[SCM] Git repository for pkg-virtuoso branch, master, updated. upstream/6.0.1.cvs20091210+dfsg2-206-g3565d20

José Manuel Santamar?==?UTF-8?Q?ía Lema panfaust at gmail.com
Tue May 22 15:15:24 UTC 2012


The following commit has been merged in the master branch:
commit ea09cba0569f0fb377063bdfdbda9121005a131e
Author: José Manuel Santamaría Lema <panfaust at gmail.com>
Date:   Tue May 22 03:54:32 2012 +0200

    Imported Upstream version 6.1.3+dfsg1

diff --git a/ChangeLog b/ChangeLog
index 6a16d4e..b534128 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,3401 @@
+2011-03-29 23:20  source
+
+	* Updated version to 6.1.3 for final release
+
+2011-03-29 22:55  source
+
+	* Fixed do not check immutable graph when dba is running
+
+2011-03-29 22:52  source
+
+	* FIxed minor issue
+
+2011-03-29 22:52  source
+
+	* FIxed ACL
+
+2011-03-29 22:49  source
+
+	* Fixed minor issue with prices
+
+2011-03-29 22:46  source
+
+	* Fixed swapped menu items
+
+2011-03-29 22:43  source
+
+	* Fixed use INFORMATION_SCHEMA.TABLES
+
+2011-03-29 21:08  source
+
+	* Fixed menu layout
+
+2011-03-29 20:14  source
+
+	* Fixed JS IE bug on profile page
+	* Small code cleanup
+
+2011-03-29 14:06  source
+
+	* Fixed typo in Makefile.am
+
+2011-03-29 12:45  source
+
+	* Fixed put absolute path for database in default virtuoso.ini
+
+2011-03-29 11:02  source
+
+	* Added alt to images in rdftab
+
+2011-03-29 10:58  source
+
+	* Fixed tuned handling of page params
+	* Fixed permalinks now encode information of which editor was used
+	  to produce the query
+
+2011-03-29 10:53  source
+
+	* Fixed must return error when cast fails
+
+2011-03-29 10:53  source
+
+	* Fixed issue with sparql filter with two optionals
+
+2011-03-29 00:31  source
+
+	* FIxed issue locating jvm runtime library location on linux x86_64
+
+2011-03-29 00:09  source
+
+	* Fixed build issue when prerequisite support .jar files not present
+
+2011-03-28 23:11  source
+
+	* Fixed check for demo data before continuing
+
+2011-03-28 17:29  source
+
+	* Added configure option for enabling mutex debugging
+
+2011-03-28 16:04  source
+
+	* Fixed dependency for VOS
+
+2011-03-28 15:56  source
+
+	* Rolled back previous patch
+
+2011-03-28 13:52  source
+
+	* Added missing files to distribution
+
+2011-03-28 12:57  source
+
+	* Fixed minor layout issue
+
+2011-03-28 12:53  source
+
+	* Added support for posh triples
+
+2011-03-28 12:52  source
+
+	* Fixed labels
+
+2011-03-28 12:22  source
+
+	* Fixed allow varbinary as input for obj
+
+2011-03-26 14:22  source
+
+	* Fixed user's pages to start with profile page
+
+2011-03-26 14:21  source
+
+	* Fixed skin handling
+
+2011-03-25 21:33  source
+
+	* Updated version
+
+2011-03-25 21:29  source
+
+	* Updated build environment for win32 and win64
+
+2011-03-25 17:47  source
+
+	* Fixed possible copy overlap on some newer C libs
+
+2011-03-25 16:23  source
+
+	* Fixed vcard handling
+
+2011-03-25 16:19  source
+
+	* Fixed encoding
+
+2011-03-25 15:10  source
+
+	* Updated testsuite
+
+2011-03-25 12:20  source
+
+	* Fixed if there is no subclass/property but there is an equivalent,
+	  then use that as the statrt point, otherwise we would not get a
+	  result
+
+2011-03-24 16:15  source
+
+	* Added bulk-loader to virtuoso binary
+
+2011-03-24 16:04  source
+
+	* Updated documentation
+
+2011-03-24 15:50  source
+
+	* Fixed do now use daq because rdf_label has two keys and soft
+	  does not work
+	* Fixed use labels if not curie or uri
+	* Fixed issue with recent dbpedia onthology
+	* Fixed labels
+	* Fixed auto-complete failed when exact match & prefix found
+
+2011-03-24 15:47  source
+
+	* Fixed use labels for IRIs only
+	* Fixed use special describe mode to avoid empty results
+	* Fixed error handling
+	* Fixed keep sas & inf
+	* Fixed bad encoding
+	* Fixed proper escape for uris
+	* Fixed wrong labels
+
+2011-03-24 13:48  source
+
+	* Fixed additional xml document parser error handling for Opera
+
+2011-03-23 16:45  source
+
+	* Added function to format rdf object for printing in html
+
+2011-03-23 12:25  source
+
+	* Fixed typo
+
+2011-03-23 12:17  source
+
+	* Added LinkedIn import
+	* Fixed duplicate addressbook entries issue
+
+2011-03-23 12:13  source
+
+	* Added rdfs schema
+	* Fixed datetime format
+	* Fixed minor issues
+
+2011-03-23 12:13  source
+
+	* Added more properties
+
+2011-03-23 12:13  source
+
+	* Fixed minor issues
+
+2011-03-23 12:03  source
+
+	* Added more options for exporting a site
+	* Added more delimiters
+	* Fixed folder DET type presentation
+	* Fixed export as text
+
+2011-03-23 12:01  source
+
+	* Fixed wrong serialization of VirtuosoExplicitString when it is
+	  binding with DV_ANY parameter
+
+2011-03-23 11:05  source
+
+	* Rebuild drivers
+
+2011-03-23 11:04  source
+
+	* Fixed issue with using _JAVA_ on sparql select
+
+2011-03-23 10:49  source
+
+	* Fixed duplicate addressbook entries issue
+
+2011-03-23 10:48  source
+
+	* Fixed broken show filter
+
+2011-03-23 10:48  source
+
+	* Fixed feeds aggregator
+
+2011-03-23 10:47  source
+
+	* Updated folder type list with 'Dynamic Resource'
+
+2011-03-23 10:37  source
+
+	* Added support for DV_RDF in v:isql rendering
+
+2011-03-23 10:35  source
+
+	* Added custom UA
+	* Fixed gunzip the zipped rdfs
+	* Fixed large pages in results
+
+2011-03-23 10:33  source
+
+	* Improved session persistence
+	* Fixed handling of XML+RDF parsing errors
+	* Fixed bugs in query cache handling/paging
+	* Fixed Cosmetics in "Raw triples" view
+	* Fixed Default view set as "Advanced" in query permalinks
+	* Fixed URL params handling so they always take precedence from
+	  persisted session
+	* Fixed bug in menu item to Reset session
+
+2011-03-23 10:28  source
+
+	* Added code to facilitate better error recovery when parsing
+	  invalid RDF+XML
+	* Fixed small code cosmetics
+
+2011-03-22 23:50  source
+
+	* Fixed missing globals
+
+2011-03-21 13:30  source
+
+	* Fixed missing variable initialization
+
+2011-03-21 10:44  source
+
+	* Fixed check if subselect has a recursive ref
+
+2011-03-18 10:51  source
+
+	* Fixed use new pages & disk reads to trigger the startup values
+
+2011-03-17 16:30  source
+
+	* Added lax mode in csv import
+
+2011-03-17 13:55  source
+
+	* Fixed when removing a join from outer's branches, do that repeatedly
+	  to remove all not needed. The recursion is done via sqlo_scope in
+	  order to get new labels for columns in select list, so process does
+	  not get confused by moving left part into FROM
+
+2011-03-17 13:53  source
+
+	* Fixed when compiling a shared query, we must have a reset context
+	  as it may jump from compiler outside of shared cache and leave
+	  a mutex locked, thus eventually can get hang
+
+2011-03-16 10:34  source
+
+	* Fixed issue with partial index when no path is followed
+
+2011-03-14 15:52  source
+
+	* Fixed return byte[] data from column with datatype = DV_ANY
+
+2011-03-14 15:47  source
+
+	* Fixed disable debug messages
+
+2011-03-14 15:46  source
+
+	* Fixed use dv_bin where needed like for dav-res
+
+2011-03-12 00:17  source
+
+	* Fixed increase delay on sequential deadlock
+
+2011-03-12 00:17  source
+
+	* Fixed labels
+
+2011-03-11 18:26  source
+
+	* Fixed use exclusive locks when doing sparul ops
+
+2011-03-11 13:08  source
+
+	* Fixed comment about missing io sect
+
+2011-03-11 13:08  source
+
+	* Added retry deadlock if session is not flushed
+
+2011-03-11 13:07  source
+
+	* Fixed do not do read ahead with less than 10k buffers available
+
+2011-03-11 12:17  source
+
+	* Fixed if no free buffer available, signal an error
+
+2011-03-11 11:28  source
+
+	* Fixed do not do read-ahead on extent map
+
+2011-03-10 23:24  source
+
+	* Added index to search over label text
+
+2011-03-09 16:41  source
+
+	* FIxed _java_ should not have effect on select
+
+2011-03-08 15:46  source
+
+	* Fixed labels in value side
+	* Fixed pages to pass W3C validator (mostly)
+	* Fixed check for integers
+	* FIxed xml excape will happen on <?V use
+
+2011-03-08 15:44  source
+
+	* Fixed hide value ranges option for now
+
+2011-03-08 15:43  source
+
+	* Fixed copyright year
+
+2011-03-08 14:32  source
+
+	* Added missing files to distribution
+
+2011-03-08 13:56  source
+
+	* Added workaround to tell _JAVA_ driver the input is string as it is
+	  confused on DV_ANY and breaks utf-8 support
+
+2011-03-08 13:44  source
+
+	* Added quick rule to check version string
+
+2011-03-08 13:44  source
+
+	* Rebuild driver
+
+2011-03-08 13:44  source
+
+	* Fixed only allow URI or Blank nodes as subjects
+
+2011-03-08 13:38  source
+
+	* Added additional crawler params
+	* Fixed show status without errors
+	* Fixed label
+
+2011-03-08 13:36  source
+
+	* Added Described By
+	* Added ProductWiki cartridge
+	* Fixed do not use triple dicts on long files
+	* Fixed OWL
+	* Fixed labels
+	* Fixed minor issues
+
+2011-03-08 13:24  source
+
+	* Updated to CKeditor version 3.5.2
+
+2011-03-08 13:08  source
+
+	* Added map markers for various types of things
+	* Added a smaller throbber animated gif
+	* Fixed resizing issue for mobile browsers
+	* Fixed bug in processing item title HREFs in map popup
+	* Fixed bugs in marker selection code using rtb:useMarker
+
+2011-03-08 12:48  source
+
+	* Fixed mime types
+	* Fixed mail rendering
+
+2011-03-08 12:47  source
+
+	* Fixed attendees
+
+2011-03-08 12:47  source
+
+	* Fixed Twitter and LinkedIn registration/login
+	* Fixed RDF object properties
+	* Fixed UI
+	* Fixed escape params
+	* Fixed scroll bars
+
+2011-03-08 12:44  source
+
+	file en.js was added on branch V6_0_0-DEVEL on 2011-03-08 13:24:39 +0000
+
+2011-03-08 12:35  source
+
+	* Added support for AddThis
+	* Added manual mode for entering location when automatic location fails
+	* Added more geocoding support
+	* Fixed location timeout to 10 sec
+	* Fixed location popup
+	* Fixed text when Javascript is not enabled
+	* Fixed bug in management of user settings
+	* Fixed bugs in session persistance
+
+2011-03-08 12:30  source
+
+	file football.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:16 +0000
+
+2011-03-08 12:30  source
+
+	file house.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:16 +0000
+
+2011-03-08 12:30  source
+
+	file info.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:16 +0000
+
+2011-03-08 12:30  source
+
+	file mail.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:16 +0000
+
+2011-03-08 12:30  source
+
+	file shield.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:17 +0000
+
+2011-03-08 12:30  source
+
+	file shoppingcart.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:17 +0000
+
+2011-03-08 12:30  source
+
+	file star.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:17 +0000
+
+2011-03-08 12:30  source
+
+	file book.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:16 +0000
+
+2011-03-08 12:30  source
+
+	file camera.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:16 +0000
+
+2011-03-08 12:30  source
+
+	file car.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:16 +0000
+
+2011-03-08 12:30  source
+
+	file coffee.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:16 +0000
+
+2011-03-08 12:30  source
+
+	file creditcards.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:16 +0000
+
+2011-03-08 12:30  source
+
+	file dollar.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:16 +0000
+
+2011-03-08 12:30  source
+
+	file drink.png was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:16 +0000
+
+2011-03-08 12:30  source
+
+	file throbber_small.gif was added on branch V6_0_0-DEVEL on 2011-03-08 13:08:15 +0000
+
+2011-03-08 12:24  source
+
+	* Fixed debug defines
+
+2011-03-08 12:19  source
+
+	* Added support for robots.txt
+
+2011-03-08 12:18  source
+
+	* Fixed update crawler entries using id and avoid table scans
+
+2011-03-08 11:52  source
+
+	* Fixed size of input buffer of an XML parser is now adaptive
+
+2011-03-08 10:38  source
+
+	* Updated version to 6.1.3-rc7
+
+2011-03-07 21:49  source
+
+	* Fixed when there is a gb node, test the sort node for dep part in
+	  the sort spec
+
+2011-03-07 12:48  source
+
+	file powder-s.owl was added on branch V6_0_0-DEVEL on 2011-03-08 13:36:27 +0000
+
+2011-03-05 00:03  source
+
+	* Updated documentation
+
+2011-03-04 14:46  source
+
+	* Fixed moved mutex lock/unlock calls to avoid deadlock
+
+2011-03-03 22:34  source
+
+	file productwiki2rdf.xsl was added on branch V6_0_0-DEVEL on 2011-03-08 13:36:28 +0000
+
+2011-03-03 17:12  source
+
+	* Added read-ahead on extent
+
+2011-03-03 17:10  source
+
+	* Fixed immutable graph setting can be a pattern, so we can disable
+	  sponging on all graphs
+
+2011-03-03 11:56  source
+
+	* Fixed DATETIME to DATE conversions
+
+2011-03-02 12:24  source
+
+	* Fixed issue with special sparql variables
+
+2011-03-02 12:24  source
+
+	* Fixed issue with qualifier in SQLForeignKeys
+
+2011-03-01 19:35  source
+
+	* Fixed initialization of defaults
+
+2011-03-01 19:32  source
+
+	* Fixed set HTTP status to 503 when showing maintenance page and
+	  added a Retry-After: 1800 (seconds) header as a hint to the remote
+
+2011-02-28 17:02  source
+
+	* Fixed issue if data did not generate prefix2iri hash
+
+2011-02-28 13:47  source
+
+	* Fixed check for 5xx or 4xx status codes
+
+2011-02-26 08:35  source
+
+	* Added http maintenance functions
+
+2011-02-25 17:31  source
+
+	* Fixed only start from the beginning when there is a thread else we
+	  could get into a busy loop
+
+2011-02-23 21:35  source
+
+	* Fixed bad regexp
+
+2011-02-23 17:31  source
+
+	* Fixed size of input buffer of an XML parser is made adaptive
+
+2011-02-21 13:36  source
+
+	* Added support for named parameters
+
+2011-02-20 16:14  source
+
+	* Fixed increase the size of the input buffer of the TURTLE lexer
+	  for file resources, in order to improve disk access pattern if many
+	  resources are loaded in parallel
+
+2011-02-18 15:49  source
+
+	* Updated version to 6.1.3-rc6
+
+2011-02-18 15:49  source
+
+	* Fixed issue with scalar subq with SSG_VALMODE_NUM output as in TPCD
+
+2011-02-18 15:37  source
+
+	* Updated version
+
+2011-02-18 15:36  source
+
+	* Added language and type options for offers
+
+2011-02-18 15:32  source
+
+	* Fixed issues with map sizing
+
+2011-02-18 15:30  source
+
+	* Fixed rdftab height for maps
+
+2011-02-18 11:19  source
+
+	* Added initial codegen for ASK subquery
+	* Fixed issue with sponging options and DESCRIBE on /sparql endpoint
+
+2011-02-18 11:16  source
+
+	* Fixed "serialize" debugging output of many threads and label
+	  messages of different threads
+
+2011-02-18 11:14  source
+
+	* Added better support of "seealso" predicate in case of recursive
+	  sponging
+
+2011-02-18 10:37  source
+
+	* Fixed use mem pool to release all objects if an error occurs
+
+2011-02-18 10:24  source
+
+	* Regenerated drivers
+
+2011-02-18 10:24  source
+
+	* Fixed issue with closing XAConnection and connectionpool
+
+2011-02-17 15:23  source
+
+	* Fixed more log info
+
+2011-02-16 21:08  source
+
+	* Updated documentation
+
+2011-02-16 20:55  source
+
+	* Fixed iSPARQL icons placed on Home screen on iPhone/iPod now have the
+	  WebApp appearance (i.e. no URL bar, etc. controls.)
+	* Fixed a regression causing reappearance of Ubiq gem on non-firefox browsers
+	* Fixed missing message candlers for geocoding module
+	* Disabled buggy location UI absorbing into statusui
+	* Improved formatting of errors in response tab somewhat
+
+2011-02-16 20:53  source
+
+	* FIxed avoid long URLs to generate wacky error
+
+2011-02-16 20:51  source
+
+	* Fixed missing line
+
+2011-02-16 17:33  source
+
+	* Fixed offers SIOC data
+
+2011-02-16 17:33  source
+
+	file login_keys.vspx was added on branch V6_0_0-DEVEL on 2011-02-16 20:58:16 +0000
+
+2011-02-16 17:32  source
+
+	* Fixed if no svc and FF then show generator page
+
+2011-02-16 17:32  source
+
+	* Fixed typo
+
+2011-02-16 17:31  source
+
+	* Fixed missing case
+
+2011-02-16 17:25  source
+
+	* Fixed status controls
+
+2011-02-16 17:25  source
+
+	* Fixed proper position
+
+2011-02-16 17:20  source
+
+	* Added support for map marker URLs in OAT.RDFTabs.map
+	* Fixed OAT.RDFTab.map control height on iPhone
+	* Fixed bug causing OAT.RDFTABs.navigator layout flowing into footer
+	* Fixed navigator layout
+
+2011-02-16 17:16  source
+
+	* Fixed separate virtrdf:label into own file
+
+2011-02-16 17:16  source
+
+	file virt_rdf_label.sql was added on branch V6_0_0-DEVEL on 2011-02-16 20:53:22 +0000
+
+2011-02-16 17:08  source
+
+	* Fixed ADO.NET datatype handling
+	* Fixed null pointer exception
+
+2011-02-15 14:45  source
+
+	* Fixed memory leaks
+
+2011-02-15 14:11  source
+
+	* Fixed signal errors other than deadlock
+
+2011-02-15 14:05  source
+
+	* Fixed issues with --with-debug and setting CFLAGS
+
+2011-02-15 10:11  source
+
+	* Fixed missing prototype
+	* Fixed after free data_col make sure it is nil
+
+2011-02-14 13:05  source
+
+	* Updated version to 6.1.3-rc5
+
+2011-02-14 13:04  source
+
+	* Fixed certificates
+
+2011-02-14 13:03  source
+
+	* Fixed page load bug
+
+2011-02-14 13:03  source
+
+	* Added RSS and Atom imports
+
+2011-02-14 13:03  source
+
+	* Fixed issue with dashboard
+
+2011-02-14 13:03  source
+
+	* Fixed mail selection from private instances
+	* Fixed encrypted emails
+
+2011-02-14 12:51  source
+
+	* Added rudimentary geocoder support module
+	* Fixed endpoints options tolle menu
+	* Fixed title to "Sponger"
+	* Fixed header margins
+	* Fixed ordering of Sponger and Query Metadata
+	* Fixed location error handler failure to change aquire state
+	* Fixed statement help popup window
+
+2011-02-14 12:49  source
+
+	* Fixed try to resize map in a more mobile friendly way
+
+2011-02-14 12:48  source
+
+	* Added more properties to virtlabel ontology
+	* Fixed issues reported by W3C Validator
+
+2011-02-14 12:33  source
+
+	* Fixed compiler warnings on SOlaris with openssl 1.0
+
+2011-02-14 11:48  source
+
+	* Fixed when P is known get stats on it to make better decision on
+	  execution plan
+
+2011-02-14 11:48  source
+
+	* Fixed infinite loop when dealing with string like abc&def and no token
+
+2011-02-14 01:25  source
+
+	* Fixed dump all mem references before dying
+
+2011-02-14 01:14  source
+
+	* Fixed issue when client disconnects inside compile where no reset ctx
+
+2011-02-11 13:19  source
+
+	* Added ssl const decoration in explain
+
+2011-02-10 20:58  source
+
+	* Added new bif getenv
+
+2011-02-07 15:07  source
+
+	* Fixed attribution
+
+2011-02-04 15:36  source
+
+	* Added check for max number of elements
+
+2011-02-03 13:30  source
+
+	* Fixed check if there is dpipes to be placed before trans node
+
+2011-02-03 11:27  source
+
+	* Fixed when compiling statement with sparqre_qi == CALLER_LOCAL, do
+	  not pass this value to box_cast
+
+2011-02-03 10:32  source
+
+	* Fixed issue with namespace pollution in FireFox
+
+2011-02-03 10:30  source
+
+	* Added separate sponge and ack for rdf flags
+	* Fixed copyright year
+
+2011-02-03 10:29  source
+
+	* Added pure RDFa cartridge
+	* Fixed copyright year
+
+2011-02-03 10:28  source
+
+	* Fixed geolocation to automatically use a location if a minimum
+	  accuracy is reached. Default=500m
+	* Fixed creation of options in anchor which did not work with FireFox
+	* Fixed copyright year
+
+2011-02-03 09:26  source
+
+	* Fixed box_cast when qst is CALLER_LOCAL
+
+2011-02-03 09:25  source
+
+	* Fixed copyright year
+
+2011-02-02 15:36  source
+
+	* Fixed make sure boxlen is within limits
+
+2011-02-02 12:06  source
+
+	* Added separate sponge and ack for rdf flags
+
+2011-02-02 11:28  source
+
+	* Added new location properties and datatypes
+
+2011-02-01 00:07  source
+
+	* Fixed use origin as base
+
+2011-02-01 00:07  source
+
+	* Added support for virtrdf:image
+
+2011-01-31 20:47  source
+
+	* Fixed declaration after statement
+
+2011-01-31 15:23  source
+
+	* Fixed to follow http redirects
+
+2011-01-31 15:23  source
+
+	* Fixed memory leak if QUIETCAST query operates with ill formed
+	  data such as invalid date/time
+
+2011-01-31 11:17  source
+
+	* Fixed problem with upstreaming of updated and deleted posts
+	* Fixed problem with triggers
+
+2011-01-31 11:16  source
+
+	* Added virtrdf-label for iCalendar
+
+2011-01-31 11:15  source
+
+	* Fixed CSS of execution grid
+
+2011-01-31 10:48  source
+
+	* Fixed RDFa cartridge
+
+2011-01-31 10:45  source
+
+	* Added UI for Login Authentication Keys
+
+2011-01-30 15:23  source
+
+	* Fixed box_cast so QUIETCAST mode returns NULL instead of error
+	  even if the problem is detected in some nested function
+
+2011-01-28 17:34  source
+
+	* Fixed when on a queue, i.e. waiting for compile to finish, we freeze
+	  the thread so cpt can proceed
+
+2011-01-28 13:35  source
+
+	* Added namespace prefix 'fn' for 'http://www.w3.org/2005/xpath-functions/#'
+	  for XPATH 2.0 and XQuery 1.0 Core Functions library
+
+2011-01-28 13:34  source
+
+	* Fixed detection of bad blank nodes
+
+2011-01-28 13:32  source
+
+	* Fixed compiler warnings
+
+2011-01-28 13:31  source
+
+	* Added numeric_from_string_is_ok to do quick syntax check on string
+	  without actual parsing
+
+2011-01-28 13:29  source
+
+	* Added support for "xpath:function_IRI" syntax, which is usally an
+	  internal syntax for functions automatically recognized as XPATH
+
+2011-01-28 13:28  source
+
+	* Fixed compiler warning
+
+2011-01-28 13:28  source
+
+	* Added xqr_stub_for_funcall
+	* Fixed memory leak
+
+2011-01-28 13:26  source
+
+	* Fixed cast to xsd:float
+
+2011-01-28 13:26  source
+
+	* Fixed moved free inside of semaphore
+
+2011-01-27 14:19  source
+
+	* Fixed use default smime
+
+2011-01-27 13:30  source
+
+	* Fixed wrong condition check
+
+2011-01-27 12:43  source
+
+	* Added support for S/MIME encrypt and decrypt
+
+2011-01-26 17:52  source
+
+	* Fixed missing namespace in </results>
+
+2011-01-25 19:15  source
+
+	* Fixed cost model to count inx cond and scale card at end
+
+2011-01-25 18:54  source
+
+	* Fixed in log replay we can drop the old objects to free memory
+
+2011-01-25 14:51  source
+
+	* Updated version to 6.1.3-rc4
+
+2011-01-25 14:39  source
+
+	* Fixed allocate space for \0 terminator
+
+2011-01-25 14:38  source
+
+	* Fixed memory leak
+
+2011-01-25 14:36  source
+
+	* Fixed compiler warning
+
+2011-01-25 14:35  source
+
+	* Added configurable normalization of accented characters
+
+2011-01-25 14:33  source
+
+	* Fixed compiler warnings
+
+2011-01-25 14:32  source
+
+	* Fixed wrong buffer
+
+2011-01-25 14:30  source
+
+	* Fixed crawling aside of the target
+	* Fixed no more need of dummy targets
+	* Fixed decrease use of lock on site table
+
+2011-01-25 14:29  source
+
+	* Fixed python initialization
+
+2011-01-25 14:11  source
+
+	* Aded linkedIn login/register
+	* Fixed bad profile UI
+	* FIxed hyperlink session expire issue
+
+2011-01-25 14:09  source
+
+	* Fixed use base as origin on zillow
+
+2011-01-25 14:09  source
+
+	* Fixed do not try to put headers when an error is detected
+
+2011-01-25 14:07  source
+
+	* Fixed connection check page
+	* Fixed error message generation in execute
+	* Fixed Preferences dialog
+
+2011-01-25 14:00  source
+
+	* Fixed cosmetics and layout
+
+2011-01-25 13:53  source
+
+	* Added RDF graph property for links
+
+2011-01-25 13:52  source
+
+	* Added IMAP support
+
+2011-01-25 13:51  source
+
+	* Fixed install issue with new DB
+	* Fixed parent
+
+2011-01-25 13:50  source
+
+	* Fixed UI
+
+2011-01-25 13:17  source
+
+	* Updated documentation
+
+2011-01-22 14:12  source
+
+	* Fixed check for blank node in wrong places
+
+2011-01-21 13:43  source
+
+	* Fixed no need to access .cfg file for plain ?query= call
+
+2011-01-19 13:17  source
+
+	* Fixed codegen for xsd:decimal() and similar cast operations
+
+2011-01-18 14:36  source
+
+	* Added configurable normalization of accented characters
+
+2011-01-18 14:32  source
+
+	file unicode3_basechars.h was added on branch V6_0_0-DEVEL on 2011-01-18 14:36:37 +0000
+
+2011-01-18 10:41  source
+
+	* Added normalization of accented characters
+
+2011-01-18 10:32  source
+
+	* Fixed debug code
+
+2011-01-18 10:31  source
+
+	* Fixed more debug output for xte_word_range
+
+2011-01-11 22:41  source
+
+	* Fixed compiler warnings
+
+2011-01-11 22:38  source
+
+	* Fixed whitespace
+
+2011-01-11 13:18  source
+
+	* Added mime_header function to parse rfc header of mail message
+
+2011-01-11 13:14  source
+
+	* Fixed commented out bogus help button
+
+2011-01-11 13:13  source
+
+	* Added more prefixes
+
+2011-01-11 13:12  source
+
+	* Added new entries to virtrdf-label
+
+2011-01-11 10:33  source
+
+	* Added new SPARQL-to-SQL codegen for type cast functions
+
+2011-01-11 10:32  source
+
+	* Fixed set box flags to BF_IRI in this special case as graphs are IRIs
+
+2011-01-10 20:49  source
+
+	* Added transitivity cache
+
+2011-01-10 16:56  source
+
+	* Fixed bifs returning int or date should use same cast as auto
+
+2011-01-10 13:23  source
+
+	* Fixed width of users, capabilities listings
+
+2011-01-10 13:22  source
+
+	* Fixed use sitemaps for default crawling, option for depth
+	* Fixed links conversion should be off by default
+	* Fixed issue with listing
+
+2011-01-10 11:51  source
+
+	* FIxed missing initialization
+
+2011-01-07 17:18  source
+
+	* Fixed set timeout only when non empty
+
+2011-01-07 15:42  source
+
+	* Fixed when explicit output format is give, make it part of the
+	  query text so don't cache eventual internal guess to turtle output
+
+2011-01-07 15:08  source
+
+	* Added cxml and csv links
+	* Fixed link layout
+
+2011-01-07 14:12  source
+
+	* Fixed allow bigger header values to be returned
+
+2011-01-05 20:58  source
+
+	* Added optional QRcode
+	* Added CXML link typing dropdowns to fct UI
+	* Added search query limit of 100 words
+	* Added CXML and CSV links on describe page
+
+2011-01-05 20:14  source
+
+	* Fixed declaration after statement warning
+
+2011-01-05 13:58  source
+
+	* Fixed search and page load behaviour
+	* Fixed RefByAll result page
+
+2011-01-05 12:45  source
+
+	* Fixed align at 8 when double align defined
+	* Fixed always return NULL when allocation failed
+
+2011-01-05 12:44  source
+
+	* Fixed compiler warnings
+
+2011-01-05 12:36  source
+
+	* Added OWL mime type
+
+2011-01-05 01:58  source
+
+	* Fixed stats on inference
+
+2011-01-03 23:37  source
+
+	* Added client-based HTTP auth support in OAT.Ajax
+	* Fixed bug in RDFStore handling of hasNamespacePrefix that caused
+	  corruption
+	* Fixed error in dialog button handler
+	* Fixed typo in insertIRIArr
+	* Fixed several issues in RDFTabs related to RDFStore changes
+
+2011-01-03 21:23  source
+
+	* Fixed json tcn
+
+2011-01-03 21:22  source
+
+	* Added optional vCal QRCode
+	* Fixed date change in events/tasks
+
+2011-01-03 21:21  source
+
+	* Added optional vCard QRCode
+
+2011-01-03 21:21  source
+
+	* Fixed UI of maintenance page
+	* Fixed ref-by command output
+
+2011-01-03 21:14  source
+
+	* Fixed detect iSPARQL Server Connection using PROPFIND
+	* Fixed link behaviour in SPARQL result set view is now
+	  controlled by dropdown
+	* Fixed Save/serialize in .ldr/.isparql file types
+
+2011-01-03 21:11  source
+
+	* Added option for crawl depth
+	* Added check for gzip magic header
+	* Fixed use sitemaps for default crawling
+	* Fixed no clean opt
+	* Fixed optmimize queue recovery
+	* Fixed when */xml reported butthe content is gziped, the client
+	  will decode on the fly
+
+2011-01-03 21:09  source
+
+	* Added properties to enable HTTP DIGEST auth on some browsers
+
+2011-01-03 21:02  source
+
+	file eol2rdf.xsl was added on branch V6_0_0-DEVEL on 2011-01-03 23:40:02 +0000
+
+2011-01-03 21:02  source
+
+	file groupon2rdf.xsl was added on branch V6_0_0-DEVEL on 2011-01-03 23:40:02 +0000
+
+2011-01-03 21:02  source
+
+	* Added Groupon cartridge
+	* Added RDFohloh cartridge
+	* Added EOL cartridge
+	* Fixed use common API to delete target
+	* Fixed minor issues
+
+2011-01-03 10:21  source
+
+	* Added support for FILTER EXISTST and FILTER NOT EXISTS
+	* Added partial support for MINUS
+
+2011-01-03 10:18  source
+
+	* FIxed minor issues
+
+2011-01-03 10:17  source
+
+	* Fixed issue with large number of namespace declarations
+
+2010-12-23 16:33  source
+
+	* Fixed JSON tcn for host-meta
+
+2010-12-22 20:58  source
+
+	* Fixed default options
+
+2010-12-22 10:31  source
+
+	* Fixed issue with aggregates and ORDER BY
+
+2010-12-22 10:27  source
+
+	* Fixed issue with DATATYPE
+
+2010-12-22 10:25  source
+
+	* Fixed string is aligned to 8
+	* Fixed wide data must be presented as UTF8 before hash chksum
+
+2010-12-21 12:27  source
+
+	* Fixed whitespace
+
+2010-12-21 10:42  source
+
+	* Added retry on deadlock when sponging on multiple threads
+
+2010-12-20 21:43  source
+
+	* Updated version to 6.1.3-rc2
+
+2010-12-20 19:12  source
+
+	* Fixed minor issue
+
+2010-12-20 18:20  source
+
+	* Fixed layout to make optional qrcode fit without wasting space
+	* Fixed tabs CSS and overall margins etc
+
+2010-12-20 18:09  source
+
+	* Fixed sqltype and display size of DV_IRI_ID column
+
+2010-12-20 13:26  source
+
+	* Fixed merge error
+
+2010-12-20 12:31  source
+
+	* Fixed missing column error in SPARQL-to-SQL preprocessor
+
+2010-12-20 12:27  source
+
+	* Added support for Twitter
+	* Added JSON format for webfinger
+	* Added optional qrcode
+
+2010-12-20 12:26  source
+
+	* Fixed missing files from vad
+
+2010-12-20 12:26  source
+
+	* Added progress bar, ping and ACL
+
+2010-12-20 12:22  source
+
+	* Added option to use tidy before loading rdfa
+
+2010-12-20 11:34  source
+
+	* Fixed minor issues
+
+2010-12-17 17:40  source
+
+	* Added support for connection string parameters with or without
+	  spaces in name
+	* Fixed removed workaround for rollback msg
+
+2010-12-17 11:27  source
+
+	* Fixed must not return error during rollback on killed txn
+
+2010-12-16 19:47  source
+
+	* Fixed sparql select (1) { { ?:sss ?p ?o } optional { ?s1 ?p1 ?o1 }}
+	  (t1.S=sss condition was lost before)
+
+2010-12-15 15:25  source
+
+	* Fixed index_only on partial can return has data even if main row
+	  does not
+
+2010-12-15 12:47  source
+
+	* Added small optimizations
+
+2010-12-15 12:19  source
+
+	* Added optimization to look at GS index only
+
+2010-12-15 10:42  source
+
+	* Added support for define input:inference in SAPRQL DESCRIBE
+
+2010-12-14 19:18  source
+
+	* Added JSON format for /.well-known/host-meta
+
+2010-12-14 13:22  source
+
+	* Fixed cxml generation options
+
+2010-12-14 13:22  source
+
+	* Fixed compiler warning
+
+2010-12-14 12:10  source
+
+	* Fixed use CURI to make smaller footprint
+
+2010-12-14 12:07  source
+
+	* Fixed hreview aggreates
+	* Fixed use CURI to make smaller qrcode
+	* Fixed CRLF
+
+2010-12-14 11:50  source
+
+	file hreview_aggregate2rdf.xsl was added on branch V6_0_0-DEVEL on 2010-12-14 12:07:57 +0000
+
+2010-12-13 21:32  source
+
+	* Fixed 'none' is a special case with value 1
+
+2010-12-13 15:08  source
+
+	* Fixed crash when only option inference is given without define
+
+2010-12-13 15:08  source
+
+	* Fixed cxml
+
+2010-12-13 11:17  source
+
+	* Fixed utf8_exec server issue
+
+2010-12-13 10:24  source
+
+	* Fixed comparison of VARCHAR and UNAME box whith identical content
+
+2010-12-13 10:23  source
+
+	* Added three new aggregates mostly for use with SPARQL-BI
+
+2010-12-13 10:22  source
+
+	* Added support for passing NVARCHAR arguments to thread-safe dicts
+
+2010-12-13 10:20  source
+
+	* Fixed check for mobile devices
+
+2010-12-12 18:09  source
+
+	* Added RDFa W3c validation button
+	* Added missing default XSL setting classes as view
+	* Added optional qrcode in page
+	* Added scrolling to use stop skip/N
+	* Added link to /sparql endpoint
+	* Fixed sid
+	* Fixed shortened uri if too long
+	* Fixed bookmarable urls
+
+2010-12-10 16:12  source
+
+	* Updated documentation
+
+2010-12-10 16:02  source
+
+	* Removed extra debugging
+	* Fixed comments
+
+2010-12-10 15:43  source
+
+	* Fixed minor issues
+
+2010-12-10 15:28  source
+
+	* Added new settings to execute.html
+	* Added hrefs to breadcrumbs in rdftab
+	* Added a pager for queries.
+	* Added URI shortener detection and user preference (persisted in
+	  HTML5 localStorage on compatible browsers)
+	* Changed the way results are cached.
+	  Each query owns its results store, which is passed to the RDFMini
+	  for display.
+
+2010-12-10 15:27  source
+
+	* Altered the order of preference for subject labels.
+	* Fixed rdfs:label and skos:prefLabel now take preference over
+	  foaf:name.
+	* Changed OAT.Dialog to accept a bitmap for buttons to include
+	  Should be (sort-of) backwards compatible (default value and setting
+	  to zero causes same behavior as before)
+
+2010-12-10 15:19  source
+
+	* Merged from V5
+
+2010-12-10 15:18  source
+
+	* Fixed do not do row autocommit when uploading with DAV api
+	  as this will break trigger logic
+
+2010-12-10 12:24  source
+
+	* Added new testcases
+
+2010-12-10 12:00  source
+
+	* Fixed deref of uninitialized memory
+
+2010-12-10 11:59  source
+
+	* FIxed uninitialized variable
+
+2010-12-10 11:58  source
+
+	* Fixed deref of uninited memory
+
+2010-12-09 14:00  source
+
+	* Fixed FOAF import
+
+2010-12-09 13:57  source
+
+	* Fixed convert link option
+
+2010-12-09 12:16  source
+
+	file hrecipe2rdf.xsl was added on branch V6_0_0-DEVEL on 2010-12-09 12:36:06 +0000
+
+2010-12-09 12:16  source
+
+	* Added hRecipe cartridge
+
+2010-12-09 09:53  source
+
+	* Fixed NULL case in patch_restricted_xml_chars()
+
+2010-12-08 16:08  source
+
+	* Fixed sparql aggregate
+
+2010-12-08 16:04  source
+
+	* Added RDFa W3c validation button
+	* Added expiration header
+	* Fixed DOI and RDFa
+	* Fixed use doi proxy if no hslookup plugin
+	* Fixed datatype for twitter
+	* Fixed tidy for overstock cartridge
+	* Fixed enable xlat iris
+	* Fixed small bugs
+
+2010-12-07 11:30  source
+
+	* Updated version of adapter
+
+2010-12-07 11:11  source
+
+	* Added 'Owns', 'Knows' and 'Social Network'
+	* Added profile security for offers, likes etc
+	* Enhanced import procedure
+	* Fixed small issues
+
+2010-12-07 10:38  source
+
+	file index.vspx was added on branch V6_0_0-DEVEL on 2010-12-07 10:59:24 +0000
+
+2010-12-07 10:38  source
+
+	* Added microblog template
+
+2010-12-07 10:38  source
+
+	file default.css was added on branch V6_0_0-DEVEL on 2010-12-07 10:59:24 +0000
+
+2010-12-07 10:35  source
+
+	file uiedit_knows.vspx was added on branch V6_0_0-DEVEL on 2010-12-07 11:11:31 +0000
+
+2010-12-07 10:35  source
+
+	file uiedit_others.vspx was added on branch V6_0_0-DEVEL on 2010-12-07 11:11:31 +0000
+
+2010-12-07 10:35  source
+
+	file uiedit_owns.vspx was added on branch V6_0_0-DEVEL on 2010-12-07 11:11:31 +0000
+
+2010-12-07 10:32  source
+
+	* Added 'Knows' to the import
+	* Enhanced import procedure
+
+2010-12-06 17:10  source
+
+	* Added MinExpiration param for sponger
+
+2010-12-06 17:09  source
+
+	* Fixed minor issues
+
+2010-12-06 17:08  source
+
+	* FIxed show better message instead of error on url parse
+
+2010-12-06 10:34  source
+
+	* Fixed max dns name is 250 chars
+
+2010-12-06 10:34  source
+
+	* Added copy_list_to_array and revlist_to_array for plugins
+
+2010-12-06 10:33  source
+
+	* Fixed if we have bad fd in saved sessions, check which one and
+	  remove, to avoid busy loop on unix
+
+2010-11-30 12:34  source
+
+	* Fixed use char flags instead of bitfield
+
+2010-11-30 12:33  source
+
+	* Added optimization for case when there is no locality
+
+2010-11-30 12:33  source
+
+	* Fixed must lock mtx before reading cache
+
+2010-11-29 14:37  source
+
+	* FIxed minor issues
+
+2010-11-29 14:36  source
+
+	* Added statistics on how many remaps are free
+
+2010-11-26 21:23  source
+
+	* Fixed busy loop when no free remaps
+
+2010-11-26 10:47  source
+
+	* Added extra debugging on shared cache
+
+2010-11-26 10:46  source
+
+	* Fixed issue compiling extensions in debug mode
+
+2010-11-25 19:53  source
+
+	* Fixed must cut before print else will return wrong error
+
+2010-11-24 11:41  source
+
+	* Fixed use external bif_tidy in the crawler
+
+2010-11-24 11:36  source
+
+	* Fixed mark transaction as ended in provider if virtuoso server kills
+	  the transaction
+
+2010-11-23 19:30  source
+
+	* FIxed issue with DISTINCT and ORDER BY
+
+2010-11-23 19:28  source
+
+	* FIxed "delayed" crash in case of passing wrong argument
+
+2010-11-23 19:27  source
+
+	* Added check for tidy in crawler
+
+2010-11-23 19:26  source
+
+	* Fixed minor issue
+
+2010-11-23 10:20  source
+
+	* Fixed bad test
+
+2010-11-22 20:40  source
+
+	* Fixed issue with sparql-fed
+
+2010-11-22 20:39  source
+
+	* Fixed prevent assert on large box
+
+2010-11-22 14:26  source
+
+	* Fixed issue with bnode
+
+2010-11-22 11:28  source
+
+	* Added VirtuosoQueryEngine auto registration was added to VirtGraph
+	  static initilization
+
+2010-11-22 11:06  source
+
+	* Rebuild driver
+
+2010-11-22 11:00  source
+
+	* Rebuild drivers
+
+2010-11-22 10:59  source
+
+	* Fixed JDBC driver lost prepared data after execution query, so next
+	  execute of prepared query throws exception
+
+2010-11-20 10:57  source
+
+	* Added bif patch_restrictec_xml_chars()
+
+2010-11-19 16:50  source
+
+	* Added Likes and DisLikes
+
+2010-11-19 16:49  source
+
+	* Added group sharing
+	* Fixed extended user's select
+
+2010-11-19 16:47  source
+
+	* Updated to ckeditor version 3.4.2
+
+2010-11-19 16:45  source
+
+	* Added optimizations
+	* Added checking for rdfa dtd
+
+2010-11-19 16:43  source
+
+	* Fixed use integer for https_verity and https_cv_depth
+	* Fixed use uppercase for SSL auth
+
+2010-11-19 16:41  source
+
+	* Added setup for DET on collections
+
+2010-11-19 14:25  source
+
+	* Fixed wrong number of params
+
+2010-11-19 14:25  source
+
+	* Fixed busy loop
+
+2010-11-18 12:09  source
+
+	file uiedit_likes.vspx was added on branch V6_0_0-DEVEL on 2010-11-19 16:50:49 +0000
+
+2010-11-18 12:07  source
+
+	file icons_rtl.png was added on branch V6_0_0-DEVEL on 2010-11-19 16:47:48 +0000
+
+2010-11-17 21:30  source
+
+	* Added function to get DTD identifiers
+
+2010-11-17 21:29  source
+
+	* Fixed dimension is not in triples
+
+2010-11-17 21:29  source
+
+	* Fixed page debug
+
+2010-11-17 21:28  source
+
+	* Fixed name in footer
+
+2010-11-17 21:27  source
+
+	* Added initialize query text option for /sparql
+
+2010-11-16 20:17  source
+
+	* Fixed do not try to close bad filedescriptor as windows does not
+	  like this
+
+2010-11-16 14:30  source
+
+	* Added imap client support
+
+2010-11-15 20:12  source
+
+	* Fixed if we have a qr with no params at all, exec should signal error
+
+2010-11-15 16:51  source
+
+	* Fixed issue with combination of UNION in the argument of IN causing
+	  General internal Optimized compiler error
+
+2010-11-15 16:47  source
+
+	* Fixed record the thread which entered/left the buffer in debug mode
+
+2010-11-15 10:13  source
+
+	* Fixed do not attempt to parse empty content
+
+2010-11-12 21:01  source
+
+	* Fixed only check pages in online backup
+
+2010-11-12 21:00  source
+
+	* Fixed recovery mode
+
+2010-11-12 21:00  source
+
+	* Fixed send body of 509 bandwidth error
+
+2010-11-11 16:06  source
+
+	* Updated version to 6.1.3-rc1
+
+2010-11-11 15:53  source
+
+	* Fixed check for sql disabled flag
+
+2010-11-11 12:38  source
+
+	* Fixed group editing
+	* Fixed WebID for Briefcase instances
+
+2010-11-11 12:34  source
+
+	* Added group sharing
+
+2010-11-11 11:23  source
+
+	* Added special immutable setting for inf rules
+
+2010-11-10 15:59  source
+
+	* Fixed use dsn from content-location when it exists
+
+2010-11-10 15:45  source
+
+	* Fixed pass headers as options so every cartridge can read
+
+2010-11-10 12:00  source
+
+	* Added magic key export
+
+2010-11-10 11:59  source
+
+	* Fixed stack corruption on 64bit
+
+2010-11-09 21:47  source
+
+	* Fixed memleak when error is signalled
+
+2010-11-09 21:44  source
+
+	* Fixed avoid re-define
+
+2010-11-09 21:42  source
+
+	* Fixed remove call to SP before it is defined
+
+2010-11-09 20:19  source
+
+	* Fixed https access
+	* Fixed ACL UI
+
+2010-11-09 20:18  source
+
+	* Added support for SWD
+	* Added support for Salmon
+	* Added RDFa info
+	* Fixed key removal not working
+	* Fixed bad permissions for user's home directory creation
+	* Fixed no validator at this point
+	* Fixed sync user's pages
+	* Fixed salmon api
+	* Fixed move groups from briefcase into framework
+
+2010-11-09 20:15  source
+
+	* Added initial support for Salmon protocol
+	* Fixed check for email
+	* Fixed uninstall problem
+
+2010-11-09 20:12  source
+
+	* Added signed mails
+	* Fixed https access
+
+2010-11-09 20:12  source
+
+	* Fixed move groups from briefcase into ODS framework
+	* Fixed https access
+
+2010-11-09 20:11  source
+
+	* Fixed https access
+	* Fixed labels
+
+2010-11-09 20:11  source
+
+	* Fixed https access
+
+2010-11-09 20:01  source
+
+	* Fixed properly encode the query before passing it to PivotViewer
+
+2010-11-09 19:59  source
+
+	* Fixed more labels
+
+2010-11-09 10:59  source
+
+	* Fixed split part of MTX_DEBUG into PAGE_DEBUG
+
+2010-11-08 15:42  source
+
+	* Fixed prevent bad data to crash system during deserialization
+
+2010-11-08 12:37  source
+
+	* Added http://loc.openlinksw.com/sparql as registered endpoint
+	* Fixed URIs in resultview anchors
+
+2010-11-08 12:35  source
+
+	* Fixed return string session, rather than allocate string so it will
+	  handle large resources
+	* Fixed possible double free of temp filename
+	* Fixed issue with MALLOC_DEBUG
+
+2010-11-08 12:21  source
+
+	* Fixed ACL update
+
+2010-11-08 11:46  source
+
+	* Fixed minor issue
+
+2010-11-08 11:45  source
+
+	* Added ACL settings
+	* Added new type
+	* Added CORS options
+	* Fixed layout of cert generation form
+	* Fixed label of cartridges
+
+2010-11-08 11:26  source
+
+	file construct_body.xsl was added on branch V6_0_0-DEVEL on 2010-11-09 20:12:59 +0000
+
+2010-11-08 11:25  source
+
+	file SWD.sql was added on branch V6_0_0-DEVEL on 2010-11-09 20:18:21 +0000
+
+2010-11-08 11:08  source
+
+	* Added check by entity type
+
+2010-11-05 20:23  source
+
+	* Fixed check dp before processing
+
+2010-11-05 10:57  source
+
+	* Fixed explanation of rdf inf failures
+
+2010-11-05 10:56  source
+
+	* Fixed bad condition of extension, do not push local imports
+
+2010-11-05 10:54  source
+
+	* Fixed  /sparql/ endpoint to show/hide controls
+	* Fixed show supported formats depending on configuration
+
+2010-11-05 10:53  source
+
+	* Fixed CXML desc support
+
+2010-11-04 18:18  source
+
+	* Fixed typo
+
+2010-11-02 19:14  source
+
+	* Added cxml det
+
+2010-11-02 19:12  source
+
+	* Fixed top/skip should only work for  non-multistate
+	* Fixed recover when itc is unregistered
+
+2010-11-01 14:15  source
+
+	* FIxed only skip when initialized
+
+2010-10-29 14:12  source
+
+	* Fixed when pl stats collection is enabled, the hash must be
+	  protected in order to avoid crash
+
+2010-10-29 14:11  source
+
+	* Fixed when count/sum/avg and other aggregates make columns to be the
+	  respective type e.g. int or double, except when performing min/max
+	  on string, we turn off mem_cache_only, so they can goto disk
+
+2010-10-29 14:09  source
+
+	* Fixed unbalanced } outside ifdef
+
+2010-10-29 14:08  source
+
+	* Added function alias
+
+2010-10-29 14:08  source
+
+	* Fixed when selection list contains expressions with constants do
+	  not inline OJ
+
+2010-10-27 12:59  source
+
+	* Fixed issues with sparql fed
+
+2010-10-27 12:56  source
+
+	* Added new bif functions dict_iter_hash and dict_key_eq
+
+2010-10-27 12:55  source
+
+	* Added page enter debugging
+
+2010-10-27 12:53  source
+
+	* Added support for CORS
+
+2010-10-27 12:52  source
+
+	* Fixed check all the cos in gby to be numeric types
+
+2010-10-27 12:51  source
+
+	* Added debug line pragmas
+
+2010-10-27 12:50  source
+
+	* Fixed debug assert for itc_is_registered
+
+2010-10-25 13:23  source
+
+	* Fixed compiler warnings
+
+2010-10-25 13:19  source
+
+	* Fixed rdf boxes cmp
+	* Fixed rdf inf loading
+
+2010-10-25 13:15  source
+
+	* Fixed allow all users to have user_t so they can have their own
+	  encryption keys
+
+2010-10-25 12:38  source
+
+	file salmon.sql was added on branch V6_0_0-DEVEL on 2010-11-09 20:18:22 +0000
+
+2010-10-25 12:38  source
+
+	file uiedit_acl.vspx was added on branch V6_0_0-DEVEL on 2010-11-09 20:18:22 +0000
+
+2010-10-25 12:38  source
+
+	file uiedit_acls.vspx was added on branch V6_0_0-DEVEL on 2010-11-09 20:18:23 +0000
+
+2010-10-22 21:12  source
+
+	* Added contols to add text filters
+	* Added support for creating new ses with class iri filter
+	* Added choose type and start/continue facets browsing session to rdfdesc
+	* Fixed drop text constraint
+	* Fixed view types
+
+2010-10-22 16:34  source
+
+	* Fixed link warning
+
+2010-10-22 16:31  source
+
+	* Fixed issue with shadowing local variable in java hosting
+
+2010-10-22 14:58  source
+
+	* Fixed temporary disabled code
+
+2010-10-22 12:31  source
+
+	* Fixed single does not have a dpipe
+
+2010-10-22 10:28  source
+
+	* FIxed if dpipe before outer section, put the dpipe before the set
+	  ctr of the outer section and not after, else it may mess with the
+	  output of the dpipe
+
+2010-10-22 09:52  source
+
+	* Fixed missing symbol
+
+2010-10-22 09:50  source
+
+	* Fixed rb can be twice as it is a ref
+
+2010-10-20 16:04  source
+
+	* Fixed problem with extremely large XML doc
+
+2010-10-19 12:38  source
+
+	* Added dynamic resizing of result block
+
+2010-10-18 18:50  source
+
+	* Fixed issue with SPARQL CONSTRUCT/INSERT/DELETE/MODIFY queries
+
+2010-10-18 12:18  source
+
+	* Fixed when a page with free remap is found, indicate the trx should be killed
+	  rather than getting infinite loop
+	* Fixed extra debugging for page access
+
+2010-10-18 12:14  source
+
+	* Fixed when operation is count etc, aggregate returning a number
+	  does not do memcache only in order to avoid running out of memory
+
+2010-10-18 12:01  source
+
+	* Added new functions to ImageMagick plugin
+
+2010-10-15 11:37  source
+
+	* Fixed fct_label on v6 single
+
+2010-10-13 13:59  source
+
+	* Fixed the xe_make_copy is valid only for XMLTYPE, not for every UDT
+
+2010-10-13 13:59  source
+
+	* Fixed gpf
+
+2010-10-13 12:12  source
+
+	* Added rsh-sha256
+	* Added xenc_dsig_verify, xenc_dsig_sign and xenc_key_RDA_construct
+
+2010-10-13 12:11  source
+
+	* Removed old upgrade code
+
+2010-10-13 12:09  source
+
+	* Fixed BestBuy cartridge
+
+2010-10-13 12:07  source
+
+	* Added checks for value ranges
+	* Added paging through 'Related Collections' links
+
+2010-10-13 12:02  source
+
+	* Fixed minor issues
+
+2010-10-13 12:00  source
+
+	* Added ACL semantic ping
+	* Fixed encoding problems
+	* Fixed JS error
+
+2010-10-13 11:59  source
+
+	* Added ACL semantic ping
+	* Fixed encoding problems
+	* Optimized page load
+
+2010-10-13 11:58  source
+
+	* Fixed encoding problems
+	* Fixed and optimized users and webIDs
+	* Fixed sharings
+	* Optimized page load
+
+2010-10-13 10:36  source
+
+	* Added ACL semantic ping
+	* Fixed and optimized users and webIDs
+	* Fixed empty lists
+	* Fixed encoding problems
+	* Optimized page load
+
+2010-10-13 10:35  source
+
+	* Added ACL semantic ping
+	* Fixed encoding problems
+
+2010-10-13 10:34  source
+
+	* Added ACL semantic ping
+	* Fixed and optimized users and webIDs
+	* Fixed encoding problems
+	* Fixed empty lists
+	* Optimized page load
+
+2010-10-13 10:33  source
+
+	* Added ACL semantic ping
+	* Fixed and optimized users and webIDs
+	* Fixed JS map error
+	* Fixed JS errors
+	* Fixed tabs
+	* Fixed encoding problems
+
+2010-10-12 17:35  source
+
+	* Fixed bug when filer (num <>= (subq))
+
+2010-10-12 12:23  source
+
+	* Added support for latest tidylib
+
+2010-10-07 23:31  source
+
+	* Fixed some issues with dsig_verify
+
+2010-10-07 13:29  source
+
+	* Fixed new debug macro DK_ALLOC_BOX_DEBUG for basic integrety checks
+	  without overhead of full MALLOC_DEBUG
+
+2010-10-07 13:24  source
+
+	* Added item ACL
+	* Added ACL Inheritance
+	* Fixed update
+	* Fixed tag bug
+
+2010-10-07 13:07  source
+
+	* Fixed minor issue
+
+2010-10-07 13:02  source
+
+	file disconnect_16.png was added on branch V6_0_0-DEVEL on 2010-10-07 13:22:39 +0000
+
+2010-10-07 13:02  source
+
+	file link_16.png was added on branch V6_0_0-DEVEL on 2010-10-07 13:22:39 +0000
+
+2010-10-07 13:02  source
+
+	file ods_upstream.sql was added on branch V6_0_0-DEVEL on 2010-10-07 13:22:38 +0000
+
+2010-10-07 13:00  source
+
+	* Added ACL Inheritance
+	* Fixed updated UI
+
+2010-10-07 13:00  source
+
+	* Added ACL Inheritance
+	* Fixed binding the twitter and linkedin with their API
+	* Fixed IE password field size bug
+	* Fixed must quote vars from sparql
+	* Fixed swat0
+
+2010-10-07 12:58  source
+
+	* Added ACL Inheritance
+	* Fixed optimized progress bar
+	* Fixed read/unread actions
+	* Fixed encoding problem
+	* Fixed updated UI
+	* Removed deprecated icons
+
+2010-10-07 12:56  source
+
+	* Added ACL Inheritance
+	* Fixed ACL recalc bug
+	* Fixed updated UI
+
+2010-10-07 12:55  source
+
+	* Added ACL Inheritance
+	* Fixed optimized update
+	* Fixed sharing problem
+	* Fixed updated UI
+
+2010-10-07 12:54  source
+
+	* Added ACL Inheritance
+	* Fixed ACL recalc bug
+	* Fixed optimize progress bar
+	* Removed deprecated images
+
+2010-10-07 12:53  source
+
+	* Fixed swat0
+
+2010-10-07 12:44  source
+
+	* Updated documentation
+
+2010-10-07 12:20  source
+
+	* Added option not to convert HTML pages
+
+2010-10-06 21:39  source
+
+	* Added initial attribute/property value ranges conditional
+	* Added new XML element <value-range hi="" lo="" /> for facet browser
+	* Fixed make pivot bridge link conditional
+
+2010-10-06 21:37  source
+
+	* Fixed prevent buggy IRI to hit compiler
+
+2010-10-06 09:40  source
+
+	* Fixed problem compiling certain SPARQL constructions
+
+2010-10-06 09:35  source
+
+	* Added some new functions to XPATH virtual table
+	* Added optimizations to boolean expression evaluation
+
+2010-10-06 09:27  source
+
+	* Fixed added qualifier to stored proc creation
+
+2010-10-06 09:26  source
+
+	* Fixed moved some checks to header file for macro expansion
+
+2010-10-06 09:15  source
+
+	* Added support for CSV output mode
+
+2010-10-06 09:15  source
+
+	* Fixed compatibility with openssl 0.9.7
+
+2010-10-05 09:39  source
+
+	* Fixed when enlist starts we should have new xid or not listed
+
+2010-10-04 18:39  source
+
+	* Fixed if resource is not free e.q. count = 2 we most restore as other
+	  thread can kill it in the middle
+
+2010-10-04 14:40  source
+
+	* Fixed save should happen after checks, as jump would leave members
+	  NULL
+
+2010-09-27 22:37  source
+
+	* Fixed missing text from cache
+
+2010-09-27 19:41  source
+
+	* FIxed label
+
+2010-09-27 14:45  source
+
+	* Added linkblog pages
+	* Fixed smaller tweet me button on bottom
+	* Fixed template list
+
+2010-09-27 14:44  source
+
+	* Added ACL inheritance
+
+2010-09-27 14:44  source
+
+	* Fixed date update change in events/tasks
+
+2010-09-27 14:37  source
+
+	* Rebuild drivers
+
+2010-09-27 14:29  source
+
+	* Fixed issue with connection timeout
+
+2010-09-27 14:24  source
+
+	file linkblog.vspx was added on branch V6_0_0-DEVEL on 2010-09-27 14:45:09 +0000
+
+2010-09-27 14:23  source
+
+	file uiedit_sec.vspx was added on branch V6_0_0-DEVEL on 2010-09-27 14:45:40 +0000
+
+2010-09-27 14:23  source
+
+	file uiedit_val.vspx was added on branch V6_0_0-DEVEL on 2010-09-27 14:45:41 +0000
+
+2010-09-27 14:23  source
+
+	file uiedit_ws.vspx was added on branch V6_0_0-DEVEL on 2010-09-27 14:45:41 +0000
+
+2010-09-27 14:23  source
+
+	file uiedit_ann.vspx was added on branch V6_0_0-DEVEL on 2010-09-27 14:45:39 +0000
+
+2010-09-27 14:23  source
+
+	file uiedit_bz.vspx was added on branch V6_0_0-DEVEL on 2010-09-27 14:45:40 +0000
+
+2010-09-27 14:23  source
+
+	file uiedit_grp.vspx was added on branch V6_0_0-DEVEL on 2010-09-27 14:45:40 +0000
+
+2010-09-27 14:23  source
+
+	file uiedit_ldap_include.vspx was added on branch V6_0_0-DEVEL on 2010-09-27 14:45:40 +0000
+
+2010-09-27 14:23  source
+
+	file uiedit_nav.vspx was added on branch V6_0_0-DEVEL on 2010-09-27 14:45:40 +0000
+
+2010-09-27 14:23  source
+
+	* Fixed split uiedit into separate pages to get better response time
+	  when compiling
+	* Fixed 'Generate Certificate'
+
+2010-09-27 14:13  source
+
+	* Fixed minor issues
+
+2010-09-27 14:11  source
+
+	* Fixed ACL implementation
+
+2010-09-27 14:11  source
+
+	* Fixed take DynamicLocal into account
+
+2010-09-27 13:51  source
+
+	* FIxed client must not redefine mutex_enter as this will crash single
+
+2010-09-27 08:58  source
+
+	* Fixed use x-forwarded-for and remember it is forwarded
+
+2010-09-27 08:57  source
+
+	* Fixed use the redirect link for base when supplied
+
+2010-09-27 08:56  source
+
+	* Fixed check if m2 is a box
+
+2010-09-22 15:11  source
+
+	* Reverted patch
+
+2010-09-22 14:01  source
+
+	* Added xml_sign() for making pure XML signatures
+	* Added signature in host-meta xrd
+	* FIxed memleaks when doing xml signatures
+
+2010-09-22 13:56  source
+
+	* Fixed bad procedure name
+
+2010-09-22 13:06  source
+
+	* Fixed unified login pages
+	* Fixed upgraded ACL implementation
+	* Fixed Linkedin link
+
+2010-09-22 13:03  source
+
+	* Fixed upgraded ACL implementation
+
+2010-09-22 13:02  source
+
+	file summary.vspx was added on branch V6_0_0-DEVEL on 2010-09-22 13:56:50 +0000
+
+2010-09-22 13:02  source
+
+	* Added archive and summary pages
+	* Added new templates to vad
+
+2010-09-22 13:02  source
+
+	file archive.vspx was added on branch V6_0_0-DEVEL on 2010-09-22 13:56:49 +0000
+
+2010-09-22 13:02  source
+
+	file summary.vspx was added on branch V6_0_0-DEVEL on 2010-09-22 13:56:49 +0000
+
+2010-09-22 12:50  source
+
+	* Fixed minor issues
+
+2010-09-22 12:48  source
+
+	* Fixed vcard and vcal file import
+
+2010-09-22 12:48  source
+
+	* Fixed group ACL access
+
+2010-09-21 13:12  source
+
+	* Fixed load demo vad after tutorial
+
+2010-09-21 13:11  source
+
+	* Added missing file
+
+2010-09-21 11:34  source
+
+	* Fixed focus issue
+	* Fixed typo
+	* Fixed XRDS
+
+2010-09-21 11:33  source
+
+	file bg.png was added on branch V6_0_0-DEVEL on 2010-09-21 11:38:52 +0000
+
+2010-09-21 11:33  source
+
+	file bg_page_title.png was added on branch V6_0_0-DEVEL on 2010-09-21 11:38:51 +0000
+
+2010-09-21 11:33  source
+
+	file bg_page_title_inner.jpg was added on branch V6_0_0-DEVEL on 2010-09-21 11:38:51 +0000
+
+2010-09-21 11:33  source
+
+	file default.css was added on branch V6_0_0-DEVEL on 2010-09-21 11:38:52 +0000
+
+2010-09-21 11:33  source
+
+	file index.vspx was added on branch V6_0_0-DEVEL on 2010-09-21 11:38:52 +0000
+
+2010-09-21 11:33  source
+
+	* Added new templates
+
+2010-09-21 11:33  source
+
+	file bg_content.png was added on branch V6_0_0-DEVEL on 2010-09-21 11:38:51 +0000
+
+2010-09-21 11:33  source
+
+	file bg_header.png was added on branch V6_0_0-DEVEL on 2010-09-21 11:38:51 +0000
+
+2010-09-21 11:33  source
+
+	file default.css was added on branch V6_0_0-DEVEL on 2010-09-21 11:38:51 +0000
+
+2010-09-21 11:33  source
+
+	file index.vspx was added on branch V6_0_0-DEVEL on 2010-09-21 11:38:51 +0000
+
+2010-09-21 11:20  source
+
+	* Fixed serialize access to connection struct
+
+2010-09-20 10:14  source
+
+	* Fixed Id
+
+2010-09-20 09:51  source
+
+	* Added RDFa doctype
+	* Added new feature of fct to show certain graph
+
+2010-09-20 09:50  source
+
+	* Fixed http://dbpedia.org/property/name is not the name of the subject
+
+2010-09-20 09:23  source
+
+	* Added new feature of fct to show certain graph when fct is installed
+
+2010-09-20 09:20  source
+
+	file linkedin-large.png was added on branch V6_0_0-DEVEL on 2010-09-20 09:25:56 +0000
+
+2010-09-20 09:20  source
+
+	file sign-in-with-twitter-d.png was added on branch V6_0_0-DEVEL on 2010-09-20 09:25:56 +0000
+
+2010-09-20 09:20  source
+
+	file register.js was added on branch V6_0_0-DEVEL on 2010-09-20 09:25:54 +0000
+
+2010-09-20 09:20  source
+
+	file twitter_login.vsp was added on branch V6_0_0-DEVEL on 2010-09-20 09:25:55 +0000
+
+2010-09-20 09:20  source
+
+	file linkedin_login.vsp was added on branch V6_0_0-DEVEL on 2010-09-20 09:25:53 +0000
+
+2010-09-20 09:20  source
+
+	file login.js was added on branch V6_0_0-DEVEL on 2010-09-20 09:25:53 +0000
+
+2010-09-20 09:20  source
+
+	* Added new login and register library
+	* Added WebID to 'My Profile'
+	* Added linkedin login
+	* Added new inde on OL accounts
+	* Added twitter login page
+	* Added login with Google account
+	* Fixed WebFinder to look at sameas
+	* Fixed X.509 certificates in user pages
+	* Fixed password problem
+	* Fixed group ACL access
+	* Fixed validation ACLs
+	* Fixed openID server parameters extraction
+	* Fixed create instance defaults
+	* Fixed use of timezone
+	* Fixed Safari and Chrome bug
+	* Fixed biographical date input
+
+2010-09-20 09:14  source
+
+	* Fixed filter problem with WebID
+
+2010-09-20 09:13  source
+
+	* Added ACL support for tasks
+	* Fixed group ACL access
+	* Fixed ACL table UI
+	* Fixed private access
+	* Fixed  validation ACLs
+
+2010-09-20 09:12  source
+
+	* Fixed group ACL access
+	* Fixed ACL group select
+	* Fixed ACL UI
+	* Fixed validation ACLs
+
+2010-09-20 09:11  source
+
+	* Added ACLs
+	* Fixed group ACL access
+	* Fixed private access
+
+2010-09-20 09:09  source
+
+	* Fixed group ACL access
+	* Fixed ACL table UI
+	* Fixed private access
+	* Fixed validation ACLs
+
+2010-09-20 08:55  source
+
+	* Added refresh=clean mode, to drop cache even if it is in the middle
+	  of sponging on another threads
+	* Added scheduler task to keep volume under some limit
+
+2010-09-20 08:27  source
+
+	* Fixed ACL testing now http returns 509
+
+2010-09-17 23:11  source
+
+	* Fixed when fct is installed, use the new feature of fct to show
+	  certain graphs
+
+2010-09-17 23:10  source
+
+	* Fixed hang in prefix check if there is single dot in prefix
+
+2010-09-17 23:10  source
+
+	* Fixed check log text should always be DV_STRING
+
+2010-09-17 23:08  source
+
+	* Added support for CXML
+
+2010-09-17 23:03  source
+
+	* Added strong optimization of SPARQL arithmatic and numerical
+	  comparisons
+
+2010-09-17 22:49  source
+
+	* Added initial support for RDB2RDF
+
+2010-09-17 22:05  source
+
+	* Added improvements for SPARQL-FED esp. to let XSLT access data
+	  from remote SPARQL endpoint
+
+2010-09-17 20:49  source
+
+	* Fixed rendezvous thread should never handle any signals
+
+2010-09-17 16:50  source
+
+	* Fixed moved include file to more appropriate place
+
+2010-09-17 16:48  source
+
+	* Fixed do not try when in V6 single mode
+
+2010-09-17 16:45  source
+
+	* Added new bifs that print start element, end elemend and empty
+	  element with some number of attributes. Attribute values are
+	  checked for NULL and print only non-NULLs to eliminate numerous
+	  IF statements in Virtuoso/PL
+
+2010-09-17 16:42  source
+
+	* Added bif that checks if some value is stored in given dictionary
+	  for a given key, without returning it. This is usefull if value is
+	  potentially big as it does not copy anything.
+
+2010-09-17 16:40  source
+
+	* Fixed let some string BIFs accept UNAME arguments
+
+2010-09-17 16:35  source
+
+	* Removed deprecated repl code
+
+2010-09-17 11:18  source
+
+	* Fixed isalnum needs unsigned char as negative values might trip asserts
+	  on some systems like Windows
+
+2010-09-15 23:54  source
+
+	* Fixed handling format like 2010-09-15T14:24:28Z without fraction part
+	* Fixed set local timezone
+
+2010-09-15 08:10  source
+
+	* Fixed redirects for tcn
+	* Fixed set default to html
+	* Fixed in order of browser preference
+
+2010-09-13 16:03  source
+
+	* Fixed issue with xs_q_4/foaf.vsp demo
+
+2010-09-09 19:19  source
+
+	* Added check
+
+2010-09-09 19:18  source
+
+	* FIxed print dict in dbg_* functions
+
+2010-09-09 16:02  source
+
+	* Fixed minor issue
+
+2010-09-09 15:32  source
+
+	* Added MIME types for .NET click-once, MS Office and MS WPF applications
+	* Added additional MIME types based on apache mime.types.txt
+
+2010-09-07 21:56  source
+
+	* Added geo for dbpedia
+	* Fixed wrong var names
+	* Fixed issue with IE
+	* Fixed deprecated call to OAT.Dom.applyStyle into OAT.Style.set
+	* Removed unused background
+
+2010-09-07 21:37  source
+
+	* Added fingerpoint hook
+
+2010-09-07 21:28  source
+
+	* Added oauth+openid hybrid
+	* Added JS validation routines
+	* Added fingerpoint hooks
+	* Fixed x509 order
+	* Fixed use ssl login if accessed via https
+	* Fixed https on endpoint
+	* Fixed openid for fingerpoint
+	* Fixed seeAlso lookups via WF/FP
+	* Fixed Facebook issues
+	* Fixed validation ACLs
+	* Fixed Gallery pane
+
+2010-09-07 21:28  source
+
+	file openid_oauth_test.vsp was added on branch V6_0_0-DEVEL on 2010-09-07 22:00:53 +0000
+
+2010-09-07 21:28  source
+
+	file validate.js was added on branch V6_0_0-DEVEL on 2010-09-07 22:00:54 +0000
+
+2010-09-07 21:24  source
+
+	* Fixed ACL
+
+2010-09-07 21:24  source
+
+	* Added ACL
+
+2010-09-07 21:23  source
+
+	* Fixed private access error
+
+2010-09-07 21:23  source
+
+	* Fixed private access error
+	* Fixed typo
+
+2010-09-07 19:55  source
+
+	* Minor fixes
+
+2010-09-07 19:55  source
+
+	* Added XRD meta
+
+2010-09-07 19:54  source
+
+	* Added attribution ontology
+
+2010-09-07 19:54  source
+
+	file attribution.owl was added on branch V6_0_0-DEVEL on 2010-09-07 21:58:11 +0000
+
+2010-09-01 12:57  source
+
+	file uiedit_groups.vspx was added on branch V6_0_0-DEVEL on 2010-09-07 22:00:53 +0000
+
+2010-09-01 12:57  source
+
+	file webid_select.vspx was added on branch V6_0_0-DEVEL on 2010-09-07 22:00:54 +0000
+
+2010-09-01 10:15  source
+
+	* Added support headers from url rewrite for static resources such
+	  as files
+
+2010-09-01 10:11  source
+
+	* Fixed link headers
+
+2010-08-31 12:12  source
+
+	* Added missing function
+
+2010-08-31 12:12  source
+
+	* Added support for IUD ops to XMLA endpoint
+
+2010-08-31 12:09  source
+
+	* Fixed return appropriate message based on the type of ACL result
+
+2010-08-31 11:45  source
+
+	* Added support for host-meta
+
+2010-08-30 13:46  source
+
+	* Updated documentation
+
+2010-08-30 13:37  source
+
+	* Fixed use short representations to make sorted by
+
+2010-08-30 13:35  source
+
+	* Fixed missing prototype
+
+2010-08-30 12:34  source
+
+	* Fixed use webfinger to do ssl authentication
+
+2010-08-30 12:21  source
+
+	* Fixed error message generation in execute
+	* Fixed encoding issue in directory listings generated from
+	  filesystem-hosted virtual directories
+
+2010-08-26 22:49  source
+
+	* FIxed i18n support for subject and address list
+
+2010-08-26 22:41  source
+
+	* Fixed typo
+
+2010-08-26 22:40  source
+
+	* Added Evri cartridge and ontology
+	* Added hNews cartridge
+
+2010-08-26 22:40  source
+
+	file evri2rdf.xsl was added on branch V6_0_0-DEVEL on 2010-08-26 22:46:12 +0000
+
+2010-08-26 22:40  source
+
+	file hnews2rdf.xsl was added on branch V6_0_0-DEVEL on 2010-08-26 22:46:12 +0000
+
+2010-08-26 22:40  source
+
+	file oplevri.owl was added on branch V6_0_0-DEVEL on 2010-08-26 22:46:12 +0000
+
+2010-08-26 22:34  source
+
+	* Added support for acct: scheme
+
+2010-08-26 22:33  source
+
+	* Added support for webfinger + OpenID
+	* Fixed login with webfinger
+	* Fixed login popup page
+	* Fixed sameAs validation values
+	* Fixed Facebook link
+	* Fixed iframe number
+	* Fixed certificate generator
+
+2010-08-26 22:30  source
+
+	* Fixed application settings page url
+
+2010-08-26 18:04  source
+
+	* Added support for host-meta
+
+2010-08-26 18:03  source
+
+	* Fixed if position is not valid, skip the iob and go to next
+
+2010-08-24 22:34  source
+
+	* Fixed set to NULL after free
+
+2010-08-22 16:04  source
+
+	* Added option for to validate in hours
+
+2010-08-22 13:06  source
+
+	* Added new SQL optimization trick to convert
+	  sprintf ('format', col0, col1, ..., colN) = exnp
+	  into more index friendly:
+	  ( col0 = sprintf_inverse ('format', expn, 2)[0] and
+	    col1 = sprintf_inverse ('format', expn, 2)[1] and ...
+	    colN = sprintf_inverse ('format', expn, 2)[N] )
+
+2010-08-20 10:12  source
+
+	* Fixed typo in BIF name
+	* Fixed SPARQL resultset output if some objects of an RDF storage are
+	  corrupted
+
+2010-08-20 10:10  source
+
+	* Fixed error on INSERT DATA with literals of non-default types
+
+2010-08-20 10:09  source
+
+	* Fixed issue with ill formed SPARQL requests send by SPARQL SERVICE
+	  clause with dynamic parameters
+
+2010-08-20 10:07  source
+
+	* Fixed issue parsing sparql function calls with zero arguments
+
+2010-08-18 08:41  source
+
+	* Fixed check dirsallowed before loading file
+
+2010-08-17 21:40  source
+
+	* Fixed use webfinger to do SSL authentication
+
+2010-08-17 18:29  source
+
+	* Added support to use webfinger for SSL authentication
+	* Disabled rel=me tweak
+
+2010-08-17 18:05  source
+
+	* Added Google Book cartridge
+
+2010-08-17 18:05  source
+
+	file google_book2rdf.xsl was added on branch V6_0_0-DEVEL on 2010-08-17 18:32:24 +0000
+
+2010-08-17 18:05  source
+
+	* Fixed use foaf ssl procedure
+
+2010-08-17 18:01  source
+
+	* Added get-certificate_info (10,cert,type, pass, 'subject field name
+	  e.g. emailAddress, OU etc.')
+
+2010-08-17 11:06  source
+
+	* FIxed sparql parse bug with NOT FROM NAMED queries like
+	  select distinct ?g ?p not from named virtrdf: where
+	  { graph ?g { ?s ?p ?o }}
+
+2010-08-17 10:23  source
+
+	* Fixed security issue in SPARQL
+	  A compiled and cached query may stay in its old state (not
+	  recompiled) after global security changes like
+	  DB.DBA.RDF_DEFAULT_USER_PERMS_SET ('nobody', 0) that should
+	  recompile most of queries cached for all users but it does not.
+
+2010-08-17 10:22  source
+
+	* Fixed build rules
+
+2010-08-17 09:25  source
+
+	* Fixed moved constant declarations of commonly used UNAMEs into
+	  separate file
+
+2010-08-16 10:10  source
+
+	* Added webfinger protocol
+	* Fixed cert gen on firefox with .net addon
+
+2010-08-16 10:09  source
+
+	* Fixed bug in re-install
+
+2010-08-16 10:07  source
+
+	* Fixed labels
+
+2010-08-16 10:07  source
+
+	* FIxed missing data for interval column
+
+2010-08-11 11:24  source
+
+	file webfinger.sql was added on branch V6_0_0-DEVEL on 2010-08-16 10:10:07 +0000
+
+2010-08-11 11:07  source
+
+	* Added support for define output:format "NT"
+
+2010-08-11 10:53  source
+
+	* Fixed issue with sparql subcode gen
+
+2010-08-10 18:47  source
+
+	* Fixed should not use escape here
+
+2010-08-10 18:45  source
+
+	* Added WebID share
+	* Fixed secure sponged VD setup
+
+2010-08-10 14:52  source
+
+	* Fixed wrong URL
+
+2010-08-10 07:04  source
+
+	file rdf_conf.vspx was added on branch V6_0_0-DEVEL on 2010-08-10 18:45:56 +0000
+
+2010-08-10 07:04  source
+
+	file tbl.js was added on branch V6_0_0-DEVEL on 2010-08-10 18:45:56 +0000
+
+2010-08-09 20:08  source
+
+	* Fixed some URL links
+
+2010-08-09 19:44  source
+
+	* Fixed support for source_uri attribute in sticker
+
+2010-08-08 11:55  source
+
+	* Fixed enhanced type recognition
+	* Fixed return errors when loading fails
+
+2010-08-08 11:55  source
+
+	* Fixed TOP has argument order of offset, limit
+
+2010-08-06 10:29  source
+
+	* Fixed issues with Rename
+	* Fixed issues with Upstreaming
+
+2010-08-06 10:04  source
+
+	file tbl.js was added on branch V6_0_0-DEVEL on 2010-08-06 10:30:03 +0000
+
+2010-08-06 10:03  source
+
+	* Added support for SSL and WebID
+
+2010-08-06 09:46  source
+
+	* Fixed skip constant ssl returned from temp table output
+
+2010-08-04 18:50  source
+
+	* Fixed clear conn vars after trx replay
+
+2010-08-04 09:34  source
+
+	* Updated documentation
+
+2010-08-04 07:37  source
+
+	* Added UI for rdb2rdf
+
+2010-08-04 07:37  source
+
+	* Fixed use subseq to handle blobs
+
+2010-08-04 07:35  source
+
+	* Fixed Activity log
+	* Fixed /about virtual dir
+	* Fixed rewrite http header in cert output
+
+2010-08-04 07:33  source
+
+	* Fixed Activity log
+	* Fixed file view
+	* Fixed filenames with .acl extension properties editing
+
+2010-08-04 07:32  source
+
+	* Fixed encoding problem
+
+2010-08-04 07:30  source
+
+	* Fixed Activity log
+
+2010-08-04 07:30  source
+
+	* Fixed Activity log
+	* Fixed uninstall DET folders
+	* Fixed 'ResFolder' type filters
+
+2010-08-04 07:10  source
+
+	* Added persistent xmlns UI
+
+2010-08-04 07:10  source
+
+	file persistent_xmlns.vspx was added on branch V6_0_0-DEVEL on 2010-08-04 07:38:10 +0000
+
+2010-08-04 07:03  source
+
+	* Added WebID based ACL support via https
+
+2010-08-04 07:02  source
+
+	* Fixed Tesco cartridge
+
+2010-08-04 07:02  source
+
+	file opltesco.owl was added on branch V6_0_0-DEVEL on 2010-08-04 07:39:47 +0000
+
+2010-08-04 06:58  source
+
+	* Fixed avoid errors later in process
+
+2010-08-04 06:53  source
+
+	* FIxed use X-Forwarded-Host when the instance is behind gateway
+
+2010-08-02 11:31  source
+
+	* Fixed when result from authentication is negative then return
+	  else WebID fals
+	* Fixed http auth checks
+
+2010-08-02 11:25  source
+
+	* Fixed keep mime hash in sync
+
+2010-08-02 11:23  source
+
+	* Fixed do not allow sponger to change log mode explicitly to no-lock and
+	  row-autocommit
+
+2010-08-02 11:20  source
+
+	* Added support for POP3 over SSL
+
+2010-08-02 07:40  source
+
+	* Added global X509 CA repository
+
+2010-07-29 16:25  source
+
+	* Updated documentation
+
+2010-07-29 16:17  source
+
+	* Fixed dynlocal format must be replaced by host as in host header
+
+2010-07-29 16:14  source
+
+	* Added common api FOAF_SSL_WEBID_GET
+	* Added setting for online certificate service
+	* Added https link in header
+	* Fixed online accounts
+	* Fixed WebID
+	* Fixed alt name can have multiple values
+
+2010-07-28 12:26  source
+
+	* Fixed size of res column to fit side menu on smaller screens like
+	 iPhone
+
+2010-07-28 12:10  source
+
+	* Fixed minor issues
+
+2010-07-26 21:01  source
+
+	* Fixed when http auth fails, must keep the http status as 401
+
+2010-07-26 12:59  source
+
+	* Fixed alt names can have multiple values
+	* Fixed paths creation
+	* Fixed users select
+	* Fixed renamed User Login to Identify Yourself
+
+2010-07-26 12:58  source
+
+	* Fixed path creation
+	* Fixed URLs
+	* Fixed users select
+
+2010-07-26 12:58  source
+
+	* Fixed path creation
+	* Fixed URLs
+
+2010-07-26 09:25  source
+
+	file select.gif was added on branch V6_0_0-DEVEL on 2010-07-26 12:59:16 +0000
+
+2010-07-23 19:44  source
+
+	* Fixed bug with WebDAVFS client
+
+2010-07-23 19:43  source
+
+	* Added continue handler to catch missing graph group signal
+
+2010-07-23 19:42  source
+
+	* Fixed URL after login
+	* FIxed view.vsp not found problem
+
+2010-07-23 19:39  source
+
+	* Adde additional endpoint
+	* Fixed splash screen
+	* Fixed error message when JavaScript is not available
+	* Fixed geo location
+
+2010-07-23 19:36  source
+
+	* Added new lock icon ref
+	* Fixed online services validation
+	* Fixed IE UI profile view
+	* Fixed multiple certificates in UI profile
+	* Fixed issue with "Creator of"
+	* Fixed image button for users pages
+	* Fixed browser related problems
+	* Fixed labels
+
+2010-07-23 19:31  source
+
+	* Removed deprecated files
+
+2010-07-23 15:56  source
+
+	* Fixed auth bug with WebDAVFS client
+
+2010-07-20 13:08  source
+
+	* Fixed minor issues
+
+2010-07-20 13:01  source
+
+	* Fixed WebKit problems with UI profile
+
+2010-07-20 13:01  source
+
+	* Fixed sync security profile
+
+2010-07-19 14:50  source
+
+	* Added discussion page rewrite rules
+	* Fixed change Member ID to User ID
+	* Fixed ODS to Digest in Login/Register form
+	* Fixed X.509 page for IE
+
+2010-07-19 14:48  source
+
+	* Fixed URLs
+
+2010-07-19 14:39  source
+
+	* Fixed missing dependency
+
+2010-07-19 14:39  source
+
+	* Fixed ordering to work with IE 7/8
+
+2010-07-19 07:12  source
+
+	* Fixed version
+
+2010-07-19 07:11  source
+
+	* Fixed some issues with sparql queries returning strings instead of IRIs
+
+2010-07-19 07:08  source
+
+	* Added explain if params are copied
+
+2010-07-19 07:08  source
+
+	* Fixed dir listing to use UTF-8 to show chars other than latin1
+
+2010-07-19 06:59  source
+
+	* Fixed issue with inferencing
+
+2010-07-19 06:59  source
+
+	* Fixed compiler warnings
+
+2010-07-14 21:18  source
+
+	* Fixed following checkpoint kill recovery remap extents may have
+	  allocated pages with no correspoinding logical page because recovery
+	  performs unremap. Therefor if em remap page is allocated in em but
+	  free in dbs freemap, disregards and reset em allocation, if no logical
+	  page. If logical page, concider the dbs freeset in errror and mark page
+	  as allocated.
+
 2010-07-09 15:57  source
 
 	* Updated version to 6.1.2 for final release
diff --git a/Makefile.in b/Makefile.in
index 0b8be3e..4e4e784 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -241,6 +241,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/NEWS b/NEWS
index 409dc86..3343d6d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,160 @@
+March 30, 2011, V6.1.3:
+  * Database engine
+    - Added configurable normalization of accented characters
+    - Added global X509 CA repository
+    - Added IMAP, IMAPs and POP3s  client support
+    - Added http maintenance functions
+    - Added optimization for case when there is no locality
+    - Added optimization to look at GS index only
+    - Added optimization to boolean expression evaluation
+    - Added read-ahead on extent
+    - Added retry deadlock if http session is not flushed
+    - Added retry on deadlock when sponging on multiple threads
+    - Added support for CORS on http endpoints
+    - Added support for passing NVARCHAR arguments to thread-safe dicts
+    - Added support for S/MIME encrypt and decrypt
+    - Added ssl const decoration in explain
+    - Added three new aggregates mostly for use with SPARQL-BI
+    - Added transitivity cache
+    - Fixed busy loop when no free remaps
+    - Fixed check for 5xx or 4xx status codes
+    - Fixed check if subselect has a recursive ref
+    - Fixed cost model to count inx cond and scale card at end
+    - Fixed error on INSERT DATA with literals of non-default types
+    - Fixed following checkpoint kill recovery remap extents may
+      have allocated pages with no corresponding logical page because
+      recovery performs unremap. Therefor if em remap page is allocated
+      in em but free in dbs freemap, disregards and reset em allocation,
+      if no logical page. If logical page, concider the dbs freeset
+      in error and mark page as allocated.
+    - Fixed increase delay on sequential deadlock
+    - Fixed index_only on partial can return has data even if main row does not
+    - Fixed infinite loop when dealing with string like abc&def and no token
+    - Fixed issue parsing sparql function calls with zero arguments
+    - Fixed issue with aggregates, distinct and ORDER BY
+    - Fixed issue with closing XAConnection and connectionpool
+    - Fixed issue with combination of UNION in the argument of IN
+      causing General internal Optimized compiler error
+    - Fixed issue with partial index when no path is followed
+    - Fixed JDBC driver lost prepared data after execution query,
+      so next execute of prepared query throws exception
+    - Fixed memleaks
+    - Fixed moved mutex lock/unlock calls to avoid deadlock
+    - Fixed recovery mode
+    - Fixed send body of 509 bandwidth error
+    - Fixed set HTTP status to 503 when showing maintenance page
+      and added a Retry-After: 1800 (seconds) header as a hint to the
+      remote
+    - Fixed set local timezone
+    - Fixed size of input buffer of an XML parser is now adaptive
+    - Updated documentation
+
+  * SPARQL and RDF
+    - Added attribution and Evri ontology
+    - Added cartridges for EOL, Evry, Google Book, Groupon, hNews,
+        hRecipe, ProductWiki, RDFa, RDFohloh
+    - Added checking for rdfa dtd
+    - Added Described By
+    - Added expiration header
+    - Added improvements for SPARQL-FED esp. to let XSLT access
+      data from remote SPARQL endpoint
+    - Added index to search over label text
+    - Added initial codegen for ASK subquery
+    - Added lax mode in csv import
+    - Added MinExpiration param for sponger
+    - Added more prefixes
+    - Added namespace prefix 'fn' for for XPATH 2.0 and XQuery 1.0
+      Core Functions library
+    - Added new SPARQL-to-SQL codegen for type cast functions
+    - Added new SQL optimization trick to convert 
+        sprintf ('format', col0, col1, ..., colN) = exnp 
+	into more index friendly: 
+	( col0 = sprintf_inverse ('format', expn, 2)[0] and 
+	  col1 = sprintf_inverse ('format', expn, 2)[1] and ...  
+	  colN = sprintf_inverse ('format', expn, 2)[N] )
+    - Added optimization of SPARQL arithmatic and numerical comparisons
+    - Added RDFa W3c validation button
+    - Added rdfs schema
+    - Added refresh=clean mode, to drop cache even if it is in the
+      middle of sponging on another threads
+    - Added scheduler task to keep volume under some limit
+    - Added special immutable setting for inf rules
+    - Added support for CSV output mode
+    - Added support for define input:inference in SAPRQL DESCRIBE
+    - Added support for define output:format "NT"
+    - Added support for FILTER EXISTST and FILTER NOT EXISTS
+    - Added support for host-meta
+    - Added support for IUD ops to XMLA endpoint
+    - Added support for MINUS
+    - Added support for posh triples
+    - Added support for RDB2RDF
+    - Added support of "seealso" predicate in case of recursive sponging
+    - Added WebID based ACL support via https
+    - Fixed datatype for twitter
+    - Fixed datetime format
+    - Fixed do not use triple dicts on long files
+    - Fixed do not check immutable graph when dba is running
+    - Fixed DOI and RDFa
+    - Fixed enable xlat iris
+    - Fixed hreview aggregates
+    - Fixed issue with SPARQL CONSTRUCT/INSERT/DELETE/MODIFY queries
+    - Fixed issue with sponging options and DESCRIBE on /sparql endpoint
+    - Fixed issue with sparql FILTER with two OPTIONALS
+    - Fixed issues reported by W3C Validator
+    - Fixed issues with SPARQL-FED
+    - Fixed missing column error in SPARQL-to-SQL preprocessor
+    - Fixed missing namespace in </results>
+    - Fixed security issue in SPARQL
+    - Fixed sparql parse bug with NOT FROM NAMED queries like 
+      select distinct ?g ?p not from named virtrdf: 
+      where { graph ?g { ?s ?p ?o }}
+    - Fixed sqltype and display size of DV_IRI_ID column
+    - Fixed use common API to delete target
+    - Fixed use doi proxy if no hslookup plugin
+    - Fixed use dsn from content-location when it exists
+    - Fixed use exclusive locks when doing SPARUL ops
+    - Fixed when selection list contains expressions with constants
+      do not inline OJ
+    - Fixed small bugs
+
+  * ODS Applications
+    - Added ACL Inheritance
+    - Added ACL semantic ping
+    - Added group sharing
+    - Added IMAP support
+    - Added JSON format for webfinger
+    - Added language and type options for offers
+    - Added 'Likes', 'Dislikes', 'Owns', 'Knows' and 'Social Network'
+    - Added linkblog pages
+    - Added login with Google account
+    - Added microblog template
+    - Added new index on OL accounts
+    - Added new login and register library
+    - Added profile security for offers, likes etc
+    - Added progress bar, ping and ACL
+    - Added RDF graph property for links
+    - Added RDFa info
+    - Added RSS and Atom imports
+    - Added signed mails
+    - Added support for LinkedIn
+    - Added support for Salmon protocol
+    - Added support for SWD
+    - Added support for Twitter
+    - Added UI for Login Authentication Keys
+    - Added WebID to 'My Profile'
+    - Fixed ACL handling
+    - Fixed HTTPS handling
+    - Fixed certificates
+    - Fixed hyperlink session expire issue
+    - Fixed openID server parameters extraction
+    - Fixed RDF object properties
+    - Fixed Twitter and LinkedIn registration/login
+    - Fixed WebID for Briefcase instances
+    - Fixed X.509 certificates in user pages
+    - Fixed XRDS
+    - Updated to CKeditor version 3.5.2
+
+
 July 09, 2010, V6.1.2:
   * Database engine
     - Added FOAF+SSL based authentication for client connection
diff --git a/aclocal.m4 b/aclocal.m4
index 79454f5..0db7c18 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -13,8 +13,8 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],,
-[m4_warning([this file was generated for autoconf 2.63.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
+[m4_warning([this file was generated for autoconf 2.65.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
diff --git a/appsrc/Makefile.in b/appsrc/Makefile.in
index e30e3db..ef7a5fe 100644
--- a/appsrc/Makefile.in
+++ b/appsrc/Makefile.in
@@ -200,6 +200,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-Addressbook/Makefile.in b/appsrc/ODS-Addressbook/Makefile.in
index b818c77..356db60 100644
--- a/appsrc/ODS-Addressbook/Makefile.in
+++ b/appsrc/ODS-Addressbook/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-Addressbook/make_vad.sh b/appsrc/ODS-Addressbook/make_vad.sh
index fbde24a..be4ecb6 100755
--- a/appsrc/ODS-Addressbook/make_vad.sh
+++ b/appsrc/ODS-Addressbook/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.47.2.16 2010/07/09 14:37:00 source Exp $
+#  $Id: make_vad.sh,v 1.47.2.30 2011/03/23 12:17:57 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -30,7 +30,7 @@ export LANG LC_ALL
 
 MODE=$1
 LOGDIR=`pwd`
-VERSION="1.4.55"
+VERSION="1.4.66"
 LOGFILE="${LOGDIR}/vad_make.log"
 STICKER_DAV="vad_dav.xml"
 STICKER_FS="vad_filesystem.xml"
@@ -222,7 +222,7 @@ sticker_init() {
   echo "  <name package=\"AddressBook\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS AddressBook Manager\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
@@ -234,8 +234,8 @@ sticker_init() {
   echo "<dependencies>" >> $STICKER
   echo "  <require>" >> $STICKER
   echo "    <name package=\"Framework\"/>" >> $STICKER
-  echo "    <versions_later package=\"1.73.21\">" >> $STICKER
-  echo "      <prop name=\"Date\" value=\"2010-07-08 12:00\" />" >> $STICKER
+  echo "    <versions_later package=\"1.76.96\">" >> $STICKER
+  echo "      <prop name=\"Date\" value=\"2010-10-08 12:00\" />" >> $STICKER
   echo "      <prop name=\"Comment\" value=\"An incompatible version of the ODS Framework\" />" >> $STICKER
   echo "    </versions_later>" >> $STICKER
   echo "  </require>" >> $STICKER
diff --git a/appsrc/ODS-Addressbook/sql/ab-a-api.sql b/appsrc/ODS-Addressbook/sql/ab-a-api.sql
index 123b582..cfc5a6a 100644
--- a/appsrc/ODS-Addressbook/sql/ab-a-api.sql
+++ b/appsrc/ODS-Addressbook/sql/ab-a-api.sql
@@ -1,5 +1,5 @@
 --
---  $Id: ab-a-api.sql,v 1.16.2.2 2009/12/08 23:25:22 source Exp $
+--  $Id: ab-a-api.sql,v 1.16.2.3 2010/09/20 10:14:39 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Addressbook/sql/ab-a-code.sql b/appsrc/ODS-Addressbook/sql/ab-a-code.sql
index 0fcd831..5b6ac7c 100644
--- a/appsrc/ODS-Addressbook/sql/ab-a-code.sql
+++ b/appsrc/ODS-Addressbook/sql/ab-a-code.sql
@@ -1,5 +1,5 @@
 --
---  $Id: ab-a-code.sql,v 1.50.2.11 2010/07/09 14:37:00 source Exp $
+--  $Id: ab-a-code.sql,v 1.50.2.23 2011/03/23 12:17:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -19,6 +19,67 @@
 --  with this program; if not, write to the Free Software Foundation, Inc.,
 --  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 --
+
+-------------------------------------------------------------------------------
+--
+-- ACL Functions
+--
+-------------------------------------------------------------------------------
+create procedure AB.WA.acl_condition (
+  in domain_id integer,
+  in id integer := null)
+{
+  if (not is_https_ctx ())
+    return 0;
+
+  if (exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_ACL is not null))
+    return 1;
+
+  if (exists (select 1 from AB.WA.PERSONS where P_ID = id and P_ACL is not null))
+    return 1;
+
+  return 0;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.acl_check (
+  in domain_id integer,
+  in id integer := null)
+{
+  declare rc varchar;
+  declare graph_iri, groups_iri, acl_iris any;
+
+  rc := '';
+  if (AB.WA.acl_condition (domain_id, id))
+  {
+    acl_iris := vector (AB.WA.forum_iri (domain_id));
+    if (not isnull (id))
+      acl_iris := vector (SIOC..addressbook_contact_iri (domain_id, id), AB.WA.forum_iri (domain_id));
+
+    graph_iri := AB.WA.acl_graph (domain_id);
+    groups_iri := SIOC..acl_groups_graph (AB.WA.domain_owner_id (domain_id));
+    rc := SIOC..acl_check (graph_iri, groups_iri, acl_iris);
+  }
+  return rc;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.acl_list (
+  in domain_id integer)
+{
+  declare graph_iri, groups_iri, iri any;
+
+  iri := AB.WA.forum_iri (domain_id);
+  graph_iri := AB.WA.acl_graph (domain_id);
+  groups_iri := SIOC..acl_groups_graph (AB.WA.domain_owner_id (domain_id));
+  return SIOC..acl_list (graph_iri, groups_iri, iri);
+}
+;
+
 -------------------------------------------------------------------------------
 --
 -- Session Functions
@@ -37,13 +98,15 @@ create procedure AB.WA.session_domain (
 
   options := http_map_get('options');
   if (not is_empty_or_null (options))
+  {
     domain_id := get_keyword ('domain', options);
+  }
   if (is_empty_or_null (domain_id))
   {
     aPath := split_and_decode (trim (http_path (), '/'), 0, '\0\0/');
     domain_id := cast(aPath[1] as integer);
   }
-  if (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id))
+  if (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_TYPE_NAME = 'AddressBook'))
     domain_id := -1;
 
 _end:;
@@ -56,64 +119,27 @@ _end:;
 create procedure AB.WA.session_restore(
   inout params any)
 {
-  declare aPath, domain_id, user_id, user_name, user_role, sid, realm, options any;
-
-  declare exit handler for sqlstate '*'
-  {
-    domain_id := -2;
-    goto _end;
-  };
+  declare domain_id, account_id, account_rights any;
 
-  sid := get_keyword('sid', params, '');
-  realm := get_keyword('realm', params, '');
-
-  options := http_map_get('options');
-  if (not is_empty_or_null(options))
-    domain_id := get_keyword('domain', options);
-  if (is_empty_or_null (domain_id))
-  {
-    aPath := split_and_decode (trim (http_path (), '/'), 0, '\0\0/');
-    domain_id := cast(aPath[1] as integer);
-  }
-  if (not exists(select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and domain_id <> -2))
-    domain_id := -1;
+  domain_id := AB.WA.session_domain (params);
+  account_id := -1;
 
-_end:
-  domain_id := cast (domain_id as integer);
-  user_id := -1;
   for (select U.U_ID,
               U.U_NAME,
               U.U_FULL_NAME
          from DB.DBA.VSPX_SESSION S,
               WS.WS.SYS_DAV_USER U
-        where S.VS_REALM = realm
-          and S.VS_SID   = sid
+        where S.VS_REALM = get_keyword ('realm', params, 'wa')
+          and S.VS_SID   = get_keyword ('sid', params, '')
           and S.VS_UID   = U.U_NAME) do
   {
-    user_id   := U_ID;
-    user_name := AB.WA.user_name(U_NAME, U_FULL_NAME);
-    user_role := AB.WA.access_role(domain_id, U_ID);
+    account_id := U_ID;
   }
-  if ((user_id = -1) and (domain_id >= 0) and (not exists(select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_IS_PUBLIC = 1)))
-    domain_id := -1;
-
-  if (user_id = -1)
-    if (domain_id = -1)
-    {
-      user_role := 'expire';
-      user_name := 'Expire session';
-    } else if (domain_id = -2) {
-      user_role := 'public';
-      user_name := 'Public User';
-    } else {
-      user_role := 'guest';
-      user_name := 'Guest User';
-    }
-
-  return vector('domain_id', domain_id,
-                'user_id',   user_id,
-                'user_name', user_name,
-                'user_role', user_role
+  account_rights := AB.WA.access_rights (domain_id, account_id);
+  return vector (
+                 'domain_id', domain_id,
+                 'account_id',   account_id,
+                 'account_rights', account_rights
                );
 }
 ;
@@ -123,7 +149,8 @@ _end:
 -- Freeze Functions
 --
 -------------------------------------------------------------------------------
-create procedure AB.WA.frozen_check(in domain_id integer)
+create procedure AB.WA.frozen_check (
+  in domain_id integer)
 {
   declare exit handler for not found { return 1; };
 
@@ -146,7 +173,8 @@ create procedure AB.WA.frozen_check(in domain_id integer)
 
 -------------------------------------------------------------------------------
 --
-create procedure AB.WA.frozen_page(in domain_id integer)
+create procedure AB.WA.frozen_page (
+  in domain_id integer)
 {
   return (select WAI_FREEZE_REDIRECT from DB.DBA.WA_INSTANCE where WAI_ID = domain_id);
 }
@@ -161,64 +189,23 @@ create procedure AB.WA.check_admin(
   in user_id integer) returns integer
 {
   declare group_id integer;
-  group_id := (select U_GROUP from SYS_USERS where U_ID = user_id);
 
-  if (user_id = 0)
-    return 1;
-  if (user_id = http_dav_uid ())
+  if ((user_id = 0) or (user_id = http_dav_uid ()))
     return 1;
-  if (group_id = 0)
-    return 1;
-  if (group_id = http_dav_uid ())
-    return 1;
-  if(group_id = http_dav_uid()+1)
-    return 1;
-  return 0;
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure AB.WA.check_grants(in domain_id integer, in user_id integer, in role_name varchar)
-{
-  whenever not found goto _end;
 
-  if (AB.WA.check_admin(user_id))
+  group_id := (select U_GROUP from SYS_USERS where U_ID = user_id);
+  if ((group_id = 0) or (group_id = http_dav_uid ()) or (group_id = http_dav_uid()+1))
     return 1;
-  if (role_name is null or role_name = '')
-    return 0;
-  if (role_name = 'admin')
-    return 0;
-  if (role_name = 'guest') {
-    if (exists(select 1
-                 from SYS_USERS A,
-                      WA_MEMBER B,
-                      WA_INSTANCE C
-                where A.U_ID = user_id
-                  and B.WAM_USER = A.U_ID
-                  and B.WAM_INST = C.WAI_NAME
-                  and C.WAI_ID = domain_id))
-      return 1;
-  }
-  if (role_name = 'owner')
-    if (exists(select 1
-                 from SYS_USERS A,
-                      WA_MEMBER B,
-                      WA_INSTANCE C
-                where A.U_ID = user_id
-                  and B.WAM_USER = A.U_ID
-                  and B.WAM_MEMBER_TYPE = 1
-                  and B.WAM_INST = C.WAI_NAME
-                  and C.WAI_ID = domain_id))
-      return 1;
-_end:
+
   return 0;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure AB.WA.check_grants2(in role_name varchar, in page_name varchar)
+create procedure AB.WA.check_grants (
+  in role_name varchar,
+  in page_name varchar)
 {
   declare tree any;
 
@@ -231,66 +218,67 @@ create procedure AB.WA.check_grants2(in role_name varchar, in page_name varchar)
 
 -------------------------------------------------------------------------------
 --
-create procedure AB.WA.access_role(in domain_id integer, in user_id integer)
+create procedure AB.WA.access_rights (
+  in domain_id integer,
+  in account_id integer)
 {
-  whenever not found goto _end;
+  declare rc varchar;
+
+  if (domain_id <= 0)
+    return null;
 
-  if (AB.WA.check_admin (user_id))
-    return 'admin';
+  if (AB.WA.check_admin (account_id))
+    return 'W';
 
   if (exists(select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
                 and B.WAM_MEMBER_TYPE = 1
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
-    return 'owner';
+    return 'W';
 
   if (exists(select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
                 and B.WAM_MEMBER_TYPE = 2
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
-    return 'author';
+    return 'W';
+
+  if (is_https_ctx ())
+  {
+    rc := AB.WA.acl_check (domain_id);
+    if (rc <> '')
+      return rc;
+  }
 
   if (exists(select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
-    return 'reader';
+    return 'R';
 
   if (exists(select 1
-               from SYS_USERS A
-              where A.U_ID = user_id))
-    return 'guest';
+                from DB.DBA.WA_INSTANCE
+               where WAI_ID = domain_id
+                 and WAI_IS_PUBLIC = 1))
+    return 'R';
 
-_end:
-  return 'public';
-}
-;
+  if (is_https_ctx () and exists (select 1 from AB.WA.acl_list (id)(iri varchar) x where x.id = domain_id))
+    return '';
 
--------------------------------------------------------------------------------
---
-create procedure AB.WA.access_is_write (in access_role varchar)
-{
-  if (is_empty_or_null (access_role))
-    return 0;
-  if (access_role = 'guest')
-    return 0;
-  if (access_role = 'public')
-    return 0;
-  return 1;
+  return null;
 }
 ;
 
@@ -331,11 +319,11 @@ create procedure AB.WA.menu_tree ()
   S :=
 '<?xml version="1.0" ?>
 <menu_tree>
-  <node name="home" url="home.vspx"            id="1"   allowed="public guest reader author owner admin">
-    <node name="11" url="home.vspx"            id="11"  allowed="public guest reader author owner admin"/>
-    <node name="12" url="search.vspx"          id="12"  allowed="public guest reader author owner admin"/>
-    <node name="13" url="error.vspx"           id="13"  allowed="public guest reader author owner admin"/>
-    <node name="14" url="settings.vspx"        id="14"  allowed="reader author owner admin"/>
+  <node name="home" url="home.vspx"            id="1"   allowed="W R">
+    <node name="11" url="home.vspx"            id="11"  allowed="W R"/>
+    <node name="12" url="search.vspx"          id="12"  allowed="W R"/>
+    <node name="13" url="error.vspx"           id="13"  allowed="W R"/>
+    <node name="14" url="settings.vspx"        id="14"  allowed="W"/>
   </node>
 </menu_tree>';
 
@@ -376,7 +364,7 @@ create procedure AB.WA.iri_fix (
   {
     declare V any;
 
-    V := rfc1808_parse_uri (S);
+    V := rfc1808_parse_uri (cast (S as varchar));
     V [0] := 'https';
     V [1] := http_request_header (http_request_header(), 'Host', null, registry_get ('URIQADefaultHost'));
     S := DB.DBA.vspx_uri_compose (V);
@@ -851,6 +839,15 @@ create procedure AB.WA.forum_iri (
 
 -------------------------------------------------------------------------------
 --
+create procedure AB.WA.acl_graph (
+  in domain_id integer)
+{
+  return SIOC..acl_graph ('AddressBook', AB.WA.domain_name (domain_id));
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure AB.WA.domain_sioc_url (
   in domain_id integer,
   in sid varchar := null,
@@ -1988,9 +1985,12 @@ create procedure AB.WA.ab_tree2(
   retValue := vector ();
 
   if ((node_type = 'u') and (node_id = -1))
-    for (select distinct U_ID, U_NAME from AB.WA.GRANTS, DB.DBA.SYS_USERS where G_GRANTEE_ID = user_id and G_GRANTER_ID = U_ID order by 2) do
+  {
+    for (select distinct U_ID, U_NAME from AB..GRANTS_VIEW where id = user_id order by 2) do
+    {
       retValue := vector_concat(retValue, vector(U_NAME, AB.WA.make_node ('u', U_ID), AB.WA.make_path(path, 'u', U_ID)));
-
+    }
+  }
   return retValue;
 }
 ;
@@ -2009,8 +2009,10 @@ create procedure AB.WA.ab_node_has_childs (
   node_type := AB.WA.node_type(node);
 
   if ((node_type = 'u') and (node_id = -1))
-    if (exists (select 1 from AB.WA.GRANTS, DB.DBA.SYS_USERS where G_GRANTEE_ID = user_id and G_GRANTER_ID = U_ID))
+  {
+    if (exists (select 1 from AB..GRANTS_VIEW where id = user_id))
       return 1;
+  }
 
   return 0;
 }
@@ -2260,83 +2262,62 @@ create procedure AB.WA.dt_format(
   };
 
   S := '';
-  N := 1;
-  while (N <= length(pFormat))
+  for (N := 1; N <= length(pFormat); N := N + 1)
   {
     ch := substring(pFormat, N, 1);
     if (ch = 'M')
     {
       S := concat(S, xslt_format_number(month(pDate), '00'));
-    } else {
-      if (ch = 'm')
+    }
+    else if (ch = 'm')
       {
         S := concat(S, xslt_format_number(month(pDate), '##'));
-      } else
-      {
-        if (ch = 'Y')
+    }
+    else if (ch = 'Y')
         {
           S := concat(S, xslt_format_number(year(pDate), '0000'));
-        } else
-        {
-          if (ch = 'y')
+    }
+    else if (ch = 'y')
           {
             S := concat(S, substring(xslt_format_number(year(pDate), '0000'),3,2));
-          } else {
-            if (ch = 'd')
+    }
+    else if (ch = 'd')
             {
               S := concat(S, xslt_format_number(dayofmonth(pDate), '##'));
-            } else
-            {
-              if (ch = 'D')
+    }
+    else if (ch = 'D')
               {
                 S := concat(S, xslt_format_number(dayofmonth(pDate), '00'));
-              } else
-              {
-                if (ch = 'H')
+    }
+    else if (ch = 'H')
                 {
                   S := concat(S, xslt_format_number(hour(pDate), '00'));
-                } else
-                {
-                  if (ch = 'h')
+    }
+    else if (ch = 'h')
                   {
                     S := concat(S, xslt_format_number(hour(pDate), '##'));
-                  } else
-                  {
-                    if (ch = 'N')
+    }
+    else if (ch = 'N')
                     {
                       S := concat(S, xslt_format_number(minute(pDate), '00'));
-                    } else
-                    {
-                      if (ch = 'n')
+    }
+    else if (ch = 'n')
                       {
                         S := concat(S, xslt_format_number(minute(pDate), '##'));
-                      } else
-                      {
-                        if (ch = 'S')
+    }
+    else if (ch = 'S')
                         {
                           S := concat(S, xslt_format_number(second(pDate), '00'));
-                        } else
-                        {
-                          if (ch = 's')
+    }
+    else if (ch = 's')
                           {
                             S := concat(S, xslt_format_number(second(pDate), '##'));
-                          } else
+    }
+    else
                           {
                             S := concat(S, ch);
-                          };
-                        };
-                      };
-                    };
-                  };
-                };
-              };
-            };
-          };
-        };
-      };
-    };
-    N := N + 1;
-  };
+    }
+  }
   return S;
 }
 ;
@@ -2754,12 +2735,16 @@ create procedure AB.WA.validate_tags (
 --
 create procedure AB.WA.ab_sparql (
   in S varchar,
+  in V any := null,
   in debug any := null)
 {
   declare st, msg, meta, rows any;
 
+  if (not isnull (V))
+    V := vector ();
+
   st := '00000';
-  exec (S, st, msg, vector (), 0, meta, rows);
+  exec (S, st, msg, V, vector ('use_cache', 1), meta, rows);
   if (not isnull (debug) and ('00000' <> st))
     dbg_obj_print ('', S, st, msg);
   if ('00000' = st)
@@ -2787,43 +2772,51 @@ create procedure AB.WA.ab_graph_create ()
 
 -------------------------------------------------------------------------------
 --
-create procedure AB.WA.dashboard_get(
-  in domain_id integer,
-  in user_id integer)
+create procedure AB.WA.dashboard_rs(
+  in p0 integer)
 {
-  declare ses any;
+  declare c0 integer;
+  declare c1 varchar;
+  declare c2 datetime;
 
-  ses := string_output ();
-  http ('<ab-db>', ses);
-  for select top 10 *
-        from (select a.P_NAME,
-                     SIOC..addressbook_contact_iri (domain_id, P_ID) P_URI,
-                     coalesce (a.P_UPDATED, now ()) P_UPDATED
-                from AB.WA.PERSONS a,
-                     DB.DBA.WA_INSTANCE b,
-                     DB.DBA.WA_MEMBER c
-                where a.P_DOMAIN_ID = domain_id
-                  and b.WAI_ID = a.P_DOMAIN_ID
-                  and c.WAM_INST = b.WAI_NAME
-                  and c.WAM_USER = user_id
-                order by a.P_UPDATED desc
-             ) x do
+  result_names(c0, c1, c2);
+  for (select top 10 *
+         from (select P_ID,
+                      P_NAME,
+                      P_UPDATED
+                 from AB.WA.PERSONS
+                where P_DOMAIN_ID = p0
+                order by P_UPDATED desc
+              ) x) do
   {
-    declare uname, full_name varchar;
+    result (P_ID, P_NAME, P_UPDATED);
+  }
+}
+;
 
-    uname := (select coalesce (U_NAME, '') from DB.DBA.SYS_USERS where U_ID = user_id);
-    full_name := (select coalesce (coalesce (U_FULL_NAME, U_NAME), '') from DB.DBA.SYS_USERS where U_ID = user_id);
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.dashboard_get(
+  in domain_id integer)
+{
+  declare account_id integer;
+  declare aStream any;
 
-    http ('<ab>', ses);
-    http (sprintf ('<dt>%s</dt>', date_iso8601 (P_UPDATED)), ses);
-    http (sprintf ('<title><![CDATA[%s]]></title>', P_NAME), ses);
-    http (sprintf ('<link><![CDATA[%s]]></link>', P_URI), ses);
-    http (sprintf ('<from><![CDATA[%s]]></from>', full_name), ses);
-    http (sprintf ('<uid>%s</uid>', uname), ses);
-    http ('</ab>', ses);
+  account_id := AB.WA.domain_owner_id (domain_id);
+  aStream := string_output ();
+  http ('<ab-db>', aStream);
+  for (select x.* from AB.WA.dashboard_rs(p0)(_id integer, _name varchar, _time datetime) x where p0 = domain_id) do
+  {
+    http ('<ab>', aStream);
+    http (sprintf ('<dt>%s</dt>', date_iso8601 (coalesce (_time, now ()))), aStream);
+    http (sprintf ('<title><![CDATA[%s]]></title>', _name), aStream);
+    http (sprintf ('<link>%V</link>', SIOC..addressbook_contact_iri (domain_id, _id)), aStream);
+    http (sprintf ('<from><![CDATA[%s]]></from>', AB.WA.account_fullName (account_id)), aStream);
+    http (sprintf ('<uid>%s</uid>', AB.WA.account_name (account_id)), aStream);
+    http ('</ab>', aStream);
   }
-  http ('</ab-db>', ses);
-  return string_output_string (ses);
+  http ('</ab-db>', aStream);
+  return string_output_string (aStream);
 }
 ;
 
@@ -3251,6 +3244,8 @@ create procedure AB.WA.contact_update2 (
     update AB.WA.PERSONS set P_B_MAIL = pValue where P_ID = id;
   if (pName = 'P_B_WEB')
     update AB.WA.PERSONS set P_B_WEB = pValue where P_ID = id;
+  if (pName = 'P_B_INDUSTRY')
+    update AB.WA.PERSONS set P_B_INDUSTRY = pValue where P_ID = id;
   if (pName = 'P_B_ORGANIZATION')
     update AB.WA.PERSONS set P_B_ORGANIZATION = pValue where P_ID = id;
   if (pName = 'P_B_DEPARTMENT')
@@ -3259,6 +3254,8 @@ create procedure AB.WA.contact_update2 (
     update AB.WA.PERSONS set P_B_JOB = pValue where P_ID = id;
   if (pName = 'P_ACL')
     update AB.WA.PERSONS set P_ACL = pValue where P_ID = id;
+  if (pName = 'P_CERTIFICATE')
+    update AB.WA.PERSONS set P_CERTIFICATE = pValue where P_ID = id;
 
   update AB.WA.PERSONS set P_UPDATED = now () where P_ID = id;
 
@@ -3305,54 +3302,22 @@ create procedure AB.WA.contact_update4 (
   in domain_id integer,
   in pFields any,
   in pValues any,
-  in tags varchar,
-  in validation any := null)
+  in tags varchar := null,
+  in options any := null,
+  in validation any := null,
+  in progress_id any := null)
 {
   declare L, N, M varchar;
   declare S varchar;
-  declare st, msg, meta, rows, F, V any;
+  declare tmp, V, F any;
 
-  if (not isnull (validation) and length (validation))
+  tmp := AB.WA.contact_validation (domain_id, pFields, pValues, options, validation, progress_id);
+  if (not isnull (tmp))
   {
-    S := sprintf ('select P_ID from AB.WA.PERSONS where P_DOMAIN_ID = %d', domain_id);
-    V := vector ();
-    for (N := 0; N < length (validation); N := N + 1)
-    {
-      M := AB.WA.vector_index (pFields, validation [N]);
-      if (not isnull (M))
-      {
-        if (not is_empty_or_null (pValues [M]))
-        {
-          S := S || sprintf (' and %s = ?', pFields [M]);
-          V := vector_concat (V, vector (pValues [M]));
-        }
-      }
-    }
-    if (length (V) = length (validation))
-    {
-      st := '00000';
-      exec (S, st, msg, V, 0, meta, rows);
-      if ((st = '00000') and (length (rows) > 0))
-      {
-        V := vector ();
-        F := vector ();
-        for (N := 0; N < length (pFields); N := N + 1) {
-          if (not AB.WA.vector_contains (validation, pFields [N]))
-          {
-            F := vector_concat (F, vector (pFields [N]));
-            V := vector_concat (V, vector (pValues [N]));
-          }
-        }
-        pFields := F;
-        pValues := V;
+    if (length (pFields) = 0)
+      return 0;
 
-        id := vector ();
-        for (N := 0; N < length (rows); N := N + 1)
-        {
-          id := vector_concat (id, vector (rows [N][0]));
-      }
-    }
-  }
+    id := tmp;
   }
 
   if ((isinteger (id)) and (id = -1))
@@ -3381,11 +3346,11 @@ create procedure AB.WA.contact_update4 (
           );
       }
       }
+
   _exit:;
     if (isinteger (id) and (id = -1))
-    {
       return 0;
-    }
+
     V := vector ();
     F := vector ();
     for (N := 0; N < L; N := N + 1)
@@ -3440,48 +3405,435 @@ create procedure AB.WA.contact_delete (
 
 -------------------------------------------------------------------------------
 --
-create procedure AB.WA.person_permissions (
-  in id integer,
+create procedure AB.WA.contact_validation (
   in domain_id integer,
-  in access_role varchar)
+  inout pFields any,
+  inout pValues any,
+  in options any := null,
+  in validation any := null,
+  in progress_id any := null)
 {
-  declare person_domain_id integer;
+  declare N, M varchar;
+  declare S varchar;
+  declare id, st, msg, meta, rows, F, V, T any;
 
-  person_domain_id := (select P_DOMAIN_ID from AB.WA.PERSONS where P_ID = id);
-  if (isnull (person_domain_id))
-    return '';
-  if (person_domain_id = domain_id)
+  id := null;
+  if (not isnull (validation) and length (validation))
   {
-    if (AB.WA.access_is_write (access_role))
-      return 'W';
-    return 'R';
-  }
-  return '';
-}
-;
+    S := sprintf ('select P_ID from AB.WA.PERSONS where P_DOMAIN_ID = %d', domain_id);
+    V := vector ();
+    for (N := 0; N < length (validation); N := N + 1)
+    {
+      M := AB.WA.vector_index (pFields, validation [N]);
+      if (not isnull (M))
+      {
+        S := S || sprintf (' and coalesce(%s, '''') = coalesce(?, '''')', pFields[M]);
+          V := vector_concat (V, vector (pValues [M]));
+        }
+      }
+      st := '00000';
+    exec (S, st, msg, V, vector ('use_cache', 1), meta, rows);
+      if ((st = '00000') and (length (rows) > 0))
+      {
+      declare validationMode varchar;
 
--------------------------------------------------------------------------------
---
-create procedure AB.WA.contact_tags_select (
-  in id integer,
-  in domain_id integer)
-{
-  return coalesce((select P_TAGS from AB.WA.PERSONS where P_ID = id and P_DOMAIN_ID = domain_id), '');
-}
-;
+      id := vector ();
+      for (N := 0; N < length (rows); N := N + 1)
+      {
+        id := vector_concat (id, vector (rows [N][0]));
+      }
+      validationMode := get_keyword ('validationMode', options);
+      if (validationMode = 'ask')
+      {
+        declare pollValue, pollTime varchar;
 
--------------------------------------------------------------------------------
---
-create procedure AB.WA.contact_tags_update (
-  in id integer,
-  in domain_id integer,
-  in tags any)
-{
-  update AB.WA.PERSONS
-     set P_TAGS = tags,
-         P_UPDATED = now()
-   where P_ID = id and
-         P_DOMAIN_ID = domain_id;
+	      registry_set ('addressbook_poll_' || progress_id, 'ask');
+        registry_set ('addressbook_poll_time_' || progress_id, cast (msec_time() as varchar));
+        registry_set ('addressbook_poll_data_' || progress_id, (select P_NAME from AB.WA.PERSONS where P_ID = id[0]));
+	      while (1)
+	      {
+          delay(2);
+
+          -- has answer?
+          pollValue := registry_get ('addressbook_poll_' || progress_id);
+          if (pollValue like 'answer:%')
+          {
+            validationMode := replace (pollValue, 'answer:', '');
+    	      registry_remove ('addressbook_poll_' || progress_id);
+            registry_remove ('addressbook_poll_time_' || progress_id);
+            registry_remove ('addressbook_poll_data_' || progress_id);
+
+            goto _break;
+          }
+
+          -- no client interaction
+          -- stopped?
+          pollTime := cast (registry_get ('addressbook_poll_time_' || progress_id) as integer);
+          if (((msec_time() - pollTime) > 10000) or not AB.WA.import_check_progress_id (progress_id))
+          {
+    	      registry_remove ('addressbook_poll_' || progress_id);
+            registry_remove ('addressbook_poll_time_' || progress_id);
+            registry_remove ('addressbook_poll_data_' || progress_id);
+	          registry_set ('addressbook_action_' || progress_id, 'stop');
+            validationMode := 'skip';
+
+            goto _break;
+          }
+	      }
+	    _break:;
+      }
+        F := vector ();
+      V := vector ();
+      if (validationMode = 'skip')
+      {
+        ;
+      }
+      else if (validationMode = 'merge')
+      {
+        for (N := 0; N < length (pFields); N := N + 1)
+        {
+          if (not AB.WA.vector_contains (validation, pFields [N]))
+          {
+            F := vector_concat (F, vector (pFields [N]));
+            V := vector_concat (V, vector (pValues [N]));
+          }
+        }
+      }
+      else if (validationMode = 'override')
+        {
+        for (N := 0; N < length (pFields); N := N + 1)
+        {
+          if (not AB.WA.vector_contains (validation, pFields[N]))
+          {
+            F := vector_concat (F, vector (pFields[N]));
+            V := vector_concat (V, vector (pValues[N]));
+        }
+      }
+        T := LDAP..contact_fields ();
+        for (N := 0; N < length (T); N := N + 2)
+        {
+          if ((T[N] <> 'P_NAME') and not AB.WA.vector_contains (pFields, T[N]))
+          {
+            F := vector_concat (F, vector (T[N]));
+            V := vector_concat (V, vector (null));
+          }
+        }
+      }
+      pFields := F;
+      pValues := V;
+    }
+  }
+  return id;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.contact_rights (
+  in domain_id integer,
+  in id integer,
+  in access_role varchar)
+{
+  declare retValue varchar;
+
+  retValue := '';
+  if (exists (select 1 from AB.WA.PERSONS where P_ID = id and P_DOMAIN_ID = domain_id))
+  {
+  retValue := AB.WA.acl_check (domain_id, id);
+    if (retValue = '')
+      retValue := access_role;
+  }
+    return retValue;
+  }
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.contact_tags_select (
+  in id integer,
+  in domain_id integer)
+{
+  return coalesce((select P_TAGS from AB.WA.PERSONS where P_ID = id and P_DOMAIN_ID = domain_id), '');
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.contact_tags_update (
+  in id integer,
+  in domain_id integer,
+  in tags any)
+{
+  update AB.WA.PERSONS
+     set P_TAGS = tags,
+         P_UPDATED = now()
+   where P_ID = id and
+         P_DOMAIN_ID = domain_id;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.contact_share (
+  in account_id integer,
+  in person_id integer,
+  in grants varchar,
+  in override integer)
+{
+  declare N, pos, id integer;
+  declare name, V any;
+
+  grants := replace(grants, ' ', '');
+  grants := replace(grants, ',,', ',');
+  grants := trim(grants, ',', '');
+  grants := grants || ',';
+  for (select U_ID, U_NAME from AB.WA.GRANTS, DB.DBA.SYS_USERS where G_GRANTER_ID = account_id and G_PERSON_ID = person_id and G_GRANTEE_ID = U_ID) do
+  {
+    name := U_NAME;
+    id := U_ID;
+    pos := strstr (grants, name || ',');
+    if (isnull (pos))
+    {
+      if (override)
+        delete from AB.WA.GRANTS where G_GRANTER_ID = account_id and G_GRANTEE_ID = id and G_PERSON_ID = person_id;
+    } else {
+      grants := replace (grants, name || ',', '');
+    }
+  }
+  V := split_and_decode (trim (grants, ','), 0, '\0\0,');
+  for (N := 0; N < length (V); N := N + 1)
+  {
+    id := (select U_ID from SYS_USERS where U_NAME = V[N]);
+    if (not isnull(id))
+      insert into AB.WA.GRANTS (G_GRANTER_ID, G_GRANTEE_ID, G_PERSON_ID)
+        values(account_id, id, person_id);
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.contact_certificate (
+  in account_id integer,
+  in mail varchar)
+{
+  return (select TOP 1 P_CERTIFICATE
+            from AB.WA.PERSONS
+           where P_MAIL = mail
+             and length (P_CERTIFICATE) <> 0
+             and P_DOMAIN_ID in (select WAI_ID
+                                   from DB.DBA.WA_INSTANCE,
+                                        DB.DBA.WA_MEMBER
+                                  where WAM_USER = account_id
+                                    and WAM_MEMBER_TYPE = 1
+                                    and WAM_INST = WAI_NAME));
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.value2str (
+  in data any,
+  in labels any,
+  in defaults any)
+{
+  declare N, M integer;
+  declare retValue varchar;
+
+  retValue := '';
+  for (N := 0; N < length (data); N := N + 1)
+  {
+    for (M := 0; M < length (labels); M := M + 1)
+    {
+      retValue := retValue || get_keyword (labels[M], data[N], defaults[M]) || ';';
+    }
+    retValue := retValue || '\n';
+  }
+  return retValue;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.import_count (
+  in type integer,
+  in data any)
+{
+  -- vCard
+  if (type = 0)
+    return AB.WA.import_vcard_count (data);
+
+  -- FOAF
+  if (type = 1)
+    return AB.WA.import_foaf_count (data);
+
+  -- CSV
+  if (type = 2)
+    return AB.WA.import_csv_count (data);
+
+  -- LDAP
+  if (type = 3)
+    return AB.WA.import_ldap_count (data);
+
+  -- LinkedIn
+  if (type = 4)
+    return AB.WA.import_linkedin_count (data);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.import_vcard_count (
+  in content any)
+{
+  declare xmlData, items any;
+  declare retValue integer;
+
+  if (not isstring (content))
+    content := cast (content as varchar);
+
+  xmlData := DB.DBA.IMC_TO_XML (content);
+  xmlData := xml_tree_doc (xmlData);
+  items := xpath_eval ('/*', xmlData, 0);
+  retValue := 0;
+  foreach (any item in items) do
+  {
+    if (xpath_eval ('name(.)', item) = 'IMC-VCARD')
+      retValue := retValue + 1;
+  }
+  return retValue;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.import_foaf_count (
+  in domain_id integer,
+  in content any)
+{
+  return 10;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.import_csv_count (
+  in content any)
+{
+  declare N, nLength integer;
+  declare retValue integer;
+
+  retValue := 0;
+  nLength := length (content);
+  for (N := 1; N < nLength; N := N + 1)
+  {
+    retValue := retValue + 1;
+  }
+  return retValue;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.import_ldap_count (
+  in content any)
+{
+  declare N, nLength integer;
+  declare retValue integer;
+
+  retValue := 0;
+  nLength := length (content);
+  for (N := 0; N < nLength; N := N + 2)
+  {
+    if (content [N] = 'entry')
+      retValue := retValue + 1;
+  }
+  return retValue;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.import_linkedin_count (
+  in content any)
+{
+  declare items any;
+
+  items := xml_tree_doc (content);
+  items := xpath_eval('/connections/person', items, 0);
+
+  return length (items);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.import_check_progress_id (
+  in progress_id any)
+{
+  if (is_empty_or_null (progress_id))
+    return 1;
+
+  if  (cast (registry_get ('addressbook_action_' || progress_id) as varchar) = 'stop')
+    return 0;
+
+  return 1;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.import_inc_progress_id (
+  in progress_id any)
+{
+  declare tmp any;
+
+  if (is_empty_or_null (progress_id))
+    return;
+
+  if  (cast (registry_get ('addressbook_action_' || progress_id) as varchar) = 'stop')
+    return;
+
+  tmp := cast (registry_get('addressbook_index_' || progress_id) as integer) + 1;
+  registry_set ('addressbook_index_' || progress_id, cast (tmp as varchar));
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.import (
+  in domain_id integer,
+  in type integer,
+  in data any,
+  in options any := null,
+  in validation any := null,
+  in progress_id varchar := null)
+{
+  if (type = 0)
+  {
+    -- vCard
+    AB.WA.import_vcard (domain_id, data, options, validation, progress_id);
+  }
+  else if (type = 1)
+  {
+    -- FOAF
+    AB.WA.import_foaf (domain_id, data, options, validation, progress_id);
+  }
+  else if (type = 2)
+  {
+    -- CSV
+    AB.WA.import_csv (domain_id, data, options, validation, progress_id);
+  }
+  else if (type = 3)
+  {
+    -- LDAP
+    AB.WA.import_ldap (domain_id, data, options, validation, progress_id);
+  }
+  else if (type = 4)
+  {
+    -- LinkedIn
+    AB.WA.import_linkedin (domain_id, data, options, validation, progress_id);
+  }
 }
 ;
 
@@ -3492,16 +3844,24 @@ create procedure AB.WA.import_vcard (
   in content any,
   in options any := null,
   in validation any := null,
-  in updatedBefore integer := null,
-  in externalUID varchar := null)
+  in progress_id varchar := null)
 {
   declare L, M, N, nLength, mLength, id integer;
-  declare tmp, uid, oTags, data, pFields, pValues, pField, pField2 any;
+  declare tmp, uid, data, pFields, pValues, pField, pField2 any;
   declare xmlData, xmlItems, itemName, Meta, V any;
-  declare vcardImported any;
+  declare mode, externalUID, updatedBefore, vcardImported any;
 
   vcardImported := vector ();
-  oTags := case when isnull (options) then '' else get_keyword ('tags', options, '') end;
+
+  if (isnull (options))
+    options := vector ();
+
+  mode := get_keyword ('mode', options, 0);
+  if (mode = 2)
+    return AB.WA.import_vcard2 (domain_id, data, options, validation);
+
+  updatedBefore := get_keyword ('updatedBefore', options);
+  externalUID := get_keyword ('externalUID', options);
 
   Meta := vector
     (
@@ -3539,6 +3899,9 @@ create procedure AB.WA.import_vcard (
     itemName := xpath_eval ('name(.)', xmlItem);
     if (itemName = 'IMC-VCARD')
     {
+      if (not AB.WA.import_check_progress_id (progress_id))
+        return;
+
       id := -1;
       uid := null;
       pFields := vector ();
@@ -3553,22 +3916,10 @@ create procedure AB.WA.import_vcard (
           if (not is_empty_or_null (T))
           {
             pField2 := pField;
-            if (pField2 = 'P_BIRTHDAY')
-            {
-              {
-                declare continue handler for sqlstate '*'
-              {
-                  T := '';
-                };
-                T := AB.WA.dt_reformat (T, 'YMD');
-              }
-            }
-            else if (pField2 = 'P_UID')
+            if (pField2 = 'P_UID')
             {
               uid := T;
             }
-            if (not is_empty_or_null (T))
-            {
               if (not isnull (Meta [N+1]))
               {
                 if (strstr (T, ' @TYPE_') <> 0)
@@ -3582,8 +3933,10 @@ create procedure AB.WA.import_vcard (
             } else {
                       V := split_and_decode (Meta [N+1][M], 0, '\0\0,');
                       for (L := 0; L < length (V); L := L + 1)
+                    {
                         if (isnull (strstr (T, ' @TYPE_' || V[L])))
                           goto _exit;
+                    }
                       pField2 := Meta [N+1][M+1];
                     _exit:;
                     }
@@ -3601,34 +3954,29 @@ create procedure AB.WA.import_vcard (
           }
         }
       }
-      }
       if (isnull (uid) and not isnull (externalUID))
       {
         N := strchr (externalUID, '_');
         if (isnull (N))
-        {
           N := 0;
-        }
+
         tmp := subseq (externalUID, N, length (externalUID));
         id := coalesce ((select P_ID from AB.WA.PERSONS where P_DOMAIN_ID = domain_id and P_UID = tmp), -1);
         if (id <> -1)
-        {
           uid := tmp;
         }
-      }
       id := coalesce ((select P_ID from AB.WA.PERSONS where P_DOMAIN_ID = domain_id and P_UID = uid), -1);
       if ((id <> -1) and not isnull (updatedBefore))
       {
         if (exists (select 1 from AB.WA.PERSONS where P_ID = id and P_UPDATED >= updatedBefore))
           goto _skip;
       }
-      commit work;
-      connection_set ('__addressbook_import', '1');
-      id := AB.WA.contact_update4 (id, domain_id, pFields, pValues, oTags, validation);
-      connection_set ('__addressbook_import', '0');
+
+      id := AB.WA.import_contact_update (id, domain_id, pFields, pValues, options, validation, progress_id);
       vcardImported := vector_concat (vcardImported, id);
 
     _skip:;
+      AB.WA.import_inc_progress_id (progress_id);
     }
   }
   return vcardImported;
@@ -3637,147 +3985,131 @@ create procedure AB.WA.import_vcard (
 
 -------------------------------------------------------------------------------
 --
-create procedure AB.WA.import_vcard2 (
+create procedure AB.WA.import_rdf_data (
   in domain_id integer,
-  in content any,
-  in options any := null,
+  in data  any,
+  in options varchar,
   in validation any := null,
-  in contentType any := 0,
-  in contentIRI varchar := null)
-{
-  declare N, M, L, mLength, iLength, id integer;
-  declare tmp, tmp2, tmpTags, data, pFields, pValues any;
-  declare Tags, Meta, Persons, Person, Items any;
-  declare S, T, name, fullName varchar;
-
-  Tags := case when isnull (options) then '' else get_keyword ('tags', options, '') end;
-  if (isnull (contentIRI))
-    contentIRI := AB.WA.ab_graph_create ();
-
-  declare exit handler for sqlstate '*'
+  in progress_id any := null)
   {
-    -- dbg_obj_print (__SQL_STATE, __SQL_MESSAGE);
-    AB.WA.ab_graph_delete (contentIRI);
-    signal ('TEST', 'Bad import source!<>');
-  };
+  declare M integer;
+  declare meta, tags, pValue, pField, pFields, pValues any;
 
-  Meta := vector
+  meta := vector
     (
-      'P_NAME',
-      'P_FIRST_NAME',
-      'P_LAST_NAME',
-      'P_BIRTHDAY',
-      'P_TITLE',
-      'P_TAGS'
+      'iri',                     'P_IRI',
+      'personalProfileDocument', 'P_FOAF',
+      'nick',                    'P_NAME',
+      'name',                    'P_FULL_NAME',
+      'type',                    'P_KIND',
+      'firstNname',              'P_FIRST_NAME',
+      'family_name',             'P_LAST_NAME',
+      'dateOfBirth',             'P_BIRTHDAY',
+      'mbox',                    'P_MAIL',
+      'workplaceHomepage',       'P_WEB',
+      'icqChatID',               'P_ICQ',
+      'msnChatID',               'P_MSN',
+      'aimChatID',               'P_AIM',
+      'yahooChatID',             'P_YAHOO',
+      'title',                   'P_TITLE',
+      'phone',                   'P_H_PHONE',
+      'homepage',                'P_H_WEB',
+      'workplaceHomepage',       'P_B_WEB',
+      'lat',                     'P_H_LAT',
+      'long',                    'P_H_LNG',
+      'depiction',               'P_PHOTO'
     );
-  mLength := length (Meta);
-
-  if (contentType = 0)
-  {
-    DB.DBA.RDF_LOAD_RDFXML (content, contentIRI, contentIRI);
-  } else {
-    declare st, msg, meta any;
 
-    -- S := sprintf ('SPARQL load <%s> into graph <%s>', content, contentIRI);
-    S := sprintf ('SPARQL\ndefine get:soft "soft"\n  define get:uri "%s"\nSELECT *\n  FROM <%s>\n WHERE { ?s ?p ?o }', content, contentIRI);
-    st := '00000';
-    exec (S, st, msg, vector (), 0, meta, Items);
-    if ('00000' <> st)
-      signal (st, msg);
-  }
-  S := ' SPARQL '                                                    ||
-       ' define input:storage "" '                                   ||
-       ' prefix vcard: <http://www.w3.org/2001/vcard-rdf/3.0#> '     ||
-       ' select ?P_ID'                                               ||
-       '   from <%s> '                                               ||
-       '  where { ?P_ID a vcard:vCard . }';
-  Items := AB.WA.ab_sparql (sprintf (S, contentIRI));
-  for (L := 0; L < length (Items); L := L + 1)
-  {
-    AB.WA.ab_sparql (sprintf ('SPARQL\ndefine get:soft "soft"\n  define get:uri "%s"\nSELECT *\n  FROM <%s>\n WHERE { ?s ?p ?o }', Items[L][0], contentIRI));
-    S := ' SPARQL ' ||
-         ' define input:storage "" ' ||
-         ' prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> ' ||
-         ' prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> '      ||
-         ' prefix foaf: <http://xmlns.com/foaf/0.1/> '                 ||
-         ' prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> '    ||
-         ' prefix vcard: <http://www.w3.org/2001/vcard-rdf/3.0#> '     ||
-         ' prefix bio: <http://vocab.org/bio/0.1/> '                   ||
-         ' select ?P_NAME ?P_FIRST_NAME ?P_LAST_NAME ?P_BIRTHDAY ?P_TITLE ?P_TAGS' ||
-         '   from <%s> '                                          ||
-         '  where { '                                             ||
-         '         <%s> a vcard:vCard . '                         ||
-         '         optional { ?P_ID vcard:NICKNAME ?P_NAME. }. '  ||
-         '         optional { ?P_ID vcard:N ?N. '                 ||
-         '                    ?N vcard:Given ?P_FIRST_NAME. '     ||
-         '                    ?N vcard:Family ?P_LAST_NAME. '     ||
-         '                    ?N vcard:Prefix ?P_TITLE. '         ||
-         '                  }.'                                   ||
-         '         optional { ?P_ID vcard:BDAY ?P_BIRTHDAY} . '   ||
-         '         optional { ?P_ID vcard:CATEGORIES ?P_TAGS} . ' ||
-         '       }';
-    Person := AB.WA.ab_sparql (sprintf (S, Items[L][0], contentIRI));
-    if (length (Person) = 1)
-    {
-      Person := Persons[0];
-      name := Person[1];
-      if (not is_empty_or_null (name))
-      {
-        pFields := vector ('P_NAME');
-        pValues := vector (name);
-        if (content like 'http://%')
-        {
-          pFields := vector_concat (pFields, vector ('P_FOAF'));
-          pValues := vector_concat (pValues, vector (content));
-        }
-        for (M := 2; M < mLength; M := M + 1)
-        {
-          tmp := Meta[M];
-          tmp2 := Person[M];
-          tmpTags := tags;
-          if (tmp = 'P_BIRTHDAY')
-          {
+  pFields := vector ();
+  pValues := vector ();
+  for (M := 0; M < length (meta); M := M + 2)
             {
-              declare continue handler for sqlstate '*'
+    pValue := get_keyword (meta[M], data);
+    if (not isnull(pValue))
               {
-                tmp := '';
-              };
-              tmp2 := AB.WA.dt_reformat (tmp2, 'Y-M-D');
+      pField := meta[M+1];
+      pFields := vector_concat (pFields, vector (pField));
+      pValues := vector_concat (pValues, vector (pValue));
             }
           }
-          if (tmp = 'P_KIND')
+  pValue := get_keyword ('keywords', data);
+  if (not isnull(pValue))
           {
-            tmp2 := case when (tmp2 = 'http://xmlns.com/foaf/0.1/Organization') then 1 else 0 end;
+    tags := AB.WA.tags_join (get_keyword ('tags', options, ''), pValue);
+    options := AB.WA.set_keyword ('tags', options, tags);
           }
-          if (tmp = 'P_MAIL')
+  pValue := get_keyword ('interest', data);
+  if (not isnull(pValue))
           {
-            tmp2 := replace (tmp2, 'mailto:', '');
+    pValue := AB.WA.value2str(pValue, vector('value', 'label'), vector('', ''));
+    pFields := vector_concat (pFields, vector ('P_INTERESTS'));
+    pValues := vector_concat (pValues, vector (pValue));
           }
-          if (tmp = 'P_PHONE')
+  pValue := get_keyword ('knows', data);
+  if (not isnull(pValue))
           {
-            tmp2 := replace (tmp2, 'tel:', '');
+    pValue := AB.WA.value2str(pValue, vector('x', 'value'), vector('foaf:knows', ''));
+    pFields := vector_concat (pFields, vector ('P_RELATIONSHIPS'));
+    pValues := vector_concat (pValues, vector (pValue));
           }
-          if (tmp = 'P_TITLE')
-          {
-            tmp2 := AB.WA.import_title (tmp2);
+  AB.WA.import_contact_update (-1, domain_id, pFields, pValues, options, validation, progress_id);
           }
-          if (tmp = 'P_TAGS')
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.import_vcard2 (
+  in domain_id integer,
+  in content any,
+  in options any := null,
+  in validation any := null,
+  in progress_id varchar := null)
           {
-            tmpTags := AB.WA.tags_join (tmpTags, tmp2);
-            tmp := '';
-          }
-          if (tmp <> '')
+  declare items, data any;
+  declare S, st, msg, meta any;
+  declare contentType, contentIRI any;
+
+  if (isnull (options))
+    options := vector ();
+
+  contentType := get_keyword ('contentType', options, 0);
+  contentIRI := get_keyword ('contentIRI', options, AB.WA.ab_graph_create ());
+
+  declare exit handler for sqlstate '*'
           {
-            pFields := vector_concat (pFields, vector (tmp));
-            pValues := vector_concat (pValues, vector (tmp2));
-          }
-        }
+    AB.WA.ab_graph_delete (contentIRI);
+    signal ('TEST', 'Bad import source!<>');
+  };
+
+  if (contentType > 0)
+  {
+    S := sprintf ('sparql define get:soft "soft" define get:uri "%s" select * from <%s> where { ?s ?p ?o }', content, contentIRI);
+    st := '00000';
         commit work;
-        connection_set ('__addressbook_import', '1');
-        AB.WA.contact_update4 (-1, domain_id, pFields, pValues, tmpTags, validation);
-        connection_set ('__addressbook_import', '0');
+    exec (S, st, msg, vector (), vector ('use_cache', 1), meta, Items);
+    if ('00000' <> st)
+      signal (st, msg);
       }
+  else if (contentType = 0)
+  {
+    DB.DBA.RDF_LOAD_RDFXML (content, contentIRI, contentIRI);
     }
+
+  S := sprintf ('sparql
+                 define input:storage ""
+                 prefix vcard: <http://www.w3.org/2001/vcard-rdf/3.0#>
+                 select ?x
+                   from <%s>
+                  where { ?x a vcard:vCard . }', contentIRI);
+  items := AB.WA.ab_sparql (S);
+  foreach (any item in items) do
+  {
+    if (not AB.WA.import_check_progress_id (progress_id))
+      return;
+
+    data := AB.WA.import_vcard2_array (item[0], contentIRI);
+    AB.WA.import_rdf_data (domain_id, data, options, validation, progress_id);
+    AB.WA.import_inc_progress_id (progress_id);
   }
 
 _delete:;
@@ -3787,21 +4119,59 @@ _delete:;
 
 -------------------------------------------------------------------------------
 --
-create procedure AB.WA.import_title (
-  in title varchar)
+create procedure AB.WA.import_vcard2_array (
+  in iri varchar,
+  in graph varchar)
 {
-  declare M integer;
-  declare V any;
-
-  V := vector ('Mr', 'Mrs', 'Dr', 'Ms', 'Sir');
-  for (M := 0; M < length (V); M := M + 1)
+  declare N integer;
+  declare S varchar;
+  declare V, S, st, msg, rows, meta any;
+
+  S := sprintf (' sparql
+                  define input:storage ""
+                  prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+                  prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+                  prefix foaf: <http://xmlns.com/foaf/0.1/>
+                  prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+                  prefix vcard: <http://www.w3.org/2001/vcard-rdf/3.0#>
+                  prefix bio: <http://vocab.org/bio/0.1/>
+                  select ?nick ?firstName ?family_name ?birthday ?title ?keywords
+                    from <%s>
+                   where {
+                          ?iri a vcard:vCard .
+                          optional { ?iri vcard:NICKNAME ?nick. }.
+                          optional { ?iri vcard:N ?N.
+                                     ?N vcard:Given ?firstName.
+                                     ?N vcard:Family ?family_name.
+                                     ?N vcard:Prefix ?title.
+                                   }.
+                          optional { ?iri vcard:BDAY ?birthday} .
+                          optional { ?iri vcard:CATEGORIES ?keywords} .
+                          filter (?iri = iri(?::0)).
+                         }', graph);
+  V := vector ();
+  st := '00000';
+  commit work;
+  exec (S, st, msg, vector (iri), vector ('use_cache', 1), meta, rows);
+  if (st = '00000')
+  {
+    meta := ODS.ODS_API.simplifyMeta(meta);
+    foreach (any row in rows) do
   {
-    if (lcase (title) like (lcase (V[M])|| '%'))
+      N := 0;
+      while (N < length(meta))
+      {
+        if (meta[N] like '%_array')
     {
-      return V[M];
+          ODS.ODS_API.appendPropertyArray (V, N, meta[N], row[N], meta, row);
+        } else {
+          ODS.ODS_API.appendProperty (V, meta[N], row[N]);
     }
+        N := N + 1;
   }
-  return '';
+    }
+  }
+  return V;
 }
 ;
 
@@ -3810,216 +4180,72 @@ create procedure AB.WA.import_title (
 create procedure AB.WA.import_foaf (
   inout domain_id integer,
   inout content any,
-  in tags any,
-  in validation any,
-  in contentType any := 0,
-  in contentIRI varchar := null,
-  in contentItems any := null,
-  in contentDepth any := 0,
-  in contentLimit any := 100,
-  in contentFollow any := 'foaf:knows')
+  in options any := null,
+  in validation any := null,
+  in progress_id varchar := null)
 {
-  declare N, M, pLength, mLength, iLength, id integer;
-  declare tmp, tmp2, tmpTags, data, pFields, pValues any;
-  declare Meta, Persons, Person, Items any;
-  declare S, T, P, name, fullName varchar;
+  declare S, T varchar;
+  declare st, msg, meta, items, data any;
+  declare contentType, contentIRI, contentItems, contentPings, contentDepth, contentLimit, contentFollow any;
+
+  if (isnull (options))
+    options := vector ();
 
-  if (isnull (contentIRI))
-    contentIRI := AB.WA.ab_graph_create ();
+  contentType := get_keyword ('contentType', options, 0);
+  contentIRI := get_keyword ('contentIRI', options, AB.WA.ab_graph_create ());
+  contentItems := get_keyword ('contentItems', options);
+  contentPings := get_keyword ('contentPings', options);
 
   declare exit handler for sqlstate '*'
   {
-    -- dbg_obj_print (__SQL_STATE, __SQL_MESSAGE);
+    -- dbg_obj_print ('', __SQL_MESSAGE);
     AB.WA.ab_graph_delete (contentIRI);
     signal ('TEST', 'Bad import source!<>');    
   };
 
-  Meta := vector
-    (
-      'P_ID',
-      'P_NAME',
-      'P_FULL_NAME',
-      'P_KIND',
-      'P_FIRST_NAME',
-      'P_LAST_NAME',
-      'P_BIRTHDAY',
-      'P_MAIL',
-      'P_WEB',
-      'P_ICQ',
-      'P_MSN',
-      'P_AIM',
-      'P_YAHOO',
-      'P_TITLE',
-      'P_H_PHONE',
-      'P_H_WEB',
-      'P_B_WEB',
-      'P_H_LAT',
-      'P_H_LNG',
-      'P_TAGS',
-      'P_PHOTO'
-    );
-  mLength := length (Meta);
-
-  if (contentType = 0)
+  if (contentType > 0)
   {
-    DB.DBA.RDF_LOAD_RDFXML (content, contentIRI, contentIRI);
-  } else {
-    declare st, msg, meta any;
+    contentDepth := get_keyword ('contentDepth', options, 0);
+    contentLimit := get_keyword ('contentLimit', options, 100);
+    contentFollow := get_keyword ('contentFollow', options, 'foaf:knows');
   
     T := case when contentDepth then sprintf ('  define input:grab-depth %d\n  define input:grab-limit %d\n  define input:grab-seealso <%s>\n  define input:grab-destination <%s>\n', contentDepth, contentLimit, contentFollow, contentIRI) else '' end;
     S := sprintf ('SPARQL\n%s  define get:soft "soft"\n  define get:uri "%s"\nSELECT *\n  FROM <%s>\n WHERE { ?s ?p ?o }', T, content, contentIRI);
     st := '00000';
+    commit work;
     exec (S, st, msg, vector (), 0, meta, Items);
     if ('00000' <> st)
       signal (st, msg);
   }
+  else if (contentType = 0)
+  {
+    DB.DBA.RDF_LOAD_RDFXML (content, contentIRI, contentIRI);
+  }
+
   if (isnull (contentItems))
   {
-    Items := AB.WA.ab_sparql (sprintf (' SPARQL                                                    \n' ||
-                                       ' define input:storage ""                                   \n' ||
-                                       ' PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n' ||
-                                       ' PREFIX foaf: <http://xmlns.com/foaf/0.1/>                 \n' ||
-                                       ' SELECT ?x                                                 \n' ||
-                                       '   FROM <%s>                                               \n' ||
-                                       '  WHERE {                                                  \n' ||
-                                       '          {?x a foaf:Person .}                             \n' ||
-                                       '          UNION                                            \n' ||
-                                       '          {?x a foaf:Organization .}                       \n' ||
-                                       '        }', contentIRI));
+    Items := AB.WA.ab_sparql (sprintf (' SPARQL
+                                         define input:storage ""
+                                         PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+                                         PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+                                         SELECT ?x
+                                           FROM <%s>
+                                          WHERE {
+                                                  {?x a foaf:Person .}
+                                                  UNION
+                                                  {?x a foaf:Organization .}
+                                                }', contentIRI));
   } else {
     Items := contentItems;
   }
-  iLength := length (Items);
-
-    S := ' SPARQL ' ||
-       ' define input:storage "" ' ||
-       ' prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> ' ||
-       ' prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> ' ||
-       ' prefix foaf: <http://xmlns.com/foaf/0.1/> ' ||
-       ' prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> ' ||
-       ' prefix bio: <http://vocab.org/bio/0.1/> ' ||
-       ' select ?P_ID, ?P_NAME, ?P_FULL_NAME, ?P_KIND, ?P_FIRST_NAME, ?P_LAST_NAME, ?P_BIRTHDAY, ?P_MAIL, ?P_WEB, ?P_ICQ, ?P_MSN, ?P_AIM, ?P_YAHOO, ?P_TITLE, ?P_H_PHONE, ?P_H_WEB, ?P_B_WEB, ?P_H_LAT, ?P_H_LNG, ?P_TAGS, ?P_PHOTO' ||
-       '   from <%s> ' ||
-       '  where { ' ||
-       '         {?P_ID a foaf:Person } UNION {?P_ID a foaf:Organization } . ' ||
-       '         ?P_ID rdf:type ?P_KIND .' ||
-       '         optional { ?P_ID foaf:nick ?P_NAME} . '                        ||
-       '         optional { ?P_ID foaf:title ?P_TITLE} . '                      ||
-       '         optional { ?P_ID foaf:name ?P_FULL_NAME} . '                   ||
-       '         optional { ?P_ID foaf:firstNname ?P_FIRST_NAME} . '            ||
-       '         optional { ?P_ID foaf:family_name ?P_LAST_NAME} . '            ||
-       '         optional { ?P_ID foaf:dateOfBirth ?P_BIRTHDAY} . '             ||
-       '         optional { ?P_ID foaf:mbox ?P_MAIL} . '                        ||
-       '         optional { ?P_ID foaf:workplaceHomepage ?P_WEB} . '            ||
-       '         optional { ?P_ID foaf:icqChatID ?P_ICQ } .'                    ||
-       '         optional { ?P_ID foaf:msnChatID ?P_MSN } .'                    ||
-       '         optional { ?P_ID foaf:aimChatID ?P_AIM } .'                    ||
-       '         optional { ?P_ID foaf:yahooChatID ?P_YAHOO } .'                ||
-       '         optional { ?P_ID foaf:phone ?P_H_PHONE } .'                    ||
-       '         optional { ?P_ID foaf:homepage ?P_H_WEB} . '                   ||
-       '         optional{ ?P_ID foaf:workplaceHomepage ?P_B_WEB } .'          ||
-       '         optional{ ?P_ID foaf:depiction ?P_PHOTO } .'                  ||
-       '         optional{ ?P_ID foaf:based_near ?based_near .'                ||
-       '                   ?based_near geo:lat ?P_H_LAT ;'                     ||
-       '                               geo:long ?P_H_LNG .'                    ||
-       '                 } .'                                                  ||
-       '         optional{ ?P_ID bio:keywords ?P_TAGS } .'                     ||
-       '         optional{ ?P_ID foaf:interest ?interest .'                    ||
-       '                   ?interest rdfs:label ?interest_label. } .'          ||
-         '       }';
-  Persons := AB.WA.ab_sparql (sprintf (S, contentIRI));
-  pLength := length (Persons);
-  P := '';
-  for (N := 0; N < pLength; N := N + 1)
-    {
-    Person := Persons[N];
-    if (P <> Person[0])
-      {
-      for (M := 0; M < iLength; M := M + 1)
-      {
-        if (Person[0] = Items[M][0])
+  foreach (any item in items) do
       {
-          goto _import;
-        }
-      }
-      }
-    goto _next;
+    if (not AB.WA.import_check_progress_id (progress_id))
+      return;
 
-  _import:;
-    P := Person[0];
-    name := Person[1];
-    fullName := Person[2];
-    if (isnull (fullName) and not (isnull (Person[4]) and isnull (Person[5])))
-    {
-      fullName := trim (Person[4] || ' ' || Person[5]);
-    }
-    if (not is_empty_or_null (coalesce (name, fullName)))
-      {
-        pFields := vector ('P_NAME');
-      pValues := vector (coalesce (name, fullName));
-      if (P not like 'nodeID://%')
-	      {
-          pFields := vector_concat (pFields, vector ('P_IRI'));
-        pValues := vector_concat (pValues, vector (P));
-	      }
-	      if (content like 'http://%')
-	      {
-          pFields := vector_concat (pFields, vector ('P_FOAF'));
-          pValues := vector_concat (pValues, vector (content));
-	      }
-            if (not isnull (fullName))
-            {
-        pFields := vector_concat (pFields, vector ('P_FULL_NAME'));
-              pValues := vector_concat (pValues, vector (fullName));
-            }
-      for (M := 3; M < mLength; M := M + 1)
-      {
-            tmp := Meta[M];
-        tmp2 := Person[M];
-        tmpTags := tags;
-            if (tmp = 'P_BIRTHDAY')
-            {
-              {
-            declare continue handler for sqlstate '*'
-            {
-                  tmp := '';
-                };
-                tmp2 := AB.WA.dt_reformat (tmp2, 'Y-M-D');
-              }
-            }
-            if (tmp = 'P_KIND')
-            {
-          tmp2 := case when (tmp2 = 'http://xmlns.com/foaf/0.1/Organization') then 1 else 0 end;
-            }
-            if (tmp = 'P_MAIL')
-            {
-              tmp2 := replace (tmp2, 'mailto:', '');
-            }
-        if (tmp = 'P_PHONE')
-        {
-          tmp2 := replace (tmp2, 'tel:', '');
-        }
-        if (tmp = 'P_TITLE')
-        {
-          tmp2 := AB.WA.import_title (tmp2);
-        }
-        if (tmp = 'P_TAGS')
-        {
-          tmpTags := AB.WA.tags_join (tmpTags, tmp2);
-          tmp := '';
-        }
-            if (tmp <> '')
-            {
-              pFields := vector_concat (pFields, vector (tmp));
-              pValues := vector_concat (pValues, vector (tmp2));
-            }
-          }
-      commit work;
-      connection_set ('__addressbook_import', '1');
-      AB.WA.contact_update4 (-1, domain_id, pFields, pValues, tmpTags, validation);
-      connection_set ('__addressbook_import', '0');
-      }
-  _next:;
+    data := ODS.ODS_API.extractFOAFDataArray (item[0], contentIRI);
+    AB.WA.import_rdf_data (domain_id, data, options, validation, progress_id);
+    AB.WA.import_inc_progress_id (progress_id);
   }
 
 _delete:;
@@ -4031,15 +4257,19 @@ _delete:;
 --
 create procedure AB.WA.import_foaf_content (
   inout content any,
-  in contentType any := 0,
-  in contentIRI any := null,
-  in contentDepth any := 0,
-  in contentLimit any := 100,
-  in contentFollow any := 'foaf:knows')
+  in options any := null)
 {
   declare N, M integer;
   declare tmp, Items, Persons any;
+  declare st, msg, meta any;
   declare S, T, personIRI varchar;
+  declare contentType, contentIRI, contentDepth, contentLimit, contentFollow any;
+
+  if (isnull (options))
+    options := vector ();
+
+  contentType := get_keyword ('contentType', options, 0);
+  contentIRI := get_keyword ('contentIRI', options, AB.WA.ab_graph_create ());
 
   declare exit handler for sqlstate '*'
   {
@@ -4049,90 +4279,76 @@ create procedure AB.WA.import_foaf_content (
   };
 
   Persons := vector ();
-  if (isnull (contentIRI))
-    contentIRI := AB.WA.ab_graph_create ();
   AB.WA.ab_graph_delete (contentIRI);
 
   -- store in QUAD Store
-  if (contentType)
+  if (contentType > 0)
   {
-    declare st, msg, meta any;
+    contentDepth := get_keyword ('contentDepth', options, 0);
+    contentLimit := get_keyword ('contentLimit', options, 100);
+    contentFollow := get_keyword ('contentFollow', options, 'foaf:knows');
 
-    T := '';
-    if (contentDepth)
-      T := sprintf ('  define input:grab-depth %d\n  define input:grab-limit %d\n  define input:grab-seealso <%s>\n  define input:grab-destination <%s>\n', contentDepth, contentLimit, contentFollow, contentIRI);
+    T := case when contentDepth then sprintf ('  define input:grab-depth %d\n  define input:grab-limit %d\n  define input:grab-seealso <%s>\n  define input:grab-destination <%s>\n', contentDepth, contentLimit, contentFollow, contentIRI) else '' end;
     S := sprintf ('sparql \n%s  define get:soft "soft"\n  define get:uri "%s"\nSELECT *\n  FROM <%s>\n WHERE { ?s ?p ?o }', T, content, contentIRI);
     st := '00000';
     exec (S, st, msg, vector (), 0, meta, Items);
-    if ('00000' <> st)
+    if (st <> '00000')
       signal (st, msg);
-  } else {
+  }
+  else
+  {
     DB.DBA.RDF_LOAD_RDFXML (content, contentIRI, contentIRI);
   }
-  Items := AB.WA.ab_sparql (sprintf (' sparql \n' ||
-                                     ' define input:storage ""                                   \n' ||
-                                     ' prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n' ||
-                                     ' prefix foaf: <http://xmlns.com/foaf/0.1/>                 \n' ||
-                                     ' select ?person, ?nick, ?name, ?mbox                       \n' ||
-                                     '   from <%s>                                               \n' ||
-                                     '  where {                                                  \n' ||
-                                     '          [] a foaf:PersonalProfileDocument ;              \n' ||
-                                     '             foaf:primaryTopic ?person .                   \n' ||
-                                     '          optional { ?person foaf:nick ?nick } .           \n' ||
-                                     '          optional { ?person foaf:name ?name } .           \n' ||
-                                     '          optional { ?person foaf:mbox ?mbox } .           \n' ||
-                                     '        }', contentIRI));
+  Items := AB.WA.ab_sparql (sprintf (' sparql
+                                       define input:storage ""
+                                       prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+                                       prefix foaf: <http://xmlns.com/foaf/0.1/>
+                                       select ?person, ?nick, ?name, ?mbox
+                                         from <%s>
+                                        where {
+                                                [] a foaf:PersonalProfileDocument ;
+                                                   foaf:primaryTopic ?person .
+                                                optional { ?person foaf:nick ?nick } .
+                                                optional { ?person foaf:name ?name } .
+                                                optional { ?person foaf:mbox ?mbox } .
+                                              }', contentIRI));
   if (length (Items))
   {
     personIRI := Items[0][0];
     tmp := replace (Items[N][3], 'mailto:', '');
     Persons := vector_concat (Persons, vector (vector (1, personIRI,  coalesce (Items[N][2], Items[N][1]), tmp)));
-    Items := AB.WA.ab_sparql (sprintf (' SPARQL                                                    \n' ||
-                                       ' define input:storage ""                                   \n' ||
-                                       ' prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n' ||
-                                       ' prefix foaf: <http://xmlns.com/foaf/0.1/>                 \n' ||
-                                       ' select ?person, ?nick, ?name, ?mbox                       \n' ||
-                                       '   from <%s>                                               \n' ||
-                                       '  where {                                                  \n' ||
-                                       '          {                                                \n' ||
-                                       '            <%s> foaf:knows ?person .                      \n' ||
-                                       '            ?person a foaf:Person .                        \n' ||
-                                       '            optional { ?person foaf:nick ?nick } .         \n' ||
-                                       '            optional { ?person foaf:name ?name } .         \n' ||
-                                       '            optional { ?person foaf:mbox ?mbox } .         \n' ||
-                                       '          }                                                \n' ||
-                                       '          UNION                                            \n' ||
-                                       '          {                                                \n' ||
-                                       '            <%s> foaf:knows ?person .                      \n' ||
-                                       '            ?person a foaf:Organization .                  \n' ||
-                                       '            optional { ?person foaf:nick ?nick } .         \n' ||
-                                       '            optional { ?person foaf:name ?name } .         \n' ||
-                                       '            optional { ?person foaf:mbox ?mbox } .         \n' ||
-                                       '          }                                                \n' ||
-                                       '        }', contentIRI, personIRI, personIRI));
+    S := sprintf (' sparql
+                    define input:storage ""
+                    prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+                    prefix foaf: <http://xmlns.com/foaf/0.1/>
+                    select ?person, ?nick, ?name, ?mbox
+                      from <%s>
+                     where {
+                             <%s> foaf:knows ?person .
+                             {?person a foaf:Person .}
+                             UNION
+                             {?person a foaf:Organization .}
+                             optional { ?person foaf:nick ?nick } .
+                             optional { ?person foaf:name ?name } .
+                             optional { ?person foaf:mbox ?mbox } .
+                           }', contentIRI, personIRI);
   } else {
-    Items := AB.WA.ab_sparql (sprintf (' SPARQL                                                    \n' ||
-                                       ' define input:storage ""                                   \n' ||
-                                       ' prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n' ||
-                                       ' prefix foaf: <http://xmlns.com/foaf/0.1/>                 \n' ||
-                                       ' select ?person, ?nick, ?name, ?mbox                       \n' ||
-                                       '   from <%s>                                               \n' ||
-                                       '  where {                                                  \n' ||
-                                       '          {                                                \n' ||
-                                       '            ?person a foaf:Person .                        \n' ||
-                                       '            optional { ?person foaf:nick ?nick } .         \n' ||
-                                       '            optional { ?person foaf:name ?name } .         \n' ||
-                                       '            optional { ?person foaf:mbox ?mbox } .         \n' ||
-                                       '          }                                                \n' ||
-                                       '          UNION                                            \n' ||
-                                       '          {                                                \n' ||
-                                       '            ?person a foaf:Organization .                  \n' ||
-                                       '            optional { ?person foaf:nick ?nick } .         \n' ||
-                                       '            optional { ?person foaf:name ?name } .         \n' ||
-                                       '            optional { ?person foaf:mbox ?mbox } .         \n' ||
-                                       '          }                                                \n' ||
-                                       '        }', contentIRI));
-  }
+    S := sprintf (' SPARQL
+                    define input:storage ""
+                    prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+                    prefix foaf: <http://xmlns.com/foaf/0.1/>
+                    select ?person, ?nick, ?name, ?mbox
+                      from <%s>
+                     where {
+                             {?person a foaf:Person .}
+                             UNION
+                             {?person a foaf:Organization .}
+                             optional { ?person foaf:nick ?nick } .
+                             optional { ?person foaf:name ?name } .
+                             optional { ?person foaf:mbox ?mbox } .
+                           }', contentIRI);
+  }
+  Items := AB.WA.ab_sparql (S);
   for (N := 0; N < length (Items); N := N + 1)
   {
     if (not isnull (coalesce (Items[N][2], Items[N][1])))
@@ -4158,99 +4374,40 @@ _exit:;
 create procedure AB.WA.import_csv (
   in domain_id integer,
   in content any,
-  in tags any,
-  in maps any,
-  in validation any)
+  in options any := null,
+  in validation any := null,
+  in progress_id varchar := null)
 {
-  declare N, M, nLength, mLength, id integer;
-  declare tmp, tmp2, data, pFields, pValues any;
-  declare nameIdx, firstNameIdx, lastNameIdx, fullNameIdx integer;
-  declare name, fullName varchar;
-
-  nameIdx := -1;
-  firstNameIdx := -1;
-  lastNameIdx := -1;
-  fullNameIdx := -1;
-  for (N := 0; N < length (maps); N := N + 2)
-  {
-    if (maps[N+1] = 'P_NAME')
-      nameIdx := cast (maps[N] as integer);
-    if (maps[N+1] = 'P_FIRST_NAME')
-      firstNameIdx := cast (maps[N] as integer);
-    if (maps[N+1] = 'P_LAST_NAME')
-      lastNameIdx := cast (maps[N] as integer);
-    if (maps[N+1] = 'P_FULL_NAME')
-      fullNameIdx := cast (maps[N] as integer);
-  }
+  declare N, M, nLength, mLength integer;
+  declare tmp, data, pFields, pValues any;
+  declare maps any;
+
+  if (isnull (options))
+    options := vector ();
+
+  maps := get_keyword ('maps', options, vector());
+
   nLength := length (content);
   for (N := 1; N < nLength; N := N + 1)
   {
+    if (not AB.WA.import_check_progress_id (progress_id))
+      return;
+
+    pFields := vector ();
+    pValues := vector ();
     data := split_and_decode (content [N], 0, '\0\0,');
-    name := '';
-    fullName := '';
-    if ((nameIdx <> -1) and (nameIdx < length (data)))
-      name := trim (trim (data[nameIdx], '"'));
-    if ((fullNameIdx <> -1) and (fullNameIdx < length (data)))
-      fullName := trim (trim (data[fullNameIdx], '"'));
-    if (fullName = '')
-    {
-      if ((firstNameIdx <> -1) and (firstNameIdx < length (data)))
-         fullName := trim (trim (data[firstNameIdx], '"'));
-      if ((lastNameIdx <> -1) and (lastNameIdx < length (data)))
-         fullName := fullName || ' ' || trim (trim (data[lastNameIdx], '"'));
-       fullName := trim (fullName);
-    }
-    if (name = '')
-      name := fullName;
-    if (name <> '')
-    {
-      pFields := vector ('P_NAME');
-      pValues := vector (name);
       mLength := length (data);
       for (M := 0; M < mLength; M := M + 1)
       {
-        if (M <> nameIdx)
-        {
-          if (M = fullNameIdx)
-          {
-            if (fullName <> '')
-            {
-               pFields := vector_concat (pFields, vector ('P_FULL_NAME'));
-               pValues := vector_concat (pValues, vector (fullName));
-             }
-          } else
-          {
              tmp := get_keyword (cast (M as varchar), maps, '');
             if (tmp <> '')
             {
-               tmp2 := trim (data[M], '"');
-              if (tmp = 'P_BIRTHDAY')
-              {
-                 {
-                   declare continue handler for sqlstate '*' {
-                     tmp := '';
-                   };
-                   tmp2 := AB.WA.dt_reformat (tmp2);
-                 }
-               }
-              if (tmp = 'P_TITLE')
-              {
-                tmp2 := AB.WA.import_title (tmp2);
-              }
-              if (tmp <> '')
-              {
                  pFields := vector_concat (pFields, vector (tmp));
-                 pValues := vector_concat (pValues, vector (tmp2));
-               }
-             }
-           }
+        pValues := vector_concat (pValues, vector (trim (data[M], '"')));
          }
       }
-      commit work;
-      connection_set ('__addressbook_import', '1');
-      AB.WA.contact_update4 (-1, domain_id, pFields, pValues, tags, validation);
-      connection_set ('__addressbook_import', '0');
-    }
+    AB.WA.import_contact_update (-1, domain_id, pFields, pValues, options, validation, progress_id);
+    AB.WA.import_inc_progress_id (progress_id);
   }
 }
 ;
@@ -4260,18 +4417,27 @@ create procedure AB.WA.import_csv (
 create procedure AB.WA.import_ldap (
   in domain_id integer,
   in content any,
-  in tags any,
-  in maps any,
-  in validation any)
+  in options any := null,
+  in validation any := null,
+  in progress_id varchar := null)
 {
   declare N, M, nLength, mLength, id integer;
   declare data, pFields, pValues any;
+  declare maps any;
+
+  if (isnull (options))
+    options := vector ();
+
+  maps := get_keyword ('maps', options, vector());
 
   nLength := length (content);
   for (N := 0; N < nLength; N := N + 2)
   {
     if (content [N] = 'entry')
     {
+      if (not AB.WA.import_check_progress_id (progress_id))
+        return;
+
       data := content [N+1];
       mLength := length (data);
         pFields := vector ();
@@ -4284,12 +4450,177 @@ create procedure AB.WA.import_ldap (
             pValues := vector_concat (pValues, vector (case when isstring (data[M+1]) then data[M+1] else data[M+1][0] end));
           }
         }
+      AB.WA.import_contact_update (-1, domain_id, pFields, pValues, options, validation, progress_id);
+      AB.WA.import_inc_progress_id (progress_id);
+    }
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.import_linkedin (
+  in domain_id integer,
+  in content any,
+  in options any := null,
+  in validation any := null,
+  in progress_id varchar := null)
+{
+  declare N, M, id integer;
+  declare items, pFields, pValues any;
+  declare tmp, meta, mLength any;
+
+  if (isnull (options))
+    options := vector ();
+
+  Meta := vector
+    (
+      'P_NAME',           'string(./first-name)',
+      'P_FIRST_NAME',     'string(./first-name)',
+      'P_LAST_NAME',      'string(./last-name)',
+      'P_H_COUNTRY',      'string(./location/name)',
+      'P_B_INDUSTRY',     'string(./industry)'
+    );
+  mLength := length (Meta);
+
+  items := xml_tree_doc (content);
+  items := xpath_eval('/connections/person', items, 0);
+  foreach (any item in items) do
+  {
+    if (not AB.WA.import_check_progress_id (progress_id))
+      return;
+
+    pFields := vector ();
+    pValues := vector ();
+    for (M := 0; M < mLength; M := M + 2)
+    {
+      tmp := serialize_to_UTF8_xml (xpath_eval (Meta[M+1], item, 1));
+      if (not is_empty_or_null (tmp))
+      {
+        pFields := vector_concat (pFields, vector (Meta[M]));
+        pValues := vector_concat (pValues, vector (tmp));
+      }
+    }
+    AB.WA.import_contact_update (-1, domain_id, pFields, pValues, options, validation, progress_id);
+
+    AB.WA.import_inc_progress_id (progress_id);
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.import_contact_update (
+  in id integer,
+  in domain_id integer,
+  in pFields any,
+  in pValues any,
+  in options any,
+  in validation any,
+  in progress_id varchar)
+{
+  declare N, noRelations inteher;
+  declare tmp, tags, name, firstName, lastName, fullName, iri varchar;
+
+  name := '';
+  firstName := '';
+  lastName := '';
+  fullName := '';
+  iri := '';
+  noRelations := 1;
+  for (N := 0; N < length (pFields); N := N + 1)
+  {
+    if (pFields[N] = 'P_NAME')
+    {
+      name := pValues[N];
+    }
+    else if (pFields[N] = 'P_FIRST_NAME')
+    {
+      firstName := pValues[N];
+    }
+    else if (pFields[N] = 'P_LAST_NAME')
+    {
+      lastName := pValues[N];
+    }
+    else if (pFields[N] = 'P_FULL_NAME')
+    {
+      fullName := pValues[N];
+    }
+    else if (pFields[N] = 'P_IRI')
+    {
+      iri := pValues[N];
+    }
+    else if (pFields[N] = 'P_BIRTHDAY')
+    {
+      {
+        declare continue handler for sqlstate '*'
+        {
+          pValues[N] := '';
+        };
+        pValues[N] := AB.WA.dt_reformat (pValues[N], 'Y-M-D');
+      }
+    }
+    else if (pFields[N] = 'P_KIND')
+    {
+      pValues[N] := case when (pValues[N] = 'http://xmlns.com/foaf/0.1/Organization') then 1 else 0 end;
+    }
+    else if (pFields[N] = 'P_MAIL')
+    {
+      pValues[N] := replace (pValues[N], 'mailto:', '');
+    }
+    else if (pFields[N] = 'P_PHONE')
+    {
+      pValues[N] := replace (pValues[N], 'tel:', '');
+    }
+    else if (pFields[N] = 'P_TITLE')
+    {
+      pValues[N] := ODS.ODS_API.appendPropertyTitle (pValues[N]);
+    }
+    else if (pFields[N] = 'P_RELATIONSHIPS')
+    {
+      pValues[N] := pValues[N] || '\nfoaf:knows;' || AB.WA.account_sioc_url (domain_id);
+      noRelations := 0;
+    }
+  }
+  if (noRelations)
+  {
+    pFields := vector_concat (pFields, vector ('P_RELATIONSHIPS'));
+    pValues := vector_concat (pValues, vector ('foaf:knows;' || AB.WA.account_sioc_url (domain_id)));
+  }
+  if (fullName = '')
+  {
+    fullName := trim (firstName || ' ' || lastName);
+    pFields := vector_concat (pFields, vector ('P_FULL_NAME'));
+    pValues := vector_concat (pValues, vector (fullName));
+  }
+  if (name = '')
+  {
+    pFields := vector_concat (pFields, vector ('P_NAME'));
+    pValues := vector_concat (pValues, vector (fullName));
+  }
+  tags := get_keyword ('tags', options, '');
+
       commit work;
       connection_set ('__addressbook_import', '1');
-      AB.WA.contact_update4 (-1, domain_id, pFields, pValues, tags, validation);
-      connection_set ('__addressbook_import', '0');
-    }
+  id := AB.WA.contact_update4 (id, domain_id, pFields, pValues, tags, options, validation, progress_id);
+  if (length (id))
+  {
+    tmp := get_keyword ('grants', options, '');
+    if (tmp <> '')
+      AB.WA.contact_share (AB.WA.domain_owner_id (domain_id), id[0], tmp, 1);
+
+    tmp := get_keyword ('acls', options, '');
+    if (tmp <> '')
+      AB.WA.contact_update2 (id[0], domain_id, 'P_ACL', tmp);
+
+    tmp := get_keyword ('contentPings', options, vector());
+    if (AB.WA.vector_contains (tmp, iri))
+      SEMPING.DBA.CLI_PING (AB.WA.account_sioc_url (domain_id), iri);
+
   }
+  connection_set ('__addressbook_import', '0');
+
+  return id;
 }
 ;
 
@@ -5206,8 +5537,7 @@ create procedure AB.WA.syncml2entry_internal (
 
   if (not isinteger (_data))
   {
-    IDs := AB.WA.import_vcard (_domain_id, _data, vector ('tags', _tags), null, _res_mod_time, _res_name);
-    -- return;
+    IDs := AB.WA.import_vcard (_domain_id, _data, vector ('tags', _tags, 'updatedBefore', _res_mod_time, 'externalUID', _res_name));
     for (N := 0; N < length (IDs); N := N + 1)
     {
       _uid := (select P_UID from AB.WA.PERSONS where P_ID = IDs[N]);
@@ -5238,8 +5568,9 @@ create procedure AB.WA.syncml2entry_internal (
 -------------------------------------------------------------------------------
 --
 create procedure AB.WA.search_sql (
-  inout domain_id integer,
-  inout account_id integer,
+  in domain_id integer,
+  in account_id integer,
+  in account_rights varchar,
   inout data varchar,
   in maxRows varchar := '')
 {
@@ -5276,12 +5607,20 @@ create procedure AB.WA.search_sql (
          '  p.P_UPDATED     P_UPDATED    \n' ||
          'from                           \n' ||
          '  AB.WA.PERSONS p,             \n' ||
-         '  AB.WA.GRANTS g               \n' ||
+         '  AB..GRANTS_PERSON_VIEW g     \n' ||
          'where p.P_ID = g.G_PERSON_ID   \n' ||
-         '  and g.G_GRANTEE_ID = <ACCOUNT_ID> <TEXT> <WHERE>';
+         '  and g.TO_ID = <ACCOUNT_ID> <TEXT> <WHERE>';
   }
-
   S := 'select <MAX> * from (' || S || ') x';
+  if (account_rights = '')
+  {
+    if (is_https_ctx ())
+    {
+      S := S || ' where SIOC..addressbook_contact_iri (<DOMAIN_ID>, x.P_ID) in (select a.iri from AB.WA.acl_list (id)(iri varchar) a where a.id = <DOMAIN_ID>)';
+    } else {
+      S := S || ' where 1=0';
+    }
+  }
 
   T := '';
   tmp := AB.WA.xml_get('keywords', data);
@@ -7359,7 +7698,7 @@ create procedure AB.WA.livecontacts () __SOAP_HTTP 'text/xml'
     {
       if (objectType = 'c')
       {
-        AB.WA.contact_update4 (objectID, domain_id, abFields, abValues, null);
+        AB.WA.contact_update4 (objectID, domain_id, abFields, abValues);
       } else {
         uname := AB.WA.domain_owner_name (domain_id);
         ocMap := AB.WA.vector_reverse (AB.WA.owner2contactMap ());
@@ -7372,7 +7711,7 @@ create procedure AB.WA.livecontacts () __SOAP_HTTP 'text/xml'
       }
       signal ('__204', '');
     } else {
-      abID := AB.WA.contact_update4 (abID, domain_id, abFields, abValues, null);
+      abID := AB.WA.contact_update4 (abID, domain_id, abFields, abValues);
       signal ('__201', '');
     }
   }
@@ -7616,7 +7955,6 @@ create procedure AB.WA.yahooSQL (
   sql := replace (sql, '%TOP%', cast (_min as varchar));
 
   exec (sql, st, msg, params, 0, _meta, _data);
-  -- dbg_obj_print('', sql, st);
   if ('00000' <> st)
     return 0;
 
@@ -7865,8 +8203,6 @@ create procedure AB.WA.yahoocontacts () __SOAP_HTTP 'text/xml'
   apiBody := string_output_string (http_body_read ());
   if (apiBody = '')
     apiBody := get_keyword ('content', apiParams);
-  --dbg_obj_print('', apiParams);
-  --dbg_obj_print('', apiBody);
 
   domain_id := 22;
   domain_id := atoi (get_keyword_ucase ('inst_id', apiParams));
@@ -7882,7 +8218,6 @@ create procedure AB.WA.yahoocontacts () __SOAP_HTTP 'text/xml'
   apiPath := substring (apiPath, length ('/ods/yahoocontacts/')+1, length (apiPath));
   apiMap := AB.WA.yahooMap();
   AB.WA.yahooPathAnalyze (apiParams, apiPath, apiMethod, apiMap, apiCommand, apiOptions);
-  -- dbg_obj_print('', apiCommand, apiOptions);
 
   if (get_keyword ('view', apiOptions, '') = 'rev')
     signal ('__406', '');
@@ -7991,7 +8326,7 @@ create procedure AB.WA.yahoocontacts () __SOAP_HTTP 'text/xml'
       if ((apiMethod = 'PUT') and not exists (select 1 from AB.WA.PERSONS where P_ID = abID and P_DOMAIN_ID = domain_id))
         signal ('__404', '');
 
-      abID := AB.WA.contact_update4 (abID, domain_id, abFields, abValues, null);
+      abID := AB.WA.contact_update4 (abID, domain_id, abFields, abValues);
     }
   }
   if (apiCommand = 'contact')
@@ -8510,7 +8845,6 @@ create procedure AB.WA.googleSQL (
   sql := replace (sql, '%TOP%', cast (_min as varchar));
 
   exec (sql, st, msg, params, 0, _meta, _data);
-  -- dbg_obj_print('', st, msg);
   if ('00000' <> st)
     return 0;
 
@@ -8628,7 +8962,6 @@ create procedure AB.WA.googlecontacts () __SOAP_HTTP 'text/xml'
       apiFields := apiFields || apiMap[N] || ',';
     apiFields := trim (apiFields, ',');
 
-    -- dbg_obj_print('', apiMethod);
     set_user_id ('dba');
     if (apiMethod = 'GET')
     {
@@ -8714,9 +9047,9 @@ create procedure AB.WA.googlecontacts () __SOAP_HTTP 'text/xml'
         objectID := (select P_ID from AB.WA.PERSONS where P_UID = abValues[M] and P_DOMAIN_ID = domain_id);
         if (isnull (objectID))
           signal ('__404', '');
-        AB.WA.contact_update4 (objectID, domain_id, abFields, abValues, null);
+        AB.WA.contact_update4 (objectID, domain_id, abFields, abValues);
       } else {
-        objectID := AB.WA.contact_update4 (objectID, domain_id, abFields, abValues, null);
+        objectID := AB.WA.contact_update4 (objectID, domain_id, abFields, abValues);
         if (isarray (objectID) and length (objectID) = 1)
           objectID := objectID[0];
       }
diff --git a/appsrc/ODS-Addressbook/sql/ab-a-soap.sql b/appsrc/ODS-Addressbook/sql/ab-a-soap.sql
index 3ac2196..4d6dc2c 100644
--- a/appsrc/ODS-Addressbook/sql/ab-a-soap.sql
+++ b/appsrc/ODS-Addressbook/sql/ab-a-soap.sql
@@ -1,5 +1,5 @@
 --
---  $Id: ab-a-soap.sql,v 1.3 2008/04/30 10:40:17 source Exp $
+--  $Id: ab-a-soap.sql,v 1.3.2.1 2010/09/20 10:14:39 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Addressbook/sql/ab-a-table.sql b/appsrc/ODS-Addressbook/sql/ab-a-table.sql
index fe4faa4..a8d00ee 100644
--- a/appsrc/ODS-Addressbook/sql/ab-a-table.sql
+++ b/appsrc/ODS-Addressbook/sql/ab-a-table.sql
@@ -1,5 +1,5 @@
 --
---  $Id: ab-a-table.sql,v 1.21.2.1 2010/04/24 14:01:57 source Exp $
+--  $Id: ab-a-table.sql,v 1.21.2.4 2010/11/11 12:37:55 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -137,6 +137,7 @@ AB.WA.exec_no_error('
     P_B_WEB varchar,
     P_TAGS varchar,
     P_ACL long varchar,
+    P_CERTIFICATE long varchar,
     P_CREATED datetime,
     P_UPDATED datetime,
 
@@ -193,6 +194,10 @@ AB.WA.exec_no_error (
 );
 
 AB.WA.exec_no_error (
+  'alter table AB.WA.PERSONS add P_CERTIFICATE long varchar', 'C', 'AB.WA.PERSONS', 'P_CERTIFICATE'
+);
+
+AB.WA.exec_no_error (
   'alter table AB.WA.PERSONS add constraint FK_PERSONS_01 FOREIGN KEY (P_CATEGORY_ID) references AB.WA.CATEGORIES (C_ID) on delete set null'
 );
 
@@ -616,6 +621,77 @@ AB.WA.exec_no_error('
 
 -------------------------------------------------------------------------------
 --
+create procedure AB.WA.grants_procedure (
+  in id integer)
+{
+  declare c0 integer;
+  declare c1 varchar;
+
+  result_names (c0, c1);
+  for (select distinct b.U_ID, b.U_NAME
+         from AB.WA.GRANTS a,
+              DB.DBA.SYS_USERS b
+        where a.G_GRANTEE_ID = id
+          and a.G_GRANTER_ID = b.U_ID
+        order by 2) do
+  {
+    result (U_ID, U_NAME);
+  }
+  for (select distinct b.U_ID, b.U_NAME
+         from AB.WA.GRANTS a,
+              DB.DBA.SYS_USERS b,
+              DB.DBA.SYS_ROLE_GRANTS c
+        where a.G_GRANTER_ID = b.U_ID
+          and c.GI_SUPER     = id
+          and c.GI_GRANT     = a.G_GRANTEE_ID
+          and c.GI_DIRECT    = '1'
+        order by 2) do
+  {
+    result (U_ID, U_NAME);
+  }
+}
+;
+
+AB.WA.exec_no_error ('
+  create procedure view AB..GRANTS_VIEW as AB.WA.grants_procedure (id) (U_ID integer, U_NAME varchar)
+')
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.grants_person_procedure (
+  in to_id integer,
+  in from_id integer := null)
+{
+  declare c0 integer;
+
+  result_names (c0);
+  for (select distinct G_PERSON_ID from AB.WA.GRANTS where G_GRANTEE_ID = to_id and (G_GRANTER_ID = from_id or from_id is null) order by 1) do
+  {
+    result (G_PERSON_ID);
+  }
+  for (select distinct G_PERSON_ID
+         from AB.WA.GRANTS a,
+              DB.DBA.SYS_ROLE_GRANTS c
+        where (a.G_GRANTER_ID = from_id or from_id is null)
+          and c.GI_SUPER     = to_id
+          and c.GI_GRANT     = a.G_GRANTEE_ID
+          and c.GI_DIRECT    = '1'
+        order by 1) do
+  {
+    result (G_PERSON_ID);
+  }
+}
+;
+
+AB.WA.exec_no_error ('
+  create procedure view AB..GRANTS_PERSON_VIEW as AB.WA.grants_person_procedure (to_id, from_id) (G_PERSON_ID integer)
+')
+;
+
+
+-------------------------------------------------------------------------------
+--
 --  PUBLISH & SUBSCRIBE
 --
 -------------------------------------------------------------------------------
diff --git a/appsrc/ODS-Addressbook/sql/ab-a-update.sql b/appsrc/ODS-Addressbook/sql/ab-a-update.sql
index 8a91f56..6be1745 100644
--- a/appsrc/ODS-Addressbook/sql/ab-a-update.sql
+++ b/appsrc/ODS-Addressbook/sql/ab-a-update.sql
@@ -1,5 +1,5 @@
 --
---  $Id: ab-a-update.sql,v 1.3.2.1 2010/04/24 14:01:57 source Exp $
+--  $Id: ab-a-update.sql,v 1.3.2.4 2010/10/07 13:24:45 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -97,3 +97,19 @@ create procedure AB.WA.tmp_update ()
 
 AB.WA.tmp_update ();
 
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.tmp_update ()
+{
+  if (registry_get ('ab_acl_update') = '1')
+    return;
+  registry_set ('ab_acl_update', '1');
+
+  set triggers off;
+  update AB.WA.PERSONS set P_ACL = null where P_ACL is not null;
+  set triggers on;
+}
+;
+
+AB.WA.tmp_update ();
+
diff --git a/appsrc/ODS-Addressbook/sql/ab-a-wa.sql b/appsrc/ODS-Addressbook/sql/ab-a-wa.sql
index bde6fae..922c320 100644
--- a/appsrc/ODS-Addressbook/sql/ab-a-wa.sql
+++ b/appsrc/ODS-Addressbook/sql/ab-a-wa.sql
@@ -1,5 +1,5 @@
 --
---  $Id: ab-a-wa.sql,v 1.8.2.3 2010/05/18 19:34:42 source Exp $
+--  $Id: ab-a-wa.sql,v 1.8.2.8 2010/09/22 13:57:02 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -63,8 +63,6 @@ create procedure AB.WA.exec_no_error(in expr varchar, in execType varchar := '',
 
 ------------------------------------------------------------------------------
 --
-------------------------------------------------------------------------------
---
 create procedure AB.WA.vhost()
 {
   declare
@@ -195,6 +193,11 @@ AB.WA.exec_no_error (
 )
 ;
 
+AB.WA.exec_no_error (
+  'alter type wa_AddressBook add overriding method wa_dashboard () returns any'
+)
+;
+
 -------------------------------------------------------------------------------
 --
 -- wa_AddressBook methods
@@ -219,7 +222,18 @@ create method wa_id () for wa_AddressBook
 --
 create method wa_drop_instance () for wa_AddressBook
 {
-  AB.WA.domain_delete (self.wa_id ());
+  declare iWaiID integer;
+
+  iWaiID := self.wa_id ();
+  for (select HP_LPATH as _lpath,
+              HP_HOST as _vhost,
+              HP_LISTEN_HOST as _lhost
+         from DB.DBA.HTTP_PATH
+        where HP_LPATH = '/addressbook/' || cast (iWaiID as varchar)) do
+  {
+    VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+  }
+  AB.WA.domain_delete (iWaiID);
   (self as web_app).wa_drop_instance ();
 }
 ;
@@ -313,7 +327,7 @@ create method wa_state_edit_form (inout stream any) for wa_AddressBook
   {
     sid := (select VS_SID from VSPX_SESSION where VS_REALM = 'wa' and VS_UID = connection_get('vspx_user'));
     http_request_status ('HTTP/1.1 302 Found');
-    http_header(sprintf('Location: %s?sid=%s&realm=%s\r\n', WS.WS.EXPAND_URL (self.wa_home_url(), 'settings.vspx'), sid, 'wa'));
+    http_header(sprintf('Location: %s?action=settings&sid=%s&realm=%s\r\n', WS.WS.EXPAND_URL (self.wa_home_url(), 'home.vspx'), sid, 'wa'));
   } else {
     signal('42001', 'Not a owner');
   }
@@ -386,13 +400,34 @@ create method get_param (in param varchar) for wa_AddressBook
 
 -------------------------------------------------------------------------------
 --
-create method wa_dashboard_last_item () for wa_AddressBook
+create method wa_dashboard () for wa_AddressBook
 {
-  declare domainID, userID integer;
+  declare iWaiID integer;
+
+  iWaiID := self.wa_id ();
+  return (select XMLAGG ( XMLELEMENT ( 'dash-row',
+                                       XMLATTRIBUTES ( 'normal' as "class",
+                                                       AB.WA.dt_format(_time, 'Y/M/D H:N') as "time",
+                                                       self.wa_name as "application"
+                                                      ),
+                                       XMLELEMENT ( 'dash-data',
+	                                                  XMLATTRIBUTES ( concat (N'<a href="', cast (SIOC..addressbook_contact_iri (iWaiID, _id) as nvarchar), N'">', AB.WA.utf2wide (_title), N'</a>') as "content",
+	                                                                  0 as "comments"
+	                                                                )
+                                          	      )
+                                     )
+                     	  )
+            from AB.WA.dashboard_rs(p0)(_id integer, _title varchar, _time datetime) x
+           where p0 = iWaiID
+         );
+}
+;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  userID := (select WAM_USER from WA_MEMBER B where WAM_INST = self.wa_name and WAM_MEMBER_TYPE = 1);
-  return AB.WA.dashboard_get (domainID, userID);
+-------------------------------------------------------------------------------
+--
+create method wa_dashboard_last_item () for wa_AddressBook
+{
+  return AB.WA.dashboard_get (self.wa_id ());
 }
 ;
 
@@ -402,9 +437,8 @@ create method wa_rdf_url (in vhost varchar, in lhost varchar) for wa_AddressBook
 {
   declare domainID, userID integer;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  userID := (select WAM_USER from WA_MEMBER B where WAM_INST= self.wa_name and WAM_MEMBER_TYPE = 1);
-
+  domainID := self.wa_id ();
+  userID := AB.WA.domain_owner_id (domainID);
   return concat(AB.WA.dav_url2(domainID, userID), 'AddressBook.rdf');
 }
 ;
@@ -436,3 +470,40 @@ create method wa_update_instance (in oldValues any, in newValues any) for wa_Add
   return (self as web_app).wa_update_instance (oldValues, newValues);
 }
 ;
+
+-------------------------------------------------------------------------------
+--
+create procedure AB.WA.path_upgrade ()
+{
+  declare _new_lpath varchar;
+
+  if (registry_get ('ab_path_upgrade2') = '1')
+    return;
+
+  for (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_TYPE_NAME = 'AddressBook') do
+  {
+    for (select HP_LPATH as _lpath,
+                HP_HOST as _vhost,
+                HP_LISTEN_HOST as _lhost
+           from DB.DBA.HTTP_PATH
+          where HP_LPATH = '/addressbook/' || cast (WAI_ID as varchar) || '/home.vspx') do
+    {
+      _new_lpath := '/addressbook/' || cast (WAI_ID as varchar);
+      if (exists (select 1 from DB.DBA.HTTP_PATH where HP_LPATH = _new_lpath and HP_HOST  = _vhost and HP_LISTEN_HOST = _lhost))
+      {
+        VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+      } else {
+        update DB.DBA.HTTP_PATH
+           set HP_LPATH = _new_lpath
+         where HP_LPATH = _lpath
+           and HP_HOST  = _vhost
+           and HP_LISTEN_HOST = _lhost;
+        http_map_del (_lpath, _vhost, _lhost);
+        VHOST_MAP_RELOAD (vhost=>_vhost, lhost=>_lhost, lpath=>_new_lpath);
+      }
+    }
+  }
+  registry_set ('ab_path_upgrade2', '1');
+}
+;
+AB.WA.path_upgrade ();
diff --git a/appsrc/ODS-Addressbook/sql/ab-d.sql b/appsrc/ODS-Addressbook/sql/ab-d.sql
index a81d33b..dd2a2dd 100644
--- a/appsrc/ODS-Addressbook/sql/ab-d.sql
+++ b/appsrc/ODS-Addressbook/sql/ab-d.sql
@@ -1,5 +1,5 @@
 --
---  $Id: ab-d.sql,v 1.13.2.1 2009/08/12 11:51:56 source Exp $
+--  $Id: ab-d.sql,v 1.13.2.5 2010/11/11 12:37:55 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -42,6 +42,11 @@ AB.WA.exec_no_error ('DELETE FROM DB.DBA.SYS_SCHEDULED_EVENT WHERE SE_NAME = \'A
 
 VHOST_REMOVE (lpath => '/addressbook');
 VHOST_REMOVE (lpath => '/dataspace/services/addressbook');
+VHOST_REMOVE (lpath => '/ods/portablecontacts');
+VHOST_REMOVE (lpath => '/ods/livecontacts');
+VHOST_REMOVE (lpath => '/ods/yahoocontacts');
+VHOST_REMOVE (lpath => '/ods/google');
+
 
 -- NNTP
 AB.WA.exec_no_error ('DROP procedure DB.DBA.ADDRESSBOOK_NEWS_MSG_I');
@@ -65,12 +70,16 @@ AB.WA.exec_no_error ('DROP type wa_AddressBook');
 
 -- Views
 AB.WA.exec_no_error ('DROP view AB..TAGS_VIEW');
+AB.WA.exec_no_error ('DROP view AB..GRANDS_PERSON_VIEW');
+AB.WA.exec_no_error ('DROP view AB..GRANDS_VIEW');
 
 -- Registry
 registry_remove ('ab_path');
 registry_remove ('ab_version');
 registry_remove ('ab_build');
 registry_remove ('ab_index_version');
+registry_remove ('ab_path_upgrade2');
+registry_remove ('ab_acl_update');
 registry_remove ('__ods_addressbook_sioc_init');
 
 -- Procedures
diff --git a/appsrc/ODS-Addressbook/sql/sioc_ab.sql b/appsrc/ODS-Addressbook/sql/sioc_ab.sql
index dbe4734..ac9f03e 100644
--- a/appsrc/ODS-Addressbook/sql/sioc_ab.sql
+++ b/appsrc/ODS-Addressbook/sql/sioc_ab.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sioc_ab.sql,v 1.33.2.6 2010/05/18 10:40:38 source Exp $
+--  $Id: sioc_ab.sql,v 1.33.2.12 2010/12/07 10:59:56 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -117,6 +117,25 @@ create procedure fill_ods_addressbook_sioc2 (
   declare graph_iri, addressbook_iri, socialnetwork_iri, contact_iri, creator_iri, role_iri, iri varchar;
 
   {
+    for (select WAI_ID,
+                WAI_TYPE_NAME,
+                WAI_NAME,
+                WAI_ACL
+           from DB.DBA.WA_INSTANCE
+          where ((_wai_name is null) or (WAI_NAME = _wai_name))
+            and WAI_TYPE_NAME = 'AddressBook') do
+    {
+      graph_iri := SIOC..acl_graph (WAI_TYPE_NAME, WAI_NAME);
+      exec (sprintf ('sparql clear graph <%s>', graph_iri));
+      SIOC..wa_instance_acl_insert (WAI_TYPE_NAME, WAI_NAME, WAI_ACL);
+      for (select P_DOMAIN_ID, P_ID, P_ACL
+             from AB.WA.PERSONS
+            where P_DOMAIN_ID = WAI_ID and P_ACL is not null) do
+      {
+        contact_acl_insert (P_DOMAIN_ID, P_ID, P_ACL);
+      }
+    }
+
     id := -1;
     deadl := 3;
     cnt := 0;
@@ -181,7 +200,8 @@ create procedure fill_ods_addressbook_sioc2 (
                 P_UPDATED,
 								P_TAGS,
 	              P_FOAF,
-		      P_IRI
+                P_IRI,
+                P_ACL
            from DB.DBA.WA_INSTANCE,
                 DB.DBA.WA_MEMBER,
                 AB.WA.PERSONS
@@ -467,11 +487,13 @@ create procedure contact_insert (
     }
     if (not DB.DBA.is_empty_or_null (relationships))
     {
-      for (select relationship from DB.DBA.WA_USER_INTERESTS (txt) (relationship varchar) P where txt = relationships) do
+      for (select fld1, fld2 from DB.DBA.WA_USER_INTERESTS (txt) (fld1 varchar, fld2 varchar) P where txt = relationships) do
   	  {
-  	    if (length (relationship))
+  	    if (length (fld1))
   	    {
-  	      DB.DBA.ODS_QUAD_URI (graph_iri, iri, ODS.ODS_API."ontology.denormalize"(relationship), person_iri);
+          if (DB.DBA.is_empty_or_null (fld2))
+            fld2 := person_iri;
+  	      DB.DBA.ODS_QUAD_URI (graph_iri, iri, ODS.ODS_API."ontology.denormalize"(fld1), fld2);
   	    }
   	  }
     }
@@ -805,6 +827,96 @@ create trigger PERSONS_SIOC_D before delete on AB.WA.PERSONS referencing old as
 
 -------------------------------------------------------------------------------
 --
+create procedure contact_acl_insert (
+  inout domain_id integer,
+  inout contact_id integer,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  iri := SIOC..addressbook_contact_iri (domain_id, contact_id);
+  graph_iri := AB.WA.acl_graph (domain_id);
+
+  SIOC..acl_insert (graph_iri, iri, acl);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure contact_acl_delete (
+  inout domain_id integer,
+  inout contact_id integer,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  iri := SIOC..addressbook_contact_iri (domain_id, contact_id);
+  graph_iri := AB.WA.acl_graph (domain_id);
+
+  SIOC..acl_delete (graph_iri, iri, acl);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger PERSONS_SIOC_ACL_I after insert on AB.WA.PERSONS order 100 referencing new as N
+{
+  if (coalesce (N.P_ACL, '') <> '')
+  {
+    contact_acl_insert (N.P_DOMAIN_ID,
+                        N.P_ID,
+                        N.P_ACL);
+
+    SIOC..acl_ping (N.P_DOMAIN_ID,
+                    SIOC..addressbook_contact_iri (N.P_DOMAIN_ID, N.P_ID),
+                    null,
+                    N.P_ACL);
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger PERSONS_SIOC_ACL_U after update (P_ACL) on AB.WA.PERSONS order 100 referencing old as O, new as N
+{
+  if (coalesce (O.P_ACL, '') <> '')
+    contact_acl_delete (O.P_DOMAIN_ID,
+                        O.P_ID,
+                        O.P_ACL);
+
+  if (coalesce (N.P_ACL, '') <> '')
+    contact_acl_insert (N.P_DOMAIN_ID,
+                        N.P_ID,
+                        N.P_ACL);
+
+  SIOC..acl_ping (N.P_DOMAIN_ID,
+                  SIOC..addressbook_contact_iri (N.P_DOMAIN_ID, N.P_ID),
+                  O.P_ACL,
+                  N.P_ACL);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger PERSONS_SIOC_ACL_D before delete on AB.WA.PERSONS order 100 referencing old as O
+{
+  if (coalesce (O.P_ACL, '') <> '')
+    contact_acl_delete (O.P_DOMAIN_ID,
+                        O.P_ID,
+                        O.P_ACL);
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure contact_comments_insert (
   in graph_iri varchar,
   in forum_iri varchar,
diff --git a/appsrc/ODS-Addressbook/www/ab_login.vspx b/appsrc/ODS-Addressbook/www/ab_login.vspx
index 0109393..023b3cf 100644
--- a/appsrc/ODS-Addressbook/www/ab_login.vspx
+++ b/appsrc/ODS-Addressbook/www/ab_login.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
-  -  $Id: ab_login.vspx,v 1.2 2007/03/30 09:58:40 source Exp $
+  -  $Id: ab_login.vspx,v 1.2.2.4 2010/10/07 13:24:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -27,28 +27,33 @@
   <v:after-data-bind>
     <![CDATA[
       declare page_name varchar;
+      declare vh, lh, hf, ods_path any;
 
       set_qualifier ('DB');
       page_name := AB.WA.page_name ();
       if (page_name = 'error.vspx')
         return;
 
-      if (AB.WA.check_grants2 (self.account_role, page_name))
+      if (AB.WA.check_grants (self.account_rights, page_name))
         return;
 
-      declare vh, lh, hf, ods_path any;
+      if (isnull (self.account_rights) and not is_empty_or_null (self.sid))
+      {
+        self.vc_redirect (sprintf ('/ods/error.vspx?__PAGE=%U&__SQL_STATE=%U&__SQL_MESSAGE=%U', 'home.vspx', '23023', 'You have no access rights for the application!'));
+        return;
+      }
 
+      if (isnull (self.account_rights))
+      {
       vh := http_map_get ('vhost');
       lh := http_map_get ('lhost');
       hf := http_request_header (lines, 'Host');
-
       if (hf is not null and exists (select 1 from HTTP_PATH where HP_HOST = vh and HP_LISTEN_HOST = lh and HP_LPATH = '/ods'))
-        ods_path := 'http://' || hf || '/ods/';
-      else
+        {
+          ods_path := DB.DBA.WA_GET_PROTOCOL() || hf || '/ods/';
+        } else {
         ods_path := DB.DBA.WA_LINK (1, '/ods/');
-
-      if (self.account_role = 'expire') {
-
+        }
         http_request_status ('HTTP/1.1 302 Found');
         http_header (sprintf('Location: %slogin.vspx?URL=%U\r\n', ods_path, HTTP_REQUESTED_URL()));;
         return;
diff --git a/appsrc/ODS-Addressbook/www/ajax.vsp b/appsrc/ODS-Addressbook/www/ajax.vsp
index b676cc2..16da906 100644
--- a/appsrc/ODS-Addressbook/www/ajax.vsp
+++ b/appsrc/ODS-Addressbook/www/ajax.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: ajax.vsp,v 1.1 2008/12/03 12:21:20 source Exp $
+--  $Id: ajax.vsp,v 1.1.2.4 2011/03/23 12:17:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -20,19 +20,96 @@
 --  with this program; if not, write to the Free Software Foundation, Inc.,
 --  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 --
-
   declare domain_id, account_id integer;
-  declare action, subAction any;
+  declare sid, realm, action, subAction any;
   declare aSession any;
 
+  sid := get_keyword ('sid', params, '');
+  realm := get_keyword ('realm', params, '');
+
   action := get_keyword ('a', params, '');
   subAction := get_keyword ('sa', params, '');
 
+  -- dbg_obj_print ('action, subAction: ', action, subAction);
+
   aSession   := AB.WA.session_restore (params);
   domain_id  := cast (get_keyword('domain_id', aSession, '0') as integer);
-  account_id := cast (get_keyword('user_id', aSession, '0') as integer);
+  account_id := cast (get_keyword('account_id', aSession, '0') as integer);
+
+  if (action = 'load')
+  {
+    declare progressID, progressIndex, progressPoll, progressPollData any;
+
+    progressID := cast (get_keyword ('id', params, msec_time()) as varchar);
+    progressIndex := registry_get ('addressbook_index_' || progressID);
+	  if (subAction = 'stop')
+	  {
+	    registry_set ('addressbook_action_' || progressID, 'stop');
+	  }
+	  else if (subAction = 'state')
+	  {
+      if (not (isinteger(progressIndex) and (progressIndex = 0)))
+      {
+        http_rewrite ();
+        http_header ('Content-Type: text/xml\r\n');
+        http('<root>');
+
+        http(sprintf('<index>%s</index>', cast (progressIndex as varchar)));
+
+	      progressPoll := registry_get ('addressbook_poll_' || progressID);
+        if (not (isinteger (progressPoll) and (progressPoll = 0)))
+        {
+	        progressPollData := registry_get ('addressbook_poll_data_' || progressID);
+          http (sprintf ('<poll><action>%s</action><data>%s</data></poll>', cast (progressPoll as varchar), cast (progressPollData as varchar)));
+        }
+
+        http('</root>');
+      }
+	  }
+	  else if (subAction = 'poll')
+	  {
+	    declare pollValue any;
+
+	    pollValue := get_keyword ('value', params);
+	    if (not is_empty_or_null (pollValue))
+        registry_set ('addressbook_poll_' || progressID, pollValue);
+
+      registry_set ('addressbook_poll_time_' || progressID, cast (msec_time() as varchar));
+	  }
+	  else if (subAction = 'init')
+	  {
+	    registry_set ('addressbook_index_' || progressID, '0');
+
+	    http_rewrite ();
+	    http_header ('Content-Type: text/xml\r\n');
+	    http ('<root>');
+	    http (sprintf ('<id>%s</id>', cast (progressID as varchar)));
+	    http ('</root>');
+	    http_flush ();
+      commit work;
+
+      declare i_type, i_data, i_options, i_validation any;
+
+      i_type := deserialize (decode_base64 (get_keyword ('i_type', params)));
+      i_data := deserialize (decode_base64 (get_keyword ('i_data', params)));
+      i_options := deserialize (decode_base64 (get_keyword ('i_options', params)));
+      i_validation := deserialize (decode_base64 (get_keyword ('i_validation', params)));
+
+      -- import
+      {
+        declare exit handler for sqlstate '*'
+        {
+        	goto _end;
+        };
+        AB.WA.import (domain_id, i_type, i_data, i_options, i_validation, progressID);
+      }
+	  _end:;
 
-  if (action = 'about')
+	    registry_remove ('addressbook_index_'  || progressID);
+	    registry_remove ('addressbook_action_' || progressID);
+	  }
+	}
+  else if (action = 'about')
   {
     http (         '<div style="padding: 1em;">');
     http (         '<table style="width: 100%;">');
diff --git a/appsrc/ODS-Addressbook/www/annotea.vspx b/appsrc/ODS-Addressbook/www/annotea.vspx
index 72c5022..59ff0f6 100644
--- a/appsrc/ODS-Addressbook/www/annotea.vspx
+++ b/appsrc/ODS-Addressbook/www/annotea.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: annotea.vspx,v 1.7.2.3 2010/03/12 09:12:04 source Exp $
+ -  $Id: annotea.vspx,v 1.7.2.4 2010/09/20 10:14:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Addressbook/www/conversation.vspx b/appsrc/ODS-Addressbook/www/conversation.vspx
index 866e21a..453d588 100644
--- a/appsrc/ODS-Addressbook/www/conversation.vspx
+++ b/appsrc/ODS-Addressbook/www/conversation.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: conversation.vspx,v 1.2.2.1 2010/01/29 20:21:28 source Exp $
+ -  $Id: conversation.vspx,v 1.2.2.2 2010/09/20 10:14:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Addressbook/www/css/style.css b/appsrc/ODS-Addressbook/www/css/style.css
index cd31310..43ae183 100644
--- a/appsrc/ODS-Addressbook/www/css/style.css
+++ b/appsrc/ODS-Addressbook/www/css/style.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: style.css,v 1.18.2.5 2010/03/01 10:18:30 source Exp $
+ *  $Id: style.css,v 1.18.2.9 2010/10/13 12:15:51 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -130,6 +130,8 @@ a:hover
   font-size: 12px;
   background-color: #EFEFEF;
   border: 1px solid #7f94a5;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
   padding: 5px;
   margin: 0 0.5em 0.5em 0.5em;
   width: auto;
@@ -1049,6 +1051,7 @@ td.calendar_selected {
 .panelbar
 {
   width: 100%;
+  height: 100%;
 	border: 1px solid #7f94a5;
 }
 
@@ -1066,21 +1069,18 @@ div.panelbar_option:hover
 	background-color: #bce;
 }
 
-.panelbar_option_upper {
+.panelbar_option_upper
+{
 	border-bottom: 1px solid #7f94a5;
 }
 
-.panelbar_option_lower {
+.panelbar_option_lower
+{
 	border-top: 1px solid #7f94a5;
 }
 
-.panelbar_option_selected
+.panelbar_content
 {
-	font-weight: bold;
-}
-
-.panelbar_content {
-	height: 430px;
 	background-color: #fff;
   overflow: auto;
 }
@@ -1179,3 +1179,23 @@ div.menu .menuItem:hover {
   background-color: #99B3C5;
   color: #ffffff;
 }
+
+.pointer {
+  cursor: pointer;
+}
+
+span.button {
+  background: none repeat scroll 0 0 #99B3C5;
+  border: 1px solid #7F94A5;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  color: #FFFFFF;
+  font-size: 0.8em;
+  font-weight: bold;
+  padding: 3px 4px 1px;
+  text-decoration:none;
+}
+
+img.button {
+  margin-bottom: -3px;
+}
diff --git a/appsrc/ODS-Addressbook/www/error.vspx b/appsrc/ODS-Addressbook/www/error.vspx
index 594575a..8824500 100644
--- a/appsrc/ODS-Addressbook/www/error.vspx
+++ b/appsrc/ODS-Addressbook/www/error.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
-  -  $Id: error.vspx,v 1.3 2008/02/19 10:59:50 source Exp $
+  -  $Id: error.vspx,v 1.3.2.2 2010/09/20 10:14:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -37,20 +37,14 @@
         An error has occurred during processing of the "<?V self.page_name ?>" page.
       </div>
       <div class="error" style="text-align: left;">
-        <table>
+        <table cellspacing="5">
           <tr>
             <td valign="top">SQL State </td>
-            <td>
-              <?V self.code ?>
-            </td>
+            <td><?V self.code ?></td>
           </tr>
           <tr>
             <td valign="top">SQL Message </td>
-            <td>
-              <pre>
-                <?V self.msg ?>
-              </pre>
-            </td>
+            <td><pre><?V self.msg ?></pre></td>
           </tr>
         </table>
       </div>
diff --git a/appsrc/ODS-Addressbook/www/export.vspx b/appsrc/ODS-Addressbook/www/export.vspx
index abfa25f..fe1b7ae 100644
--- a/appsrc/ODS-Addressbook/www/export.vspx
+++ b/appsrc/ODS-Addressbook/www/export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
-  -  $Id: export.vspx,v 1.5.2.2 2010/05/31 21:59:14 source Exp $
+  -  $Id: export.vspx,v 1.5.2.4 2010/10/07 13:24:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -79,7 +79,7 @@
 
       state := '00000';
       sqlParams := vector();
-      sql := AB.WA.search_sql (self.domain_id, self.account_id, data);
+        sql := AB.WA.search_sql (self.domain_id, self.account_id, 'R', data);
       exec(sql, state, msg, sqlParams, 0, meta, rows);
       if (state <> '00000')
         goto _error;
diff --git a/appsrc/ODS-Addressbook/www/gems.vsp b/appsrc/ODS-Addressbook/www/gems.vsp
index 66709da..ba2e53f 100644
--- a/appsrc/ODS-Addressbook/www/gems.vsp
+++ b/appsrc/ODS-Addressbook/www/gems.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: gems.vsp,v 1.1.2.1 2010/05/31 21:59:14 source Exp $
+--  $Id: gems.vsp,v 1.1.2.3 2010/10/07 13:24:46 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -25,8 +25,7 @@
   set http_charset = 'utf-8';
 
   declare _domain_id, _user_id, _authorized integer;
-  declare _params, _gems, _user, _password, _role varchar;
-  declare _authorizeVector any;
+  declare _params, _gems, _user varchar;
 
   _domain_id := AB.WA.session_domain (params);
   if (_domain_id > 0)
@@ -35,31 +34,9 @@
     if (not _authorized)
     {
       _authorized := 1;
-      _authorizeVector := DB.DBA.vsp_auth_vec (http_request_header());
-      if (_authorizeVector = 0)
-      {
-        _authorized := 0;
-      } else {
-        if (get_keyword ('authtype', _authorizeVector) <> 'basic')
-        {
-          _authorized := 0;
-        } else {
-          _user := get_keyword ('username', _authorizeVector, '');
-          _password := get_keyword ('pass', _authorizeVector, '');
-          if (not DB.DBA.web_user_password_check (_user, _password))
-          {
-            _authorized := 0;
-          } else {
-            _user_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = _user);
-            _role := AB.WA.access_role (_domain_id, _user_id);
-            if (_role not in ('admin', 'owner'))
-            {
+      if (not ODS..ods_check_auth (_user, _domain_id, 'reader'))
               _authorized := 0;
             }
-          }
-        }
-      }
-    }
     http_rewrite ();
     if (not _authorized)
     {
@@ -69,9 +46,7 @@
     }
     else
     {
-      declare exit handler for sqlstate '*' {
-        return;
-      };
+      declare exit handler for sqlstate '*' { return;};
 
       _gems := get_keyword('type', params);
       if (_gems = 'AddressBook.ics')
@@ -91,9 +66,8 @@
         DB.DBA.DAV_RES_CONTENT_INT (DB.DBA.DAV_SEARCH_ID (_path, 'R'), _content, _type, 0, 0);
         _params := null;
         if (get_keyword (':id', params, '') <> '')
-        {
           _params := vector (':id', get_keyword (':id', params));
-        }
+
         xml_template (xml_tree_doc (xml_tree (_content)), _params, _result);
         _result := xml_tree_doc (xml_tree (string_output_string (_result)));
         if (_gems in ('AddressBook.atom', 'AddressBook.rdf'))
diff --git a/appsrc/ODS-Addressbook/www/home.vspx b/appsrc/ODS-Addressbook/www/home.vspx
index 331378e..8154d5b 100644
--- a/appsrc/ODS-Addressbook/www/home.vspx
+++ b/appsrc/ODS-Addressbook/www/home.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: home.vspx,v 1.58.2.13 2010/07/09 14:37:00 source Exp $
+ -  $Id: home.vspx,v 1.58.2.25 2011/03/23 12:17:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -36,7 +36,7 @@
         self.v_id := atoi(self.abContact);
         if (self.v_id = -1)
         {
-          if (self.account_role not in ('public', 'guest'))
+          if (self.account_rights = 'W')
           {
             self.abAction := 'create';
             self.v_name := trim (get_keyword ('name', params, ''));
@@ -78,11 +78,11 @@
 
   <v:method name="toolbarEnable" arglist="in cmd varchar">
     <![CDATA[
-      if ((cmd = 'create') and ((self.account_role in ('public', 'guest')) or (self.abScope = 'MySharedContacts')))
+      if ((cmd = 'create') and ((self.account_rights <> 'W') or (self.abScope = 'MySharedContacts')))
         return 0;
-      if ((cmd = 'import') and ((self.account_role in ('public', 'guest')) or (self.abScope = 'MySharedContacts')))
+      if ((cmd = 'import') and ((self.account_rights <> 'W') or (self.abScope = 'MySharedContacts')))
         return 0;
-      if ((cmd = 'export') and ((self.account_role in ('public', 'guest')) or (self.abScope = 'MySharedContacts')))
+      if ((cmd = 'export') and ((self.account_rights <> 'W') or (self.abScope = 'MySharedContacts')))
         return 0;
       return 1;
     ]]>
@@ -94,8 +94,6 @@
 
       styleStr := '';
       onclickEvent := '';
-      --if (self.abLabels = 0)
-      --  styleStr := styleStr || 'width: 40px;';
       if (self.toolbarEnable(cmd))
       {
         onclickEvent := cmdOnClick;
@@ -111,7 +109,7 @@
     ]]>
   </v:method>
 
-  <v:method name="render_select" arglist="inout name any">
+  <v:method name="render_select" arglist="inout options any, inout name any">
     <![CDATA[
       declare N any;
       declare S, T any;
@@ -124,12 +122,10 @@
 
   	  http (sprintf ('<select name="sel_%s">', name));
   	  http ('<option value="skip">--</option>');
-      for (N := 0; N < length (self.i_Options); N := N + 2)
+      for (N := 0; N < length (options); N := N + 2)
       {
-        S := '';
-        if (self.i_Options[N] = T)
-          S := ' selected="selected"';
-        http (sprintf ('<option value="%s"%s>%s</option>', self.i_Options[N], S, self.i_Options[N+1]));
+        S := case when (options[N] = T) then ' selected="selected"' else '' end;
+        http (sprintf ('<option value="%s"%s>%s</option>', options[N], S, options[N+1]));
       }
   	  http ('</select>');
 	  ]]>
@@ -229,7 +225,9 @@
 
   <v:method name="viewImage" arglist="inout fValue any">
     <![CDATA[
-       if (self.abAction = 'view')
+      if (self.abAction <> 'view')
+        return;
+
          if (is_empty_or_null (fValue))
          {
            http (' ');
@@ -241,7 +239,9 @@
 
   <v:method name="viewTags" arglist="inout fValue any">
     <![CDATA[
-      if (self.abAction = 'view')
+      if (self.abAction <> 'view')
+        return;
+
         if (is_empty_or_null (fValue))
         {
           http (' ');
@@ -320,7 +320,9 @@
         {
           image := 'c.gif';
           image2 := 'folder_16.png';
-        } else if (AB.WA.vector_contains(self.abState, nodes[N+2])) {
+        }
+        else if (AB.WA.vector_contains(self.abState, nodes[N+2]))
+        {
           image := 'minus.gif';
           image2 := 'folder_open_16.png';
           alt := 'Close Node';
@@ -352,45 +354,12 @@
     ]]>
   </v:method>
 
-  <v:method name="shareNode" arglist="in person_id integer, in grants varchar, in override integer">
-    <![CDATA[
-      declare N, pos, id integer;
-      declare name, V any;
-
-      grants := replace(grants, ' ', '');
-      grants := replace(grants, ',,', ',');
-      grants := trim(grants, ',', '');
-      grants := grants || ',';
-      for (select U_ID, U_NAME from AB.WA.GRANTS, DB.DBA.SYS_USERS where G_GRANTER_ID = self.account_id and G_PERSON_ID = person_id and G_GRANTEE_ID = U_ID) do
-      {
-        name := U_NAME;
-        id := U_ID;
-        pos := strstr(grants, name || ',');
-        if (isnull (pos))
-        {
-          if (override)
-            delete from AB.WA.GRANTS where G_GRANTER_ID = self.account_id and G_GRANTEE_ID = id and G_PERSON_ID = person_id;
-        } else {
-          grants := replace(grants, name || ',', '');
-        }
-      }
-      V := split_and_decode(trim(grants, ','), 0, '\0\0,');
-      for (N := 0; N < length (V); N := N + 1)
-      {
-        id := (select U_ID from SYS_USERS where U_NAME = V[N]);
-        if (not isnull(id))
-          insert into AB.WA.GRANTS (G_GRANTER_ID, G_GRANTEE_ID, G_PERSON_ID)
-            values(self.account_id, id, person_id);
-      }
-    ]]>
-  </v:method>
-
   <v:method name="shareSelect" arglist="in person_id integer">
     <![CDATA[
       declare grants any;
 
       grants := '';
-      for (select U_ID, U_NAME from AB.WA.GRANTS, DB.DBA.SYS_USERS where G_GRANTER_ID = self.account_id and G_GRANTEE_ID = U_ID and G_PERSON_ID = person_id) do
+      for (select U_ID, U_NAME from AB.WA.GRANTS, DB.DBA.SYS_USERS where G_GRANTER_ID = AB.WA.domain_owner_id (self.domain_id) and G_GRANTEE_ID = U_ID and G_PERSON_ID = person_id) do
         grants := grants || cast (U_NAME as varchar) || ',';
       return trim (grants, ',');
     ]]>
@@ -408,9 +377,11 @@
     ]]>
   </v:method>
 
-  <v:method name="resetImport" arglist="">
+  <v:method name="resetImport" arglist="in mode integer">
     <![CDATA[
+      if (not mode)
       AB.WA.ab_graph_delete (self.i_iri);
+
       self.i_source := -1;
       self.i_type := -1;
       self.i_lName := '';
@@ -421,13 +392,20 @@
       self.i_lPassword := '';
       self.i_lMaps := null;
       self.i_maps := null;
+      self.i_number := 0;
       self.i_iri := null;
       self.i_contentItems := null;
+      self.i_contentPings := null;
       self.i_contentDepth := 0;
-      self.i_contentDepth := 100;
+      self.i_contentLimit := 100;
       self.i_contentFollow := null;
       self.i_data := null;
       self.i_validation := null;
+      self.i_validationMode := 'ask';
+      self.v_grants := '';
+      self.v_acl := '';
+
+      self.abAction := 'browse';
     ]]>
   </v:method>
 
@@ -440,7 +418,7 @@
           http ('<td>');
             for (select T_TAG from AB.WA.TAGS where T_DOMAIN_ID = self.domain_id and T_COUNT > 0 and T_TAG <> '' order by T_TAG) do
             {
-              http (sprintf ('<a href="#" onclick="javascript: addTag(\'%s\', \'%s\');">%s</a> ', T_TAG, fieldName, T_TAG));
+              http (sprintf ('<a href="#" onclick="javascript: return addTag(\'%s\', \'%s\');">%s</a> ', T_TAG, fieldName, T_TAG));
             }
           http ('</td>');
         http ('</tr>');
@@ -456,8 +434,8 @@
 
   <v:method name="saveData" arglist="">
     <![CDATA[
-      declare N integer;
-      declare suffix, tmp, acl, params any;
+      declare N, M integer;
+      declare suffix, tmp, tmpValue, acl, acl_users, params any;
 
       params := self.vc_page.vc_event.ve_params;
 
@@ -468,6 +446,7 @@
       acl := vector ();
       self.v_interests := '';
       self.v_relationships := '';
+      self.v_grants := '';
       for (N := 0; N < length (params); N := N + 4)
       {
         if ((params [N] like 'a_fld_1_%') and (trim (params [N+1]) <> ''))
@@ -477,20 +456,27 @@
         }
         else if ((params [N] like 'b_fld_1_%') and (trim (params [N+1]) <> ''))
         {
-          if (not AB.WA.vector_contains (tmp, trim (params [N+1])))
+          suffix := replace (params [N], 'b_fld_1_', '');
+          tmpValue := trim (params [N+1]) || ';' || trim (get_keyword ('b_fld_2_'||suffix, params, '')) || '\n';
+          if (not AB.WA.vector_contains (tmp, tmpValue))
           {
-            tmp := vector_concat (tmp, vector (trim (params [N+1])));
-            self.v_relationships := self.v_relationships || trim (params [N+1]) || '\n';
+            tmp := vector_concat (tmp, vector (tmpValue));
+            self.v_relationships := self.v_relationships || tmpValue;
           }
+
         }
-        else if ((params [N] like 's_fld_2_%') and (trim (params [N+1]) <> ''))
+        else if ((params [N] like 'f_fld_1_%') and (trim (params [N+1]) <> ''))
         {
-          suffix := replace (params [N], 's_fld_2_', '');
-          acl := vector_concat (acl, vector (vector (get_keyword ('s_fld_1_'||suffix, params, ''), get_keyword ('s_fld_2_'||suffix, params, ''), get_keyword ('s_fld_3_'||suffix, params, ''))));
+          acl_users := split_and_decode (trim (params[N+1]), 0, '\0\0,');
+          for (M := 0; M < length (acl_users); M := M + 1)
+          {
+            if (not isnull (AB.WA.account_id (trim (acl_users[M]))))
+              self.v_grants := self.v_grants || ',' || acl_users[M];
+      }
         }
       }
-      acl := vector_concat (vector (vector ('v1.0', length (acl))), acl);
-      self.v_acl := serialize (acl);
+      self.v_grants := trim (self.v_grants, ',');
+      self.v_acl := serialize (DB.DBA.wa_acl_params (params));
     ]]>
   </v:method>
 
@@ -516,7 +502,7 @@
       <v:variable name="abChars" type="integer" default="60" />
       <v:variable name="v_tabNo" param-name="tabNo" type="varchar" default="1"/>
 
-      <v:variable persist="0" name="abStep" type="varchar" default="''" />
+      <v:variable persist="0" name="abStep" type="varchar" param-name="step" default="''" />
       <v:variable persist="0" name="abSteps" type="any" default="null" />
       <v:variable name="v_id" type="any" default="-1" />
 
@@ -536,6 +522,7 @@
       <v:variable name="v_interests" type="varchar" default="''" />
       <v:variable name="v_relationships" type="varchar" default="''" />
       <v:variable name="v_acl" type="any" default="null" />
+      <v:variable name="v_certificate" type="any" default="null" />
 
       <v:variable name="v_mail" type="varchar" default="''" />
       <v:variable name="v_web" type="varchar" default="''" />
@@ -598,17 +585,19 @@
       <v:variable name="i_lPassword" type="varchar" default="''"/>
       <v:variable name="i_lSearch" type="varchar" default="'(cn=*)'"/>
       <v:variable name="i_lMaps" type="any" default="null"/>
-      <v:variable persist="temp" name="i_Options" type="any" default="null" />
       <v:variable persist="temp" name="i_Items" type="any" default="null" />
 
       <v:variable name="i_data" type="varchar" default="null"/>
       <v:variable name="i_iri" type="varchar" default="null" />
       <v:variable name="i_contentItems" type="any" default="null" />
+      <v:variable name="i_contentPings" type="any" default="null" />
       <v:variable name="i_contentDepth" type="integer" default="0" />
       <v:variable name="i_contentLimit" type="integer" default="100" />
       <v:variable name="i_contentFollow" type="any" default="null" />
-      <v:variable name="i_validation" type="varchar" default="null" />
+      <v:variable name="i_validation" type="any" default="null" />
+      <v:variable name="i_validationMode" type="varchar" default="'ask'" />
       <v:variable name="i_maps" type="any" default="null" />
+      <v:variable name="i_number" type="integer" default="0" />
 
       <v:variable name="ve_id" type="any" default="-1" />
       <v:variable name="ve_name" type="varchar" default="''" />
@@ -634,7 +623,7 @@
             self.abSubAction := '';
             self.abValue := '';
           }
-          if ((self.account_role in ('public', 'guest')) and (self.abAction = 'settings'))
+          if ((self.account_rights <> 'W') and (self.abAction = 'settings'))
             self.abAction := 'browse';
             
           self.mode_test();
@@ -694,8 +683,9 @@
                     self.v_foaf := '';
                   self.v_photo := '';
                   self.v_interests := '';
-                  self.v_relationships := '';
+                  self.v_relationships := 'foaf:knows;' || AB.WA.account_sioc_url (self.domain_id);
                   self.v_acl := null;
+                  self.v_certificate := null;
                   self.v_photo_preview_path := '';
 
                     self.v_mail := '';
@@ -781,7 +771,7 @@
                   }
                 else if (cmd = 'import')
                 {
-                  self.resetImport ();
+                  self.resetImport (0);
                     self.abAction := cmd;
                     self.abStep := '1';
                   self.abSteps  := vector ();
@@ -872,7 +862,7 @@
       <br style="clear: both;" />
 
       <vm:if test="self.abAction <> 'settings'">
-      <div class="ab_main">
+        <div id="ab_main" class="ab_main">
         <?vsp
           if (0)
           {
@@ -969,7 +959,7 @@
                         http ('<div style="border-top: 1px solid #7f94a5;"></div>');
                       }
 
-                      S := AB.WA.gems_url (self.domain_id);
+                      S := AB.WA.utf2wide (AB.WA.gems_url (self.domain_id));
                       http (sprintf ('<a href="%sAddressBook.%s" target="_blank" title="%s export" alt="%s export" class="gems noapp"><img src="image/rss-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'rss', 'RSS', 'RSS', 'RSS', 'RSS'));
                       http (sprintf ('<a href="%sAddressBook.%s" target="_blank" title="%s export" alt="%s export" class="gems noapp"><img src="image/blue-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'atom', 'ATOM', 'ATOM', 'ATOM', 'Atom'));
                       http (sprintf ('<a href="%sAddressBook.%s" target="_blank" title="%s export" alt="%s export" class="gems noapp"><img src="image/rdf-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'rdf', 'RDF', 'RDF', 'RDF', 'RDF'));
@@ -1016,8 +1006,7 @@
                 declare _done, tMin, tMax integer;
                 declare tClass, tStyle varchar;
 
-                select max(T_COUNT),
-                       min(T_COUNT)
+                  select max(T_COUNT), min(T_COUNT)
                   into tMax, tMin
                   from AB.WA.TAGS
                  where T_DOMAIN_ID = self.domain_id
@@ -1118,7 +1107,7 @@
                         if (not is_empty_or_null (cast (self.abValue as integer)))
                           AB.WA.xml_set('category', data, self.abValue);
                       }
-                    control.ds_sql := AB.WA.search_sql (self.domain_id, self.account_id, data);
+                        control.ds_sql := AB.WA.search_sql (self.domain_id, self.account_id, self.account_rights, data);
                     }
                     else if (self.abScope = 'MySharedContacts')
                     {
@@ -1132,10 +1121,8 @@
                                                         null                           P_TAGS,
                                                         null                           P_UPDATED,
                                                         null                           P_CREATED
-                                                   from AB.WA.GRANTS,
-                                                        DB.DBA.SYS_USERS
-                                                  where G_GRANTEE_ID = <USER_ID>
-                                                    and G_GRANTER_ID = U_ID) x
+                                                       from AB..GRANTS_VIEW
+                                                      where id = <USER_ID>) x
                                             where 1 = 1';
                       control.ds_sql := replace(control.ds_sql, '<USER_ID>', cast (self.account_id as varchar));
                       }
@@ -1149,10 +1136,10 @@
                                                         a.P_UPDATED                     P_UPDATED,
                                                         a.P_CREATED                     P_CREATED
                                                    from AB.WA.PERSONS a,
-                                                        AB.WA.GRANTS b
+                                                            AB..GRANTS_PERSON_VIEW b
                                                   where a.P_ID = b.G_PERSON_ID
-                                                    and b.G_GRANTER_ID = <ID>
-                                                    and b.G_GRANTEE_ID = <USER_ID>) x
+                                                        and b.FROM_ID = <ID>
+                                                        and b.TO_ID = <USER_ID>) x
                                             where 1 = 1';
                       control.ds_sql := replace(control.ds_sql, '<ID>', AB.WA.node_suffix(self.abNode));
                       control.ds_sql := replace(control.ds_sql, '<USER_ID>', cast (self.account_id as varchar));
@@ -1174,7 +1161,7 @@
                 <table id="contacts" class="ab_grid" cellspacing="0">
                   <thead class="sortHeader">
                     <tr>
-                          <v:template name="t2" type="simple" enabled="--case when ((self.account_role in ('public', 'guest')) or (self.abScope = 'MySharedContacts')) then 0 else 1 end">
+                          <v:template name="t2" type="simple" enabled="--case when ((self.account_rights <> 'W') or (self.abScope = 'MySharedContacts')) then 0 else 1 end">
                         <th class="checkbox" width="1%">
                           <input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, 'cb_item')" />
                         </th>
@@ -1190,25 +1177,32 @@
               <v:template name="ds_repeat" type="repeat" name-to-remove="" set-to-remove="">
 
                 <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
+                      <?vsp
+                        declare id integer;
+                        declare permissions any;
+
+                        id := (control as vspx_row_template).te_column_value('P_ID');
+                        permissions := AB.WA.contact_rights (self.domain_id, id, self.account_rights);
+                      ?>
                   <table>
                     <tr>
-                          <v:template  name="t3" type="simple" enabled="--case when ((self.account_role in ('public', 'guest')) or (self.abScope = 'MySharedContacts')) then 0 else 1 end">
+                          <vm:if test="(self.account_rights = 'W') and (self.abScope <> 'MySharedContacts')">
                         <td align="center" valign="top">
                           <?vsp
+                                if (permissions = 'W')
+                                {
                             declare S varchar;
 
-                            S := '';
-                            if (self.abContact = ((control.vc_parent) as vspx_row_template).te_column_value('P_ID'))
-                              S := 'checked="checked"';
-
-                            http (sprintf ('<input type="checkbox" name="cb_item" value="%d" %s onclick="selectCheck(this, \'cb_item\')" />', ((control.vc_parent) as vspx_row_template).te_column_value('P_ID'), S));
+                                  S := case when (self.abContact = id) then 'checked="checked"' else '' end;
+                                  http (sprintf ('<input type="checkbox" name="cb_item" value="%d" %s onclick="selectCheck(this, \'cb_item\')" />', id, S));
+                                }
                           ?>
                         </td>
-                      </v:template>
+                          </vm:if>
                           <td class="vcard" valign="top">
                         <?vsp
-                          declare N, id, did integer;
-                              declare tmp, title, title2, permissions, actions, tags any;
+                              declare N integer;
+                              declare tmp, title, title2, actions, tags any;
 
                             if ((self.abScope = 'MySharedContacts') and (AB.WA.node_type(self.abNode) = 'u') and (AB.WA.node_id(self.abNode) = -1))
                             {
@@ -1216,14 +1210,11 @@
                             goto _skip;
                           }
 
-                          id := (control as vspx_row_template).te_column_value('P_ID');
-                          did := (control as vspx_row_template).te_column_value('P_DOMAIN_ID');
                           title := (control as vspx_row_template).te_column_value('P_NAME');
                           tags := (control as vspx_row_template).te_column_value('P_TAGS');
-                              permissions := AB.WA.person_permissions (id, self.domain_id, self.account_role);
                               title2 := self.prepareField (AB.WA.stringCut(title, self.abChars), 'nickname', null);
 
-                              http (sprintf ('<div style="float: left; font-weight: bold;"><a id="ab_%d" href="%s" onclick="javascript: vspxPost (\'pt_browse\', \'pt_action\', \'view\', \'pt_value\', \'%d\'); return false;" title="View \'%s\'" class="app link">%s</a></div>', id, SIOC..addressbook_contact_iri (self.domain_id, id), id, title, title2));
+                              http (sprintf ('<div style="float: left; font-weight: bold;"><a id="ab_%d" href="%s" onclick="javascript: vspxPost (\'pt_browse\', \'pt_action\', \'view\', \'pt_value\', \'%d\'); return false;" title="View \'%s\'" class="app link">%s</a></div>', id, AB.WA.utf2wide (SIOC..addressbook_contact_iri (self.domain_id, id)), id, title, title2));
                           
                           actions := '';
                               if (permissions = 'W')
@@ -1378,7 +1369,7 @@
                   </th>
                   <td>
                     <v:text name="s_grants" null-value="--''" value="--self.v_grants" xhtml_class="textbox" xhtml_size="60" xhtml_title="User names must be comma delimited!" />
-                    <input type="button" value="Select" onclick="javascript: windowShow('users.vspx?mode=u&dst=m&params=s_grants:s1;',520)" class="button" />
+                      <input type="button" value="Select" onclick="javascript: windowShow('/ods/users_select.vspx?form=F1&dst=mc&params=s_grants:s1;',520)" class="button" />
                     <input type="button" value="Clear" onclick="javascript: document.F1.elements['s_grants'].value = ''" class="button" />
                   </td>
                 </tr>
@@ -1401,7 +1392,7 @@
                     self.v_override := self.s_override.ufl_selected;
 
                     for (N := 0; N < length(self.abSelected); N := N + 1)
-                      self.shareNode (self.abSelected[N], self.v_grants, self.v_override);
+                         AB.WA.contact_share (self.account_id, self.abSelected[N], self.v_grants, self.v_override);
 
                     self.abAction := 'browse';
                     self.vc_data_bind(e);
@@ -1427,7 +1418,7 @@
                   declare exit handler for not found goto _end;
 
                 params := self.vc_page.vc_event.ve_params;
-                if (isnull (get_keyword ('ab_name', params)))
+                  if (isnull (get_keyword ('ab_name', params)) or (self.abAction = 'view'))
                   self.v_tabNo := '1';
                   if ((self.abAction in ('edit', 'view')) and isnull (get_keyword ('ab_name', params)))
                   {
@@ -1486,6 +1477,7 @@
                          P_B_WEB,
                            P_TAGS,
                            P_ACL,
+                           P_CERTIFICATE,
                            C_ID,
                            C_NAME
                     into self.v_kind,
@@ -1543,6 +1535,7 @@
                          self.v_bWeb,
                            self.v_tags,
                            self.v_acl,
+                           self.v_certificate,
                            self.v_category_id,
                            self.v_category_name
                     from AB.WA.PERSONS
@@ -1583,44 +1576,65 @@
             <v:text name="dirty_force_global" xhtml_id="dirty_force_global" type="hidden" value="--get_keyword ('dirty_force_global', self.vc_event.ve_params, 'false')"/>
             <div id="a" class="c1">
               <div class="tabs">
-                   <vm:tabCaption tab="a" tabsCount="6" tabNo="0" caption="Main" />
-                   <vm:tabCaption tab="a" tabsCount="6" tabNo="1" caption="Contact" />
-                   <vm:tabCaption tab="a" tabsCount="6" tabNo="2" caption="Home" />
-                   <vm:tabCaption tab="a" tabsCount="6" tabNo="3" caption="Business" />
-                   <vm:tabCaption tab="a" tabsCount="6" tabNo="4" caption="Relationships" />
-                  <vm:if test="AB.WA.domain_is_public (self.domain_id) = 2">
-                     <vm:tabCaption tab="a" tabsCount="6" tabNo="5" caption="Access" />
+                  <vm:if test="self.abAction <> 'view'">
+                   <vm:tabCaption tab="a" tabsCount="9" tabNo="0" caption="Import" />
+                  </vm:if>
+                   <vm:tabCaption tab="a" tabsCount="9" tabNo="1" caption="Main" />
+                   <vm:tabCaption tab="a" tabsCount="9" tabNo="2" caption="Contact" />
+                   <vm:tabCaption tab="a" tabsCount="9" tabNo="3" caption="Home" />
+                   <vm:tabCaption tab="a" tabsCount="9" tabNo="4" caption="Business" />
+                   <vm:tabCaption tab="a" tabsCount="9" tabNo="5" caption="Relationships" />
+                   <vm:tabCaption tab="a" tabsCount="9" tabNo="6" caption="Sharing" />
+                   <vm:tabCaption tab="a" tabsCount="9" tabNo="7" caption="X.509 Certificate" />
+                  <vm:if test="(self.abAction = 'view') and (not isnull (__proc_exists ('QRcode encodeString8bit', 2)))">
+                   <vm:tabCaption tab="a" tabsCount="9" tabNo="8" caption="QRCode" />
                   </vm:if>
               </div>
                 <div class="contents vcard">
+                  <vm:if test="self.abAction <> 'view'">
                 <div id="a_content_0" class="tabContent" style="display: none;">
                     <table class="form-body n" cellspacing="0">
-                      <vm:if test="(self.abAction = 'view') or (self.abAction = 'edit')">
+                      <tr>
+                        <th>
+                          <v:label for="ab_foaf" value="Profile Document URL" />
+                        </th>
+                        <td>
+                          <vm:if test="self.abAction <> 'view'">
+                            <v:text name="x_foaf" xhtml_id="x_foaf" value="" fmt-function="AB.WA.utf2wide" xhtml_size="60" />
+                            <input type="button" value="Import" onclick="javascript: AB.getFOAFData($v('x_foaf')); return false;" class="button" />
+                            <img id="ab_import_image" alt="Import FOAF Data" src="/ods/images/oat/Ajax_throbber.gif" style="display: none" />
+                          </vm:if>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                  </vm:if>
+                  <div id="a_content_1" class="tabContent" style="display: none;">
+                    <table class="form-body n" cellspacing="0">
+                      <vm:if test="self.abAction in ('view', 'edit')">
                     <tr>
                         <th>
-                          <v:label for="ab_foaf" value="Contact URI" />
+                          Contact URI
                         </th>
                         <td>
-                          <?vsp self.viewField (SIOC..addressbook_contact_iri (self.domain_id, self.v_id), 'uid', null); ?>
+                          <?vsp http (self.prepareField(AB.WA.utf2wide (SIOC..addressbook_contact_iri (self.domain_id, self.v_id)), 'uid', null)); ?>
                         </td>
                       </tr>
                       </vm:if>
                       <tr>
                         <th>
-                          <v:label for="ab_foaf" value="Person''s FOAF URI" />
+                          <v:label for="ab_foaf" value="Profile Document URL" />
                         </th>
                         <td>
                           <vm:if test="self.abAction <> 'view'">
                             <v:text name="ab_foaf" xhtml_id="ab_foaf" value="--self.v_foaf" fmt-function="AB.WA.utf2wide" xhtml_size="60" />
-                            <input type="button" value="Import" onclick="javascript: AB.getFOAFData($v('ab_foaf')); return false;" class="button" />
-                            <img id="ab_import_image" alt="Import FOAF Data" src="/ods/images/oat/Ajax_throbber.gif" style="display: none" />
                           </vm:if>
                           <?vsp self.viewField (self.v_foaf, '', null); ?>
                         </td>
                       </tr>
                       <tr>
                         <th>
-                          <v:label for="ab_iri" value="Person URI" />
+                          <v:label for="ab_iri" value="WebID" />
                         </th>
                         <td>
                           <vm:if test="self.abAction <> 'view'">
@@ -1733,7 +1747,7 @@
                       <th>
                           <v:label for="ab_birthday" value="Birthday" />
                       </th>
-                      <td nowrap="1">
+                        <td nowrap="nowrap">
                         <vm:if test="self.abAction <> 'view'">
                             <v:text name="ab_birthday" xhtml_id="ab_birthday" null-value="--''" value="--AB.WA.dt_format (self.v_birthday, 'Y-M-D')" xhtml_onclick="javascript: datePopup(\'ab_birthday\');" xhtml_class="textbox" xhtml_size="10" />
                             <a href="#" name="ab_birthday_select" id="ab_birthday_select" onclick="datePopup('ab_birthday'); return false;" class="noapp">
@@ -1796,7 +1810,7 @@
                         <th valign="top">
                           <label for="ab_photo">Photo</label>
                         </th>
-                        <td class="listing_col" nowrap="1">
+                        <td class="listing_col" nowrap="nowrap">
                           <vm:if test="self.abAction <> 'view'">
                             <v:text name="ab_photo" value="--self.v_photo" fmt-function="AB.WA.utf2wide" xhtml_size="60" />
                             <v:button name="ab_photo_preview" value="Preview" action="simple" xhtml_class="button">
@@ -1905,18 +1919,6 @@
                           </td>
                         </tr>
                       </vm:if>
-                    <vm:if test="self.abAction <> 'view'">
-                      <tr>
-                        <th>
-                          <v:label for="ab_grants" value="Share with" />
-                        </th>
-                        <td>
-                          <v:text name="ab_grants" null-value="--''" value="--self.v_grants" xhtml_class="textbox" xhtml_size="60" xhtml_title="User names must be comma delimited!" />
-                          <input type="button" value="Select" onclick="javascript: windowShow('users.vspx?mode=u&dst=m&params=ab_grants:s1;',520)" class="button" />
-                          <input type="button" value="Clear" onclick="javascript: document.F1.elements['ab_grants'].value = ''" class="button" />
-                        </td>
-                      </tr>
-                    </vm:if>
                     <tr>
                         <th>
                           <v:label for="ab_category" value="Category" />
@@ -1971,7 +1973,7 @@
                     </vm:if>
                   </table>
                 </div>
-                <div id="a_content_1" class="tabContent" style="display: none;">
+                  <div id="a_content_2" class="tabContent" style="display: none;">
                   <table class="form-body" cellspacing="0">
                     <tr>
                       <th width="25%">
@@ -2052,7 +2054,7 @@
                     </tr>
                   </table>
                 </div>
-                  <div id="a_content_2" class="tabContent adr" style="display: none;">
+                  <div id="a_content_3" class="tabContent" style="display: none;">
                     <span class="type" style="display: none;">HOME</span>
                   <table class="form-body" cellspacing="0">
                     <tr>
@@ -2229,7 +2231,7 @@
                     </tr>
                   </table>
                 </div>
-                  <div id="a_content_3" class="tabContent adr" style="display: none;">
+                  <div id="a_content_4" class="tabContent" style="display: none;">
                     <span class="type" style="display: none;">WORK</span>
                   <table class="form-body" cellspacing="0">
                     <tr>
@@ -2454,14 +2456,15 @@
                     </tr>
                   </table>
                 </div>
-                  <div id="a_content_4" class="tabContent" style="display: none;">
+                  <div id="a_content_5" class="tabContent" style="display: none;">
                     <table class="form-body" cellspacing="0">
                       <tr>
-                        <td style="width: 40em; background-color: white;">
+                        <td style="width: 60em; background-color: white;">
                           <table id="b_tbl" width="100%" cellspacing="0">
                             <thead class="sortHeader">
                               <tr>
-                                <th>Relationship</th>
+                                <th width="50%">Relationship</th>
+                                <th width="50%">URI</th>
                                 <vm:if test="self.abAction <> 'view'">
                                   <th width="50px">Action</th>
                                 </vm:if>
@@ -2470,34 +2473,81 @@
                       		  <![CDATA[
                       		    <script type="text/javascript">
                             <?vsp
-                                declare N integer;
+                                declare owner_iri integer;
 
-                              N := 0;
-                              for (select relationship from DB.DBA.WA_USER_INTERESTS (txt) (relationship varchar) P where txt = self.v_relationships) do
+                                owner_iri := AB.WA.account_sioc_url (self.domain_id);
+                                for (select fld1, fld2 from DB.DBA.WA_USER_INTERESTS (txt) (fld1 varchar, fld2 varchar) P where txt = self.v_relationships) do
                               {
-                                N := N + 1;
+                                  if (DB.DBA.is_empty_or_null (fld2))
+                                    fld2 := owner_iri;
                               if (self.abAction <> 'view')
                                   {
-                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("b", null, {fld_1: {mode: 20, value: "%s", className: "_validate_"}});});', relationship));
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("b", null, {fld_1: {mode: 20, value: "%s", className: "_validate_"}, fld_2: {value: "%s", className: "_validate_ _uri_"}});});', fld1, fld2));
                                   } else {
-                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("b", {fld_1: {value: "%s"}});});', relationship));
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("b", {fld_1: {value: "%s"}, fld_2: {value: "%s"}});});', fld1, fld2));
                                   }
                                 }
                             ?>
                       		    </script>
                       		  ]]>
-                            <tr id="b_tr_no" style="display: <?V case when N=0 then '' else 'none' end ?>;"><td colspan="<?V case when self.abAction='view' then 1 else 2 end ?>"><b>No Relationships</b></td></tr>
+                            <tr id="b_tr_no"><td colspan="<?V case when self.abAction='view' then 2 else 3 end ?>"><b>No Relationships</b></td></tr>
                           </table>
                         </td>
                         <vm:if test="self.abAction <> 'view'">
                           <td valign="top" nowrap="nowrap">
-                            <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Relationship" title="Add Relationship" onclick="javascript: TBL.createRow('b', null, {fld_1: {mode: 20, className: '_validate_'}});" />
+                            <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Relationship" title="Add Relationship" onclick="javascript: TBL.createRow('b', null, {fld_1: {mode: 20, className: '_validate_'}, fld_2: {className: '_validate_ _uri_'}});" />
                           </td>
                         </vm:if>
                       </tr>
                     </table>
                   </div>
-                  <div id="a_content_5" class="tabContent" style="display: none;">
+                  <div id="a_content_6" class="tabContent" style="display: none;">
+                    <fieldset>
+                      <legend><b>ODS users</b></legend>
+                      <table class="form-body" cellspacing="0">
+                        <tr>
+                          <td style="width: 90%; background-color: white;">
+                            <table id="f_tbl" width="100%" cellspacing="0">
+                              <thead class="sortHeader">
+                                <tr>
+                                  <th width="100%">Value</th>
+                                  <th width="50px">Action</th>
+                                </tr>
+                              </thead>
+                        		  <![CDATA[
+                        		    <script type="text/javascript">
+                                <?vsp
+                                  declare N, L integer;
+                                  declare acl_values any;
+
+                                  L := 0;
+                                  acl_values := split_and_decode (self.v_grants, 0, '\0\0,');
+                                  for (N := 0; N < length (acl_values); N := N + 1)
+                                  {
+                                    L := 1;
+                                    if (self.abAction <> 'view')
+                                    {
+                                      http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("f", null, {fld_1: {mode: 1, value: "%s", form: "F1"}});});', acl_values[N], 'U'));
+                                    } else {
+                                      http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("f", {fld_1: {value: "%s"}});});', acl_values[N]));
+                                    }
+                                  }
+                                ?>
+                        		    </script>
+                        		  ]]>
+                              <tr id="f_tr_no" style="display: <?V case when L=0 then '' else 'none' end ?>;"><td colspan="<?V case when self.abAction='view' then 1 else 2 end ?>"><b>No Shares</b></td></tr>
+                        		</table>
+                        	</td>
+                          <vm:if test="self.abAction <> 'view'">
+                            <td valign="top" nowrap="nowrap">
+                              <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('f', null, {fld_1: {mode: 1, form: 'F1'}});" />
+                            </td>
+                          </vm:if>
+                        </tr>
+                      </table>
+                    </fieldset>
+                    <fieldset>
+                      <legend><b>WebID users</b></legend>
                     <table class="form-body" cellspacing="0">
                       <tr>
                         <td style="width: 90%; background-color: white;">
@@ -2506,10 +2556,8 @@
                               <tr>
                                 <th width="15%">Type</th>
                                 <th>Value</th>
-                                <th width="80px">Access</th>
-                                <vm:if test="self.abAction <> 'view'">
+                                <th width="1%" nowrap="nowrap">ACL: (R)ead, (W)rite</th>
                                   <th width="50px">Action</th>
-                                </vm:if>
                               </tr>
                             </thead>
                       		  <![CDATA[
@@ -2518,26 +2566,23 @@
                                 declare N, L integer;
                                 declare acl, aType, aAccess any;
 
-                                aType := vector ('URI', 'Person URI', 'Property', 'RDF Property', 'SPARQL', 'SPARQL Expression');
-                                aAccess := vector ('G', 'Grant', 'R', 'Revoke');
-
                               L := 0;
                               acl := (select WAI_ACL from DB.DBA.WA_INSTANCE where WAI_ID = self.domain_id);
                               acl := case when isnull (acl) then vector () else deserialize (acl) end;
-                              for (N := 1; N < length (acl); N := N + 1)
+                                for (N := 0; N < length (acl); N := N + 1)
                               {
                                 L := L + 1;
-                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {value: "%s"}, fld_2: {value: "%s"}, fld_3: {value: "%s"}, fld_4: {value: "%s"}});});', get_keyword (acl[N][0], aType), acl[N][1], get_keyword (acl[N][2], aAccess), 'Inherited'));
+                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}, fld_4: {value: "Inherited"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
                               }
                               acl := deserialize (self.v_acl);
-                              for (N := 1; N < length (acl); N := N + 1)
+                                for (N := 0; N < length (acl); N := N + 1)
                               {
                                 L := L + 1;
                                   if (self.abAction <> 'view')
                                   {
-                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("s", null, {fld_1: {mode: 30, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 31, value: "%s"}});});', acl[N][0], acl[N][1], acl[N][2]));
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("s", null, {fld_1: {mode: 50, value: "%s", onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: "F1", tdCssText: "white-space: nowrap;", className: "_validate_ _webid_", value: "%s", readOnly: %s, imgCssText: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', acl[N][2], acl[N][1], case when acl[N][2] = 'public' then 'true' else 'false' end, case when acl[N][2] = 'public' then 'display: none;' else '' end, acl[N][3], acl[N][4], acl[N][5]));
                                   } else {
-                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {value: "%s"}, fld_2: {value: "%s"}, fld_3: {value: "%s"}, fld_4: {value: "%s"}});});', get_keyword (acl[N][0], aType), acl[N][1], get_keyword (acl[N][2], aAccess), ''));
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
                                   }
                                 }
                            		    ?>
@@ -2548,16 +2593,87 @@
                         </td>
                         <vm:if test="self.abAction <> 'view'">
                           <td valign="top" nowrap="nowrap">
-                            <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 30}, fld_2: {}, fld_3: {mode: 31}});" />
+                            <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 50, onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: 'F1', tdCssText: 'white-space: nowrap;', className: '_validate_ _webid_'}, fld_3: {mode: 52, value: [1, 0, 0], tdCssText: 'width: 1%; white-space: nowrap; text-align: center;'}});" />
                           </td>
                         </vm:if>
                       </tr>
                     </table>
+                    </fieldset>
+                  </div>
+                  <div id="a_content_7" class="tabContent" style="display: none;">
+                    <table class="form-body" cellspacing="0">
+              	      <?vsp if (length (self.v_certificate)) { ?>
+                        <tr>
+                          <th width="25%">
+                            Subject
+                          </th>
+                          <td>
+                      		  <?vsp
+                		          http_value (get_certificate_info (2, cast(self.v_certificate as varchar), 0, ''));
+                		        ?>
+                          </td>
+                        </tr>
+                        <tr>
+                          <th width="25%">
+                            Agent ID
+                          </th>
+                          <td>
+                      		  <?vsp
+              		            http_value (ODS.ODS_API.SSL_WEBID_GET (cast(self.v_certificate as varchar)));
+                		        ?>
+                          </td>
+                        </tr>
+                        <tr>
+                          <th width="25%">
+                            Fingerprint
+                          </th>
+                          <td>
+                      		  <?vsp
+              		            http_value (get_certificate_info (6, cast(self.v_certificate as varchar), 0, ''));
+                		        ?>
+                          </td>
+                        </tr>
+             	        <?vsp } ?>
+                      <tr>
+                        <th width="25%" valign="top">
+                          <v:label for="ab_Certificate" value="Certificate" />
+                        </th>
+                        <td>
+                          <vm:if test="self.abAction <> 'view'">
+                            <v:textarea name="ab_Certificate" null-value="" value="--self.v_certificate" xhtml_cols="70" xhtml_rows="20" />
+                          </vm:if>
+                          <?vsp self.viewField (self.v_certificate, null, null); ?>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                  <div id="a_content_8" class="tabContent" style="display: none;">
+              		  <?vsp
+              		    declare vcard, qrcode any;
+
+        		          vcard := AB.WA.export_vcard (self.domain_id, vector (self.v_id));
+                      qrcode := ODS.ODS_API.qrcode (vcard, 120, 120, 3);
+        		        ?>
+                    <table class="form-body" cellspacing="0">
+                      <tr>
+                        <td align="center">
+                    		  <?vsp
+                            if (qrcode is not null)
+	                            http (sprintf ('<img id="qrcode" src="data:image/jpg;base64,%s"/>', qrcode));
+              		        ?>
+                        </td>
+                      </tr>
+                      <tr>
+                        <td align="center">
+                          <b>vCard Contact Data</b>
+                        </td>
+                      </tr>
+                    </table>
                   </div>
               </div>
             </div>
             <div class="new-form-footer">
-                <v:button name="ab_save" action="simple" value="Save" enabled="--case when (self.abAction <> 'view') then 1 else 0 end" xhtml_class="form-button">
+                <v:button name="ab_save" action="simple" value="Save" enabled="--case when (self.abAction <> 'view') then 1 else 0 end" xhtml_class="form-button" xhtml_onclick="return validateInputs(this);">
                 <v:on-post>
                   <![CDATA[
                       declare N, tmp any;
@@ -2742,6 +2858,7 @@
                     self.v_bJob          := trim (self.ab_bJob.ufl_value);
                     self.v_bMail         := trim (self.ab_bMail.ufl_value);
                     self.v_bWeb          := trim (self.ab_bWeb.ufl_value);
+                      self.v_certificate   := trim (self.ab_certificate.ufl_value);
 
                       self.v_category_id   := AB.WA.category_update (self.domain_id, get_keyword ('ab_category_name', e.ve_params));
 
@@ -2807,14 +2924,22 @@
                     );
                       AB.WA.contact_update2 (self.v_id, self.domain_id, 'P_RELATIONSHIPS', self.v_relationships);
                       AB.WA.contact_update2 (self.v_id, self.domain_id, 'P_ACL', self.v_acl);
-                    self.v_grants := trim (self.ab_grants.ufl_value);
-                    self.shareNode (self.v_id, self.v_grants, 1);
+                      AB.WA.contact_update2 (self.v_id, self.domain_id, 'P_CERTIFICATE', self.v_certificate);
+                      AB.WA.contact_share (self.account_id, self.v_id, self.v_grants, 1);
 
                     self.abAction := 'browse';
                     self.vc_data_bind(e);
                   ]]>
                 </v:on-post>
               </v:button>
+                <v:button action="simple" name="ab_edit" value="Edit" enabled="--case when (AB.WA.contact_rights (self.domain_id, self.v_id, self.account_rights) = 'W') and (self.abAction = 'view') then 1 else 0 end" xhtml_class="form-button">
+                  <v:on-post>
+                    <![CDATA[
+                      self.abAction := 'edit';
+                      self.vc_data_bind(e);
+                    ]]>
+                  </v:on-post>
+                </v:button>
                 <v:button name="ab_cancel" action="simple" value="Cancel" xhtml_class="form-button">
                 <v:on-post>
                   <![CDATA[
@@ -2841,118 +2966,74 @@
 	            <div class="new-form-body">
 	              <table cellspacing="0">
 	                <tr>
-                    <th rowspan="4" valign="middle" width="45%">
+                      <th valign="top" width="45%">
 	                    <v:label for="i_file" value="Source type"/>
 	                  </th>
 	                  <td nowrap="nowarap">
-	                    <v:radio-button name="i_source_0" xhtml_id="i_source_0" group-name="i_source" value="0">
+                        <label>
+                          <v:radio-button name="i_source_0" xhtml_id="i_source_0" group-name="i_source" value="0" xhtml_onchange="javascript: destinationChange(this, {show: [\'imp_tr_0\', \'imp_tr_1\', \'imp_tr_2\']});">
 	                      <v:before-render>
 	                        <![CDATA[
 	                          control.ufl_selected := either(lte(self.i_source, 0), 1, 0);
 	                        ]]>
 	                      </v:before-render>
 	                    </v:radio-button>
-	                    <xsl:call-template name="nbsp"/>
-	                    <b><vm:label for="i_source_0" value="--'File'" /></b>
-	                  </td>
-	                </tr>
-	                <tr>
-	                  <td nowrap="nowarap">
-	                    <v:radio-button name="i_source_1" xhtml_id="i_source_1" group-name="i_source" value="1">
+                          <b>File</b>
+                        </label>
+                        <br />
+                        <label>
+                          <v:radio-button name="i_source_1" xhtml_id="i_source_1" group-name="i_source" value="1" xhtml_onchange="javascript: destinationChange(this, {show: [\'imp_tr_0\', \'imp_tr_1\', \'imp_tr_2\']});">
 	                      <v:before-render>
 	                        <![CDATA[
 	                          control.ufl_selected := either(equ(self.i_source, 1), 1, 0);
 	                        ]]>
 	                      </v:before-render>
 	                    </v:radio-button>
-	                    <xsl:call-template name="nbsp"/>
-	                    <b><vm:label for="i_source_1" value="--'WebDAV'" /></b>
-	                  </td>
-	                </tr>
-	                <tr>
-	                  <td nowrap="nowarap">
-	                    <v:radio-button name="i_source_2" xhtml_id="i_source_2" group-name="i_source" value="2">
+                          <b>WebDAV</b>
+                        </label>
+                        <br />
+                        <label>
+                          <v:radio-button name="i_source_2" xhtml_id="i_source_2" group-name="i_source" value="2" xhtml_onchange="javascript: destinationChange(this, {show: [\'imp_tr_0\', \'imp_tr_1\', \'imp_tr_2\']});">
 	                      <v:before-render>
 	                        <![CDATA[
 	                          control.ufl_selected := either(equ(self.i_source, 2), 1, 0);
 	                        ]]>
 	                      </v:before-render>
 	                    </v:radio-button>
-	                    <xsl:call-template name="nbsp"/>
-                        <b><vm:label for="i_source_2" value="--'URI'" /></b>
-                    </td>
-                  </tr>
-                  <tr>
-                    <td nowrap="nowarap">
-                      <v:radio-button name="i_source_3" xhtml_id="i_source_3" group-name="i_source" value="3">
+                          <b>URI</b>
+                        </label>
+                        <br />
+                        <label>
+                          <v:radio-button name="i_source_3" xhtml_id="i_source_3" group-name="i_source" value="3" xhtml_onchange="javascript: destinationChange(this, {hide: [\'imp_tr_0\', \'imp_tr_1\', \'imp_tr_2\']});">
                         <v:before-render>
                           <![CDATA[
                             control.ufl_selected := either(equ(self.i_source, 3), 1, 0);
                           ]]>
                         </v:before-render>
                       </v:radio-button>
-                      <xsl:call-template name="nbsp" />
-                      <b><vm:label for="i_source_3" value="--'LDAP Server'" /></b>
+                          <b>LDAP Server</b>
+                        </label>
+                        <br />
+                        <vm:if test="not isnull (ODS.ODS_API.get_oauth_tok ('LinkedIn API'))">
+                          <label>
+                            <v:radio-button name="i_source_4" xhtml_id="i_source_4" group-name="i_source" value="4" xhtml_onchange="javascript: destinationChange(this, {hide: [\'imp_tr_0\', \'imp_tr_1\', \'imp_tr_2\']});">
+                              <v:before-render>
+                                <![CDATA[
+                                  control.ufl_selected := either (equ (self.i_source, 4), 1, 0);
+                                ]]>
+                              </v:before-render>
+                            </v:radio-button>
+                            <b>LinkedIn</b>
+                          </label>
+                        </vm:if>
 	                  </td>
 	                </tr>
-	              </table>
-	            </div>
-
-	            <div class="new-form-footer">
-                  <v:button name="i1_next" action="simple" value="Next" xhtml_class="form-button">
-	                <v:on-post>
-	                  <![CDATA[
-	                    declare tmp any;
-
-                      self.abStep := '2';
-	                    tmp := self.i_source;
-                        if (self.i_source_0.ufl_selected)
-                        {
-	                      self.i_source := 0;
-                        }
-                        else if (self.i_source_1.ufl_selected)
-                        {
-	                      self.i_source := 1;
-                        }
-                        else if (self.i_source_2.ufl_selected)
-                        {
-	                      self.i_source := 2;
-                        }
-                        else if (self.i_source_3.ufl_selected)
-                        {
-                        self.i_source := 3;
-	                      self.i_type := 3;
-                        self.abStep := '3';
-	                    }
-
-                      AB.WA.push (self.abSteps, '1');
-                      self.vc_data_bind(e);
-	                  ]]>
-	                </v:on-post>
-	              </v:button>
-                <v:button action="simple" name="i1_cancel" value="Cancel" xhtml_class="form-button">
-	                <v:on-post>
-	                  <![CDATA[
-	                    self.abAction := 'browse';
-	                    self.vc_data_bind(e);
-	                  ]]>
-	                </v:on-post>
-	              </v:button>
-	            </div>
-	          </v:template>
-
-              <v:template  name="t9" type="simple" enabled="-- case when (self.abStep = '2') then 1 else 0 end">
-	            <div class="new-form-header">
-	              <v:label format="%s" value="Import: Select content type"/>
-	            </div>
-
-	            <div class="new-form-body">
-	              <table cellspacing="0">
-	                <tr>
-	                  <th rowspan="3" valign="middle" width="45%">
+                    <tr id="imp_tr_0">
+                      <th valign="top" width="45%">
 	                    <v:label for="i_file" value="Content type"/>
 	                  </th>
 	                  <td nowrap="nowarap">
+                        <label>
 	                    <v:radio-button name="i_type_0" xhtml_id="i_type_0" group-name="i_type" value="0">
 	                      <v:before-render>
 	                        <![CDATA[
@@ -2960,12 +3041,10 @@
 	                        ]]>
 	                      </v:before-render>
 	                    </v:radio-button>
-	                    <xsl:call-template name="nbsp"/>
-	                    <b><vm:label for="i_type_0" value="--'vCard'" /></b>
-	                  </td>
-	                </tr>
-	                <tr>
-	                  <td nowrap="nowarap">
+                          <b>vCard</b>
+                        </label>
+                        <br />
+                        <label>
 	                    <v:radio-button name="i_type_1" xhtml_id="i_type_1" group-name="i_type" value="1">
 	                      <v:before-render>
 	                        <![CDATA[
@@ -2973,12 +3052,10 @@
 	                        ]]>
 	                      </v:before-render>
 	                    </v:radio-button>
-	                    <xsl:call-template name="nbsp"/>
-	                    <b><vm:label for="i_type_1" value="--'FOAF'" /></b>
-	                  </td>
-	                </tr>
-	                <tr>
-	                  <td nowrap="nowarap">
+                          <b>FOAF</b>
+                        </label>
+                        <br />
+                        <label>
 	                    <v:radio-button name="i_type_2" xhtml_id="i_type_2" group-name="i_type" value="2">
 	                      <v:before-render>
 	                        <![CDATA[
@@ -2986,25 +3063,42 @@
 	                        ]]>
 	                      </v:before-render>
 	                    </v:radio-button>
-	                    <xsl:call-template name="nbsp"/>
-	                    <b><vm:label for="i_type_2" value="--'CSV'" /></b>
+                          <b>CSV</b>
+                        </label>
 	                  </td>
 	                </tr>
 	              </table>
 	            </div>
 
 	            <div class="new-form-footer">
-                  <v:button action="simple" name="i2_back" value="Back" xhtml_class="form-button">
-	                <v:on-post>
-	                  <![CDATA[
-                      self.abStep := AB.WA.pop (self.abSteps);
-                      self.vc_data_bind(e);
-	                  ]]>
-	                </v:on-post>
-	              </v:button>
-                  <v:button action="simple" name="i2_next" value="Next" xhtml_class="form-button">
+                  <v:button name="i1_next" action="simple" value="Next" xhtml_class="form-button">
 	                <v:on-post>
 	                  <![CDATA[
+                        if (self.i_source_3.ufl_selected)
+                        {
+                          self.i_source := 3;
+                          self.i_type   := 3;
+                        }
+                        else if (self.i_source_4.ufl_selected)
+                        {
+                          self.i_source := 4;
+                          self.i_type   := 4;
+                        }
+                        else
+                        {
+                          if (self.i_source_0.ufl_selected)
+                          {
+                            self.i_source := 0;
+                          }
+                          else if (self.i_source_1.ufl_selected)
+                          {
+                            self.i_source := 1;
+                          }
+                          else if (self.i_source_2.ufl_selected)
+                          {
+                            self.i_source := 2;
+                          }
+
                         if (self.i_type_0.ufl_selected)
                         {
 	                      self.i_type := 0;
@@ -3017,18 +3111,18 @@
                         {
 	                      self.i_type := 2;
 	                    }
+                        }
 
-                      self.abStep := '3';
-                      AB.WA.push (self.abSteps, '2');
+                        self.abStep := '2';
+                        AB.WA.push (self.abSteps, '1');
                       self.vc_data_bind(e);
 	                  ]]>
 	                </v:on-post>
 	              </v:button>
-                <v:button action="simple" name="i2_cancel" value="Cancel" xhtml_class="form-button">
+                  <v:button action="simple" name="i1_cancel" value="Cancel" xhtml_class="form-button">
 	                <v:on-post>
 	                  <![CDATA[
 	                    self.abAction := 'browse';
-                      self.resetImport ();
 	                    self.vc_data_bind(e);
 	                  ]]>
 	                </v:on-post>
@@ -3036,7 +3130,53 @@
 	            </div>
 	          </v:template>
 
-              <v:template name="t10" type="simple" enabled="-- case when (self.abStep = '3') then 1 else 0 end">
+              <v:template name="t10" type="simple" enabled="-- case when (self.abStep = '2') then 1 else 0 end">
+                <v:after-data-bind>
+                  <![CDATA[
+                    declare params, names any;
+                    declare token, result, url, my_sid, oauth_token, return_url any;
+
+                    params := self.vc_page.vc_event.ve_params;
+                    if (get_keyword ('oauth_verifier', params) is not null)
+                    {
+                      token := ODS.ODS_API.get_oauth_tok ('LinkedIn API');
+
+                      my_sid := get_keyword ('my_sid', params);
+                      url := OAUTH..sign_request ('GET', 'https://api.linkedin.com/uas/oauth/accessToken', sprintf ('oauth_token=%U&oauth_verifier=%U', get_keyword ('oauth_token', params), get_keyword ('oauth_verifier', params)), token, my_sid, 1);
+                      result := http_get (url);
+                      my_sid := OAUTH..parse_response (my_sid, token, result);
+
+                      url := OAUTH..sign_request ('GET', 'https://api.linkedin.com/v1/people/~/connections', '', token, my_sid, 1);
+                      result := http_get (url);
+                      OAUTH..session_terminate (my_sid);
+
+                      self.abStep := '5';
+                      self.i_source := 4;
+                      self.i_type   := 4;
+                      self.i_data := result;
+                      self.i_number := AB.WA.import_count (self.i_type, self.i_data);
+                      AB.WA.push (self.abSteps, '1');
+
+                      self.vc_data_bind(e);
+                    }
+                    else if (self.i_source = 4)
+                    {
+                      token := ODS.ODS_API.get_oauth_tok ('LinkedIn API');
+
+                      my_sid := md5 (datestring (now ()));
+                      return_url := sprintf ('%shome.vspx?my_sid=%U&sid=%s&realm=%s&action=%s&step=%s', AB.WA.ab_url (self.domain_id), my_sid, self.sid, self.realm, self.abAction, self.abStep);
+                      url := OAUTH..sign_request ('GET', 'https://api.linkedin.com/uas/oauth/requestToken', sprintf ('oauth_callback=%U', return_url), token, null, 1);
+                      result := http_get (url);
+                      my_sid := OAUTH..parse_response (my_sid, token, result);
+
+                      OAUTH..set_session_data (my_sid, vector ());
+                      oauth_token := OAUTH..get_auth_token (my_sid);
+                      url := sprintf ('https://www.linkedin.com/uas/oauth/authenticate?oauth_token=%U', oauth_token);
+                      self.vc_redirect (url);
+                    }
+                  ]]>
+                </v:after-data-bind>
+
 	            <div class="new-form-header">
 	              <v:label format="%s" value="Import: Source parameters"/>
 	            </div>
@@ -3060,13 +3200,12 @@
 		                  </th>
 		                  <td>
                         <v:text name="f_dav" xhtml_id="f_dav" value="" xhtml_size="40" />
-                          <v:button action="browse" name="browse" value="Browse...">
-                       	  <v:after-data-bind>
+                          <input type="button" value="Browse..." onclick="davBrowse ('f_dav');" />
                        		  <![CDATA[
-                              control.vc_add_attribute ('onclick', 'javascript: davBrowse (''f_dav'');');
+                    		    <script type="text/javascript">
+                              OAT.Loader.load(['dav'], function(){OAT.WebDav.init(davOptions);});
+                    		    </script>
                   			    ]]>
-                  			  </v:after-data-bind>
-                  		  </v:button>
 		                  </td>
 		                </tr>
                   </vm:if>
@@ -3128,6 +3267,7 @@
                       </vm:if>
                   </vm:if>
                   <vm:if test="self.i_source = 3">
+                      <vm:if test="exists (select 1 from LDAP..LDAP_SERVERS where LS_USER_ID = self.account_id)">
                     <tr>
                       <th width="30%">
                         LDAP server
@@ -3171,6 +3311,7 @@
               	        </v:data-list>
               	      </td>
               	    </tr>
+                      </vm:if>
                     <tr>
 		                  <th width="30%">
                         Host URL
@@ -3254,7 +3395,7 @@
 	            </div>
 
 	            <div class="new-form-footer">
-                <v:button action="simple" name="i3_back" value="Back" xhtml_class="form-button">
+                  <v:button action="simple" name="i2_back" value="Back" xhtml_class="form-button">
 	                <v:on-post>
 	                  <![CDATA[
                       self.abStep := AB.WA.pop (self.abSteps);
@@ -3262,7 +3403,7 @@
 	                  ]]>
 	                </v:on-post>
 	              </v:button>
-                  <v:button action="simple" name="i3_next" value="Next" xhtml_class="form-button">
+                  <v:button action="simple" name="i2_next" value="Next" xhtml_class="form-button">
 	                <v:on-post>
 	                  <![CDATA[
                         declare tmp, host varchar;
@@ -3284,12 +3425,7 @@
                         {
                           self.i_data := trim(get_keyword ('f_file', params, ''));
                           if (is_empty_or_null (self.i_data))
-                          {
-	                        self.vc_error_message := 'Please select file from your local file system!';
-	                        self.vc_is_valid := 0;
-	                        return;
-	                      }
-
+                            signal ('TEST', 'Please select file from your local file system!');
                         }
                         else if (self.i_source = 1)
                         {
@@ -3297,22 +3433,14 @@
                           tmp := http_physical_path_resolve (replace (self.f_dav.ufl_value, ' ', '%20'));
                           self.i_data := AB.WA.dav_content (AB.WA.host_url () || tmp, AB.WA.account_name (self.account_id));
                           if (isnull(self.i_data))
-                          {
-	                        self.vc_error_message := 'Bad import source!';
-	                        self.vc_is_valid := 0;
-	                        return;
-	                      }
-
+                            signal ('TEST', 'Bad import source!');
                         }
                         else if (self.i_source = 2)
                         {
                         self.f_uri.ufl_value := trim(self.f_uri.ufl_value);
                           if (is_empty_or_null (self.f_uri.ufl_value))
-                          {
-                          self.vc_error_message := 'Please select correct URL address!';
-                          self.vc_is_valid := 0;
-                          return;
-                        }
+                            signal ('TEST', 'Please select correct URL address!');
+
                           if (self.i_type = 1)
                           {
                             AB.WA.test (self.i_limit.ufl_value, vector('name', 'Grab Limit', 'class', 'integer', 'minValue', 1, 'maxValue', 100));
@@ -3338,20 +3466,21 @@
 
                       	declare exit handler for sqlstate '*'
                       	{
-                      	  self.vc_error_message := 'Unknown LDAP server. Please, check parameters!';
-                      	  self.vc_is_valid := 0;
-                      	  return;
+                            signal ('TEST', 'Unknown LDAP server. Please, check parameters!');
                       	};
                         connection_set ('LDAP_VERSION', 2);
                       	host := 'ldap://' || self.i_lHost || ':' || self.i_lPort;
                         self.i_data := ldap_search (host, 0, self.i_lBase_dn, self.i_lSearch, self.i_lBind_dn, self.i_lPassword);
 	                    }
 
+                        self.i_number := 0;
                         if (self.i_type = 1)
                         {
                           AB.WA.ab_graph_delete (self.i_iri);
                           self.i_iri := AB.WA.ab_graph_create ();
-                          self.i_Items := AB.WA.import_foaf_content (self.i_data, case when (self.i_source = 2) then 1 else 0 end, self.i_iri, self.i_contentDepth, self.i_contentLimit, self.i_contentFollow);
+                          self.i_Items := AB.WA.import_foaf_content (self.i_data, vector ('contentType', case when (self.i_source = 2) then 1 else 0 end, 'contentIRI', self.i_iri, 'contentDepth', self.i_contentDepth, 'contentLimit', self.i_contentLimit, 'contentFollow', self.i_contentFollow));
+
+                          self.i_number := length (self.i_Items);
                       }
                         else if (self.i_type = 2)
                         {
@@ -3360,23 +3489,39 @@
                         self.i_data := replace (self.i_data, '\015', '\012');
                         self.i_data := replace (self.i_data, '\012 ', '');
                         self.i_data := split_and_decode (self.i_data, 0, '\0\0\n');
+
+                          self.i_number := AB.WA.import_count (self.i_type, self.i_data);
                       }
+                        else
+                        {
+                          self.i_number := AB.WA.import_count (self.i_type, self.i_data);
+                        }
+                        if (self.i_number = 0)
+                          signal ('TEST', 'No persons founded!<>');
 
-                      self.abStep := '5';
+                        -- next step
                       if (self.i_type = 0)
-                        self.abStep := '6';
-                      if (self.i_type = 1)
+                        {
+                          self.abStep := '5';
+                        }
+                        else if (self.i_type = 1)
+                        {
+                          self.abStep := '3';
+                        }
+                        else
+                        {
                         self.abStep := '4';
-                      AB.WA.push (self.abSteps, '3');
+                        }
+
+                        AB.WA.push (self.abSteps, '2');
                       self.vc_data_bind(e);
 	                  ]]>
 	                </v:on-post>
 	              </v:button>
-                <v:button action="simple" name="i3_cancel" value="Cancel" xhtml_class="form-button">
+                  <v:button action="simple" name="i2_cancel" value="Cancel" xhtml_class="form-button">
 	                <v:on-post>
 	                  <![CDATA[
-	                    self.abAction := 'browse';
-                      self.resetImport ();
+                        self.resetImport (0);
 	                    self.vc_data_bind(e);
 	                  ]]>
 	                </v:on-post>
@@ -3384,22 +3529,12 @@
 	            </div>
 	          </v:template>
 
-              <v:template name="t11" type="simple" enabled="-- case when (self.abStep = '4') then 1 else 0 end">
+              <v:template name="t11" type="simple" enabled="-- case when (self.abStep = '3') then 1 else 0 end">
 	            <div class="new-form-header">
-                <v:label format="%s" value="Import: Select persons" />
+                  Import: Select persons
               </div>
 
               <div class="new-form-mapping">
-                <?vsp
-                  declare N integer;
-
-                  if (length (self.i_Items) = 0)
-                  {
-                ?>
-          		  No Persons
-                <?vsp
-                  } else {
-                ?>
                   <table id="foaf" class="AB_grid" style="border-width: 0" cellspacing="0">
                   <thead class="sortHeader">
                     <tr>
@@ -3409,39 +3544,49 @@
                       <th>Name</th>
                       <th>Mail</th>
                       <th>Comment</th>
+                        <th class="checkbox last-child" width="1%" style="border-width: 0px 0px 1px 0px;">
+                          <input type="checkbox" name="cb_all_ping" value="Select All" onclick="selectAllCheckboxes(this, 'cb_ping')" />
+                        </th>
+                        <th width="1%">Ping</th>
                         <th width="1%">Action</th>
                     </tr>
                   </thead>
                 <?vsp
-                    for (N := 0; N < length (self.i_Items); N := N + 1)
+                      foreach (any item in self.i_Items) do
                     {
                 ?>
-              	  <tr class="<?V case when (self.i_Items[N][0] = 1) then 'tr_select' else '' end ?>">
+                    <tr class="<?V case when (item[0] = 1) then 'tr_select' else '' end ?>">
               		  <td width="1%">
                       <?vsp
-                        if (self.i_Items[N][0] = 0)
-                          http (sprintf ('<input type="checkbox" name="cb_item" value="%s" onclick="selectCheck(this, \'cb_item\')" />', self.i_Items[N][1]));
+                          if (item[0] = 0)
+                            http (sprintf ('<input type="checkbox" name="cb_item" value="%s" onclick="selectCheck(this, \'cb_item\')" />', item[1]));
                       ?>
               		  </td>
               		  <td>
-                        <?V AB.WA.utf2wide (self.i_Items[N][2]) ?>
+                        <?V AB.WA.utf2wide (item[2]) ?>
               		  </td>
               		  <td>
-                      <?V self.i_Items[N][3] ?>
+                        <?V item[3] ?>
               		  </td>
               		  <td>
                       <?vsp
-                          if (self.i_Items[N][0] = 1)
+                          if (item[0] = 1)
                           {
                           http ('FOAF Owner');
-                          http (sprintf ('<input type="hidden" name="cb_item" value="%s" />', self.i_Items[N][1]));
+                            http (sprintf ('<input type="hidden" name="cb_item" value="%s" />', item[1]));
                         }
                       ?>
               		  </td>
+                      <td width="1%" colspan="2">
+                        <?vsp
+                          if (item[1] not like 'nodeID://%')
+                            http (sprintf ('<input type="checkbox" name="cb_ping" value="%s" onclick="selectCheck(this, \'cb_ping\')" />', item[1]));
+                        ?>
+                      </td>
               		  <td>
                       <?vsp
-                        if (not is_empty_or_null (self.i_Items[N][3]))
-                            http (self.windowOpen (sprintf ('invite.vspx?name=%U&mail=%U', self.i_Items[N][2], self.i_Items[N][3]), 'invite', self.i_Items[N][2]));
+                          if (not is_empty_or_null (item[3]))
+                            http (self.windowOpen (sprintf ('invite.vspx?name=%U&mail=%U', item[2], item[3]), 'invite', item[2]));
                       ?>
               		  </td>
                   </tr>
@@ -3449,9 +3594,6 @@
                     }
                 ?>
                 </table>
-                <?vsp
-                  }
-                ?>
               </div>
               <script>
                 <![CDATA[
@@ -3460,7 +3602,7 @@
               </script>
 
               <div class="new-form-footer">
-                <v:button action="simple" name="i4_back" value="Back" xhtml_class="form-button">
+                  <v:button action="simple" name="i3_back" value="Back" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
                       self.abStep := AB.WA.pop (self.abSteps);
@@ -3468,7 +3610,7 @@
                     ]]>
                   </v:on-post>
                 </v:button>
-                  <v:button action="simple" name="i4_next" value="Next" xhtml_class="form-button">
+                  <v:button action="simple" name="i3_next" value="Next" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
                       declare N integer;
@@ -3476,33 +3618,35 @@
 
                       params := e.ve_params;
                         self.i_contentItems := vector ();
+                        self.i_contentPings := vector ();
                       for (N := 0; N < length (params); N := N + 4)
                       {
                         if (params[N] = 'cb_item')
                             self.i_contentItems := vector_concat (self.i_contentItems, vector (vector (params[N+1])));
+                          else if (params[N] = 'cb_ping')
+                            self.i_contentPings := vector_concat (self.i_contentPings, vector (params[N+1]));
                       }
 
-                        if (length (self.i_contentItems))
-                        {
-                        self.abStep := '6';
-                        if ((self.i_type = 2) or (self.i_type = 3))
+                        self.i_number := length (self.i_contentItems);
+                        if (self.i_number)
                         {
                           self.abStep := '5';
-                        }
-                        AB.WA.push (self.abSteps, '4');
+                          if ((self.i_type = 2) or (self.i_type = 3))
+                            self.abStep := '4';
+
+                          AB.WA.push (self.abSteps, '3');
                       } else {
-                        self.abAction := 'browse';
-                        self.resetImport ();
+                          self.resetImport (0);
+                          self.abAction := 'import';
                       }
                       self.vc_data_bind(e);
                     ]]>
                   </v:on-post>
                 </v:button>
-                <v:button action="simple" name="i4_cancel" value="Cancel" xhtml_class="form-button">
+                  <v:button action="simple" name="i3_cancel" value="Cancel" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
-                      self.abAction := 'browse';
-                      self.resetImport ();
+                        self.resetImport (0);
                       self.vc_data_bind(e);
                     ]]>
                   </v:on-post>
@@ -3510,7 +3654,7 @@
               </div>
             </v:template>
 
-              <v:template name="t12" type="simple" enabled="-- case when (self.abStep = '5') then 1 else 0 end">
+              <v:template name="t12" type="simple" enabled="-- case when (self.abStep = '4') then 1 else 0 end">
               <div class="new-form-header">
 	              <v:label format="%s" value="Import: Mapping"/>
 	            </div>
@@ -3527,9 +3671,9 @@
                   </tr>
                   <?vsp
                     declare N, M integer;
-                    declare data any;
+                        declare data, options any;
 
-                      self.i_Options := LDAP..contact_fields ();
+                        options := LDAP..contact_fields ();
                       for (N := 0; N < 1; N := N + 2)
                       {
                       data := split_and_decode (self.i_data [N], 0, '\0\0,');
@@ -3540,9 +3684,9 @@
               	    <td>
               		    <?V trim (data[M], '"') ?>
               		  </td>
-              		  <td nowrap="1">
+                        <td nowrap="nowrap">
               		    <?vsp
-              		      self.render_select (cast (M as varchar));
+                            self.render_select (options, cast (M as varchar));
               		    ?>
               		  </td>
                   </tr>
@@ -3565,9 +3709,9 @@
                   </tr>
                   <?vsp
                       declare L, N, M integer;
-                    declare data any;
+                        declare data, options any;
 
-                      self.i_Options := LDAP..contact_fields ();
+                        options := LDAP..contact_fields ();
                       for (N := 0; N < length (self.i_data); N := N + 2)
                       {
                         if (self.i_data [N] = 'entry')
@@ -3582,9 +3726,9 @@
               	    <td>
               		    <?V data[M] ?>
               		  </td>
-              		  <td nowrap="1">
+                        <td nowrap="nowrap">
               		    <?vsp
-              		      self.render_select (data[M]);
+                            self.render_select (options, data[M]);
               		    ?>
               		  </td>
               		  <td>
@@ -3602,9 +3746,9 @@
                       <td>
                         <?V self.i_lMaps[M] ?>
                       </td>
-                      <td nowrap="1">
+                        <td nowrap="nowrap">
                         <?vsp
-                          self.render_select (self.i_lMaps[M]);
+                            self.render_select (options, self.i_lMaps[M]);
                         ?>
                       </td>
                       <td>
@@ -3707,7 +3851,7 @@
                 </v:button>
               </div>
 	            <div class="new-form-footer">
-                  <v:button action="simple" name="i5_back" value="Back" xhtml_class="form-button">
+                  <v:button action="simple" name="i4_back" value="Back" xhtml_class="form-button">
 	                <v:on-post>
 	                  <![CDATA[
                       self.abStep := AB.WA.pop (self.abSteps);
@@ -3715,7 +3859,7 @@
 	                  ]]>
 	                </v:on-post>
 	              </v:button>
-                  <v:button action="simple" name="i5_next" value="Next" xhtml_class="form-button">
+                  <v:button action="simple" name="i4_next" value="Next" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
                       declare N integer;
@@ -3724,20 +3868,20 @@
                       params := e.ve_params;
                       self.i_maps := vector ();
                       for (N := 0; N < length (params); N := N + 2)
+                        {
                         if (params[N] like 'sel_%' and params[N+1] <> 'skip')
                           self.i_maps := vector_concat (self.i_maps, vector (substring (params[N], 5, length (params[N])), params[N+1]));
-
-                      self.abStep := '6';
-                      AB.WA.push (self.abSteps, '5');
+                        }
+                        self.abStep := '5';
+                        AB.WA.push (self.abSteps, '4');
                       self.vc_data_bind(e);
                     ]]>
                   </v:on-post>
                 </v:button>
-                <v:button action="simple" name="i5_cancel" value="Cancel" xhtml_class="form-button">
+                  <v:button action="simple" name="i4_cancel" value="Cancel" xhtml_class="form-button">
 	                <v:on-post>
 	                  <![CDATA[
-	                    self.abAction := 'browse';
-                      self.resetImport ();
+                        self.resetImport (0);
                       self.vc_data_bind(e);
 	                  ]]>
 	                </v:on-post>
@@ -3750,7 +3894,7 @@
               </script>
 	          </v:template>
 
-              <v:template name="t14" type="simple" enabled="-- case when (self.abStep = '6') then 1 else 0 end">
+              <v:template name="t14" type="simple" enabled="-- case when (self.abStep = '5') then 1 else 0 end">
 	            <div class="new-form-header">
 	              <v:label format="%s" value="Import: Options"/>
 	            </div>
@@ -3768,32 +3912,124 @@
                     <?vsp self.myTags ('i_tags'); ?>
                   <tr>
                     <th valign="top">
-                      Validation Fields
+                        Sharing
+                      </th>
+                      <td>
+                        <fieldset>
+                          <legend><b>ODS users</b></legend>
+                          <table class="form-body" cellspacing="0">
+                            <tr>
+                              <td style="width: 95%; background-color: white;">
+                                <table id="f_tbl" width="100%" cellspacing="0">
+                                  <thead class="sortHeader">
+                                    <tr>
+                                      <th width="100%">Value</th>
+                                      <th width="50px">Action</th>
+                                    </tr>
+                                  </thead>
+                                  <tr id="f_tr_no"><td colspan="2"><b>No Shares</b></td></tr>
+                            		</table>
+                            	</td>
+                              <td valign="top" nowrap="nowrap">
+                                <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('f', null, {fld_1: {mode: 1, form: 'F1', tdCssText: 'white-space: nowrap;'}});" />
+                              </td>
+                            </tr>
+                          </table>
+                        </fieldset>
+                        <fieldset>
+                          <legend><b>WebID users</b></legend>
+                          <table class="form-body" cellspacing="0">
+                            <tr>
+                              <td style="width: 95%; background-color: white;">
+                                <table id="s_tbl" width="100%" cellspacing="0">
+                                  <thead class="sortHeader">
+                                    <tr>
+                                      <th width="15%">Type</th>
+                                      <th>Value</th>
+                                      <th width="1%" nowrap="nowrap">ACL: (R)ead, (W)rite</th>
+                                      <th width="50px">Action</th>
+                                    </tr>
+                                  </thead>
+                            		  <![CDATA[
+                            		    <script type="text/javascript">
+                                    <?vsp
+                                      declare N, L integer;
+                                      declare acl, aType, aAccess any;
+
+                                      L := 0;
+                                      acl := (select WAI_ACL from DB.DBA.WA_INSTANCE where WAI_ID = self.domain_id);
+                                      acl := case when isnull (acl) then vector () else deserialize (acl) end;
+                                      for (N := 0; N < length (acl); N := N + 1)
+                                      {
+                                        L := L + 1;
+                                        http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}, fld_4: {value: "Inherited"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
+                                      }
+                                    ?>
+                            		    </script>
+                            		  ]]>
+                                  <tr id="s_tr_no" style="display: <?V case when L=0 then '' else 'none' end ?>;"><td colspan="4"><b>No Shares</b></td></tr>
+                            		</table>
+                            	</td>
+                              <td valign="top" nowrap="nowrap">
+                                <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 50, onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: 'F1', tdCssText: 'white-space: nowrap;', className: '_validate_ _webid_'}, fld_3: {mode: 52, value: [1, 0, 0], tdCssText: 'width: 1%; white-space: nowrap; text-align: center;'}});" />
+                              </td>
+                            </tr>
+                          </table>
+                        </fieldset>
+                      </td>
+                    </tr>
+                    <tr>
+                      <th valign="top">
+                        Duplicate entries mode
+                      </th>
+                      <td>
+                        <label>
+                          <?vsp http(sprintf('<input type="radio" name="i_validationMode" id="i_validationMode_0" value="merge" %s />', case when (self.i_validationMode = 'merge') then 'checked="checked"' else '' end)); ?> Merge
+                        </label>
+                        <br />
+                        <label>
+                          <?vsp http(sprintf('<input type="radio" name="i_validationMode" id="i_validationMode_1" value="override" %s />', case when (self.i_validationMode = 'override') then 'checked="checked"' else '' end)); ?>  Override
+                        </label>
+                        <br />
+                        <label>
+                          <?vsp http(sprintf('<input type="radio" name="i_validationMode" id="i_validationMode_2" value="skip" %s />', case when (self.i_validationMode = 'skip') then 'checked="checked"' else '' end)); ?>  Skip
+                        </label>
+                        <br />
+                        <label>
+                          <?vsp http(sprintf('<input type="radio" name="i_validationMode" id="i_validationMode_3" value="ask" %s />', case when (self.i_validationMode = 'ask') then 'checked="checked"' else '' end)); ?> Ask
+                        </label>
+                      </td>
+                    </tr>
+                    <tr>
+                      <th valign="top">
+                        Specify fields to identify entries
                     </th>
                     <td>
-                        <div style="height: 400px; overflow: auto;">
+                        <div style="height: 250px; overflow: auto;">
                         <table cellspacing="0" style="background-color: #fff;">
                           <?vsp
-                            declare N integer;
+                              declare N, M integer;
                             declare data, fields any;
 
                             data := coalesce ((select deserialize (LV_FIELDS) from LDAP..LDAP_VALIDATION where LV_USER_ID = self.account_id), vector());
                             fields := LDAP..contact_fields ();
-                              for (N := 0; N < length (fields); N := N + 2)
+                              M := length (fields) / 2;
+                              for (N := 0; N < M; N := N + 2)
                               {
                       	  ?>
                       	  <tr>
                       	    <td width="1%">
-                      	      <?vsp
-                                declare S varchar;
-
-                                  S := case when (get_keyword(fields[N], data, '') <> '') then 'checked="checked"' else '' end;
-                                http (sprintf ('<input type="checkbox" %s name="cb_item" value="%s"', S, fields[N]));
-                              ?>
+        	                      <?vsp http (sprintf ('<input type="checkbox" %s name="cb_item" value="%s"', case when (get_keyword (fields[N], data, '') <> '') then 'checked="checked"' else '' end, fields[N])); ?>
                       		  </td>
-                      		  <td >
+                              <td width="50%">
                       		    <?V fields[N+1] ?>
                       		  </td>
+                              <td width="1%">
+        	                      <?vsp http (sprintf ('<input type="checkbox" %s name="cb_item" value="%s"', case when (get_keyword (fields[M+N], data, '') <> '') then 'checked="checked"' else '' end, fields[M+N])); ?>
+                              </td>
+                              <td width="50%">
+                                <?V fields[M+N+1] ?>
+                              </td>
                           </tr>
                       	  <?vsp
                             }
@@ -3806,7 +4042,7 @@
 	            </div>
 
 	            <div class="new-form-footer">
-                  <v:button action="simple" name="i6_back" value="Back" xhtml_class="form-button">
+                  <v:button action="simple" name="i5_back" value="Back" xhtml_class="form-button">
 	                <v:on-post>
 	                  <![CDATA[
                       self.abStep := AB.WA.pop (self.abSteps);
@@ -3814,10 +4050,10 @@
 	                  ]]>
 	                </v:on-post>
 	              </v:button>
-                  <v:button action="simple" name="i6_import" value="Import" xhtml_class="form-button">
+                  <v:button action="simple" name="i5_import" value="Import" xhtml_class="form-button">
 			            <v:on-post>
 			              <![CDATA[
-                      declare N integer;
+                        declare N, M integer;
                       declare tmp, params any;
 
                         declare exit handler for SQLSTATE '*'
@@ -3830,6 +4066,7 @@
                         }
                         resignal;
                       };
+                        params := e.ve_params;
 
                       -- test tags value
                       self.v_tags := trim (self.i_tags.ufl_value);
@@ -3838,53 +4075,140 @@
                       tmp := AB.WA.vector_unique (tmp);
                       self.v_tags := AB.WA.vector2tags (tmp);
 
-                      params := e.ve_params;
+                        self.i_validationMode := get_keyword ('i_validationMode', params, 'ask');
                       self.i_validation := vector ();
+                        self.v_grants := '';
+                        self.v_acl := '';
                         for (N := 0; N < length (params); N := N + 4)
                         {
                         if (params[N] = 'cb_item')
+                          {
                           self.i_validation := vector_concat (self.i_validation, vector (params[N+1]));
                       }
+                          else if ((params [N] like 'f_fld_1_%') and (trim (params [N+1]) <> ''))
+                          {
+                            tmp := split_and_decode (trim (params[N+1]), 0, '\0\0,');
+                            for (M := 0; M < length (tmp); M := M + 1)
+                            {
+                              if (not isnull (AB.WA.account_id (trim (tmp[M]))))
+                                self.v_grants := self.v_grants || ',' || tmp[M];
+                            }
+                          }
+                        }
+                        self.v_grants := trim (self.v_grants, ',');
+                        tmp  := DB.DBA.wa_acl_params (params);
+                        if (length (tmp))
+                          self.v_acl := serialize (tmp);
+
+                        self.abStep := '6';
+                        self.vc_data_bind(e);
+                       ]]>
+                     </v:on-post>
+                  </v:button>
+                  <v:button action="simple" name="i5_cancel" value="Cancel" xhtml_class="form-button">
+                    <v:on-post>
+                      <![CDATA[
+                        self.resetImport (0);
+                        self.vc_data_bind(e);
+                      ]]>
+                    </v:on-post>
+                  </v:button>
+                </div>
+              </v:template>
+
+              <v:template name="t13" type="simple" enabled="-- case when (self.abStep = '6') then 1 else 0 end">
+                <?vsp
+                  declare options any;
 
-			                -- vCard
+                  options := vector ();
                       if (self.i_type = 0)
+                  {
+                    -- vCard
                           if (self.i_source = 2)
                           {
-                            AB.WA.import_vcard2 (self.domain_id, self.i_data, vector ('tags', self.v_tags), self.i_validation, 2);
+                      options := vector ('tags', self.v_tags, 'mode', 2);
                           } else {
-                          AB.WA.import_vcard (self.domain_id, self.i_data, vector ('tags', self.v_tags), self.i_validation);
+                      options := vector ('tags', self.v_tags);
                           }
-
-
+                  }
+                  else if (self.i_type = 1)
+                  {
 			                -- FOAF
-                      if (self.i_type = 1)
-                          AB.WA.import_foaf (self.domain_id, self.i_data, self.v_tags, self.i_validation, 2, self.i_iri, self.i_contentItems, self.i_contentDepth, self.i_contentLimit, self.i_contentFollow);
-
+                    options := vector ('tags', self.v_tags, 'contentItems', self.i_contentItems, 'contentPings', self.i_contentPings, 'contentType', -1, 'contentIRI', self.i_iri, 'contentDepth', self.i_contentDepth, 'contentLimit', self.i_contentLimit, 'contentFollow', self.i_contentFollow);
+                  }
+                  else if (self.i_type = 2)
+                  {
 			                -- CSV
-                      if (self.i_type = 2)
-                        AB.WA.import_csv (self.domain_id, self.i_data, self.v_tags, self.i_maps, self.i_validation);
-
+                    options := vector ('tags', self.v_tags, 'maps', self.i_maps);
+                  }
+                  else if (self.i_type = 3)
+                  {
 			                -- LDAP
-                      if (self.i_type = 3)
-                        AB.WA.import_ldap (self.domain_id, self.i_data, self.v_tags, self.i_maps, self.i_validation);
+                    options := vector ('tags', self.v_tags, 'maps', self.i_maps);
+                  }
+                  else if (self.i_type = 4)
+                  {
+                    -- LinkedIn
+                    options := vector ('tags', self.v_tags);
+                  }
 
-	                    self.abAction := 'browse';
-                      self.resetImport ();
-                      self.vc_data_bind(e);
-			               ]]>
-			             </v:on-post>
-			          </v:button>
-                <v:button action="simple" name="i6_cancel" value="Cancel" xhtml_class="form-button">
+                  if (self.v_grants <> '')
+                    options := vector_concat (options, vector ('grants', self.v_grants));
+
+                  if (self.v_acl <> '')
+                    options := vector_concat (options, vector ('acls', self.v_acl));
+
+                  options := vector_concat (options, vector ('validationMode', self.i_validationMode));
+
+                  http (sprintf ('<input type="hidden" name="i_type" id="i_type" value="%V" />', encode_base64 (serialize (self.i_type))));
+                  http (sprintf ('<input type="hidden" name="i_data" id="i_data" value="%V" />', encode_base64 (serialize (self.i_data))));
+                  http (sprintf ('<input type="hidden" name="i_options" id="i_options" value="%V" />', encode_base64 (serialize (options))));
+                  http (sprintf ('<input type="hidden" name="i_validation" id="i_validation" value="%V" />', encode_base64 (serialize (self.i_validation))));
+                ?>
+                <div class="new-form-header">
+                  Import contacts
+                </div>
+                <div class="new-form-body">
+                  <span id="progressMax" style="display: none;"><?V self.i_number ?></span>
+                  <table id="progressTable" cellspacing="0">
+                    <tr>
+                      <td>
+                        <div id="progressText"></div>
+                      </td>
+                    </tr>
+                    <tr>
+                      <td>
+                        <div id="progressBar"></div>
+                      </td>
+                    </tr>
+                  </table>
+                </div>
+                <div class="form-footer">
+                  <v:button action="simple" name="btn_Background" xhtml_id="btn_Background" value="Background" xhtml_class="form-button">
 	                <v:on-post>
 	                  <![CDATA[
-	                    self.abAction := 'browse';
-                      self.resetImport ();
+                        self.resetImport (1);
                       self.vc_data_bind(e);
 	                  ]]>
 	                </v:on-post>
 	              </v:button>
+                  <input type="button" id="btn_Stop" value="Stop" onclick="javascript: stopState(); return false;" xhtml_class="form-button" />
 	            </div>
+                <div id="askDiv" style="display: none;">
+                  <br />
+                  <span style="margin-left: 50px;">Select action for duplicated contact "<span id="askDiv_data">XXL</span>":</span>
+                  <br /><br />
+                  <label><input type="radio" name="i_ask" id="i_ask_0" value="merge" checked="checked" style="margin-left: 110px;" />Merge</label><br />
+                  <label><input type="radio" name="i_ask" id="i_ask_1" value="override" style="margin-left: 110px;" />Override</label><br />
+                  <label><input type="radio" name="i_ask" id="i_ask_2" value="skip" style="margin-left: 110px;" />Skip</label><br />
+                </div>
+                <script type="text/javascript">
+                  <![CDATA[
+                    OAT.MSG.attach(OAT, "PAGE_LOADED", initState);
+                  ]]>
+                </script>
 	          </v:template>
+
           </v:template>
 
             <v:template name="t17" type="simple" enabled="--case when (self.abAction = 'export') then 1 else 0 end">
@@ -3899,17 +4223,26 @@
                     <v:label for="e_format" value="Content type" />
                   </th>
                   <td>
-                    <input type="radio" name="e_format" id="e_format_0" value="vCard" checked="checked" onclick="changeExportName('e_file', ['.foaf', '.csv'], '.vcf');" /><xsl:call-template name="nbsp" /><label for="e_format_0">vCard</label>
+                      <label>
+                        <input type="radio" name="e_format" id="e_format_0" value="vCard" checked="checked" onclick="changeExportName('e_file', ['.foaf', '.csv'], '.vcf');" />
+                        vCard
+                      </label>
                   </td>
                 </tr>
                 <tr>
                   <td>
-                    <input type="radio" name="e_format" id="e_format_1" value="FOAF" onclick="changeExportName('e_file', ['.vcf', '.csv'], '.foaf');" /><xsl:call-template name="nbsp" /><label for="e_format_1">FOAF</label>
+                      <label>
+                        <input type="radio" name="e_format" id="e_format_1" value="FOAF" onclick="changeExportName('e_file', ['.vcf', '.csv'], '.foaf');" />
+                        FOAF
+                      </label>
                   </td>
                 </tr>
                 <tr>
                   <td>
-                    <input type="radio" name="e_format" id="e_format_2" value="csv" onclick="changeExportName('e_file', ['.foaf', '.vcf'], '.csv');" /><xsl:call-template name="nbsp" /><label for="e_format_2">CSV</label>
+                      <label>
+                        <input type="radio" name="e_format" id="e_format_2" value="csv" onclick="changeExportName('e_file', ['.foaf', '.vcf'], '.csv');" />
+                        CSV
+                      </label>
                   </td>
                 </tr>
                 <tr>
@@ -3976,7 +4309,7 @@
           <tr>
             <td id="LC">
               <div class="lc lc_close">
-                <span onclick="javascript: vspxPost('command', 'select', 'settings', 'mode', 'settings');" title="Settings" class="gems gems2">Settings</span>
+                <span onclick="javascript: vspxPost('command', 'select', 'settings', 'mode', '');" title="Settings" class="gems gems2">Settings</span>
                 <span onclick="javascript: vspxPost('command', 'select', 'settings', 'mode', 'categoryBrowse');" title="Categories" class="gems gems2">Categories</span>
                 <span onclick="javascript: vspxPost('command', 'select', 'settings', 'mode', 'publishBrowse');" title="Publications" class="gems gems2">Publications</span>
                 <span onclick="javascript: vspxPost('command', 'select', 'settings', 'mode', 'subscribeBrowse');" title="Subscriptions" class="gems gems2">Subscriptions</span>
@@ -4067,28 +4400,14 @@
                       <v:label for="f_chars" value="Contact name display"/>
                     </th>
                     <td>
-                      <?vsp
-                        declare S varchar;
-
-                        S := '';
-                        if (cast(get_keyword('chars', self.settings, '0') as integer) = 0)
-                          S := 'checked="checked"';
-                        http(sprintf('<input type="radio" name="r_chars" id="r_chars_0" value="0" %s />', S));
-                      ?>
+                            <?vsp http(sprintf('<input type="radio" name="r_chars" id="r_chars_0" value="0" %s />', case when (cast(get_keyword('chars', self.settings, '0') as integer) = 0) then 'checked="checked"' else '' end)); ?>
                       <xsl:call-template name="nbsp"/><vm:label for="r_chars_0" value="--'show everything'" />
                     </td>
                   </tr>
                   <tr>
                     <th />
                     <td>
-                      <?vsp
-                        declare S varchar;
-
-                        S := '';
-                        if (cast(get_keyword('chars', self.settings, '0') as integer) <> 0)
-                          S := 'checked="checked"';
-                        http(sprintf('<input type="radio" name="r_chars" id="r_chars_1" value="1" %s />', S));
-                      ?>
+                            <?vsp http(sprintf('<input type="radio" name="r_chars" id="r_chars_1" value="1" %s />', case when (cast(get_keyword('chars', self.settings, '0') as integer) = 0) then '' else 'checked="checked"' end)); ?>
                       <xsl:call-template name="nbsp"/><vm:label for="r_chars_1" value="--'show no more than'" /><xsl:call-template name="nbsp"/>
                       <v:text name="f_chars" null-value="--''" value="--get_keyword('chars', self.settings, '60')" xhtml_size="3"/>
                       <xsl:call-template name="nbsp"/><vm:label for="r_chars_1" value="--'characters'" /><xsl:call-template name="nbsp"/>
@@ -4282,7 +4601,7 @@
                   </v:template>
                   <v:template name="ds_categories_repeat" type="repeat">
 
-                    <v:template type="if-not-exists" name-to-remove="table" set-to-remove="both">
+                    <v:template name="ds_categories_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
                       <table>
                         <tr align="center">
                           <td colspan="3">No categories</td>
@@ -4496,8 +4815,26 @@
                   </v:template>
                   <v:template name="ds_exchanges_repeat" type="repeat">
 
-                    <v:template type="if-not-exists" name-to-remove="table" set-to-remove="both">
+                    <v:template name="ds_exchanges_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
                       <table>
+                        <tr align="center">
+                          <td colspan="5">
+                            <?vsp
+                              if (self.abSubAction = 'publishBrowse')
+                              {
+                                http ('No publications');
+                              }
+                              else if (self.abSubAction = 'subscribeBrowse')
+                              {
+                                http ('No subscriptions');
+                              }
+                              else
+                              {
+                                http ('No SyncMLs');
+                              }
+                            ?>
+                          </td>
+                        </tr>
                       </table>
                     </v:template>
 
@@ -4740,15 +5077,12 @@
                       <td>
                         <v:text name="exc_options_name" xhtml_id="exc_options_name" value="--get_keyword ('name', self.ve_options)" xhtml_size="60" />
                         <vm:if test="self.abSubAction not in ('syncmlCreate', 'syncmlUpdate')">
-                        <v:button action="browse" value="Browse..." name="exc_options_name_button" xhtml_id="exc_options_name_button">
-                          <v:after-data-bind>
+                          <input type="button" id="exc_options_name_button" value="Browse..." onclick="davBrowse ('exc_options_name');" style="display: <?V case when (get_keyword ('type', self.ve_options, 1) <> 1) then 'none' else '' end ?>" />
                             <![CDATA[
-                              control.vc_add_attribute ('onclick', 'javascript: davBrowse (''exc_options_name'');');
-                                if (get_keyword ('type', self.ve_options, 1) <> 1)
-                                  control.vc_add_attribute ('style', 'display: none');
+                    		    <script type="text/javascript">
+                              OAT.Loader.load(['dav'], function(){OAT.WebDav.init(davOptions);});
+                    		    </script>
                             ]]>
-                          </v:after-data-bind>
-                        </v:button>
                         </vm:if>
                       </td>
                     </tr>
diff --git a/appsrc/ODS-Addressbook/www/image/add_16.png b/appsrc/ODS-Addressbook/www/image/add_16.png
deleted file mode 100644
index ad76487..0000000
Binary files a/appsrc/ODS-Addressbook/www/image/add_16.png and /dev/null differ
diff --git a/appsrc/ODS-Addressbook/www/image/del_16.png b/appsrc/ODS-Addressbook/www/image/del_16.png
deleted file mode 100644
index 9691957..0000000
Binary files a/appsrc/ODS-Addressbook/www/image/del_16.png and /dev/null differ
diff --git a/appsrc/ODS-Addressbook/www/invite.vspx b/appsrc/ODS-Addressbook/www/invite.vspx
index 66560af..d5c2b73 100644
--- a/appsrc/ODS-Addressbook/www/invite.vspx
+++ b/appsrc/ODS-Addressbook/www/invite.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: invite.vspx,v 1.3 2008/03/24 17:33:54 source Exp $
+ -  $Id: invite.vspx,v 1.3.2.1 2010/09/20 10:14:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Addressbook/www/js/ab.js b/appsrc/ODS-Addressbook/www/js/ab.js
index b0cd491..337c362 100644
--- a/appsrc/ODS-Addressbook/www/js/ab.js
+++ b/appsrc/ODS-Addressbook/www/js/ab.js
@@ -19,19 +19,22 @@
  *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  *
 */
+function setFooter() {
+  if ($('ab_main')) {
+    var wDims = OAT.Dom.getViewport()
+    var hDims = OAT.Dom.getWH('FT')
+    var cPos = OAT.Dom.position('ab_main')
+    $('ab_main').style.height = (wDims[1] - hDims[1] - cPos[1] - 20) + 'px';
+  }
+}
+
 function urlParam(fldName)
 {
-  var O = document.forms[0].elements[fldName];
-  if (O && O.value != '')
-    return '&' + fldName + '=' + encodeURIComponent(O.value);
-  return '';
-}
+  var obj = document.forms[0].elements[fldName];
+  if (obj && obj.value != '')
+    return '&' + fldName + '=' + encodeURIComponent(obj.value);
 
-function myA(obj) {
-  if (obj.href) {
-    document.location = obj.href + '?' + urlParam('sid') + urlParam('realm');
-    return false;
-  }
+  return '';
 }
 
 function myPost(frm_name, fld_name, fld_value) {
@@ -162,12 +165,6 @@ function submitEnter(myForm, myButton, e) {
   return true;
 }
 
-function getObject(id) {
-  if (document.all)
-    return document.all[id];
-  return document.getElementById(id);
-}
-
 function getParent(obj, tag) {
   var obj = obj.parentNode;
   if (obj.tagName.toLowerCase() == tag)
@@ -199,41 +196,22 @@ function enableToolbars(objForm, prefix) {
   enableElement('tbDelete', 'tbDelete_gray', oCount>0);
 }
 
-function enableElement(id, id_gray, idFlag) {
-  var mode = 'block';
-  var element = document.getElementById(id);
-  if (element != null) {
-    if (idFlag) {
-      element.style.display = 'block';
-      mode = 'none';
+function enableElement(id, id_gray, showFlag) {
+  if (showFlag) {
+    OAT.Dom.show(id);
+    if ($(id))
+      OAT.Dom.hide(id_gray);
     } else {
-      element.style.display = 'none';
-      mode = 'block';
-    }
-  }
-  element = document.getElementById(id_gray);
-  if (element != null)
-    element.style.display = mode;
+    OAT.Dom.hide(id);
+    OAT.Dom.show(id_gray);
 }
-
-function showCell(cell) {
-  var c = getObject (cell);
-  if ((c) && (c.style.display == "none"))
-    c.style.display = "";
-}
-
-function hideCell(cell) {
-  var c = getObject(cell);
-  if ((c) && (c.style.display != "none"))
-    c.style.display = "none";
 }
 
 function selectAllCheckboxes (obj, prefix) {
   var objForm = obj.form;
   for (var i = 0; i < objForm.elements.length; i++) {
     var o = objForm.elements[i];
-		if (o != null && o.type == "checkbox" && !o.disabled
-				&& o.name.indexOf(prefix) != -1) {
+		if (o && o.type == "checkbox" && !o.disabled && o.name.indexOf(prefix) != -1) {
       if (obj.value == 'Select All')
         o.checked = true;
       else
@@ -253,8 +231,7 @@ function anySelected (form, txt, selectionMsq) {
   if ((form != null) && (txt != null)) {
     for (var i = 0; i < form.elements.length; i++) {
       var obj = form.elements[i];
-			if (obj != null && obj.type == "checkbox"
-					&& obj.name.indexOf(txt) != -1 && obj.checked)
+			if (obj && obj.type == "checkbox" && obj.name.indexOf(txt) != -1 && obj.checked)
         return true;
     }
     if (selectionMsq != null)
@@ -288,36 +265,9 @@ function showTag(tag) {
   parent.document.forms['F1'].submit();
 }
 
-//
-// sortSelect(select_object)
-//   Pass this function a SELECT object and the options will be sorted
-//   by their text (display) values
-//
-function sortSelect(box) {
-  var o = new Array();
-  for (var i=0; i<box.options.length; i++)
-		o[o.length] = new Option(box.options[i].text, box.options[i].value,
-				box.options[i].defaultSelected, box.options[i].selected);
-
-  if (o.length==0)
-    return;
-
-  o = o.sort(function(a,b) {
-		if ((a.text + "") < (b.text + "")) {
-			return -1;
-		}
-		if ((a.text + "") > (b.text + "")) {
-			return 1;
-                           }
-		return 0;
-	});
-
-  for (var i=0; i<o.length; i++)
-		box.options[i] = new Option(o[i].text, o[i].value,
-				o[i].defaultSelected, o[i].selected);
-}
-
 function showTab(tabs, tabsCount, tabNo) {
+	if (tabNo == null) { tabNo = $v('tabNo'); }
+	if (tabNo == null) { tabNo = 0; }
 	if ($(tabs)) {
 		for ( var i = 0; i < tabsCount; i++) {
       var l = $(tabs+'_tab_'+i);      // tab labels
@@ -339,94 +289,17 @@ function showTab(tabs, tabsCount, tabNo) {
 }
 
 function windowShow(sPage, width, height) {
-  if (width == null)
-    width = 500;
-  if (height == null)
+	if (!width)
+		width = 520;
+	if (!height)
     height = 420;
-	sPage = sPage + '&sid=' + document.forms[0].elements['sid'].value
-			+ '&realm=' + document.forms[0].elements['realm'].value;
-	win = window.open(sPage, null, "width=" + width + ",height=" + height
-			+ ", top=100, left=100, scrollbars=yes, resize=yes, menubar=no");
+	sPage += urlParam('sid') + urlParam('realm');
+	win = window.open(sPage, null, "width="+width+",height="+height+", top=100, left=100, scrollbars=yes, resize=yes, menubar=no");
   win.window.focus();
 }
 
-function rowSelect(obj) {
-  var submitMode = false;
-  if (window.document.F1.elements['src'])
-    if (window.document.F1.elements['src'].value.indexOf('s') != -1)
-      submitMode = true;
-  if (submitMode)
-    if (window.opener.document.F1)
-      if (window.opener.document.F1.elements['submitting'])
-        return false;
-  var closeMode = true;
-  if (window.document.F1.elements['dst'])
-    if (window.document.F1.elements['dst'].value.indexOf('c') == -1)
-      closeMode = false;
-  var singleMode = true;
-  if (window.document.F1.elements['dst'])
-    if (window.document.F1.elements['dst'].value.indexOf('s') == -1)
-      singleMode = false;
-
-  var s2 = (obj.name).replace('b1', 's2');
-  var s1 = (obj.name).replace('b1', 's1');
-
-  var myRe = /^(\w+):(\w+);(.*)?/;
-  var params = window.document.forms['F1'].elements['params'].value;
-  var myArray;
-  while(true) {
-    myArray = myRe.exec(params);
-    if (myArray == undefined)
-      break;
-    if (myArray.length > 2)
-      if (window.opener.document.F1)
-        if (window.opener.document.F1.elements[myArray[1]]) {
-          if (myArray[2] == 's1')
-            if (window.opener.document.F1.elements[myArray[1]])
-							rowSelectValue(
-									window.opener.document.F1.elements[myArray[1]],
-									window.document.F1.elements[s1],
-									singleMode, submitMode);
-          if (myArray[2] == 's2')
-            if (window.opener.document.F1.elements[myArray[1]])
-							rowSelectValue(
-									window.opener.document.F1.elements[myArray[1]],
-									window.document.F1.elements[s2],
-									singleMode, submitMode);
-        }
-    if (myArray.length < 4)
-      break;
-    params = '' + myArray[3];
-  }
-  if (submitMode) {
-    window.opener.createHidden('F1', 'submitting', 'yes');
-    window.opener.document.F1.submit();
-  }
-  if (closeMode)
-    window.close();
-}
-
-function rowSelectValue(dstField, srcField, singleMode) {
-	if (singleMode) {
-    dstField.value = srcField.value;
-  } else {
-    dstField.value = AB.trim(dstField.value);
-    dstField.value = AB.trim(dstField.value, ',');
-    dstField.value = AB.trim(dstField.value);
-		if (dstField.value.indexOf(srcField.value) == -1) {
-			if (dstField.value == '') {
-        dstField.value = srcField.value;
-      } else {
-        dstField.value = dstField.value + ',' + srcField.value;
-      }
-    }
-  }
-}
-
 function createHidden(frm_name, fld_name, fld_value) {
-  var hidden;
-
-  createHidden2(document, frm_name, fld_name, fld_value);
+	return createHidden2(document, frm_name, fld_name, fld_value);
 }
 
 function createHidden2(doc, frm_name, fld_name, fld_value) {
@@ -443,6 +316,7 @@ function createHidden2(doc, frm_name, fld_name, fld_value) {
     }
     hidden.value = fld_value;
   }
+	return hidden;
 }
 
 function changeExportName(fld_name, from, to) {
@@ -474,58 +348,6 @@ function updateChecked(obj, objName) {
   objForm.s1.value = AB.trim(objForm.s1.value, ',');
 }
 
-function addChecked(form, txt, selectionMsq) {
-  if (!anySelected (form, txt, selectionMsq, 'confirm'))
-    return;
-
-  var submitMode = false;
-  if (window.document.F1.elements['src'])
-    if (window.document.F1.elements['src'].value.indexOf('s') != -1)
-      submitMode = true;
-  if (submitMode)
-    if (window.opener.document.F1)
-      if (window.opener.document.F1.elements['submitting'])
-        return false;
-  var singleMode = true;
-  if (window.document.F1.elements['dst'])
-    if (window.document.F1.elements['dst'].value.indexOf('s') == -1)
-      singleMode = false;
-
-  var s1 = 's1';
-  var s2 = 's2';
-
-  var myRe = /^(\w+):(\w+);(.*)?/;
-  var params = window.document.forms['F1'].elements['params'].value;
-  var myArray;
-  while(true) {
-    myArray = myRe.exec(params);
-    if (myArray == undefined)
-      break;
-    if (myArray.length > 2)
-      if (window.opener.document.F1)
-        if (window.opener.document.F1.elements[myArray[1]]) {
-          if (myArray[2] == 's1')
-            if (window.opener.document.F1.elements[myArray[1]])
-							rowSelectValue(
-									window.opener.document.F1.elements[myArray[1]],
-									window.document.F1.elements[s1],
-									singleMode, submitMode);
-          if (myArray[2] == 's2')
-            if (window.opener.document.F1.elements[myArray[1]])
-							rowSelectValue(
-									window.opener.document.F1.elements[myArray[1]],
-									window.document.F1.elements[s2],
-									singleMode, submitMode);
-        }
-    if (myArray.length < 4)
-      break;
-    params = '' + myArray[3];
-  }
-  if (submitMode)
-    window.opener.document.F1.submit();
-  window.close();
-}
-
 function addTag(tag, objName) {
   var obj = document.F1.elements[objName];
   obj.value = AB.trim(obj.value);
@@ -540,6 +362,7 @@ function addTag(tag, objName) {
     obj.value = (obj.value).replace(tag+',', '');
   }
   obj.value = AB.trim(obj.value, ',');
+	return false;
 }
 
 function addCheckedTags(openerName, checkName) {
@@ -569,13 +392,13 @@ function addCheckedTags(openerName, checkName) {
 }
 
 function changeType(obj) {
-  showTab(1, 4); 
+	showTab('a', 7, 1);
   if (obj.value != "1") {
-    OAT.Dom.show ('a_tab_1');
     OAT.Dom.show ('a_tab_2');
+		OAT.Dom.show('a_tab_3');
   } else {
-    OAT.Dom.hide ('a_tab_1');
     OAT.Dom.hide ('a_tab_2');
+		OAT.Dom.hide('a_tab_3');
 }
 	var trNodes = document.getElementsByTagName("tr");
 
@@ -690,16 +513,11 @@ function updateGeodata(mode) {
   		}
   	}
 	}
-	OAT.AJAX.GET(S, '', function(arg) {
-		cb(arg, mode);
-	}, {});
+	OAT.AJAX.GET(S, '', function(arg) {cb(arg, mode);});
 }
 
 function davBrowse(fld) {
-	var options = {
-		mode : 'browser',
-		onConfirmClick : function(path, fname) {$(fld).value = path + fname;}
-                };
+	var options = {mode: 'browser', onConfirmClick: function(path, fname) {$(fld).value = path + fname;}};
   OAT.WebDav.open(options);
 }
 
@@ -761,14 +579,170 @@ function destinationChange(obj, actions) {
   }
 }
 
-var AB = new Object();
+function urlParam(fldName)
+{
+  var O = document.forms[0].elements[fldName];
+  if (O && O.value != '')
+    return '&' + fldName + '=' + encodeURIComponent(O.value);
+  return '';
+}
 
-AB.trim = function(sString, sChar) {
+// progress bar
+var progressTimer = null;
+var progressPollTimer = null;
+var progressID = null;
+var progressMax = null;
+var progressSize = 40;
+var progressInc = 100 / progressSize;
+
+function stopState()
+{
+  progressTimer = null;
+  var x = function (data) {
+    doPost ('F1', 'btn_Background');
+  }
+  OAT.AJAX.POST('ajax.vsp', "a=load&sa=stop&id="+progressID+urlParam("sid")+urlParam("realm"), x, {async: false});
+}
+
+function initState()
+{
+  progressTimer = null;
+  var x = function (data) {
+    try {
+      var xml = OAT.Xml.createXmlDoc(data);
+      progressID = OAT.Xml.textValue(xml.getElementsByTagName('id')[0]);
+    } catch (e) {}
+
+    createProgressBar();
+    progressTimer = setTimeout("checkState()", 500);
 
+    document.forms['F1'].action = 'home.vspx';
+  }
+  OAT.AJAX.POST('ajax.vsp', "a=load&sa=init"+urlParam("sid")+urlParam("realm")+urlParam("i_type")+urlParam("i_data")+urlParam("i_options")+urlParam("i_validation"), x, {async: false});
+}
+
+function checkState()
+{
+  var x = function (data) {
+    var progressIndex;
+    try {
+      var xml = OAT.Xml.createXmlDoc(data);
+      progressIndex = OAT.Xml.textValue(xml.getElementsByTagName('index')[0]);
+    } catch (e) { }
+
+    showProgress (progressIndex);
+
+    if ((progressIndex != null) && (progressIndex != progressMax)) {
+      setTimeout("checkState()", 500);
+      if (!progressPollTimer) {
+        var progressPoll = xml.getElementsByTagName('poll')[0];
+        if (progressPoll) {
+          var progressPollAction = OAT.Xml.textValue(progressPoll.getElementsByTagName('action')[0]);
+          if (progressPollAction == 'ask') {
+            progressPollTimer = setTimeout("checkPollState()", 2000);
+            var progressPollData = OAT.Xml.textValue(progressPoll.getElementsByTagName('data')[0]);
+            if (!askDialog) {
+              askDialog = new OAT.Dialog("Select action", "askDiv", {width:400, resize:0, buttons: 1, modal:1});
+              OAT.Dom.show('askDiv');
+            }
+            OAT.MSG.attach(askDialog, "DIALOG_OK", function() {
+              askDialog.hide();
+              var pollValue = '';
+              if ($('i_ask_0').checked)
+                pollValue = 'answer:merge';
+              if ($('i_ask_1').checked)
+                pollValue = 'answer:override';
+              if ($('i_ask_2').checked)
+                pollValue = 'answer:skip';
+              OAT.AJAX.POST('ajax.vsp', "a=load&sa=poll&id="+progressID+'&value='+pollValue+urlParam("sid")+urlParam("realm"), function(){});
+              progressPollTimer = null;
+              askprogressPollTimer = null;
+            });
+            $('askDiv_data').innerHTML = progressPollData;
+            askDialog.show();
+          }
+        }
+      }
+    } else {
+      progressTimer = null;
+      progressPollTimer = null;
+      $('btn_Stop').click();
+    }
+  }
+  OAT.AJAX.POST('ajax.vsp', "a=load&sa=state&id="+progressID+urlParam("sid")+urlParam("realm"), x);
+}
+
+function checkPollState()
+{
+  var x = function (data) {
+    if (progressTimer && progressPollTimer)
+      setTimeout("checkPollState()", 2000);
+  }
+  OAT.AJAX.POST('ajax.vsp', "a=load&sa=poll&id="+progressID+urlParam("sid")+urlParam("realm"), x);
+}
+
+function createProgressBar()
+{
+  progressMax = $('progressMax').innerHTML;
+  var centerCellName;
+  var tableText = "";
+  var tdText = "";
+  for (x = 0; x < progressSize; x++) {
+    if (progressMax != null) {
+      if (x == (progressSize/2))
+        centerCellName = "progress_" + x;
+    }
+    tableText += "<td id=\"progress_" + x + "\" width=\"" + progressInc + "%\" height=\"20\" bgcolor=\"blue\" />";
+  }
+  var idiv = $("progressText");
+  if (idiv)
+    idiv.innerHTML = "Imported 0 contacts from " + progressMax;
+  var idiv = $("progressBar");
+  if (idiv)
+    idiv.innerHTML = "<table with=\"200\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>" + tableText + "</tr></table>";
+  centerCell = $(centerCellName);
+}
+
+function showProgress (progressIndex)
+{
+  if (!progressMax)
+    return;
+
+  if (!progressIndex)
+    progressIndex = progressMax;
+
+  var idiv = $("progressText");
+  if (idiv)
+    idiv.innerHTML = "Imported " + progressIndex + " contacts from " + progressMax;
+  var percentage = 100;
+  if (progressMax != 0)
+    percentage = Math.round (progressIndex * 100 / progressMax);
+  var percentageText = "";
+  if (percentage < 10)
+  {
+    percentageText = " " + percentage;
+  } else {
+    percentageText = percentage;
+  }
+  centerCell.innerHTML = "<font color=\"white\">" + percentageText + "%</font>";
+  for (x = 0; x < progressSize; x++)
+  {
+    var cell = $("progress_" + x);
+    if ((cell) && (percentage/x < progressInc))
+    {
+      cell.style.backgroundColor = "blue";
+    } else {
+      cell.style.backgroundColor = "red";
+    }
+  }
+}
+
+var AB = new Object();
+AB.trim = function(sString, sChar) {
 	if (sString) {
-		if (sChar == null) {
+		if (!sChar)
       sChar = ' ';
-    }
+
 		while (sString.substring(0, 1) == sChar) {
       sString = sString.substring(1, sString.length);
     }
@@ -780,7 +754,7 @@ AB.trim = function(sString, sChar) {
 }
 
 AB.getFOAFData = function(iri) {
-  var S = '/ods/api/user.getFOAFData?foafIRI='+encodeURIComponent(iri);
+	var S = '/ods/api/user.getFOAFData?spongerMode=1&foafIRI=' + encodeURIComponent(iri);
   var x = function(data) {
     var o = null;
     try {
@@ -789,9 +763,10 @@ AB.getFOAFData = function(iri) {
 			o = null;
 		}
 		if (o && o.iri) {
-			if (confirm('New data for \'' + o.iri + '\' is founded. Do you like to fill in the corresponding fields?')) {
+			if (confirm('New data for \'' + o.iri + '\' is founded. Would you like to import discovered data into the corresponding contact details fields?')) {
+				AB.setFOAFValue(o.personalProfileDocument, 'ab_foaf');
         AB.setFOAFValue(o.iri, 'ab_iri');
-				AB.setFOAFValue(o.nickName, 'ab_name');
+				AB.setFOAFValue(o.nick, 'ab_name');
 				AB.setFOAFValue(o.title, 'ab_title');
         AB.setFOAFValue(o.name, 'ab_fullName');
         AB.setFOAFValue(o.firstName, 'ab_fName');
@@ -822,27 +797,23 @@ AB.getFOAFData = function(iri) {
         }
         // intersts
 				if (o.interest) {
-          var S = o.interest.split ("\n");
-					for ( var i = 0; i < S.length; i++) {
-            var T = S[i].split(";");
-						if (T.length > 0 && T[0].length > 0) {
-              if (T.length == 1)
-                T.push('');
-							TBL.createRow('a', null, {
-								fld1 : {
-								  mode : 0,
-									value : T[0],
-									className : '_validate_ _url_',
-									onBlur : function() {
-										AB.validateField(this);
-									}
-								},
-								fld2 : {
-								  mode : 0,
-									value : T[1]
-								}
-							});
+					for (var i = 0; i < o.interest.length; i++) {
+						TBL.createRow('a',
+						              null,
+						              {fld_1 : {value: o.interest[i].value, className: '_validate_ _url_', onBlur: function() {validateField(this);}},
+								           fld_2 : {value: o.interest[i].label}
+								          }
+								         );
+					}
+				}
+				if (o.knows) {
+					for (var i = 0; i < o.knows.length; i++) {
+						TBL.createRow('b',
+						              null,
+                          {fld_1: {mode: 20, value: 'foaf:knows', className: "_validate_"},
+                           fld_2: {value: o.knows[i].value, className: "_validate_ _uri_"}
       }
+                         );
     }
   }
       }
@@ -850,14 +821,7 @@ AB.getFOAFData = function(iri) {
       alert('No data founded for \''+iri+'\'');
     }
   }
-	OAT.AJAX.GET(S, '', x, {
-		onstart : function() {
-			OAT.Dom.show('ab_import_image')
-		},
-		onend : function() {
-			OAT.Dom.hide('ab_import_image')
-		}
-	});
+	OAT.AJAX.GET(S, '', x, {onstart : function() {OAT.Dom.show('ab_import_image')}, onend : function() {OAT.Dom.hide('ab_import_image')}});
 }
 
 AB.setFOAFValue = function(fValue, fName) {
@@ -906,10 +870,8 @@ AB.aboutDialog = function() {
   }
 	OAT.AJAX.POST("ajax.vsp", "a=about", x, {
 		type : OAT.AJAX.TYPE_TEXT,
-		onstart : function() {
-		},
-		onerror : function() {
-		}
+		onstart : function() {},
+		onerror : function() {}
 	});
 }
 
@@ -932,55 +894,3 @@ AB.getFileName = function(from, to) {
   }
   to.value = S;
 }
-
-AB.validateError = function(fld, msg) {
-  alert(msg);
-	setTimeout(function() {
-		fld.focus();
-	}, 1);
-  return false;
-}
-
-AB.validateMail = function(fld) {
-  if ((fld.value.length == 0) || (fld.value.length > 40))
-		return AB.validateError(fld,
-				'E-mail address cannot be empty or longer then 40 chars');
-
-  var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
-  if (!regex.test(fld.value))
-    return AB.validateError(fld, 'Invalid E-mail address');
-
-  return true;
-}
-
-AB.validateURL = function(fld) {
-  var regex = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
-  if (!regex.test(fld.value))
-    return AB.validateError(fld, 'Invalid URL address');
-
-  return true;
-}
-
-AB.validateField = function(fld) {
-  if ((fld.value.length == 0) && OAT.Dom.isClass(fld, '_canEmpty_'))
-    return true;
-  if (OAT.Dom.isClass(fld, '_mail_'))
-    return AB.validateMail(fld);
-  if (OAT.Dom.isClass(fld, '_url_'))
-    return AB.validateURL(fld);
-  return true;
-}
-
-AB.validateInputs = function(fld) {
-  var retValue = true;
-  var form = fld.form;
-	for (i = 0; i < form.elements.length; i++) {
-    var fld = form.elements[i];
-		if (OAT.Dom.isClass(fld, '_validate_')) {
-      retValue = AB.validateField(fld);
-      if (!retValue)
-        return retValue;
-    }
-  }
-  return retValue;
-}
diff --git a/appsrc/ODS-Addressbook/www/message.vspx b/appsrc/ODS-Addressbook/www/message.vspx
index e483b64..1e0fd63 100644
--- a/appsrc/ODS-Addressbook/www/message.vspx
+++ b/appsrc/ODS-Addressbook/www/message.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: message.vspx,v 1.1 2008/04/30 10:40:17 source Exp $
+ -  $Id: message.vspx,v 1.1.2.1 2010/09/20 10:14:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Addressbook/www/search.vspx b/appsrc/ODS-Addressbook/www/search.vspx
index 732ca0e..dd02021 100644
--- a/appsrc/ODS-Addressbook/www/search.vspx
+++ b/appsrc/ODS-Addressbook/www/search.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: search.vspx,v 1.15.2.5 2010/07/09 14:37:00 source Exp $
+ -  $Id: search.vspx,v 1.15.2.9 2010/11/11 12:37:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -37,7 +37,7 @@
       self.v_tags := AB.WA.vector2tags (tmp);
 
       params := self.vc_page.vc_event.ve_params;
-      if (not (self.account_role in ('public', 'guest')) and not isnull (get_keyword ('f_tags', params)))
+      if (not (self.account_rights = 'public') and not isnull (get_keyword ('f_tags', params)))
         self.v_own := cast (get_keyword ('f_own', params, '0') as integer);
       self.v_shared := self.f_shared.ufl_selected;
     ]]>
@@ -90,7 +90,7 @@
         }
         return;
       }
-      if (self.v_mode not in ('simple', 'opensearch'))
+      if (self.v_mode in ('simple', 'opensearch'))
       {
         AB.WA.xml_set('MyContacts', data, 1);
       } else {
@@ -104,7 +104,7 @@
 
       state := '00000';
       sqlParams := vector();
-      sql := AB.WA.search_sql (self.domain_id, self.account_id, data, self.v_max);
+      sql := AB.WA.search_sql (self.domain_id, self.account_id, self.account_rights, data, self.v_max);
       sql := concat (sql, ' order by ', self.v_order, ' ', self.v_direction);
       exec(sql, state, msg, sqlParams, 0, meta, result);
       if (state = '00000')
@@ -193,7 +193,7 @@
   </v:after-data-bind>
   <v:before-render>
     <![CDATA[
-      self.F1.uf_action := AB.WA.page_url (self.domain_id, 'search.vspx');
+      self.F1.uf_action := AB.WA.utf2wide (AB.WA.page_url (self.domain_id, 'search.vspx'));
     ]]>
   </v:before-render>
   <vm:pagetitle>Search results</vm:pagetitle>
@@ -254,7 +254,6 @@
           self.v_category := cast (get_keyword ('f_category', params, get_keyword ('category', params, self.v_category)) as integer);
 
           -- options
-          if (not (self.account_role in ('public', 'guest')) and not isnull (get_keyword ('f_tags', params)))
             self.v_own := cast (get_keyword ('f_own', params, '0') as integer);
           self.v_shared := self.f_shared.ufl_selected;
 
@@ -460,7 +459,6 @@
                     <v:text name="f_tags" value="--self.v_tags" fmt-function="AB.WA.utf2wide" xhtml_class="textbox" xhtml_size="60"/>
                   </td>
                 </tr>
-                <vm:if test="not (self.account_role in ('public', 'shared'))">
                   <tr>
                     <th/>
                     <td>
@@ -478,7 +476,6 @@
                       <v:data-list name="f_category" xhtml_id="f_category" value="--self.v_category" sql="select -1 as C_ID, ' Select category ... ' as C_NAME from WS.WS.SYS_DAV_USER where U_NAME = 'dav' union all select C_ID, C_NAME from AB.WA.CATEGORIES where C_DOMAIN_ID = self.domain_id order by C_NAME" key-column="C_ID" value-column="C_NAME" xhtml_class="select"/>
                     </td>
                   </tr>
-                </vm:if>
                 <tr>
                   <th/>
                   <td>
@@ -542,7 +539,7 @@
           <v:button action="simple" name="s_cancel" value="Cancel" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
-                self.vc_redirect (AB.WA.page_url (self.domain_id));
+                self.vc_redirect (AB.WA.utf2wide (AB.WA.page_url (self.domain_id)));
               ]]>
             </v:on-post>
           </v:button>
@@ -564,14 +561,7 @@
                 <v:button action="simple" style="url" value="Advanced" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
-                      self.vc_is_valid := 1;
-                      self.v_step := 0;
-                      self.v_mode := 'advanced';
-                      self.v_own   := 1;
-                      self.ds_data := vector();
-                      self.ds_meta := vector();
-                      self.ds_tags := vector();
-                      self.vc_data_bind(e);
+                      self.vc_redirect (AB.WA.utf2wide (AB.WA.page_url (self.domain_id, 'search.vspx?mode=advanced')));
                     ]]>
                   </v:on-post>
                 </v:button>
@@ -579,7 +569,7 @@
                 <v:button action="simple" style="url" value="Cancel" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
-                      self.vc_redirect (AB.WA.page_url (self.domain_id));
+                      self.vc_redirect (AB.WA.utf2wide (AB.WA.page_url (self.domain_id)));
                     ]]>
                   </v:on-post>
                 </v:button>
diff --git a/appsrc/ODS-Addressbook/www/tags.vspx b/appsrc/ODS-Addressbook/www/tags.vspx
index bde3ae1..0f91f72 100644
--- a/appsrc/ODS-Addressbook/www/tags.vspx
+++ b/appsrc/ODS-Addressbook/www/tags.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: tags.vspx,v 1.2.2.1 2010/02/10 22:17:03 source Exp $
+ -  $Id: tags.vspx,v 1.2.2.2 2010/09/20 10:14:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Addressbook/www/template/popup.vspx b/appsrc/ODS-Addressbook/www/template/popup.vspx
index 79199b8..4855d3c 100644
--- a/appsrc/ODS-Addressbook/www/template/popup.vspx
+++ b/appsrc/ODS-Addressbook/www/template/popup.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
-  -  $Id: popup.vspx,v 1.7.2.4 2010/03/12 09:12:04 source Exp $
+  -  $Id: popup.vspx,v 1.7.2.8 2011/03/23 12:17:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -29,35 +29,19 @@
     <link rel="stylesheet" href="css/conversation.css" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <![CDATA[
+      <script type="text/javascript" src="/ods/oat/loader.js"></script>
       <script type="text/javascript">
-        var toolkitPath="/ods/oat";
-        var imagePath="/ods/images/oat/";
+        OAT.Preferences.imagePath = '/ods/images/oat/';
+        OAT.Preferences.showAjax = false;
 
-        var featureList=["json", "dialog", "combolist", "quickedit", "dav"];
+        var featureList=["json", "dialog", "combolist", "quickedit"];
+        OAT.Loader.load(featureList);
       </script>
-      <script type="text/javascript" src="/ods/oat/loader.js"></script>
       <script type="text/javascript" src="/ods/tbl.js"></script>
       <script type="text/javascript" src="js/ab.js"></script>
-      <script type="text/javascript" src="js/conversation.js"></script>
       <script type="text/javascript">
         function myInit()
         {
-          OAT.Preferences.imagePath = '/ods/images/oat/';
-          OAT.Preferences.showAjax = false;
-
-        	/* load stylesheets */
-        	OAT.Style.include("grid.css");
-        	OAT.Style.include("webdav.css");
-
-          // WebDAV
-          var options = { imagePath: OAT.Preferences.imagePath,
-                          pathHome: '/home/',
-                          path: '<?V AB.WA.dav_logical_home (self.account_id) ?>',
-                          user: '<?V AB.WA.account_name (self.account_id) ?>',
-                          connectionHeaders: {Authorization: '<?V AB.WA.account_basicAuthorization (self.account_id) ?>'}
-                        };
-          OAT.WebDav.init(options);
-
           // init tabs
           showTab('a', 2, 0);
         }
@@ -72,10 +56,7 @@
       <vm:variables>
         <v:variable persist="0" name="domain_id" type="integer" default="-1"/>
         <v:variable persist="0" name="account_id" type="integer" default="-1"/>
-        <v:variable persist="0" name="account_role" type="varchar" default="'public'"/>
-        <v:variable persist="0" name="accountName" type="varchar" default="'Public User'"/>
-        <v:variable persist="0" name="owner_id" type="integer" default="null" />
-        <v:variable persist="0" name="ownerName" type="varchar" default="null" />
+        <v:variable persist="0" name="account_rights" type="varchar" default="''"/>
         <v:variable persist="0" name="settings" type="any" />
       </vm:variables>
       <v:on-init>
@@ -88,11 +69,8 @@
 
           aSessInfo := AB.WA.session_restore (params);
           self.domain_id := cast(get_keyword('domain_id', aSessInfo, '-1') as integer);
-          self.account_id := cast(get_keyword('user_id', aSessInfo, '-1') as integer);
-          self.account_role := get_keyword('user_role', aSessInfo, '');
-          self.accountName := get_keyword('user_name', aSessInfo, '');
-          self.owner_id := AB.WA.domain_owner_id (self.domain_id);
-          self.ownerName := AB.WA.domain_owner_name (self.domain_id);
+          self.account_id := cast (get_keyword ('account_id', aSessInfo, '-1') as integer);
+          self.account_rights := get_keyword ('account_rights', aSessInfo, '');
           self.settings := AB.WA.settings (self.domain_id);
         ]]>
       </v:on-init>
diff --git a/appsrc/ODS-Addressbook/www/template/template.vspx b/appsrc/ODS-Addressbook/www/template/template.vspx
index c7125c2..94f8923 100644
--- a/appsrc/ODS-Addressbook/www/template/template.vspx
+++ b/appsrc/ODS-Addressbook/www/template/template.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: template.vspx,v 1.26.2.6 2010/04/09 14:40:03 source Exp $
+ -  $Id: template.vspx,v 1.26.2.12 2011/03/23 12:17:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -45,39 +45,42 @@
     <meta name="dc.title" content="<?V AB.WA.utf2wide (AB.WA.domain_description (self.domain_id)) ?>" />
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <![CDATA[
+      <script type="text/javascript" src="/ods/oat/loader.js"></script>
       <script type="text/javascript">
-        // OAT
-        var toolkitPath="/ods/oat";
-        var imagePath="/ods/images/oat/";
+        OAT.Preferences.imagePath = '/ods/images/oat/';
+        OAT.Preferences.stylePath = '/ods/oat/styles/';
+        OAT.Preferences.showAjax = false;
+
+        // DAV
+        var davOptions = {
+          imagePath: OAT.Preferences.imagePath,
+          pathHome: '/home/',
+          path: '<?V AB.WA.dav_logical_home (self.account_id) ?>',
+          user: '<?V AB.WA.account_name (self.account_id) ?>',
+          connectionHeaders: {Authorization: '<?V AB.WA.account_basicAuthorization (self.account_id) ?>'}
+        };
+
+      	/* load stylesheets */
+      	OAT.Style.include("grid.css");
+      	OAT.Style.include("webdav.css");
+      	OAT.Style.include("winms.css");
         
-        var featureList=["ajax", "json", "anchor", "dimmer", "dialog", "dav", "panelbar", "combolist", "calendar"];
+        var featureList=["ajax", "json", "anchor", "dimmer", "dialog", "panelbar", "combolist", "calendar"];
+        OAT.Loader.load(featureList);
       </script>
-      <script type="text/javascript" src="/ods/oat/loader.js"></script>
       <script type="text/javascript" src="/ods/tbl.js"></script>
-      <script type="text/javascript" src="js/ab.js"></script>
       <script type="text/javascript" src="/ods/app.js"></script>
+      <script type="text/javascript" src="/ods/validate.js"></script>
+      <script type="text/javascript" src="js/ab.js"></script>
       <script type="text/javascript">
+        // publicas
+        var askDialog;
+
         function myInit() {
           if (!OAT._loaded) {
             setTimeout(myInit, 50);
             return;
           }
-          OAT.Preferences.imagePath = '/ods/images/oat/';
-          OAT.Preferences.stylePath = '/ods/oat/styles/';
-          OAT.Preferences.showAjax = false;
-
-        	/* load stylesheets */
-        	OAT.Style.include("grid.css");
-        	OAT.Style.include("webdav.css");
-
-          // WebDAV
-          var options = { imagePath: OAT.Preferences.imagePath,
-                          pathHome: '/home/',
-                          path: '<?V AB.WA.dav_logical_home (self.account_id) ?>',
-                          user: '<?V AB.WA.account_name (self.account_id) ?>',
-                          connectionHeaders: {Authorization: '<?V AB.WA.account_basicAuthorization (self.account_id) ?>'}
-                        };
-          OAT.WebDav.init(options);
 
           // <a>++
           OAT.Anchor.imagePath = OAT.Preferences.imagePath;
@@ -87,56 +90,56 @@
             generateAPP('app_area', {appActivation: "<?V case when cast (get_keyword ('app', self.settings, '1') as integer) = 2 then 'hover' else 'click' end ?>"});
             
       		// init tabs
-          showTab('a', 4, 0);
+          showTab('a', 7);
           showTab('s', 2, 0);
 
+          setFooter();
+
         	/* panelbar_content */
-          if ($('panelbar'))
-          {
-            var pcHeight = 497;
-            var pcSelect = "";
-            if ($("abSubAction"))
-              pcSelect = $v("abSubAction");
+          if ($('panelbar')) {
+            var dims = OAT.Dom.getWH('ab_main')
+            var pcHeight = dims[1];
+         	  $('panelbar').style.height = pcHeight + "px";
+            var pcSelect = $v("abSubAction");
             var pcIndex = -1;
             var pcSelectIndex = -1;
-          	var pb = new OAT.Panelbar("panelbar", 0, 500, true);
+          	var pb = new OAT.Panelbar("panelbar", 0, pcHeight+3, true);
           	var pc_1 = $('pc_1');
+          	var pc_2 = $('pc_2');
+          	var pc_3 = $('pc_3');
+            pcHeight -= 3;
             if (pc_1)
-            {
-          	  pb.addPanel("pb_1","pc_1");
           	  pcHeight -= 22;
+            if (pc_2)
+          	  pcHeight -= 22;
+            if (pc_3)
+          	  pcHeight -= 22;
+            if (pc_1) {
+          	  pc_1.style.height = pcHeight + "px";
+          	  pb.addPanel("pb_1","pc_1");
               pcIndex += 1;
               if (pcSelect == "gems")
                 pcSelectIndex = pcIndex;
           	}
-          	var pc_2 = $('pc_2');
-            if (pc_2)
-            {
+            if (pc_2) {
+          	  pc_2.style.height = pcHeight + "px";
             	pb.addPanel("pb_2","pc_2");
-          	  pcHeight -= 22;
               pcIndex += 1;
               if (pcSelect == "category")
                 pcSelectIndex = pcIndex;
           	}
-          	var pc_3 = $('pc_3');
-            if (pc_3)
-            {
+            if (pc_3) {
+          	  pc_3.style.height = pcHeight + "px";
             	pb.addPanel("pb_3","pc_3");
-          	  pcHeight -= 22;
               pcIndex += 1;
               if (pcSelect == "tags")
                 pcSelectIndex = pcIndex;
           	}
-            if (pc_1)
-          	  pc_1.style.height = pcHeight + "px";
-            if (pc_2)
-          	  pc_2.style.height = pcHeight + "px";
-            if (pc_3)
-          	  pc_3.style.height = pcHeight + "px";
             if (pcSelectIndex == -1)
               pcSelectIndex = pcIndex;
           	pb.go(pcSelectIndex);
           }
+          window.onresize = function() {setFooter();}
           OAT.MSG.send(OAT, 'PAGE_LOADED');
         }
         OAT.MSG.attach(OAT, 'PAGE_LOADED2', myInit);
@@ -149,10 +152,7 @@
     <v:page xmlns:v="http://www.openlinksw.com/vspx/">
         <v:variable persist="0" name="domain_id" type="integer" default="-1" />
         <v:variable persist="0" name="account_id" type="integer" default="-1" />
-        <v:variable persist="0" name="account_role" type="varchar" default="'public'" />
-        <v:variable persist="0" name="accountName" type="varchar" default="'Public User'" />
-      <v:variable persist="0" name="owner_id" type="integer" default="null" />
-      <v:variable persist="0" name="ownerName" type="varchar" default="null" />
+      <v:variable persist="0" name="account_rights" type="varchar" default="''" />
         <v:variable persist="0" name="settings" type="any" />
       <v:on-init>
         <![CDATA[
@@ -164,11 +164,8 @@
 
           aSessInfo := AB.WA.session_restore (params);
           self.domain_id := cast(get_keyword('domain_id', aSessInfo, '-1') as integer);
-          self.account_id := cast(get_keyword('user_id', aSessInfo, '-1') as integer);
-          self.account_role := get_keyword('user_role', aSessInfo, '');
-          self.accountName := get_keyword('user_name', aSessInfo, '');
-          self.owner_id := AB.WA.domain_owner_id (self.domain_id);
-          self.ownerName := AB.WA.domain_owner_name (self.domain_id);
+          self.account_id := cast (get_keyword ('account_id', aSessInfo, '-1') as integer);
+          self.account_rights := get_keyword ('account_rights', aSessInfo);
           self.settings := vector_concat (vector ('app', DB.DBA.WA_USER_APP_ENABLE (self.account_id)), AB.WA.settings (self.domain_id));
 
           self.vc_add_attribute ('xmlns:foaf', 'http://xmlns.com/foaf/0.1/');
diff --git a/appsrc/ODS-Addressbook/www/template/template.xsl b/appsrc/ODS-Addressbook/www/template/template.xsl
index 4947d14..c383759 100644
--- a/appsrc/ODS-Addressbook/www/template/template.xsl
+++ b/appsrc/ODS-Addressbook/www/template/template.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: template.xsl,v 1.16.2.4 2010/07/09 14:37:00 source Exp $
+ -  $Id: template.xsl,v 1.16.2.9 2010/11/09 20:11:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -109,8 +109,7 @@
     </xsl:for-each>
     <div style="padding: 0.5em;">
       <div style="padding: 0 0 0.5em 0;">
-        &nbsp;<a href="#" onClick="javascript: if (opener != null) opener.focus(); window.close();"><img src="image/close_16.png" border="0" alt="Close" title="Close" />&nbsp;Close</a>
-        <hr />
+        <span class="button pointer" onclick="javascript: if (opener != null) opener.focus(); window.close();"><img class="button" src="/ods/images/icons/close_16.png" border="0" alt="Close" title="Close" /> Close</span>
       </div>
       <v:form name="F1" type="simple" method="POST">
         <xsl:apply-templates select="vm:pagebody" />
@@ -147,7 +146,7 @@
       <xsl:copy-of select="."/>
     </xsl:for-each>
     <xsl:apply-templates select="vm:init"/>
-    <v:form name="F1" method="POST" type="simple" action="--AB.WA.forum_iri(self.domain_id)" xhtml_enctype="multipart/form-data">
+    <v:form name="F1" method="POST" type="simple" action="--AB.WA.utf2wide (AB.WA.iri_fix(AB.WA.forum_iri(self.domain_id)))" xhtml_enctype="multipart/form-data">
       <ods:ods-bar app_type='AddressBook'/>
       <div id="app_area" style="clear: right;">
       <div style="background-color: #fff;">
@@ -169,7 +168,7 @@
                       params := e.ve_params;
                       q := trim (get_keyword ('q', params, ''));
                       S := case when q <> ''then sprintf ('&q=%s&step=1', q) else '' end;
-                      self.vc_redirect (AB.WA.page_url (self.domain_id, sprintf ('search.vspx?mode=%s%s', get_keyword ('select', params, 'advanced'), S)));
+                      self.vc_redirect (AB.WA.utf2wide (AB.WA.page_url (self.domain_id, sprintf ('search.vspx?mode=%s%s', get_keyword ('select', params, 'advanced'), S))));
                       self.vc_data_bind(e);
                      ]]>
               </v:on-post>
@@ -179,10 +178,10 @@
             ?>
             <div style="float: right; text-align: right; padding-right: 0.5em; padding-top: 20px;">
               <v:text name="q" value="" fmt-function="AB.WA.utf2wide" xhtml_onkeypress="javascript: if (checkNotEnter(event)) return true; vspxPost(\'searchHead\', \'select\', \'simple\'); return false;"/>
-              <xsl:call-template name="nbsp"/>
-              <v:url url="--AB.WA.page_url (self.domain_id, 'search.vspx?mode=simple', self.sid, self.realm)" xhtml_onclick="javascript: vspxPost(\'searchHead\', \'select\', \'simple\'); return false;" value="Search" xhtml_title="simple Search" />
+              &nbsp;
+              <a href="<?vsp http (AB.WA.utf2wide (AB.WA.page_url (self.domain_id, 'search.vspx?mode=simple', self.sid, self.realm))); ?>" onclick="vspxPost('searchHead', 'select', 'simple'); return false;" title="Simple Search">Search</a>
             |
-              <v:url url="--AB.WA.page_url (self.domain_id, 'search.vspx?mode=advanced', self.sid, self.realm)" xhtml_onclick="javascript: vspxPost(\'searchHead\', \'select\', \'advanced\'); return false;" value="Advanced" xhtml_title="Advanced Search" />
+              <a href="<?vsp http (AB.WA.utf2wide (AB.WA.page_url (self.domain_id, 'search.vspx?mode=advanced', self.sid, self.realm))); ?>" onclick="vspxPost('searchHead', 'select', 'advanced'); return false;" title="Advanced">Advanced</a>
           </div>
         </v:template>
       </div>
@@ -191,11 +190,11 @@
             <?vsp http (AB.WA.utf2wide (AB.WA.banner_links (self.domain_id, self.sid, self.realm))); ?>
           </div>
           <div style="float: right; padding-right: 0.5em;">
-        <v:template type="simple" enabled="--case when (self.account_role in ('public', 'guest')) then 0 else 1 end">
-              <v:url url="--AB.WA.page_url (self.domain_id, 'home.vspx?action=settings', self.sid, self.realm)" value="Preferences" xhtml_title="Preferences"/>
+            <vm:if test="self.account_rights = 'W'">
+              <a href="<?vsp http (AB.WA.utf2wide (AB.WA.page_url (self.domain_id, 'home.vspx?action=settings', self.sid, self.realm))); ?>" title="Preferences">Preferences</a>
               |
-        </v:template>
-            <a href="--AB.WA.page_url (self.domain_id, 'about.vsp')" onclick="javascript: AB.aboutDialog(); return false;" title="About">About</a>
+            </vm:if>
+            <a href="<?vsp http (AB.WA.utf2wide (AB.WA.page_url (self.domain_id, 'about.vsp'))); ?>" onclick="javascript: AB.aboutDialog(); return false;" title="About">About</a>
       </div>
           <p style="clear: both; line-height: 0.1em"></p>
         </div>
@@ -215,7 +214,11 @@
           </td>
         </tr>
       </table>
-      <div id="FT">
+        <?vsp
+          declare C any;
+          C := vsp_ua_get_cookie_vec(self.vc_event.ve_lines);
+        ?>
+        <div id="FT" style="display: <?V case when get_keyword ('interface', C, '') = 'js' then 'none' else '' end ?>">
         <div id="FT_L">
           <a href="http://www.openlinksw.com/virtuoso">
             <img alt="Powered by OpenLink Virtuoso Universal Server" src="image/virt_power_no_border.png" border="0" />
@@ -403,16 +406,4 @@
     </div>
   </xsl:template>
 
-  <!--=========================================================================-->
-  <xsl:template name="nbsp">
-    <xsl:param name="count" select="1"/>
-    <xsl:if test="$count != 0">
-      <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
-      <xsl:call-template name="nbsp">
-        <xsl:with-param name="count" select="$count - 1"/>
-      </xsl:call-template>
-    </xsl:if>
-  </xsl:template>
-  <!--=========================================================================-->
-
 </xsl:stylesheet>
diff --git a/appsrc/ODS-Addressbook/www/users.vspx b/appsrc/ODS-Addressbook/www/users.vspx
index 7fd0be2..37ac682 100644
--- a/appsrc/ODS-Addressbook/www/users.vspx
+++ b/appsrc/ODS-Addressbook/www/users.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: users.vspx,v 1.6.2.2 2010/02/10 22:17:03 source Exp $
+ -  $Id: users.vspx,v 1.6.2.3 2010/09/20 10:14:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Addressbook/xslt/rss2atom.xsl b/appsrc/ODS-Addressbook/xslt/rss2atom.xsl
index 9b84425..641213c 100644
--- a/appsrc/ODS-Addressbook/xslt/rss2atom.xsl
+++ b/appsrc/ODS-Addressbook/xslt/rss2atom.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom.xsl,v 1.2.2.1 2010/05/31 21:59:14 source Exp $
+ -  $Id: rss2atom.xsl,v 1.2.2.2 2010/09/20 10:14:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Addressbook/xslt/rss2atom03.xsl b/appsrc/ODS-Addressbook/xslt/rss2atom03.xsl
index 6b44e64..2505311 100644
--- a/appsrc/ODS-Addressbook/xslt/rss2atom03.xsl
+++ b/appsrc/ODS-Addressbook/xslt/rss2atom03.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom03.xsl,v 1.2 2007/05/10 10:43:26 source Exp $
+ -  $Id: rss2atom03.xsl,v 1.2.2.1 2010/09/20 10:14:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Addressbook/xslt/rss2rdf.xsl b/appsrc/ODS-Addressbook/xslt/rss2rdf.xsl
index 091003c..6556b06 100644
--- a/appsrc/ODS-Addressbook/xslt/rss2rdf.xsl
+++ b/appsrc/ODS-Addressbook/xslt/rss2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
-  -  $Id: rss2rdf.xsl,v 1.2 2007/05/10 10:43:26 source Exp $
+  -  $Id: rss2rdf.xsl,v 1.2.2.1 2010/09/20 10:14:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Addressbook/xslt/rss2xbel.xsl b/appsrc/ODS-Addressbook/xslt/rss2xbel.xsl
index df4d147..59a9eeb 100644
--- a/appsrc/ODS-Addressbook/xslt/rss2xbel.xsl
+++ b/appsrc/ODS-Addressbook/xslt/rss2xbel.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -  
-  -  $Id: rss2xbel.xsl,v 1.1 2007/03/22 14:41:42 source Exp $
+  -  $Id: rss2xbel.xsl,v 1.1.2.1 2010/09/20 10:14:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/Makefile.am b/appsrc/ODS-Blog/Makefile.am
index 524a98e..e2d15e3 100644
--- a/appsrc/ODS-Blog/Makefile.am
+++ b/appsrc/ODS-Blog/Makefile.am
@@ -69,8 +69,17 @@ EXTRA_DIST = \
 	templates/columns_clean/*.vspx \
 	templates/default/*.css \
 	templates/default/*.vspx \
+	templates/digital_bazaar/*.css \
+	templates/digital_bazaar/*.vspx \
+	templates/digital_bazaar/images/*.jpg \
+	templates/digital_bazaar/images/*.png \
+	templates/micro/*.css \
+	templates/micro/*.vspx \
 	templates/modern/*.css \
 	templates/modern/*.vspx \
+	templates/newspaper_view/*.css \
+	templates/newspaper_view/*.vspx \
+	templates/newspaper_view/images/*.png \
 	templates/openlink/*.css \
 	templates/openlink/*.vspx \
 	templates/openlink_classic/*.css \
diff --git a/appsrc/ODS-Blog/Makefile.in b/appsrc/ODS-Blog/Makefile.in
index bc267dd..d0d0767 100644
--- a/appsrc/ODS-Blog/Makefile.in
+++ b/appsrc/ODS-Blog/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
@@ -331,8 +332,17 @@ EXTRA_DIST = \
 	templates/columns_clean/*.vspx \
 	templates/default/*.css \
 	templates/default/*.vspx \
+	templates/digital_bazaar/*.css \
+	templates/digital_bazaar/*.vspx \
+	templates/digital_bazaar/images/*.jpg \
+	templates/digital_bazaar/images/*.png \
+	templates/micro/*.css \
+	templates/micro/*.vspx \
 	templates/modern/*.css \
 	templates/modern/*.vspx \
+	templates/newspaper_view/*.css \
+	templates/newspaper_view/*.vspx \
+	templates/newspaper_view/images/*.png \
 	templates/openlink/*.css \
 	templates/openlink/*.vspx \
 	templates/openlink_classic/*.css \
diff --git a/appsrc/ODS-Blog/atom_pub.sql b/appsrc/ODS-Blog/atom_pub.sql
index 7237ab9..2eaa139 100644
--- a/appsrc/ODS-Blog/atom_pub.sql
+++ b/appsrc/ODS-Blog/atom_pub.sql
@@ -1,5 +1,5 @@
 --
---  $Id: atom_pub.sql,v 1.3 2006/08/14 14:33:14 source Exp $
+--  $Id: atom_pub.sql,v 1.3.2.1 2010/09/20 10:14:42 source Exp $
 --
 --  Atom publishing protocol support.
 --
diff --git a/appsrc/ODS-Blog/blog.sql b/appsrc/ODS-Blog/blog.sql
index 9bf4a53..167c022 100644
--- a/appsrc/ODS-Blog/blog.sql
+++ b/appsrc/ODS-Blog/blog.sql
@@ -1,5 +1,5 @@
 --
---  $Id: blog.sql,v 1.20.2.3 2010/06/25 11:13:04 source Exp $
+--  $Id: blog.sql,v 1.20.2.7 2010/12/07 10:59:24 source Exp $
 --
 --  Blogger API support.
 --
@@ -430,10 +430,24 @@ blog2_exec_no_error ('create table BLOG_POST_LINKS (
       PL_POST_ID varchar,
       PL_LINK varchar,
       PL_TITLE varchar,
+      PL_PING int default 0,
       foreign key (PL_BLOG_ID, PL_POST_ID) references SYS_BLOGS (B_BLOG_ID, B_POST_ID) on delete cascade,
       primary key (PL_BLOG_ID, PL_POST_ID, PL_LINK)
       )');
 
+blog2_add_col('BLOG.DBA.BLOG_POST_LINKS', 'PL_PING', 'int default 0');
+
+blog2_exec_no_error ('create table BLOG_COMMENT_LINKS (
+      CL_BLOG_ID varchar,
+      CL_POST_ID varchar,
+      CL_CID	int,
+      CL_LINK varchar,
+      CL_TITLE varchar,
+      CL_PING int default 0,
+      foreign key (CL_BLOG_ID, CL_POST_ID) references SYS_BLOGS (B_BLOG_ID, B_POST_ID) on delete cascade,
+      primary key (CL_BLOG_ID, CL_POST_ID, CL_CID, CL_LINK)
+      )');
+
 blog2_exec_no_error ('create table BLOG_POST_ENCLOSURES (
       PE_BLOG_ID varchar,
       PE_POST_ID varchar,
@@ -1469,6 +1483,9 @@ BLOG_VER_UPGRADE ();
 create procedure BLOG_ADD_LINKS (in blogid varchar, in postid varchar, inout content any)
 {
   declare xt, xp any;
+  declare tit, href, cls any;
+  declare me, blog_iri, _inst varchar;
+
   delete from BLOG_POST_LINKS where PL_BLOG_ID = blogid and PL_POST_ID = postid;
   if (content is null)
     return;
@@ -1479,10 +1496,24 @@ create procedure BLOG_ADD_LINKS (in blogid varchar, in postid varchar, inout con
   xp := xpath_eval ('//a[starts-with (@href,"http") and not(img)]', xt, 0);
   foreach (any elm in xp) do
     {
-      declare tit, href any;
       tit := cast (xpath_eval ('string()', elm) as varchar);
       href := cast (xpath_eval ('@href', elm) as varchar);
-      insert soft BLOG_POST_LINKS (PL_BLOG_ID,PL_POST_ID,PL_LINK,PL_TITLE) values (blogid,postid,href,tit);
+      cls := cast (xpath_eval ('@class', elm) as varchar);
+      insert soft BLOG_POST_LINKS (PL_BLOG_ID,PL_POST_ID,PL_LINK,PL_TITLE, PL_PING) values (blogid,postid,href,tit, 
+	  case when cls = 'auto-href' then 1 else 0 end);
+    }
+  xp := xpath_eval ('//a[starts-with (@href,"http") and not(img) and @class = "auto-href"]', xt, 0);
+  me := sioc..blog_post_iri (blogid, postid);
+  _inst := (select BI_WAI_NAME from BLOG..SYS_BLOG_INFO where BI_BLOG_ID = blogid);
+  blog_iri := sioc..blog_iri (_inst);
+  -- do this conditionally
+  if (exists (select 1 from SEMPING..PING_RULES where PR_IRI = blog_iri))    
+    {
+      foreach (any elm in xp) do
+	{
+	  href := cast (xpath_eval ('@href', elm) as varchar);
+	  SEMPING..CLI_PING (me, href);
+	}
     }
 };
 
@@ -1499,6 +1530,44 @@ create procedure BLOG_LINKS_UPGRADE ()
 
 BLOG_LINKS_UPGRADE ();
 
+create procedure BLOG_ADD_COMMENT_LINKS (in blogid varchar, in postid varchar, in cid int, inout content any)
+{
+  declare xt, xp any;
+  declare tit, href, cls any;
+  declare me, blog_iri, _inst varchar;
+
+  delete from BLOG_COMMENT_LINKS where CL_BLOG_ID = blogid and CL_POST_ID = postid and CL_CID = cid;
+  if (content is null)
+    return;
+  else if (isentity (content))
+    xt := content;
+  else
+    xt := xtree_doc (content, 2, '', 'UTF-8');
+  xp := xpath_eval ('//a[starts-with (@href,"http") and not(img)]', xt, 0);
+  foreach (any elm in xp) do
+    {
+      tit := cast (xpath_eval ('string()', elm) as varchar);
+      href := cast (xpath_eval ('@href', elm) as varchar);
+      cls := cast (xpath_eval ('@class', elm) as varchar);
+      insert soft BLOG_COMMENT_LINKS (CL_BLOG_ID,CL_POST_ID, CL_CID, CL_LINK,CL_TITLE, CL_PING) values (blogid,postid,cid,href,tit, 
+	  case when cls = 'auto-href' then 1 else 0 end);
+    }
+  xp := xpath_eval ('//a[starts-with (@href,"http") and not(img) and @class = "auto-href"]', xt, 0);
+  me := sioc..blog_comment_iri (blogid, postid, cid);
+  _inst := (select BI_WAI_NAME from BLOG..SYS_BLOG_INFO where BI_BLOG_ID = blogid);
+  blog_iri := sioc..blog_iri (_inst);
+  -- do this conditionally
+  if (0 and exists (select 1 from SEMPING..PING_RULES where PR_IRI = blog_iri))    
+    {
+      foreach (any elm in xp) do
+	{
+	  href := cast (xpath_eval ('@href', elm) as varchar);
+	  SEMPING..CLI_PING (me, href);
+	}
+    }
+};
+
+
 create procedure BLOG_ENCL_UPGRADE ()
 {
   if (registry_get ('__BLOG_ENCL_UPGRADE_done') = 'done')
@@ -1585,7 +1654,7 @@ create trigger BLOG_COMMENTS_NO_I after insert on BLOG_COMMENTS referencing new
   declare is_spam, published int;
   declare mid, rfc, refs, comment_title varchar;
   declare oid_sig, oid_is_valid int;
-  declare post_iri varchar;
+  declare post_iri, body varchar;
 
   blogid := N.BM_BLOG_ID;
   postid := N.BM_POST_ID;
@@ -1603,6 +1672,9 @@ create trigger BLOG_COMMENTS_NO_I after insert on BLOG_COMMENTS referencing new
       into opts, owner, home, title, orgblogid, refs from BLOG..SYS_BLOG_INFO, BLOG..SYS_BLOGS
       where B_POST_ID = N.BM_POST_ID and B_BLOG_ID = BI_BLOG_ID;
 
+  body := BLOG.DBA.CONTENT_ANNOTATE (owner, N.BM_COMMENT);
+  BLOG_ADD_COMMENT_LINKS (orgblogid, postid, id, body);
+
   comment_title := 'Re:' || title;
 
   if (N.BM_REF_ID)
@@ -1692,7 +1764,7 @@ own_comm:;
 skip:
   set triggers off;
   update BLOG..BLOG_COMMENTS set BM_IS_PUB = published, BM_IS_SPAM = is_spam, BM_POSTED_VIA = domain, BM_BLOG_ID = orgblogid,
-	 BM_RFC_ID = mid, BM_RFC_HEADER = rfc, BM_TITLE = comment_title, BM_RFC_REFERENCES = refs
+	 BM_RFC_ID = mid, BM_RFC_HEADER = rfc, BM_TITLE = comment_title, BM_RFC_REFERENCES = refs, BM_COMMENT = body
       where BM_BLOG_ID = blogid and BM_POST_ID = postid and BM_ID = id;
   set triggers on;
 ret:
@@ -1738,6 +1810,7 @@ create trigger BLOG_COMMENTS_NO_D after delete on BLOG_COMMENTS referencing old
       set triggers on;
     }
   delete from SYS_BLOGS_ROUTING_LOG where  RL_COMMENT_ID = O.BM_ID;
+  delete from BLOG_COMMENT_LINKS where CL_BLOG_ID = O.BM_BLOG_ID and CL_POST_ID = O.BM_POST_ID and CL_CID = O.BM_ID;
 
   set triggers off;
   update BLOG.DBA.SYS_BLOG_INFO
@@ -4700,12 +4773,16 @@ create procedure BLOG_GET_MAIL_VIA_POP3 (in pop3s varchar, in pop3u varchar, in
     if (pop3s <> '' and pop3u <> '' and pop3p <> '')
       {
       declare res any;
-      declare inx, len int;
+      declare inx, len, cert int;
       declare mess, elm any;
       declare exit handler for sqlstate '*' { goto nextu; };
 
       commit work;
-      res := pop3_get (pop3s, pop3u, pop3p, 999999999);
+      if (pop3s like '%:995')
+	cert := 1;
+      else
+        cert := 0;	
+      res := pop3_get (pop3s, pop3u, pop3p, 999999999, '', null, cert);
 
       inx := 0; len := length (res);
       while (inx < len)
@@ -7390,7 +7467,7 @@ ROUTING_PROCESS_BLOGS (in job_id int, in proto_id int, in dst varchar, in dst_id
         hdrs := BLOG_MAKE_MAIL_SUBJECT ('[Weblog post] '||_B_TITLE);
 
       for select BV_NAME, BV_E_MAIL, BV_POST_ID, BV_VIA_DOMAIN from SYS_BLOG_VISITORS
-         where BV_NOTIFY = 1 and BV_BLOG_ID = item_id
+         where BV_NOTIFY = 1 and BV_BLOG_ID = item_id and length (BV_E_MAIL)
           and (BV_POST_ID = _RL_POST_ID or length (BV_POST_ID) = 0)
         do
           {
@@ -8298,3 +8375,14 @@ CREATE FUNCTION BLOG..GET_DAYS_IN_MONTH (in pDate  DATETIME) RETURNS INT
 
 }
 ;
+
+create procedure BLOG..BLOG_RESOLVE_REFS (in txt any)
+{
+  declare a any;
+  a := regexp_replace (txt, '((http://|https://|mailto:|ftp:)[^ ]+)', '<a href="\\1">\\1</a>', 1, null);
+  a := regexp_replace (a, '(@)([[:alnum:]]+)(:)', '\\1<a href="/dataspace/person/\\2">\\2</a>\\3', 1, null);
+  a := regexp_replace (a, '([[:alnum:]]+)(@)([[:alnum:]]+\\.[[:alnum:]]+)', '<a href="mailto:\\1@\\3">\\1@\\3</a>', 1, null);
+  return '<div>' || a || '</div>';
+}
+;
+
diff --git a/appsrc/ODS-Blog/conv.sql b/appsrc/ODS-Blog/conv.sql
index 331db8a..1cc1bbc 100644
--- a/appsrc/ODS-Blog/conv.sql
+++ b/appsrc/ODS-Blog/conv.sql
@@ -1,5 +1,5 @@
 --
---  $Id: conv.sql,v 1.4 2007/07/26 14:52:28 source Exp $
+--  $Id: conv.sql,v 1.4.2.1 2010/09/20 10:14:42 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Blog/dav_browser.sql b/appsrc/ODS-Blog/dav_browser.sql
index 4106c7d..0d5a620 100644
--- a/appsrc/ODS-Blog/dav_browser.sql
+++ b/appsrc/ODS-Blog/dav_browser.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: dav_browser.sql,v 1.3 2006/08/14 14:33:14 source Exp $
+--  $Id: dav_browser.sql,v 1.3.2.1 2010/09/20 10:14:42 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Blog/gdata.sql b/appsrc/ODS-Blog/gdata.sql
index fc32596..4765976 100644
--- a/appsrc/ODS-Blog/gdata.sql
+++ b/appsrc/ODS-Blog/gdata.sql
@@ -1,5 +1,5 @@
 --
---  $Id: gdata.sql,v 1.4 2006/08/14 14:33:14 source Exp $
+--  $Id: gdata.sql,v 1.4.2.1 2010/09/20 10:14:42 source Exp $
 --
 --  Atom publishing protocol support.
 --
diff --git a/appsrc/ODS-Blog/index.vsp b/appsrc/ODS-Blog/index.vsp
index 178467e..9f71613 100644
--- a/appsrc/ODS-Blog/index.vsp
+++ b/appsrc/ODS-Blog/index.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: index.vsp,v 1.3 2006/07/31 15:35:28 source Exp $
+--  $Id: index.vsp,v 1.3.2.1 2010/09/20 10:14:42 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Blog/index.vspx b/appsrc/ODS-Blog/index.vspx
index c3b3859..ed4abd3 100644
--- a/appsrc/ODS-Blog/index.vspx
+++ b/appsrc/ODS-Blog/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: index.vspx,v 1.3.2.1 2010/09/20 10:14:42 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/install.sql b/appsrc/ODS-Blog/install.sql
index 87a9fcd..72f8670 100644
--- a/appsrc/ODS-Blog/install.sql
+++ b/appsrc/ODS-Blog/install.sql
@@ -1,5 +1,5 @@
 --
---  $Id: install.sql,v 1.25.2.5 2010/06/09 13:45:58 source Exp $
+--  $Id: install.sql,v 1.25.2.8 2010/11/09 20:15:17 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -1116,6 +1116,7 @@ http ('XMLELEMENT(\'webMaster\', BI_E_MAIL), \n', ses);
 http ('XMLELEMENT(\'copyright\', BLOG..blog_utf2wide (BI_COPYRIGHTS)), \n', ses);
 http ('XMLELEMENT(\'http://www.w3.org/2005/Atom:link\', XMLATTRIBUTES (\'http://\' || BLOG.DBA.BLOG2_GET_HOST () || http_path() as "href", \'self\' as "rel", \'application/rss+xml\' as "type", BLOG..blog_utf2wide (BI_TITLE) as "title")), \n', ses);
 http ('(select XMLAGG (XMLELEMENT(\'http://www.w3.org/2005/Atom:link\', XMLATTRIBUTES (SH_URL as "href", \'hub\' as "rel", \'PubSubHub\' as "title"))) from ODS.DBA.SVC_HOST, ODS.DBA.APP_PING_REG, DB.DBA.WA_INSTANCE where SH_PROTO = \'PubSubHub\' and SH_ID = AP_HOST_ID and AP_WAI_ID = WAI_ID and WAI_NAME = BI_WAI_NAME), \n', ses);
+http ('XMLELEMENT(\'http://www.w3.org/2005/Atom:link\', XMLATTRIBUTES (sprintf (\'http://%{WSHost}s/ods/salmon\') as "href", \'salmon\' as "rel")), \n', ses);
 http ('(select XMLAGG (XMLELEMENT (\'category\', BI_KWD)) from BLOG.DBA.BLOG_GET_BLOG_KWDS where kwds = BI_KEYWORDS) ,\n', ses);
 http ('\n', ses);
 http ('XMLELEMENT(\'language\', \'en-us\'), \n', ses);
@@ -3522,7 +3523,7 @@ create procedure BLOG.DBA.CONTENT_ANNOTATE (in ap_uid any, in source_UTF8 varcha
 	    {
 	      arr := m_app[this_apa_id];
 	      dta := arr [3];
-	      http (sprintf ('<a href="%V">', dta), res_out);
+	      http (sprintf ('<a class="auto-href" href="%V">', dta), res_out);
 	      --http ('[', res_out);
 	    }
 
@@ -3594,7 +3595,6 @@ create trigger SYS_SYS_BLOGS_IN_SYS_BLOG_ATTACHES after insert on BLOG.DBA.SYS_B
     auto_href := 0;
 
   RE_TAG_POST (N.B_BLOG_ID, N.B_POST_ID, N.B_USER_ID, inst_id, N.B_CONTENT, 0, xt, null, null, auto_tag);
-  BLOG_ADD_LINKS (N.B_BLOG_ID, N.B_POST_ID, xt);
 
   xt := xslt (BLOG2_GET_PPATH_URL ('widgets/store_post.xsl'), xt);
   xml_tree_doc_set_output (xt, 'xhtml');
@@ -3611,6 +3611,7 @@ create trigger SYS_SYS_BLOGS_IN_SYS_BLOG_ATTACHES after insert on BLOG.DBA.SYS_B
   ss := string_output_string (ss);
   if (auto_href)
   ss := BLOG.DBA.CONTENT_ANNOTATE (N.B_USER_ID, ss);
+  BLOG_ADD_LINKS (N.B_BLOG_ID, N.B_POST_ID, xml_tree_doc (xml_tree (ss, 2, '', 'UTF-8')));
 
   title := BLOG_GET_TITLE (N.B_META, N.B_CONTENT);
   enc_type := null;
@@ -3702,7 +3703,6 @@ create trigger SYS_SYS_BLOGS_UP_SYS_BLOG_ATTACHES after update on BLOG.DBA.SYS_B
       graph_iri := sioc..get_graph ();
       sioc.DBA.delete_quad_s_or_o (graph_iri, post_iri, post_iri);
       RE_TAG_POST (N.B_BLOG_ID, N.B_POST_ID, N.B_USER_ID, inst_id, N.B_CONTENT, 0, xt, null, null, auto_tag);
-      BLOG_ADD_LINKS (N.B_BLOG_ID, N.B_POST_ID, xt);
 
       xt := xslt (BLOG2_GET_PPATH_URL ('widgets/store_post.xsl'), xt);
       xml_tree_doc_set_output (xt, 'xhtml');
@@ -3718,6 +3718,7 @@ create trigger SYS_SYS_BLOGS_UP_SYS_BLOG_ATTACHES after update on BLOG.DBA.SYS_B
       ss := string_output_string (ss);
       if (auto_href)
       ss := BLOG.DBA.CONTENT_ANNOTATE (N.B_USER_ID, ss);
+      BLOG_ADD_LINKS (N.B_BLOG_ID, N.B_POST_ID, xml_tree_doc (xml_tree (ss, 2, '', 'UTF-8')));
 
       title := BLOG_GET_TITLE (N.B_META, N.B_CONTENT);
       enc_type := null;
diff --git a/appsrc/ODS-Blog/make_vad.sh b/appsrc/ODS-Blog/make_vad.sh
index 00492b0..4fac5a0 100755
--- a/appsrc/ODS-Blog/make_vad.sh
+++ b/appsrc/ODS-Blog/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.22.2.3 2010/03/12 09:14:09 source Exp $
+#  $Id: make_vad.sh,v 1.22.2.9 2011/02/03 10:26:14 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -228,6 +228,11 @@ directory_init() {
   mkdir vad/data/blog2/templates/thin_pastel
   mkdir vad/data/blog2/templates/squeaky_clean
   mkdir vad/data/blog2/templates/columns_clean
+  mkdir vad/data/blog2/templates/digital_bazaar
+  mkdir vad/data/blog2/templates/digital_bazaar/images
+  mkdir vad/data/blog2/templates/newspaper_view
+  mkdir vad/data/blog2/templates/newspaper_view/images
+  mkdir vad/data/blog2/templates/micro
   mkdir vad/data/blog2/widgets
   cp index.vspx vad/data/blog2
   cp *.sql vad/data/blog2
@@ -251,6 +256,12 @@ directory_init() {
   cp -f templates/thin_pastel/* vad/data/blog2/templates/thin_pastel 2>/dev/null
   cp -f templates/squeaky_clean/* vad/data/blog2/templates/squeaky_clean 2>/dev/null
   cp -f templates/columns_clean/* vad/data/blog2/templates/columns_clean 2>/dev/null
+  cp -f templates/digital_bazaar/* vad/data/blog2/templates/digital_bazaar 2>/dev/null
+  cp -f templates/digital_bazaar/images/* vad/data/blog2/templates/digital_bazaar/images 2>/dev/null
+  cp -f templates/newspaper_view/* vad/data/blog2/templates/newspaper_view 2>/dev/null
+  cp -f templates/newspaper_view/images/* vad/data/blog2/templates/newspaper_view/images 2>/dev/null
+  cp -f templates/micro/* vad/data/blog2/templates/micro 2>/dev/null
+
   cp -f templates/main.vspx vad/data/blog2/templates/main.vspx
   cp -rf widgets/* vad/data/blog2/widgets
 }
@@ -270,7 +281,7 @@ sticker_init() {
   echo "  <name package=\"Weblog\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS Weblog\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso/blog2/download\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso/blog2/download\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
@@ -282,8 +293,8 @@ sticker_init() {
   echo "<dependencies>" >> $STICKER
   echo "  <require>" >> $STICKER
   echo "    <name package=\"Framework\"/>" >> $STICKER
-  echo "    <versions_later package=\"1.67.12\">" >> $STICKER
-  echo "      <prop name=\"Date\" value=\"2010-03-29 12:00\" />" >> $STICKER
+  echo "    <versions_later package=\"1.77.31\">" >> $STICKER
+  echo "      <prop name=\"Date\" value=\"2010-10-20 00:00\" />" >> $STICKER
   echo "      <prop name=\"Comment\" value=\"An incompatible version of the ODS Framework\" />" >> $STICKER
   echo "    </versions_later>" >> $STICKER
   echo "  </require>" >> $STICKER
diff --git a/appsrc/ODS-Blog/public/back_nav.vspx b/appsrc/ODS-Blog/public/back_nav.vspx
index 3718695..a4586ef 100644
--- a/appsrc/ODS-Blog/public/back_nav.vspx
+++ b/appsrc/ODS-Blog/public/back_nav.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: back_nav.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: back_nav.vspx,v 1.3.2.1 2010/09/20 10:14:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/public/c_confirm.vspx b/appsrc/ODS-Blog/public/c_confirm.vspx
index ed6afdf..34727bd 100644
--- a/appsrc/ODS-Blog/public/c_confirm.vspx
+++ b/appsrc/ODS-Blog/public/c_confirm.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: c_confirm.vspx,v 1.5 2008/02/07 10:03:49 source Exp $
+ -  $Id: c_confirm.vspx,v 1.5.2.1 2010/09/20 10:14:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/public/css/dav.css b/appsrc/ODS-Blog/public/css/dav.css
index 74f2dde..0ac3769 100644
--- a/appsrc/ODS-Blog/public/css/dav.css
+++ b/appsrc/ODS-Blog/public/css/dav.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: dav.css,v 1.2 2006/05/31 13:12:59 source Exp $
+ *  $Id: dav.css,v 1.2.2.1 2010/09/20 10:14:44 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/public/css/default.css b/appsrc/ODS-Blog/public/css/default.css
index 1877d55..bdd10b3 100644
--- a/appsrc/ODS-Blog/public/css/default.css
+++ b/appsrc/ODS-Blog/public/css/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2 2006/05/31 13:12:59 source Exp $
+ *  $Id: default.css,v 1.2.2.1 2010/09/20 10:14:44 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/public/css/rte.css b/appsrc/ODS-Blog/public/css/rte.css
index bd45b4f..0dadda8 100644
--- a/appsrc/ODS-Blog/public/css/rte.css
+++ b/appsrc/ODS-Blog/public/css/rte.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: rte.css,v 1.3 2006/06/27 15:10:09 source Exp $
+ *  $Id: rte.css,v 1.3.2.1 2010/09/20 10:14:44 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/public/css/webdav.css b/appsrc/ODS-Blog/public/css/webdav.css
index d97a71c..df4618a 100644
--- a/appsrc/ODS-Blog/public/css/webdav.css
+++ b/appsrc/ODS-Blog/public/css/webdav.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: webdav.css,v 1.1 2007/11/26 10:33:14 source Exp $
+ *  $Id: webdav.css,v 1.1.2.1 2010/09/20 10:14:44 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
diff --git a/appsrc/ODS-Blog/public/openid_helper.vsp b/appsrc/ODS-Blog/public/openid_helper.vsp
index 27d76f8..a645a2e 100644
--- a/appsrc/ODS-Blog/public/openid_helper.vsp
+++ b/appsrc/ODS-Blog/public/openid_helper.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --  
---  $Id: openid_helper.vsp,v 1.3 2008/02/19 11:01:44 source Exp $
+--  $Id: openid_helper.vsp,v 1.3.2.1 2010/09/20 10:14:43 source Exp $
 --  
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Blog/public/popup_browser.vspx b/appsrc/ODS-Blog/public/popup_browser.vspx
index 1f726da..cf48ffc 100644
--- a/appsrc/ODS-Blog/public/popup_browser.vspx
+++ b/appsrc/ODS-Blog/public/popup_browser.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: popup_browser.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: popup_browser.vspx,v 1.3.2.1 2010/09/20 10:14:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/public/r_unsubscribe.vspx b/appsrc/ODS-Blog/public/r_unsubscribe.vspx
index e1d5931..76ca18a 100644
--- a/appsrc/ODS-Blog/public/r_unsubscribe.vspx
+++ b/appsrc/ODS-Blog/public/r_unsubscribe.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: r_unsubscribe.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: r_unsubscribe.vspx,v 1.3.2.1 2010/09/20 10:14:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/public/scripts/browserdetect.js b/appsrc/ODS-Blog/public/scripts/browserdetect.js
index 9b284e5..d3b717a 100644
--- a/appsrc/ODS-Blog/public/scripts/browserdetect.js
+++ b/appsrc/ODS-Blog/public/scripts/browserdetect.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: browserdetect.js,v 1.2 2006/05/31 13:12:59 source Exp $
+ *  $Id: browserdetect.js,v 1.2.2.1 2010/09/20 10:14:44 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/public/scripts/entry.js b/appsrc/ODS-Blog/public/scripts/entry.js
index 11c0b6d..38a2bb8 100644
--- a/appsrc/ODS-Blog/public/scripts/entry.js
+++ b/appsrc/ODS-Blog/public/scripts/entry.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: entry.js,v 1.2 2006/05/31 13:12:59 source Exp $
+ *  $Id: entry.js,v 1.2.2.1 2010/09/20 10:14:44 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/public/scripts/form.js b/appsrc/ODS-Blog/public/scripts/form.js
index be3d900..985191f 100644
--- a/appsrc/ODS-Blog/public/scripts/form.js
+++ b/appsrc/ODS-Blog/public/scripts/form.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: form.js,v 1.6 2008/02/08 13:45:56 source Exp $
+ *  $Id: form.js,v 1.6.2.1 2010/09/20 10:14:44 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/public/scripts/openid.js b/appsrc/ODS-Blog/public/scripts/openid.js
index b59f0d9..2bc7e9b 100644
--- a/appsrc/ODS-Blog/public/scripts/openid.js
+++ b/appsrc/ODS-Blog/public/scripts/openid.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: openid.js,v 1.2 2006/10/17 13:46:57 source Exp $
+ *  $Id: openid.js,v 1.2.2.1 2010/09/20 10:14:44 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/public/scripts/plugins.js b/appsrc/ODS-Blog/public/scripts/plugins.js
index eacde2d..934dd03 100644
--- a/appsrc/ODS-Blog/public/scripts/plugins.js
+++ b/appsrc/ODS-Blog/public/scripts/plugins.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: plugins.js,v 1.2 2006/05/31 13:12:59 source Exp $
+ *  $Id: plugins.js,v 1.2.2.1 2010/09/20 10:14:44 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/public/search.vspx b/appsrc/ODS-Blog/public/search.vspx
index 490bdcc..123203c 100644
--- a/appsrc/ODS-Blog/public/search.vspx
+++ b/appsrc/ODS-Blog/public/search.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: search.vspx,v 1.11.2.1 2009/07/10 15:31:39 source Exp $
+ -  $Id: search.vspx,v 1.11.2.2 2010/09/20 10:14:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/public/view.vspx b/appsrc/ODS-Blog/public/view.vspx
index 0c376f9..d2e46a6 100644
--- a/appsrc/ODS-Blog/public/view.vspx
+++ b/appsrc/ODS-Blog/public/view.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: view.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: view.vspx,v 1.3.2.1 2010/09/20 10:14:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/public/view_file.vspx b/appsrc/ODS-Blog/public/view_file.vspx
index c744dc5..0e6300a 100644
--- a/appsrc/ODS-Blog/public/view_file.vspx
+++ b/appsrc/ODS-Blog/public/view_file.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: view_file.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: view_file.vspx,v 1.3.2.1 2010/09/20 10:14:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/sioc_blog.sql b/appsrc/ODS-Blog/sioc_blog.sql
index fdd21f5..bc8328d 100644
--- a/appsrc/ODS-Blog/sioc_blog.sql
+++ b/appsrc/ODS-Blog/sioc_blog.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sioc_blog.sql,v 1.14.2.1 2009/11/17 21:37:40 source Exp $
+--  $Id: sioc_blog.sql,v 1.14.2.3 2010/10/07 13:24:14 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -104,8 +104,12 @@ create procedure fill_ods_weblog_sioc (in graph_iri varchar, in site_iri varchar
        {
 	 cm_iri := blog_comment_iri (B_BLOG_ID, B_POST_ID, BM_ID);
 	 foaf_maker (graph_iri, BM_HOME_PAGE, BM_NAME, BM_E_MAIL);
+	 links :=
+	 (select DB.DBA.VECTOR_AGG (vector (CL_TITLE,CL_LINK)) from BLOG..BLOG_COMMENT_LINKS
+	  where CL_BLOG_ID = B_BLOG_ID and CL_POST_ID = B_POST_ID and CL_CID = BM_ID);
+
 	 ods_sioc_post (graph_iri, cm_iri, blog_iri, null, BM_TITLE, BM_TS, BM_TS, BI_HOME ||'?id='||B_POST_ID, BM_COMMENT,
-	     null, null, BM_HOME_PAGE);
+	     null, links, BM_HOME_PAGE);
 	 DB.DBA.ODS_QUAD_URI (graph_iri, iri, sioc_iri ('has_reply'), cm_iri);
 	 DB.DBA.ODS_QUAD_URI (graph_iri, cm_iri, sioc_iri ('reply_of'), iri);
        }
@@ -305,7 +309,7 @@ create trigger SYS_BLOGS_SIOC_U after update on BLOG..SYS_BLOGS order 10 referen
 
 create trigger BLOG_COMMENTS_SIOC_I after insert on BLOG..BLOG_COMMENTS referencing new as N
 {
-  declare iri, graph_iri, cr_iri, blog_iri, home, post_iri, _wai_name varchar;
+  declare iri, graph_iri, cr_iri, blog_iri, home, post_iri, _wai_name, links varchar;
   declare exit handler for sqlstate '*' {
     sioc_log_message (__SQL_MESSAGE);
     return;
@@ -324,8 +328,11 @@ create trigger BLOG_COMMENTS_SIOC_I after insert on BLOG..BLOG_COMMENTS referenc
     return;
 
   foaf_maker (graph_iri, N.BM_HOME_PAGE, N.BM_NAME, N.BM_E_MAIL);
+  links :=
+	 (select DB.DBA.VECTOR_AGG (vector (CL_TITLE,CL_LINK)) from BLOG..BLOG_COMMENT_LINKS
+	  where CL_BLOG_ID = N.BM_BLOG_ID and CL_POST_ID = N.BM_POST_ID and CL_CID = N.BM_ID);
   ods_sioc_post (graph_iri, iri, blog_iri, null, N.BM_TITLE, N.BM_TS, N.BM_TS, home ||'?id='||N.BM_POST_ID, N.BM_COMMENT,
-      null, null, N.BM_HOME_PAGE);
+      null, links, N.BM_HOME_PAGE);
   post_iri := blog_post_iri (N.BM_BLOG_ID, N.BM_POST_ID);
   DB.DBA.ODS_QUAD_URI (graph_iri, post_iri, sioc_iri ('has_reply'), iri);
   DB.DBA.ODS_QUAD_URI (graph_iri, iri, sioc_iri ('reply_of'), post_iri);
diff --git a/appsrc/ODS-Blog/template.sql b/appsrc/ODS-Blog/template.sql
index 06828ae..9dcb8d7 100644
--- a/appsrc/ODS-Blog/template.sql
+++ b/appsrc/ODS-Blog/template.sql
@@ -1,5 +1,5 @@
 --
---  $Id: template.sql,v 1.4 2006/08/14 14:33:14 source Exp $
+--  $Id: template.sql,v 1.4.2.1 2010/09/20 10:14:42 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Blog/templates/atlantis/default.css b/appsrc/ODS-Blog/templates/atlantis/default.css
index f326c9b..3734382 100644
--- a/appsrc/ODS-Blog/templates/atlantis/default.css
+++ b/appsrc/ODS-Blog/templates/atlantis/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2 2006/05/31 13:12:59 source Exp $
+ *  $Id: default.css,v 1.2.2.1 2010/09/20 10:14:44 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/atlantis/index.vspx b/appsrc/ODS-Blog/templates/atlantis/index.vspx
index 9204764..0030e47 100644
--- a/appsrc/ODS-Blog/templates/atlantis/index.vspx
+++ b/appsrc/ODS-Blog/templates/atlantis/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:47 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/autumn/default.css b/appsrc/ODS-Blog/templates/autumn/default.css
index 16c1c25..159215d 100644
--- a/appsrc/ODS-Blog/templates/autumn/default.css
+++ b/appsrc/ODS-Blog/templates/autumn/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2.2.1 2009/07/01 10:31:47 source Exp $
+ *  $Id: default.css,v 1.2.2.2 2010/09/20 10:14:45 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/autumn/index.vspx b/appsrc/ODS-Blog/templates/autumn/index.vspx
index 48f8514..76baed3 100644
--- a/appsrc/ODS-Blog/templates/autumn/index.vspx
+++ b/appsrc/ODS-Blog/templates/autumn/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:47 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/blue_left/default.css b/appsrc/ODS-Blog/templates/blue_left/default.css
index fe3526b..e71a434 100644
--- a/appsrc/ODS-Blog/templates/blue_left/default.css
+++ b/appsrc/ODS-Blog/templates/blue_left/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2.2.1 2009/07/01 10:31:48 source Exp $
+ *  $Id: default.css,v 1.2.2.2 2010/09/20 10:14:45 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/blue_left/index.vspx b/appsrc/ODS-Blog/templates/blue_left/index.vspx
index 5c5d782..c137b74 100644
--- a/appsrc/ODS-Blog/templates/blue_left/index.vspx
+++ b/appsrc/ODS-Blog/templates/blue_left/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:48 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/columns_clean/archive.vspx b/appsrc/ODS-Blog/templates/columns_clean/archive.vspx
index bc71c7c..6fe7b69 100644
--- a/appsrc/ODS-Blog/templates/columns_clean/archive.vspx
+++ b/appsrc/ODS-Blog/templates/columns_clean/archive.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: archive.vspx,v 1.1 2007/10/17 20:13:31 source Exp $
+ -  $Id: archive.vspx,v 1.1.2.1 2010/09/20 10:14:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/columns_clean/default.css b/appsrc/ODS-Blog/templates/columns_clean/default.css
index 85cb0a6..de79bef 100644
--- a/appsrc/ODS-Blog/templates/columns_clean/default.css
+++ b/appsrc/ODS-Blog/templates/columns_clean/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.1.2.1 2009/07/01 10:31:48 source Exp $
+ *  $Id: default.css,v 1.1.2.2 2010/09/20 10:14:45 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/columns_clean/index.vspx b/appsrc/ODS-Blog/templates/columns_clean/index.vspx
index 45bd0ea..ef1a0ac 100644
--- a/appsrc/ODS-Blog/templates/columns_clean/index.vspx
+++ b/appsrc/ODS-Blog/templates/columns_clean/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.1.2.1 2009/07/01 10:31:48 source Exp $
+ -  $Id: index.vspx,v 1.1.2.2 2010/09/20 10:14:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/columns_clean/linkblog.vspx b/appsrc/ODS-Blog/templates/columns_clean/linkblog.vspx
index d429b05..1260422 100644
--- a/appsrc/ODS-Blog/templates/columns_clean/linkblog.vspx
+++ b/appsrc/ODS-Blog/templates/columns_clean/linkblog.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: linkblog.vspx,v 1.1 2007/10/17 20:13:31 source Exp $
+ -  $Id: linkblog.vspx,v 1.1.2.1 2010/09/20 10:14:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/columns_clean/summary.vspx b/appsrc/ODS-Blog/templates/columns_clean/summary.vspx
index e6cce52..744e85f 100644
--- a/appsrc/ODS-Blog/templates/columns_clean/summary.vspx
+++ b/appsrc/ODS-Blog/templates/columns_clean/summary.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: summary.vspx,v 1.1 2007/10/17 20:13:31 source Exp $
+ -  $Id: summary.vspx,v 1.1.2.1 2010/09/20 10:14:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/default/default.css b/appsrc/ODS-Blog/templates/default/default.css
index 838cf23..41c6c5d 100644
--- a/appsrc/ODS-Blog/templates/default/default.css
+++ b/appsrc/ODS-Blog/templates/default/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2.2.1 2009/07/01 10:31:48 source Exp $
+ *  $Id: default.css,v 1.2.2.2 2010/09/20 10:14:45 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/default/index.vspx b/appsrc/ODS-Blog/templates/default/index.vspx
index b8a0f96..6c6ac7c 100644
--- a/appsrc/ODS-Blog/templates/default/index.vspx
+++ b/appsrc/ODS-Blog/templates/default/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:49 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/default/red.css b/appsrc/ODS-Blog/templates/default/red.css
index 504cfd1..0c1c97e 100644
--- a/appsrc/ODS-Blog/templates/default/red.css
+++ b/appsrc/ODS-Blog/templates/default/red.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: red.css,v 1.3.2.1 2009/07/01 10:31:49 source Exp $
+ *  $Id: red.css,v 1.3.2.2 2010/09/20 10:14:45 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/digital_bazaar/archive.vspx b/appsrc/ODS-Blog/templates/digital_bazaar/archive.vspx
new file mode 100755
index 0000000..19dbf9c
--- /dev/null
+++ b/appsrc/ODS-Blog/templates/digital_bazaar/archive.vspx
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+-
+-  $Id: archive.vspx,v 1.1.4.2 2010/09/22 13:56:49 source Exp $
+-
+-  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+-  project.
+-
+-  Copyright (C) 1998-2006 OpenLink Software
+-
+-  This project is free software; you can redistribute it and/or modify it
+-  under the terms of the GNU General Public License as published by the
+-  Free Software Foundation; only version 2 of the License, dated June 1991.
+-
+-  This program is distributed in the hope that it will be useful, but
+-  WITHOUT ANY WARRANTY; without even the implied warranty of
+-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-  General Public License for more details.
+-
+-  You should have received a copy of the GNU General Public License along
+-  with this program; if not, write to the Free Software Foundation, Inc.,
+-  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-
+-->
+<v:page style="/DAV/VAD/blog2/widgets/main.xsl" name="home"
+xmlns:vm="http://www.openlinksw.com/vspx/weblog/"
+xmlns:v="http://www.openlinksw.com/vspx/"
+doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+on-deadlock-retry="5">
+  <vm:page>
+    <vm:header id="header">
+      <title>
+        <vm:blog-title url="" />
+      </title>
+      <vm:disco-rss-link />
+      <vm:disco-atom-link />
+      <vm:disco-pingback-link />
+      <vm:disco-comments-link />
+      <vm:disco-foaf-link />
+      <vm:disco-rsd-link />
+      <vm:disco-opml-link />
+      <vm:meta-owner />
+      <vm:meta-authors />
+      <vm:meta-description />
+      <vm:meta-keywords />
+      <vm:custom-style />
+    </vm:header>
+    <vm:body xhtml_style="single single-post postid-643">
+      <div id="page" style="text-align: left;">
+        <div id="header">
+          <div class="wrap">
+            <h1>
+              <vm:blog-title url="index.vspx"/>
+            </h1>
+          </div>
+          <div id="header2">
+            <div class="page_title_inner">
+              <div class="wrap">
+                <div class="page_title">
+                  <div class="page_title_inner">
+                    <h2>
+                      <vm:welcome-message show-once="no" />
+                    </h2>
+                  </div>
+                  <div>
+                  <vm:blog-view-switch />| 
+                  <vm:archive-url />
+                  <vm:settings-link title="| Settings" />
+                  <vm:new-post-link title="| New Post" />| 
+                  <vm:advanced-search-link title="Search" /></div>
+                </div>
+              </div>
+            </div>
+          </div>
+        </div>
+        <div class="page-container2">
+          <div class="wrap">
+            <div class="info-column">
+              <div class="block">
+                <div id="welcome">
+                  <vm:blog-about />
+                </div>
+                <div>
+                  <vm:about-me />
+                </div>
+                <div>
+                  <vm:login-info format_string="Logged in as %s." />
+                </div>
+                <div>
+                  <vm:cmds-menu />
+                </div>
+                <div>
+                  <vm:home-url />
+                </div>
+                <div id="selector">
+                  <vm:calendar vm:url="index.vspx?page=summary" />
+                  <vm:rss-feeds />
+                  <vm:if test="ocs">
+                    <h2>
+                      <vm:ocs-div-title />
+                    </h2>
+                    <div class="roll">
+                      <vm:ocs />
+                    </div>
+                  </vm:if>
+                  <vm:if test="opml">
+                    <h2>
+                      <vm:opml-div-title />
+                    </h2>
+                    <div class="roll">
+                      <vm:opml />
+                    </div>
+                  </vm:if>
+                </div>
+                <div>Search</div>
+                <div>
+                  <vm:search />
+                </div>
+                <div>Tag Cloud 
+                <vm:if test="tagid">
+                  <span>
+                    <a href="gems/rss_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"
+                    class="inlinelink">
+                      <img src="/weblog/public/images/rss-icon-16.gif"
+                      border="0" alt="RSS" title="RSS" />
+                    </a>
+                    <a href="gems/atom_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"
+                    class="inlinelink">
+                      <img src="/weblog/public/images/atom-icon-16.gif"
+                      border="0" alt="Atom" title="Atom" />
+                    </a>
+                    <a href="gems/rdf_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"
+                    class="inlinelink">
+                      <img src="/weblog/public/images/rdf-icon-16.gif"
+                      border="0" alt="RDF" title="RDF" />
+                    </a>
+                  </span>
+                </vm:if>
+                <vm:tags top="100" /></div>
+                <div>Post Categories</div>
+                <div>
+                  <vm:categories />
+                </div>
+                <div>Subscribe</div>
+                <div>
+                  <vm:subscribe />
+                </div>
+                <div>Recent Articles</div>
+                <div>
+                  <vm:last-messages />
+                </div>
+                <vm:if test="have_community">
+                  <div>Community Member Blogs</div>
+                  <div>
+                    <vm:bloggers />
+                  </div>
+                </vm:if>
+                <vm:if test="browse_posts">
+                  <div>Sort options</div>
+                  <div>
+                    <vm:sort-options />
+                  </div>
+                </vm:if>
+                <vm:if test="fish">
+                  <div>Translate</div>
+                  <div>
+                    <vm:babel-fish />
+                  </div>
+                </vm:if>
+                <div>
+                  <vm:amazon-wishlist-display />
+                </div>
+                <div>
+                  <vm:google-ads />
+                </div>
+                <div>
+                  <vm:etray-ads />
+                </div>
+                <div id="powered">
+                  <vm:powered-by />
+                </div>
+                <div id="copy">
+                  <vm:copyright />
+                </div>
+                <div id="disclaimer">
+                  <vm:disclaimer />
+                </div>
+              </div>
+            </div>
+            <div id="error">
+              <v:error-summary />
+            </div>
+            <div style="margin-left: 210px;">
+              <vm:archive />
+              <vm:posts mode="archive">
+                <vm:summary-group-heading>
+                  <div class="date_separator">
+                    <vm:date />
+                  </div>
+                </vm:summary-group-heading>
+                <div style="margin-bottom: 5px;">
+                  <div class="post">
+                    <vm:archive-post-title />
+                  </div>
+                  <vm:archive-post />
+                </div>
+              </vm:posts>
+            </div>
+          </div>
+        </div>
+      </div>
+    </vm:body>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Blog/templates/digital_bazaar/default.css b/appsrc/ODS-Blog/templates/digital_bazaar/default.css
new file mode 100755
index 0000000..a79512d
--- /dev/null
+++ b/appsrc/ODS-Blog/templates/digital_bazaar/default.css
@@ -0,0 +1,871 @@
+/*
+ *  $Id: default.css,v 1.1.4.3 2010/09/22 13:56:49 source Exp $
+ *  
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *  
+ *  Copyright (C) 1998-2006 OpenLink Software
+ *  
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *  
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *  
+ */
+
+html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, menu, nav, section, time, mark, audio, video { margin:0; padding:0; border:0; outline:0; font-size:100%; vertical-align:baseline; background:transparent; }
+
+body {
+font:20px/1.5em Georgia,serif;
+background:none repeat scroll 0 0 #F5F5F5;
+color:#505050;
+}
+
+a     { color: #003366; }
+a:link    { color: #003366;  }
+a:visited { color: #003366; }
+a:active  { color: #999999;  }
+a:hover   { color: #3399CC;  }
+
+
+a img {
+ border: none;
+}
+
+h1 { font-size: 2em; font-weight:700; padding: 0 0 .5em;line-height:130%; }
+
+form {
+  display: inline;
+  width: 0px;
+  padding: 0px;
+  margin: 0px;
+}
+
+#page {
+height:auto !important;
+margin:0 auto -55px;
+min-height:100%;
+}
+
+#header {
+background:url("images/bg_header.png") repeat-x scroll 0 0 #DADADA;
+z-index:1;
+padding:10px 0 30px;
+min-width:960px;
+}
+
+#header2 {
+background:url("images/bg_page_title.png") repeat-x scroll 0 0 #005490;
+}
+
+.page_title_inner {
+background:url("images/bg_page_title_inner.jpg") no-repeat scroll 50% 0 transparent;
+}
+
+.page_title_inner, .footer_widgets, .footer {
+min-width:960px;
+}
+
+.page_title {
+background:url("../images/bg_page_title.png") repeat-x scroll 0 0 #005490;
+}
+
+.wrap {
+margin:0 auto;
+overflow:hidden;
+width:960px;
+}
+
+#header .wrap {
+background:url("images/bg_header_wrap.png") no-repeat scroll 50% 0 transparent;
+min-height:80px;
+overflow:hidden;
+}
+
+#header img {
+  position: relative;
+  top: 10px;
+  margin: 0px;
+  padding: 0px;
+}
+
+#header h1 {
+display:block;
+float:left;
+font-size:2em;
+font-weight:700;
+line-height:100%;
+padding-top:26px;
+}
+
+#header2 h2 {
+font-size:2em;
+font-weight:600;
+line-height:100%;
+padding:20px 10px 0;
+  font-family: tahoma;
+color: white;
+}
+
+
+#navbartop {
+  position: relative;
+  left: 15px;
+}
+
+#navbartop * {
+  text-align: left;
+  color: black;
+  margin: 0px;
+  padding-top: 1px;
+  padding-bottom: 1px;
+  width: 100%;
+}
+
+.button {
+  border: none;
+  padding: 2px 2px;
+  margin: 3px 0px;
+  font-weight: normal;
+  cursor: pointer;
+  color: blue;
+  background-color: transparent;
+  font-family: arial, helvetica, sans-serif;
+  text-decoration: none;
+}
+
+.button:hover {
+  color: #003366;
+}
+
+.real_button
+{
+  font-family: arial, helvetica, sans-serif;
+  font-size: 9px;
+  border: 1px solid #AAAAAA;
+  background-color: #CCD4E0;
+}
+
+
+input {  
+  border: 1px solid #191970;
+  color: black;
+  background-color: white;
+  align: left;
+}
+
+select {
+  border: 1px solid #191970;
+  color: black;
+  background-color: white;
+}
+
+textarea {
+  border: 1px solid #191970;
+  color: black;
+  background-color: white;
+}
+
+div.block {
+  text-align: left;
+font-family:Arial;
+font-size:0.8em;
+line-height:1.4;
+}
+
+div.block div {
+  margin: 3px;
+}
+
+div.block div#welcome {
+  color: white;
+  background-color:#3399cc;
+  border-bottom:2px solid #EDF5F9;
+  padding-bottom:10px;
+  text-align: left;
+  font-weight: normal;
+  padding: 2px;
+  font-size: x-small;
+  voice-family: "\"}\"", inherit;
+  font-size: small;
+}
+
+
+div.block div#title {
+  color:white;
+  background-color:#3399cc;
+  border-bottom:2px solid #EDF5F9;
+  padding-bottom:10px;
+  text-align: left;
+  font-weight: normal;
+  padding: 2px;
+  font-size: x-small;
+  voice-family: "\"}\"", inherit;
+  font-size: small;
+}
+
+input.button {
+  height: 17px;
+}
+
+div.nav-column {
+  width: 128px;
+  float: left;
+  overflow: hidden;
+  margin-left: 12px;
+}
+
+div.content-column {
+  width: auto;
+  padding 6px;
+  padding-left: 0px;
+  padding-right: 250px;
+  text-align: center;
+}
+
+#selector div {
+  font-size: x-small;
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: small; 
+}
+
+#selector td{
+  font-size: x-small;
+  voice-family: "\"}\"", inherit;  
+  /* All below here hidden from IE 5 PC */
+}
+
+#selector .button {
+  text-decoration: none;
+  margin: 0px;
+  padding-left: 5px;
+  text-align: left;
+  margin: 0px;
+  padding-left: 0px;
+  list-style-type: none;
+  padding-bottom:1px;  
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: x-small; 
+}
+
+#separated * {
+  display: block;
+  padding: 0px;
+  margin: 0px;
+  border-bottom: 1px solid #191970;
+}
+
+#selector .button#inline {
+  display: inline;
+}
+
+#inline {
+  display: inline;
+}
+
+div.info-column {
+  float: left;
+  overflow: hidden;
+  margin-right: 12px;
+  width:180px; 
+  voice-family:inherit;
+}
+
+#calendar {
+  font-size: 50%;
+  text-align: center;
+  margin: auto;
+}
+#calendar td, #calendar th { padding: 1px;}
+.calactive {
+   background: url("/weblog/public/images/blog-active.png");
+   background-repeat: no-repeat;
+   background-position: center;
+   color: white;
+ }
+.calactive a {
+   color: white;
+ }
+.calnotactive a {
+   text-decoration: none;
+ }
+.caltoday {
+   background: url("/weblog/public/images/blog-today.png");
+   background-repeat: no-repeat;
+   background-position: center;
+   color: white;
+ }
+.caltoday a {
+   color: white;
+ }
+.calselected {
+   color: white;
+   border:1px solid #000000;
+ }
+.calselected a {
+   color: white;
+ }
+.tb-url, .tb-url a {
+  font-family:georgia, verdana, arial, sans-serif;
+  color:#666;
+  font-size:1em;
+  font-weight:normal;
+  background:inherit;
+  width: 100%;
+}
+.tb-url .url {
+  color: #065;
+  background: inherit;
+  position: absolute;
+  width: 100%;
+}
+
+label.button {
+  text-decoration: none;
+  margin: 0px;
+  padding-left: 5px;
+  text-align: left;
+  margin: 0px;
+  padding-left: 0px;
+  list-style-type: none;
+  padding-bottom:1px;  
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: x-small; 
+}
+
+.smallfeedlink {
+  font-size: 6pt;
+  background: #ff6800;
+  font-weight: bold;
+  color: white;
+  border-top: 1px solid white;
+  border-left: 1px solid white;
+  border-right: 1px solid darkred;
+  border-bottom: 1px solid darkred;
+  padding: 0px;
+  padding-left: 2px;
+  padding-right: 2px;
+  margin: 0px;
+  text-decoration: none;
+}
+
+#error {
+  color: red;
+  font-weight: bold;
+  background-color: white;
+  padding 3px 0px;
+  margin 2px;
+  text-align: center;
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: x-small; 
+}
+
+div.page-container {
+  width: 360px;
+  float: left;
+  overflow: hidden;
+  text-align: left;
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: small; 
+}
+
+.page-container2 {
+background:url("images/bg_content.png") repeat-x scroll 0 0 transparent;
+min-height:350px;
+min-width:960px;
+overflow:hidden;
+padding:30px 0 60px;
+}
+
+div.message {
+background:none repeat scroll 0 0 #F5F5F5;
+  font-weight:normal;
+  padding:5px;
+  font-size: x-small;
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: small; 
+}
+
+.state-mark {
+  padding-left: 6px;
+  color: darkred;
+  font-weight: normal;
+}
+
+.modified-date {
+  color: darkred;
+  font-weight: bold;
+}
+
+span.modified-date:before {
+  content: "[ "
+}
+
+span.modified-date:after {
+  content: " ]"
+}
+
+span.replacing {
+  margin: 0;
+  padding: 2px;
+  color: red;
+  border: 1px solid red;
+}
+
+div.pubdate {
+  color:gray;
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: x-small; 
+}
+
+div.post-title {
+font-size:2.2em;
+font-weight:400;
+line-height:130%;
+padding:0 0 0.535em;
+}
+
+div.post-content {
+background:none repeat scroll 0 0 #F5F5F5;
+  border: none;
+  display: block;
+  text-align: left;
+  font-size: 100%;
+}
+
+div.post-actions {
+background:none repeat scroll 0 0 #F5F5F5;
+  border: none;
+  margin-left: 20px;
+  margin-right: 20px;
+  text-align: left;
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: x-small; 
+}
+
+div.posts-title {
+  margin-top: 5px;
+  margin-bottom: 5px;
+  font-size: 110%;
+  font-weight: bold;
+}
+
+div.posts-info {
+  margin-top: 6px;
+  margin-bottom: 6px;
+}
+
+div.trackback-title {
+  margin-left: 20px;
+  margin-right: 20px;
+  margin-top: 6px;
+  margin-bottom: 6px;
+  font-size: 110%;
+  font-weight: bold;
+}
+
+div.trackback-contents {
+  background-color: white;
+  margin: 3px;
+  border: none;
+  display: block;
+  padding: 6px;
+  text-align: left;
+  margin-left: 24px;
+}
+
+div.pingback-title {
+  margin-left: 20px;
+  margin-right: 20px;
+  margin-top: 6px;
+  margin-bottom: 6px;
+  font-size: 110%;
+  font-weight: bold;
+}
+
+div.referrals-title {
+  margin-left: 20px;
+  margin-right: 20px;
+  margin-top: 6px;
+  margin-bottom: 6px;
+  font-size: 110%;
+  font-weight: bold;
+}
+
+div.referrals-contents {
+  margin: 3px;
+  border: none;
+  display: block;
+  padding: 6px;
+  text-align: left;
+  margin-left: 24px;
+}
+
+div.pingback-contents {
+  background-color: white;
+  margin: 3px;
+  border: none;
+  display: block;
+  padding: 6px;
+  text-align: left;
+  margin-left: 24px;
+}
+
+div.related-title {
+  margin-left: 20px;
+  margin-right: 20px;
+  margin-top: 6px;
+  margin-bottom: 6px;
+  font-size: 110%;
+  font-weight: bold;
+}
+
+div.related-contents {
+  background-color: white;
+  margin: 3px;
+  border: none;
+  display: block;
+  padding: 0px;
+  text-align: left;
+  margin-left: 0px;
+}
+
+
+div.comments-title {
+  margin-left: 0px;
+  margin-right: 0px;
+  margin-top: 0px;
+  margin-bottom: 0px;
+  font-size: 100%;
+  font-weight: bold;
+}
+
+div.comments-contents {
+  background-color: white;
+  margin: 3px;
+  border: none;
+  display: block;
+  padding: 6px;
+  text-align: left;
+  margin-left: 5px;
+}
+
+div.comment-message {
+  font-size: 90%;
+  background-color: white;
+  padding: 6px;
+  margin: 6px;
+  border: none;
+  margin-top: 30px;
+  margin-bottom: 5px;
+  margin-left: 0px;
+  display: block;
+}
+
+div.comment-pubdate {
+  font-size: 100%;
+  background-color: white;
+  color: black;
+  margin: 3px;
+  border: none;
+  margin-left: 20px;
+  margin-right: 20px;
+  display: block;
+  position: relative;
+  top: -30px;
+  padding: 3px;
+}
+
+div.comment-actions {
+  font-size: 90%;
+  background-color: white;
+  margin: 3px;
+  border: none;
+  margin-left: 20px;
+  margin-right: 20px;
+  padding: 3px;
+  text-align: left;
+}
+
+div.comment-content {
+  background-color: white;
+  margin: 3px;
+  border: none;
+  display: block;
+  padding: 6px;
+  text-align: left;
+  font-size: 80%;
+  position: relative;
+  top: -30px;
+  margin-bottom: -5 px;
+  margin-left: 20px;
+}
+
+div.comment-title {
+  background-color: white;
+  margin: 3px;
+  border: none;
+  margin-left: 20px;
+  margin-right: 20px;
+  display: block;
+  padding: 6px;
+  text-align: left;
+  font-weight: bold;
+  font-style: italic;
+  font-size: 140%;
+  position: relative;
+  top: -30px;
+}
+
+table#channels {
+  border: 1px solid #191970;
+  margin-bottom: 10px;
+  background-color: white;
+  width: 100%;
+}
+
+table#channels th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#channels td {
+  padding-left: 0px;
+  padding-right: 0px;
+}
+
+table#channel-posts {
+  border: 1px solid #191970;
+  margin-bottom: 10px;
+  background-color: white;
+  width: 100%;
+}
+
+table#channel-posts th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#channel-posts td {
+  padding-left: 6px;
+  padding-right: 6px;
+}
+
+table#channel-posts td#content {
+  background-color: white;
+}
+
+table#channel-posts a {
+  margin-right: 12px;
+}
+
+table#upstreamings {
+  border: 1px solid #191970;
+  margin-bottom: 10px;
+  background-color: white;
+  width: 97%;
+}
+
+table#upstreamings th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#upstreamings td {
+  padding-left: 0px;
+  padding-right: 0px;
+}
+
+table#community {
+  border: 2px solid #191970;
+  margin-bottom: 10px;
+  background-color: white;
+  width: 100%;
+}
+
+table#community th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#community td {
+  padding-left: 6px;
+  padding-right: 6px;
+}
+
+table#members {
+  border: 1px solid #191970;
+  margin-bottom: 10px;
+  background-color: white;
+  width: 100%;
+}
+
+table#members th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#members td {
+  padding-left: 6px;
+  padding-right: 6px;
+}
+
+table#categories {
+  border: 1px solid #191970;
+  background-color: white;
+  width: 100%;
+}
+
+table#categories th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#categories td {
+}
+
+div#subtitle {
+  font-weight: bold;
+  font-style: italic; 
+  color: #191970;
+}
+
+table#moblogs {
+  border: 1px solid #191970;
+  margin-bottom: 10px;
+  background-color: white;
+  width: 100%;
+}
+
+table#moblogs th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#moblogs td {
+  padding-left: 6px;
+  padding-right: 6px;
+}
+
+#text {
+  width: 510px;
+  text-align: left;
+  position: relative; /* Needed for Safari */
+  margin: auto; /* Takes care of horizontal alignment in standards compliant browsers */
+  voice-family: "\"}\"", inherit;
+  font-size: x-small;
+}
+
+#text table{
+  background-color: white;
+  width: 99%;
+}
+
+#text h1, h2 {
+  position: relative;
+  top: 0px;
+  margin: 0px;
+  padding: 0px;
+  color: black;
+}
+
+#text input {
+  padding: 0px;
+  margin: 0px;
+  text-align: left;
+  color: #003366;;
+  font-family: arial, helvetica, sans-serif;
+  voice-family: "\"}\"", inherit;
+  font-size: x-small;
+}
+
+div.form1 {
+  width: 510px;
+  text-align: left;
+  position: relative; /* Needed for Safari */
+  margin: auto; /* Takes care of horizontal alignment in standards compliant browsers */
+  voice-family: "\"}\"", inherit;
+  font-size: x-small;
+}
+
+.postcomment table {
+  margin-bottom: 1em;
+ }
+.postcomment th {
+  text-align: right;
+ }
+.postcomment .note {
+  padding: 0.3em;
+  font-size: 1em;
+  font-family: Tahoma, sans-serif;
+}
+
+/* Tabbed page - begin */
+.tab_page
+{
+    font-size: 10pt;
+    border-left: solid 1px black;
+    border-right: solid 1px black;
+    border-bottom: solid 1px black;
+    background-color: white;
+    padding-left: 10px;
+    padding-right: 10px;
+    color: black;
+    width: 100%;
+}
+.page_tab
+{
+    font-size: 10pt;
+    background-color: #eaeaea;
+    text-align: left;
+    white-space: nowrap;
+    padding: 2px;
+    border: 1px solid black;
+}
+.page_tab_empty 
+{
+    white-space: nowrap;
+    border-bottom:1px solid black;
+    border-left:1px solid black;
+    border-right:0;
+    border-top:0;
+}
+.page_tab_selected
+{
+    white-space: nowrap;
+    font-size: 10pt;
+    background-color: white;
+    text-align: left;
+    padding: 2px;
+    border-top:1px solid black;
+    border-left:1px solid black;
+    border-right:1px solid black;
+    border-bottom:0
+}
+.page_tab a
+{
+  color: black;
+  text-decoration: none;
+}
+.page_tab a:hover
+{
+  color: black;
+  text-decoration: underline;
+}
+/* Tabbed page - end */
diff --git a/appsrc/ODS-Blog/templates/digital_bazaar/images/bg_content.png b/appsrc/ODS-Blog/templates/digital_bazaar/images/bg_content.png
new file mode 100755
index 0000000..61fa72a
Binary files /dev/null and b/appsrc/ODS-Blog/templates/digital_bazaar/images/bg_content.png differ
diff --git a/appsrc/ODS-Blog/templates/digital_bazaar/images/bg_header.png b/appsrc/ODS-Blog/templates/digital_bazaar/images/bg_header.png
new file mode 100755
index 0000000..df37d98
Binary files /dev/null and b/appsrc/ODS-Blog/templates/digital_bazaar/images/bg_header.png differ
diff --git a/appsrc/ODS-Blog/templates/digital_bazaar/images/bg_page_title.png b/appsrc/ODS-Blog/templates/digital_bazaar/images/bg_page_title.png
new file mode 100755
index 0000000..054f14b
Binary files /dev/null and b/appsrc/ODS-Blog/templates/digital_bazaar/images/bg_page_title.png differ
diff --git a/appsrc/ODS-Blog/templates/digital_bazaar/images/bg_page_title_inner.jpg b/appsrc/ODS-Blog/templates/digital_bazaar/images/bg_page_title_inner.jpg
new file mode 100755
index 0000000..6603a03
Binary files /dev/null and b/appsrc/ODS-Blog/templates/digital_bazaar/images/bg_page_title_inner.jpg differ
diff --git a/appsrc/ODS-Blog/templates/digital_bazaar/index.vspx b/appsrc/ODS-Blog/templates/digital_bazaar/index.vspx
new file mode 100755
index 0000000..5ef5716
--- /dev/null
+++ b/appsrc/ODS-Blog/templates/digital_bazaar/index.vspx
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ -
+-  $Id: index.vspx,v 1.1.4.4 2010/10/07 13:24:15 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page style="/DAV/VAD/blog2/widgets/main.xsl" name="home"
+        xmlns:vm="http://www.openlinksw.com/vspx/weblog/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+        on-deadlock-retry="5">
+  <vm:page>
+    <vm:header>
+      <vm:page-title title="Weblog home page"/>
+      <vm:disco-rss-link/>
+      <vm:disco-pingback-link/>
+      <vm:disco-comments-link/>
+      <vm:disco-foaf-link/>
+      <vm:disco-rsd-link/>
+      <vm:disco-opml-link/>
+      <vm:meta-owner/>
+      <vm:meta-authors/>
+      <vm:meta-description/>
+      <vm:meta-keywords/>
+      <vm:custom-style />
+    </vm:header>
+    <vm:body xhtml_style="single single-post postid-643">
+      <div id="page" style="text-align: left;">
+      <div id="header">
+      <div class="wrap">
+        <h1>
+              <vm:blog-title  url="index.vspx"/>
+        </h1>
+      </div>
+      <div id="header2">
+<div class="page_title_inner">
+      <div class="wrap">
+<div class="page_title">
+<div class="page_title_inner">
+        <h2>
+          <vm:welcome-message show-once="no"/>
+        </h2>
+	</div>
+                  <div>
+                  <vm:blog-view-switch />| 
+                  <vm:archive-url />
+                  <vm:settings-link title="| Settings" />
+                  <vm:new-post-link title="| New Post" />| 
+                  <vm:advanced-search-link title="Search" /></div>
+	</div>
+	</div>
+	</div>
+	</div>
+      </div>
+      <div class="page-container2">
+      <div class="wrap">
+      <div class="info-column">
+        <div class="block">
+          <div id="welcome">
+            <vm:blog-about/>
+          </div>
+          <div>
+            <vm:about-me/>                
+          </div>
+          <div>
+            <vm:login-info format_string="Logged in as %s."/>
+          </div>
+          <div>
+            <vm:cmds-menu/>
+          </div>
+          <div>
+            <vm:home-url />
+          </div>
+          <div id="selector">
+            <vm:calendar vm:url="index.vspx" />
+            <vm:rss-feeds />
+            <vm:if test="ocs">
+                    <h2>
+                      <vm:ocs-div-title />
+                    </h2>
+              <div class="roll">
+                <vm:ocs/>
+              </div>
+            </vm:if>
+            <vm:if test="opml">
+                    <h2>
+                      <vm:opml-div-title />
+                    </h2>
+              <div class="roll">
+                <vm:opml/>
+              </div>
+            </vm:if>
+          </div>          
+                <div>Search</div>
+          <div>
+            <vm:search />
+          </div>
+                <div>Tag Cloud 
+                <vm:if test="tagid">
+                  <span>
+                    <a href="gems/rss_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"
+                    class="inlinelink">
+                      <img src="/weblog/public/images/rss-icon-16.gif"
+                      border="0" alt="RSS" title="RSS" />
+                    </a>
+                    <a href="gems/atom_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"
+                    class="inlinelink">
+                      <img src="/weblog/public/images/atom-icon-16.gif"
+                      border="0" alt="Atom" title="Atom" />
+                    </a>
+                    <a href="gems/rdf_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"
+                    class="inlinelink">
+                      <img src="/weblog/public/images/rdf-icon-16.gif"
+                      border="0" alt="RDF" title="RDF" />
+                    </a>
+                  </span>
+                </vm:if>
+                <vm:tags top="100" /></div>
+                <div>Post Categories</div>
+          <div>
+            <vm:categories/>
+          </div>
+                <div>Subscribe</div>
+          <div>
+            <vm:subscribe/>
+          </div>
+                <div>Recent Articles</div>
+          <div>
+            <vm:last-messages/>
+          </div>
+          <vm:if test="have_community">
+                  <div>Community Member Blogs</div>
+          <div>
+            <vm:bloggers/>
+          </div>
+          </vm:if>
+          <vm:if test="browse_posts">
+                  <div>Sort options</div>
+            <div>
+              <vm:sort-options />
+            </div>          
+          </vm:if>
+          <vm:if test="fish">
+                  <div>Translate</div>
+          <div>
+            <vm:babel-fish/>
+          </div>
+          </vm:if>
+          <div>
+            <vm:amazon-wishlist-display/>
+          </div>
+          <div>
+            <vm:google-ads/>
+          </div>
+          <div>
+            <vm:etray-ads/>
+          </div>
+          <div id="powered">
+            <vm:powered-by/>
+          </div>
+                <div id="copy">
+                  <vm:copyright />
+                </div>
+                <div id="disclaimer">
+                  <vm:disclaimer />
+                </div>
+        </div>
+      </div>
+      <div id="error">
+        <v:error-summary />
+      </div>
+        <div style="margin-left: 210px;">
+        <vm:posts trackback="discovery" />
+        </div>
+        <div>
+        <vm:comments-view>
+          <vm:trackbacks />
+          <vm:referrals />
+          <vm:related />
+          <vm:comments />
+          <vm:post-comment />
+        </vm:comments-view>
+        </div>
+        </div>
+      </div>      
+      </div>
+    </vm:body>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Blog/templates/digital_bazaar/linkblog.vspx b/appsrc/ODS-Blog/templates/digital_bazaar/linkblog.vspx
new file mode 100755
index 0000000..c6794c6
--- /dev/null
+++ b/appsrc/ODS-Blog/templates/digital_bazaar/linkblog.vspx
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: linkblog.vspx,v 1.1.4.2 2010/09/27 14:45:09 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page style="/DAV/VAD/blog2/widgets/main.xsl"
+        name="home"
+        xmlns:vm="http://www.openlinksw.com/vspx/weblog/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+        on-deadlock-retry="5">
+  <vm:page id="">
+    <vm:header id="header">
+      <title><vm:blog-title url=""/></title>
+      <vm:disco-rss-link/>
+      <vm:disco-atom-link/>
+      <vm:disco-pingback-link/>
+      <vm:disco-comments-link/>
+      <vm:disco-foaf-link/>
+      <vm:disco-rsd-link/>
+      <vm:disco-opml-link/>
+      <vm:meta-owner/>
+      <vm:meta-authors/>
+      <vm:meta-description/>
+      <vm:meta-keywords/>
+      <vm:custom-style />
+    </vm:header>
+    <vm:body xhtml_style="single single-post postid-643">
+      <div id="page" style="text-align: left;">
+        <div id="header">
+          <div class="wrap">
+            <h1>
+              <vm:blog-title url="index.vspx" />
+            </h1>
+          </div>
+          <div id="header2">
+            <div class="page_title_inner">
+              <div class="wrap">
+                <div class="page_title">
+                  <div class="page_title_inner">
+                    <h2>
+                      <vm:welcome-message show-once="no" />
+                    </h2>
+                  </div>
+                  <div>
+                  <vm:blog-view-switch />| 
+                  <vm:archive-url />
+                  <vm:settings-link title="| Settings" />
+                  <vm:new-post-link title="| New Post" />| 
+                  <vm:advanced-search-link title="Search" /></div>
+                </div>
+              </div>
+            </div>
+          </div>
+        </div>
+        <div class="page-container2">
+          <div class="wrap">
+            <div class="info-column">
+              <div class="block">
+                <div id="welcome">
+                  <vm:blog-about />
+                </div>
+                <div>
+                  <vm:about-me />
+                </div>
+                <div>
+                  <vm:login-info format_string="Logged in as %s." />
+                </div>
+                <div>
+                  <vm:cmds-menu />
+                </div>
+                <div>
+                  <vm:home-url />
+                </div>
+                <div id="selector">
+                  <vm:calendar vm:url="index.vspx?page=summary" />
+                  <vm:rss-feeds />
+                  <vm:if test="ocs">
+                    <h2>
+                      <vm:ocs-div-title />
+                    </h2>
+                    <div class="roll">
+                      <vm:ocs />
+                    </div>
+                  </vm:if>
+                  <vm:if test="opml">
+                    <h2>
+                      <vm:opml-div-title />
+                    </h2>
+                    <div class="roll">
+                      <vm:opml />
+                    </div>
+                  </vm:if>
+                </div>
+                <div>Search</div>
+                <div>
+                  <vm:search />
+                </div>
+                <div>Tag Cloud 
+                <vm:if test="tagid">
+                  <span>
+                    <a href="gems/rss_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"
+                    class="inlinelink">
+                      <img src="/weblog/public/images/rss-icon-16.gif"
+                      border="0" alt="RSS" title="RSS" />
+                    </a>
+                    <a href="gems/atom_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"
+                    class="inlinelink">
+                      <img src="/weblog/public/images/atom-icon-16.gif"
+                      border="0" alt="Atom" title="Atom" />
+                    </a>
+                    <a href="gems/rdf_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"
+                    class="inlinelink">
+                      <img src="/weblog/public/images/rdf-icon-16.gif"
+                      border="0" alt="RDF" title="RDF" />
+                    </a>
+                  </span>
+                </vm:if>
+                <vm:tags top="100" /></div>
+                <div>Post Categories</div>
+                <div>
+                  <vm:categories />
+                </div>
+                <div>Subscribe</div>
+                <div>
+                  <vm:subscribe />
+                </div>
+                <div>Recent Articles</div>
+                <div>
+                  <vm:last-messages />
+                </div>
+                <vm:if test="have_community">
+                  <div>Community Member Blogs</div>
+                  <div>
+                    <vm:bloggers />
+                  </div>
+                </vm:if>
+                <vm:if test="browse_posts">
+                  <div>Sort options</div>
+                  <div>
+                    <vm:sort-options />
+                  </div>
+                </vm:if>
+                <vm:if test="fish">
+                  <div>Translate</div>
+                  <div>
+                    <vm:babel-fish />
+                  </div>
+                </vm:if>
+                <div>
+                  <vm:amazon-wishlist-display />
+                </div>
+                <div>
+                  <vm:google-ads />
+                </div>
+                <div>
+                  <vm:etray-ads />
+                </div>
+                <div id="powered">
+                  <vm:powered-by />
+                </div>
+                <div id="copy">
+                  <vm:copyright />
+                </div>
+                <div id="disclaimer">
+                  <vm:disclaimer />
+                </div>
+              </div>
+            </div>
+            <div id="error">
+              <v:error-summary />
+            </div>
+            <div style="margin-left: 210px;">
+				<vm:posts mode="link" table="off">
+				<vm:group-heading>
+					<div class="date_separator"><vm:date /></div>
+				</vm:group-heading>
+				<vm:linkblog-links>
+					<div class="linkblog_link">
+					<vm:linkblog-url/>
+					<div class="tags"><vm:if test="have_categories">under category:</vm:if>
+						<vm:linkblog-categories>
+						<vm:linkblog-category/>
+						</vm:linkblog-categories>
+					</div>
+					<div class="tags">
+						<vm:if test="have_tags">Tags:</vm:if>
+						<vm:linkblog-tags>
+						<vm:linkblog-tag/>
+						</vm:linkblog-tags>
+					</div>
+					</div>
+				</vm:linkblog-links>
+				</vm:posts>
+            </div>
+          </div>
+        </div>
+      </div>
+    </vm:body>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Blog/templates/digital_bazaar/summary.vspx b/appsrc/ODS-Blog/templates/digital_bazaar/summary.vspx
new file mode 100755
index 0000000..4761607
--- /dev/null
+++ b/appsrc/ODS-Blog/templates/digital_bazaar/summary.vspx
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+-
+-  $Id: summary.vspx,v 1.1.4.2 2010/09/22 13:56:49 source Exp $
+-
+-  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+-  project.
+-
+-  Copyright (C) 1998-2006 OpenLink Software
+-
+-  This project is free software; you can redistribute it and/or modify it
+-  under the terms of the GNU General Public License as published by the
+-  Free Software Foundation; only version 2 of the License, dated June 1991.
+-
+-  This program is distributed in the hope that it will be useful, but
+-  WITHOUT ANY WARRANTY; without even the implied warranty of
+-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-  General Public License for more details.
+-
+-  You should have received a copy of the GNU General Public License along
+-  with this program; if not, write to the Free Software Foundation, Inc.,
+-  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-
+-->
+<v:page style="/DAV/VAD/blog2/widgets/main.xsl" name="home"
+xmlns:vm="http://www.openlinksw.com/vspx/weblog/"
+xmlns:v="http://www.openlinksw.com/vspx/"
+doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+on-deadlock-retry="5">
+  <vm:page id="">
+    <vm:header id="header">
+      <title>
+        <vm:blog-title url="" />
+      </title>
+      <vm:disco-rss-link />
+      <vm:disco-atom-link />
+      <vm:disco-pingback-link />
+      <vm:disco-comments-link />
+      <vm:disco-foaf-link />
+      <vm:disco-rsd-link />
+      <vm:disco-opml-link />
+      <vm:meta-owner />
+      <vm:meta-authors />
+      <vm:meta-description />
+      <vm:meta-keywords />
+      <vm:custom-style />
+    </vm:header>
+    <vm:body xhtml_style="single single-post postid-643">
+      <div id="page" style="text-align: left;">
+        <div id="header">
+          <div class="wrap">
+            <h1>
+              <vm:blog-title url="index.vspx" />
+            </h1>
+          </div>
+          <div id="header2">
+            <div class="page_title_inner">
+              <div class="wrap">
+                <div class="page_title">
+                  <div class="page_title_inner">
+                    <h2>
+                      <vm:welcome-message show-once="no" />
+                    </h2>
+                  </div>
+                  <div>
+                  <vm:blog-view-switch />| 
+                  <vm:archive-url />
+                  <vm:settings-link title="| Settings" />
+                  <vm:new-post-link title="| New Post" />| 
+                  <vm:advanced-search-link title="Search" /></div>
+                </div>
+              </div>
+            </div>
+          </div>
+        </div>
+        <div class="page-container2">
+          <div class="wrap">
+            <div class="info-column">
+              <div class="block">
+                <div id="welcome">
+                  <vm:blog-about />
+                </div>
+                <div>
+                  <vm:about-me />
+                </div>
+                <div>
+                  <vm:login-info format_string="Logged in as %s." />
+                </div>
+                <div>
+                  <vm:cmds-menu />
+                </div>
+                <div>
+                  <vm:home-url />
+                </div>
+                <div id="selector">
+                  <vm:calendar vm:url="index.vspx?page=summary" />
+                  <vm:rss-feeds />
+                  <vm:if test="ocs">
+                    <h2>
+                      <vm:ocs-div-title />
+                    </h2>
+                    <div class="roll">
+                      <vm:ocs />
+                    </div>
+                  </vm:if>
+                  <vm:if test="opml">
+                    <h2>
+                      <vm:opml-div-title />
+                    </h2>
+                    <div class="roll">
+                      <vm:opml />
+                    </div>
+                  </vm:if>
+                </div>
+                <div>Search</div>
+                <div>
+                  <vm:search />
+                </div>
+                <div>Tag Cloud 
+                <vm:if test="tagid">
+                  <span>
+                    <a href="gems/rss_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"
+                    class="inlinelink">
+                      <img src="/weblog/public/images/rss-icon-16.gif"
+                      border="0" alt="RSS" title="RSS" />
+                    </a>
+                    <a href="gems/atom_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"
+                    class="inlinelink">
+                      <img src="/weblog/public/images/atom-icon-16.gif"
+                      border="0" alt="Atom" title="Atom" />
+                    </a>
+                    <a href="gems/rdf_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"
+                    class="inlinelink">
+                      <img src="/weblog/public/images/rdf-icon-16.gif"
+                      border="0" alt="RDF" title="RDF" />
+                    </a>
+                  </span>
+                </vm:if>
+                <vm:tags top="100" /></div>
+                <div>Post Categories</div>
+                <div>
+                  <vm:categories />
+                </div>
+                <div>Subscribe</div>
+                <div>
+                  <vm:subscribe />
+                </div>
+                <div>Recent Articles</div>
+                <div>
+                  <vm:last-messages />
+                </div>
+                <vm:if test="have_community">
+                  <div>Community Member Blogs</div>
+                  <div>
+                    <vm:bloggers />
+                  </div>
+                </vm:if>
+                <vm:if test="browse_posts">
+                  <div>Sort options</div>
+                  <div>
+                    <vm:sort-options />
+                  </div>
+                </vm:if>
+                <vm:if test="fish">
+                  <div>Translate</div>
+                  <div>
+                    <vm:babel-fish />
+                  </div>
+                </vm:if>
+                <div>
+                  <vm:amazon-wishlist-display />
+                </div>
+                <div>
+                  <vm:google-ads />
+                </div>
+                <div>
+                  <vm:etray-ads />
+                </div>
+                <div id="powered">
+                  <vm:powered-by />
+                </div>
+                <div id="copy">
+                  <vm:copyright />
+                </div>
+                <div id="disclaimer">
+                  <vm:disclaimer />
+                </div>
+              </div>
+            </div>
+            <div id="error">
+              <v:error-summary />
+            </div>
+            <div style="margin-left: 210px;">
+              <vm:posts mode="summary">
+                <vm:summary-group-heading>
+                  <div class="date_separator">
+                    <vm:date />
+                  </div>
+                </vm:summary-group-heading>
+                <div class="summary_post">
+                  <div class="post">
+                    <vm:summary-post-header />
+                  </div>
+                  <div class="post-excerpt">
+                    <vm:summary-post />
+                  </div>
+                  <vm:summary-post-tags />
+                </div>
+              </vm:posts>
+            </div>
+          </div>
+        </div>
+      </div>
+    </vm:body>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Blog/templates/main.vspx b/appsrc/ODS-Blog/templates/main.vspx
index 6915bb5..46f2a92 100644
--- a/appsrc/ODS-Blog/templates/main.vspx
+++ b/appsrc/ODS-Blog/templates/main.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: main.vspx,v 1.4 2008/02/19 11:01:44 source Exp $
+ -  $Id: main.vspx,v 1.4.2.1 2010/09/20 10:14:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/micro/default.css b/appsrc/ODS-Blog/templates/micro/default.css
new file mode 100644
index 0000000..f29b355
--- /dev/null
+++ b/appsrc/ODS-Blog/templates/micro/default.css
@@ -0,0 +1,1170 @@
+/*
+ *  $Id: default.css,v 1.1.4.2 2010/12/07 10:59:24 source Exp $
+ *
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *
+ *  Copyright (C) 1998-2010 OpenLink Software
+ *
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/* template: openlink */
+
+body {
+  margin: 0;
+  padding: 0;
+  border: 1px solid darkgray;
+  font-size: 0.7em;
+  font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
+  background-color: #D9D6CB;
+  color: Black;
+  z-index: 0;
+}
+
+h1 {
+  margin: 0px;
+  margin-top: 7px; margin-bottom: 5px;
+  font-size: 1.8em;
+  text-align: left;
+}
+
+h2 {
+  margin: 0px;
+  font-size: 1em;
+  text-align: left;
+  padding: 4px;
+}
+
+a {
+  font-family: Verdana, Geneva, Arial, Sans-Serif;
+  text-decoration: none;
+}
+a:active { text-decoration: none }
+a:visited { text-decoration: none }
+a:hover { text-decoration: underline }
+
+#header {
+  margin: 0px;
+  background-color : white;
+  background-image: url(/weblog/public/images/blogbanner_blank_sml.jpg);
+  background-repeat: no-repeat;
+  color: #7eb4cf;
+  text-align: left;
+  width: 100%;
+}
+#header h1, #header h2 {
+  font-family: "Trebuchet MS";
+  margin-top: 0px;
+  margin-bottom: 0px;
+  padding-top: 15px;
+  padding-left: 10px;
+}
+#header h2 {
+  padding-top: 10px;
+  font-size: 1em;
+}
+#navbartop {
+  font-size: 0.8em;
+  text-align: right;
+  background: #7eb4cf;
+  color: #eeeeee;
+  margin: 0px;
+  padding-top: 0px;
+  padding-bottom: 3px;
+  width: 100%;
+}
+#navbartop div {
+    padding-right: 1em;
+    border-top: 1px #dddddd solid;
+}
+#navbartop input { padding: 0px; margin: 0px; font-family: inherit; font-size: 100%; }
+#navbartop a {
+  background: #7eb4cf;
+  color: #eeeeee;
+}
+
+form
+{
+  display: inline;
+  width: 0px;
+  padding: 0px;
+  margin: 0px;
+}
+
+.textbox, textarea, select, .button, .real_button
+{
+  font-family: Verdana, Geneva, Arial, Sans-Serif;
+  font-size: 100%;
+  border: 1px solid #AAAAAA;
+}
+
+.button
+{
+  padding-top: 1px;
+  border: none;
+  background-color: inherit;
+}
+
+.real_button
+{
+  background-color: #CCD4E0;
+}
+
+#error {
+  color: red;
+  font-weight: bold;
+  background-color: white;
+  text-align: center;
+}
+#error_left {
+  color: red;
+  font-weight: bold;
+  background-color: white;
+  text-align: left;
+}
+
+#left div.button a {
+  font-size: 0.9em;
+  font-family: Tahoma, Verdana, Geneva, Arial, Helvetica, sans-serif;
+  display: inline;
+}
+#right div.button {
+  padding-left: 6px;
+}
+
+#pagecontainer {
+  padding: 0px;
+  margin: 0px;
+  border-collapse: collapse;
+  border: 0px;
+  background: inherit;
+  color: black;
+  float:left;
+}
+
+div.box { width: 200px;
+}
+
+td.box {
+  width: 200px;
+  background: white;
+}
+td.box, #texttd {vertical-align: top;
+}
+
+td.box div#title {
+  border: none;
+  margin: 0px;
+  padding: 0px;
+}
+
+#texttd {
+  width: auto;
+  border-bottom: 1px solid #DDDDDD;
+  /*border-top: 1px solid black;*/
+  padding: 10px;
+  background: white;
+  vertical-align: top;
+  text-align: left;
+}
+
+#texttop {
+  border-color: #99B3C5;
+  border-style: solid;
+  border-width: 0px 0px 1px 0px;
+  background: white;
+  padding: 2px;
+  color: #033566;
+}
+
+#right {
+  border-bottom: 1px solid #DDDDDD;
+  /*border-top: 1px solid black;*/
+}
+#left {
+  /*border-top: 1px solid black;*/
+  border-right: 1px solid #DDDDDD;
+  background-color: #efefef;
+  color: black;
+}
+#left a:active,
+#left a:visited,
+#left a:link {
+  display : block;
+  border: solid 1px #efefef;
+  color : #000;
+  text-decoration : none;
+  margin-right : 10px;
+  padding : 2px;
+}
+#left a:hover {
+  background-color : #CCD5E0;
+  border: solid 1px silver;
+}
+
+#left a.button:hover {
+  background-color: #efefef;
+  display : block;
+  border: solid 1px #efefef;
+  color : #000;
+  text-decoration : none;
+  margin-right : 10px;
+  padding : 2px;
+}
+
+.login, .login th, .login td {
+  background-color: #efefef;
+  color: black;
+}
+.login th { text-align: right; }
+
+.roll {
+  margin: 0px;
+  padding-left: 5px;
+  padding-bottom: 6px;
+  padding-top: 0px;
+  width: 195px;
+}
+
+div.box h2 {
+  border-bottom: 1px solid #bbbbbb;
+}
+
+ul.last-messages {
+  padding: 2px;
+  list-style-type: none}
+
+#texttd h2 {
+  border-bottom: 1px solid #bbbbbb;
+  padding-bottom: 0.5em;
+}
+.comment {
+  padding-top: 1em;
+  /*text-align: right;*/
+}
+
+.desc {
+    font-family: inherit;
+    font-size: inherit;
+ }
+.postcomment table {
+  margin-bottom: 1em;
+ }
+.postcomment th {
+  text-align: right;
+ }
+.postcomment .note {
+  padding: 0.3em;
+  font-size: 1em;
+  font-family: Tahoma, sans-serif;
+}
+.note {
+  width: 180px;
+  }
+
+#inline {
+  display: inline;
+}
+
+#calendar {
+ margin-top: 2em;
+ margin-bottom: 2em;
+ font-size: 0.9em;
+ font-family: Tahoma, sans-serif;
+ text-align: center;
+ border-collapse: collapse;
+ border: 1px solid #DDDDDD;
+ }
+#calendar td, #calendar th { padding: 1px;}
+.calactive {
+   background: url("/weblog/public/images/blog-active.png");
+   background-repeat: no-repeat;
+   background-position: center;
+   color: white;
+ }
+.calactive a {
+   color: white;
+ }
+.calnotactive a {
+   text-decoration: none;
+ }
+.caltoday {
+   background: url("/weblog/public/images/blog-today.png");
+   background-repeat: no-repeat;
+   background-position: center;
+   color: white;
+ }
+.caltoday a {
+   color: white;
+ }
+.calselected {
+   color: white;
+   border:1px solid #000000;
+ }
+.calselected a {
+   color: white;
+ }
+.tb-url, .tb-url a {
+  font-family:georgia, verdana, arial, sans-serif;
+  color:#666;
+  font-size:1em;
+  font-weight:normal;
+  background:inherit;
+  padding: 0.3em;
+  width: 100%;
+}
+.tb-url .url {
+  color: #065;
+  background: inherit;
+  position: absolute;
+  width: 100%;
+  left: 500px;
+}
+#left div.smallfeedlink a {
+  font-size: 0.9em;
+  font-family: Tahoma, Verdana, Geneva, Arial, Helvetica, sans-serif;
+  display: inline;
+}
+#right div.smallfeedlink, #right div.channellink {
+  padding-left: 6px;
+}
+#right div.channellink {
+  font-size: 0.9em;
+  font-family: Tahoma, Verdana, Geneva, Arial, Helvetica, sans-serif;
+  font-weight: bold;
+}
+a:active.feedlink,
+a:visited.feedlink,
+a:link.feedlink,
+#left a:active.feedlink,
+#left a:visited.feedlink,
+#left a:link.feedlink,
+a:active.smallfeedlink,
+a:visited.smallfeedlink,
+a:link.smallfeedlink,
+#left a:active.smallfeedlink,
+#left a:visited.smallfeedlink,
+#left a:link.smallfeedlink
+  {
+  font-size: 1em;
+  background: #ff6800;
+  font-weight: bold;
+  color: white;
+  border-top: 1px outset white;
+  border-left: 1px outset white;
+  border-right: 1px outset black;
+  border-bottom: 1px outset black;
+  padding: 0px;
+  padding-left: 2px;
+  padding-right: 2px;
+  margin: 0px;
+  text-align: center;
+  display: inline;
+}
+a:active.smallfeedlink,
+a:visited.smallfeedlink,
+a:link.smallfeedlink,
+#left a:active.smallfeedlink,
+#left a:visited.smallfeedlink,
+#left a:link.smallfeedlink
+  {
+  font-size: 0.7em;
+  background: #ff6800;
+  width: 1.5em;
+}
+#left a.inlinelink
+{
+  border: none;
+  display: inline;
+  padding: 0px;
+  margin: 0px;
+}
+#powered, #copy, #disclaimer{
+  background-color: #efefef;
+  color: black;
+  text-align: center;
+  margin: 0px;
+  width: 100%;
+  padding: 0px;
+  font-size: 0.7em;
+}
+#powered {
+  font-size: 1.1em;
+  padding-top: 10px;
+}
+#disclaimer {
+  padding-bottom: 20px;
+}
+
+table.data
+{
+    margin-top: 2em;
+    margin-bottom: 3em;
+    border-top: #cccccc 1px solid;
+    border-collapse: collapse
+}
+table.data tr th
+{
+    border-right: #cccccc 1px solid;
+    border-left: #cccccc 1px solid;
+    border-bottom: #cccccc 1px solid;
+    background-color: #eeeeee;
+  color: black;
+}
+table.data tr td
+{
+    border-right: #cccccc 1px solid;
+    font-weight: normal;
+    border-left: #cccccc 1px solid;
+    border-bottom: #cccccc 1px solid
+}
+caption
+{
+    background: inherit;
+    color: navy;
+    font-family: tahoma, sans-serif;
+    font-size: 8pt;
+  margin: 0px;
+  padding: 0px;
+}
+table.formdata, table.formdatav
+{
+    margin-top: 2em;
+    margin-bottom: 3em;
+    border-collapse: collapse
+}
+table.formdata tr th, table.formdatav tr th
+{
+  color: black;
+}
+table.formdatav tr th
+{
+  text-align: right;
+  padding: 2px;
+}
+table.formdata tr th
+{
+  text-align: left;
+  padding: 2px;
+}
+table.formdata tr td, table.formdatav tr td
+{
+  font-weight: normal;
+  padding: 2px;
+}
+
+table.formdata label
+{
+  font-weight: bold;
+}
+
+div.posts-title {
+  margin-top: 6px;
+  margin-bottom: 6px;
+  font-size: 120%;
+  font-weight: bold;
+}
+
+div.message {
+  background:#fff;
+  color: black;
+  padding: 5px;
+  margin: 0px;
+  margin-bottom: 2em;
+  padding-top: 0px;
+  border: 1px solid #DDDDDD;
+  border-right: 2px solid #efefef;
+  border-bottom: 2px solid #efefef;
+ }
+
+div.widget-title {
+  width: auto;
+}
+
+
+div.post-title {
+  margin-top: 6px;
+  margin-bottom: 6px;
+  font-size: 120%;
+  font-weight: bold;
+}
+
+div.post-content {
+  font-size: 1.0em;
+}
+
+
+div.pubdate {
+    font-family: Tahoma, 'Andale Mono', 'Lucida Console', monospace;
+  font-size: 1em;
+  text-align: right;
+    background: white;
+    color: black; /*silver;*/
+    border-top: 1px solid silver;
+ }
+
+div.spread_links
+{
+  padding-top: 1em;
+  text-align: left;
+}
+
+div.post-actions {
+  padding-top: 1em;
+  text-align: right;
+}
+
+div.nav-column {
+  position: absolute;
+  left: 0px;
+  width: 200px;
+  padding: 6px;
+  padding-left: 65px;
+}
+
+div.page-container {
+  text-align: left;
+  padding: 6px;
+  margin: auto;
+  padding-left: 200px;
+  padding-right: 180px;
+  background: white;
+}
+
+/* Tabbed page - begin */
+.tab_page
+{
+    font-size: 100%;
+    border-left: solid 1px black;
+    border-right: solid 1px black;
+    border-bottom: solid 1px black;
+    background-color: white;
+    padding-left: 10px;
+    padding-right: 10px;
+    color: black;
+    width: 100%;
+}
+.page_tab
+{
+    font-size: 100%;
+    background-color: #eaeaea;
+    text-align: left;
+    white-space: nowrap;
+    padding: 2px;
+    border: 1px solid black;
+}
+.page_tab_empty
+{
+    white-space: nowrap;
+    border-bottom:1px solid black;
+    border-left:1px solid black;
+    border-right:0;
+    border-top:0;
+}
+.page_tab_selected
+{
+    white-space: nowrap;
+    font-size: 100%;
+    background-color: white;
+    text-align: left;
+    padding: 2px;
+    border-top:1px solid black;
+    border-left:1px solid black;
+    border-right:1px solid black;
+    border-bottom:0
+}
+.page_tab a
+{
+  color: black;
+  text-decoration: none;
+}
+.page_tab a:hover
+{
+  color: black;
+  text-decoration: underline;
+}
+
+/* Tabbed page - end */
+
+
+table.listing
+{
+  width: 100%;
+  background-color: white;
+}
+
+table.listing th
+{
+  background-color: #BBBBBB;
+  border-color: #FFFFFF;
+  border-style: solid;
+  border-width: 0px 0px 0px 1px;
+  padding: 2px;
+}
+
+
+tr.listing_header_row
+{
+}
+
+/* Listing-related commands - top and bottom */
+
+div.listing_top_ctl_grp
+{
+  text-align: right;
+  padding-left: 5px;
+  padding-right: 5px;
+  padding-top: 2px;
+  padding-bottom: 2px;
+  border-top: 2pt solid green;
+  background-color: #d0d0d0;
+}
+
+div.listing_bot_ctl_grp
+{
+  text-align: right;
+  padding-left: 5px;
+  padding-top: 2px;
+  padding-bottom: 2px;
+  padding-right: 5px;
+  border-bottom: 2pt solid green;
+  background-color: #d0d0d0;
+}
+
+/* see resroweven and resrowodd et al for formatting result tables
+     generated by adm_result_to_table (used in ISQL.) */
+
+tr.listing_row_even
+{
+}
+
+tr.listing_row_odd
+{
+  background-color: #f0f0f0;
+}
+
+td.listing_column
+{
+}
+
+td.listing_col
+{
+}
+
+td.listing_col_num
+{
+  text-align: right;
+}
+
+td.listing_col_action
+{
+  white-space: nowrap;
+}
+
+td.listing_count
+{
+  font-weight: bold;
+}
+
+td.listing_col_action a
+{
+  text-decoration: none;
+}
+
+span.listing_hdr_qual
+{
+  font-size: smaller;
+}
+
+.code_listing
+{
+  font-family: courier, fixed;
+}
+.copyright
+{
+  font-size: 9px;
+  text-align: right;
+  padding-right: 15px;
+  color: #666666;
+}
+
+.date_separator
+{
+    padding-top: 5px;
+    font-size: 110%;
+    font-weight: bold;
+    border-bottom: 1px solid gray;
+}
+
+#texttd li
+{
+   margin-left: 10px;
+}
+
+.crumbs_cur
+{
+  font-family: Verdana, Arial, Sans-Serif;
+  text-decoration: none;
+  color: black;
+  font-size: 10pt;
+  font-weight: bold;
+}
+
+.crumbs
+{
+  font-family: Verdana, Arial, Sans-Serif;
+  text-decoration: none;
+  color: #033566;
+  font-size: 10pt;
+  font-weight: bold;
+}
+
+.linkblog_tags td
+{
+    padding-left: 2px;
+    padding-right: 2px;
+}
+
+.scroll_area
+{
+  background-color: white;
+  height: 20em;
+  width: auto;
+  margin-right:12px;
+  overflow: auto;
+}
+
+div.tags
+{
+  margin-left: 25px;
+}
+
+
+div.message div.tags
+{
+  text-align: left;
+  border-top: 1px solid silver;
+  margin-top: 5px;
+  margin-left: 0px;
+}
+
+
+.right
+{
+    padding-top: 15px;
+    color: #7eb4cf;
+    font-size: 110%;
+    font-family: "Trebuchet MS";
+    font-weight: bold;
+    text-align: right;
+}
+
+.right input
+{
+    font-size: 100%;
+    font-weight: normal;
+}
+
+.right a,
+.right a:hover,
+.right a:visited,
+.right a:active
+{
+    text-decoration: none;
+    color: #7eb4cf;
+}
+
+#login-info-ctr
+{
+    display: inline;
+}
+
+.login_link
+{
+    display: inline;
+}
+
+#login_btn
+{
+    display: inline;
+}
+
+#login_btn:before
+{
+    content: " ";
+}
+
+
+div.login_link:before
+{
+    content: " | ";
+}
+
+a.blog_selected
+{
+   color: gray!important;
+}
+
+#arch_crumbs a
+{
+  font-weight: bold;
+  margin-left: 5px;
+}
+
+a.smallatomlink,
+a:active.smallatomlink,
+a:visited.smallatomlink,
+a:link.smallatomlink
+  {
+  font-size: 0.7em;
+  background: #1a5aff;
+  font-weight: bold;
+  color: white;
+  border-top: 1px outset white;
+  border-left: 1px outset white;
+  border-right: 1px outset black;
+  border-bottom: 1px outset black;
+  padding: 0px;
+  padding-left: 2px;
+  padding-right: 2px;
+  margin: 0px;
+  text-align: center;
+  display: inline;
+}
+
+div#arch_gems
+{
+    margin-top: 5px;
+    margin-left: 40px;
+}
+
+#search_button
+{
+    vertical-align: middle;
+}
+
+ul.cmds-menu {
+  list-style-type: none;
+  padding: 0}
+
+ul.cmds-menu li {
+  padding: 0}
+
+ul.cmds-menu li a {
+  display: block;
+  border: 1px #333 outset;}
+
+div.summary_post
+{
+  margin-bottom: 5px;
+}
+
+div.linkblog_link
+{
+  margin-bottom: 5px;
+}
+
+a.title_link
+{
+  color: #7eb4cf;
+  margin-left: 70px;
+}
+
+div.individual  {
+    font-family:verdana, arial, sans-serif;
+    font-weight: normal;
+    font-size:11px;
+    color:#333;
+    line-height:16px;
+    text-decoration: none;
+    overflow: hidden;
+    background: #f3f4ec;
+    padding: 5px 10px 5px 10px;
+    border-top: 1px solid #717543;
+    border-bottom: 1px solid #717543;
+    margin: 30px;
+}
+
+
+div.individual p {
+    font-family:verdana, arial, sans-serif;
+    font-weight: normal;
+    font-size:11px;
+    color:#111;
+    line-height:16px;
+}
+
+tr.search_result_header
+{
+  background-color: #eeeeee;
+}
+
+
+div.cm_node_top
+{
+  padding-left: 1em;
+  margin-left: 0px;
+}
+
+div.cm_node
+{
+  padding-left: 1em;
+  margin-left: 0px;
+  border-left: 2px #e0e0e0 solid;
+}
+
+div.comment
+{
+  margin: 3px;
+  /*background: #f5f5f5;*/
+}
+
+a.cmd
+{
+  border: 1px #aaaaaa solid;
+  background: #cccccc;
+  margin: 1px;
+/*  padding: 0px;
+  margin-top: 1px;
+  float: right;
+  clear: left;*/
+}
+a.cmd:hover
+{
+  border: 1px #aaaaaa solid;
+  background: #aaaaaa;
+}
+
+div.comment-footer
+{
+    margin: 1px;
+    color: gray;
+}
+
+div.comment-header
+{
+   border-bottom: 1px #cccccc solid;
+   font-size: 110%;
+}
+
+a.rss-link
+{
+}
+
+a.atom-link
+{
+}
+
+a.rdf-link
+{
+}
+
+a.mrss-link
+{
+}
+
+a.itunes-link
+{
+}
+
+a.podcast-link
+{
+}
+
+a.opml-link
+{
+}
+
+a.ocs-link
+{
+}
+
+a.xbel-link
+{
+}
+
+a.foaf-link
+{
+}
+
+a.linkblog-rss-link
+{
+}
+
+a.linkblog-atom-link
+{
+}
+
+a.linkblog-rdf-link
+{
+}
+
+
+a.summary-opml-link
+{
+}
+
+a.summary-ocs-link
+{
+}
+
+a.summary-xbel-link
+{
+}
+
+#tags_cloud
+{
+}
+
+#tags_cloud a,
+#tags_cloud a:active,
+#tags_cloud a:visited,
+#tags_cloud a:link,
+#tags_cloud a:hover
+{
+  font: 1em Arial, Verdana, Geneva, Helvetica, sans-serif;
+  display: inline;
+  border: none;
+  color: blue;
+  margin: 0px;
+  padding: 2px;
+  background-color: transparent;
+}
+
+#tags_cloud a:hover
+{
+    text-decoration: underline;
+}
+
+#HD-ODS-BAR
+{
+  padding-bottom:0px;
+}
+
+#ods-bar-sep
+{
+   display: none;
+}
+
+ul.tab_bar {
+	margin: 0px;
+	margin-top: 3px;
+	padding: 0px;
+	list-style-type: none;
+	border-bottom: 1px solid #333;
+}
+ul.tab_bar li {
+	display: inline;
+	width: 40px;
+	border: 1px solid #333;
+	border-bottom: none;
+	background-color: #ddd;
+  padding-left: 0px;
+  padding-right: 0px;
+
+}
+
+ul.tab_bar .tab_selected {
+	margin: 0px;
+	margin-top: 3px;
+	padding: 0px;
+	border-bottom: 1px solid #fff;
+	background-color: #fff;
+  padding-left: 0px;
+  padding-right: 0px;
+}
+
+ul.tab_bar li a {
+	text-decoration: none;
+	color: inherit;
+	margin-left: 8px;
+	margin-right: 8px;
+}
+
+div.tab_deck {
+	border: 1px solid #333;
+	border-top: none;
+	background-color: #fff;
+	padding-top: 8px;
+	float: left;
+	clear: both;
+	width: 100%;
+}
+
+
+.w_content .tab_bar {
+	margin: 0px;
+	margin-top: 3px;
+	padding: 0px;
+	list-style-type: none;
+	border-bottom: 1px solid #333;
+}
+.w_content .tab_bar li {
+	display: inline;
+	width: 40px;
+	border: 1px solid #333;
+	border-bottom: none;
+	background-color: #ddd;
+}
+
+ul.tab_bar .tab_selected {
+	border-bottom: 1px solid #fff;
+	background-color: #fff;
+}
+
+.w_content .tab_bar li a {
+	text-decoration: none;
+	color: inherit;
+	margin-left: 8px;
+	margin-right: 8px;
+	margin-top: 8px;
+}
+
+.tab_deck {
+	border: 1px solid #333;
+	border-top: none;
+	background-color: #fff;
+	padding-top: 8px;
+	float: left;
+	clear: both;
+	width: 100%;
+}
+
+
+a.collapsible {
+    padding-left: 15px;
+    background: url(/weblog/public/images/expanded.gif) 5px 75% no-repeat;
+}
+
+a.collapsed {
+    padding-left: 15px;
+    background: url(/weblog/public/images/collapsed.gif) 5px 75% no-repeat;
+}
+
+
+.tweetmeme_button {
+      float:left;
+      padding: 0 5pt 0 0; 
+}
+
+
+#mpta { display: block; }
+#mpb { margin: 3px; }
+div.post-content { font-size: 13pt; }
+div.pubdate { border: none; display: inline; font-size: 10pt; }
+div.post-actions { border: none; display: inline; text-align: left; font-size: 10pt; }
+
+                            
diff --git a/appsrc/ODS-Blog/templates/micro/index.vspx b/appsrc/ODS-Blog/templates/micro/index.vspx
new file mode 100644
index 0000000..8f85d8b
--- /dev/null
+++ b/appsrc/ODS-Blog/templates/micro/index.vspx
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: index.vspx,v 1.1.4.2 2010/12/07 10:59:24 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2010 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page style="/DAV/VAD/blog2/widgets/main.xsl"
+        name="home"
+        xmlns:vm="http://www.openlinksw.com/vspx/weblog/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+        on-deadlock-retry="5">
+  <vm:page>
+    <vm:header id="header">
+      <title><vm:title/></title>
+      <vm:disco-rss-link/>
+      <vm:disco-atom-link/>
+      <vm:disco-pingback-link/>
+      <vm:disco-comments-link/>
+      <vm:disco-foaf-link/>
+      <vm:disco-rsd-link/>
+      <vm:disco-opml-link/>
+      <vm:disco-ods-sioc-link/>
+      <vm:meta-owner/>
+      <vm:meta-authors/>
+      <vm:meta-description/>
+      <vm:meta-keywords/>
+      <vm:custom-style />
+      <vm:erdf-data />
+      <!-- add your custom JavaScript code here -->
+      <!-- end -->
+    </vm:header>
+    <vm:body>
+      <table id="pagecontainer" cellspacing="0" cellpadding="0" width="100%" typeof="sioct:Weblog">
+       <vm:attr name="about" value="blog-iri" />
+        <tr>
+	    <td colspan="3">
+		<table id="header" cellpadding="0" cellspacing="0">
+		    <tr>
+			<td>
+			    <h1><vm:blog-title url="index.vspx" /></h1>
+			</td>
+			<td class="right">
+			    <vm:login-info format_string="%s"/>
+			</td>
+		    </tr>
+		    <tr>
+			<td>
+			    <h2>
+				<vm:welcome-message show-once="no"/>
+			    </h2>
+
+			</td>
+			<td class="right">
+			    <vm:weblog-button/> 
+			    <vm:settings-link title="| Settings "/>
+			    | <vm:advanced-search-link title="Search"/>
+			    <vm:search/>
+			</td>
+		    </tr>
+		</table>
+	      <div id="navbartop">
+	      </div>
+	      <div id="error">
+		  <v:error-summary />
+	      </div>
+          </td>
+        </tr>
+        <tr>
+          <td class="box" id="left">
+            <div class="box">
+              <h2>Details</h2>
+              <div class="roll">
+                <vm:about-me/>
+              </div>
+              <h2>Subscribe</h2>
+              <div class="roll">
+		  <vm:atom-link>Atom <vm:atom-version /></vm:atom-link>
+		  <vm:rss-link>RSS <vm:rss-version/></vm:rss-link>
+		  <vm:rdf-link>RDF RSS 1.0</vm:rdf-link>
+		  <vm:sioc-link format="rdf">SIOC (RDF/XML)</vm:sioc-link>
+		  <vm:sioc-link format="ttl">SIOC (N3/Turtle)</vm:sioc-link>
+              </div>
+	    <div class="box">
+	    </div>
+              <div class="roll">
+              </div>
+              <vm:if test="browse_posts">
+                <h2>Display Settings</h2>
+                <div class="roll">
+                  <vm:sort-options />
+                </div>
+              </vm:if>
+              <vm:if test="fish">
+                <h2>Translate</h2>
+                <div class="roll">
+                  <vm:babel-fish/>
+                </div>
+              </vm:if>
+            </div>
+          </td>
+          <td id="texttd">
+	      <vm:micro-post title="What are you doing?"/>
+	      <vm:posts>
+		  <div class="message" typeof="sioct:BlogPost">
+		      <vm:attr name="about" value="permalink-iri" />
+		      <div class="post-content">
+			  <vm:post-author-nick format="" />
+			  <vm:post-title />
+		      </div>
+			  <div class="pubdate">
+			      <vm:post-date/>
+			  </div>
+			  <div class="post-actions">
+			      <vm:micropost-actions />
+			  </div>
+		  </div>
+	      </vm:posts>
+          </td>
+          <td class="box" id="right">
+          </td>
+        </tr>
+        <tr>
+          <td colspan="3">
+            <div id="powered"><vm:powered-by/></div>
+            <div id="copy"><vm:copyright/></div>
+            <div id="disclaimer"><vm:disclaimer/></div>
+          </td>
+        </tr>
+      </table>
+    </vm:body>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Blog/templates/modern/default.css b/appsrc/ODS-Blog/templates/modern/default.css
index 1ca23e1..70376aa 100644
--- a/appsrc/ODS-Blog/templates/modern/default.css
+++ b/appsrc/ODS-Blog/templates/modern/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2.2.1 2009/07/01 10:31:49 source Exp $
+ *  $Id: default.css,v 1.2.2.2 2010/09/20 10:14:45 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/modern/index.vspx b/appsrc/ODS-Blog/templates/modern/index.vspx
index 3b1fe8e..9b8a651 100644
--- a/appsrc/ODS-Blog/templates/modern/index.vspx
+++ b/appsrc/ODS-Blog/templates/modern/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:49 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/modern/red.css b/appsrc/ODS-Blog/templates/modern/red.css
index 9b8e0bd..2a9839f 100644
--- a/appsrc/ODS-Blog/templates/modern/red.css
+++ b/appsrc/ODS-Blog/templates/modern/red.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: red.css,v 1.3.2.1 2009/07/01 10:31:49 source Exp $
+ *  $Id: red.css,v 1.3.2.2 2010/09/20 10:14:46 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/newspaper_view/archive.vspx b/appsrc/ODS-Blog/templates/newspaper_view/archive.vspx
new file mode 100755
index 0000000..d536cde
--- /dev/null
+++ b/appsrc/ODS-Blog/templates/newspaper_view/archive.vspx
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: archive.vspx,v 1.1.4.2 2010/09/22 13:56:49 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page style="/DAV/VAD/blog2/widgets/main.xsl"
+        name="home"
+        xmlns:vm="http://www.openlinksw.com/vspx/weblog/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+        on-deadlock-retry="5">
+  <vm:page>
+    <vm:header id="header">
+      <title><vm:blog-title url=""/></title>
+      <vm:disco-rss-link/>
+      <vm:disco-atom-link/>
+      <vm:disco-pingback-link/>
+      <vm:disco-comments-link/>
+      <vm:disco-foaf-link/>
+      <vm:disco-rsd-link/>
+      <vm:disco-opml-link/>
+      <vm:meta-owner/>
+      <vm:meta-authors/>
+      <vm:meta-description/>
+      <vm:meta-keywords/>
+      <vm:custom-style />
+    </vm:header>
+    <vm:body xhtml_style="single single-post postid-643">
+      <div id="page" style="text-align: left;">
+        <div id="header">
+          <div style="height: 80px; overflow: hidden; min-width:960px;">
+            <div style="font-family: Georgia; line-height: 1; font-size: 44px; white-space: nowrap;"
+            class="paper-title">
+              <vm:blog-title url="index.vspx" />
+            </div>
+            <div id="welcome">
+              <vm:blog-about />
+            </div>
+          </div>
+          <div id="header2">
+            <div class="page_title_inner">
+              <vm:welcome-message show-once="no" />
+            </div>
+			  <div>
+				<vm:blog-view-switch/>
+				| <vm:archive-url />
+				<vm:settings-link title="| Settings"/>
+				<vm:new-post-link title="| New Post" />
+				| <vm:advanced-search-link title="Search"/>
+            </div>
+          </div>
+        </div>
+        <div class="page-container2">
+          <div style="width: 47em;float:left;margin-left:0;">
+            <div>
+				  <vm:archive/>
+				  <vm:posts mode="archive">
+				<vm:summary-group-heading>
+					<div class="date_separator"><vm:date /></div>
+				</vm:summary-group-heading>
+				<div style="margin-bottom: 5px;">
+					<div class="post">
+					<vm:archive-post-title/>
+					</div>
+					<vm:archive-post/>
+				</div>
+				  </vm:posts>
+            </div>
+          </div>
+          <div style="margin-left: 1.538em; width: 25.385em;float:left;">
+
+            <div class="info-column">
+              <div class="block">
+                <div>
+                  <vm:about-me />
+                </div>
+                <div>
+                  <vm:login-info format_string="Logged in as %s." />
+                </div>
+                <div>
+                  <vm:cmds-menu />
+                </div>
+                <div>
+                  <vm:home-url />
+                </div>
+                <div id="selector">
+                  <vm:calendar vm:url="index.vspx?page=summary" />
+                  <vm:rss-feeds />
+                  <vm:if test="ocs">
+                    <h2>
+                      <vm:ocs-div-title />
+                    </h2>
+                    <div class="roll">
+                      <vm:ocs />
+                    </div>
+                  </vm:if>
+                  <vm:if test="opml">
+                    <h2>
+                      <vm:opml-div-title />
+                    </h2>
+                    <div class="roll">
+                      <vm:opml />
+                    </div>
+                  </vm:if>
+                </div>
+                <div>Search</div>
+                <div>
+                  <vm:search />
+                </div>
+				<div>
+					Tag Cloud
+				  <vm:if test="tagid">
+					  <span>
+					  <a href="gems/rss_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"  class="inlinelink"><img src="/weblog/public/images/rss-icon-16.gif" border="0" alt="RSS" title="RSS"/></a>
+					  <a href="gems/atom_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"  class="inlinelink"><img src="/weblog/public/images/atom-icon-16.gif" border="0" alt="Atom" title="Atom"/></a>
+					  <a href="gems/rdf_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>" class="inlinelink"><img src="/weblog/public/images/rdf-icon-16.gif" border="0" alt="RDF" title="RDF"/></a>
+					  </span>
+				  </vm:if>
+				  <vm:tags top="100"/>
+				</div>
+				
+                <div>Post Categories</div>
+                <div>
+                  <vm:categories />
+                </div>
+                <div>Subscribe</div>
+                <div>
+                  <vm:subscribe />
+                </div>
+                <div>Recent Articles</div>
+                <div>
+                  <vm:last-messages />
+                </div>
+                <vm:if test="have_community">
+                  <div>Community Member Blogs</div>
+                  <div>
+                    <vm:bloggers />
+                  </div>
+                </vm:if>
+                <vm:if test="browse_posts">
+                  <div>Sort options</div>
+                  <div>
+                    <vm:sort-options />
+                  </div>
+                </vm:if>
+                <vm:if test="fish">
+                  <div>Translate</div>
+                  <div>
+                    <vm:babel-fish />
+                  </div>
+                </vm:if>
+                <div>
+                  <vm:amazon-wishlist-display />
+                </div>
+                <div>
+                  <vm:google-ads />
+                </div>
+                <div>
+                  <vm:etray-ads />
+                </div>
+                <div id="powered">
+                  <vm:powered-by />
+                </div>
+                <div id="copy">
+                  <vm:copyright />
+                </div>
+                <div id="disclaimer">
+                  <vm:disclaimer />
+                </div>
+              </div>
+            </div>
+            <div id="error">
+              <v:error-summary />
+            </div>
+          </div>
+        </div>
+      </div>
+    </vm:body>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Blog/templates/newspaper_view/default.css b/appsrc/ODS-Blog/templates/newspaper_view/default.css
new file mode 100755
index 0000000..ff29242
--- /dev/null
+++ b/appsrc/ODS-Blog/templates/newspaper_view/default.css
@@ -0,0 +1,863 @@
+/*
+ *  $Id: default.css,v 1.1.4.3 2010/09/22 13:56:49 source Exp $
+ *  
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *  
+ *  Copyright (C) 1998-2006 OpenLink Software
+ *  
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *  
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *  
+ */
+
+html {
+background-image:url("images/bg.png");
+}
+
+body {
+	font:13px/1.231 arial,helvetica,clean,sans-serif;
+font-family:Helvetica,Arial;
+margin:4px 0 0;
+width:auto;
+text-align:left;
+}
+
+a     { color: #003366; }
+a:link    { color: #003366;  }
+a:visited { color: #003366; }
+a:active  { color: #999999;  }
+a:hover   { color: #3399CC;  }
+
+
+a img {
+ border: none;
+}
+
+h1 { font-size: 2em; font-weight:700; padding: 0 0 .5em;line-height:130%; }
+
+form {
+  display: inline;
+  width: 0px;
+  padding: 0px;
+  margin: 0px;
+}
+
+#page {
+margin-bottom:6px;
+background-color:#FFFFFF;
+padding-left:25px;
+padding-right:25px;
+width:75.385em;
+margin:0 auto;
+padding-bottom:25px;
+padding-top:25px;
+}
+
+#header {
+margin-bottom:35px;
+padding:10px 0 20px;
+min-width:960px;
+}
+
+#header2 {
+}
+
+.page_title_inner {
+clear: both; background-color: rgb(0, 0, 0); height: 30px; padding: 0pt 10px; font-size: 93%;
+color: rgb(255, 255, 255); line-height: 30px; float: left;
+}
+
+.page_title_inner, .paper-title, .footer_widgets, .footer {
+min-width:960px;
+}
+
+.page-title {
+background:url("../images/bg_page_title.png") repeat-x scroll 0 0 #005490;
+min-width:960px;
+}
+
+.wrap {
+margin:0 auto;
+overflow:hidden;
+width:960px;
+}
+
+#header .wrap {
+background:url("images/bg_header_wrap.png") no-repeat scroll 50% 0 transparent;
+min-height:80px;
+overflow:hidden;
+}
+
+#header img {
+  position: relative;
+  top: 10px;
+  margin: 0px;
+  padding: 0px;
+}
+
+#header h1 {
+display:block;
+float:left;
+font-size:2em;
+font-weight:700;
+line-height:100%;
+padding-top:26px;
+}
+
+#header2 h2 {
+font-size:2em;
+font-weight:600;
+line-height:100%;
+padding:20px 10px 0;
+  font-family: tahoma;
+color: white;
+}
+
+
+#navbartop {
+  position: relative;
+  left: 15px;
+}
+
+#navbartop * {
+  text-align: left;
+  color: black;
+  margin: 0px;
+  padding-top: 1px;
+  padding-bottom: 1px;
+  width: 100%;
+}
+
+.button {
+  border: none;
+  padding: 2px 2px;
+  margin: 3px 0px;
+  font-weight: normal;
+  cursor: pointer;
+  color: blue;
+  background-color: transparent;
+  font-family: arial, helvetica, sans-serif;
+  text-decoration: none;
+}
+
+.button:hover {
+  color: #003366;
+}
+
+.real_button
+{
+  font-family: arial, helvetica, sans-serif;
+  font-size: 9px;
+  border: 1px solid #AAAAAA;
+  background-color: #CCD4E0;
+}
+
+
+input {  
+  border: 1px solid #191970;
+  color: black;
+  background-color: white;
+  align: left;
+}
+
+select {
+  border: 1px solid #191970;
+  color: black;
+  background-color: white;
+}
+
+textarea {
+  border: 1px solid #191970;
+  color: black;
+  background-color: white;
+}
+
+div.block {
+  text-align: left;
+font-family:Arial;
+font-size:0.8em;
+line-height:1.4;
+}
+
+div.block div {
+  margin: 3px;
+}
+
+div.block div#welcome {
+margin-top: 5px; margin-bottom: 10px; white-space: nowrap; font-size: 108%;
+min-width:960px;
+}
+
+
+div.block div#title {
+  color:white;
+  background-color:#3399cc;
+  border-bottom:2px solid #EDF5F9;
+  padding-bottom:10px;
+  text-align: left;
+  font-weight: normal;
+  padding: 2px;
+  font-size: x-small;
+  voice-family: "\"}\"", inherit;
+  font-size: small;
+}
+
+input.button {
+  height: 17px;
+}
+
+div.nav-column {
+  width: 128px;
+  float: left;
+  overflow: hidden;
+  margin-left: 12px;
+}
+
+div.content-column {
+  width: auto;
+  padding 6px;
+  padding-left: 0px;
+  padding-right: 250px;
+  text-align: center;
+}
+
+#selector div {
+  font-size: x-small;
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: small; 
+}
+
+#selector td{
+  font-size: x-small;
+  voice-family: "\"}\"", inherit;  
+  /* All below here hidden from IE 5 PC */
+}
+
+#selector .button {
+  text-decoration: none;
+  margin: 0px;
+  padding-left: 5px;
+  text-align: left;
+  margin: 0px;
+  padding-left: 0px;
+  list-style-type: none;
+  padding-bottom:1px;  
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: x-small; 
+}
+
+#separated * {
+  display: block;
+  padding: 0px;
+  margin: 0px;
+  border-bottom: 1px solid #191970;
+}
+
+#selector .button#inline {
+  display: inline;
+}
+
+#inline {
+  display: inline;
+}
+
+div.info-column {
+  overflow: hidden;
+  margin-right: 12px;
+  voice-family:inherit;
+border:1px solid #CCCCCC;
+padding:10px 10px 16px;
+}
+
+#calendar {
+  font-size: 50%;
+  text-align: center;
+  margin: auto;
+}
+#calendar td, #calendar th { padding: 1px;}
+.calactive {
+   background: url("/weblog/public/images/blog-active.png");
+   background-repeat: no-repeat;
+   background-position: center;
+   color: white;
+ }
+.calactive a {
+   color: white;
+ }
+.calnotactive a {
+   text-decoration: none;
+ }
+.caltoday {
+   background: url("/weblog/public/images/blog-today.png");
+   background-repeat: no-repeat;
+   background-position: center;
+   color: white;
+ }
+.caltoday a {
+   color: white;
+ }
+.calselected {
+   color: white;
+   border:1px solid #000000;
+ }
+.calselected a {
+   color: white;
+ }
+.tb-url, .tb-url a {
+  font-family:georgia, verdana, arial, sans-serif;
+  color:#666;
+  font-size:1em;
+  font-weight:normal;
+  background:inherit;
+  width: 100%;
+}
+.tb-url .url {
+  color: #065;
+  background: inherit;
+  position: absolute;
+  width: 100%;
+}
+
+label.button {
+  text-decoration: none;
+  margin: 0px;
+  padding-left: 5px;
+  text-align: left;
+  margin: 0px;
+  padding-left: 0px;
+  list-style-type: none;
+  padding-bottom:1px;  
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: x-small; 
+}
+
+.smallfeedlink {
+  font-size: 6pt;
+  background: #ff6800;
+  font-weight: bold;
+  color: white;
+  border-top: 1px solid white;
+  border-left: 1px solid white;
+  border-right: 1px solid darkred;
+  border-bottom: 1px solid darkred;
+  padding: 0px;
+  padding-left: 2px;
+  padding-right: 2px;
+  margin: 0px;
+  text-decoration: none;
+}
+
+#error {
+  color: red;
+  font-weight: bold;
+  background-color: white;
+  padding 3px 0px;
+  margin 2px;
+  text-align: center;
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: x-small; 
+}
+
+div.page-container {
+margin-bottom:10px;
+}
+
+.page-container2 {
+background:url("images/bg_content.png") repeat-x scroll 0 0 transparent;
+min-height:350px;
+min-width:960px;
+overflow:hidden;
+padding:30px 0 60px;
+}
+
+div.message {
+border-bottom:1px solid #DDDDDD;
+margin-bottom:20px;
+padding-bottom:3px;
+}
+
+.state-mark {
+  padding-left: 6px;
+  color: darkred;
+  font-weight: normal;
+}
+
+.modified-date {
+  color: darkred;
+  font-weight: bold;
+}
+
+span.modified-date:before {
+  content: "[ "
+}
+
+span.modified-date:after {
+  content: " ]"
+}
+
+span.replacing {
+  margin: 0;
+  padding: 2px;
+  color: red;
+  border: 1px solid red;
+}
+
+div.pubdate {
+  color:gray;
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: x-small; 
+}
+
+div.post-title {
+cursor:pointer;
+text-decoration:none;
+word-wrap:break-word;
+color:#000000;
+font-size:15px;
+font-weight:bold;
+line-height:18px;
+margin-bottom:10px;
+}
+
+div.post-content {
+line-height:19px;
+word-wrap:break-word;
+}
+
+div.post-actions {
+background:none repeat scroll 0 0 #F5F5F5;
+  border: none;
+  margin-left: 20px;
+  margin-right: 20px;
+  text-align: left;
+  voice-family: "\"}\"", inherit;
+  /* All below here hidden from IE 5 PC */
+  font-size: x-small; 
+}
+
+div.posts-title {
+  margin-top: 5px;
+  margin-bottom: 5px;
+  font-size: 110%;
+  font-weight: bold;
+}
+
+div.posts-info {
+  margin-top: 6px;
+  margin-bottom: 6px;
+}
+
+div.trackback-title {
+  margin-left: 20px;
+  margin-right: 20px;
+  margin-top: 6px;
+  margin-bottom: 6px;
+  font-size: 110%;
+  font-weight: bold;
+}
+
+div.trackback-contents {
+  background-color: white;
+  margin: 3px;
+  border: none;
+  display: block;
+  padding: 6px;
+  text-align: left;
+  margin-left: 24px;
+}
+
+div.pingback-title {
+  margin-left: 20px;
+  margin-right: 20px;
+  margin-top: 6px;
+  margin-bottom: 6px;
+  font-size: 110%;
+  font-weight: bold;
+}
+
+div.referrals-title {
+  margin-left: 20px;
+  margin-right: 20px;
+  margin-top: 6px;
+  margin-bottom: 6px;
+  font-size: 110%;
+  font-weight: bold;
+}
+
+div.referrals-contents {
+  margin: 3px;
+  border: none;
+  display: block;
+  padding: 6px;
+  text-align: left;
+  margin-left: 24px;
+}
+
+div.pingback-contents {
+  background-color: white;
+  margin: 3px;
+  border: none;
+  display: block;
+  padding: 6px;
+  text-align: left;
+  margin-left: 24px;
+}
+
+div.related-title {
+  margin-left: 20px;
+  margin-right: 20px;
+  margin-top: 6px;
+  margin-bottom: 6px;
+  font-size: 110%;
+  font-weight: bold;
+}
+
+div.related-contents {
+  background-color: white;
+  margin: 3px;
+  border: none;
+  display: block;
+  padding: 0px;
+  text-align: left;
+  margin-left: 0px;
+}
+
+
+div.comments-title {
+  margin-left: 0px;
+  margin-right: 0px;
+  margin-top: 0px;
+  margin-bottom: 0px;
+  font-size: 100%;
+  font-weight: bold;
+}
+
+div.comments-contents {
+  background-color: white;
+  margin: 3px;
+  border: none;
+  display: block;
+  padding: 6px;
+  text-align: left;
+  margin-left: 5px;
+}
+
+div.comment-message {
+  font-size: 90%;
+  background-color: white;
+  padding: 6px;
+  margin: 6px;
+  border: none;
+  margin-top: 30px;
+  margin-bottom: 5px;
+  margin-left: 0px;
+  display: block;
+}
+
+div.comment-pubdate {
+  font-size: 100%;
+  background-color: white;
+  color: black;
+  margin: 3px;
+  border: none;
+  margin-left: 20px;
+  margin-right: 20px;
+  display: block;
+  position: relative;
+  top: -30px;
+  padding: 3px;
+}
+
+div.comment-actions {
+  font-size: 90%;
+  background-color: white;
+  margin: 3px;
+  border: none;
+  margin-left: 20px;
+  margin-right: 20px;
+  padding: 3px;
+  text-align: left;
+}
+
+div.comment-content {
+  background-color: white;
+  margin: 3px;
+  border: none;
+  display: block;
+  padding: 6px;
+  text-align: left;
+  font-size: 80%;
+  position: relative;
+  top: -30px;
+  margin-bottom: -5 px;
+  margin-left: 20px;
+}
+
+div.comment-title {
+  background-color: white;
+  margin: 3px;
+  border: none;
+  margin-left: 20px;
+  margin-right: 20px;
+  display: block;
+  padding: 6px;
+  text-align: left;
+  font-weight: bold;
+  font-style: italic;
+  font-size: 140%;
+  position: relative;
+  top: -30px;
+}
+
+table#channels {
+  border: 1px solid #191970;
+  margin-bottom: 10px;
+  background-color: white;
+  width: 100%;
+}
+
+table#channels th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#channels td {
+  padding-left: 0px;
+  padding-right: 0px;
+}
+
+table#channel-posts {
+  border: 1px solid #191970;
+  margin-bottom: 10px;
+  background-color: white;
+  width: 100%;
+}
+
+table#channel-posts th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#channel-posts td {
+  padding-left: 6px;
+  padding-right: 6px;
+}
+
+table#channel-posts td#content {
+  background-color: white;
+}
+
+table#channel-posts a {
+  margin-right: 12px;
+}
+
+table#upstreamings {
+  border: 1px solid #191970;
+  margin-bottom: 10px;
+  background-color: white;
+  width: 97%;
+}
+
+table#upstreamings th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#upstreamings td {
+  padding-left: 0px;
+  padding-right: 0px;
+}
+
+table#community {
+  border: 2px solid #191970;
+  margin-bottom: 10px;
+  background-color: white;
+  width: 100%;
+}
+
+table#community th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#community td {
+  padding-left: 6px;
+  padding-right: 6px;
+}
+
+table#members {
+  border: 1px solid #191970;
+  margin-bottom: 10px;
+  background-color: white;
+  width: 100%;
+}
+
+table#members th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#members td {
+  padding-left: 6px;
+  padding-right: 6px;
+}
+
+table#categories {
+  border: 1px solid #191970;
+  background-color: white;
+  width: 100%;
+}
+
+table#categories th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#categories td {
+}
+
+div#subtitle {
+  font-weight: bold;
+  font-style: italic; 
+  color: #191970;
+}
+
+table#moblogs {
+  border: 1px solid #191970;
+  margin-bottom: 10px;
+  background-color: white;
+  width: 100%;
+}
+
+table#moblogs th {
+  border-bottom: 1px solid #191970;
+  text-align: center;
+}
+
+table#moblogs td {
+  padding-left: 6px;
+  padding-right: 6px;
+}
+
+#text {
+  width: 510px;
+  text-align: left;
+  position: relative; /* Needed for Safari */
+  margin: auto; /* Takes care of horizontal alignment in standards compliant browsers */
+  voice-family: "\"}\"", inherit;
+  font-size: x-small;
+}
+
+#text table{
+  background-color: white;
+  width: 99%;
+}
+
+#text h1, h2 {
+  position: relative;
+  top: 0px;
+  margin: 0px;
+  padding: 0px;
+  color: black;
+}
+
+#text input {
+  padding: 0px;
+  margin: 0px;
+  text-align: left;
+  color: #003366;;
+  font-family: arial, helvetica, sans-serif;
+  voice-family: "\"}\"", inherit;
+  font-size: x-small;
+}
+
+div.form1 {
+  width: 510px;
+  text-align: left;
+  position: relative; /* Needed for Safari */
+  margin: auto; /* Takes care of horizontal alignment in standards compliant browsers */
+  voice-family: "\"}\"", inherit;
+  font-size: x-small;
+}
+
+.postcomment table {
+  margin-bottom: 1em;
+ }
+.postcomment th {
+  text-align: right;
+ }
+.postcomment .note {
+  padding: 0.3em;
+  font-size: 1em;
+  font-family: Tahoma, sans-serif;
+}
+
+/* Tabbed page - begin */
+.tab_page
+{
+    font-size: 10pt;
+    border-left: solid 1px black;
+    border-right: solid 1px black;
+    border-bottom: solid 1px black;
+    background-color: white;
+    padding-left: 10px;
+    padding-right: 10px;
+    color: black;
+    width: 100%;
+}
+.page_tab
+{
+    font-size: 10pt;
+    background-color: #eaeaea;
+    text-align: left;
+    white-space: nowrap;
+    padding: 2px;
+    border: 1px solid black;
+}
+.page_tab_empty 
+{
+    white-space: nowrap;
+    border-bottom:1px solid black;
+    border-left:1px solid black;
+    border-right:0;
+    border-top:0;
+}
+.page_tab_selected
+{
+    white-space: nowrap;
+    font-size: 10pt;
+    background-color: white;
+    text-align: left;
+    padding: 2px;
+    border-top:1px solid black;
+    border-left:1px solid black;
+    border-right:1px solid black;
+    border-bottom:0
+}
+.page_tab a
+{
+  color: black;
+  text-decoration: none;
+}
+.page_tab a:hover
+{
+  color: black;
+  text-decoration: underline;
+}
+/* Tabbed page - end */
diff --git a/appsrc/ODS-Blog/templates/newspaper_view/images/bg.png b/appsrc/ODS-Blog/templates/newspaper_view/images/bg.png
new file mode 100755
index 0000000..9458d09
Binary files /dev/null and b/appsrc/ODS-Blog/templates/newspaper_view/images/bg.png differ
diff --git a/appsrc/ODS-Blog/templates/newspaper_view/index.vspx b/appsrc/ODS-Blog/templates/newspaper_view/index.vspx
new file mode 100755
index 0000000..752b6ae
--- /dev/null
+++ b/appsrc/ODS-Blog/templates/newspaper_view/index.vspx
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: index.vspx,v 1.1.4.3 2010/09/22 13:56:49 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page style="/DAV/VAD/blog2/widgets/main.xsl" name="home"
+        xmlns:vm="http://www.openlinksw.com/vspx/weblog/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+        on-deadlock-retry="5">
+	<vm:page>
+		<vm:header>
+			<vm:page-title title="Weblog home page"/>
+			<vm:disco-rss-link/>
+			<vm:disco-pingback-link/>
+			<vm:disco-comments-link/>
+			<vm:disco-foaf-link/>
+			<vm:disco-rsd-link/>
+			<vm:disco-opml-link/>
+			<vm:meta-owner/>
+			<vm:meta-authors/>
+			<vm:meta-description/>
+			<vm:meta-keywords/>
+			<vm:custom-style />
+		</vm:header>
+		<vm:body xhtml_style="single single-post postid-643">
+			<div id="page" style="text-align: left;">
+				<div id="header">
+          <div style="height: 80px; overflow: hidden; min-width:960px;">
+					<div style="font-family: Georgia; line-height: 1; font-size: 44px; white-space: nowrap;" class="paper-title">
+              <vm:blog-title  url="index.vspx"/>
+					</div>
+				<div id="welcome">
+				<vm:blog-about/>
+				</div>
+				</div>
+					<div id="header2">
+						<div class="page_title_inner">
+							<vm:welcome-message show-once="no"/>
+						</div>
+			 <div>
+				<vm:blog-view-switch/>
+				| <vm:archive-url />
+				<vm:settings-link title="| Settings"/>
+				<vm:new-post-link title="| New Post" />
+				| <vm:advanced-search-link title="Search"/>
+            </div>
+					</div>
+				</div>
+				<div class="page-container2">
+					<div style="width: 47em;float:left;margin-left:0;">
+						<div>
+							<vm:posts trackback="discovery" />
+						</div>
+						<div>
+							<vm:comments-view>
+							<vm:trackbacks />
+							<vm:referrals />
+							<vm:related />
+							<vm:comments />
+							<vm:post-comment />
+							</vm:comments-view>
+						</div>
+					</div>
+					<div style="margin-left: 1.538em; width: 25.385em;float:left;">
+						<div class="info-column">
+							<div class="block">
+								<div>
+									<vm:about-me/>
+								</div>
+								<div>
+								<vm:login-info format_string="Logged in as %s."/>
+								</div>
+								<div>
+								<vm:cmds-menu/>
+								</div>
+								<div>
+								<vm:home-url />
+								</div>
+								<div id="selector">
+									<vm:calendar vm:url="index.vspx" />
+									<vm:rss-feeds />
+									<vm:if test="ocs">
+                    <h2>
+                      <vm:ocs-div-title />
+                    </h2>
+									<div class="roll">
+									<vm:ocs/>
+									</div>
+									</vm:if>
+									<vm:if test="opml">
+                    <h2>
+                      <vm:opml-div-title />
+                    </h2>
+									<div class="roll">
+									<vm:opml/>
+									</div>
+									</vm:if>
+								</div>
+                <div>Search</div>
+								<div>
+								<vm:search />
+								</div>
+								<div>
+					Tag Cloud
+				  <vm:if test="tagid">
+					  <span>
+					  <a href="gems/rss_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"  class="inlinelink"><img src="/weblog/public/images/rss-icon-16.gif" border="0" alt="RSS" title="RSS"/></a>
+					  <a href="gems/atom_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"  class="inlinelink"><img src="/weblog/public/images/atom-icon-16.gif" border="0" alt="Atom" title="Atom"/></a>
+					  <a href="gems/rdf_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>" class="inlinelink"><img src="/weblog/public/images/rdf-icon-16.gif" border="0" alt="RDF" title="RDF"/></a>
+					  </span>
+				  </vm:if>
+				  <vm:tags top="100"/>
+								</div>
+				
+                <div>Post Categories</div>
+								<div>
+								<vm:categories/>
+								</div>
+                <div>Subscribe</div>
+								<div>
+								<vm:subscribe/>
+								</div>
+                <div>Recent Articles</div>
+								<div>
+								<vm:last-messages/>
+								</div>
+								<vm:if test="have_community">
+                  <div>Community Member Blogs</div>
+								<div>
+								<vm:bloggers/>
+								</div>
+								</vm:if>
+								<vm:if test="browse_posts">
+                  <div>Sort options</div>
+								<div>
+								<vm:sort-options />
+								</div>
+								</vm:if>
+								<vm:if test="fish">
+                  <div>Translate</div>
+								<div>
+								<vm:babel-fish/>
+								</div>
+								</vm:if>
+								<div>
+								<vm:amazon-wishlist-display/>
+								</div>
+								<div>
+								<vm:google-ads/>
+								</div>
+								<div>
+								<vm:etray-ads/>
+								</div>
+								<div id="powered">
+								<vm:powered-by/>
+								</div>
+                <div id="copy">
+                  <vm:copyright />
+                </div>
+                <div id="disclaimer">
+                  <vm:disclaimer />
+                </div>
+							</div>
+						</div>
+						<div id="error">
+							<v:error-summary />
+						</div>
+					</div>
+				</div>
+			</div>
+		</vm:body>
+	</vm:page>
+</v:page>
diff --git a/appsrc/ODS-Blog/templates/newspaper_view/linkblog.vspx b/appsrc/ODS-Blog/templates/newspaper_view/linkblog.vspx
new file mode 100755
index 0000000..31b03dd
--- /dev/null
+++ b/appsrc/ODS-Blog/templates/newspaper_view/linkblog.vspx
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: linkblog.vspx,v 1.1.4.2 2010/09/27 14:45:09 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page style="/DAV/VAD/blog2/widgets/main.xsl"
+        name="home"
+        xmlns:vm="http://www.openlinksw.com/vspx/weblog/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+        on-deadlock-retry="5">
+  <vm:page id="">
+    <vm:header id="header">
+      <title><vm:blog-title url=""/></title>
+      <vm:disco-rss-link/>
+      <vm:disco-atom-link/>
+      <vm:disco-pingback-link/>
+      <vm:disco-comments-link/>
+      <vm:disco-foaf-link/>
+      <vm:disco-rsd-link/>
+      <vm:disco-opml-link/>
+      <vm:meta-owner/>
+      <vm:meta-authors/>
+      <vm:meta-description/>
+      <vm:meta-keywords/>
+      <vm:custom-style />
+    </vm:header>
+    <vm:body xhtml_style="single single-post postid-643">
+      <div id="page" style="text-align: left;">
+        <div id="header">
+          <div style="height: 80px; overflow: hidden; min-width:960px;">
+            <div style="font-family: Georgia; line-height: 1; font-size: 44px; white-space: nowrap;"
+            class="paper-title">
+              <vm:blog-title url="index.vspx" />
+            </div>
+            <div id="welcome">
+              <vm:blog-about />
+            </div>
+          </div>
+          <div id="header2">
+            <div class="page_title_inner">
+              <vm:welcome-message show-once="no" />
+            </div>
+			  <div>
+				<vm:blog-view-switch/>
+				| <vm:archive-url />
+				<vm:settings-link title="| Settings"/>
+				<vm:new-post-link title="| New Post" />
+				| <vm:advanced-search-link title="Search"/>
+            </div>
+          </div>
+        </div>
+        <div class="page-container2">
+          <div style="width: 47em;float:left;margin-left:0;">
+            <div>
+				<vm:posts mode="link" table="off">
+				<vm:group-heading>
+					<div class="date_separator"><vm:date /></div>
+				</vm:group-heading>
+				<vm:linkblog-links>
+					<div class="linkblog_link">
+					<vm:linkblog-url/>
+					<div class="tags"><vm:if test="have_categories">under category:</vm:if>
+						<vm:linkblog-categories>
+						<vm:linkblog-category/>
+						</vm:linkblog-categories>
+					</div>
+					<div class="tags">
+						<vm:if test="have_tags">Tags:</vm:if>
+						<vm:linkblog-tags>
+						<vm:linkblog-tag/>
+						</vm:linkblog-tags>
+					</div>
+					</div>
+				</vm:linkblog-links>
+				</vm:posts>
+            </div>
+          </div>
+          <div style="margin-left: 1.538em; width: 25.385em;float:left;">
+
+            <div class="info-column">
+              <div class="block">
+                <div>
+                  <vm:about-me />
+                </div>
+                <div>
+                  <vm:login-info format_string="Logged in as %s." />
+                </div>
+                <div>
+                  <vm:cmds-menu />
+                </div>
+                <div>
+                  <vm:home-url />
+                </div>
+                <div id="selector">
+                  <vm:calendar vm:url="index.vspx?page=summary" />
+                  <vm:rss-feeds />
+                  <vm:if test="ocs">
+                    <h2>
+                      <vm:ocs-div-title />
+                    </h2>
+                    <div class="roll">
+                      <vm:ocs />
+                    </div>
+                  </vm:if>
+                  <vm:if test="opml">
+                    <h2>
+                      <vm:opml-div-title />
+                    </h2>
+                    <div class="roll">
+                      <vm:opml />
+                    </div>
+                  </vm:if>
+                </div>
+                <div>Search</div>
+                <div>
+                  <vm:search />
+                </div>
+				<div>
+					Tag Cloud
+				  <vm:if test="tagid">
+					  <span>
+					  <a href="gems/rss_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"  class="inlinelink"><img src="/weblog/public/images/rss-icon-16.gif" border="0" alt="RSS" title="RSS"/></a>
+					  <a href="gems/atom_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"  class="inlinelink"><img src="/weblog/public/images/atom-icon-16.gif" border="0" alt="Atom" title="Atom"/></a>
+					  <a href="gems/rdf_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>" class="inlinelink"><img src="/weblog/public/images/rdf-icon-16.gif" border="0" alt="RDF" title="RDF"/></a>
+					  </span>
+				  </vm:if>
+				  <vm:tags top="100"/>
+				</div>
+				
+                <div>Post Categories</div>
+                <div>
+                  <vm:categories />
+                </div>
+                <div>Subscribe</div>
+                <div>
+                  <vm:subscribe />
+                </div>
+                <div>Recent Articles</div>
+                <div>
+                  <vm:last-messages />
+                </div>
+                <vm:if test="have_community">
+                  <div>Community Member Blogs</div>
+                  <div>
+                    <vm:bloggers />
+                  </div>
+                </vm:if>
+                <vm:if test="browse_posts">
+                  <div>Sort options</div>
+                  <div>
+                    <vm:sort-options />
+                  </div>
+                </vm:if>
+                <vm:if test="fish">
+                  <div>Translate</div>
+                  <div>
+                    <vm:babel-fish />
+                  </div>
+                </vm:if>
+                <div>
+                  <vm:amazon-wishlist-display />
+                </div>
+                <div>
+                  <vm:google-ads />
+                </div>
+                <div>
+                  <vm:etray-ads />
+                </div>
+                <div id="powered">
+                  <vm:powered-by />
+                </div>
+                <div id="copy">
+                  <vm:copyright />
+                </div>
+                <div id="disclaimer">
+                  <vm:disclaimer />
+                </div>
+              </div>
+            </div>
+            <div id="error">
+              <v:error-summary />
+            </div>
+          </div>
+        </div>
+      </div>
+	</vm:body>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Blog/templates/newspaper_view/summary.vspx b/appsrc/ODS-Blog/templates/newspaper_view/summary.vspx
new file mode 100755
index 0000000..3f028ef
--- /dev/null
+++ b/appsrc/ODS-Blog/templates/newspaper_view/summary.vspx
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ -
+ -  $Id: summary.vspx,v 1.1.4.2 2010/09/22 13:56:50 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page style="/DAV/VAD/blog2/widgets/main.xsl" name="home"
+xmlns:vm="http://www.openlinksw.com/vspx/weblog/"
+xmlns:v="http://www.openlinksw.com/vspx/"
+doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+on-deadlock-retry="5">
+  <vm:page id="">
+    <vm:header id="header">
+      <title>
+        <vm:blog-title url="" />
+      </title>
+      <vm:disco-rss-link />
+      <vm:disco-atom-link />
+      <vm:disco-pingback-link />
+      <vm:disco-comments-link />
+      <vm:disco-foaf-link />
+      <vm:disco-rsd-link />
+      <vm:disco-opml-link />
+      <vm:meta-owner />
+      <vm:meta-authors />
+      <vm:meta-description />
+      <vm:meta-keywords />
+      <vm:custom-style />
+    </vm:header>
+    <vm:body xhtml_style="single single-post postid-643">
+      <div id="page" style="text-align: left;">
+        <div id="header">
+          <div style="height: 80px; overflow: hidden; min-width:960px;">
+            <div style="font-family: Georgia; line-height: 1; font-size: 44px; white-space: nowrap;"
+            class="paper-title">
+              <vm:blog-title url="index.vspx" />
+            </div>
+            <div id="welcome">
+              <vm:blog-about />
+            </div>
+          </div>
+          <div id="header2">
+            <div class="page_title_inner">
+              <vm:welcome-message show-once="no" />
+            </div>
+			  <div>
+				<vm:blog-view-switch/>
+				| <vm:archive-url />
+				<vm:settings-link title="| Settings"/>
+				<vm:new-post-link title="| New Post" />
+				| <vm:advanced-search-link title="Search"/>
+            </div>
+          </div>
+        </div>
+        <div class="page-container2">
+          <div style="width: 47em;float:left;margin-left:0;">
+            <div>
+              <vm:posts mode="summary">
+                <vm:summary-group-heading>
+                  <div class="date_separator">
+                    <vm:date />
+                  </div>
+                </vm:summary-group-heading>
+                <div class="summary_post">
+                  <div class="post">
+                    <vm:summary-post-header />
+                  </div>
+                  <div class="post-excerpt">
+                    <vm:summary-post />
+                  </div>
+                  <vm:summary-post-tags />
+                </div>
+              </vm:posts>
+            </div>
+          </div>
+          <div style="margin-left: 1.538em; width: 25.385em;float:left;">
+
+            <div class="info-column">
+              <div class="block">
+                <div>
+                  <vm:about-me />
+                </div>
+                <div>
+                  <vm:login-info format_string="Logged in as %s." />
+                </div>
+                <div>
+                  <vm:cmds-menu />
+                </div>
+                <div>
+                  <vm:home-url />
+                </div>
+                <div id="selector">
+                  <vm:calendar vm:url="index.vspx?page=summary" />
+                  <vm:rss-feeds />
+                  <vm:if test="ocs">
+                    <h2>
+                      <vm:ocs-div-title />
+                    </h2>
+                    <div class="roll">
+                      <vm:ocs />
+                    </div>
+                  </vm:if>
+                  <vm:if test="opml">
+                    <h2>
+                      <vm:opml-div-title />
+                    </h2>
+                    <div class="roll">
+                      <vm:opml />
+                    </div>
+                  </vm:if>
+                </div>
+                <div>Search</div>
+                <div>
+                  <vm:search />
+                </div>
+				<div>
+					Tag Cloud
+				  <vm:if test="tagid">
+					  <span>
+					  <a href="gems/rss_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"  class="inlinelink"><img src="/weblog/public/images/rss-icon-16.gif" border="0" alt="RSS" title="RSS"/></a>
+					  <a href="gems/atom_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>"  class="inlinelink"><img src="/weblog/public/images/atom-icon-16.gif" border="0" alt="Atom" title="Atom"/></a>
+					  <a href="gems/rdf_tag_arch.xml?:tag=<?V BLOG..blog_utf2wide (self.tagid) ?>&amp;:bid=<?V self.blogid ?>" class="inlinelink"><img src="/weblog/public/images/rdf-icon-16.gif" border="0" alt="RDF" title="RDF"/></a>
+					  </span>
+				  </vm:if>
+				  <vm:tags top="100"/>
+				</div>
+				
+                <div>Post Categories</div>
+                <div>
+                  <vm:categories />
+                </div>
+                <div>Subscribe</div>
+                <div>
+                  <vm:subscribe />
+                </div>
+                <div>Recent Articles</div>
+                <div>
+                  <vm:last-messages />
+                </div>
+                <vm:if test="have_community">
+                  <div>Community Member Blogs</div>
+                  <div>
+                    <vm:bloggers />
+                  </div>
+                </vm:if>
+                <vm:if test="browse_posts">
+                  <div>Sort options</div>
+                  <div>
+                    <vm:sort-options />
+                  </div>
+                </vm:if>
+                <vm:if test="fish">
+                  <div>Translate</div>
+                  <div>
+                    <vm:babel-fish />
+                  </div>
+                </vm:if>
+                <div>
+                  <vm:amazon-wishlist-display />
+                </div>
+                <div>
+                  <vm:google-ads />
+                </div>
+                <div>
+                  <vm:etray-ads />
+                </div>
+                <div id="powered">
+                  <vm:powered-by />
+                </div>
+                <div id="copy">
+                  <vm:copyright />
+                </div>
+                <div id="disclaimer">
+                  <vm:disclaimer />
+                </div>
+              </div>
+            </div>
+            <div id="error">
+              <v:error-summary />
+            </div>
+          </div>
+        </div>
+      </div>
+    </vm:body>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Blog/templates/openlink/about.vspx b/appsrc/ODS-Blog/templates/openlink/about.vspx
index fb97df2..a3907d5 100644
--- a/appsrc/ODS-Blog/templates/openlink/about.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/about.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: about.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: about.vspx,v 1.3.2.1 2010/09/20 10:14:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/archive.vspx b/appsrc/ODS-Blog/templates/openlink/archive.vspx
index ba108ce..332f3ee 100644
--- a/appsrc/ODS-Blog/templates/openlink/archive.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/archive.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: archive.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: archive.vspx,v 1.4.2.1 2010/09/20 10:14:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/bridge.vspx b/appsrc/ODS-Blog/templates/openlink/bridge.vspx
index e5d1400..6f76089 100644
--- a/appsrc/ODS-Blog/templates/openlink/bridge.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/bridge.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: bridge.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: bridge.vspx,v 1.4.2.1 2010/09/20 10:14:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/category.vspx b/appsrc/ODS-Blog/templates/openlink/category.vspx
index 14e830d..4623ca3 100644
--- a/appsrc/ODS-Blog/templates/openlink/category.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/category.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: category.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: category.vspx,v 1.4.2.1 2010/09/20 10:14:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/channel_list.vspx b/appsrc/ODS-Blog/templates/openlink/channel_list.vspx
index f3deec9..a2fcb2a 100644
--- a/appsrc/ODS-Blog/templates/openlink/channel_list.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/channel_list.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: channel_list.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: channel_list.vspx,v 1.4.2.1 2010/09/20 10:14:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/channels.vspx b/appsrc/ODS-Blog/templates/openlink/channels.vspx
index b702019..ac8d7f8 100644
--- a/appsrc/ODS-Blog/templates/openlink/channels.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/channels.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: channels.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: channels.vspx,v 1.4.2.1 2010/09/20 10:14:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/channels_ctgs.vspx b/appsrc/ODS-Blog/templates/openlink/channels_ctgs.vspx
index e3fe2d4..9794126 100644
--- a/appsrc/ODS-Blog/templates/openlink/channels_ctgs.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/channels_ctgs.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: channels_ctgs.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: channels_ctgs.vspx,v 1.4.2.1 2010/09/20 10:14:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/comments.vspx b/appsrc/ODS-Blog/templates/openlink/comments.vspx
index c48c9c7..0ee2c8c 100644
--- a/appsrc/ODS-Blog/templates/openlink/comments.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/comments.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: comments.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: comments.vspx,v 1.4.2.1 2010/09/20 10:14:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/community.vspx b/appsrc/ODS-Blog/templates/openlink/community.vspx
index 1f0e632..cac3f11 100644
--- a/appsrc/ODS-Blog/templates/openlink/community.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/community.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: community.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: community.vspx,v 1.4.2.1 2010/09/20 10:14:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/contacts.vspx b/appsrc/ODS-Blog/templates/openlink/contacts.vspx
index 170c912..0ad9454 100644
--- a/appsrc/ODS-Blog/templates/openlink/contacts.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/contacts.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: contacts.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: contacts.vspx,v 1.4.2.1 2010/09/20 10:14:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/default.css b/appsrc/ODS-Blog/templates/openlink/default.css
index 875e713..1320fe6 100644
--- a/appsrc/ODS-Blog/templates/openlink/default.css
+++ b/appsrc/ODS-Blog/templates/openlink/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.10.2.1 2010/02/25 16:11:30 source Exp $
+ *  $Id: default.css,v 1.10.2.2 2010/09/20 10:14:47 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/edit.vspx b/appsrc/ODS-Blog/templates/openlink/edit.vspx
index 967e3ac..4564ff9 100644
--- a/appsrc/ODS-Blog/templates/openlink/edit.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: edit.vspx,v 1.4.2.1 2009/07/01 10:31:49 source Exp $
+ -  $Id: edit.vspx,v 1.4.2.2 2010/09/20 10:14:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/edit_comments.vspx b/appsrc/ODS-Blog/templates/openlink/edit_comments.vspx
index 5fe2739..6e0d74f 100644
--- a/appsrc/ODS-Blog/templates/openlink/edit_comments.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/edit_comments.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: edit_comments.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: edit_comments.vspx,v 1.4.2.1 2010/09/20 10:14:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/edit_post.vspx b/appsrc/ODS-Blog/templates/openlink/edit_post.vspx
index dec50c4..43e249f 100644
--- a/appsrc/ODS-Blog/templates/openlink/edit_post.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/edit_post.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: edit_post.vspx,v 1.5 2007/05/04 15:18:20 source Exp $
+ -  $Id: edit_post.vspx,v 1.5.2.1 2010/09/20 10:14:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/edit_tb.vspx b/appsrc/ODS-Blog/templates/openlink/edit_tb.vspx
index 51e8f69..bacb7b0 100644
--- a/appsrc/ODS-Blog/templates/openlink/edit_tb.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/edit_tb.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: edit_tb.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: edit_tb.vspx,v 1.4.2.1 2010/09/20 10:14:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/errors.vspx b/appsrc/ODS-Blog/templates/openlink/errors.vspx
index efa9f37..5f4f3c4 100644
--- a/appsrc/ODS-Blog/templates/openlink/errors.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/errors.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: errors.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: errors.vspx,v 1.3.2.1 2010/09/20 10:14:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/feed_list.vspx b/appsrc/ODS-Blog/templates/openlink/feed_list.vspx
index 78d5a30..f68cad2 100644
--- a/appsrc/ODS-Blog/templates/openlink/feed_list.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/feed_list.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: feed_list.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: feed_list.vspx,v 1.3.2.1 2010/09/20 10:14:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/feed_view.vspx b/appsrc/ODS-Blog/templates/openlink/feed_view.vspx
index 8227e98..d1a812d 100644
--- a/appsrc/ODS-Blog/templates/openlink/feed_view.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/feed_view.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: feed_view.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: feed_view.vspx,v 1.3.2.1 2010/09/20 10:14:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/get_blogs.vspx b/appsrc/ODS-Blog/templates/openlink/get_blogs.vspx
index b1eb91b..b5b4cf5 100644
--- a/appsrc/ODS-Blog/templates/openlink/get_blogs.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/get_blogs.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: get_blogs.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: get_blogs.vspx,v 1.3.2.1 2010/09/20 10:14:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/get_tags.vspx b/appsrc/ODS-Blog/templates/openlink/get_tags.vspx
index ccebaed..0a2a0e4 100644
--- a/appsrc/ODS-Blog/templates/openlink/get_tags.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/get_tags.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: get_tags.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: get_tags.vspx,v 1.3.2.1 2010/09/20 10:14:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/import.vspx b/appsrc/ODS-Blog/templates/openlink/import.vspx
index 2c12a56..79e8611 100644
--- a/appsrc/ODS-Blog/templates/openlink/import.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/import.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: import.vspx,v 1.1 2007/02/27 21:19:44 source Exp $
+ -  $Id: import.vspx,v 1.1.2.1 2010/09/20 10:14:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/index.vspx b/appsrc/ODS-Blog/templates/openlink/index.vspx
index 592b8ee..c94cf8e 100644
--- a/appsrc/ODS-Blog/templates/openlink/index.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.14.2.3 2010/03/01 10:18:21 source Exp $
+ -  $Id: index.vspx,v 1.14.2.5 2010/09/27 14:45:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -176,7 +176,7 @@
 		      </div>
 		      <div class="post-content" property="sioc:content">
 			  <vm:trackback-discovery/>
-			  <vm:if test="post-view">
+			  <!--vm:if test="post-view">
 			  <div class="tweetmeme_button" style="">
 				  <script type="text/javascript">
 				      tweetmeme_url = "<vm:post-uri />";
@@ -184,7 +184,7 @@
 				  <script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js">
 				  </script>
 			  </div>
-			  </vm:if>
+			  </vm:if-->
 			  <vm:post-body />
 		      </div>
 		      <vm:if test="summary-post-view">
@@ -198,6 +198,7 @@
 			      <vm:post-delicious-link title="Post to del.icio.us">bookmark it!</vm:post-delicious-link>
 			      <vm:post-diggit-link title="submit digg.com">digg it!</vm:post-diggit-link>
 			      <vm:post-reddit-link title="post reddit">reddit!</vm:post-reddit-link>
+			      <vm:post-tweet-link/>
 			  </div>
 			  <div class="post-actions">
 			      <vm:post-anchor title="#" />
diff --git a/appsrc/ODS-Blog/templates/openlink/linkblog.vspx b/appsrc/ODS-Blog/templates/openlink/linkblog.vspx
index 40e1d71..6eed82c 100644
--- a/appsrc/ODS-Blog/templates/openlink/linkblog.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/linkblog.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: linkblog.vspx,v 1.5 2006/10/17 13:46:57 source Exp $
+ -  $Id: linkblog.vspx,v 1.5.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/list_comments.vspx b/appsrc/ODS-Blog/templates/openlink/list_comments.vspx
index 0f25803..d056a89 100644
--- a/appsrc/ODS-Blog/templates/openlink/list_comments.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/list_comments.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: list_comments.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: list_comments.vspx,v 1.4.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/login.vspx b/appsrc/ODS-Blog/templates/openlink/login.vspx
index 183ad3a..1ea5a5d 100644
--- a/appsrc/ODS-Blog/templates/openlink/login.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/login.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: login.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: login.vspx,v 1.3.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/logout.vspx b/appsrc/ODS-Blog/templates/openlink/logout.vspx
index 0a900d1..d57ed60 100644
--- a/appsrc/ODS-Blog/templates/openlink/logout.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/logout.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: logout.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: logout.vspx,v 1.3.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/member_data.vspx b/appsrc/ODS-Blog/templates/openlink/member_data.vspx
index c4c4a1e..4267f1d 100644
--- a/appsrc/ODS-Blog/templates/openlink/member_data.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/member_data.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: member_data.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: member_data.vspx,v 1.4.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/membership.vspx b/appsrc/ODS-Blog/templates/openlink/membership.vspx
index b036e68..68c65d9 100644
--- a/appsrc/ODS-Blog/templates/openlink/membership.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/membership.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: membership.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: membership.vspx,v 1.4.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/moblog_mime_select.vspx b/appsrc/ODS-Blog/templates/openlink/moblog_mime_select.vspx
index 06c398c..4d36575 100644
--- a/appsrc/ODS-Blog/templates/openlink/moblog_mime_select.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/moblog_mime_select.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: moblog_mime_select.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: moblog_mime_select.vspx,v 1.3.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/moblog_msg.vspx b/appsrc/ODS-Blog/templates/openlink/moblog_msg.vspx
index 12889d2..bac7b61 100644
--- a/appsrc/ODS-Blog/templates/openlink/moblog_msg.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/moblog_msg.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: moblog_msg.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: moblog_msg.vspx,v 1.4.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/moblogimage.vspx b/appsrc/ODS-Blog/templates/openlink/moblogimage.vspx
index e57a330..8d370c0 100644
--- a/appsrc/ODS-Blog/templates/openlink/moblogimage.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/moblogimage.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: moblogimage.vspx,v 1.4 2008/02/19 11:01:44 source Exp $
+ -  $Id: moblogimage.vspx,v 1.4.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/ping.vspx b/appsrc/ODS-Blog/templates/openlink/ping.vspx
index 3254e7f..4776b24 100644
--- a/appsrc/ODS-Blog/templates/openlink/ping.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/ping.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ping.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: ping.vspx,v 1.4.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/ping_queue.vspx b/appsrc/ODS-Blog/templates/openlink/ping_queue.vspx
index 017af9f..b50e03a 100644
--- a/appsrc/ODS-Blog/templates/openlink/ping_queue.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/ping_queue.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ping_queue.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: ping_queue.vspx,v 1.4.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/posts.vspx b/appsrc/ODS-Blog/templates/openlink/posts.vspx
index 58a13ae..c3d8915 100644
--- a/appsrc/ODS-Blog/templates/openlink/posts.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/posts.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: posts.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: posts.vspx,v 1.4.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/register.vspx b/appsrc/ODS-Blog/templates/openlink/register.vspx
index bac8e43..734b500 100644
--- a/appsrc/ODS-Blog/templates/openlink/register.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/register.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: register.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: register.vspx,v 1.3.2.1 2010/09/20 10:14:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/routing_queue.vspx b/appsrc/ODS-Blog/templates/openlink/routing_queue.vspx
index f7a67a1..c181626 100644
--- a/appsrc/ODS-Blog/templates/openlink/routing_queue.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/routing_queue.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: routing_queue.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: routing_queue.vspx,v 1.4.2.1 2010/09/20 10:14:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/suggest_kwd.vspx b/appsrc/ODS-Blog/templates/openlink/suggest_kwd.vspx
index 8cbac66..c11be22 100644
--- a/appsrc/ODS-Blog/templates/openlink/suggest_kwd.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/suggest_kwd.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: suggest_kwd.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: suggest_kwd.vspx,v 1.3.2.1 2010/09/20 10:14:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/suggest_tb.vspx b/appsrc/ODS-Blog/templates/openlink/suggest_tb.vspx
index a541a82..5f06703 100644
--- a/appsrc/ODS-Blog/templates/openlink/suggest_tb.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/suggest_tb.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: suggest_tb.vspx,v 1.3 2006/08/14 14:33:14 source Exp $
+ -  $Id: suggest_tb.vspx,v 1.3.2.1 2010/09/20 10:14:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/summary.vspx b/appsrc/ODS-Blog/templates/openlink/summary.vspx
index 5cb9fdb..5115582 100644
--- a/appsrc/ODS-Blog/templates/openlink/summary.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/summary.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: summary.vspx,v 1.5 2006/10/17 13:46:57 source Exp $
+ -  $Id: summary.vspx,v 1.5.2.1 2010/09/20 10:14:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/tags.vspx b/appsrc/ODS-Blog/templates/openlink/tags.vspx
index 4b696a6..0785aa7 100644
--- a/appsrc/ODS-Blog/templates/openlink/tags.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/tags.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: tags.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: tags.vspx,v 1.4.2.1 2010/09/20 10:14:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/templates.vspx b/appsrc/ODS-Blog/templates/openlink/templates.vspx
index 54e845f..63b8ab9 100644
--- a/appsrc/ODS-Blog/templates/openlink/templates.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/templates.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: templates.vspx,v 1.4 2006/10/17 13:46:57 source Exp $
+ -  $Id: templates.vspx,v 1.4.2.1 2010/09/20 10:14:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/wa.vspx b/appsrc/ODS-Blog/templates/openlink/wa.vspx
index c7d481c..18ce034 100644
--- a/appsrc/ODS-Blog/templates/openlink/wa.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/wa.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: wa.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: wa.vspx,v 1.3.2.1 2010/09/20 10:14:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/wa_left.vspx b/appsrc/ODS-Blog/templates/openlink/wa_left.vspx
index 2897ad6..5d74377 100644
--- a/appsrc/ODS-Blog/templates/openlink/wa_left.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/wa_left.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: wa_left.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: wa_left.vspx,v 1.3.2.1 2010/09/20 10:14:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink/wa_right.vspx b/appsrc/ODS-Blog/templates/openlink/wa_right.vspx
index 33fec91..7b266bc 100644
--- a/appsrc/ODS-Blog/templates/openlink/wa_right.vspx
+++ b/appsrc/ODS-Blog/templates/openlink/wa_right.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: wa_right.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: wa_right.vspx,v 1.3.2.1 2010/09/20 10:14:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/openlink_classic/default.css b/appsrc/ODS-Blog/templates/openlink_classic/default.css
index 32cb52b..2942fb6 100644
--- a/appsrc/ODS-Blog/templates/openlink_classic/default.css
+++ b/appsrc/ODS-Blog/templates/openlink_classic/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.3 2006/06/27 15:10:09 source Exp $
+ *  $Id: default.css,v 1.3.2.1 2010/09/20 10:14:50 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/round_the_corner/default.css b/appsrc/ODS-Blog/templates/round_the_corner/default.css
index 1afead2..15d91fd 100644
--- a/appsrc/ODS-Blog/templates/round_the_corner/default.css
+++ b/appsrc/ODS-Blog/templates/round_the_corner/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2.2.1 2009/07/01 10:31:50 source Exp $
+ *  $Id: default.css,v 1.2.2.2 2010/09/20 10:14:50 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/round_the_corner/index.vspx b/appsrc/ODS-Blog/templates/round_the_corner/index.vspx
index 1a89a25..c8c5c3d 100644
--- a/appsrc/ODS-Blog/templates/round_the_corner/index.vspx
+++ b/appsrc/ODS-Blog/templates/round_the_corner/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:50 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/round_wheat/default.css b/appsrc/ODS-Blog/templates/round_wheat/default.css
index d533a32..00c74bb 100644
--- a/appsrc/ODS-Blog/templates/round_wheat/default.css
+++ b/appsrc/ODS-Blog/templates/round_wheat/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2.2.1 2009/07/01 10:31:50 source Exp $
+ *  $Id: default.css,v 1.2.2.2 2010/09/20 10:14:50 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/round_wheat/index.vspx b/appsrc/ODS-Blog/templates/round_wheat/index.vspx
index 2a51ef7..e588a7d 100644
--- a/appsrc/ODS-Blog/templates/round_wheat/index.vspx
+++ b/appsrc/ODS-Blog/templates/round_wheat/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:50 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/seattle/default.css b/appsrc/ODS-Blog/templates/seattle/default.css
index e133846..d1d2002 100644
--- a/appsrc/ODS-Blog/templates/seattle/default.css
+++ b/appsrc/ODS-Blog/templates/seattle/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2 2006/05/31 13:12:59 source Exp $
+ *  $Id: default.css,v 1.2.2.1 2010/09/20 10:14:50 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/seattle/index.vspx b/appsrc/ODS-Blog/templates/seattle/index.vspx
index eb01a4f..c3929bb 100644
--- a/appsrc/ODS-Blog/templates/seattle/index.vspx
+++ b/appsrc/ODS-Blog/templates/seattle/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:50 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/spring/default.css b/appsrc/ODS-Blog/templates/spring/default.css
index 79dee0c..41da667 100644
--- a/appsrc/ODS-Blog/templates/spring/default.css
+++ b/appsrc/ODS-Blog/templates/spring/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2 2006/05/31 13:12:59 source Exp $
+ *  $Id: default.css,v 1.2.2.1 2010/09/20 10:14:50 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/spring/index.vspx b/appsrc/ODS-Blog/templates/spring/index.vspx
index 7a892a5..1a22c18 100644
--- a/appsrc/ODS-Blog/templates/spring/index.vspx
+++ b/appsrc/ODS-Blog/templates/spring/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:50 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/squeaky_clean/archive.vspx b/appsrc/ODS-Blog/templates/squeaky_clean/archive.vspx
index 4a1e4c0..830938e 100644
--- a/appsrc/ODS-Blog/templates/squeaky_clean/archive.vspx
+++ b/appsrc/ODS-Blog/templates/squeaky_clean/archive.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: archive.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: archive.vspx,v 1.3.2.1 2010/09/20 10:14:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/squeaky_clean/default.css b/appsrc/ODS-Blog/templates/squeaky_clean/default.css
index 975e8e6..fa12836 100644
--- a/appsrc/ODS-Blog/templates/squeaky_clean/default.css
+++ b/appsrc/ODS-Blog/templates/squeaky_clean/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2.2.1 2009/07/01 10:31:51 source Exp $
+ *  $Id: default.css,v 1.2.2.2 2010/09/20 10:14:50 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/squeaky_clean/index.vspx b/appsrc/ODS-Blog/templates/squeaky_clean/index.vspx
index 2848d33..56d5b28 100644
--- a/appsrc/ODS-Blog/templates/squeaky_clean/index.vspx
+++ b/appsrc/ODS-Blog/templates/squeaky_clean/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:51 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/squeaky_clean/linkblog.vspx b/appsrc/ODS-Blog/templates/squeaky_clean/linkblog.vspx
index 401f57b..5309bd0 100644
--- a/appsrc/ODS-Blog/templates/squeaky_clean/linkblog.vspx
+++ b/appsrc/ODS-Blog/templates/squeaky_clean/linkblog.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: linkblog.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: linkblog.vspx,v 1.3.2.1 2010/09/20 10:14:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/squeaky_clean/mr_green_genes.css b/appsrc/ODS-Blog/templates/squeaky_clean/mr_green_genes.css
index 6ac86e0..1053cfd 100644
--- a/appsrc/ODS-Blog/templates/squeaky_clean/mr_green_genes.css
+++ b/appsrc/ODS-Blog/templates/squeaky_clean/mr_green_genes.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: mr_green_genes.css,v 1.2.2.1 2009/07/01 10:31:51 source Exp $
+ *  $Id: mr_green_genes.css,v 1.2.2.2 2010/09/20 10:14:51 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/squeaky_clean/summary.vspx b/appsrc/ODS-Blog/templates/squeaky_clean/summary.vspx
index dbf7247..750c846 100644
--- a/appsrc/ODS-Blog/templates/squeaky_clean/summary.vspx
+++ b/appsrc/ODS-Blog/templates/squeaky_clean/summary.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: summary.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: summary.vspx,v 1.3.2.1 2010/09/20 10:14:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/squeaky_clean_2col/archive.vspx b/appsrc/ODS-Blog/templates/squeaky_clean_2col/archive.vspx
index ebc2c13..669eff7 100644
--- a/appsrc/ODS-Blog/templates/squeaky_clean_2col/archive.vspx
+++ b/appsrc/ODS-Blog/templates/squeaky_clean_2col/archive.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: archive.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: archive.vspx,v 1.3.2.1 2010/09/20 10:14:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/squeaky_clean_2col/default.css b/appsrc/ODS-Blog/templates/squeaky_clean_2col/default.css
index fa0e054..7a512b1 100644
--- a/appsrc/ODS-Blog/templates/squeaky_clean_2col/default.css
+++ b/appsrc/ODS-Blog/templates/squeaky_clean_2col/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2.2.1 2009/07/01 10:31:51 source Exp $
+ *  $Id: default.css,v 1.2.2.2 2010/09/20 10:14:51 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/squeaky_clean_2col/index.vspx b/appsrc/ODS-Blog/templates/squeaky_clean_2col/index.vspx
index 9338fdd..4e0ed4f 100644
--- a/appsrc/ODS-Blog/templates/squeaky_clean_2col/index.vspx
+++ b/appsrc/ODS-Blog/templates/squeaky_clean_2col/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:51 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/squeaky_clean_2col/linkblog.vspx b/appsrc/ODS-Blog/templates/squeaky_clean_2col/linkblog.vspx
index cfff361..b8fb4a4 100644
--- a/appsrc/ODS-Blog/templates/squeaky_clean_2col/linkblog.vspx
+++ b/appsrc/ODS-Blog/templates/squeaky_clean_2col/linkblog.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: linkblog.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: linkblog.vspx,v 1.3.2.1 2010/09/20 10:14:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/squeaky_clean_2col/mr_green_genes.css b/appsrc/ODS-Blog/templates/squeaky_clean_2col/mr_green_genes.css
index 6ac86e0..1053cfd 100644
--- a/appsrc/ODS-Blog/templates/squeaky_clean_2col/mr_green_genes.css
+++ b/appsrc/ODS-Blog/templates/squeaky_clean_2col/mr_green_genes.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: mr_green_genes.css,v 1.2.2.1 2009/07/01 10:31:51 source Exp $
+ *  $Id: mr_green_genes.css,v 1.2.2.2 2010/09/20 10:14:51 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/squeaky_clean_2col/summary.vspx b/appsrc/ODS-Blog/templates/squeaky_clean_2col/summary.vspx
index afe4c4f..63df308 100644
--- a/appsrc/ODS-Blog/templates/squeaky_clean_2col/summary.vspx
+++ b/appsrc/ODS-Blog/templates/squeaky_clean_2col/summary.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: summary.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: summary.vspx,v 1.3.2.1 2010/09/20 10:14:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/thin_clean/default.css b/appsrc/ODS-Blog/templates/thin_clean/default.css
index 6b39b84..9ad5c12 100644
--- a/appsrc/ODS-Blog/templates/thin_clean/default.css
+++ b/appsrc/ODS-Blog/templates/thin_clean/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2.2.1 2009/07/01 10:31:52 source Exp $
+ *  $Id: default.css,v 1.2.2.2 2010/09/20 10:14:51 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/thin_clean/index.vspx b/appsrc/ODS-Blog/templates/thin_clean/index.vspx
index 64ea318..c5470e4 100644
--- a/appsrc/ODS-Blog/templates/thin_clean/index.vspx
+++ b/appsrc/ODS-Blog/templates/thin_clean/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:52 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/templates/thin_pastel/default.css b/appsrc/ODS-Blog/templates/thin_pastel/default.css
index cef6868..615b5ae 100644
--- a/appsrc/ODS-Blog/templates/thin_pastel/default.css
+++ b/appsrc/ODS-Blog/templates/thin_pastel/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2.2.1 2009/07/01 10:31:52 source Exp $
+ *  $Id: default.css,v 1.2.2.2 2010/09/20 10:14:51 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Blog/templates/thin_pastel/index.vspx b/appsrc/ODS-Blog/templates/thin_pastel/index.vspx
index 834c089..5485074 100644
--- a/appsrc/ODS-Blog/templates/thin_pastel/index.vspx
+++ b/appsrc/ODS-Blog/templates/thin_pastel/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3.2.1 2009/07/01 10:31:52 source Exp $
+ -  $Id: index.vspx,v 1.3.2.2 2010/09/20 10:14:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/trackback.sql b/appsrc/ODS-Blog/trackback.sql
index 5657e0d..feaa61b 100644
--- a/appsrc/ODS-Blog/trackback.sql
+++ b/appsrc/ODS-Blog/trackback.sql
@@ -1,5 +1,5 @@
 --
---  $Id: trackback.sql,v 1.5 2007/07/26 14:52:28 source Exp $
+--  $Id: trackback.sql,v 1.5.2.1 2010/09/20 10:14:43 source Exp $
 --
 --  MT Trackback support.
 --
diff --git a/appsrc/ODS-Blog/uninst.sql b/appsrc/ODS-Blog/uninst.sql
index a7c56a4..4a4fdc9 100644
--- a/appsrc/ODS-Blog/uninst.sql
+++ b/appsrc/ODS-Blog/uninst.sql
@@ -1,5 +1,5 @@
 --
---  $Id: uninst.sql,v 1.5 2008/09/10 11:18:07 source Exp $
+--  $Id: uninst.sql,v 1.5.2.2 2010/11/09 20:15:17 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -126,6 +126,8 @@ DELETE FROM DB.DBA.WA_TYPES       WHERE WAT_NAME      = 'WEBLOG2'
 
 drop trigger SYS_USERS_BLOG_INFO_UP
 ;
+drop trigger BI_WAI_MEMBER_MODEL_UPD
+;
 
 -- NNTP
 DB.DBA.wa_exec_no_error('DROP procedure DB.DBA.BLOG_NEWS_MSG_I')
diff --git a/appsrc/ODS-Blog/vad_version b/appsrc/ODS-Blog/vad_version
index 0ceb7f6..b146dc5 100644
--- a/appsrc/ODS-Blog/vad_version
+++ b/appsrc/ODS-Blog/vad_version
@@ -1 +1 @@
-1.34.10
+1.34.69
diff --git a/appsrc/ODS-Blog/wa_integration.sql b/appsrc/ODS-Blog/wa_integration.sql
index 03d8b2a..f2dbcce 100644
--- a/appsrc/ODS-Blog/wa_integration.sql
+++ b/appsrc/ODS-Blog/wa_integration.sql
@@ -1,5 +1,5 @@
 --
---  $Id: wa_integration.sql,v 1.12 2008/02/19 11:01:44 source Exp $
+--  $Id: wa_integration.sql,v 1.12.2.3 2010/10/07 13:24:15 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -790,15 +790,18 @@ create method wa_dashboard () for wa_blog2 {
               XMLAGG(XMLELEMENT('dash-row',
                          XMLATTRIBUTES('normal' as "class", BLOG.DBA.BLOG2_DATE_FOR_HUMANS(B_TS) as "time", self.wa_name as "application"),
                          XMLELEMENT('dash-data',
-	    XMLATTRIBUTES(sprintf('<a href=\"%s/%s\">%s</a>', url, B_POST_ID,
-		BLOG.DBA.BLOG2_GET_TITLE (B_META, B_CONTENT)) "content", B_COMMENTS_NO "comments")
+	    XMLATTRIBUTES(
+
+	      concat ( N'<a href="' , cast (url as nvarchar),
+	       	       N'/', cast (B_POST_ID as nvarchar), N'">',
+		       charset_recode (BLOG.DBA.BLOG2_GET_TITLE (B_META, B_CONTENT), 'UTF-8', '_WIDE_'), N'</a>')
+
+	      "content", B_COMMENTS_NO "comments")
                          )
                     )
               )
             from
       (select top 10 * from BLOG.DBA.SYS_BLOGS where B_STATE = 2 and B_BLOG_ID = self.blogid order by B_TS desc) T);
-  notf:
-  return '';
 }
 ;
 
@@ -1282,7 +1285,7 @@ create procedure BLOG2_INSERT_MEDIA_MESSAGE (in _caller_name varchar, in _params
 {
   -- determine next post_id number from sequence
   declare _post_id any;
-  declare _content any;
+  declare _content, _texts any;
   declare  iurl, turl varchar;
 
   _post_id := cast(sequence_next ('blogger.postid') as varchar);
@@ -1297,6 +1300,7 @@ create procedure BLOG2_INSERT_MEDIA_MESSAGE (in _caller_name varchar, in _params
   _res.author := _caller_name;
   _res.userid := _res.author;
   _res.dateCreated := now ();
+  _texts := get_keyword('description', _params, '');
 
   -- create message body
   iurl := BLOG_GET_MEDIA_URL (_path);
@@ -1309,7 +1313,7 @@ create procedure BLOG2_INSERT_MEDIA_MESSAGE (in _caller_name varchar, in _params
     _content := '<div><a href="' || iurl || '">' ||
                 '<img src="' || turl ||
                 '" width="200" border="0" /></a></div><div><pre>' ||
-                get_keyword ('changed_name', _params, '') || ' </pre></div>';
+                get_keyword ('changed_name', _params, '') || ' </pre></div><div>' || _texts || '</div>';
   }
   else {
     _content := '<div><a href="' || iurl || '">' ||
@@ -1333,6 +1337,7 @@ create procedure MOB_GET_BLOG_ID (in _msg any, in tag varchar := 'blogId')
 
   foreach (any elm in res) do
     {
+      --dbg_obj_print_vars (elm);
       tok := regexp_match(sprintf ('@%s=[^@]+@', tag), elm);
       if (tok is not null)
   {
@@ -1558,10 +1563,20 @@ create procedure DB.DBA.BLOG2_MOBLOG_PROCESS_MSG(in _caller_user_name varchar, i
     new_message:
 
       -- retrieve attachments with allowed mime types from mail
-      declare _attaches any;
+      declare _attaches, res, parsed_message, texts any;
       _attaches := BLOG2_MOBBLOGGING_GET_MOB_MESSAGE(_mbody, _opts);
       decode_uuencoded_attachement (_mbody, _attaches, _opts);
 
+      parsed_message := mime_tree (_mbody);
+      res := null;
+      MOB_PROCESS_PARTS (parsed_message, _mbody, res);
+      
+      texts := '';
+      foreach (any elm in res) do
+	{
+	  texts := texts || elm;
+	}
+
       -- if attaches was not founded - skip next block
       if(_attaches is null or not isarray(_attaches) or length(_attaches) = 0) goto _endmark;
 
@@ -1584,6 +1599,7 @@ create procedure DB.DBA.BLOG2_MOBLOG_PROCESS_MSG(in _caller_user_name varchar, i
 	  _a_name := _attaches[_i][0];
 	  _a_mime := _attaches[_i][1];
 	  _a_content := _attaches[_i][2];
+--	  dbg_obj_print_vars (_a_name, _a_mime, _a_content);
 	  _publ := 0;
 	  if (_state = 'mob-pub')
 	    {
@@ -1596,7 +1612,7 @@ create procedure DB.DBA.BLOG2_MOBLOG_PROCESS_MSG(in _caller_user_name varchar, i
 		    -- matching secret
 	            declare thumb_path varchar;
 		    _media_path := BLOG2_UPLOAD_IMAGES_TO_BLOG_HOME(_caller_user_id, _blog_id, _a_content, _a_name, thumb_path);
-		    BLOG2_INSERT_MEDIA_MESSAGE (_u_name, vector('subj2', _subject), _blog_id, _media_path, _a_mime, thumb_path,
+		    BLOG2_INSERT_MEDIA_MESSAGE (_u_name, vector('subj2', _subject, 'description', texts), _blog_id, _media_path, _a_mime, thumb_path,
 			_bi_owner, _bi_home);
 		    _publ := 1;
 		  }
diff --git a/appsrc/ODS-Blog/wa_search_blog.sql b/appsrc/ODS-Blog/wa_search_blog.sql
index eeeeb1e..fdf3f90 100644
--- a/appsrc/ODS-Blog/wa_search_blog.sql
+++ b/appsrc/ODS-Blog/wa_search_blog.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: wa_search_blog.sql,v 1.3 2006/08/14 14:33:14 source Exp $
+--  $Id: wa_search_blog.sql,v 1.3.2.1 2010/09/20 10:14:43 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Blog/widgets/blog_template_check.xsl b/appsrc/ODS-Blog/widgets/blog_template_check.xsl
index bcfd76b..534317d 100644
--- a/appsrc/ODS-Blog/widgets/blog_template_check.xsl
+++ b/appsrc/ODS-Blog/widgets/blog_template_check.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: blog_template_check.xsl,v 1.2 2006/05/31 13:12:59 source Exp $
+ -  $Id: blog_template_check.xsl,v 1.2.2.1 2010/09/20 10:14:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/blog_tidy.xsl b/appsrc/ODS-Blog/widgets/blog_tidy.xsl
index 801f594..d5b8ed1 100644
--- a/appsrc/ODS-Blog/widgets/blog_tidy.xsl
+++ b/appsrc/ODS-Blog/widgets/blog_tidy.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: blog_tidy.xsl,v 1.4 2007/02/27 21:19:44 source Exp $
+ -  $Id: blog_tidy.xsl,v 1.4.2.1 2010/09/20 10:14:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/calendar.xsl b/appsrc/ODS-Blog/widgets/calendar.xsl
index e53b273..47433be 100644
--- a/appsrc/ODS-Blog/widgets/calendar.xsl
+++ b/appsrc/ODS-Blog/widgets/calendar.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: calendar.xsl,v 1.17.2.5 2010/06/25 11:13:04 source Exp $
+ -  $Id: calendar.xsl,v 1.17.2.9 2010/12/07 10:59:24 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -570,6 +570,9 @@
 			    </v:check-box>
 			    <label for="ins_media">Insert Media Object</label>
 			</span>
+                                <br/>
+				<v:check-box name="salmon_ping" value="1" xhtml_id="salmon_ping"/>
+				<label for="salmon_ping">Notify everybody mentioned in the post</label>
 			<script type="text/javascript"><![CDATA[
 			    <!--
       			    if (oEditor)
@@ -866,6 +869,10 @@
 		      post_title,
 		      bdate);
                     self.preview_post_id := id;
+                    if (self.salmon_ping.ufl_selected)
+		      {
+                         ODS.DBA.sp_send_all_mentioned (self.owner_name, sioc..blog_post_iri (self.blogid, id), msg);
+		      }
                   }
                   else
 		  {
@@ -1281,7 +1288,7 @@
      oi_handle := get_keyword ('assoc_handle', cnt, null);
      oi_key := get_keyword ('mac_key', cnt, '');
 
-     insert into OPENID..SERVER_SESSIONS (SS_HANDLE, SS_KEY, SS_KEY_TYPE, SS_EXPIRY)
+     insert soft OPENID..SERVER_SESSIONS (SS_HANDLE, SS_KEY, SS_KEY_TYPE, SS_EXPIRY)
      	values (oi_handle, oi_key, 'RAW', dateadd ('hour', 1, now()));
      self.openid_key := oi_key;
 
@@ -1348,6 +1355,14 @@
 			</v:before-render>
 		    </v:check-box> <label for="notify_me">Notify me on future updates</label>
 		</div>
+                <div>
+		    <v:check-box name="semping1" value="on" initial-checked="0" xhtml_id="semping1"/>
+		    	<label for="semping1">Issue Semantic Pingback</label>
+                </div>
+		    <div>
+				<v:check-box name="salmon_ping" value="1" xhtml_id="salmon_ping"/>
+				<label for="salmon_ping">Notify everybody mentioned in the post</label>
+		    </div>
 		<div><v:check-box name="comment1_disable_html" enabled="--equ(length (self.sid), 0)" initial-checked="--equ(isnull(self.comm_ref), 0)" /><v:label value=" Contains Markup" name="comment1_disable_html_l1" enabled="--equ(length (self.sid), 0)"/> </div>
               </td>
             </tr>
@@ -1459,7 +1474,34 @@
                 self.warn1.vc_enabled := 1;
              }
 
+	      declare blog_iri, src_iri varchar; 
+              src_iri := sioc..blog_comment_iri (self.blogid, self.postid, comm_id);
+	  if (self.semping1.ufl_selected)
+	    {
+	      if (not length (src_iri))
+	        {
+                  rollback work;
+		  self.vc_error_message := 'You must specify valid WebID in order to issue Semantic Pingback';
+                  self.vc_is_valid := 0;
+		  return; 
+		}
+              for select BI_WAI_NAME from BLOG..SYS_BLOG_INFO where BI_BLOG_ID = self.blogid do
+	        {
+		  blog_iri := sioc..blog_iri (BI_WAI_NAME);
+		  SEMPING..CLI_PING (src_iri, blog_iri);
+		}
+	      for select CL_LINK from BLOG..BLOG_COMMENT_LINKS 
+		where CL_BLOG_ID = self.blogid and CL_POST_ID = self.postid and CL_CID = comm_id and CL_PING = 1 do
+                {
+		  SEMPING..CLI_PING (src_iri, CL_LINK);
+                }		
+	    }
+	  if (self.salmon_ping.ufl_selected)
+	    {
+              ODS.DBA.sp_send_all_mentioned (self.owner_name, src_iri, self.comment2);
+	    }
                        self.comment2 := '';
+
 	  if (self.cook1.ufl_selected and self.blog_access <> 1)
                        {
                         if (self.vid is not null)
@@ -1530,6 +1572,47 @@
 </v:template>
   </xsl:template>
 
+  <xsl:template match="vm:micro-post">
+      <v:template name="mpt" type="simple" enabled="--(case when (self.blog_access = 1 or self.blog_access = 2) then 1 else 0 end)">
+	  <div class="micro-post">
+	      <div id="mptitle"><xsl:value-of select="@title"/></div>
+	      <v:form name="mpf" method="POST" type="simple">
+		  <v:textarea name="mpta" xhtml_cols="70" xhtml_rows="5" xhtml_id="mpta"/>
+		  <v:button name="mpb" action="simple" value="Send" xhtml_id="mpb" xhtml_class="real_button">
+		      <v:on-post><![CDATA[
+			  declare res BLOG.DBA."MTWeblogPost";
+			  declare dat datetime;
+			  declare id, dummy, title, message, tmp any;
+
+			  tmp := trim (self.mpta.ufl_value);
+			  if (length (tmp) = 0)
+			    {
+			      self.vc_is_valid := 0;
+			      self.vc_error_message := 'No content';
+			      return 0;
+			    }
+			  title := BLOG..BLOG_RESOLVE_REFS (sprintf ('%V', tmp));
+			  message := '';
+			  dat := now ();
+			  id := cast (sequence_next ('blogger.postid') as varchar);
+			  dummy := null;
+			  res := BLOG.DBA.BLOG_MESSAGE_OR_META_DATA (dummy, self.user_id, dummy, id, dat);
+
+			  res.title := title;
+			  res.dateCreated := dat;
+			  res.postid := id;
+			  insert into BLOG.DBA.SYS_BLOGS( B_APPKEY, B_POST_ID, B_BLOG_ID, B_TS, B_CONTENT, B_USER_ID, B_META, B_STATE, B_TITLE, B_TS)
+			    values( 'appKey', id, self.blogid, dat, message, self.user_id, res, 2, title, dat);
+			  self.mpta.ufl_value := '';
+                          self.vc_data_bind(e);
+			  ODS.DBA.sp_send_all_mentioned (self.owner_name, sioc..blog_post_iri (self.blogid, id), title);
+			  ]]></v:on-post>
+		  </v:button>
+	      </v:form>
+	  </div>
+      </v:template>
+  </xsl:template>
+
   <xsl:template match="vm:advanced-search-link">
       <xsl:variable name="val">--get_keyword ('title', self.user_data, <xsl:apply-templates select="@title" mode="static_value"/>)</xsl:variable>
       <v:url name="a_srch" value="{$val}" url="--sprintf('/weblog/public/search.vspx?blogid=%s', self.blogid)" />
diff --git a/appsrc/ODS-Blog/widgets/comment_check.xsl b/appsrc/ODS-Blog/widgets/comment_check.xsl
index 36ba300..612bb25 100644
--- a/appsrc/ODS-Blog/widgets/comment_check.xsl
+++ b/appsrc/ODS-Blog/widgets/comment_check.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: comment_check.xsl,v 1.2 2006/05/31 13:12:59 source Exp $
+ -  $Id: comment_check.xsl,v 1.2.2.1 2010/09/20 10:14:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/compat.xsl b/appsrc/ODS-Blog/widgets/compat.xsl
index b43ba2f..5d8708c 100644
--- a/appsrc/ODS-Blog/widgets/compat.xsl
+++ b/appsrc/ODS-Blog/widgets/compat.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: compat.xsl,v 1.3.2.1 2009/07/01 10:31:52 source Exp $
+ -  $Id: compat.xsl,v 1.3.2.2 2010/09/20 10:14:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/dav_browser.xsl b/appsrc/ODS-Blog/widgets/dav_browser.xsl
index 9dd2d5f..798e2ec 100644
--- a/appsrc/ODS-Blog/widgets/dav_browser.xsl
+++ b/appsrc/ODS-Blog/widgets/dav_browser.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: dav_browser.xsl,v 1.3 2008/02/19 11:01:44 source Exp $
+ -  $Id: dav_browser.xsl,v 1.3.2.1 2010/09/20 10:14:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/error.xsl b/appsrc/ODS-Blog/widgets/error.xsl
index e3633b4..51e5073 100644
--- a/appsrc/ODS-Blog/widgets/error.xsl
+++ b/appsrc/ODS-Blog/widgets/error.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: error.xsl,v 1.3 2008/02/19 11:01:44 source Exp $
+ -  $Id: error.xsl,v 1.3.2.1 2010/09/20 10:14:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/foaf.xsl b/appsrc/ODS-Blog/widgets/foaf.xsl
index 3ab4d82..a37d6b9 100644
--- a/appsrc/ODS-Blog/widgets/foaf.xsl
+++ b/appsrc/ODS-Blog/widgets/foaf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: foaf.xsl,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: foaf.xsl,v 1.3.2.1 2010/09/20 10:14:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/main.xsl b/appsrc/ODS-Blog/widgets/main.xsl
index da497ca..bbf97be 100644
--- a/appsrc/ODS-Blog/widgets/main.xsl
+++ b/appsrc/ODS-Blog/widgets/main.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: main.xsl,v 1.39.2.8 2010/03/12 09:14:09 source Exp $
+ -  $Id: main.xsl,v 1.39.2.13 2010/12/07 10:59:24 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -866,7 +866,7 @@ else if (length (self.catid))
         <script type="text/javascript" src="/weblog/public/scripts/plugins.js"></script>
       ]]>
       <xsl:apply-templates/>
-      <link rel="search" type="application/opensearchdescription+xml" title="OpenSearch Description" href="http://<?V self.host ?>/weblog/public/search.vspx?blogid=<?V self.blogid ?>&type=text&kwds=dir&OpenSearch" />
+      <link rel="search" type="application/opensearchdescription+xml" title="OpenSearch Description" href="http://<?V self.host ?>/weblog/public/search.vspx?blogid=<?V self.blogid ?><?V '&type=text&kwds=dir&OpenSearch' ?>" />
       <?vsp
         foreach (any f in self.custom_rss) do
 	  {
@@ -2142,6 +2142,11 @@ window.onload = function (e)
 	  <xsl:apply-templates/>
       </a>
   </xsl:template>
+  <xsl:template match="vm:post-tweet-link">
+      <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
+	  data-url="<?V self.ur ?>?id=<?V t_post_id ?>">Tweet</a>
+      <![CDATA[<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>]]>
+  </xsl:template>
 
   <xsl:template match="vm:post-date">
       <xsl:call-template name="post-parts-check"/>
@@ -2203,6 +2208,26 @@ window.onload = function (e)
       </span>
   </xsl:template>
 
+  <xsl:template match="vm:post-author-nick">
+      <xsl:call-template name="post-parts-check"/>
+      <span class="dc-creator" property="dc:creator">
+	<?vsp
+	     {
+		    declare title_val any;
+                    set isolation = 'uncommitted';
+		    declare auth_name, auth_iri, auth_pers_iri any;
+                    declare exit handler for not found;
+                    select U_NAME into auth_name from BLOG.DBA.SYS_BLOG_INFO, SYS_USERS where BI_OWNER = control.te_rowset[5] and U_ID = BI_OWNER;
+			   auth_iri := sioc.DBA.user_obj_iri (auth_name);
+                           auth_pers_iri := sioc.DBA.person_iri (auth_iri);
+                           title_val := charset_recode ('<a rel="foaf:maker" rev="foaf:made" href="' || auth_pers_iri || '">' ||
+			       sprintf('%V', auth_name) || '</a>', 'UTF-8', '');
+		    http (title_val);
+	      }
+	  ?>
+      </span>
+  </xsl:template>
+
   <xsl:template match="vm:post-body">
       <xsl:call-template name="post-parts-check"/>
                     <?vsp
@@ -2335,6 +2360,20 @@ window.onload = function (e)
     ?>
   </xsl:template>
 
+  <xsl:template match="vm:micropost-actions">
+    <xsl:call-template name="post-parts-check"/>
+    <?vsp
+      if (BLOG2_GET_ACCESS (t_blog_id, self.sid, self.realm, 120) in (1, 2))
+      {
+    ?>
+    <v:url name="delete1" value="Delete" url="--concat('index.vspx?delete_post=', t_post_id)" render-only="1" />
+    <xsl:text> </xsl:text>
+    <v:url name="show_log1" value="Log" url="--concat('index.vspx?page=routing_queue&post_id=', t_post_id)" render-only="1" />
+    <?vsp
+      }
+    ?>
+  </xsl:template>
+
   <xsl:template match="vm:post-categories">
       <xsl:variable name="val">get_keyword ('title', self.user_data, <xsl:apply-templates select="@title" mode="static_value"/>)</xsl:variable>
       <xsl:variable name="delm">get_keyword ('delimiter', self.user_data, <xsl:apply-templates select="@delimiter" mode="static_value"/>)</xsl:variable>
@@ -2448,7 +2487,7 @@ window.onload = function (e)
 
   <xsl:template match="vm:posts">
       <v:data-set name="posts" scrollable="1" edit="1" data-source="self.dss" nrows="10" enabled="--isnull (self.post_to_remove)">
-        <v:template name="template1" type="simple" condition="self.sel_cat is not null">
+        <!--v:template name="template1" type="simple" condition="self.sel_cat is not null">
           <div class="posts-title">
             <?vsp
 	    if (self.page <> 'archive')
@@ -2468,7 +2507,7 @@ window.onload = function (e)
 	      }
 	    ?>
           </div>
-        </v:template>
+        </v:template-->
         <v:template name="template2" type="repeat">
           <v:template name="template7" type="if-not-exists">
             <div class="widget-title">
@@ -4438,25 +4477,12 @@ window.onload = function (e)
                   };
       commit work;
 
+                  declare mess, elm, __uid any;
                   pop3s := get_keyword ('POP3Server', self.opts);
                   nam :=   get_keyword ('POP3Account', self.opts);
                   pwd1 :=  get_keyword ('POP3Passwd', self.opts);
-
-      res := pop3_get(pop3s, nam, pwd1, 999999999);
-
-                  declare inx, len int;
-                  declare mess, elm, __uid any;
-                  inx := 0;
-                  len := length(res);
                   __uid := (select VS_UID from VSPX_SESSION where VS_SID = self.sid and VS_REALM = self.realm);
-                  while (inx < len)
-                  {
-                    mess := aref(aref(res, inx), 1);
-                    elm := mail_header(mess, 'Message-Id');
-                    if (not exists(select 1 from MAIL_MESSAGE where MM_MSG_ID = elm and MM_OWN = __uid))
-                      NEW_MAIL(__uid, mess);
-                    inx := inx + 1;
-                  }
+                  BLOG..BLOG_GET_MAIL_VIA_POP3 (pop3s, nam, pwd1, __uid);
                   self.moblog_ds.vc_data_bind(e);
                 ]]>
               </v:on-post>
@@ -9260,15 +9286,16 @@ window.onload = function (e)
 							      xhtml_style="width:100%"
 							      name="templates_list"
 							      sql="select rtrim (WS.WS.COL_PATH (COL_ID), '/') as KEYVAL, COL_NAME as NAME FROM WS.WS.SYS_DAV_COL
-							      WHERE WS..COL_PATH (COL_ID) like registry_get('_blog2_path_') || 'templates/_*' union all select self.phome || 'templates/custom' as KEYVAL, 'custom' as NAME from BLOG..SYS_BLOG_INFO where BI_BLOG_ID = self.blogid"
+							      WHERE WS..COL_PATH (COL_ID) like registry_get('_blog2_path_') || 'templates/_*' and 
+								  not WS..COL_PATH (COL_ID) like registry_get('_blog2_path_') || 'templates/_*/_*'
+								  union all select self.phome || 'templates/custom' as KEYVAL, 'custom' as NAME from BLOG..SYS_BLOG_INFO where BI_BLOG_ID = self.blogid"
 							      key-column="KEYVAL"
 							      value-column="NAME"
 							      xhtml_size="10">
 							      <v:after-data-bind>
 								  control.ufl_value := self.current_template;
 								  if (control.ufl_value is null)
-								    control.ufl_value := registry_get('_blog2_path_')
-								  	|| 'templates/openlink/';
+								    control.ufl_value := registry_get('_blog2_path_') || 'templates/openlink/';
 								  control.vs_set_selected ();
 							      </v:after-data-bind>
 							  </v:data-list>
diff --git a/appsrc/ODS-Blog/widgets/make_sp.xsl b/appsrc/ODS-Blog/widgets/make_sp.xsl
index f9eb824..a688c7c 100644
--- a/appsrc/ODS-Blog/widgets/make_sp.xsl
+++ b/appsrc/ODS-Blog/widgets/make_sp.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: make_sp.xsl,v 1.2 2006/05/31 13:12:59 source Exp $
+ -  $Id: make_sp.xsl,v 1.2.2.1 2010/09/20 10:14:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/opml2ocs.xsl b/appsrc/ODS-Blog/widgets/opml2ocs.xsl
index 14c83ac..7eaa131 100644
--- a/appsrc/ODS-Blog/widgets/opml2ocs.xsl
+++ b/appsrc/ODS-Blog/widgets/opml2ocs.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: opml2ocs.xsl,v 1.2 2006/05/31 13:12:59 source Exp $
+ -  $Id: opml2ocs.xsl,v 1.2.2.1 2010/09/20 10:14:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/opml2ocs03.xsl b/appsrc/ODS-Blog/widgets/opml2ocs03.xsl
index 77d6a7f..72ad9b8 100644
--- a/appsrc/ODS-Blog/widgets/opml2ocs03.xsl
+++ b/appsrc/ODS-Blog/widgets/opml2ocs03.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: opml2ocs03.xsl,v 1.3 2008/02/19 11:01:44 source Exp $
+ -  $Id: opml2ocs03.xsl,v 1.3.2.1 2010/09/20 10:14:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/opml2xoxo.xsl b/appsrc/ODS-Blog/widgets/opml2xoxo.xsl
index a20c285..db6c6ed 100644
--- a/appsrc/ODS-Blog/widgets/opml2xoxo.xsl
+++ b/appsrc/ODS-Blog/widgets/opml2xoxo.xsl
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id: opml2xoxo.xsl,v 1.1 2006/05/27 20:47:43 source Exp $  -->
+<!-- $Id: opml2xoxo.xsl,v 1.1.2.1 2010/09/20 10:14:53 source Exp $  -->
 <!--
 Copyright Uche Ogbuji 2005
 -->
diff --git a/appsrc/ODS-Blog/widgets/render.xsl b/appsrc/ODS-Blog/widgets/render.xsl
index 9acc396..e10258c 100644
--- a/appsrc/ODS-Blog/widgets/render.xsl
+++ b/appsrc/ODS-Blog/widgets/render.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: render.xsl,v 1.2.2.1 2009/07/01 10:31:53 source Exp $
+ -  $Id: render.xsl,v 1.2.2.2 2010/09/20 10:14:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/rss11.xsl b/appsrc/ODS-Blog/widgets/rss11.xsl
index 6775e27..e0b5e43 100644
--- a/appsrc/ODS-Blog/widgets/rss11.xsl
+++ b/appsrc/ODS-Blog/widgets/rss11.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss11.xsl,v 1.3 2006/06/27 15:10:09 source Exp $
+ -  $Id: rss11.xsl,v 1.3.2.1 2010/09/20 10:14:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/rss2atom.xsl b/appsrc/ODS-Blog/widgets/rss2atom.xsl
index 4d24e23..9278af5 100644
--- a/appsrc/ODS-Blog/widgets/rss2atom.xsl
+++ b/appsrc/ODS-Blog/widgets/rss2atom.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom.xsl,v 1.4.2.2 2010/05/31 22:00:11 source Exp $
+ -  $Id: rss2atom.xsl,v 1.4.2.4 2010/11/09 20:15:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -59,6 +59,7 @@
     <xsl:if test="parent::channel">
 	<link href="{$httpUrl}" type="application/atom+xml" rel="self"/>
 	<xsl:copy-of select="parent::channel/atom:link[@rel='hub' and @href]"/>
+	<xsl:copy-of select="parent::channel/atom:link[@rel='salmon' and @href]"/>
     </xsl:if>
     <xsl:if test="parent::item and not ($isRegularFeed)">
 	<xsl:choose>
diff --git a/appsrc/ODS-Blog/widgets/rss2atom03.xsl b/appsrc/ODS-Blog/widgets/rss2atom03.xsl
index 6ec1ff4..da34dfb 100644
--- a/appsrc/ODS-Blog/widgets/rss2atom03.xsl
+++ b/appsrc/ODS-Blog/widgets/rss2atom03.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom03.xsl,v 1.4 2006/06/27 15:10:09 source Exp $
+ -  $Id: rss2atom03.xsl,v 1.4.2.1 2010/09/20 10:14:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/rss2mrss.xsl b/appsrc/ODS-Blog/widgets/rss2mrss.xsl
index 6ed987c..4272176 100644
--- a/appsrc/ODS-Blog/widgets/rss2mrss.xsl
+++ b/appsrc/ODS-Blog/widgets/rss2mrss.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2mrss.xsl,v 1.2 2006/05/31 13:12:59 source Exp $
+ -  $Id: rss2mrss.xsl,v 1.2.2.1 2010/09/20 10:14:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/rss2rdf.xsl b/appsrc/ODS-Blog/widgets/rss2rdf.xsl
index 45d6978..12e9541 100644
--- a/appsrc/ODS-Blog/widgets/rss2rdf.xsl
+++ b/appsrc/ODS-Blog/widgets/rss2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2rdf.xsl,v 1.6 2007/02/27 21:19:44 source Exp $
+ -  $Id: rss2rdf.xsl,v 1.6.2.1 2010/09/20 10:14:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/rss2wml.xsl b/appsrc/ODS-Blog/widgets/rss2wml.xsl
index 0b97b15..582d481 100644
--- a/appsrc/ODS-Blog/widgets/rss2wml.xsl
+++ b/appsrc/ODS-Blog/widgets/rss2wml.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2wml.xsl,v 1.2 2006/05/31 13:12:59 source Exp $
+ -  $Id: rss2wml.xsl,v 1.2.2.1 2010/09/20 10:14:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/rss2xbel.xsl b/appsrc/ODS-Blog/widgets/rss2xbel.xsl
index d8a2639..ea17d33 100644
--- a/appsrc/ODS-Blog/widgets/rss2xbel.xsl
+++ b/appsrc/ODS-Blog/widgets/rss2xbel.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2xbel.xsl,v 1.2 2006/05/31 13:12:59 source Exp $
+ -  $Id: rss2xbel.xsl,v 1.2.2.1 2010/09/20 10:14:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/store.xsl b/appsrc/ODS-Blog/widgets/store.xsl
index 73a77d4..0d27f75 100644
--- a/appsrc/ODS-Blog/widgets/store.xsl
+++ b/appsrc/ODS-Blog/widgets/store.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: store.xsl,v 1.2 2006/05/31 13:12:59 source Exp $
+ -  $Id: store.xsl,v 1.2.2.1 2010/09/20 10:14:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/store_post.xsl b/appsrc/ODS-Blog/widgets/store_post.xsl
index bdccae0..2dcf17c 100644
--- a/appsrc/ODS-Blog/widgets/store_post.xsl
+++ b/appsrc/ODS-Blog/widgets/store_post.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: store_post.xsl,v 1.4 2008/06/25 09:28:21 source Exp $
+ -  $Id: store_post.xsl,v 1.4.2.1 2010/09/20 10:14:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Blog/widgets/xbel.xsl b/appsrc/ODS-Blog/widgets/xbel.xsl
index c218a59..0cee1ee 100644
--- a/appsrc/ODS-Blog/widgets/xbel.xsl
+++ b/appsrc/ODS-Blog/widgets/xbel.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: xbel.xsl,v 1.2 2006/05/31 13:12:59 source Exp $
+ -  $Id: xbel.xsl,v 1.2.2.1 2010/09/20 10:14:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Bookmark/Makefile.in b/appsrc/ODS-Bookmark/Makefile.in
index 3d23ca0..b2942be 100644
--- a/appsrc/ODS-Bookmark/Makefile.in
+++ b/appsrc/ODS-Bookmark/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-Bookmark/make_vad.sh b/appsrc/ODS-Bookmark/make_vad.sh
index 8561fb1..7b1963b 100755
--- a/appsrc/ODS-Bookmark/make_vad.sh
+++ b/appsrc/ODS-Bookmark/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.58.2.14 2010/07/09 14:37:00 source Exp $
+#  $Id: make_vad.sh,v 1.58.2.23 2011/02/03 10:26:14 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -30,7 +30,7 @@ export LANG LC_ALL
 
 MODE=$1
 LOGDIR=`pwd`
-VERSION="1.7.87"
+VERSION="1.7.92"
 LOGFILE="${LOGDIR}/vad_make.log"
 STICKER_DAV="vad_dav.xml"
 STICKER_FS="vad_filesystem.xml"
@@ -226,7 +226,7 @@ sticker_init() {
   echo "  <name package=\"Bookmarks\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS Bookmark Manager\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
@@ -238,8 +238,8 @@ sticker_init() {
   echo "<dependencies>" >> $STICKER
   echo "  <require>" >> $STICKER
   echo "    <name package=\"Framework\"/>" >> $STICKER
-  echo "    <versions_later package=\"1.73.21\">" >> $STICKER
-  echo "      <prop name=\"Date\" value=\"2010-07-08 12:00\" />" >> $STICKER
+  echo "    <versions_later package=\"1.76.96\">" >> $STICKER
+  echo "      <prop name=\"Date\" value=\"2010-10-08 12:00\" />" >> $STICKER
   echo "      <prop name=\"Comment\" value=\"An incompatible version of the ODS Framework\" />" >> $STICKER
   echo "    </versions_later>" >> $STICKER
   echo "  </require>" >> $STICKER
diff --git a/appsrc/ODS-Bookmark/sql/DET_Bookmark.sql b/appsrc/ODS-Bookmark/sql/DET_Bookmark.sql
index 107be11..ae5aba3 100644
--- a/appsrc/ODS-Bookmark/sql/DET_Bookmark.sql
+++ b/appsrc/ODS-Bookmark/sql/DET_Bookmark.sql
@@ -1,5 +1,5 @@
 --
---  $Id: DET_Bookmark.sql,v 1.11 2008/09/10 11:15:26 source Exp $
+--  $Id: DET_Bookmark.sql,v 1.11.2.1 2010/09/20 10:14:54 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Bookmark/sql/bmk-a-api.sql b/appsrc/ODS-Bookmark/sql/bmk-a-api.sql
index 82dc495..817eff0 100644
--- a/appsrc/ODS-Bookmark/sql/bmk-a-api.sql
+++ b/appsrc/ODS-Bookmark/sql/bmk-a-api.sql
@@ -1,5 +1,5 @@
 --
---  $Id: bmk-a-api.sql,v 1.10.2.2 2009/12/08 23:25:22 source Exp $
+--  $Id: bmk-a-api.sql,v 1.10.2.3 2010/09/20 10:14:54 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Bookmark/sql/bmk-a-code.sql b/appsrc/ODS-Bookmark/sql/bmk-a-code.sql
index ce689fb..7dd121d 100644
--- a/appsrc/ODS-Bookmark/sql/bmk-a-code.sql
+++ b/appsrc/ODS-Bookmark/sql/bmk-a-code.sql
@@ -1,5 +1,5 @@
 --
---  $Id: bmk-a-code.sql,v 1.56.2.8 2010/07/09 14:37:00 source Exp $
+--  $Id: bmk-a-code.sql,v 1.56.2.16 2010/11/19 16:49:51 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -19,6 +19,68 @@
 --  with this program; if not, write to the Free Software Foundation, Inc.,
 --  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 --
+
+-------------------------------------------------------------------------------
+--
+-- ACL Functions
+--
+-------------------------------------------------------------------------------
+--
+create procedure BMK.WA.acl_condition (
+  in domain_id integer,
+  in id integer := null)
+{
+  if (not is_https_ctx ())
+    return 0;
+
+  if (exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_ACL is not null))
+    return 1;
+
+  if (exists (select 1 from BMK.WA.BOOKMARK_DOMAIN where BD_ID = id and BD_ACL is not null))
+    return 1;
+
+  return 0;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure BMK.WA.acl_check (
+  in domain_id integer,
+  in id integer := null)
+{
+  declare rc varchar;
+  declare graph_iri, groups_iri, acl_iris any;
+
+  rc := '';
+  if (BMK.WA.acl_condition (domain_id, id))
+  {
+    acl_iris := vector (BMK.WA.forum_iri (domain_id));
+    if (not isnull (id))
+      acl_iris := vector (SIOC..bmk_post_iri (domain_id, id), BMK.WA.forum_iri (domain_id));
+
+    graph_iri := BMK.WA.acl_graph (domain_id);
+    groups_iri := SIOC..acl_groups_graph (BMK.WA.domain_owner_id (domain_id));
+    rc := SIOC..acl_check (graph_iri, groups_iri, acl_iris);
+  }
+  return rc;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure BMK.WA.acl_list (
+  in domain_id integer)
+{
+  declare graph_iri, groups_iri, iri any;
+
+  iri := BMK.WA.forum_iri (domain_id);
+  graph_iri := BMK.WA.acl_graph (domain_id);
+  groups_iri := SIOC..acl_groups_graph (BMK.WA.domain_owner_id (domain_id));
+  return SIOC..acl_list (graph_iri, groups_iri, iri);
+}
+;
+
 -------------------------------------------------------------------------------
 --
 -- Session Functions
@@ -28,22 +90,29 @@ create procedure BMK.WA.session_domain (
   inout params any)
 {
   declare aPath, domain_id, options any;
-
   declare exit handler for sqlstate '*'
   {
-    domain_id := -1;
+    domain_id := -2;
     goto _end;
   };
 
   options := http_map_get('options');
   if (not is_empty_or_null (options))
+  {
     domain_id := get_keyword ('domain', options);
-  if (is_empty_or_null (domain_id)) {
+  }
+  if (is_empty_or_null (domain_id))
+  {
     aPath := split_and_decode (trim (http_path (), '/'), 0, '\0\0/');
+    if ((length (aPath) = 1) or ((length (aPath) = 2) and (aPath[1] like '%.vsp%')))
+    {
+      domain_id := -1;
+      goto _end;
+    }
     domain_id := cast(aPath[1] as integer);
   }
-  if (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id))
-    domain_id := -1;
+  if (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_TYPE_NAME = 'Bookmark'))
+    domain_id := -2;
 
 _end:;
   return cast (domain_id as integer);
@@ -55,61 +124,27 @@ _end:;
 create procedure BMK.WA.session_restore(
   inout params any)
 {
-  declare aPath, domain_id, user_id, user_name, user_role, sid, realm, options any;
-
-  declare exit handler for sqlstate '*' {
-    domain_id := -2;
-    goto _end;
-  };
-
-  sid := get_keyword('sid', params, '');
-  realm := get_keyword('realm', params, '');
+  declare domain_id, account_id, account_rights any;
 
-  options := http_map_get('options');
-  if (not is_empty_or_null(options))
-    domain_id := get_keyword('domain', options);
-  if (is_empty_or_null (domain_id)) {
-    aPath := split_and_decode (trim (http_path (), '/'), 0, '\0\0/');
-    domain_id := cast(aPath[1] as integer);
-  }
-  if (not exists(select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and domain_id <> -2))
-    domain_id := -1;
+  domain_id := BMK.WA.session_domain (params);
+  account_id := http_nobody_uid ();
 
-_end:
-  domain_id := cast(domain_id as integer);
-  user_id := -1;
   for (select U.U_ID,
               U.U_NAME,
               U.U_FULL_NAME
          from DB.DBA.VSPX_SESSION S,
               WS.WS.SYS_DAV_USER U
-        where S.VS_REALM = realm
-          and S.VS_SID   = sid
+        where S.VS_REALM = get_keyword ('realm', params, 'wa')
+          and S.VS_SID   = get_keyword ('sid', params, '')
           and S.VS_UID   = U.U_NAME) do
   {
-    user_id   := U_ID;
-    user_name := BMK.WA.user_name(U_NAME, U_FULL_NAME);
-    user_role := BMK.WA.access_role(domain_id, U_ID);
-  }
-  if ((user_id = -1) and (domain_id >= 0) and (not exists(select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_IS_PUBLIC = 1)))
-  domain_id := -1;
-
-  if (user_id = -1)
-    if (domain_id = -1) {
-      user_role := 'expire';
-      user_name := 'Expire session';
-    } else if (domain_id = -2) {
-      user_role := 'public';
-      user_name := 'Public User';
-    } else {
-      user_role := 'guest';
-      user_name := 'Guest User';
+    account_id := U_ID;
     }
-
-  return vector('domain_id', domain_id,
-                'user_id',   user_id,
-                'user_name', user_name,
-                'user_role', user_role
+  account_rights := BMK.WA.access_rights (domain_id, account_id);
+  return vector (
+                 'domain_id', domain_id,
+                 'account_id',   account_id,
+                 'account_rights', account_rights
                );
 }
 ;
@@ -157,64 +192,21 @@ create procedure BMK.WA.check_admin(
   in user_id integer) returns integer
 {
   declare group_id integer;
-  group_id := (select U_GROUP from SYS_USERS where U_ID = user_id);
 
-  if (user_id = 0)
-    return 1;
-  if (user_id = http_dav_uid ())
-    return 1;
-  if (group_id = 0)
-    return 1;
-  if (group_id = http_dav_uid ())
+  if ((user_id = 0) or (user_id = http_dav_uid ()))
     return 1;
-  if(group_id = http_dav_uid()+1)
-    return 1;
-  return 0;
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure BMK.WA.check_grants(in domain_id integer, in user_id integer, in role_name varchar)
-{
-  whenever not found goto _end;
 
-  if (BMK.WA.check_admin(user_id))
+  group_id := (select U_GROUP from SYS_USERS where U_ID = user_id);
+  if ((group_id = 0) or (group_id = http_dav_uid ()) or (group_id = http_dav_uid()+1))
     return 1;
-  if (role_name is null or role_name = '')
-    return 0;
-  if (role_name = 'admin')
-    return 0;
-  if (role_name = 'guest') {
-    if (exists(select 1
-                 from SYS_USERS A,
-                      WA_MEMBER B,
-                      WA_INSTANCE C
-                where A.U_ID = user_id
-                  and B.WAM_USER = A.U_ID
-                  and B.WAM_INST = C.WAI_NAME
-                  and C.WAI_ID = domain_id))
-      return 1;
-  }
-  if (role_name = 'owner')
-    if (exists(select 1
-                 from SYS_USERS A,
-                      WA_MEMBER B,
-                      WA_INSTANCE C
-                where A.U_ID = user_id
-                  and B.WAM_USER = A.U_ID
-                  and B.WAM_MEMBER_TYPE = 1
-                  and B.WAM_INST = C.WAI_NAME
-                  and C.WAI_ID = domain_id))
-      return 1;
-_end:
+
   return 0;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure BMK.WA.check_grants2(in role_name varchar, in page_name varchar)
+create procedure BMK.WA.check_grants (in role_name varchar, in page_name varchar)
 {
   declare tree any;
 
@@ -227,48 +219,70 @@ create procedure BMK.WA.check_grants2(in role_name varchar, in page_name varchar
 
 -------------------------------------------------------------------------------
 --
-create procedure BMK.WA.access_role(in domain_id integer, in user_id integer)
+create procedure BMK.WA.access_rights (
+  in domain_id integer,
+  in account_id integer)
 {
-  whenever not found goto _end;
+  declare rc varchar;
+
+  if (domain_id = -1)
+    return 'R';
+
+  if (domain_id = -2)
+    return null;
+
+  if (BMK.WA.check_admin (account_id))
+    return 'W';
 
-  if (BMK.WA.check_admin(user_id))
-    return 'admin';
   if (exists(select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
                 and B.WAM_MEMBER_TYPE = 1
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
-    return 'owner';
+    return 'W';
+
   if (exists(select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
                 and B.WAM_MEMBER_TYPE = 2
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
-    return 'author';
+    return 'W';
+
+  if (is_https_ctx ())
+  {
+    rc := BMK.WA.acl_check (domain_id);
+    if (rc <> '')
+      return rc;
+  }
+
   if (exists(select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
-    return 'reader';
-  if (exists(select 1
-               from SYS_USERS A
-              where A.U_ID = user_id))
-    return 'guest';
+    return 'R';
 
-_end:
-  return 'public';
+  if (exists (select 1
+                from DB.DBA.WA_INSTANCE
+               where WAI_ID = domain_id
+                 and WAI_IS_PUBLIC = 1))
+    return 'R';
+
+  if (is_https_ctx () and exists (select 1 from BMK.WA.acl_list (id)(iri varchar) x where x.id = domain_id))
+    return '';
+
+  return null;
 }
 ;
 
@@ -312,21 +326,17 @@ create procedure BMK.WA.page_name ()
 create procedure BMK.WA.menu_tree (
   in access_role varchar := null)
 {
-  declare S, T varchar;
-
-  S :=
+  return
 '<?xml version="1.0" ?>
 <menu_tree>
-  <node name="Bookmarks"       url="bookmarks.vspx"       id="1"                allowed="public guest reader author owner admin">
-    <node name="11"            url="bookmarks.vspx"       id="11"  place="link" allowed="public guest reader author owner admin"/>
-    <node name="12"            url="search.vspx"          id="12"  place="link" allowed="public guest reader author owner admin"/>
-    <node name="13"            url="error.vspx"           id="13"  place="link" allowed="public guest reader author owner admin"/>
-    <node name="14"            url="settings.vspx"        id="14"  place="link" allowed="reader author owner admin"/>
-    <node name="15"            url="bookmark.vspx"        id="15"  place="link" allowed="public guest reader author owner admin"/>
+  <node name="Bookmarks"       url="bookmarks.vspx"       id="1"                allowed="W R">
+    <node name="11"            url="bookmarks.vspx"       id="11"  place="link" allowed="W R"/>
+    <node name="12"            url="search.vspx"          id="12"  place="link" allowed="W R"/>
+    <node name="13"            url="error.vspx"           id="13"  place="link" allowed="W R"/>
+    <node name="14"            url="settings.vspx"        id="14"  place="link" allowed="W"/>
+    <node name="15"            url="bookmark.vspx"        id="15"  place="link" allowed="W R"/>
   </node>
 </menu_tree>';
-
-  return S;
 }
 ;
 
@@ -650,6 +660,15 @@ create procedure BMK.WA.forum_iri (
 
 -------------------------------------------------------------------------------
 --
+create procedure BMK.WA.acl_graph (
+  in domain_id integer)
+{
+  return SIOC..acl_graph ('Bookmark', BMK.WA.domain_name (domain_id));
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure BMK.WA.domain_sioc_url (
   in domain_id integer,
   in sid varchar := null,
@@ -734,9 +753,7 @@ create procedure BMK.WA.account_delete(
      and WAM_USER = account_id;
 
   if (iCount = 0)
-  {
     delete from BMK.WA.GRANTS where G_GRANTER_ID = account_id or G_GRANTEE_ID = account_id;
-  }
 
   return 1;
 }
@@ -1196,6 +1213,26 @@ create procedure BMK.WA.bookmark_export_tmp (
 
 -------------------------------------------------------------------------------
 --
+create procedure BMK.WA.bookmark_rights (
+  in domain_id integer,
+  in id integer,
+  in access_role varchar)
+{
+  declare retValue varchar;
+
+  retValue := '';
+  if (exists (select 1 from BMK.WA.BOOKMARK_DOMAIN where BD_ID = id and BD_DOMAIN_ID = domain_id))
+  {
+    retValue := BMK.WA.acl_check (domain_id, id);
+    if (retValue = '')
+      retValue := access_role;
+  }
+  return retValue;
+}
+;
+
+-------------------------------------------------------------------------------
+--
 -- Tags
 --
 -------------------------------------------------------------------------------
@@ -1416,12 +1453,15 @@ create procedure BMK.WA.folder_path3(
   declare parent_id integer;
   declare path any;
 
-  if (grant_id = -1) {
+  if (grant_id = -1)
+  {
     path := coalesce(BMK.WA.folder_path (folder_id), '');
   } else {
-    for (select G_OBJECT_TYPE, G_OBJECT_ID from BMK.WA.GRANTS where G_ID = grant_id) do {
+    for (select G_OBJECT_TYPE, G_OBJECT_ID from BMK.WA.GRANTS where G_ID = grant_id) do
+    {
       path := '';
-      if (G_OBJECT_TYPE = 'F') {
+      if (G_OBJECT_TYPE = 'F')
+      {
         parent_id := (select F_PARENT_ID from BMK.WA.FOLDER where F_ID = G_OBJECT_ID);
         path := replace(coalesce(BMK.WA.folder_path (folder_id), ''), coalesce(BMK.WA.folder_path (parent_id), ''), '');
       }
@@ -1442,13 +1482,13 @@ create procedure BMK.WA.folder_path4 (
   declare parent_id integer;
   declare name any;
 
-  if (grant_id = -1) {
+  if (grant_id = -1)
+  {
     name := coalesce(folder_name, '');
   } else {
-    for (select G_OBJECT_TYPE, G_OBJECT_ID from BMK.WA.GRANTS where G_ID = grant_id) do {
-      name := '';
-      if (G_OBJECT_TYPE = 'F')
-        name := coalesce(folder_name, '');
+    for (select G_OBJECT_TYPE, G_OBJECT_ID from BMK.WA.GRANTS where G_ID = grant_id) do
+    {
+      name := case when G_OBJECT_TYPE = 'F' then coalesce(folder_name, '') else '' end;
     }
   }
   if (name <> '')
@@ -1463,7 +1503,8 @@ create procedure BMK.WA.folder_check_name(
   in folder_name varchar,
   in is_path integer := 0)
 {
-  if (is_path) {
+  if (is_path)
+  {
     declare i integer;
     declare aPath any;
 
@@ -1472,9 +1513,8 @@ create procedure BMK.WA.folder_check_name(
       if (not BMK.WA.validate('folder', aPath[i]))
         return 0;
     return 1;
-  } else {
-    return BMK.WA.validate('folder', folder_name);
   }
+  return BMK.WA.validate('folder', folder_name);
 }
 ;
 
@@ -1533,6 +1573,7 @@ create procedure BMK.WA.folder_check_parent(
 create procedure BMK.WA.sfolder_sql(
   inout domain_id integer,
   inout account_id integer,
+  inout account_rights varchar,
   in data varchar,
   in maxRows varchar := '',
   in nodeType varchar := 'b')
@@ -1572,7 +1613,8 @@ create procedure BMK.WA.sfolder_sql(
   }
 
   tmp := BMK.WA.xml_get('tags', data);
-  if (not is_empty_or_null(tmp)) {
+  if (not is_empty_or_null(tmp))
+  {
     if (T = '') {
       T := BMK.WA.tags2search (tmp);
     } else {
@@ -1583,29 +1625,49 @@ create procedure BMK.WA.sfolder_sql(
     S := replace(S, '<TEXT>', sprintf('and contains (a.BD_DESCRIPTION, \'[__lang "x-ViDoc"] %s\') \n', T));
 
   tmp := BMK.WA.xml_get('folder', data);
-  if (not is_empty_or_null(tmp)) {
+  if (not is_empty_or_null(tmp))
+  {
     tmp := cast(tmp as integer);
     if (tmp > 0)
       BMK.WA.sfolder_sql_where (where2, delimiter2, sprintf('d.F_PATH like \'%s%s\'', BMK.WA.folder_path (tmp), '%'));
   }
 
+  tmp := BMK.WA.xml_get('folderID', data);
+  if (not is_empty_or_null(tmp))
+  {
+    tmp := cast (tmp as integer);
+    BMK.WA.sfolder_sql_where (where2, delimiter2, sprintf ('coalesce(a.BD_FOLDER_ID, -1) = %d', tmp));
+  }
+
   tmp := BMK.WA.xml_get('bookmark', data);
-  if (not is_empty_or_null(tmp)) {
+  if (not is_empty_or_null(tmp))
+  {
     tmp := cast(tmp as integer);
     if (tmp > 0)
       BMK.WA.sfolder_sql_where (where2, delimiter2, sprintf('a.BD_ID = %d', tmp));
   }
 
   tmp := BMK.WA.xml_get('updatedAfter', data);
-  if (not is_empty_or_null(tmp)) {
+  if (not is_empty_or_null(tmp))
+  {
     BMK.WA.sfolder_sql_where (where2, delimiter2, sprintf ('a.BD_UPDATED >= \'%s\'', tmp));
   }
 
   tmp := BMK.WA.xml_get('updatedBefore', data);
-  if (not is_empty_or_null(tmp)) {
+  if (not is_empty_or_null(tmp))
+  {
     BMK.WA.sfolder_sql_where (where2, delimiter2, sprintf ('a.BD_UPDATED <= \'%s\'', tmp));
   }
 
+  if (account_rights = '')
+  {
+    if (is_https_ctx ())
+    {
+      S := S || '   and SIOC..bmk_post_iri (a.BD_DOMAIN_ID, a.BD_ID) in (select s.iri from BMK.WA.acl_list (id)(iri varchar) s where s.id = a.BD_DOMAIN_ID)';
+    } else {
+      S := S || '   and 1=0';
+    }
+  }
   if (maxRows <> '')
     maxRows := 'TOP ' || maxRows;
   S := replace(S, '<MAX>', maxRows);
@@ -1625,6 +1687,7 @@ create procedure BMK.WA.sfolder_sql(
 create procedure BMK.WA.shared_sql(
   inout domain_id integer,
   inout account_id integer,
+  inout account_rights varchar,
   in data any,
   in maxRows varchar := '')
 {
@@ -1650,9 +1713,10 @@ create procedure BMK.WA.shared_sql(
   shared := cast (BMK.WA.xml_get ('mySharedBookmarks', data, '0') as integer);
 
   -- search in my own
-  if (own = 1) {
+  if (own = 1)
+  {
     state := '00000';
-    sql := BMK.WA.sfolder_sql(domain_id, account_id, data, maxRows);
+    sql := BMK.WA.sfolder_sql (domain_id, account_id, account_rights, data, maxRows);
     exec(sql, state, msg, vector(), 0, meta, rows);
     if (state = '00000')
       foreach (any row in rows) do
@@ -1662,10 +1726,16 @@ create procedure BMK.WA.shared_sql(
   }
 
   -- search in my shared
-  if (shared = 1) {
+  if (shared = 1)
+  {
     grants := BMK.WA.xml_get ('grants', data);
     grants := split_and_decode(trim(grants, ','), 0, '\0\0,');
-    for (select G_ID, G_GRANTER_ID, G_OBJECT_TYPE, G_OBJECT_ID, U_NAME from BMK.WA.GRANTS, DB.DBA.SYS_USERS where G_GRANTEE_ID = account_id and G_GRANTER_ID = U_ID order by G_GRANTER_ID) do {
+    for (select G_ID as _GID from BMK..GRANTS_OBJECT_VIEW where GOW_TO = account_id) do
+    {
+      for (select G_ID, G_GRANTER_ID, G_OBJECT_TYPE, G_OBJECT_ID, U_NAME
+             from BMK.WA.GRANTS, DB.DBA.SYS_USERS
+            where G_ID = _GID) do
+    {
       if (length(grants) and not BMK.WA.vector_contains(grants, U_NAME))
         goto _skip;
 
@@ -1674,7 +1744,8 @@ create procedure BMK.WA.shared_sql(
     aid := G_GRANTER_ID;
       fid := -1;
     bid := 0;
-    if (G_OBJECT_TYPE = 'F') {
+      if (G_OBJECT_TYPE = 'F')
+      {
       fid := G_OBJECT_ID;
       did := (select F_DOMAIN_ID from BMK.WA.FOLDER where F_ID = fid);
     } else {
@@ -1685,10 +1756,11 @@ create procedure BMK.WA.shared_sql(
     BMK.WA.xml_set('bookmark', newData, bid);
 
     state := '00000';
-      sql := BMK.WA.sfolder_sql (did, aid, newData, maxRows, 'B');
+      sql := BMK.WA.sfolder_sql (did, aid, account_rights, newData, maxRows, 'B');
     exec(sql, state, msg, vector(), 0, meta, rows);
     if (state = '00000')
-      foreach (any row in rows) do {
+        foreach (any row in rows) do
+        {
           fid := row[8];
         if (bid <> 0)
             fid := -1;
@@ -1698,6 +1770,7 @@ create procedure BMK.WA.shared_sql(
   }
 }
 }
+}
 ;
 
 -------------------------------------------------------------------------------
@@ -1746,7 +1819,8 @@ create procedure BMK.WA.sfolder_sql_where(
   inout delimiter varchar,
   in criteria varchar)
 {
-  if (criteria <> '') {
+  if (criteria <> '')
+  {
     if (where2 = '')
       where2 := 'where ';
     where2 := concat(where2, delimiter, criteria);
@@ -1764,7 +1838,8 @@ create procedure BMK.WA.sfolder_create(
   declare id varchar;
 
   id := coalesce((select SF_ID from BMK.WA.SFOLDER where SF_DOMAIN_ID = domain_id and SF_NAME = name), -1);
-  if (id = -1) {
+  if (id = -1)
+  {
     insert into BMK.WA.SFOLDER (SF_DOMAIN_ID, SF_NAME, SF_DATA)
       values(domain_id, name, data);
   } else {
@@ -1816,7 +1891,8 @@ create procedure BMK.WA.sfolder_name (
 create procedure BMK.WA.tag_prepare(
   inout tag varchar)
 {
-  if (not is_empty_or_null(tag)) {
+  if (not is_empty_or_null(tag))
+  {
     tag := trim(tag);
     tag := replace(tag, '  ', ' ');
   }
@@ -1928,7 +2004,8 @@ create procedure BMK.WA.tags2unique(
   declare N, M integer;
 
   aResult := vector();
-  for (N := 0; N < length(aVector); N := N + 1) {
+  for (N := 0; N < length(aVector); N := N + 1)
+  {
     for (M := 0; M < length(aResult); M := M + 1)
       if (trim(lcase(aResult[M])) = trim(lcase(aVector[N])))
         goto _next;
@@ -2271,8 +2348,8 @@ create procedure BMK.WA.dav_content (
 {
   declare content varchar;
   declare hp any;
-
-  declare exit handler for sqlstate '*' {
+  declare exit handler for sqlstate '*'
+  {
     --dbg_obj_print (__SQL_STATE, __SQL_MESSAGE);
     return null;
   };
@@ -2340,7 +2417,7 @@ create procedure BMK.WA.iri_fix (
   {
     declare V any;
 
-    V := rfc1808_parse_uri (S);
+    V := rfc1808_parse_uri (cast (S as varchar));
     V [0] := 'https';
     V [1] := http_request_header (http_request_header(), 'Host', null, registry_get ('URIQADefaultHost'));
     S := DB.DBA.vspx_uri_compose (V);
@@ -3387,7 +3464,7 @@ _end:
 
 -------------------------------------------------------------------------------
 --
-create procedure BMK.WA.bmk_tree2(
+create procedure BMK.WA.bmk_tree (
   in domain_id integer,
   in user_id integer,
   in node varchar,
@@ -3410,7 +3487,7 @@ create procedure BMK.WA.bmk_tree2(
   }
   else if ((node_type = 'u') and (node_id = -1))
   {
-    for (select distinct U_ID, U_NAME from BMK.WA.GRANTS, DB.DBA.SYS_USERS where G_GRANTEE_ID = user_id and G_GRANTER_ID = U_ID order by 2) do
+    for (select distinct U_ID, U_NAME from BMK..GRANTS_VIEW where GW_ID = user_id order by 2) do
       retValue := vector_concat(retValue, vector(U_NAME, BMK.WA.make_node('u', U_ID), BMK.WA.make_path(path, 'u', U_ID)));
   }
   else if (node_type = 'f')
@@ -3425,7 +3502,7 @@ create procedure BMK.WA.bmk_tree2(
   }
   else if ((node_type = 'u') and (node_id >= 0))
   {
-    for (select distinct F_ID, F_NAME from BMK.WA.FOLDER, BMK.WA.GRANTS where G_OBJECT_TYPE = 'F' and F_ID = G_OBJECT_ID and G_GRANTEE_ID = user_id and G_GRANTER_ID = node_id order by 2) do
+    for (select distinct F_ID, F_NAME from BMK.WA.FOLDER, BMK..GRANTS_OBJECT_VIEW where GOW_TYPE = 'F' and F_ID = G_OBJECT_ID and GOW_TO = user_id and GOW_FROM = node_id order by 2) do
       retValue := vector_concat(retValue, vector(F_NAME, BMK.WA.make_node('F', F_ID), BMK.WA.make_path(path, 'F', F_ID)));
   }
   else if (node_type = 'F')
@@ -3439,43 +3516,6 @@ create procedure BMK.WA.bmk_tree2(
 
 -------------------------------------------------------------------------------
 --
-create procedure BMK.WA.bmk_node_has_childs (
-  in domain_id integer,
-  in user_id integer,
-  in node varchar,
-  in path varchar)
-{
-  declare node_type, node_id any;
-
-  node_id := BMK.WA.node_id(node);
-  node_type := BMK.WA.node_type(node);
-
-  if ((node_type = 'u') and (node_id = -1))
-    if (exists (select 1 from BMK.WA.GRANTS, DB.DBA.SYS_USERS where G_GRANTEE_ID = user_id and G_GRANTER_ID = U_ID))
-      return 1;
-
-  if (node_type = 'f')
-    if (exists (select 1 from BMK.WA.FOLDER where F_DOMAIN_ID = domain_id and coalesce(F_PARENT_ID, -1) = coalesce(node_id, -1)))
-      return 1;
-
-  if ((node_type = 's') and (node_id = -1))
-    if (exists (select 1  from BMK.WA.SFOLDER where SF_DOMAIN_ID = domain_id))
-      return 1;
-
-  if ((node_type = 'u') and (node_id >= 0))
-    if (exists (select 1  from BMK.WA.FOLDER, BMK.WA.GRANTS where G_OBJECT_TYPE = 'F' and F_ID = G_OBJECT_ID and G_GRANTEE_ID = user_id and G_GRANTER_ID = node_id))
-      return 1;
-
-  if (node_type = 'F')
-    if (exists (select 1  from BMK.WA.FOLDER where F_PARENT_ID = node_id))
-      return 1;
-
-  return 0;
-}
-;
-
--------------------------------------------------------------------------------
---
 create procedure BMK.WA.bmk_path2_int(
   in node varchar,
   in root_id integer,
@@ -3639,45 +3679,51 @@ create procedure BMK.WA.show_excerpt(
 
 -------------------------------------------------------------------------------
 --
-create procedure BMK.WA.dashboard_get(
-  in domain_id integer,
-  in user_id integer)
+create procedure BMK.WA.dashboard_rs(
+  in p0 integer)
 {
-  declare ses any;
-
-  ses := string_output ();
-  http ('<bookmark-db>', ses);
-  for select top 10 *
-        from (select a.BD_NAME,
-                     b.B_URI,
-                     a.BD_UPDATED
-                from BMK.WA.BOOKMARK_DOMAIN a,
-                     BMK.WA.BOOKMARK b,
-                     DB.DBA.WA_INSTANCE c,
-                     DB.DBA.WA_MEMBER d
-                where a.BD_BOOKMARK_ID = b.B_ID
-                  and a.BD_DOMAIN_ID = domain_id
-                  and d.WAM_USER = user_id
-                  and d.WAM_INST = C.WAI_NAME
-                  and c.WAI_ID = a.BD_DOMAIN_ID
+  declare c0 integer;
+  declare c1 varchar;
+  declare c2 datetime;
+
+  result_names(c0, c1, c2);
+  for (select top 10 *
+         from (select BD_ID,
+                      BD_NAME,
+                      BD_UPDATED
+                 from BMK.WA.BOOKMARK_DOMAIN
+                where BD_DOMAIN_ID = p0
                 order by BD_UPDATED desc
-             ) x do {
-
-    declare uname, full_name varchar;
+              ) x) do
+  {
+    result (BD_ID, BD_NAME, coalesce (BD_UPDATED, now ()));
+  }
+}
+;
 
-    uname := (select coalesce (U_NAME, '') from DB.DBA.SYS_USERS where U_ID = user_id);
-    full_name := (select coalesce (coalesce (U_FULL_NAME, U_NAME), '') from DB.DBA.SYS_USERS where U_ID = user_id);
+-------------------------------------------------------------------------------
+--
+create procedure BMK.WA.dashboard_get(
+  in domain_id integer)
+{
+  declare account_id integer;
+  declare aStream any;
 
-    http ('<bookmark>', ses);
-    http (sprintf ('<dt>%s</dt>', date_iso8601 (BD_UPDATED)), ses);
-    http (sprintf ('<title><![CDATA[%s]]></title>', BD_NAME), ses);
-    http (sprintf ('<link><![CDATA[%s]]></link>', B_URI), ses);
-    http (sprintf ('<from><![CDATA[%s]]></from>', full_name), ses);
-    http (sprintf ('<uid>%s</uid>', uname), ses);
-    http ('</bookmark>', ses);
+  account_id := BMK.WA.domain_owner_id (domain_id);
+  aStream := string_output ();
+  http ('<bookmark-db>', aStream);
+  for (select x.* from BMK.WA.dashboard_rs(p0)(_id integer, _name varchar, _time datetime) x where p0 = domain_id) do
+  {
+    http ('<bookmark>', aStream);
+    http (sprintf ('<dt>%s</dt>', date_iso8601 (_time)), aStream);
+    http (sprintf ('<title><![CDATA[%s]]></title>', _name), aStream);
+    http (sprintf ('<link>%V</link>', SIOC..bmk_post_iri (domain_id, _id)), aStream);
+    http (sprintf ('<from><![CDATA[%s]]></from>', BMK.WA.account_fullName (account_id)), aStream);
+    http (sprintf ('<uid>%s</uid>', BMK.WA.account_name (account_id)), aStream);
+    http ('</bookmark>', aStream);
   }
-  http ('</bookmark-db>', ses);
-  return string_output_string (ses);
+  http ('</bookmark-db>', aStream);
+  return string_output_string (aStream);
 }
 ;
 
@@ -3758,91 +3804,70 @@ create procedure BMK.WA.dt_format(
   in pDate datetime,
   in pFormat varchar := 'd.m.Y')
 {
+  declare N integer;
+  declare ch, S varchar;
+
   declare exit handler for sqlstate '*' {
     return '';
   };
 
-  declare N integer;
-  declare ch, S varchar;
-
   S := '';
-  N := 1;
-  while (N <= length(pFormat))
+  for (N := 1; N <= length(pFormat); N := N + 1)
   {
     ch := substring(pFormat, N, 1);
     if (ch = 'M')
     {
       S := concat(S, xslt_format_number(month(pDate), '00'));
-    } else {
-      if (ch = 'm')
+    }
+    else if (ch = 'm')
       {
         S := concat(S, xslt_format_number(month(pDate), '##'));
-      } else
-      {
-        if (ch = 'Y')
+    }
+    else if (ch = 'Y')
         {
           S := concat(S, xslt_format_number(year(pDate), '0000'));
-        } else
-        {
-          if (ch = 'y')
+    }
+    else if (ch = 'y')
           {
             S := concat(S, substring(xslt_format_number(year(pDate), '0000'),3,2));
-          } else {
-            if (ch = 'd')
+    }
+    else if (ch = 'd')
             {
               S := concat(S, xslt_format_number(dayofmonth(pDate), '##'));
-            } else
-            {
-              if (ch = 'D')
+    }
+    else if (ch = 'D')
               {
                 S := concat(S, xslt_format_number(dayofmonth(pDate), '00'));
-              } else
-              {
-                if (ch = 'H')
+    }
+    else if (ch = 'H')
                 {
                   S := concat(S, xslt_format_number(hour(pDate), '00'));
-                } else
-                {
-                  if (ch = 'h')
+    }
+    else if (ch = 'h')
                   {
                     S := concat(S, xslt_format_number(hour(pDate), '##'));
-                  } else
-                  {
-                    if (ch = 'N')
+    }
+    else if (ch = 'N')
                     {
                       S := concat(S, xslt_format_number(minute(pDate), '00'));
-                    } else
-                    {
-                      if (ch = 'n')
+    }
+    else if (ch = 'n')
                       {
                         S := concat(S, xslt_format_number(minute(pDate), '##'));
-                      } else
-                      {
-                        if (ch = 'S')
+    }
+    else if (ch = 'S')
                         {
                           S := concat(S, xslt_format_number(second(pDate), '00'));
-                        } else
-                        {
-                          if (ch = 's')
+    }
+    else if (ch = 's')
                           {
                             S := concat(S, xslt_format_number(second(pDate), '##'));
-                          } else
+    }
+    else
                           {
                             S := concat(S, ch);
-                          };
-                        };
-                      };
-                    };
-                  };
-                };
-              };
-            };
-          };
-        };
-      };
-    };
-    N := N + 1;
-  };
+    }
+  }
   return S;
 }
 ;
@@ -3853,15 +3878,9 @@ create procedure BMK.WA.dt_deformat(
   in pString varchar,
   in pFormat varchar := 'd.m.Y')
 {
-  declare
-    y,
-    m,
-    d integer;
-  declare
-    N,
-    I integer;
-  declare
-    ch varchar;
+  declare y, m, d integer;
+  declare N, I integer;
+  declare ch varchar;
 
   N := 1;
   I := 0;
diff --git a/appsrc/ODS-Bookmark/sql/bmk-a-ods.sql b/appsrc/ODS-Bookmark/sql/bmk-a-ods.sql
index 53cf00e..a1c502c 100644
--- a/appsrc/ODS-Bookmark/sql/bmk-a-ods.sql
+++ b/appsrc/ODS-Bookmark/sql/bmk-a-ods.sql
@@ -1,5 +1,5 @@
 --
---  $Id: bmk-a-ods.sql,v 1.2 2007/12/03 13:42:14 source Exp $
+--  $Id: bmk-a-ods.sql,v 1.2.2.1 2010/09/20 10:14:54 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Bookmark/sql/bmk-a-soap.sql b/appsrc/ODS-Bookmark/sql/bmk-a-soap.sql
index c17fcd4..5414600 100644
--- a/appsrc/ODS-Bookmark/sql/bmk-a-soap.sql
+++ b/appsrc/ODS-Bookmark/sql/bmk-a-soap.sql
@@ -1,5 +1,5 @@
 --
---  $Id: bmk-a-soap.sql,v 1.2 2008/06/04 08:09:19 source Exp $
+--  $Id: bmk-a-soap.sql,v 1.2.2.1 2010/09/20 10:14:54 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Bookmark/sql/bmk-a-table.sql b/appsrc/ODS-Bookmark/sql/bmk-a-table.sql
index dffd8ea..6dc147f 100644
--- a/appsrc/ODS-Bookmark/sql/bmk-a-table.sql
+++ b/appsrc/ODS-Bookmark/sql/bmk-a-table.sql
@@ -1,5 +1,5 @@
 --
---  $Id: bmk-a-table.sql,v 1.22 2009/03/18 09:34:38 source Exp $
+--  $Id: bmk-a-table.sql,v 1.22.2.2 2010/11/19 16:49:51 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -616,6 +616,82 @@ BMK.WA.exec_no_error('
 
 -------------------------------------------------------------------------------
 --
+create procedure BMK.WA.grants_procedure (
+  in gw_id integer)
+{
+  declare c0 integer;
+  declare c1 varchar;
+
+  result_names (c0, c1);
+  for (select distinct b.U_ID, b.U_NAME
+         from BMK.WA.GRANTS a,
+              DB.DBA.SYS_USERS b
+        where a.G_GRANTEE_ID = gw_id
+          and a.G_GRANTER_ID = b.U_ID
+        order by 2) do
+  {
+    result (U_ID, U_NAME);
+  }
+  for (select distinct b.U_ID, b.U_NAME
+         from BMK.WA.GRANTS a,
+              DB.DBA.SYS_USERS b,
+              DB.DBA.SYS_ROLE_GRANTS c
+        where a.G_GRANTER_ID = b.U_ID
+          and c.GI_SUPER     = gw_id
+          and c.GI_GRANT     = a.G_GRANTEE_ID
+          and c.GI_DIRECT    = '1'
+        order by 2) do
+  {
+    result (U_ID, U_NAME);
+  }
+}
+;
+
+BMK.WA.exec_no_error ('
+  create procedure view BMK..GRANTS_VIEW as BMK.WA.grants_procedure (gw_id) (U_ID integer, U_NAME varchar)
+')
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure BMK.WA.grants_object_procedure (
+  in gow_type varchar := null,
+  in gow_to integer,
+  in gow_from integer := null)
+{
+  declare c0 integer;
+
+  result_names (c0, c0);
+  for (select distinct G_ID, G_OBJECT_ID
+         from BMK.WA.GRANTS
+        where (G_OBJECT_TYPE = gow_type or gow_type is null)
+          and G_GRANTEE_ID  = gow_to
+          and (G_GRANTER_ID = gow_from or gow_from is null) order by 1) do
+  {
+    result (G_ID, G_OBJECT_ID);
+  }
+  for (select distinct G_ID, G_OBJECT_ID
+         from BMK.WA.GRANTS a,
+              DB.DBA.SYS_ROLE_GRANTS c
+        where (a.G_OBJECT_TYPE = gow_type or gow_type is null)
+          and c.GI_SUPER      = gow_to
+          and (a.G_GRANTER_ID = gow_from or gow_from is null)
+          and c.GI_GRANT      = a.G_GRANTEE_ID
+          and c.GI_DIRECT     = '1'
+        order by 1) do
+  {
+    result (G_ID, G_OBJECT_ID);
+  }
+}
+;
+
+BMK.WA.exec_no_error ('
+  create procedure view BMK..GRANTS_OBJECT_VIEW as BMK.WA.grants_object_procedure (gow_type, gow_to, gow_from) (G_ID integer, G_OBJECT_ID integer)
+')
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure BMK.WA.drop_index ()
 {
   if (registry_get ('bmk_index_version') = '2')
diff --git a/appsrc/ODS-Bookmark/sql/bmk-a-update.sql b/appsrc/ODS-Bookmark/sql/bmk-a-update.sql
index 4bdad18..2803c8e 100644
--- a/appsrc/ODS-Bookmark/sql/bmk-a-update.sql
+++ b/appsrc/ODS-Bookmark/sql/bmk-a-update.sql
@@ -1,5 +1,5 @@
 --
---  $Id: bmk-a-update.sql,v 1.2 2008/09/10 11:15:26 source Exp $
+--  $Id: bmk-a-update.sql,v 1.2.2.3 2010/10/07 13:24:04 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -55,3 +55,18 @@ create procedure BMK.WA.tmp_update ()
 ;
 BMK.WA.tmp_update ();
 
+-------------------------------------------------------------------------------
+--
+create procedure BMK.WA.tmp_update ()
+{
+  if (registry_get ('bmk_acl_update') = '1')
+    return;
+  registry_set ('bmk_acl_update', '1');
+
+  set triggers off;
+  update BMK.WA.BOOKMARK_DOMAIN set BD_ACL = null where BD_ACL is not null;
+  set triggers on;
+}
+;
+
+BMK.WA.tmp_update ();
diff --git a/appsrc/ODS-Bookmark/sql/bmk-a-wa.sql b/appsrc/ODS-Bookmark/sql/bmk-a-wa.sql
index 4ae38dc..29d14f6 100644
--- a/appsrc/ODS-Bookmark/sql/bmk-a-wa.sql
+++ b/appsrc/ODS-Bookmark/sql/bmk-a-wa.sql
@@ -1,5 +1,5 @@
 --
---  $Id: bmk-a-wa.sql,v 1.14.2.1 2010/05/18 10:40:38 source Exp $
+--  $Id: bmk-a-wa.sql,v 1.14.2.5 2010/09/22 13:57:02 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -156,6 +156,11 @@ BMK.WA.exec_no_error('
 ;
 
 BMK.WA.exec_no_error(
+  'alter type wa_bookmark add overriding method wa_dashboard () returns any'
+)
+;
+
+BMK.WA.exec_no_error(
   'alter type wa_bookmark add method wa_dashboard_last_item () returns any'
 )
 ;
@@ -199,6 +204,14 @@ create method wa_id_string() for wa_bookmark
 --
 create method wa_drop_instance () for wa_bookmark
 {
+  for (select HP_LPATH as _lpath,
+              HP_HOST as _vhost,
+              HP_LISTEN_HOST as _lhost
+         from DB.DBA.HTTP_PATH
+        where HP_LPATH = '/bookmark/' || self.BookmarkID) do
+  {
+    VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+  }
   BMK.WA.domain_delete(self.BookmarkID);
   (self as web_app).wa_drop_instance();
 }
@@ -373,13 +386,38 @@ create method get_param (in param varchar) for wa_bookmark
 
 -------------------------------------------------------------------------------
 --
-create method wa_dashboard_last_item () for wa_bookmark
+create method wa_dashboard () for wa_bookmark
 {
-  declare domainID, userID integer;
+  declare iWaiID integer;
+
+  iWaiID := self.BookmarkID;
+  return (select XMLAGG (
+                         XMLELEMENT (
+                                     'dash-row',
+                                     XMLATTRIBUTES (
+                                                    'normal' as "class",
+                                                    BMK.WA.dt_format(_time, 'Y/M/D H:N') as "time",
+                                                    self.wa_name as "application"
+                                                   ),
+                                     XMLELEMENT(
+                                                'dash-data',
+                                                XMLATTRIBUTES ( concat (N'<a href="', cast (SIOC..bmk_post_iri (iWaiID, _id) as nvarchar), N'">', BMK.WA.utf2wide (_title), N'</a>') as "content",
+	                                                              0 "comments"
+	                                                            )
+                                          	   )
+                                    )
+                     	  )
+            from BMK.WA.dashboard_rs(p0)(_id integer, _title varchar, _time datetime) x
+           where p0 = iWaiID
+         );
+}
+;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  userID := (select WAM_USER from WA_MEMBER B where WAM_INST= self.wa_name and WAM_MEMBER_TYPE = 1);
-  return BMK.WA.dashboard_get(domainID, userID);
+-------------------------------------------------------------------------------
+--
+create method wa_dashboard_last_item () for wa_bookmark
+{
+  return BMK.WA.dashboard_get (self.BookmarkID);
 }
 ;
 
@@ -389,9 +427,8 @@ create method wa_rdf_url (in vhost varchar, in lhost varchar) for wa_bookmark
 {
   declare domainID, userID integer;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  userID := (select WAM_USER from WA_MEMBER B where WAM_INST= self.wa_name and WAM_MEMBER_TYPE = 1);
-
+  domainID := self.BookmarkID;
+  userID := BMK.WA.domain_owner_id (domainID);
   return concat(BMK.WA.dav_url2(domainID, userID), 'BM.rdf');
 }
 ;
@@ -423,3 +460,40 @@ create method wa_update_instance (in oldValues any, in newValues any) for wa_boo
   return (self as web_app).wa_update_instance (oldValues, newValues);
 }
 ;
+
+-------------------------------------------------------------------------------
+--
+create procedure BMK.WA.path_upgrade ()
+{
+  declare _new_lpath varchar;
+
+  if (registry_get ('bmk_path_upgrade2') = '1')
+    return;
+
+  for (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_TYPE_NAME = 'Bookmark') do
+  {
+    for (select HP_LPATH as _lpath,
+                HP_HOST as _vhost,
+                HP_LISTEN_HOST as _lhost
+           from DB.DBA.HTTP_PATH
+          where HP_LPATH = '/bookmark/' || cast (WAI_ID as varchar) || '/bookmarks.vspx') do
+    {
+      _new_lpath := '/bookmark/' || cast (WAI_ID as varchar);
+      if (exists (select 1 from DB.DBA.HTTP_PATH where HP_LPATH = _new_lpath and HP_HOST  = _vhost and HP_LISTEN_HOST = _lhost))
+      {
+        VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+      } else {
+        update DB.DBA.HTTP_PATH
+           set HP_LPATH = _new_lpath
+         where HP_LPATH = _lpath
+           and HP_HOST  = _vhost
+           and HP_LISTEN_HOST = _lhost;
+        http_map_del (_lpath, _vhost, _lhost);
+        VHOST_MAP_RELOAD (vhost=>_vhost, lhost=>_lhost, lpath=>_new_lpath);
+      }
+    }
+  }
+  registry_set ('bmk_path_upgrade2', '1');
+}
+;
+BMK.WA.path_upgrade ();
diff --git a/appsrc/ODS-Bookmark/sql/bmk-d.sql b/appsrc/ODS-Bookmark/sql/bmk-d.sql
index 2af8bdc..6d02569 100644
--- a/appsrc/ODS-Bookmark/sql/bmk-d.sql
+++ b/appsrc/ODS-Bookmark/sql/bmk-d.sql
@@ -1,5 +1,5 @@
 --
---  $Id: bmk-d.sql,v 1.15.2.2 2010/05/31 21:59:14 source Exp $
+--  $Id: bmk-d.sql,v 1.15.2.5 2010/11/19 16:49:51 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -86,6 +86,8 @@ BMK.WA.exec_no_error('drop type wa_bookmark');
 
 -- Views
 BMK.WA.exec_no_error('drop view BMK..TAGS_VIEW');
+BMK.WA.exec_no_error('drop view BMK..GRANTS_VIEW');
+BMK.WA.exec_no_error('drop view BMK..GRANTS_OBJECT_VIEW');
 
 -- Registry
 registry_remove ('_bookmark_path_');
@@ -96,6 +98,7 @@ registry_remove ('__ods_bookmark_sioc_init');
 registry_remove ('bmk_table_update');
 registry_remove ('bmk_index_version');
 registry_remove ('bmk_path_update');
+registry_remove ('bmk_path_upgrade2');
 
 -- Procedures
 create procedure BMK.WA.drop_procedures()
diff --git a/appsrc/ODS-Bookmark/sql/sioc_bmk.sql b/appsrc/ODS-Bookmark/sql/sioc_bmk.sql
index 21632b7..fec982b 100644
--- a/appsrc/ODS-Bookmark/sql/sioc_bmk.sql
+++ b/appsrc/ODS-Bookmark/sql/sioc_bmk.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sioc_bmk.sql,v 1.19.2.5 2010/05/18 10:40:38 source Exp $
+--  $Id: sioc_bmk.sql,v 1.19.2.9 2010/10/13 12:15:19 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -106,6 +106,25 @@ create procedure fill_ods_bookmark_sioc2 (
   declare domain_id, bookmark_id integer;
   declare graph_iri, forum_iri, creator_iri, bookmark_iri, iri varchar;
  {
+    for (select WAI_ID,
+                WAI_TYPE_NAME,
+                WAI_NAME,
+                WAI_ACL
+           from DB.DBA.WA_INSTANCE
+          where ((_wai_name is null) or (WAI_NAME = _wai_name))
+            and WAI_TYPE_NAME = 'Bookmark') do
+    {
+      graph_iri := SIOC..acl_graph (WAI_TYPE_NAME, WAI_NAME);
+      exec (sprintf ('sparql clear graph <%s>', graph_iri));
+      SIOC..wa_instance_acl_insert (WAI_TYPE_NAME, WAI_NAME, WAI_ACL);
+      for (select BD_DOMAIN_ID, BD_ID, BD_ACL
+             from BMK..BOOKMARK_DOMAIN
+            where BD_DOMAIN_ID = WAI_ID and BD_ACL is not null) do
+      {
+        bookmark_acl_insert (BD_DOMAIN_ID, BD_ID, BD_ACL);
+      }
+    }
+
     id := -1;
     deadl := 3;
     cnt := 0;
@@ -129,7 +148,8 @@ create procedure fill_ods_bookmark_sioc2 (
                 BD_DESCRIPTION,
                 BD_TAGS,
                 BD_UPDATED,
-                BD_CREATED
+                BD_CREATED,
+                BD_ACL
         from DB.DBA.WA_INSTANCE,
              BMK..BOOKMARK_DOMAIN,
              DB.DBA.WA_MEMBER
@@ -378,6 +398,96 @@ create trigger BOOKMARK_DOMAIN_SIOC_D before delete on BMK.WA.BOOKMARK_DOMAIN re
 
 -------------------------------------------------------------------------------
 --
+create procedure bookmark_acl_insert (
+  inout domain_id integer,
+  inout bookmark_id integer,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  iri := SIOC..bmk_post_iri (domain_id, bookmark_id);
+  graph_iri := BMK.WA.acl_graph (domain_id);
+
+  SIOC..acl_insert (graph_iri, iri, acl);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure bookmark_acl_delete (
+  inout domain_id integer,
+  inout bookmark_id integer,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  iri := SIOC..bmk_post_iri (domain_id, bookmark_id);
+  graph_iri := BMK.WA.acl_graph (domain_id);
+
+  SIOC..acl_delete (graph_iri, iri, acl);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger BOOKMARK_DOMAIN_SIOC_ACL_I after insert on BMK.WA.BOOKMARK_DOMAIN order 100 referencing new as N
+{
+  if (coalesce (N.BD_ACL, '') <> '')
+  {
+    bookmark_acl_insert (N.BD_DOMAIN_ID,
+                         N.BD_ID,
+                         N.BD_ACL);
+
+    SIOC..acl_ping (N.BD_DOMAIN_ID,
+                    SIOC..bmk_post_iri (N.BD_DOMAIN_ID, N.BD_ID),
+                    null,
+                    N.BD_ACL);
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger BOOKMARK_DOMAIN_SIOC_ACL_U after update (BD_ACL) on BMK.WA.BOOKMARK_DOMAIN order 100 referencing old as O, new as N
+{
+  if (coalesce (O.BD_ACL, '') <> '')
+    bookmark_acl_delete (O.BD_DOMAIN_ID,
+                         O.BD_ID,
+                         O.BD_ACL);
+
+  if (coalesce (N.BD_ACL, '') <> '')
+    bookmark_acl_insert (N.BD_DOMAIN_ID,
+                         N.BD_ID,
+                         N.BD_ACL);
+
+  SIOC..acl_ping (N.BD_DOMAIN_ID,
+                  SIOC..bmk_post_iri (N.BD_DOMAIN_ID, N.BD_ID),
+                  O.BD_ACL,
+                  N.BD_ACL);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger BOOKMARK_DOMAIN_SIOC_ACL_D before delete on BMK.WA.BOOKMARK_DOMAIN order 100 referencing old as O
+{
+  if (coalesce (O.BD_ACL, '') <> '')
+    bookmark_acl_delete (O.BD_DOMAIN_ID,
+                        O.BD_ID,
+                        O.BD_ACL);
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure bookmark_comments_insert (
   in graph_iri varchar,
   in forum_iri varchar,
diff --git a/appsrc/ODS-Bookmark/www/ajax.vsp b/appsrc/ODS-Bookmark/www/ajax.vsp
index 54d1351..488bbae 100644
--- a/appsrc/ODS-Bookmark/www/ajax.vsp
+++ b/appsrc/ODS-Bookmark/www/ajax.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: ajax.vsp,v 1.9.2.3 2010/04/15 18:46:20 source Exp $
+--  $Id: ajax.vsp,v 1.9.2.6 2010/10/07 13:24:04 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -21,7 +21,7 @@
 --  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 --
 
-  declare N, id, _domain_id, _account_id integer;
+  declare N, M, id, _domain_id, _account_id integer;
   declare sid, realm, action, subAction, node, nodePath varchar;
   declare nodes, parts, sessionData, returnData any;
 
@@ -34,75 +34,50 @@
 
   sessionData := BMK.WA.session_restore (params);
   _domain_id  := cast (get_keyword ('domain_id', sessionData, '0') as integer);
-  _account_id := cast (get_keyword ('user_id', sessionData, '0') as integer);
+  _account_id := BMK.WA.domain_owner_id (_domain_id);
 
   if (action = 'visited')
   {
     BMK.WA.bookmark_visited_set (_domain_id, id, now ());
   }
-  else if (action = 'import')
+  else if (action = 'load')
   {
-    declare progressID, progressIndex, progressMax any;
+    declare progressID, progressIndex any;
 
-	  progressID := get_keyword('id', params, '');
-	  progressIndex := registry_get ('bookmark_index_' || progressID);
-	  progressMax := registry_get ('bookmark_max_' || progressID);
-
-	  declare exit handler for sqlstate '*'
+    progressID := cast (get_keyword ('id', params, msec_time()) as varchar);
+    progressIndex := registry_get ('feed_' || progressID || '_index');
+	  if (subAction = 'stop')
 	  {
-	    registry_remove ('bookmark_max_'    || progressID);
-	    registry_remove ('bookmark_index_'  || progressID);
-	    registry_remove ('bookmark_action_' || progressID);
-	    return;
-	  };
-
-	  if (subAction = 'reset')
+	    registry_set ('bookmark_action_' || progressID, 'stop');
+	  }
+	  else if (subAction = 'state')
+	  {
+      if (not (isinteger(progressIndex) and (progressIndex = 0)))
 	  {
-	    registry_remove ('bookmark_max_'    || progressID);
-	    registry_remove ('bookmark_index_'  || progressID);
-	    registry_remove ('bookmark_action_' || progressID);
-
-  	  progressID := cast (msec_time() as varchar);
 	    http_rewrite ();
 	    http_header ('Content-Type: text/xml\r\n');
 	    http('<root>');
-	    http(sprintf('<id>%s</id>', cast (progressID as varchar)));
+        http(sprintf('<index>%s</index>', cast (progressIndex as varchar)));
 	    http('</root>');
-
-	    connection_set('stop_execution', '1');
-	    return (0);
 	  }
-	  else if (subAction = 'stop')
-	  {
-	    registry_set ('bookmark_action_' || progressID, 'stop');
-
-	    connection_set('stop_execution', '1');
-	    return (0);
 	  }
-	  else if (subAction = 'state')
+	  else if (subAction = 'init')
 	  {
+	    registry_set ('bookmark_index_' || progressID, '0');
+
       http_rewrite ();
       http_header ('Content-Type: text/xml\r\n');
       http('<root>');
-      if (not isinteger (progressIndex))
-        http(sprintf('<index>%s</index>', progressIndex));
+	    http (sprintf ('<id>%s</id>', cast (progressID as varchar)));
       http('</root>');
+	    http_flush ();
 
-	    connection_set('stop_execution','1');
-	    return (0);
-	  }
-	  else if (subAction = 'init')
-	  {
       declare folder_id, folder_name, tags, R, S, T any;
 
-	    registry_set ('bookmark_index_' || progressID, '0');
       R := DAV_RES_CONTENT_INT (DAV_SEARCH_ID ('/DAV/VAD/Bookmarks/Import/' || sid, 'R'), S, T, 0, 0);
       S := blob_to_string (S);
       DB.DBA.DAV_DELETE_INT ('/DAV/VAD/Bookmarks/Import/' || sid, 1, null, null, 0);
 
-	    -- flush and continue
-	    http_flush ();
-
       -- check / create folder
       folder_id := cast (get_keyword ('folder_id', params, '0') as integer);
       folder_name := trim (get_keyword ('folder_name', params, ''));
@@ -119,12 +94,8 @@
       }
 	  _end:;
 
-	    registry_remove ('bookmark_max_'    || progressID);
 	    registry_remove ('bookmark_index_'  || progressID);
 	    registry_remove ('bookmark_action_' || progressID);
-
-	    connection_set('stop_execution', '1');
-	    return (0);
 	  }
   }
   else if (action = 'tree')
@@ -149,7 +120,8 @@
         parts := split_and_decode (nodePath, 0, '\0\0/');
         node := case when length (parts) then parts[length (parts)-1] else '' end;
       }
-      nodes := BMK.WA.bmk_tree2 (_domain_id, _account_id, node, nodePath);
+      _account_id := cast (get_keyword ('account_id', sessionData, '-1') as integer);
+      nodes := BMK.WA.bmk_tree (_domain_id, _account_id, node, nodePath);
       for (N := 0; N < length (nodes); N := N + 3)
       {
         nodeID := BMK.WA.node_id (nodes [N+1]);
@@ -213,7 +185,7 @@
     };
 
     returnData := '';
-    if (subAction in ('Bookmark/Create', 'Bookmark/Edit', 'Bookmark/View'))
+    if (subAction in ('Bookmark/Create', 'Bookmark/Edit'))
 	  {
 	    declare tmp, id, name, uri, description, folder_id, folder_name, tags, grants, acl, suffix any;
 
@@ -224,8 +196,20 @@
       folder_id := cast (get_keyword ('b_folder_id', params) as integer);
       folder_name := trim (get_keyword ('b_folder_name', params, ''));
       tags := trim (get_keyword ('b_tags', params, ''));
-      grants := trim (get_keyword ('b_grants', params, ''));
-
+      grants := '';
+      for (N := 0; N < length (params); N := N + 2)
+      {
+        if ((params [N] like 'f_fld_1_%') and (trim (params [N+1]) <> ''))
+        {
+          tmp := split_and_decode (trim (params[N+1]), 0, '\0\0,');
+          for (M := 0; M < length (tmp); M := M + 1)
+          {
+            if (ODRIVE.WA.odrive_user_id (trim (tmp[M])) <> -1)
+              grants := grants || ',' || tmp[M];
+          }
+        }
+      }
+      grants := trim (grants, ',');
       BMK.WA.test (name, vector ('name', 'Bookmark Name', 'class', 'varchar', 'type', 'varchar', 'minLength', 1, 'maxLength', 255));
       BMK.WA.test (uri, vector('name', 'Bookmark Link', 'class', 'uri', 'type', 'varchar', 'minLength', 1, 'maxLength', 255));
       if ((folder_name <> '') and (not BMK.WA.folder_check_name (folder_name, 1)))
@@ -237,19 +221,7 @@
       tmp := BMK.WA.tags2vector (tags);
       tmp := BMK.WA.vector_unique (tmp);
       tags := BMK.WA.vector2tags (tmp);
-
-      -- acl
-      acl := vector ();
-      for (N := 0; N < length (params); N := N + 2)
-      {
-        if ((params [N] like 's_fld_2_%') and (trim (params [N+1]) <> ''))
-        {
-          suffix := replace (params [N], 's_fld_2_', '');
-          acl := vector_concat (acl, vector (vector (get_keyword ('s_fld_1_'||suffix, params, ''), get_keyword ('s_fld_2_'||suffix, params, ''), get_keyword ('s_fld_3_'||suffix, params, ''))));
-        }
-      }
-      acl := serialize (vector_concat (vector (vector ('v1.0', length (acl))), acl));
-
+      acl := serialize (DB.DBA.wa_acl_params (params));
       folder_id := BMK.WA.folder_create (_domain_id, folder_name, folder_id);
       id := BMK.WA.bookmark_update (id, _domain_id, uri, name, description, tags, folder_id, null, acl);
       BMK.WA.shareNode (_account_id, BMK.WA.make_node ('b', id), grants, 1);
diff --git a/appsrc/ODS-Bookmark/www/annotea.vspx b/appsrc/ODS-Bookmark/www/annotea.vspx
index efce33a..e4fa45e 100644
--- a/appsrc/ODS-Bookmark/www/annotea.vspx
+++ b/appsrc/ODS-Bookmark/www/annotea.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: annotea.vspx,v 1.8.2.3 2010/03/12 09:12:04 source Exp $
+ -  $Id: annotea.vspx,v 1.8.2.5 2010/10/07 13:24:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -53,7 +53,7 @@
     <vm:pagebody>
       <?vsp http(sprintf('<input type="hidden" name="sid"   id="sid"   value="%s" />', get_keyword('sid', self.vc_page.vc_event.ve_params))); ?>
       <?vsp http(sprintf('<input type="hidden" name="realm" id="realm" value="%s" />', get_keyword('realm', self.vc_page.vc_event.ve_params))); ?>
-      <div class="new-form-header">
+      <div class="form-header">
         Free Text Annotation: '<?V BMK.WA.utf2wide ((select coalesce(BD_NAME, '~ no title ~') from BMK.WA.BOOKMARK_DOMAIN where BD_ID = self.v_oid)) ?>'
       </div>
 
@@ -240,7 +240,7 @@
               </div>
             </div>
           </div>
-          <div class="new-form-footer">
+          <div class="form-footer">
             <v:button action="simple" value="Post" xhtml_title="Post" xhtml_class="button">
                     <v:on-post>
                       <![CDATA[
diff --git a/appsrc/ODS-Bookmark/www/bmk_login.vspx b/appsrc/ODS-Bookmark/www/bmk_login.vspx
index 51c797c..ea98db6 100644
--- a/appsrc/ODS-Bookmark/www/bmk_login.vspx
+++ b/appsrc/ODS-Bookmark/www/bmk_login.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: bmk_login.vspx,v 1.9 2008/04/17 09:00:07 source Exp $
+ -  $Id: bmk_login.vspx,v 1.9.2.4 2010/10/07 13:24:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -27,21 +27,25 @@
   <v:after-data-bind>
     <![CDATA[
       declare page_name varchar;
+      declare vh, lh, hf, ods_path any;
 
       set_qualifier ('DB');
       page_name := BMK.WA.page_name ();
       if (page_name = 'error.vspx')
         return;
 
-      declare vh, lh, hf, ods_path any;
+      if (isnull (self.account_rights) and not is_empty_or_null (self.sid))
+      {
+        self.vc_redirect (sprintf ('/ods/error.vspx?__PAGE=%U&__SQL_STATE=%U&__SQL_MESSAGE=%U', 'home.vspx', '23023', 'You have no access rights for the application!'));
+        return;
+      }
 
       vh := http_map_get ('vhost');
       lh := http_map_get ('lhost');
       hf := http_request_header (lines, 'Host');
-
       if (hf is not null and exists (select 1 from HTTP_PATH where HP_HOST = vh and HP_LISTEN_HOST = lh and HP_LPATH = '/ods'))
       {
-        ods_path := 'http://' || hf || '/ods/';
+        ods_path := DB.DBA.WA_GET_PROTOCOL() || hf || '/ods/';
       } else {
         ods_path := DB.DBA.WA_LINK (1, '/ods/');
       }
@@ -52,13 +56,12 @@
         return;
       }
 
-      if (BMK.WA.check_grants2 (self.account_role, page_name))
+      if (BMK.WA.check_grants (self.account_rights, page_name))
         return;
 
-      if (self.account_role = 'expire')
+      if (isnull (self.account_rights))
       {
-        http_request_status ('HTTP/1.1 302 Found');
-        http_header (sprintf('Location: %slogin.vspx?URL=%U\r\n', ods_path, HTTP_REQUESTED_URL()));;
+        self.vc_redirect (sprintf ('%slogin.vspx?URL=%U', ods_path, HTTP_REQUESTED_URL()));;
         return;
       }
       self.vc_redirect('bookmarks.vspx');
diff --git a/appsrc/ODS-Bookmark/www/bookmarks.vspx b/appsrc/ODS-Bookmark/www/bookmarks.vspx
index c959a55..e556cd7 100644
--- a/appsrc/ODS-Bookmark/www/bookmarks.vspx
+++ b/appsrc/ODS-Bookmark/www/bookmarks.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: bookmarks.vspx,v 1.40.2.3 2010/07/05 08:25:10 source Exp $
+ -  $Id: bookmarks.vspx,v 1.40.2.5 2010/10/07 13:24:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -67,7 +67,7 @@
                   self.tbLabels := cast (get_keyword ('tbLabels', self.settings, '1') as integer);
           
                   self.bNodeAction := '';
-                  if ((get_keyword ('URI', params, '') <> '') and (not self.account_role in ('public', 'guest')))
+                  if ((get_keyword ('URI', params, '') <> '') and (self.account_rights = 'W'))
                             {
                     self.bNodeAction := 'Bookmark/Create';
                     self.bNodeParams := sprintf('&URI=%U&TITLE=%U', get_keyword ('URI', params, ''), get_keyword ('TITLE', params, ''));
@@ -97,7 +97,7 @@
                             {
                       self.bNode := BMK.WA.make_node ('b', get_keyword ('id', params));
                       self.bNodeAction := 'Bookmark/Edit';
-                      if ((self.account_role in ('public', 'guest')) or (grant_id >= 0))
+                      if ((self.account_rights <> 'W') or (grant_id >= 0))
                         self.bNodeAction := 'Bookmark/View';
                     }
                   }
@@ -113,7 +113,7 @@
                       self.bNodePath := BMK.WA.bmk_path2 (BMK.WA.make_node ('f', BD_FOLDER_ID));
                     }
                   }
-                  else if ((get_keyword ('action', params, '') = 'Smart Folder/Create')  and (not self.account_role in ('public', 'guest')))
+                  else if ((get_keyword ('action', params, '') = 'Smart Folder/Create') and (self.account_rights = 'W'))
                             {
                     self.bNodeAction := 'Smart Folder/Create';
                     for (N := 0; N < length (params); N := N + 1)
@@ -137,7 +137,7 @@
                 http (sprintf ('<input type="hidden" id="nodeParams" name="nodeParams" value="%V" />', self.bNodeParams));
         ?>
               <!-- Toolbar -->
-              <vm:if test="self.account_role not in ('public', 'guest')">
+              <vm:if test="self.domain_id > 0">
                 <?vsp
                   declare toolbarWidth varchar;
 
@@ -145,6 +145,7 @@
                   toolbarWidth := '';
                 ?>
                 <div>
+                  <vm:if test="self.account_rights = 'W'">
                   <span class="toolbar" style="cursor: pointer;<?V toolbarWidth ?>" onclick="javascript: BMK.formShow('import');" alt="Import">
                     <img src="image/impt_32.png" border="0" alt="Import" /><?vsp http(self.toolbarLabel('Import'));?>
                   </span>
@@ -165,6 +166,7 @@
                   </span>
 
           <img src="image/c.gif" height="32" width="2" border="0" class="toolbar" alt="" />
+                  </vm:if>
 
                   <span id="tbTag" class="toolbar" style="display: none; cursor: pointer;<?V toolbarWidth ?>" onclick="javascript: BMK.formShow('tags');" alt="Tags">
                     <img src="image/tag_32.png" border="0" alt="Tags" /><?vsp http(self.toolbarLabel('Tag'));?>
@@ -204,12 +206,10 @@
               <div style="clear: both;">
             </div>
 
-              <vm:if test="(self.account_role not in ('public', 'shared'))">
                     <div class="tabs">
                   <div id="tree_button" class="tab <?V case when self.bTab = 'tree' then 'activeTab2' else 'tab2' end ?>" onclick="javascript: BMK.toggleLeftPane('tree');">Tree</div>
                   <div id="tags_button" class="tab <?V case when self.bTab = 'tags' then 'activeTab2' else 'tab2' end ?>" onclick="javascript: BMK.toggleLeftPane('tags');">Tags</div>
                     </div>
-              </vm:if>
 
               <div id="pane_main" class="pane_main">
                 <div id="pane_left">
diff --git a/appsrc/ODS-Bookmark/www/conversation.vspx b/appsrc/ODS-Bookmark/www/conversation.vspx
index 88e1a5f..054fa2e 100644
--- a/appsrc/ODS-Bookmark/www/conversation.vspx
+++ b/appsrc/ODS-Bookmark/www/conversation.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: conversation.vspx,v 1.3.2.1 2010/01/29 20:21:28 source Exp $
+ -  $Id: conversation.vspx,v 1.3.2.2 2010/09/20 10:14:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Bookmark/www/css/style.css b/appsrc/ODS-Bookmark/www/css/style.css
index 05fcb69..3e4913f 100644
--- a/appsrc/ODS-Bookmark/www/css/style.css
+++ b/appsrc/ODS-Bookmark/www/css/style.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: style.css,v 1.24.2.6 2010/07/05 08:25:10 source Exp $
+ *  $Id: style.css,v 1.24.2.9 2010/10/07 13:24:05 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -20,27 +20,22 @@
  *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  *  
  */
-
-body
-{
+body {
   padding: 0;
   margin: 0;
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 9pt;
 }
 
-a
-{
+a {
   text-decoration: none;
 }
 
-a:active
-{
+a:active {
   text-decoration: none;
 }
 
-a:visited
-{
+a:visited {
   text-decoration: none;
 }
 
@@ -49,41 +44,41 @@ a:hover, .link:hover
   text-decoration: underline;
 }
 
-.link
-{
+.link {
   color: blue;
 	cursor: pointer;
 }
 
-.link:hover
-{
+.link:hover {
   text-decoration: none;
 }
 
-#MTB
-{
+.visited {
+}
+
+.unvisited {
+  font-weight: bold;
+}
+
+#MTB {
   width: 100%;
   left: 0px;
   right: 0px;
 }
 
-#LC
-{
+#LC {
   width: 170px;
   padding-top: 5px;
   vertical-align: top;
 }
 
-#RC
-{
+#RC {
   padding-top: 5px;
   vertical-align: top;
 }
 
 /* Footer */
-
-#FT
-{
+#FT {
   width: 100%;
   position: relative;
   bottom: 0px;
@@ -97,8 +92,7 @@ a:hover, .link:hover
   background-image: url(../image/ods_main_footer.png);
 }
 
-#FT_L
-{
+#FT_L {
   float: left;
   clear: left;
   margin-top: 10px;
@@ -106,8 +100,7 @@ a:hover, .link:hover
   border: 1px solid #788;
 }
 
-#FT_R
-{
+#FT_R {
   float: right;
   clear: right;
   margin-top: 10px;
@@ -116,22 +109,18 @@ a:hover, .link:hover
   color: #788;
 }
 
-#FT_R a
-{
+#FT_R a {
   text-decoration: none;
   color: inherit;
 }
 
 /* Left side within MT */
-
-.page_head
-{
+.page_head {
   width: 100%;
   background-color: #b0cde4;
 }
 
-.lc
-{
+.lc {
   font-size: 12px;
   background-color: #EFEFEF;
   border: 1px solid #7f94a5;
@@ -142,59 +131,50 @@ a:hover, .link:hover
   width: auto;
 }
 
-.lc_none
-{
+.lc_none {
   margin: 0 0.5em 0.5em 0.5em;
   width: auto;
 }
 
-.lc_closer
-{
+.lc_closer {
   margin-top: -0.5em;
   z-index: 1;
 }
 
-.lc_noborder
-{
+.lc_noborder {
   border-top: 0;
 }
 
-.lc a.gems, .lc span.gems2, .lc div
-{
+.lc a.gems, .lc span.gems2, .lc div {
   display: block;
   padding: 3px;
 	margin: 3px;
 }
 
-.lc a.gems, .lc span.gems2
-{
+.lc a.gems, .lc span.gems2 {
   text-decoration: none;
 }
 
-.lc a.gems:hover, .lc span.gems2:hover
-{
+.lc a.gems:hover, .lc span.gems2:hover {
   color: blue;
   background: #99b3c5;
 }
 
-.lc span.gems2
-{
+.lc span.gems2 {
   cursor: pointer;
   color: black;
   font-weight: bold;
   background: #b0cde4;
 }
 
-.lc_head
-{
+.lc_head {
   -moz-user-select: none;
   cursor: pointer;
   font-size: 1em;
   font-weight: bold;
 }
 
-.navigator_info
-{
+.navigator_info {
   font-size: smaller;
 }
 
@@ -217,33 +197,28 @@ a:hover, .link:hover
 	text-decoration: underline;
 }
 
-.copyright
-{
+.copyright {
   font-size: 75%;
   text-align: right;
   padding-right: 5px;
   border-top: 1px solid silver;
 }
 
-.system_info
-{
+.system_info {
   font-size: 75%;
 }
 
-.page_title
-{
+.page_title {
   font-size: 12pt;
   font-weight: bold;
 }
 
-.main_page_area
-{
+.main_page_area {
   background-color: white;
   width: 100%;
 }
 
-.page_section_head
-{
+.page_section_head {
   font-size: 12pt;
   font-weight: bold;
 }
@@ -254,9 +229,7 @@ table.sub_page_area
 }
 
 /* Label */
-
-.error
-{
+.error {
   color: red;
   font-weight: bold;
   margin: 3px 0px 3px 0px;
@@ -265,47 +238,38 @@ table.sub_page_area
   text-align: center;
 }
 
-.attention_marker
-{
+.attention_marker {
   color: #ff0033;
 }
 
-.subpage_header_area
-{
+.subpage_header_area {
   margin: 3px 0px 3px 0px;
   border: 1pt solid silver;
 }
 
-.page_header_area
-{
+.page_header_area {
   border: 1pt solid silver;
   position: relative;
   bottom:15pt;
 }
 
-/*
-  Fields
-*/
-input[readonly]
-{
+/* Fields */
+input[readonly] {
   background: #EFEFEF;
 }
 
-.readonly
-{
+.readonly {
   background: #EFEFEF;
 }
 
-/*====== lists ======*/
-table#list
-{
+/* Lists */
+table#list {
   width: 100%;
   border: solid #7f94a5;
   border-width: 1px 1px 2px 1px;
 }
 
-table#list th
-{
+table#list th {
   font-size: 0.9em;
   font-weight: bold;
   text-align: center;
@@ -327,16 +291,14 @@ table#list thead input {
   background-color: #b0cde4;
 }
 
-/*====== Panes ======*/
-.pane_main
-{
+/* Panes */
+.pane_main {
   width: 100%;
   min-height: 500px;
   position: relative;
 }
 
-#pane_left
-{
+#pane_left {
   width: 30.0%;
   height: 100%;
   float: left;
@@ -345,16 +307,14 @@ table#list thead input {
   border-width: 1px;;
 }
 
-#pane_right
-{
+#pane_right {
   width: 69.3%;
   height: 100%;
   float: left;
   margin-left: 0.15%;
 }
 
-#pane_right_top
-{
+#pane_right_top {
   width: 100%;
   height: 100%;
   overflow: auto;
@@ -362,8 +322,7 @@ table#list thead input {
   border-width: 1px
 }
 
-#pane_right_bottom
-{
+#pane_right_bottom {
   width: 100%;
   height: 49.5%;
   margin-top: 0.4%;
@@ -372,8 +331,7 @@ table#list thead input {
   border-width: 1px
 }
 
-#channel_header
-{
+#channel_header {
   width: 100%;
   float: left;
   font-size: 1em;
@@ -383,67 +341,38 @@ table#list thead input {
   border-width: 0px 0px 1px 0px;
 }
 
-#channel_header_left
-{
+#channel_header_left {
   float: left;
   padding: 3px;
 }
 
-#channel_header_right
-{
+#channel_header_right {
   float: right;
   padding: 3px;
   text-align: right;
 }
 
-/*====== rows ======   background-color: #EFEFEF; */
-.td_border
-{
-  border: solid #7f94a5;
-  border-width: 1px 0px 1px 0px;
-}
-
-.tr_0
-{
+/* Grid Rows */
+.tr_0 {
   border: solid #7f94a5;
   border-width: 0px 0px 1px 0px;
   background-color: #F5F5EE;
 }
 
-.tr_1
-{
+.tr_1 {
   border: solid #7f94a5;
   border-width: 0px 0px 1px 0px;
 }
 
-.tr_1:hover, .tr_0:hover
-{
+.tr_1:hover, .tr_0:hover {
  	background-color: #eec;
 }
 
-.tr_select
-{
+.tr_select {
   background-color: #FFFFCC;
 }
 
-.visited
-{
-}
-
-.unvisited
-{
-  font-weight: bold;
-}
-
-/*====== forms ======*/
-.body-scroll
-{
-  background-color: white;
-  height: 30em;
-  width: auto;
-  overflow: auto;
-}
-
+/* Forms */
 .from-button
 {
   margin: .8em 0 .8em 0;
@@ -547,9 +476,7 @@ input.nolink4 {
   vertical-align: top;
 }
 
-
-.pane-label
-{
+.pane-label {
   font-weight: bold;
   background-color: #EFEFEF;
   border: 1px solid #000;
@@ -563,8 +490,7 @@ input.nolink4 {
 }
 
 /* New */
-.form-header
-{
+.form-header {
   font-size: 1.1em;
   font-weight: bold;
   margin: 0 0 6px 0;
@@ -574,8 +500,7 @@ input.nolink4 {
   background-color: #b0cde4;
 }
 
-.form-footer
-{
+.form-footer {
   margin: 6px 0px;
   text-align: center;
   height: 20px;
@@ -585,59 +510,27 @@ input.nolink4 {
   background-color: #b0cde4;
 }
 
-.form-header
-{
-  font-size: 13px;
-  font-weight: bold;
-  margin: 0 0 8px 0;
-  padding: 0px 0px 3px 4px;
-  border: solid #7f94a5;
-  border-width: 1px 1px 1px 10px;
-  background-color: #b0cde4;
-}
-
-.form-footer
-{
-  margin: 6px 0px;
-  text-align: center;
-  border: solid 1px #7f94a5;
-  background-color: #b0cde4;
-  height: 20px;
-  padding-top: 0px;
-  padding-bottom: 2px;
+.form-body {
+  width: 100%;
+  font-size: 1em;
 }
 
-.form-body
-{
+.form-body table {
   width: 100%;
-  font-size: 1em;
+  background-color: #EFEFEF;
 }
 
-.form-body td
-{
+.form-body td {
   padding: 2px;
 }
 
-.form-body th
-{
+.form-body th {
   white-space: nowrap;
   text-align: right;
   padding: 4px;
 }
 
-.td_label
-{
-  text-align: right;
-  padding-right: 1em;
-}
-
-.td_simple
-{
-  border-width: 0px 0px 0px 0px;
-}
-
-.tab_page
-{
+.tab_page {
   font-size: 10pt;
   border-width: 1px 1px 1px 1px;
   background-color: white;
@@ -648,42 +541,17 @@ input.nolink4 {
   height: 100%;
 }
 
-.clear
-{
+.clear {
   width: 100%;
   padding: 0px;
   border-width: 0;
 }
 
-.clear td
-{
+.clear td {
   padding: 0px;
   border-width: 0;
 }
 
-.form-body2
-{
-  width: 100%;
-  border: solid #7f94a5;
-  border-width: 1px 1px 2px 1px;
-  background-color: #EFEFEF;
-}
-
-.form-body2-td
-{
-  padding: 2px;
-  border: solid #7f94a5;
-  border-width: 0px 1px 1px 0px;
-}
-
-.form-body2-th
-{
-  text-align: right;
-  padding: 4px;
-  border: solid #7f94a5;
-  border-width: 0px 1px 1px 0px;
-}
-
 div.boxHeader {
   background-color: #EFEFEF;
   margin: 0 0 0.5em 0;
@@ -692,9 +560,8 @@ div.boxHeader {
   vertical-align: middle;
 }
 
-/*====== Grids ======*/
-.BMK_grid
-{
+/* Grids */
+.BMK_grid {
   width: 100%;
   border: solid #7f94a5;
   border-width: 1px 1px 2px 1px;
@@ -704,15 +571,12 @@ div.boxHeader {
   border-bottom: 1px solid #CCC;
 }
 
-thead.sortHeader tr
-{
+thead.sortHeader tr {
   background-image: url(../image/stl_blu1_grad.gif);
   background-repeat: repeat-x;
 }
 
-/* make the TH elements pretty */
-thead.sortHeader tr th
-{
+thead.sortHeader tr th {
   font-size: 1em;
   font-weight: bold;
   text-align: left;
@@ -721,20 +585,16 @@ thead.sortHeader tr th
   border-width: 0px 1px 1px 0px;
 }
 
-thead.sortHeader th.checkbox
-{
+thead.sortHeader th.checkbox {
   text-align: center;
   padding: 0;
 }
 
-thead.sortHeader th:last-child
-{
+thead.sortHeader th:last-child {
   border-width: 0px 0px 1px 0px;
 }
 
-/* make the A elements pretty. makes for nice clickable headers                */
-thead.sortHeader a, thead.sortHeader a:link, thead.sortHeader a:visited
-{
+thead.sortHeader a, thead.sortHeader a:link, thead.sortHeader a:visited {
   color: #000;
   font-weight: bold;
 	display: block;
@@ -742,41 +602,16 @@ thead.sortHeader a, thead.sortHeader a:link, thead.sortHeader a:visited
 	width: 100%
 }
 
-/* make the A elements pretty. makes for nice clickable headers                */
-/* WARNING: swapping the background on hover may cause problems in WinIE 6.x   */
-thead.sortHeader a:hover
-{
+thead.sortHeader a:hover {
   color: #000;
   font-weight: bold;
 	display: block;
-	text-decoration: underline;
+  text-decoration: none;
 	width: 100%
 }
 
-/*====== New forms ======*/
-.new-form-header
-{
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 0 0 6px 0;
-  padding: 0px 0px 2px 4px;
-  border: solid #7f94a5;
-  border-width: 1px 1px 1px 10px;
-  background-color: #b0cde4;
-}
-
-.new-form-footer
-{
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 6px 0 0 0;
-  text-align: center;
-  border: solid 1px #7f94a5;
-  background-color: #b0cde4;
-}
-
-.new-form-body
-{
+/* New forms */
+.new-form-body {
   font-size: 1em;
   padding: 6px;
   border: solid #7f94a5;
@@ -784,38 +619,28 @@ thead.sortHeader a:hover
   background-color: #EFEFEF;
 }
 
-.no-border
-{
-  border-width: 0;
-}
-
-.new-form-body table
-{
+.new-form-body table {
   width: 100%;
   background-color: #EFEFEF;
 }
 
-.new-form-body table td
-{
+.new-form-body table td {
   padding: 2px;
 }
 
-.new-form-body table td.text
-{
+.new-form-body table td.text {
   font-style: italic;
   font-weight: bold;
   padding: 2px;
 }
 
-.new-form-body table th
-{
+.new-form-body table th {
   text-align: right;
   white-space: nowrap;
   padding: 4px;
 }
 
-td.new-section
-{
+td.new-section {
   text-align: center;
   font-weight: bold;
   background-color: #B0CDE4;
@@ -831,7 +656,6 @@ td.new-section
 /* tabs */
 div.c1 {
   width:100%;
-  padding-top:0.5em;
 }
 
 div.tabs {
@@ -908,19 +732,17 @@ div.activeTab2 {
   background-color: #FFF;
 }
 
-/*====== Toolbars ======*/
+/* Toolbars */
 div.toolbar {
 }
 
-img.toolbar
-{
+img.toolbar {
 	float: left;
   margin-top: 10px;
   background-color: #7F94A5;
 }
 
-span.toolbar
-{
+span.toolbar {
 	float: left;
 	width: 70px;
 	padding: 10px 0 10px 0;
@@ -930,8 +752,7 @@ span.toolbar
 	text-align: center;
 }
 
-span.toolbarLabel
-{
+span.toolbarLabel {
   font-size: 0.8em;
 }
 
@@ -950,21 +771,18 @@ span.toolbarLabel
 }
 
 /* Comments */
-div.cm_node_top
-{
+div.cm_node_top {
   padding-left: 1em;
   margin-left: 0px;
 }
 
-div.cm_node
-{
+div.cm_node {
   padding-left: 1em;
   margin-left: 0px;
   border-left: 2px #e0e0e0 solid;
 }
 
-div.comment-section
-{
+div.comment-section {
   padding: 0 0px 0 2px;
   font-size: 1.1em;
   font-weight: bold;
@@ -973,25 +791,21 @@ div.comment-section
   background-color: #b0cde4;
 }
 
-div.comment
-{
+div.comment {
   margin-top: 5px;
 }
 
-div.comment-footer
-{
+div.comment-footer {
   margin: 1px;
   color: gray;
 }
 
-div.comment-header
-{
+div.comment-header {
   border-bottom: 1px #cccccc solid;
   font-size: 1.1em;
 }
 
-div.comment-button
-{
+div.comment-button {
   margin: 1px;
   padding-top: 5px;
   border-top: 1px #cccccc solid;
@@ -1002,8 +816,7 @@ input.openID {
   padding-left: 18px;
 }
 
-.FM_bold
-{
+.FM_bold {
   font-weight: bold;
 }
 
@@ -1057,3 +870,23 @@ td.calendar_selected {
 .calendar_special {
 	color: #c55;
 }
+
+.pointer {
+  cursor: pointer;
+}
+
+span.button {
+  background: none repeat scroll 0 0 #99B3C5;
+  border: 1px solid #7F94A5;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  color: #FFFFFF;
+  font-size: 0.8em;
+  font-weight: bold;
+  padding: 3px 4px 1px;
+  text-decoration:none;
+}
+
+img.button {
+  margin-bottom: -3px;
+}
diff --git a/appsrc/ODS-Bookmark/www/error.vspx b/appsrc/ODS-Bookmark/www/error.vspx
index 3747eb8..c209c44 100644
--- a/appsrc/ODS-Bookmark/www/error.vspx
+++ b/appsrc/ODS-Bookmark/www/error.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: error.vspx,v 1.5 2008/02/19 11:02:23 source Exp $
+ -  $Id: error.vspx,v 1.5.2.2 2010/09/20 10:14:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -38,7 +38,7 @@
         An error has occurred during processing of the "<?V self.page_name ?>" page.
       </div>
       <div class="error" style="text-align: left;">
-        <table>
+        <table cellspacing="5">
           <tr>
             <td valign="top">SQL State </td>
             <td>
@@ -47,11 +47,7 @@
           </tr>
           <tr>
             <td valign="top">SQL Message </td>
-            <td>
-              <pre>
-                <?V self.msg ?>
-              </pre>
-            </td>
+            <td><pre><?V self.msg ?></pre></td>
           </tr>
         </table>
       </div>
diff --git a/appsrc/ODS-Bookmark/www/export.vspx b/appsrc/ODS-Bookmark/www/export.vspx
index 7951d55..c10a1d6 100644
--- a/appsrc/ODS-Bookmark/www/export.vspx
+++ b/appsrc/ODS-Bookmark/www/export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
-  -  $Id: export.vspx,v 1.15.2.2 2010/05/31 21:59:14 source Exp $
+  -  $Id: export.vspx,v 1.15.2.3 2010/09/20 10:14:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Bookmark/www/forms.vspx b/appsrc/ODS-Bookmark/www/forms.vspx
index dd0471b..0b676d0 100644
--- a/appsrc/ODS-Bookmark/www/forms.vspx
+++ b/appsrc/ODS-Bookmark/www/forms.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: forms.vspx,v 1.12.2.8 2010/04/15 18:46:20 source Exp $
+ -  $Id: forms.vspx,v 1.12.2.15 2010/11/19 16:49:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -74,7 +74,7 @@
       if (lcase (BMK.WA.node_type (node)) <> 'b')
         return 'visited';
 
-      if (self.account_role in ('public', 'guest'))
+      if (self.account_rights <> 'W')
         return 'unvisited';
 
       return either (isnull (BMK.WA.bookmark_visited (self.domain_id, BMK.WA.node_id (node))), 'unvisited', 'visited');
@@ -110,7 +110,7 @@
           {
             http (left (cast (fValue as varchar), 10));
           } else {
-            http (BMK.WA.utf2wide (fValue));
+            http (fValue);
           }
         }
       }
@@ -123,7 +123,7 @@
       {
         if (is_empty_or_null (fValue))
         {
-          http (' ');
+          http ('-');
         } else {
           declare N integer;
           declare delimiter varchar;
@@ -253,7 +253,7 @@
 
           mt := '';
           st := '';
-          if ((self.account_role not in ('public', 'guest')) and (not (((node_type = 's') and (node_id = -1)) or (node_type = 'u') or (node_type = 'F'))))
+          if ((self.account_rights = 'W') and (not (((node_type = 's') and (node_id = -1)) or (node_type = 'u') or (node_type = 'F'))))
           {
             mt := sprintf('Selected as <select name="mark" onchange="javascript: if (anySelected(this.form, \'cb_item\', \'No posts were selected to mark as \'+this.options[this.selectedIndex].text+\'.\')) {this.form.submit();} else {this.selectedIndex = 0}"><option/><option>visited</option><option>unvisited</option></select>');
             st := sprintf('View <select name="show" onchange="javascript: this.form.submit();"><option value="">all</option><option value="visited">visited</option><option value="unvisited">unvisited</option></select>');
@@ -317,19 +317,17 @@
           <v:before-data-bind>
             <![CDATA[
               declare data, node_type, node_id any;
-              declare flag, tmp varchar;
+              declare flag, tmp, sql varchar;
 
               node_id := BMK.WA.node_id (self.bNode);
               node_type := BMK.WA.node_type (self.bNode);
 
-              tmp := 'select 0 _TYPE, F_ID _ID, \'\' _NODE, F_NAME _NAME, null _URI, null _VISITED, null _UPDATED, null _CREATED from BMK.WA.FOLDER where 1=0';
               control.ds_parameters := null;
-              control.ds_sql := tmp;
               if (node_type = 'f')
               {
                 if (self.domain_id >= 0)
                 {
-                  control.ds_sql := 'select *
+                  sql := 'select *
                                        from (select 0                                _TYPE,
                                                     F_ID                             _ID,
                                                     BMK.WA.make_node(\'f\', F_ID)    _NODE,
@@ -337,33 +335,27 @@
                                                     \'\'                             _URI,
                                                     null                             _VISITED,
                                                     null                             _UPDATED,
-                                                    null                             _CREATED
+                                         null                             _CREATED,
+                                         null                             _FOLDER_ID,
+                                         null                             _FOLDER_NAME,
+                                         null                             _GRANT_ID
                                                from BMK.WA.FOLDER
                                               where F_DOMAIN_ID = <DOMAIN_ID>
                                                 and coalesce(F_PARENT_ID, -1) = <ID>
 
                                               union
 
-                                             select 1                                _TYPE,
-                                                    a.BD_ID                          _ID,
-                                                    BMK.WA.make_node(\'b\', a.BD_ID) _NODE,
-                                                    a.BD_NAME                        _NAME,
-                                                    b.B_URI                          _URI,
-                                                    a.BD_VISITED                     _VISITED,
-                                                    a.BD_UPDATED                     _UPDATED,
-                                                    a.BD_CREATED                     _CREATED
-                                               from BMK.WA.BOOKMARK_DOMAIN a
-                                                      join BMK.WA.BOOKMARK b on b.B_ID = a.BD_BOOKMARK_ID
-                                              where a.BD_DOMAIN_ID = <DOMAIN_ID>
-                                                and coalesce(a.BD_FOLDER_ID, -1) = <ID>) x
+                                  <BOOKMARKS>
+                                 ) x
                                       where 1 = 1';
-                  control.ds_sql := replace(control.ds_sql, '<USER_ID>', cast (self.account_id as varchar));
-                  control.ds_sql := replace(control.ds_sql, '<DOMAIN_ID>', cast (self.domain_id as varchar));
-                  control.ds_sql := replace(control.ds_sql, '<ID>', BMK.WA.node_suffix(self.bNode));
+                  BMK.WA.xml_set('folderID', data, BMK.WA.node_suffix(self.bNode));
+                  tmp := BMK.WA.sfolder_sql (self.domain_id, self.account_id, self.account_rights, data);
+                  sql := replace(sql, '<BOOKMARKS>', tmp);
+                  sql := replace(sql, '<ID>', BMK.WA.node_suffix(self.bNode));
                 }
                 else
                 {
-                  control.ds_sql := 'select *
+                  sql := 'select *
                                        from (select TOP 100
                                                     1                              _TYPE,
                                                     BD_ID                          _ID,
@@ -379,14 +371,14 @@
                                               where BD_BOOKMARK_ID = B_ID
                                                 and WAI_ID = BD_DOMAIN_ID
                                                 and WAI_IS_PUBLIC = 1
-                                              order by BD_UPDATED desc) x
+                                   order by BD_UPDATED desc
+                                 ) x
                                       where 1 = 1';
                 }
-
               }
               else if ((node_type = 's') and (node_id = -1))
               {
-                control.ds_sql := 'select *
+                sql := 'select *
                                      from (select 1                              _TYPE,
                                                   SF_ID                          _ID,
                                                   BMK.WA.make_node(\'s\', SF_ID) _NODE,
@@ -398,25 +390,26 @@
                                              from BMK.WA.SFOLDER
                                             where SF_DOMAIN_ID = <DOMAIN_ID>) x
                                       where 1 = 1';
-                control.ds_sql := replace(control.ds_sql, '<DOMAIN_ID>', cast (self.domain_id as varchar));
+                sql := replace(sql, '<DOMAIN_ID>', cast (self.domain_id as varchar));
               }
               else if ((node_type = 's') and (node_id >= 0))
               {
                 data := (select SF_DATA from BMK.WA.SFOLDER where SF_DOMAIN_ID = self.domain_id and SF_ID = node_id);
-                control.ds_sql := 'select distinct rs.* from BMK.WA.shared_sql (rs0, rs1, rs2)(_TYPE integer, _ID integer, _NODE varchar, _NAME varchar, _URI varchar, _VISITED datetime, _UPDATED datetime, _CREATED datetime, _FOLDER_ID integer, _FOLDER_NAME varchar, _GRANT_ID integer) rs where rs0 = ? and rs1 = ? and rs2 = ?';
+                sql := 'select distinct rs.* from BMK.WA.shared_sql (rs0, rs1, rs2, rs3)(_TYPE integer, _ID integer, _NODE varchar, _NAME varchar, _URI varchar, _VISITED datetime, _UPDATED datetime, _CREATED datetime, _FOLDER_ID integer, _FOLDER_NAME varchar, _GRANT_ID integer) rs where rs0 = ? and rs1 = ? and rs2 = ? and rs3 = ?';
                 control.add_parameter (self.domain_id);
                 control.add_parameter (self.account_id);
+                control.add_parameter (self.account_rights);
                 control.add_parameter (data);
 
               }
               else if ((node_type = 't') and not is_empty_or_null (BMK.WA.node_suffix (self.bNode)))
               {
                 BMK.WA.xml_set('tags', data, BMK.WA.node_suffix(self.bNode));
-                control.ds_sql := BMK.WA.sfolder_sql (self.domain_id, self.account_id, data);
+                sql := BMK.WA.sfolder_sql (self.domain_id, self.account_id, self.account_rights, data);
               }
               else if ((node_type = 'u') and (node_id = -1))
               {
-                control.ds_sql := 'select *
+                sql := 'select *
                                      from (select distinct
                                                   1                              _TYPE,
                                                   U_ID                           _ID,
@@ -426,17 +419,15 @@
                                                   null                           _VISITED,
                                                   null                           _UPDATED,
                                                   null                           _CREATED
-                                             from BMK.WA.GRANTS,
-                                                  DB.DBA.SYS_USERS
-                                            where G_GRANTEE_ID = <USER_ID>
-                                              and G_GRANTER_ID = U_ID) x
+                                  from BMK..GRANTS_VIEW
+                                 where GW_ID = <USER_ID>
+                               ) x
                                       where 1 = 1';
-                control.ds_sql := replace(control.ds_sql, '<USER_ID>', cast (self.account_id as varchar));
-
+                sql := replace(sql, '<USER_ID>', cast (self.account_id as varchar));
               }
               else if ((node_type = 'u') and (node_id >= 0))
               {
-                control.ds_sql := 'select *
+                sql := 'select *
                                      from (select 0                              _TYPE,
                                                   F_ID                           _ID,
                                                   BMK.WA.make_node(\'F\', F_ID)  _NODE,
@@ -446,11 +437,11 @@
                                                   null                           _UPDATED,
                                                   null                           _CREATED
                                              from BMK.WA.FOLDER,
-                                                  BMK.WA.GRANTS
-                                            where G_OBJECT_TYPE = \'F\'
+                                      BMK..GRANTS_OBJECT_VIEW
+                                where GOW_TYPE = \'F\'
                                               and G_OBJECT_ID = F_ID
-                                              and G_GRANTER_ID = <ID>
-                                              and G_GRANTEE_ID = <USER_ID>
+                                  and GOW_FROM = <ID>
+                                  and GOW_TO = <USER_ID>
 
                                             union
 
@@ -462,20 +453,20 @@
                                                   a.BD_VISITED                     _VISITED,
                                                   a.BD_UPDATED                     _UPDATED,
                                                   a.BD_CREATED                     _CREATED
-                                             from BMK.WA.GRANTS d,
+                                 from BMK..GRANTS_OBJECT_VIEW d,
                                                   BMK.WA.BOOKMARK_DOMAIN a
                                                     join BMK.WA.BOOKMARK b on b.B_ID = a.BD_BOOKMARK_ID
-                                            where d.G_OBJECT_TYPE = \'B\'
+                                where d.GOW_TYPE = \'B\'
                                               and d.G_OBJECT_ID = a.BD_ID
-                                              and d.G_GRANTER_ID = <ID>
-                                              and d.G_GRANTEE_ID = <USER_ID>) x
+                                  and GOW_FROM = <ID>
+                                  and GOW_TO = <USER_ID>
+                              ) x
                                       where 1 = 1';
-                control.ds_sql := replace(control.ds_sql, '<ID>', BMK.WA.node_suffix(self.bNode));
-                control.ds_sql := replace(control.ds_sql, '<USER_ID>', cast (self.account_id as varchar));
+                sql := replace(sql, '<ID>', BMK.WA.node_suffix(self.bNode));
               }
               else if (node_type = 'F')
               {
-                control.ds_sql := 'select *
+                sql := 'select *
                                      from (select 0                              _TYPE,
                                                   F_ID                           _ID,
                                                   BMK.WA.make_node(\'F\', F_ID)  _NODE,
@@ -499,23 +490,26 @@
                                                   a.BD_CREATED                     _CREATED
                                              from BMK.WA.BOOKMARK_DOMAIN a
                                                     join BMK.WA.BOOKMARK b on b.B_ID = a.BD_BOOKMARK_ID
-                                            where coalesce(a.BD_FOLDER_ID, -1) = <ID>) x
+                                where coalesce(a.BD_FOLDER_ID, -1) = <ID>
+                              ) x
                                       where 1 = 1';
-                control.ds_sql := replace(control.ds_sql, '<USER_ID>', cast (self.account_id as varchar));
-                control.ds_sql := replace(control.ds_sql, '<ID>', BMK.WA.node_suffix(self.bNode));
+                sql := replace(sql, '<ID>', BMK.WA.node_suffix(self.bNode));
               }
-
-              if (tmp = control.ds_sql)
+              else
+              {
+                control.ds_sql := 'select 0 _TYPE, F_ID _ID, \'\' _NODE, F_NAME _NAME, null _URI, null _VISITED, null _UPDATED, null _CREATED from BMK.WA.FOLDER where 1=0';
                 goto _end;
-
+              }
+              sql := replace(sql, '<DOMAIN_ID>', cast (self.domain_id as varchar));
+              sql := replace(sql, '<USER_ID>', cast (self.account_id as varchar));
               flag := get_keyword('show', params, '');
               if (flag = 'visited')
-                control.ds_sql := concat(control.ds_sql, ' and (_VISITED is not null)');
-              if (flag = 'unvisited')
-                control.ds_sql := concat(control.ds_sql, ' and (_VISITED is null)');
+                sql := concat (sql, ' and (_VISITED is not null)');
+              else if (flag = 'unvisited')
+                sql := concat (sql, ' and (_VISITED is null)');
 
               self.sortChange(get_keyword ('sortColumn', params, ''));
-              control.ds_sql := concat (control.ds_sql, ' order by _TYPE, ', self.n_order, ' ', self.n_direction, ', _ID');
+              control.ds_sql := concat (sql, ' order by _TYPE, ', self.n_order, ' ', self.n_direction, ', _ID');
 
             _end:;
             ]]>
@@ -528,11 +522,9 @@
           <table id="bookmarks" style="clear: left; width: 100%;" cellspacing="0">
             <thead class="sortHeader">
               <tr>
-                <v:template type="simple" enabled="--case when (self.account_role in ('public', 'guest')) then 0 else 1 end">
                   <th class="checkbox" width="1%">
                     <input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, 'cb_item')"/>
                   </th>
-                </v:template>
                 <th width="1%" style="border-width: 0px 0px 1px 0px;">
                   <img src="image/c.gif" border="0" alt="" />
                 </th>
@@ -562,41 +554,45 @@
           <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
             <table>
               <tr>
-                <v:template type="simple" enabled="--case when (self.account_role in ('public', 'guest')) then 0 else 1 end">
-                  <td align="center" valign="top">
                     <?vsp
-                      declare node, node_type any;
+                    declare node, node_type, node_id, permissions any;
 
-                      node := ((control.vc_parent) as vspx_row_template).te_column_value('_NODE');
+                    node := (control as vspx_row_template).te_column_value('_NODE');
                       node_type := BMK.WA.node_type (node);
-                      if (node_type in ('f', 's', 'b'))
+                    node_id := BMK.WA.node_id (node);
+                    permissions := self.account_rights;
+                    if (node_type = 'b')
+                      permissions := BMK.WA.bookmark_rights (self.domain_id, node_id, self.account_rights);
+
+                  ?>
+                  <td align="center" valign="top">
+                    <?vsp
+                      if ((permissions = 'W') and (node_type in ('f', 's', 'b')))
                       {
                         http (sprintf ('<input type="checkbox" name="cb_item" value="%s" onclick="selectCheck(this, \'cb_item\')"/>', node));
                       }
                     ?>
                   </td>
-                </v:template>
                   <td valign="top">
                     <?vsp
-                      declare node, image, alt any;
+                      declare image, alt any;
 
-                      node := (control as vspx_row_template).te_column_value('_NODE');
-                      if (lcase(BMK.WA.node_type (node)) = 'f')
+                      if      (lcase (node_type) = 'f')
                       {
                         image := '/ods/images/oat/Tree_node-collapsed.png';
                         alt := 'Folder';
                       }
-                      else if (lcase(BMK.WA.node_type (node)) = 'b')
+                      else if (lcase (node_type) = 'b')
                       {
                         image := 'image/web_16.png';
                         alt := 'Bookmark';
                       }
-                      else if (BMK.WA.node_type (node) = 's')
+                      else if (lcase (node_type) = 's')
                       {
                         image := 'image/sfolder_16.jpg';
                         alt := 'Smart Folder';
                       }
-                      else if (BMK.WA.node_type (node) = 'u')
+                      else if (lcase (node_type) = 'u')
                       {
                         image := 'image/user_16.png';
                         alt := 'User';
@@ -606,37 +602,35 @@
                   </td>
                   <td valign="top">
                     <?vsp
-                      declare N, id, domain_id integer;
-                      declare node, target, uri, onclick, title, title2, tags varchar;
-
-                      node := (control as vspx_row_template).te_column_value('_NODE');
-                      id := BMK.WA.node_id (node);
-                      domain_id := (select BD_DOMAIN_ID from BMK.WA.BOOKMARK_DOMAIN where BD_ID = id);
-                      title := (control as vspx_row_template).te_column_value('_NAME');
-                      if (lcase(BMK.WA.node_type ((control as vspx_row_template).te_column_value('_NODE'))) = 'b')
+                      declare N, domain_id integer;
+                      declare target, uri, onclick, title, title2, tags varchar;
+
+                      title := BMK.WA.utf2wide ((control as vspx_row_template).te_column_value('_NAME'));
+                      if (lcase (node_type) = 'b')
                       {
+                        domain_id := (select BD_DOMAIN_ID from BMK.WA.BOOKMARK_DOMAIN where BD_ID = node_id);
                         uri := (control as vspx_row_template).te_column_value('_URI');
                         title2 := BMK.WA.rdfa_value (sprintf ('%V', title), 'dc:title');
                         onclick := '';
                         if (self.account_id > 0)
-                          onclick := sprintf ('onclick="javascript: openBookmark (\'%d\');"', id);
+                          onclick := sprintf ('onclick="javascript: openBookmark (\'%d\');"', node_id);
                         if (cast(get_keyword ('panes', self.settings, '0') as integer) = 0)
                         {
                           target := case when (cast(get_keyword ('bookmarkOpen', self.settings, '0') as integer) = 0) then '_blank' else '_self' end;
-                          http (sprintf('<a id="bookmark_%d" href="%s" target="%s" %s class="%s %s" title="Full window view of \'%s\'" about="%U">%s</a>', id, uri, target, onclick, 'app', self.linkClass(node), title, SIOC..bmk_post_iri(domain_id, id), title2));
+                          http (sprintf ('<a id="bookmark_%d" href="%s" target="%s" %s class="%s %s" title="Full window view of \'%s\'" about="%U">%s</a>', node_id, uri, target, onclick, 'app', self.linkClass(node), title, SIOC..bmk_post_iri(domain_id, node_id), title2));
                         } else {
-                          http (sprintf('<a id="bookmark_%d" href="%s" onclick="javascript: parent.openIFrame (\'%d\', \'%d\', \'%s\'); return false;" class="%s %s" title="3-Pane view of \'%s\'" about="%U">%s</a>', id, uri, id, self.account_id, uri, 'app', self.linkClass(node), title, SIOC..bmk_post_iri(domain_id, id), title2));
+                          http (sprintf ('<a id="bookmark_%d" href="%s" onclick="javascript: parent.openIFrame (\'%d\', \'%d\', \'%s\'); return false;" class="%s %s" title="3-Pane view of \'%s\'" about="%U">%s</a>', node_id, uri, node_id, self.account_id, uri, 'app', self.linkClass(node), title, SIOC..bmk_post_iri(domain_id, node_id), title2));
                         }
                         if (self.domain_id = domain_id)
                         {
-                          tags := BMK.WA.tags_select (domain_id, id);
+                          tags := BMK.WA.tags_select (domain_id, node_id);
                           if (not is_empty_or_null(tags))
                           {
                             http('<br /><i>Tags: ');
                             tags := split_and_decode (tags, 0, '\0\0,');
                             for (N := 0; N < length(tags); N := N + 1)
                             {
-                              http(sprintf('<a id="tag_%d_%s" href="%s" onclick="javascript: parent.BMK.selectTag (\'%s\'); return false;">%s</a>', id, tags[N], SIOC..tag_iri (BMK.WA.forum_iri (self.domain_id), tags[N]), tags[N], tags[N]));
+                              http(sprintf('<a id="tag_%d_%s" href="%s" onclick="javascript: parent.BMK.selectTag (\'%s\'); return false;">%s</a>', node_id, tags[N], SIOC..tag_iri (BMK.WA.forum_iri (self.domain_id), tags[N]), tags[N], tags[N]));
                               if (N <> length(tags)-1)
                                 http(' | ');
                             }
@@ -660,12 +654,9 @@
                   </vm:if>
                   <td nowrap="nowrap" valign="top">
                     <?vsp
-                      declare N, node_id, domain_id integer;
-                      declare actions, actionPrefix, node, node_type, uri, onclick, title, target, tags any;
+                      declare N, domain_id integer;
+                      declare actions, actionPrefix, uri, onclick, title, target, tags any;
 
-                      node := (control as vspx_row_template).te_column_value('_NODE');
-                      node_id := BMK.WA.node_id (node);
-                      node_type := BMK.WA.node_type (node);
                       actionPrefix := '';
                       if (lcase (node_type) = 'b')
                       {
@@ -688,11 +679,10 @@
                         title := '\'' || (control as vspx_row_template).te_column_value('_NAME') || '\'';
 
                         actions := '';
-
-                        if ((node_type = 'b') and ((self.account_role in ('public', 'guest')) or (self.bNodePath like '/u#-1%')))
+                        if ((node_type = 'b') and ((permissions <> 'W') or (self.bNodePath like '/u#-1%')))
                           actions := actions || either (equ (actions, ''), '', ' | ') || sprintf('<span onclick="javascript: parent.BMK.formShow(\'%s/View\', \'%d\'); return false;" title="View %s" class="link">view</span>', actionPrefix, node_id, title);
 
-                        if (not ((self.account_role in ('public', 'guest')) or (self.bNodePath like '/u#-1%')))
+                        if ((permissions = 'W') and (self.bNodePath not like '/u#-1%'))
                           actions := actions || either (equ (actions, ''), '', ' | ') || sprintf('<span onclick="javascript: parent.BMK.formShow(\'%s/Edit\', \'%d\'); return false;" title="Edit %s" class="link">edit</span>', actionPrefix, node_id, title);
 
                         if ((node_type = 'b') and (cast (get_keyword ('panes', self.settings, '0') as integer) = 1))
@@ -702,7 +692,7 @@
                           actions := actions || either (equ (actions, ''), '', ' | ') || sprintf('<a href="%s" target="%s" %s title="Full window view of %s" class="link">show</a>', uri, target, onclick, title);
                         }
 
-                        if ((node_type = 'b') and (self.account_role not in ('public', 'guest')) and (self.bNodePath not like '/u#-1%'))
+                        if ((node_type = 'b') and (permissions = 'W') and (self.bNodePath not like '/u#-1%'))
                           actions := actions || either (equ (actions, ''), '', ' | ') || self.windowOpen (sprintf ('annotea.vspx?oid=%d', node_id), 'annotate', title);
 
                         if ((node_type = 'b') and BMK.WA.discussion_check () and BMK.WA.conversation_enable (self.domain_id))
@@ -746,7 +736,7 @@
         </v:before-data-bind>
 
         <v:template type="simple" enabled="-- case when (self.bStep = '1') then 1 else 0 end">
-          <div class="new-form-header">
+          <div class="form-header">
             <v:label format="%s" value="Import: Step 1 - Select source type"/>
           </div>
           <div class="new-form-body">
@@ -812,7 +802,7 @@
               </tr>
             </table>
           </div>
-          <div class="new-form-footer">
+          <div class="form-footer">
             <v:button action="simple" value="Next" xhtml_class="form-button">
               <v:on-post>
                 <![CDATA[
@@ -836,7 +826,7 @@
         </v:template>
 
         <v:template type="simple" enabled="-- case when (self.bStep = '2') then 1 else 0 end">
-          <div class="new-form-header">
+          <div class="form-header">
             <v:label format="%s" value="Import: Step 2 - Source parameters"/>
           </div>
           <div class="new-form-body">
@@ -858,13 +848,12 @@
                   </th>
                   <td>
                     <v:text name="i_dav" xhtml_id="i_dav" value="" xhtml_size="40" />
-                    <v:button action="browse" value="Browse...">
-                       <v:after-data-bind>
+                    <input type="button" value="Browse..." onclick="davBrowse ('i_dav');" />
                          <![CDATA[
-                          control.vc_add_attribute ('onclick', 'javascript: davBrowse (''i_dav'');');
+              		    <script type="text/javascript">
+                        OAT.Loader.load(['dav'], function(){OAT.WebDav.init(davOptions);});
+              		    </script>
                         ]]>
-                      </v:after-data-bind>
-                    </v:button>
                   </td>
                 </tr>
               </vm:if>
@@ -913,7 +902,7 @@
               </vm:if>
             </table>
           </div>
-          <div class="new-form-footer">
+          <div class="form-footer">
             <v:button action="simple" value="Back" xhtml_class="form-button">
               <v:on-post>
                 <![CDATA[
@@ -1018,7 +1007,7 @@
         </v:template>
 
         <v:template type="simple" enabled="-- case when (self.bStep = '3') then 1 else 0 end">
-          <div class="new-form-header">
+          <div class="form-header">
             <v:label format="%s" value="Import: Step 3 - Options"/>
           </div>
           <div class="new-form-body">
@@ -1056,7 +1045,7 @@
               </tr>
             </table>
           </div>
-          <div class="new-form-footer">
+          <div class="form-footer">
             <v:button action="simple" value="Back" xhtml_class="form-button">
               <v:on-post>
                 <![CDATA[
@@ -1096,7 +1085,7 @@
         </v:template>
 
         <v:template type="simple" enabled="-- case when (self.bStep = '4') then 1 else 0 end">
-          <div class="new-form-header">
+          <div class="form-header">
             <v:label format="%s" value="Import: Step 4 - Progress bar"/>
           </div>
           <div class="new-form-body">
@@ -1171,7 +1160,7 @@
               </tr>
             </table>
           </div>
-          <div class="new-form-footer">
+          <div class="form-footer">
             <input type="button" id="btn_Background" value="Background" onclick="javascript: parent.BMK.formPostAfter('import'); return false;"/>
             <input type="button" id="btn_Stop" value="Stop" onclick="javascript: stopState(); parent.BMK.formPostAfter('import'); return false;" class="form-button" />
           </div>
@@ -1184,8 +1173,8 @@
       </v:template>
 
       <v:template type="simple" enabled="-- case when self.v_form = 'export' then 1 else 0 end">
-        <div class="new-form-header">
-          <v:label format="%s" value="Export"/>
+        <div class="form-header">
+          Export
         </div>
         <div class="new-form-body">
           <table cellspacing="0">
@@ -1212,7 +1201,7 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" value="Export" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
@@ -1235,17 +1224,13 @@
 
             if (isnull(get_keyword ('b_name', params)) and (self.v_form in ('Bookmark/Edit', 'Bookmark/View')))
             {
-              declare tmp any;
-
-              select BD_BOOKMARK_ID,
-                     B_URI,
+              select B_URI,
                      BD_NAME,
                      BD_DESCRIPTION,
                      BD_TAGS,
                      BD_FOLDER_ID,
                      BD_ACL
-                into tmp,
-                     self.v_uri,
+                into self.v_uri,
                      self.v_name,
                      self.v_description,
                      self.v_tags,
@@ -1280,22 +1265,20 @@
           http (sprintf ('<input type="hidden" name="b_id" value="%d" />', self.v_id));
         ?>
         <v:text name="tabNo" xhtml_id="tabNo" type="hidden" />
-        <div class="new-form-header">
+        <div class="form-header">
           <v:label format="%s" value="--self.v_form"/>
         </div>
         <div id="a" class="c1">
           <div class="tabs">
              <vm:tabCaption tab="a" tabsCount="2" tabNo="0" caption="Main" />
-            <vm:if test="BMK.WA.domain_is_public (self.domain_id) = 2">
-               <vm:tabCaption tab="a" tabsCount="2" tabNo="1" caption="Access" />
-            </vm:if>
+             <vm:tabCaption tab="a" tabsCount="2" tabNo="1" caption="Sharing" />
           </div>
           <div class="contents">
             <div id="a_content_0" class="tabContent">
               <table class="form-body" cellspacing="0">
             <tr>
               <th width="25%">
-                <v:label for="b_name" value="Name (*)"/>
+                    <v:label for="b_name" value="--case when self.v_form <> 'Bookmark/View' then 'Name (*)' else 'Name' end"/>
               </th>
               <td>
                 <vm:if test="self.v_form <> 'Bookmark/View'">
@@ -1306,7 +1289,7 @@
             </tr>
             <tr>
               <th>
-                <v:label for="b_uri" value="Link (*)"/>
+                    <v:label for="b_uri" value="--case when self.v_form <> 'Bookmark/View' then 'Link (*)' else 'Link' end"/>
               </th>
               <td>
                 <vm:if test="self.v_form <> 'Bookmark/View'">
@@ -1339,19 +1322,6 @@
               </td>
             </tr>
             <tr>
-              <th>
-                <v:label for="b_grants" value="Share with" />
-              </th>
-              <td>
-                <vm:if test="self.v_form <> 'Bookmark/View'">
-                  <v:text name="b_grants" null-value="--''" value="--self.v_grants" xhtml_class="textbox" xhtml_size="60" xhtml_title="User names must be comma delimited!" />
-                      <input type="button" value="Select" onClick="javascript: windowShow('/ods/users_select.vspx?form=F1&mode=u&dst=m&params=b_grants:s1;',520)" class="button" />
-                  <input type="button" value="Clear" onClick="javascript: document.F1.elements['b_grants'].value = ''" class="button" />
-                </vm:if>
-                <?vsp self.viewField (self.v_grants); ?>
-              </td>
-            </tr>
-            <tr>
               <script type="text/javascript">
                 function suggestTags ()
                 {
@@ -1376,18 +1346,62 @@
           </table>
         </div>
             <div id="a_content_1" class="tabContent" style="display: none;">
+              <fieldset>
+                <legend><b>ODS users</b></legend>
+                <table class="form-body" cellspacing="0">
+                  <tr>
+                    <td style="width: 95%; background-color: white;">
+                      <table id="f_tbl" width="100%" cellspacing="0">
+                        <thead class="sortHeader">
+                          <tr>
+                            <th width="100%">Value</th>
+                            <th width="50px">Action</th>
+                          </tr>
+                        </thead>
+                  		  <![CDATA[
+                  		    <script type="text/javascript">
+                          <?vsp
+                            declare N, L integer;
+                            declare acl_values any;
+
+                            L := 0;
+                            acl_values := split_and_decode (self.v_grants, 0, '\0\0,');
+                            for (N := 0; N < length (acl_values); N := N + 1)
+                            {
+                              L := 1;
+                              if (self.v_form <> 'Bookmark/View')
+                              {
+                                http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("f", null, {fld_1: {mode: 1, value: "%s", form: "F1"}});});', acl_values[N], 'U'));
+                              } else {
+                                http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("f", {fld_1: {value: "%s"}});});', acl_values[N]));
+                              }
+                            }
+                          ?>
+                  		    </script>
+                  		  ]]>
+                        <tr id="f_tr_no" style="display: <?V case when L=0 then '' else 'none' end ?>;"><td colspan="<?V case when self.v_form = 'Bookmark/View' then 1 else 2 end ?>"><b>No Shares</b></td></tr>
+                  		</table>
+                  	</td>
+                    <vm:if test="self.v_form <> 'Bookmark/View'">
+                      <td valign="top" nowrap="nowrap">
+                        <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('f', null, {fld_1: {mode: 1, form: 'F1'}});" />
+                      </td>
+                    </vm:if>
+                  </tr>
+                </table>
+              </fieldset>
+              <fieldset>
+                <legend><b>WebID users</b></legend>
               <table class="form-body" cellspacing="0">
                 <tr>
-                  <td style="width: 90%; background-color: white;">
+                  <td style="width: 95%; background-color: white;">
                     <table id="s_tbl" width="100%" cellspacing="0">
                       <thead class="sortHeader">
                         <tr>
                           <th width="15%">Type</th>
                           <th>Value</th>
-                          <th width="80px">Access</th>
-                          <vm:if test="self.v_form <> 'Bookmark/View'">
+                          <th width="1%" nowrap="nowrap">ACL: (R)ead, (W)rite</th>
                             <th width="50px">Action</th>
-                          </vm:if>
                         </tr>
                       </thead>
                 		  <![CDATA[
@@ -1396,26 +1410,23 @@
                           declare N, L integer;
                           declare acl, aType, aAccess any;
 
-                          aType := vector ('URI', 'Person URI', 'Property', 'RDF Property', 'SPARQL', 'SPARQL Expression');
-                          aAccess := vector ('G', 'Grant', 'R', 'Revoke');
-
                         L := 0;
                         acl := (select WAI_ACL from DB.DBA.WA_INSTANCE where WAI_ID = self.domain_id);
                         acl := case when isnull (acl) then vector () else deserialize (acl) end;
-                        for (N := 1; N < length (acl); N := N + 1)
+                          for (N := 0; N < length (acl); N := N + 1)
                         {
                           L := L + 1;
-                            http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {value: "%s"}, fld_2: {value: "%s"}, fld_3: {value: "%s"}, fld_4: {value: "%s"}});});', get_keyword (acl[N][0], aType), acl[N][1], get_keyword (acl[N][2], aAccess), 'Inherited'));
+                            http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}, fld_4: {value: "Inherited"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
                         }
                         acl := deserialize (self.v_acl);
-                        for (N := 1; N < length (acl); N := N + 1)
+                          for (N := 0; N < length (acl); N := N + 1)
                         {
                           L := L + 1;
                             if (self.v_form <> 'Bookmark/View')
                             {
-                              http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("s", null, {fld_1: {mode: 30, value: "%s"}, fld_2: {mode: 0, value: "%s"}, fld_3: {mode: 31, value: "%s"}});});', acl[N][0], acl[N][1], acl[N][2]));
+                              http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("s", null, {fld_1: {mode: 50, value: "%s", onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: "F1", tdCssText: "white-space: nowrap;", className: "_validate_ _webid_", value: "%s", readOnly: %s, imgCssText: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', acl[N][2], acl[N][1], case when acl[N][2] = 'public' then 'true' else 'false' end, case when acl[N][2] = 'public' then 'display: none;' else '' end, acl[N][3], acl[N][4], acl[N][5]));
                             } else {
-                              http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {value: "%s"}, fld_2: {value: "%s"}, fld_3: {value: "%s"}, fld_4: {value: "%s"}});});', get_keyword (acl[N][0], aType), acl[N][1], get_keyword (acl[N][2], aAccess), ''));
+                              http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
                             }
                           }
                      		    ?>
@@ -1426,16 +1437,19 @@
                   </td>
                   <vm:if test="self.v_form <> 'Bookmark/View'">
                     <td valign="top" nowrap="nowrap">
-                      <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 30}, fld_2: {mode: 0}, fld_3: {mode: 31}});" />
+                      <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 50, onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: 'F1', tdCssText: 'white-space: nowrap;', className: '_validate_ _webid_'}, fld_3: {mode: 52, value: [1, 0, 0], tdCssText: 'width: 1%; white-space: nowrap; text-align: center;'}});" />
                     </td>
                   </vm:if>
                 </tr>
               </table>
+              </fieldset>
             </div>
           </div>
         </div>
-        <div class="new-form-footer">
-          <input type="button" title="Save" value="Save" onclick="javascript: BMK.formPost('<?V self.v_form ?>'); return false;"/>
+        <div class="form-footer">
+          <vm:if test="self.v_form <> 'Bookmark/View'">
+          <input type="button" title="Save" value="Save" onclick="javascript: if (validateInputs(this)) {BMK.formPost('<?V self.v_form ?>');}; return false;"/>
+          </vm:if>
           <input type="button" title="Cancel" value="Cancel" onclick="javascript: BMK.formClose(); return false;"/>
         </div>
       </v:template>
@@ -1475,9 +1489,9 @@
           ]]>
         </v:before-data-bind>
         <?vsp
-          http (sprintf ('<input type="hidden" name="f_id" id="sid" value="%d" />', self.v_id));
+          http (sprintf ('<input type="hidden" name="f_id" id="f_id" value="%d" />', self.v_id));
         ?>
-        <div class="new-form-header">
+        <div class="form-header">
           <v:label format="%s" value="--self.v_form"/>
         </div>
         <div class="new-form-body">
@@ -1540,13 +1554,13 @@
               </th>
               <td>
                 <v:text name="f_grants" null-value="--''" value="--self.v_grants" xhtml_class="textbox" xhtml_size="60" xhtml_title="User names must be comma delimited!" />
-                <input type="button" value="Select" onClick="javascript: windowShow('/ods/users_select.vspx?form=F1&mode=u&dst=m&params=f_grants:s1;',520)" class="button" />
+                <input type="button" value="Select" onClick="javascript: windowShow('/ods/users_select.vspx?form=F1&dst=mc&params=f_grants:s1;')" class="button" />
                 <input type="button" value="Clear" onClick="javascript: document.F1.elements['f_grants'].value = ''" class="button" />
               </td>
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <input type="button" title="Save" value="Save" onclick="javascript: BMK.formPost('<?V self.v_form ?>'); return false;"/>
           <input type="button" title="Cancel" value="Cancel" onclick="javascript: BMK.formClose(); return false;"/>
         </div>
@@ -1599,9 +1613,9 @@
           ]]>
         </v:before-data-bind>
         <?vsp
-          http (sprintf ('<input type="hidden" name="s_id" id="sid" value="%d" />', self.v_id));
+          http (sprintf ('<input type="hidden" name="s_id" id="s_id" value="%d" />', self.v_id));
         ?>
-        <div class="new-form-header">
+        <div class="form-header">
           <v:label format="%s" value="--self.v_form"/>
         </div>
         <div class="new-form-body">
@@ -1670,20 +1684,20 @@
               </th>
               <td>
                 <v:text name="s_grants" null-value="--''" value="--self.v_grants" xhtml_class="textbox" xhtml_size="60" xhtml_title="User names must be comma delimited!" />
-                <input type="button" value="Select" onClick="javascript: windowShow('/ods/users_select.vspx?form=F1&mode=s&dst=m&params=s_grants:s1;',520)" class="button" />
+                <input type="button" value="Select" onClick="javascript: windowShow('/ods/users_select.vspx?form=F1&mode=s_bmk&dst=mc&params=s_grants:s1;')" class="button" />
               </td>
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <input type="button" title="Save" value="Save" onclick="javascript: BMK.formPost('<?V self.v_form ?>'); return false;"/>
           <input type="button" title="Cancel" value="Cancel" onclick="javascript: BMK.formClose(); return false;"/>
         </div>
       </v:template>
 
       <v:template type="simple" enabled="-- case when self.v_form = 'tags' then 1 else 0 end">
-        <div class="new-form-header">
-          <v:label format="%s" value="Tags"/>
+        <div class="form-header">
+          Tags
         </div>
         <div class="new-form-body">
           <table cellspacing="0">
@@ -1698,7 +1712,7 @@
             <?vsp self.myTags ('b_tags'); ?>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <input type="button" title="Tag" value="Tag" onclick="javascript: BMK.formPost('<?V self.v_form ?>'); return false;"/>
           <input type="button" title="Cancel" value="Cancel" onclick="javascript: BMK.formClose(); return false;"/>
         </div>
@@ -1711,8 +1725,8 @@
             self.vm_folder_name := get_keyword ('m_folder_name', self.vc_page.vc_event.ve_params, '');
           ]]>
         </v:before-data-bind>
-        <div class="new-form-header">
-          <v:label format="%s" value="Move"/>
+        <div class="form-header">
+          Move
         </div>
         <div class="new-form-body">
           <table cellspacing="0">
@@ -1759,7 +1773,7 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <input type="button" title="Move" value="Move" onclick="javascript: BMK.formPost('move'); return false;"/>
           <input type="button" title="Cancel" value="Cancel" onclick="javascript: BMK.formClose(); return false;"/>
         </div>
@@ -1771,7 +1785,7 @@
             self.vs_share := get_keyword ('share', self.vc_page.vc_event.ve_params, self.vs_share);
           ]]>
         </v:before-data-bind>
-        <div class="new-form-header">
+        <div class="form-header">
           <v:label value="--''">
             <v:after-data-bind>
               <![CDATA[
@@ -1813,7 +1827,7 @@
               </th>
               <td>
                 <v:text name="s_share" null-value="--''" value="--self.vs_share" xhtml_class="textbox" xhtml_size="60" xhtml_title="User names must be comma delimited!" />
-                <input type="button" value="Select" onClick="javascript: windowShow('/ods/users_select.vspx?form=F1&mode=u&dst=m&params=s_share:s1;',520)" class="button" />
+                <input type="button" value="Select" onClick="javascript: windowShow('/ods/users_select.vspx?form=F1&dst=mc&params=s_share:s1;')" class="button" />
                 <input type="button" value="Clear" onClick="javascript: document.F1.elements['s_share'].value = ''" class="button" />
               </td>
             </tr>
@@ -1826,7 +1840,7 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <input type="button" title="Share" value="Share" onclick="javascript: BMK.formPost('share'); return false;"/>
           <input type="button" title="Cancel" value="Cancel" onclick="javascript: BMK.formClose(); return false;"/>
         </div>
diff --git a/appsrc/ODS-Bookmark/www/gems.vsp b/appsrc/ODS-Bookmark/www/gems.vsp
index 6ccea9a..8055702 100644
--- a/appsrc/ODS-Bookmark/www/gems.vsp
+++ b/appsrc/ODS-Bookmark/www/gems.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: gems.vsp,v 1.1.2.1 2010/05/31 21:59:14 source Exp $
+--  $Id: gems.vsp,v 1.1.2.3 2010/10/07 13:24:04 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -35,30 +35,8 @@
     if (not _authorized)
     {
       _authorized := 1;
-      _authorizeVector := DB.DBA.vsp_auth_vec (http_request_header());
-      if (_authorizeVector = 0)
-      {
-        _authorized := 0;
-      } else {
-        if (get_keyword ('authtype', _authorizeVector) <> 'basic')
-        {
+      if (not ODS..ods_check_auth (_user, _domain_id, 'reader'))
           _authorized := 0;
-        } else {
-          _user := get_keyword ('username', _authorizeVector, '');
-          _password := get_keyword ('pass', _authorizeVector, '');
-          if (not DB.DBA.web_user_password_check (_user, _password))
-          {
-            _authorized := 0;
-          } else {
-            _user_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = _user);
-            _role := BMK.WA.access_role (_domain_id, _user_id);
-            if (_role not in ('admin', 'owner'))
-            {
-              _authorized := 0;
-            }
-          }
-        }
-      }
     }
     http_rewrite ();
     if (not _authorized)
@@ -69,9 +47,7 @@
     }
     else
     {
-      declare exit handler for sqlstate '*' {
-        return;
-      };
+      declare exit handler for sqlstate '*' { return;};
 
       _gems := get_keyword('type', params);
       if (_gems in ('Bookmark.rss', 'Bookmark.atom', 'Bookmark.rdf', 'Bookmark.comment', 'Bookmark.opml', 'Bookmark.ocs'))
diff --git a/appsrc/ODS-Bookmark/www/image/add_16.png b/appsrc/ODS-Bookmark/www/image/add_16.png
deleted file mode 100644
index ad76487..0000000
Binary files a/appsrc/ODS-Bookmark/www/image/add_16.png and /dev/null differ
diff --git a/appsrc/ODS-Bookmark/www/image/add_32.png b/appsrc/ODS-Bookmark/www/image/add_32.png
deleted file mode 100644
index cf85668..0000000
Binary files a/appsrc/ODS-Bookmark/www/image/add_32.png and /dev/null differ
diff --git a/appsrc/ODS-Bookmark/www/image/blogroll1.gif b/appsrc/ODS-Bookmark/www/image/blogroll1.gif
deleted file mode 100644
index e7124e7..0000000
Binary files a/appsrc/ODS-Bookmark/www/image/blogroll1.gif and /dev/null differ
diff --git a/appsrc/ODS-Bookmark/www/image/del_16.png b/appsrc/ODS-Bookmark/www/image/del_16.png
deleted file mode 100644
index abe8c4b..0000000
Binary files a/appsrc/ODS-Bookmark/www/image/del_16.png and /dev/null differ
diff --git a/appsrc/ODS-Bookmark/www/image/folder_16.png b/appsrc/ODS-Bookmark/www/image/folder_16.png
deleted file mode 100644
index 91951de..0000000
Binary files a/appsrc/ODS-Bookmark/www/image/folder_16.png and /dev/null differ
diff --git a/appsrc/ODS-Bookmark/www/image/folder_empty_16.png b/appsrc/ODS-Bookmark/www/image/folder_empty_16.png
deleted file mode 100644
index fc7a3bb..0000000
Binary files a/appsrc/ODS-Bookmark/www/image/folder_empty_16.png and /dev/null differ
diff --git a/appsrc/ODS-Bookmark/www/image/folder_open_16.png b/appsrc/ODS-Bookmark/www/image/folder_open_16.png
deleted file mode 100644
index 5227cac..0000000
Binary files a/appsrc/ODS-Bookmark/www/image/folder_open_16.png and /dev/null differ
diff --git a/appsrc/ODS-Bookmark/www/image/minus.gif b/appsrc/ODS-Bookmark/www/image/minus.gif
deleted file mode 100644
index e3dd648..0000000
Binary files a/appsrc/ODS-Bookmark/www/image/minus.gif and /dev/null differ
diff --git a/appsrc/ODS-Bookmark/www/image/plus.gif b/appsrc/ODS-Bookmark/www/image/plus.gif
deleted file mode 100644
index 2886456..0000000
Binary files a/appsrc/ODS-Bookmark/www/image/plus.gif and /dev/null differ
diff --git a/appsrc/ODS-Bookmark/www/image/rss.gif b/appsrc/ODS-Bookmark/www/image/rss.gif
deleted file mode 100644
index 4abadb4..0000000
Binary files a/appsrc/ODS-Bookmark/www/image/rss.gif and /dev/null differ
diff --git a/appsrc/ODS-Bookmark/www/image/rss091.gif b/appsrc/ODS-Bookmark/www/image/rss091.gif
deleted file mode 100644
index 4260e3b..0000000
Binary files a/appsrc/ODS-Bookmark/www/image/rss091.gif and /dev/null differ
diff --git a/appsrc/ODS-Bookmark/www/image/rss20.gif b/appsrc/ODS-Bookmark/www/image/rss20.gif
deleted file mode 100644
index a33d097..0000000
Binary files a/appsrc/ODS-Bookmark/www/image/rss20.gif and /dev/null differ
diff --git a/appsrc/ODS-Bookmark/www/js/bookmark.js b/appsrc/ODS-Bookmark/www/js/bookmark.js
index 6260e70..0c0ff78 100644
--- a/appsrc/ODS-Bookmark/www/js/bookmark.js
+++ b/appsrc/ODS-Bookmark/www/js/bookmark.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: bookmark.js,v 1.27.2.6 2010/07/09 14:37:00 source Exp $
+ *  $Id: bookmark.js,v 1.27.2.11 2010/11/19 16:49:52 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -20,10 +20,12 @@
  *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  *
  */
-function myA(obj) {
-  if (obj.href) {
-    document.location = obj.href + '?' + urlParam('sid') + urlParam('realm');
-    return false;
+function setFooter() {
+  if ($('pane_main')) {
+    var wDims = OAT.Dom.getViewport()
+    var hDims = OAT.Dom.getWH('FT')
+    var cPos = OAT.Dom.position('pane_main')
+    $('pane_main').style.height = (wDims[1] - hDims[1] - cPos[1] - 20) + 'px';
   }
 }
 
@@ -233,20 +235,6 @@ function enableElement (id, id_gray, flag, doc)
     o.style.display = mode;
 }
 
-function showCell (cell)
-{
-  var c = getObject (cell);
-  if ((c) && (c.style.display == "none"))
-    c.style.display = "";
-}
-
-function hideCell(cell)
-{
-  var c = getObject(cell);
-  if ((c) && (c.style.display != "none"))
-    c.style.display = "none";
-}
-
 function selectAllCheckboxes (obj, prefix) {
   var objForm = obj.form;
   for (var i = 0; i < objForm.elements.length; i++) {
@@ -305,16 +293,14 @@ function updateGrants(objName)
 }
 
 function coloriseTable(id) {
-  if (document.getElementsByTagName) {
-    var table = document.getElementById(id);
-    if (table != null) {
+  var table = $(id);
+  if (table) {
       var rows = table.getElementsByTagName("tr");
       for (i = 0; i < rows.length; i++) {
         rows[i].className = rows[i].className + " tr_" + (i % 2);;
       }
     }
   }
-}
 
 function coloriseRow(obj, checked) {
   obj.className = (obj.className).replace('tr_select', '');
@@ -346,72 +332,11 @@ function clickNode2(obj) {
   }
 }
 
-function addOption (form, text_name, box_name) {
-  var box = form.elements[box_name];
-  if (box) {
-    var text = form.elements[text_name];
-    if (text) {
-      text.value = BMK.trim(text.value);
-      if (text.value == '')
-        return;
-    	for (var i=0; i<box.options.length; i++)
-		    if (text.value == box.options[i].value)
-		      return;
-	    box.options[box.options.length] = new Option(text.value, text.value, false, true);
-	    sortSelect(box);
-	    text.value = '';
-	  }
-	}
-}
-
-function deleteOption (form, box_name) {
-  var box = form.elements[box_name];
-  if (box)
-	  box.options[box.selectedIndex] = null;
-}
-
-function composeOptions (form, box_name, text_name) {
-  var box = form.elements[box_name];
-  if (box) {
-    var text = form.elements[text_name];
-    if (text) {
-		  text.value = '';
-    	for (var i=0; i<box.options.length; i++)
-    	  if (text.value == '')
-		      text.value = box.options[i].value;
-		    else
-		      text.value = text.value + '\n' + box.options[i].value;
-	  }
-	}
-}
-
 function showTag(tag) {
   createHidden2(parent.document, 'F1', 'tag', tag);
   parent.document.forms['F1'].submit();
 }
 
-// sortSelect(select_object)
-//   Pass this function a SELECT object and the options will be sorted
-//   by their text (display) values
-function sortSelect(box) {
-	var o = new Array();
-	for (var i=0; i<box.options.length; i++)
-		o[o.length] = new Option( box.options[i].text, box.options[i].value, box.options[i].defaultSelected, box.options[i].selected) ;
-
-	if (o.length==0)
-	  return;
-
-	o = o.sort(function(a,b) {
-                      			if ((a.text+"") < (b.text+"")) { return -1; }
-                      			if ((a.text+"") > (b.text+"")) { return 1; }
-                      			return 0;
-			                     }
-		        );
-
-	for (var i=0; i<o.length; i++)
-		box.options[i] = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
-}
-
 function showTab(tabs, tabsCount, tabNo)
 {
   if ($(tabs))
@@ -440,97 +365,149 @@ function showTab(tabs, tabsCount, tabNo)
 
 function windowShow(sPage, width, height)
 {
-  if (width == null)
-    width = 500;
-  if (height == null)
+  if (!width)
+    width = 700;
+  if (!height)
     height = 420;
-  sPage = sPage + '&sid=' + document.forms[0].elements['sid'].value + '&realm=' + document.forms[0].elements['realm'].value;
+  sPage += urlParam("sid")+urlParam("realm");
   win = window.open(sPage, null, "width="+width+",height="+height+", top=100, left=100, scrollbars=yes, resize=yes, menubar=no");
   win.window.focus();
 }
 
-function rowSelect(obj)
+function rowSelected(tr)
+{
+  var cbInput;
+  var s1Input;
+  var s2Input;
+  var inputs = tr.getElementsByTagName('input');
+  for (var i = 0; i < inputs.length; i++) {
+    if (inputs[i].name == 'cb_item')
+      cbInput = inputs[i];
+    if (inputs[i].name == 's1_item')
+      s1Input = inputs[i];
+    if (inputs[i].name == 's2_item')
+      s2Input = inputs[i];
+  }
+  if (cbInput) {
+    cbInput.checked = !cbInput.checked;
+    updateChecked(cbInput, cbInput.name);
+  }
+  else if (s1Input)
 {
+    commitChecked(s1Input.value);
+  }
+}
+
+function commitChecked(s1Value, s2Value)
+{
+  var srcForm = window.document.F1;
+  var dstForm = window.opener.document.F1;
+
   var submitMode = false;
-  if (window.document.F1.elements['src'])
-    if (window.document.F1.elements['src'].value.indexOf('s') != -1)
+  if (srcForm.elements['src'] && (srcForm.elements['src'].value.indexOf('s') != -1)) {
       submitMode = true;
-  if (submitMode)
-    if (window.opener.document.F1)
-      if (window.opener.document.F1.elements['submitting'])
+    if (dstForm && dstForm.elements['submitting'])
         return false;
+  }
   var closeMode = true;
-  if (window.document.F1.elements['dst'])
-    if (window.document.F1.elements['dst'].value.indexOf('c') == -1)
-      closeMode = false;
   var singleMode = true;
-  if (window.document.F1.elements['dst'])
-    if (window.document.F1.elements['dst'].value.indexOf('s') == -1)
+  if (srcForm.elements['dst']) {
+    if (srcForm.elements['dst'].value.indexOf('c') == -1)
+      closeMode = false;
+    if (srcForm.elements['dst'].value.indexOf('s') == -1)
       singleMode = false;
-
-  var s2 = (obj.name).replace('b1', 's2');
-  var s1 = (obj.name).replace('b1', 's1');
+  }
 
   var myRe = /^(\w+):(\w+);(.*)?/;
-  var params = window.document.forms['F1'].elements['params'].value;
+  var params = srcForm.elements['params'].value;
   var myArray;
+  if (dstForm) {
   while(true) {
     myArray = myRe.exec(params);
     if (myArray == undefined)
       break;
-    if (myArray.length > 2)
-      if (window.opener.document.F1)
-        if (window.opener.document.F1.elements[myArray[1]]) {
+      if (myArray.length > 2) {
+        var fld = dstForm.elements[myArray[1]];
+        if (fld) {
           if (myArray[2] == 's1')
-            if (window.opener.document.F1.elements[myArray[1]])
-              rowSelectValue(window.opener.document.F1.elements[myArray[1]], window.document.F1.elements[s1], singleMode, submitMode);
+            rowSelectValue(fld, s1Value, singleMode);
           if (myArray[2] == 's2')
-            if (window.opener.document.F1.elements[myArray[1]])
-              rowSelectValue(window.opener.document.F1.elements[myArray[1]], window.document.F1.elements[s2], singleMode, submitMode);
+            rowSelectValue(fld, s2Value, singleMode);
+        }
         }
     if (myArray.length < 4)
       break;
     params = '' + myArray[3];
   }
+  }
   if (submitMode) {
     window.opener.createHidden('F1', 'submitting', 'yes');
-    window.opener.document.F1.submit();
+    dstForm.submit();
   }
   if (closeMode)
     window.close();
 }
 
-function rowSelectValue(dstField, srcField, singleMode)
+function updateChecked (obj, objName, event)
 {
-  if (singleMode)
+  if (event)
+	  event.cancelBubble = true;
+  var objForm = obj.form;
+  coloriseRow(getParent(obj, 'tr'), obj.checked);
+
+  var s1Value = objForm.s1.value;
+  s1Value = BMK.trim(s1Value);
+  s1Value = BMK.trim(s1Value, ',');
+  s1Value = BMK.trim(s1Value);
+  s1Value = s1Value + ',';
+  for (var i = 0; i < objForm.elements.length; i = i + 1) {
+    var obj = objForm.elements[i];
+    if (obj != null && obj.type == "checkbox" && obj.name == objName) {
+      if (obj.checked) {
+        if (s1Value.indexOf(obj.value+',') == -1)
+          s1Value = s1Value + obj.value + ',';
+      } else {
+        s1Value = (s1Value).replace(obj.value+',', '');
+      }
+    }
+  }
+  objForm.s1.value = BMK.trim(s1Value, ',');
+}
+
+function addChecked(srcForm, checkboxName, selectionMsq)
   {
-    dstField.value = srcField.value;
+  if (!anySelected (srcForm, checkboxName, selectionMsq, 'confirm'))
+    return false;
+
+  return commitChecked(srcForm.s1.value, srcForm.s2.value);
+}
+
+function rowSelectValue(dstField, srcValue, singleMode) {
+	if (singleMode) {
+		dstField.value = srcValue;
   } else {
     dstField.value = BMK.trim(dstField.value);
     dstField.value = BMK.trim(dstField.value, ',');
     dstField.value = BMK.trim(dstField.value);
-    if (dstField.value.indexOf(srcField.value) == -1)
-    {
-      if (dstField.value == '')
-      {
-        dstField.value = srcField.value;
+		if (dstField.value.indexOf(srcValue) == -1) {
+			if (dstField.value == '') {
+				dstField.value = srcValue;
       } else {
-        dstField.value = dstField.value + ', ' + srcField.value;
+				dstField.value = dstField.value + ',' + srcValue;
       }
     }
   }
 }
 
 // Hiddens functions
-function createHidden(frm_name, fld_name, fld_value) {
-  var hidden;
-
-  createHidden2(document, frm_name, fld_name, fld_value);
+function createHidden(frm_name, fld_name, fld_value)
+{
+  return createHidden2(document, frm_name, fld_name, fld_value);
 }
 
-function createHidden2(doc, frm_name, fld_name, fld_value) {
+function createHidden2(doc, frm_name, fld_name, fld_value)
+{
   var hidden;
-
   if (doc.forms[frm_name]) {
     hidden = doc.forms[frm_name].elements[fld_name];
     if (hidden == null) {
@@ -542,6 +519,7 @@ function createHidden2(doc, frm_name, fld_name, fld_value) {
     }
     hidden.value = fld_value;
   }
+  return hidden;
 }
 
 function changeExportName(fld_name, from, to) {
@@ -550,78 +528,6 @@ function changeExportName(fld_name, from, to) {
     obj.value = (obj.value).replace(from, to);
 }
 
-function updateChecked (obj, objName)
-{
-  var objForm = obj.form;
-  coloriseRow(getParent(obj, 'tr'), obj.checked);
-  objForm.s1.value = BMK.trim(objForm.s1.value);
-  objForm.s1.value = BMK.trim(objForm.s1.value, ',');
-  objForm.s1.value = BMK.trim(objForm.s1.value);
-  objForm.s1.value = objForm.s1.value + ',';
-  for (var i = 0; i < objForm.elements.length; i = i + 1)
-  {
-    var obj = objForm.elements[i];
-    if (obj != null && obj.type == "checkbox" && obj.name == objName)
-    {
-      if (obj.checked)
-      {
-        if (objForm.s1.value.indexOf(obj.value+',') == -1)
-          objForm.s1.value = objForm.s1.value + obj.value+',';
-      } else {
-        objForm.s1.value = (objForm.s1.value).replace(obj.value+',', '');
-      }
-    }
-  }
-  objForm.s1.value = BMK.trim(objForm.s1.value, ',');
-}
-
-function addChecked (form, txt, selectionMsq)
-{
-  if (!anySelected (form, txt, selectionMsq, 'confirm'))
-    return;
-
-  var submitMode = false;
-  if (window.document.F1.elements['src'])
-    if (window.document.F1.elements['src'].value.indexOf('s') != -1)
-      submitMode = true;
-  if (submitMode)
-    if (window.opener.document.F1)
-      if (window.opener.document.F1.elements['submitting'])
-        return false;
-  var singleMode = true;
-  if (window.document.F1.elements['dst'])
-    if (window.document.F1.elements['dst'].value.indexOf('s') == -1)
-      singleMode = false;
-
-  var s1 = 's1';
-  var s2 = 's2';
-
-  var myRe = /^(\w+):(\w+);(.*)?/;
-  var params = window.document.forms['F1'].elements['params'].value;
-  var myArray;
-  while(true) {
-    myArray = myRe.exec(params);
-    if (myArray == undefined)
-      break;
-    if (myArray.length > 2)
-      if (window.opener.document.F1)
-        if (window.opener.document.F1.elements[myArray[1]]) {
-          if (myArray[2] == 's1')
-            if (window.opener.document.F1.elements[myArray[1]])
-              rowSelectValue(window.opener.document.F1.elements[myArray[1]], window.document.F1.elements[s1], singleMode, submitMode);
-          if (myArray[2] == 's2')
-            if (window.opener.document.F1.elements[myArray[1]])
-              rowSelectValue(window.opener.document.F1.elements[myArray[1]], window.document.F1.elements[s2], singleMode, submitMode);
-        }
-    if (myArray.length < 4)
-      break;
-    params = '' + myArray[3];
-  }
-  if (submitMode)
-    window.opener.document.F1.submit();
-  window.close();
-}
-
 function addTag(tag, objName)
 {
   var obj = document.F1.elements[objName];
@@ -703,126 +609,56 @@ function urlParam (fldName)
   return '';
 }
 
-function showObject(id)
-{
-  var o = document.getElementById(id);
-  if (o)
-  {
-    o.style.display="";
-    o.visible = true;
-  }
-}
-
-function hideObject(id)
-{
-  var o = document.getElementById(id);
-  if (o != null)
-  {
-    o.style.display="none";
-    o.visible = false;
-  }
-}
-
-function initRequest ()
-{
-  var xmlhttp = null;
-  try {
-    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
-  } catch (e) { }
-
-  if (xmlhttp == null) {
-    try {
-      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
-    } catch (e) { }
-  }
-
-  // Gecko / Mozilla / Firefox
-  if (xmlhttp == null)
-    xmlhttp = new XMLHttpRequest();
-
-  return xmlhttp;
-}
-
-var timer = null;
+var progressTimer = null;
 var progressID = null;
 var progressMax = null;
-var progressStop = null;
-
-function resetState()
-{
-  var xmlhttp = initRequest();
-  var URL = 'ajax.vsp?a=import&sa=reset';
-  xmlhttp.open("POST", URL + urlParam("sid") + urlParam("realm"), false);
-  xmlhttp.setRequestHeader("Pragma", "no-cache");
-  xmlhttp.send(null);
-  try {
-    progressID = xmlhttp.responseXML.getElementsByTagName("id")[0].firstChild.nodeValue;
-  } catch (e) { }
-}
+var progressSize = 40;
+var progressInc = 100 / progressSize;
 
 function stopState()
 {
-  timer = null;
-
-  var xmlhttp = initRequest();
-  var URL = 'ajax.vsp?a=import&sa=stop';
-  xmlhttp.open("POST", URL+"&id="+progressID+urlParam("sid")+urlParam("realm"), false);
-  xmlhttp.setRequestHeader("Pragma", "no-cache");
-  xmlhttp.send(null);
+  progressTimer = null;
+  OAT.AJAX.POST('ajax.vsp', "a=load&sa=stop&id="+progressID+urlParam("sid")+urlParam("realm"), x, {async: false});
 }
 
 function initState ()
 {
-  // reset state first
-  resetState();
-
-  // init state
-  var xmlhttp = initRequest();
-  var URL = 'ajax.vsp';
-  xmlhttp.open("POST", URL, false);
-  xmlhttp.setRequestHeader("Pragma", "no-cache");
-  xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
-  xmlhttp.send("a=import&sa=init&id="+progressID+urlParam("sid")+urlParam("realm")+urlParam("folder_id")+urlParam("folder_name")+urlParam("tags"));
+  progressTimer = null;
+  var x = function (data) {
+    try {
+      var xml = OAT.Xml.createXmlDoc(data);
+      progressID = OAT.Xml.textValue(xml.getElementsByTagName('id')[0]);
+    } catch (e) {}
 
   createProgressBar();
-  timer = setTimeout("checkState()", 1000);
+    progressTimer = setTimeout("checkState()", 500);
 
   document.forms['F1'].action = 'bookmarks.vspx';
 }
+  OAT.AJAX.POST('ajax.vsp', "a=load&sa=init"+urlParam("sid")+urlParam("realm")+urlParam("folder_id")+urlParam("folder_name")+urlParam("tags"), x, {async: false});
+}
 
 function checkState()
 {
-  var xmlhttp = initRequest();
-  var URL = 'ajax.vsp?a=import&sa=state';
-  xmlhttp.open("POST", URL+"&id="+progressID+urlParam("sid")+urlParam("realm"), true);
-  xmlhttp.onreadystatechange = function() {
-    if (xmlhttp.readyState == 4) {
+  var x = function (data) {
       var progressIndex;
-
-      // progressIndex
       try {
-        progressIndex = xmlhttp.responseXML.getElementsByTagName("index")[0].firstChild.nodeValue;
+      var xml = OAT.Xml.createXmlDoc(data);
+      progressIndex = OAT.Xml.textValue(xml.getElementsByTagName('index')[0]);
       } catch (e) { }
 
-      if (timer != null)
         showProgress (progressIndex);
-      if ((progressIndex != null) && (progressIndex != progressMax) && (timer != null))
-      {
+
+    if ((progressIndex != null) && (progressIndex != progressMax)) {
         setTimeout("checkState()", 500);
       } else {
-        timer = null;
+      progressTimer = null;
         $('btn_Stop').click();
       }
     }
-  }
-  xmlhttp.setRequestHeader("Pragma", "no-cache");
-  xmlhttp.send("");
+  OAT.AJAX.POST('ajax.vsp', "a=load&sa=state&id="+progressID+urlParam("sid")+urlParam("realm"), x);
 }
 
-var size = 40;
-var increment = 100 / size;
-
-// create the progress bar
 function createProgressBar()
 {
   progressMax = getObject('progressMax').innerHTML;
@@ -830,12 +666,12 @@ function createProgressBar()
   var centerCellName;
   var tableText = "";
   var tdText = "";
-  for (x = 0; x < size; x++) {
+  for (x = 0; x < progressSize; x++) {
     if (progressMax != null) {
-	    if (x == (size/2))
+      if (x == (progressSize/2))
 	      centerCellName = "progress_" + x;
 	  }
-    tableText += "<td id=\"progress_" + x + "\" width=\"" + increment + "%\" height=\"20\" bgcolor=\"blue\" />";
+    tableText += "<td id=\"progress_" + x + "\" width=\"" + progressInc + "%\" height=\"20\" bgcolor=\"blue\" />";
   }
   var idiv = window.document.getElementById("progressText");
   if (idiv)
@@ -846,7 +682,6 @@ function createProgressBar()
   centerCell = window.document.getElementById(centerCellName);
 }
 
-// show the current percentage
 function showProgress (progressIndex)
 {
   if (!progressMax)
@@ -869,10 +704,10 @@ function showProgress (progressIndex)
     percentageText = percentage;
   }
   centerCell.innerHTML = "<font color=\"white\">" + percentageText + "%</font>";
-  for (x = 0; x < size; x++)
+  for (x = 0; x < progressSize; x++)
   {
     var cell = window.document.getElementById("progress_" + x);
-    if ((cell) && (percentage/x < increment))
+    if ((cell) && (percentage/x < progressInc))
     {
       cell.style.backgroundColor = "blue";
     } else {
@@ -894,9 +729,7 @@ function readBookmark (id)
 
 function davBrowse (fld)
 {
-  var options = { mode: 'browser',
-                  onConfirmClick: function(path, fname) {$(fld).value = path + fname;}
-                };
+  var options = {mode: 'browser', onConfirmClick: function(path, fname) {$(fld).value = path + fname;}};
   OAT.WebDav.open(options);
 }
 
@@ -936,12 +769,9 @@ function destinationChange(obj, actions)
 }
 
 var BMK = new Object();
-
 BMK.trim = function (sString, sChar)
 {
-
-  if (sString)
-  {
+  if (sString) {
     if (sChar == null)
     {
       sChar = ' ';
@@ -1438,8 +1268,7 @@ BMK.loadItems = function(nodeID, nodePath)
   pane.innerHTML = '';
   var URL = 'forms.vspx?sa=browse&node='+encodeURIComponent(nodeID)+'&path='+encodeURIComponent(nodePath)+BMK.sessionParams();
   var v = $('nodeItem');
-  if (v && (v.value != ''))
-  {
+  if (v && (v.value != '')) {
     URL += '&item=' + v.value;
     v.value = '';
   }
@@ -1467,20 +1296,16 @@ BMK.formParams = function (doc)
   if (!doc) {doc = document;}
   var S = '';
   var o = doc.forms[0].elements;
-  for (var i = 0; i < o.length; i++)
-  {
-    if (o[i])
-    {
-      if ((o[i].type == "checkbox" && o[i].checked) || (o[i].type != "checkbox"))
-      {
+  for (var i = 0; i < o.length; i++) {
+    if (!o[i] || !o[i].name)
+      continue;
+
+    if ((o[i].type == "checkbox" && o[i].checked) || (o[i].type != "checkbox")) {
         var n = o[i].name;
         if ((n != '') && (n.indexOf('page_') != 0) && (n.indexOf('__') != 0))
-        {
           S += '&' + n + '=' + encodeURIComponent(o[i].value);
         }
       }
-    }
-  }
   return S;
 }
 
@@ -1593,59 +1418,3 @@ BMK.aboutDialog = function ()
   }
   OAT.AJAX.POST("ajax.vsp", "a=about", x, {type:OAT.AJAX.TYPE_TEXT, onstart:function(){}, onerror:function(){}});
 }
-
-BMK.validateError = function (fld, msg)
-{
-  alert(msg);
-  setTimeout(function(){fld.focus();}, 1);
-  return false;
-}
-
-BMK.validateMail = function (fld)
-{
-  if ((fld.value.length == 0) || (fld.value.length > 40))
-    return BMK.validateError(fld, 'E-mail address cannot be empty or longer then 40 chars');
-
-  var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
-  if (!regex.test(fld.value))
-    return BMK.validateError(fld, 'Invalid E-mail address');
-
-  return true;
-}
-
-BMK.validateURL = function (fld)
-{
-  var regex = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
-  if (!regex.test(fld.value))
-    return BMK.validateError(fld, 'Invalid URL address');
-
-  return true;
-}
-
-BMK.validateField = function (fld)
-{
-  if ((fld.value.length == 0) && OAT.Dom.isClass(fld, '_canEmpty_'))
-    return true;
-  if (OAT.Dom.isClass(fld, '_mail_'))
-    return BMK.validateMail(fld);
-  if (OAT.Dom.isClass(fld, '_url_'))
-    return BMK.validateURL(fld);
-  return true;
-}
-
-BMK.validateInputs = function (fld)
-{
-  var retValue = true;
-  var form = fld.form;
-  for (i = 0; i < form.elements.length; i++)
-  {
-    var fld = form.elements[i];
-    if (OAT.Dom.isClass(fld, '_validate_'))
-    {
-      retValue = BMK.validateField(fld);
-      if (!retValue)
-        return retValue;
-    }
-  }
-  return retValue;
-}
diff --git a/appsrc/ODS-Bookmark/www/message.vspx b/appsrc/ODS-Bookmark/www/message.vspx
index b7a506b..f6d68a6 100644
--- a/appsrc/ODS-Bookmark/www/message.vspx
+++ b/appsrc/ODS-Bookmark/www/message.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: message.vspx,v 1.1 2008/10/14 10:57:29 source Exp $
+ -  $Id: message.vspx,v 1.1.2.1 2010/09/20 10:14:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Bookmark/www/search.vspx b/appsrc/ODS-Bookmark/www/search.vspx
index 53f4adb..d565411 100644
--- a/appsrc/ODS-Bookmark/www/search.vspx
+++ b/appsrc/ODS-Bookmark/www/search.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: search.vspx,v 1.30.2.7 2010/07/09 14:37:00 source Exp $
+ -  $Id: search.vspx,v 1.30.2.11 2010/11/19 16:49:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -81,11 +81,8 @@
       self.v_updatedAfter := trim (self.v_updatedAfter);
       self.v_updatedBefore := trim (self.v_updatedBefore);
 
-      if (not (self.account_role in ('public', 'guest')))
-      {
       self.v_own := self.f_own.ufl_selected;
       self.v_shared := self.f_shared.ufl_selected;
-      }
     ]]>
   </v:method>
 
@@ -156,12 +153,12 @@
       declare sql, sqlParams, state, msg, meta, result, maxRows any;
 
       state := '00000';
-      sql := 'select distinct <MAX> rs.* from BMK.WA.shared_sql (rs0, rs1, rs2, rs3)(_TYPE integer, _ID integer, _NODE varchar, _NAME varchar, _URI varchar, _VISITED datetime, _UPDATED datetime, _CREATED datetime, _FOLDER_ID integer, _FOLDER_NAME varchar, _GRANT_ID integer) rs where rs0 = ? and rs1 = ? and rs2 = ? and rs3 = ?';
+      sql := 'select distinct <MAX> rs.* from BMK.WA.shared_sql (rs0, rs1, rs2, rs3, rs4)(_TYPE integer, _ID integer, _NODE varchar, _NAME varchar, _URI varchar, _VISITED datetime, _UPDATED datetime, _CREATED datetime, _FOLDER_ID integer, _FOLDER_NAME varchar, _GRANT_ID integer) rs where rs0 = ? and rs1 = ? and rs2 = ? and rs3 = ? and rs4 = ?';
         maxRows := self.v_max;
         if (maxRows <> '')
           maxRows := 'TOP ' || maxRows;
         sql := replace(sql, '<MAX>', maxRows);
-      sqlParams := vector (self.domain_id, self.account_id, data, self.v_max);
+      sqlParams := vector (self.domain_id, self.account_id, self.account_rights, data, self.v_max);
       sql := concat(sql, 'order by ', self.v_order, ' ', self.v_direction);
       exec(sql, state, msg, sqlParams, 0, meta, result);
       if (state = '00000')
@@ -269,7 +266,7 @@
       <v:variable name="chars" type="integer" default="60" />
 
       <v:variable name="v_tabNo" param-name="tabNo" type="varchar" default="1"/>
-      <v:variable name="v_mode" type="varchar" default="'simple'"/>
+      <v:variable name="v_mode" param-name="mode" type="varchar" default="'simple'" />
       <v:variable name="v_step" param-name="step" type="integer" default="0"/>
 
       <v:variable name="v_keywords" type="varchar" default="''" param-name="q" />
@@ -307,7 +304,7 @@
                 action := get_keyword ('action', params, '');
                 if (action = 'search')
                 {
-                  self.vc_redirect (BMK.WA.page_url (self.domain_id, sprintf ('search.vspx?q=%s&mode=%s&step=1', get_keyword ('keywords', params, ''), get_keyword ('mode', params, 'simple'))));
+                  self.vc_redirect (BMK.WA.utf2wide (BMK.WA.page_url (self.domain_id, sprintf ('search.vspx?q=%s&mode=%s&step=1', get_keyword ('keywords', params, ''), get_keyword ('mode', params, 'simple')))));
                   return;
                 }
 
@@ -350,12 +347,10 @@
           self.v_folder_id := cast (get_keyword ('f_folder', params, get_keyword ('folder', params, self.v_folder_id)) as integer);
 
           -- options
-          if (not (self.account_role in ('public', 'guest')))
-          {
           self.v_own := self.f_own.ufl_selected;
           self.v_shared := self.f_shared.ufl_selected;
             self.v_grants := trim (get_keyword ('f_grants', params, get_keyword ('grants', params, self.v_grants)));
-          }
+
           self.v_max := trim (get_keyword ('f_max', params, self.v_max));
           self.v_order := trim (get_keyword ('f_order', params, self.v_order));
           self.v_direction := trim (get_keyword ('f_direction', params, self.v_direction));
@@ -473,7 +468,7 @@
                             account_id := BMK.WA.domain_owner_id (domain_id);
                             uri := (control as vspx_row_template).te_rowset[4];
                             title := (control as vspx_row_template).te_rowset[3];
-                            title2 := BMK.WA.rdfa_value (sprintf ('%V', title), 'dc:title');
+                            title2 := BMK.WA.rdfa_value (sprintf ('%V', BMK.WA.utf2wide (title)), 'dc:title');
 
                             http (sprintf('<a id="bookmark_%d" href="%s" class="%s %s" title="Full window view of \'%s\'" about="%U">%s</a>', id, uri, 'app', self.linkClass(node), title, SIOC..bmk_post_iri(domain_id, id), title2));
                             
@@ -623,7 +618,6 @@
                     </a>
                   </td>
                 </tr>
-                <vm:if test="(self.account_role <> 'public') and (self.account_role <> 'shared')">
                   <tr>
                     <th/>
                     <td>
@@ -631,7 +625,6 @@
                       <b><vm:label for="f_own" value="Search in my own bookmarks"/></b>
                     </td>
                   </tr>
-                </vm:if>
                 <tr>
                   <th>
                     <vm:label for="f_folder" value="Search in folder"/>
@@ -640,7 +633,6 @@
                     <v:data-list name="f_folder" xhtml_id="f_folder" value="--self.v_folder_id" sql="select -1 as F_ID, 'Select folder ...' as F_PATH2, '' as F_PATH from WS.WS.SYS_DAV_USER where U_NAME = 'dav' union all select F_ID, BMK.WA.folder_path2(F_PATH) as F_PATH2, F_PATH from BMK.WA.FOLDER where F_DOMAIN_ID = self.domain_id order by F_PATH" key-column="F_ID" value-column="F_PATH2" xhtml_class="select"/>
                   </td>
                 </tr>
-                <vm:if test="(self.account_role <> 'public') and (self.account_role <> 'shared')">
                 <tr>
                   <th/>
                   <td>
@@ -654,10 +646,9 @@
                     </th>
                   <td>
                       <v:text name="f_grants" null-value="--''" value="--self.v_grants" xhtml_class="textbox" xhtml_size="60" xhtml_title="User names must be comma delimited!" />
-                      <input type="button" value="Select" onClick="javascript: windowShow('users.vspx?mode=s&dst=m&params=f_grants:s1;',520)" class="button" />
+                    <input type="button" value="Select" onClick="javascript: windowShow('/ods/users_select.vspx?mode=s_bmk&form=F1&dst=mc&params=f_grants:s1;')" class="button" />
                   </td>
                 </tr>
-                </vm:if>
               </table>
             </div>
             <div id="s_content_1" class="tabContent" style="display: none;">
@@ -713,18 +704,18 @@
               ]]>
             </v:on-post>
           </v:button>
-          <v:button action="simple" value="Save" enabled="-- case when self.account_role in ('public', 'guest') then 0 else 1 end" xhtml_class="form-button">
+          <v:button action="simple" value="Save" enabled="-- case when self.account_rights = 'W' then 1 else 0 end" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
                 self.update_params();
-                self.vc_redirect (BMK.WA.page_url (self.domain_id, sprintf ('?action=%U%s', 'Smart Folder/Create', self.do_url('save', 's_'))));
+                self.vc_redirect (BMK.WA.utf2wide (BMK.WA.page_url (self.domain_id, sprintf ('?action=%U%s', 'Smart Folder/Create', self.do_url('save', 's_')))));
               ]]>
             </v:on-post>
           </v:button>
           <v:button action="simple" value="Cancel" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
-                self.vc_redirect (BMK.WA.page_url (self.domain_id));
+                self.vc_redirect (BMK.WA.utf2wide (BMK.WA.page_url (self.domain_id)));
               ]]>
             </v:on-post>
           </v:button>
@@ -744,9 +735,21 @@
                 <b><v:label for="" value="Search" /></b>
                 <v:text name="s_keywords" value="--self.v_keywords" fmt-function="BMK.WA.utf2wide" xhtml_onkeypress="return submitEnter(\'F1\', \'\', event)" xhtml_class="textbox" xhtml_size="60" />
                 |
-                <v:url url="--BMK.WA.page_url (self.domain_id, 'search.vspx?mode=advanced', self.sid, self.realm)" value="Advanced" xhtml_title="Advanced Search" />
+                <v:button action="simple" style="url" value="Advanced" xhtml_class="form-button">
+                  <v:on-post>
+                    <![CDATA[
+                      self.vc_redirect (BMK.WA.utf2wide (BMK.WA.page_url (self.domain_id, 'search.vspx?mode=advanced')));
+                    ]]>
+                  </v:on-post>
+                </v:button>
                 |
-                <v:url url="--BMK.WA.page_url (self.domain_id, null, self.sid, self.realm)" value="Cancel" xhtml_title="Cancel" />
+                <v:button action="simple" style="url" value="Cancel" xhtml_class="form-button">
+                  <v:on-post>
+                    <![CDATA[
+                      self.vc_redirect (BMK.WA.utf2wide (BMK.WA.page_url (self.domain_id)));
+                    ]]>
+                  </v:on-post>
+                </v:button>
               </td>
             </tr>
           </table>
diff --git a/appsrc/ODS-Bookmark/www/settings.vspx b/appsrc/ODS-Bookmark/www/settings.vspx
index d369646..f69f6bd 100644
--- a/appsrc/ODS-Bookmark/www/settings.vspx
+++ b/appsrc/ODS-Bookmark/www/settings.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: settings.vspx,v 1.19.2.5 2010/07/09 14:37:00 source Exp $
+ -  $Id: settings.vspx,v 1.19.2.8 2010/10/13 12:15:19 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -77,7 +77,7 @@
                 }
                 else if (action = 'back')
                 {
-                  self.vc_redirect (BMK.WA.page_url (self.domain_id));
+                  self.vc_redirect (BMK.WA.utf2wide (BMK.WA.page_url (self.domain_id)));
                 }
                 self.vc_data_bind(e);
                ]]>
@@ -90,16 +90,20 @@
         <tr>
           <td id="LC">
             <div class="lc lc_close">
+              <vm:if test="self.account_rights = 'W'">
               <span onclick="javascript: vspxPost('command', 'action', 'settings', 'mode', '');" title="Settings" class="gems2">Settings</span>
+              </vm:if>
               <span onclick="javascript: vspxPost('command', 'action', 'settings', 'mode', 'bookmarklet');" title="Bookmarklet" class="gems2">Bookmarklet</span>
+              <vm:if test="self.account_rights = 'W'">
               <span onclick="javascript: vspxPost('command', 'action', 'settings', 'mode', 'publishBrowse');" title="Publications" class="gems2">Publications</span>
               <span onclick="javascript: vspxPost('command', 'action', 'settings', 'mode', 'subscribeBrowse');" title="Subscriptions" class="gems2">Subscriptions</span>
+              </vm:if>
               <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
               <span onclick="javascript: vspxPost('command', 'action', 'back');" title="Back" class="gems2">Back</span>
             </div>
           </td>
           <td id="RC">
-      <div class="new-form-header" style="margin-top: 6px;">
+            <div class="form-header" style="margin-top: 6px;">
               <?vsp
                 declare S, T varchar;
 
@@ -360,7 +364,7 @@
           </div>
         </div>
       </div>
-      <div class="new-form-footer">
+              <div class="form-footer">
         <v:button action="simple" value="Save" xhtml_class="form-button">
           <v:on-post>
             <![CDATA[
@@ -549,8 +553,26 @@
                 </v:template>
                 <v:template name="ds_exchanges_repeat" type="repeat">
 
-                  <v:template type="if-not-exists" name-to-remove="table" set-to-remove="both">
+                  <v:template name="ds_exchanges_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
                     <table>
+                      <tr align="center">
+                        <td colspan="5">
+                          <?vsp
+                            if (self.bSubAction = 'publishBrowse')
+                            {
+                              http ('No publications');
+                            }
+                            else if (self.bSubAction = 'subscribeBrowse')
+                            {
+                              http ('No subscriptions');
+                            }
+                            else
+                            {
+                              http ('No SyncMLs');
+                            }
+                          ?>
+                        </td>
+                      </tr>
                     </table>
                   </v:template>
 
@@ -794,13 +816,12 @@
                     </th>
                     <td>
                       <v:text name="exc_options_name" xhtml_id="exc_options_name" value="--get_keyword ('name', self.ve_options)" xhtml_size="60" />
-                      <v:button action="browse" value="Browse..." name="exc_options_name_button" xhtml_id="exc_options_name_button">
-                        <v:after-data-bind>
+                      <input type="button" id="exc_options_name_button" value="Browse..." onclick="davBrowse ('exc_options_name');" />
                           <![CDATA[
-                            control.vc_add_attribute ('onclick', 'javascript: davBrowse (''exc_options_name'');');
+                		    <script type="text/javascript">
+                          OAT.Loader.load(['dav'], function(){OAT.WebDav.init(davOptions);});
+                		    </script>
                           ]]>
-                        </v:after-data-bind>
-                      </v:button>
                     </td>
                   </tr>
                   <script type="text/javascript">
@@ -874,7 +895,7 @@
                   </vm:if>
                 </table>
               </div>
-              <div class="new-form-footer">
+              <div class="form-footer">
                 <v:button action="simple" value="--case when self.bSubAction in ('publishCreate', 'subscribeCreate', 'syncmlCreate') then 'Create' else 'Update' end" name="exc_save" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
diff --git a/appsrc/ODS-Bookmark/www/tags.vspx b/appsrc/ODS-Bookmark/www/tags.vspx
index 4e0059b..9bb177a 100644
--- a/appsrc/ODS-Bookmark/www/tags.vspx
+++ b/appsrc/ODS-Bookmark/www/tags.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: tags.vspx,v 1.4.2.1 2010/02/10 22:17:03 source Exp $
+ -  $Id: tags.vspx,v 1.4.2.2 2010/09/20 10:14:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Bookmark/www/template/popup.vspx b/appsrc/ODS-Bookmark/www/template/popup.vspx
index cecec83..a185e96 100644
--- a/appsrc/ODS-Bookmark/www/template/popup.vspx
+++ b/appsrc/ODS-Bookmark/www/template/popup.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
-  -  $Id: popup.vspx,v 1.7.2.3 2010/03/12 09:12:04 source Exp $
+  -  $Id: popup.vspx,v 1.7.2.6 2010/10/13 12:15:19 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -28,26 +28,34 @@
     <link rel="stylesheet" href="css/style.css" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <![CDATA[
-      <script type="text/javascript">
-        var toolkitPath="/ods/oat";
-        var imagePath="/ods/images/oat/";
-
-        var featureList=["combolist", "dav"];
-      </script>
       <script type="text/javascript" src="/ods/oat/loader.js"></script>
-      <script type="text/javascript" src="/ods/tbl.js"></script>
-      <script type="text/javascript" src="js/bookmark.js"></script>
       <script type="text/javascript">
-        function myInit()
-        {
           OAT.Preferences.imagePath = '/ods/images/oat/';
           OAT.Preferences.stylePath = '/ods/oat/styles/';
           OAT.Preferences.showAjax = false;
 
+        // DAV
+        var davOptions = {
+          imagePath: OAT.Preferences.imagePath,
+          pathHome: '/home/',
+          path: '<?V BMK.WA.dav_logical_home (self.account_id) ?>',
+          user: '<?V BMK.WA.account_name (self.account_id) ?>',
+          connectionHeaders: {Authorization: '<?V BMK.WA.account_basicAuthorization (self.account_id) ?>'}
+        };
+
         	/* load stylesheets */
         	OAT.Style.include("grid.css");
         	OAT.Style.include("webdav.css");
+      	OAT.Style.include("winms.css");
 
+        var featureList=["combolist"];
+        OAT.Loader.load(featureList);
+      </script>
+      <script type="text/javascript" src="/ods/tbl.js"></script>
+      <script type="text/javascript" src="js/bookmark.js"></script>
+      <script type="text/javascript">
+        function myInit()
+        {
           // init tabs
           showTab('a', 2, 0);
         }
@@ -62,8 +70,7 @@
       <vm:variables>
         <v:variable persist="0" name="domain_id" type="integer" default="-1"/>
         <v:variable persist="0" name="account_id" type="integer" default="-1"/>
-        <v:variable persist="0" name="account_role" type="varchar" default="'public'"/>
-        <v:variable persist="0" name="accountName" type="varchar" default="'Public User'"/>
+        <v:variable persist="0" name="account_rights" type="varchar" default="''"/>
         <v:variable persist="0" name="settings" type="any" />
       </vm:variables>
       <v:on-init>
@@ -76,9 +83,8 @@
 
           aSessInfo := BMK.WA.session_restore (params);
           self.domain_id := cast(get_keyword('domain_id', aSessInfo, '-1') as integer);
-          self.account_id := cast(get_keyword('user_id', aSessInfo, '-1') as integer);
-          self.account_role := get_keyword('user_role', aSessInfo, '');
-          self.accountName := get_keyword('user_name', aSessInfo, '');
+          self.account_id := cast (get_keyword ('account_id', aSessInfo, '-1') as integer);
+          self.account_rights := get_keyword ('account_rights', aSessInfo, '');
           self.settings := BMK.WA.settings (self.domain_id);
         ]]>
       </v:on-init>
diff --git a/appsrc/ODS-Bookmark/www/template/template.vspx b/appsrc/ODS-Bookmark/www/template/template.vspx
index b6c1160..e20bef2 100644
--- a/appsrc/ODS-Bookmark/www/template/template.vspx
+++ b/appsrc/ODS-Bookmark/www/template/template.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: template.vspx,v 1.33.2.7 2010/04/09 14:39:31 source Exp $
+ -  $Id: template.vspx,v 1.33.2.11 2010/10/13 12:15:20 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -46,15 +46,32 @@
     <meta name="dc.title" content="<?V BMK.WA.utf2wide (BMK.WA.domain_description (self.domain_id)) ?>" />
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <![CDATA[
+      <script type="text/javascript" src="/ods/oat/loader.js"></script>
       <script type="text/javascript">
-        var toolkitPath="/ods/oat";
-        var imagePath="/ods/images/oat/";
+        OAT.Preferences.imagePath = '/ods/images/oat/';
+        OAT.Preferences.stylePath = '/ods/oat/styles/';
+        OAT.Preferences.showAjax = false;
+
+        // DAV
+        var davOptions = {
+          imagePath: OAT.Preferences.imagePath,
+          pathHome: '/home/',
+          path: '<?V BMK.WA.dav_logical_home (self.account_id) ?>',
+          user: '<?V BMK.WA.account_name (self.account_id) ?>',
+          connectionHeaders: {Authorization: '<?V BMK.WA.account_basicAuthorization (self.account_id) ?>'}
+        };
+
+      	/* load stylesheets */
+      	OAT.Style.include("grid.css");
+      	OAT.Style.include("webdav.css");
+      	OAT.Style.include("winms.css");
         
-        var featureList=["ajax", "json", "anchor", "dialog", "dav", "tree", "calendar"];
+        var featureList=["ajax", "json", "anchor", "dialog", "tree", "calendar"];
+        OAT.Loader.load(featureList);
       </script>
-      <script type="text/javascript" src="/ods/oat/loader.js"></script>
       <script type="text/javascript" src="/ods/app.js"></script>
       <script type="text/javascript" src="/ods/tbl.js"></script>
+      <script type="text/javascript" src="/ods/validate.js"></script>
       <script type="text/javascript" src="js/bookmark.js"></script>
       <script type="text/javascript">
         // publics
@@ -65,91 +82,29 @@
             setTimeout(myInit, 50);
             return;
           }
-          OAT.Preferences.imagePath = '/ods/images/oat/';
-          OAT.Preferences.stylePath = '/ods/oat/styles/';
-          OAT.Preferences.showAjax = false;
-
-        	/* load stylesheets */
-        	OAT.Style.include("grid.css");
-        	OAT.Style.include("webdav.css");
-
-          // WebDAV
-          var options = { imagePath: OAT.Preferences.imagePath,
-                          pathHome: '/home/',
-                      		width:650,
-                      		height:400,
-                          path: '<?V BMK.WA.dav_logical_home (self.account_id) ?>',
-                          user: '<?V BMK.WA.account_name (self.account_id) ?>',
-                          connectionHeaders: {Authorization: '<?V BMK.WA.account_basicAuthorization (self.account_id) ?>'}
-                        };
-          OAT.WebDav.init(options);
 
           // <a>++
           OAT.Anchor.imagePath = OAT.Preferences.imagePath;
           OAT.Anchor.zIndex = 1001;
         
-          if (<?V cast (get_keyword ('app', self.settings, '0') as integer) ?> > 0)
-          {
-            if ($('app_area'))
-            {
+          if ((<?V cast (get_keyword ('app', self.settings, '0') as integer) ?> > 0) && $('app_area'))
             generateAPP('app_area', {appActivation: "<?V case when cast (get_keyword ('app', self.settings, '1') as integer) = 2 then 'hover' else 'click' end ?>"});
-            }
-          }
             
       		// init tabs
           showTab('a', 2, 0);
           showTab('p', 3, 0);
           showTab('s', 2, 0);
 
-          // Init left pane - tree and tags
-          BMK.initLeftPane();
           setFooter();
-          OAT.MSG.send(OAT, 'PAGE_LOADED');
-        }
+          window.onresize = function() {setFooter();}
 
-        function getWindowHeight() {
-          var windowHeight = 0;
-          if (typeof(window.innerHeight) == 'number')
-          {
-            windowHeight = window.innerHeight;
-          }
-          else
-          {
-            if (document.documentElement && document.documentElement.clientHeight)
-            {
-              windowHeight = document.documentElement.clientHeight;
-            }
-            else
-            {
-              if (document.body && document.body.clientHeight)
-              {
-                windowHeight = document.body.clientHeight;
-              }
-            }
-          }
-          return windowHeight;
-        }
+          // Init left pane - tree and tags
+          BMK.initLeftPane();
 
-        function setFooter() {
-          if (document.getElementById)
-          {
-            var windowHeight = getWindowHeight();
-            if (windowHeight > 0)
-            {
-              var footerElement = $('FT');
-              if (footerElement)
-              {
-                var footerHeight = footerElement.offsetHeight;
-                var pane = $('pane_main');
-                if (pane)
-                  pane.style.height = (windowHeight - footerHeight - 270) + 'px';
-              }
-            }
-          }
+          OAT.MSG.send(OAT, 'PAGE_LOADED');
         }
         OAT.MSG.attach(OAT, 'PAGE_LOADED2', myInit);
         window.onload = function(){OAT.MSG.send(OAT, 'PAGE_LOADED2');};
-        window.onresize = function() {setFooter();}
       </script>
     ]]>
     <title></title>
@@ -157,9 +112,8 @@
   <body>
     <v:page xmlns:v="http://www.openlinksw.com/vspx/">
         <v:variable persist="0" name="domain_id" type="integer" default="-1"/>
-      <v:variable persist="0" name="owner_id" type="integer" default="null" />
         <v:variable persist="0" name="account_id" type="integer" default="-1"/>
-        <v:variable persist="0" name="account_role" type="varchar" default="'public'"/>
+      <v:variable persist="0" name="account_rights" type="varchar" default="''" />
         <v:variable persist="0" name="settings" type="any" />
       <v:on-init>
         <![CDATA[
@@ -171,9 +125,8 @@
 
           sessionData := BMK.WA.session_restore (params);
           self.domain_id := cast (get_keyword('domain_id', sessionData, '-1') as integer);
-          self.owner_id := BMK.WA.domain_owner_id (self.domain_id);
-          self.account_id := cast (get_keyword('user_id', sessionData, '-1') as integer);
-          self.account_role := get_keyword ('user_role', sessionData, '');
+          self.account_id := cast (get_keyword('account_id', sessionData, '-1') as integer);
+          self.account_rights := get_keyword ('account_rights', sessionData, '');
           self.settings := vector_concat (vector ('app', DB.DBA.WA_USER_APP_ENABLE (self.account_id)), BMK.WA.settings (self.domain_id));
 
           self.vc_add_attribute ('xmlns:foaf', 'http://xmlns.com/foaf/0.1/');
diff --git a/appsrc/ODS-Bookmark/www/template/template.xsl b/appsrc/ODS-Bookmark/www/template/template.xsl
index 71a0f1d..fd7ea95 100644
--- a/appsrc/ODS-Bookmark/www/template/template.xsl
+++ b/appsrc/ODS-Bookmark/www/template/template.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: template.xsl,v 1.29.2.3 2010/07/09 14:37:00 source Exp $
+ -  $Id: template.xsl,v 1.29.2.6 2010/10/13 12:15:20 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -108,9 +108,8 @@
       <xsl:copy-of select="."/>
     </xsl:for-each>
     <xsl:if test="not @clean or @clean = 'no'">
-      <div style="padding: 0 0 0.5em 0;">
-        &nbsp;<a href="" onclick="javascript: if (opener != null) opener.focus(); window.close();"><img src="image/close_16.png" border="0" alt="Close" title="Close" />&nbsp;Close</a>
-        <hr />
+      <div style="padding: 0.4em;">
+        <span class="button pointer" onclick="javascript: if (opener != null) opener.focus(); window.close();"><img class="button" src="/ods/images/icons/close_16.png" border="0" alt="Close" title="Close" /> Close</span>
       </div>
     </xsl:if>
     <div id="app_area">
@@ -160,7 +159,7 @@
                       params := e.ve_params;
                       q := trim (get_keyword ('q', params, ''));
                       S := case when q <> ''then sprintf ('&q=%s&step=1', q) else '' end;
-                      self.vc_redirect (BMK.WA.page_url (self.domain_id, sprintf ('search.vspx?mode=%s%s', get_keyword ('mode', params, 'advanced'), S)));
+                      self.vc_redirect (BMK.WA.utf2wide (BMK.WA.page_url (self.domain_id, sprintf ('search.vspx?mode=%s%s', get_keyword ('mode', params, 'advanced'), S))));
                       self.vc_data_bind(e);
                      ]]>
                    </v:on-post>
@@ -170,10 +169,10 @@
             ?>
           <div style="float: right; text-align: right; padding-right: 0.5em; padding-top: 20px;">
               <input name="q" value="" onkeypress="javascript: if (checkNotEnter(event)) return true; vspxPost('searchHead', 'action', 'search', 'mode', 'simple'); return false;" />
-            <xsl:call-template name="nbsp"/>
-              <v:url url="--BMK.WA.page_url (self.domain_id, 'search.vspx?mode=simple', self.sid, self.realm)" xhtml_onclick="javascript: vspxPost(\'searchHead\', \'action\', \'search\', \'mode\', \'simple\'); return false;" value="Search" xhtml_title="simple Search"/>
+              &nbsp;
+              <a href="<?vsp http (BMK.WA.utf2wide (BMK.WA.page_url (self.domain_id, 'search.vspx?mode=simple', self.sid, self.realm))); ?>" onclick="vspxPost('searchHead', 'mode', 'simple'); return false;" title="Simple Search">Search</a>
             |
-              <v:url url="--BMK.WA.page_url (self.domain_id, 'search.vspx?mode=advanced', self.sid, self.realm)" xhtml_onclick="javascript: vspxPost(\'searchHead\', \'action\', \'search\', \'mode\', \'advanced\'); return false;" value="Advanced" xhtml_title="Advanced Search"/>
+              <a href="<?vsp http (BMK.WA.utf2wide (BMK.WA.page_url (self.domain_id, 'search.vspx?mode=advanced', self.sid, self.realm))); ?>" onclick="vspxPost('searchHead', 'mode', 'advanced'); return false;" title="Advanced">Advanced</a>
           </div>
       	</v:template>
       </div>
@@ -182,11 +181,11 @@
             <?vsp http (BMK.WA.utf2wide (BMK.WA.banner_links (self.domain_id, self.sid, self.realm))); ?>
           </div>
           <div style="float: right; padding-right: 0.5em;">
-          <v:template type="simple" enabled="--case when (self.account_role in ('public', 'guest')) then 0 else 1 end">
-              <v:url url="--BMK.WA.page_url (self.domain_id, 'settings.vspx', self.sid, self.realm)" value="Preferences" xhtml_title="Preferences"/>
+            <vm:if test="self.account_rights = 'W'">
+              <a href="<?vsp http (BMK.WA.utf2wide (BMK.WA.page_url (self.domain_id, 'settings.vspx', self.sid, self.realm))); ?>" title="Preferences">Preferences</a>
               |
-      	  </v:template>
-            <a href="<?V sprintf('%s/about.vsp', BMK.WA.domain_sioc_url (self.domain_id)) ?>" onclick="javascript: BMK.aboutDialog(); return false;" title="About">About</a>
+            </vm:if>
+            <a href="<?vsp http (BMK.WA.utf2wide (BMK.WA.page_url (self.domain_id, 'about.vsp'))); ?>" onclick="javascript: BMK.aboutDialog(); return false;" title="About">About</a>
       </div>
           <p style="clear: both; line-height: 0.1em" />
         </div>
@@ -197,7 +196,11 @@
         	    </div>
         	  </v:template>
         	    <xsl:apply-templates select="vm:pagebody" />
-      <div id="FT">
+        <?vsp
+          declare C any;
+          C := vsp_ua_get_cookie_vec(self.vc_event.ve_lines);
+        ?>
+        <div id="FT" style="display: <?V case when get_keyword ('interface', C, '') = 'js' then 'none' else '' end ?>">
         <div id="FT_L">
           <a href="http://www.openlinksw.com/virtuoso">
             <img alt="Powered by OpenLink Virtuoso Universal Server" src="image/virt_power_no_border.png" border="0" />
@@ -228,7 +231,7 @@
         if (not is_empty_or_null(lat) and not is_empty_or_null (lng) and exists (select 1 from ODS..SVC_HOST, ODS..APP_PING_REG where SH_NAME = 'GeoURL' and AP_HOST_ID = SH_ID and AP_WAI_ID = self.domain_id))
           http (sprintf('<a href="http://geourl.org/near?p=%U" title="GeoURL link" alt="GeoURL link" class="gems"><img src="http://i.geourl.org/geourl.png" border="0"/></a>', BMK.WA.bookmarks_url (self.domain_id)));
 
-        S := BMK.WA.gems_url (self.domain_id);
+        S := BMK.WA.utf2wide (BMK.WA.gems_url (self.domain_id));
         http (sprintf('<a href="%sBookmark.%s" target="_blank" title="%s export" alt="%s export" class="gems"><img src="image/rss-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'rss', 'RSS', 'RSS', 'RSS', 'RSS'));
         http (sprintf('<a href="%sBookmark.%s" target="_blank" title="%s export" alt="%s export" class="gems"><img src="image/blue-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'atom', 'ATOM', 'ATOM', 'ATOM', 'Atom'));
         http (sprintf('<a href="%sBookmark.%s" target="_blank" title="%s export" alt="%s export" class="gems"><img src="image/rdf-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'rdf', 'RDF', 'RDF', 'RDF', 'RDF'));
@@ -430,16 +433,5 @@
     </div>
   </xsl:template>
 
-  <!--=========================================================================-->
-  <xsl:template name="nbsp">
-    <xsl:param name="count" select="1"/>
-    <xsl:if test="$count != 0">
-      <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
-      <xsl:call-template name="nbsp">
-        <xsl:with-param name="count" select="$count - 1"/>
-      </xsl:call-template>
-    </xsl:if>
-  </xsl:template>
-  <!--=========================================================================-->
-
 </xsl:stylesheet>
+
diff --git a/appsrc/ODS-Bookmark/www/users.vspx b/appsrc/ODS-Bookmark/www/users.vspx
index cd15b2e..99002e6 100644
--- a/appsrc/ODS-Bookmark/www/users.vspx
+++ b/appsrc/ODS-Bookmark/www/users.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: users.vspx,v 1.6.2.2 2010/02/10 22:17:03 source Exp $
+ -  $Id: users.vspx,v 1.6.2.4 2010/10/13 12:15:19 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -28,13 +28,18 @@
     <![CDATA[
       declare altStr, directionStr, imageStr varchar;
 
-      if (self.v_order = columnName and self.v_direction = 'desc') {
+      if (self.v_order = columnName and self.v_direction = 'desc')
+      {
         directionStr := 'Ascending';
         imageStr := ' <img src="image/d.gif" border="0" alt="Down"/>';
-      } else if (self.v_order = columnName and self.v_direction = 'asc') {
+      }
+      else if (self.v_order = columnName and self.v_direction = 'asc')
+      {
         directionStr := 'Descending';
         imageStr := ' <img src="image/u.gif" border="0" alt="Up"/>';
-      } else {
+      }
+      else
+      {
         directionStr := 'Ascending';
         imageStr := '  ';
       }
@@ -45,36 +50,29 @@
 
   <v:method name="sortChange" arglist="in columnName varchar">
     <![CDATA[
-      if (columnName = '')
-        return;
+      if (columnName <> '')
+      {
       self.ds.vc_reset();
-      if (self.v_order = columnName) {
+        if (self.v_order = columnName)
+        {
         self.v_direction := either(equ(self.v_direction, 'asc'), 'desc', 'asc');
       } else {
         self.v_direction := 'asc';
-      }
       self.v_order := columnName;
+        }
+      }
     ]]>
   </v:method>
 
   <v:method name="isMultiple" arglist="in dst any">
     <![CDATA[
-      declare pos integer;
-
-      pos := strstr(self.v_dst, 'm');
-      if (not isnull(pos))
-        return 1;
-      return 0;
+      return case when isnull (strstr (self.v_dst, 'm')) then 0 else 1 end;
     ]]>
   </v:method>
 
     <v:before-data-bind>
       <![CDATA[
-      if (self.v_mode = 'g') {
-          self.v_filter := 'g';
-      } else {
-          self.v_filter := 'u';
-      }
+      self.v_filter := case when (self.v_mode = 'g') then 'g' else 'u' end;
       ]]>
     </v:before-data-bind>
 
@@ -120,7 +118,7 @@
         <v:button action="simple" value="Filter" xhtml_class="button">
           <v:on-post>
             <![CDATA[
-              self.v_filter := get_keyword('filter', self.vc_page.vc_event.ve_params, self.v_filter);
+              self.v_filter := get_keyword ('filter', e.ve_params, self.v_filter);
               self.v_how := self.how.ufl_value;
               self.v_value := trim(self.value.ufl_value);
               self.vc_data_bind (e);
@@ -152,12 +150,14 @@
             self.v_mask := replace(self.v_mask, '%%', '%');
 
             group_sql := '';
-            if (self.v_mode = 's') {
+            if (self.v_mode = 's')
+            {
               user_sql := sprintf('select ''User'' U_TYPE, U_NAME, coalesce(U_FULL_NAME, \'\') U_FULL_NAME from BMK.WA.GRANTS, DB.DBA.SYS_USERS where (U_ACCOUNT_DISABLED=0) and upper(U_NAME) like upper(\'%s\') and G_GRANTEE_ID = %d and G_GRANTER_ID = U_ID', self.v_mask, self.account_id);
             } else {
               user_sql := sprintf('select ''User'' U_TYPE, U_NAME, coalesce(U_FULL_NAME, \'\') U_FULL_NAME from WS.WS.SYS_DAV_USER where (U_ACCOUNT_DISABLED=0) and (upper(U_NAME) like upper(\'%s\') and (U_ID<>5) and (U_ID<>6) and (U_ID<>%d))', self.v_mask, self.account_id);
             }
-            if (user_sql = '') {
+            if (user_sql = '')
+            {
               control.ds_sql := group_sql;
             } else if (group_sql = '') {
               control.ds_sql := user_sql;
@@ -178,29 +178,24 @@
           <table id="users" class="BMK_grid" cellspacing="0">
             <thead class="sortHeader">
               <tr>
-                <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
+                <vm:if test="self.isMultiple(self.v_dst)">
                   <th class="checkbox" width="1%">
                     <?vsp
                       http('<input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, ''cb_item''); updateChecked(this, ''cb_item''); "/>');
                     ?>
                   </th>
-                </v:template>
-                <v:template type="simple" enabled="-- case when (self.v_mode = '') then 1 else 0 end">
+                </vm:if>
+                <vm:if test="self.v_mode = ''">
                   <th>
-                    <v:label value="Type" format="%s"/>
+                    Type
                   </th>
-                </v:template>
+                </vm:if>
                 <th>
                   <?vsp self.sortColumn('Name', 'U_NAME'); ?>
                 </th>
                 <th>
                   <?vsp self.sortColumn('Description', 'U_FULL_NAME'); ?>
                 </th>
-                <v:template type="simple" enabled="--neq(self.isMultiple(self.v_dst), 1)">
-                  <th width="1%">
-                    Action
-                  </th>
-                </v:template>
               </tr>
             </thead>
           </table>
@@ -211,47 +206,40 @@
           <v:template name="ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
             <table>
               <tr align="center">
-                <?vsp http(sprintf('<td colspan="%d">No records</td>', either(equ(self.v_mode,''),4,3))); ?>
+                <td colspan="<?V either(equ(self.v_mode,''),3,2)+self.isMultiple(self.v_dst) ?>">
+                  No records
+                </td>
               </tr>
             </table>
           </v:template>
 
           <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
             <table>
-              <tr>
-                <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
+              <tr onclick="rowSelected(this);" class="pointer">
+                <vm:if test="self.isMultiple(self.v_dst)">
                   <td  align="center">
                     <?vsp
-                      declare pos integer;
                       declare S, name any;
 
-                      name := (control.vc_parent as vspx_row_template).te_column_value('U_NAME');
-                      S := '';
-                      pos := strstr(self.v_s1, concat(name, ','));
-                      if (not isnull(pos))
-                        S := 'checked="checked"';
-                      http (sprintf ('<input type="checkbox" name="cb_item" value="%s" %s onclick="javascript: updateChecked(this, ''cb_item''); " />', name, S));
+                      name := (control as vspx_row_template).te_column_value('U_NAME');
+                      S := case when isnull (strstr(self.v_s1, concat(name, ','))) then '' else 'checked="checked"' end;
+                      http (sprintf ('<input type="checkbox" name="cb_item" value="%s" %s onclick="updateChecked(this, ''cb_item'', event); " />', name, S));
                     ?>
                   </td>
-                </v:template>
-                <v:template type="simple" enabled="-- case when (self.v_mode = '') then 1 else 0 end">
+                </vm:if>
+                <vm:if test="self.v_mode = ''">
                   <td nowrap="nowrap">
-                    <v:label value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('U_TYPE')" format="%s"/>
+                    <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('U_TYPE')" format="%s"/>
                   </td>
-                </v:template>
+                </vm:if>
                 <td nowrap="nowrap">
+                  <input name="s1_item" type="hidden" value="<?V (control as vspx_row_template).te_column_value('U_NAME') ?>" />
                   <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('U_NAME')" format="%s"/>
                 </td>
                 <td nowrap="nowrap">
+                  <input name="s2_item" type="hidden" value="<?V (control as vspx_row_template).te_column_value('U_FULL_NAME') ?>" />
                   <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('U_FULL_NAME')" format="%s"/>
                 </td>
-                <v:template type="simple" enabled="--neq(self.isMultiple(self.v_dst), 1)">
-                  <td nowrap="nowrap">
-                    <v:text name="s1" type="hidden" value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('U_NAME')"/>
-                    <v:text name="s2" type="hidden" value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('U_FULL_NAME')"/>
-                    <v:button name="b1" action="simple" value="select" xhtml_alt="Select" xhtml_onclick="javascript: rowSelect(this); return false;" xhtml_class="button"/>
-                  </td>
-                </v:template>
               </tr>
             </table>
           </v:template>
@@ -261,20 +249,20 @@
         <v:template type="simple" name-to-remove="table" set-to-remove="top">
           <table>
             <tr align="center">
-              <?vsp http(sprintf('<td colspan="%d">', either(equ(self.v_mode,''),4,3))); ?>
+              <td colspan="<?V either(equ(self.v_mode,''),3,2)+self.isMultiple(self.v_dst) ?>">
                 <vm:ds-navigation data-set="ds"/>
-              <?vsp http('</td>'); ?>
+              </td>
             </tr>
           </table>
         </v:template>
 
       </v:data-set>
-      <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
+      <vm:if test="self.isMultiple(self.v_dst)">
         <div style="padding: 0 0 0.5em 0;">
           <hr />
           <a href="#" onclick="javascript: addChecked(document.forms['F1'], 'cb_item', 'No users were selected for addition.');" class="button2">&nbsp;Add selected</a>
         </div>
-      </v:template>
+      </vm:if>
       <script>
         <![CDATA[
           coloriseTable('users');
diff --git a/appsrc/ODS-Bookmark/xslt/Netscape.xsl b/appsrc/ODS-Bookmark/xslt/Netscape.xsl
index a010e95..d7cf727 100644
--- a/appsrc/ODS-Bookmark/xslt/Netscape.xsl
+++ b/appsrc/ODS-Bookmark/xslt/Netscape.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?> 
 <!--  
  -
- -  $Id: Netscape.xsl,v 1.4 2007/02/27 21:19:45 source Exp $
+ -  $Id: Netscape.xsl,v 1.4.2.1 2010/09/20 10:14:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Bookmark/xslt/XBEL.xsl b/appsrc/ODS-Bookmark/xslt/XBEL.xsl
index 02b8c46..b4b5f39 100644
--- a/appsrc/ODS-Bookmark/xslt/XBEL.xsl
+++ b/appsrc/ODS-Bookmark/xslt/XBEL.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?> 
 <!--  
  -
- -  $Id: XBEL.xsl,v 1.2 2006/08/14 14:33:15 source Exp $
+ -  $Id: XBEL.xsl,v 1.2.2.1 2010/09/20 10:14:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Bookmark/xslt/rss2atom.xsl b/appsrc/ODS-Bookmark/xslt/rss2atom.xsl
index 3db36d4..a8f5bee 100644
--- a/appsrc/ODS-Bookmark/xslt/rss2atom.xsl
+++ b/appsrc/ODS-Bookmark/xslt/rss2atom.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom.xsl,v 1.4.2.1 2010/05/31 21:59:14 source Exp $
+ -  $Id: rss2atom.xsl,v 1.4.2.2 2010/09/20 10:14:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Bookmark/xslt/rss2atom03.xsl b/appsrc/ODS-Bookmark/xslt/rss2atom03.xsl
index 546c7d1..53f03df 100644
--- a/appsrc/ODS-Bookmark/xslt/rss2atom03.xsl
+++ b/appsrc/ODS-Bookmark/xslt/rss2atom03.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom03.xsl,v 1.4 2007/05/10 10:44:22 source Exp $
+ -  $Id: rss2atom03.xsl,v 1.4.2.1 2010/09/20 10:14:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Bookmark/xslt/rss2rdf.xsl b/appsrc/ODS-Bookmark/xslt/rss2rdf.xsl
index d53c1aa..032e4d8 100644
--- a/appsrc/ODS-Bookmark/xslt/rss2rdf.xsl
+++ b/appsrc/ODS-Bookmark/xslt/rss2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2rdf.xsl,v 1.5 2007/05/10 10:44:22 source Exp $
+ -  $Id: rss2rdf.xsl,v 1.5.2.1 2010/09/20 10:14:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Bookmark/xslt/rss2xbel.xsl b/appsrc/ODS-Bookmark/xslt/rss2xbel.xsl
index 1d7a45d..3ac603e 100644
--- a/appsrc/ODS-Bookmark/xslt/rss2xbel.xsl
+++ b/appsrc/ODS-Bookmark/xslt/rss2xbel.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2xbel.xsl,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: rss2xbel.xsl,v 1.2.2.1 2010/09/20 10:14:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/Makefile.in b/appsrc/ODS-Briefcase/Makefile.in
index e6f6b39..74dab77 100644
--- a/appsrc/ODS-Briefcase/Makefile.in
+++ b/appsrc/ODS-Briefcase/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-Briefcase/make_vad.sh b/appsrc/ODS-Briefcase/make_vad.sh
index b31caed..d0128c4 100755
--- a/appsrc/ODS-Briefcase/make_vad.sh
+++ b/appsrc/ODS-Briefcase/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.49.2.25 2010/07/09 14:37:00 source Exp $
+#  $Id: make_vad.sh,v 1.49.2.37 2011/02/03 10:26:14 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -30,7 +30,7 @@ export LANG LC_ALL
 
 MODE=$1
 LOGDIR=`pwd`
-VERSION="1.3.297"
+VERSION="1.3.305"
 LOGFILE="${LOGDIR}/vad_make.log"
 STICKER_DAV="vad_dav.xml"
 STICKER_FS="vad_filesystem.xml"
@@ -242,7 +242,7 @@ sticker_init() {
   echo "  <name package=\"Briefcase\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS Briefcase\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
@@ -254,8 +254,8 @@ sticker_init() {
   echo "<dependencies>" >> $STICKER
   echo "  <require>" >> $STICKER
   echo "    <name package=\"Framework\"/>" >> $STICKER
-  echo "    <versions_later package=\"1.73.21\">" >> $STICKER
-  echo "      <prop name=\"Date\" value=\"2010-07-08 12:00\" />" >> $STICKER
+  echo "    <versions_later package=\"1.77.47\">" >> $STICKER
+  echo "      <prop name=\"Date\" value=\"2010-11-08 12:00\" />" >> $STICKER
   echo "      <prop name=\"Comment\" value=\"An incompatible version of the ODS Framework\" />" >> $STICKER
   echo "    </versions_later>" >> $STICKER
   echo "  </require>" >> $STICKER
diff --git a/appsrc/ODS-Briefcase/new/od-a-api.sql b/appsrc/ODS-Briefcase/new/od-a-api.sql
index da71f0d..06bc21b 100644
--- a/appsrc/ODS-Briefcase/new/od-a-api.sql
+++ b/appsrc/ODS-Briefcase/new/od-a-api.sql
@@ -1,5 +1,5 @@
 --
---  $Id: od-a-api.sql,v 1.1.2.4 2009/12/07 12:33:45 source Exp $
+--  $Id: od-a-api.sql,v 1.1.2.5 2010/09/20 10:14:56 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Briefcase/new/od-a-code.sql b/appsrc/ODS-Briefcase/new/od-a-code.sql
index 3637892..729235c 100644
--- a/appsrc/ODS-Briefcase/new/od-a-code.sql
+++ b/appsrc/ODS-Briefcase/new/od-a-code.sql
@@ -1,5 +1,5 @@
 --
---  $Id: od-a-code.sql,v 1.36.2.13 2010/07/09 14:37:00 source Exp $
+--  $Id: od-a-code.sql,v 1.36.2.20 2010/11/09 20:12:19 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -105,57 +105,24 @@ create procedure ODRIVE.WA.session_restore (
 
   sid := get_keyword ('sid', params, '');
   realm := get_keyword ('realm', params, 'wa');
-
   domain_id := ODRIVE.WA.session_domain (params);
   user_id := -1;
-  if (domain_id <> -1)
-    for (select U_ID,
-                U_NAME,
-                U_FULL_NAME
-           from DB.DBA.VSPX_SESSION,
-                WS.WS.SYS_DAV_USER
-          where VS_REALM = realm
-            and VS_SID   = sid
-            and VS_UID   = U_NAME) do
-    {
-      user_id   := U_ID;
-      user_name := ODRIVE.WA.user_name (U_NAME, U_FULL_NAME);
-      user_role := ODRIVE.WA.access_role (domain_id, U_ID);
-    }
-
-  if ((user_id = -1) and (domain_id >= 0) and (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_TYPE_NAME = 'oDrive' and WAI_IS_PUBLIC = 1)))
-    domain_id := -1;
-
-  if (user_id = -1)
-  {
-    if (domain_id = -1)
-    {
-      user_role := 'expire';
-      user_name := 'Expire session';
-    } else {
-      user_id := coalesce((select A.U_ID
-                             from SYS_USERS A,
-                                  WA_MEMBER B,
-                                  WA_INSTANCE C
-                            where B.WAM_USER = A.U_ID
-                              and B.WAM_MEMBER_TYPE = 1
-                              and B.WAM_INST = C.WAI_NAME
-                              and C.WAI_ID = domain_id), -1);
-      if (user_id = -1)
-      {
         user_role := 'expire';
         user_name := 'Expire session';
-      } else {
-        user_role := 'public';
-        user_name := 'Public User';
-      }
-    }
-  }
-  else if (domain_id <> -1)
+
+  for (select U.U_ID,
+              U.U_NAME,
+              U.U_FULL_NAME
+         from DB.DBA.VSPX_SESSION S,
+              WS.WS.SYS_DAV_USER U
+        where S.VS_REALM = realm
+          and S.VS_SID   = sid
+          and S.VS_UID   = U.U_NAME) do
   {
-    if (ODRIVE.WA.domain_owner_id (domain_id) <> user_id)
-      user_role := 'public';
+    user_id   := U_ID;
+    user_name := ODRIVE.WA.user_name (U_NAME, U_FULL_NAME);
   }
+  user_role := ODRIVE.WA.access_role (domain_id, user_id);
 
   return vector('domain_id', domain_id,
                 'user_id',   user_id,
@@ -203,22 +170,18 @@ create procedure ODRIVE.WA.frozen_page (
 create procedure ODRIVE.WA.check_admin(
   in usr any) returns integer
 {
+  declare grp integer;
+
   if (isstring(usr))
     usr := (select U_ID from SYS_USERS where U_NAME = usr);
 
-  declare grp integer;
-  grp := (select U_GROUP from SYS_USERS where U_ID = usr);
-
-  if (usr = 0)
-    return 1;
-  if (usr = http_dav_uid ())
+  if ((usr = 0) or (usr = http_dav_uid ()))
     return 1;
-  if (grp = 0)
-    return 1;
-  if (grp = http_dav_uid ())
-    return 1;
-  if(grp = http_dav_uid()+1)
+
+  grp := (select U_GROUP from SYS_USERS where U_ID = usr);
+  if ((grp = 0) or (grp = http_dav_uid ()) or (grp = http_dav_uid()+1))
     return 1;
+
   return 0;
 }
 ;
@@ -262,7 +225,8 @@ create procedure ODRIVE.WA.check_grants2 (in role_name varchar, in page_name var
 --
 create procedure ODRIVE.WA.access_role (in domain_id integer, in user_id integer)
 {
-  whenever not found goto _end;
+  if (domain_id <= 0)
+    return 'expire';
 
   if (ODRIVE.WA.check_admin (user_id))
     return 'admin';
@@ -295,14 +259,16 @@ create procedure ODRIVE.WA.access_role (in domain_id integer, in user_id integer
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
     return 'reader';
-  if (exists(select 1
-               from SYS_USERS A
-              where A.U_ID = user_id))
-    return 'guest';
 
-_end:
+  if (exists (select 1
+                from DB.DBA.WA_INSTANCE
+               where WAI_ID = domain_id
+                 and WAI_IS_PUBLIC = 1))
+  {
   return 'public';
 }
+  return 'expire';
+}
 ;
 
 -------------------------------------------------------------------------------
@@ -348,7 +314,6 @@ create procedure ODRIVE.WA.menu_tree ()
   <node     name="Browse"         url="home.vspx"          id="1"   tip="DAV Browser"               allowed="public guest reader author owner admin">
     <node   name="Settings"       url="settings.vspx"      id="11"  place="link"                    allowed="admin owner"/>
   </node>
-  <node     name="Groups"         url="groups.vspx"        id="2"   tip="Groups"                   allowed="admin owner"/>
   <node     name="Metadata"       url="vmds.vspx"          id="3"   tip="Metadata Administration"  allowed="admin owner">
     <node   name="Schemas"        url="vmds.vspx"          id="31"  tip="Schema Administration"    allowed="admin owner"/>
     <node   name="Mime Types"     url="mimes.vspx"         id="32"  tip="Mime Type Administration" allowed="admin owner"/>
@@ -408,6 +373,83 @@ create procedure ODRIVE.WA.show_excerpt(
 
 -------------------------------------------------------------------------------
 --
+create procedure ODRIVE.WA.dashboard_rs(
+  in p0 integer)
+{
+  declare account_id, vspxUser any;
+  declare wai_name, link varchar;
+
+  declare c0 integer;
+  declare c1 varchar;
+  declare c2 varchar;
+  declare c3 datetime;
+  declare c4 integer;
+
+  result_names(c0, c1, c2, c3, c4);
+  account_id := ODRIVE.WA.domain_owner_id (p0);
+  vspxUser := connection_get ('vspx_user');
+  if (isnull (vspxUser))
+  {
+    for (select top 10 RES_ID,
+                RES_FULL_PATH,
+                RES_MOD_TIME,
+                RES_NAME,
+                RES_OWNER
+           from WS.WS.SYS_DAV_RES
+          where RES_FULL_PATH like '/DAV/home/%'
+            and RES_OWNER = account_id
+            and substring (RES_PERMS, 7, 1) = '1'
+          order by RES_MOD_TIME desc) do
+    {
+      wai_name := (select top 1 WAI_NAME from DB.DBA.WA_INSTANCE, DB.DBA.WA_MEMBER where WAI_TYPE_NAME = 'oDrive' and WAI_NAME = WAM_INST and WAM_MEMBER_TYPE = 1 and WAM_USER = RES_OWNER);
+      link := case when isnull (wai_name) then RES_FULL_PATH else SIOC..post_iri_ex (SIOC..briefcase_iri (wai_name), RES_ID) end;
+      result (RES_ID, RES_NAME, link, RES_MOD_TIME, RES_OWNER);
+    }
+  }
+  else
+  {
+    for (select top 10 *
+           from (select *
+                   from (select top 10 RES_ID,
+                                RES_FULL_PATH,
+                                RES_MOD_TIME,
+                                RES_NAME,
+                                RES_OWNER
+                           from WS.WS.SYS_DAV_RES
+                                  join WS.WS.SYS_DAV_ACL_INVERSE on AI_PARENT_ID = RES_ID
+                                    join WS.WS.SYS_DAV_ACL_GRANTS on GI_SUB = AI_GRANTEE_ID
+                          where RES_FULL_PATH like '/DAV/home/%'
+                            and AI_PARENT_TYPE = 'R'
+                            and GI_SUPER = account_id
+                            and AI_FLAG = 'G'
+                          order by RES_MOD_TIME desc
+                        ) acl
+                 union
+                 select *
+                   from (select top 10 RES_ID,
+                                RES_FULL_PATH,
+                                RES_MOD_TIME,
+                                RES_NAME,
+                                RES_OWNER
+                           from WS.WS.SYS_DAV_RES
+                          where RES_FULL_PATH like '/DAV/home/' || vspxUser || '%'
+                            and RES_OWNER = account_id
+                            and RES_PERMS like '1%'
+                          order by RES_MOD_TIME desc
+                        ) own
+                ) sub
+          order by RES_MOD_TIME desc) do
+    {
+      wai_name := (select top 1 WAI_NAME from DB.DBA.WA_INSTANCE, DB.DBA.WA_MEMBER where WAI_TYPE_NAME = 'oDrive' and WAI_NAME = WAM_INST and WAM_MEMBER_TYPE = 1 and WAM_USER = RES_OWNER);
+      link := case when isnull (wai_name) then RES_FULL_PATH else SIOC..post_iri_ex (SIOC..briefcase_iri (wai_name), RES_ID) end;
+      result (RES_ID, RES_NAME, link, RES_MOD_TIME, RES_OWNER);
+    }
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure ODRIVE.WA.show_column_header (
   in columnLabel varchar,
   in columnName varchar,
@@ -473,7 +515,7 @@ create procedure ODRIVE.WA.iri_fix (
   {
     declare V any;
 
-    V := rfc1808_parse_uri (S);
+    V := rfc1808_parse_uri (cast (S as varchar));
     V [0] := 'https';
     V [1] := http_request_header (http_request_header(), 'Host', null, registry_get ('URIQADefaultHost'));
     S := DB.DBA.vspx_uri_compose (V);
@@ -597,69 +639,73 @@ create procedure ODRIVE.WA.dt_format(
   in pDate datetime,
   in pFormat varchar := 'd.m.Y')
 {
-  declare
-    N integer;
-  declare
-    ch,
-    S varchar;
+  declare N integer;
+  declare ch, S varchar;
+
+  declare exit handler for sqlstate '*' {
+    return '';
+  };
 
   S := '';
-  N := 1;
-  while (N <= length(pFormat)) {
-    ch := chr(pFormat[N]);
-    if (ch = 'M') {
+  for (N := 1; N <= length(pFormat); N := N + 1)
+  {
+    ch := substring(pFormat, N, 1);
+    if (ch = 'M')
+    {
       S := concat(S, xslt_format_number(month(pDate), '00'));
-    } else {
-      if (ch = 'm') {
+    }
+    else if (ch = 'm')
+    {
         S := concat(S, xslt_format_number(month(pDate), '##'));
-      } else {
-        if (ch = 'Y') {
-          S := concat(S, xslt_format_number(year(pDate), '0000'));
-        } else {
-          if (ch = 'y') {
-            S := concat(S, substring(xslt_format_number(year(pDate), '0000'),3,2));
-          } else {
-            if (ch = 'd') {
-              S := concat(S, xslt_format_number(dayofmonth(pDate), '##'));
-            } else {
-              if (ch = 'D') {
-                S := concat(S, xslt_format_number(dayofmonth(pDate), '00'));
-              } else {
-                if (ch = 'H') {
-                  S := concat(S, xslt_format_number(hour(pDate), '00'));
-                } else {
-                  if (ch = 'h') {
-                    S := concat(S, xslt_format_number(hour(pDate), '##'));
-                  } else {
-                    if (ch = 'N') {
-                      S := concat(S, xslt_format_number(minute(pDate), '00'));
-                    } else {
-                      if (ch = 'n') {
-                        S := concat(S, xslt_format_number(minute(pDate), '##'));
-                      } else {
-                        if (ch = 'S') {
-                          S := concat(S, xslt_format_number(second(pDate), '00'));
-                        } else {
-                          if (ch = 's') {
-                            S := concat(S, xslt_format_number(second(pDate), '##'));
-                          } else {
-                            S := concat(S, ch);
                           }
+    else if (ch = 'Y')
+    {
+      S := concat(S, xslt_format_number(year(pDate), '0000'));
                         }
+    else if (ch = 'y')
+    {
+      S := concat(S, substring(xslt_format_number(year(pDate), '0000'),3,2));
                       }
+    else if (ch = 'd')
+    {
+      S := concat(S, xslt_format_number(dayofmonth(pDate), '##'));
                     }
+    else if (ch = 'D')
+    {
+      S := concat(S, xslt_format_number(dayofmonth(pDate), '00'));
                   }
+    else if (ch = 'H')
+    {
+      S := concat(S, xslt_format_number(hour(pDate), '00'));
                 }
+    else if (ch = 'h')
+    {
+      S := concat(S, xslt_format_number(hour(pDate), '##'));
               }
+    else if (ch = 'N')
+    {
+      S := concat(S, xslt_format_number(minute(pDate), '00'));
             }
+    else if (ch = 'n')
+    {
+      S := concat(S, xslt_format_number(minute(pDate), '##'));
           }
+    else if (ch = 'S')
+    {
+      S := concat(S, xslt_format_number(second(pDate), '00'));
         }
+    else if (ch = 's')
+    {
+      S := concat(S, xslt_format_number(second(pDate), '##'));
       }
+    else
+    {
+      S := concat(S, ch);
     }
-    N := N + 1;
   }
   return S;
-};
+}
+;
 
 -------------------------------------------------------------------------------
 --
@@ -1629,7 +1675,7 @@ create procedure ODRIVE.WA.odrive_group_own(
     return 1;
   if (isnull(user_name))
     user_name := ODRIVE.WA.account();
-  if (exists(select 1 from DB.DBA.SYS_USERS u1, ODRIVE.WA.GROUPS g, DB.DBA.SYS_USERS u2 where u1.U_NAME=group_name and u1.U_ID=g.GROUP_ID and u1.U_IS_ROLE=1 and g.USER_ID=u2.U_ID and u2.U_NAME=user_name))
+  if (exists(select 1 from DB.DBA.SYS_USERS u1, DB.DBA.WA_GROUPS g, DB.DBA.SYS_USERS u2 where u1.U_NAME=group_name and u1.U_ID=g.WAG_GROUP_ID and u1.U_IS_ROLE=1 and g.WAG_USER_ID=u2.U_ID and u2.U_NAME=user_name))
     return 1;
   return 0;
 }
@@ -2368,7 +2414,7 @@ create procedure ODRIVE.WA.odrive_sharing_dir_list (
   if (is_https_ctx () and SIOC..foaf_check_ssl (null))
   {
     declare N integer;
-    declare graph, waGraph, foafIRI any;
+    declare graph, baseGraph, foafIRI any;
     declare S, V, st, msg, data, meta any;
 
     foafIRI := trim (get_certificate_info (7, null, null, null, '2.5.29.17'));
@@ -2377,42 +2423,59 @@ create procedure ODRIVE.WA.odrive_sharing_dir_list (
 	  if (V is null)
 	    V := vector ();
 	  foafIRI := get_keyword ('URI', V);
-    if (not isnull (foafIRI))
-    {
-      if (SIOC..foaf_check_ssl (null))
+    if (not isnull (foafIRI) and SIOC..foaf_check_ssl (null))
       {
-        waGraph := sprintf ('http://%s/webdav/webaccess', SIOC.DBA.get_cname ());
+      graph := 'http://' || SIOC.DBA.get_cname ();
+      baseGraph := SIOC.DBA.get_graph ();
         S := sprintf (' sparql \n' ||
                       ' define input:storage "" \n' ||
                       ' prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n' ||
                       ' prefix foaf: <http://xmlns.com/foaf/0.1/> \n' ||
                       ' prefix acl: <http://www.w3.org/ns/auth/acl#> \n' ||
-                      ' select ?r \n' ||
-                      '   from <%s> \n' ||
+                    ' select distinct ?r \n' ||
                       '  where { \n' ||
                       '          { \n' ||
+                    '            graph ?g0 \n' ||
+                    '            { \n' ||
                       '              ?rule a acl:Authorization ; \n' ||
                       '                    acl:accessTo ?r ; \n' ||
                       '                    acl:agent <%s>. \n' ||
+                    '              filter (?g0 like <%s/DAV/home/%%>). \n' ||
+                    '            } \n' ||
                       '          } \n' ||
                       '          union \n' ||
                       '          { \n' ||
+                    '            graph ?g0 \n' ||
+                    '            { \n' ||
                       '              ?rule a acl:Authorization ; \n' ||
                       '                    acl:accessTo ?r ; \n' ||
                       '                    acl:agentClass foaf:Agent. \n' ||
+                    '              filter (?g0 like <%s/DAV/home/%%>). \n' ||
+                    '            } \n' ||
                       '          } \n' ||
                       '          union \n' ||
                       '          { \n' ||
+                    '            graph ?g0 \n' ||
+                    '            { \n' ||
                       '              ?rule a acl:Authorization ; \n' ||
                       '                    acl:accessTo ?r ; \n' ||
                       '                    acl:agentClass ?group. \n' ||
+                    '              filter (?g0 like <%s/DAV/home/%%>). \n' ||
+                    '            } \n' ||
+                    '            graph ?g1 \n' ||
+                    '            { \n' ||
                       '                    ?group rdf:type foaf:Group ; \n' ||
                       '                    foaf:member <%s>. \n' ||
+                    '              filter (?g1 like <%s/private/%%>). \n' ||
+                    '            } \n' ||
                       '          } \n' ||
                       '        }\n',
-                      waGraph,
                       foafIRI,
-                      foafIRI);
+                    graph,
+                    graph,
+                    graph,
+                    foafIRI,
+                    baseGraph);
         commit work;
         st := '00000';
         exec (S, st, msg, vector (), vector ('use_cache', 1), meta, data);
@@ -2444,7 +2507,6 @@ create procedure ODRIVE.WA.odrive_sharing_dir_list (
         }
       }
     }
-  }
 
   name := '';
   for (select distinct COL_ID,
@@ -3311,13 +3373,13 @@ create procedure ODRIVE.WA.DAV_SET (
   declare tmp varchar;
 
   if (property = 'permissions')
-    return ODRIVE.WA.DAV_PROP_SET(path, ':virtpermissions', value);
+    return ODRIVE.WA.DAV_PROP_SET (path, ':virtpermissions', value, auth_name, auth_pwd, 0);
   if (property = 'groupID')
-    return ODRIVE.WA.DAV_PROP_SET(path, ':virtownergid', value);
+    return ODRIVE.WA.DAV_PROP_SET (path, ':virtownergid', value, auth_name, auth_pwd, 0);
   if (property = 'ownerID')
-    return ODRIVE.WA.DAV_PROP_SET(path, ':virtowneruid', value);
+    return ODRIVE.WA.DAV_PROP_SET (path, ':virtowneruid', value, auth_name, auth_pwd, 0);
   if (property = 'mimeType')
-    return ODRIVE.WA.DAV_PROP_SET(path, ':getcontenttype', value);
+    return ODRIVE.WA.DAV_PROP_SET (path, ':getcontenttype', value, auth_name, auth_pwd, 0);
   if (property = 'name')
   {
     tmp := concat(left(path, strrchr(rtrim(path, '/'), '/')), '/', value, either(equ(right(path, 1), '/'), '/', ''));
@@ -3326,11 +3388,11 @@ create procedure ODRIVE.WA.DAV_SET (
   if (property = 'detType')
     return DAV_PROP_SET_INT (path, ':virtdet', value, null, null, 0, 0, 0, http_dav_uid ());
   if (property = 'acl')
-    return ODRIVE.WA.DAV_PROP_SET(path, ':virtacl', value);
+    return ODRIVE.WA.DAV_PROP_SET (path, ':virtacl', value, auth_name, auth_pwd, 0);
   if (property = 'privatetags')
-    return ODRIVE.WA.DAV_PROP_TAGS_SET(path, ':virtprivatetags', value);
+    return ODRIVE.WA.DAV_PROP_TAGS_SET (path, ':virtprivatetags', value, auth_name, auth_pwd);
   if (property = 'publictags')
-    return ODRIVE.WA.DAV_PROP_TAGS_SET(path, ':virtpublictags', value);
+    return ODRIVE.WA.DAV_PROP_TAGS_SET (path, ':virtpublictags', value, auth_name, auth_pwd);
   if (property = 'autoversion')
     return ODRIVE.WA.DAV_SET_AUTOVERSION (path, value);
   if (property = 'permissions-inheritance')
@@ -3703,12 +3765,14 @@ create procedure ODRIVE.WA.DAV_PROP_SET (
   in propName varchar,
   in propValue any,
   in auth_name varchar := null,
-  in auth_pwd varchar := null)
+  in auth_pwd varchar := null,
+  in removeBefore integer := 1)
 {
-  -- dbg_obj_princ ('ODRIVE.WA.DAV_PROP_GET (', path, propName, ')');
+  -- dbg_obj_princ ('ODRIVE.WA.DAV_PROP_SET (', path, propName, ')');
   declare uname, gname varchar;
 
   ODRIVE.WA.DAV_API_PARAMS (null, null, uname, gname, auth_name, auth_pwd);
+  if (removeBefore)
   DB.DBA.DAV_PROP_REMOVE(path, propname, auth_name, auth_pwd);
   return DB.DBA.DAV_PROP_SET(path, propname, propvalue, auth_name, auth_pwd);
 }
@@ -3775,6 +3839,7 @@ create procedure ODRIVE.WA.DAV_PROP_REMOVE (
 {
   declare uname, gname varchar;
 
+  -- dbg_obj_princ ('ODRIVE.WA.DAV_PROP_REMOVE (', path, propName, ')');
   ODRIVE.WA.DAV_API_PARAMS (null, null, uname, gname, auth_name, auth_pwd);
   return DB.DBA.DAV_PROP_REMOVE(path, propname, auth_name, auth_pwd);
 }
@@ -4393,6 +4458,26 @@ create procedure ODRIVE.WA.acl_send_mail (
 
 -------------------------------------------------------------------------------
 --
+create procedure ODRIVE.WA.aci_parents (
+  in path varchar)
+{
+  declare N integer;
+  declare tmp, V, aPath any;
+
+  tmp := '/';
+  V := vector ();
+  aPath := split_and_decode (trim (path, '/'), 0, '\0\0/');
+  for (N := 0; N < length (aPath)-1; N := N + 1)
+  {
+    tmp := tmp || aPath[N] || '/';
+    V := vector_concat (V, vector (tmp));
+  }
+  return V;
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure ODRIVE.WA.aci_load (
   in path varchar)
 {
@@ -4401,7 +4486,7 @@ create procedure ODRIVE.WA.aci_load (
 
   retValue := vector ();
 
-  graph := SIOC..dav_res_iri (path);
+  graph := WS.WS.DAV_IRI (path);
   S := sprintf (' sparql \n' ||
                 ' define input:storage "" \n' ||
                 ' prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n' ||
@@ -4450,7 +4535,7 @@ create procedure ODRIVE.WA.aci_load (
       }
       if (ODS.ODS_API."ontology.normalize" (data[N][1]) = 'foaf:Agent')
         V[2] := 'public';
-      if (data[N][1] like SIOC..waGraph() || '%')
+      if (data[N][1] like SIOC.DBA.get_graph () || '/%/group/%')
         V[2] := 'group';
       aclMode := ODS.ODS_API."ontology.normalize" (data[N][2]);
       if (aclMode = 'acl:Read')
diff --git a/appsrc/ODS-Briefcase/new/od-a-dc-data.sql b/appsrc/ODS-Briefcase/new/od-a-dc-data.sql
index 512442f..88f50ff 100644
--- a/appsrc/ODS-Briefcase/new/od-a-dc-data.sql
+++ b/appsrc/ODS-Briefcase/new/od-a-dc-data.sql
@@ -1,5 +1,5 @@
 --
---  $Id: od-a-dc-data.sql,v 1.2 2006/08/14 14:33:15 source Exp $
+--  $Id: od-a-dc-data.sql,v 1.2.2.1 2010/09/20 10:14:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Briefcase/new/od-a-dc.sql b/appsrc/ODS-Briefcase/new/od-a-dc.sql
index 63aeed8..7d389d6 100644
--- a/appsrc/ODS-Briefcase/new/od-a-dc.sql
+++ b/appsrc/ODS-Briefcase/new/od-a-dc.sql
@@ -1,5 +1,5 @@
 --
---  $Id: od-a-dc.sql,v 1.7.2.2 2010/01/14 16:04:13 source Exp $
+--  $Id: od-a-dc.sql,v 1.7.2.4 2010/09/20 10:14:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -181,9 +181,8 @@ create procedure ODRIVE.WA.dc_get_criteria (
   aXml := ODRIVE.WA.dc_xml_doc (search);
   retValue := cast (xpath_eval (sprintf('/dc/criteria/entry[%s]/%s', S, getValue), aXml) as varchar);
   if (is_empty_or_null(retValue))
-  {
     return defaultValue;
-  }
+
   return retValue;
 }
 ;
@@ -193,18 +192,14 @@ create procedure ODRIVE.WA.dc_get_criteria (
 create procedure ODRIVE.WA.dc_filter (
   inout search varchar)
 {
-  declare I, N integer;
-  declare aXml, aEntity, aFilter any;
+  declare entries, filter any;
 
-  aFilter := vector();
-  aXml := ODRIVE.WA.dc_xml_doc (search);
-  I := xpath_eval('count(/dc/criteria/entry)', aXml);
-  for (N := 1; N <= I; N := N + 1)
-{
-    aEntity := xpath_eval('/dc/criteria/entry', aXml, N);
-    ODRIVE.WA.dc_subfilter(aFilter, aEntity);
-  }
-  return aFilter;
+  filter := vector();
+  entries := xpath_eval('/dc/criteria/entry', ODRIVE.WA.dc_xml_doc (search), 0);
+  foreach (any entry in entries) do
+    ODRIVE.WA.dc_subfilter(filter, entry);
+
+  return filter;
 }
 ;
 
diff --git a/appsrc/ODS-Briefcase/new/od-a-ddk.sql b/appsrc/ODS-Briefcase/new/od-a-ddk.sql
index 7c7658c..df5d42a 100644
--- a/appsrc/ODS-Briefcase/new/od-a-ddk.sql
+++ b/appsrc/ODS-Briefcase/new/od-a-ddk.sql
@@ -1,5 +1,5 @@
 --
---  $Id: od-a-ddk.sql,v 1.5.2.2 2010/02/10 22:17:52 source Exp $
+--  $Id: od-a-ddk.sql,v 1.5.2.5 2010/11/09 20:12:19 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -23,37 +23,6 @@
 -----------------------------------------------------------------------------
 --
 ODRIVE.WA.exec_no_error('
-  create table ODRIVE.WA.GROUPS (
-    USER_ID  integer references DB.DBA.SYS_USERS(U_ID) on delete cascade,
-    GROUP_ID integer references DB.DBA.SYS_USERS(U_ID) on delete cascade,
-
-    primary key (GROUP_ID)
-  )
-');
-
------------------------------------------------------------------------------
---
-ODRIVE.WA.exec_no_error('
-  create table ODRIVE.WA.FOAF_GROUPS (
-    FG_ID integer identity,
-    FG_USER_ID integer not null,
-    FG_NAME varchar not null,
-    FG_DESCRIPTION long varchar,
-    FG_WEBIDS long varchar,
-
-    constraint FK_ODRIVE_FOAF_GROUPS_01 FOREIGN KEY (FG_USER_ID) references DB.DBA.SYS_USERS(U_ID) on delete cascade,
-
-    primary key (FG_ID)
-  )
-');
-
-ODRIVE.WA.exec_no_error ('
-  create unique index SK_ODRIVE_FOAF_GROUPS_01 on ODRIVE.WA.FOAF_GROUPS (FG_USER_ID, FG_NAME)
-');
-
------------------------------------------------------------------------------
---
-ODRIVE.WA.exec_no_error ('
   create table ODRIVE.WA.SETTINGS (
     USER_ID   integer references DB.DBA.SYS_USERS(U_ID) on delete cascade,
     USER_SETTINGS long varchar,
diff --git a/appsrc/ODS-Briefcase/new/od-a-ods.sql b/appsrc/ODS-Briefcase/new/od-a-ods.sql
index 194378f..a85ed89 100644
--- a/appsrc/ODS-Briefcase/new/od-a-ods.sql
+++ b/appsrc/ODS-Briefcase/new/od-a-ods.sql
@@ -1,5 +1,5 @@
 --
---  $Id: od-a-ods.sql,v 1.1 2006/10/18 21:15:49 source Exp $
+--  $Id: od-a-ods.sql,v 1.1.2.1 2010/09/20 10:14:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Briefcase/new/od-a-rdf-data.sql b/appsrc/ODS-Briefcase/new/od-a-rdf-data.sql
index 8f16b21..f6f60a2 100644
--- a/appsrc/ODS-Briefcase/new/od-a-rdf-data.sql
+++ b/appsrc/ODS-Briefcase/new/od-a-rdf-data.sql
@@ -1,5 +1,5 @@
 --
---  $Id: od-a-rdf-data.sql,v 1.7 2008/02/19 11:02:58 source Exp $
+--  $Id: od-a-rdf-data.sql,v 1.7.2.1 2010/09/20 10:14:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Briefcase/new/od-a-rdf.sql b/appsrc/ODS-Briefcase/new/od-a-rdf.sql
index 705d15a..255bfed 100644
--- a/appsrc/ODS-Briefcase/new/od-a-rdf.sql
+++ b/appsrc/ODS-Briefcase/new/od-a-rdf.sql
@@ -1,5 +1,5 @@
 --
---  $Id: od-a-rdf.sql,v 1.6 2008/08/25 20:33:17 source Exp $
+--  $Id: od-a-rdf.sql,v 1.6.2.1 2010/09/20 10:14:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Briefcase/new/od-a-soap.sql b/appsrc/ODS-Briefcase/new/od-a-soap.sql
index c258af6..2e51927 100644
--- a/appsrc/ODS-Briefcase/new/od-a-soap.sql
+++ b/appsrc/ODS-Briefcase/new/od-a-soap.sql
@@ -1,5 +1,5 @@
 --
---  $Id: od-a-soap.sql,v 1.12 2008/09/10 11:16:20 source Exp $
+--  $Id: od-a-soap.sql,v 1.12.2.1 2010/09/20 10:14:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Briefcase/new/od-a-update.sql b/appsrc/ODS-Briefcase/new/od-a-update.sql
index 058b288..9668f5f 100644
--- a/appsrc/ODS-Briefcase/new/od-a-update.sql
+++ b/appsrc/ODS-Briefcase/new/od-a-update.sql
@@ -1,5 +1,5 @@
 --
---  $Id: od-a-update.sql,v 1.1 2008/08/25 20:33:17 source Exp $
+--  $Id: od-a-update.sql,v 1.1.2.2 2010/09/20 10:14:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -94,7 +94,7 @@ create procedure ODRIVE.WA.tmp_upgrade ()
 
 	  -- base
 	  --
-    ODRIVE.WA.dc_set_base (newSearch, 'path', ODRIVE.WA.dav_dc_get (oldSearch, 'base', 'path'));
+    ODRIVE.WA.dc_set_base (newSearch, 'path', ODRIVE.WA.dc_get (oldSearch, 'base', 'path'));
 
 	  ODRIVE.WA.tmp_set_criteria (newSearch, M, 'RES_NAME',         'like',                                                   ODRIVE.WA.dc_get(oldSearch, 'base', 'name'));
 	  ODRIVE.WA.tmp_set_criteria (newSearch, M, 'RES_CONTENT',      'contains_text',                                          ODRIVE.WA.dc_get(oldSearch, 'base', 'content'));
diff --git a/appsrc/ODS-Briefcase/new/od-a-wa.sql b/appsrc/ODS-Briefcase/new/od-a-wa.sql
index b7740cf..fd26235 100644
--- a/appsrc/ODS-Briefcase/new/od-a-wa.sql
+++ b/appsrc/ODS-Briefcase/new/od-a-wa.sql
@@ -1,5 +1,5 @@
 --
---  $Id: od-a-wa.sql,v 1.13 2008/02/26 20:21:23 source Exp $
+--  $Id: od-a-wa.sql,v 1.13.2.4 2010/09/22 13:57:02 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -184,6 +184,11 @@ ODRIVE.WA.exec_no_error (
 ;
 
 ODRIVE.WA.exec_no_error (
+  'alter type wa_oDrive add overriding method wa_dashboard () returns any'
+)
+;
+
+ODRIVE.WA.exec_no_error (
   'alter type wa_oDrive add method wa_dashboard_last_item () returns any'
 )
 ;
@@ -279,7 +284,14 @@ create method wa_drop_instance () for wa_oDrive
   declare iWaiID integer;
 
   iWaiID := self.wa_id ();
-  VHOST_REMOVE(lpath => concat('/odrive/', cast (iWaiID as varchar)));
+  for (select HP_LPATH as _lpath,
+              HP_HOST as _vhost,
+              HP_LISTEN_HOST as _lhost
+         from DB.DBA.HTTP_PATH
+        where HP_LPATH = '/odrive/' || cast (iWaiID as varchar)) do
+  {
+    VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+  }
   (self as web_app).wa_drop_instance ();
 }
 ;
@@ -398,98 +410,54 @@ create method get_param (in param varchar) for wa_oDrive
 }
 ;
 
-create method wa_dashboard_last_item () for wa_oDrive
+-------------------------------------------------------------------------------
+--
+create method wa_dashboard () for wa_oDrive
 {
-  declare ses, vspxUser, c_iri any;
-  declare iUserID integer;
-
-  c_iri := SIOC..briefcase_iri (self.wa_name);
-  vspxUser := connection_get ('vspx_user');
-  iUserID := (select top 1 U_ID from SYS_USERS A, WA_MEMBER B where B.WAM_USER = A.U_ID and B.WAM_INST = self.wa_name and B.WAM_MEMBER_TYPE = 1);
-  ses := string_output ();
-
-  http ('<dav-db>', ses);
-  if (isnull (vspxUser)) {
-    for (select top 10 RES_ID,
-                RES_FULL_PATH,
-                RES_MOD_TIME,
-                RES_NAME,
-                RES_OWNER
-           from WS.WS.SYS_DAV_RES
-          where RES_FULL_PATH like '/DAV/home/%'
-            and RES_OWNER = iUserID
-            and substring (RES_PERMS, 7, 1) = '1'
-          order by RES_MOD_TIME desc) do {
-
-      declare uname, full_name varchar;
-
-      uname := (select coalesce (U_NAME, '') from DB.DBA.SYS_USERS where U_ID = RES_OWNER);
-      full_name := (select coalesce (coalesce (U_FULL_NAME, U_NAME), '') from DB.DBA.SYS_USERS where U_ID = RES_OWNER);
-
-      http ('<resource>', ses);
-      http (sprintf ('<dt>%s</dt>', date_iso8601 (RES_MOD_TIME)), ses);
-      http (sprintf ('<title><![CDATA[%s]]></title>', RES_NAME), ses);
-      http (sprintf ('<link><![CDATA[%s]]></link>', RES_FULL_PATH), ses);
-      http (sprintf ('<from><![CDATA[%s]]></from>', full_name), ses);
-      http (sprintf ('<uid>%s</uid>', uname), ses);
-      http ('</resource>', ses);
-    }
-  } else {
-  for select top 10 *
-        from (select *
-              from (select top 10 RES_ID,
-                           RES_FULL_PATH,
-                           RES_MOD_TIME,
-                           RES_NAME,
-                           RES_OWNER
-                        from WS.WS.SYS_DAV_RES
-                               join WS.WS.SYS_DAV_ACL_INVERSE on AI_PARENT_ID = RES_ID
-                                 join WS.WS.SYS_DAV_ACL_GRANTS on GI_SUB = AI_GRANTEE_ID
-                     where RES_FULL_PATH like '/DAV/home/%'
-                       and AI_PARENT_TYPE = 'R'
-                           and GI_SUPER = iUserID
-                         and AI_FLAG = 'G'
-                       order by RES_MOD_TIME desc
-                     ) acl
-              union
-                select *
-                from (select top 10 RES_ID,
-                             RES_FULL_PATH,
-                             RES_MOD_TIME,
-                             RES_NAME,
-                             RES_OWNER
-                          from WS.WS.SYS_DAV_RES
-                       where RES_FULL_PATH like '/DAV/home/' || vspxUser || '%'
-                         and RES_OWNER = iUserID
-                           and RES_PERMS like '1%'
-                         order by RES_MOD_TIME desc
-                     ) own
-             ) sub
-       order by RES_MOD_TIME desc do {
-
-      declare uname, full_name, wai_name, link varchar;
-
-    uname := (select coalesce (U_NAME, '') from DB.DBA.SYS_USERS where U_ID = RES_OWNER);
-    full_name := (select coalesce (coalesce (U_FULL_NAME, U_NAME), '') from DB.DBA.SYS_USERS where U_ID = RES_OWNER);
-
-      wai_name := (select top 1 WAI_NAME from DB.DBA.WA_INSTANCE, DB.DBA.WA_MEMBER where WAI_TYPE_NAME = 'oDrive' and WAI_NAME = WAM_INST and WAM_MEMBER_TYPE = 1 and WAM_USER = RES_OWNER);
-      if (isnull (wai_name)) {
-        link := RES_FULL_PATH;
-      } else {
-        link := SIOC..post_iri_ex (SIOC..briefcase_iri (wai_name), RES_ID);
+  declare domainID integer;
+
+  domainID := self.wa_id ();
+  return (select TOP 10
+                 XMLAGG ( XMLELEMENT ( 'dash-row',
+                                       XMLATTRIBUTES ( 'normal' as "class",
+                                                       ODRIVE.WA.dt_format(_time, 'Y/M/D H:N') as "time",
+                                                       self.wa_name as "application"
+                                                      ),
+                                       XMLELEMENT ( 'dash-data',
+                                                    XMLATTRIBUTES ( concat (N'<a href="', cast (_link as nvarchar), N'">', ODRIVE.WA.utf2wide (_title), N'</a>') as "content",
+	                                                                  0 as "comments"
+	                                                                )
+                                          	      )
+                                     )
+                     	  )
+            from ODRIVE.WA.dashboard_rs(p0)(_id integer, _title varchar, _link varchar, _time datetime, _owner integer) x
+           where p0 = domainID
+         );
       }
+;
 
-    http ('<resource>', ses);
-    http (sprintf ('<dt>%s</dt>', date_iso8601 (RES_MOD_TIME)), ses);
-      http (sprintf ('<title><![CDATA[%s]]></title>', RES_NAME), ses);
-      http (sprintf ('<link><![CDATA[%s]]></link>', link), ses);
-      http (sprintf ('<from><![CDATA[%s]]></from>', full_name), ses);
-    http (sprintf ('<uid>%s</uid>', uname), ses);
-    http ('</resource>', ses);
-  }
+-------------------------------------------------------------------------------
+--
+create method wa_dashboard_last_item () for wa_oDrive
+{
+  declare domainID integer;
+  declare aStream any;
+
+  domainID := self.wa_id ();
+  aStream := string_output ();
+  http ('<dav-db>', aStream);
+  for (select x.* from ODRIVE.WA.dashboard_rs (p0)(_id integer, _name varchar, _link varchar, _time datetime, _owner integer) x where p0 = domainID) do
+  {
+    http ('<resource>', aStream);
+    http (sprintf ('<dt>%s</dt>', date_iso8601 (_time)), aStream);
+    http (sprintf ('<title><![CDATA[%s]]></title>', _name), aStream);
+    http (sprintf ('<link><![CDATA[%s]]></link>', _link), aStream);
+    http (sprintf ('<from><![CDATA[%s]]></from>', ODRIVE.WA.account_fullName(_owner)), aStream);
+    http (sprintf ('<uid>%s</uid>', ODRIVE.WA.account_name(_owner)), aStream);
+    http ('</resource>', aStream);
   }
-  http ('</dav-db>', ses);
-  return string_output_string (ses);
+  http ('</dav-db>', aStream);
+  return string_output_string (aStream);
 }
 ;
 
@@ -499,8 +467,8 @@ create method wa_rdf_url (in vhost varchar, in lhost varchar) for wa_oDrive
 {
   declare domainID, userID integer;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  userID := (select WAM_USER from WA_MEMBER B where WAM_INST= self.wa_name and WAM_MEMBER_TYPE = 1);
+  domainID := self.wa_id ();
+  userID := ODRIVE.WA.domain_owner_id (domainID);
   return sprintf ('%sexport.vspx?output=about&did=%d&aid=%d', ODRIVE.WA.odrive_url (), domainID, userID);
 }
 ;
@@ -514,7 +482,8 @@ create procedure ODRIVE.WA.path_upgrade ()
   if (registry_get ('odrive_path_upgrade') = '1')
     return;
 
-  for (select WAI_ID, WAI_NAME, WAI_INST from DB.DBA.WA_INSTANCE where WAI_TYPE_NAME = 'oDrive') do {
+  for (select WAI_ID, WAI_NAME, WAI_INST from DB.DBA.WA_INSTANCE where WAI_TYPE_NAME = 'oDrive') do
+  {
     VHOST_REMOVE(lpath    => '/odrive/' || cast (WAI_ID as varchar));
     VHOST_DEFINE(lpath    => '/odrive/' || cast (WAI_ID as varchar),
                  ppath    => (WAI_INST as wa_oDrive).get_param ('host') || 'www/',
@@ -531,9 +500,45 @@ create procedure ODRIVE.WA.path_upgrade ()
      where WAM_INST = WAI_NAME;
   }
   VHOST_REMOVE (lpath    => '/odrive/');
+
+  registry_set ('odrive_path_upgrade', '1');
 }
 ;
-
 ODRIVE.WA.path_upgrade ();
 
-registry_set ('odrive_path_upgrade', '1');
+-------------------------------------------------------------------------------
+--
+create procedure ODRIVE.WA.path_upgrade ()
+{
+  declare _new_lpath varchar;
+
+  if (registry_get ('odrive_path_upgrade2') = '1')
+    return;
+
+  for (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_TYPE_NAME = 'oDrive') do
+  {
+    for (select HP_LPATH as _lpath,
+                HP_HOST as _vhost,
+                HP_LISTEN_HOST as _lhost
+           from DB.DBA.HTTP_PATH
+          where HP_LPATH = '/odrive/' || cast (WAI_ID as varchar) || '/home.vspx') do
+    {
+      _new_lpath := '/odrive/' || cast (WAI_ID as varchar);
+      if (exists (select 1 from DB.DBA.HTTP_PATH where HP_LPATH = _new_lpath and HP_HOST  = _vhost and HP_LISTEN_HOST = _lhost))
+      {
+        VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+      } else {
+        update DB.DBA.HTTP_PATH
+           set HP_LPATH = _new_lpath
+         where HP_LPATH = _lpath
+           and HP_HOST  = _vhost
+           and HP_LISTEN_HOST = _lhost;
+        http_map_del (_lpath, _vhost, _lhost);
+        VHOST_MAP_RELOAD (vhost=>_vhost, lhost=>_lhost, lpath=>_new_lpath);
+      }
+    }
+  }
+  registry_set ('odrive_path_upgrade2', '1');
+}
+;
+ODRIVE.WA.path_upgrade ();
diff --git a/appsrc/ODS-Briefcase/new/od-d.sql b/appsrc/ODS-Briefcase/new/od-d.sql
index 912231a..f221789 100644
--- a/appsrc/ODS-Briefcase/new/od-d.sql
+++ b/appsrc/ODS-Briefcase/new/od-d.sql
@@ -1,5 +1,5 @@
 --
---  $Id: od-d.sql,v 1.7.2.2 2010/01/28 00:30:12 source Exp $
+--  $Id: od-d.sql,v 1.7.2.4 2010/09/20 10:14:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -36,8 +36,7 @@ create procedure ODRIVE.WA.uninstall ()
 ODRIVE.WA.uninstall ()
 ;
 
-VHOST_REMOVE (lpath => '/odrive');
-VHOST_REMOVE (lpath => '/odrive/SOAP');
+VHOST_REMOVE (lpath => '/briefcase');
 VHOST_REMOVE (lpath => '/dataspace/services/briefcase');
 
 ODRIVE.WA.exec_no_error('delete from WA_TYPES where WAT_NAME = \'oDrive\'');
@@ -53,8 +52,7 @@ create procedure ODRIVE.WA.drop_procedures()
 ;
 
 -- dropping procedures for ODRIVE
-ODRIVE.WA.drop_procedures()
-;
+ODRIVE.WA.drop_procedures();
 
 ODRIVE.WA.exec_no_error('DROP procedure ODRIVE.WA.odrive_vhost');
 ODRIVE.WA.exec_no_error('DROP procedure ODRIVE.WA.drop_procedures');
@@ -99,3 +97,11 @@ ODRIVE.WA.exec_no_error('DROP procedure DB.DBA.wa_collect_odrive_tags');
 
 -- final proc
 ODRIVE.WA.exec_no_error('DROP procedure ODRIVE.WA.exec_no_error');
+
+registry_remove ('_oDrive_path_');
+registry_remove ('_oDrive_version_');
+registry_remove ('_oDrive_build_');
+registry_remove ('__ods_briefcase_sioc_init');
+registry_remove ('odrive_items_upgrade');
+registry_remove ('odrive_path_upgrade');
+registry_remove ('odrive_path_upgrade2');
diff --git a/appsrc/ODS-Briefcase/new/sioc_briefcase.sql b/appsrc/ODS-Briefcase/new/sioc_briefcase.sql
index a9df1f5..4b61cbb 100644
--- a/appsrc/ODS-Briefcase/new/sioc_briefcase.sql
+++ b/appsrc/ODS-Briefcase/new/sioc_briefcase.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sioc_briefcase.sql,v 1.16.2.5 2010/07/06 23:08:51 source Exp $
+--  $Id: sioc_briefcase.sql,v 1.16.2.9 2010/09/27 14:44:36 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -149,12 +149,24 @@ create procedure fill_ods_briefcase_sioc (in graph_iri varchar, in site_iri varc
         briefcase_sioc_insert_ex (RES_FULL_PATH, RES_TYPE, RES_OWNER, _U_NAME, content);
       }
     }
-  }
-  -- update WebAccess graph
-  delete from DB.DBA.RDF_QUAD where G = DB.DBA.RDF_IID_OF_QNAME (waGraph());
-  for (select * from ODRIVE.WA.FOAF_GROUPS) do
-  {
-    foaf_group_insert (FG_USER_ID, FG_NAME, FG_WEBIDS);
+    for (select RES_FULL_PATH, RES_OWNER, RES_GROUP, PROP_VALUE
+           from WS.WS.SYS_DAV_RES
+                  join WS.WS.SYS_DAV_PROP ON PROP_PARENT_ID = RES_ID and PROP_TYPE = 'R'
+          where RES_FULL_PATH like ODRIVE.WA.dav_home(_U_NAME) || '%'
+            and PROP_NAME = 'virt:aci_meta_n3') do
+    {
+      WS.WS.WAC_DELETE (RES_FULL_PATH, 1);
+      WS.WS.WAC_INSERT (RES_FULL_PATH, PROP_VALUE, RES_OWNER, RES_GROUP, 1);
+    }
+    for (select DB.DBA.DAV_SEARCH_PATH (COL_ID, PROP_TYPE) COL_FULL_PATH, COL_OWNER, COL_GROUP, PROP_VALUE
+           from WS.WS.SYS_DAV_COL
+                  join WS.WS.SYS_DAV_PROP ON PROP_PARENT_ID = COL_ID and PROP_TYPE = 'C'
+          where DB.DBA.DAV_SEARCH_PATH (COL_ID, PROP_TYPE) like ODRIVE.WA.dav_home(_U_NAME) || '%'
+            and PROP_NAME = 'virt:aci_meta_n3') do
+    {
+      WS.WS.WAC_DELETE (COL_FULL_PATH, 1);
+      WS.WS.WAC_INSERT (COL_FULL_PATH, PROP_VALUE, COL_OWNER, COL_GROUP, 1);
+    }
   }
   return;
 }
@@ -789,100 +801,6 @@ create trigger SYS_DAV_PROP_BRIEFCASE_SIOC_D before delete on WS.WS.SYS_DAV_PROP
 
 -------------------------------------------------------------------------------
 --
-create procedure waGraph ()
-{
-  return sprintf ('http://%s/webdav/webaccess', get_cname ());
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure waGroup (
-  in id integer,
-  in name varchar)
-{
-  return sprintf ('%s/%s#%U', waGraph (), ODRIVE.WA.account_name (id), name);
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure foaf_group_insert (
-  inout id integer,
-  inout name varchar,
-  inout webIDs any)
-{
-  declare N integer;
-  declare graph_iri, group_iri varchar;
-  declare tmp any;
-  declare exit handler for sqlstate '*'
-  {
-    sioc_log_message (__SQL_MESSAGE);
-    return;
-  };
-  graph_iri := SIOC..waGraph();
-  group_iri := SIOC..waGroup(id, name);
-  DB.DBA.ODS_QUAD_URI (graph_iri, group_iri, rdf_iri ('type'), foaf_iri ('Group'));
-  tmp := split_and_decode (webIDs, 0, '\0\0\n');
-  for (N := 0; N < length (tmp); N := N + 1)
-  {
-    if (length (tmp[N]))
-      DB.DBA.ODS_QUAD_URI (graph_iri, group_iri, foaf_iri ('member'), tmp[N]);
-  }
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure foaf_group_delete (
-  inout id integer,
-  inout name varchar)
-{
-  declare graph_iri, group_iri varchar;
-  declare exit handler for sqlstate '*'
-  {
-    sioc_log_message (__SQL_MESSAGE);
-    return;
-  };
-  graph_iri := SIOC..waGraph();
-  group_iri := SIOC..waGroup(id, name);
-  delete_quad_s_or_o (graph_iri, group_iri, group_iri);
-}
-;
-
--------------------------------------------------------------------------------
---
-create trigger FOAF_GROUPS_SIOC_I after insert on ODRIVE.WA.FOAF_GROUPS referencing new as N
-{
-  foaf_group_insert (N.FG_USER_ID,
-                     N.FG_NAME,
-                     N.FG_WEBIDS);
-}
-;
-
--------------------------------------------------------------------------------
---
-create trigger FOAF_GROUPS_SIOC_U after update on ODRIVE.WA.FOAF_GROUPS referencing old as O, new as N
-{
-  foaf_group_delete (O.FG_USER_ID,
-                     O.FG_NAME);
-  foaf_group_insert (N.FG_USER_ID,
-                     N.FG_NAME,
-                     N.FG_WEBIDS);
-}
-;
-
--------------------------------------------------------------------------------
---
-create trigger FOAF_GROUPS_SIOC_D before delete on ODRIVE.WA.FOAF_GROUPS referencing old as O
-{
-  foaf_group_delete (O.FG_USER_ID,
-                     O.FG_NAME);
-}
-;
-
--------------------------------------------------------------------------------
---
 create procedure ods_briefcase_sioc_init ()
 {
   declare sioc_version any;
diff --git a/appsrc/ODS-Briefcase/schemas/DOAP.rdf b/appsrc/ODS-Briefcase/schemas/DOAP.rdf
index b97eb3d..4c06515 100644
--- a/appsrc/ODS-Briefcase/schemas/DOAP.rdf
+++ b/appsrc/ODS-Briefcase/schemas/DOAP.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: DOAP.rdf,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: DOAP.rdf,v 1.2.2.1 2010/09/20 10:14:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/EML.rdf b/appsrc/ODS-Briefcase/schemas/EML.rdf
index 4b9a57d..47574cd 100644
--- a/appsrc/ODS-Briefcase/schemas/EML.rdf
+++ b/appsrc/ODS-Briefcase/schemas/EML.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: EML.rdf,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: EML.rdf,v 1.2.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/FOAF.rdf b/appsrc/ODS-Briefcase/schemas/FOAF.rdf
index 34c60b3..df88f9f 100644
--- a/appsrc/ODS-Briefcase/schemas/FOAF.rdf
+++ b/appsrc/ODS-Briefcase/schemas/FOAF.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: FOAF.rdf,v 1.3 2007/07/26 15:00:20 source Exp $
+ -  $Id: FOAF.rdf,v 1.3.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/ICS.rdf b/appsrc/ODS-Briefcase/schemas/ICS.rdf
index 8da1182..2f17927 100644
--- a/appsrc/ODS-Briefcase/schemas/ICS.rdf
+++ b/appsrc/ODS-Briefcase/schemas/ICS.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ICS.rdf,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: ICS.rdf,v 1.2.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/MODS.rdf b/appsrc/ODS-Briefcase/schemas/MODS.rdf
index de262d3..a38f2ab 100644
--- a/appsrc/ODS-Briefcase/schemas/MODS.rdf
+++ b/appsrc/ODS-Briefcase/schemas/MODS.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: MODS.rdf,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: MODS.rdf,v 1.2.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/OPML.rdf b/appsrc/ODS-Briefcase/schemas/OPML.rdf
index 5650246..e6a4204 100644
--- a/appsrc/ODS-Briefcase/schemas/OPML.rdf
+++ b/appsrc/ODS-Briefcase/schemas/OPML.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: OPML.rdf,v 1.3 2006/06/02 12:50:15 source Exp $
+ -  $Id: OPML.rdf,v 1.3.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/Office.rdf b/appsrc/ODS-Briefcase/schemas/Office.rdf
index cb6d3a7..ccc9fd7 100644
--- a/appsrc/ODS-Briefcase/schemas/Office.rdf
+++ b/appsrc/ODS-Briefcase/schemas/Office.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: Office.rdf,v 1.3 2006/06/27 14:58:06 source Exp $
+ -  $Id: Office.rdf,v 1.3.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/RDF.rdf b/appsrc/ODS-Briefcase/schemas/RDF.rdf
index 3c513ec..3de764d 100644
--- a/appsrc/ODS-Briefcase/schemas/RDF.rdf
+++ b/appsrc/ODS-Briefcase/schemas/RDF.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: RDF.rdf,v 1.3 2007/02/27 21:19:45 source Exp $
+ -  $Id: RDF.rdf,v 1.3.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/RSS.rdf b/appsrc/ODS-Briefcase/schemas/RSS.rdf
index 43123fb..18c6bca 100644
--- a/appsrc/ODS-Briefcase/schemas/RSS.rdf
+++ b/appsrc/ODS-Briefcase/schemas/RSS.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: RSS.rdf,v 1.3 2006/06/02 12:50:15 source Exp $
+ -  $Id: RSS.rdf,v 1.3.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/Spotlight.rdf b/appsrc/ODS-Briefcase/schemas/Spotlight.rdf
index 6e4bab8..c318369 100644
--- a/appsrc/ODS-Briefcase/schemas/Spotlight.rdf
+++ b/appsrc/ODS-Briefcase/schemas/Spotlight.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: Spotlight.rdf,v 1.4 2009/01/29 23:28:57 source Exp $
+ -  $Id: Spotlight.rdf,v 1.4.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/VAD.rdf b/appsrc/ODS-Briefcase/schemas/VAD.rdf
index a1709b9..a7579e5 100644
--- a/appsrc/ODS-Briefcase/schemas/VAD.rdf
+++ b/appsrc/ODS-Briefcase/schemas/VAD.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: VAD.rdf,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: VAD.rdf,v 1.2.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/VSPX.rdf b/appsrc/ODS-Briefcase/schemas/VSPX.rdf
index c929cd8..d50d849 100644
--- a/appsrc/ODS-Briefcase/schemas/VSPX.rdf
+++ b/appsrc/ODS-Briefcase/schemas/VSPX.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: VSPX.rdf,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: VSPX.rdf,v 1.2.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/WSDL.rdf b/appsrc/ODS-Briefcase/schemas/WSDL.rdf
index d11d761..e3b44f9 100644
--- a/appsrc/ODS-Briefcase/schemas/WSDL.rdf
+++ b/appsrc/ODS-Briefcase/schemas/WSDL.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: WSDL.rdf,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: WSDL.rdf,v 1.2.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/Wiki.rdf b/appsrc/ODS-Briefcase/schemas/Wiki.rdf
index b6a5033..2d142f7 100644
--- a/appsrc/ODS-Briefcase/schemas/Wiki.rdf
+++ b/appsrc/ODS-Briefcase/schemas/Wiki.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: Wiki.rdf,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: Wiki.rdf,v 1.2.2.1 2010/09/20 10:14:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/XBEL.rdf b/appsrc/ODS-Briefcase/schemas/XBEL.rdf
index 1c0aa6b..cd4c638 100644
--- a/appsrc/ODS-Briefcase/schemas/XBEL.rdf
+++ b/appsrc/ODS-Briefcase/schemas/XBEL.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: XBEL.rdf,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: XBEL.rdf,v 1.2.2.1 2010/09/20 10:14:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/XBRL.rdf b/appsrc/ODS-Briefcase/schemas/XBRL.rdf
index d601d35..1b0506c 100644
--- a/appsrc/ODS-Briefcase/schemas/XBRL.rdf
+++ b/appsrc/ODS-Briefcase/schemas/XBRL.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: XBRL.rdf,v 1.3 2006/10/26 18:23:12 source Exp $
+ -  $Id: XBRL.rdf,v 1.3.2.1 2010/09/20 10:14:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/XDDL.rdf b/appsrc/ODS-Briefcase/schemas/XDDL.rdf
index bf017ad..f276273 100644
--- a/appsrc/ODS-Briefcase/schemas/XDDL.rdf
+++ b/appsrc/ODS-Briefcase/schemas/XDDL.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: XDDL.rdf,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: XDDL.rdf,v 1.2.2.1 2010/09/20 10:14:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/XHTML.rdf b/appsrc/ODS-Briefcase/schemas/XHTML.rdf
index 114c0e6..85d1ec2 100644
--- a/appsrc/ODS-Briefcase/schemas/XHTML.rdf
+++ b/appsrc/ODS-Briefcase/schemas/XHTML.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: XHTML.rdf,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: XHTML.rdf,v 1.2.2.1 2010/09/20 10:14:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/annotea.rdf b/appsrc/ODS-Briefcase/schemas/annotea.rdf
index 8e95f15..21a3275 100644
--- a/appsrc/ODS-Briefcase/schemas/annotea.rdf
+++ b/appsrc/ODS-Briefcase/schemas/annotea.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: annotea.rdf,v 1.1 2008/02/19 11:02:58 source Exp $
+ -  $Id: annotea.rdf,v 1.1.2.1 2010/09/20 10:14:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/archive.rdf b/appsrc/ODS-Briefcase/schemas/archive.rdf
index 08ff60a..3e4009f 100644
--- a/appsrc/ODS-Briefcase/schemas/archive.rdf
+++ b/appsrc/ODS-Briefcase/schemas/archive.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- 
  -
- -  $Id: archive.rdf,v 1.1 2006/07/17 15:20:19 source Exp $
+ -  $Id: archive.rdf,v 1.1.2.1 2010/09/20 10:14:59 source Exp $
  -  
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/audio.rdf b/appsrc/ODS-Briefcase/schemas/audio.rdf
index 28a4e68..bda3c9b 100644
--- a/appsrc/ODS-Briefcase/schemas/audio.rdf
+++ b/appsrc/ODS-Briefcase/schemas/audio.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- 
  -  
- -  $Id: audio.rdf,v 1.2 2008/10/15 20:03:01 source Exp $
+ -  $Id: audio.rdf,v 1.2.2.1 2010/09/20 10:14:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/google-kinds.rdf b/appsrc/ODS-Briefcase/schemas/google-kinds.rdf
index 9c3d4de..97c2c48 100644
--- a/appsrc/ODS-Briefcase/schemas/google-kinds.rdf
+++ b/appsrc/ODS-Briefcase/schemas/google-kinds.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: google-kinds.rdf,v 1.3 2006/06/02 12:50:15 source Exp $
+ -  $Id: google-kinds.rdf,v 1.3.2.1 2010/09/20 10:14:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/image.rdf b/appsrc/ODS-Briefcase/schemas/image.rdf
index 4c89ebf..75cb810 100644
--- a/appsrc/ODS-Briefcase/schemas/image.rdf
+++ b/appsrc/ODS-Briefcase/schemas/image.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: image.rdf,v 1.3 2006/06/02 12:50:15 source Exp $
+ -  $Id: image.rdf,v 1.3.2.1 2010/09/20 10:14:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/opl-lic.rdf b/appsrc/ODS-Briefcase/schemas/opl-lic.rdf
index abec290..c7a71b8 100644
--- a/appsrc/ODS-Briefcase/schemas/opl-lic.rdf
+++ b/appsrc/ODS-Briefcase/schemas/opl-lic.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: opl-lic.rdf,v 1.3 2008/12/15 22:02:29 source Exp $
+ -  $Id: opl-lic.rdf,v 1.3.2.1 2010/09/20 10:14:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/photo.rdf b/appsrc/ODS-Briefcase/schemas/photo.rdf
index e3f8d7f..b8e2cf2 100644
--- a/appsrc/ODS-Briefcase/schemas/photo.rdf
+++ b/appsrc/ODS-Briefcase/schemas/photo.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: photo.rdf,v 1.3 2006/06/02 12:50:15 source Exp $
+ -  $Id: photo.rdf,v 1.3.2.1 2010/09/20 10:14:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/schemas/vcard-rdf.rdf b/appsrc/ODS-Briefcase/schemas/vcard-rdf.rdf
index 54fbd3e..9ccb708 100644
--- a/appsrc/ODS-Briefcase/schemas/vcard-rdf.rdf
+++ b/appsrc/ODS-Briefcase/schemas/vcard-rdf.rdf
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vcard-rdf.rdf,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: vcard-rdf.rdf,v 1.2.2.1 2010/09/20 10:14:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/www/ajax.vsp b/appsrc/ODS-Briefcase/www/ajax.vsp
index e4f3227..1fd2268 100644
--- a/appsrc/ODS-Briefcase/www/ajax.vsp
+++ b/appsrc/ODS-Briefcase/www/ajax.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: ajax.vsp,v 1.2 2008/12/04 13:38:31 source Exp $
+--  $Id: ajax.vsp,v 1.2.2.1 2010/09/20 10:14:59 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Briefcase/www/css/style.css b/appsrc/ODS-Briefcase/www/css/style.css
index 7bef2d4..5224909 100644
--- a/appsrc/ODS-Briefcase/www/css/style.css
+++ b/appsrc/ODS-Briefcase/www/css/style.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: style.css,v 1.10.2.5 2010/03/01 10:18:30 source Exp $
+ *  $Id: style.css,v 1.10.2.8 2010/10/07 13:23:47 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -1020,7 +1020,7 @@ td.calendar_selected {
 {
   background-color: white;
   width: 100%;
-  height: 380px;
+  min-height: 350px;
   overflow: auto;
 }
 
@@ -1044,3 +1044,19 @@ table.grid {
 	font: menu;
 	width: 99%;
 }
+
+span.button {
+  background: none repeat scroll 0 0 #99B3C5;
+  border: 1px solid #7F94A5;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  color: #FFFFFF;
+  font-size: 0.8em;
+  font-weight: bold;
+  padding: 3px 4px 1px;
+  text-decoration:none;
+}
+
+img.button {
+  margin-bottom: -3px;
+}
diff --git a/appsrc/ODS-Briefcase/www/error.vspx b/appsrc/ODS-Briefcase/www/error.vspx
index 40044d1..417e7e4 100644
--- a/appsrc/ODS-Briefcase/www/error.vspx
+++ b/appsrc/ODS-Briefcase/www/error.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: error.vspx,v 1.6 2008/02/19 11:02:58 source Exp $
+ -  $Id: error.vspx,v 1.6.2.2 2010/09/20 10:15:00 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -27,9 +27,6 @@
   <vm:pagetitle>Error</vm:pagetitle>
   <vm:pagewrapper>
     <vm:header caption="Error"/>
-    <vm:menu>
-      <vm:menuitem value="Error"/>
-    </vm:menu>
     <vm:variables>
       <v:variable name="page_name" type="varchar" default="''" param-name="__PAGE" persist="0"/>
       <v:variable name="code" type="varchar" default="''" param-name="__SQL_STATE" persist="temp"/>
diff --git a/appsrc/ODS-Briefcase/www/export.vspx b/appsrc/ODS-Briefcase/www/export.vspx
index 66cc0d2..7661975 100644
--- a/appsrc/ODS-Briefcase/www/export.vspx
+++ b/appsrc/ODS-Briefcase/www/export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: export.vspx,v 1.13.2.3 2010/05/31 21:59:14 source Exp $
+ -  $Id: export.vspx,v 1.13.2.4 2010/09/20 10:15:00 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/www/forms.vspx b/appsrc/ODS-Briefcase/www/forms.vspx
index 75c70fa..357329d 100644
--- a/appsrc/ODS-Briefcase/www/forms.vspx
+++ b/appsrc/ODS-Briefcase/www/forms.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: forms.vspx,v 1.6.2.10 2010/03/18 10:17:56 source Exp $
+ -  $Id: forms.vspx,v 1.6.2.14 2010/10/13 12:15:00 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -37,7 +37,7 @@
       declare i integer;
       declare item any;
 
-      http ('<div id="dav_list" style="height: 200px;">');
+      http ('<div id="dav_list" style="max-height: 200px; min-height: 200px;">');
       http ('  <table class="OD_grid colorise no-border" cellspacing="0">');
       http ('    <thead class="sortHeader nocolor">');
       http ('      <tr>');
@@ -441,9 +441,9 @@
                           ]]>
                         </v:after-data-bind>
                       </v:text>
-                      <v:template name="tf5" type="simple" enabled="-- equ(ODRIVE.WA.check_admin (self.account_id), 1)">
-                        <input type="button" value="Select" onclick="javascript: windowShow('users_select.vspx?mode=u&params=prop_owner:s1;')" class="button" />
-                      </v:template>
+                      <vm:if test="ODRIVE.WA.check_admin (self.account_id)">
+                        <input type="button" value="Select" onclick="javascript: windowShow('/ods/users_select.vspx?form=F1&mode=u&params=prop_owner:s1;')" class="button" />
+                      </vm:if>
                     </td>
                   </tr>
                   <tr>
@@ -452,7 +452,7 @@
                     </th>
                     <td>
                       <v:text name="prop_group" value="--'Do not change'" format="%s" xhtml_class="field-short" />
-                      <input type="button" value="Select" onclick="javascript: windowShow('users_select.vspx?mode=g&params=prop_group:s1;')" class="button" />
+                      <input type="button" value="Select" onclick="javascript: windowShow('/ods/users_select.vspx?form=F1&mode=g&params=prop_group:s1;')" class="button" />
                     </td>
                   </tr>
                   <tr>
@@ -540,7 +540,7 @@
                             </table>
                           </td>
                           <td valign="top" nowrap="nowrap">
-                            <span class="button3 pointer" onclick="javascript: TBL.createRow('c', null, {fld_1: {mode: 40, className: '_validate_', onblur: function(){ODRIVE.validateField(this);}}, fld_2: {mode: 0}, fld_3: {mode: 41}});"><img src="image/add_16.png" border="0" alt="Add Property" title="Add Property" /> Add</span><br /><br />
+                            <span class="button pointer" onclick="javascript: TBL.createRow('c', null, {fld_1: {mode: 40, className: '_validate_', onblur: function(){validateField(this);}}, fld_2: {mode: 0}, fld_3: {mode: 41}});"><img src="image/add_16.png" class="button" alt="Add Property" title="Add Property" /> Add</span><br /><br />
                           </td>
                         </tr>
                       </table>
@@ -567,7 +567,7 @@
                 </table>
                       </td>
                       <td valign="top" nowrap="nowrap">
-                        <span class="button3 pointer" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 1}, fld_2: {mode: 45, value: 1}, fld_3: {mode: 44, value: [1, 1, 0], suffix: '_grant', onclick: function(){TBL.clickCell44(this);}, tdCssText: 'width: 1%; text-align: center;'}, fld_4: {mode: 44,  suffix: '_deny', onclick: function(){TBL.clickCell44(this);}, tdCssText: 'width: 1%; text-align: center;'}});"><img src="image/add_16.png" border="0" alt="Add Security" title="Add Security" /> Add</span><br /><br />
+                        <span class="button pointer" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 1, cssText: 'width: 88%;', tdCssText: 'white-space: nowrap;'}, fld_2: {mode: 43, value: 1}, fld_3: {mode: 42, value: [1, 1, 0], suffix: '_grant', onclick: function(){TBL.clickCell42(this);}, tdCssText: 'width: 1%; text-align: center;'}, fld_4: {mode: 42,  suffix: '_deny', onclick: function(){TBL.clickCell42(this);}, tdCssText: 'width: 1%; text-align: center;'}});"><img src="image/add_16.png" class="button" alt="Add Security" title="Add Security" /> Add</span><br /><br />
                       </td>
                     </tr>
                   </table>
@@ -582,14 +582,14 @@
                           <tr>
                               <th width="1%" align="center" nowrap="nowrap">Acces Type</th>
                               <th nowrap="nowrap">WebID</th>
-                            <th width="1%" align="center" nowrap="nowrap">Web Access<br />(R)ead, (W)rite, (C)ontrol</th>
+                              <th width="1%" align="center" nowrap="nowrap">ACL: (R)ead, (W)rite</th>
                             <th width="1%" >Action</th>
                           </tr>
                             <tr id="f_tr_no"><td colspan="4"><b>No Security Properties</b></td></tr>
                         </table>
                       </td>
                       <td valign="top" nowrap="nowrap">
-                          <span class="button3 pointer" onclick="javascript: TBL.createRow('f', null, {fld_1: {mode: 42, onchange: function(){TBL.changeCell42(this);}}, fld_2: {mode: 43, imgCssText: 'display: none;'}, fld_3: {mode: 44, value: [1, 0, 0], tdCssText: 'width: 1%; text-align: center;'}});"><img src="image/add_16.png" border="0" alt="Add Security" title="Add Security" /> Add</span><br /><br />
+                          <span class="button pointer" onclick="javascript: TBL.createRow('f', null, {fld_1: {mode: 50, onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: 'F1', tdCssText: 'white-space: nowrap;', className: '_validate_ _uri_'}, fld_3: {mode: 52, value: [1, 0, 0], tdCssText: 'width: 1%; text-align: center;'}});"><img src="image/add_16.png" class="button" alt="Add Security" title="Add Security" /> Add</span><br /><br />
                       </td>
                     </tr>
                   </table>
@@ -769,6 +769,11 @@
                   <td>
                     <input name="f_folder" id="f_folder" value="<?V self.v_source ?>" class="field-short" />
                     <input type="button" class="button" onclick="javascript: ODRIVE.davFolderSelect ('f_folder');" value="Select" />
+              		  <![CDATA[
+              		    <script type="text/javascript">
+                        OAT.Loader.load(['dav'], function(){OAT.WebDav.init(davOptions);});
+              		    </script>
+              		  ]]>
                   </td>
                 </v:template>
                 <v:template type="simple" condition="(self.v_step = 'overwrite')">
diff --git a/appsrc/ODS-Briefcase/www/groups.vspx b/appsrc/ODS-Briefcase/www/groups.vspx
index b67ac7d..f752f64 100644
--- a/appsrc/ODS-Briefcase/www/groups.vspx
+++ b/appsrc/ODS-Briefcase/www/groups.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: groups.vspx,v 1.8.2.7 2010/07/09 14:37:01 source Exp $
+ -  $Id: groups.vspx,v 1.8.2.10 2010/10/13 12:15:00 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -38,12 +38,10 @@
     <vm:pagebody>
       <v:before-render>
         <![CDATA[
-          self.F1.uf_action := ODRIVE.WA.page_url (self.domain_id, 'groups.vspx');
+          self.F1.uf_action := ODRIVE.WA.utf2wide (ODRIVE.WA.page_url (self.domain_id, 'groups.vspx'));
         ]]>
       </v:before-render>
       <v:template type="simple" enabled="-- case when self.v_mode = 'browse' then 1 else 0 end">
-        <fieldset>
-          <legend><b>Regular groups</b></legend>
       	<v:data-source name="dsrc" expression-type="sql" nrows="0" initial-offset="0">
           <v:before-data-bind>
             <![CDATA[
@@ -179,134 +177,6 @@
           </v:template>
 
         </v:data-set>
-        </fieldset>
-
-        <vm:if test='not isnull (ODS.ODS_API."server.getInfo"('sslPort'))'>
-          <fieldset>
-            <legend><b>WebID groups</b></legend>
-          	<v:data-source name="fgrc" expression-type="sql" nrows="0" initial-offset="0">
-              <v:before-data-bind>
-                <![CDATA[
-                  control.ds_sql := sprintf('select FG_ID, FG_NAME, FG_DESCRIPTION from ODRIVE.WA.FOAF_GROUPS where FG_USER_ID=%d order by FG_NAME', self.account_id);
-                  control.ds_nrows := ODRIVE.WA.settings_rows (self.settings);
-                ]]>
-              </v:before-data-bind>
-            </v:data-source>
-            <v:data-set name="fg" data-source="self.fgrc" scrollable="1">
-              <div style="padding: 0 0 0.5em 0;">
-                <v:button action="simple" value="Create" xhtml_class="button">
-                  <v:on-post>
-                    <![CDATA[
-                      self.v_name := '';
-                      self.v_description := '';
-                      self.v_members := null;
-                      self.v_tabNo := 0;
-                      self.v_mode := 'fgCreate';
-
-             		      self.vc_data_bind(e);
-                    ]]>
-                  </v:on-post>
-                </v:button>
-                <v:button action="simple" value="Delete" xhtml_onclick="javascript: return deleteConfirm();" xhtml_class="button">
-                  <v:on-post>
-                    <![CDATA[
-                      declare N integer;
-
-                      for (N := 0; N < length (e.ve_params); N := N + 2)
-                      {
-                        if (e.ve_params[N] = 'fg_item')
-                          delete from ODRIVE.WA.FOAF_GROUPS where FG_ID = atoi(e.ve_params[N+1]);
-                      }
-
-             		      self.vc_data_bind(e);
-                    ]]>
-                  </v:on-post>
-                </v:button>
-              </div>
-              <v:template name="fg_header" type="simple" name-to-remove="table" set-to-remove="bottom">
-                <table id="groups" class="OD_grid colorise" cellspacing="0">
-                  <thead class="sortHeader">
-                    <tr class="nocolor">
-                      <th class="checkbox" width="1%">
-                        <input type="checkbox" name="fg_all" value="Select All" onclick="selectAllCheckboxes(this, 'fg_item')" />
-                      </th>
-                      <th>
-                        Name
-                      </th>
-                      <th>
-                        IRI
-                      </th>
-                      <th width="1%">
-                        Actions
-                      </th>
-                    </tr>
-                  </thead>
-                </table>
-              </v:template>
-
-              <v:template name="fg_repeat" type="repeat" name-to-remove="" set-to-remove="">
-
-                <v:template name="fg_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
-                  <table>
-                    <tr align="center">
-                      <td colspan="4">No WebID groups</td>
-                    </tr>
-                  </table>
-                </v:template>
-
-                <v:template name="fg_browse" type="browse" name-to-remove="table" set-to-remove="both">
-                  <table>
-                    <tr>
-                      <td align="center" valign="top">
-                        <input type="checkbox" name="fg_item" value="<?V (control as vspx_row_template).te_column_value('FG_ID') ?>" onclick="selectCheck(this, 'fg_item')" />
-                      </td>
-                      <td nowrap="nowrap">
-                        <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('FG_NAME')" format="%s"/>
-                      </td>
-                      <td nowrap="nowrap">
-                        <v:label value="--SIOC..waGroup(self.account_id, (control.vc_parent as vspx_row_template).te_column_value('FG_NAME'))" format="%s"/>
-                      </td>
-                      <td nowrap="nowrap">
-                        <v:button value="Edit" action="simple" xhtml_class="button">
-                          <v:on-post>
-                            <![CDATA[
-                              self.v_id := (control.vc_parent as vspx_row_template).te_column_value('FG_ID');
-                              select FG_NAME,
-                                     FG_DESCRIPTION,
-                                     FG_WEBIDS
-                                into self.v_name,
-                                     self.v_description,
-                                     self.v_members
-                                from ODRIVE.WA.FOAF_GROUPS
-                               where FG_ID = self.v_id;
-
-                              self.v_tabNo := 0;
-                              self.v_mode := 'fgUpdate';
-
-                    		      self.vc_data_bind(e);
-                            ]]>
-                          </v:on-post>
-                        </v:button>
-                      </td>
-                    </tr>
-                  </table>
-                </v:template>
-
-              </v:template>
-
-              <v:template type="simple" name-to-remove="table" set-to-remove="top">
-                <table>
-                  <tr align="center">
-                    <td colspan="4">
-                      <vm:fg-navigation data-set="fg"/>
-                    </td>
-                  </tr>
-                </table>
-              </v:template>
-
-            </v:data-set>
-          </fieldset>
-        </vm:if>
       </v:template>
 
       <v:template type="simple" enabled="--case when self.v_mode in ('create', 'update') then 1 else 0 end">
@@ -371,7 +241,7 @@
                           for (N := 0; N < length (self.v_members); N := N + 1)
                           {
                             if (length (self.v_members[N]))
-                              http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x", null, {fld_1: {mode: 1, value: "%s"}});});', self.v_members[N]));
+                              http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x", null, {fld_1: {mode: 1, value: "%s", form: "F1"}});});', self.v_members[N]));
                   }
                 ?>
                 		    </script>
@@ -380,7 +250,7 @@
                     </table>
                   </td>
                   <td valign="top" nowrap="nowrap">
-                    <span class="button3 pointer" onclick="javascript: TBL.createRow('x', null, {fld_1: {mode: 1}});"><img src="image/add_16.png" border="0" alt="Add Security" title="Add Security" /> Add</span>
+                    <span class="button3 pointer" onclick="javascript: TBL.createRow('x', null, {fld_1: {mode: 1, form: 'F1'}});"><img src="image/add_16.png" border="0" alt="Add Security" title="Add Security" /> Add</span>
                   </td>
                 </tr>
               </table>
@@ -483,149 +353,6 @@
         </script>
       </v:template>
 
-      <v:template type="simple" enabled="--case when self.v_mode in ('fgCreate', 'fgUpdate') then 1 else 0 end">
-        <input name="tabNo" id="tabNo" type="hidden" value="<?V self.v_tabNo ?>" />
-        <div class="new-form-header">
-          <v:label format="%s" value="--concat(initcap(subseq(self.v_mode, 2)), ' WebID Group')"/>
-        </div>
-
-        <div id="c1">
-          <div class="tabs">
-            <vm:tabCaption tab="1" tabs="2" caption="Main"/> 
-            <vm:tabCaption tab="2" tabs="2" caption="WebIDs"/> 
-          </div>
-          <div class="contents">
-            <div id="1" class="tabContent" style="display: none;">
-              <table class="form-body" cellspacing="0">
-                <tr>
-                  <th>
-                    <v:label for="fg_name" value="Group name"/>
-                  </th>
-                  <td>
-                    <v:text name="fg_name" value="--self.v_name" xhtml_class="field-short"/>
-                  </td>
-                </tr>
-                <tr>
-                  <th>
-                    <v:label for="fg_description" value="Group description"/>
-                  </th>
-                  <td>
-                    <v:text name="fg_description" value="--self.v_description" xhtml_class="field-text"/>
-                  </td>
-                </tr>
-              </table>
-            </div>
-
-            <div id="2" class="tabContent" style="display: none;">
-              <table>
-                <tr>
-                  <td width="800px">
-                    <table id="x_tbl" class="form-list" cellspacing="0">
-                      <thead>
-                        <tr>
-                          <th>
-                            Personal WebID
-                          </th>
-                          <th width="1%">
-                            Action
-                          </th>
-                        </tr>
-                      </thead>
-                		  <![CDATA[
-                		    <script type="text/javascript">
-                        <?vsp
-                		      declare N varchar;
-
-             		          self.v_members := split_and_decode (self.v_members, 0, '\0\0\n');
-                          if ((self.v_mode = 'fgCreate') and (length(self.v_members) = 0))
-             		            self.v_members := vector (SIOC..person_iri (SIOC..user_iri (self.account_id)));
-
-                          for (N := 0; N < length (self.v_members); N := N + 1)
-                          {
-                            if (length (self.v_members[N]))
-                              http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x", null, {fld_1: {mode: 43, className: "_validate_ _uri_", value: "%s"}});});', self.v_members[N]));
-                          }
-                        ?>
-                		    </script>
-                		  ]]>
-                      <tr id="x_tr_no"><td colspan="2"><b>No Personal WebIDs</b></td></tr>
-                    </table>
-                  </td>
-                  <td valign="top" nowrap="nowrap">
-                    <span class="button3 pointer" onclick="javascript: TBL.createRow('x', null, {fld_1: {mode: 43, className: '_validate_ _uri_'}});"><img src="image/add_16.png" border="0" alt="Add Security" title="Add Security" /> Add</span>
-                  </td>
-                </tr>
-              </table>
-            </div>
-          </div>
-        </div>
-
-        <div class="new-form-footer">
-          <v:button action="simple" value="--initcap (subseq (self.v_mode, 2))" xhtml_class="form-button" xhtml_onclick="return ODRIVE.validateInputs(this);">
-            <v:on-post>
-              <![CDATA[
-                declare N integer;
-                declare tmp, params any;
-                declare exit handler for SQLSTATE '*'
-                {
-                  if (__SQL_STATE = 'TEST')
-                  {
-                    self.vc_error_message := ODRIVE.WA.test_clear(__SQL_MESSAGE);
-                    self.vc_is_valid := 0;
-                    return;
-                  }
-                  resignal;
-                };
-
-                params := self.vc_page.vc_event.ve_params;
-                self.v_name := trim(self.fg_name.ufl_value);
-                self.v_description := trim(self.fg_description.ufl_value);
-
-                self.v_name := ODRIVE.WA.test(self.v_name, vector('name', 'Group name', 'class', 'varchar', 'minLength', 1, 'maxLength', 128));
-                self.v_description := ODRIVE.WA.test(self.v_description, vector('name', 'Group description', 'class', 'varchar', 'minLength', 0, 'maxLength', 255));
-
-                tmp := '';
-                for (N := 0; N < length (params); N := N + 2)
-                {
-                  if ((params [N] like 'x_fld_1_%') and (trim (params [N+1]) <> ''))
-                  {
-                    tmp := tmp || trim (params [N+1]) || '\n';
-                  }
-                }
-                self.v_members := tmp;
-                if (self.v_mode = 'fgCreate')
-                {
-                  insert into ODRIVE.WA.FOAF_GROUPS (FG_USER_ID, FG_NAME, FG_DESCRIPTION,  FG_WEBIDS)
-                    values (self.account_id, self.v_name, self.v_description, self.v_members);
-                } else {
-                  update ODRIVE.WA.FOAF_GROUPS
-                     set FG_NAME = self.v_name,
-                         FG_DESCRIPTION = self.v_description,
-                         FG_WEBIDS = self.v_members
-                   where FG_ID = self.v_id;
-                }
-
-                self.v_mode := 'browse';
-                  		    self.vc_data_bind(e);
-                        ]]>
-                      </v:on-post>
-                    </v:button>
-          <v:button action="simple" value="Cancel" xhtml_class="form-button">
-            <v:on-post>
-              <![CDATA[
-                self.v_mode := 'browse';
-         		    self.vc_data_bind(e);
-              ]]>
-            </v:on-post>
-          </v:button>
-        </div>
-
-        <script>
-          <![CDATA[
-            initTab(2, 1);
-          ]]>
-        </script>
-      </v:template>
     </vm:pagebody>
   </vm:pagewrapper>
 </v:page>
diff --git a/appsrc/ODS-Briefcase/www/home.vspx b/appsrc/ODS-Briefcase/www/home.vspx
index f4a3dcc..07bd3e4 100644
--- a/appsrc/ODS-Briefcase/www/home.vspx
+++ b/appsrc/ODS-Briefcase/www/home.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: home.vspx,v 1.30.2.18 2010/03/18 10:17:56 source Exp $
+ -  $Id: home.vspx,v 1.30.2.27 2011/03/23 12:19:08 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,24 +32,23 @@
       declare params any;
 
       params := self.vc_page.vc_event.ve_params;
+      self.search_dc := null;
       ODRIVE.WA.dc_set_base (self.search_dc, 'path', get_keyword ('ts_path', params));
 
-      declare N, M, seqNo integer;
-      declare fType, fSchema, fProperty, fCriteria, fValue any;
+      declare N, seqNo integer;
+      declare f0, f1, f2, f3, f4 any;
 
-      M := 0;
-      seqNo := cast (get_keyword ('search_seqNo', params, '0') as integer);
+      seqNo := cast (get_keyword ('search_no', params, '1') as integer);
       for (N := 0; N < seqNo; N := N + 1)
       {
-        fType := get_keyword (sprintf ('search_field_0_%d', N), params);
-        if (not isnull (fType))
+        f0 := get_keyword (sprintf ('search_field_0_%d', N), params);
+        if (not isnull (f0))
         {
-          fSchema := get_keyword (sprintf ('search_field_1_%d', N), params);
-          fProperty := get_keyword (sprintf ('search_field_2_%d', N), params);
-          fCriteria := get_keyword (sprintf ('search_field_3_%d', N), params);
-          fValue := get_keyword (sprintf ('search_field_4_%d', N), params);
-          ODRIVE.WA.dc_set_criteria (self.search_dc, cast (M as varchar), fType, fCriteria, fValue, fSchema, fProperty);
-          M := M + 1;
+          f1 := get_keyword (sprintf ('search_field_1_%d', N), params);
+          f2 := get_keyword (sprintf ('search_field_2_%d', N), params);
+          f3 := get_keyword (sprintf ('search_field_3_%d', N), params);
+          f4 := get_keyword (sprintf ('search_field_4_%d', N), params);
+          ODRIVE.WA.dc_set_criteria (self.search_dc, cast (N as varchar), f0, f3, f4, f1, f2);
         }
       }
       return ODRIVE.WA.dc_filter_check (self.search_dc, self.account_id);
@@ -635,12 +634,9 @@
             }
 
             -- ACI (Web Access)
-            if (self.dav_type = 'R')
-            {
               dav_aci := ODRIVE.WA.aci_n3 (ODRIVE.WA.aci_params (params));
               ODRIVE.WA.DAV_PROP_SET (dav_fullPath, 'virt:aci_meta_n3', dav_aci);
           }
-          }
 
           -- Folder
             if (self.dav_type = 'C')
@@ -664,6 +660,7 @@
                 itemList := DB.DBA.DAV_PROP_LIST_INT (DB.DBA.DAV_SEARCH_ID (dav_fullPath, 'C'), 'C', 'virt:%', 0);
                   foreach (any item in itemList) do
                   {
+                  if (item[0] <> 'virt:aci_meta_n3')
                   DB.DBA.DAV_PROP_REMOVE_INT (dav_fullPath, item[0], null, null, 0, 0, 0);
                   }
                 }
@@ -1077,7 +1074,7 @@
                     if (ODRIVE.WA.dav_get (_item, 'type') = 'R')
                     {
                       http_request_status ('HTTP/1.1 302 Found');
-                      http_header (sprintf ('Location: view.vsp?sid=%s&realm=%s&file=%U&mode=download\r\n', self.sid , self.realm, _path));
+                      http_header (sprintf ('Location: %s&mode=download&file=%U\r\n', ODRIVE.WA.page_url (self.domain_id, 'view.vsp', self.sid , self.realm), _path));
                     }
                     else
                     {
@@ -1340,12 +1337,18 @@
       <v:template name="tform_4" type="simple" enabled="-- equ(self.command, 10)">
         <v:before-data-bind>
           <![CDATA[
+            self.search_dc := null;
             self.dav_path := ODRIVE.WA.odrive_real_resource (self.source);
             self.dav_enable := 1;
             self.dav_propEnable := self.dav_enable;
             if (self.command_mode = 10)
             {
+              if (equ(self.dav_type, 'R') and (self.dav_path like '%,acl'))
+              {
+                self.dav_enable := 0;
+              } else {
               self.dav_enable := ODRIVE.WA.odrive_write_permission (self.dav_path);
+              }
               if (self.dav_enable)
                 ODRIVE.WA.det_action_enable (self.dav_path, 'edit');
               self.dav_item := ODRIVE.WA.DAV_INIT(self.dav_path);
@@ -1356,8 +1359,8 @@
                 return;
               }
               self.dav_propEnable := self.dav_enable;
-              if (self.dav_propEnable)
-                if (not isnull(DB.DBA.DAV_HIDE_ERROR(DB.DBA.DAV_PROP_GET_INT (ODRIVE.WA.DAV_GET (self.dav_item, 'id'), 'R', 'DAV:checked-in', 0))))
+              if (self.dav_propEnable and
+                  not isnull (DB.DBA.DAV_HIDE_ERROR(DB.DBA.DAV_PROP_GET_INT (ODRIVE.WA.DAV_GET (self.dav_item, 'id'), 'R', 'DAV:checked-in', 0))))
                   self.dav_propEnable := 0;
               self.dav_category := coalesce (ODRIVE.WA.det_category (self.dav_path, ODRIVE.WA.DAV_GET (self.dav_item, 'type')) , '');
             }
@@ -1412,7 +1415,7 @@
               <![CDATA[
                 if (self.command_mode = 10)
                 {
-                  control.ufl_value := 'Properties of ' || self.source;
+                  control.ufl_value := 'Properties of ' || ODRIVE.WA.utf2wide (self.source);
                 } else {
                   control.ufl_value := case when (self.command_mode = 5) then 'Upload file into ' when (self.command_mode = 6) then 'Create file into ' else 'Create folder in ' end || ODRIVE.WA.path_show (self.dir_path);
                 }
@@ -1423,13 +1426,13 @@
          <div id="c1">
           <div class="tabs">
             <vm:tabCaption tab="1" tabs="10" caption="Main" />
-            <v:template name="tform_5" type="simple" enabled="-- case when (equ (self.command_mode, 10) and ODRIVE.WA.det_action_enable (self.dav_path, 'share')) then 1 else 0 end">
+            <v:template name="tform_5" type="simple" enabled="-- case when (equ (self.command_mode, 10) and ODRIVE.WA.det_action_enable (self.dav_path, 'share') and not (equ(self.dav_type, 'R') and (ODRIVE.WA.DAV_GET (self.dav_item, 'name') like '%,acl'))) then 1 else 0 end">
             <vm:tabCaption tab="2" tabs="10" caption="Sharing" />
             </v:template>
             <v:template name="tform_6" type="simple" enabled="-- case when (equ (self.command_mode, 10) and ODRIVE.WA.dav_rdf_has_metadata (self.dav_path)) then 1 else 0 end">
             <vm:tabCaption tab="3" tabs="10" caption="Metadata" />
             </v:template>
-            <v:template name="tform_7" type="simple" enabled="-- case when (equ(self.command_mode, 10) and equ(self.dav_type, 'R') and ODRIVE.WA.det_action_enable(self.dav_path, 'version')) then 1 else 0 end">
+            <v:template name="tform_7" type="simple" enabled="-- case when (equ (self.command_mode, 10) and equ(self.dav_type, 'R') and ODRIVE.WA.det_action_enable (self.dav_path, 'version') and not (equ(self.dav_type, 'R') and (ODRIVE.WA.DAV_GET (self.dav_item, 'name') like '%,acl'))) then 1 else 0 end">
             <vm:tabCaption tab="9" tabs="10" caption="Versions" />
             </v:template>
             <v:template name="tform_8" type="simple" enabled="-- equ(self.dav_type, 'C')">
@@ -1502,8 +1505,8 @@
                     <span id="label_dav_rdf" style="display: none;"><v:label for="dav_name" value="--'RDF graph name'" /></span>
                   </th>
                   <td>
-                    <v:text name="dav_name" xhtml_id="dav_name" value="--get_keyword ('dav_name', self.vc_page.vc_event.ve_params, get_keyword ('TITLE', self.vc_page.vc_event.ve_params, ODRIVE.WA.DAV_GET (self.dav_item, 'name')))" format="%s" fmt-function="ODRIVE.WA.wide2utf" xhtml_disabled="disabled" xhtml_class="field-short" />
-                    <v:text name="dav_name_rdf" xhtml_id="dav_name_rdf" value="--get_keyword ('dav_name', self.vc_page.vc_event.ve_params, ODRIVE.WA.host_url() || WS.WS.FIXPATH(ODRIVE.WA.odrive_real_path(self.dir_path)))" format="%s" xhtml_disabled="disabled" xhtml_class="field-text" xhtml_style="display: none;" />
+                    <v:text name="dav_name" xhtml_id="dav_name" value="--get_keyword ('dav_name', self.vc_page.vc_event.ve_params, get_keyword ('TITLE', self.vc_page.vc_event.ve_params, ODRIVE.WA.DAV_GET (self.dav_item, 'name')))" format="%s" fmt-function="ODRIVE.WA.utf2wide" xhtml_disabled="disabled" xhtml_class="field-short" />
+                    <v:text name="dav_name_rdf" xhtml_id="dav_name_rdf" value="--get_keyword ('dav_name', self.vc_page.vc_event.ve_params, ODRIVE.WA.host_url() || WS.WS.FIXPATH(ODRIVE.WA.odrive_real_path(self.dir_path)))" format="%s" fmt-function="ODRIVE.WA.utf2wide" xhtml_disabled="disabled" xhtml_class="field-text" xhtml_style="display: none;" />
                   </td>
                 </tr>
                 <v:template name="tform_10" type="simple" enabled="-- equ(self.dav_type, 'R')">
@@ -1571,6 +1574,7 @@
                             http (self.option_prepare('rdfSink',          'RDF Upload Folder',             self.dav_detType));
                             http (self.option_prepare('RDFData',          'RDF Data',                      self.dav_detType));
                             http (self.option_prepare('S3',               'Amazon S3',                     self.dav_detType));
+                            http (self.option_prepare('DynaRes',          'Dynamic Resources',             self.dav_detType));
                           }
                         ?>
                       </select>
@@ -1590,9 +1594,9 @@
                         ]]>
                       </v:after-data-bind>
                     </v:text>
-                    <v:template name="tform_14" type="simple" enabled="-- case when (ODRIVE.WA.check_admin (self.account_id) and (self.dav_enable = 1)) then 1 else 0 end;">
-                      <input type="button" value="Select" onclick="javascript: windowShow('users_select.vspx?mode=u&params=dav_owner:s1;')" disabled="disabled" class="button" />
-                    </v:template>
+                    <vm:if test="ODRIVE.WA.check_admin (self.account_id) and self.dav_enable">
+                      <input type="button" value="Select" onclick="javascript: windowShow('/ods/users_select.vspx?form=F1&mode=u&params=dav_owner:s1;')" disabled="disabled" class="button" />
+                    </vm:if>
                   </td>
                 </tr>
                 <tr id="davRow_group">
@@ -1601,9 +1605,9 @@
                   </th>
                   <td>
                     <v:text name="dav_group" value="--get_keyword ('dav_group', self.vc_page.vc_event.ve_params, ODRIVE.WA.DAV_GET (self.dav_item, 'groupName'))" format="%s" xhtml_disabled="disabled" xhtml_class="field-short" />
-                    <v:template name="tform_15" type="simple" enabled="--self.dav_enable">
-                      <input type="button" value="Select" onclick="javascript: windowShow('users_select.vspx?mode=g&params=dav_group:s1;')" disabled="disabled" class="button" />
-                    </v:template>
+                    <vm:if test="self.dav_enable">
+                      <input type="button" value="Select" onclick="javascript: windowShow('/ods/users_select.vspx?form=F1&mode=g&params=dav_group:s1;')" disabled="disabled" class="button" />
+                    </vm:if>
                   </td>
                 </tr>
                 <tr id="davRow_perms">
@@ -1781,7 +1785,7 @@
                                     M := M + 1;
                                     if (self.dav_propEnable)
                                     {
-                                      http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("c", null, {fld_1: {mode: 40, value: "%s", className: "_validate_", onbBlur: function(){ODRIVE.validateField(this);}}, fld_2: {mode: 0, value: "%s"}});});', properties[N][0], properties[N][1]));
+                                      http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("c", null, {fld_1: {mode: 40, value: "%s", className: "_validate_", onbBlur: function(){validateField(this);}}, fld_2: {mode: 0, value: "%s"}});});', properties[N][0], properties[N][1]));
                                     } else {
                                       http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("c", {fld_1: {value: "%s"}, fld_2: {value: "%s"}});});', properties[N][0], properties[N][1]));
                                     }
@@ -1794,7 +1798,7 @@
                             </td>
                             <vm:if test="self.dav_propEnable">
                             <td valign="top" nowrap="nowrap">
-                              <span class="button3 pointer" onclick="javascript: TBL.createRow('c', null, {fld_1: {mode: 40, className: '_validate_', onblur: function(){ODRIVE.validateField(this);}}, fld_2: {mode: 0}});"><img src="image/add_16.png" border="0" alt="Add Property" title="Add Property" /> Add</span><br /><br />
+                              <span class="button pointer" onclick="javascript: TBL.createRow('c', null, {fld_1: {mode: 40, className: '_validate_', onblur: function(){validateField(this);}}, fld_2: {mode: 0}});"><img src="image/add_16.png" border="0" class="button" alt="Add Property" title="Add Property" /> Add</span><br /><br />
                               </td>
                             </vm:if>
                           </tr>
@@ -1835,9 +1839,9 @@
                       acl := acl_values[N];
                                 if (self.dav_enable and (acl[1] <> 3))
                                 {
-                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("s", null, {fld_1: {mode: 1, value: "%s"}, fld_2: {mode: 45, value: %d, objectType: "%s"}, fld_3: {mode: 44, value: [%d, %d, %d], suffix: "_grant", onclick: function(){TBL.clickCell44(this);}, tdCssText: "width: 1%%; text-align: center;"}, fld_4: {mode: 44, value: [%d, %d, %d], suffix: "_deny", onclick: function(){TBL.clickCell44(this);}, tdCssText: "width: 1%%; text-align: center;"}});});', ODRIVE.WA.account_name (acl[0]), acl[1], self.dav_type, bit_and (acl[2], 4), bit_and (acl[2], 2), bit_and (acl[2], 1), bit_and (acl[3], 4), bit_and (acl[3], 2), bit_and (acl[3], 1)));
+                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("s", null, {fld_1: {mode: 1, value: "%s", form: "F1", formMode: "u", tdCssText: "white-space: nowrap;"}, fld_2: {mode: 43, value: %d, objectType: "%s"}, fld_3: {mode: 42, value: [%d, %d, %d], suffix: "_grant", onclick: function(){TBL.clickCell42(this);}, tdCssText: "width: 1%%; text-align: center;"}, fld_4: {mode: 42, value: [%d, %d, %d], suffix: "_deny", onclick: function(){TBL.clickCell42(this);}, tdCssText: "width: 1%%; text-align: center;"}});});', ODRIVE.WA.account_name (acl[0]), acl[1], self.dav_type, bit_and (acl[2], 4), bit_and (acl[2], 2), bit_and (acl[2], 1), bit_and (acl[3], 4), bit_and (acl[3], 2), bit_and (acl[3], 1)));
                                 } else {
-                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 43, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}, fld_4: {mode: 44, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', ODRIVE.WA.account_name (acl[0]), get_keyword (acl[1], V, ''), bit_and (acl[2], 4), bit_and (acl[2], 2), bit_and (acl[2], 1), bit_and (acl[3], 4), bit_and (acl[3], 2), bit_and (acl[3], 1)));
+                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 42, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}, fld_4: {mode: 42, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', ODRIVE.WA.account_name (acl[0]), get_keyword (acl[1], V, ''), bit_and (acl[2], 4), bit_and (acl[2], 2), bit_and (acl[2], 1), bit_and (acl[3], 4), bit_and (acl[3], 2), bit_and (acl[3], 1)));
                                 }
                   }
                   ?>
@@ -1848,7 +1852,7 @@
                       </td>
                       <td valign="top" nowrap="nowrap">
                         <vm:if test="self.dav_enable">
-                          <span class="button3 pointer" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 1}, fld_2: {mode: 45, value: 1, objectType: '<?V self.dav_type ?>'}, fld_3: {mode: 44, value: [1, 1, 0], suffix: '_grant', onclick: function(){TBL.clickCell44(this);}, tdCssText: 'width: 1%; text-align: center;'}, fld_4: {mode: 44,  suffix: '_deny', onclick: function(){TBL.clickCell44(this);}, tdCssText: 'width: 1%; text-align: center;'}});"><img src="image/add_16.png" border="0" alt="Add Security" title="Add Security" /> Add</span><br /><br />
+                          <span class="button pointer" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 1, form: 'F1', formMode: 'u', tdCssText: 'white-space: nowrap;'}, fld_2: {mode: 43, value: 1, objectType: '<?V self.dav_type ?>'}, fld_3: {mode: 42, value: [1, 1, 0], suffix: '_grant', onclick: function(){TBL.clickCell42(this);}, tdCssText: 'width: 1%; text-align: center;'}, fld_4: {mode: 42,  suffix: '_deny', onclick: function(){TBL.clickCell42(this);}, tdCssText: 'width: 1%; text-align: center;'}});"><img src="image/add_16.png" border="0" class="button" alt="Add Security" title="Add Security" /> Add</span><br /><br />
                         </vm:if>
                       </td>
                     </tr>
@@ -1864,7 +1868,7 @@
                             <tr>
                               <th width="1%" nowrap="nowrap">Access Type</th>
                               <th nowrap="nowrap">WebID</th>
-                              <th width="1%" align="center" nowrap="nowrap">Web Access<br />(R)ead, (W)rite, (C)ontrol</th>
+                              <th width="1%" align="center" nowrap="nowrap">ACL: (R)ead, (W)rite</th>
                               <vm:if test="self.dav_enable">
                               <th width="1%" >Action</th>
                               </vm:if>
@@ -1872,30 +1876,37 @@
                         		  <![CDATA[
                         		    <script type="text/javascript">
                         		    <?vsp
-                                declare M, N integer;
-                                declare aci_values any;
+                                declare N, L integer;
+                                declare aci_values, aci_parents any;
 
-                                M := 0;
-                                aci_values := ODRIVE.WA.aci_load (self.dav_path);
+                                aci_parents := ODRIVE.WA.aci_parents (self.dav_path);
+                                for (L := 0; L < length (aci_parents); L := L + 1)
+                                {
+                                  aci_values := ODRIVE.WA.aci_load (aci_parents[L]);
                                   for (N := 0; N < length (aci_values); N := N + 1)
                                   {
-                                  M := M + 1;
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("f", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}, fld_4: {value: "Inherited"}});});', aci_values[N][2], aci_values[N][1], aci_values[N][3], aci_values[N][4], aci_values[N][5]));
+                                  }
+                                }
+                                aci_values := ODRIVE.WA.aci_load (self.dav_path);
+                                for (N := 0; N < length (aci_values); N := N + 1)
+                                {
                                   if (self.dav_enable)
                                   {
-                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("f", null, {fld_1: {mode: 42, value: "%s", onchange: function(){TBL.changeCell42(this);}}, fld_2: {mode: 43, className: "_validate_ _uri_", value: "%s", readOnly: %s, imgCssText: "%s"}, fld_3: {mode: 44, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', aci_values[N][2], aci_values[N][1], case when aci_values[N][2] = 'public' then 'true' else 'false' end, case when aci_values[N][2] = 'public' then 'display: none;' else '' end, aci_values[N][3], aci_values[N][4], aci_values[N][5]));
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("f", null, {fld_1: {mode: 50, value: "%s", onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: "F1", tdCssText: "white-space: nowrap;", className: "_validate_ _webid_", value: "%s", readOnly: %s, imgCssText: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', aci_values[N][2], aci_values[N][1], case when aci_values[N][2] = 'public' then 'true' else 'false' end, case when aci_values[N][2] = 'public' then 'display: none;' else '' end, aci_values[N][3], aci_values[N][4], aci_values[N][5]));
                                   } else {
-                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("f", {fld_1: {value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 43, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', initcap (aci_values[N][2]), aci_values[N][1], aci_values[N][3], aci_values[N][4], aci_values[N][5]));
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("f", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', aci_values[N][2], aci_values[N][1], aci_values[N][3], aci_values[N][4], aci_values[N][5]));
                                   }
                                   }
                         		    ?>
                         		    </script>
                         		  ]]>
-                            <tr id="f_tr_no" style="display: <?V case when M=0 then '' else 'none' end ?>;"><td colspan="<?V case when self.dav_enable then 3 else 4 end ?>"><b>No WebID Security</b></td></tr>
+                            <tr id="f_tr_no"><td colspan="<?V case when self.dav_enable then 3 else 4 end ?>"><b>No WebID Security</b></td></tr>
                           </table>
                         </td>
                         <vm:if test="self.dav_enable">
                         <td valign="top" nowrap="nowrap">
-                            <span class="button3 pointer" onclick="javascript: TBL.createRow('f', null, {fld_1: {mode: 42, onchange: function(){TBL.changeCell42(this);}}, fld_2: {mode: 43, className: '_validate_ _uri_'}, fld_3: {mode: 44, value: [1, 0, 0], tdCssText: 'width: 1%; text-align: center;'}});"><img src="image/add_16.png" border="0" alt="Add Security" title="Add Security" /> Add</span><br /><br />
+                            <span class="button pointer" onclick="javascript: TBL.createRow('f', null, {fld_1: {mode: 50, onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: 'F1', tdCssText: 'white-space: nowrap;', className: '_validate_ _webid_'}, fld_3: {mode: 52, value: [1, 0, 0], tdCssText: 'width: 1%; text-align: center;'}});"><img src="image/add_16.png" border="0" class="button" alt="Add Security" title="Add Security" /> Add</span><br /><br />
                         </td>
                         </vm:if>
                       </tr>
@@ -2004,7 +2015,7 @@
           </div>
         </div>
         <div class="new-form-footer">
-          <v:button action="simple" name="cCreate" value="--case when (self.command_mode >= 10) then 'Update' else case when (self.command_mode = 5) then 'Upload' else 'Create' end end" enabled="--self.dav_enable" xhtml_onclick="return ODRIVE.validateInputs(this);"/>
+          <v:button action="simple" name="cCreate" value="--case when (self.command_mode >= 10) then 'Update' else case when (self.command_mode = 5) then 'Upload' else 'Create' end end" enabled="--self.dav_enable" xhtml_onclick="return validateInputs(this);"/>
           <v:button action="simple" name="cCancel" value="Cancel" >
             <v:on-post>
               <![CDATA[
@@ -2263,7 +2274,10 @@
 
                               if (self.dir_path <> '')
                               {
-                                http (sprintf ('<td align="center"><input type="checkbox" name="cb_item" value="%s" onclick="selectCheck (this, \'cb_item\')"/></td>', rowset[8]));
+                                http (         '<td align="center">');
+                                if (rowset[8] not like '%,acl')
+                                  http (sprintf ('  <input type="checkbox" name="cb_item" value="%s" onclick="selectCheck (this, \'cb_item\')"/>', rowset[8]));
+                                http (         '</td>');
                               }
                             ?>
                             <td nowrap="nowrap">
@@ -2272,7 +2286,7 @@
 
                                 rowset := (control as vspx_row_template).te_rowset;
                                 id := case when (rowset[1] = 'R') then sprintf ('id=%V', rowset[8]) else '' end;
-                                http (sprintf ('<a %s href="%s" onclick="javascript: vspxPost(\'action\', \'_cmd\', \'select\', \'_path\', \'%s\'); return false;" title="%s"><img src="%s" border="0" /> %V</a>', id, ODRIVE.WA.dav_url (rowset[8]), replace (rowset[8], '\'', '\\\''), ODRIVE.WA.utf2wide (rowset[0]), ODRIVE.WA.ui_image(rowset[8], rowset[1], rowset[4]), ODRIVE.WA.stringCut (rowset[0], self.chars)));
+                                http (sprintf ('<a %s href="%s" onclick="javascript: vspxPost(\'action\', \'_cmd\', \'select\', \'_path\', \'%s\'); return false;" title="%s"><img src="%s" border="0" /> %V</a>', id, ODRIVE.WA.dav_url (rowset[8]), replace (rowset[8], '\'', '\\\''), ODRIVE.WA.utf2wide (rowset[0]), ODRIVE.WA.ui_image(rowset[8], rowset[1], rowset[4]), ODRIVE.WA.utf2wide (ODRIVE.WA.stringCut (rowset[0], self.chars))));
                               ?>
                               <v:template type="simple" enabled="-- case when (self.command_mode <> 3 or is_empty_or_null(ODRIVE.WA.dc_get (self.search_dc, 'base', 'content'))) then 0 else 1 end">
                                 <br /><i><v:label value="--ODRIVE.WA.content_excerpt((((control.vc_parent).vc_parent as vspx_row_template).te_rowset[8]), ODRIVE.WA.dc_get(self.search_dc, 'base', 'content'))" format="%s" /></i>
diff --git a/appsrc/ODS-Briefcase/www/js/odrive.js b/appsrc/ODS-Briefcase/www/js/odrive.js
index 777c4d1..1dff572 100644
--- a/appsrc/ODS-Briefcase/www/js/odrive.js
+++ b/appsrc/ODS-Briefcase/www/js/odrive.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: odrive.js,v 1.15.2.12 2010/07/09 14:37:01 source Exp $
+ *  $Id: odrive.js,v 1.15.2.18 2010/10/07 13:23:47 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -20,6 +20,15 @@
  *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  *
  */
+function setFooter() {
+  if ($('dav_list')) {
+    var wDims = OAT.Dom.getViewport()
+    var hDims = OAT.Dom.getWH('FT')
+    var cPos = OAT.Dom.position('dav_list')
+    $('dav_list').style.height = (wDims[1] - hDims[1] - cPos[1] - 20) + 'px';
+  }
+}
+
 function urlParam(fldName)
 {
   var O = document.forms[0].elements[fldName];
@@ -28,13 +37,6 @@ function urlParam(fldName)
   return '';
 }
 
-function myA(obj) {
-  if (obj.href) {
-    document.location = obj.href + '?' + urlParam('sid') + urlParam('realm');
-    return false;
-  }
-}
-
 function myPost(frm_name, fld_name, fld_value)
 {
   createHidden(frm_name, fld_name, fld_value);
@@ -500,7 +502,7 @@ function webidShow(obj, width, height)
   if (obj.id.replace('fld_2', 'fld_1') != obj.id)
     S = $v(obj.id.replace('fld_2', 'fld_1'));
 
-  windowShow('webid_select.vspx?mode='+S.charAt(0)+'&params='+obj.id+':s1;', width, height);
+  windowShow('/ods/webid_select.vspx?form=F1&mode='+S.charAt(0)+'&params='+obj.id+':s1;', width, height);
 }
 
 function windowShow(sPage, width, height)
@@ -861,13 +863,13 @@ ODRIVE.readCookie = function (name)
   return false;
 }
 
-ODRIVE.readField = function (field, doc)
+ODRIVE.readField = function (fld, doc)
 {
   var v;
   if (!doc) {doc = document;}
   if (doc.forms[0])
   {
-    v = doc.forms[0].elements[field];
+    v = doc.forms[0].elements[fld];
     if (v)
     {
       v = v.value;
@@ -876,12 +878,12 @@ ODRIVE.readField = function (field, doc)
   return v;
 }
 
-ODRIVE.createParam = function (field, doc)
+ODRIVE.createParam = function (fld, doc)
 {
   var S = '';
-  var v = ODRIVE.readField(field, doc);
+  var v = ODRIVE.readField(fld, doc);
   if (v)
-    S = '&'+field+'='+ encodeURIComponent(v);
+    S = '&'+fld+'='+ encodeURIComponent(v);
   return S;
 }
 
@@ -1049,148 +1051,116 @@ ODRIVE.formPostAfter = function (action)
 {
   var formParams = action.split('/')[0].toLowerCase();
   var form = ODRIVE.forms[formParams];
-  if (form)
-  {
+  if (form) {
     var actions = form.postActions;
-    if (actions)
-    {
+    if (actions) {
       for (var i = 0; i < actions.length; i++)
-      {
         eval(actions[i]);
       }
     }
   }
-}
 
-ODRIVE.searchRowAction = function (rowID)
+ODRIVE.searchRowAction = function (No)
 {
   var tbody = $('search_tbody');
   if (tbody)
   {
-    var seqNo = parseInt($v('search_seqNo'));
-    if (seqNo == rowID)
-    {
-      var span = $('search_span_5_' + seqNo);
-      if (span)
-      {
-        var S = span.innerHTML;
-        S = S.replace(/add_16/g, 'del_16');
-        S = S.replace(/Add/g, 'Delete');
-        span.innerHTML = S;
-      }
-      OAT.Dom.unlink('search_tr');
-      var tr = OAT.Dom.create('tr');
-      tr.id = 'search_tr';
-      var td = OAT.Dom.create('td');
-      td.colSpan = '6';
-      td.appendChild(OAT.Dom.create('hr'));
-      tr.appendChild(td);
-      tbody.appendChild(tr);
-
-      seqNo++;
-      $('search_seqNo').value = seqNo;
-      ODRIVE.searchRowCreate(seqNo);
-    }
-    else
-    {
-      OAT.Dom.unlink('search_tr_'+rowID);
+    OAT.Dom.unlink('search_tr_'+No);
       ODRIVE.searchColumnHide(1);
       ODRIVE.searchColumnHide(2);
+    var No = parseInt($v('search_no'));
+    for (var N = 0; N < No; N++)
+    {
+      if ($('search_tr_'+N))
+        return;
     }
+    OAT.Dom.show('search_tr_no');
   }
 }
 
-ODRIVE.searchRowCreate = function (rowID, values)
+ODRIVE.searchRowCreate = function (values)
 {
   var tbody = $('search_tbody');
-  if (tbody)
-  {
-    var seqNo = parseInt($v('search_seqNo'));
-    var tr = OAT.Dom.create('tr');
-    tr.id = 'search_tr_' + rowID;
-    if (seqNo != rowID)
-    {
-      tr_line = $('search_tr');
-      tbody.insertBefore(tr, tr_line);
+  if (tbody) {
+    if (!$('search_no')) {
+    	var fld = OAT.Dom.create("input");
+      fld.type = 'hidden';
+      fld.name = 'search_no';
+      fld.id = fld.name;
+      fld.value = '0';
+      tbody.appendChild(fld);
     }
-    else
-    {
+    var No = parseInt($v('search_no'));
+    OAT.Dom.hide ('search_tr_no');
+
+    var tr = OAT.Dom.create('tr');
+    tr.id = 'search_tr_' + No;
       tbody.appendChild(tr);
-    }
     if (!values)
       values = new Object();
 
     var td = OAT.Dom.create('td');
-    td.id = 'search_td_0_' + rowID;
+    td.id = 'search_td_0_' + No;
     tr.appendChild(td);
-    ODRIVE.searchColumnCreate(rowID, 0, values['field_0']);
+    ODRIVE.searchColumnCreate(No, 0, values['field_0']);
 
     var td = OAT.Dom.create('td');
-    td.id = 'search_td_1_' + rowID;
-    if (ODRIVE.searchColumnHideCheck(1))
-    {
+    td.id = 'search_td_1_' + No;
+    if (!values['field_1'])
       td.style.display = 'none';
-    }
     tr.appendChild(td);
     if (values['field_1'])
-      ODRIVE.searchColumnCreate(rowID, 1, values['field_1']);
+      ODRIVE.searchColumnCreate(No, 1, values['field_1']);
 
     var td = OAT.Dom.create('td');
-    td.id = 'search_td_2_' + rowID;
-    if (ODRIVE.searchColumnHideCheck(2))
-    {
+    td.id = 'search_td_2_' + No;
+    if (!values['field_2'])
       td.style.display = 'none';
-    }
     tr.appendChild(td);
     if (values['field_2'])
-      ODRIVE.searchColumnCreate(rowID, 2, values['field_2']);
+      ODRIVE.searchColumnCreate(No, 2, values['field_2']);
 
     var td = OAT.Dom.create('td');
-    td.id = 'search_td_3_' + rowID;
+    td.id = 'search_td_3_' + No;
     tr.appendChild(td);
     if (values['field_3'])
-      ODRIVE.searchColumnCreate(rowID, 3, values['field_3']);
+      ODRIVE.searchColumnCreate(No, 3, values['field_3']);
 
     var td = OAT.Dom.create('td');
-    td.id = 'search_td_4_' + rowID;
+    td.id = 'search_td_4_' + No;
     tr.appendChild(td);
     if (values['field_4'])
-      ODRIVE.searchColumnCreate(rowID, 4, values['field_4']);
+      ODRIVE.searchColumnCreate(No, 4, values['field_4']);
 
     var td = OAT.Dom.create('td');
-    td.id = 'search_td_5_' + rowID;
+    td.id = 'search_td_5_' + No;
     td.style['whiteSpace'] = 'nowrap';
     var span = OAT.Dom.create('span');
-    span.id = 'search_span_5_' + rowID;
-    span.onclick = function (){ODRIVE.searchRowAction(rowID)};
-    OAT.Dom.addClass(span, 'button3');
+    span.onclick = function (){ODRIVE.searchRowAction(No)};
+    OAT.Dom.addClass(span, 'button');
     OAT.Dom.addClass(span, 'pointer');
-    var imgSrc = (seqNo != rowID)? 'image/del_16.png': 'image/add_16.png';
-    var img = OAT.Dom.image(imgSrc);
-    img.id = 'search_img_5_' + rowID;
+    var img = OAT.Dom.image('/ods/images/icons/trash_16.png');
+    OAT.Dom.addClass(img, 'button');
     span.appendChild(img);
-    span.appendChild((seqNo != rowID)? OAT.Dom.text(' Delete'): OAT.Dom.text(' Add'));
+    span.appendChild(OAT.Dom.text(' Delete'));
     td.appendChild(span);
     tr.appendChild(td);
-    if (values['field_5'])
-      ODRIVE.searchColumnCreate(rowID, 5, values['field_5']);
+
+    $('search_no').value = No + 1;
+
   }
 }
 
-ODRIVE.searchColumnsInit = function (rowID, columnNo)
-{
-  var tr = $('search_tr_' + rowID);
-  if (tr)
+ODRIVE.searchColumnsInit = function (No, columnNo)
   {
+  var tr = $('search_tr_' + No);
+  if (tr) {
     var tds = tr.getElementsByTagName("td");
     for (var i = columnNo; i < tds.length-1; i++)
-    {
       tds[i].innerHTML = '';
-    }
+
     if (columnNo == 0)
-    {
-      ODRIVE.searchColumnCreate(rowID, columnNo)
-    }
+      ODRIVE.searchColumnCreate(No, columnNo)
     if (columnNo <= 1)
       ODRIVE.searchColumnHide(1)
     if (columnNo <= 2)
@@ -1198,150 +1168,129 @@ ODRIVE.searchColumnsInit = function (rowID, columnNo)
   }
 }
 
-ODRIVE.searchColumnCreate = function (rowID, columnNo, columnValue)
+ODRIVE.searchColumnCreate = function (No, columnNo, columnValue)
 {
-  var tr = $('search_tr_' + rowID);
+  var tr = $('search_tr_' + No);
   if (tr)
   {
-    var td = $('search_td_' + columnNo + '_' + rowID);
-    if (td)
-    {
-      var predicate = ODRIVE.searchGetPredicate(rowID);
-      if (columnNo == 0)
-      {
-        var field = OAT.Dom.create('select');
-        field.id = 'search_field_' + columnNo + '_' + rowID;
-        field.name = field.id;
-        field.style.width = '95%';
-        OAT.Dom.option('', '', field);
+    var td = $('search_td_' + columnNo + '_' + No);
+    if (td) {
+      var predicate = ODRIVE.searchGetPredicate(No);
+      if (columnNo == 0) {
+        var fld = OAT.Dom.create('select');
+        fld.id = 'search_field_' + columnNo + '_' + No;
+        fld.name = fld.id;
+        fld.style.width = '95%';
+        OAT.Dom.option('', '', fld);
         for (var i = 0; i < ODRIVE.searchPredicates.length; i = i + 2)
         {
           if (ODRIVE.searchPredicates[i+1][0] == 1)
-          {
-            OAT.Dom.option(ODRIVE.searchPredicates[i+1][1], ODRIVE.searchPredicates[i], field);
-          }
+            OAT.Dom.option(ODRIVE.searchPredicates[i+1][1], ODRIVE.searchPredicates[i], fld);
         }
         if (columnValue)
-          field.value = columnValue;
-        field.onchange = function(){ODRIVE.searchColumnChange(this)};
-        td.appendChild(field);
+          fld.value = columnValue;
+        fld.onchange = function(){ODRIVE.searchColumnChange(this)};
+        td.appendChild(fld);
       }
-      if (columnNo == 1)
+      else if (columnNo == 1)
       {
-        if (predicate && (predicate[2] == 'rdfSchema'))
-        {
-          var field = OAT.Dom.create('select');
-          field.id = 'search_field_' + columnNo + '_' + rowID;
-          field.name = field.id;
-          field.style.width = '95%';
-          OAT.Dom.option('', '', field);
-          td.appendChild(field);
+        if (predicate && (predicate[2] == 'rdfSchema')) {
+          var fld = OAT.Dom.create('select');
+          fld.id = 'search_field_' + columnNo + '_' + No;
+          fld.name = fld.id;
+          fld.style.width = '95%';
+          OAT.Dom.option('', '', fld);
+          td.appendChild(fld);
+          ODRIVE.searchColumnShow(1);
 
           var x = function(data) {
             var o = OAT.JSON.parse(data);
             for (var i = 0; i < o.length; i = i + 2)
-            {
-              OAT.Dom.option(o[i+1], o[i], field);
-            }
+              OAT.Dom.option(o[i+1], o[i], fld);
+
             if (columnValue)
-              field.value = columnValue;
-            field.onchange = function(){ODRIVE.searchColumnChange(this)};
+              fld.value = columnValue;
+            fld.onchange = function(){ODRIVE.searchColumnChange(this)};
           }
           var s = 'ajax.vsp?a=search&sa=schemas';
-          OAT.AJAX.GET(s, '', x);
-          ODRIVE.searchColumnShow(1);
+          OAT.AJAX.GET(s, '', x, {async: false});
         }
       }
-      if (columnNo == 2)
+      else if (columnNo == 2)
       {
-        if (predicate && (predicate[3] == 'davProperties'))
-        {
-          var cl = new OAT.Combolist([], '');
-          cl.input.id = 'search_field_' + columnNo + '_' + rowID;;
-          cl.input.name = cl.input.id;
-          cl.input.style.width = "90%";
-          if (columnValue)
-            cl.input.value = columnValue;
-          td.appendChild(cl.div);
-          ODRIVE.propertyAddOptions(cl);
+        if (predicate && (predicate[3] == 'davProperties')) {
+          TBL.createCell40(td, 'search', 'search_field_'+columnNo+'_'+No, No, {value: columnValue})
           ODRIVE.searchColumnShow(2);
         }
-        if (predicate && (predicate[3] == 'rdfProperties'))
+        else if (predicate && (predicate[3] == 'rdfProperties'))
         {
-          var fieldSchema = $('search_field_1_' + rowID)
-          if (fieldSchema && (fieldSchema.value != ''))
-          {
-            var field = OAT.Dom.create('select');
-            field.id = 'search_field_' + columnNo + '_' + rowID;
-            field.name = field.id;
-            field.style.width = '95%';
-            OAT.Dom.option('', '', field);
-            td.appendChild(field);
+          var fldSchema = $('search_field_1_' + No)
+          if (fldSchema && (fldSchema.value != '')) {
+            var fld = OAT.Dom.create('select');
+            fld.id = 'search_field_' + columnNo + '_' + No;
+            fld.name = fld.id;
+            fld.style.width = '95%';
+            OAT.Dom.option('', '', fld);
+            td.appendChild(fld);
+            ODRIVE.searchColumnShow(2);
 
             var x = function(data) {
               var o = OAT.JSON.parse(data);
               for (var i = 0; i < o.length; i = i + 2)
-              {
-                OAT.Dom.option(o[i+1], o[i], field);
-              }
+                OAT.Dom.option(o[i+1], o[i], fld);
+
               if (columnValue)
-                field.value = columnValue;
+                fld.value = columnValue;
             }
-            var s = 'ajax.vsp?a=search&sa=schemaProperties&schema='+fieldSchema.value;
+            var s = 'ajax.vsp?a=search&sa=schemaProperties&schema='+fldSchema.value;
             OAT.AJAX.GET(s, '', x);
-            ODRIVE.searchColumnShow(2);
           }
         }
       }
-      if (columnNo == 3)
+      else if (columnNo == 3)
       {
-        var field = OAT.Dom.create('select');
-        field.id = 'search_field_' + columnNo + '_' + rowID;
-        field.name = field.id;
-        field.style.width = '95%';
-        OAT.Dom.option('', '', field);
+        var fld = OAT.Dom.create('select');
+        fld.id = 'search_field_' + columnNo + '_' + No;
+        fld.name = fld.id;
+        fld.style.width = '95%';
+        OAT.Dom.option('', '', fld);
         var predicateType = predicate[4];
-        for (var i = 0; i < ODRIVE.searchCompares.length; i = i + 2)
-        {
+        for (var i = 0; i < ODRIVE.searchCompares.length; i = i + 2) {
           var compareTypes = ODRIVE.searchCompares[i+1][1];
           for (var j = 0; j < compareTypes.length; j++)
           {
             if (compareTypes[j] == predicateType)
-            {
-              OAT.Dom.option(ODRIVE.searchCompares[i+1][0], ODRIVE.searchCompares[i], field);
-            }
+              OAT.Dom.option(ODRIVE.searchCompares[i+1][0], ODRIVE.searchCompares[i], fld);
           }
         }
         if (columnValue)
-          field.value = columnValue;
-        td.appendChild(field);
+          fld.value = columnValue;
+        td.appendChild(fld);
       }
-      if (columnNo == 4)
+      else if (columnNo == 4)
       {
     		var properties = OAT.Dom.create("input");
-    		var field = OAT.Dom.create("input");
-    		field.type = 'text';
-        field.id = 'search_field_' + columnNo + '_' + rowID;
-        field.name = field.id;
-        field.style.width = '93%';
+    		var fld = OAT.Dom.create("input");
+    		fld.type = 'text';
+        fld.id = 'search_field_' + columnNo + '_' + No;
+        fld.name = fld.id;
+        fld.style.width = '93%';
         if (columnValue)
-          field.value = columnValue;
-        td.appendChild(field);
-        for (var i = 0; i < predicate[5].length; i = i + 2)
-        {
-          if (predicate[5][i] == 'size')
-          {
-    		    field['size'] = predicate[5][i+1];
-            field.style.width = null;
+          fld.value = columnValue;
+        td.appendChild(fld);
+        for (var i = 0; i < predicate[5].length; i = i + 2) {
+          if (predicate[5][i] == 'size') {
+    		    fld['size'] = predicate[5][i+1];
+            fld.style.width = null;
           }
-          if (predicate[5][i] == 'onclick')
+          else if (predicate[5][i] == 'onclick')
           {
-			      OAT.Event.attach(field, "click", new Function((predicate[5][i+1]).replace(/-FIELD-/g, field.id)));
+			      OAT.Event.attach(fld, "click", new Function((predicate[5][i+1]).replace(/-FIELD-/g, fld.id)));
           }
-          if (predicate[5][i] == 'button')
+          else if (predicate[5][i] == 'button')
           {
     		    var span = OAT.Dom.create("span");
-    		    span.innerHTML = ' ' + (predicate[5][i+1]).replace(/-FIELD-/g, field.id);
+    		    span.innerHTML = ' ' + (predicate[5][i+1]).replace(/-FIELD-/g, fld.id);
             td.appendChild(span);
           }
         }
@@ -1352,8 +1301,8 @@ ODRIVE.searchColumnCreate = function (rowID, columnNo, columnValue)
 
 ODRIVE.searchColumnShow = function (columnNo)
 {
-  var seqNo = parseInt($v('search_seqNo'));
-  for (var i = 0; i <= seqNo; i++)
+  var No = parseInt($v('search_no'));
+  for (var i = 0; i <= No; i++)
   {
     var td = $('search_td_' + columnNo + '_' + i);
     if (td)
@@ -1364,8 +1313,8 @@ ODRIVE.searchColumnShow = function (columnNo)
 
 ODRIVE.searchColumnHideCheck = function (columnNo)
 {
-  var seqNo = parseInt($v('search_seqNo'));
-  for (var i = 0; i <= seqNo; i++)
+  var No = parseInt($v('search_no'));
+  for (var i = 0; i <= No; i++)
   {
     var td = $('search_td_' + columnNo + '_' + i);
     if (td && (td.innerHTML != '')) {return false;}
@@ -1377,8 +1326,8 @@ ODRIVE.searchColumnHide = function (columnNo)
 {
   if (ODRIVE.searchColumnHideCheck(columnNo))
   {
-    var seqNo = parseInt($v('search_seqNo'));
-    for (var i = 0; i <= seqNo; i++)
+    var No = parseInt($v('search_no'));
+    for (var i = 0; i <= No; i++)
     {
       var td = $('search_td_' + columnNo + '_' + i);
       if (td)
@@ -1392,42 +1341,42 @@ ODRIVE.searchColumnChange = function (obj)
 {
   var parts = obj.id.split('_');
   var columnNo = parseInt(parts[2]);
-  var rowID = parts[3];
-  var predicate = ODRIVE.searchGetPredicate(rowID);
+  var No = parts[3];
+  var predicate = ODRIVE.searchGetPredicate(No);
   if (columnNo == 0)
   {
-    ODRIVE.searchColumnsInit(rowID, 1);
+    ODRIVE.searchColumnsInit(No, 1);
     if (obj.value == '') {return;}
     if (predicate && (predicate[2]))
     {
-      ODRIVE.searchColumnCreate(rowID, 1)
+      ODRIVE.searchColumnCreate(No, 1)
       return;
     }
   }
   if (columnNo == 1)
   {
-    ODRIVE.searchColumnsInit(rowID, 2);
+    ODRIVE.searchColumnsInit(No, 2);
     if (obj.value == '') {return;}
   }
   if (predicate)
   {
     if (predicate[3])
     {
-      ODRIVE.searchColumnCreate(rowID, 2)
+      ODRIVE.searchColumnCreate(No, 2)
     }
-    ODRIVE.searchColumnCreate(rowID, 3)
-    ODRIVE.searchColumnCreate(rowID, 4)
+    ODRIVE.searchColumnCreate(No, 3)
+    ODRIVE.searchColumnCreate(No, 4)
   }
 }
 
-ODRIVE.searchGetPredicate = function (rowID)
+ODRIVE.searchGetPredicate = function (No)
 {
-  var field = $('search_field_0_' + rowID)
-  if (field)
+  var fld = $('search_field_0_' + No)
+  if (fld)
   {
     for (var i = 0; i < ODRIVE.searchPredicates.length; i = i + 2)
     {
-      if (ODRIVE.searchPredicates[i] == field.value)
+      if (ODRIVE.searchPredicates[i] == fld.value)
       {
         return ODRIVE.searchPredicates[i+1];
       }
@@ -1439,8 +1388,7 @@ ODRIVE.searchGetPredicate = function (rowID)
 ODRIVE.searchGetCompares = function (predicate)
 {
   if (predicate)
-  {
-  }
+  {}
   return null;
 }
 
@@ -1497,56 +1445,6 @@ ODRIVE.aboutDialog = function ()
   OAT.AJAX.POST("ajax.vsp", "a=about", x, {type:OAT.AJAX.TYPE_TEXT, onstart:function(){}, onerror:function(){}});
 }
 
-ODRIVE.validateError = function (fld, msg)
-{
-  alert(msg);
-  setTimeout(function(){fld.focus();}, 1);
-  return false;
-}
-
-ODRIVE.validateMail = function (fld)
-{
-  if ((fld.value.length == 0) || (fld.value.length > 40))
-    return ODRIVE.validateError(fld, 'E-mail address cannot be empty or longer then 40 chars');
-
-  var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
-  if (!regex.test(fld.value))
-    return ODRIVE.validateError(fld, 'Invalid E-mail address');
-
-  return true;
-}
-
-ODRIVE.validateURL = function (fld)
-{
-  var regex = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
-  if (!regex.test(fld.value))
-    return ODRIVE.validateError(fld, 'Invalid URL address');
-
-  return true;
-}
-
-ODRIVE.validateURI = function (fld)
-{
-  var regex = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
-  if (!regex.test(fld.value))
-    return ODRIVE.validateError(fld, 'Invalid URI address');
-
-  return true;
-}
-
-ODRIVE.validateField = function (fld)
-{
-  if ((fld.value.length == 0) && OAT.Dom.isClass(fld, '_canEmpty_'))
-    return true;
-  if (OAT.Dom.isClass(fld, '_mail_'))
-    return ODRIVE.validateMail(fld);
-  if (OAT.Dom.isClass(fld, '_url_'))
-    return ODRIVE.validateURL(fld);
-  if (OAT.Dom.isClass(fld, '_uri_'))
-    return ODRIVE.validateURI(fld);
-  return true;
-}
-
 ODRIVE.validateInputs = function (fld)
 {
   var retValue = true;
diff --git a/appsrc/ODS-Briefcase/www/js/tbl.js b/appsrc/ODS-Briefcase/www/js/tbl.js
index fb4cc94..6bda4f5 100644
--- a/appsrc/ODS-Briefcase/www/js/tbl.js
+++ b/appsrc/ODS-Briefcase/www/js/tbl.js
@@ -40,7 +40,8 @@ TBL.createCell40 = function (td, prefix, fldName, No, fldOptions)
   return fld;
 }
 
-TBL.createCell41 = function (td, prefix, fldName, No, fldOptions) {
+TBL.createCell41 = function (td, prefix, fldName, No, fldOptions)
+{
 	var fld = OAT.Dom.create("select");
 	fld.name = fldName;
 	fld.id = fldName;
@@ -51,36 +52,8 @@ TBL.createCell41 = function (td, prefix, fldName, No, fldOptions) {
   return fld;
 }
 
-TBL.createCell42 = function (td, prefix, fldName, No, fldOptions) {
-	var fld = OAT.Dom.create("select");
-	fld.name = fldName;
-	fld.id = fldName;
-	TBL.selectOption(fld, fldOptions.value, "Personal", "person");
-	TBL.selectOption(fld, fldOptions.value, "Group", "group");
-	TBL.selectOption(fld, fldOptions.value, "Public", "public");
-  if (fldOptions.onchange)
-    fld.onclick = fldOptions.onchange;
-
-  td.appendChild(fld);
-  return fld;
-}
-
-TBL.createCell43 = function (td, prefix, fldName, No, fldOptions)
+TBL.createCell42 = function (td, prefix, fldName, No, fldOptions, disabled)
 {
-  var fld = TBL.createCell0 (td, prefix, fldName, No, fldOptions)
-  td.appendChild(OAT.Dom.text(' '));
-  var img = OAT.Dom.image('image/select.gif');
-  img.id = fldName+'_img';
-  img.className = "pointer";
-  img.onclick = function (){webidShow(fld)};
-  if (fldOptions.imgCssText)
-    img.style.cssText = fldOptions.imgCssText;
-
-  td.appendChild(img);
-  return fld;
-}
-
-TBL.createCell44 = function (td, prefix, fldName, No, fldOptions, disabled) {
   function cb(td, prefix, fldName, No, fldOptions, disabled, ndx) {
   	var fld = OAT.Dom.create("input");
     fld.type = 'checkbox';
@@ -103,7 +76,8 @@ TBL.createCell44 = function (td, prefix, fldName, No, fldOptions, disabled) {
   cb(td, prefix, fldName+'_x'+suffix, No, fldOptions, disabled, 2);
 }
 
-TBL.createCell45 = function (td, prefix, fldName, No, fldOptions) {
+TBL.createCell43 = function (td, prefix, fldName, No, fldOptions)
+{
 	var fld = OAT.Dom.create("select");
 	fld.name = fldName;
 	fld.id = fldName;
@@ -117,11 +91,12 @@ TBL.createCell45 = function (td, prefix, fldName, No, fldOptions) {
   return fld;
 }
 
-TBL.viewCell44 = function (td, prefix, fldName, No, fldOptions) {
-  TBL.createCell44(td, prefix, fldName, No, fldOptions, true);
+TBL.viewCell42 = function (td, prefix, fldName, No, fldOptions)
+{
+  TBL.createCell42(td, prefix, fldName, No, fldOptions, true);
 }
 
-TBL.clickCell44 = function (fld)
+TBL.clickCell42 = function (fld)
 {
   var fldName = fld.name;
   if (fldName.indexOf('_deny') != -1) {
@@ -134,23 +109,3 @@ TBL.clickCell44 = function (fld)
   }
   $(fldName).checked = false;
 }
-
-TBL.changeCell42 = function (srcFld) {
-  var srcValue = $v(srcFld.name);
-  var dstName = srcFld.name.replace('fld_1', 'fld_2');
-  var dstFld = $(dstName);
-  var dstImg = $(dstName+'_img');
-  if (srcValue == 'public') {
-    dstFld.value = 'foaf:Agent';
-    dstFld.readOnly = true;
-  } else {
-    if (dstFld.value == 'foaf:Agent')
-      dstFld.value = '';
-    dstFld.readOnly = false;
-  }
-  if (srcValue == 'public') {
-    OAT.Dom.hide(dstImg);
-  } else {
-    OAT.Dom.show(dstImg);
-  }
-}
diff --git a/appsrc/ODS-Briefcase/www/mimes.vspx b/appsrc/ODS-Briefcase/www/mimes.vspx
index d27e09f..3b00563 100644
--- a/appsrc/ODS-Briefcase/www/mimes.vspx
+++ b/appsrc/ODS-Briefcase/www/mimes.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: mimes.vspx,v 1.8.2.2 2010/07/09 14:37:01 source Exp $
+ -  $Id: mimes.vspx,v 1.8.2.4 2010/10/13 12:15:01 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -56,7 +56,7 @@
     <vm:pagebody>
       <v:before-render>
         <![CDATA[
-          self.F1.uf_action := ODRIVE.WA.page_url (self.domain_id, 'mimes.vspx');
+          self.F1.uf_action := ODRIVE.WA.utf2wide (ODRIVE.WA.page_url (self.domain_id, 'mimes.vspx'));
         ]]>
       </v:before-render>
         <v:before-data-bind>
diff --git a/appsrc/ODS-Briefcase/www/mimes_select.vspx b/appsrc/ODS-Briefcase/www/mimes_select.vspx
index c675223..3968ad7 100644
--- a/appsrc/ODS-Briefcase/www/mimes_select.vspx
+++ b/appsrc/ODS-Briefcase/www/mimes_select.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: mimes_select.vspx,v 1.8.2.1 2010/02/10 22:17:52 source Exp $
+ -  $Id: mimes_select.vspx,v 1.8.2.2 2010/09/20 10:15:00 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/www/odrive_login.vspx b/appsrc/ODS-Briefcase/www/odrive_login.vspx
index 1fa31fe..4ad4f24 100644
--- a/appsrc/ODS-Briefcase/www/odrive_login.vspx
+++ b/appsrc/ODS-Briefcase/www/odrive_login.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: odrive_login.vspx,v 1.6.2.2 2010/02/15 10:07:18 source Exp $
+ -  $Id: odrive_login.vspx,v 1.6.2.8 2010/10/07 13:23:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -26,53 +26,44 @@
   <v:template name='inl' type='if-no-login'/>
   <v:after-data-bind>
     <![CDATA[
-      declare page_name varchar;
+      declare domain_id integer;
+      declare page_name, path, ods_path varchar;
       declare params any;
-      declare vh, lh, hf, ods_path any;
 
         set_qualifier ('DB');
-      params := self.vc_page.vc_event.ve_params;
       page_name := ODRIVE.WA.page_name ();
       if (page_name = 'error.vspx')
         return;
 
-      if ((page_name = 'home.vspx') and (get_keyword('id', params, '') <> ''))
+      if ((self.account_role = 'expire') and not is_empty_or_null (self.sid))
       {
-        declare domain_id integer;
-
-        domain_id := ODRIVE.WA.session_domain (params);
-        if (domain_id <> -1)
-        {
-          self.vc_redirect (sprintf ('%sview.vsp?file=%U&mode=download', ODRIVE.WA.odrive_url (self.domain_id), DB.DBA.DAV_SEARCH_PATH (atoi(get_keyword ('id', params)), 'R')));
-          return;
-        }
+        self.vc_redirect (sprintf ('/ods/error.vspx?__PAGE=%U&__SQL_STATE=%U&__SQL_MESSAGE=%U', 'home.vspx', '23023', 'You have no access rights for the application!'));
+        return;
       }
 
-        vh := http_map_get ('vhost');
-        lh := http_map_get ('lhost');
-        hf := http_request_header (lines, 'Host');
-        if (hf is not null and exists (select 1 from HTTP_PATH where HP_HOST = vh and HP_LISTEN_HOST = lh and HP_LPATH = '/ods'))
+      params := self.vc_page.vc_event.ve_params;
+        domain_id := ODRIVE.WA.session_domain (params);
+      path := rtrim (case when (domain_id <> -1) then ODRIVE.WA.iri_fix (ODRIVE.WA.forum_iri (domain_id)) else HTTP_REQUESTED_URL() end, '/');
+      if ((page_name = 'home.vspx') and (get_keyword ('id', params, '') <> '') and (domain_id <> -1))
       {
-          ods_path := 'http://' || hf || '/ods/';
-      } else {
-          ods_path := DB.DBA.WA_LINK (1, '/ods/');
+        self.vc_redirect (sprintf ('%s/view.vsp?file=%U&mode=download', path, DB.DBA.DAV_SEARCH_PATH (atoi(get_keyword ('id', params)), 'R')));
+        return;
       }
+      ods_path := ODRIVE.WA.host_url () || '/ods/';
       if ((page_name = 'home.vspx') and (get_keyword('URL', params, '') <> ''))
       {
-        self.vc_redirect(sprintf('%slogin.vspx?URL=%U', ods_path, sprintf('%s?URI=%s&TITLE=%V', HTTP_REQUESTED_URL(), get_keyword('URL', params, ''), get_keyword('TITLE', params, ''))));
+        self.vc_redirect (sprintf ('%slogin.vspx?URL=%U', ods_path, sprintf ('%s?URI=%s&TITLE=%V', path, get_keyword ('URL', params, ''), get_keyword ('TITLE', params, ''))));
         return;
       }
-
       if (self.account_role = 'expire')
       {
-        http_request_status ('HTTP/1.1 302 Found');
-        http_header (sprintf('Location: %slogin.vspx?URL=%U\r\n', ods_path, HTTP_REQUESTED_URL()));
+        self.vc_redirect (sprintf ('%slogin.vspx?URL=%U', ods_path, path));
         return;
       }
-
       if (ODRIVE.WA.check_grants2 (self.account_role, page_name))
         return;
 
+      if (page_name <> 'home.vspx')
           self.vc_redirect('home.vspx');
     ]]>
   </v:after-data-bind>
diff --git a/appsrc/ODS-Briefcase/www/odrive_navigation.vspx b/appsrc/ODS-Briefcase/www/odrive_navigation.vspx
deleted file mode 100644
index a114182..0000000
--- a/appsrc/ODS-Briefcase/www/odrive_navigation.vspx
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="iso8859-1"?>
-<!--
- -
- -  $Id: odrive_navigation.vspx,v 1.7 2008/10/31 15:41:10 source Exp $
- -
- -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- -  project.
- -
- -  Copyright (C) 1998-2006 OpenLink Software
- -
- -  This project is free software; you can redistribute it and/or modify it
- -  under the terms of the GNU General Public License as published by the
- -  Free Software Foundation; only version 2 of the License, dated June 1991.
- -
- -  This program is distributed in the hope that it will be useful, but
- -  WITHOUT ANY WARRANTY; without even the implied warranty of
- -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- -  General Public License for more details.
- -
- -  You should have received a copy of the GNU General Public License along
- -  with this program; if not, write to the Free Software Foundation, Inc.,
- -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- -
--->
-<v:page name="nav_bar_page" fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro">
-  <v:variable name="nav_pos_fixed" type="int" default="0" />
-  <v:variable name="nav_top" type="int" default="0"/>
-  <v:variable name="nav_tip" type="varchar" default="''"/>
-  <v:variable name="domain_id" type="integer" default="-1"/>
-  <v:variable name="owner_id" type="integer" default="-1"/>
-  <v:variable name="account_id" type="integer" default="-1"/>
-  <v:variable name="account_role" type="varchar" default="'public'"/>
-  <v:variable name="settings" type="any" />
-
-  <v:method name="set_pmembers" arglist="">
-    <![CDATA[
-      udt_set (self.vc_parent.vc_page, 'nav_pos_fixed', self.nav_pos_fixed);
-      udt_set (self.vc_parent.vc_page, 'nav_top', self.nav_top);
-      udt_set (self.vc_parent.vc_page, 'nav_tip', self.nav_tip);
-    ]]>
-  </v:method>
-
-  <v:before-data-bind>
-    <![CDATA[
-      self.vc_authenticated := self.vc_parent.vc_page.vc_authenticated;
-      self.sid := udt_get (self.vc_parent.vc_page, 'sid');
-      self.realm := udt_get (self.vc_parent.vc_page, 'realm');
-      self.domain_id := udt_get (self.vc_parent.vc_page, 'domain_id');
-      self.owner_id := udt_get (self.vc_parent.vc_page, 'owner_id');
-      self.account_id := udt_get (self.vc_parent.vc_page, 'account_id');
-      self.account_role := udt_get (self.vc_parent.vc_page, 'account_role');
-      self.settings := udt_get (self.vc_parent.vc_page, 'settings');
-    ]]>
-  </v:before-data-bind>
-
-  <v:tree show-root="0" multi-branch="0" orientation="horizontal" root="ODRIVE.WA.navigation_root" start-path="" child-function="ODRIVE.WA.navigation_child">
-    <v:before-data-bind>
-      <![CDATA[
-        declare page_name any;
-
-        page_name := ODRIVE.WA.page_name ();
-        self.nav_pos_fixed := 0;
-
-        if (page_name = 'error.vspx') {
-          self.nav_pos_fixed := 1;
-        } else if (not self.nav_top and page_name <> '') {
-          self.nav_pos_fixed := ODRIVE.WA.check_grants2 (self.account_role, page_name);
-          control.vc_open_at (sprintf ('//*[@url = "%s"]', page_name));
-        }
-        self.set_pmembers ();
-      ]]>
-    </v:before-data-bind>
-    <v:node-template>
-	    <td nowrap="nowrap" class="<?V case when control.tn_open then 'sel' else '' end ?>">
-        <v:button action="simple" style="url" xhtml_class="--(case when (control.vc_parent as vspx_tree_node).tn_open = 1 then 'sel' else '' end)" value="--(control.vc_parent as vspx_tree_node).tn_value">
-          <v:after-data-bind>
-	          <![CDATA[
-                if ((control.vc_parent as vspx_tree_node).tn_open = 1)
-                  control.ufl_active := 0;
-                else
-                control.ufl_active := ODRIVE.WA.check_grants2(self.account_role, ODRIVE.WA.page_name ());
-            ]]>
-          </v:after-data-bind>
-          <v:on-post>
-            <![CDATA[
-              declare node vspx_tree_node;
-              declare tree vspx_control;
-              self.nav_tip := xpath_eval('/node/@tip', (control.vc_parent as vspx_tree_node).tn_element, 1);
-              self.nav_pos_fixed := 0;
-              node := control.vc_parent;
-              tree := node.tn_tree;
-              node.tn_tree.vt_open_at := NULL;
-              self.nav_top := 1;
-              tree.vc_data_bind (e);
-              self.set_pmembers ();
-            ]]>
-        	</v:on-post>
-	      </v:button>
-      </td>
-    </v:node-template>
-    <v:leaf-template>
-      <td nowrap="nowrap" class="<?V case when control.tn_open then 'sel' else '' end ?>">
-        <v:button action="simple" style="url" xhtml_class="--case when (control.vc_parent as vspx_tree_node).tn_open = 1 then 'sel' else '' end" value="--(control.vc_parent as vspx_tree_node).tn_value"/>
-      </td>
-    </v:leaf-template>
-    <v:horizontal-template>
-	    <table class="nav_bar" cellspacing="0">
-	      <tr>
-	        <v:node-set />
-	        <?vsp
-	          if ((control as vspx_tree).vt_node <> control) {
-	        ?>
-	        <td class="filler"> </td>
-	        <?vsp } ?>
-	      </tr>
-	    </table>
-  	  <?vsp
-    	  if ((control as vspx_tree).vt_node = control and not length (childs)) {
-    	?>
-      <div class="nav_bar nav_seperator" >x</div>
-  	  <?vsp } ?>
-    </v:horizontal-template>
-  </v:tree>
-</v:page>
diff --git a/appsrc/ODS-Briefcase/www/settings.vspx b/appsrc/ODS-Briefcase/www/settings.vspx
index 33745ef..ff1d596 100644
--- a/appsrc/ODS-Briefcase/www/settings.vspx
+++ b/appsrc/ODS-Briefcase/www/settings.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: settings.vspx,v 1.11.2.4 2010/07/09 14:37:01 source Exp $
+ -  $Id: settings.vspx,v 1.11.2.6 2010/10/13 12:15:01 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -34,7 +34,7 @@
     <vm:pagebody>
       <v:before-render>
         <![CDATA[
-          self.F1.uf_action := ODRIVE.WA.page_url (self.domain_id, 'settings.vspx');
+          self.F1.uf_action := ODRIVE.WA.utf2wide (ODRIVE.WA.page_url (self.domain_id, 'settings.vspx'));
         ]]>
       </v:before-render>
       <?vsp
diff --git a/appsrc/ODS-Briefcase/www/subscriptions.vspx b/appsrc/ODS-Briefcase/www/subscriptions.vspx
index c42cc5c..589c914 100644
--- a/appsrc/ODS-Briefcase/www/subscriptions.vspx
+++ b/appsrc/ODS-Briefcase/www/subscriptions.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: subscriptions.vspx,v 1.5.2.1 2010/07/09 14:37:01 source Exp $
+ -  $Id: subscriptions.vspx,v 1.5.2.3 2010/10/13 12:15:01 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -65,7 +65,7 @@
     <vm:pagebody>
       <v:before-render>
         <![CDATA[
-          self.F1.uf_action := ODRIVE.WA.page_url (self.domain_id, 'subscriptions.vspx');
+          self.F1.uf_action := ODRIVE.WA.utf2wide (ODRIVE.WA.page_url (self.domain_id, 'subscriptions.vspx'));
         ]]>
       </v:before-render>
       <vm:if test="self.v_mode in ('targetBrowse', 'queueBrowse', 'retrievedBrowse', 'retrievedEdit')">
@@ -346,9 +346,9 @@
                     ]]>
                   </v:after-data-bind>
                 </v:text>
-                <v:template name="subscriptions_t1" type="simple" enabled="-- case when ODRIVE.WA.check_admin (self.account_id) then 1 else 0 end;">
-                  <input type="button" value="Select" onclick="javascript: windowShow('users_select.vspx?mode=u&params=owner:s1;')" class="button" />
-                </v:template>
+                <vm:if test="ODRIVE.WA.check_admin (self.account_id)">
+                  <input type="button" value="Select" onclick="javascript: windowShow('/ods/users_select.vspx?form=F1&mode=u&params=owner:s1;')" class="button" />
+                </vm:if>
               </td>
             </tr>
             <tr>
diff --git a/appsrc/ODS-Briefcase/www/template/popup.vspx b/appsrc/ODS-Briefcase/www/template/popup.vspx
index 6ff1f1e..feafd7c 100644
--- a/appsrc/ODS-Briefcase/www/template/popup.vspx
+++ b/appsrc/ODS-Briefcase/www/template/popup.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
-  -  $Id: popup.vspx,v 1.4.2.2 2010/03/12 09:14:46 source Exp $
+  -  $Id: popup.vspx,v 1.4.2.4 2010/10/13 12:15:01 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -28,11 +28,12 @@
     <link rel="stylesheet" href="css/style.css" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <![CDATA[
+      <script type="text/javascript" src="/ods/oat/loader.js"></script>
       <script type="text/javascript">
-        var toolkitPath="/ods/oat";
-        var imagePath="/ods/images/oat/";
+        OAT.Preferences.imagePath = '/ods/images/oat/';
+        OAT.Preferences.stylePath = '/ods/oat/styles/';
+        OAT.Preferences.showAjax = false;
       </script>
-      <script type="text/javascript" src="/ods/oat/loader.js"></script>
       <script type="text/javascript" src="/ods/tbl.js"></script>
       <script type="text/javascript" src="js/odrive.js"></script>
       <script type="text/javascript" src="js/tbl.js"></script>
diff --git a/appsrc/ODS-Briefcase/www/template/template.vspx b/appsrc/ODS-Briefcase/www/template/template.vspx
index 57480f0..1e9137c 100644
--- a/appsrc/ODS-Briefcase/www/template/template.vspx
+++ b/appsrc/ODS-Briefcase/www/template/template.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: template.vspx,v 1.25.2.5 2010/04/09 14:39:31 source Exp $
+ -  $Id: template.vspx,v 1.25.2.9 2010/10/13 12:15:01 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -38,15 +38,32 @@
     <meta name="dc.title" content="<?V ODRIVE.WA.utf2wide (ODRIVE.WA.domain_description (self.domain_id)) ?>" />
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     <![CDATA[
+      <script type="text/javascript" src="/ods/oat/loader.js"></script>
       <script type="text/javascript">
-        var toolkitPath="/ods/oat";
-        var imagePath="/ods/images/oat/";
+        OAT.Preferences.imagePath = '/ods/images/oat/';
+        OAT.Preferences.stylePath = '/ods/oat/styles/';
+        OAT.Preferences.showAjax = false;
         
-        var featureList=["ajax", "json", "anchor", "dialog", "dav", "combolist", "calendar"];
+        // DAV
+        var davOptions = {
+          imagePath: OAT.Preferences.imagePath,
+          pathHome: '/home/',
+          path: '<?V ODRIVE.WA.dav_logical_home (self.account_id) ?>',
+          user: '<?V ODRIVE.WA.account_name (self.account_id) ?>',
+          connectionHeaders: {Authorization: '<?V ODRIVE.WA.account_basicAuthorization (self.account_id) ?>'}
+        };
+
+      	/* load stylesheets */
+      	OAT.Style.include("grid.css");
+      	OAT.Style.include("webdav.css");
+      	OAT.Style.include("winms.css");
+
+        var featureList=["ajax", "json", "anchor", "dialog", "combolist", "calendar"];
+        OAT.Loader.load(featureList);
       </script>
-      <script type="text/javascript" src="/ods/oat/loader.js"></script>
       <script type="text/javascript" src="/ods/app.js"></script>
       <script type="text/javascript" src="/ods/tbl.js"></script>
+      <script type="text/javascript" src="/ods/validate.js"></script>
       <script type="text/javascript" src="js/odrive.js"></script>
       <script type="text/javascript" src="js/tbl.js"></script>
       <script type="text/javascript">
@@ -55,36 +72,18 @@
             setTimeout(myInit, 50);
             return;
           }
-          OAT.Preferences.imagePath = '/ods/images/oat/';
-          OAT.Preferences.stylePath = '/ods/oat/styles/';
-          OAT.Preferences.showAjax = false;
-
-        	/* load stylesheets */
-        	OAT.Style.include("grid.css");
-        	OAT.Style.include("webdav.css");
-
-          // WebDAV
-          var options = { imagePath: OAT.Preferences.imagePath,
-                          pathHome: '/home/',
-                          foldersOnly: true,
-													height:330,
-                          path: '<?V ODRIVE.WA.dav_logical_home (self.account_id) ?>',
-                          user: '<?V ODRIVE.WA.account_name (self.account_id) ?>',
-                          connectionHeaders: {Authorization: '<?V ODRIVE.WA.account_basicAuthorization (self.account_id) ?>'}
-                        };
-          OAT.WebDav.init(options);
-
           // <a>++
           OAT.Anchor.imagePath = OAT.Preferences.imagePath;
           OAT.Anchor.zIndex = 1001;
         
           if ((<?V cast (get_keyword ('app', self.settings, '0') as integer) ?> > 0) && $('app_area'))
-            {
             generateAPP('app_area', {appActivation: "<?V case when cast (get_keyword ('app', self.settings, '1') as integer) = 2 then 'hover' else 'click' end ?>"});
-        }
 
           // Init ODRIVE object
           ODRIVE.init();
+
+          setFooter();
+          window.onresize = function() {setFooter();}
           OAT.MSG.send(OAT, 'PAGE_LOADED');
         }
         OAT.MSG.attach(OAT, 'PAGE_LOADED2', myInit);
diff --git a/appsrc/ODS-Briefcase/www/template/template.xsl b/appsrc/ODS-Briefcase/www/template/template.xsl
index 3ef6f73..bf52028 100644
--- a/appsrc/ODS-Briefcase/www/template/template.xsl
+++ b/appsrc/ODS-Briefcase/www/template/template.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: template.xsl,v 1.18.2.3 2010/07/09 14:37:01 source Exp $
+ -  $Id: template.xsl,v 1.18.2.9 2010/10/13 12:15:01 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -100,7 +100,6 @@
   <xsl:template match="vm:popup_pagewrapper">
     <v:variable name="nav_pos_fixed" type="integer" default="1"/>
     <v:variable name="nav_top" type="integer" default="0"/>
-    <v:variable name="nav_tip" type="varchar" default="''"/>
     <xsl:for-each select="//v:variable">
       <xsl:copy-of select="."/>
     </xsl:for-each>
@@ -124,12 +123,11 @@
   <xsl:template match="vm:pagewrapper">
     <v:variable name="nav_pos_fixed" type="int" default="0"/>
     <v:variable name="nav_top" type="int" default="0"/>
-    <v:variable name="nav_tip" type="varchar" default="''"/>
     <xsl:for-each select="//v:variable">
       <xsl:copy-of select="."/>
     </xsl:for-each>
     <xsl:apply-templates select="vm:init"/>
-    <v:form name="F1" method="POST" type="simple" action="--ODRIVE.WA.page_url (self.domain_id)" xhtml_enctype="multipart/form-data">
+    <v:form name="F1" method="POST" type="simple" action="--ODRIVE.WA.utf2wide (ODRIVE.WA.page_url (self.domain_id))" xhtml_enctype="multipart/form-data">
       <ods:ods-bar app_type='oDrive'/>
       <div id="app_area" style="clear: right;">
       <div style="background-color: #fff;">
@@ -150,7 +148,7 @@
                     params := e.ve_params;
                     q := trim (get_keyword ('keywords', params, ''));
                     S := case when q <> ''then sprintf ('&keywords=%s&step=1', q) else '' end;
-                    self.vc_redirect (ODRIVE.WA.page_url (self.domain_id, sprintf ('home.vspx?mode=%s%s', get_keyword ('select', params, 'advanced'), S)));
+                    self.vc_redirect (ODRIVE.WA.utf2wide (ODRIVE.WA.page_url (self.domain_id, sprintf ('home.vspx?mode=%s%s', get_keyword ('select', params, 'advanced'), S))));
                     self.vc_data_bind(e);
                    ]]>
                  </v:on-post>
@@ -160,10 +158,10 @@
           ?>
         <div style="float: right; text-align: right; padding-right: 0.5em; padding-top: 20px;">
             <input name="keywords" value="" onkeypress="javascript: if (checkNotEnter(event)) return true; vspxPost('searchHead', 'select', 'simple'); return false;" />
-          <xsl:call-template name="nbsp"/>
-            <v:url url="--ODRIVE.WA.page_url (self.domain_id, 'home.vspx?mode=simple', self.sid, self.realm)" xhtml_onclick="javascript: vspxPost(\'searchHead\', \'select\', \'simple\'); return false;" value="Search" xhtml_title="simple Search" />
+            &nbsp;
+            <a href="<?vsp http (ODRIVE.WA.utf2wide (ODRIVE.WA.page_url (self.domain_id, 'search.vspx?mode=simple', self.sid, self.realm))); ?>" onclick="vspxPost('searchHead', 'select', 'simple'); return false;" title="Simple Search">Search</a>
           |
-            <v:url url="--ODRIVE.WA.page_url (self.domain_id, 'home.vspx?mode=advanced', self.sid, self.realm)" xhtml_onclick="javascript: vspxPost(\'searchHead\', \'select\', \'advanced\'); return false;" value="Advanced" xhtml_title="Advanced Search" />
+            <a href="<?vsp http (ODRIVE.WA.utf2wide (ODRIVE.WA.page_url (self.domain_id, 'search.vspx?mode=advanced', self.sid, self.realm))); ?>" onclick="vspxPost('searchHead', 'select', 'advanced'); return false;" title="Advanced">Advanced</a>
         </div>
       </div>
         <div style="clear: both; border: solid #935000; border-width: 0px 0px 1px 0px;">
@@ -171,11 +169,11 @@
             <?vsp http (ODRIVE.WA.utf2wide (ODRIVE.WA.banner_links (self.domain_id, self.sid, self.realm))); ?>
           </div>
           <div style="float: right; padding-right: 0.5em;">
-            <v:template name="t1" type="simple" enabled="--case when (self.account_role in ('public', 'guest')) then 0 else 1 end">
-              <v:url url="--ODRIVE.WA.page_url (self.domain_id, 'settings.vspx', self.sid, self.realm)" value="Preferences" xhtml_title="Preferences"/>
+            <vm:if test="self.account_role not in ('public', 'guest')">
+              <a href="<?vsp http (ODRIVE.WA.utf2wide (ODRIVE.WA.page_url (self.domain_id, 'settings.vspx', self.sid, self.realm))); ?>" title="Preferences">Preferences</a>
               |
-        </v:template>
-            <a href="<?V ODRIVE.WA.page_url (self.domain_id, 'about.vsp') ?>" onclick="javascript: ODRIVE.aboutDialog(); return false;" title="About">About</a>
+            </vm:if>
+            <a href="<?vsp http (ODRIVE.WA.utf2wide (ODRIVE.WA.page_url (self.domain_id, 'about.vsp'))); ?>" onclick="javascript: ODRIVE.aboutDialog(); return false;" title="About">About</a>
       </div>
           <p style="clear: both; line-height: 0.1em" />
         </div>
@@ -183,7 +181,87 @@
     <table id="RCT">
       <tr>
           <td id="RC">
-      	    <v:vscx name="navbar" url="odrive_navigation.vspx" />
+              <v:tree show-root="0" multi-branch="0" orientation="horizontal" root="ODRIVE.WA.navigation_root" start-path="" child-function="ODRIVE.WA.navigation_child">
+                <v:before-data-bind>
+                  <![CDATA[
+                    declare page_name any;
+
+                    page_name := ODRIVE.WA.page_name ();
+                    if (page_name = 'error.vspx')
+                    {
+                      self.nav_pos_fixed := 1;
+                    }
+                    else if (not self.nav_top and page_name <> '')
+                    {
+                      self.nav_pos_fixed := 0;
+                      self.nav_pos_fixed := ODRIVE.WA.check_grants2 (self.account_role, page_name);
+                      control.vc_open_at (sprintf ('//*[@url = "%s"]', page_name));
+                    }
+                  ]]>
+                </v:before-data-bind>
+
+                <v:node-template>
+                  <td nowrap="nowrap" class="<?V case when control.tn_open then 'sel' else '' end ?>">
+                    <v:button action="simple" style="url" xhtml_class="--(case when (control.vc_parent as vspx_tree_node).tn_open = 1 then 'sel' else '' end)" value="--(control.vc_parent as vspx_tree_node).tn_value">
+                      <v:after-data-bind>
+                        <![CDATA[
+                          if ((control.vc_parent as vspx_tree_node).tn_open = 1)
+                            control.ufl_active := 0;
+                          else
+                            control.ufl_active := ODRIVE.WA.check_grants2(self.account_role, ODRIVE.WA.page_name ());
+                        ]]>
+                      </v:after-data-bind>
+                      <v:before-render>
+                        <![CDATA[
+                          control.bt_anchor := 0;
+                          control.bt_url := ODRIVE.WA.utf2wide (replace (control.bt_url, sprintf ('/odrive/%d', self.domain_id), ODRIVE.WA.page_url (self.domain_id)));
+                        ]]>
+                      </v:before-render>
+                      <v:on-post>
+                        <![CDATA[
+                          declare node vspx_tree_node;
+                          declare tree vspx_control;
+                          self.nav_pos_fixed := 0;
+                          node := control.vc_parent;
+                          tree := node.tn_tree;
+                          node.tn_tree.vt_open_at := NULL;
+                          self.nav_top := 1;
+                          tree.vc_data_bind (e);
+                        ]]>
+                      </v:on-post>
+                    </v:button>
+                  </td>
+                </v:node-template>
+                <v:leaf-template>
+                  <td nowrap="nowrap" class="<?V case when control.tn_open then 'sel' else '' end ?>">
+                    <v:button action="simple" style="url" xhtml_class="--case when (control.vc_parent as vspx_tree_node).tn_open = 1 then 'sel' else '' end" value="--(control.vc_parent as vspx_tree_node).tn_value">
+                      <v:before-render>
+                        <![CDATA[
+                          control.bt_anchor := 0;
+                          control.bt_url := ODRIVE.WA.utf2wide (replace (control.bt_url, sprintf ('/odrive/%d', self.domain_id), ODRIVE.WA.page_url (self.domain_id)));
+                        ]]>
+                      </v:before-render>
+                    </v:button>
+                  </td>
+                </v:leaf-template>
+                <v:horizontal-template>
+                  <table class="nav_bar" cellspacing="0">
+                    <tr>
+                      <v:node-set />
+                      <?vsp
+                        if ((control as vspx_tree).vt_node <> control) {
+                      ?>
+                      <td class="filler"> </td>
+                      <?vsp } ?>
+                    </tr>
+                  </table>
+                  <?vsp
+                    if ((control as vspx_tree).vt_node = control and not length (childs)) {
+                  ?>
+                  <div class="nav_bar nav_seperator" >x</div>
+                  <?vsp } ?>
+                </v:horizontal-template>
+              </v:tree>
               <v:template name="t2" type="simple" condition="not self.vc_is_valid">
       	    <div class="error">
       		    <p><v:error-summary/></p>
@@ -195,7 +273,11 @@
       	</td>
       </tr>
     </table>
-      <div id="FT">
+        <?vsp
+          declare C any;
+          C := vsp_ua_get_cookie_vec(self.vc_event.ve_lines);
+        ?>
+        <div id="FT" style="display: <?V case when get_keyword ('interface', C, '') = 'js' then 'none' else '' end ?>">
         <div id="FT_L">
           <a href="http://www.openlinksw.com/virtuoso">
             <img alt="Powered by OpenLink Virtuoso Universal Server" src="image/virt_power_no_border.png" border="0" />
@@ -214,43 +296,6 @@
   </xsl:template>
 
   <!--=========================================================================-->
-  <xsl:template match="vm:menu">
-    <div class="left_container">
-      <ul class="left_navigation">
-      <?vsp if (self.nav_pos_fixed) { ?>
-        <xsl:for-each select="vm:menuitem">
-          <li>
-            <xsl:choose>
-              <xsl:when test="@type='hot' or @url">
-                <v:url format="%s">
-                  <xsl:copy-of select="@name" />
-                  <xsl:attribute name="value">--'<xsl:value-of select="@value"/>'</xsl:attribute>
-                  <xsl:attribute name="url">--'<xsl:value-of select="@url"/>'</xsl:attribute>
-                </v:url>
-              </xsl:when>
-              <xsl:when test="@ref">
-                <v:url format="%s">
-                  <xsl:copy-of select="@name" />
-                  <xsl:attribute name="value">--'<xsl:value-of select="@value"/>'</xsl:attribute>
-                  <xsl:attribute name="url">--<xsl:value-of select="@ref"/></xsl:attribute>
-                </v:url>
-              </xsl:when>
-              <xsl:otherwise>
-                <xsl:value-of select="@value"/>
-              </xsl:otherwise>
-            </xsl:choose>
-          </li>
-        </xsl:for-each>
-      <?vsp } else { ?>
-        <li>
-        <?vsp http (coalesce (self.nav_tip, '')); ?>
-        </li>
-      <?vsp } ?>
-      </ul>
-    </div>
-  </xsl:template>
-
-  <!--=========================================================================-->
   <xsl:template match="vm:ds-navigation">
     <?vsp
       {
@@ -651,16 +696,9 @@
         </tr>
       </table>
       <br />
-		  <?vsp
-		    declare I, N integer;
-		    declare S varchar;
-		    declare aCriteria, criteria any;
-        declare V, f0, f1, f2, f3, f4 any;
-
-        aCriteria := ODRIVE.WA.dc_xml_doc (self.search_dc);
-        I := xpath_eval('count(/dc/criteria/entry)', aCriteria);
-		  ?>
-      <input name="search_seqNo" id="search_seqNo" type="hidden" value="<?V I ?>" />
+      <table style="width: 100%;">
+        <tr>
+          <td>
       <table id="searchProperties" class="form-list" style="width: 100%;" cellspacing="0">
         <thead>
           <tr>
@@ -673,15 +711,18 @@
           </tr>
         </thead>
         <tbody id="search_tbody">
-          <tr id="search_tr">
-            <td colspan="6">
-              <hr />
-            </td>
-          </tr>
+                <tr id="search_tr_no"><td colspan="6"><b>No Criteria</b></td></tr>
     		  <![CDATA[
     		    <script type="text/javascript">
               OAT.MSG.attach(OAT, "PAGE_LOADED", ODRIVE.initFilter);
     		  <?vsp
+            		    declare I, N integer;
+            		    declare S varchar;
+            		    declare aCriteria, criteria any;
+                    declare V, f0, f1, f2, f3, f4 any;
+
+                    aCriteria := ODRIVE.WA.dc_xml_doc (self.search_dc);
+                    I := xpath_eval('count(/dc/criteria/entry)', aCriteria);
               for (N := 1; N <= I; N := N + 1)
               {
                 criteria := xpath_eval('/dc/criteria/entry', aCriteria, N);
@@ -690,17 +731,21 @@
                 f2 := coalesce (cast (xpath_eval ('@property', criteria) as varchar), 'null');
                 f3 := coalesce (cast (xpath_eval ('@criteria', criteria) as varchar), 'null');
                 f4 := coalesce (cast (xpath_eval ('.', criteria) as varchar), 'null');
-                S := sprintf ('field_0:\'%s\', field_1:\'%s\', field_2:\'%s\', field_3:\'%s\', field_4:\'%s\'', f0, f1, f2, f3, f4);
-                S := replace (S, '\'null\'', 'null');
+                      S := replace (sprintf ('field_0:\'%s\', field_1:\'%s\', field_2:\'%s\', field_3:\'%s\', field_4:\'%s\'', f0, f1, f2, f3, f4), '\'null\'', 'null');
 
-                http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){ODRIVE.searchRowCreate(\'%d\', {%s});});', N - 1, S));
+                      http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){ODRIVE.searchRowCreate({%s});});', S));
               }
-              http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){ODRIVE.searchRowCreate(\'%d\');})', I));
     		  ?>
     		    </script>
     		  ]]>
         </tbody>
       </table>
+          </td>
+          <td valign="top" nowrap="nowrap" width="1%">
+            <span class="button pointer" onclick="javascript: ODRIVE.searchRowCreate();"><img src="image/add_16.png" border="0" class="button" alt="Add Criteria" title="Add Criteria" /> Add</span><br /><br />
+          </td>
+        </tr>
+      </table>
         </div>
   </xsl:template>
 
diff --git a/appsrc/ODS-Briefcase/www/users_select.vspx b/appsrc/ODS-Briefcase/www/users_select.vspx
index 642e8df..f686b5c 100644
--- a/appsrc/ODS-Briefcase/www/users_select.vspx
+++ b/appsrc/ODS-Briefcase/www/users_select.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: users_select.vspx,v 1.8.2.2 2010/02/10 22:17:52 source Exp $
+ -  $Id: users_select.vspx,v 1.8.2.3 2010/09/20 10:15:01 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/www/view.vsp b/appsrc/ODS-Briefcase/www/view.vsp
index 2c31b5b..b090da9 100644
--- a/appsrc/ODS-Briefcase/www/view.vsp
+++ b/appsrc/ODS-Briefcase/www/view.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: view.vsp,v 1.8.2.4 2010/07/06 23:08:51 source Exp $
+--  $Id: view.vsp,v 1.8.2.5 2010/09/20 10:15:01 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Briefcase/www/vmds.vspx b/appsrc/ODS-Briefcase/www/vmds.vspx
index 05006a5..13e8430 100644
--- a/appsrc/ODS-Briefcase/www/vmds.vspx
+++ b/appsrc/ODS-Briefcase/www/vmds.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vmds.vspx,v 1.7.2.3 2010/07/09 14:37:01 source Exp $
+ -  $Id: vmds.vspx,v 1.7.2.5 2010/10/13 12:15:01 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -82,7 +82,7 @@
     <vm:pagebody>
       <v:before-render>
         <![CDATA[
-          self.F1.uf_action := ODRIVE.WA.page_url (self.domain_id, 'vmds.vspx');
+          self.F1.uf_action := ODRIVE.WA.utf2wide (ODRIVE.WA.page_url (self.domain_id, 'vmds.vspx'));
         ]]>
       </v:before-render>
         <v:before-data-bind>
diff --git a/appsrc/ODS-Briefcase/www/webid_select.vspx b/appsrc/ODS-Briefcase/www/webid_select.vspx
deleted file mode 100644
index 182dce7..0000000
--- a/appsrc/ODS-Briefcase/www/webid_select.vspx
+++ /dev/null
@@ -1,251 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- -
- -  $Id: webid_select.vspx,v 1.1.2.3 2010/02/12 22:15:41 source Exp $
- -
- -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- -  project.
- -
- -  Copyright (C) 1998-2009 OpenLink Software
- -
- -  This project is free software; you can redistribute it and/or modify it
- -  under the terms of the GNU General Public License as published by the
- -  Free Software Foundation; only version 2 of the License, dated June 1991.
- -
- -  This program is distributed in the hope that it will be useful, but
- -  WITHOUT ANY WARRANTY; without even the implied warranty of
- -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- -  General Public License for more details.
- -
- -  You should have received a copy of the GNU General Public License along
- -  with this program; if not, write to the Free Software Foundation, Inc.,
- -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- -
--->
-<v:page name="users_select" decor="template/popup.vspx" style="template/template.xsl" fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-  <v:method name="sortColumn" arglist="in titleName varchar, in columnName varchar">
-    <![CDATA[
-      declare altStr, directionStr, imageStr varchar;
-
-      if (self.v_order = columnName and self.v_direction = 'desc') {
-        directionStr := 'Ascending';
-        imageStr := ' <img src="image/d.gif" border="0" alt="Down"/>';
-      } else if (self.v_order = columnName and self.v_direction = 'asc') {
-        directionStr := 'Descending';
-        imageStr := ' <img src="image/u.gif" border="0" alt="Up"/>';
-      } else {
-        directionStr := 'Ascending';
-        imageStr := '  ';
-      }
-      altStr := sprintf('Sort Rows on %s in %s Order', titleName, directionStr);
-      http(sprintf('<a href="#" onClick="javascript: myPost(''F1'', ''sortColumn'', ''%s''); return false;" alt="%s" title="%s">%s%s</a>', columnName, altStr, altStr, titleName, imageStr));
-    ]]>
-  </v:method>
-
-  <v:method name="sortChange" arglist="in columnName varchar">
-    <![CDATA[
-      if (columnName = '')
-        return;
-      self.ds.vc_reset();
-      if (self.v_order = columnName) {
-        self.v_direction := either(equ(self.v_direction, 'asc'), 'desc', 'asc');
-      } else {
-        self.v_direction := 'asc';
-      }
-      self.v_order := columnName;
-    ]]>
-  </v:method>
-
-  <v:method name="isMultiple" arglist="in dst any">
-    <![CDATA[
-      declare pos integer;
-
-      pos := strstr(self.v_dst, 'm');
-      if (not isnull(pos))
-        return 1;
-      return 0;
-    ]]>
-  </v:method>
-
-  <v:before-data-bind>
-    <![CDATA[
-      if (isnull(self.v_filter))
-        self.v_filter := self.v_mode;
-    ]]>
-  </v:before-data-bind>
-
-  <vm:pagetitle>Select User/Group</vm:pagetitle>
-  <vm:popup_pagewrapper>
-    <vm:variables>
-      <v:variable name="v_params" param-name="params" type="varchar"/>
-      <v:variable name="v_mode" persist="0" param-name="mode" type="varchar" default="''"/>
-      <v:variable name="v_value" persist="0" type="varchar" default="''"/>
-      <v:variable name="v_filter" persist="0" type="varchar" default="null"/>
-      <v:variable name="v_order" persist="0" type="varchar" default="'F2'" />
-      <v:variable name="v_direction" persist="0" type="varchar" default="'asc'" />
-      <v:variable name="v_src" persist="0" param-name="src" type="varchar" default="''" />
-      <v:variable name="v_dst" persist="0" param-name="dst" type="varchar" default="'sc'" />
-      <v:variable name="v_s1" persist="0" param-name="s1" type="varchar" default="''" />
-      <v:variable name="v_s2" persist="0" param-name="s2" type="varchar" default="''" />
-    </vm:variables>
-    <vm:pagebody>
-      <input type="hidden" name="sid"   id="sid"   value="<?V get_keyword('sid', self.vc_page.vc_event.ve_params) ?>" />
-      <input type="hidden" name="realm" id="realm" value="<?V get_keyword('realm', self.vc_page.vc_event.ve_params) ?> " />
-      <input type="hidden" name="src"   id="src"   value="<?V get_keyword('src', self.vc_page.vc_event.ve_params, '') ?>" />
-      <input type="hidden" name="dst"   id="dst"   value="<?V get_keyword('dst', self.vc_page.vc_event.ve_params, 'sc') ?>" />
-      <input type="hidden" name="s1"    id="s1"    value="<?V get_keyword('s1', self.vc_page.vc_event.ve_params, '') ?>" />
-      <input type="hidden" name="s2"    id="s2"    value="<?V get_keyword('s2', self.vc_page.vc_event.ve_params, '') ?>" />
-      <v:text name="params" type="hidden" value="--self.v_params"/>
-      <div style="padding: 0.2em;">
-        <div class="boxHeader">
-          Show
-          <v:select-list name="filter" value="--self.v_filter" enabled="-- case when (self.v_mode = '') then 1 else 0 end">
-            <v:item name="Persons & Groups" value="" />
-            <v:item name="Persons" value="p" />
-            <v:item name="Groups" value="g" />
-          </v:select-list>
-        </div>
-        <v:data-source name="dsrc" expression-type="sql" nrows="0" initial-offset="0">
-          <v:before-data-bind>
-            <![CDATA[
-              declare user_sql, group_sql varchar;
-
-              user_sql := '';
-              group_sql := '';
-              if (self.v_filter <> 'p')
-              {
-                group_sql := sprintf ('select ''Group'' F1, SIOC..waGroup(%d, FG_NAME) F2, FG_DESCRIPTION F3 from ODRIVE.WA.FOAF_GROUPS where FG_USER_ID = %d', self.account_id, self.account_id);
-              }
-              if (self.v_filter <> 'g')
-              {
-                if (ODRIVE.WA.check_app ('AddressBook', self.account_id))
-                {
-                  user_sql := sprintf ('select ''Person'' F1, a.P_IRI F2, a.P_NAME F3 from AB.WA.PERSONS a, DB.DBA.WA_MEMBER b, DB.DBA.WA_INSTANCE c where a.P_DOMAIN_ID = c.WAI_ID and c.WAI_TYPE_NAME = ''AddressBook'' and c.WAI_NAME = b.WAM_INST and B.WAM_MEMBER_TYPE = 1 and b.WAM_USER = %d and DB.DBA.is_empty_or_null (a.P_IRI) <> 1', self.account_id);
-                } else {
-                  user_sql := 'select ''Person'' F1, '''' F2, '''' F3 from DB.DBA.SYS_USERS where 0 = 1';
-              }
-              }
-              if (user_sql = '')
-              {
-                control.ds_sql := group_sql;
-              }
-              else if (group_sql = '')
-              {
-                control.ds_sql := user_sql;
-              }
-              else
-              {
-                control.ds_sql := concat('select F1, F2, F3 from (', user_sql, ' union ' , group_sql, ') x ');
-              }
-              self.sortChange(get_keyword('sortColumn', e.ve_params, ''));
-              control.ds_sql := concat(control.ds_sql, ' order by ', self.v_order, ' ', self.v_direction);
-              control.ds_nrows := ODRIVE.WA.settings_rows (self.settings);
-            ]]>
-          </v:before-data-bind>
-          <v:after-data-bind>
-            control.ds_make_statistic ();
-          </v:after-data-bind>
-        </v:data-source>
-        <v:data-set name="ds" data-source="self.dsrc" scrollable="1">
-          <v:template name="ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
-            <table id="users" class="OD_grid colorise" cellspacing="0">
-              <thead class="sortHeader">
-                <tr>
-                  <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
-                    <th class="checkbox" width="1%">
-                      <?vsp
-                        http('<input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, ''cb_item''); updateChecked(this.form, ''cb_item''); "/>');
-                      ?>
-                    </th>
-                  </v:template>
-                  <v:template type="simple" enabled="-- case when (self.v_mode = '') then 1 else 0 end">
-                    <th>
-                      <v:label value="Type" format="%s"/>
-                    </th>
-                  </v:template>
-                  <?vsp http (ODRIVE.WA.show_column_header ('WebID', 'F2', self.v_order, self.v_direction)); ?>
-                  <?vsp http (ODRIVE.WA.show_column_header ('Description', 'F3', self.v_order, self.v_direction)); ?>
-                  <v:template type="simple" enabled="--neq(self.isMultiple(self.v_dst), 1)">
-                    <th width="1%">
-                      Action
-                    </th>
-                  </v:template>
-                </tr>
-              </thead>
-            </table>
-          </v:template>
-
-          <v:template name="ds_repeat" type="repeat" name-to-remove="" set-to-remove="">
-
-            <v:template name="ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
-              <table>
-                <tr align="center">
-                  <?vsp http(sprintf('<td colspan="%d">No records</td>', either(equ(self.v_mode,''),4,3))); ?>
-                </tr>
-              </table>
-            </v:template>
-
-            <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
-              <table>
-                <tr>
-                  <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
-                    <td  align="center">
-                      <?vsp
-                        declare pos integer;
-                        declare S, name any;
-
-                        name := (control.vc_parent as vspx_row_template).te_column_value('F2');
-                        S := '';
-                        pos := strstr(self.v_s1, concat(name, ','));
-                        if (not isnull(pos))
-                          S := 'checked="checked"';
-                        http (sprintf ('<input type="checkbox" name="cb_item" value="%s" %s onclick="javascript: updateChecked(this.form, ''cb_item''); " />', name, S));
-                      ?>
-                    </td>
-                  </v:template>
-                  <v:template type="simple" enabled="-- case when (self.v_mode = '') then 1 else 0 end">
-                    <td nowrap="nowrap">
-                      <v:label value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('F1')" format="%s"/>
-                    </td>
-                  </v:template>
-                  <td nowrap="nowrap">
-                    <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('F2')" format="%s"/>
-                  </td>
-                  <td nowrap="nowrap">
-                    <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('F3')" format="%s"/>
-                  </td>
-                  <v:template type="simple" enabled="--neq(self.isMultiple(self.v_dst), 1)">
-                    <td nowrap="nowrap">
-                      <v:text name="s1" type="hidden" value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('F2')"/>
-                      <v:text name="s2" type="hidden" value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('F3')"/>
-                      <v:button name="b1" action="simple" value="select" xhtml_alt="Select" xhtml_onclick="javascript: rowSelect(this); return false;" xhtml_class="button"/>
-                    </td>
-                  </v:template>
-                </tr>
-              </table>
-            </v:template>
-
-          </v:template>
-
-          <v:template type="simple" name-to-remove="table" set-to-remove="top">
-            <table>
-              <tr align="center">
-                <?vsp http(sprintf('<td colspan="%d">', either(equ(self.v_mode,''),4,3))); ?>
-                  <vm:ds-navigation data-set="ds"/>
-                <?vsp http('</td>'); ?>
-              </tr>
-            </table>
-          </v:template>
-
-        </v:data-set>
-        <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
-          <div style="padding: 0 0 0.5em 0;">
-            <hr />
-            <a href="#" onclick="javascript: addChecked(document.forms['F1'], 'cb_item', 'No users were selected for addition. No groups were selected for addition.');" class="button2">&nbsp;Add selected</a>
-          </div>
-        </v:template>
-      </div>
-    </vm:pagebody>
-  </vm:popup_pagewrapper>
-</v:page>
diff --git a/appsrc/ODS-Briefcase/xslt/rss2atom.xsl b/appsrc/ODS-Briefcase/xslt/rss2atom.xsl
index 5edbc92..817d839 100644
--- a/appsrc/ODS-Briefcase/xslt/rss2atom.xsl
+++ b/appsrc/ODS-Briefcase/xslt/rss2atom.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom.xsl,v 1.3.2.1 2010/05/31 21:59:14 source Exp $
+ -  $Id: rss2atom.xsl,v 1.3.2.2 2010/09/20 10:15:01 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/xslt/rss2atom03.xsl b/appsrc/ODS-Briefcase/xslt/rss2atom03.xsl
index f538e8a..4ff5b07 100644
--- a/appsrc/ODS-Briefcase/xslt/rss2atom03.xsl
+++ b/appsrc/ODS-Briefcase/xslt/rss2atom03.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom03.xsl,v 1.3.2.1 2009/07/17 14:46:47 source Exp $
+ -  $Id: rss2atom03.xsl,v 1.3.2.2 2010/09/20 10:15:01 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/xslt/rss2rdf.xsl b/appsrc/ODS-Briefcase/xslt/rss2rdf.xsl
index 221d722..98067ea 100644
--- a/appsrc/ODS-Briefcase/xslt/rss2rdf.xsl
+++ b/appsrc/ODS-Briefcase/xslt/rss2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2rdf.xsl,v 1.4.2.1 2009/07/17 14:46:47 source Exp $
+ -  $Id: rss2rdf.xsl,v 1.4.2.2 2010/09/20 10:15:01 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Briefcase/xslt/rss2xbel.xsl b/appsrc/ODS-Briefcase/xslt/rss2xbel.xsl
index 1d7a45d..efb62a9 100644
--- a/appsrc/ODS-Briefcase/xslt/rss2xbel.xsl
+++ b/appsrc/ODS-Briefcase/xslt/rss2xbel.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2xbel.xsl,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: rss2xbel.xsl,v 1.2.2.1 2010/09/20 10:15:02 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Calendar/Makefile.in b/appsrc/ODS-Calendar/Makefile.in
index e2220f4..cc39cca 100644
--- a/appsrc/ODS-Calendar/Makefile.in
+++ b/appsrc/ODS-Calendar/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-Calendar/make_vad.sh b/appsrc/ODS-Calendar/make_vad.sh
index eb01ae2..bc8c886 100755
--- a/appsrc/ODS-Calendar/make_vad.sh
+++ b/appsrc/ODS-Calendar/make_vad.sh
@@ -28,7 +28,7 @@ export LANG LC_ALL
 
 MODE=$1
 LOGDIR=`pwd`
-VERSION="1.6.59"
+VERSION="1.6.69"
 LOGFILE="${LOGDIR}/vad_make.log"
 STICKER_DAV="vad_dav.xml"
 STICKER_FS="vad_filesystem.xml"
@@ -225,7 +225,7 @@ sticker_init() {
   echo "  <name package=\"Calendar\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS Calendar Manager\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
@@ -237,8 +237,8 @@ sticker_init() {
   echo "<dependencies>" >> $STICKER
   echo "  <require>" >> $STICKER
   echo "    <name package=\"Framework\"/>" >> $STICKER
-  echo "    <versions_later package=\"1.73.21\">" >> $STICKER
-  echo "      <prop name=\"Date\" value=\"2010-07-08 12:00\" />" >> $STICKER
+  echo "    <versions_later package=\"1.76.62\">" >> $STICKER
+  echo "      <prop name=\"Date\" value=\"2010-09-27 12:00\" />" >> $STICKER
   echo "      <prop name=\"Comment\" value=\"An incompatible version of the ODS Framework\" />" >> $STICKER
   echo "    </versions_later>" >> $STICKER
   echo "  </require>" >> $STICKER
diff --git a/appsrc/ODS-Calendar/sql/DET_Calendar.sql b/appsrc/ODS-Calendar/sql/DET_Calendar.sql
index 9c05fd2..13b18fa 100644
--- a/appsrc/ODS-Calendar/sql/DET_Calendar.sql
+++ b/appsrc/ODS-Calendar/sql/DET_Calendar.sql
@@ -1,5 +1,5 @@
 --
---  $Id: DET_Calendar.sql,v 1.7.2.1 2009/07/16 06:13:09 source Exp $
+--  $Id: DET_Calendar.sql,v 1.7.2.2 2010/09/20 10:15:02 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Calendar/sql/calendar-a-api.sql b/appsrc/ODS-Calendar/sql/calendar-a-api.sql
index 4d3764c..0e9eb70 100644
--- a/appsrc/ODS-Calendar/sql/calendar-a-api.sql
+++ b/appsrc/ODS-Calendar/sql/calendar-a-api.sql
@@ -1,5 +1,5 @@
 --
---  $Id: calendar-a-api.sql,v 1.10.2.2 2009/12/08 23:25:22 source Exp $
+--  $Id: calendar-a-api.sql,v 1.10.2.3 2010/09/20 10:15:02 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Calendar/sql/calendar-a-code.sql b/appsrc/ODS-Calendar/sql/calendar-a-code.sql
index abbde84..0f57dce 100644
--- a/appsrc/ODS-Calendar/sql/calendar-a-code.sql
+++ b/appsrc/ODS-Calendar/sql/calendar-a-code.sql
@@ -1,5 +1,5 @@
 --
---  $Id: calendar-a-code.sql,v 1.64.2.17 2010/07/09 14:37:01 source Exp $
+--  $Id: calendar-a-code.sql,v 1.64.2.29 2011/03/23 12:18:41 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -21,6 +21,67 @@
 --
 -------------------------------------------------------------------------------
 --
+-- ACL Functions
+--
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.acl_condition (
+  in domain_id integer,
+  in id integer := null)
+{
+  if (not is_https_ctx ())
+    return 0;
+
+  if (exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_ACL is not null))
+    return 1;
+
+  if (exists (select 1 from CAL.WA.EVENTS where E_ID = id and E_ACL is not null))
+    return 1;
+
+  return 0;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.acl_check (
+  in domain_id integer,
+  in id integer := null)
+{
+  declare rc varchar;
+  declare graph_iri, groups_iri, acl_iris any;
+
+  rc := '';
+  if (CAL.WA.acl_condition (domain_id, id))
+  {
+    acl_iris := vector (CAL.WA.forum_iri (domain_id));
+    if (not isnull (id))
+      acl_iris := vector (SIOC..calendar_event_iri (domain_id, id), CAL.WA.forum_iri (domain_id));
+
+    graph_iri := CAL.WA.acl_graph (domain_id);
+    groups_iri := SIOC..acl_groups_graph (CAL.WA.domain_owner_id (domain_id));
+    rc := SIOC..acl_check (graph_iri, groups_iri, acl_iris);
+  }
+  return rc;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.acl_list (
+  in domain_id integer)
+{
+  declare graph_iri, groups_iri, iri any;
+
+  iri := CAL.WA.forum_iri (domain_id);
+  graph_iri := CAL.WA.acl_graph (domain_id);
+  groups_iri := SIOC..acl_groups_graph (CAL.WA.domain_owner_id (domain_id));
+  return SIOC..acl_list (graph_iri, groups_iri, iri);
+}
+;
+
+-------------------------------------------------------------------------------
+--
 -- Session Functions
 --
 -------------------------------------------------------------------------------
@@ -37,12 +98,15 @@ create procedure CAL.WA.session_domain (
 
   options := http_map_get('options');
   if (not is_empty_or_null(options))
+  {
     domain_id := get_keyword ('domain', options);
-  if (is_empty_or_null (domain_id)) {
+  }
+  if (is_empty_or_null (domain_id))
+  {
     aPath := split_and_decode (trim (http_path (), '/'), 0, '\0\0/');
     domain_id := cast(aPath[1] as integer);
   }
-  if (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id))
+  if (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_TYPE_NAME = 'Calendar'))
     domain_id := -1;
 
 _end:;
@@ -55,44 +119,27 @@ _end:;
 create procedure CAL.WA.session_restore (
   inout params any)
 {
-  declare domain_id, user_id, user_name, user_role, sid, realm any;
-
-  sid := get_keyword ('sid', params, '');
-  realm := get_keyword ('realm', params, '');
+  declare domain_id, account_id, account_rights any;
 
   domain_id := CAL.WA.session_domain (params);
+  account_id := -1;
 
-  user_id := -1;
   for (select U.U_ID,
               U.U_NAME,
               U.U_FULL_NAME
          from DB.DBA.VSPX_SESSION S,
               WS.WS.SYS_DAV_USER U
-        where S.VS_REALM = realm
-          and S.VS_SID   = sid
+        where S.VS_REALM = get_keyword ('realm', params, 'wa')
+          and S.VS_SID   = get_keyword ('sid', params, '')
           and S.VS_UID   = U.U_NAME) do
   {
-    user_id   := U_ID;
-    user_name := CAL.WA.user_name(U_NAME, U_FULL_NAME);
-    user_role := CAL.WA.access_role(domain_id, U_ID);
+    account_id := U_ID;
   }
-  if ((user_id = -1) and (domain_id >= 0) and (not exists(select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_IS_PUBLIC = 1)))
-    domain_id := -1;
-
-  if (user_id = -1)
-    if (domain_id = -1)
-    {
-      user_role := 'expire';
-      user_name := 'Expire User';
-    } else {
-      user_role := 'guest';
-      user_name := 'Guest User';
-    }
-
-  return vector('domain_id', domain_id,
-                'user_id',   user_id,
-                'user_name', user_name,
-                'user_role', user_role
+  account_rights := CAL.WA.access_rights (domain_id, account_id);
+  return vector (
+                 'domain_id', domain_id,
+                 'account_id',   account_id,
+                 'account_rights', account_rights
                );
 }
 ;
@@ -102,7 +149,8 @@ create procedure CAL.WA.session_restore (
 -- Freeze Functions
 --
 -------------------------------------------------------------------------------
-create procedure CAL.WA.frozen_check(in domain_id integer)
+create procedure CAL.WA.frozen_check (
+  in domain_id integer)
 {
   declare exit handler for not found { return 1; };
 
@@ -125,7 +173,8 @@ create procedure CAL.WA.frozen_check(in domain_id integer)
 
 -------------------------------------------------------------------------------
 --
-create procedure CAL.WA.frozen_page(in domain_id integer)
+create procedure CAL.WA.frozen_page (
+  in domain_id integer)
 {
   return (select WAI_FREEZE_REDIRECT from DB.DBA.WA_INSTANCE where WAI_ID = domain_id);
 }
@@ -137,21 +186,17 @@ create procedure CAL.WA.frozen_page(in domain_id integer)
 --
 -------------------------------------------------------------------------------
 create procedure CAL.WA.check_admin(
-  in user_id integer) returns integer
+  in user_id integer)
 {
   declare group_id integer;
-  group_id := (select U_GROUP from SYS_USERS where U_ID = user_id);
 
-  if (user_id = 0)
-    return 1;
-  if (user_id = http_dav_uid ())
-    return 1;
-  if (group_id = 0)
+  if ((user_id = 0) or (user_id = http_dav_uid ()))
     return 1;
-  if (group_id = http_dav_uid ())
-    return 1;
-  if(group_id = http_dav_uid()+1)
+
+  group_id := (select U_GROUP from SYS_USERS where U_ID = user_id);
+  if ((group_id = 0) or (group_id = http_dav_uid ()) or (group_id = http_dav_uid()+1))
     return 1;
+
   return 0;
 }
 ;
@@ -159,98 +204,88 @@ create procedure CAL.WA.check_admin(
 -------------------------------------------------------------------------------
 --
 create procedure CAL.WA.check_grants (
-  in domain_id integer,
-  in user_id integer,
-  in role_name varchar)
+  in role_name varchar,
+  in page_name varchar)
 {
-  whenever not found goto _end;
-
-  if (CAL.WA.check_admin(user_id))
-    return 1;
-  if (role_name is null or role_name = '')
-    return 0;
-  if (role_name = 'admin')
-    return 0;
-  if (role_name = 'guest')
-  {
-    if (exists(select 1
-                 from SYS_USERS A,
-                      WA_MEMBER B,
-                      WA_INSTANCE C
-                where A.U_ID = user_id
-                  and B.WAM_USER = A.U_ID
-                  and B.WAM_INST = C.WAI_NAME
-                  and C.WAI_ID = domain_id))
-      return 1;
-  }
-  if (role_name = 'owner')
-  {
-    if (exists(select 1
-                 from SYS_USERS A,
-                      WA_MEMBER B,
-                      WA_INSTANCE C
-                where A.U_ID = user_id
-                  and B.WAM_USER = A.U_ID
-                  and B.WAM_MEMBER_TYPE = 1
-                  and B.WAM_INST = C.WAI_NAME
-                  and C.WAI_ID = domain_id))
-      return 1;
-  }
-_end:
-  return 0;
+  return case when isnull (role_name) then 0 else 1 end;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure CAL.WA.check_grants2(in role_name varchar, in page_name varchar)
+create procedure CAL.WA.access_rights (
+  in domain_id integer,
+  in account_id integer)
 {
-  if (role_name = 'expire')
-    return 0;
-  return 1;
-}
-;
+  declare rc varchar;
 
--------------------------------------------------------------------------------
---
-create procedure CAL.WA.access_role(in domain_id integer, in user_id integer)
-{
-  if (CAL.WA.check_admin (user_id))
-    return 'admin';
+  if (domain_id <= 0)
+    return null;
 
-  for (select B.WAM_MEMBER_TYPE
+  if (CAL.WA.check_admin (account_id))
+    return 'W';
+
+  if (exists (select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
+                 and B.WAM_MEMBER_TYPE = 1
                 and B.WAM_INST = C.WAI_NAME
-          and C.WAI_ID = domain_id) do
+                 and C.WAI_ID = domain_id))
+    return 'W';
+
+  if (exists (select 1
+                from SYS_USERS A,
+                     WA_MEMBER B,
+                     WA_INSTANCE C
+               where A.U_ID = account_id
+                 and B.WAM_USER = A.U_ID
+                 and B.WAM_MEMBER_TYPE = 2
+                 and B.WAM_INST = C.WAI_NAME
+                 and C.WAI_ID = domain_id))
+    return 'W';
+
+  if (is_https_ctx ())
   {
-    if (WAM_MEMBER_TYPE = 1)
-    return 'owner';
-    if (WAM_MEMBER_TYPE = 2)
-    return 'author';
-    return 'reader';
-  }
-  if (exists (select 1 from SYS_USERS A where A.U_ID = user_id))
-    return 'guest';
+    rc := CAL.WA.acl_check (domain_id);
+    if (rc <> '')
+      return rc;
+  }
+
+  if (exists (select 1
+                from SYS_USERS A,
+                     WA_MEMBER B,
+                     WA_INSTANCE C
+               where A.U_ID = account_id
+                 and B.WAM_USER = A.U_ID
+                 and B.WAM_INST = C.WAI_NAME
+                 and C.WAI_ID = domain_id))
+    return 'R';
+
+  if (exists (select 1
+                from DB.DBA.WA_INSTANCE
+               where WAI_ID = domain_id
+                 and WAI_IS_PUBLIC = 1))
+    return 'R';
 
-  return 'public';
+  if (is_https_ctx () and exists (select 1 from CAL.WA.acl_list (id)(iri varchar) x where x.id = domain_id))
+    return '';
+
+  return null;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure CAL.WA.access_is_write (in access_role varchar)
+create procedure CAL.WA.access_is_write (
+  in access_role varchar)
 {
-  if (is_empty_or_null (access_role))
-    return 0;
-  if (access_role = 'guest')
-    return 0;
-  if (access_role = 'public')
-    return 0;
+  if (access_role = 'W')
   return 1;
+
+  return 0;
 }
 ;
 
@@ -315,7 +350,7 @@ create procedure CAL.WA.iri_fix (
   {
     declare V any;
 
-    V := rfc1808_parse_uri (S);
+    V := rfc1808_parse_uri (cast (S as varchar));
     V [0] := 'https';
     V [1] := http_request_header (http_request_header(), 'Host', null, registry_get ('URIQADefaultHost'));
     S := DB.DBA.vspx_uri_compose (V);
@@ -829,6 +864,15 @@ create procedure CAL.WA.forum_iri (
 
 -------------------------------------------------------------------------------
 --
+create procedure CAL.WA.acl_graph (
+  in domain_id integer)
+{
+  return SIOC..acl_graph ('Calendar', CAL.WA.domain_name (domain_id));
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure CAL.WA.domain_sioc_url (
   in domain_id integer,
   in sid varchar := null,
@@ -2387,6 +2431,26 @@ create procedure CAL.WA.dt_reformat(
 }
 ;
 
+-----------------------------------------------------------------------------------------
+--
+create procedure CAL.WA.dt_convert (
+  in pString varchar,
+  in pDefault any := null)
+{
+  if (isnull (pString))
+    goto _end;
+
+  declare exit handler for sqlstate '*' { goto _next; };
+  return stringdate (pString);
+_next:
+  declare exit handler for sqlstate '*' { goto _end; };
+  return http_string_date (pString);
+
+_end:
+  return pDefault;
+}
+;
+
 -----------------------------------------------------------------------------
 --
 create procedure CAL.WA.dt_formatTemplate (
@@ -3515,58 +3579,67 @@ create procedure CAL.WA.checkedAttribute (
 
 -------------------------------------------------------------------------------
 --
-create procedure CAL.WA.dashboard_get(
-  in _domain_id integer,
-  in _account_id integer,
-  in _privacy integer := 0)
+create procedure CAL.WA.dashboard_rs (
+  in p0 integer,
+  in p1 integer := 0)
 {
-  declare sStream any;
+  declare c0 integer;
+  declare c1 varchar;
+  declare c2 datetime;
 
-  sStream := string_output ();
-  http ('<calendar-db>', sStream);
-  if (_privacy = 1)
+  result_names(c0, c1, c2);
+  if (p1 = 1)
   {
     for (select top 10 *
-        from (select a.E_SUBJECT,
-                        SIOC..calendar_event_iri (_domain_id, E_ID) E_URI,
-                     coalesce (a.E_UPDATED, now ()) E_UPDATED
-                from CAL.WA.EVENTS a,
-                     DB.DBA.WA_INSTANCE b,
-                     DB.DBA.WA_MEMBER c
-                  where a.E_DOMAIN_ID = _domain_id
-                    and a.E_PRIVACY >= _privacy
-                  and b.WAI_ID = a.E_DOMAIN_ID
-                  and c.WAM_INST = b.WAI_NAME
-                    and c.WAM_USER = _account_id
-                order by a.E_UPDATED desc
+           from (select E_ID,
+                        E_SUBJECT,
+                        E_UPDATED
+                   from CAL.WA.EVENTS
+                  where E_DOMAIN_ID = p0
+                    and E_PRIVACY = p1
+                  order by E_UPDATED desc
                 ) x
         ) do
   {
-      CAL.WA.dashboard_item (sStream, _account_id, E_SUBJECT, E_URI, E_UPDATED);
+      result (E_ID, E_SUBJECT, coalesce (E_UPDATED, now ()));
   }
   } else {
     for (select top 10 *
-           from (select a.E_SUBJECT,
-                        SIOC..calendar_event_iri (_domain_id, a.E_ID) E_URI,
-                        coalesce (a.E_UPDATED, now ()) E_UPDATED
+           from (select a.E_ID,
+                        a.E_SUBJECT,
+                        a.E_UPDATED
                    from CAL.WA.EVENTS a,
-                        CAL..MY_CALENDARS b,
-                        DB.DBA.WA_INSTANCE c,
-                        DB.DBA.WA_MEMBER d
-                  where b.domain_id = _domain_id
-                    and b.privacy = _privacy
+                        CAL..MY_CALENDARS b
+                  where b.domain_id = p0
+                    and b.privacy = p1
                     and a.E_DOMAIN_ID = b.CALENDAR_ID
                     and a.E_PRIVACY >= b.CALENDAR_PRIVACY
-                    and c.WAI_ID = _domain_id
-                    and d.WAM_INST = c.WAI_NAME
-                    and d.WAM_USER = _account_id
                   order by a.E_UPDATED desc
                 ) x
         ) do
     {
-      CAL.WA.dashboard_item (sStream, _account_id, E_SUBJECT, E_URI, E_UPDATED);
+      result (E_ID, E_SUBJECT, coalesce (E_UPDATED, now ()));
+    }
     }
   }
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.dashboard_get (
+  in domain_id integer,
+  in privacy integer := 0)
+{
+  declare account_id integer;
+  declare sStream any;
+
+  account_id := CAL.WA.domain_owner_id (domain_id);
+  sStream := string_output ();
+  http ('<calendar-db>', sStream);
+  for (select x.* from CAL.WA.dashboard_rs(p0, p1)(_id integer, _name varchar, _time datetime) x where p0 = domain_id and p1 = privacy) do
+  {
+    CAL.WA.dashboard_item (sStream, account_id, _name, SIOC..calendar_event_iri (domain_id, _id), _time);
+  }
   http ('</calendar-db>', sStream);
   return string_output_string (sStream);
 }
@@ -3812,6 +3885,32 @@ create procedure CAL.WA.settings_mailAttendees (
 }
 ;
 
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.settings_taskFilter (
+  in settings any)
+{
+  return get_keyword ('taskFilter', settings, 'All');
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.settings_set (
+  in domain_id integer,
+  in _key varchar,
+  in _value any)
+{
+  declare settings any;
+
+  settings := CAL.WA.settings (domain_id);
+  CAL.WA.set_keyword (_key, settings, _value);
+
+  insert replacing CAL.WA.SETTINGS (S_DOMAIN_ID, S_DATA, S_ACCOUNT_ID)
+    values(domain_id, serialize (settings), CAL.WA.domain_owner_id (domain_id));
+}
+;
+
 -----------------------------------------------------------------------------------------
 --
 -- Events
@@ -4046,22 +4145,26 @@ create procedure CAL.WA.event_update_acl (
 
 -------------------------------------------------------------------------------
 --
-create procedure CAL.WA.event_permissions (
-  in id integer,
+create procedure CAL.WA.event_rights (
   in domain_id integer,
+  in id integer,
   in access_role varchar)
 {
   declare event_domain_id integer;
+  declare retValue varchar;
 
+  retValue := '';
   event_domain_id := (select E_DOMAIN_ID from CAL.WA.EVENTS where E_ID = id);
-  if (isnull (event_domain_id))
-    return '';
-  if (event_domain_id = domain_id)
+  if (not isnull (event_domain_id))
   {
-    if (CAL.WA.access_is_write (access_role))
-    return 'W';
-    return 'R';
+    if (event_domain_id = domain_id)
+    {
+      retValue := CAL.WA.acl_check (domain_id, id);
+      if (retValue = '')
+        retValue := access_role;
   }
+    else
+    {
   for (select a.WAI_IS_PUBLIC,
               b.*,
               c.G_ENABLE,
@@ -4077,17 +4180,46 @@ create procedure CAL.WA.event_permissions (
     if (isnull (S_GRANT_ID))
     {
       if (WAI_IS_PUBLIC = 1)
-        return 'R';
-    } else {
-      if (G_ENABLE)
+            retValue := 'R';
+        }
+        else if (G_ENABLE)
       {
         if (CAL.WA.access_is_write (access_role))
-        return G_MODE;
-        return 'R';
+          {
+            retValue := G_MODE;
+          } else {
+            retValue := access_role;
+          }
       }
     }
   }
-  return '';
+  }
+  return retValue;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.event_check_privacy (
+  in my_domain_id integer,
+  in my_account_id integer,
+  in event_domain_id integer,
+  in event_id integer,
+  in event_privacy integer)
+{
+  -- my event
+  if (my_domain_id = event_domain_id)
+    return 1;
+
+  -- public event
+  if (event_privacy = 1)
+    return 1;
+
+  -- shared event
+  if ((event_privacy = 2) and exists (select 1 from CAL..EVENT_GRANTS_VIEW a where a.EVENT_ID = event_id and a.TO_ID = my_account_id))
+    return 1;
+
+  return 0;
 }
 ;
 
@@ -4550,9 +4682,10 @@ create procedure CAL.WA.events_forPeriod (
   in pDateStart date,
   in pDateEnd date,
   in pPrivacy integer := 0,
-  in pTaskMode integer := 0)
+  in pTaskMode integer := 0,
+  in pRights varchar := '')
 {
-  declare dt_offset, dtTimezone integer;
+  declare dt_offset, dtTimezone, account_id integer;
   declare dtWeekStarts varchar;
   declare dt, dtStart, dtEnd, tzDT, tzEventStart, tzRepeatUntil date;
 
@@ -4565,6 +4698,7 @@ create procedure CAL.WA.events_forPeriod (
   dtWeekStarts := CAL.WA.settings_weekStarts2 (pDomainID);
   dtStart := CAL.WA.event_user2gmt (CAL.WA.dt_dateClear (pDateStart), dtTimezone);
   dtEnd := CAL.WA.event_user2gmt (dateadd ('day', 1, CAL.WA.dt_dateClear (pDateEnd)), dtTimezone);
+  account_id := CAL.WA.domain_owner_id (pDomainID);
 
     if (pTaskMode)
     {
@@ -4583,9 +4717,15 @@ create procedure CAL.WA.events_forPeriod (
             and b.privacy = pPrivacy
             and a.E_DOMAIN_ID = b.CALENDAR_ID
             and a.E_PRIVACY >= b.CALENDAR_PRIVACY
+            and CAL.WA.event_check_privacy (pDomainID, account_id, a.E_DOMAIN_ID, a.E_ID, a.E_PRIVACY)
             and a.E_KIND = 1
             and a.E_EVENT_START <  dtEnd
-            and a.E_EVENT_END   >  dtStart) do
+            and a.E_EVENT_END   > dtStart
+            and ((pRights <> '') or
+                 (is_https_ctx () and
+                  (SIOC..calendar_event_iri (pDomainID, a.E_ID) in (select x.iri from CAL.WA.acl_list (id)(iri varchar) x where x.id = pDomainID))
+                  )
+                )) do
     {
       result (E_ID,
               E_EVENT,
@@ -4613,11 +4753,16 @@ create procedure CAL.WA.events_forPeriod (
         where b.domain_id = pDomainID
           and b.privacy = pPrivacy
           and a.E_DOMAIN_ID = b.CALENDAR_ID
-          and a.E_PRIVACY >= b.CALENDAR_PRIVACY
+          and CAL.WA.event_check_privacy (pDomainID, account_id, a.E_DOMAIN_ID, a.E_ID, a.E_PRIVACY)
           and a.E_KIND = 0
           and (a.E_REPEAT = '' or a.E_REPEAT is null)
           and a.E_EVENT_START < dtEnd
-          and a.E_EVENT_END   > dtStart) do
+          and a.E_EVENT_END   > dtStart
+          and ((pRights <> '') or
+               (is_https_ctx () and
+                (SIOC..calendar_event_iri (pDomainID, a.E_ID) in (select x.iri from CAL.WA.acl_list (id)(iri varchar) x where x.id = pDomainID))
+               )
+              )) do
   {
     result (E_ID,
             E_EVENT,
@@ -4649,11 +4794,16 @@ create procedure CAL.WA.events_forPeriod (
         where b.domain_id = pDomainID
           and b.privacy = pPrivacy
           and a.E_DOMAIN_ID = b.CALENDAR_ID
-          and a.E_PRIVACY >= b.CALENDAR_PRIVACY
+          and CAL.WA.event_check_privacy (pDomainID, account_id, a.E_DOMAIN_ID, a.E_ID, a.E_PRIVACY)
           and a.E_KIND = 0
           and a.E_REPEAT <> ''
           and a.E_EVENT_START < dtEnd
-          and ((a.E_REPEAT_UNTIL is null) or (a.E_REPEAT_UNTIL >= dtStart))) do
+          and ((a.E_REPEAT_UNTIL is null) or (a.E_REPEAT_UNTIL >= dtStart))
+          and ((pRights <> '') or
+               (is_https_ctx () and
+                (SIOC..calendar_event_iri (pDomainID, a.E_ID) in (select x.iri from CAL.WA.acl_list (id)(iri varchar) x where x.id = pDomainID))
+               )
+              )) do
   {
       tzEventStart := CAL.WA.event_gmt2user (E_EVENT_START, dtTimezone);
       tzRepeatUntil := CAL.WA.event_gmt2user (E_REPEAT_UNTIL, dtTimezone);
@@ -4985,42 +5135,43 @@ create procedure CAL.WA.attendees_mails ()
   declare save_id, account_id, domain_id, mailAttendees integer;
   declare T, H varchar;
   declare dateFormat, timeFormat varchar;
-  declare url, account_mail, subject, period, subject_mail, content_text, content_html varchar;
+  declare url, domain, account_mail, subject, period, subject_mail, content_text, content_html, content_ical varchar;
 
-  H := '<table cellspacing="0" cellpadding="0" border="0" width="100%%"> ' ||
+  H := '<table cellspacing="0" cellpadding="0" border="0" width="600px"> ' ||
        '  <tr> ' ||
-       '    <td nowrap="noswap"><b>ODS Calendar</b></td> ' ||
-       '    <td align="right" valign="bottom" nowrap="nowrap"><b>Meeting Request</b></td> ' ||
+       '    <td><b>ODS Calendar</b></td> ' ||
+       '    <td nowrap="nowrap">%V</td> ' ||
        '  </tr> ' ||
        '  <tr> ' ||
-       '    <td colspan="2" bgcolor="#800000" height="1"></td> ' ||
+       '    <td><b>Reason</b></td> ' ||
+       '    <td nowrap="nowrap">Meeting Request</td> ' ||
        '  </tr> ' ||
        '  <tr> ' ||
-       '    <td valign="top" width="100%%" colspan="2" style="padding-top:10px;"> ' ||
-       '      <br /><br /> ' ||
-       '      <table width="600" border="0" cellspacing="0" cellpadding="5"> ' ||
+       '    <td colspan="2"><br /></td> ' ||
+       '  </tr> ' ||
        '        <tr> ' ||
        '          <td><b>Subject</b></td>  ' ||
-       '          <td>%s</td> ' ||
+       '    <td>%V</td> ' ||
        '        </tr> ' ||
        '        <tr> ' ||
        '          <td><b>When</b></td> ' ||
-       '          <td>%s</td> ' ||
+       '    <td>%s<br /></td> ' ||
        '        </tr> ' ||
        '        <tr> ' ||
        '          <td><b>Please RSVP</b></td> ' ||
-       '          <td><a href="%s" target="new"><b>Respond to Meeting Request</b></a></td> ' ||
+       '    <td><a href="%s&a=A" target="new"><b>Accept</b></a> <a href="%s&a=D" target="new"><b>Decline</b></a> <a href="%s&a=T" target="new"><b>Tentative</b></a></td> ' ||
        '        </tr> ' ||
-       '      </table> ' ||
-       '      <br /><br /> ' ||
-       '    </td> ' ||
+       '  <tr> ' ||
+       '    <td></td> ' ||
+       '    <td><br /><a href="%s" target="new"><b>Details</b></a></td> ' ||
        '  </tr> ' ||
        '  <tr> ' ||
-       '    <td colspan="2" width="100%%"><br><font size="1"> ' ||
+       '    <td colspan="2"><br /><font size="1"> ' ||
+       '      <br />' ||
        '      If the link appears to be inactive, just cut and paste it into a browser location bar and click Enter ' ||
-       '      <br>----------------------<br> ' ||
+       '      <br />----------------------<br /> ' ||
        '      <a href="%s" target="new">%s</a> ' ||
-       '      <br>----------------------<br> ' ||
+       '      <br />----------------------<br /></font>' ||
        '	  </td> ' ||
        '  </tr> ' ||
        '</table> ';
@@ -5060,6 +5211,7 @@ create procedure CAL.WA.attendees_mails ()
         }
       }
       save_id := event_id;
+      domain := CAL.WA.domain_name (domain_id);
       account_id := CAL.WA.domain_owner_id (domain_id);
       account_mail := CAL.WA.account_mail (account_id);
     }
@@ -5073,9 +5225,11 @@ create procedure CAL.WA.attendees_mails ()
     };
 
     url := sprintf ('%sattendees.vspx?uid=%U', CAL.WA.calendar_url (domain_id), uid);
-    content_html := sprintf (H, subject, period, url, url, url);
+    content_html := sprintf (H, domain, subject, period, url, url, url, url, url, url);
     content_text := sprintf (T, subject, period, url);
-    CAL.WA.send_mail (account_mail, mail, subject_mail, content_text, content_html);
+    content_ical := CAL.WA.export_vcal (domain_id, vector (save_id));
+
+    CAL.WA.send_mail (account_mail, mail, subject_mail, content_text, content_html, content_ical);
     update CAL.WA.ATTENDEES
        set AT_DATE_REQUEST = now (),
            AT_STATUS = 'N'
@@ -5093,9 +5247,10 @@ create procedure CAL.WA.send_mail (
   in _to any,
   in _subject any,
   in _message_text any,
-  in _message_html any)
+  in _message_html any,
+  in _message_ical any)
 {
-  declare _smtp_server, _mail_body, _mail_body_text, _mail_body_html, _encoded, _date any;
+  declare _smtp_server, _mail_body, _mail_body_text, _mail_body_html, _mail_body_ical, _encoded, _date any;
 
   if ((select max(WS_USE_DEFAULT_SMTP) from WA_SETTINGS) = 1)
   {
@@ -5109,12 +5264,12 @@ create procedure CAL.WA.send_mail (
   _date := sprintf ('Date: %s\r\n', date_rfc1123 (now ()));
   _mail_body_text := mime_part ('text/plain; charset=UTF-8', null, null, _message_text);
   _mail_body_html := mime_part ('text/html; charset=UTF-8', null, null, _message_html);
-  _mail_body := _date || _subject || mime_body (vector (_mail_body_html, _mail_body_text));
+  _mail_body_ical := mime_part ('application/ics; name="invite.ics"', 'attachment; filename="invite.ics"', 'base64', _message_ical);
+  _mail_body := _date || _subject || mime_body (vector (_mail_body_html, _mail_body_text, _mail_body_ical));
 
   if(not _smtp_server or length(_smtp_server) = 0)
-  {
     signal('WA002', 'The Mail Server is not defined. Mail can not be sent.');
-  }
+
   smtp_send (_smtp_server, _from, _to, _mail_body);
 }
 ;
@@ -5125,9 +5280,10 @@ create procedure CAL.WA.send_mail (
 --
 -------------------------------------------------------------------------------
 create procedure CAL.WA.search_sql (
-  inout domain_id integer,
-  inout privacy integer,
-  inout data varchar)
+  in domain_id integer,
+  in privacy integer,
+  in data varchar,
+  in account_rights varchar := '')
 {
   declare S, tmp, where2, delimiter2 varchar;
 
@@ -5155,8 +5311,19 @@ create procedure CAL.WA.search_sql (
        ' where b.domain_id = <DOMAIN_ID>     \n' ||
        '   and b.privacy = <PRIVACY>         \n' ||
        '   and a.E_DOMAIN_ID = b.CALENDAR_ID \n' ||
-       '   and a.E_PRIVACY >= b.CALENDAR_PRIVACY <TEXT> <TAGS> <WHERE> \n';
+       '   and CAL.WA.event_check_privacy (<DOMAIN_ID>, <ACCOUNT_ID>, a.E_DOMAIN_ID, a.E_ID, a.E_PRIVACY) <TEXT> <TAGS> <WHERE> \n';
 
+  if (account_rights = '')
+  {
+    if (is_https_ctx ())
+    {
+      S := S || ' and SIOC..calendar_event_iri (<DOMAIN_ID>, a.E_ID) in (select x.iri from CAL.WA.acl_list (id)(iri varchar) x where x.id = <DOMAIN_ID>)';
+    } else {
+      S := S || ' and 1=0';
+    }
+  }
+  if (not isnull (data))
+  {
   tmp := CAL.WA.xml_get ('keywords', data);
   if (not is_empty_or_null (tmp))
   {
@@ -5173,8 +5340,9 @@ create procedure CAL.WA.search_sql (
     tmp := CAL.WA.tags2search (tmp);
     S := replace (S, '<TAGS>', sprintf ('and contains (a.E_SUBJECT, \'[__lang "x-ViDoc"] %s\') \n', tmp));
   }
-
+  }
   S := replace (S, '<DOMAIN_ID>', cast (domain_id as varchar));
+  S := replace (S, '<ACCOUNT_ID>', cast (CAL.WA.domain_owner_id (domain_id) as varchar));
   S := replace (S, '<PRIVACY>', cast (privacy as varchar));;
   S := replace (S, '<TAGS>', '');
   S := replace (S, '<TEXT>', '');
@@ -5267,7 +5435,7 @@ create procedure CAL.WA.vcal_str2privacy (
   declare N integer;
   declare S, V any;
 
-  V := vector ('PUBLIC', 1, 'PRIVATE', 0);
+  V := vector ('SHARED', 2, 'PUBLIC', 1, 'PRIVATE', 0);
   S := cast (xquery_eval (xmlPath, xmlItem, 1) as varchar);
   for (N := 0; N < length (V); N := N + 2)
     if (lcase (S) = lcase (V[N]))
@@ -5530,12 +5698,26 @@ create procedure CAL.WA.vcal_str2reminder (
 
 -------------------------------------------------------------------------------
 --
-create procedure CAL.WA.export_vcal_reminder (
-  in eReminder integer,
+create procedure CAL.WA.export_vcal_privacy (
+  in privacy integer,
   inout sStream any)
 {
   declare V any;
 
+  if (is_empty_or_null (privacy))
+    return;
+
+  V := vector (2, 'SHARED', 1, 'PUBLIC', 0, 'PRIVATE');
+  http (sprintf ('CLASS:%s\r\n', get_keyword (privacy, V)), sStream);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.export_vcal_reminder (
+  in eReminder integer,
+  inout sStream any)
+{
   if (is_empty_or_null (eReminder))
     return;
 
@@ -5687,7 +5869,7 @@ create procedure CAL.WA.export_vcal (
         CAL.WA.export_vcal_reminder (E_REMINDER, sStream);
         CAL.WA.export_vcal_attendees (E_ID, E_DOMAIN_ID, E_ATTENDEES, sStream);
         CAL.WA.export_vcal_line ('X-OL-NOTES', E_NOTES, sStream);
-        CAL.WA.export_vcal_line ('CLASS', case when E_PRIVACY = 1 then 'PUBLIC' else 'PRIVATE' end, sStream);
+        CAL.WA.export_vcal_privacy (E_PRIVACY, sStream);
         http ('END:VEVENT\r\n', sStream);
       }
     }
@@ -5716,7 +5898,7 @@ create procedure CAL.WA.export_vcal (
         CAL.WA.export_vcal_line ('STATUS', E_STATUS, sStream);
         CAL.WA.export_vcal_attendees (E_ID, E_DOMAIN_ID, E_ATTENDEES, sStream);
         CAL.WA.export_vcal_line ('X-OL-NOTES', E_NOTES, sStream);
-        CAL.WA.export_vcal_line ('CLASS', case when E_PRIVACY = 1 then 'PUBLIC' else 'PRIVATE' end, sStream);
+        CAL.WA.export_vcal_privacy (E_PRIVACY, sStream);
         http ('END:VTODO\r\n', sStream);
       }
     }
@@ -5767,7 +5949,14 @@ create procedure CAL.WA.import_vcal (
   declare vcalVersion, vcalImported any;
   declare tzDict, tzID, tzOffset any;
 
+  if (not isstring (content))
+    content := cast (content as varchar);
+
+  if (strstr (content, '<?xml') = 0)
+    return CAL.WA.import_feed (domain_id, content, options, exchange_id, updatedBefore);
+
   vcalImported := vector ();
+
   -- options
   oEvents := 1;
   oTasks := 1;
@@ -5784,13 +5973,7 @@ create procedure CAL.WA.import_vcal (
   }
 
   -- using DAV parser
-  if (not isstring (content))
-  {
-    xmlData := DB.DBA.IMC_TO_XML (cast (content as varchar));
-  } else {
-    xmlData := DB.DBA.IMC_TO_XML (content);
-  }
-  xmlData := xml_tree_doc (xmlData);
+  xmlData := xml_tree_doc (DB.DBA.IMC_TO_XML (content));
   xmlItems := xpath_eval ('/*', xmlData, 0);
   foreach (any xmlItem in xmlItems) do
   {
@@ -5919,32 +6102,30 @@ create procedure CAL.WA.import_vcal (
         completed := CAL.WA.dt_join (completed, CAL.WA.dt_timeEncode (12, 0));
         updated := CAL.WA.vcal_str2date (xmlItem, sprintf ('IMC-VTODO[%d]/DTSTAMP/', N), tzDict);
           notes := cast (xquery_eval (sprintf ('IMC-VTODO[%d]/X-OL-NOTES/val', N), xmlItem, 1) as varchar);
-          connection_set ('__calendar_import', '1');
-          id := CAL.WA.task_update
+          attendees := CAL.WA.import_vcal_attendees (xmlItem, sprintf ('IMC-VTODO[%d]/ATTENDEE', N));
+          id := CAL.WA.import_task_update
           (
-            id,
-            uid,
-            domain_id,
-            subject,
-            description,
-            null,
-            privacy,
-            eventTags,
-            eEventStart,
-            eEventEnd,
-            priority,
-            status,
-            complete,
-            completed,
-            notes,
-            updated
+                  id,              -- id
+                  uid,             -- uid
+                  domain_id,       -- domain_id
+                  subject,         -- subject
+                  description,     -- description
+                  null,            -- attendees
+                  privacy,         -- privacy
+                  eventTags,       -- tags
+                  eEventStart,     -- eEventStart
+                  eEventEnd,       -- eEventEnd
+                  priority,        -- priority
+                  status,          -- status
+                  complete,        -- complete
+                  completed,       -- completed
+                  notes,           -- notes
+                  updated,         -- updated
+                  exchange_id,     -- exchange_id
+                  updatedBefore,   -- updatedBefore
+                  attendees,       -- attendees
+                  oMailAttendees   -- mailAttendees
           );
-          if (not isnull (exchange_id))
-            update CAL.WA.EVENTS set E_EXCHANGE_ID = exchange_id where E_ID = id;
-          attendees := CAL.WA.import_vcal_attendees (xmlItem, sprintf ('IMC-VTODO[%d]/ATTENDEE', N));
-          if (length (attendees))
-            CAL.WA.attendees_update2 (id, attendees, oMailAttendees);
-          connection_set ('__calendar_import', '0');
           vcalImported := vector_concat (vcalImported, vector (id));
 
         _skip2:;
@@ -5994,6 +6175,238 @@ create procedure CAL.WA.import_vcal_attendees (
 }
 ;
 
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.import_feed (
+  in domain_id integer,
+  in content any,
+  in options any := null,
+  in exchange_id integer := null,
+  in updatedBefore integer := null)
+{
+  declare id integer;
+  declare tags any;
+  declare xt, items any;
+  declare vcalImported any;
+
+  vcalImported := vector ();
+
+  -- options
+  tags := '';
+  if (not isnull (options))
+    tags := get_keyword ('tags', options, '');
+
+  xt := CAL.WA.string2xml (content);
+  if (xpath_eval ('/rss/channel/item|/rss/item|/RDF/item|/Channel/items/item', xt) is not null)
+  {
+    -- RSS formats
+    items := xpath_eval ('/rss/channel/item|/rss/item|/RDF/item|/Channel/items/item', xt, 0);
+    foreach (any item in items) do
+    {
+      id := CAL.WA.import_feed_rss_item (domain_id, exchange_id, updatedBefore, tags, xml_cut (item));
+      vcalImported := vector_concat (vcalImported, vector (id));
+    }
+  }
+  else if (xpath_eval ('/feed/entry', xt) is not null)
+  {
+    -- Atom format
+    items := xpath_eval ('/feed/entry', xt, 0);
+    foreach (any item in items) do
+    {
+      id := CAL.WA.import_feed_atom_item (domain_id, exchange_id, updatedBefore, tags, xml_cut (item));
+      vcalImported := vector_concat (vcalImported, vector (id));
+    }
+  }
+
+  return vcalImported;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.import_feed_rss_item (
+  in domain_id integer,
+  in exchange_id integer,
+  in updatedBefore integer,
+  in tags varchar,
+  inout xt any)
+{
+  declare id integer;
+  declare subject, description, link, uid, pubDate varchar;
+
+  subject := serialize_to_UTF8_xml (xpath_eval ('string(/item/title)', xt, 1));
+  description := xpath_eval ('[ xmlns:content="http://purl.org/rss/1.0/modules/content/" ] string(/item/content:encoded)', xt, 1);
+  if (is_empty_or_null (description))
+    description := xpath_eval ('string(/item/description)', xt, 1);
+  description := CAL.WA.string2xml (serialize_to_UTF8_xml (description));
+  link := cast (xpath_eval ('/item/link', xt, 1) as varchar);
+  if (isnull (link))
+  {
+    link := cast (xpath_eval ('[xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"] /item/@rdf:about', xt, 1) as varchar);
+    if ((isnull (link)) and isnull (cast(xpath_eval ('/item/guid[@isPermaLink = "false"]', xt, 1) as varchar)))
+      link := cast (xpath_eval ('/item/guid', xt, 1) as varchar);
+  }
+  uid := cast (xpath_eval ('/item/guid', xt, 1) as varchar);
+  pubDate := CAL.WA.dt_convert(cast (xpath_eval ('[ xmlns:dc="http://purl.org/dc/elements/1.1/" ] /item/dc:date', xt, 1) as varchar));
+  if (isnull (pubDate))
+    pubDate := CAL.WA.dt_convert(cast(xpath_eval('/item/pubDate', xt, 1) as varchar), now());
+
+  id := CAL.WA.import_task_update
+        (
+          id,                                   -- id
+          uid,                                  -- uid
+          domain_id,                            -- domain_id
+          subject,                              -- subject
+          description,                          -- description
+          null,                                 -- attendees
+          CAL.WA.domain_is_public (domain_id),  -- privacy
+          tags,                                 -- tags
+          pubDate,                              -- eEventStart
+          pubDate,                              -- eEventEnd
+          3,                                    -- priority
+          null,                                 -- status
+          null,                                 -- complete
+          null,                                 -- completed
+          null,                                 -- notes
+          null,                                 -- updated
+          exchange_id,                          -- exchange_id
+          updatedBefore                         -- updatedBefore
+        );
+  return id;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.import_feed_atom_item(
+  in domain_id integer,
+  in exchange_id integer,
+  in updatedBefore integer,
+  in tags varchar,
+  inout xt any)
+{
+  declare id integer;
+  declare subject, description, link, uid, pubDate varchar;
+  declare contents any;
+
+  subject := serialize_to_UTF8_xml (xpath_eval ('string(/entry/title)', xt, 1));
+  if (xpath_eval ('/entry/content[@type = "application/xhtml+xml" or @type="xhtml"]', xt) is not null)
+  {
+    contents := xpath_eval ('/entry/content/*', xt, 0);
+    if (length (contents) = 1)
+    {
+      description := CAL.WA.xml2string(contents[0]);
+    } else {
+      description := '<div>';
+      foreach (any content in contents) do
+        description := concat(description, CAL.WA.xml2string(content));
+      description := concat(description, '</div>');
+    }
+  } else {
+    description := xpath_eval ('string(/entry/content)', xt, 1);
+    if (is_empty_or_null(description))
+      description := xpath_eval ('string(/entry/summary)', xt, 1);
+    description := CAL.WA.string2xml (serialize_to_UTF8_xml (description));
+  }
+  link := cast (xpath_eval ('/entry/link[@rel="alternate"]/@href', xt, 1) as varchar);
+  uid := cast (xpath_eval ('/entry/id', xt, 1) as varchar);
+  pubDate := CAL.WA.dt_convert(cast(xpath_eval ('/entry/created', xt, 1) as varchar), null);
+  if (isnull (pubDate))
+  {
+    pubdate := CAL.WA.dt_convert(cast(xpath_eval ('/entry/modified', xt, 1) as varchar), null);
+    if (isnull (pubDate))
+    {
+      pubdate := CAL.WA.dt_convert(cast(xpath_eval ('/entry/updated', xt, 1) as varchar), null);
+      if (isnull (pubDate))
+        pubdate := now();
+    }
+  }
+  id := CAL.WA.import_task_update
+        (
+          id,                                   -- id
+          uid,                                  -- uid
+          domain_id,                            -- domain_id
+          subject,                              -- subject
+          description,                          -- description
+          null,                                 -- attendees
+          CAL.WA.domain_is_public (domain_id),  -- privacy
+          tags,                                 -- tags
+          pubDate,                              -- eEventStart
+          pubDate,                              -- eEventEnd
+          3,                                    -- priority
+          null,                                 -- status
+          null,                                 -- complete
+          null,                                 -- completed
+          null,                                 -- notes
+          null,                                 -- updated
+          exchange_id,                          -- exchange_id
+          updatedBefore                         -- updatedBefore
+        );
+  return id;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.import_task_update (
+  in id integer,
+  in uid varchar,
+  in domain_id integer,
+  in subject varchar,
+  in description varchar,
+  in attendees varchar,
+  in privacy integer,
+  in tags varchar,
+  in eEventStart datetime,
+  in eEventEnd datetime,
+  in priority integer,
+  in status varchar,
+  in complete integer,
+  in completed datetime,
+  in notes varchar := null,
+  in updated datetime := null,
+  in exchange_id integer := null,
+  in updatedBefore integer := null,
+  in attendees any := null,
+  in mailAttendees any := null)
+{
+  id := coalesce ((select E_ID from CAL.WA.EVENTS where E_DOMAIN_ID = domain_id and E_UID = uid), -1);
+  if ((id <> -1) and not isnull (updatedBefore))
+  {
+    if (exists (select 1 from CAL.WA.EVENTS where E_ID = id and E_UPDATED >= updatedBefore))
+      goto _exit;
+  }
+  connection_set ('__calendar_import', '1');
+  id := CAL.WA.task_update
+        (
+          id,
+          uid,
+          domain_id,
+          subject,
+          description,
+          null,
+          privacy,
+          tags,
+          eEventStart,
+          eEventEnd,
+          priority,
+          status,
+          complete,
+          completed,
+          notes,
+          updated
+        );
+  if (not isnull (exchange_id))
+    update CAL.WA.EVENTS set E_EXCHANGE_ID = exchange_id where E_ID = id;
+  if (length (attendees))
+    CAL.WA.attendees_update2 (id, attendees, mailAttendees);
+  connection_set ('__calendar_import', '0');
+
+_exit:;
+  return id;
+}
+;
+
 --------------------------------------------------------------------------------
 --
 create procedure CAL.WA.exchange_name (
diff --git a/appsrc/ODS-Calendar/sql/calendar-a-table.sql b/appsrc/ODS-Calendar/sql/calendar-a-table.sql
index 23ee88b..8010ba1 100644
--- a/appsrc/ODS-Calendar/sql/calendar-a-table.sql
+++ b/appsrc/ODS-Calendar/sql/calendar-a-table.sql
@@ -1,5 +1,5 @@
 --
---  $Id: calendar-a-table.sql,v 1.26.2.2 2009/11/17 21:37:40 source Exp $
+--  $Id: calendar-a-table.sql,v 1.26.2.5 2010/11/19 16:50:15 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -205,6 +205,7 @@ CAL.WA.exec_no_error ('
                                           -- 1 - Task
     E_PRIVACY integer default 0,          -- 0 - PRIVATE
                                           -- 1 - PUBLIC
+                                          -- 2 - ACL
     E_ATTENDEES integer default 0,        -- 0 - no attendees
                                           -- N - number of attendees
     E_SUBJECT varchar,
@@ -528,6 +529,67 @@ create procedure CAL.WA.tags_update (
 -------------------------------------------------------------------------------
 --
 CAL.WA.exec_no_error ('
+  create table CAL.WA.EVENT_GRANTS (
+    G_ID integer identity,
+    G_GRANTER_ID integer not null,
+    G_GRANTEE_ID integer not null,
+    G_EVENT_ID integer not null,
+
+    PRIMARY KEY (G_ID)
+  )
+');
+
+CAL.WA.exec_no_error ('
+  create index SK_EVENT_GRANTS_01 on CAL.WA.EVENT_GRANTS (G_GRANTER_ID, G_EVENT_ID)
+');
+
+CAL.WA.exec_no_error ('
+  create index SK_EVENT_GRANTS_02 on CAL.WA.EVENT_GRANTS (G_GRANTEE_ID, G_EVENT_ID)
+');
+
+CAL.WA.exec_no_error ('
+  alter table CAL.WA.EVENT_GRANTS add constraint FK_CAL_EVENT_GRANTS_01 FOREIGN KEY (G_EVENT_ID) references CAL.WA.EVENTS (E_ID) on delete cascade
+');
+
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.event_grants_procedure (
+  in to_id integer,
+  in event_id integer := null)
+{
+  declare c0 integer;
+
+  result_names (c0);
+  for (select distinct G_EVENT_ID
+         from CAL.WA.EVENT_GRANTS
+        where G_GRANTEE_ID = to_id
+          and (G_EVENT_ID = event_id or event_id is null)
+        order by 1) do
+  {
+    result (G_EVENT_ID);
+  }
+  for (select distinct G_EVENT_ID
+         from CAL.WA.EVENT_GRANTS a,
+              DB.DBA.SYS_ROLE_GRANTS c
+        where (a.G_EVENT_ID  = event_id or event_id is null)
+          and c.GI_SUPER     = to_id
+          and c.GI_GRANT     = a.G_GRANTEE_ID
+          and c.GI_DIRECT    = '1'
+        order by 1) do
+  {
+    result (G_EVENT_ID);
+  }
+}
+;
+
+CAL.WA.exec_no_error ('
+  create procedure view CAL..EVENT_GRANTS_VIEW as CAL.WA.event_grants_procedure (to_id, event_id) (G_EVENT_ID integer)
+')
+;
+
+-------------------------------------------------------------------------------
+--
+CAL.WA.exec_no_error ('
   create table CAL.WA.ALARMS (
     A_ID integer identity,
     A_DOMAIN_ID integer not null,
diff --git a/appsrc/ODS-Calendar/sql/calendar-a-update.sql b/appsrc/ODS-Calendar/sql/calendar-a-update.sql
index db6e341..83d3693 100644
--- a/appsrc/ODS-Calendar/sql/calendar-a-update.sql
+++ b/appsrc/ODS-Calendar/sql/calendar-a-update.sql
@@ -1,5 +1,5 @@
 --
---  $Id: calendar-a-update.sql,v 1.1.2.1 2009/11/17 21:37:40 source Exp $
+--  $Id: calendar-a-update.sql,v 1.1.2.3 2010/10/07 13:23:18 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -186,3 +186,19 @@ create procedure CAL.WA.tmp_update ()
 ;
 CAL.WA.tmp_update ()
 ;
+
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.tmp_update ()
+{
+  if (registry_get ('cal_acl_update') = '1')
+    return;
+  registry_set ('cal_acl_update', '1');
+
+  set triggers off;
+  update CAL.WA.EVENTS set E_ACL = null where E_ACL is not null;
+  set triggers on;
+}
+;
+
+CAL.WA.tmp_update ();
diff --git a/appsrc/ODS-Calendar/sql/calendar-a-wa.sql b/appsrc/ODS-Calendar/sql/calendar-a-wa.sql
index a3cbf47..8438653 100644
--- a/appsrc/ODS-Calendar/sql/calendar-a-wa.sql
+++ b/appsrc/ODS-Calendar/sql/calendar-a-wa.sql
@@ -1,5 +1,5 @@
 --
---  $Id: calendar-a-wa.sql,v 1.8.2.1 2010/05/18 10:41:26 source Exp $
+--  $Id: calendar-a-wa.sql,v 1.8.2.5 2010/09/22 13:57:03 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -187,6 +187,12 @@ CAL.WA.exec_no_error (
 )
 ;
 
+CAL.WA.exec_no_error (
+  'alter type wa_Calendar add overriding method wa_dashboard () returns any'
+)
+;
+
+
 -------------------------------------------------------------------------------
 --
 -- wa_Calendar methods
@@ -211,7 +217,18 @@ create method wa_id () for wa_Calendar
 --
 create method wa_drop_instance () for wa_Calendar
 {
-  CAL.WA.domain_delete (self.wa_id ());
+  declare iWaiID integer;
+
+  iWaiID := self.wa_id ();
+  for (select HP_LPATH as _lpath,
+              HP_HOST as _vhost,
+              HP_LISTEN_HOST as _lhost
+         from DB.DBA.HTTP_PATH
+        where HP_LPATH = '/calendar/' || cast (iWaiID as varchar)) do
+  {
+    VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+  }
+  CAL.WA.domain_delete (iWaiID);
   (self as web_app).wa_drop_instance ();
 }
 ;
@@ -380,25 +397,42 @@ create method get_param (in param varchar) for wa_Calendar
 
 -------------------------------------------------------------------------------
 --
-create method wa_dashboard_last_item () for wa_Calendar
+create method wa_dashboard () for wa_Calendar
 {
-  declare domainID, userID integer;
+  declare iWaiID integer;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  userID := (select WAM_USER from WA_MEMBER B where WAM_INST = self.wa_name and WAM_MEMBER_TYPE = 1);
-  return CAL.WA.dashboard_get (domainID, userID, 1);
+  iWaiID := self.wa_id ();
+  return (select XMLAGG ( XMLELEMENT ( 'dash-row',
+                                       XMLATTRIBUTES ( 'normal' as "class",
+                                                       CAL.WA.dt_format(_time, 'Y/M/D H:N') as "time",
+                                                       self.wa_name as "application"
+                                                      ),
+                                       XMLELEMENT ( 'dash-data',
+	                                                  XMLATTRIBUTES ( concat (N'<a href="', cast (SIOC..calendar_event_iri (iWaiID, _id) as nvarchar), N'">', CAL.WA.utf2wide (_title), N'</a>') as "content",
+	                                                                  0 as "comments"
+	                                                                )
+                                          	      )
+                                     )
+                     	  )
+            from CAL.WA.dashboard_rs(p0, p1)(_id integer, _title varchar, _time datetime) x
+           where p0 = iWaiID and p1 = 1
+         );
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create method wa_dashboard_user_items () for wa_Calendar
+create method wa_dashboard_last_item () for wa_Calendar
 {
-  declare domainID, userID integer;
+  return CAL.WA.dashboard_get (self.wa_id (), 1);
+}
+;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  userID := (select WAM_USER from WA_MEMBER B where WAM_INST = self.wa_name and WAM_MEMBER_TYPE = 1);
-  return CAL.WA.dashboard_get (domainID, userID, 0);
+-------------------------------------------------------------------------------
+--
+create method wa_dashboard_user_items () for wa_Calendar
+{
+  return CAL.WA.dashboard_get (self.wa_id (), 0);
 }
 ;
 
@@ -408,8 +442,8 @@ create method wa_rdf_url (in vhost varchar, in lhost varchar) for wa_Calendar
 {
   declare domainID, userID integer;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  userID := (select WAM_USER from WA_MEMBER B where WAM_INST= self.wa_name and WAM_MEMBER_TYPE = 1);
+  domainID := self.wa_id ();
+  userID := CAL.WA.domain_owner_id (domainID);
 
   return concat(CAL.WA.dav_url2(domainID, userID), 'Calendar.rdf');
 }
@@ -442,3 +476,40 @@ create method wa_update_instance (in oldValues any, in newValues any) for wa_Cal
   return (self as web_app).wa_update_instance (oldValues, newValues);
 }
 ;
+
+-------------------------------------------------------------------------------
+--
+create procedure CAL.WA.path_upgrade ()
+{
+  declare _new_lpath varchar;
+
+  if (registry_get ('cal_path_upgrade2') = '1')
+    return;
+
+  for (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_TYPE_NAME = 'Calendar') do
+  {
+    for (select HP_LPATH as _lpath,
+                HP_HOST as _vhost,
+                HP_LISTEN_HOST as _lhost
+           from DB.DBA.HTTP_PATH
+          where HP_LPATH = '/calendar/' || cast (WAI_ID as varchar) || '/home.vspx') do
+    {
+      _new_lpath := '/calendar/' || cast (WAI_ID as varchar);
+      if (exists (select 1 from DB.DBA.HTTP_PATH where HP_LPATH = _new_lpath and HP_HOST  = _vhost and HP_LISTEN_HOST = _lhost))
+      {
+        VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+      } else {
+        update DB.DBA.HTTP_PATH
+           set HP_LPATH = _new_lpath
+         where HP_LPATH = _lpath
+           and HP_HOST  = _vhost
+           and HP_LISTEN_HOST = _lhost;
+        http_map_del (_lpath, _vhost, _lhost);
+        VHOST_MAP_RELOAD (vhost=>_vhost, lhost=>_lhost, lpath=>_new_lpath);
+      }
+    }
+  }
+  registry_set ('cal_path_upgrade2', '1');
+}
+;
+CAL.WA.path_upgrade ();
diff --git a/appsrc/ODS-Calendar/sql/calendar-d.sql b/appsrc/ODS-Calendar/sql/calendar-d.sql
index 6b6d1b9..9dbc89a 100644
--- a/appsrc/ODS-Calendar/sql/calendar-d.sql
+++ b/appsrc/ODS-Calendar/sql/calendar-d.sql
@@ -1,5 +1,5 @@
 --
---  $Id: calendar-d.sql,v 1.12.2.2 2010/05/31 21:59:14 source Exp $
+--  $Id: calendar-d.sql,v 1.12.2.5 2010/11/19 16:50:15 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -86,6 +86,7 @@ CAL.WA.exec_no_error('drop type wa_Calendar');
 -- Views
 CAL.WA.exec_no_error('drop view CAL..TAGS_VIEW');
 CAL.WA.exec_no_error('drop view CAL..MY_CALENDARS');
+CAL.WA.exec_no_error ('drop view CAL..EVENT_GRANTS_VIEW');
 
 -- Registry
 registry_remove ('calendar_path');
@@ -98,6 +99,7 @@ registry_remove ('cal_description_update');
 registry_remove ('cal_index_version');
 registry_remove ('cal_uid_version');
 registry_remove ('cal_attendee_update');
+registry_remove ('cal_path_upgrade2');
 registry_remove ('cal_atom_update');
 
 -- Procedures
diff --git a/appsrc/ODS-Calendar/sql/sioc_calendar.sql b/appsrc/ODS-Calendar/sql/sioc_calendar.sql
index dd4b29d..b7a9178 100644
--- a/appsrc/ODS-Calendar/sql/sioc_calendar.sql
+++ b/appsrc/ODS-Calendar/sql/sioc_calendar.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sioc_calendar.sql,v 1.19.2.4 2010/05/18 10:41:26 source Exp $
+--  $Id: sioc_calendar.sql,v 1.19.2.9 2010/10/13 12:14:39 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -109,6 +109,25 @@ create procedure fill_ods_calendar_sioc (
   declare c_iri, creator_iri, iri varchar;
 
   {
+    for (select WAI_ID,
+                WAI_TYPE_NAME,
+                WAI_NAME,
+                WAI_ACL
+           from DB.DBA.WA_INSTANCE
+          where ((_wai_name is null) or (WAI_NAME = _wai_name))
+            and WAI_TYPE_NAME = 'Calendar') do
+    {
+      graph_iri := SIOC..acl_graph (WAI_TYPE_NAME, WAI_NAME);
+      exec (sprintf ('sparql clear graph <%s>', graph_iri));
+      SIOC..wa_instance_acl_insert (WAI_TYPE_NAME, WAI_NAME, WAI_ACL);
+      for (select E_DOMAIN_ID, E_ID, E_ACL
+             from CAL.WA.EVENTS
+            where E_DOMAIN_ID = WAI_ID and E_ACL is not null) do
+      {
+        event_acl_insert (E_DOMAIN_ID, E_ID, E_ACL);
+      }
+    }
+
     id := -1;
     deadl := 3;
     cnt := 0;
@@ -143,7 +162,8 @@ create procedure fill_ods_calendar_sioc (
                 E_CREATED,
                 E_UPDATED,
                 E_TAGS,
-                E_NOTES
+                E_NOTES,
+                E_ACL
            from DB.DBA.WA_INSTANCE,
                 DB.DBA.WA_MEMBER,
                 CAL.WA.EVENTS
@@ -178,7 +198,6 @@ create procedure fill_ods_calendar_sioc (
                     E_UPDATED,
                     E_TAGS,
                     E_NOTES);
-
 	    for (select EC_ID,
                   EC_DOMAIN_ID,
                   EC_EVENT_ID,
@@ -278,7 +297,6 @@ create procedure ods_calendar_services (
 {
   declare svc_iri varchar;
   
-  -- dbg_obj_print (now (), 'ods_calendar_services');
   svc_iri := sprintf ('http://%s%s/%U/calendar/%U/atom-pub', get_cname(), get_base_path (), CAL.WA.domain_owner_name (wai_id), wai_name);
   ods_sioc_service (graph_iri, svc_iri, forum_iri, null, null, null, svc_iri, 'Atom');
 }
@@ -501,6 +519,96 @@ create trigger EVENTS_SIOC_D before delete on CAL.WA.EVENTS referencing old as O
 
 -------------------------------------------------------------------------------
 --
+create procedure event_acl_insert (
+  inout domain_id integer,
+  inout event_id integer,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  iri := SIOC..calendar_event_iri (domain_id, event_id);
+  graph_iri := CAL.WA.acl_graph (domain_id);
+
+  SIOC..acl_insert (graph_iri, iri, acl);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure event_acl_delete (
+  inout domain_id integer,
+  inout event_id integer,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  iri := SIOC..calendar_event_iri (domain_id, event_id);
+  graph_iri := CAL.WA.acl_graph (domain_id);
+
+  SIOC..acl_delete (graph_iri, iri, acl);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger EVENTS_SIOC_ACL_I after insert on CAL.WA.EVENTS order 100 referencing new as N
+{
+  if (coalesce (N.E_ACL, '') <> '')
+  {
+    event_acl_insert (N.E_DOMAIN_ID,
+                        N.E_ID,
+                        N.E_ACL);
+
+    SIOC..acl_ping (N.E_DOMAIN_ID,
+                    SIOC..calendar_event_iri (N.E_DOMAIN_ID, N.E_ID),
+                    null,
+                    N.E_ACL);
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger EVENTS_SIOC_ACL_U after update (E_ACL) on CAL.WA.EVENTS order 100 referencing old as O, new as N
+{
+  if (coalesce (O.E_ACL, '') <> '')
+    event_acl_delete (O.E_DOMAIN_ID,
+                      O.E_ID,
+                      O.E_ACL);
+
+  if (coalesce (N.E_ACL, '') <> '')
+    event_acl_insert (N.E_DOMAIN_ID,
+                      N.E_ID,
+                      N.E_ACL);
+
+  SIOC..acl_ping (N.E_DOMAIN_ID,
+                  SIOC..calendar_event_iri (N.E_DOMAIN_ID, N.E_ID),
+                  O.E_ACL,
+                  N.E_ACL);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger EVENTS_SIOC_ACL_D before delete on CAL.WA.EVENTS order 100 referencing old as O
+{
+  if (coalesce (O.E_ACL, '') <> '')
+    event_acl_delete (O.E_DOMAIN_ID,
+                      O.E_ID,
+                      O.E_ACL);
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure calendar_comment_insert (
 	in graph_iri varchar,
 	in forum_iri varchar,
diff --git a/appsrc/ODS-Calendar/www/ajax.vsp b/appsrc/ODS-Calendar/www/ajax.vsp
index 3fca6d0..a045bc7 100644
--- a/appsrc/ODS-Calendar/www/ajax.vsp
+++ b/appsrc/ODS-Calendar/www/ajax.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: ajax.vsp,v 1.2.2.1 2009/07/17 14:46:47 source Exp $
+--  $Id: ajax.vsp,v 1.2.2.2 2010/09/20 10:15:03 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Calendar/www/annotea.vspx b/appsrc/ODS-Calendar/www/annotea.vspx
index d9551bf..cca7879 100644
--- a/appsrc/ODS-Calendar/www/annotea.vspx
+++ b/appsrc/ODS-Calendar/www/annotea.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: annotea.vspx,v 1.7.2.3 2010/03/12 09:12:04 source Exp $
+ -  $Id: annotea.vspx,v 1.7.2.5 2010/10/07 13:23:19 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -53,7 +53,7 @@
     <vm:pagebody>
       <?vsp http(sprintf('<input type="hidden" name="sid"   id="sid"   value="%s" />', get_keyword('sid', self.vc_page.vc_event.ve_params))); ?>
       <?vsp http(sprintf('<input type="hidden" name="realm" id="realm" value="%s" />', get_keyword('realm', self.vc_page.vc_event.ve_params))); ?>
-      <div class="new-form-header">
+      <div class="form-header">
         Free Text Annotation: '<?V CAL.WA.utf2wide ((select coalesce(E_SUBJECT, '~ no title ~') from CAL.WA.EVENTS where E_ID = self.v_oid)) ?>'
       </div>
 
@@ -240,7 +240,7 @@
               </div>
             </div>
           </div>
-          <div class="new-form-footer">
+          <div class="form-footer">
             <v:button action="simple" value="Post" xhtml_title="Post" xhtml_class="button">
                     <v:on-post>
                       <![CDATA[
diff --git a/appsrc/ODS-Calendar/www/attendees.vspx b/appsrc/ODS-Calendar/www/attendees.vspx
index 9ca2663..c3f4d76 100644
--- a/appsrc/ODS-Calendar/www/attendees.vspx
+++ b/appsrc/ODS-Calendar/www/attendees.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: attendees.vspx,v 1.2.2.1 2009/11/17 21:37:40 source Exp $
+ -  $Id: attendees.vspx,v 1.2.2.4 2011/03/08 13:25:23 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -114,6 +114,7 @@
       <v:variable name="v_mode" type="varchar" default="null" />
 
       <v:variable name="v_uid" param-name="uid" type="varchar" default="null" />
+      <v:variable name="v_action" param-name="a" type="varchar" default="null" />
       <v:variable name="v_id" param-name="id" type="integer" default="null" />
 
       <v:variable name="v_subject" type="varchar" default="''" />
@@ -142,26 +143,17 @@
     <vm:pagebody>
       <v:before-data-bind>
         <![CDATA[
-          declare tmp any;
-
-          self.v_mode := '';
           if (not isnull (self.v_uid))
           {
             self.v_id := (select AT_EVENT_ID from CAL.WA.ATTENDEES where AT_UID = self.v_uid);
           }
-          else if (not CAL.WA.access_is_write (self.access_role))
+          else if (not CAL.WA.access_is_write (self.account_rights))
           {
             return;
           }
-          tmp := (select E_KIND from CAL.WA.EVENTS where E_ID = self.v_id);
-          if (tmp = 0)
-          {
-            self.v_mode := 'event';
-          }
-          if (tmp = 1)
-          {
-            self.v_mode := 'task';
-          }
+          self.v_mode := case when (select E_KIND from CAL.WA.EVENTS where E_ID = self.v_id) = 0 then 'event' else 'task' end;
+          if (self.v_action in ('A', 'D', 'T'))
+            CAL.WA.attendees_update_status (self.v_uid, self.v_action);
         ]]>
       </v:before-data-bind>
 
@@ -170,7 +162,7 @@
           <img src="image/calendarbanner_sml.jpg" border="0" alt="Calendar Home" />
         </div>
       </div>
-      <div class="new-form-header">
+      <div class="form-header">
         Attendees
       </div>
 
@@ -250,7 +242,7 @@
                         from CAL.WA.EVENTS
                        where E_ID = self.v_id;
                     }
-                    if (self.v_mode = 'task')
+                    else if (self.v_mode = 'task')
                     {
                       select E_SUBJECT,
                              E_DESCRIPTION,
@@ -472,7 +464,7 @@
                   for (M := 0; M < length (X); M := M + 2)
                   {
                     V := CAL.WA.attendees_select (self.v_id, X[M]);
-                    http (sprintf ('<div class="new-form-header">%s (%d)</div>', X[M+1], length (V)));
+                    http (sprintf ('<div class="form-header">%s (%d)</div>', X[M+1], length (V)));
                     for (N := 0; N < length (V); N := N + 1)
                     {
                       http (sprintf ('<div style="padding-left: 12px;"><a href="mailto: %s">%V</a> (%s)</div>', V[N][2], CAL.WA.mail2string (V[N][1], V[N][2]), CAL.WA.dt_datetimestring (V[N][4], self.cDateFormat, self.cTimeFormat)));
diff --git a/appsrc/ODS-Calendar/www/calendar_login.vspx b/appsrc/ODS-Calendar/www/calendar_login.vspx
index 5e06528..09c162b 100644
--- a/appsrc/ODS-Calendar/www/calendar_login.vspx
+++ b/appsrc/ODS-Calendar/www/calendar_login.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
-  -  $Id: calendar_login.vspx,v 1.4.2.1 2009/12/07 12:33:45 source Exp $
+  -  $Id: calendar_login.vspx,v 1.4.2.5 2010/10/07 13:23:19 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -36,13 +36,18 @@
       if (page_name = 'error.vspx')
         return;
 
+      if (isnull (self.account_rights) and not is_empty_or_null (self.sid))
+      {
+        self.vc_redirect (sprintf ('/ods/error.vspx?__PAGE=%U&__SQL_STATE=%U&__SQL_MESSAGE=%U', 'home.vspx', '23023', 'You have no access rights for the application!'));
+        return;
+      }
+
       vh := http_map_get ('vhost');
       lh := http_map_get ('lhost');
       hf := http_request_header (lines, 'Host');
-
       if (hf is not null and exists (select 1 from HTTP_PATH where HP_HOST = vh and HP_LISTEN_HOST = lh and HP_LPATH = '/ods'))
       {
-        ods_path := 'http://' || hf || '/ods/';
+        ods_path := DB.DBA.WA_GET_PROTOCOL() || hf || '/ods/';
       } else {
         ods_path := DB.DBA.WA_LINK (1, '/ods/');
       }
@@ -51,9 +56,7 @@
         self.vc_redirect(sprintf('%slogin.vspx?URL=%U', ods_path, concat(HTTP_REQUESTED_URL(), '?URI=', get_keyword('URL', params, ''))));
         return;
       }
-      if (CAL.WA.check_grants2 (self.access_role, page_name))
-        return;
-      if (self.access_role = 'expire')
+      if (isnull (self.account_rights))
       {
         http_request_status ('HTTP/1.1 302 Found');
         http_header (sprintf('Location: %slogin.vspx?URL=%U\r\n', ods_path, HTTP_REQUESTED_URL()));;
diff --git a/appsrc/ODS-Calendar/www/calendars.vspx b/appsrc/ODS-Calendar/www/calendars.vspx
index 64bf933..811a901 100644
--- a/appsrc/ODS-Calendar/www/calendars.vspx
+++ b/appsrc/ODS-Calendar/www/calendars.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: calendars.vspx,v 1.3.2.1 2010/02/10 22:17:03 source Exp $
+ -  $Id: calendars.vspx,v 1.3.2.3 2010/11/09 20:19:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -77,6 +77,7 @@
     <vm:pagebody>
       <?vsp http(sprintf('<input type="hidden" name="sid"   id="sid"   value="%s"/>', get_keyword('sid', self.vc_page.vc_event.ve_params))); ?>
       <?vsp http(sprintf('<input type="hidden" name="realm" id="realm" value="%s"/>', get_keyword('realm', self.vc_page.vc_event.ve_params))); ?>
+      <?vsp http(sprintf('<input type="hidden" name="form"  id="form"  value="%s"/>', get_keyword('form', self.vc_page.vc_event.ve_params, 'F1'))); ?>
       <?vsp http(sprintf('<input type="hidden" name="src"   id="src"   value="%s"/>', get_keyword('src', self.vc_page.vc_event.ve_params, ''))); ?>
       <?vsp http(sprintf('<input type="hidden" name="dst"   id="dst"   value="%s"/>', get_keyword('dst', self.vc_page.vc_event.ve_params, 'sc'))); ?>
       <?vsp http(sprintf('<input type="hidden" name="s1"    id="s1"    value="%s"/>', get_keyword('s1', self.vc_page.vc_event.ve_params, ''))); ?>
@@ -146,9 +147,6 @@
                 <th>
                   <?vsp self.sortColumn('Description', 'WAI_DESCRIPTION'); ?>
                 </th>
-                <th width="1%">
-                  <v:label value="Action" format="%s"/>
-                </th>
               </tr>
             </thead>
           </table>
@@ -158,18 +156,15 @@
 
           <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
             <table>
-              <tr>
+              <tr onclick="rowSelected(this);" class="pointer">
                 <td nowrap="nowrap">
+                  <input name="s1_item" type="hidden" value="<?V (control as vspx_row_template).te_column_value('WAI_NAME') ?>" />
                   <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WAI_NAME')" format="%s"/>
                 </td>
                 <td nowrap="nowrap">
+                  <input name="s2_item" type="hidden" value="<?V (control as vspx_row_template).te_column_value('WAI_DESCRIPTION') ?>" />
                   <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WAI_DESCRIPTION')" format="%s"/>
                 </td>
-                  <td nowrap="nowrap">
-                  <v:text name="s1" type="hidden" value="--(control.vc_parent as vspx_row_template).te_column_value('WAI_NAME')"/>
-                  <v:text name="s2" type="hidden" value="--(control.vc_parent as vspx_row_template).te_column_value('WAI_DESCRIPTION')"/>
-                    <v:button name="b1" action="simple" value="select" xhtml_alt="Select" xhtml_onclick="javascript: rowSelect(this); return false;" xhtml_class="button"/>
-                  </td>
               </tr>
             </table>
           </v:template>
diff --git a/appsrc/ODS-Calendar/www/contacts.vspx b/appsrc/ODS-Calendar/www/contacts.vspx
index 75bcafd..b667a1f 100644
--- a/appsrc/ODS-Calendar/www/contacts.vspx
+++ b/appsrc/ODS-Calendar/www/contacts.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: contacts.vspx,v 1.2.2.1 2010/02/10 22:17:03 source Exp $
+ -  $Id: contacts.vspx,v 1.2.2.3 2011/03/23 12:18:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -97,6 +97,7 @@
 
         http (sprintf ('<input type="hidden" name="sid"   id="sid"   value="%s"/>', get_keyword('sid', params)));
         http (sprintf ('<input type="hidden" name="realm" id="realm" value="%s"/>', get_keyword('realm', params)));
+        http (sprintf ('<input type="hidden" name="form"  id="form"  value="%s"/>', get_keyword('form', params, 'page_form')));
         http (sprintf ('<input type="hidden" name="src"   id="src"   value="%s"/>', get_keyword('src', params, '')));
         http (sprintf ('<input type="hidden" name="dst"   id="dst"   value="%s"/>', get_keyword('dst', params, 'sc')));
         http (sprintf ('<input type="hidden" name="s1"    id="s1"    value="%s"/>', get_keyword('s1', params, '')));
@@ -160,7 +161,7 @@
                 <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
                   <th class="checkbox" width="1%">
                     <?vsp
-                      http('<input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, ''cb_item''); updateChecked(this, ''cb_item''); "/>');
+                      http('<input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this.form, this); updateChecked(this, ''cb_item''); "/>');
                     ?>
                   </th>
                 </v:template>
@@ -192,19 +193,15 @@
 
           <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
             <table>
-              <tr>
+              <tr onclick="rowSelected(this);" class="pointer">
                 <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
                   <td  align="center">
                     <?vsp
-                      declare pos integer;
                       declare S, name any;
 
                       name := (control.vc_parent as vspx_row_template).te_column_value('P_MAIL');
-                      S := '';
-                      pos := strstr (self.v_s1, concat(name, ','));
-                      if (not isnull (pos))
-                        S := 'checked="checked"';
-                      http (sprintf ('<input type="checkbox" name="cb_item" value="%s" %s onclick="javascript: updateChecked(this, ''cb_item''); " />', name, S));
+                      S := case when isnull (strstr(self.v_s1, concat(name, ','))) then '' else 'checked="checked"' end;
+                      http (sprintf ('<input type="checkbox" name="cb_item" value="%s" %s onclick="javascript: updateChecked(this, ''cb_item'', event); " />', name, S));
                     ?>
                   </td>
                 </v:template>
diff --git a/appsrc/ODS-Calendar/www/conversation.vspx b/appsrc/ODS-Calendar/www/conversation.vspx
index 45c9278..11ffda2 100644
--- a/appsrc/ODS-Calendar/www/conversation.vspx
+++ b/appsrc/ODS-Calendar/www/conversation.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: conversation.vspx,v 1.3.2.1 2010/01/29 20:21:29 source Exp $
+ -  $Id: conversation.vspx,v 1.3.2.3 2010/10/07 13:23:19 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -67,10 +67,10 @@
       <?vsp http(sprintf('<input type="hidden" name="sid"   id="sid"   value="%s" />', get_keyword('sid', self.vc_page.vc_event.ve_params))); ?>
       <?vsp http(sprintf('<input type="hidden" name="realm" id="realm" value="%s" />', get_keyword('realm', self.vc_page.vc_event.ve_params))); ?>
       <?vsp http(sprintf('<input type="hidden" name="user_name" id="user_name" value="%s" />', CAL.WA.account_name (self.account_id))); ?>
-      <div class="new-form-header">
+      <div class="form-header">
         Discussion
       </div>
-      <div class="new-form-body">
+      <div class="form-body">
         <table cellspacing="0">
           <tr>
             <td>
diff --git a/appsrc/ODS-Calendar/www/css/style.css b/appsrc/ODS-Calendar/www/css/style.css
index a991bdd..84e90b7 100644
--- a/appsrc/ODS-Calendar/www/css/style.css
+++ b/appsrc/ODS-Calendar/www/css/style.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: style.css,v 1.23.2.8 2010/03/01 10:18:30 source Exp $
+ *  $Id: style.css,v 1.23.2.11 2010/10/07 13:23:19 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -20,70 +20,57 @@
  *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  *
  */
-
-body
-{
+body {
   padding: 0;
   margin: 0;
   font-family: Verdana, Arial, Helvetica, Sans-Serif;
   font-size: 9pt;
 }
 
-abbr
-{
+abbr {
   border: none;
 }
 
-a
-{
+a {
   text-decoration: none;
 }
 
-a:active, .link:active
-{
+a:active, .link:active {
   text-decoration: none;
 }
 
-a:visited
-{
+a:visited {
   text-decoration: none;
 }
 
-a:hover
-{
+a:hover {
   text-decoration: underline;
 }
 
-.link
-{
+.link {
   color: blue;
 	cursor: pointer;
 }
 
-#MTB
-{
+#MTB {
   width: 100%;
   left: 0px;
   right: 0px;
 }
 
-#LC
-{
+#LC {
   width: 180px;
   padding-top: 5px;
   vertical-align: top;
 }
 
-#RC
-{
+#RC {
   padding-top: 5px;
   vertical-align: top;
 }
 
 /* Footer */
-
-#FT
-{
+#FT {
   width: 100%;
   position: relative;
   bottom: 0px;
@@ -97,8 +84,7 @@ a:hover
   background-image: url(../image/ods_main_footer.png);
 }
 
-#FT_L
-{
+#FT_L {
   float: left;
   clear: left;
   margin-top: 10px;
@@ -106,8 +92,7 @@ a:hover
   border: 1px solid #788;
 }
 
-#FT_R
-{
+#FT_R {
   float: right;
   clear: right;
   margin-top: 10px;
@@ -116,22 +101,19 @@ a:hover
   color: #788;
 }
 
-#FT_R a
-{
+#FT_R a {
   text-decoration: none;
   color: inherit;
 }
 
 /* Left side within MT */
 
-.page_head
-{
+.page_head {
   width: 100%;
   background-color: #b0cde4;
 }
 
-.lc
-{
+.lc {
   font-size: 12px;
   background-color: #EFEFEF;
   border: 1px solid #7f94a5;
@@ -142,25 +124,21 @@ a:hover
   width: auto;
 }
 
-.lc_none
-{
+.lc_none {
   margin: 0 0.5em 0.5em 0.5em;
   width: auto;
 }
 
-.lc_closer
-{
+.lc_closer {
   margin-top: -0.5em;
   z-index: 1;
 }
 
-.lc_noborder
-{
+.lc_noborder {
   border-top: 0;
 }
 
-.lc a, .lc div, .lc .gems
-{
+.lc a, .lc div, .lc .gems {
   color: blue;
 	cursor: pointer;
   display: block;
@@ -168,76 +146,63 @@ a:hover
   margin: 3px;
 }
 
-.lc a
-{
+.lc a {
   text-decoration: none;
 }
 
-.lc a:hover, .lc .gems:hover
-{
+.lc a:hover, .lc .gems:hover {
   color: blue;
   background: #99b3c5;
 }
 
-.gems2
-{
+.gems2 {
   font-weight: bold;
   background: #b0cde4;
 }
 
-.lc_head
-{
+.lc_head {
   -moz-user-select: none; 
   cursor: pointer; 
   font-size: 1em;
   font-weight: bold;
 }
 
-.navigator_info
-{
+.navigator_info {
   font-size: smaller;
 }
 
-.copyright
-{
+.copyright {
   font-size: 75%;
   text-align: right;
   padding-right: 5px;
   border-top: 1px solid silver;
 }
 
-.system_info
-{
+.system_info {
   font-size: 75%;
 }
 
-.page_title
-{
+.page_title {
   font-size: 12pt;
   font-weight: bold;
 }
 
-.main_page_area
-{
+.main_page_area {
   background-color: white;
   width: 100%;
 }
 
-.page_section_head
-{
+.page_section_head {
   font-size: 12pt;
   font-weight: bold;
 }
 
-table.sub_page_area
-{
+table.sub_page_area {
   width: 100%;
 }
 
 /* Label */
-
-.error
-{
+.error {
   color: red;
   font-weight: bold;
   margin: 3px 0px 3px 0px;
@@ -246,120 +211,38 @@ table.sub_page_area
   text-align: center;
 }
 
-.attention_marker
-{
+.attention_marker {
   color: #ff0033;
 }
 
-.subpage_header_area
-{
+.subpage_header_area {
   margin: 3px 0px 3px 0px;
   border: 1pt solid silver;
 }
 
-.page_header_area
-{
+.page_header_area {
   border: 1pt solid silver;
   position: relative;
   bottom:15pt;
 }
 
-/* The main navigation bar */
-.nav_bar
-{
-  display: block;
-  padding: 0;
-  margin: 0;
-  line-height: 1.9em;
-  font-size: 0.9em;
-}
-
-.nav_bar td.sel
-{
-}
-
-.nav_bar td
-{
-  background: #ddd;
-}
-
-.nav_bar td.filler
-{
-  background: #b0cde4;
-  width: 100%;
-}
-
-.nav_bar a
-{
-  display: block;
-  color: #444;
-  text-decoration: none;
-  font-weight: bold;
-  background: #99b3c5;
-  background-image: url(../image/stl_blu2_grad.gif);
-  background-repeat: repeat-x;
-  margin: 0;
-  padding: 0.25em 1em;
-  border-left: 1px solid #fff;
-  border-top: 1px solid #fff;
-  border-right: 1px solid #aaa;
-  white-space: nowrap;
-}
-
-.nav_bar a.les
-{
-  background: #b0cde4;
-  background-image: url(../image/sel_nav_grad2.gif);
-}
-
-.nav_bar a.les:hover
-{
-  color: black;
-  background: #99b3c5;
-}
-
-.nav_bar a:hover,
-.nav_bar a:active,
-.nav_bar a.sel:link,
-.nav_bar a.sel:visited
-{
-  background: #b0cde4;
-  background-image: url(../image/sel_nav_grad2.gif);
-  color: #000;
-}
-
-.nav_seperator {
-  left: 0px;
-  top: 0px;
-  width: 100%;
-  background-color: #b0cde4;
-  line-height: 2.6em;
-  color: #b0cde4;
-}
-
-/*
-  Fields
-*/
-input[readonly]
-{
+/* Fields */
+input[readonly] {
   background: #EFEFEF;
 }
 
-.readonly
-{
+.readonly {
   background: #EFEFEF;
 }
 
 /* ====== lists ====== */
-table#list
-{
+table#list {
   width: 100%;
   border: solid #7f94a5;
   border-width: 1px 1px 2px 1px;
 }
 
-table#list th
-{
+table#list th {
   font-size: 0.9em;
   font-weight: bold;
   text-align: center;
@@ -369,8 +252,7 @@ table#list th
   border-width: 0px 1px 1px 0px;
 }
 
-table#list th:last-child
-{
+table#list th:last-child {
   border-width: 0px 0px 1px 0px;
 }
 
@@ -381,53 +263,35 @@ table#list thead input {
   background-color: #b0cde4;
 }
 
-/*====== trees ======*/
-.tree_main
-{
-  border: solid #7f94a5;
-  border-width: 1px 1px 1px 1px;
-  padding: 3px;
-  height: 400px;
-  overflow: auto;
-  font-weight: bold;
-}
-
-/* ====== rows ====== */
-.td_border
-{
+/* rows */
+.td_border {
   border: solid #7f94a5;
   border-width: 1px 0px 1px 0px;
 }
 
-.tr_0
-{
+.tr_0 {
   border: solid #7f94a5;
   border-width: 0px 0px 1px 0px;
   background-color: #F5F5EE;
 }
 
-.tr_1
-{
+.tr_1 {
   border: solid #7f94a5;
   border-width: 0px 0px 1px 0px;
 }
 
-.tr_1:hover, .tr_0:hover
-{
+.tr_1:hover, .tr_0:hover {
  	background-color: #eec;
 }
 
-.tr_select
-{
+.tr_select {
   background-color: #FFFFCC;
 }
 
-.read
-{
+.read {
 }
 
-.unread
-{
+.unread {
   font-weight: bold;
 }
 
@@ -489,17 +353,8 @@ div.menu div.menuItemSep {
   margin: 4px 2px;
 }
 
-/*====== forms ======*/
-.body-scroll
-{
-  background-color: white;
-  height: 30em;
-  width: auto;
-  overflow: auto;
-}
-
-.from-button
-{
+/* forms */
+.from-button {
   margin: .8em 0 .8em 0;
   font-size: .8em;
   font-family: verdana, sans-serif;
@@ -601,9 +456,7 @@ input.nolink4 {
   vertical-align: top;
 }
 
-
-.pane-label
-{
+.pane-label {
   font-weight: bold;
   background-color: #EFEFEF;
   border: 1px solid #000;
@@ -617,8 +470,7 @@ input.nolink4 {
 }
 
 /* New */
-.form-header
-{
+.form-header {
   font-size: 1.1em;
   font-weight: bold;
   margin: 0 0 6px 0;
@@ -628,8 +480,7 @@ input.nolink4 {
   background-color: #b0cde4;
 }
 
-.form-footer
-{
+.form-footer {
   margin: 6px 0px;
   text-align: center;
   height: 20px;
@@ -639,58 +490,30 @@ input.nolink4 {
   background-color: #b0cde4;
 }
 
-.form-header
-{
-  font-size: 13px;
-  font-weight: bold;
-  margin: 0 0 8px 0;
-  padding: 0px 0px 3px 4px;
-  border: solid #7f94a5;
-  border-width: 1px 1px 1px 10px;
-  background-color: #b0cde4;
-}
-
-.form-footer
-{
-  margin: 6px 0px;
-  text-align: center;
-  border: solid 1px #7f94a5;
-  background-color: #b0cde4;
-  height: 20px;
-  padding-top: 0px;
-  padding-bottom: 2px;
-}
-
-.form-body
-{
+.form-body {
   width: 100%;
   font-size: 1em;
 }
 
-.form-body td
-{
+.form-body td {
   padding: 2px;
 }
 
-.form-body th
-{
+.form-body th {
   text-align: right;
   padding: 4px;
 }
 
-.td_label
-{
+.td_label {
   text-align: right;
   padding-right: 1em;
 }
 
-.td_simple
-{
+.td_simple {
   border-width: 0px 0px 0px 0px;
 }
 
-.tab_page
-{
+.tab_page {
   font-size: 10pt;
   border-width: 1px 1px 1px 1px;
   background-color: white;
@@ -701,42 +524,17 @@ input.nolink4 {
   height: 100%;
 }
 
-.clear
-{
+.clear {
   width: 100%;
   padding: 0px;
   border-width: 0;
 }
 
-.clear td
-{
+.clear td {
   padding: 0px;
   border-width: 0;
 }
 
-.form-body2
-{
-  width: 100%;
-  border: solid #7f94a5;
-  border-width: 1px 1px 2px 1px;
-  background-color: #EFEFEF;
-}
-
-.form-body2-td
-{
-  padding: 2px;
-  border: solid #7f94a5;
-  border-width: 0px 1px 1px 0px;
-}
-
-.form-body2-th
-{
-  text-align: right;
-  padding: 4px;
-  border: solid #7f94a5;
-  border-width: 0px 1px 1px 0px;
-}
-
 div.boxHeader {
   background-color: #EFEFEF;
   margin: 0 0 0.5em 0;
@@ -745,9 +543,8 @@ div.boxHeader {
   vertical-align: middle;
 }
 
-/*====== Grids ======*/
-.CAL_grid
-{
+/* Grids */
+.CAL_grid {
   width: 100%;
   border: solid #7f94a5;
   border-width: 1px 1px 2px 1px;
@@ -757,15 +554,12 @@ div.boxHeader {
   border-bottom: 1px solid #fff;
 }
 
-thead.sortHeader tr
-{
+thead.sortHeader tr {
   background-image: url(../image/stl_blu1_grad.gif);
   background-repeat: repeat-x;
 }
 
-/* make the TH elements pretty */
-thead.sortHeader tr th
-{
+thead.sortHeader tr th {
   font-size: 1em;
   font-weight: bold;
   text-align: left;
@@ -774,20 +568,16 @@ thead.sortHeader tr th
   border-width: 0px 1px 1px 0px;
 }
 
-thead.sortHeader th.checkbox
-{
+thead.sortHeader th.checkbox {
   text-align: center;
   padding: 0;
 }
 
-thead.sortHeader th:last-child
-{
+thead.sortHeader th:last-child {
   border-width: 0px 0px 1px 0px;
 }
 
-/* make the A elements pretty. makes for nice clickable headers                */
-thead.sortHeader a, thead.sortHeader a:link, thead.sortHeader a:visited
-{
+thead.sortHeader a, thead.sortHeader a:link, thead.sortHeader a:visited {
   color: #000;
   font-weight: bold;
   display: block;
@@ -795,10 +585,7 @@ thead.sortHeader a, thead.sortHeader a:link, thead.sortHeader a:visited
   width: 100%
 }
 
-/* make the A elements pretty. makes for nice clickable headers                */
-/* WARNING: swapping the background on hover may cause problems in WinIE 6.x   */
-thead.sortHeader a:hover
-{
+thead.sortHeader a:hover {
   color: #000;
   font-weight: bold;
   display: block;
@@ -806,30 +593,8 @@ thead.sortHeader a:hover
   width: 100%
 }
 
-/*====== New forms ======*/
-.new-form-header
-{
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 0 0 6px 0;
-  padding: 0px 0px 2px 4px;
-  border: solid #7f94a5;
-  border-width: 1px 1px 1px 10px;
-  background-color: #b0cde4;
-}
-
-.new-form-footer
-{
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 6px 0 0 0;
-  text-align: center;
-  border: solid 1px #7f94a5;
-  background-color: #b0cde4;
-}
-
-.new-form-body
-{
+/* New forms */
+.new-form-body {
   font-size: 1em;
   padding: 6px;
   border: solid #7f94a5;
@@ -837,61 +602,38 @@ thead.sortHeader a:hover
   background-color: #EFEFEF;
 }
 
-.new-form-mapping
-{
-  width: 100%;
-  height: 415px;
-  overflow: auto;
-  border: solid #7f94a5;
-  border-width: 1px 1px 1px 1px;
-}
-
-.new-form-mapping2
-{
-  width: 100%;
-  text-align: right;
-  border-width: 0px;
-}
-
-.no-border
-{
+.no-border {
   border-width: 0;
 }
 
-.new-form-body table
-{
+.new-form-body table {
   width: 100%;
   background-color: #EFEFEF;
 }
 
-.new-form-body table td
-{
+.new-form-body table td {
   padding: 2px;
 }
 
-.new-form-body table td.text
-{
+.new-form-body table td.text {
   font-style: italic;
   font-weight: bold;
   padding: 2px;
 }
 
-.new-form-body table th
-{
+.new-form-body table th {
   text-align: right;
   white-space: nowrap;
   padding: 4px;
 }
 
-td.new-section
-{
+td.new-section {
   text-align: center;
   font-weight: bold;
   background-color: #B0CDE4;
 }
 
-.text
-{
+.text {
   font-style: italic;
   font-weight: bold;
   padding: 2px;
@@ -900,7 +642,6 @@ td.new-section
 /* tabs */
 div.c1 {
   width: 100%;
-  padding-top: 0.5em;
 }
 
 div.tabs {
@@ -977,50 +718,7 @@ a.tab.activeTab2 {
   background-color: #FFF;
 }
 
-/*====== Toolbars ======*/
-div.toolbar {
-}
-
-img.toolbar
-{
-  display: block;
-  float: left;
-  margin-top: 10px;
-  background-color: #7F94A5;
-}
-
-a.toolbar
-{
-  display: block;
-  float: left;
-  width: 70px;
-  padding: 10px 0 10px 0;
-  color: #4F56A6;
-  font-weight: bold;
-  font-size: 12px;
-  text-decoration: none;
-  text-align: center;
-}
-
-span.toolbar
-{
-  display: block;
-  float: left;
-  width: 70px;
-  padding: 10px 0 10px 0;
-  color: #4F56A6;
-  font-weight: bold;
-  font-size: 12px;
-  text-decoration: none;
-  text-align: center;
-}
-
-span.toolbarLabel
-{
-  font-size: 0.8em;
-}
-
-/*====== Calendar pane ======*/
+/* Calendar pane */
 .calendar_tab {
   cursor: pointer;
   color: #000;
@@ -1033,7 +731,7 @@ span.toolbarLabel
   -moz-border-radius-topright: 3px;
   -webkit-border-top-left-radius: 3px;
   -webkit-border-top-right-radius: 3px;
-  margin: 0px 0px -1px 2px;
+  margin: 0px 0px 1px 3px;
   padding: 2px 10px 2px 10px;
   position: relative;
   text-decoration: none;
@@ -1052,7 +750,7 @@ span.toolbarLabel
   background-color: #FFF;
   border: 1px solid #000;
   border-color: #7f94a5;
-  margin: 0px 0px 1px 2px;
+  margin: 0px 0px -3px 2px;
   padding: 2px 10px 2px 10px;
   position: relative;
   text-decoration: none;
@@ -1061,37 +759,32 @@ span.toolbarLabel
 }
 
 /* Small Calendar Left*/
-.C_monthtable
-{
+.C_monthtable {
   border-bottom: 1px solid #FFFFFF;
   padding: 0pt;
   width: 100%;
 }
 
-.C_monthtable td
-{
+.C_monthtable td {
   font-family: Verdana;
   font-size: 85%;
   padding: 2px;
   text-align: center;
 }
 
-.C_heading
-{
+.C_heading {
   color: #112ABB;
   cursor: pointer;
   vertical-align: middle;
 }
 
-.C_prev, .C_next
-{
+.C_prev, .C_next {
   cursor: pointer;
   font-size: 125%;
   padding-bottom: 6px;
 }
 
-.C_cur
-{
+.C_cur {
   font-family: Verdana, Sans-serif;
   font-size: 78%;
   font-size-adjust: none;
@@ -1104,19 +797,16 @@ span.toolbarLabel
   text-align: center;
 }
 
-.C_dayh
-{
+.C_dayh {
   cursor: default;
   font-size: 78%;
 }
 
-.C_day_left
-{
+.C_day_left {
   border-left: 1px solid #A2BBDD;
 }
 
-.C_day_right
-{
+.C_day_right {
   border-right:1px solid #FFFFFF;
 }
 
@@ -1124,8 +814,7 @@ span.toolbarLabel
   border-top: 1px solid #A2BBDD;
 }
 
-.C_offmonth
-{
+.C_offmonth {
   color: #888888;
 }
 
@@ -1141,18 +830,15 @@ span.toolbarLabel
   background: #AACCEE none repeat scroll 0%;
 }
 
-.C_weekend
-{
+.C_weekend {
   background: #E8EEF7 none repeat scroll 0%;
 }
 
-.C_weekend_selected
-{
+.C_weekend_selected {
   background: #99BBDD none repeat scroll 0%;
 }
 
-.C_today
-{
+.C_today {
   background: #99AABB none repeat scroll 0% !important;
   border-color:#556677 rgb(170, 187, 204) rgb(170, 187, 204) rgb(85, 102, 119) !important;
   border-style:solid !important;
@@ -1160,8 +846,7 @@ span.toolbarLabel
   color: #FFFFFF;
 }
 
-.C_today_selected
-{
+.C_today_selected {
   background: #557799 none repeat scroll 0% !important;
   border-color: #224466 rgb(153, 187, 221) rgb(153, 187, 221) rgb(34, 68, 102) !important;
   border-style: solid !important;
@@ -1170,8 +855,7 @@ span.toolbarLabel
 }
 
 /* Big Calendar Events */
-.CE_container
-{
+.CE_container {
   padding: 10px;
   margin-top: 2px;
   border: solid #7f94a5;
@@ -1180,8 +864,7 @@ span.toolbarLabel
   position: relative;
 }
 
-.CE_main
-{
+.CE_main {
   width: 100%;
   min-height: 320px;
   height: 560px;
@@ -1191,58 +874,48 @@ span.toolbarLabel
   overflow-y: auto;
 }
 
-.CE_name
-{
+.CE_name {
   font-weight: bold;
   font-size: 90%;
 }
 
-.CE_table
-{
+.CE_table {
   width: 100%;
   background-color: #FFF;
 }
 
-.CE_row
-{
+.CE_row {
   height: 20px;
 }
 
-.CE_row_week
-{
+.CE_row_week {
   height: 100px;
 }
 
-.CE_row_month
-{
+.CE_row_month {
   height: 120px;
 }
 
-.CE_cell
-{
+.CE_cell {
   font-size: 90%;
   padding: 0px;
   vertical-align: top;
   border-bottom: 1px solid #EFEFEF;
 }
 
-.CE_cell_today
-{
+.CE_cell_today {
   background-color: #FFFFDF;
 }
 
-.CE_cell_pointer
-{
+.CE_cell_pointer {
   cursor: pointer;
 }
 
-.CE_cell_odd
-{
+.CE_cell_odd {
   border-bottom: 1px dotted #EFEFEF;
 }
 
-.CE_cell_time
-{
+.CE_cell_time {
   width: 6%;
   font-weight: bold;
   font-size: 90%;
@@ -1252,24 +925,20 @@ span.toolbarLabel
   background-color: #F8F8F8;
 }
 
-.CE_cell_bottom
-{
+.CE_cell_bottom {
   border-bottom: 0px;
 }
 
-.CE_cell_middle
-{
+.CE_cell_middle {
   border-right: 1px solid #EFEFEF;
 }
 
-.CE_cell_week
-{
+.CE_cell_week {
   width: 12%;
   vertical-align: top;
 }
 
-.CE_cell_header
-{
+.CE_cell_header {
   cursor: pointer;
   font-weight: bold;
   font-size: 90%;
@@ -1278,8 +947,7 @@ span.toolbarLabel
 }
 
 /* Events */
-.EV
-{
+.EV {
   cursor: pointer;
   font-size: 85%;
   padding-left: 3px;
@@ -1287,62 +955,52 @@ span.toolbarLabel
   border-bottom: 1px solid #FEFEFE;
 }
 
-.EV_time
-{
+.EV_time {
   font-style: italic;
   padding-right: 5px;
 }
 
-.EV_delete
-{
+.EV_delete {
   color: red;
   font-weight: bold;
 }
 
-.EV_subject
-{
+.EV_subject {
   font-weight: bold;
   width: 100%;
 }
 
-.EVL
-{
+.EVL {
   cursor: pointer;
 }
 
-.EVL_duration
-{
+.EVL_duration {
   font-size: 90%;
 }
 
-.EVL_time
-{
+.EVL_time {
   font-style: italic;
   font-size: 90%;
 }
 
 .EVL_subject:hover,
-.EVL_subject:visited
-{
+.EVL_subject:visited {
   text-decoration: none;
 }
 
-.EVL_subject
-{
+.EVL_subject {
   font-weight: bold;
   text-decoration: none;
 }
 
-.chip .chipbody
-{
+.chip .chipbody {
   width: 100%;
   color: #FFF;
   overflow: hidden;
   position: relative;
   width: 100%;
 }
-.chip * 
-{
+.chip * {
   -moz-user-select:none;
 }
 
@@ -1406,21 +1064,18 @@ td.calendar_selected {
 }
 
 /* Comments */
-div.cm_node_top
-{
+div.cm_node_top {
   padding-left: 1em;
   margin-left: 0px;
 }
 
-div.cm_node
-{
+div.cm_node {
   padding-left: 1em;
   margin-left: 0px;
   border-left: 2px #e0e0e0 solid;
 }
 
-div.comment-section
-{
+div.comment-section {
   padding: 0 0px 0 2px;
   font-size: 1.1em;
   font-weight: bold;
@@ -1429,25 +1084,21 @@ div.comment-section
   background-color: #b0cde4;
 }
 
-div.comment
-{
+div.comment {
   margin-top: 5px;
 }
 
-div.comment-footer
-{
+div.comment-footer {
   margin: 1px;
   color: gray;
 }
 
-div.comment-header
-{
+div.comment-header {
   border-bottom: 1px #cccccc solid;
   font-size: 1.1em;
 }
 
-div.comment-button
-{
+div.comment-button {
   margin: 1px;
   padding-top: 5px;
   border-top: 1px #cccccc solid;
@@ -1457,3 +1108,23 @@ input.openID {
   background: #FFFFFF url(/ods/images/login-bg.gif) no-repeat scroll;
   padding-left: 18px;
 }
+
+.pointer {
+  cursor: pointer;
+}
+
+span.button {
+  background: none repeat scroll 0 0 #99B3C5;
+  border: 1px solid #7F94A5;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  color: #FFFFFF;
+  font-size: 0.8em;
+  font-weight: bold;
+  padding: 3px 4px 1px;
+  text-decoration:none;
+}
+
+img.button {
+  margin-bottom: -3px;
+}
diff --git a/appsrc/ODS-Calendar/www/error.vspx b/appsrc/ODS-Calendar/www/error.vspx
index 9a25cfc..133517f 100644
--- a/appsrc/ODS-Calendar/www/error.vspx
+++ b/appsrc/ODS-Calendar/www/error.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
-  -  $Id: error.vspx,v 1.5 2008/02/19 11:04:53 source Exp $
+  -  $Id: error.vspx,v 1.5.2.2 2010/09/20 10:15:03 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -51,20 +51,14 @@
         An error has occurred during processing of the "<?V self.page_name ?>" page.
       </div>
       <div class="error" style="text-align: left;">
-        <table>
+        <table cellspacing="5">
           <tr>
             <td valign="top">SQL State </td>
-            <td>
-              <?V self.code ?>
-            </td>
+            <td><?V self.code ?></td>
           </tr>
           <tr>
             <td valign="top">SQL Message </td>
-            <td>
-              <pre>
-                <?V self.msg ?>
-              </pre>
-            </td>
+            <td><pre><?V self.msg ?></pre></td>
           </tr>
         </table>
       </div>
diff --git a/appsrc/ODS-Calendar/www/export.vspx b/appsrc/ODS-Calendar/www/export.vspx
index 34d5bf8..1a44d27 100644
--- a/appsrc/ODS-Calendar/www/export.vspx
+++ b/appsrc/ODS-Calendar/www/export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
-  -  $Id: export.vspx,v 1.1.2.3 2010/05/31 21:59:14 source Exp $
+  -  $Id: export.vspx,v 1.1.2.4 2010/09/20 10:15:03 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Calendar/www/gems.vsp b/appsrc/ODS-Calendar/www/gems.vsp
index 799447a..4e16a86 100644
--- a/appsrc/ODS-Calendar/www/gems.vsp
+++ b/appsrc/ODS-Calendar/www/gems.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: gems.vsp,v 1.3.2.1 2010/05/31 21:59:14 source Exp $
+--  $Id: gems.vsp,v 1.3.2.3 2010/10/07 13:23:19 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -35,30 +35,8 @@
       if (not _authorized)
       {
         _authorized := 1;
-        _authorizeVector := DB.DBA.vsp_auth_vec (http_request_header());
-        if (_authorizeVector = 0)
-        {
-          _authorized := 0;
-        } else {
-          if (get_keyword ('authtype', _authorizeVector) <> 'basic')
-          {
+      if (not ODS..ods_check_auth (_user, _domain_id, 'reader'))
             _authorized := 0;
-          } else {
-            _user := get_keyword ('username', _authorizeVector, '');
-            _password := get_keyword ('pass', _authorizeVector, '');
-            if (not DB.DBA.web_user_password_check (_user, _password))
-            {
-              _authorized := 0;
-            } else {
-              _user_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = _user);
-              _role := CAL.WA.access_role (_domain_id, _user_id);
-              if (_role not in ('admin', 'owner'))
-              {
-                _authorized := 0;
-              }
-            }
-          }
-        }
       }
       http_rewrite ();
       if (not _authorized)
@@ -69,9 +47,7 @@
     }
     else
     {
-      declare exit handler for sqlstate '*' {
-        return;
-      };
+      declare exit handler for sqlstate '*' { return;};
 
       _gems := get_keyword('type', params);
       if (_gems = 'calendar.ics')
diff --git a/appsrc/ODS-Calendar/www/help.vspx b/appsrc/ODS-Calendar/www/help.vspx
index 254016f..66b1701 100644
--- a/appsrc/ODS-Calendar/www/help.vspx
+++ b/appsrc/ODS-Calendar/www/help.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: help.vspx,v 1.2 2008/02/22 13:06:13 source Exp $
+ -  $Id: help.vspx,v 1.2.2.1 2010/09/20 10:15:03 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Calendar/www/home.vspx b/appsrc/ODS-Calendar/www/home.vspx
index 50c3064..25a8d2d 100644
--- a/appsrc/ODS-Calendar/www/home.vspx
+++ b/appsrc/ODS-Calendar/www/home.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: home.vspx,v 1.60.2.18 2010/07/09 14:37:01 source Exp $
+ -  $Id: home.vspx,v 1.60.2.32 2011/03/23 12:18:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -72,7 +72,7 @@
         self.v_id := cast (tmp as integer);
         if (self.v_id <> -1)
         {
-          permissions := CAL.WA.event_permissions (self.v_id, self.domain_id, self.access_role);
+          permissions := CAL.WA.event_rights (self.domain_id, self.v_id, self.account_rights);
           if (permissions = 'W')
           {
           self.cAction := 'edit';
@@ -123,7 +123,7 @@
   <v:method name="initData" arglist="">
     <![CDATA[
       self.cShowTasks := CAL.WA.settings_showTasks (self.settings);
-      self.cPrivacy := case when CAL.WA.access_is_write (self.access_role) then 0 else 1 end;
+      self.cPrivacy := case when CAL.WA.access_is_write (self.account_rights) then 0 else 1 end;
       if (isnull (self.cScope))
         self.cScope := CAL.WA.settings_defaultView (self.settings);
       if (isnull (self.cDay))
@@ -207,7 +207,7 @@
   <v:method name="showEvent" arglist="in _id integer, in e_event integer, in e_subject varchar, in e_start datetime, in e_end datetime, in e_repeat varchar, in e_repeat_offset integer, in e_reminder integer, in e_attendees integer, in e_continue varchar">
     <![CDATA[
       declare domain_id integer;
-      declare showDelete, showAnnotate, color, S, T, R varchar;
+      declare onclick, showDelete, showAnnotate, color, S, T, R varchar;
 
         S := 'null';
         if (not isnull (e_repeat_offset))
@@ -215,18 +215,21 @@
       color := self.showEventColor (_id);
       showDelete := '';
       showAnnotate := '';
-      if (CAL.WA.event_permissions (_id, self.domain_id, self.access_role) = 'W')
+      if (CAL.WA.event_rights (self.domain_id, _id, self.account_rights) = 'W')
       {
         showDelete :=  sprintf ('<span id="d_%d_%s" onclick="eDelete(event, this, %s)">[<span class="EV_delete">X</span>]</span> ', _id, S, S);
         showAnnotate := sprintf ('<img border="0" width="11" height="11" title="Annotate" alt="Annotate" src="image/ann_16.gif" onclick="eAnnotea (event, %d, %d, %d);" /> ', _id, self.domain_id, self.account_id);
       }
       domain_id := (select E_DOMAIN_ID from CAL.WA.EVENTS where E_ID = _id);  
+      onclick := '';
+      if (not DB.DBA.is_empty_or_null (self.sid))
+        onclick := 'onclick="javascript: eView(this);"';
       R := self.showEventSubjectTmp (_id, e_event, e_subject, e_repeat, e_reminder, e_attendees);
       if (e_event = 1)
       {
-        T := sprintf ('<div id="e_%d_%s" class="EV vevent" typeof="sioct:EventCalendar" %s onclick="eView(this)" about="%V">%s%s%s<span style="display:none;">%s</span>%s</div>', _id, S, color, SIOC..calendar_event_iri (domain_id, _id), e_continue, showDelete, showAnnotate, self.prepareField (e_start, 'dtstart', null), R);
+        T := sprintf ('<div id="e_%d_%s" class="EV vevent" typeof="sioct:EventCalendar" %s %s about="%V">%s%s%s<span style="display:none;">%s</span>%s</div>', _id, S, color, onclick, SIOC..calendar_event_iri (domain_id, _id), e_continue, showDelete, showAnnotate, self.prepareField (e_start, 'dtstart', null), R);
       } else {
-        T := sprintf ('<div id="e_%d_%s" class="EV vevent" typeof="sioct:EventCalendar" %s onclick="eView(this)" about="%V">%s%s%s<span class="EV_time">%s-%s</span>%s</div>', _id, S, color, SIOC..calendar_event_iri (domain_id, _id), e_continue, showDelete, showAnnotate, self.prepareField (e_start, 'dtstart', CAL.WA.dt_timestring (e_start)), self.prepareField (e_end, 'dtend', CAL.WA.dt_timestring (e_end)), R);
+        T := sprintf ('<div id="e_%d_%s" class="EV vevent" typeof="sioct:EventCalendar" %s %s about="%V">%s%s%s<span class="EV_time">%s-%s</span>%s</div>', _id, S, color, onclick, SIOC..calendar_event_iri (domain_id, _id), e_continue, showDelete, showAnnotate, self.prepareField (e_start, 'dtstart', CAL.WA.dt_timestring (e_start)), self.prepareField (e_end, 'dtend', CAL.WA.dt_timestring (e_end)), R);
       }
       return T;
     ]]>
@@ -322,9 +325,13 @@
   <v:method name="showEventSubjectTmp" arglist="in _id integer, in e_event integer, in e_subject varchar, in e_repeat varchar, in e_reminder varchar, in e_attendees integer">
     <![CDATA[
       declare domain_id integer;
+      declare onclick varchar;
       
       domain_id := (select E_DOMAIN_ID from CAL.WA.EVENTS where E_ID = _id);  
-      return sprintf ('<a id="e_%d" href="%s" onclick="javascript: eView(\'e_%d\'); return false;" class="EVL EVL_subject app" about="%V"> %s%s%s%s</a>', _id, SIOC..calendar_event_iri(domain_id, _id), _id, SIOC..calendar_event_iri(domain_id, _id), self.repeatableImage (e_repeat), self.reminderImage (e_reminder), self.attendeesImage (e_attendees), self.prepareField (CAL.WA.show_subject (e_subject), 'summary', null));
+      onclick := '';
+      if (not DB.DBA.is_empty_or_null (self.sid))
+        onclick := sprintf ('onclick="javascript: eView(\'e_%d\'); return false;"', _id);
+      return sprintf ('<a id="e_%d" href="%s" %s class="EVL EVL_subject app" about="%V"> %s%s%s%s</a>', _id, CAL.WA.utf2wide (SIOC..calendar_event_iri(domain_id, _id)), onclick, CAL.WA.utf2wide (SIOC..calendar_event_iri(domain_id, _id)), self.repeatableImage (e_repeat), self.reminderImage (e_reminder), self.attendeesImage (e_attendees), self.prepareField (CAL.WA.show_subject (e_subject), 'summary', null));
     ]]>
   </v:method>
 
@@ -520,7 +527,7 @@
         T := 'abbr';
       if (fProperty = 'dtend')
         T := 'abbr';
-      return sprintf ('<%s%s>%s</%s>', T, P, FS, T);
+      return sprintf ('<%s%s>%s</%s>', T, P, CAL.WA.utf2wide (FS), T);
     ]]>
   </v:method>
 
@@ -588,23 +595,47 @@
     ]]>
   </v:method>
 
-  <v:method name="getAcl" arglist="">
+  <v:method name="shareNode" arglist="in event_id integer, in grants varchar, in override integer">
     <![CDATA[
-      declare N integer;
-      declare tmp, suffix, params any;
-
-      params := self.vc_page.vc_event.ve_params;
-      tmp := vector ();
-      for (N := 0; N < length (params); N := N + 4)
+      declare N, pos, id integer;
+      declare name, V any;
+
+      grants := replace(grants, ' ', '');
+      grants := replace(grants, ',,', ',');
+      grants := trim(grants, ',', '');
+      grants := grants || ',';
+      for (select U_ID, U_NAME from CAL.WA.EVENT_GRANTS, DB.DBA.SYS_USERS where G_GRANTER_ID = self.account_id and G_EVENT_ID = event_id and G_GRANTEE_ID = U_ID) do
       {
-        if ((params [N] like 's_fld_2_%') and (trim (params [N+1]) <> ''))
+        name := U_NAME;
+        id := U_ID;
+        pos := strstr(grants, name || ',');
+        if (isnull (pos))
         {
-          suffix := replace (params [N], 's_fld_2_', '');
-          tmp := vector_concat (tmp, vector (vector (get_keyword ('s_fld_1_'||suffix, params, ''), get_keyword ('s_fld_2_'||suffix, params, ''), get_keyword ('s_fld_3_'||suffix, params, ''))));
+          if (override)
+            delete from CAL.WA.EVENT_GRANTS where G_GRANTER_ID = self.account_id and G_GRANTEE_ID = id and G_EVENT_ID = event_id;
+        } else {
+          grants := replace (grants, name || ',', '');
         }
       }
-      tmp := vector_concat (vector (vector ('v1.0', length (tmp))), tmp);
-      return serialize (tmp);
+      V := split_and_decode (trim (grants, ','), 0, '\0\0,');
+      for (N := 0; N < length (V); N := N + 1)
+      {
+        id := (select U_ID from SYS_USERS where U_NAME = V[N]);
+        if (not isnull(id))
+          insert into CAL.WA.EVENT_GRANTS (G_GRANTER_ID, G_GRANTEE_ID, G_EVENT_ID)
+            values(self.account_id, id, event_id);
+      }
+    ]]>
+  </v:method>
+
+  <v:method name="shareSelect" arglist="in event_id integer">
+    <![CDATA[
+      declare grants any;
+
+      grants := '';
+      for (select U_ID, U_NAME from CAL.WA.EVENT_GRANTS, DB.DBA.SYS_USERS where G_GRANTER_ID = CAL.WA.domain_owner_id (self.domain_id) and G_GRANTEE_ID = U_ID and G_EVENT_ID = event_id) do
+        grants := grants || cast (U_NAME as varchar) || ',';
+      return trim (grants, ',');
     ]]>
   </v:method>
 
@@ -650,13 +681,14 @@
       self.v_reminder := 600;
       self.v_notes := '';
       self.v_acl := null;
+      self.v_grants := '';
     ]]>
   </v:method>
 
   <v:method name="saveEvent" arglist="">
     <![CDATA[
-      declare N integer;
-      declare tmp, params, sd, ed any;
+      declare N, M integer;
+      declare tmp, acl_users, params, sd, ed any;
 
       declare exit handler for SQLSTATE '*'
       {
@@ -675,11 +707,25 @@
       self.v_location := trim (self.e_location.ufl_value);
       self.v_description := trim (self.e_description.ufl_value);
       self.v_attendees := trim (self.e_attendees.ufl_value);
-      if ((self.cAction = 'create') or (CAL.WA.event_permissions (self.v_id, self.domain_id, self.access_role) = 'W'))
+      if ((self.cAction = 'create') or (CAL.WA.event_rights (self.domain_id, self.v_id, self.account_rights) = 'W'))
       self.v_privacy := cast (self.e_privacy.ufl_value as integer);
       self.v_tags := trim (self.e_tags.ufl_value);
       self.v_notes := trim (get_keyword ('e_notes', params, ''));
-      self.v_acl := self.getAcl ();
+      self.v_grants := '';
+      for (N := 0; N < length (params); N := N + 2)
+      {
+        if ((params [N] like 'f_fld_1_%') and (trim (params [N+1]) <> ''))
+        {
+          acl_users := split_and_decode (trim (params[N+1]), 0, '\0\0,');
+          for (M := 0; M < length (acl_users); M := M + 1)
+          {
+            if (not isnull (CAL.WA.account_id (trim (acl_users[M]))))
+              self.v_grants := self.v_grants || ',' || acl_users[M];
+          }
+        }
+      }
+      self.v_grants := trim (self.v_grants, ',');
+      self.v_acl := serialize (DB.DBA.wa_acl_params (params));
 
       CAL.WA.test (self.v_subject, vector('name', 'Name', 'class', 'varchar', 'minLength', 0, 'maxLength', 255));
       CAL.WA.test (self.v_location, vector('name', 'Location', 'class', 'varchar', 'minLength', 0, 'maxLength', 255));
@@ -793,6 +839,7 @@
         self.v_notes
       );
       CAL.WA.event_update_acl (self.v_id, self.v_acl);
+      self.shareNode (self.v_id, self.v_grants, 1);
 
       if (self.cScope = 'tasks')
         self.cScope := 'events';
@@ -816,12 +863,14 @@
       self.v_completed := null;
       self.v_notes := '';
       self.v_acl := null;
+      self.v_grants := '';
     ]]>
   </v:method>
 
   <v:method name="saveTask" arglist="">
     <![CDATA[
-      declare tmp, params any;
+      declare N, M integer;
+      declare acl_users, tmp, params any;
 
       declare exit handler for SQLSTATE '*'
       {
@@ -846,7 +895,21 @@
       self.v_privacy := cast (self.t_privacy.ufl_value as integer);
       self.v_tags := trim (self.t_tags.ufl_value);
       self.v_notes := trim (get_keyword ('t_notes', params, ''));
-      self.v_acl := self.getAcl ();
+      self.v_grants := '';
+      for (N := 0; N < length (params); N := N + 2)
+      {
+        if ((params [N] like 'f_fld_1_%') and (trim (params [N+1]) <> ''))
+        {
+          acl_users := split_and_decode (trim (params[N+1]), 0, '\0\0,');
+          for (M := 0; M < length (acl_users); M := M + 1)
+          {
+            if (not isnull (CAL.WA.account_id (trim (acl_users[M]))))
+              self.v_grants := self.v_grants || ',' || acl_users[M];
+          }
+        }
+      }
+      self.v_grants := trim (self.v_grants, ',');
+      self.v_acl := serialize (DB.DBA.wa_acl_params (params));
 
       CAL.WA.test (self.v_subject, vector('name', 'Name', 'class', 'varchar', 'minLength', 1, 'maxLength', 255));
       CAL.WA.test (self.v_tags, vector ('name', 'Tags', 'class', 'tags'));
@@ -909,6 +972,7 @@
         self.v_notes
       );
       CAL.WA.event_update_acl (self.v_id, self.v_acl);
+      self.shareNode (self.v_id, self.v_grants, 1);
     ]]>
   </v:method>
 
@@ -962,7 +1026,7 @@
           http ('<td>');
             for (select T_TAG from CAL.WA.TAGS where T_DOMAIN_ID = self.domain_id and T_COUNT > 0 and T_TAG <> '' order by T_TAG) do
             {
-              http (sprintf ('<a href="#" onclick="javascript: addTag(\'%s\', \'%s\');">%s</a> ', T_TAG, fieldName, T_TAG));
+              http (sprintf ('<a href="#" onclick="javascript: return addTag(\'%s\', \'%s\');">%s</a> ', T_TAG, fieldName, T_TAG));
             }
           http ('</td>');
         http ('</tr>');
@@ -1083,6 +1147,7 @@
       <v:variable name="v_status" type="varchar" default="''"/>
       <v:variable name="v_notes" type="varchar" default="''" />
       <v:variable name="v_acl" type="any" default="null" />
+      <v:variable name="v_grants" type="any" default="null"/>
 
       <v:variable name="vg_id" type="any" default="null" />
       <v:variable name="vg_account_id" type="varchar" default="null" />
@@ -1126,7 +1191,7 @@
           <!-- Navigation left column -->
           <td id="LC">
             <vm:if test="self.cAction <> 'settings'">
-              <vm:if test="self.access_role not in ('public', 'guest')">
+              <vm:if test="self.account_rights = 'W'">
                 <vm:event />
               </vm:if>
               <vm:calendar />
@@ -1137,11 +1202,15 @@
             </vm:if>
             <vm:if test="self.cAction = 'settings'">
               <div class="lc lc_close">
+                <vm:if test="self.account_rights = 'W'">
                 <span onclick="javascript: vspxPost('command', 'select', 'settings', 'mode', 'settings');" title="Settings" class="gems gems2" style="color: black;">Settings</span>
+                </vm:if>
                 <span onclick="javascript: vspxPost('command', 'select', 'settings', 'mode', 'bookmarklet');" title="Bookmarklet" class="gems gems2" style="color: black;">Bookmarklet</span>
+                <vm:if test="self.account_rights = 'W'">
                 <span onclick="javascript: vspxPost('command', 'select', 'settings', 'mode', 'upstreamBrowse');" title="Upstreams" class="gems gems2" style="color: black;">Upstreams</span>
                 <span onclick="javascript: vspxPost('command', 'select', 'settings', 'mode', 'grantBrowse');" title="Share My Calendar" class="gems gems2" style="color: black;">Share My Calendar</span>
                 <span onclick="javascript: vspxPost('command', 'select', 'settings', 'mode', 'sharedBrowse');" title="Accepted Calendars" class="gems gems2" style="color: black;">Accepted Calendars</span>
+                </vm:if>
                 <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
                 <span onclick="javascript: vspxPost('command', 'select', 'settings', 'mode', 'back');" title="Back" class="gems gems2" style="color: black;">Back</span>
               </div>
@@ -1183,7 +1252,7 @@
                       cCommand := get_keyword ('export', params, '');
                 if (cCommand in ('rss', 'atom', 'rdf'))
                 {
-                  S := sprintf('export.vspx?output=%s&scope=%s', cCommand, self.cScope);
+                        S := sprintf('%s/export.vspx?output=%s&scope=%s', CAL.WA.iri_fix (CAL.WA.forum_iri (self.domain_id)), cCommand, self.cScope);
                         if (self.cScope = 'events')
                   {
                           S := S || sprintf ('&order=%s&direction=%s', self.e_order, self.e_direction);
@@ -1352,7 +1421,7 @@
                         if (length (cParams) > 1)
                         {
                     self.v_id := cast (cParams [1] as integer);
-                          cPermission := CAL.WA.event_permissions (self.v_id, self.domain_id, self.access_role);
+                          cPermission := CAL.WA.event_rights (self.domain_id, self.v_id, self.account_rights);
                           if (cPermission = 'W')
                           {
                     self.cAction := 'edit';
@@ -1367,11 +1436,15 @@
                           }
                     kind := CAL.WA.event_kind (self.v_id);
                     if ((kind = 'event') and (self.cScope in ('tasks', 'search')))
+                          {
                       self.cScope := 'events';
-                    if (kind = 'task')
+                          }
+                          else if (kind = 'task')
+                          {
                       self.cScope := 'tasks';
                   }
                 }
+                      }
 
                       cCommand := get_keyword ('view', params, '');
                       if (cCommand <> '')
@@ -1380,15 +1453,11 @@
                         if (length (cParams) > 1)
                         {
                           self.v_id := cast (cParams [1] as integer);
-                          cPermission := CAL.WA.event_permissions (self.v_id, self.domain_id, self.access_role);
-                          if ((cPermission = 'W') or (cPermission = 'R'))
-                          {
-                            self.cAction := 'view';
-                          }
-                          else
-                          {
+                          cPermission := CAL.WA.event_rights (self.domain_id, self.v_id, self.account_rights);
+                          if (not ((cPermission = 'W') or (cPermission = 'R')))
                             return;
-                          }
+
+                          self.cAction := 'view';
                           kind := CAL.WA.event_kind (self.v_id);
                           if ((kind = 'event') and (self.cScope in ('tasks', 'search')))
                             self.cScope := 'events';
@@ -1404,10 +1473,9 @@
                   if (length (cParams) > 1)
                         {
                           self.v_id := cast (cParams [1] as integer);
-                          if (CAL.WA.event_permissions (self.v_id, self.domain_id, self.access_role) <> 'W')
-                          {
+                          if (CAL.WA.event_rights (self.domain_id, self.v_id, self.account_rights) <> 'W')
                             return;
-                          }
+
                           CAL.WA.event_delete (self.v_id, get_keyword ('onOffset', params));
                         }
                 }
@@ -1482,7 +1550,7 @@
               </tr>
             </table>
           </div>
-          <div class="new-form-footer" style="margin: 0;   border-top: 0;">
+                <div class="form-footer" style="margin: 0;   border-top: 0;">
                   <v:button action="simple" name="s_search" value="Search" xhtml_class="form-button">
               <v:on-post>
                 <![CDATA[
@@ -1505,7 +1573,7 @@
           </div>
         </vm:if>
 
-        <table cellspacing="0" style="width: 100%;">
+              <table cellspacing="0" cellpadding="0" style="width: 100%;">
           <tr style="height: 18px;">
             <td>
                     <v:button action="simple" name="day" value="Day" xhtml_class="-- case when (self.cScope = 'day') then 'calendar_tab calendar_tabActive' else 'calendar_tab' end" xhtml_alt="Day">
@@ -1654,13 +1722,13 @@
         <div class="CE_container">
           <v:before-data-bind>
             <![CDATA[
-              self.tv_status := get_keyword('tvf_status', self.vc_page.vc_event.ve_params, 'All');
+                    self.tv_status := get_keyword ('tvf_status', self.vc_page.vc_event.ve_params, CAL.WA.settings_taskFilter (self.settings));
             ]]>
           </v:before-data-bind>
             <table width="100%" cellspacing="0">
               <tr>
                 <td>
-                      <vm:if test="(self.cScope not in ('day', 'week', 'month')) and (self.access_role not in ('public', 'guest'))">
+                      <vm:if test="(self.cScope not in ('day', 'week', 'month')) and (self.account_rights = 'W')">
             <vm:if test="(self.cScope <> 'search')">
                           <v:button action="simple" name="new" value="--'New ' || self.singleObjectName (self.cScope)" xhtml_class="button">
               <v:on-post>
@@ -1684,7 +1752,7 @@
                                 if (params[N] = 'cb_item')
                                 {
                                   id := cast (params[N+1] as integer);
-                                  if (CAL.WA.event_permissions (id, self.domain_id, self.access_role) = 'W')
+                                  if (CAL.WA.event_rights (self.domain_id, id, self.account_rights) = 'W')
                                     CAL.WA.event_delete(id);
                                 }
                               }
@@ -1764,12 +1832,13 @@
                       V[N] := vector ();
                     hasEvents := 0;
                     for (select distinct rs.*
-                                from CAL.WA.events_forPeriod (rs0, rs1, rs2, rs3, rs4)(e_id integer, e_event integer, e_subject varchar, e_start datetime, e_end datetime, e_repeat varchar, e_repeat_offset integer, e_reminder integer, e_attendees integer) rs
+                                from CAL.WA.events_forPeriod (rs0, rs1, rs2, rs3, rs4, rs5)(e_id integer, e_event integer, e_subject varchar, e_start datetime, e_end datetime, e_repeat varchar, e_repeat_offset integer, e_reminder integer, e_attendees integer) rs
                        where rs0 = self.domain_id
                          and rs1 = self.cDay
                          and rs2 = self.cDay
                                  and rs3 = self.cPrivacy
                            and rs4 = self.cShowTasks
+                                 and rs5 = self.account_rights
                          order by e_event DESC, e_start) do
                     {
                             if (e_event = 1)
@@ -1841,7 +1910,7 @@
                         if (mod (N, 2) = 0)
                           http (sprintf ('<th class="CE_cell CE_cell_time %s" rowspan="2">%s</th>', case when (N = 46) then 'CE_cell_bottom' else '' end, CAL.WA.dt_timestring (CAL.WA.dt_timeEncode (N/2, 0), self.cTimeFormat)));
                         onClick := '';
-                              if ((self.domain_id > 0) and (self.access_role not in ('public', 'guest')))
+                              if ((self.domain_id > 0) and (self.account_rights = 'W'))
                           onClick := sprintf (' onclick="javascript: cNewEvent(event, null, %d);"', N*30);
                         S := '';
                         if (length (V[N]))
@@ -1895,16 +1964,17 @@
                           if (self.domain_id > 0)
                             C := C || ' CE_cell_pointer';
                           onClick := 'javascript: void(0);';
-                                if ((self.domain_id > 0) and (self.access_role not in ('public', 'guest')))
+                                if ((self.domain_id > 0) and (self.account_rights = 'W'))
                             onClick := sprintf (' onclick="javascript: cNewEvent(event, %d, -1);"', N);
                           hasEvents := 0;
                           for (select distinct rs.*
-                                       from CAL.WA.events_forPeriod (rs0, rs1, rs2, rs3, rs4)(e_id integer, e_event integer, e_subject varchar, e_start datetime, e_end datetime, e_repeat varchar, e_repeat_offset integer, e_reminder integer, e_attendees integer) rs
+                                       from CAL.WA.events_forPeriod (rs0, rs1, rs2, rs3, rs4, rs5)(e_id integer, e_event integer, e_subject varchar, e_start datetime, e_end datetime, e_repeat varchar, e_repeat_offset integer, e_reminder integer, e_attendees integer) rs
                                 where rs0 = self.domain_id
                                   and rs1 = dt
                                   and rs2 = dt
                                         and rs3 = self.cPrivacy
                                   and rs4 = self.cShowTasks
+                                        and rs5 = self.account_rights
                                 order by e_event DESC, e_start) do
                           {
                             if (not hasEvents)
@@ -1942,7 +2012,7 @@
                         if (self.domain_id > 0)
                           C := C || ' CE_cell_pointer';
                         onClick := '';
-                              if ((self.domain_id > 0) and (self.access_role not in ('public', 'guest')))
+                              if ((self.domain_id > 0) and (self.account_rights = 'W'))
                           onClick := sprintf (' onclick="javascript: cNewEvent(event, %d, -1);"', N);
                         http (sprintf ('<td width="%s" class="CE_new CE_cell %s" %s>', '14.2857%', C, onClick));
                         C := '';
@@ -1960,12 +2030,13 @@
                           C := C || ' C_today';
                         http (sprintf ('<div onclick="cSelect(this)" id="d_day_%d_%d" class="CE_cell_header%s">%d</div>', W, D, C, abs (self.cDays [N])));
                         for (select distinct rs.*
-                                     from CAL.WA.events_forPeriod (rs0, rs1, rs2, rs3, rs4)(e_id integer, e_event integer, e_subject varchar, e_start datetime, e_end datetime, e_repeat varchar, e_repeat_offset integer, e_reminder integer, e_attendees integer) rs
+                                     from CAL.WA.events_forPeriod (rs0, rs1, rs2, rs3, rs4, rs5)(e_id integer, e_event integer, e_subject varchar, e_start datetime, e_end datetime, e_repeat varchar, e_repeat_offset integer, e_reminder integer, e_attendees integer) rs
                               where rs0 = self.domain_id
                                 and rs1 = dt
                                 and rs2 = dt
                                       and rs3 = self.cPrivacy
                                 and rs4 = self.cShowTasks
+                                      and rs5 = self.account_rights
                               order by e_event DESC, e_start) do
                         {
                                 http (self.showEvent (e_id, e_event, e_subject, e_start, e_end, e_repeat, e_repeat_offset, e_reminder, e_attendees, self.showContinue (dt, e_event, e_start, e_end)));
@@ -1984,90 +2055,39 @@
               <v:data-source name="dsrc" expression-type="sql" nrows="0" initial-offset="0">
                 <v:before-data-bind>
                   <![CDATA[
-                          if (self.cScope = 'tasks')
-                          {
-                            control.ds_sql := sprintf (' select a.E_ID,                           ' ||
-                                                       '        a.E_DOMAIN_ID,                    ' ||
-                                                       '        a.E_KIND,                         ' ||
-                                                       '        a.E_SUBJECT,                      ' ||
-                                                       '        a.E_EVENT,                        ' ||
-                                                       '        a.E_EVENT_START,                  ' ||
-                                                       '        a.E_EVENT_END,                    ' ||
-                                                       '        a.E_REPEAT,                       ' ||
-                                                       '        a.E_REMINDER,                     ' ||
-                                                       '        a.E_LOCATION,                     ' ||
-                                                       '        a.E_ATTENDEES,                    ' ||
-                                                       '        a.E_COMPLETED,                    ' ||
-                                                       '        a.E_STATUS,                       ' ||
-                                                       '        a.E_PRIORITY,                     ' ||
-                                                       '        a.E_CREATED,                      ' ||
-                                                       '        a.E_UPDATED                       ' ||
-                                                       '   from CAL.WA.EVENTS a,                  ' ||
-                                                       '        CAL..MY_CALENDARS b                ' ||
-                                                       '  where b.domain_id = %d                  ' ||
-                                                       '    and b.privacy = %d                    ' ||
-                                                       '    and a.E_DOMAIN_ID = b.CALENDAR_ID     ' ||
-                                                       '    and a.E_PRIVACY >= b.CALENDAR_PRIVACY ' ||
-                                                       '    and a.E_KIND = 1',
-                                                       self.domain_id,
-                                                       self.cPrivacy
-                                                      );
-                            if (self.tv_status <> 'All')
-                            {
-                              if (self.tv_status = 'Not Completed')     
-                              {
-                                control.ds_sql := control.ds_sql || ' and a.E_STATUS <> \'Completed\'';
-                              } else {
-                              control.ds_sql := control.ds_sql || sprintf (' and a.E_STATUS = ''%s''', self.tv_status);
-                              }  
-                            }
+                          declare sql varchar;
 
-                            self.sortChange (get_keyword ('t_sortColumn', e.ve_params), 'ts_order', 'ts_direction', self.ds);
-                            control.ds_sql := sprintf ('%s order by %s %s', control.ds_sql, self.ts_order, self.ts_direction);
-                          }
-                          else if (self.cScope = 'search')
+                          if (self.cScope = 'search')
                           {
                             if (isnull (self.cSearch))
                             {
-                              control.ds_sql := 'select * from CAL.WA.EVENTS where 1 = 0';
+                              sql := 'select * from CAL.WA.EVENTS where 1 = 0';
                             } else {
-                              control.ds_sql := CAL.WA.search_sql (self.domain_id, self.cPrivacy, self.cSearch);
+                              sql := CAL.WA.search_sql (self.domain_id, self.cPrivacy, self.cSearch, self.account_rights);
                             }
                             self.sortChange (get_keyword ('s_sortColumn', e.ve_params), 's_order', 's_direction', self.ds);
-                            control.ds_sql := sprintf ('%s order by %s %s, E_ID', control.ds_sql, self.s_order, self.s_direction);
+                            sql := sql || sprintf (' order by %s %s, E_ID', self.s_order, self.s_direction);
                           }
                           else
                           {
-                            control.ds_sql := sprintf (' select a.E_ID,                           ' ||
-                                                       '        a.E_DOMAIN_ID,                    ' ||
-                                                       '        a.E_KIND,                         ' ||
-                                                       '        a.E_SUBJECT,                      ' ||
-                                                       '        a.E_EVENT,                        ' ||
-                                                       '        a.E_EVENT_START,                  ' ||
-                                                       '        a.E_EVENT_END,                    ' ||
-                                                       '        a.E_REPEAT,                       ' ||
-                                                       '        a.E_REMINDER,                     ' ||
-                                                       '        a.E_LOCATION,                     ' ||
-                                                       '        a.E_ATTENDEES,                    ' ||
-                                                       '        a.E_COMPLETED,                    ' ||
-                                                       '        a.E_STATUS,                       ' ||
-                                                       '        a.E_PRIORITY,                     ' ||
-                                                       '        a.E_CREATED,                      ' ||
-                                                       '        a.E_UPDATED                       ' ||
-                                                     '   from CAL.WA.EVENTS a,                  ' ||
-                                                     '        CAL..MY_CALENDARS b               ' ||
-                                                     '  where b.domain_id = %d                  ' ||
-                                                     '    and b.privacy = %d                    ' ||
-                                                     '    and a.E_DOMAIN_ID = b.CALENDAR_ID     ' ||
-                                                     '    and a.E_PRIVACY >= b.CALENDAR_PRIVACY ' ||
-                                                     '    and a.E_KIND = 0',
-                                                     self.domain_id,
-                                                     self.cPrivacy
-                                                    );
+                            sql := CAL.WA.search_sql (self.domain_id, self.cPrivacy, null, self.account_rights);
+                            sql := sql || sprintf (' and a.E_KIND = %d', case when (self.cScope = 'tasks') then 1 else 0 end);
+                            if (self.cScope = 'tasks')
+                            {
+                              CAL.WA.settings_set (self.domain_id, 'taskFilter', self.tv_status);
+                              if (self.tv_status <> 'All')
+                                sql := sql || sprintf (' and a.E_STATUS %s', case when (self.tv_status = 'Not Completed') then '<> ''Completed''' else '= ''' || self.tv_status || '''' end);
+
+                              self.sortChange (get_keyword ('t_sortColumn', e.ve_params), 'ts_order', 'ts_direction', self.ds);
+                              sql := sql || sprintf (' order by %s %s', self.ts_order, self.ts_direction);
+                            }
+                            else
+                            {
                     self.sortChange (get_keyword ('e_sortColumn', e.ve_params), 'e_order', 'e_direction', self.ds);
-                            control.ds_sql := sprintf ('%s order by %s %s', control.ds_sql, self.e_order, self.e_direction);
+                              sql := sql || sprintf (' order by %s %s', self.e_order, self.e_direction);
                           }
-
+                          }
+                          control.ds_sql := sql;
                           control.ds_nrows := CAL.WA.settings_rows (self.settings);
                           control.ds_parameters := null;
                   ]]>
@@ -2083,11 +2103,9 @@
                   <table id="events" style="width: 100%; background-color: #FFF;" cellspacing="0">
                     <thead class="sortHeader">
                       <tr>
-                              <vm:if test="self.access_role not in ('public', 'guest')">
                           <th class="checkbox" width="1%">
                             <input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, 'cb_item')"/>
                           </th>
-                        </vm:if>
                               <vm:if test="self.cScope = 'events'">
                         <th nowrap="nowrap" width="10%">
                           <?vsp self.sortColumn ('Duration', 'E_EVENT_START', 'e_sortColumn', self.e_order, self.e_direction); ?>
@@ -2122,11 +2140,9 @@
                                   <?vsp self.sortColumn ('Updated', 'E_UPDATED', 's_sortColumn', self.s_order, self.s_direction); ?>
                                 </th>
                               </vm:if>
-                              <vm:if test="((self.access_role not in ('public', 'guest')) or (CAL.WA.discussion_check () and CAL.WA.conversation_enable (self.domain_id)))">
                           <th width="1%">
                             Action
                           </th>
-                        </vm:if>
                       </tr>
                     </thead>
                   </table>
@@ -2166,13 +2182,10 @@
                           <table>
                             <tr class="vevent" typeof="sioct:EventCalendar">
                               <?vsp
-                                if (self.access_role not in ('public', 'guest'))
-                                {
                                   http (sprintf ('<td align="center" valign="top" %s>', self.showEventColor (e_id)));
-                                  if (CAL.WA.event_permissions (e_id, self.domain_id, self.access_role) = 'W')
+                                if (CAL.WA.event_rights (self.domain_id, e_id, self.account_rights) = 'W')
                                     http (sprintf ('<input type="checkbox" name="cb_item" value="%d" onclick="selectCheck(this, \'cb_item\')" />', e_id));
                                   http ('</td>');
-                                }
                               ?>
                               <vm:if test="self.cScope = 'events'">
                         <td nowrap="nowrap">
@@ -2260,16 +2273,18 @@
                         </td>
                               </vm:if>
                               <?vsp
-                                declare actions any;
+                                declare permissions, actions any;
 
                                 actions := '';
-                                if (self.access_role not in ('public', 'guest'))
-                                  actions := actions || either (equ (actions, ''), '', ' | ') || sprintf ('<span onclick="javascript: vspxPost (\'command\', \'edit\', \'x_%d\'); return false;" class="link">edit</span>', e_id);
-                                if (self.access_role not in ('public', 'guest'))
-                                  actions := actions || either (equ (actions, ''), '', ' | ') || self.windowOpen (sprintf ('annotea.vspx?oid=%d', e_id), 'annotate', e_subject);
+                                permissions := CAL.WA.event_rights (self.domain_id, e_id, self.account_rights);
+                                if (permissions = 'W')
+                                {
+                                  actions := sprintf ('<span onclick="javascript: vspxPost (\'command\', \'edit\', \'x_%d\'); return false;" class="link">edit</span>', e_id)
+                                             || ' | '
+                                             || self.windowOpen (sprintf ('annotea.vspx?oid=%d', e_id), 'annotate', e_subject);
+                                }
                                 if (CAL.WA.discussion_check () and CAL.WA.conversation_enable (self.domain_id))
                                   actions := actions || either (equ(actions, ''), '', ' | ') || self.windowOpen (sprintf ('conversation.vspx?id=%d', e_id), 'discuss', e_subject);
-                                if (actions <> '')
                                   http ('<td nowrap="nowrap">' || actions || '</td>');
                               ?>
                       </tr>
@@ -2360,6 +2375,7 @@
                  where E_ID = self.v_id;
 
                        self.v_attendees := CAL.WA.attendees_return (self.v_id);
+                       self.v_grants := self.shareSelect (self.v_id);
                  return;
               }
             _end:;
@@ -2368,17 +2384,15 @@
               }
           ]]>
         </v:before-data-bind>
-        <div class="new-form-header">
+              <div class="form-header">
                 <v:label format="%s" value="--self.eventHeader (self.v_id, 'event')" />
         </div>
         <div id="e" class="c1">
           <div class="tabs">
-                   <vm:tabCaption tab="e" tabsCount="4" tabNo="0" caption="Main" />
-                   <vm:tabCaption tab="e" tabsCount="4" tabNo="1" caption="Repeats" />
-                   <vm:tabCaption tab="e" tabsCount="4" tabNo="2" caption="Notes" />
-                  <vm:if test="CAL.WA.domain_is_public (self.domain_id) = 2">
-                     <vm:tabCaption tab="e" tabsCount="4" tabNo="3" caption="Access" />
-                  </vm:if>
+                  <div onclick="javascript: showTab('e', 4, 0);" class="tab " id="e_tab_0">Main</div>
+                  <div onclick="javascript: showTab('e', 4, 1);" class="tab " id="e_tab_1">Repeats</div>
+                  <div onclick="javascript: showTab('e', 4, 2);" class="tab " id="e_tab_2">Notes</div>
+                  <div onclick="javascript: showTab('e', 4, 3);" class="tab " id="e_tab_3" style="display: <?V case when self.v_privacy > 1 then '' else 'none' end ?>">Sharing</div>
           </div>
           <div class="contents">
             <div id="e_content_0" class="tabContent" style="display: none;">
@@ -2413,8 +2427,9 @@
                             From
                     </td>
                     <td>
-                                <v:text name="e_eventStartDate" xhtml_id="e_eventStartDate" null-value="--''" value="--CAL.WA.dt_datestring (self.v_eventStart, self.cDateFormat)" xhtml_onclick="--sprintf ('datePopup(\'e_eventStartDate\', \'%s\');', self.cDateFormat)" xhtml_class="textbox" xhtml_size="10" />
-                                <a href="#" id="e_eventStartDate_select" onclick="datePopup('e_eventStartDate', '<?V self.cDateFormat ?>'); return false;" class="noapp">
+                                <input type="hidden" name="e_eventStartDate_save" id="e_eventStartDate_save" value="<?V CAL.WA.dt_datestring (self.v_eventStart, self.cDateFormat) ?>" />
+                                <v:text name="e_eventStartDate" xhtml_id="e_eventStartDate" null-value="--''" value="--CAL.WA.dt_datestring (self.v_eventStart, self.cDateFormat)" xhtml_onclick="--sprintf ('datePopup(\'e_eventStartDate\', \'%s\', function(){dateUpdate(\'e_eventStartDate\', [\'e_eventEndDate\'], \'%s\');});', self.cDateFormat, self.cDateFormat)" xhtml_onchange="--sprintf ('dateUpdate(\'e_eventStartDate\', [\'e_eventEndDate\'], \'%s\');', self.cDateFormat)" xhtml_class="textbox" xhtml_size="10" />
+                                <a href="#" id="e_eventStartDate_select" onclick="datePopup('e_eventStartDate', '<?V self.cDateFormat ?>', function(){dateUpdate('e_eventStartDate', ['e_eventEndDate'], '<?V self.cDateFormat ?>');}); return false;" class="noapp">
                         <img border="0" title="pick" alt="pick" src="image/pick_calendar.gif"/>
                       </a>
                                 <v:select-list name="e_eventStartTime" xhtml_id="e_eventStartTime">
@@ -2542,8 +2557,9 @@
                           <vm:label for="e_privacy" value="--'Privacy'" />
                         </th>
                         <td>
-                          <v:select-list name="e_privacy">
+                            <v:select-list name="e_privacy" xhtml_onchange="javascript: (this.value == \'2\')? OAT.Dom.show(\'e_tab_3\'): OAT.Dom.hide(\'e_tab_3\');">
                             <v:item value="0" name="Private" />
+                              <v:item value="2" name="ACL" />
                             <v:item value="1" name="Public" />
                             <v:before-data-bind>
                               <![CDATA[
@@ -2562,7 +2578,7 @@
                           <v:textarea name="e_attendees" null-value="--''" value="--self.v_attendees" fmt-function="CAL.WA.utf2wide" xhtml_cols="45" xhtml_rows="6" />
                           <?vsp
                             if (CAL.WA.instance_check (self.account_id, 'AddressBook'))
-                              http (sprintf ('<input type="button" value="Select" onclick="javascript: window.open (\'contacts.vspx?dst=m&params=e_attendees:s1;&sid=%s&realm=%s\', \'calendar_contacts_window\', \'top=100, left=100, scrollbars=yes, resize=yes, menubar=no, height=500, width=600\'); return false;" class="button"> ', self.sid, self.realm));
+                              http (sprintf ('<input type="button" value="Select" onclick="javascript: window.open (\'contacts.vspx?form=F1&dst=mc&params=e_attendees:s1;&sid=%s&realm=%s\', \'calendar_contacts_window\', \'top=100, left=100, scrollbars=yes, resize=yes, menubar=no, height=500, width=600\'); return false;" class="button"> ', self.sid, self.realm));
                             if (self.v_attendees_count)
                               http (sprintf ('<input type="button" value="Details" onclick="javascript: window.open (\'attendees.vspx?id=%d&sid=%s&realm=%s\', \'calendar_contacts_window\', \'top=100, left=100, scrollbars=yes, resize=yes, menubar=no, height=768, width=1024\'); return false;" class="button">', self.v_id, self.sid, self.realm));
                           ?>
@@ -2601,7 +2617,7 @@
                       <?vsp
                                   http(sprintf('<input type="radio" name="e_repeat" id="e_repeat_0" value="" %s />', CAL.WA.checkedAttribute (self.v_repeat, '')));
                       ?>
-                      <xsl:call-template name="nbsp"/>
+                                 
                       <vm:label for="e_repeat_0" value="--'No repeat'" />
                     </td>
                   </tr>
@@ -2613,7 +2629,7 @@
                       <?vsp
                                   http(sprintf('<input type="radio" name="e_repeat" id="e_repeat_1" value="D1" %s />', CAL.WA.checkedAttribute (self.v_repeat, 'D1')));
                       ?>
-                      <xsl:call-template name="nbsp"/>
+                                 
                       <vm:label for="e_repeat_1" value="--'Every'" />
                       <v:text name="e_repeat_param1_D1" null-value="''" value="--self.repeatParam (self.v_repeat, 'D1', 1, null);" xhtml_onfocus="--'javascript: checkRepetition (\'e_repeat\', \'e_repeat_1\');'" xhtml_class="textbox" xhtml_size="1" /> day(s)
                     </td>
@@ -2623,7 +2639,7 @@
                       <?vsp
                                   http(sprintf('<input type="radio" name="e_repeat" id="e_repeat_2" value="D2" %s />', CAL.WA.checkedAttribute (self.v_repeat, 'D2')));
                       ?>
-                      <xsl:call-template name="nbsp"/>
+                                 
                       <vm:label for="e_repeat_2" value="--'Every weekday (Monday-Friday)'" />
                     </td>
                   </tr>
@@ -2635,7 +2651,7 @@
                       <?vsp
                                   http(sprintf('<input type="radio" name="e_repeat" id="e_repeat_3" value="W1" %s />', CAL.WA.checkedAttribute (self.v_repeat, 'W1')));
                       ?>
-                      <xsl:call-template name="nbsp"/>
+                                 
                       <vm:label for="e_repeat_3" value="--'Every'" />
                       <v:text name="e_repeat_param1_W1" null-value="''" value="--self.repeatParam (self.v_repeat, 'W1', 1, null);" xhtml_onfocus="--'javascript: checkRepetition (\'e_repeat\', \'e_repeat_3\');'" xhtml_class="textbox" xhtml_size="1" /> week(s) on
                       <?vsp
@@ -2657,7 +2673,7 @@
                       <?vsp
                                   http(sprintf('<input type="radio" name="e_repeat" id="e_repeat_4" value="M1" %s />', CAL.WA.checkedAttribute (self.v_repeat, 'M1')));
                       ?>
-                      <xsl:call-template name="nbsp"/>
+                                 
                       <vm:label for="e_repeat_4" value="--'Every'" />
                       <v:select-list name="e_repeat_param1_M1" xhtml_onfocus="--'javascript: checkRepetition (\'e_repeat\', \'e_repeat_4\');'" >
                         <v:on-init>
@@ -2708,7 +2724,7 @@
                       <?vsp
                                   http(sprintf('<input type="radio" name="e_repeat" id="e_repeat_5" value="M2" %s />', CAL.WA.checkedAttribute (self.v_repeat, 'M2')));
                       ?>
-                      <xsl:call-template name="nbsp"/>
+                                 
                       <vm:label for="e_repeat_5" value="--'Every'" />
                       <v:select-list name="e_repeat_param1_M2" xhtml_onfocus="--'javascript: checkRepetition (\'e_repeat\', \'e_repeat_5\');'">
                         <v:on-init>
@@ -2806,7 +2822,7 @@
                       <?vsp
                                   http(sprintf('<input type="radio" name="e_repeat" id="e_repeat_6" value="Y1" %s />', CAL.WA.checkedAttribute (self.v_repeat, 'Y1')));
                       ?>
-                      <xsl:call-template name="nbsp"/>
+                                 
                       <vm:label for="e_repeat_6" value="--'Every'" />
                       <v:text name="e_repeat_param1_Y1" null-value="''" value="--self.repeatParam (self.v_repeat, 'Y1', 1, null);" xhtml_onfocus="--'javascript: checkRepetition (\'e_repeat\', \'e_repeat_6\');'" xhtml_class="textbox" xhtml_size="1" /> year(s)
                       on
@@ -2870,7 +2886,7 @@
                       <?vsp
                                   http(sprintf('<input type="radio" name="e_repeat" id="e_repeat_7" value="Y2" %s />', CAL.WA.checkedAttribute (self.v_repeat, 'Y2')));
                       ?>
-                      <xsl:call-template name="nbsp"/>
+                                 
                       <vm:label for="e_repeat_7" value="--'The'" />
                       <v:select-list name="e_repeat_param1_Y2" xhtml_onfocus="--'javascript: checkRepetition (\'e_repeat\', \'e_repeat_7\');'">
                         <v:on-init>
@@ -2992,7 +3008,7 @@
                     S := 'checked="checked"';
                   http(sprintf('<input type="radio" name="e_repeatUntilKind" id="e_repeatUntilKind_0" value="0" %s />', S));
                 ?>
-                <xsl:call-template name="nbsp"/>
+                                 
                 <vm:label for="e_repeatUntilKind_0" value="--'No end date'" />
               </td>
             </tr>
@@ -3006,9 +3022,9 @@
                     S := 'checked="checked"';
                   http(sprintf('<input type="radio" name="e_repeatUntilKind" id="e_repeatUntilKind_1" value="1" %s />', S));
                 ?>
-                <xsl:call-template name="nbsp"/>
+                                 
                 <vm:label for="e_repeatUntilKind_1" value="--'Until'" />
-                <xsl:call-template name="nbsp"/>
+                                 
                                 <v:text name="e_repeatUntil" xhtml_id="e_repeatUntil" null-value="--''" value="--CAL.WA.dt_datestring (self.v_repeatUntil, self.cDateFormat)" xhtml_onfocus="--'javascript: checkRepetition (\'e_repeatUntilKind\', \'e_repeatUntilKind_1\');'" xhtml_onclick="--sprintf ('datePopup(\'e_repeatUntil\', \'%s\');', self.cDateFormat)" xhtml_class="textbox" xhtml_size="10" />
                                 <a href="#" id="e_repeatUntil_select" onclick="datePopup('e_repeatUntil', '<?V self.cDateFormat ?>'); return false;" class="noapp">
                   <img border="0" title="pick" alt="pick" src="image/pick_calendar.gif"/>
@@ -3027,7 +3043,7 @@
                     Notes
                   </th>
                   <td>
-                          <textarea id="e_notes" name="e_notes" style="width: 400; height: 170"><?vsp http (self.v_notes); ?></textarea>
+                          <textarea id="e_notes" name="e_notes" style="width: 400; height: 170"><?vsp http (coalesce (self.v_notes, '')); ?></textarea>
                       <![CDATA[
                             <script type="text/javascript" src="/ods/ckeditor/ckeditor.js"></script>
                             <script type="text/javascript">
@@ -3039,6 +3055,52 @@
               </table>
             </div>
                   <div id="e_content_3" class="tabContent" style="display: none;">
+                    <fieldset>
+                      <legend><b>ODS users</b></legend>
+                      <table class="form-body" cellspacing="0">
+                        <tr>
+                          <td style="width: 90%; background-color: white;">
+                            <table id="f_tbl" width="100%" cellspacing="0">
+                              <thead class="sortHeader">
+                                <tr>
+                                  <th width="100%">Value</th>
+                                  <th width="50px">Action</th>
+                                </tr>
+                              </thead>
+                        		  <![CDATA[
+                        		    <script type="text/javascript">
+                                <?vsp
+                                  declare N, L integer;
+                                  declare acl_values any;
+
+                                  L := 0;
+                                  acl_values := split_and_decode (self.v_grants, 0, '\0\0,');
+                                  for (N := 0; N < length (acl_values); N := N + 1)
+                                  {
+                                    L := 1;
+                                    if (self.cAction <> 'view')
+                                    {
+                                      http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("f", null, {fld_1: {mode: 1, value: "%s", form: "F1"}});});', acl_values[N], 'U'));
+                                    } else {
+                                      http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("f", {fld_1: {value: "%s"}});});', acl_values[N]));
+                                    }
+                                  }
+                                ?>
+                        		    </script>
+                        		  ]]>
+                              <tr id="f_tr_no" style="display: <?V case when L=0 then '' else 'none' end ?>;"><td colspan="<?V case when self.cAction='view' then 1 else 2 end ?>"><b>No Shares</b></td></tr>
+                        		</table>
+                        	</td>
+                          <vm:if test="self.cAction <> 'view'">
+                            <td valign="top" nowrap="nowrap">
+                              <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('f', null, {fld_1: {mode: 1, form: 'F1'}});" />
+                            </td>
+                          </vm:if>
+                        </tr>
+                      </table>
+                    </fieldset>
+                    <fieldset>
+                      <legend><b>WebID users</b></legend>
                     <table class="form-body" cellspacing="0">
                       <tr>
                         <td style="width: 90%; background-color: white;">
@@ -3047,7 +3109,7 @@
                               <tr>
                                 <th width="15%">Type</th>
                                 <th>Value</th>
-                                <th width="80px">Access</th>
+                                <th width="1%" nowrap="nowrap">ACL: (R)ead, (W)rite</th>
                                 <th width="50px">Action</th>
                               </tr>
                             </thead>
@@ -3057,39 +3119,44 @@
                                 declare N, L integer;
                                 declare acl, aType, aAccess any;
 
-                                aType := vector ('URI', 'Person URI', 'Property', 'RDF Property', 'SPARQL', 'SPARQL Expression');
-                                aAccess := vector ('G', 'Grant', 'R', 'Revoke');
-
                               L := 0;
                               acl := (select WAI_ACL from DB.DBA.WA_INSTANCE where WAI_ID = self.domain_id);
                               acl := case when isnull (acl) then vector () else deserialize (acl) end;
-                              for (N := 1; N < length (acl); N := N + 1)
+                                for (N := 0; N < length (acl); N := N + 1)
                               {
                                 L := L + 1;
-                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {value: "%s"}, fld_2: {value: "%s"}, fld_3: {value: "%s"}, fld_4: {value: "%s"}});});', get_keyword (acl[N][0], aType), acl[N][1], get_keyword (acl[N][2], aAccess), 'Inherited'));
+                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}, fld_4: {value: "Inherited"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
                               }
                               acl := deserialize (self.v_acl);
-                              for (N := 1; N < length (acl); N := N + 1)
+                                for (N := 0; N < length (acl); N := N + 1)
                               {
                                 L := L + 1;
-                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("s", null, {fld_1: {mode: 30, value: "%s"}, fld_2: {mode: 0, value: "%s"}, fld_3: {mode: 31, value: "%s"}});});', acl[N][0], acl[N][1], acl[N][2]));
+                                  if (self.cAction <> 'view')
+                                  {
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("s", null, {fld_1: {mode: 50, value: "%s", onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: "F1", tdCssText: "white-space: nowrap;", className: "_validate_ _webid_", value: "%s", readOnly: %s, imgCssText: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', acl[N][2], acl[N][1], case when acl[N][2] = 'public' then 'true' else 'false' end, case when acl[N][2] = 'public' then 'display: none;' else '' end, acl[N][3], acl[N][4], acl[N][5]));
+                                  } else {
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
+                                  }
                                 }
                            		    ?>
                            		    </script>
                            		  ]]>
-                            <tr id="s_tr_no"><td colspan="4"><b>No Shares</b></td></tr>
+                            <tr id="s_tr_no" style="display: <?V case when L=0 then '' else 'none' end ?>;"><td colspan="<?V case when self.cAction='view' then 3 else 4 end ?>"><b>No Shares</b></td></tr>
                           </table>
                         </td>
+                        <vm:if test="self.cAction <> 'view'">
                         <td valign="top" nowrap="nowrap">
-                          <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 30}, fld_2: {mode: 0}, fld_3: {mode: 31}});" />
+                            <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 50, onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: 'F1', tdCssText: 'white-space: nowrap;', className: '_validate_ _webid_'}, fld_3: {mode: 52, value: [1, 0, 0], tdCssText: 'width: 1%; white-space: nowrap; text-align: center;'}});" />
                         </td>
+                        </vm:if>
                       </tr>
                     </table>
+                    </fieldset>
                   </div>
           </div>
         </div>
-        <div class="new-form-footer">
-                <v:button action="simple" name="e_create" value="--case when (self.cAction = 'create') then 'Create' else 'Update' end" xhtml_class="form-button">
+              <div class="form-footer">
+                <v:button action="simple" name="e_create" value="--case when (self.cAction = 'create') then 'Create' else 'Update' end" xhtml_class="form-button" xhtml_onclick="return validateInputs(this);">
             <v:on-post>
               <![CDATA[
                 self.saveEvent ();
@@ -3102,7 +3169,7 @@
               ]]>
             </v:on-post>
           </v:button>
-                <v:button action="simple" name="e_create_new" value="Create and New" enabled="--case when ((self.cScope = 'events') and (self.cAction = 'create')) then 1 else 0 end" xhtml_class="form-button">
+                <v:button action="simple" name="e_create_new" value="Create and New" enabled="--case when ((self.cScope = 'events') and (self.cAction = 'create')) then 1 else 0 end" xhtml_class="form-button" xhtml_onclick="return validateInputs(this);">
             <v:on-post>
               <![CDATA[
                 self.saveEvent ();
@@ -3176,11 +3243,19 @@
             self.initNewEvent ();
           ]]>
         </v:before-data-bind>
-        <div class="new-form-header">
+              <div class="form-header">
                 <v:label format="%s" value="--self.eventHeader (self.v_id, 'event')" />
         </div>
-              <div class="new-form-body vevent" typeof="sioct:EventCalendar" about="<?V SIOC..calendar_event_iri (self.domain_id, self.v_id) ?>">
-          <table cellspacing="0">
+              <div id="t" class="c1">
+                <div class="tabs">
+                  <div onclick="javascript: showTab('t', 2, 0);" class="tab " id="t_tab_0">Main</div>
+                  <vm:if test="not isnull (__proc_exists ('QRcode encodeString8bit', 2))">
+                  <div onclick="javascript: showTab('t', 2, 1);" class="tab " id="t_tab_1">QRCode</div>
+                  </vm:if>
+                </div>
+                <div class="contents vevent" typeof="sioct:EventCalendar" about="<?V SIOC..calendar_event_iri (self.domain_id, self.v_id) ?>">
+                  <div id="t_content_0" class="tabContent" style="display: none;">
+                    <table class="form-body" cellspacing="0">
             <tr>
               <th width="25%">
                 Name
@@ -3272,8 +3347,33 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
-                <v:button action="simple" name="ev_edit" value="Edit" enabled="--case when CAL.WA.event_permissions (self.v_id, self.domain_id, self.access_role) = 'W' then 1 else 0 end" xhtml_class="form-button">
+                  <div id="t_content_1" class="tabContent" style="display: none;">
+              		  <?vsp
+              		    declare vcard, qrcode any;
+
+        		          vcard := CAL.WA.export_vcal (self.domain_id, vector (self.v_id));
+                      qrcode := ODS.ODS_API.qrcode (vcard, 120, 120, 3);
+        		        ?>
+                    <table class="form-body" cellspacing="0">
+                      <tr>
+                        <td align="center">
+                    		  <?vsp
+                            if (qrcode is not null)
+	                            http (sprintf ('<img id="qrcode" src="data:image/jpg;base64,%s"/>', qrcode));
+              		        ?>
+                        </td>
+                      </tr>
+                      <tr>
+                        <td align="center">
+                          <b>iCal Event Data</b>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                </div>
+              </div>
+              <div class="form-footer">
+                <v:button action="simple" name="ev_edit" value="Edit" enabled="--case when CAL.WA.event_rights (self.domain_id, self.v_id, self.account_rights) = 'W' then 1 else 0 end" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
                       self.cAction := 'edit';
@@ -3333,6 +3433,7 @@
                  where E_ID = self.v_id;
 
                        self.v_attendees := CAL.WA.attendees_return (self.v_id);
+                       self.v_grants := self.shareSelect (self.v_id);
                  return;
               }
             _end:;
@@ -3341,16 +3442,14 @@
             }
           ]]>
         </v:before-data-bind>
-        <div class="new-form-header">
+              <div class="form-header">
                 <v:label format="%s" value="--self.eventHeader (self.v_id, 'task')" />
         </div>
         <div id="t" class="c1">
           <div class="tabs">
-                   <vm:tabCaption tab="t" tabsCount="3" tabNo="0" caption="Main" />
-                   <vm:tabCaption tab="t" tabsCount="3" tabNo="1" caption="Notes" />
-                  <vm:if test="CAL.WA.domain_is_public (self.domain_id) = 2">
-                   <vm:tabCaption tab="t" tabsCount="3" tabNo="2" caption="Access" />
-                  </vm:if>
+                  <div onclick="javascript: showTab('t', 4, 0);" class="tab " id="t_tab_0">Main</div>
+                  <div onclick="javascript: showTab('t', 4, 1);" class="tab " id="t_tab_1">Notes</div>
+                  <div onclick="javascript: showTab('t', 4, 2);" class="tab " id="t_tab_2" style="display: <?V case when self.v_privacy > 1 then '' else 'none' end ?>">Sharing</div>
           </div>
           <div class="contents">
             <div id="t_content_0" class="tabContent" style="display: none;">
@@ -3368,8 +3467,9 @@
                 <v:label for="t_eventEndDate" value="Start Date"/>
               </th>
               <td>
-                          <v:text name="t_eventStartDate" xhtml_id="t_eventStartDate" null-value="--''" value="--CAL.WA.dt_datestring (self.v_eventStart, self.cDateFormat)" xhtml_onclick="--sprintf ('datePopup(\'t_eventStartDate\', \'%s\');', self.cDateFormat)" xhtml_class="textbox" xhtml_size="10" />
-                          <a href="#" id="t_eventStartDate_select" onclick="datePopup('t_eventStartDate', '<?V self.cDateFormat ?>'); return false;" class="noapp">
+                          <input type="hidden" name="t_eventStartDate_save" id="t_eventStartDate_save" value="<?V CAL.WA.dt_datestring (self.v_eventStart, self.cDateFormat) ?>" />
+                          <v:text name="t_eventStartDate" xhtml_id="t_eventStartDate" null-value="--''" value="--CAL.WA.dt_datestring (self.v_eventStart, self.cDateFormat)" xhtml_onclick="--sprintf ('datePopup(\'t_eventStartDate\', \'%s\', function(){dateUpdate(\'t_eventStartDate\', [\'t_eventEndDate\'], \'%s\');});', self.cDateFormat, self.cDateFormat)" xhtml_onchange="--sprintf ('dateUpdate(\'t_eventStartDate\', [\'t_eventEndDate\'], \'%s\');', self.cDateFormat)" xhtml_class="textbox" xhtml_size="10" />
+                          <a href="#" id="t_eventStartDate_select" onclick="datePopup('t_eventStartDate', '<?V self.cDateFormat ?>', function(){dateUpdate('t_eventStartDate', ['t_eventEndDate'], '<?V self.cDateFormat ?>');}); return false;" class="noapp">
                   <img border="0" title="pick" alt="pick" src="image/pick_calendar.gif"/>
                 </a>
               </td>
@@ -3379,7 +3479,7 @@
                 <v:label for="t_eventEndDate" value="Due Date"/>
               </th>
               <td>
-                          <v:text name="t_eventEndDate" xhtml_id="t_eventEndDate" null-value="--''" value="--CAL.WA.dt_datestring (self.v_eventEnd, self.cDateFormat)" xhtml_onclick="--sprintf ('datePopup(\'t_eventEndDate\', \'%s\');', self.cDateFormat)" xhtml_class="textbox" xhtml_size="10" />
+                          <v:text name="t_eventEndDate" xhtml_id="t_eventEndDate" null-value="--''" value="--CAL.WA.dt_datestring (self.v_eventEnd, self.cDateFormat)" xhtml_onclick="--sprintf ('datePopup(\'t_eventEndDate\', \'%s\');', self.cDateFormat)" xhtml_onchange="dateUpdate(\'t_eventEndDate\', [\'t_eventStartDate\']);" xhtml_class="textbox" xhtml_size="10" />
                           <a href="#" id="t_eventEndDate_select" onclick="datePopup('t_eventEndDate', '<?V self.cDateFormat ?>'); return false;" class="noapp">
                   <img border="0" title="pick" alt="pick" src="image/pick_calendar.gif"/>
                 </a>
@@ -3428,12 +3528,7 @@
                     <![CDATA[
                       declare x any;
 
-                      x := make_array (5, 'any');
-                      x[0] := 'Not Started';
-                      x[1] := 'In Progress';
-                      x[2] := 'Completed';
-                                x[3] := 'Waiting';
-                      x[4] := 'Deferred';
+                                x := vector ('Not Started', 'In Progress', 'Completed', 'Waiting', 'Deferred');
                       control.vsl_item_values := x;
                       control.vsl_items := x;
                       control.ufl_value := '';
@@ -3468,12 +3563,7 @@
                     <![CDATA[
                       declare x any;
 
-                      x := make_array (5, 'any');
-                      x[0] := '0';
-                      x[1] := '25';
-                      x[2] := '50';
-                      x[3] := '75';
-                      x[4] := '100';
+                                x := vector ('0', '25', '50', '75', '100');
                       control.vsl_item_values := x;
                       control.vsl_items := x;
                       control.ufl_value := '0';
@@ -3501,8 +3591,9 @@
                           <vm:label for="t_privacy" value="--'Privacy'" />
                         </th>
                         <td>
-                          <v:select-list name="t_privacy">
+                            <v:select-list name="t_privacy" xhtml_onchange="javascript: (this.value == \'2\')? OAT.Dom.show(\'t_tab_2\'): OAT.Dom.hide(\'t_tab_2\');">
                             <v:item value="0" name="Private" />
+                              <v:item value="2" name="ACL" />
                             <v:item value="1" name="Public" />
                             <v:before-data-bind>
                               <![CDATA[
@@ -3521,7 +3612,7 @@
                           <v:textarea name="t_attendees" null-value="--''" value="--self.v_attendees" fmt-function="CAL.WA.utf2wide" xhtml_cols="45" xhtml_rows="6" />
                           <?vsp
                             if (CAL.WA.instance_check (self.account_id, 'AddressBook'))
-                              http (sprintf ('<input type="button" value="Select" onclick="javascript: window.open (\'contacts.vspx?dst=m&params=t_attendees:s1;&sid=%s&realm=%s\', \'calendar_contacts_window\', \'top=100, left=100, scrollbars=yes, resize=yes, menubar=no, height=500, width=600\'); return false;" class="button"> ', self.sid, self.realm));
+                              http (sprintf ('<input type="button" value="Select" onclick="javascript: window.open (\'contacts.vspx?form=F1&dst=mc&params=t_attendees:s1;&sid=%s&realm=%s\', \'calendar_contacts_window\', \'top=100, left=100, scrollbars=yes, resize=yes, menubar=no, height=500, width=600\'); return false;" class="button"> ', self.sid, self.realm));
                             if (self.v_attendees_count)
                               http (sprintf ('<input type="button" value="Details" onclick="javascript: window.open (\'attendees.vspx?id=%d&sid=%s&realm=%s\', \'calendar_contacts_window\', \'top=100, left=100, scrollbars=yes, resize=yes, menubar=no, height=768, width=1024\'); return false;" class="button">', self.v_id, self.sid, self.realm));
                           ?>
@@ -3553,7 +3644,7 @@
                     Notes
                   </th>
                   <td>
-                          <textarea id="t_notes" name="t_notes" style="width: 400; height: 170"><?vsp http (self.v_notes); ?></textarea>
+                          <textarea id="t_notes" name="t_notes" style="width: 400; height: 170"><?vsp http (coalesce (self.v_notes, '')); ?></textarea>
                     <![CDATA[
                             <script type="text/javascript" src="/ods/ckeditor/ckeditor.js"></script>
                             <script type="text/javascript">
@@ -3565,6 +3656,52 @@
               </table>  
             </div>
                   <div id="t_content_2" class="tabContent" style="display: none;">
+                    <fieldset>
+                      <legend><b>ODS users</b></legend>
+                      <table class="form-body" cellspacing="0">
+                        <tr>
+                          <td style="width: 90%; background-color: white;">
+                            <table id="f_tbl" width="100%" cellspacing="0">
+                              <thead class="sortHeader">
+                                <tr>
+                                  <th width="100%">Value</th>
+                                  <th width="50px">Action</th>
+                                </tr>
+                              </thead>
+                        		  <![CDATA[
+                        		    <script type="text/javascript">
+                                <?vsp
+                                  declare N, L integer;
+                                  declare acl_values any;
+
+                                  L := 0;
+                                  acl_values := split_and_decode (self.v_grants, 0, '\0\0,');
+                                  for (N := 0; N < length (acl_values); N := N + 1)
+                                  {
+                                    L := 1;
+                                    if (self.cAction <> 'view')
+                                    {
+                                      http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("f", null, {fld_1: {mode: 1, value: "%s", form: "F1"}});});', acl_values[N], 'U'));
+                                    } else {
+                                      http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("f", {fld_1: {value: "%s"}});});', acl_values[N]));
+                                    }
+                                  }
+                                ?>
+                        		    </script>
+                        		  ]]>
+                              <tr id="f_tr_no" style="display: <?V case when L=0 then '' else 'none' end ?>;"><td colspan="<?V case when self.cAction='view' then 1 else 2 end ?>"><b>No Shares</b></td></tr>
+                        		</table>
+                        	</td>
+                          <vm:if test="self.cAction <> 'view'">
+                            <td valign="top" nowrap="nowrap">
+                              <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('f', null, {fld_1: {mode: 1, form: 'F1'}});" />
+                            </td>
+                          </vm:if>
+                        </tr>
+                      </table>
+                    </fieldset>
+                    <fieldset>
+                      <legend><b>WebID users</b></legend>
                     <table class="form-body" cellspacing="0">
                       <tr>
                         <td style="width: 90%; background-color: white;">
@@ -3573,7 +3710,7 @@
                               <tr>
                                 <th width="15%">Type</th>
                                 <th>Value</th>
-                                <th width="80px">Access</th>
+                                <th width="1%" nowrap="nowrap">ACL: (R)ead, (W)rite</th>
                                 <th width="50px">Action</th>
                               </tr>
                             </thead>
@@ -3583,38 +3720,43 @@
                                 declare N, L integer;
                                 declare acl, aType, aAccess any;
 
-                                aType := vector ('URI', 'Person URI', 'Property', 'RDF Property', 'SPARQL', 'SPARQL Expression');
-                                aAccess := vector ('G', 'Grant', 'R', 'Revoke');
-
                               L := 0;
                               acl := (select WAI_ACL from DB.DBA.WA_INSTANCE where WAI_ID = self.domain_id);
                               acl := case when isnull (acl) then vector () else deserialize (acl) end;
-                              for (N := 1; N < length (acl); N := N + 1)
+                                for (N := 0; N < length (acl); N := N + 1)
                               {
                                 L := L + 1;
-                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {value: "%s"}, fld_2: {value: "%s"}, fld_3: {value: "%s"}, fld_4: {value: "%s"}});});', get_keyword (acl[N][0], aType), acl[N][1], get_keyword (acl[N][2], aAccess), 'Inherited'));
+                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}, fld_4: {value: "Inherited"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
                               }
                               acl := deserialize (self.v_acl);
-                              for (N := 1; N < length (acl); N := N + 1)
+                                for (N := 0; N < length (acl); N := N + 1)
                               {
                                 L := L + 1;
-                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("s", null, {fld_1: {mode: 30, value: "%s"}, fld_2: {mode: 0, value: "%s"}, fld_3: {mode: 31, value: "%s"}});});', acl[N][0], acl[N][1], acl[N][2]));
+                                  if (self.cAction <> 'view')
+                                  {
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("s", null, {fld_1: {mode: 50, value: "%s", onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: "F1", tdCssText: "white-space: nowrap;", className: "_validate_ _uri_", value: "%s", readOnly: %s, imgCssText: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', acl[N][2], acl[N][1], case when acl[N][2] = 'public' then 'true' else 'false' end, case when acl[N][2] = 'public' then 'display: none;' else '' end, acl[N][3], acl[N][4], acl[N][5]));
+                                  } else {
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
+                                  }
                                 }
                            		    ?>
                            		    </script>
                            		  ]]>
-                            <tr id="s_tr_no"><td colspan="4"><b>No Shares</b></td></tr>
+                            <tr id="s_tr_no" style="display: <?V case when L=0 then '' else 'none' end ?>;"><td colspan="<?V case when self.cAction='view' then 3 else 4 end ?>"><b>No Shares</b></td></tr>
                           </table>
                         </td>
+                        <vm:if test="self.cAction <> 'view'">
                         <td valign="top" nowrap="nowrap">
-                          <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 30}, fld_2: {mode: 0}, fld_3: {mode: 31}});" />
+                            <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 50, onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: 'F1', tdCssText: 'white-space: nowrap;', className: '_validate_ _uri_'}, fld_3: {mode: 52, value: [1, 0, 0], tdCssText: 'width: 1%; white-space: nowrap; text-align: center;'}});" />
                         </td>
+                        </vm:if>
                       </tr>
                     </table>
+                    </fieldset>
                   </div>
           </div>
         </div>
-        <div class="new-form-footer">
+              <div class="form-footer">
                 <v:button action="simple" name="t_create" value="--case when (self.cAction = 'create') then 'Create' else 'Update' end" enabled="--case when (self.cAction in ('create', 'edit')) then 1 else 0 end" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
@@ -3688,11 +3830,19 @@
             self.initNewTask ();
           ]]>
         </v:before-data-bind>
-        <div class="new-form-header">
+              <div class="form-header">
                 <v:label format="%s" value="--self.eventHeader (self.v_id, 'task')" />
         </div>
-              <div class="new-form-body vevent" typeof="sioct:EventCalendar" about="<?V SIOC..calendar_event_iri (self.domain_id, self.v_id) ?>">
-                <table cellspacing="0">
+              <div id="t" class="c1">
+                <div class="tabs">
+                  <div onclick="javascript: showTab('t', 2, 0);" class="tab " id="t_tab_0">Main</div>
+                  <vm:if test="not isnull (__proc_exists ('QRcode encodeString8bit', 2))">
+                  <div onclick="javascript: showTab('t', 2, 1);" class="tab " id="t_tab_1">QRCode</div>
+                  </vm:if>
+                </div>
+                <div class="contents vevent" typeof="sioct:EventCalendar" about="<?V SIOC..calendar_event_iri (self.domain_id, self.v_id) ?>">
+                  <div id="t_content_0" class="tabContent" style="display: none;">
+                    <table class="form-body" cellspacing="0">
             <tr>
               <th width="25%">
                 Name
@@ -3775,8 +3925,33 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
-                <v:button action="simple" name="tv_edit" value="Edit" enabled="--case when CAL.WA.event_permissions (self.v_id, self.domain_id, self.access_role) = 'W' then 1 else 0 end" xhtml_class="form-button">
+                  <div id="t_content_1" class="tabContent" style="display: none;">
+              		  <?vsp
+              		    declare vcard, qrcode any;
+
+        		          vcard := CAL.WA.export_vcal (self.domain_id, vector (self.v_id));
+                      qrcode := ODS.ODS_API.qrcode (vcard, 120, 120, 3);
+        		        ?>
+                    <table class="form-body" cellspacing="0">
+                      <tr>
+                        <td align="center">
+                    		  <?vsp
+                            if (qrcode is not null)
+	                            http (sprintf ('<img id="qrcode" src="data:image/jpg;base64,%s"/>', qrcode));
+              		        ?>
+                        </td>
+                      </tr>
+                      <tr>
+                        <td align="center">
+                          <b>iCal Task Data</b>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                </div>
+              </div>
+              <div class="form-footer">
+                <v:button action="simple" name="tv_edit" value="Edit" enabled="--case when CAL.WA.event_rights (self.domain_id, self.v_id, self.account_rights) = 'W' then 1 else 0 end" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
                       self.cAction := 'edit';
@@ -3796,7 +3971,7 @@
       </v:template>
 
       <vm:if test="self.cAction = 'import'">
-        <div class="new-form-header">
+              <div class="form-header">
                 <v:label format="%s" value="Import" />
         </div>
 
@@ -3814,7 +3989,7 @@
                       ]]>
                     </v:before-render>
                   </v:radio-button>
-                  <xsl:call-template name="nbsp" />
+                       
                   <b><vm:label for="icSource_0" value="--'File'" /></b>
                 </td>
               </tr>
@@ -3827,7 +4002,7 @@
                       ]]>
                     </v:before-render>
                   </v:radio-button>
-                  <xsl:call-template name="nbsp" />
+                       
                   <b><vm:label for="icSource_1" value="--'WebDAV'" /></b>
                 </td>
               </tr>
@@ -3840,7 +4015,7 @@
                       ]]>
                     </v:before-render>
                   </v:radio-button>
-                  <xsl:call-template name="nbsp" />
+                       
                   <b><vm:label for="icSource_2" value="--'URL'" /></b>
               </td>
             </tr>
@@ -3853,20 +4028,20 @@
                       <input type="file" name="f_file" size="60" />
                       </span>
                       <span id="imp_td_1" style="display: <?V case when self.icSource = 1 then '' else 'none' end ?>;">
-                        <v:text name="f_dav" xhtml_id="f_dav" value="--get_keyword ('f_dav', self.vc_page.vc_event.ve_params, '')" xhtml_size="60" /><v:button action="browse" name="browse" value="Browse...">
-                   	  <v:after-data-bind>
+                        <v:text name="f_dav" xhtml_id="f_dav" value="--get_keyword ('f_dav', self.vc_page.vc_event.ve_params, '')" xhtml_size="60" />
+                        <input type="button" value="Browse..." onclick="davBrowse ('f_dav');" />
                    		  <![CDATA[
-                                control.vc_add_attribute ('onclick', 'javascript: davBrowse (\'f_dav\');');
+                  		    <script type="text/javascript">
+                            OAT.Loader.load(['dav'], function(){OAT.WebDav.init(davOptions);});
+                  		    </script>
               			    ]]>
-              			  </v:after-data-bind>
-              		  </v:button>
                       </span>
                       <span id="imp_td_2" style="display: <?V case when self.icSource = 2 then '' else 'none' end ?>;">
                         <v:text name="f_uri" value="--get_keyword ('f_uri', self.vc_page.vc_event.ve_params, '')" xhtml_size="60" />
                       </span>
                     </td>
                 </tr>
-                  <tr id="imp_tr_31" style="display: <?V case when self.icSource < 1 then 'none' else 'run-in' end ?>;">
+                  <tr id="imp_tr_31" style="<?V case when self.icSource < 1 then 'display: none;' else '' end ?>;">
                     <th>
                       User
                   </th>
@@ -3874,7 +4049,7 @@
                       <v:text name="i_user" value="--self.icUser" xhtml_class="" />
                     </td>
                   </tr>
-                  <tr id="imp_tr_32" style="display: <?V case when self.icSource < 1 then 'none' else 'run-in' end ?>;">
+                  <tr id="imp_tr_32" style="<?V case when self.icSource < 1 then 'display: none;' else '' end ?>;">
                     <th>
                       Password
                     </th>
@@ -3910,7 +4085,7 @@
                     </td>
                   </tr>
                   <tr>
-                    <th />
+                    <th></th>
                     <td>
                       <label>
                         <v:check-box name="i_sync" is-boolean="1" true-value="1" false-value="0" value="--self.icSync" />
@@ -3921,7 +4096,7 @@
           </table>
         </div>
 
-        <div class="new-form-footer">
+              <div class="form-footer">
                 <v:button action="simple" name="import" value="Import" xhtml_class="form-button">
               <v:on-post>
                 <![CDATA[
@@ -4012,7 +4187,7 @@
         </vm:if>
 
             <vm:if test="self.cAction = 'export'">
-              <div class="new-form-header">
+              <div class="form-header">
                 <v:label format="%s" value="Export" />
               </div>
 
@@ -4048,7 +4223,7 @@
                           ]]>
                         </v:before-render>
                       </v:radio-button>
-                      <xsl:call-template name="nbsp" />
+                       
                       <b><vm:label for="ex_destination_type_1" value="--'WebDAV'" /></b>
                     </td>
                   </tr>
@@ -4061,7 +4236,7 @@
                           ]]>
                         </v:before-render>
                       </v:radio-button>
-                      <xsl:call-template name="nbsp" />
+                       
                       <b><vm:label for="ex_destination_type_2" value="--'URL'" /></b>
                     </td>
                   </tr>
@@ -4071,17 +4246,15 @@
                     </th>
                     <td>
                       <v:text name="ex_destination" xhtml_id="ex_destination" value="--self.exName" xhtml_size="60" />
-                      <v:button action="browse" name="ex_destination_button" value="Browse..." xhtml_id="ex_destination_button">
-                        <v:after-data-bind>
+                      <input type="button" id="ex_destination_button" value="Browse..." onclick="davBrowse ('ex_destination');" style="display: none;" />
                           <![CDATA[
-                            control.vc_add_attribute ('onclick', 'javascript: davBrowse (''ex_destination'');');
-                            control.vc_add_attribute ('style', 'display: none;');
+                		    <script type="text/javascript">
+                          OAT.Loader.load(['dav'], function(){OAT.WebDav.init(davOptions);});
+                		    </script>
                           ]]>
-                        </v:after-data-bind>
-                      </v:button>
                     </td>
                   </tr>
-                  <tr id="ex_tr_0" style="display: <?V case when self.exType < 1 then 'none' else 'run-in' end ?>;">
+                  <tr id="ex_tr_0" style="<?V case when self.exType < 1 then 'display: none;' else '' end ?>;">
                     <th>
                       User
                     </th>
@@ -4089,7 +4262,7 @@
                       <v:text name="ex_user" value="--self.exUser" xhtml_class="" />
                     </td>
                   </tr>
-                  <tr id="ex_tr_1" style="display: <?V case when self.exType < 1 then 'none' else 'run-in' end ?>;">
+                  <tr id="ex_tr_1" style="<?V case when self.exType < 1 then 'display: none;' else '' end ?>;">
                     <th>
                       Password
                     </th>
@@ -4103,7 +4276,7 @@
                     </td>
                   </tr>
                   <tr>
-                    <th />
+                    <th></th>
                     <td>
                       <label>
                         <v:check-box name="ex_events" is-boolean="1" true-value="1" false-value="0" value="--self.exEvents" />
@@ -4112,7 +4285,7 @@
                     </td>
                   </tr>
                   <tr>
-                    <th />
+                    <th></th>
                     <td>
                       <label>
                         <v:check-box name="ex_tasks" is-boolean="1" true-value="1" false-value="0" value="--self.exTasks" />
@@ -4165,7 +4338,7 @@
                 </table>
               </div>
 
-              <div class="new-form-footer">
+              <div class="form-footer">
                 <v:button action="simple" name="ex_export" value="Export" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
@@ -4307,7 +4480,7 @@
             </vm:if>
 
             <vm:if test="self.cAction in ('publishBrowse', 'subscribeBrowse', 'syncmlBrowse')">
-        <div class="new-form-header">
+              <div class="form-header">
                 <?vsp
                   declare T varchar;
 
@@ -4523,7 +4696,7 @@
             </vm:if>
 
             <v:template name="exchange_form" type="simple" enabled="--case when self.cAction in ('publishCreate', 'publishUpdate', 'subscribeCreate', 'subscribeUpdate', 'syncmlCreate', 'syncmlUpdate') then 1 else 0 end">
-              <div class="new-form-header">
+              <div class="form-header">
                 <?vsp
                   declare T varchar;
 
@@ -4709,15 +4882,12 @@
                           <td>
                       <v:text name="exc_options_name" xhtml_id="exc_options_name" value="--get_keyword ('name', self.ve_options)" xhtml_size="60" />
                       <vm:if test="self.cAction not in ('syncmlCreate', 'syncmlUpdate')">
-                        <v:button action="browse" name="exc_options_name_button" value="Browse..." xhtml_id="exc_options_name_button">
-                        <v:after-data-bind>
+                        <input type="button" id="exc_options_name_button" value="Browse..." onclick="davBrowse ('exc_options_name');" style="display: <?V case when (get_keyword ('type', self.ve_options, 1) <> 1) then 'none' else '' end ?>;" />
                           <![CDATA[
-                            control.vc_add_attribute ('onclick', 'javascript: davBrowse (''exc_options_name'');');
-                              if (get_keyword ('type', self.ve_options, 1) <> 1)
-                                control.vc_add_attribute ('style', 'display: none');
+                  		    <script type="text/javascript">
+                            OAT.Loader.load(['dav'], function(){OAT.WebDav.init(davOptions);});
+                  		    </script>
                           ]]>
-                        </v:after-data-bind>
-                      </v:button>
                       </vm:if>
                           </td>
                         </tr>
@@ -4781,7 +4951,7 @@
                     </tr>
                   </vm:if>
                         <tr>
-                          <th />
+                    <th></th>
                           <td>
                       <label>
                         <v:check-box name="exc_options_events" is-boolean="1" true-value="1" false-value="0" value="--get_keyword ('events', coalesce (self.ve_options, vector ()), 1)" />
@@ -4790,7 +4960,7 @@
                           </td>
                         </tr>
                         <tr>
-                          <th />
+                    <th></th>
                           <td>
                       <label>
                         <v:check-box name="exc_options_tasks" is-boolean="1" true-value="1" false-value="0" value="--get_keyword ('tasks', coalesce (self.ve_options, vector ()), 1)" />
@@ -4800,7 +4970,7 @@
                         </tr>
                       </table>
                     </div>
-              <div class="new-form-footer">
+              <div class="form-footer">
                 <v:button action="simple" name="exc_save" value="--case when self.cAction in ('publishCreate', 'subscribeCreate', 'syncmlCreate') then 'Create' else 'Update' end" xhtml_class="form-button">
                   <v:on-post>
                         <![CDATA[
@@ -4928,7 +5098,7 @@
             </v:template>
 
             <v:template name="exchange_delete" type="simple" enabled="--case when self.cAction in ('subscribeDelete') then 1 else 0 end">
-              <div class="new-form-header">
+              <div class="form-header">
                 Subscriptions/Delete
               </div>
               <div class="new-form-body">
@@ -4969,7 +5139,7 @@
                   ?>
                 </table>
               </div>
-              <div class="new-form-footer">
+              <div class="form-footer">
                 <v:button action="simple" name="exc_delete" value="Delete" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
@@ -5042,7 +5212,7 @@
                  _end3:;
                 ]]>
               </v:before-data-bind>
-              <div class="new-form-header">
+              <div class="form-header">
                 SyncML/Execute
               </div>
               <div class="new-form-body">
@@ -5075,7 +5245,7 @@
                   ?>
                 </table>
               </div>
-              <div class="new-form-footer">
+              <div class="form-footer">
                 <v:button action="simple" name="exc_sync_exec" value="Sync" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
@@ -5102,7 +5272,7 @@
             </v:template>
 
             <vm:if test="self.cAction = 'settings'">
-              <div class="new-form-header">
+              <div class="form-header">
                 <?vsp
                   declare S, T varchar;
 
@@ -5199,11 +5369,11 @@
                               <?vsp
                                 http(sprintf('<input type="radio" name="sr_chars" id="sr_chars_0" value="0" %s />', CAL.WA.checkedAttribute (CAL.WA.settings_chars (self.settings), 0)));
                               ?>
-                              <xsl:call-template name="nbsp" /><vm:label for="s_chars_0" value="--'show everything'" />
+                               <vm:label for="s_chars_0" value="--'show everything'" />
                             </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <?vsp
                                 declare S varchar;
@@ -5213,9 +5383,9 @@
                                   S := 'checked="checked"';
                                 http(sprintf('<input type="radio" name="sr_chars" id="sr_chars_1" value="1" %s />', S));
                               ?>
-                              <xsl:call-template name="nbsp" /><vm:label for="s_chars_1" value="--'show no more than'" /><xsl:call-template name="nbsp" />
+                               <vm:label for="s_chars_1" value="--'show no more than'" /> 
                               <v:text name="s_chars" null-value="--''" value="--get_keyword('chars', self.settings, '60')" xhtml_size="3" />
-                              <xsl:call-template name="nbsp" /><vm:label for="s_chars_1" value="--'characters'" /><xsl:call-template name="nbsp" />
+                               <vm:label for="s_chars_1" value="--'characters'" /> 
                             </td>
                           </tr>
                         <tr>
@@ -5243,14 +5413,14 @@
                             </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <v:check-box name="s_showTasks" xhtml_id="s_showTasks" is-boolean="1" true-value="1" false-value="0" value="--cast(get_keyword('showTasks', self.settings, '1') as integer)" />
                               <vm:label for="s_showTasks" value="Show tasks in Calendar"/>
                             </td>
                         </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <label>
                                 <v:check-box name="s_attendees" xhtml_id="s_attendees" is-boolean="1" true-value="1" false-value="0" value="--cast(get_keyword ('mailAttendees', self.settings, '1') as integer)" />
@@ -5272,14 +5442,14 @@
                           </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <v:check-box name="s_e_column_1" xhtml_id="s_e_column_1" is-boolean="1" true-value="1" false-value="0" value="--cast (get_keyword ('event_E_UPDATED', self.settings, '1') as integer)" />
                               <vm:label for="s_e_column_1" value="Updated"/>
                           </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <v:check-box name="s_e_column_2" xhtml_id="s_e_column_2" is-boolean="1" true-value="1" false-value="0" value="--cast(get_keyword ('event_E_CREATED', self.settings, '0') as integer)" />
                               <vm:label for="s_e_column_2" value="Created"/>
@@ -5295,42 +5465,42 @@
                           </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <v:check-box name="s_t_column_5" xhtml_id="s_t_column_5" is-boolean="1" true-value="1" false-value="0" value="--cast (get_keyword ('task_E_PRIORITY', self.settings, '1') as integer)" />
                               <vm:label for="s_t_column_5" value="Priority"/>
                             </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <v:check-box name="s_t_column_6" xhtml_id="s_t_column_6" is-boolean="1" true-value="1" false-value="0" value="--cast(get_keyword ('task_E_START', self.settings, '0') as integer)" />
                               <vm:label for="s_t_column_6" value="Start Date"/>
                             </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <v:check-box name="s_t_column_7" xhtml_id="s_t_column_7" is-boolean="1" true-value="1" false-value="0" value="--cast(get_keyword ('task_E_END', self.settings, '1') as integer)" />
                               <vm:label for="s_t_column_7" value="Due Date"/>
                             </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <v:check-box name="s_t_column_2" xhtml_id="s_t_column_2" is-boolean="1" true-value="1" false-value="0" value="--cast(get_keyword ('task_E_COMPLETED', self.settings, '0') as integer)" />
                               <vm:label for="s_t_column_2" value="Completed"/>
                             </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <v:check-box name="s_t_column_3" xhtml_id="s_t_column_3" is-boolean="1" true-value="1" false-value="0" value="--cast(get_keyword ('task_E_UPDATED', self.settings, '0') as integer)" />
                               <vm:label for="s_t_column_3" value="Updated"/>
                             </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <v:check-box name="s_t_column_4" xhtml_id="s_t_column_4" is-boolean="1" true-value="1" false-value="0" value="--cast(get_keyword ('task_E_CREATED', self.settings, '0') as integer)" />
                               <vm:label for="s_t_column_4" value="Created"/>
@@ -5345,25 +5515,25 @@
                             </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <?vsp self.showColorRef ('In Progress'); ?>
                             </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <?vsp self.showColorRef ('Completed'); ?>
                             </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <?vsp self.showColorRef ('Waiting'); ?>
                             </td>
                           </tr>
                           <tr>
-                            <th />
+                            <th></th>
                             <td>
                               <?vsp self.showColorRef ('Deferred'); ?>
                             </td>
@@ -5538,7 +5708,7 @@
                   </div>
                     </div>
                   </div>
-                <div class="new-form-footer">
+                  <div class="form-footer">
                     <v:button action="simple" value="Save" xhtml_class="form-button">
                     <v:on-post>
                       <![CDATA[
@@ -5902,7 +6072,7 @@
                       <?vsp self.myTags ('su_exclude'); ?>
                     </table>
                   </div>
-                  <div class="new-form-footer">
+                  <div class="form-footer">
                     <v:button action="simple" value="--case when self.cSubAction = 'upstreamCreate' then 'Create' else 'Update' end" name="su_save" xhtml_class="form-button">
                       <v:on-post>
                         <![CDATA[
@@ -6108,11 +6278,11 @@
                         </th>
                         <td>
                           <v:text name="sg_account" null-value="--''" value="--self.vg_account" xhtml_class="textbox" />
-                          <input type="button" value="Select" onclick="javascript: windowShow('users.vspx?params=sg_account:s1;',520)" class="button" />
+                          <input type="button" value="Select" onclick="javascript: windowShow('/ods/users_select.vspx?mode=u&form=F1&params=sg_account:s1;')" class="button" />
                         </td>
                       </tr>
                       <tr>
-                        <th />
+                        <th></th>
                         <td>
                           <?vsp
                             http (sprintf ('<input type="checkbox" value="1" name="sg_enable" id="sg_enable" %s />', CAL.WA.checkedAttribute (self.vg_enable)));
@@ -6138,7 +6308,7 @@
                       </tr>
                     </table>
                   </div>
-                  <div class="new-form-footer">
+                  <div class="form-footer">
                     <v:button action="simple" value="Share" name="sg_save" xhtml_class="form-button">
                       <v:on-post>
                         <![CDATA[
@@ -6420,11 +6590,11 @@
                         </th>
                         <td>
                           <v:text name="ss_calendar" xhtml_id="ss_calendar" value="--self.vs_calendar" xhtml_size="60" />
-                          <input id="ss_type_button" type="button" value="Select" onclick="javascript: calendarsShow('calendars.vspx?params=ss_calendar:s1;',520)" class="button" />
+                          <input id="ss_type_button" type="button" value="Select" onclick="javascript: calendarsShow('calendars.vspx?form=F1&params=ss_calendar:s1;',520)" class="button" />
                         </td>
                       </tr>
                       <tr>
-                        <th />
+                        <th></th>
                         <td>
                           <?vsp
                             http (sprintf ('<input type="checkbox" value="1" name="ss_visible" id="ss_visible" %s />', CAL.WA.checkedAttribute (self.vs_visible)));
@@ -6448,7 +6618,7 @@
                       ]]>
                     </script>
                   </div>
-                  <div class="new-form-footer">
+                  <div class="form-footer">
                     <v:button action="simple" value="--case when self.cSubAction = 'sharedCreate' then 'Accept' else 'Update' end" name="ss_save" xhtml_class="form-button">
                       <v:on-post>
                         <![CDATA[
@@ -6571,7 +6741,7 @@
             </tbody>
           </table>
         </div>
-        <div class="new-form-footer">
+                <div class="form-footer">
           <input type="button" value="Dismiss Selected" onclick="javascript: dismissReminder ('cbr_item', false);" title="Dismiss Selected" class="button" />
           <input type="button" value="Dismiss All"      onclick="javascript: dismissReminder ('cbr_item', true);"  title="Dismiss All"      class="button" />
         </div>
diff --git a/appsrc/ODS-Calendar/www/image/add_16.png b/appsrc/ODS-Calendar/www/image/add_16.png
deleted file mode 100644
index ad76487..0000000
Binary files a/appsrc/ODS-Calendar/www/image/add_16.png and /dev/null differ
diff --git a/appsrc/ODS-Calendar/www/image/calendarbanner_sml.jpg b/appsrc/ODS-Calendar/www/image/calendarbanner_sml.jpg
index edc23b7..4509dfe 100644
Binary files a/appsrc/ODS-Calendar/www/image/calendarbanner_sml.jpg and b/appsrc/ODS-Calendar/www/image/calendarbanner_sml.jpg differ
diff --git a/appsrc/ODS-Calendar/www/image/del_16.png b/appsrc/ODS-Calendar/www/image/del_16.png
deleted file mode 100644
index abe8c4b..0000000
Binary files a/appsrc/ODS-Calendar/www/image/del_16.png and /dev/null differ
diff --git a/appsrc/ODS-Calendar/www/image/polls_32.png b/appsrc/ODS-Calendar/www/image/polls_32.png
deleted file mode 100644
index 67086d7..0000000
Binary files a/appsrc/ODS-Calendar/www/image/polls_32.png and /dev/null differ
diff --git a/appsrc/ODS-Calendar/www/image/polls_add_32.png b/appsrc/ODS-Calendar/www/image/polls_add_32.png
deleted file mode 100644
index b62737b..0000000
Binary files a/appsrc/ODS-Calendar/www/image/polls_add_32.png and /dev/null differ
diff --git a/appsrc/ODS-Calendar/www/image/polls_public_32.png b/appsrc/ODS-Calendar/www/image/polls_public_32.png
deleted file mode 100644
index 3de79c9..0000000
Binary files a/appsrc/ODS-Calendar/www/image/polls_public_32.png and /dev/null differ
diff --git a/appsrc/ODS-Calendar/www/js/calendar.js b/appsrc/ODS-Calendar/www/js/calendar.js
index 9679012..43838c0 100644
--- a/appsrc/ODS-Calendar/www/js/calendar.js
+++ b/appsrc/ODS-Calendar/www/js/calendar.js
@@ -19,10 +19,12 @@
  *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  *
 */
-function myA(obj) {
-  if (obj.href) {
-    document.location = obj.href + '?' + urlParam('sid') + urlParam('realm');
-    return false;
+function setFooter() {
+  if ($('content')) {
+    var wDims = OAT.Dom.getViewport()
+    var hDims = OAT.Dom.getWH('FT')
+    var cPos = OAT.Dom.position('content')
+    $('content').style.height = (wDims[1] - hDims[1] - cPos[1] - 20) + 'px';
   }
 }
 
@@ -115,44 +117,77 @@ function dateParse(dateString, format) {
 	return result;
 }
 
-function datePopup(objName, format) {
-	if (!format) {
+function datePopup(objName, format, cb) {
+	if (!format)
 		format = 'yyyy-MM-dd';
-	}
+
 	var obj = $(objName);
 	var d = dateParse(obj.value, format);
-	var c = new OAT.Calendar( {
-		popup : true
-	});
+	var c = new OAT.Calendar({popup: true});
 	var coords = OAT.Dom.position(obj);
-	if (isNaN(coords[0])) {
+	if (isNaN(coords[0]))
 		coords = [ 0, 0 ];
-	}
+
 	var x = function(date) {
 		obj.value = dateFormat(date, format);
+		if (cb)
+		  cb();
 	}
 	c.show(coords[0], coords[1] + 30, x, d);
 }
 
-function submitEnter(e, fForm, fButton, fName, fValue, f2Name, f2Value, f3Name,
-		f3Value) {
+function dateUpdate(srcField, dstFields, format) {
+  function dp(v, f) {
+    var dt = dateParse(v, f);
+    if (dt)
+      dt = new Date(dt[0], dt[1]-1, dt[2]);
+
+    return dt;
+  }
+  var src = $(srcField);
+  if (!src) {return;}
+  var srcDate = dp(src.value, format);
+  if (!srcDate) {return;}
+
+  var srcSave = $(srcField+'_save');
+  if (!srcSave) {return;}
+  var srcSaveDate = dp(srcSave.value, format);
+  if (!srcSaveDate) {return;}
+
+  var delta = (srcDate.getTime() - srcSaveDate.getTime()) / (60 * 60 * 24 * 1000);
+	for (var i = 0; i < dstFields.length; i++) {
+    var dst = $(dstFields[i]);
+    if (!dst) {continue;}
+    var dstDate = dp(dst.value, format);
+    if (!dstDate) {continue;}
+
+    dstDate = new Date(dstDate.getFullYear(), dstDate.getMonth(), dstDate.getDate()+delta);
+    dst.value = dateFormat([dstDate.getFullYear(), dstDate.getMonth()+1, dstDate.getDate()], format);
+
+    var dstSave = $(dstFields[i]+'_save');
+    if (!dstSave) {continue;}
+    dstSave.value = dst.value;
+  }
+  srcSave.value = src.value;
+}
+
+function submitEnter(e, fForm, fButton, fName, fValue, f2Name, f2Value, f3Name, f3Value) {
   var keyCode;
   
 	if (window.event) {
     keycode = window.event.keyCode;
   } else {
-		if (!e) {
+		if (!e)
 			return true;
-		}
+
       keycode = e.which;
   }
 	if (keycode == 13) {
 		if (fButton != '') {
       vspxPost(fButton, fName, fValue, f2Name, f2Value, f3Name, f3Value);
       return false;
-    } else {
-      document.forms[fForm].submit();
     }
+		document.forms[fForm].submit();
   }
   return true;
 }
@@ -284,10 +319,8 @@ function coloriseTable(id) {
     var table = $(id);
 		if (table) {
       var rows = table.getElementsByTagName("tr");
-			for (i = 0; i < rows.length; i++) {
+			for (i = 0; i < rows.length; i++)
 				rows[i].className = rows[i].className + " tr_" + (i % 2);
-				;
-      }
     }
   }
 }
@@ -327,8 +360,7 @@ function sortSelect(box) {
 	});
 
   for (var i=0; i<o.length; i++)
-		box.options[i] = new Option(o[i].text, o[i].value,
-				o[i].defaultSelected, o[i].selected);
+		box.options[i] = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
 }
 
 function showTab(tabs, tabsCount, tabNo) {
@@ -345,9 +377,9 @@ function showTab(tabs, tabsCount, tabNo) {
         OAT.Dom.addClass(l, "activeTab");
         l.blur();
       } else {
-				if (c) {
+				if (c)
           OAT.Dom.hide(c);
-}
+
         OAT.Dom.removeClass(l, "activeTab");
   }
 }
@@ -356,7 +388,7 @@ function showTab(tabs, tabsCount, tabNo) {
 
 function windowShow(sPage, width, height) {
   if (width == null)
-    width = 500;
+		width = 700;
   if (height == null)
     height = 420;
 	sPage = sPage + '&sid=' + document.forms[0].elements['sid'].value
@@ -367,76 +399,73 @@ function windowShow(sPage, width, height) {
 }
 
 function calendarsShow(sPage, width, height) {
-	if ($('ss_type_0').checked) {
+	if ($('ss_type_0').checked)
     sPage = sPage + '&mode=p'
-  }
+
   windowShow(sPage, width, height);
 }
 
 function calendarsHelp(mode) {
   var T = '';
-	if ($('ss_type_0').checked) {
+	if ($('ss_type_0').checked)
     T = 'Select Public';
-  }
-	if ($('ss_type_1').checked) {
+
+	if ($('ss_type_1').checked)
     T = 'Select Shared';
-  }
+
   $('ss_type_button').value = T;
   if (mode)
     $('ss_calendar').value = '';
 }
 
-function rowSelect(obj) {
+function rowSelect(obj)
+{
+  var srcForm = window.document.F1;
+  var dstForm = window.opener.document.F1;
+
+  var s2 = (obj.name).replace('b1', 's2');
+  var s1 = (obj.name).replace('b1', 's1');
+
   var submitMode = false;
-  if (window.document.F1.elements['src'])
-    if (window.document.F1.elements['src'].value.indexOf('s') != -1)
+  if (srcForm.elements['src'] && (srcForm.elements['src'].value.indexOf('s') != -1)) {
       submitMode = true;
-  if (submitMode)
-    if (window.opener.document.F1)
-      if (window.opener.document.F1.elements['submitting'])
+    if (dstForm && dstForm.elements['submitting'])
         return false;
+  }
   var closeMode = true;
-  if (window.document.F1.elements['dst'])
-    if (window.document.F1.elements['dst'].value.indexOf('c') == -1)
-      closeMode = false;
   var singleMode = true;
-  if (window.document.F1.elements['dst'])
-    if (window.document.F1.elements['dst'].value.indexOf('s') == -1)
+  if (srcForm.elements['dst']) {
+    if (srcForm.elements['dst'].value.indexOf('c') == -1)
+      closeMode = false;
+    if (srcForm.elements['dst'].value.indexOf('s') == -1)
       singleMode = false;
-
-  var s2 = (obj.name).replace('b1', 's2');
-  var s1 = (obj.name).replace('b1', 's1');
+  }
 
   var myRe = /^(\w+):(\w+);(.*)?/;
-  var params = window.document.forms['F1'].elements['params'].value;
+  var params = srcForm.elements['params'].value;
   var myArray;
+  if (dstForm) {
 	while (true) {
     myArray = myRe.exec(params);
     if (myArray == undefined)
       break;
-    if (myArray.length > 2)
-      if (window.opener.document.F1)
-				if (window.opener.document.F1.elements[myArray[1]]) {
+      if (myArray.length > 2) {
+        var fld = dstForm.elements[myArray[1]];
+        if (fld) {
           if (myArray[2] == 's1')
-            if (window.opener.document.F1.elements[myArray[1]])
-							rowSelectValue(
-									window.opener.document.F1.elements[myArray[1]],
-									window.document.F1.elements[s1],
-									singleMode, submitMode);
+            rowSelectValue(fld, srcForm.elements[s1], singleMode);
           if (myArray[2] == 's2')
-            if (window.opener.document.F1.elements[myArray[1]])
-							rowSelectValue(
-									window.opener.document.F1.elements[myArray[1]],
-									window.document.F1.elements[s2],
-									singleMode, submitMode);
+            rowSelectValue(fld, srcForm.elements[s2], singleMode);
+        }
         }
     if (myArray.length < 4)
       break;
     params = '' + myArray[3];
   }
+  }
 	if (submitMode) {
     window.opener.createHidden('F1', 'submitting', 'yes');
-    window.opener.document.F1.submit();
+    dstForm.submit();
   }
   if (closeMode)
     window.close();
@@ -544,79 +573,6 @@ function changeExportName(fld_name, from, to) {
     obj.value = (obj.value).replace(from, to);
 }
 
-function updateChecked(obj, objName) {
-  var objForm = obj.form;
-  coloriseRow(getParent(obj, 'tr'), obj.checked);
-  objForm.s1.value = CAL.trim(objForm.s1.value);
-  objForm.s1.value = CAL.trim(objForm.s1.value, ',');
-  objForm.s1.value = CAL.trim(objForm.s1.value);
-  objForm.s1.value = objForm.s1.value + ',';
-	for ( var i = 0; i < objForm.elements.length; i = i + 1) {
-    var obj = objForm.elements[i];
-		if (obj != null && obj.type == "checkbox" && obj.name == objName) {
-			if (obj.checked) {
-				if (objForm.s1.value.indexOf(obj.value + ',') == -1) {
-          objForm.s1.value = objForm.s1.value + obj.value+',';
-        }
-      } else {
-				objForm.s1.value = (objForm.s1.value).replace(obj.value + ',',
-						'');
-      }
-    }
-  }
-  objForm.s1.value = CAL.trim(objForm.s1.value, ',');
-}
-
-function addChecked(form, txt, selectionMsq) {
-  if (!anySelected (form, txt, selectionMsq, 'confirm'))
-    return;
-
-  var submitMode = false;
-  if (window.document.F1.elements['src'])
-    if (window.document.F1.elements['src'].value.indexOf('s') != -1)
-      submitMode = true;
-  if (submitMode)
-    if (window.opener.document.F1)
-      if (window.opener.document.F1.elements['submitting'])
-        return false;
-  var singleMode = true;
-  if (window.document.F1.elements['dst'])
-    if (window.document.F1.elements['dst'].value.indexOf('s') == -1)
-      singleMode = false;
-
-  var s1 = 's1';
-  var s2 = 's2';
-
-  var myRe = /^(\w+):(\w+);(.*)?/;
-  var params = window.document.forms['F1'].elements['params'].value;
-  var myArray;
-	while (true) {
-    myArray = myRe.exec(params);
-    if (myArray == undefined)
-      break;
-    if (myArray.length > 2)
-      if (window.opener.document.F1)
-				if (window.opener.document.F1.elements[myArray[1]]) {
-          if (myArray[2] == 's1')
-						rowSelectValue(
-								window.opener.document.F1.elements[myArray[1]],
-								window.document.F1.elements[s1], singleMode,
-								submitMode);
-          if (myArray[2] == 's2')
-						rowSelectValue(
-								window.opener.document.F1.elements[myArray[1]],
-								window.document.F1.elements[s2], singleMode,
-								submitMode);
-        }
-    if (myArray.length < 4)
-      break;
-    params = '' + myArray[3];
-  }
-  if (submitMode)
-    window.opener.document.F1.submit();
-  window.close();
-}
-
 function addTag(tag, objName) {
   var obj = document.F1.elements[objName];
   obj.value = CAL.trim(obj.value);
@@ -634,6 +590,7 @@ function addTag(tag, objName) {
   obj.value = CAL.trim(obj.value);
   obj.value = CAL.trim(obj.value, ',');
   obj.value = CAL.trim(obj.value);
+	return false;
 }
 
 function addCheckedTags(openerName, checkName) {
@@ -728,11 +685,7 @@ function eAnnotea(event, id, domain_id, account_id) {
 	URL = 'annotea.vspx?sid=' + document.forms[0].sid.value + '&realm='
 			+ document.forms[0].realm.value + '&oid=' + id + '&did='
 			+ domain_id + '&aid=' + account_id;
-	window
-			.open(
-					URL,
-					'addressbook_anotea_window',
-					'top=100, left=100, scrollbars=yes, resize=yes, menubar=no, height=500, width=600');
+	window.open(URL, 'addressbook_anotea_window', 'top=100, left=100, scrollbars=yes, resize=yes, menubar=no, height=500, width=600');
   return false;
 }
 
@@ -755,8 +708,7 @@ function cExchange(command) {
 }
 
 function cCalendar(calendar_id) {
-	vspxPost('command', 'select', 'settings', 'mode', 'sharedUpdate', 'id',
-			calendar_id);
+	vspxPost('command', 'select', 'settings', 'mode', 'sharedUpdate', 'id', calendar_id);
 }
 
 function exchangeHTML() {
@@ -839,14 +791,7 @@ function dismissReminder(prefix, mode) {
         reminders = reminders + "," + o.value;
     }
   }
-	OAT.AJAX.POST("ajax.vsp", "a=alarms&sa=dismiss&reminders=" + reminders
-			+ urlParam("sid") + urlParam("realm"), function() {
-	}, {
-		onstart : function() {
-		},
-		onerror : function() {
-		}
-	});
+	OAT.AJAX.POST("ajax.vsp", "a=alarms&sa=dismiss&reminders="+reminders+urlParam("sid")+urlParam("realm"), function(){}, {onstart : function(){}, onerror : function(){}});
 	reminderDialog.hide ();
 }
 
@@ -885,39 +830,36 @@ function destinationChange(obj, actions) {
     var a = actions.hide;
 		for ( var i = 0; i < a.length; i++) {
       var o = $(a[i])
-			if (o) {
+			if (o)
 				OAT.Dom.hide(o);
 			}
     }
-  }
 	if (actions.show) {
     var a = actions.show;
 		for ( var i = 0; i < a.length; i++) {
       var o = $(a[i])
-			if (o) {
+			if (o)
 				OAT.Dom.show(o);
     }
   }
-	}
 	if (actions.clear) {
     var a = actions.clear;
 		for ( var i = 0; i < a.length; i++) {
       var o = $(a[i])
-			if (o && o.value) {
+			if (o && o.value)
 				o.value = '';
 			}
     }
   }
-}
 
 var CAL = new Object();
 
 CAL.trim = function(sString, sChar) {
 
 	if (sString) {
-		if (sChar == null) {
+		if (sChar == null)
       sChar = ' ';
-    }
+
 		while (sString.substring(0, 1) == sChar) {
       sString = sString.substring(1, sString.length);
     }
@@ -940,20 +882,12 @@ CAL.colorRef = function(fldName) {
                         		
 CAL.aboutDialog = function() {
   var aboutDiv = $('aboutDiv');
-	if (aboutDiv) {
+	if (aboutDiv)
 		OAT.Dom.unlink(aboutDiv);
-	}
-	aboutDiv = OAT.Dom.create('div', {
-		width : '430px',
-		height : '150px'
-	});
+
+	aboutDiv = OAT.Dom.create('div', {width: '430px', height: '150px'});
   aboutDiv.id = 'aboutDiv';
-	aboutDialog = new OAT.Dialog('About ODS Calendar', aboutDiv, {
-		width : 430,
-		buttons : 0,
-		resize : 0,
-		modal : 1
-	});
+	aboutDialog = new OAT.Dialog('About ODS Calendar', aboutDiv, {width: 445, buttons: 0, resize: 0, modal: 1});
 	aboutDialog.cancel = aboutDialog.hide;
 
   var x = function (txt) {
@@ -965,63 +899,5 @@ CAL.aboutDialog = function() {
       }
     }
   }
-	OAT.AJAX.POST("ajax.vsp", "a=about", x, {
-		type : OAT.AJAX.TYPE_TEXT,
-		onstart : function() {
-		},
-		onerror : function() {
-		}
-	});
-}
-
-CAL.validateError = function(fld, msg) {
-  alert(msg);
-	setTimeout(function() {
-		fld.focus();
-	}, 1);
-  return false;
-}
-
-CAL.validateMail = function(fld) {
-  if ((fld.value.length == 0) || (fld.value.length > 40))
-		return CAL.validateError(fld,
-				'E-mail address cannot be empty or longer then 40 chars');
-
-  var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
-  if (!regex.test(fld.value))
-    return CAL.validateError(fld, 'Invalid E-mail address');
-
-  return true;
-}
-
-CAL.validateURL = function(fld) {
-  var regex = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
-  if (!regex.test(fld.value))
-    return CAL.validateError(fld, 'Invalid URL address');
-
-  return true;
-}
-
-CAL.validateField = function(fld) {
-  if ((fld.value.length == 0) && OAT.Dom.isClass(fld, '_canEmpty_'))
-    return true;
-  if (OAT.Dom.isClass(fld, '_mail_'))
-    return CAL.validateMail(fld);
-  if (OAT.Dom.isClass(fld, '_url_'))
-    return CAL.validateURL(fld);
-  return true;
-}
-
-CAL.validateInputs = function(fld) {
-  var retValue = true;
-  var form = fld.form;
-	for (i = 0; i < form.elements.length; i++) {
-    var fld = form.elements[i];
-		if (OAT.Dom.isClass(fld, '_validate_')) {
-      retValue = CAL.validateField(fld);
-      if (!retValue)
-        return retValue;
-    }
-  }
-  return retValue;
+	OAT.AJAX.POST("ajax.vsp", "a=about", x, {type: OAT.AJAX.TYPE_TEXT, onstart: function(){}, onerror: function(){}});
 }
diff --git a/appsrc/ODS-Calendar/www/logs.vspx b/appsrc/ODS-Calendar/www/logs.vspx
index ee5ce40..2d6bb9e 100644
--- a/appsrc/ODS-Calendar/www/logs.vspx
+++ b/appsrc/ODS-Calendar/www/logs.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: logs.vspx,v 1.1 2008/01/21 15:18:43 source Exp $
+ -  $Id: logs.vspx,v 1.1.2.1 2010/09/20 10:15:03 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Calendar/www/message.vspx b/appsrc/ODS-Calendar/www/message.vspx
index 1ff7fbb..e9cb110 100644
--- a/appsrc/ODS-Calendar/www/message.vspx
+++ b/appsrc/ODS-Calendar/www/message.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: message.vspx,v 1.1 2008/04/30 10:41:05 source Exp $
+ -  $Id: message.vspx,v 1.1.2.1 2010/09/20 10:15:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Calendar/www/tags.vspx b/appsrc/ODS-Calendar/www/tags.vspx
index df9ed58..34700f8 100644
--- a/appsrc/ODS-Calendar/www/tags.vspx
+++ b/appsrc/ODS-Calendar/www/tags.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: tags.vspx,v 1.3.2.1 2010/02/10 22:17:03 source Exp $
+ -  $Id: tags.vspx,v 1.3.2.2 2010/09/20 10:15:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Calendar/www/template/popup.vspx b/appsrc/ODS-Calendar/www/template/popup.vspx
index f4e20bb..2d0cac9 100644
--- a/appsrc/ODS-Calendar/www/template/popup.vspx
+++ b/appsrc/ODS-Calendar/www/template/popup.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
-  -  $Id: popup.vspx,v 1.11.2.3 2010/03/12 09:12:05 source Exp $
+  -  $Id: popup.vspx,v 1.11.2.7 2010/11/09 20:19:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -28,25 +28,35 @@
     <link rel="stylesheet" href="css/style.css" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <![CDATA[
-      <script type="text/javascript">
-        var toolkitPath="/ods/oat";
-        var imagePath="/ods/images/oat/";
-
-        var featureList=["combolist", "dav"];
-      </script>
       <script type="text/javascript" src="/ods/oat/loader.js"></script>
-      <script type="text/javascript" src="/ods/tbl.js"></script>
-      <script type="text/javascript" src="js/calendar.js"></script>
       <script type="text/javascript">
-        function myInit()
-        {
           OAT.Preferences.imagePath = '/ods/images/oat/';
+        OAT.Preferences.stylePath = '/ods/oat/styles/';
           OAT.Preferences.showAjax = false;
 
+        // DAV
+        var davOptions = {
+          imagePath: OAT.Preferences.imagePath,
+          pathHome: '/home/',
+          path: '<?V CAL.WA.dav_logical_home (self.account_id) ?>',
+          user: '<?V CAL.WA.account_name (self.account_id) ?>',
+          connectionHeaders: {Authorization: '<?V CAL.WA.account_basicAuthorization (self.account_id) ?>'}
+        };
+
         	/* load stylesheets */
         	OAT.Style.include("grid.css");
         	OAT.Style.include("webdav.css");
+      	OAT.Style.include("winms.css");
 
+        var featureList=["combolist"];
+        OAT.Loader.load(featureList);
+      </script>
+      <script type="text/javascript" src="/ods/tbl.js"></script>
+      <script type="text/javascript" src="js/calendar.js"></script>
+      <script type="text/javascript" src="/ods/users_select.js"></script>
+      <script type="text/javascript">
+        function myInit()
+        {
           // init tabs
           showTab('a', 2, 0);
         }
@@ -61,10 +71,8 @@
       <vm:variables>
         <v:variable persist="0" name="domain_id" type="integer" default="-1"/>
         <v:variable persist="0" name="account_id" type="integer" default="-1"/>
-        <v:variable persist="0" name="accountName" type="varchar" default="'Public User'"/>
         <v:variable persist="0" name="owner_id" type="integer" default="null" />
-        <v:variable persist="0" name="ownerName" type="varchar" default="null" />
-        <v:variable persist="0" name="access_role" type="varchar" default="'public'"/>
+        <v:variable persist="0" name="account_rights" type="varchar" default="''"/>
         <v:variable persist="0" name="settings" type="any" />
         <v:variable persist="0" name="cWeekStarts" type="varchar" default="'m'" />
         <v:variable persist="0" name="cTimeZone" type="integer" default="0" />
@@ -81,11 +89,9 @@
 
           aSessInfo := CAL.WA.session_restore (params);
           self.domain_id := cast(get_keyword('domain_id', aSessInfo, '-1') as integer);
-          self.account_id := cast(get_keyword('user_id', aSessInfo, '-1') as integer);
-          self.accountName := get_keyword('user_name', aSessInfo, '');
+          self.account_id := cast (get_keyword ('account_id', aSessInfo, '-1') as integer);
           self.owner_id := CAL.WA.domain_owner_id (self.domain_id);
-          self.ownerName := CAL.WA.domain_owner_name (self.domain_id);
-          self.access_role := get_keyword ('user_role', aSessInfo, '');
+          self.account_rights := get_keyword ('account_rights', aSessInfo, '');
 
           self.settings := CAL.WA.settings (self.domain_id);
 
diff --git a/appsrc/ODS-Calendar/www/template/template.vspx b/appsrc/ODS-Calendar/www/template/template.vspx
index 6511435..70d902d 100644
--- a/appsrc/ODS-Calendar/www/template/template.vspx
+++ b/appsrc/ODS-Calendar/www/template/template.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: template.vspx,v 1.29.2.9 2010/04/09 14:39:32 source Exp $
+ -  $Id: template.vspx,v 1.29.2.14 2010/11/09 20:19:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -47,16 +47,32 @@
     <meta name="dc.title" content="<?V CAL.WA.utf2wide (CAL.WA.domain_description (self.domain_id)) ?>" />
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
       <![CDATA[
+      <script type="text/javascript" src="/ods/oat/loader.js"></script>
       <script type="text/javascript">
-        // OAT
-        var toolkitPath="/ods/oat";
-        var imagePath = "/ods/images/oat/";
+        OAT.Preferences.imagePath = '/ods/images/oat/';
+        OAT.Preferences.stylePath = '/ods/oat/styles/';
+        OAT.Preferences.showAjax = false;
+
+        // DAV
+        var davOptions = {
+          imagePath: OAT.Preferences.imagePath,
+          pathHome: '/home/',
+          path: '<?V CAL.WA.dav_logical_home (self.account_id) ?>',
+          user: '<?V CAL.WA.account_name (self.account_id) ?>',
+          connectionHeaders: {Authorization: '<?V CAL.WA.account_basicAuthorization (self.account_id) ?>'}
+        };
         
-        var featureList=["ajax", "json", "anchor", "dialog", "dav", "color", "calendar"];
+      	/* load stylesheets */
+      	OAT.Style.include("grid.css");
+      	OAT.Style.include("webdav.css");
+      	OAT.Style.include("winms.css");
+
+        var featureList=["ajax", "json", "anchor", "dialog", "color", "calendar"];
+        OAT.Loader.load(featureList);
     </script>
-      <script type="text/javascript" src="/ods/oat/loader.js"></script>
       <script type="text/javascript" src="/ods/tbl.js"></script>
       <script type="text/javascript" src="/ods/app.js"></script>
+      <script type="text/javascript" src="/ods/validate.js"></script>
       <script type="text/javascript" src="js/calendar.js"></script>
   	<script type="text/javascript">
         // publics
@@ -72,22 +88,6 @@
           CAL.weekStartDay = '<?V self.cWeekStarts ?>';
           CAL.dateFormat = '<?V self.cDateFormat ?>';
 
-          OAT.Preferences.imagePath = '/ods/images/oat/';
-          OAT.Preferences.stylePath = '/ods/oat/styles/';
-
-        	/* load stylesheets */
-        	OAT.Style.include("grid.css");
-        	OAT.Style.include("webdav.css");
-
-          // WebDAV
-          var options = { imagePath: OAT.Preferences.imagePath,
-                          pathHome: '/home/',
-                          path: '<?V CAL.WA.dav_logical_home (self.account_id) ?>',
-                          user: '<?V CAL.WA.account_name (self.account_id) ?>',
-                          connectionHeaders: {Authorization: '<?V CAL.WA.account_basicAuthorization (self.account_id) ?>'}
-                        };
-          OAT.WebDav.init(options);
-
           // <a>++
           OAT.Anchor.imagePath = OAT.Preferences.imagePath;
           OAT.Anchor.zIndex = 1001;
@@ -108,9 +108,9 @@
           }
           	
       		// init tabs
-          showTab('e', 2, 0);
-          showTab('t', 2, 0);
-          showTab('s', 2, 0);
+          showTab('e', 4, 0);
+          showTab('t', 3, 0);
+          showTab('s', 4, 0);
 
           // start reminder
           if (<?V self.owner_id ?> == <?V self.account_id ?>)
@@ -124,46 +124,11 @@
           }
         }
           setFooter();
+          window.onresize = function() {setFooter();}
           OAT.MSG.send(OAT, 'PAGE_LOADED');
         }
-        function getWindowHeight() {
-    			var windowHeight = 0;
-    			if (typeof(window.innerHeight) == 'number')
-    			{
-    				windowHeight = window.innerHeight;
-    			}
-    			else
-    			{
-    				if (document.documentElement && document.documentElement.clientHeight)
-    				{
-    					windowHeight = document.documentElement.clientHeight;
-    				}
-    				else
-    				{
-    					if (document.body && document.body.clientHeight)
-    					{
-    						windowHeight = document.body.clientHeight;
-    					}
-    				}
-    			}
-    			return windowHeight;
-    		}
-        function setFooter() {
-    			if (document.getElementById)
-    			{
-    				var windowHeight = getWindowHeight();
-    				if (windowHeight > 0)
-    				{
-    					var footerElement = document.getElementById('FT');
-    					var footerHeight  = footerElement.offsetHeight;
-    					if (document.getElementById('content'))
-                document.getElementById('content').style.height = (windowHeight - footerHeight - 225) + 'px';
-    				}
-    			}
-    		}
         OAT.MSG.attach(OAT, 'PAGE_LOADED2', myInit);
         window.onload = function(){OAT.MSG.send(OAT, 'PAGE_LOADED2');};
-    		window.onresize = function() {setFooter();}
   	</script>
     ]]>
     <title></title>
@@ -172,10 +137,8 @@
     <v:page xmlns:v="http://www.openlinksw.com/vspx/">
         <v:variable persist="0" name="domain_id" type="integer" default="-1" />
         <v:variable persist="0" name="account_id" type="integer" default="-1" />
-        <v:variable persist="0" name="accountName" type="varchar" default="'Public User'" />
         <v:variable persist="0" name="owner_id" type="integer" default="null" />
-        <v:variable persist="0" name="ownerName" type="varchar" default="null" />
-      <v:variable persist="0" name="access_role" type="varchar" default="'public'" />
+      <v:variable persist="0" name="account_rights" type="varchar" default="''" />
         <v:variable persist="0" name="settings" type="any" />
       <v:variable persist="0" name="cWeekStarts" type="varchar" default="'m'" />
       <v:variable persist="0" name="cTimeZone" type="integer" default="0" />
@@ -193,11 +156,9 @@
 
           aSessInfo := CAL.WA.session_restore (params);
           self.domain_id := cast(get_keyword('domain_id', aSessInfo, '-1') as integer);
-          self.account_id := cast(get_keyword('user_id', aSessInfo, '-1') as integer);
-          self.accountName := get_keyword('user_name', aSessInfo, '');
+          self.account_id := cast (get_keyword ('account_id', aSessInfo, '-1') as integer);
           self.owner_id := CAL.WA.domain_owner_id (self.domain_id);
-          self.ownerName := CAL.WA.domain_owner_name (self.domain_id);
-          self.access_role := get_keyword ('user_role', aSessInfo, '');
+          self.account_rights := get_keyword ('account_rights', aSessInfo);
 
           self.settings := CAL.WA.settings (self.domain_id);
           CAL.WA.settings_init (self.settings);
diff --git a/appsrc/ODS-Calendar/www/template/template.xsl b/appsrc/ODS-Calendar/www/template/template.xsl
index c13c6e3..9d5490f 100644
--- a/appsrc/ODS-Calendar/www/template/template.xsl
+++ b/appsrc/ODS-Calendar/www/template/template.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: template.xsl,v 1.38.2.5 2010/07/09 14:37:01 source Exp $
+ -  $Id: template.xsl,v 1.38.2.10 2010/11/09 20:19:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -110,8 +110,7 @@
     <div style="padding: 0.5em;">
       <xsl:if test="not @close or @close = 'yes'">
       <div style="padding: 0 0 0.5em 0;">
-          &nbsp;<a href="javascript: void (0);" onclick="javascript: if (opener != null) opener.focus(); window.close();"><img src="image/close_16.png" border="0" alt="Close" title="Close" />&nbsp;Close</a>
-        <hr />
+          <span class="button pointer" onclick="javascript: if (opener != null) opener.focus(); window.close();"><img class="button" src="/ods/images/icons/close_16.png" border="0" alt="Close" title="Close" /> Close</span>
       </div>
       </xsl:if>
       <v:form name="F1" type="simple" method="POST">
@@ -152,7 +151,7 @@
       <xsl:copy-of select="."/>
     </xsl:for-each>
     <xsl:apply-templates select="vm:init"/>
-    <v:form name="F1" method="POST" type="simple" action="--CAL.WA.forum_iri(self.domain_id)" xhtml_enctype="multipart/form-data">
+    <v:form name="F1" method="POST" type="simple" action="--CAL.WA.iri_fix (CAL.WA.utf2wide (CAL.WA.forum_iri(self.domain_id)))" xhtml_enctype="multipart/form-data">
       <ods:ods-bar app_type='Calendar'/>
       <div id="app_area" style="clear: right;">
       <div style="background-color: #fff;">
@@ -164,7 +163,7 @@
         <v:template type="simple" enabled="--either(gt(self.domain_id, 0), 1, 0)">
           <div style="float: right; text-align: right; padding-right: 0.5em; padding-top: 20px;">
               <v:text name="keywords" value="--case when (self.cScope = 'search') and (CAL.WA.xml_get ('mode', self.cSearch) <> 'advanced') then CAL.WA.xml_get ('keywords', self.cSearch, '') else '' end" fmt-function="CAL.WA.utf2wide" xhtml_onkeypress="return submitEnter(event, \'F1\', \'command\', \'select\', \'search\', \'mode\', \'simple\');" />
-            <xsl:call-template name="nbsp"/>
+              &nbsp;
               <span onclick="javascript: vspxPost('command', 'select', 'search', 'mode', 'simple');" title="Simple Search" about="Simple Search" class="link">Search</span>
             |
               <span onclick="javascript: vspxPost('command', 'select', 'search', 'mode', 'advanced');" title="Advanced Search" about="Advanced Search" class="link">Advanced</span>
@@ -176,17 +175,21 @@
             <?vsp http (CAL.WA.utf2wide (CAL.WA.banner_links (self.domain_id, self.sid, self.realm))); ?>
           </div>
           <div style="float: right; padding-right: 0.5em;">
-            <v:template type="simple" enabled="--case when (self.access_role in ('public', 'guest')) then 0 else 1 end">
+            <vm:if test="self.account_rights = 'W'">
               <span onclick="javascript: vspxPost('command', 'select', 'settings', 'mode', 'settings');" title="Preferences" about="Preferences" class="link">Preferences</span>
               |
-        </v:template>
+            </vm:if>
             <span onclick="javascript: CAL.aboutDialog(); return false;" title="About" class="link">About</span>
       </div>
           <p style="clear: both; line-height: 0.1em"> </p>
         </div>
       <v:include url="calendar_login.vspx"/>
               <xsl:apply-templates select="vm:pagebody" />
-      <div id="FT">
+        <?vsp
+          declare C any;
+          C := vsp_ua_get_cookie_vec(self.vc_event.ve_lines);
+        ?>
+        <div id="FT" style="display: <?V case when get_keyword ('interface', C, '') = 'js' then 'none' else '' end ?>">
         <div id="FT_L">
           <a href="http://www.openlinksw.com/virtuoso">
             <img alt="Powered by OpenLink Virtuoso Universal Server" src="image/virt_power_no_border.png" border="0" />
@@ -248,12 +251,13 @@
             eventDays := vector ();
             for (select rs.e_start,
                         rs.e_end
-                   from CAL.WA.events_forPeriod (rs0, rs1, rs2, rs3, rs4)(e_id integer, e_event integer, e_subject varchar, e_start datetime, e_end datetime, e_repeat varchar, e_repeat_offset integer, e_reminder integer) rs
+                   from CAL.WA.events_forPeriod (rs0, rs1, rs2, rs3, rs4, rs5)(e_id integer, e_event integer, e_subject varchar, e_start datetime, e_end datetime, e_repeat varchar, e_repeat_offset integer, e_reminder integer) rs
                   where rs0 = self.domain_id
                     and rs1 = self.nCalcDate (0)
                     and rs2 = self.nCalcDate (length (self.cnDays)-1)
                     and rs3 = self.cPrivacy
-                    and rs4 = self.cShowTasks) do
+                    and rs4 = self.cShowTasks
+                    and rs5 = self.account_rights) do
             {
               L := datediff ('day', e_start, e_end);
               for (N := 0; N <= L; N := N + 1)
@@ -346,11 +350,11 @@
         <?vsp
           for (select * from CAL.WA.SHARED where S_DOMAIN_ID = self.domain_id) do
           {
-            if (self.access_role not in ('public', 'guest'))
+            if (self.account_rights = 'W')
             {
-              http (sprintf ('<span onclick="javascript: cCalendar(%d);" class="gems" style="background-color: %s;">%s</span>', S_ID, S_COLOR, CAL.WA.domain_name (S_CALENDAR_ID)));
-            } else {
               http (sprintf ('<div class="gems" style="background-color: %s;">%s</div>', S_COLOR, CAL.WA.domain_name (S_CALENDAR_ID)));
+            } else {
+              http (sprintf ('<span onclick="javascript: cCalendar(%d);" class="gems" style="background-color: %s;">%s</span>', S_ID, S_COLOR, CAL.WA.domain_name (S_CALENDAR_ID)));
             }
           }
         ?>
@@ -360,7 +364,7 @@
 
   <!--=========================================================================-->
   <xsl:template match="vm:exchange">
-    <vm:if test="self.access_role not in ('public', 'guest')">
+    <vm:if test="self.account_rights = 'W'">
     <div class="lc lc_head" onclick="shCell('exchange')">
         <img id="exchange_image" src="image/tr_close.gif" border="0" alt="Open" style="float: left;" />&nbsp;Import/Export
     </div>
@@ -402,7 +406,7 @@
           http ('<div style="border-top: 1px solid #7f94a5;"></div>');
         }
 
-        S := CAL.WA.gems_url (self.domain_id);
+        S := CAL.WA.utf2wide (CAL.WA.gems_url (self.domain_id));
         http (sprintf('<a href="%sCalendar.%s" target="_blank" title="%s export" class="gems"><img src="image/rss-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'rss', 'RSS', 'RSS', 'RSS'));
         http (sprintf('<a href="%sCalendar.%s" target="_blank" title="%s export" class="gems"><img src="image/blue-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'atom', 'ATOM', 'ATOM', 'Atom'));
         http (sprintf('<a href="%sCalendar.%s" target="_blank" title="%s export" class="gems"><img src="image/rdf-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'rdf', 'RDF', 'RDF', 'RDF'));
@@ -590,16 +594,4 @@
     </div>
   </xsl:template>
 
-  <!--=========================================================================-->
-  <xsl:template name="nbsp">
-    <xsl:param name="count" select="1"/>
-    <xsl:if test="$count != 0">
-      <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
-      <xsl:call-template name="nbsp">
-        <xsl:with-param name="count" select="$count - 1"/>
-      </xsl:call-template>
-    </xsl:if>
-  </xsl:template>
-  <!--=========================================================================-->
-
 </xsl:stylesheet>
diff --git a/appsrc/ODS-Calendar/www/users.vspx b/appsrc/ODS-Calendar/www/users.vspx
index 2164296..be67838 100644
--- a/appsrc/ODS-Calendar/www/users.vspx
+++ b/appsrc/ODS-Calendar/www/users.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: users.vspx,v 1.2.2.2 2010/02/10 22:17:03 source Exp $
+ -  $Id: users.vspx,v 1.2.2.4 2010/11/09 20:19:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -61,12 +61,7 @@
 
   <v:method name="isMultiple" arglist="in dst any">
     <![CDATA[
-      declare pos integer;
-
-      pos := strstr(self.v_dst, 'm');
-      if (not isnull(pos))
-        return 1;
-      return 0;
+      return case when isnull (strstr (self.v_dst, 'm')) then 0 else 1 end;
     ]]>
   </v:method>
 
@@ -75,7 +70,9 @@
       if (self.v_mode = 'g')
       {
         self.v_filter := 'g';
-      } else {
+      }
+      else if (self.v_mode = 'u')
+      {
         self.v_filter := 'u';
       }
     ]]>
@@ -101,6 +98,7 @@
     <vm:pagebody>
       <?vsp http(sprintf('<input type="hidden" name="sid"   id="sid"   value="%s"/>', get_keyword('sid', self.vc_page.vc_event.ve_params))); ?>
       <?vsp http(sprintf('<input type="hidden" name="realm" id="realm" value="%s"/>', get_keyword('realm', self.vc_page.vc_event.ve_params))); ?>
+      <?vsp http(sprintf('<input type="hidden" name="form"  id="form"  value="%s"/>', get_keyword('form', self.vc_page.vc_event.ve_params, 'F1'))); ?>
       <?vsp http(sprintf('<input type="hidden" name="src"   id="src"   value="%s"/>', get_keyword('src', self.vc_page.vc_event.ve_params, ''))); ?>
       <?vsp http(sprintf('<input type="hidden" name="dst"   id="dst"   value="%s"/>', get_keyword('dst', self.vc_page.vc_event.ve_params, 'sc'))); ?>
       <?vsp http(sprintf('<input type="hidden" name="s1"    id="s1"    value="%s"/>', get_keyword('s1', self.vc_page.vc_event.ve_params, ''))); ?>
@@ -177,29 +175,22 @@
           <table id="users" class="CAL_grid" cellspacing="0">
             <thead class="sortHeader">
               <tr>
-                <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
+                <vm:if test="self.isMultiple(self.v_dst)">
                   <th class="checkbox" width="1%">
-                    <?vsp
-                      http('<input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, ''cb_item''); updateChecked(this, ''cb_item''); "/>');
-                    ?>
+                    <input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, 'cb_item'); updateChecked(this, 'cb_item'); "/>
                   </th>
-                </v:template>
-                <v:template type="simple" enabled="-- case when (self.v_mode = '') then 1 else 0 end">
+                </vm:if>
+                <vm:if test="self.v_mode = ''">
                   <th>
-                    <v:label value="Type" format="%s"/>
+                    Type
                   </th>
-                </v:template>
+                </vm:if>
                 <th>
                   <?vsp self.sortColumn('Name', 'U_NAME'); ?>
                 </th>
                 <th>
                   <?vsp self.sortColumn('Description', 'U_FULL_NAME'); ?>
                 </th>
-                <v:template type="simple" enabled="--neq(self.isMultiple(self.v_dst), 1)">
-                  <th width="1%">
-                    Action
-                  </th>
-                </v:template>
               </tr>
             </thead>
           </table>
@@ -217,40 +208,31 @@
 
           <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
             <table>
-              <tr>
-                <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
+              <tr onclick="rowSelected(this);" class="pointer">
+                <vm:if test="self.isMultiple(self.v_dst)">
                   <td  align="center">
                     <?vsp
-                      declare pos integer;
                       declare S, name any;
 
-                      name := (control.vc_parent as vspx_row_template).te_column_value('U_NAME');
-                      S := '';
-                      pos := strstr(self.v_s1, concat(name, ','));
-                      if (not isnull(pos))
-                        S := 'checked="checked"';
-                      http (sprintf ('<input type="checkbox" name="cb_item" value="%s" %s onclick="javascript: updateChecked(this, ''cb_item''); " />', name, S));
+                      name := (control as vspx_row_template).te_column_value('U_NAME');
+                      S := case when isnull (strstr(self.v_s1, concat(name, ','))) then '' else 'checked="checked"' end;
+                      http (sprintf ('<input type="checkbox" name="cb_item" value="%s" %s onclick="javascript: updateChecked(this, ''cb_item'', event); " />', name, S));
                     ?>
                   </td>
-                </v:template>
-                <v:template type="simple" enabled="-- case when (self.v_mode = '') then 1 else 0 end">
+                </vm:if>
+                <vm:if test="self.v_mode = ''">
                   <td nowrap="nowrap">
-                    <v:label value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('U_TYPE')" format="%s"/>
+                    <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('U_TYPE')" format="%s"/>
                   </td>
-                </v:template>
+                </vm:if>
                 <td nowrap="nowrap">
+                  <input name="s1_item" type="hidden" value="<?V (control as vspx_row_template).te_column_value('U_NAME') ?>" />
                   <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('U_NAME')" format="%s"/>
                 </td>
                 <td nowrap="nowrap">
+                  <input name="s2_item" type="hidden" value="<?V (control as vspx_row_template).te_column_value('U_FULL_NAME') ?>" />
                   <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('U_FULL_NAME')" format="%s"/>
                 </td>
-                <v:template type="simple" enabled="--neq(self.isMultiple(self.v_dst), 1)">
-                  <td nowrap="nowrap">
-                    <v:text name="s1" type="hidden" value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('U_NAME')"/>
-                    <v:text name="s2" type="hidden" value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('U_FULL_NAME')"/>
-                    <v:button name="b1" action="simple" value="select" xhtml_alt="Select" xhtml_onclick="javascript: rowSelect(this); return false;" xhtml_class="button"/>
-                  </td>
-                </v:template>
               </tr>
             </table>
           </v:template>
@@ -263,12 +245,12 @@
         </v:template>
 
       </v:data-set>
-      <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
+      <vm:if test="self.isMultiple(self.v_dst)">
         <div style="padding: 0 0 0.5em 0;">
           <hr />
           <a href="#" onclick="javascript: addChecked(document.forms['F1'], 'cb_item', 'No users were selected for addition.');" class="button2">&nbsp;Add selected</a>
         </div>
-      </v:template>
+      </vm:if>
       <script>
         <![CDATA[
           coloriseTable('users');
diff --git a/appsrc/ODS-Calendar/xslt/rss2atom.xsl b/appsrc/ODS-Calendar/xslt/rss2atom.xsl
index 9b84425..e998236 100644
--- a/appsrc/ODS-Calendar/xslt/rss2atom.xsl
+++ b/appsrc/ODS-Calendar/xslt/rss2atom.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom.xsl,v 1.2.2.1 2010/05/31 21:59:14 source Exp $
+ -  $Id: rss2atom.xsl,v 1.2.2.2 2010/09/20 10:15:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Calendar/xslt/rss2atom03.xsl b/appsrc/ODS-Calendar/xslt/rss2atom03.xsl
index 22daa75..fff9714 100644
--- a/appsrc/ODS-Calendar/xslt/rss2atom03.xsl
+++ b/appsrc/ODS-Calendar/xslt/rss2atom03.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom03.xsl,v 1.2 2007/05/10 10:46:25 source Exp $
+ -  $Id: rss2atom03.xsl,v 1.2.2.1 2010/09/20 10:15:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Calendar/xslt/rss2rdf.xsl b/appsrc/ODS-Calendar/xslt/rss2rdf.xsl
index f10d493..84757c1 100644
--- a/appsrc/ODS-Calendar/xslt/rss2rdf.xsl
+++ b/appsrc/ODS-Calendar/xslt/rss2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
-  -  $Id: rss2rdf.xsl,v 1.2 2007/05/10 10:46:25 source Exp $
+  -  $Id: rss2rdf.xsl,v 1.2.2.1 2010/09/20 10:15:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Calendar/xslt/rss2xbel.xsl b/appsrc/ODS-Calendar/xslt/rss2xbel.xsl
index 950fe50..d03224d 100644
--- a/appsrc/ODS-Calendar/xslt/rss2xbel.xsl
+++ b/appsrc/ODS-Calendar/xslt/rss2xbel.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -  
-  -  $Id: rss2xbel.xsl,v 1.1 2007/05/07 13:23:31 source Exp $
+  -  $Id: rss2xbel.xsl,v 1.1.2.1 2010/09/20 10:15:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/Makefile.in b/appsrc/ODS-Community/Makefile.in
index 01f6d43..ba2502c 100644
--- a/appsrc/ODS-Community/Makefile.in
+++ b/appsrc/ODS-Community/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-Community/make_vad.sh b/appsrc/ODS-Community/make_vad.sh
index 8a56138..8123297 100755
--- a/appsrc/ODS-Community/make_vad.sh
+++ b/appsrc/ODS-Community/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.14.2.1 2010/01/07 16:57:09 source Exp $
+#  $Id: make_vad.sh,v 1.14.2.3 2011/02/03 10:26:14 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -225,7 +225,7 @@ sticker_init() {
   echo "  <name package=\"Community\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS Community\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
diff --git a/appsrc/ODS-Community/sql/exec_no_error.sql b/appsrc/ODS-Community/sql/exec_no_error.sql
index cde8946..0b0d0e3 100644
--- a/appsrc/ODS-Community/sql/exec_no_error.sql
+++ b/appsrc/ODS-Community/sql/exec_no_error.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: exec_no_error.sql,v 1.3 2006/08/14 14:33:15 source Exp $
+--  $Id: exec_no_error.sql,v 1.3.2.1 2010/09/20 10:15:04 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Community/sql/install.bat b/appsrc/ODS-Community/sql/install.bat
index a1f158a..5e42f94 100644
--- a/appsrc/ODS-Community/sql/install.bat
+++ b/appsrc/ODS-Community/sql/install.bat
@@ -1,6 +1,6 @@
 @echo off
 rem
-rem  $Id: install.bat,v 1.2 2006/05/31 13:13:00 source Exp $
+rem  $Id: install.bat,v 1.2.2.1 2010/09/20 10:15:05 source Exp $
 rem
 rem  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 rem  project.
diff --git a/appsrc/ODS-Community/sql/procedures.sql b/appsrc/ODS-Community/sql/procedures.sql
index 6768c60..8fc1fc6 100644
--- a/appsrc/ODS-Community/sql/procedures.sql
+++ b/appsrc/ODS-Community/sql/procedures.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: procedures.sql,v 1.11 2007/11/08 11:50:02 source Exp $
+--  $Id: procedures.sql,v 1.11.2.1 2010/09/20 10:15:05 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Community/sql/run_install.sql b/appsrc/ODS-Community/sql/run_install.sql
index 57f0e59..227ccfe 100644
--- a/appsrc/ODS-Community/sql/run_install.sql
+++ b/appsrc/ODS-Community/sql/run_install.sql
@@ -1,5 +1,5 @@
 --
---  $Id: run_install.sql,v 1.3 2006/10/26 18:45:52 source Exp $
+--  $Id: run_install.sql,v 1.3.2.1 2010/09/20 10:15:05 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Community/sql/run_uninstall.sql b/appsrc/ODS-Community/sql/run_uninstall.sql
index fa8937c..d1428a8 100644
--- a/appsrc/ODS-Community/sql/run_uninstall.sql
+++ b/appsrc/ODS-Community/sql/run_uninstall.sql
@@ -1,5 +1,5 @@
 --
---  $Id: run_uninstall.sql,v 1.3 2006/10/26 18:45:52 source Exp $
+--  $Id: run_uninstall.sql,v 1.3.2.1 2010/09/20 10:15:05 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Community/sql/sioc_xd.sql b/appsrc/ODS-Community/sql/sioc_xd.sql
index 6b4df41..fc1d0c1 100644
--- a/appsrc/ODS-Community/sql/sioc_xd.sql
+++ b/appsrc/ODS-Community/sql/sioc_xd.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sioc_xd.sql,v 1.7.2.1 2009/11/17 21:37:40 source Exp $
+--  $Id: sioc_xd.sql,v 1.7.2.2 2010/09/20 10:15:05 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Community/sql/tables.sql b/appsrc/ODS-Community/sql/tables.sql
index d8e1244..99847ca 100644
--- a/appsrc/ODS-Community/sql/tables.sql
+++ b/appsrc/ODS-Community/sql/tables.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: tables.sql,v 1.5 2007/02/27 21:19:45 source Exp $
+--  $Id: tables.sql,v 1.5.2.1 2010/09/20 10:15:05 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Community/sql/uninstall.bat b/appsrc/ODS-Community/sql/uninstall.bat
index ca1acce..a6fc51d 100644
--- a/appsrc/ODS-Community/sql/uninstall.bat
+++ b/appsrc/ODS-Community/sql/uninstall.bat
@@ -1,6 +1,6 @@
 @echo off
 rem
-rem  $Id: uninstall.bat,v 1.2 2006/05/31 13:13:00 source Exp $
+rem  $Id: uninstall.bat,v 1.2.2.1 2010/09/20 10:15:05 source Exp $
 rem
 rem  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 rem  project.
diff --git a/appsrc/ODS-Community/sql/wa_install.sql b/appsrc/ODS-Community/sql/wa_install.sql
index f26d63c..57899fa 100644
--- a/appsrc/ODS-Community/sql/wa_install.sql
+++ b/appsrc/ODS-Community/sql/wa_install.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: wa_install.sql,v 1.10 2008/01/30 11:57:04 source Exp $
+--  $Id: wa_install.sql,v 1.10.2.1 2010/09/20 10:15:05 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Community/sql/wa_uninstall.sql b/appsrc/ODS-Community/sql/wa_uninstall.sql
index 8780091..b0c8bb0 100644
--- a/appsrc/ODS-Community/sql/wa_uninstall.sql
+++ b/appsrc/ODS-Community/sql/wa_uninstall.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: wa_uninstall.sql,v 1.3 2006/08/14 14:33:15 source Exp $
+--  $Id: wa_uninstall.sql,v 1.3.2.1 2010/09/20 10:15:05 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Community/www-root/index.vsp b/appsrc/ODS-Community/www-root/index.vsp
index b73d665..ee3fd4b 100644
--- a/appsrc/ODS-Community/www-root/index.vsp
+++ b/appsrc/ODS-Community/www-root/index.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: index.vsp,v 1.4 2006/07/31 15:35:28 source Exp $
+--  $Id: index.vsp,v 1.4.2.1 2010/09/20 10:15:05 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Community/www-root/index.vspx b/appsrc/ODS-Community/www-root/index.vspx
index 678e13f..37dbbc5 100644
--- a/appsrc/ODS-Community/www-root/index.vspx
+++ b/appsrc/ODS-Community/www-root/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: index.vspx,v 1.3.2.1 2010/09/20 10:15:05 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/public/aboutcommunity.html b/appsrc/ODS-Community/www-root/public/aboutcommunity.html
index 5b6b28e..fbb565e 100644
--- a/appsrc/ODS-Community/www-root/public/aboutcommunity.html
+++ b/appsrc/ODS-Community/www-root/public/aboutcommunity.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
  -
- -  $Id: aboutcommunity.html,v 1.2 2006/05/31 13:13:00 source Exp $
+ -  $Id: aboutcommunity.html,v 1.2.2.1 2010/09/20 10:15:05 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/public/css/default.css b/appsrc/ODS-Community/www-root/public/css/default.css
index cbd8e65..252d7f2 100644
--- a/appsrc/ODS-Community/www-root/public/css/default.css
+++ b/appsrc/ODS-Community/www-root/public/css/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.9 2008/01/30 15:29:45 source Exp $
+ *  $Id: default.css,v 1.9.2.1 2010/09/20 10:15:05 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Community/www-root/public/images/lightblue/myopenlink.css b/appsrc/ODS-Community/www-root/public/images/lightblue/myopenlink.css
index 1ac3d07..8e7c733 100644
--- a/appsrc/ODS-Community/www-root/public/images/lightblue/myopenlink.css
+++ b/appsrc/ODS-Community/www-root/public/images/lightblue/myopenlink.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: myopenlink.css,v 1.2 2006/05/31 13:13:00 source Exp $
+ *  $Id: myopenlink.css,v 1.2.2.1 2010/09/20 10:15:05 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Community/www-root/public/js/map_control.js b/appsrc/ODS-Community/www-root/public/js/map_control.js
index b5dbdf9..35a9924 100644
--- a/appsrc/ODS-Community/www-root/public/js/map_control.js
+++ b/appsrc/ODS-Community/www-root/public/js/map_control.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: map_control.js,v 1.3 2006/10/26 18:45:52 source Exp $
+ *  $Id: map_control.js,v 1.3.2.1 2010/09/20 10:15:06 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Community/www-root/templates/openlink/app_inst.vspx b/appsrc/ODS-Community/www-root/templates/openlink/app_inst.vspx
index 2022ebc..431ef30 100644
--- a/appsrc/ODS-Community/www-root/templates/openlink/app_inst.vspx
+++ b/appsrc/ODS-Community/www-root/templates/openlink/app_inst.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: app_inst.vspx,v 1.10 2007/11/08 11:50:02 source Exp $
+ -  $Id: app_inst.vspx,v 1.10.2.1 2010/09/20 10:15:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/templates/openlink/default.css b/appsrc/ODS-Community/www-root/templates/openlink/default.css
index 139eb61..99dac85 100644
--- a/appsrc/ODS-Community/www-root/templates/openlink/default.css
+++ b/appsrc/ODS-Community/www-root/templates/openlink/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.9 2008/01/30 15:29:45 source Exp $
+ *  $Id: default.css,v 1.9.2.1 2010/09/20 10:15:06 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Community/www-root/templates/openlink/errors.vspx b/appsrc/ODS-Community/www-root/templates/openlink/errors.vspx
index 866c007..5ca605f 100644
--- a/appsrc/ODS-Community/www-root/templates/openlink/errors.vspx
+++ b/appsrc/ODS-Community/www-root/templates/openlink/errors.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: errors.vspx,v 1.4 2006/08/16 00:04:13 source Exp $
+ -  $Id: errors.vspx,v 1.4.2.1 2010/09/20 10:15:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/templates/openlink/index.vspx b/appsrc/ODS-Community/www-root/templates/openlink/index.vspx
index a1df97f..c92ed44 100644
--- a/appsrc/ODS-Community/www-root/templates/openlink/index.vspx
+++ b/appsrc/ODS-Community/www-root/templates/openlink/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: index.vspx,v 1.12 2007/07/26 15:04:26 source Exp $
+ -  $Id: index.vspx,v 1.12.2.1 2010/09/20 10:15:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/templates/openlink/login.vspx b/appsrc/ODS-Community/www-root/templates/openlink/login.vspx
index 540bc57..6c1c2b3 100644
--- a/appsrc/ODS-Community/www-root/templates/openlink/login.vspx
+++ b/appsrc/ODS-Community/www-root/templates/openlink/login.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: login.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: login.vspx,v 1.3.2.1 2010/09/20 10:15:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/templates/openlink/logout.vspx b/appsrc/ODS-Community/www-root/templates/openlink/logout.vspx
index b364b5f..2b35468 100644
--- a/appsrc/ODS-Community/www-root/templates/openlink/logout.vspx
+++ b/appsrc/ODS-Community/www-root/templates/openlink/logout.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: logout.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
+ -  $Id: logout.vspx,v 1.3.2.1 2010/09/20 10:15:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/templates/openlink/settings.vspx b/appsrc/ODS-Community/www-root/templates/openlink/settings.vspx
index 3370cf9..d9a840a 100644
--- a/appsrc/ODS-Community/www-root/templates/openlink/settings.vspx
+++ b/appsrc/ODS-Community/www-root/templates/openlink/settings.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: settings.vspx,v 1.6 2006/10/20 15:47:02 source Exp $
+ -  $Id: settings.vspx,v 1.6.2.1 2010/09/20 10:15:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/templates/openlink/settings_app.vspx b/appsrc/ODS-Community/www-root/templates/openlink/settings_app.vspx
index 65fb944..239edf1 100644
--- a/appsrc/ODS-Community/www-root/templates/openlink/settings_app.vspx
+++ b/appsrc/ODS-Community/www-root/templates/openlink/settings_app.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: settings_app.vspx,v 1.9 2008/02/19 11:05:09 source Exp $
+ -  $Id: settings_app.vspx,v 1.9.2.1 2010/09/20 10:15:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/templates/openlink/wa_maps.vspx b/appsrc/ODS-Community/www-root/templates/openlink/wa_maps.vspx
index 21ffe18..0d0c232 100644
--- a/appsrc/ODS-Community/www-root/templates/openlink/wa_maps.vspx
+++ b/appsrc/ODS-Community/www-root/templates/openlink/wa_maps.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: wa_maps.vspx,v 1.9 2007/02/27 21:19:45 source Exp $
+ -  $Id: wa_maps.vspx,v 1.9.2.1 2010/09/20 10:15:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/widgets/app_inst_menu.xsl b/appsrc/ODS-Community/www-root/widgets/app_inst_menu.xsl
index b071f4e..def1810 100644
--- a/appsrc/ODS-Community/www-root/widgets/app_inst_menu.xsl
+++ b/appsrc/ODS-Community/www-root/widgets/app_inst_menu.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: app_inst_menu.xsl,v 1.4 2007/05/04 15:17:00 source Exp $
+ -  $Id: app_inst_menu.xsl,v 1.4.2.1 2010/09/20 10:15:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/widgets/apply_custom_settings.xsl b/appsrc/ODS-Community/www-root/widgets/apply_custom_settings.xsl
index 2951afa..dbd3151 100644
--- a/appsrc/ODS-Community/www-root/widgets/apply_custom_settings.xsl
+++ b/appsrc/ODS-Community/www-root/widgets/apply_custom_settings.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: apply_custom_settings.xsl,v 1.1 2006/10/17 11:18:44 source Exp $
+ -  $Id: apply_custom_settings.xsl,v 1.1.2.1 2010/09/20 10:15:07 source Exp $
  -  
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/widgets/dashboard.xsl b/appsrc/ODS-Community/www-root/widgets/dashboard.xsl
index d55abae..b03b548 100644
--- a/appsrc/ODS-Community/www-root/widgets/dashboard.xsl
+++ b/appsrc/ODS-Community/www-root/widgets/dashboard.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: dashboard.xsl,v 1.7 2007/11/13 22:14:33 source Exp $
+ -  $Id: dashboard.xsl,v 1.7.2.1 2010/09/20 10:15:07 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/widgets/error.xsl b/appsrc/ODS-Community/www-root/widgets/error.xsl
index eb7d8c7..aeec633 100644
--- a/appsrc/ODS-Community/www-root/widgets/error.xsl
+++ b/appsrc/ODS-Community/www-root/widgets/error.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: error.xsl,v 1.4 2007/11/08 11:50:02 source Exp $
+ -  $Id: error.xsl,v 1.4.2.1 2010/09/20 10:15:07 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/widgets/main.xsl b/appsrc/ODS-Community/www-root/widgets/main.xsl
index 53fdfa1..f2b8808 100644
--- a/appsrc/ODS-Community/www-root/widgets/main.xsl
+++ b/appsrc/ODS-Community/www-root/widgets/main.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: main.xsl,v 1.21.2.1 2010/01/25 16:09:29 source Exp $
+ -  $Id: main.xsl,v 1.21.2.2 2010/09/20 10:15:07 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/widgets/map_control.xsl b/appsrc/ODS-Community/www-root/widgets/map_control.xsl
index fed34fa..a9edb25 100644
--- a/appsrc/ODS-Community/www-root/widgets/map_control.xsl
+++ b/appsrc/ODS-Community/www-root/widgets/map_control.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: map_control.xsl,v 1.5 2007/05/04 15:17:00 source Exp $
+ -  $Id: map_control.xsl,v 1.5.2.1 2010/09/20 10:15:07 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Community/www-root/widgets/template_check.xsl b/appsrc/ODS-Community/www-root/widgets/template_check.xsl
index 0db3f50..9223985 100644
--- a/appsrc/ODS-Community/www-root/widgets/template_check.xsl
+++ b/appsrc/ODS-Community/www-root/widgets/template_check.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: template_check.xsl,v 1.2 2006/05/31 13:13:01 source Exp $
+ -  $Id: template_check.xsl,v 1.2.2.1 2010/09/20 10:15:07 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/DET_nntp.sql b/appsrc/ODS-Discussion/DET_nntp.sql
index 85f0f5b..0fea09b 100644
--- a/appsrc/ODS-Discussion/DET_nntp.sql
+++ b/appsrc/ODS-Discussion/DET_nntp.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: DET_nntp.sql,v 1.1 2007/11/26 10:34:18 source Exp $
+--  $Id: DET_nntp.sql,v 1.1.2.1 2010/09/20 10:15:07 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/Makefile.in b/appsrc/ODS-Discussion/Makefile.in
index ff3c737..ea9e243 100644
--- a/appsrc/ODS-Discussion/Makefile.in
+++ b/appsrc/ODS-Discussion/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-Discussion/attachment.vsp b/appsrc/ODS-Discussion/attachment.vsp
index 27f0eb3..d18476c 100644
--- a/appsrc/ODS-Discussion/attachment.vsp
+++ b/appsrc/ODS-Discussion/attachment.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: attachment.vsp,v 1.2 2006/07/31 15:35:28 source Exp $
+--  $Id: attachment.vsp,v 1.2.2.1 2010/09/20 10:15:07 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/comp/adv_srh.xsl b/appsrc/ODS-Discussion/comp/adv_srh.xsl
index 291a3ba..d0fd5bd 100644
--- a/appsrc/ODS-Discussion/comp/adv_srh.xsl
+++ b/appsrc/ODS-Discussion/comp/adv_srh.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: adv_srh.xsl,v 1.5 2007/04/04 07:38:15 source Exp $
+ -  $Id: adv_srh.xsl,v 1.5.2.1 2010/09/20 10:15:11 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/attach.xsl b/appsrc/ODS-Discussion/comp/attach.xsl
index ad38fec..bb83562 100644
--- a/appsrc/ODS-Discussion/comp/attach.xsl
+++ b/appsrc/ODS-Discussion/comp/attach.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: attach.xsl,v 1.6 2008/02/19 11:06:15 source Exp $
+ -  $Id: attach.xsl,v 1.6.2.1 2010/09/20 10:15:11 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/common.xsl b/appsrc/ODS-Discussion/comp/common.xsl
index 366d073..efe9f68 100644
--- a/appsrc/ODS-Discussion/comp/common.xsl
+++ b/appsrc/ODS-Discussion/comp/common.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: common.xsl,v 1.2 2007/02/27 21:19:45 source Exp $
+ -  $Id: common.xsl,v 1.2.2.1 2010/09/20 10:15:11 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/dialog.xsl b/appsrc/ODS-Discussion/comp/dialog.xsl
index 134365a..91bc3bb 100644
--- a/appsrc/ODS-Discussion/comp/dialog.xsl
+++ b/appsrc/ODS-Discussion/comp/dialog.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: dialog.xsl,v 1.1 2006/06/01 10:50:29 source Exp $
+ -  $Id: dialog.xsl,v 1.1.2.1 2010/09/20 10:15:11 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/group_list.xsl b/appsrc/ODS-Discussion/comp/group_list.xsl
index 9dcc509..ef96c7b 100644
--- a/appsrc/ODS-Discussion/comp/group_list.xsl
+++ b/appsrc/ODS-Discussion/comp/group_list.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: group_list.xsl,v 1.13.2.1 2010/03/16 10:26:11 source Exp $
+ -  $Id: group_list.xsl,v 1.13.2.3 2010/09/20 10:15:11 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -58,7 +58,7 @@
         ]]>
       </v:before-data-bind>
 
-      View All: <v:url name="view_mode" value="--(case when self.force_list<>1 then 'Unthread' else 'Thread' end)" url="--'nntpf_main.vspx?view='||(case when self.force_list<>1 then 'list' else 'thread' end)" />
+      View All: <v:url name="view_mode" value="--(case when self.force_list<>1 then 'Unthread' else 'Thread' end)" url="--'/dataspace/discussion/nntpf_main.vspx?view='||(case when self.force_list<>1 then 'list' else 'thread' end)" />
        <br/>
       <table width="100%"
              class="nntp_groups_listing"
@@ -120,7 +120,7 @@
                   <v:url name="nntp_groups"
                          format="%s"
                          value="--(control.vc_parent as vspx_row_template).te_rowset[1]"
-                         url="--'nntpf_nthread_view.vspx?group=' ||
+                         url="--'/dataspace/discussion/nntpf_nthread_view.vspx?group=' ||
                                 cast ((control.vc_parent as vspx_row_template).te_rowset[0] as varchar)"
                          xhtml_class="nntp_group"/>
                 </td>
@@ -128,7 +128,7 @@
                   <v:url name="nntp_groups1"
                          format="%s"
                          value="--(control.vc_parent as vspx_row_template).te_rowset[2]"
-                         url="--'nntpf_nthread_view.vspx?group=' ||
+                         url="--'/dataspace/discussion/nntpf_nthread_view.vspx?group=' ||
                                 cast ((control.vc_parent as vspx_row_template).te_rowset[0] as varchar)"
                          xhtml_class="nntp_group"/>
                 </td>
@@ -136,19 +136,18 @@
                   <v:url name="nntp_groups2"
                          format="%s"
                          value="--'List'"
-                         url="--'nntpf_nthread_view.vspx?group=' ||
+                         url="--'/dataspace/discussion/nntpf_nthread_view.vspx?group=' ||
                               cast ((control.vc_parent as vspx_row_template).te_rowset[0] as varchar)"/> |
                   <v:url name="nntp_groups3"
                          format="%s"
                          value="--'Thread'"
-                         url="--'nntpf_thread_view.vspx?group=' ||
+                         url="--'/dataspace/discussion/nntpf_thread_view.vspx?group=' ||
                               cast ((control.vc_parent as vspx_row_template).te_rowset[0] as varchar) ||
                               '&thr=1'"/>
                 </td>
                 <td align="left">
                   <v:url value="RSS"
-                       url="--concat ('nntpf_rss_group.vspx?group=' ||
-                                      cast ((control.vc_parent as vspx_row_template).te_rowset[0] as varchar))"
+                       url="--concat ('/dataspace/discussion/nntpf_rss_group.vspx?group=' || cast ((control.vc_parent as vspx_row_template).te_rowset[0] as varchar))"
                        enabled="--self.vc_authenticated"
                        xhtml_class="nntp_group_rss"/>
                 </td>
@@ -395,7 +394,7 @@
                   <v:url name="ods_groups"
                          format="%s"
                          value="--(control.vc_parent as vspx_row_template).te_rowset[1]"
-                         url="--'nntpf_nthread_view.vspx?group=' ||
+                         url="--'/dataspace/discussion/nntpf_nthread_view.vspx?group=' ||
                                 cast ((control.vc_parent as vspx_row_template).te_rowset[0] as varchar)"
                          xhtml_class="nntp_group"/>
                 </td>
@@ -403,7 +402,7 @@
                   <v:url name="ods_groups1"
                          format="%s"
                          value="--(control.vc_parent as vspx_row_template).te_rowset[2]"
-                         url="--'nntpf_nthread_view.vspx?group=' ||
+                         url="--'/dataspace/discussion/nntpf_nthread_view.vspx?group=' ||
                                 cast ((control.vc_parent as vspx_row_template).te_rowset[0] as varchar)"
                          xhtml_class="nntp_group"/>
                 </td>
@@ -549,7 +548,7 @@
                   <v:url name="nntp_groups"
                          format="%s"
                          value="--(control.vc_parent as vspx_row_template).te_rowset[1]"
-                         url="--'nntpf_nthread_view.vspx?group=' ||
+                         url="--'/dataspace/discussion/nntpf_nthread_view.vspx?group=' ||
                                 cast ((control.vc_parent as vspx_row_template).te_rowset[0] as varchar)"
                          xhtml_class="nntp_group"/>
                 </td>
@@ -557,7 +556,7 @@
                   <v:url name="nntp_groups1"
                          format="%s"
                          value="--(control.vc_parent as vspx_row_template).te_rowset[2]"
-                         url="--'nntpf_nthread_view.vspx?group=' ||
+                         url="--'/dataspace/discussion/nntpf_nthread_view.vspx?group=' ||
                                 cast ((control.vc_parent as vspx_row_template).te_rowset[0] as varchar)"
                          xhtml_class="nntp_group"/>
                 </td>
@@ -704,7 +703,7 @@
                   <v:url name="ods_allgroups"
                          format="%s"
                          value="--(control.vc_parent as vspx_row_template).te_rowset[1]"
-                         url="--'nntpf_nthread_view.vspx?group=' ||
+                         url="--'/dataspace/discussion/nntpf_nthread_view.vspx?group=' ||
                                 cast ((control.vc_parent as vspx_row_template).te_rowset[0] as varchar)"
                          xhtml_class="nntp_group"/>
                 </td>
@@ -712,7 +711,7 @@
                   <v:url name="ods_allgroups1"
                          format="%s"
                          value="--(control.vc_parent as vspx_row_template).te_rowset[2]"
-                         url="--'nntpf_nthread_view.vspx?group=' ||
+                         url="--'/dataspace/discussion/nntpf_nthread_view.vspx?group=' ||
                                 cast ((control.vc_parent as vspx_row_template).te_rowset[0] as varchar)"
                          xhtml_class="nntp_group"/>
                 </td>
diff --git a/appsrc/ODS-Discussion/comp/group_view.xsl b/appsrc/ODS-Discussion/comp/group_view.xsl
index bd5a1bc..72d6acb 100644
--- a/appsrc/ODS-Discussion/comp/group_view.xsl
+++ b/appsrc/ODS-Discussion/comp/group_view.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: group_view.xsl,v 1.9.2.2 2010/03/16 10:26:11 source Exp $
+ -  $Id: group_view.xsl,v 1.9.2.4 2010/09/20 10:15:11 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -226,8 +226,8 @@
           | enable
           <v:url value="--'Thread view'"
                  format="%s"
-		 url="--'nntpf_thread_view.vspx?group='||self.grp_sel_no_thr || '&thr=1'" /> |
-	  <v:url value="Subscribe" format="%s" url="--sprintf ('nntpf_subs_group.vspx?group=%s', self.grp_sel_no_thr)" />
+		             url="--'/dataspace/discussion/nntpf_thread_view.vspx?group='||self.grp_sel_no_thr || '&thr=1'" /> |
+	        <v:url value="Subscribe" format="%s" url="--sprintf ('/dataspace/discussion/nntpf_subs_group.vspx?group=%s', self.grp_sel_no_thr)" />
           <br/>
         </p>
         <table width="100%" class="news_summary_encapsul" cellspacing="0" cellpadding="0">
@@ -388,7 +388,7 @@ if(self.ds_list_message.ds_data_source.ds_total_pages >= self.ds_list_message.ds
       <table>
 	  <tr>
 	      <td>
-		  <v:url value="Subscribe to the thread" format="%s" url="--sprintf ('nntpf_subs_group.vspx?group=%s&id=%U', self.grp_sel_thr, self.cur_art)" />
+       		   <v:url value="Subscribe to the thread" format="%s" url="--sprintf ('/dataspace/discussion/nntpf_subs_group.vspx?group=%s&id=%U', self.grp_sel_thr, self.cur_art)" />
 		  <br />
       <?vsp
       nntpf_display_article ((id), NULL, self.sid);
diff --git a/appsrc/ODS-Discussion/comp/login.xsl b/appsrc/ODS-Discussion/comp/login.xsl
index 36af694..17c631e 100644
--- a/appsrc/ODS-Discussion/comp/login.xsl
+++ b/appsrc/ODS-Discussion/comp/login.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: login.xsl,v 1.3 2006/10/17 13:55:54 source Exp $
+ -  $Id: login.xsl,v 1.3.2.1 2010/09/20 10:15:11 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/menubar.xsl b/appsrc/ODS-Discussion/comp/menubar.xsl
index dfef248..04726d7 100644
--- a/appsrc/ODS-Discussion/comp/menubar.xsl
+++ b/appsrc/ODS-Discussion/comp/menubar.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: menubar.xsl,v 1.10 2008/02/19 11:06:15 source Exp $
+ -  $Id: menubar.xsl,v 1.10.2.2 2010/09/20 10:15:11 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -33,16 +33,16 @@
     <table class="menubar">
       <tr>
         <td class="menuitem">
-          <v:url value="Home" format="%s" url="nntpf_main.vspx" />
+          <v:url value="Home" format="%s" url="/dataspace/discussion/nntpf_main.vspx" />
         </td>
         <v:template type="simple" condition="nntpf_posts_enabled()">
           <td class="menuitem">
-            <v:url value="Post" url="nntpf_post.vspx" />
+            <v:url value="Post" url="/dataspace/discussion/nntpf_post.vspx" />
           </td>
         </v:template>
         <v:template type="simple" condition="self.vc_authenticated">
           <td class="menuitem">
-            <v:url value="My RSS" format="%s" url="nntpf_edit_rss.vspx" />
+            <v:url value="My RSS" format="%s" url="/dataspace/discussion/nntpf_edit_rss.vspx" />
           </td>
           <td class="menuitem">
             <v:url value="Subscriptions" format="%s" url="nntpf_subs.vspx" />
@@ -50,7 +50,7 @@
           <td><!-- necessary to stretch the table --> </td>
             <td>
               <v:url value="Settings" format="%s"
-                     url="nntpf_odsnewsgroups_admin.vspx"
+                     url="/dataspace/discussion/nntpf_odsnewsgroups_admin.vspx"
                      enabled='--nntpf_check_is_dav_admin (self.u_name, self.u_full_name)' />
             </td>
           </v:template>
@@ -67,24 +67,24 @@
     <table class="menubar" style="border: 1px solid">
       <tr>
         <td class="menuitem">
-          <v:url value="--'Home'" format="%s" url="--'nntpf_main.vspx'" />
+          <v:url value="--'Home'" format="%s" url="/dataspace/discussion/nntpf_main.vspx" />
         </td>
         <v:template type="simple" condition="nntpf_posts_enabled()">
           <td class="menuitem">
-            <v:url value="Post" url="--'nntpf_post.vspx'" />
+            <v:url value="Post" url="/dataspace/discussion/nntpf_post.vspx" />
           </td>
         </v:template>
         <v:template type="simple" condition="self.vc_authenticated">
           <td class="menuitem">
-            <v:url value="--'My RSS'" format="%s" url="--'nntpf_edit_rss.vspx'" />
+            <v:url value="--'My RSS'" format="%s" url="/dataspace/discussion/nntpf_edit_rss.vspx" />
           </td>
           <td class="menuitem">
-            <v:url value="Subscriptions" format="%s" url="nntpf_subs.vspx" />
+            <v:url value="Subscriptions" format="%s" url="/dataspace/discussion/nntpf_subs.vspx" />
           </td>
           <td><!-- necessary to stretch the table --></td>
           <td>
               <v:url value="Settings" format="%s"
-                     url="nntpf_odsnewsgroups_admin.vspx"
+                     url="/dataspace/discussion/nntpf_odsnewsgroups_admin.vspx"
                      enabled='--nntpf_check_is_dav_admin (self.u_name, self.u_full_name)' />
           </td>
 
diff --git a/appsrc/ODS-Discussion/comp/nntp_cal.xsl b/appsrc/ODS-Discussion/comp/nntp_cal.xsl
index b482731..dab3a4a 100644
--- a/appsrc/ODS-Discussion/comp/nntp_cal.xsl
+++ b/appsrc/ODS-Discussion/comp/nntp_cal.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntp_cal.xsl,v 1.6.2.2 2010/03/12 09:14:46 source Exp $
+ -  $Id: nntp_cal.xsl,v 1.6.2.3 2010/09/20 10:15:12 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/nntpf_tags.xsl b/appsrc/ODS-Discussion/comp/nntpf_tags.xsl
index e40bd7c..33321ba 100644
--- a/appsrc/ODS-Discussion/comp/nntpf_tags.xsl
+++ b/appsrc/ODS-Discussion/comp/nntpf_tags.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -  
- -  $Id: nntpf_tags.xsl,v 1.5.2.3 2010/03/12 09:14:46 source Exp $
+ -  $Id: nntpf_tags.xsl,v 1.5.2.4 2010/09/20 10:15:12 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/page.xsl b/appsrc/ODS-Discussion/comp/page.xsl
index 2e56876..141afe0 100644
--- a/appsrc/ODS-Discussion/comp/page.xsl
+++ b/appsrc/ODS-Discussion/comp/page.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: page.xsl,v 1.16.2.1 2010/03/16 10:26:11 source Exp $
+ -  $Id: page.xsl,v 1.16.2.2 2010/09/20 10:15:12 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/post.xsl b/appsrc/ODS-Discussion/comp/post.xsl
index 59810df..59064ee 100644
--- a/appsrc/ODS-Discussion/comp/post.xsl
+++ b/appsrc/ODS-Discussion/comp/post.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: post.xsl,v 1.14.2.1 2010/03/16 10:26:11 source Exp $
+ -  $Id: post.xsl,v 1.14.2.2 2010/09/20 10:15:12 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/register.xsl b/appsrc/ODS-Discussion/comp/register.xsl
index 0ac30c1..1b35200 100644
--- a/appsrc/ODS-Discussion/comp/register.xsl
+++ b/appsrc/ODS-Discussion/comp/register.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: register.xsl,v 1.4 2008/02/19 11:06:15 source Exp $
+ -  $Id: register.xsl,v 1.4.2.1 2010/09/20 10:15:12 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/rss_del.xsl b/appsrc/ODS-Discussion/comp/rss_del.xsl
index a0d3b58..dccc2f7 100644
--- a/appsrc/ODS-Discussion/comp/rss_del.xsl
+++ b/appsrc/ODS-Discussion/comp/rss_del.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss_del.xsl,v 1.1 2006/06/01 10:50:29 source Exp $
+ -  $Id: rss_del.xsl,v 1.1.2.1 2010/09/20 10:15:12 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/rss_group.xsl b/appsrc/ODS-Discussion/comp/rss_group.xsl
index 745aeff..d59d3c0 100644
--- a/appsrc/ODS-Discussion/comp/rss_group.xsl
+++ b/appsrc/ODS-Discussion/comp/rss_group.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss_group.xsl,v 1.2 2007/05/04 15:18:05 source Exp $
+ -  $Id: rss_group.xsl,v 1.2.2.1 2010/09/20 10:15:12 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/rss_list.xsl b/appsrc/ODS-Discussion/comp/rss_list.xsl
index 8c4e360..1644e23 100644
--- a/appsrc/ODS-Discussion/comp/rss_list.xsl
+++ b/appsrc/ODS-Discussion/comp/rss_list.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss_list.xsl,v 1.2 2007/05/04 15:18:05 source Exp $
+ -  $Id: rss_list.xsl,v 1.2.2.1 2010/09/20 10:15:12 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/search.xsl b/appsrc/ODS-Discussion/comp/search.xsl
index 97430d8..c14508c 100644
--- a/appsrc/ODS-Discussion/comp/search.xsl
+++ b/appsrc/ODS-Discussion/comp/search.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: search.xsl,v 1.6 2007/05/15 12:05:53 source Exp $
+ -  $Id: search.xsl,v 1.6.2.1 2010/09/20 10:15:12 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/search_res.xsl b/appsrc/ODS-Discussion/comp/search_res.xsl
index 450d244..3db1460 100644
--- a/appsrc/ODS-Discussion/comp/search_res.xsl
+++ b/appsrc/ODS-Discussion/comp/search_res.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: search_res.xsl,v 1.9 2007/05/04 15:18:05 source Exp $
+ -  $Id: search_res.xsl,v 1.9.2.1 2010/09/20 10:15:13 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/settings.xsl b/appsrc/ODS-Discussion/comp/settings.xsl
index 3fd8e20..2f52f5a 100644
--- a/appsrc/ODS-Discussion/comp/settings.xsl
+++ b/appsrc/ODS-Discussion/comp/settings.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: settings.xsl,v 1.2 2006/08/08 13:18:50 source Exp $
+ -  $Id: settings.xsl,v 1.2.2.1 2010/09/20 10:15:13 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/thread_view.xsl b/appsrc/ODS-Discussion/comp/thread_view.xsl
index b16bcc4..917dcfc 100644
--- a/appsrc/ODS-Discussion/comp/thread_view.xsl
+++ b/appsrc/ODS-Discussion/comp/thread_view.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: thread_view.xsl,v 1.4 2007/07/26 15:09:19 source Exp $
+ -  $Id: thread_view.xsl,v 1.4.2.1 2010/09/20 10:15:13 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/comp/title.xsl b/appsrc/ODS-Discussion/comp/title.xsl
index f874d35..e4f8169 100644
--- a/appsrc/ODS-Discussion/comp/title.xsl
+++ b/appsrc/ODS-Discussion/comp/title.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: title.xsl,v 1.3 2006/10/21 10:20:51 source Exp $
+ -  $Id: title.xsl,v 1.3.2.1 2010/09/20 10:15:13 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/drop.sql b/appsrc/ODS-Discussion/drop.sql
index d5d35c7..f834746 100644
--- a/appsrc/ODS-Discussion/drop.sql
+++ b/appsrc/ODS-Discussion/drop.sql
@@ -1,5 +1,5 @@
 --
---  $Id: drop.sql,v 1.3 2008/09/10 11:18:29 source Exp $
+--  $Id: drop.sql,v 1.3.2.1 2010/09/20 10:15:07 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/login.vspx b/appsrc/ODS-Discussion/login.vspx
index 449de7f..7ecf541 100644
--- a/appsrc/ODS-Discussion/login.vspx
+++ b/appsrc/ODS-Discussion/login.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: login.vspx,v 1.3 2007/04/06 13:52:02 source Exp $
+ -  $Id: login.vspx,v 1.3.2.1 2010/09/20 10:15:07 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/mail_notify.sql b/appsrc/ODS-Discussion/mail_notify.sql
index d06f9a5..2bf9031 100644
--- a/appsrc/ODS-Discussion/mail_notify.sql
+++ b/appsrc/ODS-Discussion/mail_notify.sql
@@ -1,5 +1,5 @@
 --
---  $Id: mail_notify.sql,v 1.1 2006/06/01 10:50:29 source Exp $
+--  $Id: mail_notify.sql,v 1.1.2.1 2010/09/20 10:15:07 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/main.xsl b/appsrc/ODS-Discussion/main.xsl
index a8a9be0..dd0eed6 100644
--- a/appsrc/ODS-Discussion/main.xsl
+++ b/appsrc/ODS-Discussion/main.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: main.xsl,v 1.3.2.1 2009/06/16 19:56:16 source Exp $
+ -  $Id: main.xsl,v 1.3.2.2 2010/09/20 10:15:08 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/make_vad.sh b/appsrc/ODS-Discussion/make_vad.sh
index 6ce8abe..874b6e2 100755
--- a/appsrc/ODS-Discussion/make_vad.sh
+++ b/appsrc/ODS-Discussion/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.23.2.2 2010/03/16 10:26:11 source Exp $
+#  $Id: make_vad.sh,v 1.23.2.5 2011/02/03 10:26:14 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -239,7 +239,7 @@ sticker_init() {
   echo "  <name package=\"Discussion\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS Discussion\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
@@ -251,8 +251,8 @@ sticker_init() {
   echo "<dependencies>" >> $STICKER
   echo "  <require>" >> $STICKER
   echo "    <name package=\"Framework\"/>" >> $STICKER
-  echo "    <versions_later package=\"1.67.12\">" >> $STICKER
-  echo "      <prop name=\"Date\" value=\"2010-03-29 12:00\" />" >> $STICKER
+  echo "    <versions_later package=\"1.73.26\">" >> $STICKER
+  echo "      <prop name=\"Date\" value=\"2010-07-15 12:00\" />" >> $STICKER
   echo "      <prop name=\"Comment\" value=\"An incompatible version of the ODS Framework\" />" >> $STICKER
   echo "    </versions_later>" >> $STICKER
   echo "  </require>" >> $STICKER
diff --git a/appsrc/ODS-Discussion/nntpf.css b/appsrc/ODS-Discussion/nntpf.css
index 740d9fb..bd67a4f 100644
--- a/appsrc/ODS-Discussion/nntpf.css
+++ b/appsrc/ODS-Discussion/nntpf.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: nntpf.css,v 1.9.2.1 2009/06/16 19:56:16 source Exp $
+ *  $Id: nntpf.css,v 1.9.2.2 2010/09/20 10:15:08 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Discussion/nntpf_addtorss.vspx b/appsrc/ODS-Discussion/nntpf_addtorss.vspx
index 66810e2..f520a4c 100644
--- a/appsrc/ODS-Discussion/nntpf_addtorss.vspx
+++ b/appsrc/ODS-Discussion/nntpf_addtorss.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_addtorss.vspx,v 1.5 2007/04/06 13:52:02 source Exp $
+ -  $Id: nntpf_addtorss.vspx,v 1.5.2.2 2010/09/20 10:15:08 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,6 +32,7 @@
 	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html>
     <head>
+      <base href="<?V WA_GET_PROTOCOL() || WA_GET_HOST () || http_path () ?>" />
       <v:include url="virtuoso_app_links.xhtml"/>
       <link rel="stylesheet" type="text/css" href="nntpf.css"/>
       <title>ODS Discussion</title>
diff --git a/appsrc/ODS-Discussion/nntpf_adv_search.vspx b/appsrc/ODS-Discussion/nntpf_adv_search.vspx
index 7d4ffe1..b7f7cc0 100644
--- a/appsrc/ODS-Discussion/nntpf_adv_search.vspx
+++ b/appsrc/ODS-Discussion/nntpf_adv_search.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_adv_search.vspx,v 1.3 2007/04/06 13:52:02 source Exp $
+ -  $Id: nntpf_adv_search.vspx,v 1.3.2.2 2010/09/20 10:15:08 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,6 +32,7 @@
 	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html>
     <head>
+      <base href="<?V WA_GET_PROTOCOL() || WA_GET_HOST () || http_path () ?>" />
       <v:include url="virtuoso_app_links.xhtml"/>
       <link rel="stylesheet" type="text/css" href="nntpf.css"/>
       <title>ODS Discussion</title>
diff --git a/appsrc/ODS-Discussion/nntpf_api.sql b/appsrc/ODS-Discussion/nntpf_api.sql
index 83f9056..94e0550 100644
--- a/appsrc/ODS-Discussion/nntpf_api.sql
+++ b/appsrc/ODS-Discussion/nntpf_api.sql
@@ -1,5 +1,5 @@
 --
---  $Id: nntpf_api.sql,v 1.4.2.2 2009/12/08 23:25:22 source Exp $
+--  $Id: nntpf_api.sql,v 1.4.2.3 2010/09/20 10:15:08 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/nntpf_browser.vspx b/appsrc/ODS-Discussion/nntpf_browser.vspx
index 1870794..7f9940b 100644
--- a/appsrc/ODS-Discussion/nntpf_browser.vspx
+++ b/appsrc/ODS-Discussion/nntpf_browser.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_browser.vspx,v 1.2 2006/08/14 14:33:15 source Exp $
+ -  $Id: nntpf_browser.vspx,v 1.2.2.1 2010/09/20 10:15:08 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/nntpf_ddl.sql b/appsrc/ODS-Discussion/nntpf_ddl.sql
index 35bb72d..daeaf47 100644
--- a/appsrc/ODS-Discussion/nntpf_ddl.sql
+++ b/appsrc/ODS-Discussion/nntpf_ddl.sql
@@ -1,5 +1,5 @@
 --
---  $Id: nntpf_ddl.sql,v 1.3 2007/03/22 14:45:07 source Exp $
+--  $Id: nntpf_ddl.sql,v 1.3.2.1 2010/09/20 10:15:08 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/nntpf_disp_article.vspx b/appsrc/ODS-Discussion/nntpf_disp_article.vspx
index 14f3dcc..5ee5e56 100644
--- a/appsrc/ODS-Discussion/nntpf_disp_article.vspx
+++ b/appsrc/ODS-Discussion/nntpf_disp_article.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_disp_article.vspx,v 1.7 2009/02/25 23:58:27 source Exp $
+ -  $Id: nntpf_disp_article.vspx,v 1.7.2.1 2010/09/20 10:15:08 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/nntpf_edit_rss.vspx b/appsrc/ODS-Discussion/nntpf_edit_rss.vspx
index 839b00a..9c8cc8a 100644
--- a/appsrc/ODS-Discussion/nntpf_edit_rss.vspx
+++ b/appsrc/ODS-Discussion/nntpf_edit_rss.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_edit_rss.vspx,v 1.5 2009/02/25 23:58:27 source Exp $
+ -  $Id: nntpf_edit_rss.vspx,v 1.5.2.1 2010/09/20 10:15:08 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/nntpf_error.vsp b/appsrc/ODS-Discussion/nntpf_error.vsp
index 0ef87cd..eb7e694 100644
--- a/appsrc/ODS-Discussion/nntpf_error.vsp
+++ b/appsrc/ODS-Discussion/nntpf_error.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: nntpf_error.vsp,v 1.3 2007/03/29 08:48:00 source Exp $
+--  $Id: nntpf_error.vsp,v 1.3.2.1 2010/09/20 10:15:08 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/nntpf_error.vspx b/appsrc/ODS-Discussion/nntpf_error.vspx
index a844c0f..7256f6e 100644
--- a/appsrc/ODS-Discussion/nntpf_error.vspx
+++ b/appsrc/ODS-Discussion/nntpf_error.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: nntpf_error.vspx,v 1.2 2007/05/22 12:03:52 source Exp $
+ -  $Id: nntpf_error.vspx,v 1.2.2.1 2010/09/20 10:15:08 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -25,7 +25,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_error.vspx,v 1.2 2007/05/22 12:03:52 source Exp $
+ -  $Id: nntpf_error.vspx,v 1.2.2.1 2010/09/20 10:15:08 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/nntpf_logout.vspx b/appsrc/ODS-Discussion/nntpf_logout.vspx
index e42eacf..c34505e 100644
--- a/appsrc/ODS-Discussion/nntpf_logout.vspx
+++ b/appsrc/ODS-Discussion/nntpf_logout.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_logout.vspx,v 1.3 2007/04/06 13:52:02 source Exp $
+ -  $Id: nntpf_logout.vspx,v 1.3.2.1 2010/09/20 10:15:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/nntpf_main.vspx b/appsrc/ODS-Discussion/nntpf_main.vspx
index 1ccde57..f1fc9b0 100644
--- a/appsrc/ODS-Discussion/nntpf_main.vspx
+++ b/appsrc/ODS-Discussion/nntpf_main.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_main.vspx,v 1.9 2009/02/25 23:58:27 source Exp $
+ -  $Id: nntpf_main.vspx,v 1.9.2.1 2010/09/20 10:15:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/nntpf_nthread_view.vspx b/appsrc/ODS-Discussion/nntpf_nthread_view.vspx
index 701a3f6..2ef3904 100644
--- a/appsrc/ODS-Discussion/nntpf_nthread_view.vspx
+++ b/appsrc/ODS-Discussion/nntpf_nthread_view.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_nthread_view.vspx,v 1.7 2009/02/25 23:58:27 source Exp $
+ -  $Id: nntpf_nthread_view.vspx,v 1.7.2.1 2010/09/20 10:15:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/nntpf_odsnewsgroups_admin.vspx b/appsrc/ODS-Discussion/nntpf_odsnewsgroups_admin.vspx
index 674dc48..df80eee 100644
--- a/appsrc/ODS-Discussion/nntpf_odsnewsgroups_admin.vspx
+++ b/appsrc/ODS-Discussion/nntpf_odsnewsgroups_admin.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_odsnewsgroups_admin.vspx,v 1.8 2007/07/26 15:09:19 source Exp $
+ -  $Id: nntpf_odsnewsgroups_admin.vspx,v 1.8.2.2 2010/09/20 10:15:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,6 +32,7 @@
 	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html>
     <head>
+      <base href="<?V WA_GET_PROTOCOL() || WA_GET_HOST () || http_path () ?>" />
       <v:include url="virtuoso_app_links.xhtml"/>
       <link rel="stylesheet" type="text/css" href="nntpf.css" />
       <title>ODS Discussion</title>
@@ -81,14 +82,14 @@
                    <table width="100%" cellspacing="0" cellpadding="0" border="0" >
                    <tr class="navtab_row">
                     <td class="<?V case when self.page = 1 then 'navtab_sel' else 'navtab' end ?>" align="center" nowrap="1">
-                           <v:url name="b_tab1" value="Newsgroups" format="%s" url="--sprintf('nntpf_odsnewsgroups_admin.vspx?page=1')"/>
+                           <v:url name="b_tab1" value="Newsgroups" format="%s" url="--sprintf('/dataspace/discussion/nntpf_odsnewsgroups_admin.vspx?page=1')"/>
 
                     </td>
                      <td class="<?V case when self.page = 2 then 'navtab_sel' else 'navtab' end ?>" align="center" nowrap="1">
-                        <v:url name="b_tab2" value="Notification" format="%s" url="--sprintf('nntpf_odsnewsgroups_admin.vspx?page=2')"/>
+                        <v:url name="b_tab2" value="Notification" format="%s" url="--sprintf('/dataspace/discussion/nntpf_odsnewsgroups_admin.vspx?page=2')"/>
                       </td>
                      <td class="<?V case when self.page = 3 then 'navtab_sel' else 'navtab' end ?>" align="center" nowrap="1">
-                        <v:url name="b_tab3" value="Posts Settings" format="%s" url="--sprintf('nntpf_odsnewsgroups_admin.vspx?page=3')"/>
+                        <v:url name="b_tab3" value="Posts Settings" format="%s" url="--sprintf('/dataspace/discussion/nntpf_odsnewsgroups_admin.vspx?page=3')"/>
                       </td>
 
                     <td width="100%" class="page_tab_empty"></td>
diff --git a/appsrc/ODS-Discussion/nntpf_post.vspx b/appsrc/ODS-Discussion/nntpf_post.vspx
index 0a7c161..a5c321b 100644
--- a/appsrc/ODS-Discussion/nntpf_post.vspx
+++ b/appsrc/ODS-Discussion/nntpf_post.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_post.vspx,v 1.8 2009/02/25 23:58:27 source Exp $
+ -  $Id: nntpf_post.vspx,v 1.8.2.1 2010/09/20 10:15:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/nntpf_preferences.vspx b/appsrc/ODS-Discussion/nntpf_preferences.vspx
index 209109d..ac608df 100644
--- a/appsrc/ODS-Discussion/nntpf_preferences.vspx
+++ b/appsrc/ODS-Discussion/nntpf_preferences.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_preferences.vspx,v 1.4 2007/04/06 13:52:02 source Exp $
+ -  $Id: nntpf_preferences.vspx,v 1.4.2.1 2010/09/20 10:15:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/nntpf_rss_del.vspx b/appsrc/ODS-Discussion/nntpf_rss_del.vspx
index 079ce38..a64d186 100644
--- a/appsrc/ODS-Discussion/nntpf_rss_del.vspx
+++ b/appsrc/ODS-Discussion/nntpf_rss_del.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_rss_del.vspx,v 1.3 2007/04/06 13:52:02 source Exp $
+ -  $Id: nntpf_rss_del.vspx,v 1.3.2.2 2010/09/20 10:15:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,6 +32,7 @@
 	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html>
     <head>
+      <base href="<?V WA_GET_PROTOCOL() || WA_GET_HOST () || http_path () ?>" />
       <link rel="stylesheet" type="text/css" href="nntpf.css"/>
       <v:include url="virtuoso_app_links.xhtml"/>
       <title>ODS Discussion</title>
diff --git a/appsrc/ODS-Discussion/nntpf_rss_group.vspx b/appsrc/ODS-Discussion/nntpf_rss_group.vspx
index cdd4c4e..0dd8fc3 100644
--- a/appsrc/ODS-Discussion/nntpf_rss_group.vspx
+++ b/appsrc/ODS-Discussion/nntpf_rss_group.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_rss_group.vspx,v 1.3 2007/04/06 13:52:02 source Exp $
+ -  $Id: nntpf_rss_group.vspx,v 1.3.2.2 2010/09/20 10:15:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,6 +32,7 @@
 	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html>
     <head>
+      <base href="<?V WA_GET_PROTOCOL() || WA_GET_HOST () || http_path () ?>" />
       <link rel="alternate" 
             type="application/rss+xml" 
             title="Virtuoso Screencast Demos" 
diff --git a/appsrc/ODS-Discussion/nntpf_rss_list.vspx b/appsrc/ODS-Discussion/nntpf_rss_list.vspx
index 8a272db..57697df 100644
--- a/appsrc/ODS-Discussion/nntpf_rss_list.vspx
+++ b/appsrc/ODS-Discussion/nntpf_rss_list.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_rss_list.vspx,v 1.3 2007/04/06 13:52:02 source Exp $
+ -  $Id: nntpf_rss_list.vspx,v 1.3.2.2 2010/09/20 10:15:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,6 +32,7 @@
 	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html>
     <head>
+      <base href="<?V WA_GET_PROTOCOL() || WA_GET_HOST () || http_path () ?>" />
       <link rel="stylesheet" type="text/css" href="nntpf.css"/>
       <v:include url="virtuoso_app_links.xhtml"/>
       <title>ODS Discussion</title>
diff --git a/appsrc/ODS-Discussion/nntpf_subs.vspx b/appsrc/ODS-Discussion/nntpf_subs.vspx
index 83fee84..10536e4 100644
--- a/appsrc/ODS-Discussion/nntpf_subs.vspx
+++ b/appsrc/ODS-Discussion/nntpf_subs.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_subs.vspx,v 1.7 2009/02/25 23:58:27 source Exp $
+ -  $Id: nntpf_subs.vspx,v 1.7.2.1 2010/09/20 10:15:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/nntpf_subs_edit.vspx b/appsrc/ODS-Discussion/nntpf_subs_edit.vspx
index 8667f3f..9b8a16f 100644
--- a/appsrc/ODS-Discussion/nntpf_subs_edit.vspx
+++ b/appsrc/ODS-Discussion/nntpf_subs_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_subs_edit.vspx,v 1.5 2008/02/19 11:06:15 source Exp $
+ -  $Id: nntpf_subs_edit.vspx,v 1.5.2.2 2010/09/20 10:15:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -39,6 +39,7 @@
 	<v:variable name="sub_e_mail" type="varchar" default="null" persist="temp" />
   <html>
     <head>
+      <base href="<?V WA_GET_PROTOCOL() || WA_GET_HOST () || http_path () ?>" />
       <v:include url="virtuoso_app_links.xhtml"/>
       <link rel="stylesheet" type="text/css" href="nntpf.css"/>
       <title>ODS Discussion</title>
diff --git a/appsrc/ODS-Discussion/nntpf_subs_group.vspx b/appsrc/ODS-Discussion/nntpf_subs_group.vspx
index 298dd12..8e4d70d 100644
--- a/appsrc/ODS-Discussion/nntpf_subs_group.vspx
+++ b/appsrc/ODS-Discussion/nntpf_subs_group.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_subs_group.vspx,v 1.3 2007/04/06 13:52:02 source Exp $
+ -  $Id: nntpf_subs_group.vspx,v 1.3.2.2 2010/09/20 10:15:09 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -55,6 +55,7 @@
 	    ]]></v:on-init>
   <html>
     <head>
+      <base href="<?V WA_GET_PROTOCOL() || WA_GET_HOST () || http_path () ?>" />
       <v:include url="virtuoso_app_links.xhtml"/>
       <link rel="stylesheet" type="text/css" href="nntpf.css"/>
       <title>ODS Discussion</title>
diff --git a/appsrc/ODS-Discussion/nntpf_subs_remove.vspx b/appsrc/ODS-Discussion/nntpf_subs_remove.vspx
index 3c1da37..9836c10 100644
--- a/appsrc/ODS-Discussion/nntpf_subs_remove.vspx
+++ b/appsrc/ODS-Discussion/nntpf_subs_remove.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_subs_remove.vspx,v 1.4 2007/05/04 15:18:05 source Exp $
+ -  $Id: nntpf_subs_remove.vspx,v 1.4.2.1 2010/09/20 10:15:10 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/nntpf_tags.sql b/appsrc/ODS-Discussion/nntpf_tags.sql
index ca79780..10251aa 100644
--- a/appsrc/ODS-Discussion/nntpf_tags.sql
+++ b/appsrc/ODS-Discussion/nntpf_tags.sql
@@ -1,5 +1,5 @@
 --
---  $Id: nntpf_tags.sql,v 1.2.2.1 2009/06/16 19:56:16 source Exp $
+--  $Id: nntpf_tags.sql,v 1.2.2.2 2010/09/20 10:15:10 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/nntpf_thread_view.vspx b/appsrc/ODS-Discussion/nntpf_thread_view.vspx
index c1b3fb7..9c1c801 100644
--- a/appsrc/ODS-Discussion/nntpf_thread_view.vspx
+++ b/appsrc/ODS-Discussion/nntpf_thread_view.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_thread_view.vspx,v 1.4 2007/05/04 15:18:05 source Exp $
+ -  $Id: nntpf_thread_view.vspx,v 1.4.2.2 2010/09/20 10:15:10 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,6 +32,7 @@
 	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html>
     <head>
+      <base href="<?V WA_GET_PROTOCOL() || WA_GET_HOST () || http_path () ?>" />
       <v:include url="virtuoso_app_links.xhtml"/>
       <link rel="stylesheet" type="text/css" href="nntpf.css"/>
       <title>ODS Discussion</title>
diff --git a/appsrc/ODS-Discussion/nntpf_warning.vsp b/appsrc/ODS-Discussion/nntpf_warning.vsp
index 95a6ee1..935ad7e 100644
--- a/appsrc/ODS-Discussion/nntpf_warning.vsp
+++ b/appsrc/ODS-Discussion/nntpf_warning.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: nntpf_warning.vsp,v 1.2.2.1 2009/06/16 19:56:16 source Exp $
+--  $Id: nntpf_warning.vsp,v 1.2.2.2 2010/09/20 10:15:10 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/nntpf_yacutia.vspx b/appsrc/ODS-Discussion/nntpf_yacutia.vspx
index 50b0c2e..fe9f930 100644
--- a/appsrc/ODS-Discussion/nntpf_yacutia.vspx
+++ b/appsrc/ODS-Discussion/nntpf_yacutia.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: nntpf_yacutia.vspx,v 1.4 2007/04/06 13:52:02 source Exp $
+ -  $Id: nntpf_yacutia.vspx,v 1.4.2.2 2010/09/20 10:15:10 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,6 +32,7 @@
 	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html>
     <head>
+      <base href="<?V WA_GET_PROTOCOL() || WA_GET_HOST () || http_path () ?>" />
       <link rel="alternate" 
             type="application/rss+xml" 
             title="Virtuoso Screencast Demos" 
diff --git a/appsrc/ODS-Discussion/openid_helper.vsp b/appsrc/ODS-Discussion/openid_helper.vsp
index 6aa8a1e..b10e92c 100644
--- a/appsrc/ODS-Discussion/openid_helper.vsp
+++ b/appsrc/ODS-Discussion/openid_helper.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --  
---  $Id: openid_helper.vsp,v 1.2 2008/02/19 11:06:15 source Exp $
+--  $Id: openid_helper.vsp,v 1.2.2.1 2010/09/20 10:15:10 source Exp $
 --  
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/register.vspx b/appsrc/ODS-Discussion/register.vspx
index 03c86b0..b1e4d01 100644
--- a/appsrc/ODS-Discussion/register.vspx
+++ b/appsrc/ODS-Discussion/register.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: register.vspx,v 1.3 2007/04/06 13:52:02 source Exp $
+ -  $Id: register.vspx,v 1.3.2.1 2010/09/20 10:15:10 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/rss.vsp b/appsrc/ODS-Discussion/rss.vsp
index 2b7a132..24e1078 100644
--- a/appsrc/ODS-Discussion/rss.vsp
+++ b/appsrc/ODS-Discussion/rss.vsp
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="<?= current_charset () ?>"?>
 <?vsp
 --
---  $Id: rss.vsp,v 1.3 2006/08/14 14:33:15 source Exp $
+--  $Id: rss.vsp,v 1.3.2.1 2010/09/20 10:15:10 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/rsscomments.vsp b/appsrc/ODS-Discussion/rsscomments.vsp
index b2bb23d..2a23fb9 100644
--- a/appsrc/ODS-Discussion/rsscomments.vsp
+++ b/appsrc/ODS-Discussion/rsscomments.vsp
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="<?= current_charset () ?>"?>
 <?vsp
 --
---  $Id: rsscomments.vsp,v 1.3 2006/08/14 14:33:15 source Exp $
+--  $Id: rsscomments.vsp,v 1.3.2.1 2010/09/20 10:15:10 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/setup.sql b/appsrc/ODS-Discussion/setup.sql
index 121a979..6df545e 100644
--- a/appsrc/ODS-Discussion/setup.sql
+++ b/appsrc/ODS-Discussion/setup.sql
@@ -1,5 +1,5 @@
 --
---  $Id: setup.sql,v 1.27 2008/11/19 12:24:04 source Exp $
+--  $Id: setup.sql,v 1.27.2.1 2010/09/20 10:15:10 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/sioc_nntp.sql b/appsrc/ODS-Discussion/sioc_nntp.sql
index e792305..f32ea32 100644
--- a/appsrc/ODS-Discussion/sioc_nntp.sql
+++ b/appsrc/ODS-Discussion/sioc_nntp.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sioc_nntp.sql,v 1.14.2.2 2009/11/17 21:37:40 source Exp $
+--  $Id: sioc_nntp.sql,v 1.14.2.3 2010/09/20 10:15:10 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/vad_version b/appsrc/ODS-Discussion/vad_version
index b207b75..a0903c6 100644
--- a/appsrc/ODS-Discussion/vad_version
+++ b/appsrc/ODS-Discussion/vad_version
@@ -1 +1 @@
-1.10.55
+1.10.70
diff --git a/appsrc/ODS-Discussion/virtuoso_app_links.xhtml b/appsrc/ODS-Discussion/virtuoso_app_links.xhtml
index d964d2f..8cfeafd 100644
--- a/appsrc/ODS-Discussion/virtuoso_app_links.xhtml
+++ b/appsrc/ODS-Discussion/virtuoso_app_links.xhtml
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: virtuoso_app_links.xhtml,v 1.1 2006/06/01 10:50:29 source Exp $
+ -  $Id: virtuoso_app_links.xhtml,v 1.1.2.1 2010/09/20 10:15:11 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Discussion/wa_install.sql b/appsrc/ODS-Discussion/wa_install.sql
index 1e9f4e4..35911d9 100644
--- a/appsrc/ODS-Discussion/wa_install.sql
+++ b/appsrc/ODS-Discussion/wa_install.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: wa_install.sql,v 1.4.2.1 2009/06/16 19:56:16 source Exp $
+--  $Id: wa_install.sql,v 1.4.2.2 2010/09/20 10:15:11 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Discussion/webdav.css b/appsrc/ODS-Discussion/webdav.css
index de6ad0e..a5fd354 100644
--- a/appsrc/ODS-Discussion/webdav.css
+++ b/appsrc/ODS-Discussion/webdav.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: webdav.css,v 1.2 2007/05/30 11:37:36 source Exp $
+ *  $Id: webdav.css,v 1.2.2.1 2010/09/20 10:15:11 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
diff --git a/appsrc/ODS-FeedManager/Makefile.in b/appsrc/ODS-FeedManager/Makefile.in
index c16c349..51abc9f 100644
--- a/appsrc/ODS-FeedManager/Makefile.in
+++ b/appsrc/ODS-FeedManager/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-FeedManager/make_vad.sh b/appsrc/ODS-FeedManager/make_vad.sh
index 84f9a0f..8af3046 100755
--- a/appsrc/ODS-FeedManager/make_vad.sh
+++ b/appsrc/ODS-FeedManager/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.44.2.16 2010/07/09 14:37:01 source Exp $
+#  $Id: make_vad.sh,v 1.44.2.25 2011/03/23 12:19:24 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -30,7 +30,7 @@ export LANG LC_ALL
 
 MODE=$1
 LOGDIR=`pwd`
-VERSION="1.8.169"
+VERSION="1.8.176"
 LOGFILE="${LOGDIR}/vad_make.log"
 STICKER_DAV="vad_dav.xml"
 STICKER_FS="vad_filesystem.xml"
@@ -225,7 +225,7 @@ sticker_init() {
   echo "  <name package=\"Feed Manager\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS Feed Manager\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
@@ -237,8 +237,8 @@ sticker_init() {
   echo "<dependencies>" >> $STICKER
   echo "  <require>" >> $STICKER
   echo "    <name package=\"Framework\"/>" >> $STICKER
-  echo "    <versions_later package=\"1.73.21\">" >> $STICKER
-  echo "      <prop name=\"Date\" value=\"2010-07-08 12:00\" />" >> $STICKER
+  echo "    <versions_later package=\"1.76.62\">" >> $STICKER
+  echo "      <prop name=\"Date\" value=\"2010-09-27 12:00\" />" >> $STICKER
   echo "      <prop name=\"Comment\" value=\"An incompatible version of the ODS Framework\" />" >> $STICKER
   echo "    </versions_later>" >> $STICKER
   echo "  </require>" >> $STICKER
diff --git a/appsrc/ODS-FeedManager/sql/DET_News3.sql b/appsrc/ODS-FeedManager/sql/DET_News3.sql
index 6b04dc4..a00f403 100644
--- a/appsrc/ODS-FeedManager/sql/DET_News3.sql
+++ b/appsrc/ODS-FeedManager/sql/DET_News3.sql
@@ -1,5 +1,5 @@
 --
---  $Id: DET_News3.sql,v 1.4 2006/10/26 19:20:48 source Exp $
+--  $Id: DET_News3.sql,v 1.4.2.1 2010/09/20 10:15:13 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-FeedManager/sql/nws-a-api.sql b/appsrc/ODS-FeedManager/sql/nws-a-api.sql
index 9d3c37d..76b0ef8 100644
--- a/appsrc/ODS-FeedManager/sql/nws-a-api.sql
+++ b/appsrc/ODS-FeedManager/sql/nws-a-api.sql
@@ -6,7 +6,7 @@
 
 
 --
---  $Id: nws-a-api.sql,v 1.7.2.2 2009/12/08 23:25:22 source Exp $
+--  $Id: nws-a-api.sql,v 1.7.2.3 2010/09/20 10:15:13 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-FeedManager/sql/nws-a-code.sql b/appsrc/ODS-FeedManager/sql/nws-a-code.sql
index 6ac195b..d0563ff 100644
--- a/appsrc/ODS-FeedManager/sql/nws-a-code.sql
+++ b/appsrc/ODS-FeedManager/sql/nws-a-code.sql
@@ -1,5 +1,5 @@
 --
---  $Id: nws-a-code.sql,v 1.44.2.17 2010/07/09 14:37:01 source Exp $
+--  $Id: nws-a-code.sql,v 1.44.2.27 2011/03/23 12:19:24 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -19,6 +19,67 @@
 --  with this program; if not, write to the Free Software Foundation, Inc.,
 --  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 --
+
+-------------------------------------------------------------------------------
+--
+-- ACL Functions
+--
+-------------------------------------------------------------------------------
+create procedure ENEWS.WA.acl_condition (
+  in domain_id integer,
+  in id integer := null)
+{
+  if (not is_https_ctx ())
+    return 0;
+
+  if (exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_ACL is not null))
+    return 1;
+
+  --if (exists (select 1 from ENEWS.WA.PERSONS where P_ID = id and P_ACL is not null))
+  --  return 1;
+
+  return 0;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure ENEWS.WA.acl_check (
+  in domain_id integer,
+  in id integer := null)
+{
+  declare rc varchar;
+  declare graph_iri, groups_iri, acl_iris any;
+
+  rc := '';
+  if (ENEWS.WA.acl_condition (domain_id, id))
+  {
+    acl_iris := vector (ENEWS.WA.forum_iri (domain_id));
+    if (not isnull (id))
+      acl_iris := vector (SIOC..feed_iri (id), ENEWS.WA.forum_iri (domain_id));
+
+    graph_iri := ENEWS.WA.acl_graph (domain_id);
+    groups_iri := SIOC..acl_groups_graph (ENEWS.WA.domain_owner_id (domain_id));
+    rc := SIOC..acl_check (graph_iri, groups_iri, acl_iris);
+  }
+  return rc;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure ENEWS.WA.acl_list (
+  in domain_id integer)
+{
+  declare graph_iri, groups_iri, iri any;
+
+  iri := ENEWS.WA.forum_iri (domain_id);
+  graph_iri := ENEWS.WA.acl_graph (domain_id);
+  groups_iri := SIOC..acl_groups_graph (ENEWS.WA.domain_owner_id (domain_id));
+  return SIOC..acl_list (graph_iri, groups_iri, iri);
+}
+;
+
 -------------------------------------------------------------------------------
 --
 -- Session Functions
@@ -28,23 +89,29 @@ create procedure ENEWS.WA.session_domain (
   inout params any)
 {
   declare aPath, domain_id, options any;
-
   declare exit handler for sqlstate '*'
   {
-    domain_id := -1;
+    domain_id := -2;
     goto _end;
   };
 
   options := http_map_get('options');
   if (not is_empty_or_null (options))
+  {
     domain_id := get_keyword ('domain', options);
+  }
   if (is_empty_or_null (domain_id))
   {
     aPath := split_and_decode (trim (http_path (), '/'), 0, '\0\0/');
+    if ((length (aPath) = 1) or ((length (aPath) = 2) and (aPath[1] like '%.vsp%')))
+    {
+      domain_id := -1;
+      goto _end;
+    }
     domain_id := cast(aPath[1] as integer);
   }
-  if (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id))
-    domain_id := -1;
+  if (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_TYPE_NAME = 'eNews2'))
+    domain_id := -2;
 
 _end:;
   return cast (domain_id as integer);
@@ -56,61 +123,27 @@ _end:;
 create procedure ENEWS.WA.session_restore(
   inout params any)
 {
-  declare aPath, domain_id, user_id, user_name, user_role, sid, realm, options any;
+  declare domain_id, account_id, account_rights any;
 
-  declare exit handler for sqlstate '*', not found {
-    domain_id := -2;
-    goto _end;
-  };
-
-  sid := get_keyword('sid', params, '');
-  realm := get_keyword('realm', params, 'wa');
-
-  options := http_map_get('options');
-  if (not is_empty_or_null(options))
-    domain_id := get_keyword('domain', options);
-  if (is_empty_or_null (domain_id)) {
-    aPath := split_and_decode (trim (http_path (), '/'), 0, '\0\0/');
-    domain_id := cast(aPath[1] as integer);
-  }
-  if (not exists(select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and domain_id <> -2))
-    domain_id := -1;
+  domain_id := ENEWS.WA.session_domain (params);
+  account_id := http_nobody_uid ();
 
-_end:
-  domain_id := cast(domain_id as integer);
-  user_id := -1;
-  for (select U_ID,
-              U_NAME,
-              U_FULL_NAME
-         from DB.DBA.VSPX_SESSION,
-              WS.WS.SYS_DAV_USER
-        where VS_REALM = realm
-          and VS_SID   = sid
-          and VS_UID   = U_NAME) do
+  for (select U.U_ID,
+              U.U_NAME,
+              U.U_FULL_NAME
+         from DB.DBA.VSPX_SESSION S,
+              WS.WS.SYS_DAV_USER U
+        where S.VS_REALM = get_keyword ('realm', params, 'wa')
+          and S.VS_SID   = get_keyword ('sid', params, '')
+          and S.VS_UID   = U.U_NAME) do
   {
-    user_id   := U_ID;
-    user_name := ENEWS.WA.user_name(U_NAME, U_FULL_NAME);
-    user_role := ENEWS.WA.access_role(domain_id, U_ID);
-  }
-  if ((user_id = -1) and (domain_id >= 0) and (not exists(select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_IS_PUBLIC = 1)))
-    domain_id := -1;
-
-  if (user_id = -1)
-    if (domain_id = -1) {
-      user_role := 'expire';
-      user_name := 'Expire session';
-    } else if (domain_id = -2) {
-    user_role := 'public';
-    user_name := 'Public User';
-    } else {
-      user_role := 'guest';
-      user_name := 'Guest User';
+    account_id := U_ID;
   }
-
-  return vector('domain_id', domain_id,
-                'user_id',   user_id,
-                'user_name', user_name,
-                'user_role', user_role
+  account_rights := ENEWS.WA.access_rights (domain_id, account_id);
+  return vector (
+                 'domain_id', domain_id,
+                 'account_id',   account_id,
+                 'account_rights', account_rights
                );
 }
 ;
@@ -120,7 +153,8 @@ _end:
 -- Freeze Functions
 --
 -------------------------------------------------------------------------------
-create procedure ENEWS.WA.frozen_check(in domain_id integer)
+create procedure ENEWS.WA.frozen_check (
+  in domain_id integer)
 {
   declare exit handler for not found { return 1; };
 
@@ -143,7 +177,8 @@ create procedure ENEWS.WA.frozen_check(in domain_id integer)
 
 -------------------------------------------------------------------------------
 --
-create procedure ENEWS.WA.frozen_page(in domain_id integer)
+create procedure ENEWS.WA.frozen_page (
+  in domain_id integer)
 {
   return (select WAI_FREEZE_REDIRECT from DB.DBA.WA_INSTANCE where WAI_ID = domain_id);
 }
@@ -155,63 +190,17 @@ create procedure ENEWS.WA.frozen_page(in domain_id integer)
 --
 -------------------------------------------------------------------------------
 create procedure ENEWS.WA.check_admin(
-  in user_id integer) returns integer
+  in user_id integer)
 {
   declare group_id integer;
-  group_id := (select U_GROUP from SYS_USERS where U_ID = user_id);
 
-  if (user_id = 0)
-    return 1;
-  if (user_id = http_dav_uid ())
+  if ((user_id = 0) or (user_id = http_dav_uid ()))
     return 1;
-  if (group_id = 0)
-    return 1;
-  if (group_id = http_dav_uid ())
-    return 1;
-  if(group_id = http_dav_uid()+1)
-    return 1;
-  return 0;
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure ENEWS.WA.check_grants (
-  in domain_id integer,
-  in user_id integer,
-  in role_name varchar)
-{
-  whenever not found goto _end;
 
-  if (ENEWS.WA.check_admin(user_id))
-    return 1;
-  if (role_name is null or role_name = '')
-    return 0;
-  if (role_name = 'admin')
-    return 0;
-  if (role_name = 'guest') {
-    if (exists(select 1
-                 from SYS_USERS A,
-                      WA_MEMBER B,
-                      WA_INSTANCE C
-                where A.U_ID = user_id
-                  and B.WAM_USER = A.U_ID
-                  and B.WAM_INST = C.WAI_NAME
-                  and C.WAI_ID = domain_id))
-      return 1;
-  }
-  if (role_name = 'owner')
-    if (exists(select 1
-                 from SYS_USERS A,
-                      WA_MEMBER B,
-                      WA_INSTANCE C
-                where A.U_ID = user_id
-                  and B.WAM_USER = A.U_ID
-                  and B.WAM_MEMBER_TYPE = 1
-                  and B.WAM_INST = C.WAI_NAME
-                  and C.WAI_ID = domain_id))
+  group_id := (select U_GROUP from SYS_USERS where U_ID = user_id);
+  if ((group_id = 0) or (group_id = http_dav_uid ()) or (group_id = http_dav_uid()+1))
       return 1;
-_end:
+
   return 0;
 }
 ;
@@ -234,14 +223,14 @@ create procedure ENEWS.WA.check_feeds_grants (
 
 -------------------------------------------------------------------------------
 --
-create procedure ENEWS.WA.check_grants2 (
-  in role_name varchar,
+create procedure ENEWS.WA.check_grants (
+  in access_rights varchar,
   in page_name varchar)
 {
   declare tree any;
 
   tree := xml_tree_doc (ENEWS.WA.menu_tree());
-  if (isnull(xpath_eval (sprintf ('/menu_tree/node[.//*[(@url = "%s") and contains(@allowed, "%s")]]', page_name, role_name), tree, 1)))
+  if (isnull (xpath_eval (sprintf ('/menu_tree/node[.//*[(@url = "%s") and contains(@allowed, "%s")]]', page_name, access_rights), tree, 1)))
     return 0;
   return 1;
 }
@@ -249,50 +238,70 @@ create procedure ENEWS.WA.check_grants2 (
 
 -------------------------------------------------------------------------------
 --
-create procedure ENEWS.WA.access_role (
+create procedure ENEWS.WA.access_rights (
   in domain_id integer,
-  in user_id integer)
+  in account_id integer)
 {
-  whenever not found goto _end;
+  declare rc varchar;
+
+  if (domain_id = -1)
+    return 'R';
+
+  if (domain_id = -2)
+    return null;
+
+  if (ENEWS.WA.check_admin (account_id))
+    return 'W';
 
-  if (ENEWS.WA.check_admin(user_id))
-    return 'admin';
   if (exists(select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
                 and B.WAM_MEMBER_TYPE = 1
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
-    return 'owner';
+    return 'W';
+
   if (exists(select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
                 and B.WAM_MEMBER_TYPE = 2
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
-    return 'author';
+    return 'W';
+
+  if (is_https_ctx ())
+  {
+    rc := ENEWS.WA.acl_check (domain_id);
+    if (rc <> '')
+      return rc;
+  }
+
   if (exists(select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
-    return 'reader';
-  if (exists(select 1
-               from SYS_USERS A
-              where A.U_ID = user_id))
-    return 'guest';
+    return 'R';
 
-_end:
-  return 'public';
+  if (exists (select 1
+                from DB.DBA.WA_INSTANCE
+               where WAI_ID = domain_id
+                 and WAI_IS_PUBLIC = 1))
+    return 'R';
+
+  if (is_https_ctx () and exists (select 1 from ENEWS.WA.acl_list (id)(iri varchar) x where x.id = domain_id))
+    return '';
+
+  return null;
 }
 ;
 
@@ -334,42 +343,36 @@ create procedure ENEWS.WA.page_name ()
 -------------------------------------------------------------------------------
 --
 create procedure ENEWS.WA.menu_tree (
-  in access_role varchar := null)
+  in access_rights varchar := null)
 {
-  declare S, T varchar;
+  declare S varchar;
 
-  S :=
-'<?xml version="1.0" ?>
+  S := '<?xml version="1.0" ?>
 <menu_tree>
-  <node name="Read" url="news.vspx?tab=feeds" id="1" allowed="public guest reader author owner admin">
-    <node name="11" url="news.vspx" id="11" place="link" allowed="public guest reader author owner admin"/>
-    <node name="12" url="search.vspx" id="12" place="link" allowed="public guest reader author owner admin"/>
-    <node name="13" url="error.vspx" id="13" place="link" allowed="public guest reader author owner admin"/>
-    <node name="14" url="blog.vspx" id="14" place="link" allowed="reader author owner admin"/>
-    <node name="14" url="tags.vspx" id="14"  place="link" allowed="reader author owner admin"/>
-    <node name="15" url="bookmark.vspx" id="15" place="link" allowed="reader author owner admin"/>
-    <node name="16" url="settings.vspx" id="16" place="link" allowed="reader author owner admin"/>
+            <node name="Read"            url="news.vspx"            id="1"                allowed="A W R">
+              <node name="11"            url="news.vspx"            id="11"  place="link" allowed="A W R" />
+              <node name="12"            url="search.vspx"          id="12"  place="link" allowed="A W R" />
+              <node name="13"            url="bookmark.vspx"        id="13"  place="link" allowed="A W R" />
+              <node name="14"            url="settings.vspx"        id="14"  place="link" allowed="A W"/>
   </node>
-  <node name="Administration"  url="channels.vspx"        id="2"                allowed="author owner admin">
-    <node name="Feeds" url="channels.vspx" id="21" allowed="author owner admin">
-      <node name="211" url="channels_create.vspx" id="211" place="link" allowed="author owner admin"/>
-      <node name="212" url="channels_update.vspx" id="212" place="link" allowed="author owner admin"/>
-      <node name="213" url="export.vspx" id="213" place="link" allowed="reader author owner admin"/>
+            <node name="Administration"  url="channels.vspx"        id="2"                allowed="A W">
+              <node name="Feeds"         url="channels.vspx"        id="21"               allowed="A W">
+                <node name="211"         url="channels_create.vspx" id="211" place="link" allowed="A W" />
+                <node name="213"         url="export.vspx"          id="213" place="link" allowed="A W R" />
     </node>
-    <node name="Folders"       url="folders.vspx" id="22"                       allowed="author owner admin"/>
-    <node name="Smart Folders" url="sfolders.vspx" id="23"                      allowed="author owner admin">
-      <node name="231"         url="sfolders_update.vspx" id="231" place="link" allowed="author owner admin"/>
-  </node>
-    <node name="Weblogs"       url="weblog.vspx"          id="24"               allowed="author owner admin"/>
-    <Directories/>
-  </node>
-</menu_tree>';
+              <node name="Folders"       url="folders.vspx"         id="22"               allowed="A W" />
+              <node name="Smart Folders" url="sfolders.vspx"        id="23"               allowed="A W" />
+              <node name="Weblogs"       url="weblog.vspx"          id="24"               allowed="A W" />
+       ';
+
+  if (isnull (access_rights) or (access_rights = 'A'))
+    S := S ||'<node name="Directories"   url="directories.vspx"     id="25"               allowed="A W" />';
 
-  T := '';
-  if (isnull(access_role) or (access_role = 'admin'))
-    T := '<node name="Directories"   url="directories.vspx"     id="25"               allowed="admin"/>';
+  S := S ||
+       '    </node>
+          </menu_tree>';
 
-  return replace(S, '<Directories/>', T);
+  return S;
 }
 ;
 
@@ -378,18 +381,13 @@ create procedure ENEWS.WA.menu_tree (
 create procedure ENEWS.WA.navigation_root (
   in path varchar)
 {
-  declare domain_id, user_id integer;
-  declare access_role varchar;
-  declare aPath any;
+  declare V any;
 
-  aPath := split_and_decode(path,0,'\0\0/');
-  if (length(aPath) < 2)
+  V := split_and_decode(path,0,'\0\0/');
+  if (length (V) = 0)
     return vector();
-  domain_id := cast(aPath[0] as integer);
-  user_id := cast(aPath[1] as integer);
-  access_role := ENEWS.WA.access_role(domain_id, user_id);
-  return xpath_eval (sprintf('/menu_tree/*[contains(@allowed, "%s")]', access_role), xml_tree_doc (ENEWS.WA.menu_tree (access_role)), 0);
 
+  return xpath_eval (sprintf('/menu_tree/*[contains(@allowed, "%s")]', V[0]), xml_tree_doc (ENEWS.WA.menu_tree (V[0])), 0);
 }
 ;
 
@@ -399,8 +397,7 @@ create procedure ENEWS.WA.navigation_child (
   in path varchar,
   in node any)
 {
-  path := concat (path, '[not @place]');
-  return xpath_eval (path, node, 0);
+  return xpath_eval (path || '[not @place]', node, 0);
 }
 ;
 
@@ -738,7 +735,7 @@ create procedure ENEWS.WA.domain_url (
   } else {
     S := sprintf ('%s/dataspace/%U/subscriptions/%U', ENEWS.WA.host_url (), ENEWS.WA.domain_owner_name (domain_id), ENEWS.WA.domain_name (domain_id));
   }
-  return ENEWS.WA.url_fix (S, sid, realm);
+  return ENEWS.WA.url_fix (ENEWS.WA.iri_fix (S), sid, realm);
 }
 ;
 
@@ -755,9 +752,9 @@ create procedure ENEWS.WA.domain_sioc_url (
   {
     S := sprintf ('http://%s/subscriptions', DB.DBA.wa_cname ());
   } else {
-  S := sprintf ('http://%s/dataspace/%U/subscriptions/%U', DB.DBA.wa_cname (), ENEWS.WA.domain_owner_name (domain_id), ENEWS.WA.domain_name (domain_id));
+    S := ENEWS.WA.forum_iri (domain_id);
   }
-  return ENEWS.WA.url_fix (S, sid, realm);
+  return ENEWS.WA.url_fix (ENEWS.WA.iri_fix (S), sid, realm);
 }
 ;
 
@@ -772,6 +769,15 @@ create procedure ENEWS.WA.forum_iri (
 
 -------------------------------------------------------------------------------
 --
+create procedure ENEWS.WA.acl_graph (
+  in domain_id integer)
+{
+  return SIOC..acl_graph ('eNews2', ENEWS.WA.domain_name (domain_id));
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure ENEWS.WA.sparql_url ()
 {
   return sprintf ('http://%s/sparql?default-graph-uri=%U&query=%U&format=%U', SIOC..get_cname (), SIOC..get_graph (), 'DESCRIBE <_RDF_>', 'application/sparql-results+xml');
@@ -895,7 +901,7 @@ create procedure ENEWS.WA.account_sioc_url (
 {
   declare S varchar;
 
-  S := SIOC..person_iri (SIOC..user_iri (ENEWS.WA.domain_owner_id (domain_id), null));
+  S := ENEWS.WA.iri_fix (SIOC..person_iri (SIOC..user_iri (ENEWS.WA.domain_owner_id (domain_id), null)));
   return ENEWS.WA.url_fix (S, sid, realm);
 }
 ;
@@ -1165,9 +1171,12 @@ create procedure ENEWS.WA.feed_refresh (
   in id integer)
 {
   declare exit handler for not found { return 0; };
-
   declare uri, days, tag, retValue any;
-  select EF_URI, EF_STORE_DAYS, EF_TAG into uri, days, tag from ENEWS.WA.FEED where EF_ID = id;
+
+  select EF_URI, EF_STORE_DAYS, EF_TAG
+    into uri, days, tag
+    from ENEWS.WA.FEED
+   where EF_ID = id;
 
  	commit work;
   retValue := ENEWS.WA.feed_refresh_int (id, uri, days, tag);
@@ -1197,10 +1206,15 @@ create procedure ENEWS.WA.feed_refresh_int(
   declare N, L integer;
   declare new_tag, newUri, oldUri varchar;
 
+  if (not exists (select 1 from ENEWS.WA.FEED_DOMAIN where EFD_FEED_ID = id))
+    return 0;
+
   delete
     from ENEWS.WA.FEED_ITEM
    where EFI_FEED_ID = id
-     and ((EFI_LAST_UPDATE is not null) and dateadd('day', days, EFI_LAST_UPDATE) < now());
+     and (EFI_LAST_UPDATE is not null)
+     and (dateadd ('day', days, EFI_LAST_UPDATE) < now())
+     and EFI_ID not in (select x._id from ENEWS.WA.feed_items_rs (p0)(_id integer) x where p0 = id);
 
   reqHdr := 'User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\r\n';
   newUri := ENEWS.WA.url_schema_fix (uri);
@@ -1256,8 +1270,8 @@ again:
 
     set_user_id ('dba');
     graph := ENEWS.WA.graph_create ();
-    sql := sprintf ('sparql define get:soft "soft" define input:grab-destination <%s> select * from <%s> where { ?s ?p ?o }', graph, uri);
-    -- sql := sprintf ('sparql load <%s> into graph <%s>', uri, graph);
+    -- sql := sprintf ('sparql define get:soft "soft" define input:grab-destination <%s> select * from <%s> where { ?s ?p ?o }', graph, uri);
+    sql := sprintf ('sparql load <%s> into graph <%s>', uri, graph);
     ENEWS.WA.exec_sparql (sql, 1);
 
       sql := sprintf(
@@ -1282,6 +1296,19 @@ again:
 ;
 
 -------------------------------------------------------------------------------
+--
+create procedure ENEWS.WA.feed_items_rs (
+  in id integer)
+{
+  declare c0 integer;
+
+  result_names (c0);
+  for (select top 20 EFI_ID from ENEWS.WA.FEED_ITEM where EFI_FEED_ID = id order by EFI_LAST_UPDATE desc) do
+    result (EFI_ID);
+}
+;
+
+-------------------------------------------------------------------------------
 -- /* callback */
 create procedure ENEWS.WA.feed_callback (
   in url varchar,
@@ -1340,9 +1367,9 @@ create procedure ENEWS.WA.process_rss_item(
 
   comment_api := cast (xpath_eval ('[ xmlns:wfw="http://wellformedweb.org/CommentAPI/" ] /item/wfw:comment', xt, 1) as varchar);
   comment_rss := cast (xpath_eval ('[ xmlns:wfw="http://wellformedweb.org/CommentAPI/" ] /item/wfw:commentRss', xt, 1) as varchar);
-  author := cast (xpath_eval ('[ xmlns:dc="http://purl.org/dc/elements/1.1/" ] /item/dc:creator', xt, 1) as varchar);
-  if (isnull(author))
-    author := cast (xpath_eval ('/item/author', xt, 1) as varchar);
+  author := serialize_to_UTF8_xml (xpath_eval ('[ xmlns:dc="http://purl.org/dc/elements/1.1/" ] string(/item/dc:creator)', xt, 1));
+  if (is_empty_or_null (author))
+    author := serialize_to_UTF8_xml (xpath_eval ('string(/item/author)', xt, 1));
 
   ENEWS.WA.process_insert(feed_id, title, description, link, guid, pubDate, comment_api, comment_rss, author, xt);
 }
@@ -1393,7 +1420,7 @@ create procedure ENEWS.WA.process_atom_item(
   comment_api := null;
   comment_rss := null;
   pubDate := now ();
-  author := cast (xpath_eval ('/entry/author/name', xt, 1) as varchar);
+  author := serialize_to_UTF8_xml (xpath_eval ('string (/entry/author/name)', xt, 1));
 
   ENEWS.WA.process_insert(feed_id, title, description, link, guid, pubDate, comment_api, comment_rss, author, xt);
 }
@@ -1505,10 +1532,17 @@ _start:
   item_tags := case when isnull (tags) then ENEWS.WA.tags_item (item_id) else tags end;
 
   -- domain tags
-  for (select EFD_DOMAIN_ID, EFD_TAGS from ENEWS.WA.FEED_DOMAIN where EFD_FEED_ID = feed_id) do
+  for (select EFD_DOMAIN_ID, EFD_GRAPH, EFD_TAGS from ENEWS.WA.FEED_DOMAIN where EFD_FEED_ID = feed_id) do
   {
+    -- schedule RDF Graph
+    if (not is_empty_or_null (EFD_GRAPH) and not is_empty_or_null (link) and __proc_exists ('DB.DBA.RDF_SPONGER_QUEUE_ADD'))
+      DB.DBA.RDF_SPONGER_QUEUE_ADD (link, vector ('get:soft', 'soft', 'get:destination', EFD_GRAPH));
+
+    -- update NNTP
     if (ENEWS.WA.conversation_enable(EFD_DOMAIN_ID))
       ENEWS.WA.nntp_root (EFD_DOMAIN_ID, item_id);
+
+    -- updates tags
     ENEWS.WA.tags_domain_item2 (EFD_DOMAIN_ID, item_id, ENEWS.WA.tags_join(EFD_TAGS, item_tags));
   }
 }
@@ -1615,7 +1649,7 @@ create procedure ENEWS.WA.channel_add(
       link := xpath_eval ('/link', xtree_doc (link));
     L := length(channels);
     for (N := 1; N < L; N := N + 1)
-      if (get_keyword('rss', channels[N]) = xpath_eval ('@href', link))
+      if (isvector (channels[N]) and get_keyword ('rss', channels[N]) = xpath_eval ('@href', link))
         goto _next;
     vectorbld_acc (channels, vector ('title', xpath_eval ('@title', link), 'rss',  WS.WS.EXPAND_URL (uri, xpath_eval ('@href', link)), 'format', format));
   _next:;
@@ -1856,7 +1890,7 @@ create procedure ENEWS.WA.channel_get (
   inout xt any,
   in header varchar := null) returns any
 {
-  declare title, home, format, version, lang, css, psh, data, tmp, channel any;
+  declare title, home, format, version, lang, css, psh, data, tmp, channel, salmon any;
 
   channel := vector ();
   data := null;
@@ -1899,6 +1933,7 @@ create procedure ENEWS.WA.channel_get (
     -- Atom feed
     css := ENEWS.WA.channel_css(xt);
     psh := ENEWS.WA.channel_psh(xt, header);
+    salmon := ENEWS.WA.channel_salmon(xt, header);
     xt := xml_cut (xpath_eval ('/feed[1]', xt, 1));
     title := serialize_to_UTF8_xml(xpath_eval ('string(/feed/title/text()|/feed/author/name/text())', xt, 1));
     home := cast (xpath_eval ('/feed/link[@rel="service.post" and @type="application/atom+xml"]/@href', xt) as varchar);
@@ -1912,7 +1947,7 @@ create procedure ENEWS.WA.channel_get (
       format := 'http://purl.org/atom/ns#';
     }
     lang := cast (xpath_eval ('/feed/@lang', xt, 1) as varchar);
-    channel := vector ('type', 'long', 'title', title, 'home', home, 'rss', uri, 'format', format, 'lang', lang, 'css', css, 'psh', psh, 'data', data);
+    channel := vector ('type', 'long', 'title', title, 'home', home, 'rss', uri, 'format', format, 'lang', lang, 'css', css, 'psh', psh, 'data', data, 'salmon', salmon);
 
     tmp := cast (xpath_eval ('/Channel/image/url/text()', xt, 1) as varchar);
     if (not isnull(tmp))
@@ -1953,7 +1988,6 @@ create procedure ENEWS.WA.channel_psh (
   declare psh, link varchar;
   declare parts any;
 
-  -- dbg_obj_print('', xt);
   psh := cast (xpath_eval ('[ xmlns:atom="http://www.w3.org/2005/Atom" ] /rss/channel/atom:link[@rel="hub" and @title="PubSubHub"]/@href|/atom:feed/atom:link[@rel="hub" and @title="PubSubHub"]/@href', xt, 1) as varchar);
   if (isnull (psh))
   {
@@ -1969,6 +2003,28 @@ create procedure ENEWS.WA.channel_psh (
 }
 ;
 
+create procedure ENEWS.WA.channel_salmon (
+  inout xt any,
+  inout header varchar) returns any
+{
+  declare spep, link varchar;
+  declare parts any;
+
+  spep := cast (xpath_eval ('[ xmlns:atom="http://www.w3.org/2005/Atom" ] /atom:feed/atom:link[@rel="salmon"]/@href', xt, 1) as varchar);
+  if (isnull (spep))
+  {
+    link := http_request_header (header, 'Link');
+    if (isstring (link))
+    {
+      parts := split_and_decode (link, 0, '\0\0;=');
+      if ((trim (get_keyword ('rel', parts), '"') = 'salmon'))
+        spep := rtrim (ltrim (parts[0], '<'), '>');
+    }
+  }
+  return spep;
+}
+;
+
 -------------------------------------------------------------------------------
 --
 create procedure ENEWS.WA.channel_create(
@@ -2039,7 +2095,8 @@ create procedure ENEWS.WA.channel_create(
             EF_LANG,
             EF_UPDATE_PERIOD,
             EF_UPDATE_FREQ,
-            EF_IMAGE_URI
+       EF_IMAGE_URI,
+       EF_SALMON_SERVER
            )
     values
       (
@@ -2054,7 +2111,8 @@ create procedure ENEWS.WA.channel_create(
             get_keyword('lang', channel, 'us-en'),
             get_keyword('updatePeriod', channel, 'daily'),
             get_keyword('updateFrequency', channel, 4),
-            imageUri
+       imageUri,
+       get_keyword ('salmon', channel, null)
            );
   }
   if (isnull (id))
@@ -2162,7 +2220,6 @@ create procedure ENEWS.WA.channel_psh_subscribe (
                      http_method=>'GET',
                      http_headers=>pshReqHdr,
                      headers=>pshResHdr);
-    -- dbg_obj_print('', pshResHdr);
     if (pshResHdr[0] not like 'HTTP/1._ 20%')
       return null;
 
@@ -2194,7 +2251,8 @@ create procedure ENEWS.WA.channel_select(
               EF_LANG,
               EF_IMAGE_URI,
               EF_PSH_ENABLED,
-              EF_PSH_SERVER
+              EF_PSH_SERVER,
+	      EF_SALMON_SERVER
          from ENEWS.WA.FEED
         where EF_URI = feed_uri) do
     return vector (
@@ -2213,7 +2271,8 @@ create procedure ENEWS.WA.channel_select(
                    'updateFrequency', EF_UPDATE_FREQ,
                    'imageUrl', EF_IMAGE_URI,
                    'psh', EF_PSH_SERVER,
-                   'psh_enabled', EF_PSH_ENABLED
+                   'psh_enabled', EF_PSH_ENABLED,
+		   'salmon', EF_SALMON_SERVER
                   );
   return vector();
 }
@@ -2264,7 +2323,8 @@ create procedure ENEWS.WA.channel_domain(
   in title any,
   in tags any,
   in folder_name any,
-  in folder_id any)
+  in folder_id any,
+  in graph any := null)
 {
   folder_name := trim(folder_name);
   if (folder_name <> '')
@@ -2279,13 +2339,14 @@ create procedure ENEWS.WA.channel_domain(
     id := coalesce((select EFD_ID from ENEWS.WA.FEED_DOMAIN where EFD_DOMAIN_ID = domain_id and EFD_FEED_ID = feed_id and coalesce(EFD_FOLDER_ID, 0) = coalesce(folder_id, 0)), -1);
   if (id = -1)
   {
-    insert replacing ENEWS.WA.FEED_DOMAIN (EFD_DOMAIN_ID, EFD_FEED_ID, EFD_TITLE, EFD_TAGS, EFD_FOLDER_ID)
-      values (domain_id, feed_id, title, tags, folder_id);
+    insert replacing ENEWS.WA.FEED_DOMAIN (EFD_DOMAIN_ID, EFD_FEED_ID, EFD_TITLE, EFD_GRAPH, EFD_TAGS, EFD_FOLDER_ID)
+      values (domain_id, feed_id, title, graph, tags, folder_id);
     id := (select max (EFD_ID) from ENEWS.WA.FEED_DOMAIN);
     ENEWS.WA.channel_reindex(feed_id);
   } else {
     update ENEWS.WA.FEED_DOMAIN
        set EFD_TITLE = title,
+           EFD_GRAPH = graph,
            EFD_TAGS = tags,
            EFD_FOLDER_ID = folder_id
      where EFD_ID = id;
@@ -2296,6 +2357,18 @@ create procedure ENEWS.WA.channel_domain(
 
 -------------------------------------------------------------------------------
 --
+create procedure ENEWS.WA.channel_acl (
+  in id integer,
+  in acl any)
+{
+  update ENEWS.WA.FEED_DOMAIN
+     set EFD_ACL = acl
+   where EFD_ID = id;
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure ENEWS.WA.channel_reindex(
   in feed_id varchar)
 {
@@ -3391,6 +3464,7 @@ create procedure ENEWS.WA.blog_change_flag (
 create procedure ENEWS.WA.sfolder_sql(
   inout domain_id integer,
   inout account_id integer,
+  in account_rights varchar,
   inout data varchar,
   in mode varchar := 'text',
   in maxRows varchar := '')
@@ -3557,15 +3631,24 @@ create procedure ENEWS.WA.sfolder_sql(
   tmp := ENEWS.WA.xml_get('read', data);
   if (tmp = 'r+')
     ENEWS.WA.sfolder_sql_where(where2, delimiter2, 'coalesce(fida.EFID_READ_FLAG, 0) = 1');
-  if (tmp = 'r-')
+  else if (tmp = 'r-')
     ENEWS.WA.sfolder_sql_where(where2, delimiter2, 'coalesce(fida.EFID_READ_FLAG, 0) = 0');
 
   tmp := ENEWS.WA.xml_get('flag', data);
   if (tmp = 'f+')
     ENEWS.WA.sfolder_sql_where(where2, delimiter2, 'coalesce(fida.EFID_KEEP_FLAG, 0) = 1');
-  if (tmp = 'f-')
+  else if (tmp = 'f-')
     ENEWS.WA.sfolder_sql_where(where2, delimiter2, 'coalesce(fida.EFID_KEEP_FLAG, 0) = 0');
 
+  if (account_rights = '')
+  {
+    if (is_https_ctx ())
+    {
+      S := S || '   and SIOC..feed_iri (z.EF_ID) in (select s.iri from ENEWS.WA.acl_list (id)(iri varchar) s where s.id = <DOMAIN_ID>)';
+    } else {
+      S := S || '   and 1=0';
+    }
+  }
   if (maxRows <> '')
     maxRows := 'TOP ' || maxRows;
   S := replace(S, '<MAX>', maxRows);
@@ -4335,14 +4418,18 @@ create procedure ENEWS.WA.make_dasboard_item (
   if (action = 'insert')
   {
     ret := sprintf (
-      '<post id="%d"><title><![CDATA[%s]]></title><dt>%s</dt><link>%V</link><from><![CDATA[%s]]></from><email>%V</email></post>',
-      id, ENEWS.WA.show_title(title), ENEWS.WA.dt_iso8601 (tim), SIOC..feed_item_iri (feed_id, id), ENEWS.WA.show_author(uname), coalesce(ENEWS.WA.process_authorEMail(data), ''));
+      '<post id="%d"><title>%V</title><dt>%s</dt><link>%V</link><from>%V</from><email>%V</email></post>',
+      id, ENEWS.WA.show_title(ENEWS.WA.utf2wide (title)), ENEWS.WA.dt_iso8601 (tim), SIOC..feed_item_iri (feed_id, id), ENEWS.WA.show_author(uname), coalesce(ENEWS.WA.process_authorEMail(data), ''));
     http (ret, ses);
     i := i + 1;
   }
 
   if (dash is not null)
   {
+    declare exit handler for sqlstate '*'
+    {
+      goto _end;
+    };
     declare xt, xp any;
 
     xt := xtree_doc (dash);
@@ -4371,37 +4458,73 @@ _end:;
 
 -----------------------------------------------------------------------------
 --
-create procedure ENEWS.WA.dashboard_get(
-  in _domain_id integer,
-  in _user_id   integer)
+create procedure ENEWS.WA.dashboard_rs (
+  in p0 integer)
 {
-  declare _user_name varchar;
-  declare sStream any;
+  declare N integer;
+  declare xt, xp any;
+  declare id, title, dt, autor, mail any;
 
-  _user_name := ENEWS.WA.account_name (_user_id);
-  sStream := string_output ();
+  declare c0 integer;
+  declare c1 integer;
+  declare c2 varchar;
+  declare c3 datetime;
+  declare c4 varchar;
+  declare c5 varchar;
 
-  for (select EF_ID, EF_DASHBOARD from ENEWS.WA.FEED, ENEWS.WA.FEED_DOMAIN where EFD_FEED_ID = EF_ID and EFD_DOMAIN_ID = _domain_id and EF_DASHBOARD is not null) do
+  result_names (c0, c1, c2, c3, c4, c5);
+  for (select EF_ID,
+              EF_DASHBOARD
+         from ENEWS.WA.FEED,
+              ENEWS.WA.FEED_DOMAIN
+        where EFD_FEED_ID = EF_ID
+          and EFD_DOMAIN_ID = p0
+          and EF_DASHBOARD is not null) do
   {
-      declare I, J integer;
-      declare xt, xp any;
-      declare _id, _title, _dt, _from, _email any;
-
+    declare exit handler for sqlstate '*'
+    {
+      goto _skipBad;
+    };
       xt := xtree_doc (EF_DASHBOARD);
       xp := xpath_eval ('/feed-db/*', xt, 0);
-      http ('<feed-db>', sStream);
-    for (j := 0; j < length (xp); j := j + 1)
+    for (N := 0; N < length (xp); N := N + 1)
     {
-      _id    := serialize_to_UTF8_xml (xpath_eval ('string(@id)', xp[j]));
-      _title := serialize_to_UTF8_xml (xpath_eval ('string(./title)', xp[j]));
-      _dt    := serialize_to_UTF8_xml (xpath_eval ('string(./dt)', xp[j]));
-      _from  := serialize_to_UTF8_xml (xpath_eval ('string(./from)', xp[j]));
-      _email := serialize_to_UTF8_xml (xpath_eval ('string(./email)', xp[j]));
-        http (sprintf ('<post id="%s"><title><![CDATA[%s]]></title><dt>%s</dt><link>%V?instance=%d</link><from><![CDATA[%s]]></from><uid>%V</uid><email>%V</email></post>', _id, _title, _dt, SIOC..feed_item_iri (EF_ID, cast (_id as integer)), _domain_id, _from, _user_name, _email), sStream);
+      id    := xpath_eval ('@id', xp[N]);
+      title := serialize_to_UTF8_xml (xpath_eval ('string(./title)', xp[N]));
+      declare continue handler for sqlstate '*' {
+        dt := now ();
+        goto _skip;
+      };
+      dt    := stringdate (xpath_eval ('string(./dt)', xp[N]));
+    _skip:;
+      autor := serialize_to_UTF8_xml (xpath_eval ('string(./from)', xp[N]));
+      mail  := serialize_to_UTF8_xml (xpath_eval ('string(./email)', xp[N]));
+      result (EF_ID, cast (id as integer), title, dt, autor, mail);
       }
-      http ('</feed-db>', sStream);
+  _skipBad:;
     }
-  return string_output_string (sStream);
+}
+;
+
+-----------------------------------------------------------------------------
+--
+create procedure ENEWS.WA.dashboard_get (
+  in domain_id integer)
+{
+  declare account_name varchar;
+  declare aStream any;
+
+  account_name := ENEWS.WA.domain_owner_name (domain_id);
+  aStream := string_output ();
+  http ('<feed-db>', aStream);
+  for (select TOP 10 x.*
+         from ENEWS.WA.dashboard_rs(p0)(_feed_id integer, _id integer, _name varchar, _time datetime, _autor varchar, _mail varchar) x
+        where p0 = domain_id order by x._time desc) do
+  {
+    http (sprintf ('<post id="%d"><title>%V</title><dt>%s</dt><link>%V?instance=%d</link><from>%V</from><uid>%V</uid><email>%V</email></post>', _id, ENEWS.WA.utf2wide (_name), ENEWS.WA.dt_iso8601 (_time), SIOC..feed_item_iri (_feed_id, _id), domain_id, ENEWS.WA.utf2wide (_autor), account_name, _mail), aStream);
+  }
+  http ('</feed-db>', aStream);
+  return string_output_string (aStream);
 }
 ;
 
@@ -4672,11 +4795,11 @@ create procedure ENEWS.WA.url_fix (
 create procedure ENEWS.WA.iri_fix (
   in S varchar)
 {
-  if (is_https_ctx ())
+  if (not is_empty_or_null (S) and is_https_ctx ())
   {
     declare V any;
 
-    V := rfc1808_parse_uri (S);
+    V := rfc1808_parse_uri (cast (S as varchar));
     V [0] := 'https';
     V [1] := http_request_header (http_request_header(), 'Host', null, registry_get ('URIQADefaultHost'));
     S := DB.DBA.vspx_uri_compose (V);
@@ -5491,7 +5614,8 @@ create procedure ENEWS.WA.set_keyword(
 
   L := length(params);
   for (N := 0; N < L; N := N + 2)
-    if (params[N] = name) {
+    if (params[N] = name)
+    {
       aset(params, N + 1, value);
       goto _end;
     }
@@ -5505,7 +5629,7 @@ _end:
 
 -------------------------------------------------------------------------------
 --
-create procedure ENEWS.WA.enews_path2_int(
+create procedure ENEWS.WA.enews_path_int (
   in domain_id integer,
   in node varchar,
   inout path varchar)
@@ -5518,13 +5642,13 @@ create procedure ENEWS.WA.enews_path2_int(
   if ((node_type = 'f') and (node_id <> -1) and (domain_id > 0))
     for (select EFO_PARENT_ID from ENEWS.WA.FOLDER where EFO_DOMAIN_ID = domain_id and coalesce(EFO_ID, -1) = node_id) do {
       path := sprintf('%s/%s', ENEWS.WA.make_node('f', coalesce(EFO_PARENT_ID, -1)), path);
-      ENEWS.WA.enews_path2_int(domain_id, ENEWS.WA.make_node('f', coalesce(EFO_PARENT_ID, -1)), path);
+      ENEWS.WA.enews_path_int (domain_id, ENEWS.WA.make_node('f', coalesce(EFO_PARENT_ID, -1)), path);
   }
 
   if ((node_type = 'c') and (domain_id > 0))
     for (select EFD_FOLDER_ID from ENEWS.WA.FEED_DOMAIN where EFD_DOMAIN_ID = domain_id and EFD_ID = node_id) do {
       path := sprintf('%s/%s', ENEWS.WA.make_node('f', coalesce(EFD_FOLDER_ID, -1)), path);
-      ENEWS.WA.enews_path2_int(domain_id, ENEWS.WA.make_node('f', coalesce(EFD_FOLDER_ID, -1)), path);
+      ENEWS.WA.enews_path_int (domain_id, ENEWS.WA.make_node('f', coalesce(EFD_FOLDER_ID, -1)), path);
 }
 
   if ((node_type = 'c') and (domain_id < 0))
@@ -5543,108 +5667,87 @@ create procedure ENEWS.WA.enews_path2_int(
     for (select EW_ID from ENEWS.WA.BLOG, ENEWS.WA.WEBLOG where EB_ID = node_id and EW_DOMAIN_ID = domain_id and EB_WEBLOG_ID = EW_ID) do
     {
       path := sprintf('%s/%s', ENEWS.WA.make_node('w', EW_ID), path);
-      ENEWS.WA.enews_path2_int(domain_id, ENEWS.WA.make_node('w', EW_ID), path);
+      ENEWS.WA.enews_path_int (domain_id, ENEWS.WA.make_node('w', EW_ID), path);
   }
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure ENEWS.WA.enews_path2(
+create procedure ENEWS.WA.enews_path (
   in domain_id integer,
   in node varchar)
 {
   declare path any;
 
   path := node;
-  ENEWS.WA.enews_path2_int(domain_id, node, path);
+  ENEWS.WA.enews_path_int (domain_id, node, path);
   return '/' || path;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure ENEWS.WA.enews_tree2(
+create procedure ENEWS.WA.enews_tree (
   in domain_id integer,
+  in account_rights varchar,
   in node varchar,
   in path varchar)
 {
+  declare retValue any;
   declare node_type, node_id any;
 
   node_id := ENEWS.WA.node_id(node);
   node_type := ENEWS.WA.node_type(node);
-  if (node_type = 'r') {
-    if (node_id = 0)
+  if ((node_type = 'r') and (node_id = 0))
       return vector('Feeds', ENEWS.WA.make_node('f', -1), ENEWS.WA.make_path('', 'f', -1));
 
-    if (node_id = 1)
+  if ((node_type = 'r') and (node_id = 1))
       return vector('Feeds', ENEWS.WA.make_node('f', -1), ENEWS.WA.make_path(path, 'f', -1), 'Smart Folders', ENEWS.WA.make_node('s', -1), ENEWS.WA.make_path(path, 's', -1), 'Weblogs', ENEWS.WA.make_node('w', -1), ENEWS.WA.make_path(path, 'w', -1));
-  }
 
-  declare retValue any;
   retValue := vector ();
   if ((node_type = 'f') and (domain_id < 0))
+  {
     for (select distinct top 10 EF_ID, EF_TITLE from ENEWS.WA.FEED, ENEWS.WA.FEED_ITEM where EFI_FEED_ID = EF_ID order by EFI_LAST_UPDATE desc) do
       retValue := vector_concat (retValue, vector(EF_TITLE, ENEWS.WA.make_node ('c', EF_ID), ENEWS.WA.make_path (path, 'c', EF_ID)));
+  }
 
-  if ((node_type = 'f') and (domain_id > 0)) {
+  if ((node_type = 'f') and (domain_id > 0))
+  {
     for (select EFO_ID, EFO_NAME from ENEWS.WA.FOLDER where EFO_DOMAIN_ID = domain_id and coalesce(EFO_PARENT_ID, -1) = node_id order by 2) do
       retValue := vector_concat(retValue, vector(EFO_NAME, ENEWS.WA.make_node ('f', EFO_ID), ENEWS.WA.make_path (path, 'f', EFO_ID)));
-    for (select EFD_ID, coalesce(EFD_TITLE, EF_TITLE) EFD_TITLE from ENEWS.WA.FEED join ENEWS.WA.FEED_DOMAIN on EF_ID = EFD_FEED_ID where EFD_DOMAIN_ID = domain_id and coalesce(EFD_FOLDER_ID, -1) = node_id order by 2) do
+
+    for (select EFD_ID, coalesce(EFD_TITLE, EF_TITLE) EFD_TITLE, EFD_FEED_ID
+           from ENEWS.WA.FEED
+                  join ENEWS.WA.FEED_DOMAIN on EF_ID = EFD_FEED_ID
+          where EFD_DOMAIN_ID = domain_id
+            and coalesce(EFD_FOLDER_ID, -1) = node_id
+            and (
+                 (account_rights <> '') or
+                 (SIOC..feed_iri (EFD_FEED_ID) in (select a.iri from ENEWS.WA.acl_list (id)(iri varchar) a where a.id = domain_id))
+                )
+          order by 2) do
       retValue := vector_concat (retValue, vector(EFD_TITLE, ENEWS.WA.make_node ('c', EFD_ID), ENEWS.WA.make_path (path, 'c', EFD_ID)));
   }
 
   if ((node_type = 's') and (node_id = -1))
+  {
     for (select ESFO_ID, ESFO_NAME from ENEWS.WA.SFOLDER where ESFO_DOMAIN_ID = domain_id order by 2) do
       retValue := vector_concat (retValue, vector(ESFO_NAME, ENEWS.WA.make_node ('s', ESFO_ID), ENEWS.WA.make_path (path, 's', ESFO_ID)));
+  }
 
   if ((node_type = 'w') and (node_id = -1))
+  {
     for (select EW_ID, EW_NAME from ENEWS.WA.WEBLOG where EW_DOMAIN_ID = domain_id order by 2) do
       retValue := vector_concat (retValue, vector(EW_NAME, ENEWS.WA.make_node ('w', EW_ID), ENEWS.WA.make_path (path, 'w', EW_ID)));
+  }
 
   if ((node_type = 'w') and (node_id <> -1))
+  {
     for (select EB_ID, EB_NAME from ENEWS.WA.BLOG, ENEWS.WA.WEBLOG where EW_DOMAIN_ID = domain_id and EW_ID = node_id and EB_WEBLOG_ID = EW_ID order by 2) do
       retValue := vector_concat (retValue, vector(EB_NAME, ENEWS.WA.make_node ('b', EB_ID), ENEWS.WA.make_path (path, 'b', EB_ID)));
-
-  return retValue;
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure ENEWS.WA.enews_node_has_childs (
-  in domain_id integer,
-  in node varchar)
-{
-  declare node_type, node_id any;
-
-  node_id := ENEWS.WA.node_id(node);
-  node_type := ENEWS.WA.node_type(node);
-
-  if ((node_type = 'f') and (domain_id < 0))
-    if (exists (select 1 from ENEWS.WA.FEED, ENEWS.WA.FEED_ITEM where EFI_FEED_ID = EF_ID))
-      return 1;
-
-  if ((node_type = 'f') and (domain_id > 0)) {
-    if (exists (select 1 from ENEWS.WA.FOLDER where EFO_DOMAIN_ID = domain_id and coalesce(EFO_PARENT_ID, -1) = coalesce(node_id, -1)))
-      return 1;
-    if (exists (select 1 from ENEWS.WA.FEED join ENEWS.WA.FEED_DOMAIN on EF_ID = EFD_FEED_ID where EFD_DOMAIN_ID = domain_id and coalesce(EFD_FOLDER_ID, -1) = node_id))
-      return 1;
   }
-
-  if ((node_type = 's') and (node_id = -1))
-    if (exists (select 1 from ENEWS.WA.SFOLDER where ESFO_DOMAIN_ID = domain_id))
-      return 1;
-
-  if ((node_type = 'w') and (node_id = -1))
-    if (exists (select 1 from ENEWS.WA.WEBLOG where EW_DOMAIN_ID = domain_id))
-      return 1;
-
-  if ((node_type = 'w') and (node_id <> -1))
-    if (exists (select 1 from ENEWS.WA.BLOG, ENEWS.WA.WEBLOG where EW_DOMAIN_ID = domain_id and EW_ID = node_id and EB_WEBLOG_ID = EW_ID))
-      return 1;
-
-  return 0;
+  return retValue;
 }
 ;
 
@@ -5674,9 +5777,9 @@ create procedure ENEWS.WA.make_path (
 create procedure ENEWS.WA.node_type(
   in code varchar)
 {
-  if (length(code) > 1)
-    if (substring(code,2,1) = '#')
+  if ((length (code) > 1) and (substring(code,2,1) = '#'))
       return left(code, 1);
+
   return '';
 }
 ;
@@ -5686,9 +5789,9 @@ create procedure ENEWS.WA.node_type(
 create procedure ENEWS.WA.node_prefix(
   in code varchar)
 {
-  if (length(code) > 1)
-    if (substring(code,2,1) = '#')
+  if ((length (code) > 1) and (substring(code,2,1) = '#'))
       return left(code, 2);
+
   return '';
 }
 ;
@@ -5700,9 +5803,9 @@ create procedure ENEWS.WA.node_id(
 {
   declare exit handler for sqlstate '*' { return 0; };
 
-  if (length(code) > 2)
-    if (substring(code,2,1) = '#')
+  if ((length (code) > 2) and (substring(code,2,1) = '#'))
       return cast(subseq(code, 2) as integer);
+
   return 0;
 }
 ;
@@ -5712,9 +5815,9 @@ create procedure ENEWS.WA.node_id(
 create procedure ENEWS.WA.node_suffix(
   in code varchar)
 {
-  if (length(code) > 2)
-    if (substring(code,2,1) = '#')
+  if ((length (code) > 2) and (substring(code,2,1) = '#'))
       return subseq(code, 2);
+
   return '';
 }
 ;
@@ -5857,90 +5960,70 @@ create procedure ENEWS.WA.dt_format(
   in pDate datetime,
   in pFormat varchar := 'd.m.Y')
 {
-  declare
-    N integer;
-  declare
-    ch,
-    S varchar;
+  declare N integer;
+  declare ch, S varchar;
+
+  declare exit handler for sqlstate '*' {
+    return '';
+  };
 
   S := '';
-  N := 1;
-  while (N <= length(pFormat))
+  for (N := 1; N <= length(pFormat); N := N + 1)
   {
     ch := substring(pFormat, N, 1);
     if (ch = 'M')
     {
       S := concat(S, xslt_format_number(month(pDate), '00'));
-    } else {
-      if (ch = 'm')
+    }
+    else if (ch = 'm')
       {
         S := concat(S, xslt_format_number(month(pDate), '##'));
-      } else
-      {
-        if (ch = 'Y')
+    }
+    else if (ch = 'Y')
         {
           S := concat(S, xslt_format_number(year(pDate), '0000'));
-        } else
-        {
-          if (ch = 'y')
+    }
+    else if (ch = 'y')
           {
             S := concat(S, substring(xslt_format_number(year(pDate), '0000'),3,2));
-          } else {
-            if (ch = 'd')
+    }
+    else if (ch = 'd')
             {
               S := concat(S, xslt_format_number(dayofmonth(pDate), '##'));
-            } else
-            {
-              if (ch = 'D')
+    }
+    else if (ch = 'D')
               {
                 S := concat(S, xslt_format_number(dayofmonth(pDate), '00'));
-              } else
-              {
-                if (ch = 'H')
+    }
+    else if (ch = 'H')
                 {
                   S := concat(S, xslt_format_number(hour(pDate), '00'));
-                } else
-                {
-                  if (ch = 'h')
+    }
+    else if (ch = 'h')
                   {
                     S := concat(S, xslt_format_number(hour(pDate), '##'));
-                  } else
-                  {
-                    if (ch = 'N')
+    }
+    else if (ch = 'N')
                     {
                       S := concat(S, xslt_format_number(minute(pDate), '00'));
-                    } else
-                    {
-                      if (ch = 'n')
+    }
+    else if (ch = 'n')
                       {
                         S := concat(S, xslt_format_number(minute(pDate), '##'));
-                      } else
-                      {
-                        if (ch = 'S')
+    }
+    else if (ch = 'S')
                         {
                           S := concat(S, xslt_format_number(second(pDate), '00'));
-                        } else
-                        {
-                          if (ch = 's')
+    }
+    else if (ch = 's')
                           {
                             S := concat(S, xslt_format_number(second(pDate), '##'));
-                          } else
+    }
+    else
                           {
                             S := concat(S, ch);
-                          };
-                        };
-                      };
-                    };
-                  };
-                };
-              };
-            };
-          };
-        };
-      };
-    };
-    N := N + 1;
-  };
+    }
+  }
   return S;
 }
 ;
@@ -5951,15 +6034,9 @@ create procedure ENEWS.WA.dt_deformat(
   in pString varchar,
   in pFormat varchar := 'd.m.Y')
 {
-  declare
-    y,
-    m,
-    d integer;
-  declare
-    N,
-    I integer;
-  declare
-    ch varchar;
+  declare y, m, d integer;
+  declare N, I integer;
+  declare ch varchar;
 
   N := 1;
   I := 0;
diff --git a/appsrc/ODS-FeedManager/sql/nws-a-ods.sql b/appsrc/ODS-FeedManager/sql/nws-a-ods.sql
index d5f7b7c..2bcc5e7 100644
--- a/appsrc/ODS-FeedManager/sql/nws-a-ods.sql
+++ b/appsrc/ODS-FeedManager/sql/nws-a-ods.sql
@@ -1,5 +1,5 @@
 --
---  $Id: nws-a-ods.sql,v 1.2 2007/02/27 21:19:45 source Exp $
+--  $Id: nws-a-ods.sql,v 1.2.2.1 2010/09/20 10:15:13 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-FeedManager/sql/nws-a-table.sql b/appsrc/ODS-FeedManager/sql/nws-a-table.sql
index f6cb37b..fb2ad13 100644
--- a/appsrc/ODS-FeedManager/sql/nws-a-table.sql
+++ b/appsrc/ODS-FeedManager/sql/nws-a-table.sql
@@ -1,5 +1,5 @@
 --
---  $Id: nws-a-table.sql,v 1.16.2.3 2010/06/09 13:45:58 source Exp $
+--  $Id: nws-a-table.sql,v 1.16.2.8 2011/01/25 14:11:48 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -43,6 +43,7 @@ ENEWS.WA.exec_no_error('
     EF_PSH_SERVER varchar,
     EF_PSH_ENABLED integer default 0,
     EF_PSH_TOKEN varchar,
+    EF_SALMON_SERVER varchar,
     EF_TAG varchar,
     EF_LAST_UPDATE datetime,
     EF_QUEUE_FLAG integer,
@@ -85,6 +86,10 @@ ENEWS.WA.exec_no_error (
   'alter table ENEWS.WA.FEED add EF_PSH_TOKEN varchar', 'C', 'ENEWS.WA.FEED', 'EF_PSH_TOKEN'
 );
 
+ENEWS.WA.exec_no_error (
+  'alter table ENEWS.WA.FEED add EF_SALMON_SERVER varchar', 'C', 'ENEWS.WA.FEED', 'EF_SALMON_SERVER'
+);
+
 
 ENEWS.WA.exec_no_error('
   create trigger FEED_INSERT AFTER INSERT ON ENEWS.WA.FEED referencing new as N {
@@ -98,7 +103,9 @@ ENEWS.WA.exec_no_error('
 
     if ((O.EF_UPDATE_PERIOD <> N.EF_UPDATE_PERIOD) or (O.EF_UPDATE_FREQ <> N.EF_UPDATE_FREQ))
       ENEWS.WA.channel_trigger (N.EF_ID, N.EF_UPDATE_PERIOD, N.EF_UPDATE_FREQ);
-    if ((isnull(O.EF_LAST_UPDATE) and not isnull(N.EF_LAST_UPDATE)) or (O.EF_LAST_UPDATE <> N.EF_LAST_UPDATE)) {
+
+    if ((isnull(O.EF_LAST_UPDATE) and not isnull(N.EF_LAST_UPDATE)) or (O.EF_LAST_UPDATE <> N.EF_LAST_UPDATE))
+    {
       id := N.EF_ID;
       for (select EFD_DOMAIN_ID from ENEWS.WA.FEED_DOMAIN where EFD_FEED_ID = id) do {
         ENEWS.WA.domain_ping (EFD_DOMAIN_ID);
@@ -382,8 +389,10 @@ ENEWS.WA.exec_no_error('
   	EFD_FEED_ID integer not null,
     EFD_TITLE varchar,
     EFD_TAGS varchar,
-  	EFD_FOLDER_ID integer,
+    EFD_GRAPH varchar,
     EFD_FAVOURITE integer,
+  	EFD_FOLDER_ID integer,
+    EFD_ACL long varchar,
 
     constraint FK_FEED_DOMAIN_01 FOREIGN KEY (EFD_FEED_ID) references ENEWS.WA.FEED (EF_ID),
     constraint FK_FEED_DOMAIN_02 FOREIGN KEY (EFD_DOMAIN_ID, EFD_FOLDER_ID) references ENEWS.WA.FOLDER (EFO_DOMAIN_ID, EFO_ID) on delete set null,
@@ -397,6 +406,14 @@ ENEWS.WA.exec_no_error (
   'alter table ENEWS.WA.FEED_DOMAIN add EFD_FAVOURITE integer', 'C', 'ENEWS.WA.FEED_DOMAIN', 'EFD_FAVOURITE'
 );
 
+ENEWS.WA.exec_no_error (
+  'alter table ENEWS.WA.FEED_DOMAIN add EFD_GRAPH varchar', 'C', 'ENEWS.WA.FEED_DOMAIN', 'EFD_GRAPH'
+);
+
+ENEWS.WA.exec_no_error (
+  'alter table ENEWS.WA.FEED_DOMAIN add EFD_ACL long varchar', 'C', 'ENEWS.WA.FEED_DOMAIN', 'EFD_ACL'
+);
+
 ENEWS.WA.exec_no_error('
   create index SK_FEED_DOMAIN_01 on ENEWS.WA.FEED_DOMAIN(EFD_DOMAIN_ID, EFD_FEED_ID)
 ');
diff --git a/appsrc/ODS-FeedManager/sql/nws-a-wa.sql b/appsrc/ODS-FeedManager/sql/nws-a-wa.sql
index 88db237..69654ce 100644
--- a/appsrc/ODS-FeedManager/sql/nws-a-wa.sql
+++ b/appsrc/ODS-FeedManager/sql/nws-a-wa.sql
@@ -1,5 +1,5 @@
 --
---  $Id: nws-a-wa.sql,v 1.7 2008/03/13 20:32:50 source Exp $
+--  $Id: nws-a-wa.sql,v 1.7.2.4 2010/09/22 13:57:03 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -162,6 +162,11 @@ ENEWS.WA.exec_no_error (
 ;
 
 ENEWS.WA.exec_no_error (
+  'alter type wa_eNews2 add overriding method wa_dashboard () returns any'
+)
+;
+
+ENEWS.WA.exec_no_error (
   'alter type wa_eNews2 add method wa_dashboard_last_item () returns any'
 )
 ;
@@ -205,8 +210,15 @@ create method wa_id_string() for wa_eNews2
 --
 create method wa_drop_instance () for wa_eNews2
 {
+  for (select HP_LPATH as _lpath,
+              HP_HOST as _vhost,
+              HP_LISTEN_HOST as _lhost
+         from DB.DBA.HTTP_PATH
+        where HP_LPATH = '/enews2/' || self.eNewsID) do
+  {
+    VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+  }
   ENEWS.WA.domain_delete(self.eNewsID);
-  VHOST_REMOVE(lpath => concat('/enews2/', self.eNewsID));
   (self as web_app).wa_drop_instance();
 }
 ;
@@ -375,14 +387,34 @@ create method get_param (in param varchar) for wa_eNews2
 
 -------------------------------------------------------------------------------
 --
-create method wa_dashboard_last_item () for wa_eNews2
+create method wa_dashboard () for wa_eNews2
 {
-  declare domainID, ownerID integer;
-
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  ownerID := (select WAM_USER from WA_MEMBER B where WAM_INST= self.wa_name and WAM_MEMBER_TYPE = 1);
+  declare iWaiID integer;
+
+  iWaiID := cast (self.eNewsID as integer);
+  return (select XMLAGG ( XMLELEMENT ( 'dash-row',
+                                       XMLATTRIBUTES ( 'normal' as "class",
+                                                       ENEWS.WA.dt_format(_time, 'Y/M/D H:N') as "time",
+                                                       self.wa_name as "application"
+                                                      ),
+                                       XMLELEMENT ( 'dash-data',
+	                                                  XMLATTRIBUTES ( concat (N'<a href="', cast (SIOC..feed_item_iri (_feed_id, _id) as nvarchar), N'">', ENEWS.WA.utf2wide (_title), N'</a>') as "content",
+	                                                                  0 as "comments"
+	                                                                )
+                                          	      )
+                                     )
+                     	  )
+            from ENEWS.WA.dashboard_rs(p0)(_feed_id integer, _id integer, _title varchar, _time datetime, _autor varchar, _mail varchar) x
+           where p0 = iWaiID
+         );
+}
+;
 
-  return ENEWS.WA.dashboard_get (domainID, ownerID);
+-------------------------------------------------------------------------------
+--
+create method wa_dashboard_last_item () for wa_eNews2
+{
+  return ENEWS.WA.dashboard_get (cast (self.eNewsID as integer));
 }
 ;
 
@@ -392,9 +424,8 @@ create method wa_rdf_url (in vhost varchar, in lhost varchar) for wa_eNews2
 {
   declare domainID, ownerID integer;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  ownerID := (select WAM_USER from WA_MEMBER B where WAM_INST= self.wa_name and WAM_MEMBER_TYPE = 1);
-
+  domainID := cast (self.eNewsID as integer);
+  ownerID := ENEWS.WA.domain_owner_id (domainID);
   return concat(ENEWS.WA.dav_url2 (domainID, ownerID), 'OFM.rdf');
 }
 ;
@@ -426,3 +457,40 @@ create method wa_update_instance (in oldValues any, in newValues any) for wa_eNe
   return (self as web_app).wa_update_instance (oldValues, newValues);
 }
 ;
+
+-------------------------------------------------------------------------------
+--
+create procedure ENEWS.WA.path_upgrade ()
+{
+  declare _new_lpath varchar;
+
+  if (registry_get ('news_path_upgrade2') = '1')
+    return;
+
+  for (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_TYPE_NAME = 'eNews2') do
+  {
+    for (select HP_LPATH as _lpath,
+                HP_HOST as _vhost,
+                HP_LISTEN_HOST as _lhost
+           from DB.DBA.HTTP_PATH
+          where HP_LPATH = '/enews2/' || cast (WAI_ID as varchar) || '/news.vsp') do
+    {
+      _new_lpath := '/enews2/' || cast (WAI_ID as varchar);
+      if (exists (select 1 from DB.DBA.HTTP_PATH where HP_LPATH = _new_lpath and HP_HOST  = _vhost and HP_LISTEN_HOST = _lhost))
+      {
+        VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+      } else {
+        update DB.DBA.HTTP_PATH
+           set HP_LPATH = _new_lpath
+         where HP_LPATH = _lpath
+           and HP_HOST  = _vhost
+           and HP_LISTEN_HOST = _lhost;
+        http_map_del (_lpath, _vhost, _lhost);
+        VHOST_MAP_RELOAD (vhost=>_vhost, lhost=>_lhost, lpath=>_new_lpath);
+      }
+    }
+  }
+  registry_set ('news_path_upgrade2', '1');
+}
+;
+ENEWS.WA.path_upgrade ();
diff --git a/appsrc/ODS-FeedManager/sql/nws-d.sql b/appsrc/ODS-FeedManager/sql/nws-d.sql
index 1179e18..5f47610 100644
--- a/appsrc/ODS-FeedManager/sql/nws-d.sql
+++ b/appsrc/ODS-FeedManager/sql/nws-d.sql
@@ -1,5 +1,5 @@
 --
---  $Id: nws-d.sql,v 1.13.2.2 2010/05/31 21:59:15 source Exp $
+--  $Id: nws-d.sql,v 1.13.2.4 2010/09/20 10:15:13 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -54,8 +54,8 @@ create procedure ENEWS.WA.uninstall ()
 ;
 ENEWS.WA.uninstall ()
 ;
-                                                                                            -- Scheduler
-VHOST_REMOVE (lpath => '/enews2');
+
+VHOST_REMOVE (lpath => '/subscriptions');
 
 -- Scheduler
 ENEWS.WA.exec_no_error('DELETE FROM DB.DBA.SYS_SCHEDULED_EVENT WHERE SE_NAME = \'eNews feed aggregator\'');
@@ -102,6 +102,7 @@ registry_remove ('news_table_version');
 registry_remove ('news_index_version');
 registry_remove ('news_links_upgrade');
 registry_remove ('news_comment_upgrade');
+registry_remove ('news_path_upgrade2');
 registry_remove ('__ods_feeds_sioc_init');
 
 -- Procedures
diff --git a/appsrc/ODS-FeedManager/sql/sioc_feeds.sql b/appsrc/ODS-FeedManager/sql/sioc_feeds.sql
index 1fc433e..96d01b8 100644
--- a/appsrc/ODS-FeedManager/sql/sioc_feeds.sql
+++ b/appsrc/ODS-FeedManager/sql/sioc_feeds.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sioc_feeds.sql,v 1.20.2.5 2010/02/10 22:17:03 source Exp $
+--  $Id: sioc_feeds.sql,v 1.20.2.9 2010/10/13 12:14:21 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -24,19 +24,6 @@ use sioc;
 
 -------------------------------------------------------------------------------
 --
--- the same as feeds_iri (wai_name)
-create procedure feed_mgr_iri (
-  inout domain_id integer)
-{
-  declare instance varchar;
-  declare exit handler for not found { return null; };
-  select WAI_NAME into instance from DB.DBA.WA_INSTANCE where WAI_ID = domain_id;
-  return feeds_iri (instance);
-}
-;
-
--------------------------------------------------------------------------------
---
 -- this represents a feed, not an instance
 create procedure feed_iri (
   inout feed_id integer)
@@ -250,6 +237,24 @@ create procedure fill_ods_feeds_sioc (in graph_iri varchar, in site_iri varchar,
   declare id, deadl, cnt any;
 
  {
+    for (select WAI_ID,
+                WAI_TYPE_NAME,
+                WAI_NAME,
+                WAI_ACL
+           from DB.DBA.WA_INSTANCE
+          where ((_wai_name is null) or (WAI_NAME = _wai_name))
+            and WAI_TYPE_NAME = 'eNews2') do
+    {
+      graph_iri := SIOC..acl_graph (WAI_TYPE_NAME, WAI_NAME);
+      exec (sprintf ('sparql clear graph <%s>', graph_iri));
+      SIOC..wa_instance_acl_insert (WAI_TYPE_NAME, WAI_NAME, WAI_ACL);
+      for (select EFD_DOMAIN_ID, EFD_FEED_ID, EFD_ACL
+             from ENEWS.WA.FEED_DOMAIN
+            where EFD_DOMAIN_ID = WAI_ID and EFD_ACL is not null) do
+      {
+        feedDomain_acl_insert (EFD_DOMAIN_ID, EFD_FEED_ID, EFD_ACL);
+      }
+    }
 
     id := -1;
     deadl := 3;
@@ -264,8 +269,8 @@ create procedure fill_ods_feeds_sioc (in graph_iri varchar, in site_iri varchar,
     l0:
 
   for select EFD_ID, EFD_DOMAIN_ID, EFD_FEED_ID, EFD_TITLE, EF_ID, EF_URI, EF_HOME_URI, EF_SOURCE_URI, EF_TITLE, EF_DESCRIPTION
-        from ENEWS..FEED_DOMAIN,
-             ENEWS..FEED,
+          from ENEWS.WA.FEED_DOMAIN,
+               ENEWS.WA.FEED,
              DB.DBA.WA_INSTANCE
          where EFD_ID > id
          and EFD_FEED_ID = EF_ID
@@ -274,7 +279,7 @@ create procedure fill_ods_feeds_sioc (in graph_iri varchar, in site_iri varchar,
          order by EFD_ID do
   {
       iri := feed_iri (EF_ID);
-      m_iri := feed_mgr_iri (EFD_DOMAIN_ID);
+      m_iri := ENEWS.WA.forum_iri (EFD_DOMAIN_ID);
       DB.DBA.ODS_QUAD_URI (graph_iri, iri, rdf_iri ('type'), atom_iri ('Feed'));
       DB.DBA.ODS_QUAD_URI (graph_iri, iri, sioc_iri ('has_parent'), m_iri);
       DB.DBA.ODS_QUAD_URI (graph_iri, m_iri, sioc_iri ('parent_of'), iri);
@@ -352,7 +357,7 @@ create procedure fill_ods_feeds_sioc (in graph_iri varchar, in site_iri varchar,
             where A_OBJECT_ID = EFI_ID) do
       {
         feeds_annotation_insert (graph_iri,
-                                 feed_mgr_iri (A_DOMAIN_ID),
+                                 ENEWS.WA.forum_iri (A_DOMAIN_ID),
                                  A_ID,
                                  A_DOMAIN_ID,
                                  A_OBJECT_ID,
@@ -384,9 +389,10 @@ create trigger FEEDD_SIOC_I after insert on ENEWS..FEED_DOMAIN referencing new a
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
+
   graph_iri := get_graph ();
   iri := feed_iri (N.EFD_FEED_ID);
-  m_iri := feed_mgr_iri (N.EFD_DOMAIN_ID);
+  m_iri := ENEWS.WA.forum_iri (N.EFD_DOMAIN_ID);
   DB.DBA.ODS_QUAD_URI (graph_iri, iri, sioc_iri ('has_parent'), m_iri);
   DB.DBA.ODS_QUAD_URI (graph_iri, m_iri, sioc_iri ('parent_of'), iri);
   DB.DBA.ODS_QUAD_URI (graph_iri, iri, sioc_iri ('has_container'), m_iri);
@@ -403,9 +409,10 @@ create trigger FEEDD_SIOC_D before delete on ENEWS..FEED_DOMAIN referencing old
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
+
   graph_iri := get_graph ();
   iri := feed_iri (O.EFD_FEED_ID);
-  m_iri := feed_mgr_iri (O.EFD_DOMAIN_ID);
+  m_iri := ENEWS.WA.forum_iri (O.EFD_DOMAIN_ID);
   delete_quad_s_p_o (graph_iri, iri, sioc_iri ('has_parent'), m_iri);
   delete_quad_s_p_o (graph_iri, m_iri, sioc_iri ('parent_of'), iri);
   delete_quad_s_p_o (graph_iri, iri, sioc_iri ('has_container'), m_iri);
@@ -415,6 +422,96 @@ create trigger FEEDD_SIOC_D before delete on ENEWS..FEED_DOMAIN referencing old
 
 -------------------------------------------------------------------------------
 --
+create procedure feedDomain_acl_insert (
+  inout domain_id integer,
+  inout feed_id integer,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  iri := SIOC..feed_iri (feed_id);
+  graph_iri := ENEWS.WA.acl_graph (domain_id);
+
+  SIOC..acl_insert (graph_iri, iri, acl);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure feedDomain_acl_delete (
+  inout domain_id integer,
+  inout feed_id integer,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  iri := SIOC..feed_iri (feed_id);
+  graph_iri := ENEWS.WA.acl_graph (domain_id);
+
+  SIOC..acl_delete (graph_iri, iri, acl);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger FEED_DOMAIN_SIOC_ACL_I after insert on ENEWS.WA.FEED_DOMAIN order 100 referencing new as N
+{
+  if (coalesce (N.EFD_ACL, '') <> '')
+  {
+    feedDomain_acl_insert (N.EFD_DOMAIN_ID,
+                           N.EFD_FEED_ID,
+                           N.EFD_ACL);
+
+    SIOC..acl_ping (N.EFD_DOMAIN_ID,
+                    SIOC..feed_iri (N.EFD_FEED_ID),
+                    null,
+                    N.EFD_ACL);
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger FEED_DOMAIN_SIOC_ACL_U after update (EFD_ACL) on ENEWS.WA.FEED_DOMAIN order 100 referencing old as O, new as N
+{
+  if (coalesce (O.EFD_ACL, '') <> '')
+    feedDomain_acl_delete (O.EFD_DOMAIN_ID,
+                           O.EFD_FEED_ID,
+                           O.EFD_ACL);
+
+  if (coalesce (N.EFD_ACL, '') <> '')
+    feedDomain_acl_insert (N.EFD_DOMAIN_ID,
+                           N.EFD_FEED_ID,
+                           N.EFD_ACL);
+
+  SIOC..acl_ping (N.EFD_DOMAIN_ID,
+                  SIOC..feed_iri (N.EFD_FEED_ID),
+                  O.EFD_ACL,
+                  N.EFD_ACL);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger FEED_DOMAIN_SIOC_ACL_D before delete on ENEWS.WA.FEED_DOMAIN order 100 referencing old as O
+{
+  if (coalesce (O.EFD_ACL, '') <> '')
+    feedDomain_acl_delete (O.EFD_DOMAIN_ID,
+                           O.EFD_FEED_ID,
+                           O.EFD_ACL);
+}
+;
+
+-------------------------------------------------------------------------------
+--
 -- ENEWS..FEED_ITEM
 create procedure feeds_item_insert (
   inout feed_id integer,
@@ -923,8 +1020,8 @@ create procedure sioc.DBA.rdf_feeds_view_str ()
         sioc:link sioc:proxy_iri (EF_URI) ;
 	atom:link sioc:proxy_iri (EF_URI) ;
 	atom:title EF_TITLE ;
-	sioc:has_parent sioc:feed_mgr_iri (U_NAME, WAI_NAME) .
-	sioc:feed_mgr_iri (DB.DBA.ODS_FEED_FEED_DOMAIN.U_NAME, DB.DBA.ODS_FEED_FEED_DOMAIN.WAI_NAME)
+	  sioc:has_parent sioc:feeds_iri (WAI_NAME) .
+	  sioc:feeds_iri (DB.DBA.ODS_FEED_FEED_DOMAIN.WAI_NAME)
 	sioc:parent_of sioc:feed_iri (EF_ID) .
 
 	# Posts
diff --git a/appsrc/ODS-FeedManager/www/ajax.vsp b/appsrc/ODS-FeedManager/www/ajax.vsp
index f792988..ecf874a 100644
--- a/appsrc/ODS-FeedManager/www/ajax.vsp
+++ b/appsrc/ODS-FeedManager/www/ajax.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: ajax.vsp,v 1.3.2.1 2009/10/06 10:20:04 source Exp $
+--  $Id: ajax.vsp,v 1.3.2.3 2010/10/07 13:23:02 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -24,12 +24,13 @@
   set http_charset = 'utf-8';
 
   declare N, _domain_id, _account_id integer;
-  declare action, subAction, node, nodePath varchar;
+  declare action, subAction, node, nodePath, _account_rights varchar;
   declare nodes, parts, sessionData, returnData any;
 
   sessionData   := ENEWS.WA.session_restore (params);
-  _domain_id  := cast (get_keyword ('domain_id', sessionData, '0') as integer);
-  _account_id := cast (get_keyword ('user_id', sessionData, '0') as integer);
+  _domain_id  := cast (get_keyword ('domain_id', sessionData) as integer);
+  _account_id := cast (get_keyword ('account_id', sessionData) as integer);
+  _account_rights := get_keyword ('account_rights', sessionData);
 
   returnData := vector();
   action := get_keyword ('a', params, '');
@@ -56,7 +57,7 @@
         parts := split_and_decode (nodePath, 0, '\0\0/');
         node := case when length (parts) then parts[length (parts)-1] else '' end;
       }
-      nodes := ENEWS.WA.enews_tree2 (_domain_id, node, nodePath);
+      nodes := ENEWS.WA.enews_tree (_domain_id, _account_rights, node, nodePath);
       returnData := vector ();
       for (N := 0; N < length (nodes); N := N + 3)
       {
@@ -99,9 +100,8 @@
         }
         itemDraggable := 0;
         if ((nodeType = 'c') or (nodeType = 'b'))
-        {
           itemDraggable := 1;
-        }
+
         returnData := vector_concat (returnData, vector (vector (itemID, itemType, itemLabel, itemPath, itemImage, itemSelected, itemDraggable)));
       }
     }
@@ -151,19 +151,123 @@
       for (select EFD_ID, EFD_TITLE from ENEWS.WA.FEED_DOMAIN where EFD_DOMAIN_ID = _domain_id and EFD_FAVOURITE > 0 order by EFD_TITLE) do
       {
         node := ENEWS.WA.make_node ('c', EFD_ID);
-        nodePath := ENEWS.WA.enews_path2 (_domain_id, node);
+        nodePath := ENEWS.WA.enews_path (_domain_id, node);
         http (sprintf('<span id="pt_favourite_%s"><a class="remove" href="javascript: Feeds.removeFavourite(\'%s\');" alt="Remove" title="Remove">[X]</a> <a href="#" class="nolink3" onclick="javascript: Feeds.selectFavourite(\'%s\'); return false" alt="%s" title="%s" > <img src="%s" border="0" /> %s</a></span>', node, node, nodePath, EFD_TITLE, EFD_TITLE, ENEWS.WA.channel_icon (EFD_ID, 'image/docs_16.gif'), EFD_TITLE));
         http ( ' <br />' );
       }
       for (select EB_ID, EB_NAME from ENEWS.WA.WEBLOG join ENEWS.WA.BLOG on EB_WEBLOG_ID = EW_ID where EW_DOMAIN_ID = _domain_id and EB_FAVOURITE > 0 order by EB_NAME) do
       {
         node := ENEWS.WA.make_node ('b', EB_ID);
-        nodePath := ENEWS.WA.enews_path2 (_domain_id, node);
+        nodePath := ENEWS.WA.enews_path (_domain_id, node);
         http (sprintf('<span id="pt_favourite_%s"><a class="remove" href="javascript: Feeds.removeFavourite(\'%s\');" alt="Remove" title="Remove">[X]</a> <a href="#" class="nolink3" onclick="javascript:  Feeds.selectFavourite(\'%s\'); return false" alt="%s" title="%s" > <img src="%s" border="0" /> %s</a></span>', node, node, nodePath, EB_NAME, EB_NAME, 'image/ods_weblog_16.png', EB_NAME));
         http ( ' <br />' );
       }
     }
   }
+  else if (action = 'load')
+  {
+    declare progressID, progressIndex any;
+
+    progressID := cast (get_keyword ('id', params, msec_time()) as varchar);
+    progressIndex := registry_get ('feed_' || progressID || '_index');
+    if (subAction = 'stop')
+    {
+      registry_set ('feed_' || progressID || '_action', 'stop');
+    }
+    else if (subAction = 'state')
+    {
+      if (not (isinteger(progressIndex) and (progressIndex = 0)))
+      {
+        http_rewrite ();
+        http_header ('Content-Type: text/xml\r\n');
+        http('<root>');
+        http(sprintf('<index>%s</index>', cast (progressIndex as varchar)));
+        http('</root>');
+      }
+    }
+    else if (subAction = 'init')
+    {
+      registry_set ('feed_' || progressID || '_index', '0');
+
+      http_rewrite ();
+      http_header ('Content-Type: text/xml\r\n');
+      http('<root>');
+      http(sprintf('<id>%s</id>', cast (progressID as varchar)));
+      http('</root>');
+
+      -- flush and continue
+      http_flush ();
+
+      declare I, J, N integer;
+      declare dataLength, folder_id, mfolder_id integer;
+      declare feed_id, folder_name, mfolder_name varchar;
+      declare data, rss, title, retrieve, V any;
+
+      retrieve := cast (get_keyword('$_retrieve', params, '1') as integer);
+      mfolder_id := cast (get_keyword('$_mfolder_id', params) as integer);
+      mfolder_name := trim (get_keyword('$_mfolder_name', params));
+
+      -- test folder names & count subscriptions
+      j := length(params);
+      vectorbld_init(V);
+      for (i := 0; i < j; i := i + 2)
+      {
+        if (params[i] like 'cb_item%')
+          vectorbld_acc(V, params[i+1]);
+      }
+      vectorbld_final(V);
+      dataLength := length(V);
+
+      -- dbg_obj_print('start: ', dataLength, now());
+      -- exec subscriptions
+      for (i := 0; i < dataLength; i := i + 1)
+      {
+        if  (cast(registry_get ('feed_' || progressID || '_action') as varchar) = 'stop')
+          goto _stop;
+
+        commit work;
+        registry_set('feed_' || progressID || '_index', cast (i as varchar));
+
+        N := V[i];
+        data := deserialize (decode_base64 (get_keyword ('$_data_'||N, params)));
+        rss := get_keyword ('rss', data, '');
+        if (rss <> '')
+        {
+          for (j := 0; j < length (data); j := j + 1)
+            data[j] := ENEWS.WA.wide2utf(data[j]);
+          title := get_keyword ('title', data);
+
+          feed_id := ENEWS.WA.channel_create (data);
+          if (is_empty_or_null (mfolder_name) and is_empty_or_null (mfolder_id))
+          {
+            folder_name := trim (get_keyword ('$_fname_' || N, params, get_keyword ('folder', data, '')));
+            folder_id := cast (trim (get_keyword ('$_fid_'|| N, params, '')) as integer);
+          } else {
+            folder_name := mfolder_name;
+            folder_id := mfolder_id;
+          }
+          ENEWS.WA.channel_domain (-1, _domain_id, feed_id, ENEWS.WA.wide2utf(title), null, folder_name, folder_id);
+          if ((ENEWS.WA.channel_feeds(feed_id) = 0) or retrieve)
+          {
+            declare continue handler for sqlstate '*'
+            {
+              goto _next;
+            };
+            ENEWS.WA.feed_refresh (feed_id);
+          }
+       }
+      _next:;
+      }
+      registry_set('feed_' || progressID || '_index', cast (dataLength as varchar));
+    _stop:;
+
+      -- update tags
+      ENEWS.WA.tags_refresh(_domain_id, _account_id, 0);
+
+      registry_remove ('feed_' || progressID || '_index');
+      registry_remove ('feed_' || progressID || '_action');
+    }
+  }
   else if (action = 'about')
   {
     http (         '<div style="padding: 1em;">');
diff --git a/appsrc/ODS-FeedManager/www/annotea.vspx b/appsrc/ODS-FeedManager/www/annotea.vspx
index 225cee8..01ee866 100644
--- a/appsrc/ODS-FeedManager/www/annotea.vspx
+++ b/appsrc/ODS-FeedManager/www/annotea.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: annotea.vspx,v 1.8.2.3 2010/03/12 09:13:47 source Exp $
+ -  $Id: annotea.vspx,v 1.8.2.5 2010/10/07 13:23:02 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -53,7 +53,7 @@
     <vm:pagebody>
       <?vsp http(sprintf('<input type="hidden" name="sid"   id="sid"   value="%s" />', get_keyword('sid', self.vc_page.vc_event.ve_params))); ?>
       <?vsp http(sprintf('<input type="hidden" name="realm" id="realm" value="%s" />', get_keyword('realm', self.vc_page.vc_event.ve_params))); ?>
-      <div class="new-form-header">
+      <div class="form-header">
         Free Text Annotation: '<?V ENEWS.WA.utf2wide ((select coalesce(EFI_TITLE, '~ no title ~') from ENEWS.WA.FEED_ITEM where EFI_ID = self.v_oid)) ?>'
       </div>
 
@@ -241,7 +241,7 @@
               </div>
             </div>
           </div>
-          <div class="new-form-footer">
+          <div class="form-footer">
             <v:button action="simple" value="Post" xhtml_title="Post" xhtml_class="button">
                     <v:on-post>
                       <![CDATA[
diff --git a/appsrc/ODS-FeedManager/www/attachment.vsp b/appsrc/ODS-FeedManager/www/attachment.vsp
index e7c1070..e1e3bc7 100644
--- a/appsrc/ODS-FeedManager/www/attachment.vsp
+++ b/appsrc/ODS-FeedManager/www/attachment.vsp
@@ -1,6 +1,6 @@
 <?vsp 
 --  
---  $Id: attachment.vsp,v 1.1 2007/07/26 15:12:26 source Exp $
+--  $Id: attachment.vsp,v 1.1.2.1 2010/09/20 10:15:14 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-FeedManager/www/blog.vspx b/appsrc/ODS-FeedManager/www/blog.vspx
index ec6c445..2bcbed2 100644
--- a/appsrc/ODS-FeedManager/www/blog.vspx
+++ b/appsrc/ODS-FeedManager/www/blog.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: blog.vspx,v 1.7.2.1 2010/01/29 20:21:29 source Exp $
+ -  $Id: blog.vspx,v 1.7.2.3 2010/10/07 13:23:02 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -33,7 +33,7 @@
           <v:variable persist="0" name="step" type="integer" default="0" />
         </vm:variables>
     <vm:pagebody>
-          <div class="new-form-header">
+      <div class="form-header">
             <v:label format="%s" value="--concat(initcap(self.v_mode), ' this')" />
           </div>
           <div class="new-form-body">
@@ -129,7 +129,7 @@
               </v:template>
             </table>
           </div>
-          <div class="new-form-footer">
+      <div class="form-footer">
         <v:button action="simple" value="--either(equ(self.v_mode, 'blog'), 'Post', 'Comment')" enabled="--case when (self.step = 0) then 1 else 0 end" xhtml_class="form-button">
               <v:on-post>
                 <![CDATA[
diff --git a/appsrc/ODS-FeedManager/www/bookmark.vspx b/appsrc/ODS-FeedManager/www/bookmark.vspx
index e665a5a..dbb21b2 100644
--- a/appsrc/ODS-FeedManager/www/bookmark.vspx
+++ b/appsrc/ODS-FeedManager/www/bookmark.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: bookmark.vspx,v 1.5.2.1 2009/12/07 12:33:59 source Exp $
+ -  $Id: bookmark.vspx,v 1.5.2.3 2010/09/20 10:15:14 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -22,7 +22,7 @@
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  -
 -->
-<v:page name="bookmark" decor="template/template.vspx" style="template/template.xsl" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<v:page name="bookmark" decor="template/template.vspx" style="template/template.xsl" fast-render="1" button-anchors="1" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <v:after-data-bind>
     <![CDATA[
       self.url := sprintf('<a onClick="alert(''To drag the button to your toolbar, left click the link and while holding the mouse button down, drag it to the browser toolbar and release the button.''); return false;" href="javascript:location.href=''%schannels_create.vspx?URL=''+location.href">Subscribe with Feed Manager</a>', ENEWS.WA.enews_url(self.domain_id));
diff --git a/appsrc/ODS-FeedManager/www/channels.vspx b/appsrc/ODS-FeedManager/www/channels.vspx
index c12d254..5e061a3 100644
--- a/appsrc/ODS-FeedManager/www/channels.vspx
+++ b/appsrc/ODS-FeedManager/www/channels.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: channels.vspx,v 1.12.2.5 2010/06/09 13:45:58 source Exp $
+ -  $Id: channels.vspx,v 1.12.2.11 2011/01/25 14:11:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -22,7 +22,7 @@
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  -
 -->
-<v:page name="channels" decor="template/template.vspx" style="template/template.xsl" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<v:page name="channels" decor="template/template.vspx" style="template/template.xsl" fast-render="1" button-anchors="1" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <v:method name="sortColumn" arglist="in titleName varchar, in columnName varchar">
     <![CDATA[
       declare altStr, directionStr, imageStr varchar;
@@ -69,9 +69,7 @@
 
   <vm:pagetitle>Feeds</vm:pagetitle>
   <vm:pagewrapper>
-    <vm:header>
-      Feeds
-    </vm:header>
+    <vm:header>Feeds</vm:header>
     <vm:variables>
       <v:variable name="c_order" persist="1" type="varchar" default="'EF_TITLE'" />
       <v:variable name="c_direction" persist="1" type="varchar" default="'asc'" />
@@ -90,16 +88,23 @@
       <v:variable name="v_folder_id" type="varchar" default="'0'"/>
       <v:variable name="v_directory_name" type="varchar" default="''"/>
       <v:variable name="v_directory_id" type="varchar" default="'0'"/>
+      <v:variable name="v_graph" type="varchar" default="''"/>
       <v:variable name="v_psh" type="varchar" default="null"/>
       <v:variable name="v_psh_enabled" type="integer" default="1"/>
+      <v:variable name="v_acl" type="varchar" default="null"/>
     </vm:variables>
     <vm:pagebody>
+      <v:before-render>
+        <![CDATA[
+          self.F1.uf_action := ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels.vspx'));
+        ]]>
+      </v:before-render>
       <v:template name="t1" type="simple" enabled="--either(equ(self.v_mode, ''), 1, 0)">
           <div style="padding: 0 0 0.5em 0;">
-        <v:button action="simple" value="subscribe" xhtml_class="button2" xhtml_alt="Subscribe feed">
+          <v:button name="btn_subscribe" action="simple" value="subscribe" xhtml_class="button2" xhtml_alt="Subscribe feed">
               <v:on-post>
                 <![CDATA[
-                  self.vc_redirect('channels_create.vspx');
+                self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels_create.vspx')));
                 ]]>
               </v:on-post>
             </v:button>
@@ -142,7 +147,7 @@
                     <?vsp self.sortColumn('Retrieved', 'EF_COUNT'); ?>
                   </th>
                   <th width="5%" colspan="2">
-                    <v:label value="Action" format="%s"/>
+                    Action
                   </th>
                 </tr>
               </thead>
@@ -177,7 +182,7 @@
                     <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('EF_COUNT')" format="%d"/>
                   </td>
                   <td nowrap="nowrap">
-                    <v:button value="edit" action="simple" xhtml_class="button" xhtml_alt="edit feed">
+                    <v:button name="btn_edit" value="edit" action="simple" xhtml_class="button" xhtml_alt="edit feed">
                       <v:on-post>
                         <![CDATA[
                           self.v_id := (control.vc_parent as vspx_row_template).te_column_value('EFD_ID');
@@ -188,7 +193,7 @@
                     </v:button>
                   </td>
                   <td nowrap="nowrap">
-                    <v:button value="delete" action="simple" xhtml_onclick="return confirmAction(\'Are you sure that you want to delete this feed?\');" xhtml_class="button" xhtml_alt="Delete feed">
+                    <v:button name="btn_delete" value="delete" action="simple" xhtml_onclick="return confirmAction(\'Are you sure that you want to delete this feed?\');" xhtml_class="button" xhtml_alt="Delete feed">
                       <v:on-post>
                         <![CDATA[
                         ENEWS.WA.channel_delete ((control.vc_parent as vspx_row_template).te_column_value('EFD_ID'));
@@ -197,7 +202,7 @@
                         ]]>
                       </v:on-post>
                     </v:button>
-                    <v:button value="refresh" action="simple" xhtml_class="button" xhtml_alt="Refresh feed">
+                    <v:button name="btn_refresh" value="refresh" action="simple" xhtml_class="button" xhtml_alt="Refresh feed">
                       <v:on-post>
                         <![CDATA[
                           declare exit handler for sqlstate '*' { goto _next; };
@@ -226,7 +231,7 @@
                     &nbsp;
                   </td>
                   <td nowrap="nowrap" class="td_border">
-                    <v:button value="delete" action="simple" xhtml_onclick="javascript: return confirmAction(\'Are you sure that you want to delete selected feed(s)?\', this.form, \'cb_item\', \'No feeds were selected to be deleted.\');" xhtml_class="button" xhtml_alt="Delete selected feed(s)">
+                    <v:button name="btn_delete2" value="delete" action="simple" xhtml_onclick="javascript: return confirmAction(\'Are you sure that you want to delete selected feed(s)?\', this.form, \'cb_item\', \'No feeds were selected to be deleted.\');" xhtml_class="button" xhtml_alt="Delete selected feed(s)">
                       <v:on-post>
                         <![CDATA[
                           declare i integer;
@@ -248,14 +253,17 @@
                         ]]>
                       </v:on-post>
                     </v:button>
-                    <v:button value="refresh" action="simple" xhtml_onclick="javascript: return anySelected(this.form, \'cb_item\', \'No feeds were selected to be refreshed.\');" xhtml_class="button" xhtml_alt="Refresh selected feed(s)">
+                    <v:button name="btn_refresh2" value="refresh" action="simple" xhtml_onclick="javascript: return anySelected(this.form, \'cb_item\', \'No feeds were selected to be refreshed.\');" xhtml_class="button" xhtml_alt="Refresh selected feed(s)">
                       <v:on-post>
                         <![CDATA[
                           declare i integer;
 
-                          for (i := 0; i < length(e.ve_params); i := i + 2) {
-                            if (e.ve_params[i] = 'cb_item') {
-                              declare exit handler for sqlstate '*' {
+                          for (i := 0; i < length(e.ve_params); i := i + 2)
+                          {
+                            if (e.ve_params[i] = 'cb_item')
+                            {
+                              declare exit handler for sqlstate '*'
+                              {
                                 rollback work;
                                 goto _next;
                               };
@@ -279,14 +287,15 @@
                     &nbsp;
                   </td>
                   <td nowrap="nowrap" class="td_border">
-                    <v:button value="delete" action="simple" xhtml_onclick="javascript: return confirmAction(\'Are you sure that you want to delete all feeds?\');" xhtml_class="button" xhtml_alt="Delete all feeds">
+                    <v:button name="btn_delete3" value="delete" action="simple" xhtml_onclick="javascript: return confirmAction(\'Are you sure that you want to delete all feeds?\');" xhtml_class="button" xhtml_alt="Delete all feeds">
                       <v:on-post>
                         <![CDATA[
                         for (select EFD_ID
                                  from ENEWS.WA.FEED
                                    join ENEWS.WA.FEED_DOMAIN EC on EFD_FEED_ID = EF_ID
                                 where EFD_DOMAIN_ID = self.domain_id) do {
-                            declare exit handler for sqlstate '*' {
+                            declare exit handler for sqlstate '*'
+                            {
                               rollback work;
                               goto _next;
                             };
@@ -300,14 +309,15 @@
                         ]]>
                       </v:on-post>
                     </v:button>
-                    <v:button value="refresh" action="simple" xhtml_class="button" xhtml_alt="Refresh all feeds">
+                    <v:button name="btn_refresh3" value="refresh" action="simple" xhtml_class="button" xhtml_alt="Refresh all feeds">
                       <v:on-post>
                         <![CDATA[
                           for (select EF_ID
                                  from ENEWS.WA.FEED ECD
                                    join ENEWS.WA.FEED_DOMAIN on EFD_FEED_ID = EF_ID
                                 where EFD_DOMAIN_ID = self.domain_id) do {
-                            declare exit handler for sqlstate '*' {
+                            declare exit handler for sqlstate '*'
+                            {
                               rollback work;
                               goto _next;
                             };
@@ -356,9 +366,11 @@
                       b.EF_PSH_SERVER,
                       b.EF_PSH_ENABLED,
                       a.EFD_TITLE,
+                      a.EFD_GRAPH,
                       a.EFD_TAGS,
                       a.EFD_FOLDER_ID,
-                      c.EFD_DIRECTORY_ID
+                      c.EFD_DIRECTORY_ID,
+                      a.EFD_ACL
                  into self.v_feed_id,
                       self.v_feed_uri,
                       self.v_home,
@@ -368,9 +380,11 @@
                       self.v_psh,
                       self.v_psh_enabled,
                       self.v_title,
+                      self.v_graph,
                       self.v_tags,
                       self.v_folder_id,
-                      self.v_directory_id
+                      self.v_directory_id,
+                      self.v_acl
                 from ENEWS.WA.FEED_DOMAIN a
                        join ENEWS.WA.FEED b on b.EF_ID = a.EFD_FEED_ID
                           left join ENEWS.WA.FEED_DIRECTORY c on c.EFD_FEED_ID = a.EFD_FEED_ID
@@ -391,13 +405,20 @@
             self.v_folder_name := get_keyword('f_folder_name', params, '');
             self.v_directory_id := get_keyword('f_directory_id', params, '');
             self.v_directory_name := get_keyword('f_directory_name', params, '');
+            self.v_acl := null;
           ]]>
         </v:before-data-bind>
-        <div class="new-form-header">
+        <div class="form-header">
           Feed
         </div>
-        <div class="new-form-body">
-          <table cellspacing="0">
+        <div id="p" class="c1">
+          <div class="tabs">
+             <vm:tabCaption tab="p" tabsCount="2" tabNo="0" caption="Main" />
+             <vm:tabCaption tab="p" tabsCount="2" tabNo="1" caption="Sharing" />
+          </div>
+          <div class="contents">
+            <div id="p_content_0" class="tabContent">
+              <table class="form-body" cellspacing="0">
             <tr>
               <th>
                 <v:label value="Feed URL"/>
@@ -489,6 +510,14 @@
             </v:template>
             <tr>
               <th>
+                    <v:label for="f_graph" value="RDF Graph"/>
+                  </th>
+                  <td>
+                    <v:text name="f_graph" null-value="''" value="--self.v_graph" xhtml_class="textbox" xhtml_size="70%"/>
+                  </td>
+                </tr>
+                <tr>
+                  <th>
                 <v:label for="f_tags" value="Tags"/>
               </th>
               <td>
@@ -518,8 +547,65 @@
             </v:template>
           </table>
         </div>
+            <div id="p_content_1" class="tabContent" style="display: none;">
+              <fieldset>
+                <legend><b>WebID users</b></legend>
+              <table class="form-body" cellspacing="0">
+                <tr>
+                  <td style="width: 90%; background-color: white;">
+                    <table id="s_tbl" width="100%" cellspacing="0">
+                      <thead class="sortHeader">
+                        <tr>
+                          <th width="15%">Type</th>
+                          <th>Value</th>
+                          <th width="1%" nowrap="nowrap">ACL: (R)ead, (W)rite</th>
+                          <th width="50px">Action</th>
+                        </tr>
+                      </thead>
+                		  <![CDATA[
+                		    <script type="text/javascript">
+                        <?vsp
+                          declare N, L integer;
+                          declare acl, aType, aAccess any;
+
+                          L := 0;
+                          acl := (select WAI_ACL from DB.DBA.WA_INSTANCE where WAI_ID = self.domain_id);
+                          acl := case when isnull (acl) then vector () else deserialize (acl) end;
+                          for (N := 0; N < length (acl); N := N + 1)
+                          {
+                            L := L + 1;
+                            http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}, fld_4: {value: "Inherited"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
+                          }
+                          acl := deserialize (self.v_acl);
+                          for (N := 0; N < length (acl); N := N + 1)
+                          {
+                            L := L + 1;
+                            if (self.v_mode <> 'view')
+                            {
+                              http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("s", null, {fld_1: {mode: 50, value: "%s", onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: "F1", tdCssText: "white-space: nowrap;", className: "_validate_ _webid_", value: "%s", readOnly: %s, imgCssText: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', acl[N][2], acl[N][1], case when acl[N][2] = 'public' then 'true' else 'false' end, case when acl[N][2] = 'public' then 'display: none;' else '' end, acl[N][3], acl[N][4], acl[N][5]));
+                            } else {
+                              http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
+                            }
+                          }
+                        ?>
+                		    </script>
+                		  ]]>
+                      <tr id="s_tr_no" style="display: <?V case when L=0 then '' else 'none' end ?>;"><td colspan="<?V case when self.v_mode='view' then 3 else 4 end ?>"><b>No Shares</b></td></tr>
+                		</table>
+                	</td>
+                  <vm:if test="self.v_mode <> 'view'">
+                    <td valign="top" nowrap="nowrap">
+                      <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 50, onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: 'F1', tdCssText: 'white-space: nowrap;', className: '_validate_ _webid_'}, fld_3: {mode: 52, value: [1, 0, 0], tdCssText: 'width: 1%; white-space: nowrap; text-align: center;'}});" />
+                    </td>
+                  </vm:if>
+                </tr>
+              </table>
+              </fieldset>
+            </div>
+          </div>
+        </div>
         <div class="form-footer">
-          <v:button action="simple" value="Save" xhtml_alt="Save feed data" xhtml_class="form-button">
+          <v:button name="btn_save" action="simple" value="Save" xhtml_alt="Save feed data" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
                 declare N, isAdmin integer;
@@ -600,7 +686,9 @@
                 }
 
                 -- domain
-                ENEWS.WA.channel_domain (self.v_id, self.domain_id, self.v_feed_id, self.f_title.ufl_value, self.v_tags, self.v_folder_name, trim(self.f_folder_id.ufl_value));
+                ENEWS.WA.channel_domain (self.v_id, self.domain_id, self.v_feed_id, self.f_title.ufl_value, self.v_tags, self.v_folder_name, trim (self.f_folder_id.ufl_value), self.f_graph.ufl_value);
+                self.v_acl := serialize (DB.DBA.wa_acl_params (params));
+                ENEWS.WA.channel_acl (self.v_id, self.v_acl);
 
                 -- directory
                 if (isAdmin)
@@ -623,7 +711,7 @@
               ]]>
            </v:on-post>
           </v:button>
-          <v:button action="simple" value="Cancel" xhtml_class="form-button">
+          <v:button name="btn_cancel" action="simple" value="Cancel" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
                 self.v_mode := '';
diff --git a/appsrc/ODS-FeedManager/www/channels_create.vspx b/appsrc/ODS-FeedManager/www/channels_create.vspx
index 2a32553..682762c 100644
--- a/appsrc/ODS-FeedManager/www/channels_create.vspx
+++ b/appsrc/ODS-FeedManager/www/channels_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: channels_create.vspx,v 1.14.2.2 2010/06/09 13:45:58 source Exp $
+ -  $Id: channels_create.vspx,v 1.14.2.6 2010/10/13 12:14:21 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -23,7 +23,8 @@
  -
 -->
 
-<v:page name="channels_create" decor="template/template.vspx" style="template/template.xsl" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<v:page name="channels_create" decor="template/template.vspx" style="template/template.xsl" fast-render="1" button-anchors="1" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
   <v:method name="check_url" arglist="in url varchar, in url2 varchar, in type integer, in msg any">
     <![CDATA[
       declare exit handler for sqlstate '*' { goto _error; };
@@ -58,7 +59,8 @@
     _error:
 
       if (retValue = '')
-      if (is_empty_or_null(self.v_data)) {
+        if (is_empty_or_null(self.v_data))
+        {
         retValue := sprintf('Unknown %s.', msg);
       } else if (length(self.v_data) <= 1) {
         retValue := 'Feed(s) source is bad or empty.';
@@ -106,7 +108,8 @@
       declare retValue any;
 
       retValue := vector();
-      while (not is_empty_or_null(id)) {
+      while (not is_empty_or_null(id))
+      {
         name := (select ED_NAME from ENEWS.WA.DIRECTORY where ED_ID = id);
         retValue := vector_concat(vector(vector(concat(name, ' /'), id)), retValue);
         id := (select ED_PARENT_ID from ENEWS.WA.DIRECTORY where ED_ID = id);
@@ -142,6 +145,11 @@
       <v:variable name="v_directory_id" type="integer" default="0" persist="0"/>
     </vm:variables>
     <vm:pagebody>
+      <v:before-render>
+        <![CDATA[
+          self.F1.uf_action := ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels_create.vspx'));
+        ]]>
+      </v:before-render>
       <v:before-data-bind>
         <![CDATA[
           declare params any;
@@ -172,11 +180,8 @@
         ]]>
       </v:before-data-bind>
 
-      <script language="JavaScript" type="text/javascript">
-        var URL = '<?V replace(http_path(), 'channels_create.vspx', 'channels_load.vsp') ?>';
-      </script>
       <v:template type="simple" enabled="-- case when (self.v_step = '0') then 1 else 0 end">
-        <div class="new-form-header">
+        <div class="form-header">
           Select feed source
         </div>
         <div class="new-form-body">
@@ -201,7 +206,7 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" name="Next0" value="Next" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
@@ -224,7 +229,7 @@
           <v:button action="simple" name="Cancel0" value="Cancel" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
-                self.vc_redirect('channels.vspx');
+                self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels.vspx')));
               ]]>
             </v:on-post>
           </v:button>
@@ -232,7 +237,7 @@
       </v:template>
 
       <v:template type="simple" enabled="-- case when ((self.v_step = '1') and (self.v_source <> 3)) then 1 else 0 end">
-        <div class="new-form-header">
+        <div class="form-header">
           <v:label format="%s" value="--'Subscribe feed(s)'" />
         </div>
         <div class="new-form-body">
@@ -427,11 +432,11 @@
             </v:template>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" name="Back1" value="Back" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
-                self.vc_redirect(sprintf('channels_create.vspx?rb=%d',self.v_source));
+                self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, sprintf ('channels_create.vspx?rb=%d', self.v_source))));
               ]]>
             </v:on-post>
           </v:button>
@@ -512,14 +517,14 @@
           </v:button>
           <v:button action="simple" name="Cancel1" value="Cancel" xhtml_class="form-button">
             <v:on-post><![CDATA[
-              self.vc_redirect('channels.vspx');
+              self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels.vspx')));
              ]]></v:on-post>
           </v:button>
         </div>
       </v:template>
 
       <v:template type="simple" enabled="-- case when ((self.v_step = '1') and (self.v_source = 3)) then 1 else 0 end">
-        <div class="new-form-header">
+        <div class="form-header">
           Directory of known (popular) feeds
         </div>
         <input type="hidden" name="directory" value="-1"/>
@@ -625,11 +630,11 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" name="Back2" value="Back" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
-                self.vc_redirect('channels_create.vspx?rb=4');
+                self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels_create.vspx?rb=4')));
               ]]>
             </v:on-post>
           </v:button>
@@ -680,14 +685,14 @@
                   _next:;
                   }
                 }
-                self.vc_redirect('channels.vspx');
+                self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels.vspx')));
               ]]>
             </v:on-post>
           </v:button>
           <v:button action="simple" name="Cancel2" value="Cancel" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
-                self.vc_redirect('channels.vspx');
+                self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels.vspx')));
               ]]>
             </v:on-post>
           </v:button>
@@ -695,7 +700,7 @@
       </v:template>
 
       <v:template type="simple" enabled="-- case when (self.v_step = '2') then 1 else 0 end">
-        <div class="new-form-header">
+        <div class="form-header">
           Autodiscovered Feeds
         </div>
         <div class="new-form-body">
@@ -751,7 +756,7 @@
               http('</div>');
           ?>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" value="Back" xhtml_onclick="javascript:history.back();return false;" xhtml_class="form-button"/>
           <v:button action="simple" value="Check" xhtml_class="form-button">
             <v:on-post>
@@ -792,7 +797,7 @@
           <v:button action="simple" name="Cancel3" value="Cancel" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
-                self.vc_redirect('channels.vspx');
+                self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels.vspx')));
               ]]>
             </v:on-post>
           </v:button>
@@ -800,7 +805,7 @@
       </v:template>
 
       <v:template type="simple" enabled="-- case when (self.v_step = '3') then 1 else 0 end">
-        <div class="new-form-header">
+        <div class="form-header">
           Feed
         </div>
         <div class="new-form-body">
@@ -861,7 +866,7 @@
             </v:template>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" value="Subscribe" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
@@ -908,20 +913,20 @@
                   ENEWS.WA.tags_refresh(self.domain_id, self.account_id, 0);
                 }
               _next:
-                self.vc_redirect('channels.vspx');
+                self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels.vspx')));
                ]]>
              </v:on-post>
           </v:button>
           <v:button action="simple" name="Cancel4" value="Cancel" xhtml_class="form-button">
             <v:on-post><![CDATA[
-              self.vc_redirect('channels.vspx');
+              self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels.vspx')));
              ]]></v:on-post>
           </v:button>
         </div>
       </v:template>
 
       <v:template type="simple" enabled="-- case when (self.v_step like '3.%') then 1 else 0 end">
-        <div class="new-form-header">
+        <div class="form-header">
           <?vsp http(self.v_data[0]); ?> Feeds
         </div>
         <div class="new-form-body">
@@ -1000,7 +1005,7 @@
               http('</div>');
           ?>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" xhtml_id="btn_Back" value="Back" xhtml_onclick="javascript:history.back();return false;" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
@@ -1012,14 +1017,14 @@
           <v:button action="simple" name="btn_Background" xhtml_id="btn_Background" value="Background" xhtml_class="form-button" xhtml_style="display: none;">
             <v:on-post>
               <![CDATA[
-                self.vc_redirect('channels.vspx');
+                self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels.vspx')));
                ]]>
              </v:on-post>
           </v:button>
           <v:button action="simple" xhtml_id="btn_Stop" name="Cancel5" value="Cancel" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
-                self.vc_redirect('channels.vspx');
+                self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels.vspx')));
                ]]>
              </v:on-post>
           </v:button>
@@ -1049,7 +1054,7 @@
           }
         ?>
         </div>
-        <div class="new-form-header">
+        <div class="form-header">
           <?vsp http(self.v_data[0]); ?> Feeds
         </div>
         <div class="new-form-body">
@@ -1067,11 +1072,11 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" xhtml_id="btn_Background" value="Background" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
-                self.vc_redirect('channels.vspx');
+                self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'channels.vspx')));
                ]]>
              </v:on-post>
           </v:button>
@@ -1079,7 +1084,7 @@
         </div>
         <script type="text/javascript">
           <![CDATA[
-            initState();
+            OAT.MSG.attach(OAT, "PAGE_LOADED", initState);
           ]]>
         </script>
       </v:template>
diff --git a/appsrc/ODS-FeedManager/www/channels_load.vsp b/appsrc/ODS-FeedManager/www/channels_load.vsp
deleted file mode 100644
index 7d224a7..0000000
--- a/appsrc/ODS-FeedManager/www/channels_load.vsp
+++ /dev/null
@@ -1,171 +0,0 @@
-<?vsp
---
---  $Id: channels_load.vsp,v 1.11.2.1 2009/11/04 09:43:43 source Exp $
---
---  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
---  project.
---
---  Copyright (C) 1998-2006 OpenLink Software
---
---  This project is free software; you can redistribute it and/or modify it
---  under the terms of the GNU General Public License as published by the
---  Free Software Foundation; only version 2 of the License, dated June 1991.
---
---  This program is distributed in the hope that it will be useful, but
---  WITHOUT ANY WARRANTY; without even the implied warranty of
---  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
---  General Public License for more details.
---
---  You should have received a copy of the GNU General Public License along
---  with this program; if not, write to the Free Software Foundation, Inc.,
---  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
---
-
-  declare domain_id, account_id integer;
-  declare sid, realm any;
-  declare aSession any;
-  declare progressID, progressIndex any;
-
-  sid := get_keyword ('sid', params, '');
-  realm := get_keyword ('realm', params, '');
-
-  aSession   := ENEWS.WA.session_restore (params);
-  domain_id := cast(get_keyword('domain_id', aSession, '0') as integer);
-  account_id := cast(get_keyword('user_id', aSession, '0') as integer);
-  progressID := cast(get_keyword('id', params, msec_time()) as varchar);
-
-  declare exit handler for sqlstate '*'
-  {
-    registry_remove ('feed_' || progressID || '_index');
-    registry_remove ('feed_' || progressID || '_action');
-    return;
-  };
-
-  progressIndex := registry_get ('feed_' || progressID || '_index');
-
-  -- dbg_obj_print(get_keyword ('mode', params, ''), progressID, progressIndex);
-  -- reset
-  if (get_keyword ('mode', params, '') = 'reset')
-  {
-    registry_remove ('feed_' || progressID || '_index');
-    registry_remove ('feed_' || progressID || '_action');
-    registry_set ('feed_' || progressID || '_index', '0');
-
-    http_rewrite ();
-    http_header ('Content-Type: text/xml\r\n');
-    http('<root>');
-    http(sprintf('<id>%s</id>', cast (progressID as varchar)));
-    http('</root>');
-
-    connection_set('stop_execution', '1');
-    return (0);
-  }
-
-  -- stop
-  if (get_keyword ('mode', params, '') = 'stop')
-  {
-    registry_set ('feed_' || progressID || '_action', 'stop');
-
-    connection_set('stop_execution', '1');
-    return (0);
-  }
-
-  -- state
-  if (get_keyword ('mode', params, '') = 'state')
-  {
-    if (not (isinteger(progressIndex) and (progressIndex = 0)))
-    {
-    http_rewrite ();
-    http_header ('Content-Type: text/xml\r\n');
-    http('<root>');
-      http(sprintf('<index>%s</index>', cast (progressIndex as varchar)));
-    http('</root>');
-    }
-
-    connection_set('stop_execution','1');
-    return (0);
-  }
-
-  -- exec
-  if (get_keyword ('mode', params, '') = 'init')
-  {
-    -- flush and continue
-    http_flush ();
-
-    declare I, J, N integer;
-    declare dataLength, folder_id, mfolder_id integer;
-    declare feed_id, folder_name, mfolder_name varchar;
-    declare data, rss, title, retrieve, V any;
-
-    retrieve := cast (get_keyword('$_retrieve', params, '1') as integer);
-    mfolder_id := cast (get_keyword('$_mfolder_id', params) as integer);
-    mfolder_name := trim (get_keyword('$_mfolder_name', params));
-
-    -- test folder names & count subscriptions
-    j := length(params);
-    vectorbld_init(V);
-    for (i := 0; i < j; i := i + 2)
-    {
-      if (params[i] like 'cb_item%')
-        vectorbld_acc(V, params[i+1]);
-    }
-    vectorbld_final(V);
-    dataLength := length(V);
-
-    -- dbg_obj_print('start: ', dataLength, now());
-    -- exec subscriptions
-    prof_enable(1);
-    for (i := 0; i < dataLength; i := i + 1)
-    {
-      if  (cast(registry_get ('feed_' || progressID || '_action') as varchar) = 'stop')
-        goto _stop;
-
-      commit work;
-      registry_set('feed_' || progressID || '_index', cast (i as varchar));
-
-      N := V[i];
-      data := deserialize (decode_base64 (get_keyword ('$_data_'||N, params)));
-      rss := get_keyword ('rss', data, '');
-      if (rss <> '')
-      {
-        for (j := 0; j < length (data); j := j + 1)
-          data[j] := ENEWS.WA.wide2utf(data[j]);
-        title := get_keyword ('title', data);
-
-          feed_id := ENEWS.WA.channel_create(data);
-        if (is_empty_or_null (mfolder_name) and is_empty_or_null (mfolder_id))
-        {
-          folder_name := trim (get_keyword ('$_fname_' || N, params, get_keyword ('folder', data, '')));
-          folder_id := cast (trim (get_keyword ('$_fid_'|| N, params, '')) as integer);
-        } else {
-          folder_name := mfolder_name;
-          folder_id := mfolder_id;
-        }
-        ENEWS.WA.channel_domain (-1, domain_id, feed_id, ENEWS.WA.wide2utf(title), null, folder_name, folder_id);
-        if ((ENEWS.WA.channel_feeds(feed_id) = 0) or retrieve)
-          {
-          declare continue handler for sqlstate '*'
-          {
-            goto _next;
-          };
-              ENEWS.WA.feed_refresh(feed_id);
-          }
-        }
-      _next:;
-      }
-    registry_set('feed_' || progressID || '_index', cast (dataLength as varchar));
-  _stop:;
-
-    prof_enable(0);
-    -- update tags
-    ENEWS.WA.tags_refresh(domain_id, account_id, 0);
-
-    -- dbg_obj_print('end: ', dataLength, now());
-
-    registry_remove ('feed_' || progressID || '_index');
-    registry_remove ('feed_' || progressID || '_action');
-
-    connection_set('stop_execution', '1');
-    return (0);
-  }
-?>
diff --git a/appsrc/ODS-FeedManager/www/channels_select.vspx b/appsrc/ODS-FeedManager/www/channels_select.vspx
index ba00c69..7cfea00 100644
--- a/appsrc/ODS-FeedManager/www/channels_select.vspx
+++ b/appsrc/ODS-FeedManager/www/channels_select.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: channels_select.vspx,v 1.6.2.1 2010/02/10 22:17:03 source Exp $
+ -  $Id: channels_select.vspx,v 1.6.2.2 2010/09/20 10:15:14 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-FeedManager/www/conversation.vspx b/appsrc/ODS-FeedManager/www/conversation.vspx
index 00cb5c6..0518b9c 100644
--- a/appsrc/ODS-FeedManager/www/conversation.vspx
+++ b/appsrc/ODS-FeedManager/www/conversation.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: conversation.vspx,v 1.13.2.1 2010/01/29 20:21:29 source Exp $
+ -  $Id: conversation.vspx,v 1.13.2.3 2010/10/07 13:23:03 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -67,7 +67,7 @@
       <?vsp http(sprintf('<input type="hidden" name="sid"   id="sid"   value="%s" />', get_keyword('sid', self.vc_page.vc_event.ve_params))); ?>
       <?vsp http(sprintf('<input type="hidden" name="realm" id="realm" value="%s" />', get_keyword('realm', self.vc_page.vc_event.ve_params))); ?>
       <?vsp http(sprintf('<input type="hidden" name="user_name" id="user_name" value="%s" />', ENEWS.WA.account_name (self.account_id))); ?>
-          <div class="new-form-header">
+      <div class="form-header">
         Discussion
           </div>
           <div class="new-form-body">
diff --git a/appsrc/ODS-FeedManager/www/css/style.css b/appsrc/ODS-FeedManager/www/css/style.css
index 9cb3373..6d10078 100644
--- a/appsrc/ODS-FeedManager/www/css/style.css
+++ b/appsrc/ODS-FeedManager/www/css/style.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: style.css,v 1.26.2.5 2010/04/15 18:46:36 source Exp $
+ *  $Id: style.css,v 1.26.2.8 2010/10/07 13:23:04 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -20,49 +20,40 @@
  *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  *  
  */
-
-body
-{
+body {
   padding: 0;
   margin: 0;
   font-family: Verdana, Arial, Helvetica, Sans-Serif;
   font-size: 9pt;
 }
 
-.pointer
-{
+.pointer {
   cursor: pointer;
 }
 
-a
-{
+a {
   text-decoration: none
 }
 
-a:active
-{
+a:active {
   text-decoration: none;
 }
 
-a:visited
-{
+a:visited {
   text-decoration: none;
 }
 
-a:hover
-{
+a:hover {
   text-decoration: underline;
 }
 
-.link
-{
+.link {
   color: blue;
 	cursor: pointer;
 }
 
 /* Header */
-#HD
-{
+#HD {
   width: 100%;
   margin: 0;
   padding: 0;
@@ -71,8 +62,7 @@ a:hover
   background-color: #fff;
 }
 
-div.app_page_hdr
-{
+div.app_page_hdr {
   height: 60px;
   width: 100%;
   padding: 0 10px 0 0;
@@ -82,10 +72,11 @@ div.app_page_hdr
   text-align: right;
 }
 
-img.hdr_img { float: left;}
+img.hdr_img {
+  float: left;
+}
 
-div.app_hdr_cmds_ctr
-{
+div.app_hdr_cmds_ctr {
   margin-top: 10px;
   float: right;
   clear: right;
@@ -99,60 +90,24 @@ div.app_hdr_cmds_ctr
   width: 100%;
   padding: 0;
   margin: 0 0 4px 4px;
-  border: 0}
-
-h1.page_hd {
-  clear: both;
-  margin: 0;
-  height: 60px;
-  padding: 10px 20px 0 0;
-  color: #888;
-  background-image: url("images/ods_banner.jpg");
-  background-repeat: no-repeat;
-  background-position: top left;
-  text-align: right;
+  border: 0;
 }
 
 #LT {
   float: left;
   clear: left;
   width: 450px;
-  margin: 0}
+  margin: 0;'
+}
 
 #RT {
   float: left;
   clear: right;
-  margin: 0 5px 0 0}
-
-/* Footer */
-
-#FT1 {
-  width: 100%;
-  position: relative;
-  bottom: 0px;
-  font-size: 8pt;
-  float: left;
-  clear: both;
-  text-align: right;
-  border-top: 1px solid black;
-  background-color: #86b9d9
-}
-
-#FT_L1 {
-  float: left;
-  clear: left
-}
-
-#FT_R1 {
-  padding-right: 10px;
-  float: right;
-  clear: right
+  margin: 0 5px 0 0;
 }
 
 /* Footer */
-
-#FT
-{
+#FT {
   width: 100%;
   position: relative;
   bottom: 0px;
@@ -166,8 +121,7 @@ h1.page_hd {
   background-image: url(../image/ods_main_footer.png);
 }
 
-#FT_L
-{
+#FT_L {
   float: left;
   clear: left;
   margin-top: 10px;
@@ -175,8 +129,7 @@ h1.page_hd {
   border: 1px solid #788;
 }
 
-#FT_R
-{
+#FT_R {
   float: right;
   clear: right;
   margin-top: 10px;
@@ -185,42 +138,35 @@ h1.page_hd {
   color: #788;
 }
 
-#FT_R a
-{
+#FT_R a {
   text-decoration: none;
   color: inherit;
 }
 
-#MTB
-{
+#MTB {
   width: 100%;
   left: 0px;
   right: 0px;
 }
 
-#LC
-{
+#LC {
   width: 170px;
   padding-top: 5px;
   vertical-align: top;
 }
 
-#RC
-{
+#RC {
   padding-top: 5px;
   vertical-align: top;
 }
 
 /* Left side within MT */
-
-.page_head
-{
+.page_head {
   width: 100%;
   background-color: #b0cde4;
 }
 
-.left_container
-{
+.left_container {
   background-color: #EFEFEF;
   border: 1px solid #7f94a5;
   -moz-border-radius: 5px;
@@ -230,26 +176,22 @@ h1.page_hd {
   width: auto;
 }
 
-.left_container div, .left_container a
-{
+.left_container div, .left_container a {
   display: block;
   padding: 3px;
 	margin: 3px;
 }
 
-.left_container a
-{
+.left_container a {
   text-decoration: none;
 }
 
-.left_container a:hover
-{
+.left_container a:hover {
   color: black;
   background: #99b3c5;
 }
 
-.navigator_info
-{
+.navigator_info {
   font-size: smaller;
 }
 
@@ -272,47 +214,39 @@ h1.page_hd {
 	text-decoration: underline;
 }
 
-.copyright
-{
+.copyright {
   font-size: 75%;
   text-align: right;
   padding-right: 5px;
   border-top: 1px solid silver;
 }
 
-.system_info
-{
+.system_info {
   font-size: 75%;
 }
 
-.page_title
-{
+.page_title {
   font-size: 12pt;
   font-weight: bold;
 }
 
-.main_page_area
-{
+.main_page_area {
   padding-top: 5px;
   background-color: white;
   width: 100%;
 }
 
-.page_section_head
-{
+.page_section_head {
   font-size: 12pt;
   font-weight: bold;
 }
 
-table.sub_page_area
-{
+table.sub_page_area {
   width: 100%;
 }
 
 /* Label */
-
-.error
-{
+.error {
   color: red;
   font-weight: bold;
   margin: 3px 0px 3px 0px;
@@ -321,34 +255,14 @@ table.sub_page_area
   text-align: center;
 }
 
-.error_text
-{
+.error_text {
   color: red;
   font-weight: bold;
   text-align: center;
 }
 
-.attention_marker
-{
-  color: #ff0033;
-}
-
-.subpage_header_area
-{
-  margin: 3px 0px 3px 0px;
-  border: 1pt solid silver;
-}
-
-.page_header_area
-{
-  border: 1pt solid silver;
-  position: relative;
-  bottom:15pt;
-}
-
 /* The main navigation bar */
-.nav_bar
-{
+.nav_bar {
   display: block;
   padding: 0;
   margin: 0;
@@ -356,23 +270,19 @@ table.sub_page_area
   font-size: 0.9em;
 }
 
-.nav_bar td.sel
-{
+.nav_bar td.sel {
 }
 
-.nav_bar td
-{
+.nav_bar td {
   background: #ddd;
 }
 
-.nav_bar td.filler
-{
+.nav_bar td.filler {
   background: #b0cde4;
   width: 100%;
 }
 
-.nav_bar a
-{
+.nav_bar a {
   display: block;
   color: #444;
   text-decoration: none;
@@ -388,14 +298,12 @@ table.sub_page_area
   white-space: nowrap;
 }
 
-.nav_bar a.les
-{
+.nav_bar a.les {
   background: #b0cde4;
   background-image: url(../image/sel_nav_grad2.gif);
 }
 
-.nav_bar a.les:hover
-{
+.nav_bar a.les:hover {
   color: black;
   background: #99b3c5;
 }
@@ -403,11 +311,10 @@ table.sub_page_area
 .nav_bar a:hover,
 .nav_bar a:active,
 .nav_bar a.sel:link,
-.nav_bar a.sel:visited
-{
+.nav_bar a.sel:visited {
   background: #b0cde4;
   background-image: url(../image/sel_nav_grad2.gif);
-  color: #000;
+  color: #000000;
 }
 
 .nav_seperator {
@@ -419,29 +326,23 @@ table.sub_page_area
   color: #b0cde4;
 }
 
-/*
-  Fields
-*/
-input[readonly]
-{
+/* Fields */
+input[readonly] {
   background: #EFEFEF;
 }
 
-.readonly
-{
+.readonly {
   background: #EFEFEF;
 }
 
-/*====== lists ======*/
-table#list
-{
+/* lists */
+table#list {
   width: 100%;
   border: solid #7f94a5;
   border-width: 1px 1px 2px 1px;
 }
 
-table#list th
-{
+table#list th {
   font-size: 0.9em;
   font-weight: bold;
   text-align: center;
@@ -451,8 +352,7 @@ table#list th
   border-width: 0px 1px 1px 0px;
 }
 
-table#list th:last-child
-{
+table#list th:last-child {
   border-width: 0px 0px 1px 0px;
 }
 
@@ -463,9 +363,8 @@ table#list thead input {
   background-color: #b0cde4;
 }
 
-/*====== trees ======*/
-.tree_main
-{
+/* trees */
+.tree_main {
   border: solid #7f94a5;
   border-width: 1px 1px 1px 1px;
   padding: 3px;
@@ -474,16 +373,14 @@ table#list thead input {
   font-weight: bold;
 }
 
-/*====== Panes ======*/
-.pane_main
-{
+/* Panes */
+.pane_main {
   width: 100%;
   min-height: 500px;
   position: relative;
 }
 
-#pane_left
-{
+#pane_left {
   width: 30.0%;
   height: 100%;
   float: left;
@@ -492,16 +389,14 @@ table#list thead input {
   border-width: 1px
 }
 
-#pane_right
-{
+#pane_right {
   width: 69.3%;
   height: 100%;
   float: left;
   margin-left: 0.15%;
 }
 
-#pane_right_top
-{
+#pane_right_top {
   width: 100%;
   height: 49.5%;
   overflow: auto;
@@ -509,8 +404,7 @@ table#list thead input {
   border-width: 1px
 }
 
-#pane_right_bottom
-{
+#pane_right_bottom {
   width: 100%;
   height: 49.5%;
   margin-top: 0.4%;
@@ -519,8 +413,7 @@ table#list thead input {
   border-width: 1px
 }
 
-#pane_right2
-{
+#pane_right2 {
   width: 19.55%;
   height: 100%;
   float: right;
@@ -530,9 +423,8 @@ table#list thead input {
   margin-left: 0.15%;
 }
 
-/*====== news ======*/
-#feed_header
-{
+/* news */
+#feed_header {
   width: auto;
   font-size: 1em;
   padding: 3px 0 3px 0;
@@ -541,8 +433,7 @@ table#list thead input {
   border-width: 0px 0px 1px 0px;
 }
 
-#feed_subheader
-{
+#feed_subheader {
   width: auto;
   font-size: 0.9em;
   padding: 2px 0 2px 0;
@@ -551,14 +442,12 @@ table#list thead input {
   border-width: 0px 0px 1px 0px;
 }
 
-#feed_body
-{
+#feed_body {
   width: auto;
   padding: 3px 0px 0px 3px;
 }
 
-#feed_gems
-{
+#feed_gems {
   width: auto;
   font-size: 0.9em;
   padding: 3px 0px 0px 3px;
@@ -567,17 +456,14 @@ table#list thead input {
   border-width: 0px 0px 1px 0px;
 }
 
-.read
-{
+.read {
 }
 
-.unread
-{
+.unread {
   font-weight: bold;
 }
 
-#channel_header
-{
+#channel_header {
   font-size: 1em;
   font-weight: bold;
   background-color: #b0cde4;
@@ -585,20 +471,17 @@ table#list thead input {
   border-width: 0px 0px 1px 0px;
 }
 
-#channel_header_left
-{
+#channel_header_left {
   float: left;
   padding: 3px;
 }
 
-#channel_header_right
-{
+#channel_header_right {
   float: right;
   padding: 3px;
 }
 
-#channel_subheader
-{
+#channel_subheader {
   font-size: 0.9em;
   padding: 3px 0 3px 3px;
   padding-top: 2px;
@@ -607,48 +490,33 @@ table#list thead input {
   border-width: 0px 0px 1px 0px;
 }
 
-table#feed
-{
+table#feed {
   font-size: 0.9em;
 }
 
-/*====== rows ======*/
-.td_border
-{
+/* rows */
+.td_border {
   border: solid #7f94a5;
   border-width: 1px 0px 1px 0px;
 }
 
-.tr_0
-{
+.tr_0 {
   background-color: #EFEFEF;
 }
 
-.tr_1
-{
+.tr_1 {
 }
 
-.tr_1:hover, .tr_0:hover
-{
+.tr_1:hover, .tr_0:hover {
  	background-color: #eec;
 }
 
-.tr_select
-{
+.tr_select {
   background-color: #FFFFCC;
 }
 
-/*====== forms ======*/
-.body-scroll
-{
-  background-color: white;
-  height: 30em;
-  width: auto;
-  overflow: auto;
-}
-
-.from-button
-{
+/* forms */
+.from-button {
   margin: .8em 0 .8em 0;
   font-size: .8em;
 	font-family: verdana, sans-serif;
@@ -707,8 +575,7 @@ input.nolink4 {
   background-color: #b0cde4;
 }
 
-.FM_bold
-{
+.FM_bold {
   font-weight: bold;
 }
 
@@ -739,8 +606,7 @@ input.nolink4 {
 }
 
 
-.pane-label
-{
+.pane-label {
   font-weight: bold;
   background-color: #EFEFEF;
   border: 1px solid #000;
@@ -754,8 +620,7 @@ input.nolink4 {
 }
 
 /* New */
-.form-header
-{
+.form-header {
   font-size: 1.1em;
   font-weight: bold;
   margin: 0 0 6px 0;
@@ -765,8 +630,7 @@ input.nolink4 {
   background-color: #b0cde4;
 }
 
-.form-footer
-{
+.form-footer {
   margin: 6px 0px;
   text-align: center;
   height: 20px;
@@ -776,58 +640,30 @@ input.nolink4 {
   background-color: #b0cde4;
 }
 
-.form-header
-{
-  font-size: 13px;
-  font-weight: bold;
-  margin: 0 0 8px 0;
-  padding: 0px 0px 3px 4px;
-  border: solid #7f94a5;
-  border-width: 1px 1px 1px 10px;
-  background-color: #b0cde4;
-}
-
-.form-footer
-{
-  margin: 6px 0px;
-  text-align: center;
-  border: solid 1px #7f94a5;
-  background-color: #b0cde4;
-  height: 20px;
-  padding-top: 0px;
-  padding-bottom: 2px;
-}
-
-.form-body
-{
+.form-body {
   width: 100%;
   font-size: 1em;
 }
 
-.form-body td
-{
+.form-body td {
   padding: 2px;
 }
 
-.form-body th
-{
+.form-body th {
   text-align: right;
   padding: 4px;
 }
 
-.td_label
-{
+.td_label {
   text-align: right;
   padding-right: 1em;
 }
 
-.td_simple
-{
+.td_simple {
   border-width: 0px 0px 0px 0px;
 }
 
-.tab_page
-{
+.tab_page {
   font-size: 10pt;
   border-width: 1px 1px 1px 1px;
   background-color: white;
@@ -838,42 +674,17 @@ input.nolink4 {
   height: 100%;
 }
 
-.clear
-{
+.clear {
   width: 100%;
   padding: 0px;
   border-width: 0;
 }
 
-.clear td
-{
+.clear td {
   padding: 0px;
   border-width: 0;
 }
 
-.form-body2
-{
-  width: 100%;
-  border: solid #7f94a5;
-  border-width: 1px 1px 2px 1px;
-  background-color: #EFEFEF;
-}
-
-.form-body2-td
-{
-  padding: 2px;
-  border: solid #7f94a5;
-  border-width: 0px 1px 1px 0px;
-}
-
-.form-body2-th
-{
-  text-align: right;
-  padding: 4px;
-  border: solid #7f94a5;
-  border-width: 0px 1px 1px 0px;
-}
-
 div.boxHeader {
   background-color: #EFEFEF;
   margin: 0 0 0.5em 0;
@@ -882,28 +693,23 @@ div.boxHeader {
   vertical-align: middle;
 }
 
-/*====== Grids ======*/
-.FM_grid
-{
+/* Grids */
+.FM_grid {
   width: 100%;
   border: solid #7f94a5;
   border-width: 1px 1px 2px 1px;
 }
 
-FM_grid td
-{
+FM_grid td {
   padding: 2px 4px 2px 4px;
 }
 
-thead.sortHeader tr
-{
+thead.sortHeader tr {
   background-image: url(../image/stl_blu1_grad.gif);
   background-repeat: repeat-x;
 }
 
-/* make the TH elements pretty */
-thead.sortHeader tr th
-{
+thead.sortHeader tr th {
   font-size: 1em;
   font-weight: bold;
   text-align: left;
@@ -912,27 +718,22 @@ thead.sortHeader tr th
   border-width: 0px 1px 1px 0px;
 }
 
-thead.sortHeader th.checkbox
-{
+thead.sortHeader th.checkbox {
   text-align: center;
   padding: 0;
 }
 
-thead.sortHeader th:last-child
-{
+thead.sortHeader th:last-child {
   border-width: 0px 0px 1px 0px;
 }
 
-thead.sortHeader th.image
-{
+thead.sortHeader th.image {
   padding: 0px;
   text-align: center;
   vertical-align: middle;
 }
 
-/* make the A elements pretty. makes for nice clickable headers                */
-thead.sortHeader a, thead.sortHeader a:link, thead.sortHeader a:visited
-{
+thead.sortHeader a, thead.sortHeader a:link, thead.sortHeader a:visited {
   color: #000;
   font-weight: bold;
 	display: block;
@@ -940,10 +741,7 @@ thead.sortHeader a, thead.sortHeader a:link, thead.sortHeader a:visited
 	width: 100%
 }
 
-/* make the A elements pretty. makes for nice clickable headers                */
-/* WARNING: swapping the background on hover may cause problems in WinIE 6.x   */
-thead.sortHeader a:hover
-{
+thead.sortHeader a:hover {
   color: #000;
   font-weight: bold;
 	display: block;
@@ -951,30 +749,8 @@ thead.sortHeader a:hover
 	width: 100%
 }
 
-/*====== New forms ======*/
-.new-form-header
-{
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 0 0 6px 0;
-  padding: 0px 0px 2px 4px;
-  border: solid #7f94a5;
-  border-width: 1px 1px 1px 10px;
-  background-color: #b0cde4;
-}
-
-.new-form-footer
-{
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 6px 0 0 0;
-  text-align: center;
-  border: solid 1px #7f94a5;
-  background-color: #b0cde4;
-}
-
-.new-form-body
-{
+/* New forms */
+.new-form-body {
   font-size: 1em;
   padding: 6px;
   border: solid #7f94a5;
@@ -982,38 +758,28 @@ thead.sortHeader a:hover
   background-color: #EFEFEF;
 }
 
-.no-border
-{
-  border-width: 0;
-}
-
-.new-form-body table
-{
+.new-form-body table {
   width: 100%;
   background-color: #EFEFEF;
 }
 
-.new-form-body table td
-{
+.new-form-body table td {
   padding: 2px;
 }
 
-.new-form-body table td.text
-{
+.new-form-body table td.text {
   font-style: italic;
   font-weight: bold;
   padding: 2px;
 }
 
-.new-form-body table th
-{
+.new-form-body table th {
   text-align: right;
   white-space: nowrap;
   padding: 4px;
 }
 
-.text
-{
+.text {
   font-style: italic;
   font-weight: bold;
   padding: 2px;
@@ -1022,7 +788,6 @@ thead.sortHeader a:hover
 /* tabs */
 div.c1 {
   width:100%;
-  padding-top:0.5em;
 }
 
 div.tabs {
@@ -1079,6 +844,10 @@ span.tab {
   border: 1px solid #000;
   border-bottom-width: 0px;
   border-color: #7f94a5;
+  -moz-border-radius-topleft: 3px;
+  -moz-border-radius-topright: 3px;
+  -webkit-border-top-left-radius: 3px;
+  -webkit-border-top-right-radius: 3px;
   padding: 2px 10px 2px 10px;
   position: relative;
   text-decoration: none;
@@ -1086,8 +855,7 @@ span.tab {
   z-index: 100;
 }
 
-a.remove
-{
+a.remove {
   color: red;
   font-weight: bold;
   font-size: 10px;
@@ -1190,21 +958,18 @@ div.menu div.menuItemSep {
 }
 
 /* Comments */
-div.cm_node_top
-{
+div.cm_node_top {
   padding-left: 1em;
   margin-left: 0px;
 }
 
-div.cm_node
-{
+div.cm_node {
   padding-left: 1em;
   margin-left: 0px;
   border-left: 2px #e0e0e0 solid;
 }
 
-div.comment-section
-{
+div.comment-section {
   padding: 0 0px 0 2px;
   font-size: 1.1em;
   font-weight: bold;
@@ -1213,25 +978,21 @@ div.comment-section
   background-color: #b0cde4;
 }
 
-div.comment
-{
+div.comment {
   margin-top: 5px;
 }
 
-div.comment-footer
-{
+div.comment-footer {
     margin: 1px;
     color: gray;
 }
 
-div.comment-header
-{
+div.comment-header {
    border-bottom: 1px #cccccc solid;
   font-size: 1.1em;
 }
 
-div.comment-button
-{
+div.comment-button {
   margin: 1px;
   padding-top: 5px;
   border-top: 1px #cccccc solid;
@@ -1292,3 +1053,23 @@ font-weight:bold;
 #pane_left .tree_ul_selected {
 font-weight:normal !important;
 }
+
+.pointer {
+  cursor: pointer;
+}
+
+span.button {
+  background: none repeat scroll 0 0 #99B3C5;
+  border: 1px solid #7F94A5;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  color: #FFFFFF;
+  font-size: 0.8em;
+  font-weight: bold;
+  padding: 3px 4px 1px;
+  text-decoration:none;
+}
+
+img.button {
+  margin-bottom: -3px;
+}
diff --git a/appsrc/ODS-FeedManager/www/directories.vspx b/appsrc/ODS-FeedManager/www/directories.vspx
index 9561921..24a5d43 100644
--- a/appsrc/ODS-FeedManager/www/directories.vspx
+++ b/appsrc/ODS-FeedManager/www/directories.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: directories.vspx,v 1.6.2.1 2009/12/17 10:55:57 source Exp $
+ -  $Id: directories.vspx,v 1.6.2.5 2010/10/13 12:14:21 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -36,6 +36,11 @@
       <v:variable persist="session" name="dt_bookmark" type="varchar" default="null" />
     </vm:variables>
     <vm:pagebody>
+      <v:before-render>
+        <![CDATA[
+          self.F1.uf_action := ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'directories.vspx'));
+        ]]>
+      </v:before-render>
     	<v:on-post>
         <![CDATA[
       	  if (e.ve_button is not null)  {
@@ -179,7 +184,7 @@
             self.v_name := get_keyword('f_name', self.vc_page.vc_event.ve_params, '');
           ]]>
         </v:before-data-bind>
-        <div class="new-form-header">
+        <div class="form-header">
           <v:label format="%s" value="--concat(initcap(self.v_mode), ' directory')"/>
         </div>
         <div class="new-form-body">
@@ -202,7 +207,7 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" value="Save" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
diff --git a/appsrc/ODS-FeedManager/www/enews_login.vspx b/appsrc/ODS-FeedManager/www/enews_login.vspx
index 6f5398b..dce8090 100644
--- a/appsrc/ODS-FeedManager/www/enews_login.vspx
+++ b/appsrc/ODS-FeedManager/www/enews_login.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: enews_login.vspx,v 1.5.2.1 2009/12/07 12:33:59 source Exp $
+ -  $Id: enews_login.vspx,v 1.5.2.5 2010/10/07 13:23:03 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -34,18 +34,24 @@
       page_name := ENEWS.WA.page_name ();
       if (page_name = 'error.vspx')
         return;
-      if (ENEWS.WA.check_grants2(self.account_role, page_name))
+
+      if (ENEWS.WA.check_grants (self.account_rights, page_name))
         return;
 
+      if (isnull (self.account_rights) and not is_empty_or_null (self.sid))
+      {
+         self.vc_redirect (sprintf ('/ods/error.vspx?__PAGE=%U&__SQL_STATE=%U&__SQL_MESSAGE=%U', 'home.vspx', '23023', 'You have no access rights for the application!'));
+         return;
+      }
+
       declare vh, lh, hf, ods_path any;
 
       vh := http_map_get ('vhost');
       lh := http_map_get ('lhost');
       hf := http_request_header (lines, 'Host');
-
       if (hf is not null and exists (select 1 from HTTP_PATH where HP_HOST = vh and HP_LISTEN_HOST = lh and HP_LPATH = '/ods'))
       {
-        ods_path := 'http://' || hf || '/ods/';
+        ods_path := DB.DBA.WA_GET_PROTOCOL() || hf || '/ods/';
       } else {
         ods_path := DB.DBA.WA_LINK (1, '/ods/');
       }
@@ -54,12 +60,13 @@
         self.vc_redirect(sprintf('%slogin.vspx?URL=%U', ods_path, concat(HTTP_REQUESTED_URL(), '?URL=', get_keyword('URL', params, ''))));
         return;
       }
-      if (self.account_role = 'expire')
+      if (isnull (self.account_rights))
       {
         http_request_status ('HTTP/1.1 302 Found');
         http_header (sprintf('Location: %slogin.vspx?URL=%U\r\n', ods_path, HTTP_REQUESTED_URL()));;
         return;
       }
+      if (page_name <> 'news.vspx')
       self.vc_redirect('news.vspx');
     ]]>
   </v:after-data-bind>
diff --git a/appsrc/ODS-FeedManager/www/enews_navigation.vspx b/appsrc/ODS-FeedManager/www/enews_navigation.vspx
deleted file mode 100644
index 249cb2b..0000000
--- a/appsrc/ODS-FeedManager/www/enews_navigation.vspx
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="iso8859-1"?>
-<!--
- -
- -  $Id: enews_navigation.vspx,v 1.6 2008/01/30 00:04:33 source Exp $
- -
- -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- -  project.
- -
- -  Copyright (C) 1998-2006 OpenLink Software
- -
- -  This project is free software; you can redistribute it and/or modify it
- -  under the terms of the GNU General Public License as published by the
- -  Free Software Foundation; only version 2 of the License, dated June 1991.
- -
- -  This program is distributed in the hope that it will be useful, but
- -  WITHOUT ANY WARRANTY; without even the implied warranty of
- -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- -  General Public License for more details.
- -
- -  You should have received a copy of the GNU General Public License along
- -  with this program; if not, write to the Free Software Foundation, Inc.,
- -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- -
--->
-<v:page name="nav_bar_page" on-error-redirect="error.vspx" fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro">
-  <v:variable name="nav_pos_fixed" type="int" default="0" />
-  <v:variable name="nav_top" type="int" default="0"/>
-  <v:variable name="nav_tip" type="varchar" default="''"/>
-  <v:variable name="domain_id" type="integer" default="-1"/>
-  <v:variable name="account_id" type="integer" default="-1"/>
-  <v:variable name="account_role" type="varchar" default="'public'"/>
-  <v:variable name="accountName" type="varchar" default="'Public User'"/>
-  <v:variable name="settings" type="any" />
-
-  <v:method name="set_pmembers" arglist="">
-    <![CDATA[
-      udt_set (self.vc_parent.vc_page, 'nav_pos_fixed', self.nav_pos_fixed);
-      udt_set (self.vc_parent.vc_page, 'nav_top', self.nav_top);
-      udt_set (self.vc_parent.vc_page, 'nav_tip', self.nav_tip);
-      return;
-    ]]>
-  </v:method>
-  <v:before-data-bind>
-    <![CDATA[
-      self.vc_authenticated := self.vc_parent.vc_page.vc_authenticated;
-      self.sid := udt_get (self.vc_parent.vc_page, 'sid');
-      self.realm := udt_get (self.vc_parent.vc_page, 'realm');
-      self.domain_id := udt_get (self.vc_parent.vc_page, 'domain_id');
-      self.account_id := udt_get (self.vc_parent.vc_page, 'account_id');
-      self.account_role := udt_get (self.vc_parent.vc_page, 'account_role');
-      self.accountName := udt_get (self.vc_parent.vc_page, 'accountName');
-      self.settings := udt_get (self.vc_parent.vc_page, 'settings');
-      return;
-    ]]>
-  </v:before-data-bind>
-  <v:tree show-root="0" multi-branch="0" orientation="horizontal" start-path="--cast(self.domain_id as varchar) || '/' || cast(self.account_id as varchar)" root="ENEWS.WA.navigation_root" child-function="ENEWS.WA.navigation_child">
-    <v:before-data-bind>
-      <![CDATA[
-        declare page_name any;
-
-        page_name := ENEWS.WA.page_name ();
-        self.nav_pos_fixed := 0;
-        if (page_name = 'error.vspx')
-        {
-          self.nav_pos_fixed := 1;
-        } else if (not self.nav_top and page_name <> '') {
-          self.nav_pos_fixed := ENEWS.WA.check_grants2 (self.account_role, page_name);
-          control.vc_open_at (sprintf ('//*[@url = "%s"]', page_name));
-        }
-        self.set_pmembers ();
-      ]]>
-    </v:before-data-bind>
-    <v:node-template>
-	    <td nowrap="nowrap" class="<?V case when control.tn_open then 'sel' else '' end ?>">
-        <v:button action="simple" style="url" xhtml_class="--(case when (control.vc_parent as vspx_tree_node).tn_open = 1 then 'sel' else '' end)" value="--(control.vc_parent as vspx_tree_node).tn_value" xhtml_title="--(control.vc_parent as vspx_tree_node).tn_value">
-          <v:after-data-bind>
-	          <![CDATA[
-              if ((control.vc_parent as vspx_tree_node).tn_open = 1)
-              {
-                control.ufl_active := 0;
-              } else {
-                control.ufl_active := ENEWS.WA.check_grants2(self.account_role, ENEWS.WA.page_name ());
-              }
-            ]]>
-          </v:after-data-bind>
-          <v:on-post>
-            <![CDATA[
-              declare node vspx_tree_node;
-              declare tree vspx_control;
-              self.nav_tip := xpath_eval('/node/@tip', (control.vc_parent as vspx_tree_node).tn_element, 1);
-              self.nav_pos_fixed := 0;
-              node := control.vc_parent;
-              tree := node.tn_tree;
-              node.tn_tree.vt_open_at := NULL;
-              self.nav_top := 1;
-              tree.vc_data_bind (e);
-              self.set_pmembers ();
-            ]]>
-        	</v:on-post>
-	      </v:button>
-      </td>
-    </v:node-template>
-    <v:leaf-template>
-      <td nowrap="nowrap" class="<?V case when control.tn_open then 'sel' else '' end ?>">
-        <v:button action="simple" style="url" xhtml_class="--case when (control.vc_parent as vspx_tree_node).tn_open = 1 then 'sel' else '' end" value="--(control.vc_parent as vspx_tree_node).tn_value" xhtml_title="--(control.vc_parent as vspx_tree_node).tn_value" />
-      </td>
-    </v:leaf-template>
-    <v:horizontal-template>
-	    <table class="nav_bar" cellspacing="0" cellpadding="0">
-	      <tr>
-	        <v:node-set />
-	        <?vsp
-	          if ((control as vspx_tree).vt_node <> control) {
-	        ?>
-	        <td class="filler"> </td>
-	        <?vsp } ?>
-	      </tr>
-	    </table>
-  	  <?vsp
-    	  if ((control as vspx_tree).vt_node = control and not length (childs)) {
-    	?>
-      <div class="nav_bar nav_seperator" >x</div>
-  	  <?vsp } ?>
-    </v:horizontal-template>
-  </v:tree>
-</v:page>
diff --git a/appsrc/ODS-FeedManager/www/error.vspx b/appsrc/ODS-FeedManager/www/error.vspx
index 9ee7daa..b69ea73 100644
--- a/appsrc/ODS-FeedManager/www/error.vspx
+++ b/appsrc/ODS-FeedManager/www/error.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: error.vspx,v 1.5 2007/05/31 08:31:40 source Exp $
+ -  $Id: error.vspx,v 1.5.2.1 2010/09/20 10:15:15 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-FeedManager/www/export.vspx b/appsrc/ODS-FeedManager/www/export.vspx
index b9cb3fe..9411552 100644
--- a/appsrc/ODS-FeedManager/www/export.vspx
+++ b/appsrc/ODS-FeedManager/www/export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: export.vspx,v 1.10.2.2 2010/05/31 21:59:15 source Exp $
+ -  $Id: export.vspx,v 1.10.2.5 2010/10/07 13:23:03 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -22,7 +22,7 @@
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  -
 -->
-<v:page name="export" xmlns:v="http://www.openlinksw.com/vspx/" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<v:page name="export" fast-render="1" button-anchors="1" xmlns:v="http://www.openlinksw.com/vspx/" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <v:variable name="v_mode" type="varchar" default="''" param-name="mode"/>
 
   <v:variable name="domain_id" type="integer" default="-1"/>
@@ -89,7 +89,7 @@
         if (length(xpath_eval('//entry', data, 0)) = 0)
           goto _error;
 
-    	  sql := ENEWS.WA.sfolder_sql(self.domain_id, self.account_id, data, self.v_type, self.v_max);
+    	  sql := ENEWS.WA.sfolder_sql(self.domain_id, self.account_id, 'R', data, self.v_type, self.v_max);
         sql := concat(sql, 'order by ', self.v_order, ' ', self.v_direction);
 
         state := '00000';
diff --git a/appsrc/ODS-FeedManager/www/folders.vspx b/appsrc/ODS-FeedManager/www/folders.vspx
index d7d88e6..cb81e0d 100644
--- a/appsrc/ODS-FeedManager/www/folders.vspx
+++ b/appsrc/ODS-FeedManager/www/folders.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: folders.vspx,v 1.6 2007/09/13 14:41:39 source Exp $
+ -  $Id: folders.vspx,v 1.6.2.4 2010/10/13 12:14:21 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -25,7 +25,6 @@
 <v:page name="folders" decor="template/template.vspx" style="template/template.xsl" fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <vm:pagetitle>Folders</vm:pagetitle>
   <vm:pagewrapper>
-    <vm:header/>
     <vm:variables>
       <v:variable name="v_id" param-name="id" type="integer" default="0"/>
       <v:variable name="v_parent_id" type="varchar" default="'0'"/>
@@ -35,6 +34,11 @@
       <v:variable persist="session" name="ft_bookmark" type="varchar" default="null" />
     </vm:variables>
     <vm:pagebody>
+      <v:before-render>
+        <![CDATA[
+          self.F1.uf_action := ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'folders.vspx'));
+        ]]>
+      </v:before-render>
       <v:on-post>
         <![CDATA[
           if (e.ve_button is not null) {
@@ -184,7 +188,7 @@
             self.v_name := get_keyword('f_name', self.vc_page.vc_event.ve_params, '');
           ]]>
         </v:before-data-bind>
-        <div class="new-form-header">
+        <div class="form-header">
           <v:label format="%s" value="--concat(initcap(self.v_mode), ' folder')"/>
         </div>
         <div class="new-form-body">
@@ -207,7 +211,7 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" value="Save" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
diff --git a/appsrc/ODS-FeedManager/www/gems.vsp b/appsrc/ODS-FeedManager/www/gems.vsp
index b22f49b..a4d5e12 100644
--- a/appsrc/ODS-FeedManager/www/gems.vsp
+++ b/appsrc/ODS-FeedManager/www/gems.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: gems.vsp,v 1.1.2.1 2010/05/31 21:59:15 source Exp $
+--  $Id: gems.vsp,v 1.1.2.3 2010/10/07 13:23:03 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -35,30 +35,8 @@
     if (not _authorized)
     {
       _authorized := 1;
-      _authorizeVector := DB.DBA.vsp_auth_vec (http_request_header());
-      if (_authorizeVector = 0)
-      {
-        _authorized := 0;
-      } else {
-        if (get_keyword ('authtype', _authorizeVector) <> 'basic')
-        {
+      if (not ODS..ods_check_auth (_user, _domain_id, 'reader'))
           _authorized := 0;
-        } else {
-          _user := get_keyword ('username', _authorizeVector, '');
-          _password := get_keyword ('pass', _authorizeVector, '');
-          if (not DB.DBA.web_user_password_check (_user, _password))
-          {
-            _authorized := 0;
-          } else {
-            _user_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = _user);
-            _role := ENEWS.WA.access_role (_domain_id, _user_id);
-            if (_role not in ('admin', 'owner'))
-            {
-              _authorized := 0;
-            }
-          }
-        }
-      }
     }
     http_rewrite ();
     if (not _authorized)
diff --git a/appsrc/ODS-FeedManager/www/image/folder.gif b/appsrc/ODS-FeedManager/www/image/folder.gif
deleted file mode 100644
index cdbb887..0000000
Binary files a/appsrc/ODS-FeedManager/www/image/folder.gif and /dev/null differ
diff --git a/appsrc/ODS-FeedManager/www/image/home_16.png b/appsrc/ODS-FeedManager/www/image/home_16.png
deleted file mode 100644
index 3525b0b..0000000
Binary files a/appsrc/ODS-FeedManager/www/image/home_16.png and /dev/null differ
diff --git a/appsrc/ODS-FeedManager/www/image/html.gif b/appsrc/ODS-FeedManager/www/image/html.gif
deleted file mode 100644
index 311370d..0000000
Binary files a/appsrc/ODS-FeedManager/www/image/html.gif and /dev/null differ
diff --git a/appsrc/ODS-FeedManager/www/image/minus.gif b/appsrc/ODS-FeedManager/www/image/minus.gif
deleted file mode 100644
index e3dd648..0000000
Binary files a/appsrc/ODS-FeedManager/www/image/minus.gif and /dev/null differ
diff --git a/appsrc/ODS-FeedManager/www/image/plus.gif b/appsrc/ODS-FeedManager/www/image/plus.gif
deleted file mode 100644
index 2886456..0000000
Binary files a/appsrc/ODS-FeedManager/www/image/plus.gif and /dev/null differ
diff --git a/appsrc/ODS-FeedManager/www/item.vspx b/appsrc/ODS-FeedManager/www/item.vspx
index 7740893..77cc5ad 100644
--- a/appsrc/ODS-FeedManager/www/item.vspx
+++ b/appsrc/ODS-FeedManager/www/item.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: item.vspx,v 1.4.2.2 2010/02/18 10:07:06 source Exp $
+ -  $Id: item.vspx,v 1.4.2.4 2010/10/07 13:23:03 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -38,7 +38,7 @@
           declare sessionInfo any;
 
           sessionInfo := ENEWS.WA.session_restore (self.vc_event.ve_params);
-          if (get_keyword('user_role', sessionInfo, '') = 'expire')
+        if (isnull (get_keyword ('account_rights', sessionInfo)))
           {
             http('<script type="text/javascript">parent.document.forms[\'F1\'].submit();</script>');
             goto _end;
@@ -46,7 +46,7 @@
           sid := get_keyword('sid', self.vc_event.ve_params, '');
           realm := get_keyword('realm', self.vc_event.ve_params, '');
           domain_id := get_keyword('domain_id', sessionInfo);
-          account_id := get_keyword('user_id', sessionInfo);
+        account_id := get_keyword ('account_id', sessionInfo);
 
           item_id := atoi(get_keyword('fid', self.vc_event.ve_params));
           mode := get_keyword('m', self.vc_event.ve_params, 'channel');
@@ -65,7 +65,7 @@
           if ((mode = 'c') and (domain_id < 0))
           {
             for (select EFI_ID,
-                        ENEWS.WA.show_title(ENEWS.WA.wide2utf(EFI_TITLE)) EFI_TITLE,
+                      ENEWS.WA.show_title (EFI_TITLE) EFI_TITLE,
                         ENEWS.WA.show_description(EFI_DESCRIPTION) DESCRIPTION,
                         EFI_PUBLISH_DATE,
                         EFI_LAST_UPDATE,
@@ -77,7 +77,7 @@
                         EF_ID,
                         EF_URI,
                         EF_HOME_URI,
-                        ENEWS.WA.wide2utf(EF_TITLE) EFD_TITLE
+                      EF_TITLE EFD_TITLE
                    from ENEWS.WA.FEED_ITEM
                      join ENEWS.WA.FEED on EF_ID = EFI_FEED_ID
                        left join ENEWS.WA.FEED_ITEM_DATA on EFID_ITEM_ID = EFI_ID and EFID_DOMAIN_ID is null and EFID_ACCOUNT_ID is null
@@ -86,15 +86,15 @@
               declare lt, ut, en, rt, ft, mt, bt, ct, tt varchar;
               if (isnull(EFI_LINK))
               {
-                lt := sprintf('%s', EFI_TITLE);
+              lt := EFI_TITLE;
               } else {
                 lt := sprintf('<a id="v_item_%d" target="_blank" href="%s" title="%s" class="%s" about="%U">%s</a>', EFI_ID, EFI_LINK, EFI_TITLE, 'app', SIOC..feed_item_iri (EF_ID, EFI_ID), EFI_TITLE);
               }
               if (isnull(EF_HOME_URI))
               {
-                ut := sprintf('%s', EFD_TITLE);
+              ut := EFD_TITLE;
               } else {
-                ut := sprintf('<a id="v_feed_%d" target="_blank" href="%s" title="%s" class="%s" about="%U">%s</a>', EF_ID, EF_URI, EFD_TITLE, 'app', SIOC..feed_iri (EF_ID), EFD_TITLE);
+              ut := sprintf ('<a id="v_feed_%d" target="_blank" href="%s" title="%s" class="%s" about="%U">%V</a>', EF_ID, EF_URI, EFD_TITLE, 'app', SIOC..feed_iri (EF_ID), EFD_TITLE);
               }
               en := ENEWS.WA.feed_enclosure(EFI_ID);
               if (isnull(en))
@@ -171,7 +171,7 @@
             }
 
             for (select EFI_ID,
-                        ENEWS.WA.show_title(ENEWS.WA.wide2utf(EFI_TITLE)) EFI_TITLE,
+                      ENEWS.WA.show_title (EFI_TITLE) EFI_TITLE,
                         ENEWS.WA.show_description(EFI_DESCRIPTION) DESCRIPTION,
                         EFI_PUBLISH_DATE,
                         EFI_LAST_UPDATE,
@@ -183,7 +183,7 @@
                         EF_ID,
                         EF_URI,
                         EF_HOME_URI,
-                         ENEWS.WA.wide2utf(EFD_TITLE) EFD_TITLE
+                      EFD_TITLE
                      from ENEWS.WA.FEED_ITEM
                        join ENEWS.WA.FEED on EF_ID = EFI_FEED_ID
                          left join ENEWS.WA.FEED_ITEM_DATA on EFID_ITEM_ID = EFI_ID and EFID_ACCOUNT_ID = account_id
@@ -193,13 +193,13 @@
               declare lt, ut, en, rt, ft, mt, bt, ct, tt, cv, an varchar;
               if (isnull(EFI_LINK))
               {
-                lt := sprintf('%s', EFI_TITLE);
+              lt := EFI_TITLE;
               } else {
                 lt := sprintf('<a id="v_item_%d" target="_blank" href="%s" title="%s" class="%s" about="%U">%s</a>', EFI_ID, EFI_LINK, EFI_TITLE, 'app', SIOC..feed_item_iri (EF_ID, EFI_ID), EFI_TITLE);
               }
               if (isnull(EF_HOME_URI))
               {
-                ut := sprintf('%s', EFD_TITLE);
+              ut := EFD_TITLE;
               } else {
                 ut := sprintf('<a id="v_feed_%d" target="_blank" href="%s" title="%s" class="%s" about="%U">%s</a>', EF_ID, EF_URI, EFD_TITLE, 'app', SIOC..feed_iri (EF_ID), EFD_TITLE);
               }
@@ -246,23 +246,22 @@
               {
                 if (coalesce(EFID_READ_FLAG, 0) = 1)
                 {
-                rt := sprintf(' | <span onclick="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s" class="link">%s</span>', EFI_ID, 'r0', mode, 'Mark unread', 'Unread');
+                rt := sprintf (' | <span onclick="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s" class="link">%s</span>', EFI_ID, mode, 'r0', 'Mark unread', 'Unread');
                 } else {
-                rt := sprintf(' | <span onclick="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s" class="link">%s</span>', EFI_ID, 'r1', mode, 'Mark read', 'Read');
+                rt := sprintf (' | <span onclick="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s" class="link">%s</span>', EFI_ID, mode, 'r1', 'Mark read', 'Read');
                 }
                 if (coalesce(EFID_KEEP_FLAG, 0) = 1)
                 {
-                ft := sprintf(' | <span onclick="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s" class="link">%s</span>', EFI_ID, 'f0', mode, 'Unflag This', 'Unflag');
+                ft := sprintf (' | <span onclick="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s" class="link">%s</span>', EFI_ID, mode, 'f0', 'Unflag This', 'Unflag');
                 } else {
-                ft := sprintf(' | <span onclick="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s" class="link">%s</span>', EFI_ID, 'f1', mode, 'Flag This', 'Flag');
+                ft := sprintf (' | <span onclick="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s" class="link">%s</span>', EFI_ID, mode, 'f1', 'Flag This', 'Flag');
                 }
 
                 -- Blog this
                 if (ENEWS.WA.blog_check(domain_id))
                 bt := sprintf(' | <span onclick="javascript: window.open(\'blog.vspx?sid=%s&realm=%s&did=%d&aid=%d&fid=%d\', \'\', \'width=640,height=450\'); return false;" title="%s" class="link">%s</span>', sid, realm, domain_id, account_id, EFI_ID, 'Blog This', 'Blog');
-
-                -- Tags
               }
+            -- Tags
               tt := '';
               if (account_id >= 0)
               tt := tt || sprintf('<span onclick="javascript: window.open(\'tags.vspx?sid=%s&realm=%s&did=%d&aid=%d&fid=%d\', \'\', \'width=640,height=450\'); return false;" class="link" title="Revise tags">(Revise)</span>: <input type="text" name="tag"/>%s <span onclick="javascript: myPost(\'F1\', \'atag\', \'+\'); parent.Feeds.loadTags(); return false" class="link"><img src="image/add_16.png" border="0" alt="Add Tag" title="Add Tag" /></span>', sid, realm, domain_id, account_id, EFI_ID, tagError);
@@ -335,13 +334,13 @@
               declare lt, ut, en, rt, ft, mt, tt varchar;
               if (isnull(EFI_LINK))
               {
-                lt := sprintf('%s', EFI_TITLE);
+              lt := EFI_TITLE;
               } else {
                 lt := sprintf('<a target="_blank" href="%s" title="%s">%s</a>', EFI_LINK, EFI_TITLE, EFI_TITLE);
               }
               if (isnull(EF_HOME_URI))
               {
-                ut := sprintf('%s', EFD_TITLE);
+              ut := EFD_TITLE;
               } else {
                 ut := sprintf('<a target="_blank" href="%s" title="%s">%s</a>', EF_HOME_URI, EFD_TITLE, EFD_TITLE);
               }
@@ -354,15 +353,15 @@
               }
               if (coalesce(EFID_READ_FLAG, 0) = 1)
               {
-                rt := sprintf(' | <a href="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s">%s</a>', EFI_ID, 'r0', mode, 'Mark unread', 'Unread');
+              rt := sprintf (' | <a href="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s">%s</a>', EFI_ID, mode, 'r0', 'Mark unread', 'Unread');
               } else {
-                rt := sprintf(' | <a href="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s">%s</a>', EFI_ID, 'r1', mode, 'Mark read', 'Read');
+              rt := sprintf (' | <a href="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s">%s</a>', EFI_ID, mode, 'r1', 'Mark read', 'Read');
               }
               if (coalesce(EFID_KEEP_FLAG, 0) = 1)
               {
-                ft := sprintf(' | <a href="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s">%s</a>', EFI_ID, 'f0', mode, 'Unflag This', 'Unflag');
+              ft := sprintf (' | <a href="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s">%s</a>', EFI_ID, mode, 'f0', 'Unflag This', 'Unflag');
               } else {
-                ft := sprintf(' | <a href="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s">%s</a>', EFI_ID, 'f1', mode, 'Flag This', 'Flag');
+              ft := sprintf (' | <a href="javascript: loadFromIFrame(\'%d\', \'%s\', \'%s\');" title="%s">%s</a>', EFI_ID, mode, 'f1', 'Flag This', 'Flag');
               }
               http(sprintf('<div id="feed_header"> <b>Post</b>: <i>%s</i> | <b>Author</b>: <i>%s</i> | <b>Feed</b>: <i>%s</i>%s</div>', lt, author, ut, en));
               http(sprintf('<div id="feed_subheader"> <b>Posted on</b>: <i>%s</i>, <b>Updated on</b>: <i>%s</i>%s %s</div>', ENEWS.WA.rdfa_value (ENEWS.WA.dt_value (EFI_PUBLISH_DATE, EFI_LAST_UPDATE, account_name), 'dct:created'), ENEWS.WA.rdfa_value (ENEWS.WA.dt_value (EFI_LAST_UPDATE, null, account_name), 'dct:modified'), rt, ft));
diff --git a/appsrc/ODS-FeedManager/www/items.vspx b/appsrc/ODS-FeedManager/www/items.vspx
index dd8202f..f1b844e 100644
--- a/appsrc/ODS-FeedManager/www/items.vspx
+++ b/appsrc/ODS-FeedManager/www/items.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: items.vspx,v 1.3.2.2 2010/02/18 10:07:06 source Exp $
+ -  $Id: items.vspx,v 1.3.2.5 2010/10/13 12:14:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -63,7 +63,7 @@
 
   <v:method name="linkClass" arglist="inout flag any">
     <![CDATA[
-      if (self.account_role in ('public', 'guest'))
+      if (self.account_rights <> 'W')
         return 'unread';
       return either( equ (flag, 1), 'read', 'unread');
     ]]>
@@ -139,7 +139,7 @@
       <v:data-source name="dsrc" expression-type="sql" nrows="0" initial-offset="0">
         <v:before-data-bind>
           <![CDATA[
-            declare read_flag, keep_flag varchar;
+            declare sql, flag, read_flag, keep_flag varchar;
             declare data, node_type, node_id any;
 
             node_id := ENEWS.WA.node_id (self.fNode);
@@ -152,7 +152,7 @@
 
             if ((node_type = 'c') and (self.domain_id < 0))
             {
-              control.ds_sql := 'select top 10
+              sql := 'select top 10
                                         EFI_ID,
                                         EFI_TITLE,
                                         ENEWS.WA.show_author(EFI_AUTHOR) EFI_AUTHOR,
@@ -165,12 +165,11 @@
                                             left join ENEWS.WA.FEED_ITEM_DATA on EFID_ITEM_ID = EFI_ID and EFID_DOMAIN_ID is null and EFID_ACCOUNT_ID is null
                                   where EF_ID = %d
                                     and coalesce(EFI_DELETE_FLAG, 0) <> 1';
-              control.ds_sql := sprintf (control.ds_sql, node_id);
-
+              sql := sprintf (sql, node_id);
             }
             else if ((node_type = 'c') and (self.domain_id > 0))
             {
-              control.ds_sql := 'select EFI_ID,
+              sql := 'select EFI_ID,
                                         EFI_TITLE,
                                         ENEWS.WA.show_author(EFI_AUTHOR) EFI_AUTHOR,
                                         EFI_PUBLISH_DATE,
@@ -182,24 +181,24 @@
                                             left join ENEWS.WA.FEED_ITEM_DATA on EFID_ITEM_ID = EFI_ID and EFID_ACCOUNT_ID = %d
                                   where EFD_ID = %d
                                     and coalesce(EFI_DELETE_FLAG, 0) <> 1';
-              control.ds_sql := sprintf (control.ds_sql, self.account_id, node_id);
+              sql := sprintf (sql, self.account_id, node_id);
             }
             else if (node_type = 'f')
             {
               if (node_id <> -1)
                 ENEWS.WA.xml_set('folder', data, node_id);
-              control.ds_sql := ENEWS.WA.sfolder_sql(self.domain_id, self.account_id, data);
+              sql := ENEWS.WA.sfolder_sql(self.domain_id, self.account_id, self.account_rights, data);
             }
             else if ((node_type = 's') and (node_id <> -1))
             {
               data := (select ESFO_DATA from ENEWS.WA.SFOLDER where ESFO_DOMAIN_ID = self.domain_id and ESFO_ID = node_id);
-              control.ds_sql := ENEWS.WA.sfolder_sql(self.domain_id, self.account_id, data);
+              sql := ENEWS.WA.sfolder_sql (self.domain_id, self.account_id, self.account_rights, data);
             }
             else if (node_type = 'b')
             {
               read_flag := 'EBPD_READ_FLAG';
               keep_flag := 'EBPD_KEEP_FLAG';
-              control.ds_sql := 'select EBP_ID EFI_ID,
+              sql := 'select EBP_ID EFI_ID,
                                         (EBP_META as BLOG..MWeblogPost).title EFI_TITLE,
                                         ENEWS.WA.show_author((EBP_META as BLOG..MWeblogPost).author) EFI_AUTHOR,
                                         coalesce((EBP_META as BLOG..MWeblogPost).dateCreated, now()) EFI_PUBLISH_DATE,
@@ -212,12 +211,12 @@
                                               left join ENEWS.WA.BLOG_POST_DATA on EBPD_POST_ID = EBP_ID
                                   where EW_DOMAIN_ID = %d
                                     and EB_ID = %d';
-              control.ds_sql := sprintf (control.ds_sql, self.domain_id, node_id);
+              sql := sprintf (sql, self.domain_id, node_id);
             }
             else if ((node_type = 't') and not is_empty_or_null(ENEWS.WA.node_suffix(self.fNode)))
             {
               ENEWS.WA.xml_set('tags', data, ENEWS.WA.node_suffix(self.fNode));
-              control.ds_sql := ENEWS.WA.sfolder_sql(self.domain_id, self.account_id, data);
+              sql := ENEWS.WA.sfolder_sql (self.domain_id, self.account_id, self.account_rights, data);
 
             }
             else
@@ -225,21 +224,18 @@
               control.ds_sql := 'select * from ENEWS.WA.BLOG where 1=0';
               goto _end;
             }
-
-            declare flag varchar;
-
             flag := get_keyword('show', params, '');
             if (flag = 'r1')
-              control.ds_sql := concat(control.ds_sql, sprintf (' and coalesce(%s, 0) = 1', read_flag));
+              sql := concat(sql, sprintf (' and coalesce(%s, 0) = 1', read_flag));
             else if (flag = 'r0')
-              control.ds_sql := concat(control.ds_sql, sprintf (' and coalesce(%s, 0) = 0', read_flag));
+              sql := concat(sql, sprintf (' and coalesce(%s, 0) = 0', read_flag));
             else if (flag = 'f1')
-              control.ds_sql := concat(control.ds_sql, sprintf (' and coalesce(%s, 0) = 1', keep_flag));
+              sql := concat(sql, sprintf (' and coalesce(%s, 0) = 1', keep_flag));
             else if (flag = 'f0')
-              control.ds_sql := concat(control.ds_sql, sprintf (' and coalesce(%s, 0) = 0', keep_flag));
+              sql := concat(sql, sprintf (' and coalesce(%s, 0) = 0', keep_flag));
 
             self.sortChange(get_keyword('sortColumn', e.ve_params, ''));
-            control.ds_sql := concat(control.ds_sql, ' order by ', self.n_order, ' ', self.n_direction, ', EFI_ID');
+            control.ds_sql := concat(sql, ' order by ', self.n_order, ' ', self.n_direction, ', EFI_ID');
           _end:;
           ]]>
         </v:before-data-bind>
@@ -257,9 +253,9 @@
             node_id := ENEWS.WA.node_id (self.fNode);
             node_type := ENEWS.WA.node_type (self.fNode);
 
-            mt := sprintf ('<b>Selected as</b> <select name="mark" onchange="javascript: if (anySelected(this.form, \'cb_item\', \'No posts were selected to mark as \'+this.options[this.selectedIndex].text+\'.\')) {this.form.submit();} else {this.selectedIndex = 0}"><option/><option value="r1">read</option><option value="r0">unread</option><option value="f1">flagged</option><option value="f0">unflagged</option></select>');
-            if (self.account_role in ('public', 'guest'))
               mt := '';
+            if (self.account_rights = 'W')
+              mt := sprintf ('<b>Selected as</b> <select name="mark" onchange="javascript: if (anySelected(this.form, \'cb_item\', \'No posts were selected to mark as \'+this.options[this.selectedIndex].text+\'.\')) {this.form.submit();} else {this.selectedIndex = 0}"><option/><option value="r1">read</option><option value="r0">unread</option><option value="f1">flagged</option><option value="f0">unflagged</option></select>');
 
             st := sprintf ('<b>View</b> <select name="show" onchange="javascript: this.form.submit();"><option value="">all</option><option value="r1">read</option><option value="r0">unread</option><option value="f1">flagged</option><option value="f0">unflagged</option></select> <b>posts</b>');
             sv := get_keyword('show', self.vc_page.vc_event.ve_params, '');
@@ -366,7 +362,7 @@
           <table id="feed" style="clear: left; float: left; width: 100%;" cellspacing="0">
             <thead class="sortHeader">
               <tr>
-                <v:template type="simple" enabled="--case when (self.account_role in ('public', 'guest')) then 0 else 1 end">
+                <v:template type="simple" enabled="--case when (self.account_rights = 'W') then 1 else 0 end">
                   <th width="1%" class="checkbox">
                     <input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this.form, this, 'cb_item')"/>
                   </th>
@@ -401,16 +397,16 @@
           <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
             <table>
               <tr id="<?V ENEWS.WA.node_type(self.fNode) || '#' || cast (control.te_column_value('EFI_ID') as varchar) ?>">
-                <v:template type="simple" enabled="--case when (self.account_role in ('public', 'guest')) then 0 else 1 end">
+                <vm:if test="self.account_rights = 'W'">
                   <td align="center">
                     <?vsp
-                      http (sprintf ('<input type="checkbox" name="cb_item" value="%d" />', ((control.vc_parent) as vspx_row_template).te_column_value('EFI_ID')));
+                      http (sprintf ('<input type="checkbox" name="cb_item" value="%d" />', (control as vspx_row_template).te_column_value('EFI_ID')));
                     ?>
                   </td>
                   <td align="center">
                     <?vsp
-                      http (sprintf ('<span id="image_%d">', ((control.vc_parent) as vspx_row_template).te_column_value('EFI_ID')));
-                      if (((control.vc_parent) as vspx_row_template).te_column_value('EFID_KEEP_FLAG') = 1)
+                      http (sprintf ('<span id="image_%d">', (control as vspx_row_template).te_column_value('EFI_ID')));
+                      if ((control as vspx_row_template).te_column_value('EFID_KEEP_FLAG') = 1)
                       {
                         http ('<img src="image/flag.gif" border="0"/>');
                       } else {
@@ -419,7 +415,7 @@
                       http ('</span>');
                     ?>
                   </td>
-                </v:template>
+                </vm:if>
                 <td>
                   <img src="image/html.png" border="0" alt="folder" width="16"/>
                 </td>
@@ -438,13 +434,13 @@
                     http (sprintf ('<a id="feed_%d" href="%s" onclick="%s" title="%s" class="%s %s" %s>%s</a>', id, href, onclick, title, 'app', linkClass, appIri, ENEWS.WA.rdfa_value (title, 'dc:title')));
                   ?>
                 </td>
-                <v:template type="simple" enabled="--case when (ENEWS.WA.node_type (self.fNode) = 'f') then 1 else 0 end">
+                <vm:if test="ENEWS.WA.node_type (self.fNode) = 'f'">
                   <td>
-                    <v:label value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('EFD_TITLE')" format="%s"/>
+                    <?V ENEWS.WA.utf2wide ((control as vspx_row_template).te_column_value('EFD_TITLE')) ?>
                   </td>
-                </v:template>
+                </vm:if>
                 <td>
-                  <v:label value="--ENEWS.WA.rdfa_value ((control.vc_parent as vspx_row_template).te_column_value('EFI_AUTHOR'), 'dc:creator')" format="%s"/>
+                  <?vsp http (ENEWS.WA.rdfa_value ((control as vspx_row_template).te_column_value('EFI_AUTHOR'), 'dc:creator')); ?>
                 </td>
                 <td align="right" nowrap="nowrap">
                   <i><v:label value="--ENEWS.WA.rdfa_value (ENEWS.WA.dt_value ((control.vc_parent as vspx_row_template).te_column_value('EFI_PUBLISH_DATE')), 'dct:modified')" format="%s"/></i>
@@ -462,7 +458,7 @@
                   } else {
                     id := cast (control.te_column_value('EFI_ID') as varchar);
                   }
-                  self.r_load := sprintf ('parent.loadIFrame(%s, ''%s'');', id, ENEWS.WA.node_type (self.fNode));
+                  self.r_load := sprintf ('loadIFrame(%s, \'%s\');', id, ENEWS.WA.node_type (self.fNode));
                 }
               ?>
             </table>
@@ -486,16 +482,13 @@
           coloriseTable('feed');
 
           var T = $('ds_navigation');
-          if (T)
-          {
+          if (T) {
             S = $('navigation')
-            if (S)
-            {
+            if (S) {
               var R = T.innerHTML;
               if (S.previousSibling)
-              {
                 R = ' | ' + R;
-              }
+
               S.innerHTML = R;
             }
             T.innerHTML = '';
diff --git a/appsrc/ODS-FeedManager/www/js/enews.js b/appsrc/ODS-FeedManager/www/js/enews.js
index 9a79bbc..238eb03 100644
--- a/appsrc/ODS-FeedManager/www/js/enews.js
+++ b/appsrc/ODS-FeedManager/www/js/enews.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: enews.js,v 1.21.2.8 2010/07/09 14:37:01 source Exp $
+ *  $Id: enews.js,v 1.21.2.10 2010/10/07 13:23:04 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -75,15 +75,13 @@ Feeds.readCookie = function (name)
 Feeds.readField = function (field, doc)
 {
   var v;
-  if (!doc) {doc = document;}
-  if (doc.forms[0])
-  {
+  if (!doc)
+    doc = document;
+  if (doc.forms[0]) {
     v = doc.forms[0].elements[field];
     if (v)
-    {
       v = v.value;
     }
-  }
   return v;
 }
 
@@ -106,12 +104,15 @@ Feeds.initState = function (state)
   if (!state)
     var state = new Object();
 
+  delete state.sid;
   var v = Feeds.readField('sid');
   if (v)
     state.sid = v;
+
+  delete state.realm;
   var v = Feeds.readField('realm');
   if (v)
-    state.sid = v;
+    state.realm = v;
   if (!state.tab)
     state.tab = 'feeds';
 
@@ -149,8 +150,7 @@ Feeds.initLeftPane = function ()
 
   // load cookie data
   var s = Feeds.readCookie('Feeds_State');
-  if (s)
-  {
+  if (s) {
     try {
       s = OAT.JSON.parse(unescape(s));
     } catch (e) { s = null; }
@@ -160,8 +160,7 @@ Feeds.initLeftPane = function ()
   }
   Feeds.state = s;
   var v = $('nodePath');
-  if (v && (v.value != ''))
-  {
+  if (v && (v.value != '')) {
     Feeds.state.selected = v.value;
     if (v.value.indexOf('t#') == 0)
       Feeds.state.tab = 'tags';
@@ -178,8 +177,7 @@ Feeds.initTags = function ()
   if (!div)
     return;
 
-  if (Feeds.state.tab != 'tags')
-  {
+  if (Feeds.state.tab != 'tags') {
     OAT.Dom.addClass('tags_button', 'tab2');
     OAT.Dom.removeClass('tags_button', 'activeTab2');
     OAT.Dom.hide('pane_left_tags');
@@ -242,8 +240,7 @@ Feeds.initFeeds = function ()
   if (!div)
     return;
 
-  if (Feeds.state.tab != 'feeds')
-  {
+  if (Feeds.state.tab != 'feeds') {
     OAT.Dom.addClass('feeds_button', 'tab2');
     OAT.Dom.removeClass('feeds_button', 'activeTab2');
     OAT.Dom.hide('pane_left_feeds');
@@ -282,17 +279,13 @@ Feeds.loadFeeds = function ()
   // load and open selected nodes
   var x = function() {
     var v = new Array();
-    if (Feeds.state.expanded)
-    {
+    if (Feeds.state.expanded) {
       for (var i = 0; i < Feeds.state.expanded.length; i++)
-      {
         v.push(Feeds.state.expanded[i]);
       }
-    }
     if (Feeds.state.selected)
-    {
       v.push(Feeds.state.selected);
-    }
+
     Feeds.loadPath(v, 0);
   };
   Feeds.loadTree('', Feeds.tree.tree, x);
@@ -301,9 +294,7 @@ Feeds.loadFeeds = function ()
 Feeds.loadPath = function (w, wIndex)
 {
   var selectNode;
-
-  for (var n = wIndex; n < w.length; n++)
-  {
+  for (var n = wIndex; n < w.length; n++) {
     var nodePath = w[n];
     var parts = nodePath.split("/");
     if (parts[0] == "") { parts.shift(); }
@@ -312,17 +303,13 @@ Feeds.loadPath = function (w, wIndex)
     var node = Feeds.tree.tree;
     var currentPath = '';
 
-    for (var i = 0; i < parts.length; i++)
-    {
+    for (var i = 0; i < parts.length; i++) {
       currentPath += '/' + parts[i];
       var index = -1;
-      for (var j = 0; j < node.children.length; j++)
-      {
+      for (var j = 0; j < node.children.length; j++) {
         var child = node.children[j];
-        if (child.myPath == currentPath)
-        {
-          if ((child.children.length == 0) && child.ul)
-          {
+        if (child.myPath == currentPath) {
+          if ((child.children.length == 0) && child.ul) {
             var x = function() {Feeds.loadPath(w, n);};
             Feeds.loadTree(currentPath, child, x);
             return;
@@ -336,10 +323,8 @@ Feeds.loadPath = function (w, wIndex)
       node = node.children[index];
       node.expand(true);
       if (Feeds.state.selected == node.myPath)
-      {
         selectNode = node;
       }
-    }
     node.toggleSelect({ctrlKey:false});
   }
   Feeds.loadItems(Feeds.selectPath());
@@ -347,10 +332,8 @@ Feeds.loadPath = function (w, wIndex)
 
 Feeds.selectPath = function ()
 {
-  if (Feeds.state.selected)
-  {
-    if (Feeds.state.selected.indexOf('t#') != 0)
-    {
+  if (Feeds.state.selected) {
+    if (Feeds.state.selected.indexOf('t#') != 0) {
       var parts = Feeds.state.selected.split("/");
       if (parts[0] == "") { parts.shift(); }
       if (parts[parts.length-1] == "") { parts.pop(); }
@@ -358,16 +341,12 @@ Feeds.selectPath = function ()
       var node = Feeds.tree.tree;
       var currentPath = '';
 
-      for (var i = 0; i < parts.length; i++)
-      {
+      for (var i = 0; i < parts.length; i++) {
         currentPath += '/' + parts[i];
-        for (var j = 0; j < node.children.length; j++)
-        {
+        for (var j = 0; j < node.children.length; j++) {
           var child = node.children[j];
-          if (child.myPath == currentPath)
-          {
-            if (Feeds.state.selected == child.myPath)
-            {
+          if (child.myPath == currentPath) {
+            if (Feeds.state.selected == child.myPath) {
               child.select();
               return child.myID;
             }
@@ -377,7 +356,8 @@ Feeds.selectPath = function ()
         }
         if (index == -1) {return;}
         node = node.children[index];
-        if (!node) {break;}
+        if (!node)
+          break;
       }
       Feeds.state.selected = '';
     }
@@ -400,8 +380,7 @@ Feeds.updateTree = function(data, node, nodePath, nodeFunction)
     OAT.Event.attach(node._gdElm, 'click', function() {Feeds.selectNode(path, node);});
   }
   var o = OAT.JSON.parse(data);
-  for (var i = 0; i < o.length; i++)
-  {
+  for (var i = 0; i < o.length; i++) {
     var item = o[i];
     var iID = item[0];
     var iType = item[1];
@@ -419,9 +398,7 @@ Feeds.updateTree = function(data, node, nodePath, nodeFunction)
 
     /* draggable */
     if ((iDraggable == 1) && (Feeds.gd))
-    {
       Feeds.gd.addSource(newNode._gdElm, Feeds.gdDummy, Feeds.gdSuccess(iID));
-    }
 
     /* custom properties */
     newNode.myID = iID;
@@ -438,16 +415,13 @@ Feeds.updateTree = function(data, node, nodePath, nodeFunction)
 Feeds.expandTree = function (nodePath, node)
 {
   var a = Feeds.state.expanded;
-  if (!a)
-  {
+  if (!a) {
     a = [nodePath];
   } else {
     var N = a.find(nodePath);
     if (N == -1)
-    {
       a.push(nodePath);
     }
-  }
   Feeds.state.expanded = a;
   Feeds.saveState();
 
@@ -459,19 +433,14 @@ Feeds.expandTree = function (nodePath, node)
 Feeds.collapseTree = function (nodePath, node)
 {
   var expanded = Feeds.state.expanded;
-  if (expanded)
-  {
+  if (expanded) {
     var N = expanded.find(nodePath);
-    if (N != -1)
-    {
+    if (N != -1) {
       var a = [];
-      for (var i = 0; i < expanded.length; i++)
-      {
+      for (var i = 0; i < expanded.length; i++) {
         if (i != N)
-        {
           a.push(expanded[i]);
         }
-      }
       Feeds.state.expanded = a;
       Feeds.saveState();
     }
@@ -480,8 +449,7 @@ Feeds.collapseTree = function (nodePath, node)
 
 Feeds.selectNode = function(nodePath, node)
 {
-  if (node.selectable)
-  {
+  if (node.selectable) {
     Feeds.loadItems(node.myID);
     Feeds.state.selected = nodePath;
     Feeds.saveState();
@@ -493,8 +461,7 @@ Feeds.loadItems = function(nodeID)
   $('pane_right_bottom').innerHTML = '';
   var URL = 'items.vspx?node='+encodeURIComponent(nodeID)+Feeds.sessionParams();
   var v = $('nodeItem');
-  if (v && (v.value != ''))
-  {
+  if (v && (v.value != '')) {
     URL += '&item=' + v.value;
     v.value = '';
   }
@@ -514,8 +481,7 @@ Feeds.addFavourite = function (node)
 Feeds.removeFavourite = function (node)
 {
   if (!$('pt_favourite_'+node)) {return};
-  if (confirmAction('Are you sure you want to remove this item from Favourites?'))
-  {
+  if (confirmAction('Are you sure you want to remove this item from Favourites?')) {
     var x = function(data) {
       Feeds.listFavourites();
     }
@@ -549,11 +515,9 @@ Feeds.aboutDialog = function ()
 	aboutDialog.cancel = aboutDialog.hide;
 
   var x = function (txt) {
-    if (txt != "")
-    {
+    if (txt != "") {
       var aboutDiv = $("aboutDiv");
-      if (aboutDiv)
-      {
+      if (aboutDiv) {
         aboutDiv.innerHTML = txt;
         aboutDialog.show ();
       }
@@ -562,10 +526,12 @@ Feeds.aboutDialog = function ()
   OAT.AJAX.POST("ajax.vsp", "a=about", x, {type:OAT.AJAX.TYPE_TEXT, onstart:function(){}, onerror:function(){}});
 }
 
-function myA(obj) {
-  if (obj.href) {
-    document.location = obj.href + '?' + urlParam('sid') + urlParam('realm');
-    return false;
+function setFooter() {
+  if ($('pane_main')) {
+    var wDims = OAT.Dom.getViewport()
+    var hDims = OAT.Dom.getWH('FT')
+    var cPos = OAT.Dom.position('pane_main')
+    $('pane_main').style.height = (wDims[1] - hDims[1] - cPos[1] - 20) + 'px';
   }
 }
 
@@ -639,9 +605,9 @@ function dateParse(dateString, format) {
 }
 
 function datePopup(objName, format) {
-	if (!format) {
+	if (!format)
 		format = 'yyyy-MM-dd';
-	}
+
 	var obj = $(objName);
 	var d = dateParse(obj.value, format);
 	var c = new OAT.Calendar( {
@@ -660,13 +626,10 @@ function datePopup(objName, format) {
 function checkNotEnter(e)
 {
   var key;
-
-  if (window.event)
-  {
+  if (window.event) {
     key = window.event.keyCode;
   } else {
-    if (e)
-    {
+    if (e) {
       key = e.which;
     } else {
       return true;
@@ -711,11 +674,9 @@ function confirmAction(confirmMsq, form, txt, selectionMsq)
 
 function selectAllCheckboxes (form, btn, txt)
 {
-  for (var i = 0; i < form.elements.length; i++)
-  {
+  for (var i = 0; i < form.elements.length; i++) {
     var obj = form.elements[i];
-    if (obj != null && obj.type == "checkbox" && !obj.disabled && obj.name.indexOf (txt) != -1)
-    {
+    if (obj != null && obj.type == "checkbox" && !obj.disabled && obj.name.indexOf (txt) != -1) {
       if (btn.value == 'Select All')
         obj.checked = true;
       else
@@ -733,8 +694,7 @@ function anySelected (form, txt, selectionMsq)
 {
   if ((form != null) && (txt != null))
   {
-    for (var i = 0; i < form.elements.length; i++)
-    {
+    for (var i = 0; i < form.elements.length; i++) {
       var obj = form.elements[i];
       if (obj != null && obj.type == "checkbox" && obj.name.indexOf (txt) != -1 && obj.checked)
         return true;
@@ -748,28 +708,20 @@ function anySelected (form, txt, selectionMsq)
 
 function coloriseTable(id)
 {
-  if (document.getElementsByTagName)
-  {
-    var table = document.getElementById(id);
-    if (table != null)
-    {
+  var table = $(id);
+  if (table) {
       var rows = table.getElementsByTagName("tr");
       for (i = 0; i < rows.length; i++)
-      {
         rows[i].className = "tr_" + (i % 2);;
       }
     }
-  }
-}
 
 function clickNode(obj)
 {
   var nodes = obj.parentNode.childNodes;
-  for (var i=0; i<nodes.length; i++)
-  {
+  for (var i=0; i<nodes.length; i++) {
     var node = nodes[i];
-    if ((node.tagName == 'A') && (node.innerHTML))
-    {
+    if ((node.tagName == 'A') && (node.innerHTML)) {
         if (node.innerHTML.indexOf('<IMG') == 0)
            return node.onclick();
         if (node.innerHTML.indexOf('<img') == 0)
@@ -781,8 +733,7 @@ function clickNode(obj)
 function clickNode2(obj)
 {
   var nodes = obj.parentNode.childNodes;
-  for (var i=0; i<nodes.length; i++)
-  {
+  for (var i=0; i<nodes.length; i++) {
     var node = nodes[i];
     if ((node.tagName == 'A') && (node.onclick))
         return node.onclick();
@@ -791,13 +742,12 @@ function clickNode2(obj)
 
 function loadIFrame(id, mode)
 {
-  var doc = document.ownerDocument;
-  if (!getObject('pane_right_bottom', doc)) {var doc = parent.document;}
-  if (!mode) {mode = 'c';}
+  var doc = parent.document;
+  if (!mode)
+    mode = 'c';
   if (mode != 'p')
-{
-    readObject('feed_'+id, 'r1', doc);
-  }
+    readObject('feed_'+id, 'r1');
+
   var URL = 'item.vspx?&fid='+id+'&f=r1&m='+mode+Feeds.sessionParams(doc);
   getObject('pane_right_bottom', doc).innerHTML = '<iframe id="feed_item" src="'+URL+'" style="margin: -2px 0px 0px 0px;" width="100%" height="100%" frameborder="0" scrolling="auto" hspace="0" vspace="0" marginwidth="0" marginheight="0"></iframe>';
 }
@@ -808,42 +758,42 @@ function loadIFrameURL(URL)
   getObject('pane_right_bottom', doc).innerHTML = '<iframe src="http://feedvalidator.org/check.cgi?url='+encodeURIComponent(URL)+'" style="margin: -2px 0px 0px 0px;" width="100%" height="100%" frameborder="0" scrolling="auto" hspace="0" vspace="0" marginwidth="0" marginheight="0"></iframe>';
 }
 
-function loadFromIFrame(id, flag, mode)
+function loadFromIFrame(id, mode, flag)
 {
   var doc = parent.document;
-  if (!flag) {flag = 'r1';}
-  if (!mode) {mode = 'c';}
-
-  readObject('feed_'+id, flag, doc);
-  flagObject('image_'+id, flag, doc);
-
+  var frame = getObject('feed_items', doc);
+  if (frame) {
+    readObject('feed_'+id, flag, frame.contentDocument);
+    flagObject('image_'+id, flag, frame.contentDocument);
+  }
   var URL = 'item.vspx?fid='+id+'&f='+flag+'&m='+mode+Feeds.sessionParams(doc);
   getObject('pane_right_bottom', doc).innerHTML = '<iframe src="'+URL+'" style="margin: -2px 0px 0px 0px;" width="100%" height="100%" frameborder="no" scrolling="auto" hspace="0" vspace="0" marginwidth="0" marginheight="0"></iframe>';
 }
 
 function readObject(id, flag, doc)
 {
-  var c = $(id);
-  if (c)
-{
+  var c = getObject(id, doc);
+  if (!c)
+    return;
+
     if (flag == 'r0')
 {
-      OAT.Dom.removeClass(id, 'read');
-      OAT.Dom.addClass(id, 'unread');
+    OAT.Dom.removeClass(c, 'read');
+    OAT.Dom.addClass(c, 'unread');
 }
     else if (flag == 'r1')
     {
-      OAT.Dom.removeClass(id, 'unread');
-      OAT.Dom.addClass(id, 'read');
-    }
+    OAT.Dom.removeClass(c, 'unread');
+    OAT.Dom.addClass(c, 'read');
   }
 }
 
 function flagObject(id, flag, doc)
 {
-  var c = $(id);
-  if (c)
-  {
+  var c = getObject(id, doc);
+  if (!c)
+    return;
+
     if (flag == 'f0')
     {
         c.innerHTML = '';
@@ -853,112 +803,37 @@ function flagObject(id, flag, doc)
       c.innerHTML = '<img src="image/flag.gif" border="0"/>';
     }
   }
-}
-
-function addOption (form, text_name, box_name)
-{
-  var box = form.elements[box_name];
-  if (box)
-  {
-    var text = form.elements[text_name];
-    if (text)
-    {
-      text.value = Feeds.trim(text.value);
-      if (text.value == '')
-        return;
-    	for (var i=0; i<box.options.length; i++)
-		    if (text.value == box.options[i].value)
-		      return;
-	    box.options[box.options.length] = new Option(text.value, text.value, false, true);
-	    sortSelect(box);
-	    text.value = '';
-	  }
-	}
-}
-
-function deleteOption (form, box_name)
-{
-  var box = form.elements[box_name];
-  if (box)
-	  box.options[box.selectedIndex] = null;
-}
-
-function composeOptions (form, box_name, text_name)
-{
-  var box = form.elements[box_name];
-  if (box)
-  {
-    var text = form.elements[text_name];
-    if (text)
-    {
-		  text.value = '';
-    	for (var i=0; i<box.options.length; i++)
-    	  if (text.value == '')
-		      text.value = box.options[i].value;
-		    else
-          text.value += '\n' + box.options[i].value;
-	  }
-	}
-}
 
 function showTag(tag)
 {
   parent.Feeds.selectTag(tag);
 }
 
-// sortSelect(select_object)
-//   Pass this function a SELECT object and the options will be sorted
-//   by their text (display) values
-function sortSelect(box)
-{
-	var o = new Array();
-	for (var i=0; i<box.options.length; i++)
-		o[o.length] = new Option( box.options[i].text, box.options[i].value, box.options[i].defaultSelected, box.options[i].selected) ;
-
-	if (o.length==0)
-	  return;
-
-	o = o.sort(function(a,b) {
-                      			if ((a.text+"") < (b.text+"")) { return -1; }
-                      			if ((a.text+"") > (b.text+"")) { return 1; }
-                      			return 0;
-			                     }
-		        );
-
-	for (var i=0; i<o.length; i++)
-		box.options[i] = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
-}
-
 function showTab(tabs, tabsCount, tabNo)
 {
-  if ($(tabs))
-  {
-    for (var i = 0; i < tabsCount; i++)
-    {
+  if (!$(tabs))
+    return;
+
+  for (var i = 0; i < tabsCount; i++) {
       var l = $(tabs+'_tab_'+i);      // tab labels
       var c = $(tabs+'_content_'+i);  // tab contents
-      if (i == tabNo)
-      {
+    if (i == tabNo) {
         if ($('tabNo'))
-        {
           $('tabNo').value = tabNo;
-        }
+
         if (c)
-        {
           OAT.Dom.show(c);
-      }
+
         OAT.Dom.addClass(l, "activeTab");
         l.blur();
       } else {
         if (c)
-        {
           OAT.Dom.hide(c);
-    }
+
         OAT.Dom.removeClass(l, "activeTab");
   }
 }
   }
-}
 
 function windowShow(sPage, width, height)
 {
@@ -1141,9 +1016,7 @@ function urlParams(mask)
 {
   var S = '';
   var form = document.forms['F1'];
-
-  for (var i = 0; i < form.elements.length; i++)
-  {
+  for (var i = 0; i < form.elements.length; i++) {
     var obj = form.elements[i];
     if ((obj.name.indexOf (mask) != -1) && (((obj.type == "checkbox") && (obj.checked)) || (obj.type != "checkbox")))
       S += '&' + obj.name + '=' + encodeURIComponent(obj.value);
@@ -1151,180 +1024,115 @@ function urlParams(mask)
   return S;
 }
 
-function showObject(id)
-{
-  var obj = document.getElementById(id);
-  if (obj)
-  {
-    obj.style.display="";
-    obj.visible = true;
-  }
-}
-
-function hideObject(id)
-{
-  var obj = document.getElementById(id);
-  if (obj != null)
-  {
-    obj.style.display="none";
-    obj.visible = false;
-  }
-}
-
-function initRequest()
-{
-	var xmlhttp = null;
-  try {
-    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
-  } catch (e) { }
-
-  if (xmlhttp == null)
-  {
-    try {
-      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
-    } catch (e) { }
-  }
-
-  // Gecko / Mozilla / Firefox
-  if (xmlhttp == null)
-    xmlhttp = new XMLHttpRequest();
-
-  return xmlhttp;
-}
-
-var timer = null;
+var progressTimer = null;
 var progressID = null;
 var progressMax = null;
-
-function resetState()
-{
-	var xmlhttp = initRequest();
-	xmlhttp.open("POST", URL + "?mode=reset" + urlParams("sid") + urlParams("realm"), false);
-	xmlhttp.setRequestHeader("Pragma", "no-cache");
-  xmlhttp.send(null);
-  try {
-    progressID = xmlhttp.responseXML.getElementsByTagName("id")[0].firstChild.nodeValue;
-  } catch (e) { }
-}
+var progressSize = 40;
+var progressInc = 100 / progressSize;
 
 function stopState()
 {
-  timer = null;
-
-	var xmlhttp = initRequest();
-	xmlhttp.open("POST", URL+"?mode=stop&id="+progressID+urlParams("sid")+urlParams("realm"), false);
-	xmlhttp.setRequestHeader("Pragma", "no-cache");
-  xmlhttp.send(null);
-
+  progressTimer = null;
+  var x = function (data) {
   doPost ('F1', 'btn_Background');
 }
+  OAT.AJAX.POST('ajax.vsp', "a=load&sa=stop&id="+progressID+urlParams("sid")+urlParams("realm"), x, {async: false});
+}
 
 function initState()
 {
-  hideObject('btn_Back');
-  hideObject('btn_Subscribe');
-  showObject('btn_Background');
-	document.getElementById("btn_Background").disabled = true;
-	document.getElementById("btn_Stop").disabled = true;
- 	document.getElementById("btn_Stop").value = 'Stop';
-
-	// reset state first
-	resetState();
-
-	// init state
-	var xmlhttp = initRequest();
-	xmlhttp.open("POST", URL, false);
-	xmlhttp.setRequestHeader("Pragma", "no-cache");
-  xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
-	xmlhttp.send("mode=init&id="+progressID+urlParams("sid")+urlParams("realm")+urlParams("cb_item")+urlParams("$_"));
-
-	hideObject("feeds");
-  createProgressBar();
-	if (timer == null)
-		timer = setTimeout("checkState()", 1000);
-
-  document.forms['F1'].action = 'channels.vspx';
-  var obj = document.getElementById("feeds");
-   if (obj)
+  progressTimer = null;
+  var x = function (data) {
+    try {
+      var xml = OAT.Xml.createXmlDoc(data);
+      progressID = OAT.Xml.textValue(xml.getElementsByTagName('id')[0]);
+    } catch (e) {}
+
+    OAT.Dom.hide('btn_Back');
+    OAT.Dom.hide('btn_Subscribe');
+    OAT.Dom.show('btn_Background');
+    $("btn_Background").disabled = true;
+    $("btn_Stop").disabled = true;
+    $("btn_Stop").value = 'Stop';
+
+    OAT.Dom.hide("feeds");
+    var obj = $("feeds");
+    if (obj) {
+      OAT.Dom.hide(obj);
      obj.innerHTML = '';
-  obj = document.getElementById("feedsData");
+    }
+    obj = $("feedsData");
    if (obj)
      obj.innerHTML = '';
+
+    createProgressBar();
+    progressTimer = setTimeout("checkState()", 1000);
+
+    document.forms['F1'].action = 'channels.vspx';
+  }
+  OAT.AJAX.POST('ajax.vsp', "a=load&sa=init"+urlParams("sid")+urlParams("realm")+urlParams("cb_item")+urlParams("$_"), x, {async: false});
 }
 
 function checkState()
 {
-	var xmlhttp = initRequest();
-	xmlhttp.open("POST", URL+"?mode=state&id="+progressID+urlParams("sid")+urlParams("realm"), true);
-	xmlhttp.onreadystatechange = function() {
-    if (xmlhttp.readyState == 4)
-    {
+  var x = function (data) {
       var progressIndex;
-
-      // progressIndex
       try {
-        progressIndex = xmlhttp.responseXML.getElementsByTagName("index")[0].firstChild.nodeValue;
+      var xml = OAT.Xml.createXmlDoc(data);
+      progressIndex = OAT.Xml.textValue(xml.getElementsByTagName('index')[0]);
       } catch (e) { }
 
-      if (timer != null)
       showProgress(progressIndex);
-     	document.getElementById("btn_Background").disabled = false;
-     	document.getElementById("btn_Stop").disabled = false;
-      if ((progressIndex != null) && (progressIndex != progressMax))
-      {
+
+    $("btn_Background").disabled = false;
+    $("btn_Stop").disabled = false;
+    if ((progressIndex != null) && (progressIndex != progressMax)) {
         setTimeout("checkState()", 1000);
 			} else {
+      progressTimer = null;
         doPost ('F1', 'btn_Stop');
-			  timer = null;
 			}
 	  }
-	}
-	xmlhttp.setRequestHeader("Pragma", "no-cache");
-	xmlhttp.send("");
+  OAT.AJAX.POST('ajax.vsp', "a=load&sa=state&id="+progressID+urlParams("sid")+urlParams("realm"), x);
 }
 
 function progressText(txt)
 {
-  getObject('progressText').innerHTML = txt;
-
   progressMax = 0;
   var form = document.forms['F1'];
   for (var i = 0; i < form.elements.length; i++) {
     var obj = form.elements[i];
-    if (obj != null && obj.type == "checkbox" && obj.name.indexOf ('cb_item') != -1 && obj.checked)
+    if (obj && obj.type == "checkbox" && obj.checked && obj.name.indexOf ('cb_item') != -1)
       progressMax += 1;
   }
-  getObject('progressMax').innerHTML = progressMax;
+  $('progressText').innerHTML = txt;
+  $('progressMax').innerHTML = progressMax;
 }
 
-var size = 40;
-var increment = 100 / size;
-
 // create the progress bar
 function createProgressBar()
 {
-  progressMax = getObject('progressMax').innerHTML;
-
+  progressMax = $('progressMax').innerHTML;
   var centerCellName;
   var tableText = "";
   var tdText = "";
-  for (x = 0; x < size; x++)
+  for (x = 0; x < progressSize; x++)
   {
     tdText = "";
-    if (x == ((size/2)-1))
+    if (x == ((progressSize/2)-1))
     {
       centerCellName = "progress_" + x;
       tdText = "<font color=\"white\">" + 0 + ' out of ' + progressMax + "</font>"
     }
-    else if (x == (size/2))
+    else if (x == (progressSize/2))
     {
       tdText = "<font color=\"white\">" + "Subscriptions</font>";
     }
-    else if (x == ((size/2)+1))
+    else if (x == ((progressSize/2)+1))
     {
       tdText = "<font color=\"white\">" + "Completed</font>";
     }
-    tableText += "<td id=\"progress_" + x + "\" width=\"" + increment + "%\" height=\"20\" bgcolor=\"blue\">"+tdText+"</td>";
+    tableText += "<td id=\"progress_" + x + "\" width=\"" + progressInc + "%\" height=\"20\" bgcolor=\"blue\">"+tdText+"</td>";
   }
   var idiv = window.document.getElementById("progress");
   idiv.innerHTML = "<table with=\"200\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>" + tableText + "</tr></table>";
@@ -1339,13 +1147,10 @@ function showProgress(progressIndex)
 
   var percentage = progressIndex * 100 / progressMax;
   centerCell.innerHTML = "<font color=\"white\">" + progressIndex + ' out of ' + progressMax + "</font>";
-  for (x = 0; x < size; x++)
-  {
+  for (x = 0; x < progressSize; x++) {
     var cell = window.document.getElementById("progress_" + x);
-    if (cell)
-    {
-      if ((percentage == 0) || (percentage/x < increment))
-    {
+    if (cell) {
+      if ((percentage == 0) || (percentage/x < progressInc)) {
       cell.style.backgroundColor = "blue";
     } else {
       cell.style.backgroundColor = "red";
@@ -1356,9 +1161,7 @@ function showProgress(progressIndex)
 
 function davBrowse (fld)
 {
-  var options = { mode: 'browser',
-                  onConfirmClick: function(path, fname) {$(fld).value = path + fname;}
-                };
+  var options = {mode: 'browser', onConfirmClick: function(path, fname){$(fld).value = path + fname;}};
   OAT.WebDav.open(options);
 }
 
@@ -1381,72 +1184,69 @@ function updateChecked (obj, objName)
 {
   var objForm = obj.form;
   coloriseRow(getParent(obj, 'tr'), obj.checked);
-  objForm.s1.value = Feeds.trim(objForm.s1.value);
-  objForm.s1.value = Feeds.trim(objForm.s1.value, ',');
-  objForm.s1.value = Feeds.trim(objForm.s1.value);
-  objForm.s1.value = objForm.s1.value + ',';
-  for (var i = 0; i < objForm.elements.length; i = i + 1)
-  {
+
+  var s1Value = objForm.s1.value;
+  s1Value = Feeds.trim(s1Value);
+  s1Value = Feeds.trim(s1Value, ',');
+  s1Value = Feeds.trim(s1Value);
+  s1Value = s1Value + ',';
+  for (var i = 0; i < objForm.elements.length; i = i + 1) {
     var obj = objForm.elements[i];
-    if (obj != null && obj.type == "checkbox" && obj.name == objName)
-    {
+    if (obj != null && obj.type == "checkbox" && obj.name == objName) {
       if (obj.checked)
       {
-        if (objForm.s1.value.indexOf(obj.value+',') == -1)
-        {
-          objForm.s1.value = objForm.s1.value + obj.value+',';
-        }
+        if (s1Value.indexOf(obj.value+',') == -1)
+          s1Value = s1Value + obj.value+',';
       } else {
-        objForm.s1.value = (objForm.s1.value).replace(obj.value+',', '');
+        s1Value = (s1Value).replace(obj.value+',', '');
       }
     }
   }
-  objForm.s1.value = Feeds.trim(objForm.s1.value, ',');
+  objForm.s1.value = Feeds.trim(s1Value, ',');
 }
 
 function addChecked (form, txt, selectionMsq)
 {
+  var openerForm = eval('window.opener.document.F1');
+  if (!openerForm)
+    return false;
+
   if (!anySelected (form, txt, selectionMsq, 'confirm'))
-    return;
+    return false;
 
   var submitMode = false;
-  if (window.document.F1.elements['src'])
-    if (window.document.F1.elements['src'].value.indexOf('s') != -1)
+  if (form.elements['src'] && (form.elements['src'].value.indexOf('s') != -1))
       submitMode = true;
-  if (submitMode)
-    if (window.opener.document.F1)
-      if (window.opener.document.F1.elements['submitting'])
-        return false;
+
   var singleMode = true;
-  if (window.document.F1.elements['dst'])
-    if (window.document.F1.elements['dst'].value.indexOf('s') == -1)
+  if (form.elements['dst'] && (form.elements['dst'].value.indexOf('s') == -1))
       singleMode = false;
 
   var s1 = 's1';
   var s2 = 's2';
 
   var myRe = /^(\w+):(\w+);(.*)?/;
-  var params = window.document.forms['F1'].elements['params'].value;
+  var params = form.elements['params'].value;
   var myArray;
-  while(true)
-  {
+  while(true) {
     myArray = myRe.exec(params);
     if (myArray == undefined)
       break;
     if (myArray.length > 2)
-      if (window.opener.document.F1)
-        if (window.opener.document.F1.elements[myArray[1]])
-        {
+      if (openerForm.elements[myArray[1]]) {
           if (myArray[2] == 's1')
-            rowSelectValue(window.opener.document.F1.elements[myArray[1]], window.document.F1.elements[s1], singleMode, submitMode);
+          if (openerForm.elements[myArray[1]])
+            rowSelectValue(openerForm.elements[myArray[1]], form.elements[s1], singleMode, submitMode);
           if (myArray[2] == 's2')
-            rowSelectValue(window.opener.document.F1.elements[myArray[1]], window.document.F1.elements[s2], singleMode, submitMode);
+          if (openerForm.elements[myArray[1]])
+            rowSelectValue(openerForm.elements[myArray[1]], form.elements[s2], singleMode, submitMode);
         }
     if (myArray.length < 4)
       break;
     params = '' + myArray[3];
   }
   if (submitMode)
-    window.opener.document.F1.submit();
+    openerForm.submit();
+
   window.close();
 }
diff --git a/appsrc/ODS-FeedManager/www/news.vsp b/appsrc/ODS-FeedManager/www/news.vsp
index a533965..e0b357a 100644
--- a/appsrc/ODS-FeedManager/www/news.vsp
+++ b/appsrc/ODS-FeedManager/www/news.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: news.vsp,v 1.7.2.1 2010/03/12 09:13:47 source Exp $
+--  $Id: news.vsp,v 1.7.2.2 2010/09/20 10:15:15 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-FeedManager/www/news.vspx b/appsrc/ODS-FeedManager/www/news.vspx
index 27e855b..e41364f 100644
--- a/appsrc/ODS-FeedManager/www/news.vspx
+++ b/appsrc/ODS-FeedManager/www/news.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: news.vspx,v 1.21.2.2 2009/11/04 09:43:43 source Exp $
+ -  $Id: news.vspx,v 1.21.2.4 2010/10/07 13:23:03 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -60,7 +60,7 @@
         } else {
               self.fNode := 'c#' || cast (coalesce ((select EFI_FEED_ID from ENEWS.WA.FEED_ITEM where EFI_ID = tmp), '') as varchar);
         }
-            self.fNodePath := ENEWS.WA.enews_path2 (self.domain_id, self.fNode);
+            self.fNodePath := ENEWS.WA.enews_path (self.domain_id, self.fNode);
             self.fNodeItem := cast (tmp as varchar);
             goto _validate;
       }
@@ -69,14 +69,14 @@
       {
         self.fTab := 'feed';
             self.fNode := 'c#' || cast (tmp as varchar);
-            self.fNodePath := ENEWS.WA.enews_path2 (self.domain_id, self.fNode);
+            self.fNodePath := ENEWS.WA.enews_path (self.domain_id, self.fNode);
             goto _validate;
       }
           tmp := get_keyword('node', params, '');
           if (tmp <> '')
       {
             self.fNode := tmp;
-            self.fNodePath := ENEWS.WA.enews_path2 (self.domain_id, self.fNode);
+            self.fNodePath := ENEWS.WA.enews_path (self.domain_id, self.fNode);
             goto _validate;
   	  }
           goto _exit;
@@ -109,7 +109,7 @@
           for (select TOP 1 EFD_ID, EFD_TITLE, ENEWS.WA.folder_path (EFD_DOMAIN_ID, EFD_FOLDER_ID) EFD_PATH from ENEWS.WA.FEED_DOMAIN where EFD_DOMAIN_ID = self.domain_id order by EFD_PATH, EFD_TITLE) do
       {
         self.fNode := ENEWS.WA.make_node ('c', EFD_ID);
-            self.fNodePath := ENEWS.WA.enews_path2 (self.domain_id, self.fNode);
+            self.fNodePath := ENEWS.WA.enews_path (self.domain_id, self.fNode);
             self.fNodeItem := '';
             goto _exit;
       }
@@ -117,7 +117,7 @@
           for (select TOP 1 EB_ID, EW_ID from ENEWS.WA.BLOG, ENEWS.WA.WEBLOG where EW_DOMAIN_ID = self.domain_id and EB_WEBLOG_ID = EW_ID order by EW_NAME, EB_NAME) do
       {
         self.fNode := ENEWS.WA.make_node ('b', EB_ID);
-            self.fNodePath := ENEWS.WA.enews_path2 (self.domain_id, self.fNode);
+            self.fNodePath := ENEWS.WA.enews_path (self.domain_id, self.fNode);
             self.fNodeItem := '';
             goto _exit;
       }
@@ -136,27 +136,22 @@
         http (sprintf ('<input type="hidden" id="nodePath" name="nodePath" value="%V" />', self.fNodePath));
         http (sprintf ('<input type="hidden" id="nodeItem" name="nodeItem" value="%V" />', self.fNodeItem));
       ?>
-      <v:template type="simple" enabled="--either(equ(self.account_role, 'public'), 0, 1)">
+      <vm:if test="self.domain_id > 0">
         <div class="tabs">
           <div style="float: left;">
             <div id="feeds_button" class="tab <?V case when self.fTab = 'feeds' then 'activeTab2' else 'tab2' end ?>" onclick="javascript: Feeds.toggleLeftPane('feeds');">Feeds</div>
             <div id="tags_button" class="tab <?V case when self.fTab = 'tags' then 'activeTab2' else 'tab2' end ?>" onclick="javascript: Feeds.toggleLeftPane('tags');">Tags</div>
         </div>
-        <?vsp
-          if (ENEWS.WA.settings_favourites (self.settings))
-          {
-        ?>
+          <vm:if test="ENEWS.WA.settings_favourites (self.settings)">
           <div style="float: right;">
             <div>
               <span class="tab">Favourites</span>
             </div>
           </div>
-        <?vsp
-          }
-        ?>
+          </vm:if>
           <br style="clear: both;"/>
         </div>
-      </v:template>
+      </vm:if>
 
       <div id="pane_main" class="pane_main">
         <div id="pane_left" style="<?V case when ENEWS.WA.settings_favourites(self.settings) then 'width: 20.3%;' else '' end ?>">
@@ -169,12 +164,10 @@
           <div id="pane_right_bottom">
           </div>
         </div>
-        <?vsp
-          if (ENEWS.WA.settings_favourites (self.settings))
-          {
-            http ('<div id="pane_right2"></div>');
-          }
-        ?>
+        <vm:if test="ENEWS.WA.settings_favourites (self.settings)">
+          <div id="pane_right2">
+          </div>
+        </vm:if>
       </div>
     </vm:pagebody>
   </vm:pagewrapper>
diff --git a/appsrc/ODS-FeedManager/www/search.vspx b/appsrc/ODS-FeedManager/www/search.vspx
index dba97b2..e709fad 100644
--- a/appsrc/ODS-FeedManager/www/search.vspx
+++ b/appsrc/ODS-FeedManager/www/search.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: search.vspx,v 1.18.2.4 2010/07/09 14:37:01 source Exp $
+ -  $Id: search.vspx,v 1.18.2.9 2010/10/13 12:14:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -22,7 +22,15 @@
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  -
 -->
-<v:page name="search" decor="template/template.vspx" style="template/template.xsl" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<v:page name="search"
+        decor="template/template.vspx"
+        style="template/template.xsl"
+        fast-render="1"
+        button-anchors="1"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        xmlns:vm="http://www.openlinksw.com/vspx/macro"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <v:method name="sortColumn" arglist="in titleName varchar, in columnName varchar">
     <![CDATA[
       declare altStr, directionStr, imageStr varchar;
@@ -58,7 +66,7 @@
 
   <v:method name="linkClass" arglist="inout flag any">
     <![CDATA[
-      if (self.account_role in ('public', 'guest'))
+      if (self.account_rights <> 'W')
         return 'unread';
       return either(equ(flag, 1), 'read', 'unread');
     ]]>
@@ -167,7 +175,7 @@
 
       declare sql, state, msg, meta, result any;
 
-  	  sql := ENEWS.WA.sfolder_sql(self.domain_id, self.account_id, data, self.v_type, self.v_max);
+      sql := ENEWS.WA.sfolder_sql(self.domain_id, self.account_id, self.account_rights, data, self.v_type, self.v_max);
       if (self.v_group = 0)
       {
         sql := concat(sql, 'order by ', self.v_order, ' ', self.v_direction);
@@ -333,7 +341,7 @@
       <v:text name="tabNo" xhtml_id="tabNo" type="hidden" value="--self.v_tabNo"/>
       <v:text name="step" xhtml_id="step" type="hidden" value="1"/>
       <v:template name="st1" type="simple" enabled="-- case when (self.v_step and self.vc_is_valid) then 1 else 0 end;">
-        <div class="new-form-header">
+        <div class="form-header">
           <i><?V initcap(self.v_mode) ?> search found <?V length (self.ds_data) ?> feed(s) in last search</i>
         </div>
       </v:template>
@@ -543,7 +551,7 @@
                     </v:select-list>
                   </td>
                 </tr>
-                <v:template type="simple" enabled="--case when (self.v_type = 'text') then 1 else 0 end;">
+                <vm:if test="self.v_type = 'text'">
                   <tr>
                     <th>
                       <v:label for="" value="Space delimited keyword list" />
@@ -552,7 +560,7 @@
                       <v:text name="a_keywords" value="--self.v_keywords" fmt-function="ENEWS.WA.utf2wide" xhtml_class="textbox" xhtml_size="70%"/>
                     </td>
                   </tr>
-                </v:template>
+                </vm:if>
                 <tr>
                   <th>
                     <v:label for="f_expression" value="--case when (self.v_type = 'text') then 'or expression' else case when (self.v_type = 'xpath') then 'XPath Expression' else 'XQuery Expression' end end;" />
@@ -594,7 +602,7 @@
                     <v:textarea name="f_expression" value="--self.v_expression" fmt-function="ENEWS.WA.utf2wide" xhtml_rows="2" xhtml_cols="70"/>
                   </td>
                 </tr>
-                <v:template type="simple" enabled="--case when ENEWS.WA.conversation_enable(self.domain_id) then 1 else 0 end">
+                <vm:if test="ENEWS.WA.conversation_enable(self.domain_id)">
                   <tr>
                     <tr>
                       <th width="30%"> </th>
@@ -604,8 +612,8 @@
                       </td>
                     </tr>
                   </tr>
-                </v:template>
-                <v:template type="simple" enabled="--case when (self.account_role in ('public', 'guest')) then 0 else 1 end">
+                </vm:if>
+                <vm:if test="self.account_rights <> 'W'">
                 <tr>
                   <th>
                       <v:label for="f_tags" value="Tags" />
@@ -638,7 +646,7 @@
                     </v:select-list>
                   </td>
                 </tr>
-                </v:template>
+                </vm:if>
                 <tr>
                   <th>
                     <v:label for="f_after" value="Date after"/>
@@ -716,7 +724,7 @@
           </div>
         </div>
         <div class="form-footer">
-          <v:button action="simple" value="Search" xhtml_class="form-button">
+          <v:button name="btn_search" action="simple" value="Search" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
                 self.do_search (e);
@@ -724,27 +732,24 @@
               ]]>
             </v:on-post>
           </v:button>
-          <v:button action="simple" value="Save" enabled="--case when ((self.v_type = 'text') and not (self.account_role in ('public', 'guest'))) then 1 else 0 end" xhtml_class="form-button">
+          <v:button name="btn_save" action="simple" value="Save" enabled="--case when ((self.v_type = 'text') and (self.account_rights = 'W')) then 1 else 0 end" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
-                declare tmp varchar;
-
                 self.update_params();
-                tmp := 'sfolders_update.vspx?return=yes' || self.do_url('save', 'f_');;
-                self.vc_redirect(tmp);
+                self.vc_redirect(ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'sfolders.vspx') || '?mode=create&return=yes' || self.do_url('save', 'f_')));
               ]]>
             </v:on-post>
           </v:button>
-          <v:button action="simple" value="Cancel" xhtml_class="form-button">
+          <v:button name="btn_cancel" action="simple" value="Cancel" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
-                self.vc_redirect('news.vspx');
+                self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'news.vspx')));
               ]]>
             </v:on-post>
           </v:button>
         </div>
       </v:template>
-      <v:template type="simple" enabled="--case when self.v_mode in ('simple', 'opensearch') then 1 else 0 end">
+      <vm:if test="self.v_mode in ('simple', 'opensearch')">
         <div class="new-form-body">
           <table cellspacing="0">
             <tr>
@@ -768,7 +773,7 @@
                 <v:button action="simple" style="url" value="Cancel" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
-                      self.vc_redirect('news.vspx');
+                      self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'news.vspx')));
                     ]]>
                   </v:on-post>
                 </v:button>
@@ -776,7 +781,7 @@
             </tr>
           </table>
         </div>
-      </v:template>
+      </vm:if>
     </vm:pagebody>
   </vm:pagewrapper>
 </v:page>
diff --git a/appsrc/ODS-FeedManager/www/settings.vspx b/appsrc/ODS-FeedManager/www/settings.vspx
index 2627eb5..5cb7eff 100644
--- a/appsrc/ODS-FeedManager/www/settings.vspx
+++ b/appsrc/ODS-FeedManager/www/settings.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: settings.vspx,v 1.13.2.1 2009/07/03 15:25:31 source Exp $
+ -  $Id: settings.vspx,v 1.13.2.4 2010/10/13 12:14:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -48,7 +48,7 @@
     </vm:variables>
     <vm:pagebody>
       <v:text name="tabNo" xhtml_id="tabNo" type="hidden" value="--self.v_tabNo"/>
-      <div class="new-form-header">
+      <div class="form-header">
         Preferences
       </div>
       <div id="p" class="c1">
@@ -70,15 +70,19 @@
               <tr>
                 <th />
                 <td>
+                  <label>
                   <v:check-box name="f_favourites" xhtml_id="f_favourites" is-boolean="1" true-value="1" false-value="0" value="--cast(get_keyword ('favourites', self.settings, '0') as integer)"  xhtml_title="Show Favourites" />
-                  <vm:label for="f_favourites" value="show Favourites"/>
+                    show Favourites
+                  </label>
                 </td>
               </tr>
               <tr>
                 <th />
                 <td>
+                  <label>
                   <v:check-box name="f_feedIcons" xhtml_id="f_feedIcons" is-boolean="1" true-value="1" false-value="0" value="--cast(get_keyword ('feedIcons', self.settings, '1') as integer)"  xhtml_title="Show Feed Icons" />
-                  <vm:label for="f_feedIcons" value="show Feed''s Images"/>
+                    show Feed's Image
+                  </label>
                 </td>
               </tr>
               <tr>
@@ -86,14 +90,18 @@
                   <v:label value="Auto-refresh at login"/>
                 </th>
                 <td>
+                  <label>
                   <v:check-box name="f_updateFeeds" xhtml_id="f_updateFeeds" is-boolean="1" true-value="1" false-value="0" value="--cast(get_keyword('updateFeeds', self.settings, '0') as integer)" xhtml_title="Auto-refresh feeds at login" />
-                  <vm:label for="f_updateFeeds" value="for feeds"/>
+                    for feeds
+                  </label>
                 </td>
               </tr>
               <tr>
                 <td>
+                  <label>
                   <v:check-box name="f_updateBlogs" xhtml_id="f_updateBlogs" is-boolean="1" true-value="1" false-value="0" value="--cast(get_keyword('updateBlogs', self.settings, '0') as integer)"  xhtml_title="Auto-refresh blogs at login" />
-                  <vm:label for="f_updateBlogs" value="for blogs"/>
+                    for blogs
+                  </label>
                 </td>
               </tr>
               <tr>
@@ -161,7 +169,7 @@
           </div>
         </div>
       </div>
-      <div class="new-form-footer">
+      <div class="form-footer">
         <v:button action="simple" value="Save" xhtml_class="form-button">
           <v:on-post>
             <![CDATA[
@@ -200,15 +208,14 @@
          				if (f_conv and f_conv_init)
   					    ENEWS.WA.nntp_fill (self.domain_id);
     					}
-
-              self.vc_redirect('news.vspx');
+              self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'news.vspx')));
       	    ]]>
       	  </v:on-post>
         </v:button>
         <v:button action="simple" value="Cancel" xhtml_class="form-button">
           <v:on-post>
             <![CDATA[
-              self.vc_redirect('news.vspx');
+              self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'news.vspx')));
       	    ]]>
       	  </v:on-post>
         </v:button>
diff --git a/appsrc/ODS-FeedManager/www/sfolders.vspx b/appsrc/ODS-FeedManager/www/sfolders.vspx
index 2fd3cae..beeded3 100644
--- a/appsrc/ODS-FeedManager/www/sfolders.vspx
+++ b/appsrc/ODS-FeedManager/www/sfolders.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sfolders.vspx,v 1.7.2.2 2010/02/10 22:17:03 source Exp $
+ -  $Id: sfolders.vspx,v 1.7.2.6 2010/10/13 12:14:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -22,7 +22,7 @@
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  -
 -->
-<v:page name="sfolders" decor="template/template.vspx" style="template/template.xsl" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<v:page name="sfolders" decor="template/template.vspx" style="template/template.xsl" fast-render="1" button-anchors="1" xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <v:method name="sortColumn" arglist="in titleName varchar, in columnName varchar">
     <![CDATA[
       declare altStr, directionStr, imageStr varchar;
@@ -60,7 +60,7 @@
       <v:variable name="sf_order" persist="1" type="varchar" default="'ESFO_NAME'" />
       <v:variable name="sf_direction" persist="1" type="varchar" default="'asc'" />
 
-      <v:variable name="v_mode" type="varchar" default="''"/>
+      <v:variable name="v_mode" type="varchar" param-name="mode" default="''"/>
 
       <v:variable name="v_id" param-name="id" persist="0" type="varchar" default="''"/>
       <v:variable name="v_return" param-name="return" persist="0" type="varchar" default="''"/>
@@ -74,6 +74,11 @@
       <v:variable name="v_before" type="varchar" default="''"/>
     </vm:variables>
     <vm:pagebody>
+      <v:before-render>
+        <![CDATA[
+          self.F1.uf_action := ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'sfolders.vspx'));
+        ]]>
+      </v:before-render>
       <v:template type="simple" enabled="--either(equ(self.v_mode, ''), 1, 0)">
       <v:data-source name="dsrc" expression-type="sql" nrows="0" initial-offset="0">
         <v:before-data-bind>
@@ -240,9 +245,11 @@
       <v:template type="simple" enabled="--either(equ(self.v_mode, ''), 0, 1)">
         <v:before-data-bind>
           <![CDATA[
+            declare params any;
      		    declare exit handler for not found goto _end;
 
-            if (isnull (get_keyword('f_name', self.vc_page.vc_event.ve_params)))
+            params := self.vc_page.vc_event.ve_params;
+            if (isnull (get_keyword('f_name', params)) and (self.v_mode = 'update'))
             {
               declare data, keywords varchar;
 
@@ -262,20 +269,19 @@
               self.v_flag := ENEWS.WA.xml_get('flag', data);
               self.v_after := ENEWS.WA.xml_get('afterDate', data);
               self.v_before := ENEWS.WA.xml_get('beforeDate', data);
-        			self.v_mode := 'update';
     	    		return;
     		    }
 
   		    _end:
-            self.v_name := get_keyword('f_name', self.vc_page.vc_event.ve_params, '');
-            self.v_keywords := trim (get_keyword('f_keywords', self.vc_page.vc_event.ve_params, ''));
-            self.v_expression := trim (get_keyword('f_expression', self.vc_page.vc_event.ve_params, ''));
-            self.v_tags := trim (get_keyword('f_tags', self.vc_page.vc_event.ve_params, ''));
-            self.v_read := trim (get_keyword('f_read', self.vc_page.vc_event.ve_params, ''));
-            self.v_flag := trim (get_keyword('f_flag', self.vc_page.vc_event.ve_params, ''));
-            self.v_after := trim (get_keyword('f_after', self.vc_page.vc_event.ve_params, ''));
-            self.v_before := trim (get_keyword('f_before', self.vc_page.vc_event.ve_params, ''));
-      			self.v_mode := get_keyword('f_mode', self.vc_page.vc_event.ve_params, 'create');
+            self.v_name := get_keyword('f_name', params, '');
+            self.v_keywords := trim (get_keyword('f_keywords', params, ''));
+            self.v_expression := trim (get_keyword('f_expression', params, ''));
+            self.v_tags := trim (get_keyword('f_tags', params, ''));
+            self.v_read := trim (get_keyword('f_read', params, ''));
+            self.v_flag := trim (get_keyword('f_flag', params, ''));
+            self.v_after := trim (get_keyword('f_after', params, ''));
+            self.v_before := trim (get_keyword('f_before', params, ''));
+      			self.v_mode := get_keyword('f_mode', params, 'create');
       			if (self.v_return = 'yes')
       			{
               self.v_return := 'search.vspx?mode=advanced';
@@ -295,8 +301,8 @@
           ]]>
         </v:before-data-bind>
         <v:text name="f_mode" type="hidden" value="--self.v_mode"/>
-        <div class="new-form-header">
-          <v:label format="%s" value="--concat(initcap(self.v_mode), ' Smart folder')" />
+        <div class="form-header">
+          <?V concat(initcap(self.v_mode), ' Smart folder') ?>
         </div>
         <div class="new-form-body">
           <table cellspacing="0">
@@ -380,7 +386,7 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" value="Save" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
diff --git a/appsrc/ODS-FeedManager/www/show.vspx b/appsrc/ODS-FeedManager/www/show.vspx
deleted file mode 100644
index 0d8fee0..0000000
--- a/appsrc/ODS-FeedManager/www/show.vspx
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<!--
- -
- -  $Id: show.vspx,v 1.3 2006/08/14 14:33:15 source Exp $
- -
- -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- -  project.
- -
- -  Copyright (C) 1998-2006 OpenLink Software
- -
- -  This project is free software; you can redistribute it and/or modify it
- -  under the terms of the GNU General Public License as published by the
- -  Free Software Foundation; only version 2 of the License, dated June 1991.
- -
- -  This program is distributed in the hope that it will be useful, but
- -  WITHOUT ANY WARRANTY; without even the implied warranty of
- -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- -  General Public License for more details.
- -
- -  You should have received a copy of the GNU General Public License along
- -  with this program; if not, write to the Free Software Foundation, Inc.,
- -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- -
--->
-<v:page name="show" fast-render="1"  xmlns:v="http://www.openlinksw.com/vspx/">
-  <v:variable name="did" type="varchar" default="null" />
-  <v:variable name="aid" type="varchar" default="null" />
-  <v:variable name="cid" type="varchar" default="null" />
-  <?vsp
-    declare sql, meta, result, content any;
-
-    self.did := get_keyword('did', params);
-    self.aid := get_keyword('aid', params);
-    self.cid := get_keyword('cid', params);
-
-    declare st, msg varchar;
-
-    content := ENEWS.WA.xml2string(ENEWS.WA.export_opml_xml(self.did, self.aid));
-
-    http_header (sprintf('Content-Type: %s\r\n', 'text/xml'));
-    http(content);
-    http_flush();
-  ?>
-</v:page>
diff --git a/appsrc/ODS-FeedManager/www/tags.vspx b/appsrc/ODS-FeedManager/www/tags.vspx
index 7dea8da..6d4ca4a 100644
--- a/appsrc/ODS-FeedManager/www/tags.vspx
+++ b/appsrc/ODS-FeedManager/www/tags.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: tags.vspx,v 1.6 2008/04/17 11:03:30 source Exp $
+ -  $Id: tags.vspx,v 1.6.2.1 2010/09/20 10:15:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-FeedManager/www/template/popup.vspx b/appsrc/ODS-FeedManager/www/template/popup.vspx
index 1ef5d11..1ec92e7 100644
--- a/appsrc/ODS-FeedManager/www/template/popup.vspx
+++ b/appsrc/ODS-FeedManager/www/template/popup.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: popup.vspx,v 1.10.2.3 2010/03/12 09:13:47 source Exp $
+ -  $Id: popup.vspx,v 1.10.2.5 2010/10/07 13:23:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -55,18 +55,12 @@
           OAT.Anchor.zIndex = 1001;
 
           if (<?V cast (get_keyword ('app', self.settings, '0') as integer) ?> > 0)
-          {
-            if ($('app_area'))
-            {
               generateAPP('app_area', {appActivation: "<?V case when cast (get_keyword ('app', self.settings, '1') as integer) = 2 then 'hover' else 'click' end ?>"});
-            }
-          }
 
           // init tabs
           showTab('a', 2, 0);
         }
-        OAT.MSG.attach(OAT, 'PAGE_LOADED', myInit);
-        window.onload = function(){OAT.MSG.send(OAT, 'PAGE_LOADED');};
+        OAT.MSG.attach(OAT, 'OAT_LOADED', myInit);
       </script>
     ]]>
     <title></title>
@@ -76,8 +70,7 @@
       <vm:variables>
         <v:variable persist="0" name="domain_id" type="integer" default="-1"/>
         <v:variable persist="0" name="account_id" type="integer" default="-1"/>
-        <v:variable persist="0" name="account_role" type="varchar" default="'public'"/>
-        <v:variable persist="0" name="accountName" type="varchar" default="'Public User'"/>
+        <v:variable persist="0" name="account_rights" type="varchar" default="''"/>
         <v:variable persist="0" name="settings" type="any" />
       </vm:variables>
       <v:on-init>
@@ -90,9 +83,8 @@
 
           aSessInfo := ENEWS.WA.session_restore (params);
           self.domain_id := cast(get_keyword('domain_id', aSessInfo, '-1') as integer);
-          self.account_id := cast(get_keyword('user_id', aSessInfo, '-1') as integer);
-          self.account_role := get_keyword('user_role', aSessInfo, '');
-          self.accountName := get_keyword('user_name', aSessInfo, '');
+          self.account_id := cast (get_keyword ('account_id', aSessInfo, '-1') as integer);
+          self.account_rights := get_keyword ('account_rights', aSessInfo, '');
           self.settings := vector_concat (vector ('app', DB.DBA.WA_USER_APP_ENABLE (self.account_id)), ENEWS.WA.settings (self.domain_id, self.account_id));
         ]]>
       </v:on-init>
diff --git a/appsrc/ODS-FeedManager/www/template/template.vspx b/appsrc/ODS-FeedManager/www/template/template.vspx
index db4b64a..ce73089 100644
--- a/appsrc/ODS-FeedManager/www/template/template.vspx
+++ b/appsrc/ODS-FeedManager/www/template/template.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: template.vspx,v 1.33.2.6 2010/04/09 14:39:32 source Exp $
+ -  $Id: template.vspx,v 1.33.2.8 2010/10/07 13:23:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -84,12 +84,7 @@
           OAT.Anchor.zIndex = 1001;
         
           if (<?V cast (get_keyword ('app', self.settings, '0') as integer) ?> > 0)
-          {
-            if ($('app_area'))
-            {
             generateAPP('app_area', {appActivation: "<?V case when cast (get_keyword ('app', self.settings, '1') as integer) = 2 then 'hover' else 'click' end ?>"});
-            }
-          }
             
       		// init tabs
           showTab('p', 2, 0);
@@ -99,49 +94,12 @@
           Feeds.initLeftPane();
 
           setFooter();
+          window.onresize = function() {setFooter();}
+
           OAT.MSG.send(OAT, 'PAGE_LOADED');
         }
-        function getWindowHeight() {
-          var windowHeight = 0;
-          if (typeof(window.innerHeight) == 'number')
-              {
-            windowHeight = window.innerHeight;
-          }
-          else
-                {
-            if (document.documentElement && document.documentElement.clientHeight)
-                  {
-              windowHeight = document.documentElement.clientHeight;
-                  }
-            else
-            {
-              if (document.body && document.body.clientHeight)
-                  {
-                windowHeight = document.body.clientHeight;
-              }
-            }
-                  }
-          return windowHeight;
-                }
-        function setFooter() {
-          if (document.getElementById)
-          {
-            var windowHeight = getWindowHeight();
-            if (windowHeight > 0)
-            {
-              var footerElement = $('FT');
-              if (footerElement)
-              {
-                var footerHeight = footerElement.offsetHeight;
-                if ($('pane_main'))
-                  document.getElementById('pane_main').style.height = (windowHeight - footerHeight - 250) + 'px';
-              }
-          }
-        }
-        }
         OAT.MSG.attach(OAT, 'PAGE_LOADED2', myInit);
         window.onload = function(){OAT.MSG.send(OAT, 'PAGE_LOADED2');};
-        window.onresize = function() {setFooter();}
       </script>
     ]]>
     <title></title>
@@ -150,10 +108,7 @@
     <v:page name="template" xmlns:v="http://www.openlinksw.com/vspx/">
         <v:variable persist="0" name="domain_id" type="integer" default="-1"/>
         <v:variable persist="0" name="account_id" type="integer" default="-1"/>
-        <v:variable persist="0" name="account_role" type="varchar" default="'public'"/>
-        <v:variable persist="0" name="accountName" type="varchar" default="'Public User'"/>
-      <v:variable persist="0" name="owner_id" type="integer" default="null" />
-      <v:variable persist="0" name="ownerName" type="varchar" default="null" />
+      <v:variable persist="0" name="account_rights" type="varchar" default="''"/>
         <v:variable persist="0" name="settings" type="any" />
       <v:on-init>
         <![CDATA[
@@ -164,12 +119,9 @@
           declare aSessInfo any;
 
           aSessInfo := ENEWS.WA.session_restore (params);
-          self.domain_id := cast(get_keyword('domain_id', aSessInfo, '-1') as integer);
-          self.account_id := cast(get_keyword('user_id', aSessInfo, '-1') as integer);
-          self.account_role := get_keyword('user_role', aSessInfo, '');
-          self.accountName := get_keyword('user_name', aSessInfo, '');
-          self.owner_id := ENEWS.WA.domain_owner_id (self.domain_id);
-          self.ownerName := ENEWS.WA.domain_owner_name (self.domain_id);
+          self.domain_id := cast (get_keyword ('domain_id', aSessInfo) as integer);
+          self.account_id := cast (get_keyword ('account_id', aSessInfo) as integer);
+          self.account_rights := get_keyword ('account_rights', aSessInfo);
           self.settings := vector_concat (vector ('app', DB.DBA.WA_USER_APP_ENABLE (self.account_id)), ENEWS.WA.settings (self.domain_id, self.account_id));
 
           self.vc_add_attribute ('xmlns:foaf', 'http://xmlns.com/foaf/0.1/');
diff --git a/appsrc/ODS-FeedManager/www/template/template.xsl b/appsrc/ODS-FeedManager/www/template/template.xsl
index 94c3b55..e4b40a0 100644
--- a/appsrc/ODS-FeedManager/www/template/template.xsl
+++ b/appsrc/ODS-FeedManager/www/template/template.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: template.xsl,v 1.29.2.3 2010/07/09 14:37:01 source Exp $
+ -  $Id: template.xsl,v 1.29.2.8 2010/10/13 12:14:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -103,7 +103,6 @@
   <xsl:template match="vm:popup_pagewrapper">
     <v:variable name="nav_pos_fixed" type="integer" default="1"/>
     <v:variable name="nav_top" type="integer" default="0"/>
-    <v:variable name="nav_tip" type="varchar" default="''"/>
     <xsl:for-each select="//v:variable">
       <xsl:copy-of select="."/>
     </xsl:for-each>
@@ -127,7 +126,6 @@
   <xsl:template match="vm:pagewrapper">
     <v:variable name="nav_pos_fixed" type="integer" default="0"/>
     <v:variable name="nav_top" type="integer" default="0"/>
-    <v:variable name="nav_tip" type="varchar" default="''"/>
     <xsl:for-each select="//v:variable">
       <xsl:copy-of select="."/>
     </xsl:for-each>
@@ -154,7 +152,7 @@
                       params := e.ve_params;
                       q := trim (get_keyword ('q', params, ''));
                       S := case when q <> ''then sprintf ('&q=%s&step=1', q) else '' end;
-                      self.vc_redirect (ENEWS.WA.page_url (self.domain_id, sprintf ('search.vspx?mode=%s%s', get_keyword ('select', params, 'advanced'), S)));
+                      self.vc_redirect (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, sprintf ('search.vspx?mode=%s%s', get_keyword ('select', params, 'advanced'), S))));
                       self.vc_data_bind(e);
                      ]]>
             	</v:on-post>
@@ -164,10 +162,10 @@
             ?>
             <div style="float: right; text-align: right; padding-right: 0.5em; padding-top: 20px;">
               <v:text name="q" value="" fmt-function="ENEWS.WA.utf2wide" xhtml_onkeypress="javascript: if (checkNotEnter(event)) return true; vspxPost(\'searchHead\', \'select\', \'simple\'); return false;"/>
-              <xsl:call-template name="nbsp"/>
-              <v:url url="--ENEWS.WA.page_url (self.domain_id, 'search.vspx?mode=simple', self.sid, self.realm)" xhtml_onclick="javascript: vspxPost(\'searchHead\', \'select\', \'simple\'); return false;" value="Search" xhtml_title="simple Search" />
+              &nbsp;
+              <a href="<?vsp http (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'search.vspx?mode=simple', self.sid, self.realm))); ?>" onclick="vspxPost('searchHead', 'select', 'simple'); return false;" title="Simple Search">Search</a>
             |
-              <v:url url="--ENEWS.WA.page_url (self.domain_id, 'search.vspx?mode=advanced', self.sid, self.realm)" xhtml_onclick="javascript: vspxPost(\'searchHead\', \'select\', \'advanced\'); return false;" value="Advanced" xhtml_title="Advanced Search" />
+              <a href="<?vsp http (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'search.vspx?mode=advanced', self.sid, self.realm))); ?>" onclick="vspxPost('searchHead', 'select', 'advanced'); return false;" title="Advanced">Advanced</a>
           </div>
         </v:template>
       </div>
@@ -176,13 +174,13 @@
             <?vsp http (ENEWS.WA.utf2wide (ENEWS.WA.banner_links (self.domain_id, self.sid, self.realm))); ?>
           </div>
           <div style="float: right; padding-right: 0.5em;">
-          <v:template type="simple" enabled="--case when (self.account_role in ('public', 'guest')) then 0 else 1 end">
-              <v:url url="--ENEWS.WA.page_url (self.domain_id, 'settings.vspx', self.sid, self.realm)" value="Preferences" xhtml_title="Preferences"/>
+            <vm:if test="self.account_rights = 'W'">
+              <a href="<?vsp http (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'settings.vspx', self.sid, self.realm))); ?>" title="Preferences">Preferences</a>
               |
-      	  </v:template>
-            <a href="<?V ENEWS.WA.page_url (self.domain_id, 'about.vsp') ?>" onclick="javascript: Feeds.aboutDialog(); return false;" title="About">About</a>
+            </vm:if>
+            <a href="<?vsp http (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'about.vsp'))); ?>" onclick="javascript: Feeds.aboutDialog(); return false;" title="About">About</a>
       </div>
-          <p style="clear: both; line-height: 0.1em" />
+          <br style="clear: both; line-height: 0.1em" />
         </div>  
       <v:include url="enews_login.vspx"/>
       <table id="MTB">
@@ -190,15 +188,93 @@
           <!-- Navigation left column -->
           <v:template type="simple" enabled="--either(gt(self.domain_id, 0), 1, 0)">
             <td id="LC">
-                <v:template type="simple" enabled="--case when (self.account_role in ('guest')) then 0 else 1 end">
+                <v:template type="simple" enabled="--case when (self.account_rights <> '') then 1 else 0 end">
               <xsl:call-template name="vm:others"/>
                 </v:template>
               <xsl:call-template name="vm:formats"/>
             </td>
       	  </v:template>
-          <!-- Navigation right column -->
           <td id="RC">
-            	    <v:vscx name="navbar" url="enews_navigation.vspx" />
+              <v:tree show-root="0" multi-branch="0" orientation="horizontal" start-path="--case when ENEWS.WA.check_admin (self.account_id) then 'A' else self.account_rights end" root="ENEWS.WA.navigation_root" child-function="ENEWS.WA.navigation_child">
+                <v:before-data-bind>
+                  <![CDATA[
+                    declare page_name any;
+
+                    page_name := ENEWS.WA.page_name ();
+                    if (page_name = 'error.vspx')
+                    {
+                      self.nav_pos_fixed := 1;
+                    }
+                    else if (not self.nav_top and page_name <> '')
+                    {
+                      self.nav_pos_fixed := ENEWS.WA.check_grants (self.account_rights, page_name);
+                      control.vc_open_at (sprintf ('//*[@url = "%s"]', page_name));
+                    }
+                  ]]>
+                </v:before-data-bind>
+
+                <v:node-template>
+                  <td nowrap="nowrap" class="<?V case when control.tn_open then 'sel' else '' end ?>">
+                    <v:button action="simple" style="url" xhtml_class="--(case when (control.vc_parent as vspx_tree_node).tn_open = 1 then 'sel' else '' end)" value="--(control.vc_parent as vspx_tree_node).tn_value">
+                      <v:after-data-bind>
+                        <![CDATA[
+                          if ((control.vc_parent as vspx_tree_node).tn_open = 1)
+                            control.ufl_active := 0;
+                          else
+                            control.ufl_active := ENEWS.WA.check_grants (self.account_rights, ENEWS.WA.page_name ());
+                        ]]>
+                      </v:after-data-bind>
+                      <v:before-render>
+                        <![CDATA[
+                          control.bt_anchor := 0;
+                          control.bt_url := ENEWS.WA.utf2wide (replace (control.bt_url, sprintf ('/enews2/%d', self.domain_id), ENEWS.WA.page_url (self.domain_id)));
+                        ]]>
+                      </v:before-render>
+                      <v:on-post>
+                        <![CDATA[
+                          declare node vspx_tree_node;
+                          declare tree vspx_control;
+                          self.nav_pos_fixed := 0;
+                          node := control.vc_parent;
+                          tree := node.tn_tree;
+                          node.tn_tree.vt_open_at := NULL;
+                          self.nav_top := 1;
+                          tree.vc_data_bind (e);
+                        ]]>
+                      </v:on-post>
+                    </v:button>
+                  </td>
+                </v:node-template>
+                <v:leaf-template>
+                  <td nowrap="nowrap" class="<?V case when control.tn_open then 'sel' else '' end ?>">
+                    <v:button action="simple" style="url" xhtml_class="--case when (control.vc_parent as vspx_tree_node).tn_open = 1 then 'sel' else '' end" value="--(control.vc_parent as vspx_tree_node).tn_value">
+                      <v:before-render>
+                        <![CDATA[
+                          control.bt_anchor := 0;
+                          control.bt_url := ENEWS.WA.utf2wide (replace (control.bt_url, sprintf ('/enews2/%d', self.domain_id), ENEWS.WA.page_url (self.domain_id)));
+                        ]]>
+                      </v:before-render>
+                    </v:button>
+                  </td>
+                </v:leaf-template>
+                <v:horizontal-template>
+                  <table class="nav_bar" cellspacing="0">
+                    <tr>
+                      <v:node-set />
+                      <?vsp
+                        if ((control as vspx_tree).vt_node <> control) {
+                      ?>
+                      <td class="filler"> </td>
+                      <?vsp } ?>
+                    </tr>
+                  </table>
+                  <?vsp
+                    if ((control as vspx_tree).vt_node = control and not length (childs)) {
+                  ?>
+                  <div class="nav_bar nav_seperator" >x</div>
+                  <?vsp } ?>
+                </v:horizontal-template>
+              </v:tree>
               	  <v:template type="simple" condition="not self.vc_is_valid">
               	    <div class="error">
               		    <p><v:error-summary/></p>
@@ -210,7 +286,11 @@
               	</td>
               </tr>
             </table>
-      <div id="FT">
+        <?vsp
+          declare C any;
+          C := vsp_ua_get_cookie_vec(self.vc_event.ve_lines);
+        ?>
+        <div id="FT" style="display: <?V case when get_keyword ('interface', C, '') = 'js' then 'none' else '' end ?>">
         <div id="FT_L">
           <a href="http://www.openlinksw.com/virtuoso">
               <img alt="Powered by OpenLink Virtuoso Universal Server" src="image/virt_power_no_border.png" border="0" />
@@ -231,7 +311,7 @@
   <!--=========================================================================-->
   <xsl:template name="vm:others">
     <div class="left_container">
-      <v:url value='<img src="image/bmklet_32.png" height="16" width="16" border="0" /> Bookmarklet ' format="%s" url="--ENEWS.WA.page_url (self.domain_id, 'bookmark.vspx', self.sid, self.realm)"/>
+      <a href="<?vsp http (ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'bookmark.vspx', self.sid, self.realm))); ?>" title="Bookmarklet"><img src="image/bmklet_32.png" height="16" width="16" border="0" /> Bookmarklet</a>
     </div>
   </xsl:template>
 
@@ -250,7 +330,7 @@
           http ('<div style="border-top: 1px solid #7f94a5;"></div>');
       }
 
-        S := ENEWS.WA.gems_url (self.domain_id);
+        S := ENEWS.WA.utf2wide (ENEWS.WA.gems_url (self.domain_id));
         http (sprintf('<a href="%sOFM.%s" target="_blank" title="%s export" alt="%s export" class="gems"><img src="image/rss-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'rss', 'RSS', 'RSS', 'RSS', 'RSS'));
         http (sprintf('<a href="%sOFM.%s" target="_blank" title="%s export" alt="%s export" class="gems"><img src="image/blue-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'atom', 'ATOM', 'ATOM', 'ATOM', 'Atom'));
         http (sprintf('<a href="%sOFM.%s" target="_blank" title="%s export" alt="%s export" class="gems"><img src="image/rdf-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'rdf', 'RDF', 'RDF', 'RDF', 'RDF'));
@@ -481,15 +561,4 @@
     </div>
   </xsl:template>
 
-  <!--=========================================================================-->
-  <xsl:template name="nbsp">
-    <xsl:param name="count" select="1"/>
-    <xsl:if test="$count != 0">
-      <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
-      <xsl:call-template name="nbsp">
-        <xsl:with-param name="count" select="$count - 1"/>
-      </xsl:call-template>
-    </xsl:if>
-  </xsl:template>
-
 </xsl:stylesheet>
diff --git a/appsrc/ODS-FeedManager/www/weblog.vspx b/appsrc/ODS-FeedManager/www/weblog.vspx
index 871fb92..a538aaa 100644
--- a/appsrc/ODS-FeedManager/www/weblog.vspx
+++ b/appsrc/ODS-FeedManager/www/weblog.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: weblog.vspx,v 1.9 2008/06/23 12:49:29 source Exp $
+ -  $Id: weblog.vspx,v 1.9.2.4 2010/10/13 12:14:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -80,6 +80,11 @@
       <v:variable persist="session" name="wt_bookmark" type="varchar" default="null" />
     </vm:variables>
     <vm:pagebody>
+      <v:before-render>
+        <![CDATA[
+          self.F1.uf_action := ENEWS.WA.utf2wide (ENEWS.WA.page_url (self.domain_id, 'weblog.vspx'));
+        ]]>
+      </v:before-render>
     	<v:on-post>
         <![CDATA[
           if (e.ve_button is not null)
@@ -272,7 +277,7 @@
             self.v_password := get_keyword('f_password', self.vc_page.vc_event.ve_params, '');
           ]]>
         </v:before-data-bind>
-        <div class="new-form-header">
+        <div class="form-header">
           <v:label format="%s" value="--concat(initcap(self.v_mode), ' weblog')"/>
         </div>
         <div class="new-form-body">
@@ -340,7 +345,7 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" value="Save" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
@@ -435,7 +440,7 @@
             self.v_store_days := get_keyword('f_store_days', self.vc_page.vc_event.ve_params, '30');
           ]]>
         </v:before-data-bind>
-        <div class="new-form-header">
+        <div class="form-header">
           <v:label format="%s" value="--'Update blog'"/>
         </div>
         <div class="new-form-body">
@@ -494,7 +499,7 @@
             </tr>
           </table>
         </div>
-        <div class="new-form-footer">
+        <div class="form-footer">
           <v:button action="simple" value="Save" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
diff --git a/appsrc/ODS-FeedManager/xslt/foaf.xsl b/appsrc/ODS-FeedManager/xslt/foaf.xsl
index 843a6c1..41798cc 100644
--- a/appsrc/ODS-FeedManager/xslt/foaf.xsl
+++ b/appsrc/ODS-FeedManager/xslt/foaf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: foaf.xsl,v 1.2 2006/08/14 14:33:16 source Exp $
+ -  $Id: foaf.xsl,v 1.2.2.1 2010/09/20 10:15:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-FeedManager/xslt/rss2atom.xsl b/appsrc/ODS-FeedManager/xslt/rss2atom.xsl
index 85a5d29..86d363d 100644
--- a/appsrc/ODS-FeedManager/xslt/rss2atom.xsl
+++ b/appsrc/ODS-FeedManager/xslt/rss2atom.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom.xsl,v 1.3.2.2 2010/05/31 21:59:15 source Exp $
+ -  $Id: rss2atom.xsl,v 1.3.2.3 2010/09/20 10:15:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-FeedManager/xslt/rss2atom03.xsl b/appsrc/ODS-FeedManager/xslt/rss2atom03.xsl
index 298ede5..3f7456d 100644
--- a/appsrc/ODS-FeedManager/xslt/rss2atom03.xsl
+++ b/appsrc/ODS-FeedManager/xslt/rss2atom03.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom03.xsl,v 1.3.2.1 2009/07/16 06:13:09 source Exp $
+ -  $Id: rss2atom03.xsl,v 1.3.2.2 2010/09/20 10:15:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-FeedManager/xslt/rss2rdf.xsl b/appsrc/ODS-FeedManager/xslt/rss2rdf.xsl
index ce782fe..26c06dc 100644
--- a/appsrc/ODS-FeedManager/xslt/rss2rdf.xsl
+++ b/appsrc/ODS-FeedManager/xslt/rss2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2rdf.xsl,v 1.4.2.1 2009/07/16 06:13:09 source Exp $
+ -  $Id: rss2rdf.xsl,v 1.4.2.2 2010/09/20 10:15:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-FeedManager/xslt/rss2xbel.xsl b/appsrc/ODS-FeedManager/xslt/rss2xbel.xsl
index 89b9f49..99f98d6 100644
--- a/appsrc/ODS-FeedManager/xslt/rss2xbel.xsl
+++ b/appsrc/ODS-FeedManager/xslt/rss2xbel.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2xbel.xsl,v 1.2 2006/05/31 13:13:01 source Exp $
+ -  $Id: rss2xbel.xsl,v 1.2.2.1 2010/09/20 10:15:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/Makefile.am b/appsrc/ODS-Framework/Makefile.am
index 6e20dab..55b20bd 100644
--- a/appsrc/ODS-Framework/Makefile.am
+++ b/appsrc/ODS-Framework/Makefile.am
@@ -73,6 +73,7 @@ EXTRA_DIST = \
 	ckeditor/plugins/smiley/dialogs/*.js \
 	ckeditor/plugins/smiley/images/*.gif \
 	ckeditor/plugins/specialchar/dialogs/*.js \
+	ckeditor/plugins/specialchar/lang/*.js \
 	ckeditor/plugins/styles/styles/*.js \
 	ckeditor/plugins/table/dialogs/*.js \
 	ckeditor/plugins/tabletools/dialogs/*.js \
@@ -127,13 +128,13 @@ EXTRA_DIST = \
 	tmpl/WS_TERM_BY_USER_TEMPLATE \
 	users/css/*.css \
 	users/*.html \
-	users/js/*.js \
 	users/*.php \
 	users/*.txt \
+	users/*.vsp \
+	users/*.xsl \
+	users/js/*.js \
 	users/users.jsp \
 	users/users.rb \
-	users/*.vsp \
 	vad_version \
 	version.base \
 	version.curr
-
diff --git a/appsrc/ODS-Framework/Makefile.in b/appsrc/ODS-Framework/Makefile.in
index 08a514b..d57c5da 100644
--- a/appsrc/ODS-Framework/Makefile.in
+++ b/appsrc/ODS-Framework/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
@@ -335,6 +336,7 @@ EXTRA_DIST = \
 	ckeditor/plugins/smiley/dialogs/*.js \
 	ckeditor/plugins/smiley/images/*.gif \
 	ckeditor/plugins/specialchar/dialogs/*.js \
+	ckeditor/plugins/specialchar/lang/*.js \
 	ckeditor/plugins/styles/styles/*.js \
 	ckeditor/plugins/table/dialogs/*.js \
 	ckeditor/plugins/tabletools/dialogs/*.js \
@@ -389,12 +391,13 @@ EXTRA_DIST = \
 	tmpl/WS_TERM_BY_USER_TEMPLATE \
 	users/css/*.css \
 	users/*.html \
-	users/js/*.js \
 	users/*.php \
 	users/*.txt \
+	users/*.vsp \
+	users/*.xsl \
+	users/js/*.js \
 	users/users.jsp \
 	users/users.rb \
-	users/*.vsp \
 	vad_version \
 	version.base \
 	version.curr
diff --git a/appsrc/ODS-Framework/SWD.sql b/appsrc/ODS-Framework/SWD.sql
new file mode 100644
index 0000000..b7926da
--- /dev/null
+++ b/appsrc/ODS-Framework/SWD.sql
@@ -0,0 +1,76 @@
+use ODS;
+
+create procedure swd_get_app_type (in svc varchar)
+{
+  declare app, arr varchar;
+  arr := sprintf_inverse (svc, 'urn:openlinksw.com:ods:%s', 0);
+  app := arr[0];
+  return db.dba.wa_app_to_type (app);
+}
+;
+
+create procedure "simple-web-discovery" (in principal varchar, in service varchar) __SOAP_HTTP 'application/json'
+{
+  declare host, mail, uname varchar;
+  declare arr, tmp, graph, app any;
+  declare f int;
+
+  host := http_host ();
+  arr := WS.WS.PARSE_URI (principal);
+  graph := sioc..get_graph ();
+
+  if (arr [0] = 'http')
+    {
+      tmp := (sparql define input:storage "" 
+        prefix foaf: <http://xmlns.com/foaf/0.1/> 
+      	select ?mbox where 
+	 { graph `iri(?:graph)` { `iri(?:principal)` foaf:mbox ?mbox }});
+      if (tmp is not null)
+        {
+	  arr := WS.WS.PARSE_URI (tmp);
+	}	  
+    } 
+  mail := arr[2];
+  uname := (select top 1 U_NAME from DB.DBA.SYS_USERS where U_E_MAIL = mail order by U_ID);
+  if (uname is null)
+    {
+      uname := (sparql define input:storage "" 
+      	prefix owl: <http://www.w3.org/2002/07/owl#> 
+        prefix foaf: <http://xmlns.com/foaf/0.1/> 
+      	select ?nick 
+         where { graph `iri(?:graph)` { ?s owl:sameAs `iri(?:principal)` ; foaf:nick ?nick . }});
+    }
+  if (uname is null)
+    signal ('22023', sprintf ('The user account "%s" does not exist', principal));
+  app := swd_get_app_type (service);
+  http ('{\n');
+  http (' "locations":[\n');
+  for select WAM_HOME_PAGE, WAM_INST, WAM_APP_TYPE 
+    from DB.DBA.SYS_USERS, DB.DBA.WA_MEMBER where WAM_USER = U_ID and U_NAME = uname and WAM_MEMBER_TYPE = 1 and WAM_APP_TYPE = app do
+    {
+      declare url varchar; 
+      url := sioc..forum_iri (WAM_APP_TYPE, WAM_INST, uname);
+      if (not f)
+	f := 1;
+      else
+	http (',');
+      http (sprintf ('   "%s"\n', url));
+    }
+  http ('   ] \n');
+  http ('}\n');
+  return '';
+}
+;
+
+create procedure SWD_INIT ()
+{
+  DB.DBA.VHOST_REMOVE (lpath=>'/.well-known/simple-web-discovery');
+  DB.DBA.VHOST_DEFINE (lpath=>'/.well-known/simple-web-discovery', ppath=>'/SOAP/Http/simple-web-discovery', soap_user=>'ODS_API');
+}
+;
+
+SWD_INIT ();
+
+grant execute on ODS.DBA."simple-web-discovery" to ODS_API;
+
+use DB;
diff --git a/appsrc/ODS-Framework/aboutus.html b/appsrc/ODS-Framework/aboutus.html
index 5ea035c..b2abf52 100644
--- a/appsrc/ODS-Framework/aboutus.html
+++ b/appsrc/ODS-Framework/aboutus.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
  -
- -  $Id: aboutus.html,v 1.2 2006/05/31 13:13:01 source Exp $
+ -  $Id: aboutus.html,v 1.2.2.1 2010/09/20 10:15:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/accounts.vspx b/appsrc/ODS-Framework/accounts.vspx
index ef180e4..6fd0a2e 100644
--- a/appsrc/ODS-Framework/accounts.vspx
+++ b/appsrc/ODS-Framework/accounts.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: accounts.vspx,v 1.7 2008/03/13 20:50:05 source Exp $
+ -  $Id: accounts.vspx,v 1.7.2.1 2010/09/20 10:15:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/add_rule.vspx b/appsrc/ODS-Framework/add_rule.vspx
index d70ba0b..25bf19a 100644
--- a/appsrc/ODS-Framework/add_rule.vspx
+++ b/appsrc/ODS-Framework/add_rule.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: add_rule.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: add_rule.vspx,v 1.4.2.1 2010/09/20 10:15:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/admin.vspx b/appsrc/ODS-Framework/admin.vspx
index 5984a17..580da4a 100644
--- a/appsrc/ODS-Framework/admin.vspx
+++ b/appsrc/ODS-Framework/admin.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: admin.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: admin.vspx,v 1.4.2.1 2010/09/20 10:15:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/advertise.html b/appsrc/ODS-Framework/advertise.html
index 31230e7..d8e99b7 100644
--- a/appsrc/ODS-Framework/advertise.html
+++ b/appsrc/ODS-Framework/advertise.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
  -
- -  $Id: advertise.html,v 1.2 2008/03/13 20:50:05 source Exp $
+ -  $Id: advertise.html,v 1.2.2.1 2010/09/20 10:15:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/afoaf.xml b/appsrc/ODS-Framework/afoaf.xml
index 17992e3..9d4a134 100644
--- a/appsrc/ODS-Framework/afoaf.xml
+++ b/appsrc/ODS-Framework/afoaf.xml
@@ -1,7 +1,7 @@
 <?xml version ='1.0' encoding='UTF-8'?>
 <!--
  -
- -  $Id: afoaf.xml,v 1.5 2008/03/13 20:50:05 source Exp $
+ -  $Id: afoaf.xml,v 1.5.2.1 2010/09/20 10:15:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/app.vspx b/appsrc/ODS-Framework/app.vspx
index aaa58d1..80974f6 100644
--- a/appsrc/ODS-Framework/app.vspx
+++ b/appsrc/ODS-Framework/app.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: app.vspx,v 1.6 2008/03/13 20:50:05 source Exp $
+ -  $Id: app.vspx,v 1.6.2.1 2010/09/20 10:15:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/app_inst.vspx b/appsrc/ODS-Framework/app_inst.vspx
index 4b9f9b2..bbccd52 100644
--- a/appsrc/ODS-Framework/app_inst.vspx
+++ b/appsrc/ODS-Framework/app_inst.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: app_inst.vspx,v 1.19 2008/03/13 20:50:05 source Exp $
+ -  $Id: app_inst.vspx,v 1.19.2.1 2010/09/20 10:15:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/app_instance_limits.vspx b/appsrc/ODS-Framework/app_instance_limits.vspx
index e6a7174..a2758ca 100644
--- a/appsrc/ODS-Framework/app_instance_limits.vspx
+++ b/appsrc/ODS-Framework/app_instance_limits.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: app_instance_limits.vspx,v 1.4 2008/03/13 20:50:05 source Exp $
+ -  $Id: app_instance_limits.vspx,v 1.4.2.1 2010/09/20 10:15:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/app_menu.js b/appsrc/ODS-Framework/app_menu.js
index a96c436..96ec3b7 100644
--- a/appsrc/ODS-Framework/app_menu.js
+++ b/appsrc/ODS-Framework/app_menu.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: app_menu.js,v 1.3 2008/03/13 20:50:05 source Exp $
+ *  $Id: app_menu.js,v 1.3.2.1 2010/09/20 10:15:17 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Framework/app_menu_settings.vspx b/appsrc/ODS-Framework/app_menu_settings.vspx
index aef31b3..2d4b353 100644
--- a/appsrc/ODS-Framework/app_menu_settings.vspx
+++ b/appsrc/ODS-Framework/app_menu_settings.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: app_menu_settings.vspx,v 1.7 2008/03/13 20:50:05 source Exp $
+ -  $Id: app_menu_settings.vspx,v 1.7.2.1 2010/09/20 10:15:18 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/app_my_inst.vspx b/appsrc/ODS-Framework/app_my_inst.vspx
index 179a1d6..85613d7 100644
--- a/appsrc/ODS-Framework/app_my_inst.vspx
+++ b/appsrc/ODS-Framework/app_my_inst.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: app_my_inst.vspx,v 1.21 2008/04/17 09:10:36 source Exp $
+ -  $Id: app_my_inst.vspx,v 1.21.2.1 2010/09/20 10:15:18 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/app_sent_inv.vspx b/appsrc/ODS-Framework/app_sent_inv.vspx
index 59ea8b8..834fedd 100644
--- a/appsrc/ODS-Framework/app_sent_inv.vspx
+++ b/appsrc/ODS-Framework/app_sent_inv.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: app_sent_inv.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: app_sent_inv.vspx,v 1.4.2.1 2010/09/20 10:15:18 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/app_settings.vspx b/appsrc/ODS-Framework/app_settings.vspx
index 416284e..b269ffd 100644
--- a/appsrc/ODS-Framework/app_settings.vspx
+++ b/appsrc/ODS-Framework/app_settings.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: app_settings.vspx,v 1.10.2.1 2010/06/30 14:31:42 source Exp $
+ -  $Id: app_settings.vspx,v 1.10.2.3 2011/03/08 13:28:13 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -26,7 +26,9 @@
   xmlns:v="http://www.openlinksw.com/vspx/"
   style="index.xsl"
   doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
-  doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+        fast-render="1">
+
 <vm:page>
   <vm:header>
     <vm:title>Application Settings</vm:title>
@@ -152,6 +154,11 @@
    ?>
 	  </td>
 	  <td>
+              <img src="images/icons/go_16.png" border="0" alt="" />
+        	    <v:url name="appl7" value="Validation fields" url="--sprintf('uiedit_validation.vspx?l=%s', self.topmenu_level)" render-only="1" />
+        	    <div>
+        	      Define validation fields by imports.
+        	    </div>
 	  </td>
 	</tr>
       </table>
diff --git a/appsrc/ODS-Framework/back_nav.vspx b/appsrc/ODS-Framework/back_nav.vspx
index cc44f85..d2f27be 100644
--- a/appsrc/ODS-Framework/back_nav.vspx
+++ b/appsrc/ODS-Framework/back_nav.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: back_nav.vspx,v 1.5 2008/03/13 20:50:05 source Exp $
+ -  $Id: back_nav.vspx,v 1.5.2.1 2010/09/20 10:15:18 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/cert.vsp b/appsrc/ODS-Framework/cert.vsp
index 1c271d2..68c579c 100644
--- a/appsrc/ODS-Framework/cert.vsp
+++ b/appsrc/ODS-Framework/cert.vsp
@@ -1,56 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC
+  "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+  <head>
+      <link rel="stylesheet" type="text/css" href="/ods/default.css" />
+  </head>
 <?vsp
---
---  $Id: cert.vsp,v 1.1.2.3 2010/07/05 08:26:08 source Exp $
---
---  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
---  project.
---
---  Copyright (C) 1998-2009 OpenLink Software
---
---  This project is free software; you can redistribute it and/or modify it
---  under the terms of the GNU General Public License as published by the
---  Free Software Foundation; only version 2 of the License, dated June 1991.
---
---  This program is distributed in the hope that it will be useful, but
---  WITHOUT ANY WARRANTY; without even the implied warranty of
---  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
---  General Public License for more details.
---
---  You should have received a copy of the GNU General Public License along
---  with this program; if not, write to the Free Software Foundation, Inc.,
---  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
---
-
-   declare sid varchar;
+   declare sid, ua varchar;
+   declare kname, cvalue varchar;
+   declare cn, c, o, ou, mail, webid, pk, uname varchar;
+   declare days, hours any;
+   declare uid int;
    --dbg_obj_print (params);
+
+   ua := http_request_header (http_request_header (), 'User-Agent');
    sid := {?'sid'};
    if (get_keyword ('pubkey', params) is not null)
      {
-       declare kname, cvalue varchar;
-       declare cn, c, o, ou, mail, webid, pk, uname varchar;
-       declare uid int;
+       declare exts any;
        whenever not found goto nf;
        select U_NAME, U_FULL_NAME, U_E_MAIL, WAUI_BORG, WAUI_BCOUNTRY, U_ID 
-	into uname, cn, mail, o, c, uid from
-	SYS_USERS, WA_USER_INFO, VSPX_SESSION where
-	VS_SID = sid and VS_REALM = 'wa' and VS_UID = U_NAME and U_ID = WAUI_U_ID;
+         into uname, cn, mail, o, c, uid
+       	 from SYS_USERS, WA_USER_INFO, VSPX_SESSION
+      	where VS_SID = sid and VS_REALM = 'wa' and VS_UID = U_NAME and U_ID = WAUI_U_ID;
        webid := sioc..person_iri (sioc..user_obj_iri (uname));
+       
        pk := replace (get_keyword ('pubkey', params), '\r\n', '');
        pk := replace (pk, '\n', '');
        pk := replace (pk, '\r', '');
        kname := xenc_SPKI_read (null, pk);
-       xenc_x509_generate ('id_rsa', kname, sequence_next ('ca_id_rsa'), 365,
+       cn := get_keyword ('cn', params, cn);
+       c := get_keyword ('c', params, c);
+       o := get_keyword ('o', params, o);
+       mail := get_keyword ('email', params, mail);
+       webid := get_keyword ('webid', params, webid);
+       if (length (webid))
+         {  
+	   webid := 'URI:' || webid;
+	   exts := vector ('subjectAltName', webid, 'nsComment', 'Virtuoso Generated Certificate');
+         }
+       else
+         {
+	   exts := vector ('nsComment', 'Virtuoso Generated Certificate');
+	 }
+       days := atoi (get_keyword ('days', params, '365'));
+       hours := atof (get_keyword ('hours', params, '0.0'));
+       xenc_x509_generate ('id_rsa', kname, sequence_next ('ca_id_rsa'), days,
 		vector (
 			'CN', cn,
 			'C',  c,
 			'O',  o,
-			'OU', ou,
 			'emailAddress', mail
 			),
-		vector ('subjectAltName', 'URI:'||webid, 'nsComment', 'Virtuoso Generated Certificate'));
+			exts,
+		        hours);
        cvalue := xenc_pem_export (kname);
-       insert into WA_USER_CERTS (UC_U_ID, UC_CERT, UC_FINGERPRINT, UC_LOGIN) 
-		         values (uid, cvalue, get_certificate_info (6, cvalue, 0, ''), 0);
+       insert into WA_USER_CERTS (UC_U_ID, UC_CERT, UC_FINGERPRINT, UC_LOGIN, UC_TS)
+		         values (uid, cvalue, get_certificate_info (6, cvalue, 0, ''), 0, now ());
+       http_rewrite (); 
        http_header ('Content-Type: application/x-x509-user-cert\r\n');
        http (decode_base64 (xenc_X509_certificate_serialize (kname)));
        xenc_key_remove (kname);
@@ -58,12 +66,123 @@
        nf:;
     }
 ?>
-<html>
-  <body>
+  <body style="background-color: #EFEFEF;">
+     <?vsp
+       if (coalesce (strstr (ua, 'MSIE'), -1) > 0 or regexp_match ('Mozilla.*Windows.*Firefox.*\.NET CLR .*', ua) is not null)
+       {
+	 declare svc_url varchar;
+	 svc_url := (select  top 1 WS_CERT_GEN_URL from DB.DBA.WA_SETTINGS);
+         if (length (svc_url)) {
+         for select U_NAME, U_FULL_NAME, U_E_MAIL, WAUI_BORG, WAUI_BCOUNTRY from SYS_USERS, VSPX_SESSION, WA_USER_INFO
+      	where VS_SID = sid and VS_REALM = 'wa' and VS_UID = U_NAME and U_ID = WAUI_U_ID do 
+          {
+            declare url varchar;
+            webid := sioc..person_iri (sioc..user_obj_iri (U_NAME));
+            url := sprintf ('%s?uri=%U&name=%U&email=%U&organization=%U',
+		svc_url, webid, coalesce (U_FULL_NAME, U_NAME), coalesce (U_E_MAIL, ''), coalesce (WAUI_BORG, '')); 
+	
+     ?>
+     <form>
+	<div>
+ 	  <a class="button" href='<?vsp http (url); ?>'>Generate</a>	
+        </div>
+     </form>
+     	     
+     <?vsp
+       }
+	 } 
+	else if (regexp_match ('Mozilla.*Windows.*Firefox.*\.NET CLR .*', ua) is not null)
+	  goto make_cert;
+        else 
+	 {  ?>Certificate & Key Generation Not Supported. You can export a PKCS12 file produced by other browsers instead <?vsp } 
+       }
+       else
+       {
+ 	 make_cert:;
+         for select U_NAME, U_FULL_NAME, U_E_MAIL, WAUI_BORG, WAUI_BCOUNTRY from SYS_USERS, VSPX_SESSION, WA_USER_INFO
+      	    where VS_SID = sid and VS_REALM = 'wa' and VS_UID = U_NAME and U_ID = WAUI_U_ID do 
+	    {
+	      cn := coalesce (U_FULL_NAME, U_NAME);
+              webid := sioc..person_iri (sioc..user_obj_iri (U_NAME));
+	      mail := coalesce (U_E_MAIL, '');
+	      o := WAUI_BORG;
+              c := WAUI_BCOUNTRY;
+              
+	    }
+     ?>
      <form>
 	<input type="hidden" name="sid" value="<?V {?'sid'} ?>"/>
-	Key strength: <keygen name="pubkey"/><br>
-	<input type="submit" name="gen" value="Generate"/>
+	 <table border="0">
+	     <tr>
+		 <td nowrap="1">
+		     Common Name: 
+		 </td>
+		 <td>
+		     <input type="text" name="cn" value="<?V cn ?>" size="50"/>
+		 </td>
+	     </tr>
+	     <tr>
+		 <td nowrap="1">
+		     Country: 
+		 </td>
+		 <td>
+		     <input type="text" name="c" value="<?V c ?>" size="50"/>
+		 </td>
+	     </tr>
+	     <tr>
+		 <td nowrap="1">
+		     Organization: 
+		 </td>
+		 <td>
+		     <input type="text" name="o" value="<?V o ?>" size="50"/>
+		 </td>
+	     </tr>
+	     <tr>
+		 <td>
+		     E-mail:
+		 </td>
+		 <td>
+		     <input type="text" name="email" value="<?V mail ?>" size="50"/>
+		 </td>
+	     </tr>
+	     <tr>
+		 <td>
+		     WebID:       
+		 </td>
+		 <td>
+		     <input type="text" name="webid" value="<?V webid ?>" size="80" />
+		 </td>
+	     </tr>
+	     <tr>
+		 <td>
+		     Key strength: 
+		 </td>
+		 <td>
+		     <keygen name="pubkey" />
+		 </td>
+	     </tr>
+	     <tr>
+		 <td rowspan="2">
+		     Valid for 
+		 </td>
+		 <td>
+		     <input type="text" name="hours" value="0.0" size="4"/> hours
+		 </td>
+	     </tr>
+	     <tr>
+		 <td>
+		     <input type="text" name="days" value="365" size="4"/> days
+		 </td>
+	     </tr>
+	     <tr>
+		 <td colspan="2">
+		     <input type="submit" name="gen" value="submit certificate request"/>
+		 </td>
+	     </tr>
+	 </table>
      </form>
+     <?vsp
+       }
+     ?>
   </body>
 </html>
diff --git a/appsrc/ODS-Framework/ckeditor/ckeditor.js b/appsrc/ODS-Framework/ckeditor/ckeditor.js
index c0c9bfa..8843b54 100644
--- a/appsrc/ODS-Framework/ckeditor/ckeditor.js
+++ b/appsrc/ODS-Framework/ckeditor/ckeditor.js
@@ -1,129 +1,141 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-(function(){if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'A5AB4B6',version:'3.3.1',revision:'5586',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf('://')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;if(!d)throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';return d;})(),getUrl:function(d){if(d.indexOf('://')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/')d+=(d.indexOf('?')>=0?'&':'?')+'t='+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();var a=CKEDITOR;if(!a.event){a.event=function(){};a.event.implementOn=function(b,c){var d=a.event.prototype;for(var e in d){if(b[e]==undefined)b[e]=d[e];}};a.event.prototype=(function(){var b=function(d){var e=d.getPrivate&&d.getPrivate()||d._||(d._={});return e.events||(e.events={});},c=function(d){this.name=d;this.listeners=[];};c.prototype={getListenerIndex:function(d){for(var e=0,f=this.listeners;e<f.length;e++){if(f[e].fn==d)return e;}return-1;}};return{on:function(d,e,f,g,h){var i=b(this),j=i[d]||(i[d]=new c(d));if(j.getListenerIndex(e)<0){var k=j.listeners;if(!f)f=this;if(isNaN(h))h=10;var l=this,m=function(o,p,q,r){var s={name:d,sender:this,editor:o,data:p,listenerData:g,stop:q,cancel:r,removeListener:function(){l.removeListener(d,e);}};e.call(f,s);return s.data;};m.fn=e;m.priority=h;for(var n=k.length-1;n>=0;n--){if(k[n].priority<=h){k.splice(n+1,0,m);return;}}k.unshift(m);}},fire:(function(){var d=false,e=function(){d=true;},f=false,g=function(){f=true;};return function(h,i,j){var k=b(this)[h],l=d,m=f;d=f=false;if(k){var n=k.listeners;if(n.length){n=n.slice(0);for(var o=0;o<n.length;o++){var p=n[o].call(this,j,i,e,g);if(typeof p!='undefined')i=p;if(d||f)break;}}}var q=f||(typeof i=='undefined'?false:i);d=l;f=m;return q;};})(),fireOnce:function(d,e,f){var g=this.fire(d,e,f);delete b(this)[d];return g;},removeListener:function(d,e){var f=b(this)[d];if(f){var g=f.getListenerIndex(e);if(g>=0)f.listeners.splice(g,1);}},hasListeners:function(d){var e=b(this)[d];return e&&e.listeners.length>0;
-}};})();}if(!a.editor){a.ELEMENT_MODE_NONE=0;a.ELEMENT_MODE_REPLACE=1;a.ELEMENT_MODE_APPENDTO=2;a.editor=function(b,c,d,e){var f=this;f._={instanceConfig:b,element:c,data:e};f.elementMode=d||0;a.event.call(f);f._init();};a.editor.replace=function(b,c){var d=b;if(typeof d!='object'){d=document.getElementById(b);if(!d){var e=0,f=document.getElementsByName(b);while((d=f[e++])&&d.tagName.toLowerCase()!='textarea'){}}if(!d)throw '[CKEDITOR.editor.replace] The element with id or name "'+b+'" was not found.';}d.style.visibility='hidden';return new a.editor(c,d,1);};a.editor.appendTo=function(b,c,d){var e=b;if(typeof e!='object'){e=document.getElementById(b);if(!e)throw '[CKEDITOR.editor.appendTo] The element with id "'+b+'" was not found.';}return new a.editor(c,e,2,d);};a.editor.prototype={_init:function(){var b=a.editor._pending||(a.editor._pending=[]);b.push(this);},fire:function(b,c){return a.event.prototype.fire.call(this,b,c,this);},fireOnce:function(b,c){return a.event.prototype.fireOnce.call(this,b,c,this);}};a.event.implementOn(a.editor.prototype,true);}if(!a.env)a.env=(function(){var b=navigator.userAgent.toLowerCase(),c=window.opera,d={ie:/*@cc_on!@*/false,opera:!!c&&c.version,webkit:b.indexOf(' applewebkit/')>-1,air:b.indexOf(' adobeair/')>-1,mac:b.indexOf('macintosh')>-1,quirks:document.compatMode=='BackCompat',mobile:b.indexOf('mobile')>-1,isCustomDomain:function(){var g=document.domain,h=window.location.hostname;return this.ie&&g!=h&&g!='['+h+']';}};d.gecko=navigator.product=='Gecko'&&!d.webkit&&!d.opera;var e=0;if(d.ie){e=parseFloat(b.match(/msie (\d+)/)[1]);d.ie8=!!document.documentMode;d.ie8Compat=document.documentMode==8;d.ie7Compat=e==7&&!document.documentMode||document.documentMode==7;d.ie6Compat=e<7||d.quirks;}if(d.gecko){var f=b.match(/rv:([\d\.]+)/);if(f){f=f[1].split('.');e=f[0]*10000+(f[1]||0)*100+ +(f[2]||0);}}if(d.opera)e=parseFloat(c.version());if(d.air)e=parseFloat(b.match(/ adobeair\/(\d+)/)[1]);if(d.webkit)e=parseFloat(b.match(/ applewebkit\/(\d+)/)[1]);d.version=e;d.isCompatible=!d.mobile&&(d.ie&&e>=6||d.gecko&&e>=10801||d.opera&&e>=9.5||d.air&&e>=1||d.webkit&&e>=522||false);d.cssClass='cke_browser_'+(d.ie?'ie':d.gecko?'gecko':d.opera?'opera':d.air?'air':d.webkit?'webkit':'unknown');if(d.quirks)d.cssClass+=' cke_browser_quirks';if(d.ie){d.cssClass+=' cke_browser_ie'+(d.version<7?'6':d.version>=8?'8':'7');if(d.quirks)d.cssClass+=' cke_browser_iequirks';}if(d.gecko&&e<10900)d.cssClass+=' cke_browser_gecko18';return d;
-})();var b=a.env;var c=b.ie;if(a.status=='unloaded')(function(){a.event.implementOn(a);a.loadFullCore=function(){if(a.status!='basic_ready'){a.loadFullCore._load=true;return;}delete a.loadFullCore;var e=document.createElement('script');e.type='text/javascript';e.src=a.basePath+'ckeditor.js';document.getElementsByTagName('head')[0].appendChild(e);};a.loadFullCoreTimeout=0;a.replaceClass='ckeditor';a.replaceByClassEnabled=true;var d=function(e,f,g,h){if(b.isCompatible){if(a.loadFullCore)a.loadFullCore();var i=g(e,f,h);a.add(i);return i;}return null;};a.replace=function(e,f){return d(e,f,a.editor.replace);};a.appendTo=function(e,f,g){return d(e,f,a.editor.appendTo,g);};a.add=function(e){var f=this._.pending||(this._.pending=[]);f.push(e);};a.replaceAll=function(){var e=document.getElementsByTagName('textarea');for(var f=0;f<e.length;f++){var g=null,h=e[f],i=h.name;if(!h.name&&!h.id)continue;if(typeof arguments[0]=='string'){var j=new RegExp('(?:^|\\s)'+arguments[0]+'(?:$|\\s)');if(!j.test(h.className))continue;}else if(typeof arguments[0]=='function'){g={};if(arguments[0](h,g)===false)continue;}this.replace(h,g);}};(function(){var e=function(){var f=a.loadFullCore,g=a.loadFullCoreTimeout;if(a.replaceByClassEnabled)a.replaceAll(a.replaceClass);a.status='basic_ready';if(f&&f._load)f();else if(g)setTimeout(function(){if(a.loadFullCore)a.loadFullCore();},g*1000);};if(window.addEventListener)window.addEventListener('load',e,false);else if(window.attachEvent)window.attachEvent('onload',e);})();a.status='basic_loaded';})();a.dom={};var d=a.dom;(function(){var e=[];a.on('reset',function(){e=[];});a.tools={arrayCompare:function(f,g){if(!f&&!g)return true;if(!f||!g||f.length!=g.length)return false;for(var h=0;h<f.length;h++){if(f[h]!=g[h])return false;}return true;},clone:function(f){var g;if(f&&f instanceof Array){g=[];for(var h=0;h<f.length;h++)g[h]=this.clone(f[h]);return g;}if(f===null||typeof f!='object'||f instanceof String||f instanceof Number||f instanceof Boolean||f instanceof Date||f instanceof RegExp)return f;g=new f.constructor();for(var i in f){var j=f[i];g[i]=this.clone(j);}return g;},capitalize:function(f){return f.charAt(0).toUpperCase()+f.substring(1).toLowerCase();},extend:function(f){var g=arguments.length,h,i;if(typeof (h=arguments[g-1])=='boolean')g--;else if(typeof (h=arguments[g-2])=='boolean'){i=arguments[g-1];g-=2;}for(var j=1;j<g;j++){var k=arguments[j];for(var l in k){if(h===true||f[l]==undefined)if(!i||l in i)f[l]=k[l];}}return f;},prototypedCopy:function(f){var g=function(){};
-g.prototype=f;return new g();},isArray:function(f){return!!f&&f instanceof Array;},isEmpty:function(f){for(var g in f){if(f.hasOwnProperty(g))return false;}return true;},cssStyleToDomStyle:(function(){var f=document.createElement('div').style,g=typeof f.cssFloat!='undefined'?'cssFloat':typeof f.styleFloat!='undefined'?'styleFloat':'float';return function(h){if(h=='float')return g;else return h.replace(/-./g,function(i){return i.substr(1).toUpperCase();});};})(),buildStyleHtml:function(f){f=[].concat(f);var g,h=[];for(var i=0;i<f.length;i++){g=f[i];if(/@import|[{}]/.test(g))h.push('<style>'+g+'</style>');else h.push('<link type="text/css" rel=stylesheet href="'+g+'">');}return h.join('');},htmlEncode:function(f){var g=function(k){var l=new d.element('span');l.setText(k);return l.getHtml();},h=g('\n').toLowerCase()=='<br>'?function(k){return g(k).replace(/<br>/gi,'\n');}:g,i=g('>')=='>'?function(k){return h(k).replace(/>/g,'>');}:h,j=g('  ')=='  '?function(k){return i(k).replace(/ /g,' ');}:i;this.htmlEncode=j;return this.htmlEncode(f);},htmlEncodeAttr:function(f){return f.replace(/"/g,'"').replace(/</g,'<').replace(/>/,'>');},escapeCssSelector:function(f){return f.replace(/[\s#:.,$*^\[\]()~=+>]/g,'\\$&');},getNextNumber:(function(){var f=0;return function(){return++f;};})(),override:function(f,g){return g(f);},setTimeout:function(f,g,h,i,j){if(!j)j=window;if(!h)h=j;return j.setTimeout(function(){if(i)f.apply(h,[].concat(i));else f.apply(h);},g||0);},trim:(function(){var f=/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g;return function(g){return g.replace(f,'');};})(),ltrim:(function(){var f=/^[ \t\n\r]+/g;return function(g){return g.replace(f,'');};})(),rtrim:(function(){var f=/[ \t\n\r]+$/g;return function(g){return g.replace(f,'');};})(),indexOf:Array.prototype.indexOf?function(f,g){return f.indexOf(g);}:function(f,g){for(var h=0,i=f.length;h<i;h++){if(f[h]===g)return h;}return-1;},bind:function(f,g){return function(){return f.apply(g,arguments);};},createClass:function(f){var g=f.$,h=f.base,i=f.privates||f._,j=f.proto,k=f.statics;if(i){var l=g;g=function(){var p=this;var m=p._||(p._={});for(var n in i){var o=i[n];m[n]=typeof o=='function'?a.tools.bind(o,p):o;}l.apply(p,arguments);};}if(h){g.prototype=this.prototypedCopy(h.prototype);g.prototype['constructor']=g;g.prototype.base=function(){this.base=h.prototype.base;h.apply(this,arguments);this.base=arguments.callee;};}if(j)this.extend(g.prototype,j,true);if(k)this.extend(g,k,true);return g;},addFunction:function(f,g){return e.push(function(){f.apply(g||this,arguments);
-})-1;},removeFunction:function(f){e[f]=null;},callFunction:function(f){var g=e[f];return g&&g.apply(window,Array.prototype.slice.call(arguments,1));},cssLength:(function(){var f=/^\d+(?:\.\d+)?$/;return function(g){return g+(f.test(g)?'px':'');};})(),repeat:function(f,g){return new Array(g+1).join(f);},tryThese:function(){var f;for(var g=0,h=arguments.length;g<h;g++){var i=arguments[g];try{f=i();break;}catch(j){}}return f;},genKey:function(){return Array.prototype.slice.call(arguments).join('-');}};})();var e=a.tools;a.dtd=(function(){var f=e.extend,g={isindex:1,fieldset:1},h={input:1,button:1,select:1,textarea:1,label:1},i=f({a:1},h),j=f({iframe:1},i),k={hr:1,ul:1,menu:1,div:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1},l={ins:1,del:1,script:1,style:1},m=f({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1},l),n=f({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1},m),o=f({p:1},n),p=f({iframe:1},n,h),q={img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1},r=f({a:1},p),s={tr:1},t={'#':1},u=f({param:1},q),v=f({form:1},g,j,k,o),w={li:1},x={style:1,script:1},y={base:1,link:1,meta:1,title:1},z=f(y,x),A={head:1,body:1},B={html:1},C={address:1,blockquote:1,center:1,dir:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,menu:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1};return{$nonBodyContent:f(B,A,y),$block:C,$blockLimit:{body:1,div:1,td:1,th:1,caption:1,form:1},$inline:r,$body:f({script:1,style:1},C),$cdata:{script:1,style:1},$empty:{area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1},$listItem:{dd:1,dt:1,li:1},$list:{ul:1,ol:1,dl:1},$nonEditable:{applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1,param:1},$removeEmpty:{abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1},$tabIndex:{a:1,area:1,button:1,input:1,object:1,select:1,textarea:1},$tableContent:{caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1},html:A,head:z,style:t,script:t,body:v,base:{},link:{},meta:{},title:t,col:{},tr:{td:1,th:1},img:{},colgroup:{col:1},noscript:v,td:v,br:{},th:v,center:v,kbd:r,button:f(o,k),basefont:{},h5:r,h4:r,samp:r,h6:r,ol:w,h1:r,h3:r,option:t,h2:r,form:f(g,j,k,o),select:{optgroup:1,option:1},font:r,ins:r,menu:w,abbr:r,label:r,table:{thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1},code:r,script:t,tfoot:s,cite:r,li:v,input:{},iframe:v,strong:r,textarea:t,noframes:v,big:r,small:r,span:r,hr:{},dt:r,sub:r,optgroup:{option:1},param:{},bdo:r,'var':r,div:v,object:u,sup:r,dd:v,strike:r,area:{},dir:w,map:f({area:1,form:1,p:1},g,l,k),applet:u,dl:{dt:1,dd:1},del:r,isindex:{},fieldset:f({legend:1},q),thead:s,ul:w,acronym:r,b:r,a:p,blockquote:v,caption:r,i:r,u:r,tbody:s,s:r,address:f(j,o),tt:r,legend:r,q:r,pre:f(m,i),p:r,em:r,dfn:r};
-})();var f=a.dtd;d.event=function(g){this.$=g;};d.event.prototype={getKey:function(){return this.$.keyCode||this.$.which;},getKeystroke:function(){var h=this;var g=h.getKey();if(h.$.ctrlKey||h.$.metaKey)g+=1000;if(h.$.shiftKey)g+=2000;if(h.$.altKey)g+=4000;return g;},preventDefault:function(g){var h=this.$;if(h.preventDefault)h.preventDefault();else h.returnValue=false;if(g)this.stopPropagation();},stopPropagation:function(){var g=this.$;if(g.stopPropagation)g.stopPropagation();else g.cancelBubble=true;},getTarget:function(){var g=this.$.target||this.$.srcElement;return g?new d.node(g):null;}};a.CTRL=1000;a.SHIFT=2000;a.ALT=4000;d.domObject=function(g){if(g)this.$=g;};d.domObject.prototype=(function(){var g=function(h,i){return function(j){if(typeof a!='undefined')h.fire(i,new d.event(j));};};return{getPrivate:function(){var h;if(!(h=this.getCustomData('_')))this.setCustomData('_',h={});return h;},on:function(h){var k=this;var i=k.getCustomData('_cke_nativeListeners');if(!i){i={};k.setCustomData('_cke_nativeListeners',i);}if(!i[h]){var j=i[h]=g(k,h);if(k.$.addEventListener)k.$.addEventListener(h,j,!!a.event.useCapture);else if(k.$.attachEvent)k.$.attachEvent('on'+h,j);}return a.event.prototype.on.apply(k,arguments);},removeListener:function(h){var k=this;a.event.prototype.removeListener.apply(k,arguments);if(!k.hasListeners(h)){var i=k.getCustomData('_cke_nativeListeners'),j=i&&i[h];if(j){if(k.$.removeEventListener)k.$.removeEventListener(h,j,false);else if(k.$.detachEvent)k.$.detachEvent('on'+h,j);delete i[h];}}},removeAllListeners:function(){var k=this;var h=k.getCustomData('_cke_nativeListeners');for(var i in h){var j=h[i];if(k.$.removeEventListener)k.$.removeEventListener(i,j,false);else if(k.$.detachEvent)k.$.detachEvent('on'+i,j);delete h[i];}}};})();(function(g){var h={};a.on('reset',function(){h={};});g.equals=function(i){return i&&i.$===this.$;};g.setCustomData=function(i,j){var k=this.getUniqueId(),l=h[k]||(h[k]={});l[i]=j;return this;};g.getCustomData=function(i){var j=this.$._cke_expando,k=j&&h[j];return k&&k[i];};g.removeCustomData=function(i){var j=this.$._cke_expando,k=j&&h[j],l=k&&k[i];if(typeof l!='undefined')delete k[i];return l||null;};g.clearCustomData=function(){this.removeAllListeners();var i=this.$._cke_expando;i&&delete h[i];};g.getUniqueId=function(){return this.$._cke_expando||(this.$._cke_expando=e.getNextNumber());};a.event.implementOn(g);})(d.domObject.prototype);d.window=function(g){d.domObject.call(this,g);};d.window.prototype=new d.domObject();
-e.extend(d.window.prototype,{focus:function(){if(b.webkit&&this.$.parent)this.$.parent.focus();this.$.focus();},getViewPaneSize:function(){var g=this.$.document,h=g.compatMode=='CSS1Compat';return{width:(h?g.documentElement.clientWidth:g.body.clientWidth)||0,height:(h?g.documentElement.clientHeight:g.body.clientHeight)||0};},getScrollPosition:function(){var g=this.$;if('pageXOffset' in g)return{x:g.pageXOffset||0,y:g.pageYOffset||0};else{var h=g.document;return{x:h.documentElement.scrollLeft||h.body.scrollLeft||0,y:h.documentElement.scrollTop||h.body.scrollTop||0};}}});d.document=function(g){d.domObject.call(this,g);};var g=d.document;g.prototype=new d.domObject();e.extend(g.prototype,{appendStyleSheet:function(h){if(this.$.createStyleSheet)this.$.createStyleSheet(h);else{var i=new d.element('link');i.setAttributes({rel:'stylesheet',type:'text/css',href:h});this.getHead().append(i);}},appendStyleText:function(h){var k=this;if(k.$.createStyleSheet){var i=k.$.createStyleSheet('');i.cssText=h;}else{var j=new d.element('style',k);j.append(new d.text(h,k));k.getHead().append(j);}},createElement:function(h,i){var j=new d.element(h,this);if(i){if(i.attributes)j.setAttributes(i.attributes);if(i.styles)j.setStyles(i.styles);}return j;},createText:function(h){return new d.text(h,this);},focus:function(){this.getWindow().focus();},getById:function(h){var i=this.$.getElementById(h);return i?new d.element(i):null;},getByAddress:function(h,i){var j=this.$.documentElement;for(var k=0;j&&k<h.length;k++){var l=h[k];if(!i){j=j.childNodes[l];continue;}var m=-1;for(var n=0;n<j.childNodes.length;n++){var o=j.childNodes[n];if(i===true&&o.nodeType==3&&o.previousSibling&&o.previousSibling.nodeType==3)continue;m++;if(m==l){j=o;break;}}}return j?new d.node(j):null;},getElementsByTag:function(h,i){if(!c&&i)h=i+':'+h;return new d.nodeList(this.$.getElementsByTagName(h));},getHead:function(){var h=this.$.getElementsByTagName('head')[0];h=new d.element(h);return(this.getHead=function(){return h;})();},getBody:function(){var h=new d.element(this.$.body);return(this.getBody=function(){return h;})();},getDocumentElement:function(){var h=new d.element(this.$.documentElement);return(this.getDocumentElement=function(){return h;})();},getWindow:function(){var h=new d.window(this.$.parentWindow||this.$.defaultView);return(this.getWindow=function(){return h;})();}});d.node=function(h){if(h){switch(h.nodeType){case 9:return new g(h);case 1:return new d.element(h);case 3:return new d.text(h);}d.domObject.call(this,h);
-}return this;};d.node.prototype=new d.domObject();a.NODE_ELEMENT=1;a.NODE_DOCUMENT=9;a.NODE_TEXT=3;a.NODE_COMMENT=8;a.NODE_DOCUMENT_FRAGMENT=11;a.POSITION_IDENTICAL=0;a.POSITION_DISCONNECTED=1;a.POSITION_FOLLOWING=2;a.POSITION_PRECEDING=4;a.POSITION_IS_CONTAINED=8;a.POSITION_CONTAINS=16;e.extend(d.node.prototype,{appendTo:function(h,i){h.append(this,i);return h;},clone:function(h,i){var j=this.$.cloneNode(h);if(!i){var k=function(l){if(l.nodeType!=1)return;l.removeAttribute('id',false);l.removeAttribute('_cke_expando',false);var m=l.childNodes;for(var n=0;n<m.length;n++)k(m[n]);};k(j);}return new d.node(j);},hasPrevious:function(){return!!this.$.previousSibling;},hasNext:function(){return!!this.$.nextSibling;},insertAfter:function(h){h.$.parentNode.insertBefore(this.$,h.$.nextSibling);return h;},insertBefore:function(h){h.$.parentNode.insertBefore(this.$,h.$);return h;},insertBeforeMe:function(h){this.$.parentNode.insertBefore(h.$,this.$);return h;},getAddress:function(h){var i=[],j=this.getDocument().$.documentElement,k=this.$;while(k&&k!=j){var l=k.parentNode,m=-1;if(l){for(var n=0;n<l.childNodes.length;n++){var o=l.childNodes[n];if(h&&o.nodeType==3&&o.previousSibling&&o.previousSibling.nodeType==3)continue;m++;if(o==k)break;}i.unshift(m);}k=l;}return i;},getDocument:function(){var h=new g(this.$.ownerDocument||this.$.parentNode.ownerDocument);return(this.getDocument=function(){return h;})();},getIndex:function(){var h=this.$,i=h.parentNode&&h.parentNode.firstChild,j=-1;while(i){j++;if(i==h)return j;i=i.nextSibling;}return-1;},getNextSourceNode:function(h,i,j){if(j&&!j.call){var k=j;j=function(n){return!n.equals(k);};}var l=!h&&this.getFirst&&this.getFirst(),m;if(!l){if(this.type==1&&j&&j(this,true)===false)return null;l=this.getNext();}while(!l&&(m=(m||this).getParent())){if(j&&j(m,true)===false)return null;l=m.getNext();}if(!l)return null;if(j&&j(l)===false)return null;if(i&&i!=l.type)return l.getNextSourceNode(false,i,j);return l;},getPreviousSourceNode:function(h,i,j){if(j&&!j.call){var k=j;j=function(n){return!n.equals(k);};}var l=!h&&this.getLast&&this.getLast(),m;if(!l){if(this.type==1&&j&&j(this,true)===false)return null;l=this.getPrevious();}while(!l&&(m=(m||this).getParent())){if(j&&j(m,true)===false)return null;l=m.getPrevious();}if(!l)return null;if(j&&j(l)===false)return null;if(i&&l.type!=i)return l.getPreviousSourceNode(false,i,j);return l;},getPrevious:function(h){var i=this.$,j;do{i=i.previousSibling;j=i&&new d.node(i);}while(j&&h&&!h(j))return j;
-},getNext:function(h){var i=this.$,j;do{i=i.nextSibling;j=i&&new d.node(i);}while(j&&h&&!h(j))return j;},getParent:function(){var h=this.$.parentNode;return h&&h.nodeType==1?new d.node(h):null;},getParents:function(h){var i=this,j=[];do j[h?'push':'unshift'](i);while(i=i.getParent())return j;},getCommonAncestor:function(h){var j=this;if(h.equals(j))return j;if(h.contains&&h.contains(j))return h;var i=j.contains?j:j.getParent();do{if(i.contains(h))return i;}while(i=i.getParent())return null;},getPosition:function(h){var i=this.$,j=h.$;if(i.compareDocumentPosition)return i.compareDocumentPosition(j);if(i==j)return 0;if(this.type==1&&h.type==1){if(i.contains){if(i.contains(j))return 16+4;if(j.contains(i))return 8+2;}if('sourceIndex' in i)return i.sourceIndex<0||j.sourceIndex<0?1:i.sourceIndex<j.sourceIndex?4:2;}var k=this.getAddress(),l=h.getAddress(),m=Math.min(k.length,l.length);for(var n=0;n<=m-1;n++){if(k[n]!=l[n]){if(n<m)return k[n]<l[n]?4:2;break;}}return k.length<l.length?16+4:8+2;},getAscendant:function(h,i){var j=this.$;if(!i)j=j.parentNode;while(j){if(j.nodeName&&j.nodeName.toLowerCase()==h)return new d.node(j);j=j.parentNode;}return null;},hasAscendant:function(h,i){var j=this.$;if(!i)j=j.parentNode;while(j){if(j.nodeName&&j.nodeName.toLowerCase()==h)return true;j=j.parentNode;}return false;},move:function(h,i){h.append(this.remove(),i);},remove:function(h){var i=this.$,j=i.parentNode;if(j){if(h)for(var k;k=i.firstChild;)j.insertBefore(i.removeChild(k),i);j.removeChild(i);}return this;},replace:function(h){this.insertBefore(h);h.remove();},trim:function(){this.ltrim();this.rtrim();},ltrim:function(){var k=this;var h;while(k.getFirst&&(h=k.getFirst())){if(h.type==3){var i=e.ltrim(h.getText()),j=h.getLength();if(!i){h.remove();continue;}else if(i.length<j){h.split(j-i.length);k.$.removeChild(k.$.firstChild);}}break;}},rtrim:function(){var k=this;var h;while(k.getLast&&(h=k.getLast())){if(h.type==3){var i=e.rtrim(h.getText()),j=h.getLength();if(!i){h.remove();continue;}else if(i.length<j){h.split(i.length);k.$.lastChild.parentNode.removeChild(k.$.lastChild);}}break;}if(!c&&!b.opera){h=k.$.lastChild;if(h&&h.type==1&&h.nodeName.toLowerCase()=='br')h.parentNode.removeChild(h);}}});d.nodeList=function(h){this.$=h;};d.nodeList.prototype={count:function(){return this.$.length;},getItem:function(h){var i=this.$[h];return i?new d.node(i):null;}};d.element=function(h,i){if(typeof h=='string')h=(i?i.$:document).createElement(h);d.domObject.call(this,h);};var h=d.element;
-h.get=function(i){return i&&(i.$?i:new h(i));};h.prototype=new d.node();h.createFromHtml=function(i,j){var k=new h('div',j);k.setHtml(i);return k.getFirst().remove();};h.setMarker=function(i,j,k,l){var m=j.getCustomData('list_marker_id')||j.setCustomData('list_marker_id',e.getNextNumber()).getCustomData('list_marker_id'),n=j.getCustomData('list_marker_names')||j.setCustomData('list_marker_names',{}).getCustomData('list_marker_names');i[m]=j;n[k]=1;return j.setCustomData(k,l);};h.clearAllMarkers=function(i){for(var j in i)h.clearMarkers(i,i[j],true);};h.clearMarkers=function(i,j,k){var l=j.getCustomData('list_marker_names'),m=j.getCustomData('list_marker_id');for(var n in l)j.removeCustomData(n);j.removeCustomData('list_marker_names');if(k){j.removeCustomData('list_marker_id');delete i[m];}};e.extend(h.prototype,{type:1,addClass:function(i){var j=this.$.className;if(j){var k=new RegExp('(?:^|\\s)'+i+'(?:\\s|$)','');if(!k.test(j))j+=' '+i;}this.$.className=j||i;},removeClass:function(i){var j=this.getAttribute('class');if(j){var k=new RegExp('(?:^|\\s+)'+i+'(?=\\s|$)','i');if(k.test(j)){j=j.replace(k,'').replace(/^\s+/,'');if(j)this.setAttribute('class',j);else this.removeAttribute('class');}}},hasClass:function(i){var j=new RegExp('(?:^|\\s+)'+i+'(?=\\s|$)','');return j.test(this.getAttribute('class'));},append:function(i,j){var k=this;if(typeof i=='string')i=k.getDocument().createElement(i);if(j)k.$.insertBefore(i.$,k.$.firstChild);else k.$.appendChild(i.$);return i;},appendHtml:function(i){var k=this;if(!k.$.childNodes.length)k.setHtml(i);else{var j=new h('div',k.getDocument());j.setHtml(i);j.moveChildren(k);}},appendText:function(i){if(this.$.text!=undefined)this.$.text+=i;else this.append(new d.text(i));},appendBogus:function(){var k=this;var i=k.getLast();while(i&&i.type==3&&!e.rtrim(i.getText()))i=i.getPrevious();if(!i||!i.is||!i.is('br')){var j=b.opera?k.getDocument().createText(''):k.getDocument().createElement('br');b.gecko&&j.setAttribute('type','_moz');k.append(j);}},breakParent:function(i){var l=this;var j=new d.range(l.getDocument());j.setStartAfter(l);j.setEndAfter(i);var k=j.extractContents();j.insertNode(l.remove());k.insertAfterNode(l);},contains:c||b.webkit?function(i){var j=this.$;return i.type!=1?j.contains(i.getParent().$):j!=i.$&&j.contains(i.$);}:function(i){return!!(this.$.compareDocumentPosition(i.$)&16);},focus:function(){try{this.$.focus();}catch(i){}},getHtml:function(){var i=this.$.innerHTML;return c?i.replace(/<\?[^>]*>/g,''):i;
-},getOuterHtml:function(){var j=this;if(j.$.outerHTML)return j.$.outerHTML.replace(/<\?[^>]*>/,'');var i=j.$.ownerDocument.createElement('div');i.appendChild(j.$.cloneNode(true));return i.innerHTML;},setHtml:function(i){return this.$.innerHTML=i;},setText:function(i){h.prototype.setText=this.$.innerText!=undefined?function(j){return this.$.innerText=j;}:function(j){return this.$.textContent=j;};return this.setText(i);},getAttribute:(function(){var i=function(j){return this.$.getAttribute(j,2);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){var n=this;switch(j){case 'class':j='className';break;case 'tabindex':var k=i.call(n,j);if(k!==0&&n.$.tabIndex===0)k=null;return k;break;case 'checked':var l=n.$.attributes.getNamedItem(j),m=l.specified?l.nodeValue:n.$.checked;return m?'checked':null;case 'hspace':return n.$.hspace;case 'style':return n.$.style.cssText;}return i.call(n,j);};else return i;})(),getChildren:function(){return new d.nodeList(this.$.childNodes);},getComputedStyle:c?function(i){return this.$.currentStyle[e.cssStyleToDomStyle(i)];}:function(i){return this.getWindow().$.getComputedStyle(this.$,'').getPropertyValue(i);},getDtd:function(){var i=f[this.getName()];this.getDtd=function(){return i;};return i;},getElementsByTag:g.prototype.getElementsByTag,getTabIndex:c?function(){var i=this.$.tabIndex;if(i===0&&!f.$tabIndex[this.getName()]&&parseInt(this.getAttribute('tabindex'),10)!==0)i=-1;return i;}:b.webkit?function(){var i=this.$.tabIndex;if(i==undefined){i=parseInt(this.getAttribute('tabindex'),10);if(isNaN(i))i=-1;}return i;}:function(){return this.$.tabIndex;},getText:function(){return this.$.textContent||this.$.innerText||'';},getWindow:function(){return this.getDocument().getWindow();},getId:function(){return this.$.id||null;},getNameAtt:function(){return this.$.name||null;},getName:function(){var i=this.$.nodeName.toLowerCase();if(c){var j=this.$.scopeName;if(j!='HTML')i=j.toLowerCase()+':'+i;}return(this.getName=function(){return i;})();},getValue:function(){return this.$.value;},getFirst:function(i){var j=this.$.firstChild,k=j&&new d.node(j);if(k&&i&&!i(k))k=k.getNext(i);return k;},getLast:function(i){var j=this.$.lastChild,k=j&&new d.node(j);if(k&&i&&!i(k))k=k.getPrevious(i);return k;},getStyle:function(i){return this.$.style[e.cssStyleToDomStyle(i)];},is:function(){var i=this.getName();for(var j=0;j<arguments.length;j++){if(arguments[j]==i)return true;}return false;},isEditable:function(){var i=this.getName(),j=!f.$nonEditable[i]&&(f[i]||f.span);
-return j&&j['#'];},isIdentical:function(i){if(this.getName()!=i.getName())return false;var j=this.$.attributes,k=i.$.attributes,l=j.length,m=k.length;if(!c&&l!=m)return false;for(var n=0;n<l;n++){var o=j[n];if((!c||o.specified&&o.nodeName!='_cke_expando')&&o.nodeValue!=i.getAttribute(o.nodeName))return false;}if(c)for(n=0;n<m;n++){o=k[n];if(o.specified&&o.nodeName!='_cke_expando'&&o.nodeValue!=this.getAttribute(o.nodeName))return false;}return true;},isVisible:function(){var i=!!this.$.offsetHeight&&this.getComputedStyle('visibility')!='hidden',j,k;if(i&&(b.webkit||b.opera)){j=this.getWindow();if(!j.equals(a.document.getWindow())&&(k=j.$.frameElement))i=new h(k).isVisible();}return i;},isEmptyInlineRemoveable:function(){if(!f.$removeEmpty[this.getName()])return false;var i=this.getChildren();for(var j=0,k=i.count();j<k;j++){var l=i.getItem(j);if(l.type==1&&l.getAttribute('_fck_bookmark'))continue;if(l.type==1&&!l.isEmptyInlineRemoveable()||l.type==3&&e.trim(l.getText()))return false;}return true;},hasAttributes:c&&(b.ie7Compat||b.ie6Compat)?function(){var i=this.$.attributes;for(var j=0;j<i.length;j++){var k=i[j];switch(k.nodeName){case 'class':if(this.getAttribute('class'))return true;case '_cke_expando':continue;default:if(k.specified)return true;}}return false;}:function(){var i=this.$.attributes;return i.length>1||i.length==1&&i[0].nodeName!='_cke_expando';},hasAttribute:function(i){var j=this.$.attributes.getNamedItem(i);return!!(j&&j.specified);},hide:function(){this.setStyle('display','none');},moveChildren:function(i,j){var k=this.$;i=i.$;if(k==i)return;var l;if(j)while(l=k.lastChild)i.insertBefore(k.removeChild(l),i.firstChild);else while(l=k.firstChild)i.appendChild(k.removeChild(l));},mergeSiblings:(function(){function i(j,k,l){if(k&&k.type==1){var m=[];while(k.getAttribute('_fck_bookmark')||k.isEmptyInlineRemoveable()){m.push(k);k=l?k.getNext():k.getPrevious();if(!k||k.type!=1)return;}if(j.isIdentical(k)){var n=l?j.getLast():j.getFirst();while(m.length)m.shift().move(j,!l);k.moveChildren(j,!l);k.remove();if(n&&n.type==1)n.mergeSiblings();}}};return function(){var j=this;if(!(f.$removeEmpty[j.getName()]||j.is('a')))return;i(j,j.getNext(),true);i(j,j.getPrevious());};})(),show:function(){this.setStyles({display:'',visibility:''});},setAttribute:(function(){var i=function(j,k){this.$.setAttribute(j,k);return this;};if(c&&(b.ie7Compat||b.ie6Compat))return function(j,k){var l=this;if(j=='class')l.$.className=k;else if(j=='style')l.$.style.cssText=k;else if(j=='tabindex')l.$.tabIndex=k;
-else if(j=='checked')l.$.checked=k;else i.apply(l,arguments);return l;};else return i;})(),setAttributes:function(i){for(var j in i)this.setAttribute(j,i[j]);return this;},setValue:function(i){this.$.value=i;return this;},removeAttribute:(function(){var i=function(j){this.$.removeAttribute(j);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){if(j=='class')j='className';else if(j=='tabindex')j='tabIndex';i.call(this,j);};else return i;})(),removeAttributes:function(i){if(e.isArray(i))for(var j=0;j<i.length;j++)this.removeAttribute(i[j]);else for(var k in i)i.hasOwnProperty(k)&&this.removeAttribute(k);},removeStyle:function(i){var j=this;j.setStyle(i,'');if(j.$.style.removeAttribute)j.$.style.removeAttribute(e.cssStyleToDomStyle(i));if(!j.$.style.cssText)j.removeAttribute('style');},setStyle:function(i,j){this.$.style[e.cssStyleToDomStyle(i)]=j;return this;},setStyles:function(i){for(var j in i)this.setStyle(j,i[j]);return this;},setOpacity:function(i){if(c){i=Math.round(i*100);this.setStyle('filter',i>=100?'':'progid:DXImageTransform.Microsoft.Alpha(opacity='+i+')');}else this.setStyle('opacity',i);},unselectable:b.gecko?function(){this.$.style.MozUserSelect='none';}:b.webkit?function(){this.$.style.KhtmlUserSelect='none';}:function(){if(c||b.opera){var i=this.$,j,k=0;i.unselectable='on';while(j=i.all[k++])switch(j.tagName.toLowerCase()){case 'iframe':case 'textarea':case 'input':case 'select':break;default:j.unselectable='on';}}},getPositionedAncestor:function(){var i=this;while(i.getName()!='html'){if(i.getComputedStyle('position')!='static')return i;i=i.getParent();}return null;},getDocumentPosition:function(i){var D=this;var j=0,k=0,l=D.getDocument().getBody(),m=D.getDocument().$.compatMode=='BackCompat',n=D.getDocument();if(document.documentElement.getBoundingClientRect){var o=D.$.getBoundingClientRect(),p=n.$,q=p.documentElement,r=q.clientTop||l.$.clientTop||0,s=q.clientLeft||l.$.clientLeft||0,t=true;if(c){var u=n.getDocumentElement().contains(D),v=n.getBody().contains(D);t=m&&v||!m&&u;}if(t){j=o.left+(!m&&q.scrollLeft||l.$.scrollLeft);j-=s;k=o.top+(!m&&q.scrollTop||l.$.scrollTop);k-=r;}}else{var w=D,x=null,y;while(w&&!(w.getName()=='body'||w.getName()=='html')){j+=w.$.offsetLeft-w.$.scrollLeft;k+=w.$.offsetTop-w.$.scrollTop;if(!w.equals(D)){j+=w.$.clientLeft||0;k+=w.$.clientTop||0;}var z=x;while(z&&!z.equals(w)){j-=z.$.scrollLeft;k-=z.$.scrollTop;z=z.getParent();}x=w;w=(y=w.$.offsetParent)?new h(y):null;}}if(i){var A=D.getWindow(),B=i.getWindow();
-if(!A.equals(B)&&A.$.frameElement){var C=new h(A.$.frameElement).getDocumentPosition(i);j+=C.x;k+=C.y;}}if(!document.documentElement.getBoundingClientRect)if(b.gecko&&!m){j+=D.$.clientLeft?1:0;k+=D.$.clientTop?1:0;}return{x:j,y:k};},scrollIntoView:function(i){var o=this;var j=o.getWindow(),k=j.getViewPaneSize().height,l=k*-1;if(i)l+=k;else{l+=o.$.offsetHeight||0;l+=parseInt(o.getComputedStyle('marginBottom')||0,10)||0;}var m=o.getDocumentPosition();l+=m.y;l=l<0?0:l;var n=j.getScrollPosition().y;if(l>n||l<n-k)j.$.scrollTo(0,l);},setState:function(i){var j=this;switch(i){case 1:j.addClass('cke_on');j.removeClass('cke_off');j.removeClass('cke_disabled');break;case 0:j.addClass('cke_disabled');j.removeClass('cke_off');j.removeClass('cke_on');break;default:j.addClass('cke_off');j.removeClass('cke_on');j.removeClass('cke_disabled');break;}},getFrameDocument:function(){var i=this.$;try{i.contentWindow.document;}catch(j){i.src=i.src;if(c&&b.version<7)window.showModalDialog('javascript:document.write("<script>window.setTimeout(function(){window.close();},50);</script>")');}return i&&new g(i.contentWindow.document);},copyAttributes:function(i,j){var p=this;var k=p.$.attributes;j=j||{};for(var l=0;l<k.length;l++){var m=k[l],n=m.nodeName.toLowerCase(),o;if(n in j)continue;if(n=='checked'&&(o=p.getAttribute(n)))i.setAttribute(n,o);else if(m.specified||c&&m.nodeValue&&n=='value'){o=p.getAttribute(n);if(o===null)o=m.nodeValue;i.setAttribute(n,o);}}if(p.$.style.cssText!=='')i.$.style.cssText=p.$.style.cssText;},renameNode:function(i){var l=this;if(l.getName()==i)return;var j=l.getDocument(),k=new h(i,j);l.copyAttributes(k);l.moveChildren(k);l.getParent()&&l.$.parentNode.replaceChild(k.$,l.$);k.$._cke_expando=l.$._cke_expando;l.$=k.$;},getChild:function(i){var j=this.$;if(!i.slice)j=j.childNodes[i];else while(i.length>0&&j)j=j.childNodes[i.shift()];return j?new d.node(j):null;},getChildCount:function(){return this.$.childNodes.length;},disableContextMenu:function(){this.on('contextmenu',function(i){if(!i.data.getTarget().hasClass('cke_enable_context_menu'))i.data.preventDefault();});}});a.command=function(i,j){this.uiItems=[];this.exec=function(k){if(this.state==0)return false;if(this.editorFocus)i.focus();return j.exec.call(this,i,k)!==false;};e.extend(this,j,{modes:{wysiwyg:1},editorFocus:true,state:2});a.event.call(this);};a.command.prototype={enable:function(){var i=this;if(i.state==0)i.setState(!i.preserveState||typeof i.previousState=='undefined'?2:i.previousState);},disable:function(){this.setState(0);
-},setState:function(i){var j=this;if(j.state==i)return false;j.previousState=j.state;j.state=i;j.fire('state');return true;},toggleState:function(){var i=this;if(i.state==2)i.setState(1);else if(i.state==1)i.setState(2);}};a.event.implementOn(a.command.prototype,true);a.ENTER_P=1;a.ENTER_BR=2;a.ENTER_DIV=3;a.config={customConfig:'config.js',autoUpdateElement:true,baseHref:'',contentsCss:a.basePath+'contents.css',contentsLangDirection:'ui',contentsLanguage:'',language:'',defaultLanguage:'en',enterMode:1,forceEnterMode:false,shiftEnterMode:2,corePlugins:'',docType:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',bodyId:'',bodyClass:'',fullPage:false,height:200,plugins:'about,a11yhelp,basicstyles,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',extraPlugins:'',removePlugins:'',protectedSource:[],tabIndex:0,theme:'default',skin:'kama',width:'',baseFloatZIndex:10000};var i=a.config;a.focusManager=function(j){if(j.focusManager)return j.focusManager;this.hasFocus=false;this._={editor:j};return this;};a.focusManager.prototype={focus:function(){var k=this;if(k._.timer)clearTimeout(k._.timer);if(!k.hasFocus){if(a.currentInstance)a.currentInstance.focusManager.forceBlur();var j=k._.editor;j.container.getChild(1).addClass('cke_focus');k.hasFocus=true;j.fire('focus');}},blur:function(){var j=this;if(j._.timer)clearTimeout(j._.timer);j._.timer=setTimeout(function(){delete j._.timer;j.forceBlur();},100);},forceBlur:function(){if(this.hasFocus){var j=this._.editor;j.container.getChild(1).removeClass('cke_focus');this.hasFocus=false;j.fire('blur');}}};(function(){var j={};a.lang={languages:{af:1,ar:1,bg:1,bn:1,bs:1,ca:1,cs:1,cy:1,da:1,de:1,el:1,'en-au':1,'en-ca':1,'en-gb':1,en:1,eo:1,es:1,et:1,eu:1,fa:1,fi:1,fo:1,'fr-ca':1,fr:1,gl:1,gu:1,he:1,hi:1,hr:1,hu:1,is:1,it:1,ja:1,km:1,ko:1,lt:1,lv:1,mn:1,ms:1,nb:1,nl:1,no:1,pl:1,'pt-br':1,pt:1,ro:1,ru:1,sk:1,sl:1,'sr-latn':1,sr:1,sv:1,th:1,tr:1,uk:1,vi:1,'zh-cn':1,zh:1},load:function(k,l,m){if(!k||!a.lang.languages[k])k=this.detect(l,k);if(!this[k])a.scriptLoader.load(a.getUrl('lang/'+k+'.js'),function(){m(k,this[k]);
-},this);else m(k,this[k]);},detect:function(k,l){var m=this.languages;l=l||navigator.userLanguage||navigator.language;var n=l.toLowerCase().match(/([a-z]+)(?:-([a-z]+))?/),o=n[1],p=n[2];if(m[o+'-'+p])o=o+'-'+p;else if(!m[o])o=null;a.lang.detect=o?function(){return o;}:function(q){return q;};return o||k;}};})();a.scriptLoader=(function(){var j={},k={};return{load:function(l,m,n,o,p){var q=typeof l=='string';if(q)l=[l];if(!n)n=a;var r=l.length,s=[],t=[],u=function(z){if(m)if(q)m.call(n,z);else m.call(n,s,t);};if(r===0){u(true);return;}var v=function(z,A){(A?s:t).push(z);if(--r<=0){p&&a.document.getDocumentElement().removeStyle('cursor');u(A);}},w=function(z,A){j[z]=1;var B=k[z];delete k[z];for(var C=0;C<B.length;C++)B[C](z,A);},x=function(z){if(o!==true&&j[z]){v(z,true);return;}var A=k[z]||(k[z]=[]);A.push(v);if(A.length>1)return;var B=new h('script');B.setAttributes({type:'text/javascript',src:z});if(m)if(c)B.$.onreadystatechange=function(){if(B.$.readyState=='loaded'||B.$.readyState=='complete'){B.$.onreadystatechange=null;w(z,true);}};else{B.$.onload=function(){setTimeout(function(){w(z,true);},0);};B.$.onerror=function(){w(z,false);};}B.appendTo(a.document.getHead());};p&&a.document.getDocumentElement().setStyle('cursor','wait');for(var y=0;y<r;y++)x(l[y]);},loadCode:function(l){var m=new h('script');m.setAttribute('type','text/javascript');m.appendText(l);m.appendTo(a.document.getHead());}};})();a.resourceManager=function(j,k){var l=this;l.basePath=j;l.fileName=k;l.registered={};l.loaded={};l.externals={};l._={waitingList:{}};};a.resourceManager.prototype={add:function(j,k){if(this.registered[j])throw '[CKEDITOR.resourceManager.add] The resource name "'+j+'" is already registered.';a.fire(j+e.capitalize(this.fileName)+'Ready',this.registered[j]=k||{});},get:function(j){return this.registered[j]||null;},getPath:function(j){var k=this.externals[j];return a.getUrl(k&&k.dir||this.basePath+j+'/');},getFilePath:function(j){var k=this.externals[j];return a.getUrl(this.getPath(j)+(k&&typeof k.file=='string'?k.file:this.fileName+'.js'));},addExternal:function(j,k,l){j=j.split(',');for(var m=0;m<j.length;m++){var n=j[m];this.externals[n]={dir:k,file:l};}},load:function(j,k,l){if(!e.isArray(j))j=j?[j]:[];var m=this.loaded,n=this.registered,o=[],p={},q={};for(var r=0;r<j.length;r++){var s=j[r];if(!s)continue;if(!m[s]&&!n[s]){var t=this.getFilePath(s);o.push(t);if(!(t in p))p[t]=[];p[t].push(s);}else q[s]=this.get(s);}a.scriptLoader.load(o,function(u,v){if(v.length)throw '[CKEDITOR.resourceManager.load] Resource name "'+p[v[0]].join(',')+'" was not found at "'+v[0]+'".';
-for(var w=0;w<u.length;w++){var x=p[u[w]];for(var y=0;y<x.length;y++){var z=x[y];q[z]=this.get(z);m[z]=1;}}k.call(l,q);},this);}};a.plugins=new a.resourceManager('plugins/','plugin');var j=a.plugins;j.load=e.override(j.load,function(k){return function(l,m,n){var o={},p=function(q){k.call(this,q,function(r){e.extend(o,r);var s=[];for(var t in r){var u=r[t],v=u&&u.requires;if(v)for(var w=0;w<v.length;w++){if(!o[v[w]])s.push(v[w]);}}if(s.length)p.call(this,s);else{for(t in o){u=o[t];if(u.onLoad&&!u.onLoad._called){u.onLoad();u.onLoad._called=1;}}if(m)m.call(n||window,o);}},this);};p.call(this,l);};});j.setLang=function(k,l,m){var n=this.get(k),o=n.lang||(n.lang={});o[l]=m;};(function(){var k={},l=function(m,n){var o=function(){p.removeAllListeners();k[m]=1;n();},p=new h('img');p.on('load',o);p.on('error',o);p.setAttribute('src',m);};a.imageCacher={load:function(m,n){var o=m.length,p=function(){if(--o===0)n();};for(var q=0;q<m.length;q++){var r=m[q];if(k[r])p();else l(r,p);}}};})();a.skins=(function(){var k={},l={},m={},n=function(o,p,q,r){var s=k[p];if(!o.skin){o.skin=s;if(s.init)s.init(o);}var t=function(D){for(var E=0;E<D.length;E++)D[E]=a.getUrl(m[p]+D[E]);};function u(D,E){return D.replace(/url\s*\(([\s'"]*)(.*?)([\s"']*)\)/g,function(F,G,H,I){if(/^\/|^\w?:/.test(H))return F;else return 'url('+E+G+H+I+')';});};if(!l[p]){var v=s.preload;if(v&&v.length>0){t(v);a.imageCacher.load(v,function(){l[p]=1;n(o,p,q,r);});return;}l[p]=1;}q=s[q];var w=!q||!!q._isLoaded;if(w)r&&r();else{var x=q._pending||(q._pending=[]);x.push(r);if(x.length>1)return;var y=!q.css||!q.css.length,z=!q.js||!q.js.length,A=function(){if(y&&z){q._isLoaded=1;for(var D=0;D<x.length;D++){if(x[D])x[D]();}}};if(!y){var B=q.css;if(e.isArray(B)){t(B);for(var C=0;C<B.length;C++)a.document.appendStyleSheet(B[C]);}else{B=u(B,a.getUrl(m[p]));a.document.appendStyleText(B);}q.css=B;y=1;}if(!z){t(q.js);a.scriptLoader.load(q.js,function(){z=1;A();});}A();}};return{add:function(o,p){k[o]=p;p.skinPath=m[o]||(m[o]=a.getUrl('skins/'+o+'/'));},load:function(o,p,q){var r=o.skinName,s=o.skinPath;if(k[r])n(o,r,p,q);else{m[r]=s;a.scriptLoader.load(a.getUrl(s+'skin.js'),function(){n(o,r,p,q);});}}};})();a.themes=new a.resourceManager('themes/','theme');a.ui=function(k){if(k.ui)return k.ui;this._={handlers:{},items:{},editor:k};return this;};var k=a.ui;k.prototype={add:function(l,m,n){this._.items[l]={type:m,command:n.command||null,args:Array.prototype.slice.call(arguments,2)};},create:function(l){var q=this;var m=q._.items[l],n=m&&q._.handlers[m.type],o=m&&m.command&&q._.editor.getCommand(m.command),p=n&&n.create.apply(q,m.args);
-if(o)o.uiItems.push(p);return p;},addHandler:function(l,m){this._.handlers[l]=m;}};(function(){var l=0,m=function(){var x='editor'+ ++l;return a.instances&&a.instances[x]?m():x;},n={},o=function(x){var y=x.config.customConfig;if(!y)return false;y=a.getUrl(y);var z=n[y]||(n[y]={});if(z.fn){z.fn.call(x,x.config);if(a.getUrl(x.config.customConfig)==y||!o(x))x.fireOnce('customConfigLoaded');}else a.scriptLoader.load(y,function(){if(a.editorConfig)z.fn=a.editorConfig;else z.fn=function(){};o(x);});return true;},p=function(x,y){x.on('customConfigLoaded',function(){if(y){if(y.on)for(var z in y.on)x.on(z,y.on[z]);e.extend(x.config,y,true);delete x.config.on;}q(x);});if(y&&y.customConfig!=undefined)x.config.customConfig=y.customConfig;if(!o(x))x.fireOnce('customConfigLoaded');},q=function(x){var y=x.config.skin.split(','),z=y[0],A=a.getUrl(y[1]||'skins/'+z+'/');x.skinName=z;x.skinPath=A;x.skinClass='cke_skin_'+z;x.tabIndex=x.config.tabIndex||x.element.getAttribute('tabindex')||0;x.fireOnce('configLoaded');t(x);},r=function(x){a.lang.load(x.config.language,x.config.defaultLanguage,function(y,z){x.langCode=y;x.lang=e.prototypedCopy(z);if(b.gecko&&b.version<10900&&x.lang.dir=='rtl')x.lang.dir='ltr';var A=x.config;A.contentsLangDirection=='ui'&&(A.contentsLangDirection=x.lang.dir);s(x);});},s=function(x){var y=x.config,z=y.plugins,A=y.extraPlugins,B=y.removePlugins;if(A){var C=new RegExp('(?:^|,)(?:'+A.replace(/\s*,\s*/g,'|')+')(?=,|$)','g');z=z.replace(C,'');z+=','+A;}if(B){C=new RegExp('(?:^|,)(?:'+B.replace(/\s*,\s*/g,'|')+')(?=,|$)','g');z=z.replace(C,'');}j.load(z.split(','),function(D){var E=[],F=[],G=[];x.plugins=D;for(var H in D){var I=D[H],J=I.lang,K=j.getPath(H),L=null;I.path=K;if(J){L=e.indexOf(J,x.langCode)>=0?x.langCode:J[0];if(!I.lang[L])G.push(a.getUrl(K+'lang/'+L+'.js'));else{e.extend(x.lang,I.lang[L]);L=null;}}F.push(L);E.push(I);}a.scriptLoader.load(G,function(){var M=['beforeInit','init','afterInit'];for(var N=0;N<M.length;N++)for(var O=0;O<E.length;O++){var P=E[O];if(N===0&&F[O]&&P.lang)e.extend(x.lang,P.lang[F[O]]);if(P[M[N]])P[M[N]](x);}x.fire('pluginsLoaded');u(x);});});},t=function(x){a.skins.load(x,'editor',function(){r(x);});},u=function(x){var y=x.config.theme;a.themes.load(y,function(){var z=x.theme=a.themes.get(y);z.path=a.themes.getPath(y);z.build(x);if(x.config.autoUpdateElement)v(x);});},v=function(x){var y=x.element;if(x.elementMode==1&&y.is('textarea')){var z=y.$.form&&new h(y.$.form);if(z){function A(){x.updateElement();};z.on('submit',A);
-if(!z.$.submit.nodeName)z.$.submit=e.override(z.$.submit,function(B){return function(){x.updateElement();if(B.apply)B.apply(this,arguments);else B();};});x.on('destroy',function(){z.removeListener('submit',A);});}}};function w(){var x,y=this._.commands,z=this.mode;for(var A in y){x=y[A];x[x.startDisabled?'disable':x.modes[z]?'enable':'disable']();}};a.editor.prototype._init=function(){var z=this;var x=h.get(z._.element),y=z._.instanceConfig;delete z._.element;delete z._.instanceConfig;z._.commands={};z._.styles=[];z.element=x;z.name=x&&z.elementMode==1&&(x.getId()||x.getNameAtt())||m();if(z.name in a.instances)throw '[CKEDITOR.editor] The instance "'+z.name+'" already exists.';z.config=e.prototypedCopy(i);z.ui=new k(z);z.focusManager=new a.focusManager(z);a.fire('instanceCreated',null,z);z.on('mode',w,null,null,1);p(z,y);};})();e.extend(a.editor.prototype,{addCommand:function(l,m){return this._.commands[l]=new a.command(this,m);},addCss:function(l){this._.styles.push(l);},destroy:function(l){var r=this;if(!l)r.updateElement();if(r.mode)r._.modes[r.mode].unload(r.getThemeSpace('contents'));r.theme.destroy(r);var m,n=0,o,p,q;if(r.toolbox){m=r.toolbox.toolbars;for(;n<m.length;n++){p=m[n].items;for(o=0;o<p.length;o++){q=p[o];if(q.clickFn)e.removeFunction(q.clickFn);if(q.keyDownFn)e.removeFunction(q.keyDownFn);if(q.index)k.button._.instances[q.index]=null;}}}if(r.contextMenu)e.removeFunction(r.contextMenu._.functionId);if(r._.filebrowserFn)e.removeFunction(r._.filebrowserFn);r.fire('destroy');a.remove(r);a.fire('instanceDestroyed',null,r);},execCommand:function(l,m){var n=this.getCommand(l),o={name:l,commandData:m,command:n};if(n&&n.state!=0)if(this.fire('beforeCommandExec',o)!==true){o.returnValue=n.exec(o.commandData);if(!n.async&&this.fire('afterCommandExec',o)!==true)return o.returnValue;}return false;},getCommand:function(l){return this._.commands[l];},getData:function(){var n=this;n.fire('beforeGetData');var l=n._.data;if(typeof l!='string'){var m=n.element;if(m&&n.elementMode==1)l=m.is('textarea')?m.getValue():m.getHtml();else l='';}l={dataValue:l};n.fire('getData',l);return l.dataValue;},getSnapshot:function(){var l=this.fire('getSnapshot');if(typeof l!='string'){var m=this.element;if(m&&this.elementMode==1)l=m.is('textarea')?m.getValue():m.getHtml();}return l;},loadSnapshot:function(l){this.fire('loadSnapshot',l);},setData:function(l,m){if(m)this.on('dataReady',function(o){o.removeListener();m.call(o.editor);});var n={dataValue:l};this.fire('setData',n);
-this._.data=n.dataValue;this.fire('afterSetData',n);},insertHtml:function(l){this.fire('insertHtml',l);},insertElement:function(l){this.fire('insertElement',l);},checkDirty:function(){return this.mayBeDirty&&this._.previousValue!==this.getSnapshot();},resetDirty:function(){if(this.mayBeDirty)this._.previousValue=this.getSnapshot();},updateElement:function(){var n=this;var l=n.element;if(l&&n.elementMode==1){var m=n.getData();if(n.config.htmlEncodeOutput)m=e.htmlEncode(m);if(l.is('textarea'))l.setValue(m);else l.setHtml(m);}}});a.on('loaded',function(){var l=a.editor._pending;if(l){delete a.editor._pending;for(var m=0;m<l.length;m++)l[m]._init();}});a.htmlParser=function(){this._={htmlPartsRegex:new RegExp("<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:[^\"'>]+)|(?:\"[^\"]*\")|(?:'[^']*'))*)\\/?>))",'g')};};(function(){var l=/([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,m={checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1};a.htmlParser.prototype={onTagOpen:function(){},onTagClose:function(){},onText:function(){},onCDATA:function(){},onComment:function(){},parse:function(n){var A=this;var o,p,q=0,r;while(o=A._.htmlPartsRegex.exec(n)){var s=o.index;if(s>q){var t=n.substring(q,s);if(r)r.push(t);else A.onText(t);}q=A._.htmlPartsRegex.lastIndex;if(p=o[1]){p=p.toLowerCase();if(r&&f.$cdata[p]){A.onCDATA(r.join(''));r=null;}if(!r){A.onTagClose(p);continue;}}if(r){r.push(o[0]);continue;}if(p=o[3]){p=p.toLowerCase();var u={},v,w=o[4],x=!!(w&&w.charAt(w.length-1)=='/');if(w)while(v=l.exec(w)){var y=v[1].toLowerCase(),z=v[2]||v[3]||v[4]||'';if(!z&&m[y])u[y]=y;else u[y]=z;}A.onTagOpen(p,u,x);if(!r&&f.$cdata[p])r=[];continue;}if(p=o[2])A.onComment(p);}if(n.length>q)A.onText(n.substring(q,n.length));}};})();a.htmlParser.comment=function(l){this.value=l;this._={isBlockLike:false};};a.htmlParser.comment.prototype={type:8,writeHtml:function(l,m){var n=this.value;if(m){if(!(n=m.onComment(n,this)))return;if(typeof n!='string'){n.parent=this.parent;n.writeHtml(l,m);return;}}l.comment(n);}};(function(){var l=/[\t\r\n ]{2,}|[\t\r\n]/g;a.htmlParser.text=function(m){this.value=m;this._={isBlockLike:false};};a.htmlParser.text.prototype={type:3,writeHtml:function(m,n){var o=this.value;if(n&&!(o=n.onText(o,this)))return;m.text(o);}};})();(function(){a.htmlParser.cdata=function(l){this.value=l;};a.htmlParser.cdata.prototype={type:3,writeHtml:function(l){l.write(this.value);
-}};})();a.htmlParser.fragment=function(){this.children=[];this.parent=null;this._={isBlockLike:true,hasInlineStarted:false};};(function(){var l={colgroup:1,dd:1,dt:1,li:1,option:1,p:1,td:1,tfoot:1,th:1,thead:1,tr:1},m=e.extend({table:1,ul:1,ol:1,dl:1},f.table,f.ul,f.ol,f.dl),n=f.$list,o=f.$listItem;a.htmlParser.fragment.fromHtml=function(p,q){var r=new a.htmlParser(),s=[],t=new a.htmlParser.fragment(),u=[],v=[],w=t,x=false,y;function z(E){var F;if(u.length>0)for(var G=0;G<u.length;G++){var H=u[G],I=H.name,J=f[I],K=w.name&&f[w.name];if((!K||K[I])&&(!E||!J||J[E]||!f[E])){if(!F){A();F=1;}H=H.clone();H.parent=w;w=H;u.splice(G,1);G--;}}};function A(){while(v.length)w.add(v.shift());};function B(E,F,G){F=F||w||t;if(q&&!F.type){var H,I;if(E.attributes&&(I=E.attributes._cke_real_element_type))H=I;else H=E.name;if(H&&!(H in f.$body)&&!(H in f.$nonBodyContent)){var J=w;w=F;r.onTagOpen(q,{});F=w;if(G)w=J;}}if(E._.isBlockLike&&E.name!='pre'){var K=E.children.length,L=E.children[K-1],M;if(L&&L.type==3)if(!(M=e.rtrim(L.value)))E.children.length=K-1;else L.value=M;}F.add(E);if(E.returnPoint){w=E.returnPoint;delete E.returnPoint;}};r.onTagOpen=function(E,F,G){var H=new a.htmlParser.element(E,F);if(H.isUnknown&&G)H.isEmpty=true;if(f.$removeEmpty[E]){u.push(H);return;}else if(E=='pre')x=true;else if(E=='br'&&x){w.add(new a.htmlParser.text('\n'));return;}if(E=='br'){v.push(H);return;}var I=w.name,J=I&&(f[I]||(w._.isBlockLike?f.div:f.span));if(J&&!H.isUnknown&&!w.isUnknown&&!J[E]){var K=false,L;if(E in n&&I in n){var M=w.children,N=M[M.length-1];if(!(N&&N.name in o))B(N=new a.htmlParser.element('li'),w);y=w,L=N;}else if(E==I)B(w,w.parent);else{if(m[I]){if(!y)y=w;}else{B(w,w.parent,true);if(!l[I])u.unshift(w);}K=true;}if(L)w=L;else w=w.returnPoint||w.parent;if(K){r.onTagOpen.apply(this,arguments);return;}}z(E);A();H.parent=w;H.returnPoint=y;y=0;if(H.isEmpty)B(H);else w=H;};r.onTagClose=function(E){for(var F=u.length-1;F>=0;F--){if(E==u[F].name){u.splice(F,1);return;}}var G=[],H=[],I=w;while(I.type&&I.name!=E){if(!I._.isBlockLike)H.unshift(I);G.push(I);I=I.parent;}if(I.type){for(F=0;F<G.length;F++){var J=G[F];B(J,J.parent);}w=I;if(w.name=='pre')x=false;if(I._.isBlockLike)A();B(I,I.parent);if(I==w)w=w.parent;u=u.concat(H);}if(E=='body')q=false;};r.onText=function(E){if(!w._.hasInlineStarted&&!x){E=e.ltrim(E);if(E.length===0)return;}A();z();if(q&&(!w.type||w.name=='body')&&e.trim(E))this.onTagOpen(q,{});if(!x)E=E.replace(/[\t\r\n ]{2,}|[\t\r\n]/g,' ');w.add(new a.htmlParser.text(E));
-};r.onCDATA=function(E){w.add(new a.htmlParser.cdata(E));};r.onComment=function(E){w.add(new a.htmlParser.comment(E));};r.parse(p);A();while(w.type){var C=w.parent,D=w;if(q&&(!C.type||C.name=='body')&&!f.$body[D.name]){w=C;r.onTagOpen(q,{});C=w;}C.add(D);w=C;}return t;};a.htmlParser.fragment.prototype={add:function(p){var s=this;var q=s.children.length,r=q>0&&s.children[q-1]||null;if(r){if(p._.isBlockLike&&r.type==3){r.value=e.rtrim(r.value);if(r.value.length===0){s.children.pop();s.add(p);return;}}r.next=p;}p.previous=r;p.parent=s;s.children.push(p);s._.hasInlineStarted=p.type==3||p.type==1&&!p._.isBlockLike;},writeHtml:function(p,q){var r;this.filterChildren=function(){var s=new a.htmlParser.basicWriter();this.writeChildrenHtml.call(this,s,q,true);var t=s.getHtml();this.children=new a.htmlParser.fragment.fromHtml(t).children;r=1;};!this.name&&q&&q.onFragment(this);this.writeChildrenHtml(p,r?null:q);},writeChildrenHtml:function(p,q){for(var r=0;r<this.children.length;r++)this.children[r].writeHtml(p,q);}};})();a.htmlParser.element=function(l,m){var r=this;r.name=l;r.attributes=m||(m={});r.children=[];var n=m._cke_real_element_type||l,o=f,p=!!(o.$nonBodyContent[n]||o.$block[n]||o.$listItem[n]||o.$tableContent[n]||o.$nonEditable[n]||n=='br'),q=!!o.$empty[l];r.isEmpty=q;r.isUnknown=!o[l];r._={isBlockLike:p,hasInlineStarted:q||!p};};(function(){var l=function(m,n){m=m[0];n=n[0];return m<n?-1:m>n?1:0;};a.htmlParser.element.prototype={type:1,add:a.htmlParser.fragment.prototype.add,clone:function(){return new a.htmlParser.element(this.name,this.attributes);},writeHtml:function(m,n){var o=this.attributes,p=this,q=p.name,r,s,t,u;p.filterChildren=function(){if(!u){var z=new a.htmlParser.basicWriter();a.htmlParser.fragment.prototype.writeChildrenHtml.call(p,z,n);p.children=new a.htmlParser.fragment.fromHtml(z.getHtml()).children;u=1;}};if(n){for(;;){if(!(q=n.onElementName(q)))return;p.name=q;if(!(p=n.onElement(p)))return;p.parent=this.parent;if(p.name==q)break;if(p.type!=1){p.writeHtml(m,n);return;}q=p.name;if(!q){this.writeChildrenHtml.call(p,m,u?null:n);return;}}o=p.attributes;}m.openTag(q,o);var v=[];for(var w=0;w<2;w++)for(r in o){s=r;t=o[r];if(w==1)v.push([r,t]);else if(n){for(;;){if(!(s=n.onAttributeName(r))){delete o[r];break;}else if(s!=r){delete o[r];r=s;continue;}else break;}if(s)if((t=n.onAttribute(p,s,t))===false)delete o[s];else o[s]=t;}}if(m.sortAttributes)v.sort(l);var x=v.length;for(w=0;w<x;w++){var y=v[w];m.attribute(y[0],y[1]);}m.openTagClose(q,p.isEmpty);
-if(!p.isEmpty){this.writeChildrenHtml.call(p,m,u?null:n);m.closeTag(q);}},writeChildrenHtml:function(m,n){a.htmlParser.fragment.prototype.writeChildrenHtml.apply(this,arguments);}};})();(function(){a.htmlParser.filter=e.createClass({$:function(q){this._={elementNames:[],attributeNames:[],elements:{$length:0},attributes:{$length:0}};if(q)this.addRules(q,10);},proto:{addRules:function(q,r){var s=this;if(typeof r!='number')r=10;m(s._.elementNames,q.elementNames,r);m(s._.attributeNames,q.attributeNames,r);n(s._.elements,q.elements,r);n(s._.attributes,q.attributes,r);s._.text=o(s._.text,q.text,r)||s._.text;s._.comment=o(s._.comment,q.comment,r)||s._.comment;s._.root=o(s._.root,q.root,r)||s._.root;},onElementName:function(q){return l(q,this._.elementNames);},onAttributeName:function(q){return l(q,this._.attributeNames);},onText:function(q){var r=this._.text;return r?r.filter(q):q;},onComment:function(q,r){var s=this._.comment;return s?s.filter(q,r):q;},onFragment:function(q){var r=this._.root;return r?r.filter(q):q;},onElement:function(q){var v=this;var r=[v._.elements['^'],v._.elements[q.name],v._.elements.$],s,t;for(var u=0;u<3;u++){s=r[u];if(s){t=s.filter(q,v);if(t===false)return null;if(t&&t!=q)return v.onNode(t);if(q.parent&&!q.name)break;}}return q;},onNode:function(q){var r=q.type;return r==1?this.onElement(q):r==3?new a.htmlParser.text(this.onText(q.value)):r==8?new a.htmlParser.comment(this.onComment(q.value)):null;},onAttribute:function(q,r,s){var t=this._.attributes[r];if(t){var u=t.filter(s,q,this);if(u===false)return false;if(typeof u!='undefined')return u;}return s;}}});function l(q,r){for(var s=0;q&&s<r.length;s++){var t=r[s];q=q.replace(t[0],t[1]);}return q;};function m(q,r,s){if(typeof r=='function')r=[r];var t,u,v=q.length,w=r&&r.length;if(w){for(t=0;t<v&&q[t].pri<s;t++){}for(u=w-1;u>=0;u--){var x=r[u];if(x){x.pri=s;q.splice(t,0,x);}}}};function n(q,r,s){if(r)for(var t in r){var u=q[t];q[t]=o(u,r[t],s);if(!u)q.$length++;}};function o(q,r,s){if(r){r.pri=s;if(q){if(!q.splice){if(q.pri>s)q=[r,q];else q=[q,r];q.filter=p;}else m(q,r,s);return q;}else{r.filter=r;return r;}}};function p(q){var r=q.type||q instanceof a.htmlParser.fragment;for(var s=0;s<this.length;s++){if(r)var t=q.type,u=q.name;var v=this[s],w=v.apply(window,arguments);if(w===false)return w;if(r){if(w&&(w.name!=u||w.type!=t))return w;}else if(typeof w!='string')return w;w!=undefined&&(q=w);}return q;};})();a.htmlParser.basicWriter=e.createClass({$:function(){this._={output:[]};},proto:{openTag:function(l,m){this._.output.push('<',l);
-},openTagClose:function(l,m){if(m)this._.output.push(' />');else this._.output.push('>');},attribute:function(l,m){if(typeof m=='string')m=e.htmlEncodeAttr(m);this._.output.push(' ',l,'="',m,'"');},closeTag:function(l){this._.output.push('</',l,'>');},text:function(l){this._.output.push(l);},comment:function(l){this._.output.push('<!--',l,'-->');},write:function(l){this._.output.push(l);},reset:function(){this._.output=[];this._.indent=false;},getHtml:function(l){var m=this._.output.join('');if(l)this.reset();return m;}}});delete a.loadFullCore;a.instances={};a.document=new g(document);a.add=function(l){a.instances[l.name]=l;l.on('focus',function(){if(a.currentInstance!=l){a.currentInstance=l;a.fire('currentInstance');}});l.on('blur',function(){if(a.currentInstance==l){a.currentInstance=null;a.fire('currentInstance');}});};a.remove=function(l){delete a.instances[l.name];};a.on('instanceDestroyed',function(){if(e.isEmpty(this.instances))a.fire('reset');});a.TRISTATE_ON=1;a.TRISTATE_OFF=2;a.TRISTATE_DISABLED=0;d.comment=e.createClass({base:d.node,$:function(l,m){if(typeof l=='string')l=(m?m.$:document).createComment(l);this.base(l);},proto:{type:8,getOuterHtml:function(){return '<!--'+this.$.nodeValue+'-->';}}});(function(){var l={address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1},m={body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,caption:1,form:1},n=function(o){var p=o.getChildren();for(var q=0,r=p.count();q<r;q++){var s=p.getItem(q);if(s.type==1&&f.$block[s.getName()])return true;}return false;};d.elementPath=function(o){var u=this;var p=null,q=null,r=[],s=o;while(s){if(s.type==1){if(!u.lastElement)u.lastElement=s;var t=s.getName();if(c&&s.$.scopeName!='HTML')t=s.$.scopeName.toLowerCase()+':'+t;if(!q){if(!p&&l[t])p=s;if(m[t])if(!p&&t=='div'&&!n(s))p=s;else q=s;}r.push(s);if(t=='body')break;}s=s.getParent();}u.block=p;u.blockLimit=q;u.elements=r;};})();d.elementPath.prototype={compare:function(l){var m=this.elements,n=l&&l.elements;if(!n||m.length!=n.length)return false;for(var o=0;o<m.length;o++){if(!m[o].equals(n[o]))return false;}return true;},contains:function(l){var m=this.elements;for(var n=0;n<m.length;n++){if(m[n].getName() in l)return m[n];}return null;}};d.text=function(l,m){if(typeof l=='string')l=(m?m.$:document).createTextNode(l);this.$=l;};d.text.prototype=new d.node();e.extend(d.text.prototype,{type:3,getLength:function(){return this.$.nodeValue.length;},getText:function(){return this.$.nodeValue;},split:function(l){var q=this;
-if(c&&l==q.getLength()){var m=q.getDocument().createText('');m.insertAfter(q);return m;}var n=q.getDocument(),o=new d.text(q.$.splitText(l),n);if(b.ie8){var p=new d.text('',n);p.insertAfter(o);p.remove();}return o;},substring:function(l,m){if(typeof m!='number')return this.$.nodeValue.substr(l);else return this.$.nodeValue.substring(l,m);}});d.documentFragment=function(l){l=l||a.document;this.$=l.$.createDocumentFragment();};e.extend(d.documentFragment.prototype,h.prototype,{type:11,insertAfterNode:function(l){l=l.$;l.parentNode.insertBefore(this.$,l.nextSibling);}},true,{append:1,appendBogus:1,getFirst:1,getLast:1,appendTo:1,moveChildren:1,insertBefore:1,insertAfterNode:1,replace:1,trim:1,type:1,ltrim:1,rtrim:1,getDocument:1,getChildCount:1,getChild:1,getChildren:1});(function(){function l(t,u){if(this._.end)return null;var v,w=this.range,x,y=this.guard,z=this.type,A=t?'getPreviousSourceNode':'getNextSourceNode';if(!this._.start){this._.start=1;w.trim();if(w.collapsed){this.end();return null;}}if(!t&&!this._.guardLTR){var B=w.endContainer,C=B.getChild(w.endOffset);this._.guardLTR=function(G,H){return(!H||!B.equals(G))&&(!C||!G.equals(C))&&(G.type!=1||!H||G.getName()!='body');};}if(t&&!this._.guardRTL){var D=w.startContainer,E=w.startOffset>0&&D.getChild(w.startOffset-1);this._.guardRTL=function(G,H){return(!H||!D.equals(G))&&(!E||!G.equals(E))&&(G.type!=1||!H||G.getName()!='body');};}var F=t?this._.guardRTL:this._.guardLTR;if(y)x=function(G,H){if(F(G,H)===false)return false;return y(G,H);};else x=F;if(this.current)v=this.current[A](false,z,x);else if(t){v=w.endContainer;if(w.endOffset>0){v=v.getChild(w.endOffset-1);if(x(v)===false)v=null;}else v=x(v,true)===false?null:v.getPreviousSourceNode(true,z,x);}else{v=w.startContainer;v=v.getChild(w.startOffset);if(v){if(x(v)===false)v=null;}else v=x(w.startContainer,true)===false?null:w.startContainer.getNextSourceNode(true,z,x);}while(v&&!this._.end){this.current=v;if(!this.evaluator||this.evaluator(v)!==false){if(!u)return v;}else if(u&&this.evaluator)return false;v=v[A](false,z,x);}this.end();return this.current=null;};function m(t){var u,v=null;while(u=l.call(this,t))v=u;return v;};d.walker=e.createClass({$:function(t){this.range=t;this._={};},proto:{end:function(){this._.end=1;},next:function(){return l.call(this);},previous:function(){return l.call(this,true);},checkForward:function(){return l.call(this,false,true)!==false;},checkBackward:function(){return l.call(this,true,true)!==false;},lastForward:function(){return m.call(this);
-},lastBackward:function(){return m.call(this,true);},reset:function(){delete this.current;this._={};}}});var n={block:1,'list-item':1,table:1,'table-row-group':1,'table-header-group':1,'table-footer-group':1,'table-row':1,'table-column-group':1,'table-column':1,'table-cell':1,'table-caption':1},o={hr:1};h.prototype.isBlockBoundary=function(t){var u=e.extend({},o,t||{});return n[this.getComputedStyle('display')]||u[this.getName()];};d.walker.blockBoundary=function(t){return function(u,v){return!(u.type==1&&u.isBlockBoundary(t));};};d.walker.listItemBoundary=function(){return this.blockBoundary({br:1});};d.walker.bookmarkContents=function(t){},d.walker.bookmark=function(t,u){function v(w){return w&&w.getName&&w.getName()=='span'&&w.hasAttribute('_fck_bookmark');};return function(w){var x,y;x=w&&!w.getName&&(y=w.getParent())&&v(y);x=t?x:x||v(w);return u^x;};};d.walker.whitespaces=function(t){return function(u){var v=u&&u.type==3&&!e.trim(u.getText());return t^v;};};d.walker.invisible=function(t){var u=d.walker.whitespaces();return function(v){var w=u(v)||v.is&&!v.$.offsetHeight;return t^w;};};var p=/^[\t\r\n ]*(?: |\xa0)$/,q=d.walker.whitespaces(true),r=d.walker.bookmark(false,true),s=function(t){return r(t)&&q(t);};h.prototype.getBogus=function(){var t=this.getLast(s);if(t&&(!c?t.is&&t.is('br'):t.getText&&p.test(t.getText())))return t;return false;};})();d.range=function(l){var m=this;m.startContainer=null;m.startOffset=null;m.endContainer=null;m.endOffset=null;m.collapsed=true;m.document=l;};(function(){var l=function(t){t.collapsed=t.startContainer&&t.endContainer&&t.startContainer.equals(t.endContainer)&&t.startOffset==t.endOffset;},m=function(t,u,v){t.optimizeBookmark();var w=t.startContainer,x=t.endContainer,y=t.startOffset,z=t.endOffset,A,B;if(x.type==3)x=x.split(z);else if(x.getChildCount()>0)if(z>=x.getChildCount()){x=x.append(t.document.createText(''));B=true;}else x=x.getChild(z);if(w.type==3){w.split(y);if(w.equals(x))x=w.getNext();}else if(!y){w=w.getFirst().insertBeforeMe(t.document.createText(''));A=true;}else if(y>=w.getChildCount()){w=w.append(t.document.createText(''));A=true;}else w=w.getChild(y).getPrevious();var C=w.getParents(),D=x.getParents(),E,F,G;for(E=0;E<C.length;E++){F=C[E];G=D[E];if(!F.equals(G))break;}var H=v,I,J,K,L;for(var M=E;M<C.length;M++){I=C[M];if(H&&!I.equals(w))J=H.append(I.clone());K=I.getNext();while(K){if(K.equals(D[M])||K.equals(x))break;L=K.getNext();if(u==2)H.append(K.clone(true));else{K.remove();if(u==1)H.append(K);
-}K=L;}if(H)H=J;}H=v;for(var N=E;N<D.length;N++){I=D[N];if(u>0&&!I.equals(x))J=H.append(I.clone());if(!C[N]||I.$.parentNode!=C[N].$.parentNode){K=I.getPrevious();while(K){if(K.equals(C[N])||K.equals(w))break;L=K.getPrevious();if(u==2)H.$.insertBefore(K.$.cloneNode(true),H.$.firstChild);else{K.remove();if(u==1)H.$.insertBefore(K.$,H.$.firstChild);}K=L;}}if(H)H=J;}if(u==2){var O=t.startContainer;if(O.type==3){O.$.data+=O.$.nextSibling.data;O.$.parentNode.removeChild(O.$.nextSibling);}var P=t.endContainer;if(P.type==3&&P.$.nextSibling){P.$.data+=P.$.nextSibling.data;P.$.parentNode.removeChild(P.$.nextSibling);}}else{if(F&&G&&(w.$.parentNode!=F.$.parentNode||x.$.parentNode!=G.$.parentNode)){var Q=G.getIndex();if(A&&G.$.parentNode==w.$.parentNode)Q--;t.setStart(G.getParent(),Q);}t.collapse(true);}if(A)w.remove();if(B&&x.$.parentNode)x.remove();},n={abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1};function o(t){var u=false,v=d.walker.bookmark(true);return function(w){if(v(w))return true;if(w.type==3){if(e.trim(w.getText()).length)return false;}else if(w.type==1)if(!n[w.getName()])if(!t&&!c&&w.getName()=='br'&&!u)u=true;else return false;return true;};};function p(t){return t.type!=3&&t.getName() in f.$removeEmpty||!e.trim(t.getText())||t.getParent().hasAttribute('_fck_bookmark');};var q=new d.walker.whitespaces(),r=new d.walker.bookmark();function s(t){return!q(t)&&!r(t);};d.range.prototype={clone:function(){var u=this;var t=new d.range(u.document);t.startContainer=u.startContainer;t.startOffset=u.startOffset;t.endContainer=u.endContainer;t.endOffset=u.endOffset;t.collapsed=u.collapsed;return t;},collapse:function(t){var u=this;if(t){u.endContainer=u.startContainer;u.endOffset=u.startOffset;}else{u.startContainer=u.endContainer;u.startOffset=u.endOffset;}u.collapsed=true;},cloneContents:function(){var t=new d.documentFragment(this.document);if(!this.collapsed)m(this,2,t);return t;},deleteContents:function(){if(this.collapsed)return;m(this,0);},extractContents:function(){var t=new d.documentFragment(this.document);if(!this.collapsed)m(this,1,t);return t;},createBookmark:function(t){var y=this;var u,v,w,x;u=y.document.createElement('span');u.setAttribute('_fck_bookmark',1);u.setStyle('display','none');u.setHtml(' ');if(t){w='cke_bm_'+e.getNextNumber();u.setAttribute('id',w+'S');}if(!y.collapsed){v=u.clone();v.setHtml(' ');if(t)v.setAttribute('id',w+'E');
-x=y.clone();x.collapse();x.insertNode(v);}x=y.clone();x.collapse(true);x.insertNode(u);if(v){y.setStartAfter(u);y.setEndBefore(v);}else y.moveToPosition(u,4);return{startNode:t?w+'S':u,endNode:t?w+'E':v,serializable:t};},createBookmark2:function(t){var A=this;var u=A.startContainer,v=A.endContainer,w=A.startOffset,x=A.endOffset,y,z;if(!u||!v)return{start:0,end:0};if(t){if(u.type==1){y=u.getChild(w);if(y&&y.type==3&&w>0&&y.getPrevious().type==3){u=y;w=0;}}while(u.type==3&&(z=u.getPrevious())&&z.type==3){u=z;w+=z.getLength();}if(!A.isCollapsed){if(v.type==1){y=v.getChild(x);if(y&&y.type==3&&x>0&&y.getPrevious().type==3){v=y;x=0;}}while(v.type==3&&(z=v.getPrevious())&&z.type==3){v=z;x+=z.getLength();}}}return{start:u.getAddress(t),end:A.isCollapsed?null:v.getAddress(t),startOffset:w,endOffset:x,normalized:t,is2:true};},moveToBookmark:function(t){var B=this;if(t.is2){var u=B.document.getByAddress(t.start,t.normalized),v=t.startOffset,w=t.end&&B.document.getByAddress(t.end,t.normalized),x=t.endOffset;B.setStart(u,v);if(w)B.setEnd(w,x);else B.collapse(true);}else{var y=t.serializable,z=y?B.document.getById(t.startNode):t.startNode,A=y?B.document.getById(t.endNode):t.endNode;B.setStartBefore(z);z.remove();if(A){B.setEndBefore(A);A.remove();}else B.collapse(true);}},getBoundaryNodes:function(){var y=this;var t=y.startContainer,u=y.endContainer,v=y.startOffset,w=y.endOffset,x;if(t.type==1){x=t.getChildCount();if(x>v)t=t.getChild(v);else if(x<1)t=t.getPreviousSourceNode();else{t=t.$;while(t.lastChild)t=t.lastChild;t=new d.node(t);t=t.getNextSourceNode()||t;}}if(u.type==1){x=u.getChildCount();if(x>w)u=u.getChild(w).getPreviousSourceNode(true);else if(x<1)u=u.getPreviousSourceNode();else{u=u.$;while(u.lastChild)u=u.lastChild;u=new d.node(u);}}if(t.getPosition(u)&2)t=u;return{startNode:t,endNode:u};},getCommonAncestor:function(t,u){var y=this;var v=y.startContainer,w=y.endContainer,x;if(v.equals(w)){if(t&&v.type==1&&y.startOffset==y.endOffset-1)x=v.getChild(y.startOffset);else x=v;}else x=v.getCommonAncestor(w);return u&&!x.is?x.getParent():x;},optimize:function(){var v=this;var t=v.startContainer,u=v.startOffset;if(t.type!=1)if(!u)v.setStartBefore(t);else if(u>=t.getLength())v.setStartAfter(t);t=v.endContainer;u=v.endOffset;if(t.type!=1)if(!u)v.setEndBefore(t);else if(u>=t.getLength())v.setEndAfter(t);},optimizeBookmark:function(){var v=this;var t=v.startContainer,u=v.endContainer;if(t.is&&t.is('span')&&t.hasAttribute('_fck_bookmark'))v.setStartAt(t,3);if(u&&u.is&&u.is('span')&&u.hasAttribute('_fck_bookmark'))v.setEndAt(u,4);
-},trim:function(t,u){var B=this;var v=B.startContainer,w=B.startOffset,x=B.collapsed;if((!t||x)&&v&&v.type==3){if(!w){w=v.getIndex();v=v.getParent();}else if(w>=v.getLength()){w=v.getIndex()+1;v=v.getParent();}else{var y=v.split(w);w=v.getIndex()+1;v=v.getParent();if(B.startContainer.equals(B.endContainer))B.setEnd(y,B.endOffset-B.startOffset);else if(v.equals(B.endContainer))B.endOffset+=1;}B.setStart(v,w);if(x){B.collapse(true);return;}}var z=B.endContainer,A=B.endOffset;if(!(u||x)&&z&&z.type==3){if(!A){A=z.getIndex();z=z.getParent();}else if(A>=z.getLength()){A=z.getIndex()+1;z=z.getParent();}else{z.split(A);A=z.getIndex()+1;z=z.getParent();}B.setEnd(z,A);}},enlarge:function(t){switch(t){case 1:if(this.collapsed)return;var u=this.getCommonAncestor(),v=this.document.getBody(),w,x,y,z,A,B=false,C,D,E=this.startContainer,F=this.startOffset;if(E.type==3){if(F){E=!e.trim(E.substring(0,F)).length&&E;B=!!E;}if(E)if(!(z=E.getPrevious()))y=E.getParent();}else{if(F)z=E.getChild(F-1)||E.getLast();if(!z)y=E;}while(y||z){if(y&&!z){if(!A&&y.equals(u))A=true;if(!v.contains(y))break;if(!B||y.getComputedStyle('display')!='inline'){B=false;if(A)w=y;else this.setStartBefore(y);}z=y.getPrevious();}while(z){C=false;if(z.type==3){D=z.getText();if(/[^\s\ufeff]/.test(D))z=null;C=/[\s\ufeff]$/.test(D);}else if(z.$.offsetWidth>0&&!z.getAttribute('_fck_bookmark'))if(B&&f.$removeEmpty[z.getName()]){D=z.getText();if(/[^\s\ufeff]/.test(D))z=null;else{var G=z.$.all||z.$.getElementsByTagName('*');for(var H=0,I;I=G[H++];){if(!f.$removeEmpty[I.nodeName.toLowerCase()]){z=null;break;}}}if(z)C=!!D.length;}else z=null;if(C)if(B){if(A)w=y;else if(y)this.setStartBefore(y);}else B=true;if(z){var J=z.getPrevious();if(!y&&!J){y=z;z=null;break;}z=J;}else y=null;}if(y)y=y.getParent();}E=this.endContainer;F=this.endOffset;y=z=null;A=B=false;if(E.type==3){E=!e.trim(E.substring(F)).length&&E;B=!(E&&E.getLength());if(E)if(!(z=E.getNext()))y=E.getParent();}else{z=E.getChild(F);if(!z)y=E;}while(y||z){if(y&&!z){if(!A&&y.equals(u))A=true;if(!v.contains(y))break;if(!B||y.getComputedStyle('display')!='inline'){B=false;if(A)x=y;else if(y)this.setEndAfter(y);}z=y.getNext();}while(z){C=false;if(z.type==3){D=z.getText();if(/[^\s\ufeff]/.test(D))z=null;C=/^[\s\ufeff]/.test(D);}else if(z.$.offsetWidth>0&&!z.getAttribute('_fck_bookmark'))if(B&&f.$removeEmpty[z.getName()]){D=z.getText();if(/[^\s\ufeff]/.test(D))z=null;else{G=z.$.all||z.$.getElementsByTagName('*');for(H=0;I=G[H++];){if(!f.$removeEmpty[I.nodeName.toLowerCase()]){z=null;
-break;}}}if(z)C=!!D.length;}else z=null;if(C)if(B)if(A)x=y;else this.setEndAfter(y);if(z){J=z.getNext();if(!y&&!J){y=z;z=null;break;}z=J;}else y=null;}if(y)y=y.getParent();}if(w&&x){u=w.contains(x)?x:w;this.setStartBefore(u);this.setEndAfter(u);}break;case 2:case 3:var K=new d.range(this.document);v=this.document.getBody();K.setStartAt(v,1);K.setEnd(this.startContainer,this.startOffset);var L=new d.walker(K),M,N,O=d.walker.blockBoundary(t==3?{br:1}:null),P=function(R){var S=O(R);if(!S)M=R;return S;},Q=function(R){var S=P(R);if(!S&&R.is&&R.is('br'))N=R;return S;};L.guard=P;y=L.lastBackward();M=M||v;this.setStartAt(M,!M.is('br')&&(!y&&this.checkStartOfBlock()||y&&M.contains(y))?1:4);K=this.clone();K.collapse();K.setEndAt(v,2);L=new d.walker(K);L.guard=t==3?Q:P;M=null;y=L.lastForward();M=M||v;this.setEndAt(M,!y&&this.checkEndOfBlock()||y&&M.contains(y)?2:3);if(N)this.setEndAfter(N);}},shrink:function(t,u){if(!this.collapsed){t=t||2;var v=this.clone(),w=this.startContainer,x=this.endContainer,y=this.startOffset,z=this.endOffset,A=this.collapsed,B=1,C=1;if(w&&w.type==3)if(!y)v.setStartBefore(w);else if(y>=w.getLength())v.setStartAfter(w);else{v.setStartBefore(w);B=0;}if(x&&x.type==3)if(!z)v.setEndBefore(x);else if(z>=x.getLength())v.setEndAfter(x);else{v.setEndAfter(x);C=0;}var D=new d.walker(v);D.evaluator=function(H){return H.type==(t==1?1:3);};var E;D.guard=function(H,I){if(t==1&&H.type==3)return false;if(I&&H.equals(E))return false;if(!I&&H.type==1)E=H;return true;};if(B){var F=D[t==1?'lastForward':'next']();F&&this.setStartAt(F,u?1:3);}if(C){D.reset();var G=D[t==1?'lastBackward':'previous']();G&&this.setEndAt(G,u?2:4);}return!!(B||C);}},insertNode:function(t){var x=this;x.optimizeBookmark();x.trim(false,true);var u=x.startContainer,v=x.startOffset,w=u.getChild(v);if(w)t.insertBefore(w);else u.append(t);if(t.getParent().equals(x.endContainer))x.endOffset++;x.setStartBefore(t);},moveToPosition:function(t,u){this.setStartAt(t,u);this.collapse(true);},selectNodeContents:function(t){this.setStart(t,0);this.setEnd(t,t.type==3?t.getLength():t.getChildCount());},setStart:function(t,u){var v=this;if(t.type==1&&f.$empty[t.getName()])t=t.getParent(),u=t.getIndex();v.startContainer=t;v.startOffset=u;if(!v.endContainer){v.endContainer=t;v.endOffset=u;}l(v);},setEnd:function(t,u){var v=this;if(t.type==1&&f.$empty[t.getName()])t=t.getParent(),u=t.getIndex()+1;v.endContainer=t;v.endOffset=u;if(!v.startContainer){v.startContainer=t;v.startOffset=u;}l(v);},setStartAfter:function(t){this.setStart(t.getParent(),t.getIndex()+1);
-},setStartBefore:function(t){this.setStart(t.getParent(),t.getIndex());},setEndAfter:function(t){this.setEnd(t.getParent(),t.getIndex()+1);},setEndBefore:function(t){this.setEnd(t.getParent(),t.getIndex());},setStartAt:function(t,u){var v=this;switch(u){case 1:v.setStart(t,0);break;case 2:if(t.type==3)v.setStart(t,t.getLength());else v.setStart(t,t.getChildCount());break;case 3:v.setStartBefore(t);break;case 4:v.setStartAfter(t);}l(v);},setEndAt:function(t,u){var v=this;switch(u){case 1:v.setEnd(t,0);break;case 2:if(t.type==3)v.setEnd(t,t.getLength());else v.setEnd(t,t.getChildCount());break;case 3:v.setEndBefore(t);break;case 4:v.setEndAfter(t);}l(v);},fixBlock:function(t,u){var x=this;var v=x.createBookmark(),w=x.document.createElement(u);x.collapse(t);x.enlarge(2);x.extractContents().appendTo(w);w.trim();if(!c)w.appendBogus();x.insertNode(w);x.moveToBookmark(v);return w;},splitBlock:function(t){var D=this;var u=new d.elementPath(D.startContainer),v=new d.elementPath(D.endContainer),w=u.blockLimit,x=v.blockLimit,y=u.block,z=v.block,A=null;if(!w.equals(x))return null;if(t!='br'){if(!y){y=D.fixBlock(true,t);z=new d.elementPath(D.endContainer).block;}if(!z)z=D.fixBlock(false,t);}var B=y&&D.checkStartOfBlock(),C=z&&D.checkEndOfBlock();D.deleteContents();if(y&&y.equals(z))if(C){A=new d.elementPath(D.startContainer);D.moveToPosition(z,4);z=null;}else if(B){A=new d.elementPath(D.startContainer);D.moveToPosition(y,3);y=null;}else{z=D.splitElement(y);if(!c&&!y.is('ul','ol'))y.appendBogus();}return{previousBlock:y,nextBlock:z,wasStartOfBlock:B,wasEndOfBlock:C,elementPath:A};},splitElement:function(t){var w=this;if(!w.collapsed)return null;w.setEndAt(t,2);var u=w.extractContents(),v=t.clone(false);u.appendTo(v);v.insertAfter(t);w.moveToPosition(t,4);return v;},checkBoundaryOfElement:function(t,u){var v=this.clone();v[u==1?'setStartAt':'setEndAt'](t,u==1?1:2);var w=new d.walker(v),x=false;w.evaluator=p;return w[u==1?'checkBackward':'checkForward']();},checkStartOfBlock:function(){var z=this;var t=z.startContainer,u=z.startOffset;if(u&&t.type==3){var v=e.ltrim(t.substring(0,u));if(v.length)return false;}z.trim();var w=new d.elementPath(z.startContainer),x=z.clone();x.collapse(true);x.setStartAt(w.block||w.blockLimit,1);var y=new d.walker(x);y.evaluator=o(true);return y.checkBackward();},checkEndOfBlock:function(){var z=this;var t=z.endContainer,u=z.endOffset;if(t.type==3){var v=e.rtrim(t.substring(u));if(v.length)return false;}z.trim();var w=new d.elementPath(z.endContainer),x=z.clone();
-x.collapse(false);x.setEndAt(w.block||w.blockLimit,2);var y=new d.walker(x);y.evaluator=o(false);return y.checkForward();},moveToElementEditablePosition:function(t,u){var v;if(f.$empty[t.getName()])return false;while(t&&t.type==1){v=t.isEditable();if(v)this.moveToPosition(t,u?2:1);else if(f.$inline[t.getName()]){this.moveToPosition(t,u?4:3);return true;}if(f.$empty[t.getName()])t=t[u?'getPrevious':'getNext'](s);else t=t[u?'getLast':'getFirst'](s);if(t&&t.type==3){this.moveToPosition(t,u?4:3);return true;}}return v;},moveToElementEditStart:function(t){return this.moveToElementEditablePosition(t);},moveToElementEditEnd:function(t){return this.moveToElementEditablePosition(t,true);},getEnclosedNode:function(){var t=this.clone();t.optimize();if(t.startContainer.type!=1||t.endContainer.type!=1)return null;var u=new d.walker(t),v=d.walker.bookmark(true),w=d.walker.whitespaces(true),x=function(z){return w(z)&&v(z);};t.evaluator=x;var y=u.next();u.reset();return y&&y.equals(u.previous())?y:null;},getTouchedStartNode:function(){var t=this.startContainer;if(this.collapsed||t.type!=1)return t;return t.getChild(this.startOffset)||t;},getTouchedEndNode:function(){var t=this.endContainer;if(this.collapsed||t.type!=1)return t;return t.getChild(this.endOffset-1)||t;}};})();a.POSITION_AFTER_START=1;a.POSITION_BEFORE_END=2;a.POSITION_BEFORE_START=3;a.POSITION_AFTER_END=4;a.ENLARGE_ELEMENT=1;a.ENLARGE_BLOCK_CONTENTS=2;a.ENLARGE_LIST_ITEM_CONTENTS=3;a.START=1;a.END=2;a.STARTEND=3;a.SHRINK_ELEMENT=1;a.SHRINK_TEXT=2;(function(){if(b.webkit){b.hc=false;return;}var l=c&&b.version<7,m=c&&b.version==7,n=l?a.basePath+'images/spacer.gif':m?'about:blank':'data:image/png;base64,',o=h.createFromHtml('<div style="width:0px;height:0px;position:absolute;left:-10000px;background-image:url('+n+')"></div>',a.document);o.appendTo(a.document.getHead());try{b.hc=o.getComputedStyle('background-image')=='none';}catch(p){b.hc=false;}if(b.hc)b.cssClass+=' cke_hc';o.remove();})();j.load(i.corePlugins.split(','),function(){a.status='loaded';a.fire('loaded');var l=a._.pending;if(l){delete a._.pending;for(var m=0;m<l.length;m++)a.add(l[m]);}});a.skins.add('kama',(function(){var l=[],m='cke_ui_color';if(c&&b.version<7)l.push('icons.png','images/sprites_ie6.png','images/dialog_sides.gif');return{preload:l,editor:{css:['editor.css']},dialog:{css:['dialog.css']},templates:{css:['templates.css']},margins:[0,0,0,0],init:function(n){if(n.config.width&&!isNaN(n.config.width))n.config.width-=12;var o=[],p=/\$color/g,q='/* UI Color Support */.cke_skin_kama .cke_menuitem .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuitem a:hover .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:focus .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:active .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuitem a:hover .cke_label,.cke_skin_kama .cke_menuitem a:focus .cke_label,.cke_skin_kama .cke_menuitem a:active .cke_label{\tbackground-color: $color !important;}.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:active .cke_label{\tbackground-color: transparent !important;}.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a.cke_disabled:active .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuitem a.cke_disabled .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuseparator{\tbackground-color: $color !important;}.cke_skin_kama .cke_menuitem a:hover,.cke_skin_kama .cke_menuitem a:focus,.cke_skin_kama .cke_menuitem a:active{\tbackground-color: $color !important;}';
-if(b.webkit){q=q.split('}').slice(0,-1);for(var r=0;r<q.length;r++)q[r]=q[r].split('{');}function s(v){var w=v.getById(m);if(!w){w=v.getHead().append('style');w.setAttribute('id',m);w.setAttribute('type','text/css');}return w;};function t(v,w,x){var y,z,A;for(var B=0;B<v.length;B++){if(b.webkit)for(z=0;z<w.length;z++){A=w[z][1];for(y=0;y<x.length;y++)A=A.replace(x[y][0],x[y][1]);v[B].$.sheet.addRule(w[z][0],A);}else{A=w;for(y=0;y<x.length;y++)A=A.replace(x[y][0],x[y][1]);if(c)v[B].$.styleSheet.cssText+=A;else v[B].$.innerHTML+=A;}}};var u=/\$color/g;e.extend(n,{uiColor:null,getUiColor:function(){return this.uiColor;},setUiColor:function(v){var w,x=s(a.document),y='.cke_editor_'+e.escapeCssSelector(n.name),z=[y+' .cke_wrapper',y+'_dialog .cke_dialog_contents',y+'_dialog a.cke_dialog_tab',y+'_dialog .cke_dialog_footer'].join(','),A='background-color: $color !important;';if(b.webkit)w=[[z,A]];else w=z+'{'+A+'}';return(this.setUiColor=function(B){var C=[[u,B]];n.uiColor=B;t([x],w,C);t(o,q,C);})(v);}});n.on('menuShow',function(v){var w=v.data[0],x=w.element.getElementsByTag('iframe').getItem(0).getFrameDocument();if(!x.getById('cke_ui_color')){var y=s(x);o.push(y);var z=n.getUiColor();if(z)t([y],q,[[u,z]]);}});if(n.config.uiColor)n.setUiColor(n.config.uiColor);}};})());(function(){a.dialog?l():a.on('dialogPluginReady',l);function l(){a.dialog.on('resize',function(m){var n=m.data,o=n.width,p=n.height,q=n.dialog,r=q.parts.contents;if(n.skin!='kama')return;r.setStyles({width:o+'px',height:p+'px'});setTimeout(function(){var s=q.parts.dialog.getChild([0,0,0]),t=s.getChild(0),u=s.getChild(2);u.setStyle('width',t.$.offsetWidth+'px');u=s.getChild(7);u.setStyle('width',t.$.offsetWidth-28+'px');u=s.getChild(4);u.setStyle('height',t.$.offsetHeight-31-14+'px');u=s.getChild(5);u.setStyle('height',t.$.offsetHeight-31-14+'px');},100);});};})();j.add('about',{requires:['dialog'],init:function(l){var m=l.addCommand('about',new a.dialogCommand('about'));m.modes={wysiwyg:1,source:1};m.canUndo=false;l.ui.addButton('About',{label:l.lang.about.title,command:'about'});a.dialog.add('about',this.path+'dialogs/about.js');}});(function(){var l='a11yhelp',m='a11yHelp';j.add(l,{availableLangs:{en:1,he:1},init:function(n){var o=this;n.addCommand(m,{exec:function(){var p=n.langCode;p=o.availableLangs[p]?p:'en';a.scriptLoader.load(a.getUrl(o.path+'lang/'+p+'.js'),function(){e.extend(n.lang,o.lang[p]);n.openDialog(m);});},modes:{wysiwyg:1,source:1},canUndo:false});a.dialog.add(m,this.path+'dialogs/a11yhelp.js');
-}});})();j.add('basicstyles',{requires:['styles','button'],init:function(l){var m=function(p,q,r,s){var t=new a.style(s);l.attachStyleStateChange(t,function(u){l.getCommand(r).setState(u);});l.addCommand(r,new a.styleCommand(t));l.ui.addButton(p,{label:q,command:r});},n=l.config,o=l.lang;m('Bold',o.bold,'bold',n.coreStyles_bold);m('Italic',o.italic,'italic',n.coreStyles_italic);m('Underline',o.underline,'underline',n.coreStyles_underline);m('Strike',o.strike,'strike',n.coreStyles_strike);m('Subscript',o.subscript,'subscript',n.coreStyles_subscript);m('Superscript',o.superscript,'superscript',n.coreStyles_superscript);}});i.coreStyles_bold={element:'strong',overrides:'b'};i.coreStyles_italic={element:'em',overrides:'i'};i.coreStyles_underline={element:'u'};i.coreStyles_strike={element:'strike'};i.coreStyles_subscript={element:'sub'};i.coreStyles_superscript={element:'sup'};(function(){function l(p,q){var r=q.block||q.blockLimit;if(!r||r.getName()=='body')return 2;if(r.getAscendant('blockquote',true))return 1;return 2;};function m(p){var q=p.editor,r=q.getCommand('blockquote');r.state=l(q,p.data.path);r.fire('state');};function n(p){for(var q=0,r=p.getChildCount(),s;q<r&&(s=p.getChild(q));q++){if(s.type==1&&s.isBlockBoundary())return false;}return true;};var o={exec:function(p){var q=p.getCommand('blockquote').state,r=p.getSelection(),s=r&&r.getRanges()[0];if(!s)return;var t=r.createBookmarks();if(c){var u=t[0].startNode,v=t[0].endNode,w;if(u&&u.getParent().getName()=='blockquote'){w=u;while(w=w.getNext()){if(w.type==1&&w.isBlockBoundary()){u.move(w,true);break;}}}if(v&&v.getParent().getName()=='blockquote'){w=v;while(w=w.getPrevious()){if(w.type==1&&w.isBlockBoundary()){v.move(w);break;}}}}var x=s.createIterator(),y;if(q==2){var z=[];while(y=x.getNextParagraph())z.push(y);if(z.length<1){var A=p.document.createElement(p.config.enterMode==1?'p':'div'),B=t.shift();s.insertNode(A);A.append(new d.text('\ufeff',p.document));s.moveToBookmark(B);s.selectNodeContents(A);s.collapse(true);B=s.createBookmark();z.push(A);t.unshift(B);}var C=z[0].getParent(),D=[];for(var E=0;E<z.length;E++){y=z[E];C=C.getCommonAncestor(y.getParent());}var F={table:1,tbody:1,tr:1,ol:1,ul:1};while(F[C.getName()])C=C.getParent();var G=null;while(z.length>0){y=z.shift();while(!y.getParent().equals(C))y=y.getParent();if(!y.equals(G))D.push(y);G=y;}while(D.length>0){y=D.shift();if(y.getName()=='blockquote'){var H=new d.documentFragment(p.document);while(y.getFirst()){H.append(y.getFirst().remove());
-z.push(H.getLast());}H.replace(y);}else z.push(y);}var I=p.document.createElement('blockquote');I.insertBefore(z[0]);while(z.length>0){y=z.shift();I.append(y);}}else if(q==1){var J=[],K={};while(y=x.getNextParagraph()){var L=null,M=null;while(y.getParent()){if(y.getParent().getName()=='blockquote'){L=y.getParent();M=y;break;}y=y.getParent();}if(L&&M&&!M.getCustomData('blockquote_moveout')){J.push(M);h.setMarker(K,M,'blockquote_moveout',true);}}h.clearAllMarkers(K);var N=[],O=[];K={};while(J.length>0){var P=J.shift();I=P.getParent();if(!P.getPrevious())P.remove().insertBefore(I);else if(!P.getNext())P.remove().insertAfter(I);else{P.breakParent(P.getParent());O.push(P.getNext());}if(!I.getCustomData('blockquote_processed')){O.push(I);h.setMarker(K,I,'blockquote_processed',true);}N.push(P);}h.clearAllMarkers(K);for(E=O.length-1;E>=0;E--){I=O[E];if(n(I))I.remove();}if(p.config.enterMode==2){var Q=true;while(N.length){P=N.shift();if(P.getName()=='div'){H=new d.documentFragment(p.document);var R=Q&&P.getPrevious()&&!(P.getPrevious().type==1&&P.getPrevious().isBlockBoundary());if(R)H.append(p.document.createElement('br'));var S=P.getNext()&&!(P.getNext().type==1&&P.getNext().isBlockBoundary());while(P.getFirst())P.getFirst().remove().appendTo(H);if(S)H.append(p.document.createElement('br'));H.replace(P);Q=false;}}}}r.selectBookmarks(t);p.focus();}};j.add('blockquote',{init:function(p){p.addCommand('blockquote',o);p.ui.addButton('Blockquote',{label:p.lang.blockquote,command:'blockquote'});p.on('selectionChange',m);},requires:['domiterator']});})();j.add('button',{beforeInit:function(l){l.ui.addHandler(1,k.button.handler);}});a.UI_BUTTON=1;k.button=function(l){e.extend(this,l,{title:l.label,className:l.className||l.command&&'cke_button_'+l.command||'',click:l.click||(function(m){m.execCommand(l.command);})});this._={};};k.button.handler={create:function(l){return new k.button(l);}};k.button.prototype={canGroup:true,render:function(l,m){var n=b,o=this._.id='cke_'+e.getNextNumber(),p='',q=this.command,r,s;this._.editor=l;var t={id:o,button:this,editor:l,focus:function(){var v=a.document.getById(o);v.focus();},execute:function(){this.button.click(l);}};t.clickFn=r=e.addFunction(t.execute,t);t.index=s=k.button._.instances.push(t)-1;if(this.modes)l.on('mode',function(){this.setState(this.modes[l.mode]?2:0);},this);else if(q){q=l.getCommand(q);if(q){q.on('state',function(){this.setState(q.state);},this);p+='cke_'+(q.state==1?'on':q.state==0?'disabled':'off');}}if(!q)p+='cke_off';
-if(this.className)p+=' '+this.className;m.push('<span class="cke_button">','<a id="',o,'" class="',p,'"',n.gecko&&n.version>=10900&&!n.hc?'':'" href="javascript:void(\''+(this.title||'').replace("'")+"')\"",' title="',this.title,'" tabindex="-1" hidefocus="true" role="button" aria-labelledby="'+o+'_label"'+(this.hasArrow?' aria-haspopup="true"':''));if(n.opera||n.gecko&&n.mac)m.push(' onkeypress="return false;"');if(n.gecko)m.push(' onblur="this.style.cssText = this.style.cssText;"');m.push(' onkeydown="return CKEDITOR.ui.button._.keydown(',s,', event);" onfocus="return CKEDITOR.ui.button._.focus(',s,', event);" onclick="CKEDITOR.tools.callFunction(',r,', this); return false;"><span class="cke_icon"');if(this.icon){var u=(this.iconOffset||0)*-16;m.push(' style="background-image:url(',a.getUrl(this.icon),');background-position:0 '+u+'px;"');}m.push('> </span><span id="',o,'_label" class="cke_label">',this.label,'</span>');if(this.hasArrow)m.push('<span class="cke_buttonarrow">'+(b.hc?'▼':' ')+'</span>');m.push('</a>','</span>');if(this.onRender)this.onRender();return t;},setState:function(l){if(this._.state==l)return false;this._.state=l;var m=a.document.getById(this._.id);if(m){m.setState(l);l==0?m.setAttribute('aria-disabled',true):m.removeAttribute('aria-disabled');l==1?m.setAttribute('aria-pressed',true):m.removeAttribute('aria-pressed');return true;}else return false;}};k.button._={instances:[],keydown:function(l,m){var n=k.button._.instances[l];if(n.onkey){m=new d.event(m);return n.onkey(n,m.getKeystroke())!==false;}},focus:function(l,m){var n=k.button._.instances[l],o;if(n.onfocus)o=n.onfocus(n,new d.event(m))!==false;if(b.gecko&&b.version<10900)m.preventBubble();return o;}};k.prototype.addButton=function(l,m){this.add(l,1,m);};a.on('reset',function(){k.button._.instances=[];});(function(){var l=function(s,t){var u=s.document,v=u.getBody(),w=false,x=function(){w=true;};v.on(t,x);(b.version>7?u.$:u.$.selection.createRange()).execCommand(t);v.removeListener(t,x);return w;},m=c?function(s,t){return l(s,t);}:function(s,t){try{return s.document.$.execCommand(t);}catch(u){return false;}},n=function(s){this.type=s;this.canUndo=this.type=='cut';};n.prototype={exec:function(s,t){this.type=='cut'&&r(s);var u=m(s,this.type);if(!u)alert(s.lang.clipboard[this.type+'Error']);return u;}};var o={canUndo:false,exec:c?function(s){s.focus();if(!s.document.getBody().fire('beforepaste')&&!l(s,'paste')){s.fire('pasteDialog');return false;}}:function(s){try{if(!s.document.getBody().fire('beforepaste')&&!s.document.$.execCommand('Paste',false,null))throw 0;
-}catch(t){setTimeout(function(){s.fire('pasteDialog');},0);return false;}}},p=function(s){if(this.mode!='wysiwyg')return;switch(s.data.keyCode){case 1000+86:case 2000+45:var t=this.document.getBody();if(!c&&t.fire('beforepaste'))s.cancel();else if(b.opera||b.gecko&&b.version<10900)t.fire('paste');return;case 1000+88:case 2000+46:var u=this;this.fire('saveSnapshot');setTimeout(function(){u.fire('saveSnapshot');},0);}};function q(s,t,u){var v=this.document;if(c&&v.getById('cke_pastebin'))return;if(t=='text'&&s.data&&s.data.$.clipboardData){var w=s.data.$.clipboardData.getData('text/plain');if(w){s.data.preventDefault();u(w);return;}}var x=this.getSelection(),y=new d.range(v),z=new h(t=='text'?'textarea':b.webkit?'body':'div',v);z.setAttribute('id','cke_pastebin');b.webkit&&z.append(v.createText('\xa0'));v.getBody().append(z);z.setStyles({position:'absolute',top:x.getStartElement().getDocumentPosition().y+'px',width:'1px',height:'1px',overflow:'hidden'});z.setStyle(this.config.contentsLangDirection=='ltr'?'left':'right','-1000px');var A=x.createBookmarks();if(t=='text'){if(c){var B=v.getBody().$.createTextRange();B.moveToElementText(z.$);B.execCommand('Paste');s.data.preventDefault();}else{v.$.designMode='off';z.$.focus();}}else{y.setStartAt(z,1);y.setEndAt(z,2);y.select(true);}window.setTimeout(function(){t=='text'&&!c&&(v.$.designMode='on');z.remove();var C;z=b.webkit&&(C=z.getFirst())&&C.is&&C.hasClass('Apple-style-span')?C:z;x.selectBookmarks(A);u(z['get'+(t=='text'?'Value':'Html')]());},0);};function r(s){if(!c||s.document.$.compatMode=='BackCompat')return;var t=s.getSelection(),u;if(t.getType()==3&&(u=t.getSelectedElement())){var v=t.getRanges()[0],w=s.document.createText('');w.insertBefore(u);v.setStartBefore(w);v.setEndAfter(u);t.selectRanges([v]);setTimeout(function(){if(u.getParent()){w.remove();t.selectElement(u);}},0);}};j.add('clipboard',{requires:['dialog','htmldataprocessor'],init:function(s){s.on('paste',function(x){var y=x.data;if(y.html)s.insertHtml(y.html);else if(y.text)s.insertText(y.text);},null,null,1000);s.on('pasteDialog',function(x){setTimeout(function(){s.openDialog('paste');},0);});function t(x,y,z,A){var B=s.lang[y];s.addCommand(y,z);s.ui.addButton(x,{label:B,command:y});if(s.addMenuItems)s.addMenuItem(y,{label:B,command:y,group:'clipboard',order:A});};t('Cut','cut',new n('cut'),1);t('Copy','copy',new n('copy'),4);t('Paste','paste',o,8);a.dialog.add('paste',a.getUrl(this.path+'dialogs/paste.js'));s.on('key',p,s);var u=s.config.forcePasteAsPlainText?'text':'html';
-s.on('contentDom',function(){var x=s.document.getBody();x.on(u=='text'&&c||b.webkit?'paste':'beforepaste',function(y){if(v)return;q.call(s,y,u,function(z){if(!z)return;var A={};A[u]=z;s.fire('paste',A);});});x.on('beforecut',function(){!v&&r(s);});});if(s.contextMenu){var v;function w(x){c&&(v=1);var y=s.document.$.queryCommandEnabled(x)?2:0;v=0;return y;};s.contextMenu.addListener(function(){return{cut:w('Cut'),copy:w('Cut'),paste:b.webkit?2:w('Paste')};});}}});})();j.add('colorbutton',{requires:['panelbutton','floatpanel','styles'],init:function(l){var m=l.config,n=l.lang.colorButton,o;if(!b.hc){p('TextColor','fore',n.textColorTitle);p('BGColor','back',n.bgColorTitle);}function p(r,s,t){l.ui.add(r,4,{label:t,title:t,className:'cke_button_'+r.toLowerCase(),modes:{wysiwyg:1},panel:{css:l.skin.editor.css,attributes:{role:'listbox','aria-label':n.panelTitle}},onBlock:function(u,v){v.autoSize=true;v.element.addClass('cke_colorblock');v.element.setHtml(q(u,s));var w=v.keys;w[39]='next';w[40]='next';w[9]='next';w[37]='prev';w[38]='prev';w[2000+9]='prev';w[32]='click';}});};function q(r,s){var t=[],u=m.colorButton_colors.split(','),v=u.length+(m.colorButton_enableMore?2:1),w=e.addFunction(function(C,D){if(C=='?'){var E=arguments.callee;function F(H){this.removeListener('ok',F);this.removeListener('cancel',F);H.name=='ok'&&E(this.getContentElement('picker','selectedColor').getValue(),D);};l.openDialog('colordialog',function(){this.on('ok',F);this.on('cancel',F);});return;}l.focus();r.hide();l.fire('saveSnapshot');new a.style(m['colorButton_'+D+'Style'],{color:'inherit'}).remove(l.document);if(C){var G=m['colorButton_'+D+'Style'];G.childRule=D=='back'?function(){return false;}:function(H){return H.getName()!='a';};new a.style(G,{color:C}).apply(l.document);}l.fire('saveSnapshot');});t.push('<a class="cke_colorauto" _cke_focus=1 hidefocus=true title="',n.auto,'" onclick="CKEDITOR.tools.callFunction(',w,",null,'",s,"');return false;\" href=\"javascript:void('",n.auto,'\')" role="option" aria-posinset="1" aria-setsize="',v,'"><table role="presentation" cellspacing=0 cellpadding=0 width="100%"><tr><td><span class="cke_colorbox" style="background-color:#000"></span></td><td colspan=7 align=center>',n.auto,'</td></tr></table></a><table role="presentation" cellspacing=0 cellpadding=0 width="100%">');for(var x=0;x<u.length;x++){if(x%8===0)t.push('</tr><tr>');var y=u[x].split('/'),z=y[0],A=y[1]||z;if(!y[1])z='#'+z.replace(/^(.)(.)(.)$/,'$1$1$2$2$3$3');var B=l.lang.colors[A]||A;
-t.push('<td><a class="cke_colorbox" _cke_focus=1 hidefocus=true title="',B,'" onclick="CKEDITOR.tools.callFunction(',w,",'",z,"','",s,"'); return false;\" href=\"javascript:void('",B,'\')" role="option" aria-posinset="',x+2,'" aria-setsize="',v,'"><span class="cke_colorbox" style="background-color:#',A,'"></span></a></td>');}if(m.colorButton_enableMore)t.push('</tr><tr><td colspan=8 align=center><a class="cke_colormore" _cke_focus=1 hidefocus=true title="',n.more,'" onclick="CKEDITOR.tools.callFunction(',w,",'?','",s,"');return false;\" href=\"javascript:void('",n.more,"')\"",' role="option" aria-posinset="',v,'" aria-setsize="',v,'">',n.more,'</a></td>');t.push('</tr></table>');return t.join('');};}});i.colorButton_enableMore=true;i.colorButton_colors='000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF';i.colorButton_foreStyle={element:'span',styles:{color:'#(color)'},overrides:[{element:'font',attributes:{color:null}}]};i.colorButton_backStyle={element:'span',styles:{'background-color':'#(color)'}};(function(){j.colordialog={init:function(l){l.addCommand('colordialog',new a.dialogCommand('colordialog'));a.dialog.add('colordialog',this.path+'dialogs/colordialog.js');}};j.add('colordialog',j.colordialog);})();j.add('contextmenu',{requires:['menu'],beforeInit:function(l){l.contextMenu=new j.contextMenu(l);l.addCommand('contextMenu',{exec:function(){l.contextMenu.show(l.document.getBody());}});}});j.contextMenu=e.createClass({$:function(l){this.id='cke_'+e.getNextNumber();this.editor=l;this._.listeners=[];this._.functionId=e.addFunction(function(m){this._.panel.hide();l.focus();l.execCommand(m);},this);this.definition={panel:{className:l.skinClass+' cke_contextmenu',attributes:{'aria-label':l.lang.contextmenu.options}}};},_:{onMenu:function(l,m,n,o){var p=this._.menu,q=this.editor;if(p){p.hide();p.removeAll();}else{p=this._.menu=new a.menu(q,this.definition);p.onClick=e.bind(function(z){p.hide();if(z.onClick)z.onClick();else if(z.command)q.execCommand(z.command);},this);p.onEscape=function(z){var A=this.parent;if(A){A._.panel.hideChild();var B=A._.panel._.panel._.currentBlock,C=B._.focusIndex;B._.markItem(C);}else if(z==27){this.hide();q.focus();}return false;};}var r=this._.listeners,s=[],t=this.editor.getSelection(),u=t&&t.getStartElement();p.onHide=e.bind(function(){p.onHide=null;
-if(c){var z=q.getSelection();z&&z.unlock();}this.onHide&&this.onHide();},this);for(var v=0;v<r.length;v++){var w=r[v](u,t);if(w)for(var x in w){var y=this.editor.getMenuItem(x);if(y){y.state=w[x];p.add(y);}}}p.items.length&&p.show(l,m||(q.lang.dir=='rtl'?2:1),n,o);}},proto:{addTarget:function(l,m){if(b.opera){var n;l.on('mousedown',function(r){r=r.data;if(r.$.button!=2){if(r.getKeystroke()==1000+1)l.fire('contextmenu',r);return;}if(m&&(b.mac?r.$.metaKey:r.$.ctrlKey))return;var s=r.getTarget();if(!n){var t=s.getDocument();n=t.createElement('input');n.$.type='button';t.getBody().append(n);}n.setAttribute('style','position:absolute;top:'+(r.$.clientY-2)+'px;left:'+(r.$.clientX-2)+'px;width:5px;height:5px;opacity:0.01');});l.on('mouseup',function(r){if(n){n.remove();n=undefined;l.fire('contextmenu',r.data);}});}l.on('contextmenu',function(r){var s=r.data;if(m&&(b.webkit?o:b.mac?s.$.metaKey:s.$.ctrlKey))return;s.preventDefault();var t=s.getTarget().getDocument().getDocumentElement(),u=s.$.clientX,v=s.$.clientY;e.setTimeout(function(){this.show(t,null,u,v);},0,this);},this);if(b.webkit){var o,p=function(r){o=b.mac?r.data.$.metaKey:r.data.$.ctrlKey;},q=function(){o=0;};l.on('keydown',p);l.on('keyup',q);l.on('contextmenu',q);}},addListener:function(l){this._.listeners.push(l);},show:function(l,m,n,o){this.editor.focus();if(c){var p=this.editor.getSelection();p&&p.lock();}this._.onMenu(l||a.document.getDocumentElement(),m,n||0,o||0);}}});(function(){j.add('div',{requires:['editingblock','domiterator','styles'],init:function(l){var m=l.lang.div;l.addCommand('creatediv',new a.dialogCommand('creatediv'));l.addCommand('editdiv',new a.dialogCommand('editdiv'));l.addCommand('removediv',{exec:function(n){var o=n.getSelection(),p=o&&o.getRanges(),q,r=o.createBookmarks(),s,t=[];function u(w){var x=new d.elementPath(w),y=x.blockLimit,z=y.is('div')&&y;if(z&&!z.getAttribute('_cke_div_added')){t.push(z);z.setAttribute('_cke_div_added');}};for(var v=0;v<p.length;v++){q=p[v];if(q.collapsed)u(o.getStartElement());else{s=new d.walker(q);s.evaluator=u;s.lastForward();}}for(v=0;v<t.length;v++)t[v].remove(true);o.selectBookmarks(r);}});l.ui.addButton('CreateDiv',{label:m.toolbar,command:'creatediv'});if(l.addMenuItems){l.addMenuItems({editdiv:{label:m.edit,command:'editdiv',group:'div',order:1},removediv:{label:m.remove,command:'removediv',group:'div',order:5}});if(l.contextMenu)l.contextMenu.addListener(function(n,o){if(!n)return null;var p=new d.elementPath(n),q=p.blockLimit;if(q&&q.getAscendant('div',true))return{editdiv:2,removediv:2};
-return null;});}a.dialog.add('creatediv',this.path+'dialogs/div.js');a.dialog.add('editdiv',this.path+'dialogs/div.js');}});})();(function(){var l={toolbarFocus:{exec:function(n){var o=n._.elementsPath.idBase,p=a.document.getById(o+'0');if(p)p.focus();}}},m='<span class="cke_empty"> </span>';j.add('elementspath',{requires:['selection'],init:function(n){var o='cke_path_'+n.name,p,q=function(){if(!p)p=a.document.getById(o);return p;},r='cke_elementspath_'+e.getNextNumber()+'_';n._.elementsPath={idBase:r,filters:[]};n.on('themeSpace',function(s){if(s.data.space=='bottom')s.data.html+='<span id="'+o+'_label" class="cke_voice_label">'+n.lang.elementsPath.eleLabel+'</span>'+'<div id="'+o+'" class="cke_path" role="group" aria-labelledby="'+o+'_label">'+m+'</div>';});n.on('selectionChange',function(s){var t=b,u=s.data.selection,v=u.getStartElement(),w=[],x=s.editor,y=x._.elementsPath.list=[],z=x._.elementsPath.filters;while(v){var A=0;for(var B=0;B<z.length;B++){if(z[B](v)===false){A=1;break;}}if(!A){var C=y.push(v)-1,D;if(v.getAttribute('_cke_real_element_type'))D=v.getAttribute('_cke_real_element_type');else D=v.getName();var E='';if(t.opera||t.gecko&&t.mac)E+=' onkeypress="return false;"';if(t.gecko)E+=' onblur="this.style.cssText = this.style.cssText;"';var F=x.lang.elementsPath.eleTitle.replace(/%1/,D);w.unshift('<a id="',r,C,'" href="javascript:void(\'',D,'\')" tabindex="-1" title="',F,'"'+(b.gecko&&b.version<10900?' onfocus="event.preventBubble();"':'')+' hidefocus="true" '+" onkeydown=\"return CKEDITOR._.elementsPath.keydown('",x.name,"',",C,', event);"'+E," onclick=\"return CKEDITOR._.elementsPath.click('",x.name,"',",C,');"',' role="button" aria-labelledby="'+r+C+'_label">',D,'<span id="',r,C,'_label" class="cke_label">'+F+'</span>','</a>');}if(D=='body')break;v=v.getParent();}q().setHtml(w.join('')+m);});n.on('contentDomUnload',function(){q().setHtml(m);});n.addCommand('elementsPathFocus',l.toolbarFocus);}});})();a._.elementsPath={click:function(l,m){var n=a.instances[l];n.focus();var o=n._.elementsPath.list[m];n.getSelection().selectElement(o);return false;},keydown:function(l,m,n){var o=k.button._.instances[m],p=a.instances[l],q=p._.elementsPath.idBase,r;n=new d.event(n);var s=p.lang.dir=='rtl';switch(n.getKeystroke()){case s?39:37:case 9:r=a.document.getById(q+(m+1));if(!r)r=a.document.getById(q+'0');r.focus();return false;case s?37:39:case 2000+9:r=a.document.getById(q+(m-1));if(!r)r=a.document.getById(q+(p._.elementsPath.list.length-1));r.focus();
-return false;case 27:p.focus();return false;case 13:case 32:this.click(l,m);return false;}return true;}};(function(){j.add('enterkey',{requires:['keystrokes','indent'],init:function(s){var t=s.specialKeys;t[13]=q;t[2000+13]=p;}});j.enterkey={enterBlock:function(s,t,u,v){u=u||r(s);var w=u.document;if(u.checkStartOfBlock()&&u.checkEndOfBlock()){var x=new d.elementPath(u.startContainer),y=x.block;if(y&&(y.is('li')||y.getParent().is('li'))){s.execCommand('outdent');return;}}var z=t==3?'div':'p',A=u.splitBlock(z);if(!A)return;var B=A.previousBlock,C=A.nextBlock,D=A.wasStartOfBlock,E=A.wasEndOfBlock,F;if(C){F=C.getParent();if(F.is('li')){C.breakParent(F);C.move(C.getNext(),true);}}else if(B&&(F=B.getParent())&&F.is('li')){B.breakParent(F);u.moveToElementEditStart(B.getNext());B.move(B.getPrevious());}if(!D&&!E){if(C.is('li')&&(F=C.getFirst(d.walker.invisible(true)))&&F.is&&F.is('ul','ol'))(c?w.createText('\xa0'):w.createElement('br')).insertBefore(F);if(C)u.moveToElementEditStart(C);}else{var G;if(B){if(B.is('li')||!o.test(B.getName()))G=B.clone();}else if(C)G=C.clone();if(!G)G=w.createElement(z);else if(v&&!G.is('li'))G.renameNode(z);var H=A.elementPath;if(H)for(var I=0,J=H.elements.length;I<J;I++){var K=H.elements[I];if(K.equals(H.block)||K.equals(H.blockLimit))break;if(f.$removeEmpty[K.getName()]){K=K.clone();G.moveChildren(K);G.append(K);}}if(!c)G.appendBogus();u.insertNode(G);if(c&&D&&(!E||!B.getChildCount())){u.moveToElementEditStart(E?B:G);u.select();}u.moveToElementEditStart(D&&!E?C:G);}if(!c)if(C){var L=w.createElement('span');L.setHtml(' ');u.insertNode(L);L.scrollIntoView();u.deleteContents();}else G.scrollIntoView();u.select();},enterBr:function(s,t,u,v){u=u||r(s);var w=u.document,x=t==3?'div':'p',y=u.checkEndOfBlock(),z=new d.elementPath(s.getSelection().getStartElement()),A=z.block,B=A&&z.block.getName(),C=false;if(!v&&B=='li'){n(s,t,u,v);return;}if(!v&&y&&o.test(B)){w.createElement('br').insertAfter(A);if(b.gecko)w.createText('').insertAfter(A);u.setStartAt(A.getNext(),c?3:1);}else{var D;C=B=='pre';if(C&&!b.gecko)D=w.createText(c?'\r':'\n');else D=w.createElement('br');u.deleteContents();u.insertNode(D);if(!c)w.createText('\ufeff').insertAfter(D);if(y&&!c)D.getParent().appendBogus();if(!c)D.getNext().$.nodeValue='';if(c)u.setStartAt(D,4);else u.setStartAt(D.getNext(),1);if(!c){var E=null;if(!b.gecko){E=w.createElement('span');E.setHtml(' ');}else E=w.createElement('br');E.insertBefore(D.getNext());E.scrollIntoView();E.remove();}}u.collapse(true);
-u.select(C);}};var l=j.enterkey,m=l.enterBr,n=l.enterBlock,o=/^h[1-6]$/;function p(s){if(s.mode!='wysiwyg')return false;if(s.getSelection().getStartElement().hasAscendant('pre',true)){setTimeout(function(){n(s,s.config.enterMode,null,true);},0);return true;}else return q(s,s.config.shiftEnterMode,true);};function q(s,t,u){u=s.config.forceEnterMode||u;if(s.mode!='wysiwyg')return false;if(!t)t=s.config.enterMode;setTimeout(function(){s.fire('saveSnapshot');if(t==2||s.getSelection().getStartElement().hasAscendant('pre',true))m(s,t,null,u);else n(s,t,null,u);},0);return true;};function r(s){var t=s.getSelection().getRanges();for(var u=t.length-1;u>0;u--)t[u].deleteContents();return t[0];};})();(function(){var l='nbsp,gt,lt,quot,iexcl,cent,pound,curren,yen,brvbar,sect,uml,copy,ordf,laquo,not,shy,reg,macr,deg,plusmn,sup2,sup3,acute,micro,para,middot,cedil,sup1,ordm,raquo,frac14,frac12,frac34,iquest,times,divide,fnof,bull,hellip,prime,Prime,oline,frasl,weierp,image,real,trade,alefsym,larr,uarr,rarr,darr,harr,crarr,lArr,uArr,rArr,dArr,hArr,forall,part,exist,empty,nabla,isin,notin,ni,prod,sum,minus,lowast,radic,prop,infin,ang,and,or,cap,cup,int,there4,sim,cong,asymp,ne,equiv,le,ge,sub,sup,nsub,sube,supe,oplus,otimes,perp,sdot,lceil,rceil,lfloor,rfloor,lang,rang,loz,spades,clubs,hearts,diams,circ,tilde,ensp,emsp,thinsp,zwnj,zwj,lrm,rlm,ndash,mdash,lsquo,rsquo,sbquo,ldquo,rdquo,bdquo,dagger,Dagger,permil,lsaquo,rsaquo,euro',m='Agrave,Aacute,Acirc,Atilde,Auml,Aring,AElig,Ccedil,Egrave,Eacute,Ecirc,Euml,Igrave,Iacute,Icirc,Iuml,ETH,Ntilde,Ograve,Oacute,Ocirc,Otilde,Ouml,Oslash,Ugrave,Uacute,Ucirc,Uuml,Yacute,THORN,szlig,agrave,aacute,acirc,atilde,auml,aring,aelig,ccedil,egrave,eacute,ecirc,euml,igrave,iacute,icirc,iuml,eth,ntilde,ograve,oacute,ocirc,otilde,ouml,oslash,ugrave,uacute,ucirc,uuml,yacute,thorn,yuml,OElig,oelig,Scaron,scaron,Yuml',n='Alpha,Beta,Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda,Mu,Nu,Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,Omega,alpha,beta,gamma,delta,epsilon,zeta,eta,theta,iota,kappa,lambda,mu,nu,xi,omicron,pi,rho,sigmaf,sigma,tau,upsilon,phi,chi,psi,omega,thetasym,upsih,piv';function o(p){var q={},r=[],s={nbsp:'\xa0',shy:'­',gt:'>',lt:'<'};p=p.replace(/\b(nbsp|shy|gt|lt|amp)(?:,|$)/g,function(x,y){q[s[y]]='&'+y+';';r.push(s[y]);return '';});p=p.split(',');var t=document.createElement('div'),u;t.innerHTML='&'+p.join(';&')+';';u=t.innerHTML;t=null;for(var v=0;v<u.length;v++){var w=u.charAt(v);q[w]='&'+p[v]+';';r.push(w);}q.regex=r.join('');
-return q;};j.add('entities',{afterInit:function(p){var q=p.config;if(!q.entities)return;var r=p.dataProcessor,s=r&&r.htmlFilter;if(s){var t=l;if(q.entities_latin)t+=','+m;if(q.entities_greek)t+=','+n;if(q.entities_additional)t+=','+q.entities_additional;var u=o(t),v='['+u.regex+']';delete u.regex;if(q.entities_processNumerical)v='[^ -~]|'+v;v=new RegExp(v,'g');function w(x){return u[x]||'&#'+x.charCodeAt(0)+';';};s.addRules({text:function(x){return x.replace(v,w);}});}}});})();i.entities=true;i.entities_latin=true;i.entities_greek=true;i.entities_processNumerical=false;i.entities_additional='#39';(function(){function l(u,v){var w=[];if(!v)return u;else for(var x in v)w.push(x+'='+encodeURIComponent(v[x]));return u+(u.indexOf('?')!=-1?'&':'?')+w.join('&');};function m(u){u+='';var v=u.charAt(0).toUpperCase();return v+u.substr(1);};function n(u){var B=this;var v=B.getDialog(),w=v.getParentEditor();w._.filebrowserSe=B;var x=w.config['filebrowser'+m(v.getName())+'WindowWidth']||w.config.filebrowserWindowWidth||'80%',y=w.config['filebrowser'+m(v.getName())+'WindowHeight']||w.config.filebrowserWindowHeight||'70%',z=B.filebrowser.params||{};z.CKEditor=w.name;z.CKEditorFuncNum=w._.filebrowserFn;if(!z.langCode)z.langCode=w.langCode;var A=l(B.filebrowser.url,z);w.popup(A,x,y);};function o(u){var x=this;var v=x.getDialog(),w=v.getParentEditor();w._.filebrowserSe=x;if(!v.getContentElement(x['for'][0],x['for'][1]).getInputElement().$.value)return false;if(!v.getContentElement(x['for'][0],x['for'][1]).getAction())return false;return true;};function p(u,v,w){var x=w.params||{};x.CKEditor=u.name;x.CKEditorFuncNum=u._.filebrowserFn;if(!x.langCode)x.langCode=u.langCode;v.action=l(w.url,x);v.filebrowser=w;};function q(u,v,w,x){var y,z;for(var A in x){y=x[A];if(y.type=='hbox'||y.type=='vbox')q(u,v,w,y.children);if(!y.filebrowser)continue;if(typeof y.filebrowser=='string'){var B={action:y.type=='fileButton'?'QuickUpload':'Browse',target:y.filebrowser};y.filebrowser=B;}if(y.filebrowser.action=='Browse'){var C=y.filebrowser.url||u.config['filebrowser'+m(v)+'BrowseUrl']||u.config.filebrowserBrowseUrl;if(C){y.onClick=n;y.filebrowser.url=C;y.hidden=false;}}else if(y.filebrowser.action=='QuickUpload'&&y['for']){C=y.filebrowser.url||u.config['filebrowser'+m(v)+'UploadUrl']||u.config.filebrowserUploadUrl;if(C){var D=y.onClick;y.onClick=function(E){var F=E.sender;if(D&&D.call(F,E)===false)return false;return o.call(F,E);};y.filebrowser.url=C;y.hidden=false;p(u,w.getContents(y['for'][0]).get(y['for'][1]),y.filebrowser);
-}}}};function r(u,v){var w=v.getDialog(),x=v.filebrowser.target||null;u=u.replace(/#/g,'%23');if(x){var y=x.split(':'),z=w.getContentElement(y[0],y[1]);if(z){z.setValue(u);w.selectPage(y[0]);}}};function s(u,v,w){if(w.indexOf(';')!==-1){var x=w.split(';');for(var y=0;y<x.length;y++){if(s(u,v,x[y]))return true;}return false;}var z=u.getContents(v).get(w).filebrowser;return z&&z.url;};function t(u,v){var z=this;var w=z._.filebrowserSe.getDialog(),x=z._.filebrowserSe['for'],y=z._.filebrowserSe.filebrowser.onSelect;if(x)w.getContentElement(x[0],x[1]).reset();if(typeof v=='function'&&v.call(z._.filebrowserSe)===false)return;if(y&&y.call(z._.filebrowserSe,u,v)===false)return;if(typeof v=='string'&&v)alert(v);if(u)r(u,z._.filebrowserSe);};j.add('filebrowser',{init:function(u,v){u._.filebrowserFn=e.addFunction(t,u);}});a.on('dialogDefinition',function(u){var v=u.data.definition,w;for(var x in v.contents){w=v.contents[x];q(u.editor,u.data.name,v,w.elements);if(w.hidden&&w.filebrowser)w.hidden=!s(v,w.id,w.filebrowser);}});})();j.add('find',{init:function(l){var m=j.find;l.ui.addButton('Find',{label:l.lang.findAndReplace.find,command:'find'});var n=l.addCommand('find',new a.dialogCommand('find'));n.canUndo=false;l.ui.addButton('Replace',{label:l.lang.findAndReplace.replace,command:'replace'});var o=l.addCommand('replace',new a.dialogCommand('replace'));o.canUndo=false;a.dialog.add('find',this.path+'dialogs/find.js');a.dialog.add('replace',this.path+'dialogs/find.js');},requires:['styles']});i.find_highlight={element:'span',styles:{'background-color':'#004',color:'#fff'}};(function(){var l=/\.swf(?:$|\?)/i,m=/^\d+(?:\.\d+)?$/;function n(q){if(m.test(q))return q+'px';return q;};function o(q){var r=q.attributes;return r.type=='application/x-shockwave-flash'||l.test(r.src||'');};function p(q,r){var s=q.createFakeParserElement(r,'cke_flash','flash',true),t=s.attributes.style||'',u=r.attributes.width,v=r.attributes.height;if(typeof u!='undefined')t=s.attributes.style=t+'width:'+n(u)+';';if(typeof v!='undefined')t=s.attributes.style=t+'height:'+n(v)+';';return s;};j.add('flash',{init:function(q){q.addCommand('flash',new a.dialogCommand('flash'));q.ui.addButton('Flash',{label:q.lang.common.flash,command:'flash'});a.dialog.add('flash',this.path+'dialogs/flash.js');q.addCss('img.cke_flash{background-image: url('+a.getUrl(this.path+'images/placeholder.png')+');'+'background-position: center center;'+'background-repeat: no-repeat;'+'border: 1px solid #a9a9a9;'+'width: 80px;'+'height: 80px;'+'}');
-if(q.addMenuItems)q.addMenuItems({flash:{label:q.lang.flash.properties,command:'flash',group:'flash'}});q.on('doubleclick',function(r){var s=r.data.element;if(s.is('img')&&s.getAttribute('_cke_real_element_type')=='flash')r.data.dialog='flash';});if(q.contextMenu)q.contextMenu.addListener(function(r,s){if(r&&r.is('img')&&r.getAttribute('_cke_real_element_type')=='flash')return{flash:2};});},afterInit:function(q){var r=q.dataProcessor,s=r&&r.dataFilter;if(s)s.addRules({elements:{'cke:object':function(t){var u=t.attributes,v=u.classid&&String(u.classid).toLowerCase();if(!v){for(var w=0;w<t.children.length;w++){if(t.children[w].name=='cke:embed'){if(!o(t.children[w]))return null;return p(q,t);}}return null;}return p(q,t);},'cke:embed':function(t){if(!o(t))return null;return p(q,t);}}},5);},requires:['fakeobjects']});})();e.extend(i,{flashEmbedTagOnly:false,flashAddEmbedTag:true,flashConvertOnEdit:false});(function(){function l(m,n,o,p,q,r,s){var t=m.config,u=q.split(';'),v=[],w={};for(var x=0;x<u.length;x++){var y=u[x];if(y){y=y.split('/');var z={},A=u[x]=y[0];z[o]=v[x]=y[1]||A;w[A]=new a.style(s,z);w[A]._.definition.name=A;}else u.splice(x--,1);}m.ui.addRichCombo(n,{label:p.label,title:p.panelTitle,className:'cke_'+(o=='size'?'fontSize':'font'),panel:{css:m.skin.editor.css.concat(t.contentsCss),multiSelect:false,attributes:{'aria-label':p.panelTitle}},init:function(){this.startGroup(p.panelTitle);for(var B=0;B<u.length;B++){var C=u[B];this.add(C,w[C].buildPreview(),C);}},onClick:function(B){m.focus();m.fire('saveSnapshot');var C=w[B];if(this.getValue()==B)C.remove(m.document);else C.apply(m.document);m.fire('saveSnapshot');},onRender:function(){m.on('selectionChange',function(B){var C=this.getValue(),D=B.data.path,E=D.elements;for(var F=0,G;F<E.length;F++){G=E[F];for(var H in w){if(w[H].checkElementRemovable(G,true)){if(H!=C)this.setValue(H);return;}}}this.setValue('',r);},this);}});};j.add('font',{requires:['richcombo','styles'],init:function(m){var n=m.config;l(m,'Font','family',m.lang.font,n.font_names,n.font_defaultLabel,n.font_style);l(m,'FontSize','size',m.lang.fontSize,n.fontSize_sizes,n.fontSize_defaultLabel,n.fontSize_style);}});})();i.font_names='Arial/Arial, Helvetica, sans-serif;Comic Sans MS/Comic Sans MS, cursive;Courier New/Courier New, Courier, monospace;Georgia/Georgia, serif;Lucida Sans Unicode/Lucida Sans Unicode, Lucida Grande, sans-serif;Tahoma/Tahoma, Geneva, sans-serif;Times New Roman/Times New Roman, Times, serif;Trebuchet MS/Trebuchet MS, Helvetica, sans-serif;Verdana/Verdana, Geneva, sans-serif';
-i.font_defaultLabel='';i.font_style={element:'span',styles:{'font-family':'#(family)'},overrides:[{element:'font',attributes:{face:null}}]};i.fontSize_sizes='8/8px;9/9px;10/10px;11/11px;12/12px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px';i.fontSize_defaultLabel='';i.fontSize_style={element:'span',styles:{'font-size':'#(size)'},overrides:[{element:'font',attributes:{size:null}}]};j.add('format',{requires:['richcombo','styles'],init:function(l){var m=l.config,n=l.lang.format,o=m.format_tags.split(';'),p={};for(var q=0;q<o.length;q++){var r=o[q];p[r]=new a.style(m['format_'+r]);p[r]._.enterMode=l.config.enterMode;}l.ui.addRichCombo('Format',{label:n.label,title:n.panelTitle,className:'cke_format',panel:{css:l.skin.editor.css.concat(m.contentsCss),multiSelect:false,attributes:{'aria-label':n.panelTitle}},init:function(){this.startGroup(n.panelTitle);for(var s in p){var t=n['tag_'+s];this.add(s,'<'+s+'>'+t+'</'+s+'>',t);}},onClick:function(s){l.focus();l.fire('saveSnapshot');p[s].apply(l.document);setTimeout(function(){l.fire('saveSnapshot');},0);},onRender:function(){l.on('selectionChange',function(s){var t=this.getValue(),u=s.data.path;for(var v in p){if(p[v].checkActive(u)){if(v!=t)this.setValue(v,l.lang.format['tag_'+v]);return;}}this.setValue('');},this);}});}});i.format_tags='p;h1;h2;h3;h4;h5;h6;pre;address;div';i.format_p={element:'p'};i.format_div={element:'div'};i.format_pre={element:'pre'};i.format_address={element:'address'};i.format_h1={element:'h1'};i.format_h2={element:'h2'};i.format_h3={element:'h3'};i.format_h4={element:'h4'};i.format_h5={element:'h5'};i.format_h6={element:'h6'};j.add('forms',{init:function(l){var m=l.lang;l.addCss('form{border: 1px dotted #FF0000;padding: 2px;}\n');l.addCss('img.cke_hidden{background-image: url('+a.getUrl(this.path+'images/hiddenfield.gif')+');'+'background-position: center center;'+'background-repeat: no-repeat;'+'border: 1px solid #a9a9a9;'+'width: 16px;'+'height: 16px;'+'}');var n=function(p,q,r){l.addCommand(q,new a.dialogCommand(q));l.ui.addButton(p,{label:m.common[p.charAt(0).toLowerCase()+p.slice(1)],command:q});a.dialog.add(q,r);},o=this.path+'dialogs/';n('Form','form',o+'form.js');n('Checkbox','checkbox',o+'checkbox.js');n('Radio','radio',o+'radio.js');n('TextField','textfield',o+'textfield.js');n('Textarea','textarea',o+'textarea.js');n('Select','select',o+'select.js');n('Button','button',o+'button.js');n('ImageButton','imagebutton',j.getPath('image')+'dialogs/image.js');
-n('HiddenField','hiddenfield',o+'hiddenfield.js');if(l.addMenuItems)l.addMenuItems({form:{label:m.form.menu,command:'form',group:'form'},checkbox:{label:m.checkboxAndRadio.checkboxTitle,command:'checkbox',group:'checkbox'},radio:{label:m.checkboxAndRadio.radioTitle,command:'radio',group:'radio'},textfield:{label:m.textfield.title,command:'textfield',group:'textfield'},hiddenfield:{label:m.hidden.title,command:'hiddenfield',group:'hiddenfield'},imagebutton:{label:m.image.titleButton,command:'imagebutton',group:'imagebutton'},button:{label:m.button.title,command:'button',group:'button'},select:{label:m.select.title,command:'select',group:'select'},textarea:{label:m.textarea.title,command:'textarea',group:'textarea'}});if(l.contextMenu){l.contextMenu.addListener(function(p){if(p&&p.hasAscendant('form',true))return{form:2};});l.contextMenu.addListener(function(p){if(p){var q=p.getName();if(q=='select')return{select:2};if(q=='textarea')return{textarea:2};if(q=='input'){var r=p.getAttribute('type');if(r=='text'||r=='password')return{textfield:2};if(r=='button'||r=='submit'||r=='reset')return{button:2};if(r=='checkbox')return{checkbox:2};if(r=='radio')return{radio:2};if(r=='image')return{imagebutton:2};}if(q=='img'&&p.getAttribute('_cke_real_element_type')=='hiddenfield')return{hiddenfield:2};}});}l.on('doubleclick',function(p){var q=p.data.element;if(q.is('form'))p.data.dialog='form';else if(q.is('select'))p.data.dialog='select';else if(q.is('textarea'))p.data.dialog='textarea';else if(q.is('img')&&q.getAttribute('_cke_real_element_type')=='hiddenfield')p.data.dialog='hiddenfield';else if(q.is('input')){var r=q.getAttribute('type');switch(r){case 'text':case 'password':p.data.dialog='textfield';break;case 'button':case 'submit':case 'reset':p.data.dialog='button';break;case 'checkbox':p.data.dialog='checkbox';break;case 'radio':p.data.dialog='radio';break;case 'image':p.data.dialog='imagebutton';break;}}});},afterInit:function(l){var m=l.dataProcessor,n=m&&m.htmlFilter,o=m&&m.dataFilter;if(c)n&&n.addRules({elements:{input:function(p){var q=p.attributes,r=q.type;if(r=='checkbox'||r=='radio')q.value=='on'&&delete q.value;}}});if(o)o.addRules({elements:{input:function(p){if(p.attributes.type=='hidden')return l.createFakeParserElement(p,'cke_hidden','hiddenfield');}}});},requires:['image','fakeobjects']});if(c)h.prototype.hasAttribute=function(l){var o=this;var m=o.$.attributes.getNamedItem(l);if(o.getName()=='input')switch(l){case 'class':return o.$.className.length>0;
-case 'checked':return!!o.$.checked;case 'value':var n=o.getAttribute('type');if(n=='checkbox'||n=='radio')return o.$.value!='on';break;default:}return!!(m&&m.specified);};(function(){var l={canUndo:false,exec:function(n){n.insertElement(n.document.createElement('hr'));}},m='horizontalrule';j.add(m,{init:function(n){n.addCommand(m,l);n.ui.addButton('HorizontalRule',{label:n.lang.horizontalrule,command:m});}});})();(function(){var l=/^[\t\r\n ]*(?: |\xa0)$/,m='{cke_protected}';function n(Q){var R=Q.children.length,S=Q.children[R-1];while(S&&S.type==3&&!e.trim(S.value))S=Q.children[--R];return S;};function o(Q,R){var S=Q.children,T=n(Q);if(T){if((R||!c)&&T.type==1&&T.name=='br')S.pop();if(T.type==3&&l.test(T.value))S.pop();}};function p(Q){var R=n(Q);return!R||R.type==1&&R.name=='br'||Q.name=='form'&&R.name=='input';};function q(Q){o(Q,true);if(p(Q))if(c)Q.add(new a.htmlParser.text('\xa0'));else Q.add(new a.htmlParser.element('br',{}));};function r(Q){o(Q);if(p(Q))Q.add(new a.htmlParser.text('\xa0'));};var s=f,t=e.extend({},s.$block,s.$listItem,s.$tableContent);for(var u in t){if(!('br' in s[u]))delete t[u];}delete t.pre;var v={elements:{},attributeNames:[[/^on/,'_cke_pa_on']]},w={elements:{}};for(u in t)w.elements[u]=q;var x={elementNames:[[/^cke:/,''],[/^\?xml:namespace$/,'']],attributeNames:[[/^_cke_(saved|pa)_/,''],[/^_cke.*/,''],['hidefocus','']],elements:{$:function(Q){var R=Q.attributes;if(R){if(R.cke_temp)return false;var S=['name','href','src'],T;for(var U=0;U<S.length;U++){T='_cke_saved_'+S[U];T in R&&delete R[S[U]];}}return Q;},embed:function(Q){var R=Q.parent;if(R&&R.name=='object'){var S=R.attributes.width,T=R.attributes.height;S&&(Q.attributes.width=S);T&&(Q.attributes.height=T);}},param:function(Q){Q.children=[];Q.isEmpty=true;return Q;},a:function(Q){if(!(Q.children.length||Q.attributes.name||Q.attributes._cke_saved_name))return false;},html:function(Q){delete Q.attributes.contenteditable;delete Q.attributes['class'];},body:function(Q){delete Q.attributes.spellcheck;delete Q.attributes.contenteditable;},style:function(Q){var R=Q.children[0];R&&R.value&&(R.value=e.trim(R.value));if(!Q.attributes.type)Q.attributes.type='text/css';},title:function(Q){Q.children[0].value=Q.attributes._cke_title;}},attributes:{'class':function(Q,R){return e.ltrim(Q.replace(/(?:^|\s+)cke_[^\s]*/g,''))||false;}},comment:function(Q){if(Q.substr(0,m.length)==m){if(Q.substr(m.length,3)=='{C}')Q=Q.substr(m.length+3);else Q=Q.substr(m.length);return new a.htmlParser.cdata(decodeURIComponent(Q));
-}return Q;}},y={elements:{}};for(u in t)y.elements[u]=r;if(c)x.attributes.style=function(Q,R){return Q.toLowerCase();};function z(Q){Q.attributes.contenteditable='false';};function A(Q){delete Q.attributes.contenteditable;};for(u in {input:1,textarea:1}){v.elements[u]=z;x.elements[u]=A;}var B=/<(?:a|area|img|input)[\s\S]*?\s((?:href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))/gi,C=/(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,D=/<cke:encoded>([^<]*)<\/cke:encoded>/gi,E=/(<\/?)((?:object|embed|param|html|body|head|title)[^>]*>)/gi,F=/(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,G=/<cke:(param|embed)([^>]*?)\/?>(?!\s*<\/cke:\1)/gi;function H(Q){return Q.replace(B,'$& _cke_saved_$1');};function I(Q){return Q.replace(C,function(R){return '<cke:encoded>'+encodeURIComponent(R)+'</cke:encoded>';});};function J(Q){return Q.replace(D,function(R,S){return decodeURIComponent(S);});};function K(Q){return Q.replace(E,'$1cke:$2');};function L(Q){return Q.replace(F,'$1$2');};function M(Q){return Q.replace(G,'<cke:$1$2></cke:$1>');};function N(Q){return Q.replace(/<!--(?!{cke_protected})[\s\S]+?-->/g,function(R){return '<!--'+m+'{C}'+encodeURIComponent(R).replace(/--/g,'%2D%2D')+'-->';});};function O(Q){return Q.replace(/<!--\{cke_protected\}\{C\}([\s\S]+?)-->/g,function(R,S){return decodeURIComponent(S);});};function P(Q,R){var S=[],T=/<\!--\{cke_temp(comment)?\}(\d*?)-->/g,U=[/<script[\s\S]*?<\/script>/gi,/<noscript[\s\S]*?<\/noscript>/gi].concat(R);Q=Q.replace(/<!--[\s\S]*?-->/g,function(W){return '<!--{cke_tempcomment}'+(S.push(W)-1)+'-->';});for(var V=0;V<U.length;V++)Q=Q.replace(U[V],function(W){W=W.replace(T,function(X,Y,Z){return S[Z];});return '<!--{cke_temp}'+(S.push(W)-1)+'-->';});Q=Q.replace(T,function(W,X,Y){return '<!--'+m+(X?'{C}':'')+encodeURIComponent(S[Y]).replace(/--/g,'%2D%2D')+'-->';});return Q;};j.add('htmldataprocessor',{requires:['htmlwriter'],init:function(Q){var R=Q.dataProcessor=new a.htmlDataProcessor(Q);R.writer.forceSimpleAmpersand=Q.config.forceSimpleAmpersand;R.dataFilter.addRules(v);R.dataFilter.addRules(w);R.htmlFilter.addRules(x);R.htmlFilter.addRules(y);}});a.htmlDataProcessor=function(Q){var R=this;R.editor=Q;R.writer=new a.htmlWriter();R.dataFilter=new a.htmlParser.filter();R.htmlFilter=new a.htmlParser.filter();};a.htmlDataProcessor.prototype={toHtml:function(Q,R){Q=P(Q,this.editor.config.protectedSource);Q=H(Q);Q=I(Q);Q=K(Q);Q=M(Q);var S=new h('div');S.setHtml('a'+Q);Q=S.getHtml().substr(1);
-Q=L(Q);Q=J(Q);Q=O(Q);var T=a.htmlParser.fragment.fromHtml(Q,R),U=new a.htmlParser.basicWriter();T.writeHtml(U,this.dataFilter);Q=U.getHtml(true);Q=N(Q);return Q;},toDataFormat:function(Q,R){var S=this.writer,T=a.htmlParser.fragment.fromHtml(Q,R);S.reset();T.writeHtml(S,this.htmlFilter);return S.getHtml(true);}};})();i.forceSimpleAmpersand=false;j.add('image',{init:function(l){var m='image';a.dialog.add(m,this.path+'dialogs/image.js');l.addCommand(m,new a.dialogCommand(m));l.ui.addButton('Image',{label:l.lang.common.image,command:m});l.on('doubleclick',function(n){var o=n.data.element;if(o.is('img')&&!o.getAttribute('_cke_realelement'))n.data.dialog='image';});if(l.addMenuItems)l.addMenuItems({image:{label:l.lang.image.menu,command:'image',group:'image'}});if(l.contextMenu)l.contextMenu.addListener(function(n,o){if(!n||!n.is('img')||n.getAttribute('_cke_realelement'))return null;return{image:2};});}});i.image_removeLinkByEmptyURL=true;(function(){var l={ol:1,ul:1},m=d.walker.whitespaces(true),n=d.walker.bookmark(false,true);function o(v,w){v.getCommand(this.name).setState(w);};function p(v){var E=this;var w=v.editor,x=v.data.path,y=x&&x.contains(l);if(y)return o.call(E,w,2);if(!E.useIndentClasses&&E.name=='indent')return o.call(E,w,2);var z=v.data.path,A=z.block||z.blockLimit;if(!A)return o.call(E,w,0);if(E.useIndentClasses){var B=A.$.className.match(E.classNameRegex),C=0;if(B){B=B[1];C=E.indentClassMap[B];}if(E.name=='outdent'&&!C||E.name=='indent'&&C==w.config.indentClasses.length)return o.call(E,w,0);return o.call(E,w,2);}else{var D=parseInt(A.getStyle(E.indentCssProperty),10);if(isNaN(D))D=0;if(D<=0)return o.call(E,w,0);return o.call(E,w,2);}};function q(v,w,x){var y=w.startContainer,z=w.endContainer;while(y&&!y.getParent().equals(x))y=y.getParent();while(z&&!z.getParent().equals(x))z=z.getParent();if(!y||!z)return;var A=y,B=[],C=false;while(!C){if(A.equals(z))C=true;B.push(A);A=A.getNext();}if(B.length<1)return;var D=x.getParents(true);for(var E=0;E<D.length;E++){if(D[E].getName&&l[D[E].getName()]){x=D[E];break;}}var F=this.name=='indent'?1:-1,G=B[0],H=B[B.length-1],I={},J=j.list.listToArray(x,I),K=J[H.getCustomData('listarray_index')].indent;for(E=G.getCustomData('listarray_index');E<=H.getCustomData('listarray_index');E++){J[E].indent+=F;var L=J[E].parent;J[E].parent=new h(L.getName(),L.getDocument());}for(E=H.getCustomData('listarray_index')+1;E<J.length&&J[E].indent>K;E++)J[E].indent+=F;var M=j.list.arrayToList(J,I,null,v.config.enterMode,0);if(this.name=='outdent'){var N;
-if((N=x.getParent())&&N.is('li')){var O=M.listNode.getChildren(),P=[],Q=O.count(),R;for(E=Q-1;E>=0;E--){if((R=O.getItem(E))&&R.is&&R.is('li'))P.push(R);}}}if(M)M.listNode.replace(x);if(P&&P.length)for(E=0;E<P.length;E++){var S=P[E],T=S;while((T=T.getNext())&&T.is&&T.getName() in l){if(c&&!S.getFirst(function(U){return m(U)&&n(U);}))S.append(w.document.createText('\xa0'));S.append(T);}S.insertAfter(N);}h.clearAllMarkers(I);};function r(v,w){var x=w.createIterator(),y=v.config.enterMode;x.enforceRealBlocks=true;x.enlargeBr=y!=2;var z;while(z=x.getNextParagraph())s.call(this,v,z);};function s(v,w){var B=this;if(B.useIndentClasses){var x=w.$.className.match(B.classNameRegex),y=0;if(x){x=x[1];y=B.indentClassMap[x];}if(B.name=='outdent')y--;else y++;if(y<0)return false;y=Math.min(y,v.config.indentClasses.length);y=Math.max(y,0);var z=e.ltrim(w.$.className.replace(B.classNameRegex,''));if(y<1)w.$.className=z;else w.addClass(v.config.indentClasses[y-1]);}else{var A=parseInt(w.getStyle(B.indentCssProperty),10);if(isNaN(A))A=0;A+=(B.name=='indent'?1:-1)*v.config.indentOffset;if(A<0)return false;A=Math.max(A,0);A=Math.ceil(A/v.config.indentOffset)*v.config.indentOffset;w.setStyle(B.indentCssProperty,A?A+v.config.indentUnit:'');if(w.getAttribute('style')==='')w.removeAttribute('style');}return true;};function t(v,w){var y=this;y.name=w;y.useIndentClasses=v.config.indentClasses&&v.config.indentClasses.length>0;if(y.useIndentClasses){y.classNameRegex=new RegExp('(?:^|\\s+)('+v.config.indentClasses.join('|')+')(?=$|\\s)');y.indentClassMap={};for(var x=0;x<v.config.indentClasses.length;x++)y.indentClassMap[v.config.indentClasses[x]]=x+1;}else y.indentCssProperty=v.config.contentsLangDirection=='ltr'?'margin-left':'margin-right';y.startDisabled=w=='outdent';};function u(v){return v.type=1&&v.is('li');};t.prototype={exec:function(v){var w=v.getSelection(),x=w&&w.getRanges()[0],y=x.startContainer,z=x.endContainer,A=x.getCommonAncestor(),B=A;while(B&&!(B.type==1&&l[B.getName()]))B=B.getParent();if(B&&y.type==1&&y.getName() in l){var C=new d.walker(x);C.evaluator=u;x.startContainer=C.next();}if(B&&z.type==1&&z.getName() in l){C=new d.walker(x);C.evaluator=u;x.endContainer=C.previous();}var D=w.createBookmarks(true);if(B){var E=B.getFirst(function(H){return H.type==1&&H.is('li');}),F=x.startContainer,G=E.equals(F)||E.contains(F);if(!(G&&s.call(this,v,B)))q.call(this,v,x,B);}else r.call(this,v,x);v.focus();v.forceNextSelectionCheck();w.selectBookmarks(D);}};j.add('indent',{init:function(v){var w=new t(v,'indent'),x=new t(v,'outdent');
-v.addCommand('indent',w);v.addCommand('outdent',x);v.ui.addButton('Indent',{label:v.lang.indent,command:'indent'});v.ui.addButton('Outdent',{label:v.lang.outdent,command:'outdent'});v.on('selectionChange',e.bind(p,w));v.on('selectionChange',e.bind(p,x));if(b.ie6Compat||b.ie7Compat)v.addCss('ul,ol{\tmargin-left: 0px;\tpadding-left: 40px;}');},requires:['domiterator','list']});})();e.extend(i,{indentOffset:40,indentUnit:'px',indentClasses:null});(function(){var l=/(-moz-|-webkit-|start|auto)/i;function m(p,q){var r=q.block||q.blockLimit;if(!r||r.getName()=='body')return 2;var s=r.getComputedStyle('text-align').replace(l,'');if(!s&&this.isDefaultAlign||s==this.value)return 1;return 2;};function n(p){var q=p.editor.getCommand(this.name);q.state=m.call(this,p.editor,p.data.path);q.fire('state');};function o(p,q,r){var u=this;u.name=q;u.value=r;var s=p.config.contentsLangDirection;u.isDefaultAlign=r=='left'&&s=='ltr'||r=='right'&&s=='rtl';var t=p.config.justifyClasses;if(t){switch(r){case 'left':u.cssClassName=t[0];break;case 'center':u.cssClassName=t[1];break;case 'right':u.cssClassName=t[2];break;case 'justify':u.cssClassName=t[3];break;}u.cssClassRegex=new RegExp('(?:^|\\s+)(?:'+t.join('|')+')(?=$|\\s)');}};o.prototype={exec:function(p){var z=this;var q=p.getSelection(),r=p.config.enterMode;if(!q)return;var s=q.createBookmarks(),t=q.getRanges(),u=z.cssClassName,v,w;for(var x=t.length-1;x>=0;x--){v=t[x].createIterator();v.enlargeBr=r!=2;while(w=v.getNextParagraph()){w.removeAttribute('align');if(u){var y=w.$.className=e.ltrim(w.$.className.replace(z.cssClassRegex,''));if(z.state==2&&!z.isDefaultAlign)w.addClass(u);else if(!y)w.removeAttribute('class');}else if(z.state==2&&!z.isDefaultAlign)w.setStyle('text-align',z.value);else w.removeStyle('text-align');}}p.focus();p.forceNextSelectionCheck();q.selectBookmarks(s);}};j.add('justify',{init:function(p){var q=new o(p,'justifyleft','left'),r=new o(p,'justifycenter','center'),s=new o(p,'justifyright','right'),t=new o(p,'justifyblock','justify');p.addCommand('justifyleft',q);p.addCommand('justifycenter',r);p.addCommand('justifyright',s);p.addCommand('justifyblock',t);p.ui.addButton('JustifyLeft',{label:p.lang.justify.left,command:'justifyleft'});p.ui.addButton('JustifyCenter',{label:p.lang.justify.center,command:'justifycenter'});p.ui.addButton('JustifyRight',{label:p.lang.justify.right,command:'justifyright'});p.ui.addButton('JustifyBlock',{label:p.lang.justify.block,command:'justifyblock'});p.on('selectionChange',e.bind(n,q));
-p.on('selectionChange',e.bind(n,s));p.on('selectionChange',e.bind(n,r));p.on('selectionChange',e.bind(n,t));},requires:['domiterator']});})();e.extend(i,{justifyClasses:null});j.add('keystrokes',{beforeInit:function(l){l.keystrokeHandler=new a.keystrokeHandler(l);l.specialKeys={};},init:function(l){var m=l.config.keystrokes,n=l.config.blockedKeystrokes,o=l.keystrokeHandler.keystrokes,p=l.keystrokeHandler.blockedKeystrokes;for(var q=0;q<m.length;q++)o[m[q][0]]=m[q][1];for(q=0;q<n.length;q++)p[n[q]]=1;}});a.keystrokeHandler=function(l){var m=this;if(l.keystrokeHandler)return l.keystrokeHandler;m.keystrokes={};m.blockedKeystrokes={};m._={editor:l};return m;};(function(){var l,m=function(o){o=o.data;var p=o.getKeystroke(),q=this.keystrokes[p],r=this._.editor;l=r.fire('key',{keyCode:p})===true;if(!l){if(q){var s={from:'keystrokeHandler'};l=r.execCommand(q,s)!==false;}if(!l){var t=r.specialKeys[p];l=t&&t(r)===true;if(!l)l=!!this.blockedKeystrokes[p];}}if(l)o.preventDefault(true);return!l;},n=function(o){if(l){l=false;o.data.preventDefault(true);}};a.keystrokeHandler.prototype={attach:function(o){o.on('keydown',m,this);if(b.opera||b.gecko&&b.mac)o.on('keypress',n,this);}};})();i.blockedKeystrokes=[1000+66,1000+73,1000+85];i.keystrokes=[[4000+121,'toolbarFocus'],[4000+122,'elementsPathFocus'],[2000+121,'contextMenu'],[1000+2000+121,'contextMenu'],[1000+90,'undo'],[1000+89,'redo'],[1000+2000+90,'redo'],[1000+76,'link'],[1000+66,'bold'],[1000+73,'italic'],[1000+85,'underline'],[4000+109,'toolbarCollapse'],[4000+48,'a11yHelp']];j.add('link',{init:function(l){l.addCommand('link',new a.dialogCommand('link'));l.addCommand('anchor',new a.dialogCommand('anchor'));l.addCommand('unlink',new a.unlinkCommand());l.ui.addButton('Link',{label:l.lang.link.toolbar,command:'link'});l.ui.addButton('Unlink',{label:l.lang.unlink,command:'unlink'});l.ui.addButton('Anchor',{label:l.lang.anchor.toolbar,command:'anchor'});a.dialog.add('link',this.path+'dialogs/link.js');a.dialog.add('anchor',this.path+'dialogs/anchor.js');l.addCss('img.cke_anchor{background-image: url('+a.getUrl(this.path+'images/anchor.gif')+');'+'background-position: center center;'+'background-repeat: no-repeat;'+'border: 1px solid #a9a9a9;'+'width: 18px;'+'height: 18px;'+'}\n'+'a.cke_anchor'+'{'+'background-image: url('+a.getUrl(this.path+'images/anchor.gif')+');'+'background-position: 0 center;'+'background-repeat: no-repeat;'+'border: 1px solid #a9a9a9;'+'padding-left: 18px;'+'}');l.on('selectionChange',function(m){var n=l.getCommand('unlink'),o=m.data.path.lastElement.getAscendant('a',true);
-if(o&&o.getName()=='a'&&o.getAttribute('href'))n.setState(2);else n.setState(0);});l.on('doubleclick',function(m){var n=j.link.getSelectedLink(l)||m.data.element;if(n.is('a'))m.data.dialog=n.getAttribute('name')&&!n.getAttribute('href')?'anchor':'link';else if(n.is('img')&&n.getAttribute('_cke_real_element_type')=='anchor')m.data.dialog='anchor';});if(l.addMenuItems)l.addMenuItems({anchor:{label:l.lang.anchor.menu,command:'anchor',group:'anchor'},link:{label:l.lang.link.menu,command:'link',group:'link',order:1},unlink:{label:l.lang.unlink,command:'unlink',group:'link',order:5}});if(l.contextMenu)l.contextMenu.addListener(function(m,n){if(!m)return null;var o=m.is('img')&&m.getAttribute('_cke_real_element_type')=='anchor';if(!o){if(!(m=j.link.getSelectedLink(l)))return null;o=m.getAttribute('name')&&!m.getAttribute('href');}return o?{anchor:2}:{link:2,unlink:2};});},afterInit:function(l){var m=l.dataProcessor,n=m&&m.dataFilter;if(n)n.addRules({elements:{a:function(o){var p=o.attributes;if(p.name&&!p.href)return l.createFakeParserElement(o,'cke_anchor','anchor');}}});},requires:['fakeobjects']});j.link={getSelectedLink:function(l){var m;try{m=l.getSelection().getRanges()[0];}catch(o){return null;}m.shrink(2);var n=m.getCommonAncestor();return n.getAscendant('a',true);}};a.unlinkCommand=function(){};a.unlinkCommand.prototype={exec:function(l){var m=l.getSelection(),n=m.createBookmarks(),o=m.getRanges(),p,q;for(var r=0;r<o.length;r++){p=o[r].getCommonAncestor(true);q=p.getAscendant('a',true);if(!q)continue;o[r].selectNodeContents(q);}m.selectRanges(o);l.document.$.execCommand('unlink',false,null);m.selectBookmarks(n);},startDisabled:true};e.extend(i,{linkShowAdvancedTab:true,linkShowTargetTab:true});(function(){var l={ol:1,ul:1},m=/^[\n\r\t ]*$/;j.list={listToArray:function(B,C,D,E,F){if(!l[B.getName()])return[];if(!E)E=0;if(!D)D=[];for(var G=0,H=B.getChildCount();G<H;G++){var I=B.getChild(G);if(I.$.nodeName.toLowerCase()!='li')continue;var J={parent:B,indent:E,element:I,contents:[]};if(!F){J.grandparent=B.getParent();if(J.grandparent&&J.grandparent.$.nodeName.toLowerCase()=='li')J.grandparent=J.grandparent.getParent();}else J.grandparent=F;if(C)h.setMarker(C,I,'listarray_index',D.length);D.push(J);for(var K=0,L=I.getChildCount(),M;K<L;K++){M=I.getChild(K);if(M.type==1&&l[M.getName()])j.list.listToArray(M,C,D,E+1,J.grandparent);else J.contents.push(M);}}return D;},arrayToList:function(B,C,D,E){if(!D)D=0;if(!B||B.length<D+1)return null;var F=B[D].parent.getDocument(),G=new d.documentFragment(F),H=null,I=D,J=Math.max(B[D].indent,0),K=null,L=E==1?'p':'div';
-for(;;){var M=B[I];if(M.indent==J){if(!H||B[I].parent.getName()!=H.getName()){H=B[I].parent.clone(false,true);G.append(H);}K=H.append(M.element.clone(false,true));for(var N=0;N<M.contents.length;N++)K.append(M.contents[N].clone(true,true));I++;}else if(M.indent==Math.max(J,0)+1){var O=j.list.arrayToList(B,null,I,E);K.append(O.listNode);I=O.nextIndex;}else if(M.indent==-1&&!D&&M.grandparent){K;if(l[M.grandparent.getName()])K=M.element.clone(false,true);else if(E!=2&&M.grandparent.getName()!='td')K=F.createElement(L);else K=new d.documentFragment(F);for(N=0;N<M.contents.length;N++)K.append(M.contents[N].clone(true,true));if(K.type==11&&I!=B.length-1){if(K.getLast()&&K.getLast().type==1&&K.getLast().getAttribute('type')=='_moz')K.getLast().remove();K.appendBogus();}if(K.type==1&&K.getName()==L&&K.$.firstChild){K.trim();var P=K.getFirst();if(P.type==1&&P.isBlockBoundary()){var Q=new d.documentFragment(F);K.moveChildren(Q);K=Q;}}var R=K.$.nodeName.toLowerCase();if(!c&&(R=='div'||R=='p'))K.appendBogus();G.append(K);H=null;I++;}else return null;if(B.length<=I||Math.max(B[I].indent,0)<J)break;}if(C){var S=G.getFirst();while(S){if(S.type==1)h.clearMarkers(C,S);S=S.getNextSourceNode();}}return{listNode:G,nextIndex:I};}};function n(B,C){B.getCommand(this.name).setState(C);};function o(B){var C=B.data.path,D=C.blockLimit,E=C.elements,F;for(var G=0;G<E.length&&(F=E[G])&&!F.equals(D);G++){if(l[E[G].getName()])return n.call(this,B.editor,this.type==E[G].getName()?1:2);}return n.call(this,B.editor,2);};function p(B,C,D,E){var F=j.list.listToArray(C.root,D),G=[];for(var H=0;H<C.contents.length;H++){var I=C.contents[H];I=I.getAscendant('li',true);if(!I||I.getCustomData('list_item_processed'))continue;G.push(I);h.setMarker(D,I,'list_item_processed',true);}var J=C.root.getDocument().createElement(this.type);for(H=0;H<G.length;H++){var K=G[H].getCustomData('listarray_index');F[K].parent=J;}var L=j.list.arrayToList(F,D,null,B.config.enterMode),M,N=L.listNode.getChildCount();for(H=0;H<N&&(M=L.listNode.getChild(H));H++){if(M.getName()==this.type)E.push(M);}L.listNode.replace(C.root);};var q=/^h[1-6]$/;function r(B,C,D){var E=C.contents,F=C.root.getDocument(),G=[];if(E.length==1&&E[0].equals(C.root)){var H=F.createElement('div');E[0].moveChildren&&E[0].moveChildren(H);E[0].append(H);E[0]=H;}var I=C.contents[0].getParent();for(var J=0;J<E.length;J++)I=I.getCommonAncestor(E[J].getParent());for(J=0;J<E.length;J++){var K=E[J],L;while(L=K.getParent()){if(L.equals(I)){G.push(K);break;}K=L;
-}}if(G.length<1)return;var M=G[G.length-1].getNext(),N=F.createElement(this.type);D.push(N);while(G.length){var O=G.shift(),P=F.createElement('li');if(q.test(O.getName()))O.appendTo(P);else{O.copyAttributes(P);O.moveChildren(P);O.remove();}P.appendTo(N);if(!c)P.appendBogus();}if(M)N.insertBefore(M);else N.appendTo(I);};function s(B,C,D){var E=j.list.listToArray(C.root,D),F=[];for(var G=0;G<C.contents.length;G++){var H=C.contents[G];H=H.getAscendant('li',true);if(!H||H.getCustomData('list_item_processed'))continue;F.push(H);h.setMarker(D,H,'list_item_processed',true);}var I=null;for(G=0;G<F.length;G++){var J=F[G].getCustomData('listarray_index');E[J].indent=-1;I=J;}for(G=I+1;G<E.length;G++){if(E[G].indent>E[G-1].indent+1){var K=E[G-1].indent+1-E[G].indent,L=E[G].indent;while(E[G]&&E[G].indent>=L){E[G].indent+=K;G++;}G--;}}var M=j.list.arrayToList(E,D,null,B.config.enterMode),N=M.listNode,O,P;function Q(R){if((O=N[R?'getFirst':'getLast']())&&!(O.is&&O.isBlockBoundary())&&(P=C.root[R?'getPrevious':'getNext'](d.walker.whitespaces(true)))&&!(P.is&&P.isBlockBoundary({br:1})))B.document.createElement('br')[R?'insertBefore':'insertAfter'](O);};Q(true);Q();N.replace(C.root);};function t(B,C){this.name=B;this.type=C;};t.prototype={exec:function(B){B.focus();var C=B.document,D=B.getSelection(),E=D&&D.getRanges();if(!E||E.length<1)return;if(this.state==2){var F=C.getBody();F.trim();if(!F.getFirst()){var G=C.createElement(B.config.enterMode==1?'p':B.config.enterMode==3?'div':'br');G.appendTo(F);E=[new d.range(C)];if(G.is('br')){E[0].setStartBefore(G);E[0].setEndAfter(G);}else E[0].selectNodeContents(G);D.selectRanges(E);}else{var H=E.length==1&&E[0],I=H&&H.getEnclosedNode();if(I&&I.is&&this.type==I.getName())n.call(this,B,1);}}var J=D.createBookmarks(true),K=[],L={};while(E.length>0){H=E.shift();var M=H.getBoundaryNodes(),N=M.startNode,O=M.endNode;if(N.type==1&&N.getName()=='td')H.setStartAt(M.startNode,1);if(O.type==1&&O.getName()=='td')H.setEndAt(M.endNode,2);var P=H.createIterator(),Q;P.forceBrBreak=this.state==2;while(Q=P.getNextParagraph()){var R=new d.elementPath(Q),S=R.elements,T=S.length,U=null,V=false,W=R.blockLimit,X;for(var Y=T-1;Y>=0&&(X=S[Y]);Y--){if(l[X.getName()]&&W.contains(X)){W.removeCustomData('list_group_object');var Z=X.getCustomData('list_group_object');if(Z)Z.contents.push(Q);else{Z={root:X,contents:[Q]};K.push(Z);h.setMarker(L,X,'list_group_object',Z);}V=true;break;}}if(V)continue;var aa=W;if(aa.getCustomData('list_group_object'))aa.getCustomData('list_group_object').contents.push(Q);
-else{Z={root:aa,contents:[Q]};h.setMarker(L,aa,'list_group_object',Z);K.push(Z);}}}var ab=[];while(K.length>0){Z=K.shift();if(this.state==2){if(l[Z.root.getName()])p.call(this,B,Z,L,ab);else r.call(this,B,Z,ab);}else if(this.state==1&&l[Z.root.getName()])s.call(this,B,Z,L);}for(Y=0;Y<ab.length;Y++){U=ab[Y];var ac,ad=this;(ac=function(ae){var af=U[ae?'getPrevious':'getNext'](d.walker.whitespaces(true));if(af&&af.getName&&af.getName()==ad.type){af.remove();af.moveChildren(U,ae?true:false);}})();ac(true);}h.clearAllMarkers(L);D.selectBookmarks(J);B.focus();}};var u=f,v=/[\t\r\n ]*(?: |\xa0)$/;function w(B,C){var D,E=B.children,F=E.length;for(var G=0;G<F;G++){D=E[G];if(D.name&&D.name in C)return G;}return F;};function x(B){return function(C){var D=C.children,E=w(C,u.$list),F=D[E],G=F&&F.previous,H;if(G&&(G.name&&G.name=='br'||G.value&&(H=G.value.match(v)))){var I=G;if(!(H&&H.index)&&I==D[0])D[0]=B||c?new a.htmlParser.text('\xa0'):new a.htmlParser.element('br',{});else if(I.name=='br')D.splice(E-1,1);else I.value=I.value.replace(v,'');}};};var y={elements:{}};for(var z in u.$listItem)y.elements[z]=x();var A={elements:{}};for(z in u.$listItem)A.elements[z]=x(true);j.add('list',{init:function(B){var C=new t('numberedlist','ol'),D=new t('bulletedlist','ul');B.addCommand('numberedlist',C);B.addCommand('bulletedlist',D);B.ui.addButton('NumberedList',{label:B.lang.numberedlist,command:'numberedlist'});B.ui.addButton('BulletedList',{label:B.lang.bulletedlist,command:'bulletedlist'});B.on('selectionChange',e.bind(o,C));B.on('selectionChange',e.bind(o,D));},afterInit:function(B){var C=B.dataProcessor;if(C){C.dataFilter.addRules(y);C.htmlFilter.addRules(A);}},requires:['domiterator']});})();(function(){j.liststyle={init:function(l){l.addCommand('numberedListStyle',new a.dialogCommand('numberedListStyle'));a.dialog.add('numberedListStyle',this.path+'dialogs/liststyle.js');l.addCommand('bulletedListStyle',new a.dialogCommand('bulletedListStyle'));a.dialog.add('bulletedListStyle',this.path+'dialogs/liststyle.js');l.addMenuGroup('list',108);if(l.addMenuItems)l.addMenuItems({numberedlist:{label:l.lang.list.numberedTitle,group:'list',command:'numberedListStyle'},bulletedlist:{label:l.lang.list.bulletedTitle,group:'list',command:'bulletedListStyle'}});if(l.contextMenu)l.contextMenu.addListener(function(m,n){if(!m)return null;if(m.getAscendant('ol'))return{numberedlist:2};if(m.getAscendant('ul'))return{bulletedlist:2};});}};j.add('liststyle',j.liststyle);})();(function(){function l(r){if(!r||r.type!=1||r.getName()!='form')return[];
-var s=[],t=['style','className'];for(var u=0;u<t.length;u++){var v=t[u],w=r.$.elements.namedItem(v);if(w){var x=new h(w);s.push([x,x.nextSibling]);x.remove();}}return s;};function m(r,s){if(!r||r.type!=1||r.getName()!='form')return;if(s.length>0)for(var t=s.length-1;t>=0;t--){var u=s[t][0],v=s[t][1];if(v)u.insertBefore(v);else u.appendTo(r);}};function n(r,s){var t=l(r),u={},v=r.$;if(!s){u['class']=v.className||'';v.className='';}u.inline=v.style.cssText||'';if(!s)v.style.cssText='position: static; overflow: visible';m(t);return u;};function o(r,s){var t=l(r),u=r.$;if('class' in s)u.className=s['class'];if('inline' in s)u.style.cssText=s.inline;m(t);};function p(r){var s=a.instances;for(var t in s){var u=s[t];if(u.mode=='wysiwyg'){var v=u.document.getBody();v.setAttribute('contentEditable',false);v.setAttribute('contentEditable',true);}}if(r.focusManager.hasFocus){r.toolbox.focus();r.focus();}};function q(r){if(!c||b.version>6)return null;var s=h.createFromHtml('<iframe frameborder="0" tabindex="-1" src="javascript:void((function(){document.open();'+(b.isCustomDomain()?"document.domain='"+this.getDocument().$.domain+"';":'')+'document.close();'+'})())"'+' style="display:block;position:absolute;z-index:-1;'+'progid:DXImageTransform.Microsoft.Alpha(opacity=0);'+'"></iframe>');return r.append(s,true);};j.add('maximize',{init:function(r){var s=r.lang,t=a.document,u=t.getWindow(),v,w,x,y;function z(){var B=u.getViewPaneSize();y&&y.setStyles({width:B.width+'px',height:B.height+'px'});r.resize(B.width,B.height,null,true);};var A=2;r.addCommand('maximize',{modes:{wysiwyg:1,source:1},editorFocus:false,exec:function(){var B=r.container.getChild(1),C=r.getThemeSpace('contents');if(r.mode=='wysiwyg'){var D=r.getSelection();v=D&&D.getRanges();w=u.getScrollPosition();}else{var E=r.textarea.$;v=!c&&[E.selectionStart,E.selectionEnd];w=[E.scrollLeft,E.scrollTop];}if(this.state==2){u.on('resize',z);x=u.getScrollPosition();var F=r.container;while(F=F.getParent()){F.setCustomData('maximize_saved_styles',n(F));F.setStyle('z-index',r.config.baseFloatZIndex-1);}C.setCustomData('maximize_saved_styles',n(C,true));B.setCustomData('maximize_saved_styles',n(B,true));if(c)t.$.documentElement.style.overflow=t.getBody().$.style.overflow='hidden';else t.getBody().setStyles({overflow:'hidden',width:'0px',height:'0px'});c?setTimeout(function(){u.$.scrollTo(0,0);},0):u.$.scrollTo(0,0);var G=u.getViewPaneSize();B.setStyle('position','absolute');B.$.offsetLeft;B.setStyles({'z-index':r.config.baseFloatZIndex-1,left:'0px',top:'0px'});
-y=q(B);z();var H=B.getDocumentPosition();B.setStyles({left:-1*H.x+'px',top:-1*H.y+'px'});b.gecko&&p(r);B.addClass('cke_maximized');}else if(this.state==1){u.removeListener('resize',z);var I=[C,B];for(var J=0;J<I.length;J++){o(I[J],I[J].getCustomData('maximize_saved_styles'));I[J].removeCustomData('maximize_saved_styles');}F=r.container;while(F=F.getParent()){o(F,F.getCustomData('maximize_saved_styles'));F.removeCustomData('maximize_saved_styles');}c?setTimeout(function(){u.$.scrollTo(x.x,x.y);},0):u.$.scrollTo(x.x,x.y);B.removeClass('cke_maximized');if(y){y.remove();y=null;}r.fire('resize');}this.toggleState();var K=this.uiItems[0],L=this.state==2?s.maximize:s.minimize,M=r.element.getDocument().getById(K._.id);M.getChild(1).setHtml(L);M.setAttribute('title',L);M.setAttribute('href','javascript:void("'+L+'");');if(r.mode=='wysiwyg'){if(v){b.gecko&&p(r);r.getSelection().selectRanges(v);var N=r.getSelection().getStartElement();N&&N.scrollIntoView(true);}else u.$.scrollTo(w.x,w.y);}else{if(v){E.selectionStart=v[0];E.selectionEnd=v[1];}E.scrollLeft=w[0];E.scrollTop=w[1];}v=w=null;A=this.state;},canUndo:false});r.ui.addButton('Maximize',{label:s.maximize,command:'maximize'});r.on('mode',function(){r.getCommand('maximize').setState(A);},null,null,100);}});})();j.add('newpage',{init:function(l){l.addCommand('newpage',{modes:{wysiwyg:1,source:1},exec:function(m){var n=this;m.setData(m.config.newpage_html,function(){setTimeout(function(){m.fire('afterCommandExec',{name:n.name,command:n});},200);});m.focus();},async:true});l.ui.addButton('NewPage',{label:l.lang.newPage,command:'newpage'});}});i.newpage_html='';j.add('pagebreak',{init:function(l){l.addCommand('pagebreak',j.pagebreakCmd);l.ui.addButton('PageBreak',{label:l.lang.pagebreak,command:'pagebreak'});l.addCss('img.cke_pagebreak{background-image: url('+a.getUrl(this.path+'images/pagebreak.gif')+');'+'background-position: center center;'+'background-repeat: no-repeat;'+'clear: both;'+'display: block;'+'float: none;'+'width:100%;_width:99.9%;'+'border-top: #999999 1px dotted;'+'border-bottom: #999999 1px dotted;'+'height: 5px;'+'page-break-after: always;'+'}');},afterInit:function(l){var m=l.dataProcessor,n=m&&m.dataFilter;if(n)n.addRules({elements:{div:function(o){var p=o.attributes,q=p&&p.style,r=q&&o.children.length==1&&o.children[0],s=r&&r.name=='span'&&r.attributes.style;if(s&&/page-break-after\s*:\s*always/i.test(q)&&/display\s*:\s*none/i.test(s))return l.createFakeParserElement(o,'cke_pagebreak','div');}}});
-},requires:['fakeobjects']});j.pagebreakCmd={exec:function(l){var m=h.createFromHtml('<div style="page-break-after: always;"><span style="display: none;"> </span></div>');m=l.createFakeElement(m,'cke_pagebreak','div');var n=l.getSelection().getRanges();l.fire('saveSnapshot');for(var o,p=0;p<n.length;p++){o=n[p];if(p>0)m=m.clone(true);o.splitBlock('p');o.insertNode(m);if(p==n.length-1){o.moveToPosition(m,4);o.select();}}l.fire('saveSnapshot');}};(function(){j.add('pastefromword',{init:function(l){var m=0,n=function(){setTimeout(function(){m=0;},0);};l.addCommand('pastefromword',{canUndo:false,exec:function(){m=1;if(l.execCommand('paste')===false)l.on('dialogHide',function(o){o.removeListener();n();});else n();}});l.ui.addButton('PasteFromWord',{label:l.lang.pastefromword.toolbar,command:'pastefromword'});l.on('paste',function(o){var p=o.data,q;if((q=p.html)&&(m||/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(q))){var r=this.loadFilterRules(function(){if(r)l.fire('paste',p);else if(!l.config.pasteFromWordPromptCleanup||m||confirm(l.lang.pastefromword.confirmCleanup))p.html=a.cleanWord(q,l);});r&&o.cancel();}},this);},loadFilterRules:function(l){var m=a.cleanWord;if(m)l();else{var n=a.getUrl(i.pasteFromWordCleanupFile||this.path+'filter/default.js');a.scriptLoader.load(n,l,null,false,true);}return!m;}});})();(function(){var l={exec:function(o){var p=e.tryThese(function(){var q=window.clipboardData.getData('Text');if(!q)throw 0;return q;},function(){window.netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');var q=window.Components.classes['@mozilla.org/widget/clipboard;1'].getService(window.Components.interfaces.nsIClipboard),r=window.Components.classes['@mozilla.org/widget/transferable;1'].createInstance(window.Components.interfaces.nsITransferable);r.addDataFlavor('text/unicode');q.getData(r,q.kGlobalClipboard);var s={},t={},u;r.getTransferData('text/unicode',s,t);s=s.value.QueryInterface(window.Components.interfaces.nsISupportsString);u=s.data.substring(0,t.value/2);return u;});if(!p){o.openDialog('pastetext');return false;}else o.fire('paste',{text:p});return true;}};function m(o,p){if(c){var q=o.selection;if(q.type=='Control')q.clear();q.createRange().pasteHTML(p);}else o.execCommand('inserthtml',false,p);};j.add('pastetext',{init:function(o){var p='pastetext',q=o.addCommand(p,l);o.ui.addButton('PasteText',{label:o.lang.pasteText.button,command:p});a.dialog.add(p,a.getUrl(this.path+'dialogs/pastetext.js'));if(o.config.forcePasteAsPlainText)o.on('beforeCommandExec',function(r){if(r.data.name=='paste'){o.execCommand('pastetext');
-r.cancel();}},null,null,0);},requires:['clipboard']});function n(o,p,q,r){while(q--)j.enterkey[p==2?'enterBr':'enterBlock'](o,p,null,r);};a.editor.prototype.insertText=function(o){this.focus();this.fire('saveSnapshot');var p=this.getSelection().getStartElement().hasAscendant('pre',true)?2:this.config.enterMode,q=p==2,r=this.document.$,s=this,t;o=e.htmlEncode(o.replace(/\r\n|\r/g,'\n'));var u=0;o.replace(/\n+/g,function(v,w){t=o.substring(u,w);u=w+v.length;t.length&&m(r,t);var x=v.length,y=q?0:Math.floor(x/2),z=q?x:x%2;n(s,p,y);n(s,2,z,q?false:true);});t=o.substring(u,o.length);t.length&&m(r,t);this.fire('saveSnapshot');};})();j.add('popup');e.extend(a.editor.prototype,{popup:function(l,m,n){m=m||'80%';n=n||'70%';if(typeof m=='string'&&m.length>1&&m.substr(m.length-1,1)=='%')m=parseInt(window.screen.width*parseInt(m,10)/100,10);if(typeof n=='string'&&n.length>1&&n.substr(n.length-1,1)=='%')n=parseInt(window.screen.height*parseInt(n,10)/100,10);if(m<640)m=640;if(n<420)n=420;var o=parseInt((window.screen.height-n)/2,10),p=parseInt((window.screen.width-m)/2,10),q='location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,width='+m+',height='+n+',top='+o+',left='+p,r=window.open('',null,q,true);if(!r)return false;try{r.moveTo(p,o);r.resizeTo(m,n);r.focus();r.location.href=l;}catch(s){r=window.open(l,null,q,true);}return true;}});(function(){var l={modes:{wysiwyg:1,source:1},canUndo:false,exec:function(n){var o,p=n.config,q=p.baseHref?'<base href="'+p.baseHref+'"/>':'',r=b.isCustomDomain();if(p.fullPage)o=n.getData().replace(/<head>/,'$&'+q).replace(/[^>]*(?=<\/title>)/,n.lang.preview);else{var s='<body ',t=n.document&&n.document.getBody();if(t){if(t.getAttribute('id'))s+='id="'+t.getAttribute('id')+'" ';if(t.getAttribute('class'))s+='class="'+t.getAttribute('class')+'" ';}s+='>';o=n.config.docType+'<html dir="'+n.config.contentsLangDirection+'">'+'<head>'+q+'<title>'+n.lang.preview+'</title>'+e.buildStyleHtml(n.config.contentsCss)+'</head>'+s+n.getData()+'</body></html>';}var u=640,v=420,w=80;try{var x=window.screen;u=Math.round(x.width*0.8);v=Math.round(x.height*0.7);w=Math.round(x.width*0.1);}catch(A){}var y='';if(r){window._cke_htmlToLoad=o;y='javascript:void( (function(){document.open();document.domain="'+document.domain+'";'+'document.write( window.opener._cke_htmlToLoad );'+'document.close();'+'window.opener._cke_htmlToLoad = null;'+'})() )';}var z=window.open(y,null,'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+u+',height='+v+',left='+w);
-if(!r){z.document.open();z.document.write(o);z.document.close();}}},m='preview';j.add(m,{init:function(n){n.addCommand(m,l);n.ui.addButton('Preview',{label:n.lang.preview,command:m});}});})();j.add('print',{init:function(l){var m='print',n=l.addCommand(m,j.print);l.ui.addButton('Print',{label:l.lang.print,command:m});}});j.print={exec:function(l){if(b.opera)return;else if(b.gecko)l.window.$.print();else l.document.$.execCommand('Print');},canUndo:false,modes:{wysiwyg:!b.opera}};j.add('removeformat',{requires:['selection'],init:function(l){l.addCommand('removeFormat',j.removeformat.commands.removeformat);l.ui.addButton('RemoveFormat',{label:l.lang.removeFormat,command:'removeFormat'});l._.removeFormat={filters:[]};}});j.removeformat={commands:{removeformat:{exec:function(l){var m=l._.removeFormatRegex||(l._.removeFormatRegex=new RegExp('^(?:'+l.config.removeFormatTags.replace(/,/g,'|')+')$','i')),n=l._.removeAttributes||(l._.removeAttributes=l.config.removeFormatAttributes.split(',')),o=j.removeformat.filter,p=l.getSelection().getRanges();for(var q=0,r;r=p[q];q++){if(r.collapsed)continue;r.enlarge(1);var s=r.createBookmark(),t=s.startNode,u=s.endNode,v=function(y){var z=new d.elementPath(y),A=z.elements;for(var B=1,C;C=A[B];B++){if(C.equals(z.block)||C.equals(z.blockLimit))break;if(m.test(C.getName())&&o(l,C))y.breakParent(C);}};v(t);v(u);var w=t.getNextSourceNode(true,1);while(w){if(w.equals(u))break;var x=w.getNextSourceNode(false,1);if(!(w.getName()=='img'&&w.getAttribute('_cke_realelement'))&&o(l,w))if(m.test(w.getName()))w.remove(true);else w.removeAttributes(n);w=x;}r.moveToBookmark(s);}l.getSelection().selectRanges(p);}}},filter:function(l,m){var n=l._.removeFormat.filters;for(var o=0;o<n.length;o++){if(n[o](m)===false)return false;}return true;}};a.editor.prototype.addRemoveFormatFilter=function(l){this._.removeFormat.filters.push(l);};i.removeFormatTags='b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var';i.removeFormatAttributes='class,style,lang,width,height,align,hspace,valign';j.add('resize',{init:function(l){var m=l.config;if(m.resize_enabled){var n=null,o,p,q=(m.resize_dir=='both'||m.resize_dir=='horizontal')&&m.resize_minWidth!=m.resize_maxWidth,r=(m.resize_dir=='both'||m.resize_dir=='vertical')&&m.resize_minHeight!=m.resize_maxHeight;function s(v){var w=v.data.$.screenX-o.x,x=v.data.$.screenY-o.y,y=p.width,z=p.height,A=y+w*(l.lang.dir=='rtl'?-1:1),B=z+x;if(q)y=Math.max(m.resize_minWidth,Math.min(A,m.resize_maxWidth));
-if(r)z=Math.max(m.resize_minHeight,Math.min(B,m.resize_maxHeight));l.resize(y,z);};function t(v){a.document.removeListener('mousemove',s);a.document.removeListener('mouseup',t);if(l.document){l.document.removeListener('mousemove',s);l.document.removeListener('mouseup',t);}};var u=e.addFunction(function(v){if(!n)n=l.getResizable();p={width:n.$.offsetWidth||0,height:n.$.offsetHeight||0};o={x:v.screenX,y:v.screenY};a.document.on('mousemove',s);a.document.on('mouseup',t);if(l.document){l.document.on('mousemove',s);l.document.on('mouseup',t);}});l.on('destroy',function(){e.removeFunction(u);});l.on('themeSpace',function(v){if(v.data.space=='bottom'){var w='';if(q&&!r)w=' cke_resizer_horizontal';if(!q&&r)w=' cke_resizer_vertical';v.data.html+='<div class="cke_resizer'+w+'"'+' title="'+e.htmlEncode(l.lang.resize)+'"'+' onmousedown="CKEDITOR.tools.callFunction('+u+', event)"'+'></div>';}},l,null,100);}}});i.resize_minWidth=750;i.resize_minHeight=250;i.resize_maxWidth=3000;i.resize_maxHeight=3000;i.resize_enabled=true;i.resize_dir='both';(function(){var l={modes:{wysiwyg:1,source:1},exec:function(n){var o=n.element.$.form;if(o)try{o.submit();}catch(p){if(o.submit.click)o.submit.click();}}},m='save';j.add(m,{init:function(n){var o=n.addCommand(m,l);o.modes={wysiwyg:!!n.element.$.form};n.ui.addButton('Save',{label:n.lang.save,command:m});}});})();(function(){var l='scaytcheck',m='';function n(s,t){var u=false,v;for(v in t){if(t[v]===s||t[v]==s){u=true;break;}}return u;};var o=function(){var s=this,t=function(){var x={};x.srcNodeRef=s.document.getWindow().$.frameElement;x.assocApp='CKEDITOR.'+a.version+'@'+a.revision;x.customerid=s.config.scayt_customerid||'1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2';x.customDictionaryIds=s.config.scayt_customDictionaryIds||'';x.userDictionaryName=s.config.scayt_userDictionaryName||'';x.sLang=s.config.scayt_sLang||'en_US';x.onLoad=function(){if(!(c&&b.version<8))this.addStyle(this.selectorCss(),'padding-bottom: 2px !important;');if(s.focusManager.hasFocus&&!p.isControlRestored(s))this.focus();};x.onBeforeChange=function(){if(p.getScayt(s)&&!s.checkDirty())setTimeout(function(){s.resetDirty();});};var y=window.scayt_custom_params;if(typeof y=='object')for(var z in y)x[z]=y[z];if(p.getControlId(s))x.id=p.getControlId(s);var A=new window.scayt(x);A.afterMarkupRemove.push(function(H){new h(H,A.document).mergeSiblings();});var B=p.instances[s.name];if(B){A.sLang=B.sLang;A.option(B.option());A.paused=B.paused;}p.instances[s.name]=A;
-var C='scaytButton',D=window.scayt.uiTags,E=[];for(var F=0,G=4;F<G;F++)E.push(D[F]&&p.uiTabs[F]);p.uiTabs=E;try{A.setDisabled(p.isPaused(s)===false);}catch(H){}s.fire('showScaytState');};s.on('contentDom',t);s.on('contentDomUnload',function(){var x=a.document.getElementsByTag('script'),y=/^dojoIoScript(\d+)$/i,z=/^https?:\/\/svc\.spellchecker\.net\/spellcheck\/script\/ssrv\.cgi/i;for(var A=0;A<x.count();A++){var B=x.getItem(A),C=B.getId(),D=B.getAttribute('src');if(C&&D&&C.match(y)&&D.match(z))B.remove();}});s.on('beforeCommandExec',function(x){if((x.data.name=='source'||x.data.name=='newpage')&&s.mode=='wysiwyg'){var y=p.getScayt(s);if(y){p.setPaused(s,!y.disabled);p.setControlId(s,y.id);y.destroy(true);delete p.instances[s.name];}}else if(x.data.name=='source'&&s.mode=='source')p.markControlRestore(s);});s.on('afterCommandExec',function(x){if(!p.isScaytEnabled(s))return;if(s.mode=='wysiwyg'&&(x.data.name=='undo'||x.data.name=='redo'))window.setTimeout(function(){p.getScayt(s).refresh();},10);});s.on('destroy',function(x){var y=x.editor,z=p.getScayt(y);if(!z)return;delete p.instances[y.name];p.setControlId(y,z.id);z.destroy(true);});s.on('afterSetData',function(){if(p.isScaytEnabled(s))window.setTimeout(function(){var x=p.getScayt(s);x&&x.refresh();},10);});s.on('insertElement',function(){var x=p.getScayt(s);if(p.isScaytEnabled(s)){if(c)s.getSelection().unlock(true);window.setTimeout(function(){x.focus();x.refresh();},10);}},this,null,50);s.on('insertHtml',function(){var x=p.getScayt(s);if(p.isScaytEnabled(s)){if(c)s.getSelection().unlock(true);window.setTimeout(function(){x.focus();x.refresh();},10);}},this,null,50);s.on('scaytDialog',function(x){x.data.djConfig=window.djConfig;x.data.scayt_control=p.getScayt(s);x.data.tab=m;x.data.scayt=window.scayt;});var u=s.dataProcessor,v=u&&u.htmlFilter;if(v)v.addRules({elements:{span:function(x){if(x.attributes.scayt_word&&x.attributes.scaytid){delete x.name;return x;}}}});var w=j.undo.Image.prototype;w.equals=e.override(w.equals,function(x){return function(y){var D=this;var z=D.contents,A=y.contents,B=p.getScayt(D.editor);if(B&&p.isScaytReady(D.editor)){D.contents=B.reset(z)||'';y.contents=B.reset(A)||'';}var C=x.apply(D,arguments);D.contents=z;y.contents=A;return C;};});if(s.document)t();};j.scayt={engineLoaded:false,instances:{},controlInfo:{},setControlInfo:function(s,t){if(s&&s.name&&typeof this.controlInfo[s.name]!='object')this.controlInfo[s.name]={};for(var u in t)this.controlInfo[s.name][u]=t[u];},isControlRestored:function(s){if(s&&s.name&&this.controlInfo[s.name])return this.controlInfo[s.name].restored;
-return false;},markControlRestore:function(s){this.setControlInfo(s,{restored:true});},setControlId:function(s,t){this.setControlInfo(s,{id:t});},getControlId:function(s){if(s&&s.name&&this.controlInfo[s.name]&&this.controlInfo[s.name].id)return this.controlInfo[s.name].id;return null;},setPaused:function(s,t){this.setControlInfo(s,{paused:t});},isPaused:function(s){if(s&&s.name&&this.controlInfo[s.name])return this.controlInfo[s.name].paused;return undefined;},getScayt:function(s){return this.instances[s.name];},isScaytReady:function(s){return this.engineLoaded===true&&'undefined'!==typeof window.scayt&&this.getScayt(s);},isScaytEnabled:function(s){var t=this.getScayt(s);return t?t.disabled===false:false;},loadEngine:function(s){if(b.gecko&&b.version<10900||b.opera)return s.fire('showScaytState');if(this.engineLoaded===true)return o.apply(s);else if(this.engineLoaded==-1)return a.on('scaytReady',function(){o.apply(s);});a.on('scaytReady',o,s);a.on('scaytReady',function(){this.engineLoaded=true;},this,null,0);this.engineLoaded=-1;var t=document.location.protocol;t=t.search(/https?:/)!=-1?t:'http:';var u='svc.spellchecker.net/spellcheck31/lf/scayt24/loader__base.js',v=s.config.scayt_srcUrl||t+'//'+u,w=p.parseUrl(v).path+'/';if(window.scayt==undefined){a._djScaytConfig={baseUrl:w,addOnLoad:[function(){a.fireOnce('scaytReady');}],isDebug:false};a.document.getHead().append(a.document.createElement('script',{attributes:{type:'text/javascript',async:'true',src:v}}));}else a.fireOnce('scaytReady');return null;},parseUrl:function(s){var t;if(s.match&&(t=s.match(/(.*)[\/\\](.*?\.\w+)$/)))return{path:t[1],file:t[2]};else return s;}};var p=j.scayt,q=function(s,t,u,v,w,x,y){s.addCommand(v,w);s.addMenuItem(v,{label:u,command:v,group:x,order:y});},r={preserveState:true,editorFocus:false,exec:function(s){var t=s.config.scayt_autoStartup;t=t==undefined||t;if(p.isScaytReady(s)){var u=p.isScaytEnabled(s);this.setState(u?2:1);var v=p.getScayt(s);v.focus();v.setDisabled(u);}else if(!t&&p.engineLoaded>=0){this.setState(0);p.loadEngine(s);}}};j.add('scayt',{requires:['menubutton'],beforeInit:function(s){var t=s.config.scayt_contextMenuItemsOrder||'suggest|moresuggest|control',u='';t=t.split('|');if(t&&t.length)for(var v in t)u+='scayt_'+t[v]+(t.length!=parseInt(v,10)+1?',':'');if(s.config.scayt_contextMenuOntop)s.config.menu_groups=u+','+s.config.menu_groups;else s.config.menu_groups=s.config.menu_groups+','+u;},init:function(s){var t={},u={},v=s.addCommand(l,r);a.dialog.add(l,a.getUrl(this.path+'dialogs/options.js'));
-var w=s.config.scayt_uiTabs||'1,1,1',x=[];w=w.split(',');for(var y=0,z=3;y<z;y++){var A=parseInt(w[y]||'1',10);x.push(A);}var B='scaytButton';s.addMenuGroup(B);var C={};C.scaytToggle={label:s.lang.scayt.enable,command:l,group:B};if(x[0]==1)C.scaytOptions={label:s.lang.scayt.options,group:B,onClick:function(){m='options';s.openDialog(l);}};if(x[1]==1)C.scaytLangs={label:s.lang.scayt.langs,group:B,onClick:function(){m='langs';s.openDialog(l);}};if(x[2]==1)C.scaytDict={label:s.lang.scayt.dictionariesTab,group:B,onClick:function(){m='dictionaries';s.openDialog(l);}};C.scaytAbout={label:s.lang.scayt.about,group:B,onClick:function(){m='about';s.openDialog(l);}};x[3]=1;p.uiTabs=x;s.addMenuItems(C);s.ui.add('Scayt',5,{label:s.lang.scayt.title,title:b.opera?s.lang.scayt.opera_title:s.lang.scayt.title,className:'cke_button_scayt',onRender:function(){v.on('state',function(){this.setState(v.state);},this);},onMenu:function(){var F=p.isScaytEnabled(s);s.getMenuItem('scaytToggle').label=s.lang.scayt[F?'disable':'enable'];return{scaytToggle:2,scaytOptions:F&&p.uiTabs[0]?2:0,scaytLangs:F&&p.uiTabs[1]?2:0,scaytDict:F&&p.uiTabs[2]?2:0,scaytAbout:F&&p.uiTabs[3]?2:0};}});if(s.contextMenu&&s.addMenuItems)s.contextMenu.addListener(function(){if(!p.isScaytEnabled(s))return null;var F=p.getScayt(s),G=F.getScaytNode();if(!G)return null;var H=F.getWord(G);if(!H)return null;var I=F.getLang(),J={},K=window.scayt.getSuggestion(H,I);if(!K||!K.length)return null;for(y in t){delete s._.menuItems[y];delete s._.commands[y];}for(y in u){delete s._.menuItems[y];delete s._.commands[y];}t={};u={};var L=s.config.scayt_moreSuggestions||'on',M=false,N=s.config.scayt_maxSuggestions;typeof N!='number'&&(N=5);!N&&(N=K.length);var O=s.config.scayt_contextCommands||'all';O=O.split('|');for(var P=0,Q=K.length;P<Q;P+=1){var R='scayt_suggestion_'+K[P].replace(' ','_'),S=(function(W,X){return{exec:function(){F.replace(W,X);}};})(G,K[P]);if(P<N){q(s,'button_'+R,K[P],R,S,'scayt_suggest',P+1);J[R]=2;u[R]=2;}else if(L=='on'){q(s,'button_'+R,K[P],R,S,'scayt_moresuggest',P+1);t[R]=2;M=true;}}if(M){s.addMenuItem('scayt_moresuggest',{label:s.lang.scayt.moreSuggestions,group:'scayt_moresuggest',order:10,getItems:function(){return t;}});u.scayt_moresuggest=2;}if(n('all',O)||n('ignore',O)){var T={exec:function(){F.ignore(G);}};q(s,'ignore',s.lang.scayt.ignore,'scayt_ignore',T,'scayt_control',1);u.scayt_ignore=2;}if(n('all',O)||n('ignoreall',O)){var U={exec:function(){F.ignoreAll(G);}};q(s,'ignore_all',s.lang.scayt.ignoreAll,'scayt_ignore_all',U,'scayt_control',2);
-u.scayt_ignore_all=2;}if(n('all',O)||n('add',O)){var V={exec:function(){window.scayt.addWordToUserDictionary(G);}};q(s,'add_word',s.lang.scayt.addWord,'scayt_add_word',V,'scayt_control',3);u.scayt_add_word=2;}if(F.fireOnContextMenu)F.fireOnContextMenu(s);return u;});var D=function(){s.removeListener('showScaytState',D);if(!b.opera)v.setState(p.isScaytEnabled(s)?1:2);else v.setState(0);};s.on('showScaytState',D);if(b.opera)s.on('instanceReady',function(){D();});var E=s.config.scayt_autoStartup;if(E==undefined||E)s.on('instanceReady',function(){p.loadEngine(s);});},afterInit:function(s){var t,u=function(v){if(v.hasAttribute('scaytid'))return false;};if(s._.elementsPath&&(t=s._.elementsPath.filters))t.push(u);s.addRemoveFormatFilter&&s.addRemoveFormatFilter(u);}});})();j.add('smiley',{requires:['dialog'],init:function(l){l.config.smiley_path=l.config.smiley_path||this.path+'images/';l.addCommand('smiley',new a.dialogCommand('smiley'));l.ui.addButton('Smiley',{label:l.lang.smiley.toolbar,command:'smiley'});a.dialog.add('smiley',this.path+'dialogs/smiley.js');}});i.smiley_images=['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif','embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif','devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'];i.smiley_descriptions=['smiley','sad','wink','laugh','frown','cheeky','blush','surprise','indecision','angry','angel','cool','devil','crying','enlightened','no','yes','heart','broken heart','kiss','mail'];(function(){var l='.%2 p,.%2 div,.%2 pre,.%2 address,.%2 blockquote,.%2 h1,.%2 h2,.%2 h3,.%2 h4,.%2 h5,.%2 h6{background-repeat: no-repeat;border: 1px dotted gray;padding-top: 8px;padding-left: 8px;}.%2 p{%1p.png);}.%2 div{%1div.png);}.%2 pre{%1pre.png);}.%2 address{%1address.png);}.%2 blockquote{%1blockquote.png);}.%2 h1{%1h1.png);}.%2 h2{%1h2.png);}.%2 h3{%1h3.png);}.%2 h4{%1h4.png);}.%2 h5{%1h5.png);}.%2 h6{%1h6.png);}',m=/%1/g,n=/%2/g,o={preserveState:true,editorFocus:false,exec:function(p){this.toggleState();this.refresh(p);},refresh:function(p){var q=this.state==1?'addClass':'removeClass';p.document.getBody()[q]('cke_show_blocks');}};j.add('showblocks',{requires:['wysiwygarea'],init:function(p){var q=p.addCommand('showblocks',o);q.canUndo=false;if(p.config.startupOutlineBlocks)q.setState(1);p.addCss(l.replace(m,'background-image: url('+a.getUrl(this.path)+'images/block_').replace(n,'cke_show_blocks '));
-p.ui.addButton('ShowBlocks',{label:p.lang.showBlocks,command:'showblocks'});p.on('mode',function(){if(q.state!=0)q.refresh(p);});p.on('contentDom',function(){if(q.state!=0)q.refresh(p);});}});})();i.startupOutlineBlocks=false;(function(){var l='cke_show_border',m,n=(b.ie6Compat?['.%1 table.%2,','.%1 table.%2 td, .%1 table.%2 th,','{','border : #d3d3d3 1px dotted','}']:['.%1 table.%2,','.%1 table.%2 > tr > td, .%1 table.%2 > tr > th,','.%1 table.%2 > tbody > tr > td, .%1 table.%2 > tbody > tr > th,','.%1 table.%2 > thead > tr > td, .%1 table.%2 > thead > tr > th,','.%1 table.%2 > tfoot > tr > td, .%1 table.%2 > tfoot > tr > th','{','border : #d3d3d3 1px dotted','}']).join('');m=n.replace(/%2/g,l).replace(/%1/g,'cke_show_borders ');var o={preserveState:true,editorFocus:false,exec:function(p){this.toggleState();this.refresh(p);},refresh:function(p){var q=this.state==1?'addClass':'removeClass';p.document.getBody()[q]('cke_show_borders');}};j.add('showborders',{requires:['wysiwygarea'],modes:{wysiwyg:1},init:function(p){var q=p.addCommand('showborders',o);q.canUndo=false;if(p.config.startupShowBorders!==false)q.setState(1);p.addCss(m);p.on('mode',function(){if(q.state!=0)q.refresh(p);},null,null,100);p.on('contentDom',function(){if(q.state!=0)q.refresh(p);});},afterInit:function(p){var q=p.dataProcessor,r=q&&q.dataFilter,s=q&&q.htmlFilter;if(r)r.addRules({elements:{table:function(t){var u=t.attributes,v=u['class'],w=parseInt(u.border,10);if(!w||w<=0)u['class']=(v||'')+' '+l;}}});if(s)s.addRules({elements:{table:function(t){var u=t.attributes,v=u['class'];v&&(u['class']=v.replace(l,'').replace(/\s{2}/,' ').replace(/^\s+|\s+$/,''));}}});}});a.on('dialogDefinition',function(p){var q=p.data.name;if(q=='table'||q=='tableProperties'){var r=p.data.definition,s=r.getContents('info'),t=s.get('txtBorder'),u=t.commit;t.commit=e.override(u,function(v){return function(w,x){v.apply(this,arguments);var y=parseInt(this.getValue(),10);x[!y||y<=0?'addClass':'removeClass'](l);};});}});})();j.add('sourcearea',{requires:['editingblock'],init:function(l){var m=j.sourcearea,n=a.document.getWindow();l.on('editingBlockReady',function(){var o,p;l.addMode('source',{load:function(q,r){if(c&&b.version<8)q.setStyle('position','relative');l.textarea=o=new h('textarea');o.setAttributes({dir:'ltr',tabIndex:b.webkit?-1:l.tabIndex,role:'textbox','aria-label':l.lang.editorTitle.replace('%1',l.name)});o.addClass('cke_source');o.addClass('cke_enable_context_menu');var s={width:b.ie7Compat?'99%':'100%',height:'100%',resize:'none',outline:'none','text-align':'left'};
-if(c){p=function(){o.hide();o.setStyle('height',q.$.clientHeight+'px');o.setStyle('width',q.$.clientWidth+'px');o.show();};l.on('resize',p);n.on('resize',p);setTimeout(p,0);}else o.on('mousedown',function(u){u.data.stopPropagation();});q.setHtml('');q.append(o);o.setStyles(s);l.fire('ariaWidget',o);o.on('blur',function(){l.focusManager.blur();});o.on('focus',function(){l.focusManager.focus();});l.mayBeDirty=true;this.loadData(r);var t=l.keystrokeHandler;if(t)t.attach(o);setTimeout(function(){l.mode='source';l.fire('mode');},b.gecko||b.webkit?100:0);},loadData:function(q){o.setValue(q);l.fire('dataReady');},getData:function(){return o.getValue();},getSnapshotData:function(){return o.getValue();},unload:function(q){o.clearCustomData();l.textarea=o=null;if(p){l.removeListener('resize',p);n.removeListener('resize',p);}if(c&&b.version<8)q.removeStyle('position');},focus:function(){o.focus();}});});l.addCommand('source',m.commands.source);if(l.ui.addButton)l.ui.addButton('Source',{label:l.lang.source,command:'source'});l.on('mode',function(){l.getCommand('source').setState(l.mode=='source'?1:2);});}});j.sourcearea={commands:{source:{modes:{wysiwyg:1,source:1},editorFocus:false,exec:function(l){if(l.mode=='wysiwyg')l.fire('saveSnapshot');l.getCommand('source').setState(0);l.setMode(l.mode=='source'?'wysiwyg':'source');},canUndo:false}}};(function(){j.add('stylescombo',{requires:['richcombo','styles'],init:function(m){var n=m.config,o=m.lang.stylesCombo,p={},q=[];function r(s){m.getStylesSet(function(t){if(!q.length){var u,v;for(var w=0;w<t.length;w++){var x=t[w];v=x.name;u=p[v]=new a.style(x);u._name=v;u._.enterMode=n.enterMode;q.push(u);}q.sort(l);}s&&s();});};m.ui.addRichCombo('Styles',{label:o.label,title:o.panelTitle,className:'cke_styles',panel:{css:m.skin.editor.css.concat(n.contentsCss),multiSelect:true,attributes:{'aria-label':o.panelTitle}},init:function(){var s=this;r(function(){var t,u,v;for(var w=0;w<q.length;w++){t=q[w];u=t._name;var x=t.type;if(x!=v){s.startGroup(o['panelTitle'+String(x)]);v=x;}s.add(u,t.type==3?u:t.buildPreview(),u);}s.commit();s.onOpen();});},onClick:function(s){m.focus();m.fire('saveSnapshot');var t=p[s],u=m.getSelection(),v=new d.elementPath(u.getStartElement());if(t.type==2&&t.checkActive(v))t.remove(m.document);else t.apply(m.document);m.fire('saveSnapshot');},onRender:function(){m.on('selectionChange',function(s){var t=this.getValue(),u=s.data.path,v=u.elements;for(var w=0,x;w<v.length;w++){x=v[w];for(var y in p){if(p[y].checkElementRemovable(x,true)){if(y!=t)this.setValue(y);
-return;}}}this.setValue('');},this);},onOpen:function(){var z=this;if(c||b.webkit)m.focus();var s=m.getSelection(),t=s.getSelectedElement(),u=new d.elementPath(t||s.getStartElement()),v=[0,0,0,0];z.showAll();z.unmarkAll();for(var w in p){var x=p[w],y=x.type;if(x.checkActive(u))z.mark(w);else if(y==3&&!x.checkApplicable(u)){z.hideItem(w);v[y]--;}v[y]++;}if(!v[1])z.hideGroup(o['panelTitle'+String(1)]);if(!v[2])z.hideGroup(o['panelTitle'+String(2)]);if(!v[3])z.hideGroup(o['panelTitle'+String(3)]);}});m.on('instanceReady',function(){r();});}});function l(m,n){var o=m.type,p=n.type;return o==p?0:o==3?-1:p==3?1:p==1?1:-1;};})();j.add('table',{init:function(l){var m=j.table,n=l.lang.table;l.addCommand('table',new a.dialogCommand('table'));l.addCommand('tableProperties',new a.dialogCommand('tableProperties'));l.ui.addButton('Table',{label:n.toolbar,command:'table'});a.dialog.add('table',this.path+'dialogs/table.js');a.dialog.add('tableProperties',this.path+'dialogs/table.js');if(l.addMenuItems)l.addMenuItems({table:{label:n.menu,command:'tableProperties',group:'table',order:5},tabledelete:{label:n.deleteTable,command:'tableDelete',group:'table',order:1}});l.on('doubleclick',function(o){var p=o.data.element;if(p.is('table'))o.data.dialog='tableProperties';});if(l.contextMenu)l.contextMenu.addListener(function(o,p){if(!o)return null;var q=o.is('table')||o.hasAscendant('table');if(q)return{tabledelete:2,table:2};return null;});}});(function(){function l(G,H){if(c)G.removeAttribute(H);else delete G[H];};var m=/^(?:td|th)$/;function n(G){var H=G.createBookmarks(),I=G.getRanges(),J=[],K={};function L(T){if(J.length>0)return;if(T.type==1&&m.test(T.getName())&&!T.getCustomData('selected_cell')){h.setMarker(K,T,'selected_cell',true);J.push(T);}};for(var M=0;M<I.length;M++){var N=I[M];if(N.collapsed){var O=N.getCommonAncestor(),P=O.getAscendant('td',true)||O.getAscendant('th',true);if(P)J.push(P);}else{var Q=new d.walker(N),R;Q.guard=L;while(R=Q.next()){var S=R.getParent();if(S&&m.test(S.getName())&&!S.getCustomData('selected_cell')){h.setMarker(K,S,'selected_cell',true);J.push(S);}}}}h.clearAllMarkers(K);G.selectBookmarks(H);return J;};function o(G){var H=0,I=G.length-1,J={},K,L,M;while(K=G[H++])h.setMarker(J,K,'delete_cell',true);H=0;while(K=G[H++]){if((L=K.getPrevious())&&!L.getCustomData('delete_cell')||(L=K.getNext())&&!L.getCustomData('delete_cell')){h.clearAllMarkers(J);return L;}}h.clearAllMarkers(J);M=G[0].getParent();if(M=M.getPrevious())return M.getLast();M=G[I].getParent();
-if(M=M.getNext())return M.getChild(0);return null;};function p(G){var H=G.cells;for(var I=0;I<H.length;I++){H[I].innerHTML='';if(!c)new h(H[I]).appendBogus();}};function q(G,H){var I=G.getStartElement().getAscendant('tr');if(!I)return;var J=I.clone(true);J.insertBefore(I);p(H?J.$:I.$);};function r(G){if(G instanceof d.selection){var H=n(G),I=H.length,J=[],K,L,M;for(var N=0;N<I;N++){var O=H[N].getParent(),P=O.$.rowIndex;!N&&(L=P-1);J[P]=O;N==I-1&&(M=P+1);}var Q=O.getAscendant('table'),R=Q.$.rows,S=R.length;K=new h(M<S&&Q.$.rows[M]||L>0&&Q.$.rows[L]||Q.$.parentNode);for(N=J.length;N>=0;N--){if(J[N])r(J[N]);}return K;}else if(G instanceof h){Q=G.getAscendant('table');if(Q.$.rows.length==1)Q.remove();else G.remove();}return 0;};function s(G,H){var I=G.getStartElement(),J=I.getAscendant('td',true)||I.getAscendant('th',true);if(!J)return;var K=J.getAscendant('table'),L=J.$.cellIndex;for(var M=0;M<K.$.rows.length;M++){var N=K.$.rows[M];if(N.cells.length<L+1)continue;J=new h(N.cells[L].cloneNode(false));if(!c)J.appendBogus();var O=new h(N.cells[L]);if(H)J.insertBefore(O);else J.insertAfter(O);}};function t(G){var H=[],I=G[0]&&G[0].getAscendant('table'),J,K,L,M;for(J=0,K=G.length;J<K;J++)H.push(G[J].$.cellIndex);H.sort();for(J=1,K=H.length;J<K;J++){if(H[J]-H[J-1]>1){L=H[J-1]+1;break;}}if(!L)L=H[0]>0?H[0]-1:H[H.length-1]+1;var N=I.$.rows;for(J=0,K=N.length;J<K;J++){M=N[J].cells[L];if(M)break;}return M?new h(M):I.getPrevious();};function u(G){if(G instanceof d.selection){var H=n(G),I=t(H);for(var J=H.length-1;J>=0;J--){if(H[J])u(H[J]);}return I;}else if(G instanceof h){var K=G.getAscendant('table');if(!K)return null;var L=G.$.cellIndex;for(J=K.$.rows.length-1;J>=0;J--){var M=new h(K.$.rows[J]);if(!L&&M.$.cells.length==1){r(M);continue;}if(M.$.cells[L])M.$.removeChild(M.$.cells[L]);}}return null;};function v(G,H){var I=G.getStartElement(),J=I.getAscendant('td',true)||I.getAscendant('th',true);if(!J)return;var K=J.clone();if(!c)K.appendBogus();if(H)K.insertBefore(J);else K.insertAfter(J);};function w(G){if(G instanceof d.selection){var H=n(G),I=H[0]&&H[0].getAscendant('table'),J=o(H);for(var K=H.length-1;K>=0;K--)w(H[K]);if(J)y(J,true);else if(I)I.remove();}else if(G instanceof h){var L=G.getParent();if(L.getChildCount()==1)L.remove();else G.remove();}};function x(G){var H=G.getBogus();H&&H.remove();G.trim();};function y(G,H){var I=new d.range(G.getDocument());if(!I['moveToElementEdit'+(H?'End':'Start')](G)){I.selectNodeContents(G);I.collapse(H?false:true);}I.select(true);
-};function z(G){var H=G.$.rows,I=-1,J=[];for(var K=0;K<H.length;K++){I++;!J[I]&&(J[I]=[]);var L=-1;for(var M=0;M<H[K].cells.length;M++){var N=H[K].cells[M];L++;while(J[I][L])L++;var O=isNaN(N.colSpan)?1:N.colSpan,P=isNaN(N.rowSpan)?1:N.rowSpan;for(var Q=0;Q<P;Q++){if(!J[I+Q])J[I+Q]=[];for(var R=0;R<O;R++)J[I+Q][L+R]=H[K].cells[M];}L+=O-1;}}return J;};function A(G,H,I){var J=G[H];if(typeof I=='undefined')return J;for(var K=0;J&&K<J.length;K++){if(I.is&&J[K]==I.$)return K;else if(K==I)return new h(J[K]);}return I.is?-1:null;};function B(G,H,I){var J=[];for(var K=0;K<G.length;K++){var L=G[K];if(typeof I=='undefined')J.push(L[H]);else if(I.is&&L[H]==I.$)return K;else if(K==I)return new h(L[H]);}return typeof I=='undefined'?J:I.is?-1:null;};function C(G,H,I){var J=n(G),K;if((H?J.length!=1:J.length<2)||(K=G.getCommonAncestor())&&K.type==1&&K.is('table'))return false;var L,M=J[0],N=M.getAscendant('table'),O=z(N),P=O.length,Q=O[0].length,R=M.getParent().$.rowIndex,S=A(O,R,M);if(H){var T;try{T=O[H=='up'?R-1:H=='down'?R+1:R][H=='left'?S-1:H=='right'?S+1:S];}catch(al){return false;}if(!T||M.$==T)return false;J[H=='up'||H=='left'?'unshift':'push'](new h(T));}var U=M.getDocument(),V=R,W=0,X=0,Y=!I&&new d.documentFragment(U),Z=0;for(var aa=0;aa<J.length;aa++){L=J[aa];var ab=L.getParent(),ac=L.getFirst(),ad=L.$.colSpan,ae=L.$.rowSpan,af=ab.$.rowIndex,ag=A(O,af,L);Z+=ad*ae;X=Math.max(X,ag-S+ad);W=Math.max(W,af-R+ae);if(!I){if(x(L),L.getChildren().count()){if(af!=V&&ac&&!(ac.isBlockBoundary&&ac.isBlockBoundary({br:1}))){var ah=Y.getLast(d.walker.whitespaces(true));if(ah&&!(ah.is&&ah.is('br')))Y.append(new h('br'));}L.moveChildren(Y);}aa?L.remove():L.setHtml('');}V=af;}if(!I){Y.moveChildren(M);if(!c)M.appendBogus();if(X>=Q)M.removeAttribute('rowSpan');else M.$.rowSpan=W;if(W>=P)M.removeAttribute('colSpan');else M.$.colSpan=X;var ai=new d.nodeList(N.$.rows),aj=ai.count();for(aa=aj-1;aa>=0;aa--){var ak=ai.getItem(aa);if(!ak.$.cells.length){ak.remove();aj++;continue;}}return M;}else return W*X==Z;};function D(G,H){var I=n(G);if(I.length>1)return false;else if(H)return true;var J=I[0],K=J.getParent(),L=K.getAscendant('table'),M=z(L),N=K.$.rowIndex,O=A(M,N,J),P=J.$.rowSpan,Q,R,S,T;if(P>1){R=Math.ceil(P/2);S=Math.floor(P/2);T=N+R;var U=new h(L.$.rows[T]),V=A(M,T),W;Q=J.clone();for(var X=0;X<V.length;X++){W=V[X];if(W.parentNode==U.$&&X>O){Q.insertBefore(new h(W));break;}else W=null;}if(!W)U.append(Q,true);}else{S=R=1;U=K.clone();U.insertAfter(K);U.append(Q=J.clone());var Y=A(M,N);for(var Z=0;
-Z<Y.length;Z++)Y[Z].rowSpan++;}if(!c)Q.appendBogus();J.$.rowSpan=R;Q.$.rowSpan=S;if(R==1)J.removeAttribute('rowSpan');if(S==1)Q.removeAttribute('rowSpan');return Q;};function E(G,H){var I=n(G);if(I.length>1)return false;else if(H)return true;var J=I[0],K=J.getParent(),L=K.getAscendant('table'),M=z(L),N=K.$.rowIndex,O=A(M,N,J),P=J.$.colSpan,Q,R,S;if(P>1){R=Math.ceil(P/2);S=Math.floor(P/2);}else{S=R=1;var T=B(M,O);for(var U=0;U<T.length;U++)T[U].colSpan++;}Q=J.clone();Q.insertAfter(J);if(!c)Q.appendBogus();J.$.colSpan=R;Q.$.colSpan=S;if(R==1)J.removeAttribute('colSpan');if(S==1)Q.removeAttribute('colSpan');return Q;};var F={thead:1,tbody:1,tfoot:1,td:1,tr:1,th:1};j.tabletools={init:function(G){var H=G.lang.table;G.addCommand('cellProperties',new a.dialogCommand('cellProperties'));a.dialog.add('cellProperties',this.path+'dialogs/tableCell.js');G.addCommand('tableDelete',{exec:function(I){var J=I.getSelection(),K=J&&J.getStartElement(),L=K&&K.getAscendant('table',true);if(!L)return;J.selectElement(L);var M=J.getRanges()[0];M.collapse();J.selectRanges([M]);var N=L.getParent();if(N.getChildCount()==1&&N.getName()!='body')N.remove();else L.remove();}});G.addCommand('rowDelete',{exec:function(I){var J=I.getSelection();y(r(J));}});G.addCommand('rowInsertBefore',{exec:function(I){var J=I.getSelection();q(J,true);}});G.addCommand('rowInsertAfter',{exec:function(I){var J=I.getSelection();q(J);}});G.addCommand('columnDelete',{exec:function(I){var J=I.getSelection(),K=u(J);K&&y(K,true);}});G.addCommand('columnInsertBefore',{exec:function(I){var J=I.getSelection();s(J,true);}});G.addCommand('columnInsertAfter',{exec:function(I){var J=I.getSelection();s(J);}});G.addCommand('cellDelete',{exec:function(I){var J=I.getSelection();w(J);}});G.addCommand('cellMerge',{exec:function(I){y(C(I.getSelection()),true);}});G.addCommand('cellMergeRight',{exec:function(I){y(C(I.getSelection(),'right'),true);}});G.addCommand('cellMergeDown',{exec:function(I){y(C(I.getSelection(),'down'),true);}});G.addCommand('cellVerticalSplit',{exec:function(I){y(D(I.getSelection()));}});G.addCommand('cellHorizontalSplit',{exec:function(I){y(E(I.getSelection()));}});G.addCommand('cellInsertBefore',{exec:function(I){var J=I.getSelection();v(J,true);}});G.addCommand('cellInsertAfter',{exec:function(I){var J=I.getSelection();v(J);}});if(G.addMenuItems)G.addMenuItems({tablecell:{label:H.cell.menu,group:'tablecell',order:1,getItems:function(){var I=G.getSelection(),J=n(I);return{tablecell_insertBefore:2,tablecell_insertAfter:2,tablecell_delete:2,tablecell_merge:C(I,null,true)?2:0,tablecell_merge_right:C(I,'right',true)?2:0,tablecell_merge_down:C(I,'down',true)?2:0,tablecell_split_vertical:D(I,true)?2:0,tablecell_split_horizontal:E(I,true)?2:0,tablecell_properties:J.length>0?2:0};
-}},tablecell_insertBefore:{label:H.cell.insertBefore,group:'tablecell',command:'cellInsertBefore',order:5},tablecell_insertAfter:{label:H.cell.insertAfter,group:'tablecell',command:'cellInsertAfter',order:10},tablecell_delete:{label:H.cell.deleteCell,group:'tablecell',command:'cellDelete',order:15},tablecell_merge:{label:H.cell.merge,group:'tablecell',command:'cellMerge',order:16},tablecell_merge_right:{label:H.cell.mergeRight,group:'tablecell',command:'cellMergeRight',order:17},tablecell_merge_down:{label:H.cell.mergeDown,group:'tablecell',command:'cellMergeDown',order:18},tablecell_split_horizontal:{label:H.cell.splitHorizontal,group:'tablecell',command:'cellHorizontalSplit',order:19},tablecell_split_vertical:{label:H.cell.splitVertical,group:'tablecell',command:'cellVerticalSplit',order:20},tablecell_properties:{label:H.cell.title,group:'tablecellproperties',command:'cellProperties',order:21},tablerow:{label:H.row.menu,group:'tablerow',order:1,getItems:function(){return{tablerow_insertBefore:2,tablerow_insertAfter:2,tablerow_delete:2};}},tablerow_insertBefore:{label:H.row.insertBefore,group:'tablerow',command:'rowInsertBefore',order:5},tablerow_insertAfter:{label:H.row.insertAfter,group:'tablerow',command:'rowInsertAfter',order:10},tablerow_delete:{label:H.row.deleteRow,group:'tablerow',command:'rowDelete',order:15},tablecolumn:{label:H.column.menu,group:'tablecolumn',order:1,getItems:function(){return{tablecolumn_insertBefore:2,tablecolumn_insertAfter:2,tablecolumn_delete:2};}},tablecolumn_insertBefore:{label:H.column.insertBefore,group:'tablecolumn',command:'columnInsertBefore',order:5},tablecolumn_insertAfter:{label:H.column.insertAfter,group:'tablecolumn',command:'columnInsertAfter',order:10},tablecolumn_delete:{label:H.column.deleteColumn,group:'tablecolumn',command:'columnDelete',order:15}});if(G.contextMenu)G.contextMenu.addListener(function(I,J){if(!I)return null;while(I){if(I.getName() in F)return{tablecell:2,tablerow:2,tablecolumn:2};I=I.getParent();}return null;});},getSelectedCells:n};j.add('tabletools',j.tabletools);})();j.add('specialchar',{init:function(l){var m='specialchar';a.dialog.add(m,this.path+'dialogs/specialchar.js');l.addCommand(m,new a.dialogCommand(m));l.ui.addButton('SpecialChar',{label:l.lang.specialChar.toolbar,command:m});}});(function(){var l={editorFocus:false,modes:{wysiwyg:1,source:1}},m={exec:function(o){o.container.focusNext(true,o.tabIndex);}},n={exec:function(o){o.container.focusPrevious(true,o.tabIndex);}};j.add('tab',{requires:['keystrokes'],init:function(o){var p=o.config.tabSpaces||0,q='';
-while(p--)q+='\xa0';if(q)o.on('key',function(r){if(r.data.keyCode==9){o.insertHtml(q);r.cancel();}});if(b.webkit||b.gecko)o.on('key',function(r){var s=r.data.keyCode;if(s==9&&!q){r.cancel();o.execCommand('blur');}if(s==2000+9){o.execCommand('blurBack');r.cancel();}});o.addCommand('blur',e.extend(m,l));o.addCommand('blurBack',e.extend(n,l));}});})();h.prototype.focusNext=function(l,m){var v=this;var n=v.$,o=m===undefined?v.getTabIndex():m,p,q,r,s,t,u;if(o<=0){t=v.getNextSourceNode(l,1);while(t){if(t.isVisible()&&t.getTabIndex()===0){r=t;break;}t=t.getNextSourceNode(false,1);}}else{t=v.getDocument().getBody().getFirst();while(t=t.getNextSourceNode(false,1)){if(!p)if(!q&&t.equals(v)){q=true;if(l){if(!(t=t.getNextSourceNode(true,1)))break;p=1;}}else if(q&&!v.contains(t))p=1;if(!t.isVisible()||(u=t.getTabIndex())<0)continue;if(p&&u==o){r=t;break;}if(u>o&&(!r||!s||u<s)){r=t;s=u;}else if(!r&&u===0){r=t;s=u;}}}if(r)r.focus();};h.prototype.focusPrevious=function(l,m){var v=this;var n=v.$,o=m===undefined?v.getTabIndex():m,p,q,r,s=0,t,u=v.getDocument().getBody().getLast();while(u=u.getPreviousSourceNode(false,1)){if(!p)if(!q&&u.equals(v)){q=true;if(l){if(!(u=u.getPreviousSourceNode(true,1)))break;p=1;}}else if(q&&!v.contains(u))p=1;if(!u.isVisible()||(t=u.getTabIndex())<0)continue;if(o<=0){if(p&&t===0){r=u;break;}if(t>s){r=u;s=t;}}else{if(p&&t==o){r=u;break;}if(t<o&&(!r||t>s)){r=u;s=t;}}}if(r)r.focus();};(function(){j.add('templates',{requires:['dialog'],init:function(n){a.dialog.add('templates',a.getUrl(this.path+'dialogs/templates.js'));n.addCommand('templates',new a.dialogCommand('templates'));n.ui.addButton('Templates',{label:n.lang.templates.button,command:'templates'});}});var l={},m={};a.addTemplates=function(n,o){l[n]=o;};a.getTemplates=function(n){return l[n];};a.loadTemplates=function(n,o){var p=[];for(var q=0;q<n.length;q++){if(!m[n[q]]){p.push(n[q]);m[n[q]]=1;}}if(p.length>0)a.scriptLoader.load(p,o);else setTimeout(o,0);};})();i.templates='default';i.templates_files=[a.getUrl('plugins/templates/templates/default.js')];i.templates_replaceContent=true;(function(){var l=function(){this.toolbars=[];this.focusCommandExecuted=false;};l.prototype.focus=function(){for(var n=0,o;o=this.toolbars[n++];)for(var p=0,q;q=o.items[p++];){if(q.focus){q.focus();return;}}};var m={toolbarFocus:{modes:{wysiwyg:1,source:1},exec:function(n){if(n.toolbox){n.toolbox.focusCommandExecuted=true;if(c)setTimeout(function(){n.toolbox.focus();},100);else n.toolbox.focus();}}}};j.add('toolbar',{init:function(n){var o=function(p,q){var r,s,t,u=n.lang.dir=='rtl';
-switch(q){case u?37:39:case 9:do{r=p.next;if(!r){s=p.toolbar.next;t=s&&s.items.length;while(t===0){s=s.next;t=s&&s.items.length;}if(s)r=s.items[0];}p=r;}while(p&&!p.focus)if(p)p.focus();else n.toolbox.focus();return false;case u?39:37:case 2000+9:do{r=p.previous;if(!r){s=p.toolbar.previous;t=s&&s.items.length;while(t===0){s=s.previous;t=s&&s.items.length;}if(s)r=s.items[t-1];}p=r;}while(p&&!p.focus)if(p)p.focus();else{var v=n.toolbox.toolbars[n.toolbox.toolbars.length-1].items;v[v.length-1].focus();}return false;case 27:n.focus();return false;case 13:case 32:p.execute();return false;}return true;};n.on('themeSpace',function(p){if(p.data.space==n.config.toolbarLocation){n.toolbox=new l();var q='cke_'+e.getNextNumber(),r=['<div class="cke_toolbox" role="toolbar" aria-labelledby="',q,'"'],s=n.config.toolbarStartupExpanded!==false,t;r.push(s?'>':' style="display:none">');r.push('<span id="',q,'" class="cke_voice_label">',n.lang.toolbar,'</span>');var u=n.toolbox.toolbars,v=n.config.toolbar instanceof Array?n.config.toolbar:n.config['toolbar_'+n.config.toolbar];for(var w=0;w<v.length;w++){var x=v[w];if(!x)continue;var y='cke_'+e.getNextNumber(),z={id:y,items:[]};if(t){r.push('</div>');t=0;}if(x==='/'){r.push('<div class="cke_break"></div>');continue;}r.push('<span id="',y,'" class="cke_toolbar" role="presentation"><span class="cke_toolbar_start"></span>');var A=u.push(z)-1;if(A>0){z.previous=u[A-1];z.previous.next=z;}for(var B=0;B<x.length;B++){var C,D=x[B];if(D=='-')C=k.separator;else C=n.ui.create(D);if(C){if(C.canGroup){if(!t){r.push('<span class="cke_toolgroup" role="presentation">');t=1;}}else if(t){r.push('</span>');t=0;}var E=C.render(n,r);A=z.items.push(E)-1;if(A>0){E.previous=z.items[A-1];E.previous.next=E;}E.toolbar=z;E.onkey=o;E.onfocus=function(){if(!n.toolbox.focusCommandExecuted)n.focus();};}}if(t){r.push('</span>');t=0;}r.push('<span class="cke_toolbar_end"></span></span>');}r.push('</div>');if(n.config.toolbarCanCollapse){var F=e.addFunction(function(){n.execCommand('toolbarCollapse');});n.on('destroy',function(){e.removeFunction(F);});var G='cke_'+e.getNextNumber();n.addCommand('toolbarCollapse',{exec:function(H){var I=a.document.getById(G),J=I.getPrevious(),K=H.getThemeSpace('contents'),L=J.getParent(),M=parseInt(K.$.style.height,10),N=L.$.offsetHeight,O=!J.isVisible();if(!O){J.hide();I.addClass('cke_toolbox_collapser_min');I.setAttribute('title',H.lang.toolbarExpand);}else{J.show();I.removeClass('cke_toolbox_collapser_min');I.setAttribute('title',H.lang.toolbarCollapse);
-}I.getFirst().setText(O?'â–²':'â—€');var P=L.$.offsetHeight-N;K.setStyle('height',M-P+'px');H.fire('resize');},modes:{wysiwyg:1,source:1}});r.push('<a title="'+(s?n.lang.toolbarCollapse:n.lang.toolbarExpand)+'" id="'+G+'" tabIndex="-1" class="cke_toolbox_collapser');if(!s)r.push(' cke_toolbox_collapser_min');r.push('" onclick="CKEDITOR.tools.callFunction('+F+')">','<span>▲</span>','</a>');}p.data.html+=r.join('');}});n.addCommand('toolbarFocus',m.toolbarFocus);}});})();k.separator={render:function(l,m){m.push('<span class="cke_separator" role="separator"></span>');return{};}};i.toolbarLocation='top';i.toolbar_Basic=[['Bold','Italic','-','NumberedList','BulletedList','-','Link','Unlink','-','About']];i.toolbar_Full=[['Source','-','Save','NewPage','Preview','-','Templates'],['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print','SpellChecker','Scayt'],['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],'/',['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],['Link','Unlink','Anchor'],['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],'/',['Styles','Format','Font','FontSize'],['TextColor','BGColor'],['Maximize','ShowBlocks','-','About']];i.toolbar='Full';i.toolbarCanCollapse=true;(function(){j.add('undo',{requires:['selection','wysiwygarea'],init:function(r){var s=new n(r),t=r.addCommand('undo',{exec:function(){if(s.undo()){r.selectionChange();this.fire('afterUndo');}},state:0,canUndo:false}),u=r.addCommand('redo',{exec:function(){if(s.redo()){r.selectionChange();this.fire('afterRedo');}},state:0,canUndo:false});s.onChange=function(){t.setState(s.undoable()?2:0);u.setState(s.redoable()?2:0);};function v(w){if(s.enabled&&w.data.command.canUndo!==false)s.save();};r.on('beforeCommandExec',v);r.on('afterCommandExec',v);r.on('saveSnapshot',function(){s.save();});r.on('contentDom',function(){r.document.on('keydown',function(w){if(!w.data.$.ctrlKey&&!w.data.$.metaKey)s.type(w);});});r.on('beforeModeUnload',function(){r.mode=='wysiwyg'&&s.save(true);});r.on('mode',function(){s.enabled=r.mode=='wysiwyg';s.onChange();});r.ui.addButton('Undo',{label:r.lang.undo,command:'undo'});r.ui.addButton('Redo',{label:r.lang.redo,command:'redo'});r.resetUndo=function(){s.reset();r.fire('saveSnapshot');
-};r.on('updateSnapshot',function(){if(s.currentImage&&new l(r).equals(s.currentImage))setTimeout(function(){s.update();},0);});}});j.undo={};var l=j.undo.Image=function(r){this.editor=r;var s=r.getSnapshot(),t=s&&r.getSelection();c&&s&&(s=s.replace(/\s+_cke_expando=".*?"/g,''));this.contents=s;this.bookmarks=t&&t.createBookmarks2(true);},m=/\b(?:href|src|name)="[^"]*?"/gi;l.prototype={equals:function(r,s){var t=this.contents,u=r.contents;if(c&&(b.ie7Compat||b.ie6Compat)){t=t.replace(m,'');u=u.replace(m,'');}if(t!=u)return false;if(s)return true;var v=this.bookmarks,w=r.bookmarks;if(v||w){if(!v||!w||v.length!=w.length)return false;for(var x=0;x<v.length;x++){var y=v[x],z=w[x];if(y.startOffset!=z.startOffset||y.endOffset!=z.endOffset||!e.arrayCompare(y.start,z.start)||!e.arrayCompare(y.end,z.end))return false;}}return true;}};function n(r){this.editor=r;this.reset();};var o={8:1,46:1},p={16:1,17:1,18:1},q={37:1,38:1,39:1,40:1};n.prototype={type:function(r){var s=r&&r.data.getKey(),t=s in p,u=s in o,v=this.lastKeystroke in o,w=u&&s==this.lastKeystroke,x=s in q,y=this.lastKeystroke in q,z=!u&&!x,A=u&&!w,B=!(t||this.typing)||z&&(v||y);if(B||A){var C=new l(this.editor);e.setTimeout(function(){var E=this;var D=E.editor.getSnapshot();if(c)D=D.replace(/\s+_cke_expando=".*?"/g,'');if(C.contents!=D){E.typing=true;if(!E.save(false,C,false))E.snapshots.splice(E.index+1,E.snapshots.length-E.index-1);E.hasUndo=true;E.hasRedo=false;E.typesCount=1;E.modifiersCount=1;E.onChange();}},0,this);}this.lastKeystroke=s;if(u){this.typesCount=0;this.modifiersCount++;if(this.modifiersCount>25){this.save(false,null,false);this.modifiersCount=1;}}else if(!x){this.modifiersCount=0;this.typesCount++;if(this.typesCount>25){this.save(false,null,false);this.typesCount=1;}}},reset:function(){var r=this;r.lastKeystroke=0;r.snapshots=[];r.index=-1;r.limit=r.editor.config.undoStackSize;r.currentImage=null;r.hasUndo=false;r.hasRedo=false;r.resetType();},resetType:function(){var r=this;r.typing=false;delete r.lastKeystroke;r.typesCount=0;r.modifiersCount=0;},fireChange:function(){var r=this;r.hasUndo=!!r.getNextImage(true);r.hasRedo=!!r.getNextImage(false);r.resetType();r.onChange();},save:function(r,s,t){var v=this;var u=v.snapshots;if(!s)s=new l(v.editor);if(s.contents===false)return false;if(v.currentImage&&s.equals(v.currentImage,r))return false;u.splice(v.index+1,u.length-v.index-1);if(u.length==v.limit)u.shift();v.index=u.push(s)-1;v.currentImage=s;if(t!==false)v.fireChange();return true;},restoreImage:function(r){var t=this;
-t.editor.loadSnapshot(r.contents);if(r.bookmarks)t.editor.getSelection().selectBookmarks(r.bookmarks);else if(c){var s=t.editor.document.getBody().$.createTextRange();s.collapse(true);s.select();}t.index=r.index;t.update();t.fireChange();},getNextImage:function(r){var w=this;var s=w.snapshots,t=w.currentImage,u,v;if(t)if(r)for(v=w.index-1;v>=0;v--){u=s[v];if(!t.equals(u,true)){u.index=v;return u;}}else for(v=w.index+1;v<s.length;v++){u=s[v];if(!t.equals(u,true)){u.index=v;return u;}}return null;},redoable:function(){return this.enabled&&this.hasRedo;},undoable:function(){return this.enabled&&this.hasUndo;},undo:function(){var s=this;if(s.undoable()){s.save(true);var r=s.getNextImage(true);if(r)return s.restoreImage(r),true;}return false;},redo:function(){var s=this;if(s.redoable()){s.save(true);if(s.redoable()){var r=s.getNextImage(false);if(r)return s.restoreImage(r),true;}}return false;},update:function(){var r=this;r.snapshots.splice(r.index,1,r.currentImage=new l(r.editor));}};})();i.undoStackSize=20;(function(){var l={table:1,pre:1},m=/\s*<(p|div|address|h\d|center)[^>]*>\s*(?:<br[^>]*>| |\u00A0| )?\s*(:?<\/\1>)?\s*(?=$|<\/body>)/gi;function n(x){if(this.mode=='wysiwyg'){this.focus();this.fire('saveSnapshot');var y=this.getSelection(),z=x.data;if(this.dataProcessor)z=this.dataProcessor.toHtml(z);if(c){var A=y.isLocked;if(A)y.unlock();var B=y.getNative();if(B.type=='Control')B.clear();B.createRange().pasteHTML(z);if(A)this.getSelection().lock();}else this.document.$.execCommand('inserthtml',false,z);e.setTimeout(function(){this.fire('saveSnapshot');},0,this);}};function o(x){if(this.mode=='wysiwyg'){this.focus();this.fire('saveSnapshot');var y=x.data,z=y.getName(),A=f.$block[z],B=this.getSelection(),C=B.getRanges(),D=B.isLocked;if(D)B.unlock();var E,F,G,H;for(var I=C.length-1;I>=0;I--){E=C[I];E.deleteContents();F=!I&&y||y.clone(true);var J,K;if(A)while((J=E.getCommonAncestor(false,true))&&(K=f[J.getName()])&&!(K&&K[z])){if(J.getName() in f.span)E.splitElement(J);else if(E.checkStartOfBlock()&&E.checkEndOfBlock()){E.setStartBefore(J);E.collapse(true);J.remove();}else E.splitBlock();}E.insertNode(F);if(!G)G=F;}E.moveToPosition(G,4);var L=G.getNextSourceNode(true);if(L&&L.type==1)E.moveToElementEditStart(L);B.selectRanges([E]);if(D)this.getSelection().lock();e.setTimeout(function(){this.fire('saveSnapshot');},0,this);}};function p(x){if(!x.checkDirty())setTimeout(function(){x.resetDirty();});};var q=d.walker.whitespaces(true),r=d.walker.bookmark(false,true);
-function s(x){return q(x)&&r(x);};function t(x){return x.type==3&&e.trim(x.getText()).match(/^(?: |\xa0)$/);};function u(x){if(x.isLocked){x.unlock();setTimeout(function(){x.lock();},0);}};function v(x){return x.getOuterHtml().match(m);};q=d.walker.whitespaces(true);function w(x){var y=x.editor,z=x.data.path,A=z.blockLimit,B=x.data.selection,C=B.getRanges()[0],D=y.document.getBody(),E=y.config.enterMode;if(E!=2&&C.collapsed&&A.getName()=='body'&&!z.block){y.fire('updateSnapshot');p(y);c&&u(B);var F=C.fixBlock(true,y.config.enterMode==3?'div':'p');if(c){var G=F.getFirst(s);G&&t(G)&&G.remove();}if(v(F)){var H=F.getPrevious(q),I=F.getNext(q);if(H&&H.getName&&!(H.getName() in l)&&v(H)&&C.moveToElementEditStart(H)||I&&I.getName&&!(I.getName() in l)&&v(I)&&C.moveToElementEditStart(I))F.remove();}C.select();if(!c)y.selectionChange();}var J=new d.range(y.document),K=new d.walker(J);J.selectNodeContents(D);K.evaluator=function(M){return M.type==1&&M.getName() in l;};K.guard=function(M,N){return!(M.type==3&&q(M)||N);};if(K.previous()){y.fire('updateSnapshot');p(y);c&&u(B);var L;if(E!=2)L=D.append(new h(E==1?'p':'div'));else L=D;if(!c)L.appendBogus();}};j.add('wysiwygarea',{requires:['editingblock'],init:function(x){var y=x.config.enterMode!=2?x.config.enterMode==3?'div':'p':false,z=x.lang.editorTitle.replace('%1',x.name),A;x.on('editingBlockReady',function(){var G,H,I,J,K,L,M=b.isCustomDomain(),N=function(Q){if(H)H.remove();var R='document.open();'+(M?'document.domain="'+document.domain+'";':'')+'document.close();';H=h.createFromHtml('<iframe style="width:100%;height:100%" frameBorder="0" title="'+z+'"'+' src="'+(c?'javascript:void(function(){'+encodeURIComponent(R)+'}())':'')+'"'+' tabIndex="'+(b.webkit?-1:x.tabIndex)+'"'+' allowTransparency="true"'+'></iframe>');H.on('load',function(S){K=1;S.removeListener();var T=H.getFrameDocument().$;T.open('text/html','replace');T.write(Q);T.close();});G.append(H);};A=e.addFunction(P);var O='<script id="cke_actscrpt" type="text/javascript" cke_temp="1">'+(M?'document.domain="'+document.domain+'";':'')+'window.parent.CKEDITOR.tools.callFunction( '+A+', window );'+'</script>';function P(Q){if(!K)return;K=0;x.fire('ariaWidget',H);var R=Q.document,S=R.body,T=R.getElementById('cke_actscrpt');T.parentNode.removeChild(T);S.spellcheck=!x.config.disableNativeSpellChecker;if(c){S.hideFocus=true;S.disabled=true;S.contentEditable=true;S.removeAttribute('disabled');}else setTimeout(function(){if(b.gecko&&b.version>=10900||b.opera)R.$.body.contentEditable=true;
-else if(b.webkit)R.$.body.parentNode.contentEditable=true;else R.$.designMode='on';},0);if(b.gecko&&!S.childNodes.length)setTimeout(function(){p(x);var X=R.$.createEvent('KeyEvents');X.initKeyEvent('keypress',true,true,Q.$,false,false,false,false,0,32);R.$.dispatchEvent(X);R.createElement('br',{attributes:{_moz_editor_bogus_node:'TRUE',_moz_dirty:''}}).replace(R.getBody().getFirst());var Y=new d.range(R);Y.setStartAt(new h(S),1);Y.select();},0);try{R.execCommand('enableObjectResizing',false,!x.config.disableObjectResizing);}catch(X){}try{R.execCommand('enableInlineTableEditing',false,!x.config.disableNativeTableHandles);}catch(Y){}Q=x.window=new d.window(Q);R=x.document=new g(R);R.on('dblclick',function(Z){var aa=Z.data.getTarget(),ab={element:aa,dialog:''};x.fire('doubleclick',ab);ab.dialog&&x.openDialog(ab.dialog);});if(!(c||b.opera))R.on('mousedown',function(Z){var aa=Z.data.getTarget();if(aa.is('img','hr','input','textarea','select'))x.getSelection().selectElement(aa);});if(b.webkit){R.on('click',function(Z){if(Z.data.getTarget().is('input','select'))Z.data.preventDefault();});R.on('mouseup',function(Z){if(Z.data.getTarget().is('input','textarea'))Z.data.preventDefault();});}if(c&&R.$.compatMode=='CSS1Compat'||b.gecko||b.opera){var U=R.getDocumentElement();U.on('mousedown',function(Z){if(Z.data.getTarget().equals(U)){if(b.gecko&&b.version>=10900)E();F.focus();}});}Q.on('blur',function(){x.focusManager.blur();});Q.on('focus',function(){var Z=x.document;if(b.gecko&&b.version>=10900)E();else if(b.opera)Z.getBody().focus();else if(b.webkit){var aa=x.getSelection(),ab=aa.getType(),ac=ab!=1&&aa.getRanges()[0];Z.getDocumentElement().focus();ac&&ac.select();}x.focusManager.focus();});var V=x.keystrokeHandler;if(V)V.attach(R);if(c){R.getDocumentElement().addClass(R.$.compatMode);R.on('keydown',function(Z){var aa=Z.data.getKeystroke();if(aa in {8:1,46:1}){var ab=x.getSelection(),ac=ab.getSelectedElement();if(ac){x.fire('saveSnapshot');var ad=ab.getRanges()[0].createBookmark();ac.remove();ab.selectBookmarks([ad]);x.fire('saveSnapshot');Z.data.preventDefault();}}});if(R.$.compatMode=='CSS1Compat'){var W={33:1,34:1};R.on('keydown',function(Z){if(Z.data.getKeystroke() in W)setTimeout(function(){x.getSelection().scrollIntoView();},0);});}}if(x.contextMenu)x.contextMenu.addTarget(R,x.config.browserContextMenuOnCtrl!==false);setTimeout(function(){x.fire('contentDom');if(L){x.mode='wysiwyg';x.fire('mode');L=false;}I=false;if(J){x.focus();J=false;}setTimeout(function(){x.fire('dataReady');
-},0);if(c)setTimeout(function(){if(x.document){var Z=x.document.$.body;Z.runtimeStyle.marginBottom='0px';Z.runtimeStyle.marginBottom='';}},1000);},0);};x.addMode('wysiwyg',{load:function(Q,R,S){G=Q;if(c&&b.quirks)Q.setStyle('position','relative');x.mayBeDirty=true;L=true;if(S)this.loadSnapshotData(R);else this.loadData(R);},loadData:function(Q){I=true;var R=x.config,S=R.fullPage,T=R.docType,U='<style type="text/css" cke_temp="1">'+x._.styles.join('\n')+'</style>';!S&&(U=e.buildStyleHtml(x.config.contentsCss)+U);var V=R.baseHref?'<base href="'+R.baseHref+'" cke_temp="1" />':'';if(S)Q=Q.replace(/<!DOCTYPE[^>]*>/i,function(W){x.docType=T=W;return '';});if(x.dataProcessor)Q=x.dataProcessor.toHtml(Q,y);if(S){if(!/<body[\s|>]/.test(Q))Q='<body>'+Q;if(!/<html[\s|>]/.test(Q))Q='<html>'+Q+'</html>';if(!/<head[\s|>]/.test(Q))Q=Q.replace(/<html[^>]*>/,'$&<head><title></title></head>');else if(!/<title[\s|>]/.test(Q))Q=Q.replace(/<head[^>]*>/,'$&<title></title>');V&&(Q=Q.replace(/<head>/,'$&'+V));Q=Q.replace(/<\/head\s*>/,U+'$&');Q=T+Q;}else Q=R.docType+'<html dir="'+R.contentsLangDirection+'"'+' lang="'+(R.contentsLanguage||x.langCode)+'">'+'<head>'+'<title>'+z+'</title>'+V+U+'</head>'+'<body'+(R.bodyId?' id="'+R.bodyId+'"':'')+(R.bodyClass?' class="'+R.bodyClass+'"':'')+'>'+Q+'</html>';Q+=O;this.onDispose();N(Q);},getData:function(){var Q=x.config,R=Q.fullPage,S=R&&x.docType,T=H.getFrameDocument(),U=R?T.getDocumentElement().getOuterHtml():T.getBody().getHtml();if(x.dataProcessor)U=x.dataProcessor.toDataFormat(U,y);if(Q.ignoreEmptyParagraph)U=U.replace(m,'');if(S)U=S+'\n'+U;return U;},getSnapshotData:function(){return H.getFrameDocument().getBody().getHtml();},loadSnapshotData:function(Q){H.getFrameDocument().getBody().setHtml(Q);},onDispose:function(){if(!x.document)return;x.document.getDocumentElement().clearCustomData();x.document.getBody().clearCustomData();x.window.clearCustomData();x.document.clearCustomData();H.clearCustomData();},unload:function(Q){this.onDispose();x.window=x.document=H=G=J=null;x.fire('contentDomUnload');},focus:function(){if(I)J=true;else if(x.window){x.window.focus();x.selectionChange();}}});x.on('insertHtml',n,null,null,20);x.on('insertElement',o,null,null,20);x.on('selectionChange',w,null,null,1);});var B;x.on('contentDom',function(){var G=x.document.getElementsByTag('title').getItem(0);G.setAttribute('_cke_title',x.document.$.title);x.document.$.title=z;});if(b.ie8Compat){x.addCss('html.CSS1Compat [contenteditable=false]{ min-height:0 !important;}');
-var C=[];for(var D in f.$removeEmpty)C.push('html.CSS1Compat '+D+'[contenteditable=false]');x.addCss(C.join(',')+'{ display:inline-block;}');}function E(G){e.tryThese(function(){x.document.$.designMode='on';setTimeout(function(){x.document.$.designMode='off';x.document.getBody().focus();},50);},function(){x.document.$.designMode='off';var H=x.document.getBody();H.setAttribute('contentEditable',false);H.setAttribute('contentEditable',true);!G&&E(1);});};if(b.gecko||c||b.opera){var F;x.on('uiReady',function(){F=x.container.append(h.createFromHtml('<span tabindex="-1" style="position:absolute; left:-10000" role="presentation"></span>'));F.on('focus',function(){x.focus();});});x.on('destroy',function(){e.removeFunction(A);F.clearCustomData();});}x.on('insertElement',function(G){var H=G.data;if(H.type=1&&(H.is('input')||H.is('textarea')))H.setAttribute('contentEditable',false);});}});if(b.gecko)(function(){var x=document.body;if(!x)window.addEventListener('load',arguments.callee,false);else{var y=x.getAttribute('onpageshow');x.setAttribute('onpageshow',(y?y+';':'')+'event.persisted && (function(){'+'var allInstances = CKEDITOR.instances, editor, doc;'+'for ( var i in allInstances )'+'{'+'\teditor = allInstances[ i ];'+'\tdoc = editor.document;'+'\tif ( doc )'+'\t{'+'\t\tdoc.$.designMode = "off";'+'\t\tdoc.$.designMode = "on";'+'\t}'+'}'+'})();');}})();})();i.disableObjectResizing=false;i.disableNativeTableHandles=true;i.disableNativeSpellChecker=true;i.ignoreEmptyParagraph=true;j.add('wsc',{requires:['dialog'],init:function(l){var m='checkspell',n=l.addCommand(m,new a.dialogCommand(m));n.modes={wysiwyg:!b.opera&&document.domain==window.location.hostname};l.ui.addButton('SpellChecker',{label:l.lang.spellCheck.toolbar,command:m});a.dialog.add(m,this.path+'dialogs/wsc.js');}});i.wsc_customerId=i.wsc_customerId||'1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk';i.wsc_customLoaderScript=i.wsc_customLoaderScript||null;a.DIALOG_RESIZE_NONE=0;a.DIALOG_RESIZE_WIDTH=1;a.DIALOG_RESIZE_HEIGHT=2;a.DIALOG_RESIZE_BOTH=3;(function(){function l(M){return!!this._.tabs[M][0].$.offsetHeight;};function m(){var Q=this;var M=Q._.currentTabId,N=Q._.tabIdList.length,O=e.indexOf(Q._.tabIdList,M)+N;for(var P=O-1;P>O-N;P--){if(l.call(Q,Q._.tabIdList[P%N]))return Q._.tabIdList[P%N];}return null;};function n(){var Q=this;var M=Q._.currentTabId,N=Q._.tabIdList.length,O=e.indexOf(Q._.tabIdList,M);for(var P=O+1;P<O+N;P++){if(l.call(Q,Q._.tabIdList[P%N]))return Q._.tabIdList[P%N];
-}return null;};a.dialog=function(M,N){var O=a.dialog._.dialogDefinitions[N];O=e.extend(O(M),p);O=e.clone(O);O=new t(this,O);var P=a.document,Q=M.theme.buildDialog(M);this._={editor:M,element:Q.element,name:N,contentSize:{width:0,height:0},size:{width:0,height:0},updateSize:false,contents:{},buttons:{},accessKeyMap:{},tabs:{},tabIdList:[],currentTabId:null,currentTabIndex:null,pageCount:0,lastTab:null,tabBarMode:false,focusList:[],currentFocusIndex:0,hasFocus:false};this.parts=Q.parts;e.setTimeout(function(){M.fire('ariaWidget',this.parts.contents);},0,this);this.parts.dialog.setStyles({position:b.ie6Compat?'absolute':'fixed',top:0,left:0,visibility:'hidden'});a.event.call(this);this.definition=O=a.fire('dialogDefinition',{name:N,definition:O},M).definition;if(O.onLoad)this.on('load',O.onLoad);if(O.onShow)this.on('show',O.onShow);if(O.onHide)this.on('hide',O.onHide);if(O.onOk)this.on('ok',function(ac){if(O.onOk.call(this,ac)===false)ac.data.hide=false;});if(O.onCancel)this.on('cancel',function(ac){if(O.onCancel.call(this,ac)===false)ac.data.hide=false;});var R=this,S=function(ac){var ad=R._.contents,ae=false;for(var af in ad)for(var ag in ad[af]){ae=ac.call(this,ad[af][ag]);if(ae)return;}};this.on('ok',function(ac){S(function(ad){if(ad.validate){var ae=ad.validate(this);if(typeof ae=='string'){alert(ae);ae=false;}if(ae===false){if(ad.select)ad.select();else ad.focus();ac.data.hide=false;ac.stop();return true;}}});},this,null,0);this.on('cancel',function(ac){S(function(ad){if(ad.isChanged()){if(!confirm(M.lang.common.confirmCancel))ac.data.hide=false;return true;}});},this,null,0);this.parts.close.on('click',function(ac){if(this.fire('cancel',{hide:true}).hide!==false)this.hide();ac.data.preventDefault();},this);function T(){var ac=R._.focusList;ac.sort(function(af,ag){if(af.tabIndex!=ag.tabIndex)return ag.tabIndex-af.tabIndex;else return af.focusIndex-ag.focusIndex;});var ad=ac.length;for(var ae=0;ae<ad;ae++)ac[ae].focusIndex=ae;};function U(ac){var ad=R._.focusList,ae=ac?1:-1;if(ad.length<1)return;var af=R._.currentFocusIndex;try{ad[af].getInputElement().$.blur();}catch(ai){}var ag=(af+ae+ad.length)%ad.length,ah=ag;while(!ad[ah].isFocusable()){ah=(ah+ae+ad.length)%ad.length;if(ah==ag)break;}ad[ah].focus();if(ad[ah].type=='text')ad[ah].select();};this.changeFocus=U;var V;function W(ac){var ah=this;if(R!=a.dialog._.currentTop)return;var ad=ac.data.getKeystroke(),ae=M.lang.dir=='rtl';V=0;if(ad==9||ad==2000+9){var af=ad==2000+9;if(R._.tabBarMode){var ag=af?m.call(R):n.call(R);
-R.selectPage(ag);R._.tabs[ag][0].focus();}else U(!af);V=1;}else if(ad==4000+121&&!R._.tabBarMode&&R.getPageCount()>1){R._.tabBarMode=true;R._.tabs[R._.currentTabId][0].focus();V=1;}else if((ad==37||ad==39)&&R._.tabBarMode){ag=ad==(ae?39:37)?m.call(R):n.call(R);R.selectPage(ag);R._.tabs[ag][0].focus();V=1;}else if((ad==13||ad==32)&&R._.tabBarMode){ah.selectPage(ah._.currentTabId);ah._.tabBarMode=false;ah._.currentFocusIndex=-1;U(true);V=1;}if(V){ac.stop();ac.data.preventDefault();}};function X(ac){V&&ac.data.preventDefault();};var Y=this._.element;this.on('show',function(){Y.on('keydown',W,this,null,0);if(b.opera||b.gecko&&b.mac)Y.on('keypress',X,this);});this.on('hide',function(){Y.removeListener('keydown',W);if(b.opera||b.gecko&&b.mac)Y.removeListener('keypress',X);});this.on('iframeAdded',function(ac){var ad=new g(ac.data.iframe.$.contentWindow.document);ad.on('keydown',W,this,null,0);});this.on('show',function(){var ag=this;T();if(M.config.dialog_startupFocusTab&&R._.tabIdList.length>1){R._.tabBarMode=true;R._.tabs[R._.currentTabId][0].focus();}else if(!ag._.hasFocus){ag._.currentFocusIndex=-1;if(O.onFocus){var ac=O.onFocus.call(ag);ac&&ac.focus();}else U(true);if(ag._.editor.mode=='wysiwyg'&&c){var ad=M.document.$.selection,ae=ad.createRange();if(ae)if(ae.parentElement&&ae.parentElement().ownerDocument==M.document.$||ae.item&&ae.item(0).ownerDocument==M.document.$){var af=document.body.createTextRange();af.moveToElementText(ag.getElement().getFirst().$);af.collapse(true);af.select();}}}},this,null,4294967295);if(b.ie6Compat)this.on('load',function(ac){var ad=this.getElement(),ae=ad.getFirst();ae.remove();ae.appendTo(ad);},this);v(this);w(this);new d.text(O.title,a.document).appendTo(this.parts.title);for(var Z=0;Z<O.contents.length;Z++)this.addPage(O.contents[Z]);this.parts.tabs.on('click',function(ac){var af=this;var ad=ac.data.getTarget();if(ad.hasClass('cke_dialog_tab')){var ae=ad.$.id;af.selectPage(ae.substr(0,ae.lastIndexOf('_')));if(af._.tabBarMode){af._.tabBarMode=false;af._.currentFocusIndex=-1;U(true);}ac.data.preventDefault();}},this);var aa=[],ab=a.dialog._.uiElementBuilders.hbox.build(this,{type:'hbox',className:'cke_dialog_footer_buttons',widths:[],children:O.buttons},aa).getChild();this.parts.footer.setHtml(aa.join(''));for(Z=0;Z<ab.length;Z++)this._.buttons[ab[Z].id]=ab[Z];};function o(M,N,O){this.element=N;this.focusIndex=O;this.tabIndex=0;this.isFocusable=function(){return!N.getAttribute('disabled')&&N.isVisible();};this.focus=function(){M._.currentFocusIndex=this.focusIndex;
-this.element.focus();};N.on('keydown',function(P){if(P.data.getKeystroke() in {32:1,13:1})this.fire('click');});N.on('focus',function(){this.fire('mouseover');});N.on('blur',function(){this.fire('mouseout');});};a.dialog.prototype={destroy:function(){this.hide();this._.element.remove();},resize:(function(){return function(M,N){var O=this;if(O._.contentSize&&O._.contentSize.width==M&&O._.contentSize.height==N)return;a.dialog.fire('resize',{dialog:O,skin:O._.editor.skinName,width:M,height:N},O._.editor);O._.contentSize={width:M,height:N};O._.updateSize=true;};})(),getSize:function(){var O=this;if(!O._.updateSize)return O._.size;var M=O._.element.getFirst(),N=O._.size={width:M.$.offsetWidth||0,height:M.$.offsetHeight||0};O._.updateSize=!N.width||!N.height;return N;},move:(function(){var M;return function(N,O){var R=this;var P=R._.element.getFirst();if(M===undefined)M=P.getComputedStyle('position')=='fixed';if(M&&R._.position&&R._.position.x==N&&R._.position.y==O)return;R._.position={x:N,y:O};if(!M){var Q=a.document.getWindow().getScrollPosition();N+=Q.x;O+=Q.y;}P.setStyles({left:(N>0?N:0)+'px',top:(O>0?O:0)+'px'});};})(),getPosition:function(){return e.extend({},this._.position);},show:function(){var M=this._.editor;if(M.mode=='wysiwyg'&&c){var N=M.getSelection();N&&N.lock();}var O=this._.element,P=this.definition;if(!(O.getParent()&&O.getParent().equals(a.document.getBody())))O.appendTo(a.document.getBody());else O.setStyle('display','block');if(b.gecko&&b.version<10900){var Q=this.parts.dialog;Q.setStyle('position','absolute');setTimeout(function(){Q.setStyle('position','fixed');},0);}this.resize(P.minWidth,P.minHeight);this.selectPage(this.definition.contents[0].id);this.reset();if(a.dialog._.currentZIndex===null)a.dialog._.currentZIndex=this._.editor.config.baseFloatZIndex;this._.element.getFirst().setStyle('z-index',a.dialog._.currentZIndex+=10);if(a.dialog._.currentTop===null){a.dialog._.currentTop=this;this._.parentDialog=null;A(this._.editor);O.on('keydown',E);O.on(b.opera?'keypress':'keyup',F);for(var R in {keyup:1,keydown:1,keypress:1})O.on(R,L);}else{this._.parentDialog=a.dialog._.currentTop;var S=this._.parentDialog.getElement().getFirst();S.$.style.zIndex-=Math.floor(this._.editor.config.baseFloatZIndex/2);a.dialog._.currentTop=this;}G(this,this,'\x1b',null,function(){this.getButton('cancel')&&this.getButton('cancel').click();});this._.hasFocus=false;e.setTimeout(function(){var T=a.document.getWindow().getViewPaneSize(),U=this.getSize();this.move((T.width-P.minWidth)/2,(T.height-U.height)/2);
-this.parts.dialog.setStyle('visibility','');this.fireOnce('load',{});this.fire('show',{});this._.editor.fire('dialogShow',this);this.foreach(function(V){V.setInitValue&&V.setInitValue();});},100,this);},foreach:function(M){var P=this;for(var N in P._.contents)for(var O in P._.contents[N])M(P._.contents[N][O]);return P;},reset:(function(){var M=function(N){if(N.reset)N.reset();};return function(){this.foreach(M);return this;};})(),setupContent:function(){var M=arguments;this.foreach(function(N){if(N.setup)N.setup.apply(N,M);});},commitContent:function(){var M=arguments;this.foreach(function(N){if(N.commit)N.commit.apply(N,M);});},hide:function(){if(!this.parts.dialog.isVisible())return;this.fire('hide',{});this._.editor.fire('dialogHide',this);var M=this._.element;M.setStyle('display','none');this.parts.dialog.setStyle('visibility','hidden');H(this);while(a.dialog._.currentTop!=this)a.dialog._.currentTop.hide();if(!this._.parentDialog)B();else{var N=this._.parentDialog.getElement().getFirst();N.setStyle('z-index',parseInt(N.$.style.zIndex,10)+Math.floor(this._.editor.config.baseFloatZIndex/2));}a.dialog._.currentTop=this._.parentDialog;if(!this._.parentDialog){a.dialog._.currentZIndex=null;M.removeListener('keydown',E);M.removeListener(b.opera?'keypress':'keyup',F);for(var O in {keyup:1,keydown:1,keypress:1})M.removeListener(O,L);var P=this._.editor;P.focus();if(P.mode=='wysiwyg'&&c){var Q=P.getSelection();Q&&Q.unlock(true);}}else a.dialog._.currentZIndex-=10;delete this._.parentDialog;this.foreach(function(R){R.resetInitValue&&R.resetInitValue();});},addPage:function(M){var Y=this;var N=[],O=M.label?' title="'+e.htmlEncode(M.label)+'"':'',P=M.elements,Q=a.dialog._.uiElementBuilders.vbox.build(Y,{type:'vbox',className:'cke_dialog_page_contents',children:M.elements,expand:!!M.expand,padding:M.padding,style:M.style||'width: 100%; height: 100%;'},N),R=h.createFromHtml(N.join(''));R.setAttribute('role','tabpanel');var S=b,T=M.id+'_'+e.getNextNumber(),U=h.createFromHtml(['<a class="cke_dialog_tab"',Y._.pageCount>0?' cke_last':'cke_first',O,!!M.hidden?' style="display:none"':'',' id="',T,'"',S.gecko&&S.version>=10900&&!S.hc?'':' href="javascript:void(0)"',' tabIndex="-1"',' hidefocus="true"',' role="tab">',M.label,'</a>'].join(''));R.setAttribute('aria-labelledby',T);Y._.tabs[M.id]=[U,R];Y._.tabIdList.push(M.id);!M.hidden&&Y._.pageCount++;Y._.lastTab=U;Y.updateStyle();var V=Y._.contents[M.id]={},W,X=Q.getChild();while(W=X.shift()){V[W.id]=W;if(typeof W.getChild=='function')X.push.apply(X,W.getChild());
-}R.setAttribute('name',M.id);R.appendTo(Y.parts.contents);U.unselectable();Y.parts.tabs.append(U);if(M.accessKey){G(Y,Y,'CTRL+'+M.accessKey,J,I);Y._.accessKeyMap['CTRL+'+M.accessKey]=M.id;}},selectPage:function(M){var R=this;for(var N in R._.tabs){var O=R._.tabs[N][0],P=R._.tabs[N][1];if(N!=M){O.removeClass('cke_dialog_tab_selected');P.hide();}P.setAttribute('aria-hidden',N!=M);}var Q=R._.tabs[M];Q[0].addClass('cke_dialog_tab_selected');Q[1].show();R._.currentTabId=M;R._.currentTabIndex=e.indexOf(R._.tabIdList,M);},updateStyle:function(){this.parts.dialog[(this._.pageCount===1?'add':'remove')+'Class']('cke_single_page');},hidePage:function(M){var O=this;var N=O._.tabs[M]&&O._.tabs[M][0];if(!N||O._.pageCount==1)return;else if(M==O._.currentTabId)O.selectPage(m.call(O));N.hide();O._.pageCount--;O.updateStyle();},showPage:function(M){var O=this;var N=O._.tabs[M]&&O._.tabs[M][0];if(!N)return;N.show();O._.pageCount++;O.updateStyle();},getElement:function(){return this._.element;},getName:function(){return this._.name;},getContentElement:function(M,N){var O=this._.contents[M];return O&&O[N];},getValueOf:function(M,N){return this.getContentElement(M,N).getValue();},setValueOf:function(M,N,O){return this.getContentElement(M,N).setValue(O);},getButton:function(M){return this._.buttons[M];},click:function(M){return this._.buttons[M].click();},disableButton:function(M){return this._.buttons[M].disable();},enableButton:function(M){return this._.buttons[M].enable();},getPageCount:function(){return this._.pageCount;},getParentEditor:function(){return this._.editor;},getSelectedElement:function(){return this.getParentEditor().getSelection().getSelectedElement();},addFocusable:function(M,N){var P=this;if(typeof N=='undefined'){N=P._.focusList.length;P._.focusList.push(new o(P,M,N));}else{P._.focusList.splice(N,0,new o(P,M,N));for(var O=N+1;O<P._.focusList.length;O++)P._.focusList[O].focusIndex++;}}};e.extend(a.dialog,{add:function(M,N){if(!this._.dialogDefinitions[M]||typeof N=='function')this._.dialogDefinitions[M]=N;},exists:function(M){return!!this._.dialogDefinitions[M];},getCurrent:function(){return a.dialog._.currentTop;},okButton:(function(){var M=function(N,O){O=O||{};return e.extend({id:'ok',type:'button',label:N.lang.common.ok,'class':'cke_dialog_ui_button_ok',onClick:function(P){var Q=P.data.dialog;if(Q.fire('ok',{hide:true}).hide!==false)Q.hide();}},O,true);};M.type='button';M.override=function(N){return e.extend(function(O){return M(O,N);},{type:'button'},true);
-};return M;})(),cancelButton:(function(){var M=function(N,O){O=O||{};return e.extend({id:'cancel',type:'button',label:N.lang.common.cancel,'class':'cke_dialog_ui_button_cancel',onClick:function(P){var Q=P.data.dialog;if(Q.fire('cancel',{hide:true}).hide!==false)Q.hide();}},O,true);};M.type='button';M.override=function(N){return e.extend(function(O){return M(O,N);},{type:'button'},true);};return M;})(),addUIElement:function(M,N){this._.uiElementBuilders[M]=N;}});a.dialog._={uiElementBuilders:{},dialogDefinitions:{},currentTop:null,currentZIndex:null};a.event.implementOn(a.dialog);a.event.implementOn(a.dialog.prototype,true);var p={resizable:3,minWidth:600,minHeight:400,buttons:[a.dialog.okButton,a.dialog.cancelButton]};b.mac&&p.buttons.reverse();var q=function(M,N,O){for(var P=0,Q;Q=M[P];P++){if(Q.id==N)return Q;if(O&&Q[O]){var R=q(Q[O],N,O);if(R)return R;}}return null;},r=function(M,N,O,P,Q){if(O){for(var R=0,S;S=M[R];R++){if(S.id==O){M.splice(R,0,N);return N;}if(P&&S[P]){var T=r(S[P],N,O,P,true);if(T)return T;}}if(Q)return null;}M.push(N);return N;},s=function(M,N,O){for(var P=0,Q;Q=M[P];P++){if(Q.id==N)return M.splice(P,1);if(O&&Q[O]){var R=s(Q[O],N,O);if(R)return R;}}return null;},t=function(M,N){this.dialog=M;var O=N.contents;for(var P=0,Q;Q=O[P];P++)O[P]=new u(M,Q);e.extend(this,N);};t.prototype={getContents:function(M){return q(this.contents,M);},getButton:function(M){return q(this.buttons,M);},addContents:function(M,N){return r(this.contents,M,N);},addButton:function(M,N){return r(this.buttons,M,N);},removeContents:function(M){s(this.contents,M);},removeButton:function(M){s(this.buttons,M);}};function u(M,N){this._={dialog:M};e.extend(this,N);};u.prototype={get:function(M){return q(this.elements,M,'children');},add:function(M,N){return r(this.elements,M,N,'children');},remove:function(M){s(this.elements,M,'children');}};function v(M){var N=null,O=null,P=M.getElement().getFirst(),Q=M.getParentEditor(),R=Q.config.dialog_magnetDistance,S=Q.skin.margins||[0,0,0,0];if(typeof R=='undefined')R=20;function T(V){var W=M.getSize(),X=a.document.getWindow().getViewPaneSize(),Y=V.data.$.screenX,Z=V.data.$.screenY,aa=Y-N.x,ab=Z-N.y,ac,ad;N={x:Y,y:Z};O.x+=aa;O.y+=ab;if(O.x+S[3]<R)ac=-S[3];else if(O.x-S[1]>X.width-W.width-R)ac=X.width-W.width+S[1];else ac=O.x;if(O.y+S[0]<R)ad=-S[0];else if(O.y-S[2]>X.height-W.height-R)ad=X.height-W.height+S[2];else ad=O.y;M.move(ac,ad);V.data.preventDefault();};function U(V){a.document.removeListener('mousemove',T);a.document.removeListener('mouseup',U);
-if(b.ie6Compat){var W=z.getChild(0).getFrameDocument();W.removeListener('mousemove',T);W.removeListener('mouseup',U);}};M.parts.title.on('mousedown',function(V){M._.updateSize=true;N={x:V.data.$.screenX,y:V.data.$.screenY};a.document.on('mousemove',T);a.document.on('mouseup',U);O=M.getPosition();if(b.ie6Compat){var W=z.getChild(0).getFrameDocument();W.on('mousemove',T);W.on('mouseup',U);}V.data.preventDefault();},M);};function w(M){var N=M.definition,O=N.minWidth||0,P=N.minHeight||0,Q=N.resizable,R=M.getParentEditor().skin.margins||[0,0,0,0];function S(ad,ae){ad.y+=ae;};function T(ad,ae){ad.x2+=ae;};function U(ad,ae){ad.y2+=ae;};function V(ad,ae){ad.x+=ae;};var W=null,X=null,Y=M._.editor.config.magnetDistance,Z=['tl','t','tr','l','r','bl','b','br'];function aa(ad){var ae=ad.listenerData.part,af=M.getSize();X=M.getPosition();e.extend(X,{x2:X.x+af.width,y2:X.y+af.height});W={x:ad.data.$.screenX,y:ad.data.$.screenY};a.document.on('mousemove',ab,M,{part:ae});a.document.on('mouseup',ac,M,{part:ae});if(b.ie6Compat){var ag=z.getChild(0).getFrameDocument();ag.on('mousemove',ab,M,{part:ae});ag.on('mouseup',ac,M,{part:ae});}ad.data.preventDefault();};function ab(ad){var ae=ad.data.$.screenX,af=ad.data.$.screenY,ag=ae-W.x,ah=af-W.y,ai=a.document.getWindow().getViewPaneSize(),aj=ad.listenerData.part;if(aj.search('t')!=-1)S(X,ah);if(aj.search('l')!=-1)V(X,ag);if(aj.search('b')!=-1)U(X,ah);if(aj.search('r')!=-1)T(X,ag);W={x:ae,y:af};var ak,al,am,an;if(X.x+R[3]<Y)ak=-R[3];else if(aj.search('l')!=-1&&X.x2-X.x<O+Y)ak=X.x2-O;else ak=X.x;if(X.y+R[0]<Y)al=-R[0];else if(aj.search('t')!=-1&&X.y2-X.y<P+Y)al=X.y2-P;else al=X.y;if(X.x2-R[1]>ai.width-Y)am=ai.width+R[1];else if(aj.search('r')!=-1&&X.x2-X.x<O+Y)am=X.x+O;else am=X.x2;if(X.y2-R[2]>ai.height-Y)an=ai.height+R[2];else if(aj.search('b')!=-1&&X.y2-X.y<P+Y)an=X.y+P;else an=X.y2;M.move(ak,al);M.resize(am-ak,an-al);ad.data.preventDefault();};function ac(ad){a.document.removeListener('mouseup',ac);a.document.removeListener('mousemove',ab);if(b.ie6Compat){var ae=z.getChild(0).getFrameDocument();ae.removeListener('mouseup',ac);ae.removeListener('mousemove',ab);}};};var x,y={},z;function A(M){var N=a.document.getWindow(),O=M.config.dialog_backgroundCoverColor||'white',P=M.config.dialog_backgroundCoverOpacity,Q=M.config.baseFloatZIndex,R=e.genKey(O,P,Q),S=y[R];if(!S){var T=['<div style="position: ',b.ie6Compat?'absolute':'fixed','; z-index: ',Q,'; top: 0px; left: 0px; ',!b.ie6Compat?'background-color: '+O:'','" class="cke_dialog_background_cover">'];
-if(b.ie6Compat){var U=b.isCustomDomain(),V="<html><body style=\\'background-color:"+O+";\\'></body></html>";T.push('<iframe hidefocus="true" frameborder="0" id="cke_dialog_background_iframe" src="javascript:');T.push('void((function(){document.open();'+(U?"document.domain='"+document.domain+"';":'')+"document.write( '"+V+"' );"+'document.close();'+'})())');T.push('" style="position:absolute;left:0;top:0;width:100%;height: 100%;progid:DXImageTransform.Microsoft.Alpha(opacity=0)"></iframe>');}T.push('</div>');S=h.createFromHtml(T.join(''));S.setOpacity(P!=undefined?P:0.5);S.appendTo(a.document.getBody());y[R]=S;}else S.show();z=S;var W=function(){var Z=N.getViewPaneSize();S.setStyles({width:Z.width+'px',height:Z.height+'px'});},X=function(){var Z=N.getScrollPosition(),aa=a.dialog._.currentTop;S.setStyles({left:Z.x+'px',top:Z.y+'px'});do{var ab=aa.getPosition();aa.move(ab.x,ab.y);}while(aa=aa._.parentDialog)};x=W;N.on('resize',W);W();if(b.ie6Compat){var Y=function(){X();arguments.callee.prevScrollHandler.apply(this,arguments);};N.$.setTimeout(function(){Y.prevScrollHandler=window.onscroll||(function(){});window.onscroll=Y;},0);X();}};function B(){if(!z)return;var M=a.document.getWindow();z.hide();M.removeListener('resize',x);if(b.ie6Compat)M.$.setTimeout(function(){var N=window.onscroll&&window.onscroll.prevScrollHandler;window.onscroll=N||null;},0);x=null;};function C(){for(var M in y)y[M].remove();y={};};var D={},E=function(M){var N=M.data.$.ctrlKey||M.data.$.metaKey,O=M.data.$.altKey,P=M.data.$.shiftKey,Q=String.fromCharCode(M.data.$.keyCode),R=D[(N?'CTRL+':'')+(O?'ALT+':'')+(P?'SHIFT+':'')+Q];if(!R||!R.length)return;R=R[R.length-1];R.keydown&&R.keydown.call(R.uiElement,R.dialog,R.key);M.data.preventDefault();},F=function(M){var N=M.data.$.ctrlKey||M.data.$.metaKey,O=M.data.$.altKey,P=M.data.$.shiftKey,Q=String.fromCharCode(M.data.$.keyCode),R=D[(N?'CTRL+':'')+(O?'ALT+':'')+(P?'SHIFT+':'')+Q];if(!R||!R.length)return;R=R[R.length-1];if(R.keyup){R.keyup.call(R.uiElement,R.dialog,R.key);M.data.preventDefault();}},G=function(M,N,O,P,Q){var R=D[O]||(D[O]=[]);R.push({uiElement:M,dialog:N,key:O,keyup:Q||M.accessKeyUp,keydown:P||M.accessKeyDown});},H=function(M){for(var N in D){var O=D[N];for(var P=O.length-1;P>=0;P--){if(O[P].dialog==M||O[P].uiElement==M)O.splice(P,1);}if(O.length===0)delete D[N];}},I=function(M,N){if(M._.accessKeyMap[N])M.selectPage(M._.accessKeyMap[N]);},J=function(M,N){},K={27:1,13:1},L=function(M){if(M.data.getKeystroke() in K)M.data.stopPropagation();
-};(function(){k.dialog={uiElement:function(M,N,O,P,Q,R,S){if(arguments.length<4)return;var T=(P.call?P(N):P)||'div',U=['<',T,' '],V=(Q&&Q.call?Q(N):Q)||{},W=(R&&R.call?R(N):R)||{},X=(S&&S.call?S.call(this,M,N):S)||'',Y=this.domId=W.id||e.getNextNumber()+'_uiElement',Z=this.id=N.id,aa;W.id=Y;var ab={};if(N.type)ab['cke_dialog_ui_'+N.type]=1;if(N.className)ab[N.className]=1;var ac=W['class']&&W['class'].split?W['class'].split(' '):[];for(aa=0;aa<ac.length;aa++){if(ac[aa])ab[ac[aa]]=1;}var ad=[];for(aa in ab)ad.push(aa);W['class']=ad.join(' ');if(N.title)W.title=N.title;var ae=(N.style||'').split(';');for(aa in V)ae.push(aa+':'+V[aa]);if(N.hidden)ae.push('display:none');for(aa=ae.length-1;aa>=0;aa--){if(ae[aa]==='')ae.splice(aa,1);}if(ae.length>0)W.style=(W.style?W.style+'; ':'')+ae.join('; ');for(aa in W)U.push(aa+'="'+e.htmlEncode(W[aa])+'" ');U.push('>',X,'</',T,'>');O.push(U.join(''));(this._||(this._={})).dialog=M;if(typeof N.isChanged=='boolean')this.isChanged=function(){return N.isChanged;};if(typeof N.isChanged=='function')this.isChanged=N.isChanged;a.event.implementOn(this);this.registerEvents(N);if(this.accessKeyUp&&this.accessKeyDown&&N.accessKey)G(this,M,'CTRL+'+N.accessKey);var af=this;M.on('load',function(){if(af.getInputElement())af.getInputElement().on('focus',function(){M._.tabBarMode=false;M._.hasFocus=true;af.fire('focus');},af);});if(this.keyboardFocusable){this.tabIndex=N.tabIndex||0;this.focusIndex=M._.focusList.push(this)-1;this.on('focus',function(){M._.currentFocusIndex=af.focusIndex;});}e.extend(this,N);},hbox:function(M,N,O,P,Q){if(arguments.length<4)return;this._||(this._={});var R=this._.children=N,S=Q&&Q.widths||null,T=Q&&Q.height||null,U={},V,W=function(){var Y=['<tbody><tr class="cke_dialog_ui_hbox">'];for(V=0;V<O.length;V++){var Z='cke_dialog_ui_hbox_child',aa=[];if(V===0)Z='cke_dialog_ui_hbox_first';if(V==O.length-1)Z='cke_dialog_ui_hbox_last';Y.push('<td class="',Z,'" role="presentation" ');if(S){if(S[V])aa.push('width:'+e.cssLength(S[V]));}else aa.push('width:'+Math.floor(100/O.length)+'%');if(T)aa.push('height:'+e.cssLength(T));if(Q&&Q.padding!=undefined)aa.push('padding:'+e.cssLength(Q.padding));if(aa.length>0)Y.push('style="'+aa.join('; ')+'" ');Y.push('>',O[V],'</td>');}Y.push('</tr></tbody>');return Y.join('');},X={role:'presentation'};Q&&Q.align&&(X.align=Q.align);k.dialog.uiElement.call(this,M,Q||{type:'hbox'},P,'table',U,X,W);},vbox:function(M,N,O,P,Q){if(arguments.length<3)return;this._||(this._={});var R=this._.children=N,S=Q&&Q.width||null,T=Q&&Q.heights||null,U=function(){var V=['<table role="presentation" cellspacing="0" border="0" '];
-V.push('style="');if(Q&&Q.expand)V.push('height:100%;');V.push('width:'+e.cssLength(S||'100%'),';');V.push('"');V.push('align="',e.htmlEncode(Q&&Q.align||(M.getParentEditor().lang.dir=='ltr'?'left':'right')),'" ');V.push('><tbody>');for(var W=0;W<O.length;W++){var X=[];V.push('<tr><td role="presentation" ');if(S)X.push('width:'+e.cssLength(S||'100%'));if(T)X.push('height:'+e.cssLength(T[W]));else if(Q&&Q.expand)X.push('height:'+Math.floor(100/O.length)+'%');if(Q&&Q.padding!=undefined)X.push('padding:'+e.cssLength(Q.padding));if(X.length>0)V.push('style="',X.join('; '),'" ');V.push(' class="cke_dialog_ui_vbox_child">',O[W],'</td></tr>');}V.push('</tbody></table>');return V.join('');};k.dialog.uiElement.call(this,M,Q||{type:'vbox'},P,'div',null,{role:'presentation'},U);}};})();k.dialog.uiElement.prototype={getElement:function(){return a.document.getById(this.domId);},getInputElement:function(){return this.getElement();},getDialog:function(){return this._.dialog;},setValue:function(M){this.getInputElement().setValue(M);this.fire('change',{value:M});return this;},getValue:function(){return this.getInputElement().getValue();},isChanged:function(){return false;},selectParentTab:function(){var P=this;var M=P.getInputElement(),N=M,O;while((N=N.getParent())&&N.$.className.search('cke_dialog_page_contents')==-1){}if(!N)return P;O=N.getAttribute('name');if(P._.dialog._.currentTabId!=O)P._.dialog.selectPage(O);return P;},focus:function(){this.selectParentTab().getInputElement().focus();return this;},registerEvents:function(M){var N=/^on([A-Z]\w+)/,O,P=function(R,S,T,U){S.on('load',function(){R.getInputElement().on(T,U,R);});};for(var Q in M){if(!(O=Q.match(N)))continue;if(this.eventProcessors[Q])this.eventProcessors[Q].call(this,this._.dialog,M[Q]);else P(this,this._.dialog,O[1].toLowerCase(),M[Q]);}return this;},eventProcessors:{onLoad:function(M,N){M.on('load',N,this);},onShow:function(M,N){M.on('show',N,this);},onHide:function(M,N){M.on('hide',N,this);}},accessKeyDown:function(M,N){this.focus();},accessKeyUp:function(M,N){},disable:function(){var M=this.getInputElement();M.setAttribute('disabled','true');M.addClass('cke_disabled');},enable:function(){var M=this.getInputElement();M.removeAttribute('disabled');M.removeClass('cke_disabled');},isEnabled:function(){return!this.getInputElement().getAttribute('disabled');},isVisible:function(){return this.getInputElement().isVisible();},isFocusable:function(){if(!this.isEnabled()||!this.isVisible())return false;return true;
-}};k.dialog.hbox.prototype=e.extend(new k.dialog.uiElement(),{getChild:function(M){var N=this;if(arguments.length<1)return N._.children.concat();if(!M.splice)M=[M];if(M.length<2)return N._.children[M[0]];else return N._.children[M[0]]&&N._.children[M[0]].getChild?N._.children[M[0]].getChild(M.slice(1,M.length)):null;}},true);k.dialog.vbox.prototype=new k.dialog.hbox();(function(){var M={build:function(N,O,P){var Q=O.children,R,S=[],T=[];for(var U=0;U<Q.length&&(R=Q[U]);U++){var V=[];S.push(V);T.push(a.dialog._.uiElementBuilders[R.type].build(N,R,V));}return new k.dialog[O.type](N,T,S,P,O);}};a.dialog.addUIElement('hbox',M);a.dialog.addUIElement('vbox',M);})();a.dialogCommand=function(M){this.dialogName=M;};a.dialogCommand.prototype={exec:function(M){M.openDialog(this.dialogName);},canUndo:false,editorFocus:c||b.webkit};(function(){var M=/^([a]|[^a])+$/,N=/^\d*$/,O=/^\d*(?:\.\d+)?$/;a.VALIDATE_OR=1;a.VALIDATE_AND=2;a.dialog.validate={functions:function(){return function(){var V=this;var P=V&&V.getValue?V.getValue():arguments[0],Q=undefined,R=2,S=[],T;for(T=0;T<arguments.length;T++){if(typeof arguments[T]=='function')S.push(arguments[T]);else break;}if(T<arguments.length&&typeof arguments[T]=='string'){Q=arguments[T];T++;}if(T<arguments.length&&typeof arguments[T]=='number')R=arguments[T];var U=R==2?true:false;for(T=0;T<S.length;T++){if(R==2)U=U&&S[T](P);else U=U||S[T](P);}if(!U){if(Q!==undefined)alert(Q);if(V&&(V.select||V.focus))V.select||V.focus();return false;}return true;};},regex:function(P,Q){return function(){var S=this;var R=S&&S.getValue?S.getValue():arguments[0];if(!P.test(R)){if(Q!==undefined)alert(Q);if(S&&(S.select||S.focus))if(S.select)S.select();else S.focus();return false;}return true;};},notEmpty:function(P){return this.regex(M,P);},integer:function(P){return this.regex(N,P);},number:function(P){return this.regex(O,P);},equals:function(P,Q){return this.functions(function(R){return R==P;},Q);},notEqual:function(P,Q){return this.functions(function(R){return R!=P;},Q);}};a.on('instanceDestroyed',function(P){if(e.isEmpty(a.instances)){var Q;while(Q=a.dialog._.currentTop)Q.hide();C();}var R=P.editor._.storedDialogs;for(var S in R)R[S].destroy();});})();})();e.extend(a.editor.prototype,{openDialog:function(l,m){var n=a.dialog._.dialogDefinitions[l],o=this.skin.dialog;if(typeof n=='function'&&o._isLoaded){var p=this._.storedDialogs||(this._.storedDialogs={}),q=p[l]||(p[l]=new a.dialog(this,l));m&&m.call(q,q);q.show();return q;}else if(n=='failed')throw new Error('[CKEDITOR.dialog.openDialog] Dialog "'+l+'" failed when loading definition.');
-var r=a.document.getBody(),s=r.$.style.cursor,t=this;r.setStyle('cursor','wait');function u(w){var x=a.dialog._.dialogDefinitions[l],y=t.skin.dialog;if(!y._isLoaded||v&&typeof w=='undefined')return;if(typeof x!='function')a.dialog._.dialogDefinitions[l]='failed';t.openDialog(l,m);r.setStyle('cursor',s);};if(typeof n=='string'){var v=1;a.scriptLoader.load(a.getUrl(n),u);}a.skins.load(this,'dialog',u);return null;}});j.add('dialog',{requires:['dialogui']});j.add('styles',{requires:['selection']});a.editor.prototype.attachStyleStateChange=function(l,m){var n=this._.styleStateChangeCallbacks;if(!n){n=this._.styleStateChangeCallbacks=[];this.on('selectionChange',function(o){for(var p=0;p<n.length;p++){var q=n[p],r=q.style.checkActive(o.data.path)?1:2;if(q.state!==r){q.fn.call(this,r);q.state!==r;}}});}n.push({style:l,fn:m});};a.STYLE_BLOCK=1;a.STYLE_INLINE=2;a.STYLE_OBJECT=3;(function(){var l={address:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1},m={a:1,embed:1,hr:1,img:1,li:1,object:1,ol:1,table:1,td:1,tr:1,th:1,ul:1,dl:1,dt:1,dd:1,form:1},n=/\s*(?:;\s*|$)/;a.style=function(N,O){if(O){N=e.clone(N);F(N.attributes,O);F(N.styles,O);}var P=this.element=(N.element||'*').toLowerCase();this.type=P=='#'||l[P]?1:m[P]?3:2;this._={definition:N};};a.style.prototype={apply:function(N){M.call(this,N,false);},remove:function(N){M.call(this,N,true);},applyToRange:function(N){var O=this;return(O.applyToRange=O.type==2?o:O.type==1?r:O.type==3?q:null).call(O,N);},removeFromRange:function(N){return(this.removeFromRange=this.type==2?p:null).call(this,N);},applyToObject:function(N){D(N,this);},checkActive:function(N){var R=this;switch(R.type){case 1:return R.checkElementRemovable(N.block||N.blockLimit,true);case 3:case 2:var O=N.elements;for(var P=0,Q;P<O.length;P++){Q=O[P];if(R.type==2&&(Q==N.block||Q==N.blockLimit))continue;if(R.type==3&&!(Q.getName() in m))continue;if(R.checkElementRemovable(Q,true))return true;}}return false;},checkApplicable:function(N){switch(this.type){case 2:case 1:break;case 3:return N.lastElement.getAscendant(this.element,true);}return true;},checkElementRemovable:function(N,O){if(!N)return false;var P=this._.definition,Q;if(N.getName()==this.element){if(!O&&!N.hasAttributes())return true;Q=G(P);if(Q._length){for(var R in Q){if(R=='_length')continue;var S=N.getAttribute(R)||'';if(R=='style'?L(Q[R],J(S,false)):Q[R]==S){if(!O)return true;}else if(O)return false;}if(O)return true;}else return true;}var T=H(this)[N.getName()];if(T){if(!(Q=T.attributes))return true;
-for(var U=0;U<Q.length;U++){R=Q[U][0];var V=N.getAttribute(R);if(V){var W=Q[U][1];if(W===null||typeof W=='string'&&V==W||W.test(V))return true;}}}return false;},buildPreview:function(){var N=this._.definition,O=[],P=N.element;if(P=='bdo')P='span';O=['<',P];var Q=N.attributes;if(Q)for(var R in Q)O.push(' ',R,'="',Q[R],'"');var S=a.style.getStyleText(N);if(S)O.push(' style="',S,'"');O.push('>',N.name,'</',P,'>');return O.join('');}};a.style.getStyleText=function(N){var O=N._ST;if(O)return O;O=N.styles;var P=N.attributes&&N.attributes.style||'',Q='';if(P.length)P=P.replace(n,';');for(var R in O){var S=O[R],T=(R+':'+S).replace(n,';');if(S=='inherit')Q+=T;else P+=T;}if(P.length)P=J(P);P+=Q;return N._ST=P;};function o(N){var ak=this;var O=N.document;if(N.collapsed){var P=C(ak,O);N.insertNode(P);N.moveToPosition(P,2);return;}var Q=ak.element,R=ak._.definition,S,T=f[Q]||(S=true,f.span),U=N.createBookmark();N.enlarge(1);N.trim();var V=N.createBookmark(),W=V.startNode,X=V.endNode,Y=W,Z;while(Y){var aa=false;if(Y.equals(X)){Y=null;aa=true;}else{var ab=Y.type,ac=ab==1?Y.getName():null;if(ac&&Y.getAttribute('_fck_bookmark')){Y=Y.getNextSourceNode(true);continue;}if(!ac||T[ac]&&(Y.getPosition(X)|4|0|8)==4+0+8&&(!R.childRule||R.childRule(Y))){var ad=Y.getParent();if(ad&&((ad.getDtd()||f.span)[Q]||S)&&(!R.parentRule||R.parentRule(ad))){if(!Z&&(!ac||!f.$removeEmpty[ac]||(Y.getPosition(X)|4|0|8)==4+0+8)){Z=new d.range(O);Z.setStartBefore(Y);}if(ab==3||ab==1&&!Y.getChildCount()){var ae=Y,af;while(!ae.$.nextSibling&&(af=ae.getParent(),T[af.getName()])&&(af.getPosition(W)|2|0|8)==2+0+8&&(!R.childRule||R.childRule(af)))ae=af;Z.setEndAfter(ae);if(!ae.$.nextSibling)aa=true;}}else aa=true;}else aa=true;Y=Y.getNextSourceNode();}if(aa&&Z&&!Z.collapsed){var ag=C(ak,O),ah=Z.getCommonAncestor();while(ag&&ah){if(ah.getName()==Q){for(var ai in R.attributes){if(ag.getAttribute(ai)==ah.getAttribute(ai))ag.removeAttribute(ai);}for(var aj in R.styles){if(ag.getStyle(aj)==ah.getStyle(aj))ag.removeStyle(aj);}if(!ag.hasAttributes()){ag=null;break;}}ah=ah.getParent();}if(ag){Z.extractContents().appendTo(ag);z(ak,ag);Z.insertNode(ag);ag.mergeSiblings();if(!c)ag.$.normalize();}Z=null;}}W.remove();X.remove();N.moveToBookmark(U);N.shrink(2);};function p(N){N.enlarge(1);var O=N.createBookmark(),P=O.startNode;if(N.collapsed){var Q=new d.elementPath(P.getParent()),R;for(var S=0,T;S<Q.elements.length&&(T=Q.elements[S]);S++){if(T==Q.block||T==Q.blockLimit)break;if(this.checkElementRemovable(T)){var U=N.checkBoundaryOfElement(T,2),V=!U&&N.checkBoundaryOfElement(T,1);
-if(V||U){R=T;R.match=V?'start':'end';}else{T.mergeSiblings();y(this,T);}}}if(R){var W=P;for(S=0;true;S++){var X=Q.elements[S];if(X.equals(R))break;else if(X.match)continue;else X=X.clone();X.append(W);W=X;}W[R.match=='start'?'insertBefore':'insertAfter'](R);}}else{var Y=O.endNode,Z=this;function aa(){var ad=new d.elementPath(P.getParent()),ae=new d.elementPath(Y.getParent()),af=null,ag=null;for(var ah=0;ah<ad.elements.length;ah++){var ai=ad.elements[ah];if(ai==ad.block||ai==ad.blockLimit)break;if(Z.checkElementRemovable(ai))af=ai;}for(ah=0;ah<ae.elements.length;ah++){ai=ae.elements[ah];if(ai==ae.block||ai==ae.blockLimit)break;if(Z.checkElementRemovable(ai))ag=ai;}if(ag)Y.breakParent(ag);if(af)P.breakParent(af);};aa();var ab=P.getNext();while(!ab.equals(Y)){var ac=ab.getNextSourceNode();if(ab.type==1&&this.checkElementRemovable(ab)){if(ab.getName()==this.element)y(this,ab);else A(ab,H(this)[ab.getName()]);if(ac.type==1&&ac.contains(P)){aa();ac=P.getNext();}}ab=ac;}}N.moveToBookmark(O);};function q(N){var O=N.getCommonAncestor(true,true),P=O.getAscendant(this.element,true);P&&D(P,this);};function r(N){var O=N.createBookmark(true),P=N.createIterator();P.enforceRealBlocks=true;if(this._.enterMode)P.enlargeBr=this._.enterMode!=2;var Q,R=N.document,S;while(Q=P.getNextParagraph()){var T=C(this,R);s(Q,T);}N.moveToBookmark(O);};function s(N,O){var P=O.is('pre'),Q=N.is('pre'),R=P&&!Q,S=!P&&Q;if(R)O=x(N,O);else if(S)O=w(u(N),O);else N.moveChildren(O);O.replace(N);if(P)t(O);};function t(N){var O;if(!((O=N.getPreviousSourceNode(true,1))&&O.is&&O.is('pre')))return;var P=v(O.getHtml(),/\n$/,'')+'\n\n'+v(N.getHtml(),/^\n/,'');if(c)N.$.outerHTML='<pre>'+P+'</pre>';else N.setHtml(P);O.remove();};function u(N){var O=/(\S\s*)\n(?:\s|(<span[^>]+_fck_bookmark.*?\/span>))*\n(?!$)/gi,P=N.getName(),Q=v(N.getOuterHtml(),O,function(S,T,U){return T+'</pre>'+U+'<pre>';}),R=[];Q.replace(/<pre\b.*?>([\s\S]*?)<\/pre>/gi,function(S,T){R.push(T);});return R;};function v(N,O,P){var Q='',R='';N=N.replace(/(^<span[^>]+_fck_bookmark.*?\/span>)|(<span[^>]+_fck_bookmark.*?\/span>$)/gi,function(S,T,U){T&&(Q=T);U&&(R=U);return '';});return Q+N.replace(O,P)+R;};function w(N,O){var P=new d.documentFragment(O.getDocument());for(var Q=0;Q<N.length;Q++){var R=N[Q];R=R.replace(/(\r\n|\r)/g,'\n');R=v(R,/^[ \t]*\n/,'');R=v(R,/\n$/,'');R=v(R,/^[ \t]+|[ \t]+$/g,function(T,U,V){if(T.length==1)return ' ';else if(!U)return e.repeat(' ',T.length-1)+' ';else return ' '+e.repeat(' ',T.length-1);});R=R.replace(/\n/g,'<br>');
-R=R.replace(/[ \t]{2,}/g,function(T){return e.repeat(' ',T.length-1)+' ';});var S=O.clone();S.setHtml(R);P.append(S);}return P;};function x(N,O){var P=N.getHtml();P=v(P,/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g,'');P=P.replace(/[ \t\r\n]*(<br[^>]*>)[ \t\r\n]*/gi,'$1');P=P.replace(/([ \t\n\r]+| )/g,' ');P=P.replace(/<br\b[^>]*>/gi,'\n');if(c){var Q=N.getDocument().createElement('div');Q.append(O);O.$.outerHTML='<pre>'+P+'</pre>';O=Q.getFirst().remove();}else O.setHtml(P);return O;};function y(N,O){var P=N._.definition,Q=e.extend({},P.attributes,H(N)[O.getName()]),R=P.styles,S=e.isEmpty(Q)&&e.isEmpty(R);for(var T in Q){if((T=='class'||N._.definition.fullMatch)&&O.getAttribute(T)!=I(T,Q[T]))continue;S=O.hasAttribute(T);O.removeAttribute(T);}for(var U in R){if(N._.definition.fullMatch&&O.getStyle(U)!=I(U,R[U],true))continue;S=S||!!O.getStyle(U);O.removeStyle(U);}S&&B(O);};function z(N,O){var P=N._.definition,Q=P.attributes,R=P.styles,S=H(N),T=O.getElementsByTag(N.element);for(var U=T.count();--U>=0;)y(N,T.getItem(U));for(var V in S){if(V!=N.element){T=O.getElementsByTag(V);for(U=T.count()-1;U>=0;U--){var W=T.getItem(U);A(W,S[V]);}}}};function A(N,O){var P=O&&O.attributes;if(P)for(var Q=0;Q<P.length;Q++){var R=P[Q][0],S;if(S=N.getAttribute(R)){var T=P[Q][1];if(T===null||T.test&&T.test(S)||typeof T=='string'&&S==T)N.removeAttribute(R);}}B(N);};function B(N){if(!N.hasAttributes()){var O=N.getFirst(),P=N.getLast();N.remove(true);if(O){O.type==1&&O.mergeSiblings();if(P&&!O.equals(P)&&P.type==1)P.mergeSiblings();}}};function C(N,O){var P,Q=N._.definition,R=N.element;if(R=='*')R='span';P=new h(R,O);return D(P,N);};function D(N,O){var P=O._.definition,Q=P.attributes,R=a.style.getStyleText(P);if(Q)for(var S in Q)N.setAttribute(S,Q[S]);if(R)N.setAttribute('style',R);return N;};var E=/#\((.+?)\)/g;function F(N,O){for(var P in N)N[P]=N[P].replace(E,function(Q,R){return O[R];});};function G(N){var O=N._AC;if(O)return O;O={};var P=0,Q=N.attributes;if(Q)for(var R in Q){P++;O[R]=Q[R];}var S=a.style.getStyleText(N);if(S){if(!O.style)P++;O.style=S;}O._length=P;return N._AC=O;};function H(N){if(N._.overrides)return N._.overrides;var O=N._.overrides={},P=N._.definition.overrides;if(P){if(!e.isArray(P))P=[P];for(var Q=0;Q<P.length;Q++){var R=P[Q],S,T,U;if(typeof R=='string')S=R.toLowerCase();else{S=R.element?R.element.toLowerCase():N.element;U=R.attributes;}T=O[S]||(O[S]={});if(U){var V=T.attributes=T.attributes||[];for(var W in U)V.push([W.toLowerCase(),U[W]]);}}}return O;};function I(N,O,P){var Q=new h('span');
-Q[P?'setStyle':'setAttribute'](N,O);return Q[P?'getStyle':'getAttribute'](N);};function J(N,O){var P;if(O!==false){var Q=new h('span');Q.setAttribute('style',N);P=Q.getAttribute('style')||'';}else P=N;return P.replace(/\s*([;:])\s*/,'$1').replace(/([^\s;])$/,'$1;').replace(/,\s+/g,',').toLowerCase();};function K(N){var O={};N.replace(/"/g,'"').replace(/\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g,function(P,Q,R){O[Q]=R;});return O;};function L(N,O){typeof N=='string'&&(N=K(N));typeof O=='string'&&(O=K(O));for(var P in N){if(!(P in O&&(O[P]==N[P]||N[P]=='inherit'||O[P]=='inherit')))return false;}return true;};function M(N,O){var P=N.getSelection(),Q=P.getRanges(),R=O?this.removeFromRange:this.applyToRange;for(var S=0;S<Q.length;S++)R.call(this,Q[S]);P.selectRanges(Q);};})();a.styleCommand=function(l){this.style=l;};a.styleCommand.prototype.exec=function(l){var n=this;l.focus();var m=l.document;if(m)if(n.state==2)n.style.apply(m);else if(n.state==1)n.style.remove(m);return!!m;};a.stylesSet=new a.resourceManager('','stylesSet');a.addStylesSet=e.bind(a.stylesSet.add,a.stylesSet);a.loadStylesSet=function(l,m,n){a.stylesSet.addExternal(l,m,'');a.stylesSet.load(l,n);};a.editor.prototype.getStylesSet=function(l){if(!this._.stylesDefinitions){var m=this,n=m.config.stylesCombo_stylesSet||m.config.stylesSet||'default';if(n instanceof Array){m._.stylesDefinitions=n;l(n);return;}var o=n.split(':'),p=o[0],q=o[1],r=j.registered.styles.path;a.stylesSet.addExternal(p,q?o.slice(1).join(':'):r+'styles/'+p+'.js','');a.stylesSet.load(p,function(s){m._.stylesDefinitions=s[p];l(m._.stylesDefinitions);});}else l(this._.stylesDefinitions);};j.add('domiterator');(function(){function l(o){var p=this;if(arguments.length<1)return;p.range=o;p.forceBrBreak=false;p.enlargeBr=true;p.enforceRealBlocks=false;p._||(p._={});};var m=/^[\r\n\t ]+$/,n=d.walker.bookmark();l.prototype={getNextParagraph:function(o){var O=this;var p,q,r,s,t;if(!O._.lastNode){q=O.range.clone();q.enlarge(O.forceBrBreak||!O.enlargeBr?3:2);var u=new d.walker(q),v=d.walker.bookmark(true,true);u.evaluator=v;O._.nextNode=u.next();u=new d.walker(q);u.evaluator=v;var w=u.previous();O._.lastNode=w.getNextSourceNode(true);if(O._.lastNode&&O._.lastNode.type==3&&!e.trim(O._.lastNode.getText())&&O._.lastNode.getParent().isBlockBoundary()){var x=new d.range(q.document);x.moveToPosition(O._.lastNode,4);if(x.checkEndOfBlock()){var y=new d.elementPath(x.endContainer),z=y.block||y.blockLimit;O._.lastNode=z.getNextSourceNode(true);}}if(!O._.lastNode){O._.lastNode=O._.docEndMarker=q.document.createText('');
-O._.lastNode.insertAfter(w);}q=null;}var A=O._.nextNode;w=O._.lastNode;O._.nextNode=null;while(A){var B=false,C=A.type!=1,D=false;if(!C){var E=A.getName();if(A.isBlockBoundary(O.forceBrBreak&&{br:1})){if(E=='br')C=true;else if(!q&&!A.getChildCount()&&E!='hr'){p=A;r=A.equals(w);break;}if(q){q.setEndAt(A,3);if(E!='br')O._.nextNode=A;}B=true;}else{if(A.getFirst()){if(!q){q=new d.range(O.range.document);q.setStartAt(A,3);}A=A.getFirst();continue;}C=true;}}else if(A.type==3)if(m.test(A.getText()))C=false;if(C&&!q){q=new d.range(O.range.document);q.setStartAt(A,3);}r=(!B||C)&&A.equals(w);if(q&&!B)while(!A.getNext()&&!r){var F=A.getParent();if(F.isBlockBoundary(O.forceBrBreak&&{br:1})){B=true;r=r||F.equals(w);break;}A=F;C=true;r=A.equals(w);D=true;}if(C)q.setEndAt(A,4);A=A.getNextSourceNode(D,null,w);r=!A;if((B||r)&&q){var G=q.getBoundaryNodes(),H=new d.elementPath(q.startContainer);if(G.startNode.getParent().equals(H.blockLimit)&&n(G.startNode)&&n(G.endNode)){q=null;O._.nextNode=null;}else break;}if(r)break;}if(!p){if(!q){O._.docEndMarker&&O._.docEndMarker.remove();O._.nextNode=null;return null;}H=new d.elementPath(q.startContainer);var I=H.blockLimit,J={div:1,th:1,td:1};p=H.block;if(!p&&!O.enforceRealBlocks&&J[I.getName()]&&q.checkStartOfBlock()&&q.checkEndOfBlock())p=I;else if(!p||O.enforceRealBlocks&&p.getName()=='li'){p=O.range.document.createElement(o||'p');q.extractContents().appendTo(p);p.trim();q.insertNode(p);s=t=true;}else if(p.getName()!='li'){if(!q.checkStartOfBlock()||!q.checkEndOfBlock()){p=p.clone(false);q.extractContents().appendTo(p);p.trim();var K=q.splitBlock();s=!K.wasStartOfBlock;t=!K.wasEndOfBlock;q.insertNode(p);}}else if(!r)O._.nextNode=p.equals(w)?null:q.getBoundaryNodes().endNode.getNextSourceNode(true,null,w);}if(s){var L=p.getPrevious();if(L&&L.type==1)if(L.getName()=='br')L.remove();else if(L.getLast()&&L.getLast().$.nodeName.toLowerCase()=='br')L.getLast().remove();}if(t){var M=d.walker.bookmark(false,true),N=p.getLast();if(N&&N.type==1&&N.getName()=='br')if(c||N.getPrevious(M)||N.getNext(M))N.remove();}if(!O._.nextNode)O._.nextNode=r||p.equals(w)?null:p.getNextSourceNode(true,null,w);return p;}};d.range.prototype.createIterator=function(){return new l(this);};})();j.add('panelbutton',{requires:['button'],beforeInit:function(l){l.ui.addHandler(4,k.panelButton.handler);}});a.UI_PANELBUTTON=4;(function(){var l=function(m){var o=this;var n=o._;if(n.state==0)return;o.createPanel(m);if(n.on){n.panel.hide();return;}n.panel.showBlock(o._.id,o.document.getById(o._.id),4);
-};k.panelButton=e.createClass({base:k.button,$:function(m){var o=this;var n=m.panel;delete m.panel;o.base(m);o.document=n&&n.parent&&n.parent.getDocument()||a.document;n.block={attributes:n.attributes};o.hasArrow=true;o.click=l;o._={panelDefinition:n};},statics:{handler:{create:function(m){return new k.panelButton(m);}}},proto:{createPanel:function(m){var n=this._;if(n.panel)return;var o=this._.panelDefinition||{},p=this._.panelDefinition.block,q=o.parent||a.document.getBody(),r=this._.panel=new k.floatPanel(m,q,o),s=r.addBlock(n.id,p),t=this;r.onShow=function(){if(t.className)this.element.getFirst().addClass(t.className+'_panel');n.oldState=t._.state;t.setState(1);n.on=1;if(t.onOpen)t.onOpen();};r.onHide=function(){if(t.className)this.element.getFirst().removeClass(t.className+'_panel');t.setState(n.oldState);n.on=0;if(t.onClose)t.onClose();};r.onEscape=function(){r.hide();t.document.getById(n.id).focus();};if(this.onBlock)this.onBlock(r,s);s.onHide=function(){n.on=0;t.setState(2);};}}});})();j.add('floatpanel',{requires:['panel']});(function(){var l={},m=false;function n(o,p,q,r,s){var t=p.getUniqueId()+'-'+q.getUniqueId()+'-'+o.skinName+'-'+o.lang.dir+(o.uiColor&&'-'+o.uiColor||'')+(r.css&&'-'+r.css||'')+(s&&'-'+s||''),u=l[t];if(!u){u=l[t]=new k.panel(p,r);u.element=q.append(h.createFromHtml(u.renderHtml(o),p));u.element.setStyles({display:'none',position:'absolute'});}return u;};k.floatPanel=e.createClass({$:function(o,p,q,r){q.forceIFrame=true;var s=p.getDocument(),t=n(o,s,p,q,r||0),u=t.element,v=u.getFirst().getFirst();this.element=u;this._={panel:t,parentElement:p,definition:q,document:s,iframe:v,children:[],dir:o.lang.dir};},proto:{addBlock:function(o,p){return this._.panel.addBlock(o,p);},addListBlock:function(o,p){return this._.panel.addListBlock(o,p);},getBlock:function(o){return this._.panel.getBlock(o);},showBlock:function(o,p,q,r,s){var t=this._.panel,u=t.showBlock(o);this.allowBlur(false);m=true;var v=this.element,w=this._.iframe,x=this._.definition,y=p.getDocumentPosition(v.getDocument()),z=this._.dir=='rtl',A=y.x+(r||0),B=y.y+(s||0);if(z&&(q==1||q==4))A+=p.$.offsetWidth;else if(!z&&(q==2||q==3))A+=p.$.offsetWidth-1;if(q==3||q==4)B+=p.$.offsetHeight-1;this._.panel._.offsetParentId=p.getId();v.setStyles({top:B+'px',left:'-3000px',opacity:'0',display:''});v.getFirst().removeStyle('width');if(!this._.blurSet){var C=c?w:new d.window(w.$.contentWindow);a.event.useCapture=true;C.on('blur',function(D){var F=this;if(!F.allowBlur())return;var E;if(c&&!F.allowBlur()||(E=D.data.getTarget())&&E.getName&&E.getName()!='iframe')return;
-if(F.visible&&!F._.activeChild&&!m)F.hide();},this);C.on('focus',function(){this._.focused=true;this.hideChild();this.allowBlur(true);},this);a.event.useCapture=false;this._.blurSet=1;}t.onEscape=e.bind(function(D){if(this.onEscape&&this.onEscape(D)===false)return false;},this);e.setTimeout(function(){if(z)A-=v.$.offsetWidth;var D=e.bind(function(){var E=v.getFirst();if(u.autoSize){var F=u.element.$;if(b.gecko||b.opera)F=F.parentNode;if(c)F=F.document.body;var G=F.scrollWidth;if(c&&b.quirks&&G>0)G+=(E.$.offsetWidth||0)-(E.$.clientWidth||0);G+=4;E.setStyle('width',G+'px');u.element.addClass('cke_frameLoaded');var H=u.element.$.scrollHeight;if(c&&b.quirks&&H>0)H+=(E.$.offsetHeight||0)-(E.$.clientHeight||0);E.setStyle('height',H+'px');t._.currentBlock.element.setStyle('display','none').removeStyle('display');}else E.removeStyle('height');var I=t.element,J=I.getWindow(),K=J.getScrollPosition(),L=J.getViewPaneSize(),M={height:I.$.offsetHeight,width:I.$.offsetWidth};if(z?A<0:A+M.width>L.width+K.x)A+=M.width*(z?1:-1);if(B+M.height>L.height+K.y)B-=M.height;v.setStyles({top:B+'px',left:A+'px',opacity:'1'});},this);t.isLoaded?D():t.onLoad=D;e.setTimeout(function(){w.$.contentWindow.focus();this.allowBlur(true);},0,this);},0,this);this.visible=1;if(this.onShow)this.onShow.call(this);m=false;},hide:function(){var o=this;if(o.visible&&(!o.onHide||o.onHide.call(o)!==true)){o.hideChild();o.element.setStyle('display','none');o.visible=0;}},allowBlur:function(o){var p=this._.panel;if(o!=undefined)p.allowBlur=o;return p.allowBlur;},showAsChild:function(o,p,q,r,s,t){if(this._.activeChild==o&&o._.panel._.offsetParentId==q.getId())return;this.hideChild();o.onHide=e.bind(function(){e.setTimeout(function(){if(!this._.focused)this.hide();},0,this);},this);this._.activeChild=o;this._.focused=false;o.showBlock(p,q,r,s,t);if(b.ie7Compat||b.ie8&&b.ie6Compat)setTimeout(function(){o.element.getChild(0).$.style.cssText+='';},100);},hideChild:function(){var o=this._.activeChild;if(o){delete o.onHide;delete this._.activeChild;o.hide();}}}});a.on('instanceDestroyed',function(){var o=e.isEmpty(a.instances);for(var p in l){var q=l[p];if(o)q.destroy();else q.element.hide();}o&&(l={});});})();j.add('menu',{beforeInit:function(l){var m=l.config.menu_groups.split(','),n=l._.menuGroups={},o=l._.menuItems={};for(var p=0;p<m.length;p++)n[m[p]]=p+1;l.addMenuGroup=function(q,r){n[q]=r||100;};l.addMenuItem=function(q,r){if(n[r.group])o[q]=new a.menuItem(this,q,r);};l.addMenuItems=function(q){for(var r in q)this.addMenuItem(r,q[r]);
-};l.getMenuItem=function(q){return o[q];};},requires:['floatpanel']});(function(){a.menu=e.createClass({$:function(m,n){var q=this;n=q._.definition=n||{};q.id='cke_'+e.getNextNumber();q.editor=m;q.items=[];q._.level=n.level||1;var o=e.extend({},n.panel,{css:m.skin.editor.css,level:q._.level-1,block:{}}),p=o.block.attributes=o.attributes||{};!p.role&&(p.role='menu');q._.panelDefinition=o;},_:{showSubMenu:function(m){var u=this;var n=u._.subMenu,o=u.items[m],p=o.getItems&&o.getItems();if(!p){u._.panel.hideChild();return;}var q=u._.panel.getBlock(u.id);q._.focusIndex=m;if(n)n.removeAll();else{n=u._.subMenu=new a.menu(u.editor,e.extend({},u._.definition,{level:u._.level+1},true));n.parent=u;n.onClick=e.bind(u.onClick,u);n.onEscape=u.onEscape;}for(var r in p){var s=u.editor.getMenuItem(r);if(s){s.state=p[r];n.add(s);}}var t=u._.panel.getBlock(u.id).element.getDocument().getById(u.id+String(m));n.show(t,2);}},proto:{add:function(m){if(!m.order)m.order=this.items.length;this.items.push(m);},removeAll:function(){this.items=[];},show:function(m,n,o,p){var q=this.items,r=this.editor,s=this._.panel,t=this._.element;if(!s){s=this._.panel=new k.floatPanel(this.editor,a.document.getBody(),this._.panelDefinition,this._.level);s.onEscape=e.bind(function(C){if(this.onEscape&&this.onEscape(C)===false)return false;},this);s.onHide=e.bind(function(){this.onHide&&this.onHide();},this);var u=s.addBlock(this.id,this._.panelDefinition.block);u.autoSize=true;var v=u.keys;v[40]='next';v[9]='next';v[38]='prev';v[2000+9]='prev';v[32]='click';v[r.lang.dir=='rtl'?37:39]='click';t=this._.element=u.element;t.addClass(r.skinClass);var w=t.getDocument();w.getBody().setStyle('overflow','hidden');w.getElementsByTag('html').getItem(0).setStyle('overflow','hidden');this._.itemOverFn=e.addFunction(function(C){var D=this;clearTimeout(D._.showSubTimeout);D._.showSubTimeout=e.setTimeout(D._.showSubMenu,r.config.menu_subMenuDelay,D,[C]);},this);this._.itemOutFn=e.addFunction(function(C){clearTimeout(this._.showSubTimeout);},this);this._.itemClickFn=e.addFunction(function(C){var E=this;var D=E.items[C];if(D.state==0){E.hide();return;}if(D.getItems)E._.showSubMenu(C);else E.onClick&&E.onClick(D);},this);}l(q);var x=['<div class="cke_menu" role="presentation">'],y=q.length,z=y&&q[0].group;for(var A=0;A<y;A++){var B=q[A];if(z!=B.group){x.push('<div class="cke_menuseparator" role="separator"></div>');z=B.group;}B.render(this,A,x);}x.push('</div>');t.setHtml(x.join(''));if(this.parent)this.parent._.panel.showAsChild(s,this.id,m,n,o,p);
-else s.showBlock(this.id,m,n,o,p);r.fire('menuShow',[s]);},hide:function(){this._.panel&&this._.panel.hide();}}});function l(m){m.sort(function(n,o){if(n.group<o.group)return-1;else if(n.group>o.group)return 1;return n.order<o.order?-1:n.order>o.order?1:0;});};})();a.menuItem=e.createClass({$:function(l,m,n){var o=this;e.extend(o,n,{order:0,className:'cke_button_'+m});o.group=l._.menuGroups[o.group];o.editor=l;o.name=m;},proto:{render:function(l,m,n){var u=this;var o=l.id+String(m),p=typeof u.state=='undefined'?2:u.state,q=' cke_'+(p==1?'on':p==0?'disabled':'off'),r=u.label;if(u.className)q+=' '+u.className;var s=u.getItems;n.push('<span class="cke_menuitem"><a id="',o,'" class="',q,'" href="javascript:void(\'',(u.label||'').replace("'",''),'\')" title="',u.label,'" tabindex="-1"_cke_focus=1 hidefocus="true" role="menuitem"'+(s?'aria-haspopup="true"':'')+(p==0?'aria-disabled="true"':'')+(p==1?'aria-pressed="true"':''));if(b.opera||b.gecko&&b.mac)n.push(' onkeypress="return false;"');if(b.gecko)n.push(' onblur="this.style.cssText = this.style.cssText;"');var t=(u.iconOffset||0)*-16;n.push(' onmouseover="CKEDITOR.tools.callFunction(',l._.itemOverFn,',',m,');" onmouseout="CKEDITOR.tools.callFunction(',l._.itemOutFn,',',m,');" onclick="CKEDITOR.tools.callFunction(',l._.itemClickFn,',',m,'); return false;"><span class="cke_icon_wrapper"><span class="cke_icon"'+(u.icon?' style="background-image:url('+a.getUrl(u.icon)+');background-position:0 '+t+'px;"':'')+'></span></span>'+'<span class="cke_label">');if(s)n.push('<span class="cke_menuarrow">','<span>&#',u.editor.lang.dir=='rtl'?'9668':'9658',';</span>','</span>');n.push(r,'</span></a></span>');}}});i.menu_subMenuDelay=400;i.menu_groups='clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea,div';(function(){var l=function(n,o){return n._.modes&&n._.modes[o||n.mode];},m;j.add('editingblock',{init:function(n){if(!n.config.editingBlock)return;n.on('themeSpace',function(o){if(o.data.space=='contents')o.data.html+='<br>';});n.on('themeLoaded',function(){n.fireOnce('editingBlockReady');});n.on('uiReady',function(){n.setMode(n.config.startupMode);});n.on('afterSetData',function(){if(!m){function o(){m=true;l(n).loadData(n.getData());m=false;};if(n.mode)o();else n.on('mode',function(){o();n.removeListener('mode',arguments.callee);});}});n.on('beforeGetData',function(){if(!m&&n.mode){m=true;n.setData(l(n).getData());
-m=false;}});n.on('getSnapshot',function(o){if(n.mode)o.data=l(n).getSnapshotData();});n.on('loadSnapshot',function(o){if(n.mode)l(n).loadSnapshotData(o.data);});n.on('mode',function(o){o.removeListener();b.webkit&&n.container.on('focus',function(){n.focus();});if(n.config.startupFocus)n.focus();setTimeout(function(){n.fireOnce('instanceReady');a.fire('instanceReady',null,n);});});}});a.editor.prototype.mode='';a.editor.prototype.addMode=function(n,o){o.name=n;(this._.modes||(this._.modes={}))[n]=o;};a.editor.prototype.setMode=function(n){var o,p=this.getThemeSpace('contents'),q=this.checkDirty();if(this.mode){if(n==this.mode)return;this.fire('beforeModeUnload');var r=l(this);o=r.getData();r.unload(p);this.mode='';}p.setHtml('');var s=l(this,n);if(!s)throw '[CKEDITOR.editor.setMode] Unknown mode "'+n+'".';if(!q)this.on('mode',function(){this.resetDirty();this.removeListener('mode',arguments.callee);});s.load(p,typeof o!='string'?this.getData():o);};a.editor.prototype.focus=function(){var n=l(this);if(n)n.focus();};})();i.startupMode='wysiwyg';i.startupFocus=false;i.editingBlock=true;(function(){function l(){var v=this;try{var s=v.getSelection();if(!s)return;var t=s.getStartElement(),u=new d.elementPath(t);if(!u.compare(v._.selectionPreviousPath)){v._.selectionPreviousPath=u;v.fire('selectionChange',{selection:s,path:u,element:t});}}catch(w){}};var m,n;function o(){n=true;if(m)return;p.call(this);m=e.setTimeout(p,200,this);};function p(){m=null;if(n){e.setTimeout(l,0,this);n=false;}};var q={modes:{wysiwyg:1,source:1},exec:function(s){switch(s.mode){case 'wysiwyg':s.document.$.execCommand('SelectAll',false,null);break;case 'source':var t=s.textarea.$;if(c)t.createTextRange().execCommand('SelectAll');else{t.selectionStart=0;t.selectionEnd=t.value.length;}t.focus();}},canUndo:false};j.add('selection',{init:function(s){s.on('contentDom',function(){var t=s.document,u=t.getBody();if(c){var v,w;u.on('focusin',function(z){if(z.data.$.srcElement.nodeName!='BODY')return;if(v){try{v.select();}catch(A){}v=null;}});u.on('focus',function(){w=true;y();});u.on('beforedeactivate',function(z){if(z.data.$.toElement)return;w=false;});if(c&&b.version<8)t.getWindow().on('blur',function(z){s.document.$.selection.empty();});u.on('mousedown',x);u.on('mouseup',function(){w=true;setTimeout(function(){y(true);},0);});u.on('keydown',x);u.on('keyup',function(){w=true;y();});t.on('selectionchange',y);function x(){w=false;};function y(z){if(w){var A=s.document,B=s.getSelection(),C=B&&B.getNative();
-if(z&&C&&C.type=='None')if(!A.$.queryCommandEnabled('InsertImage')){e.setTimeout(y,50,this,true);return;}var D;if(C&&C.type=='Text'&&(D=C.createRange().parentElement().nodeName.toLowerCase())&&D in {input:1,textarea:1})return;v=C&&B.getRanges()[0];o.call(s);}};}else{t.on('mouseup',o,s);t.on('keyup',o,s);}});s.addCommand('selectAll',q);s.ui.addButton('SelectAll',{label:s.lang.selectAll,command:'selectAll'});s.selectionChange=o;}});a.editor.prototype.getSelection=function(){return this.document&&this.document.getSelection();};a.editor.prototype.forceNextSelectionCheck=function(){delete this._.selectionPreviousPath;};g.prototype.getSelection=function(){var s=new d.selection(this);return!s||s.isInvalid?null:s;};a.SELECTION_NONE=1;a.SELECTION_TEXT=2;a.SELECTION_ELEMENT=3;d.selection=function(s){var v=this;var t=s.getCustomData('cke_locked_selection');if(t)return t;v.document=s;v.isLocked=false;v._={cache:{}};if(c){var u=v.getNative().createRange();if(!u||u.item&&u.item(0).ownerDocument!=v.document.$||u.parentElement&&u.parentElement().ownerDocument!=v.document.$)v.isInvalid=true;}return v;};var r={img:1,hr:1,li:1,table:1,tr:1,td:1,th:1,embed:1,object:1,ol:1,ul:1,a:1,input:1,form:1,select:1,textarea:1,button:1,fieldset:1,th:1,thead:1,tfoot:1};d.selection.prototype={getNative:c?function(){return this._.cache.nativeSel||(this._.cache.nativeSel=this.document.$.selection);}:function(){return this._.cache.nativeSel||(this._.cache.nativeSel=this.document.getWindow().$.getSelection());},getType:c?function(){var s=this._.cache;if(s.type)return s.type;var t=1;try{var u=this.getNative(),v=u.type;if(v=='Text')t=2;if(v=='Control')t=3;if(u.createRange().parentElement)t=2;}catch(w){}return s.type=t;}:function(){var s=this._.cache;if(s.type)return s.type;var t=2,u=this.getNative();if(!u)t=1;else if(u.rangeCount==1){var v=u.getRangeAt(0),w=v.startContainer;if(w==v.endContainer&&w.nodeType==1&&v.endOffset-v.startOffset==1&&r[w.childNodes[v.startOffset].nodeName.toLowerCase()])t=3;}return s.type=t;},getRanges:c?(function(){var s=function(t,u){t=t.duplicate();t.collapse(u);var v=t.parentElement(),w=v.childNodes,x;for(var y=0;y<w.length;y++){var z=w[y];if(z.nodeType==1){x=t.duplicate();x.moveToElementText(z);var A=x.compareEndPoints('StartToStart',t),B=x.compareEndPoints('EndToStart',t);x.collapse();if(A>0)break;else if(!A||B==1&&A==-1)return{container:v,offset:y};else if(!B)return{container:v,offset:y+1};x=null;}}if(!x){x=t.duplicate();x.moveToElementText(v);x.collapse(false);}x.setEndPoint('StartToStart',t);
-var C=x.text.replace(/(\r\n|\r)/g,'\n').length;try{while(C>0)C-=w[--y].nodeValue.length;}catch(D){C=0;}if(C===0)return{container:v,offset:y};else return{container:w[y],offset:-C};};return function(){var E=this;var t=E._.cache;if(t.ranges)return t.ranges;var u=E.getNative(),v=u&&u.createRange(),w=E.getType(),x;if(!u)return[];if(w==2){x=new d.range(E.document);var y=s(v,true);x.setStart(new d.node(y.container),y.offset);y=s(v);x.setEnd(new d.node(y.container),y.offset);return t.ranges=[x];}else if(w==3){var z=E._.cache.ranges=[];for(var A=0;A<v.length;A++){var B=v.item(A),C=B.parentNode,D=0;x=new d.range(E.document);for(;D<C.childNodes.length&&C.childNodes[D]!=B;D++){}x.setStart(new d.node(C),D);x.setEnd(new d.node(C),D+1);z.push(x);}return z;}return t.ranges=[];};})():function(){var s=this._.cache;if(s.ranges)return s.ranges;var t=[],u=this.getNative();if(!u)return[];for(var v=0;v<u.rangeCount;v++){var w=u.getRangeAt(v),x=new d.range(this.document);x.setStart(new d.node(w.startContainer),w.startOffset);x.setEnd(new d.node(w.endContainer),w.endOffset);t.push(x);}return s.ranges=t;},getStartElement:function(){var z=this;var s=z._.cache;if(s.startElement!==undefined)return s.startElement;var t,u=z.getNative();switch(z.getType()){case 3:return z.getSelectedElement();case 2:var v=z.getRanges()[0];if(v)if(!v.collapsed){v.optimize();for(;;){var w=v.startContainer,x=v.startOffset;if(x==(w.getChildCount?w.getChildCount():w.getLength())&&!w.isBlockBoundary())v.setStartAfter(w);else break;}t=v.startContainer;if(t.type!=1)return t.getParent();t=t.getChild(v.startOffset);if(!t||t.type!=1)return v.startContainer;var y=t.getFirst();while(y&&y.type==1){t=y;y=y.getFirst();}return t;}if(c){v=u.createRange();v.collapse(true);t=v.parentElement();}else{t=u.anchorNode;if(t&&t.nodeType!=1)t=t.parentNode;}}return s.startElement=t?new h(t):null;},getSelectedElement:function(){var s=this._.cache;if(s.selectedElement!==undefined)return s.selectedElement;var t=this,u=e.tryThese(function(){return t.getNative().createRange().item(0);},function(){var v=t.getRanges()[0],w,x;for(var y=2;y&&!((w=v.getEnclosedNode())&&w.type==1&&r[w.getName()]&&(x=w));y--)v.shrink(1);return x.$;});return s.selectedElement=u?new h(u):null;},lock:function(){var s=this;s.getRanges();s.getStartElement();s.getSelectedElement();s._.cache.nativeSel={};s.isLocked=true;s.document.setCustomData('cke_locked_selection',s);},unlock:function(s){var x=this;var t=x.document,u=t.getCustomData('cke_locked_selection');if(u){t.setCustomData('cke_locked_selection',null);
-if(s){var v=u.getSelectedElement(),w=!v&&u.getRanges();x.isLocked=false;x.reset();t.getBody().focus();if(v)x.selectElement(v);else x.selectRanges(w);}}if(!u||!s){x.isLocked=false;x.reset();}},reset:function(){this._.cache={};},selectElement:function(s){var v=this;if(v.isLocked){var t=new d.range(v.document);t.setStartBefore(s);t.setEndAfter(s);v._.cache.selectedElement=s;v._.cache.startElement=s;v._.cache.ranges=[t];v._.cache.type=3;return;}if(c){v.getNative().empty();try{t=v.document.$.body.createControlRange();t.addElement(s.$);t.select();}catch(w){t=v.document.$.body.createTextRange();t.moveToElementText(s.$);t.select();}finally{v.document.fire('selectionchange');}v.reset();}else{t=v.document.$.createRange();t.selectNode(s.$);var u=v.getNative();u.removeAllRanges();u.addRange(t);v.reset();}},selectRanges:function(s){var y=this;if(y.isLocked){y._.cache.selectedElement=null;y._.cache.startElement=s[0].getTouchedStartNode();y._.cache.ranges=s;y._.cache.type=2;return;}if(c){if(s[0])s[0].select();y.reset();}else{var t=y.getNative();t.removeAllRanges();for(var u=0;u<s.length;u++){var v=s[u],w=y.document.$.createRange(),x=v.startContainer;if(v.collapsed&&b.gecko&&b.version<10900&&x.type==1&&!x.getChildCount())x.appendText('');w.setStart(x.$,v.startOffset);w.setEnd(v.endContainer.$,v.endOffset);t.addRange(w);}y.reset();}},createBookmarks:function(s){var t=[],u=this.getRanges(),v=u.length,w;for(var x=0;x<v;x++){t.push(w=u[x].createBookmark(s,true));s=w.serializable;var y=s?this.document.getById(w.startNode):w.startNode,z=s?this.document.getById(w.endNode):w.endNode;for(var A=x+1;A<v;A++){var B=u[A],C=B.startContainer,D=B.endContainer;C.equals(y.getParent())&&B.startOffset++;C.equals(z.getParent())&&B.startOffset++;D.equals(y.getParent())&&B.endOffset++;D.equals(z.getParent())&&B.endOffset++;}}return t;},createBookmarks2:function(s){var t=[],u=this.getRanges();for(var v=0;v<u.length;v++)t.push(u[v].createBookmark2(s));return t;},selectBookmarks:function(s){var t=[];for(var u=0;u<s.length;u++){var v=new d.range(this.document);v.moveToBookmark(s[u]);t.push(v);}this.selectRanges(t);return this;},getCommonAncestor:function(){var s=this.getRanges(),t=s[0].startContainer,u=s[s.length-1].endContainer;return t.getCommonAncestor(u);},scrollIntoView:function(){var s=this.getStartElement();s.scrollIntoView();}};})();(function(){var l=d.walker.whitespaces(true),m=/\ufeff|\u00a0/,n={table:1,tbody:1,tr:1};d.range.prototype.select=c?function(o){var y=this;var p=y.collapsed,q,r;if(y.startContainer.type==1&&y.startContainer.getName() in n||y.endContainer.type==1&&y.endContainer.getName() in n)y.shrink(1,true);
-var s=y.createBookmark(),t=s.startNode,u;if(!p)u=s.endNode;var v=y.document.$.body.createTextRange();v.moveToElementText(t.$);v.moveStart('character',1);if(u){var w=y.document.$.body.createTextRange();w.moveToElementText(u.$);v.setEndPoint('EndToEnd',w);v.moveEnd('character',-1);}else{var x=t.getNext(l);q=!(x&&x.getText&&x.getText().match(m))&&(o||!t.hasPrevious()||t.getPrevious().is&&t.getPrevious().is('br'));r=y.document.createElement('span');r.setHtml('');r.insertBefore(t);if(q)y.document.createText('\ufeff').insertBefore(t);}y.setStartBefore(t);t.remove();if(p){if(q){v.moveStart('character',-1);v.select();y.document.$.selection.clear();}else v.select();y.moveToPosition(r,3);r.remove();}else{y.setEndBefore(u);u.remove();v.select();}y.document.fire('selectionchange');}:function(){var r=this;var o=r.startContainer;if(r.collapsed&&o.type==1&&!o.getChildCount())o.append(new d.text(''));var p=r.document.$.createRange();p.setStart(o.$,r.startOffset);try{p.setEnd(r.endContainer.$,r.endOffset);}catch(s){if(s.toString().indexOf('NS_ERROR_ILLEGAL_VALUE')>=0){r.collapse(true);p.setEnd(r.endContainer.$,r.endOffset);}else throw s;}var q=r.document.getSelection().getNative();q.removeAllRanges();q.addRange(p);};})();(function(){var l={elements:{$:function(m){var n=m.attributes,o=n&&n._cke_realelement,p=o&&new a.htmlParser.fragment.fromHtml(decodeURIComponent(o)),q=p&&p.children[0];if(q&&m.attributes._cke_resizable){var r=m.attributes.style;if(r){var s=/(?:^|\s)width\s*:\s*(\d+)/i.exec(r),t=s&&s[1];s=/(?:^|\s)height\s*:\s*(\d+)/i.exec(r);var u=s&&s[1];if(t)q.attributes.width=t;if(u)q.attributes.height=u;}}return q;}}};j.add('fakeobjects',{requires:['htmlwriter'],afterInit:function(m){var n=m.dataProcessor,o=n&&n.htmlFilter;if(o)o.addRules(l);}});})();a.editor.prototype.createFakeElement=function(l,m,n,o){var p=this.lang.fakeobjects,q={'class':m,src:a.getUrl('images/spacer.gif'),_cke_realelement:encodeURIComponent(l.getOuterHtml()),_cke_real_node_type:l.type,alt:p[n]||p.unknown,align:l.getAttribute('align')||''};if(n)q._cke_real_element_type=n;if(o)q._cke_resizable=o;return this.document.createElement('img',{attributes:q});};a.editor.prototype.createFakeParserElement=function(l,m,n,o){var p=this.lang.fakeobjects,q,r=new a.htmlParser.basicWriter();l.writeHtml(r);q=r.getHtml();var s={'class':m,src:a.getUrl('images/spacer.gif'),_cke_realelement:encodeURIComponent(q),_cke_real_node_type:l.type,alt:p[n]||p.unknown,align:l.attributes.align||''};if(n)s._cke_real_element_type=n;
-if(o)s._cke_resizable=o;return new a.htmlParser.element('img',s);};a.editor.prototype.restoreRealElement=function(l){if(l.getAttribute('_cke_real_node_type')!=1)return null;return h.createFromHtml(decodeURIComponent(l.getAttribute('_cke_realelement')),this.document);};j.add('richcombo',{requires:['floatpanel','listblock','button'],beforeInit:function(l){l.ui.addHandler(3,k.richCombo.handler);}});a.UI_RICHCOMBO=3;k.richCombo=e.createClass({$:function(l){var n=this;e.extend(n,l,{title:l.label,modes:{wysiwyg:1}});var m=n.panel||{};delete n.panel;n.id=e.getNextNumber();n.document=m&&m.parent&&m.parent.getDocument()||a.document;m.className=(m.className||'')+' cke_rcombopanel';m.block={multiSelect:m.multiSelect,attributes:m.attributes};n._={panelDefinition:m,items:{},state:2};},statics:{handler:{create:function(l){return new k.richCombo(l);}}},proto:{renderHtml:function(l){var m=[];this.render(l,m);return m.join('');},render:function(l,m){var n=b,o='cke_'+this.id,p=e.addFunction(function(s){var v=this;var t=v._;if(t.state==0)return;v.createPanel(l);if(t.on){t.panel.hide();return;}if(!t.committed){t.list.commit();t.committed=1;}var u=v.getValue();if(u)t.list.mark(u);else t.list.unmarkAll();t.panel.showBlock(v.id,new h(s),4);},this),q={id:o,combo:this,focus:function(){var s=a.document.getById(o).getChild(1);s.focus();},clickFn:p};l.on('mode',function(){this.setState(this.modes[l.mode]?2:0);},this);var r=e.addFunction(function(s,t){s=new d.event(s);var u=s.getKeystroke();switch(u){case 13:case 32:case 40:e.callFunction(p,t);break;default:q.onkey(q,u);}s.preventDefault();});q.keyDownFn=r;m.push('<span class="cke_rcombo">','<span id=',o);if(this.className)m.push(' class="',this.className,' cke_off"');m.push('>','<span id="'+o+'_label" class=cke_label>',this.label,'</span>','<a hidefocus=true title="',this.title,'" tabindex="-1"',n.gecko&&n.version>=10900&&!n.hc?'':" href=\"javascript:void('"+this.label+"')\"",' role="button" aria-labelledby="',o,'_label" aria-describedby="',o,'_text" aria-haspopup="true"');if(b.opera||b.gecko&&b.mac)m.push(' onkeypress="return false;"');if(b.gecko)m.push(' onblur="this.style.cssText = this.style.cssText;"');m.push(' onkeydown="CKEDITOR.tools.callFunction( ',r,', event, this );" onclick="CKEDITOR.tools.callFunction(',p,', this); return false;"><span><span id="'+o+'_text" class="cke_text cke_inline_label">'+this.label+'</span>'+'</span>'+'<span class=cke_openbutton>'+(b.hc?'<span>▼</span>':'')+'</span>'+'</a>'+'</span>'+'</span>');
-if(this.onRender)this.onRender();return q;},createPanel:function(l){if(this._.panel)return;var m=this._.panelDefinition,n=this._.panelDefinition.block,o=m.parent||a.document.getBody(),p=new k.floatPanel(l,o,m),q=p.addListBlock(this.id,n),r=this;p.onShow=function(){if(r.className)this.element.getFirst().addClass(r.className+'_panel');r.setState(1);q.focus(!r.multiSelect&&r.getValue());r._.on=1;if(r.onOpen)r.onOpen();};p.onHide=function(){if(r.className)this.element.getFirst().removeClass(r.className+'_panel');r.setState(2);r._.on=0;if(r.onClose)r.onClose();};p.onEscape=function(){p.hide();r.document.getById('cke_'+r.id).getFirst().getNext().focus();};q.onClick=function(s,t){r.document.getWindow().focus();if(r.onClick)r.onClick.call(r,s,t);if(t)r.setValue(s,r._.items[s]);else r.setValue('');p.hide();};this._.panel=p;this._.list=q;p.getBlock(this.id).onHide=function(){r._.on=0;r.setState(2);};if(this.init)this.init();},setValue:function(l,m){var o=this;o._.value=l;var n=o.document.getById('cke_'+o.id+'_text');if(!(l||m)){m=o.label;n.addClass('cke_inline_label');}else n.removeClass('cke_inline_label');n.setHtml(typeof m!='undefined'?m:l);},getValue:function(){return this._.value||'';},unmarkAll:function(){this._.list.unmarkAll();},mark:function(l){this._.list.mark(l);},hideItem:function(l){this._.list.hideItem(l);},hideGroup:function(l){this._.list.hideGroup(l);},showAll:function(){this._.list.showAll();},add:function(l,m,n){this._.items[l]=n||l;this._.list.add(l,m,n);},startGroup:function(l){this._.list.startGroup(l);},commit:function(){this._.list.commit();},setState:function(l){var m=this;if(m._.state==l)return;m.document.getById('cke_'+m.id).setState(l);m._.state=l;}}});k.prototype.addRichCombo=function(l,m){this.add(l,3,m);};j.add('htmlwriter');a.htmlWriter=e.createClass({base:a.htmlParser.basicWriter,$:function(){var n=this;n.base();n.indentationChars='\t';n.selfClosingEnd=' />';n.lineBreakChars='\n';n.forceSimpleAmpersand=false;n.sortAttributes=true;n._.indent=false;n._.indentation='';n._.rules={};var l=f;for(var m in e.extend({},l.$nonBodyContent,l.$block,l.$listItem,l.$tableContent))n.setRules(m,{indent:true,breakBeforeOpen:true,breakAfterOpen:true,breakBeforeClose:!l[m]['#'],breakAfterClose:true});n.setRules('br',{breakAfterOpen:true});n.setRules('title',{indent:false,breakAfterOpen:false});n.setRules('style',{indent:false,breakBeforeClose:true});n.setRules('pre',{indent:false});},proto:{openTag:function(l,m){var o=this;var n=o._.rules[l];if(o._.indent)o.indentation();
-else if(n&&n.breakBeforeOpen){o.lineBreak();o.indentation();}o._.output.push('<',l);},openTagClose:function(l,m){var o=this;var n=o._.rules[l];if(m)o._.output.push(o.selfClosingEnd);else{o._.output.push('>');if(n&&n.indent)o._.indentation+=o.indentationChars;}if(n&&n.breakAfterOpen)o.lineBreak();},attribute:function(l,m){if(typeof m=='string'){this.forceSimpleAmpersand&&(m=m.replace(/&/g,'&'));m=e.htmlEncodeAttr(m);}this._.output.push(' ',l,'="',m,'"');},closeTag:function(l){var n=this;var m=n._.rules[l];if(m&&m.indent)n._.indentation=n._.indentation.substr(n.indentationChars.length);if(n._.indent)n.indentation();else if(m&&m.breakBeforeClose){n.lineBreak();n.indentation();}n._.output.push('</',l,'>');if(m&&m.breakAfterClose)n.lineBreak();},text:function(l){if(this._.indent){this.indentation();l=e.ltrim(l);}this._.output.push(l);},comment:function(l){if(this._.indent)this.indentation();this._.output.push('<!--',l,'-->');},lineBreak:function(){var l=this;if(l._.output.length>0)l._.output.push(l.lineBreakChars);l._.indent=true;},indentation:function(){this._.output.push(this._.indentation);this._.indent=false;},setRules:function(l,m){var n=this._.rules[l];if(n)e.extend(n,m,true);else this._.rules[l]=m;}}});j.add('menubutton',{requires:['button','contextmenu'],beforeInit:function(l){l.ui.addHandler(5,k.menuButton.handler);}});a.UI_MENUBUTTON=5;(function(){var l=function(m){var n=this._;if(n.state===0)return;n.previousState=n.state;var o=n.menu;if(!o){o=n.menu=new j.contextMenu(m);o.definition.panel.attributes['aria-label']=m.lang.common.options;o.onHide=e.bind(function(){this.setState(n.previousState);},this);if(this.onMenu)o.addListener(this.onMenu);}if(n.on){o.hide();return;}this.setState(1);o.show(a.document.getById(this._.id),4);};k.menuButton=e.createClass({base:k.button,$:function(m){var n=m.panel;delete m.panel;this.base(m);this.hasArrow=true;this.click=l;},statics:{handler:{create:function(m){return new k.menuButton(m);}}}});})();j.add('dialogui');(function(){var l=function(t){var w=this;w._||(w._={});w._['default']=w._.initValue=t['default']||'';w._.required=t.required||false;var u=[w._];for(var v=1;v<arguments.length;v++)u.push(arguments[v]);u.push(true);e.extend.apply(e,u);return w._;},m={build:function(t,u,v){return new k.dialog.textInput(t,u,v);}},n={build:function(t,u,v){return new k.dialog[u.type](t,u,v);}},o={build:function(t,u,v){var w=u.children,x,y=[],z=[];for(var A=0;A<w.length&&(x=w[A]);A++){var B=[];y.push(B);z.push(a.dialog._.uiElementBuilders[x.type].build(t,x,B));
-}return new k.dialog[u.type](t,z,y,v,u);}},p={isChanged:function(){return this.getValue()!=this.getInitValue();},reset:function(){this.setValue(this.getInitValue());},setInitValue:function(){this._.initValue=this.getValue();},resetInitValue:function(){this._.initValue=this._['default'];},getInitValue:function(){return this._.initValue;}},q=e.extend({},k.dialog.uiElement.prototype.eventProcessors,{onChange:function(t,u){if(!this._.domOnChangeRegistered){t.on('load',function(){this.getInputElement().on('change',function(){if(!t.parts.dialog.isVisible())return;this.fire('change',{value:this.getValue()});},this);},this);this._.domOnChangeRegistered=true;}this.on('change',u);}},true),r=/^on([A-Z]\w+)/,s=function(t){for(var u in t){if(r.test(u)||u=='title'||u=='type')delete t[u];}return t;};e.extend(k.dialog,{labeledElement:function(t,u,v,w){if(arguments.length<4)return;var x=l.call(this,u);x.labelId=e.getNextNumber()+'_label';var y=this._.children=[],z=function(){var A=[];if(u.labelLayout!='horizontal')A.push('<label class="cke_dialog_ui_labeled_label" ',' id="'+x.labelId+'"',' for="'+x.inputId+'"',' style="'+u.labelStyle+'">',u.label,'</label>','<div class="cke_dialog_ui_labeled_content" role="presentation">',w.call(this,t,u),'</div>');else{var B={type:'hbox',widths:u.widths,padding:0,children:[{type:'html',html:'<label class="cke_dialog_ui_labeled_label" id="'+x.labelId+'"'+' for="'+x.inputId+'"'+' style="'+u.labelStyle+'">'+e.htmlEncode(u.label)+'</span>'},{type:'html',html:'<span class="cke_dialog_ui_labeled_content">'+w.call(this,t,u)+'</span>'}]};a.dialog._.uiElementBuilders.hbox.build(t,B,A);}return A.join('');};k.dialog.uiElement.call(this,t,u,v,'div',null,{role:'presentation'},z);},textInput:function(t,u,v){if(arguments.length<3)return;l.call(this,u);var w=this._.inputId=e.getNextNumber()+'_textInput',x={'class':'cke_dialog_ui_input_'+u.type,id:w,type:'text'},y;if(u.validate)this.validate=u.validate;if(u.maxLength)x.maxlength=u.maxLength;if(u.size)x.size=u.size;var z=this,A=false;t.on('load',function(){z.getInputElement().on('keydown',function(C){if(C.data.getKeystroke()==13)A=true;});z.getInputElement().on('keyup',function(C){if(C.data.getKeystroke()==13&&A){t.getButton('ok')&&setTimeout(function(){t.getButton('ok').click();},0);A=false;}},null,null,1000);});var B=function(){var C=['<div class="cke_dialog_ui_input_',u.type,'" role="presentation"'];if(u.width)C.push('style="width:'+u.width+'" ');C.push('><input ');x['aria-labelledby']=this._.labelId;this._.required&&(x['aria-required']=this._.required);
-for(var D in x)C.push(D+'="'+x[D]+'" ');C.push(' /></div>');return C.join('');};k.dialog.labeledElement.call(this,t,u,v,B);},textarea:function(t,u,v){if(arguments.length<3)return;l.call(this,u);var w=this,x=this._.inputId=e.getNextNumber()+'_textarea',y={};if(u.validate)this.validate=u.validate;y.rows=u.rows||5;y.cols=u.cols||20;var z=function(){y['aria-labelledby']=this._.labelId;this._.required&&(y['aria-required']=this._.required);var A=['<div class="cke_dialog_ui_input_textarea" role="presentation"><textarea class="cke_dialog_ui_input_textarea" id="',x,'" '];for(var B in y)A.push(B+'="'+e.htmlEncode(y[B])+'" ');A.push('>',e.htmlEncode(w._['default']),'</textarea></div>');return A.join('');};k.dialog.labeledElement.call(this,t,u,v,z);},checkbox:function(t,u,v){if(arguments.length<3)return;var w=l.call(this,u,{'default':!!u['default']});if(u.validate)this.validate=u.validate;var x=function(){var y=e.extend({},u,{id:u.id?u.id+'_checkbox':e.getNextNumber()+'_checkbox'},true),z=[],A=e.getNextNumber()+'_label',B={'class':'cke_dialog_ui_checkbox_input',type:'checkbox','aria-labelledby':A};s(y);if(u['default'])B.checked='checked';w.checkbox=new k.dialog.uiElement(t,y,z,'input',null,B);z.push(' <label id="',A,'" for="',B.id,'">',e.htmlEncode(u.label),'</label>');return z.join('');};k.dialog.uiElement.call(this,t,u,v,'span',null,null,x);},radio:function(t,u,v){if(arguments.length<3)return;l.call(this,u);if(!this._['default'])this._['default']=this._.initValue=u.items[0][1];if(u.validate)this.validate=u.valdiate;var w=[],x=this,y=function(){var z=[],A=[],B={'class':'cke_dialog_ui_radio_item','aria-labelledby':this._.labelId},C=u.id?u.id+'_radio':e.getNextNumber()+'_radio';for(var D=0;D<u.items.length;D++){var E=u.items[D],F=E[2]!==undefined?E[2]:E[0],G=E[1]!==undefined?E[1]:E[0],H=e.getNextNumber()+'_radio_input',I=H+'_label',J=e.extend({},u,{id:H,title:null,type:null},true),K=e.extend({},J,{title:F},true),L={type:'radio','class':'cke_dialog_ui_radio_input',name:C,value:G,'aria-labelledby':I},M=[];if(x._['default']==G)L.checked='checked';s(J);s(K);w.push(new k.dialog.uiElement(t,J,M,'input',null,L));M.push(' ');new k.dialog.uiElement(t,K,M,'label',null,{id:I,'for':L.id},E[0]);z.push(M.join(''));}new k.dialog.hbox(t,[],z,A);return A.join('');};k.dialog.labeledElement.call(this,t,u,v,y);this._.children=w;},button:function(t,u,v){if(!arguments.length)return;if(typeof u=='function')u=u(t.getParentEditor());l.call(this,u,{disabled:u.disabled||false});a.event.implementOn(this);
-var w=this;t.on('load',function(z){var A=this.getElement();(function(){A.on('click',function(B){w.fire('click',{dialog:w.getDialog()});B.data.preventDefault();});A.on('keydown',function(B){if(B.data.getKeystroke() in {32:1}){w.click();B.data.preventDefault();}});})();A.unselectable();},this);var x=e.extend({},u);delete x.style;var y=e.getNextNumber()+'_label';k.dialog.uiElement.call(this,t,x,v,'a',null,{style:u.style,href:'javascript:void(0)',title:u.label,hidefocus:'true','class':u['class'],role:'button','aria-labelledby':y},'<span id="'+y+'" class="cke_dialog_ui_button">'+e.htmlEncode(u.label)+'</span>');},select:function(t,u,v){if(arguments.length<3)return;var w=l.call(this,u);if(u.validate)this.validate=u.validate;w.inputId=e.getNextNumber()+'_select';var x=function(){var y=e.extend({},u,{id:u.id?u.id+'_select':e.getNextNumber()+'_select'},true),z=[],A=[],B={id:w.inputId,'class':'cke_dialog_ui_input_select','aria-labelledby':this._.labelId};if(u.size!=undefined)B.size=u.size;if(u.multiple!=undefined)B.multiple=u.multiple;s(y);for(var C=0,D;C<u.items.length&&(D=u.items[C]);C++)A.push('<option value="',e.htmlEncode(D[1]!==undefined?D[1]:D[0]),'" /> ',e.htmlEncode(D[0]));w.select=new k.dialog.uiElement(t,y,z,'select',null,B,A.join(''));return z.join('');};k.dialog.labeledElement.call(this,t,u,v,x);},file:function(t,u,v){if(arguments.length<3)return;if(u['default']===undefined)u['default']='';var w=e.extend(l.call(this,u),{definition:u,buttons:[]});if(u.validate)this.validate=u.validate;var x=function(){w.frameId=e.getNextNumber()+'_fileInput';var y=b.isCustomDomain(),z=['<iframe frameborder="0" allowtransparency="0" class="cke_dialog_ui_input_file" id="',w.frameId,'" title="',u.label,'" src="javascript:void('];z.push(y?"(function(){document.open();document.domain='"+document.domain+"';"+'document.close();'+'})()':'0');z.push(')"></iframe>');return z.join('');};t.on('load',function(){var y=a.document.getById(w.frameId),z=y.getParent();z.addClass('cke_dialog_ui_input_file');});k.dialog.labeledElement.call(this,t,u,v,x);},fileButton:function(t,u,v){if(arguments.length<3)return;var w=l.call(this,u),x=this;if(u.validate)this.validate=u.validate;var y=e.extend({},u),z=y.onClick;y.className=(y.className?y.className+' ':'')+'cke_dialog_ui_button';y.onClick=function(A){var B=u['for'];if(!z||z.call(this,A)!==false){t.getContentElement(B[0],B[1]).submit();this.disable();}};t.on('load',function(){t.getContentElement(u['for'][0],u['for'][1])._.buttons.push(x);});k.dialog.button.call(this,t,y,v);
-},html:(function(){var t=/^\s*<[\w:]+\s+([^>]*)?>/,u=/^(\s*<[\w:]+(?:\s+[^>]*)?)((?:.|\r|\n)+)$/,v=/\/$/;return function(w,x,y){if(arguments.length<3)return;var z=[],A,B=x.html,C,D;if(B.charAt(0)!='<')B='<span>'+B+'</span>';var E=x.focus;if(E){var F=this.focus;this.focus=function(){F.call(this);typeof E=='function'&&E.call(this);this.fire('focus');};if(x.isFocusable){var G=this.isFocusable;this.isFocusable=G;}this.keyboardFocusable=true;}k.dialog.uiElement.call(this,w,x,z,'span',null,null,'');A=z.join('');C=A.match(t);D=B.match(u)||['','',''];if(v.test(D[1])){D[1]=D[1].slice(0,-1);D[2]='/'+D[2];}y.push([D[1],' ',C[1]||'',D[2]].join(''));};})(),fieldset:function(t,u,v,w,x){var y=x.label,z=function(){var A=[];y&&A.push('<legend>'+y+'</legend>');for(var B=0;B<v.length;B++)A.push(v[B]);return A.join('');};this._={children:u};k.dialog.uiElement.call(this,t,x,w,'fieldset',null,null,z);}},true);k.dialog.html.prototype=new k.dialog.uiElement();k.dialog.labeledElement.prototype=e.extend(new k.dialog.uiElement(),{setLabel:function(t){var u=a.document.getById(this._.labelId);if(u.getChildCount()<1)new d.text(t,a.document).appendTo(u);else u.getChild(0).$.nodeValue=t;return this;},getLabel:function(){var t=a.document.getById(this._.labelId);if(!t||t.getChildCount()<1)return '';else return t.getChild(0).getText();},eventProcessors:q},true);k.dialog.button.prototype=e.extend(new k.dialog.uiElement(),{click:function(){var t=this;if(!t._.disabled)return t.fire('click',{dialog:t._.dialog});t.getElement().$.blur();return false;},enable:function(){this._.disabled=false;var t=this.getElement();t&&t.removeClass('disabled');},disable:function(){this._.disabled=true;this.getElement().addClass('disabled');},isVisible:function(){return this.getElement().getFirst().isVisible();},isEnabled:function(){return!this._.disabled;},eventProcessors:e.extend({},k.dialog.uiElement.prototype.eventProcessors,{onClick:function(t,u){this.on('click',u);}},true),accessKeyUp:function(){this.click();},accessKeyDown:function(){this.focus();},keyboardFocusable:true},true);k.dialog.textInput.prototype=e.extend(new k.dialog.labeledElement(),{getInputElement:function(){return a.document.getById(this._.inputId);},focus:function(){var t=this.selectParentTab();setTimeout(function(){var u=t.getInputElement();u&&u.$.focus();},0);},select:function(){var t=this.selectParentTab();setTimeout(function(){var u=t.getInputElement();if(u){u.$.focus();u.$.select();}},0);},accessKeyUp:function(){this.select();},setValue:function(t){!t&&(t='');
-return k.dialog.uiElement.prototype.setValue.call(this,t);},keyboardFocusable:true},p,true);k.dialog.textarea.prototype=new k.dialog.textInput();k.dialog.select.prototype=e.extend(new k.dialog.labeledElement(),{getInputElement:function(){return this._.select.getElement();},add:function(t,u,v){var w=new h('option',this.getDialog().getParentEditor().document),x=this.getInputElement().$;w.$.text=t;w.$.value=u===undefined||u===null?t:u;if(v===undefined||v===null){if(c)x.add(w.$);else x.add(w.$,null);}else x.add(w.$,v);return this;},remove:function(t){var u=this.getInputElement().$;u.remove(t);return this;},clear:function(){var t=this.getInputElement().$;while(t.length>0)t.remove(0);return this;},keyboardFocusable:true},p,true);k.dialog.checkbox.prototype=e.extend(new k.dialog.uiElement(),{getInputElement:function(){return this._.checkbox.getElement();},setValue:function(t){this.getInputElement().$.checked=t;this.fire('change',{value:t});},getValue:function(){return this.getInputElement().$.checked;},accessKeyUp:function(){this.setValue(!this.getValue());},eventProcessors:{onChange:function(t,u){if(!c)return q.onChange.apply(this,arguments);else{t.on('load',function(){var v=this._.checkbox.getElement();v.on('propertychange',function(w){w=w.data.$;if(w.propertyName=='checked')this.fire('change',{value:v.$.checked});},this);},this);this.on('change',u);}return null;}},keyboardFocusable:true},p,true);k.dialog.radio.prototype=e.extend(new k.dialog.uiElement(),{setValue:function(t){var u=this._.children,v;for(var w=0;w<u.length&&(v=u[w]);w++)v.getElement().$.checked=v.getValue()==t;this.fire('change',{value:t});},getValue:function(){var t=this._.children;for(var u=0;u<t.length;u++){if(t[u].getElement().$.checked)return t[u].getValue();}return null;},accessKeyUp:function(){var t=this._.children,u;for(u=0;u<t.length;u++){if(t[u].getElement().$.checked){t[u].getElement().focus();return;}}t[0].getElement().focus();},eventProcessors:{onChange:function(t,u){if(!c)return q.onChange.apply(this,arguments);else{t.on('load',function(){var v=this._.children,w=this;for(var x=0;x<v.length;x++){var y=v[x].getElement();y.on('propertychange',function(z){z=z.data.$;if(z.propertyName=='checked'&&this.$.checked)w.fire('change',{value:this.getAttribute('value')});});}},this);this.on('change',u);}return null;}},keyboardFocusable:true},p,true);k.dialog.file.prototype=e.extend(new k.dialog.labeledElement(),p,{getInputElement:function(){var t=a.document.getById(this._.frameId).getFrameDocument();
-return t.$.forms.length>0?new h(t.$.forms[0].elements[0]):this.getElement();},submit:function(){this.getInputElement().getParent().$.submit();return this;},getAction:function(t){return this.getInputElement().getParent().$.action;},reset:function(){var t=a.document.getById(this._.frameId),u=t.getFrameDocument(),v=this._.definition,w=this._.buttons;function x(){u.$.open();if(b.isCustomDomain())u.$.domain=document.domain;var y='';if(v.size)y=v.size-(c?7:0);u.$.write(['<html><head><title></title></head><body style="margin: 0; overflow: hidden; background: transparent;">','<form enctype="multipart/form-data" method="POST" action="',e.htmlEncode(v.action),'">','<input type="file" name="',e.htmlEncode(v.id||'cke_upload'),'" size="',e.htmlEncode(y>0?y:''),'" />','</form>','</body></html>'].join(''));u.$.close();for(var z=0;z<w.length;z++)w[z].enable();};if(b.gecko)setTimeout(x,500);else x();},getValue:function(){return '';},eventProcessors:q,keyboardFocusable:true},true);k.dialog.fileButton.prototype=new k.dialog.button();k.dialog.fieldset.prototype=e.clone(k.dialog.hbox.prototype);a.dialog.addUIElement('text',m);a.dialog.addUIElement('password',m);a.dialog.addUIElement('textarea',n);a.dialog.addUIElement('checkbox',n);a.dialog.addUIElement('radio',n);a.dialog.addUIElement('button',n);a.dialog.addUIElement('select',n);a.dialog.addUIElement('file',n);a.dialog.addUIElement('fileButton',n);a.dialog.addUIElement('html',n);a.dialog.addUIElement('fieldset',o);})();j.add('panel',{beforeInit:function(l){l.ui.addHandler(2,k.panel.handler);}});a.UI_PANEL=2;k.panel=function(l,m){var n=this;if(m)e.extend(n,m);e.extend(n,{className:'',css:[]});n.id=e.getNextNumber();n.document=l;n._={blocks:{}};};k.panel.handler={create:function(l){return new k.panel(l);}};k.panel.prototype={renderHtml:function(l){var m=[];this.render(l,m);return m.join('');},render:function(l,m){var o=this;var n='cke_'+o.id;m.push('<div class="',l.skinClass,'" lang="',l.langCode,'" role="presentation" style="display:none;z-index:'+(l.config.baseFloatZIndex+1)+'">'+'<div'+' id=',n,' dir=',l.lang.dir,' role="presentation" class="cke_panel cke_',l.lang.dir);if(o.className)m.push(' ',o.className);m.push('">');if(o.forceIFrame||o.css.length){m.push('<iframe id="',n,'_frame" frameborder="0" role="application" src="javascript:void(');m.push(b.isCustomDomain()?"(function(){document.open();document.domain='"+document.domain+"';"+'document.close();'+'})()':'0');m.push(')"></iframe>');}m.push('</div></div>');return n;},getHolderElement:function(){var l=this._.holder;
-if(!l){if(this.forceIFrame||this.css.length){var m=this.document.getById('cke_'+this.id+'_frame'),n=m.getParent(),o=n.getAttribute('dir'),p=n.getParent().getAttribute('class'),q=n.getParent().getAttribute('lang'),r=m.getFrameDocument();r.$.open();if(b.isCustomDomain())r.$.domain=document.domain;var s=e.addFunction(e.bind(function(u){this.isLoaded=true;if(this.onLoad)this.onLoad();},this));r.$.write('<!DOCTYPE html><html dir="'+o+'" class="'+p+'_container" lang="'+q+'">'+'<head>'+'<style>.'+p+'_container{visibility:hidden}</style>'+'</head>'+'<body class="cke_'+o+' cke_panel_frame '+b.cssClass+'" style="margin:0;padding:0"'+' onload="( window.CKEDITOR || window.parent.CKEDITOR ).tools.callFunction('+s+');"></body>'+e.buildStyleHtml(this.css)+'</html>');r.$.close();var t=r.getWindow();t.$.CKEDITOR=a;r.on('keydown',function(u){var x=this;var v=u.data.getKeystroke(),w=x.document.getById('cke_'+x.id).getAttribute('dir');if(x._.onKeyDown&&x._.onKeyDown(v)===false){u.data.preventDefault();return;}if(v==27||v==(w=='rtl'?39:37))if(x.onEscape&&x.onEscape(v)===false)u.data.preventDefault();},this);l=r.getBody();}else l=this.document.getById('cke_'+this.id);this._.holder=l;}return l;},addBlock:function(l,m){var n=this;m=n._.blocks[l]=m instanceof k.panel.block?m:new k.panel.block(n.getHolderElement(),m);if(!n._.currentBlock)n.showBlock(l);return m;},getBlock:function(l){return this._.blocks[l];},showBlock:function(l){var m=this._.blocks,n=m[l],o=this._.currentBlock,p=this.forceIFrame?this.document.getById('cke_'+this.id+'_frame'):this._.holder;p.getParent().getParent().disableContextMenu();if(o){p.removeAttributes(o.attributes);o.hide();}this._.currentBlock=n;p.setAttributes(n.attributes);a.fire('ariaWidget',p);n._.focusIndex=-1;this._.onKeyDown=n.onKeyDown&&e.bind(n.onKeyDown,n);n.onMark=function(q){p.setAttribute('aria-activedescendant',q.getId()+'_option');};n.onUnmark=function(){p.removeAttribute('aria-activedescendant');};n.show();return n;},destroy:function(){this.element&&this.element.remove();}};k.panel.block=e.createClass({$:function(l,m){var n=this;n.element=l.append(l.getDocument().createElement('div',{attributes:{tabIndex:-1,'class':'cke_panel_block',role:'presentation'},styles:{display:'none'}}));if(m)e.extend(n,m);if(!n.attributes.title)n.attributes.title=n.attributes['aria-label'];n.keys={};n._.focusIndex=-1;n.element.disableContextMenu();},_:{markItem:function(l){var o=this;if(l==-1)return;var m=o.element.getElementsByTag('a'),n=m.getItem(o._.focusIndex=l);
-if(b.webkit)n.getDocument().getWindow().focus();n.focus();o.onMark&&o.onMark(n);}},proto:{show:function(){this.element.setStyle('display','');},hide:function(){var l=this;if(!l.onHide||l.onHide.call(l)!==true)l.element.setStyle('display','none');},onKeyDown:function(l){var q=this;var m=q.keys[l];switch(m){case 'next':var n=q._.focusIndex,o=q.element.getElementsByTag('a'),p;while(p=o.getItem(++n)){if(p.getAttribute('_cke_focus')&&p.$.offsetWidth){q._.focusIndex=n;p.focus();break;}}return false;case 'prev':n=q._.focusIndex;o=q.element.getElementsByTag('a');while(n>0&&(p=o.getItem(--n))){if(p.getAttribute('_cke_focus')&&p.$.offsetWidth){q._.focusIndex=n;p.focus();break;}}return false;case 'click':n=q._.focusIndex;p=n>=0&&q.element.getElementsByTag('a').getItem(n);if(p)p.$.click?p.$.click():p.$.onclick();return false;}return true;}}});j.add('listblock',{requires:['panel'],onLoad:function(){k.panel.prototype.addListBlock=function(l,m){return this.addBlock(l,new k.listBlock(this.getHolderElement(),m));};k.listBlock=e.createClass({base:k.panel.block,$:function(l,m){var p=this;m=m||{};var n=m.attributes||(m.attributes={});(p.multiSelect=!!m.multiSelect)&&(n['aria-multiselectable']=true);!n.role&&(n.role='listbox');p.base.apply(p,arguments);var o=p.keys;o[40]='next';o[9]='next';o[38]='prev';o[2000+9]='prev';o[32]='click';p._.pendingHtml=[];p._.items={};p._.groups={};},_:{close:function(){if(this._.started){this._.pendingHtml.push('</ul>');delete this._.started;}},getClick:function(){if(!this._.click)this._.click=e.addFunction(function(l){var n=this;var m=true;if(n.multiSelect)m=n.toggle(l);else n.mark(l);if(n.onClick)n.onClick(l,m);},this);return this._.click;}},proto:{add:function(l,m,n){var q=this;var o=q._.pendingHtml,p='cke_'+e.getNextNumber();if(!q._.started){o.push('<ul role="presentation" class=cke_panel_list>');q._.started=1;q._.size=q._.size||0;}q._.items[l]=p;o.push('<li id=',p,' class=cke_panel_listItem><a id="',p,'_option" _cke_focus=1 hidefocus=true title="',n||l,'" href="javascript:void(\'',l,'\')" onclick="CKEDITOR.tools.callFunction(',q._.getClick(),",'",l,"'); return false;\"",' role="option" aria-posinset="'+ ++q._.size+'">',m||l,'</a></li>');},startGroup:function(l){this._.close();var m='cke_'+e.getNextNumber();this._.groups[l]=m;this._.pendingHtml.push('<h1 role="presentation" id=',m,' class=cke_panel_grouptitle>',l,'</h1>');},commit:function(){var o=this;o._.close();o.element.appendHtml(o._.pendingHtml.join(''));var l=o._.items,m=o.element.getDocument();
-for(var n in l)m.getById(l[n]+'_option').setAttribute('aria-setsize',o._.size);delete o._.size;o._.pendingHtml=[];},toggle:function(l){var m=this.isMarked(l);if(m)this.unmark(l);else this.mark(l);return!m;},hideGroup:function(l){var m=this.element.getDocument().getById(this._.groups[l]),n=m&&m.getNext();if(m){m.setStyle('display','none');if(n&&n.getName()=='ul')n.setStyle('display','none');}},hideItem:function(l){this.element.getDocument().getById(this._.items[l]).setStyle('display','none');},showAll:function(){var l=this._.items,m=this._.groups,n=this.element.getDocument();for(var o in l)n.getById(l[o]).setStyle('display','');for(var p in m){var q=n.getById(m[p]),r=q.getNext();q.setStyle('display','');if(r&&r.getName()=='ul')r.setStyle('display','');}},mark:function(l){var o=this;if(!o.multiSelect)o.unmarkAll();var m=o._.items[l],n=o.element.getDocument().getById(m);n.addClass('cke_selected');o.element.getDocument().getById(m+'_option').setAttribute('aria-selected',true);o.element.setAttribute('aria-activedescendant',m+'_option');o.onMark&&o.onMark(n);},unmark:function(l){var m=this;m.element.getDocument().getById(m._.items[l]).removeClass('cke_selected');m.onUnmark&&m.onUnmark(m._.items[l]);},unmarkAll:function(){var o=this;var l=o._.items,m=o.element.getDocument();for(var n in l)m.getById(l[n]).removeClass('cke_selected');o.onUnmark&&o.onUnmark();},isMarked:function(l){return this.element.getDocument().getById(this._.items[l]).hasClass('cke_selected');},focus:function(l){this._.focusIndex=-1;if(l){var m=this.element.getDocument().getById(this._.items[l]).getFirst(),n=this.element.getElementsByTag('a'),o,p=-1;while(o=n.getItem(++p)){if(o.equals(m)){this._.focusIndex=p;break;}}setTimeout(function(){m.focus();},0);}}}});}});a.themes.add('default',(function(){function l(m,n){var o,p;p=m.config.sharedSpaces;p=p&&p[n];p=p&&a.document.getById(p);if(p){var q='<span class="cke_shared"><span class="'+m.skinClass+' cke_editor_'+m.name+'">'+'<span class="'+b.cssClass+'">'+'<span class="cke_wrapper cke_'+m.lang.dir+'">'+'<span class="cke_editor">'+'<div class="cke_'+n+'">'+'</div></span></span></span></span></span>',r=p.append(h.createFromHtml(q,p.getDocument()));if(p.getCustomData('cke_hasshared'))r.hide();else p.setCustomData('cke_hasshared',1);o=r.getChild([0,0,0,0]);m.on('focus',function(){for(var s=0,t,u=p.getChildren();t=u.getItem(s);s++){if(t.type==1&&!t.equals(r)&&t.hasClass('cke_shared'))t.hide();}r.show();});m.on('destroy',function(){r.remove();});}return o;
-};return{build:function(m,n){var o=m.name,p=m.element,q=m.elementMode;if(!p||q==0)return;if(q==1)p.hide();var r=m.fire('themeSpace',{space:'top',html:''}).html,s=m.fire('themeSpace',{space:'contents',html:''}).html,t=m.fireOnce('themeSpace',{space:'bottom',html:''}).html,u=s&&m.config.height,v=m.config.tabIndex||m.element.getAttribute('tabindex')||0;if(!s)u='auto';else if(!isNaN(u))u+='px';var w='',x=m.config.width;if(x){if(!isNaN(x))x+='px';w+='width: '+x+';';}var y=r&&l(m,'top'),z=l(m,'bottom');y&&(y.setHtml(r),r='');z&&(z.setHtml(t),t='');var A=h.createFromHtml(['<span id="cke_',o,'" onmousedown="return false;" class="',m.skinClass,' cke_editor_',o,'" dir="',m.lang.dir,'" title="',b.gecko?' ':'','" lang="',m.langCode,'"'+(b.webkit?' tabindex="'+v+'"':'')+' role="application"'+' aria-labelledby="cke_',o,'_arialbl"'+(w?' style="'+w+'"':'')+'>'+'<span id="cke_',o,'_arialbl" class="cke_voice_label">'+m.lang.editor+'</span>'+'<span class="',b.cssClass,'" role="presentation"><span class="cke_wrapper cke_',m.lang.dir,'" role="presentation"><table class="cke_editor" border="0" cellspacing="0" cellpadding="0" role="presentation"><tbody><tr',r?'':' style="display:none"',' role="presentation"><td id="cke_top_',o,'" class="cke_top" role="presentation">',r,'</td></tr><tr',s?'':' style="display:none"',' role="presentation"><td id="cke_contents_',o,'" class="cke_contents" style="height:',u,'" role="presentation">',s,'</td></tr><tr',t?'':' style="display:none"',' role="presentation"><td id="cke_bottom_',o,'" class="cke_bottom" role="presentation">',t,'</td></tr></tbody></table><style>.',m.skinClass,'{visibility:hidden;}</style></span></span></span>'].join(''));A.getChild([1,0,0,0,0]).unselectable();A.getChild([1,0,0,0,2]).unselectable();if(q==1)A.insertAfter(p);else p.append(A);m.container=A;A.disableContextMenu();m.fireOnce('themeLoaded');m.fireOnce('uiReady');},buildDialog:function(m){var n=e.getNextNumber(),o=h.createFromHtml(['<div class="cke_editor_'+m.name.replace('.','\\.')+'_dialog cke_skin_',m.skinName,'" dir="',m.lang.dir,'" lang="',m.langCode,'" role="dialog" aria-labelledby="%title#"><table class="cke_dialog',' '+b.cssClass,' cke_',m.lang.dir,'" style="position:absolute" role="presentation"><tr><td role="presentation"><div class="%body" role="presentation"><div id="%title#" class="%title" role="presentation"></div><a id="%close_button#" class="%close_button" href="javascript:void(0)" title="'+m.lang.common.close+'" role="button"><span class="cke_label">X</span></a>'+'<div id="%tabs#" class="%tabs" role="tablist"></div>'+'<table class="%contents" role="presentation"><tr>'+'<td id="%contents#" class="%contents" role="presentation"></td>'+'</tr></table>'+'<div id="%footer#" class="%footer" role="presentation"></div>'+'</div>'+'<div id="%tl#" class="%tl"></div>'+'<div id="%tc#" class="%tc"></div>'+'<div id="%tr#" class="%tr"></div>'+'<div id="%ml#" class="%ml"></div>'+'<div id="%mr#" class="%mr"></div>'+'<div id="%bl#" class="%bl"></div>'+'<div id="%bc#" class="%bc"></div>'+'<div id="%br#" class="%br"></div>'+'</td></tr>'+'</table>',c?'':'<style>.cke_dialog{visibility:hidden;}</style>','</div>'].join('').replace(/#/g,'_'+n).replace(/%/g,'cke_dialog_')),p=o.getChild([0,0,0,0,0]),q=p.getChild(0),r=p.getChild(1);
-q.unselectable();r.unselectable();return{element:o,parts:{dialog:o.getChild(0),title:q,close:r,tabs:p.getChild(2),contents:p.getChild([3,0,0,0]),footer:p.getChild(4)}};},destroy:function(m){var n=m.container;n.clearCustomData();m.element.clearCustomData();if(c){n.setStyle('display','none');var o=document.body.createTextRange();o.moveToElementText(n.$);try{o.select();}catch(p){}}if(n)n.remove();if(m.elementMode==1)m.element.show();delete m.element;}};})());a.editor.prototype.getThemeSpace=function(l){var m='cke_'+l,n=this._[m]||(this._[m]=a.document.getById(m+'_'+this.name));return n;};a.editor.prototype.resize=function(l,m,n,o){var p=/^\d+$/;if(p.test(l))l+='px';var q=this.container,r=a.document.getById('cke_contents_'+this.name),s=o?q.getChild(1):q;b.webkit&&s.setStyle('display','none');s.setStyle('width',l);if(b.webkit){s.$.offsetWidth;s.setStyle('display','');}var t=n?0:(s.$.offsetHeight||0)-(r.$.clientHeight||0);r.setStyle('height',Math.max(m-t,0)+'px');this.fire('resize');};a.editor.prototype.getResizable=function(){return this.container.getChild(1);};})();
+(function(){if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'B1GG4Z6',version:'3.5.2',revision:'6450',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf(':/')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;if(!d)throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';return d;})(),getUrl:function(d){if(d.indexOf(':/')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/'&&!/[&?]t=/.test(d))d+=(d.indexOf('?')>=0?'&':'?')+'t='+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();var a=CKEDITOR;if(!a.event){a.event=function(){};a.event.implementOn=function(b){var c=a.event.prototype;for(var d in c){if(b[d]==undefined)b[d]=c[d];}};a.event.prototype=(function(){var b=function(d){var e=d.getPrivate&&d.getPrivate()||d._||(d._={});return e.events||(e.events={});},c=function(d){this.name=d;this.listeners=[];};c.prototype={getListenerIndex:function(d){for(var e=0,f=this.listeners;e<f.length;e++){if(f[e].fn==d)return e;}return-1;}};return{on:function(d,e,f,g,h){var i=b(this),j=i[d]||(i[d]=new c(d));if(j.getListenerIndex(e)<0){var k=j.listeners;if(!f)f=this;if(isNaN(h))h=10;var l=this,m=function(o,p,q,r){var s={name:d,sender:this,editor:o,data:p,listenerData:g,stop:q,cancel:r,removeListener:function(){l.removeListener(d,e);}};e.call(f,s);return s.data;};m.fn=e;m.priority=h;for(var n=k.length-1;n>=0;n--){if(k[n].priority<=h){k.splice(n+1,0,m);return;}}k.unshift(m);}},fire:(function(){var d=false,e=function(){d=true;},f=false,g=function(){f=true;};return function(h,i,j){var k=b(this)[h],l=d,m=f;d=f=false;if(k){var n=k.listeners;if(n.length){n=n.slice(0);for(var o=0;o<n.length;o++){var p=n[o].call(this,j,i,e,g);if(typeof p!='undefined')i=p;if(d||f)break;}}}var q=f||(typeof i=='undefined'?false:i);d=l;f=m;return q;};})(),fireOnce:function(d,e,f){var g=this.fire(d,e,f);delete b(this)[d];return g;},removeListener:function(d,e){var f=b(this)[d];if(f){var g=f.getListenerIndex(e);if(g>=0)f.listeners.splice(g,1);}},hasListeners:function(d){var e=b(this)[d];
+return e&&e.listeners.length>0;}};})();}if(!a.editor){a.ELEMENT_MODE_NONE=0;a.ELEMENT_MODE_REPLACE=1;a.ELEMENT_MODE_APPENDTO=2;a.editor=function(b,c,d,e){var f=this;f._={instanceConfig:b,element:c,data:e};f.elementMode=d||0;a.event.call(f);f._init();};a.editor.replace=function(b,c){var d=b;if(typeof d!='object'){d=document.getElementById(b);if(d&&d.tagName.toLowerCase() in {style:1,script:1,base:1,link:1,meta:1,title:1})d=null;if(!d){var e=0,f=document.getElementsByName(b);while((d=f[e++])&&d.tagName.toLowerCase()!='textarea'){}}if(!d)throw '[CKEDITOR.editor.replace] The element with id or name "'+b+'" was not found.';}d.style.visibility='hidden';return new a.editor(c,d,1);};a.editor.appendTo=function(b,c,d){var e=b;if(typeof e!='object'){e=document.getElementById(b);if(!e)throw '[CKEDITOR.editor.appendTo] The element with id "'+b+'" was not found.';}return new a.editor(c,e,2,d);};a.editor.prototype={_init:function(){var b=a.editor._pending||(a.editor._pending=[]);b.push(this);},fire:function(b,c){return a.event.prototype.fire.call(this,b,c,this);},fireOnce:function(b,c){return a.event.prototype.fireOnce.call(this,b,c,this);}};a.event.implementOn(a.editor.prototype,true);}if(!a.env)a.env=(function(){var b=navigator.userAgent.toLowerCase(),c=window.opera,d={ie:/*@cc_on!@*/false,opera:!!c&&c.version,webkit:b.indexOf(' applewebkit/')>-1,air:b.indexOf(' adobeair/')>-1,mac:b.indexOf('macintosh')>-1,quirks:document.compatMode=='BackCompat',mobile:b.indexOf('mobile')>-1,isCustomDomain:function(){if(!this.ie)return false;var g=document.domain,h=window.location.hostname;return g!=h&&g!='['+h+']';}};d.gecko=navigator.product=='Gecko'&&!d.webkit&&!d.opera;var e=0;if(d.ie){e=parseFloat(b.match(/msie (\d+)/)[1]);d.ie8=!!document.documentMode;d.ie8Compat=document.documentMode==8;d.ie7Compat=e==7&&!document.documentMode||document.documentMode==7;d.ie6Compat=e<7||d.quirks;}if(d.gecko){var f=b.match(/rv:([\d\.]+)/);if(f){f=f[1].split('.');e=f[0]*10000+(f[1]||0)*100+ +(f[2]||0);}}if(d.opera)e=parseFloat(c.version());if(d.air)e=parseFloat(b.match(/ adobeair\/(\d+)/)[1]);if(d.webkit)e=parseFloat(b.match(/ applewebkit\/(\d+)/)[1]);d.version=e;d.isCompatible=!d.mobile&&(d.ie&&e>=6||d.gecko&&e>=10801||d.opera&&e>=9.5||d.air&&e>=1||d.webkit&&e>=522||false);d.cssClass='cke_browser_'+(d.ie?'ie':d.gecko?'gecko':d.opera?'opera':d.webkit?'webkit':'unknown');if(d.quirks)d.cssClass+=' cke_browser_quirks';if(d.ie){d.cssClass+=' cke_browser_ie'+(d.version<7?'6':d.version>=8?document.documentMode:'7');
+if(d.quirks)d.cssClass+=' cke_browser_iequirks';}if(d.gecko&&e<10900)d.cssClass+=' cke_browser_gecko18';if(d.air)d.cssClass+=' cke_browser_air';return d;})();var b=a.env;var c=b.ie;if(a.status=='unloaded')(function(){a.event.implementOn(a);a.loadFullCore=function(){if(a.status!='basic_ready'){a.loadFullCore._load=1;return;}delete a.loadFullCore;var e=document.createElement('script');e.type='text/javascript';e.src=a.basePath+'ckeditor.js';document.getElementsByTagName('head')[0].appendChild(e);};a.loadFullCoreTimeout=0;a.replaceClass='ckeditor';a.replaceByClassEnabled=1;var d=function(e,f,g,h){if(b.isCompatible){if(a.loadFullCore)a.loadFullCore();var i=g(e,f,h);a.add(i);return i;}return null;};a.replace=function(e,f){return d(e,f,a.editor.replace);};a.appendTo=function(e,f,g){return d(e,f,a.editor.appendTo,g);};a.add=function(e){var f=this._.pending||(this._.pending=[]);f.push(e);};a.replaceAll=function(){var e=document.getElementsByTagName('textarea');for(var f=0;f<e.length;f++){var g=null,h=e[f],i=h.name;if(!h.name&&!h.id)continue;if(typeof arguments[0]=='string'){var j=new RegExp('(?:^|\\s)'+arguments[0]+'(?:$|\\s)');if(!j.test(h.className))continue;}else if(typeof arguments[0]=='function'){g={};if(arguments[0](h,g)===false)continue;}this.replace(h,g);}};(function(){var e=function(){var f=a.loadFullCore,g=a.loadFullCoreTimeout;if(a.replaceByClassEnabled)a.replaceAll(a.replaceClass);a.status='basic_ready';if(f&&f._load)f();else if(g)setTimeout(function(){if(a.loadFullCore)a.loadFullCore();},g*1000);};if(window.addEventListener)window.addEventListener('load',e,false);else if(window.attachEvent)window.attachEvent('onload',e);})();a.status='basic_loaded';})();a.dom={};var d=a.dom;(function(){var e=[];a.on('reset',function(){e=[];});a.tools={arrayCompare:function(f,g){if(!f&&!g)return true;if(!f||!g||f.length!=g.length)return false;for(var h=0;h<f.length;h++){if(f[h]!=g[h])return false;}return true;},clone:function(f){var g;if(f&&f instanceof Array){g=[];for(var h=0;h<f.length;h++)g[h]=this.clone(f[h]);return g;}if(f===null||typeof f!='object'||f instanceof String||f instanceof Number||f instanceof Boolean||f instanceof Date||f instanceof RegExp)return f;g=new f.constructor();for(var i in f){var j=f[i];g[i]=this.clone(j);}return g;},capitalize:function(f){return f.charAt(0).toUpperCase()+f.substring(1).toLowerCase();},extend:function(f){var g=arguments.length,h,i;if(typeof (h=arguments[g-1])=='boolean')g--;else if(typeof (h=arguments[g-2])=='boolean'){i=arguments[g-1];
+g-=2;}for(var j=1;j<g;j++){var k=arguments[j];for(var l in k){if(h===true||f[l]==undefined)if(!i||l in i)f[l]=k[l];}}return f;},prototypedCopy:function(f){var g=function(){};g.prototype=f;return new g();},isArray:function(f){return!!f&&f instanceof Array;},isEmpty:function(f){for(var g in f){if(f.hasOwnProperty(g))return false;}return true;},cssStyleToDomStyle:(function(){var f=document.createElement('div').style,g=typeof f.cssFloat!='undefined'?'cssFloat':typeof f.styleFloat!='undefined'?'styleFloat':'float';return function(h){if(h=='float')return g;else return h.replace(/-./g,function(i){return i.substr(1).toUpperCase();});};})(),buildStyleHtml:function(f){f=[].concat(f);var g,h=[];for(var i=0;i<f.length;i++){g=f[i];if(/@import|[{}]/.test(g))h.push('<style>'+g+'</style>');else h.push('<link type="text/css" rel=stylesheet href="'+g+'">');}return h.join('');},htmlEncode:function(f){var g=function(k){var l=new d.element('span');l.setText(k);return l.getHtml();},h=g('\n').toLowerCase()=='<br>'?function(k){return g(k).replace(/<br>/gi,'\n');}:g,i=g('>')=='>'?function(k){return h(k).replace(/>/g,'>');}:h,j=g('  ')=='  '?function(k){return i(k).replace(/ /g,' ');}:i;this.htmlEncode=j;return this.htmlEncode(f);},htmlEncodeAttr:function(f){return f.replace(/"/g,'"').replace(/</g,'<').replace(/>/g,'>');},getNextNumber:(function(){var f=0;return function(){return++f;};})(),getNextId:function(){return 'cke_'+this.getNextNumber();},override:function(f,g){return g(f);},setTimeout:function(f,g,h,i,j){if(!j)j=window;if(!h)h=j;return j.setTimeout(function(){if(i)f.apply(h,[].concat(i));else f.apply(h);},g||0);},trim:(function(){var f=/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g;return function(g){return g.replace(f,'');};})(),ltrim:(function(){var f=/^[ \t\n\r]+/g;return function(g){return g.replace(f,'');};})(),rtrim:(function(){var f=/[ \t\n\r]+$/g;return function(g){return g.replace(f,'');};})(),indexOf:Array.prototype.indexOf?function(f,g){return f.indexOf(g);}:function(f,g){for(var h=0,i=f.length;h<i;h++){if(f[h]===g)return h;}return-1;},bind:function(f,g){return function(){return f.apply(g,arguments);};},createClass:function(f){var g=f.$,h=f.base,i=f.privates||f._,j=f.proto,k=f.statics;if(i){var l=g;g=function(){var p=this;var m=p._||(p._={});for(var n in i){var o=i[n];m[n]=typeof o=='function'?a.tools.bind(o,p):o;}l.apply(p,arguments);};}if(h){g.prototype=this.prototypedCopy(h.prototype);g.prototype['constructor']=g;g.prototype.base=function(){this.base=h.prototype.base;
+h.apply(this,arguments);this.base=arguments.callee;};}if(j)this.extend(g.prototype,j,true);if(k)this.extend(g,k,true);return g;},addFunction:function(f,g){return e.push(function(){return f.apply(g||this,arguments);})-1;},removeFunction:function(f){e[f]=null;},callFunction:function(f){var g=e[f];return g&&g.apply(window,Array.prototype.slice.call(arguments,1));},cssLength:(function(){var f=/^\d+(?:\.\d+)?$/;return function(g){return g+(f.test(g)?'px':'');};})(),repeat:function(f,g){return new Array(g+1).join(f);},tryThese:function(){var f;for(var g=0,h=arguments.length;g<h;g++){var i=arguments[g];try{f=i();break;}catch(j){}}return f;},genKey:function(){return Array.prototype.slice.call(arguments).join('-');}};})();var e=a.tools;a.dtd=(function(){var f=e.extend,g={isindex:1,fieldset:1},h={input:1,button:1,select:1,textarea:1,label:1},i=f({a:1},h),j=f({iframe:1},i),k={hr:1,ul:1,menu:1,div:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1},l={ins:1,del:1,script:1,style:1},m=f({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1},l),n=f({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1},m),o=f({p:1},n),p=f({iframe:1},n,h),q={img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1},r=f({a:1},p),s={tr:1},t={'#':1},u=f({param:1},q),v=f({form:1},g,j,k,o),w={li:1},x={style:1,script:1},y={base:1,link:1,meta:1,title:1},z=f(y,x),A={head:1,body:1},B={html:1},C={address:1,blockquote:1,center:1,dir:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,menu:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1};return{$nonBodyContent:f(B,A,y),$block:C,$blockLimit:{body:1,div:1,td:1,th:1,caption:1,form:1},$inline:r,$body:f({script:1,style:1},C),$cdata:{script:1,style:1},$empty:{area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1},$listItem:{dd:1,dt:1,li:1},$list:{ul:1,ol:1,dl:1},$nonEditable:{applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1,param:1},$removeEmpty:{abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1},$tabIndex:{a:1,area:1,button:1,input:1,object:1,select:1,textarea:1},$tableContent:{caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1},html:A,head:z,style:t,script:t,body:v,base:{},link:{},meta:{},title:t,col:{},tr:{td:1,th:1},img:{},colgroup:{col:1},noscript:v,td:v,br:{},th:v,center:v,kbd:r,button:f(o,k),basefont:{},h5:r,h4:r,samp:r,h6:r,ol:w,h1:r,h3:r,option:t,h2:r,form:f(g,j,k,o),select:{optgroup:1,option:1},font:r,ins:r,menu:w,abbr:r,label:r,table:{thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1},code:r,script:t,tfoot:s,cite:r,li:v,input:{},iframe:v,strong:r,textarea:t,noframes:v,big:r,small:r,span:r,hr:{},dt:r,sub:r,optgroup:{option:1},param:{},bdo:r,'var':r,div:v,object:u,sup:r,dd:v,strike:r,area:{},dir:w,map:f({area:1,form:1,p:1},g,l,k),applet:u,dl:{dt:1,dd:1},del:r,isindex:{},fieldset:f({legend:1},q),thead:s,ul:w,acronym:r,b:r,a:p,blockquote:v,caption:r,i:r,u:r,tbody:s,s:r,address:f(j,o),tt:r,legend:r,q:r,pre:f(m,i),p:r,em:r,dfn:r};
+})();var f=a.dtd;d.event=function(g){this.$=g;};d.event.prototype={getKey:function(){return this.$.keyCode||this.$.which;},getKeystroke:function(){var h=this;var g=h.getKey();if(h.$.ctrlKey||h.$.metaKey)g+=1000;if(h.$.shiftKey)g+=2000;if(h.$.altKey)g+=4000;return g;},preventDefault:function(g){var h=this.$;if(h.preventDefault)h.preventDefault();else h.returnValue=false;if(g)this.stopPropagation();},stopPropagation:function(){var g=this.$;if(g.stopPropagation)g.stopPropagation();else g.cancelBubble=true;},getTarget:function(){var g=this.$.target||this.$.srcElement;return g?new d.node(g):null;}};a.CTRL=1000;a.SHIFT=2000;a.ALT=4000;d.domObject=function(g){if(g)this.$=g;};d.domObject.prototype=(function(){var g=function(h,i){return function(j){if(typeof a!='undefined')h.fire(i,new d.event(j));};};return{getPrivate:function(){var h;if(!(h=this.getCustomData('_')))this.setCustomData('_',h={});return h;},on:function(h){var k=this;var i=k.getCustomData('_cke_nativeListeners');if(!i){i={};k.setCustomData('_cke_nativeListeners',i);}if(!i[h]){var j=i[h]=g(k,h);if(k.$.attachEvent)k.$.attachEvent('on'+h,j);else if(k.$.addEventListener)k.$.addEventListener(h,j,!!a.event.useCapture);}return a.event.prototype.on.apply(k,arguments);},removeListener:function(h){var k=this;a.event.prototype.removeListener.apply(k,arguments);if(!k.hasListeners(h)){var i=k.getCustomData('_cke_nativeListeners'),j=i&&i[h];if(j){if(k.$.detachEvent)k.$.detachEvent('on'+h,j);else if(k.$.removeEventListener)k.$.removeEventListener(h,j,false);delete i[h];}}},removeAllListeners:function(){var k=this;var h=k.getCustomData('_cke_nativeListeners');for(var i in h){var j=h[i];if(k.$.detachEvent)k.$.detachEvent('on'+i,j);else if(k.$.removeEventListener)k.$.removeEventListener(i,j,false);delete h[i];}}};})();(function(g){var h={};a.on('reset',function(){h={};});g.equals=function(i){return i&&i.$===this.$;};g.setCustomData=function(i,j){var k=this.getUniqueId(),l=h[k]||(h[k]={});l[i]=j;return this;};g.getCustomData=function(i){var j=this.$['data-cke-expando'],k=j&&h[j];return k&&k[i];};g.removeCustomData=function(i){var j=this.$['data-cke-expando'],k=j&&h[j],l=k&&k[i];if(typeof l!='undefined')delete k[i];return l||null;};g.clearCustomData=function(){this.removeAllListeners();var i=this.$['data-cke-expando'];i&&delete h[i];};g.getUniqueId=function(){return this.$['data-cke-expando']||(this.$['data-cke-expando']=e.getNextNumber());};a.event.implementOn(g);})(d.domObject.prototype);d.window=function(g){d.domObject.call(this,g);
+};d.window.prototype=new d.domObject();e.extend(d.window.prototype,{focus:function(){if(b.webkit&&this.$.parent)this.$.parent.focus();this.$.focus();},getViewPaneSize:function(){var g=this.$.document,h=g.compatMode=='CSS1Compat';return{width:(h?g.documentElement.clientWidth:g.body.clientWidth)||0,height:(h?g.documentElement.clientHeight:g.body.clientHeight)||0};},getScrollPosition:function(){var g=this.$;if('pageXOffset' in g)return{x:g.pageXOffset||0,y:g.pageYOffset||0};else{var h=g.document;return{x:h.documentElement.scrollLeft||h.body.scrollLeft||0,y:h.documentElement.scrollTop||h.body.scrollTop||0};}}});d.document=function(g){d.domObject.call(this,g);};var g=d.document;g.prototype=new d.domObject();e.extend(g.prototype,{appendStyleSheet:function(h){if(this.$.createStyleSheet)this.$.createStyleSheet(h);else{var i=new d.element('link');i.setAttributes({rel:'stylesheet',type:'text/css',href:h});this.getHead().append(i);}},appendStyleText:function(h){var k=this;if(k.$.createStyleSheet){var i=k.$.createStyleSheet('');i.cssText=h;}else{var j=new d.element('style',k);j.append(new d.text(h,k));k.getHead().append(j);}},createElement:function(h,i){var j=new d.element(h,this);if(i){if(i.attributes)j.setAttributes(i.attributes);if(i.styles)j.setStyles(i.styles);}return j;},createText:function(h){return new d.text(h,this);},focus:function(){this.getWindow().focus();},getById:function(h){var i=this.$.getElementById(h);return i?new d.element(i):null;},getByAddress:function(h,i){var j=this.$.documentElement;for(var k=0;j&&k<h.length;k++){var l=h[k];if(!i){j=j.childNodes[l];continue;}var m=-1;for(var n=0;n<j.childNodes.length;n++){var o=j.childNodes[n];if(i===true&&o.nodeType==3&&o.previousSibling&&o.previousSibling.nodeType==3)continue;m++;if(m==l){j=o;break;}}}return j?new d.node(j):null;},getElementsByTag:function(h,i){if(!(c&&!(document.documentMode>8))&&i)h=i+':'+h;return new d.nodeList(this.$.getElementsByTagName(h));},getHead:function(){var h=this.$.getElementsByTagName('head')[0];if(!h)h=this.getDocumentElement().append(new d.element('head'),true);else h=new d.element(h);return(this.getHead=function(){return h;})();},getBody:function(){var h=new d.element(this.$.body);return(this.getBody=function(){return h;})();},getDocumentElement:function(){var h=new d.element(this.$.documentElement);return(this.getDocumentElement=function(){return h;})();},getWindow:function(){var h=new d.window(this.$.parentWindow||this.$.defaultView);return(this.getWindow=function(){return h;
+})();},write:function(h){var i=this;i.$.open('text/html','replace');b.isCustomDomain()&&(i.$.domain=document.domain);i.$.write(h);i.$.close();}});d.node=function(h){if(h){switch(h.nodeType){case 9:return new g(h);case 1:return new d.element(h);case 3:return new d.text(h);}d.domObject.call(this,h);}return this;};d.node.prototype=new d.domObject();a.NODE_ELEMENT=1;a.NODE_DOCUMENT=9;a.NODE_TEXT=3;a.NODE_COMMENT=8;a.NODE_DOCUMENT_FRAGMENT=11;a.POSITION_IDENTICAL=0;a.POSITION_DISCONNECTED=1;a.POSITION_FOLLOWING=2;a.POSITION_PRECEDING=4;a.POSITION_IS_CONTAINED=8;a.POSITION_CONTAINS=16;e.extend(d.node.prototype,{appendTo:function(h,i){h.append(this,i);return h;},clone:function(h,i){var j=this.$.cloneNode(h),k=function(l){if(l.nodeType!=1)return;if(!i)l.removeAttribute('id',false);l.removeAttribute('data-cke-expando',false);if(h){var m=l.childNodes;for(var n=0;n<m.length;n++)k(m[n]);}};k(j);return new d.node(j);},hasPrevious:function(){return!!this.$.previousSibling;},hasNext:function(){return!!this.$.nextSibling;},insertAfter:function(h){h.$.parentNode.insertBefore(this.$,h.$.nextSibling);return h;},insertBefore:function(h){h.$.parentNode.insertBefore(this.$,h.$);return h;},insertBeforeMe:function(h){this.$.parentNode.insertBefore(h.$,this.$);return h;},getAddress:function(h){var i=[],j=this.getDocument().$.documentElement,k=this.$;while(k&&k!=j){var l=k.parentNode,m=-1;if(l){for(var n=0;n<l.childNodes.length;n++){var o=l.childNodes[n];if(h&&o.nodeType==3&&o.previousSibling&&o.previousSibling.nodeType==3)continue;m++;if(o==k)break;}i.unshift(m);}k=l;}return i;},getDocument:function(){return new g(this.$.ownerDocument||this.$.parentNode.ownerDocument);},getIndex:function(){var h=this.$,i=h.parentNode&&h.parentNode.firstChild,j=-1;while(i){j++;if(i==h)return j;i=i.nextSibling;}return-1;},getNextSourceNode:function(h,i,j){if(j&&!j.call){var k=j;j=function(n){return!n.equals(k);};}var l=!h&&this.getFirst&&this.getFirst(),m;if(!l){if(this.type==1&&j&&j(this,true)===false)return null;l=this.getNext();}while(!l&&(m=(m||this).getParent())){if(j&&j(m,true)===false)return null;l=m.getNext();}if(!l)return null;if(j&&j(l)===false)return null;if(i&&i!=l.type)return l.getNextSourceNode(false,i,j);return l;},getPreviousSourceNode:function(h,i,j){if(j&&!j.call){var k=j;j=function(n){return!n.equals(k);};}var l=!h&&this.getLast&&this.getLast(),m;if(!l){if(this.type==1&&j&&j(this,true)===false)return null;l=this.getPrevious();}while(!l&&(m=(m||this).getParent())){if(j&&j(m,true)===false)return null;
+l=m.getPrevious();}if(!l)return null;if(j&&j(l)===false)return null;if(i&&l.type!=i)return l.getPreviousSourceNode(false,i,j);return l;},getPrevious:function(h){var i=this.$,j;do{i=i.previousSibling;j=i&&new d.node(i);}while(j&&h&&!h(j));return j;},getNext:function(h){var i=this.$,j;do{i=i.nextSibling;j=i&&new d.node(i);}while(j&&h&&!h(j));return j;},getParent:function(){var h=this.$.parentNode;return h&&h.nodeType==1?new d.node(h):null;},getParents:function(h){var i=this,j=[];do j[h?'push':'unshift'](i);while(i=i.getParent());return j;},getCommonAncestor:function(h){var j=this;if(h.equals(j))return j;if(h.contains&&h.contains(j))return h;var i=j.contains?j:j.getParent();do{if(i.contains(h))return i;}while(i=i.getParent());return null;},getPosition:function(h){var i=this.$,j=h.$;if(i.compareDocumentPosition)return i.compareDocumentPosition(j);if(i==j)return 0;if(this.type==1&&h.type==1){if(i.contains){if(i.contains(j))return 16+4;if(j.contains(i))return 8+2;}if('sourceIndex' in i)return i.sourceIndex<0||j.sourceIndex<0?1:i.sourceIndex<j.sourceIndex?4:2;}var k=this.getAddress(),l=h.getAddress(),m=Math.min(k.length,l.length);for(var n=0;n<=m-1;n++){if(k[n]!=l[n]){if(n<m)return k[n]<l[n]?4:2;break;}}return k.length<l.length?16+4:8+2;},getAscendant:function(h,i){var j=this.$;if(!i)j=j.parentNode;while(j){if(j.nodeName&&j.nodeName.toLowerCase()==h)return new d.node(j);j=j.parentNode;}return null;},hasAscendant:function(h,i){var j=this.$;if(!i)j=j.parentNode;while(j){if(j.nodeName&&j.nodeName.toLowerCase()==h)return true;j=j.parentNode;}return false;},move:function(h,i){h.append(this.remove(),i);},remove:function(h){var i=this.$,j=i.parentNode;if(j){if(h)for(var k;k=i.firstChild;)j.insertBefore(i.removeChild(k),i);j.removeChild(i);}return this;},replace:function(h){this.insertBefore(h);h.remove();},trim:function(){this.ltrim();this.rtrim();},ltrim:function(){var k=this;var h;while(k.getFirst&&(h=k.getFirst())){if(h.type==3){var i=e.ltrim(h.getText()),j=h.getLength();if(!i){h.remove();continue;}else if(i.length<j){h.split(j-i.length);k.$.removeChild(k.$.firstChild);}}break;}},rtrim:function(){var k=this;var h;while(k.getLast&&(h=k.getLast())){if(h.type==3){var i=e.rtrim(h.getText()),j=h.getLength();if(!i){h.remove();continue;}else if(i.length<j){h.split(i.length);k.$.lastChild.parentNode.removeChild(k.$.lastChild);}}break;}if(!c&&!b.opera){h=k.$.lastChild;if(h&&h.type==1&&h.nodeName.toLowerCase()=='br')h.parentNode.removeChild(h);}},isReadOnly:function(){var h=this;
+while(h){if(h.type==1){if(h.is('body')||!!h.data('cke-editable'))break;if(h.getAttribute('contentEditable')=='false')return h;else if(h.getAttribute('contentEditable')=='true')break;}h=h.getParent();}return false;}});d.nodeList=function(h){this.$=h;};d.nodeList.prototype={count:function(){return this.$.length;},getItem:function(h){var i=this.$[h];return i?new d.node(i):null;}};d.element=function(h,i){if(typeof h=='string')h=(i?i.$:document).createElement(h);d.domObject.call(this,h);};var h=d.element;h.get=function(i){return i&&(i.$?i:new h(i));};h.prototype=new d.node();h.createFromHtml=function(i,j){var k=new h('div',j);k.setHtml(i);return k.getFirst().remove();};h.setMarker=function(i,j,k,l){var m=j.getCustomData('list_marker_id')||j.setCustomData('list_marker_id',e.getNextNumber()).getCustomData('list_marker_id'),n=j.getCustomData('list_marker_names')||j.setCustomData('list_marker_names',{}).getCustomData('list_marker_names');i[m]=j;n[k]=1;return j.setCustomData(k,l);};h.clearAllMarkers=function(i){for(var j in i)h.clearMarkers(i,i[j],1);};h.clearMarkers=function(i,j,k){var l=j.getCustomData('list_marker_names'),m=j.getCustomData('list_marker_id');for(var n in l)j.removeCustomData(n);j.removeCustomData('list_marker_names');if(k){j.removeCustomData('list_marker_id');delete i[m];}};e.extend(h.prototype,{type:1,addClass:function(i){var j=this.$.className;if(j){var k=new RegExp('(?:^|\\s)'+i+'(?:\\s|$)','');if(!k.test(j))j+=' '+i;}this.$.className=j||i;},removeClass:function(i){var j=this.getAttribute('class');if(j){var k=new RegExp('(?:^|\\s+)'+i+'(?=\\s|$)','i');if(k.test(j)){j=j.replace(k,'').replace(/^\s+/,'');if(j)this.setAttribute('class',j);else this.removeAttribute('class');}}},hasClass:function(i){var j=new RegExp('(?:^|\\s+)'+i+'(?=\\s|$)','');return j.test(this.getAttribute('class'));},append:function(i,j){var k=this;if(typeof i=='string')i=k.getDocument().createElement(i);if(j)k.$.insertBefore(i.$,k.$.firstChild);else k.$.appendChild(i.$);return i;},appendHtml:function(i){var k=this;if(!k.$.childNodes.length)k.setHtml(i);else{var j=new h('div',k.getDocument());j.setHtml(i);j.moveChildren(k);}},appendText:function(i){if(this.$.text!=undefined)this.$.text+=i;else this.append(new d.text(i));},appendBogus:function(){var k=this;var i=k.getLast();while(i&&i.type==3&&!e.rtrim(i.getText()))i=i.getPrevious();if(!i||!i.is||!i.is('br')){var j=b.opera?k.getDocument().createText(''):k.getDocument().createElement('br');b.gecko&&j.setAttribute('type','_moz');k.append(j);
+}},breakParent:function(i){var l=this;var j=new d.range(l.getDocument());j.setStartAfter(l);j.setEndAfter(i);var k=j.extractContents();j.insertNode(l.remove());k.insertAfterNode(l);},contains:c||b.webkit?function(i){var j=this.$;return i.type!=1?j.contains(i.getParent().$):j!=i.$&&j.contains(i.$);}:function(i){return!!(this.$.compareDocumentPosition(i.$)&16);},focus:(function(){function i(){try{this.$.focus();}catch(j){}};return function(j){if(j)e.setTimeout(i,100,this);else i.call(this);};})(),getHtml:function(){var i=this.$.innerHTML;return c?i.replace(/<\?[^>]*>/g,''):i;},getOuterHtml:function(){var j=this;if(j.$.outerHTML)return j.$.outerHTML.replace(/<\?[^>]*>/,'');var i=j.$.ownerDocument.createElement('div');i.appendChild(j.$.cloneNode(true));return i.innerHTML;},setHtml:function(i){return this.$.innerHTML=i;},setText:function(i){h.prototype.setText=this.$.innerText!=undefined?function(j){return this.$.innerText=j;}:function(j){return this.$.textContent=j;};return this.setText(i);},getAttribute:(function(){var i=function(j){return this.$.getAttribute(j,2);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){var n=this;switch(j){case 'class':j='className';break;case 'tabindex':var k=i.call(n,j);if(k!==0&&n.$.tabIndex===0)k=null;return k;break;case 'checked':var l=n.$.attributes.getNamedItem(j),m=l.specified?l.nodeValue:n.$.checked;return m?'checked':null;case 'hspace':case 'value':return n.$[j];case 'style':return n.$.style.cssText;}return i.call(n,j);};else return i;})(),getChildren:function(){return new d.nodeList(this.$.childNodes);},getComputedStyle:c?function(i){return this.$.currentStyle[e.cssStyleToDomStyle(i)];}:function(i){return this.getWindow().$.getComputedStyle(this.$,'').getPropertyValue(i);},getDtd:function(){var i=f[this.getName()];this.getDtd=function(){return i;};return i;},getElementsByTag:g.prototype.getElementsByTag,getTabIndex:c?function(){var i=this.$.tabIndex;if(i===0&&!f.$tabIndex[this.getName()]&&parseInt(this.getAttribute('tabindex'),10)!==0)i=-1;return i;}:b.webkit?function(){var i=this.$.tabIndex;if(i==undefined){i=parseInt(this.getAttribute('tabindex'),10);if(isNaN(i))i=-1;}return i;}:function(){return this.$.tabIndex;},getText:function(){return this.$.textContent||this.$.innerText||'';},getWindow:function(){return this.getDocument().getWindow();},getId:function(){return this.$.id||null;},getNameAtt:function(){return this.$.name||null;},getName:function(){var i=this.$.nodeName.toLowerCase();if(c&&!(document.documentMode>8)){var j=this.$.scopeName;
+if(j!='HTML')i=j.toLowerCase()+':'+i;}return(this.getName=function(){return i;})();},getValue:function(){return this.$.value;},getFirst:function(i){var j=this.$.firstChild,k=j&&new d.node(j);if(k&&i&&!i(k))k=k.getNext(i);return k;},getLast:function(i){var j=this.$.lastChild,k=j&&new d.node(j);if(k&&i&&!i(k))k=k.getPrevious(i);return k;},getStyle:function(i){return this.$.style[e.cssStyleToDomStyle(i)];},is:function(){var i=this.getName();for(var j=0;j<arguments.length;j++){if(arguments[j]==i)return true;}return false;},isEditable:function(){var i=this.getName(),j=!f.$nonEditable[i]&&(f[i]||f.span);return j&&j['#'];},isIdentical:function(i){if(this.getName()!=i.getName())return false;var j=this.$.attributes,k=i.$.attributes,l=j.length,m=k.length;for(var n=0;n<l;n++){var o=j[n];if(o.nodeName=='_moz_dirty')continue;if((!c||o.specified&&o.nodeName!='data-cke-expando')&&o.nodeValue!=i.getAttribute(o.nodeName))return false;}if(c)for(n=0;n<m;n++){o=k[n];if(o.specified&&o.nodeName!='data-cke-expando'&&o.nodeValue!=this.getAttribute(o.nodeName))return false;}return true;},isVisible:function(){var i=!!this.$.offsetHeight&&this.getComputedStyle('visibility')!='hidden',j,k;if(i&&(b.webkit||b.opera)){j=this.getWindow();if(!j.equals(a.document.getWindow())&&(k=j.$.frameElement))i=new h(k).isVisible();}return i;},isEmptyInlineRemoveable:function(){if(!f.$removeEmpty[this.getName()])return false;var i=this.getChildren();for(var j=0,k=i.count();j<k;j++){var l=i.getItem(j);if(l.type==1&&l.data('cke-bookmark'))continue;if(l.type==1&&!l.isEmptyInlineRemoveable()||l.type==3&&e.trim(l.getText()))return false;}return true;},hasAttributes:c&&(b.ie7Compat||b.ie6Compat)?function(){var i=this.$.attributes;for(var j=0;j<i.length;j++){var k=i[j];switch(k.nodeName){case 'class':if(this.getAttribute('class'))return true;case 'data-cke-expando':continue;default:if(k.specified)return true;}}return false;}:function(){var i=this.$.attributes,j=i.length,k={'data-cke-expando':1,_moz_dirty:1};return j>0&&(j>2||!k[i[0].nodeName]||j==2&&!k[i[1].nodeName]);},hasAttribute:function(i){var j=this.$.attributes.getNamedItem(i);return!!(j&&j.specified);},hide:function(){this.setStyle('display','none');},moveChildren:function(i,j){var k=this.$;i=i.$;if(k==i)return;var l;if(j)while(l=k.lastChild)i.insertBefore(k.removeChild(l),i.firstChild);else while(l=k.firstChild)i.appendChild(k.removeChild(l));},mergeSiblings:(function(){function i(j,k,l){if(k&&k.type==1){var m=[];while(k.data('cke-bookmark')||k.isEmptyInlineRemoveable()){m.push(k);
+k=l?k.getNext():k.getPrevious();if(!k||k.type!=1)return;}if(j.isIdentical(k)){var n=l?j.getLast():j.getFirst();while(m.length)m.shift().move(j,!l);k.moveChildren(j,!l);k.remove();if(n&&n.type==1)n.mergeSiblings();}}};return function(j){var k=this;if(!(j===false||f.$removeEmpty[k.getName()]||k.is('a')))return;i(k,k.getNext(),true);i(k,k.getPrevious());};})(),show:function(){this.setStyles({display:'',visibility:''});},setAttribute:(function(){var i=function(j,k){this.$.setAttribute(j,k);return this;};if(c&&(b.ie7Compat||b.ie6Compat))return function(j,k){var l=this;if(j=='class')l.$.className=k;else if(j=='style')l.$.style.cssText=k;else if(j=='tabindex')l.$.tabIndex=k;else if(j=='checked')l.$.checked=k;else i.apply(l,arguments);return l;};else return i;})(),setAttributes:function(i){for(var j in i)this.setAttribute(j,i[j]);return this;},setValue:function(i){this.$.value=i;return this;},removeAttribute:(function(){var i=function(j){this.$.removeAttribute(j);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){if(j=='class')j='className';else if(j=='tabindex')j='tabIndex';i.call(this,j);};else return i;})(),removeAttributes:function(i){if(e.isArray(i))for(var j=0;j<i.length;j++)this.removeAttribute(i[j]);else for(var k in i)i.hasOwnProperty(k)&&this.removeAttribute(k);},removeStyle:function(i){var j=this;j.setStyle(i,'');if(j.$.style.removeAttribute)j.$.style.removeAttribute(e.cssStyleToDomStyle(i));if(!j.$.style.cssText)j.removeAttribute('style');},setStyle:function(i,j){this.$.style[e.cssStyleToDomStyle(i)]=j;return this;},setStyles:function(i){for(var j in i)this.setStyle(j,i[j]);return this;},setOpacity:function(i){if(c){i=Math.round(i*100);this.setStyle('filter',i>=100?'':'progid:DXImageTransform.Microsoft.Alpha(opacity='+i+')');}else this.setStyle('opacity',i);},unselectable:b.gecko?function(){this.$.style.MozUserSelect='none';this.on('dragstart',function(i){i.data.preventDefault();});}:b.webkit?function(){this.$.style.KhtmlUserSelect='none';this.on('dragstart',function(i){i.data.preventDefault();});}:function(){if(c||b.opera){var i=this.$,j,k=0;i.unselectable='on';while(j=i.all[k++])switch(j.tagName.toLowerCase()){case 'iframe':case 'textarea':case 'input':case 'select':break;default:j.unselectable='on';}}},getPositionedAncestor:function(){var i=this;while(i.getName()!='html'){if(i.getComputedStyle('position')!='static')return i;i=i.getParent();}return null;},getDocumentPosition:function(i){var D=this;var j=0,k=0,l=D.getDocument().getBody(),m=D.getDocument().$.compatMode=='BackCompat',n=D.getDocument();
+if(document.documentElement.getBoundingClientRect){var o=D.$.getBoundingClientRect(),p=n.$,q=p.documentElement,r=q.clientTop||l.$.clientTop||0,s=q.clientLeft||l.$.clientLeft||0,t=true;if(c){var u=n.getDocumentElement().contains(D),v=n.getBody().contains(D);t=m&&v||!m&&u;}if(t){j=o.left+(!m&&q.scrollLeft||l.$.scrollLeft);j-=s;k=o.top+(!m&&q.scrollTop||l.$.scrollTop);k-=r;}}else{var w=D,x=null,y;while(w&&!(w.getName()=='body'||w.getName()=='html')){j+=w.$.offsetLeft-w.$.scrollLeft;k+=w.$.offsetTop-w.$.scrollTop;if(!w.equals(D)){j+=w.$.clientLeft||0;k+=w.$.clientTop||0;}var z=x;while(z&&!z.equals(w)){j-=z.$.scrollLeft;k-=z.$.scrollTop;z=z.getParent();}x=w;w=(y=w.$.offsetParent)?new h(y):null;}}if(i){var A=D.getWindow(),B=i.getWindow();if(!A.equals(B)&&A.$.frameElement){var C=new h(A.$.frameElement).getDocumentPosition(i);j+=C.x;k+=C.y;}}if(!document.documentElement.getBoundingClientRect)if(b.gecko&&!m){j+=D.$.clientLeft?1:0;k+=D.$.clientTop?1:0;}return{x:j,y:k};},scrollIntoView:function(i){var o=this;var j=o.getWindow(),k=j.getViewPaneSize().height,l=k*-1;if(i)l+=k;else{l+=o.$.offsetHeight||0;l+=parseInt(o.getComputedStyle('marginBottom')||0,10)||0;}var m=o.getDocumentPosition();l+=m.y;l=l<0?0:l;var n=j.getScrollPosition().y;if(l>n||l<n-k)j.$.scrollTo(0,l);},setState:function(i){var j=this;switch(i){case 1:j.addClass('cke_on');j.removeClass('cke_off');j.removeClass('cke_disabled');break;case 0:j.addClass('cke_disabled');j.removeClass('cke_off');j.removeClass('cke_on');break;default:j.addClass('cke_off');j.removeClass('cke_on');j.removeClass('cke_disabled');break;}},getFrameDocument:function(){var i=this.$;try{i.contentWindow.document;}catch(j){i.src=i.src;if(c&&b.version<7)window.showModalDialog('javascript:document.write("<script>window.setTimeout(function(){window.close();},50);</script>")');}return i&&new g(i.contentWindow.document);},copyAttributes:function(i,j){var p=this;var k=p.$.attributes;j=j||{};for(var l=0;l<k.length;l++){var m=k[l],n=m.nodeName.toLowerCase(),o;if(n in j)continue;if(n=='checked'&&(o=p.getAttribute(n)))i.setAttribute(n,o);else if(m.specified||c&&m.nodeValue&&n=='value'){o=p.getAttribute(n);if(o===null)o=m.nodeValue;i.setAttribute(n,o);}}if(p.$.style.cssText!=='')i.$.style.cssText=p.$.style.cssText;},renameNode:function(i){var l=this;if(l.getName()==i)return;var j=l.getDocument(),k=new h(i,j);l.copyAttributes(k);l.moveChildren(k);l.getParent()&&l.$.parentNode.replaceChild(k.$,l.$);k.$['data-cke-expando']=l.$['data-cke-expando'];l.$=k.$;
+},getChild:function(i){var j=this.$;if(!i.slice)j=j.childNodes[i];else while(i.length>0&&j)j=j.childNodes[i.shift()];return j?new d.node(j):null;},getChildCount:function(){return this.$.childNodes.length;},disableContextMenu:function(){this.on('contextmenu',function(i){if(!i.data.getTarget().hasClass('cke_enable_context_menu'))i.data.preventDefault();});},getDirection:function(i){return i?this.getComputedStyle('direction'):this.getStyle('direction')||this.getAttribute('dir');},data:function(i,j){i='data-'+i;if(j===undefined)return this.getAttribute(i);else if(j===false)this.removeAttribute(i);else this.setAttribute(i,j);return null;}});(function(){var i={width:['border-left-width','border-right-width','padding-left','padding-right'],height:['border-top-width','border-bottom-width','padding-top','padding-bottom']};function j(k){var l=0;for(var m=0,n=i[k].length;m<n;m++)l+=parseInt(this.getComputedStyle(i[k][m])||0,10)||0;return l;};h.prototype.setSize=function(k,l,m){if(typeof l=='number'){if(m&&!(c&&b.quirks))l-=j.call(this,k);this.setStyle(k,l+'px');}};h.prototype.getSize=function(k,l){var m=Math.max(this.$['offset'+e.capitalize(k)],this.$['client'+e.capitalize(k)])||0;if(l)m-=j.call(this,k);return m;};})();a.command=function(i,j){this.uiItems=[];this.exec=function(k){if(this.state==0)return false;if(this.editorFocus)i.focus();return j.exec.call(this,i,k)!==false;};e.extend(this,j,{modes:{wysiwyg:1},editorFocus:1,state:2});a.event.call(this);};a.command.prototype={enable:function(){var i=this;if(i.state==0)i.setState(!i.preserveState||typeof i.previousState=='undefined'?2:i.previousState);},disable:function(){this.setState(0);},setState:function(i){var j=this;if(j.state==i)return false;j.previousState=j.state;j.state=i;j.fire('state');return true;},toggleState:function(){var i=this;if(i.state==2)i.setState(1);else if(i.state==1)i.setState(2);}};a.event.implementOn(a.command.prototype,true);a.ENTER_P=1;a.ENTER_BR=2;a.ENTER_DIV=3;a.config={customConfig:'config.js',autoUpdateElement:true,baseHref:'',contentsCss:a.basePath+'contents.css',contentsLangDirection:'ui',contentsLanguage:'',language:'',defaultLanguage:'en',enterMode:1,forceEnterMode:false,shiftEnterMode:2,corePlugins:'',docType:'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',bodyId:'',bodyClass:'',fullPage:false,height:200,plugins:'about,a11yhelp,basicstyles,bidi,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,dialogadvtab,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,iframe,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',extraPlugins:'',removePlugins:'',protectedSource:[],tabIndex:0,theme:'default',skin:'kama',width:'',baseFloatZIndex:10000};
+var i=a.config;a.focusManager=function(j){if(j.focusManager)return j.focusManager;this.hasFocus=false;this._={editor:j};return this;};a.focusManager.prototype={focus:function(){var k=this;if(k._.timer)clearTimeout(k._.timer);if(!k.hasFocus){if(a.currentInstance)a.currentInstance.focusManager.forceBlur();var j=k._.editor;j.container.getChild(1).addClass('cke_focus');k.hasFocus=true;j.fire('focus');}},blur:function(){var j=this;if(j._.timer)clearTimeout(j._.timer);j._.timer=setTimeout(function(){delete j._.timer;j.forceBlur();},100);},forceBlur:function(){if(this.hasFocus){var j=this._.editor;j.container.getChild(1).removeClass('cke_focus');this.hasFocus=false;j.fire('blur');}}};(function(){var j={};a.lang={languages:{af:1,ar:1,bg:1,bn:1,bs:1,ca:1,cs:1,cy:1,da:1,de:1,el:1,'en-au':1,'en-ca':1,'en-gb':1,en:1,eo:1,es:1,et:1,eu:1,fa:1,fi:1,fo:1,'fr-ca':1,fr:1,gl:1,gu:1,he:1,hi:1,hr:1,hu:1,is:1,it:1,ja:1,km:1,ko:1,lt:1,lv:1,mn:1,ms:1,nb:1,nl:1,no:1,pl:1,'pt-br':1,pt:1,ro:1,ru:1,sk:1,sl:1,'sr-latn':1,sr:1,sv:1,th:1,tr:1,uk:1,vi:1,'zh-cn':1,zh:1},load:function(k,l,m){if(!k||!a.lang.languages[k])k=this.detect(l,k);if(!this[k])a.scriptLoader.load(a.getUrl('lang/'+k+'.js'),function(){m(k,this[k]);},this);else m(k,this[k]);},detect:function(k,l){var m=this.languages;l=l||navigator.userLanguage||navigator.language;var n=l.toLowerCase().match(/([a-z]+)(?:-([a-z]+))?/),o=n[1],p=n[2];if(m[o+'-'+p])o=o+'-'+p;else if(!m[o])o=null;a.lang.detect=o?function(){return o;}:function(q){return q;};return o||k;}};})();a.scriptLoader=(function(){var j={},k={};return{load:function(l,m,n,o){var p=typeof l=='string';if(p)l=[l];if(!n)n=a;var q=l.length,r=[],s=[],t=function(y){if(m)if(p)m.call(n,y);else m.call(n,r,s);};if(q===0){t(true);return;}var u=function(y,z){(z?r:s).push(y);if(--q<=0){o&&a.document.getDocumentElement().removeStyle('cursor');t(z);}},v=function(y,z){j[y]=1;var A=k[y];delete k[y];for(var B=0;B<A.length;B++)A[B](y,z);},w=function(y){if(j[y]){u(y,true);return;}var z=k[y]||(k[y]=[]);z.push(u);if(z.length>1)return;var A=new h('script');A.setAttributes({type:'text/javascript',src:y});if(m)if(c)A.$.onreadystatechange=function(){if(A.$.readyState=='loaded'||A.$.readyState=='complete'){A.$.onreadystatechange=null;v(y,true);}};else{A.$.onload=function(){setTimeout(function(){v(y,true);},0);};A.$.onerror=function(){v(y,false);};}A.appendTo(a.document.getHead());};o&&a.document.getDocumentElement().setStyle('cursor','wait');for(var x=0;x<q;x++)w(l[x]);}};})();a.resourceManager=function(j,k){var l=this;
+l.basePath=j;l.fileName=k;l.registered={};l.loaded={};l.externals={};l._={waitingList:{}};};a.resourceManager.prototype={add:function(j,k){if(this.registered[j])throw '[CKEDITOR.resourceManager.add] The resource name "'+j+'" is already registered.';a.fire(j+e.capitalize(this.fileName)+'Ready',this.registered[j]=k||{});},get:function(j){return this.registered[j]||null;},getPath:function(j){var k=this.externals[j];return a.getUrl(k&&k.dir||this.basePath+j+'/');},getFilePath:function(j){var k=this.externals[j];return a.getUrl(this.getPath(j)+(k&&typeof k.file=='string'?k.file:this.fileName+'.js'));},addExternal:function(j,k,l){j=j.split(',');for(var m=0;m<j.length;m++){var n=j[m];this.externals[n]={dir:k,file:l};}},load:function(j,k,l){if(!e.isArray(j))j=j?[j]:[];var m=this.loaded,n=this.registered,o=[],p={},q={};for(var r=0;r<j.length;r++){var s=j[r];if(!s)continue;if(!m[s]&&!n[s]){var t=this.getFilePath(s);o.push(t);if(!(t in p))p[t]=[];p[t].push(s);}else q[s]=this.get(s);}a.scriptLoader.load(o,function(u,v){if(v.length)throw '[CKEDITOR.resourceManager.load] Resource name "'+p[v[0]].join(',')+'" was not found at "'+v[0]+'".';for(var w=0;w<u.length;w++){var x=p[u[w]];for(var y=0;y<x.length;y++){var z=x[y];q[z]=this.get(z);m[z]=1;}}k.call(l,q);},this);}};a.plugins=new a.resourceManager('plugins/','plugin');var j=a.plugins;j.load=e.override(j.load,function(k){return function(l,m,n){var o={},p=function(q){k.call(this,q,function(r){e.extend(o,r);var s=[];for(var t in r){var u=r[t],v=u&&u.requires;if(v)for(var w=0;w<v.length;w++){if(!o[v[w]])s.push(v[w]);}}if(s.length)p.call(this,s);else{for(t in o){u=o[t];if(u.onLoad&&!u.onLoad._called){u.onLoad();u.onLoad._called=1;}}if(m)m.call(n||window,o);}},this);};p.call(this,l);};});j.setLang=function(k,l,m){var n=this.get(k),o=n.lang||(n.lang={});o[l]=m;};a.skins=(function(){var k={},l={},m=function(n,o,p,q){var r=k[o];if(!n.skin){n.skin=r;if(r.init)r.init(n);}var s=function(B){for(var C=0;C<B.length;C++)B[C]=a.getUrl(l[o]+B[C]);};function t(B,C){return B.replace(/url\s*\(([\s'"]*)(.*?)([\s"']*)\)/g,function(D,E,F,G){if(/^\/|^\w?:/.test(F))return D;else return 'url('+C+E+F+G+')';});};p=r[p];var u=!p||!!p._isLoaded;if(u)q&&q();else{var v=p._pending||(p._pending=[]);v.push(q);if(v.length>1)return;var w=!p.css||!p.css.length,x=!p.js||!p.js.length,y=function(){if(w&&x){p._isLoaded=1;for(var B=0;B<v.length;B++){if(v[B])v[B]();}}};if(!w){var z=p.css;if(e.isArray(z)){s(z);for(var A=0;A<z.length;A++)a.document.appendStyleSheet(z[A]);
+}else{z=t(z,a.getUrl(l[o]));a.document.appendStyleText(z);}p.css=z;w=1;}if(!x){s(p.js);a.scriptLoader.load(p.js,function(){x=1;y();});}y();}};return{add:function(n,o){k[n]=o;o.skinPath=l[n]||(l[n]=a.getUrl('skins/'+n+'/'));},load:function(n,o,p){var q=n.skinName,r=n.skinPath;if(k[q])m(n,q,o,p);else{l[q]=r;a.scriptLoader.load(a.getUrl(r+'skin.js'),function(){m(n,q,o,p);});}}};})();a.themes=new a.resourceManager('themes/','theme');a.ui=function(k){if(k.ui)return k.ui;this._={handlers:{},items:{},editor:k};return this;};var k=a.ui;k.prototype={add:function(l,m,n){this._.items[l]={type:m,command:n.command||null,args:Array.prototype.slice.call(arguments,2)};},create:function(l){var q=this;var m=q._.items[l],n=m&&q._.handlers[m.type],o=m&&m.command&&q._.editor.getCommand(m.command),p=n&&n.create.apply(q,m.args);if(o)o.uiItems.push(p);return p;},addHandler:function(l,m){this._.handlers[l]=m;}};a.event.implementOn(k);(function(){var l=0,m=function(){var x='editor'+ ++l;return a.instances&&a.instances[x]?m():x;},n={},o=function(x){var y=x.config.customConfig;if(!y)return false;y=a.getUrl(y);var z=n[y]||(n[y]={});if(z.fn){z.fn.call(x,x.config);if(a.getUrl(x.config.customConfig)==y||!o(x))x.fireOnce('customConfigLoaded');}else a.scriptLoader.load(y,function(){if(a.editorConfig)z.fn=a.editorConfig;else z.fn=function(){};o(x);});return true;},p=function(x,y){x.on('customConfigLoaded',function(){if(y){if(y.on)for(var z in y.on)x.on(z,y.on[z]);e.extend(x.config,y,true);delete x.config.on;}q(x);});if(y&&y.customConfig!=undefined)x.config.customConfig=y.customConfig;if(!o(x))x.fireOnce('customConfigLoaded');},q=function(x){var y=x.config.skin.split(','),z=y[0],A=a.getUrl(y[1]||'skins/'+z+'/');x.skinName=z;x.skinPath=A;x.skinClass='cke_skin_'+z;x.tabIndex=x.config.tabIndex||x.element.getAttribute('tabindex')||0;x.fireOnce('configLoaded');t(x);},r=function(x){a.lang.load(x.config.language,x.config.defaultLanguage,function(y,z){x.langCode=y;x.lang=e.prototypedCopy(z);if(b.gecko&&b.version<10900&&x.lang.dir=='rtl')x.lang.dir='ltr';var A=x.config;A.contentsLangDirection=='ui'&&(A.contentsLangDirection=x.lang.dir);s(x);});},s=function(x){var y=x.config,z=y.plugins,A=y.extraPlugins,B=y.removePlugins;if(A){var C=new RegExp('(?:^|,)(?:'+A.replace(/\s*,\s*/g,'|')+')(?=,|$)','g');z=z.replace(C,'');z+=','+A;}if(B){C=new RegExp('(?:^|,)(?:'+B.replace(/\s*,\s*/g,'|')+')(?=,|$)','g');z=z.replace(C,'');}b.air&&(z+=',adobeair');j.load(z.split(','),function(D){var E=[],F=[],G=[];x.plugins=D;
+for(var H in D){var I=D[H],J=I.lang,K=j.getPath(H),L=null;I.path=K;if(J){L=e.indexOf(J,x.langCode)>=0?x.langCode:J[0];if(!I.lang[L])G.push(a.getUrl(K+'lang/'+L+'.js'));else{e.extend(x.lang,I.lang[L]);L=null;}}F.push(L);E.push(I);}a.scriptLoader.load(G,function(){var M=['beforeInit','init','afterInit'];for(var N=0;N<M.length;N++)for(var O=0;O<E.length;O++){var P=E[O];if(N===0&&F[O]&&P.lang)e.extend(x.lang,P.lang[F[O]]);if(P[M[N]])P[M[N]](x);}x.fire('pluginsLoaded');u(x);});});},t=function(x){a.skins.load(x,'editor',function(){r(x);});},u=function(x){var y=x.config.theme;a.themes.load(y,function(){var z=x.theme=a.themes.get(y);z.path=a.themes.getPath(y);z.build(x);if(x.config.autoUpdateElement)v(x);});},v=function(x){var y=x.element;if(x.elementMode==1&&y.is('textarea')){var z=y.$.form&&new h(y.$.form);if(z){function A(){x.updateElement();};z.on('submit',A);if(!z.$.submit.nodeName&&!z.$.submit.length)z.$.submit=e.override(z.$.submit,function(B){return function(){x.updateElement();if(B.apply)B.apply(this,arguments);else B();};});x.on('destroy',function(){z.removeListener('submit',A);});}}};function w(){var x,y=this._.commands,z=this.mode;for(var A in y){x=y[A];x[x.startDisabled?'disable':x.modes[z]?'enable':'disable']();}};a.editor.prototype._init=function(){var z=this;var x=h.get(z._.element),y=z._.instanceConfig;delete z._.element;delete z._.instanceConfig;z._.commands={};z._.styles=[];z.element=x;z.name=x&&z.elementMode==1&&(x.getId()||x.getNameAtt())||m();if(z.name in a.instances)throw '[CKEDITOR.editor] The instance "'+z.name+'" already exists.';z.id=e.getNextId();z.config=e.prototypedCopy(i);z.ui=new k(z);z.focusManager=new a.focusManager(z);a.fire('instanceCreated',null,z);z.on('mode',w,null,null,1);p(z,y);};})();e.extend(a.editor.prototype,{addCommand:function(l,m){return this._.commands[l]=new a.command(this,m);},addCss:function(l){this._.styles.push(l);},destroy:function(l){var m=this;if(!l)m.updateElement();m.fire('destroy');m.theme&&m.theme.destroy(m);a.remove(m);a.fire('instanceDestroyed',null,m);},execCommand:function(l,m){var n=this.getCommand(l),o={name:l,commandData:m,command:n};if(n&&n.state!=0)if(this.fire('beforeCommandExec',o)!==true){o.returnValue=n.exec(o.commandData);if(!n.async&&this.fire('afterCommandExec',o)!==true)return o.returnValue;}return false;},getCommand:function(l){return this._.commands[l];},getData:function(){var n=this;n.fire('beforeGetData');var l=n._.data;if(typeof l!='string'){var m=n.element;if(m&&n.elementMode==1)l=m.is('textarea')?m.getValue():m.getHtml();
+else l='';}l={dataValue:l};n.fire('getData',l);return l.dataValue;},getSnapshot:function(){var l=this.fire('getSnapshot');if(typeof l!='string'){var m=this.element;if(m&&this.elementMode==1)l=m.is('textarea')?m.getValue():m.getHtml();}return l;},loadSnapshot:function(l){this.fire('loadSnapshot',l);},setData:function(l,m,n){if(m)this.on('dataReady',function(p){p.removeListener();m.call(p.editor);});var o={dataValue:l};!n&&this.fire('setData',o);this._.data=o.dataValue;!n&&this.fire('afterSetData',o);},insertHtml:function(l){this.fire('insertHtml',l);},insertText:function(l){this.fire('insertText',l);},insertElement:function(l){this.fire('insertElement',l);},checkDirty:function(){return this.mayBeDirty&&this._.previousValue!==this.getSnapshot();},resetDirty:function(){if(this.mayBeDirty)this._.previousValue=this.getSnapshot();},updateElement:function(){var n=this;var l=n.element;if(l&&n.elementMode==1){var m=n.getData();if(n.config.htmlEncodeOutput)m=e.htmlEncode(m);if(l.is('textarea'))l.setValue(m);else l.setHtml(m);}}});a.on('loaded',function(){var l=a.editor._pending;if(l){delete a.editor._pending;for(var m=0;m<l.length;m++)l[m]._init();}});a.htmlParser=function(){this._={htmlPartsRegex:new RegExp("<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:[^\"'>]+)|(?:\"[^\"]*\")|(?:'[^']*'))*)\\/?>))",'g')};};(function(){var l=/([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,m={checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1};a.htmlParser.prototype={onTagOpen:function(){},onTagClose:function(){},onText:function(){},onCDATA:function(){},onComment:function(){},parse:function(n){var A=this;var o,p,q=0,r;while(o=A._.htmlPartsRegex.exec(n)){var s=o.index;if(s>q){var t=n.substring(q,s);if(r)r.push(t);else A.onText(t);}q=A._.htmlPartsRegex.lastIndex;if(p=o[1]){p=p.toLowerCase();if(r&&f.$cdata[p]){A.onCDATA(r.join(''));r=null;}if(!r){A.onTagClose(p);continue;}}if(r){r.push(o[0]);continue;}if(p=o[3]){p=p.toLowerCase();if(/="/.test(p))continue;var u={},v,w=o[4],x=!!(w&&w.charAt(w.length-1)=='/');if(w)while(v=l.exec(w)){var y=v[1].toLowerCase(),z=v[2]||v[3]||v[4]||'';if(!z&&m[y])u[y]=y;else u[y]=z;}A.onTagOpen(p,u,x);if(!r&&f.$cdata[p])r=[];continue;}if(p=o[2])A.onComment(p);}if(n.length>q)A.onText(n.substring(q,n.length));}};})();a.htmlParser.comment=function(l){this.value=l;this._={isBlockLike:false};};a.htmlParser.comment.prototype={type:8,writeHtml:function(l,m){var n=this.value;
+if(m){if(!(n=m.onComment(n,this)))return;if(typeof n!='string'){n.parent=this.parent;n.writeHtml(l,m);return;}}l.comment(n);}};(function(){var l=/[\t\r\n ]{2,}|[\t\r\n]/g;a.htmlParser.text=function(m){this.value=m;this._={isBlockLike:false};};a.htmlParser.text.prototype={type:3,writeHtml:function(m,n){var o=this.value;if(n&&!(o=n.onText(o,this)))return;m.text(o);}};})();(function(){a.htmlParser.cdata=function(l){this.value=l;};a.htmlParser.cdata.prototype={type:3,writeHtml:function(l){l.write(this.value);}};})();a.htmlParser.fragment=function(){this.children=[];this.parent=null;this._={isBlockLike:true,hasInlineStarted:false};};(function(){var l={colgroup:1,dd:1,dt:1,li:1,option:1,p:1,td:1,tfoot:1,th:1,thead:1,tr:1},m=e.extend({table:1,ul:1,ol:1,dl:1},f.table,f.ul,f.ol,f.dl),n=f.$list,o=f.$listItem;a.htmlParser.fragment.fromHtml=function(p,q){var r=new a.htmlParser(),s=[],t=new a.htmlParser.fragment(),u=[],v=[],w=t,x=false,y;function z(E){var F;if(u.length>0)for(var G=0;G<u.length;G++){var H=u[G],I=H.name,J=f[I],K=w.name&&f[w.name];if((!K||K[I])&&(!E||!J||J[E]||!f[E])){if(!F){A();F=1;}H=H.clone();H.parent=w;w=H;u.splice(G,1);G--;}}};function A(E){while(v.length-(E||0)>0)w.add(v.shift());};function B(E,F,G){F=F||w||t;if(q&&!F.type){var H,I;if(E.attributes&&(I=E.attributes['data-cke-real-element-type']))H=I;else H=E.name;if(H&&H in f.$inline){var J=w;w=F;r.onTagOpen(q,{});F=w;if(G)w=J;}}if(E._.isBlockLike&&E.name!='pre'){var K=E.children.length,L=E.children[K-1],M;if(L&&L.type==3)if(!(M=e.rtrim(L.value)))E.children.length=K-1;else L.value=M;}F.add(E);if(E.returnPoint){w=E.returnPoint;delete E.returnPoint;}};r.onTagOpen=function(E,F,G){var H=new a.htmlParser.element(E,F);if(H.isUnknown&&G)H.isEmpty=true;if(f.$removeEmpty[E]){u.push(H);return;}else if(E=='pre')x=true;else if(E=='br'&&x){w.add(new a.htmlParser.text('\n'));return;}if(E=='br'){v.push(H);return;}var I=w.name,J=I&&(f[I]||(w._.isBlockLike?f.div:f.span));if(J&&!H.isUnknown&&!w.isUnknown&&!J[E]){var K=false,L;if(E in n&&I in n){var M=w.children,N=M[M.length-1];if(!(N&&N.name in o))B(N=new a.htmlParser.element('li'),w);y=w,L=N;}else if(E==I)B(w,w.parent);else if(E in f.$listItem){r.onTagOpen('ul',{});L=w;K=true;}else{if(m[I]){if(!y)y=w;}else{B(w,w.parent,true);if(!l[I])u.unshift(w);}K=true;}if(L)w=L;else w=w.returnPoint||w.parent;if(K){r.onTagOpen.apply(this,arguments);return;}}z(E);A();H.parent=w;H.returnPoint=y;y=0;if(H.isEmpty)B(H);else w=H;};r.onTagClose=function(E){for(var F=u.length-1;F>=0;F--){if(E==u[F].name){u.splice(F,1);
+return;}}var G=[],H=[],I=w;while(I.type&&I.name!=E){if(!I._.isBlockLike)H.unshift(I);G.push(I);I=I.parent;}if(I.type){for(F=0;F<G.length;F++){var J=G[F];B(J,J.parent);}w=I;if(w.name=='pre')x=false;if(I._.isBlockLike)A();B(I,I.parent);if(I==w)w=w.parent;u=u.concat(H);}if(E=='body')q=false;};r.onText=function(E){if(!w._.hasInlineStarted&&!x){E=e.ltrim(E);if(E.length===0)return;}A();z();if(q&&(!w.type||w.name=='body')&&e.trim(E))this.onTagOpen(q,{});if(!x)E=E.replace(/[\t\r\n ]{2,}|[\t\r\n]/g,' ');w.add(new a.htmlParser.text(E));};r.onCDATA=function(E){w.add(new a.htmlParser.cdata(E));};r.onComment=function(E){A();z();w.add(new a.htmlParser.comment(E));};r.parse(p);A(!c&&1);while(w.type){var C=w.parent,D=w;if(q&&(!C.type||C.name=='body')&&!f.$body[D.name]){w=C;r.onTagOpen(q,{});C=w;}C.add(D);w=C;}return t;};a.htmlParser.fragment.prototype={add:function(p){var s=this;var q=s.children.length,r=q>0&&s.children[q-1]||null;if(r){if(p._.isBlockLike&&r.type==3){r.value=e.rtrim(r.value);if(r.value.length===0){s.children.pop();s.add(p);return;}}r.next=p;}p.previous=r;p.parent=s;s.children.push(p);s._.hasInlineStarted=p.type==3||p.type==1&&!p._.isBlockLike;},writeHtml:function(p,q){var r;this.filterChildren=function(){var s=new a.htmlParser.basicWriter();this.writeChildrenHtml.call(this,s,q,true);var t=s.getHtml();this.children=new a.htmlParser.fragment.fromHtml(t).children;r=1;};!this.name&&q&&q.onFragment(this);this.writeChildrenHtml(p,r?null:q);},writeChildrenHtml:function(p,q){for(var r=0;r<this.children.length;r++)this.children[r].writeHtml(p,q);}};})();a.htmlParser.element=function(l,m){var s=this;s.name=l;s.attributes=m||(m={});s.children=[];var n=m['data-cke-real-element-type']||l,o=n.match(/^cke:(.*)/);o&&(n=o[1]);var p=f,q=!!(p.$nonBodyContent[n]||p.$block[n]||p.$listItem[n]||p.$tableContent[n]||p.$nonEditable[n]||n=='br'),r=!!p.$empty[l];s.isEmpty=r;s.isUnknown=!p[l];s._={isBlockLike:q,hasInlineStarted:r||!q};};(function(){var l=function(m,n){m=m[0];n=n[0];return m<n?-1:m>n?1:0;};a.htmlParser.element.prototype={type:1,add:a.htmlParser.fragment.prototype.add,clone:function(){return new a.htmlParser.element(this.name,this.attributes);},writeHtml:function(m,n){var o=this.attributes,p=this,q=p.name,r,s,t,u;p.filterChildren=function(){if(!u){var z=new a.htmlParser.basicWriter();a.htmlParser.fragment.prototype.writeChildrenHtml.call(p,z,n);p.children=new a.htmlParser.fragment.fromHtml(z.getHtml()).children;u=1;}};if(n){for(;;){if(!(q=n.onElementName(q)))return;p.name=q;
+if(!(p=n.onElement(p)))return;p.parent=this.parent;if(p.name==q)break;if(p.type!=1){p.writeHtml(m,n);return;}q=p.name;if(!q){this.writeChildrenHtml.call(p,m,u?null:n);return;}}o=p.attributes;}m.openTag(q,o);var v=[];for(var w=0;w<2;w++)for(r in o){s=r;t=o[r];if(w==1)v.push([r,t]);else if(n){for(;;){if(!(s=n.onAttributeName(r))){delete o[r];break;}else if(s!=r){delete o[r];r=s;continue;}else break;}if(s)if((t=n.onAttribute(p,s,t))===false)delete o[s];else o[s]=t;}}if(m.sortAttributes)v.sort(l);var x=v.length;for(w=0;w<x;w++){var y=v[w];m.attribute(y[0],y[1]);}m.openTagClose(q,p.isEmpty);if(!p.isEmpty){this.writeChildrenHtml.call(p,m,u?null:n);m.closeTag(q);}},writeChildrenHtml:function(m,n){a.htmlParser.fragment.prototype.writeChildrenHtml.apply(this,arguments);}};})();(function(){a.htmlParser.filter=e.createClass({$:function(q){this._={elementNames:[],attributeNames:[],elements:{$length:0},attributes:{$length:0}};if(q)this.addRules(q,10);},proto:{addRules:function(q,r){var s=this;if(typeof r!='number')r=10;m(s._.elementNames,q.elementNames,r);m(s._.attributeNames,q.attributeNames,r);n(s._.elements,q.elements,r);n(s._.attributes,q.attributes,r);s._.text=o(s._.text,q.text,r)||s._.text;s._.comment=o(s._.comment,q.comment,r)||s._.comment;s._.root=o(s._.root,q.root,r)||s._.root;},onElementName:function(q){return l(q,this._.elementNames);},onAttributeName:function(q){return l(q,this._.attributeNames);},onText:function(q){var r=this._.text;return r?r.filter(q):q;},onComment:function(q,r){var s=this._.comment;return s?s.filter(q,r):q;},onFragment:function(q){var r=this._.root;return r?r.filter(q):q;},onElement:function(q){var v=this;var r=[v._.elements['^'],v._.elements[q.name],v._.elements.$],s,t;for(var u=0;u<3;u++){s=r[u];if(s){t=s.filter(q,v);if(t===false)return null;if(t&&t!=q)return v.onNode(t);if(q.parent&&!q.name)break;}}return q;},onNode:function(q){var r=q.type;return r==1?this.onElement(q):r==3?new a.htmlParser.text(this.onText(q.value)):r==8?new a.htmlParser.comment(this.onComment(q.value)):null;},onAttribute:function(q,r,s){var t=this._.attributes[r];if(t){var u=t.filter(s,q,this);if(u===false)return false;if(typeof u!='undefined')return u;}return s;}}});function l(q,r){for(var s=0;q&&s<r.length;s++){var t=r[s];q=q.replace(t[0],t[1]);}return q;};function m(q,r,s){if(typeof r=='function')r=[r];var t,u,v=q.length,w=r&&r.length;if(w){for(t=0;t<v&&q[t].pri<s;t++){}for(u=w-1;u>=0;u--){var x=r[u];if(x){x.pri=s;q.splice(t,0,x);}}}};function n(q,r,s){if(r)for(var t in r){var u=q[t];
+q[t]=o(u,r[t],s);if(!u)q.$length++;}};function o(q,r,s){if(r){r.pri=s;if(q){if(!q.splice){if(q.pri>s)q=[r,q];else q=[q,r];q.filter=p;}else m(q,r,s);return q;}else{r.filter=r;return r;}}};function p(q){var r=q.type||q instanceof a.htmlParser.fragment;for(var s=0;s<this.length;s++){if(r)var t=q.type,u=q.name;var v=this[s],w=v.apply(window,arguments);if(w===false)return w;if(r){if(w&&(w.name!=u||w.type!=t))return w;}else if(typeof w!='string')return w;w!=undefined&&(q=w);}return q;};})();a.htmlParser.basicWriter=e.createClass({$:function(){this._={output:[]};},proto:{openTag:function(l,m){this._.output.push('<',l);},openTagClose:function(l,m){if(m)this._.output.push(' />');else this._.output.push('>');},attribute:function(l,m){if(typeof m=='string')m=e.htmlEncodeAttr(m);this._.output.push(' ',l,'="',m,'"');},closeTag:function(l){this._.output.push('</',l,'>');},text:function(l){this._.output.push(l);},comment:function(l){this._.output.push('<!--',l,'-->');},write:function(l){this._.output.push(l);},reset:function(){this._.output=[];this._.indent=false;},getHtml:function(l){var m=this._.output.join('');if(l)this.reset();return m;}}});delete a.loadFullCore;a.instances={};a.document=new g(document);a.add=function(l){a.instances[l.name]=l;l.on('focus',function(){if(a.currentInstance!=l){a.currentInstance=l;a.fire('currentInstance');}});l.on('blur',function(){if(a.currentInstance==l){a.currentInstance=null;a.fire('currentInstance');}});};a.remove=function(l){delete a.instances[l.name];};a.on('instanceDestroyed',function(){if(e.isEmpty(this.instances))a.fire('reset');});a.TRISTATE_ON=1;a.TRISTATE_OFF=2;a.TRISTATE_DISABLED=0;d.comment=e.createClass({base:d.node,$:function(l,m){if(typeof l=='string')l=(m?m.$:document).createComment(l);this.base(l);},proto:{type:8,getOuterHtml:function(){return '<!--'+this.$.nodeValue+'-->';}}});(function(){var l={address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1,legend:1},m={body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,caption:1,form:1,fieldset:1},n=function(o){var p=o.getChildren();for(var q=0,r=p.count();q<r;q++){var s=p.getItem(q);if(s.type==1&&f.$block[s.getName()])return true;}return false;};d.elementPath=function(o){var u=this;var p=null,q=null,r=[],s=o;while(s){if(s.type==1){if(!u.lastElement)u.lastElement=s;var t=s.getName();if(c&&s.$.scopeName!='HTML')t=s.$.scopeName.toLowerCase()+':'+t;if(!q){if(!p&&l[t])p=s;if(m[t])if(!p&&t=='div'&&!n(s))p=s;else q=s;}r.push(s);if(t=='body')break;}s=s.getParent();
+}u.block=p;u.blockLimit=q;u.elements=r;};})();d.elementPath.prototype={compare:function(l){var m=this.elements,n=l&&l.elements;if(!n||m.length!=n.length)return false;for(var o=0;o<m.length;o++){if(!m[o].equals(n[o]))return false;}return true;},contains:function(l){var m=this.elements;for(var n=0;n<m.length;n++){if(m[n].getName() in l)return m[n];}return null;}};d.text=function(l,m){if(typeof l=='string')l=(m?m.$:document).createTextNode(l);this.$=l;};d.text.prototype=new d.node();e.extend(d.text.prototype,{type:3,getLength:function(){return this.$.nodeValue.length;},getText:function(){return this.$.nodeValue;},split:function(l){var q=this;if(c&&l==q.getLength()){var m=q.getDocument().createText('');m.insertAfter(q);return m;}var n=q.getDocument(),o=new d.text(q.$.splitText(l),n);if(b.ie8){var p=new d.text('',n);p.insertAfter(o);p.remove();}return o;},substring:function(l,m){if(typeof m!='number')return this.$.nodeValue.substr(l);else return this.$.nodeValue.substring(l,m);}});d.documentFragment=function(l){l=l||a.document;this.$=l.$.createDocumentFragment();};e.extend(d.documentFragment.prototype,h.prototype,{type:11,insertAfterNode:function(l){l=l.$;l.parentNode.insertBefore(this.$,l.nextSibling);}},true,{append:1,appendBogus:1,getFirst:1,getLast:1,appendTo:1,moveChildren:1,insertBefore:1,insertAfterNode:1,replace:1,trim:1,type:1,ltrim:1,rtrim:1,getDocument:1,getChildCount:1,getChild:1,getChildren:1});(function(){function l(s,t){if(this._.end)return null;var u,v=this.range,w,x=this.guard,y=this.type,z=s?'getPreviousSourceNode':'getNextSourceNode';if(!this._.start){this._.start=1;v.trim();if(v.collapsed){this.end();return null;}}if(!s&&!this._.guardLTR){var A=v.endContainer,B=A.getChild(v.endOffset);this._.guardLTR=function(F,G){return(!G||!A.equals(F))&&(!B||!F.equals(B))&&(F.type!=1||!G||F.getName()!='body');};}if(s&&!this._.guardRTL){var C=v.startContainer,D=v.startOffset>0&&C.getChild(v.startOffset-1);this._.guardRTL=function(F,G){return(!G||!C.equals(F))&&(!D||!F.equals(D))&&(F.type!=1||!G||F.getName()!='body');};}var E=s?this._.guardRTL:this._.guardLTR;if(x)w=function(F,G){if(E(F,G)===false)return false;return x(F,G);};else w=E;if(this.current)u=this.current[z](false,y,w);else if(s){u=v.endContainer;if(v.endOffset>0){u=u.getChild(v.endOffset-1);if(w(u)===false)u=null;}else u=w(u,true)===false?null:u.getPreviousSourceNode(true,y,w);}else{u=v.startContainer;u=u.getChild(v.startOffset);if(u){if(w(u)===false)u=null;}else u=w(v.startContainer,true)===false?null:v.startContainer.getNextSourceNode(true,y,w);
+}while(u&&!this._.end){this.current=u;if(!this.evaluator||this.evaluator(u)!==false){if(!t)return u;}else if(t&&this.evaluator)return false;u=u[z](false,y,w);}this.end();return this.current=null;};function m(s){var t,u=null;while(t=l.call(this,s))u=t;return u;};d.walker=e.createClass({$:function(s){this.range=s;this._={};},proto:{end:function(){this._.end=1;},next:function(){return l.call(this);},previous:function(){return l.call(this,1);},checkForward:function(){return l.call(this,0,1)!==false;},checkBackward:function(){return l.call(this,1,1)!==false;},lastForward:function(){return m.call(this);},lastBackward:function(){return m.call(this,1);},reset:function(){delete this.current;this._={};}}});var n={block:1,'list-item':1,table:1,'table-row-group':1,'table-header-group':1,'table-footer-group':1,'table-row':1,'table-column-group':1,'table-column':1,'table-cell':1,'table-caption':1};h.prototype.isBlockBoundary=function(s){var t=e.extend({},f.$block,s||{});return this.getComputedStyle('float')=='none'&&n[this.getComputedStyle('display')]||t[this.getName()];};d.walker.blockBoundary=function(s){return function(t,u){return!(t.type==1&&t.isBlockBoundary(s));};};d.walker.listItemBoundary=function(){return this.blockBoundary({br:1});};d.walker.bookmark=function(s,t){function u(v){return v&&v.getName&&v.getName()=='span'&&v.data('cke-bookmark');};return function(v){var w,x;w=v&&!v.getName&&(x=v.getParent())&&u(x);w=s?w:w||u(v);return!!(t^w);};};d.walker.whitespaces=function(s){return function(t){var u=t&&t.type==3&&!e.trim(t.getText());return!!(s^u);};};d.walker.invisible=function(s){var t=d.walker.whitespaces();return function(u){var v=t(u)||u.is&&!u.$.offsetHeight;return!!(s^v);};};d.walker.nodeType=function(s,t){return function(u){return!!(t^u.type==s);};};var o=/^[\t\r\n ]*(?: |\xa0)$/,p=d.walker.whitespaces(),q=d.walker.bookmark(),r=function(s){return q(s)||p(s)||s.type==1&&s.getName() in f.$inline&&!(s.getName() in f.$empty);};h.prototype.getBogus=function(){var s=this;do s=s.getPreviousSourceNode();while(r(s));if(s&&(!c?s.is&&s.is('br'):s.getText&&o.test(s.getText())))return s;return false;};})();d.range=function(l){var m=this;m.startContainer=null;m.startOffset=null;m.endContainer=null;m.endOffset=null;m.collapsed=true;m.document=l;};(function(){var l=function(t){t.collapsed=t.startContainer&&t.endContainer&&t.startContainer.equals(t.endContainer)&&t.startOffset==t.endOffset;},m=function(t,u,v,w){t.optimizeBookmark();var x=t.startContainer,y=t.endContainer,z=t.startOffset,A=t.endOffset,B,C;
+if(y.type==3)y=y.split(A);else if(y.getChildCount()>0)if(A>=y.getChildCount()){y=y.append(t.document.createText(''));C=true;}else y=y.getChild(A);if(x.type==3){x.split(z);if(x.equals(y))y=x.getNext();}else if(!z){x=x.getFirst().insertBeforeMe(t.document.createText(''));B=true;}else if(z>=x.getChildCount()){x=x.append(t.document.createText(''));B=true;}else x=x.getChild(z).getPrevious();var D=x.getParents(),E=y.getParents(),F,G,H;for(F=0;F<D.length;F++){G=D[F];H=E[F];if(!G.equals(H))break;}var I=v,J,K,L,M;for(var N=F;N<D.length;N++){J=D[N];if(I&&!J.equals(x))K=I.append(J.clone());L=J.getNext();while(L){if(L.equals(E[N])||L.equals(y))break;M=L.getNext();if(u==2)I.append(L.clone(true));else{L.remove();if(u==1)I.append(L);}L=M;}if(I)I=K;}I=v;for(var O=F;O<E.length;O++){J=E[O];if(u>0&&!J.equals(y))K=I.append(J.clone());if(!D[O]||J.$.parentNode!=D[O].$.parentNode){L=J.getPrevious();while(L){if(L.equals(D[O])||L.equals(x))break;M=L.getPrevious();if(u==2)I.$.insertBefore(L.$.cloneNode(true),I.$.firstChild);else{L.remove();if(u==1)I.$.insertBefore(L.$,I.$.firstChild);}L=M;}}if(I)I=K;}if(u==2){var P=t.startContainer;if(P.type==3){P.$.data+=P.$.nextSibling.data;P.$.parentNode.removeChild(P.$.nextSibling);}var Q=t.endContainer;if(Q.type==3&&Q.$.nextSibling){Q.$.data+=Q.$.nextSibling.data;Q.$.parentNode.removeChild(Q.$.nextSibling);}}else{if(G&&H&&(x.$.parentNode!=G.$.parentNode||y.$.parentNode!=H.$.parentNode)){var R=H.getIndex();if(B&&H.$.parentNode==x.$.parentNode)R--;if(w&&G.type==1){var S=h.createFromHtml('<span data-cke-bookmark="1" style="display:none"> </span>',t.document);S.insertAfter(G);G.mergeSiblings(false);t.moveToBookmark({startNode:S});}else t.setStart(H.getParent(),R);}t.collapse(true);}if(B)x.remove();if(C&&y.$.parentNode)y.remove();},n={abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1};function o(t){var u=false,v=d.walker.bookmark(true);return function(w){if(v(w))return true;if(w.type==3){if(e.trim(w.getText()).length)return false;}else if(w.type==1)if(!n[w.getName()])if(!t&&!c&&w.getName()=='br'&&!u)u=true;else return false;return true;};};function p(t){return t.type!=3&&t.getName() in f.$removeEmpty||!e.trim(t.getText())||!!t.getParent().data('cke-bookmark');};var q=new d.walker.whitespaces(),r=new d.walker.bookmark();function s(t){return!q(t)&&!r(t);};d.range.prototype={clone:function(){var u=this;var t=new d.range(u.document);
+t.startContainer=u.startContainer;t.startOffset=u.startOffset;t.endContainer=u.endContainer;t.endOffset=u.endOffset;t.collapsed=u.collapsed;return t;},collapse:function(t){var u=this;if(t){u.endContainer=u.startContainer;u.endOffset=u.startOffset;}else{u.startContainer=u.endContainer;u.startOffset=u.endOffset;}u.collapsed=true;},cloneContents:function(){var t=new d.documentFragment(this.document);if(!this.collapsed)m(this,2,t);return t;},deleteContents:function(t){if(this.collapsed)return;m(this,0,null,t);},extractContents:function(t){var u=new d.documentFragment(this.document);if(!this.collapsed)m(this,1,u,t);return u;},createBookmark:function(t){var z=this;var u,v,w,x,y=z.collapsed;u=z.document.createElement('span');u.data('cke-bookmark',1);u.setStyle('display','none');u.setHtml(' ');if(t){w='cke_bm_'+e.getNextNumber();u.setAttribute('id',w+'S');}if(!y){v=u.clone();v.setHtml(' ');if(t)v.setAttribute('id',w+'E');x=z.clone();x.collapse();x.insertNode(v);}x=z.clone();x.collapse(true);x.insertNode(u);if(v){z.setStartAfter(u);z.setEndBefore(v);}else z.moveToPosition(u,4);return{startNode:t?w+'S':u,endNode:t?w+'E':v,serializable:t,collapsed:y};},createBookmark2:function(t){var B=this;var u=B.startContainer,v=B.endContainer,w=B.startOffset,x=B.endOffset,y=B.collapsed,z,A;if(!u||!v)return{start:0,end:0};if(t){if(u.type==1){z=u.getChild(w);if(z&&z.type==3&&w>0&&z.getPrevious().type==3){u=z;w=0;}}while(u.type==3&&(A=u.getPrevious())&&A.type==3){u=A;w+=A.getLength();}if(!y){if(v.type==1){z=v.getChild(x);if(z&&z.type==3&&x>0&&z.getPrevious().type==3){v=z;x=0;}}while(v.type==3&&(A=v.getPrevious())&&A.type==3){v=A;x+=A.getLength();}}}return{start:u.getAddress(t),end:y?null:v.getAddress(t),startOffset:w,endOffset:x,normalized:t,collapsed:y,is2:true};},moveToBookmark:function(t){var B=this;if(t.is2){var u=B.document.getByAddress(t.start,t.normalized),v=t.startOffset,w=t.end&&B.document.getByAddress(t.end,t.normalized),x=t.endOffset;B.setStart(u,v);if(w)B.setEnd(w,x);else B.collapse(true);}else{var y=t.serializable,z=y?B.document.getById(t.startNode):t.startNode,A=y?B.document.getById(t.endNode):t.endNode;B.setStartBefore(z);z.remove();if(A){B.setEndBefore(A);A.remove();}else B.collapse(true);}},getBoundaryNodes:function(){var y=this;var t=y.startContainer,u=y.endContainer,v=y.startOffset,w=y.endOffset,x;if(t.type==1){x=t.getChildCount();if(x>v)t=t.getChild(v);else if(x<1)t=t.getPreviousSourceNode();else{t=t.$;while(t.lastChild)t=t.lastChild;t=new d.node(t);t=t.getNextSourceNode()||t;
+}}if(u.type==1){x=u.getChildCount();if(x>w)u=u.getChild(w).getPreviousSourceNode(true);else if(x<1)u=u.getPreviousSourceNode();else{u=u.$;while(u.lastChild)u=u.lastChild;u=new d.node(u);}}if(t.getPosition(u)&2)t=u;return{startNode:t,endNode:u};},getCommonAncestor:function(t,u){var y=this;var v=y.startContainer,w=y.endContainer,x;if(v.equals(w)){if(t&&v.type==1&&y.startOffset==y.endOffset-1)x=v.getChild(y.startOffset);else x=v;}else x=v.getCommonAncestor(w);return u&&!x.is?x.getParent():x;},optimize:function(){var v=this;var t=v.startContainer,u=v.startOffset;if(t.type!=1)if(!u)v.setStartBefore(t);else if(u>=t.getLength())v.setStartAfter(t);t=v.endContainer;u=v.endOffset;if(t.type!=1)if(!u)v.setEndBefore(t);else if(u>=t.getLength())v.setEndAfter(t);},optimizeBookmark:function(){var v=this;var t=v.startContainer,u=v.endContainer;if(t.is&&t.is('span')&&t.data('cke-bookmark'))v.setStartAt(t,3);if(u&&u.is&&u.is('span')&&u.data('cke-bookmark'))v.setEndAt(u,4);},trim:function(t,u){var B=this;var v=B.startContainer,w=B.startOffset,x=B.collapsed;if((!t||x)&&v&&v.type==3){if(!w){w=v.getIndex();v=v.getParent();}else if(w>=v.getLength()){w=v.getIndex()+1;v=v.getParent();}else{var y=v.split(w);w=v.getIndex()+1;v=v.getParent();if(B.startContainer.equals(B.endContainer))B.setEnd(y,B.endOffset-B.startOffset);else if(v.equals(B.endContainer))B.endOffset+=1;}B.setStart(v,w);if(x){B.collapse(true);return;}}var z=B.endContainer,A=B.endOffset;if(!(u||x)&&z&&z.type==3){if(!A){A=z.getIndex();z=z.getParent();}else if(A>=z.getLength()){A=z.getIndex()+1;z=z.getParent();}else{z.split(A);A=z.getIndex()+1;z=z.getParent();}B.setEnd(z,A);}},enlarge:function(t,u){switch(t){case 1:if(this.collapsed)return;var v=this.getCommonAncestor(),w=this.document.getBody(),x,y,z,A,B,C=false,D,E,F=this.startContainer,G=this.startOffset;if(F.type==3){if(G){F=!e.trim(F.substring(0,G)).length&&F;C=!!F;}if(F)if(!(A=F.getPrevious()))z=F.getParent();}else{if(G)A=F.getChild(G-1)||F.getLast();if(!A)z=F;}while(z||A){if(z&&!A){if(!B&&z.equals(v))B=true;if(!w.contains(z))break;if(!C||z.getComputedStyle('display')!='inline'){C=false;if(B)x=z;else this.setStartBefore(z);}A=z.getPrevious();}while(A){D=false;if(A.type==3){E=A.getText();if(/[^\s\ufeff]/.test(E))A=null;D=/[\s\ufeff]$/.test(E);}else if((A.$.offsetWidth>0||u&&A.is('br'))&&!A.data('cke-bookmark'))if(C&&f.$removeEmpty[A.getName()]){E=A.getText();if(/[^\s\ufeff]/.test(E))A=null;else{var H=A.$.all||A.$.getElementsByTagName('*');for(var I=0,J;J=H[I++];){if(!f.$removeEmpty[J.nodeName.toLowerCase()]){A=null;
+break;}}}if(A)D=!!E.length;}else A=null;if(D)if(C){if(B)x=z;else if(z)this.setStartBefore(z);}else C=true;if(A){var K=A.getPrevious();if(!z&&!K){z=A;A=null;break;}A=K;}else z=null;}if(z)z=z.getParent();}F=this.endContainer;G=this.endOffset;z=A=null;B=C=false;if(F.type==3){F=!e.trim(F.substring(G)).length&&F;C=!(F&&F.getLength());if(F)if(!(A=F.getNext()))z=F.getParent();}else{A=F.getChild(G);if(!A)z=F;}while(z||A){if(z&&!A){if(!B&&z.equals(v))B=true;if(!w.contains(z))break;if(!C||z.getComputedStyle('display')!='inline'){C=false;if(B)y=z;else if(z)this.setEndAfter(z);}A=z.getNext();}while(A){D=false;if(A.type==3){E=A.getText();if(/[^\s\ufeff]/.test(E))A=null;D=/^[\s\ufeff]/.test(E);}else if((A.$.offsetWidth>0||u&&A.is('br'))&&!A.data('cke-bookmark'))if(C&&f.$removeEmpty[A.getName()]){E=A.getText();if(/[^\s\ufeff]/.test(E))A=null;else{H=A.$.all||A.$.getElementsByTagName('*');for(I=0;J=H[I++];){if(!f.$removeEmpty[J.nodeName.toLowerCase()]){A=null;break;}}}if(A)D=!!E.length;}else A=null;if(D)if(C)if(B)y=z;else this.setEndAfter(z);if(A){K=A.getNext();if(!z&&!K){z=A;A=null;break;}A=K;}else z=null;}if(z)z=z.getParent();}if(x&&y){v=x.contains(y)?y:x;this.setStartBefore(v);this.setEndAfter(v);}break;case 2:case 3:var L=new d.range(this.document);w=this.document.getBody();L.setStartAt(w,1);L.setEnd(this.startContainer,this.startOffset);var M=new d.walker(L),N,O,P=d.walker.blockBoundary(t==3?{br:1}:null),Q=function(S){var T=P(S);if(!T)N=S;return T;},R=function(S){var T=Q(S);if(!T&&S.is&&S.is('br'))O=S;return T;};M.guard=Q;z=M.lastBackward();N=N||w;this.setStartAt(N,!N.is('br')&&(!z&&this.checkStartOfBlock()||z&&N.contains(z))?1:4);L=this.clone();L.collapse();L.setEndAt(w,2);M=new d.walker(L);M.guard=t==3?R:Q;N=null;z=M.lastForward();N=N||w;this.setEndAt(N,!z&&this.checkEndOfBlock()||z&&N.contains(z)?2:3);if(O)this.setEndAfter(O);}},shrink:function(t,u){if(!this.collapsed){t=t||2;var v=this.clone(),w=this.startContainer,x=this.endContainer,y=this.startOffset,z=this.endOffset,A=this.collapsed,B=1,C=1;if(w&&w.type==3)if(!y)v.setStartBefore(w);else if(y>=w.getLength())v.setStartAfter(w);else{v.setStartBefore(w);B=0;}if(x&&x.type==3)if(!z)v.setEndBefore(x);else if(z>=x.getLength())v.setEndAfter(x);else{v.setEndAfter(x);C=0;}var D=new d.walker(v),E=d.walker.bookmark();D.evaluator=function(I){return I.type==(t==1?1:3);};var F;D.guard=function(I,J){if(E(I))return true;if(t==1&&I.type==3)return false;if(J&&I.equals(F))return false;if(!J&&I.type==1)F=I;return true;};if(B){var G=D[t==1?'lastForward':'next']();
+G&&this.setStartAt(G,u?1:3);}if(C){D.reset();var H=D[t==1?'lastBackward':'previous']();H&&this.setEndAt(H,u?2:4);}return!!(B||C);}},insertNode:function(t){var x=this;x.optimizeBookmark();x.trim(false,true);var u=x.startContainer,v=x.startOffset,w=u.getChild(v);if(w)t.insertBefore(w);else u.append(t);if(t.getParent().equals(x.endContainer))x.endOffset++;x.setStartBefore(t);},moveToPosition:function(t,u){this.setStartAt(t,u);this.collapse(true);},selectNodeContents:function(t){this.setStart(t,0);this.setEnd(t,t.type==3?t.getLength():t.getChildCount());},setStart:function(t,u){var v=this;if(t.type==1&&f.$empty[t.getName()])u=t.getIndex(),t=t.getParent();v.startContainer=t;v.startOffset=u;if(!v.endContainer){v.endContainer=t;v.endOffset=u;}l(v);},setEnd:function(t,u){var v=this;if(t.type==1&&f.$empty[t.getName()])u=t.getIndex()+1,t=t.getParent();v.endContainer=t;v.endOffset=u;if(!v.startContainer){v.startContainer=t;v.startOffset=u;}l(v);},setStartAfter:function(t){this.setStart(t.getParent(),t.getIndex()+1);},setStartBefore:function(t){this.setStart(t.getParent(),t.getIndex());},setEndAfter:function(t){this.setEnd(t.getParent(),t.getIndex()+1);},setEndBefore:function(t){this.setEnd(t.getParent(),t.getIndex());},setStartAt:function(t,u){var v=this;switch(u){case 1:v.setStart(t,0);break;case 2:if(t.type==3)v.setStart(t,t.getLength());else v.setStart(t,t.getChildCount());break;case 3:v.setStartBefore(t);break;case 4:v.setStartAfter(t);}l(v);},setEndAt:function(t,u){var v=this;switch(u){case 1:v.setEnd(t,0);break;case 2:if(t.type==3)v.setEnd(t,t.getLength());else v.setEnd(t,t.getChildCount());break;case 3:v.setEndBefore(t);break;case 4:v.setEndAfter(t);}l(v);},fixBlock:function(t,u){var x=this;var v=x.createBookmark(),w=x.document.createElement(u);x.collapse(t);x.enlarge(2);x.extractContents().appendTo(w);w.trim();if(!c)w.appendBogus();x.insertNode(w);x.moveToBookmark(v);return w;},splitBlock:function(t){var D=this;var u=new d.elementPath(D.startContainer),v=new d.elementPath(D.endContainer),w=u.blockLimit,x=v.blockLimit,y=u.block,z=v.block,A=null;if(!w.equals(x))return null;if(t!='br'){if(!y){y=D.fixBlock(true,t);z=new d.elementPath(D.endContainer).block;}if(!z)z=D.fixBlock(false,t);}var B=y&&D.checkStartOfBlock(),C=z&&D.checkEndOfBlock();D.deleteContents();if(y&&y.equals(z))if(C){A=new d.elementPath(D.startContainer);D.moveToPosition(z,4);z=null;}else if(B){A=new d.elementPath(D.startContainer);D.moveToPosition(y,3);y=null;}else{z=D.splitElement(y);if(!c&&!y.is('ul','ol'))y.appendBogus();
+}return{previousBlock:y,nextBlock:z,wasStartOfBlock:B,wasEndOfBlock:C,elementPath:A};},splitElement:function(t){var w=this;if(!w.collapsed)return null;w.setEndAt(t,2);var u=w.extractContents(),v=t.clone(false);u.appendTo(v);v.insertAfter(t);w.moveToPosition(t,4);return v;},checkBoundaryOfElement:function(t,u){var v=u==1,w=this.clone();w.collapse(v);w[v?'setStartAt':'setEndAt'](t,v?1:2);var x=new d.walker(w);x.evaluator=p;return x[v?'checkBackward':'checkForward']();},checkStartOfBlock:function(){var z=this;var t=z.startContainer,u=z.startOffset;if(u&&t.type==3){var v=e.ltrim(t.substring(0,u));if(v.length)return false;}z.trim();var w=new d.elementPath(z.startContainer),x=z.clone();x.collapse(true);x.setStartAt(w.block||w.blockLimit,1);var y=new d.walker(x);y.evaluator=o(true);return y.checkBackward();},checkEndOfBlock:function(){var z=this;var t=z.endContainer,u=z.endOffset;if(t.type==3){var v=e.rtrim(t.substring(u));if(v.length)return false;}z.trim();var w=new d.elementPath(z.endContainer),x=z.clone();x.collapse(false);x.setEndAt(w.block||w.blockLimit,2);var y=new d.walker(x);y.evaluator=o(false);return y.checkForward();},checkReadOnly:(function(){function t(u,v){while(u){if(u.type==1)if(u.getAttribute('contentEditable')=='false'&&!u.data('cke-editable'))return 0;else if(u.is('body')||u.getAttribute('contentEditable')=='true'&&(u.contains(v)||u.equals(v)))break;u=u.getParent();}return 1;};return function(){var u=this.startContainer,v=this.endContainer;return!(t(u,v)&&t(v,u));};})(),moveToElementEditablePosition:function(t,u){var v;if(f.$empty[t.getName()])return false;while(t&&t.type==1){v=t.isEditable();if(v)this.moveToPosition(t,u?2:1);else if(f.$inline[t.getName()]){this.moveToPosition(t,u?4:3);return true;}if(f.$empty[t.getName()])t=t[u?'getPrevious':'getNext'](s);else t=t[u?'getLast':'getFirst'](s);if(t&&t.type==3){this.moveToPosition(t,u?4:3);return true;}}return v;},moveToElementEditStart:function(t){return this.moveToElementEditablePosition(t);},moveToElementEditEnd:function(t){return this.moveToElementEditablePosition(t,true);},getEnclosedNode:function(){var t=this.clone();t.optimize();if(t.startContainer.type!=1||t.endContainer.type!=1)return null;var u=new d.walker(t),v=d.walker.bookmark(true),w=d.walker.whitespaces(true),x=function(z){return w(z)&&v(z);};t.evaluator=x;var y=u.next();u.reset();return y&&y.equals(u.previous())?y:null;},getTouchedStartNode:function(){var t=this.startContainer;if(this.collapsed||t.type!=1)return t;return t.getChild(this.startOffset)||t;
+},getTouchedEndNode:function(){var t=this.endContainer;if(this.collapsed||t.type!=1)return t;return t.getChild(this.endOffset-1)||t;}};})();a.POSITION_AFTER_START=1;a.POSITION_BEFORE_END=2;a.POSITION_BEFORE_START=3;a.POSITION_AFTER_END=4;a.ENLARGE_ELEMENT=1;a.ENLARGE_BLOCK_CONTENTS=2;a.ENLARGE_LIST_ITEM_CONTENTS=3;a.START=1;a.END=2;a.STARTEND=3;a.SHRINK_ELEMENT=1;a.SHRINK_TEXT=2;(function(){d.rangeList=function(n){if(n instanceof d.rangeList)return n;if(!n)n=[];else if(n instanceof d.range)n=[n];return e.extend(n,l);};var l={createIterator:function(){var n=this,o=d.walker.bookmark(),p=function(s){return!(s.is&&s.is('tr'));},q=[],r;return{getNextRange:function(s){r=r==undefined?0:r+1;var t=n[r];if(t&&n.length>1){if(!r)for(var u=n.length-1;u>=0;u--)q.unshift(n[u].createBookmark(true));if(s){var v=0;while(n[r+v+1]){var w=t.document,x=0,y=w.getById(q[v].endNode),z=w.getById(q[v+1].startNode),A;while(1){A=y.getNextSourceNode(false);if(!z.equals(A)){if(o(A)||A.type==1&&A.isBlockBoundary()){y=A;continue;}}else x=1;break;}if(!x)break;v++;}}t.moveToBookmark(q.shift());while(v--){A=n[++r];A.moveToBookmark(q.shift());t.setEnd(A.endContainer,A.endOffset);}}return t;}};},createBookmarks:function(n){var s=this;var o=[],p;for(var q=0;q<s.length;q++){o.push(p=s[q].createBookmark(n,true));for(var r=q+1;r<s.length;r++){s[r]=m(p,s[r]);s[r]=m(p,s[r],true);}}return o;},createBookmarks2:function(n){var o=[];for(var p=0;p<this.length;p++)o.push(this[p].createBookmark2(n));return o;},moveToBookmarks:function(n){for(var o=0;o<this.length;o++)this[o].moveToBookmark(n[o]);}};function m(n,o,p){var q=n.serializable,r=o[p?'endContainer':'startContainer'],s=p?'endOffset':'startOffset',t=q?o.document.getById(n.startNode):n.startNode,u=q?o.document.getById(n.endNode):n.endNode;if(r.equals(t.getPrevious())){o.startOffset=o.startOffset-r.getLength()-u.getPrevious().getLength();r=u.getNext();}else if(r.equals(u.getPrevious())){o.startOffset=o.startOffset-r.getLength();r=u.getNext();}r.equals(t.getParent())&&o[s]++;r.equals(u.getParent())&&o[s]++;o[p?'endContainer':'startContainer']=r;return o;};})();(function(){if(b.webkit){b.hc=false;return;}var l=c&&b.version<7,m=c&&b.version==7,n=l?a.basePath+'images/spacer.gif':m?'about:blank':'data:image/png;base64,',o=h.createFromHtml('<div style="width:0px;height:0px;position:absolute;left:-10000px;background-image:url('+n+')"></div>',a.document);o.appendTo(a.document.getHead());try{b.hc=o.getComputedStyle('background-image')=='none';}catch(p){b.hc=false;
+}if(b.hc)b.cssClass+=' cke_hc';o.remove();})();j.load(i.corePlugins.split(','),function(){a.status='loaded';a.fire('loaded');var l=a._.pending;if(l){delete a._.pending;for(var m=0;m<l.length;m++)a.add(l[m]);}});if(c)try{document.execCommand('BackgroundImageCache',false,true);}catch(l){}a.skins.add('kama',(function(){var m='cke_ui_color';return{editor:{css:['editor.css']},dialog:{css:['dialog.css']},templates:{css:['templates.css']},margins:[0,0,0,0],init:function(n){if(n.config.width&&!isNaN(n.config.width))n.config.width-=12;var o=[],p=/\$color/g,q='/* UI Color Support */.cke_skin_kama .cke_menuitem .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuitem a:hover .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:focus .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:active .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuitem a:hover .cke_label,.cke_skin_kama .cke_menuitem a:focus .cke_label,.cke_skin_kama .cke_menuitem a:active .cke_label{\tbackground-color: $color !important;}.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:active .cke_label{\tbackground-color: transparent !important;}.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a.cke_disabled:active .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuitem a.cke_disabled .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuseparator{\tbackground-color: $color !important;}.cke_skin_kama .cke_menuitem a:hover,.cke_skin_kama .cke_menuitem a:focus,.cke_skin_kama .cke_menuitem a:active{\tbackground-color: $color !important;}';if(b.webkit){q=q.split('}').slice(0,-1);for(var r=0;r<q.length;r++)q[r]=q[r].split('{');}function s(v){var w=v.getById(m);if(!w){w=v.getHead().append('style');w.setAttribute('id',m);w.setAttribute('type','text/css');}return w;};function t(v,w,x){var y,z,A;for(var B=0;B<v.length;B++){if(b.webkit)for(z=0;z<w.length;z++){A=w[z][1];for(y=0;y<x.length;y++)A=A.replace(x[y][0],x[y][1]);v[B].$.sheet.addRule(w[z][0],A);}else{A=w;for(y=0;y<x.length;y++)A=A.replace(x[y][0],x[y][1]);if(c)v[B].$.styleSheet.cssText+=A;else v[B].$.innerHTML+=A;
+}}};var u=/\$color/g;e.extend(n,{uiColor:null,getUiColor:function(){return this.uiColor;},setUiColor:function(v){var w,x=s(a.document),y='.'+n.id,z=[y+' .cke_wrapper',y+'_dialog .cke_dialog_contents',y+'_dialog a.cke_dialog_tab',y+'_dialog .cke_dialog_footer'].join(','),A='background-color: $color !important;';if(b.webkit)w=[[z,A]];else w=z+'{'+A+'}';return(this.setUiColor=function(B){var C=[[u,B]];n.uiColor=B;t([x],w,C);t(o,q,C);})(v);}});n.on('menuShow',function(v){var w=v.data[0],x=w.element.getElementsByTag('iframe').getItem(0).getFrameDocument();if(!x.getById('cke_ui_color')){var y=s(x);o.push(y);var z=n.getUiColor();if(z)t([y],q,[[u,z]]);}});if(n.config.uiColor)n.setUiColor(n.config.uiColor);}};})());(function(){a.dialog?m():a.on('dialogPluginReady',m);function m(){a.dialog.on('resize',function(n){var o=n.data,p=o.width,q=o.height,r=o.dialog,s=r.parts.contents;if(o.skin!='kama')return;s.setStyles({width:p+'px',height:q+'px'});});};})();j.add('about',{requires:['dialog'],init:function(m){var n=m.addCommand('about',new a.dialogCommand('about'));n.modes={wysiwyg:1,source:1};n.canUndo=false;m.ui.addButton('About',{label:m.lang.about.title,command:'about'});a.dialog.add('about',this.path+'dialogs/about.js');}});(function(){var m='a11yhelp',n='a11yHelp';j.add(m,{availableLangs:{en:1,he:1},init:function(o){var p=this;o.addCommand(n,{exec:function(){var q=o.langCode;q=p.availableLangs[q]?q:'en';a.scriptLoader.load(a.getUrl(p.path+'lang/'+q+'.js'),function(){e.extend(o.lang,p.lang[q]);o.openDialog(n);});},modes:{wysiwyg:1,source:1},canUndo:false});a.dialog.add(n,this.path+'dialogs/a11yhelp.js');}});})();j.add('basicstyles',{requires:['styles','button'],init:function(m){var n=function(q,r,s,t){var u=new a.style(t);m.attachStyleStateChange(u,function(v){m.getCommand(s).setState(v);});m.addCommand(s,new a.styleCommand(u));m.ui.addButton(q,{label:r,command:s});},o=m.config,p=m.lang;n('Bold',p.bold,'bold',o.coreStyles_bold);n('Italic',p.italic,'italic',o.coreStyles_italic);n('Underline',p.underline,'underline',o.coreStyles_underline);n('Strike',p.strike,'strike',o.coreStyles_strike);n('Subscript',p.subscript,'subscript',o.coreStyles_subscript);n('Superscript',p.superscript,'superscript',o.coreStyles_superscript);}});i.coreStyles_bold={element:'strong',overrides:'b'};i.coreStyles_italic={element:'em',overrides:'i'};i.coreStyles_underline={element:'u'};i.coreStyles_strike={element:'strike'};i.coreStyles_subscript={element:'sub'};i.coreStyles_superscript={element:'sup'};
+(function(){var m={table:1,ul:1,ol:1,blockquote:1,div:1},n={},o={};e.extend(n,m,{tr:1,p:1,div:1,li:1});e.extend(o,n,{td:1});function p(w){q(w);r(w);};function q(w){var x=w.editor,y=w.data.path,z=x.config.useComputedState,A;z=z===undefined||z;if(!z)A=s(y.lastElement);A=A||y.block||y.blockLimit;A.is('body')&&(A=x.getSelection().getRanges()[0].getEnclosedNode());if(!A)return;var B=z?A.getComputedStyle('direction'):A.getStyle('direction')||A.getAttribute('dir');x.getCommand('bidirtl').setState(B=='rtl'?1:2);x.getCommand('bidiltr').setState(B=='ltr'?1:2);};function r(w){var x=w.editor,y=x.container.getChild(1),z=w.data.path.block||w.data.path.blockLimit;if(z&&x.lang.dir!=z.getComputedStyle('direction'))y.addClass('cke_mixed_dir_content');else y.removeClass('cke_mixed_dir_content');};function s(w){while(w&&!(w.getName() in o||w.is('body'))){var x=w.getParent();if(!x)break;w=x;}return w;};function t(w,x,y,z){h.setMarker(z,w,'bidi_processed',1);var A=w;while((A=A.getParent())&&!A.is('body')){if(A.getCustomData('bidi_processed')){w.removeStyle('direction');w.removeAttribute('dir');return null;}}var B='useComputedState' in y.config?y.config.useComputedState:1,C=B?w.getComputedStyle('direction'):w.getStyle('direction')||w.hasAttribute('dir');if(C==x)return null;var D=B?C:w.getComputedStyle('direction');w.removeStyle('direction');if(B){w.removeAttribute('dir');if(x!=w.getComputedStyle('direction'))w.setAttribute('dir',x);}else w.setAttribute('dir',x);if(x!=D)y.fire('dirChanged',{node:w,dir:x});y.forceNextSelectionCheck();return null;};function u(w,x,y){var z=w.getCommonAncestor(false,true);w=w.clone();w.enlarge(y==2?3:2);if(w.checkBoundaryOfElement(z,1)&&w.checkBoundaryOfElement(z,2)){var A;while(z&&z.type==1&&(A=z.getParent())&&A.getChildCount()==1&&!(z.getName() in x))z=A;return z.type==1&&z.getName() in x&&z;}};function v(w){return function(x){var y=x.getSelection(),z=x.config.enterMode,A=y.getRanges();if(A&&A.length){var B={},C=y.createBookmarks(),D=A.createIterator(),E,F=0;while(E=D.getNextRange(1)){var G=E.getEnclosedNode();if(!G||G&&!(G.type==1&&G.getName() in n))G=u(E,m,z);if(G&&!G.isReadOnly())t(G,w,x,B);var H,I,J=new d.walker(E),K=C[F].startNode,L=C[F++].endNode;J.evaluator=function(M){return!!(M.type==1&&M.getName() in m&&!(M.getName()==(z==1?'p':'div')&&M.getParent().type==1&&M.getParent().getName()=='blockquote')&&M.getPosition(K)&2&&(M.getPosition(L)&4+16)==4);};while(I=J.next())t(I,w,x,B);H=E.createIterator();H.enlargeBr=z!=2;while(I=H.getNextParagraph(z==1?'p':'div'))!I.isReadOnly()&&t(I,w,x,B);
+}h.clearAllMarkers(B);x.forceNextSelectionCheck();y.selectBookmarks(C);x.focus();}};};j.add('bidi',{requires:['styles','button'],init:function(w){var x=function(z,A,B,C){w.addCommand(B,new a.command(w,{exec:C}));w.ui.addButton(z,{label:A,command:B});},y=w.lang.bidi;x('BidiLtr',y.ltr,'bidiltr',v('ltr'));x('BidiRtl',y.rtl,'bidirtl',v('rtl'));w.on('selectionChange',p);}});})();(function(){function m(q,r){var s=r.block||r.blockLimit;if(!s||s.getName()=='body')return 2;if(s.getAscendant('blockquote',true))return 1;return 2;};function n(q){var r=q.editor,s=r.getCommand('blockquote');s.state=m(r,q.data.path);s.fire('state');};function o(q){for(var r=0,s=q.getChildCount(),t;r<s&&(t=q.getChild(r));r++){if(t.type==1&&t.isBlockBoundary())return false;}return true;};var p={exec:function(q){var r=q.getCommand('blockquote').state,s=q.getSelection(),t=s&&s.getRanges(true)[0];if(!t)return;var u=s.createBookmarks();if(c){var v=u[0].startNode,w=u[0].endNode,x;if(v&&v.getParent().getName()=='blockquote'){x=v;while(x=x.getNext()){if(x.type==1&&x.isBlockBoundary()){v.move(x,true);break;}}}if(w&&w.getParent().getName()=='blockquote'){x=w;while(x=x.getPrevious()){if(x.type==1&&x.isBlockBoundary()){w.move(x);break;}}}}var y=t.createIterator(),z;y.enlargeBr=q.config.enterMode!=2;if(r==2){var A=[];while(z=y.getNextParagraph())A.push(z);if(A.length<1){var B=q.document.createElement(q.config.enterMode==1?'p':'div'),C=u.shift();t.insertNode(B);B.append(new d.text('\ufeff',q.document));t.moveToBookmark(C);t.selectNodeContents(B);t.collapse(true);C=t.createBookmark();A.push(B);u.unshift(C);}var D=A[0].getParent(),E=[];for(var F=0;F<A.length;F++){z=A[F];D=D.getCommonAncestor(z.getParent());}var G={table:1,tbody:1,tr:1,ol:1,ul:1};while(G[D.getName()])D=D.getParent();var H=null;while(A.length>0){z=A.shift();while(!z.getParent().equals(D))z=z.getParent();if(!z.equals(H))E.push(z);H=z;}while(E.length>0){z=E.shift();if(z.getName()=='blockquote'){var I=new d.documentFragment(q.document);while(z.getFirst()){I.append(z.getFirst().remove());A.push(I.getLast());}I.replace(z);}else A.push(z);}var J=q.document.createElement('blockquote');J.insertBefore(A[0]);while(A.length>0){z=A.shift();J.append(z);}}else if(r==1){var K=[],L={};while(z=y.getNextParagraph()){var M=null,N=null;while(z.getParent()){if(z.getParent().getName()=='blockquote'){M=z.getParent();N=z;break;}z=z.getParent();}if(M&&N&&!N.getCustomData('blockquote_moveout')){K.push(N);h.setMarker(L,N,'blockquote_moveout',true);}}h.clearAllMarkers(L);
+var O=[],P=[];L={};while(K.length>0){var Q=K.shift();J=Q.getParent();if(!Q.getPrevious())Q.remove().insertBefore(J);else if(!Q.getNext())Q.remove().insertAfter(J);else{Q.breakParent(Q.getParent());P.push(Q.getNext());}if(!J.getCustomData('blockquote_processed')){P.push(J);h.setMarker(L,J,'blockquote_processed',true);}O.push(Q);}h.clearAllMarkers(L);for(F=P.length-1;F>=0;F--){J=P[F];if(o(J))J.remove();}if(q.config.enterMode==2){var R=true;while(O.length){Q=O.shift();if(Q.getName()=='div'){I=new d.documentFragment(q.document);var S=R&&Q.getPrevious()&&!(Q.getPrevious().type==1&&Q.getPrevious().isBlockBoundary());if(S)I.append(q.document.createElement('br'));var T=Q.getNext()&&!(Q.getNext().type==1&&Q.getNext().isBlockBoundary());while(Q.getFirst())Q.getFirst().remove().appendTo(I);if(T)I.append(q.document.createElement('br'));I.replace(Q);R=false;}}}}s.selectBookmarks(u);q.focus();}};j.add('blockquote',{init:function(q){q.addCommand('blockquote',p);q.ui.addButton('Blockquote',{label:q.lang.blockquote,command:'blockquote'});q.on('selectionChange',n);},requires:['domiterator']});})();j.add('button',{beforeInit:function(m){m.ui.addHandler(1,k.button.handler);}});a.UI_BUTTON=1;k.button=function(m){e.extend(this,m,{title:m.label,className:m.className||m.command&&'cke_button_'+m.command||'',click:m.click||(function(n){n.execCommand(m.command);})});this._={};};k.button.handler={create:function(m){return new k.button(m);}};k.button._={instances:[],keydown:function(m,n){var o=k.button._.instances[m];if(o.onkey){n=new d.event(n);return o.onkey(o,n.getKeystroke())!==false;}},focus:function(m,n){var o=k.button._.instances[m],p;if(o.onfocus)p=o.onfocus(o,new d.event(n))!==false;if(b.gecko&&b.version<10900)n.preventBubble();return p;}};(function(){var m=e.addFunction(k.button._.keydown,k.button._),n=e.addFunction(k.button._.focus,k.button._);k.button.prototype={canGroup:true,render:function(o,p){var q=b,r=this._.id=e.getNextId(),s='',t=this.command,u,v;this._.editor=o;var w={id:r,button:this,editor:o,focus:function(){var z=a.document.getById(r);z.focus();},execute:function(){this.button.click(o);}};w.clickFn=u=e.addFunction(w.execute,w);w.index=v=k.button._.instances.push(w)-1;if(this.modes){var x={};o.on('beforeModeUnload',function(){x[o.mode]=this._.state;},this);o.on('mode',function(){var z=o.mode;this.setState(this.modes[z]?x[z]!=undefined?x[z]:2:0);},this);}else if(t){t=o.getCommand(t);if(t){t.on('state',function(){this.setState(t.state);},this);s+='cke_'+(t.state==1?'on':t.state==0?'disabled':'off');
+}}if(!t)s+='cke_off';if(this.className)s+=' '+this.className;p.push('<span class="cke_button'+(this.icon&&this.icon.indexOf('.png')==-1?' cke_noalphafix':'')+'">','<a id="',r,'" class="',s,'"',q.gecko&&q.version>=10900&&!q.hc?'':'" href="javascript:void(\''+(this.title||'').replace("'",'')+"')\"",' title="',this.title,'" tabindex="-1" hidefocus="true" role="button" aria-labelledby="'+r+'_label"'+(this.hasArrow?' aria-haspopup="true"':''));if(q.opera||q.gecko&&q.mac)p.push(' onkeypress="return false;"');if(q.gecko)p.push(' onblur="this.style.cssText = this.style.cssText;"');p.push(' onkeydown="return CKEDITOR.tools.callFunction(',m,', ',v,', event);" onfocus="return CKEDITOR.tools.callFunction(',n,', ',v,', event);" onclick="CKEDITOR.tools.callFunction(',u,', this); return false;"><span class="cke_icon"');if(this.icon){var y=(this.iconOffset||0)*-16;p.push(' style="background-image:url(',a.getUrl(this.icon),');background-position:0 '+y+'px;"');}p.push('> </span><span id="',r,'_label" class="cke_label">',this.label,'</span>');if(this.hasArrow)p.push('<span class="cke_buttonarrow">'+(b.hc?'▼':' ')+'</span>');p.push('</a>','</span>');if(this.onRender)this.onRender();return w;},setState:function(o){if(this._.state==o)return false;this._.state=o;var p=a.document.getById(this._.id);if(p){p.setState(o);o==0?p.setAttribute('aria-disabled',true):p.removeAttribute('aria-disabled');o==1?p.setAttribute('aria-pressed',true):p.removeAttribute('aria-pressed');return true;}else return false;}};})();k.prototype.addButton=function(m,n){this.add(m,1,n);};a.on('reset',function(){k.button._.instances=[];});(function(){var m=function(x,y){var z=x.document,A=z.getBody(),B=0,C=function(){B=1;};A.on(y,C);(b.version>7?z.$:z.$.selection.createRange()).execCommand(y);A.removeListener(y,C);return B;},n=c?function(x,y){return m(x,y);}:function(x,y){try{return x.document.$.execCommand(y,false,null);}catch(z){return false;}},o=function(x){var y=this;y.type=x;y.canUndo=y.type=='cut';y.startDisabled=true;};o.prototype={exec:function(x,y){this.type=='cut'&&s(x);var z=n(x,this.type);if(!z)alert(x.lang.clipboard[this.type+'Error']);return z;}};var p={canUndo:false,exec:c?function(x){x.focus();if(!x.document.getBody().fire('beforepaste')&&!m(x,'paste')){x.fire('pasteDialog');return false;}}:function(x){try{if(!x.document.getBody().fire('beforepaste')&&!x.document.$.execCommand('Paste',false,null))throw 0;}catch(y){setTimeout(function(){x.fire('pasteDialog');},0);return false;}}},q=function(x){if(this.mode!='wysiwyg')return;
+switch(x.data.keyCode){case 1000+86:case 2000+45:var y=this.document.getBody();if(!c&&y.fire('beforepaste'))x.cancel();else if(b.opera||b.gecko&&b.version<10900)y.fire('paste');return;case 1000+88:case 2000+46:var z=this;this.fire('saveSnapshot');setTimeout(function(){z.fire('saveSnapshot');},0);}};function r(x,y,z){var A=this.document;if(A.getById('cke_pastebin'))return;if(y=='text'&&x.data&&x.data.$.clipboardData){var B=x.data.$.clipboardData.getData('text/plain');if(B){x.data.preventDefault();z(B);return;}}var C=this.getSelection(),D=new d.range(A),E=new h(y=='text'?'textarea':b.webkit?'body':'div',A);E.setAttribute('id','cke_pastebin');b.webkit&&E.append(A.createText('\xa0'));A.getBody().append(E);E.setStyles({position:'absolute',top:C.getStartElement().getDocumentPosition().y+'px',width:'1px',height:'1px',overflow:'hidden'});E.setStyle(this.config.contentsLangDirection=='ltr'?'left':'right','-1000px');var F=C.createBookmarks();if(y=='text'){if(c){var G=A.getBody().$.createTextRange();G.moveToElementText(E.$);G.execCommand('Paste');x.data.preventDefault();}else E.$.focus();}else{D.setStartAt(E,1);D.setEndAt(E,2);D.select(true);}var H=this;window.setTimeout(function(){y=='text'&&b.gecko&&H.focusGrabber.focus();E.remove();var I;E=b.webkit&&(I=E.getFirst())&&I.is&&I.hasClass('Apple-style-span')?I:E;C.selectBookmarks(F);z(E['get'+(y=='text'?'Value':'Html')]());},0);};function s(x){if(!c||b.quirks)return;var y=x.getSelection(),z;if(y.getType()==3&&(z=y.getSelectedElement())){var A=y.getRanges()[0],B=x.document.createText('');B.insertBefore(z);A.setStartBefore(B);A.setEndAfter(z);y.selectRanges([A]);setTimeout(function(){if(z.getParent()){B.remove();y.selectElement(z);}},0);}};var t;function u(x,y){c&&(t=1);var z=y.document.$.queryCommandEnabled(x)?2:0;t=0;return z;};var v;function w(){var y=this;if(y.mode!='wysiwyg')return;y.getCommand('cut').setState(v?0:u('Cut',y));y.getCommand('copy').setState(u('Copy',y));var x=v?0:b.webkit?2:u('Paste',y);y.fire('pasteState',x);};j.add('clipboard',{requires:['dialog','htmldataprocessor'],init:function(x){x.on('paste',function(A){var B=A.data;if(B.html)x.insertHtml(B.html);else if(B.text)x.insertText(B.text);},null,null,1000);x.on('pasteDialog',function(A){setTimeout(function(){x.openDialog('paste');},0);});x.on('pasteState',function(A){x.getCommand('paste').setState(A.data);});function y(A,B,C,D){var E=x.lang[B];x.addCommand(B,C);x.ui.addButton(A,{label:E,command:B});if(x.addMenuItems)x.addMenuItem(B,{label:E,command:B,group:'clipboard',order:D});
+};y('Cut','cut',new o('cut'),1);y('Copy','copy',new o('copy'),4);y('Paste','paste',p,8);a.dialog.add('paste',a.getUrl(this.path+'dialogs/paste.js'));x.on('key',q,x);var z=x.config.forcePasteAsPlainText?'text':'html';x.on('contentDom',function(){var A=x.document.getBody();A.on(z=='text'&&c||b.webkit?'paste':'beforepaste',function(B){if(t)return;r.call(x,B,z,function(C){if(!C)return;var D={};D[z]=C;x.fire('paste',D);});});A.on('beforecut',function(){!t&&s(x);});A.on('mouseup',function(){setTimeout(function(){w.call(x);},0);},x);A.on('keyup',w,x);});x.on('selectionChange',function(A){v=A.data.selection.getRanges()[0].checkReadOnly();w.call(x);});if(x.contextMenu)x.contextMenu.addListener(function(A,B){var C=B.getRanges()[0].checkReadOnly();return{cut:!C&&u('Cut',x),copy:u('Copy',x),paste:!C&&(b.webkit?2:u('Paste',x))};});}});})();j.add('colorbutton',{requires:['panelbutton','floatpanel','styles'],init:function(m){var n=m.config,o=m.lang.colorButton,p;if(!b.hc){q('TextColor','fore',o.textColorTitle);q('BGColor','back',o.bgColorTitle);}function q(t,u,v){var w=e.getNextId()+'_colorBox';m.ui.add(t,4,{label:v,title:v,className:'cke_button_'+t.toLowerCase(),modes:{wysiwyg:1},panel:{css:m.skin.editor.css,attributes:{role:'listbox','aria-label':o.panelTitle}},onBlock:function(x,y){y.autoSize=true;y.element.addClass('cke_colorblock');y.element.setHtml(r(x,u,w));y.element.getDocument().getBody().setStyle('overflow','hidden');k.fire('ready',this);var z=y.keys,A=m.lang.dir=='rtl';z[A?37:39]='next';z[40]='next';z[9]='next';z[A?39:37]='prev';z[38]='prev';z[2000+9]='prev';z[32]='click';},onOpen:function(){var x=m.getSelection(),y=x&&x.getStartElement(),z=new d.elementPath(y),A;y=z.block||z.blockLimit;do A=y&&y.getComputedStyle(u=='back'?'background-color':'color')||'transparent';while(u=='back'&&A=='transparent'&&y&&(y=y.getParent()));if(!A||A=='transparent')A='#ffffff';this._.panel._.iframe.getFrameDocument().getById(w).setStyle('background-color',A);}});};function r(t,u,v){var w=[],x=n.colorButton_colors.split(','),y=x.length+(n.colorButton_enableMore?2:1),z=e.addFunction(function(F,G){if(F=='?'){var H=arguments.callee;function I(K){this.removeListener('ok',I);this.removeListener('cancel',I);K.name=='ok'&&H(this.getContentElement('picker','selectedColor').getValue(),G);};m.openDialog('colordialog',function(){this.on('ok',I);this.on('cancel',I);});return;}m.focus();t.hide();m.fire('saveSnapshot');new a.style(n['colorButton_'+G+'Style'],{color:'inherit'}).remove(m.document);
+if(F){var J=n['colorButton_'+G+'Style'];J.childRule=G=='back'?function(K){return s(K);}:function(K){return K.getName()!='a'||s(K);};new a.style(J,{color:F}).apply(m.document);}m.fire('saveSnapshot');});w.push('<a class="cke_colorauto" _cke_focus=1 hidefocus=true title="',o.auto,'" onclick="CKEDITOR.tools.callFunction(',z,",null,'",u,"');return false;\" href=\"javascript:void('",o.auto,'\')" role="option" aria-posinset="1" aria-setsize="',y,'"><table role="presentation" cellspacing=0 cellpadding=0 width="100%"><tr><td><span class="cke_colorbox" id="',v,'"></span></td><td colspan=7 align=center>',o.auto,'</td></tr></table></a><table role="presentation" cellspacing=0 cellpadding=0 width="100%">');for(var A=0;A<x.length;A++){if(A%8===0)w.push('</tr><tr>');var B=x[A].split('/'),C=B[0],D=B[1]||C;if(!B[1])C='#'+C.replace(/^(.)(.)(.)$/,'$1$1$2$2$3$3');var E=m.lang.colors[D]||D;w.push('<td><a class="cke_colorbox" _cke_focus=1 hidefocus=true title="',E,'" onclick="CKEDITOR.tools.callFunction(',z,",'",C,"','",u,"'); return false;\" href=\"javascript:void('",E,'\')" role="option" aria-posinset="',A+2,'" aria-setsize="',y,'"><span class="cke_colorbox" style="background-color:#',D,'"></span></a></td>');}if(n.colorButton_enableMore===undefined||n.colorButton_enableMore)w.push('</tr><tr><td colspan=8 align=center><a class="cke_colormore" _cke_focus=1 hidefocus=true title="',o.more,'" onclick="CKEDITOR.tools.callFunction(',z,",'?','",u,"');return false;\" href=\"javascript:void('",o.more,"')\"",' role="option" aria-posinset="',y,'" aria-setsize="',y,'">',o.more,'</a></td>');w.push('</tr></table>');return w.join('');};function s(t){return t.getAttribute('contentEditable')=='false'||t.getAttribute('data-nostyle');};}});i.colorButton_colors='000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF';i.colorButton_foreStyle={element:'span',styles:{color:'#(color)'},overrides:[{element:'font',attributes:{color:null}}]};i.colorButton_backStyle={element:'span',styles:{'background-color':'#(color)'}};(function(){j.colordialog={init:function(m){m.addCommand('colordialog',new a.dialogCommand('colordialog'));a.dialog.add('colordialog',this.path+'dialogs/colordialog.js');}};j.add('colordialog',j.colordialog);})();j.add('contextmenu',{requires:['menu'],onLoad:function(){j.contextMenu=e.createClass({base:a.menu,$:function(m){this.base.call(this,m,{panel:{className:m.skinClass+' cke_contextmenu',attributes:{'aria-label':m.lang.contextmenu.options}}});
+},proto:{addTarget:function(m,n){if(b.opera&&!('oncontextmenu' in document.body)){var o;m.on('mousedown',function(s){s=s.data;if(s.$.button!=2){if(s.getKeystroke()==1000+1)m.fire('contextmenu',s);return;}if(n&&(b.mac?s.$.metaKey:s.$.ctrlKey))return;var t=s.getTarget();if(!o){var u=t.getDocument();o=u.createElement('input');o.$.type='button';u.getBody().append(o);}o.setAttribute('style','position:absolute;top:'+(s.$.clientY-2)+'px;left:'+(s.$.clientX-2)+'px;width:5px;height:5px;opacity:0.01');});m.on('mouseup',function(s){if(o){o.remove();o=undefined;m.fire('contextmenu',s.data);}});}m.on('contextmenu',function(s){var t=s.data;if(n&&(b.webkit?p:b.mac?t.$.metaKey:t.$.ctrlKey))return;t.preventDefault();var u=t.getTarget().getDocument().getDocumentElement(),v=t.$.clientX,w=t.$.clientY;e.setTimeout(function(){this.open(u,null,v,w);},0,this);},this);if(b.opera)m.on('keypress',function(s){var t=s.data;if(t.$.keyCode===0)t.preventDefault();});if(b.webkit){var p,q=function(s){p=b.mac?s.data.$.metaKey:s.data.$.ctrlKey;},r=function(){p=0;};m.on('keydown',q);m.on('keyup',r);m.on('contextmenu',r);}},open:function(m,n,o,p){this.editor.focus();m=m||a.document.getDocumentElement();this.show(m,n,o,p);}}});},beforeInit:function(m){m.contextMenu=new j.contextMenu(m);m.addCommand('contextMenu',{exec:function(){m.contextMenu.open(m.document.getBody());}});}});(function(){function m(o){var p=this.att,q=o&&o.hasAttribute(p)&&o.getAttribute(p)||'';if(q!==undefined)this.setValue(q);};function n(){var o;for(var p=0;p<arguments.length;p++){if(arguments[p] instanceof h){o=arguments[p];break;}}if(o){var q=this.att,r=this.getValue();if(q=='dir'){var s=o.getAttribute(q);if(s!=r&&o.getParent())this._.dialog._.editor.fire('dirChanged',{node:o,dir:r||o.getDirection(1)});}if(r)o.setAttribute(q,r);else o.removeAttribute(q,r);}};j.add('dialogadvtab',{createAdvancedTab:function(o,p){if(!p)p={id:1,dir:1,classes:1,styles:1};var q=o.lang.common,r={id:'advanced',label:q.advancedTab,title:q.advancedTab,elements:[{type:'vbox',padding:1,children:[]}]},s=[];if(p.id||p.dir){if(p.id)s.push({id:'advId',att:'id',type:'text',label:q.id,setup:m,commit:n});if(p.dir)s.push({id:'advLangDir',att:'dir',type:'select',label:q.langDir,'default':'',style:'width:100%',items:[[q.notSet,''],[q.langDirLTR,'ltr'],[q.langDirRTL,'rtl']],setup:m,commit:n});r.elements[0].children.push({type:'hbox',widths:['50%','50%'],children:[].concat(s)});}if(p.styles||p.classes){s=[];if(p.styles)s.push({id:'advStyles',att:'style',type:'text',label:q.styles,'default':'',getStyle:function(t,u){var v=this.getValue().match(new RegExp(t+'\\s*:s*([^;]*)','i'));
+return v?v[1]:u;},updateStyle:function(t,u){var v=this.getValue();if(v)v=v.replace(new RegExp('\\s*'+t+'s*:[^;]*(?:$|;s*)','i'),'').replace(/^[;\s]+/,'').replace(/\s+$/,'');if(u){v&&!/;\s*$/.test(v)&&(v+='; ');v+=t+': '+u;}this.setValue(v,1);},setup:m,commit:n});if(p.classes)s.push({type:'hbox',widths:['45%','55%'],children:[{id:'advCSSClasses',att:'class',type:'text',label:q.cssClasses,'default':'',setup:m,commit:n}]});r.elements[0].children.push({type:'hbox',widths:['50%','50%'],children:[].concat(s)});}return r;}});})();(function(){j.add('div',{requires:['editingblock','domiterator','styles'],init:function(m){var n=m.lang.div;m.addCommand('creatediv',new a.dialogCommand('creatediv'));m.addCommand('editdiv',new a.dialogCommand('editdiv'));m.addCommand('removediv',{exec:function(o){var p=o.getSelection(),q=p&&p.getRanges(),r,s=p.createBookmarks(),t,u=[];function v(x){var y=new d.elementPath(x),z=y.blockLimit,A=z.is('div')&&z;if(A&&!A.data('cke-div-added')){u.push(A);A.data('cke-div-added');}};for(var w=0;w<q.length;w++){r=q[w];if(r.collapsed)v(p.getStartElement());else{t=new d.walker(r);t.evaluator=v;t.lastForward();}}for(w=0;w<u.length;w++)u[w].remove(true);p.selectBookmarks(s);}});m.ui.addButton('CreateDiv',{label:n.toolbar,command:'creatediv'});if(m.addMenuItems){m.addMenuItems({editdiv:{label:n.edit,command:'editdiv',group:'div',order:1},removediv:{label:n.remove,command:'removediv',group:'div',order:5}});if(m.contextMenu)m.contextMenu.addListener(function(o,p){if(!o||o.isReadOnly())return null;var q=new d.elementPath(o),r=q.blockLimit;if(r&&r.getAscendant('div',true))return{editdiv:2,removediv:2};return null;});}a.dialog.add('creatediv',this.path+'dialogs/div.js');a.dialog.add('editdiv',this.path+'dialogs/div.js');}});})();(function(){var m={toolbarFocus:{exec:function(o){var p=o._.elementsPath.idBase,q=a.document.getById(p+'0');q&&q.focus(c||b.air);}}},n='<span class="cke_empty"> </span>';j.add('elementspath',{requires:['selection'],init:function(o){var p='cke_path_'+o.name,q,r=function(){if(!q)q=a.document.getById(p);return q;},s='cke_elementspath_'+e.getNextNumber()+'_';o._.elementsPath={idBase:s,filters:[]};o.on('themeSpace',function(w){if(w.data.space=='bottom')w.data.html+='<span id="'+p+'_label" class="cke_voice_label">'+o.lang.elementsPath.eleLabel+'</span>'+'<div id="'+p+'" class="cke_path" role="group" aria-labelledby="'+p+'_label">'+n+'</div>';});function t(w){o.focus();var x=o._.elementsPath.list[w];if(x.is('body')){var y=new d.range(o.document);
+y.selectNodeContents(x);y.select();}else o.getSelection().selectElement(x);};var u=e.addFunction(t),v=e.addFunction(function(w,x){var y=o._.elementsPath.idBase,z;x=new d.event(x);var A=o.lang.dir=='rtl';switch(x.getKeystroke()){case A?39:37:case 9:z=a.document.getById(y+(w+1));if(!z)z=a.document.getById(y+'0');z.focus();return false;case A?37:39:case 2000+9:z=a.document.getById(y+(w-1));if(!z)z=a.document.getById(y+(o._.elementsPath.list.length-1));z.focus();return false;case 27:o.focus();return false;case 13:case 32:t(w);return false;}return true;});o.on('selectionChange',function(w){var x=b,y=w.data.selection,z=y.getStartElement(),A=[],B=w.editor,C=B._.elementsPath.list=[],D=B._.elementsPath.filters;while(z){var E=0;for(var F=0;F<D.length;F++){if(D[F](z)===false){E=1;break;}}if(!E){var G=C.push(z)-1,H;if(z.data('cke-real-element-type'))H=z.data('cke-real-element-type');else H=z.getName();var I='';if(x.opera||x.gecko&&x.mac)I+=' onkeypress="return false;"';if(x.gecko)I+=' onblur="this.style.cssText = this.style.cssText;"';var J=B.lang.elementsPath.eleTitle.replace(/%1/,H);A.unshift('<a id="',s,G,'" href="javascript:void(\'',H,'\')" tabindex="-1" title="',J,'"'+(b.gecko&&b.version<10900?' onfocus="event.preventBubble();"':'')+' hidefocus="true" '+' onkeydown="return CKEDITOR.tools.callFunction(',v,',',G,', event );"'+I,' onclick="CKEDITOR.tools.callFunction('+u,',',G,'); return false;"',' role="button" aria-labelledby="'+s+G+'_label">',H,'<span id="',s,G,'_label" class="cke_label">'+J+'</span>','</a>');}if(H=='body')break;z=z.getParent();}var K=r();K.setHtml(A.join('')+n);B.fire('elementsPathUpdate',{space:K});});o.on('contentDomUnload',function(){q&&q.setHtml(n);});o.addCommand('elementsPathFocus',m.toolbarFocus);}});})();(function(){j.add('enterkey',{requires:['keystrokes','indent'],init:function(t){var u=t.specialKeys;u[13]=r;u[2000+13]=q;}});j.enterkey={enterBlock:function(t,u,v,w){v=v||s(t);if(!v)return;var x=v.document;if(v.checkStartOfBlock()&&v.checkEndOfBlock()){var y=new d.elementPath(v.startContainer),z=y.block;if(z&&(z.is('li')||z.getParent().is('li'))){t.execCommand('outdent');return;}}var A=u==3?'div':'p',B=v.splitBlock(A);if(!B)return;var C=B.previousBlock,D=B.nextBlock,E=B.wasStartOfBlock,F=B.wasEndOfBlock,G;if(D){G=D.getParent();if(G.is('li')){D.breakParent(G);D.move(D.getNext(),1);}}else if(C&&(G=C.getParent())&&G.is('li')){C.breakParent(G);v.moveToElementEditStart(C.getNext());C.move(C.getPrevious());}if(!E&&!F){if(D.is('li')&&(G=D.getFirst(d.walker.invisible(true)))&&G.is&&G.is('ul','ol'))(c?x.createText('\xa0'):x.createElement('br')).insertBefore(G);
+if(D)v.moveToElementEditStart(D);}else{var H,I;if(C){if(C.is('li')||!p.test(C.getName()))H=C.clone();}else if(D)H=D.clone();if(!H){H=x.createElement(A);if(C&&(I=C.getDirection()))H.setAttribute('dir',I);}else if(w&&!H.is('li'))H.renameNode(A);var J=B.elementPath;if(J)for(var K=0,L=J.elements.length;K<L;K++){var M=J.elements[K];if(M.equals(J.block)||M.equals(J.blockLimit))break;if(f.$removeEmpty[M.getName()]){M=M.clone();H.moveChildren(M);H.append(M);}}if(!c)H.appendBogus();v.insertNode(H);if(c&&E&&(!F||!C.getChildCount())){v.moveToElementEditStart(F?C:H);v.select();}v.moveToElementEditStart(E&&!F?D:H);}if(!c)if(D){var N=x.createElement('span');N.setHtml(' ');v.insertNode(N);N.scrollIntoView();v.deleteContents();}else H.scrollIntoView();v.select();},enterBr:function(t,u,v,w){v=v||s(t);if(!v)return;var x=v.document,y=u==3?'div':'p',z=v.checkEndOfBlock(),A=new d.elementPath(t.getSelection().getStartElement()),B=A.block,C=B&&A.block.getName(),D=false;if(!w&&C=='li'){o(t,u,v,w);return;}if(!w&&z&&p.test(C)){var E,F;if(F=B.getDirection()){E=x.createElement('div');E.setAttribute('dir',F);E.insertAfter(B);v.setStart(E,0);}else{x.createElement('br').insertAfter(B);if(b.gecko)x.createText('').insertAfter(B);v.setStartAt(B.getNext(),c?3:1);}}else{var G;D=C=='pre';if(D&&!b.gecko)G=x.createText(c?'\r':'\n');else G=x.createElement('br');v.deleteContents();v.insertNode(G);if(!c)x.createText('\ufeff').insertAfter(G);if(z&&!c)G.getParent().appendBogus();if(!c)G.getNext().$.nodeValue='';if(c)v.setStartAt(G,4);else v.setStartAt(G.getNext(),1);if(!c){var H=null;if(!b.gecko){H=x.createElement('span');H.setHtml(' ');}else H=x.createElement('br');H.insertBefore(G.getNext());H.scrollIntoView();H.remove();}}v.collapse(true);v.select(D);}};var m=j.enterkey,n=m.enterBr,o=m.enterBlock,p=/^h[1-6]$/;function q(t){if(t.mode!='wysiwyg')return false;if(t.getSelection().getStartElement().hasAscendant('pre',true)){setTimeout(function(){o(t,t.config.enterMode,null,true);},0);return true;}else return r(t,t.config.shiftEnterMode,1);};function r(t,u,v){v=t.config.forceEnterMode||v;if(t.mode!='wysiwyg')return false;if(!u)u=t.config.enterMode;setTimeout(function(){t.fire('saveSnapshot');if(u==2||t.getSelection().getStartElement().hasAscendant('pre',1))n(t,u,null,v);else o(t,u,null,v);},0);return true;};function s(t){var u=t.getSelection().getRanges(true);for(var v=u.length-1;v>0;v--)u[v].deleteContents();return u[0];};})();(function(){var m='nbsp,gt,lt',n='quot,iexcl,cent,pound,curren,yen,brvbar,sect,uml,copy,ordf,laquo,not,shy,reg,macr,deg,plusmn,sup2,sup3,acute,micro,para,middot,cedil,sup1,ordm,raquo,frac14,frac12,frac34,iquest,times,divide,fnof,bull,hellip,prime,Prime,oline,frasl,weierp,image,real,trade,alefsym,larr,uarr,rarr,darr,harr,crarr,lArr,uArr,rArr,dArr,hArr,forall,part,exist,empty,nabla,isin,notin,ni,prod,sum,minus,lowast,radic,prop,infin,ang,and,or,cap,cup,int,there4,sim,cong,asymp,ne,equiv,le,ge,sub,sup,nsub,sube,supe,oplus,otimes,perp,sdot,lceil,rceil,lfloor,rfloor,lang,rang,loz,spades,clubs,hearts,diams,circ,tilde,ensp,emsp,thinsp,zwnj,zwj,lrm,rlm,ndash,mdash,lsquo,rsquo,sbquo,ldquo,rdquo,bdquo,dagger,Dagger,permil,lsaquo,rsaquo,euro',o='Agrave,Aacute,Acirc,Atilde,Auml,Aring,AElig,Ccedil,Egrave,Eacute,Ecirc,Euml,Igrave,Iacute,Icirc,Iuml,ETH,Ntilde,Ograve,Oacute,Ocirc,Otilde,Ouml,Oslash,Ugrave,Uacute,Ucirc,Uuml,Yacute,THORN,szlig,agrave,aacute,acirc,atilde,auml,aring,aelig,ccedil,egrave,eacute,ecirc,euml,igrave,iacute,icirc,iuml,eth,ntilde,ograve,oacute,ocirc,otilde,ouml,oslash,ugrave,uacute,ucirc,uuml,yacute,thorn,yuml,OElig,oelig,Scaron,scaron,Yuml',p='Alpha,Beta,Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda,Mu,Nu,Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,Omega,alpha,beta,gamma,delta,epsilon,zeta,eta,theta,iota,kappa,lambda,mu,nu,xi,omicron,pi,rho,sigmaf,sigma,tau,upsilon,phi,chi,psi,omega,thetasym,upsih,piv';
+function q(r,s){var t={},u=[],v={nbsp:'\xa0',shy:'­',gt:'>',lt:'<'};r=r.replace(/\b(nbsp|shy|gt|lt|amp)(?:,|$)/g,function(A,B){var C=s?'&'+B+';':v[B],D=s?v[B]:'&'+B+';';t[C]=D;u.push(C);return '';});if(!s&&r){r=r.split(',');var w=document.createElement('div'),x;w.innerHTML='&'+r.join(';&')+';';x=w.innerHTML;w=null;for(var y=0;y<x.length;y++){var z=x.charAt(y);t[z]='&'+r[y]+';';u.push(z);}}t.regex=u.join(s?'|':'');return t;};j.add('entities',{afterInit:function(r){var s=r.config,t=r.dataProcessor,u=t&&t.htmlFilter;if(u){var v=m;if(s.entities){v+=','+n;if(s.entities_latin)v+=','+o;if(s.entities_greek)v+=','+p;if(s.entities_additional)v+=','+s.entities_additional;}var w=q(v),x='['+w.regex+']';delete w.regex;if(s.entities&&s.entities_processNumerical)x='[^ -~]|'+x;x=new RegExp(x,'g');function y(C){return s.entities_processNumerical=='force'||!w[C]?'&#'+C.charCodeAt(0)+';':w[C];};var z=q([m,'shy'].join(','),true),A=new RegExp(z.regex,'g');function B(C){return z[C];};u.addRules({text:function(C){return C.replace(A,B).replace(x,y);}});}}});})();i.entities=true;i.entities_latin=true;i.entities_greek=true;i.entities_additional='#39';(function(){function m(v,w){var x=[];if(!w)return v;else for(var y in w)x.push(y+'='+encodeURIComponent(w[y]));return v+(v.indexOf('?')!=-1?'&':'?')+x.join('&');};function n(v){v+='';var w=v.charAt(0).toUpperCase();return w+v.substr(1);};function o(v){var C=this;var w=C.getDialog(),x=w.getParentEditor();x._.filebrowserSe=C;var y=x.config['filebrowser'+n(w.getName())+'WindowWidth']||x.config.filebrowserWindowWidth||'80%',z=x.config['filebrowser'+n(w.getName())+'WindowHeight']||x.config.filebrowserWindowHeight||'70%',A=C.filebrowser.params||{};A.CKEditor=x.name;A.CKEditorFuncNum=x._.filebrowserFn;if(!A.langCode)A.langCode=x.langCode;var B=m(C.filebrowser.url,A);x.popup(B,y,z,x.config.fileBrowserWindowFeatures);};function p(v){var y=this;var w=y.getDialog(),x=w.getParentEditor();x._.filebrowserSe=y;if(!w.getContentElement(y['for'][0],y['for'][1]).getInputElement().$.value)return false;if(!w.getContentElement(y['for'][0],y['for'][1]).getAction())return false;return true;};function q(v,w,x){var y=x.params||{};y.CKEditor=v.name;y.CKEditorFuncNum=v._.filebrowserFn;if(!y.langCode)y.langCode=v.langCode;w.action=m(x.url,y);w.filebrowser=x;};function r(v,w,x,y){var z,A;for(var B in y){z=y[B];if(z.type=='hbox'||z.type=='vbox')r(v,w,x,z.children);if(!z.filebrowser)continue;if(typeof z.filebrowser=='string'){var C={action:z.type=='fileButton'?'QuickUpload':'Browse',target:z.filebrowser};
+z.filebrowser=C;}if(z.filebrowser.action=='Browse'){var D=z.filebrowser.url;if(D===undefined){D=v.config['filebrowser'+n(w)+'BrowseUrl'];if(D===undefined)D=v.config.filebrowserBrowseUrl;}if(D){z.onClick=o;z.filebrowser.url=D;z.hidden=false;}}else if(z.filebrowser.action=='QuickUpload'&&z['for']){D=z.filebrowser.url;if(D===undefined){D=v.config['filebrowser'+n(w)+'UploadUrl'];if(D===undefined)D=v.config.filebrowserUploadUrl;}if(D){var E=z.onClick;z.onClick=function(F){var G=F.sender;if(E&&E.call(G,F)===false)return false;return p.call(G,F);};z.filebrowser.url=D;z.hidden=false;q(v,x.getContents(z['for'][0]).get(z['for'][1]),z.filebrowser);}}}};function s(v,w){var x=w.getDialog(),y=w.filebrowser.target||null;v=v.replace(/#/g,'%23');if(y){var z=y.split(':'),A=x.getContentElement(z[0],z[1]);if(A){A.setValue(v);x.selectPage(z[0]);}}};function t(v,w,x){if(x.indexOf(';')!==-1){var y=x.split(';');for(var z=0;z<y.length;z++){if(t(v,w,y[z]))return true;}return false;}var A=v.getContents(w).get(x).filebrowser;return A&&A.url;};function u(v,w){var A=this;var x=A._.filebrowserSe.getDialog(),y=A._.filebrowserSe['for'],z=A._.filebrowserSe.filebrowser.onSelect;if(y)x.getContentElement(y[0],y[1]).reset();if(typeof w=='function'&&w.call(A._.filebrowserSe)===false)return;if(z&&z.call(A._.filebrowserSe,v,w)===false)return;if(typeof w=='string'&&w)alert(w);if(v)s(v,A._.filebrowserSe);};j.add('filebrowser',{init:function(v,w){v._.filebrowserFn=e.addFunction(u,v);v.on('destroy',function(){e.removeFunction(this._.filebrowserFn);});}});a.on('dialogDefinition',function(v){var w=v.data.definition,x;for(var y in w.contents){if(x=w.contents[y]){r(v.editor,v.data.name,w,x.elements);if(x.hidden&&x.filebrowser)x.hidden=!t(w,x.id,x.filebrowser);}}});})();j.add('find',{init:function(m){var n=j.find;m.ui.addButton('Find',{label:m.lang.findAndReplace.find,command:'find'});var o=m.addCommand('find',new a.dialogCommand('find'));o.canUndo=false;m.ui.addButton('Replace',{label:m.lang.findAndReplace.replace,command:'replace'});var p=m.addCommand('replace',new a.dialogCommand('replace'));p.canUndo=false;a.dialog.add('find',this.path+'dialogs/find.js');a.dialog.add('replace',this.path+'dialogs/find.js');},requires:['styles']});i.find_highlight={element:'span',styles:{'background-color':'#004',color:'#fff'}};(function(){var m=/\.swf(?:$|\?)/i,n=e.cssLength;function o(q){var r=q.attributes;return r.type=='application/x-shockwave-flash'||m.test(r.src||'');};function p(q,r){var s=q.createFakeParserElement(r,'cke_flash','flash',true),t=s.attributes.style||'',u=r.attributes.width,v=r.attributes.height;
+if(typeof u!='undefined')t=s.attributes.style=t+'width:'+n(u)+';';if(typeof v!='undefined')t=s.attributes.style=t+'height:'+n(v)+';';return s;};j.add('flash',{init:function(q){q.addCommand('flash',new a.dialogCommand('flash'));q.ui.addButton('Flash',{label:q.lang.common.flash,command:'flash'});a.dialog.add('flash',this.path+'dialogs/flash.js');q.addCss('img.cke_flash{background-image: url('+a.getUrl(this.path+'images/placeholder.png')+');'+'background-position: center center;'+'background-repeat: no-repeat;'+'border: 1px solid #a9a9a9;'+'width: 80px;'+'height: 80px;'+'}');if(q.addMenuItems)q.addMenuItems({flash:{label:q.lang.flash.properties,command:'flash',group:'flash'}});q.on('doubleclick',function(r){var s=r.data.element;if(s.is('img')&&s.data('cke-real-element-type')=='flash')r.data.dialog='flash';});if(q.contextMenu)q.contextMenu.addListener(function(r,s){if(r&&r.is('img')&&!r.isReadOnly()&&r.data('cke-real-element-type')=='flash')return{flash:2};});},afterInit:function(q){var r=q.dataProcessor,s=r&&r.dataFilter;if(s)s.addRules({elements:{'cke:object':function(t){var u=t.attributes,v=u.classid&&String(u.classid).toLowerCase();if(!v){for(var w=0;w<t.children.length;w++){if(t.children[w].name=='cke:embed'){if(!o(t.children[w]))return null;return p(q,t);}}return null;}return p(q,t);},'cke:embed':function(t){if(!o(t))return null;return p(q,t);}}},5);},requires:['fakeobjects']});})();e.extend(i,{flashEmbedTagOnly:false,flashAddEmbedTag:true,flashConvertOnEdit:false});(function(){function m(n,o,p,q,r,s,t){var u=n.config,v=r.split(';'),w=[],x={};for(var y=0;y<v.length;y++){var z=v[y];if(z){z=z.split('/');var A={},B=v[y]=z[0];A[p]=w[y]=z[1]||B;x[B]=new a.style(t,A);x[B]._.definition.name=B;}else v.splice(y--,1);}n.ui.addRichCombo(o,{label:q.label,title:q.panelTitle,className:'cke_'+(p=='size'?'fontSize':'font'),panel:{css:n.skin.editor.css.concat(u.contentsCss),multiSelect:false,attributes:{'aria-label':q.panelTitle}},init:function(){this.startGroup(q.panelTitle);for(var C=0;C<v.length;C++){var D=v[C];this.add(D,x[D].buildPreview(),D);}},onClick:function(C){n.focus();n.fire('saveSnapshot');var D=x[C];if(this.getValue()==C)D.remove(n.document);else D.apply(n.document);n.fire('saveSnapshot');},onRender:function(){n.on('selectionChange',function(C){var D=this.getValue(),E=C.data.path,F=E.elements;for(var G=0,H;G<F.length;G++){H=F[G];for(var I in x){if(x[I].checkElementRemovable(H,true)){if(I!=D)this.setValue(I);return;}}}this.setValue('',s);},this);}});};j.add('font',{requires:['richcombo','styles'],init:function(n){var o=n.config;
+m(n,'Font','family',n.lang.font,o.font_names,o.font_defaultLabel,o.font_style);m(n,'FontSize','size',n.lang.fontSize,o.fontSize_sizes,o.fontSize_defaultLabel,o.fontSize_style);}});})();i.font_names='Arial/Arial, Helvetica, sans-serif;Comic Sans MS/Comic Sans MS, cursive;Courier New/Courier New, Courier, monospace;Georgia/Georgia, serif;Lucida Sans Unicode/Lucida Sans Unicode, Lucida Grande, sans-serif;Tahoma/Tahoma, Geneva, sans-serif;Times New Roman/Times New Roman, Times, serif;Trebuchet MS/Trebuchet MS, Helvetica, sans-serif;Verdana/Verdana, Geneva, sans-serif';i.font_defaultLabel='';i.font_style={element:'span',styles:{'font-family':'#(family)'},overrides:[{element:'font',attributes:{face:null}}]};i.fontSize_sizes='8/8px;9/9px;10/10px;11/11px;12/12px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px';i.fontSize_defaultLabel='';i.fontSize_style={element:'span',styles:{'font-size':'#(size)'},overrides:[{element:'font',attributes:{size:null}}]};j.add('format',{requires:['richcombo','styles'],init:function(m){var n=m.config,o=m.lang.format,p=n.format_tags.split(';'),q={};for(var r=0;r<p.length;r++){var s=p[r];q[s]=new a.style(n['format_'+s]);q[s]._.enterMode=m.config.enterMode;}m.ui.addRichCombo('Format',{label:o.label,title:o.panelTitle,className:'cke_format',panel:{css:m.skin.editor.css.concat(n.contentsCss),multiSelect:false,attributes:{'aria-label':o.panelTitle}},init:function(){this.startGroup(o.panelTitle);for(var t in q){var u=o['tag_'+t];this.add(t,'<'+t+'>'+u+'</'+t+'>',u);}},onClick:function(t){m.focus();m.fire('saveSnapshot');var u=q[t],v=new d.elementPath(m.getSelection().getStartElement());u[u.checkActive(v)?'remove':'apply'](m.document);setTimeout(function(){m.fire('saveSnapshot');},0);},onRender:function(){m.on('selectionChange',function(t){var u=this.getValue(),v=t.data.path;for(var w in q){if(q[w].checkActive(v)){if(w!=u)this.setValue(w,m.lang.format['tag_'+w]);return;}}this.setValue('');},this);}});}});i.format_tags='p;h1;h2;h3;h4;h5;h6;pre;address;div';i.format_p={element:'p'};i.format_div={element:'div'};i.format_pre={element:'pre'};i.format_address={element:'address'};i.format_h1={element:'h1'};i.format_h2={element:'h2'};i.format_h3={element:'h3'};i.format_h4={element:'h4'};i.format_h5={element:'h5'};i.format_h6={element:'h6'};j.add('forms',{init:function(m){var n=m.lang;m.addCss('form{border: 1px dotted #FF0000;padding: 2px;}\n');m.addCss('img.cke_hidden{background-image: url('+a.getUrl(this.path+'images/hiddenfield.gif')+');'+'background-position: center center;'+'background-repeat: no-repeat;'+'border: 1px solid #a9a9a9;'+'width: 16px !important;'+'height: 16px !important;'+'}');
+var o=function(q,r,s){m.addCommand(r,new a.dialogCommand(r));m.ui.addButton(q,{label:n.common[q.charAt(0).toLowerCase()+q.slice(1)],command:r});a.dialog.add(r,s);},p=this.path+'dialogs/';o('Form','form',p+'form.js');o('Checkbox','checkbox',p+'checkbox.js');o('Radio','radio',p+'radio.js');o('TextField','textfield',p+'textfield.js');o('Textarea','textarea',p+'textarea.js');o('Select','select',p+'select.js');o('Button','button',p+'button.js');o('ImageButton','imagebutton',j.getPath('image')+'dialogs/image.js');o('HiddenField','hiddenfield',p+'hiddenfield.js');if(m.addMenuItems)m.addMenuItems({form:{label:n.form.menu,command:'form',group:'form'},checkbox:{label:n.checkboxAndRadio.checkboxTitle,command:'checkbox',group:'checkbox'},radio:{label:n.checkboxAndRadio.radioTitle,command:'radio',group:'radio'},textfield:{label:n.textfield.title,command:'textfield',group:'textfield'},hiddenfield:{label:n.hidden.title,command:'hiddenfield',group:'hiddenfield'},imagebutton:{label:n.image.titleButton,command:'imagebutton',group:'imagebutton'},button:{label:n.button.title,command:'button',group:'button'},select:{label:n.select.title,command:'select',group:'select'},textarea:{label:n.textarea.title,command:'textarea',group:'textarea'}});if(m.contextMenu){m.contextMenu.addListener(function(q){if(q&&q.hasAscendant('form',true)&&!q.isReadOnly())return{form:2};});m.contextMenu.addListener(function(q){if(q&&!q.isReadOnly()){var r=q.getName();if(r=='select')return{select:2};if(r=='textarea')return{textarea:2};if(r=='input')switch(q.getAttribute('type')){case 'button':case 'submit':case 'reset':return{button:2};case 'checkbox':return{checkbox:2};case 'radio':return{radio:2};case 'image':return{imagebutton:2};default:return{textfield:2};}if(r=='img'&&q.data('cke-real-element-type')=='hiddenfield')return{hiddenfield:2};}});}m.on('doubleclick',function(q){var r=q.data.element;if(r.is('form'))q.data.dialog='form';else if(r.is('select'))q.data.dialog='select';else if(r.is('textarea'))q.data.dialog='textarea';else if(r.is('img')&&r.data('cke-real-element-type')=='hiddenfield')q.data.dialog='hiddenfield';else if(r.is('input'))switch(r.getAttribute('type')){case 'button':case 'submit':case 'reset':q.data.dialog='button';break;case 'checkbox':q.data.dialog='checkbox';break;case 'radio':q.data.dialog='radio';break;case 'image':q.data.dialog='imagebutton';break;default:q.data.dialog='textfield';break;}});},afterInit:function(m){var n=m.dataProcessor,o=n&&n.htmlFilter,p=n&&n.dataFilter;if(c)o&&o.addRules({elements:{input:function(q){var r=q.attributes,s=r.type;
+if(!s)r.type='text';if(s=='checkbox'||s=='radio')r.value=='on'&&delete r.value;}}});if(p)p.addRules({elements:{input:function(q){if(q.attributes.type=='hidden')return m.createFakeParserElement(q,'cke_hidden','hiddenfield');}}});},requires:['image','fakeobjects']});if(c)h.prototype.hasAttribute=function(m){var p=this;var n=p.$.attributes.getNamedItem(m);if(p.getName()=='input')switch(m){case 'class':return p.$.className.length>0;case 'checked':return!!p.$.checked;case 'value':var o=p.getAttribute('type');return o=='checkbox'||o=='radio'?p.$.value!='on':p.$.value;}return!!(n&&n.specified);};(function(){var m={canUndo:false,exec:function(o){o.insertElement(o.document.createElement('hr'));}},n='horizontalrule';j.add(n,{init:function(o){o.addCommand(n,m);o.ui.addButton('HorizontalRule',{label:o.lang.horizontalrule,command:n});}});})();(function(){var m=/^[\t\r\n ]*(?: |\xa0)$/,n='{cke_protected}';function o(R){var S=R.children.length,T=R.children[S-1];while(T&&T.type==3&&!e.trim(T.value))T=R.children[--S];return T;};function p(R,S){var T=R.children,U=o(R);if(U){if((S||!c)&&U.type==1&&U.name=='br')T.pop();if(U.type==3&&m.test(U.value))T.pop();}};function q(R,S,T){if(!S&&(!T||typeof T=='function'&&T(R)===false))return false;if(S&&c&&(document.documentMode>7||R.name in f.tr||R.name in f.$listItem))return false;var U=o(R);return!U||U&&(U.type==1&&U.name=='br'||R.name=='form'&&U.name=='input');};function r(R,S){return function(T){p(T,!R);if(q(T,!R,S))if(R||c)T.add(new a.htmlParser.text('\xa0'));else T.add(new a.htmlParser.element('br',{}));};};var s=f,t=e.extend({},s.$block,s.$listItem,s.$tableContent);for(var u in t){if(!('br' in s[u]))delete t[u];}delete t.pre;var v={elements:{a:function(R){var S=R.attributes;if(S&&S['data-cke-saved-name'])S['class']=(S['class']?S['class']+' ':'')+'cke_anchor';}},attributeNames:[[/^on/,'data-cke-pa-on']]},w={elements:{}};for(u in t)w.elements[u]=r();var x={elementNames:[[/^cke:/,''],[/^\?xml:namespace$/,'']],attributeNames:[[/^data-cke-(saved|pa)-/,''],[/^data-cke-.*/,''],['hidefocus','']],elements:{$:function(R){var S=R.attributes;if(S){if(S['data-cke-temp'])return false;var T=['name','href','src'],U;for(var V=0;V<T.length;V++){U='data-cke-saved-'+T[V];U in S&&delete S[T[V]];}}return R;},embed:function(R){var S=R.parent;if(S&&S.name=='object'){var T=S.attributes.width,U=S.attributes.height;T&&(R.attributes.width=T);U&&(R.attributes.height=U);}},param:function(R){R.children=[];R.isEmpty=true;return R;},a:function(R){if(!(R.children.length||R.attributes.name||R.attributes['data-cke-saved-name']))return false;
+},span:function(R){if(R.attributes['class']=='Apple-style-span')delete R.name;},pre:function(R){c&&p(R);},html:function(R){delete R.attributes.contenteditable;delete R.attributes['class'];},body:function(R){delete R.attributes.spellcheck;delete R.attributes.contenteditable;},style:function(R){var S=R.children[0];S&&S.value&&(S.value=e.trim(S.value));if(!R.attributes.type)R.attributes.type='text/css';},title:function(R){var S=R.children[0];S&&(S.value=R.attributes['data-cke-title']||'');}},attributes:{'class':function(R,S){return e.ltrim(R.replace(/(?:^|\s+)cke_[^\s]*/g,''))||false;}},comment:function(R){if(R.substr(0,n.length)==n){if(R.substr(n.length,3)=='{C}')R=R.substr(n.length+3);else R=R.substr(n.length);return new a.htmlParser.cdata(decodeURIComponent(R));}return R;}};if(c)x.attributes.style=function(R,S){return R.replace(/(^|;)([^\:]+)/g,function(T){return T.toLowerCase();});};function y(R){var S=R.attributes;if(S.contenteditable!='false')S['data-cke-editable']=S.contenteditable?'true':1;S.contenteditable='false';};function z(R){var S=R.attributes;switch(S['data-cke-editable']){case 'true':S.contenteditable='true';break;case '1':delete S.contenteditable;break;}};for(u in {input:1,textarea:1}){v.elements[u]=y;x.elements[u]=z;}var A=/<(a|area|img|input)\b([^>]*)>/gi,B=/\b(href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+))/gi,C=/(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,D=/<cke:encoded>([^<]*)<\/cke:encoded>/gi,E=/(<\/?)((?:object|embed|param|html|body|head|title)[^>]*>)/gi,F=/(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,G=/<cke:(param|embed)([^>]*?)\/?>(?!\s*<\/cke:\1)/gi;function H(R){return R.replace(A,function(S,T,U){return '<'+T+U.replace(B,function(V,W){if(U.indexOf('data-cke-saved-'+W)==-1)return ' data-cke-saved-'+V+' '+V;return V;})+'>';});};function I(R){return R.replace(C,function(S){return '<cke:encoded>'+encodeURIComponent(S)+'</cke:encoded>';});};function J(R){return R.replace(D,function(S,T){return decodeURIComponent(T);});};function K(R){return R.replace(E,'$1cke:$2');};function L(R){return R.replace(F,'$1$2');};function M(R){return R.replace(G,'<cke:$1$2></cke:$1>');};function N(R){return R.replace(/(<pre\b[^>]*>)(\r\n|\n)/g,'$1$2$2');};function O(R){return R.replace(/<!--(?!{cke_protected})[\s\S]+?-->/g,function(S){return '<!--'+n+'{C}'+encodeURIComponent(S).replace(/--/g,'%2D%2D')+'-->';});};function P(R){return R.replace(/<!--\{cke_protected\}\{C\}([\s\S]+?)-->/g,function(S,T){return decodeURIComponent(T);
+});};function Q(R,S){var T=[],U=/<\!--\{cke_temp(comment)?\}(\d*?)-->/g,V=[/<script[\s\S]*?<\/script>/gi,/<noscript[\s\S]*?<\/noscript>/gi].concat(S);R=R.replace(/<!--[\s\S]*?-->/g,function(X){return '<!--{cke_tempcomment}'+(T.push(X)-1)+'-->';});for(var W=0;W<V.length;W++)R=R.replace(V[W],function(X){X=X.replace(U,function(Y,Z,aa){return T[aa];});return '<!--{cke_temp}'+(T.push(X)-1)+'-->';});R=R.replace(U,function(X,Y,Z){return '<!--'+n+(Y?'{C}':'')+encodeURIComponent(T[Z]).replace(/--/g,'%2D%2D')+'-->';});return R;};j.add('htmldataprocessor',{requires:['htmlwriter'],init:function(R){var S=R.dataProcessor=new a.htmlDataProcessor(R);S.writer.forceSimpleAmpersand=R.config.forceSimpleAmpersand;S.dataFilter.addRules(v);S.dataFilter.addRules(w);S.htmlFilter.addRules(x);var T={elements:{}};for(u in t)T.elements[u]=r(true,R.config.fillEmptyBlocks);S.htmlFilter.addRules(T);},onLoad:function(){!('fillEmptyBlocks' in i)&&(i.fillEmptyBlocks=1);}});a.htmlDataProcessor=function(R){var S=this;S.editor=R;S.writer=new a.htmlWriter();S.dataFilter=new a.htmlParser.filter();S.htmlFilter=new a.htmlParser.filter();};a.htmlDataProcessor.prototype={toHtml:function(R,S){R=Q(R,this.editor.config.protectedSource);R=H(R);R=I(R);R=K(R);R=M(R);R=N(R);var T=new h('div');T.setHtml('a'+R);R=T.getHtml().substr(1);R=L(R);R=J(R);R=P(R);var U=a.htmlParser.fragment.fromHtml(R,S),V=new a.htmlParser.basicWriter();U.writeHtml(V,this.dataFilter);R=V.getHtml(true);R=O(R);return R;},toDataFormat:function(R,S){var T=this.writer,U=a.htmlParser.fragment.fromHtml(R,S);T.reset();U.writeHtml(T,this.htmlFilter);return T.getHtml(true);}};})();(function(){function m(n,o){var p=n.createFakeParserElement(o,'cke_iframe','iframe',true),q=p.attributes.style||'',r=o.attributes.width,s=o.attributes.height;if(typeof r!='undefined')q+='width:'+e.cssLength(r)+';';if(typeof s!='undefined')q+='height:'+e.cssLength(s)+';';p.attributes.style=q;return p;};j.add('iframe',{requires:['dialog','fakeobjects'],init:function(n){var o='iframe',p=n.lang.iframe;a.dialog.add(o,this.path+'dialogs/iframe.js');n.addCommand(o,new a.dialogCommand(o));n.addCss('img.cke_iframe{background-image: url('+a.getUrl(this.path+'images/placeholder.png')+');'+'background-position: center center;'+'background-repeat: no-repeat;'+'border: 1px solid #a9a9a9;'+'width: 80px;'+'height: 80px;'+'}');n.ui.addButton('Iframe',{label:p.toolbar,command:o});n.on('doubleclick',function(q){var r=q.data.element;if(r.is('img')&&r.data('cke-real-element-type')=='iframe')q.data.dialog='iframe';
+});if(n.addMenuItems)n.addMenuItems({iframe:{label:p.title,command:'iframe',group:'image'}});if(n.contextMenu)n.contextMenu.addListener(function(q,r){if(q&&q.is('img')&&q.data('cke-real-element-type')=='iframe')return{iframe:2};});},afterInit:function(n){var o=n.dataProcessor,p=o&&o.dataFilter;if(p)p.addRules({elements:{iframe:function(q){return m(n,q);}}});}});})();j.add('image',{init:function(m){var n='image';a.dialog.add(n,this.path+'dialogs/image.js');m.addCommand(n,new a.dialogCommand(n));m.ui.addButton('Image',{label:m.lang.common.image,command:n});m.on('doubleclick',function(o){var p=o.data.element;if(p.is('img')&&!p.data('cke-realelement'))o.data.dialog='image';});if(m.addMenuItems)m.addMenuItems({image:{label:m.lang.image.menu,command:'image',group:'image'}});if(m.contextMenu)m.contextMenu.addListener(function(o,p){if(!o||!o.is('img')||o.data('cke-realelement')||o.isReadOnly())return null;return{image:2};});}});i.image_removeLinkByEmptyURL=true;(function(){var m={ol:1,ul:1},n=d.walker.whitespaces(true),o=d.walker.bookmark(false,true);function p(t){var C=this;var u=t.editor,v=t.data.path,w=v&&v.contains(m);if(w)return C.setState(2);if(!C.useIndentClasses&&C.name=='indent')return C.setState(2);var x=t.data.path,y=x.block||x.blockLimit;if(!y)return C.setState(0);if(C.useIndentClasses){var z=y.$.className.match(C.classNameRegex),A=0;if(z){z=z[1];A=C.indentClassMap[z];}if(C.name=='outdent'&&!A||C.name=='indent'&&A==u.config.indentClasses.length)return C.setState(0);return C.setState(2);}else{var B=parseInt(y.getStyle(r(y)),10);if(isNaN(B))B=0;if(B<=0)return C.setState(0);return C.setState(2);}};function q(t,u){var w=this;w.name=u;w.useIndentClasses=t.config.indentClasses&&t.config.indentClasses.length>0;if(w.useIndentClasses){w.classNameRegex=new RegExp('(?:^|\\s+)('+t.config.indentClasses.join('|')+')(?=$|\\s)');w.indentClassMap={};for(var v=0;v<t.config.indentClasses.length;v++)w.indentClassMap[t.config.indentClasses[v]]=v+1;}w.startDisabled=u=='outdent';};function r(t,u){return(u||t.getComputedStyle('direction'))=='ltr'?'margin-left':'margin-right';};function s(t){return t.type=1&&t.is('li');};q.prototype={exec:function(t){var u=this,v={};function w(M){var N=C.startContainer,O=C.endContainer;while(N&&!N.getParent().equals(M))N=N.getParent();while(O&&!O.getParent().equals(M))O=O.getParent();if(!N||!O)return;var P=N,Q=[],R=false;while(!R){if(P.equals(O))R=true;Q.push(P);P=P.getNext();}if(Q.length<1)return;var S=M.getParents(true);for(var T=0;T<S.length;
+T++){if(S[T].getName&&m[S[T].getName()]){M=S[T];break;}}var U=u.name=='indent'?1:-1,V=Q[0],W=Q[Q.length-1],X=j.list.listToArray(M,v),Y=X[W.getCustomData('listarray_index')].indent;for(T=V.getCustomData('listarray_index');T<=W.getCustomData('listarray_index');T++){X[T].indent+=U;var Z=X[T].parent;X[T].parent=new h(Z.getName(),Z.getDocument());}for(T=W.getCustomData('listarray_index')+1;T<X.length&&X[T].indent>Y;T++)X[T].indent+=U;var aa=j.list.arrayToList(X,v,null,t.config.enterMode,M.getDirection());if(u.name=='outdent'){var ab;if((ab=M.getParent())&&ab.is('li')){var ac=aa.listNode.getChildren(),ad=[],ae=ac.count(),af;for(T=ae-1;T>=0;T--){if((af=ac.getItem(T))&&af.is&&af.is('li'))ad.push(af);}}}if(aa)aa.listNode.replace(M);if(ad&&ad.length)for(T=0;T<ad.length;T++){var ag=ad[T],ah=ag;while((ah=ah.getNext())&&ah.is&&ah.getName() in m){if(c&&!ag.getFirst(function(ai){return n(ai)&&o(ai);}))ag.append(C.document.createText('\xa0'));ag.append(ah);}ag.insertAfter(ab);}};function x(){var M=C.createIterator(),N=t.config.enterMode;M.enforceRealBlocks=true;M.enlargeBr=N!=2;var O;while(O=M.getNextParagraph(N==1?'p':'div'))y(O);};function y(M,N){if(M.getCustomData('indent_processed'))return false;if(u.useIndentClasses){var O=M.$.className.match(u.classNameRegex),P=0;if(O){O=O[1];P=u.indentClassMap[O];}if(u.name=='outdent')P--;else P++;if(P<0)return false;P=Math.min(P,t.config.indentClasses.length);P=Math.max(P,0);M.$.className=e.ltrim(M.$.className.replace(u.classNameRegex,''));if(P>0)M.addClass(t.config.indentClasses[P-1]);}else{var Q=r(M,N),R=parseInt(M.getStyle(Q),10);if(isNaN(R))R=0;var S=t.config.indentOffset||40;R+=(u.name=='indent'?1:-1)*S;if(R<0)return false;R=Math.max(R,0);R=Math.ceil(R/S)*S;M.setStyle(Q,R?R+(t.config.indentUnit||'px'):'');if(M.getAttribute('style')==='')M.removeAttribute('style');}h.setMarker(v,M,'indent_processed',1);return true;};var z=t.getSelection(),A=z.createBookmarks(1),B=z&&z.getRanges(1),C,D=B.createIterator();while(C=D.getNextRange()){var E=C.getCommonAncestor(),F=E;while(F&&!(F.type==1&&m[F.getName()]))F=F.getParent();if(!F){var G=C.getEnclosedNode();if(G&&G.type==1&&G.getName() in m){C.setStartAt(G,1);C.setEndAt(G,2);F=G;}}if(F&&C.startContainer.type==1&&C.startContainer.getName() in m){var H=new d.walker(C);H.evaluator=s;C.startContainer=H.next();}if(F&&C.endContainer.type==1&&C.endContainer.getName() in m){H=new d.walker(C);H.evaluator=s;C.endContainer=H.previous();}if(F){var I=F.getFirst(s),J=!!I.getNext(s),K=C.startContainer,L=I.equals(K)||I.contains(K);
+if(!(L&&(u.name=='indent'||u.useIndentClasses||parseInt(F.getStyle(r(F)),10))&&y(F,!J&&I.getDirection())))w(F);}else x();}h.clearAllMarkers(v);t.forceNextSelectionCheck();z.selectBookmarks(A);}};j.add('indent',{init:function(t){var u=t.addCommand('indent',new q(t,'indent')),v=t.addCommand('outdent',new q(t,'outdent'));t.ui.addButton('Indent',{label:t.lang.indent,command:'indent'});t.ui.addButton('Outdent',{label:t.lang.outdent,command:'outdent'});t.on('selectionChange',e.bind(p,u));t.on('selectionChange',e.bind(p,v));if(b.ie6Compat||b.ie7Compat)t.addCss('ul,ol{\tmargin-left: 0px;\tpadding-left: 40px;}');t.on('dirChanged',function(w){var x=new d.range(t.document);x.setStartBefore(w.data.node);x.setEndAfter(w.data.node);var y=new d.walker(x),z;while(z=y.next()){if(z.type==1){if(!z.equals(w.data.node)&&z.getDirection()){x.setStartAfter(z);y=new d.walker(x);continue;}var A=t.config.indentClasses;if(A){var B=w.data.dir=='ltr'?['_rtl','']:['','_rtl'];for(var C=0;C<A.length;C++){if(z.hasClass(A[C]+B[0])){z.removeClass(A[C]+B[0]);z.addClass(A[C]+B[1]);}}}var D=z.getStyle('margin-right'),E=z.getStyle('margin-left');D?z.setStyle('margin-left',D):z.removeStyle('margin-left');E?z.setStyle('margin-right',E):z.removeStyle('margin-right');}}});},requires:['domiterator','list']});})();(function(){function m(r,s){var t=s.block||s.blockLimit;if(!t||t.getName()=='body')return 2;return n(t,r.config.useComputedState)==this.value?1:2;};function n(r,s){s=s===undefined||s;var t;if(s)t=r.getComputedStyle('text-align');else{while(!r.hasAttribute||!(r.hasAttribute('align')||r.getStyle('text-align'))){var u=r.getParent();if(!u)break;r=u;}t=r.getStyle('text-align')||r.getAttribute('align')||'';}t&&(t=t.replace(/-moz-|-webkit-|start|auto/i,''));!t&&s&&(t=r.getComputedStyle('direction')=='rtl'?'right':'left');return t;};function o(r){var s=r.editor.getCommand(this.name);s.state=m.call(this,r.editor,r.data.path);s.fire('state');};function p(r,s,t){var v=this;v.name=s;v.value=t;var u=r.config.justifyClasses;if(u){switch(t){case 'left':v.cssClassName=u[0];break;case 'center':v.cssClassName=u[1];break;case 'right':v.cssClassName=u[2];break;case 'justify':v.cssClassName=u[3];break;}v.cssClassRegex=new RegExp('(?:^|\\s+)(?:'+u.join('|')+')(?=$|\\s)');}};function q(r){var s=r.editor,t=new d.range(s.document);t.setStartBefore(r.data.node);t.setEndAfter(r.data.node);var u=new d.walker(t),v;while(v=u.next()){if(v.type==1){if(!v.equals(r.data.node)&&v.getDirection()){t.setStartAfter(v);u=new d.walker(t);
+continue;}var w=s.config.justifyClasses;if(w)if(v.hasClass(w[0])){v.removeClass(w[0]);v.addClass(w[2]);}else if(v.hasClass(w[2])){v.removeClass(w[2]);v.addClass(w[0]);}var x='text-align',y=v.getStyle(x);if(y=='left')v.setStyle(x,'right');else if(y=='right')v.setStyle(x,'left');}}};p.prototype={exec:function(r){var D=this;var s=r.getSelection(),t=r.config.enterMode;if(!s)return;var u=s.createBookmarks(),v=s.getRanges(true),w=D.cssClassName,x,y,z=r.config.useComputedState;z=z===undefined||z;for(var A=v.length-1;A>=0;A--){x=v[A].createIterator();x.enlargeBr=t!=2;while(y=x.getNextParagraph(t==1?'p':'div')){y.removeAttribute('align');y.removeStyle('text-align');var B=w&&(y.$.className=e.ltrim(y.$.className.replace(D.cssClassRegex,''))),C=D.state==2&&(!z||n(y,true)!=D.value);if(w){if(C)y.addClass(w);else if(!B)y.removeAttribute('class');}else if(C)y.setStyle('text-align',D.value);}}r.focus();r.forceNextSelectionCheck();s.selectBookmarks(u);}};j.add('justify',{init:function(r){var s=new p(r,'justifyleft','left'),t=new p(r,'justifycenter','center'),u=new p(r,'justifyright','right'),v=new p(r,'justifyblock','justify');r.addCommand('justifyleft',s);r.addCommand('justifycenter',t);r.addCommand('justifyright',u);r.addCommand('justifyblock',v);r.ui.addButton('JustifyLeft',{label:r.lang.justify.left,command:'justifyleft'});r.ui.addButton('JustifyCenter',{label:r.lang.justify.center,command:'justifycenter'});r.ui.addButton('JustifyRight',{label:r.lang.justify.right,command:'justifyright'});r.ui.addButton('JustifyBlock',{label:r.lang.justify.block,command:'justifyblock'});r.on('selectionChange',e.bind(o,s));r.on('selectionChange',e.bind(o,u));r.on('selectionChange',e.bind(o,t));r.on('selectionChange',e.bind(o,v));r.on('dirChanged',q);},requires:['domiterator']});})();j.add('keystrokes',{beforeInit:function(m){m.keystrokeHandler=new a.keystrokeHandler(m);m.specialKeys={};},init:function(m){var n=m.config.keystrokes,o=m.config.blockedKeystrokes,p=m.keystrokeHandler.keystrokes,q=m.keystrokeHandler.blockedKeystrokes;for(var r=0;r<n.length;r++)p[n[r][0]]=n[r][1];for(r=0;r<o.length;r++)q[o[r]]=1;}});a.keystrokeHandler=function(m){var n=this;if(m.keystrokeHandler)return m.keystrokeHandler;n.keystrokes={};n.blockedKeystrokes={};n._={editor:m};return n;};(function(){var m,n=function(p){p=p.data;var q=p.getKeystroke(),r=this.keystrokes[q],s=this._.editor;m=s.fire('key',{keyCode:q})===true;if(!m){if(r){var t={from:'keystrokeHandler'};m=s.execCommand(r,t)!==false;}if(!m){var u=s.specialKeys[q];
+m=u&&u(s)===true;if(!m)m=!!this.blockedKeystrokes[q];}}if(m)p.preventDefault(true);return!m;},o=function(p){if(m){m=false;p.data.preventDefault(true);}};a.keystrokeHandler.prototype={attach:function(p){p.on('keydown',n,this);if(b.opera||b.gecko&&b.mac)p.on('keypress',o,this);}};})();i.blockedKeystrokes=[1000+66,1000+73,1000+85];i.keystrokes=[[4000+121,'toolbarFocus'],[4000+122,'elementsPathFocus'],[2000+121,'contextMenu'],[1000+2000+121,'contextMenu'],[1000+90,'undo'],[1000+89,'redo'],[1000+2000+90,'redo'],[1000+76,'link'],[1000+66,'bold'],[1000+73,'italic'],[1000+85,'underline'],[4000+109,'toolbarCollapse'],[4000+48,'a11yHelp']];j.add('link',{init:function(m){m.addCommand('link',new a.dialogCommand('link'));m.addCommand('anchor',new a.dialogCommand('anchor'));m.addCommand('unlink',new a.unlinkCommand());m.ui.addButton('Link',{label:m.lang.link.toolbar,command:'link'});m.ui.addButton('Unlink',{label:m.lang.unlink,command:'unlink'});m.ui.addButton('Anchor',{label:m.lang.anchor.toolbar,command:'anchor'});a.dialog.add('link',this.path+'dialogs/link.js');a.dialog.add('anchor',this.path+'dialogs/anchor.js');var n=m.lang.dir=='rtl'?'right':'left';m.addCss('img.cke_anchor{background-image: url('+a.getUrl(this.path+'images/anchor.gif')+');'+'background-position: center center;'+'background-repeat: no-repeat;'+'border: 1px solid #a9a9a9;'+'width: 18px !important;'+'height: 18px !important;'+'}\n'+'a.cke_anchor'+'{'+'background-image: url('+a.getUrl(this.path+'images/anchor.gif')+');'+'background-position: '+n+' center;'+'background-repeat: no-repeat;'+'border: 1px solid #a9a9a9;'+'padding-'+n+': 18px;'+'}');m.on('selectionChange',function(o){var p=m.getCommand('unlink'),q=o.data.path.lastElement&&o.data.path.lastElement.getAscendant('a',true);if(q&&q.getName()=='a'&&q.getAttribute('href'))p.setState(2);else p.setState(0);});m.on('doubleclick',function(o){var p=j.link.getSelectedLink(m)||o.data.element;if(!p.isReadOnly())if(p.is('a'))o.data.dialog=p.getAttribute('name')&&!p.getAttribute('href')?'anchor':'link';else if(p.is('img')&&p.data('cke-real-element-type')=='anchor')o.data.dialog='anchor';});if(m.addMenuItems)m.addMenuItems({anchor:{label:m.lang.anchor.menu,command:'anchor',group:'anchor'},link:{label:m.lang.link.menu,command:'link',group:'link',order:1},unlink:{label:m.lang.unlink,command:'unlink',group:'link',order:5}});if(m.contextMenu)m.contextMenu.addListener(function(o,p){if(!o||o.isReadOnly())return null;var q=o.is('img')&&o.data('cke-real-element-type')=='anchor';
+if(!q){if(!(o=j.link.getSelectedLink(m)))return null;q=o.getAttribute('name')&&!o.getAttribute('href');}return q?{anchor:2}:{link:2,unlink:2};});},afterInit:function(m){var n=m.dataProcessor,o=n&&n.dataFilter;if(o)o.addRules({elements:{a:function(p){var q=p.attributes;if(q.name&&!q.href)return m.createFakeParserElement(p,'cke_anchor','anchor');}}});},requires:['fakeobjects']});j.link={getSelectedLink:function(m){try{var n=m.getSelection();if(n.getType()==3){var o=n.getSelectedElement();if(o.is('a'))return o;}var p=n.getRanges(true)[0];p.shrink(2);var q=p.getCommonAncestor();return q.getAscendant('a',true);}catch(r){return null;}}};a.unlinkCommand=function(){};a.unlinkCommand.prototype={exec:function(m){var n=m.getSelection(),o=n.createBookmarks(),p=n.getRanges(),q,r;for(var s=0;s<p.length;s++){q=p[s].getCommonAncestor(true);r=q.getAscendant('a',true);if(!r)continue;p[s].selectNodeContents(r);}n.selectRanges(p);m.document.$.execCommand('unlink',false,null);n.selectBookmarks(o);},startDisabled:true};e.extend(i,{linkShowAdvancedTab:true,linkShowTargetTab:true});(function(){var m={ol:1,ul:1},n=/^[\n\r\t ]*$/,o=d.walker.whitespaces(),p=d.walker.bookmark(),q=function(E){return!(o(E)||p(E));};j.list={listToArray:function(E,F,G,H,I){if(!m[E.getName()])return[];if(!H)H=0;if(!G)G=[];for(var J=0,K=E.getChildCount();J<K;J++){var L=E.getChild(J);if(L.$.nodeName.toLowerCase()!='li')continue;var M={parent:E,indent:H,element:L,contents:[]};if(!I){M.grandparent=E.getParent();if(M.grandparent&&M.grandparent.$.nodeName.toLowerCase()=='li')M.grandparent=M.grandparent.getParent();}else M.grandparent=I;if(F)h.setMarker(F,L,'listarray_index',G.length);G.push(M);for(var N=0,O=L.getChildCount(),P;N<O;N++){P=L.getChild(N);if(P.type==1&&m[P.getName()])j.list.listToArray(P,F,G,H+1,M.grandparent);else M.contents.push(P);}}return G;},arrayToList:function(E,F,G,H,I){if(!G)G=0;if(!E||E.length<G+1)return null;var J=E[G].parent.getDocument(),K=new d.documentFragment(J),L=null,M=G,N=Math.max(E[G].indent,0),O=null,P=H==1?'p':'div';while(1){var Q=E[M];if(Q.indent==N){if(!L||E[M].parent.getName()!=L.getName()){L=E[M].parent.clone(false,1);I&&L.setAttribute('dir',I);K.append(L);}O=L.append(Q.element.clone(0,1));for(var R=0;R<Q.contents.length;R++)O.append(Q.contents[R].clone(1,1));M++;}else if(Q.indent==Math.max(N,0)+1){var S=j.list.arrayToList(E,null,M,H);if(!O.getChildCount()&&c&&!(J.$.documentMode>7))O.append(J.createText('\xa0'));O.append(S.listNode);M=S.nextIndex;}else if(Q.indent==-1&&!G&&Q.grandparent){O;
+if(m[Q.grandparent.getName()])O=Q.element.clone(false,true);else if(I||Q.element.hasAttributes()||H!=2){O=J.createElement(P);Q.element.copyAttributes(O,{type:1,value:1});var T=Q.element.getDirection()||I;T&&O.setAttribute('dir',T);if(!I&&H==2&&!O.hasAttributes())O=new d.documentFragment(J);}else O=new d.documentFragment(J);for(R=0;R<Q.contents.length;R++)O.append(Q.contents[R].clone(1,1));if(O.type==11&&M!=E.length-1){var U=O.getLast();if(U&&U.type==1&&U.getAttribute('type')=='_moz')U.remove();if(!(U=O.getLast(q)&&U.type==1&&U.getName() in f.$block))O.append(J.createElement('br'));}if(O.type==1&&O.getName()==P&&O.$.firstChild){O.trim();var V=O.getFirst();if(V.type==1&&V.isBlockBoundary()){var W=new d.documentFragment(J);O.moveChildren(W);O=W;}}var X=O.$.nodeName.toLowerCase();if(!c&&(X=='div'||X=='p'))O.appendBogus();K.append(O);L=null;M++;}else return null;if(E.length<=M||Math.max(E[M].indent,0)<N)break;}if(F){var Y=K.getFirst();while(Y){if(Y.type==1)h.clearMarkers(F,Y);Y=Y.getNextSourceNode();}}return{listNode:K,nextIndex:M};}};function r(E){var F=E.data.path,G=F.blockLimit,H=F.elements,I,J;for(J=0;J<H.length&&(I=H[J])&&!I.equals(G);J++){if(m[H[J].getName()])return this.setState(this.type==H[J].getName()?1:2);}return this.setState(2);};function s(E,F,G,H){var I=j.list.listToArray(F.root,G),J=[];for(var K=0;K<F.contents.length;K++){var L=F.contents[K];L=L.getAscendant('li',true);if(!L||L.getCustomData('list_item_processed'))continue;J.push(L);h.setMarker(G,L,'list_item_processed',true);}var M=F.root,N=M.getDocument().createElement(this.type);M.copyAttributes(N,{start:1,type:1});N.removeStyle('list-style-type');for(K=0;K<J.length;K++){var O=J[K].getCustomData('listarray_index');I[O].parent=N;}var P=j.list.arrayToList(I,G,null,E.config.enterMode),Q,R=P.listNode.getChildCount();for(K=0;K<R&&(Q=P.listNode.getChild(K));K++){if(Q.getName()==this.type)H.push(Q);}P.listNode.replace(F.root);};var t=/^h[1-6]$/;function u(E,F,G){var H=F.contents,I=F.root.getDocument(),J=[];if(H.length==1&&H[0].equals(F.root)){var K=I.createElement('div');H[0].moveChildren&&H[0].moveChildren(K);H[0].append(K);H[0]=K;}var L=F.contents[0].getParent();for(var M=0;M<H.length;M++)L=L.getCommonAncestor(H[M].getParent());var N=E.config.useComputedState,O,P;N=N===undefined||N;for(M=0;M<H.length;M++){var Q=H[M],R;while(R=Q.getParent()){if(R.equals(L)){J.push(Q);if(!P&&Q.getDirection())P=1;var S=Q.getDirection(N);if(O!==null)if(O&&O!=S)O=null;else O=S;break;}Q=R;}}if(J.length<1)return;var T=J[J.length-1].getNext(),U=I.createElement(this.type);
+G.push(U);var V,W;while(J.length){V=J.shift();W=I.createElement('li');if(V.is('pre')||t.test(V.getName()))V.appendTo(W);else{if(O&&V.getDirection()){V.removeStyle('direction');V.removeAttribute('dir');}V.copyAttributes(W);V.moveChildren(W);V.remove();}W.appendTo(U);}if(O&&P)U.setAttribute('dir',O);if(T)U.insertBefore(T);else U.appendTo(L);};function v(E,F,G){var H=j.list.listToArray(F.root,G),I=[];for(var J=0;J<F.contents.length;J++){var K=F.contents[J];K=K.getAscendant('li',true);if(!K||K.getCustomData('list_item_processed'))continue;I.push(K);h.setMarker(G,K,'list_item_processed',true);}var L=null;for(J=0;J<I.length;J++){var M=I[J].getCustomData('listarray_index');H[M].indent=-1;L=M;}for(J=L+1;J<H.length;J++){if(H[J].indent>H[J-1].indent+1){var N=H[J-1].indent+1-H[J].indent,O=H[J].indent;while(H[J]&&H[J].indent>=O){H[J].indent+=N;J++;}J--;}}var P=j.list.arrayToList(H,G,null,E.config.enterMode,F.root.getAttribute('dir')),Q=P.listNode,R,S;function T(U){if((R=Q[U?'getFirst':'getLast']())&&!(R.is&&R.isBlockBoundary())&&(S=F.root[U?'getPrevious':'getNext'](d.walker.whitespaces(true)))&&!(S.is&&S.isBlockBoundary({br:1})))E.document.createElement('br')[U?'insertBefore':'insertAfter'](R);};T(true);T();Q.replace(F.root);};function w(E,F){this.name=E;this.type=F;};w.prototype={exec:function(E){E.focus();var F=E.document,G=E.getSelection(),H=G&&G.getRanges(true);if(!H||H.length<1)return;if(this.state==2){var I=F.getBody();I.trim();if(!I.getFirst()){var J=F.createElement(E.config.enterMode==1?'p':E.config.enterMode==3?'div':'br');J.appendTo(I);H=new d.rangeList([new d.range(F)]);if(J.is('br')){H[0].setStartBefore(J);H[0].setEndAfter(J);}else H[0].selectNodeContents(J);G.selectRanges(H);}else{var K=H.length==1&&H[0],L=K&&K.getEnclosedNode();if(L&&L.is&&this.type==L.getName())this.setState(1);}}var M=G.createBookmarks(true),N=[],O={},P=H.createIterator(),Q=0;while((K=P.getNextRange())&&++Q){var R=K.getBoundaryNodes(),S=R.startNode,T=R.endNode;if(S.type==1&&S.getName()=='td')K.setStartAt(R.startNode,1);if(T.type==1&&T.getName()=='td')K.setEndAt(R.endNode,2);var U=K.createIterator(),V;U.forceBrBreak=this.state==2;while(V=U.getNextParagraph()){if(V.getCustomData('list_block'))continue;else h.setMarker(O,V,'list_block',1);var W=new d.elementPath(V),X=W.elements,Y=X.length,Z=null,aa=0,ab=W.blockLimit,ac;for(var ad=Y-1;ad>=0&&(ac=X[ad]);ad--){if(m[ac.getName()]&&ab.contains(ac)){ab.removeCustomData('list_group_object_'+Q);var ae=ac.getCustomData('list_group_object');if(ae)ae.contents.push(V);
+else{ae={root:ac,contents:[V]};N.push(ae);h.setMarker(O,ac,'list_group_object',ae);}aa=1;break;}}if(aa)continue;var af=ab;if(af.getCustomData('list_group_object_'+Q))af.getCustomData('list_group_object_'+Q).contents.push(V);else{ae={root:af,contents:[V]};h.setMarker(O,af,'list_group_object_'+Q,ae);N.push(ae);}}}var ag=[];while(N.length>0){ae=N.shift();if(this.state==2){if(m[ae.root.getName()])s.call(this,E,ae,O,ag);else u.call(this,E,ae,ag);}else if(this.state==1&&m[ae.root.getName()])v.call(this,E,ae,O);}for(ad=0;ad<ag.length;ad++){Z=ag[ad];var ah,ai=this;(ah=function(aj){var ak=Z[aj?'getPrevious':'getNext'](d.walker.whitespaces(true));if(ak&&ak.getName&&ak.getName()==ai.type){ak.remove();ak.moveChildren(Z,aj);}})();ah(1);}h.clearAllMarkers(O);G.selectBookmarks(M);E.focus();}};var x=f,y=/[\t\r\n ]*(?: |\xa0)$/;function z(E,F){var G,H=E.children,I=H.length;for(var J=0;J<I;J++){G=H[J];if(G.name&&G.name in F)return J;}return I;};function A(E){return function(F){var G=F.children,H=z(F,x.$list),I=G[H],J=I&&I.previous,K;if(J&&(J.name&&J.name=='br'||J.value&&(K=J.value.match(y)))){var L=J;if(!(K&&K.index)&&L==G[0])G[0]=E||c?new a.htmlParser.text('\xa0'):new a.htmlParser.element('br',{});else if(L.name=='br')G.splice(H-1,1);else L.value=L.value.replace(y,'');}};};var B={elements:{}};for(var C in x.$listItem)B.elements[C]=A();var D={elements:{}};for(C in x.$listItem)D.elements[C]=A(true);j.add('list',{init:function(E){var F=E.addCommand('numberedlist',new w('numberedlist','ol')),G=E.addCommand('bulletedlist',new w('bulletedlist','ul'));E.ui.addButton('NumberedList',{label:E.lang.numberedlist,command:'numberedlist'});E.ui.addButton('BulletedList',{label:E.lang.bulletedlist,command:'bulletedlist'});E.on('selectionChange',e.bind(r,F));E.on('selectionChange',e.bind(r,G));},afterInit:function(E){var F=E.dataProcessor;if(F){F.dataFilter.addRules(B);F.htmlFilter.addRules(D);}},requires:['domiterator']});})();(function(){j.liststyle={requires:['dialog'],init:function(m){m.addCommand('numberedListStyle',new a.dialogCommand('numberedListStyle'));a.dialog.add('numberedListStyle',this.path+'dialogs/liststyle.js');m.addCommand('bulletedListStyle',new a.dialogCommand('bulletedListStyle'));a.dialog.add('bulletedListStyle',this.path+'dialogs/liststyle.js');if(m.addMenuItems){m.addMenuGroup('list',108);m.addMenuItems({numberedlist:{label:m.lang.list.numberedTitle,group:'list',command:'numberedListStyle'},bulletedlist:{label:m.lang.list.bulletedTitle,group:'list',command:'bulletedListStyle'}});
+}if(m.contextMenu)m.contextMenu.addListener(function(n,o){if(!n||n.isReadOnly())return null;while(n){var p=n.getName();if(p=='ol')return{numberedlist:2};else if(p=='ul')return{bulletedlist:2};n=n.getParent();}return null;});}};j.add('liststyle',j.liststyle);})();(function(){function m(s){if(!s||s.type!=1||s.getName()!='form')return[];var t=[],u=['style','className'];for(var v=0;v<u.length;v++){var w=u[v],x=s.$.elements.namedItem(w);if(x){var y=new h(x);t.push([y,y.nextSibling]);y.remove();}}return t;};function n(s,t){if(!s||s.type!=1||s.getName()!='form')return;if(t.length>0)for(var u=t.length-1;u>=0;u--){var v=t[u][0],w=t[u][1];if(w)v.insertBefore(w);else v.appendTo(s);}};function o(s,t){var u=m(s),v={},w=s.$;if(!t){v['class']=w.className||'';w.className='';}v.inline=w.style.cssText||'';if(!t)w.style.cssText='position: static; overflow: visible';n(u);return v;};function p(s,t){var u=m(s),v=s.$;if('class' in t)v.className=t['class'];if('inline' in t)v.style.cssText=t.inline;n(u);};function q(s){var t=a.instances;for(var u in t){var v=t[u];if(v.mode=='wysiwyg'){var w=v.document.getBody();w.setAttribute('contentEditable',false);w.setAttribute('contentEditable',true);}}if(s.focusManager.hasFocus){s.toolbox.focus();s.focus();}};function r(s){if(!c||b.version>6)return null;var t=h.createFromHtml('<iframe frameborder="0" tabindex="-1" src="javascript:void((function(){document.open();'+(b.isCustomDomain()?"document.domain='"+this.getDocument().$.domain+"';":'')+'document.close();'+'})())"'+' style="display:block;position:absolute;z-index:-1;'+'progid:DXImageTransform.Microsoft.Alpha(opacity=0);'+'"></iframe>');return s.append(t,true);};j.add('maximize',{init:function(s){var t=s.lang,u=a.document,v=u.getWindow(),w,x,y,z;function A(){var C=v.getViewPaneSize();z&&z.setStyles({width:C.width+'px',height:C.height+'px'});s.resize(C.width,C.height,null,true);};var B=2;s.addCommand('maximize',{modes:{wysiwyg:1,source:1},editorFocus:false,exec:function(){var C=s.container.getChild(1),D=s.getThemeSpace('contents');if(s.mode=='wysiwyg'){var E=s.getSelection();w=E&&E.getRanges();x=v.getScrollPosition();}else{var F=s.textarea.$;w=!c&&[F.selectionStart,F.selectionEnd];x=[F.scrollLeft,F.scrollTop];}if(this.state==2){v.on('resize',A);y=v.getScrollPosition();var G=s.container;while(G=G.getParent()){G.setCustomData('maximize_saved_styles',o(G));G.setStyle('z-index',s.config.baseFloatZIndex-1);}D.setCustomData('maximize_saved_styles',o(D,true));C.setCustomData('maximize_saved_styles',o(C,true));
+var H={overflow:b.webkit?'':'hidden',width:0,height:0};u.getDocumentElement().setStyles(H);!b.gecko&&u.getDocumentElement().setStyle('position','fixed');u.getBody().setStyles(H);c?setTimeout(function(){v.$.scrollTo(0,0);},0):v.$.scrollTo(0,0);C.setStyle('position','absolute');C.$.offsetLeft;C.setStyles({'z-index':s.config.baseFloatZIndex-1,left:'0px',top:'0px'});z=r(C);C.addClass('cke_maximized');A();var I=C.getDocumentPosition();C.setStyles({left:-1*I.x+'px',top:-1*I.y+'px'});b.gecko&&q(s);}else if(this.state==1){v.removeListener('resize',A);var J=[D,C];for(var K=0;K<J.length;K++){p(J[K],J[K].getCustomData('maximize_saved_styles'));J[K].removeCustomData('maximize_saved_styles');}G=s.container;while(G=G.getParent()){p(G,G.getCustomData('maximize_saved_styles'));G.removeCustomData('maximize_saved_styles');}c?setTimeout(function(){v.$.scrollTo(y.x,y.y);},0):v.$.scrollTo(y.x,y.y);C.removeClass('cke_maximized');if(b.webkit){C.setStyle('display','inline');setTimeout(function(){C.setStyle('display','block');},0);}if(z){z.remove();z=null;}s.fire('resize');}this.toggleState();var L=this.uiItems[0];if(L){var M=this.state==2?t.maximize:t.minimize,N=s.element.getDocument().getById(L._.id);N.getChild(1).setHtml(M);N.setAttribute('title',M);N.setAttribute('href','javascript:void("'+M+'");');}if(s.mode=='wysiwyg'){if(w){b.gecko&&q(s);s.getSelection().selectRanges(w);var O=s.getSelection().getStartElement();O&&O.scrollIntoView(true);}else v.$.scrollTo(x.x,x.y);}else{if(w){F.selectionStart=w[0];F.selectionEnd=w[1];}F.scrollLeft=x[0];F.scrollTop=x[1];}w=x=null;B=this.state;},canUndo:false});s.ui.addButton('Maximize',{label:t.maximize,command:'maximize'});s.on('mode',function(){var C=s.getCommand('maximize');C.setState(C.state==0?0:B);},null,null,100);}});})();j.add('newpage',{init:function(m){m.addCommand('newpage',{modes:{wysiwyg:1,source:1},exec:function(n){var o=this;n.setData(n.config.newpage_html||'',function(){setTimeout(function(){n.fire('afterCommandExec',{name:o.name,command:o});},200);});n.focus();},async:true});m.ui.addButton('NewPage',{label:m.lang.newPage,command:'newpage'});}});j.add('pagebreak',{init:function(m){m.addCommand('pagebreak',j.pagebreakCmd);m.ui.addButton('PageBreak',{label:m.lang.pagebreak,command:'pagebreak'});m.addCss('img.cke_pagebreak{background-image: url('+a.getUrl(this.path+'images/pagebreak.gif')+');'+'background-position: center center;'+'background-repeat: no-repeat;'+'clear: both;'+'display: block;'+'float: none;'+'width:100% !important; _width:99.9% !important;'+'border-top: #999999 1px dotted;'+'border-bottom: #999999 1px dotted;'+'height: 5px !important;'+'page-break-after: always;'+'}');
+},afterInit:function(m){var n=m.dataProcessor,o=n&&n.dataFilter;if(o)o.addRules({elements:{div:function(p){var q=p.attributes,r=q&&q.style,s=r&&p.children.length==1&&p.children[0],t=s&&s.name=='span'&&s.attributes.style;if(t&&/page-break-after\s*:\s*always/i.test(r)&&/display\s*:\s*none/i.test(t)){var u=m.createFakeParserElement(p,'cke_pagebreak','div'),v=m.lang.pagebreakAlt;u.attributes.alt=v;u.attributes['aria-label']=v;return u;}}}});},requires:['fakeobjects']});j.pagebreakCmd={exec:function(m){var n=m.lang.pagebreakAlt,o=h.createFromHtml('<div style="page-break-after: always;"><span style="display: none;"> </span></div>');o=m.createFakeElement(o,'cke_pagebreak','div');o.setAttributes({alt:n,'aria-label':n,title:n});var p=m.getSelection().getRanges(true);m.fire('saveSnapshot');for(var q,r=p.length-1;r>=0;r--){q=p[r];if(r<p.length-1)o=o.clone(true);q.splitBlock('p');q.insertNode(o);if(r==p.length-1){q.moveToPosition(o,4);q.select();}var s=o.getPrevious();if(s&&f[s.getName()].div)o.move(s);}m.fire('saveSnapshot');}};(function(){j.add('pastefromword',{init:function(m){var n=0,o=function(){setTimeout(function(){n=0;},0);};m.addCommand('pastefromword',{canUndo:false,exec:function(){n=1;if(m.execCommand('paste')===false)m.on('dialogHide',function(p){p.removeListener();o();});else o();}});m.ui.addButton('PasteFromWord',{label:m.lang.pastefromword.toolbar,command:'pastefromword'});m.on('pasteState',function(p){m.getCommand('pastefromword').setState(p.data);});m.on('paste',function(p){var q=p.data,r;if((r=q.html)&&(n||/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(r))){var s=this.loadFilterRules(function(){if(s)m.fire('paste',q);else if(!m.config.pasteFromWordPromptCleanup||n||confirm(m.lang.pastefromword.confirmCleanup))q.html=a.cleanWord(r,m);});s&&p.cancel();}},this);},loadFilterRules:function(m){var n=a.cleanWord;if(n)m();else{var o=a.getUrl(i.pasteFromWordCleanupFile||this.path+'filter/default.js');a.scriptLoader.load(o,m,null,true);}return!n;},requires:['clipboard']});})();(function(){var m={exec:function(n){var o=e.tryThese(function(){var p=window.clipboardData.getData('Text');if(!p)throw 0;return p;});if(!o){n.openDialog('pastetext');return false;}else n.fire('paste',{text:o});return true;}};j.add('pastetext',{init:function(n){var o='pastetext',p=n.addCommand(o,m);n.ui.addButton('PasteText',{label:n.lang.pasteText.button,command:o});a.dialog.add(o,a.getUrl(this.path+'dialogs/pastetext.js'));if(n.config.forcePasteAsPlainText)n.on('beforeCommandExec',function(q){if(q.data.name=='paste'){n.execCommand('pastetext');
+q.cancel();}},null,null,0);n.on('pasteState',function(q){n.getCommand('pastetext').setState(q.data);});},requires:['clipboard']});})();j.add('popup');e.extend(a.editor.prototype,{popup:function(m,n,o,p){n=n||'80%';o=o||'70%';if(typeof n=='string'&&n.length>1&&n.substr(n.length-1,1)=='%')n=parseInt(window.screen.width*parseInt(n,10)/100,10);if(typeof o=='string'&&o.length>1&&o.substr(o.length-1,1)=='%')o=parseInt(window.screen.height*parseInt(o,10)/100,10);if(n<640)n=640;if(o<420)o=420;var q=parseInt((window.screen.height-o)/2,10),r=parseInt((window.screen.width-n)/2,10);p=(p||'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes')+',width='+n+',height='+o+',top='+q+',left='+r;var s=window.open('',null,p,true);if(!s)return false;try{s.moveTo(r,q);s.resizeTo(n,o);s.focus();s.location.href=m;}catch(t){s=window.open(m,null,p,true);}return true;}});(function(){var m={modes:{wysiwyg:1,source:1},canUndo:false,exec:function(o){var p,q=o.config,r=q.baseHref?'<base href="'+q.baseHref+'"/>':'',s=b.isCustomDomain();if(q.fullPage)p=o.getData().replace(/<head>/,'$&'+r).replace(/[^>]*(?=<\/title>)/,'$& — '+o.lang.preview);else{var t='<body ',u=o.document&&o.document.getBody();if(u){if(u.getAttribute('id'))t+='id="'+u.getAttribute('id')+'" ';if(u.getAttribute('class'))t+='class="'+u.getAttribute('class')+'" ';}t+='>';p=o.config.docType+'<html dir="'+o.config.contentsLangDirection+'">'+'<head>'+r+'<title>'+o.lang.preview+'</title>'+e.buildStyleHtml(o.config.contentsCss)+'</head>'+t+o.getData()+'</body></html>';}var v=640,w=420,x=80;try{var y=window.screen;v=Math.round(y.width*0.8);w=Math.round(y.height*0.7);x=Math.round(y.width*0.1);}catch(B){}var z='';if(s){window._cke_htmlToLoad=p;z='javascript:void( (function(){document.open();document.domain="'+document.domain+'";'+'document.write( window.opener._cke_htmlToLoad );'+'document.close();'+'window.opener._cke_htmlToLoad = null;'+'})() )';}var A=window.open(z,null,'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+v+',height='+w+',left='+x);if(!s){A.document.open();A.document.write(p);A.document.close();}}},n='preview';j.add(n,{init:function(o){o.addCommand(n,m);o.ui.addButton('Preview',{label:o.lang.preview,command:n});}});})();j.add('print',{init:function(m){var n='print',o=m.addCommand(n,j.print);m.ui.addButton('Print',{label:m.lang.print,command:n});}});j.print={exec:function(m){if(b.opera)return;else if(b.gecko)m.window.$.print();
+else m.document.$.execCommand('Print');},canUndo:false,modes:{wysiwyg:!b.opera}};j.add('removeformat',{requires:['selection'],init:function(m){m.addCommand('removeFormat',j.removeformat.commands.removeformat);m.ui.addButton('RemoveFormat',{label:m.lang.removeFormat,command:'removeFormat'});m._.removeFormat={filters:[]};}});j.removeformat={commands:{removeformat:{exec:function(m){var n=m._.removeFormatRegex||(m._.removeFormatRegex=new RegExp('^(?:'+m.config.removeFormatTags.replace(/,/g,'|')+')$','i')),o=m._.removeAttributes||(m._.removeAttributes=m.config.removeFormatAttributes.split(',')),p=j.removeformat.filter,q=m.getSelection().getRanges(1),r=q.createIterator(),s;while(s=r.getNextRange()){if(!s.collapsed)s.enlarge(1);var t=s.createBookmark(),u=t.startNode,v=t.endNode,w,x=function(z){var A=new d.elementPath(z),B=A.elements;for(var C=1,D;D=B[C];C++){if(D.equals(A.block)||D.equals(A.blockLimit))break;if(n.test(D.getName())&&p(m,D))z.breakParent(D);}};x(u);if(v){x(v);w=u.getNextSourceNode(true,1);while(w){if(w.equals(v))break;var y=w.getNextSourceNode(false,1);if(!(w.getName()=='img'&&w.data('cke-realelement'))&&p(m,w))if(n.test(w.getName()))w.remove(1);else{w.removeAttributes(o);m.fire('removeFormatCleanup',w);}w=y;}}s.moveToBookmark(t);}m.getSelection().selectRanges(q);}}},filter:function(m,n){var o=m._.removeFormat.filters;for(var p=0;p<o.length;p++){if(o[p](n)===false)return false;}return true;}};a.editor.prototype.addRemoveFormatFilter=function(m){this._.removeFormat.filters.push(m);};i.removeFormatTags='b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var';i.removeFormatAttributes='class,style,lang,width,height,align,hspace,valign';j.add('resize',{init:function(m){var n=m.config;!n.resize_dir&&(n.resize_dir='both');n.resize_maxWidth==undefined&&(n.resize_maxWidth=3000);n.resize_maxHeight==undefined&&(n.resize_maxHeight=3000);n.resize_minWidth==undefined&&(n.resize_minWidth=750);n.resize_minHeight==undefined&&(n.resize_minHeight=250);if(n.resize_enabled!==false){var o=null,p,q,r=(n.resize_dir=='both'||n.resize_dir=='horizontal')&&n.resize_minWidth!=n.resize_maxWidth,s=(n.resize_dir=='both'||n.resize_dir=='vertical')&&n.resize_minHeight!=n.resize_maxHeight;function t(w){var x=w.data.$.screenX-p.x,y=w.data.$.screenY-p.y,z=q.width,A=q.height,B=z+x*(m.lang.dir=='rtl'?-1:1),C=A+y;if(r)z=Math.max(n.resize_minWidth,Math.min(B,n.resize_maxWidth));if(s)A=Math.max(n.resize_minHeight,Math.min(C,n.resize_maxHeight));m.resize(z,A);};
+function u(w){a.document.removeListener('mousemove',t);a.document.removeListener('mouseup',u);if(m.document){m.document.removeListener('mousemove',t);m.document.removeListener('mouseup',u);}};var v=e.addFunction(function(w){if(!o)o=m.getResizable();q={width:o.$.offsetWidth||0,height:o.$.offsetHeight||0};p={x:w.screenX,y:w.screenY};n.resize_minWidth>q.width&&(n.resize_minWidth=q.width);n.resize_minHeight>q.height&&(n.resize_minHeight=q.height);a.document.on('mousemove',t);a.document.on('mouseup',u);if(m.document){m.document.on('mousemove',t);m.document.on('mouseup',u);}});m.on('destroy',function(){e.removeFunction(v);});m.on('themeSpace',function(w){if(w.data.space=='bottom'){var x='';if(r&&!s)x=' cke_resizer_horizontal';if(!r&&s)x=' cke_resizer_vertical';w.data.html+='<div class="cke_resizer'+x+'"'+' title="'+e.htmlEncode(m.lang.resize)+'"'+' onmousedown="CKEDITOR.tools.callFunction('+v+', event)"'+'></div>';}},m,null,100);}}});(function(){var m={modes:{wysiwyg:1,source:1},exec:function(o){var p=o.element.$.form;if(p)try{p.submit();}catch(q){if(p.submit.click)p.submit.click();}}},n='save';j.add(n,{init:function(o){var p=o.addCommand(n,m);p.modes={wysiwyg:!!o.element.$.form};o.ui.addButton('Save',{label:o.lang.save,command:n});}});})();(function(){var m='scaytcheck',n='';function o(t,u){var v=0,w;for(w in u){if(u[w]==t){v=1;break;}}return v;};var p=function(){var t=this,u=function(){var y=t.config,z={};z.srcNodeRef=t.document.getWindow().$.frameElement;z.assocApp='CKEDITOR.'+a.version+'@'+a.revision;z.customerid=y.scayt_customerid||'1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2';z.customDictionaryIds=y.scayt_customDictionaryIds||'';z.userDictionaryName=y.scayt_userDictionaryName||'';z.sLang=y.scayt_sLang||'en_US';z.onLoad=function(){if(!(c&&b.version<8))this.addStyle(this.selectorCss(),'padding-bottom: 2px !important;');if(t.focusManager.hasFocus&&!q.isControlRestored(t))this.focus();};z.onBeforeChange=function(){if(q.getScayt(t)&&!t.checkDirty())setTimeout(function(){t.resetDirty();},0);};var A=window.scayt_custom_params;if(typeof A=='object')for(var B in A)z[B]=A[B];if(q.getControlId(t))z.id=q.getControlId(t);var C=new window.scayt(z);C.afterMarkupRemove.push(function(J){new h(J,C.document).mergeSiblings();});var D=q.instances[t.name];if(D){C.sLang=D.sLang;C.option(D.option());C.paused=D.paused;}q.instances[t.name]=C;var E='scaytButton',F=window.scayt.uiTags,G=[];for(var H=0,I=4;H<I;H++)G.push(F[H]&&q.uiTabs[H]);q.uiTabs=G;try{C.setDisabled(q.isPaused(t)===false);
+}catch(J){}t.fire('showScaytState');};t.on('contentDom',u);t.on('contentDomUnload',function(){var y=a.document.getElementsByTag('script'),z=/^dojoIoScript(\d+)$/i,A=/^https?:\/\/svc\.spellchecker\.net\/spellcheck\/script\/ssrv\.cgi/i;for(var B=0;B<y.count();B++){var C=y.getItem(B),D=C.getId(),E=C.getAttribute('src');if(D&&E&&D.match(z)&&E.match(A))C.remove();}});t.on('beforeCommandExec',function(y){if((y.data.name=='source'||y.data.name=='newpage')&&t.mode=='wysiwyg'){var z=q.getScayt(t);if(z){q.setPaused(t,!z.disabled);q.setControlId(t,z.id);z.destroy(true);delete q.instances[t.name];}}else if(y.data.name=='source'&&t.mode=='source')q.markControlRestore(t);});t.on('afterCommandExec',function(y){if(!q.isScaytEnabled(t))return;if(t.mode=='wysiwyg'&&(y.data.name=='undo'||y.data.name=='redo'))window.setTimeout(function(){q.getScayt(t).refresh();},10);});t.on('destroy',function(y){var z=y.editor,A=q.getScayt(z);if(!A)return;delete q.instances[z.name];q.setControlId(z,A.id);A.destroy(true);});t.on('afterSetData',function(){if(q.isScaytEnabled(t))window.setTimeout(function(){var y=q.getScayt(t);y&&y.refresh();},10);});t.on('insertElement',function(){var y=q.getScayt(t);if(q.isScaytEnabled(t)){if(c)t.getSelection().unlock(true);window.setTimeout(function(){y.focus();y.refresh();},10);}},this,null,50);t.on('insertHtml',function(){var y=q.getScayt(t);if(q.isScaytEnabled(t)){if(c)t.getSelection().unlock(true);window.setTimeout(function(){y.focus();y.refresh();},10);}},this,null,50);t.on('scaytDialog',function(y){y.data.djConfig=window.djConfig;y.data.scayt_control=q.getScayt(t);y.data.tab=n;y.data.scayt=window.scayt;});var v=t.dataProcessor,w=v&&v.htmlFilter;if(w)w.addRules({elements:{span:function(y){if(y.attributes['data-scayt_word']&&y.attributes['data-scaytid']){delete y.name;return y;}}}});var x=j.undo.Image.prototype;x.equals=e.override(x.equals,function(y){return function(z){var E=this;var A=E.contents,B=z.contents,C=q.getScayt(E.editor);if(C&&q.isScaytReady(E.editor)){E.contents=C.reset(A)||'';z.contents=C.reset(B)||'';}var D=y.apply(E,arguments);E.contents=A;z.contents=B;return D;};});if(t.document)u();};j.scayt={engineLoaded:false,instances:{},controlInfo:{},setControlInfo:function(t,u){if(t&&t.name&&typeof this.controlInfo[t.name]!='object')this.controlInfo[t.name]={};for(var v in u)this.controlInfo[t.name][v]=u[v];},isControlRestored:function(t){if(t&&t.name&&this.controlInfo[t.name])return this.controlInfo[t.name].restored;return false;},markControlRestore:function(t){this.setControlInfo(t,{restored:true});
+},setControlId:function(t,u){this.setControlInfo(t,{id:u});},getControlId:function(t){if(t&&t.name&&this.controlInfo[t.name]&&this.controlInfo[t.name].id)return this.controlInfo[t.name].id;return null;},setPaused:function(t,u){this.setControlInfo(t,{paused:u});},isPaused:function(t){if(t&&t.name&&this.controlInfo[t.name])return this.controlInfo[t.name].paused;return undefined;},getScayt:function(t){return this.instances[t.name];},isScaytReady:function(t){return this.engineLoaded===true&&'undefined'!==typeof window.scayt&&this.getScayt(t);},isScaytEnabled:function(t){var u=this.getScayt(t);return u?u.disabled===false:false;},loadEngine:function(t){if(b.gecko&&b.version<10900||b.opera||b.air)return t.fire('showScaytState');if(this.engineLoaded===true)return p.apply(t);else if(this.engineLoaded==-1)return a.on('scaytReady',function(){p.apply(t);});a.on('scaytReady',p,t);a.on('scaytReady',function(){this.engineLoaded=true;},this,null,0);this.engineLoaded=-1;var u=document.location.protocol;u=u.search(/https?:/)!=-1?u:'http:';var v='svc.spellchecker.net/scayt26/loader__base.js',w=t.config.scayt_srcUrl||u+'//'+v,x=q.parseUrl(w).path+'/';if(window.scayt==undefined){a._djScaytConfig={baseUrl:x,addOnLoad:[function(){a.fireOnce('scaytReady');}],isDebug:false};a.document.getHead().append(a.document.createElement('script',{attributes:{type:'text/javascript',async:'true',src:w}}));}else a.fireOnce('scaytReady');return null;},parseUrl:function(t){var u;if(t.match&&(u=t.match(/(.*)[\/\\](.*?\.\w+)$/)))return{path:u[1],file:u[2]};else return t;}};var q=j.scayt,r=function(t,u,v,w,x,y,z){t.addCommand(w,x);t.addMenuItem(w,{label:v,command:w,group:y,order:z});},s={preserveState:true,editorFocus:false,canUndo:false,exec:function(t){if(q.isScaytReady(t)){var u=q.isScaytEnabled(t);this.setState(u?2:1);var v=q.getScayt(t);v.focus();v.setDisabled(u);}else if(!t.config.scayt_autoStartup&&q.engineLoaded>=0){this.setState(0);q.loadEngine(t);}}};j.add('scayt',{requires:['menubutton'],beforeInit:function(t){var u=t.config.scayt_contextMenuItemsOrder||'suggest|moresuggest|control',v='';u=u.split('|');if(u&&u.length)for(var w=0;w<u.length;w++)v+='scayt_'+u[w]+(u.length!=parseInt(w,10)+1?',':'');t.config.menu_groups=v+','+t.config.menu_groups;},init:function(t){var u={},v={},w=t.addCommand(m,s);a.dialog.add(m,a.getUrl(this.path+'dialogs/options.js'));var x=t.config.scayt_uiTabs||'1,1,1',y=[];x=x.split(',');for(var z=0,A=3;z<A;z++){var B=parseInt(x[z]||'1',10);y.push(B);}var C='scaytButton';
+t.addMenuGroup(C);var D={},E=t.lang.scayt;D.scaytToggle={label:E.enable,command:m,group:C};if(y[0]==1)D.scaytOptions={label:E.options,group:C,onClick:function(){n='options';t.openDialog(m);}};if(y[1]==1)D.scaytLangs={label:E.langs,group:C,onClick:function(){n='langs';t.openDialog(m);}};if(y[2]==1)D.scaytDict={label:E.dictionariesTab,group:C,onClick:function(){n='dictionaries';t.openDialog(m);}};D.scaytAbout={label:t.lang.scayt.about,group:C,onClick:function(){n='about';t.openDialog(m);}};y[3]=1;q.uiTabs=y;t.addMenuItems(D);t.ui.add('Scayt',5,{label:E.title,title:b.opera?E.opera_title:E.title,className:'cke_button_scayt',modes:{wysiwyg:1},onRender:function(){w.on('state',function(){this.setState(w.state);},this);},onMenu:function(){var G=q.isScaytEnabled(t);t.getMenuItem('scaytToggle').label=E[G?'disable':'enable'];return{scaytToggle:2,scaytOptions:G&&q.uiTabs[0]?2:0,scaytLangs:G&&q.uiTabs[1]?2:0,scaytDict:G&&q.uiTabs[2]?2:0,scaytAbout:G&&q.uiTabs[3]?2:0};}});if(t.contextMenu&&t.addMenuItems)t.contextMenu.addListener(function(G,H){if(!q.isScaytEnabled(t)||H.getRanges()[0].checkReadOnly())return null;var I=q.getScayt(t),J=I.getScaytNode();if(!J)return null;var K=I.getWord(J);if(!K)return null;var L=I.getLang(),M={},N=window.scayt.getSuggestion(K,L);if(!N||!N.length)return null;for(z in u){delete t._.menuItems[z];delete t._.commands[z];}for(z in v){delete t._.menuItems[z];delete t._.commands[z];}u={};v={};var O=t.config.scayt_moreSuggestions||'on',P=false,Q=t.config.scayt_maxSuggestions;typeof Q!='number'&&(Q=5);!Q&&(Q=N.length);var R=t.config.scayt_contextCommands||'all';R=R.split('|');for(var S=0,T=N.length;S<T;S+=1){var U='scayt_suggestion_'+N[S].replace(' ','_'),V=(function(Z,aa){return{exec:function(){I.replace(Z,aa);}};})(J,N[S]);if(S<Q){r(t,'button_'+U,N[S],U,V,'scayt_suggest',S+1);M[U]=2;v[U]=2;}else if(O=='on'){r(t,'button_'+U,N[S],U,V,'scayt_moresuggest',S+1);u[U]=2;P=true;}}if(P){t.addMenuItem('scayt_moresuggest',{label:E.moreSuggestions,group:'scayt_moresuggest',order:10,getItems:function(){return u;}});v.scayt_moresuggest=2;}if(o('all',R)||o('ignore',R)){var W={exec:function(){I.ignore(J);}};r(t,'ignore',E.ignore,'scayt_ignore',W,'scayt_control',1);v.scayt_ignore=2;}if(o('all',R)||o('ignoreall',R)){var X={exec:function(){I.ignoreAll(J);}};r(t,'ignore_all',E.ignoreAll,'scayt_ignore_all',X,'scayt_control',2);v.scayt_ignore_all=2;}if(o('all',R)||o('add',R)){var Y={exec:function(){window.scayt.addWordToUserDictionary(J);}};r(t,'add_word',E.addWord,'scayt_add_word',Y,'scayt_control',3);
+v.scayt_add_word=2;}if(I.fireOnContextMenu)I.fireOnContextMenu(t);return v;});var F=function(){t.removeListener('showScaytState',F);if(!b.opera&&!b.air)w.setState(q.isScaytEnabled(t)?1:2);else w.setState(0);};t.on('showScaytState',F);if(b.opera||b.air)t.on('instanceReady',function(){F();});if(t.config.scayt_autoStartup)t.on('instanceReady',function(){q.loadEngine(t);});},afterInit:function(t){var u,v=function(w){if(w.hasAttribute('data-scaytid'))return false;};if(t._.elementsPath&&(u=t._.elementsPath.filters))u.push(v);t.addRemoveFormatFilter&&t.addRemoveFormatFilter(v);}});})();j.add('smiley',{requires:['dialog'],init:function(m){m.config.smiley_path=m.config.smiley_path||this.path+'images/';m.addCommand('smiley',new a.dialogCommand('smiley'));m.ui.addButton('Smiley',{label:m.lang.smiley.toolbar,command:'smiley'});a.dialog.add('smiley',this.path+'dialogs/smiley.js');}});i.smiley_images=['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif','embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif','devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'];i.smiley_descriptions=['smiley','sad','wink','laugh','frown','cheeky','blush','surprise','indecision','angry','angel','cool','devil','crying','enlightened','no','yes','heart','broken heart','kiss','mail'];(function(){var m='.%2 p,.%2 div,.%2 pre,.%2 address,.%2 blockquote,.%2 h1,.%2 h2,.%2 h3,.%2 h4,.%2 h5,.%2 h6{background-repeat: no-repeat;background-position: top %3;border: 1px dotted gray;padding-top: 8px;padding-%3: 8px;}.%2 p{%1p.png);}.%2 div{%1div.png);}.%2 pre{%1pre.png);}.%2 address{%1address.png);}.%2 blockquote{%1blockquote.png);}.%2 h1{%1h1.png);}.%2 h2{%1h2.png);}.%2 h3{%1h3.png);}.%2 h4{%1h4.png);}.%2 h5{%1h5.png);}.%2 h6{%1h6.png);}',n=/%1/g,o=/%2/g,p=/%3/g,q={preserveState:true,editorFocus:false,exec:function(r){this.toggleState();this.refresh(r);},refresh:function(r){var s=this.state==1?'addClass':'removeClass';r.document.getBody()[s]('cke_show_blocks');}};j.add('showblocks',{requires:['wysiwygarea'],init:function(r){var s=r.addCommand('showblocks',q);s.canUndo=false;if(r.config.startupOutlineBlocks)s.setState(1);r.addCss(m.replace(n,'background-image: url('+a.getUrl(this.path)+'images/block_').replace(o,'cke_show_blocks ').replace(p,r.lang.dir=='rtl'?'right':'left'));r.ui.addButton('ShowBlocks',{label:r.lang.showBlocks,command:'showblocks'});
+r.on('mode',function(){if(s.state!=0)s.refresh(r);});r.on('contentDom',function(){if(s.state!=0)s.refresh(r);});}});})();(function(){var m='cke_show_border',n,o=(b.ie6Compat?['.%1 table.%2,','.%1 table.%2 td, .%1 table.%2 th,','{','border : #d3d3d3 1px dotted','}']:['.%1 table.%2,','.%1 table.%2 > tr > td, .%1 table.%2 > tr > th,','.%1 table.%2 > tbody > tr > td, .%1 table.%2 > tbody > tr > th,','.%1 table.%2 > thead > tr > td, .%1 table.%2 > thead > tr > th,','.%1 table.%2 > tfoot > tr > td, .%1 table.%2 > tfoot > tr > th','{','border : #d3d3d3 1px dotted','}']).join('');n=o.replace(/%2/g,m).replace(/%1/g,'cke_show_borders ');var p={preserveState:true,editorFocus:false,exec:function(q){this.toggleState();this.refresh(q);},refresh:function(q){var r=this.state==1?'addClass':'removeClass';q.document.getBody()[r]('cke_show_borders');}};j.add('showborders',{requires:['wysiwygarea'],modes:{wysiwyg:1},init:function(q){var r=q.addCommand('showborders',p);r.canUndo=false;if(q.config.startupShowBorders!==false)r.setState(1);q.addCss(n);q.on('mode',function(){if(r.state!=0)r.refresh(q);},null,null,100);q.on('contentDom',function(){if(r.state!=0)r.refresh(q);});q.on('removeFormatCleanup',function(s){var t=s.data;if(q.getCommand('showborders').state==1&&t.is('table')&&(!t.hasAttribute('border')||parseInt(t.getAttribute('border'),10)<=0))t.addClass(m);});},afterInit:function(q){var r=q.dataProcessor,s=r&&r.dataFilter,t=r&&r.htmlFilter;if(s)s.addRules({elements:{table:function(u){var v=u.attributes,w=v['class'],x=parseInt(v.border,10);if(!x||x<=0)v['class']=(w||'')+' '+m;}}});if(t)t.addRules({elements:{table:function(u){var v=u.attributes,w=v['class'];w&&(v['class']=w.replace(m,'').replace(/\s{2}/,' ').replace(/^\s+|\s+$/,''));}}});}});a.on('dialogDefinition',function(q){var r=q.data.name;if(r=='table'||r=='tableProperties'){var s=q.data.definition,t=s.getContents('info'),u=t.get('txtBorder'),v=u.commit;u.commit=e.override(v,function(y){return function(z,A){y.apply(this,arguments);var B=parseInt(this.getValue(),10);A[!B||B<=0?'addClass':'removeClass'](m);};});var w=s.getContents('advanced'),x=w&&w.get('advCSSClasses');if(x){x.setup=e.override(x.setup,function(y){return function(){y.apply(this,arguments);this.setValue(this.getValue().replace(/cke_show_border/,''));};});x.commit=e.override(x.commit,function(y){return function(z,A){y.apply(this,arguments);if(!parseInt(A.getAttribute('border'),10))A.addClass('cke_show_border');};});}}});})();j.add('sourcearea',{requires:['editingblock'],init:function(m){var n=j.sourcearea,o=a.document.getWindow();
+m.on('editingBlockReady',function(){var p,q;m.addMode('source',{load:function(r,s){if(c&&b.version<8)r.setStyle('position','relative');m.textarea=p=new h('textarea');p.setAttributes({dir:'ltr',tabIndex:b.webkit?-1:m.tabIndex,role:'textbox','aria-label':m.lang.editorTitle.replace('%1',m.name)});p.addClass('cke_source');p.addClass('cke_enable_context_menu');var t={width:b.ie7Compat?'99%':'100%',height:'100%',resize:'none',outline:'none','text-align':'left'};if(c){q=function(){p.hide();p.setStyle('height',r.$.clientHeight+'px');p.setStyle('width',r.$.clientWidth+'px');p.show();};m.on('resize',q);o.on('resize',q);setTimeout(q,0);}r.setHtml('');r.append(p);p.setStyles(t);m.fire('ariaWidget',p);p.on('blur',function(){m.focusManager.blur();});p.on('focus',function(){m.focusManager.focus();});m.mayBeDirty=true;this.loadData(s);var u=m.keystrokeHandler;if(u)u.attach(p);setTimeout(function(){m.mode='source';m.fire('mode');},b.gecko||b.webkit?100:0);},loadData:function(r){p.setValue(r);m.fire('dataReady');},getData:function(){return p.getValue();},getSnapshotData:function(){return p.getValue();},unload:function(r){p.clearCustomData();m.textarea=p=null;if(q){m.removeListener('resize',q);o.removeListener('resize',q);}if(c&&b.version<8)r.removeStyle('position');},focus:function(){p.focus();}});});m.addCommand('source',n.commands.source);if(m.ui.addButton)m.ui.addButton('Source',{label:m.lang.source,command:'source'});m.on('mode',function(){m.getCommand('source').setState(m.mode=='source'?1:2);});}});j.sourcearea={commands:{source:{modes:{wysiwyg:1,source:1},editorFocus:false,exec:function(m){if(m.mode=='wysiwyg')m.fire('saveSnapshot');m.getCommand('source').setState(0);m.setMode(m.mode=='source'?'wysiwyg':'source');},canUndo:false}}};(function(){j.add('stylescombo',{requires:['richcombo','styles'],init:function(n){var o=n.config,p=n.lang.stylesCombo,q={},r=[];function s(t){n.getStylesSet(function(u){if(!r.length){var v,w;for(var x=0,y=u.length;x<y;x++){var z=u[x];w=z.name;v=q[w]=new a.style(z);v._name=w;v._.enterMode=o.enterMode;r.push(v);}r.sort(m);}t&&t();});};n.ui.addRichCombo('Styles',{label:p.label,title:p.panelTitle,className:'cke_styles',panel:{css:n.skin.editor.css.concat(o.contentsCss),multiSelect:true,attributes:{'aria-label':p.panelTitle}},init:function(){var t=this;s(function(){var u,v,w;for(var x=0,y=r.length;x<y;x++){u=r[x];v=u._name;var z=u.type;if(z!=w){t.startGroup(p['panelTitle'+String(z)]);w=z;}t.add(v,u.type==3?v:u.buildPreview(),v);}t.commit();t.onOpen();
+});},onClick:function(t){n.focus();n.fire('saveSnapshot');var u=q[t],v=n.getSelection(),w=new d.elementPath(v.getStartElement());u[u.checkActive(w)?'remove':'apply'](n.document);n.fire('saveSnapshot');},onRender:function(){n.on('selectionChange',function(t){var u=this.getValue(),v=t.data.path,w=v.elements;for(var x=0,y=w.length,z;x<y;x++){z=w[x];for(var A in q){if(q[A].checkElementRemovable(z,true)){if(A!=u)this.setValue(A);return;}}}this.setValue('');},this);},onOpen:function(){var A=this;if(c||b.webkit)n.focus();var t=n.getSelection(),u=t.getSelectedElement(),v=new d.elementPath(u||t.getStartElement()),w=[0,0,0,0];A.showAll();A.unmarkAll();for(var x in q){var y=q[x],z=y.type;if(y.checkActive(v))A.mark(x);else if(z==3&&!y.checkApplicable(v)){A.hideItem(x);w[z]--;}w[z]++;}if(!w[1])A.hideGroup(p['panelTitle'+String(1)]);if(!w[2])A.hideGroup(p['panelTitle'+String(2)]);if(!w[3])A.hideGroup(p['panelTitle'+String(3)]);}});n.on('instanceReady',function(){s();});}});function m(n,o){var p=n.type,q=o.type;return p==q?0:p==3?-1:q==3?1:q==1?1:-1;};})();j.add('table',{init:function(m){var n=j.table,o=m.lang.table;m.addCommand('table',new a.dialogCommand('table'));m.addCommand('tableProperties',new a.dialogCommand('tableProperties'));m.ui.addButton('Table',{label:o.toolbar,command:'table'});a.dialog.add('table',this.path+'dialogs/table.js');a.dialog.add('tableProperties',this.path+'dialogs/table.js');if(m.addMenuItems)m.addMenuItems({table:{label:o.menu,command:'tableProperties',group:'table',order:5},tabledelete:{label:o.deleteTable,command:'tableDelete',group:'table',order:1}});m.on('doubleclick',function(p){var q=p.data.element;if(q.is('table'))p.data.dialog='tableProperties';});if(m.contextMenu)m.contextMenu.addListener(function(p,q){if(!p||p.isReadOnly())return null;var r=p.hasAscendant('table',1);if(r)return{tabledelete:2,table:2};return null;});}});(function(){var m=/^(?:td|th)$/;function n(G){var H=G.createBookmarks(),I=G.getRanges(),J=[],K={};function L(T){if(J.length>0)return;if(T.type==1&&m.test(T.getName())&&!T.getCustomData('selected_cell')){h.setMarker(K,T,'selected_cell',true);J.push(T);}};for(var M=0;M<I.length;M++){var N=I[M];if(N.collapsed){var O=N.getCommonAncestor(),P=O.getAscendant('td',true)||O.getAscendant('th',true);if(P)J.push(P);}else{var Q=new d.walker(N),R;Q.guard=L;while(R=Q.next()){var S=R.getParent();if(S&&m.test(S.getName())&&!S.getCustomData('selected_cell')){h.setMarker(K,S,'selected_cell',true);J.push(S);}}}}h.clearAllMarkers(K);G.selectBookmarks(H);
+return J;};function o(G){var H=0,I=G.length-1,J={},K,L,M;while(K=G[H++])h.setMarker(J,K,'delete_cell',true);H=0;while(K=G[H++]){if((L=K.getPrevious())&&!L.getCustomData('delete_cell')||(L=K.getNext())&&!L.getCustomData('delete_cell')){h.clearAllMarkers(J);return L;}}h.clearAllMarkers(J);M=G[0].getParent();if(M=M.getPrevious())return M.getLast();M=G[I].getParent();if(M=M.getNext())return M.getChild(0);return null;};function p(G,H){var I=n(G),J=I[0],K=J.getAscendant('table'),L=J.getDocument(),M=I[0].getParent(),N=M.$.rowIndex,O=I[I.length-1],P=O.getParent().$.rowIndex+O.$.rowSpan-1,Q=new h(K.$.rows[P]),R=H?N:P,S=H?M:Q,T=e.buildTableMap(K),U=T[R],V=H?T[R-1]:T[R+1],W=T[0].length,X=L.createElement('tr');for(var Y=0;Y<W;Y++){var Z;if(U[Y].rowSpan>1&&V&&U[Y]==V[Y]){Z=U[Y];Z.rowSpan+=1;}else{Z=new h(U[Y]).clone();Z.removeAttribute('rowSpan');!c&&Z.appendBogus();X.append(Z);Z=Z.$;}Y+=Z.colSpan-1;}H?X.insertBefore(S):X.insertAfter(S);};function q(G){if(G instanceof d.selection){var H=n(G),I=H[0],J=I.getAscendant('table'),K=e.buildTableMap(J),L=H[0].getParent(),M=L.$.rowIndex,N=H[H.length-1],O=N.getParent().$.rowIndex+N.$.rowSpan-1,P=[];for(var Q=M;Q<=O;Q++){var R=K[Q],S=new h(J.$.rows[Q]);for(var T=0;T<R.length;T++){var U=new h(R[T]),V=U.getParent().$.rowIndex;if(U.$.rowSpan==1)U.remove();else{U.$.rowSpan-=1;if(V==Q){var W=K[Q+1];W[T-1]?U.insertAfter(new h(W[T-1])):new h(J.$.rows[Q+1]).append(U,1);}}T+=U.$.colSpan-1;}P.push(S);}var X=J.$.rows,Y=new h(X[M]||X[M-1]||J.$.parentNode);for(Q=P.length;Q>=0;Q--)q(P[Q]);return Y;}else if(G instanceof h){J=G.getAscendant('table');if(J.$.rows.length==1)J.remove();else G.remove();}return null;};function r(G,H){var I=G.getParent(),J=I.$.cells,K=0;for(var L=0;L<J.length;L++){var M=J[L];K+=H?1:M.colSpan;if(M==G.$)break;}return K-1;};function s(G,H){var I=H?Infinity:0;for(var J=0;J<G.length;J++){var K=r(G[J],H);if(H?K<I:K>I)I=K;}return I;};function t(G,H){var I=n(G),J=I[0],K=J.getAscendant('table'),L=s(I,1),M=s(I),N=H?L:M,O=e.buildTableMap(K),P=[],Q=[],R=O.length;for(var S=0;S<R;S++){P.push(O[S][N]);var T=H?O[S][N-1]:O[S][N+1];T&&Q.push(T);}for(S=0;S<R;S++){var U;if(P[S].colSpan>1&&Q.length&&Q[S]==P[S]){U=P[S];U.colSpan+=1;}else{U=new h(P[S]).clone();U.removeAttribute('colSpan');!c&&U.appendBogus();U[H?'insertBefore':'insertAfter'].call(U,new h(P[S]));U=U.$;}S+=U.rowSpan-1;}};function u(G){var H=n(G),I=H[0],J=H[H.length-1],K=I.getAscendant('table'),L=e.buildTableMap(K),M,N,O=[];for(var P=0,Q=L.length;P<Q;P++)for(var R=0,S=L[P].length;
+R<S;R++){if(L[P][R]==I.$)M=R;if(L[P][R]==J.$)N=R;}for(P=M;P<=N;P++)for(R=0;R<L.length;R++){var T=L[R],U=new h(K.$.rows[R]),V=new h(T[P]);if(V.$.colSpan==1)V.remove();else V.$.colSpan-=1;R+=V.$.rowSpan-1;if(!U.$.cells.length)O.push(U);}var W=K.$.rows[0]&&K.$.rows[0].cells,X=new h(W[M]||(M?W[M-1]:K.$.parentNode));if(O.length==Q)K.remove();return X;};function v(G){var H=[],I=G[0]&&G[0].getAscendant('table'),J,K,L,M;for(J=0,K=G.length;J<K;J++)H.push(G[J].$.cellIndex);H.sort();for(J=1,K=H.length;J<K;J++){if(H[J]-H[J-1]>1){L=H[J-1]+1;break;}}if(!L)L=H[0]>0?H[0]-1:H[H.length-1]+1;var N=I.$.rows;for(J=0,K=N.length;J<K;J++){M=N[J].cells[L];if(M)break;}return M?new h(M):I.getPrevious();};function w(G,H){var I=G.getStartElement(),J=I.getAscendant('td',1)||I.getAscendant('th',1);if(!J)return;var K=J.clone();if(!c)K.appendBogus();if(H)K.insertBefore(J);else K.insertAfter(J);};function x(G){if(G instanceof d.selection){var H=n(G),I=H[0]&&H[0].getAscendant('table'),J=o(H);for(var K=H.length-1;K>=0;K--)x(H[K]);if(J)z(J,true);else if(I)I.remove();}else if(G instanceof h){var L=G.getParent();if(L.getChildCount()==1)L.remove();else G.remove();}};function y(G){var H=G.getBogus();H&&H.remove();G.trim();};function z(G,H){var I=new d.range(G.getDocument());if(!I['moveToElementEdit'+(H?'End':'Start')](G)){I.selectNodeContents(G);I.collapse(H?false:true);}I.select(true);};function A(G,H,I){var J=G[H];if(typeof I=='undefined')return J;for(var K=0;J&&K<J.length;K++){if(I.is&&J[K]==I.$)return K;else if(K==I)return new h(J[K]);}return I.is?-1:null;};function B(G,H,I){var J=[];for(var K=0;K<G.length;K++){var L=G[K];if(typeof I=='undefined')J.push(L[H]);else if(I.is&&L[H]==I.$)return K;else if(K==I)return new h(L[H]);}return typeof I=='undefined'?J:I.is?-1:null;};function C(G,H,I){var J=n(G),K;if((H?J.length!=1:J.length<2)||(K=G.getCommonAncestor())&&K.type==1&&K.is('table'))return false;var L,M=J[0],N=M.getAscendant('table'),O=e.buildTableMap(N),P=O.length,Q=O[0].length,R=M.getParent().$.rowIndex,S=A(O,R,M);if(H){var T;try{var U=parseInt(M.getAttribute('rowspan'),10)||1,V=parseInt(M.getAttribute('colspan'),10)||1;T=O[H=='up'?R-U:H=='down'?R+U:R][H=='left'?S-V:H=='right'?S+V:S];}catch(an){return false;}if(!T||M.$==T)return false;J[H=='up'||H=='left'?'unshift':'push'](new h(T));}var W=M.getDocument(),X=R,Y=0,Z=0,aa=!I&&new d.documentFragment(W),ab=0;for(var ac=0;ac<J.length;ac++){L=J[ac];var ad=L.getParent(),ae=L.getFirst(),af=L.$.colSpan,ag=L.$.rowSpan,ah=ad.$.rowIndex,ai=A(O,ah,L);ab+=af*ag;
+Z=Math.max(Z,ai-S+af);Y=Math.max(Y,ah-R+ag);if(!I){if(y(L),L.getChildren().count()){if(ah!=X&&ae&&!(ae.isBlockBoundary&&ae.isBlockBoundary({br:1}))){var aj=aa.getLast(d.walker.whitespaces(true));if(aj&&!(aj.is&&aj.is('br')))aa.append('br');}L.moveChildren(aa);}ac?L.remove():L.setHtml('');}X=ah;}if(!I){aa.moveChildren(M);if(!c)M.appendBogus();if(Z>=Q)M.removeAttribute('rowSpan');else M.$.rowSpan=Y;if(Y>=P)M.removeAttribute('colSpan');else M.$.colSpan=Z;var ak=new d.nodeList(N.$.rows),al=ak.count();for(ac=al-1;ac>=0;ac--){var am=ak.getItem(ac);if(!am.$.cells.length){am.remove();al++;continue;}}return M;}else return Y*Z==ab;};function D(G,H){var I=n(G);if(I.length>1)return false;else if(H)return true;var J=I[0],K=J.getParent(),L=K.getAscendant('table'),M=e.buildTableMap(L),N=K.$.rowIndex,O=A(M,N,J),P=J.$.rowSpan,Q,R,S,T;if(P>1){R=Math.ceil(P/2);S=Math.floor(P/2);T=N+R;var U=new h(L.$.rows[T]),V=A(M,T),W;Q=J.clone();for(var X=0;X<V.length;X++){W=V[X];if(W.parentNode==U.$&&X>O){Q.insertBefore(new h(W));break;}else W=null;}if(!W)U.append(Q,true);}else{S=R=1;U=K.clone();U.insertAfter(K);U.append(Q=J.clone());var Y=A(M,N);for(var Z=0;Z<Y.length;Z++)Y[Z].rowSpan++;}if(!c)Q.appendBogus();J.$.rowSpan=R;Q.$.rowSpan=S;if(R==1)J.removeAttribute('rowSpan');if(S==1)Q.removeAttribute('rowSpan');return Q;};function E(G,H){var I=n(G);if(I.length>1)return false;else if(H)return true;var J=I[0],K=J.getParent(),L=K.getAscendant('table'),M=e.buildTableMap(L),N=K.$.rowIndex,O=A(M,N,J),P=J.$.colSpan,Q,R,S;if(P>1){R=Math.ceil(P/2);S=Math.floor(P/2);}else{S=R=1;var T=B(M,O);for(var U=0;U<T.length;U++)T[U].colSpan++;}Q=J.clone();Q.insertAfter(J);if(!c)Q.appendBogus();J.$.colSpan=R;Q.$.colSpan=S;if(R==1)J.removeAttribute('colSpan');if(S==1)Q.removeAttribute('colSpan');return Q;};var F={thead:1,tbody:1,tfoot:1,td:1,tr:1,th:1};j.tabletools={init:function(G){var H=G.lang.table;G.addCommand('cellProperties',new a.dialogCommand('cellProperties'));a.dialog.add('cellProperties',this.path+'dialogs/tableCell.js');G.addCommand('tableDelete',{exec:function(I){var J=I.getSelection(),K=J&&J.getStartElement(),L=K&&K.getAscendant('table',1);if(!L)return;J.selectElement(L);var M=J.getRanges()[0];M.collapse();J.selectRanges([M]);var N=L.getParent();if(N.getChildCount()==1&&!N.is('body','td','th'))N.remove();else L.remove();}});G.addCommand('rowDelete',{exec:function(I){var J=I.getSelection();z(q(J));}});G.addCommand('rowInsertBefore',{exec:function(I){var J=I.getSelection();p(J,true);}});G.addCommand('rowInsertAfter',{exec:function(I){var J=I.getSelection();
+p(J);}});G.addCommand('columnDelete',{exec:function(I){var J=I.getSelection(),K=u(J);K&&z(K,true);}});G.addCommand('columnInsertBefore',{exec:function(I){var J=I.getSelection();t(J,true);}});G.addCommand('columnInsertAfter',{exec:function(I){var J=I.getSelection();t(J);}});G.addCommand('cellDelete',{exec:function(I){var J=I.getSelection();x(J);}});G.addCommand('cellMerge',{exec:function(I){z(C(I.getSelection()),true);}});G.addCommand('cellMergeRight',{exec:function(I){z(C(I.getSelection(),'right'),true);}});G.addCommand('cellMergeDown',{exec:function(I){z(C(I.getSelection(),'down'),true);}});G.addCommand('cellVerticalSplit',{exec:function(I){z(D(I.getSelection()));}});G.addCommand('cellHorizontalSplit',{exec:function(I){z(E(I.getSelection()));}});G.addCommand('cellInsertBefore',{exec:function(I){var J=I.getSelection();w(J,true);}});G.addCommand('cellInsertAfter',{exec:function(I){var J=I.getSelection();w(J);}});if(G.addMenuItems)G.addMenuItems({tablecell:{label:H.cell.menu,group:'tablecell',order:1,getItems:function(){var I=G.getSelection(),J=n(I);return{tablecell_insertBefore:2,tablecell_insertAfter:2,tablecell_delete:2,tablecell_merge:C(I,null,true)?2:0,tablecell_merge_right:C(I,'right',true)?2:0,tablecell_merge_down:C(I,'down',true)?2:0,tablecell_split_vertical:D(I,true)?2:0,tablecell_split_horizontal:E(I,true)?2:0,tablecell_properties:J.length>0?2:0};}},tablecell_insertBefore:{label:H.cell.insertBefore,group:'tablecell',command:'cellInsertBefore',order:5},tablecell_insertAfter:{label:H.cell.insertAfter,group:'tablecell',command:'cellInsertAfter',order:10},tablecell_delete:{label:H.cell.deleteCell,group:'tablecell',command:'cellDelete',order:15},tablecell_merge:{label:H.cell.merge,group:'tablecell',command:'cellMerge',order:16},tablecell_merge_right:{label:H.cell.mergeRight,group:'tablecell',command:'cellMergeRight',order:17},tablecell_merge_down:{label:H.cell.mergeDown,group:'tablecell',command:'cellMergeDown',order:18},tablecell_split_horizontal:{label:H.cell.splitHorizontal,group:'tablecell',command:'cellHorizontalSplit',order:19},tablecell_split_vertical:{label:H.cell.splitVertical,group:'tablecell',command:'cellVerticalSplit',order:20},tablecell_properties:{label:H.cell.title,group:'tablecellproperties',command:'cellProperties',order:21},tablerow:{label:H.row.menu,group:'tablerow',order:1,getItems:function(){return{tablerow_insertBefore:2,tablerow_insertAfter:2,tablerow_delete:2};}},tablerow_insertBefore:{label:H.row.insertBefore,group:'tablerow',command:'rowInsertBefore',order:5},tablerow_insertAfter:{label:H.row.insertAfter,group:'tablerow',command:'rowInsertAfter',order:10},tablerow_delete:{label:H.row.deleteRow,group:'tablerow',command:'rowDelete',order:15},tablecolumn:{label:H.column.menu,group:'tablecolumn',order:1,getItems:function(){return{tablecolumn_insertBefore:2,tablecolumn_insertAfter:2,tablecolumn_delete:2};
+}},tablecolumn_insertBefore:{label:H.column.insertBefore,group:'tablecolumn',command:'columnInsertBefore',order:5},tablecolumn_insertAfter:{label:H.column.insertAfter,group:'tablecolumn',command:'columnInsertAfter',order:10},tablecolumn_delete:{label:H.column.deleteColumn,group:'tablecolumn',command:'columnDelete',order:15}});if(G.contextMenu)G.contextMenu.addListener(function(I,J){if(!I||I.isReadOnly())return null;while(I){if(I.getName() in F)return{tablecell:2,tablerow:2,tablecolumn:2};I=I.getParent();}return null;});},getSelectedCells:n};j.add('tabletools',j.tabletools);})();e.buildTableMap=function(m){var n=m.$.rows,o=-1,p=[];for(var q=0;q<n.length;q++){o++;!p[o]&&(p[o]=[]);var r=-1;for(var s=0;s<n[q].cells.length;s++){var t=n[q].cells[s];r++;while(p[o][r])r++;var u=isNaN(t.colSpan)?1:t.colSpan,v=isNaN(t.rowSpan)?1:t.rowSpan;for(var w=0;w<v;w++){if(!p[o+w])p[o+w]=[];for(var x=0;x<u;x++)p[o+w][r+x]=n[q].cells[s];}r+=u-1;}}return p;};j.add('specialchar',{availableLangs:{en:1},init:function(m){var n='specialchar',o=this;a.dialog.add(n,this.path+'dialogs/specialchar.js');m.addCommand(n,{exec:function(){var p=m.langCode;p=o.availableLangs[p]?p:'en';a.scriptLoader.load(a.getUrl(o.path+'lang/'+p+'.js'),function(){e.extend(m.lang.specialChar,o.lang[p]);m.openDialog(n);});},modes:{wysiwyg:1},canUndo:false});m.ui.addButton('SpecialChar',{label:m.lang.specialChar.toolbar,command:n});}});i.specialChars=['!','"','#','$','%','&',"'",'(',')','*','+','-','.','/','0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?','@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[',']','^','_','`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','{','|','}','~','€','‘','’','“','”','–','—','¡','¢','£','¤','¥','¦','§','¨','©','ª','«','¬','®','¯','°','&','&sup2;','&sup3;','´','µ','¶','·','¸','&sup1;','º','&','&frac14;','&frac12;','&frac34;','¿','À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','×','Ø','Ù','Ú','Û','Ü','Ý','Þ','ß','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö','÷','ø','ù','ú','û','ü','ü','ý','þ','ÿ','Œ','œ','Ŵ','&#374','&#373','ŷ','‚','‛','„','…','™','►','•','→','⇒','⇔','♦','≈'];
+(function(){var m={editorFocus:false,modes:{wysiwyg:1,source:1}},n={exec:function(q){q.container.focusNext(true,q.tabIndex);}},o={exec:function(q){q.container.focusPrevious(true,q.tabIndex);}};function p(q){return{editorFocus:false,canUndo:false,modes:{wysiwyg:1},exec:function(r){if(r.focusManager.hasFocus){var s=r.getSelection(),t=s.getCommonAncestor(),u;if(u=t.getAscendant('td',true)||t.getAscendant('th',true)){var v=new d.range(r.document),w=e.tryThese(function(){var D=u.getParent(),E=D.$.cells[u.$.cellIndex+(q?-1:1)];E.parentNode.parentNode;return E;},function(){var D=u.getParent(),E=D.getAscendant('table'),F=E.$.rows[D.$.rowIndex+(q?-1:1)];return F.cells[q?F.cells.length-1:0];});if(!(w||q)){var x=u.getAscendant('table').$,y=u.getParent().$.cells,z=new h(x.insertRow(-1),r.document);for(var A=0,B=y.length;A<B;A++){var C=z.append(new h(y[A],r.document).clone(false,false));!c&&C.appendBogus();}v.moveToElementEditStart(z);}else if(w){w=new h(w);v.moveToElementEditStart(w);if(!(v.checkStartOfBlock()&&v.checkEndOfBlock()))v.selectNodeContents(w);}else return true;v.select(true);return true;}}return false;}};};j.add('tab',{requires:['keystrokes'],init:function(q){var r=q.config.enableTabKeyTools!==false,s=q.config.tabSpaces||0,t='';while(s--)t+='\xa0';if(t)q.on('key',function(u){if(u.data.keyCode==9){q.insertHtml(t);u.cancel();}});if(r)q.on('key',function(u){if(u.data.keyCode==9&&q.execCommand('selectNextCell')||u.data.keyCode==2000+9&&q.execCommand('selectPreviousCell'))u.cancel();});if(b.webkit||b.gecko)q.on('key',function(u){var v=u.data.keyCode;if(v==9&&!t){u.cancel();q.execCommand('blur');}if(v==2000+9){q.execCommand('blurBack');u.cancel();}});q.addCommand('blur',e.extend(n,m));q.addCommand('blurBack',e.extend(o,m));q.addCommand('selectNextCell',p());q.addCommand('selectPreviousCell',p(true));}});})();h.prototype.focusNext=function(m,n){var w=this;var o=w.$,p=n===undefined?w.getTabIndex():n,q,r,s,t,u,v;if(p<=0){u=w.getNextSourceNode(m,1);while(u){if(u.isVisible()&&u.getTabIndex()===0){s=u;break;}u=u.getNextSourceNode(false,1);}}else{u=w.getDocument().getBody().getFirst();while(u=u.getNextSourceNode(false,1)){if(!q)if(!r&&u.equals(w)){r=true;if(m){if(!(u=u.getNextSourceNode(true,1)))break;q=1;}}else if(r&&!w.contains(u))q=1;if(!u.isVisible()||(v=u.getTabIndex())<0)continue;if(q&&v==p){s=u;break;}if(v>p&&(!s||!t||v<t)){s=u;t=v;}else if(!s&&v===0){s=u;t=v;}}}if(s)s.focus();};h.prototype.focusPrevious=function(m,n){var w=this;var o=w.$,p=n===undefined?w.getTabIndex():n,q,r,s,t=0,u,v=w.getDocument().getBody().getLast();
+while(v=v.getPreviousSourceNode(false,1)){if(!q)if(!r&&v.equals(w)){r=true;if(m){if(!(v=v.getPreviousSourceNode(true,1)))break;q=1;}}else if(r&&!w.contains(v))q=1;if(!v.isVisible()||(u=v.getTabIndex())<0)continue;if(p<=0){if(q&&u===0){s=v;break;}if(u>t){s=v;t=u;}}else{if(q&&u==p){s=v;break;}if(u<p&&(!s||u>t)){s=v;t=u;}}}if(s)s.focus();};(function(){j.add('templates',{requires:['dialog'],init:function(o){a.dialog.add('templates',a.getUrl(this.path+'dialogs/templates.js'));o.addCommand('templates',new a.dialogCommand('templates'));o.ui.addButton('Templates',{label:o.lang.templates.button,command:'templates'});}});var m={},n={};a.addTemplates=function(o,p){m[o]=p;};a.getTemplates=function(o){return m[o];};a.loadTemplates=function(o,p){var q=[];for(var r=0,s=o.length;r<s;r++){if(!n[o[r]]){q.push(o[r]);n[o[r]]=1;}}if(q.length)a.scriptLoader.load(q,p);else setTimeout(p,0);};})();i.templates_files=[a.getUrl('plugins/templates/templates/default.js')];i.templates_replaceContent=true;(function(){var m=function(){this.toolbars=[];this.focusCommandExecuted=false;};m.prototype.focus=function(){for(var o=0,p;p=this.toolbars[o++];)for(var q=0,r;r=p.items[q++];){if(r.focus){r.focus();return;}}};var n={toolbarFocus:{modes:{wysiwyg:1,source:1},exec:function(o){if(o.toolbox){o.toolbox.focusCommandExecuted=true;if(c||b.air)setTimeout(function(){o.toolbox.focus();},100);else o.toolbox.focus();}}}};j.add('toolbar',{init:function(o){var p=function(q,r){var s,t,u,v=o.lang.dir=='rtl';switch(r){case v?37:39:case 9:do{s=q.next;if(!s){t=q.toolbar.next;u=t&&t.items.length;while(u===0){t=t.next;u=t&&t.items.length;}if(t)s=t.items[0];}q=s;}while(q&&!q.focus);if(q)q.focus();else o.toolbox.focus();return false;case v?39:37:case 2000+9:do{s=q.previous;if(!s){t=q.toolbar.previous;u=t&&t.items.length;while(u===0){t=t.previous;u=t&&t.items.length;}if(t)s=t.items[u-1];}q=s;}while(q&&!q.focus);if(q)q.focus();else{var w=o.toolbox.toolbars[o.toolbox.toolbars.length-1].items;w[w.length-1].focus();}return false;case 27:o.focus();return false;case 13:case 32:q.execute();return false;}return true;};o.on('themeSpace',function(q){if(q.data.space==o.config.toolbarLocation){o.toolbox=new m();var r=e.getNextId(),s=['<div class="cke_toolbox" role="toolbar" aria-labelledby="',r,'" onmousedown="return false;"'],t=o.config.toolbarStartupExpanded!==false,u;s.push(t?'>':' style="display:none">');s.push('<span id="',r,'" class="cke_voice_label">',o.lang.toolbar,'</span>');var v=o.toolbox.toolbars,w=o.config.toolbar instanceof Array?o.config.toolbar:o.config['toolbar_'+o.config.toolbar];
+for(var x=0;x<w.length;x++){var y=w[x];if(!y)continue;var z=e.getNextId(),A={id:z,items:[]};if(u){s.push('</div>');u=0;}if(y==='/'){s.push('<div class="cke_break"></div>');continue;}s.push('<span id="',z,'" class="cke_toolbar" role="presentation"><span class="cke_toolbar_start"></span>');var B=v.push(A)-1;if(B>0){A.previous=v[B-1];A.previous.next=A;}for(var C=0;C<y.length;C++){var D,E=y[C];if(E=='-')D=k.separator;else D=o.ui.create(E);if(D){if(D.canGroup){if(!u){s.push('<span class="cke_toolgroup" role="presentation">');u=1;}}else if(u){s.push('</span>');u=0;}var F=D.render(o,s);B=A.items.push(F)-1;if(B>0){F.previous=A.items[B-1];F.previous.next=F;}F.toolbar=A;F.onkey=p;F.onfocus=function(){if(!o.toolbox.focusCommandExecuted)o.focus();};}}if(u){s.push('</span>');u=0;}s.push('<span class="cke_toolbar_end"></span></span>');}s.push('</div>');if(o.config.toolbarCanCollapse){var G=e.addFunction(function(){o.execCommand('toolbarCollapse');});o.on('destroy',function(){e.removeFunction(G);});var H=e.getNextId();o.addCommand('toolbarCollapse',{exec:function(I){var J=a.document.getById(H),K=J.getPrevious(),L=I.getThemeSpace('contents'),M=K.getParent(),N=parseInt(L.$.style.height,10),O=M.$.offsetHeight,P=!K.isVisible();if(!P){K.hide();J.addClass('cke_toolbox_collapser_min');J.setAttribute('title',I.lang.toolbarExpand);}else{K.show();J.removeClass('cke_toolbox_collapser_min');J.setAttribute('title',I.lang.toolbarCollapse);}J.getFirst().setText(P?'â–²':'â—€');var Q=M.$.offsetHeight-O;L.setStyle('height',N-Q+'px');I.fire('resize');},modes:{wysiwyg:1,source:1}});s.push('<a title="'+(t?o.lang.toolbarCollapse:o.lang.toolbarExpand)+'" id="'+H+'" tabIndex="-1" class="cke_toolbox_collapser');if(!t)s.push(' cke_toolbox_collapser_min');s.push('" onclick="CKEDITOR.tools.callFunction('+G+')">','<span>▲</span>','</a>');}q.data.html+=s.join('');}});o.on('destroy',function(){var q,r=0,s,t,u;q=this.toolbox.toolbars;for(;r<q.length;r++){t=q[r].items;for(s=0;s<t.length;s++){u=t[s];if(u.clickFn)e.removeFunction(u.clickFn);if(u.keyDownFn)e.removeFunction(u.keyDownFn);if(u.index)k.button._.instances[u.index]=null;}}});o.addCommand('toolbarFocus',n.toolbarFocus);}});})();k.separator={render:function(m,n){n.push('<span class="cke_separator" role="separator"></span>');return{};}};i.toolbarLocation='top';i.toolbar_Basic=[['Bold','Italic','-','NumberedList','BulletedList','-','Link','Unlink','-','About']];i.toolbar_Full=[['Source','-','Save','NewPage','Preview','-','Templates'],['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print','SpellChecker','Scayt'],['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],'/',['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],['BidiLtr','BidiRtl'],['Link','Unlink','Anchor'],['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],'/',['Styles','Format','Font','FontSize'],['TextColor','BGColor'],['Maximize','ShowBlocks','-','About']];
+i.toolbar='Full';i.toolbarCanCollapse=true;(function(){j.add('undo',{requires:['selection','wysiwygarea'],init:function(s){var t=new o(s),u=s.addCommand('undo',{exec:function(){if(t.undo()){s.selectionChange();this.fire('afterUndo');}},state:0,canUndo:false}),v=s.addCommand('redo',{exec:function(){if(t.redo()){s.selectionChange();this.fire('afterRedo');}},state:0,canUndo:false});t.onChange=function(){u.setState(t.undoable()?2:0);v.setState(t.redoable()?2:0);};function w(x){if(t.enabled&&x.data.command.canUndo!==false)t.save();};s.on('beforeCommandExec',w);s.on('afterCommandExec',w);s.on('saveSnapshot',function(){t.save();});s.on('contentDom',function(){s.document.on('keydown',function(x){if(!x.data.$.ctrlKey&&!x.data.$.metaKey)t.type(x);});});s.on('beforeModeUnload',function(){s.mode=='wysiwyg'&&t.save(true);});s.on('mode',function(){t.enabled=s.mode=='wysiwyg';t.onChange();});s.ui.addButton('Undo',{label:s.lang.undo,command:'undo'});s.ui.addButton('Redo',{label:s.lang.redo,command:'redo'});s.resetUndo=function(){t.reset();s.fire('saveSnapshot');};s.on('updateSnapshot',function(){if(t.currentImage&&new m(s).equals(t.currentImage))setTimeout(function(){t.update();},0);});}});j.undo={};var m=j.undo.Image=function(s){this.editor=s;var t=s.getSnapshot(),u=t&&s.getSelection();c&&t&&(t=t.replace(/\s+data-cke-expando=".*?"/g,''));this.contents=t;this.bookmarks=u&&u.createBookmarks2(true);},n=/\b(?:href|src|name)="[^"]*?"/gi;m.prototype={equals:function(s,t){var u=this.contents,v=s.contents;if(c&&(b.ie7Compat||b.ie6Compat)){u=u.replace(n,'');v=v.replace(n,'');}if(u!=v)return false;if(t)return true;var w=this.bookmarks,x=s.bookmarks;if(w||x){if(!w||!x||w.length!=x.length)return false;for(var y=0;y<w.length;y++){var z=w[y],A=x[y];if(z.startOffset!=A.startOffset||z.endOffset!=A.endOffset||!e.arrayCompare(z.start,A.start)||!e.arrayCompare(z.end,A.end))return false;}}return true;}};function o(s){this.editor=s;this.reset();};var p={8:1,46:1},q={16:1,17:1,18:1},r={37:1,38:1,39:1,40:1};o.prototype={type:function(s){var t=s&&s.data.getKey(),u=t in q,v=t in p,w=this.lastKeystroke in p,x=v&&t==this.lastKeystroke,y=t in r,z=this.lastKeystroke in r,A=!v&&!y,B=v&&!x,C=!(u||this.typing)||A&&(w||z);if(C||B){var D=new m(this.editor);e.setTimeout(function(){var F=this;var E=F.editor.getSnapshot();if(c)E=E.replace(/\s+data-cke-expando=".*?"/g,'');if(D.contents!=E){F.typing=true;if(!F.save(false,D,false))F.snapshots.splice(F.index+1,F.snapshots.length-F.index-1);F.hasUndo=true;F.hasRedo=false;
+F.typesCount=1;F.modifiersCount=1;F.onChange();}},0,this);}this.lastKeystroke=t;if(v){this.typesCount=0;this.modifiersCount++;if(this.modifiersCount>25){this.save(false,null,false);this.modifiersCount=1;}}else if(!y){this.modifiersCount=0;this.typesCount++;if(this.typesCount>25){this.save(false,null,false);this.typesCount=1;}}},reset:function(){var s=this;s.lastKeystroke=0;s.snapshots=[];s.index=-1;s.limit=s.editor.config.undoStackSize||20;s.currentImage=null;s.hasUndo=false;s.hasRedo=false;s.resetType();},resetType:function(){var s=this;s.typing=false;delete s.lastKeystroke;s.typesCount=0;s.modifiersCount=0;},fireChange:function(){var s=this;s.hasUndo=!!s.getNextImage(true);s.hasRedo=!!s.getNextImage(false);s.resetType();s.onChange();},save:function(s,t,u){var w=this;var v=w.snapshots;if(!t)t=new m(w.editor);if(t.contents===false)return false;if(w.currentImage&&t.equals(w.currentImage,s))return false;v.splice(w.index+1,v.length-w.index-1);if(v.length==w.limit)v.shift();w.index=v.push(t)-1;w.currentImage=t;if(u!==false)w.fireChange();return true;},restoreImage:function(s){var u=this;u.editor.loadSnapshot(s.contents);if(s.bookmarks)u.editor.getSelection().selectBookmarks(s.bookmarks);else if(c){var t=u.editor.document.getBody().$.createTextRange();t.collapse(true);t.select();}u.index=s.index;u.update();u.fireChange();},getNextImage:function(s){var x=this;var t=x.snapshots,u=x.currentImage,v,w;if(u)if(s)for(w=x.index-1;w>=0;w--){v=t[w];if(!u.equals(v,true)){v.index=w;return v;}}else for(w=x.index+1;w<t.length;w++){v=t[w];if(!u.equals(v,true)){v.index=w;return v;}}return null;},redoable:function(){return this.enabled&&this.hasRedo;},undoable:function(){return this.enabled&&this.hasUndo;},undo:function(){var t=this;if(t.undoable()){t.save(true);var s=t.getNextImage(true);if(s)return t.restoreImage(s),true;}return false;},redo:function(){var t=this;if(t.redoable()){t.save(true);if(t.redoable()){var s=t.getNextImage(false);if(s)return t.restoreImage(s),true;}}return false;},update:function(){var s=this;s.snapshots.splice(s.index,1,s.currentImage=new m(s.editor));}};})();(function(){var m={table:1,pre:1},n=/(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center)[^>]*>\s*(?:<br[^>]*>| |\u00A0| )?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi,o=d.walker.whitespaces(true);function p(D){return D.getName() in m||D.isBlockBoundary()&&f.$empty[D.getName()];};function q(D){return function(E){if(this.mode=='wysiwyg'){this.focus();this.fire('saveSnapshot');D.call(this,E.data);e.setTimeout(function(){this.fire('saveSnapshot');
+},0,this);}};};function r(D){var J=this;if(J.dataProcessor)D=J.dataProcessor.toHtml(D);var E=J.getSelection(),F=E.getRanges()[0];if(F.checkReadOnly())return;if(c){var G=E.isLocked;if(G)E.unlock();var H=E.getNative();if(H.type=='Control')H.clear();else if(E.getType()==2){F=E.getRanges()[0];var I=F&&F.endContainer;if(I&&I.type==1&&I.getAttribute('contenteditable')=='false'&&F.checkBoundaryOfElement(I,2)){F.setEndAfter(F.endContainer);F.deleteContents();}}try{H.createRange().pasteHTML(D);}catch(K){}if(G)J.getSelection().lock();}else J.document.$.execCommand('inserthtml',false,D);if(b.webkit){E=J.getSelection();E.scrollIntoView();}};function s(D){var E=this.getSelection(),F=E.getStartElement().hasAscendant('pre',true)?2:this.config.enterMode,G=F==2,H=e.htmlEncode(D.replace(/\r\n|\r/g,'\n'));H=H.replace(/^[ \t]+|[ \t]+$/g,function(N,O,P){if(N.length==1)return ' ';else if(!O)return e.repeat(' ',N.length-1)+' ';else return ' '+e.repeat(' ',N.length-1);});H=H.replace(/[ \t]{2,}/g,function(N){return e.repeat(' ',N.length-1)+' ';});var I=F==1?'p':'div';if(!G)H=H.replace(/(\n{2})([\s\S]*?)(?:$|\1)/g,function(N,O,P){return '<'+I+'>'+P+'</'+I+'>';});H=H.replace(/\n/g,'<br>');if(!(G||c))H=H.replace(new RegExp('<br>(?=</'+I+'>)'),function(N){return e.repeat(N,2);});if(b.gecko||b.webkit){var J=new d.elementPath(E.getStartElement()),K=[];for(var L=0;L<J.elements.length;L++){var M=J.elements[L].getName();if(M in f.$inline)K.unshift(J.elements[L].getOuterHtml().match(/^<.*?>/));else if(M in f.$block)break;}H=K.join('')+H;}r.call(this,H);};function t(D){var E=this.getSelection(),F=E.getRanges(),G=D.getName(),H=f.$block[G],I=E.isLocked;if(I)E.unlock();var J,K,L,M;for(var N=F.length-1;N>=0;N--){J=F[N];if(!J.checkReadOnly()){J.deleteContents(1);K=!N&&D||D.clone(1);var O,P;if(H)while((O=J.getCommonAncestor(0,1))&&(P=f[O.getName()])&&!(P&&P[G])){if(O.getName() in f.span)J.splitElement(O);else if(J.checkStartOfBlock()&&J.checkEndOfBlock()){J.setStartBefore(O);J.collapse(true);O.remove();}else J.splitBlock();}J.insertNode(K);if(!L)L=K;}}if(L){J.moveToPosition(L,4);if(H){var Q=L.getNext(o),R=Q&&Q.type==1&&Q.getName();if(R&&f.$block[R]&&f[R]['#'])J.moveToElementEditStart(Q);}}E.selectRanges([J]);if(I)this.getSelection().lock();};function u(D){if(!D.checkDirty())setTimeout(function(){D.resetDirty();},0);};var v=d.walker.whitespaces(true),w=d.walker.bookmark(false,true);function x(D){return v(D)&&w(D);};function y(D){return D.type==3&&e.trim(D.getText()).match(/^(?: |\xa0)$/);
+};function z(D){if(D.isLocked){D.unlock();setTimeout(function(){D.lock();},0);}};function A(D){return D.getOuterHtml().match(n);};v=d.walker.whitespaces(true);function B(D){var E=D.window,F=D.document,G=D.document.getBody(),H=G.getChildren().count();if(!H||H==1&&G.getFirst().hasAttribute('_moz_editor_bogus_node')){u(D);var I=D.element.getDocument(),J=I.getDocumentElement(),K=J.$.scrollTop,L=J.$.scrollLeft,M=F.$.createEvent('KeyEvents');M.initKeyEvent('keypress',true,true,E.$,false,false,false,false,0,32);F.$.dispatchEvent(M);if(K!=J.$.scrollTop||L!=J.$.scrollLeft)I.getWindow().$.scrollTo(L,K);H&&G.getFirst().remove();F.getBody().appendBogus();var N=new d.range(F);N.setStartAt(G,1);N.select();}};function C(D){var E=D.editor,F=D.data.path,G=F.blockLimit,H=D.data.selection,I=H.getRanges()[0],J=E.document.getBody(),K=E.config.enterMode;if(b.gecko){B(E);var L=F.block||F.blockLimit;if(L&&!L.getBogus()){E.fire('updateSnapshot');u(E);L.appendBogus();}}if(K!=2&&I.collapsed&&G.getName()=='body'&&!F.block){E.fire('updateSnapshot');u(E);c&&z(H);var M=I.fixBlock(true,E.config.enterMode==3?'div':'p');if(c){var N=M.getFirst(x);N&&y(N)&&N.remove();}if(A(M)){var O=M.getNext(v);if(O&&O.type==1&&!p(O)){I.moveToElementEditStart(O);M.remove();}else{O=M.getPrevious(v);if(O&&O.type==1&&!p(O)){I.moveToElementEditEnd(O);M.remove();}}}I.select();if(!c){E.forceNextSelectionCheck();E.selectionChange();}}var P=new d.range(E.document),Q=new d.walker(P);P.selectNodeContents(J);Q.evaluator=function(S){return S.type==1&&S.getName() in m;};Q.guard=function(S,T){return!(S.type==3&&v(S)||T);};if(Q.previous()){E.fire('updateSnapshot');u(E);c&&z(H);var R;if(K!=2)R=J.append(new h(K==1?'p':'div'));else R=J;if(!c)R.appendBogus();}};j.add('wysiwygarea',{requires:['editingblock'],init:function(D){var E=D.config.enterMode!=2?D.config.enterMode==3?'div':'p':false,F=D.lang.editorTitle.replace('%1',D.name),G;D.on('editingBlockReady',function(){var M,N,O,P,Q,R,S=b.isCustomDomain(),T=function(W){if(N)N.remove();var X='document.open();'+(S?'document.domain="'+document.domain+'";':'')+'document.close();';X=b.air?'javascript:void(0)':c?'javascript:void(function(){'+encodeURIComponent(X)+'}())':'';N=h.createFromHtml('<iframe style="width:100%;height:100%" frameBorder="0" title="'+F+'"'+' src="'+X+'"'+' tabIndex="'+(b.webkit?-1:D.tabIndex)+'"'+' allowTransparency="true"'+'></iframe>');if(document.location.protocol=='chrome:')a.event.useCapture=true;N.on('load',function(ab){Q=1;ab.removeListener();var ac=N.getFrameDocument();
+ac.write(W);b.air&&V(ac.getWindow().$);});if(document.location.protocol=='chrome:')a.event.useCapture=false;var Y=D.element,Z=b.gecko&&!Y.isVisible(),aa={};if(Z){Y.show();aa={position:Y.getStyle('position'),top:Y.getStyle('top')};Y.setStyles({position:'absolute',top:'-3000px'});}M.append(N);if(Z)setTimeout(function(){Y.hide();Y.setStyles(aa);},1000);};G=e.addFunction(V);var U='<script id="cke_actscrpt" type="text/javascript" data-cke-temp="1">'+(S?'document.domain="'+document.domain+'";':'')+'window.parent.CKEDITOR.tools.callFunction( '+G+', window );'+'</script>';function V(W){if(!Q)return;Q=0;D.fire('ariaWidget',N);var X=W.document,Y=X.body,Z=X.getElementById('cke_actscrpt');Z&&Z.parentNode.removeChild(Z);Y.spellcheck=!D.config.disableNativeSpellChecker;if(c){Y.hideFocus=true;Y.disabled=true;Y.contentEditable=true;Y.removeAttribute('disabled');}else setTimeout(function(){if(b.gecko&&b.version>=10900||b.opera)X.$.body.contentEditable=true;else if(b.webkit)X.$.body.parentNode.contentEditable=true;else X.$.designMode='on';},0);b.gecko&&e.setTimeout(B,0,null,D);W=D.window=new d.window(W);X=D.document=new g(X);X.on('dblclick',function(af){var ag=af.data.getTarget(),ah={element:ag,dialog:''};D.fire('doubleclick',ah);ah.dialog&&D.openDialog(ah.dialog);});c&&X.on('click',function(af){var ag=af.data.getTarget();if(ag.is('input')){var ah=ag.getAttribute('type');if(ah=='submit'||ah=='reset')af.data.preventDefault();}});if(!(c||b.opera))X.on('mousedown',function(af){var ag=af.data.getTarget();if(ag.is('img','hr','input','textarea','select'))D.getSelection().selectElement(ag);});if(b.gecko)X.on('mouseup',function(af){if(af.data.$.button==2){var ag=af.data.getTarget();if(!ag.getOuterHtml().replace(n,'')){var ah=new d.range(X);ah.moveToElementEditStart(ag);ah.select(true);}}});X.on('click',function(af){af=af.data;if(af.getTarget().is('a')&&af.$.button!=2)af.preventDefault();});if(b.webkit){X.on('click',function(af){if(af.data.getTarget().is('input','select'))af.data.preventDefault();});X.on('mouseup',function(af){if(af.data.getTarget().is('input','textarea'))af.data.preventDefault();});}if(c&&X.$.compatMode=='CSS1Compat'||b.gecko||b.opera){var aa=X.getDocumentElement();aa.on('mousedown',function(af){if(af.data.getTarget().equals(aa)){if(b.gecko&&b.version>=10900)K();L.focus();}});}var ab=c?N:W;ab.on('blur',function(){D.focusManager.blur();});var ac;ab.on('focus',function(){var af=D.document;if(b.gecko&&b.version>=10900)K();else if(b.opera)af.getBody().focus();else if(b.webkit)if(!ac){D.document.getDocumentElement().focus();
+ac=1;}D.focusManager.focus();});var ad=D.keystrokeHandler;if(ad)ad.attach(X);if(c){X.getDocumentElement().addClass(X.$.compatMode);X.on('keydown',function(af){var ag=af.data.getKeystroke();if(ag in {8:1,46:1}){var ah=D.getSelection(),ai=ah.getSelectedElement();if(ai){D.fire('saveSnapshot');var aj=ah.getRanges()[0].createBookmark();ai.remove();ah.selectBookmarks([aj]);D.fire('saveSnapshot');af.data.preventDefault();}}});if(X.$.compatMode=='CSS1Compat'){var ae={33:1,34:1};X.on('keydown',function(af){if(af.data.getKeystroke() in ae)setTimeout(function(){D.getSelection().scrollIntoView();},0);});}}if(D.contextMenu)D.contextMenu.addTarget(X,D.config.browserContextMenuOnCtrl!==false);setTimeout(function(){D.fire('contentDom');if(R){D.mode='wysiwyg';D.fire('mode');R=false;}O=false;if(P){D.focus();P=false;}setTimeout(function(){D.fire('dataReady');},0);try{D.document.$.execCommand('enableInlineTableEditing',false,!D.config.disableNativeTableHandles);}catch(af){}if(D.config.disableObjectResizing)try{D.document.$.execCommand('enableObjectResizing',false,false);}catch(ag){D.document.getBody().on(c?'resizestart':'resize',function(ah){ah.data.preventDefault();});}if(c)setTimeout(function(){if(D.document){var ah=D.document.$.body;ah.runtimeStyle.marginBottom='0px';ah.runtimeStyle.marginBottom='';}},1000);},0);};D.addMode('wysiwyg',{load:function(W,X,Y){M=W;if(c&&b.quirks)W.setStyle('position','relative');D.mayBeDirty=true;R=true;if(Y)this.loadSnapshotData(X);else this.loadData(X);},loadData:function(W){O=true;var X=D.config,Y=X.fullPage,Z=X.docType,aa='<style type="text/css" data-cke-temp="1">'+D._.styles.join('\n')+'</style>';!Y&&(aa=e.buildStyleHtml(D.config.contentsCss)+aa);var ab=X.baseHref?'<base href="'+X.baseHref+'" data-cke-temp="1" />':'';if(Y)W=W.replace(/<!DOCTYPE[^>]*>/i,function(ac){D.docType=Z=ac;return '';});if(D.dataProcessor)W=D.dataProcessor.toHtml(W,E);if(Y){if(!/<body[\s|>]/.test(W))W='<body>'+W;if(!/<html[\s|>]/.test(W))W='<html>'+W+'</html>';if(!/<head[\s|>]/.test(W))W=W.replace(/<html[^>]*>/,'$&<head><title></title></head>');else if(!/<title[\s|>]/.test(W))W=W.replace(/<head[^>]*>/,'$&<title></title>');ab&&(W=W.replace(/<head>/,'$&'+ab));W=W.replace(/<\/head\s*>/,aa+'$&');W=Z+W;}else W=X.docType+'<html dir="'+X.contentsLangDirection+'"'+' lang="'+(X.contentsLanguage||D.langCode)+'">'+'<head>'+'<title>'+F+'</title>'+ab+aa+'</head>'+'<body'+(X.bodyId?' id="'+X.bodyId+'"':'')+(X.bodyClass?' class="'+X.bodyClass+'"':'')+'>'+W+'</html>';W+=U;this.onDispose();
+T(W);},getData:function(){var W=D.config,X=W.fullPage,Y=X&&D.docType,Z=N.getFrameDocument(),aa=X?Z.getDocumentElement().getOuterHtml():Z.getBody().getHtml();if(D.dataProcessor)aa=D.dataProcessor.toDataFormat(aa,E);if(W.ignoreEmptyParagraph)aa=aa.replace(n,function(ab,ac){return ac;});if(Y)aa=Y+'\n'+aa;return aa;},getSnapshotData:function(){return N.getFrameDocument().getBody().getHtml();},loadSnapshotData:function(W){N.getFrameDocument().getBody().setHtml(W);},onDispose:function(){if(!D.document)return;D.document.getDocumentElement().clearCustomData();D.document.getBody().clearCustomData();D.window.clearCustomData();D.document.clearCustomData();N.clearCustomData();N.remove();},unload:function(W){this.onDispose();D.window=D.document=N=M=P=null;D.fire('contentDomUnload');},focus:function(){var W=D.window;if(O)P=true;else if(b.opera&&D.document){var X=D.window.$.frameElement;X.blur(),X.focus();D.document.getBody().focus();D.selectionChange();}else if(!b.opera&&W){b.air?setTimeout(function(){W.focus();},0):W.focus();D.selectionChange();}}});D.on('insertHtml',q(r),null,null,20);D.on('insertElement',q(t),null,null,20);D.on('insertText',q(s),null,null,20);D.on('selectionChange',C,null,null,1);});var H;D.on('contentDom',function(){var M=D.document.getElementsByTag('title').getItem(0);M.data('cke-title',D.document.$.title);D.document.$.title=F;});if(a.document.$.documentMode>=8){D.addCss('html.CSS1Compat [contenteditable=false]{ min-height:0 !important;}');var I=[];for(var J in f.$removeEmpty)I.push('html.CSS1Compat '+J+'[contenteditable=false]');D.addCss(I.join(',')+'{ display:inline-block;}');}else if(b.gecko)D.addCss('html { height: 100% !important; }');function K(M){e.tryThese(function(){D.document.$.designMode='on';setTimeout(function(){D.document.$.designMode='off';if(a.currentInstance==D)D.document.getBody().focus();},50);},function(){D.document.$.designMode='off';var N=D.document.getBody();N.setAttribute('contentEditable',false);N.setAttribute('contentEditable',true);!M&&K(1);});};if(b.gecko||c||b.opera){var L;D.on('uiReady',function(){L=D.container.append(h.createFromHtml('<span tabindex="-1" style="position:absolute;" role="presentation"></span>'));L.on('focus',function(){D.focus();});D.focusGrabber=L;});D.on('destroy',function(){e.removeFunction(G);L.clearCustomData();delete D.focusGrabber;});}D.on('insertElement',function(M){var N=M.data;if(N.type==1&&(N.is('input')||N.is('textarea'))){if(!N.isReadOnly())N.data('cke-editable',N.hasAttribute('contenteditable')?'true':'1');
+N.setAttribute('contentEditable',false);}});}});if(b.gecko)(function(){var D=document.body;if(!D)window.addEventListener('load',arguments.callee,false);else{var E=D.getAttribute('onpageshow');D.setAttribute('onpageshow',(E?E+';':'')+'event.persisted && (function(){'+'var allInstances = CKEDITOR.instances, editor, doc;'+'for ( var i in allInstances )'+'{'+'\teditor = allInstances[ i ];'+'\tdoc = editor.document;'+'\tif ( doc )'+'\t{'+'\t\tdoc.$.designMode = "off";'+'\t\tdoc.$.designMode = "on";'+'\t}'+'}'+'})();');}})();})();i.disableObjectResizing=false;i.disableNativeTableHandles=true;i.disableNativeSpellChecker=true;i.ignoreEmptyParagraph=true;j.add('wsc',{requires:['dialog'],init:function(m){var n='checkspell',o=m.addCommand(n,new a.dialogCommand(n));o.modes={wysiwyg:!b.opera&&!b.air&&document.domain==window.location.hostname};m.ui.addButton('SpellChecker',{label:m.lang.spellCheck.toolbar,command:n});a.dialog.add(n,this.path+'dialogs/wsc.js');}});i.wsc_customerId=i.wsc_customerId||'1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk';i.wsc_customLoaderScript=i.wsc_customLoaderScript||null;a.DIALOG_RESIZE_NONE=0;a.DIALOG_RESIZE_WIDTH=1;a.DIALOG_RESIZE_HEIGHT=2;a.DIALOG_RESIZE_BOTH=3;(function(){var m=e.cssLength;function n(P){return!!this._.tabs[P][0].$.offsetHeight;};function o(){var T=this;var P=T._.currentTabId,Q=T._.tabIdList.length,R=e.indexOf(T._.tabIdList,P)+Q;for(var S=R-1;S>R-Q;S--){if(n.call(T,T._.tabIdList[S%Q]))return T._.tabIdList[S%Q];}return null;};function p(){var T=this;var P=T._.currentTabId,Q=T._.tabIdList.length,R=e.indexOf(T._.tabIdList,P);for(var S=R+1;S<R+Q;S++){if(n.call(T,T._.tabIdList[S%Q]))return T._.tabIdList[S%Q];}return null;};function q(P,Q){var R=P.$.getElementsByTagName('input');for(var S=0,T=R.length;S<T;S++){var U=new h(R[S]);if(U.getAttribute('type').toLowerCase()=='text')if(Q){U.setAttribute('value',U.getCustomData('fake_value')||'');U.removeCustomData('fake_value');}else{U.setCustomData('fake_value',U.getAttribute('value'));U.setAttribute('value','');}}};a.dialog=function(P,Q){var R=a.dialog._.dialogDefinitions[Q],S=e.clone(s),T=P.config.dialog_buttonsOrder||'OS',U=P.lang.dir;if(T=='OS'&&b.mac||T=='rtl'&&U=='ltr'||T=='ltr'&&U=='rtl')S.buttons.reverse();R=e.extend(R(P),S);R=e.clone(R);R=new w(this,R);var V=a.document,W=P.theme.buildDialog(P);this._={editor:P,element:W.element,name:Q,contentSize:{width:0,height:0},size:{width:0,height:0},contents:{},buttons:{},accessKeyMap:{},tabs:{},tabIdList:[],currentTabId:null,currentTabIndex:null,pageCount:0,lastTab:null,tabBarMode:false,focusList:[],currentFocusIndex:0,hasFocus:false};
+this.parts=W.parts;e.setTimeout(function(){P.fire('ariaWidget',this.parts.contents);},0,this);this.parts.dialog.setStyles({position:b.ie6Compat?'absolute':'fixed',top:0,left:0,visibility:'hidden'});a.event.call(this);this.definition=R=a.fire('dialogDefinition',{name:Q,definition:R},P).definition;var X={};if(!('removeDialogTabs' in P._)&&P.config.removeDialogTabs){var Y=P.config.removeDialogTabs.split(';');for(i=0;i<Y.length;i++){var Z=Y[i].split(':');if(Z.length==2){var aa=Z[0];if(!X[aa])X[aa]=[];X[aa].push(Z[1]);}}P._.removeDialogTabs=X;}if(P._.removeDialogTabs&&(X=P._.removeDialogTabs[Q]))for(i=0;i<X.length;i++)R.removeContents(X[i]);if(R.onLoad)this.on('load',R.onLoad);if(R.onShow)this.on('show',R.onShow);if(R.onHide)this.on('hide',R.onHide);if(R.onOk)this.on('ok',function(an){P.fire('saveSnapshot');setTimeout(function(){P.fire('saveSnapshot');},0);if(R.onOk.call(this,an)===false)an.data.hide=false;});if(R.onCancel)this.on('cancel',function(an){if(R.onCancel.call(this,an)===false)an.data.hide=false;});var ab=this,ac=function(an){var ao=ab._.contents,ap=false;for(var aq in ao)for(var ar in ao[aq]){ap=an.call(this,ao[aq][ar]);if(ap)return;}};this.on('ok',function(an){ac(function(ao){if(ao.validate){var ap=ao.validate(this);if(typeof ap=='string'){alert(ap);ap=false;}if(ap===false){if(ao.select)ao.select();else ao.focus();an.data.hide=false;an.stop();return true;}}});},this,null,0);this.on('cancel',function(an){ac(function(ao){if(ao.isChanged()){if(!confirm(P.lang.common.confirmCancel))an.data.hide=false;return true;}});},this,null,0);this.parts.close.on('click',function(an){if(this.fire('cancel',{hide:true}).hide!==false)this.hide();an.data.preventDefault();},this);function ad(){var an=ab._.focusList;an.sort(function(aq,ar){if(aq.tabIndex!=ar.tabIndex)return ar.tabIndex-aq.tabIndex;else return aq.focusIndex-ar.focusIndex;});var ao=an.length;for(var ap=0;ap<ao;ap++)an[ap].focusIndex=ap;};function ae(an){var ao=ab._.focusList,ap=an?1:-1;if(ao.length<1)return;var aq=ab._.currentFocusIndex;try{ao[aq].getInputElement().$.blur();}catch(at){}var ar=(aq+ap+ao.length)%ao.length,as=ar;while(!ao[as].isFocusable()){as=(as+ap+ao.length)%ao.length;if(as==ar)break;}ao[as].focus();if(ao[as].type=='text')ao[as].select();};this.changeFocus=ae;var af;function ag(an){var as=this;if(ab!=a.dialog._.currentTop)return;var ao=an.data.getKeystroke(),ap=P.lang.dir=='rtl';af=0;if(ao==9||ao==2000+9){var aq=ao==2000+9;if(ab._.tabBarMode){var ar=aq?o.call(ab):p.call(ab);ab.selectPage(ar);
+ab._.tabs[ar][0].focus();}else ae(!aq);af=1;}else if(ao==4000+121&&!ab._.tabBarMode&&ab.getPageCount()>1){ab._.tabBarMode=true;ab._.tabs[ab._.currentTabId][0].focus();af=1;}else if((ao==37||ao==39)&&ab._.tabBarMode){ar=ao==(ap?39:37)?o.call(ab):p.call(ab);ab.selectPage(ar);ab._.tabs[ar][0].focus();af=1;}else if((ao==13||ao==32)&&ab._.tabBarMode){as.selectPage(as._.currentTabId);as._.tabBarMode=false;as._.currentFocusIndex=-1;ae(true);af=1;}if(af){an.stop();an.data.preventDefault();}};function ah(an){af&&an.data.preventDefault();};var ai=this._.element;this.on('show',function(){ai.on('keydown',ag,this,null,0);if(b.opera||b.gecko&&b.mac)ai.on('keypress',ah,this);});this.on('hide',function(){ai.removeListener('keydown',ag);if(b.opera||b.gecko&&b.mac)ai.removeListener('keypress',ah);});this.on('iframeAdded',function(an){var ao=new g(an.data.iframe.$.contentWindow.document);ao.on('keydown',ag,this,null,0);});this.on('show',function(){var ar=this;ad();if(P.config.dialog_startupFocusTab&&ab._.pageCount>1){ab._.tabBarMode=true;ab._.tabs[ab._.currentTabId][0].focus();}else if(!ar._.hasFocus){ar._.currentFocusIndex=-1;if(R.onFocus){var an=R.onFocus.call(ar);an&&an.focus();}else ae(true);if(ar._.editor.mode=='wysiwyg'&&c){var ao=P.document.$.selection,ap=ao.createRange();if(ap)if(ap.parentElement&&ap.parentElement().ownerDocument==P.document.$||ap.item&&ap.item(0).ownerDocument==P.document.$){var aq=document.body.createTextRange();aq.moveToElementText(ar.getElement().getFirst().$);aq.collapse(true);aq.select();}}}},this,null,4294967295);if(b.ie6Compat)this.on('load',function(an){var ao=this.getElement(),ap=ao.getFirst();ap.remove();ap.appendTo(ao);},this);y(this);z(this);new d.text(R.title,a.document).appendTo(this.parts.title);for(var aj=0;aj<R.contents.length;aj++){var ak=R.contents[aj];ak&&this.addPage(ak);}this.parts.tabs.on('click',function(an){var aq=this;var ao=an.data.getTarget();if(ao.hasClass('cke_dialog_tab')){var ap=ao.$.id;aq.selectPage(ap.substring(4,ap.lastIndexOf('_')));if(aq._.tabBarMode){aq._.tabBarMode=false;aq._.currentFocusIndex=-1;ae(true);}an.data.preventDefault();}},this);var al=[],am=a.dialog._.uiElementBuilders.hbox.build(this,{type:'hbox',className:'cke_dialog_footer_buttons',widths:[],children:R.buttons},al).getChild();this.parts.footer.setHtml(al.join(''));for(aj=0;aj<am.length;aj++)this._.buttons[am[aj].id]=am[aj];};function r(P,Q,R){this.element=Q;this.focusIndex=R;this.tabIndex=0;this.isFocusable=function(){return!Q.getAttribute('disabled')&&Q.isVisible();
+};this.focus=function(){P._.currentFocusIndex=this.focusIndex;this.element.focus();};Q.on('keydown',function(S){if(S.data.getKeystroke() in {32:1,13:1})this.fire('click');});Q.on('focus',function(){this.fire('mouseover');});Q.on('blur',function(){this.fire('mouseout');});};a.dialog.prototype={destroy:function(){this.hide();this._.element.remove();},resize:(function(){return function(P,Q){var R=this;if(R._.contentSize&&R._.contentSize.width==P&&R._.contentSize.height==Q)return;a.dialog.fire('resize',{dialog:R,skin:R._.editor.skinName,width:P,height:Q},R._.editor);R._.contentSize={width:P,height:Q};};})(),getSize:function(){var P=this._.element.getFirst();return{width:P.$.offsetWidth||0,height:P.$.offsetHeight||0};},move:(function(){var P;return function(Q,R,S){var V=this;var T=V._.element.getFirst();if(P===undefined)P=T.getComputedStyle('position')=='fixed';if(P&&V._.position&&V._.position.x==Q&&V._.position.y==R)return;V._.position={x:Q,y:R};if(!P){var U=a.document.getWindow().getScrollPosition();Q+=U.x;R+=U.y;}T.setStyles({left:(Q>0?Q:0)+'px',top:(R>0?R:0)+'px'});S&&(V._.moved=1);};})(),getPosition:function(){return e.extend({},this._.position);},show:function(){var P=this._.element,Q=this.definition;if(!(P.getParent()&&P.getParent().equals(a.document.getBody())))P.appendTo(a.document.getBody());else P.setStyle('display','block');if(b.gecko&&b.version<10900){var R=this.parts.dialog;R.setStyle('position','absolute');setTimeout(function(){R.setStyle('position','fixed');},0);}this.resize(this._.contentSize&&this._.contentSize.width||Q.minWidth,this._.contentSize&&this._.contentSize.height||Q.minHeight);this.reset();this.selectPage(this.definition.contents[0].id);if(a.dialog._.currentZIndex===null)a.dialog._.currentZIndex=this._.editor.config.baseFloatZIndex;this._.element.getFirst().setStyle('z-index',a.dialog._.currentZIndex+=10);if(a.dialog._.currentTop===null){a.dialog._.currentTop=this;this._.parentDialog=null;D(this._.editor);P.on('keydown',H);P.on(b.opera?'keypress':'keyup',I);for(var S in {keyup:1,keydown:1,keypress:1})P.on(S,O);}else{this._.parentDialog=a.dialog._.currentTop;var T=this._.parentDialog.getElement().getFirst();T.$.style.zIndex-=Math.floor(this._.editor.config.baseFloatZIndex/2);a.dialog._.currentTop=this;}J(this,this,'\x1b',null,function(){this.getButton('cancel')&&this.getButton('cancel').click();});this._.hasFocus=false;e.setTimeout(function(){this.layout();this.parts.dialog.setStyle('visibility','');this.fireOnce('load',{});k.fire('ready',this);
+this.fire('show',{});this._.editor.fire('dialogShow',this);this.foreach(function(U){U.setInitValue&&U.setInitValue();});},100,this);},layout:function(){var R=this;var P=a.document.getWindow().getViewPaneSize(),Q=R.getSize();R.move(R._.moved?R._.position.x:(P.width-Q.width)/2,R._.moved?R._.position.y:(P.height-Q.height)/2);},foreach:function(P){var S=this;for(var Q in S._.contents)for(var R in S._.contents[Q])P(S._.contents[Q][R]);return S;},reset:(function(){var P=function(Q){if(Q.reset)Q.reset(1);};return function(){this.foreach(P);return this;};})(),setupContent:function(){var P=arguments;this.foreach(function(Q){if(Q.setup)Q.setup.apply(Q,P);});},commitContent:function(){var P=arguments;this.foreach(function(Q){if(Q.commit)Q.commit.apply(Q,P);});},hide:function(){if(!this.parts.dialog.isVisible())return;this.fire('hide',{});this._.editor.fire('dialogHide',this);var P=this._.element;P.setStyle('display','none');this.parts.dialog.setStyle('visibility','hidden');K(this);while(a.dialog._.currentTop!=this)a.dialog._.currentTop.hide();if(!this._.parentDialog)E();else{var Q=this._.parentDialog.getElement().getFirst();Q.setStyle('z-index',parseInt(Q.$.style.zIndex,10)+Math.floor(this._.editor.config.baseFloatZIndex/2));}a.dialog._.currentTop=this._.parentDialog;if(!this._.parentDialog){a.dialog._.currentZIndex=null;P.removeListener('keydown',H);P.removeListener(b.opera?'keypress':'keyup',I);for(var R in {keyup:1,keydown:1,keypress:1})P.removeListener(R,O);var S=this._.editor;S.focus();if(S.mode=='wysiwyg'&&c){var T=S.getSelection();T&&T.unlock(true);}}else a.dialog._.currentZIndex-=10;delete this._.parentDialog;this.foreach(function(U){U.resetInitValue&&U.resetInitValue();});},addPage:function(P){var ab=this;var Q=[],R=P.label?' title="'+e.htmlEncode(P.label)+'"':'',S=P.elements,T=a.dialog._.uiElementBuilders.vbox.build(ab,{type:'vbox',className:'cke_dialog_page_contents',children:P.elements,expand:!!P.expand,padding:P.padding,style:P.style||'width: 100%;'},Q),U=h.createFromHtml(Q.join(''));U.setAttribute('role','tabpanel');var V=b,W='cke_'+P.id+'_'+e.getNextNumber(),X=h.createFromHtml(['<a class="cke_dialog_tab"',ab._.pageCount>0?' cke_last':'cke_first',R,!!P.hidden?' style="display:none"':'',' id="',W,'"',V.gecko&&V.version>=10900&&!V.hc?'':' href="javascript:void(0)"',' tabIndex="-1"',' hidefocus="true"',' role="tab">',P.label,'</a>'].join(''));U.setAttribute('aria-labelledby',W);ab._.tabs[P.id]=[X,U];ab._.tabIdList.push(P.id);!P.hidden&&ab._.pageCount++;ab._.lastTab=X;
+ab.updateStyle();var Y=ab._.contents[P.id]={},Z,aa=T.getChild();while(Z=aa.shift()){Y[Z.id]=Z;if(typeof Z.getChild=='function')aa.push.apply(aa,Z.getChild());}U.setAttribute('name',P.id);U.appendTo(ab.parts.contents);X.unselectable();ab.parts.tabs.append(X);if(P.accessKey){J(ab,ab,'CTRL+'+P.accessKey,M,L);ab._.accessKeyMap['CTRL+'+P.accessKey]=P.id;}},selectPage:function(P){if(this._.currentTabId==P)return;if(this.fire('selectPage',{page:P,currentPage:this._.currentTabId})===true)return;for(var Q in this._.tabs){var R=this._.tabs[Q][0],S=this._.tabs[Q][1];if(Q!=P){R.removeClass('cke_dialog_tab_selected');S.hide();}S.setAttribute('aria-hidden',Q!=P);}var T=this._.tabs[P];T[0].addClass('cke_dialog_tab_selected');if(b.ie6Compat||b.ie7Compat){q(T[1]);T[1].show();setTimeout(function(){q(T[1],1);},0);}else T[1].show();this._.currentTabId=P;this._.currentTabIndex=e.indexOf(this._.tabIdList,P);},updateStyle:function(){this.parts.dialog[(this._.pageCount===1?'add':'remove')+'Class']('cke_single_page');},hidePage:function(P){var R=this;var Q=R._.tabs[P]&&R._.tabs[P][0];if(!Q||R._.pageCount==1||!Q.isVisible())return;else if(P==R._.currentTabId)R.selectPage(o.call(R));Q.hide();R._.pageCount--;R.updateStyle();},showPage:function(P){var R=this;var Q=R._.tabs[P]&&R._.tabs[P][0];if(!Q)return;Q.show();R._.pageCount++;R.updateStyle();},getElement:function(){return this._.element;},getName:function(){return this._.name;},getContentElement:function(P,Q){var R=this._.contents[P];return R&&R[Q];},getValueOf:function(P,Q){return this.getContentElement(P,Q).getValue();},setValueOf:function(P,Q,R){return this.getContentElement(P,Q).setValue(R);},getButton:function(P){return this._.buttons[P];},click:function(P){return this._.buttons[P].click();},disableButton:function(P){return this._.buttons[P].disable();},enableButton:function(P){return this._.buttons[P].enable();},getPageCount:function(){return this._.pageCount;},getParentEditor:function(){return this._.editor;},getSelectedElement:function(){return this.getParentEditor().getSelection().getSelectedElement();},addFocusable:function(P,Q){var S=this;if(typeof Q=='undefined'){Q=S._.focusList.length;S._.focusList.push(new r(S,P,Q));}else{S._.focusList.splice(Q,0,new r(S,P,Q));for(var R=Q+1;R<S._.focusList.length;R++)S._.focusList[R].focusIndex++;}}};e.extend(a.dialog,{add:function(P,Q){if(!this._.dialogDefinitions[P]||typeof Q=='function')this._.dialogDefinitions[P]=Q;},exists:function(P){return!!this._.dialogDefinitions[P];},getCurrent:function(){return a.dialog._.currentTop;
+},okButton:(function(){var P=function(Q,R){R=R||{};return e.extend({id:'ok',type:'button',label:Q.lang.common.ok,'class':'cke_dialog_ui_button_ok',onClick:function(S){var T=S.data.dialog;if(T.fire('ok',{hide:true}).hide!==false)T.hide();}},R,true);};P.type='button';P.override=function(Q){return e.extend(function(R){return P(R,Q);},{type:'button'},true);};return P;})(),cancelButton:(function(){var P=function(Q,R){R=R||{};return e.extend({id:'cancel',type:'button',label:Q.lang.common.cancel,'class':'cke_dialog_ui_button_cancel',onClick:function(S){var T=S.data.dialog;if(T.fire('cancel',{hide:true}).hide!==false)T.hide();}},R,true);};P.type='button';P.override=function(Q){return e.extend(function(R){return P(R,Q);},{type:'button'},true);};return P;})(),addUIElement:function(P,Q){this._.uiElementBuilders[P]=Q;}});a.dialog._={uiElementBuilders:{},dialogDefinitions:{},currentTop:null,currentZIndex:null};a.event.implementOn(a.dialog);a.event.implementOn(a.dialog.prototype,true);var s={resizable:3,minWidth:600,minHeight:400,buttons:[a.dialog.okButton,a.dialog.cancelButton]},t=function(P,Q,R){for(var S=0,T;T=P[S];S++){if(T.id==Q)return T;if(R&&T[R]){var U=t(T[R],Q,R);if(U)return U;}}return null;},u=function(P,Q,R,S,T){if(R){for(var U=0,V;V=P[U];U++){if(V.id==R){P.splice(U,0,Q);return Q;}if(S&&V[S]){var W=u(V[S],Q,R,S,true);if(W)return W;}}if(T)return null;}P.push(Q);return Q;},v=function(P,Q,R){for(var S=0,T;T=P[S];S++){if(T.id==Q)return P.splice(S,1);if(R&&T[R]){var U=v(T[R],Q,R);if(U)return U;}}return null;},w=function(P,Q){this.dialog=P;var R=Q.contents;for(var S=0,T;T=R[S];S++)R[S]=T&&new x(P,T);e.extend(this,Q);};w.prototype={getContents:function(P){return t(this.contents,P);},getButton:function(P){return t(this.buttons,P);},addContents:function(P,Q){return u(this.contents,P,Q);},addButton:function(P,Q){return u(this.buttons,P,Q);},removeContents:function(P){v(this.contents,P);},removeButton:function(P){v(this.buttons,P);}};function x(P,Q){this._={dialog:P};e.extend(this,Q);};x.prototype={get:function(P){return t(this.elements,P,'children');},add:function(P,Q){return u(this.elements,P,Q,'children');},remove:function(P){v(this.elements,P,'children');}};function y(P){var Q=null,R=null,S=P.getElement().getFirst(),T=P.getParentEditor(),U=T.config.dialog_magnetDistance,V=T.skin.margins||[0,0,0,0];if(typeof U=='undefined')U=20;function W(Y){var Z=P.getSize(),aa=a.document.getWindow().getViewPaneSize(),ab=Y.data.$.screenX,ac=Y.data.$.screenY,ad=ab-Q.x,ae=ac-Q.y,af,ag;
+Q={x:ab,y:ac};R.x+=ad;R.y+=ae;if(R.x+V[3]<U)af=-V[3];else if(R.x-V[1]>aa.width-Z.width-U)af=aa.width-Z.width+(T.lang.dir=='rtl'?0:V[1]);else af=R.x;if(R.y+V[0]<U)ag=-V[0];else if(R.y-V[2]>aa.height-Z.height-U)ag=aa.height-Z.height+V[2];else ag=R.y;P.move(af,ag,1);Y.data.preventDefault();};function X(Y){a.document.removeListener('mousemove',W);a.document.removeListener('mouseup',X);if(b.ie6Compat){var Z=C.getChild(0).getFrameDocument();Z.removeListener('mousemove',W);Z.removeListener('mouseup',X);}};P.parts.title.on('mousedown',function(Y){Q={x:Y.data.$.screenX,y:Y.data.$.screenY};a.document.on('mousemove',W);a.document.on('mouseup',X);R=P.getPosition();if(b.ie6Compat){var Z=C.getChild(0).getFrameDocument();Z.on('mousemove',W);Z.on('mouseup',X);}Y.data.preventDefault();},P);};function z(P){var Q=P.definition,R=Q.resizable;if(R==0)return;var S=P.getParentEditor(),T,U,V,W,X,Y;function Z(ad){if(P._.moved&&S.lang.dir=='rtl'){var ae=P._.element.getFirst();ae.setStyle('right',ad+'px');ae.removeStyle('left');}else if(!P._.moved)P.layout();};var aa=e.addFunction(function(ad){X=P.getSize();var ae=P.parts.contents,af=ae.$.getElementsByTagName('iframe').length;if(af){Y=h.createFromHtml('<div class="cke_dialog_resize_cover" style="height: 100%; position: absolute; width: 100%;"></div>');ae.append(Y);}U=X.height-P.parts.contents.getSize('height',!(b.gecko||b.opera||c&&b.quirks));T=X.width-P.parts.contents.getSize('width',1);W={x:ad.screenX,y:ad.screenY};V=a.document.getWindow().getViewPaneSize();a.document.on('mousemove',ab);a.document.on('mouseup',ac);if(b.ie6Compat){var ag=C.getChild(0).getFrameDocument();ag.on('mousemove',ab);ag.on('mouseup',ac);}ad.preventDefault&&ad.preventDefault();});P.on('load',function(){var ad='';if(R==1)ad=' cke_resizer_horizontal';else if(R==2)ad=' cke_resizer_vertical';var ae=h.createFromHtml('<div class="cke_resizer'+ad+'"'+' title="'+e.htmlEncode(S.lang.resize)+'"'+' onmousedown="CKEDITOR.tools.callFunction('+aa+', event )"></div>');P.parts.footer.append(ae,1);});S.on('destroy',function(){e.removeFunction(aa);});function ab(ad){var ae=S.lang.dir=='rtl',af=(ad.data.$.screenX-W.x)*(ae?-1:1),ag=ad.data.$.screenY-W.y,ah=X.width,ai=X.height,aj=ah+af*(P._.moved?1:2),ak=ai+ag*(P._.moved?1:2),al=P._.element.getFirst(),am=ae&&al.getComputedStyle('right'),an=P.getPosition();if(am)am=am=='auto'?V.width-(an.x||0)-al.getSize('width'):parseInt(am,10);if(an.y+ak>V.height)ak=V.height-an.y;if((ae?am:an.x)+aj>V.width)aj=V.width-(ae?am:an.x);if((R==1||R==3)&&!(ae&&af>0&&!an.x))ah=Math.max(Q.minWidth||0,aj-T);
+if(R==2||R==3)ai=Math.max(Q.minHeight||0,ak-U);P.resize(ah,ai);Z(am);ad.data.preventDefault();};function ac(){a.document.removeListener('mouseup',ac);a.document.removeListener('mousemove',ab);if(Y){Y.remove();Y=null;}if(b.ie6Compat){var ad=C.getChild(0).getFrameDocument();ad.removeListener('mouseup',ac);ad.removeListener('mousemove',ab);}if(S.lang.dir=='rtl'){var ae=P._.element.getFirst(),af=ae.getComputedStyle('left');if(af=='auto')af=V.width-parseInt(ae.getStyle('right'),10)-P.getSize().width;else af=parseInt(af,10);ae.removeStyle('right');P._.position.x+=1;P.move(af,P._.position.y);}};};var A,B={},C;function D(P){var Q=a.document.getWindow(),R=P.config,S=R.dialog_backgroundCoverColor||'white',T=R.dialog_backgroundCoverOpacity,U=R.baseFloatZIndex,V=e.genKey(S,T,U),W=B[V];if(!W){var X=['<div tabIndex="-1" style="position: ',b.ie6Compat?'absolute':'fixed','; z-index: ',U,'; top: 0px; left: 0px; ',!b.ie6Compat?'background-color: '+S:'','" class="cke_dialog_background_cover">'];if(b.ie6Compat){var Y=b.isCustomDomain(),Z="<html><body style=\\'background-color:"+S+";\\'></body></html>";X.push('<iframe hidefocus="true" frameborder="0" id="cke_dialog_background_iframe" src="javascript:');X.push('void((function(){document.open();'+(Y?"document.domain='"+document.domain+"';":'')+"document.write( '"+Z+"' );"+'document.close();'+'})())');X.push('" style="position:absolute;left:0;top:0;width:100%;height: 100%;progid:DXImageTransform.Microsoft.Alpha(opacity=0)"></iframe>');}X.push('</div>');W=h.createFromHtml(X.join(''));W.setOpacity(T!=undefined?T:0.5);W.appendTo(a.document.getBody());B[V]=W;}else W.show();C=W;var aa=function(){var ad=Q.getViewPaneSize();W.setStyles({width:ad.width+'px',height:ad.height+'px'});},ab=function(){var ad=Q.getScrollPosition(),ae=a.dialog._.currentTop;W.setStyles({left:ad.x+'px',top:ad.y+'px'});if(ae)do{var af=ae.getPosition();ae.move(af.x,af.y);}while(ae=ae._.parentDialog)};A=aa;Q.on('resize',aa);aa();if(!(b.mac&&b.webkit))W.focus();if(b.ie6Compat){var ac=function(){ab();arguments.callee.prevScrollHandler.apply(this,arguments);};Q.$.setTimeout(function(){ac.prevScrollHandler=window.onscroll||(function(){});window.onscroll=ac;},0);ab();}};function E(){if(!C)return;var P=a.document.getWindow();C.hide();P.removeListener('resize',A);if(b.ie6Compat)P.$.setTimeout(function(){var Q=window.onscroll&&window.onscroll.prevScrollHandler;window.onscroll=Q||null;},0);A=null;};function F(){for(var P in B)B[P].remove();B={};};var G={},H=function(P){var Q=P.data.$.ctrlKey||P.data.$.metaKey,R=P.data.$.altKey,S=P.data.$.shiftKey,T=String.fromCharCode(P.data.$.keyCode),U=G[(Q?'CTRL+':'')+(R?'ALT+':'')+(S?'SHIFT+':'')+T];
+if(!U||!U.length)return;U=U[U.length-1];U.keydown&&U.keydown.call(U.uiElement,U.dialog,U.key);P.data.preventDefault();},I=function(P){var Q=P.data.$.ctrlKey||P.data.$.metaKey,R=P.data.$.altKey,S=P.data.$.shiftKey,T=String.fromCharCode(P.data.$.keyCode),U=G[(Q?'CTRL+':'')+(R?'ALT+':'')+(S?'SHIFT+':'')+T];if(!U||!U.length)return;U=U[U.length-1];if(U.keyup){U.keyup.call(U.uiElement,U.dialog,U.key);P.data.preventDefault();}},J=function(P,Q,R,S,T){var U=G[R]||(G[R]=[]);U.push({uiElement:P,dialog:Q,key:R,keyup:T||P.accessKeyUp,keydown:S||P.accessKeyDown});},K=function(P){for(var Q in G){var R=G[Q];for(var S=R.length-1;S>=0;S--){if(R[S].dialog==P||R[S].uiElement==P)R.splice(S,1);}if(R.length===0)delete G[Q];}},L=function(P,Q){if(P._.accessKeyMap[Q])P.selectPage(P._.accessKeyMap[Q]);},M=function(P,Q){},N={27:1,13:1},O=function(P){if(P.data.getKeystroke() in N)P.data.stopPropagation();};(function(){k.dialog={uiElement:function(P,Q,R,S,T,U,V){if(arguments.length<4)return;var W=(S.call?S(Q):S)||'div',X=['<',W,' '],Y=(T&&T.call?T(Q):T)||{},Z=(U&&U.call?U(Q):U)||{},aa=(V&&V.call?V.call(this,P,Q):V)||'',ab=this.domId=Z.id||e.getNextId()+'_uiElement',ac=this.id=Q.id,ad;Z.id=ab;var ae={};if(Q.type)ae['cke_dialog_ui_'+Q.type]=1;if(Q.className)ae[Q.className]=1;var af=Z['class']&&Z['class'].split?Z['class'].split(' '):[];for(ad=0;ad<af.length;ad++){if(af[ad])ae[af[ad]]=1;}var ag=[];for(ad in ae)ag.push(ad);Z['class']=ag.join(' ');if(Q.title)Z.title=Q.title;var ah=(Q.style||'').split(';');for(ad in Y)ah.push(ad+':'+Y[ad]);if(Q.hidden)ah.push('display:none');for(ad=ah.length-1;ad>=0;ad--){if(ah[ad]==='')ah.splice(ad,1);}if(ah.length>0)Z.style=(Z.style?Z.style+'; ':'')+ah.join('; ');for(ad in Z)X.push(ad+'="'+e.htmlEncode(Z[ad])+'" ');X.push('>',aa,'</',W,'>');R.push(X.join(''));(this._||(this._={})).dialog=P;if(typeof Q.isChanged=='boolean')this.isChanged=function(){return Q.isChanged;};if(typeof Q.isChanged=='function')this.isChanged=Q.isChanged;a.event.implementOn(this);this.registerEvents(Q);if(this.accessKeyUp&&this.accessKeyDown&&Q.accessKey)J(this,P,'CTRL+'+Q.accessKey);var ai=this;P.on('load',function(){if(ai.getInputElement())ai.getInputElement().on('focus',function(){P._.tabBarMode=false;P._.hasFocus=true;ai.fire('focus');},ai);});if(this.keyboardFocusable){this.tabIndex=Q.tabIndex||0;this.focusIndex=P._.focusList.push(this)-1;this.on('focus',function(){P._.currentFocusIndex=ai.focusIndex;});}e.extend(this,Q);},hbox:function(P,Q,R,S,T){if(arguments.length<4)return;this._||(this._={});
+var U=this._.children=Q,V=T&&T.widths||null,W=T&&T.height||null,X={},Y,Z=function(){var ab=['<tbody><tr class="cke_dialog_ui_hbox">'];for(Y=0;Y<R.length;Y++){var ac='cke_dialog_ui_hbox_child',ad=[];if(Y===0)ac='cke_dialog_ui_hbox_first';if(Y==R.length-1)ac='cke_dialog_ui_hbox_last';ab.push('<td class="',ac,'" role="presentation" ');if(V){if(V[Y])ad.push('width:'+m(V[Y]));}else ad.push('width:'+Math.floor(100/R.length)+'%');if(W)ad.push('height:'+m(W));if(T&&T.padding!=undefined)ad.push('padding:'+m(T.padding));if(ad.length>0)ab.push('style="'+ad.join('; ')+'" ');ab.push('>',R[Y],'</td>');}ab.push('</tr></tbody>');return ab.join('');},aa={role:'presentation'};T&&T.align&&(aa.align=T.align);k.dialog.uiElement.call(this,P,T||{type:'hbox'},S,'table',X,aa,Z);},vbox:function(P,Q,R,S,T){if(arguments.length<3)return;this._||(this._={});var U=this._.children=Q,V=T&&T.width||null,W=T&&T.heights||null,X=function(){var Y=['<table role="presentation" cellspacing="0" border="0" '];Y.push('style="');if(T&&T.expand)Y.push('height:100%;');Y.push('width:'+m(V||'100%'),';');Y.push('"');Y.push('align="',e.htmlEncode(T&&T.align||(P.getParentEditor().lang.dir=='ltr'?'left':'right')),'" ');Y.push('><tbody>');for(var Z=0;Z<R.length;Z++){var aa=[];Y.push('<tr><td role="presentation" ');if(V)aa.push('width:'+m(V||'100%'));if(W)aa.push('height:'+m(W[Z]));else if(T&&T.expand)aa.push('height:'+Math.floor(100/R.length)+'%');if(T&&T.padding!=undefined)aa.push('padding:'+m(T.padding));if(aa.length>0)Y.push('style="',aa.join('; '),'" ');Y.push(' class="cke_dialog_ui_vbox_child">',R[Z],'</td></tr>');}Y.push('</tbody></table>');return Y.join('');};k.dialog.uiElement.call(this,P,T||{type:'vbox'},S,'div',null,{role:'presentation'},X);}};})();k.dialog.uiElement.prototype={getElement:function(){return a.document.getById(this.domId);},getInputElement:function(){return this.getElement();},getDialog:function(){return this._.dialog;},setValue:function(P,Q){this.getInputElement().setValue(P);!Q&&this.fire('change',{value:P});return this;},getValue:function(){return this.getInputElement().getValue();},isChanged:function(){return false;},selectParentTab:function(){var S=this;var P=S.getInputElement(),Q=P,R;while((Q=Q.getParent())&&Q.$.className.search('cke_dialog_page_contents')==-1){}if(!Q)return S;R=Q.getAttribute('name');if(S._.dialog._.currentTabId!=R)S._.dialog.selectPage(R);return S;},focus:function(){this.selectParentTab().getInputElement().focus();return this;},registerEvents:function(P){var Q=/^on([A-Z]\w+)/,R,S=function(U,V,W,X){V.on('load',function(){U.getInputElement().on(W,X,U);
+});};for(var T in P){if(!(R=T.match(Q)))continue;if(this.eventProcessors[T])this.eventProcessors[T].call(this,this._.dialog,P[T]);else S(this,this._.dialog,R[1].toLowerCase(),P[T]);}return this;},eventProcessors:{onLoad:function(P,Q){P.on('load',Q,this);},onShow:function(P,Q){P.on('show',Q,this);},onHide:function(P,Q){P.on('hide',Q,this);}},accessKeyDown:function(P,Q){this.focus();},accessKeyUp:function(P,Q){},disable:function(){var P=this.getInputElement();P.setAttribute('disabled','true');P.addClass('cke_disabled');},enable:function(){var P=this.getInputElement();P.removeAttribute('disabled');P.removeClass('cke_disabled');},isEnabled:function(){return!this.getInputElement().getAttribute('disabled');},isVisible:function(){return this.getInputElement().isVisible();},isFocusable:function(){if(!this.isEnabled()||!this.isVisible())return false;return true;}};k.dialog.hbox.prototype=e.extend(new k.dialog.uiElement(),{getChild:function(P){var Q=this;if(arguments.length<1)return Q._.children.concat();if(!P.splice)P=[P];if(P.length<2)return Q._.children[P[0]];else return Q._.children[P[0]]&&Q._.children[P[0]].getChild?Q._.children[P[0]].getChild(P.slice(1,P.length)):null;}},true);k.dialog.vbox.prototype=new k.dialog.hbox();(function(){var P={build:function(Q,R,S){var T=R.children,U,V=[],W=[];for(var X=0;X<T.length&&(U=T[X]);X++){var Y=[];V.push(Y);W.push(a.dialog._.uiElementBuilders[U.type].build(Q,U,Y));}return new k.dialog[R.type](Q,W,V,S,R);}};a.dialog.addUIElement('hbox',P);a.dialog.addUIElement('vbox',P);})();a.dialogCommand=function(P){this.dialogName=P;};a.dialogCommand.prototype={exec:function(P){P.openDialog(this.dialogName);},canUndo:false,editorFocus:c||b.webkit};(function(){var P=/^([a]|[^a])+$/,Q=/^\d*$/,R=/^\d*(?:\.\d+)?$/;a.VALIDATE_OR=1;a.VALIDATE_AND=2;a.dialog.validate={functions:function(){return function(){var Y=this;var S=Y&&Y.getValue?Y.getValue():arguments[0],T=undefined,U=2,V=[],W;for(W=0;W<arguments.length;W++){if(typeof arguments[W]=='function')V.push(arguments[W]);else break;}if(W<arguments.length&&typeof arguments[W]=='string'){T=arguments[W];W++;}if(W<arguments.length&&typeof arguments[W]=='number')U=arguments[W];var X=U==2?true:false;for(W=0;W<V.length;W++){if(U==2)X=X&&V[W](S);else X=X||V[W](S);}if(!X){if(T!==undefined)alert(T);if(Y&&(Y.select||Y.focus))Y.select||Y.focus();return false;}return true;};},regex:function(S,T){return function(){var V=this;var U=V&&V.getValue?V.getValue():arguments[0];if(!S.test(U)){if(T!==undefined)alert(T);
+if(V&&(V.select||V.focus))if(V.select)V.select();else V.focus();return false;}return true;};},notEmpty:function(S){return this.regex(P,S);},integer:function(S){return this.regex(Q,S);},number:function(S){return this.regex(R,S);},equals:function(S,T){return this.functions(function(U){return U==S;},T);},notEqual:function(S,T){return this.functions(function(U){return U!=S;},T);}};a.on('instanceDestroyed',function(S){if(e.isEmpty(a.instances)){var T;while(T=a.dialog._.currentTop)T.hide();F();}var U=S.editor._.storedDialogs;for(var V in U)U[V].destroy();});})();e.extend(a.editor.prototype,{openDialog:function(P,Q){if(this.mode=='wysiwyg'&&c){var R=this.getSelection();R&&R.lock();}var S=a.dialog._.dialogDefinitions[P],T=this.skin.dialog;if(a.dialog._.currentTop===null)D(this);if(typeof S=='function'&&T._isLoaded){var U=this._.storedDialogs||(this._.storedDialogs={}),V=U[P]||(U[P]=new a.dialog(this,P));Q&&Q.call(V,V);V.show();return V;}else if(S=='failed')throw new Error('[CKEDITOR.dialog.openDialog] Dialog "'+P+'" failed when loading definition.');var W=this;function X(Z){var aa=a.dialog._.dialogDefinitions[P],ab=W.skin.dialog;if(!ab._isLoaded||Y&&typeof Z=='undefined')return;if(typeof aa!='function')a.dialog._.dialogDefinitions[P]='failed';W.openDialog(P,Q);};if(typeof S=='string'){var Y=1;a.scriptLoader.load(a.getUrl(S),X,null,0,1);}a.skins.load(this,'dialog',X);return null;}});})();j.add('dialog',{requires:['dialogui']});j.add('styles',{requires:['selection'],init:function(m){m.on('contentDom',function(){m.document.setCustomData('cke_includeReadonly',!m.config.disableReadonlyStyling);});}});a.editor.prototype.attachStyleStateChange=function(m,n){var o=this._.styleStateChangeCallbacks;if(!o){o=this._.styleStateChangeCallbacks=[];this.on('selectionChange',function(p){for(var q=0;q<o.length;q++){var r=o[q],s=r.style.checkActive(p.data.path)?1:2;if(r.state!==s){r.fn.call(this,s);r.state=s;}}});}o.push({style:m,fn:n});};a.STYLE_BLOCK=1;a.STYLE_INLINE=2;a.STYLE_OBJECT=3;(function(){var m={address:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1},n={a:1,embed:1,hr:1,img:1,li:1,object:1,ol:1,table:1,td:1,tr:1,th:1,ul:1,dl:1,dt:1,dd:1,form:1},o=/\s*(?:;\s*|$)/,p=d.walker.bookmark(0,1);a.style=function(T,U){if(U){T=e.clone(T);L(T.attributes,U);L(T.styles,U);}var V=this.element=(T.element||'*').toLowerCase();this.type=V=='#'||m[V]?1:n[V]?3:2;this._={definition:T};};a.style.prototype={apply:function(T){S.call(this,T,false);},remove:function(T){S.call(this,T,true);},applyToRange:function(T){var U=this;
+return(U.applyToRange=U.type==2?r:U.type==1?v:U.type==3?t:null).call(U,T);},removeFromRange:function(T){var U=this;return(U.removeFromRange=U.type==2?s:U.type==1?w:U.type==3?u:null).call(U,T);},applyToObject:function(T){J(T,this);},checkActive:function(T){var X=this;switch(X.type){case 1:return X.checkElementRemovable(T.block||T.blockLimit,true);case 3:case 2:var U=T.elements;for(var V=0,W;V<U.length;V++){W=U[V];if(X.type==2&&(W==T.block||W==T.blockLimit))continue;if(X.type==3&&!(W.getName() in n))continue;if(X.checkElementRemovable(W,true))return true;}}return false;},checkApplicable:function(T){switch(this.type){case 2:case 1:break;case 3:return T.lastElement.getAscendant(this.element,true);}return true;},checkElementRemovable:function(T,U){if(!T)return false;var V=this._.definition,W;if(T.getName()==this.element){if(!U&&!T.hasAttributes())return true;W=M(V);if(W._length){for(var X in W){if(X=='_length')continue;var Y=T.getAttribute(X)||'';if(X=='style'?R(W[X],P(Y,false)):W[X]==Y){if(!U)return true;}else if(U)return false;}if(U)return true;}else return true;}var Z=N(this)[T.getName()];if(Z){if(!(W=Z.attributes))return true;for(var aa=0;aa<W.length;aa++){X=W[aa][0];var ab=T.getAttribute(X);if(ab){var ac=W[aa][1];if(ac===null||typeof ac=='string'&&ab==ac||ac.test(ab))return true;}}}return false;},buildPreview:function(){var T=this._.definition,U=[],V=T.element;if(V=='bdo')V='span';U=['<',V];var W=T.attributes;if(W)for(var X in W)U.push(' ',X,'="',W[X],'"');var Y=a.style.getStyleText(T);if(Y)U.push(' style="',Y,'"');U.push('>',T.name,'</',V,'>');return U.join('');}};a.style.getStyleText=function(T){var U=T._ST;if(U)return U;U=T.styles;var V=T.attributes&&T.attributes.style||'',W='';if(V.length)V=V.replace(o,';');for(var X in U){var Y=U[X],Z=(X+':'+Y).replace(o,';');if(Y=='inherit')W+=Z;else V+=Z;}if(V.length)V=P(V);V+=W;return T._ST=V;};function q(T){var U,V;while(T=T.getParent()){if(T.getName()=='body')break;if(T.getAttribute('data-nostyle'))U=T;else if(!V){var W=T.getAttribute('contentEditable');if(W=='false')U=T;else if(W=='true')V=1;}}return U;};function r(T){var ax=this;var U=T.document;if(T.collapsed){var V=I(ax,U);T.insertNode(V);T.moveToPosition(V,2);return;}var W=ax.element,X=ax._.definition,Y,Z=X.includeReadonly;if(Z==undefined)Z=U.getCustomData('cke_includeReadonly');var aa=f[W]||(Y=true,f.span);T.enlarge(1,1);T.trim();var ab=T.createBookmark(),ac=ab.startNode,ad=ab.endNode,ae=ac,af,ag=q(ac),ah=q(ad);if(ag)ae=ag.getNextSourceNode(true);if(ah)ad=ah;
+if(ae.getPosition(ad)==2)ae=0;while(ae){var ai=false;if(ae.equals(ad)){ae=null;ai=true;}else{var aj=ae.type,ak=aj==1?ae.getName():null,al=ak&&ae.getAttribute('contentEditable')=='false',am=ak&&ae.getAttribute('data-nostyle');if(ak&&ae.data('cke-bookmark')){ae=ae.getNextSourceNode(true);continue;}if(!ak||aa[ak]&&!am&&(!al||Z)&&(ae.getPosition(ad)|4|0|8)==4+0+8&&(!X.childRule||X.childRule(ae))){var an=ae.getParent();if(an&&((an.getDtd()||f.span)[W]||Y)&&(!X.parentRule||X.parentRule(an))){if(!af&&(!ak||!f.$removeEmpty[ak]||(ae.getPosition(ad)|4|0|8)==4+0+8)){af=new d.range(U);af.setStartBefore(ae);}if(aj==3||al||aj==1&&!ae.getChildCount()){var ao=ae,ap;while((ai=!ao.getNext(p))&&(ap=ao.getParent(),aa[ap.getName()])&&(ap.getPosition(ac)|2|0|8)==2+0+8&&(!X.childRule||X.childRule(ap)))ao=ap;af.setEndAfter(ao);}}else ai=true;}else ai=true;ae=ae.getNextSourceNode(am||al);}if(ai&&af&&!af.collapsed){var aq=I(ax,U),ar=aq.hasAttributes(),as=af.getCommonAncestor(),at={styles:{},attrs:{},blockedStyles:{},blockedAttrs:{}},au,av,aw;while(aq&&as){if(as.getName()==W){for(au in X.attributes){if(at.blockedAttrs[au]||!(aw=as.getAttribute(av)))continue;if(aq.getAttribute(au)==aw)at.attrs[au]=1;else at.blockedAttrs[au]=1;}for(av in X.styles){if(at.blockedStyles[av]||!(aw=as.getStyle(av)))continue;if(aq.getStyle(av)==aw)at.styles[av]=1;else at.blockedStyles[av]=1;}}as=as.getParent();}for(au in at.attrs)aq.removeAttribute(au);for(av in at.styles)aq.removeStyle(av);if(ar&&!aq.hasAttributes())aq=null;if(aq){af.extractContents().appendTo(aq);F(ax,aq);af.insertNode(aq);aq.mergeSiblings();if(!c)aq.$.normalize();}else{aq=new h('span');af.extractContents().appendTo(aq);af.insertNode(aq);F(ax,aq);aq.remove(true);}af=null;}}T.moveToBookmark(ab);T.shrink(2);};function s(T){T.enlarge(1,1);var U=T.createBookmark(),V=U.startNode;if(T.collapsed){var W=new d.elementPath(V.getParent()),X;for(var Y=0,Z;Y<W.elements.length&&(Z=W.elements[Y]);Y++){if(Z==W.block||Z==W.blockLimit)break;if(this.checkElementRemovable(Z)){var aa;if(T.collapsed&&(T.checkBoundaryOfElement(Z,2)||(aa=T.checkBoundaryOfElement(Z,1)))){X=Z;X.match=aa?'start':'end';}else{Z.mergeSiblings();E(this,Z);}}}if(X){var ab=V;for(Y=0;true;Y++){var ac=W.elements[Y];if(ac.equals(X))break;else if(ac.match)continue;else ac=ac.clone();ac.append(ab);ab=ac;}ab[X.match=='start'?'insertBefore':'insertAfter'](X);}}else{var ad=U.endNode,ae=this;function af(){var ai=new d.elementPath(V.getParent()),aj=new d.elementPath(ad.getParent()),ak=null,al=null;
+for(var am=0;am<ai.elements.length;am++){var an=ai.elements[am];if(an==ai.block||an==ai.blockLimit)break;if(ae.checkElementRemovable(an))ak=an;}for(am=0;am<aj.elements.length;am++){an=aj.elements[am];if(an==aj.block||an==aj.blockLimit)break;if(ae.checkElementRemovable(an))al=an;}if(al)ad.breakParent(al);if(ak)V.breakParent(ak);};af();var ag=V.getNext();while(!ag.equals(ad)){var ah=ag.getNextSourceNode();if(ag.type==1&&this.checkElementRemovable(ag)){if(ag.getName()==this.element)E(this,ag);else G(ag,N(this)[ag.getName()]);if(ah.type==1&&ah.contains(V)){af();ah=V.getNext();}}ag=ah;}}T.moveToBookmark(U);};function t(T){var U=T.getCommonAncestor(true,true),V=U.getAscendant(this.element,true);V&&J(V,this);};function u(T){var U=T.getCommonAncestor(true,true),V=U.getAscendant(this.element,true);if(!V)return;var W=this,X=W._.definition,Y=X.attributes,Z=a.style.getStyleText(X);if(Y)for(var aa in Y)V.removeAttribute(aa,Y[aa]);if(X.styles)for(var ab in X.styles){if(!X.styles.hasOwnProperty(ab))continue;V.removeStyle(ab);}};function v(T){var U=T.createBookmark(true),V=T.createIterator();V.enforceRealBlocks=true;if(this._.enterMode)V.enlargeBr=this._.enterMode!=2;var W,X=T.document,Y;while(W=V.getNextParagraph()){var Z=I(this,X,W);x(W,Z);}T.moveToBookmark(U);};function w(T){var Y=this;var U=T.createBookmark(1),V=T.createIterator();V.enforceRealBlocks=true;V.enlargeBr=Y._.enterMode!=2;var W;while(W=V.getNextParagraph()){if(Y.checkElementRemovable(W))if(W.is('pre')){var X=Y._.enterMode==2?null:T.document.createElement(Y._.enterMode==1?'p':'div');X&&W.copyAttributes(X);x(W,X);}else E(Y,W,1);}T.moveToBookmark(U);};function x(T,U){var V=!U;if(V){U=T.getDocument().createElement('div');T.copyAttributes(U);}var W=U&&U.is('pre'),X=T.is('pre'),Y=W&&!X,Z=!W&&X;if(Y)U=D(T,U);else if(Z)U=C(V?[T.getHtml()]:A(T),U);else T.moveChildren(U);U.replace(T);if(W)z(U);else if(V)H(U);};var y=d.walker.whitespaces(1);function z(T){var U;if(!((U=T.getPrevious(y))&&U.is&&U.is('pre')))return;var V=B(U.getHtml(),/\n$/,'')+'\n\n'+B(T.getHtml(),/^\n/,'');if(c)T.$.outerHTML='<pre>'+V+'</pre>';else T.setHtml(V);U.remove();};function A(T){var U=/(\S\s*)\n(?:\s|(<span[^>]+data-cke-bookmark.*?\/span>))*\n(?!$)/gi,V=T.getName(),W=B(T.getOuterHtml(),U,function(Y,Z,aa){return Z+'</pre>'+aa+'<pre>';}),X=[];W.replace(/<pre\b.*?>([\s\S]*?)<\/pre>/gi,function(Y,Z){X.push(Z);});return X;};function B(T,U,V){var W='',X='';T=T.replace(/(^<span[^>]+data-cke-bookmark.*?\/span>)|(<span[^>]+data-cke-bookmark.*?\/span>$)/gi,function(Y,Z,aa){Z&&(W=Z);
+aa&&(X=aa);return '';});return W+T.replace(U,V)+X;};function C(T,U){var V;if(T.length>1)V=new d.documentFragment(U.getDocument());for(var W=0;W<T.length;W++){var X=T[W];X=X.replace(/(\r\n|\r)/g,'\n');X=B(X,/^[ \t]*\n/,'');X=B(X,/\n$/,'');X=B(X,/^[ \t]+|[ \t]+$/g,function(Z,aa,ab){if(Z.length==1)return ' ';else if(!aa)return e.repeat(' ',Z.length-1)+' ';else return ' '+e.repeat(' ',Z.length-1);});X=X.replace(/\n/g,'<br>');X=X.replace(/[ \t]{2,}/g,function(Z){return e.repeat(' ',Z.length-1)+' ';});if(V){var Y=U.clone();Y.setHtml(X);V.append(Y);}else U.setHtml(X);}return V||U;};function D(T,U){var V=T.getBogus();V&&V.remove();var W=T.getHtml();W=B(W,/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g,'');W=W.replace(/[ \t\r\n]*(<br[^>]*>)[ \t\r\n]*/gi,'$1');W=W.replace(/([ \t\n\r]+| )/g,' ');W=W.replace(/<br\b[^>]*>/gi,'\n');if(c){var X=T.getDocument().createElement('div');X.append(U);U.$.outerHTML='<pre>'+W+'</pre>';U.copyAttributes(X.getFirst());U=X.getFirst().remove();}else U.setHtml(W);return U;};function E(T,U){var V=T._.definition,W=e.extend({},V.attributes,N(T)[U.getName()]),X=V.styles,Y=e.isEmpty(W)&&e.isEmpty(X);for(var Z in W){if((Z=='class'||T._.definition.fullMatch)&&U.getAttribute(Z)!=O(Z,W[Z]))continue;Y=U.hasAttribute(Z);U.removeAttribute(Z);}for(var aa in X){if(T._.definition.fullMatch&&U.getStyle(aa)!=O(aa,X[aa],true))continue;Y=Y||!!U.getStyle(aa);U.removeStyle(aa);}if(Y)!f.$block[U.getName()]||T._.enterMode==2&&!U.hasAttributes()?H(U):U.renameNode(T._.enterMode==1?'p':'div');};function F(T,U){var V=T._.definition,W=V.attributes,X=V.styles,Y=N(T),Z=U.getElementsByTag(T.element);for(var aa=Z.count();--aa>=0;)E(T,Z.getItem(aa));for(var ab in Y){if(ab!=T.element){Z=U.getElementsByTag(ab);for(aa=Z.count()-1;aa>=0;aa--){var ac=Z.getItem(aa);G(ac,Y[ab]);}}}};function G(T,U){var V=U&&U.attributes;if(V)for(var W=0;W<V.length;W++){var X=V[W][0],Y;if(Y=T.getAttribute(X)){var Z=V[W][1];if(Z===null||Z.test&&Z.test(Y)||typeof Z=='string'&&Y==Z)T.removeAttribute(X);}}H(T);};function H(T){if(!T.hasAttributes())if(f.$block[T.getName()]){var U=T.getPrevious(y),V=T.getNext(y);if(U&&(U.type==3||!U.isBlockBoundary({br:1})))T.append('br',1);if(V&&(V.type==3||!V.isBlockBoundary({br:1})))T.append('br');T.remove(true);}else{var W=T.getFirst(),X=T.getLast();T.remove(true);if(W){W.type==1&&W.mergeSiblings();if(X&&!W.equals(X)&&X.type==1)X.mergeSiblings();}}};function I(T,U,V){var W,X=T._.definition,Y=T.element;if(Y=='*')Y='span';W=new h(Y,U);if(V)V.copyAttributes(W);
+W=J(W,T);if(U.getCustomData('doc_processing_style')&&W.hasAttribute('id'))W.removeAttribute('id');else U.setCustomData('doc_processing_style',1);return W;};function J(T,U){var V=U._.definition,W=V.attributes,X=a.style.getStyleText(V);if(W)for(var Y in W)T.setAttribute(Y,W[Y]);if(X)T.setAttribute('style',X);return T;};var K=/#\((.+?)\)/g;function L(T,U){for(var V in T)T[V]=T[V].replace(K,function(W,X){return U[X];});};function M(T){var U=T._AC;if(U)return U;U={};var V=0,W=T.attributes;if(W)for(var X in W){V++;U[X]=W[X];}var Y=a.style.getStyleText(T);if(Y){if(!U.style)V++;U.style=Y;}U._length=V;return T._AC=U;};function N(T){if(T._.overrides)return T._.overrides;var U=T._.overrides={},V=T._.definition.overrides;if(V){if(!e.isArray(V))V=[V];for(var W=0;W<V.length;W++){var X=V[W],Y,Z,aa;if(typeof X=='string')Y=X.toLowerCase();else{Y=X.element?X.element.toLowerCase():T.element;aa=X.attributes;}Z=U[Y]||(U[Y]={});if(aa){var ab=Z.attributes=Z.attributes||[];for(var ac in aa)ab.push([ac.toLowerCase(),aa[ac]]);}}}return U;};function O(T,U,V){var W=new h('span');W[V?'setStyle':'setAttribute'](T,U);return W[V?'getStyle':'getAttribute'](T);};function P(T,U){var V;if(U!==false){var W=new h('span');W.setAttribute('style',T);V=W.getAttribute('style')||'';}else V=T;return V.replace(/\s*([;:])\s*/,'$1').replace(/([^\s;])$/,'$1;').replace(/,\s+/g,',').replace(/\"/g,'').toLowerCase();};function Q(T){var U={};T.replace(/"/g,'"').replace(/\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g,function(V,W,X){U[W]=X;});return U;};function R(T,U){typeof T=='string'&&(T=Q(T));typeof U=='string'&&(U=Q(U));for(var V in T){if(!(V in U&&(U[V]==T[V]||T[V]=='inherit'||U[V]=='inherit')))return false;}return true;};function S(T,U){var V=T.getSelection(),W=V.getRanges(),X=U?this.removeFromRange:this.applyToRange,Y,Z=W.createIterator();while(Y=Z.getNextRange())X.call(this,Y);V.selectRanges(W);T.removeCustomData('doc_processing_style');};})();a.styleCommand=function(m){this.style=m;};a.styleCommand.prototype.exec=function(m){var o=this;m.focus();var n=m.document;if(n)if(o.state==2)o.style.apply(n);else if(o.state==1)o.style.remove(n);return!!n;};a.stylesSet=new a.resourceManager('','stylesSet');a.addStylesSet=e.bind(a.stylesSet.add,a.stylesSet);a.loadStylesSet=function(m,n,o){a.stylesSet.addExternal(m,n,'');a.stylesSet.load(m,o);};a.editor.prototype.getStylesSet=function(m){if(!this._.stylesDefinitions){var n=this,o=n.config.stylesCombo_stylesSet||n.config.stylesSet||'default';if(o instanceof Array){n._.stylesDefinitions=o;
+m(o);return;}var p=o.split(':'),q=p[0],r=p[1],s=j.registered.styles.path;a.stylesSet.addExternal(q,r?p.slice(1).join(':'):s+'styles/'+q+'.js','');a.stylesSet.load(q,function(t){n._.stylesDefinitions=t[q];m(n._.stylesDefinitions);});}else m(this._.stylesDefinitions);};j.add('domiterator');(function(){function m(q){var r=this;if(arguments.length<1)return;r.range=q;r.forceBrBreak=0;r.enlargeBr=1;r.enforceRealBlocks=0;r._||(r._={});};var n=/^[\r\n\t ]+$/,o=d.walker.bookmark(false,true);function p(q,r,s){var t=q.getNextSourceNode(r,null,s);while(!o(t))t=t.getNextSourceNode(r,null,s);return t;};m.prototype={getNextParagraph:function(q){var Q=this;var r,s,t,u,v,w;if(!Q._.lastNode){s=Q.range.clone();s.shrink(1,true);u=s.endContainer.hasAscendant('pre',true)||s.startContainer.hasAscendant('pre',true);s.enlarge(Q.forceBrBreak&&!u||!Q.enlargeBr?3:2);var x=new d.walker(s),y=d.walker.bookmark(true,true);x.evaluator=y;Q._.nextNode=x.next();x=new d.walker(s);x.evaluator=y;var z=x.previous();Q._.lastNode=z.getNextSourceNode(true);if(Q._.lastNode&&Q._.lastNode.type==3&&!e.trim(Q._.lastNode.getText())&&Q._.lastNode.getParent().isBlockBoundary()){var A=new d.range(s.document);A.moveToPosition(Q._.lastNode,4);if(A.checkEndOfBlock()){var B=new d.elementPath(A.endContainer),C=B.block||B.blockLimit;Q._.lastNode=C.getNextSourceNode(true);}}if(!Q._.lastNode){Q._.lastNode=Q._.docEndMarker=s.document.createText('');Q._.lastNode.insertAfter(z);}s=null;}var D=Q._.nextNode;z=Q._.lastNode;Q._.nextNode=null;while(D){var E=0,F=D.hasAscendant('pre'),G=D.type!=1,H=0;if(!G){var I=D.getName();if(D.isBlockBoundary(Q.forceBrBreak&&!F&&{br:1})){if(I=='br')G=1;else if(!s&&!D.getChildCount()&&I!='hr'){r=D;t=D.equals(z);break;}if(s){s.setEndAt(D,3);if(I!='br')Q._.nextNode=D;}E=1;}else{if(D.getFirst()){if(!s){s=new d.range(Q.range.document);s.setStartAt(D,3);}D=D.getFirst();continue;}G=1;}}else if(D.type==3)if(n.test(D.getText()))G=0;if(G&&!s){s=new d.range(Q.range.document);s.setStartAt(D,3);}t=(!E||G)&&D.equals(z);if(s&&!E)while(!D.getNext(o)&&!t){var J=D.getParent();if(J.isBlockBoundary(Q.forceBrBreak&&!F&&{br:1})){E=1;t=t||J.equals(z);break;}D=J;G=1;t=D.equals(z);H=1;}if(G)s.setEndAt(D,4);D=p(D,H,z);t=!D;if(t||E&&s)break;}if(!r){if(!s){Q._.docEndMarker&&Q._.docEndMarker.remove();Q._.nextNode=null;return null;}var K=new d.elementPath(s.startContainer),L=K.blockLimit,M={div:1,th:1,td:1};r=K.block;if(!r&&!Q.enforceRealBlocks&&M[L.getName()]&&s.checkStartOfBlock()&&s.checkEndOfBlock())r=L;else if(!r||Q.enforceRealBlocks&&r.getName()=='li'){r=Q.range.document.createElement(q||'p');
+s.extractContents().appendTo(r);r.trim();s.insertNode(r);v=w=true;}else if(r.getName()!='li'){if(!s.checkStartOfBlock()||!s.checkEndOfBlock()){r=r.clone(false);s.extractContents().appendTo(r);r.trim();var N=s.splitBlock();v=!N.wasStartOfBlock;w=!N.wasEndOfBlock;s.insertNode(r);}}else if(!t)Q._.nextNode=r.equals(z)?null:p(s.getBoundaryNodes().endNode,1,z);}if(v){var O=r.getPrevious();if(O&&O.type==1)if(O.getName()=='br')O.remove();else if(O.getLast()&&O.getLast().$.nodeName.toLowerCase()=='br')O.getLast().remove();}if(w){var P=r.getLast();if(P&&P.type==1&&P.getName()=='br')if(c||P.getPrevious(o)||P.getNext(o))P.remove();}if(!Q._.nextNode)Q._.nextNode=t||r.equals(z)?null:p(r,1,z);return r;}};d.range.prototype.createIterator=function(){return new m(this);};})();j.add('panelbutton',{requires:['button'],beforeInit:function(m){m.ui.addHandler(4,k.panelButton.handler);}});a.UI_PANELBUTTON=4;(function(){var m=function(n){var p=this;var o=p._;if(o.state==0)return;p.createPanel(n);if(o.on){o.panel.hide();return;}o.panel.showBlock(p._.id,p.document.getById(p._.id),4);};k.panelButton=e.createClass({base:k.button,$:function(n){var p=this;var o=n.panel;delete n.panel;p.base(n);p.document=o&&o.parent&&o.parent.getDocument()||a.document;o.block={attributes:o.attributes};p.hasArrow=true;p.click=m;p._={panelDefinition:o};},statics:{handler:{create:function(n){return new k.panelButton(n);}}},proto:{createPanel:function(n){var o=this._;if(o.panel)return;var p=this._.panelDefinition||{},q=this._.panelDefinition.block,r=p.parent||a.document.getBody(),s=this._.panel=new k.floatPanel(n,r,p),t=s.addBlock(o.id,q),u=this;s.onShow=function(){if(u.className)this.element.getFirst().addClass(u.className+'_panel');u.setState(1);o.on=1;if(u.onOpen)u.onOpen();};s.onHide=function(v){if(u.className)this.element.getFirst().removeClass(u.className+'_panel');u.setState(u.modes&&u.modes[n.mode]?2:0);o.on=0;if(!v&&u.onClose)u.onClose();};s.onEscape=function(){s.hide();u.document.getById(o.id).focus();};if(this.onBlock)this.onBlock(s,t);t.onHide=function(){o.on=0;u.setState(2);};}}});})();j.add('floatpanel',{requires:['panel']});(function(){var m={},n=false;function o(p,q,r,s,t){var u=e.genKey(q.getUniqueId(),r.getUniqueId(),p.skinName,p.lang.dir,p.uiColor||'',s.css||'',t||''),v=m[u];if(!v){v=m[u]=new k.panel(q,s);v.element=r.append(h.createFromHtml(v.renderHtml(p),q));v.element.setStyles({display:'none',position:'absolute'});}return v;};k.floatPanel=e.createClass({$:function(p,q,r,s){r.forceIFrame=1;
+var t=q.getDocument(),u=o(p,t,q,r,s||0),v=u.element,w=v.getFirst().getFirst();this.element=v;this._={panel:u,parentElement:q,definition:r,document:t,iframe:w,children:[],dir:p.lang.dir};p.on('mode',function(){this.hide();},this);},proto:{addBlock:function(p,q){return this._.panel.addBlock(p,q);},addListBlock:function(p,q){return this._.panel.addListBlock(p,q);},getBlock:function(p){return this._.panel.getBlock(p);},showBlock:function(p,q,r,s,t){var u=this._.panel,v=u.showBlock(p);this.allowBlur(false);n=1;var w=this.element,x=this._.iframe,y=this._.definition,z=q.getDocumentPosition(w.getDocument()),A=this._.dir=='rtl',B=z.x+(s||0),C=z.y+(t||0);if(A&&(r==1||r==4))B+=q.$.offsetWidth;else if(!A&&(r==2||r==3))B+=q.$.offsetWidth-1;if(r==3||r==4)C+=q.$.offsetHeight-1;this._.panel._.offsetParentId=q.getId();w.setStyles({top:C+'px',left:0,display:''});w.setOpacity(0);w.getFirst().removeStyle('width');if(!this._.blurSet){var D=c?x:new d.window(x.$.contentWindow);a.event.useCapture=true;D.on('blur',function(E){var G=this;if(!G.allowBlur())return;var F;if(c&&!G.allowBlur()||(F=E.data.getTarget())&&F.getName&&F.getName()!='iframe')return;if(G.visible&&!G._.activeChild&&!n)G.hide();},this);D.on('focus',function(){this._.focused=true;this.hideChild();this.allowBlur(true);},this);a.event.useCapture=false;this._.blurSet=1;}u.onEscape=e.bind(function(E){if(this.onEscape&&this.onEscape(E)===false)return false;},this);e.setTimeout(function(){if(A)B-=w.$.offsetWidth;var E=e.bind(function(){var F=w.getFirst();if(v.autoSize){var G=v.element.$;if(b.gecko||b.opera)G=G.parentNode;if(c)G=G.document.body;var H=G.scrollWidth;if(c&&b.quirks&&H>0)H+=(F.$.offsetWidth||0)-(F.$.clientWidth||0);H+=4;F.setStyle('width',H+'px');v.element.addClass('cke_frameLoaded');var I=v.element.$.scrollHeight;if(c&&b.quirks&&I>0)I+=(F.$.offsetHeight||0)-(F.$.clientHeight||0);F.setStyle('height',I+'px');u._.currentBlock.element.setStyle('display','none').removeStyle('display');}else F.removeStyle('height');var J=u.element,K=J.getWindow(),L=K.getScrollPosition(),M=K.getViewPaneSize(),N={height:J.$.offsetHeight,width:J.$.offsetWidth};if(A?B<0:B+N.width>M.width+L.x)B+=N.width*(A?1:-1);if(C+N.height>M.height+L.y)C-=N.height;if(c){var O=new h(w.$.offsetParent),P=O;if(P.getName()=='html')P=P.getDocument().getBody();if(P.getComputedStyle('direction')=='rtl')if(b.ie8Compat)B-=w.getDocument().getDocumentElement().$.scrollLeft*2;else B-=O.$.scrollWidth-O.$.clientWidth;}var Q=w.getFirst(),R;if(R=Q.getCustomData('activePanel'))R.onHide&&R.onHide.call(this,1);
+Q.setCustomData('activePanel',this);w.setStyles({top:C+'px',left:B+'px'});w.setOpacity(1);},this);u.isLoaded?E():u.onLoad=E;e.setTimeout(function(){x.$.contentWindow.focus();this.allowBlur(true);},0,this);},b.air?200:0,this);this.visible=1;if(this.onShow)this.onShow.call(this);n=0;},hide:function(){var p=this;if(p.visible&&(!p.onHide||p.onHide.call(p)!==true)){p.hideChild();p.element.setStyle('display','none');p.visible=0;p.element.getFirst().removeCustomData('activePanel');}},allowBlur:function(p){var q=this._.panel;if(p!=undefined)q.allowBlur=p;return q.allowBlur;},showAsChild:function(p,q,r,s,t,u){if(this._.activeChild==p&&p._.panel._.offsetParentId==r.getId())return;this.hideChild();p.onHide=e.bind(function(){e.setTimeout(function(){if(!this._.focused)this.hide();},0,this);},this);this._.activeChild=p;this._.focused=false;p.showBlock(q,r,s,t,u);if(b.ie7Compat||b.ie8&&b.ie6Compat)setTimeout(function(){p.element.getChild(0).$.style.cssText+='';},100);},hideChild:function(){var p=this._.activeChild;if(p){delete p.onHide;delete this._.activeChild;p.hide();}}}});a.on('instanceDestroyed',function(){var p=e.isEmpty(a.instances);for(var q in m){var r=m[q];if(p)r.destroy();else r.element.hide();}p&&(m={});});})();j.add('menu',{beforeInit:function(m){var n=m.config.menu_groups.split(','),o=m._.menuGroups={},p=m._.menuItems={};for(var q=0;q<n.length;q++)o[n[q]]=q+1;m.addMenuGroup=function(r,s){o[r]=s||100;};m.addMenuItem=function(r,s){if(o[s.group])p[r]=new a.menuItem(this,r,s);};m.addMenuItems=function(r){for(var s in r)this.addMenuItem(s,r[s]);};m.getMenuItem=function(r){return p[r];};},requires:['floatpanel']});(function(){a.menu=e.createClass({$:function(n,o){var r=this;o=r._.definition=o||{};r.id=e.getNextId();r.editor=n;r.items=[];r._.listeners=[];r._.level=o.level||1;var p=e.extend({},o.panel,{css:n.skin.editor.css,level:r._.level-1,block:{}}),q=p.block.attributes=p.attributes||{};!q.role&&(q.role='menu');r._.panelDefinition=p;},_:{onShow:function(){var v=this;var n=v.editor.getSelection();if(c)n&&n.lock();var o=n&&n.getStartElement(),p=v._.listeners,q=[];v.removeAll();for(var r=0;r<p.length;r++){var s=p[r](o,n);if(s)for(var t in s){var u=v.editor.getMenuItem(t);if(u){u.state=s[t];v.add(u);}}}},onClick:function(n){this.hide();if(n.onClick)n.onClick();else if(n.command)this.editor.execCommand(n.command);},onEscape:function(n){var o=this.parent;if(o){o._.panel.hideChild();var p=o._.panel._.panel._.currentBlock,q=p._.focusIndex;p._.markItem(q);}else if(n==27){this.hide();
+this.editor.focus();}return false;},onHide:function(){if(c){var n=this.editor.getSelection();n&&n.unlock();}this.onHide&&this.onHide();},showSubMenu:function(n){var v=this;var o=v._.subMenu,p=v.items[n],q=p.getItems&&p.getItems();if(!q){v._.panel.hideChild();return;}var r=v._.panel.getBlock(v.id);r._.focusIndex=n;if(o)o.removeAll();else{o=v._.subMenu=new a.menu(v.editor,e.extend({},v._.definition,{level:v._.level+1},true));o.parent=v;o._.onClick=e.bind(v._.onClick,v);}for(var s in q){var t=v.editor.getMenuItem(s);if(t){t.state=q[s];o.add(t);}}var u=v._.panel.getBlock(v.id).element.getDocument().getById(v.id+String(n));o.show(u,2);}},proto:{add:function(n){if(!n.order)n.order=this.items.length;this.items.push(n);},removeAll:function(){this.items=[];},show:function(n,o,p,q){if(!this.parent){this._.onShow();if(!this.items.length)return;}o=o||(this.editor.lang.dir=='rtl'?2:1);var r=this.items,s=this.editor,t=this._.panel,u=this._.element;if(!t){t=this._.panel=new k.floatPanel(this.editor,a.document.getBody(),this._.panelDefinition,this._.level);t.onEscape=e.bind(function(F){if(this._.onEscape(F)===false)return false;},this);t.onHide=e.bind(function(){this._.onHide&&this._.onHide();},this);var v=t.addBlock(this.id,this._.panelDefinition.block);v.autoSize=true;var w=v.keys;w[40]='next';w[9]='next';w[38]='prev';w[2000+9]='prev';w[32]='click';w[s.lang.dir=='rtl'?37:39]='click';u=this._.element=v.element;u.addClass(s.skinClass);var x=u.getDocument();x.getBody().setStyle('overflow','hidden');x.getElementsByTag('html').getItem(0).setStyle('overflow','hidden');this._.itemOverFn=e.addFunction(function(F){var G=this;clearTimeout(G._.showSubTimeout);G._.showSubTimeout=e.setTimeout(G._.showSubMenu,s.config.menu_subMenuDelay||400,G,[F]);},this);this._.itemOutFn=e.addFunction(function(F){clearTimeout(this._.showSubTimeout);},this);this._.itemClickFn=e.addFunction(function(F){var H=this;var G=H.items[F];if(G.state==0){H.hide();return;}if(G.getItems)H._.showSubMenu(F);else H._.onClick(G);},this);}m(r);var y=s.container.getChild(1),z=y.hasClass('cke_mixed_dir_content')?' cke_mixed_dir_content':'',A=['<div class="cke_menu'+z+'" role="presentation">'],B=r.length,C=B&&r[0].group;for(var D=0;D<B;D++){var E=r[D];if(C!=E.group){A.push('<div class="cke_menuseparator" role="separator"></div>');C=E.group;}E.render(this,D,A);}A.push('</div>');u.setHtml(A.join(''));k.fire('ready',this);if(this.parent)this.parent._.panel.showAsChild(t,this.id,n,o,p,q);else t.showBlock(this.id,n,o,p,q);s.fire('menuShow',[t]);
+},addListener:function(n){this._.listeners.push(n);},hide:function(){var n=this;n._.onHide&&n._.onHide();n._.panel&&n._.panel.hide();}}});function m(n){n.sort(function(o,p){if(o.group<p.group)return-1;else if(o.group>p.group)return 1;return o.order<p.order?-1:o.order>p.order?1:0;});};a.menuItem=e.createClass({$:function(n,o,p){var q=this;e.extend(q,p,{order:0,className:'cke_button_'+o});q.group=n._.menuGroups[q.group];q.editor=n;q.name=o;},proto:{render:function(n,o,p){var w=this;var q=n.id+String(o),r=typeof w.state=='undefined'?2:w.state,s=' cke_'+(r==1?'on':r==0?'disabled':'off'),t=w.label;if(w.className)s+=' '+w.className;var u=w.getItems;p.push('<span class="cke_menuitem'+(w.icon&&w.icon.indexOf('.png')==-1?' cke_noalphafix':'')+'">'+'<a id="',q,'" class="',s,'" href="javascript:void(\'',(w.label||'').replace("'",''),'\')" title="',w.label,'" tabindex="-1"_cke_focus=1 hidefocus="true" role="menuitem"'+(u?'aria-haspopup="true"':'')+(r==0?'aria-disabled="true"':'')+(r==1?'aria-pressed="true"':''));if(b.opera||b.gecko&&b.mac)p.push(' onkeypress="return false;"');if(b.gecko)p.push(' onblur="this.style.cssText = this.style.cssText;"');var v=(w.iconOffset||0)*-16;p.push(' onmouseover="CKEDITOR.tools.callFunction(',n._.itemOverFn,',',o,');" onmouseout="CKEDITOR.tools.callFunction(',n._.itemOutFn,',',o,');" onclick="CKEDITOR.tools.callFunction(',n._.itemClickFn,',',o,'); return false;"><span class="cke_icon_wrapper"><span class="cke_icon"'+(w.icon?' style="background-image:url('+a.getUrl(w.icon)+');background-position:0 '+v+'px;"':'')+'></span></span>'+'<span class="cke_label">');if(u)p.push('<span class="cke_menuarrow">','<span>&#',w.editor.lang.dir=='rtl'?'9668':'9658',';</span>','</span>');p.push(t,'</span></a></span>');}}});})();i.menu_groups='clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea,div';(function(){var m=function(o,p){return o._.modes&&o._.modes[p||o.mode];},n;j.add('editingblock',{init:function(o){if(!o.config.editingBlock)return;o.on('themeSpace',function(p){if(p.data.space=='contents')p.data.html+='<br>';});o.on('themeLoaded',function(){o.fireOnce('editingBlockReady');});o.on('uiReady',function(){o.setMode(o.config.startupMode);});o.on('afterSetData',function(){if(!n){function p(){n=true;m(o).loadData(o.getData());n=false;};if(o.mode)p();else o.on('mode',function(){p();o.removeListener('mode',arguments.callee);});}});o.on('beforeGetData',function(){if(!n&&o.mode){n=true;
+o.setData(m(o).getData(),null,1);n=false;}});o.on('getSnapshot',function(p){if(o.mode)p.data=m(o).getSnapshotData();});o.on('loadSnapshot',function(p){if(o.mode)m(o).loadSnapshotData(p.data);});o.on('mode',function(p){p.removeListener();b.webkit&&o.container.on('focus',function(){o.focus();});if(o.config.startupFocus)o.focus();setTimeout(function(){o.fireOnce('instanceReady');a.fire('instanceReady',null,o);},0);});o.on('destroy',function(){var p=this;if(p.mode)p._.modes[p.mode].unload(p.getThemeSpace('contents'));});}});a.editor.prototype.mode='';a.editor.prototype.addMode=function(o,p){p.name=o;(this._.modes||(this._.modes={}))[o]=p;};a.editor.prototype.setMode=function(o){var p,q=this.getThemeSpace('contents'),r=this.checkDirty();if(this.mode){if(o==this.mode)return;this.fire('beforeModeUnload');var s=m(this);p=s.getData();s.unload(q);this.mode='';}q.setHtml('');var t=m(this,o);if(!t)throw '[CKEDITOR.editor.setMode] Unknown mode "'+o+'".';if(!r)this.on('mode',function(){this.resetDirty();this.removeListener('mode',arguments.callee);});t.load(q,typeof p!='string'?this.getData():p);};a.editor.prototype.focus=function(){var o=m(this);if(o)o.focus();};})();i.startupMode='wysiwyg';i.editingBlock=true;(function(){function m(){var w=this;try{var t=w.getSelection();if(!t||!t.document.getWindow().$)return;var u=t.getStartElement(),v=new d.elementPath(u);if(!v.compare(w._.selectionPreviousPath)){w._.selectionPreviousPath=v;w.fire('selectionChange',{selection:t,path:v,element:u});}}catch(x){}};var n,o;function p(){o=true;if(n)return;q.call(this);n=e.setTimeout(q,200,this);};function q(){n=null;if(o){e.setTimeout(m,0,this);o=false;}};var r={modes:{wysiwyg:1,source:1},exec:function(t){switch(t.mode){case 'wysiwyg':t.document.$.execCommand('SelectAll',false,null);t.forceNextSelectionCheck();t.selectionChange();break;case 'source':var u=t.textarea.$;if(c)u.createTextRange().execCommand('SelectAll');else{u.selectionStart=0;u.selectionEnd=u.value.length;}u.focus();}},canUndo:false};j.add('selection',{init:function(t){t.on('contentDom',function(){var u=t.document,v=u.getBody(),w=u.getDocumentElement();if(c){var x,y,z=1;v.on('focusin',function(D){if(D.data.$.srcElement.nodeName!='BODY')return;if(x){var E=u.getCustomData('cke_locked_selection');if(z&&!E)try{x.select();}catch(F){}x=null;}});v.on('focus',function(){y=1;C();});v.on('beforedeactivate',function(D){if(D.data.$.toElement)return;y=0;z=1;});if(c&&b.version<8)t.on('blur',function(D){try{t.document&&t.document.$.selection.empty();
+}catch(E){}});w.on('mousedown',function(){z=0;});w.on('mouseup',function(){z=1;});if(c&&(b.ie7Compat||b.version<8||b.quirks))w.on('click',function(D){if(D.data.getTarget().getName()=='html')t.getSelection().getRanges()[0].select();});var A;v.on('mousedown',function(D){if(D.data.$.button==2){var E=t.document.$.selection;if(E.type=='None')A=t.window.getScrollPosition();}B();});v.on('mouseup',function(D){if(D.data.$.button==2&&A){t.document.$.documentElement.scrollLeft=A.x;t.document.$.documentElement.scrollTop=A.y;}A=null;y=1;setTimeout(function(){C(true);},0);});v.on('keydown',B);v.on('keyup',function(){y=1;C();});u.on('selectionchange',C);function B(){y=0;};function C(D){if(y){var E=t.document,F=t.getSelection(),G=F&&F.getNative();if(D&&G&&G.type=='None')if(!E.$.queryCommandEnabled('InsertImage')){e.setTimeout(C,50,this,true);return;}var H;if(G&&G.type&&G.type!='Control'&&(H=G.createRange())&&(H=H.parentElement())&&(H=H.nodeName)&&H.toLowerCase() in {input:1,textarea:1})return;x=G&&F.getRanges()[0];p.call(t);}};}else{u.on('mouseup',p,t);u.on('keyup',p,t);}});t.on('contentDomUnload',t.forceNextSelectionCheck,t);t.addCommand('selectAll',r);t.ui.addButton('SelectAll',{label:t.lang.selectAll,command:'selectAll'});t.selectionChange=p;}});a.editor.prototype.getSelection=function(){return this.document&&this.document.getSelection();};a.editor.prototype.forceNextSelectionCheck=function(){delete this._.selectionPreviousPath;};g.prototype.getSelection=function(){var t=new d.selection(this);return!t||t.isInvalid?null:t;};a.SELECTION_NONE=1;a.SELECTION_TEXT=2;a.SELECTION_ELEMENT=3;d.selection=function(t){var w=this;var u=t.getCustomData('cke_locked_selection');if(u)return u;w.document=t;w.isLocked=0;w._={cache:{}};if(c){var v=w.getNative().createRange();if(!v||v.item&&v.item(0).ownerDocument!=w.document.$||v.parentElement&&v.parentElement().ownerDocument!=w.document.$)w.isInvalid=true;}return w;};var s={img:1,hr:1,li:1,table:1,tr:1,td:1,th:1,embed:1,object:1,ol:1,ul:1,a:1,input:1,form:1,select:1,textarea:1,button:1,fieldset:1,th:1,thead:1,tfoot:1};d.selection.prototype={getNative:c?function(){return this._.cache.nativeSel||(this._.cache.nativeSel=this.document.$.selection);}:function(){return this._.cache.nativeSel||(this._.cache.nativeSel=this.document.getWindow().$.getSelection());},getType:c?function(){var t=this._.cache;if(t.type)return t.type;var u=1;try{var v=this.getNative(),w=v.type;if(w=='Text')u=2;if(w=='Control')u=3;if(v.createRange().parentElement)u=2;}catch(x){}return t.type=u;
+}:function(){var t=this._.cache;if(t.type)return t.type;var u=2,v=this.getNative();if(!v)u=1;else if(v.rangeCount==1){var w=v.getRangeAt(0),x=w.startContainer;if(x==w.endContainer&&x.nodeType==1&&w.endOffset-w.startOffset==1&&s[x.childNodes[w.startOffset].nodeName.toLowerCase()])u=3;}return t.type=u;},getRanges:(function(){var t=c?(function(){function u(w){return new d.node(w).getIndex();};var v=function(w,x){w=w.duplicate();w.collapse(x);var y=w.parentElement();if(!y.hasChildNodes())return{container:y,offset:0};var z=y.children,A,B=w.duplicate(),C=0,D=z.length-1,E=-1,F,G;while(C<=D){E=Math.floor((C+D)/2);A=z[E];B.moveToElementText(A);F=B.compareEndPoints('StartToStart',w);if(F>0)D=E-1;else if(F<0)C=E+1;else return{container:y,offset:u(A)};}if(E==-1||E==z.length-1&&F<0){B.moveToElementText(y);B.setEndPoint('StartToStart',w);G=B.text.replace(/(\r\n|\r)/g,'\n').length;z=y.childNodes;if(!G){A=z[z.length-1];if(A.nodeType==1)return{container:y,offset:z.length};else return{container:A,offset:A.nodeValue.length};}var H=z.length;while(G>0)G-=z[--H].nodeValue.length;return{container:z[H],offset:-G};}else{B.collapse(F>0?true:false);B.setEndPoint(F>0?'StartToStart':'EndToStart',w);G=B.text.replace(/(\r\n|\r)/g,'\n').length;if(!G)return{container:y,offset:u(A)+(F>0?0:1)};while(G>0){A=A[F>0?'previousSibling':'nextSibling'];try{G-=A.nodeValue.length;}catch(I){return{container:y,offset:u(A)};}}return{container:A,offset:F>0?-G:A.nodeValue.length+G};}};return function(){var G=this;var w=G.getNative(),x=w&&w.createRange(),y=G.getType(),z;if(!w)return[];if(y==2){z=new d.range(G.document);var A=v(x,true);z.setStart(new d.node(A.container),A.offset);A=v(x);z.setEnd(new d.node(A.container),A.offset);if(z.endContainer.getPosition(z.startContainer)&4&&z.endOffset<=z.startContainer.getIndex())z.collapse();return[z];}else if(y==3){var B=[];for(var C=0;C<x.length;C++){var D=x.item(C),E=D.parentNode,F=0;z=new d.range(G.document);for(;F<E.childNodes.length&&E.childNodes[F]!=D;F++){}z.setStart(new d.node(E),F);z.setEnd(new d.node(E),F+1);B.push(z);}return B;}return[];};})():function(){var u=[],v,w=this.document,x=this.getNative();if(!x)return u;if(!x.rangeCount){v=new d.range(w);v.moveToElementEditStart(w.getBody());u.push(v);}for(var y=0;y<x.rangeCount;y++){var z=x.getRangeAt(y);v=new d.range(w);v.setStart(new d.node(z.startContainer),z.startOffset);v.setEnd(new d.node(z.endContainer),z.endOffset);u.push(v);}return u;};return function(u){var v=this._.cache;if(v.ranges&&!u)return v.ranges;
+else if(!v.ranges)v.ranges=new d.rangeList(t.call(this));if(u){var w=v.ranges;for(var x=0;x<w.length;x++){var y=w[x],z=y.getCommonAncestor();if(z.isReadOnly())w.splice(x,1);if(y.collapsed)continue;var A=y.startContainer,B=y.endContainer,C=y.startOffset,D=y.endOffset,E=y.clone(),F;if(F=A.isReadOnly())y.setStartAfter(F);if(A&&A.type==3)if(C>=A.getLength())E.setStartAfter(A);else E.setStartBefore(A);if(B&&B.type==3)if(!D)E.setEndBefore(B);else E.setEndAfter(B);var G=new d.walker(E);G.evaluator=function(H){if(H.type==1&&H.isReadOnly()){var I=y.clone();y.setEndBefore(H);if(y.collapsed)w.splice(x--,1);if(!(H.getPosition(E.endContainer)&16)){I.setStartAfter(H);if(!I.collapsed)w.splice(x+1,0,I);}return true;}return false;};G.next();}}return v.ranges;};})(),getStartElement:function(){var A=this;var t=A._.cache;if(t.startElement!==undefined)return t.startElement;var u,v=A.getNative();switch(A.getType()){case 3:return A.getSelectedElement();case 2:var w=A.getRanges()[0];if(w){if(!w.collapsed){w.optimize();while(1){var x=w.startContainer,y=w.startOffset;if(y==(x.getChildCount?x.getChildCount():x.getLength())&&!x.isBlockBoundary())w.setStartAfter(x);else break;}u=w.startContainer;if(u.type!=1)return u.getParent();u=u.getChild(w.startOffset);if(!u||u.type!=1)u=w.startContainer;else{var z=u.getFirst();while(z&&z.type==1){u=z;z=z.getFirst();}}}else{u=w.startContainer;if(u.type!=1)u=u.getParent();}u=u.$;}}return t.startElement=u?new h(u):null;},getSelectedElement:function(){var t=this._.cache;if(t.selectedElement!==undefined)return t.selectedElement;var u=this,v=e.tryThese(function(){return u.getNative().createRange().item(0);},function(){var w=u.getRanges()[0],x,y;for(var z=2;z&&!((x=w.getEnclosedNode())&&x.type==1&&s[x.getName()]&&(y=x));z--)w.shrink(1);return y.$;});return t.selectedElement=v?new h(v):null;},lock:function(){var t=this;t.getRanges();t.getStartElement();t.getSelectedElement();t._.cache.nativeSel={};t.isLocked=1;t.document.setCustomData('cke_locked_selection',t);},unlock:function(t){var y=this;var u=y.document,v=u.getCustomData('cke_locked_selection');if(v){u.setCustomData('cke_locked_selection',null);if(t){var w=v.getSelectedElement(),x=!w&&v.getRanges();y.isLocked=0;y.reset();u.getBody().focus();if(w)y.selectElement(w);else y.selectRanges(x);}}if(!v||!t){y.isLocked=0;y.reset();}},reset:function(){this._.cache={};},selectElement:function(t){var w=this;if(w.isLocked){var u=new d.range(w.document);u.setStartBefore(t);u.setEndAfter(t);w._.cache.selectedElement=t;
+w._.cache.startElement=t;w._.cache.ranges=new d.rangeList(u);w._.cache.type=3;return;}if(c){w.getNative().empty();try{u=w.document.$.body.createControlRange();u.addElement(t.$);u.select();}catch(x){u=w.document.$.body.createTextRange();u.moveToElementText(t.$);u.select();}finally{w.document.fire('selectionchange');}w.reset();}else{u=w.document.$.createRange();u.selectNode(t.$);var v=w.getNative();v.removeAllRanges();v.addRange(u);w.reset();}},selectRanges:function(t){var F=this;if(F.isLocked){F._.cache.selectedElement=null;F._.cache.startElement=t[0]&&t[0].getTouchedStartNode();F._.cache.ranges=new d.rangeList(t);F._.cache.type=2;return;}if(c){if(t.length>1){var u=t[t.length-1];t[0].setEnd(u.endContainer,u.endOffset);t.length=1;}if(t[0])t[0].select();F.reset();}else{var v=F.getNative();if(t.length)v.removeAllRanges();for(var w=0;w<t.length;w++){if(w<t.length-1){var x=t[w],y=t[w+1],z=x.clone();z.setStart(x.endContainer,x.endOffset);z.setEnd(y.startContainer,y.startOffset);if(!z.collapsed){z.shrink(1,true);var A=z.getCommonAncestor(),B=z.getEnclosedNode();if(A.isReadOnly()||B&&B.isReadOnly()){y.setStart(x.startContainer,x.startOffset);t.splice(w--,1);continue;}}}var C=t[w],D=F.document.$.createRange(),E=C.startContainer;if(C.collapsed&&(b.opera||b.gecko&&b.version<10900)&&E.type==1&&!E.getChildCount())E.appendText('');D.setStart(E.$,C.startOffset);D.setEnd(C.endContainer.$,C.endOffset);v.addRange(D);}F.reset();}},createBookmarks:function(t){return this.getRanges().createBookmarks(t);},createBookmarks2:function(t){return this.getRanges().createBookmarks2(t);},selectBookmarks:function(t){var u=[];for(var v=0;v<t.length;v++){var w=new d.range(this.document);w.moveToBookmark(t[v]);u.push(w);}this.selectRanges(u);return this;},getCommonAncestor:function(){var t=this.getRanges(),u=t[0].startContainer,v=t[t.length-1].endContainer;return u.getCommonAncestor(v);},scrollIntoView:function(){var t=this.getStartElement();t.scrollIntoView();}};})();(function(){var m=d.walker.whitespaces(true),n=/\ufeff|\u00a0/,o={table:1,tbody:1,tr:1};d.range.prototype.select=c?function(p){var z=this;var q=z.collapsed,r,s;if(z.startContainer.type==1&&z.startContainer.getName() in o||z.endContainer.type==1&&z.endContainer.getName() in o)z.shrink(1,true);var t=z.createBookmark(),u=t.startNode,v;if(!q)v=t.endNode;var w=z.document.$.body.createTextRange();w.moveToElementText(u.$);w.moveStart('character',1);if(v){var x=z.document.$.body.createTextRange();x.moveToElementText(v.$);w.setEndPoint('EndToEnd',x);
+w.moveEnd('character',-1);}else{var y=u.getNext(m);r=!(y&&y.getText&&y.getText().match(n))&&(p||!u.hasPrevious()||u.getPrevious().is&&u.getPrevious().is('br'));s=z.document.createElement('span');s.setHtml('');s.insertBefore(u);if(r)z.document.createText('\ufeff').insertBefore(u);}z.setStartBefore(u);u.remove();if(q){if(r){w.moveStart('character',-1);w.select();z.document.$.selection.clear();}else w.select();z.moveToPosition(s,3);s.remove();}else{z.setEndBefore(v);v.remove();w.select();}z.document.fire('selectionchange');}:function(){var s=this;var p=s.startContainer;if(s.collapsed&&p.type==1&&!p.getChildCount())p.append(new d.text(''));var q=s.document.$.createRange();q.setStart(p.$,s.startOffset);try{q.setEnd(s.endContainer.$,s.endOffset);}catch(t){if(t.toString().indexOf('NS_ERROR_ILLEGAL_VALUE')>=0){s.collapse(true);q.setEnd(s.endContainer.$,s.endOffset);}else throw t;}var r=s.document.getSelection().getNative();if(r){r.removeAllRanges();r.addRange(q);}};})();(function(){var m={elements:{$:function(n){var o=n.attributes,p=o&&o['data-cke-realelement'],q=p&&new a.htmlParser.fragment.fromHtml(decodeURIComponent(p)),r=q&&q.children[0];if(r&&n.attributes['data-cke-resizable']){var s=n.attributes.style;if(s){var t=/(?:^|\s)width\s*:\s*(\d+)/i.exec(s),u=t&&t[1];t=/(?:^|\s)height\s*:\s*(\d+)/i.exec(s);var v=t&&t[1];if(u)r.attributes.width=u;if(v)r.attributes.height=v;}}return r;}}};j.add('fakeobjects',{requires:['htmlwriter'],afterInit:function(n){var o=n.dataProcessor,p=o&&o.htmlFilter;if(p)p.addRules(m);}});})();a.editor.prototype.createFakeElement=function(m,n,o,p){var q=this.lang.fakeobjects,r=q[o]||q.unknown,s={'class':n,src:a.getUrl('images/spacer.gif'),'data-cke-realelement':encodeURIComponent(m.getOuterHtml()),'data-cke-real-node-type':m.type,alt:r,title:r,align:m.getAttribute('align')||''};if(o)s['data-cke-real-element-type']=o;if(p)s['data-cke-resizable']=p;return this.document.createElement('img',{attributes:s});};a.editor.prototype.createFakeParserElement=function(m,n,o,p){var q=this.lang.fakeobjects,r=q[o]||q.unknown,s,t=new a.htmlParser.basicWriter();m.writeHtml(t);s=t.getHtml();var u={'class':n,src:a.getUrl('images/spacer.gif'),'data-cke-realelement':encodeURIComponent(s),'data-cke-real-node-type':m.type,alt:r,title:r,align:m.attributes.align||''};if(o)u['data-cke-real-element-type']=o;if(p)u['data-cke-resizable']=p;return new a.htmlParser.element('img',u);};a.editor.prototype.restoreRealElement=function(m){if(m.data('cke-real-node-type')!=1)return null;
+return h.createFromHtml(decodeURIComponent(m.data('cke-realelement')),this.document);};j.add('richcombo',{requires:['floatpanel','listblock','button'],beforeInit:function(m){m.ui.addHandler(3,k.richCombo.handler);}});a.UI_RICHCOMBO=3;k.richCombo=e.createClass({$:function(m){var o=this;e.extend(o,m,{title:m.label,modes:{wysiwyg:1}});var n=o.panel||{};delete o.panel;o.id=e.getNextNumber();o.document=n&&n.parent&&n.parent.getDocument()||a.document;n.className=(n.className||'')+' cke_rcombopanel';n.block={multiSelect:n.multiSelect,attributes:n.attributes};o._={panelDefinition:n,items:{},state:2};},statics:{handler:{create:function(m){return new k.richCombo(m);}}},proto:{renderHtml:function(m){var n=[];this.render(m,n);return n.join('');},render:function(m,n){var o=b,p='cke_'+this.id,q=e.addFunction(function(t){var w=this;var u=w._;if(u.state==0)return;w.createPanel(m);if(u.on){u.panel.hide();return;}w.commit();var v=w.getValue();if(v)u.list.mark(v);else u.list.unmarkAll();u.panel.showBlock(w.id,new h(t),4);},this),r={id:p,combo:this,focus:function(){var t=a.document.getById(p).getChild(1);t.focus();},clickFn:q};m.on('mode',function(){this.setState(this.modes[m.mode]?2:0);this.setValue('');},this);var s=e.addFunction(function(t,u){t=new d.event(t);var v=t.getKeystroke();switch(v){case 13:case 32:case 40:e.callFunction(q,u);break;default:r.onkey(r,v);}t.preventDefault();});r.keyDownFn=s;n.push('<span class="cke_rcombo">','<span id=',p);if(this.className)n.push(' class="',this.className,' cke_off"');n.push('>','<span id="'+p+'_label" class=cke_label>',this.label,'</span>','<a hidefocus=true title="',this.title,'" tabindex="-1"',o.gecko&&o.version>=10900&&!o.hc?'':" href=\"javascript:void('"+this.label+"')\"",' role="button" aria-labelledby="',p,'_label" aria-describedby="',p,'_text" aria-haspopup="true"');if(b.opera||b.gecko&&b.mac)n.push(' onkeypress="return false;"');if(b.gecko)n.push(' onblur="this.style.cssText = this.style.cssText;"');n.push(' onkeydown="CKEDITOR.tools.callFunction( ',s,', event, this );" onclick="CKEDITOR.tools.callFunction(',q,', this); return false;"><span><span id="'+p+'_text" class="cke_text cke_inline_label">'+this.label+'</span>'+'</span>'+'<span class=cke_openbutton>'+(b.hc?'<span>▼</span>':b.air?' ':'')+'</span>'+'</a>'+'</span>'+'</span>');if(this.onRender)this.onRender();return r;},createPanel:function(m){if(this._.panel)return;var n=this._.panelDefinition,o=this._.panelDefinition.block,p=n.parent||a.document.getBody(),q=new k.floatPanel(m,p,n),r=q.addListBlock(this.id,o),s=this;
+q.onShow=function(){if(s.className)this.element.getFirst().addClass(s.className+'_panel');s.setState(1);r.focus(!s.multiSelect&&s.getValue());s._.on=1;if(s.onOpen)s.onOpen();};q.onHide=function(t){if(s.className)this.element.getFirst().removeClass(s.className+'_panel');s.setState(s.modes&&s.modes[m.mode]?2:0);s._.on=0;if(!t&&s.onClose)s.onClose();};q.onEscape=function(){q.hide();s.document.getById('cke_'+s.id).getFirst().getNext().focus();};r.onClick=function(t,u){s.document.getWindow().focus();if(s.onClick)s.onClick.call(s,t,u);if(u)s.setValue(t,s._.items[t]);else s.setValue('');q.hide();};this._.panel=q;this._.list=r;q.getBlock(this.id).onHide=function(){s._.on=0;s.setState(2);};if(this.init)this.init();},setValue:function(m,n){var p=this;p._.value=m;var o=p.document.getById('cke_'+p.id+'_text');if(o){if(!(m||n)){n=p.label;o.addClass('cke_inline_label');}else o.removeClass('cke_inline_label');o.setHtml(typeof n!='undefined'?n:m);}},getValue:function(){return this._.value||'';},unmarkAll:function(){this._.list.unmarkAll();},mark:function(m){this._.list.mark(m);},hideItem:function(m){this._.list.hideItem(m);},hideGroup:function(m){this._.list.hideGroup(m);},showAll:function(){this._.list.showAll();},add:function(m,n,o){this._.items[m]=o||m;this._.list.add(m,n,o);},startGroup:function(m){this._.list.startGroup(m);},commit:function(){var m=this;if(!m._.committed){m._.list.commit();m._.committed=1;k.fire('ready',m);}m._.committed=1;},setState:function(m){var n=this;if(n._.state==m)return;n.document.getById('cke_'+n.id).setState(m);n._.state=m;}}});k.prototype.addRichCombo=function(m,n){this.add(m,3,n);};j.add('htmlwriter');a.htmlWriter=e.createClass({base:a.htmlParser.basicWriter,$:function(){var o=this;o.base();o.indentationChars='\t';o.selfClosingEnd=' />';o.lineBreakChars='\n';o.forceSimpleAmpersand=0;o.sortAttributes=1;o._.indent=0;o._.indentation='';o._.inPre=0;o._.rules={};var m=f;for(var n in e.extend({},m.$nonBodyContent,m.$block,m.$listItem,m.$tableContent))o.setRules(n,{indent:1,breakBeforeOpen:1,breakAfterOpen:1,breakBeforeClose:!m[n]['#'],breakAfterClose:1});o.setRules('br',{breakAfterOpen:1});o.setRules('title',{indent:0,breakAfterOpen:0});o.setRules('style',{indent:0,breakBeforeClose:1});o.setRules('pre',{indent:0});},proto:{openTag:function(m,n){var p=this;var o=p._.rules[m];if(p._.indent)p.indentation();else if(o&&o.breakBeforeOpen){p.lineBreak();p.indentation();}p._.output.push('<',m);},openTagClose:function(m,n){var p=this;var o=p._.rules[m];
+if(n)p._.output.push(p.selfClosingEnd);else{p._.output.push('>');if(o&&o.indent)p._.indentation+=p.indentationChars;}if(o&&o.breakAfterOpen)p.lineBreak();m=='pre'&&(p._.inPre=1);},attribute:function(m,n){if(typeof n=='string'){this.forceSimpleAmpersand&&(n=n.replace(/&/g,'&'));n=e.htmlEncodeAttr(n);}this._.output.push(' ',m,'="',n,'"');},closeTag:function(m){var o=this;var n=o._.rules[m];if(n&&n.indent)o._.indentation=o._.indentation.substr(o.indentationChars.length);if(o._.indent)o.indentation();else if(n&&n.breakBeforeClose){o.lineBreak();o.indentation();}o._.output.push('</',m,'>');m=='pre'&&(o._.inPre=0);if(n&&n.breakAfterClose)o.lineBreak();},text:function(m){var n=this;if(n._.indent){n.indentation();!n._.inPre&&(m=e.ltrim(m));}n._.output.push(m);},comment:function(m){if(this._.indent)this.indentation();this._.output.push('<!--',m,'-->');},lineBreak:function(){var m=this;if(!m._.inPre&&m._.output.length>0)m._.output.push(m.lineBreakChars);m._.indent=1;},indentation:function(){var m=this;if(!m._.inPre)m._.output.push(m._.indentation);m._.indent=0;},setRules:function(m,n){var o=this._.rules[m];if(o)e.extend(o,n,true);else this._.rules[m]=n;}}});j.add('menubutton',{requires:['button','menu'],beforeInit:function(m){m.ui.addHandler(5,k.menuButton.handler);}});a.UI_MENUBUTTON=5;(function(){var m=function(n){var o=this._;if(o.state===0)return;o.previousState=o.state;var p=o.menu;if(!p){p=o.menu=new a.menu(n,{panel:{className:n.skinClass+' cke_contextmenu',attributes:{'aria-label':n.lang.common.options}}});p.onHide=e.bind(function(){this.setState(this.modes&&this.modes[n.mode]?o.previousState:0);},this);if(this.onMenu)p.addListener(this.onMenu);}if(o.on){p.hide();return;}this.setState(1);p.show(a.document.getById(this._.id),4);};k.menuButton=e.createClass({base:k.button,$:function(n){var o=n.panel;delete n.panel;this.base(n);this.hasArrow=true;this.click=m;},statics:{handler:{create:function(n){return new k.menuButton(n);}}}});})();j.add('dialogui');(function(){var m=function(u){var x=this;x._||(x._={});x._['default']=x._.initValue=u['default']||'';x._.required=u.required||false;var v=[x._];for(var w=1;w<arguments.length;w++)v.push(arguments[w]);v.push(true);e.extend.apply(e,v);return x._;},n={build:function(u,v,w){return new k.dialog.textInput(u,v,w);}},o={build:function(u,v,w){return new k.dialog[v.type](u,v,w);}},p={build:function(u,v,w){var x=v.children,y,z=[],A=[];for(var B=0;B<x.length&&(y=x[B]);B++){var C=[];z.push(C);A.push(a.dialog._.uiElementBuilders[y.type].build(u,y,C));
+}return new k.dialog[v.type](u,A,z,w,v);}},q={isChanged:function(){return this.getValue()!=this.getInitValue();},reset:function(u){this.setValue(this.getInitValue(),u);},setInitValue:function(){this._.initValue=this.getValue();},resetInitValue:function(){this._.initValue=this._['default'];},getInitValue:function(){return this._.initValue;}},r=e.extend({},k.dialog.uiElement.prototype.eventProcessors,{onChange:function(u,v){if(!this._.domOnChangeRegistered){u.on('load',function(){this.getInputElement().on('change',function(){if(!u.parts.dialog.isVisible())return;this.fire('change',{value:this.getValue()});},this);},this);this._.domOnChangeRegistered=true;}this.on('change',v);}},true),s=/^on([A-Z]\w+)/,t=function(u){for(var v in u){if(s.test(v)||v=='title'||v=='type')delete u[v];}return u;};e.extend(k.dialog,{labeledElement:function(u,v,w,x){if(arguments.length<4)return;var y=m.call(this,v);y.labelId=e.getNextId()+'_label';var z=this._.children=[],A=function(){var B=[],C=v.required?' cke_required':'';if(v.labelLayout!='horizontal')B.push('<label class="cke_dialog_ui_labeled_label'+C+'" ',' id="'+y.labelId+'"',' for="'+y.inputId+'"',' style="'+v.labelStyle+'">',v.label,'</label>','<div class="cke_dialog_ui_labeled_content" role="presentation">',x.call(this,u,v),'</div>');else{var D={type:'hbox',widths:v.widths,padding:0,children:[{type:'html',html:'<label class="cke_dialog_ui_labeled_label'+C+'"'+' id="'+y.labelId+'"'+' for="'+y.inputId+'"'+' style="'+v.labelStyle+'">'+e.htmlEncode(v.label)+'</span>'},{type:'html',html:'<span class="cke_dialog_ui_labeled_content">'+x.call(this,u,v)+'</span>'}]};a.dialog._.uiElementBuilders.hbox.build(u,D,B);}return B.join('');};k.dialog.uiElement.call(this,u,v,w,'div',null,{role:'presentation'},A);},textInput:function(u,v,w){if(arguments.length<3)return;m.call(this,v);var x=this._.inputId=e.getNextId()+'_textInput',y={'class':'cke_dialog_ui_input_'+v.type,id:x,type:'text'},z;if(v.validate)this.validate=v.validate;if(v.maxLength)y.maxlength=v.maxLength;if(v.size)y.size=v.size;if(v.controlStyle)y.style=v.controlStyle;var A=this,B=false;u.on('load',function(){A.getInputElement().on('keydown',function(D){if(D.data.getKeystroke()==13)B=true;});A.getInputElement().on('keyup',function(D){if(D.data.getKeystroke()==13&&B){u.getButton('ok')&&setTimeout(function(){u.getButton('ok').click();},0);B=false;}},null,null,1000);});var C=function(){var D=['<div class="cke_dialog_ui_input_',v.type,'" role="presentation"'];if(v.width)D.push('style="width:'+v.width+'" ');
+D.push('><input ');y['aria-labelledby']=this._.labelId;this._.required&&(y['aria-required']=this._.required);for(var E in y)D.push(E+'="'+y[E]+'" ');D.push(' /></div>');return D.join('');};k.dialog.labeledElement.call(this,u,v,w,C);},textarea:function(u,v,w){if(arguments.length<3)return;m.call(this,v);var x=this,y=this._.inputId=e.getNextId()+'_textarea',z={};if(v.validate)this.validate=v.validate;z.rows=v.rows||5;z.cols=v.cols||20;var A=function(){z['aria-labelledby']=this._.labelId;this._.required&&(z['aria-required']=this._.required);var B=['<div class="cke_dialog_ui_input_textarea" role="presentation"><textarea class="cke_dialog_ui_input_textarea" id="',y,'" '];for(var C in z)B.push(C+'="'+e.htmlEncode(z[C])+'" ');B.push('>',e.htmlEncode(x._['default']),'</textarea></div>');return B.join('');};k.dialog.labeledElement.call(this,u,v,w,A);},checkbox:function(u,v,w){if(arguments.length<3)return;var x=m.call(this,v,{'default':!!v['default']});if(v.validate)this.validate=v.validate;var y=function(){var z=e.extend({},v,{id:v.id?v.id+'_checkbox':e.getNextId()+'_checkbox'},true),A=[],B=e.getNextId()+'_label',C={'class':'cke_dialog_ui_checkbox_input',type:'checkbox','aria-labelledby':B};t(z);if(v['default'])C.checked='checked';if(typeof z.controlStyle!='undefined')z.style=z.controlStyle;x.checkbox=new k.dialog.uiElement(u,z,A,'input',null,C);A.push(' <label id="',B,'" for="',C.id,'">',e.htmlEncode(v.label),'</label>');return A.join('');};k.dialog.uiElement.call(this,u,v,w,'span',null,null,y);},radio:function(u,v,w){if(arguments.length<3)return;m.call(this,v);if(!this._['default'])this._['default']=this._.initValue=v.items[0][1];if(v.validate)this.validate=v.valdiate;var x=[],y=this,z=function(){var A=[],B=[],C={'class':'cke_dialog_ui_radio_item','aria-labelledby':this._.labelId},D=v.id?v.id+'_radio':e.getNextId()+'_radio';for(var E=0;E<v.items.length;E++){var F=v.items[E],G=F[2]!==undefined?F[2]:F[0],H=F[1]!==undefined?F[1]:F[0],I=e.getNextId()+'_radio_input',J=I+'_label',K=e.extend({},v,{id:I,title:null,type:null},true),L=e.extend({},K,{title:G},true),M={type:'radio','class':'cke_dialog_ui_radio_input',name:D,value:H,'aria-labelledby':J},N=[];if(y._['default']==H)M.checked='checked';t(K);t(L);if(typeof K.controlStyle!='undefined')K.style=K.controlStyle;x.push(new k.dialog.uiElement(u,K,N,'input',null,M));N.push(' ');new k.dialog.uiElement(u,L,N,'label',null,{id:J,'for':M.id},F[0]);A.push(N.join(''));}new k.dialog.hbox(u,[],A,B);return B.join('');};k.dialog.labeledElement.call(this,u,v,w,z);
+this._.children=x;},button:function(u,v,w){if(!arguments.length)return;if(typeof v=='function')v=v(u.getParentEditor());m.call(this,v,{disabled:v.disabled||false});a.event.implementOn(this);var x=this;u.on('load',function(A){var B=this.getElement();(function(){B.on('click',function(C){x.fire('click',{dialog:x.getDialog()});C.data.preventDefault();});B.on('keydown',function(C){if(C.data.getKeystroke() in {32:1}){x.click();C.data.preventDefault();}});})();B.unselectable();},this);var y=e.extend({},v);delete y.style;var z=e.getNextId()+'_label';k.dialog.uiElement.call(this,u,y,w,'a',null,{style:v.style,href:'javascript:void(0)',title:v.label,hidefocus:'true','class':v['class'],role:'button','aria-labelledby':z},'<span id="'+z+'" class="cke_dialog_ui_button">'+e.htmlEncode(v.label)+'</span>');},select:function(u,v,w){if(arguments.length<3)return;var x=m.call(this,v);if(v.validate)this.validate=v.validate;x.inputId=e.getNextId()+'_select';var y=function(){var z=e.extend({},v,{id:v.id?v.id+'_select':e.getNextId()+'_select'},true),A=[],B=[],C={id:x.inputId,'class':'cke_dialog_ui_input_select','aria-labelledby':this._.labelId};if(v.size!=undefined)C.size=v.size;if(v.multiple!=undefined)C.multiple=v.multiple;t(z);for(var D=0,E;D<v.items.length&&(E=v.items[D]);D++)B.push('<option value="',e.htmlEncode(E[1]!==undefined?E[1]:E[0]),'" /> ',e.htmlEncode(E[0]));if(typeof z.controlStyle!='undefined')z.style=z.controlStyle;x.select=new k.dialog.uiElement(u,z,A,'select',null,C,B.join(''));return A.join('');};k.dialog.labeledElement.call(this,u,v,w,y);},file:function(u,v,w){if(arguments.length<3)return;if(v['default']===undefined)v['default']='';var x=e.extend(m.call(this,v),{definition:v,buttons:[]});if(v.validate)this.validate=v.validate;var y=function(){x.frameId=e.getNextId()+'_fileInput';var z=b.isCustomDomain(),A=['<iframe frameborder="0" allowtransparency="0" class="cke_dialog_ui_input_file" id="',x.frameId,'" title="',v.label,'" src="javascript:void('];A.push(z?"(function(){document.open();document.domain='"+document.domain+"';"+'document.close();'+'})()':'0');A.push(')"></iframe>');return A.join('');};u.on('load',function(){var z=a.document.getById(x.frameId),A=z.getParent();A.addClass('cke_dialog_ui_input_file');});k.dialog.labeledElement.call(this,u,v,w,y);},fileButton:function(u,v,w){if(arguments.length<3)return;var x=m.call(this,v),y=this;if(v.validate)this.validate=v.validate;var z=e.extend({},v),A=z.onClick;z.className=(z.className?z.className+' ':'')+'cke_dialog_ui_button';
+z.onClick=function(B){var C=v['for'];if(!A||A.call(this,B)!==false){u.getContentElement(C[0],C[1]).submit();this.disable();}};u.on('load',function(){u.getContentElement(v['for'][0],v['for'][1])._.buttons.push(y);});k.dialog.button.call(this,u,z,w);},html:(function(){var u=/^\s*<[\w:]+\s+([^>]*)?>/,v=/^(\s*<[\w:]+(?:\s+[^>]*)?)((?:.|\r|\n)+)$/,w=/\/$/;return function(x,y,z){if(arguments.length<3)return;var A=[],B,C=y.html,D,E;if(C.charAt(0)!='<')C='<span>'+C+'</span>';var F=y.focus;if(F){var G=this.focus;this.focus=function(){G.call(this);typeof F=='function'&&F.call(this);this.fire('focus');};if(y.isFocusable){var H=this.isFocusable;this.isFocusable=H;}this.keyboardFocusable=true;}k.dialog.uiElement.call(this,x,y,A,'span',null,null,'');B=A.join('');D=B.match(u);E=C.match(v)||['','',''];if(w.test(E[1])){E[1]=E[1].slice(0,-1);E[2]='/'+E[2];}z.push([E[1],' ',D[1]||'',E[2]].join(''));};})(),fieldset:function(u,v,w,x,y){var z=y.label,A=function(){var B=[];z&&B.push('<legend>'+z+'</legend>');for(var C=0;C<w.length;C++)B.push(w[C]);return B.join('');};this._={children:v};k.dialog.uiElement.call(this,u,y,x,'fieldset',null,null,A);}},true);k.dialog.html.prototype=new k.dialog.uiElement();k.dialog.labeledElement.prototype=e.extend(new k.dialog.uiElement(),{setLabel:function(u){var v=a.document.getById(this._.labelId);if(v.getChildCount()<1)new d.text(u,a.document).appendTo(v);else v.getChild(0).$.nodeValue=u;return this;},getLabel:function(){var u=a.document.getById(this._.labelId);if(!u||u.getChildCount()<1)return '';else return u.getChild(0).getText();},eventProcessors:r},true);k.dialog.button.prototype=e.extend(new k.dialog.uiElement(),{click:function(){var u=this;if(!u._.disabled)return u.fire('click',{dialog:u._.dialog});u.getElement().$.blur();return false;},enable:function(){this._.disabled=false;var u=this.getElement();u&&u.removeClass('cke_disabled');},disable:function(){this._.disabled=true;this.getElement().addClass('cke_disabled');},isVisible:function(){return this.getElement().getFirst().isVisible();},isEnabled:function(){return!this._.disabled;},eventProcessors:e.extend({},k.dialog.uiElement.prototype.eventProcessors,{onClick:function(u,v){this.on('click',v);}},true),accessKeyUp:function(){this.click();},accessKeyDown:function(){this.focus();},keyboardFocusable:true},true);k.dialog.textInput.prototype=e.extend(new k.dialog.labeledElement(),{getInputElement:function(){return a.document.getById(this._.inputId);},focus:function(){var u=this.selectParentTab();
+setTimeout(function(){var v=u.getInputElement();v&&v.$.focus();},0);},select:function(){var u=this.selectParentTab();setTimeout(function(){var v=u.getInputElement();if(v){v.$.focus();v.$.select();}},0);},accessKeyUp:function(){this.select();},setValue:function(u){!u&&(u='');return k.dialog.uiElement.prototype.setValue.apply(this,arguments);},keyboardFocusable:true},q,true);k.dialog.textarea.prototype=new k.dialog.textInput();k.dialog.select.prototype=e.extend(new k.dialog.labeledElement(),{getInputElement:function(){return this._.select.getElement();},add:function(u,v,w){var x=new h('option',this.getDialog().getParentEditor().document),y=this.getInputElement().$;x.$.text=u;x.$.value=v===undefined||v===null?u:v;if(w===undefined||w===null){if(c)y.add(x.$);else y.add(x.$,null);}else y.add(x.$,w);return this;},remove:function(u){var v=this.getInputElement().$;v.remove(u);return this;},clear:function(){var u=this.getInputElement().$;while(u.length>0)u.remove(0);return this;},keyboardFocusable:true},q,true);k.dialog.checkbox.prototype=e.extend(new k.dialog.uiElement(),{getInputElement:function(){return this._.checkbox.getElement();},setValue:function(u,v){this.getInputElement().$.checked=u;!v&&this.fire('change',{value:u});},getValue:function(){return this.getInputElement().$.checked;},accessKeyUp:function(){this.setValue(!this.getValue());},eventProcessors:{onChange:function(u,v){if(!c)return r.onChange.apply(this,arguments);else{u.on('load',function(){var w=this._.checkbox.getElement();w.on('propertychange',function(x){x=x.data.$;if(x.propertyName=='checked')this.fire('change',{value:w.$.checked});},this);},this);this.on('change',v);}return null;}},keyboardFocusable:true},q,true);k.dialog.radio.prototype=e.extend(new k.dialog.uiElement(),{setValue:function(u,v){var w=this._.children,x;for(var y=0;y<w.length&&(x=w[y]);y++)x.getElement().$.checked=x.getValue()==u;!v&&this.fire('change',{value:u});},getValue:function(){var u=this._.children;for(var v=0;v<u.length;v++){if(u[v].getElement().$.checked)return u[v].getValue();}return null;},accessKeyUp:function(){var u=this._.children,v;for(v=0;v<u.length;v++){if(u[v].getElement().$.checked){u[v].getElement().focus();return;}}u[0].getElement().focus();},eventProcessors:{onChange:function(u,v){if(!c)return r.onChange.apply(this,arguments);else{u.on('load',function(){var w=this._.children,x=this;for(var y=0;y<w.length;y++){var z=w[y].getElement();z.on('propertychange',function(A){A=A.data.$;if(A.propertyName=='checked'&&this.$.checked)x.fire('change',{value:this.getAttribute('value')});
+});}},this);this.on('change',v);}return null;}},keyboardFocusable:true},q,true);k.dialog.file.prototype=e.extend(new k.dialog.labeledElement(),q,{getInputElement:function(){var u=a.document.getById(this._.frameId).getFrameDocument();return u.$.forms.length>0?new h(u.$.forms[0].elements[0]):this.getElement();},submit:function(){this.getInputElement().getParent().$.submit();return this;},getAction:function(){return this.getInputElement().getParent().$.action;},registerEvents:function(u){var v=/^on([A-Z]\w+)/,w,x=function(z,A,B,C){z.on('formLoaded',function(){z.getInputElement().on(B,C,z);});};for(var y in u){if(!(w=y.match(v)))continue;if(this.eventProcessors[y])this.eventProcessors[y].call(this,this._.dialog,u[y]);else x(this,this._.dialog,w[1].toLowerCase(),u[y]);}return this;},reset:function(){var u=this._,v=a.document.getById(u.frameId),w=v.getFrameDocument(),x=u.definition,y=u.buttons,z=this.formLoadedNumber,A=this.formUnloadNumber,B=u.dialog._.editor.lang.dir,C=u.dialog._.editor.langCode;if(!z){z=this.formLoadedNumber=e.addFunction(function(){this.fire('formLoaded');},this);A=this.formUnloadNumber=e.addFunction(function(){this.getInputElement().clearCustomData();},this);this.getDialog()._.editor.on('destroy',function(){e.removeFunction(z);e.removeFunction(A);});}function D(){w.$.open();if(b.isCustomDomain())w.$.domain=document.domain;var E='';if(x.size)E=x.size-(c?7:0);w.$.write(['<html dir="'+B+'" lang="'+C+'"><head><title></title></head><body style="margin: 0; overflow: hidden; background: transparent;">','<form enctype="multipart/form-data" method="POST" dir="'+B+'" lang="'+C+'" action="',e.htmlEncode(x.action),'">','<input type="file" name="',e.htmlEncode(x.id||'cke_upload'),'" size="',e.htmlEncode(E>0?E:''),'" />','</form>','</body></html>','<script>window.parent.CKEDITOR.tools.callFunction('+z+');','window.onbeforeunload = function() {window.parent.CKEDITOR.tools.callFunction('+A+')}</script>'].join(''));w.$.close();for(var F=0;F<y.length;F++)y[F].enable();};if(b.gecko)setTimeout(D,500);else D();},getValue:function(){return this.getInputElement().$.value||'';},setInitValue:function(){this._.initValue='';},eventProcessors:{onChange:function(u,v){if(!this._.domOnChangeRegistered){this.on('formLoaded',function(){this.getInputElement().on('change',function(){this.fire('change',{value:this.getValue()});},this);},this);this._.domOnChangeRegistered=true;}this.on('change',v);}},keyboardFocusable:true},true);k.dialog.fileButton.prototype=new k.dialog.button();
+k.dialog.fieldset.prototype=e.clone(k.dialog.hbox.prototype);a.dialog.addUIElement('text',n);a.dialog.addUIElement('password',n);a.dialog.addUIElement('textarea',o);a.dialog.addUIElement('checkbox',o);a.dialog.addUIElement('radio',o);a.dialog.addUIElement('button',o);a.dialog.addUIElement('select',o);a.dialog.addUIElement('file',o);a.dialog.addUIElement('fileButton',o);a.dialog.addUIElement('html',o);a.dialog.addUIElement('fieldset',p);})();j.add('panel',{beforeInit:function(m){m.ui.addHandler(2,k.panel.handler);}});a.UI_PANEL=2;k.panel=function(m,n){var o=this;if(n)e.extend(o,n);e.extend(o,{className:'',css:[]});o.id=e.getNextId();o.document=m;o._={blocks:{}};};k.panel.handler={create:function(m){return new k.panel(m);}};k.panel.prototype={renderHtml:function(m){var n=[];this.render(m,n);return n.join('');},render:function(m,n){var p=this;var o=p.id;n.push('<div class="',m.skinClass,'" lang="',m.langCode,'" role="presentation" style="display:none;z-index:'+(m.config.baseFloatZIndex+1)+'">'+'<div'+' id=',o,' dir=',m.lang.dir,' role="presentation" class="cke_panel cke_',m.lang.dir);if(p.className)n.push(' ',p.className);n.push('">');if(p.forceIFrame||p.css.length){n.push('<iframe id="',o,'_frame" frameborder="0" role="application" src="javascript:void(');n.push(b.isCustomDomain()?"(function(){document.open();document.domain='"+document.domain+"';"+'document.close();'+'})()':'0');n.push(')"></iframe>');}n.push('</div></div>');return o;},getHolderElement:function(){var m=this._.holder;if(!m){if(this.forceIFrame||this.css.length){var n=this.document.getById(this.id+'_frame'),o=n.getParent(),p=o.getAttribute('dir'),q=o.getParent().getAttribute('class'),r=o.getParent().getAttribute('lang'),s=n.getFrameDocument(),t=e.addFunction(e.bind(function(w){this.isLoaded=true;if(this.onLoad)this.onLoad();},this)),u='<!DOCTYPE html><html dir="'+p+'" class="'+q+'_container" lang="'+r+'">'+'<head>'+'<style>.'+q+'_container{visibility:hidden}</style>'+'</head>'+'<body class="cke_'+p+' cke_panel_frame '+b.cssClass+'" style="margin:0;padding:0"'+' onload="( window.CKEDITOR || window.parent.CKEDITOR ).tools.callFunction('+t+');"></body>'+e.buildStyleHtml(this.css)+'</html>';s.write(u);var v=s.getWindow();v.$.CKEDITOR=a;s.on('key'+(b.opera?'press':'down'),function(w){var z=this;var x=w.data.getKeystroke(),y=z.document.getById(z.id).getAttribute('dir');if(z._.onKeyDown&&z._.onKeyDown(x)===false){w.data.preventDefault();return;}if(x==27||x==(y=='rtl'?39:37))if(z.onEscape&&z.onEscape(x)===false)w.data.preventDefault();
+},this);m=s.getBody();m.unselectable();b.air&&e.callFunction(t);}else m=this.document.getById(this.id);this._.holder=m;}return m;},addBlock:function(m,n){var o=this;n=o._.blocks[m]=n instanceof k.panel.block?n:new k.panel.block(o.getHolderElement(),n);if(!o._.currentBlock)o.showBlock(m);return n;},getBlock:function(m){return this._.blocks[m];},showBlock:function(m){var n=this._.blocks,o=n[m],p=this._.currentBlock,q=this.forceIFrame?this.document.getById(this.id+'_frame'):this._.holder;q.getParent().getParent().disableContextMenu();if(p){q.removeAttributes(p.attributes);p.hide();}this._.currentBlock=o;q.setAttributes(o.attributes);a.fire('ariaWidget',q);o._.focusIndex=-1;this._.onKeyDown=o.onKeyDown&&e.bind(o.onKeyDown,o);o.onMark=function(r){q.setAttribute('aria-activedescendant',r.getId()+'_option');};o.onUnmark=function(){q.removeAttribute('aria-activedescendant');};o.show();return o;},destroy:function(){this.element&&this.element.remove();}};k.panel.block=e.createClass({$:function(m,n){var o=this;o.element=m.append(m.getDocument().createElement('div',{attributes:{tabIndex:-1,'class':'cke_panel_block',role:'presentation'},styles:{display:'none'}}));if(n)e.extend(o,n);if(!o.attributes.title)o.attributes.title=o.attributes['aria-label'];o.keys={};o._.focusIndex=-1;o.element.disableContextMenu();},_:{markItem:function(m){var p=this;if(m==-1)return;var n=p.element.getElementsByTag('a'),o=n.getItem(p._.focusIndex=m);if(b.webkit||b.opera)o.getDocument().getWindow().focus();o.focus();p.onMark&&p.onMark(o);}},proto:{show:function(){this.element.setStyle('display','');},hide:function(){var m=this;if(!m.onHide||m.onHide.call(m)!==true)m.element.setStyle('display','none');},onKeyDown:function(m){var r=this;var n=r.keys[m];switch(n){case 'next':var o=r._.focusIndex,p=r.element.getElementsByTag('a'),q;while(q=p.getItem(++o)){if(q.getAttribute('_cke_focus')&&q.$.offsetWidth){r._.focusIndex=o;q.focus();break;}}return false;case 'prev':o=r._.focusIndex;p=r.element.getElementsByTag('a');while(o>0&&(q=p.getItem(--o))){if(q.getAttribute('_cke_focus')&&q.$.offsetWidth){r._.focusIndex=o;q.focus();break;}}return false;case 'click':o=r._.focusIndex;q=o>=0&&r.element.getElementsByTag('a').getItem(o);if(q)q.$.click?q.$.click():q.$.onclick();return false;}return true;}}});j.add('listblock',{requires:['panel'],onLoad:function(){k.panel.prototype.addListBlock=function(m,n){return this.addBlock(m,new k.listBlock(this.getHolderElement(),n));};k.listBlock=e.createClass({base:k.panel.block,$:function(m,n){var q=this;
+n=n||{};var o=n.attributes||(n.attributes={});(q.multiSelect=!!n.multiSelect)&&(o['aria-multiselectable']=true);!o.role&&(o.role='listbox');q.base.apply(q,arguments);var p=q.keys;p[40]='next';p[9]='next';p[38]='prev';p[2000+9]='prev';p[32]='click';q._.pendingHtml=[];q._.items={};q._.groups={};},_:{close:function(){if(this._.started){this._.pendingHtml.push('</ul>');delete this._.started;}},getClick:function(){if(!this._.click)this._.click=e.addFunction(function(m){var o=this;var n=true;if(o.multiSelect)n=o.toggle(m);else o.mark(m);if(o.onClick)o.onClick(m,n);},this);return this._.click;}},proto:{add:function(m,n,o){var r=this;var p=r._.pendingHtml,q=e.getNextId();if(!r._.started){p.push('<ul role="presentation" class=cke_panel_list>');r._.started=1;r._.size=r._.size||0;}r._.items[m]=q;p.push('<li id=',q,' class=cke_panel_listItem role=presentation><a id="',q,'_option" _cke_focus=1 hidefocus=true title="',o||m,'" href="javascript:void(\'',m,'\')" onclick="CKEDITOR.tools.callFunction(',r._.getClick(),",'",m,"'); return false;\"",' role="option" aria-posinset="'+ ++r._.size+'">',n||m,'</a></li>');},startGroup:function(m){this._.close();var n=e.getNextId();this._.groups[m]=n;this._.pendingHtml.push('<h1 role="presentation" id=',n,' class=cke_panel_grouptitle>',m,'</h1>');},commit:function(){var p=this;p._.close();p.element.appendHtml(p._.pendingHtml.join(''));var m=p._.items,n=p.element.getDocument();for(var o in m)n.getById(m[o]+'_option').setAttribute('aria-setsize',p._.size);delete p._.size;p._.pendingHtml=[];},toggle:function(m){var n=this.isMarked(m);if(n)this.unmark(m);else this.mark(m);return!n;},hideGroup:function(m){var n=this.element.getDocument().getById(this._.groups[m]),o=n&&n.getNext();if(n){n.setStyle('display','none');if(o&&o.getName()=='ul')o.setStyle('display','none');}},hideItem:function(m){this.element.getDocument().getById(this._.items[m]).setStyle('display','none');},showAll:function(){var m=this._.items,n=this._.groups,o=this.element.getDocument();for(var p in m)o.getById(m[p]).setStyle('display','');for(var q in n){var r=o.getById(n[q]),s=r.getNext();r.setStyle('display','');if(s&&s.getName()=='ul')s.setStyle('display','');}},mark:function(m){var p=this;if(!p.multiSelect)p.unmarkAll();var n=p._.items[m],o=p.element.getDocument().getById(n);o.addClass('cke_selected');p.element.getDocument().getById(n+'_option').setAttribute('aria-selected',true);p.element.setAttribute('aria-activedescendant',n+'_option');p.onMark&&p.onMark(o);},unmark:function(m){var n=this;
+n.element.getDocument().getById(n._.items[m]).removeClass('cke_selected');n.onUnmark&&n.onUnmark(n._.items[m]);},unmarkAll:function(){var p=this;var m=p._.items,n=p.element.getDocument();for(var o in m)n.getById(m[o]).removeClass('cke_selected');p.onUnmark&&p.onUnmark();},isMarked:function(m){return this.element.getDocument().getById(this._.items[m]).hasClass('cke_selected');},focus:function(m){this._.focusIndex=-1;if(m){var n=this.element.getDocument().getById(this._.items[m]).getFirst(),o=this.element.getElementsByTag('a'),p,q=-1;while(p=o.getItem(++q)){if(p.equals(n)){this._.focusIndex=q;break;}}setTimeout(function(){n.focus();},0);}}}});}});a.themes.add('default',(function(){function m(n,o){var p,q;q=n.config.sharedSpaces;q=q&&q[o];q=q&&a.document.getById(q);if(q){var r='<span class="cke_shared " dir="'+n.lang.dir+'"'+'>'+'<span class="'+n.skinClass+' '+n.id+' cke_editor_'+n.name+'">'+'<span class="'+b.cssClass+'">'+'<span class="cke_wrapper cke_'+n.lang.dir+'">'+'<span class="cke_editor">'+'<div class="cke_'+o+'">'+'</div></span></span></span></span></span>',s=q.append(h.createFromHtml(r,q.getDocument()));if(q.getCustomData('cke_hasshared'))s.hide();else q.setCustomData('cke_hasshared',1);p=s.getChild([0,0,0,0]);!n.sharedSpaces&&(n.sharedSpaces={});n.sharedSpaces[o]=p;n.on('focus',function(){for(var t=0,u,v=q.getChildren();u=v.getItem(t);t++){if(u.type==1&&!u.equals(s)&&u.hasClass('cke_shared'))u.hide();}s.show();});n.on('destroy',function(){s.remove();});}return p;};return{build:function(n,o){var p=n.name,q=n.element,r=n.elementMode;if(!q||r==0)return;if(r==1)q.hide();var s=n.fire('themeSpace',{space:'top',html:''}).html,t=n.fire('themeSpace',{space:'contents',html:''}).html,u=n.fireOnce('themeSpace',{space:'bottom',html:''}).html,v=t&&n.config.height,w=n.config.tabIndex||n.element.getAttribute('tabindex')||0;if(!t)v='auto';else if(!isNaN(v))v+='px';var x='',y=n.config.width;if(y){if(!isNaN(y))y+='px';x+='width: '+y+';';}var z=s&&m(n,'top'),A=m(n,'bottom');z&&(z.setHtml(s),s='');A&&(A.setHtml(u),u='');var B=h.createFromHtml(['<span id="cke_',p,'" class="',n.skinClass,' ',n.id,' cke_editor_',p,'" dir="',n.lang.dir,'" title="',b.gecko?' ':'','" lang="',n.langCode,'"'+(b.webkit?' tabindex="'+w+'"':'')+' role="application"'+' aria-labelledby="cke_',p,'_arialbl"'+(x?' style="'+x+'"':'')+'>'+'<span id="cke_',p,'_arialbl" class="cke_voice_label">'+n.lang.editor+'</span>'+'<span class="',b.cssClass,'" role="presentation"><span class="cke_wrapper cke_',n.lang.dir,'" role="presentation"><table class="cke_editor" border="0" cellspacing="0" cellpadding="0" role="presentation"><tbody><tr',s?'':' style="display:none"',' role="presentation"><td id="cke_top_',p,'" class="cke_top" role="presentation">',s,'</td></tr><tr',t?'':' style="display:none"',' role="presentation"><td id="cke_contents_',p,'" class="cke_contents" style="height:',v,'" role="presentation">',t,'</td></tr><tr',u?'':' style="display:none"',' role="presentation"><td id="cke_bottom_',p,'" class="cke_bottom" role="presentation">',u,'</td></tr></tbody></table><style>.',n.skinClass,'{visibility:hidden;}</style></span></span></span>'].join(''));
+B.getChild([1,0,0,0,0]).unselectable();B.getChild([1,0,0,0,2]).unselectable();if(r==1)B.insertAfter(q);else q.append(B);n.container=B;B.disableContextMenu();n.fireOnce('themeLoaded');n.fireOnce('uiReady');},buildDialog:function(n){var o=e.getNextNumber(),p=h.createFromHtml(['<div class="',n.id,'_dialog cke_editor_',n.name.replace('.','\\.'),'_dialog cke_skin_',n.skinName,'" dir="',n.lang.dir,'" lang="',n.langCode,'" role="dialog" aria-labelledby="%title#"><table class="cke_dialog',' '+b.cssClass,' cke_',n.lang.dir,'" style="position:absolute" role="presentation"><tr><td role="presentation"><div class="%body" role="presentation"><div id="%title#" class="%title" role="presentation"></div><a id="%close_button#" class="%close_button" href="javascript:void(0)" title="'+n.lang.common.close+'" role="button"><span class="cke_label">X</span></a>'+'<div id="%tabs#" class="%tabs" role="tablist"></div>'+'<table class="%contents" role="presentation">'+'<tr>'+'<td id="%contents#" class="%contents" role="presentation"></td>'+'</tr>'+'<tr>'+'<td id="%footer#" class="%footer" role="presentation"></td>'+'</tr>'+'</table>'+'</div>'+'<div id="%tl#" class="%tl"></div>'+'<div id="%tc#" class="%tc"></div>'+'<div id="%tr#" class="%tr"></div>'+'<div id="%ml#" class="%ml"></div>'+'<div id="%mr#" class="%mr"></div>'+'<div id="%bl#" class="%bl"></div>'+'<div id="%bc#" class="%bc"></div>'+'<div id="%br#" class="%br"></div>'+'</td></tr>'+'</table>',c?'':'<style>.cke_dialog{visibility:hidden;}</style>','</div>'].join('').replace(/#/g,'_'+o).replace(/%/g,'cke_dialog_')),q=p.getChild([0,0,0,0,0]),r=q.getChild(0),s=q.getChild(1);r.unselectable();s.unselectable();return{element:p,parts:{dialog:p.getChild(0),title:r,close:s,tabs:q.getChild(2),contents:q.getChild([3,0,0,0]),footer:q.getChild([3,0,1,0])}};},destroy:function(n){var o=n.container,p=n.element;if(o){o.clearCustomData();o.remove();}if(p){p.clearCustomData();n.elementMode==1&&p.show();delete n.element;}}};})());a.editor.prototype.getThemeSpace=function(m){var n='cke_'+m,o=this._[n]||(this._[n]=a.document.getById(n+'_'+this.name));return o;};a.editor.prototype.resize=function(m,n,o,p){var q=this.container,r=a.document.getById('cke_contents_'+this.name),s=p?q.getChild(1):q;b.webkit&&s.setStyle('display','none');s.setSize('width',m,true);if(b.webkit){s.$.offsetWidth;s.setStyle('display','');}var t=o?0:(s.$.offsetHeight||0)-(r.$.clientHeight||0);r.setStyle('height',Math.max(n-t,0)+'px');this.fire('resize');};a.editor.prototype.getResizable=function(){return this.container;
+};})();
diff --git a/appsrc/ODS-Framework/ckeditor/lang/en.js b/appsrc/ODS-Framework/ckeditor/lang/en.js
index 7cf7dd0..ce35fd2 100644
--- a/appsrc/ODS-Framework/ckeditor/lang/en.js
+++ b/appsrc/ODS-Framework/ckeditor/lang/en.js
@@ -1,6 +1,6 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.lang.en={dir:'ltr',editorTitle:'Rich text editor, %1, press ALT 0 for help.',toolbar:'Toolbar',editor:'Rich Text Editor',source:'Source',newPage:'New Page',save:'Save',preview:'Preview',cut:'Cut',copy:'Copy',paste:'Paste',print:'Print',underline:'Underline',bold:'Bold',italic:'Italic',selectAll:'Select All',removeFormat:'Remove Format',strike:'Strike Through',subscript:'Subscript',superscript:'Superscript',horizontalrule:'Insert Horizontal Line',pagebreak:'Insert Page Break for Printing',unlink:'Unlink',undo:'Undo',redo:'Redo',common:{browseServer:'Browse Server',url:'URL',protocol:'Protocol',upload:'Upload',uploadSubmit:'Send it to the Server',image:'Image',flash:'Flash',form:'Form',checkbox:'Checkbox',radio:'Radio Button',textField:'Text Field',textarea:'Textarea',hiddenField:'Hidden Field',button:'Button',select:'Selection Field',imageButton:'Image Button',notSet:'<not set>',id:'Id',name:'Name',langDir:'Language Direction',langDirLtr:'Left to Right (LTR)',langDirRtl:'Right to Left (RTL)',langCode:'Language Code',longDescr:'Long Description URL',cssClass:'Stylesheet Classes',advisoryTitle:'Advisory Title',cssStyle:'Style',ok:'OK',cancel:'Cancel',close:'Close',preview:'Preview',generalTab:'General',advancedTab:'Advanced',validateNumberFailed:'This value is not a number.',confirmNewPage:'Any unsaved changes to this content will be lost. Are you sure you want to load new page?',confirmCancel:'Some of the options have been changed. Are you sure to close the dialog?',options:'Options',target:'Target',targetNew:'New Window (_blank)',targetTop:'Topmost Window (_top)',targetSelf:'Same Window (_self)',targetParent:'Parent Window (_parent)',unavailable:'%1<span class="cke_accessibility">, unavailable</span>'},contextmenu:{options:'Context Menu Options'},specialChar:{toolbar:'Insert Special Character',title:'Select Special Character',options:'Special Character Options'},link:{toolbar:'Link',other:'<other>',menu:'Edit Link',title:'Link',info:'Link Info',target:'Target',upload:'Upload',advanced:'Advanced',type:'Link Type',toUrl:'URL',toAnchor:'Link to anchor in the text',toEmail:'E-mail',targetFrame:'<frame>',targetPopup:'<popup window>',targetFrameName:'Target Frame Name',targetPopupName:'Popup Window Name',popupFeatures:'Popup Window Features',popupResizable:'Resizable',popupStatusBar:'Status Bar',popupLocationBar:'Location Bar',popupToolbar:'Toolbar',popupMenuBar:'Menu Bar',popupFullScreen:'Full Screen (IE)',popupScrollBars:'Scroll Bars',popupDependent:'Dependent (Netscape)',popupWidth:'Width',popupLeft:'Left Position',popupHeight:'Height',popupTop:'Top Position',id:'Id',langDir:'Language Direction',langDirLTR:'Left to Right (LTR)',langDirRTL:'Right to Left (RTL)',acccessKey:'Access Key',name:'Name',langCode:'Language Code',tabIndex:'Tab Index',advisoryTitle:'Advisory Title',advisoryContentType:'Advisory Content Type',cssClasses:'Stylesheet Classes',charset:'Linked Resource Charset',styles:'Style',selectAnchor:'Select an Anchor',anchorName:'By Anchor Name',anchorId:'By Element Id',emailAddress:'E-Mail Address',emailSubject:'Message Subject',emailBody:'Message Body',noAnchors:'(No anchors available in the document)',noUrl:'Please type the link URL',noEmail:'Please type the e-mail address'},anchor:{toolbar:'Anchor',menu:'Edit Anchor',title:'Anchor Properties',name:'Anchor Name',errorName:'Please type the anchor name'},list:{numberedTitle:'Numbered List Properties',bulletedTitle:'Bulleted List Properties',type:'Type',start:'Start',circle:'Circle',disc:'Disc',square:'Square',none:'None',notset:'<not set>',armenian:'Armenian numbering',georgian:'Georgian numbering (an, ban, gan, etc.)',lowerRoman:'Lower Roman (i, ii, iii, iv, v, etc.)',upperRoman:'Upper Roman (I, II, III, IV, V, etc.)',lowerAlpha:'Lower Alpha (a, b, c, d, e, etc.)',upperAlpha:'Upper Alpha (A, B, C, D, E, etc.)',lowerGreek:'Lower Greek (alpha, beta, gamma, etc.)',decimal:'Decimal (1, 2, 3, etc.)',decimalLeadingZero:'Decimal leading zero (01, 02, 03, etc.)'},findAndReplace:{title:'Find and Replace',find:'Find',replace:'Replace',findWhat:'Find what:',replaceWith:'Replace with:',notFoundMsg:'The specified text was not found.',matchCase:'Match case',matchWord:'Match whole word',matchCyclic:'Match cyclic',replaceAll:'Replace All',replaceSuccessMsg:'%1 occurrence(s) replaced.'},table:{toolbar:'Table',title:'Table Properties',menu:'Table Properties',deleteTable:'Delete Table',rows:'Rows',columns:'Columns',border:'Border size',align:'Alignment',alignLeft:'Left',alignCenter:'Center',alignRight:'Right',width:'Width',widthPx:'pixels',widthPc:'percent',widthUnit:'width unit',height:'Height',cellSpace:'Cell spacing',cellPad:'Cell padding',caption:'Caption',summary:'Summary',headers:'Headers',headersNone:'None',headersColumn:'First column',headersRow:'First Row',headersBoth:'Both',invalidRows:'Number of rows must be a number greater than 0.',invalidCols:'Number of columns must be a number greater than 0.',invalidBorder:'Border size must be a number.',invalidWidth:'Table width must be a number.',invalidHeight:'Table height must be a number.',invalidCellSpacing:'Cell spacing must be a number.',invalidCellPadding:'Cell padding must be a number.',cell:{menu:'Cell',insertBefore:'Insert Cell Before',insertAfter:'Insert Cell After',deleteCell:'Delete Cells',merge:'Merge Cells',mergeRight:'Merge Right',mergeDown:'Merge Down',splitHorizontal:'Split Cell Horizontally',splitVertical:'Split Cell Vertically',title:'Cell Properties',cellType:'Cell Type',rowSpan:'Rows Span',colSpan:'Columns Span',wordWrap:'Word Wrap',hAlign:'Horizontal Alignment',vAlign:'Vertical Alignment',alignTop:'Top',alignMiddle:'Middle',alignBottom:'Bottom',alignBaseline:'Baseline',bgColor:'Background Color',borderColor:'Border Color',data:'Data',header:'Header',yes:'Yes',no:'No',invalidWidth:'Cell width must be a number.',invalidHeight:'Cell height must be a number.',invalidRowSpan:'Rows span must be a whole number.',invalidColSpan:'Columns span must be a whole number.',chooseColor:'Choose'},row:{menu:'Row',insertBefore:'Insert Row Before',insertAfter:'Insert Row After',deleteRow:'Delete Rows'},column:{menu:'Column',insertBefore:'Insert Column Before',insertAfter:'Insert Column After',deleteColumn:'Delete Columns'}},button:{title:'Button Properties',text:'Text (Value)',type:'Type',typeBtn:'Button',typeSbm:'Submit',typeRst:'Reset'},checkboxAndRadio:{checkboxTitle:'Checkbox Properties',radioTitle:'Radio Button Properties',value:'Value',selected:'Selected'},form:{title:'Form Properties',menu:'Form Properties',action:'Action',method:'Method',encoding:'Encoding'},select:{title:'Selection Field Properties',selectInfo:'Select Info',opAvail:'Available Options',value:'Value',size:'Size',lines:'lines',chkMulti:'Allow multiple selections',opText:'Text',opValue:'Value',btnAdd:'Add',btnModify:'Modify',btnUp:'Up',btnDown:'Down',btnSetValue:'Set as selected value',btnDelete:'Delete'},textarea:{title:'Textarea Properties',cols:'Columns',rows:'Rows'},textfield:{title:'Text Field Properties',name:'Name',value:'Value',charWidth:'Character Width',maxChars:'Maximum Characters',type:'Type',typeText:'Text',typePass:'Password'},hidden:{title:'Hidden Field Properties',name:'Name',value:'Value'},image:{title:'Image Properties',titleButton:'Image Button Properties',menu:'Image Properties',infoTab:'Image Info',btnUpload:'Send it to the Server',upload:'Upload',alt:'Alternative Text',width:'Width',height:'Height',lockRatio:'Lock Ratio',unlockRatio:'Unlock Ratio',resetSize:'Reset Size',border:'Border',hSpace:'HSpace',vSpace:'VSpace',align:'Align',alignLeft:'Left',alignRight:'Right',alertUrl:'Please type the image URL',linkTab:'Link',button2Img:'Do you want to transform the selected image button on a simple image?',img2Button:'Do you want to transform the selected image on a image button?',urlMissing:'Image source URL is missing.',validateWidth:'Width must be a whole number.',validateHeight:'Height must be a whole number.',validateBorder:'Border must be a whole number.',validateHSpace:'HSpace must be a whole number.',validateVSpace:'VSpace must be a whole number.'},flash:{properties:'Flash Properties',propertiesTab:'Properties',title:'Flash Properties',chkPlay:'Auto Play',chkLoop:'Loop',chkMenu:'Enable Flash Menu',chkFull:'Allow Fullscreen',scale:'Scale',scaleAll:'Show all',scaleNoBorder:'No Border',scaleFit:'Exact Fit',access:'Script Access',accessAlways:'Always',accessSameDomain:'Same domain',accessNever:'Never',align:'Align',alignLeft:'Left',alignAbsBottom:'Abs Bottom',alignAbsMiddle:'Abs Middle',alignBaseline:'Baseline',alignBottom:'Bottom',alignMiddle:'Middle',alignRight:'Right',alignTextTop:'Text Top',alignTop:'Top',quality:'Quality',qualityBest:'Best',qualityHigh:'High',qualityAutoHigh:'Auto High',qualityMedium:'Medium',qualityAutoLow:'Auto Low',qualityLow:'Low',windowModeWindow:'Window',windowModeOpaque:'Opaque',windowModeTransparent:'Transparent',windowMode:'Window mode',flashvars:'Variables for Flash',bgcolor:'Background color',width:'Width',height:'Height',hSpace:'HSpace',vSpace:'VSpace',validateSrc:'URL must not be empty.',validateWidth:'Width must be a number.',validateHeight:'Height must be a number.',validateHSpace:'HSpace must be a number.',validateVSpace:'VSpace must be a number.'},spellCheck:{toolbar:'Check Spelling',title:'Spell Check',notAvailable:'Sorry, but service is unavailable now.',errorLoading:'Error loading application service host: %s.',notInDic:'Not in dictionary',changeTo:'Change to',btnIgnore:'Ignore',btnIgnoreAll:'Ignore All',btnReplace:'Replace',btnReplaceAll:'Replace All',btnUndo:'Undo',noSuggestions:'- No suggestions -',progress:'Spell check in progress...',noMispell:'Spell check complete: No misspellings found',noChanges:'Spell check complete: No words changed',oneChange:'Spell check complete: One word changed',manyChanges:'Spell check complete: %1 words changed',ieSpellDownload:'Spell checker not installed. Do you want to download it now?'},smiley:{toolbar:'Smiley',title:'Insert a Smiley',options:'Smiley Options'},elementsPath:{eleLabel:'Elements path',eleTitle:'%1 element'},numberedlist:'Insert/Remove Numbered List',bulletedlist:'Insert/Remove Bulleted List',indent:'Increase Indent',outdent:'Decrease Indent',justify:{left:'Left Justify',center:'Center Justify',right:'Right Justify',block:'Block Justify'},blockquote:'Block Quote',clipboard:{title:'Paste',cutError:"Your browser security settings don't permit the editor to automatically execute cutting operations. Please use the keyboard for that (Ctrl/Cmd+X).",copyError:"Your browser security settings don't permit the editor to automatically execute copying operations. Please use the keyboard for that (Ctrl/Cmd+C).",pasteMsg:'Please paste inside the following box using the keyboard (<strong>Ctrl/Cmd+V</strong>) and hit OK',securityMsg:'Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.',pasteArea:'Paste Area'},pastefromword:{confirmCleanup:'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?',toolbar:'Paste from Word',title:'Paste from Word',error:'It was not possible to clean up the pasted data due to an internal error'},pasteText:{button:'Paste as plain text',title:'Paste as Plain Text'},templates:{button:'Templates',title:'Content Templates',options:'Template Options',insertOption:'Replace actual contents',selectPromptMsg:'Please select the template to open in the editor',emptyListMsg:'(No templates defined)'},showBlocks:'Show Blocks',stylesCombo:{label:'Styles',panelTitle:'Formatting Styles',panelTitle1:'Block Styles',panelTitle2:'Inline Styles',panelTitle3:'Object Styles'},format:{label:'Format',panelTitle:'Paragraph Format',tag_p:'Normal',tag_pre:'Formatted',tag_address:'Address',tag_h1:'Heading 1',tag_h2:'Heading 2',tag_h3:'Heading 3',tag_h4:'Heading 4',tag_h5:'Heading 5',tag_h6:'Heading 6',tag_div:'Normal (DIV)'},div:{title:'Create Div Container',toolbar:'Create Div Container',cssClassInputLabel:'Stylesheet Classes',styleSelectLabel:'Style',IdInputLabel:'Id',languageCodeInputLabel:' Language Code',inlineStyleInputLabel:'Inline Style',advisoryTitleInputLabel:'Advisory Title',langDirLabel:'Language Direction',langDirLTRLabel:'Left to Right (LTR)',langDirRTLLabel:'Right to Left (RTL)',edit:'Edit Div',remove:'Remove Div'},font:{label:'Font',voiceLabel:'Font',panelTitle:'Font Name'},fontSize:{label:'Size',voiceLabel:'Font Size',panelTitle:'Font Size'},colorButton:{textColorTitle:'Text Color',bgColorTitle:'Background Color',panelTitle:'Colors',auto:'Automatic',more:'More Colors...'},colors:{'000':'Black',800000:'Maroon','8B4513':'Saddle Brown','2F4F4F':'Dark Slate Gray','008080':'Teal','000080':'Navy','4B0082':'Indigo',696969:'Dim Gray',B22222:'Fire Brick',A52A2A:'Brown',DAA520:'Golden Rod','006400':'Dark Green','40E0D0':'Turquoise','0000CD':'Medium Blue',800080:'Purple',808080:'Gray',F00:'Red',FF8C00:'Dark Orange',FFD700:'Gold','008000':'Green','0FF':'Cyan','00F':'Blue',EE82EE:'Violet',A9A9A9:'Dark Gray',FFA07A:'Light Salmon',FFA500:'Orange',FFFF00:'Yellow','00FF00':'Lime',AFEEEE:'Pale Turquoise',ADD8E6:'Light Blue',DDA0DD:'Plum',D3D3D3:'Light Grey',FFF0F5:'Lavender Blush',FAEBD7:'Antique White',FFFFE0:'Light Yellow',F0FFF0:'Honeydew',F0FFFF:'Azure',F0F8FF:'Alice Blue',E6E6FA:'Lavender',FFF:'White'},scayt:{title:'Spell Check As You Type',opera_title:'Not supported by Opera',enable:'Enable SCAYT',disable:'Disable SCAYT',about:'About SCAYT',toggle:'Toggle SCAYT',options:'Options',langs:'Languages',moreSuggestions:'More suggestions',ignore:'Ignore',ignoreAll:'Ignore All',addWord:'Add Word',emptyDic:'Dictionary name should not be empty.',optionsTab:'Options',allCaps:'Ignore All-Caps Words',ignoreDomainNames:'Ignore Domain Names',mixedCase:'Ignore Words with Mixed Case',mixedWithDigits:'Ignore Words with Numbers',languagesTab:'Languages',dictionariesTab:'Dictionaries',dic_field_name:'Dictionary name',dic_create:'Create',dic_restore:'Restore',dic_delete:'Delete',dic_rename:'Rename',dic_info:"Initially the User Dictionary is stored in a Cookie. However, Cookies are limited in size. When the User Dictionary grows to a point where it cannot be stored in a Cookie, then the dictionary may be stored on our server. To store your personal dictionary on our server you should specify a name for your dictionary. If you already have a stored dictionary, please type it's name and click the Restore button.",aboutTab:'About'},about:{title:'About CKEditor',dlgTitle:'About CKEditor',moreInfo:'For licensing information please visit our web site:',copy:'Copyright © $1. All rights reserved.'},maximize:'Maximize',minimize:'Minimize',fakeobjects:{anchor:'Anchor',flash:'Flash Animation',div:'Page Break',unknown:'Unknown Object'},resize:'Drag to resize',colordialog:{title:'Select color',options:'Color Options',highlight:'Highlight',selected:'Selected Color',clear:'Clear'},toolbarCollapse:'Collapse Toolbar',toolbarExpand:'Expand Toolbar'};
+CKEDITOR.lang.en={dir:'ltr',editorTitle:'Rich text editor, %1, press ALT 0 for help.',toolbar:'Toolbar',editor:'Rich Text Editor',source:'Source',newPage:'New Page',save:'Save',preview:'Preview',cut:'Cut',copy:'Copy',paste:'Paste',print:'Print',underline:'Underline',bold:'Bold',italic:'Italic',selectAll:'Select All',removeFormat:'Remove Format',strike:'Strike Through',subscript:'Subscript',superscript:'Superscript',horizontalrule:'Insert Horizontal Line',pagebreak:'Insert Page Break for Printing',pagebreakAlt:'Page Break',unlink:'Unlink',undo:'Undo',redo:'Redo',common:{browseServer:'Browse Server',url:'URL',protocol:'Protocol',upload:'Upload',uploadSubmit:'Send it to the Server',image:'Image',flash:'Flash',form:'Form',checkbox:'Checkbox',radio:'Radio Button',textField:'Text Field',textarea:'Textarea',hiddenField:'Hidden Field',button:'Button',select:'Selection Field',imageButton:'Image Button',notSet:'<not set>',id:'Id',name:'Name',langDir:'Language Direction',langDirLtr:'Left to Right (LTR)',langDirRtl:'Right to Left (RTL)',langCode:'Language Code',longDescr:'Long Description URL',cssClass:'Stylesheet Classes',advisoryTitle:'Advisory Title',cssStyle:'Style',ok:'OK',cancel:'Cancel',close:'Close',preview:'Preview',generalTab:'General',advancedTab:'Advanced',validateNumberFailed:'This value is not a number.',confirmNewPage:'Any unsaved changes to this content will be lost. Are you sure you want to load new page?',confirmCancel:'Some of the options have been changed. Are you sure to close the dialog?',options:'Options',target:'Target',targetNew:'New Window (_blank)',targetTop:'Topmost Window (_top)',targetSelf:'Same Window (_self)',targetParent:'Parent Window (_parent)',langDirLTR:'Left to Right (LTR)',langDirRTL:'Right to Left (RTL)',styles:'Style',cssClasses:'Stylesheet Classes',width:'Width',height:'Height',align:'Alignment',alignLeft:'Left',alignRight:'Right',alignCenter:'Center',alignTop:'Top',alignMiddle:'Middle',alignBottom:'Bottom',invalidHeight:'Height must be a number.',invalidWidth:'Width must be a number.',unavailable:'%1<span class="cke_accessibility">, unavailable</span>'},contextmenu:{options:'Context Menu Options'},specialChar:{toolbar:'Insert Special Character',title:'Select Special Character',options:'Special Character Options'},link:{toolbar:'Link',other:'<other>',menu:'Edit Link',title:'Link',info:'Link Info',target:'Target',upload:'Upload',advanced:'Advanced',type:'Link Type',toUrl:'URL',toAnchor:'Link to anchor in the text',toEmail:'E-mail',targetFrame:'<frame>',targetPopup:'<popup window>',targetFrameName:'Target Frame Name',targetPopupName:'Popup Window Name',popupFeatures:'Popup Window Features',popupResizable:'Resizable',popupStatusBar:'Status Bar',popupLocationBar:'Location Bar',popupToolbar:'Toolbar',popupMenuBar:'Menu Bar',popupFullScreen:'Full Screen (IE)',popupScrollBars:'Scroll Bars',popupDependent:'Dependent (Netscape)',popupLeft:'Left Position',popupTop:'Top Position',id:'Id',langDir:'Language Direction',langDirLTR:'Left to Right (LTR)',langDirRTL:'Right to Left (RTL)',acccessKey:'Access Key',name:'Name',langCode:'Language Code',tabIndex:'Tab Index',advisoryTitle:'Advisory Title',advisoryContentType:'Advisory Content Type',cssClasses:'Stylesheet Classes',charset:'Linked Resource Charset',styles:'Style',selectAnchor:'Select an Anchor',anchorName:'By Anchor Name',anchorId:'By Element Id',emailAddress:'E-Mail Address',emailSubject:'Message Subject',emailBody:'Message Body',noAnchors:'(No anchors available in the document)',noUrl:'Please type the link URL',noEmail:'Please type the e-mail address'},anchor:{toolbar:'Anchor',menu:'Edit Anchor',title:'Anchor Properties',name:'Anchor Name',errorName:'Please type the anchor name'},list:{numberedTitle:'Numbered List Properties',bulletedTitle:'Bulleted List Properties',type:'Type',start:'Start',validateStartNumber:'List start number must be a whole number.',circle:'Circle',disc:'Disc',square:'Square',none:'None',notset:'<not set>',armenian:'Armenian numbering',georgian:'Georgian numbering (an, ban, gan, etc.)',lowerRoman:'Lower Roman (i, ii, iii, iv, v, etc.)',upperRoman:'Upper Roman (I, II, III, IV, V, etc.)',lowerAlpha:'Lower Alpha (a, b, c, d, e, etc.)',upperAlpha:'Upper Alpha (A, B, C, D, E, etc.)',lowerGreek:'Lower Greek (alpha, beta, gamma, etc.)',decimal:'Decimal (1, 2, 3, etc.)',decimalLeadingZero:'Decimal leading zero (01, 02, 03, etc.)'},findAndReplace:{title:'Find and Replace',find:'Find',replace:'Replace',findWhat:'Find what:',replaceWith:'Replace with:',notFoundMsg:'The specified text was not found.',matchCase:'Match case',matchWord:'Match whole word',matchCyclic:'Match cyclic',replaceAll:'Replace All',replaceSuccessMsg:'%1 occurrence(s) replaced.'},table:{toolbar:'Table',title:'Table Properties',menu:'Table Properties',deleteTable:'Delete Table',rows:'Rows',columns:'Columns',border:'Border size',widthPx:'pixels',widthPc:'percent',widthUnit:'width unit',cellSpace:'Cell spacing',cellPad:'Cell padding',caption:'Caption',summary:'Summary',headers:'Headers',headersNone:'None',headersColumn:'First column',headersRow:'First Row',headersBoth:'Both',invalidRows:'Number of rows must be a number greater than 0.',invalidCols:'Number of columns must be a number greater than 0.',invalidBorder:'Border size must be a number.',invalidWidth:'Table width must be a number.',invalidHeight:'Table height must be a number.',invalidCellSpacing:'Cell spacing must be a number.',invalidCellPadding:'Cell padding must be a number.',cell:{menu:'Cell',insertBefore:'Insert Cell Before',insertAfter:'Insert Cell After',deleteCell:'Delete Cells',merge:'Merge Cells',mergeRight:'Merge Right',mergeDown:'Merge Down',splitHorizontal:'Split Cell Horizontally',splitVertical:'Split Cell Vertically',title:'Cell Properties',cellType:'Cell Type',rowSpan:'Rows Span',colSpan:'Columns Span',wordWrap:'Word Wrap',hAlign:'Horizontal Alignment',vAlign:'Vertical Alignment',alignBaseline:'Baseline',bgColor:'Background Color',borderColor:'Border Color',data:'Data',header:'Header',yes:'Yes',no:'No',invalidWidth:'Cell width must be a number.',invalidHeight:'Cell height must be a number.',invalidRowSpan:'Rows span must be a whole number.',invalidColSpan:'Columns span must be a whole number.',chooseColor:'Choose'},row:{menu:'Row',insertBefore:'Insert Row Before',insertAfter:'Insert Row After',deleteRow:'Delete Rows'},column:{menu:'Column',insertBefore:'Insert Column Before',insertAfter:'Insert Column After',deleteColumn:'Delete Columns'}},button:{title:'Button Properties',text:'Text (Value)',type:'Type',typeBtn:'Button',typeSbm:'Submit',typeRst:'Reset'},checkboxAndRadio:{checkboxTitle:'Checkbox Properties',radioTitle:'Radio Button Properties',value:'Value',selected:'Selected'},form:{title:'Form Properties',menu:'Form Properties',action:'Action',method:'Method',encoding:'Encoding'},select:{title:'Selection Field Properties',selectInfo:'Select Info',opAvail:'Available Options',value:'Value',size:'Size',lines:'lines',chkMulti:'Allow multiple selections',opText:'Text',opValue:'Value',btnAdd:'Add',btnModify:'Modify',btnUp:'Up',btnDown:'Down',btnSetValue:'Set as selected value',btnDelete:'Delete'},textarea:{title:'Textarea Properties',cols:'Columns',rows:'Rows'},textfield:{title:'Text Field Properties',name:'Name',value:'Value',charWidth:'Character Width',maxChars:'Maximum Characters',type:'Type',typeText:'Text',typePass:'Password'},hidden:{title:'Hidden Field Properties',name:'Name',value:'Value'},image:{title:'Image Properties',titleButton:'Image Button Properties',menu:'Image Properties',infoTab:'Image Info',btnUpload:'Send it to the Server',upload:'Upload',alt:'Alternative Text',lockRatio:'Lock Ratio',unlockRatio:'Unlock Ratio',resetSize:'Reset Size',border:'Border',hSpace:'HSpace',vSpace:'VSpace',alertUrl:'Please type the image URL',linkTab:'Link',button2Img:'Do you want to transform the selected image button on a simple image?',img2Button:'Do you want to transform the selected image on a image button?',urlMissing:'Image source URL is missing.',validateBorder:'Border must be a whole number.',validateHSpace:'HSpace must be a whole number.',validateVSpace:'VSpace must be a whole number.'},flash:{properties:'Flash Properties',propertiesTab:'Properties',title:'Flash Properties',chkPlay:'Auto Play',chkLoop:'Loop',chkMenu:'Enable Flash Menu',chkFull:'Allow Fullscreen',scale:'Scale',scaleAll:'Show all',scaleNoBorder:'No Border',scaleFit:'Exact Fit',access:'Script Access',accessAlways:'Always',accessSameDomain:'Same domain',accessNever:'Never',alignAbsBottom:'Abs Bottom',alignAbsMiddle:'Abs Middle',alignBaseline:'Baseline',alignTextTop:'Text Top',quality:'Quality',qualityBest:'Best',qualityHigh:'High',qualityAutoHigh:'Auto High',qualityMedium:'Medium',qualityAutoLow:'Auto Low',qualityLow:'Low',windowModeWindow:'Window',windowModeOpaque:'Opaque',windowModeTransparent:'Transparent',windowMode:'Window mode',flashvars:'Variables for Flash',bgcolor:'Background color',hSpace:'HSpace',vSpace:'VSpace',validateSrc:'URL must not be empty.',validateHSpace:'HSpace must be a number.',validateVSpace:'VSpace must be a number.'},spellCheck:{toolbar:'Check Spelling',title:'Spell Check',notAvailable:'Sorry, but service is unavailable now.',errorLoading:'Error loading application service host: %s.',notInDic:'Not in dictionary',changeTo:'Change to',btnIgnore:'Ignore',btnIgnoreAll:'Ignore All',btnReplace:'Replace',btnReplaceAll:'Replace All',btnUndo:'Undo',noSuggestions:'- No suggestions -',progress:'Spell check in progress...',noMispell:'Spell check complete: No misspellings found',noChanges:'Spell check complete: No words changed',oneChange:'Spell check complete: One word changed',manyChanges:'Spell check complete: %1 words changed',ieSpellDownload:'Spell checker not installed. Do you want to download it now?'},smiley:{toolbar:'Smiley',title:'Insert a Smiley',options:'Smiley Options'},elementsPath:{eleLabel:'Elements path',eleTitle:'%1 element'},numberedlist:'Insert/Remove Numbered List',bulletedlist:'Insert/Remove Bulleted List',indent:'Increase Indent',outdent:'Decrease Indent',justify:{left:'Align Left',center:'Center',right:'Align Right',block:'Justify'},blockquote:'Block Quote',clipboard:{title:'Paste',cutError:"Your browser security settings don't permit the editor to automatically execute cutting operations. Please use the keyboard for that (Ctrl/Cmd+X).",copyError:"Your browser security settings don't permit the editor to automatically execute copying operations. Please use the keyboard for that (Ctrl/Cmd+C).",pasteMsg:'Please paste inside the following box using the keyboard (<strong>Ctrl/Cmd+V</strong>) and hit OK',securityMsg:'Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.',pasteArea:'Paste Area'},pastefromword:{confirmCleanup:'The text you want to paste seems to be copied from Word. Do you want to clean it before pasting?',toolbar:'Paste from Word',title:'Paste from Word',error:'It was not possible to clean up the pasted data due to an internal error'},pasteText:{button:'Paste as plain text',title:'Paste as Plain Text'},templates:{button:'Templates',title:'Content Templates',options:'Template Options',insertOption:'Replace actual contents',selectPromptMsg:'Please select the template to open in the editor',emptyListMsg:'(No templates defined)'},showBlocks:'Show Blocks',stylesCombo:{label:'Styles',panelTitle:'Formatting Styles',panelTitle1:'Block Styles',panelTitle2:'Inline Styles',panelTitle3:'Object Styles'},format:{label:'Format',panelTitle:'Paragraph Format',tag_p:'Normal',tag_pre:'Formatted',tag_address:'Address',tag_h1:'Heading 1',tag_h2:'Heading 2',tag_h3:'Heading 3',tag_h4:'Heading 4',tag_h5:'Heading 5',tag_h6:'Heading 6',tag_div:'Normal (DIV)'},div:{title:'Create Div Container',toolbar:'Create Div Container',cssClassInputLabel:'Stylesheet Classes',styleSelectLabel:'Style',IdInputLabel:'Id',languageCodeInputLabel:' Language Code',inlineStyleInputLabel:'Inline Style',advisoryTitleInputLabel:'Advisory Title',langDirLabel:'Language Direction',langDirLTRLabel:'Left to Right (LTR)',langDirRTLLabel:'Right to Left (RTL)',edit:'Edit Div',remove:'Remove Div'},iframe:{title:'IFrame Properties',toolbar:'IFrame',noUrl:'Please type the iframe URL',scrolling:'Enable scrollbars',border:'Show frame border'},font:{label:'Font',voiceLabel:'Font',panelTitle:'Font Name'},fontSize:{label:'Size',voiceLabel:'Font Size',panelTitle:'Font Size'},colorButton:{textColorTitle:'Text Color',bgColorTitle:'Background Color',panelTitle:'Colors',auto:'Automatic',more:'More Colors...'},colors:{'000':'Black',800000:'Maroon','8B4513':'Saddle Brown','2F4F4F':'Dark Slate Gray','008080':'Teal','000080':'Navy','4B0082':'Indigo',696969:'Dark Gray',B22222:'Fire Brick',A52A2A:'Brown',DAA520:'Golden Rod','006400':'Dark Green','40E0D0':'Turquoise','0000CD':'Medium Blue',800080:'Purple',808080:'Gray',F00:'Red',FF8C00:'Dark Orange',FFD700:'Gold','008000':'Green','0FF':'Cyan','00F':'Blue',EE82EE:'Violet',A9A9A9:'Dim Gray',FFA07A:'Light Salmon',FFA500:'Orange',FFFF00:'Yellow','00FF00':'Lime',AFEEEE:'Pale Turquoise',ADD8E6:'Light Blue',DDA0DD:'Plum',D3D3D3:'Light Grey',FFF0F5:'Lavender Blush',FAEBD7:'Antique White',FFFFE0:'Light Yellow',F0FFF0:'Honeydew',F0FFFF:'Azure',F0F8FF:'Alice Blue',E6E6FA:'Lavender',FFF:'White'},scayt:{title:'Spell Check As You Type',opera_title:'Not supported by Opera',enable:'Enable SCAYT',disable:'Disable SCAYT',about:'About SCAYT',toggle:'Toggle SCAYT',options:'Options',langs:'Languages',moreSuggestions:'More suggestions',ignore:'Ignore',ignoreAll:'Ignore All',addWord:'Add Word',emptyDic:'Dictionary name should not be empty.',optionsTab:'Options',allCaps:'Ignore All-Caps Words',ignoreDomainNames:'Ignore Domain Names',mixedCase:'Ignore Words with Mixed Case',mixedWithDigits:'Ignore Words with Numbers',languagesTab:'Languages',dictionariesTab:'Dictionaries',dic_field_name:'Dictionary name',dic_create:'Create',dic_restore:'Restore',dic_delete:'Delete',dic_rename:'Rename',dic_info:'Initially the User Dictionary is stored in a Cookie. However, Cookies are limited in size. When the User Dictionary grows to a point where it cannot be stored in a Cookie, then the dictionary may be stored on our server. To store your personal dictionary on our server you should specify a name for your dictionary. If you already have a stored dictionary, please type its name and click the Restore button.',aboutTab:'About'},about:{title:'About CKEditor',dlgTitle:'About CKEditor',moreInfo:'For licensing information please visit our web site:',copy:'Copyright © $1. All rights reserved.'},maximize:'Maximize',minimize:'Minimize',fakeobjects:{anchor:'Anchor',flash:'Flash Animation',iframe:'IFrame',hiddenfield:'Hidden Field',unknown:'Unknown Object'},resize:'Drag to resize',colordialog:{title:'Select color',options:'Color Options',highlight:'Highlight',selected:'Selected Color',clear:'Clear'},toolbarCollapse:'Collapse Toolbar',toolbarExpand:'Expand Toolbar',bidi:{ltr:'Text direction from left to right',rtl:'Text direction from right to left'}};
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/clipboard/dialogs/paste.js b/appsrc/ODS-Framework/ckeditor/plugins/clipboard/dialogs/paste.js
index ceffa5e..e9e2dda 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/clipboard/dialogs/paste.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/clipboard/dialogs/paste.js
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.dialog.add('paste',function(a){var b=a.lang.clipboard,c=CKEDITOR.env.isCustomDomain();function d(e){var f=new CKEDITOR.dom.document(e.document),g=f.$;f.getById('cke_actscrpt').remove();CKEDITOR.env.ie?g.body.contentEditable='true':g.designMode='on';if(CKEDITOR.env.ie&&CKEDITOR.env.version<8)f.getWindow().on('blur',function(){g.selection.empty();});f.on('keydown',function(h){var i=h.data,j=i.getKeystroke(),k;switch(j){case 27:this.hide();k=1;break;case 9:case CKEDITOR.SHIFT+9:this.changeFocus(true);k=1;}k&&i.preventDefault();},this);a.fire('ariaWidget',new CKEDITOR.dom.element(e.frameElement));};return{title:b.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?370:350,minHeight:CKEDITOR.env.quirks?250:245,onShow:function(){this.parts.dialog.$.offsetHeight;var e='<html dir="'+a.config.contentsLangDirection+'"'+' lang="'+(a.config.contentsLanguage||a.langCode)+'">'+'<head><style>body { margin: 3px; height: 95%; } </style></head><body>'+'<script id="cke_actscrpt" type="text/javascript">'+'window.parent.CKEDITOR.tools.callFunction( '+CKEDITOR.tools.addFunction(d,this)+', this );'+'</script></body>'+'</html>',f=CKEDITOR.dom.element.createFromHtml('<iframe frameborder="0"  allowTransparency="true"'+(c?" src=\"javascript:void((function(){document.open();document.domain='"+document.domain+"';"+'document.close();'+'})())"':'')+' role="region"'+' aria-label="'+b.pasteArea+'"'+' aria-describedby="'+this.getContentElement('general','pasteMsg').domId+'"'+' aria-multiple="true"'+'></iframe>');f.on('load',function(j){j.removeListener();var k=f.getFrameDocument().$;k.open();if(c)k.domain=document.domain;k.write(e);k.close();},this);f.setStyles({width:'346px',height:'130px','background-color':'white',border:'1px solid black'});f.setCustomData('dialog',this);var g=this.getContentElement('general','editing_area'),h=g.getElement();h.setHtml('');h.append(f);if(CKEDITOR.env.ie){var i=CKEDITOR.dom.element.createFromHtml('<span tabindex="-1" style="position:absolute;" role="presentation"></span>');i.on('focus',function(){f.$.contentWindow.focus();});h.append(i);g.focus=function(){i.focus();this.fire('focus');};}g.getInputElement=function(){return f;};if(CKEDITOR.env.ie){h.setStyle('display','block');h.setStyle('height',f.$.offsetHeight+2+'px');}},onHide:function(){if(CKEDITOR.env.ie)this.getParentEditor().document.getBody().$.contentEditable='true';},onLoad:function(){if((CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat)&&a.lang.dir=='rtl')this.parts.contents.setStyle('overflow','hidden');
-},onOk:function(){var e=this.getContentElement('general','editing_area').getElement(),f=e.getElementsByTag('iframe').getItem(0),g=this.getParentEditor(),h=f.$.contentWindow.document.body.innerHTML;setTimeout(function(){g.fire('paste',{html:h});},0);},contents:[{id:'general',label:a.lang.common.generalTab,elements:[{type:'html',id:'securityMsg',html:'<div style="white-space:normal;width:340px;">'+b.securityMsg+'</div>'},{type:'html',id:'pasteMsg',html:'<div style="white-space:normal;width:340px;">'+b.pasteMsg+'</div>'},{type:'html',id:'editing_area',style:'width: 100%; height: 100%;',html:'',focus:function(){var e=this.getInputElement().$.contentWindow;setTimeout(function(){e.focus();},500);}}]}]};});
+CKEDITOR.dialog.add('paste',function(a){var b=a.lang.clipboard,c=CKEDITOR.env.isCustomDomain();function d(e){var f=new CKEDITOR.dom.document(e.document),g=f.$,h=f.getById('cke_actscrpt');h&&h.remove();CKEDITOR.env.ie?g.body.contentEditable='true':g.designMode='on';if(CKEDITOR.env.ie&&CKEDITOR.env.version<8)f.getWindow().on('blur',function(){g.selection.empty();});f.on('keydown',function(i){var j=i.data,k=j.getKeystroke(),l;switch(k){case 27:this.hide();l=1;break;case 9:case CKEDITOR.SHIFT+9:this.changeFocus(true);l=1;}l&&j.preventDefault();},this);a.fire('ariaWidget',new CKEDITOR.dom.element(e.frameElement));};return{title:b.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?370:350,minHeight:CKEDITOR.env.quirks?250:245,onShow:function(){this.parts.dialog.$.offsetHeight;var e='<html dir="'+a.config.contentsLangDirection+'"'+' lang="'+(a.config.contentsLanguage||a.langCode)+'">'+'<head><style>body { margin: 3px; height: 95%; } </style></head><body>'+'<script id="cke_actscrpt" type="text/javascript">'+'window.parent.CKEDITOR.tools.callFunction( '+CKEDITOR.tools.addFunction(d,this)+', this );'+'</script></body>'+'</html>',f=CKEDITOR.env.air?'javascript:void(0)':c?"javascript:void((function(){document.open();document.domain='"+document.domain+"';"+'document.close();'+'})())"':'',g=CKEDITOR.dom.element.createFromHtml('<iframe class="cke_pasteframe" frameborder="0"  allowTransparency="true" src="'+f+'"'+' role="region"'+' aria-label="'+b.pasteArea+'"'+' aria-describedby="'+this.getContentElement('general','pasteMsg').domId+'"'+' aria-multiple="true"'+'></iframe>');g.on('load',function(k){k.removeListener();var l=g.getFrameDocument();l.write(e);if(CKEDITOR.env.air)d.call(this,l.getWindow().$);},this);g.setCustomData('dialog',this);var h=this.getContentElement('general','editing_area'),i=h.getElement();i.setHtml('');i.append(g);if(CKEDITOR.env.ie){var j=CKEDITOR.dom.element.createFromHtml('<span tabindex="-1" style="position:absolute;" role="presentation"></span>');j.on('focus',function(){g.$.contentWindow.focus();});i.append(j);h.focus=function(){j.focus();this.fire('focus');};}h.getInputElement=function(){return g;};if(CKEDITOR.env.ie){i.setStyle('display','block');i.setStyle('height',g.$.offsetHeight+2+'px');}},onHide:function(){if(CKEDITOR.env.ie)this.getParentEditor().document.getBody().$.contentEditable='true';},onLoad:function(){if((CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat)&&a.lang.dir=='rtl')this.parts.contents.setStyle('overflow','hidden');},onOk:function(){var e=this.getContentElement('general','editing_area').getElement(),f=e.getElementsByTag('iframe').getItem(0),g=this.getParentEditor(),h=f.$.contentWindow.document.body.innerHTML;
+setTimeout(function(){g.fire('paste',{html:h});},0);},contents:[{id:'general',label:a.lang.common.generalTab,elements:[{type:'html',id:'securityMsg',html:'<div style="white-space:normal;width:340px;">'+b.securityMsg+'</div>'},{type:'html',id:'pasteMsg',html:'<div style="white-space:normal;width:340px;">'+b.pasteMsg+'</div>'},{type:'html',id:'editing_area',style:'width: 100%; height: 100%;',html:'',focus:function(){var e=this.getInputElement().$.contentWindow;setTimeout(function(){e.focus();},500);}}]}]};});
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/colordialog/dialogs/colordialog.js b/appsrc/ODS-Framework/ckeditor/plugins/colordialog/dialogs/colordialog.js
index 64e9463..1f4138f 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/colordialog/dialogs/colordialog.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/colordialog/dialogs/colordialog.js
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.dialog.add('colordialog',function(a){var b=CKEDITOR.dom.element,c=CKEDITOR.document,d=CKEDITOR.tools,e=a.lang.colordialog,f;function g(){return{type:'html',html:' '};};function h(){c.getById(w).removeStyle('background-color');f.getContentElement('picker','selectedColor').setValue('');};function i(x){if(!(x instanceof CKEDITOR.dom.event))x=new CKEDITOR.dom.event(x);var y=x.getTarget(),z;if(y.getName()=='a'&&(z=y.getChild(0).getHtml()))f.getContentElement('picker','selectedColor').setValue(z);};function j(x){if(!(x instanceof CKEDITOR.dom.event))x=x.data;var y=x.getTarget(),z;if(y.getName()=='a'&&(z=y.getChild(0).getHtml())){c.getById(u).setStyle('background-color',z);c.getById(v).setHtml(z);}};function k(){c.getById(u).removeStyle('background-color');c.getById(v).setHtml(' ');};var l=d.addFunction(k),m=i,n=CKEDITOR.tools.addFunction(m),o=j,p=k,q=CKEDITOR.tools.addFunction(function(x){x=new CKEDITOR.dom.event(x);var y=x.getTarget(),z,A,B=x.getKeystroke(),C=a.lang.dir=='rtl';switch(B){case 38:if(z=y.getParent().getParent().getPrevious()){A=z.getChild([y.getParent().getIndex(),0]);A.focus();p(x,y);o(x,A);}x.preventDefault();break;case 40:if(z=y.getParent().getParent().getNext()){A=z.getChild([y.getParent().getIndex(),0]);if(A&&A.type==1){A.focus();p(x,y);o(x,A);}}x.preventDefault();break;case 32:m(x);x.preventDefault();break;case C?37:39:if(z=y.getParent().getNext()){A=z.getChild(0);if(A.type==1){A.focus();p(x,y);o(x,A);x.preventDefault(true);}else p(null,y);}else if(z=y.getParent().getParent().getNext()){A=z.getChild([0,0]);if(A&&A.type==1){A.focus();p(x,y);o(x,A);x.preventDefault(true);}else p(null,y);}break;case C?39:37:if(z=y.getParent().getPrevious()){A=z.getChild(0);A.focus();p(x,y);o(x,A);x.preventDefault(true);}else if(z=y.getParent().getParent().getPrevious()){A=z.getLast().getChild(0);A.focus();p(x,y);o(x,A);x.preventDefault(true);}else p(null,y);break;default:return;}});function r(){var x=['00','33','66','99','cc','ff'];function y(D,E){for(var F=D;F<D+3;F++){var G=s.$.insertRow(-1);for(var H=E;H<E+3;H++)for(var I=0;I<6;I++)z(G,'#'+x[H]+x[I]+x[F]);}};function z(D,E){var F=new b(D.insertCell(-1));F.setAttribute('class','ColorCell');F.setStyle('background-color',E);F.setStyle('width','15px');F.setStyle('height','15px');var G=F.$.cellIndex+1+18*D.rowIndex;F.append(CKEDITOR.dom.element.createFromHtml('<a href="javascript: void(0);" role="option" aria-posinset="'+G+'"'+' aria-setsize="'+234+'"'+' style="cursor: pointer;display:block;width:100%;height:100% " title="'+CKEDITOR.tools.htmlEncode(E)+'"'+' onkeydown="CKEDITOR.tools.callFunction( '+q+', event, this )"'+' onclick="CKEDITOR.tools.callFunction('+n+', event, this ); return false;"'+' tabindex="-1"><span class="cke_voice_label">'+E+'</span> </a>',CKEDITOR.document));
-};y(0,0);y(3,0);y(0,3);y(3,3);var A=s.$.insertRow(-1);for(var B=0;B<6;B++)z(A,'#'+x[B]+x[B]+x[B]);for(var C=0;C<12;C++)z(A,'#000000');};var s=new b('table');r();var t=function(x){return x+CKEDITOR.tools.getNextNumber();},u=t('hicolor'),v=t('hicolortext'),w=t('selhicolor');return{title:e.title,minWidth:360,minHeight:220,onLoad:function(){f=this;},contents:[{id:'picker',label:e.title,accessKey:'I',elements:[{type:'hbox',padding:0,widths:['70%','10%','30%'],children:[{type:'html',html:'<table role="listbox" aria-labelledby="color_table_label" onmouseout="CKEDITOR.tools.callFunction( '+l+' );">'+s.getHtml()+'</table>'+'<span id="color_table_label" class="cke_voice_label">'+e.options+'</span>',onLoad:function(){var x=CKEDITOR.document.getById(this.domId);x.on('mouseover',j);},focus:function(){var x=this.getElement().getElementsByTag('a').getItem(0);x.focus();}},g(),{type:'vbox',padding:0,widths:['70%','5%','25%'],children:[{type:'html',html:'<span>'+e.highlight+'</span>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+u+'" style="border: 1px solid; height: 74px; width: 74px;"></div>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+v+'"> </div><span>'+e.selected+'</span>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+w+'" style="border: 1px solid; height: 20px; width: 74px;"></div>'},{type:'text',label:e.selected,labelStyle:'display:none',id:'selectedColor',style:'width: 74px',onChange:function(){try{c.getById(w).setStyle('background-color',this.getValue());}catch(x){h();}}},g(),{type:'button',id:'clear',style:'margin-top: 5px',label:e.clear,onClick:h}]}]}]}]};});
+CKEDITOR.dialog.add('colordialog',function(a){var b=CKEDITOR.dom.element,c=CKEDITOR.document,d=CKEDITOR.tools,e=a.lang.colordialog,f,g={type:'html',html:' '};function h(){c.getById(x).removeStyle('background-color');f.getContentElement('picker','selectedColor').setValue('');};function i(z){if(!(z instanceof CKEDITOR.dom.event))z=new CKEDITOR.dom.event(z);var A=z.getTarget(),B;if(A.getName()=='a'&&(B=A.getChild(0).getHtml()))f.getContentElement('picker','selectedColor').setValue(B);};function j(z){if(!(z instanceof CKEDITOR.dom.event))z=z.data;var A=z.getTarget(),B;if(A.getName()=='a'&&(B=A.getChild(0).getHtml())){c.getById(v).setStyle('background-color',B);c.getById(w).setHtml(B);}};function k(){c.getById(v).removeStyle('background-color');c.getById(w).setHtml(' ');};var l=d.addFunction(k),m=i,n=CKEDITOR.tools.addFunction(m),o=j,p=k,q=CKEDITOR.tools.addFunction(function(z){z=new CKEDITOR.dom.event(z);var A=z.getTarget(),B,C,D=z.getKeystroke(),E=a.lang.dir=='rtl';switch(D){case 38:if(B=A.getParent().getParent().getPrevious()){C=B.getChild([A.getParent().getIndex(),0]);C.focus();p(z,A);o(z,C);}z.preventDefault();break;case 40:if(B=A.getParent().getParent().getNext()){C=B.getChild([A.getParent().getIndex(),0]);if(C&&C.type==1){C.focus();p(z,A);o(z,C);}}z.preventDefault();break;case 32:m(z);z.preventDefault();break;case E?37:39:if(B=A.getParent().getNext()){C=B.getChild(0);if(C.type==1){C.focus();p(z,A);o(z,C);z.preventDefault(true);}else p(null,A);}else if(B=A.getParent().getParent().getNext()){C=B.getChild([0,0]);if(C&&C.type==1){C.focus();p(z,A);o(z,C);z.preventDefault(true);}else p(null,A);}break;case E?39:37:if(B=A.getParent().getPrevious()){C=B.getChild(0);C.focus();p(z,A);o(z,C);z.preventDefault(true);}else if(B=A.getParent().getParent().getPrevious()){C=B.getLast().getChild(0);C.focus();p(z,A);o(z,C);z.preventDefault(true);}else p(null,A);break;default:return;}});function r(){var z=['00','33','66','99','cc','ff'];function A(F,G){for(var H=F;H<F+3;H++){var I=s.$.insertRow(-1);for(var J=G;J<G+3;J++)for(var K=0;K<6;K++)B(I,'#'+z[J]+z[K]+z[H]);}};function B(F,G){var H=new b(F.insertCell(-1));H.setAttribute('class','ColorCell');H.setStyle('background-color',G);H.setStyle('width','15px');H.setStyle('height','15px');var I=H.$.cellIndex+1+18*F.rowIndex;H.append(CKEDITOR.dom.element.createFromHtml('<a href="javascript: void(0);" role="option" aria-posinset="'+I+'"'+' aria-setsize="'+234+'"'+' style="cursor: pointer;display:block;width:100%;height:100% " title="'+CKEDITOR.tools.htmlEncode(G)+'"'+' onkeydown="CKEDITOR.tools.callFunction( '+q+', event, this )"'+' onclick="CKEDITOR.tools.callFunction('+n+', event, this ); return false;"'+' tabindex="-1"><span class="cke_voice_label">'+G+'</span> </a>',CKEDITOR.document));
+};A(0,0);A(3,0);A(0,3);A(3,3);var C=s.$.insertRow(-1);for(var D=0;D<6;D++)B(C,'#'+z[D]+z[D]+z[D]);for(var E=0;E<12;E++)B(C,'#000000');};var s=new b('table');r();var t=s.getHtml(),u=function(z){return CKEDITOR.tools.getNextId()+'_'+z;},v=u('hicolor'),w=u('hicolortext'),x=u('selhicolor'),y=u('color_table_label');return{title:e.title,minWidth:360,minHeight:220,onLoad:function(){f=this;},contents:[{id:'picker',label:e.title,accessKey:'I',elements:[{type:'hbox',padding:0,widths:['70%','10%','30%'],children:[{type:'html',html:'<table role="listbox" aria-labelledby="'+y+'" onmouseout="CKEDITOR.tools.callFunction( '+l+' );">'+(!CKEDITOR.env.webkit?t:'')+'</table><span id="'+y+'" class="cke_voice_label">'+e.options+'</span>',onLoad:function(){var z=CKEDITOR.document.getById(this.domId);z.on('mouseover',j);CKEDITOR.env.webkit&&z.setHtml(t);},focus:function(){var z=this.getElement().getElementsByTag('a').getItem(0);z.focus();}},g,{type:'vbox',padding:0,widths:['70%','5%','25%'],children:[{type:'html',html:'<span>'+e.highlight+'</span>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+v+'" style="border: 1px solid; height: 74px; width: 74px;"></div>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+w+'"> </div><span>'+e.selected+'</span>\t\t\t\t\t\t\t\t\t\t\t\t<div id="'+x+'" style="border: 1px solid; height: 20px; width: 74px;"></div>'},{type:'text',label:e.selected,labelStyle:'display:none',id:'selectedColor',style:'width: 74px',onChange:function(){try{c.getById(x).setStyle('background-color',this.getValue());}catch(z){h();}}},g,{type:'button',id:'clear',style:'margin-top: 5px',label:e.clear,onClick:h}]}]}]}]};});
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/dialog/dialogDefinition.js b/appsrc/ODS-Framework/ckeditor/plugins/dialog/dialogDefinition.js
index b07ba78..24ebf64 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/dialog/dialogDefinition.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/dialog/dialogDefinition.js
@@ -1,4 +1,4 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/find/dialogs/find.js b/appsrc/ODS-Framework/ckeditor/plugins/find/dialogs/find.js
index a0d41bd..08094fe 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/find/dialogs/find.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/find/dialogs/find.js
@@ -1,9 +1,9 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-(function(){function a(h){return h.type==CKEDITOR.NODE_TEXT&&h.getLength()>0;};function b(h){return!(h.type==CKEDITOR.NODE_ELEMENT&&h.isBlockBoundary(CKEDITOR.tools.extend({},CKEDITOR.dtd.$empty,CKEDITOR.dtd.$nonEditable)));};var c=function(){var h=this;return{textNode:h.textNode,offset:h.offset,character:h.textNode?h.textNode.getText().charAt(h.offset):null,hitMatchBoundary:h._.matchBoundary};},d=['find','replace'],e=[['txtFindFind','txtFindReplace'],['txtFindCaseChk','txtReplaceCaseChk'],['txtFindWordChk','txtReplaceWordChk'],['txtFindCyclic','txtReplaceCyclic']];function f(h){var i,j,k,l;i=h==='find'?1:0;j=1-i;var m,n=e.length;for(m=0;m<n;m++){k=this.getContentElement(d[i],e[m][i]);l=this.getContentElement(d[j],e[m][j]);l.setValue(k.getValue());}};var g=function(h,i){var j=new CKEDITOR.style(CKEDITOR.tools.extend({fullMatch:true,childRule:function(){return false;}},h.config.find_highlight)),k=function(w,x){var y=new CKEDITOR.dom.walker(w);y.guard=x?b:null;y.evaluator=a;y.breakOnFalse=true;this._={matchWord:x,walker:y,matchBoundary:false};};k.prototype={next:function(){return this.move();},back:function(){return this.move(true);},move:function(w){var y=this;var x=y.textNode;if(x===null)return c.call(y);y._.matchBoundary=false;if(x&&w&&y.offset>0){y.offset--;return c.call(y);}else if(x&&y.offset<x.getLength()-1){y.offset++;return c.call(y);}else{x=null;while(!x){x=y._.walker[w?'previous':'next'].call(y._.walker);if(y._.matchWord&&!x||y._.walker._.end)break;if(!x&&!b(y._.walker.current))y._.matchBoundary=true;}y.textNode=x;if(x)y.offset=w?x.getLength()-1:0;else y.offset=0;}return c.call(y);}};var l=function(w,x){this._={walker:w,cursors:[],rangeLength:x,highlightRange:null,isMatched:false};};l.prototype={toDomRange:function(){var w=new CKEDITOR.dom.range(h.document),x=this._.cursors;if(x.length<1){var y=this._.walker.textNode;if(y)w.setStartAfter(y);else return null;}else{var z=x[0],A=x[x.length-1];w.setStart(z.textNode,z.offset);w.setEnd(A.textNode,A.offset+1);}return w;},updateFromDomRange:function(w){var z=this;var x,y=new k(w);z._.cursors=[];do{x=y.next();if(x.character)z._.cursors.push(x);}while(x.character)z._.rangeLength=z._.cursors.length;},setMatched:function(){this._.isMatched=true;},clearMatched:function(){this._.isMatched=false;},isMatched:function(){return this._.isMatched;},highlight:function(){var y=this;if(y._.cursors.length<1)return;if(y._.highlightRange)y.removeHighlight();var w=y.toDomRange();j.applyToRange(w);y._.highlightRange=w;var x=w.startContainer;
-if(x.type!=CKEDITOR.NODE_ELEMENT)x=x.getParent();x.scrollIntoView();y.updateFromDomRange(w);},removeHighlight:function(){var w=this;if(!w._.highlightRange)return;j.removeFromRange(w._.highlightRange);w.updateFromDomRange(w._.highlightRange);w._.highlightRange=null;},moveBack:function(){var y=this;var w=y._.walker.back(),x=y._.cursors;if(w.hitMatchBoundary)y._.cursors=x=[];x.unshift(w);if(x.length>y._.rangeLength)x.pop();return w;},moveNext:function(){var y=this;var w=y._.walker.next(),x=y._.cursors;if(w.hitMatchBoundary)y._.cursors=x=[];x.push(w);if(x.length>y._.rangeLength)x.shift();return w;},getEndCharacter:function(){var w=this._.cursors;if(w.length<1)return null;return w[w.length-1].character;},getNextCharacterRange:function(w){var x,y,z=this._.cursors;if((x=z[z.length-1])&&x.textNode)y=new k(m(x));else y=this._.walker;return new l(y,w);},getCursors:function(){return this._.cursors;}};function m(w,x){var y=new CKEDITOR.dom.range();y.setStart(w.textNode,x?w.offset:w.offset+1);y.setEndAt(h.document.getBody(),CKEDITOR.POSITION_BEFORE_END);return y;};function n(w){var x=new CKEDITOR.dom.range();x.setStartAt(h.document.getBody(),CKEDITOR.POSITION_AFTER_START);x.setEnd(w.textNode,w.offset);return x;};var o=0,p=1,q=2,r=function(w,x){var y=[-1];if(x)w=w.toLowerCase();for(var z=0;z<w.length;z++){y.push(y[z]+1);while(y[z+1]>0&&w.charAt(z)!=w.charAt(y[z+1]-1))y[z+1]=y[y[z+1]-1]+1;}this._={overlap:y,state:0,ignoreCase:!!x,pattern:w};};r.prototype={feedCharacter:function(w){var x=this;if(x._.ignoreCase)w=w.toLowerCase();for(;;){if(w==x._.pattern.charAt(x._.state)){x._.state++;if(x._.state==x._.pattern.length){x._.state=0;return q;}return p;}else if(!x._.state)return o;else x._.state=x._.overlap[x._.state];}return null;},reset:function(){this._.state=0;}};var s=/[.,"'?!;: \u0085\u00a0\u1680\u280e\u2028\u2029\u202f\u205f\u3000]/,t=function(w){if(!w)return true;var x=w.charCodeAt(0);return x>=9&&x<=13||x>=8192&&x<=8202||s.test(w);},u={searchRange:null,matchRange:null,find:function(w,x,y,z,A,B){var K=this;if(!K.matchRange)K.matchRange=new l(new k(K.searchRange),w.length);else{K.matchRange.removeHighlight();K.matchRange=K.matchRange.getNextCharacterRange(w.length);}var C=new r(w,!x),D=o,E='%';while(E!==null){K.matchRange.moveNext();while(E=K.matchRange.getEndCharacter()){D=C.feedCharacter(E);if(D==q)break;if(K.matchRange.moveNext().hitMatchBoundary)C.reset();}if(D==q){if(y){var F=K.matchRange.getCursors(),G=F[F.length-1],H=F[0],I=new k(n(H),true),J=new k(m(G),true);if(!(t(I.back().character)&&t(J.next().character)))continue;
-}K.matchRange.setMatched();if(A!==false)K.matchRange.highlight();return true;}}K.matchRange.clearMatched();K.matchRange.removeHighlight();if(z&&!B){K.searchRange=v(true);K.matchRange=null;return arguments.callee.apply(K,Array.prototype.slice.call(arguments).concat([true]));}return false;},replaceCounter:0,replace:function(w,x,y,z,A,B,C){var H=this;var D=false;if(H.matchRange&&H.matchRange.isMatched()&&!H.matchRange._.isReplaced){H.matchRange.removeHighlight();var E=H.matchRange.toDomRange(),F=h.document.createText(y);if(!C){var G=h.getSelection();G.selectRanges([E]);h.fire('saveSnapshot');}E.deleteContents();E.insertNode(F);if(!C){G.selectRanges([E]);h.fire('saveSnapshot');}H.matchRange.updateFromDomRange(E);if(!C)H.matchRange.highlight();H.matchRange._.isReplaced=true;H.replaceCounter++;D=true;}else D=H.find(x,z,A,B,!C);return D;}};function v(w){var x,y=h.getSelection(),z=h.document.getBody();if(y&&!w){x=y.getRanges()[0].clone();x.collapse(true);}else{x=new CKEDITOR.dom.range();x.setStartAt(z,CKEDITOR.POSITION_AFTER_START);}x.setEndAt(z,CKEDITOR.POSITION_BEFORE_END);return x;};return{title:h.lang.findAndReplace.title,resizable:CKEDITOR.DIALOG_RESIZE_NONE,minWidth:350,minHeight:165,buttons:[CKEDITOR.dialog.cancelButton],contents:[{id:'find',label:h.lang.findAndReplace.find,title:h.lang.findAndReplace.find,accessKey:'',elements:[{type:'hbox',widths:['230px','90px'],children:[{type:'text',id:'txtFindFind',label:h.lang.findAndReplace.findWhat,isChanged:false,labelLayout:'horizontal',accessKey:'F'},{type:'button',align:'left',style:'width:100%',label:h.lang.findAndReplace.find,onClick:function(){var w=this.getDialog();if(!u.find(w.getValueOf('find','txtFindFind'),w.getValueOf('find','txtFindCaseChk'),w.getValueOf('find','txtFindWordChk'),w.getValueOf('find','txtFindCyclic')))alert(h.lang.findAndReplace.notFoundMsg);}}]},{type:'vbox',padding:0,children:[{type:'checkbox',id:'txtFindCaseChk',isChanged:false,style:'margin-top:28px',label:h.lang.findAndReplace.matchCase},{type:'checkbox',id:'txtFindWordChk',isChanged:false,label:h.lang.findAndReplace.matchWord},{type:'checkbox',id:'txtFindCyclic',isChanged:false,'default':true,label:h.lang.findAndReplace.matchCyclic}]}]},{id:'replace',label:h.lang.findAndReplace.replace,accessKey:'M',elements:[{type:'hbox',widths:['230px','90px'],children:[{type:'text',id:'txtFindReplace',label:h.lang.findAndReplace.findWhat,isChanged:false,labelLayout:'horizontal',accessKey:'F'},{type:'button',align:'left',style:'width:100%',label:h.lang.findAndReplace.replace,onClick:function(){var w=this.getDialog();
-if(!u.replace(w,w.getValueOf('replace','txtFindReplace'),w.getValueOf('replace','txtReplace'),w.getValueOf('replace','txtReplaceCaseChk'),w.getValueOf('replace','txtReplaceWordChk'),w.getValueOf('replace','txtReplaceCyclic')))alert(h.lang.findAndReplace.notFoundMsg);}}]},{type:'hbox',widths:['230px','90px'],children:[{type:'text',id:'txtReplace',label:h.lang.findAndReplace.replaceWith,isChanged:false,labelLayout:'horizontal',accessKey:'R'},{type:'button',align:'left',style:'width:100%',label:h.lang.findAndReplace.replaceAll,isChanged:false,onClick:function(){var w=this.getDialog(),x;u.replaceCounter=0;u.searchRange=v(true);if(u.matchRange){u.matchRange.removeHighlight();u.matchRange=null;}h.fire('saveSnapshot');while(u.replace(w,w.getValueOf('replace','txtFindReplace'),w.getValueOf('replace','txtReplace'),w.getValueOf('replace','txtReplaceCaseChk'),w.getValueOf('replace','txtReplaceWordChk'),false,true)){}if(u.replaceCounter){alert(h.lang.findAndReplace.replaceSuccessMsg.replace(/%1/,u.replaceCounter));h.fire('saveSnapshot');}else alert(h.lang.findAndReplace.notFoundMsg);}}]},{type:'vbox',padding:0,children:[{type:'checkbox',id:'txtReplaceCaseChk',isChanged:false,label:h.lang.findAndReplace.matchCase},{type:'checkbox',id:'txtReplaceWordChk',isChanged:false,label:h.lang.findAndReplace.matchWord},{type:'checkbox',id:'txtReplaceCyclic',isChanged:false,'default':true,label:h.lang.findAndReplace.matchCyclic}]}]}],onLoad:function(){var w=this,x,y,z=false;this.on('hide',function(){z=false;});this.on('show',function(){z=true;});this.selectPage=CKEDITOR.tools.override(this.selectPage,function(A){return function(B){A.call(w,B);var C=w._.tabs[B],D,E,F;E=B==='find'?'txtFindFind':'txtFindReplace';F=B==='find'?'txtFindWordChk':'txtReplaceWordChk';x=w.getContentElement(B,E);y=w.getContentElement(B,F);if(!C.initialized){D=CKEDITOR.document.getById(x._.inputId);C.initialized=true;}if(z)f.call(this,B);};});},onShow:function(){u.searchRange=v();this.selectPage(i);},onHide:function(){var w;if(u.matchRange&&u.matchRange.isMatched()){u.matchRange.removeHighlight();h.focus();w=u.matchRange.toDomRange();if(w)h.getSelection().selectRanges([w]);}delete u.matchRange;},onFocus:function(){if(i=='replace')return this.getContentElement('replace','txtFindReplace');else return this.getContentElement('find','txtFindFind');}};};CKEDITOR.dialog.add('find',function(h){return g(h,'find');});CKEDITOR.dialog.add('replace',function(h){return g(h,'replace');});})();
+(function(){var a;function b(i){return i.type==CKEDITOR.NODE_TEXT&&i.getLength()>0&&(!a||!i.isReadOnly());};function c(i){return!(i.type==CKEDITOR.NODE_ELEMENT&&i.isBlockBoundary(CKEDITOR.tools.extend({},CKEDITOR.dtd.$empty,CKEDITOR.dtd.$nonEditable)));};var d=function(){var i=this;return{textNode:i.textNode,offset:i.offset,character:i.textNode?i.textNode.getText().charAt(i.offset):null,hitMatchBoundary:i._.matchBoundary};},e=['find','replace'],f=[['txtFindFind','txtFindReplace'],['txtFindCaseChk','txtReplaceCaseChk'],['txtFindWordChk','txtReplaceWordChk'],['txtFindCyclic','txtReplaceCyclic']];function g(i){var j,k,l,m;j=i==='find'?1:0;k=1-j;var n,o=f.length;for(n=0;n<o;n++){l=this.getContentElement(e[j],f[n][j]);m=this.getContentElement(e[k],f[n][k]);m.setValue(l.getValue());}};var h=function(i,j){var k=new CKEDITOR.style(CKEDITOR.tools.extend({fullMatch:true,childRule:function(){return 0;}},i.config.find_highlight)),l=function(y,z){var A=this,B=new CKEDITOR.dom.walker(y);B.guard=z?c:function(C){!c(C)&&(A._.matchBoundary=true);};B.evaluator=b;B.breakOnFalse=1;if(y.startContainer.type==CKEDITOR.NODE_TEXT){this.textNode=y.startContainer;this.offset=y.startOffset-1;}this._={matchWord:z,walker:B,matchBoundary:false};};l.prototype={next:function(){return this.move();},back:function(){return this.move(true);},move:function(y){var A=this;var z=A.textNode;if(z===null)return d.call(A);A._.matchBoundary=false;if(z&&y&&A.offset>0){A.offset--;return d.call(A);}else if(z&&A.offset<z.getLength()-1){A.offset++;return d.call(A);}else{z=null;while(!z){z=A._.walker[y?'previous':'next'].call(A._.walker);if(A._.matchWord&&!z||A._.walker._.end)break;}A.textNode=z;if(z)A.offset=y?z.getLength()-1:0;else A.offset=0;}return d.call(A);}};var m=function(y,z){this._={walker:y,cursors:[],rangeLength:z,highlightRange:null,isMatched:0};};m.prototype={toDomRange:function(){var y=new CKEDITOR.dom.range(i.document),z=this._.cursors;if(z.length<1){var A=this._.walker.textNode;if(A)y.setStartAfter(A);else return null;}else{var B=z[0],C=z[z.length-1];y.setStart(B.textNode,B.offset);y.setEnd(C.textNode,C.offset+1);}return y;},updateFromDomRange:function(y){var B=this;var z,A=new l(y);B._.cursors=[];do{z=A.next();if(z.character)B._.cursors.push(z);}while(z.character);B._.rangeLength=B._.cursors.length;},setMatched:function(){this._.isMatched=true;},clearMatched:function(){this._.isMatched=false;},isMatched:function(){return this._.isMatched;},highlight:function(){var B=this;if(B._.cursors.length<1)return;
+if(B._.highlightRange)B.removeHighlight();var y=B.toDomRange(),z=y.createBookmark();k.applyToRange(y);y.moveToBookmark(z);B._.highlightRange=y;var A=y.startContainer;if(A.type!=CKEDITOR.NODE_ELEMENT)A=A.getParent();A.scrollIntoView();B.updateFromDomRange(y);},removeHighlight:function(){var z=this;if(!z._.highlightRange)return;var y=z._.highlightRange.createBookmark();k.removeFromRange(z._.highlightRange);z._.highlightRange.moveToBookmark(y);z.updateFromDomRange(z._.highlightRange);z._.highlightRange=null;},isReadOnly:function(){if(!this._.highlightRange)return 0;return this._.highlightRange.startContainer.isReadOnly();},moveBack:function(){var A=this;var y=A._.walker.back(),z=A._.cursors;if(y.hitMatchBoundary)A._.cursors=z=[];z.unshift(y);if(z.length>A._.rangeLength)z.pop();return y;},moveNext:function(){var A=this;var y=A._.walker.next(),z=A._.cursors;if(y.hitMatchBoundary)A._.cursors=z=[];z.push(y);if(z.length>A._.rangeLength)z.shift();return y;},getEndCharacter:function(){var y=this._.cursors;if(y.length<1)return null;return y[y.length-1].character;},getNextCharacterRange:function(y){var z,A,B=this._.cursors;if((z=B[B.length-1])&&z.textNode)A=new l(n(z));else A=this._.walker;return new m(A,y);},getCursors:function(){return this._.cursors;}};function n(y,z){var A=new CKEDITOR.dom.range();A.setStart(y.textNode,z?y.offset:y.offset+1);A.setEndAt(i.document.getBody(),CKEDITOR.POSITION_BEFORE_END);return A;};function o(y){var z=new CKEDITOR.dom.range();z.setStartAt(i.document.getBody(),CKEDITOR.POSITION_AFTER_START);z.setEnd(y.textNode,y.offset);return z;};var p=0,q=1,r=2,s=function(y,z){var A=[-1];if(z)y=y.toLowerCase();for(var B=0;B<y.length;B++){A.push(A[B]+1);while(A[B+1]>0&&y.charAt(B)!=y.charAt(A[B+1]-1))A[B+1]=A[A[B+1]-1]+1;}this._={overlap:A,state:0,ignoreCase:!!z,pattern:y};};s.prototype={feedCharacter:function(y){var z=this;if(z._.ignoreCase)y=y.toLowerCase();for(;;){if(y==z._.pattern.charAt(z._.state)){z._.state++;if(z._.state==z._.pattern.length){z._.state=0;return r;}return q;}else if(!z._.state)return p;else z._.state=z._.overlap[z._.state];}return null;},reset:function(){this._.state=0;}};var t=/[.,"'?!;: \u0085\u00a0\u1680\u280e\u2028\u2029\u202f\u205f\u3000]/,u=function(y){if(!y)return true;var z=y.charCodeAt(0);return z>=9&&z<=13||z>=8192&&z<=8202||t.test(y);},v={searchRange:null,matchRange:null,find:function(y,z,A,B,C,D){var M=this;if(!M.matchRange)M.matchRange=new m(new l(M.searchRange),y.length);else{M.matchRange.removeHighlight();M.matchRange=M.matchRange.getNextCharacterRange(y.length);
+}var E=new s(y,!z),F=p,G='%';while(G!==null){M.matchRange.moveNext();while(G=M.matchRange.getEndCharacter()){F=E.feedCharacter(G);if(F==r)break;if(M.matchRange.moveNext().hitMatchBoundary)E.reset();}if(F==r){if(A){var H=M.matchRange.getCursors(),I=H[H.length-1],J=H[0],K=new l(o(J),true),L=new l(n(I),true);if(!(u(K.back().character)&&u(L.next().character)))continue;}M.matchRange.setMatched();if(C!==false)M.matchRange.highlight();return true;}}M.matchRange.clearMatched();M.matchRange.removeHighlight();if(B&&!D){M.searchRange=w(1);M.matchRange=null;return arguments.callee.apply(M,Array.prototype.slice.call(arguments).concat([true]));}return false;},replaceCounter:0,replace:function(y,z,A,B,C,D,E){var J=this;a=1;var F=0;if(J.matchRange&&J.matchRange.isMatched()&&!J.matchRange._.isReplaced&&!J.matchRange.isReadOnly()){J.matchRange.removeHighlight();var G=J.matchRange.toDomRange(),H=i.document.createText(A);if(!E){var I=i.getSelection();I.selectRanges([G]);i.fire('saveSnapshot');}G.deleteContents();G.insertNode(H);if(!E){I.selectRanges([G]);i.fire('saveSnapshot');}J.matchRange.updateFromDomRange(G);if(!E)J.matchRange.highlight();J.matchRange._.isReplaced=true;J.replaceCounter++;F=1;}else F=J.find(z,B,C,D,!E);a=0;return F;}};function w(y){var z,A=i.getSelection(),B=i.document.getBody();if(A&&!y){z=A.getRanges()[0].clone();z.collapse(true);}else{z=new CKEDITOR.dom.range();z.setStartAt(B,CKEDITOR.POSITION_AFTER_START);}z.setEndAt(B,CKEDITOR.POSITION_BEFORE_END);return z;};var x=i.lang.findAndReplace;return{title:x.title,resizable:CKEDITOR.DIALOG_RESIZE_NONE,minWidth:350,minHeight:170,buttons:[CKEDITOR.dialog.cancelButton],contents:[{id:'find',label:x.find,title:x.find,accessKey:'',elements:[{type:'hbox',widths:['230px','90px'],children:[{type:'text',id:'txtFindFind',label:x.findWhat,isChanged:false,labelLayout:'horizontal',accessKey:'F'},{type:'button',align:'left',style:'width:100%',label:x.find,onClick:function(){var y=this.getDialog();if(!v.find(y.getValueOf('find','txtFindFind'),y.getValueOf('find','txtFindCaseChk'),y.getValueOf('find','txtFindWordChk'),y.getValueOf('find','txtFindCyclic')))alert(x.notFoundMsg);}}]},{type:'vbox',padding:0,children:[{type:'checkbox',id:'txtFindCaseChk',isChanged:false,style:'margin-top:28px',label:x.matchCase},{type:'checkbox',id:'txtFindWordChk',isChanged:false,label:x.matchWord},{type:'checkbox',id:'txtFindCyclic',isChanged:false,'default':true,label:x.matchCyclic}]}]},{id:'replace',label:x.replace,accessKey:'M',elements:[{type:'hbox',widths:['230px','90px'],children:[{type:'text',id:'txtFindReplace',label:x.findWhat,isChanged:false,labelLayout:'horizontal',accessKey:'F'},{type:'button',align:'left',style:'width:100%',label:x.replace,onClick:function(){var y=this.getDialog();
+if(!v.replace(y,y.getValueOf('replace','txtFindReplace'),y.getValueOf('replace','txtReplace'),y.getValueOf('replace','txtReplaceCaseChk'),y.getValueOf('replace','txtReplaceWordChk'),y.getValueOf('replace','txtReplaceCyclic')))alert(x.notFoundMsg);}}]},{type:'hbox',widths:['230px','90px'],children:[{type:'text',id:'txtReplace',label:x.replaceWith,isChanged:false,labelLayout:'horizontal',accessKey:'R'},{type:'button',align:'left',style:'width:100%',label:x.replaceAll,isChanged:false,onClick:function(){var y=this.getDialog(),z;v.replaceCounter=0;v.searchRange=w(1);if(v.matchRange){v.matchRange.removeHighlight();v.matchRange=null;}i.fire('saveSnapshot');while(v.replace(y,y.getValueOf('replace','txtFindReplace'),y.getValueOf('replace','txtReplace'),y.getValueOf('replace','txtReplaceCaseChk'),y.getValueOf('replace','txtReplaceWordChk'),false,true)){}if(v.replaceCounter){alert(x.replaceSuccessMsg.replace(/%1/,v.replaceCounter));i.fire('saveSnapshot');}else alert(x.notFoundMsg);}}]},{type:'vbox',padding:0,children:[{type:'checkbox',id:'txtReplaceCaseChk',isChanged:false,label:x.matchCase},{type:'checkbox',id:'txtReplaceWordChk',isChanged:false,label:x.matchWord},{type:'checkbox',id:'txtReplaceCyclic',isChanged:false,'default':true,label:x.matchCyclic}]}]}],onLoad:function(){var y=this,z,A,B=0;this.on('hide',function(){B=0;});this.on('show',function(){B=1;});this.selectPage=CKEDITOR.tools.override(this.selectPage,function(C){return function(D){C.call(y,D);var E=y._.tabs[D],F,G,H;G=D==='find'?'txtFindFind':'txtFindReplace';H=D==='find'?'txtFindWordChk':'txtReplaceWordChk';z=y.getContentElement(D,G);A=y.getContentElement(D,H);if(!E.initialized){F=CKEDITOR.document.getById(z._.inputId);E.initialized=true;}if(B)g.call(this,D);};});},onShow:function(){v.searchRange=w();this.selectPage(j);},onHide:function(){var y;if(v.matchRange&&v.matchRange.isMatched()){v.matchRange.removeHighlight();i.focus();y=v.matchRange.toDomRange();if(y)i.getSelection().selectRanges([y]);}delete v.matchRange;},onFocus:function(){if(j=='replace')return this.getContentElement('replace','txtFindReplace');else return this.getContentElement('find','txtFindFind');}};};CKEDITOR.dialog.add('find',function(i){return h(i,'find');});CKEDITOR.dialog.add('replace',function(i){return h(i,'replace');});})();
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/flash/dialogs/flash.js b/appsrc/ODS-Framework/ckeditor/plugins/flash/dialogs/flash.js
index de1e9b6..63d5da0 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/flash/dialogs/flash.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/flash/dialogs/flash.js
@@ -1,9 +1,9 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-(function(){var a=1,b=2,c=4,d={id:[{type:a,name:'id'}],classid:[{type:a,name:'classid'}],codebase:[{type:a,name:'codebase'}],pluginspage:[{type:c,name:'pluginspage'}],src:[{type:b,name:'movie'},{type:c,name:'src'}],name:[{type:c,name:'name'}],align:[{type:a,name:'align'}],title:[{type:a,name:'title'},{type:c,name:'title'}],'class':[{type:a,name:'class'},{type:c,name:'class'}],width:[{type:a,name:'width'},{type:c,name:'width'}],height:[{type:a,name:'height'},{type:c,name:'height'}],hSpace:[{type:a,name:'hSpace'},{type:c,name:'hSpace'}],vSpace:[{type:a,name:'vSpace'},{type:c,name:'vSpace'}],style:[{type:a,name:'style'},{type:c,name:'style'}],type:[{type:c,name:'type'}]},e=['play','loop','menu','quality','scale','salign','wmode','bgcolor','base','flashvars','allowScriptAccess','allowFullScreen'];for(var f=0;f<e.length;f++)d[e[f]]=[{type:c,name:e[f]},{type:b,name:e[f]}];e=['allowFullScreen','play','loop','menu'];for(f=0;f<e.length;f++)d[e[f]][0]['default']=d[e[f]][1]['default']=true;function g(i,j,k){var q=this;var l=d[q.id];if(!l)return;var m=q instanceof CKEDITOR.ui.dialog.checkbox;for(var n=0;n<l.length;n++){var o=l[n];switch(o.type){case a:if(!i)continue;if(i.getAttribute(o.name)!==null){var p=i.getAttribute(o.name);if(m)q.setValue(p.toLowerCase()=='true');else q.setValue(p);return;}else if(m)q.setValue(!!o['default']);break;case b:if(!i)continue;if(o.name in k){p=k[o.name];if(m)q.setValue(p.toLowerCase()=='true');else q.setValue(p);return;}else if(m)q.setValue(!!o['default']);break;case c:if(!j)continue;if(j.getAttribute(o.name)){p=j.getAttribute(o.name);if(m)q.setValue(p.toLowerCase()=='true');else q.setValue(p);return;}else if(m)q.setValue(!!o['default']);}}};function h(i,j,k){var s=this;var l=d[s.id];if(!l)return;var m=s.getValue()==='',n=s instanceof CKEDITOR.ui.dialog.checkbox;for(var o=0;o<l.length;o++){var p=l[o];switch(p.type){case a:if(!i)continue;var q=s.getValue();if(m||n&&q===p['default'])i.removeAttribute(p.name);else i.setAttribute(p.name,q);break;case b:if(!i)continue;q=s.getValue();if(m||n&&q===p['default']){if(p.name in k)k[p.name].remove();}else if(p.name in k)k[p.name].setAttribute('value',q);else{var r=CKEDITOR.dom.element.createFromHtml('<cke:param></cke:param>',i.getDocument());r.setAttributes({name:p.name,value:q});if(i.getChildCount()<1)r.appendTo(i);else r.insertBefore(i.getFirst());}break;case c:if(!j)continue;q=s.getValue();if(m||n&&q===p['default'])j.removeAttribute(p.name);else j.setAttribute(p.name,q);}}};CKEDITOR.dialog.add('flash',function(i){var j=!i.config.flashEmbedTagOnly,k=i.config.flashAddEmbedTag||i.config.flashEmbedTagOnly,l,m='<div>'+CKEDITOR.tools.htmlEncode(i.lang.common.preview)+'<br>'+'<div id="FlashPreviewLoader'+CKEDITOR.tools.getNextNumber()+'" style="display:none"><div class="loading"> </div></div>'+'<div id="FlashPreviewBox'+CKEDITOR.tools.getNextNumber()+'" class="FlashPreviewBox"></div></div>';
-return{title:i.lang.flash.title,minWidth:420,minHeight:310,onShow:function(){var z=this;z.fakeImage=z.objectNode=z.embedNode=null;l=new CKEDITOR.dom.element('embeded',i.document);var n=z.getSelectedElement();if(n&&n.getAttribute('_cke_real_element_type')&&n.getAttribute('_cke_real_element_type')=='flash'){z.fakeImage=n;var o=i.restoreRealElement(n),p=null,q=null,r={};if(o.getName()=='cke:object'){p=o;var s=p.getElementsByTag('embed','cke');if(s.count()>0)q=s.getItem(0);var t=p.getElementsByTag('param','cke');for(var u=0,v=t.count();u<v;u++){var w=t.getItem(u),x=w.getAttribute('name'),y=w.getAttribute('value');r[x]=y;}}else if(o.getName()=='cke:embed')q=o;z.objectNode=p;z.embedNode=q;z.setupContent(p,q,r,n);}},onOk:function(){var x=this;var n=null,o=null,p=null;if(!x.fakeImage){if(j){n=CKEDITOR.dom.element.createFromHtml('<cke:object></cke:object>',i.document);var q={classid:'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',codebase:'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'};n.setAttributes(q);}if(k){o=CKEDITOR.dom.element.createFromHtml('<cke:embed></cke:embed>',i.document);o.setAttributes({type:'application/x-shockwave-flash',pluginspage:'http://www.macromedia.com/go/getflashplayer'});if(n)o.appendTo(n);}}else{n=x.objectNode;o=x.embedNode;}if(n){p={};var r=n.getElementsByTag('param','cke');for(var s=0,t=r.count();s<t;s++)p[r.getItem(s).getAttribute('name')]=r.getItem(s);}var u={},v={};x.commitContent(n,o,p,u,v);var w=i.createFakeElement(n||o,'cke_flash','flash',true);w.setAttributes(v);w.setStyles(u);if(x.fakeImage){w.replace(x.fakeImage);i.getSelection().selectElement(w);}else i.insertElement(w);},onHide:function(){if(this.preview)this.preview.setHtml('');},contents:[{id:'info',label:i.lang.common.generalTab,accessKey:'I',elements:[{type:'vbox',padding:0,children:[{type:'hbox',widths:['280px','110px'],align:'right',children:[{id:'src',type:'text',label:i.lang.common.url,required:true,validate:CKEDITOR.dialog.validate.notEmpty(i.lang.flash.validateSrc),setup:g,commit:h,onLoad:function(){var n=this.getDialog(),o=function(p){l.setAttribute('src',p);n.preview.setHtml('<embed height="100%" width="100%" src="'+CKEDITOR.tools.htmlEncode(l.getAttribute('src'))+'" type="application/x-shockwave-flash"></embed>');};n.preview=n.getContentElement('info','preview').getElement().getChild(3);this.on('change',function(p){if(p.data&&p.data.value)o(p.data.value);});this.getInputElement().on('change',function(p){o(this.getValue());},this);
-}},{type:'button',id:'browse',filebrowser:'info:src',hidden:true,style:'display:inline-block;margin-top:10px;',label:i.lang.common.browseServer}]}]},{type:'hbox',widths:['25%','25%','25%','25%','25%'],children:[{type:'text',id:'width',style:'width:95px',label:i.lang.flash.width,validate:CKEDITOR.dialog.validate.integer(i.lang.flash.validateWidth),setup:function(n,o,p,q){g.apply(this,arguments);if(q){var r=parseInt(q.$.style.width,10);if(!isNaN(r))this.setValue(r);}},commit:function(n,o,p,q){h.apply(this,arguments);if(this.getValue())q.width=this.getValue()+'px';}},{type:'text',id:'height',style:'width:95px',label:i.lang.flash.height,validate:CKEDITOR.dialog.validate.integer(i.lang.flash.validateHeight),setup:function(n,o,p,q){g.apply(this,arguments);if(q){var r=parseInt(q.$.style.height,10);if(!isNaN(r))this.setValue(r);}},commit:function(n,o,p,q){h.apply(this,arguments);if(this.getValue())q.height=this.getValue()+'px';}},{type:'text',id:'hSpace',style:'width:95px',label:i.lang.flash.hSpace,validate:CKEDITOR.dialog.validate.integer(i.lang.flash.validateHSpace),setup:g,commit:h},{type:'text',id:'vSpace',style:'width:95px',label:i.lang.flash.vSpace,validate:CKEDITOR.dialog.validate.integer(i.lang.flash.validateVSpace),setup:g,commit:h}]},{type:'vbox',children:[{type:'html',id:'preview',style:'width:95%;',html:m}]}]},{id:'Upload',hidden:true,filebrowser:'uploadButton',label:i.lang.common.upload,elements:[{type:'file',id:'upload',label:i.lang.common.upload,size:38},{type:'fileButton',id:'uploadButton',label:i.lang.common.uploadSubmit,filebrowser:'info:src','for':['Upload','upload']}]},{id:'properties',label:i.lang.flash.propertiesTab,elements:[{type:'hbox',widths:['50%','50%'],children:[{id:'scale',type:'select',label:i.lang.flash.scale,'default':'',style:'width : 100%;',items:[[i.lang.common.notSet,''],[i.lang.flash.scaleAll,'showall'],[i.lang.flash.scaleNoBorder,'noborder'],[i.lang.flash.scaleFit,'exactfit']],setup:g,commit:h},{id:'allowScriptAccess',type:'select',label:i.lang.flash.access,'default':'',style:'width : 100%;',items:[[i.lang.common.notSet,''],[i.lang.flash.accessAlways,'always'],[i.lang.flash.accessSameDomain,'samedomain'],[i.lang.flash.accessNever,'never']],setup:g,commit:h}]},{type:'hbox',widths:['50%','50%'],children:[{id:'wmode',type:'select',label:i.lang.flash.windowMode,'default':'',style:'width : 100%;',items:[[i.lang.common.notSet,''],[i.lang.flash.windowModeWindow,'window'],[i.lang.flash.windowModeOpaque,'opaque'],[i.lang.flash.windowModeTransparent,'transparent']],setup:g,commit:h},{id:'quality',type:'select',label:i.lang.flash.quality,'default':'high',style:'width : 100%;',items:[[i.lang.common.notSet,''],[i.lang.flash.qualityBest,'best'],[i.lang.flash.qualityHigh,'high'],[i.lang.flash.qualityAutoHigh,'autohigh'],[i.lang.flash.qualityMedium,'medium'],[i.lang.flash.qualityAutoLow,'autolow'],[i.lang.flash.qualityLow,'low']],setup:g,commit:h}]},{type:'hbox',widths:['50%','50%'],children:[{id:'align',type:'select',label:i.lang.flash.align,'default':'',style:'width : 100%;',items:[[i.lang.common.notSet,''],[i.lang.flash.alignLeft,'left'],[i.lang.flash.alignAbsBottom,'absBottom'],[i.lang.flash.alignAbsMiddle,'absMiddle'],[i.lang.flash.alignBaseline,'baseline'],[i.lang.flash.alignBottom,'bottom'],[i.lang.flash.alignMiddle,'middle'],[i.lang.flash.alignRight,'right'],[i.lang.flash.alignTextTop,'textTop'],[i.lang.flash.alignTop,'top']],setup:g,commit:function(n,o,p,q,r){var s=this.getValue();
+(function(){var a=1,b=2,c=4,d={id:[{type:a,name:'id'}],classid:[{type:a,name:'classid'}],codebase:[{type:a,name:'codebase'}],pluginspage:[{type:c,name:'pluginspage'}],src:[{type:b,name:'movie'},{type:c,name:'src'}],name:[{type:c,name:'name'}],align:[{type:a,name:'align'}],title:[{type:a,name:'title'},{type:c,name:'title'}],'class':[{type:a,name:'class'},{type:c,name:'class'}],width:[{type:a,name:'width'},{type:c,name:'width'}],height:[{type:a,name:'height'},{type:c,name:'height'}],hSpace:[{type:a,name:'hSpace'},{type:c,name:'hSpace'}],vSpace:[{type:a,name:'vSpace'},{type:c,name:'vSpace'}],style:[{type:a,name:'style'},{type:c,name:'style'}],type:[{type:c,name:'type'}]},e=['play','loop','menu','quality','scale','salign','wmode','bgcolor','base','flashvars','allowScriptAccess','allowFullScreen'];for(var f=0;f<e.length;f++)d[e[f]]=[{type:c,name:e[f]},{type:b,name:e[f]}];e=['allowFullScreen','play','loop','menu'];for(f=0;f<e.length;f++)d[e[f]][0]['default']=d[e[f]][1]['default']=true;function g(i,j,k){var q=this;var l=d[q.id];if(!l)return;var m=q instanceof CKEDITOR.ui.dialog.checkbox;for(var n=0;n<l.length;n++){var o=l[n];switch(o.type){case a:if(!i)continue;if(i.getAttribute(o.name)!==null){var p=i.getAttribute(o.name);if(m)q.setValue(p.toLowerCase()=='true');else q.setValue(p);return;}else if(m)q.setValue(!!o['default']);break;case b:if(!i)continue;if(o.name in k){p=k[o.name];if(m)q.setValue(p.toLowerCase()=='true');else q.setValue(p);return;}else if(m)q.setValue(!!o['default']);break;case c:if(!j)continue;if(j.getAttribute(o.name)){p=j.getAttribute(o.name);if(m)q.setValue(p.toLowerCase()=='true');else q.setValue(p);return;}else if(m)q.setValue(!!o['default']);}}};function h(i,j,k){var s=this;var l=d[s.id];if(!l)return;var m=s.getValue()==='',n=s instanceof CKEDITOR.ui.dialog.checkbox;for(var o=0;o<l.length;o++){var p=l[o];switch(p.type){case a:if(!i)continue;var q=s.getValue();if(m||n&&q===p['default'])i.removeAttribute(p.name);else i.setAttribute(p.name,q);break;case b:if(!i)continue;q=s.getValue();if(m||n&&q===p['default']){if(p.name in k)k[p.name].remove();}else if(p.name in k)k[p.name].setAttribute('value',q);else{var r=CKEDITOR.dom.element.createFromHtml('<cke:param></cke:param>',i.getDocument());r.setAttributes({name:p.name,value:q});if(i.getChildCount()<1)r.appendTo(i);else r.insertBefore(i.getFirst());}break;case c:if(!j)continue;q=s.getValue();if(m||n&&q===p['default'])j.removeAttribute(p.name);else j.setAttribute(p.name,q);}}};CKEDITOR.dialog.add('flash',function(i){var j=!i.config.flashEmbedTagOnly,k=i.config.flashAddEmbedTag||i.config.flashEmbedTagOnly,l,m='<div>'+CKEDITOR.tools.htmlEncode(i.lang.common.preview)+'<br>'+'<div id="cke_FlashPreviewLoader'+CKEDITOR.tools.getNextNumber()+'" style="display:none"><div class="loading"> </div></div>'+'<div id="cke_FlashPreviewBox'+CKEDITOR.tools.getNextNumber()+'" class="FlashPreviewBox"></div></div>';
+return{title:i.lang.flash.title,minWidth:420,minHeight:310,onShow:function(){var z=this;z.fakeImage=z.objectNode=z.embedNode=null;l=new CKEDITOR.dom.element('embed',i.document);var n=z.getSelectedElement();if(n&&n.data('cke-real-element-type')&&n.data('cke-real-element-type')=='flash'){z.fakeImage=n;var o=i.restoreRealElement(n),p=null,q=null,r={};if(o.getName()=='cke:object'){p=o;var s=p.getElementsByTag('embed','cke');if(s.count()>0)q=s.getItem(0);var t=p.getElementsByTag('param','cke');for(var u=0,v=t.count();u<v;u++){var w=t.getItem(u),x=w.getAttribute('name'),y=w.getAttribute('value');r[x]=y;}}else if(o.getName()=='cke:embed')q=o;z.objectNode=p;z.embedNode=q;z.setupContent(p,q,r,n);}},onOk:function(){var x=this;var n=null,o=null,p=null;if(!x.fakeImage){if(j){n=CKEDITOR.dom.element.createFromHtml('<cke:object></cke:object>',i.document);var q={classid:'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',codebase:'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'};n.setAttributes(q);}if(k){o=CKEDITOR.dom.element.createFromHtml('<cke:embed></cke:embed>',i.document);o.setAttributes({type:'application/x-shockwave-flash',pluginspage:'http://www.macromedia.com/go/getflashplayer'});if(n)o.appendTo(n);}}else{n=x.objectNode;o=x.embedNode;}if(n){p={};var r=n.getElementsByTag('param','cke');for(var s=0,t=r.count();s<t;s++)p[r.getItem(s).getAttribute('name')]=r.getItem(s);}var u={},v={};x.commitContent(n,o,p,u,v);var w=i.createFakeElement(n||o,'cke_flash','flash',true);w.setAttributes(v);w.setStyles(u);if(x.fakeImage){w.replace(x.fakeImage);i.getSelection().selectElement(w);}else i.insertElement(w);},onHide:function(){if(this.preview)this.preview.setHtml('');},contents:[{id:'info',label:i.lang.common.generalTab,accessKey:'I',elements:[{type:'vbox',padding:0,children:[{type:'hbox',widths:['280px','110px'],align:'right',children:[{id:'src',type:'text',label:i.lang.common.url,required:true,validate:CKEDITOR.dialog.validate.notEmpty(i.lang.flash.validateSrc),setup:g,commit:h,onLoad:function(){var n=this.getDialog(),o=function(p){l.setAttribute('src',p);n.preview.setHtml('<embed height="100%" width="100%" src="'+CKEDITOR.tools.htmlEncode(l.getAttribute('src'))+'" type="application/x-shockwave-flash"></embed>');};n.preview=n.getContentElement('info','preview').getElement().getChild(3);this.on('change',function(p){if(p.data&&p.data.value)o(p.data.value);});this.getInputElement().on('change',function(p){o(this.getValue());},this);}},{type:'button',id:'browse',filebrowser:'info:src',hidden:true,style:'display:inline-block;margin-top:10px;',label:i.lang.common.browseServer}]}]},{type:'hbox',widths:['25%','25%','25%','25%','25%'],children:[{type:'text',id:'width',style:'width:95px',label:i.lang.common.width,validate:CKEDITOR.dialog.validate.integer(i.lang.common.invalidWidth),setup:function(n,o,p,q){g.apply(this,arguments);
+if(q){var r=parseInt(q.$.style.width,10);if(!isNaN(r))this.setValue(r);}},commit:function(n,o,p,q){h.apply(this,arguments);if(this.getValue())q.width=this.getValue()+'px';}},{type:'text',id:'height',style:'width:95px',label:i.lang.common.height,validate:CKEDITOR.dialog.validate.integer(i.lang.common.invalidHeight),setup:function(n,o,p,q){g.apply(this,arguments);if(q){var r=parseInt(q.$.style.height,10);if(!isNaN(r))this.setValue(r);}},commit:function(n,o,p,q){h.apply(this,arguments);if(this.getValue())q.height=this.getValue()+'px';}},{type:'text',id:'hSpace',style:'width:95px',label:i.lang.flash.hSpace,validate:CKEDITOR.dialog.validate.integer(i.lang.flash.validateHSpace),setup:g,commit:h},{type:'text',id:'vSpace',style:'width:95px',label:i.lang.flash.vSpace,validate:CKEDITOR.dialog.validate.integer(i.lang.flash.validateVSpace),setup:g,commit:h}]},{type:'vbox',children:[{type:'html',id:'preview',style:'width:95%;',html:m}]}]},{id:'Upload',hidden:true,filebrowser:'uploadButton',label:i.lang.common.upload,elements:[{type:'file',id:'upload',label:i.lang.common.upload,size:38},{type:'fileButton',id:'uploadButton',label:i.lang.common.uploadSubmit,filebrowser:'info:src','for':['Upload','upload']}]},{id:'properties',label:i.lang.flash.propertiesTab,elements:[{type:'hbox',widths:['50%','50%'],children:[{id:'scale',type:'select',label:i.lang.flash.scale,'default':'',style:'width : 100%;',items:[[i.lang.common.notSet,''],[i.lang.flash.scaleAll,'showall'],[i.lang.flash.scaleNoBorder,'noborder'],[i.lang.flash.scaleFit,'exactfit']],setup:g,commit:h},{id:'allowScriptAccess',type:'select',label:i.lang.flash.access,'default':'',style:'width : 100%;',items:[[i.lang.common.notSet,''],[i.lang.flash.accessAlways,'always'],[i.lang.flash.accessSameDomain,'samedomain'],[i.lang.flash.accessNever,'never']],setup:g,commit:h}]},{type:'hbox',widths:['50%','50%'],children:[{id:'wmode',type:'select',label:i.lang.flash.windowMode,'default':'',style:'width : 100%;',items:[[i.lang.common.notSet,''],[i.lang.flash.windowModeWindow,'window'],[i.lang.flash.windowModeOpaque,'opaque'],[i.lang.flash.windowModeTransparent,'transparent']],setup:g,commit:h},{id:'quality',type:'select',label:i.lang.flash.quality,'default':'high',style:'width : 100%;',items:[[i.lang.common.notSet,''],[i.lang.flash.qualityBest,'best'],[i.lang.flash.qualityHigh,'high'],[i.lang.flash.qualityAutoHigh,'autohigh'],[i.lang.flash.qualityMedium,'medium'],[i.lang.flash.qualityAutoLow,'autolow'],[i.lang.flash.qualityLow,'low']],setup:g,commit:h}]},{type:'hbox',widths:['50%','50%'],children:[{id:'align',type:'select',label:i.lang.common.align,'default':'',style:'width : 100%;',items:[[i.lang.common.notSet,''],[i.lang.common.alignLeft,'left'],[i.lang.flash.alignAbsBottom,'absBottom'],[i.lang.flash.alignAbsMiddle,'absMiddle'],[i.lang.flash.alignBaseline,'baseline'],[i.lang.common.alignBottom,'bottom'],[i.lang.common.alignMiddle,'middle'],[i.lang.common.alignRight,'right'],[i.lang.flash.alignTextTop,'textTop'],[i.lang.common.alignTop,'top']],setup:g,commit:function(n,o,p,q,r){var s=this.getValue();
 h.apply(this,arguments);s&&(r.align=s);}},{type:'html',html:'<div></div>'}]},{type:'fieldset',label:CKEDITOR.tools.htmlEncode(i.lang.flash.flashvars),children:[{type:'vbox',padding:0,children:[{type:'checkbox',id:'menu',label:i.lang.flash.chkMenu,'default':true,setup:g,commit:h},{type:'checkbox',id:'play',label:i.lang.flash.chkPlay,'default':true,setup:g,commit:h},{type:'checkbox',id:'loop',label:i.lang.flash.chkLoop,'default':true,setup:g,commit:h},{type:'checkbox',id:'allowFullScreen',label:i.lang.flash.chkFull,'default':true,setup:g,commit:h}]}]}]},{id:'advanced',label:i.lang.common.advancedTab,elements:[{type:'hbox',widths:['45%','55%'],children:[{type:'text',id:'id',label:i.lang.common.id,setup:g,commit:h},{type:'text',id:'title',label:i.lang.common.advisoryTitle,setup:g,commit:h}]},{type:'hbox',widths:['45%','55%'],children:[{type:'text',id:'bgcolor',label:i.lang.flash.bgcolor,setup:g,commit:h},{type:'text',id:'class',label:i.lang.common.cssClass,setup:g,commit:h}]},{type:'text',id:'style',label:i.lang.common.cssStyle,setup:g,commit:h}]}]};});})();
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/image/dialogs/image.js b/appsrc/ODS-Framework/ckeditor/plugins/image/dialogs/image.js
index cb6e89e..09a9041 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/image/dialogs/image.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/image/dialogs/image.js
@@ -1,13 +1,13 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
 (function(){var a=function(b,c){var d=1,e=2,f=4,g=8,h=/^\s*(\d+)((px)|\%)?\s*$/i,i=/(^\s*(\d+)((px)|\%)?\s*$)|^$/i,j=/^\d+px$/,k=function(){var C=this.getValue(),D=this.getDialog(),E=C.match(h);if(E){if(E[2]=='%')p(D,false);C=E[1];}if(D.lockRatio){var F=D.originalElement;if(F.getCustomData('isReady')=='true')if(this.id=='txtHeight'){if(C&&C!='0')C=Math.round(F.$.width*(C/F.$.height));if(!isNaN(C))D.setValueOf('info','txtWidth',C);}else{if(C&&C!='0')C=Math.round(F.$.height*(C/F.$.width));if(!isNaN(C))D.setValueOf('info','txtHeight',C);}}l(D);},l=function(C){if(!C.originalElement||!C.preview)return 1;C.commitContent(f,C.preview);return 0;};function m(){var C=arguments,D=this.getContentElement('advanced','txtdlgGenStyle');D&&D.commit.apply(D,C);this.foreach(function(E){if(E.commit&&E.id!='txtdlgGenStyle')E.commit.apply(E,C);});};var n;function o(C){if(n)return;n=1;var D=this.getDialog(),E=D.imageElement;if(E){this.commit(d,E);C=[].concat(C);var F=C.length,G;for(var H=0;H<F;H++){G=D.getContentElement.apply(D,C[H].split(':'));G&&G.setup(d,E);}}n=0;};var p=function(C,D){var E=C.originalElement;if(!E)return null;var F=CKEDITOR.document.getById(w);if(E.getCustomData('isReady')=='true'){if(D=='check'){var G=C.getValueOf('info','txtWidth'),H=C.getValueOf('info','txtHeight'),I=E.$.width*1000/E.$.height,J=G*1000/H;C.lockRatio=false;if(!G&&!H)C.lockRatio=true;else if(!isNaN(I)&&!isNaN(J))if(Math.round(I)==Math.round(J))C.lockRatio=true;}else if(D!=undefined)C.lockRatio=D;else C.lockRatio=!C.lockRatio;}else if(D!='check')C.lockRatio=false;if(C.lockRatio)F.removeClass('cke_btn_unlocked');else F.addClass('cke_btn_unlocked');var K=C._.editor.lang.image,L=K[C.lockRatio?'unlockRatio':'lockRatio'];F.setAttribute('title',L);F.getFirst().setText(L);return C.lockRatio;},q=function(C){var D=C.originalElement;if(D.getCustomData('isReady')=='true'){C.setValueOf('info','txtWidth',D.$.width);C.setValueOf('info','txtHeight',D.$.height);}l(C);},r=function(C,D){if(C!=d)return;function E(J,K){var L=J.match(h);if(L){if(L[2]=='%'){L[1]+='%';p(F,false);}return L[1];}return K;};var F=this.getDialog(),G='',H=this.id=='txtWidth'?'width':'height',I=D.getAttribute(H);if(I)G=E(I,G);G=E(D.getStyle(H),G);this.setValue(G);},s,t=function(){var C=this.originalElement;C.setCustomData('isReady','true');C.removeListener('load',t);C.removeListener('error',u);C.removeListener('abort',u);CKEDITOR.document.getById(y).setStyle('display','none');if(!this.dontResetSize)q(this);if(this.firstLoad)CKEDITOR.tools.setTimeout(function(){p(this,'check');
-},0,this);this.firstLoad=false;this.dontResetSize=false;},u=function(){var E=this;var C=E.originalElement;C.removeListener('load',t);C.removeListener('error',u);C.removeListener('abort',u);var D=CKEDITOR.getUrl(b.skinPath+'images/noimage.png');if(E.preview)E.preview.setAttribute('src',D);CKEDITOR.document.getById(y).setStyle('display','none');p(E,false);},v=function(C){return C+CKEDITOR.tools.getNextNumber();},w=v('btnLockSizes'),x=v('btnResetSize'),y=v('ImagePreviewLoader'),z=v('ImagePreviewBox'),A=v('previewLink'),B=v('previewImage');return{title:c=='image'?b.lang.image.title:b.lang.image.titleButton,minWidth:420,minHeight:310,onShow:function(){var I=this;I.imageElement=false;I.linkElement=false;I.imageEditMode=false;I.linkEditMode=false;I.lockRatio=true;I.dontResetSize=false;I.firstLoad=true;I.addLink=false;var C=I.getParentEditor(),D=I.getParentEditor().getSelection(),E=D.getSelectedElement(),F=E&&E.getAscendant('a');CKEDITOR.document.getById(y).setStyle('display','none');s=new CKEDITOR.dom.element('img',C.document);I.preview=CKEDITOR.document.getById(B);I.originalElement=C.document.createElement('img');I.originalElement.setAttribute('alt','');I.originalElement.setCustomData('isReady','false');if(F){I.linkElement=F;I.linkEditMode=true;var G=F.getChildren();if(G.count()==1){var H=G.getItem(0).getName();if(H=='img'||H=='input'){I.imageElement=G.getItem(0);if(I.imageElement.getName()=='img')I.imageEditMode='img';else if(I.imageElement.getName()=='input')I.imageEditMode='input';}}if(c=='image')I.setupContent(e,F);}if(E&&E.getName()=='img'&&!E.getAttribute('_cke_realelement')||E&&E.getName()=='input'&&E.getAttribute('type')=='image'){I.imageEditMode=E.getName();I.imageElement=E;}if(I.imageEditMode){I.cleanImageElement=I.imageElement;I.imageElement=I.cleanImageElement.clone(true,true);I.setupContent(d,I.imageElement);p(I,true);}else I.imageElement=C.document.createElement('img');if(!CKEDITOR.tools.trim(I.getValueOf('info','txtUrl'))){I.preview.removeAttribute('src');I.preview.setStyle('display','none');}},onOk:function(){var D=this;if(D.imageEditMode){var C=D.imageEditMode;if(c=='image'&&C=='input'&&confirm(b.lang.image.button2Img)){C='img';D.imageElement=b.document.createElement('img');D.imageElement.setAttribute('alt','');b.insertElement(D.imageElement);}else if(c!='image'&&C=='img'&&confirm(b.lang.image.img2Button)){C='input';D.imageElement=b.document.createElement('input');D.imageElement.setAttributes({type:'image',alt:''});b.insertElement(D.imageElement);
-}else{D.imageElement=D.cleanImageElement;delete D.cleanImageElement;}}else{if(c=='image')D.imageElement=b.document.createElement('img');else{D.imageElement=b.document.createElement('input');D.imageElement.setAttribute('type','image');}D.imageElement.setAttribute('alt','');}if(!D.linkEditMode)D.linkElement=b.document.createElement('a');D.commitContent(d,D.imageElement);D.commitContent(e,D.linkElement);if(!D.imageElement.getAttribute('style'))D.imageElement.removeAttribute('style');if(!D.imageEditMode){if(D.addLink){if(!D.linkEditMode){b.insertElement(D.linkElement);D.linkElement.append(D.imageElement,false);}else b.insertElement(D.imageElement);}else b.insertElement(D.imageElement);}else if(!D.linkEditMode&&D.addLink){b.insertElement(D.linkElement);D.imageElement.appendTo(D.linkElement);}else if(D.linkEditMode&&!D.addLink){b.getSelection().selectElement(D.linkElement);b.insertElement(D.imageElement);}},onLoad:function(){var D=this;if(c!='image')D.hidePage('Link');var C=D._.element.getDocument();D.addFocusable(C.getById(x),5);D.addFocusable(C.getById(w),5);D.commitContent=m;},onHide:function(){var C=this;if(C.preview)C.commitContent(g,C.preview);if(C.originalElement){C.originalElement.removeListener('load',t);C.originalElement.removeListener('error',u);C.originalElement.removeListener('abort',u);C.originalElement.remove();C.originalElement=false;}delete C.imageElement;},contents:[{id:'info',label:b.lang.image.infoTab,accessKey:'I',elements:[{type:'vbox',padding:0,children:[{type:'hbox',widths:['280px','110px'],align:'right',children:[{id:'txtUrl',type:'text',label:b.lang.common.url,required:true,onChange:function(){var C=this.getDialog(),D=this.getValue();if(D.length>0){C=this.getDialog();var E=C.originalElement;C.preview.removeStyle('display');E.setCustomData('isReady','false');var F=CKEDITOR.document.getById(y);if(F)F.setStyle('display','');E.on('load',t,C);E.on('error',u,C);E.on('abort',u,C);E.setAttribute('src',D);s.setAttribute('src',D);C.preview.setAttribute('src',s.$.src);l(C);}else if(C.preview){C.preview.removeAttribute('src');C.preview.setStyle('display','none');}},setup:function(C,D){if(C==d){var E=D.getAttribute('_cke_saved_src')||D.getAttribute('src'),F=this;this.getDialog().dontResetSize=true;F.setValue(E);F.setInitValue();F.focus();}},commit:function(C,D){var E=this;if(C==d&&(E.getValue()||E.isChanged())){D.setAttribute('_cke_saved_src',decodeURI(E.getValue()));D.setAttribute('src',decodeURI(E.getValue()));}else if(C==g){D.setAttribute('src','');
-D.removeAttribute('src');}},validate:CKEDITOR.dialog.validate.notEmpty(b.lang.image.urlMissing)},{type:'button',id:'browse',style:'display:inline-block;margin-top:10px;',align:'center',label:b.lang.common.browseServer,hidden:true,filebrowser:'info:txtUrl'}]}]},{id:'txtAlt',type:'text',label:b.lang.image.alt,accessKey:'A','default':'',onChange:function(){l(this.getDialog());},setup:function(C,D){if(C==d)this.setValue(D.getAttribute('alt'));},commit:function(C,D){var E=this;if(C==d){if(E.getValue()||E.isChanged())D.setAttribute('alt',E.getValue());}else if(C==f)D.setAttribute('alt',E.getValue());else if(C==g)D.removeAttribute('alt');}},{type:'hbox',widths:['140px','240px'],children:[{type:'vbox',padding:10,children:[{type:'hbox',widths:['70%','30%'],children:[{type:'vbox',padding:1,children:[{type:'text',width:'40px',id:'txtWidth',labelLayout:'horizontal',label:b.lang.image.width,onKeyUp:k,onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:function(){var C=this.getValue().match(i);if(!C)alert(b.lang.image.validateWidth);return!!C;},setup:r,commit:function(C,D,E){var F=this.getValue();if(C==d){if(F)D.setStyle('width',CKEDITOR.tools.cssLength(F));else if(!F&&this.isChanged())D.removeStyle('width');!E&&D.removeAttribute('width');}else if(C==f){var G=F.match(h);if(!G){var H=this.getDialog().originalElement;if(H.getCustomData('isReady')=='true')D.setStyle('width',H.$.width+'px');}else D.setStyle('width',F+'px');}else if(C==g){D.removeAttribute('width');D.removeStyle('width');}}},{type:'text',id:'txtHeight',width:'40px',labelLayout:'horizontal',label:b.lang.image.height,onKeyUp:k,onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:function(){var C=this.getValue().match(i);if(!C)alert(b.lang.image.validateHeight);return!!C;},setup:r,commit:function(C,D,E){var F=this.getValue();if(C==d){if(F)D.setStyle('height',CKEDITOR.tools.cssLength(F));else if(!F&&this.isChanged())D.removeStyle('height');if(!E&&C==d)D.removeAttribute('height');}else if(C==f){var G=F.match(h);if(!G){var H=this.getDialog().originalElement;if(H.getCustomData('isReady')=='true')D.setStyle('height',H.$.height+'px');}else D.setStyle('height',F+'px');}else if(C==g){D.removeAttribute('height');D.removeStyle('height');}}}]},{type:'html',style:'margin-top:10px;width:40px;height:40px;',onLoad:function(){var C=CKEDITOR.document.getById(x),D=CKEDITOR.document.getById(w);if(C){C.on('click',function(E){q(this);E.data.preventDefault();},this.getDialog());C.on('mouseover',function(){this.addClass('cke_btn_over');
-},C);C.on('mouseout',function(){this.removeClass('cke_btn_over');},C);}if(D){D.on('click',function(E){var J=this;var F=p(J),G=J.originalElement,H=J.getValueOf('info','txtWidth');if(G.getCustomData('isReady')=='true'&&H){var I=G.$.height/G.$.width*H;if(!isNaN(I)){J.setValueOf('info','txtHeight',Math.round(I));l(J);}}E.data.preventDefault();},this.getDialog());D.on('mouseover',function(){this.addClass('cke_btn_over');},D);D.on('mouseout',function(){this.removeClass('cke_btn_over');},D);}},html:'<div><a href="javascript:void(0)" tabindex="-1" title="'+b.lang.image.unlockRatio+'" class="cke_btn_locked" id="'+w+'" role="button"><span class="cke_label">'+b.lang.image.unlockRatio+'</span></a>'+'<a href="javascript:void(0)" tabindex="-1" title="'+b.lang.image.resetSize+'" class="cke_btn_reset" id="'+x+'" role="button"><span class="cke_label">'+b.lang.image.resetSize+'</span></a>'+'</div>'}]},{type:'vbox',padding:1,children:[{type:'text',id:'txtBorder',width:'60px',labelLayout:'horizontal',label:b.lang.image.border,'default':'',onKeyUp:function(){l(this.getDialog());},onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:CKEDITOR.dialog.validate.integer(b.lang.image.validateBorder),setup:function(C,D){if(C==d){var E,F=D.getStyle('border-width');F=F&&F.match(/^(\d+px)(?: \1 \1 \1)?$/);E=F&&parseInt(F[1],10);isNaN(parseInt(E,10))&&(E=D.getAttribute('border'));this.setValue(E);}},commit:function(C,D,E){var F=parseInt(this.getValue(),10);if(C==d||C==f){if(!isNaN(F)){D.setStyle('border-width',CKEDITOR.tools.cssLength(F));D.setStyle('border-style','solid');}else if(!F&&this.isChanged()){D.removeStyle('border-width');D.removeStyle('border-style');D.removeStyle('border-color');}if(!E&&C==d)D.removeAttribute('border');}else if(C==g){D.removeAttribute('border');D.removeStyle('border-width');D.removeStyle('border-style');D.removeStyle('border-color');}}},{type:'text',id:'txtHSpace',width:'60px',labelLayout:'horizontal',label:b.lang.image.hSpace,'default':'',onKeyUp:function(){l(this.getDialog());},onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:CKEDITOR.dialog.validate.integer(b.lang.image.validateHSpace),setup:function(C,D){if(C==d){var E,F,G,H=D.getStyle('margin-left'),I=D.getStyle('margin-right');H=H&&H.match(j);I=I&&I.match(j);F=parseInt(H,10);G=parseInt(I,10);E=F==G&&F;isNaN(parseInt(E,10))&&(E=D.getAttribute('hspace'));this.setValue(E);}},commit:function(C,D,E){var F=parseInt(this.getValue(),10);if(C==d||C==f){if(!isNaN(F)){D.setStyle('margin-left',CKEDITOR.tools.cssLength(F));
-D.setStyle('margin-right',CKEDITOR.tools.cssLength(F));}else if(!F&&this.isChanged()){D.removeStyle('margin-left');D.removeStyle('margin-right');}if(!E&&C==d)D.removeAttribute('hspace');}else if(C==g){D.removeAttribute('hspace');D.removeStyle('margin-left');D.removeStyle('margin-right');}}},{type:'text',id:'txtVSpace',width:'60px',labelLayout:'horizontal',label:b.lang.image.vSpace,'default':'',onKeyUp:function(){l(this.getDialog());},onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:CKEDITOR.dialog.validate.integer(b.lang.image.validateVSpace),setup:function(C,D){if(C==d){var E,F,G,H=D.getStyle('margin-top'),I=D.getStyle('margin-bottom');H=H&&H.match(j);I=I&&I.match(j);F=parseInt(H,10);G=parseInt(I,10);E=F==G&&F;isNaN(parseInt(E,10))&&(E=D.getAttribute('vspace'));this.setValue(E);}},commit:function(C,D,E){var F=parseInt(this.getValue(),10);if(C==d||C==f){if(!isNaN(F)){D.setStyle('margin-top',CKEDITOR.tools.cssLength(F));D.setStyle('margin-bottom',CKEDITOR.tools.cssLength(F));}else if(!F&&this.isChanged()){D.removeStyle('margin-top');D.removeStyle('margin-bottom');}if(!E&&C==d)D.removeAttribute('vspace');}else if(C==g){D.removeAttribute('vspace');D.removeStyle('margin-top');D.removeStyle('margin-bottom');}}},{id:'cmbAlign',type:'select',labelLayout:'horizontal',widths:['35%','65%'],style:'width:90px',label:b.lang.image.align,'default':'',items:[[b.lang.common.notSet,''],[b.lang.image.alignLeft,'left'],[b.lang.image.alignRight,'right']],onChange:function(){l(this.getDialog());o.call(this,'advanced:txtdlgGenStyle');},setup:function(C,D){if(C==d){var E=D.getStyle('float');switch(E){case 'inherit':case 'none':E='';}!E&&(E=(D.getAttribute('align')||'').toLowerCase());this.setValue(E);}},commit:function(C,D,E){var F=this.getValue();if(C==d||C==f){if(F)D.setStyle('float',F);else D.removeStyle('float');if(!E&&C==d){F=(D.getAttribute('align')||'').toLowerCase();switch(F){case 'left':case 'right':D.removeAttribute('align');}}}else if(C==g)D.removeStyle('float');}}]}]},{type:'vbox',height:'250px',children:[{type:'html',style:'width:95%;',html:'<div>'+CKEDITOR.tools.htmlEncode(b.lang.common.preview)+'<br>'+'<div id="'+y+'" class="ImagePreviewLoader" style="display:none"><div class="loading"> </div></div>'+'<div id="'+z+'" class="ImagePreviewBox"><table><tr><td>'+'<a href="javascript:void(0)" target="_blank" onclick="return false;" id="'+A+'">'+'<img id="'+B+'" alt="" /></a>'+(b.config.image_previewText||'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.')+'</td></tr></table></div></div>'}]}]}]},{id:'Link',label:b.lang.link.title,padding:0,elements:[{id:'txtUrl',type:'text',label:b.lang.common.url,style:'width: 100%','default':'',setup:function(C,D){if(C==e){var E=D.getAttribute('_cke_saved_href');
-if(!E)E=D.getAttribute('href');this.setValue(E);}},commit:function(C,D){var E=this;if(C==e)if(E.getValue()||E.isChanged()){D.setAttribute('_cke_saved_href',decodeURI(E.getValue()));D.setAttribute('href','javascript:void(0)/*'+CKEDITOR.tools.getNextNumber()+'*/');if(E.getValue()||!b.config.image_removeLinkByEmptyURL)E.getDialog().addLink=true;}}},{type:'button',id:'browse',filebrowser:{action:'Browse',target:'Link:txtUrl',url:b.config.filebrowserImageBrowseLinkUrl||b.config.filebrowserBrowseUrl},style:'float:right',hidden:true,label:b.lang.common.browseServer},{id:'cmbTarget',type:'select',label:b.lang.common.target,'default':'',items:[[b.lang.common.notSet,''],[b.lang.common.targetNew,'_blank'],[b.lang.common.targetTop,'_top'],[b.lang.common.targetSelf,'_self'],[b.lang.common.targetParent,'_parent']],setup:function(C,D){if(C==e)this.setValue(D.getAttribute('target'));},commit:function(C,D){if(C==e)if(this.getValue()||this.isChanged())D.setAttribute('target',this.getValue());}}]},{id:'Upload',hidden:true,filebrowser:'uploadButton',label:b.lang.image.upload,elements:[{type:'file',id:'upload',label:b.lang.image.btnUpload,style:'height:40px',size:38},{type:'fileButton',id:'uploadButton',filebrowser:'info:txtUrl',label:b.lang.image.btnUpload,'for':['Upload','upload']}]},{id:'advanced',label:b.lang.common.advancedTab,elements:[{type:'hbox',widths:['50%','25%','25%'],children:[{type:'text',id:'linkId',label:b.lang.common.id,setup:function(C,D){if(C==d)this.setValue(D.getAttribute('id'));},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('id',this.getValue());}},{id:'cmbLangDir',type:'select',style:'width : 100px;',label:b.lang.common.langDir,'default':'',items:[[b.lang.common.notSet,''],[b.lang.common.langDirLtr,'ltr'],[b.lang.common.langDirRtl,'rtl']],setup:function(C,D){if(C==d)this.setValue(D.getAttribute('dir'));},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('dir',this.getValue());}},{type:'text',id:'txtLangCode',label:b.lang.common.langCode,'default':'',setup:function(C,D){if(C==d)this.setValue(D.getAttribute('lang'));},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('lang',this.getValue());}}]},{type:'text',id:'txtGenLongDescr',label:b.lang.common.longDescr,setup:function(C,D){if(C==d)this.setValue(D.getAttribute('longDesc'));},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('longDesc',this.getValue());}},{type:'hbox',widths:['50%','50%'],children:[{type:'text',id:'txtGenClass',label:b.lang.common.cssClass,'default':'',setup:function(C,D){if(C==d)this.setValue(D.getAttribute('class'));
+},0,this);this.firstLoad=false;this.dontResetSize=false;},u=function(){var E=this;var C=E.originalElement;C.removeListener('load',t);C.removeListener('error',u);C.removeListener('abort',u);var D=CKEDITOR.getUrl(b.skinPath+'images/noimage.png');if(E.preview)E.preview.setAttribute('src',D);CKEDITOR.document.getById(y).setStyle('display','none');p(E,false);},v=function(C){return CKEDITOR.tools.getNextId()+'_'+C;},w=v('btnLockSizes'),x=v('btnResetSize'),y=v('ImagePreviewLoader'),z=v('ImagePreviewBox'),A=v('previewLink'),B=v('previewImage');return{title:b.lang.image[c=='image'?'title':'titleButton'],minWidth:420,minHeight:360,onShow:function(){var I=this;I.imageElement=false;I.linkElement=false;I.imageEditMode=false;I.linkEditMode=false;I.lockRatio=true;I.dontResetSize=false;I.firstLoad=true;I.addLink=false;var C=I.getParentEditor(),D=I.getParentEditor().getSelection(),E=D.getSelectedElement(),F=E&&E.getAscendant('a');CKEDITOR.document.getById(y).setStyle('display','none');s=new CKEDITOR.dom.element('img',C.document);I.preview=CKEDITOR.document.getById(B);I.originalElement=C.document.createElement('img');I.originalElement.setAttribute('alt','');I.originalElement.setCustomData('isReady','false');if(F){I.linkElement=F;I.linkEditMode=true;var G=F.getChildren();if(G.count()==1){var H=G.getItem(0).getName();if(H=='img'||H=='input'){I.imageElement=G.getItem(0);if(I.imageElement.getName()=='img')I.imageEditMode='img';else if(I.imageElement.getName()=='input')I.imageEditMode='input';}}if(c=='image')I.setupContent(e,F);}if(E&&E.getName()=='img'&&!E.data('cke-realelement')||E&&E.getName()=='input'&&E.getAttribute('type')=='image'){I.imageEditMode=E.getName();I.imageElement=E;}if(I.imageEditMode){I.cleanImageElement=I.imageElement;I.imageElement=I.cleanImageElement.clone(true,true);I.setupContent(d,I.imageElement);p(I,true);}else I.imageElement=C.document.createElement('img');if(!CKEDITOR.tools.trim(I.getValueOf('info','txtUrl'))){I.preview.removeAttribute('src');I.preview.setStyle('display','none');}},onOk:function(){var D=this;if(D.imageEditMode){var C=D.imageEditMode;if(c=='image'&&C=='input'&&confirm(b.lang.image.button2Img)){C='img';D.imageElement=b.document.createElement('img');D.imageElement.setAttribute('alt','');b.insertElement(D.imageElement);}else if(c!='image'&&C=='img'&&confirm(b.lang.image.img2Button)){C='input';D.imageElement=b.document.createElement('input');D.imageElement.setAttributes({type:'image',alt:''});b.insertElement(D.imageElement);}else{D.imageElement=D.cleanImageElement;
+delete D.cleanImageElement;}}else{if(c=='image')D.imageElement=b.document.createElement('img');else{D.imageElement=b.document.createElement('input');D.imageElement.setAttribute('type','image');}D.imageElement.setAttribute('alt','');}if(!D.linkEditMode)D.linkElement=b.document.createElement('a');D.commitContent(d,D.imageElement);D.commitContent(e,D.linkElement);if(!D.imageElement.getAttribute('style'))D.imageElement.removeAttribute('style');if(!D.imageEditMode){if(D.addLink){if(!D.linkEditMode){b.insertElement(D.linkElement);D.linkElement.append(D.imageElement,false);}else b.insertElement(D.imageElement);}else b.insertElement(D.imageElement);}else if(!D.linkEditMode&&D.addLink){b.insertElement(D.linkElement);D.imageElement.appendTo(D.linkElement);}else if(D.linkEditMode&&!D.addLink){b.getSelection().selectElement(D.linkElement);b.insertElement(D.imageElement);}},onLoad:function(){var D=this;if(c!='image')D.hidePage('Link');var C=D._.element.getDocument();D.addFocusable(C.getById(x),5);D.addFocusable(C.getById(w),5);D.commitContent=m;},onHide:function(){var C=this;if(C.preview)C.commitContent(g,C.preview);if(C.originalElement){C.originalElement.removeListener('load',t);C.originalElement.removeListener('error',u);C.originalElement.removeListener('abort',u);C.originalElement.remove();C.originalElement=false;}delete C.imageElement;},contents:[{id:'info',label:b.lang.image.infoTab,accessKey:'I',elements:[{type:'vbox',padding:0,children:[{type:'hbox',widths:['280px','110px'],align:'right',children:[{id:'txtUrl',type:'text',label:b.lang.common.url,required:true,onChange:function(){var C=this.getDialog(),D=this.getValue();if(D.length>0){C=this.getDialog();var E=C.originalElement;C.preview.removeStyle('display');E.setCustomData('isReady','false');var F=CKEDITOR.document.getById(y);if(F)F.setStyle('display','');E.on('load',t,C);E.on('error',u,C);E.on('abort',u,C);E.setAttribute('src',D);s.setAttribute('src',D);C.preview.setAttribute('src',s.$.src);l(C);}else if(C.preview){C.preview.removeAttribute('src');C.preview.setStyle('display','none');}},setup:function(C,D){if(C==d){var E=D.data('cke-saved-src')||D.getAttribute('src'),F=this;this.getDialog().dontResetSize=true;F.setValue(E);F.setInitValue();}},commit:function(C,D){var E=this;if(C==d&&(E.getValue()||E.isChanged())){D.data('cke-saved-src',E.getValue());D.setAttribute('src',E.getValue());}else if(C==g){D.setAttribute('src','');D.removeAttribute('src');}},validate:CKEDITOR.dialog.validate.notEmpty(b.lang.image.urlMissing)},{type:'button',id:'browse',style:'display:inline-block;margin-top:10px;',align:'center',label:b.lang.common.browseServer,hidden:true,filebrowser:'info:txtUrl'}]}]},{id:'txtAlt',type:'text',label:b.lang.image.alt,accessKey:'T','default':'',onChange:function(){l(this.getDialog());
+},setup:function(C,D){if(C==d)this.setValue(D.getAttribute('alt'));},commit:function(C,D){var E=this;if(C==d){if(E.getValue()||E.isChanged())D.setAttribute('alt',E.getValue());}else if(C==f)D.setAttribute('alt',E.getValue());else if(C==g)D.removeAttribute('alt');}},{type:'hbox',children:[{type:'vbox',children:[{type:'hbox',widths:['50%','50%'],children:[{type:'vbox',padding:1,children:[{type:'text',width:'40px',id:'txtWidth',label:b.lang.common.width,onKeyUp:k,onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:function(){var C=this.getValue().match(i);if(!C)alert(b.lang.common.invalidWidth);return!!C;},setup:r,commit:function(C,D,E){var F=this.getValue();if(C==d){if(F)D.setStyle('width',CKEDITOR.tools.cssLength(F));else if(!F&&this.isChanged())D.removeStyle('width');!E&&D.removeAttribute('width');}else if(C==f){var G=F.match(h);if(!G){var H=this.getDialog().originalElement;if(H.getCustomData('isReady')=='true')D.setStyle('width',H.$.width+'px');}else D.setStyle('width',CKEDITOR.tools.cssLength(F));}else if(C==g){D.removeAttribute('width');D.removeStyle('width');}}},{type:'text',id:'txtHeight',width:'40px',label:b.lang.common.height,onKeyUp:k,onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:function(){var C=this.getValue().match(i);if(!C)alert(b.lang.common.invalidHeight);return!!C;},setup:r,commit:function(C,D,E){var F=this.getValue();if(C==d){if(F)D.setStyle('height',CKEDITOR.tools.cssLength(F));else if(!F&&this.isChanged())D.removeStyle('height');if(!E&&C==d)D.removeAttribute('height');}else if(C==f){var G=F.match(h);if(!G){var H=this.getDialog().originalElement;if(H.getCustomData('isReady')=='true')D.setStyle('height',H.$.height+'px');}else D.setStyle('height',CKEDITOR.tools.cssLength(F));}else if(C==g){D.removeAttribute('height');D.removeStyle('height');}}}]},{type:'html',style:'margin-top:30px;width:40px;height:40px;',onLoad:function(){var C=CKEDITOR.document.getById(x),D=CKEDITOR.document.getById(w);if(C){C.on('click',function(E){q(this);E.data.preventDefault();},this.getDialog());C.on('mouseover',function(){this.addClass('cke_btn_over');},C);C.on('mouseout',function(){this.removeClass('cke_btn_over');},C);}if(D){D.on('click',function(E){var J=this;var F=p(J),G=J.originalElement,H=J.getValueOf('info','txtWidth');if(G.getCustomData('isReady')=='true'&&H){var I=G.$.height/G.$.width*H;if(!isNaN(I)){J.setValueOf('info','txtHeight',Math.round(I));l(J);}}E.data.preventDefault();},this.getDialog());D.on('mouseover',function(){this.addClass('cke_btn_over');
+},D);D.on('mouseout',function(){this.removeClass('cke_btn_over');},D);}},html:'<div><a href="javascript:void(0)" tabindex="-1" title="'+b.lang.image.unlockRatio+'" class="cke_btn_locked" id="'+w+'" role="button"><span class="cke_label">'+b.lang.image.unlockRatio+'</span></a>'+'<a href="javascript:void(0)" tabindex="-1" title="'+b.lang.image.resetSize+'" class="cke_btn_reset" id="'+x+'" role="button"><span class="cke_label">'+b.lang.image.resetSize+'</span></a>'+'</div>'}]},{type:'vbox',padding:1,children:[{type:'text',id:'txtBorder',width:'60px',label:b.lang.image.border,'default':'',onKeyUp:function(){l(this.getDialog());},onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:CKEDITOR.dialog.validate.integer(b.lang.image.validateBorder),setup:function(C,D){if(C==d){var E,F=D.getStyle('border-width');F=F&&F.match(/^(\d+px)(?: \1 \1 \1)?$/);E=F&&parseInt(F[1],10);isNaN(parseInt(E,10))&&(E=D.getAttribute('border'));this.setValue(E);}},commit:function(C,D,E){var F=parseInt(this.getValue(),10);if(C==d||C==f){if(!isNaN(F)){D.setStyle('border-width',CKEDITOR.tools.cssLength(F));D.setStyle('border-style','solid');}else if(!F&&this.isChanged()){D.removeStyle('border-width');D.removeStyle('border-style');D.removeStyle('border-color');}if(!E&&C==d)D.removeAttribute('border');}else if(C==g){D.removeAttribute('border');D.removeStyle('border-width');D.removeStyle('border-style');D.removeStyle('border-color');}}},{type:'text',id:'txtHSpace',width:'60px',label:b.lang.image.hSpace,'default':'',onKeyUp:function(){l(this.getDialog());},onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:CKEDITOR.dialog.validate.integer(b.lang.image.validateHSpace),setup:function(C,D){if(C==d){var E,F,G,H=D.getStyle('margin-left'),I=D.getStyle('margin-right');H=H&&H.match(j);I=I&&I.match(j);F=parseInt(H,10);G=parseInt(I,10);E=F==G&&F;isNaN(parseInt(E,10))&&(E=D.getAttribute('hspace'));this.setValue(E);}},commit:function(C,D,E){var F=parseInt(this.getValue(),10);if(C==d||C==f){if(!isNaN(F)){D.setStyle('margin-left',CKEDITOR.tools.cssLength(F));D.setStyle('margin-right',CKEDITOR.tools.cssLength(F));}else if(!F&&this.isChanged()){D.removeStyle('margin-left');D.removeStyle('margin-right');}if(!E&&C==d)D.removeAttribute('hspace');}else if(C==g){D.removeAttribute('hspace');D.removeStyle('margin-left');D.removeStyle('margin-right');}}},{type:'text',id:'txtVSpace',width:'60px',label:b.lang.image.vSpace,'default':'',onKeyUp:function(){l(this.getDialog());},onChange:function(){o.call(this,'advanced:txtdlgGenStyle');
+},validate:CKEDITOR.dialog.validate.integer(b.lang.image.validateVSpace),setup:function(C,D){if(C==d){var E,F,G,H=D.getStyle('margin-top'),I=D.getStyle('margin-bottom');H=H&&H.match(j);I=I&&I.match(j);F=parseInt(H,10);G=parseInt(I,10);E=F==G&&F;isNaN(parseInt(E,10))&&(E=D.getAttribute('vspace'));this.setValue(E);}},commit:function(C,D,E){var F=parseInt(this.getValue(),10);if(C==d||C==f){if(!isNaN(F)){D.setStyle('margin-top',CKEDITOR.tools.cssLength(F));D.setStyle('margin-bottom',CKEDITOR.tools.cssLength(F));}else if(!F&&this.isChanged()){D.removeStyle('margin-top');D.removeStyle('margin-bottom');}if(!E&&C==d)D.removeAttribute('vspace');}else if(C==g){D.removeAttribute('vspace');D.removeStyle('margin-top');D.removeStyle('margin-bottom');}}},{id:'cmbAlign',type:'select',widths:['35%','65%'],style:'width:90px',label:b.lang.common.align,'default':'',items:[[b.lang.common.notSet,''],[b.lang.common.alignLeft,'left'],[b.lang.common.alignRight,'right']],onChange:function(){l(this.getDialog());o.call(this,'advanced:txtdlgGenStyle');},setup:function(C,D){if(C==d){var E=D.getStyle('float');switch(E){case 'inherit':case 'none':E='';}!E&&(E=(D.getAttribute('align')||'').toLowerCase());this.setValue(E);}},commit:function(C,D,E){var F=this.getValue();if(C==d||C==f){if(F)D.setStyle('float',F);else D.removeStyle('float');if(!E&&C==d){F=(D.getAttribute('align')||'').toLowerCase();switch(F){case 'left':case 'right':D.removeAttribute('align');}}}else if(C==g)D.removeStyle('float');}}]}]},{type:'vbox',height:'250px',children:[{type:'html',style:'width:95%;',html:'<div>'+CKEDITOR.tools.htmlEncode(b.lang.common.preview)+'<br>'+'<div id="'+y+'" class="ImagePreviewLoader" style="display:none"><div class="loading"> </div></div>'+'<div id="'+z+'" class="ImagePreviewBox"><table><tr><td>'+'<a href="javascript:void(0)" target="_blank" onclick="return false;" id="'+A+'">'+'<img id="'+B+'" alt="" /></a>'+(b.config.image_previewText||'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.')+'</td></tr></table></div></div>'}]}]}]},{id:'Link',label:b.lang.link.title,padding:0,elements:[{id:'txtUrl',type:'text',label:b.lang.common.url,style:'width: 100%','default':'',setup:function(C,D){if(C==e){var E=D.data('cke-saved-href');
+if(!E)E=D.getAttribute('href');this.setValue(E);}},commit:function(C,D){var F=this;if(C==e)if(F.getValue()||F.isChanged()){var E=decodeURI(F.getValue());D.data('cke-saved-href',E);D.setAttribute('href',E);if(F.getValue()||!b.config.image_removeLinkByEmptyURL)F.getDialog().addLink=true;}}},{type:'button',id:'browse',filebrowser:{action:'Browse',target:'Link:txtUrl',url:b.config.filebrowserImageBrowseLinkUrl},style:'float:right',hidden:true,label:b.lang.common.browseServer},{id:'cmbTarget',type:'select',label:b.lang.common.target,'default':'',items:[[b.lang.common.notSet,''],[b.lang.common.targetNew,'_blank'],[b.lang.common.targetTop,'_top'],[b.lang.common.targetSelf,'_self'],[b.lang.common.targetParent,'_parent']],setup:function(C,D){if(C==e)this.setValue(D.getAttribute('target')||'');},commit:function(C,D){if(C==e)if(this.getValue()||this.isChanged())D.setAttribute('target',this.getValue());}}]},{id:'Upload',hidden:true,filebrowser:'uploadButton',label:b.lang.image.upload,elements:[{type:'file',id:'upload',label:b.lang.image.btnUpload,style:'height:40px',size:38},{type:'fileButton',id:'uploadButton',filebrowser:'info:txtUrl',label:b.lang.image.btnUpload,'for':['Upload','upload']}]},{id:'advanced',label:b.lang.common.advancedTab,elements:[{type:'hbox',widths:['50%','25%','25%'],children:[{type:'text',id:'linkId',label:b.lang.common.id,setup:function(C,D){if(C==d)this.setValue(D.getAttribute('id'));},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('id',this.getValue());}},{id:'cmbLangDir',type:'select',style:'width : 100px;',label:b.lang.common.langDir,'default':'',items:[[b.lang.common.notSet,''],[b.lang.common.langDirLtr,'ltr'],[b.lang.common.langDirRtl,'rtl']],setup:function(C,D){if(C==d)this.setValue(D.getAttribute('dir'));},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('dir',this.getValue());}},{type:'text',id:'txtLangCode',label:b.lang.common.langCode,'default':'',setup:function(C,D){if(C==d)this.setValue(D.getAttribute('lang'));},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('lang',this.getValue());}}]},{type:'text',id:'txtGenLongDescr',label:b.lang.common.longDescr,setup:function(C,D){if(C==d)this.setValue(D.getAttribute('longDesc'));},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('longDesc',this.getValue());}},{type:'hbox',widths:['50%','50%'],children:[{type:'text',id:'txtGenClass',label:b.lang.common.cssClass,'default':'',setup:function(C,D){if(C==d)this.setValue(D.getAttribute('class'));
 },commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('class',this.getValue());}},{type:'text',id:'txtGenTitle',label:b.lang.common.advisoryTitle,'default':'',onChange:function(){l(this.getDialog());},setup:function(C,D){if(C==d)this.setValue(D.getAttribute('title'));},commit:function(C,D){var E=this;if(C==d){if(E.getValue()||E.isChanged())D.setAttribute('title',E.getValue());}else if(C==f)D.setAttribute('title',E.getValue());else if(C==g)D.removeAttribute('title');}}]},{type:'text',id:'txtdlgGenStyle',label:b.lang.common.cssStyle,'default':'',setup:function(C,D){if(C==d){var E=D.getAttribute('style');if(!E&&D.$.style.cssText)E=D.$.style.cssText;this.setValue(E);var F=D.$.style.height,G=D.$.style.width,H=(F?F:'').match(h),I=(G?G:'').match(h);this.attributesInStyle={height:!!H,width:!!I};}},onChange:function(){o.call(this,['info:cmbFloat','info:cmbAlign','info:txtVSpace','info:txtHSpace','info:txtBorder','info:txtWidth','info:txtHeight']);l(this);},commit:function(C,D){if(C==d&&(this.getValue()||this.isChanged()))D.setAttribute('style',this.getValue());}}]}]};};CKEDITOR.dialog.add('image',function(b){return a(b,'image');});CKEDITOR.dialog.add('imagebutton',function(b){return a(b,'imagebutton');});})();
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/link/dialogs/anchor.js b/appsrc/ODS-Framework/ckeditor/plugins/link/dialogs/anchor.js
index 91391f6..4c8edd2 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/link/dialogs/anchor.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/link/dialogs/anchor.js
@@ -1,6 +1,6 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.dialog.add('anchor',function(a){var b=function(c,d,e){var g=this;g.editMode=true;g.editObj=e;var f=g.editObj.getAttribute('name');if(f)g.setValueOf('info','txtName',f);else g.setValueOf('info','txtName','');};return{title:a.lang.anchor.title,minWidth:300,minHeight:60,onOk:function(){var f=this;var c=f.getValueOf('info','txtName'),d=CKEDITOR.env.ie?a.document.createElement('<a name="'+CKEDITOR.tools.htmlEncode(c)+'">'):a.document.createElement('a');if(f.editMode){f.editObj.copyAttributes(d,{name:1});f.editObj.moveChildren(d);}d.removeAttribute('_cke_saved_name');d.setAttribute('name',c);var e=a.createFakeElement(d,'cke_anchor','anchor');if(!f.editMode)a.insertElement(e);else{e.replace(f.fakeObj);a.getSelection().selectElement(e);}return true;},onShow:function(){var e=this;e.editObj=false;e.fakeObj=false;e.editMode=false;var c=a.getSelection(),d=c.getSelectedElement();if(d&&d.getAttribute('_cke_real_element_type')&&d.getAttribute('_cke_real_element_type')=='anchor'){e.fakeObj=d;d=a.restoreRealElement(e.fakeObj);b.apply(e,[a,c,d]);c.selectElement(e.fakeObj);}e.getContentElement('info','txtName').focus();},contents:[{id:'info',label:a.lang.anchor.title,accessKey:'I',elements:[{type:'text',id:'txtName',label:a.lang.anchor.name,required:true,validate:function(){if(!this.getValue()){alert(a.lang.anchor.errorName);return false;}return true;}}]}]};});
+CKEDITOR.dialog.add('anchor',function(a){var b=function(c,d,e){var g=this;g.editMode=true;g.editObj=e;var f=g.editObj.getAttribute('name');if(f)g.setValueOf('info','txtName',f);else g.setValueOf('info','txtName','');};return{title:a.lang.anchor.title,minWidth:300,minHeight:60,onOk:function(){var f=this;var c=f.getValueOf('info','txtName'),d=CKEDITOR.env.ie?a.document.createElement('<a name="'+CKEDITOR.tools.htmlEncode(c)+'">'):a.document.createElement('a');if(f.editMode){f.editObj.copyAttributes(d,{name:1});f.editObj.moveChildren(d);}d.data('cke-saved-name',false);d.setAttribute('name',c);var e=a.createFakeElement(d,'cke_anchor','anchor');if(!f.editMode)a.insertElement(e);else{e.replace(f.fakeObj);a.getSelection().selectElement(e);}return true;},onShow:function(){var e=this;e.editObj=false;e.fakeObj=false;e.editMode=false;var c=a.getSelection(),d=c.getSelectedElement();if(d&&d.data('cke-real-element-type')&&d.data('cke-real-element-type')=='anchor'){e.fakeObj=d;d=a.restoreRealElement(e.fakeObj);b.apply(e,[a,c,d]);c.selectElement(e.fakeObj);}e.getContentElement('info','txtName').focus();},contents:[{id:'info',label:a.lang.anchor.title,accessKey:'I',elements:[{type:'text',id:'txtName',label:a.lang.anchor.name,required:true,validate:function(){if(!this.getValue()){alert(a.lang.anchor.errorName);return false;}return true;}}]}]};});
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/link/dialogs/link.js b/appsrc/ODS-Framework/ckeditor/plugins/link/dialogs/link.js
index da295ff..815487f 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/link/dialogs/link.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/link/dialogs/link.js
@@ -1,11 +1,11 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.dialog.add('link',function(a){var b=CKEDITOR.plugins.link,c=function(){var C=this.getDialog(),D=C.getContentElement('target','popupFeatures'),E=C.getContentElement('target','linkTargetName'),F=this.getValue();if(!D||!E)return;D=D.getElement();D.hide();E.setValue('');switch(F){case 'frame':E.setLabel(a.lang.link.targetFrameName);E.getElement().show();break;case 'popup':D.show();E.setLabel(a.lang.link.targetPopupName);E.getElement().show();break;default:E.setValue(F);E.getElement().hide();break;}},d=function(){var C=this.getDialog(),D=['urlOptions','anchorOptions','emailOptions'],E=this.getValue(),F=C.definition.getContents('upload'),G=F&&F.hidden;if(E=='url'){if(a.config.linkShowTargetTab)C.showPage('target');if(!G)C.showPage('upload');}else{C.hidePage('target');if(!G)C.hidePage('upload');}for(var H=0;H<D.length;H++){var I=C.getContentElement('info',D[H]);if(!I)continue;I=I.getElement().getParent().getParent();if(D[H]==E+'Options')I.show();else I.hide();}},e=/^javascript:/,f=/^mailto:([^?]+)(?:\?(.+))?$/,g=/subject=([^;?:@&=$,\/]*)/,h=/body=([^;?:@&=$,\/]*)/,i=/^#(.*)$/,j=/^((?:http|https|ftp|news):\/\/)?(.*)$/,k=/^(_(?:self|top|parent|blank))$/,l=/^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,m=/^javascript:([^(]+)\(([^)]+)\)$/,n=/\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/,o=/(?:^|,)([^=]+)=(\d+|yes|no)/gi,p=function(C,D){var E=D&&(D.getAttribute('_cke_saved_href')||D.getAttribute('href'))||'',F,G,H,I,J={};if(F=E.match(e))if(y=='encode')E=E.replace(l,function(Z,aa,ab){return 'mailto:'+String.fromCharCode.apply(String,aa.split(','))+(ab&&w(ab));});else if(y)E.replace(m,function(Z,aa,ab){if(aa==z.name){J.type='email';var ac=J.email={},ad=/[^,\s]+/g,ae=/(^')|('$)/g,af=ab.match(ad),ag=af.length,ah,ai;for(var aj=0;aj<ag;aj++){ai=decodeURIComponent(w(af[aj].replace(ae,'')));ah=z.params[aj].toLowerCase();ac[ah]=ai;}ac.address=[ac.name,ac.domain].join('@');}});if(!J.type)if(H=E.match(i)){J.type='anchor';J.anchor={};J.anchor.name=J.anchor.id=H[1];}else if(G=E.match(f)){var K=E.match(g),L=E.match(h);J.type='email';var M=J.email={};M.address=G[1];K&&(M.subject=decodeURIComponent(K[1]));L&&(M.body=decodeURIComponent(L[1]));}else if(E&&(I=E.match(j))){J.type='url';J.url={};J.url.protocol=I[1];J.url.url=I[2];}else J.type='url';if(D){var N=D.getAttribute('target');J.target={};J.adv={};if(!N){var O=D.getAttribute('_cke_pa_onclick')||D.getAttribute('onclick'),P=O&&O.match(n);
-if(P){J.target.type='popup';J.target.name=P[1];var Q;while(Q=o.exec(P[2])){if(Q[2]=='yes'||Q[2]=='1')J.target[Q[1]]=true;else if(isFinite(Q[2]))J.target[Q[1]]=Q[2];}}}else{var R=N.match(k);if(R)J.target.type=J.target.name=N;else{J.target.type='frame';J.target.name=N;}}var S=this,T=function(Z,aa){var ab=D.getAttribute(aa);if(ab!==null)J.adv[Z]=ab||'';};T('advId','id');T('advLangDir','dir');T('advAccessKey','accessKey');T('advName','name');T('advLangCode','lang');T('advTabIndex','tabindex');T('advTitle','title');T('advContentType','type');T('advCSSClasses','class');T('advCharset','charset');T('advStyles','style');}var U=C.document.getElementsByTag('img'),V=new CKEDITOR.dom.nodeList(C.document.$.anchors),W=J.anchors=[];for(var X=0;X<U.count();X++){var Y=U.getItem(X);if(Y.getAttribute('_cke_realelement')&&Y.getAttribute('_cke_real_element_type')=='anchor')W.push(C.restoreRealElement(Y));}for(X=0;X<V.count();X++)W.push(V.getItem(X));for(X=0;X<W.length;X++){Y=W[X];W[X]={name:Y.getAttribute('name'),id:Y.getAttribute('id')};}this._.selectedElement=D;return J;},q=function(C,D){if(D[C])this.setValue(D[C][this.id]||'');},r=function(C){return q.call(this,'target',C);},s=function(C){return q.call(this,'adv',C);},t=function(C,D){if(!D[C])D[C]={};D[C][this.id]=this.getValue()||'';},u=function(C){return t.call(this,'target',C);},v=function(C){return t.call(this,'adv',C);};function w(C){return C.replace(/\\'/g,"'");};function x(C){return C.replace(/'/g,'\\$&');};var y=a.config.emailProtection||'';if(y&&y!='encode'){var z={};y.replace(/^([^(]+)\(([^)]+)\)$/,function(C,D,E){z.name=D;z.params=[];E.replace(/[^,\s]+/g,function(F){z.params.push(F);});});}function A(C){var D,E=z.name,F=z.params,G,H;D=[E,'('];for(var I=0;I<F.length;I++){G=F[I].toLowerCase();H=C[G];I>0&&D.push(',');D.push("'",H?x(encodeURIComponent(C[G])):'',"'");}D.push(')');return D.join('');};function B(C){var D,E=C.length,F=[];for(var G=0;G<E;G++){D=C.charCodeAt(G);F.push(D);}return 'String.fromCharCode('+F.join(',')+')';};return{title:a.lang.link.title,minWidth:350,minHeight:230,contents:[{id:'info',label:a.lang.link.info,title:a.lang.link.info,elements:[{id:'linkType',type:'select',label:a.lang.link.type,'default':'url',items:[[a.lang.link.toUrl,'url'],[a.lang.link.toAnchor,'anchor'],[a.lang.link.toEmail,'email']],onChange:d,setup:function(C){if(C.type)this.setValue(C.type);},commit:function(C){C.type=this.getValue();}},{type:'vbox',id:'urlOptions',children:[{type:'hbox',widths:['25%','75%'],children:[{id:'protocol',type:'select',label:a.lang.common.protocol,'default':'http://',items:[['http://‎','http://'],['https://‎','https://'],['ftp://‎','ftp://'],['news://‎','news://'],[a.lang.link.other,'']],setup:function(C){if(C.url)this.setValue(C.url.protocol||'');
-},commit:function(C){if(!C.url)C.url={};C.url.protocol=this.getValue();}},{type:'text',id:'url',label:a.lang.common.url,required:true,onLoad:function(){this.allowOnChange=true;},onKeyUp:function(){var H=this;H.allowOnChange=false;var C=H.getDialog().getContentElement('info','protocol'),D=H.getValue(),E=/^(http|https|ftp|news):\/\/(?=.)/gi,F=/^((javascript:)|[#\/\.\?])/gi,G=E.exec(D);if(G){H.setValue(D.substr(G[0].length));C.setValue(G[0].toLowerCase());}else if(F.test(D))C.setValue('');H.allowOnChange=true;},onChange:function(){if(this.allowOnChange)this.onKeyUp();},validate:function(){var C=this.getDialog();if(C.getContentElement('info','linkType')&&C.getValueOf('info','linkType')!='url')return true;if(this.getDialog().fakeObj)return true;var D=CKEDITOR.dialog.validate.notEmpty(a.lang.link.noUrl);return D.apply(this);},setup:function(C){this.allowOnChange=false;if(C.url)this.setValue(C.url.url);this.allowOnChange=true;},commit:function(C){this.onChange();if(!C.url)C.url={};C.url.url=this.getValue();this.allowOnChange=false;}}],setup:function(C){if(!this.getDialog().getContentElement('info','linkType'))this.getElement().show();}},{type:'button',id:'browse',hidden:'true',filebrowser:'info:url',label:a.lang.common.browseServer}]},{type:'vbox',id:'anchorOptions',width:260,align:'center',padding:0,children:[{type:'fieldset',id:'selectAnchorText',label:a.lang.link.selectAnchor,setup:function(C){if(C.anchors.length>0)this.getElement().show();else this.getElement().hide();},children:[{type:'hbox',id:'selectAnchor',children:[{type:'select',id:'anchorName','default':'',label:a.lang.link.anchorName,style:'width: 100%;',items:[['']],setup:function(C){var F=this;F.clear();F.add('');for(var D=0;D<C.anchors.length;D++){if(C.anchors[D].name)F.add(C.anchors[D].name);}if(C.anchor)F.setValue(C.anchor.name);var E=F.getDialog().getContentElement('info','linkType');if(E&&E.getValue()=='email')F.focus();},commit:function(C){if(!C.anchor)C.anchor={};C.anchor.name=this.getValue();}},{type:'select',id:'anchorId','default':'',label:a.lang.link.anchorId,style:'width: 100%;',items:[['']],setup:function(C){var E=this;E.clear();E.add('');for(var D=0;D<C.anchors.length;D++){if(C.anchors[D].id)E.add(C.anchors[D].id);}if(C.anchor)E.setValue(C.anchor.id);},commit:function(C){if(!C.anchor)C.anchor={};C.anchor.id=this.getValue();}}],setup:function(C){if(C.anchors.length>0)this.getElement().show();else this.getElement().hide();}}]},{type:'html',id:'noAnchors',style:'text-align: center;',html:'<div role="label" tabIndex="-1">'+CKEDITOR.tools.htmlEncode(a.lang.link.noAnchors)+'</div>',focus:true,setup:function(C){if(C.anchors.length<1)this.getElement().show();
-else this.getElement().hide();}}],setup:function(C){if(!this.getDialog().getContentElement('info','linkType'))this.getElement().hide();}},{type:'vbox',id:'emailOptions',padding:1,children:[{type:'text',id:'emailAddress',label:a.lang.link.emailAddress,required:true,validate:function(){var C=this.getDialog();if(!C.getContentElement('info','linkType')||C.getValueOf('info','linkType')!='email')return true;var D=CKEDITOR.dialog.validate.notEmpty(a.lang.link.noEmail);return D.apply(this);},setup:function(C){if(C.email)this.setValue(C.email.address);var D=this.getDialog().getContentElement('info','linkType');if(D&&D.getValue()=='email')this.select();},commit:function(C){if(!C.email)C.email={};C.email.address=this.getValue();}},{type:'text',id:'emailSubject',label:a.lang.link.emailSubject,setup:function(C){if(C.email)this.setValue(C.email.subject);},commit:function(C){if(!C.email)C.email={};C.email.subject=this.getValue();}},{type:'textarea',id:'emailBody',label:a.lang.link.emailBody,rows:3,'default':'',setup:function(C){if(C.email)this.setValue(C.email.body);},commit:function(C){if(!C.email)C.email={};C.email.body=this.getValue();}}],setup:function(C){if(!this.getDialog().getContentElement('info','linkType'))this.getElement().hide();}}]},{id:'target',label:a.lang.link.target,title:a.lang.link.target,elements:[{type:'hbox',widths:['50%','50%'],children:[{type:'select',id:'linkTargetType',label:a.lang.common.target,'default':'notSet',style:'width : 100%;',items:[[a.lang.common.notSet,'notSet'],[a.lang.link.targetFrame,'frame'],[a.lang.link.targetPopup,'popup'],[a.lang.common.targetNew,'_blank'],[a.lang.common.targetTop,'_top'],[a.lang.common.targetSelf,'_self'],[a.lang.common.targetParent,'_parent']],onChange:c,setup:function(C){if(C.target)this.setValue(C.target.type);},commit:function(C){if(!C.target)C.target={};C.target.type=this.getValue();}},{type:'text',id:'linkTargetName',label:a.lang.link.targetFrameName,'default':'',setup:function(C){if(C.target)this.setValue(C.target.name);},commit:function(C){if(!C.target)C.target={};C.target.name=this.getValue().replace(/\W/gi,'');}}]},{type:'vbox',width:260,align:'center',padding:2,id:'popupFeatures',children:[{type:'fieldset',label:a.lang.link.popupFeatures,children:[{type:'hbox',children:[{type:'checkbox',id:'resizable',label:a.lang.link.popupResizable,setup:r,commit:u},{type:'checkbox',id:'status',label:a.lang.link.popupStatusBar,setup:r,commit:u}]},{type:'hbox',children:[{type:'checkbox',id:'location',label:a.lang.link.popupLocationBar,setup:r,commit:u},{type:'checkbox',id:'toolbar',label:a.lang.link.popupToolbar,setup:r,commit:u}]},{type:'hbox',children:[{type:'checkbox',id:'menubar',label:a.lang.link.popupMenuBar,setup:r,commit:u},{type:'checkbox',id:'fullscreen',label:a.lang.link.popupFullScreen,setup:r,commit:u}]},{type:'hbox',children:[{type:'checkbox',id:'scrollbars',label:a.lang.link.popupScrollBars,setup:r,commit:u},{type:'checkbox',id:'dependent',label:a.lang.link.popupDependent,setup:r,commit:u}]},{type:'hbox',children:[{type:'text',widths:['30%','70%'],labelLayout:'horizontal',label:a.lang.link.popupWidth,id:'width',setup:r,commit:u},{type:'text',labelLayout:'horizontal',widths:['55%','45%'],label:a.lang.link.popupLeft,id:'left',setup:r,commit:u}]},{type:'hbox',children:[{type:'text',labelLayout:'horizontal',widths:['30%','70%'],label:a.lang.link.popupHeight,id:'height',setup:r,commit:u},{type:'text',labelLayout:'horizontal',label:a.lang.link.popupTop,widths:['55%','45%'],id:'top',setup:r,commit:u}]}]}]}]},{id:'upload',label:a.lang.link.upload,title:a.lang.link.upload,hidden:true,filebrowser:'uploadButton',elements:[{type:'file',id:'upload',label:a.lang.common.upload,style:'height:40px',size:29},{type:'fileButton',id:'uploadButton',label:a.lang.common.uploadSubmit,filebrowser:'info:url','for':['upload','upload']}]},{id:'advanced',label:a.lang.link.advanced,title:a.lang.link.advanced,elements:[{type:'vbox',padding:1,children:[{type:'hbox',widths:['45%','35%','20%'],children:[{type:'text',id:'advId',label:a.lang.link.id,setup:s,commit:v},{type:'select',id:'advLangDir',label:a.lang.link.langDir,'default':'',style:'width:110px',items:[[a.lang.common.notSet,''],[a.lang.link.langDirLTR,'ltr'],[a.lang.link.langDirRTL,'rtl']],setup:s,commit:v},{type:'text',id:'advAccessKey',width:'80px',label:a.lang.link.acccessKey,maxLength:1,setup:s,commit:v}]},{type:'hbox',widths:['45%','35%','20%'],children:[{type:'text',label:a.lang.link.name,id:'advName',setup:s,commit:v},{type:'text',label:a.lang.link.langCode,id:'advLangCode',width:'110px','default':'',setup:s,commit:v},{type:'text',label:a.lang.link.tabIndex,id:'advTabIndex',width:'80px',maxLength:5,setup:s,commit:v}]}]},{type:'vbox',padding:1,children:[{type:'hbox',widths:['45%','55%'],children:[{type:'text',label:a.lang.link.advisoryTitle,'default':'',id:'advTitle',setup:s,commit:v},{type:'text',label:a.lang.link.advisoryContentType,'default':'',id:'advContentType',setup:s,commit:v}]},{type:'hbox',widths:['45%','55%'],children:[{type:'text',label:a.lang.link.cssClasses,'default':'',id:'advCSSClasses',setup:s,commit:v},{type:'text',label:a.lang.link.charset,'default':'',id:'advCharset',setup:s,commit:v}]},{type:'hbox',children:[{type:'text',label:a.lang.link.styles,'default':'',id:'advStyles',setup:s,commit:v}]}]}]}],onShow:function(){var F=this;
-F.fakeObj=false;var C=F.getParentEditor(),D=C.getSelection(),E=null;if((E=b.getSelectedLink(C))&&E.hasAttribute('href'))D.selectElement(E);else if((E=D.getSelectedElement())&&E.is('img')&&E.getAttribute('_cke_real_element_type')&&E.getAttribute('_cke_real_element_type')=='anchor'){F.fakeObj=E;E=C.restoreRealElement(F.fakeObj);D.selectElement(F.fakeObj);}else E=null;F.setupContent(p.apply(F,[C,E]));},onOk:function(){var C={href:'javascript:void(0)/*'+CKEDITOR.tools.getNextNumber()+'*/'},D=[],E={href:C.href},F=this,G=this.getParentEditor();this.commitContent(E);switch(E.type||'url'){case 'url':var H=E.url&&E.url.protocol!=undefined?E.url.protocol:'http://',I=E.url&&E.url.url||'';C._cke_saved_href=I.indexOf('/')===0?I:H+I;break;case 'anchor':var J=E.anchor&&E.anchor.name,K=E.anchor&&E.anchor.id;C._cke_saved_href='#'+(J||K||'');break;case 'email':var L,M=E.email,N=M.address;switch(y){case '':case 'encode':var O=encodeURIComponent(M.subject||''),P=encodeURIComponent(M.body||''),Q=[];O&&Q.push('subject='+O);P&&Q.push('body='+P);Q=Q.length?'?'+Q.join('&'):'';if(y=='encode'){L=["javascript:void(location.href='mailto:'+",B(N)];Q&&L.push("+'",x(Q),"'");L.push(')');}else L=['mailto:',N,Q];break;default:var R=N.split('@',2);M.name=R[0];M.domain=R[1];L=['javascript:',A(M)];}C._cke_saved_href=L.join('');break;}if(E.target)if(E.target.type=='popup'){var S=["window.open(this.href, '",E.target.name||'',"', '"],T=['resizable','status','location','toolbar','menubar','fullscreen','scrollbars','dependent'],U=T.length,V=function(ah){if(E.target[ah])T.push(ah+'='+E.target[ah]);};for(var W=0;W<U;W++)T[W]=T[W]+(E.target[T[W]]?'=yes':'=no');V('width');V('left');V('height');V('top');S.push(T.join(','),"'); return false;");C._cke_pa_onclick=S.join('');}else{if(E.target.type!='notSet'&&E.target.name)C.target=E.target.name;else D.push('target');D.push('_cke_pa_onclick','onclick');}if(E.adv){var X=function(ah,ai){var aj=E.adv[ah];if(aj)C[ai]=aj;else D.push(ai);};if(this._.selectedElement)X('advId','id');X('advLangDir','dir');X('advAccessKey','accessKey');X('advName','name');X('advLangCode','lang');X('advTabIndex','tabindex');X('advTitle','title');X('advContentType','type');X('advCSSClasses','class');X('advCharset','charset');X('advStyles','style');}if(!this._.selectedElement){var Y=G.getSelection(),Z=Y.getRanges();if(Z.length==1&&Z[0].collapsed){var aa=new CKEDITOR.dom.text(C._cke_saved_href,G.document);Z[0].insertNode(aa);Z[0].selectNodeContents(aa);Y.selectRanges(Z);}var ab=new CKEDITOR.style({element:'a',attributes:C});
-ab.type=CKEDITOR.STYLE_INLINE;ab.apply(G.document);if(E.adv&&E.adv.advId){var ac=this.getParentEditor().document.$.getElementsByTagName('a');for(W=0;W<ac.length;W++){if(ac[W].href==C.href){ac[W].id=E.adv.advId;break;}}}}else{var ad=this._.selectedElement,ae=ad.getAttribute('_cke_saved_href'),af=ad.getHtml();if(CKEDITOR.env.ie&&C.name!=ad.getAttribute('name')){var ag=new CKEDITOR.dom.element('<a name="'+CKEDITOR.tools.htmlEncode(C.name)+'">',G.document);Y=G.getSelection();ad.moveChildren(ag);ad.copyAttributes(ag,{name:1});ag.replace(ad);ad=ag;Y.selectElement(ad);}ad.setAttributes(C);ad.removeAttributes(D);if(ae==af)ad.setHtml(C._cke_saved_href);if(ad.getAttribute('name'))ad.addClass('cke_anchor');else ad.removeClass('cke_anchor');if(this.fakeObj)G.createFakeElement(ad,'cke_anchor','anchor').replace(this.fakeObj);delete this._.selectedElement;}},onLoad:function(){if(!a.config.linkShowAdvancedTab)this.hidePage('advanced');if(!a.config.linkShowTargetTab)this.hidePage('target');},onFocus:function(){var C=this.getContentElement('info','linkType'),D;if(C&&C.getValue()=='url'){D=this.getContentElement('info','url');D.select();}}};});
+CKEDITOR.dialog.add('link',function(a){var b=CKEDITOR.plugins.link,c=function(){var E=this.getDialog(),F=E.getContentElement('target','popupFeatures'),G=E.getContentElement('target','linkTargetName'),H=this.getValue();if(!F||!G)return;F=F.getElement();F.hide();G.setValue('');switch(H){case 'frame':G.setLabel(a.lang.link.targetFrameName);G.getElement().show();break;case 'popup':F.show();G.setLabel(a.lang.link.targetPopupName);G.getElement().show();break;default:G.setValue(H);G.getElement().hide();break;}},d=function(){var E=this.getDialog(),F=['urlOptions','anchorOptions','emailOptions'],G=this.getValue(),H=E.definition.getContents('upload'),I=H&&H.hidden;if(G=='url'){if(a.config.linkShowTargetTab)E.showPage('target');if(!I)E.showPage('upload');}else{E.hidePage('target');if(!I)E.hidePage('upload');}for(var J=0;J<F.length;J++){var K=E.getContentElement('info',F[J]);if(!K)continue;K=K.getElement().getParent().getParent();if(F[J]==G+'Options')K.show();else K.hide();}E.layout();},e=/^javascript:/,f=/^mailto:([^?]+)(?:\?(.+))?$/,g=/subject=([^;?:@&=$,\/]*)/,h=/body=([^;?:@&=$,\/]*)/,i=/^#(.*)$/,j=/^((?:http|https|ftp|news):\/\/)?(.*)$/,k=/^(_(?:self|top|parent|blank))$/,l=/^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,m=/^javascript:([^(]+)\(([^)]+)\)$/,n=/\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/,o=/(?:^|,)([^=]+)=(\d+|yes|no)/gi,p=function(E,F){var G=F&&(F.data('cke-saved-href')||F.getAttribute('href'))||'',H,I,J,K,L={};if(H=G.match(e))if(y=='encode')G=G.replace(l,function(ab,ac,ad){return 'mailto:'+String.fromCharCode.apply(String,ac.split(','))+(ad&&w(ad));});else if(y)G.replace(m,function(ab,ac,ad){if(ac==z.name){L.type='email';var ae=L.email={},af=/[^,\s]+/g,ag=/(^')|('$)/g,ah=ad.match(af),ai=ah.length,aj,ak;for(var al=0;al<ai;al++){ak=decodeURIComponent(w(ah[al].replace(ag,'')));aj=z.params[al].toLowerCase();ae[aj]=ak;}ae.address=[ae.name,ae.domain].join('@');}});if(!L.type)if(J=G.match(i)){L.type='anchor';L.anchor={};L.anchor.name=L.anchor.id=J[1];}else if(I=G.match(f)){var M=G.match(g),N=G.match(h);L.type='email';var O=L.email={};O.address=I[1];M&&(O.subject=decodeURIComponent(M[1]));N&&(O.body=decodeURIComponent(N[1]));}else if(G&&(K=G.match(j))){L.type='url';L.url={};L.url.protocol=K[1];L.url.url=K[2];}else L.type='url';if(F){var P=F.getAttribute('target');L.target={};L.adv={};if(!P){var Q=F.data('cke-pa-onclick')||F.getAttribute('onclick'),R=Q&&Q.match(n);
+if(R){L.target.type='popup';L.target.name=R[1];var S;while(S=o.exec(R[2])){if(S[2]=='yes'||S[2]=='1')L.target[S[1]]=true;else if(isFinite(S[2]))L.target[S[1]]=S[2];}}}else{var T=P.match(k);if(T)L.target.type=L.target.name=P;else{L.target.type='frame';L.target.name=P;}}var U=this,V=function(ab,ac){var ad=F.getAttribute(ac);if(ad!==null)L.adv[ab]=ad||'';};V('advId','id');V('advLangDir','dir');V('advAccessKey','accessKey');L.adv.advName=F.data('cke-saved-name')||F.getAttribute('name')||'';V('advLangCode','lang');V('advTabIndex','tabindex');V('advTitle','title');V('advContentType','type');V('advCSSClasses','class');V('advCharset','charset');V('advStyles','style');}var W=E.document.getElementsByTag('img'),X=new CKEDITOR.dom.nodeList(E.document.$.anchors),Y=L.anchors=[];for(var Z=0;Z<W.count();Z++){var aa=W.getItem(Z);if(aa.data('cke-realelement')&&aa.data('cke-real-element-type')=='anchor')Y.push(E.restoreRealElement(aa));}for(Z=0;Z<X.count();Z++)Y.push(X.getItem(Z));for(Z=0;Z<Y.length;Z++){aa=Y[Z];Y[Z]={name:aa.getAttribute('name'),id:aa.getAttribute('id')};}this._.selectedElement=F;return L;},q=function(E,F){if(F[E])this.setValue(F[E][this.id]||'');},r=function(E){return q.call(this,'target',E);},s=function(E){return q.call(this,'adv',E);},t=function(E,F){if(!F[E])F[E]={};F[E][this.id]=this.getValue()||'';},u=function(E){return t.call(this,'target',E);},v=function(E){return t.call(this,'adv',E);};function w(E){return E.replace(/\\'/g,"'");};function x(E){return E.replace(/'/g,'\\$&');};var y=a.config.emailProtection||'';if(y&&y!='encode'){var z={};y.replace(/^([^(]+)\(([^)]+)\)$/,function(E,F,G){z.name=F;z.params=[];G.replace(/[^,\s]+/g,function(H){z.params.push(H);});});}function A(E){var F,G=z.name,H=z.params,I,J;F=[G,'('];for(var K=0;K<H.length;K++){I=H[K].toLowerCase();J=E[I];K>0&&F.push(',');F.push("'",J?x(encodeURIComponent(E[I])):'',"'");}F.push(')');return F.join('');};function B(E){var F,G=E.length,H=[];for(var I=0;I<G;I++){F=E.charCodeAt(I);H.push(F);}return 'String.fromCharCode('+H.join(',')+')';};var C=a.lang.common,D=a.lang.link;return{title:D.title,minWidth:350,minHeight:230,contents:[{id:'info',label:D.info,title:D.info,elements:[{id:'linkType',type:'select',label:D.type,'default':'url',items:[[D.toUrl,'url'],[D.toAnchor,'anchor'],[D.toEmail,'email']],onChange:d,setup:function(E){if(E.type)this.setValue(E.type);},commit:function(E){E.type=this.getValue();}},{type:'vbox',id:'urlOptions',children:[{type:'hbox',widths:['25%','75%'],children:[{id:'protocol',type:'select',label:C.protocol,'default':'http://',items:[['http://‎','http://'],['https://‎','https://'],['ftp://‎','ftp://'],['news://‎','news://'],[D.other,'']],setup:function(E){if(E.url)this.setValue(E.url.protocol||'');
+},commit:function(E){if(!E.url)E.url={};E.url.protocol=this.getValue();}},{type:'text',id:'url',label:C.url,required:true,onLoad:function(){this.allowOnChange=true;},onKeyUp:function(){var J=this;J.allowOnChange=false;var E=J.getDialog().getContentElement('info','protocol'),F=J.getValue(),G=/^(http|https|ftp|news):\/\/(?=.)/i,H=/^((javascript:)|[#\/\.\?])/i,I=G.exec(F);if(I){J.setValue(F.substr(I[0].length));E.setValue(I[0].toLowerCase());}else if(H.test(F))E.setValue('');J.allowOnChange=true;},onChange:function(){if(this.allowOnChange)this.onKeyUp();},validate:function(){var E=this.getDialog();if(E.getContentElement('info','linkType')&&E.getValueOf('info','linkType')!='url')return true;if(this.getDialog().fakeObj)return true;var F=CKEDITOR.dialog.validate.notEmpty(D.noUrl);return F.apply(this);},setup:function(E){this.allowOnChange=false;if(E.url)this.setValue(E.url.url);this.allowOnChange=true;},commit:function(E){this.onChange();if(!E.url)E.url={};E.url.url=this.getValue();this.allowOnChange=false;}}],setup:function(E){if(!this.getDialog().getContentElement('info','linkType'))this.getElement().show();}},{type:'button',id:'browse',hidden:'true',filebrowser:'info:url',label:C.browseServer}]},{type:'vbox',id:'anchorOptions',width:260,align:'center',padding:0,children:[{type:'fieldset',id:'selectAnchorText',label:D.selectAnchor,setup:function(E){if(E.anchors.length>0)this.getElement().show();else this.getElement().hide();},children:[{type:'hbox',id:'selectAnchor',children:[{type:'select',id:'anchorName','default':'',label:D.anchorName,style:'width: 100%;',items:[['']],setup:function(E){var H=this;H.clear();H.add('');for(var F=0;F<E.anchors.length;F++){if(E.anchors[F].name)H.add(E.anchors[F].name);}if(E.anchor)H.setValue(E.anchor.name);var G=H.getDialog().getContentElement('info','linkType');if(G&&G.getValue()=='email')H.focus();},commit:function(E){if(!E.anchor)E.anchor={};E.anchor.name=this.getValue();}},{type:'select',id:'anchorId','default':'',label:D.anchorId,style:'width: 100%;',items:[['']],setup:function(E){var G=this;G.clear();G.add('');for(var F=0;F<E.anchors.length;F++){if(E.anchors[F].id)G.add(E.anchors[F].id);}if(E.anchor)G.setValue(E.anchor.id);},commit:function(E){if(!E.anchor)E.anchor={};E.anchor.id=this.getValue();}}],setup:function(E){if(E.anchors.length>0)this.getElement().show();else this.getElement().hide();}}]},{type:'html',id:'noAnchors',style:'text-align: center;',html:'<div role="label" tabIndex="-1">'+CKEDITOR.tools.htmlEncode(D.noAnchors)+'</div>',focus:true,setup:function(E){if(E.anchors.length<1)this.getElement().show();
+else this.getElement().hide();}}],setup:function(E){if(!this.getDialog().getContentElement('info','linkType'))this.getElement().hide();}},{type:'vbox',id:'emailOptions',padding:1,children:[{type:'text',id:'emailAddress',label:D.emailAddress,required:true,validate:function(){var E=this.getDialog();if(!E.getContentElement('info','linkType')||E.getValueOf('info','linkType')!='email')return true;var F=CKEDITOR.dialog.validate.notEmpty(D.noEmail);return F.apply(this);},setup:function(E){if(E.email)this.setValue(E.email.address);var F=this.getDialog().getContentElement('info','linkType');if(F&&F.getValue()=='email')this.select();},commit:function(E){if(!E.email)E.email={};E.email.address=this.getValue();}},{type:'text',id:'emailSubject',label:D.emailSubject,setup:function(E){if(E.email)this.setValue(E.email.subject);},commit:function(E){if(!E.email)E.email={};E.email.subject=this.getValue();}},{type:'textarea',id:'emailBody',label:D.emailBody,rows:3,'default':'',setup:function(E){if(E.email)this.setValue(E.email.body);},commit:function(E){if(!E.email)E.email={};E.email.body=this.getValue();}}],setup:function(E){if(!this.getDialog().getContentElement('info','linkType'))this.getElement().hide();}}]},{id:'target',label:D.target,title:D.target,elements:[{type:'hbox',widths:['50%','50%'],children:[{type:'select',id:'linkTargetType',label:C.target,'default':'notSet',style:'width : 100%;',items:[[C.notSet,'notSet'],[D.targetFrame,'frame'],[D.targetPopup,'popup'],[C.targetNew,'_blank'],[C.targetTop,'_top'],[C.targetSelf,'_self'],[C.targetParent,'_parent']],onChange:c,setup:function(E){if(E.target)this.setValue(E.target.type||'notSet');c.call(this);},commit:function(E){if(!E.target)E.target={};E.target.type=this.getValue();}},{type:'text',id:'linkTargetName',label:D.targetFrameName,'default':'',setup:function(E){if(E.target)this.setValue(E.target.name);},commit:function(E){if(!E.target)E.target={};E.target.name=this.getValue().replace(/\W/gi,'');}}]},{type:'vbox',width:'100%',align:'center',padding:2,id:'popupFeatures',children:[{type:'fieldset',label:D.popupFeatures,children:[{type:'hbox',children:[{type:'checkbox',id:'resizable',label:D.popupResizable,setup:r,commit:u},{type:'checkbox',id:'status',label:D.popupStatusBar,setup:r,commit:u}]},{type:'hbox',children:[{type:'checkbox',id:'location',label:D.popupLocationBar,setup:r,commit:u},{type:'checkbox',id:'toolbar',label:D.popupToolbar,setup:r,commit:u}]},{type:'hbox',children:[{type:'checkbox',id:'menubar',label:D.popupMenuBar,setup:r,commit:u},{type:'checkbox',id:'fullscreen',label:D.popupFullScreen,setup:r,commit:u}]},{type:'hbox',children:[{type:'checkbox',id:'scrollbars',label:D.popupScrollBars,setup:r,commit:u},{type:'checkbox',id:'dependent',label:D.popupDependent,setup:r,commit:u}]},{type:'hbox',children:[{type:'text',widths:['50%','50%'],labelLayout:'horizontal',label:C.width,id:'width',setup:r,commit:u},{type:'text',labelLayout:'horizontal',widths:['50%','50%'],label:D.popupLeft,id:'left',setup:r,commit:u}]},{type:'hbox',children:[{type:'text',labelLayout:'horizontal',widths:['50%','50%'],label:C.height,id:'height',setup:r,commit:u},{type:'text',labelLayout:'horizontal',label:D.popupTop,widths:['50%','50%'],id:'top',setup:r,commit:u}]}]}]}]},{id:'upload',label:D.upload,title:D.upload,hidden:true,filebrowser:'uploadButton',elements:[{type:'file',id:'upload',label:C.upload,style:'height:40px',size:29},{type:'fileButton',id:'uploadButton',label:C.uploadSubmit,filebrowser:'info:url','for':['upload','upload']}]},{id:'advanced',label:D.advanced,title:D.advanced,elements:[{type:'vbox',padding:1,children:[{type:'hbox',widths:['45%','35%','20%'],children:[{type:'text',id:'advId',label:D.id,setup:s,commit:v},{type:'select',id:'advLangDir',label:D.langDir,'default':'',style:'width:110px',items:[[C.notSet,''],[D.langDirLTR,'ltr'],[D.langDirRTL,'rtl']],setup:s,commit:v},{type:'text',id:'advAccessKey',width:'80px',label:D.acccessKey,maxLength:1,setup:s,commit:v}]},{type:'hbox',widths:['45%','35%','20%'],children:[{type:'text',label:D.name,id:'advName',setup:s,commit:v},{type:'text',label:D.langCode,id:'advLangCode',width:'110px','default':'',setup:s,commit:v},{type:'text',label:D.tabIndex,id:'advTabIndex',width:'80px',maxLength:5,setup:s,commit:v}]}]},{type:'vbox',padding:1,children:[{type:'hbox',widths:['45%','55%'],children:[{type:'text',label:D.advisoryTitle,'default':'',id:'advTitle',setup:s,commit:v},{type:'text',label:D.advisoryContentType,'default':'',id:'advContentType',setup:s,commit:v}]},{type:'hbox',widths:['45%','55%'],children:[{type:'text',label:D.cssClasses,'default':'',id:'advCSSClasses',setup:s,commit:v},{type:'text',label:D.charset,'default':'',id:'advCharset',setup:s,commit:v}]},{type:'hbox',children:[{type:'text',label:D.styles,'default':'',id:'advStyles',setup:s,commit:v}]}]}]}],onShow:function(){var H=this;
+H.fakeObj=false;var E=H.getParentEditor(),F=E.getSelection(),G=null;if((G=b.getSelectedLink(E))&&G.hasAttribute('href'))F.selectElement(G);else if((G=F.getSelectedElement())&&G.is('img')&&G.data('cke-real-element-type')&&G.data('cke-real-element-type')=='anchor'){H.fakeObj=G;G=E.restoreRealElement(H.fakeObj);F.selectElement(H.fakeObj);}else G=null;H.setupContent(p.apply(H,[E,G]));},onOk:function(){var E={},F=[],G={},H=this,I=this.getParentEditor();this.commitContent(G);switch(G.type||'url'){case 'url':var J=G.url&&G.url.protocol!=undefined?G.url.protocol:'http://',K=G.url&&G.url.url||'';E['data-cke-saved-href']=K.indexOf('/')===0?K:J+K;break;case 'anchor':var L=G.anchor&&G.anchor.name,M=G.anchor&&G.anchor.id;E['data-cke-saved-href']='#'+(L||M||'');break;case 'email':var N,O=G.email,P=O.address;switch(y){case '':case 'encode':var Q=encodeURIComponent(O.subject||''),R=encodeURIComponent(O.body||''),S=[];Q&&S.push('subject='+Q);R&&S.push('body='+R);S=S.length?'?'+S.join('&'):'';if(y=='encode'){N=["javascript:void(location.href='mailto:'+",B(P)];S&&N.push("+'",x(S),"'");N.push(')');}else N=['mailto:',P,S];break;default:var T=P.split('@',2);O.name=T[0];O.domain=T[1];N=['javascript:',A(O)];}E['data-cke-saved-href']=N.join('');break;}if(G.target)if(G.target.type=='popup'){var U=["window.open(this.href, '",G.target.name||'',"', '"],V=['resizable','status','location','toolbar','menubar','fullscreen','scrollbars','dependent'],W=V.length,X=function(ai){if(G.target[ai])V.push(ai+'='+G.target[ai]);};for(var Y=0;Y<W;Y++)V[Y]=V[Y]+(G.target[V[Y]]?'=yes':'=no');X('width');X('left');X('height');X('top');U.push(V.join(','),"'); return false;");E['data-cke-pa-onclick']=U.join('');F.push('target');}else{if(G.target.type!='notSet'&&G.target.name)E.target=G.target.name;else F.push('target');F.push('data-cke-pa-onclick','onclick');}if(G.adv){var Z=function(ai,aj){var ak=G.adv[ai];if(ak)E[aj]=ak;else F.push(aj);};Z('advId','id');Z('advLangDir','dir');Z('advAccessKey','accessKey');if(G.adv.advName){E.name=E['data-cke-saved-name']=G.adv.advName;E['class']=(E['class']?E['class']+' ':'')+'cke_anchor';}else F=F.concat(['data-cke-saved-name','name']);Z('advLangCode','lang');Z('advTabIndex','tabindex');Z('advTitle','title');Z('advContentType','type');Z('advCSSClasses','class');Z('advCharset','charset');Z('advStyles','style');}E.href=E['data-cke-saved-href'];if(!this._.selectedElement){var aa=I.getSelection(),ab=aa.getRanges(true);if(ab.length==1&&ab[0].collapsed){var ac=new CKEDITOR.dom.text(G.type=='email'?G.email.address:E['data-cke-saved-href'],I.document);
+ab[0].insertNode(ac);ab[0].selectNodeContents(ac);aa.selectRanges(ab);}var ad=new CKEDITOR.style({element:'a',attributes:E});ad.type=CKEDITOR.STYLE_INLINE;ad.apply(I.document);}else{var ae=this._.selectedElement,af=ae.data('cke-saved-href'),ag=ae.getHtml();if(CKEDITOR.env.ie&&E.name!=ae.getAttribute('name')){var ah=new CKEDITOR.dom.element('<a name="'+CKEDITOR.tools.htmlEncode(E.name)+'">',I.document);aa=I.getSelection();ae.copyAttributes(ah,{name:1});ae.moveChildren(ah);ah.replace(ae);ae=ah;aa.selectElement(ae);}ae.setAttributes(E);ae.removeAttributes(F);if(af==ag||G.type=='email'&&ag.indexOf('@')!=-1)ae.setHtml(G.type=='email'?G.email.address:E['data-cke-saved-href']);if(ae.getAttribute('name'))ae.addClass('cke_anchor');else ae.removeClass('cke_anchor');if(this.fakeObj)I.createFakeElement(ae,'cke_anchor','anchor').replace(this.fakeObj);delete this._.selectedElement;}},onLoad:function(){if(!a.config.linkShowAdvancedTab)this.hidePage('advanced');if(!a.config.linkShowTargetTab)this.hidePage('target');},onFocus:function(){var E=this.getContentElement('info','linkType'),F;if(E&&E.getValue()=='url'){F=this.getContentElement('info','url');F.select();}}};});
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/pastetext/dialogs/pastetext.js b/appsrc/ODS-Framework/ckeditor/plugins/pastetext/dialogs/pastetext.js
index 9cb25ea..0d8f165 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/pastetext/dialogs/pastetext.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/pastetext/dialogs/pastetext.js
@@ -1,6 +1,6 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-(function(){CKEDITOR.dialog.add('pastetext',function(a){return{title:a.lang.pasteText.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?368:350,minHeight:240,onShow:function(){this.getContentElement('general','content').getInputElement().setValue('');},onOk:function(){var b=this.getContentElement('general','content').getInputElement().getValue(),c=this.getParentEditor();setTimeout(function(){c.fire('paste',{text:b});},0);},contents:[{label:a.lang.common.generalTab,id:'general',elements:[{type:'html',id:'pasteMsg',html:'<div style="white-space:normal;width:340px;">'+a.lang.clipboard.pasteMsg+'</div>'},{type:'html',id:'content',style:'width:340px;height:170px',html:'<textarea style="width:346px;height:170px;resize: none;direction:'+a.config.contentsLangDirection+';'+'border:1px solid black;'+'background-color:white">'+'</textarea>',onLoad:function(){var b=this.getDialog().getContentElement('general','pasteMsg').getElement(),c=this.getElement();c.setAttribute('aria-labelledby',b.$.id);},focus:function(){this.getElement().focus();}}]}]};});})();
+(function(){CKEDITOR.dialog.add('pastetext',function(a){return{title:a.lang.pasteText.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?368:350,minHeight:240,onShow:function(){this.getContentElement('general','content').getInputElement().setValue('');},onOk:function(){var b=this.getContentElement('general','content').getInputElement().getValue(),c=this.getParentEditor();setTimeout(function(){c.fire('paste',{text:b});},0);},contents:[{label:a.lang.common.generalTab,id:'general',elements:[{type:'html',id:'pasteMsg',html:'<div style="white-space:normal;width:340px;">'+a.lang.clipboard.pasteMsg+'</div>'},{type:'textarea',id:'content',className:'cke_pastetext',onLoad:function(){var b=this.getDialog().getContentElement('general','pasteMsg').getElement(),c=this.getElement().getElementsByTag('textarea').getItem(0);c.setAttribute('aria-labelledby',b.$.id);c.setStyle('direction',a.config.contentsLangDirection);},focus:function(){this.getElement().focus();}}]}]};});})();
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/scayt/dialogs/options.js b/appsrc/ODS-Framework/ckeditor/plugins/scayt/dialogs/options.js
index 37297f2..3f9aa41 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/scayt/dialogs/options.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/scayt/dialogs/options.js
@@ -1,8 +1,8 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.dialog.add('scaytcheck',function(a){var b=true,c,d=CKEDITOR.document,e=[],f,g=[],h=false,i=['dic_create,dic_restore','dic_rename,dic_delete'],j=['mixedCase','mixedWithDigits','allCaps','ignoreDomainNames'];function k(){return document.forms.optionsbar.options;};function l(){return document.forms.languagesbar.scayt_lang;};function m(x,y){if(!x)return;var z=x.length;if(z==undefined){x.checked=x.value==y.toString();return;}for(var A=0;A<z;A++){x[A].checked=false;if(x[A].value==y.toString())x[A].checked=true;}};var n=[{id:'options',label:a.lang.scayt.optionsTab,elements:[{type:'html',id:'options',html:'<form name="optionsbar"><div class="inner_options">\t<div class="messagebox"></div>\t<div style="display:none;">\t\t<input type="checkbox" name="options"  id="allCaps" />\t\t<label for="allCaps" id="label_allCaps"></label>\t</div>\t<div style="display:none;">\t\t<input name="options" type="checkbox"  id="ignoreDomainNames" />\t\t<label for="ignoreDomainNames" id="label_ignoreDomainNames"></label>\t</div>\t<div style="display:none;">\t<input name="options" type="checkbox"  id="mixedCase" />\t\t<label for="mixedCase" id="label_mixedCase"></label>\t</div>\t<div style="display:none;">\t\t<input name="options" type="checkbox"  id="mixedWithDigits" />\t\t<label for="mixedWithDigits" id="label_mixedWithDigits"></label>\t</div></div></form>'}]},{id:'langs',label:a.lang.scayt.languagesTab,elements:[{type:'html',id:'langs',html:'<form name="languagesbar"><div class="inner_langs">\t<div class="messagebox"></div>\t   <div style="float:left;width:45%;margin-left:5px;" id="scayt_lcol" ></div>   <div style="float:left;width:45%;margin-left:15px;" id="scayt_rcol"></div></div></form>'}]},{id:'dictionaries',label:a.lang.scayt.dictionariesTab,elements:[{type:'html',style:'',id:'dictionaries',html:'<form name="dictionarybar"><div class="inner_dictionary" style="text-align:left; white-space:normal; width:320px; overflow: hidden;">\t<div style="margin:5px auto; width:80%;white-space:normal; overflow:hidden;" id="dic_message"> </div>\t<div style="margin:5px auto; width:80%;white-space:normal;">        <span class="cke_dialog_ui_labeled_label" >Dictionary name</span><br>\t\t<span class="cke_dialog_ui_labeled_content" >\t\t\t<div class="cke_dialog_ui_input_text">\t\t\t\t<input id="dic_name" type="text" class="cke_dialog_ui_input_text"/>\t\t</div></span></div>\t\t<div style="margin:5px auto; width:80%;white-space:normal;">\t\t\t<a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_create">\t\t\t\t</a>\t\t\t<a  style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_delete">\t\t\t\t</a>\t\t\t<a  style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_rename">\t\t\t\t</a>\t\t\t<a  style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_restore">\t\t\t\t</a>\t\t</div>\t<div style="margin:5px auto; width:95%;white-space:normal;" id="dic_info"></div></div></form>'}]},{id:'about',label:a.lang.scayt.aboutTab,elements:[{type:'html',id:'about',style:'margin: 5px 5px;',html:'<div id="scayt_about"></div>'}]}],o={title:a.lang.scayt.title,minWidth:360,minHeight:220,onShow:function(){var x=this;
-x.data=a.fire('scaytDialog',{});x.options=x.data.scayt_control.option();x.sLang=x.data.scayt_control.sLang;if(!x.data||!x.data.scayt||!x.data.scayt_control){alert('Error loading application service');x.hide();return;}var y=0;if(b)x.data.scayt.getCaption(a.langCode||'en',function(z){if(y++>0)return;c=z;q.apply(x);r.apply(x);b=false;});else r.apply(x);x.selectPage(x.data.tab);},onOk:function(){var x=this.data.scayt_control;x.option(this.options);var y=this.chosed_lang;x.setLang(y);x.refresh();},onCancel:function(){var x=k();for(f in x)x[f].checked=false;m(l(),'');},contents:g},p=CKEDITOR.plugins.scayt.getScayt(a);e=CKEDITOR.plugins.scayt.uiTabs;for(f in e){if(e[f]==1)g[g.length]=n[f];}if(e[2]==1)h=true;var q=function(){var x=this,y=x.data.scayt.getLangList(),z=['dic_create','dic_delete','dic_rename','dic_restore'],A=j,B;if(h){for(B=0;B<z.length;B++){var C=z[B];d.getById(C).setHtml('<span class="cke_dialog_ui_button">'+c['button_'+C]+'</span>');}d.getById('dic_info').setHtml(c.dic_info);}if(e[0]==1)for(B in A){var D='label_'+A[B],E=d.getById(D);if('undefined'!=typeof E&&'undefined'!=typeof c[D]&&'undefined'!=typeof x.options[A[B]]){E.setHtml(c[D]);var F=E.getParent();F.$.style.display='block';}}var G='<p><img src="'+window.scayt.getAboutInfo().logoURL+'" /></p>'+'<p>'+c.version+window.scayt.getAboutInfo().version.toString()+'</p>'+'<p>'+c.about_throwt_copy+'</p>';d.getById('scayt_about').setHtml(G);var H=function(R,S){var T=d.createElement('label');T.setAttribute('for','cke_option'+R);T.setHtml(S[R]);if(x.sLang==R)x.chosed_lang=R;var U=d.createElement('div'),V=CKEDITOR.dom.element.createFromHtml('<input id="cke_option'+R+'" type="radio" '+(x.sLang==R?'checked="checked"':'')+' value="'+R+'" name="scayt_lang" />');V.on('click',function(){this.$.checked=true;x.chosed_lang=R;});U.append(V);U.append(T);return{lang:S[R],code:R,radio:U};},I=[];if(e[1]==1){for(B in y.rtl)I[I.length]=H(B,y.ltr);for(B in y.ltr)I[I.length]=H(B,y.ltr);I.sort(function(R,S){return S.lang>R.lang?-1:1;});var J=d.getById('scayt_lcol'),K=d.getById('scayt_rcol');for(B=0;B<I.length;B++){var L=B<I.length/2?J:K;L.append(I[B].radio);}}var M={};M.dic_create=function(R,S,T){var U=T[0]+','+T[1],V=c.err_dic_create,W=c.succ_dic_create;window.scayt.createUserDictionary(S,function(X){v(U);u(T[1]);W=W.replace('%s',X.dname);t(W);},function(X){V=V.replace('%s',X.dname);s(V+'( '+(X.message||'')+')');});};M.dic_rename=function(R,S){var T=c.err_dic_rename||'',U=c.succ_dic_rename||'';window.scayt.renameUserDictionary(S,function(V){U=U.replace('%s',V.dname);
-w(S);t(U);},function(V){T=T.replace('%s',V.dname);w(S);s(T+'( '+(V.message||'')+' )');});};M.dic_delete=function(R,S,T){var U=T[0]+','+T[1],V=c.err_dic_delete,W=c.succ_dic_delete;window.scayt.deleteUserDictionary(function(X){W=W.replace('%s',X.dname);v(U);u(T[0]);w('');t(W);},function(X){V=V.replace('%s',X.dname);s(V);});};M.dic_restore=x.dic_restore||(function(R,S,T){var U=T[0]+','+T[1],V=c.err_dic_restore,W=c.succ_dic_restore;window.scayt.restoreUserDictionary(S,function(X){W=W.replace('%s',X.dname);v(U);u(T[1]);t(W);},function(X){V=V.replace('%s',X.dname);s(V);});});function N(R){var S=d.getById('dic_name').getValue();if(!S){s(' Dictionary name should not be empty. ');return false;}try{var T=id=R.data.getTarget().getParent(),U=T.getId();M[U].apply(null,[T,S,i]);}catch(V){s(' Dictionary error. ');}return true;};var O=(i[0]+','+i[1]).split(','),P;for(B=0,P=O.length;B<P;B+=1){var Q=d.getById(O[B]);if(Q)Q.on('click',N,this);}},r=function(){var x=this;if(e[0]==1){var y=k();for(var z=0,A=y.length;z<A;z++){var B=y[z].id,C=d.getById(B);if(C){y[z].checked=false;if(x.options[B]==1)y[z].checked=true;if(b)C.on('click',function(){x.options[this.getId()]=this.$.checked?1:0;});}}}if(e[1]==1){var D=d.getById('cke_option'+x.sLang);m(D.$,x.sLang);}if(h){window.scayt.getNameUserDictionary(function(E){var F=E.dname;v(i[0]+','+i[1]);if(F){d.getById('dic_name').setValue(F);u(i[1]);}else u(i[0]);},function(){d.getById('dic_name').setValue('');});t('');}};function s(x){d.getById('dic_message').setHtml('<span style="color:red;">'+x+'</span>');};function t(x){d.getById('dic_message').setHtml('<span style="color:blue;">'+x+'</span>');};function u(x){x=String(x);var y=x.split(',');for(var z=0,A=y.length;z<A;z+=1)d.getById(y[z]).$.style.display='inline';};function v(x){x=String(x);var y=x.split(',');for(var z=0,A=y.length;z<A;z+=1)d.getById(y[z]).$.style.display='none';};function w(x){d.getById('dic_name').$.value=x;};return o;});
+CKEDITOR.dialog.add('scaytcheck',function(a){var b=true,c,d=CKEDITOR.document,e=[],f,g=[],h=0,i=['dic_create,dic_restore','dic_rename,dic_delete'],j=['mixedCase','mixedWithDigits','allCaps','ignoreDomainNames'];function k(){return document.forms.optionsbar.options;};function l(){return document.forms.languagesbar.scayt_lang;};function m(y,z){if(!y)return;var A=y.length;if(A==undefined){y.checked=y.value==z.toString();return;}for(var B=0;B<A;B++){y[B].checked=false;if(y[B].value==z.toString())y[B].checked=true;}};var n=a.lang.scayt,o=[{id:'options',label:n.optionsTab,elements:[{type:'html',id:'options',html:'<form name="optionsbar"><div class="inner_options">\t<div class="messagebox"></div>\t<div style="display:none;">\t\t<input type="checkbox" name="options"  id="allCaps" />\t\t<label for="allCaps" id="label_allCaps"></label>\t</div>\t<div style="display:none;">\t\t<input name="options" type="checkbox"  id="ignoreDomainNames" />\t\t<label for="ignoreDomainNames" id="label_ignoreDomainNames"></label>\t</div>\t<div style="display:none;">\t<input name="options" type="checkbox"  id="mixedCase" />\t\t<label for="mixedCase" id="label_mixedCase"></label>\t</div>\t<div style="display:none;">\t\t<input name="options" type="checkbox"  id="mixedWithDigits" />\t\t<label for="mixedWithDigits" id="label_mixedWithDigits"></label>\t</div></div></form>'}]},{id:'langs',label:n.languagesTab,elements:[{type:'html',id:'langs',html:'<form name="languagesbar"><div class="inner_langs">\t<div class="messagebox"></div>\t   <div style="float:left;width:45%;margin-left:5px;" id="scayt_lcol" ></div>   <div style="float:left;width:45%;margin-left:15px;" id="scayt_rcol"></div></div></form>'}]},{id:'dictionaries',label:n.dictionariesTab,elements:[{type:'html',style:'',id:'dictionaries',html:'<form name="dictionarybar"><div class="inner_dictionary" style="text-align:left; white-space:normal; width:320px; overflow: hidden;">\t<div style="margin:5px auto; width:80%;white-space:normal; overflow:hidden;" id="dic_message"> </div>\t<div style="margin:5px auto; width:80%;white-space:normal;">        <span class="cke_dialog_ui_labeled_label" >Dictionary name</span><br>\t\t<span class="cke_dialog_ui_labeled_content" >\t\t\t<div class="cke_dialog_ui_input_text">\t\t\t\t<input id="dic_name" type="text" class="cke_dialog_ui_input_text"/>\t\t</div></span></div>\t\t<div style="margin:5px auto; width:80%;white-space:normal;">\t\t\t<a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_create">\t\t\t\t</a>\t\t\t<a  style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_delete">\t\t\t\t</a>\t\t\t<a  style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_rename">\t\t\t\t</a>\t\t\t<a  style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_restore">\t\t\t\t</a>\t\t</div>\t<div style="margin:5px auto; width:95%;white-space:normal;" id="dic_info"></div></div></form>'}]},{id:'about',label:n.aboutTab,elements:[{type:'html',id:'about',style:'margin: 5px 5px;',html:'<div id="scayt_about"></div>'}]}],p={title:n.title,minWidth:360,minHeight:220,onShow:function(){var y=this;
+y.data=a.fire('scaytDialog',{});y.options=y.data.scayt_control.option();y.sLang=y.data.scayt_control.sLang;if(!y.data||!y.data.scayt||!y.data.scayt_control){alert('Error loading application service');y.hide();return;}var z=0;if(b)y.data.scayt.getCaption(a.langCode||'en',function(A){if(z++>0)return;c=A;r.apply(y);s.apply(y);b=false;});else s.apply(y);y.selectPage(y.data.tab);},onOk:function(){var y=this.data.scayt_control;y.option(this.options);var z=this.chosed_lang;y.setLang(z);y.refresh();},onCancel:function(){var y=k();for(var z in y)y[z].checked=false;m(l(),'');},contents:g},q=CKEDITOR.plugins.scayt.getScayt(a);e=CKEDITOR.plugins.scayt.uiTabs;for(f in e){if(e[f]==1)g[g.length]=o[f];}if(e[2]==1)h=1;var r=function(){var y=this,z=y.data.scayt.getLangList(),A=['dic_create','dic_delete','dic_rename','dic_restore'],B=j,C;if(h){for(C=0;C<A.length;C++){var D=A[C];d.getById(D).setHtml('<span class="cke_dialog_ui_button">'+c['button_'+D]+'</span>');}d.getById('dic_info').setHtml(c.dic_info);}if(e[0]==1)for(C in B){var E='label_'+B[C],F=d.getById(E);if('undefined'!=typeof F&&'undefined'!=typeof c[E]&&'undefined'!=typeof y.options[B[C]]){F.setHtml(c[E]);var G=F.getParent();G.$.style.display='block';}}var H='<p><img src="'+window.scayt.getAboutInfo().logoURL+'" /></p>'+'<p>'+c.version+window.scayt.getAboutInfo().version.toString()+'</p>'+'<p>'+c.about_throwt_copy+'</p>';d.getById('scayt_about').setHtml(H);var I=function(S,T){var U=d.createElement('label');U.setAttribute('for','cke_option'+S);U.setHtml(T[S]);if(y.sLang==S)y.chosed_lang=S;var V=d.createElement('div'),W=CKEDITOR.dom.element.createFromHtml('<input id="cke_option'+S+'" type="radio" '+(y.sLang==S?'checked="checked"':'')+' value="'+S+'" name="scayt_lang" />');W.on('click',function(){this.$.checked=true;y.chosed_lang=S;});V.append(W);V.append(U);return{lang:T[S],code:S,radio:V};},J=[];if(e[1]==1){for(C in z.rtl)J[J.length]=I(C,z.ltr);for(C in z.ltr)J[J.length]=I(C,z.ltr);J.sort(function(S,T){return T.lang>S.lang?-1:1;});var K=d.getById('scayt_lcol'),L=d.getById('scayt_rcol');for(C=0;C<J.length;C++){var M=C<J.length/2?K:L;M.append(J[C].radio);}}var N={};N.dic_create=function(S,T,U){var V=U[0]+','+U[1],W=c.err_dic_create,X=c.succ_dic_create;window.scayt.createUserDictionary(T,function(Y){w(V);v(U[1]);X=X.replace('%s',Y.dname);u(X);},function(Y){W=W.replace('%s',Y.dname);t(W+'( '+(Y.message||'')+')');});};N.dic_rename=function(S,T){var U=c.err_dic_rename||'',V=c.succ_dic_rename||'';window.scayt.renameUserDictionary(T,function(W){V=V.replace('%s',W.dname);
+x(T);u(V);},function(W){U=U.replace('%s',W.dname);x(T);t(U+'( '+(W.message||'')+' )');});};N.dic_delete=function(S,T,U){var V=U[0]+','+U[1],W=c.err_dic_delete,X=c.succ_dic_delete;window.scayt.deleteUserDictionary(function(Y){X=X.replace('%s',Y.dname);w(V);v(U[0]);x('');u(X);},function(Y){W=W.replace('%s',Y.dname);t(W);});};N.dic_restore=y.dic_restore||(function(S,T,U){var V=U[0]+','+U[1],W=c.err_dic_restore,X=c.succ_dic_restore;window.scayt.restoreUserDictionary(T,function(Y){X=X.replace('%s',Y.dname);w(V);v(U[1]);u(X);},function(Y){W=W.replace('%s',Y.dname);t(W);});});function O(S){var T=d.getById('dic_name').getValue();if(!T){t(' Dictionary name should not be empty. ');return false;}try{var U=id=S.data.getTarget().getParent(),V=U.getId();N[V].apply(null,[U,T,i]);}catch(W){t(' Dictionary error. ');}return true;};var P=(i[0]+','+i[1]).split(','),Q;for(C=0,Q=P.length;C<Q;C+=1){var R=d.getById(P[C]);if(R)R.on('click',O,this);}},s=function(){var y=this;if(e[0]==1){var z=k();for(var A=0,B=z.length;A<B;A++){var C=z[A].id,D=d.getById(C);if(D){z[A].checked=false;if(y.options[C]==1)z[A].checked=true;if(b)D.on('click',function(){y.options[this.getId()]=this.$.checked?1:0;});}}}if(e[1]==1){var E=d.getById('cke_option'+y.sLang);m(E.$,y.sLang);}if(h){window.scayt.getNameUserDictionary(function(F){var G=F.dname;w(i[0]+','+i[1]);if(G){d.getById('dic_name').setValue(G);v(i[1]);}else v(i[0]);},function(){d.getById('dic_name').setValue('');});u('');}};function t(y){d.getById('dic_message').setHtml('<span style="color:red;">'+y+'</span>');};function u(y){d.getById('dic_message').setHtml('<span style="color:blue;">'+y+'</span>');};function v(y){y=String(y);var z=y.split(',');for(var A=0,B=z.length;A<B;A+=1)d.getById(z[A]).$.style.display='inline';};function w(y){y=String(y);var z=y.split(',');for(var A=0,B=z.length;A<B;A+=1)d.getById(z[A]).$.style.display='none';};function x(y){d.getById('dic_name').$.value=y;};return p;});
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/scayt/dialogs/toolbar.css b/appsrc/ODS-Framework/ckeditor/plugins/scayt/dialogs/toolbar.css
index cbfa844..ae37086 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/scayt/dialogs/toolbar.css
+++ b/appsrc/ODS-Framework/ckeditor/plugins/scayt/dialogs/toolbar.css
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_address.png b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_address.png
index 8bbae6e..1ee67aa 100644
Binary files a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_address.png and b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_address.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_blockquote.png b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_blockquote.png
index cf065ba..cae3aec 100644
Binary files a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_blockquote.png and b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_blockquote.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_div.png b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_div.png
index a2806b1..c71f397 100644
Binary files a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_div.png and b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_div.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h1.png b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h1.png
index d43fbdb..3a64347 100644
Binary files a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h1.png and b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h1.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h2.png b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h2.png
index 27b5475..8062ebe 100644
Binary files a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h2.png and b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h2.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h3.png b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h3.png
index 3c3034f..5b6a403 100644
Binary files a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h3.png and b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h3.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h4.png b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h4.png
index ab3f64d..6c7f795 100644
Binary files a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h4.png and b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h4.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h5.png b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h5.png
index 93477d0..e153de0 100644
Binary files a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h5.png and b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h5.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h6.png b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h6.png
index 11ea1c2..c8d993a 100644
Binary files a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h6.png and b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_h6.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_p.png b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_p.png
index d055c51..4e6035d 100644
Binary files a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_p.png and b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_p.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_pre.png b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_pre.png
index be8ad26..d11a0ff 100644
Binary files a/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_pre.png and b/appsrc/ODS-Framework/ckeditor/plugins/showblocks/images/block_pre.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/smiley/dialogs/smiley.js b/appsrc/ODS-Framework/ckeditor/plugins/smiley/dialogs/smiley.js
index 9dd92ab..194f258 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/smiley/dialogs/smiley.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/smiley/dialogs/smiley.js
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.dialog.add('smiley',function(a){var b=a.config,c=a.lang.smiley,d=b.smiley_images,e=8,f,g,h=function(o){var p=o.data.getTarget(),q=p.getName();if(q=='td')p=p.getChild([0,0]);else if(q=='a')p=p.getChild(0);else if(q!='img')return;var r=p.getAttribute('cke_src'),s=p.getAttribute('title'),t=a.document.createElement('img',{attributes:{src:r,_cke_saved_src:r,title:s,alt:s}});a.insertElement(t);g.hide();o.data.preventDefault();},i=CKEDITOR.tools.addFunction(function(o,p){o=new CKEDITOR.dom.event(o);p=new CKEDITOR.dom.element(p);var q,r,s=o.getKeystroke(),t=a.lang.dir=='rtl';switch(s){case 38:if(q=p.getParent().getParent().getPrevious()){r=q.getChild([p.getParent().getIndex(),0]);r.focus();}o.preventDefault();break;case 40:if(q=p.getParent().getParent().getNext()){r=q.getChild([p.getParent().getIndex(),0]);if(r)r.focus();}o.preventDefault();break;case 32:h({data:o});o.preventDefault();break;case t?37:39:case 9:if(q=p.getParent().getNext()){r=q.getChild(0);r.focus();o.preventDefault(true);}else if(q=p.getParent().getParent().getNext()){r=q.getChild([0,0]);if(r)r.focus();o.preventDefault(true);}break;case t?39:37:case CKEDITOR.SHIFT+9:if(q=p.getParent().getPrevious()){r=q.getChild(0);r.focus();o.preventDefault(true);}else if(q=p.getParent().getParent().getPrevious()){r=q.getLast().getChild(0);r.focus();o.preventDefault(true);}break;default:return;}}),j='smiley_emtions_label'+CKEDITOR.tools.getNextNumber(),k=['<div><span id="'+j+'" class="cke_voice_label">'+c.options+'</span>','<table role="listbox" aria-labelledby="'+j+'" style="width:100%;height:100%" cellspacing="2" cellpadding="2"',CKEDITOR.env.ie&&CKEDITOR.env.quirks?' style="position:absolute;"':'','><tbody>'],l=d.length;for(f=0;f<l;f++){if(f%e===0)k.push('<tr>');var m='cke_smile_label_'+f+'_'+CKEDITOR.tools.getNextNumber();k.push('<td class="cke_dark_background cke_hand cke_centered" style="vertical-align: middle;"><a href="javascript:void(0)" role="option"',' aria-posinset="'+(f+1)+'"',' aria-setsize="'+l+'"',' aria-labelledby="'+m+'"',' class="cke_smile" tabindex="-1" onkeydown="CKEDITOR.tools.callFunction( ',i,', event, this );">','<img class="hand" title="',b.smiley_descriptions[f],'" cke_src="',CKEDITOR.tools.htmlEncode(b.smiley_path+d[f]),'" alt="',b.smiley_descriptions[f],'"',' src="',CKEDITOR.tools.htmlEncode(b.smiley_path+d[f]),'"',CKEDITOR.env.ie?" onload=\"this.setAttribute('width', 2); this.removeAttribute('width');\" ":'','><span id="'+m+'" class="cke_voice_label">'+b.smiley_descriptions[f]+'</span>'+'</a>','</td>');
-if(f%e==e-1)k.push('</tr>');}if(f<e-1){for(;f<e-1;f++)k.push('<td></td>');k.push('</tr>');}k.push('</tbody></table></div>');var n={type:'html',html:k.join(''),onLoad:function(o){g=o.sender;},focus:function(){var o=this.getElement().getElementsByTag('a').getItem(0);o.focus();},onClick:h,style:'width: 100%; border-collapse: separate;'};return{title:a.lang.smiley.title,minWidth:270,minHeight:120,contents:[{id:'tab1',label:'',title:'',expand:true,padding:0,elements:[n]}],buttons:[CKEDITOR.dialog.cancelButton]};});
+CKEDITOR.dialog.add('smiley',function(a){var b=a.config,c=a.lang.smiley,d=b.smiley_images,e=b.smiley_columns||8,f,g,h=function(o){var p=o.data.getTarget(),q=p.getName();if(q=='a')p=p.getChild(0);else if(q!='img')return;var r=p.getAttribute('cke_src'),s=p.getAttribute('title'),t=a.document.createElement('img',{attributes:{src:r,'data-cke-saved-src':r,title:s,alt:s,width:p.$.width,height:p.$.height}});a.insertElement(t);g.hide();o.data.preventDefault();},i=CKEDITOR.tools.addFunction(function(o,p){o=new CKEDITOR.dom.event(o);p=new CKEDITOR.dom.element(p);var q,r,s=o.getKeystroke(),t=a.lang.dir=='rtl';switch(s){case 38:if(q=p.getParent().getParent().getPrevious()){r=q.getChild([p.getParent().getIndex(),0]);r.focus();}o.preventDefault();break;case 40:if(q=p.getParent().getParent().getNext()){r=q.getChild([p.getParent().getIndex(),0]);if(r)r.focus();}o.preventDefault();break;case 32:h({data:o});o.preventDefault();break;case t?37:39:case 9:if(q=p.getParent().getNext()){r=q.getChild(0);r.focus();o.preventDefault(true);}else if(q=p.getParent().getParent().getNext()){r=q.getChild([0,0]);if(r)r.focus();o.preventDefault(true);}break;case t?39:37:case CKEDITOR.SHIFT+9:if(q=p.getParent().getPrevious()){r=q.getChild(0);r.focus();o.preventDefault(true);}else if(q=p.getParent().getParent().getPrevious()){r=q.getLast().getChild(0);r.focus();o.preventDefault(true);}break;default:return;}}),j=CKEDITOR.tools.getNextId()+'_smiley_emtions_label',k=['<div><span id="'+j+'" class="cke_voice_label">'+c.options+'</span>','<table role="listbox" aria-labelledby="'+j+'" style="width:100%;height:100%" cellspacing="2" cellpadding="2"',CKEDITOR.env.ie&&CKEDITOR.env.quirks?' style="position:absolute;"':'','><tbody>'],l=d.length;for(f=0;f<l;f++){if(f%e===0)k.push('<tr>');var m='cke_smile_label_'+f+'_'+CKEDITOR.tools.getNextNumber();k.push('<td class="cke_dark_background cke_centered" style="vertical-align: middle;"><a href="javascript:void(0)" role="option"',' aria-posinset="'+(f+1)+'"',' aria-setsize="'+l+'"',' aria-labelledby="'+m+'"',' class="cke_smile cke_hand" tabindex="-1" onkeydown="CKEDITOR.tools.callFunction( ',i,', event, this );">','<img class="cke_hand" title="',b.smiley_descriptions[f],'" cke_src="',CKEDITOR.tools.htmlEncode(b.smiley_path+d[f]),'" alt="',b.smiley_descriptions[f],'"',' src="',CKEDITOR.tools.htmlEncode(b.smiley_path+d[f]),'"',CKEDITOR.env.ie?" onload=\"this.setAttribute('width', 2); this.removeAttribute('width');\" ":'','><span id="'+m+'" class="cke_voice_label">'+b.smiley_descriptions[f]+'</span>'+'</a>','</td>');
+if(f%e==e-1)k.push('</tr>');}if(f<e-1){for(;f<e-1;f++)k.push('<td></td>');k.push('</tr>');}k.push('</tbody></table></div>');var n={type:'html',html:k.join(''),onLoad:function(o){g=o.sender;},focus:function(){var o=this;setTimeout(function(){var p=o.getElement().getElementsByTag('a').getItem(0);p.focus();},0);},onClick:h,style:'width: 100%; border-collapse: separate;'};return{title:a.lang.smiley.title,minWidth:270,minHeight:120,contents:[{id:'tab1',label:'',title:'',expand:true,padding:0,elements:[n]}],buttons:[CKEDITOR.dialog.cancelButton]};});
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/specialchar/dialogs/specialchar.js b/appsrc/ODS-Framework/ckeditor/plugins/specialchar/dialogs/specialchar.js
index f2087c0..bf6988d 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/specialchar/dialogs/specialchar.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/specialchar/dialogs/specialchar.js
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.dialog.add('specialchar',function(a){var b,c=a.lang.specialChar,d=function(k){var l=a.getSelection(),m=l.getRanges(),n,o;a.fire('saveSnapshot');for(var p=0,q=m.length;p<q;p++){n=m[p];n.deleteContents();o=CKEDITOR.dom.element.createFromHtml(k);n.insertNode(o);}n.moveToPosition(o,CKEDITOR.POSITION_AFTER_END);n.select();a.fire('saveSnapshot');},e=function(k){var l,m;if(k.data)l=k.data.getTarget();else l=new CKEDITOR.dom.element(k);if(l.getName()=='a'&&(m=l.getChild(0).getHtml())){l.removeClass('cke_light_background');b.hide();if(CKEDITOR.env.gecko)d(m);else a.insertHtml(m);}},f=CKEDITOR.tools.addFunction(e),g,h=function(k,l){var m;l=l||k.data.getTarget();if(l.getName()=='span')l=l.getParent();if(l.getName()=='a'&&(m=l.getChild(0).getHtml())){if(g)i(null,g);var n=b.getContentElement('info','htmlPreview').getElement();b.getContentElement('info','charPreview').getElement().setHtml(m);n.setHtml(CKEDITOR.tools.htmlEncode(m));l.getParent().addClass('cke_light_background');g=l;}},i=function(k,l){l=l||k.data.getTarget();if(l.getName()=='span')l=l.getParent();if(l.getName()=='a'){b.getContentElement('info','charPreview').getElement().setHtml(' ');b.getContentElement('info','htmlPreview').getElement().setHtml(' ');l.getParent().removeClass('cke_light_background');g=undefined;}},j=CKEDITOR.tools.addFunction(function(k){k=new CKEDITOR.dom.event(k);var l=k.getTarget(),m,n,o=k.getKeystroke(),p=a.lang.dir=='rtl';switch(o){case 38:if(m=l.getParent().getParent().getPrevious()){n=m.getChild([l.getParent().getIndex(),0]);n.focus();i(null,l);h(null,n);}k.preventDefault();break;case 40:if(m=l.getParent().getParent().getNext()){n=m.getChild([l.getParent().getIndex(),0]);if(n&&n.type==1){n.focus();i(null,l);h(null,n);}}k.preventDefault();break;case 32:e({data:k});k.preventDefault();break;case p?37:39:case 9:if(m=l.getParent().getNext()){n=m.getChild(0);if(n.type==1){n.focus();i(null,l);h(null,n);k.preventDefault(true);}else i(null,l);}else if(m=l.getParent().getParent().getNext()){n=m.getChild([0,0]);if(n&&n.type==1){n.focus();i(null,l);h(null,n);k.preventDefault(true);}else i(null,l);}break;case p?39:37:case CKEDITOR.SHIFT+9:if(m=l.getParent().getPrevious()){n=m.getChild(0);n.focus();i(null,l);h(null,n);k.preventDefault(true);}else if(m=l.getParent().getParent().getPrevious()){n=m.getLast().getChild(0);n.focus();i(null,l);h(null,n);k.preventDefault(true);}else i(null,l);break;default:return;}});return{title:c.title,minWidth:430,minHeight:280,buttons:[CKEDITOR.dialog.cancelButton],charColumns:17,chars:['!','"','#','$','%','&',"'",'(',')','*','+','-','.','/','0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?','@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[',']','^','_','`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','{','|','}','~','€(EURO SIGN)','‘(LEFT SINGLE QUOTATION MARK)','’(RIGHT SINGLE QUOTATION MARK)','“(LEFT DOUBLE QUOTATION MARK)','”(RIGHT DOUBLE QUOTATION MARK)','–(EN DASH)','—(EM DASH)','¡(INVERTED EXCLAMATION MARK)','¢(CENT SIGN)','£(POUND SIGN)','¤(CURRENCY SIGN)','¥(YEN SIGN)','¦(BROKEN BAR)','§(SECTION SIGN)','¨(DIAERESIS)','©(COPYRIGHT SIGN)','ª(FEMININE ORDINAL INDICATOR)','«(LEFT-POINTING DOUBLE ANGLE QUOTATION MARK)','¬(NOT SIGN)','®(REGISTERED SIGN)','¯(MACRON)','°(DEGREE SIGN)','±(PLUS-MINUS SIGN)','&sup2;(SUPERSCRIPT TWO)','&sup3;(SUPERSCRIPT THREE)','´(ACUTE ACCENT)','µ(MICRO SIGN)','¶(PILCROW SIGN)','·(MIDDLE DOT)','¸(CEDILLA)','&sup1;(SUPERSCRIPT ONE)','º(MASCULINE ORDINAL INDICATOR)','»(RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK)','&frac14;(VULGAR FRACTION ONE QUARTER)','&frac12;(VULGAR FRACTION ONE HALF)','&frac34;(VULGAR FRACTION THREE QUARTERS)','¿(INVERTED QUESTION MARK)','À(LATIN CAPITAL LETTER A WITH GRAVE)','Á(LATIN CAPITAL LETTER A WITH ACUTE)','Â(LATIN CAPITAL LETTER A WITH CIRCUMFLEX)','Ã(LATIN CAPITAL LETTER A WITH TILDE)','Ä(LATIN CAPITAL LETTER A WITH DIAERESIS)','Å(LATIN CAPITAL LETTER A WITH RING ABOVE)','Æ(LATIN CAPITAL LETTER AE)','Ç(LATIN CAPITAL LETTER C WITH CEDILLA)','È(LATIN CAPITAL LETTER E WITH GRAVE)','É(LATIN CAPITAL LETTER E WITH ACUTE)','Ê(LATIN CAPITAL LETTER E WITH CIRCUMFLEX)','Ë(LATIN CAPITAL LETTER E WITH DIAERESIS)','Ì(LATIN CAPITAL LETTER I WITH GRAVE)','Í(LATIN CAPITAL LETTER I WITH ACUTE)','Î(LATIN CAPITAL LETTER I WITH CIRCUMFLEX)','Ï(LATIN CAPITAL LETTER I WITH DIAERESIS)','Ð(LATIN CAPITAL LETTER ETH)','Ñ(LATIN CAPITAL LETTER N WITH TILDE)','Ò(LATIN CAPITAL LETTER O WITH GRAVE)','Ó(LATIN CAPITAL LETTER O WITH ACUTE)','Ô(LATIN CAPITAL LETTER O WITH CIRCUMFLEX)','Õ(LATIN CAPITAL LETTER O WITH TILDE)','Ö(LATIN CAPITAL LETTER O WITH DIAERESIS)','×(MULTIPLICATION SIGN)','Ø(LATIN CAPITAL LETTER O WITH STROKE)','Ù(LATIN CAPITAL LETTER U WITH GRAVE)','Ú(LATIN CAPITAL LETTER U WITH ACUTE)','Û(LATIN CAPITAL LETTER U WITH CIRCUMFLEX)','Ü(LATIN CAPITAL LETTER U WITH DIAERESIS)','Ý(LATIN CAPITAL LETTER Y WITH ACUTE)','Þ(LATIN CAPITAL LETTER THORN)','ß(LATIN SMALL LETTER SHARP S)','à(LATIN SMALL LETTER A WITH GRAVE)','á(LATIN SMALL LETTER A WITH ACUTE)','â(LATIN SMALL LETTER A WITH CIRCUMFLEX)','ã(LATIN SMALL LETTER A WITH TILDE)','ä(LATIN SMALL LETTER A WITH DIAERESIS)','å(LATIN SMALL LETTER A WITH RING ABOVE)','æ(LATIN SMALL LETTER AE)','ç(LATIN SMALL LETTER C WITH CEDILLA)','è(LATIN SMALL LETTER E WITH GRAVE)','é(LATIN SMALL LETTER E WITH ACUTE)','ê(LATIN SMALL LETTER E WITH CIRCUMFLEX)','ë(LATIN SMALL LETTER E WITH DIAERESIS)','ì(LATIN SMALL LETTER I WITH GRAVE)','í(LATIN SMALL LETTER I WITH ACUTE)','î(LATIN SMALL LETTER I WITH CIRCUMFLEX)','ï(LATIN SMALL LETTER I WITH DIAERESIS)','ð(LATIN SMALL LETTER ETH)','ñ(LATIN SMALL LETTER N WITH TILDE)','ò(LATIN SMALL LETTER O WITH GRAVE)','ó(LATIN SMALL LETTER O WITH ACUTE)','ô(LATIN SMALL LETTER O WITH CIRCUMFLEX)','õ(LATIN SMALL LETTER O WITH TILDE)','ö(LATIN SMALL LETTER O WITH DIAERESIS)','÷(DIVISION SIGN)','ø(LATIN SMALL LETTER O WITH STROKE)','ù(LATIN SMALL LETTER U WITH GRAVE)','ú(LATIN SMALL LETTER U WITH ACUTE)','û(LATIN SMALL LETTER U WITH CIRCUMFLEX)','ü(LATIN SMALL LETTER U WITH DIAERESIS)','ü(LATIN SMALL LETTER U WITH DIAERESIS)','ý(LATIN SMALL LETTER Y WITH ACUTE)','þ(LATIN SMALL LETTER THORN)','ÿ(LATIN SMALL LETTER Y WITH DIAERESIS)','Œ(LATIN CAPITAL LIGATURE OE)','œ(LATIN SMALL LIGATURE OE)','Ŵ(LATIN CAPITAL LETTER W WITH CIRCUMFLEX)','&#374(LATIN CAPITAL LETTER Y WITH CIRCUMFLEX)','&#373(LATIN SMALL LETTER W WITH CIRCUMFLEX)','ŷ(LATIN SMALL LETTER Y WITH CIRCUMFLEX)','‚(SINGLE LOW-9 QUOTATION MARK)','‛(SINGLE HIGH-REVERSED-9 QUOTATION MARK)','„(DOUBLE LOW-9 QUOTATION MARK)','…(HORIZONTAL ELLIPSIS)','™(TRADE MARK SIGN)','►(BLACK RIGHT-POINTING POINTER)','•(BULLET)','→(RIGHTWARDS ARROW)','⇒(RIGHTWARDS DOUBLE ARROW)','⇔(LEFT RIGHT DOUBLE ARROW)','♦(BLACK DIAMOND SUIT)','≈(ALMOST EQUAL TO)'],onLoad:function(){var k=this.definition.charColumns,l=this.definition.chars,m='specialchar_table_label'+CKEDITOR.tools.getNextNumber(),n=['<table role="listbox" aria-labelledby="'+m+'"'+' style="width: 320px; height: 100%; border-collapse: separate;"'+' align="center" cellspacing="2" cellpadding="2" border="0">'],o=0,p=l.length,q,r;
-while(o<p){n.push('<tr>');for(var s=0;s<k;s++,o++){if(q=l[o]){r='';q=q.replace(/\((.*?)\)/,function(u,v){r=v;return '';});r=r||q;var t='cke_specialchar_label_'+o+'_'+CKEDITOR.tools.getNextNumber();n.push('<td class="cke_dark_background" style="cursor: default" role="presentation"><a href="javascript: void(0);" role="option" aria-posinset="'+(o+1)+'"',' aria-setsize="'+p+'"',' aria-labelledby="'+t+'"',' style="cursor: inherit; display: block; height: 1.25em; margin-top: 0.25em; text-align: center;" title="',CKEDITOR.tools.htmlEncode(r),'" onkeydown="CKEDITOR.tools.callFunction( '+j+', event, this )"'+' onclick="CKEDITOR.tools.callFunction('+f+', this); return false;"'+' tabindex="-1">'+'<span style="margin: 0 auto;cursor: inherit">'+q+'</span>'+'<span class="cke_voice_label" id="'+t+'">'+r+'</span></a>');}else n.push('<td class="cke_dark_background"> ');n.push('</td>');}n.push('</tr>');}n.push('</tbody></table>','<span id="'+m+'" class="cke_voice_label">'+c.options+'</span>');this.getContentElement('info','charContainer').getElement().setHtml(n.join(''));},contents:[{id:'info',label:a.lang.common.generalTab,title:a.lang.common.generalTab,padding:0,align:'top',elements:[{type:'hbox',align:'top',widths:['320px','90px'],children:[{type:'html',id:'charContainer',html:'',onMouseover:h,onMouseout:i,focus:function(){var k=this.getElement().getElementsByTag('a').getItem(0);setTimeout(function(){k.focus();h(null,k);});},onShow:function(){var k=this.getElement().getChild([0,0,0,0,0]);setTimeout(function(){k.focus();h(null,k);});},onLoad:function(k){b=k.sender;}},{type:'hbox',align:'top',widths:['100%'],children:[{type:'vbox',align:'top',children:[{type:'html',html:'<div></div>'},{type:'html',id:'charPreview',className:'cke_dark_background',style:"border:1px solid #eeeeee;font-size:28px;height:40px;width:70px;padding-top:9px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;text-align:center;",html:'<div> </div>'},{type:'html',id:'htmlPreview',className:'cke_dark_background',style:"border:1px solid #eeeeee;font-size:14px;height:20px;width:70px;padding-top:2px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;text-align:center;",html:'<div> </div>'}]}]}]}]}]};});
+CKEDITOR.dialog.add('specialchar',function(a){var b,c=a.lang.specialChar,d=function(j){var k,l;if(j.data)k=j.data.getTarget();else k=new CKEDITOR.dom.element(j);if(k.getName()=='a'&&(l=k.getChild(0).getHtml())){k.removeClass('cke_light_background');b.hide();a.insertHtml(l);}},e=CKEDITOR.tools.addFunction(d),f,g=function(j,k){var l;k=k||j.data.getTarget();if(k.getName()=='span')k=k.getParent();if(k.getName()=='a'&&(l=k.getChild(0).getHtml())){if(f)h(null,f);var m=b.getContentElement('info','htmlPreview').getElement();b.getContentElement('info','charPreview').getElement().setHtml(l);m.setHtml(CKEDITOR.tools.htmlEncode(l));k.getParent().addClass('cke_light_background');f=k;}},h=function(j,k){k=k||j.data.getTarget();if(k.getName()=='span')k=k.getParent();if(k.getName()=='a'){b.getContentElement('info','charPreview').getElement().setHtml(' ');b.getContentElement('info','htmlPreview').getElement().setHtml(' ');k.getParent().removeClass('cke_light_background');f=undefined;}},i=CKEDITOR.tools.addFunction(function(j){j=new CKEDITOR.dom.event(j);var k=j.getTarget(),l,m,n=j.getKeystroke(),o=a.lang.dir=='rtl';switch(n){case 38:if(l=k.getParent().getParent().getPrevious()){m=l.getChild([k.getParent().getIndex(),0]);m.focus();h(null,k);g(null,m);}j.preventDefault();break;case 40:if(l=k.getParent().getParent().getNext()){m=l.getChild([k.getParent().getIndex(),0]);if(m&&m.type==1){m.focus();h(null,k);g(null,m);}}j.preventDefault();break;case 32:d({data:j});j.preventDefault();break;case o?37:39:case 9:if(l=k.getParent().getNext()){m=l.getChild(0);if(m.type==1){m.focus();h(null,k);g(null,m);j.preventDefault(true);}else h(null,k);}else if(l=k.getParent().getParent().getNext()){m=l.getChild([0,0]);if(m&&m.type==1){m.focus();h(null,k);g(null,m);j.preventDefault(true);}else h(null,k);}break;case o?39:37:case CKEDITOR.SHIFT+9:if(l=k.getParent().getPrevious()){m=l.getChild(0);m.focus();h(null,k);g(null,m);j.preventDefault(true);}else if(l=k.getParent().getParent().getPrevious()){m=l.getLast().getChild(0);m.focus();h(null,k);g(null,m);j.preventDefault(true);}else h(null,k);break;default:return;}});return{title:c.title,minWidth:430,minHeight:280,buttons:[CKEDITOR.dialog.cancelButton],charColumns:17,onLoad:function(){var j=this.definition.charColumns,k=a.config.extraSpecialChars,l=a.config.specialChars,m=CKEDITOR.tools.getNextId()+'_specialchar_table_label',n=['<table role="listbox" aria-labelledby="'+m+'"'+' style="width: 320px; height: 100%; border-collapse: separate;"'+' align="center" cellspacing="2" cellpadding="2" border="0">'],o=0,p=l.length,q,r;
+while(o<p){n.push('<tr>');for(var s=0;s<j;s++,o++){if(q=l[o]){r='';if(q instanceof Array){r=q[1];q=q[0];}else{var t=q.toLowerCase().replace('&','').replace(';','').replace('#','');r=c[t]||q;}var u='cke_specialchar_label_'+o+'_'+CKEDITOR.tools.getNextNumber();n.push('<td class="cke_dark_background" style="cursor: default" role="presentation"><a href="javascript: void(0);" role="option" aria-posinset="'+(o+1)+'"',' aria-setsize="'+p+'"',' aria-labelledby="'+u+'"',' style="cursor: inherit; display: block; height: 1.25em; margin-top: 0.25em; text-align: center;" title="',CKEDITOR.tools.htmlEncode(r),'" onkeydown="CKEDITOR.tools.callFunction( '+i+', event, this )"'+' onclick="CKEDITOR.tools.callFunction('+e+', this); return false;"'+' tabindex="-1">'+'<span style="margin: 0 auto;cursor: inherit">'+q+'</span>'+'<span class="cke_voice_label" id="'+u+'">'+r+'</span></a>');}else n.push('<td class="cke_dark_background"> ');n.push('</td>');}n.push('</tr>');}n.push('</tbody></table>','<span id="'+m+'" class="cke_voice_label">'+c.options+'</span>');this.getContentElement('info','charContainer').getElement().setHtml(n.join(''));},contents:[{id:'info',label:a.lang.common.generalTab,title:a.lang.common.generalTab,padding:0,align:'top',elements:[{type:'hbox',align:'top',widths:['320px','90px'],children:[{type:'html',id:'charContainer',html:'',onMouseover:g,onMouseout:h,focus:function(){var j=this.getElement().getElementsByTag('a').getItem(0);setTimeout(function(){j.focus();g(null,j);},0);},onShow:function(){var j=this.getElement().getChild([0,0,0,0,0]);setTimeout(function(){j.focus();g(null,j);},0);},onLoad:function(j){b=j.sender;}},{type:'hbox',align:'top',widths:['100%'],children:[{type:'vbox',align:'top',children:[{type:'html',html:'<div></div>'},{type:'html',id:'charPreview',className:'cke_dark_background',style:"border:1px solid #eeeeee;font-size:28px;height:40px;width:70px;padding-top:9px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;text-align:center;",html:'<div> </div>'},{type:'html',id:'htmlPreview',className:'cke_dark_background',style:"border:1px solid #eeeeee;font-size:14px;height:20px;width:70px;padding-top:2px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;text-align:center;",html:'<div> </div>'}]}]}]}]}]};});
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/specialchar/lang/en.js b/appsrc/ODS-Framework/ckeditor/plugins/specialchar/lang/en.js
new file mode 100644
index 0000000..2bd269c
--- /dev/null
+++ b/appsrc/ODS-Framework/ckeditor/plugins/specialchar/lang/en.js
@@ -0,0 +1,6 @@
+/*
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+CKEDITOR.plugins.setLang('specialchar','en',{euro:'EURO SIGN',lsquo:'LEFT SINGLE QUOTATION MARK',rsquo:'RIGHT SINGLE QUOTATION MARK',ldquo:'LEFT DOUBLE QUOTATION MARK',rdquo:'RIGHT DOUBLE QUOTATION MARK',ndash:'EN DASH',mdash:'EM DASH',iexcl:'INVERTED EXCLAMATION MARK',cent:'CENT SIGN',pound:'POUND SIGN',curren:'CURRENCY SIGN',yen:'YEN SIGN',brvbar:'BROKEN BAR',sect:'SECTION SIGN',uml:'DIAERESIS',copy:'COPYRIGHT SIGN',ordf:'FEMININE ORDINAL INDICATOR',laquo:'LEFT-POINTING DOUBLE ANGLE QUOTATION MARK',not:'NOT SIGN',reg:'REGISTERED SIGN',macr:'MACRON',deg:'DEGREE SIGN',sup2:'SUPERSCRIPT TWO',sup3:'SUPERSCRIPT THREE',acute:'ACUTE ACCENT',micro:'MICRO SIGN',para:'PILCROW SIGN',middot:'MIDDLE DOT',cedil:'CEDILLA',sup1:'SUPERSCRIPT ONE',ordm:'MASCULINE ORDINAL INDICATOR',frac14:'VULGAR FRACTION ONE QUARTER',frac12:'VULGAR FRACTION ONE HALF',frac34:'VULGAR FRACTION THREE QUARTERS',iquest:'INVERTED QUESTION MARK',agrave:'LATIN SMALL LETTER A WITH GRAVE',aacute:'LATIN SMALL LETTER A WITH ACUTE',acirc:'LATIN SMALL LETTER A WITH CIRCUMFLEX',atilde:'LATIN SMALL LETTER A WITH TILDE',auml:'LATIN SMALL LETTER A WITH DIAERESIS',aring:'LATIN SMALL LETTER A WITH RING ABOVE',aelig:'LATIN SMALL LETTER AE',ccedil:'LATIN SMALL LETTER C WITH CEDILLA',egrave:'LATIN SMALL LETTER E WITH GRAVE',eacute:'LATIN SMALL LETTER E WITH ACUTE',ecirc:'LATIN SMALL LETTER E WITH CIRCUMFLEX',euml:'LATIN SMALL LETTER E WITH DIAERESIS',igrave:'LATIN SMALL LETTER I WITH GRAVE',iacute:'LATIN SMALL LETTER I WITH ACUTE',icirc:'LATIN SMALL LETTER I WITH CIRCUMFLEX',iuml:'LATIN SMALL LETTER I WITH DIAERESIS',eth:'LATIN SMALL LETTER ETH',ntilde:'LATIN SMALL LETTER N WITH TILDE',ograve:'LATIN SMALL LETTER O WITH GRAVE',oacute:'LATIN SMALL LETTER O WITH ACUTE',ocirc:'LATIN SMALL LETTER O WITH CIRCUMFLEX',otilde:'LATIN SMALL LETTER O WITH TILDE',ouml:'LATIN SMALL LETTER O WITH DIAERESIS',times:'MULTIPLICATION SIGN',oslash:'LATIN SMALL LETTER O WITH STROKE',ugrave:'LATIN SMALL LETTER U WITH GRAVE',uacute:'LATIN SMALL LETTER U WITH ACUTE',ucirc:'LATIN SMALL LETTER U WITH CIRCUMFLEX',uuml:'LATIN SMALL LETTER U WITH DIAERESIS',yacute:'LATIN SMALL LETTER Y WITH ACUTE',thorn:'LATIN SMALL LETTER THORN',szlig:'LATIN SMALL LETTER SHARP S',divide:'DIVISION SIGN',yuml:'LATIN SMALL LETTER Y WITH DIAERESIS',oelig:'LATIN SMALL LIGATURE OE',372:'LATIN CAPITAL LETTER W WITH CIRCUMFLEX',374:'LATIN CAPITAL LETTER Y WITH CIRCUMFLEX',373:'LATIN SMALL LETTER W WITH CIRCUMFLEX',375:'LATIN SMALL LETTER Y WITH CIRCUMFLEX',8219:'SINGLE HIGH-REVERSED-9 QUOTATION MARK',bdquo:'DOUBLE LOW-9 QUOTATION MARK',hellip:'HORIZONTAL ELLIPSIS',trade:'TRADE MARK SIGN',9658:'BLACK RIGHT-POINTING POINTER',bull:'BULLET',rarr:'RIGHTWARDS DOUBLE ARROW',harr:'LEFT RIGHT DOUBLE ARROW',diams:'BLACK DIAMOND SUIT',asymp:'ALMOST EQUAL TO',sbquo:'SINGLE LOW-9 QUOTATION MARK'});
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/styles/styles/default.js b/appsrc/ODS-Framework/ckeditor/plugins/styles/styles/default.js
index ddead5b..dc34cca 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/styles/styles/default.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/styles/styles/default.js
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/table/dialogs/table.js b/appsrc/ODS-Framework/ckeditor/plugins/table/dialogs/table.js
index 9bbaab4..b6f7cf1 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/table/dialogs/table.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/table/dialogs/table.js
@@ -1,9 +1,9 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-(function(){var a=/^(\d+(?:\.\d+)?)(px|%)$/,b=/^(\d+(?:\.\d+)?)px$/,c=function(e){var f=this.id;if(!e.info)e.info={};e.info[f]=this.getValue();};function d(e,f){var g=function(h){return new CKEDITOR.dom.element(h,e.document);};return{title:e.lang.table.title,minWidth:310,minHeight:CKEDITOR.env.ie?310:280,onShow:function(){var o=this;var h=e.getSelection(),i=h.getRanges(),j=null,k=o.getContentElement('info','txtRows'),l=o.getContentElement('info','txtCols'),m=o.getContentElement('info','txtWidth');if(f=='tableProperties'){if(j=e.getSelection().getSelectedElement()){if(j.getName()!='table')j=null;}else if(i.length>0){if(CKEDITOR.env.webkit)i[0].shrink(CKEDITOR.NODE_ELEMENT);var n=i[0].getCommonAncestor(true);j=n.getAscendant('table',true);}o._.selectedElement=j;}if(j){o.setupContent(j);k&&k.disable();l&&l.disable();m&&m.select();}else{k&&k.enable();l&&l.enable();k&&k.select();}},onOk:function(){var C=this;if(C._.selectedElement)var h=e.getSelection(),i=e.getSelection().createBookmarks();var j=C._.selectedElement||g('table'),k=C,l={};C.commitContent(l,j);if(l.info){var m=l.info;if(!C._.selectedElement){var n=j.append(g('tbody')),o=parseInt(m.txtRows,10)||0,p=parseInt(m.txtCols,10)||0;for(var q=0;q<o;q++){var r=n.append(g('tr'));for(var s=0;s<p;s++){var t=r.append(g('td'));if(!CKEDITOR.env.ie)t.append(g('br'));}}}var u=m.selHeaders;if(!j.$.tHead&&(u=='row'||u=='both')){var v=new CKEDITOR.dom.element(j.$.createTHead());n=j.getElementsByTag('tbody').getItem(0);var w=n.getElementsByTag('tr').getItem(0);for(q=0;q<w.getChildCount();q++){var x=w.getChild(q);if(x.type==CKEDITOR.NODE_ELEMENT){x.renameNode('th');x.setAttribute('scope','col');}}v.append(w.remove());}if(j.$.tHead!==null&&!(u=='row'||u=='both')){v=new CKEDITOR.dom.element(j.$.tHead);n=j.getElementsByTag('tbody').getItem(0);var y=n.getFirst();while(v.getChildCount()>0){w=v.getFirst();for(q=0;q<w.getChildCount();q++){var z=w.getChild(q);if(z.type==CKEDITOR.NODE_ELEMENT){z.renameNode('td');z.removeAttribute('scope');}}w.insertBefore(y);}v.remove();}if(!C.hasColumnHeaders&&(u=='col'||u=='both'))for(r=0;r<j.$.rows.length;r++){z=new CKEDITOR.dom.element(j.$.rows[r].cells[0]);z.renameNode('th');z.setAttribute('scope','row');}if(C.hasColumnHeaders&&!(u=='col'||u=='both'))for(q=0;q<j.$.rows.length;q++){r=new CKEDITOR.dom.element(j.$.rows[q]);if(r.getParent().getName()=='tbody'){z=new CKEDITOR.dom.element(r.$.cells[0]);z.renameNode('td');z.removeAttribute('scope');}}var A=[];if(m.txtHeight)j.setStyle('height',CKEDITOR.tools.cssLength(m.txtHeight));
-else j.removeStyle('height');if(m.txtWidth){var B=m.cmbWidthType||'pixels';j.setStyle('width',m.txtWidth+(B=='pixels'?'px':'%'));}else j.removeStyle('width');if(!j.getAttribute('style'))j.removeAttribute('style');}if(!C._.selectedElement)e.insertElement(j);else h.selectBookmarks(i);return true;},contents:[{id:'info',label:e.lang.table.title,elements:[{type:'hbox',widths:[null,null],styles:['vertical-align:top'],children:[{type:'vbox',padding:0,children:[{type:'text',id:'txtRows','default':3,label:e.lang.table.rows,style:'width:5em',validate:function(){var h=true,i=this.getValue();h=h&&CKEDITOR.dialog.validate.integer()(i)&&i>0;if(!h){alert(e.lang.table.invalidRows);this.select();}return h;},setup:function(h){this.setValue(h.$.rows.length);},commit:c},{type:'text',id:'txtCols','default':2,label:e.lang.table.columns,style:'width:5em',validate:function(){var h=true,i=this.getValue();h=h&&CKEDITOR.dialog.validate.integer()(i)&&i>0;if(!h){alert(e.lang.table.invalidCols);this.select();}return h;},setup:function(h){this.setValue(h.$.rows[0].cells.length);},commit:c},{type:'html',html:' '},{type:'select',id:'selHeaders','default':'',label:e.lang.table.headers,items:[[e.lang.table.headersNone,''],[e.lang.table.headersRow,'row'],[e.lang.table.headersColumn,'col'],[e.lang.table.headersBoth,'both']],setup:function(h){var i=this.getDialog();i.hasColumnHeaders=true;for(var j=0;j<h.$.rows.length;j++){if(h.$.rows[j].cells[0].nodeName.toLowerCase()!='th'){i.hasColumnHeaders=false;break;}}if(h.$.tHead!==null)this.setValue(i.hasColumnHeaders?'both':'row');else this.setValue(i.hasColumnHeaders?'col':'');},commit:c},{type:'text',id:'txtBorder','default':1,label:e.lang.table.border,style:'width:3em',validate:CKEDITOR.dialog.validate.number(e.lang.table.invalidBorder),setup:function(h){this.setValue(h.getAttribute('border')||'');},commit:function(h,i){if(this.getValue())i.setAttribute('border',this.getValue());else i.removeAttribute('border');}},{id:'cmbAlign',type:'select','default':'',label:e.lang.table.align,items:[[e.lang.common.notSet,''],[e.lang.table.alignLeft,'left'],[e.lang.table.alignCenter,'center'],[e.lang.table.alignRight,'right']],setup:function(h){this.setValue(h.getAttribute('align')||'');},commit:function(h,i){if(this.getValue())i.setAttribute('align',this.getValue());else i.removeAttribute('align');}}]},{type:'vbox',padding:0,children:[{type:'hbox',widths:['5em'],children:[{type:'text',id:'txtWidth',style:'width:5em',label:e.lang.table.width,'default':200,validate:CKEDITOR.dialog.validate.number(e.lang.table.invalidWidth),onLoad:function(){var h=this.getDialog().getContentElement('info','cmbWidthType'),i=h.getElement(),j=this.getInputElement(),k=j.getAttribute('aria-labelledby');
-j.setAttribute('aria-labelledby',[k,i.$.id].join(' '));},setup:function(h){var i=a.exec(h.$.style.width);if(i)this.setValue(i[1]);else this.setValue('');},commit:c},{id:'cmbWidthType',type:'select',label:e.lang.table.widthUnit,labelStyle:'visibility:hidden','default':'pixels',items:[[e.lang.table.widthPx,'pixels'],[e.lang.table.widthPc,'percents']],setup:function(h){var i=a.exec(h.$.style.width);if(i)this.setValue(i[2]=='px'?'pixels':'percents');},commit:c}]},{type:'hbox',widths:['5em'],children:[{type:'text',id:'txtHeight',style:'width:5em',label:e.lang.table.height,'default':'',validate:CKEDITOR.dialog.validate.number(e.lang.table.invalidHeight),onLoad:function(){var h=this.getDialog().getContentElement('info','htmlHeightType'),i=h.getElement(),j=this.getInputElement(),k=j.getAttribute('aria-labelledby');j.setAttribute('aria-labelledby',[k,i.$.id].join(' '));},setup:function(h){var i=b.exec(h.$.style.height);if(i)this.setValue(i[1]);},commit:c},{id:'htmlHeightType',type:'html',html:'<div><br />'+e.lang.table.widthPx+'</div>'}]},{type:'html',html:' '},{type:'text',id:'txtCellSpace',style:'width:3em',label:e.lang.table.cellSpace,'default':1,validate:CKEDITOR.dialog.validate.number(e.lang.table.invalidCellSpacing),setup:function(h){this.setValue(h.getAttribute('cellSpacing')||'');},commit:function(h,i){if(this.getValue())i.setAttribute('cellSpacing',this.getValue());else i.removeAttribute('cellSpacing');}},{type:'text',id:'txtCellPad',style:'width:3em',label:e.lang.table.cellPad,'default':1,validate:CKEDITOR.dialog.validate.number(e.lang.table.invalidCellPadding),setup:function(h){this.setValue(h.getAttribute('cellPadding')||'');},commit:function(h,i){if(this.getValue())i.setAttribute('cellPadding',this.getValue());else i.removeAttribute('cellPadding');}}]}]},{type:'html',align:'right',html:''},{type:'vbox',padding:0,children:[{type:'text',id:'txtCaption',label:e.lang.table.caption,setup:function(h){var i=h.getElementsByTag('caption');if(i.count()>0){var j=i.getItem(0);j=j.getChild(0)&&j.getChild(0).getText()||'';j=CKEDITOR.tools.trim(j);this.setValue(j);}},commit:function(h,i){var j=this.getValue(),k=i.getElementsByTag('caption');if(j){if(k.count()>0){k=k.getItem(0);k.setHtml('');}else{k=new CKEDITOR.dom.element('caption',e.document);if(i.getChildCount())k.insertBefore(i.getFirst());else k.appendTo(i);}k.append(new CKEDITOR.dom.text(j,e.document));}else if(k.count()>0)for(var l=k.count()-1;l>=0;l--)k.getItem(l).remove();}},{type:'text',id:'txtSummary',label:e.lang.table.summary,setup:function(h){this.setValue(h.getAttribute('summary')||'');
-},commit:function(h,i){if(this.getValue())i.setAttribute('summary',this.getValue());else i.removeAttribute('summary');}}]}]}]};};CKEDITOR.dialog.add('table',function(e){return d(e,'table');});CKEDITOR.dialog.add('tableProperties',function(e){return d(e,'tableProperties');});})();
+(function(){var a=/^(\d+(?:\.\d+)?)(px|%)$/,b=/^(\d+(?:\.\d+)?)px$/,c=function(e){var f=this.id;if(!e.info)e.info={};e.info[f]=this.getValue();};function d(e,f){var g=function(i){return new CKEDITOR.dom.element(i,e.document);},h=e.plugins.dialogadvtab;return{title:e.lang.table.title,minWidth:310,minHeight:CKEDITOR.env.ie?310:280,onLoad:function(){var i=this,j=i.getContentElement('advanced','advStyles');if(j)j.on('change',function(k){var l=this.getStyle('width',''),m=i.getContentElement('info','txtWidth'),n=i.getContentElement('info','cmbWidthType'),o=1;if(l){o=l.length<3||l.substr(l.length-1)!='%';l=parseInt(l,10);}m&&m.setValue(l,true);n&&n.setValue(o?'pixels':'percents',true);var p=this.getStyle('height',''),q=i.getContentElement('info','txtHeight');p&&(p=parseInt(p,10));q&&q.setValue(p,true);});},onShow:function(){var q=this;var i=e.getSelection(),j=i.getRanges(),k=null,l=q.getContentElement('info','txtRows'),m=q.getContentElement('info','txtCols'),n=q.getContentElement('info','txtWidth'),o=q.getContentElement('info','txtHeight');if(f=='tableProperties'){if(k=i.getSelectedElement())k=k.getAscendant('table',true);else if(j.length>0){if(CKEDITOR.env.webkit)j[0].shrink(CKEDITOR.NODE_ELEMENT);var p=j[0].getCommonAncestor(true);k=p.getAscendant('table',true);}q._.selectedElement=k;}if(k){q.setupContent(k);l&&l.disable();m&&m.disable();}else{l&&l.enable();m&&m.enable();}n&&n.onChange();o&&o.onChange();},onOk:function(){var D=this;if(D._.selectedElement)var i=e.getSelection(),j=i.createBookmarks();var k=D._.selectedElement||g('table'),l=D,m={};D.commitContent(m,k);if(m.info){var n=m.info;if(!D._.selectedElement){var o=k.append(g('tbody')),p=parseInt(n.txtRows,10)||0,q=parseInt(n.txtCols,10)||0;for(var r=0;r<p;r++){var s=o.append(g('tr'));for(var t=0;t<q;t++){var u=s.append(g('td'));if(!CKEDITOR.env.ie)u.append(g('br'));}}}var v=n.selHeaders;if(!k.$.tHead&&(v=='row'||v=='both')){var w=new CKEDITOR.dom.element(k.$.createTHead());o=k.getElementsByTag('tbody').getItem(0);var x=o.getElementsByTag('tr').getItem(0);for(r=0;r<x.getChildCount();r++){var y=x.getChild(r);if(y.type==CKEDITOR.NODE_ELEMENT&&!y.data('cke-bookmark')){y.renameNode('th');y.setAttribute('scope','col');}}w.append(x.remove());}if(k.$.tHead!==null&&!(v=='row'||v=='both')){w=new CKEDITOR.dom.element(k.$.tHead);o=k.getElementsByTag('tbody').getItem(0);var z=o.getFirst();while(w.getChildCount()>0){x=w.getFirst();for(r=0;r<x.getChildCount();r++){var A=x.getChild(r);if(A.type==CKEDITOR.NODE_ELEMENT){A.renameNode('td');
+A.removeAttribute('scope');}}x.insertBefore(z);}w.remove();}if(!D.hasColumnHeaders&&(v=='col'||v=='both'))for(s=0;s<k.$.rows.length;s++){A=new CKEDITOR.dom.element(k.$.rows[s].cells[0]);A.renameNode('th');A.setAttribute('scope','row');}if(D.hasColumnHeaders&&!(v=='col'||v=='both'))for(r=0;r<k.$.rows.length;r++){s=new CKEDITOR.dom.element(k.$.rows[r]);if(s.getParent().getName()=='tbody'){A=new CKEDITOR.dom.element(s.$.cells[0]);A.renameNode('td');A.removeAttribute('scope');}}var B=[];if(n.txtHeight)k.setStyle('height',CKEDITOR.tools.cssLength(n.txtHeight));else k.removeStyle('height');if(n.txtWidth){var C=n.cmbWidthType||'pixels';k.setStyle('width',n.txtWidth+(C=='pixels'?'px':'%'));}else k.removeStyle('width');if(!k.getAttribute('style'))k.removeAttribute('style');}if(!D._.selectedElement)e.insertElement(k);else i.selectBookmarks(j);return true;},contents:[{id:'info',label:e.lang.table.title,elements:[{type:'hbox',widths:[null,null],styles:['vertical-align:top'],children:[{type:'vbox',padding:0,children:[{type:'text',id:'txtRows','default':3,label:e.lang.table.rows,required:true,style:'width:5em',validate:function(){var i=true,j=this.getValue();i=i&&CKEDITOR.dialog.validate.integer()(j)&&j>0;if(!i){alert(e.lang.table.invalidRows);this.select();}return i;},setup:function(i){this.setValue(i.$.rows.length);},commit:c},{type:'text',id:'txtCols','default':2,label:e.lang.table.columns,required:true,style:'width:5em',validate:function(){var i=true,j=this.getValue();i=i&&CKEDITOR.dialog.validate.integer()(j)&&j>0;if(!i){alert(e.lang.table.invalidCols);this.select();}return i;},setup:function(i){this.setValue(i.$.rows[0].cells.length);},commit:c},{type:'html',html:' '},{type:'select',id:'selHeaders','default':'',label:e.lang.table.headers,items:[[e.lang.table.headersNone,''],[e.lang.table.headersRow,'row'],[e.lang.table.headersColumn,'col'],[e.lang.table.headersBoth,'both']],setup:function(i){var j=this.getDialog();j.hasColumnHeaders=true;for(var k=0;k<i.$.rows.length;k++){if(i.$.rows[k].cells[0].nodeName.toLowerCase()!='th'){j.hasColumnHeaders=false;break;}}if(i.$.tHead!==null)this.setValue(j.hasColumnHeaders?'both':'row');else this.setValue(j.hasColumnHeaders?'col':'');},commit:c},{type:'text',id:'txtBorder','default':1,label:e.lang.table.border,style:'width:3em',validate:CKEDITOR.dialog.validate.number(e.lang.table.invalidBorder),setup:function(i){this.setValue(i.getAttribute('border')||'');},commit:function(i,j){if(this.getValue())j.setAttribute('border',this.getValue());
+else j.removeAttribute('border');}},{id:'cmbAlign',type:'select','default':'',label:e.lang.common.align,items:[[e.lang.common.notSet,''],[e.lang.common.alignLeft,'left'],[e.lang.common.alignCenter,'center'],[e.lang.common.alignRight,'right']],setup:function(i){this.setValue(i.getAttribute('align')||'');},commit:function(i,j){if(this.getValue())j.setAttribute('align',this.getValue());else j.removeAttribute('align');}}]},{type:'vbox',padding:0,children:[{type:'hbox',widths:['5em'],children:[{type:'text',id:'txtWidth',style:'width:5em',label:e.lang.common.width,'default':500,validate:CKEDITOR.dialog.validate.number(e.lang.table.invalidWidth),onLoad:function(){var i=this.getDialog().getContentElement('info','cmbWidthType'),j=i.getElement(),k=this.getInputElement(),l=k.getAttribute('aria-labelledby');k.setAttribute('aria-labelledby',[l,j.$.id].join(' '));},onChange:function(){var i=this.getDialog().getContentElement('advanced','advStyles');if(i){var j=this.getValue();if(j)j+=this.getDialog().getContentElement('info','cmbWidthType').getValue()=='percents'?'%':'px';i.updateStyle('width',j);}},setup:function(i){var j=a.exec(i.$.style.width);if(j)this.setValue(j[1]);else this.setValue('');},commit:c},{id:'cmbWidthType',type:'select',label:e.lang.table.widthUnit,labelStyle:'visibility:hidden','default':'pixels',items:[[e.lang.table.widthPx,'pixels'],[e.lang.table.widthPc,'percents']],setup:function(i){var j=a.exec(i.$.style.width);if(j)this.setValue(j[2]=='px'?'pixels':'percents');},onChange:function(){this.getDialog().getContentElement('info','txtWidth').onChange();},commit:c}]},{type:'hbox',widths:['5em'],children:[{type:'text',id:'txtHeight',style:'width:5em',label:e.lang.common.height,'default':'',validate:CKEDITOR.dialog.validate.number(e.lang.table.invalidHeight),onLoad:function(){var i=this.getDialog().getContentElement('info','htmlHeightType'),j=i.getElement(),k=this.getInputElement(),l=k.getAttribute('aria-labelledby');k.setAttribute('aria-labelledby',[l,j.$.id].join(' '));},onChange:function(){var i=this.getDialog().getContentElement('advanced','advStyles');if(i){var j=this.getValue();i.updateStyle('height',j&&j+'px');}},setup:function(i){var j=b.exec(i.$.style.height);if(j)this.setValue(j[1]);},commit:c},{id:'htmlHeightType',type:'html',html:'<div><br />'+e.lang.table.widthPx+'</div>'}]},{type:'html',html:' '},{type:'text',id:'txtCellSpace',style:'width:3em',label:e.lang.table.cellSpace,'default':1,validate:CKEDITOR.dialog.validate.number(e.lang.table.invalidCellSpacing),setup:function(i){this.setValue(i.getAttribute('cellSpacing')||'');
+},commit:function(i,j){if(this.getValue())j.setAttribute('cellSpacing',this.getValue());else j.removeAttribute('cellSpacing');}},{type:'text',id:'txtCellPad',style:'width:3em',label:e.lang.table.cellPad,'default':1,validate:CKEDITOR.dialog.validate.number(e.lang.table.invalidCellPadding),setup:function(i){this.setValue(i.getAttribute('cellPadding')||'');},commit:function(i,j){if(this.getValue())j.setAttribute('cellPadding',this.getValue());else j.removeAttribute('cellPadding');}}]}]},{type:'html',align:'right',html:''},{type:'vbox',padding:0,children:[{type:'text',id:'txtCaption',label:e.lang.table.caption,setup:function(i){var j=i.getElementsByTag('caption');if(j.count()>0){var k=j.getItem(0);k=CKEDITOR.tools.trim(k.getText());this.setValue(k);}},commit:function(i,j){var k=this.getValue(),l=j.getElementsByTag('caption');if(k){if(l.count()>0){l=l.getItem(0);l.setHtml('');}else{l=new CKEDITOR.dom.element('caption',e.document);if(j.getChildCount())l.insertBefore(j.getFirst());else l.appendTo(j);}l.append(new CKEDITOR.dom.text(k,e.document));}else if(l.count()>0)for(var m=l.count()-1;m>=0;m--)l.getItem(m).remove();}},{type:'text',id:'txtSummary',label:e.lang.table.summary,setup:function(i){this.setValue(i.getAttribute('summary')||'');},commit:function(i,j){if(this.getValue())j.setAttribute('summary',this.getValue());else j.removeAttribute('summary');}}]}]},h&&h.createAdvancedTab(e)]};};CKEDITOR.dialog.add('table',function(e){return d(e,'table');});CKEDITOR.dialog.add('tableProperties',function(e){return d(e,'tableProperties');});})();
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/tabletools/dialogs/tableCell.js b/appsrc/ODS-Framework/ckeditor/plugins/tabletools/dialogs/tableCell.js
index 733cdaf..8822b3e 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/tabletools/dialogs/tableCell.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/tabletools/dialogs/tableCell.js
@@ -1,8 +1,8 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.dialog.add('cellProperties',function(a){var b=a.lang.table,c=b.cell,d=a.lang.common,e=CKEDITOR.dialog.validate,f=/^(\d+(?:\.\d+)?)(px|%)$/,g=/^(\d+(?:\.\d+)?)px$/,h=CKEDITOR.tools.bind;function i(){return{type:'html',html:' '};};function j(k,l){var m=function(){p(this);l(this);},n=function(){p(this);},o=function(q){q.on('ok',m);q.on('cancel',n);},p=function(q){q.removeListener('ok',m);q.removeListener('cancel',n);};a.execCommand(k);if(a._.storedDialogs.colordialog)o(a._.storedDialogs.colordialog);else CKEDITOR.on('dialogDefinition',function(q){if(q.data.name!=k)return;var r=q.data.definition;q.removeListener();r.onLoad=CKEDITOR.tools.override(r.onLoad,function(s){return function(){o(this);r.onLoad=s;if(typeof s=='function')s.call(this);};});});};return{title:c.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?550:480,minHeight:CKEDITOR.env.ie?CKEDITOR.env.quirks?180:150:140,contents:[{id:'info',label:c.title,accessKey:'I',elements:[{type:'hbox',widths:['40%','5%','40%'],children:[{type:'vbox',padding:0,children:[{type:'hbox',widths:['70%','30%'],children:[{type:'text',id:'width',label:b.width,widths:['71%','29%'],labelLayout:'horizontal',validate:e.number(c.invalidWidth),onLoad:function(){var k=this.getDialog().getContentElement('info','widthType'),l=k.getElement(),m=this.getInputElement(),n=m.getAttribute('aria-labelledby');m.setAttribute('aria-labelledby',[n,l.$.id].join(' '));},setup:function(k){var l=parseInt(k.getAttribute('width'),10),m=parseInt(k.getStyle('width'),10);!isNaN(l)&&this.setValue(l);!isNaN(m)&&this.setValue(m);},commit:function(k){var l=parseInt(this.getValue(),10),m=this.getDialog().getValueOf('info','widthType');if(!isNaN(l))k.setStyle('width',l+m);else k.removeStyle('width');k.removeAttribute('width');},'default':''},{type:'select',id:'widthType',labelLayout:'horizontal',widths:['0%','100%'],label:a.lang.table.widthUnit,labelStyle:'display:none','default':'px',items:[[b.widthPx,'px'],[b.widthPc,'%']],setup:function(k){var l=f.exec(k.$.style.width);if(l)this.setValue(l[2]);}}]},{type:'hbox',widths:['70%','30%'],children:[{type:'text',id:'height',label:b.height,'default':'',widths:['71%','29%'],labelLayout:'horizontal',validate:e.number(c.invalidHeight),onLoad:function(){var k=this.getDialog().getContentElement('info','htmlHeightType'),l=k.getElement(),m=this.getInputElement(),n=m.getAttribute('aria-labelledby');m.setAttribute('aria-labelledby',[n,l.$.id].join(' '));},setup:function(k){var l=parseInt(k.getAttribute('height'),10),m=parseInt(k.getStyle('height'),10);
-!isNaN(l)&&this.setValue(l);!isNaN(m)&&this.setValue(m);},commit:function(k){var l=parseInt(this.getValue(),10);if(!isNaN(l))k.setStyle('height',CKEDITOR.tools.cssLength(l));else k.removeStyle('height');k.removeAttribute('height');}},{id:'htmlHeightType',type:'html',html:b.widthPx}]},i(),{type:'select',id:'wordWrap',labelLayout:'horizontal',label:c.wordWrap,widths:['50%','50%'],'default':'yes',items:[[c.yes,'yes'],[c.no,'no']],setup:function(k){var l=k.getAttribute('noWrap'),m=k.getStyle('white-space');if(m=='nowrap'||l)this.setValue('no');},commit:function(k){if(this.getValue()=='no')k.setStyle('white-space','nowrap');else k.removeStyle('white-space');k.removeAttribute('noWrap');}},i(),{type:'select',id:'hAlign',labelLayout:'horizontal',label:c.hAlign,widths:['50%','50%'],'default':'',items:[[d.notSet,''],[b.alignLeft,'left'],[b.alignCenter,'center'],[b.alignRight,'right']],setup:function(k){var l=k.getAttribute('align'),m=k.getStyle('text-align');this.setValue(m||l||'');},commit:function(k){var l=this.getValue();if(l)k.setStyle('text-align',l);else k.removeStyle('text-align');k.removeAttribute('align');}},{type:'select',id:'vAlign',labelLayout:'horizontal',label:c.vAlign,widths:['50%','50%'],'default':'',items:[[d.notSet,''],[c.alignTop,'top'],[c.alignMiddle,'middle'],[c.alignBottom,'bottom'],[c.alignBaseline,'baseline']],setup:function(k){var l=k.getAttribute('vAlign'),m=k.getStyle('vertical-align');switch(m){case 'top':case 'middle':case 'bottom':case 'baseline':break;default:m='';}this.setValue(m||l||'');},commit:function(k){var l=this.getValue();if(l)k.setStyle('vertical-align',l);else k.removeStyle('vertical-align');k.removeAttribute('vAlign');}}]},i(),{type:'vbox',padding:0,children:[{type:'select',id:'cellType',label:c.cellType,labelLayout:'horizontal',widths:['50%','50%'],'default':'td',items:[[c.data,'td'],[c.header,'th']],setup:function(k){this.setValue(k.getName());},commit:function(k){k.renameNode(this.getValue());}},i(),{type:'text',id:'rowSpan',label:c.rowSpan,labelLayout:'horizontal',widths:['50%','50%'],'default':'',validate:e.integer(c.invalidRowSpan),setup:function(k){var l=parseInt(k.getAttribute('rowSpan'),10);if(l&&l!=1)this.setValue(l);},commit:function(k){var l=parseInt(this.getValue(),10);if(l&&l!=1)k.setAttribute('rowSpan',this.getValue());else k.removeAttribute('rowSpan');}},{type:'text',id:'colSpan',label:c.colSpan,labelLayout:'horizontal',widths:['50%','50%'],'default':'',validate:e.integer(c.invalidColSpan),setup:function(k){var l=parseInt(k.getAttribute('colSpan'),10);
-if(l&&l!=1)this.setValue(l);},commit:function(k){var l=parseInt(this.getValue(),10);if(l&&l!=1)k.setAttribute('colSpan',this.getValue());else k.removeAttribute('colSpan');}},i(),{type:'hbox',padding:0,widths:['80%','20%'],children:[{type:'text',id:'bgColor',label:c.bgColor,labelLayout:'horizontal',widths:['70%','30%'],'default':'',setup:function(k){var l=k.getAttribute('bgColor'),m=k.getStyle('background-color');this.setValue(m||l);},commit:function(k){var l=this.getValue();if(l)k.setStyle('background-color',this.getValue());else k.removeStyle('background-color');k.removeAttribute('bgColor');}},{type:'button',id:'bgColorChoose',label:c.chooseColor,style:'margin-left: 10px',onClick:function(){var k=this;j('colordialog',function(l){k.getDialog().getContentElement('info','bgColor').setValue(l.getContentElement('picker','selectedColor').getValue());});}}]},i(),{type:'hbox',padding:0,widths:['80%','20%'],children:[{type:'text',id:'borderColor',label:c.borderColor,labelLayout:'horizontal',widths:['70%','30%'],'default':'',setup:function(k){var l=k.getAttribute('borderColor'),m=k.getStyle('border-color');this.setValue(m||l);},commit:function(k){var l=this.getValue();if(l)k.setStyle('border-color',this.getValue());else k.removeStyle('border-color');k.removeAttribute('borderColor');}},{type:'button',id:'borderColorChoose',label:c.chooseColor,style:'margin-left: 10px',onClick:function(){var k=this;j('colordialog',function(l){k.getDialog().getContentElement('info','borderColor').setValue(l.getContentElement('picker','selectedColor').getValue());});}}]}]}]}]}],onShow:function(){var k=this;k.cells=CKEDITOR.plugins.tabletools.getSelectedCells(k._.editor.getSelection());k.setupContent(k.cells[0]);},onOk:function(){var k=this._.editor.getSelection(),l=k.createBookmarks(),m=this.cells;for(var n=0;n<m.length;n++)this.commitContent(m[n]);k.selectBookmarks(l);}};});
+CKEDITOR.dialog.add('cellProperties',function(a){var b=a.lang.table,c=b.cell,d=a.lang.common,e=CKEDITOR.dialog.validate,f=/^(\d+(?:\.\d+)?)(px|%)$/,g=/^(\d+(?:\.\d+)?)px$/,h=CKEDITOR.tools.bind,i={type:'html',html:' '},j=a.lang.dir=='rtl';function k(l,m){var n=function(){var r=this;p(r);m(r,r._.parentDialog);r._.parentDialog.changeFocus(true);},o=function(){p(this);this._.parentDialog.changeFocus();},p=function(r){r.removeListener('ok',n);r.removeListener('cancel',o);},q=function(r){r.on('ok',n);r.on('cancel',o);};a.execCommand(l);if(a._.storedDialogs.colordialog)q(a._.storedDialogs.colordialog);else CKEDITOR.on('dialogDefinition',function(r){if(r.data.name!=l)return;var s=r.data.definition;r.removeListener();s.onLoad=CKEDITOR.tools.override(s.onLoad,function(t){return function(){q(this);s.onLoad=t;if(typeof t=='function')t.call(this);};});});};return{title:c.title,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?450:410,minHeight:CKEDITOR.env.ie&&CKEDITOR.env.quirks?230:200,contents:[{id:'info',label:c.title,accessKey:'I',elements:[{type:'hbox',widths:['40%','5%','40%'],children:[{type:'vbox',padding:0,children:[{type:'hbox',widths:['70%','30%'],children:[{type:'text',id:'width',width:'100px',label:d.width,validate:e.number(c.invalidWidth),onLoad:function(){var l=this.getDialog().getContentElement('info','widthType'),m=l.getElement(),n=this.getInputElement(),o=n.getAttribute('aria-labelledby');n.setAttribute('aria-labelledby',[o,m.$.id].join(' '));},setup:function(l){var m=parseInt(l.getAttribute('width'),10),n=parseInt(l.getStyle('width'),10);!isNaN(m)&&this.setValue(m);!isNaN(n)&&this.setValue(n);},commit:function(l){var m=parseInt(this.getValue(),10),n=this.getDialog().getValueOf('info','widthType');if(!isNaN(m))l.setStyle('width',m+n);else l.removeStyle('width');l.removeAttribute('width');},'default':''},{type:'select',id:'widthType',label:a.lang.table.widthUnit,labelStyle:'visibility:hidden','default':'px',items:[[b.widthPx,'px'],[b.widthPc,'%']],setup:function(l){var m=f.exec(l.getStyle('width')||l.getAttribute('width'));if(m)this.setValue(m[2]);}}]},{type:'hbox',widths:['70%','30%'],children:[{type:'text',id:'height',label:d.height,width:'100px','default':'',validate:e.number(c.invalidHeight),onLoad:function(){var l=this.getDialog().getContentElement('info','htmlHeightType'),m=l.getElement(),n=this.getInputElement(),o=n.getAttribute('aria-labelledby');n.setAttribute('aria-labelledby',[o,m.$.id].join(' '));},setup:function(l){var m=parseInt(l.getAttribute('height'),10),n=parseInt(l.getStyle('height'),10);
+!isNaN(m)&&this.setValue(m);!isNaN(n)&&this.setValue(n);},commit:function(l){var m=parseInt(this.getValue(),10);if(!isNaN(m))l.setStyle('height',CKEDITOR.tools.cssLength(m));else l.removeStyle('height');l.removeAttribute('height');}},{id:'htmlHeightType',type:'html',html:'<br />'+b.widthPx}]},i,{type:'select',id:'wordWrap',label:c.wordWrap,'default':'yes',items:[[c.yes,'yes'],[c.no,'no']],setup:function(l){var m=l.getAttribute('noWrap'),n=l.getStyle('white-space');if(n=='nowrap'||m)this.setValue('no');},commit:function(l){if(this.getValue()=='no')l.setStyle('white-space','nowrap');else l.removeStyle('white-space');l.removeAttribute('noWrap');}},i,{type:'select',id:'hAlign',label:c.hAlign,'default':'',items:[[d.notSet,''],[d.alignLeft,'left'],[d.alignCenter,'center'],[d.alignRight,'right']],setup:function(l){var m=l.getAttribute('align'),n=l.getStyle('text-align');this.setValue(n||m||'');},commit:function(l){var m=this.getValue();if(m)l.setStyle('text-align',m);else l.removeStyle('text-align');l.removeAttribute('align');}},{type:'select',id:'vAlign',label:c.vAlign,'default':'',items:[[d.notSet,''],[d.alignTop,'top'],[d.alignMiddle,'middle'],[d.alignBottom,'bottom'],[c.alignBaseline,'baseline']],setup:function(l){var m=l.getAttribute('vAlign'),n=l.getStyle('vertical-align');switch(n){case 'top':case 'middle':case 'bottom':case 'baseline':break;default:n='';}this.setValue(n||m||'');},commit:function(l){var m=this.getValue();if(m)l.setStyle('vertical-align',m);else l.removeStyle('vertical-align');l.removeAttribute('vAlign');}}]},i,{type:'vbox',padding:0,children:[{type:'select',id:'cellType',label:c.cellType,'default':'td',items:[[c.data,'td'],[c.header,'th']],setup:function(l){this.setValue(l.getName());},commit:function(l){l.renameNode(this.getValue());}},i,{type:'text',id:'rowSpan',label:c.rowSpan,'default':'',validate:e.integer(c.invalidRowSpan),setup:function(l){var m=parseInt(l.getAttribute('rowSpan'),10);if(m&&m!=1)this.setValue(m);},commit:function(l){var m=parseInt(this.getValue(),10);if(m&&m!=1)l.setAttribute('rowSpan',this.getValue());else l.removeAttribute('rowSpan');}},{type:'text',id:'colSpan',label:c.colSpan,'default':'',validate:e.integer(c.invalidColSpan),setup:function(l){var m=parseInt(l.getAttribute('colSpan'),10);if(m&&m!=1)this.setValue(m);},commit:function(l){var m=parseInt(this.getValue(),10);if(m&&m!=1)l.setAttribute('colSpan',this.getValue());else l.removeAttribute('colSpan');}},i,{type:'hbox',padding:0,widths:['60%','40%'],children:[{type:'text',id:'bgColor',label:c.bgColor,'default':'',setup:function(l){var m=l.getAttribute('bgColor'),n=l.getStyle('background-color');
+this.setValue(n||m);},commit:function(l){var m=this.getValue();if(m)l.setStyle('background-color',this.getValue());else l.removeStyle('background-color');l.removeAttribute('bgColor');}},{type:'button',id:'bgColorChoose','class':'colorChooser',label:c.chooseColor,onLoad:function(){this.getElement().getParent().setStyle('vertical-align','bottom');},onClick:function(){var l=this;k('colordialog',function(m){l.getDialog().getContentElement('info','bgColor').setValue(m.getContentElement('picker','selectedColor').getValue());});}}]},i,{type:'hbox',padding:0,widths:['60%','40%'],children:[{type:'text',id:'borderColor',label:c.borderColor,'default':'',setup:function(l){var m=l.getAttribute('borderColor'),n=l.getStyle('border-color');this.setValue(n||m);},commit:function(l){var m=this.getValue();if(m)l.setStyle('border-color',this.getValue());else l.removeStyle('border-color');l.removeAttribute('borderColor');}},{type:'button',id:'borderColorChoose','class':'colorChooser',label:c.chooseColor,style:(j?'margin-right':'margin-left')+': 10px',onLoad:function(){this.getElement().getParent().setStyle('vertical-align','bottom');},onClick:function(){var l=this;k('colordialog',function(m){l.getDialog().getContentElement('info','borderColor').setValue(m.getContentElement('picker','selectedColor').getValue());});}}]}]}]}]}],onShow:function(){var l=this;l.cells=CKEDITOR.plugins.tabletools.getSelectedCells(l._.editor.getSelection());l.setupContent(l.cells[0]);},onOk:function(){var r=this;var l=r._.editor.getSelection(),m=l.createBookmarks(),n=r.cells;for(var o=0;o<n.length;o++)r.commitContent(n[o]);l.selectBookmarks(m);var p=l.getStartElement(),q=new CKEDITOR.dom.elementPath(p);r._.editor._.selectionPreviousPath=q;r._.editor.fire('selectionChange',{selection:l,path:q,element:p});}};});
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/templates/dialogs/templates.js b/appsrc/ODS-Framework/ckeditor/plugins/templates/dialogs/templates.js
index e1124a2..57546ce 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/templates/dialogs/templates.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/templates/dialogs/templates.js
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-(function(){var a=CKEDITOR.document;CKEDITOR.dialog.add('templates',function(b){function c(i,j){i.setHtml('');for(var k=0;k<j.length;k++){var l=CKEDITOR.getTemplates(j[k]),m=l.imagesPath,n=l.templates,o=n.length;for(var p=0;p<o;p++){var q=n[p],r=d(q,m);r.setAttribute('aria-posinset',p+1);r.setAttribute('aria-setsize',o);i.append(r);}}};function d(i,j){var k=CKEDITOR.dom.element.createFromHtml('<a href="javascript:void(0)" tabIndex="-1" role="option" ><div class="cke_tpl_item"></div></a>'),l='<table style="width:350px;" class="cke_tpl_preview" role="presentation"><tr>';if(i.image&&j)l+='<td class="cke_tpl_preview_img"><img src="'+CKEDITOR.getUrl(j+i.image)+'"'+(CKEDITOR.env.ie6Compat?' onload="this.width=this.width"':'')+' alt="" title=""></td>';l+='<td style="white-space:normal;"><span class="cke_tpl_title">'+i.title+'</span><br/>';if(i.description)l+='<span>'+i.description+'</span>';l+='</td></tr></table>';k.getFirst().setHtml(l);k.on('click',function(){e(i.html);});return k;};function e(i){var j=CKEDITOR.dialog.getCurrent(),k=j.getValueOf('selectTpl','chkInsertOpt');if(k){b.on('contentDom',function(l){l.removeListener();j.hide();var m=new CKEDITOR.dom.range(b.document);m.moveToElementEditStart(b.document.getBody());m.select(true);setTimeout(function(){b.fire('saveSnapshot');},0);});b.fire('saveSnapshot');b.setData(i);}else{b.insertHtml(i);j.hide();}};function f(i){var j=i.data.getTarget(),k=g.equals(j);if(k||g.contains(j)){var l=i.data.getKeystroke(),m=g.getElementsByTag('a'),n;if(m){if(k)n=m.getItem(0);else switch(l){case 40:n=j.getNext();break;case 38:n=j.getPrevious();break;case 13:case 32:j.fire('click');}if(n){n.focus();i.data.preventDefault();}}}};CKEDITOR.skins.load(b,'templates');var g,h='cke_tpl_list_label_'+CKEDITOR.tools.getNextNumber();return{title:b.lang.templates.title,minWidth:CKEDITOR.env.ie?440:400,minHeight:340,contents:[{id:'selectTpl',label:b.lang.templates.title,elements:[{type:'vbox',padding:5,children:[{type:'html',html:'<span>'+b.lang.templates.selectPromptMsg+'</span>'},{id:'templatesList',type:'html',focus:true,html:'<div class="cke_tpl_list" tabIndex="-1" role="listbox" aria-labelledby="'+h+'">'+'<div class="cke_tpl_loading"><span></span></div>'+'</div>'+'<span class="cke_voice_label" id="'+h+'">'+b.lang.templates.options+'</span>'},{id:'chkInsertOpt',type:'checkbox',label:b.lang.templates.insertOption,'default':b.config.templates_replaceContent}]}]}],buttons:[CKEDITOR.dialog.cancelButton],onShow:function(){var i=this.getContentElement('selectTpl','templatesList');
-g=i.getElement();CKEDITOR.loadTemplates(b.config.templates_files,function(){var j=b.config.templates.split(',');if(j.length){c(g,j);i.focus();}else g.setHtml('<div class="cke_tpl_empty"><span>'+b.lang.templates.emptyListMsg+'</span>'+'</div>');});this._.element.on('keydown',f);},onHide:function(){this._.element.removeListener('keydown',f);}};});})();
+(function(){var a=CKEDITOR.document;CKEDITOR.dialog.add('templates',function(b){function c(k,l){k.setHtml('');for(var m=0,n=l.length;m<n;m++){var o=CKEDITOR.getTemplates(l[m]),p=o.imagesPath,q=o.templates,r=q.length;for(var s=0;s<r;s++){var t=q[s],u=d(t,p);u.setAttribute('aria-posinset',s+1);u.setAttribute('aria-setsize',r);k.append(u);}}};function d(k,l){var m=CKEDITOR.dom.element.createFromHtml('<a href="javascript:void(0)" tabIndex="-1" role="option" ><div class="cke_tpl_item"></div></a>'),n='<table style="width:350px;" class="cke_tpl_preview" role="presentation"><tr>';if(k.image&&l)n+='<td class="cke_tpl_preview_img"><img src="'+CKEDITOR.getUrl(l+k.image)+'"'+(CKEDITOR.env.ie6Compat?' onload="this.width=this.width"':'')+' alt="" title=""></td>';n+='<td style="white-space:normal;"><span class="cke_tpl_title">'+k.title+'</span><br/>';if(k.description)n+='<span>'+k.description+'</span>';n+='</td></tr></table>';m.getFirst().setHtml(n);m.on('click',function(){e(k.html);});return m;};function e(k){var l=CKEDITOR.dialog.getCurrent(),m=l.getValueOf('selectTpl','chkInsertOpt');if(m){b.on('contentDom',function(n){n.removeListener();l.hide();var o=new CKEDITOR.dom.range(b.document);o.moveToElementEditStart(b.document.getBody());o.select(1);setTimeout(function(){b.fire('saveSnapshot');},0);});b.fire('saveSnapshot');b.setData(k);}else{b.insertHtml(k);l.hide();}};function f(k){var l=k.data.getTarget(),m=g.equals(l);if(m||g.contains(l)){var n=k.data.getKeystroke(),o=g.getElementsByTag('a'),p;if(o){if(m)p=o.getItem(0);else switch(n){case 40:p=l.getNext();break;case 38:p=l.getPrevious();break;case 13:case 32:l.fire('click');}if(p){p.focus();k.data.preventDefault();}}}};CKEDITOR.skins.load(b,'templates');var g,h='cke_tpl_list_label_'+CKEDITOR.tools.getNextNumber(),i=b.lang.templates,j=b.config;return{title:b.lang.templates.title,minWidth:CKEDITOR.env.ie?440:400,minHeight:340,contents:[{id:'selectTpl',label:i.title,elements:[{type:'vbox',padding:5,children:[{type:'html',html:'<span>'+i.selectPromptMsg+'</span>'},{id:'templatesList',type:'html',focus:true,html:'<div class="cke_tpl_list" tabIndex="-1" role="listbox" aria-labelledby="'+h+'">'+'<div class="cke_tpl_loading"><span></span></div>'+'</div>'+'<span class="cke_voice_label" id="'+h+'">'+i.options+'</span>'},{id:'chkInsertOpt',type:'checkbox',label:i.insertOption,'default':j.templates_replaceContent}]}]}],buttons:[CKEDITOR.dialog.cancelButton],onShow:function(){var k=this.getContentElement('selectTpl','templatesList');
+g=k.getElement();CKEDITOR.loadTemplates(j.templates_files,function(){var l=(j.templates||'default').split(',');if(l.length){c(g,l);k.focus();}else g.setHtml('<div class="cke_tpl_empty"><span>'+i.emptyListMsg+'</span>'+'</div>');});this._.element.on('keydown',f);},onHide:function(){this._.element.removeListener('keydown',f);}};});})();
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/templates/templates/default.js b/appsrc/ODS-Framework/ckeditor/plugins/templates/templates/default.js
index 9ed80b0..a45be8a 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/templates/templates/default.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/templates/templates/default.js
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/ciframe.html b/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/ciframe.html
index ca742c6..f880177 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/ciframe.html
+++ b/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/ciframe.html
@@ -1,6 +1,6 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <!--
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 -->
 <html>
@@ -16,7 +16,7 @@ function gup( name )
 	var regex = new RegExp( regexS ) ;
 	var results = regex.exec( window.location.href ) ;
 
-	if( results )
+	if ( results )
 		return results[ 1 ] ;
 	else
 		return '' ;
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/tmpFrameset.html b/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/tmpFrameset.html
index c7f7ab5..bec11ae 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/tmpFrameset.html
+++ b/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/tmpFrameset.html
@@ -1,6 +1,6 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
 <!--
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 -->
 <html>
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/wsc.css b/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/wsc.css
index 88ab595..83a2785 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/wsc.css
+++ b/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/wsc.css
@@ -1,6 +1,6 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-html,body{background-color:transparent;margin:0;padding:0;}body{padding:10px;}body,td,input,select,textarea{font-size:11px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;}.midtext{padding:0;margin:10px;}.midtext p{padding:0;margin:10px;}.Button{border:#737357 1px solid;color:#3b3b1f;background-color:#c7c78f;}.PopupTabArea{color:#737357;background-color:#e3e3c7;}.PopupTitleBorder{border-bottom:#d5d59d 1px solid;}.PopupTabEmptyArea{padding-left:10px;border-bottom:#d5d59d 1px solid;}.PopupTab,.PopupTabSelected{border-right:#d5d59d 1px solid;border-top:#d5d59d 1px solid;border-left:#d5d59d 1px solid;padding:3px 5px 3px 5px;color:#737357;}.PopupTab{margin-top:1px;border-bottom:#d5d59d 1px solid;cursor:pointer;cursor:hand;}.PopupTabSelected{font-weight:bold;cursor:default;padding-top:4px;border-bottom:#f1f1e3 1px solid;background-color:#f1f1e3;}
+html,body{background-color:transparent;margin:0;padding:0;}body{padding:10px;}body,td,input,select,textarea{font-size:11px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;}.midtext{padding:0;margin:10px;}.midtext p{padding:0;margin:10px;}.Button{border:#737357 1px solid;color:#3b3b1f;background-color:#c7c78f;}.PopupTabArea{color:#737357;background-color:#e3e3c7;}.PopupTitleBorder{border-bottom:#d5d59d 1px solid;}.PopupTabEmptyArea{padding-left:10px;border-bottom:#d5d59d 1px solid;}.PopupTab,.PopupTabSelected{border-right:#d5d59d 1px solid;border-top:#d5d59d 1px solid;border-left:#d5d59d 1px solid;padding:3px 5px 3px 5px;color:#737357;}.PopupTab{margin-top:1px;border-bottom:#d5d59d 1px solid;cursor:pointer;}.PopupTabSelected{font-weight:bold;cursor:default;padding-top:4px;border-bottom:#f1f1e3 1px solid;background-color:#f1f1e3;}
diff --git a/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/wsc.js b/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/wsc.js
index cb9594e..2752d0a 100644
--- a/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/wsc.js
+++ b/appsrc/ODS-Framework/ckeditor/plugins/wsc/dialogs/wsc.js
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.dialog.add('checkspell',function(a){var b=CKEDITOR.tools.getNextNumber(),c='cke_frame_'+b,d='cke_data_'+b,e='cke_error_'+b,f,g=document.location.protocol||'http:',h=a.lang.spellCheck.notAvailable,i='<textarea style="display: none" id="'+d+'"'+' rows="10"'+' cols="40">'+' </textarea><div'+' id="'+e+'"'+' style="display:none;color:red;font-size:16px;font-weight:bold;padding-top:160px;text-align:center;z-index:11;">'+'</div><iframe'+' src=""'+' style="width:485px;background-color:#f1f1e3;height:380px"'+' frameborder="0"'+' name="'+c+'"'+' id="'+c+'"'+' allowtransparency="1">'+'</iframe>',j=a.config.wsc_customLoaderScript||g+'//loader.spellchecker.net/sproxy_fck/sproxy.php'+'?plugin=fck2'+'&customerid='+a.config.wsc_customerId+'&cmd=script&doc=wsc&schema=22';if(a.config.wsc_customLoaderScript)h+='<p style="color:#000;font-size:11px;font-weight: normal;text-align:center;padding-top:10px">'+a.lang.spellCheck.errorLoading.replace(/%s/g,a.config.wsc_customLoaderScript)+'</p>';function k(m,n){var o=0;return function(){if(typeof window.doSpell=='function'){if(typeof f!='undefined')window.clearInterval(f);l(m);}else if(o++==180)window._cancelOnError(n);};};window._cancelOnError=function(m){if(typeof window.WSC_Error=='undefined'){CKEDITOR.document.getById(c).setStyle('display','none');var n=CKEDITOR.document.getById(e);n.setStyle('display','block');n.setHtml(m||a.lang.spellCheck.notAvailable);}};function l(m){var n=new window._SP_FCK_LangCompare(),o=CKEDITOR.getUrl(a.plugins.wsc.path+'dialogs/'),p=o+'tmpFrameset.html';window.gFCKPluginName='wsc';n.setDefaulLangCode(a.config.defaultLanguage);window.doSpell({ctrl:d,lang:a.config.wsc_lang||n.getSPLangCode(a.langCode),intLang:a.config.wsc_uiLang||n.getSPLangCode(a.langCode),winType:c,onCancel:function(){m.hide();},onFinish:function(q){a.focus();m.getParentEditor().setData(q.value);m.hide();},staticFrame:p,framesetPath:p,iframePath:o+'ciframe.html',schemaURI:o+'wsc.css',userDictionaryName:a.config.wsc_userDictionaryName,customDictionaryName:a.config.wsc_customDictionaryIds&&a.config.wsc_customDictionaryIds.split(','),domainName:a.config.wsc_domainName});CKEDITOR.document.getById(e).setStyle('display','none');CKEDITOR.document.getById(c).setStyle('display','block');};return{title:a.config.wsc_dialogTitle||a.lang.spellCheck.title,minWidth:485,minHeight:380,buttons:[CKEDITOR.dialog.cancelButton],onShow:function(){var m=this.getContentElement('general','content').getElement();m.setHtml(i);if(typeof window.doSpell!='function')CKEDITOR.document.getHead().append(CKEDITOR.document.createElement('script',{attributes:{type:'text/javascript',src:j}}));
-var n=a.getData();CKEDITOR.document.getById(d).setValue(n);f=window.setInterval(k(this,h),250);},onHide:function(){window.ooo=undefined;window.int_framsetLoaded=undefined;window.framesetLoaded=undefined;window.is_window_opened=false;},contents:[{id:'general',label:a.config.wsc_dialogTitle||a.lang.spellCheck.title,padding:0,elements:[{type:'html',id:'content',style:'width:485;height:380px',html:'<div></div>'}]}]};});
+CKEDITOR.dialog.add('checkspell',function(a){var b=CKEDITOR.tools.getNextNumber(),c='cke_frame_'+b,d='cke_data_'+b,e='cke_error_'+b,f,g=document.location.protocol||'http:',h=a.lang.spellCheck.notAvailable,i='<textarea style="display: none" id="'+d+'"'+' rows="10"'+' cols="40">'+' </textarea><div'+' id="'+e+'"'+' style="display:none;color:red;font-size:16px;font-weight:bold;padding-top:160px;text-align:center;z-index:11;">'+'</div><iframe'+' src=""'+' style="width:100%;background-color:#f1f1e3;"'+' frameborder="0"'+' name="'+c+'"'+' id="'+c+'"'+' allowtransparency="1">'+'</iframe>',j=a.config.wsc_customLoaderScript||g+'//loader.spellchecker.net/sproxy_fck/sproxy.php'+'?plugin=fck2'+'&customerid='+a.config.wsc_customerId+'&cmd=script&doc=wsc&schema=22';if(a.config.wsc_customLoaderScript)h+='<p style="color:#000;font-size:11px;font-weight: normal;text-align:center;padding-top:10px">'+a.lang.spellCheck.errorLoading.replace(/%s/g,a.config.wsc_customLoaderScript)+'</p>';function k(m,n){var o=0;return function(){if(typeof window.doSpell=='function'){if(typeof f!='undefined')window.clearInterval(f);l(m);}else if(o++==180)window._cancelOnError(n);};};window._cancelOnError=function(m){if(typeof window.WSC_Error=='undefined'){CKEDITOR.document.getById(c).setStyle('display','none');var n=CKEDITOR.document.getById(e);n.setStyle('display','block');n.setHtml(m||a.lang.spellCheck.notAvailable);}};function l(m){var n=new window._SP_FCK_LangCompare(),o=CKEDITOR.getUrl(a.plugins.wsc.path+'dialogs/'),p=o+'tmpFrameset.html';window.gFCKPluginName='wsc';n.setDefaulLangCode(a.config.defaultLanguage);window.doSpell({ctrl:d,lang:a.config.wsc_lang||n.getSPLangCode(a.langCode),intLang:a.config.wsc_uiLang||n.getSPLangCode(a.langCode),winType:c,onCancel:function(){m.hide();},onFinish:function(q){a.focus();m.getParentEditor().setData(q.value);m.hide();},staticFrame:p,framesetPath:p,iframePath:o+'ciframe.html',schemaURI:o+'wsc.css',userDictionaryName:a.config.wsc_userDictionaryName,customDictionaryName:a.config.wsc_customDictionaryIds&&a.config.wsc_customDictionaryIds.split(','),domainName:a.config.wsc_domainName});CKEDITOR.document.getById(e).setStyle('display','none');CKEDITOR.document.getById(c).setStyle('display','block');};return{title:a.config.wsc_dialogTitle||a.lang.spellCheck.title,minWidth:485,minHeight:380,buttons:[CKEDITOR.dialog.cancelButton],onShow:function(){var m=this.getContentElement('general','content').getElement();m.setHtml(i);m.getChild(2).setStyle('height',this._.contentSize.height+'px');
+if(typeof window.doSpell!='function')CKEDITOR.document.getHead().append(CKEDITOR.document.createElement('script',{attributes:{type:'text/javascript',src:j}}));var n=a.getData();CKEDITOR.document.getById(d).setValue(n);f=window.setInterval(k(this,h),250);},onHide:function(){window.ooo=undefined;window.int_framsetLoaded=undefined;window.framesetLoaded=undefined;window.is_window_opened=false;},contents:[{id:'general',label:a.config.wsc_dialogTitle||a.lang.spellCheck.title,padding:0,elements:[{type:'html',id:'content',html:''}]}]};});CKEDITOR.dialog.on('resize',function(a){var b=a.data,c=b.dialog;if(c._.name=='checkspell'){var d=c.getContentElement('general','content').getElement(),e=d&&d.getChild(2);e&&e.setSize('height',b.height);e&&e.setSize('width',b.width);}});
diff --git a/appsrc/ODS-Framework/ckeditor/skins/kama/dialog.css b/appsrc/ODS-Framework/ckeditor/skins/kama/dialog.css
index 0afbd64..5bbb430 100644
--- a/appsrc/ODS-Framework/ckeditor/skins/kama/dialog.css
+++ b/appsrc/ODS-Framework/ckeditor/skins/kama/dialog.css
@@ -1,9 +1,9 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-body .cke_dialog{visibility:visible;}.cke_skin_kama table.cke_dialog.cke_browser_gecko{display:block;}.cke_skin_kama .cke_dialog_body{z-index:1;border:solid 1px #ddd;padding:5px;background-color:#fff;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;position:relative;_position:static;}.cke_skin_kama .cke_dialog_tl,.cke_skin_kama .cke_dialog_tr,.cke_skin_kama .cke_dialog_tc,.cke_skin_kama .cke_dialog_bl,.cke_skin_kama .cke_dialog_br,.cke_skin_kama .cke_dialog_bc,.cke_skin_kama .cke_dialog_ml,.cke_skin_kama .cke_dialog_mr{display:none;}.cke_skin_kama .cke_dialog_title{font-weight:bold;font-size:14px;padding:3px 3px 8px;cursor:move;position:relative;border-bottom:1px solid #eee;}.cke_skin_kama .cke_browser_iequirks .cke_dialog_title,.cke_skin_kama .cke_browser_ie6 .cke_dialog_title,.cke_skin_kama .cke_browser_ie7 .cke_dialog_title{margin-bottom:22px;}.cke_skin_kama .cke_browser_iequirks.cke_single_page .cke_dialog_title,.cke_skin_kama .cke_browser_ie6.cke_single_page .cke_dialog_title,.cke_skin_kama .cke_browser_ie7.cke_single_page .cke_dialog_title{margin-bottom:10px;}.cke_skin_kama .cke_dialog_contents{background-color:#ebebeb;border:solid 1px #fff;border-bottom:none;overflow:auto;padding:17px 10px 5px 10px;-moz-border-radius-topleft:5px;-moz-border-radius-topright:5px;-webkit-border-top-left-radius:5px;-webkit-border-top-right-radius:5px;border-top-left-radius:5px;border-top-right-radius:5px;margin-top:22px;}.cke_skin_kama .cke_dialog_footer{text-align:right;background-color:#ebebeb;border:solid 1px #fff;border-bottom:none;-moz-border-radius-bottomleft:5px;-moz-border-radius-bottomright:5px;-webkit-border-bottom-left-radius:5px;-webkit-border-bottom-right-radius:5px;border-bottom-left-radius:5px;border-bottom-right-radius:5px;}.cke_skin_kama .cke_rtl .cke_dialog_footer{text-align:left;}.cke_skin_kama .cke_dialog_tabs{height:23px;display:inline-block;_display:block;margin-left:10px;margin-right:10px;margin-top:11px;position:absolute;z-index:2;}.cke_skin_kama .cke_browser_iequirks .cke_dialog_tabs,.cke_skin_kama .cke_browser_ie6 .cke_dialog_tabs,.cke_skin_kama .cke_browser_ie7 .cke_dialog_tabs{top:33px;}.cke_skin_kama .cke_rtl .cke_dialog_tabs{right:10px;}.cke_skin_kama a.cke_dialog_tab,.cke_skin_kama a:link.cke_dialog_tab,.cke_skin_kama a:active.cke_dialog_tab,.cke_skin_kama a:hover.cke_dialog_tab,.cke_skin_kama a:visited.cke_dialog_tab{background-image:url(images/sprites.png);background-repeat:repeat-x;background-position:0 -1323px;background-color:#ebebeb;height:14px;padding:4px 8px;display:inline-block;cursor:pointer;}.cke_skin_kama .cke_browser_gecko18 a.cke_dialog_tab,.cke_skin_kama .cke_browser_gecko18 a:link.cke_dialog_tab,.cke_skin_kama .cke_browser_gecko18 a:active.cke_dialog_tab,.cke_skin_kama .cke_browser_gecko18 a:hover.cke_dialog_tab,.cke_skin_kama .cke_browser_gecko18 a:visited.cke_dialog_tab{display:inline;position:relative;top:6px;}.cke_skin_kama a:hover.cke_dialog_tab{background-color:#f1f1e3;}.cke_skin_kama .cke_hc a:hover.cke_dialog_tab{padding:2px 6px!important;border-width:3px;}.cke_skin_kama a.cke_dialog_tab_selected,.cke_skin_kama a:link.cke_dialog_tab_selected,.cke_skin_kama a:active.cke_dialog_tab_selected,.cke_skin_kama a:hover.cke_dialog_tab_selected,.cke_skin_kama a:visited.cke_dialog_tab_selected{background-position:0 -1279px;cursor:default;}.cke_skin_kama .cke_hc a.cke_dialog_tab_selected,.cke_skin_kama .cke_hc a:link.cke_dialog_tab_selected,.cke_skin_kama .cke_hc a:active.cke_dialog_tab_selected,.cke_skin_kama .cke_hc a:hover.cke_dialog_tab_selected,.cke_skin_kama .cke_hc a:visited.cke_dialog_tab_selected{padding:2px 6px!important;border-width:3px;}.cke_skin_kama .cke_single_page .cke_dialog_tabs{display:none;}.cke_skin_kama .cke_single_page .cke_dialog_contents{padding-top:5px;margin-top:10px;}.cke_skin_kama .cke_browser_ie7.cke_single_page .cke_dialog_contents{margin-top:0;position:relative;margin-bottom:-22px;}.cke_skin_kama .cke_dialog_ui_vbox table,.cke_skin_kama .cke_dialog_ui_hbox table{margin:auto;}.cke_skin_kama .cke_dialog_ui_vbox_child{padding:5px 0;}.cke_skin_kama input.cke_dialog_ui_input_text,.cke_skin_kama input.cke_dialog_ui_input_password{background-color:white;border:none;padding:0;width:100%;height:14px;}
-.cke_skin_kama div.cke_dialog_ui_input_text,.cke_skin_kama div.cke_dialog_ui_input_password{background-color:white;border:1px solid #a0a0a0;padding:1px 0;}.cke_skin_kama .cke_browser_gecko.cke_hc div.cke_dialog_ui_input_text,.cke_skin_kama .cke_browser_gecko.cke_hc div.cke_dialog_ui_input_password{border-width:0;}.cke_skin_kama .cke_browser_gecko18.cke_hc div.cke_dialog_ui_input_text,.cke_skin_kama .cke_browser_gecko18.cke_hc div.cke_dialog_ui_input_password{border-width:1px;}.cke_skin_kama textarea.cke_dialog_ui_input_textarea{background-color:white;border:none;padding:0;width:100%;_width:99%;overflow:auto;resize:none;}.cke_skin_kama div.cke_dialog_ui_input_textarea{background-color:white;border:1px solid #a0a0a0;padding:1px 0;}.cke_skin_kama div.cke_disabled .cke_dialog_ui_labeled_content *{background-color:#a0a0a0;cursor:default;}.cke_skin_kama .cke_dialog_ui_hbox{width:100%;}.cke_skin_kama .cke_dialog_ui_hbox_first,.cke_skin_kama .cke_dialog_ui_hbox_child,.cke_skin_kama .cke_dialog_ui_hbox_last{vertical-align:top;}.cke_skin_kama .cke_ltr .cke_dialog_ui_hbox_first,.cke_skin_kama .cke_ltr .cke_dialog_ui_hbox_child{padding-right:10px;}.cke_skin_kama .cke_rtl .cke_dialog_ui_hbox_first,.cke_skin_kama .cke_rtl .cke_dialog_ui_hbox_child{padding-left:10px;}.cke_skin_kama a.cke_dialog_ui_button{border-collapse:separate;cursor:default;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;background:transparent url(images/sprites.png) repeat-x scroll 0 -1069px;_background:none;padding:5px 0;text-align:center;}.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button{padding:0;}.cke_skin_kama .cke_browser_ie6 a.cke_dialog_ui_button span{width:70px;}.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button span{width:100px;}.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_ie6 a.cke_dialog_ui_button span{padding:5px 15px;text-align:center;color:#3b3b1f;background:#53D9F0 none;display:inline-block;cursor:default;}.cke_skin_kama .cke_browser_webkit a.cke_dialog_ui_button span.cke_dialog_ui_button{margin:0;}.cke_skin_kama .cke_browser_webkit a.cke_dialog_ui_button{display:inline-block;padding-top:3px;padding-bottom:2px;margin:2px 0;}.cke_skin_kama a.cke_dialog_ui_button_ok span,.cke_skin_kama a.cke_dialog_ui_button_cancel span{padding-right:20px;padding-left:20px;}.cke_skin_kama a.cke_dialog_ui_button_ok{background-position:0 -1143px;}.cke_skin_kama a.cke_dialog_ui_button_ok span{background:transparent url(images/sprites.png) no-repeat scroll right -1219px;}.cke_skin_kama .cke_rtl a.cke_dialog_ui_button_ok span{background-position:left -1219px;}.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button_ok span,.cke_skin_kama .cke_browser_ie6 a.cke_dialog_ui_button_ok span{background-color:#B8E834;margin-right:0;}.cke_skin_kama a.cke_dialog_ui_button_cancel{background-position:0 -1104px;}.cke_skin_kama a.cke_dialog_ui_button_cancel span{background:transparent url(images/sprites.png) no-repeat scroll right -1245px;}.cke_skin_kama .cke_rtl a.cke_dialog_ui_button_cancel span{background-position:left -1245px;}.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button_cancel span,.cke_skin_kama .cke_browser_ie6 a.cke_dialog_ui_button_cancel span{background-color:#F65D20;}.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button_cancel span,.cke_skin_kama .cke_browser_ie6 a.cke_dialog_ui_button_cancel span,.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button_ok span,.cke_skin_kama .cke_browser_ie6 a.cke_dialog_ui_button_ok span{background-image:none;}.cke_skin_kama span.cke_dialog_ui_button{padding:2px 10px;text-align:center;color:#222;display:inline-block;cursor:default;min-width:60px;+margin:2px 0;}.cke_skin_kama .cke_browser_gecko18 .cke_dialog_footer_buttons span.cke_dialog_ui_button{display:block;}.cke_skin_kama a.cke_dialog_ui_button span.cke_disabled{border:#898980 1px solid;color:#5e5e55;background-color:#c5c5b3;}.cke_skin_kama a:hover.cke_dialog_ui_button,.cke_skin_kama a:focus.cke_dialog_ui_button,.cke_skin_kama a:active.cke_dialog_ui_button{background-position:0 -1179px;}
-.cke_skin_kama .cke_hc a:hover.cke_dialog_ui_button,.cke_skin_kama .cke_hc a:focus.cke_dialog_ui_button,.cke_skin_kama .cke_hc a:active.cke_dialog_ui_button{border-width:2px;}.cke_skin_kama .cke_browser_iequirks a:hover.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_iequirks a:focus.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_iequirks a:active.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_ie6 a:hover.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_ie6 a:focus.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_ie6 a:active.cke_dialog_ui_button span{background-image:none;background:#F7A922;}.cke_skin_kama .cke_dialog_footer_buttons{display:inline-table;margin-right:12px;margin-left:12px;width:auto;position:relative;}.cke_skin_kama .cke_browser_gecko18 .cke_dialog_footer_buttons{display:inline;}.cke_skin_kama .cke_dialog_footer_buttons span.cke_dialog_ui_button{margin:7px 0;width:60px;text-align:center;}.cke_skin_kama .cke_browser_gecko18 .cke_dialog_footer_buttons a.cke_dialog_ui_button{display:block;padding:0;}.cke_skin_kama .cke_browser_gecko18 .cke_dialog_footer_buttons span.cke_dialog_ui_button{padding-bottom:5px;padding-top:6px;margin-bottom:0;}.cke_skin_kama .cke_browser_gecko18 .cke_dialog_footer_buttons .cke_dialog_ui_button_ok .cke_dialog_ui_button{background-position:right -1214px;}.cke_skin_kama .cke_browser_gecko18 .cke_dialog_footer_buttons .cke_dialog_ui_button_cancel .cke_dialog_ui_button{background-position:right -1242px;}.cke_skin_kama strong{font-weight:bold;}.cke_skin_kama .cke_dialog .cke_dialog_body .cke_dialog_close_button{background-image:url(images/sprites.png);background-repeat:no-repeat;background-position:0 -1022px;position:absolute;cursor:pointer;text-align:center;height:20px;width:20px;top:5px;_background-image:url(images/sprites_ie6.png);}.cke_skin_kama .cke_dialog_close_button span{display:none;}.cke_skin_kama .cke_dialog_close_button:hover{background-position:0 -1045px;}.cke_skin_kama .cke_ltr .cke_dialog_close_button{right:10px;}.cke_skin_kama .cke_browser_ie8.cke_rtl .cke_dialog_close_button{left:8px;}.cke_skin_kama .cke_rtl .cke_dialog_close_button{left:10px;}.cke_skin_kama .cke_browser_ie7.cke_rtl .cke_dialog_close_button{left:16px;top:0;}.cke_skin_kama .cke_browser_ie7.cke_rtl .cke_dialog_close_button{position:absolute;left:10px;top:5px;}.cke_skin_kama .cke_browser_ie7.cke_single_page .cke_dialog_footer{margin-top:22px;}.cke_skin_kama .cke_browser_ie6 .cke_dialog_close_button,.cke_skin_kama .cke_browser_iequirks .cke_dialog_close_button{top:7px;}.cke_skin_kama .cke_browser_ie7.cke_ltr .cke_dialog_close_button{margin-top:0;}.cke_skin_kama .cke_dialog_ui_input_select{border:1px solid #a0a0a0;background-color:white;}.cke_skin_kama iframe.cke_dialog_ui_input_file{width:100%;height:25px;}.cke_skin_kama .cke_dialog .cke_dark_background{background-color:#eaead1;}.cke_skin_kama .cke_dialog .cke_hand{cursor:pointer;}.cke_skin_kama .cke_dialog .cke_centered{text-align:center;}.cke_skin_kama .cke_dialog a.cke_btn_reset{float:right;background-position:0 -32px;background-image:url(images/mini.gif);width:16px;height:16px;background-repeat:no-repeat;border:1px none;font-size:1px;}.cke_skin_kama .cke_rtl .cke_dialog a.cke_btn_reset{float:left;}.cke_skin_kama .cke_dialog a.cke_btn_locked,.cke_skin_kama .cke_dialog a.cke_btn_unlocked{float:left;background-position:0 0;background-image:url(images/mini.gif);width:16px;height:16px;background-repeat:no-repeat;border:none 1px;font-size:1px;}.cke_skin_kama .cke_rtl .cke_dialog a.cke_btn_locked,.cke_skin_kama .cke_rtl .cke_dialog a.cke_btn_unlocked{float:right;}.cke_skin_kama .cke_dialog a.cke_btn_unlocked{background-position:0 -16px;background-image:url(images/mini.gif);}.cke_skin_kama .cke_dialog .cke_btn_over{border:outset 1px;cursor:pointer;cursor:hand;}.cke_skin_kama .cke_dialog .ImagePreviewBox{border:2px ridge black;overflow:scroll;height:160px;width:230px;padding:2px;background-color:white;}.cke_skin_kama .cke_dialog .ImagePreviewBox table td{white-space:normal;}.cke_skin_kama .cke_browser_iequirks .cke_dialog_page_contents{_position:absolute;}
-.cke_skin_kama .cke_dialog .ImagePreviewLoader{position:absolute;white-space:normal;overflow:hidden;height:160px;width:230px;margin:2px;padding:2px;opacity:.9;filter:alpha(opacity=90);background-color:#e4e4e4;}.cke_skin_kama .cke_dialog .FlashPreviewBox{white-space:normal;border:2px ridge black;overflow:auto;height:160px;width:390px;padding:2px;background-color:white;}.cke_skin_kama .cke_dialog .cke_dark_background{text-align:center;background-color:#eaead1;font-size:14px;}.cke_skin_kama .cke_dialog .cke_light_background{text-align:center;background-color:#ffffbe;}.cke_skin_kama .cke_dialog .cke_hand{cursor:pointer;cursor:hand;}.cke_skin_kama .cke_disabled{color:#a0a0a0;}.cke_skin_kama .cke_hc .cke_dialog_title,.cke_skin_kama .cke_hc .cke_dialog_tabs,.cke_skin_kama .cke_hc .cke_dialog_contents,.cke_skin_kama .cke_hc .cke_dialog_footer{border-left:1px solid;border-right:1px solid;}.cke_skin_kama .cke_hc .cke_dialog_title{border-top:1px solid;}.cke_skin_kama .cke_hc .cke_dialog_footer{border-bottom:1px solid;}.cke_skin_kama .cke_hc .cke_dialog_close_button span{display:inline;cursor:pointer;cursor:hand;font-weight:bold;position:relative;top:3px;}.cke_skin_kama .cke_dialog_body .cke_label{display:none;}.cke_skin_kama .cke_hc .cke_dialog_body .cke_label{display:inline;}.cke_skin_kama .cke_hc a.cke_btn_locked,.cke_skin_kama .cke_hc a.cke_btn_unlocked,.cke_skin_kama .cke_hc a.cke_btn_reset{border-style:solid;float:left;width:auto;height:auto;}.cke_skin_kama .cke_rtl.cke_hc a.cke_btn_locked,.cke_skin_kama .cke_rtl.cke_hc a.cke_btn_unlocked,.cke_skin_kama .cke_rtl.cke_hc a.cke_btn_reset{float:right;}.cke_skin_kama a.cke_smile img{border:2px solid #eaead1;}.cke_skin_kama a.cke_smile:focus img,.cke_skin_kama a.cke_smile:active img,.cke_skin_kama a.cke_smile:hover img{border-color:#C7C78F;}.cke_skin_kama .cke_hc .cke_dialog_tabs a,.cke_skin_kama .cke_hc .cke_dialog_footer a{opacity:1.0;filter:alpha(opacity=100);border:1px solid white;}
+body .cke_dialog{visibility:visible;}.cke_skin_kama table.cke_dialog.cke_browser_gecko{display:block;}.cke_skin_kama .cke_dialog_body{z-index:1;border:solid 1px #ddd;padding:5px;background-color:#fff;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;position:relative;_position:static;}.cke_skin_kama .cke_dialog_tl,.cke_skin_kama .cke_dialog_tr,.cke_skin_kama .cke_dialog_tc,.cke_skin_kama .cke_dialog_bl,.cke_skin_kama .cke_dialog_br,.cke_skin_kama .cke_dialog_bc,.cke_skin_kama .cke_dialog_ml,.cke_skin_kama .cke_dialog_mr{display:none;}.cke_skin_kama .cke_dialog_title{font-weight:bold;font-size:14px;padding:3px 3px 8px;cursor:move;position:relative;border-bottom:1px solid #eee;}.cke_skin_kama .cke_browser_iequirks .cke_dialog_title,.cke_skin_kama .cke_browser_ie6 .cke_dialog_title,.cke_skin_kama .cke_browser_ie7 .cke_dialog_title{margin-bottom:22px;}.cke_skin_kama .cke_browser_iequirks.cke_single_page .cke_dialog_title,.cke_skin_kama .cke_browser_ie6.cke_single_page .cke_dialog_title,.cke_skin_kama .cke_browser_ie7.cke_single_page .cke_dialog_title{margin-bottom:10px;}.cke_skin_kama .cke_dialog_contents{background-color:#ebebeb;border:solid 1px #fff;border-bottom:none;overflow:auto;padding:17px 10px 5px 10px;-moz-border-radius-topleft:5px;-moz-border-radius-topright:5px;-webkit-border-top-left-radius:5px;-webkit-border-top-right-radius:5px;border-top-left-radius:5px;border-top-right-radius:5px;margin-top:22px;}.cke_skin_kama .cke_dialog_footer{text-align:right;background-color:#ebebeb;border:solid 1px #fff;border-bottom:none;-moz-border-radius-bottomleft:5px;-moz-border-radius-bottomright:5px;-webkit-border-bottom-left-radius:5px;-webkit-border-bottom-right-radius:5px;border-bottom-left-radius:5px;border-bottom-right-radius:5px;}.cke_skin_kama .cke_rtl .cke_dialog_footer{text-align:left;}.cke_skin_kama .cke_dialog_footer .cke_resizer{margin-top:20px;}.cke_skin_kama .cke_browser_iequirks .cke_dialog_footer .cke_resizer,.cke_skin_kama .cke_browser_ie6 .cke_dialog_footer .cke_resizer{margin-top:27px;}.cke_skin_kama .cke_dialog_tabs{height:23px;display:inline-block;_display:block;margin-left:10px;margin-right:10px;margin-top:11px;position:absolute;z-index:2;}.cke_skin_kama .cke_browser_iequirks .cke_dialog_tabs,.cke_skin_kama .cke_browser_ie6 .cke_dialog_tabs,.cke_skin_kama .cke_browser_ie7 .cke_dialog_tabs{top:33px;}.cke_skin_kama .cke_rtl .cke_dialog_tabs{right:10px;}.cke_skin_kama a.cke_dialog_tab,.cke_skin_kama a:link.cke_dialog_tab,.cke_skin_kama a:active.cke_dialog_tab,.cke_skin_kama a:hover.cke_dialog_tab,.cke_skin_kama a:visited.cke_dialog_tab{background-image:url(images/sprites.png);background-repeat:repeat-x;background-position:0 -1323px;background-color:#ebebeb;height:14px;padding:4px 8px;display:inline-block;cursor:pointer;}.cke_skin_kama .cke_browser_gecko18 a.cke_dialog_tab,.cke_skin_kama .cke_browser_gecko18 a:link.cke_dialog_tab,.cke_skin_kama .cke_browser_gecko18 a:active.cke_dialog_tab,.cke_skin_kama .cke_browser_gecko18 a:hover.cke_dialog_tab,.cke_skin_kama .cke_browser_gecko18 a:visited.cke_dialog_tab{display:inline;position:relative;top:6px;}.cke_skin_kama a:hover.cke_dialog_tab{background-color:#f1f1e3;}.cke_skin_kama .cke_hc a:hover.cke_dialog_tab{padding:2px 6px!important;border-width:3px;}.cke_skin_kama a.cke_dialog_tab_selected,.cke_skin_kama a:link.cke_dialog_tab_selected,.cke_skin_kama a:active.cke_dialog_tab_selected,.cke_skin_kama a:hover.cke_dialog_tab_selected,.cke_skin_kama a:visited.cke_dialog_tab_selected{background-position:0 -1279px;cursor:default;}.cke_skin_kama .cke_hc a.cke_dialog_tab_selected,.cke_skin_kama .cke_hc a:link.cke_dialog_tab_selected,.cke_skin_kama .cke_hc a:active.cke_dialog_tab_selected,.cke_skin_kama .cke_hc a:hover.cke_dialog_tab_selected,.cke_skin_kama .cke_hc a:visited.cke_dialog_tab_selected{padding:2px 6px!important;border-width:3px;}.cke_skin_kama .cke_single_page .cke_dialog_tabs{display:none;}.cke_skin_kama .cke_single_page .cke_dialog_contents{padding-top:5px;margin-top:10px;}.cke_skin_kama .cke_browser_ie7.cke_single_page .cke_dialog_contents{margin-top:0;position:relative;margin-bottom:-22px;}
+.cke_skin_kama .cke_dialog_ui_vbox table,.cke_skin_kama .cke_dialog_ui_hbox table{margin:auto;}.cke_skin_kama .cke_dialog_ui_vbox_child{padding:5px 0;}.cke_skin_kama input.cke_dialog_ui_input_text,.cke_skin_kama input.cke_dialog_ui_input_password{background-color:white;border:none;padding:0;width:100%;height:14px;}.cke_skin_kama div.cke_dialog_ui_input_text,.cke_skin_kama div.cke_dialog_ui_input_password{background-color:white;border:1px solid #a0a0a0;padding:1px 0;}.cke_skin_kama .cke_browser_ie.cke_rtl input.cke_dialog_ui_input_text,.cke_skin_kama .cke_browser_opera.cke_rtl input.cke_dialog_ui_input_text,.cke_skin_kama .cke_browser_ie.cke_rtl input.cke_dialog_ui_input_password,.cke_skin_kama .cke_browser_opera.cke_rtl input.cke_dialog_ui_input_password{padding-right:2px;}.cke_skin_kama .cke_browser_ie.cke_rtl div.cke_dialog_ui_input_text,.cke_skin_kama .cke_browser_opera.cke_rtl div.cke_dialog_ui_input_text,.cke_skin_kama .cke_browser_ie.cke_rtl div.cke_dialog_ui_input_password,.cke_skin_kama .cke_browser_opera.cke_rtl div.cke_dialog_ui_input_password{padding-left:2px;}.cke_skin_kama .cke_browser_ie.cke_rtl .cke_dialog_ui_vbox_child,.cke_skin_kama .cke_browser_ie.cke_rtl .cke_dialog_ui_hbox_child,.cke_skin_kama .cke_browser_ie.cke_rtl .cke_dialog_ui_hbox_first,.cke_skin_kama .cke_browser_ie.cke_rtl .cke_dialog_ui_hbox_last{padding-right:2px!important;}.cke_skin_kama .cke_browser_ie.cke_rtl div.cke_dialog_ui_input_text{padding-right:1px;}.cke_skin_kama .cke_browser_gecko.cke_hc div.cke_dialog_ui_input_text,.cke_skin_kama .cke_browser_gecko.cke_hc div.cke_dialog_ui_input_password{border-width:0;}.cke_skin_kama .cke_browser_gecko18.cke_hc div.cke_dialog_ui_input_text,.cke_skin_kama .cke_browser_gecko18.cke_hc div.cke_dialog_ui_input_password{border-width:1px;}.cke_skin_kama textarea.cke_dialog_ui_input_textarea{background-color:white;border:none;padding:0;width:100%;_width:99%;overflow:auto;resize:none;}.cke_skin_kama div.cke_dialog_ui_input_textarea{background-color:white;border:1px solid #a0a0a0;padding:1px 0;}.cke_skin_kama div.cke_disabled .cke_dialog_ui_labeled_content *{background-color:#a0a0a0;cursor:default;}.cke_skin_kama .cke_dialog_ui_hbox{width:100%;}.cke_skin_kama .cke_dialog_ui_hbox_first,.cke_skin_kama .cke_dialog_ui_hbox_child,.cke_skin_kama .cke_dialog_ui_hbox_last{vertical-align:top;}.cke_skin_kama .cke_ltr .cke_dialog_ui_hbox_first,.cke_skin_kama .cke_ltr .cke_dialog_ui_hbox_child{padding-right:10px;}.cke_skin_kama .cke_rtl .cke_dialog_ui_hbox_first,.cke_skin_kama .cke_rtl .cke_dialog_ui_hbox_child{padding-left:10px;}.cke_skin_kama a.cke_dialog_ui_button{border-collapse:separate;cursor:default;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;background:transparent url(images/sprites.png) repeat-x scroll 0 -1069px;_background:none;padding:5px 0;text-align:center;}.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button{padding:0;}.cke_skin_kama .cke_browser_ie6 a.cke_dialog_ui_button span{width:70px;}.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button span{width:100px;}.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_ie6 a.cke_dialog_ui_button span{padding:5px 15px;text-align:center;color:#3b3b1f;background:#53D9F0 none;display:inline-block;cursor:default;}.cke_skin_kama .cke_browser_webkit a.cke_dialog_ui_button span.cke_dialog_ui_button{margin:0;}.cke_skin_kama .cke_browser_webkit a.cke_dialog_ui_button{display:inline-block;padding-top:3px;padding-bottom:2px;margin:2px 0;}.cke_skin_kama a.cke_dialog_ui_button_ok span,.cke_skin_kama a.cke_dialog_ui_button_cancel span{width:60px;padding-right:20px;padding-left:20px;}.cke_skin_kama a.cke_dialog_ui_button_ok{background-position:0 -1143px;}.cke_skin_kama a.cke_dialog_ui_button_ok span{background:transparent url(images/sprites.png) no-repeat scroll right -1219px;}.cke_skin_kama .cke_rtl a.cke_dialog_ui_button_ok span{background-position:left -1219px;}.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button_ok span,.cke_skin_kama .cke_browser_ie6 a.cke_dialog_ui_button_ok span{background-color:#B8E834;margin-right:0;}
+.cke_skin_kama a.cke_dialog_ui_button_cancel{background-position:0 -1104px;}.cke_skin_kama a.cke_dialog_ui_button_cancel span{background:transparent url(images/sprites.png) no-repeat scroll right -1245px;}.cke_skin_kama .cke_rtl a.cke_dialog_ui_button_cancel span{background-position:left -1245px;}.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button_cancel span,.cke_skin_kama .cke_browser_ie6 a.cke_dialog_ui_button_cancel span{background-color:#F65D20;}.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button_cancel span,.cke_skin_kama .cke_browser_ie6 a.cke_dialog_ui_button_cancel span,.cke_skin_kama .cke_browser_iequirks a.cke_dialog_ui_button_ok span,.cke_skin_kama .cke_browser_ie6 a.cke_dialog_ui_button_ok span{background-image:none;}.cke_skin_kama span.cke_dialog_ui_button{padding:2px 10px;text-align:center;color:#222;display:inline-block;cursor:default;min-width:60px;+margin:2px 0;}.cke_skin_kama .cke_browser_gecko18 .cke_dialog_footer_buttons span.cke_dialog_ui_button{display:block;}.cke_skin_kama a.cke_dialog_ui_button span.cke_disabled{border:#898980 1px solid;color:#5e5e55;background-color:#c5c5b3;}.cke_skin_kama a:hover.cke_dialog_ui_button,.cke_skin_kama a:focus.cke_dialog_ui_button,.cke_skin_kama a:active.cke_dialog_ui_button{background-position:0 -1179px;}.cke_skin_kama .cke_hc a:hover.cke_dialog_ui_button,.cke_skin_kama .cke_hc a:focus.cke_dialog_ui_button,.cke_skin_kama .cke_hc a:active.cke_dialog_ui_button{border-width:2px;}.cke_skin_kama .cke_browser_iequirks a:hover.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_iequirks a:focus.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_iequirks a:active.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_ie6 a:hover.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_ie6 a:focus.cke_dialog_ui_button span,.cke_skin_kama .cke_browser_ie6 a:active.cke_dialog_ui_button span{background-image:none;background:#F7A922;}.cke_skin_kama .cke_dialog_footer_buttons{display:inline-table;margin-right:12px;margin-left:12px;width:auto;position:relative;}.cke_skin_kama .cke_browser_ie7 .cke_dialog_footer_buttons{position:static;}.cke_skin_kama .cke_browser_gecko18 .cke_dialog_footer_buttons{display:inline;}.cke_skin_kama .cke_dialog_footer_buttons span.cke_dialog_ui_button{margin:7px 0;text-align:center;}.cke_skin_kama .cke_browser_gecko18 .cke_dialog_footer_buttons a.cke_dialog_ui_button{display:block;padding:0;}.cke_skin_kama .cke_browser_gecko18 .cke_dialog_footer_buttons span.cke_dialog_ui_button{padding-bottom:5px;padding-top:6px;margin-bottom:0;}.cke_skin_kama .cke_browser_gecko18 .cke_dialog_footer_buttons .cke_dialog_ui_button_ok .cke_dialog_ui_button{background-position:right -1214px;}.cke_skin_kama .cke_browser_gecko18 .cke_dialog_footer_buttons .cke_dialog_ui_button_cancel .cke_dialog_ui_button{background-position:right -1242px;}.cke_skin_kama strong{font-weight:bold;}.cke_skin_kama .cke_dialog .cke_dialog_body .cke_dialog_close_button{background-image:url(images/sprites.png);background-repeat:no-repeat;background-position:0 -1022px;position:absolute;cursor:pointer;text-align:center;height:20px;width:20px;top:5px;_background-image:url(images/sprites_ie6.png);}.cke_skin_kama .cke_dialog_close_button span{display:none;}.cke_skin_kama .cke_dialog_close_button:hover{background-position:0 -1045px;}.cke_skin_kama .cke_ltr .cke_dialog_close_button{right:10px;}.cke_skin_kama .cke_browser_ie8.cke_rtl .cke_dialog_close_button{left:8px;}.cke_skin_kama .cke_rtl .cke_dialog_close_button{left:10px;}.cke_skin_kama .cke_browser_ie7.cke_rtl .cke_dialog_close_button{left:16px;top:0;}.cke_skin_kama .cke_browser_ie7.cke_rtl .cke_dialog_close_button{position:absolute;left:10px;top:5px;}.cke_skin_kama .cke_browser_ie7.cke_single_page .cke_dialog_footer{margin-top:22px;}.cke_skin_kama .cke_browser_ie6 .cke_dialog_close_button,.cke_skin_kama .cke_browser_iequirks .cke_dialog_close_button{top:7px;}.cke_skin_kama .cke_browser_ie7.cke_ltr .cke_dialog_close_button{margin-top:0;}.cke_skin_kama .cke_dialog_ui_input_select{border:1px solid #a0a0a0;background-color:white;}.cke_skin_kama .cke_dialog_ui_input_file{width:100%;height:25px;}
+.cke_skin_kama .cke_dialog .cke_dark_background{background-color:#eaead1;}.cke_skin_kama .cke_dialog .cke_hand{cursor:pointer;}.cke_skin_kama .cke_dialog .cke_centered{text-align:center;}.cke_skin_kama .cke_dialog a.cke_btn_reset{float:right;background-position:0 -32px;background-image:url(images/mini.gif);width:16px;height:16px;background-repeat:no-repeat;border:1px none;font-size:1px;}.cke_skin_kama .cke_rtl .cke_dialog a.cke_btn_reset{float:left;}.cke_skin_kama .cke_dialog a.cke_btn_locked,.cke_skin_kama .cke_dialog a.cke_btn_unlocked{float:left;background-position:0 0;background-image:url(images/mini.gif);width:16px;height:16px;background-repeat:no-repeat;border:none 1px;font-size:1px;}.cke_skin_kama .cke_rtl .cke_dialog a.cke_btn_locked,.cke_skin_kama .cke_rtl .cke_dialog a.cke_btn_unlocked{float:right;}.cke_skin_kama .cke_dialog a.cke_btn_unlocked{background-position:0 -16px;background-image:url(images/mini.gif);}.cke_skin_kama .cke_dialog .cke_btn_over{border:outset 1px;cursor:pointer;}.cke_skin_kama .cke_dialog .ImagePreviewBox{border:2px ridge black;overflow:scroll;height:200px;width:300px;padding:2px;background-color:white;}.cke_skin_kama .cke_dialog .ImagePreviewBox table td{white-space:normal;}.cke_skin_kama .cke_browser_iequirks .cke_dialog_page_contents{_position:absolute;}.cke_skin_kama .cke_dialog .ImagePreviewLoader{position:absolute;white-space:normal;overflow:hidden;height:160px;width:230px;margin:2px;padding:2px;opacity:.9;filter:alpha(opacity=90);background-color:#e4e4e4;}.cke_skin_kama .cke_dialog .FlashPreviewBox{white-space:normal;border:2px ridge black;overflow:auto;height:160px;width:390px;padding:2px;background-color:white;}.cke_skin_kama .cke_dialog .cke_pastetext{width:346px;height:170px;}.cke_skin_kama .cke_dialog .cke_pastetext textarea{width:340px;height:170px;resize:none;}.cke_skin_kama .cke_dialog iframe.cke_pasteframe{width:346px;height:130px;background-color:white;border:1px solid black;}.cke_skin_kama .cke_dialog .cke_dark_background{text-align:center;background-color:#eaead1;font-size:14px;}.cke_skin_kama .cke_dialog .cke_light_background{text-align:center;background-color:#ffffbe;}.cke_skin_kama .cke_dialog .cke_hand{cursor:pointer;}.cke_skin_kama .cke_disabled{color:#a0a0a0;}.cke_skin_kama .cke_hc .cke_dialog_title,.cke_skin_kama .cke_hc .cke_dialog_tabs,.cke_skin_kama .cke_hc .cke_dialog_contents,.cke_skin_kama .cke_hc .cke_dialog_footer{border-left:1px solid;border-right:1px solid;}.cke_skin_kama .cke_hc .cke_dialog_title{border-top:1px solid;}.cke_skin_kama .cke_hc .cke_dialog_footer{border-bottom:1px solid;}.cke_skin_kama .cke_hc .cke_dialog_close_button span{display:inline;cursor:pointer;font-weight:bold;position:relative;top:3px;}.cke_skin_kama .cke_dialog_body .cke_label{display:none;}.cke_skin_kama .cke_dialog_body label.cke_required{font-weight:bold;}.cke_skin_kama .cke_hc .cke_dialog_body .cke_label{display:inline;}.cke_skin_kama .cke_hc a.cke_btn_locked,.cke_skin_kama .cke_hc a.cke_btn_unlocked,.cke_skin_kama .cke_hc a.cke_btn_reset{border-style:solid;float:left;width:auto;height:auto;}.cke_skin_kama .cke_rtl.cke_hc a.cke_btn_locked,.cke_skin_kama .cke_rtl.cke_hc a.cke_btn_unlocked,.cke_skin_kama .cke_rtl.cke_hc a.cke_btn_reset{float:right;}.cke_skin_kama a.cke_smile img{border:2px solid #eaead1;}.cke_skin_kama a.cke_smile:focus img,.cke_skin_kama a.cke_smile:active img,.cke_skin_kama a.cke_smile:hover img{border-color:#C7C78F;}.cke_skin_kama .cke_hc .cke_dialog_tabs a,.cke_skin_kama .cke_hc .cke_dialog_footer a{opacity:1.0;filter:alpha(opacity=100);border:1px solid white;}.cke_skin_kama .cke_dialog_contents a.colorChooser{display:block;margin-top:6px;margin-left:10px;width:80px;}.cke_skin_kama .cke_rtl .cke_dialog_contents a.colorChooser{margin-right:10px;}
diff --git a/appsrc/ODS-Framework/ckeditor/skins/kama/editor.css b/appsrc/ODS-Framework/ckeditor/skins/kama/editor.css
index 127518c..a7deda9 100644
--- a/appsrc/ODS-Framework/ckeditor/skins/kama/editor.css
+++ b/appsrc/ODS-Framework/ckeditor/skins/kama/editor.css
@@ -1,12 +1,13 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-.cke_skin_kama *,.cke_skin_kama a:hover,.cke_skin_kama a:link,.cke_skin_kama a:visited,.cke_skin_kama a:active{margin:0;padding:0;border:0;background:transparent;text-decoration:none;font:normal normal normal 100% Sans-Serif;width:auto;height:auto;border-collapse:collapse;text-align:left;vertical-align:baseline;white-space:nowrap;cursor:auto;color:#000;font-size:12px;font-family:Arial,Helvetica,Tahoma,Verdana,Sans-Serif;}.cke_skin_kama .cke_rtl *,.cke_skin_kama .cke_rtl a:hover,.cke_skin_kama .cke_rtl a:link,.cke_skin_kama .cke_rtl a:visited,.cke_skin_kama .cke_rtl a:active,.cke_rtl .cke_skin_kama *,.cke_rtl .cke_skin_kama a:hover,.cke_rtl .cke_skin_kama a:link,.cke_rtl .cke_skin_kama a:visited,.cke_rtl .cke_skin_kama a:active{text-align:right;}.cke_skin_kama iframe{vertical-align:inherit;}.cke_skin_kama textarea{white-space:pre;}.cke_skin_kama .cke_browser_gecko textarea{cursor:text;}.cke_skin_kama .cke_browser_gecko textarea[disabled]{cursor:default;}.cke_skin_kama input[type="text"],.cke_skin_kama input[type="password"]{cursor:text;}.cke_skin_kama input[type="text"][disabled],.cke_skin_kama input[type="password"][disabled]{cursor:default;}.cke_skin_kama{display:block;}span.cke_skin_kama{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;border:1px solid #D3D3D3;padding:5px;}.cke_skin_kama span.cke_browser_webkit,.cke_skin_kama span.cke_browser_gecko18{display:block;}.cke_skin_kama .cke_wrapper{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;background-color:#d3d3d3;background-image:url(images/sprites.png);background-repeat:repeat-x;background-position:0 -1950px;display:block;_display:inline-block;padding:5px;}.cke_shared .cke_skin_kama .cke_wrapper{padding-bottom:0;}.cke_skin_kama .cke_browser_ie6 .cke_wrapper,.cke_skin_kama .cke_browser_iequirks .cke_wrapper{background-image:none;}.cke_skin_kama .cke_editor{display:inline-table;width:100%;}.cke_skin_kama .ltr .cke_browser_ie iframe{margin-right:-10px;}.cke_skin_kama .rtl .cke_browser_ie iframe{margin-left:-10px;}.cke_skin_kama .cke_browser_opera .cke_editor.cke_skin_kama .cke_resizer{display:table;}.cke_skin_kama .cke_contents{margin:5px;}.cke_skin_kama .cke_hc .cke_contents{border:1px solid black;}.cke_skin_kama .cke_contents iframe{background-color:#fff;}.cke_skin_kama .cke_focus{outline:auto 5px -webkit-focus-ring-color;}.cke_skin_kama textarea.cke_source{font-family:'Courier New',Monospace;font-size:small;background-color:#fff;white-space:pre;}.cke_skin_kama .cke_browser_iequirks textarea.cke_source{_white-space:normal;}.cke_skin_kama .cke_resizer{width:12px;height:12px;margin-top:9px;display:block;float:right;background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-position:0 -1428px;background-repeat:no-repeat;cursor:se-resize;}.cke_skin_kama .cke_rtl .cke_resizer{cursor:sw-resize;background-position:0 -1455px;float:left;}.cke_skin_kama .cke_resizer_horizontal,.cke_skin_kama .cke_rtl .cke_resizer_horizontal{cursor:e-resize;}.cke_skin_kama .cke_resizer_vertical,.cke_skin_kama .cke_rtl .cke_resizer_vertical{cursor:n-resize;}.cke_skin_kama .cke_maximized .cke_resizer{display:none;}.cke_skin_kama .cke_browser_ie6 .cke_contents textarea,.cke_skin_kama .cke_browser_ie7 .cke_contents textarea{position:absolute;}.cke_skin_kama .cke_browser_ie.cke_browser_quirks .cke_contents iframe{position:absolute;top:0;}.cke_skin_kama .cke_browser_ie6 .cke_editor,.cke_skin_kama .cke_browser_ie7 .cke_editor{display:inline-block;}.cke_skin_kama .cke_browser_ie6 .cke_editor,.cke_shared .cke_skin_kama .cke_browser_ie7 .cke_wrapper{padding-bottom:5px;}.cke_skin_kama .cke_voice_label{display:none;}.cke_skin_kama legend.cke_voice_label{display:none;}.cke_skin_kama .cke_browser_ie legend.cke_voice_label{position:absolute;display:block;width:0;height:0;overflow:hidden;}.cke_skin_kama .cke_panel{border:1px solid #8f8f73;background-color:#fff;width:120px;height:100px;overflow:hidden;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.cke_skin_kama .cke_contextmenu{margin:0;}.cke_skin_kama .cke_panel iframe{width:100%;height:100%;}
-html.cke_skin_kama_container{overflow:auto;overflow-x:hidden;}body.cke_panel_frame{overflow:hidden;}.cke_panel_frame .cke_label{display:none;}ul.cke_panel_list{list-style-type:none;margin:3px;padding:0;white-space:nowrap;}li.cke_panel_listItem{margin:0;}.cke_panel_listItem a{padding:2px;display:block;border:1px solid #fff;color:inherit;text-decoration:none;overflow:hidden;text-overflow:ellipsis;}* html .cke_panel_listItem a{width:100%;color:#000;}*:first-child+html .cke_panel_listItem a{color:#000;}.cke_panel_listItem.cke_selected a{border:1px solid #ccc;background-color:#e9f5ff;}.cke_panel_listItem a:hover,.cke_panel_listItem a:focus,.cke_panel_listItem a:active{border-color:#316ac5;background-color:#dff1ff;}.cke_hc .cke_panel_listItem.cke_selected a,.cke_hc .cke_panel_listItem a:hover,.cke_hc .cke_panel_listItem a:focus,.cke_hc .cke_panel_listItem a:active{border-width:3px;padding:0;}.cke_panel_grouptitle{font-size:11px;font-family:'Microsoft Sans Serif',Tahoma,Arial,Verdana,Sans-Serif;font-weight:bold;white-space:nowrap;background-color:#dcdcdc;color:#000;margin:0;padding:3px;}.cke_panel_listItem p,.cke_panel_listItem h1,.cke_panel_listItem h2,.cke_panel_listItem h3,.cke_panel_listItem h4,.cke_panel_listItem h5,.cke_panel_listItem h6,.cke_panel_listItem pre{margin-top:3px;margin-bottom:3px;}.cke_skin_kama .cke_button_textcolor_panel,.cke_skin_kama .cke_button_bgcolor_panel{width:150px;height:135px;}.cke_colorblock{padding:3px;font-size:11px;font-family:'Microsoft Sans Serif',Tahoma,Arial,Verdana,Sans-Serif;}.cke_colorblock,.cke_colorblock a{text-decoration:none;color:#000;}span.cke_colorbox{width:10px;height:10px;border:#808080 1px solid;float:left;}.cke_rtl span.cke_colorbox{float:right;}a.cke_colorbox{border:#fff 1px solid;padding:2px;float:left;}.cke_rtl a.cke_colorbox{float:right;}a:hover.cke_colorbox,a:focus.cke_colorbox,a:active.cke_colorbox{border:#316ac5 1px solid;background-color:#dff1ff;}a.cke_colorauto,a.cke_colormore{border:#fff 1px solid;padding:2px;display:block;}a:hover.cke_colorauto,a:hover.cke_colormore,a:focus.cke_colorauto,a:focus.cke_colormore,a:active.cke_colorauto,a:active.cke_colormore{border:#316ac5 1px solid;background-color:#dff1ff;}@media print{.cke_skin_kama .cke_toolbox{display:none;}}.cke_skin_kama .cke_browser_webkit .cke_toolbox,.cke_skin_kama .cke_browser_webkit .cke_toolbox>span{white-space:normal;}.cke_skin_kama .cke_toolbox{clear:both;padding-bottom:1px;}.cke_skin_kama a.cke_toolbox_collapser,.cke_skin_kama a:hover.cke_toolbox_collapser{background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-position:3px -1366px;background-repeat:no-repeat;width:11px;height:11px;float:right;border:1px outset #D3D3D3;margin:11px 0 2px;cursor:pointer;}.cke_skin_kama .cke_rtl a.cke_toolbox_collapser,.cke_skin_kama .cke_rtl a:hover.cke_toolbox_collapser{float:left;}.cke_skin_kama a.cke_toolbox_collapser span{display:none;}.cke_skin_kama .cke_hc a.cke_toolbox_collapser span{font-size:10px;font-weight:bold;font-family:Arial;display:inline;}.cke_skin_kama a.cke_toolbox_collapser_min,.cke_skin_kama a:hover.cke_toolbox_collapser_min{background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-position:4px -1387px;background-repeat:no-repeat;margin:2px 4px;}.cke_skin_kama .cke_rtl a.cke_toolbox_collapser_min,.cke_skin_kama .cke_rtl a:hover.cke_toolbox_collapser_min{background-position:4px -1408px;}.cke_skin_kama .cke_toolbar{display:inline;}.cke_skin_kama .cke_separator{display:none;}.cke_skin_kama .cke_break{font-size:0;clear:left;}.cke_skin_kama .cke_rtl .cke_break{clear:right;}.cke_skin_kama .cke_toolbar_start{display:none;}.cke_skin_kama .cke_toolgroup{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-repeat:repeat-x;background-position:0 -500px;float:left;margin-right:6px;margin-bottom:5px;padding:2px;display:inline;}.cke_skin_kama .cke_rtl .cke_toolgroup{float:right;margin-right:0;margin-left:6px;}.cke_skin_kama .cke_toolgroup{display:block;height:22px;}
-.cke_skin_kama .cke_button a,.cke_skin_kama .cke_button a:hover,.cke_skin_kama .cke_button a:focus,.cke_skin_kama .cke_button a:active,.cke_skin_kama .cke_button a.cke_off{border-radius:3px;outline:none;padding:2px 4px;height:18px;display:inline-block;cursor:default;}.cke_skin_kama .cke_button a,.cke_skin_kama .cke_button a.cke_off{filter:alpha(opacity=70);opacity:.70;-moz-border-radius:3px;-webkit-border-radius:3px;}.cke_skin_kama .cke_hc .cke_button a,.cke_skin_kama .cke_hc .cke_button a.cke_off{opacity:1.0;filter:alpha(opacity=100);border:1px solid white;}.cke_skin_kama .cke_button a.cke_on{background-color:#a3d7ff;filter:alpha(opacity=100);opacity:1;padding:2px 4px;}.cke_skin_kama .cke_hc .cke_button a.cke_on{padding:0 2px!important;border-width:3px;}.cke_skin_kama .cke_button a.cke_disabled *,.cke_skin_kama .cke_browser_ie a:hover.cke_button .cke_disabled *{filter:alpha(opacity=30);opacity:.3;}.cke_skin_kama .cke_hc .cke_button a.cke_disabled *,.cke_skin_kama .cke_browser_ie.cke_hc a:hover.cke_button .cke_disabled *{filter:alpha(opacity=60);opacity:.6;}.cke_skin_kama .cke_button a:hover.cke_on,.cke_skin_kama .cke_button a:focus.cke_on,.cke_skin_kama .cke_button a:active.cke_on,.cke_skin_kama .cke_button a:hover.cke_off,.cke_skin_kama .cke_button a:focus.cke_off,.cke_skin_kama .cke_button a:active.cke_off{filter:alpha(opacity=100);opacity:1;padding:2px 4px;}.cke_skin_kama .cke_button a:hover,.cke_skin_kama .cke_button a:focus,.cke_skin_kama .cke_button a:active{background-color:#dff1ff;}.cke_skin_kama .cke_button a:hover.cke_on,.cke_skin_kama .cke_button a:focus.cke_on,.cke_skin_kama .cke_button a:active.cke_on{background-color:#86caff;}.cke_skin_kama .cke_hc .cke_button a:hover,.cke_skin_kama .cke_hc .cke_button a:focus,.cke_skin_kama .cke_hc .cke_button a:active{padding:0 2px!important;border-width:3px;}.cke_skin_kama .cke_button .cke_icon{background-image:url(icons.png);background-position:100px;background-repeat:no-repeat;margin-top:1px;width:16px;height:16px;display:inline-block;float:left;}.cke_skin_kama .cke_rtl .cke_button .cke_icon{float:right;}.cke_skin_kama .cke_button .cke_label{cursor:default;display:none;padding-left:3px;line-height:18px;vertical-align:middle;float:left;}.cke_skin_kama .cke_rtl .cke_button .cke_label{padding-left:0;padding-right:3px;float:right;}.cke_skin_kama .cke_hc .cke_button .cke_label{padding:0;display:inline-block;}.cke_skin_kama .cke_hc .cke_button .cke_icon{display:none;}.cke_skin_kama .cke_accessibility{position:absolute;display:block;width:0;height:0;overflow:hidden;}.cke_skin_kama .cke_button .cke_buttonarrow{display:inline-block;height:17px;width:8px;background-position:2px -1469px;background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-repeat:no-repeat;float:left;}.cke_skin_kama .cke_rtl .cke_button .cke_buttonarrow{background-position:0 -1469px;float:right;}.cke_skin_kama .cke_browser_gecko .cke_toolbar,.cke_skin_kama .cke_browser_gecko .cke_button a,.cke_skin_kama .cke_browser_gecko .cke_button a.cke_off,.cke_skin_kama .cke_browser_gecko .cke_button .cke_icon,.cke_skin_kama .cke_browser_gecko .cke_button .cke_buttonarrow,.cke_skin_kama .cke_browser_gecko .cke_separator,.cke_skin_kama .cke_browser_gecko .cke_toolbar_start{display:block;float:left;}.cke_skin_kama .cke_browser_gecko.cke_hc .cke_button .cke_icon{display:none;}.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_toolbar,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_button a,.cke_skin_kama .cke_browser_gecko .cke_rtl.cke_button a.cke_off,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_button .cke_icon,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_button .cke_buttonarrow,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_toolbar_start{float:right;}.cke_skin_kama .cke_browser_gecko .cke_button .cke_label,.cke_skin_kama .cke_browser_gecko .cke_break{float:left;}.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_button .cke_label,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_break{float:right;}.cke_skin_kama .cke_browser_ie .cke_rtl .cke_button .cke_icon,.cke_skin_kama .cke_browser_ie .cke_rtl .cke_button .cke_label,.cke_skin_kama .cke_browser_ie .cke_rtl .cke_button .cke_buttonarrow{float:none;}
-.cke_skin_kama .cke_browser_webkit .cke_toolbar{float:left;}.cke_skin_kama .cke_browser_webkit .cke_rtl .cke_toolbar{float:right;}.cke_skin_kama .cke_browser_ie8 .cke_button .cke_label,.cke_skin_kama .cke_browser_opera .cke_button .cke_label,.cke_skin_kama .cke_browser_webkit .cke_button .cke_label{line-height:20px;}.cke_skin_kama .cke_browser_opera.cke_browser_quirks .cke_button .cke_label,.cke_skin_kama .cke_browser_iequirks .cke_button .cke_label{line-height:17px;}.cke_skin_kama .cke_browser_ie .cke_rcombo,.cke_skin_kama .cke_browser_ie .cke_rcombo *{cursor:default;}.cke_skin_kama .cke_browser_ie .cke_toolbox{padding-bottom:5px;_padding-bottom:6px;}.cke_shared .cke_skin_kama .cke_browser_ie .cke_toolbox{padding-bottom:0;}.cke_skin_kama .cke_contextmenu{padding:2px;}.cke_skin_kama .cke_menuitem a{display:block;}.cke_skin_kama .cke_menuitem span{cursor:default;}.cke_skin_kama .cke_menuitem a:hover,.cke_skin_kama .cke_menuitem a:focus,.cke_skin_kama .cke_menuitem a:active{background-color:#D3D3D3;display:block;}.cke_hc .cke_menuitem a:hover,.cke_hc .cke_menuitem a:focus,.cke_hc .cke_menuitem a:active{border:2px solid;}.cke_skin_kama .cke_menuitem .cke_icon{background-image:url(icons.png);background-position:100px;background-repeat:no-repeat;background-color:transparent;width:16px;height:16px;float:left;}.cke_skin_kama .cke_menuitem .cke_disabled .cke_icon{filter:alpha(opacity=70);opacity:.70;}.cke_skin_kama .cke_menuitem .cke_icon_wrapper{background-color:#D3D3D3;border:solid 4px #D3D3D3;width:16px;height:16px;float:left;filter:alpha(opacity=70);opacity:.70;clear:both;}.cke_rtl .cke_skin_kama .cke_menuitem .cke_icon_wrapper{float:right;}.cke_skin_kama .cke_menuitem a:hover .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:focus .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:active .cke_icon_wrapper{background-color:#9d9d9d;border:solid 4px #9d9d9d;filter:alpha(opacity=70);opacity:.70;}.cke_skin_kama .cke_menuitem a:hover.cke_disabled .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:focus.cke_disabled .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:active.cke_disabled .cke_icon_wrapper{background-color:#D3D3D3;border:solid 4px #D3D3D3;}.cke_skin_kama .cke_menuitem .cke_label{display:block;padding-right:3px;padding-top:5px;padding-left:4px;height:19px;margin-left:24px;background-color:#fff;}.cke_skin_kama .cke_frameLoaded .cke_menuitem .cke_label{filter:alpha(opacity=70);opacity:.70;}.cke_rtl .cke_skin_kama .cke_menuitem .cke_label{padding-right:0;margin-left:0;padding-left:3px;margin-right:28px;}.cke_skin_kama .cke_menuitem a.cke_disabled .cke_label{filter:alpha(opacity=30);opacity:.30;}.cke_skin_kama .cke_menuitem a:hover .cke_label,.cke_skin_kama .cke_menuitem a:focus .cke_label,.cke_skin_kama .cke_menuitem a:active .cke_label{background-color:#D3D3D3;}.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:active .cke_label{background-color:transparent;}.cke_skin_kama .cke_menuseparator{background-color:#D3D3D3;height:2px;filter:alpha(opacity=70);opacity:.70;_font-size:0;}.cke_skin_kama .cke_menuarrow{background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-position:0 -1411px;background-repeat:no-repeat;height:5px;width:3px;float:right;margin-right:2px;margin-top:3px;}.cke_rtl .cke_skin_kama .cke_menuarrow{float:left;margin-right:0;margin-left:2px;background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-position:0 -1390px;background-repeat:no-repeat;}.cke_skin_kama .cke_menuarrow span{display:none;}.cke_hc .cke_skin_kama .cke_menuarrow{width:auto;margin-top:0;}.cke_hc .cke_skin_kama .cke_menuarrow span{display:inline;}.cke_browser_ie.cke_ltr .cke_skin_kama .cke_menuarrow{position:absolute;right:2px;}.cke_browser_ie.cke_rtl .cke_skin_kama .cke_menuarrow{position:absolute;left:2px;}.cke_skin_kama .cke_rcombo{display:inline;}.cke_skin_kama .cke_rcombopanel{border:1px solid #8F8F73;-moz-border-radius-topleft:0;-webkit-border-top-left-radius:0;border-top-left-radius:0;height:auto;_height:100px;}
-.cke_skin_kama .cke_rcombo a,.cke_skin_kama .cke_rcombo a:active,.cke_skin_kama .cke_rcombo a:hover{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-repeat:repeat-x;background-position:0 -100px;border-bottom:1px solid #DAD9D9;border-right:1px solid #DAD9D9;float:left;padding:2px;height:21px;margin-right:6px;}.cke_skin_kama .cke_rtl .cke_rcombo a,.cke_skin_kama .cke_rtl .cke_rcombo a:active,.cke_skin_kama .cke_rtl .cke_rcombo a:hover{float:right;margin-right:0;margin-left:6px;}.cke_skin_kama .cke_hc .cke_rcombo a{filter:alpha(opacity=100);opacity:1.0;}.cke_skin_kama .cke_rcombo .cke_label{display:none;line-height:26px;vertical-align:top;margin-right:5px;filter:alpha(opacity=70);opacity:.70;}.cke_skin_kama .cke_rtl .cke_rcombo .cke_label{margin-right:0;margin-left:5px;}.cke_skin_kama .cke_rcombo .cke_inline_label{line-height:21px;font-style:italic;color:#666;}.cke_skin_kama .cke_hc .cke_rcombo .cke_openbutton{vertical-align:top;}.cke_skin_kama .cke_hc .cke_rcombo .cke_label{filter:alpha(opacity=100);opacity:1.0;}.cke_skin_kama .cke_rcombo .cke_text{filter:alpha(opacity=70);opacity:.70;height:21px;line-height:21px;width:60px;text-overflow:ellipsis;overflow:hidden;display:inline-block;margin:0 2px 0 4px;}.cke_skin_kama .cke_rtl .cke_rcombo .cke_text{margin:0 4px 0 2px;}.cke_skin_kama .cke_rcombo .cke_openbutton{background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-position:0 -68px;background-repeat:no-repeat;display:inline-block;width:17px;height:19px;margin:1px 2px;background-repeat:no-repeat;}.cke_skin_kama .cke_rcombo .cke_openbutton span{display:none;}.cke_skin_kama .cke_hc .cke_rcombo .cke_openbutton span{display:inline;}.cke_skin_kama .cke_browser_iequirks .cke_rcombo .cke_openbutton{margin-bottom:0;}.cke_skin_kama .cke_rcombo .cke_off a:hover .cke_text,.cke_skin_kama .cke_rcombo .cke_off a:focus .cke_text,.cke_skin_kama .cke_rcombo .cke_off a:active .cke_text,.cke_skin_kama .cke_rcombo .cke_on .cke_text{border-color:#316ac5;filter:alpha(opacity=100);opacity:1;}.cke_skin_kama .cke_rcombo .cke_off a:hover .cke_openbutton,.cke_skin_kama .cke_rcombo .cke_off a:focus .cke_openbutton,.cke_skin_kama .cke_rcombo .cke_off a:active .cke_openbutton,.cke_skin_kama .cke_rcombo .cke_on .cke_openbutton{border-color:#316ac5;background-color:#dff1ff;}.cke_skin_kama .cke_rcombo .cke_on .cke_text{-moz-border-radius-bottomleft:0;-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;}.cke_skin_kama .cke_rcombo .cke_on .cke_openbutton{-moz-border-radius-bottomright:0;-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;}.cke_skin_kama .cke_rcombo .cke_disabled .cke_label{filter:alpha(opacity=30);opacity:.3;}.cke_skin_kama .cke_hc .cke_rcombo .cke_disabled .cke_label{filter:alpha(opacity=70);opacity:.7;}.cke_skin_kama .cke_rcombo .cke_disabled .cke_text,.cke_skin_kama .cke_rcombo .cke_disabled .cke_openbutton{filter:alpha(opacity=50);opacity:.5;}.cke_skin_kama .cke_hc .cke_rcombo .cke_disabled .cke_text,.cke_skin_kama .cke_hc .cke_rcombo .cke_disabled .cke_openbutton{filter:alpha(opacity=80);opacity:.8;}.cke_skin_kama .cke_rcombo .cke_disabled .cke_text{color:#fff;}.cke_skin_kama .cke_browser_gecko .cke_rcombo .cke_text,.cke_skin_kama .cke_browser_gecko .cke_rcombo .cke_openbutton,.cke_skin_kama .cke_browser_webkit .cke_rcombo .cke_text,.cke_skin_kama .cke_browser_webkit .cke_rcombo .cke_openbutton{display:block;float:left;}.cke_skin_kama .cke_browser_gecko .cke_rcombo .cke_label,.cke_skin_kama .cke_browser_webkit .cke_rcombo .cke_label{float:left;}.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_rcombo .cke_label,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_rcombo .cke_text,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_rcombo .cke_openbutton,.cke_skin_kama .cke_browser_webkit .cke_rtl .cke_rcombo .cke_label,.cke_skin_kama .cke_browser_webkit .cke_rtl .cke_rcombo .cke_text,.cke_skin_kama .cke_browser_webkit .cke_rtl .cke_rcombo .cke_openbutton{float:right;}
-.cke_skin_kama .cke_browser_ie7 .cke_rcombo .cke_text{line-height:18px;}.cke_skin_kama .cke_browser_ie6 .cke_rcombo .cke_text,.cke_skin_kama .cke_browser_iequirks .cke_rcombo .cke_text{height:auto;line-height:17px;}@media print{.cke_path{display:none;}}.cke_skin_kama .cke_path{display:inline-block;float:left;margin-top:5px;}.cke_skin_kama .cke_rtl .cke_path{float:right;}.cke_shared .cke_skin_kama .cke_path{_width:100%;margin:0 0 5px;}.cke_skin_kama .cke_path a,.cke_skin_kama .cke_path .cke_empty{display:inline-block;float:left;padding:1px 4px 0;color:#60676a;}.cke_skin_kama .cke_path .cke_empty{visibility:hidden;}.cke_skin_kama .cke_rtl .cke_path a,.cke_skin_kama .cke_rtl .cke_path cke_empty{float:right;}.cke_skin_kama .cke_path a:hover,.cke_skin_kama .cke_path a:focus,.cke_skin_kama .cke_path a:active{background-color:#dff1ff;padding:1px 4px 0;outline:none;color:#000;}.cke_skin_kama .cke_browser_ie .cke_rtl .cke_path a,.cke_skin_kama .cke_browser_ie .cke_rtl .cke_path .cke_empty{float:none;}.cke_skin_kama .cke_path .cke_label{display:none;}.cke_skin_kama .cke_button_source .cke_icon{background-position:0 0;}.cke_skin_kama .cke_button_newpage .cke_icon{background-position:0 -48px;}.cke_skin_kama .cke_button_preview .cke_icon{background-position:0 -64px;}.cke_skin_kama .cke_button_cut .cke_icon{background-position:0 -96px;}.cke_skin_kama .cke_button_copy .cke_icon{background-position:0 -112px;}.cke_skin_kama .cke_button_paste .cke_icon{background-position:0 -128px;}.cke_skin_kama .cke_button_pastetext .cke_icon{background-position:0 -144px;}.cke_skin_kama .cke_button_find .cke_icon{background-position:0 -240px;}.cke_skin_kama .cke_button_replace .cke_icon{background-position:0 -256px;}.cke_skin_kama .cke_button_selectAll .cke_icon{background-position:0 -272px;}.cke_skin_kama .cke_button_removeFormat .cke_icon{background-position:0 -288px;}.cke_skin_kama .cke_button_bold .cke_icon{background-position:0 -304px;}.cke_skin_kama .cke_button_italic .cke_icon{background-position:0 -320px;}.cke_skin_kama .cke_button_underline .cke_icon{background-position:0 -336px;}.cke_skin_kama .cke_button_strike .cke_icon{background-position:0 -352px;}.cke_skin_kama .cke_button_subscript .cke_icon{background-position:0 -368px;}.cke_skin_kama .cke_button_superscript .cke_icon{background-position:0 -384px;}.cke_skin_kama .cke_button_table .cke_icon{background-position:0 -608px;}.cke_skin_kama .cke_button_horizontalrule .cke_icon{background-position:0 -624px;}.cke_skin_kama .cke_button_smiley .cke_icon{background-position:0 -640px;}.cke_skin_kama .cke_button_link .cke_icon{background-position:0 -528px;}.cke_skin_kama .cke_button_unlink .cke_icon{background-position:0 -544px;}.cke_skin_kama .cke_button_anchor .cke_icon{background-position:0 -560px;}.cke_skin_kama .cke_button_image .cke_icon{background-position:0 -576px;}.cke_skin_kama .cke_button_flash .cke_icon{background-position:0 -592px;}.cke_skin_kama .cke_button_specialchar .cke_icon{background-position:0 -656px;}.cke_skin_kama .cke_button_pagebreak .cke_icon{background-position:0 -672px;}.cke_skin_kama .cke_button_print .cke_icon{background-position:0 -176px;}.cke_skin_kama .cke_button_checkspell .cke_icon,.cke_skin_kama .cke_button_scayt .cke_icon{background-position:0 -192px;}.cke_skin_kama .cke_button_pagebreak .cke_icon{background-position:0 -672px;}.cke_skin_kama .cke_button_textcolor .cke_icon{background-position:0 -704px;}.cke_skin_kama .cke_button_bgcolor .cke_icon{background-position:0 -720px;}.cke_skin_kama .cke_button_form .cke_icon{background-position:0 -752px;}.cke_skin_kama .cke_button_checkbox .cke_icon{background-position:0 -768px;}.cke_skin_kama .cke_button_radio .cke_icon{background-position:0 -784px;}.cke_skin_kama .cke_button_textfield .cke_icon{background-position:0 -800px;}.cke_skin_kama .cke_button_textarea .cke_icon{background-position:0 -816px;}.cke_skin_kama .cke_button_showblocks .cke_icon{background-position:0 -1136px;}.cke_skin_kama .cke_button_select .cke_icon{background-position:0 -832px;}.cke_skin_kama .cke_button_button .cke_icon{background-position:0 -848px;}
-.cke_skin_kama .cke_button_imagebutton .cke_icon{background-position:0 -864px;}.cke_skin_kama .cke_button_hiddenfield .cke_icon{background-position:0 -880px;}.cke_skin_kama .cke_button_undo .cke_icon{background-position:0 -208px;}.cke_skin_kama .cke_rtl .cke_button_undo .cke_icon{background-position:0 -224px;}.cke_skin_kama .cke_button_redo .cke_icon{background-position:0 -224px;}.cke_skin_kama .cke_rtl .cke_button_redo .cke_icon{background-position:0 -208px;}.cke_skin_kama .cke_button_templates .cke_icon{background-position:0 -80px;}.cke_skin_kama .cke_button_numberedlist .cke_icon{background-position:0 -400px;}.cke_skin_kama .cke_button_bulletedlist .cke_icon{background-position:0 -416px;}.cke_skin_kama .cke_button_outdent .cke_icon{background-position:0 -432px;}.cke_skin_kama .cke_button_indent .cke_icon{background-position:0 -448px;}.cke_skin_kama .cke_button_justifyleft .cke_icon{background-position:0 -464px;}.cke_skin_kama .cke_button_justifycenter .cke_icon{background-position:0 -480px;}.cke_skin_kama .cke_button_justifyright .cke_icon{background-position:0 -496px;}.cke_skin_kama .cke_button_justifyblock .cke_icon{background-position:0 -512px;}.cke_skin_kama .cke_button_blockquote .cke_icon{background-position:0 -1152px;}.cke_skin_kama .cke_button_creatediv .cke_icon{background-position:0 -1168px;}.cke_skin_kama .cke_button_editdiv .cke_icon{background-position:0 -1184px;}.cke_skin_kama .cke_button_removediv .cke_icon{background-position:0 -1200px;}.cke_skin_kama .cke_button_flash .cke_icon{background-position:0 -592px;}.cke_skin_kama .cke_button_pastefromword .cke_icon{background-position:0 -160px;}.cke_skin_kama .cke_button_save .cke_icon{background-position:0 -32px;}.cke_skin_kama .cke_button_about .cke_icon{background-position:0 -736px;}.cke_skin_kama .cke_button_maximize .cke_icon{background-position:0 -1040px;}.cke_skin_office2003 .cke_button_editdiv .cke_icon{background-position:0 -1184px;}.cke_skin_kama .cke_button_source .cke_label{display:inline;}.cke_skin_kama .cke_styles_panel{width:150px;height:170px;}.cke_skin_kama .cke_format_panel{width:150px;height:170px;}.cke_skin_kama .cke_font_panel{width:150px;height:170px;}.cke_skin_kama .cke_fontSize_panel{height:170px;}.cke_skin_kama .cke_fontSize .cke_text{width:25px;}.cke_skin_kama .cke_browser_iequirks .cke_fontSize .cke_text{width:32px;}html .cke_skin_kama{visibility:inherit;}html.cke_skin_kama_container{visibility:visible;}
+.cke_skin_kama *,.cke_skin_kama a:hover,.cke_skin_kama a:link,.cke_skin_kama a:visited,.cke_skin_kama a:active{margin:0;padding:0;border:0;background:transparent;text-decoration:none;font:normal normal normal 100% Sans-Serif;width:auto;height:auto;border-collapse:collapse;text-align:left;vertical-align:baseline;white-space:nowrap;cursor:auto;color:#000;font-size:12px;font-family:Arial,Helvetica,Tahoma,Verdana,Sans-Serif;}.cke_skin_kama .cke_rtl *,.cke_skin_kama .cke_rtl a:hover,.cke_skin_kama .cke_rtl a:link,.cke_skin_kama .cke_rtl a:visited,.cke_skin_kama .cke_rtl a:active,.cke_rtl .cke_skin_kama *,.cke_rtl .cke_skin_kama a:hover,.cke_rtl .cke_skin_kama a:link,.cke_rtl .cke_skin_kama a:visited,.cke_rtl .cke_skin_kama a:active{text-align:right;}.cke_skin_kama iframe{vertical-align:inherit;}.cke_skin_kama textarea{white-space:pre;}.cke_skin_kama .cke_browser_gecko textarea{cursor:text;}.cke_skin_kama .cke_browser_gecko textarea[disabled]{cursor:default;}.cke_skin_kama input[type="text"],.cke_skin_kama input[type="password"]{cursor:text;}.cke_skin_kama input[type="text"][disabled],.cke_skin_kama input[type="password"][disabled]{cursor:default;}.cke_skin_kama fieldset{padding:10px;border:2px groove #E0DFE3;}.cke_skin_kama{display:block;}span.cke_skin_kama{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;border:1px solid #D3D3D3;padding:5px;}.cke_skin_kama span.cke_browser_webkit,.cke_skin_kama span.cke_browser_gecko18{display:block;}.cke_skin_kama .cke_wrapper{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;background-color:#d3d3d3;background-image:url(images/sprites.png);background-repeat:repeat-x;background-position:0 -1950px;display:block;_display:inline-block;padding:5px;}.cke_shared .cke_skin_kama .cke_wrapper{padding-bottom:0;}.cke_skin_kama .cke_browser_ie6 .cke_wrapper,.cke_skin_kama .cke_browser_iequirks .cke_wrapper{background-image:none;}.cke_skin_kama .cke_editor{display:inline-table;width:100%;}.cke_skin_kama .cke_browser_webkit .cke_editor{display:table;}.cke_skin_kama .ltr .cke_browser_ie iframe{margin-right:-10px;}.cke_skin_kama .rtl .cke_browser_ie iframe{margin-left:-10px;}.cke_skin_kama .cke_browser_opera .cke_editor.cke_skin_kama .cke_resizer{display:table;}.cke_skin_kama .cke_contents{margin:5px;}.cke_skin_kama .cke_hc .cke_contents{border:1px solid black;}.cke_skin_kama .cke_contents iframe{background-color:#fff;}.cke_skin_kama .cke_focus{outline:auto 5px -webkit-focus-ring-color;}.cke_skin_kama textarea.cke_source{font-family:'Courier New',Monospace;font-size:small;background-color:#fff;white-space:pre;}.cke_skin_kama .cke_browser_iequirks textarea.cke_source{_white-space:normal;}.cke_skin_kama .cke_resizer{width:12px;height:12px;margin-top:9px;display:block;float:right;background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-position:0 -1428px;background-repeat:no-repeat;cursor:se-resize;}.cke_skin_kama .cke_browser_air .cke_resizer,.cke_skin_kama .cke_browser_air .cke_rtl .cke_resizer{cursor:move;}.cke_skin_kama .cke_rtl .cke_resizer{cursor:sw-resize;background-position:0 -1455px;float:left;}.cke_skin_kama .cke_resizer_horizontal,.cke_skin_kama .cke_rtl .cke_resizer_horizontal{cursor:e-resize;}.cke_skin_kama .cke_resizer_vertical,.cke_skin_kama .cke_rtl .cke_resizer_vertical{cursor:n-resize;}.cke_skin_kama .cke_maximized .cke_resizer{display:none;}.cke_skin_kama .cke_browser_ie6 .cke_contents textarea,.cke_skin_kama .cke_browser_ie7 .cke_contents textarea{position:absolute;}.cke_skin_kama .cke_browser_ie.cke_browser_quirks .cke_contents iframe{position:absolute;top:0;}.cke_skin_kama .cke_browser_ie6 .cke_editor,.cke_skin_kama .cke_browser_ie7 .cke_editor{display:inline-block;}.cke_skin_kama .cke_browser_ie6 .cke_editor,.cke_shared .cke_skin_kama .cke_browser_ie7 .cke_wrapper{padding-bottom:5px;}.cke_skin_kama .cke_voice_label{display:none;}.cke_skin_kama legend.cke_voice_label{display:none;}.cke_skin_kama .cke_browser_ie legend.cke_voice_label{position:absolute;display:block;width:0;height:0;overflow:hidden;}.cke_skin_kama .cke_panel{border:1px solid #8f8f73;background-color:#fff;width:120px;height:100px;overflow:hidden;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}
+.cke_skin_kama .cke_contextmenu{margin:0;}.cke_skin_kama .cke_panel iframe{width:100%;height:100%;}html.cke_skin_kama_container{overflow:auto;overflow-x:hidden;}body.cke_panel_frame{overflow:auto;}.cke_panel_frame .cke_label{display:none;}ul.cke_panel_list{list-style-type:none;margin:3px;padding:0;white-space:nowrap;}li.cke_panel_listItem{margin:0;}.cke_panel_listItem a{padding:2px;display:block;border:1px solid #fff;color:inherit!important;text-decoration:none;overflow:hidden;text-overflow:ellipsis;}* html .cke_panel_listItem a{width:100%;color:#000;}*:first-child+html .cke_panel_listItem a{color:#000;}.cke_panel_listItem.cke_selected a{border:1px solid #ccc;background-color:#e9f5ff;}.cke_panel_listItem a:hover,.cke_panel_listItem a:focus,.cke_panel_listItem a:active{border-color:#316ac5;background-color:#dff1ff;}.cke_hc .cke_panel_listItem.cke_selected a,.cke_hc .cke_panel_listItem a:hover,.cke_hc .cke_panel_listItem a:focus,.cke_hc .cke_panel_listItem a:active{border-width:3px;padding:0;}.cke_panel_grouptitle{font-size:11px;font-family:'Microsoft Sans Serif',Tahoma,Arial,Verdana,Sans-Serif;font-weight:bold;white-space:nowrap;background-color:#dcdcdc;color:#000;margin:0;padding:3px;}.cke_panel_listItem p,.cke_panel_listItem h1,.cke_panel_listItem h2,.cke_panel_listItem h3,.cke_panel_listItem h4,.cke_panel_listItem h5,.cke_panel_listItem h6,.cke_panel_listItem pre{margin-top:3px;margin-bottom:3px;}.cke_skin_kama .cke_button_textcolor_panel,.cke_skin_kama .cke_button_bgcolor_panel{width:150px;height:135px;}.cke_colorblock{padding:3px;font-size:11px;font-family:'Microsoft Sans Serif',Tahoma,Arial,Verdana,Sans-Serif;}.cke_colorblock,.cke_colorblock a{text-decoration:none;color:#000;}span.cke_colorbox{width:10px;height:10px;border:#808080 1px solid;float:left;}.cke_rtl span.cke_colorbox{float:right;}a.cke_colorbox{border:#fff 1px solid;padding:2px;float:left;}.cke_rtl a.cke_colorbox{float:right;}a:hover.cke_colorbox,a:focus.cke_colorbox,a:active.cke_colorbox{border:#316ac5 1px solid;background-color:#dff1ff;}a.cke_colorauto,a.cke_colormore{border:#fff 1px solid;padding:2px;display:block;cursor:pointer;}a:hover.cke_colorauto,a:hover.cke_colormore,a:focus.cke_colorauto,a:focus.cke_colormore,a:active.cke_colorauto,a:active.cke_colormore{border:#316ac5 1px solid;background-color:#dff1ff;}@media print{.cke_skin_kama .cke_toolbox{display:none;}}.cke_skin_kama .cke_browser_webkit .cke_toolbox,.cke_skin_kama .cke_browser_webkit .cke_toolbox>span{white-space:normal;}.cke_skin_kama .cke_toolbox{clear:both;padding-bottom:1px;}.cke_skin_kama a.cke_toolbox_collapser,.cke_skin_kama a:hover.cke_toolbox_collapser{background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-position:3px -1366px;background-repeat:no-repeat;width:11px;height:11px;float:right;border:1px outset #D3D3D3;margin:11px 0 2px;cursor:pointer;}.cke_skin_kama .cke_rtl a.cke_toolbox_collapser,.cke_skin_kama .cke_rtl a:hover.cke_toolbox_collapser{float:left;}.cke_skin_kama a.cke_toolbox_collapser span{display:none;}.cke_skin_kama .cke_hc a.cke_toolbox_collapser span{font-size:10px;font-weight:bold;font-family:Arial;display:inline;}.cke_skin_kama a.cke_toolbox_collapser_min,.cke_skin_kama a:hover.cke_toolbox_collapser_min{background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-position:4px -1387px;background-repeat:no-repeat;margin:2px 4px;}.cke_skin_kama .cke_rtl a.cke_toolbox_collapser_min,.cke_skin_kama .cke_rtl a:hover.cke_toolbox_collapser_min{background-position:4px -1408px;}.cke_skin_kama .cke_toolbar{display:inline;}.cke_skin_kama .cke_separator{display:none;}.cke_skin_kama .cke_break{font-size:0;clear:left;}.cke_skin_kama .cke_rtl .cke_break{clear:right;}.cke_skin_kama .cke_toolbar_start{display:none;}.cke_skin_kama .cke_toolgroup{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-repeat:repeat-x;background-position:0 -500px;float:left;margin-right:6px;margin-bottom:5px;padding:2px;display:inline;}
+.cke_skin_kama .cke_rtl .cke_toolgroup{float:right;margin-right:0;margin-left:6px;}.cke_skin_kama .cke_toolgroup{display:block;height:22px;}.cke_skin_kama .cke_button a,.cke_skin_kama .cke_button a:hover,.cke_skin_kama .cke_button a:focus,.cke_skin_kama .cke_button a:active,.cke_skin_kama .cke_button a.cke_off{border-radius:3px;outline:none;padding:2px 4px;height:18px;display:inline-block;cursor:default;}.cke_skin_kama .cke_button a,.cke_skin_kama .cke_button a.cke_off{filter:alpha(opacity=70);opacity:.70;-moz-border-radius:3px;-webkit-border-radius:3px;}.cke_skin_kama .cke_hc .cke_button a,.cke_skin_kama .cke_hc .cke_button a.cke_off{opacity:1.0;filter:alpha(opacity=100);border:1px solid white;}.cke_skin_kama .cke_button a.cke_on{background-color:#a3d7ff;filter:alpha(opacity=100);opacity:1;padding:2px 4px;}.cke_skin_kama .cke_hc .cke_button a.cke_on{padding:0 2px!important;border-width:3px;}.cke_skin_kama .cke_button a.cke_disabled *{filter:alpha(opacity=30);opacity:.3;}.cke_skin_kama .cke_browser_ie .cke_button a.cke_disabled *,.cke_skin_kama .cke_browser_ie a:hover.cke_button .cke_disabled *{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale'), alpha(opacity=30);}.cke_skin_kama .cke_browser_ie .cke_rtl .cke_button a.cke_disabled *,.cke_skin_kama .cke_browser_ie .cke_rtl a:hover.cke_button .cke_disabled *{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale'), alpha(opacity=30);}.cke_skin_kama .cke_browser_ie6 .cke_button a.cke_disabled *,.cke_skin_kama .cke_browser_ie6 a:hover.cke_button .cke_disabled *,.cke_skin_kama .cke_browser_ie .cke_button.cke_noalphafix a.cke_disabled *{filter:alpha(opacity=30);}.cke_skin_kama .cke_hc .cke_button a.cke_disabled *,.cke_skin_kama .cke_browser_ie.cke_hc a:hover.cke_button .cke_disabled *{filter:alpha(opacity=60);opacity:.6;}.cke_skin_kama .cke_button a:hover.cke_on,.cke_skin_kama .cke_button a:focus.cke_on,.cke_skin_kama .cke_button a:active.cke_on,.cke_skin_kama .cke_button a:hover.cke_off,.cke_skin_kama .cke_button a:focus.cke_off,.cke_skin_kama .cke_button a:active.cke_off{filter:alpha(opacity=100);opacity:1;padding:2px 4px;}.cke_skin_kama .cke_button a:hover,.cke_skin_kama .cke_button a:focus,.cke_skin_kama .cke_button a:active{background-color:#dff1ff;}.cke_skin_kama .cke_button a:hover.cke_on,.cke_skin_kama .cke_button a:focus.cke_on,.cke_skin_kama .cke_button a:active.cke_on{background-color:#86caff;}.cke_skin_kama .cke_hc .cke_button a:hover,.cke_skin_kama .cke_hc .cke_button a:focus,.cke_skin_kama .cke_hc .cke_button a:active{padding:0 2px!important;border-width:3px;}.cke_skin_kama .cke_button .cke_icon{background-image:url(icons.png);background-position:100px;background-repeat:no-repeat;margin-top:1px;width:16px;height:16px;display:inline-block;float:left;cursor:default;}.cke_skin_kama .cke_rtl .cke_button .cke_icon{background-image:url(icons_rtl.png);}.cke_skin_kama .cke_browser_ie .cke_button .cke_icon{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale');}.cke_skin_kama .cke_browser_ie .cke_rtl .cke_button .cke_icon{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale');}.cke_skin_kama .cke_browser_ie6 .cke_button .cke_icon,.cke_skin_kama .cke_browser_ie6 .cke_rtl .cke_button .cke_icon,.cke_skin_kama .cke_browser_ie .cke_button.cke_noalphafix .cke_icon,.cke_skin_kama .cke_browser_ie .cke_rtl .cke_button.cke_noalphafix .cke_icon{filter:;}.cke_skin_kama .cke_rtl .cke_button .cke_icon{float:right;}.cke_skin_kama .cke_button .cke_label{cursor:default;display:none;padding-left:3px;line-height:18px;vertical-align:middle;float:left;}.cke_skin_kama .cke_rtl .cke_button .cke_label{padding-left:0;padding-right:3px;float:right;}.cke_skin_kama .cke_hc .cke_button .cke_label{padding:0;display:inline-block;}.cke_skin_kama .cke_hc .cke_button .cke_icon{display:none;}.cke_skin_kama .cke_accessibility{position:absolute;display:block;width:0;height:0;overflow:hidden;}.cke_skin_kama .cke_button .cke_buttonarrow{display:inline-block;height:17px;width:8px;background-position:2px -1469px;background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-repeat:no-repeat;float:left;cursor:default;}
+.cke_skin_kama .cke_browser_ie .cke_button .cke_buttonarrow{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale');}.cke_skin_kama .cke_browser_ie6 .cke_button .cke_buttonarrow{filter:;}.cke_skin_kama .cke_rtl .cke_button .cke_buttonarrow{background-position:0 -1469px;float:right;}.cke_skin_kama .cke_browser_gecko .cke_toolbar,.cke_skin_kama .cke_browser_gecko .cke_button a,.cke_skin_kama .cke_browser_gecko .cke_button a.cke_off,.cke_skin_kama .cke_browser_gecko .cke_button .cke_icon,.cke_skin_kama .cke_browser_gecko .cke_button .cke_buttonarrow,.cke_skin_kama .cke_browser_gecko .cke_separator,.cke_skin_kama .cke_browser_gecko .cke_toolbar_start{display:block;float:left;}.cke_skin_kama .cke_browser_gecko.cke_hc .cke_button .cke_icon{display:none;}.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_toolbar,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_button a,.cke_skin_kama .cke_browser_gecko .cke_rtl.cke_button a.cke_off,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_button .cke_icon,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_button .cke_buttonarrow,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_toolbar_start{float:right;}.cke_skin_kama .cke_browser_gecko .cke_button .cke_label,.cke_skin_kama .cke_browser_gecko .cke_break{float:left;}.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_button .cke_label,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_break{float:right;}.cke_skin_kama .cke_browser_ie .cke_rtl .cke_button .cke_icon,.cke_skin_kama .cke_browser_ie .cke_rtl .cke_button .cke_label,.cke_skin_kama .cke_browser_ie .cke_rtl .cke_button .cke_buttonarrow{float:none;}.cke_skin_kama .cke_browser_webkit .cke_toolbar{float:left;}.cke_skin_kama .cke_browser_webkit .cke_rtl .cke_toolbar{float:right;}.cke_skin_kama .cke_browser_ie8 .cke_button .cke_label,.cke_skin_kama .cke_browser_opera .cke_button .cke_label,.cke_skin_kama .cke_browser_webkit .cke_button .cke_label{line-height:20px;}.cke_skin_kama .cke_browser_opera.cke_browser_quirks .cke_button .cke_label,.cke_skin_kama .cke_browser_iequirks .cke_button .cke_label{line-height:17px;}.cke_skin_kama .cke_browser_ie .cke_rcombo,.cke_skin_kama .cke_browser_ie .cke_rcombo *{cursor:default;}.cke_skin_kama .cke_browser_ie .cke_toolbox{padding-bottom:5px;_padding-bottom:6px;}.cke_shared .cke_skin_kama .cke_browser_ie .cke_toolbox{padding-bottom:0;}.cke_skin_kama .cke_contextmenu{padding:2px;}.cke_skin_kama .cke_menuitem a{display:block;}.cke_skin_kama .cke_menuitem span{cursor:default;}.cke_skin_kama .cke_menuitem a:hover,.cke_skin_kama .cke_menuitem a:focus,.cke_skin_kama .cke_menuitem a:active{background-color:#D3D3D3;display:block;}.cke_hc .cke_menuitem a:hover,.cke_hc .cke_menuitem a:focus,.cke_hc .cke_menuitem a:active{border:2px solid;}.cke_skin_kama .cke_menuitem .cke_icon{background-image:url(icons.png);background-position:100px;background-repeat:no-repeat;background-color:transparent;width:16px;height:16px;float:left;}.cke_rtl .cke_skin_kama .cke_menuitem .cke_icon{background-image:url(icons_rtl.png);}.cke_browser_ie .cke_skin_kama .cke_menuitem .cke_icon{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale');}.cke_browser_ie.cke_rtl .cke_skin_kama .cke_menuitem .cke_icon{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale');}.cke_browser_ie6 .cke_skin_kama .cke_menuitem .cke_icon,.cke_browser_ie .cke_skin_kama .cke_menuitem.cke_noalphafix .cke_icon{filter:;}.cke_skin_kama .cke_menuitem .cke_disabled .cke_icon{filter:alpha(opacity=70);opacity:.70;}.cke_browser_ie .cke_skin_kama .cke_menuitem .cke_disabled .cke_icon{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale');}.cke_browser_ie.cke_rtl .cke_skin_kama .cke_menuitem .cke_disabled .cke_icon{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale');}.cke_browser_ie6 .cke_skin_kama .cke_menuitem .cke_disabled .cke_icon,.cke_browser_ie .cke_skin_kama .cke_menuitem.cke_noalphafix .cke_disabled .cke_icon{filter:;}.cke_skin_kama .cke_menuitem .cke_icon_wrapper{background-color:#D3D3D3;border:solid 4px #D3D3D3;width:16px;height:16px;float:left;filter:alpha(opacity=70);opacity:.70;clear:both;}
+.cke_rtl .cke_skin_kama .cke_menuitem .cke_icon_wrapper{float:right;}.cke_skin_kama .cke_menuitem a:hover .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:focus .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:active .cke_icon_wrapper{background-color:#9d9d9d;border:solid 4px #9d9d9d;filter:alpha(opacity=70);opacity:.70;}.cke_skin_kama .cke_menuitem a:hover.cke_disabled .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:focus.cke_disabled .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:active.cke_disabled .cke_icon_wrapper{background-color:#D3D3D3;border:solid 4px #D3D3D3;}.cke_skin_kama .cke_menuitem .cke_label{display:block;padding-right:3px;padding-top:5px;padding-left:4px;height:19px;margin-left:24px;background-color:#fff;}.cke_skin_kama .cke_frameLoaded .cke_menuitem .cke_label{filter:alpha(opacity=70);opacity:.70;}.cke_rtl .cke_skin_kama .cke_menuitem .cke_label{padding-right:0;margin-left:0;padding-left:3px;margin-right:28px;}.cke_skin_kama .cke_menuitem a.cke_disabled .cke_label{filter:alpha(opacity=30);opacity:.30;}.cke_skin_kama .cke_menuitem a:hover .cke_label,.cke_skin_kama .cke_menuitem a:focus .cke_label,.cke_skin_kama .cke_menuitem a:active .cke_label{background-color:#D3D3D3;}.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:active .cke_label{background-color:transparent;}.cke_skin_kama .cke_menuseparator{background-color:#D3D3D3;height:2px;filter:alpha(opacity=70);opacity:.70;_font-size:0;}.cke_skin_kama .cke_menuarrow{background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-position:0 -1411px;background-repeat:no-repeat;height:5px;width:3px;float:right;margin-right:2px;margin-top:3px;}.cke_rtl .cke_skin_kama .cke_menuarrow{float:left;margin-right:0;margin-left:2px;background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-position:0 -1390px;background-repeat:no-repeat;}.cke_skin_kama .cke_menuarrow span{display:none;}.cke_hc .cke_skin_kama .cke_menuarrow{width:auto;margin-top:0;}.cke_hc .cke_skin_kama .cke_menuarrow span{display:inline;}.cke_browser_ie.cke_ltr .cke_skin_kama .cke_menuarrow{position:absolute;right:2px;}.cke_browser_ie.cke_rtl .cke_skin_kama .cke_menuarrow{position:absolute;left:2px;}.cke_skin_kama .cke_rcombo{display:inline;}.cke_skin_kama .cke_rcombopanel{border:1px solid #8F8F73;-moz-border-radius-topleft:0;-webkit-border-top-left-radius:0;border-top-left-radius:0;height:auto;_height:100px;}.cke_skin_kama .cke_rcombo a,.cke_skin_kama .cke_rcombo a:active,.cke_skin_kama .cke_rcombo a:hover{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-repeat:repeat-x;background-position:0 -100px;border-bottom:1px solid #DAD9D9;border-right:1px solid #DAD9D9;float:left;padding:2px;height:21px;margin-right:6px;}.cke_skin_kama .cke_rtl .cke_rcombo a,.cke_skin_kama .cke_rtl .cke_rcombo a:active,.cke_skin_kama .cke_rtl .cke_rcombo a:hover{float:right;margin-right:0;margin-left:6px;}.cke_skin_kama .cke_hc .cke_rcombo a{filter:alpha(opacity=100);opacity:1.0;}.cke_skin_kama .cke_rcombo .cke_label{display:none;line-height:26px;vertical-align:top;margin-right:5px;filter:alpha(opacity=70);opacity:.70;}.cke_skin_kama .cke_rtl .cke_rcombo .cke_label{margin-right:0;margin-left:5px;}.cke_skin_kama .cke_rcombo .cke_inline_label{line-height:21px;font-style:italic;color:#666;}.cke_skin_kama .cke_hc .cke_rcombo .cke_openbutton{vertical-align:top;}.cke_skin_kama .cke_hc .cke_rcombo .cke_label{filter:alpha(opacity=100);opacity:1.0;}.cke_skin_kama .cke_rcombo .cke_text{filter:alpha(opacity=70);opacity:.70;height:21px;line-height:21px;width:60px;text-overflow:ellipsis;overflow:hidden;display:inline-block;margin:0 2px 0 4px;cursor:default;}.cke_skin_kama .cke_rtl .cke_rcombo .cke_text{margin:0 4px 0 2px;}.cke_skin_kama .cke_rcombo .cke_openbutton{background-image:url(images/sprites.png);_background-image:url(images/sprites_ie6.png);background-position:0 -68px;background-repeat:no-repeat;display:inline-block;width:17px;height:19px;margin:1px 2px;background-repeat:no-repeat;}
+.cke_skin_kama .cke_rcombo .cke_openbutton span{display:none;}.cke_skin_kama .cke_hc .cke_rcombo .cke_openbutton span{display:inline;}.cke_skin_kama .cke_browser_iequirks .cke_rcombo .cke_openbutton{margin-bottom:0;}.cke_skin_kama .cke_rcombo .cke_off a:hover .cke_text,.cke_skin_kama .cke_rcombo .cke_off a:focus .cke_text,.cke_skin_kama .cke_rcombo .cke_off a:active .cke_text,.cke_skin_kama .cke_rcombo .cke_on .cke_text{border-color:#316ac5;filter:alpha(opacity=100);opacity:1;}.cke_skin_kama .cke_rcombo .cke_off a:hover .cke_openbutton,.cke_skin_kama .cke_rcombo .cke_off a:focus .cke_openbutton,.cke_skin_kama .cke_rcombo .cke_off a:active .cke_openbutton,.cke_skin_kama .cke_rcombo .cke_on .cke_openbutton{border-color:#316ac5;background-color:#dff1ff;}.cke_skin_kama .cke_rcombo .cke_on .cke_text{-moz-border-radius-bottomleft:0;-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;}.cke_skin_kama .cke_rcombo .cke_on .cke_openbutton{-moz-border-radius-bottomright:0;-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;}.cke_skin_kama .cke_rcombo .cke_disabled .cke_label{filter:alpha(opacity=30);opacity:.3;}.cke_skin_kama .cke_hc .cke_rcombo .cke_disabled .cke_label{filter:alpha(opacity=70);opacity:.7;}.cke_skin_kama .cke_rcombo .cke_disabled .cke_text,.cke_skin_kama .cke_rcombo .cke_disabled .cke_openbutton{filter:alpha(opacity=50);opacity:.5;}.cke_skin_kama .cke_browser_ie .cke_rcombo .cke_disabled .cke_openbutton{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale'), alpha(opacity=50);}.cke_skin_kama .cke_browser_ie6 .cke_rcombo .cke_disabled .cke_openbutton{filter:alpha(opacity=50);}.cke_skin_kama .cke_hc .cke_rcombo .cke_disabled .cke_text,.cke_skin_kama .cke_hc .cke_rcombo .cke_disabled .cke_openbutton{filter:alpha(opacity=80);opacity:.8;}.cke_skin_kama .cke_rcombo .cke_disabled .cke_text{color:#fff;}.cke_skin_kama .cke_browser_gecko .cke_rcombo .cke_text,.cke_skin_kama .cke_browser_gecko .cke_rcombo .cke_openbutton,.cke_skin_kama .cke_browser_webkit .cke_rcombo .cke_text,.cke_skin_kama .cke_browser_webkit .cke_rcombo .cke_openbutton{display:block;float:left;}.cke_skin_kama .cke_browser_gecko .cke_rcombo .cke_label,.cke_skin_kama .cke_browser_webkit .cke_rcombo .cke_label{float:left;}.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_rcombo .cke_label,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_rcombo .cke_text,.cke_skin_kama .cke_browser_gecko .cke_rtl .cke_rcombo .cke_openbutton,.cke_skin_kama .cke_browser_webkit .cke_rtl .cke_rcombo .cke_label,.cke_skin_kama .cke_browser_webkit .cke_rtl .cke_rcombo .cke_text,.cke_skin_kama .cke_browser_webkit .cke_rtl .cke_rcombo .cke_openbutton{float:right;}.cke_skin_kama .cke_browser_ie7 .cke_rcombo .cke_text{line-height:18px;}.cke_skin_kama .cke_browser_ie6 .cke_rcombo .cke_text,.cke_skin_kama .cke_browser_iequirks .cke_rcombo .cke_text{height:auto;line-height:17px;}.cke_skin_kama .cke_rtl .cke_rcombo .cke_font .cke_text,.cke_skin_kama .cke_rtl .cke_rcombo .cke_fontSize .cke_text{direction:ltr;}@media print{.cke_path{display:none;}}.cke_skin_kama .cke_path{display:inline-block;float:left;margin-top:5px;}.cke_skin_kama .cke_rtl .cke_path{float:right;}.cke_shared .cke_skin_kama .cke_path{_width:100%;margin:0 0 5px;}.cke_skin_kama .cke_path a,.cke_skin_kama .cke_path .cke_empty{display:inline-block;float:left;padding:1px 4px 0;color:#60676a;cursor:default;}.cke_skin_kama .cke_path .cke_empty{visibility:hidden;}.cke_skin_kama .cke_rtl .cke_path a,.cke_skin_kama .cke_rtl .cke_path cke_empty{float:right;}.cke_skin_kama .cke_path a:hover,.cke_skin_kama .cke_path a:focus,.cke_skin_kama .cke_path a:active{background-color:#dff1ff;padding:1px 4px 0;outline:none;color:#000;}.cke_skin_kama .cke_browser_ie .cke_rtl .cke_path a,.cke_skin_kama .cke_browser_ie .cke_rtl .cke_path .cke_empty{float:none;}.cke_skin_kama .cke_path .cke_label{display:none;}.cke_skin_kama .cke_button_source .cke_icon{background-position:0 0;}.cke_skin_kama .cke_button_newpage .cke_icon{background-position:0 -48px;}.cke_skin_kama .cke_button_preview .cke_icon{background-position:0 -64px;}
+.cke_skin_kama .cke_button_cut .cke_icon{background-position:0 -96px;}.cke_skin_kama .cke_button_copy .cke_icon{background-position:0 -112px;}.cke_skin_kama .cke_button_paste .cke_icon{background-position:0 -128px;}.cke_skin_kama .cke_button_pastetext .cke_icon{background-position:0 -144px;}.cke_skin_kama .cke_button_find .cke_icon{background-position:0 -240px;}.cke_skin_kama .cke_button_replace .cke_icon{background-position:0 -256px;}.cke_skin_kama .cke_button_selectAll .cke_icon{background-position:0 -272px;}.cke_skin_kama .cke_button_removeFormat .cke_icon{background-position:0 -288px;}.cke_skin_kama .cke_button_bold .cke_icon{background-position:0 -304px;}.cke_skin_kama .cke_button_italic .cke_icon{background-position:0 -320px;}.cke_skin_kama .cke_button_underline .cke_icon{background-position:0 -336px;}.cke_skin_kama .cke_button_strike .cke_icon{background-position:0 -352px;}.cke_skin_kama .cke_button_subscript .cke_icon{background-position:0 -368px;}.cke_skin_kama .cke_button_superscript .cke_icon{background-position:0 -384px;}.cke_skin_kama .cke_button_table .cke_icon{background-position:0 -608px;}.cke_skin_kama .cke_button_horizontalrule .cke_icon{background-position:0 -624px;}.cke_skin_kama .cke_button_smiley .cke_icon{background-position:0 -640px;}.cke_skin_kama .cke_button_link .cke_icon{background-position:0 -528px;}.cke_skin_kama .cke_button_unlink .cke_icon{background-position:0 -544px;}.cke_skin_kama .cke_button_anchor .cke_icon{background-position:0 -560px;}.cke_skin_kama .cke_button_image .cke_icon{background-position:0 -576px;}.cke_skin_kama .cke_button_flash .cke_icon{background-position:0 -592px;}.cke_skin_kama .cke_button_specialchar .cke_icon{background-position:0 -656px;}.cke_skin_kama .cke_button_pagebreak .cke_icon{background-position:0 -672px;}.cke_skin_kama .cke_button_print .cke_icon{background-position:0 -176px;}.cke_skin_kama .cke_button_checkspell .cke_icon,.cke_skin_kama .cke_button_scayt .cke_icon{background-position:0 -192px;}.cke_skin_kama .cke_button_pagebreak .cke_icon{background-position:0 -672px;}.cke_skin_kama .cke_button_textcolor .cke_icon{background-position:0 -704px;}.cke_skin_kama .cke_button_bgcolor .cke_icon{background-position:0 -720px;}.cke_skin_kama .cke_button_form .cke_icon{background-position:0 -752px;}.cke_skin_kama .cke_button_checkbox .cke_icon{background-position:0 -768px;}.cke_skin_kama .cke_button_radio .cke_icon{background-position:0 -784px;}.cke_skin_kama .cke_button_textfield .cke_icon{background-position:0 -800px;}.cke_skin_kama .cke_button_textarea .cke_icon{background-position:0 -816px;}.cke_skin_kama .cke_button_showblocks .cke_icon{background-position:0 -1136px;}.cke_skin_kama .cke_button_select .cke_icon{background-position:0 -832px;}.cke_skin_kama .cke_button_button .cke_icon{background-position:0 -848px;}.cke_skin_kama .cke_button_imagebutton .cke_icon{background-position:0 -864px;}.cke_skin_kama .cke_button_hiddenfield .cke_icon{background-position:0 -880px;}.cke_skin_kama .cke_button_undo .cke_icon{background-position:0 -208px;}.cke_skin_kama .cke_rtl .cke_button_undo .cke_icon{background-position:0 -224px;}.cke_skin_kama .cke_button_redo .cke_icon{background-position:0 -224px;}.cke_skin_kama .cke_rtl .cke_button_redo .cke_icon{background-position:0 -208px;}.cke_skin_kama .cke_button_templates .cke_icon{background-position:0 -80px;}.cke_skin_kama .cke_button_numberedlist .cke_icon{background-position:0 -400px;}.cke_skin_kama .cke_button_bulletedlist .cke_icon{background-position:0 -416px;}.cke_skin_kama .cke_mixed_dir_content .cke_button_numberedlist .cke_icon{background-position:0 -1217px;}.cke_skin_kama .cke_mixed_dir_content .cke_button_bulletedlist .cke_icon{background-position:0 -1233px;}.cke_skin_kama .cke_button_outdent .cke_icon{background-position:0 -432px;}.cke_skin_kama .cke_button_indent .cke_icon{background-position:0 -448px;}.cke_skin_kama .cke_mixed_dir_content .cke_button_indent .cke_icon{background-position:0 -1265px;}.cke_skin_kama .cke_mixed_dir_content .cke_button_outdent .cke_icon{background-position:0 -1249px;}.cke_skin_kama .cke_button_justifyleft .cke_icon{background-position:0 -464px;}
+.cke_skin_kama .cke_button_justifycenter .cke_icon{background-position:0 -480px;}.cke_skin_kama .cke_button_justifyright .cke_icon{background-position:0 -496px;}.cke_skin_kama .cke_button_justifyblock .cke_icon{background-position:0 -512px;}.cke_skin_kama .cke_button_blockquote .cke_icon{background-position:0 -1152px;}.cke_skin_kama .cke_button_creatediv .cke_icon{background-position:0 -1168px;}.cke_skin_kama .cke_button_editdiv .cke_icon{background-position:0 -1184px;}.cke_skin_kama .cke_button_removediv .cke_icon{background-position:0 -1200px;}.cke_skin_kama .cke_button_flash .cke_icon{background-position:0 -592px;}.cke_skin_kama .cke_button_pastefromword .cke_icon{background-position:0 -160px;}.cke_skin_kama .cke_button_save .cke_icon{background-position:0 -32px;}.cke_skin_kama .cke_button_about .cke_icon{background-position:0 -736px;}.cke_skin_kama .cke_button_maximize .cke_icon{background-position:0 -1040px;}.cke_skin_kama .cke_button_editdiv .cke_icon{background-position:0 -1184px;}.cke_skin_kama .cke_button_bidirtl .cke_icon{background-position:0 -1072px;}.cke_skin_kama .cke_button_bidiltr .cke_icon{background-position:0 -1056px;}.cke_skin_kama .cke_button_iframe .cke_icon{background-position:0 -1279px;}.cke_skin_kama .cke_button_source .cke_label{display:inline;}.cke_skin_kama .cke_styles_panel{width:150px;height:170px;}.cke_skin_kama .cke_format_panel{width:150px;height:170px;}.cke_skin_kama .cke_font_panel{width:150px;height:170px;}.cke_skin_kama .cke_fontSize_panel{height:170px;}.cke_skin_kama .cke_fontSize .cke_text{width:25px;}.cke_skin_kama .cke_browser_iequirks .cke_fontSize .cke_text{width:32px;}html .cke_skin_kama{visibility:inherit;}html.cke_skin_kama_container{visibility:visible;}
diff --git a/appsrc/ODS-Framework/ckeditor/skins/kama/icons.png b/appsrc/ODS-Framework/ckeditor/skins/kama/icons.png
index 394ce89..7c3bf19 100644
Binary files a/appsrc/ODS-Framework/ckeditor/skins/kama/icons.png and b/appsrc/ODS-Framework/ckeditor/skins/kama/icons.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/skins/kama/icons_rtl.png b/appsrc/ODS-Framework/ckeditor/skins/kama/icons_rtl.png
new file mode 100644
index 0000000..83eee28
Binary files /dev/null and b/appsrc/ODS-Framework/ckeditor/skins/kama/icons_rtl.png differ
diff --git a/appsrc/ODS-Framework/ckeditor/skins/kama/skin.js b/appsrc/ODS-Framework/ckeditor/skins/kama/skin.js
index 936edc1..19c7473 100644
--- a/appsrc/ODS-Framework/ckeditor/skins/kama/skin.js
+++ b/appsrc/ODS-Framework/ckeditor/skins/kama/skin.js
@@ -1,7 +1,7 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.skins.add('kama',(function(){var a=[],b='cke_ui_color';if(CKEDITOR.env.ie&&CKEDITOR.env.version<7)a.push('icons.png','images/sprites_ie6.png','images/dialog_sides.gif');return{preload:a,editor:{css:['editor.css']},dialog:{css:['dialog.css']},templates:{css:['templates.css']},margins:[0,0,0,0],init:function(c){if(c.config.width&&!isNaN(c.config.width))c.config.width-=12;var d=[],e=/\$color/g,f='/* UI Color Support */.cke_skin_kama .cke_menuitem .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuitem a:hover .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:focus .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:active .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuitem a:hover .cke_label,.cke_skin_kama .cke_menuitem a:focus .cke_label,.cke_skin_kama .cke_menuitem a:active .cke_label{\tbackground-color: $color !important;}.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:active .cke_label{\tbackground-color: transparent !important;}.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a.cke_disabled:active .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuitem a.cke_disabled .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuseparator{\tbackground-color: $color !important;}.cke_skin_kama .cke_menuitem a:hover,.cke_skin_kama .cke_menuitem a:focus,.cke_skin_kama .cke_menuitem a:active{\tbackground-color: $color !important;}';if(CKEDITOR.env.webkit){f=f.split('}').slice(0,-1);for(var g=0;g<f.length;g++)f[g]=f[g].split('{');}function h(k){var l=k.getById(b);if(!l){l=k.getHead().append('style');l.setAttribute('id',b);l.setAttribute('type','text/css');}return l;};function i(k,l,m){var n,o,p;for(var q=0;q<k.length;q++){if(CKEDITOR.env.webkit)for(o=0;o<l.length;o++){p=l[o][1];for(n=0;n<m.length;n++)p=p.replace(m[n][0],m[n][1]);k[q].$.sheet.addRule(l[o][0],p);}else{p=l;for(n=0;n<m.length;n++)p=p.replace(m[n][0],m[n][1]);if(CKEDITOR.env.ie)k[q].$.styleSheet.cssText+=p;else k[q].$.innerHTML+=p;}}};var j=/\$color/g;CKEDITOR.tools.extend(c,{uiColor:null,getUiColor:function(){return this.uiColor;
-},setUiColor:function(k){var l,m=h(CKEDITOR.document),n='.cke_editor_'+CKEDITOR.tools.escapeCssSelector(c.name),o=[n+' .cke_wrapper',n+'_dialog .cke_dialog_contents',n+'_dialog a.cke_dialog_tab',n+'_dialog .cke_dialog_footer'].join(','),p='background-color: $color !important;';if(CKEDITOR.env.webkit)l=[[o,p]];else l=o+'{'+p+'}';return(this.setUiColor=function(q){var r=[[j,q]];c.uiColor=q;i([m],l,r);i(d,f,r);})(k);}});c.on('menuShow',function(k){var l=k.data[0],m=l.element.getElementsByTag('iframe').getItem(0).getFrameDocument();if(!m.getById('cke_ui_color')){var n=h(m);d.push(n);var o=c.getUiColor();if(o)i([n],f,[[j,o]]);}});if(c.config.uiColor)c.setUiColor(c.config.uiColor);}};})());(function(){CKEDITOR.dialog?a():CKEDITOR.on('dialogPluginReady',a);function a(){CKEDITOR.dialog.on('resize',function(b){var c=b.data,d=c.width,e=c.height,f=c.dialog,g=f.parts.contents;if(c.skin!='kama')return;g.setStyles({width:d+'px',height:e+'px'});setTimeout(function(){var h=f.parts.dialog.getChild([0,0,0]),i=h.getChild(0),j=h.getChild(2);j.setStyle('width',i.$.offsetWidth+'px');j=h.getChild(7);j.setStyle('width',i.$.offsetWidth-28+'px');j=h.getChild(4);j.setStyle('height',i.$.offsetHeight-31-14+'px');j=h.getChild(5);j.setStyle('height',i.$.offsetHeight-31-14+'px');},100);});};})();
+CKEDITOR.skins.add('kama',(function(){var a='cke_ui_color';return{editor:{css:['editor.css']},dialog:{css:['dialog.css']},templates:{css:['templates.css']},margins:[0,0,0,0],init:function(b){if(b.config.width&&!isNaN(b.config.width))b.config.width-=12;var c=[],d=/\$color/g,e='/* UI Color Support */.cke_skin_kama .cke_menuitem .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuitem a:hover .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:focus .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a:active .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuitem a:hover .cke_label,.cke_skin_kama .cke_menuitem a:focus .cke_label,.cke_skin_kama .cke_menuitem a:active .cke_label{\tbackground-color: $color !important;}.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_label,.cke_skin_kama .cke_menuitem a.cke_disabled:active .cke_label{\tbackground-color: transparent !important;}.cke_skin_kama .cke_menuitem a.cke_disabled:hover .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a.cke_disabled:focus .cke_icon_wrapper,.cke_skin_kama .cke_menuitem a.cke_disabled:active .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuitem a.cke_disabled .cke_icon_wrapper{\tbackground-color: $color !important;\tborder-color: $color !important;}.cke_skin_kama .cke_menuseparator{\tbackground-color: $color !important;}.cke_skin_kama .cke_menuitem a:hover,.cke_skin_kama .cke_menuitem a:focus,.cke_skin_kama .cke_menuitem a:active{\tbackground-color: $color !important;}';if(CKEDITOR.env.webkit){e=e.split('}').slice(0,-1);for(var f=0;f<e.length;f++)e[f]=e[f].split('{');}function g(j){var k=j.getById(a);if(!k){k=j.getHead().append('style');k.setAttribute('id',a);k.setAttribute('type','text/css');}return k;};function h(j,k,l){var m,n,o;for(var p=0;p<j.length;p++){if(CKEDITOR.env.webkit)for(n=0;n<k.length;n++){o=k[n][1];for(m=0;m<l.length;m++)o=o.replace(l[m][0],l[m][1]);j[p].$.sheet.addRule(k[n][0],o);}else{o=k;for(m=0;m<l.length;m++)o=o.replace(l[m][0],l[m][1]);if(CKEDITOR.env.ie)j[p].$.styleSheet.cssText+=o;else j[p].$.innerHTML+=o;}}};var i=/\$color/g;CKEDITOR.tools.extend(b,{uiColor:null,getUiColor:function(){return this.uiColor;},setUiColor:function(j){var k,l=g(CKEDITOR.document),m='.'+b.id,n=[m+' .cke_wrapper',m+'_dialog .cke_dialog_contents',m+'_dialog a.cke_dialog_tab',m+'_dialog .cke_dialog_footer'].join(','),o='background-color: $color !important;';
+if(CKEDITOR.env.webkit)k=[[n,o]];else k=n+'{'+o+'}';return(this.setUiColor=function(p){var q=[[i,p]];b.uiColor=p;h([l],k,q);h(c,e,q);})(j);}});b.on('menuShow',function(j){var k=j.data[0],l=k.element.getElementsByTag('iframe').getItem(0).getFrameDocument();if(!l.getById('cke_ui_color')){var m=g(l);c.push(m);var n=b.getUiColor();if(n)h([m],e,[[i,n]]);}});if(b.config.uiColor)b.setUiColor(b.config.uiColor);}};})());(function(){CKEDITOR.dialog?a():CKEDITOR.on('dialogPluginReady',a);function a(){CKEDITOR.dialog.on('resize',function(b){var c=b.data,d=c.width,e=c.height,f=c.dialog,g=f.parts.contents;if(c.skin!='kama')return;g.setStyles({width:d+'px',height:e+'px'});});};})();
diff --git a/appsrc/ODS-Framework/ckeditor/skins/kama/templates.css b/appsrc/ODS-Framework/ckeditor/skins/kama/templates.css
index 1c6b195..9441486 100644
--- a/appsrc/ODS-Framework/ckeditor/skins/kama/templates.css
+++ b/appsrc/ODS-Framework/ckeditor/skins/kama/templates.css
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
diff --git a/appsrc/ODS-Framework/ckeditor/themes/default/theme.js b/appsrc/ODS-Framework/ckeditor/themes/default/theme.js
index f9e67e0..171fb00 100644
--- a/appsrc/ODS-Framework/ckeditor/themes/default/theme.js
+++ b/appsrc/ODS-Framework/ckeditor/themes/default/theme.js
@@ -1,8 +1,8 @@
 /*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
 */
 
-CKEDITOR.themes.add('default',(function(){function a(b,c){var d,e;e=b.config.sharedSpaces;e=e&&e[c];e=e&&CKEDITOR.document.getById(e);if(e){var f='<span class="cke_shared"><span class="'+b.skinClass+' cke_editor_'+b.name+'">'+'<span class="'+CKEDITOR.env.cssClass+'">'+'<span class="cke_wrapper cke_'+b.lang.dir+'">'+'<span class="cke_editor">'+'<div class="cke_'+c+'">'+'</div></span></span></span></span></span>',g=e.append(CKEDITOR.dom.element.createFromHtml(f,e.getDocument()));if(e.getCustomData('cke_hasshared'))g.hide();else e.setCustomData('cke_hasshared',1);d=g.getChild([0,0,0,0]);b.on('focus',function(){for(var h=0,i,j=e.getChildren();i=j.getItem(h);h++){if(i.type==CKEDITOR.NODE_ELEMENT&&!i.equals(g)&&i.hasClass('cke_shared'))i.hide();}g.show();});b.on('destroy',function(){g.remove();});}return d;};return{build:function(b,c){var d=b.name,e=b.element,f=b.elementMode;if(!e||f==CKEDITOR.ELEMENT_MODE_NONE)return;if(f==CKEDITOR.ELEMENT_MODE_REPLACE)e.hide();var g=b.fire('themeSpace',{space:'top',html:''}).html,h=b.fire('themeSpace',{space:'contents',html:''}).html,i=b.fireOnce('themeSpace',{space:'bottom',html:''}).html,j=h&&b.config.height,k=b.config.tabIndex||b.element.getAttribute('tabindex')||0;if(!h)j='auto';else if(!isNaN(j))j+='px';var l='',m=b.config.width;if(m){if(!isNaN(m))m+='px';l+='width: '+m+';';}var n=g&&a(b,'top'),o=a(b,'bottom');n&&(n.setHtml(g),g='');o&&(o.setHtml(i),i='');var p=CKEDITOR.dom.element.createFromHtml(['<span id="cke_',d,'" onmousedown="return false;" class="',b.skinClass,' cke_editor_',d,'" dir="',b.lang.dir,'" title="',CKEDITOR.env.gecko?' ':'','" lang="',b.langCode,'"'+(CKEDITOR.env.webkit?' tabindex="'+k+'"':'')+' role="application"'+' aria-labelledby="cke_',d,'_arialbl"'+(l?' style="'+l+'"':'')+'>'+'<span id="cke_',d,'_arialbl" class="cke_voice_label">'+b.lang.editor+'</span>'+'<span class="',CKEDITOR.env.cssClass,'" role="presentation"><span class="cke_wrapper cke_',b.lang.dir,'" role="presentation"><table class="cke_editor" border="0" cellspacing="0" cellpadding="0" role="presentation"><tbody><tr',g?'':' style="display:none"',' role="presentation"><td id="cke_top_',d,'" class="cke_top" role="presentation">',g,'</td></tr><tr',h?'':' style="display:none"',' role="presentation"><td id="cke_contents_',d,'" class="cke_contents" style="height:',j,'" role="presentation">',h,'</td></tr><tr',i?'':' style="display:none"',' role="presentation"><td id="cke_bottom_',d,'" class="cke_bottom" role="presentation">',i,'</td></tr></tbody></table><style>.',b.skinClass,'{visibility:hidden;}</style></span></span></span>'].join(''));
-p.getChild([1,0,0,0,0]).unselectable();p.getChild([1,0,0,0,2]).unselectable();if(f==CKEDITOR.ELEMENT_MODE_REPLACE)p.insertAfter(e);else e.append(p);b.container=p;p.disableContextMenu();b.fireOnce('themeLoaded');b.fireOnce('uiReady');},buildDialog:function(b){var c=CKEDITOR.tools.getNextNumber(),d=CKEDITOR.dom.element.createFromHtml(['<div class="cke_editor_'+b.name.replace('.','\\.')+'_dialog cke_skin_',b.skinName,'" dir="',b.lang.dir,'" lang="',b.langCode,'" role="dialog" aria-labelledby="%title#"><table class="cke_dialog',' '+CKEDITOR.env.cssClass,' cke_',b.lang.dir,'" style="position:absolute" role="presentation"><tr><td role="presentation"><div class="%body" role="presentation"><div id="%title#" class="%title" role="presentation"></div><a id="%close_button#" class="%close_button" href="javascript:void(0)" title="'+b.lang.common.close+'" role="button"><span class="cke_label">X</span></a>'+'<div id="%tabs#" class="%tabs" role="tablist"></div>'+'<table class="%contents" role="presentation"><tr>'+'<td id="%contents#" class="%contents" role="presentation"></td>'+'</tr></table>'+'<div id="%footer#" class="%footer" role="presentation"></div>'+'</div>'+'<div id="%tl#" class="%tl"></div>'+'<div id="%tc#" class="%tc"></div>'+'<div id="%tr#" class="%tr"></div>'+'<div id="%ml#" class="%ml"></div>'+'<div id="%mr#" class="%mr"></div>'+'<div id="%bl#" class="%bl"></div>'+'<div id="%bc#" class="%bc"></div>'+'<div id="%br#" class="%br"></div>'+'</td></tr>'+'</table>',CKEDITOR.env.ie?'':'<style>.cke_dialog{visibility:hidden;}</style>','</div>'].join('').replace(/#/g,'_'+c).replace(/%/g,'cke_dialog_')),e=d.getChild([0,0,0,0,0]),f=e.getChild(0),g=e.getChild(1);f.unselectable();g.unselectable();return{element:d,parts:{dialog:d.getChild(0),title:f,close:g,tabs:e.getChild(2),contents:e.getChild([3,0,0,0]),footer:e.getChild(4)}};},destroy:function(b){var c=b.container;c.clearCustomData();b.element.clearCustomData();if(CKEDITOR.env.ie){c.setStyle('display','none');var d=document.body.createTextRange();d.moveToElementText(c.$);try{d.select();}catch(e){}}if(c)c.remove();if(b.elementMode==CKEDITOR.ELEMENT_MODE_REPLACE)b.element.show();delete b.element;}};})());CKEDITOR.editor.prototype.getThemeSpace=function(a){var b='cke_'+a,c=this._[b]||(this._[b]=CKEDITOR.document.getById(b+'_'+this.name));return c;};CKEDITOR.editor.prototype.resize=function(a,b,c,d){var e=/^\d+$/;if(e.test(a))a+='px';var f=this.container,g=CKEDITOR.document.getById('cke_contents_'+this.name),h=d?f.getChild(1):f;
-CKEDITOR.env.webkit&&h.setStyle('display','none');h.setStyle('width',a);if(CKEDITOR.env.webkit){h.$.offsetWidth;h.setStyle('display','');}var i=c?0:(h.$.offsetHeight||0)-(g.$.clientHeight||0);g.setStyle('height',Math.max(b-i,0)+'px');this.fire('resize');};CKEDITOR.editor.prototype.getResizable=function(){return this.container.getChild(1);};
+CKEDITOR.themes.add('default',(function(){function a(b,c){var d,e;e=b.config.sharedSpaces;e=e&&e[c];e=e&&CKEDITOR.document.getById(e);if(e){var f='<span class="cke_shared " dir="'+b.lang.dir+'"'+'>'+'<span class="'+b.skinClass+' '+b.id+' cke_editor_'+b.name+'">'+'<span class="'+CKEDITOR.env.cssClass+'">'+'<span class="cke_wrapper cke_'+b.lang.dir+'">'+'<span class="cke_editor">'+'<div class="cke_'+c+'">'+'</div></span></span></span></span></span>',g=e.append(CKEDITOR.dom.element.createFromHtml(f,e.getDocument()));if(e.getCustomData('cke_hasshared'))g.hide();else e.setCustomData('cke_hasshared',1);d=g.getChild([0,0,0,0]);!b.sharedSpaces&&(b.sharedSpaces={});b.sharedSpaces[c]=d;b.on('focus',function(){for(var h=0,i,j=e.getChildren();i=j.getItem(h);h++){if(i.type==CKEDITOR.NODE_ELEMENT&&!i.equals(g)&&i.hasClass('cke_shared'))i.hide();}g.show();});b.on('destroy',function(){g.remove();});}return d;};return{build:function(b,c){var d=b.name,e=b.element,f=b.elementMode;if(!e||f==CKEDITOR.ELEMENT_MODE_NONE)return;if(f==CKEDITOR.ELEMENT_MODE_REPLACE)e.hide();var g=b.fire('themeSpace',{space:'top',html:''}).html,h=b.fire('themeSpace',{space:'contents',html:''}).html,i=b.fireOnce('themeSpace',{space:'bottom',html:''}).html,j=h&&b.config.height,k=b.config.tabIndex||b.element.getAttribute('tabindex')||0;if(!h)j='auto';else if(!isNaN(j))j+='px';var l='',m=b.config.width;if(m){if(!isNaN(m))m+='px';l+='width: '+m+';';}var n=g&&a(b,'top'),o=a(b,'bottom');n&&(n.setHtml(g),g='');o&&(o.setHtml(i),i='');var p=CKEDITOR.dom.element.createFromHtml(['<span id="cke_',d,'" class="',b.skinClass,' ',b.id,' cke_editor_',d,'" dir="',b.lang.dir,'" title="',CKEDITOR.env.gecko?' ':'','" lang="',b.langCode,'"'+(CKEDITOR.env.webkit?' tabindex="'+k+'"':'')+' role="application"'+' aria-labelledby="cke_',d,'_arialbl"'+(l?' style="'+l+'"':'')+'>'+'<span id="cke_',d,'_arialbl" class="cke_voice_label">'+b.lang.editor+'</span>'+'<span class="',CKEDITOR.env.cssClass,'" role="presentation"><span class="cke_wrapper cke_',b.lang.dir,'" role="presentation"><table class="cke_editor" border="0" cellspacing="0" cellpadding="0" role="presentation"><tbody><tr',g?'':' style="display:none"',' role="presentation"><td id="cke_top_',d,'" class="cke_top" role="presentation">',g,'</td></tr><tr',h?'':' style="display:none"',' role="presentation"><td id="cke_contents_',d,'" class="cke_contents" style="height:',j,'" role="presentation">',h,'</td></tr><tr',i?'':' style="display:none"',' role="presentation"><td id="cke_bottom_',d,'" class="cke_bottom" role="presentation">',i,'</td></tr></tbody></table><style>.',b.skinClass,'{visibility:hidden;}</style></span></span></span>'].join(''));
+p.getChild([1,0,0,0,0]).unselectable();p.getChild([1,0,0,0,2]).unselectable();if(f==CKEDITOR.ELEMENT_MODE_REPLACE)p.insertAfter(e);else e.append(p);b.container=p;p.disableContextMenu();b.fireOnce('themeLoaded');b.fireOnce('uiReady');},buildDialog:function(b){var c=CKEDITOR.tools.getNextNumber(),d=CKEDITOR.dom.element.createFromHtml(['<div class="',b.id,'_dialog cke_editor_',b.name.replace('.','\\.'),'_dialog cke_skin_',b.skinName,'" dir="',b.lang.dir,'" lang="',b.langCode,'" role="dialog" aria-labelledby="%title#"><table class="cke_dialog',' '+CKEDITOR.env.cssClass,' cke_',b.lang.dir,'" style="position:absolute" role="presentation"><tr><td role="presentation"><div class="%body" role="presentation"><div id="%title#" class="%title" role="presentation"></div><a id="%close_button#" class="%close_button" href="javascript:void(0)" title="'+b.lang.common.close+'" role="button"><span class="cke_label">X</span></a>'+'<div id="%tabs#" class="%tabs" role="tablist"></div>'+'<table class="%contents" role="presentation">'+'<tr>'+'<td id="%contents#" class="%contents" role="presentation"></td>'+'</tr>'+'<tr>'+'<td id="%footer#" class="%footer" role="presentation"></td>'+'</tr>'+'</table>'+'</div>'+'<div id="%tl#" class="%tl"></div>'+'<div id="%tc#" class="%tc"></div>'+'<div id="%tr#" class="%tr"></div>'+'<div id="%ml#" class="%ml"></div>'+'<div id="%mr#" class="%mr"></div>'+'<div id="%bl#" class="%bl"></div>'+'<div id="%bc#" class="%bc"></div>'+'<div id="%br#" class="%br"></div>'+'</td></tr>'+'</table>',CKEDITOR.env.ie?'':'<style>.cke_dialog{visibility:hidden;}</style>','</div>'].join('').replace(/#/g,'_'+c).replace(/%/g,'cke_dialog_')),e=d.getChild([0,0,0,0,0]),f=e.getChild(0),g=e.getChild(1);f.unselectable();g.unselectable();return{element:d,parts:{dialog:d.getChild(0),title:f,close:g,tabs:e.getChild(2),contents:e.getChild([3,0,0,0]),footer:e.getChild([3,0,1,0])}};},destroy:function(b){var c=b.container,d=b.element;if(c){c.clearCustomData();c.remove();}if(d){d.clearCustomData();b.elementMode==CKEDITOR.ELEMENT_MODE_REPLACE&&d.show();delete b.element;}}};})());CKEDITOR.editor.prototype.getThemeSpace=function(a){var b='cke_'+a,c=this._[b]||(this._[b]=CKEDITOR.document.getById(b+'_'+this.name));return c;};CKEDITOR.editor.prototype.resize=function(a,b,c,d){var e=this.container,f=CKEDITOR.document.getById('cke_contents_'+this.name),g=d?e.getChild(1):e;CKEDITOR.env.webkit&&g.setStyle('display','none');g.setSize('width',a,true);if(CKEDITOR.env.webkit){g.$.offsetWidth;g.setStyle('display','');
+}var h=c?0:(g.$.offsetHeight||0)-(f.$.clientHeight||0);f.setStyle('height',Math.max(b-h,0)+'px');this.fire('resize');};CKEDITOR.editor.prototype.getResizable=function(){return this.container;};
diff --git a/appsrc/ODS-Framework/common.js b/appsrc/ODS-Framework/common.js
index 643ea96..11e8ea4 100644
--- a/appsrc/ODS-Framework/common.js
+++ b/appsrc/ODS-Framework/common.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: common.js,v 1.13.2.29 2010/07/06 23:09:10 source Exp $
+ *  $Id: common.js,v 1.13.2.40 2011/03/26 14:22:25 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -21,6 +21,11 @@
  *
  */
 
+function showError(msg) {
+  alert(msg);
+  return false;
+}
+
 function toggleControl (ctr1, val, ctr2)
 {
   if (ctr2 == null)
@@ -344,9 +349,12 @@ function callSparql (graph, qry_id, res_id, rdf_gem)
   OAT.Ajax.command(OAT.Ajax.POST, endpoint, body, callback, OAT.Ajax.TYPE_TEXT,{'Accept':format});
 }
 
-function hasError(root) {
+function hasError(root, showMessage) {
+  if (showMessage != false)
+    showMessage = true;
 	if (!root)
 	{
+	  if (showMessage)
 		alert('No data!');
 		return true;
 	}
@@ -356,7 +364,7 @@ function hasError(root) {
   if (error)
   {
 	    var message = error.getElementsByTagName('message')[0];
-      if (message)
+    if (message && showMessage)
         alert (OAT.Xml.textValue(message));
   		return true;
     }
@@ -486,86 +494,6 @@ function initLoadProfile()
   return false;
 }
 
-var serviceList = [
-  ["twelveseconds.jpg", "http://12seconds.tv/", "12seconds"],
-  ["amazon.jpg", "http://www.amazon.com/", "Amazon.com"],
-  ["ameba.jpg", "http://www.ameba.jp/", "Ameba"],
-  ["backtype.jpg", "http://www.backtype.com/", "Backtype"],
-  ["blog.jpg", "http://en.wikipedia.org/wiki/Blog/", "Blog"],
-  ["brightkite.jpg", "http://brightkite.com/", "brightkite.com"],
-  ["feed.jpg", "http://en.wikipedia.org/wiki/Web_feed/", "Custom RSS/Atom"],
-  ["dailymotion.jpg", "http://www.dailymotion.com/", "Dailymotion"],
-  ["delicious.jpg", "http://del.icio.us/", "Del.icio.us"],
-  ["digg.jpg", "http://www.digg.com/", "Digg"],
-  ["diigo.jpg", "http://www.diigo.com/", "Diigo"],
-  ["disqus.jpg", "http://www.disqus.com/", "Disqus"],
-  ["facebook.jpg", "http://www.facebook.com/", "Facebook"],
-  ["flickr.jpg", "http://www.flickr.com/", "Flickr"],
-  ["fotolog.jpg", "http://www.fotolog.com/", "Fotolog"],
-  ["friendfeed.jpg", "http://www.friendfeed.com/", "FriendFeed"],
-  ["furl.jpg", "http://www.furl.net/", "Furl"],
-  ["googletalk.jpg", "http://talk.google.com/", "Gmail/Google Talk"],
-  ["goodreads.jpg", "http://www.goodreads.com/", "Goodreads"],
-  ["googlereader.jpg", "http://reader.google.com/", "Google Reader"],
-  ["googleshared.jpg", "http://www.google.com/s2/sharing/stuff/", "Google Shared Stuff"],
-  ["identica.jpg", "http://identi.ca/", "identi.ca"],
-  ["ilike.jpg", "http://www.ilike.com/", "iLike"],
-  ["intensedebate.jpg", "http://www.intensedebate.com/", "Intense Debate"],
-  ["jaiku.jpg", "http://www.jaiku.com/", "Jaiku"],
-  ["joost.jpg", "http://www.joost.com/", "Joost"],
-  ["lastfm.jpg", "http://www.last.fm/user/", "Last.fm"],
-  ["librarything.jpg", "http://www.librarything.com/", "LibraryThing"],
-  ["linkedin.jpg", "http://www.linkedin.com/", "LinkedIn"],
-  ["livejournal.jpg", "http://www.livejournal.com/", "LiveJournal"],
-  ["magnolia.jpg", "http://ma.gnolia.com/", "Ma.gnolia"],
-  ["meneame.jpg", "http://meneame.net/", "meneame"],
-  ["misterwong.jpg", "http://www.mister-wong.com/", "Mister Wong"],
-  ["mixx.jpg", "http://www.mixx.com/", "Mixx"],
-  ["myspace.jpg", "http://www.myspace.com/", "MySpace"],
-  ["netflix.jpg", "http://www.netflix.com/", "Netflix"],
-  ["netvibes.jpg", "http://www.netvibes.com/", "Netvibes"],
-  ["pandora.jpg", "http://www.pandora.com/", "Pandora"],
-  ["photobucket.jpg", "http://www.photobucket.com/", "Photobucket"],
-  ["picasa.jpg", "http://picasaweb.google.com/", "Picasa Web Albums"],
-  ["plurk.jpg", "http://www.plurk.com/", "Plurk"],
-  ["polyvore.jpg", "http://www.polyvore.com/", "Polyvore"],
-  ["pownce.jpg", "http://pownce.com/", "Pownce"],
-  ["reddit.jpg", "http://reddit.com/", "Reddit"],
-  ["seesmic.jpg", "http://www.seesmic.com/", "Seesmic"],
-  ["skyrock.jpg", "http://www.skyrock.com/", "Skyrock"],
-  ["slideshare.jpg", "http://www.slideshare.net/", "SlideShare"],
-  ["smotri.jpg", "http://smotri.com/", "Smotri.com"],
-  ["smugmug.jpg", "http://www.smugmug.com/", "SmugMug"],
-  ["stumbleupon.jpg", "http://www.stumbleupon.com/", "StumbleUpon"],
-  ["tipjoy.jpg", "http://tipjoy.com/", "tipjoy"],
-  ["tumblr.jpg", "http://www.tumblr.com/", "Tumblr"],
-  ["twine.jpg", "http://www.twine.com/", "Twine"],
-  ["twitter.jpg", "http://twitter.com/", "Twitter"],
-  ["upcoming.jpg", "http://upcoming.yahoo.com/", "Upcoming"],
-  ["vimeo.jpg", "http://www.vimeo.com/", "Vimeo"],
-  ["wakoopa.jpg", "http://wakoopa.com/", "Wakoopa"],
-  ["yahoo.jpg", "http://www.yahoo.com/", "Yahoo"],
-  ["yelp.jpg", "http://www.yelp.com/", "Yelp"],
-  ["youtube.jpg", "http://www.youtube.com/", "YouTube"],
-  ["zooomr.jpg", "http://www.zooomr.com/", "Zooomr"]
-]
-
-var setServiceUrl = function(fld)
-  {
-    for (N = 0; N < serviceList.length; N = N + 1)
-    {
-      if (fld.value == serviceList[N][2])
-      {
-        var urlName;
-        if (fld.input)
-          urlName = fld.input.name.replace(/fld_1_/, 'fld_2_');
-        else
-          urlName = fld.name.replace(/fld_1_/, 'fld_2_');
-        $(urlName).value = serviceList[N][1]+$v('c_nick');
-      }
-    }
-	}
-
 function sortSelect(obj)
 {
 	if (!obj || !obj.options) { return; }
@@ -588,64 +516,38 @@ function sortSelect(obj)
 	}
 }
 
-function validateError(fld, msg)
-{
-  alert(msg);
-  setTimeout(function(){fld.focus();}, 1);
-  return false;
-}
-
-function validateMail(fld)
-{
-  if ((fld.value.length == 0) || (fld.value.length > 40))
-    return validateError(fld, 'E-mail address cannot be empty or longer then 40 chars');
-
-  var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
-  if (!regex.test(fld.value))
-    return validateError(fld, 'Invalid E-mail address');
-
-  return true;
-}
-
-function validateURL(fld)
-{
-  var regex = /(ftp|http|https|skype):(\/\/)?(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
-  if (!regex.test(fld.value))
-    return validateError(fld, 'Invalid URL address : ' + fld.value);
-
-  return true;
+function hiddenCreate(objName, objForm, objValue) {
+  var obj = $(objName);
+  if (!obj) {
+    obj = OAT.Dom.create("input");
+    obj.setAttribute("type", "hidden");
+    obj.setAttribute("name", objName);
+    obj.setAttribute("id", objName);
+    if (!objForm)
+      objForm = document.forms[0];
+    objForm.appendChild(obj);
+  }
+  if (objValue)
+    obj.setAttribute("value", objValue);
+  return obj;
 }
 
-function validateField(fld)
-{
-  if ((fld.value.length == 0) && OAT.Dom.isClass(fld, '_canEmpty_'))
-    return true;
-  if (OAT.Dom.isClass(fld, '_mail_'))
-    return validateMail(fld);
-  if (OAT.Dom.isClass(fld, '_url_'))
-    return validateURL(fld);
-  if (fld.value.length == 0)
-    return validateError(fld, 'Field cannot be empty');
-  return true;
-}
+function pageFocus(tab) {
+  var div = $(tab);
+  if (!div)
+    return;
 
-function validateInputs(fld, prefix)
-{
-  var retValue = true;
-  var form = fld.form;
-  for (i = 0; i < form.elements.length; i++)
+  var inputs = div.getElementsByTagName('input');
+  for (var i = 0; i < inputs.length; i++)
   {
-    var fld = form.elements[i];
-    if (prefix && (fld.name.indexOf(prefix) != 0))
-      continue;
-    if (OAT.Dom.isClass(fld, '_validate_'))
-    {
-      retValue = validateField(fld);
-      if (!retValue)
-        return retValue;
+    var ctrl = inputs[i];
+    if ((ctrl.type.indexOf ('text') != -1) || (ctrl.type == 'password')) {
+      try {
+        ctrl.focus();
+      } catch (e) {}
+      break;
     }
   }
-  return retValue;
 }
 
 // RDF Relations
@@ -672,6 +574,7 @@ RDF.ontologies['ibis'] = {"name": 'http://purl.org/ibis#', "hidden": 1};
 RDF.ontologies['ical'] = {"name": 'http://www.w3.org/2002/12/cal/icaltzd#'};
 RDF.ontologies['kuaba'] = {"name": 'http://www.tecweb.inf.puc-rio.br/ontologies/kuaba'};
 RDF.ontologies['lsdis'] = {"name": 'http://lsdis.cs.uga.edu/projects/meteor-s/wsdl-s/ontologies/LSDIS_FInance.owl'};
+RDF.ontologies['like'] = {"name": 'http://ontologi.es/like#', "dependent": 'rev'};
 RDF.ontologies['mo'] = {"name": 'http://purl.org/ontology/mo/'};
 RDF.ontologies['movie'] = {"name": 'http://www.csd.abdn.ac.uk/~ggrimnes/dev/imdb/IMDB#'};
 RDF.ontologies['nao'] = {"name": 'http://www.semanticdesktop.org/ontologies/nao/'};
@@ -708,13 +611,15 @@ RDF.ontologies['rdfs'] =
           {"name": 'dc:subject', "datatypeProperties": 'rdfs:string'},
           {"name": 'dc:title', "datatypeProperties": 'rdfs:string'},
           {"name": 'dc:type', "datatypeProperties": 'rdfs:string'},
-          {"name": 'rdfs:label', "datatypeProperties": 'rdfs:string'},
+          {"name": 'owl:sameAs', "objectProperties": 'owl:Thing'},
           {"name": 'rdfs:comment', "datatypeProperties": 'rdfs:string'},
-          {"name": 'rdfs:seeAlso', "datatypeProperties": 'rdfs:string'}
+          {"name": 'rdfs:label', "datatypeProperties": 'rdfs:string'},
+          {"name": 'rdfs:seeAlso', "objectProperties": 'rdfs:Resource'}
         ]
 }
     ]
   };
+RDF.ontologies['rev'] = {"name": 'http://purl.org/stuff/rev#'};
 RDF.ontologies['rss'] = {"name": 'http://purl.org/rss/1.0/'};
 RDF.ontologies['scot'] = {"name": 'http://scot-project.org/scot/ns'};
 RDF.ontologies['sioc'] = {"name": 'http://rdfs.org/sioc/ns#'};
@@ -725,8 +630,10 @@ RDF.ontologies['wot'] = {"name": 'http://xmlns.com/wot/0.1/', "hidden": 1};
 RDF.ontologies['xhtml'] = {"name": 'http://www.w3.org/1999/xhtml', "hidden": 1};
 RDF.ontologies['xsd'] = {"name": 'http://www.w3.org/2001/XMLSchema#', "hidden": 1};
 
-RDF.loadOntology = function (ontologyName, cb)
+RDF.loadOntology = function (ontologyName, cb, options)
 {
+  var ontology = this.getOntologyByName(ontologyName);
+  var dependent = ontology.dependent;
   var prefix = this.ontologyPrefix(ontologyName);
   if (!prefix) {
     var N = 0;
@@ -739,7 +646,9 @@ RDF.loadOntology = function (ontologyName, cb)
   }
 
   // load ontology classes
-  var S = '/ods/api/ontology.classes?ontology='+encodeURIComponent(ontologyName)+'&prefix='+prefix;
+  var S = '/ods/api/ontology.classes?ontology='+encodeURIComponent(ontologyName);
+  if (dependent)
+    S += '&dependentOntology='+encodeURIComponent(this.getOntologyByPrefix(dependent).name);
   var x = function(data) {
     var o = null;
     try {
@@ -748,6 +657,7 @@ RDF.loadOntology = function (ontologyName, cb)
     if (o)
     {
       o.prefix = prefix;
+      o.dependent = dependent;
       RDF.ontologies[prefix] = o;
 
       // load objects (individuals)
@@ -760,10 +670,12 @@ RDF.loadOntology = function (ontologyName, cb)
         RDF.ontologies[prefix].objects = o;
       }
       OAT.AJAX.GET(S, '', x, {});
+      if (o.dependent)
+        RDF.loadOntology(RDF.getOntologyByPrefix(o.dependent).name, null, {async: false});
     }
     if (cb) {cb();}
   }
-  OAT.AJAX.GET(S, '', x, {});
+  OAT.AJAX.GET(S, '', x, options);
 }
 
 RDF.getOntologyByPrefix = function(prefix)
@@ -941,12 +853,16 @@ RDF.showItemTypes = function()
     }
     OAT.Dom.hide(noTR);
   } else {
+    OAT.Dom.unlink(prefix+'_throbber');
     OAT.Dom.show(noTR);
   }
 }
 
 RDF.showItemType = function(prefix, itemType)
 {
+  // hide throbber
+  OAT.Dom.unlink(prefix+'_throbber');
+
   var rowOptions = {No: itemType.id, fld_1: {mode: 43, cssText: ''}, fld_2: {mode: 42, value: itemType.ontology, showValue: itemType.ontology+' ('+RDF.ontologyPrefix(itemType.ontology)+')'}, btn_1: {mode: 40}};
   if (this.tableOptions && this.tableOptions.itemType) {
     var itemTypeOptions = this.tableOptions.itemType;
@@ -1394,7 +1310,7 @@ RDF.showPropertiesTable = function(item)
       var prefixProp = prefix + '_prop_' + No;
 
       var fld = OAT.Dom.create('span');
-      fld.onclick = function(){TBL.createRow(prefixProp, null, {fld_1: {mode: 46, item: item}, fld_2: {mode: 48, item: item}, fld_3: {mode: 47, item: item}});};
+      fld.onclick = function(){TBL.createRow(prefixProp, null, {fld_1: {mode: 46, item: item}, fld_2: {mode: 48, item: item}, fld_3: {mode: 47, item: item}, fld_4: {mode: 49, item: item}});};
       OAT.Dom.addClass(fld, 'button pointer');
 
       var img = OAT.Dom.create('img');
@@ -1408,14 +1324,14 @@ RDF.showPropertiesTable = function(item)
       TDs[2].style.whiteSpace = 'nowrap';
       TDs[2].appendChild(fld);
 
-      var S = '<table id="prop_tbl" class="listing" style="background-color: #FFF;"><thead><tr class="listing_header_row"><th width="50%">Property IRI</th><th width="50%" colspan="2">Value</th><th width="80px">Action</th></tr></thead><tbody id="prop_tbody"><tr id="prop_tr_no"><td colspan="3">No Properties</td></tr></tbody></table><input type="hidden" id="prop_no" name="prop_no" value="0" />';
+      var S = '<table id="prop_tbl" class="listing" style="background-color: #FFF;"><thead><tr class="listing_header_row"><th width="50%">Property IRI</th><th width="50%" colspan="3">Value</th><th width="80px">Action</th></tr></thead><tbody id="prop_tbody"><tr id="prop_tr_no"><td colspan="3">No Properties</td></tr></tbody></table><input type="hidden" id="prop_no" name="prop_no" value="0" />';
       TDs[1].innerHTML = S.replace(/prop_/g, prefixProp+'_');
 
       var properties = item.properties;
       if (properties)
       {
         for (var i = 0; i < properties.length; i++)
-          TBL.createRow(prefixProp, null, {fld_1: {mode: 46, item: item, value: properties[i]}, fld_2: {mode: 48, item: item, value: properties[i]}, fld_3: {mode: 47, item: item, value: properties[i]}});
+          TBL.createRow(prefixProp, null, {fld_1: {mode: 46, item: item, value: properties[i]}, fld_2: {mode: 48, item: item, value: properties[i]}, fld_3: {mode: 47, item: item, value: properties[i]}, fld_4: {mode: 49, item: item, value: properties[i]}});
       } else {
         fld.onclick();
       }
@@ -1427,11 +1343,17 @@ RDF.showPropertiesTable = function(item)
 
 RDF.changePropertyValue = function(obj)
 {
-  var S = obj.id;
-  var fldName = S.replace(/fld_1/, 'fld_2');
   var S = obj.parentNode.id;
+
+  var fldName = (obj.id).replace(/fld_1/, 'fld_2');
   var td = $(S.substr(0,S.lastIndexOf('_')+1)+'2');
   TBL.createCell48(td, '', fldName, 0, {item: obj.item, value: {name: obj.value}});
+
+  var fldName = (obj.id).replace(/fld_1/, 'fld_3');
   var td = $(S.substr(0,S.lastIndexOf('_')+1)+'3');
   TBL.createCell47(td, '', fldName, 0, {item: obj.item, value: {name: obj.value}});
+
+  var fldName = (obj.id).replace(/fld_1/, 'fld_4');
+  var td = $(S.substr(0,S.lastIndexOf('_')+1)+'4');
+  TBL.createCell49(td, '', fldName, 0, {item: obj.item, value: {name: obj.value}});
 }
diff --git a/appsrc/ODS-Framework/community.vspx b/appsrc/ODS-Framework/community.vspx
index 48146fa..61d7ce3 100644
--- a/appsrc/ODS-Framework/community.vspx
+++ b/appsrc/ODS-Framework/community.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: community.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: community.vspx,v 1.4.2.1 2010/09/20 10:15:18 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/app_inst_menu.xsl b/appsrc/ODS-Framework/comp/app_inst_menu.xsl
index 7a828b1..cbc3ce0 100644
--- a/appsrc/ODS-Framework/comp/app_inst_menu.xsl
+++ b/appsrc/ODS-Framework/comp/app_inst_menu.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: app_inst_menu.xsl,v 1.6 2008/03/13 20:50:06 source Exp $
+ -  $Id: app_inst_menu.xsl,v 1.6.2.1 2010/09/20 10:15:32 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/app_search.xsl b/appsrc/ODS-Framework/comp/app_search.xsl
index 054b907..4c1a3f1 100644
--- a/appsrc/ODS-Framework/comp/app_search.xsl
+++ b/appsrc/ODS-Framework/comp/app_search.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: app_search.xsl,v 1.4 2007/11/30 09:54:49 source Exp $
+ -  $Id: app_search.xsl,v 1.4.2.1 2010/09/20 10:15:32 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/apps.xsl b/appsrc/ODS-Framework/comp/apps.xsl
index 25da55f..76c1754 100644
--- a/appsrc/ODS-Framework/comp/apps.xsl
+++ b/appsrc/ODS-Framework/comp/apps.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: apps.xsl,v 1.8 2008/03/13 20:50:06 source Exp $
+ -  $Id: apps.xsl,v 1.8.2.1 2010/09/20 10:15:32 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/check.xsl b/appsrc/ODS-Framework/comp/check.xsl
index 423ee04..3004b50 100644
--- a/appsrc/ODS-Framework/comp/check.xsl
+++ b/appsrc/ODS-Framework/comp/check.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: check.xsl,v 1.3 2006/10/17 14:07:20 source Exp $
+ -  $Id: check.xsl,v 1.3.2.1 2010/09/20 10:15:32 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/check_register.xsl b/appsrc/ODS-Framework/comp/check_register.xsl
index 56db84a..b9dc2c7 100644
--- a/appsrc/ODS-Framework/comp/check_register.xsl
+++ b/appsrc/ODS-Framework/comp/check_register.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: check_register.xsl,v 1.3 2006/10/17 14:07:20 source Exp $
+ -  $Id: check_register.xsl,v 1.3.2.1 2010/09/20 10:15:33 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/dashboard.xsl b/appsrc/ODS-Framework/comp/dashboard.xsl
index 5c6f903..e21f193 100644
--- a/appsrc/ODS-Framework/comp/dashboard.xsl
+++ b/appsrc/ODS-Framework/comp/dashboard.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: dashboard.xsl,v 1.39.2.2 2010/03/12 09:10:13 source Exp $
+ -  $Id: dashboard.xsl,v 1.39.2.7 2011/03/29 20:23:14 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -27,29 +27,6 @@
   xmlns:v="http://www.openlinksw.com/vspx/"
   xmlns:vm="http://www.openlinksw.com/vspx/ods/">
 
-  <!-- xsl:template match="vm:widget_wrap">
-    <div class="widget">
-      <xsl:attribute name="class">
-        <xsl:value-of select="@class"/>
-      </xsl:attribute>
-      <div class="w_title_bar">
-        <div class="w_title_text_ctr">
-          <img>
-            <xsl:attribute name="src">
-              <xsl:value-of select="id_img"/>
-            </xsl:attribute>
-          </img>
-          <xsl:value-of select="@title"/>
-        </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
-      </div--> <!-- w_title_bar -->
-      <!--xsl:apply-templates/>
-    </div--> <!-- widget -->
-  <!--/xsl:template -->
-
   <xsl:template match="vm:dash-welcome">
     <div class="widget w_welcome">
       <vm:welcome-message />
@@ -59,39 +36,6 @@
 
   <xsl:template match="vm:dash-app-ads">
     <div class="widget w_dash_app_ads">
-      <!-- add dismiss cookie/prefs check -->
-      <!-- add dismiss control and pane -->
-      <!-- vm:if test="wa_vad_check ('blog2') is not null">
-        <div class="sf_blurb">
-          <vm:url value="Start blogging now!" url="index_inst.vspx?wa_name=WEBLOG2&fr=promo" />
-        </div>
-     </vm:if>
-     <vm:if test="wa_vad_check ('enews2') is not null">
-       <div class="sf_blurb">
-         <vm:url value="Start your personalized news desk now!" url="index_inst.vspx?wa_name=eNews2&fr=promo" />
-       </div>
-     </vm:if>
-     <vm:if test="wa_vad_check ('oDrive') is not null">
-       <div class="sf_blurb">
-   <vm:url
-     value="-->
-
-<!--sprintf ('Did you know that %s allows you to share you documents ideas, goal, ideas with your colleagues?',
-     self.banner)"
-     url="index_inst.vspx?wa_name=oDrive&fr=promo" />
-       </div>
-     </vm:if>
-     <vm:if test="wa_vad_check ('wiki') is not null">
-       <div class="sf_blurb">
-   <vm:url value="Create your wiki article now!" url="index_inst.vspx?wa_name=oWiki&fr=promo" />
-       </div>
-     </vm:if>
-     <vm:if test="wa_vad_check ('oMail') is not null">
-       <div class="sf_blurb">
-   <vm:url value="Get your own ODS Webmail address!" url="index_inst.vspx?wa_name=oMail&fr=promo" />
-       </div>
-     </vm:if -->
-
     </div>
   </xsl:template>
 
@@ -110,10 +54,6 @@
                alt="ODS user icon" />
           <span class="w_title_text">Users <span class="usr_count"> active: <?V active ?></span></span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
           <h3>Recently Signed In</h3>
@@ -158,10 +98,6 @@
                alt="ODS-Weblog icon"/>
           <span class="w_title_text">Top Blogs</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <ul>
@@ -190,11 +126,6 @@
                alt="ODS-Feed Reader icon" />
           <span class="w_title_text">Latest News</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="edit_btn" href="#"><img src="i/w_btn_configure.png" alt="configure icon"/></a>
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div> <!-- w_title_bar -->
       <div class="w_pane content_pane">
         <ul>
@@ -225,11 +156,6 @@
                alt="ODS-Weblog icon"/>
           <span class="w_title_text">Wiki Activity</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="edit_btn" href="#"><img src="i/w_btn_configure.png" alt="configure icon"/></a>
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div> <!-- w_title_bar -->
       <div class="w_pane content_pane">
         <ul>
@@ -262,11 +188,6 @@
                alt="ODS-Weblog icon"/>
           <span class="w_title_text"><?V WA_GET_APP_NAME ('WEBLOG2') ?> Summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="edit_btn" href="#"><img src="i/w_btn_configure.png" alt="configure icon"/></a>
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="app_summary_listing">
@@ -579,7 +500,7 @@
   </xsl:processing-instruction>
         <tr align="left">
        <?vsp
-            if(insttype_from_xsl='WEBLOG2' or insttype_from_xsl='eNews2' or insttype_from_xsl='oWiki' or insttype_from_xsl='Bookmark' or insttype_from_xsl='oGallery' or insttype_from_xsl='Polls' or insttype_from_xsl='AddressBook' or insttype_from_xsl='Calendar' or insttype_from_xsl='Discussions')
+            if (insttype_from_xsl in ('WEBLOG2', 'eNews2', 'oWiki', 'Bookmark', 'oGallery', 'Polls', 'AddressBook', 'Calendar', 'Discussions'))
             {
        ?>
 
@@ -599,7 +520,7 @@
             }
        ?>
         <td nowrap="nowrap">
-          <a href="<?V wa_expand_url (url, self.login_pars) ?>"><?V coalesce (title, '*no title*') ?></a>
+          <a href="<?vsp http (wa_utf8_to_wide (wa_expand_url (url, self.login_pars))); ?>"><?V coalesce (title, '*no title*') ?></a>
         </td>
         <td nowrap="nowrap">
         <?vsp
@@ -643,10 +564,6 @@
                alt="ODS-Feed Reader icon" />
             <span class="w_title_text"><?V WA_GET_APP_NAME ('eNews2') ?> Summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="app_summary_listing">
@@ -709,10 +626,6 @@
                alt="ODS-Mail icon" />
           <span class="w_title_text"><?V WA_GET_APP_NAME ('oMail') ?> Summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="app_summary_listing">
@@ -765,10 +678,6 @@
                alt="ODS-Wiki icon"/>
           <span class="w_title_text"><?V WA_GET_APP_NAME ('oWiki') ?> Summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="app_summary_listing">
@@ -830,10 +739,6 @@
                alt="ODS-Briefcase icon"/>
           <span class="w_title_text"><?V WA_GET_APP_NAME ('oDrive') ?> Summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="app_summary_listing">
@@ -886,11 +791,6 @@
                alt="ODS-Bookmark icon" />
           <span class="w_title_text"><?V WA_GET_APP_NAME ('Bookmark') ?> summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="edit_btn" href="#"><img src="i/w_btn_configure.png" alt="configure icon"/></a>
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div> <!-- w_title_bar -->
       <div class="w_pane content_pane">
         <table width="100%" border="0" cellpadding="0" cellspacing="0" class="app_summary_listing">
@@ -953,11 +853,6 @@
                alt="ODS-Community icon" />
           <span class="w_title_text"><?V WA_GET_APP_NAME ('Community') ?> Summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="edit_btn" href="#"><img src="i/w_btn_configure.png" alt="configure icon"/></a>
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div> <!-- w_title_bar -->
       <div class="w_pane content_pane">
         <table class="app_summary_listing">
@@ -981,10 +876,6 @@
                alt="ODS-Gallery icon" />
             <span class="w_title_text"><?V WA_GET_APP_NAME ('oGallery') ?> Summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <table width="100%" border="0" cellpadding="0" cellspacing="0" class="app_summary_listing">
@@ -1047,10 +938,6 @@
                alt="ODS-Polls icon" />
             <span class="w_title_text"><?V WA_GET_APP_NAME ('Polls') ?> Summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="app_summary_listing">
@@ -1113,10 +1000,6 @@
                alt="ODS-AddressBook icon" />
             <span class="w_title_text"><?V WA_GET_APP_NAME ('AddressBook') ?> Summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="app_summary_listing">
@@ -1179,10 +1062,6 @@
                alt="ODS-Calendar icon" />
             <span class="w_title_text"><?V WA_GET_APP_NAME ('Calendar') ?> Summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="app_summary_listing">
@@ -1245,10 +1124,6 @@
                alt="ODS-IM icon" />
             <span class="w_title_text"><?V WA_GET_APP_NAME ('IM') ?> Summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="app_summary_listing">
@@ -1311,10 +1186,6 @@
                alt="ODS-Discussion icon" />
             <span class="w_title_text"><?V WA_GET_APP_NAME ('nntpf') ?> Summary</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <table width="100%"  border="0" cellpadding="0" cellspacing="0" class="app_summary_listing">
@@ -1378,10 +1249,6 @@
                height="16" />
           What's New
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="images/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="images/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div> <!-- w_title_bar -->
       <div class="w_pane content_pane">
         <vm:welcome-message2 />
@@ -1398,10 +1265,6 @@
                alt="ODS-Data Spaces icon"/>
           <span class="w_title_text">My Data Spaces</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div> <!-- w_title_bar -->
       <div class="w_pane content_pane">
         <ul>
@@ -1612,10 +1475,6 @@
                height="16"/>
           My Profile
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <v:template name="my_user_details" type="simple" enabled="1">
@@ -1688,6 +1547,16 @@
                     </td>
                   </tr>
           <?vsp } ?>
+                  <tr>
+                    <td></td>
+                    <th><v:label value="WebID:" /></th>
+                    <td><v:url name="lwebid1"
+                               value="--SIOC..person_iri (SIOC..user_iri (self.ufid))"
+                               url="--SIOC..person_iri (SIOC..user_iri (self.ufid))"
+                               xhtml_target="_blank"
+                               xhtml_class="url" />
+                    </td>
+                  </tr>
                 </table>
               </td>
             </tr>
@@ -1737,10 +1606,6 @@
                  alt="ODS-Weblog icon" />
             <span class="w_title_text">My Blog</span>
           </div>
-          <div class="w_title_btns_ctr">
-            <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-            <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-          </div>
         </div>
         <div class="w_pane content_pane">
           <ul>
@@ -1842,10 +1707,6 @@
                  alt="ODS-Feed Reader icon" />
             <span class="w_title_text">My News</span>
           </div>
-          <div class="w_title_btns_ctr">
-            <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-            <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-          </div>
         </div> <!-- w_title_bar -->
         <div class="w_pane content_pane">
           <ul>
@@ -1888,10 +1749,6 @@
                  alt="ODS-Bookmarks icon"/>
             <span class="w_title_text">My Bookmarks</span>
           </div>
-          <div class="w_title_btns_ctr">
-            <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-            <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-          </div>
         </div> <!-- w_title_bar -->
         <div class="w_pane content_pane">
           <ul>
@@ -1984,10 +1841,6 @@
                  alt="ODS-AddressBook icon"/>
             <span class="w_title_text">My Contacts</span>
           </div>
-          <div class="w_title_btns_ctr">
-            <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-            <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-          </div>
         </div> <!-- w_title_bar -->
         <div class="w_pane content_pane">
           <ul>
@@ -2091,10 +1944,6 @@
                alt="ODS Connections icon" />
           <span class="w_title_text">My Connections</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
     <?vsp
@@ -2223,10 +2072,6 @@
                alt="ODS-Communities icon"/>
           <span class="w_title_text">My Communities</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
 <?vsp
@@ -2263,6 +2108,15 @@
   </xsl:template>
 
   <xsl:template match="vm:dash-my-photos">
+    <?vsp
+
+      declare has_gallery integer;
+
+      has_gallery := 0;
+      if (exists (select 1 from wa_member where WAM_APP_TYPE='oGallery' and WAM_MEMBER_TYPE = 1 and WAM_USER = self.u_id))
+        has_gallery := 1;
+    ?>
+    <vm:if test="has_gallery">
     <div class="widget w_my_photos">
       <div class="w_title_bar">
         <div class="w_title_text_ctr">
@@ -2272,28 +2126,13 @@
                alt="ods gallery icon"/>
           <span class="w_title_text">My Photos</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
-<?vsp
-  if (wa_check_package('oGallery'))
-    {
-      declare i,ii int;
-      declare ogallery_id varchar;
-      ogallery_id:='';
-      ogallery_id := coalesce ((select WAM_INST from wa_member
-                                  where WAM_APP_TYPE='oGallery' and WAM_MEMBER_TYPE=1 and WAM_USER=self.u_id)
-                               ,'');
-      if (ogallery_id <> '')
-        {
-?>
         <br/>
         <table border="0" cellpadding="0" cellspacing="0" class="infoarea2">
           <tr>
 <?vsp
+                declare i, ii int;
   declare q_str, rc, dta, h, curr_davres any;
   declare _gallery_folder_name varchar;
 
@@ -2341,18 +2180,9 @@
            {
                _home_url:=rows[0][0];
                _inst_name:=rows[0][1];
-           }
-           else
-               goto _skip;
-
-
---           photo_href:=' href="'||_home_url||'/?'||subseq(self.login_pars,1)||'#'||'/'||gallery_path_arr[5]||'/'||gallery_path_arr[6]||'" target="_blank" ';
            photo_href:= sprintf(' href="/dataspace/%s/photos/%U#/%s/%s" target="_blank" ',self.u_name,_inst_name, gallery_path_arr[5], gallery_path_arr[6]);
-
           }
-
-          _skip:;
-
+                    }
           declare img_size_arr,new_img_size_arr any;
 
           img_size_arr:=wa_get_image_sizes(dta[5]);
@@ -2364,8 +2194,7 @@
             if(_img_aspect_ratio>=1.333)
             {
               new_img_size_arr:=vector(100,ceiling(100/_img_aspect_ratio));
-            }else
-            {
+                      } else {
               new_img_size_arr:=vector(ceiling(75*_img_aspect_ratio),75);
             }
           }
@@ -2397,7 +2226,9 @@
                 </tr>
               </table>
             </td>
-            <td><p></p></td>
+              <td>
+                <p></p>
+              </td>
 <?vsp
            ii := ii + 1;
          }
@@ -2419,15 +2250,24 @@
           </tr>
         </table>
         <br/>
-      </div>
       <div class="w_footer">
-        <a href="<?V '/photos/'||self.u_name||'/?'||subseq(self.login_pars,1) ?>">More&#8230;</a>
+            <a href="search.vspx?newest=photos&l=1<?V self.login_pars ?>">More&#8230;</a>
+          </div>
       </div>
-     <?vsp
-           }
-     }
-     ?>
     </div> <!-- widget -->
+    </vm:if>
+    <vm:if test="not has_gallery">
+      <div class="app_ad">
+        <a href="index_inst.vspx?<?V 'wa_name=oGallery&fr=promo' || '&' || trim (self.login_pars, '&') ?>">
+          <img border="0" src="images/app_ads/ods_bann_photos.jpg" alt="Let us help you organize and share your contacts!" />
+        </a>
+        <div class="app_ad_ft">
+          <input type="checkbox" id="gallery_app_ad_nuke"/>
+          <label for="gallery_app_ad_nuke">Do not show this next time</label>
+          <a href="#">Dismiss</a>
+        </div>
+      </div> <!-- app_ad -->
+    </vm:if>
   </xsl:template>
 
   <xsl:template match="vm:dash-my-facebook">
@@ -2440,10 +2280,6 @@
                alt="facebook icon"/>
           <span class="w_title_text">Facebook</span>
         </div>
-        <div class="w_title_btns_ctr">
-          <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-          <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-        </div>
       </div>
       <div class="w_pane content_pane">
         <?vsp
@@ -2482,10 +2318,6 @@
                  alt="ODS-Guestbook icon" />
             <span class="w_title_text">My Guestbook</span>
           </div>
-          <div class="w_title_btns_ctr">
-            <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-            <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-          </div>
         </div>
         <div class="w_pane content_pane">
           <ul>
@@ -2585,7 +2417,7 @@
 
     </xsl:processing-instruction>
     <li>
-      <a href="<?V wa_expand_url (url, self.login_pars) ?>">
+      <a href="<?vsp http (wa_utf8_to_wide (wa_expand_url (url, self.login_pars))); ?>">
         <?V substring (coalesce (title, '*no title*'), 1, 55) ?></a>
 <!--
                  <a href="<?V aurl ?>" onclick="<?V clk ?>"><?V wa_utf8_to_wide (coalesce (author, '~unknown~')) ?></a>
@@ -2636,10 +2468,6 @@
                  alt="ODS-Mail icon" />
             <span class="w_title_text">My Mail</span>
           </div>
-          <div class="w_title_btns_ctr">
-            <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-            <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-          </div>
         </div>
         <div class="w_pane content_pane">
 <?vsp
@@ -2728,10 +2556,6 @@
                  alt="ODS-Briefcase icon" />
             <span class="w_title_text">My briefcase</span>
           </div>
-          <div class="w_title_btns_ctr">
-            <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-            <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-          </div>
         </div>
         <div class="w_pane content_pane">
         <ul>
@@ -2834,10 +2658,6 @@
             <img class="w_title_icon" src="images/icons/ods_calendar_16.png" alt="ODS-Calendar icon"/>
             <span class="w_title_text">My Calendar</span>
           </div>
-          <div class="w_title_btns_ctr">
-            <a class="minimize_btn" href="#"><img src="i/w_btn_minimize.png" alt="minimize icon"/></a>
-            <a class="close_btn" href="#"><img src="i/w_btn_close.png" alt="close icon"/></a>
-          </div>
         </div> <!-- w_title_bar -->
         <div class="w_pane content_pane">
           <ul>
diff --git a/appsrc/ODS-Framework/comp/dashboard_style.xsl b/appsrc/ODS-Framework/comp/dashboard_style.xsl
index dd67fbb..5d72982 100644
--- a/appsrc/ODS-Framework/comp/dashboard_style.xsl
+++ b/appsrc/ODS-Framework/comp/dashboard_style.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: dashboard_style.xsl,v 1.4 2008/03/13 20:50:06 source Exp $
+ -  $Id: dashboard_style.xsl,v 1.4.2.2 2010/09/20 10:15:33 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -22,11 +22,11 @@
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  -
 -->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-     version="1.0"
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:v="http://www.openlinksw.com/vspx/"  exclude-result-prefixes="v"
      xmlns:xhtml="http://www.w3.org/1999/xhtml">
-<xsl:output method="text" omit-xml-declaration="yes" indent="yes" />
+<xsl:output method="text" omit-xml-declaration="yes" indent="yes" encoding="utf-8"/>
 
 <xsl:template match="/">
   <xsl:apply-templates />
@@ -42,8 +42,8 @@
       <th>Content</th>
     </tr>
     <xsl:for-each select="./dash-row">
-      <xsl:sort select="@class"/>
       <xsl:sort select="@time" order="descending"/>
+        <xsl:sort select="@class"/>
       <xsl:if test="position() <= $nrows">
         <xsl:if test=" (position() mod 2)= 0">
            <xsl:apply-templates select=".">
@@ -78,7 +78,7 @@
     <td valign="top" nowrap="true">
       <xsl:value-of select="@time"/>
     </td>
-    <td valign="top">
+    <td valign="top" nowrap="true">
       <xsl:if test="string-length(@application) < 23">
         <xsl:value-of select="@application"/>
       </xsl:if>
diff --git a/appsrc/ODS-Framework/comp/dav_browser.xsl b/appsrc/ODS-Framework/comp/dav_browser.xsl
index c6a7cfa..912f84f 100644
--- a/appsrc/ODS-Framework/comp/dav_browser.xsl
+++ b/appsrc/ODS-Framework/comp/dav_browser.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: dav_browser.xsl,v 1.5 2007/02/27 21:19:46 source Exp $
+ -  $Id: dav_browser.xsl,v 1.5.2.1 2010/09/20 10:15:33 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/help.xml b/appsrc/ODS-Framework/comp/help.xml
index adcfdc5..3189422 100644
--- a/appsrc/ODS-Framework/comp/help.xml
+++ b/appsrc/ODS-Framework/comp/help.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" standalone="yes" ?>
 <!--
  -
- -  $Id: help.xml,v 1.4 2008/03/13 20:50:06 source Exp $
+ -  $Id: help.xml,v 1.4.2.1 2010/09/20 10:15:33 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/help.xsl b/appsrc/ODS-Framework/comp/help.xsl
index 2f936ad..668931b 100644
--- a/appsrc/ODS-Framework/comp/help.xsl
+++ b/appsrc/ODS-Framework/comp/help.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: help.xsl,v 1.2 2006/05/31 13:13:02 source Exp $
+ -  $Id: help.xsl,v 1.2.2.1 2010/09/20 10:15:33 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/home.xsl b/appsrc/ODS-Framework/comp/home.xsl
index a6c70de..581e7fe 100644
--- a/appsrc/ODS-Framework/comp/home.xsl
+++ b/appsrc/ODS-Framework/comp/home.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: home.xsl,v 1.21.2.4 2010/03/12 09:10:13 source Exp $
+ -  $Id: home.xsl,v 1.21.2.6 2010/12/20 12:27:08 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -259,21 +259,25 @@
                       if (length (self.arr[7])) {
 			    ?>
                             <tr>
-                      <th><v:label value="Personal Webpage:" /></th>
-                      <td><v:url name="lwpage1" value="--coalesce(self.arr[7],'')" url="--self.arr[7]" xhtml_target="_blank" xhtml_class="url"/></td>
+                      <th valign="top"><v:label value="Personal Webpage:" /></th>
+                      <td>
+                        <v:url name="lwpage1" value="--coalesce(self.arr[7],'')" url="--self.arr[7]" xhtml_target="_blank" xhtml_class="url"/>
+                        <br />
+                        <img src="data:image/jpg;base64,<?V ODS.ODS_API.qrcode(self.arr[7]) ?>"/>
+                      </td>
                             </tr>
                     <?vsp
                       }
 			    if (length (self.arr[8])) {
 			    ?>
                             <tr>
-                      <th><v:label value="Other Identity URIs (synonyms):" /></th>
+                      <th valign="top"><v:label value="Other Identity URIs (synonyms):" /></th>
 			      <td>
 				  <?vsp
                         for select Y from DB.DBA.ODS_USER_IDENTIY_URLS (uname) (Y varchar) sub where uname = self.fname do
 				      {
 					  ?>
-					  <a href="<?V Y ?>" target="_blank"><?V Y ?></a>
+                          <a href="<?V Y ?>" target="_blank"><?V Y ?></a><br />
 					  <?vsp
 				       }
 				  ?>
diff --git a/appsrc/ODS-Framework/comp/inst.xsl b/appsrc/ODS-Framework/comp/inst.xsl
index 1a00255..0b6718e 100644
--- a/appsrc/ODS-Framework/comp/inst.xsl
+++ b/appsrc/ODS-Framework/comp/inst.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: inst.xsl,v 1.13 2009/03/25 12:39:09 source Exp $
+ -  $Id: inst.xsl,v 1.13.2.3 2010/11/11 12:38:19 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -26,102 +26,8 @@
     xmlns:v="http://www.openlinksw.com/vspx/"
     xmlns:vm="http://www.openlinksw.com/vspx/ods/">
 
-    <xsl:template match="vm:instance-sharing">
-      <tr>
-        <th width="1%" nowrap="nowrap">
-          <label for="is_public1">Access mode</label>
-        </th>
-        <td align="left">
-          <?vsp
-            if (self.wa_type in ('oMail', 'IM'))
-            {
-              http (case when self.is_public = 0 then 'Private' else case when self.is_public = 1 then 'Public' else 'Shared' end end);
-              http (sprintf ('<input type="hidden" name="is_public1" id="is_public1" value="%d"/>', self.is_public));
-            }
-            else
-            {
-              http (         '<select name="is_public1" id="is_public1" onchange="javascript: sharedChange(this);">');
-              http (sprintf ('  <option value="0" %s>Private</option>', case when self.is_public = 0 then 'selected="selected"' else '' end));
-              http (sprintf ('  <option value="1" %s>Public</option>', case when self.is_public = 1 then 'selected="selected"' else '' end));
-              http (sprintf ('  <option value="2" %s>Shared (RDF Data Only)</option>', case when self.is_public = 2 then 'selected="selected"' else '' end));
-              http (         '</select>');
-            }
-          ?>
-        </td>
-      </tr>
-      <tr id="tr_shared" style="display: <?V case when self.is_public <> 2 then 'none' else '' end ?>">
-        <td colspan="2">
-          <table>
-            <tr>
-              <td width="700px">
-                <table id="s_tbl" class="listing">
-                  <tr class="listing_header_row">
-                    <th>
-                      Type
-                    </th>
-                    <th width="100%">
-                      Value
-                    </th>
-                    <th width="80px">
-                      Access
-                    </th>
-                    <th width="70px">
-                      Action
-                    </th>
-                  </tr>
-                  <?vsp
-                    declare N integer;
-                    declare acl any;
-
-                    acl := deserialize (self.acl);
-                    for (N := 1; N < length (acl); N := N + 1)
-                    {
-                  ?>
-                  <tr id="s_tr_<?V N ?>">
-                    <td id="s_td1_<?V N ?>">
-                		  <![CDATA[
-                   		  <script type="text/javascript">
-                   		  <?vsp
-                          http (sprintf ('ODSInitArray.push ( function (){updateRowCombo2(\'s_td1_%d\', \'s_fld_1_%d\', {value: \'%s\'});});', N, N, acl[N][0]));
-                   		  ?>
-                   		  </script>
-                 		  ]]>
-                    </td>
-                    <td id="s_td2_<?V N ?>">
-                      <input type="text" id="s_fld_2_<?V N ?>" name="s_fld_2_<?V N ?>" value="<?V acl[N][1] ?>" style="width: 95%;" class="_validate_" onblur="javascript: validateField(this);" />
-                    </td>
-                    <td id="s_td3_<?V N ?>">
-                	    <![CDATA[
-                 		    <script type="text/javascript">
-                 		    <?vsp
-                          http (sprintf ('ODSInitArray.push ( function (){updateRowCombo3(\'s_td3_%d\', \'s_fld_3_%d\', {value: \'%s\'});});', N, N, acl[N][2]));
-                 		    ?>
-                 		    </script>
-                 		  ]]>
-                    </td>
-                    <td>
-                      <input type="button" value="Remove" onclick="javascript: updateRow('s', <?V N ?>);" />
-                    </td>
-                  </tr>
-                  <?vsp
-                    }
-                    http (sprintf ('<tr id="s_tr_no" style="display: %s"><td colspan="4"><b>No Sharings</b></td></tr>', case when N = 1 then '' else 'none' end));
-                  ?>
-                </table>
-                <input type="hidden" id="s_no" name="s_no" value="<?V N ?>" />
-              </td>
-              <td valign="top" nowrap="1">
-                <?vsp
-                  http ('<input type="button" value="Add" onclick="javascript: updateRow(\'s\', null, {fld_1: {mode: 2}, fld_2: {}, fld_3: {mode: 3}});" />');
-                ?>
-              </td>
-            </tr>
-          </table>
-        </td>
-      </tr>
-    </xsl:template>
-
     <xsl:template match="vm:instance-settings">
+
       <tr>
         <th><label for="ianame1"><?V self.instance_descr ?></label>
           <?V case when self.wa_type = 'WEBLOG2' then 'name' else '' end?>
@@ -178,27 +84,42 @@
             <?vsp
               }
             ?>
+
+            <!--/xsl:if-->
+            <!--xsl:if test="@edit">
+              <?V wa_utf8_to_wide (self.iname) ?>
+              <?vsp
+                if (self.wa_type in ('IM'))
+                {
+              ?>
+              @
+              <?V self.wa_domain ?>
+              <?vsp
+                }
+              ?>
+            </xsl:if-->
           </xsl:if>
         </td>
       </tr>
 
       <xsl:if test="not (@edit = 'yes') and not (@readonly = 'yes')">
+
       <tr  style="vertical-align : baseline;">
         <th>
-            Your <?V self.instance_descr?> will be accessible by this URL <br/>
+          Your <?V self.instance_descr?> will be accessible by this URL: <br/>
         </th>
         <td>
           <?vsp
             declare domain any;
-
+            domain:=null;
             domain:=cfg_item_value (virtuoso_ini_path (), 'URIQA', 'DefaultHost');
-              if ((domain is null or length(domain)=0) and is_http_ctx ())
-              {
+            if ((domain is null or length(domain)=0) and is_http_ctx ())
+            {
               declare lines any;
               lines := http_request_header ();
               if (isarray (lines))
                 domain := http_request_header (lines, 'Host', null, null);
-              }
+            }
           ?>
           http://<?V domain||self.ihome?>
         </td>
@@ -209,50 +130,42 @@
             ?>
             <input type="button" name="change_url" value="Change" onclick="document.getElementById('change_defurl').style.display='block';"/>
             <?vsp
-              };
+              }
             ?>
           </xsl:if>
         </td>
       </tr>
     </xsl:if>
     <?vsp
-      if (self.wa_type in ('WEBLOG2', 'oWiki', 'Community', 'oGallery'))
-      {
+      if (self.wa_type in ('WEBLOG2', 'oWiki', 'Community','oGallery')) {
     ?>
     <xsl:if test="not (@edit = 'yes')">
       <tr>
         <td></td>
         <td colspan="2">
           <div id="change_defurl" style="display:none;">
-            <table>
-              <tr>
+            <table><tr>
               <td>
                 <xsl:if test="@readonly">
                   <?V self.ihome ?>
                 </xsl:if>
                 <xsl:if test="not @readonly">
                   <v:text name="sub_domain" error-glyph="*" value="" />.
-                    <v:data-list name="main_domain"
-                                 key-column="WD_DOMAIN"
-                                 value-column="WD_DOMAIN"
-                                 sql="select WD_DOMAIN from WA_DOMAINS where length (WD_LISTEN_HOST) union select '\173Default Domain\175' from WA_SETTINGS"
+                  <v:data-list name="main_domain" key-column="WD_DOMAIN" value-column="WD_DOMAIN"
+                    sql="select WD_DOMAIN from WA_DOMAINS where length (WD_LISTEN_HOST)
+                      union select '\173Default Domain\175' from WA_SETTINGS"
                       xhtml_onchange='toggleControl (this, "\173Default Domain\175", this.form["sub_domain"])' >
-                      <v:after-data-bind>
-                        <![CDATA[
+                  <v:after-data-bind><![CDATA[
                     control.vs_set_selected ();
-                        ]]>
-                      </v:after-data-bind>
-                      <v:before-render>
-                        <![CDATA[
-                          if (control.ufl_value is null)
-                          {
+                  ]]></v:after-data-bind>
+                  <v:before-render><![CDATA[
+                    if (control.ufl_value is null) {
                       control.ufl_value := '{Default Domain}';
                       control.vs_set_selected ();
                     }
                     if (control.ufl_value = '{Default Domain}')
                       self.sub_domain.vc_add_attribute ('disabled', '1');
-                        ]]>
-                      </v:before-render>
+                  ]]></v:before-render>
                 </v:data-list>
                 <v:text xhtml_id="ihome1" error-glyph="*" name="ihome1" value="--self.ihome" xhtml_style="width:250px">
                   <v:on-post>
@@ -262,9 +175,9 @@
                 <v:text name="ihome2" type="hidden" value="--case when e.ve_is_post then control.ufl_value else self.ihome end"/>
               </xsl:if>
             </td>
-              </tr>
-            </table>
+          </tr></table>
         </div>
+
       </td>
     </tr>
         </xsl:if>
@@ -321,10 +234,12 @@
               <td>
                 <v:select-list xhtml_id="itempl_c1" xhtml_style="width: 155px" name="itempl_c1">
                   <v:before-data-bind>
-                    if (__proc_exists ('ODS.COMMUNITY.COMM_NEWINST_GET_CUSTOMOPTIONS'))
-                    {
+
+                    if (__proc_exists ('ODS.COMMUNITY.COMM_NEWINST_GET_CUSTOMOPTIONS')){
+
                     declare res_names_arr, res_path_arr any;
 
+
                     res_names_arr:=vector();
                     res_path_arr:=vector();
 
@@ -370,12 +285,15 @@
 
                   <tr>
                     <td>
+
                        <v:select-list xhtml_id="ilogo_c1" name="ilogo_c1" xhtml_style="width: 155px">
                          <v:before-data-bind>
-                           if (__proc_exists ('ODS.COMMUNITY.COMM_NEWINST_GET_CUSTOMOPTIONS'))
-                           {
+
+                           if (__proc_exists ('ODS.COMMUNITY.COMM_NEWINST_GET_CUSTOMOPTIONS')){
+
                            declare res_names_arr, res_path_arr any;
 
+
                            res_names_arr:=vector();
                            res_path_arr:=vector();
 
@@ -578,6 +496,27 @@
             </tr>
             <tr>
               <?vsp
+                if (self.wa_type in ('oMail', 'IM'))
+                {
+              ?>
+              <th><label for="is_public1">Visible to public</label></th>
+              <td align="left">
+                <v:label format="%s" value="--case when self.is_public then 'YES' else 'NO' end" />
+                <?vsp http(sprintf('<input type="hidden" name="is_public1" id="is_public1" value="%d"/>', self.is_public)); ?>
+              </td>
+              <?vsp
+                } else {
+              ?>
+              <td align="right">
+                <v:check-box xhtml_id="is_public1" name="is_public1" value="1" initial-checked="--self.is_public"/>
+              </td>
+              <th style="text-align: left"><label for="is_public1">Visible to public</label></th>
+              <?vsp
+                }
+              ?>
+            </tr>
+            <tr>
+              <?vsp
                 if (self.wa_type in ('oDrive', 'oMail', 'IM'))
                 {
               ?>
@@ -589,13 +528,10 @@
               <?vsp
                 } else {
               ?>
-              <td />
-              <td>
-                <label for="is_visible1">
+              <td align="right">
                 <v:check-box xhtml_id="is_visible1" name="is_visible1" value="1" initial-checked="--self.is_visible"/>
-                  <b>Visible members list</b>
-                </label>
               </td>
+              <th style="text-align: left"><label for="is_visible1">Visible members list</label></th>
               <?vsp
                 }
               ?>
@@ -644,7 +580,7 @@
 
                  self.vc_data_bind(e);
 
-                 self.is_public := cast (get_keyword ('is_public1', e.ve_params) as integer);
+                 self.is_public1.ufl_selected := self.is_public;
                  self.is_visible1.ufl_selected := self.is_visible;
 
 
diff --git a/appsrc/ODS-Framework/comp/login.xsl b/appsrc/ODS-Framework/comp/login.xsl
index 3157451..3b301ca 100644
--- a/appsrc/ODS-Framework/comp/login.xsl
+++ b/appsrc/ODS-Framework/comp/login.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: login.xsl,v 1.21.2.2 2009/11/17 21:37:41 source Exp $
+ -  $Id: login.xsl,v 1.21.2.9 2011/01/25 14:11:29 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -25,166 +25,195 @@
 <!-- login control; two states in main page and on the other pages -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
   xmlns:v="http://www.openlinksw.com/vspx/"
-                xmlns:vm="http://www.openlinksw.com/vspx/ods/"
-                xmlns:fb="http://www.facebook.com/2008/fbml">
+                xmlns:vm="http://www.openlinksw.com/vspx/ods/">
 
 <xsl:template match="vm:login">
-  <v:variable name="login_blocked" type="varchar" default="null" persist="0"/>
-  <v:variable name="login_attempts" type="integer" default="0" persist="0" />
+    <![CDATA[
+      <script type="text/javascript" src="/ods/login.js"></script>
+      <script type="text/javascript">
+        ODSInitArray.push(function(){OAT.Loader.load(["ajax", "tab"], function(){lfInit()});});
+      </script>
+    ]]>
   <v:variable name="wa_name" type="varchar" default="null" persist="0" param-name="wa_name"/>
-  <v:variable name="is_cookie_session" type="int" default="0" persist="0" param-name="noparams"/>
-  <!-- OpenID signin -->
-  <v:variable name="oid_sig" type="varchar" default="null" param-name="openid.sig" />
-  <v:variable name="oid_identity" type="varchar" default="''" param-name="openid.identity" />
-  <v:variable name="oid_assoc_handle" type="varchar" default="''" param-name="openid.assoc_handle" />
-  <v:variable name="oid_signed" type="varchar" default="''" param-name="openid.signed" />
-  <v:variable name="oid_srv" type="varchar" default="''" param-name="oid-srv" />
-  <v:variable name="_return_to" type="varchar" default="null" persist="0" param-name="return_to" />
-  <v:variable name="_identity" type="varchar" default="null" persist="0" param-name="identity" />
-  <v:variable name="_assoc_handle" type="varchar" default="null" persist="0" param-name="assoc_handle" />
-  <v:variable name="_trust_root" type="varchar" default="null" persist="0" param-name="trust_root" />
-  <v:variable name="_sreg_required" type="varchar" default="null" persist="0" param-name="sreg_required" />
-  <v:variable name="_sreg_optional" type="varchar" default="null" persist="0" param-name="sreg_optional" />
-  <v:variable name="_policy_url" type="varchar" default="null" persist="0" param-name="policy_url" />
-
   <v:login name="login1" realm="wa" mode="url" user-password-check="web_user_password_check">
-    <div id="id_col">
-      <div id="site_id">
-        <img class="id_logo" src="images/odslogo_200.png" alt="ods logo icon"/>
-      </div> <!-- site_id -->
-    </div> <!-- id_col -->
-    <div id="form_col">
-      <div id="login_form_ctr">
-        <v:template type="if-no-login" name="login_if_no_login">
-          <xsl:if test="not (@no-login-ui)">
-            <xsl:choose>
-              <xsl:when test="@inst">
-                If you are already a member, please log in:
-              </xsl:when>
-              <xsl:otherwise>
-<?vsp
-  declare copy varchar;
-  copy := (select top 1 WS_WEB_DESCRIPTION from WA_SETTINGS);
-  if (copy is not null and copy <> '')
-                  http ('<h2>' || copy || '</h2>');
-?>
-              </xsl:otherwise>
-            </xsl:choose>
-            <div id="login_form">
-              <label for="login_frm_username">Member ID</label>
-              <v:text xhtml_id="login_frm_username" name="username" value="" xhtml_style="width: 200px" /><br/>
-              <label for="password">Password</label>
-              <v:text xhtml_id="login_frm_password" name="password" value="" type="password" xhtml_style="width: 200px" /><br/>
-	      <xsl:if test="not (@mode = 'oid')">
-		  <b>or</b><br/>
-                <label for="open_id_url">OpenID URL<img alt="OpenID" src="images/login-bg.gif" style="vertical-align: bottom; margin-left: 5px;"/></label>
-                <v:text name="open_id_url" xhtml_id="open_id_url" xhtml_style="width: 200px"/><br />
-	      </xsl:if>
-              <xsl:if test="not (@mode = 'facebook')">
-                <?vsp
-                  declare _fb_options any;
-                  declare _fb DB.DBA.Facebook;
-
-                  if (_get_ods_fb_settings (_fb_options))
-                  {
-                    _fb := new Facebook(_fb_options[0], _fb_options[1], self.vc_event.ve_params, self.vc_event.ve_lines);
-                ?>
-                  <b>or</b><br/>
-                  <label>Facebook</label>
-                <?vsp
-                  http(         '<div style="float: left;">');
-                  if (length (_fb._user))
+      <?vsp if (0) { ?>
+      <v:button name="lf_login2" action="simple" style="url" value="Submit" />
+      <?vsp } ?>
+      <v:after-data-bind>
+        <![CDATA[
+          declare params any;
+
+          params := self.vc_page.vc_event.ve_params;
+          if ((get_keyword ('command', params, '') = 'login') and (get_keyword ('sid', params, '') <> ''))
                   {
-                  declare _res any;
-                  _res := _fb.api_client.users_getInfo(_fb._user, 'name');
-                  http(sprintf ('Connected as <b><i>%s</i><b><br />', serialize_to_UTF8_xml (xpath_eval('string(/users_getInfo_response/user/name)', _res))));
+            self.sid := get_keyword ('sid', params);
+            self.realm := get_keyword ('realm', params);
+            connection_set ('vspx_user', (select U_NAME from DB.DBA.VSPX_SESSION, WS.WS.SYS_DAV_USER where VS_REALM = self.realm and VS_SID = self.sid and VS_UID = U_NAME));
+            self.vc_authenticated := 1;
                   }
-
-                  http(         '<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>');
-                  http(         '<fb:login-button autologoutlink="true" onlogin1="window.location=\'/ods/login.vspx\'"></fb:login-button>');
-                  http(sprintf ('<script type="text/javascript">FB.init("%s", "fb_dummy.vsp", {"reloadIfSessionStateChanged": true});</script>', _fb_options[0]));
-                  http(         '</div>');
-                ?>
+        ]]>
+      </v:after-data-bind>
+      <v:template type="if-no-login" name="login_if_no_login">
+        <table cellspacing="0">
+          <tr>
+            <td valign="top">
+              <img id="lf_logo" src="/ods/images/odslogo_200.png" />
+            </td>
+            <td valign="top">
+              <div id="lf" class="form">
+                <div class="header">
+                  Identify Yourself <img id="lf_throbber" src="/ods/images/oat/Ajax_throbber.gif" style="float: right; margin-right: 10px; display: none" />
+                </div>
+                <ul id="lf_tabs" class="tabs">
+                  <li id="lf_tab_0" title="Digest">Digest</li>
+                  <li id="lf_tab_1" title="OpenID" style="display: none;">OpenID</li>
+                  <li id="lf_tab_2" title="Facebook" style="display: none;">Facebook</li>
+                  <li id="lf_tab_3" title="WebID" style="display: none;">WebID</li>
+                  <li id="lf_tab_4" title="Twitter" style="display: none;">Twitter</li>
+                  <li id="lf_tab_5" title="LinkedIn" style="display: none;">LinkedIn</li>
+                </ul>
+                <div style="min-height: 120px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                  <div id="lf_content"> 
+                  </div>
+                  <div id="lf_page_0" class="tabContent" >
+                    <table class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%">
+                          <label for="lf_uid">User ID</label>
+                        </th>
+                        <td nowrap="nowrap">
+                          <input type="text" name="lf_uid" value="" id="lf_uid" style="width: 150px;" />
+                        </td>
+                      </tr>
+                      <tr>
+                        <th>
+                          <label for="lf_password">Password</label>
+                        </th>
+                        <td nowrap="nowrap">
+                          <input type="password" name="lf_password" value="" id="lf_password" style="width: 150px;" />
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+
+                  <div id="lf_page_1" class="tabContent" style="display: none;">
+                    <table class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%">
+                          <label for="lf_openId">OpenID URL</label>
+                        </th>
+                        <td nowrap="nowrap">
+                          <input type="text" name="lf_openId" value="" id="lf_openId" style="width: 300px;" />
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+
+                  <div id="lf_page_2" class="tabContent" style="display: none;">
+                    <table class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%"> </th>
+                        <td nowrap="nowrap">
+                          <span id="lf_facebookData" style="min-height: 20px;"> </span>
                   <br />
-                <?vsp
-                  }
-                ?>
-              </xsl:if>
-              <v:check-box name="cb_remember_me" xhtml_id="login_frm_cb_remember_me" value="1" xhtml_checked="1"/>
-              <label for="login_frm_cb_remember_me">Remember me</label><br/>
-              <span class="space">&nbsp;</span>
-              <v:button action="simple" name="login" value="Login" xhtml_id="login_frm_b_login">
-                <v:on-post>
 <![CDATA[
-              declare _blocked_until any;
-                    _blocked_until := (select WAB_DISABLE_UNTIL
-                                           from WA_BLOCKED_IP
-                                           where WAB_IP = http_client_ip ());
-              if (_blocked_until is not null and _blocked_until > now ())
-                {
-                  self.login_blocked := 'Too many failed attempts. Try again in an hour.';
-                  return;
-                }
-
-              self.login_attempts := coalesce(self.login_attempts, 0) + 1;
-
-              -- during login processing the post are called twice
-              -- so 6 instead 3
-
-              if (self.login_attempts > 6)
-                {
-                    insert replacing WA_BLOCKED_IP (WAB_IP, WAB_DISABLE_UNTIL)
-                      values (http_client_ip(), dateadd('hour', 1, now()));
-                }
+                            <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
+                            <fb:login-button autologoutlink="true" xmlns:fb="http://www.facebook.com/2008/fbml"></fb:login-button>
 ]]>
-                </v:on-post>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+
+                  <div id="lf_page_3" class="tabContent" style="display: none;">
+                    <table id="lf_table_3" class="form" cellspacing="5">
+                      <tr>
+                        <td>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+
+                  <div id="lf_page_4" class="tabContent" style="display: none;">
+                    <table id="lf_table_4" class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%">
+                        </th>
+                        <td>
+                          <span id="lf_twitter" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="lf_twitterButton" src="/ods/images/sign-in-with-twitter-d.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+
+                  <div id="lf_page_5" class="tabContent" style="display: none;">
+                    <table id="lf_table_5" class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%">
+                        </th>
+                        <td>
+                          <span id="lf_linkedin" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="lf_linkedinButton" src="/ods/images/linkedin-large.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                </div>
+                <div id="lf_forget" class="footer" style="background-color: #FFF; display: none;">
+                  <a href="pass_recovery.vspx">Forgot your password?</a>
+                </div>
+                <div class="footer">
+                  <input type="submit" name="lf_login" id="lf_login" value="Login" onclick="javascript: return lfLoginSubmit();" />
+                  <v:button name="lf_register" action="simple" value="Sign Up">
                 <v:before-render>
 <![CDATA[
-  if (self.login_blocked is not null)
-      control.vc_enabled := 0;
+                        declare dom_reg any;
+
+                        control.vc_enabled := coalesce ((select top 1 WS_REGISTER from WA_SETTINGS), 0);
+                        whenever not found goto nfd;
+                        select WD_MODEL
+                          into dom_reg
+                          from WA_DOMAINS
+                         where WD_HOST = http_map_get ('vhost')
+                           and WD_LISTEN_HOST = http_map_get ('lhost')
+                           and WD_LPATH = http_map_get ('domain');
+                        control.vc_enabled := dom_reg;
+
+                      nfd:;
+                        -- XXX: wrong!!! member model is per instance not for wa registration
+                        -- declare model any;
+                        -- model := (select top 1 WS_MEMBER_MODEL from WA_SETTINGS);
+                        -- if (model <> 0)
+                        --   control.vc_enabled := 0;
 ]]>
                 </v:before-render>
-              </v:button>
-              <v:button action="simple" name="login_form_X509" value="X.509 Login" enabled="--is_https_ctx ()" xhtml_id="login_form_X509" />
-                <vm:register/>
-              <xsl:if test="@inst">
-                  If you are a new member, please enter the following to create an account:
-              </xsl:if>
-              <br/>
-              <v:url xhtml_class="pwd_recovery_url" url="" name="url_to_forget" value="Forgot your password?">
-                <v:before-render>
+                    <v:on-post>
 <![CDATA[
-  control.vu_url := 'pass_recovery.vspx';
-  if (self.username.ufl_value is not null and
-      self.username.ufl_value <> '' and
-      get_keyword('username', self.vc_event.ve_params, '') <> '')
-    {
-      control.vu_url := concat(control.vu_url, '?usr=', self.username.ufl_value);
-      control.vc_enabled := self.login_attempts;
-                    } else {
-    control.vc_enabled := 0;
-                    }
+                        declare redir any;
+
+                        redir := '';
+                        if (length (self.url) and self.url <> 'uhome.vspx')
+                          redir := sprintf ('&URL=%U', self.url);
+
+                        http_request_status ('HTTP/1.1 302 Found');
+                        http_header (sprintf ('Location: register.vspx?reguid=%s%s\r\n', get_keyword('username', self.vc_event.ve_params, ''), redir));
 ]]>
-                </v:before-render>
-              </v:url>
-            </div> <!-- login-form -->
-          </xsl:if>
+                    </v:on-post>
+                  </v:button>
+                </div>
+              </div>
+            </td>
+          </tr>
+        </table>
         </v:template>
         <v:template type="if-login" name="login_if_login">
 <?vsp
-  {
-    if (get_keyword('register_btn', self.vc_event.ve_params, '') <> '')
-      return;
-
     declare url, pars varchar;
 
-    if (not self.is_cookie_session)
       pars := sprintf ('sid=%s&realm=%s', self.sid, self.realm);
-    else
-      pars := '';
-
-    declare cook_str, expire varchar;
-
     if (self.wa_name is not null)
       {
         self.url := 'new_inst.vspx';
@@ -196,101 +225,29 @@
       pars := pars || '&fr=' || self.promo;
 
     url := vspx_uri_add_parameters (self.url, pars);
-
-    declare oid_code int;
-    oid_code := 0;
-?>
-<xsl:if test="@mode = 'oid'">
-            <xsl:processing-instruction name="vsp">
-              <![CDATA[
-    if (self._return_to is not null)
-      {
-                  OPENID..checkid_immediate (self._identity, self._assoc_handle, self._return_to, self._trust_root, self.sid, 0, self._sreg_required, self._sreg_optional, self._policy_url);
-	 oid_code := 1;
-      }
-              ]]>
-            </xsl:processing-instruction>
-</xsl:if>
-<?vsp
-    -- should be else, but cant stick with XSL-T if
-    if (not oid_code)
-      {
         http_request_status ('HTTP/1.1 302 Found');
         http_header (concat (http_header_get (), sprintf ('Location: %s\r\n', url)));
-      }
-  }
-
-  self.login_attempts := 0;
 ?>
         </v:template>
         <v:on-post>
-
 <![CDATA[
-
-  declare cook_str, expire varchar;
-
-  if (self.vc_authenticated and length (self.sid))
+          if ((self.vc_authenticated and length (self.sid)) and (strstr (http_header_get (), 'Set-Cookie: sid=') is null))
     {
-      declare expire varchar;
+            declare cook_str, expire varchar;
 
+            expire := '';
       if (get_keyword('cb_remember_me', self.vc_event.ve_params) is not null)
         expire := sprintf (' expires=%s;', date_rfc1123 (dateadd ('hour', 1, now())));
-      else
-        expire := '';
 
-      cook_str := sprintf ('Set-Cookie: sid=%s;%s path=/\r\n', self.sid, expire);
-
-      if (strstr (http_header_get (), 'Set-Cookie: sid=') is null)
-        {
-          cook_str := concat (http_header_get (), cook_str);
+            cook_str := http_header_get () || sprintf ('Set-Cookie: sid=%s;%s path=/\r\n', self.sid, expire);
           http_header (cook_str);
         }
-    }
-  if (self.vc_authenticated and length (self.sid) and self._return_to is not null)
-    {
-      expire := date_rfc1123 (dateadd ('hour', 1, now()));
-      cook_str := sprintf ('Set-Cookie: openid.sid=%s; expires=%s; path=/;\r\n', self.sid, expire);
-
-      if (strstr (http_header_get (), 'Set-Cookie: openid.sid=') is null)
-	    {
-          cook_str := concat (http_header_get (), cook_str);
-          http_header (cook_str);
-        }
-    }
 ]]>
         </v:on-post>
         <xsl:call-template name="login-after-data-bind"/>
-<?vsp
-      if (self.login_blocked is not null)
-        http(self.login_blocked);
-      else
-        {
-          if (self.login_attempts > 0)
-            {
-?>
-        <div class="login_error_ctr">
-          <p class="login_error">
-            <img class="warn_img" src="images/warn_16.png"/>
-            <span class="err_msg">Invalid member ID or password</span>
-          </p>
-        </div>
-<?vsp
-            }
-        }
-?>
-
-      </div> <!-- login-form-ctr -->
-    </div> <!-- form_col -->
   </v:login>
 </xsl:template>
 
-<xsl:template match="vm:login-url">
-  <v:url url="index.vspx">
-    <xsl:attribute name="name">ul_<xsl:value-of select="generate-id()"/></xsl:attribute>
-    <xsl:copy-of select="@*"/>
-  </v:url>
-</xsl:template>
-
 <xsl:template match="vm:login[@redirect]">
   <v:login name="login1" realm="wa" mode="url" user-password-check="web_user_password_check">
     <v:template type="if-no-login">
@@ -305,8 +262,9 @@
 
 <xsl:template name="login-after-data-bind">
   <v:after-data-bind>
-
 <![CDATA[
+        declare tmpl, uname any;
+
   if (length (self.sid) and length (self.login_ip) and self.login_ip <> http_client_ip ())
     {
       delete from VSPX_SESSION where VS_SID = self.sid and VS_REALM = self.realm;
@@ -318,158 +276,15 @@
       self.vc_redirect ('login.vspx');
       return;
     }
-  else if (length (self.sid) and self.login_ip is null)
     self.login_ip := http_client_ip ();
-
-      declare tmpl, redirect, open_id_url, uname any;
-      declare _fb_options any;
-      declare _fb DB.DBA.Facebook;
-
   ]]>
     <xsl:if test="@redirect">
     <![CDATA[
-      redirect := 1;
-    ]]>
-    </xsl:if>
-    <xsl:if test="not (@mode = 'oid') and not (@mode = 'facebook') and not (@redirect)">
-<![CDATA[
-open_id_url := get_keyword ('open_id_url', e.ve_params, null);
-if (not control.vl_authenticated and length(self.oid_sig))
-{
-        declare url, pars, sig varchar;
-
-  url := sprintf ('%s?openid.mode=check_authentication&openid.assoc_handle=%U&openid.sig=%U&openid.signed=%U',
-  self.oid_srv, self.oid_assoc_handle, self.oid_sig, self.oid_signed);
-
-  pars := e.ve_params;
-
-  sig := split_and_decode (self.oid_signed, 0, '\0\0,');
-  foreach (any el in sig) do
-    {
-      el := trim (el);
-      if (el not in ('mode', 'signed', 'assoc_handle'))
+        if (not control.vl_authenticated and is_https_ctx ())
         {
-          declare val any;
-	  val := get_keyword ('openid.'||el, pars, '');
-	  if (val <> '')
-	    url := url || sprintf ('&openid.'||el||'=%U', val);
-	}
-    }
-  {
-     declare resp any;
-          declare exit handler for sqlstate '*'
-          {
-     goto auth_failed1;
-    };
-    resp := HTTP_CLIENT (url);
-    if (resp not like '%is_valid:%true\n%')
-      goto auth_failed1;
-  }
-
-  whenever not found goto no_auth2;
-  select U_NAME into uname from WA_USER_INFO, SYS_USERS where WAUI_U_ID = U_ID and WAUI_OPENID_URL = self.oid_identity;
-  control.vl_authenticated := 1;
-  connection_set ('vspx_user', uname);
-  self.sid := vspx_sid_generate ();
-  self.realm := 'wa';
-  insert into VSPX_SESSION (VS_SID, VS_REALM, VS_UID, VS_EXPIRY) values (self.sid, self.realm, uname, now ());
-  no_auth2:;
-  if (not control.vl_authenticated)
-      self.login_attempts := coalesce(self.login_attempts, 0) + 1;
-    }
-if (not control.vl_authenticated and length (open_id_url) and e.ve_is_post)
-{
-declare hdr, xt, uoid, is_agreed any;
-declare url, cnt, oi_ident, oi_srv, oi_delegate, host, this_page, trust_root, check_immediate varchar;
-declare oi2_srv varchar;
-
-host := http_request_header (e.ve_lines, 'Host');
-
-this_page := 'http://' || host || http_path ();
-trust_root := 'http://' || host;
-
-declare exit handler for sqlstate '*'
-{
-  self.vc_is_valid := 0;
-  self.vc_error_message := 'Invalid OpenID URL';
-  return;
-};
-
-url := open_id_url;
-oi_ident := url;
-again:
-hdr := null;
-cnt := DB.DBA.HTTP_CLIENT_EXT (url=>url, headers=>hdr);
-if (hdr [0] like 'HTTP/1._ 30_ %')
-  {
-    declare loc any;
-    loc := http_request_header (hdr, 'Location', null, null);
-    url := WS.WS.EXPAND_URL (url, loc);
-    oi_ident := url;
-    goto again;
-  }
-xt := xtree_doc (cnt, 2);
-oi_srv := cast (xpath_eval ('//link[contains (@rel, "openid.server")]/@href', xt) as varchar);
-oi2_srv := cast (xpath_eval ('//link[contains (@rel, "openid2.provider")]/@href', xt) as varchar);
-oi_delegate := cast (xpath_eval ('//link[contains (@rel, "openid.delegate")]/@href', xt) as varchar);
-
-if (oi2_srv is not null)
-  oi_srv := oi2_srv;
-
-if (oi_srv is null)
-  signal ('22023', 'Cannot locate OpenID server');
-
-if (oi_delegate is not null)
-  oi_ident := oi_delegate;
-
-this_page := this_page || sprintf ('?oid-srv=%U', oi_srv);
-
-if (oi2_srv is not null)
-  {
-     check_immediate :=
-     sprintf ('%s?openid.ns=%U&openid.ns.sreg=%U&openid.mode=checkid_setup&openid.identity=%U&openid.claimed_id=%U&openid.return_to=%U&openid.realm=%U',
-     oi_srv, OPENID..ns_v2 (), OPENID..sreg_ns_v1 (), oi_ident, oi_ident, this_page, trust_root);
-  }
-else
-  {
-    check_immediate :=
-     sprintf ('%s?openid.mode=checkid_setup&openid.identity=%U&openid.return_to=%U&openid.trust_root=%U',
-    oi_srv, oi_ident, this_page, trust_root);
- }
-self.vc_redirect (check_immediate);
-return;
-      }
-      if (not control.vl_authenticated and e.ve_is_post and _get_ods_fb_settings (_fb_options))
-      {
-        whenever not found goto no_auth3;
+          declare data any;
 
-        _fb := new Facebook(_fb_options[0], _fb_options[1], self.vc_event.ve_params, self.vc_event.ve_lines);
-        if (length (_fb._user))
-        {
-          select U_NAME into uname from WA_USER_INFO, SYS_USERS where WAUI_U_ID = U_ID and WAUI_FACEBOOK_LOGIN_ID = _fb._user;
-          control.vl_authenticated := 1;
-          connection_set ('vspx_user', uname);
-          self.sid := vspx_sid_generate ();
-          self.realm := 'wa';
-          insert into VSPX_SESSION (VS_SID, VS_REALM, VS_UID, VS_EXPIRY) values (self.sid, self.realm, uname, now ());
-        no_auth3:;
-          if (not control.vl_authenticated)
-            self.login_attempts := coalesce(self.login_attempts, 0) + 1;
-        }
-}
-auth_failed1:;
-    ]]>
-</xsl:if>
-<![CDATA[
-      if (not control.vl_authenticated and (redirect or (e.ve_is_post and (not isnull (e.ve_button)) and (e.ve_button.vc_name = 'login_form_X509'))))
-      {
-        if (e.ve_is_post and (not isnull (e.ve_button)) and (e.ve_button.vc_name = 'login_form_X509'))
-          redirect := 2;
-        if (is_https_ctx ())
-        {
-          declare uname, data any;
-
-          data := ODS.DBA.sessionValidateX509 (redirect);
+          data := ODS.DBA.sessionValidateX509 (1);
           if (isnull (data))
               return 0;
 
@@ -478,9 +293,12 @@ auth_failed1:;
             connection_set ('vspx_user', uname);
             self.sid := vspx_sid_generate ();
             self.realm := 'wa';
-            insert into VSPX_SESSION (VS_SID, VS_REALM, VS_UID, VS_EXPIRY) values (self.sid, self.realm, uname, now ());
-          }
+          insert into VSPX_SESSION (VS_SID, VS_REALM, VS_UID, VS_EXPIRY)
+            values (self.sid, self.realm, uname, now ());
         }
+      ]]>
+      </xsl:if>
+      <![CDATA[
   if (control.vl_authenticated)
     {
       set isolation = 'committed';
@@ -508,10 +326,6 @@ auth_failed1:;
                  left join WA_USER_INFO on (U_ID = WAUI_U_ID)
         where U_NAME = connection_get ('vspx_user') with (prefetch 1);
 
-        if (not length (self.u_full_name))
-          self.u_full_name := self.u_name;
-
-        self.u_full_name := wa_utf8_to_wide (self.u_full_name);
         tmpl := (select coalesce (WAUI_TEMPLATE, 'default') from DB.DBA.WA_USER_INFO where WAUI_U_ID = self.u_id);
         if (tmpl = 'custom')
           self.current_template := self.u_home || 'wa/templates/custom';
@@ -529,19 +343,13 @@ auth_failed1:;
             self.current_template_name := 'default';
           }
 
-        self.u_first_name := self.u_name;
-
-        whenever not found goto nfud;
-
-        select WAUI_FIRST_NAME
-          into self.u_first_name
-          from WA_USER_INFO
-          where WAUI_U_ID = self.u_id;
-
+          if (not length (self.u_full_name))
+            self.u_full_name := self.u_name;
+          self.u_full_name := wa_utf8_to_wide (self.u_full_name);
+          self.u_first_name := (select WAUI_FIRST_NAME from WA_USER_INFO where WAUI_U_ID = self.u_id);
         if (not length (self.u_first_name))
           self.u_first_name := self.u_name;
 
-       nfud:;
         if (self.fname = self.u_name or length (self.fname) = 0)
             self.tab_pref := 'My ';
 
@@ -561,53 +369,6 @@ auth_failed1:;
   <vm:label value="--coalesce(self.u_full_name,'not logged')" />
 </xsl:template>
 
-<xsl:template match="vm:register">
-  <v:button action="simple" name="register_btn" value="Sign Up!" xhtml_id="login_frm_b_signup">
-    <v:before-render>
-
-<![CDATA[
-
-  declare dom_reg any;
-
-  control.vc_enabled := coalesce ((select top 1 WS_REGISTER from WA_SETTINGS), 0);
-
-  whenever not found goto nfd;
-
-  select WD_MODEL
-    into dom_reg
-    from WA_DOMAINS
-         where WD_HOST = http_map_get ('vhost')
-           and WD_LISTEN_HOST = http_map_get ('lhost')
-           and WD_LPATH = http_map_get ('domain');
-  control.vc_enabled := dom_reg;
-
-nfd:;
-
-	-- XXX: wrong!!! member model is per instance not for wa registration
-        --declare _model any;
-        --_model := (select top 1 WS_MEMBER_MODEL from WA_SETTINGS);
-        --if(_model <> 0)
-        --  control.vc_enabled := 0;
-]]>
-
-    </v:before-render>
-    <v:on-post>
-
-<![CDATA[
-
-  declare redir any;
-  redir := '';
-
-  if (length (self.url) and self.url <> 'uhome.vspx')
-    redir := sprintf ('&URL=%U', self.url);
-
-  http_request_status ('HTTP/1.1 302 Found');
-        http_header (sprintf ('Location: register.vspx?reguid=%s%s\r\n', get_keyword('username', self.vc_event.ve_params, ''), redir));
-]]>
-    </v:on-post>
-  </v:button>
-</xsl:template>
-
 <xsl:template match="vm:user-id">
     <vm:label value="--self.u_name" />
 </xsl:template>
diff --git a/appsrc/ODS-Framework/comp/make_sp.xsl b/appsrc/ODS-Framework/comp/make_sp.xsl
index c3592be..8578e12 100644
--- a/appsrc/ODS-Framework/comp/make_sp.xsl
+++ b/appsrc/ODS-Framework/comp/make_sp.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: make_sp.xsl,v 1.3 2006/10/17 14:07:20 source Exp $
+ -  $Id: make_sp.xsl,v 1.3.2.1 2010/09/20 10:15:33 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/map_control.js b/appsrc/ODS-Framework/comp/map_control.js
index 3128104..e64ccbb 100644
--- a/appsrc/ODS-Framework/comp/map_control.js
+++ b/appsrc/ODS-Framework/comp/map_control.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: map_control.js,v 1.5 2008/03/13 20:50:06 source Exp $
+ *  $Id: map_control.js,v 1.5.2.1 2010/09/20 10:15:33 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Framework/comp/map_control.xsl b/appsrc/ODS-Framework/comp/map_control.xsl
index 32c70ee..520a47e 100644
--- a/appsrc/ODS-Framework/comp/map_control.xsl
+++ b/appsrc/ODS-Framework/comp/map_control.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: map_control.xsl,v 1.12.2.2 2010/03/12 09:10:13 source Exp $
+ -  $Id: map_control.xsl,v 1.12.2.3 2010/09/20 10:15:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/members.xsl b/appsrc/ODS-Framework/comp/members.xsl
index d80e7c5..61c0c19 100644
--- a/appsrc/ODS-Framework/comp/members.xsl
+++ b/appsrc/ODS-Framework/comp/members.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: members.xsl,v 1.3 2006/10/17 14:07:20 source Exp $
+ -  $Id: members.xsl,v 1.3.2.1 2010/09/20 10:15:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/membership.xsl b/appsrc/ODS-Framework/comp/membership.xsl
index d09ce0d..0cc7a03 100644
--- a/appsrc/ODS-Framework/comp/membership.xsl
+++ b/appsrc/ODS-Framework/comp/membership.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: membership.xsl,v 1.3 2006/10/17 14:07:20 source Exp $
+ -  $Id: membership.xsl,v 1.3.2.1 2010/09/20 10:15:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/ods_bar.xsl b/appsrc/ODS-Framework/comp/ods_bar.xsl
index fbc73e9..616f378 100644
--- a/appsrc/ODS-Framework/comp/ods_bar.xsl
+++ b/appsrc/ODS-Framework/comp/ods_bar.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: ods_bar.xsl,v 1.40.2.5 2010/06/09 13:45:51 source Exp $
+ -  $Id: ods_bar.xsl,v 1.40.2.12 2011/03/08 13:28:18 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -52,33 +52,23 @@
     <v:variable name="odsbar_return_url" type="varchar" persist="session" default="null" param-name="RETURL" />
     <v:variable name="odsbar_current_url" type="varchar" default="''"/>
     <xsl:processing-instruction name="vsp">
+        declare _params any;
 
+        _params := self.vc_event.ve_params;
   self.odsbar_show_signin:='<xsl:value-of select="@show_signin"/>';
-
-  if (length(self.odsbar_show_signin)=0) self.odsbar_show_signin:='true';
+        if (length(self.odsbar_show_signin) = 0)
+          self.odsbar_show_signin := 'true';
 
   self.odsbar_inout_arr:=vector('app_type','<xsl:value-of select="@app_type"/>');
+        if (get_keyword ('app_type', self.odsbar_inout_arr, '') = '')
+          self.odsbar_inout_arr := vector ('app_type', get_keyword ('app_type', _params));
 
-  if (get_keyword ('app_type', self.odsbar_inout_arr) is NULL or
-      length (get_keyword ('app_type', self.odsbar_inout_arr)) = 0)
-    {
-      self.odsbar_inout_arr := vector ('app_type', get_keyword ('app_type', self.vc_event.ve_params));
-    };
-
-
-  if (get_keyword ('logout', self.vc_event.ve_params) = 'true' and length (self.sid) > 0)
+        if (get_keyword ('logout', _params) = 'true' and length (self.sid) > 0)
     {
       delete from VSPX_SESSION where VS_REALM = self.realm and VS_SID = self.sid;
-
       self.sid := null;
-
-      declare _params any;
-      _params := self.vc_event.ve_params;
-      _params := vector_concat (subseq (_params, 0, position ('sid', _params) - 1),
-                                subseq (_params, position ('sid', _params) + 1));
-
+          _params := vector_concat (subseq (_params, 0, position ('sid', _params) - 1), subseq (_params, position ('sid', _params) + 1));
       self.vc_event.ve_params := _params;
-
       connection_set ('vspx_user','');
 
       declare redirect_url varchar;
@@ -88,56 +78,34 @@
         redirect_url := self.odsbar_ods_gpath || 'sfront.vspx';
       http_rewrite ();
       http_request_status ('HTTP/1.1 302 Found');
-      http_header (concat (http_header_get (), 'Location: ', redirect_url, '\r\n'));
-      self.vc_redirect (redirect_url);
-    };
-
+          http_header (http_header_get () ||  'Location: ' || redirect_url || '\r\nSet-Cookie: sid=; path=/\r\n');
+          http_flush();
+          return;
+        }
     </xsl:processing-instruction>
-
     <v:on-init>
-
 <![CDATA[
-
   declare vsp2vspx_user varchar;
+          declare _params any;
 
-  vsp2vspx_user := '';
-
-  whenever not found goto nf_uid;
-
-  select VS_UID
-    into vsp2vspx_user
+          _params := self.vc_event.ve_params;
+          vsp2vspx_user := (select VS_UID
     from VSPX_SESSION
-    where VS_REALM = get_keyword ('realm', self.vc_event.ve_params) and
-          VS_SID = get_keyword ('sid', self.vc_event.ve_params);
-
- nf_uid:;
-
+                             where VS_REALM = get_keyword ('realm', _params)
+                               and VS_SID = get_keyword ('sid', _params));
   if (length (self.sid) = 0 and
-      length (get_keyword ('sid', self.vc_event.ve_params)) > 0 and
+              length (get_keyword ('sid', _params)) > 0 and
       length (vsp2vspx_user) > 0)
     {
-      self.sid := get_keyword ('sid', self.vc_event.ve_params);
-      self.realm := coalesce(get_keyword ('realm', self.vc_event.ve_params),'wa');
+            self.sid := get_keyword ('sid', _params);
+            self.realm := get_keyword ('realm', _params, 'wa');
       connection_set ('vspx_user', vsp2vspx_user);
-
-    };
-
-
-     declare _preserv_urlhost integer;
-     _preserv_urlhost:=1;
-
-     if( _preserv_urlhost )
-     {
+          }
         declare vh, lh, hf any;
+
         vh := http_map_get ('vhost');
         lh := http_map_get ('lhost');
         hf := http_request_header (self.vc_event.ve_lines, 'Host');
-
-	-- The below is wrong, the request can be to default http port 80 ,
-	-- therefore mixing the default http & server port is bad idea
-        -- if(strchr (hf, ':') is null)
-        --   hf:=hf||':'|| server_http_port ();
-
         if (hf is not null and exists (select 1 from HTTP_PATH where HP_HOST = vh and HP_LISTEN_HOST = lh and HP_LPATH = '/ods'))
         {
           self.odsbar_ods_gpath := http_s() || hf || '/ods/';
@@ -149,43 +117,22 @@
           self.odsbar_dataspace_path :=WA_LINK(1, '/dataspace/');
         }
 
-     }else
-     {
-       self.odsbar_ods_gpath := cfg_item_value (virtuoso_ini_path (), 'URIQA', 'DefaultHost');
-       if (self.odsbar_ods_gpath is not null and strchr (self.odsbar_ods_gpath, ':') is null and server_http_port () <> '80')
-       {
-           self.odsbar_ods_gpath:=self.odsbar_ods_gpath||':'|| server_http_port ();
-           self.odsbar_dataspace_path :=self.odsbar_ods_gpath||':'|| server_http_port ()|| '/dataspace/';
-       }
-       else if(self.odsbar_ods_gpath is null)
-       {
-           self.odsbar_ods_gpath := WA_LINK(1, '/ods/');
-           self.odsbar_dataspace_path :=WA_LINK(1, '/dataspace/');
-       }
-     }
-
      declare _url any;
+
      _url:=split_and_decode(self.vc_event.ve_lines[0],0,'\0\0 ');
      if(length(_url)>1)
         self.odsbar_current_url:=_url[1];
      else
         self.odsbar_current_url:='';
 
-     if(get_keyword ('signin_returl_params', self.vc_event.ve_params,'')<>'')
-        self.odsbar_current_url:=http_path()||'?'||get_keyword ('signin_returl_params', self.vc_event.ve_params,'');
+          if (get_keyword ('signin_returl_params', _params, '') <> '')
+            self.odsbar_current_url:=http_path()||'?'||get_keyword ('signin_returl_params', _params, '');
 ]]>
-
     </v:on-init>
     <v:before-data-bind>
-
 <![CDATA[
-
---          if (registry_get ('wa_home_link')<>0)
---              self.odsbar_ods_gpath:=registry_get ('wa_home_link');
-
   if (length (self.sid))
     {
-
       self.odsbar_loginparams:='sid='||coalesce(self.sid,'')||'&realm='||coalesce(self.realm,'wa');
 
   whenever not found goto nf_uid2;
@@ -233,8 +180,6 @@ for (var i = 0; i < _head.childNodes.length; i++)
    }
 }
 
-//console.debug(odsbarCSSloaded);
-
 function loadCSS(cssContainer)
 {
   var _head=document.getElementsByTagName("head")[0];
@@ -246,15 +191,12 @@ function loadCSS(cssContainer)
   {
     var cssNode = document.createElement('style');
     cssNode.type = 'text/css';
-    if(cssNode.styleSheet)
-    {// IE
+    if (cssNode.styleSheet) {
+      // IE
       cssNode.styleSheet.cssText = cssObj.innerHTML;
-    }else
-    {
+    } else {
       cssNode.textContent =cssObj.innerHTML;
-    };
-
-
+    }
     _head.appendChild(cssNode);
   }
   else if(cssUrl.length)
@@ -268,11 +210,8 @@ function loadCSS(cssContainer)
   }
   return;
 }
-
 if(odsbarCSSloaded==0)
-{
    loadCSS('odsBarCss');
-}
 
 var ODSInitArray = new Array();
 
@@ -284,12 +223,10 @@ if (typeof (OAT) == 'undefined')
   var toolkitPath="<?V self.odsbar_ods_gpath ?>oat";
   var toolkitImagesPath="<?V self.odsbar_ods_gpath ?>images/oat/";
 
-
-  var featureList = ["dom"];
+  var featureList = [];
 
   var script = document.createElement("script");
   script.src = '<?V self.odsbar_ods_gpath ?>oat/loader.js';
-//  alert ("OAT loader path: "+script.src);
   _head.appendChild(script);
 }
 
@@ -340,7 +277,6 @@ if (typeof (OAT) == 'undefined')
           doPost (fld.form.name, btn);
           return false;
         }
-      else
         return true;
     }
 
@@ -355,24 +291,54 @@ if (typeof (OAT) == 'undefined')
       else
         return true;
 
-
       if (keycode == 13)
         {
-
-//        alert('<?V sprintf('%ssearch.vspx',self.odsbar_ods_gpath) ?>?q='+$('odsbar_search_text').value);
           document.location.href =
             '<?V sprintf ('%ssearch.vspx', self.odsbar_ods_gpath) ?>?q='+$('odsbar_search_text').value+
             '<?vsp http(case when self.sid is not null then '&sid='||self.sid||'&realm='||coalesce(self.realm,'wa') else '' end);?>'+
             '<?vsp http(case when coalesce(self.odsbar_app_type,get_keyword ('app_type', self.odsbar_inout_arr)) is not null then '&ontype='||coalesce(self.odsbar_app_type,get_keyword ('app_type', self.odsbar_inout_arr)) else '' end);?>'
             ;
-
           return false;
         }
-      else
         return true;
     }
+function showSSLLink()
+{
+  if (inFrame)
+    return;
+
+  if (document.location.protocol == 'https:')
+    return;
+
+	var x = function(data) {
+		var o = null;
+		try {
+			o = OAT.JSON.parse(data);
+		} catch (e) {
+			o = null;
+		}
+		if (o && o.sslPort && !$('a_ssl_link')) {
+			var href = 'https://' +
+			           document.location.hostname +
+			           ((o.sslPort != '443')? ':'+o.sslPort: '') +
+			           document.location.pathname +
+			           document.location.search +
+			           document.location.hash;
+			var a = OAT.Dom.create("a");
+			a.id = 'a_ssl_link';
+			a.href = href;
+			var img = OAT.Dom.create('img');
+			img.src = '/ods/images/icons/lock_16.png';
+			img.alt = 'ODS SSL Link';
+      a.appendChild(img);
+			$('span_ssl_link').appendChild(a);
+		}
+	}
+	OAT.AJAX.GET('/ods/api/server.getInfo?info=sslPort', false, x, {onstart : function(){}, onend : function(){}});
+}
 //-->
-]]></script>
+        ]]>
+      </script>
 
   <div id="ods_bar_loading" style="background-color:#DDEFF9;height: 62px;padding:5px 0px 0px 5px;display:none;">
      <img src="/ods/images/oat/Ajax_throbber.gif" alt="loading..." /><span> Loading... please wait.</span>
@@ -428,31 +394,17 @@ if (typeof (OAT) == 'undefined')
                      url="--self.odsbar_ods_gpath||'app_settings.vspx'"
                      value="Application Settings"
                      is-local="1"/>
-            </vm:if>
-
             <!-- Site admin settings link -->
-
-            <vm:if test=" length (self.sid) and wa_user_is_dba (self.odsbar_u_name, self.odsbar_u_group) ">
+              <vm:if test="wa_user_is_dba (self.odsbar_u_name, self.odsbar_u_group) ">
               <v:url name="site_settings_lnk"
                      value="Site Settings"
                      url="--self.odsbar_ods_gpath||'site_settings.vspx'"
                      render-only="1"
                      is-local="1"/>
-              |
             </vm:if>
-
-            <vm:if test=" length (self.sid) ">
               |
             </vm:if>
-
-            <v:url name="odsbar_help_button"
-                   value="Help"
-                   url="--self.odsbar_ods_gpath||'help.vspx'"
-                   xhtml_target="_blank"
-                   is-local="1"/>
-
             <vm:if test=" length (self.sid) = 0 ">
-              |
               <v:url name="odsbar_login_button"
                      value="Sign In"
                      url="--self.odsbar_ods_gpath||'login.vspx'||(case when length(self.odsbar_current_url)>0 then sprintf('?URL=%U',self.odsbar_current_url) else '' end)"
@@ -467,14 +419,8 @@ if (typeof (OAT) == 'undefined')
               <v:template name="ods_barregister_txt"  type="simple" enabled="--(1-coalesce ((select top 1 WS_REGISTER from WA_SETTINGS), 0))">
                   Sign Up
               </v:template>
-
             </vm:if>
             <vm:if test=" length (self.sid) > 0 ">
-              <img class="ods_bar_inline_icon"
-                   style="float:none"
-                   src="<?V self.odsbar_ods_gpath ?>images/lock.png"
-                   alt="lock icon"/>
-
               <v:url name="odsbar_userinfo_button"
                      value="--self.odsbar_u_full_name"
                      url="--self.odsbar_dataspace_path||wa_identity_dstype(self.odsbar_u_name)||'/'||self.odsbar_u_name||'#this'"
@@ -490,6 +436,18 @@ if (typeof (OAT) == 'undefined')
                      xhtml_class="logout_lnk"
                      is-local="1"/>
             </vm:if>
+            |
+            <v:url name="odsbar_help_button"
+                   value="Help"
+                   url="--self.odsbar_ods_gpath||'help.vspx'"
+                   xhtml_target="_blank"
+                   is-local="1"/>
+                <span id="span_ssl_link"> </span>
+            <script type="text/javascript">
+              <![CDATA[
+                ODSInitArray.push(function(){OAT.Loader.load(["ajax", "json"], function(){showSSLLink();});});
+              ]]>
+            </script>
           </div><!-- ods_bar_top_cmds -->
         </div> <!-- ods_bar_top -->
         <vm:odsbar_navigation_level2/>
@@ -500,7 +458,8 @@ if (typeof (OAT) == 'undefined')
          declare curr_location varchar;
          curr_location:='';
 
-         if (registry_get ('wa_home_link') = 0){
+                if (registry_get ('wa_home_link') = 0)
+                {
               curr_location:=sprintf('<a href="%s?sid=%s&realm=%s">%s</a> > ','/ods/', coalesce(self.sid,''), coalesce(self.realm,'wa') ,case when registry_get ('wa_home_title') = 0 then 'ODS Home' else registry_get ('wa_home_title') end);
          }else{
               curr_location:=sprintf('<a href="%s?sid=%s&realm=%s">%s</a> > ',registry_get ('wa_home_link'), coalesce(self.sid,''), coalesce(self.realm,'wa') ,case when registry_get ('wa_home_title') = 0 then 'ODS Home' else registry_get ('wa_home_title') end);
@@ -519,118 +478,104 @@ if (typeof (OAT) == 'undefined')
          if(length(self.odsbar_app_type)>0)
             curr_location:=curr_location||WA_GET_APP_NAME(self.odsbar_app_type)||' > ';
 
-
         declare _http_path varchar;
-        _http_path:=http_path ();
 
+                _http_path := http_path ();
         if(locate('/gtags.vspx',_http_path))
             curr_location:=curr_location||'Tags > ';
-        if(locate('/app_settings.vspx',_http_path))
-            curr_location:=curr_location||'Settings > ';
+                else if (locate ('/app_settings.vspx', _http_path))
+                  curr_location := curr_location||'Application Settings > ';
 
         declare settings_url varchar;
-        settings_url:='<a href="'||self.odsbar_ods_gpath||'app_settings.vspx?'||self.odsbar_loginparams||'">Application Settings</a> > ';
 
+                settings_url := '<a href="'||self.odsbar_ods_gpath||'app_settings.vspx?'||self.odsbar_loginparams||'">Application Settings</a> > ';
         if(locate('/services.vspx',_http_path))
             curr_location:=curr_location||settings_url||'Applications Management > ';
 
         declare settings_applications_url varchar;
-        settings_applications_url:='<a href="'||self.odsbar_ods_gpath||'services.vspx?'||self.odsbar_loginparams||'">Applications Management</a> > ';
 
+                settings_applications_url := '<a href="'||self.odsbar_ods_gpath||'services.vspx?'||self.odsbar_loginparams||'">Applications Management</a> > ';
         if(locate('/delete_inst.vspx',_http_path))
             curr_location:=curr_location||settings_url||settings_applications_url||' Delete > ';
-        if(locate('/edit_inst.vspx',_http_path))
+                else if (locate ('/edit_inst.vspx', _http_path))
             curr_location:=curr_location||settings_url||settings_applications_url||' Edit > ';
-        if(locate('/members.vspx',_http_path))
+                else if (locate ('/members.vspx', _http_path))
             curr_location:=curr_location||settings_url||settings_applications_url||' Members > ';
-        if(locate('/vhost_simple.vspx',_http_path))
+                else if (locate ('/vhost_simple.vspx', _http_path))
             curr_location:=curr_location||settings_url||settings_applications_url||' Endpoints > ';
-
-
-
-        if(locate('/stat.vspx',_http_path))
+                else if (locate ('/stat.vspx', _http_path))
             curr_location:=curr_location||settings_url||'Log and Statistics > ';
-
-        if(locate('/admin.vspx',_http_path))
+                else if (locate ('/admin.vspx', _http_path))
             curr_location:=curr_location||settings_url||'Application Administration > ';
-        if(locate('/inst_ping.vspx',_http_path))
+                else if (locate ('/inst_ping.vspx', _http_path))
             curr_location:=curr_location||settings_url||'Application Notifications > ';
-        if(locate('/ping_log.vspx',_http_path))
+                else if (locate ('/ping_log.vspx', _http_path))
             curr_location:=curr_location||settings_url||'Application Notification Log > ';
-        if(locate('/vhost.vspx',_http_path))
+                else if (locate ('/vhost.vspx', _http_path))
             curr_location:=curr_location||settings_url||'Endpoints > ';
-
-        if(locate('/tags.vspx',_http_path))
+                else if (locate ('/tags.vspx', _http_path))
             curr_location:=curr_location||settings_url||'Content Tagging Settings > ';
-        if(locate('/add_rule.vspx',_http_path))
+                else if (locate ('/add_rule.vspx', _http_path))
             curr_location:=curr_location||settings_url||'Content Tagging Settings > New Rule> ';
-        if(locate('/url_rule.vspx',_http_path))
+                else if (locate ('/url_rule.vspx', _http_path))
             curr_location:=curr_location||settings_url||'Content Hyperlinking Settings > ';
-
-        if(locate('/user_template.vspx',_http_path))
+                else if (locate ('/user_template.vspx', _http_path))
             curr_location:=curr_location||settings_url||'Home Page Template Selection > ';
-        if(locate('/uiedit.vspx',_http_path))
+                else if (locate ('/uiedit.vspx', _http_path))
             curr_location:=curr_location||settings_url||'Edit Profile > ';
-        if(locate('/security.vspx',_http_path))
+                else if (locate ('/security.vspx', _http_path))
             curr_location:=curr_location||settings_url||'Site Security > ';
-
-
-        if(locate('/search.vspx',_http_path))
+                else if (locate ('/oauth_apps.vspx', _http_path))
+                  curr_location := curr_location || settings_url || 'OAuth Keys > ';
+                else if (locate ('/semping_app.vspx', _http_path))
+                  curr_location := curr_location || settings_url || 'Semantic Pingback > ';
+                else if (locate ('/uiedit_validation.vspx', _http_path))
+                  curr_location := curr_location || settings_url || 'Validation Fields > ';
+                else if (locate ('/search.vspx', _http_path))
             curr_location:=curr_location||'Search > ';
-        if(locate('/help.vspx',_http_path))
+                else if (locate ('/help.vspx', _http_path))
             curr_location:=curr_location||'Help > ';
-
-        if(locate('/register.vspx',_http_path))
+                else if (locate ('/register.vspx', _http_path))
             curr_location:=curr_location||'Register > ';
-        if(locate('/login.vspx',_http_path))
+                else if (locate ('/login.vspx', _http_path))
             curr_location:=curr_location||'Login > ';
-
-        if(locate('/site_settings.vspx',_http_path))
+                else if (locate ('/site_settings.vspx', _http_path))
             curr_location:=curr_location||'Site Settings > ';
 
         declare site_settings_url varchar;
-        site_settings_url:='<a href="'||self.odsbar_ods_gpath||'site_settings.vspx?'||self.odsbar_loginparams||'">Site Settings</a> > ';
 
+                site_settings_url := '<a href="' || self.odsbar_ods_gpath || 'site_settings.vspx?' || self.odsbar_loginparams || '">Site Settings</a> > ';
         if(locate('/web_header.vspx',_http_path))
             curr_location:=curr_location||site_settings_url||'Web Application Configuration > ';
-
-
-
-        if(locate('/member.vspx',_http_path))
+                else if (locate ('/member.vspx', _http_path))
             curr_location:=curr_location||site_settings_url||'Member Registration > ';
-
-        if(locate('/app.vspx',_http_path))
+                else if (locate ('/app.vspx', _http_path))
             curr_location:=curr_location||site_settings_url||'Application Agreements > ';
-
-        if(locate('/map_svc.vspx',_http_path))
+                else if (locate ('/login_leys.vspx', _http_path))
+                  curr_location  :=  curr_location || site_settings_url || 'Login Authentication Keys > ';
+                else if (locate ('/map_svc.vspx', _http_path))
             curr_location:=curr_location||site_settings_url||'Mapping Services > ';
-
-        if(locate('/accounts.vspx',_http_path))
+                else if (locate ('/accounts.vspx', _http_path))
             curr_location:=curr_location||site_settings_url||'Users Administration > ';
-
-        if(locate('/mail.vspx',_http_path))
+                else if (locate ('/mail.vspx', _http_path))
             curr_location:=curr_location||site_settings_url||'Mail > ';
-
-        if(locate('/server.vspx',_http_path))
+                else if (locate ('/server.vspx', _http_path))
             curr_location:=curr_location||site_settings_url||'Server Settings > ';
-
-        if(locate('/app_menu_settings.vspx',_http_path))
+                else if (locate ('/app_menu_settings.vspx', _http_path))
             curr_location:=curr_location||site_settings_url||'Application Menu > ';
-
-        if(locate('/ping_svc.vspx',_http_path))
+                else if (locate ('/ping_svc.vspx', _http_path))
             curr_location:=curr_location||site_settings_url||'Notification Services > ';
-
-        if(locate('/rdf_storage.vspx',_http_path))
+                else if (locate ('/rdf_storage.vspx', _http_path))
             curr_location:=curr_location||site_settings_url||'RDF Data Administration > ';
-
-        if(locate('/app_instance_limits.vspx',_http_path))
+                else if (locate ('/app_instance_limits.vspx', _http_path))
             curr_location:=curr_location||site_settings_url||'Application Instances Limit > ';
-
-        if(locate('/uhome.vspx',_http_path) and length(self.odsbar_u_name)=0)
+                else if (locate ('/login_keys.vspx', _http_path))
+                  curr_location := curr_location || site_settings_url || 'Login Authentication Keys > ';
+                else if (locate ('/semping_log.vspx', _http_path))
+                  curr_location := curr_location || site_settings_url || 'Semantic Pingback Log > ';
+                else if (locate ('/uhome.vspx', _http_path) and length(self.odsbar_u_name)=0)
               curr_location:=curr_location||' '||self.odsbar_fname||' > ';
-
-
-         if(subseq(curr_location,length(curr_location)-3,length(curr_location)) = ' > ')
+                else if (subseq(curr_location,length(curr_location)-3,length(curr_location)) = ' > ')
             curr_location:=subseq(curr_location,0,length(curr_location)-3);
 
             http(curr_location);
@@ -668,11 +613,10 @@ if (typeof (OAT) == 'undefined')
 
   function applyTransparentImg(parent_elm)
     {
-
-      if (!OAT.Browser.isIE) return;
+    if (!OAT.Browser.isIE)
+      return;
 
         var img_elements = parent_elm.getElementsByTagName('IMG');
-
         for (var i=0; i < img_elements.length; i++)
           {
             var img_elm = img_elements[i];
@@ -691,8 +635,6 @@ if (typeof (OAT) == 'undefined')
                   "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+"', sizingMethod='scale')";
               }
           }
-
-        return;
     }
 
   function create_cookie (name, value, days)
@@ -703,7 +645,8 @@ if (typeof (OAT) == 'undefined')
           date.setTime (date.getTime () + (days*24*60*60*1000));
           var expires = "; expires=" + date.toGMTString ();
         }
-      else var expires = "";
+    else
+      var expires = "";
 
       document.cookie = name + "=" + value + expires + "; path=/";
     }
@@ -736,12 +679,10 @@ function ods_bar_state_set (state)
         OAT.Dom.hide('ods_bar_second_lvl');
         OAT.Dom.hide('ods_bar_toggle_min_spacer');
         OAT.Dom.show('ods_bar_top');
-//        OAT.Event.detach ($('ods_bar'),'click', ods_bar_state_toggle);
+
         create_cookie ('odsbar_state', 'half', 7);
-        return;
       }
-
-    if (state == 'full')
+    else if (state == 'full')
       {
         OAT.Dom.show('ods_bar_toggle_full');
         OAT.Dom.hide('ods_bar_toggle_min');
@@ -749,12 +690,10 @@ function ods_bar_state_set (state)
         OAT.Dom.hide('ods_bar_toggle_min_spacer');
         OAT.Dom.show('ods_bar_second_lvl');
         OAT.Dom.show('ods_bar_bot');
-//        OAT.Event.detach ($('ods_bar'),'click', ods_bar_state_toggle);
+
         create_cookie ('odsbar_state', 'full', 7);
-        return;
       }
-
-    if (state == 'min')
+    else if (state == 'min')
       {
         var dx;
 
@@ -778,12 +717,9 @@ function ods_bar_state_set (state)
         OAT.Dom.hide('ods_bar_mid');
         OAT.Dom.hide('ods_bar_r');
         OAT.Dom.hide('ods_bar_bot');
-//        OAT.Event.attach ($('ods_bar'),'click', ods_bar_state_toggle);
-        create_cookie ('odsbar_state', 'min', 7);
 
-        return;
+      create_cookie ('odsbar_state', 'min', 7);
       }
-
   }
 
   function ods_bar_state_toggle()
@@ -791,19 +727,14 @@ function ods_bar_state_set (state)
       if ($('ods_bar_toggle_min').style.display != 'none')
         {
           ods_bar_state_set('half')
-          return;
         }
-
-      if ($('ods_bar_toggle_half').style.display != 'none')
+    else if ($('ods_bar_toggle_half').style.display != 'none')
         {
           ods_bar_state_set('full')
-          return;
         }
-
-      if ($('ods_bar_toggle_full').style.display != 'none')
+    else if ($('ods_bar_toggle_full').style.display != 'none')
         {
           ods_bar_state_set('min')
-          return;
         }
     }
 
@@ -813,52 +744,40 @@ if(top.location.href!=window.location.href)
 {
     inFrame=1;
     ODSInitArray.push(function(){OAT.Dom.hide('FT');});
-}else
-{
+} else {
    create_cookie ('interface', 'vspx', 1);
 }
 
   function odsbarSafeInit()
     {
       if(inFrame)
-      {
          return;
-      }
 
-      if (typeof (OAT) != 'undefined')
+    if (OAT)
         {
           ods_bar_state_set (read_cookie ('odsbar_state'));
-
           if (userIsLogged || notLoggedShowOdsBar)
             {
               applyTransparentImg (document.getElementById ('ods_bar'));
               OAT.Dom.show('HD_ODS_BAR');
             }
-          else
-            {
-              if (notLoggedShowSignIn != 0)
+      else if (notLoggedShowSignIn != 0)
                 {
                   OAT.Dom.show('ods_bar_odslogin');
-                };
             }
         }
       else
         {
           OATWaitCount++;
-
-          if (OATWaitCount > 100)
-            return; // alert('ods_bar.xsl: OAT is taking too long to initialize - page navigation disabled.');
-          else
+      if (OATWaitCount <= 100)
             setTimeout(odsbarSafeInit, 200);
-
         }
     }
 odsbarSafeInit();
 //-->
-]]></script>
-
+        ]]>
+      </script>
  </v:template>
-
 </xsl:template>
 
 <xsl:template match="vm:odsbar_navigation_level1">
@@ -955,11 +874,10 @@ if(coalesce(self.odsbar_app_type,get_keyword ('app_type', self.odsbar_inout_arr)
                         );
 
       declare arr_url any;
-      arr_url := vector ('_nntpf', rtrim (self.odsbar_ods_gpath,'/ods/') || '/dataspace/discussion'
-                           --packagename, fullurl - uses even url of type key1,key1value,
-                           --                                             key2,key2value
-                          );
-      if (length (self.sid) = 0) arr := arr_notlogged;
+
+        arr_url := vector ('_nntpf', rtrim (self.odsbar_ods_gpath,'/ods/') || '/dataspace/discussion');
+        if (length (self.sid) = 0)
+          arr := arr_notlogged;
       arr := ODS.WA.wa_order_vector (arr);
 
       foreach (any app in arr) do
@@ -972,16 +890,13 @@ if(coalesce(self.odsbar_app_type,get_keyword ('app_type', self.odsbar_inout_arr)
                 {
                   apptype_showtab := 1;
                 };
-
               select WAT_MAXINST into apptype_showtab from WA_TYPES where WAT_NAME=app[0] ;
-
-              if (apptype_showtab is null) apptype_showtab := 1;
+            if (apptype_showtab is null)
+              apptype_showtab := 1;
 
               if (apptype_showtab <> 0)
                 {
-
                  declare url_value varchar;
-                 url_value:='';
 
                  if (get_keyword(app[0],arr_url) is not null)
                    {
@@ -1003,10 +918,9 @@ if(coalesce(self.odsbar_app_type,get_keyword ('app_type', self.odsbar_inout_arr)
                                            app[2]
                                            );
                    }
-
                  declare url_class varchar;
-                 url_class:='';
 
+              url_class := '';
                  if (self.odsbar_app_type = app[0] and
                      get_keyword ('app_type', self.odsbar_inout_arr) is null)
                    {
@@ -1033,8 +947,8 @@ if(coalesce(self.odsbar_app_type,get_keyword ('app_type', self.odsbar_inout_arr)
     }
 
     declare arr_custom_app any;
-    arr_custom_app:=wa_get_custom_app_options();
 
+      arr_custom_app := wa_get_custom_app_options();
     foreach (any custom_app in arr_custom_app) do
     {
       declare _name, _url varchar;
@@ -1071,22 +985,17 @@ if(coalesce(self.odsbar_app_type,get_keyword ('app_type', self.odsbar_inout_arr)
     <?vsp
       {
       declare arr,arr_notlogged any;
-      arr := vector (
-                     vector ('Tags',self.odsbar_ods_gpath||'gtags.vspx')
-                    );
-      arr_notlogged := vector (
-                                vector ('Tags',self.odsbar_ods_gpath||'gtags.vspx')
-                               );
+        arr := vector (vector ('Tags', self.odsbar_ods_gpath || 'gtags.vspx'));
+        arr_notlogged := vector (vector ('Tags',self.odsbar_ods_gpath||'gtags.vspx'));
 
-      if (length(self.sid)=0) arr :=arr_notlogged;
+        if (length(self.sid) = 0)
+          arr := arr_notlogged;
 
       foreach (any menu_link in arr) do
         {
           declare url_value,class_value varchar;
-          url_value:='';
-          class_value:='';
-
 
+          class_value:='';
           url_value:=menu_link[1];
           if(locate(url_value,rtrim(self.odsbar_ods_gpath,'/ods/')||http_path ()))
           class_value:='sel';
@@ -1111,7 +1020,7 @@ if(coalesce(self.odsbar_app_type,get_keyword ('app_type', self.odsbar_inout_arr)
 <xsl:template match="vm:odsbar_navigation_level2">
         <ul id="ods_bar_second_lvl">
           <vm:odsbar_instances_menu/>
-          <li></li>
+      <li> </li>
         </ul>
 </xsl:template>
 
@@ -1131,28 +1040,30 @@ if ((self.odsbar_app_type is NULL) and locate('myhome.vspx',http_path ()))
       <li><v:url name="odsbar_myfacebook_link" url="--self.odsbar_ods_gpath||'fb_front.vspx?'" render-only="1" value="My Facebook" is-local="1"/></li>
 <?vsp
       }
-}else if ( ((self.odsbar_app_type is not NULL) and (locate('app_inst.vspx',http_path ()) or locate('app_my_inst.vspx',http_path ())))
+      }
+      else if (((self.odsbar_app_type is not NULL) and (locate ('app_inst.vspx', http_path ()) or locate ('app_my_inst.vspx', http_path ())))
             or
             get_keyword('app_type',self.odsbar_inout_arr) is not null and length(get_keyword('app_type',self.odsbar_inout_arr))>0
          )
 {
-            if(self.odsbar_app_type is NULL and get_keyword('app_type',self.odsbar_inout_arr) is not NULL) self.odsbar_app_type:=get_keyword('app_type',self.odsbar_inout_arr);
+        if (self.odsbar_app_type is NULL and get_keyword('app_type',self.odsbar_inout_arr) is not NULL)
+          self.odsbar_app_type := get_keyword('app_type',self.odsbar_inout_arr);
 
 ?>
        <vm:if test=" self.odsbar_app_type='nntpf' ">
        <li>
-       <v:url name="gotodiscussion" url="--rtrim (self.odsbar_ods_gpath,'/ods/') || '/dataspace/discussion'"
+        <v:url name="gotodiscussion"
+               url="--rtrim (self.odsbar_ods_gpath,'/ods/') || '/dataspace/discussion'"
           value="--WA_GET_MFORM_APP_NAME(self.odsbar_app_type)"
           render-only="1"
           is-local="1"
        />
        </li>
        </vm:if>
-
-
        <vm:if test=" (length(self.sid) > 0) AND self.odsbar_app_type<>'oMail' AND self.odsbar_app_type<>'nntpf' AND self.odsbar_app_type<>'discussion' AND self.odsbar_app_type<>'IM'">
        <li>
-       <v:url name="slice_all" url="--sprintf ('%sall/%s',self.odsbar_dataspace_path, self.odsbar_app_dataspace)"
+        <v:url name="slice_all"
+               url="--sprintf ('%sall/%s',self.odsbar_dataspace_path, self.odsbar_app_dataspace)"
           value="--'All '||WA_GET_MFORM_APP_NAME(self.odsbar_app_type)"
           render-only="1"
           is-local="1"
@@ -1168,8 +1079,8 @@ if ((self.odsbar_app_type is NULL) and locate('myhome.vspx',http_path ()))
             apptype_instnum:=0;
         };
         select WAT_MAXINST into apptype_instnum from WA_TYPES where WAT_NAME=self.odsbar_app_type ;
-
-        if( apptype_instnum is null) apptype_instnum:=999999;
+      if( apptype_instnum is null)
+        apptype_instnum := 999999;
 
         declare i int;
         declare q_str any;
@@ -1181,26 +1092,26 @@ if ((self.odsbar_app_type is NULL) and locate('myhome.vspx',http_path ()))
            q_str:=sprintf('select distinct top 10  WAM_INST as INST_NAME,WAM_HOME_PAGE as INST_URL, U_NAME '||
                           ' from WA_MEMBER, WA_INSTANCE, SYS_USERS '||
                           ' where WA_MEMBER.WAM_INST=WA_INSTANCE.WAI_NAME and WA_MEMBER.WAM_USER=SYS_USERS.U_ID and U_NAME=''%s'' and WAI_IS_PUBLIC=1 and WAM_APP_TYPE = ''%s'' ',self.odsbar_fname,self.odsbar_app_type);
-        }else if(length(self.odsbar_u_name)>0)
+      }
+      else if(length(self.odsbar_u_name) > 0)
         {
            q_str:=sprintf('select distinct top 10  WAM_INST as INST_NAME,WAM_HOME_PAGE as INST_URL, U_NAME'||
                           ' from WA_MEMBER, WA_INSTANCE, SYS_USERS  '||
                           ' where WA_MEMBER.WAM_INST=WA_INSTANCE.WAI_NAME and WA_MEMBER.WAM_USER=SYS_USERS.U_ID and WAM_USER=''%d'' and WAM_APP_TYPE = ''%s'' ',self.odsbar_u_id,self.odsbar_app_type);
-        }else
+      }
+      else
         {
         q_str:=sprintf('select distinct top 10  WAM_INST as INST_NAME,WAM_HOME_PAGE as INST_URL, U_NAME'||
                        ' from WA_MEMBER, WA_INSTANCE, SYS_USERS  '||
                        ' where WA_MEMBER.WAM_INST=WA_INSTANCE.WAI_NAME and WA_MEMBER.WAM_USER=SYS_USERS.U_ID and WAI_IS_PUBLIC=1 and WAM_APP_TYPE = ''%s'' ',self.odsbar_app_type);
         }
-
-
         declare INST_URL,INST_NAME,INST_OWNER varchar;
-
         declare state, msg, descs, rows any;
+
         state := '00000';
         exec (q_str, state, msg, vector (), 10, descs, rows);
-
-        if (state <> '00000') signal (state, msg);
+      if (state <> '00000')
+        signal (state, msg);
 
         while (i < length(rows) and i<4)
         {
@@ -1208,11 +1119,7 @@ if ((self.odsbar_app_type is NULL) and locate('myhome.vspx',http_path ()))
           INST_URL:=coalesce(rows[i][1],'javascript:void(0)');
           INST_NAME:=coalesce(rows[i][0],'');
           INST_OWNER:=coalesce(rows[i][2],'');
-
 ?>
-<!--
-      <li><a href="<?V (case when locate('http://',INST_URL) then '' else rtrim(self.odsbar_ods_gpath,'/ods/') end)||wa_expand_url (INST_URL, self.odsbar_loginparams) ?>"><?V wa_utf8_to_wide (INST_NAME) ?></a></li>
--->
       <li><a href="<?vsp http(wa_expand_url (sprintf('%s%V/%s/%s',self.odsbar_dataspace_path,INST_OWNER,self.odsbar_app_dataspace,replace(sprintf('%U',wa_utf8_to_wide (INST_NAME)),'/','%2f')),self.odsbar_loginparams)); ?>"><?V wa_utf8_to_wide (INST_NAME) ?></a></li>
 <?vsp
           i := i + 1;
@@ -1243,12 +1150,12 @@ if ((self.odsbar_app_type is NULL) and locate('myhome.vspx',http_path ()))
 
 <xsl:template match="vm:if">
     <xsl:processing-instruction name="vsp">
-	if (<xsl:value-of select="@test"/>) {
+  	  if (<xsl:value-of select="@test"/>)
+  	  {
     </xsl:processing-instruction>
     <xsl:apply-templates />
-  <xsl:processing-instruction name="vsp"> } </xsl:processing-instruction>
+    <xsl:processing-instruction name="vsp">
+      }
+    </xsl:processing-instruction>
 </xsl:template>
-
-
-
 </xsl:stylesheet>
diff --git a/appsrc/ODS-Framework/comp/page.xsl b/appsrc/ODS-Framework/comp/page.xsl
index d45db75..3044d71 100644
--- a/appsrc/ODS-Framework/comp/page.xsl
+++ b/appsrc/ODS-Framework/comp/page.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: page.xsl,v 1.34.2.10 2010/06/09 13:45:51 source Exp $
+ -  $Id: page.xsl,v 1.34.2.17 2011/01/25 14:11:29 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -294,7 +294,11 @@
     <xsl:if test="@vm_onunload">
       <xsl:attribute name="onunload"><xsl:value-of select="@vm_onunload" /></xsl:attribute>
     </xsl:if>
-    <![CDATA[<script type="text/javascript" src="common.js"></script>]]>
+    <![CDATA[
+      <script type="text/javascript" src="oat/loader.js"></script>
+      <script type="text/javascript" src="common.js"></script>
+      <script type="text/javascript" src="validate.js"></script>
+    ]]>
     <v:form name="page_form"
             type="simple"
             method="POST"
@@ -391,7 +395,10 @@
   <xsl:if test="@vm_onunload">
    <xsl:attribute name="onunload"><xsl:value-of select="@vm_onunload" /></xsl:attribute>
   </xsl:if>
-  <![CDATA[<script type="text/javascript" src="common.js"></script>]]>
+  <![CDATA[
+    <script type="text/javascript" src="common.js"></script>
+    <script type="text/javascript" src="validate.js"></script>
+  ]]>
   <v:form name="page_form" type="simple" method="POST" xhtml_enctype="multipart/form-data" xhtml_onsubmit="sflag=true;">
   <!-- user-defined area -->
   <xsl:apply-templates />
@@ -1485,9 +1492,21 @@ if (i > 0)
       </td>
     </tr>
     <tr>
+      <th>Allow Twitter Login/Registration</th>
+      <td>
+        <v:check-box name="ssetc6" value="1" initial-checked="--(select top 1 WS_REGISTER_TWITTER from WA_SETTINGS)" />
+      </td>
+    </tr>
+    <tr>
+      <th>Allow LinkedIn Login/Registration</th>
+      <td>
+        <v:check-box name="ssetc7" value="1" initial-checked="--(select top 1 WS_REGISTER_LINKEDIN from WA_SETTINGS)" />
+      </td>
+    </tr>
+    <tr>
       <th>Verify registration by email</th>
       <td>
-        <v:check-box name="ssetc6" value="1" initial-checked="--(select top 1 WS_MAIL_VERIFY from WA_SETTINGS)" />
+        <v:check-box name="ssetc8" value="1" initial-checked="--(select top 1 WS_MAIL_VERIFY from WA_SETTINGS)" />
       </td>
     </tr>
     <tr>
@@ -1520,7 +1539,7 @@ if (i > 0)
     <tr>
       <th>Verify registration with <?V case when self.im_enabled then 'image' else 'formula' end ?></th>
       <td>
-        <v:check-box name="ssetc7" value="1" initial-checked="--(select top 1 WS_VERIFY_TIP from WA_SETTINGS)" />
+        <v:check-box name="ssetc9" value="1" initial-checked="--(select top 1 WS_VERIFY_TIP from WA_SETTINGS)" />
       </td>
     </tr>
     <tr>
@@ -1617,15 +1636,17 @@ if (i > 0)
                        WS_REGISTER_FACEBOOK = self.ssetc3.ufl_selected,
                        WS_REGISTER_SSL = self.ssetc4.ufl_selected,
                        WS_REGISTER_AUTOMATIC_SSL = self.ssetc5.ufl_selected,
-                       WS_MAIL_VERIFY = self.ssetc6.ufl_selected,
+                       WS_REGISTER_TWITTER = self.ssetc6.ufl_selected,
+                       WS_REGISTER_LINKEDIN = self.ssetc7.ufl_selected,
+                       WS_MAIL_VERIFY = self.ssetc8.ufl_selected,
                   WS_UNIQUE_MAIL = self.unique_mail.ufl_selected,
-                       WS_VERIFY_TIP = self.ssetc7.ufl_selected,
+                       WS_VERIFY_TIP = self.ssetc9.ufl_selected,
                   WS_REGISTRATION_EMAIL_EXPIRY = _reg,
                   WS_JOIN_EXPIRY = _join;
                 if (row_count() = 0)
                 {
-                  insert into WA_SETTINGS (WS_REGISTER, WS_REGISTER_OPENID, WS_REGISTER_FACEBOOK, WS_REGISTER_SSL, WS_REGISTER_AUTOMATIC_SSL, WS_MAIL_VERIFY, WS_REGISTRATION_EMAIL_EXPIRY, WS_JOIN_EXPIRY, WS_VERIFY_TIP)
-  	                values (self.ssetc1.ufl_selected, self.ssetc2.ufl_selected, self.ssetc3.ufl_selected, self.ssetc4.ufl_selected, self.ssetc5.ufl_selected, self.ssetc6.ufl_selected, self.t_reg_expiry.ufl_value, self.t_join_expiry.ufl_value, self.ssetc7.ufl_selected);
+                  insert into WA_SETTINGS (WS_REGISTER, WS_REGISTER_OPENID, WS_REGISTER_FACEBOOK, WS_REGISTER_SSL, WS_REGISTER_AUTOMATIC_SSL, WS_REGISTER_TWITTER, WS_REGISTER_LINKEDIN, WS_MAIL_VERIFY, WS_REGISTRATION_EMAIL_EXPIRY, WS_JOIN_EXPIRY, WS_VERIFY_TIP)
+  	                values (self.ssetc1.ufl_selected, self.ssetc2.ufl_selected, self.ssetc3.ufl_selected, self.ssetc4.ufl_selected, self.ssetc5.ufl_selected, self.ssetc6.ufl_selected, self.ssetc7.ufl_selected, self.ssetc8.ufl_selected, self.t_reg_expiry.ufl_value, self.t_join_expiry.ufl_value, self.ssetc9.ufl_selected);
                 }
               ]]>
           </v:on-post>
@@ -2138,6 +2159,38 @@ if (i > 0)
           </v:button>
     </fieldset>
   </v:form>
+  <v:form type="simple" name="fkg" method="POST">
+    <fieldset>
+			<legend><b>X.509 Certificate Service</b></legend>
+      <label>
+        Service URL
+      </label>
+      <br />
+              <v:text name="s_kg" xhtml_class="textbox" xhtml_size="100" value="">
+                <v:before-data-bind>
+                  control.ufl_value := cast (coalesce ((select top 1 WS_CERT_GEN_URL from WA_SETTINGS), '') as varchar);
+                </v:before-data-bind>
+              </v:text>
+      <br />
+      <v:button name="bt_kg" action="simple" value="Set">
+        <v:on-post>
+          <v:script>
+            <![CDATA[
+              if (not wa_user_is_dba (self.u_name, self.u_group))
+              {
+                self.vc_is_valid := 0;
+                control.vc_parent.vc_error_message := 'Only admin user can change global settings';
+                return;
+              }
+              update WA_SETTINGS set WS_CERT_GEN_URL = self.s_kg.ufl_value;
+              if (row_count() = 0)
+                insert into WA_SETTINGS (WS_CERT_GEN_URL) values (self.s_kg.ufl_value);
+            ]]>
+          </v:script>
+        </v:on-post>
+      </v:button>
+    </fieldset>
+  </v:form>
   <v:template type="simple" enabled="--case when isnull (VAD_CHECK_VERSION ('Feed Manager')) then 0 else 1 end">
   <v:form type="simple" name="form2" method="POST">
       <fieldset>
@@ -3036,7 +3089,7 @@ if (i > 0)
 <xsl:template match="vm:u-prop-select">
   <v:select-list name="{@name}">
     <v:item name="public"  value="1" />
-    <v:item name="friends" value="2" />
+    <v:item name="acl" value="2" />
     <v:item name="private" value="3" />
     <v:before-data-bind>
       control.ufl_value := <xsl:value-of select="@value"/>;
diff --git a/appsrc/ODS-Framework/comp/register.xsl b/appsrc/ODS-Framework/comp/register.xsl
index ad32b58..ac6b91a 100644
--- a/appsrc/ODS-Framework/comp/register.xsl
+++ b/appsrc/ODS-Framework/comp/register.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: register.xsl,v 1.31.2.9 2010/07/05 08:26:09 source Exp $
+ -  $Id: register.xsl,v 1.31.2.18 2011/02/16 20:56:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -26,341 +26,32 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
     xmlns:v="http://www.openlinksw.com/vspx/"
     xmlns:vm="http://www.openlinksw.com/vspx/ods/">
+
   <xsl:template match="vm:register-form">
-    <v:method name="decodeName" arglist="in S varchar">
       <![CDATA[
-        declare N Integer;
-        declare V, retValue any;
-
-        retValue := vector ();
-        V := split_and_decode (S, 0, '\0\0/');
-        for (N := 0; N < length (V); N := N + 1)
-          retValue := vector_concat (retValue, split_and_decode (V[N], 0, '\0\0='));
-
-        return retValue;
+      <script type="text/javascript" src="/ods/register.js"></script>
+      <script type="text/javascript">
+        ODSInitArray.push(function(){OAT.Loader.load(["ajax", "tab"], function(){rfInit()});});
+    </script>
       ]]>
-    </v:method>
-
-    <v:method name="getValue" arglist="in cName varchar, in pName varchar, in V any, in V2 any">
+    <v:before-render>
       <![CDATA[
-        declare retValue any;
-
-        retValue := get_keyword (cName, V);
-        if (isnull (retValue))
-        {
-          retValue := get_keyword (cName, V2);
-          if (isnull (retValue))
-            retValue := get_keyword (cName, self.vc_page.vc_event.ve_params);
-        }
-        return retValue;
-      ]]>
-    </v:method>
-
-    <v:method name="makeRegistration" arglist="">
-      <![CDATA[
-        declare data, params any;
+        declare params any;
 
         params := self.vc_page.vc_event.ve_params;
-        data := vector ();
-        if ((self.uoid in (0, 2, 3)) or (self.oid_mode = 'id_res' and self.oid_sig is not null and self.uoid))
-        {
-          declare u_name1, u_mail1, u_password1, u_password2, dom_reg varchar;
-          declare tmp, country, city, lat, lng, xt, xp any;
-
-          declare exit handler for sqlstate '*'
+        if (length (self.sid))
           {
-            self.vc_error_message := concat (__SQL_STATE,' ',__SQL_MESSAGE);
-            self.vc_is_valid := 0;
-            rollback work;
-            return;
-          };
+          declare delim, u_name varchar;
 
-          if (self.uoid = 2)
+          if (length (self.ods_returl)) -- URL given by GET
      {
-            data := self.reg_foafData;
-            u_name1 := get_keyword ('webid_uid', params);
-            if (isnull (u_name1))
-         {
-              u_name1 := DB.DBA.WA_MAKE_NICK (coalesce (get_keyword ('nick', data), replace (get_keyword ('name', data), ' ', '')));
-            }
-            u_mail1 := get_keyword ('webid_mbox', params);
-            if (isnull (u_mail1))
-       {
-              u_mail1 := get_keyword ('mbox', data);
-              if (isnull (u_mail1))
-              {
-                tmp := self.decodeName(get_certificate_info (2));
-                u_mail1 := get_keyword ('emailAddress', tmp);
-       }
-         }
-            u_password1 := uuid ();
-            u_password2 := u_password1;
-          }
-          else if (self.uoid = 3)
-        {
-            data := ODS.ODS_API."user.getFacebookData"(fb=>self.fb, fields=>'uid,name,first_name,last_name,sex,birthday', outputMode=>0);
-            u_name1 := DB.DBA.WA_MAKE_NICK (coalesce (get_keyword ('nick', data), replace (get_keyword ('name', data), ' ', '')));
-            u_mail1 := null;
-            u_password1 := uuid ();
-            u_password2 := u_password1;
-          }
-      else
-          {
-            u_name1 := trim (self.reguid.ufl_value);
-            u_mail1 := trim (self.regmail.ufl_value);
-            u_password1 := trim (self.regpwd.ufl_value);
-            u_password2 := trim (self.regpwd1.ufl_value);
-          }
-
-          dom_reg := (select WD_MODEL from WA_DOMAINS where WD_HOST = http_map_get ('vhost') and WD_LISTEN_HOST = http_map_get ('lhost') and WD_LPATH = http_map_get ('domain'));
-          if (((dom_reg is not null) and (dom_reg = 0)) or (not exists (select 1 from WA_SETTINGS where WS_REGISTER = 1)))
-          {
-            self.vc_error_message := 'Registration is not allowed';
-            self.vc_is_valid := 0;
-            return;
-        }
-          if (u_name1 is null or length (u_name1) < 1 or length (u_name1) > 20)
-          {
-            self.vc_error_message := 'Login name cannot be empty or longer then 20 chars';
-            self.vc_is_valid := 0;
-            return;
-    }
-          if (regexp_match ('^[A-Za-z0-9_. at -]+$', u_name1) is null)
-      {
-            self.vc_error_message := 'The login name contains invalid characters';
-        self.vc_is_valid := 0;
-            return;
-      }
-          if (exists (select 1 from DB.DBA.SYS_USERS where U_NAME = u_name1))
-    {
-            self.vc_error_message := 'Login name already in use';
-            self.vc_is_valid := 0;
-            return;
-          }
-          if (self.uoid <> 3)
-        {
-            if (u_mail1 is null or length (u_mail1) < 1 or length (u_mail1) > 40)
-            {
-              self.vc_error_message := 'E-mail address cannot be empty or longer then 40 chars';
-              self.vc_is_valid := 0;
-              return;
-        }
-            if (regexp_match ('[^@ ]+@([^\. ]+\.)+[^\. ]+', u_mail1) is null)
-        {
-              self.vc_error_message := 'Invalid E-mail address';
-              self.vc_is_valid := 0;
-              return;
-            }
-          }
-          if (exists (select 1 from SYS_USERS where U_E_MAIL = u_mail1) and exists (select 1 from WA_SETTINGS where WS_UNIQUE_MAIL = 1))
-          {
-            if (length (self.ods_returnurl) and self.ods_returnurl = 'index.html')
-              self.vc_redirect (sprintf ('index.html#msg=%U', 'This e-mail address is already registered.'));
-            self.vc_error_message := 'This e-mail address is already registered.';
-            self.vc_is_valid := 0;
-            return;
-          }
-          if (u_password1 is null or length (u_password1) < 1 or length (u_password1) > 40)
-          {
-            self.vc_error_message := 'Password cannot be empty or longer then 40 chars';
-            self.vc_is_valid := 0;
-            return;
-          }
-          if (u_password1 <> u_password2)
-          {
-            self.vc_error_message := 'Password verification does not match';
-            self.vc_is_valid := 0;
-            return;
-          }
-          if (not (self.is_agreed.ufl_selected))
-          {
-            self.vc_error_message := 'You have not agreed to the Terms of Service.';
-            self.vc_is_valid := 0;
-            return;
-          }
-          if (self.uoid = 1 and not self.vc_is_valid and not self.reguid.ufl_failed)
-          {
-            self.vc_is_valid := 1;
-            self.regpwd.ufl_failed := 0;
-            self.regpwd1.ufl_failed := 0;
-          }
-
-          declare uid integer;
-          declare sid any;
-          -- check if this login already exists
-          if ((self.uoid = 1) and self.oid_sig is not null and exists (select 1 from WA_USER_INFO where WAUI_OPENID_URL = self.oid_identity))
-          {
-            self.vc_error_message := 'This OpenID identity is already registered.';
-            self.vc_is_valid := 0;
-            return;
-          }
-          if ((self.uoid = 3) and exists (select 1 from WA_USER_INFO where WAUI_FACEBOOK_LOGIN_ID = self.fb._user))
-          {
-            self.vc_error_message := 'This Facebook identity is already registered.';
-            self.vc_is_valid := 0;
-            return;
-          }
-
-          -- determine if mail verification is necessary
-          declare _mail_verify_on any;
-
-          uid := USER_CREATE (u_name1,
-                              u_password1,
-                              vector ('E-MAIL', u_mail1,
-                                      'HOME', '/DAV/home/' || u_name1 || '/',
-                                      'DAV_ENABLE' , 1,
-                                      'SQL_ENABLE', 0));
-          -- create user initially disabled
-          _mail_verify_on := coalesce((select 1 from WA_SETTINGS where WS_MAIL_VERIFY = 1), 0);
-          update SYS_USERS set U_ACCOUNT_DISABLED = _mail_verify_on where U_ID = uid;
-          DAV_HOME_DIR_CREATE (u_name1);
-          WA_USER_SET_INFO (u_name1, '', '');
-          WA_USER_TEXT_SET (uid, u_name1||' '||u_mail1);
-          wa_reg_register (uid, u_name1);
-
-          declare _det_col_id int;
-          _det_col_id := DB.DBA.DAV_MAKE_DIR ('/DAV/home/'||u_name1||'/RDFData/', uid, null, '110100100N');
-          update WS.WS.SYS_DAV_COL set COL_DET = 'RDFData' where COL_ID = _det_col_id;
-
-          if (self.oid_sig is not null)
-          {
-            if (length (self.oid_dob))
-            {
-              declare tmp_date datetime;
-              tmp_date := null;
-              {
-                declare exit handler for sqlstate '*'
-                {
-                  goto no_date;
-                };
-                tmp_date := stringdate(self.oid_dob);
-         }
-              if (tmp_date is not null)
-                WA_USER_EDIT (u_name1, 'WAUI_BIRTHDAY', tmp_date);
-         }
-no_date:
-         if (length (self.oid_fullname))
-         WA_USER_EDIT (u_name1, 'WAUI_FULL_NAME', self.oid_fullname);
-       if (length (self.oid_gender))
-         WA_USER_EDIT (u_name1, 'WAUI_GENDER', case self.oid_gender when 'M' then 'male' when 'F' then 'female' else NULL end);
-              if (length (self.oid_postcode))
-         WA_USER_EDIT (u_name1, 'WAUI_HCODE', self.oid_postcode);
-              if (length (self.oid_country))
-         WA_USER_EDIT (u_name1, 'WAUI_HCOUNTRY', (select WC_NAME from WA_COUNTRY where WC_ISO_CODE = upper (self.oid_country)));
-              if (length (self.oid_tz))
-         WA_USER_EDIT (u_name1, 'WAUI_HTZONE', self.oid_tz);
-                if (self.uoid = 1)
-          {
-            update WA_USER_INFO set WAUI_OPENID_URL = self.oid_identity, WAUI_OPENID_SERVER = self.oid_srv where WAUI_U_ID = uid;
-     }
-             } else {
-     declare coords any;
-
-               lat := null;
-               lng := null;
-                if (self.uoid = 2)
-               {
-                  WA_USER_EDIT (u_name1, 'WAUI_TITLE'        , get_keyword ('title', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_FULL_NAME'    , get_keyword ('name', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_FIRST_NAME'   , get_keyword ('firstName', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_LAST_NAME'    , get_keyword ('family_name', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_BIRTHDAY'     , get_keyword ('birthday', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_GENDER'       , get_keyword ('gender', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_ICQ'          , get_keyword ('icqChatID', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_MSN'          , get_keyword ('msnChatID', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_AIM'          , get_keyword ('aimChatID', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_YAHOO'        , get_keyword ('yahooChatID', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_BORG_HOMEPAGE', get_keyword ('workplaceHomepage', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_WEBPAGE'      , get_keyword ('homepage', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_HPHONE'       , get_keyword ('phone', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_BORG_HOMEPAGE', get_keyword ('organizationHomepage', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_BORG'         , get_keyword ('organizationTitle', data));
-              WA_USER_EDIT (u_name1, 'WAUI_FOAF'         , get_keyword ('iri', data));
-
-	      --see below
-              --WA_USER_EDIT (u_name1, 'WAUI_CERT'         , client_attr ('client_certificate'));
-	      --WA_USER_EDIT (u_name1, 'WAUI_CERT_LOGIN'   , 1);
-              declare cert any;
-	      cert := client_attr ('client_certificate');
-	      insert into DB.DBA.WA_USER_CERTS (UC_U_ID, UC_CERT, UC_FINGERPRINT, UC_LOGIN) 
-	      	values (uid, cert, get_certificate_info (6, cert, 0, ''), 1);
-
-                  lat := get_keyword ('lat', data);
-                  lng := get_keyword ('lng', data);
-                }
-                if (self.uoid = 3)
-                {
-                  WA_USER_EDIT (u_name1, 'WAUI_FULL_NAME'    , get_keyword ('name', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_FIRST_NAME'   , get_keyword ('firstName', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_LAST_NAME'    , get_keyword ('family_name', data));
-                  -- WA_USER_EDIT (u_name1, 'WAUI_BIRTHDAY'     , get_keyword ('birthday', data));
-                  WA_USER_EDIT (u_name1, 'WAUI_GENDER'       , get_keyword ('gender', data));
-
-                  -- facebook
-                  WA_USER_EDIT (u_name1, 'WAUI_FACEBOOK_LOGIN_ID', self.fb._user);
-               }
-     declare exit handler for sqlstate '*';
-
-            xt := http_client (sprintf ('http://api.hostip.info/?ip=%s', http_client_ip ()));
-            xt := xtree_doc (xt);
-            country := cast (xpath_eval ('string (//countryName)', xt) as varchar);
-            city := cast (xpath_eval ('string (//Hostip/name)', xt) as varchar);
-            coords := cast (xpath_eval ('string(//ipLocation//coordinates)', xt) as varchar);
-            if (country is not null and length (country) > 2)
-            {
-              country := (select WC_NAME from WA_COUNTRY where upper (WC_NAME) = country);
-              if (country is not null)
-              {
-                declare exit handler for not found;
-
-                select WC_LAT, WC_LNG into lat, lng from WA_COUNTRY where WC_NAME = country;
-                if (country is not null)
-                  WA_USER_EDIT (u_name1, 'WAUI_HCOUNTRY', country);
-              }
-            } else {
-              country := null;
-            }
-            if ((coords is not null) and (lat is null) and (lng is null))
-            {
-              coords := split_and_decode (coords, 0, '\0\0\,');
-              if (length (coords) = 2)
-              {
-                lat := atof (coords [0]);
-                lng := atof (coords [1]);
-              }
-            }
-            WA_USER_EDIT (u_name1, 'WAUI_HCITY', city);
-            if (lat is not null and lng is not null)
-            {
-              WA_USER_EDIT (u_name1, 'WAUI_LAT', lat);
-              WA_USER_EDIT (u_name1, 'WAUI_LNG', lng);
-              WA_USER_EDIT (u_name1, 'WAUI_LATLNG_HBDEF', 0);
-            }
-          }
-          insert soft sn_person (sne_name, sne_org_id) values (u_name1, uid);
-
-          if ((self.wa_nameR) is not null)
-            sid := md5 (concat (datestring (now ()), http_client_ip (), wa_link(), '/register.vspx'));
-          else
-            sid := md5 (concat (datestring (now ()), http_client_ip (), http_path ()));
-          -- create session
-          declare _expire any;
-          _expire := coalesce((select top 1 WS_REGISTRATION_EMAIL_EXPIRY from WA_SETTINGS), 1);
-          if(_mail_verify_on = 0)
-            _expire := 1;
-          insert into VSPX_SESSION (VS_REALM, VS_SID, VS_UID, VS_STATE, VS_EXPIRY)
-            values ('wa', sid, u_name1,
-          serialize (vector ('vspx_user', u_name1)), dateadd ('hour', _expire, now()));
-
-          if (length (self.ods_returnurl)) -- URL given by GET
-          {
-            self.ret_page := self.ods_returnurl;
+            self.ret_page := self.ods_returl;
           }
           else if (get_keyword_ucase ('ret', params, '') <> '')
           {
             self.ret_page := get_keyword_ucase ('ret', params);
           }
-          else if (self.wa_nameR is not null)
+          else if (self.wa_name_ret is not null)
           {
             self.ret_page := 'new_inst.vspx';
             if (self.topmenu_level='1')
@@ -374,64 +65,6 @@ no_date:
           {
             self.ret_page := 'uhome.vspx';
           }
-          if (_mail_verify_on)
-          {
-            -- determine existing default mail server
-            declare _smtp_server any;
-            if ((select max(WS_USE_DEFAULT_SMTP) from WA_SETTINGS) = 1)
-              _smtp_server := cfg_item_value(virtuoso_ini_path(), 'HTTPServer', 'DefaultMailServer');
-            else
-              _smtp_server := (select max(WS_SMTP) from WA_SETTINGS);
-            if (_smtp_server = 0)
-            {
-              self.vc_error_message := 'Default Mail Server is not defined. Mail verification impossible.';
-              self.vc_is_valid := 0;
-              rollback work;
-              return 0;
-            }
-            declare msg, aadr, body, body1 varchar;
-            body := WA_GET_EMAIL_TEMPLATE('WS_REG_TEMPLATE');
-            body1 := WA_MAIL_TEMPLATES(body, null, u_name1, sprintf('%s/conf.vspx?sid=%s&realm=wa&URL=%U', WA_LINK(1), sid, self.url));
-            msg := 'Subject: Account registration confirmation\r\nContent-Type: text/plain\r\n';
-            msg := msg || body1;
-            aadr := (select U_E_MAIL from SYS_USERS where U_ID = http_dav_uid ());
-            {
-              declare exit handler for sqlstate '*'
-              {
-                self.vc_is_valid := 0;
-                declare _use_sys_errors, _sys_error, _error any;
-                _sys_error := concat (__SQL_STATE,' ',__SQL_MESSAGE);
-                _error := 'The system is unable to complete the process due to email delivery services being disabled.'||
-                          'Please contact data space <a href="mailto:'||
-                          coalesce((select U_E_MAIL from DB.DBA.SYS_USERS where U_NAME='dav'),'')||
-                          '">administrator</a> about this problem.';
-
-                _use_sys_errors := (select top 1 WS_SHOW_SYSTEM_ERRORS from WA_SETTINGS);
-                if(_use_sys_errors)
-                {
-                  self.vc_error_message := _error || ' ' || _sys_error;
-                }
-                else
-                {
-                  self.vc_error_message := _error;
-                }
-                rollback work;
-                if (length(self.ods_returnurl) and self.ods_returnurl='index.html')
-                  self.vc_redirect (sprintf('index.html#msg=%U',_error));
-
-                return;
-              };
-              smtp_send(_smtp_server, aadr, self.regmail.ufl_value, msg);
-            }
-            self.regl1.ufl_value := 'Thank you for registering. You will receive an email soon with a link to activate your account, please follow the instructions to complete the registration.';
-            self.registration.vc_enabled := 0;
-          }
-          else
-          {
-            if (self.managed_by_admin = 0)
-            {
-              declare delim varchar;
-
               delim := '?';
               if (strchr (self.ret_page, '?') is not null)
                 delim := '&';
@@ -439,520 +72,166 @@ no_date:
               http_rewrite ();
               http_request_status ('HTTP/1.1 302 Found');
               if (get_keyword_ucase ('ret', params, '') <> '' )
-                http_header (sprintf ('Location: %s%ssid=%s&realm=wa\r\n', self.ret_page, delim, sid));
-              else if (self.wa_nameR is not null)
-                http_header (sprintf ('Location: %s%ssid=%s&realm=wa&wa_name=%s\r\n', self.ret_page, delim, sid, self.wa_nameR));
-              else
-                http_header (sprintf ('Location: %s%ssid=%s&realm=wa&ufname=%s\r\n', self.ret_page, delim, sid, u_name1));
-              if (strstr (http_header_get (), 'Set-Cookie: sid=') is null)
-                http_header (http_header_get () || sprintf ('Set-Cookie: sid=%s; path=/\r\n', sid));
-              return 0;
-            }
-          }
-          if (self.managed_by_admin = 1)
           {
-            -- update list of users
-            declare ds vspx_data_set;
-            ds := self.vc_find_descendant_control('ds_users');
-            if (ds is not null)
-              ds.vc_data_bind(self.vc_page.vc_event);
+            http_header (sprintf ('Location: %s%ssid=%s&realm=wa\r\n', self.ret_page, delim, self.sid));
           }
-        }
-        else
+          else if (self.wa_name_ret is not null)
         {
-          -- openid post
-          declare hdr, xt, is_agreed,ods_returnurl any;
-          declare url, cnt, oi_ident, oi_srv, oi_delegate, host, this_page, trust_root, check_immediate varchar;
-          declare oi2_srv, oi2_delegate varchar;
-
-          host := http_request_header (self.vc_page.vc_event.ve_lines, 'Host');
-          is_agreed := atoi(get_keyword ('is_agreed', params, '0'));
-
-          if (self.uoid and not is_agreed)
-          {
-            self.vc_error_message := 'You have not agreed to the Terms of Service.';
-            self.vc_is_valid := 0;
-            return;
+            http_header (sprintf ('Location: %s%ssid=%s&realm=wa&wa_name=%s\r\n', self.ret_page, delim, self.sid, self.wa_name_ret));
           }
-
-          this_page := case when is_https_ctx () then 'https://' else 'http://' end || host || http_path () || sprintf ('?uoid=%d', self.uoid);
-          if (self.ods_returnurl is not null)
-            this_page := this_page || sprintf ('&RETURL=%s', self.ods_returnurl);
-
-          trust_root := case when is_https_ctx () then 'https://' else 'http://' end || host;
-
-          declare exit handler for sqlstate '*'
+	  else
           {
-            self.vc_is_valid := 0;
-            self.vc_error_message := 'Invalid OpenID URL';
-            return;
-          };
-
-          url := self.openid_url.ufl_value;
-          oi_ident := url;
-        again:
-          hdr := null;
-          cnt := DB.DBA.HTTP_CLIENT_EXT (url=>url, headers=>hdr);
-          if (hdr [0] like 'HTTP/1._ 30_ %')
-          {
-            declare loc any;
-            loc := http_request_header (hdr, 'Location', null, null);
-            url := WS.WS.EXPAND_URL (url, loc);
-            oi_ident := url;
-            goto again;
+            http_header (sprintf ('Location: %s%ssid=%s&realm=wa\r\n', self.ret_page, delim, self.sid));
           }
-          xt := xtree_doc (cnt, 2);
-          oi_srv := cast (xpath_eval ('//link[contains (@rel, "openid.server")]/@href', xt) as varchar);
-          oi2_srv := cast (xpath_eval ('//link[contains (@rel, "openid2.provider")]/@href', xt) as varchar);
-          oi_delegate := cast (xpath_eval ('//link[contains (@rel, "openid.delegate")]/@href', xt) as varchar);
-          oi2_delegate := cast (xpath_eval ('//link[contains (@rel, "openid2.local_id")]/@href', xt) as varchar);
-
-          if (oi2_srv is not null)
-            oi_srv := oi2_srv;
-          if (oi_srv is null)
-            signal ('22023', 'Cannot locate OpenID server');
-
-          if (oi2_delegate is not null)
-            oi_delegate := oi2_delegate;
-
-          if (oi_delegate is not null)
-            oi_ident := oi_delegate;
+          if (strstr (http_header_get (), 'Set-Cookie: sid=') is null)
+            http_header (http_header_get () || sprintf ('Set-Cookie: sid=%s; path=/\r\n', self.sid));
 
-          this_page := this_page || sprintf ('&oi_srv=%U', oi_srv);
-          if (oi2_srv is not null)
-          {
-            check_immediate :=
-              sprintf ('%s?openid.ns=%U&openid.ns.sreg=%U&openid.mode=checkid_setup&openid.identity=%U&openid.claimed_id=%U&openid.return_to=%U&openid.realm=%U',
-                       oi_srv, OPENID..ns_v2 (), OPENID..sreg_ns_v1 (), oi_ident, oi_ident, this_page, trust_root);
-          }
-          else
-          {
-            check_immediate :=
-              sprintf ('%s?openid.mode=checkid_setup&openid.identity=%U&openid.return_to=%U&openid.trust_root=%U',
-                       oi_srv, oi_ident, this_page, trust_root);
-          }
-          check_immediate := check_immediate || sprintf ('&openid.sreg.optional=%U','fullname,nickname,dob,gender,postcode,country,timezone');
-          check_immediate := check_immediate || sprintf ('&openid.sreg.required=%U','email,nickname');
-          self.vc_redirect (check_immediate);
+          http_flush ();
         }
       ]]>
-    </v:method>
-
-    <v:variable name="wa_nameR" type="varchar" default="null" persist="0" param-name="wa_name"/>
-    <xsl:if test="@managed_by_admin = 1">
-      <v:variable name="managed_by_admin" type="int" default="1" persist="page" />
-    </xsl:if>
-    <xsl:if test="not @managed_by_admin = 1">
-      <v:variable name="managed_by_admin" type="int" default="0" persist="page" />
-    </xsl:if>
+    </v:before-render>
+    <v:variable name="wa_name_ret" type="varchar" default="null" persist="0" param-name="wa_name"/>
     <v:variable name="ret_page" type="varchar" persist="page" />
-
-    <v:variable name="reg_foafData" type="any" default="null" />
-    <v:variable name="reg_tip" type="int" default="0" persist="temp" />
-    <v:variable name="reg_number" type="varchar" default="null" persist="0" />
-    <v:variable name="reg_number_img" type="varchar" default="null" persist="temp" />
-    <v:variable name="reg_number_txt" type="varchar" default="null" persist="0" />
-
-    <v:variable name="reg_uid" type="varchar" default="''" param-name="reguid" />
-    <v:variable name="reg_mail" type="varchar" default="''" param-name="regmail" />
-
-    <v:variable name="oid_srv" type="varchar" default="null" param-name="oi_srv" />
-    <v:variable name="oid_assoc_handle" type="varchar" default="null" param-name="openid.assoc_handle" />
-    <v:variable name="oid_identity" type="varchar" default="''" param-name="openid.identity" />
-    <v:variable name="oid_mode" type="varchar" default="null" param-name="openid.mode" />
-    <v:variable name="oid_sig" type="varchar" default="null" param-name="openid.sig" />
-    <v:variable name="oid_email" type="varchar" default="''" param-name="openid.sreg.email" />
-    <v:variable name="oid_fullname" type="varchar" default="''" param-name="openid.sreg.fullname" />
-    <v:variable name="oid_nickname" type="varchar" default="''" param-name="openid.sreg.nickname" />
-    <v:variable name="oid_dob" type="varchar" default="''" param-name="openid.sreg.dob" />
-    <v:variable name="oid_gender" type="varchar" default="''" param-name="openid.sreg.gender" />
-    <v:variable name="oid_postcode" type="varchar" default="''" param-name="openid.sreg.postcode" />
-    <v:variable name="oid_country" type="varchar" default="''" param-name="openid.sreg.country" />
-    <v:variable name="oid_tz" type="varchar" default="''" param-name="openid.sreg.timezone" />
-    <v:variable name="uoid" type="integer" default="0" param-name="uoid" persist="temp"/>
-    <v:variable name="ods_returnurl" type="varchar" default="''" param-name="RETURL"/>
-    <v:variable name="fb" type="DB.DBA.Facebook" default="null" />
-    <div>
-      <v:label name="regl1" value="--''" />
-    </div>
-    <v:form name="regf1" method="POST" type="simple">
-      <v:on-init>
-        <![CDATA[
-          self.reg_tip := coalesce ((select top 1 WS_VERIFY_TIP from WA_SETTINGS), 0);
-          if (__proc_exists ('IM AnnotateImageBlob', 2) is not null)
-            self.im_enabled := 1;
-
-          if (self.reg_tip)
-           {
-            if (self.im_enabled)
-       {
-              if (not self.vc_event.ve_is_post)
-           {
-                self.reg_number := cast (rand (999999) as varchar);
-     }
-              self.reg_number_img := "IM AnnotateImageBlob" ("IM CreateImageBlob" (60, 25, 'white', 'jpg'), 10, 15, self.reg_number);
-              self.reg_number_img := encode_base64 (cast (self.reg_number_img as varchar));
-       }
-            else if (not self.vc_event.ve_is_post)
-       {
-              declare a,b,op,res any;
-
-              randomize (msec_time ());
-              a := rand(9);
-              b := rand(9);
-              op := rand (3);
-              if (op = 0)
-                res := a + b;
-              else if (op = 1)
-                res := a - b;
-         else
-                res := a * b;
-
-              self.reg_number_txt := sprintf ('%d %s %d = ', a, case op when 0 then '+' when 1 then '-' else '*' end, b);
-              self.reg_number := cast (res as varchar);
-             }
-             }
-
-          -- OpenID
-          if (self.oid_mode is not null and self.oid_sig is null)
-   {
-            self.vc_is_valid := 0;
-            self.vc_error_message := 'Verification failed.';
-   }
-          if (self.oid_mode = 'id_res' and self.oid_sig is not null and not self.vc_event.ve_is_post)
-             {
-            declare cnt, pref, ix int;
-            ix := 1;
-            pref := self.oid_nickname;
-
-          try_next:
-            cnt := (select count(*) from DB.DBA.SYS_USERS where U_NAME = self.oid_nickname);
-            if (cnt > 0)
-             {
-              self.oid_nickname := pref || cast (ix as varchar);
-              ix := ix + 1;
-              goto try_next;
-             }
-            if (self.uoid)
-         {
-              self.reguid.ufl_value := self.oid_nickname;
-              self.regmail.ufl_value := self.oid_email;
-              self.reg_uid := self.oid_nickname;
-              self.reg_mail := self.oid_email;
-              self.regpwd.ufl_value := uuid ();
-              self.regpwd1.ufl_value := self.regpwd.ufl_value;
-              self.is_agreed.ufl_selected := 1;
-
-              if (self.oid_nickname is not null and length(self.oid_nickname) > 0 and self.oid_email is not null and length(self.oid_email) > 0)
-           {
-                self.registration.vc_focus := 1;
-                self.vc_event.ve_is_post := 1;
-                self.registration.vc_user_post (self.vc_event);
-
-                self.registration.vc_enabled := 0;
-                self.registration.vc_focus := 0;
-                self.vc_event.ve_is_post := 0;
-              } else {
-             self.vc_is_valid := 0;
-                if (self.oid_nickname is null or length(self.oid_nickname)<1)
-                  self.vc_error_message := 'Your openID provider has not supplied your nickname.';
-
-                if (self.oid_email is null or length(self.oid_email)<1)
-                  self.vc_error_message := 'Your openID provider has not supplied your e-mail address.';
-
-                if ((self.oid_nickname is null or length(self.oid_nickname)<1) and (self.oid_email is null or length(self.oid_email) < 1))
-                  self.vc_error_message := 'Your openID provider has not supplied your nickname and e-mail address.';
-
-                declare _location varchar;
-                _location:=split_and_decode(self.vc_event.ve_lines[0],0,'\0\0 ')[1];
-
-                if (self.ods_returnurl is not null and self.ods_returnurl='index.html')
-                  self.vc_redirect (sprintf('index.html#fhref=%U',replace(_location,'RETURL=','OLDRETURL=')));
-           }
-            }
-          }
-          self.reg_foafData := null;
-          if (((select top 1 WS_REGISTER_SSL from WA_SETTINGS) = 1) and is_https_ctx ())
-           {
-            self.reg_foafData := ODS.ODS_API."user.getFOAFSSLData"(1, 0);
-            if (not self.uoid and length (self.reg_foafData) and (get_keyword ('certLogin', self.reg_foafData, 0) = 0))
-             {
-              self.uoid := 2;
-              if ((select top 1 WS_REGISTER_AUTOMATIC_SSL from WA_SETTINGS) = 1)
-               {
-                if ((get_keyword ('mbox', self.reg_foafData, '') <> '') and ((get_keyword ('nick', self.reg_foafData, '') <> '') or (get_keyword ('name', self.reg_foafData, '') <> '')))
-                {
-                  self.is_agreed.ufl_selected := 1;
-                  return self.makeRegistration();
-               }
-              }
-            }
-          }
-          if ((select top 1 WS_REGISTER_FACEBOOK from WA_SETTINGS) = 1)
-          {
-            declare fb_options any;
-            if (_get_ods_fb_settings (fb_options))
-              self.fb := new Facebook(fb_options[0], fb_options[1], self.vc_event.ve_params, self.vc_event.ve_lines);
-          }
-        ]]>
-      </v:on-init>
-      <v:template name="registration_na"  type="simple" enabled="--(1-coalesce ((select top 1 WS_REGISTER from WA_SETTINGS), 0))">
-        <div style="padding: 20px 20px 20px 35px;">
-          This service is currently not accepting new registrations without invitation.
+    <v:variable name="ods_returl" type="varchar" default="''" param-name="RETURL"/>
+    <table cellspacing="0">
+      <tr>
+        <td valign="top">
+          <img id="lf_logo" src="/ods/images/odslogo_200.png" />
+        </td>
+        <td valign="top">
+          <div id="rf" class="form">
+            <div class="header">
+              User Registration <img id="rf_throbber" src="/ods/images/oat/Ajax_throbber.gif" style="float: right; margin-right: 10px; display: none" />
         </div>
-      </v:template>
-      <v:template name="registration" type="simple" enabled="--coalesce ((select top 1 WS_REGISTER from WA_SETTINGS), 0)">
-        <div>
-          <div class="<?V case when self.uoid = 0 then 'login_tabactive' else 'login_tab' end ?>" id="tabODS" onclick="loginTabToggle(this);">ODS</div>
-          <?vsp
-            if ((select top 1 WS_REGISTER_OPENID from WA_SETTINGS) = 1)
-              http (sprintf ('<div class="%s" id="tabOpenID" onclick="loginTabToggle(this);">OpenID</div>', case when self.uoid = 1 then 'login_tabactive' else 'login_tab' end));
-            if (((select top 1 WS_REGISTER_SSL from WA_SETTINGS) = 1) and length (self.reg_foafData) and (get_keyword ('certLogin', self.reg_foafData, 0) = 0))
-              http (sprintf ('<div class="%s" id="tabSSL" onclick="loginTabToggle(this);">WebID</div>', case when self.uoid = 2 then 'login_tabactive' else 'login_tab' end));
-            if (((select top 1 WS_REGISTER_FACEBOOK from WA_SETTINGS) = 1) and not isnull(self.fb))
-              http (sprintf ('<div class="%s" id="tabFB" onclick="loginTabToggle(this);">Facebook</div>', case when self.uoid = 3 then 'login_tabactive' else 'login_tab' end));
-          ?>
+            <ul id="rf_tabs" class="tabs">
+              <li id="rf_tab_0" title="Digest">Digest</li>
+              <li id="rf_tab_1" title="OpenID" style="display: none;">OpenID</li>
+              <li id="rf_tab_2" title="Facebook" style="display: none;">Facebook</li>
+              <li id="rf_tab_3" title="WebID" style="display: none;">WebID</li>
+              <li id="rf_tab_4" title="Twitter" style="display: none;">Twitter</li>
+              <li id="rf_tab_5" title="LinkedIn" style="display: none;">LinkedIn</li>
+            </ul>
+            <div style="min-height: 135px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+              <div id="rf_content">.
         </div>
-        <br/>
-        <div class="login_tabdeck"><!--container div start-->
-          <div id="login_info" style="height: 115px;<?V case when self.uoid = 0 then '' else 'display:none;' end ?>">
-            <table width="100%">
-              <tr>
-                <th width="30%"><label for="reguid">Login Name<div style="font-weight: normal; display:inline; color:red;"> *</div></label></th>
+              <div id="rf_page_0" class="tabContent">
+                <table id="rf_table_0" class="form" cellspacing="5">
+                  <tr>
+                    <th width="20%">
+                      <label for="rf_uid">Login Name<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
+                    </th>
                 <td nowrap="nowrap">
-                  <v:text error-glyph="?" xhtml_tabindex="1" xhtml_id="reguid" xhtml_style="width:270px" name="reguid" value="--self.reg_uid" default_value="--self.oid_nickname" />
+                      <input type="text" name="rf_uid" value="" id="rf_uid" style="width: 150px;" />
                 </td>
               </tr>
-              <tr>
-                <th><label for="regmail">E-mail<div style="font-weight: normal; display:inline; color:red;"> *</div></label></th>
+                  <tr>
+                    <th>
+                      <label for="rf_email">E-mail<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
+                    </th>
                 <td nowrap="nowrap">
-                  <v:text error-glyph="?" xhtml_tabindex="2" xhtml_id="regmail" xhtml_style="width:270px" name="regmail" value="--self.reg_mail" default_value="--self.oid_email" />
+                      <input type="text" name="rf_email" value="" id="rf_email" style="width: 300px;" />
                 </td>
               </tr>
-              <tr>
-                <th><label for="regpwd">Password<div style="font-weight: normal; display:inline; color:red;"> *</div></label></th>
+                  <tr>
+                    <th>
+                      <label for="rf_password">Password<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
+                    </th>
                 <td nowrap="nowrap">
-                  <v:text error-glyph="?" xhtml_tabindex="3" xhtml_id="regpwd" xhtml_style="width:270px" type="password" name="regpwd" value="" />
+                      <input type="password" name="rf_password" value="" id="rf_password" style="width: 150px;" />
                 </td>
               </tr>
-              <tr>
-                <th><label for="regpwd1">Password (verify)<div style="font-weight: normal; display:inline; color:red;"> *</div></label></th>
+                  <tr>
+                    <th>
+                      <label for="rf_password2">Password (verify)<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
+                    </th>
                 <td nowrap="nowrap">
-                  <v:text error-glyph="?" xhtml_tabindex="4" xhtml_id="regpwd1" xhtml_style="width:270px" type="password" name="regpwd1" value="" >
-                    <v:validator test="sql" expression="self.regpwd.ufl_value <> self.regpwd1.ufl_value"
-                      message="Password verification does not match" />
-                  </v:text>
+                      <input type="password" name="rf_password2" value="" id="rf_password2" style="width: 150px;" />
                 </td>
               </tr>
-              <?vsp if (self.reg_tip) { ?>
+                </table>
+              </div>
+              <div id="rf_page_1" class="tabContent" style="display: none;">
+                <table id="rf_table_1" class="form" cellspacing="5">
               <tr>
-                <th><label for="regimg1">Enter the <?V case when self.im_enabled then 'number' else 'answer for the question' end ?> below<div style="font-weight: normal; display:inline; color:red;"> *</div></label></th>
+                    <th width="20%">
+                      <label for="rf_openId">OpenID</label>
+                    </th>
                 <td nowrap="nowrap">
-                  <v:text error-glyph="?" xhtml_tabindex="5" xhtml_id="regimg1" name="regimg1" value="">
-                    <v:validator test="sql" expression="self.reg_number is not null and self.reg_number <> self.regimg1.ufl_value"
-                      message="The number verification does not match" />
-                  </v:text>
+                      <input type="text" name="rf_openId" value="" id="rf_openId" style="width: 300px;" />
                 </td>
               </tr>
-              <tr>
-                <td></td>
-                <td>
-                  <?vsp if (self.im_enabled) { ?>
-                  <img src="data:image/jpeg;base64,<?V self.reg_number_img ?>" border="1"/>
-                  <?vsp } else {
-                    http (self.reg_number_txt);
-                  } ?>
-                </td>
-              </tr>
-              <?vsp } ?>
             </table>
           </div>
-          <?vsp
-            if ((select top 1 WS_REGISTER_OPENID from WA_SETTINGS) = 1)
-               {
-          ?>
-          <div id="login_openid" style="height: 115px;<?V case when self.uoid = 1 then '' else 'display:none;' end ?>">
-            <table width="100%">
+              <div id="rf_page_2" class="tabContent" style="display: none;">
+                <table id="rf_table_2" class="form" cellspacing="5">
               <tr>
-                <th width="30%"><label for="reguid">OpenID</label></th>
-                <td>
-                  <img src="images/login-bg.gif" alt="openID"  class="login_openid" />
-                  <v:text  xhtml_id="openid_url" name="openid_url" value="" xhtml_style="width:90%" default_value="--self.oid_identity"/>
-                  <script type="text/javascript">
+                    <th width="20%">
+                    </th>
+                    <td nowrap="nowrap">
+                      <span id="rf_facebookData" style="min-height: 20px;">.</span>
+                      <br />
                     <![CDATA[
-                      var is_disabled=<?V(case when self.oid_mode = 'id_res' and self.oid_sig is not null then 1 else 0 end)?>+0;
-                      if (is_disabled && $('openid_url'))
-                      {
-                        $('openid_url').disabled = true;
-                        if ($('tabODS'))
-                        $('tabODS').style.display = 'none';
-                        if ($('tabSSL'))
-                        $('tabSSL').style.display = 'none';
-                        if ($('tabFB'))
-                        $('tabFB').style.display = 'none';
-           }
+                        <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
+                        <fb:login-button autologoutlink="true" xmlns:fb="http://www.facebook.com/2008/fbml"></fb:login-button>
                     ]]>
-                  </script>
-                  <input type="hidden" id="uoid" name="uoid" value="<?Vself.uoid?>"/>
                 </td>
               </tr>
-              <v:template name="oid_login_row"  type="simple" enabled="--(case when self.oid_sig is not null and (self.oid_nickname is null or length(self.oid_nickname)<1) then 1 else 0 end)">
+                </table>
+              </div>
+              <div id="rf_page_3" class="tabContent" style="display: none;">
+                <table id="rf_table_3" class="form" cellspacing="5">
               <tr>
-                <th nowrap="1"><label for="oid_reguid">Login Name<div style="font-weight: normal; display:inline; color:red;"> *</div></label></th>
+                    <th width="20%">
+                    </th>
                 <td nowrap="nowrap">
-                  <v:text xhtml_tabindex="11" xhtml_id="oid_reguid" xhtml_style="width:270px" name="oid_reguid" value="--get_keyword('oid_reguid', params)"
-                    default_value="--self.oid_nickname" xhtml_onblur="document.getElementById(''reguid'').value=this.value;">
-                  </v:text>
                 </td>
               </tr>
-              </v:template>
-              <v:template name="oid_mail_row"  type="simple" enabled="--(case when self.oid_sig is not null and (self.oid_email is null or length(self.oid_email)<1) then 1 else 0 end)">
+                </table>
+              </div>
+              <div id="rf_page_4" class="tabContent" style="display: none;">
+                <table id="rf_table_4" class="form" cellspacing="5">
+                  <tr>
+                    <th width="20%">
+                    </th>
+                    <td>
+                      <span id="rf_twitter" style="min-height: 20px;"></span>
+                      <br />
+                      <img id="rf_twitterButton" src="/ods/images/sign-in-with-twitter-d.png" border="0"/>
+                    </td>
+                  </tr>
+                </table>
+              </div>
+              <div id="rf_page_5" class="tabContent" style="display: none;">
+                <table id="rf_table_5" class="form" cellspacing="5">
+                  <tr>
+                    <th width="20%">
+                    </th>
+                    <td>
+                      <span id="rf_linkedin" style="min-height: 20px;"></span>
+                      <br />
+                      <img id="rf_linkedinButton" src="/ods/images/linkedin-large.png" border="0"/>
+                    </td>
+                  </tr>
+                </table>
+              </div>
+            </div>
+            <div>
+              <table class="form" cellspacing="5">
               <tr>
-                <th><label for="oid_regmail">E-mail<div style="font-weight: normal; display:inline; color:red;"> *</div></label></th>
+                  <th width="20%">
+                  </th>
                 <td nowrap="nowrap">
-                  <v:text xhtml_tabindex="12" xhtml_id="oid_regmail" xhtml_style="width:270px" name="oid_regmail" value="--get_keyword ('oid_regmail', params)"
-                    default_value="--self.oid_email" xhtml_onblur="document.getElementById(''regmail'').value=this.value;">
-                  </v:text>
+                    <input type="checkbox" name="rf_is_agreed" value="1" id="rf_is_agreed"/><label for="rf_is_agreed">I agree to the <a href="/ods/terms.html" target="_blank">Terms of Service</a>.</label>
                 </td>
               </tr>
-              </v:template>
             </table>
           </div>
-          <?vsp
-         }
-            if (((select top 1 WS_REGISTER_SSL from WA_SETTINGS) = 1) and length (self.reg_foafData) and (get_keyword ('certLogin', self.reg_foafData, 0) = 0))
-         {
-          ?>
-          <div id="login_ssl" style="height: 115px;<?V case when self.uoid = 2 then '' else 'display:none;' end ?>">
-            <table width="100%">
-              <?vsp
-                if (get_keyword ('iri', self.reg_foafData, '') <> '')
-                  http (sprintf ('<tr><th width="30%%"><label>%s</label></th><td>%s</td></tr>', 'WebID', get_keyword ('iri', self.reg_foafData)));
-                if (get_keyword ('firstName', self.reg_foafData, '') <> '')
-                  http (sprintf ('<tr><th width="30%%"><label>%s</label></th><td>%s</td></tr>', 'First Name', get_keyword ('firstName', self.reg_foafData)));
-                if (get_keyword ('family_name', self.reg_foafData, '') <> '')
-                  http (sprintf ('<tr><th width="30%%"><label>%s</label></th><td>%s</td></tr>', 'Family name', get_keyword ('family_name', self.reg_foafData)));
-                if (isnull (get_keyword ('nick', self.reg_foafData)) and isnull (get_keyword ('name', self.reg_foafData)))
-                  http (sprintf ('<tr><th width="30%%"><label>%s<div style="font-weight: normal; display: inline; color: red;"> *</div></label></th><td><input type="text" name="webid_uid" id="webid_uid" value="%s" style="width:270px" /></td></tr>', 'Login Name', get_keyword ('webid_uid', self.vc_page.vc_event.ve_params, '')));
-                if (get_keyword ('mbox', self.reg_foafData, '') <> '')
-           {
-                  http (sprintf ('<tr><th width="30%%"><label>%s</label></th><td>%s</td></tr>', 'E-Mail', get_keyword ('mbox', self.reg_foafData)));
-                } else {
-                  http (sprintf ('<tr><th width="30%%"><label>%s<div style="font-weight: normal; display: inline; color: red;"> *</div></label></th><td><input type="text" name="webid_mbox" id="webid_mail" value="%s" style="width:270px" /></td></tr>', 'E-Mail', get_keyword ('webid_mbox', self.vc_page.vc_event.ve_params, '')));
-           }
-              ?>
-            </table>
+            <div class="footer" id="rf_login_5">
+              <input type="button" id="rf_signup" name="rf_signup" value="Sign Up" onclick="javascript: return rfSignupSubmit();" />
           </div>
-          <?vsp
-         }
-            if (((select top 1 WS_REGISTER_FACEBOOK from WA_SETTINGS) = 1) and not isnull(self.fb))
-         {
-          ?>
-          <div id="login_fb" style="height: 115px;<?V case when self.uoid = 3 then '' else 'display:none;' end ?>">
-            <table width="100%">
-              <?vsp
-                if (length (self.fb._user))
-                {
-                  declare _res any;
-                  _res := self.fb.api_client.users_getInfo(self.fb._user, 'name');
-                  http (sprintf ('<tr><th width="30%%"></th><td>Connected as <b><i>%s</i><b></td></tr>', serialize_to_UTF8_xml (xpath_eval('string(/users_getInfo_response/user/name)', _res))));
-         }
-                http (         '<tr><th width="30%"></th><td>');
-                http (         '<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>');
-                http (         '<fb:login-button autologoutlink="true" onlogin1="window.location=\'/ods/login.vspx\'"></fb:login-button>');
-                http (sprintf ('<script type="text/javascript">FB.init("%s", "fb_dummy.vsp", {"reloadIfSessionStateChanged": true});</script>', self.fb.api_key));
-                http (         '</td></tr>');
-              ?>
-            </table>
           </div>
-          <?vsp
-}
-          ?>
-          <table width="100%">
-            <tr>
-              <td width="30%"></td>
-              <td>
-                <v:check-box name="is_agreed" value="1" initial-checked="0" xhtml_id="is_agreed"/>
-                <label for="is_agreed">I agree to the <a href="terms.html" target="_blank">Terms of Service</a>.</label>
-              </td>
-            </tr>
-            <tr>
-              <td></td>
-              <td class="ctrl">
-                <span class="fm_ctl_btn" id="signup_span">
-                 <v:button action="simple" name="regb1" value="Sign Up">
-                 </v:button>
-                </span>
               </td>
             </tr>
-            <input type="hidden" name="ret" value="<?=get_keyword_ucase ('ret', self.vc_page.vc_event.ve_params, '')?>" />
           </table>
-        </div><!--container div end-->
-        <script type="text/javascript">
-          <![CDATA[
-            <!--
-            function loginTabReset()
-  {
-              $('tabOpenID').className='login_tab';
-              $('tabODS').className='login_tab';
-              $('tabSSL').className='login_tab';
-              $('tabFB').className='login_tab';
-              OAT.Dom.hide($('login_info'));
-              OAT.Dom.hide($('login_openid'));
-              OAT.Dom.hide($('login_ssl'));
-              OAT.Dom.hide($('login_fb'));
-  }
-            function loginTabToggle(tabObj)
-{
-              if (!tabObj)
-  return;
-              loginTabReset();
-              if (tabObj.id == 'tabODS')
-  {
-                $('tabODS').className='login_tabactive';
-                OAT.Dom.show($('login_info'));
-                $('uoid').value = 0;
-  }
-              else if (tabObj.id == 'tabOpenID')
-  {
-                $('tabOpenID').className='login_tabactive';
-                OAT.Dom.show($('login_openid'));
-                $('uoid').value = 1;
-  }
-              else if(tabObj.id == 'tabSSL')
-  {
-                $('tabSSL').className='login_tabactive';
-                OAT.Dom.show($('login_ssl'));
-                $('uoid').value = 2;
-  }
-              else if(tabObj.id == 'tabFB')
-              {
-                $('tabFB').className='login_tabactive';
-                OAT.Dom.show($('login_fb'));
-                $('uoid').value = 3;
-}
-            }
-
-            var activeTab=<?Vself.uoid?>+0;
-            if (activeTab == 1)
-              loginTabToggle($('tabOpenID'));
-            else if (activeTab == 2)
-              loginTabToggle($('tabSSL'));
-            else if (activeTab == 3)
-              loginTabToggle($('tabFB'));
-            else
-              loginTabToggle($('tabODS'));
-            // -->
-          ]]>
-        </script>
-        <v:on-post>
-          <![CDATA[
-            return self.makeRegistration();
-      ]]>
-      </v:on-post>
-     </v:template>
-
-    </v:form>
-
   </xsl:template>
 </xsl:stylesheet>
diff --git a/appsrc/ODS-Framework/comp/render.xsl b/appsrc/ODS-Framework/comp/render.xsl
index 07e324a..5cb52b7 100644
--- a/appsrc/ODS-Framework/comp/render.xsl
+++ b/appsrc/ODS-Framework/comp/render.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: render.xsl,v 1.3 2006/10/17 14:07:20 source Exp $
+ -  $Id: render.xsl,v 1.3.2.1 2010/09/20 10:15:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/rss2atom.xsl b/appsrc/ODS-Framework/comp/rss2atom.xsl
index 359fd64..3a1b0e5 100644
--- a/appsrc/ODS-Framework/comp/rss2atom.xsl
+++ b/appsrc/ODS-Framework/comp/rss2atom.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom.xsl,v 1.6 2008/03/13 20:50:06 source Exp $
+ -  $Id: rss2atom.xsl,v 1.6.2.1 2010/09/20 10:15:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/rss2rdf.xsl b/appsrc/ODS-Framework/comp/rss2rdf.xsl
index c16c9d9..83fedad 100644
--- a/appsrc/ODS-Framework/comp/rss2rdf.xsl
+++ b/appsrc/ODS-Framework/comp/rss2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2rdf.xsl,v 1.2 2006/05/31 13:13:02 source Exp $
+ -  $Id: rss2rdf.xsl,v 1.2.2.1 2010/09/20 10:15:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/rss2xbel.xsl b/appsrc/ODS-Framework/comp/rss2xbel.xsl
index f914b65..d36cf89 100644
--- a/appsrc/ODS-Framework/comp/rss2xbel.xsl
+++ b/appsrc/ODS-Framework/comp/rss2xbel.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2xbel.xsl,v 1.2 2006/05/31 13:13:02 source Exp $
+ -  $Id: rss2xbel.xsl,v 1.2.2.1 2010/09/20 10:15:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/services.xsl b/appsrc/ODS-Framework/comp/services.xsl
index a17750d..db9479e 100644
--- a/appsrc/ODS-Framework/comp/services.xsl
+++ b/appsrc/ODS-Framework/comp/services.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: services.xsl,v 1.7 2008/03/13 20:50:06 source Exp $
+ -  $Id: services.xsl,v 1.7.2.2 2010/09/20 10:15:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -86,10 +86,7 @@
                     <v:after-data-bind>
                       <![CDATA[
                         control.ufl_value := '<img src="images/icons/add_16.png" border="0" alt="Join" title="Join"/> Join';
-			control.vc_enabled :=
-			DB.DBA.WA_USER_CAN_JOIN_INSTANCE (
-			  self.u_id,
-			  (control.vc_parent as vspx_row_template).te_rowset[3]);
+                  			control.vc_enabled := DB.DBA.WA_USER_CAN_JOIN_INSTANCE (self.u_id, (control.vc_parent as vspx_row_template).te_rowset[3]);
                       ]]>
                     </v:after-data-bind>
                   </vm:url>
@@ -150,22 +147,16 @@
         declare _str any;
         _str := string_output();
         http('<dashboard>', _str);
-        for select
-          inst.WAI_INST.wa_dashboard() as r
-        from
-          WA_INSTANCE inst
-        where
-          inst.WAI_IS_PUBLIC >= 1 or
-          exists(select
-                   1
-                 from
-                   WA_MEMBER
-                 where
-                   WAM_INST = inst.WAI_NAME and
-                   WAM_STATUS <= 2 and
-                   WAM_USER = self.u_id
-                 )
-        do {
+            for select inst.WAI_INST.wa_dashboard() as r
+                  from WA_INSTANCE inst
+                  where inst.WAI_IS_PUBLIC >= 1
+                     or exists (select 1
+                                  from WA_MEMBER
+                                 where WAM_INST = inst.WAI_NAME
+                                   and WAM_STATUS <= 2
+                                   and WAM_USER = self.u_id)
+            do
+            {
           http_value(r, null, _str);
         }
         http('</dashboard>', _str);
@@ -179,13 +170,15 @@
         declare _is_dav, _xsl_fullname, _xsl_string, _xsl_uri any;
         declare _dav_path, _dav_fullpath any;
         _is_dav := http_map_get('is_dav');
-        if(not _is_dav) {
+            if (not _is_dav)
+            {
           -- file system
           _xsl_fullname := concat(_real_dir, '/', _style, '.xsl');
           _xsl_string := file_to_string(_xsl_fullname);
           _xsl_uri := concat('file://', _request_dir, '/', _style, '.xsl');
         }
-        else {
+            else
+            {
           -- dav collection
           declare _position any;
           _dav_path := http_physical_path();
@@ -210,7 +203,8 @@
       </v:before-render>
     </v:template>
     <?vsp
-      if(length(self.dashboard_content) = 0) {
+      if (length(self.dashboard_content) = 0)
+      {
         http('<br/>');
       }
       else {
@@ -230,12 +224,9 @@
   <![CDATA[
 function selectAllCheckboxes (form, btn, txt)
 {
-  var i;
-  for (i =0; i < form.elements.length; i++)
-    {
+        for (var i =0; i < form.elements.length; i++) {
       var contr = form.elements[i];
-      if (contr != null && contr.type == "checkbox" && contr.name.indexOf (txt) != -1)
-        {
+          if (contr != null && contr.type == "checkbox" && contr.name.indexOf (txt) != -1) {
     contr.focus();
     if (btn.value == 'Select All')
       contr.checked = true;
@@ -371,12 +362,9 @@ function selectAllCheckboxes (form, btn, txt)
                     ]]>
                   </v:after-data-bind>
                   <v:on-post>
-                    <v:script>
                     <![CDATA[
-		    self.vc_redirect (sprintf('freeze.vspx?app=%s',
-		    	(control.vc_parent as vspx_row_template).te_rowset[3]));
+		                  self.vc_redirect (sprintf('freeze.vspx?app=%s', (control.vc_parent as vspx_row_template).te_rowset[3]));
                     ]]>
-                    </v:script>
                   </v:on-post>
                 </v:button>
                 <v:button style="url" value="Unfreeze" action="simple" name="unfreeze_instance">
@@ -386,7 +374,6 @@ function selectAllCheckboxes (form, btn, txt)
                     ]]>
                   </v:after-data-bind>
                   <v:before-data-bind>
-                    <v:script>
                       <![CDATA[
                         declare freeze varchar;
                         freeze := (select WAI_IS_FROZEN from WA_INSTANCE where WAI_NAME = (control.vc_parent as vspx_row_template).te_rowset[3]);
@@ -395,15 +382,12 @@ function selectAllCheckboxes (form, btn, txt)
                         else
                           control.vc_enabled := 0;
                       ]]>
-                    </v:script>
                   </v:before-data-bind>
                   <v:on-post>
-                    <v:script>
                     <![CDATA[
                       update WA_INSTANCE set WAI_IS_FROZEN = 0 where WAI_NAME = (control.vc_parent as vspx_row_template).te_rowset[3];
                       self.vc_redirect ('security.vspx');
                     ]]>
-                    </v:script>
                   </v:on-post>
                 </v:button>
                 <vm:url value="Delete"
@@ -414,14 +398,12 @@ function selectAllCheckboxes (form, btn, txt)
                     ]]>
                   </v:after-data-bind>
                   <v:before-data-bind>
-                    <v:script>
                       <![CDATA[
                         if (wa_user_is_dba (self.u_name, self.u_group))
                           control.vc_enabled := 1;
                         else
                           control.vc_enabled := 0;
                       ]]>
-                    </v:script>
                   </v:before-data-bind>
                 </vm:url>
               </td>
@@ -444,7 +426,8 @@ function selectAllCheckboxes (form, btn, txt)
 	       v := rtrim (v, ',');
 	       if (length (v))
 	         self.vc_redirect ('freeze.vspx?apps='||v);
-	       ]]></v:on-post>
+	       ]]>
+	     </v:on-post>
        </v:button>
        <v:button name="remove_btn" value="Delete Selected" action="simple" >
 	   <v:on-post><![CDATA[
diff --git a/appsrc/ODS-Framework/comp/settings.xsl b/appsrc/ODS-Framework/comp/settings.xsl
index 5058ea4..7f56644 100644
--- a/appsrc/ODS-Framework/comp/settings.xsl
+++ b/appsrc/ODS-Framework/comp/settings.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: settings.xsl,v 1.4 2007/02/27 21:19:46 source Exp $
+ -  $Id: settings.xsl,v 1.4.2.1 2010/09/20 10:15:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/site_home.xsl b/appsrc/ODS-Framework/comp/site_home.xsl
index 956a9ec..03bfb0f 100644
--- a/appsrc/ODS-Framework/comp/site_home.xsl
+++ b/appsrc/ODS-Framework/comp/site_home.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: site_home.xsl,v 1.4 2006/10/17 14:07:20 source Exp $
+ -  $Id: site_home.xsl,v 1.4.2.1 2010/09/20 10:15:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/store.xsl b/appsrc/ODS-Framework/comp/store.xsl
index f23f8c1..760d25d 100644
--- a/appsrc/ODS-Framework/comp/store.xsl
+++ b/appsrc/ODS-Framework/comp/store.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: store.xsl,v 1.3 2006/10/17 14:07:20 source Exp $
+ -  $Id: store.xsl,v 1.3.2.1 2010/09/20 10:15:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/comp/tagging.xsl b/appsrc/ODS-Framework/comp/tagging.xsl
index a2aad4a..e60f8e7 100644
--- a/appsrc/ODS-Framework/comp/tagging.xsl
+++ b/appsrc/ODS-Framework/comp/tagging.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: tagging.xsl,v 1.9.2.1 2009/05/11 07:39:14 source Exp $
+ -  $Id: tagging.xsl,v 1.9.2.2 2010/09/20 10:15:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/conf.vspx b/appsrc/ODS-Framework/conf.vspx
index 7b619ad..5d551db 100644
--- a/appsrc/ODS-Framework/conf.vspx
+++ b/appsrc/ODS-Framework/conf.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: conf.vspx,v 1.5 2006/10/17 14:07:19 source Exp $
+ -  $Id: conf.vspx,v 1.5.2.1 2010/09/20 10:15:18 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/conf_app.vspx b/appsrc/ODS-Framework/conf_app.vspx
index 1be4232..29d9e27 100644
--- a/appsrc/ODS-Framework/conf_app.vspx
+++ b/appsrc/ODS-Framework/conf_app.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: conf_app.vspx,v 1.5 2008/05/15 16:17:58 source Exp $
+ -  $Id: conf_app.vspx,v 1.5.2.1 2010/09/20 10:15:18 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/contact.html b/appsrc/ODS-Framework/contact.html
index b9e233c..9e386b3 100644
--- a/appsrc/ODS-Framework/contact.html
+++ b/appsrc/ODS-Framework/contact.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
  -
- -  $Id: contact.html,v 1.2 2008/03/13 20:50:05 source Exp $
+ -  $Id: contact.html,v 1.2.2.1 2010/09/20 10:15:18 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/dashboard.sql b/appsrc/ODS-Framework/dashboard.sql
index 33c4be0..cf59f92 100644
--- a/appsrc/ODS-Framework/dashboard.sql
+++ b/appsrc/ODS-Framework/dashboard.sql
@@ -1,5 +1,5 @@
 --
---  $Id: dashboard.sql,v 1.13.2.1 2010/03/12 09:10:12 source Exp $
+--  $Id: dashboard.sql,v 1.13.2.3 2010/11/09 20:18:21 source Exp $
 --
 --  WA Dashboard support
 --
@@ -363,7 +363,7 @@ create procedure WA_COMMON_DASHBOARD_SP (in inst_type varchar)
 
   result_names (inst_name, title, ts, author, url, uname, email);
   for select WAM_INST, WAI_INST, WAM_HOME_PAGE from WA_MEMBER, WA_INSTANCE where WAI_NAME = WAM_INST
-    and WAI_IS_PUBLIC=1 and WAM_APP_TYPE = inst_type do
+    and WAI_IS_PUBLIC=1 and WAM_APP_TYPE = inst_type option (loop) do
       {
 	inst := WAI_INST;
 	h := udt_implements_method (inst, fix_identifier_case ('wa_dashboard_last_item'));
diff --git a/appsrc/ODS-Framework/dav.css b/appsrc/ODS-Framework/dav.css
index d1907ee..6af0a52 100644
--- a/appsrc/ODS-Framework/dav.css
+++ b/appsrc/ODS-Framework/dav.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: dav.css,v 1.3 2008/03/13 20:50:05 source Exp $
+ *  $Id: dav.css,v 1.3.2.1 2010/09/20 10:15:19 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Framework/default.css b/appsrc/ODS-Framework/default.css
index 38c0413..7ffaf03 100644
--- a/appsrc/ODS-Framework/default.css
+++ b/appsrc/ODS-Framework/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.26.2.9 2010/03/18 10:17:26 source Exp $
+ *  $Id: default.css,v 1.26.2.17 2011/03/08 13:28:13 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -940,8 +940,8 @@ a.tabX {
   border: 1px solid #000;
   border-bottom-width: 0px;
   border-color: #7f94a5;
-  padding: 2px 10px 2px 10px;
-  margin-right: 3px;
+  padding: 2px 5px 2px 5px;
+  margin-right: 2px;
   position: relative;
   text-decoration: none;
   top: -1px;
@@ -950,7 +950,6 @@ a.tabX {
 
 a.activeTabX {
   background-color: #EFEFEF;
-  border-color: #7f94a5;
 }
 
 a.tabX:visited
@@ -988,6 +987,7 @@ div.contents {
   background-color: #EFEFEF;
   border: 1px solid #7F94A5;
   padding: 0.5em;
+  margin-top: -1px;
 }
 
 /* ComboList */
@@ -1081,3 +1081,109 @@ span.button {
 img.button {
   margin-bottom: -3px;
 }
+
+div.form {
+  width: 550px;
+  background-color: #FFF;
+  margin: 5px;
+}
+
+div.header {
+  width: 100%;
+  padding: 5px 0 5px 0;
+  background-color: #F6F6F6;
+  text-align: center;
+  font-size: 14px;
+  font-weight: bold;
+}
+
+div.footer {
+  width: 100%;
+  padding: 5px 0 5px 0;
+  background-color: #F6F6F6;
+  text-align: center;
+  font-size: 14px;
+  font-weight: bold;
+}
+
+table.form {
+  width: 100%;
+}
+
+table.form th {
+  text-align: right;
+  padding-right: 3px;
+  margin-bottom: 5px;
+  white-space: nowrap;
+}
+
+table.form td {
+  padding-left: 3px;
+  margin-bottom: 5px;
+  white-space: nowrap;
+}
+
+.tabs {
+	margin-top: 1.5em;
+	list-style-type: none;
+	padding-bottom: 1px;
+	padding-left: 0.5em;
+}
+
+.tabs li {
+	display: inline;
+	padding: 1px 3px;
+	margin-left: 0.1em;
+	cursor: pointer;
+  border-top: 1px solid #aaa;
+  border-left: 1px solid #aaa;
+  border-right: 1px solid #aaa;
+  -moz-border-radius-topleft: 3px;
+  -moz-border-radius-topright: 3px;
+  -webkit-border-top-left-radius: 3px;
+  -webkit-border-top-right-radius: 3px;
+	background-color: #EFEFEF;
+	z-index: 10;
+}
+
+.tabs li.tab_selected {
+	background-color: #FFF;
+}
+
+.tabs li.tab:hover {
+	background-color: #FFF;
+}
+
+#lf_logo {
+  margin: 50px 25px 25px 30px
+}
+
+label span.small {
+  font-size: smaller;
+  font-weight: normal;
+  display: block;
+  color: #666;
+}
+
+fieldset.form {
+  padding: 1em;
+}
+
+fieldset.form div {
+  clear: left;
+  display: block;
+  width: 800px;
+  zoom: 1;
+  margin: 5px 0 0 0;
+  padding: 1px 3px;
+}
+
+fieldset.form div label.form {
+  display: block;
+  float: left;
+  width: 200px;
+  padding: 3px 5px;
+  margin: 0 0 5px 0;
+  font-weight: bold;
+  text-align: right;
+}
diff --git a/appsrc/ODS-Framework/delete_inst.vspx b/appsrc/ODS-Framework/delete_inst.vspx
index 8a13308..ca9416d 100644
--- a/appsrc/ODS-Framework/delete_inst.vspx
+++ b/appsrc/ODS-Framework/delete_inst.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: delete_inst.vspx,v 1.9 2008/03/13 20:50:05 source Exp $
+ -  $Id: delete_inst.vspx,v 1.9.2.1 2010/09/20 10:15:19 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/drop.sql b/appsrc/ODS-Framework/drop.sql
index 3b7e347..60b5a04 100644
--- a/appsrc/ODS-Framework/drop.sql
+++ b/appsrc/ODS-Framework/drop.sql
@@ -1,5 +1,5 @@
 --
---  $Id: drop.sql,v 1.4.2.4 2010/01/14 16:04:13 source Exp $
+--  $Id: drop.sql,v 1.4.2.6 2010/09/20 10:15:19 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -67,12 +67,14 @@ drop procedure WA_DATE_GET;
 drop procedure WA_USER_IS_FRIEND;
 drop procedure WA_OPTION_IS_PUBLIC;
 drop procedure WA_USER_TEXT_SET;
+drop procedure WA_USER_OL_ACCOUNTS_SET_UP;
 
 registry_remove ('__wa_member_upgrade');
 registry_remove ('__wa_member_doinstcount');
 registry_remove ('__WA_USER_INFO_CERT_UPGRADE');
 registry_remove ('__WA_USER_INFO_NICK_UPGRADE');
 registry_remove ('__WA_USER_OL_ACCOUNTS_SET_UP');
+registry_remove ('__WA_USER_OL_ACCOUNTS_SET_UP2');
 registry_remove ('__wa_offerlist_upgrade');
 registry_remove ('__wa_wishlist_upgrade');
 registry_remove ('__wa_favorites_upgrade');
diff --git a/appsrc/ODS-Framework/drop_sioc_proc.sql b/appsrc/ODS-Framework/drop_sioc_proc.sql
index 417b12f..9b34c1d 100644
--- a/appsrc/ODS-Framework/drop_sioc_proc.sql
+++ b/appsrc/ODS-Framework/drop_sioc_proc.sql
@@ -1,7 +1,7 @@
 --
 --  drop_sioc_proc
 --
---  $Id: drop_sioc_proc.sql,v 1.1 2007/03/16 17:19:28 source Exp $
+--  $Id: drop_sioc_proc.sql,v 1.1.2.1 2010/09/20 10:15:19 source Exp $
 --
 --  script to clean the old variant of the ODS RDF data support : triggers over the apps
 --
diff --git a/appsrc/ODS-Framework/drop_sioc_trig.sql b/appsrc/ODS-Framework/drop_sioc_trig.sql
index 31ed020..bba8e00 100644
--- a/appsrc/ODS-Framework/drop_sioc_trig.sql
+++ b/appsrc/ODS-Framework/drop_sioc_trig.sql
@@ -1,7 +1,7 @@
 --
 --  sioc.sql
 --
---  $Id: drop_sioc_trig.sql,v 1.1 2007/02/27 21:19:45 source Exp $
+--  $Id: drop_sioc_trig.sql,v 1.1.2.1 2010/09/20 10:15:19 source Exp $
 --
 --  script to clean the old variant of the ODS RDF data support : triggers over the apps
 --
diff --git a/appsrc/ODS-Framework/edit_inst.vspx b/appsrc/ODS-Framework/edit_inst.vspx
index f519604..3ed11d8 100644
--- a/appsrc/ODS-Framework/edit_inst.vspx
+++ b/appsrc/ODS-Framework/edit_inst.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: edit_inst.vspx,v 1.14 2009/03/12 09:34:30 source Exp $
+ -  $Id: edit_inst.vspx,v 1.14.2.2 2010/09/20 10:15:19 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -34,8 +34,8 @@
     </vm:header>
     <v:on-init>
       <![CDATA[
-        select WAI_MEMBER_MODEL, WAI_IS_PUBLIC, WAI_MEMBERS_VISIBLE, WAI_INST, WAI_NAME, WAI_TYPE_NAME, WAI_DESCRIPTION, WAI_LICENSE, WAI_ACL
-          into self.imodel, self.is_public, self.is_visible, self.inst, self.iname, self.wa_type, self.idesc, self.ilic, self.acl
+        select WAI_MEMBER_MODEL, WAI_IS_PUBLIC, WAI_MEMBERS_VISIBLE, WAI_INST, WAI_NAME, WAI_TYPE_NAME, WAI_DESCRIPTION, WAI_LICENSE
+          into self.imodel, self.is_public, self.is_visible, self.inst, self.iname, self.wa_type, self.idesc, self.ilic
           from WA_INSTANCE
          where WAI_ID = self.iid;
         if (self.instance_descr is null)
@@ -108,7 +108,6 @@
       <vm:variable name="imodel" type="int" default="null" persist="0"/>
       <vm:variable name="is_public" type="int" default="null" persist="0"/>
       <vm:variable name="is_visible" type="int" default="null" persist="0"/>
-      <vm:variable name="acl" type="any" default="null" persist="0"/>
       <vm:variable name="iid" type="int" default="null" persist="0" param-name="wai_id"/>
       <vm:variable name="iname" type="varchar" default="null" persist="0"/>
       <vm:variable name="idesc" type="varchar" default="null" persist="0"/>
@@ -135,26 +134,11 @@
         <vm:login redirect="index.vspx"/>
         <div class="box">
           <v:form type="simple" method="POST" name="eform1">
-            <br />
-            <input type="hidden" name="tabNo" xhtml_id="tabNo" value="0"/>
-            <div id="z" class="c1">
-              <div class="tabs">
-                <div onclick="javascript: showTab('z', 2, 0);" class="tab activeTab" id="z_tab_0">Main</div>
-                <div onclick="javascript: showTab('z', 2, 1);" class="tab" id="z_tab_1">Access</div>
-              </div>
-              <div class="contents">
-                <div id="z_content_0" class="tabContent">
             <table  class="ctl_grp">
               <vm:instance-settings edit="yes" />
-                  </table>
-                </div>
-                <div id="z_content_1" class="tabContent" style="display: none;">
-	                <table class="ctl_grp" width="100%">
-                    <vm:instance-sharing />
-                  </table>
-                </div>
-              </div>
-              <div>
+              <tr>
+                 <td colspan="2">
+                  <span class="fm_ctl_btn">
                     <v:button action="simple" name="cancel1" value="Cancel">
                       <v:on-post>
                         <![CDATA[
@@ -231,26 +215,12 @@
                           inst.wa_member_model := atoi(self.imodel1.ufl_value);
                           if (self.wa_type not in ('oMail', 'IM'))
                           {
-                        self.is_public := get_keyword ('is_public1', self.vc_event.ve_params);
+                            self.is_public := self.is_public1.ufl_selected;
                           }
                           if (self.wa_type not in ('oDrive', 'oMail', 'IM'))
                           {
                             self.is_visible := self.is_visible1.ufl_selected;
                           }
-                      declare N integer;
-                      declare suffix, tmp_s varchar;
-
-                      tmp_s := vector();
-                      for (N := 0; N < length (e.ve_params); N := N + 4)
-                      {
-                        if ((e.ve_params [N] like 's_fld_2_%') and (trim (e.ve_params [N+1]) <> ''))
-                        {
-                          suffix := replace (e.ve_params [N], 's_fld_2_', '');
-                          tmp_s := vector_concat (tmp_s, vector (vector (get_keyword ('s_fld_1_'||suffix, e.ve_params, ''), get_keyword ('s_fld_2_'||suffix, e.ve_params, ''), get_keyword ('s_fld_3_'||suffix, e.ve_params, ''))));
-                        }
-                      }
-                      tmp_s := vector_concat (vector (vector ('v1.0', length (tmp_s))), tmp_s);
-                      self.acl := serialize (tmp_s);
 
                           declare exit handler for sqlstate '23000'
                           {
@@ -267,8 +237,7 @@
                                  WAI_INST = inst,
                                  WAI_NAME = inst.wa_name,
                                    WAI_DESCRIPTION = self.idesc1.ufl_value,
-                             WAI_LICENSE = self.ilic1.ufl_value,
-                             WAI_ACL = self.acl
+                                  WAI_LICENSE = self.ilic1.ufl_value
                            where WAI_ID = self.iid;
                           commit work;
 
@@ -278,8 +247,10 @@
                         ]]>
                       </v:on-post>
                     </v:button>
-              </div>
-            </div>
+                  </span>
+                 </td>
+              </tr>
+            </table>
           </v:form>
         </div>
       </vm:body>
diff --git a/appsrc/ODS-Framework/edit_interests_popup.vspx b/appsrc/ODS-Framework/edit_interests_popup.vspx
index f7636db..e8b7c48 100644
--- a/appsrc/ODS-Framework/edit_interests_popup.vspx
+++ b/appsrc/ODS-Framework/edit_interests_popup.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: edit_interests_popup.vspx,v 1.2 2008/12/22 23:47:33 source Exp $
+ -  $Id: edit_interests_popup.vspx,v 1.2.2.1 2010/09/20 10:15:19 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/edit_rule.vspx b/appsrc/ODS-Framework/edit_rule.vspx
index 459d80f..1da184a 100644
--- a/appsrc/ODS-Framework/edit_rule.vspx
+++ b/appsrc/ODS-Framework/edit_rule.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: edit_rule.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: edit_rule.vspx,v 1.4.2.1 2010/09/20 10:15:19 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/error.vspx b/appsrc/ODS-Framework/error.vspx
index fdc86a9..7e72df3 100644
--- a/appsrc/ODS-Framework/error.vspx
+++ b/appsrc/ODS-Framework/error.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: error.vspx,v 1.5 2006/10/20 16:01:20 source Exp $
+ -  $Id: error.vspx,v 1.5.2.1 2010/09/20 10:15:19 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/facebook.sql b/appsrc/ODS-Framework/facebook.sql
index 0e127ec..8b255b9 100644
--- a/appsrc/ODS-Framework/facebook.sql
+++ b/appsrc/ODS-Framework/facebook.sql
@@ -1,5 +1,5 @@
 --
---  $Id: facebook.sql,v 1.14.2.3 2010/03/12 09:10:12 source Exp $
+--  $Id: facebook.sql,v 1.14.2.7 2010/12/10 16:04:14 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -82,8 +82,6 @@ create constructor method FacebookRestClient(
   self.last_call_id := 0;
   self.server_addr  := get_facebook_url('api')||'/restserver.php';
   self.debug_mode   := 0; --set this to 1 if you want to see error xml on server console
-
-  return;
 }
 ;
 
@@ -100,12 +98,12 @@ create method auth_getSession(
        self.session_key := cast(xpath_eval('/auth_getSession_response/session_key',_result) as varchar);
        _user:=cast(xpath_eval('/auth_getSession_response/uid',_result) as integer);
 
-       if (cast(xpath_eval('/auth_getSession_response/secret',_result) as varchar) is not null) {
+    if (cast(xpath_eval('/auth_getSession_response/secret',_result) as varchar) is not null)
          -- desktop apps have a special secret
          self.secret := cast(xpath_eval('/auth_getSession_response/secret',_result) as varchar);
-       }
+
        return vector(self.session_key,_user);
-    }else
+  }
        return null;
 }
 ;
@@ -121,14 +119,9 @@ create method call_method(
   declare res_xml varchar;
 
     res_xml := self.post_request(method, params);
---    dbg_obj_print(res_xml);
     _result:=xtree_doc(res_xml);
-
-
     if(xpath_eval('/error_response',_result) is not null )
     {
---       dbg_obj_print(cast(xpath_eval('/error_response/error_code',_result) as varchar));
-
        if(self.debug_mode=1)
        {
           dbg_obj_print('Facebook REST API returns ERROR XML');
@@ -165,9 +158,7 @@ create method post_request(
     }
 
   if (get_keyword('v',params,null) is null)
-  {
         params := vector_concat(params,vector('v','1.0'));
-    }
 
     params := vector_concat(params,vector('sig',self.generate_sig(params, self.secret))); --'e54f374e470893968b6c9457e69c6f7a'
     declare _result,aResult any;
@@ -210,54 +201,32 @@ create method generate_sig(
 for DB.DBA.FacebookRestClient
 {
     declare str varchar;
-    str := '';
-
     declare params_key any;
-    params_key:=vector();
-
     declare i,l integer;
+  declare _key, _val varchar;
 
-    i := 0;
     l := length (params_array);
-
-    while (i < l)
+  params_key := vector();
+  for (i := 0; i < l; i := i + 2)
     {
-      declare _key, _val varchar;
-
       _key := trim(cast(params_array[i] as varchar));
       _val := params_array[i+1];
---      if (_val is not null)
---          _val := trim (_val);
-
       params_key:=vector_concat(params_key,vector(_key));
-
-      i := i + 2;
     }
-    ;
-
 
    params_key:=__vector_sort(params_key);
-
-   i := 0;
+  str := '';
    l := length (params_key);
-
-   while (i < l)
+  for (i := 0; i < l; i := i + 1)
    {
-     declare _key, _val varchar;
      _key := params_key[i];
      _val := get_keyword(_key,params_array);
      if (_val is not null)
          _val := trim (cast(_val as varchar));
 
-
      str := str || _key || '=' || _val;
-
-     i := i + 1;
    }
-   ;
-
    str := str||secret;
-
    return md5(str);
 }
 ;
@@ -292,7 +261,8 @@ create method events_get(
                'eids', eids,
                'start_time', start_time,
                'end_time', end_time,
-               'rsvp_status', rsvp_status));
+                                 'rsvp_status', rsvp_status)
+                         );
  }
 ;
 
@@ -483,7 +453,10 @@ create method notifications_send(
 )
 for DB.DBA.FacebookRestClient
 {
-    return self.call_method('facebook.notifications.send',vector('to_ids',to_ids, 'notification', notification, 'email', email));
+  return self.call_method('facebook.notifications.send',
+                          vector('to_ids', to_ids,
+                                 'notification', notification,
+                                 'email', email));
 }
 ;
 
@@ -507,7 +480,11 @@ create method notifications_sendRequest(
 for DB.DBA.FacebookRestClient
 {
     return self.call_method('facebook.notifications.sendRequest',
-                             vector('to_ids', to_ids, 'type', type, 'content', content, 'image', image, 'invite', invite));
+                           vector('to_ids', to_ids,
+                                  'type', type,
+                                  'content', content,
+                                  'image', image,
+                                  'invite', invite));
 }
 ;
 --  /**
@@ -586,27 +563,20 @@ for DB.DBA.FacebookRestClient
 create method users_isAppAdded()
 for DB.DBA.FacebookRestClient
 {
-    if (self.added is not null) {
+  if (self.added is not null)
       return self.added;
-    }else
-    {
+
       declare _xmle any;
-      _xmle:=self.call_method('facebook.users.isAppAdded', vector());
 
+  _xmle := self.call_method('facebook.users.isAppAdded', vector());
       if(_xmle is not null)
-      {
          _xmle:=xpath_eval('/users_isAppAdded_response',_xmle);
 
-      }
-
       if(_xmle is not null)
       {
          self.added:=cast(_xmle as integer);
          return self.added;
       }
-
-    }
-
     return 0;
 }
 ;
@@ -627,9 +597,11 @@ create method friends_areFriends(
 for DB.DBA.FacebookRestClient
 {
     return self.call_method('facebook.friends.areFriends',
-        vector('uids1',uids1, 'uids2', uids2));
+                          vector('uids1', uids1,
+                                 'uids2', uids2));
 }
 ;
+
 --  /**
 --   * Returns the friends of the current session user.
 --   * @return array of friends
@@ -637,13 +609,12 @@ for DB.DBA.FacebookRestClient
 create method friends_get()
 for DB.DBA.FacebookRestClient
 {
-
-    if (self.friends_list is not null and length(self.friends_list)>0) {
+  if (self.friends_list is not null and length(self.friends_list)>0)
       return self.friends_list;
-    }else
-    {
+
       declare _xmle,friends_arr any;
       declare i,friends_num integer;
+
       _xmle:=self.call_method('facebook.friends.get', vector());
       if(_xmle is not null)
       {
@@ -651,19 +622,15 @@ for DB.DBA.FacebookRestClient
 
          if(length(_xmle)>0)
             friends_num:=length(_xmle);
+
          friends_arr:=vector();
-         i := 0;
-         while (i < friends_num)
+    for (i := 0; i < friends_num; i := i + 1)
          {
            friends_arr:=vector_concat(friends_arr,vector(cast(_xmle[i] as varchar)));
-           i := i + 1;
          }
-
          if(length(friends_arr)>0)
             return friends_arr;
       }
-    }
-
      return self.call_method('facebook.friends.get', vector());
 }
 ;
@@ -793,8 +760,8 @@ for DB.DBA.Facebook
 
     if(isstring(expires) and expires='0')
          expires:=dateadd ('day', 15, now());
-    else expires:=now();
-
+  else
+    expires := now();
 
     expires_str := sprintf (' expires=%s;', date_rfc1123 (dateadd ('hour', 1, expires)));
 
@@ -898,9 +865,8 @@ for DB.DBA.Facebook
     }
     if( self.fb_params is not null)
        return 1;
-    else
-       return 0;
 
+  return 0;
 }
 ;
 
@@ -944,12 +910,11 @@ for DB.DBA.Facebook
 --    }
 
   if (get_keyword(namespace,params) is null OR self.verify_signature(fb_params, get_keyword(namespace,params))=0)
-  {
       return vector();
-    }
+
     if(length(fb_params)=0)
        return null;
-    else
+
        return fb_params;
 }
 ;
@@ -962,7 +927,7 @@ for DB.DBA.Facebook
 {
     if (self.api_client.generate_sig(fb_params, self.secret) = expected_sig)
         return 1;
-    else
+
         return 0;
 }
 ;
@@ -972,7 +937,7 @@ for DB.DBA.Facebook
 {
   if(get_keyword('in_canvas',self.fb_params,'')<>'')
      return 1;
-  else
+
      return 0;
 }
 ;
@@ -992,7 +957,7 @@ for DB.DBA.Facebook
                                                dbg_obj_print(__SQL_STATE);
                                                dbg_obj_print(__SQL_MESSAGE);
                                                dbg_obj_print('-------------------');
-                                            };
+    }
                                             return null;
                                           };
     auth_res:=self.api_client.auth_getSession(auth_token);
@@ -1054,7 +1019,7 @@ create method get_add_url(
 for DB.DBA.Facebook
 {
     declare add_url varchar;
-    add_url:='';
+
     add_url:=get_facebook_url()||'/add.php?api_key='||self.api_key;
     if(_next is not null)
        add_url:=add_url||'&next=' || sprintf('%U',_next);
@@ -1185,7 +1150,9 @@ create procedure _get_cookie_vec (in lines any)
 }
 ;
 
-create procedure _get_ods_fb_settings (out fb_settings any, in fb_user_id integer := 0)
+create procedure _get_ods_fb_settings (
+  out fb_settings any,
+  in fb_user_id integer := 2)
 {
    declare dba_options,fb_dba_options any;
    declare exit handler for sqlstate '*' {return 0;};
@@ -1213,8 +1180,7 @@ create procedure valid_abid_by_fbid (
                  in logged_odsuser_id integer,
                  inout fbf_data any,
                  in ab_domain_id integer,
-                 in validation_arr any :=null
-                 )
+  in validation_arr any := null)
 {
     declare valid_id_arr any;
     valid_id_arr:=null;
@@ -1250,10 +1216,9 @@ create procedure valid_abid_by_fbid (
       {
         declare _key varchar;
         declare _val,_tmpval any;
+
         _key:=validate_by_fields[k];
         _val:=validate_by_fields[k+1];
-        _tmpval:='';
-
         if(_val is not null and (_val=1 or _val='1'))
         {
           if(_key='P_FULL_NAME' and length(full_name)>0 )
@@ -1341,16 +1306,9 @@ create procedure valid_abid_by_fbid (
                     '       or (concat(trim(P_FIRST_NAME),'' '',trim(P_LAST_NAME))=''%s'') '||
                     '       or (concat(trim(P_MIDDLE_NAME),'' '',trim(P_LAST_NAME))=''%s'') )',
                     ab_domain_id,last_name,first_name,first_name,full_name,full_name,full_name);
-    }else
-    {
-       qry:=sprintf('select P_ID from AB.WA.PERSONS '||
-                    'where P_DOMAIN_ID=%d %s',
-                    ab_domain_id,validation_sql);
-
+  } else {
+    qry:=sprintf('select P_ID from AB.WA.PERSONS where P_DOMAIN_ID=%d %s', ab_domain_id, validation_sql);
     }
-
-
-
     exec (qry, state, msg, vector(), maxrows, metas, rset);
     if (state = '00000' and length(rset)>0)
     {
@@ -1358,13 +1316,26 @@ create procedure valid_abid_by_fbid (
        for(idx:=0;idx<length(rset);idx:=idx+1)
           valid_id_arr:=vector_concat(valid_id_arr,vector(rset[idx][0]));
     }
-
---    if(valid_id_arr is null)
---          dbg_printf('%s',qry);
-
-
     return valid_id_arr;
+}
+;
 
+create procedure sync_fbf_value (
+  in colPath varchar,
+  in colName varchar,
+  inout _xml any,
+  inout _col any,
+  inout _val any)
+{
+  declare tmp any;
+
+  tmp := serialize_to_UTF8_xml (xpath_eval (sprintf ('string(%s)', colPath), _xml));
+  if (tmp <> '')
+  {
+    _col := vector_concat(_col, vector (colName));
+    _val := vector_concat(_val, vector (tmp));
+  }
+  return tmp;
 }
 ;
 
@@ -1385,16 +1356,17 @@ create procedure sync_fbf_odsab (
 --_res_stat[3] - total fb friends count
 --_res_stat[4] - addressbook id if exists
 
+  declare i integer;
+  declare _res any;
 declare _res_stat any;
-
-_res_stat:=vector(0,0,0,0,0);
-
 declare ab_domain_id integer;
-ab_domain_id:=0;
 
-if (ab_domain_id=0)
+  _res_stat := vector(0,0,0,0,0);
+  declare exit handler for not found
 {
-   declare exit handler for not found {ab_domain_id:=0; goto _no_address_book;};
+    ab_domain_id := 0;
+    goto _no_address_book;
+  };
    select top 1 B.WAI_ID into ab_domain_id from WA_MEMBER A, WA_INSTANCE B where A.WAM_MEMBER_TYPE = 1 and A.WAM_INST = B.WAI_NAME and A.WAM_APP_TYPE='AddressBook' and A.WAM_USER=ods_uid ;
 
 _no_address_book:;
@@ -1405,59 +1377,37 @@ _no_address_book:;
     return _res_stat;
   }
   _res_stat[4]:=ab_domain_id;
-}
-;
-
-
-declare _res any;
-
   _res:=fb_obj.api_client.friends_get();
 
-  declare i integer;
-
   if(isarray(_res) and length(_res)>0)
   {
     declare ff_ids varchar;
+
     ff_ids:='';
-    i:=0;
-    while(i<length(_res))
+    for (i := 0; i < length(_res); i := i + 1)
     {
      if(i<(length(_res)-1))
         ff_ids:=ff_ids||_res[i]||',';
      else
         ff_ids:=ff_ids||_res[i];
-
-     i:=i+1;
     }
-
     _res:=fb_obj.api_client.users_getInfo(ff_ids,'name,first_name,last_name,sex,birthday,current_location,work_history,hometown_location,timezone');
-  }else
+  } else {
     _res_stat[0]:=-2;
-
+  }
 
   if(_res is not null)
   {
     _res:=xpath_eval('/users_getInfo_response/user',_res,0);
     if(_res is not null and length(_res)>0)
     {
-      i := 0;
-      while (i < length(_res))
+      for (i := 0; i < length(_res); i := i + 1)
       {
-
-        declare full_name,first_name,last_name varchar;
-        full_name  := trim(xpath_eval('string(name)',_res[i]));
-        first_name := trim(xpath_eval('string(first_name)',_res[i]));
-        last_name  := trim(xpath_eval('string(last_name)',_res[i]));
-
-        if(ab_domain_id>0)
-        {
-
+        declare _p_id integer;
           declare valid_abid_arr any;
-          valid_abid_arr:=valid_abid_by_fbid(ods_uid,_res[i],ab_domain_id);
 
-          declare _p_id integer;
           _p_id:=-1;
-
+        valid_abid_arr := valid_abid_by_fbid(ods_uid, _res[i], ab_domain_id);
           if(valid_abid_arr is not null)
           _p_id:=valid_abid_arr[0];
 
@@ -1473,39 +1423,14 @@ declare _res any;
 
           declare _col, _val any;
           declare _tmpval varchar;
+        declare full_name, first_name, last_name varchar;
+
           _col    :=vector();
           _val    :=vector();
-          _tmpval :='';
-
-          if(full_name<>'')
-          {
-             _col:=vector_concat(_col,vector('P_FULL_NAME'));
-             _val:=vector_concat(_val,vector(full_name));
-          }
-
-          if(first_name<>'')
-          {
-             _col:=vector_concat(_col,vector('P_FIRST_NAME'));
-             _val:=vector_concat(_val,vector(first_name));
-          }
-
-          if(last_name<>'')
-          {
-             _col:=vector_concat(_col,vector('P_LAST_NAME'));
-             _val:=vector_concat(_val,vector(last_name));
-          }
-
-          _tmpval:=trim(xpath_eval('string(sex)',_res[i]));
-          if(_tmpval<>'')
-          {
-             _col:=vector_concat(_col,vector('P_GENDER'));
-             _val:=vector_concat(_val,vector(_tmpval));
-          }
 
           _tmpval:=trim(xpath_eval('string(birthday)',_res[i]));
           if(_tmpval<>'')
           {
-             _col:=vector_concat(_col,vector('P_BIRTHDAY'));
              declare _date date;
              declare _arr any;
 
@@ -1517,83 +1442,29 @@ declare _res any;
              else
                 _date:=stringdate(trim(_arr[1])||'-'||cast(_get_monhtbyname(trim(_arr[0][0])) as varchar)||'-'||trim(_arr[0][1]));
 
+          _col := vector_concat(_col, vector('P_BIRTHDAY'));
              _val:=vector_concat(_val,vector(_date));
           }
-
-          _tmpval:=trim(xpath_eval('string(hometown_location/city)',_res[i]));
-          if(_tmpval<>'')
-          {
-             _col:=vector_concat(_col,vector('P_H_CITY'));
-             _val:=vector_concat(_val,vector(_tmpval));
-          }
-
-
-          _tmpval:=trim(xpath_eval('string(hometown_location/state)',_res[i]));
-          if(_tmpval<>'')
-          {
-             _col:=vector_concat(_col,vector('P_H_STATE'));
-             _val:=vector_concat(_val,vector(_tmpval));
-          }
-
-          _tmpval:=trim(xpath_eval('string(hometown_location/country)',_res[i]));
-          if(_tmpval<>'')
-          {
-             _col:=vector_concat(_col,vector('P_H_COUNTRY'));
-             _val:=vector_concat(_val,vector(_tmpval));
-          }
-
-          _tmpval:=trim(xpath_eval('string(hometown_location/zip)',_res[i]));
-          if(_tmpval<>'')
-          {
-             _col:=vector_concat(_col,vector('P_H_CODE'));
-             _val:=vector_concat(_val,vector(_tmpval));
-          }
-
-
-          _tmpval:=trim(xpath_eval('string(work_history/work_info[1]/location/city)',_res[i]));
-          if(_tmpval<>'')
-          {
-             _col:=vector_concat(_col,vector('P_B_CITY'));
-             _val:=vector_concat(_val,vector(_tmpval));
-          }
-
-          _tmpval:=trim(xpath_eval('string(work_history/work_info[1]/location/state)',_res[i]));
-          if(_tmpval<>'')
-          {
-             _col:=vector_concat(_col,vector('P_B_STATE'));
-             _val:=vector_concat(_val,vector(_tmpval));
-          }
-
-          _tmpval:=trim(xpath_eval('string(work_history/work_info[1]/location/country)',_res[i]));
-          if(_tmpval<>'')
-          {
-             _col:=vector_concat(_col,vector('P_B_COUNTRY'));
-             _val:=vector_concat(_val,vector(_tmpval));
-          }
-
-          _tmpval:=trim(xpath_eval('string(work_history/work_info[1]/company_name)',_res[i]));
-          if(_tmpval<>'')
-          {
-             _col:=vector_concat(_col,vector('P_B_ORGANIZATION'));
-             _val:=vector_concat(_val,vector(_tmpval));
-          }
-
-
-          _tmpval:=trim(xpath_eval('string(work_history/work_info[1]/position)',_res[i]));
-          if(_tmpval<>'')
-          {
-             _col:=vector_concat(_col,vector('P_B_JOB'));
-             _val:=vector_concat(_val,vector(_tmpval));
-          }
-
+        full_name  := sync_fbf_value ('name', 'P_FULL_NAME', _res[i], _col, _val);
+        first_name := sync_fbf_value ('first_name', 'P_FIRST_NAME', _res[i], _col, _val);
+        last_name  := sync_fbf_value ('last_name', 'P_LAST_NAME', _res[i], _col, _val);
+        sync_fbf_value ('sex', 'P_GENDER', _res[i], _col, _val);
+        sync_fbf_value ('hometown_location/city', 'P_H_CITY', _res[i], _col, _val);
+        sync_fbf_value ('hometown_location/state', 'P_H_STATE', _res[i], _col, _val);
+        sync_fbf_value ('hometown_location/country', 'P_H_COUNTRY', _res[i], _col, _val);
+        sync_fbf_value ('hometown_location/zip', 'P_H_CODE', _res[i], _col, _val);
+        sync_fbf_value ('work_history/work_info[1]/location/city', 'P_B_CITY', _res[i], _col, _val);
+        sync_fbf_value ('work_history/work_info[1]/location/state', 'P_B_STATE', _res[i], _col, _val);
+        sync_fbf_value ('work_history/work_info[1]/location/country', 'P_B_COUNTRY', _res[i], _col, _val);
+        sync_fbf_value ('work_history/work_info[1]/company_name', 'P_B_ORGANIZATION', _res[i], _col, _val);
+        sync_fbf_value ('work_history/work_info[1]/position', 'P_B_JOB', _res[i], _col, _val);
           if(trim(coalesce(full_name,first_name||' '||last_name))<>'')
           {
             if(_p_id=-1)
             {
                declare _np_id integer;
-               _np_id:=-1;
-               _np_id:=AB.WA.contact_update2 (_p_id,ab_domain_id,'P_NAME',full_name);
 
+            _np_id := AB.WA.contact_update2 (_p_id, ab_domain_id, 'P_NAME', full_name);
                if(_np_id>-1)
                {
                   AB.WA.contact_update3 (_np_id,ab_domain_id,_col,_val,'');
@@ -1606,14 +1477,8 @@ declare _res any;
                AB.WA.contact_update3 (_p_id,ab_domain_id,_col,_val,'');
                _res_stat[2]:=_res_stat[2]+1;
             }
-
-          }
-
         }
 _skip_parseandupdate:;
-
-        i := i + 1;
-
       }
     }
   }
@@ -1645,74 +1510,45 @@ create procedure get_syncdata_arr (
                  in simple integer :=0
 )
 {
-
-declare _res_str varchar;
-_res_str:=string_output();
-
+  declare i, k integer;
 declare ab_domain_id integer;
-ab_domain_id:=0;
-
-if (ab_domain_id=0)
-{
-   declare exit handler for not found {ab_domain_id:=0; goto _no_address_book;};
-   select top 1 B.WAI_ID into ab_domain_id from WA_MEMBER A, WA_INSTANCE B where A.WAM_MEMBER_TYPE = 1 and A.WAM_INST = B.WAI_NAME and A.WAM_APP_TYPE='AddressBook' and A.WAM_USER=ods_uid ;
+  declare _res any;
+  declare _res_str varchar;
 
-_no_address_book:;
-
-  if(ab_domain_id=0)
-  {
+  ab_domain_id := (select top 1 B.WAI_ID from WA_MEMBER A, WA_INSTANCE B where A.WAM_MEMBER_TYPE = 1 and A.WAM_INST = B.WAI_NAME and A.WAM_APP_TYPE='AddressBook' and A.WAM_USER=ods_uid);
+  if (isnull (ab_domain_id))
     return 'No addressbook instance';
-  }
-}
-;
-
-
-declare _res any;
 
+  _res_str := string_output();
   _res:=fb_obj.api_client.friends_get();
+  if (not (isarray(_res) and length(_res) > 0))
+    return 'REST API error';
 
-  declare i integer;
-
-  if(isarray(_res) and length(_res)>0)
-  {
     declare ff_ids varchar;
+
     ff_ids:='';
-    i:=0;
-    while(i<length(_res))
+  for (i := 0; i<length(_res); i:=i+1)
     {
      if(i<(length(_res)-1))
         ff_ids:=ff_ids||_res[i]||',';
      else
         ff_ids:=ff_ids||_res[i];
-
-     i:=i+1;
     }
-
     _res:=fb_obj.api_client.users_getInfo(ff_ids,'name,first_name,last_name,sex,birthday,current_location,work_history,hometown_location,timezone');
 
-  }else
-    return 'REST API error';
-
-
   if(_res is not null)
   {
-
      http ('new Array(', _res_str);
-
     _res:=xpath_eval('/users_getInfo_response/user',_res,0);
     if(_res is not null and length(_res)>0)
     {
-      i := 0;
-      while (i < length(_res))
+      for (i := 0; i < length(_res); i := i + 1)
       {
         declare uid,full_name,first_name,last_name varchar;
-        uid        := trim(xpath_eval('string(uid)',_res[i]));
-        full_name  := trim(xpath_eval('string(name)',_res[i]));
-        first_name := trim(xpath_eval('string(first_name)',_res[i]));
-        last_name  := trim(xpath_eval('string(last_name)',_res[i]));
-
-        if(ab_domain_id>0)
-        {
+        uid        := serialize_to_UTF8_xml (xpath_eval('string(uid)',_res[i]));
+        full_name  := serialize_to_UTF8_xml (xpath_eval('string(name)',_res[i]));
+        first_name := serialize_to_UTF8_xml (xpath_eval('string(first_name)',_res[i]));
+        last_name  := serialize_to_UTF8_xml (xpath_eval('string(last_name)',_res[i]));
 
           declare addressbook_cid_arr any;
           declare addressbook_cid_sqlstr varchar;
@@ -1722,89 +1558,65 @@ declare _res any;
 
 --          dbg_obj_print(addressbook_cid_arr);
           if(addressbook_cid_arr is not null and length(addressbook_cid_arr)>0)
-          { if(length(addressbook_cid_arr)=1)
-                addressbook_cid_sqlstr:=sprintf(' = %d',addressbook_cid_arr[0]);
-            else
             {
+          if (length(addressbook_cid_arr) = 1)
+          {
+            addressbook_cid_sqlstr := sprintf(' = %d',addressbook_cid_arr[0]);
+          } else {
               declare m integer;
               declare _tmp_str varchar;
-              _tmp_str:='';
 
+            _tmp_str := '';
               for(m:=0; m<length(addressbook_cid_arr); m:=m+1)
               {
                   if(m=0)
                      _tmp_str:=sprintf('%d',addressbook_cid_arr[m]);
                   else
                      _tmp_str:=sprintf('%s,%d',_tmp_str,addressbook_cid_arr[m]);
-
               }
                 addressbook_cid_sqlstr:=sprintf(' in  (%s)',_tmp_str);
-
             }
-
           }
 
-          declare qry,state, msg, maxrows, metas, rset any;
+        declare qry, state, msg, metas, rset any;
 
-          rset := null;
-          maxrows := 0;
           state := '00000';
-          msg := '';
-
---          qry:=sprintf('select P_ID,P_NAME,AB.WA.contact_url (P_DOMAIN_ID,P_ID) from AB.WA.PERSONS where (P_FULL_NAME=''%s'' or P_FIRST_NAME=''%s'' or P_LAST_NAME=''%s'') and P_DOMAIN_ID=%d',full_name,first_name,last_name,ab_domain_id);
           if(addressbook_cid_sqlstr='')
           {
-
-          qry:=sprintf('select top 1 -1,''New contact'',P_DOMAIN_ID,-1 from AB.WA.PERSONS '||
-                       'where P_DOMAIN_ID=%d ',
+          qry := sprintf('select top 1 -1, ''New contact'', P_DOMAIN_ID, -1 from AB.WA.PERSONS where P_DOMAIN_ID=%d ',
                        ab_domain_id);
-          }else
-          qry:=sprintf('select P_ID,P_NAME,P_DOMAIN_ID,P_ID from AB.WA.PERSONS '||
-                       'where P_DOMAIN_ID=%d '||
-                       ' and P_ID%s',
+        } else {
+          qry := sprintf('select P_ID, P_NAME, P_DOMAIN_ID, P_ID from AB.WA.PERSONS where P_DOMAIN_ID=%d and P_ID%s',
                        ab_domain_id,addressbook_cid_sqlstr);
-
-
---          dbg_printf(qry);
-
-          exec (qry, state, msg, vector(), maxrows, metas, rset);
+        }
+        exec (qry, state, msg, vector(), 0, metas, rset);
           if (state = '00000' and length(rset)>0)
           {
-            if(i>0) http ('\r\n,', _res_str);
+          if (i > 0)
+            http ('\r\n,', _res_str);
             if(simple=1)
             http ('{fb_id:'||cast(uid as varchar)||',', _res_str);
             else
             http ('{_name:"'||full_name||'",fb_id:'||cast(uid as varchar)||',fb_href:"http://www.facebook.com/profile.php?id='||cast(uid as varchar)||'",odsab_instid:'||cast(ab_domain_id as varchar)||',ods_contacts:new Array(', _res_str);
 
-            declare k integer;
             k:=0;
             if(simple)
             {
              http ('ods_cid:'||cast(rset[k][0] as varchar)||'}', _res_str);
-            }else
-            {
-             while (k < length(rset))
+          } else {
+            for (k := 0; k < length(rset); k := k + 1)
              {
 	             http ('{ods_cid:'||cast(rset[k][0] as varchar)||',ods_name:"'||cast(rset[k][1] as varchar)||'",ods_href:"'||sprintf('/dataspace/%U/addressbook/%U/%d',WA_APP_GET_OWNER(rset[k][2]),replace (AB.WA.domain_name (rset[k][2]), '+', '%2B'),rset[k][3])||'"}', _res_str);
 	             if(k < length(rset)-1)
 	                http (',', _res_str);
-
-	             k:=k+1;
 	           }
              http (')}', _res_str);
             }
-
 	        }
         }
-        i := i + 1;
-
-      }
     }
-
    http (')', _res_str);
-
   }
-
 return string_output_string(_res_str);
 }
 ;
@@ -1822,33 +1634,23 @@ create procedure DB.DBA.fbf_rdf_load_fql (
 
   SPARQL CLEAR GRAPH <graph_iri>;
 
-
   own := fb_uid;
-
   q :=  sprintf ('SELECT uid, first_name, last_name, name, pic_small, pic_big, pic_square, pic, affiliations, profile_update_time, timezone, religion, birthday, sex, hometown_location, meeting_sex, meeting_for, relationship_status, significant_other_id, political, current_location, activities, interests, is_app_user, music, tv, movies, books, quotes, about_me, hs_info, education_history, work_history, notes_count, wall_count, status, has_added_app FROM user WHERE uid = %s', own);
---  ret := DB.DBA.FQL_CALL (q, api_key, ses_id, secret);
     ret := fb_obj.api_client.fql_query(q);
---dbg_printf ('%s', ret);
---  xt := xtree_doc (ret);
   if(ret is not null)
   {
    xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/fql2rdf.xsl', ret, vector ('baseUri', coalesce (dest, graph_iri)));
    xd := serialize_to_UTF8_xml (xt);
---   dbg_printf ('%s', xd);
    DB.DBA.RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
   }
-
   q := sprintf ('SELECT aid, cover_pid, owner, name, created, modified, description, location, size, link FROM album WHERE owner = %s', own);
   ret := fb_obj.api_client.fql_query(q);
   if(ret is not null)
   {
-
     xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/fql2rdf.xsl', ret, vector ('baseUri', coalesce (dest, graph_iri)));
     xd := serialize_to_UTF8_xml (xt);
---    dbg_printf ('%s', xd);
     DB.DBA.RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
   }
-
   q := sprintf ('select eid, name, tagline, nid, pic_small, pic_big, pic, host, description, event_type, event_subtype, '||
                 ' start_time, end_time, creator, update_time, location, venue from event where eid in '||
                 '(SELECT eid FROM event_member where uid = %s)', own);
@@ -1864,25 +1666,20 @@ create procedure DB.DBA.fbf_rdf_load_fql (
   {
      q := sprintf ('select uid2 from friend where uid1 = %s', own);
      ret := fb_obj.api_client.fql_query(q);
---     dbg_printf ('%s', ret);
      if(ret is not null)
      {
         xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/fql2rdf.xsl', ret, vector ('baseUri', coalesce (dest, graph_iri)));
         xd := serialize_to_UTF8_xml (xt);
---      dbg_printf ('%s', xd);
         DB.DBA.RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
-     };
-
+    }
      q := sprintf ('SELECT uid, first_name, last_name, name, pic_small, pic_big, pic_square, pic, profile_update_time, timezone, religion, birthday, sex, current_location FROM user WHERE uid IN (select uid2 from friend where uid1 = %s)', own);
      ret := fb_obj.api_client.fql_query(q);
---     dbg_printf ('%s', ret);
      if(ret is not null)
      {
         xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/fql2rdf.xsl', ret, vector ('baseUri', coalesce (dest, graph_iri)));
         xd := serialize_to_UTF8_xml (xt);
-        --dbg_printf ('%s', xd);
         DB.DBA.RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
-     };
+    }
   }
   return 1;
 }
diff --git a/appsrc/ODS-Framework/facebook_helper.vsp b/appsrc/ODS-Framework/facebook_helper.vsp
index 902f231..ec0487a 100644
--- a/appsrc/ODS-Framework/facebook_helper.vsp
+++ b/appsrc/ODS-Framework/facebook_helper.vsp
@@ -1,7 +1,7 @@
 <?vsp
 --   search_ajax.vsp
 --
---   $Id: facebook_helper.vsp,v 1.6 2008/03/13 20:50:05 source Exp $
+--   $Id: facebook_helper.vsp,v 1.6.2.1 2010/09/20 10:15:20 source Exp $
 --
 --   AJAX Handler for the google map control
 --
diff --git a/appsrc/ODS-Framework/faq.html b/appsrc/ODS-Framework/faq.html
index ffd9871..5dda372 100644
--- a/appsrc/ODS-Framework/faq.html
+++ b/appsrc/ODS-Framework/faq.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
  -
- -  $Id: faq.html,v 1.6 2008/03/13 20:50:05 source Exp $
+ -  $Id: faq.html,v 1.6.2.1 2010/09/20 10:15:20 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/fb_front.vspx b/appsrc/ODS-Framework/fb_front.vspx
index 9f343df..c102b5b 100644
--- a/appsrc/ODS-Framework/fb_front.vspx
+++ b/appsrc/ODS-Framework/fb_front.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: fb_front.vspx,v 1.15.2.5 2010/03/12 09:10:12 source Exp $
+ -  $Id: fb_front.vspx,v 1.15.2.8 2010/09/20 10:15:20 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -80,8 +80,7 @@
             if(_qstr_pos>0)
             {
                params := vector_concat (subseq (params, 0, _qstr_pos-1),
-                                        vector('_http_query_str',_http_query_str),
-                                        subseq (params, _qstr_pos));
+                                         vector('_http_query_str', _http_query_str), subseq (params, _qstr_pos));
             } else {
                params:=vector_concat(params, vector('_http_query_str',_http_query_str));
           }
@@ -99,17 +98,12 @@
           self._ods_u_name:=_user_name;
 
           declare _ods_fb_id,_fb_user_assocexist integer;
-
-          declare exit handler for not found {
-          _ods_fb_id:=null;
-          };
-            select WAUI_FACEBOOK_ID into _ods_fb_id from DB.DBA.WA_USER_INFO where WAUI_U_ID=_user_id;
-
           declare _cfb_id integer;
           declare _cfb_session varchar;
           declare _fb_user integer;
           declare fb_dba_options any;
 
+            _ods_fb_id := (select WAUI_FACEBOOK_ID from DB.DBA.WA_USER_INFO where WAUI_U_ID = _user_id);
             if (_get_ods_fb_settings(fb_dba_options)) --fb_dba_options is array of type (facebook_api_key,facebook_api_secret)
           {
              self._fb_isset:=1;
@@ -129,8 +123,8 @@
           self.syncdata_arr:=vector();
 
           declare _html,_src,_fb_user_fullname varchar;
-          _fb_user_fullname:='';
 
+            _fb_user_fullname := '';
           if(self._fb_isset)
           {
             _fb_user_assocexist:=0;
@@ -167,20 +161,21 @@
                if (_fb_user<>0 and _user_name is not null)
                {
                  if(_assoc_action='assoc')
+                  {
                     update DB.DBA.WA_USER_INFO set WAUI_FACEBOOK_ID=_fb_user where WAUI_U_ID=_user_id;
-
-                 if(_assoc_action='unassoc')
+                  }
+                  else if (_assoc_action = 'unassoc')
+                  {
                     update DB.DBA.WA_USER_INFO set WAUI_FACEBOOK_ID=null where WAUI_U_ID=_user_id;
                }
             }
-
-
-
+              }
 
             -- ODS autologin for ODS use that has signed in to FB but not to ODS and he has connected his ods user to facebook user
             if(_fb_user<>0 and _user_name is null)
             {
-              declare exit handler for not found {
+                declare exit handler for not found
+                {
                 _user_name := null;
                 _user_id := null;
               };
@@ -310,32 +305,27 @@
               self._dhtml:=vector_concat(self._dhtml,vector('friends',_html));
               if(get_keyword('import', params,'')='create_import')
               {
-                 declare _inst_id integer;
-
-                 _inst_id:=DB.DBA.ODS_CREATE_NEW_APP_INST ('AddressBook', _user_name||'\'s AddressBook', _user_name);
-
+                  DB.DBA.ODS_CREATE_NEW_APP_INST ('AddressBook', _user_name||'''s AddressBook', _user_name);
                  sync_fbf_odsab(self._fb,_user_id,_fb_user);
               }
-
               if(get_keyword('import', params,'')='import')
                  sync_fbf_odsab(self._fb,_user_id,_fb_user);
 
               self._sync:=0;
               if(get_keyword('import', params,'')='update')
               {
-                 self._sync:=1;
                  declare syncdata_jsarrstr varchar;
-                 syncdata_jsarrstr:='';
-                 syncdata_jsarrstr:=get_syncdata_arr(self._fb,_user_id,1);
 
+                  self._sync := 1;
+                  syncdata_jsarrstr := get_syncdata_arr(self._fb,_user_id, 1);
                  if(length(syncdata_jsarrstr))
                   self._dhtml:=vector_concat(self._dhtml,vector('syncdata_jsarrstr',syncdata_jsarrstr));
               }
               else if (get_keyword('import', params,'')='updateadvanced')
               {
-                 self._sync:=2;
                  declare syncdata_jsarrstr varchar;
-                 syncdata_jsarrstr:='';
+
+                  self._sync := 2;
                  syncdata_jsarrstr:=get_syncdata_arr(self._fb,_user_id);
                  if(length(syncdata_jsarrstr))
                   self._dhtml:=vector_concat(self._dhtml,vector('syncdata_jsarrstr',syncdata_jsarrstr));
@@ -357,14 +347,13 @@
 
                _html:=_html||'<br/>';
             }
-
             if(_user_id is not null and _fb_user>0 and _are_assoc=0)
             {
-               _html:=_html||'<br/>'||_user_name||' and '||_fb_user_fullname||' are not <a id="a_assoc_1" style="text-decoration: underline;cursor: pointer;">connected</a>.<br/> <a href="'||self.odsbar_ods_gpath ||wa_expand_url('fb_front.vspx?assoc=assoc',self._ods_login_params)||'">Do you want to connect them?</a>';
+                _html := _html||'<br/>'||_user_name||' and '||_fb_user_fullname||' are not logically connected in ODS.<br /> <a href="'||self.odsbar_ods_gpath ||wa_expand_url('fb_front.vspx?assoc=assoc',self._ods_login_params)||'">Do you want to connect them?</a>';
             }
             else if (_user_id is not null and _fb_user<>0 and _are_assoc=1)
             {
-               _html:=_html||'<br/>'||_user_name||' and '||_fb_user_fullname||' are <a id="a_assoc_2" style="text-decoration: underline;cursor: pointer;">connected</a>. <a href="'||self.odsbar_ods_gpath ||wa_expand_url('fb_front.vspx?assoc=unassoc',self._ods_login_params)||'">Disconnect?</a>';
+                _html := _html||'<br/>'||_user_name||' and '||_fb_user_fullname||' are logically connected in ODS.<br /><a href="'||self.odsbar_ods_gpath ||wa_expand_url('fb_front.vspx?assoc=unassoc',self._ods_login_params)||'">Disconnect?</a>';
             }
             else if(_user_id is not null and _fb_user=0)
             {
@@ -390,15 +379,15 @@
 
               if(isarray(contatcst_import_res) and contatcst_import_res[0]=0 and contatcst_import_res[1]>0)
                 _html:=_html||'<br/><br/>You have '||cast(contatcst_import_res[1] as varchar)||' Facebook contact'||(case when contatcst_import_res[1]>1 then 's' else '' end)||
-                              ' that may be imported to your <a href="'||wa_expand_url(dataspace_url,self._ods_login_params)||'">ODS AddressBook</a>. <a href="'||self.odsbar_ods_gpath ||wa_expand_url('fb_front.vspx?import=import',self._ods_login_params)||'">Import</a>';
+                                ' that may be imported to your <a href="'||wa_expand_url(dataspace_url,self._ods_login_params)||'">ODS AddressBook</a> application.<br /><a href="'||self.odsbar_ods_gpath ||wa_expand_url('fb_front.vspx?import=import',self._ods_login_params)||'">Import</a>';
 
               if(isarray(contatcst_import_res) and contatcst_import_res[0]=0 and contatcst_import_res[2]>0)
                 _html:=_html||'<br/><br/>You have '||cast(contatcst_import_res[2] as varchar)||' Facebook contact'||(case when contatcst_import_res[2]>1 then 's' else '' end)||
-                              ' that may be updated in your <a href="'||wa_expand_url(dataspace_url,self._ods_login_params)||'">ODS AddressBook</a>. <a href="'||self.odsbar_ods_gpath ||wa_expand_url('fb_front.vspx?import=update',self._ods_login_params)||'">Synchronize</a>';
+                                ' that may be updated in your <a href="'||wa_expand_url(dataspace_url,self._ods_login_params)||'">ODS AddressBook</a> application.<br /><a href="'||self.odsbar_ods_gpath ||wa_expand_url('fb_front.vspx?import=update',self._ods_login_params)||'">Synchronize</a>';
 
               if(isarray(contatcst_import_res) and contatcst_import_res[0]=1 and contatcst_import_res[2]>0)
                 _html:=_html||'<br/><br/>You have '||cast(contatcst_import_res[2] as varchar)||' Facebook contact'||(case when contatcst_import_res[2]>1 then 's' else '' end)||
-                              ' that may be updated in your <a href="'||wa_expand_url(dataspace_url,self._ods_login_params)||'">ODS AddressBook</a>. <a href="'||self.odsbar_ods_gpath ||wa_expand_url('fb_front.vspx?import=update',self._ods_login_params)||'">Synchronize</a>';
+                                ' that may be updated in your <a href="'||wa_expand_url(dataspace_url,self._ods_login_params)||'">ODS AddressBook</a> application.<br /><a href="'||self.odsbar_ods_gpath ||wa_expand_url('fb_front.vspx?import=update',self._ods_login_params)||'">Synchronize</a>';
             }
             self._dhtml:=vector_concat(self._dhtml,vector('ods_user',_html));
 
@@ -406,17 +395,13 @@
 
               _html := 'var validateObj={};';
             validate_by_fields := coalesce ((select deserialize (LV_FIELDS) from LDAP..LDAP_VALIDATION where LV_USER_ID = _user_id), vector());
-            declare i integer;
             if(validate_by_fields is not null and length(validate_by_fields)>0)
             {
+                declare i integer;
                for (i := 0; i < length (validate_by_fields); i := i + 2)
                    _html:=sprintf('%s\nvalidateObj[''%s'']=%s ;',_html,validate_by_fields[i],coalesce(validate_by_fields[i+1],0));
-
             }
-
             self._dhtml:=vector_concat(self._dhtml,vector('validation_obj',_html));
-
-
          }
         ]]>
         </v:before-data-bind>
@@ -452,8 +437,7 @@ function fbInitPrepare()
   ods_bar_state_set('min');
   OAT.Preferences.imagePath='./images/oat/';
   if(typeof(fbInit)!='undefined')
-    OAT.Loader.load(["dock","animation","ajax","xml","combobutton","window","anchor","sparql"],function(){setTimeout(fbInit,80)});
-  return;
+                OAT.Loader.load(["dock","animation","ajax","xml","combobutton","mswin","window","anchor","sparql"], function(){setTimeout(fbInit,80)});
 }
 
 var colors = ["#99c","#cc9","#c8c","#9c9"];
@@ -496,40 +480,6 @@ function dockAdd(win_title,custom_colsize)
   return win;
 }
 
-function assignPopup(element,textContent)
-{
-	var elm = $(element);
-	var popup = OAT.Dom.create("div",{},"popup");
-	OAT.Style.opacity(popup,0);
-	popup.innerHTML = textContent;
-	OAT.Dom.hide(popup);
-	document.body.appendChild(popup);
-
-	var a1 = new OAT.AnimationOpacity(popup,{opacity:1});
-	var a2 = new OAT.AnimationOpacity(popup,{opacity:0});
-
-	OAT.MSG.attach(a2.animation,"ANIMATION_STOP",function(){ /* hide after opacity gets to 0 */
-		OAT.Dom.hide(popup);
-	});
-
-	OAT.Event.attach(elm,"mouseover",function(event) { /* start displaying on mouseover */
-		a2.stop();
-
-		var position = OAT.Event.position(event);
-		popup.style.left = position[0]+"px";
-		popup.style.top = (position[1]+10)+"px";
-
-		OAT.Dom.show(popup);
-		a1.start();
-	});
-
-	OAT.Event.attach(elm,"mouseout",function(event) { /* start hiding on mouseout */
-		a1.stop();
-		a2.start();
-	});
-}
-
-
 function ajaxUpdate(abID,odsCID,fbCID,dockObj,mappingStr)
 {
   var data='sid=<?Vself.sid?>&'+
@@ -563,17 +513,14 @@ function ajaxUpdate(abID,odsCID,fbCID,dockObj,mappingStr)
                                                                   i--;
                                                                 }, 1000);
 
-                                       }
-                                       else
-                                       {
+               } else {
                                         var err_msg_xml  = OAT.Xml.xpath(xmlDoc, '//err_msg', {});
                                         var err_msg='';
                                         if(err_msg_xml.length)
                                            err_msg = OAT.Xml.textValue(err_msg_xml[0]);
                                         $(dockObj.id+'_body').innerHTML='Synchronization unsuccessful due to:'+err_msg
-
                                        }
-                                     };
+             }
 
   OAT.AJAX.POST("facebook_helper.vsp", data, callback, options);
 }
@@ -611,23 +558,18 @@ function ajaxUpdateAdvanced(abID,odsCID,fbCID,dockObj,mappingStr,validationStr,t
                                          {
                                            $(dockObj.id+'_progress').style.width=OAT.Dom.getWH($(dockObj.id+'_bar'))[0]+'px';
                                            $(dockObj.id+'_counterdiv').innerHTML=totalCount+' of '+totalCount+' contacts synchronized';
-                                         }else
-                                         {
+                  } else {
                                            $(dockObj.id+'_progress').style.width=OAT.Dom.getWH($(dockObj.id+'_progress'))[0]+pbUnit+'px';
                                            $(dockObj.id+'_counterdiv').innerHTML=ajaxSuccCallCount+' of '+totalCount+' contacts synchronized';
                                          }
-                                       }
-                                       else
-                                       {
+                } else {
                                         var err_msg_xml  = OAT.Xml.xpath(xmlDoc, '//err_msg', {});
                                         var err_msg='';
                                         if(err_msg_xml.length)
                                            err_msg = OAT.Xml.textValue(err_msg_xml[0]);
                                         $(dockObj.id+'_body').innerHTML='Synchronization unsuccessful due to:'+err_msg
-
                                        }
-                                     };
-
+              }
   OAT.AJAX.POST("facebook_helper.vsp", data, callback, options);
 }
 
@@ -736,14 +678,13 @@ function derefFBP(fbCID)
                                           function constructElm(txt)
                                           {
                                             var simple=simpleUri(txt);
-                                            if(txt.indexOf('http')==0)
-                                            {
+                    if (txt.indexOf('http') == 0) {
                                               var _a=OAT.Dom.create("a");
                                               _a.href=txt;
                                               _a.innerHTML=simple;
                                               _a.target='_blank';
                                               return _a;
-                                            }else
+                    }
                                               return OAT.Dom.text(simple);
                                           }
 
@@ -771,19 +712,14 @@ function derefFBP(fbCID)
                                           var _endpoint='/sparql/';
                                           var _request=buildRequest(optObj);
                                       		OAT.AJAX.POST(_endpoint,_request,resCallback,{type:OAT.AJAX.TYPE_TEXT});
-
-                                       }
-                                       else
-                                       {
+                } else {
                                         var err_msg_xml  = OAT.Xml.xpath(xmlDoc, '//err_msg', {});
                                         var err_msg='';
                                         if(err_msg_xml.length)
                                            err_msg = OAT.Xml.textValue(err_msg_xml[0]);
                                         $(dockObj.id+'_body').innerHTML='Synchronization unsuccessful due to:'+err_msg
-
                                        }
-                                     };
-
+              }
   OAT.AJAX.POST("facebook_helper.vsp", data, callback, options);
 }
 
@@ -850,7 +786,7 @@ function genAbFieldsCb(cbId,defSelection)
   cb.value=defSelection;
 
   OAT.Dom.append([_tr,_td1],[_td1,_label],[_tr,_td2],[_td2,cb])
-  return _tr
+              return _tr;
 }
 
 function getCustomMapping(mappingDockId)
@@ -936,22 +872,15 @@ function fbInit()
  $(friends_win.id+'_body').innerHTML='<?vsp http(get_keyword('friends',self._dhtml,'')); ?>';
  $(ods_win.id+'_body').innerHTML='<?vsp http(get_keyword('ods_user',self._dhtml,'')); ?>';
 
-
- var assoc_txt = 'logically connected in ODS';
- assignPopup("a_assoc_1",assoc_txt);
- assignPopup("a_assoc_2",assoc_txt);
-
-
  derefFBP(<?Vself._fb._user?>);
 
-
 fbfStr='<?vsp http(get_keyword('fbf_jsarrstr',self._dhtml,'')); ?>';
 
  var fbfArr=fbfStr.split(',');
  for(var i=0;i<fbfArr.length;i++)
    derefFBP(fbfArr[i]);
-]]>
 }
+    ]]>
 </script>
 <div id="fbDock"></div>
 </v:template>
@@ -967,15 +896,6 @@ var win_mapping=false
 
 function fbInit()
 {
-
-// dd('<?Vself.syncdata_arr[0]?>'); //fb_user
-// dd('<?Vself.syncdata_arr[1]?>'); //sync_check_res 1 - the same; 0 - different
-// dd('<?Vself.syncdata_arr[2]?>'); //new contacts count
-// dd('<?Vself.syncdata_arr[3]?>'); //update contacts count
-// dd('<?Vself.syncdata_arr[4]?>'); //total contacts count
-// dd('<?Vself.syncdata_arr[5]?>'); //addressbook instance id
-
-
  dock = new OAT.Dock('fbDock',2);
 
  var win_info=dockAdd('Action');
@@ -1304,10 +1224,9 @@ function createImportObjDock(_syncData)
   var d_ods_cid=0;
   for(var ii=0;ii < _syncData.ods_contacts.length;ii++)
   {
-   var _radio=OAT.Dom.radio(_dock_obj.id+'_syncgrp');
-   OAT.Dom.append([_parent_div,_radio]);
+          var _radio = OAT.Dom.create("input", {type: "radio", id: _dock_obj.id+'_syncgrp'});
    _radio.value=_syncData.ods_contacts[ii].ods_cid;
-
+          OAT.Dom.append([_parent_div,_radio]);
     OAT.Event.attach(_radio,"click",function(e){
       if (OAT.Browser.isIE)
                                                 var _objval=e.srcElement.value;
@@ -1351,7 +1270,8 @@ function createImportObjDock(_syncData)
   _cbutton.addOption(""," Default ",function(){
                                                ajaxUpdate(_syncData.odsab_instid,parseInt($(_dock_obj.id+'_body').c_ods_cid),_syncData.fb_id,_dock_obj,getCustomMapping('mappingDivContent'));
                                               })
-	_cbutton.addOption(""," Manual ",function(){ $('manualMappingOK').odsab_instid=_syncData.odsab_instid;
+      	_cbutton.addOption(""," Manual ",function(){
+      	  $('manualMappingOK').odsab_instid=_syncData.odsab_instid;
                                                $('manualMappingOK').c_ods_cid=parseInt($(_dock_obj.id+'_body').c_ods_cid);
                                                $('manualMappingOK').fb_id=_syncData.fb_id;
                                                $('manualMappingOK').dock_obj=_dock_obj;
@@ -1360,70 +1280,8 @@ function createImportObjDock(_syncData)
   _td2.appendChild(_cbutton.div);
 
   OAT.Dom.append([_table,_tbody],[_tbody,_tr],[_tr,_td1,_td2])
-
   OAT.Dom.append([_parent_div,_table,OAT.Dom.create('br')]);
-
-
-
-
-//  var _btnDiv=OAT.Dom.create("div",{padding:'0px 0px 0px 10px',clear: 'both'});
-//
-//
-//   var _def_button=OAT.Dom.create("input",{width:'100px'});
-//   _def_button.type='button';
-//   _def_button.value='Default';
-//   _def_button.id=_dock_obj.id+'_defsyncbtn';
-//   _def_button.c_ods_cid=d_ods_cid;
-//
-//   OAT.Event.attach(_def_button,"click",function(e){if(OAT.Browser.isIE)
-//                                                     var _c_ods_cid = e.srcElement.c_ods_cid;
-//                                                  else
-//                                                     var _c_ods_cid = this.c_ods_cid;
-//                                                  ajaxUpdate(_syncData.odsab_instid,parseInt(_c_ods_cid),_syncData.fb_id,_dock_obj,getCustomMapping('mappingDivContent'));});
-//
-//  _btnDiv.appendChild(_def_button);
-//  _btnDiv.appendChild(OAT.Dom.create("br"));
-
-
-//   var _button=OAT.Dom.create("input",{width:'100px'});
-//   _button.type='button';
-//   _button.value='Manual';
-//
-//   _button.id=_dock_obj.id+'_syncbtn';
-//   _button.c_ods_cid=d_ods_cid;
-//
-//   OAT.Event.attach(_button,"click",function(e){if(OAT.Browser.isIE)
-//                                                     var _c_ods_cid = e.srcElement.c_ods_cid;
-//                                                  else
-//                                                     var _c_ods_cid = this.c_ods_cid;
-//
-//                                               $('manualMappingOK').odsab_instid=_syncData.odsab_instid;
-//                                               $('manualMappingOK').c_ods_cid=parseInt(_c_ods_cid);
-//                                               $('manualMappingOK').fb_id=_syncData.fb_id;
-//                                               $('manualMappingOK').dock_obj=_dock_obj;
-//                                               OAT.Dom.show($('manualMappingDiv'));
-//                                              });
-//
-//  _btnDiv.appendChild(_button);
-//  _btnDiv.appendChild(OAT.Dom.create("br"));
-
-
-//   var _cancel=OAT.Dom.create("input",{width:'60px'});
-//   _cancel.type='button';
-//   _cancel.value='Cancel';
-
-//   _cancel.id=_dock_obj.id+'_cancelbtn';
-
-//   OAT.Event.attach(_cancel,"click",function(){_dock_obj.dock.removeObject(_dock_obj);});
-
-//  _btnDiv.appendChild(_cancel);
-//  _parent_div.appendChild(_btnDiv);
-
-  return;
 }
-
-
-
 ]]>
 </script>
 <div id="fbDock"></div>
diff --git a/appsrc/ODS-Framework/fb_popup.vspx b/appsrc/ODS-Framework/fb_popup.vspx
index 1410517..a6e82c1 100644
--- a/appsrc/ODS-Framework/fb_popup.vspx
+++ b/appsrc/ODS-Framework/fb_popup.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: fb_popup.vspx,v 1.2 2008/02/19 11:21:22 source Exp $
+ -  $Id: fb_popup.vspx,v 1.2.2.1 2010/09/20 10:15:20 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/foaf.xml b/appsrc/ODS-Framework/foaf.xml
index 24c1bbb..a75c1ed 100644
--- a/appsrc/ODS-Framework/foaf.xml
+++ b/appsrc/ODS-Framework/foaf.xml
@@ -1,7 +1,7 @@
 <?xml version ='1.0' encoding='UTF-8'?>
 <!--
  -
- -  $Id: foaf.xml,v 1.3 2008/03/13 20:50:05 source Exp $
+ -  $Id: foaf.xml,v 1.3.2.1 2010/09/20 10:15:20 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/foaf.xsl b/appsrc/ODS-Framework/foaf.xsl
index c03bc72..cea3066 100644
--- a/appsrc/ODS-Framework/foaf.xsl
+++ b/appsrc/ODS-Framework/foaf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: foaf.xsl,v 1.7 2007/11/08 11:40:52 source Exp $
+ -  $Id: foaf.xsl,v 1.7.2.1 2010/09/20 10:15:20 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/freeze.vspx b/appsrc/ODS-Framework/freeze.vspx
index 5aaf4f5..cf08978 100644
--- a/appsrc/ODS-Framework/freeze.vspx
+++ b/appsrc/ODS-Framework/freeze.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: freeze.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: freeze.vspx,v 1.4.2.1 2010/09/20 10:15:20 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/gdata.sql b/appsrc/ODS-Framework/gdata.sql
index a13575f..57e2a76 100644
--- a/appsrc/ODS-Framework/gdata.sql
+++ b/appsrc/ODS-Framework/gdata.sql
@@ -1,6 +1,6 @@
 --
 --
---  $Id: gdata.sql,v 1.36 2008/03/21 12:27:45 source Exp $
+--  $Id: gdata.sql,v 1.36.2.1 2010/09/20 10:15:20 source Exp $
 --
 --  Atom publishing protocol support.
 --
diff --git a/appsrc/ODS-Framework/generic.vspx b/appsrc/ODS-Framework/generic.vspx
index b7f45b4..5b2428b 100644
--- a/appsrc/ODS-Framework/generic.vspx
+++ b/appsrc/ODS-Framework/generic.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: generic.vspx,v 1.5 2008/02/19 11:21:22 source Exp $
+ -  $Id: generic.vspx,v 1.5.2.1 2010/09/20 10:15:20 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/get_tags_popup.vspx b/appsrc/ODS-Framework/get_tags_popup.vspx
index a039461..133448c 100644
--- a/appsrc/ODS-Framework/get_tags_popup.vspx
+++ b/appsrc/ODS-Framework/get_tags_popup.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: get_tags_popup.vspx,v 1.5 2006/10/17 14:07:19 source Exp $
+ -  $Id: get_tags_popup.vspx,v 1.5.2.1 2010/09/20 10:15:20 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/gtags.vspx b/appsrc/ODS-Framework/gtags.vspx
index b50409d..27871e5 100644
--- a/appsrc/ODS-Framework/gtags.vspx
+++ b/appsrc/ODS-Framework/gtags.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: gtags.vspx,v 1.6 2008/03/13 20:50:05 source Exp $
+ -  $Id: gtags.vspx,v 1.6.2.1 2010/09/20 10:15:20 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/help.vspx b/appsrc/ODS-Framework/help.vspx
index 862e923..5e97707 100644
--- a/appsrc/ODS-Framework/help.vspx
+++ b/appsrc/ODS-Framework/help.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: help.vspx,v 1.5 2006/10/17 14:07:19 source Exp $
+ -  $Id: help.vspx,v 1.5.2.1 2010/09/20 10:15:20 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/home.vspx b/appsrc/ODS-Framework/home.vspx
index 34c85d8..d84c5d9 100644
--- a/appsrc/ODS-Framework/home.vspx
+++ b/appsrc/ODS-Framework/home.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: home.vspx,v 1.16.2.1 2009/08/20 18:03:20 source Exp $
+ -  $Id: home.vspx,v 1.16.2.2 2010/09/20 10:15:21 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/home.xsl b/appsrc/ODS-Framework/home.xsl
index 20501f0..67913da 100644
--- a/appsrc/ODS-Framework/home.xsl
+++ b/appsrc/ODS-Framework/home.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: home.xsl,v 1.3 2006/10/17 14:07:19 source Exp $
+ -  $Id: home.xsl,v 1.3.2.1 2010/09/20 10:15:21 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/hosted_services.sql b/appsrc/ODS-Framework/hosted_services.sql
index da808d0..88e9834 100644
--- a/appsrc/ODS-Framework/hosted_services.sql
+++ b/appsrc/ODS-Framework/hosted_services.sql
@@ -1,5 +1,5 @@
 --
---  $Id: hosted_services.sql,v 1.79.2.23 2010/07/08 13:40:41 source Exp $
+--  $Id: hosted_services.sql,v 1.79.2.39 2011/02/03 10:26:15 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -463,8 +463,6 @@ wa_add_col('DB.DBA.WA_MEMBER', 'WAM_HOME_PAGE', 'varchar')
  --wa_add_col('DB.DBA.WA_MEMBER', 'WAM_REQUESTED_MEMBER_TYPE', 'int')
  --;
 
---zdravko
-
 create procedure wa_member_upgrade() {
 
   if (registry_get ('__wa_member_upgrade') = 'done')
@@ -519,6 +517,90 @@ create procedure wa_member_doinstcount() {
 wa_member_doinstcount()
 ;
 
+wa_exec_no_error ('
+  create table WA_GROUPS (
+    WAG_ID integer identity,
+    WAG_USER_ID integer,
+    WAG_GROUP_ID integer,
+
+    primary key (WAG_ID)
+  )
+');
+
+wa_exec_no_error ('
+  create unique index SK_WA_GROUPS_01 on WA_GROUPS (WAG_USER_ID, WAG_GROUP_ID)
+');
+
+create procedure wa_groups_update () {
+
+  if (registry_get ('__wa_groups_update') = 'done')
+    return;
+
+  wa_exec_no_error ('insert into DB.DBA.WA_GROUPS (WAG_USER_ID, WAG_GROUP_ID) select USER_ID, GROUP_ID from ODRIVE.WA.GROUPS');
+  wa_exec_no_error ('delete from ODRIVE.WA.GROUPS');
+  registry_set ('__wa_groups_update', 'done');
+}
+;
+
+wa_exec_no_error ('
+  create table WA_GROUPS_ACL (
+    WACL_ID integer identity,
+    WACL_USER_ID integer not null,
+    WACL_NAME varchar not null,
+    WACL_DESCRIPTION long varchar,
+    WACL_WEBIDS long varchar,
+
+    constraint FK_WA_GROUPS_ACL_01 FOREIGN KEY (WACL_USER_ID) references DB.DBA.SYS_USERS(U_ID) on delete cascade,
+
+    primary key (WACL_ID)
+  )
+');
+
+wa_exec_no_error ('
+  create unique index SK_WA_GROUPS_ACL_01 on WA_GROUPS_ACL (WACL_USER_ID, WACL_NAME)
+');
+
+create procedure wa_groups_acl_update () {
+
+  if (registry_get ('__wa_groups_acl_update') = 'done')
+    return;
+
+  wa_exec_no_error ('insert into DB.DBA.WA_GROUPS_ACL (WACL_USER_ID, WACL_NAME, WACL_DESCRIPTION, WACL_WEBIDS) select FG_USER_ID, FG_NAME, FG_DESCRIPTION, FG_WEBIDS from ODRIVE.WA.FOAF_GROUPS');
+  wa_exec_no_error ('update DB.DBA.WA_INSTANCE set WAI_ACL = null');
+  registry_set ('__wa_groups_acl_update', 'done');
+}
+;
+
+wa_groups_acl_update()
+;
+
+create procedure wa_acl_params (
+  in params any)
+{
+  declare N, M integer;
+  declare aclNo, retValue, V any;
+
+  M := 1;
+  retValue := vector ();
+  for (N := 0; N < length (params); N := N + 2)
+  {
+    if (params[N] like 's_fld_2_%')
+    {
+      aclNo := replace (params[N], 's_fld_2_', '');
+      V := vector (M,
+                   trim (params[N+1]),
+                   get_keyword ('s_fld_1_' || aclNo, params, 'person'),
+                   atoi (get_keyword ('s_fld_3_' || aclNo || '_r', params, '0')),
+                   atoi (get_keyword ('s_fld_3_' || aclNo || '_w', params, '0')),
+                   atoi (get_keyword ('s_fld_3_' || aclNo || '_x', params, '0'))
+                  );
+      retValue := vector_concat (retValue, vector (V));
+      M := M + 1;
+    }
+  }
+  return retValue;
+}
+;
 
 wa_exec_no_error_log(
 'create table WA_INVITATIONS
@@ -561,12 +643,15 @@ wa_exec_no_error(
    WS_HTTPS integer default 0,
    WS_REGISTER_OPENID integer default 1,
    WS_REGISTER_FACEBOOK integer default 1,
+   WS_REGISTER_TWITTER integer default 1,
+   WS_REGISTER_LINKEDIN integer default 1,
    WS_REGISTER_SSL integer default 1,
    WS_REGISTER_AUTOMATIC_SSL integer default 1,
    WS_FEEDS_UPDATE_PERIOD varchar default \'hourly\',
    WS_FEEDS_UPDATE_FREQ integer default 1,
    WS_FEEDS_HUB varchar default null,
-   WS_FEEDS_HUB_CALLBACK integer default 1
+   WS_FEEDS_HUB_CALLBACK integer default 1,
+   WS_CERT_GEN_URL varchar default null
  )
 ')
 ;
@@ -616,7 +701,7 @@ wa_add_col('DB.DBA.WA_SETTINGS', 'WS_DEFAULT_MAIL_DOMAIN', 'varchar')
 wa_add_col('DB.DBA.WA_SETTINGS', 'WS_VERIFY_TIP', 'int')
 ;
 
-wa_add_col('DB.DBA.WA_SETTINGS', 'WS_UNIQUE_MAIL', 'int default 0')
+wa_add_col('DB.DBA.WA_SETTINGS', 'WS_UNIQUE_MAIL', 'int default 1')
 ;
 
 wa_add_col('DB.DBA.WA_SETTINGS', 'WS_FEEDS_UPDATE_PERIOD', 'varchar default \'hourly\'')
@@ -628,6 +713,9 @@ wa_add_col('DB.DBA.WA_SETTINGS', 'WS_FEEDS_UPDATE_FREQ', 'integer default 1')
 wa_add_col('DB.DBA.WA_SETTINGS', 'WS_FEEDS_HUB', 'varchar default null')
 ;
 
+wa_add_col('DB.DBA.WA_SETTINGS', 'WS_CERT_GEN_URL', 'varchar default null')
+;
+
 wa_add_col('DB.DBA.WA_SETTINGS', 'WS_FEEDS_HUB_CALLBACK', 'integer default 1')
 ;
 
@@ -643,6 +731,12 @@ wa_add_col('DB.DBA.WA_SETTINGS', 'WS_REGISTER_OPENID', 'integer default 1')
 wa_add_col('DB.DBA.WA_SETTINGS', 'WS_REGISTER_FACEBOOK', 'integer default 1')
 ;
 
+wa_add_col('DB.DBA.WA_SETTINGS', 'WS_REGISTER_TWITTER', 'integer default 1')
+;
+
+wa_add_col('DB.DBA.WA_SETTINGS', 'WS_REGISTER_LINKEDIN', 'integer default 1')
+;
+
 wa_add_col('DB.DBA.WA_SETTINGS', 'WS_REGISTER_SSL', 'integer default 1')
 ;
 
@@ -759,6 +853,21 @@ db.dba.wa_exec_ddl ('create table WA_USER_SVC (
       )'
 );
 
+create procedure wa_facebook_upgrade() {
+
+  if (registry_get ('__wa_facebook_upgrade') = 'done')
+    return;
+
+  delete from DB.DBA.WA_USER_SVC where US_U_ID <> 0 and US_SVC = 'FBKey';
+  update DB.DBA.WA_USER_SVC set US_U_ID = http_dav_uid () where US_SVC = 'FBKey';
+
+  registry_set ('__wa_facebook_upgrade', 'done');
+}
+;
+
+wa_facebook_upgrade()
+;
+
 db.dba.wa_exec_ddl ('create table WA_RELATED_APPS (
       RA_ID int identity,
       RA_WAI_ID int,
@@ -1589,6 +1698,14 @@ create procedure wa_check_package (in pname varchar) -- Duplicate conductor proc
 ;
 
 
+create procedure wa_check_app (
+  in app_type varchar,
+  in user_id integer)
+{
+  return coalesce ((select top 1 WAI_ID from DB.DBA.WA_MEMBER, DB.DBA.WA_INSTANCE where WAM_INST = WAI_NAME and WAM_USER = user_id and WAI_TYPE_NAME = app_type order by WAI_ID), 0);
+}
+;
+
 create procedure wa_vad_check (in pname varchar)
 {
   declare nam varchar;
@@ -1902,6 +2019,8 @@ create procedure INIT_SERVER_SETTINGS ()
   	   WS_REGISTER,
        WS_REGISTER_OPENID,
        WS_REGISTER_FACEBOOK,
+       WS_REGISTER_TWITTER,
+       WS_REGISTER_LINKEDIN,
        WS_REGISTER_SSL,
        WS_REGISTER_AUTOMATIC_SSL,
   	   WS_MAIL_VERIFY,
@@ -1916,7 +2035,8 @@ create procedure INIT_SERVER_SETTINGS ()
   	   WS_WELCOME_MESSAGE2,
   	   WS_COPYRIGHT,
   	   WS_DISCLAIMER,
-  	   WS_DEFAULT_MAIL_DOMAIN
+  	   WS_DEFAULT_MAIL_DOMAIN,
+	   WS_UNIQUE_MAIL
   	  )
 	  values
 	    (
@@ -1925,6 +2045,8 @@ create procedure INIT_SERVER_SETTINGS ()
 	     1,
 	     1,
 	     1,
+	     1,
+	     1,
 	     0,
 	     24,
 	     72,
@@ -1932,15 +2054,16 @@ create procedure INIT_SERVER_SETTINGS ()
 	     0,
 	     'default',
 	     '',
-	     'Enter your Member ID and Password',
+	     'Enter your User ID and Password',
 	     '',
 	     '',
-	     'Copyright © 1998-2010 OpenLink Software',
+	     'Copyright © 1998-2011 OpenLink Software',
 	     '',
-	     sys_stat ('st_host_name')
+	     sys_stat ('st_host_name'),
+	     1
 	    );
   }
-  update WA_SETTINGS set WS_COPYRIGHT = 'Copyright © 1998-2010 OpenLink Software';
+  update WA_SETTINGS set WS_COPYRIGHT = 'Copyright © 1998-2011 OpenLink Software';
 
   update WA_SETTINGS
      set WS_WELCOME_MESSAGE =
@@ -3206,9 +3329,9 @@ wa_exec_no_error_log(
     WAUI_OPENID_URL varchar,
     WAUI_OPENID_SERVER varchar,
     WAUI_FACEBOOK_ID integer,
-    WAUI_FACEBOOK_LOGIN_ID varchar,
     WAUI_IS_ORG	int default 0,
     WAUI_APP_ENABLE	int default 0,
+    WAUI_SPB_ENABLE	int default 0,
     WAUI_NICK		varchar,
     WAUI_BICQ VARCHAR,                  -- 50
     WAUI_BSKYPE VARCHAR,                -- 51
@@ -3220,6 +3343,8 @@ wa_exec_no_error_log(
     WAUI_CERT_LOGIN integer default 0,  -- XXX: obsolete, see WA_USER_CERTS
     WAUI_CERT_FINGERPRINT varchar,	-- same as above
     WAUI_CERT long varbinary,		-- same as above
+    WAUI_ACL LONG VARCHAR,
+    WAUI_SALMON_KEY varchar, 
 
     primary key (WAUI_U_ID)
   )'
@@ -3270,6 +3395,9 @@ wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_CERT', 'long varbinary');
 wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_BPHONE_EXT', 'varchar(5)');
 wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_HPHONE_EXT', 'varchar(5)');
 
+wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_ACL', 'LONG VARCHAR');
+wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_SALMON_KEY', 'VARCHAR');
+
 wa_exec_no_error ('create index WA_USER_INFO_CERT_FINGERPRINT on DB.DBA.WA_USER_INFO (WAUI_CERT_FINGERPRINT)');
 
 create procedure WA_USER_INFO_WAUI_FOAF_UPGRADE ()
@@ -3286,18 +3414,34 @@ wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_OPENID_URL', 'VARCHAR');
 wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_OPENID_SERVER', 'VARCHAR');
 
 wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_FACEBOOK_ID', 'INTEGER');
-wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_FACEBOOK_LOGIN_ID', 'VARCHAR');
 wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_IS_ORG', 'INT default 0');
 wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_APP_ENABLE', 'INT default 0');
+wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_SPB_ENABLE', 'INT default 0');
 wa_add_col ('DB.DBA.WA_USER_INFO', 'WAUI_NICK', 'varchar');
 
 update DB.DBA.WA_USER_INFO set WAUI_IS_ORG = 0 where WAUI_IS_ORG is null;
 alter table DB.DBA.WA_USER_INFO modify column WAUI_APP_ENABLE integer default 0;
 update DB.DBA.WA_USER_INFO set WAUI_APP_ENABLE = 0 where WAUI_APP_ENABLE is null;
 
+alter table DB.DBA.WA_USER_INFO modify column WAUI_SPB_ENABLE integer default 0;
+update DB.DBA.WA_USER_INFO set WAUI_SPB_ENABLE = 0 where WAUI_SPB_ENABLE is null;
+
 wa_exec_no_error('create index WA_USER_INFO_OID on DB.DBA.WA_USER_INFO (WAUI_OPENID_URL)');
 wa_exec_no_error('create index WA_USER_INFO_NICK on DB.DBA.WA_USER_INFO (WAUI_NICK)');
 
+create procedure WA_FACEBOOK_UPGRADE ()
+{
+  if (registry_get ('WA_FACEBOOK_UPGRADE') = 'done')
+    return;
+
+  wa_exec_no_error ('update DB.DBA.WA_USER_INFO set WAUI_FACEBOOK_ID = atoi (WAUI_FACEBOOK_LOGIN_ID) where coalesce (WAUI_FACEBOOK_ID, 0) = 0');
+
+  registry_set ('WA_FACEBOOK_UPGRADE', 'done');
+}
+;
+WA_FACEBOOK_UPGRADE ()
+;
+
 DB.DBA.EXEC_STMT (
 'create table WA_USER_CERTS (
   UC_ID   	int identity,
@@ -3305,12 +3449,15 @@ DB.DBA.EXEC_STMT (
   UC_CERT 	long varchar,
   UC_FINGERPRINT varchar,
   UC_LOGIN	int default 0,
+  UC_TS		datetime,
   primary key (UC_U_ID, UC_FINGERPRINT)
   )
 create unique index WA_USER_CERTS_FINGERPRINT on WA_USER_CERTS (UC_FINGERPRINT)
 ', 
 0);
 
+wa_add_col ('DB.DBA.WA_USER_CERTS', 'UC_TS', 'datetime');
+
 create procedure WA_CERTS_UPGRADE ()
 {
   if (registry_get ('WA_CERTS_UPGRADE') = '1')
@@ -3339,6 +3486,29 @@ create procedure WA_CERTS_UPGRADE ()
 
 WA_CERTS_UPGRADE ();
 
+create procedure ODS..cert_date_to_ts (in x varchar)
+{
+  declare a any;
+  declare exit handler for sqlstate '*'
+    {
+      return null;
+    };
+  a := sprintf_inverse (x, '%s %s %s %s %s', 0);
+  return http_string_date (sprintf ('Wdy, %s %s %s %s %s', a[1], a[0], a[3], a[2], a[4]));
+}
+;
+
+create procedure WA_CERTS_UPGRADE ()
+{
+  if (registry_get ('WA_CERTS_UPGRADE2') = '1')
+    return;
+  update WA_USER_CERTS set UC_TS = ODS..cert_date_to_ts (get_certificate_info (4,UC_CERT));
+  registry_set ('WA_CERTS_UPGRADE2', '1');
+}
+;
+
+WA_CERTS_UPGRADE ();
+
 create procedure WA_MAKE_NICK (in nick varchar)
 {
   declare i int;
@@ -3516,24 +3686,54 @@ wa_exec_no_error_log(
       WUO_TYPE varchar,
       WUO_NAME varchar,
       WUO_URL varchar,
+      WUO_URI varchar,
       WUO_PUBLIC integer default 0,
+      WUO_OAUTH_SID varchar default null,
       primary key (WUO_U_ID, WUO_ID)
       )'
 )
 ;
 
 wa_add_col('DB.DBA.WA_USER_OL_ACCOUNTS', 'WUO_TYPE', 'varchar');
+wa_add_col('DB.DBA.WA_USER_OL_ACCOUNTS', 'WUO_URI', 'varchar');
+wa_add_col('DB.DBA.WA_USER_OL_ACCOUNTS', 'WUO_OAUTH_SID', 'varchar');
+
+wa_exec_no_error_log('ALTER TABLE DB.DBA.WA_USER_OL_ACCOUNTS ADD FOREIGN KEY (WUO_U_ID) REFERENCES DB.DBA.SYS_USERS (U_ID) ON DELETE CASCADE');
 
 create procedure WA_USER_OL_ACCOUNTS_SET_UP ()
 {
   if (registry_get ('__WA_USER_OL_ACCOUNTS_SET_UP') = 'done')
     return;
-  update WA_USER_OL_ACCOUNTS set WUO_TYPE = 'P' where WUO_TYPE is null;
   registry_set ('__WA_USER_OL_ACCOUNTS_SET_UP', 'done');
-};
 
+  update WA_USER_OL_ACCOUNTS set WUO_TYPE = 'P' where WUO_TYPE is null;
+};
 WA_USER_OL_ACCOUNTS_SET_UP ();
 
+create procedure WA_USER_OL_ACCOUNTS_SET_UP ()
+{
+  if (registry_get ('__WA_USER_OL_ACCOUNTS_SET_UP2') = 'done')
+    return;
+  registry_set ('__WA_USER_OL_ACCOUNTS_SET_UP2', 'done');
+
+  update WA_USER_OL_ACCOUNTS set WUO_URI = ODS.ODS_API."user.onlineAccounts.uri"(WUO_URL) where WUO_URI is null;
+};
+
+create procedure WA_USER_OL_ACCOUNTS_UPGRADE ()
+{
+  if (exists (select 1 from SYS_KEYS where KEY_NAME = 'WA_USER_OL_ACCOUNTS_URL'))
+    return;
+  if (exists (select 1 from DB.DBA.WA_USER_OL_ACCOUNTS group by WUO_URL having count(*) > 1))
+    {
+      log_message ('Duplicate online account URL');
+      return;
+    }
+  wa_exec_no_error_log ('create unique index WA_USER_OL_ACCOUNTS_URL on DB.DBA.WA_USER_OL_ACCOUNTS (WUO_URL)');
+}
+;
+
+WA_USER_OL_ACCOUNTS_UPGRADE ();
+
 wa_exec_no_error_log(
     'CREATE TABLE WA_USER_RELATED_RES (
       WUR_ID int identity,
@@ -3635,7 +3835,9 @@ wa_exec_no_error_log(
     'CREATE TABLE WA_USER_OFFERLIST
      (
       WUOL_ID integer identity,
-      WUOL_U_ID int,
+      WUOL_U_ID integer,
+      WUOL_TYPE char(1) default \'1\',
+      WUOL_FLAG char(1) default \'1\',
       WUOL_OFFER varchar,
       WUOL_COMMENT long varchar,
       WUOL_PROPERTIES long varchar,
@@ -3643,7 +3845,20 @@ wa_exec_no_error_log(
       primary key (WUOL_ID)
      )'
 );
-wa_exec_no_error('create unique index WA_USER_OFFERLIST_USER on WA_USER_OFFERLIST (WUOL_U_ID, WUOL_OFFER)');
+wa_add_col('DB.DBA.WA_USER_OFFERLIST', 'WUOL_FLAG', 'char(1) default \'1\'');
+wa_add_col('DB.DBA.WA_USER_OFFERLIST', 'WUOL_TYPE', 'char(1) default \'1\'');
+wa_exec_no_error('drop index WA_USER_OFFERLIST_USER');
+wa_exec_no_error('create unique index WA_USER_OFFERLIST_USER on WA_USER_OFFERLIST (WUOL_U_ID, WUOL_TYPE, WUOL_OFFER)');
+
+alter table DB.DBA.WA_USER_OFFERLIST modify column WUOL_FLAG char(1) default '1';
+alter table DB.DBA.WA_USER_OFFERLIST modify column WUOL_TYPE char(1) default '1';
+update DB.DBA.WA_USER_OFFERLIST set WUOL_FLAG = '1' where WUOL_FLAG is null;
+update DB.DBA.WA_USER_OFFERLIST set WUOL_TYPE = '1' where WUOL_TYPE is null;
+
+wa_exec_no_error('DROP TRIGGER DB.DBA.WA_USER_WISHLIST_SIOC_I');
+wa_exec_no_error('DROP TRIGGER DB.DBA.WA_USER_WISHLIST_SIOC_U');
+wa_exec_no_error('DROP TRIGGER DB.DBA.WA_USER_WISHLIST_SIOC_D');
+
 
 create procedure wa_offerlist_upgrade()
 {
@@ -3665,41 +3880,47 @@ create procedure wa_offerlist_upgrade()
 ;
 wa_offerlist_upgrade();
 
-wa_exec_no_error_log (
-    'CREATE TABLE WA_USER_WISHLIST
-     (
-      WUWL_ID integer identity,
-      WUWL_U_ID int,
-      WUWL_BARTER varchar,
-      WUWL_PROPERTY varchar,
-      WUWL_COMMENT long varchar,
-      WUWL_PROPERTIES long varchar,
-
-      primary key (WUWL_ID)
-     )'
-);
-wa_add_col ('DB.DBA.WA_USER_WISHLIST', 'WUWL_PROPERTIES', 'long varchar');
-wa_exec_no_error('create unique index WA_USER_WISHLIST_USER on WA_USER_WISHLIST (WUWL_U_ID, WUWL_BARTER)');
-
-create procedure wa_wishlist_upgrade()
+create procedure wa_offerlist_upgrade()
 {
-  declare id integer;
-  declare obj any;
-
-  if (registry_get ('__wa_wishlist_upgrade') = 'done')
+  if (registry_get ('__wa_offerlist_upgrade2') = 'done')
     return;
-  registry_set ('__wa_wishlist_upgrade', 'done');
+  registry_set ('__wa_offerlist_upgrade2', 'done');
 
-  for (select WUWL_ID, WUWL_PROPERTIES from DB.DBA.WA_USER_WISHLIST) do
-  {
-    id := WUWL_ID;
-    obj := grUpdate (WUWL_PROPERTIES);
-    obj := vector_concat (subseq (soap_box_structure ('x', 1), 0, 2), vector ('version', '1.0', 'products', obj));
-    update DB.DBA.WA_USER_WISHLIST set WUWL_PROPERTIES = serialize (obj) where WUWL_ID = id;
-  }
+  wa_exec_no_error('insert into DB.DBA.WA_USER_OFFERLIST (WUOL_U_ID, WUOL_TYPE, WUOL_FLAG, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES) select WUWL_U_ID, \'2\', WUWL_FLAG, WUWL_BARTER, WUWL_COMMENT, WUWL_PROPERTIES from DB.DBA.WA_USER_WISHLIST');
 }
 ;
-wa_wishlist_upgrade();
+wa_offerlist_upgrade();
+
+wa_exec_no_error_log(
+    'CREATE TABLE WA_USER_LIKES (
+      WUL_ID integer identity,
+      WUL_U_ID integer,
+      WUL_FLAG char(1),
+      WUL_TYPE varchar,
+      WUL_URI varchar,
+      WUL_NAME varchar,
+      WUL_COMMENT long varchar,
+      WUL_PROPERTIES long varchar,
+
+      primary key (WUL_ID)
+     )'
+);
+wa_add_col ('DB.DBA.WA_USER_LIKES', 'WUL_FLAG', 'char(1)');
+wa_exec_no_error('create unique index WA_USER_LIKES_USER on WA_USER_LIKES (WUL_U_ID, WUL_NAME)');
+
+wa_exec_no_error_log(
+    'CREATE TABLE WA_USER_KNOWS (
+      WUK_ID int identity,
+      WUK_U_ID integer NOT NULL,
+      WUK_FLAG char(1) default \'1\',
+      WUK_LABEL varchar,
+      WUK_URI varchar NOT NULL,
+      primary key (WUK_ID)
+     )'
+)
+;
+wa_exec_no_error_log ('create unique index WA_USER_KNOWS_USER on DB.DBA.WA_USER_KNOWS (WUK_U_ID, WUK_URI)');
+
 
 wa_exec_no_error_log(
     'CREATE TABLE WA_USER_BIOEVENTS (
@@ -3718,6 +3939,7 @@ wa_exec_no_error_log(
     'CREATE TABLE WA_USER_FAVORITES (
       WUF_ID integer identity,
       WUF_U_ID integer,
+      WUF_FLAG char(1),
       WUF_TYPE varchar,
       WUF_CLASS varchar,
       WUF_PROPERTIES long varchar,
@@ -3730,6 +3952,7 @@ wa_exec_no_error_log(
 wa_add_col ('DB.DBA.WA_USER_FAVORITES', 'WUF_TYPE', 'varchar');
 wa_add_col ('DB.DBA.WA_USER_FAVORITES', 'WUF_CLASS', 'varchar');
 wa_add_col ('DB.DBA.WA_USER_FAVORITES', 'WUF_PROPERTIES', 'long varchar');
+wa_add_col ('DB.DBA.WA_USER_FAVORITES', 'WUF_FLAG', 'char(1)');
 wa_exec_no_error('create index WA_USER_FAVORITES_USER on WA_USER_FAVORITES (WUF_U_ID)');
 
 create procedure wa_favorites_upgrade()
@@ -4036,15 +4259,18 @@ create procedure WA_USER_EDIT (in _name varchar,in _key varchar,in _data any)
     UPDATE WA_USER_INFO SET WAUI_OPENID_SERVER = _data WHERE WAUI_U_ID = _uid;
   else if (_key = 'WAUI_FACEBOOK_ID')
     UPDATE WA_USER_INFO SET WAUI_FACEBOOK_ID = _data WHERE WAUI_U_ID = _uid;
-  else if (_key = 'WAUI_FACEBOOK_LOGIN_ID')
-    UPDATE WA_USER_INFO SET WAUI_FACEBOOK_LOGIN_ID = _data WHERE WAUI_U_ID = _uid;
   else if (_key = 'WAUI_APP_ENABLE')
     UPDATE WA_USER_INFO SET WAUI_APP_ENABLE = _data WHERE WAUI_U_ID = _uid;
+  else if (_key = 'WAUI_SPB_ENABLE')
+    UPDATE WA_USER_INFO SET WAUI_SPB_ENABLE = _data WHERE WAUI_U_ID = _uid;
   else if (_key = 'WAUI_CERT_LOGIN')
     UPDATE WA_USER_INFO SET WAUI_CERT_LOGIN = _data WHERE WAUI_U_ID = _uid;
   else if (_key = 'WAUI_CERT')
     UPDATE WA_USER_INFO SET WAUI_CERT = _data WHERE WAUI_U_ID = _uid;
 
+  else if (_key = 'WAUI_ACL')
+    UPDATE WA_USER_INFO SET WAUI_ACL = _data WHERE WAUI_U_ID = _uid;
+
   return row_count ();
 
  nf:
@@ -4345,6 +4571,12 @@ create procedure WA_USER_APP_ENABLE (in user_id integer)
 }
 ;
 
+create procedure WA_USER_SPB_ENABLE (in user_id integer)
+{
+  return coalesce ((select WAUI_SPB_ENABLE from WA_USER_INFO WHERE WAUI_U_ID = user_id), 0);
+}
+;
+
 create procedure WA_USER_TAG_SET (in owner_uid any, in tagee_uid integer, in tags varchar)
 {
   if (not exists (select 1 from DB.DBA.SYS_USERS where U_ID = owner_uid))
@@ -4504,6 +4736,168 @@ create procedure WA_USER_IS_TAGGED (in uid integer, in tagee integer)
 }
 ;
 
+create procedure WA_CLEAR (
+  in S any)
+{
+  return substring(S, 1, coalesce (strstr(S, '<>'), length (S)));
+}
+;
+
+create procedure WA_VALIDATE (
+  in value any,
+  in params any := null)
+{
+  declare valueType, valueClass, valueName, valueMessage, tmp any;
+
+  declare exit handler for SQLSTATE '*' {
+    if (not is_empty_or_null(valueMessage))
+      signal ('TEST', valueMessage);
+    if (__SQL_STATE = 'EMPTY')
+      signal ('TEST', sprintf('Field ''%s'' cannot be empty!<>', valueName));
+    if (__SQL_STATE = 'CLASS') {
+      if (valueType in ('free-text', 'tags')) {
+        signal ('TEST', sprintf('Field ''%s'' contains invalid characters or noise words!<>', valueName));
+      } else {
+        signal ('TEST', sprintf('Field ''%s'' contains invalid characters!<>', valueName));
+      }
+    }
+    if (__SQL_STATE = 'TYPE')
+      signal ('TEST', sprintf('Field ''%s'' contains invalid characters for \'%s\'!<>', valueName, valueType));
+    if (__SQL_STATE = 'MIN')
+      signal ('TEST', sprintf('''%s'' value should be greater than %s!<>', valueName, cast (tmp as varchar)));
+    if (__SQL_STATE = 'MAX')
+      signal ('TEST', sprintf('''%s'' value should be less than %s!<>', valueName, cast (tmp as varchar)));
+    if (__SQL_STATE = 'MINLENGTH')
+      signal ('TEST', sprintf('The length of field ''%s'' should be greater than %s characters!<>', valueName, cast (tmp as varchar)));
+    if (__SQL_STATE = 'MAXLENGTH')
+      signal ('TEST', sprintf('The length of field ''%s'' should be less than %s characters!<>', valueName, cast (tmp as varchar)));
+    signal ('TEST', 'Unknown validation error!<>');
+    --resignal;
+  };
+
+  value := trim(value);
+  if (is_empty_or_null(params))
+    return value;
+
+  valueClass := coalesce (get_keyword ('class', params), get_keyword ('type', params));
+  valueType := coalesce (get_keyword ('type', params), get_keyword ('class', params));
+  valueName := get_keyword ('name', params, 'Field');
+  valueMessage := get_keyword ('message', params, '');
+  tmp := get_keyword ('canEmpty', params);
+  if (isnull (tmp))
+  {
+    if (not isnull (get_keyword ('minValue', params))) {
+      tmp := 0;
+    } else if (get_keyword ('minLength', params, 0) <> 0) {
+      tmp := 0;
+    }
+  }
+  if (not isnull (tmp) and (tmp = 0) and is_empty_or_null(value)) {
+    signal('EMPTY', '');
+  } else if (is_empty_or_null(value)) {
+    return value;
+  }
+
+  value := WA_VALIDATE2 (valueClass, value);
+
+  if (valueType = 'integer') {
+    tmp := get_keyword ('minValue', params);
+    if ((not isnull (tmp)) and (value < tmp))
+      signal('MIN', cast (tmp as varchar));
+
+    tmp := get_keyword ('maxValue', params);
+    if (not isnull (tmp) and (value > tmp))
+      signal('MAX', cast (tmp as varchar));
+
+  } else if (valueType = 'float') {
+    tmp := get_keyword ('minValue', params);
+    if (not isnull (tmp) and (value < tmp))
+      signal('MIN', cast (tmp as varchar));
+
+    tmp := get_keyword ('maxValue', params);
+    if (not isnull (tmp) and (value > tmp))
+      signal('MAX', cast (tmp as varchar));
+
+  } else if (valueType = 'varchar') {
+    tmp := get_keyword ('minLength', params);
+    if (not isnull (tmp) and (length (value) < tmp))
+      signal('MINLENGTH', cast (tmp as varchar));
+
+    tmp := get_keyword ('maxLength', params);
+    if (not isnull (tmp) and (length (value) > tmp))
+      signal('MAXLENGTH', cast (tmp as varchar));
+  }
+  return value;
+}
+;
+
+create procedure WA_VALIDATE2 (
+  in propertyType varchar,
+  in propertyValue varchar)
+{
+  declare exit handler for SQLSTATE '*' {
+    if (__SQL_STATE = 'CLASS')
+      resignal;
+    signal('TYPE', propertyType);
+    return;
+  };
+
+  if (propertyType = 'boolean') {
+    if (propertyValue not in ('Yes', 'No'))
+      goto _error;
+  } else if (propertyType = 'integer') {
+    if (isnull (regexp_match('^[0-9]+\$', propertyValue)))
+      goto _error;
+    return cast (propertyValue as integer);
+  } else if (propertyType = 'float') {
+    if (isnull (regexp_match('^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?\$', propertyValue)))
+      goto _error;
+    return cast (propertyValue as float);
+  } else if (propertyType = 'dateTime') {
+    if (isnull (regexp_match('^((?:19|20)[0-9][0-9])[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])\$', propertyValue)))
+      if (isnull (regexp_match('^((?:19|20)[0-9][0-9])[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01]) ([01]?[0-9]|[2][0-3])(:[0-5][0-9])?\$', propertyValue)))
+        goto _error;
+    return cast (propertyValue as datetime);
+  } else if (propertyType = 'dateTime2') {
+    if (isnull (regexp_match('^((?:19|20)[0-9][0-9])[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01]) ([01]?[0-9]|[2][0-3])(:[0-5][0-9])?\$', propertyValue)))
+      goto _error;
+    return cast (propertyValue as datetime);
+  } else if (propertyType = 'date') {
+    if (isnull (regexp_match('^((?:19|20)[0-9][0-9])[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])\$', propertyValue)))
+      goto _error;
+    return cast (propertyValue as datetime);
+  } else if (propertyType = 'date2') {
+    if (isnull (regexp_match('^(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.]((?:19|20)[0-9][0-9])\$', propertyValue)))
+      goto _error;
+    return cast (propertyValue as datetime);
+  } else if (propertyType = 'time') {
+    if (isnull (regexp_match('^([01]?[0-9]|[2][0-3])(:[0-5][0-9])?\$', propertyValue)))
+      goto _error;
+    return cast (propertyValue as time);
+  } else if (propertyType = 'folder') {
+    if (isnull (regexp_match('^[^\\\/\?\*\"\'\>\<\:\|]*\$', propertyValue)))
+      goto _error;
+  } else if ((propertyType = 'uri') or (propertyType = 'anyuri')) {
+    if (isnull (regexp_match('^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_=:]*)?\$', propertyValue)))
+      goto _error;
+  } else if (propertyType = 'email') {
+    if (isnull (regexp_match('^([a-zA-Z0-9_\-])+(\.([a-zA-Z0-9_\-])+)*@((\[(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))\]))|((([a-zA-Z0-9])+(([\-])+([a-zA-Z0-9])+)*\.)+([a-zA-Z])+(([\-])+([a-zA-Z0-9])+)*))\$', propertyValue)))
+      goto _error;
+  } else if (propertyType = 'free-text') {
+    if (length (propertyValue))
+      vt_parse(propertyValue);
+  } else if (propertyType = 'tags') {
+    -- if (not ODRIVE.WA.validate_tags(propertyValue))
+      goto _error;
+  }
+  return propertyValue;
+
+_error:
+  signal('CLASS', propertyType);
+}
+;
+
+
 create procedure WA_GET_USER_INFO (in uid integer, in ufid integer, in visb any, in own integer, in umode integer default 0)
 {
   declare _utitle, _fname, _lname, _fullname, _gender,_wpage,_efoaf, _email varchar;
@@ -6472,7 +6866,7 @@ create procedure wa_make_url_from_vd (in host varchar, in lhost varchar, in path
 
 -- NEW version of this procedure is stored in ods_api.sql and is called ODS_CREATE_NEW_APP_INST. The new version is exposed to SOAP.
 create procedure
-WA_CREATE_NEW_APP_INST (in app_type varchar, in inst_name varchar, in owner varchar, in model int := 0, in pub int := 1)
+WA_CREATE_NEW_APP_INST (in app_type varchar, in inst_name varchar, in owner varchar, in model int := 1, in pub int := 0)
 {
   declare inst web_app;
   declare ty, h, id any;
@@ -6982,7 +7376,20 @@ DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_user_public_home_rule',
     null, null, 2, null, 'MS-Author-Via: DAV'
     );
 
-DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_user_home_rulelist', 1, vector ('ods_user_home_rule', 'ods_user_public_home_rule'));
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_root_rule', 1,
+      '/\x24',
+      vector (),
+      0,
+      '/index.html',
+      vector (),
+      NULL, NULL, 2, 0,
+      'Link: <^{DynamicLocalFormat}^/sparql?default-graph-uri=^{DynamicLocalFormat}^/dataspace>;'||
+      ' title="Public SPARQL Service"; rel="http://ontologi.es/sparql#fingerpoint"'
+      );
+
+
+DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_user_home_rulelist', 1, vector ('ods_user_home_rule', 'ods_user_public_home_rule', 'ods_root_rule'));
 
 
 create procedure ods_define_common_vd (in _host varchar, in _lhost varchar, in isdav int := 1)
@@ -7069,6 +7476,10 @@ create procedure ods_define_common_vd (in _host varchar, in _lhost varchar, in i
   DB.DBA.VHOST_DEFINE (vhost=>_host, lhost=>_lhost, lpath=>'/ods/api', 
       ppath=>'/SOAP/Http', soap_user=>'ODS_API', opts=>vector ('500_page', 'error_handler'), sec=>_sec, auth_opts=>_opts);
 
+  DB.DBA.VHOST_REMOVE (vhost=>_host, lhost=>_lhost, lpath=>'/about');
+  DB.DBA.VHOST_DEFINE (vhost=>_host, lhost=>_lhost, lpath=>'/about', ppath=>'/SOAP/Http/ext_http_proxy', soap_user=>'PROXY',
+      opts=>vector('url_rewrite', 'ext_about_http_proxy_rule_list1'), sec=>_sec, auth_opts=>_opts);
+
   if (exists (select 1 from DB.DBA.HTTP_PATH where HP_HOST = _host and HP_LISTEN_HOST = _lhost and HP_LPATH = '/DAV'))
     {
   if (not (exists (select 1 from DB.DBA.HTTP_PATH where HP_HOST = _host and HP_LISTEN_HOST = _lhost and HP_LPATH = '/')))
@@ -7550,3 +7961,19 @@ create procedure ods_uri_curie (in uri varchar)
 }
 ;
 
+create procedure ods_user_keys (in username varchar)
+{
+  declare xenc_name, xenc_type varchar;
+  declare arr any;
+  result_names (xenc_name, xenc_type);
+  if (not exists (select 1 from SYS_USERS where U_NAME = username))
+    return;
+  arr := USER_GET_OPTION (username, 'KEYS');
+  for (declare i, l int, i := 0, l := length (arr); i < l; i := i + 2)
+    {
+      if (length (arr[i]))
+        result (arr[i], arr[i+1][0]);
+    }
+}
+;
+
diff --git a/appsrc/ODS-Framework/href_export.xml b/appsrc/ODS-Framework/href_export.xml
index 1bb87c1..5f34e26 100644
--- a/appsrc/ODS-Framework/href_export.xml
+++ b/appsrc/ODS-Framework/href_export.xml
@@ -1,7 +1,7 @@
 <?xml version ='1.0' encoding='UTF-8'?>
 <!--
  -  
- -  $Id: href_export.xml,v 1.1 2008/04/17 09:10:36 source Exp $
+ -  $Id: href_export.xml,v 1.1.2.1 2010/09/20 10:15:21 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/images/icons/disconnect_16.png b/appsrc/ODS-Framework/icons/disconnect_16.png
similarity index 100%
copy from binsrc/yacutia/images/icons/disconnect_16.png
copy to appsrc/ODS-Framework/icons/disconnect_16.png
diff --git a/binsrc/yacutia/images/icons/link_16.png b/appsrc/ODS-Framework/icons/link_16.png
similarity index 100%
copy from binsrc/yacutia/images/icons/link_16.png
copy to appsrc/ODS-Framework/icons/link_16.png
diff --git a/appsrc/ODS-Framework/icons/lock_16.png b/appsrc/ODS-Framework/icons/lock_16.png
index 04a05c1..17fa6da 100644
Binary files a/appsrc/ODS-Framework/icons/lock_16.png and b/appsrc/ODS-Framework/icons/lock_16.png differ
diff --git a/appsrc/ODS-Framework/icons/unlock_16.png b/appsrc/ODS-Framework/icons/unlock_16.png
index 3a1a0d3..3a8dc5c 100644
Binary files a/appsrc/ODS-Framework/icons/unlock_16.png and b/appsrc/ODS-Framework/icons/unlock_16.png differ
diff --git a/appsrc/ODS-Framework/image.vsp b/appsrc/ODS-Framework/image.vsp
index 57c7226..ed3a022 100644
--- a/appsrc/ODS-Framework/image.vsp
+++ b/appsrc/ODS-Framework/image.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: image.vsp,v 1.3 2008/04/17 09:10:36 source Exp $
+--  $Id: image.vsp,v 1.3.2.1 2010/09/20 10:15:21 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Framework/images/linkedin-large.png b/appsrc/ODS-Framework/images/linkedin-large.png
new file mode 100644
index 0000000..4452d04
Binary files /dev/null and b/appsrc/ODS-Framework/images/linkedin-large.png differ
diff --git a/appsrc/ODS-Briefcase/www/image/select.gif b/appsrc/ODS-Framework/images/select.gif
similarity index 100%
rename from appsrc/ODS-Briefcase/www/image/select.gif
rename to appsrc/ODS-Framework/images/select.gif
diff --git a/appsrc/ODS-Framework/images/sign-in-with-twitter-d.png b/appsrc/ODS-Framework/images/sign-in-with-twitter-d.png
new file mode 100644
index 0000000..746b6b9
Binary files /dev/null and b/appsrc/ODS-Framework/images/sign-in-with-twitter-d.png differ
diff --git a/appsrc/ODS-Framework/images/throbber.gif b/appsrc/ODS-Framework/images/throbber.gif
old mode 100755
new mode 100644
diff --git a/appsrc/ODS-Framework/images/yacutia_style_alt.htm b/appsrc/ODS-Framework/images/yacutia_style_alt.htm
index 23f6cb6..5d42c52 100644
--- a/appsrc/ODS-Framework/images/yacutia_style_alt.htm
+++ b/appsrc/ODS-Framework/images/yacutia_style_alt.htm
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
 <!--
  -
- -  $Id: yacutia_style_alt.htm,v 1.2 2006/05/31 13:13:02 source Exp $
+ -  $Id: yacutia_style_alt.htm,v 1.2.2.1 2010/09/20 10:15:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/index.html b/appsrc/ODS-Framework/index.html
index 344616e..811b912 100644
--- a/appsrc/ODS-Framework/index.html
+++ b/appsrc/ODS-Framework/index.html
@@ -84,6 +84,8 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
 //]]>
     </script>
     <script type="text/javascript" src="oat/loader.js"></script>
+    <script type="text/javascript" src="common.js"></script>
+    <script type="text/javascript" src="login.js"></script>
     <script type="text/javascript" src="nav_framework.js"></script>
   </head>
   <body>
@@ -207,13 +209,7 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
       	        <h3></h3>
       	      </div>
   	      <div class="w_content">
-                <div class="user_img_ctr">
-                  <a href="javascript:void(0)">
-		  <img alt="Profile image"
-		  id="userProfilePhotoImg"
-		  rel="foaf:depiction"
-		  class="prof_photo" src="images/profile.png"/>
-                  </a>
+                <div class="user_img_ctr" id="userProfilePhoto">
                 </div> <!-- user_img_ctr -->
                 <div class="gems_ctr">
                   <div class="prof_user_gems" id="profileUserGems">
@@ -320,13 +316,17 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
                   <div id="ciPCtr" class="tab_page">
                   </div>
                   <div id="ciP1" class="tab_page">
+                  <table width="100%">
+                    <tr>
+                      <td width="100%" valign="top">
                     <div  class="vcard">
-		      <div class="vcard_l">
-			<img id="ciP1photo" rel="foaf:depiction"
-			     src="images/profile_small.png"
-			     alt="photo" class="photo"/>
+            	      <div class="vcard_l" id="ciP1photo">
 		      </div>
                       <div class="vcard_r">
+            	        <span>
+            	          <a href="#" class="personal_uri" id="ciP1uri">Personal URI</a>
+            	          <br />
+                  	        </span>
                         <span class="fn" id="ciP1fn"></span>
                         <div class="org" id="ciP1org"></div>
                         <a class="email" id="ciP1email" rel="foaf:mbox" href=""></a>
@@ -341,6 +341,12 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
                       </div>
                       </div>
                     </div>
+                      </td>
+                      <td valign="top">
+                        <img id="ciP1qrcode" src=""/>
+                      </td>
+                    </tr>
+                </table>
                   </div> <!-- tab_page -->
                   <div id="ciP2" class="tab_page">
                     <div class="vcard">
@@ -409,62 +415,10 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
 		</div> <!-- w_title_bar_btns -->
               </div>
               <div class="w_content" id="notify_content">
-<!--
-		<h3 class="date" >Today</h3>
-                <ul class="msgs" >
-                  <li>
-                    <img class="msg_icon person_tnail"
-                         alt="Dipsy"
-                         src="images/people/dipsy.jpg"/>
-                    <div class="msg">
-                      <span class="time">20:30</span>
-                      LaaLaa and <a href="#">Dipsy</a> are now connected.
-                    </div>
-                      <div class="msg_r">
-                        <img src="images/skin/default/notify_remove_btn.png" alt="Hide" width="16" height="16" />
-                      </div>
-                  </li>
-                  <li>
-                    <img class="msg_icon" alt="ODS-Weblog" src="images/icons/ods_weblog_16.png"/>
-                    <div class="msg"><span class="time">22:20</span> LaaLaa wrote a weblog article titled <a href="#">Eh Oh!</a></div>
-                      <div class="msg_r">
-                        <img src="images/skin/default/notify_remove_btn.png" alt="Hide" width="16" height="16" />
-                      </div>
-                  </li>
-                  <li>
-                    <img class="msg_icon" alt="ODS-Feeds" src="images/icons/ods_feeds_16.png"/>
-                    <div class="msg"><span class="time">22:20</span> LaaLaa published a feed <a href="#">Raw!</a></div>
-                    <div class="msg_r">
-                      <img src="images/skin/default/notify_remove_btn.png" alt="Hide" width="16" height="16" />
-                    </div>
-                  </li>
-                </ul>
--->
               </div> <!-- w_content -->
             </div> <!-- widget -->
-
-	    <!-- Locator -->
-            <!-- div class="widget w_contact">
-              <div class="w_title">
-                <h3>Locator</h3>
-		<div class="w_title_bar_btns">
-		  <img src="images/skin/default/settings_btn.png"
-		       alt="settings" />
-		  <img src="images/skin/default/menu_dd_handle_close.png"
-		       alt="Minimize"
-		       class="w_toggle"
-		       onclick="widgetToggle(this);"/>
-		</div--> <!-- w_title_bar_btns -->
-              <!--</div>--> <!-- w_title -->
-              <!-- div class="w_content">
-                <div id="locatorMap" style="height:300px;"></div>
-              </div>
-            </div-->
-          </div> <!-- #u_home_r -->
-
    	  <!-- Profile Page end-->
           <!-- Connections Page start-->
-
           <div id="contacts_interface" style="display:none;">
             <div class="widget w_contact">
               <div class="w_content">
@@ -490,10 +444,8 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
                       <table border="0" cellspacing="0" width="98%">
                         <tr>
 			  <td class="image" style="width:150px;">
-			    <img src="{connImgSRC}"
-				 alt=""
-				 class=""
-				 style="width:40px;cursor:pointer"/><br/>
+                  			    <img src="{connImgSRC}" style="width:40px;cursor:pointer"/>
+                  			    <br/>
 			    <span style="cursor:pointer;text-decoration: underline;">{connProfileFullName}</span>
 			  </td>
                           <td class="info">
@@ -514,13 +466,11 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
               </div>
             </div>
           </div>
-
 	  <!-- Connections Page end-->
           <!-- Invitation Page start-->
-
           <div id="invitations_C" style="display:none;">
             <h1>
-	      <img alt="Openlink Data Spaces" src="images/odslogo_200x25.png" style="padding-top:5px" /><br/>Welcome to
+	      <img alt="OpenLink Data Spaces" src="images/odslogo_200x25.png" style="padding-top:5px" /><br/>Welcome to
 	      <span id="invitations_connection_full_name_1"></span>'s network</h1>
             <div class="profile">
               <img src="images/profile_small.png" width="105px" alt="" id="invitations_connection_photo" />
@@ -654,37 +604,43 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
 			     tabindex="4"
 			     checked="checked"
 			     value="on_people"
-			     name="cb_people"/><label for="cb_people">People</label>
+                  			     name="cb_people"/>
+                  		<label for="cb_people">People</label>
                       <input id="cb_apps"
 			     type="checkbox"
 			     tabindex="9"
 			     checked="checked"
 			     value="on_apps"
-			     name="cb_apps"/><label for="cb_apps">Application descriptions</label>
+                  			     name="cb_apps"/>
+                  	  <label for="cb_apps">Application descriptions</label>
                       <input id="cb_dav"
 			     type="checkbox"
 			     tabindex="8"
 			     checked="checked"
 			     value="on_dav"
-			     name="cb_dav"/><label for="cb_dav">DAV</label>
+                  			     name="cb_dav"/>
+                  		<label for="cb_dav">DAV</label>
                       <input id="cb_blogs"
 			     type="checkbox"
 			     tabindex="6"
 			     checked="checked"
 			     value="on_blogs"
-			     name="cb_blogs"/><label for="cb_blogs">Weblog</label>
+                  			     name="cb_blogs"/>
+                  	  <label for="cb_blogs">Weblog</label>
                       <input id="cb_news"
 			     type="checkbox"
 			     tabindex="5"
 			     checked="checked"
 			     value="on_news"
-			     name="cb_news"/><label for="cb_news">Feeds</label>
+                  			     name="cb_news"/>
+                  		<label for="cb_news">Feeds</label>
                       <input id="cb_wikis"
 			     type="checkbox"
 			     tabindex="7"
 			     checked="checked"
 			     value="on_wikis"
-			     name="cb_wikis"/><label for="cb_wikis">Wiki</label>
+                  			     name="cb_wikis"/>
+                  		<label for="cb_wikis">Wiki</label>
                       <input id="cb_omail"
 			     type="checkbox"
 			     tabindex="10"
@@ -696,19 +652,22 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
 			     tabindex="11"
 			     checked="checked"
 			     value="on_bookmark"
-			     name="cb_bookmark"/><label for="cb_bookmark">Bookmarks</label>
+                  			     name="cb_bookmark"/>
+                  		<label for="cb_bookmark">Bookmarks</label>
                       <input id="cb_polls"
 			     type="checkbox"
 			     tabindex="13"
 			     checked="checked"
 			     value="on_polls"
-			     name="cb_polls"/><label for="cb_polls">Polls</label>
+                  			     name="cb_polls"/>
+                  	  <label for="cb_polls">Polls</label>
                       <input id="cb_addressbook"
 			     type="checkbox"
 			     tabindex="14"
 			     checked="checked"
 			     value="on_addressbook"
-			     name="cb_addressbook"/><label for="cb_addressbook">AddressBook</label>
+                  			     name="cb_addressbook"/>
+                  		<label for="cb_addressbook">AddressBook</label>
                       <input id="cb_calendar"
 			     type="checkbox"
 			     tabindex="15"
@@ -720,7 +679,8 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
 			     tabindex="12"
 			     checked="checked"
 			     value="on_nntp"
-			     name="cb_nntp"/><label for="cb_nntp">Discussion</label>
+                  			     name="cb_nntp"/>
+                  		<label for="cb_nntp">Discussion</label>
                     </div>
                     <div class="pager" style="text-align:left;display:none;" id="do_tag_block">
                       <input id="tagsInput"
@@ -782,55 +742,6 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
                       <li>
 			<div class="hit person"></div>
 		      </li>
-
-<!--
-                            <li>
-                              <div class="hit person">
-                                <input type="checkbox" class="sel_ckb"/>
-                                <div class="person_box">
-                                  <img alt="Kingsley" src="i/people/kingsley_t.png" class="person_tnail"/><br/>
-                                  <div class="conn_info"><a href="#">Kingsley</a></div>
-                                </div>
-                                <div class="person_summary_ctr vcard">
-                                  <h4 class="fn">Kingsley <span class="n">Idehen</span></h4>
-                                  <div class="adr">
-                                    <span class="locality">Lexington</span>, <span class="state">MA</span>, <span class="country">USA</span>
-                                  </div>
-                                </div>
-                                <div class="cmds"><button>Write Message</button><button>Delete Connection</button></div>
-                              </div>
-                            </li>
-                            <li>
-                              <div class="hit wiki_article">
-                                <input type="checkbox" class="sel_ckb"/>
-                                <div class="hit_ctr">
-                                  <img src="images/icons/ods_wiki_16.png" class="app_icon"/>
-                                  <h4><a href="#">ODS Menu Spec Revision 0.9</a></h4>
-                                  <p class="excerpt">"ODS Menu system revision was needed to improve control flow and accessibility of the ODS system and to facilitate modern interface using AJAX techniques and the OpenLink Ajax Toolkit. The aims..." <a href="="#"">More...</a></p>
-                                  <div class="props">
-                                    Updated <span class="date">Yesterday</span> by <a href="#">Yrjänä Rankka</a><br/>
-                                  </div>
-                                </div>
-                              </div>
-                            </li>
-                            <li>
-                              <div class="hit message">
-                                <input type="checkbox" class="sel_ckb"/>
-                                <div class="person_box">
-                                  <img alt="Dipsy" src="i/people/dipsy.jpg" class="person_tnail"/><br/>
-                                  <div class="conn_info"><a href="#">Dipsy</a></div>
-                                </div>
-                                <div class="msg_summary">
-                                  <h4><a href="#">New OAT demo page</a></h4>
-                                  <p class="excerpt">"All, See <a href="http://oat.openlinksw.com">OAT demo</a> and tell me what to do with it? I'm Uh-Ohing all over the place but it won't do me any..." <a href="="#"">More...</a></p>
-                                  <div class="props">
-                                    Received <span class="date">Yesterday at 12:32</span>
-                                  </div>
-                                  <div class="cmds"><button>Reply</button><button>Forward</button></div>
-                                </div>
-                              </div>
-                            </li>
--->
                     </ul>
                     <div class="pager" id="bottom_pager">Results 0:
                       <span><img src="images/skin/pager/p_first_gr.png" alt="First page"/>first</span>
@@ -971,27 +882,12 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
         <div id="FT">
           <img alt="Powered by OpenLink Virtuoso" src="images/skin/default/virt_power_no_border.png"/>
           <div id="FT_RC">
-            Copyright © 1998-2010 OpenLink Software<br/>
+            Copyright © 1998-2011 OpenLink Software<br/>
             <a href="#">About</a> <a href="#">Privacy</a> <a href="#">FAQ</a> <a href="#">Developers</a>
           </div><!-- #FT_RC -->
         </div> <!-- #FT -->
       </div> <!-- #RT -->
     </div> <!-- #PG -->
-
-<!-- templates
-    
-    span prof_user_full_name
-    span prof_user_first_name
-    span prof_user_last_name
-    span prof_user_id
-    span prof_user_dataspace_lnk
-    img user_depiction
-    img user_depiction_thumbnail
-    a user_dataspace_lnk
-    a user_vcard_lnk
-    a user_personal_uri_lnk
-
--->
     <div id="connect_box_tpl" class="widget" style="display: none">
       <div class="w_title">
 	<h3 class="w_title"><span class="u_full_name">Full Name</span> is not in your network</h3>
@@ -1114,75 +1010,126 @@ if ((document.location.href.indexOf ('/dataspace/person/') >- 1 ||
       </div> <!-- .oat_anchor_footer -->
     </div> <!-- #a_tmpl_1 -->
 
-    <div id="login_page" style="display:none">
-      <span id="loginCloseBtn">X</span>
-      <h1 class="page_title"><!--balek.zonk.net--></h1>
-      <div id="id_col">
-	<div id="site_id">
-          <img class="id_logo" src="images/odslogo_200.png" alt="ods logo icon" />
-	</div>
-      </div> <!-- id_col -->
-      <div id="form_col">
-	<div id="login_form_ctr">
-          <h2>Please identify yourself</h2>
-          <div id="login_form" style="padding: 10px 0px 0px 0px;">
-            <ul class="tab_bar">
-              <li id="loginT1" class="tab_selected">
-		<a href="javascript:void(0)">ODS</a>
-	      </li>
-              <li id="loginT2" style="display:none">
-		<a href="javascript:void(0)">OpenID</a>
-	      </li>
-              <li id="loginT3" style="display:none">
-		            <a href="javascript: void(0)">Facebook</a>
-	            </li>
-              <li id="loginT4" style="display:none">
-		            <a href="javascript: void(0)">WebID</a>
-	            </li>
-            </ul>
-            <div class="tab_deck">
-              <div id="loginPCtr"></div>
-              <div id="loginP1" class="tab_page" style="min-height: 70px;">
-		<label for="loginUserName">Member ID</label>
-            		<input type="text" name="loginUserName" value="" id="loginUserName"/>
-            		<br />
-		<label for="loginUserPass">Password</label>
-            		<input type="password" name="loginUserPass" value="" id="loginUserPass" />
+    <div id="login_page" style="display: none;">
+      <span id="lf_close"><b>X</b></span>
      		        <br />
+      <table cellspacing="0">
+        <tr>
+          <td valign="top">
+            <img class="id_logo" src="/ods/images/odslogo_200.png" />
+          </td>
+          <td valign="top">
+            <div id="lf" class="form">
+              <div class="header">
+                Identify Yourself <img id="lf_throbber" src="/ods/images/oat/Ajax_throbber.gif" style="float: right; margin-right: 10px; display: none" />
+              </div>
+              <ul id="lf_tabs" class="tabs">
+                <li id="lf_tab_0" title="Digest">Digest</li>
+                <li id="lf_tab_1" title="OpenID" style="display: none;">OpenID</li>
+                <li id="lf_tab_2" title="Facebook" style="display: none;">Facebook</li>
+                <li id="lf_tab_3" title="WebID" style="display: none;">WebID</li>
+                <li id="lf_tab_4" title="Twitter" style="display: none;">Twitter</li>
+                <li id="lf_tab_5" title="LinkedIn" style="display: none;">LinkedIn</li>
+              </ul>
+              <div style="min-height: 120px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                <div id="lf_content"> 
               </div>
-              <div id="loginP2" class="tab_page" style="display:none; min-height: 70px;">
-		<label for="loginOpenIdUrl">OpenID URL
-            		  <img alt="OpenID" src="images/login-bg.gif" style="vertical-align:bottom;margin-left:5px;"/>
-		</label>
-  		          <input type="text" name="loginOpenIdUrl" value="" id="loginOpenIdUrl" />
-  		          <br />
+                <div id="lf_page_0" class="tabContent" >
+                  <table class="form" cellspacing="5" style="inherit: none;">
+                    <tr>
+                      <th width="20%">
+                        <label for="lf_uid">User ID</label>
+                      </th>
+                      <td nowrap="nowrap">
+                        <input type="text" name="lf_uid" value="" id="lf_uid" style="width: 150px;" />
+                      </td>
+                    </tr>
+                    <tr>
+                      <th>
+                        <label for="lf_password">Password</label>
+                      </th>
+                      <td nowrap="nowrap">
+                        <input type="password" name="lf_password" value="" id="lf_password" style="width: 150px;" />
+                      </td>
+                    </tr>
+                  </table>
+                </div>
+
+                <div id="lf_page_1" class="tabContent" style="display: none;">
+                  <table class="form" cellspacing="5">
+                    <tr>
+                      <th width="20%">
+                        <label for="lf_openId">OpenID URL</label>
+                      </th>
+                      <td nowrap="nowrap">
+                        <input type="text" name="lf_openId" value="" id="lf_openId" style="width: 300px;" />
+                      </td>
+                    </tr>
+                  </table>
               </div>
-              <div id="loginP3" class="tab_page" style="display:none; min-height: 70px; padding-left: 100px;">
-                <span id="loginFBData" style="min-height: 20px;"></span>
+
+                <div id="lf_page_2" class="tabContent" style="display: none;">
+                  <table class="form" cellspacing="5">
+                    <tr>
+                      <th width="20%"> </th>
+                      <td nowrap="nowrap">
+                        <span id="lf_facebookData" style="min-height: 20px;"> </span>
                 <br />
                 <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
-                <fb:login-button autologoutlink="true"></fb:login-button>
+                        <fb:login-button autologoutlink="true" xmlns:fb="http://www.facebook.com/2008/fbml"></fb:login-button>
+                      </td>
+                    </tr>
+                  </table>
+              </div>
+
+                <div id="lf_page_3" class="tabContent" style="display: none;">
+                  <table id="lf_table_3" class="form" cellspacing="5">
+                    <tr>
+                      <td>
+                      </td>
+                    </tr>
+                  </table>
+                </div>
+
+                <div id="lf_page_4" class="tabContent" style="display: none;">
+                  <table id="lf_table_4" class="form" cellspacing="5">
+                    <tr>
+                      <th width="20%">
+                      </th>
+                      <td>
+                        <span id="lf_twitter" style="min-height: 20px;"></span>
+                        <br />
+                        <img id="lf_twitterButton" src="/ods/images/sign-in-with-twitter-d.png" border="0"/>
+                      </td>
+                    </tr>
+                  </table>
+
+                  </div>
+                    <div id="lf_page_5" class="tabContent" style="display: none;">
+                      <table id="lf_table_5" class="form" cellspacing="5">
+                        <tr>
+                          <th width="20%">
+                          </th>
+                          <td>
+                            <span id="lf_linkedin" style="min-height: 20px;"></span>
+                            <br />
+                            <img id="lf_linkedinButton" src="/ods/images/linkedin-large.png" border="0"/>
+                          </td>
+                        </tr>
+                      </table>
+                </div>
+              </div>
+              <div id="lf_forget" class="footer" style="background-color: #FFF; display: none;">
+                <a href="pass_recovery.vspx">Forgot your password?</a>
               </div>
-              <div id="loginP4" class="tab_page" style="display:none; min-height: 70px; ">
+              <div class="footer">
+                <input type="button" name="lf_login" value="Login" id="lf_login" />
+                <input type="button" name="lf_register" value="Sign Up" id="lf_register" />
               </div>
-            </div> <!-- tab_deck -->
-            <div id="login_ctrls">
-              <input type="hidden" name="cb_remember_me" value="1" id="login_frm_cb_remember_me" checked="checked" />
-              <input type="checkbox" name="cb_remember_me" value="1" id="login_frm_cb_remember_me" checked="checked" />
-          	  <label for="login_frm_cb_remember_me">Remember me</label>
-          	  <br />
-              <input type="button" name="loginBtn" value="Login" id="loginBtn" />
-              <input type="button" name="signupBtn" value="Sign Up!" id="signupBtn" />
-              <span id="loginThrobber" style="display:none">Logging in ...
-		<img alt="Please wait..." src="images/oat/throbber.gif"/>
-	      </span>
-              <br/>
-              <a id="loginForgot" style="display:none">Forgot your password?</a>
             </div>
-          </div> <!-- login_form -->
-	</div> <!-- login_form_ctr -->
-	<div id="loginErrDiv"></div>
-      </div> <!-- form_col -->
+          </td>
+        </tr>
+      </table>
     </div> <!-- login_page -->
   </body>
 </html>
diff --git a/appsrc/ODS-Framework/index.vsp b/appsrc/ODS-Framework/index.vsp
index 2617fc0..5c99c4d 100644
--- a/appsrc/ODS-Framework/index.vsp
+++ b/appsrc/ODS-Framework/index.vsp
@@ -1,7 +1,7 @@
 <?vsp
 --   search_ajax.vsp
 --
---   $Id: index.vsp,v 1.9.2.2 2010/07/08 13:40:41 source Exp $
+--   $Id: index.vsp,v 1.9.2.7 2010/09/20 10:15:21 source Exp $
 --
 --   AJAX Handler for the google map control
 --
@@ -24,7 +24,7 @@
 --  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 --
 --
-  declare sid,realm,server_root,server_dataspace,oldui_url,uname,utype varchar;
+  declare sid,realm,server_root,server_dataspace,oldui_url,uname,utype,https varchar;
 
   utype:=get_keyword('utype',params,'');
   uname:=get_keyword('uname',params,'');
@@ -90,12 +90,18 @@
     else
       _country_code:=null;
 
+    https := ODS..getDefaultHttps ();
+    if (exists (select 1 from WA_SETTINGS where WS_HTTPS = 1) and https is not null)
+      _openid_server := 'https://' || https;
+    else
     _openid_server := server_root;
 --META openID start
     if (length (_oid_url) and length (_oid_server))
     {
       http('  <link rel="openid.server" title="OpenID Server" href="'|| _oid_server ||'" />\r\n',resMeta);
       http('   <link rel="openid.delegate" title="OpenID URL" href="'|| _oid_url ||'" />\r\n',resMeta);
+      http('  <link rel="openid2.provider" title="OpenID v2 Server" href="'|| _oid_server ||'" />\r\n',resMeta);
+      http('   <link rel="openid2.local_id" title="OpenID v2 URL" href="'|| _oid_url ||'" />\r\n',resMeta);
     }
     else
     {
@@ -173,17 +179,23 @@ skip_meta:
   html_content:=replace(html_content,'<!-- #META# -->',string_output_string (resMeta));
 
   links := 'Link:';
-  links := links || sprintf (' <%s%s%s#this>; rel="http://xmlns.com/foaf/0.1/primaryTopic",\r\n', server_dataspace, utype, uname);
-  links := links || sprintf (' <%s%s%s#this>; rev="describedby",\r\n', server_dataspace, utype, uname);
+  links := links || sprintf (' <%s%s%s#this>; rel="http://xmlns.com/foaf/0.1/primaryTopic",', server_dataspace, utype, uname);
+  links := links || sprintf (' <%s%s%s#this>; rev="describedby",', server_dataspace, utype, uname);
+  links := links || sprintf (' <%s/activities/feeds/activities/user/%U>; rel="http://schemas.google.com/g/2010#updates-from"; type="application/atom+xml",', server_root, uname);
+  links := links || sprintf (' <%s/sparql?default-graph-uri=%s/dataspace>; title="Public SPARQL Service"; rel="http://ontologi.es/sparql#fingerpoint", ', server_root, server_root);
   foreach (any ss in exts) do
     {
-       links := links || sprintf (' <%s%s%s/about.%s>; rel="alternate";\r\n type="%s"; title="Structured Descriptor Document (%s format)",\r\n', 
+       links := links || sprintf (' <%s%s%s/about.%s>; rel="alternate"; type="%s"; title="Structured Descriptor Document (%s format)",', 
        server_dataspace, utype, uname, ss[0], ss[2], ss[1]);
     }
+  for select U_E_MAIL from DB.DBA.SYS_USERS where U_NAME = uname do
+    {
+      links := links || sprintf (' <%s/ods/describe?uri=%U>; rel="webfinger",', server_root, 'acct:' || U_E_MAIL);
+    }
   links := rtrim (links, ',\r\n');
 
   http_rewrite();
-  http_header (links || '\r\nContent-Type: text/html; charset=UTF-8\r\n');
+  http_header (http_header_get () || links || '\r\nContent-Type: text/html; charset=UTF-8\r\n');
   http (html_content);
 
 ?>
diff --git a/appsrc/ODS-Framework/index.vspx b/appsrc/ODS-Framework/index.vspx
index 7fc7437..b2959a2 100644
--- a/appsrc/ODS-Framework/index.vspx
+++ b/appsrc/ODS-Framework/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: index.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: index.vspx,v 1.4.2.1 2010/09/20 10:15:21 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/index.xsl b/appsrc/ODS-Framework/index.xsl
index 9d99c45..825d177 100644
--- a/appsrc/ODS-Framework/index.xsl
+++ b/appsrc/ODS-Framework/index.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: index.xsl,v 1.4 2008/03/13 20:50:05 source Exp $
+ -  $Id: index.xsl,v 1.4.2.2 2010/09/20 10:15:21 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -40,7 +40,6 @@
   <xsl:include href="comp/dav_browser.xsl"/>
   <xsl:include href="comp/tagging.xsl"/>
   <xsl:include href="comp/dashboard.xsl"/>
-  <!-- zdravko -->
   <xsl:include href="comp/site_home.xsl"/>
   <xsl:include href="comp/app_inst_menu.xsl"/>
   <xsl:include href="comp/map_control.xsl"/>
diff --git a/appsrc/ODS-Framework/index_inst.vspx b/appsrc/ODS-Framework/index_inst.vspx
index b8f4f9a..5440bde 100644
--- a/appsrc/ODS-Framework/index_inst.vspx
+++ b/appsrc/ODS-Framework/index_inst.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: index_inst.vspx,v 1.6 2007/05/23 09:41:54 source Exp $
+ -  $Id: index_inst.vspx,v 1.6.2.2 2010/09/20 10:15:21 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -34,10 +34,7 @@
     </vm:header>
     <vm:pagewrapper>
       <vm:body>
-        <table>
-        <tr><td><vm:login inst="yes"/></td></tr>
-        <!--tr><td><vm:register-form/></td></tr-->
-        </table>
+        <vm:login />
       </vm:body>
     </vm:pagewrapper>
   </vm:page>
diff --git a/appsrc/ODS-Framework/init.sql b/appsrc/ODS-Framework/init.sql
index 45a4bcc..0efe103 100644
--- a/appsrc/ODS-Framework/init.sql
+++ b/appsrc/ODS-Framework/init.sql
@@ -1,5 +1,5 @@
 --
---  $Id: init.sql,v 1.5 2008/03/13 20:36:50 source Exp $
+--  $Id: init.sql,v 1.5.2.1 2010/09/20 10:15:22 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Framework/inst.vspx b/appsrc/ODS-Framework/inst.vspx
index c040785..86e4c8d 100644
--- a/appsrc/ODS-Framework/inst.vspx
+++ b/appsrc/ODS-Framework/inst.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: inst.vspx,v 1.5 2006/10/17 14:07:19 source Exp $
+ -  $Id: inst.vspx,v 1.5.2.1 2010/09/20 10:15:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/inst_ping.vspx b/appsrc/ODS-Framework/inst_ping.vspx
index a10602a..1763e79 100644
--- a/appsrc/ODS-Framework/inst_ping.vspx
+++ b/appsrc/ODS-Framework/inst_ping.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: inst_ping.vspx,v 1.1 2006/10/17 11:18:44 source Exp $
+ -  $Id: inst_ping.vspx,v 1.1.2.2 2011/03/08 13:28:13 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -27,7 +27,8 @@
         xmlns:v="http://www.openlinksw.com/vspx/"
         style="index.xsl"
         doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
-        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+        fast-render="1">
   <vm:page>
     <vm:header>
       <vm:title>Application Notifications</vm:title>
@@ -51,10 +52,9 @@
 	      <tr class="listing_header_row">
 		  <th>Application</th>
 		  <th>Notification Services</th>
-		  <th>Action</th>
+      		  <th width="5%">Action</th>
 	      </tr>
-	      <v:data-set name="maps" sql="select WAI_NAME, WAI_ID, DB.DBA.WA_APP_PING_TGT_AGG (SH_NAME) as SH_SVC from ODS..APP_PING_REG, ODS..SVC_HOST, DB.DBA.WA_INSTANCE, DB.DBA.WA_MEMBER where SH_ID = AP_HOST_ID  and WAI_ID = AP_WAI_ID and WAI_NAME = WAM_INST and WAM_MEMBER_TYPE = 1 and WAM_USER = :self.u_id group by WAI_NAME, WAI_ID"
-		  scrollable="1" editable="1" nrows="1000">
+	        <v:data-set name="maps" sql="select WAI_NAME, WAI_ID, DB.DBA.WA_APP_PING_TGT_AGG (SH_NAME) as SH_SVC from ODS..APP_PING_REG, ODS..SVC_HOST, DB.DBA.WA_INSTANCE, DB.DBA.WA_MEMBER where SH_ID = AP_HOST_ID  and WAI_ID = AP_WAI_ID and WAI_NAME = WAM_INST and WAM_MEMBER_TYPE = 1 and WAM_USER = :self.u_id group by WAI_NAME, WAI_ID" scrollable="1" editable="1" nrows="1000">
 		  <v:before-data-bind>
 if (not e.ve_is_post and self.del_svc is not null)
 {
@@ -84,14 +84,14 @@ if (not e.ve_is_post and control.te_rowset[1] = self.edit_svc)
 			      </td>
 			      <td>
 				  <v:label name="la1" value="--(control.vc_parent as vspx_row_template).te_rowset[2]"/>
-
 			      </td>
-			      <td>
-				  <v:url name="ur2" value='<img src="images/icons/del_16.png" hspace="3" border="0"/>Delete'
+      			      <td nowrap="nowrap">
+          				  <v:url name="ur2" value='<img src="images/icons/trash_16.png" hspace="3" border="0"/>Delete'
 				      format="%s"
 				      url="--sprintf ('inst_ping.vspx?del=%d', (control.vc_parent as vspx_row_template).te_rowset[1])"
 				      xhtml_title="Delete"
 				      xhtml_alt="Delete"
+          				      xhtml_class="img_button"
 				      />
 			      </td>
 			  </tr>
@@ -108,22 +108,23 @@ if (not e.ve_is_post and control.te_rowset[1] = self.edit_svc)
 	      </v:data-set>
 	  </table>
 	  <div class="fm">
-	      <fieldset>
-		  <label for="app1">Application</label>
-		  <v:data-list name="app1" sql="select '--' as WAI_NAME, -1 as WAI_ID from SYS_USERS where U_ID = self.u_id union all select WAI_NAME, WAI_ID from WA_INSTANCE, WA_MEMBER where WAI_NAME = WAM_INST and WAM_MEMBER_TYPE = 1 and WAM_USER = self.u_id and WAI_IS_PUBLIC = 1"
-		      key-column="WAI_ID" value-column="WAI_NAME">
+  	      <fieldset class="form">
+  	        <div>
+  		        <label class="form" for="app1">Application</label>
+	        	  <v:data-list name="app1" sql="select '--' as WAI_NAME, -1 as WAI_ID from SYS_USERS where U_ID = self.u_id union all select WAI_NAME, WAI_ID from WA_INSTANCE, WA_MEMBER where WAI_NAME = WAM_INST and WAM_MEMBER_TYPE = 1 and WAM_USER = self.u_id and WAI_IS_PUBLIC = 1" key-column="WAI_ID" value-column="WAI_NAME">
 		      <v:before-render>
 			  if (self.edit_svc is not null)
 			    control.vc_add_attribute ('disabled', 1);
 		      </v:before-render>
 		  </v:data-list>
-		  <br/>
-		  <label for="ps1">Notification Services</label>
-		  <v:data-list name="ps1" sql="select SH_ID, SH_NAME from ODS..SVC_HOST" key-column="SH_ID" value-column="SH_NAME"
-		      multiple="1" xhtml_size="--(select count(*) from ODS..SVC_HOST)">
+  	        </div>
+  	        <div>
+        		  <label class="form" for="ps1">Notification Services</label>
+        		  <v:data-list name="ps1" sql="select SH_ID, SH_NAME from ODS..SVC_HOST" key-column="SH_ID" value-column="SH_NAME" multiple="1" xhtml_size="--(select count(*) from ODS..SVC_HOST)">
 		  </v:data-list>
-		  <br />
-	      <span class="fm_ctl_btn">
+  	        </div>
+  	        <div>
+        		  <label class="form"> </label>
 		  <v:button name="cancel1" value="Cancel" action="simple" enabled="--equ(isnull(self.edit_svc),0)">
 		      <v:on-post>
 self.app1.ufl_value := null;
@@ -185,7 +186,7 @@ control.vc_data_bind (e);
 self.maps.vc_data_bind (e);
 ]]></v:on-post>
 		  </v:button>
-	      </span>
+            </div>
 	  </fieldset>
       </div>
       </vm:body>
diff --git a/appsrc/ODS-Framework/join.vspx b/appsrc/ODS-Framework/join.vspx
index aca9cd2..9f886fc 100644
--- a/appsrc/ODS-Framework/join.vspx
+++ b/appsrc/ODS-Framework/join.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: join.vspx,v 1.8 2008/02/19 11:21:22 source Exp $
+ -  $Id: join.vspx,v 1.8.2.1 2010/09/20 10:15:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/ldap.sql b/appsrc/ODS-Framework/ldap.sql
index 05f0dd3..6efa54c 100644
--- a/appsrc/ODS-Framework/ldap.sql
+++ b/appsrc/ODS-Framework/ldap.sql
@@ -1,5 +1,5 @@
 --
---  $Id: ldap.sql,v 1.5 2007/11/19 11:16:16 source Exp $
+--  $Id: ldap.sql,v 1.5.2.2 2011/03/23 12:18:30 source Exp $
 --
 --  OpenID protocol support.
 --
@@ -133,6 +133,7 @@ create procedure LDAP..contact_fields ()
         'P_FULL_NAME',      'Full Name',
         'P_GENDER',         'Gender',
         'P_BIRTHDAY',       'Birthday',
+        'P_IRI',            'WebID',
         'P_MAIL',           'Contact - Mail',
         'P_WEB',            'Contact - Web address',
         'P_ICQ',            'Contact - Icq',
diff --git a/appsrc/ODS-Framework/ldap_search.vspx b/appsrc/ODS-Framework/ldap_search.vspx
index 7111519..ec533b8 100644
--- a/appsrc/ODS-Framework/ldap_search.vspx
+++ b/appsrc/ODS-Framework/ldap_search.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: ldap_search.vspx,v 1.5 2006/10/17 14:07:19 source Exp $
+ -  $Id: ldap_search.vspx,v 1.5.2.1 2010/09/20 10:15:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/linkedin_login.vsp b/appsrc/ODS-Framework/linkedin_login.vsp
new file mode 100644
index 0000000..158e2ec
--- /dev/null
+++ b/appsrc/ODS-Framework/linkedin_login.vsp
@@ -0,0 +1,73 @@
+<?vsp 
+  declare tok, res, url, sid, oauth_tok, ret_url, profile_url, tmp any;
+
+  sid := {?'sid'};
+  profile_url := null;
+  tok := ODS.ODS_API.get_oauth_tok ('LinkedIn API');
+
+  if ({?'login'} is not null)
+    {
+      sid := md5 (datestring (now ()));
+      ret_url := sprintf ('http://%{WSHost}s%s?sid=%U', http_path(), sid);
+      url := OAUTH..sign_request ('GET', 'https://api.linkedin.com/uas/oauth/requestToken', sprintf ('oauth_callback=%U', ret_url), tok, null, 1); 
+      res := http_get (url);
+      dbg_obj_print_vars (url, res);
+      sid := OAUTH..parse_response (sid, tok, res);
+
+      OAUTH..set_session_data (sid, params);
+      oauth_tok := OAUTH..get_auth_token (sid);
+      url := sprintf ('https://www.linkedin.com/uas/oauth/authenticate?oauth_token=%U', oauth_tok);
+      http_status_set (302);
+      http_header (sprintf ('Location: %s\r\n', url)); 
+      return;
+    }
+  else if ({?'oauth_verifier'} is not null)
+    {
+      declare header, auth any;
+      dbg_obj_print (params);
+      url := OAUTH..sign_request ('GET', 'https://api.linkedin.com/uas/oauth/accessToken', 
+		sprintf ('oauth_token=%U&oauth_verifier=%U', {?'oauth_token'}, {?'oauth_verifier'}), 
+			tok, sid, 1);
+      dbg_obj_print (url);
+      res := http_get (url);
+      dbg_obj_print (res);
+      sid := OAUTH..parse_response (sid, tok, res);
+
+      url := OAUTH..sign_request ('GET', 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,industry,public-profile-url,date-of-birth)', '', tok, sid, 1);
+      dbg_obj_print_vars (url);
+      res := http_get (url);
+      dbg_printf ('%s', res);
+      profile_url := cast (xpath_eval ('/person/public-profile-url', xtree_doc (res)) as varchar);
+      OAUTH..session_terminate (sid); 
+    }
+?>
+<html>
+  <head>
+  </head>
+  <body>
+   <?vsp 
+      if (profile_url is not null)
+        {
+           http_value (sprintf ('OAuth login suceeded, profile : %s', profile_url), 'div');
+           if (exists (select 1 from DB.DBA.WA_USER_OL_ACCOUNTS where WUO_URL = profile_url))
+             {
+               declare uname varchar;
+               uname := (select U_NAME from SYS_USERS, WA_USER_OL_ACCOUNTS where WUO_U_ID = U_ID and 
+			WUO_URL = profile_url);
+	       http_value (sprintf ('You are logged in as ODS account: %s', uname), 'b');
+               sid := vspx_sid_generate ();
+               insert into VSPX_SESSION (VS_SID, VS_REALM, VS_UID, VS_EXPIRY, VS_STATE) 
+			values (sid, 'wa', uname, now (), serialize (vector ('vspx_user', uname)));
+
+               ?><br/><a href="/ods/?sid=<?V sid ?>&realm=wa">Continue to ODS</a><?vsp
+             }
+           else
+             http_value ('Can not match screen name against ODS account, please verify account settings', 'b');  
+        }
+      else 
+        {
+          ?><a href="<?V http_path () ?>?login=1"> <img src="images/linkedin-large.png" border="0"/> </a><?vsp
+        } 
+   ?>
+  </body>
+</html>
diff --git a/appsrc/ODS-Framework/login.js b/appsrc/ODS-Framework/login.js
new file mode 100644
index 0000000..4f24170
--- /dev/null
+++ b/appsrc/ODS-Framework/login.js
@@ -0,0 +1,398 @@
+/*
+ *
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *
+ *  Copyright (C) 1998-2010 OpenLink Software
+ *
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+var lfTab;
+var lfFacebookData;
+var lfOptions;
+var lfAjaxs = 0;
+var lfNotReturn = true;
+var lfAttempts = 0;
+
+function lfRowValue(tbl, label, value, leftTag) {
+  if (!leftTag) {
+    leftTag = 'th';
+  }
+  var tr = OAT.Dom.create('tr');
+  var th = OAT.Dom.create(leftTag);
+  th.width = '20%';
+  th.innerHTML = label;
+  tr.appendChild(th);
+  if (value) {
+    var td = OAT.Dom.create('td');
+    td.innerHTML = value;
+    tr.appendChild(td);
+  }
+  tbl.appendChild(tr);
+}
+
+function lfInit() {
+  if (!$("lf")) {return;}
+
+  lfOptrions = {onstart: lfStart, onend: lfEnd};
+  var regData;
+  var x = function (data) {
+    try {
+      regData = OAT.JSON.parse(data);
+    } catch (e) { regData = {}; }
+  }
+  OAT.AJAX.GET ('/ods/api/server.getInfo?info=regData', false, x, {async: false});
+
+  lfTab = new OAT.Tab("lf_content", {goCallback: lfCallback});
+  lfTab.add("lf_tab_0", "lf_page_0");
+  if (regData.openidEnable)
+    OAT.Dom.show('lf_tab_1');
+  lfTab.add("lf_tab_1", "lf_page_1");
+  lfTab.add("lf_tab_2", "lf_page_2");
+  lfTab.add("lf_tab_3", "lf_page_3");
+  if (regData.twitterEnable)
+    OAT.Dom.show('lf_tab_4');
+  lfTab.add("lf_tab_4", "lf_page_4");
+  if (regData.linkedinEnable)
+    OAT.Dom.show('lf_tab_5');
+  lfTab.add("lf_tab_5", "lf_page_5");
+  lfTab.go(0);
+  var uriParams = OAT.Dom.uriParams();
+  if (uriParams['oid-form'] == 'lf') {
+    OAT.Dom.show('lf');
+    if (uriParams['oid-mode'] == 'twitter') {
+      lfTab.go(4);
+      lfNotReturn = false;
+      $('lf_login').click();
+    }
+    else if (uriParams['oid-mode'] == 'linkedin') {
+      lfTab.go(5);
+      lfNotReturn = false;
+      $('lf_login').click();
+    }
+    else {
+      $('lf_openId').value = uriParams['openid.identity'];
+    lfTab.go(1);
+    if (typeof (uriParams['openid.signed']) != 'undefined' && uriParams['openid.signed'] != '')
+    {
+      OAT.AJAX.POST("/ods/api/user.authenticate", lfOpenIdLoginURL(uriParams), $('lf_login').onclick);
+    }
+    else if (typeof (uriParams['openid.mode']) != 'undefined' && uriParams['openid.mode'] == 'cancel')
+    {
+      alert('OpenID Authentication Failed');
+    }
+    }
+  }
+
+  if (regData.facebookEnable) {
+    lfLoadFacebookData(function() {
+      if (lfFacebookData)
+        FB.init(lfFacebookData.api_key, "/ods/fb_dummy.vsp", {
+          ifUserConnected : function() {
+            lfShowFacebookData();
+          },
+          ifUserNotConnected : function() {
+            lfHideFacebookData();
+          }
+        });
+    });
+  }
+
+  if ((document.location.protocol == 'https:') && regData.sslEnable) {
+    var x = function(data) {
+      var sslData;
+      try {
+        sslData = OAT.JSON.parse(data);
+      } catch (e) {
+        sslData = null;
+      }
+      if (sslData && sslData.iri && sslData.certLogin) {
+        var prefix = 'lf';
+        OAT.Dom.show(prefix+"_tab_3");
+        var tbl = $(prefix+'_table_3');
+        if (tbl) {
+          lfRowValue(tbl, 'WebID', sslData.iri);
+          if (sslData.firstName)
+            lfRowValue(tbl, 'First Name', sslData.firstName);
+          if (sslData.family_name)
+            lfRowValue(tbl, 'Family Name', sslData.family_name);
+          if (sslData.mbox)
+            lfRowValue(tbl, 'E-Mail', sslData.mbox);
+
+          lfTab.go(3);
+        }
+      }
+    }
+    OAT.AJAX.GET('/ods/api/user.getFOAFSSLData?sslFOAFCheck=1', '', x);
+  }
+}
+
+function lfCallback(oldIndex, newIndex) {
+  if (newIndex == 0)
+    $('lf_login').value = 'Login';
+  else if (newIndex == 1)
+    $('lf_login').value = 'OpenID Login';
+  else if (newIndex == 2)
+    $('lf_login').value = 'Facebook Login';
+  else if (newIndex == 3)
+    $('lf_login').value = 'WebID Login';
+  else if (newIndex == 4)
+    $('lf_login').value = 'Twitter Login';
+  else if (newIndex == 5)
+    $('lf_login').value = 'LinkedIn Login';
+
+  pageFocus('lf_page_'+newIndex);
+}
+
+function lfStart() {
+  lfAjaxs++;
+  var inputs = $("lf").getElementsByTagName('input');
+  for (var i = 0; i < inputs.length; i++)
+    inputs[i].tokenReceived = false;
+
+  $('lf_login').disabled = true;
+  $('lf_register').disabled = true;
+	OAT.Dom.hide('lf_close');
+	OAT.Dom.show('lf_throbber');
+}
+
+function lfEnd() {
+  lfAjaxs--;
+  if (lfAjaxs == 0) {
+    var inputs = $("lf").getElementsByTagName('input');
+    for (var i = 0; i < inputs.length; i++)
+      inputs[i].tokenReceived = true;
+
+    OAT.Dom.hide('lf_throbber');
+  	OAT.Dom.show('lf_close');
+    $('lf_login').disabled = false;
+    $('lf_register').disabled = false;
+  }
+}
+
+function lfLoginSubmit(cb) {
+  var notReturn = lfNotReturn;
+  lfNotReturn = true;
+  var mode = lfTab.selectedIndex;
+  var prefix = 'lf';
+  var q = '';
+  if (mode == 1) {
+    var uriParams = OAT.Dom.uriParams();
+    if (typeof (uriParams['openid.signed']) != 'undefined' && uriParams['openid.signed'] != '') {
+      q += lfOpenIdLoginURL(uriParams);
+    } else {
+      if ($(prefix+'_openId').value.length == 0)
+        return showError('Invalid OpenID URL');
+
+      lfOpenIdAuthenticate(prefix);
+      return false;
+    }
+  } else if (mode == 2) {
+    if (!lfFacebookData || !lfFacebookData.uid)
+      return showError('Invalid Facebook UserID');
+
+    q += '&facebookUID=' + lfFacebookData.uid;
+  } else if (mode == 3) {
+  } else if (mode == 4) {
+    var uriParams = OAT.Dom.uriParams();
+	  if (notReturn || (typeof (uriParams['oauth_verifier']) == 'undefined') || (typeof (uriParams['oauth_token']) == 'undefined')) {
+      twitterAuthenticate('lf');
+      return false;
+    }
+    q +='oauthMode=twitter'
+      + '&oauthSid=' + encodeURIComponent(uriParams['sid'])
+      + '&oauthVerifier=' + encodeURIComponent(uriParams['oauth_verifier'])
+      + '&oauthToken=' + encodeURIComponent(uriParams['oauth_token']);
+  } else if (mode == 5) {
+    var uriParams = OAT.Dom.uriParams();
+	  if ((notReturn || typeof (uriParams['oauth_verifier']) == 'undefined') || (typeof (uriParams['oauth_token']) == 'undefined')) {
+      linkedinAuthenticate('lf');
+      return false;
+    }
+    q +='oauthMode=linkedin'
+      + '&oauthSid=' + encodeURIComponent(uriParams['sid'])
+      + '&oauthVerifier=' + encodeURIComponent(uriParams['oauth_verifier'])
+      + '&oauthToken=' + encodeURIComponent(uriParams['oauth_token']);
+  } else {
+    if (($(prefix+'_uid').value.length == 0) || ($(prefix+'_password').value.length == 0))
+      return showError('Invalid User ID or Password');
+
+    q +='user_name=' + encodeURIComponent($v(prefix+'_uid'))
+      + '&password_hash=' + encodeURIComponent(OAT.Crypto.sha($v(prefix+'_uid') + $v(prefix+'_password')));
+  }
+  OAT.AJAX.POST("/ods/api/user.authenticate", q, ((cb)? cb: lfAfterLogin), lfOptrions);
+  return false;
+}
+
+function lfAfterLogin(data) {
+  var xml = OAT.Xml.createXmlDoc(data);
+  if (!hasError(xml)) {
+    lfAttempts = 0;
+    OAT.Dom.hide('lf_forget');
+
+    var frm = document.forms['page_form'];
+    hiddenCreate('sid', frm, OAT.Xml.textValue(xml.getElementsByTagName('sid')[0]));
+    hiddenCreate('realm', frm, 'wa');
+    hiddenCreate('command', frm, 'login');
+  	doPost('page_form', 'lf_login2');
+  } else {
+    lfAttempts++;
+    OAT.Dom.show('lf_forget');
+  }
+  return false;
+}
+
+function lfOpenIdLoginURL(uriParams) {
+  var openIdServer       = uriParams['oid-srv'];
+  var openIdSig          = uriParams['openid.sig'];
+  var openIdIdentity     = uriParams['openid.identity'];
+  var openIdAssoc_handle = uriParams['openid.assoc_handle'];
+  var openIdSigned       = uriParams['openid.signed'];
+
+  var url = openIdServer + ((openIdServer.lastIndexOf('?') != -1)? '&': '?') +
+    'openid.mode=check_authentication' +
+    '&openid.assoc_handle=' + encodeURIComponent (openIdAssoc_handle) +
+    '&openid.sig='          + encodeURIComponent (openIdSig) +
+    '&openid.signed='       + encodeURIComponent (openIdSigned);
+
+  var sig = openIdSigned.split(',');
+  for (var i = 0; i < sig.length; i++)
+  {
+    var _key = sig[i].trim ();
+    if (_key != 'mode' &&
+        _key != 'signed' &&
+        _key != 'assoc_handle')
+    {
+      var _val = uriParams['openid.' + _key];
+      if (_val != '')
+        url += '&openid.' + _key + '=' + encodeURIComponent (_val);
+    }
+  }
+  return '&openIdUrl=' + encodeURIComponent (url) + '&openIdIdentity=' + encodeURIComponent (openIdIdentity);
+}
+
+function lfOpenIdAuthenticate(prefix) {
+  var q = 'openIdUrl=' + encodeURIComponent($v(prefix+'_openId'));
+  var x = function (data) {
+    var xml = OAT.Xml.createXmlDoc(data);
+    var error = OAT.Xml.xpath (xml, '//error_response', {});
+    if (error.length)
+      showError('Invalied OpenID Server');
+
+    var oidServer = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/server', {})[0]);
+    if (!oidServer || !oidServer.length)
+      showError(' Cannot locate OpenID server');
+
+    var oidVersion = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/version', {})[0]);
+    var oidDelegate = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/delegate', {})[0]);
+		var oidUrl = OAT.Xml.textValue(OAT.Xml.xpath(xml, '/openIdServer_response/identity', {})[0]);
+
+    var oidIdent = oidUrl;
+    if (oidDelegate && oidDelegate.length)
+      oidIdent = oidDelegate;
+
+    var thisPage  = document.location.protocol +
+      '//' +
+      document.location.host +
+      document.location.pathname +
+      '?oid-form=' + prefix +
+      '&oid-srv=' + encodeURIComponent (oidServer);
+
+    var trustRoot = document.location.protocol + '//' + document.location.host;
+
+    var S = oidServer + ((oidServer.lastIndexOf('?') != -1)? '&': '?') +
+      'openid.mode=checkid_setup' +
+      '&openid.return_to=' + encodeURIComponent(thisPage);
+
+    if (oidVersion == '1.0')
+      S +='&openid.identity=' + encodeURIComponent(oidIdent)
+        + '&openid.trust_root=' + encodeURIComponent(trustRoot);
+
+    if (oidVersion == '2.0')
+      S +='&openid.ns=' + encodeURIComponent('http://specs.openid.net/auth/2.0')
+        + '&openid.claimed_id=' + encodeURIComponent(oidIdent)
+        + '&openid.identity=' + encodeURIComponent(oidIdent)
+
+    document.location = S;
+  };
+  OAT.AJAX.POST ("/ods_services/Http/openIdServer", q, x);
+}
+
+function twitterAuthenticate(prefix) {
+  var thisPage  = document.location.protocol +
+    '//' +
+    document.location.host +
+    document.location.pathname +
+    '?oid-mode=twitter&oid-form=' + prefix;
+
+  var x = function (data) {
+    document.location = data;
+  }
+  OAT.AJAX.POST ("/ods/api/twitterServer?hostUrl="+encodeURIComponent(thisPage), null, x);
+}
+
+function linkedinAuthenticate(prefix) {
+  var thisPage  = document.location.protocol +
+    '//' +
+    document.location.host +
+    document.location.pathname +
+    '?oid-mode=linkedin&oid-form=' + prefix;
+
+  var x = function (data) {
+    document.location = data;
+  }
+  OAT.AJAX.POST ("/ods/api/linkedinServer?hostUrl="+encodeURIComponent(thisPage), null, x);
+}
+
+function lfLoadFacebookData(cb) {
+  var x = function(data) {
+    try {
+      lfFacebookData = OAT.JSON.parse(data);
+    } catch (e) {
+      lfFacebookData = null;
+    }
+
+    if (lfFacebookData)
+      OAT.Dom.show("lf_tab_2");
+
+    if (cb) {cb()};
+  }
+  OAT.AJAX.GET('/ods/api/user.getFacebookData?fields=uid,name,first_name,last_name,sex,birthday', '', x);
+}
+
+function lfShowFacebookData(skip) {
+  var lfLabel = $('lf_facebookData');
+  if (lfLabel) {
+    lfLabel.innerHTML = '';
+    if (lfFacebookData && lfFacebookData.name) {
+      lfLabel.innerHTML = 'Connected as <b><i>' + lfFacebookData.name + '</i></b></b>';
+    } else if (!skip) {
+      lfLoadFacebookData(function() {lfShowFacebookData(true);});
+    }
+  }
+}
+
+function lfHideFacebookData() {
+  var label = $('lf_facebookData');
+  if (label)
+    label.innerHTML = '';
+  if (lfFacebookData) {
+    var o = {}
+    o.api_key = lfFacebookData.api_key;
+    o.secret = lfFacebookData.secret;
+    lfFacebookData = o;
+  }
+}
diff --git a/appsrc/ODS-Framework/login.vspx b/appsrc/ODS-Framework/login.vspx
index b7e0b1d..82275a1 100644
--- a/appsrc/ODS-Framework/login.vspx
+++ b/appsrc/ODS-Framework/login.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: login.vspx,v 1.7.2.1 2010/03/12 09:10:12 source Exp $
+ -  $Id: login.vspx,v 1.7.2.3 2010/09/22 13:55:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -35,12 +35,12 @@
     <vm:pagewrapper>
       <vm:rawheader caption=""/>
       <vm:body default-input="username">
-        <div id="login_page">
+        <div style="margin-left: 20px;">
           <h1 class="page_title">
             <?vsp
               declare copy varchar;
-              copy := (select top 1 WS_WEB_TITLE from WA_SETTINGS);
 
+              copy := (select top 1 WS_WEB_TITLE from WA_SETTINGS);
               if (copy = '' or copy is null)
                 http(sys_stat ('st_host_name'));
               else
diff --git a/appsrc/ODS-Framework/login_keys.vspx b/appsrc/ODS-Framework/login_keys.vspx
new file mode 100644
index 0000000..9a8507f
--- /dev/null
+++ b/appsrc/ODS-Framework/login_keys.vspx
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: login_keys.vspx,v 1.1.4.3 2011/03/08 13:28:14 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="login-keys-page"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        style="index.xsl"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+  <vm:page>
+    <vm:header>
+      <vm:title>Login Authentication Keys</vm:title>
+    </vm:header>
+    <v:on-init>
+      if (wa_user_is_dba (connection_get ('vspx_user'), null) = 0)
+        signal('22024', 'You have no DBA privileges!');
+    </v:on-init>
+    <vm:pagewrapper>
+      <v:variable name="lk_edit" type="integer" default="null" param-name="edit" />
+      <v:variable name="lk_delete" type="integer" default="null" param-name="del" />
+      <vm:navigation on="settings"/>
+      <vm:navigation1 on="admin"/>
+      <vm:navigation2 on="endpoint"/>
+      <vm:rawheader caption="Login Keys"/>
+      <vm:body>
+        <vm:login redirect="index.vspx"/>
+        <table class="listing" rules="groups">
+          <colgroup>
+            <col/>
+            <col/>
+          </colgroup>
+          <tr class="listing_header_row">
+            <th>Provider</th>
+            <th width="5%">Action</th>
+          </tr>
+          <v:data-set name="maps" sql="select A_ID, A_NAME, A_KEY, A_SECRET from OAUTH..APP_REG where A_OWNER = 0" scrollable="1" editable="1" nrows="0">
+            <v:before-data-bind>
+              if (not e.ve_is_post and self.lk_delete is not null)
+              {
+                delete from OAUTH..APP_REG where A_ID = self.lk_delete;
+              }
+            </v:before-data-bind>
+            <v:template name="maps_rep" type="repeat">
+              <v:template name="maps_brows" type="browse">
+                <v:after-data-bind>
+                  if (not e.ve_is_post and control.te_rowset[0] = self.lk_edit)
+                  {
+                    self.a_name.ufl_value := control.te_rowset[1];
+                    self.a_key.ufl_value := control.te_rowset[2];
+                    self.a_secret.ufl_value := control.te_rowset[3];
+                  }
+                </v:after-data-bind>
+                <tr class="<?V case when self.lk_edit = control.te_rowset[0] then 'listing_row_selected' when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
+                  <td>
+                    <v:url name="ur1"
+                      value='--concat ('<img src="images/icons/edit_16.png" hspace="3" border="0"/>', (control.vc_parent as vspx_row_template).te_rowset[1])'
+                      format="%s"
+                      url="--sprintf ('login_keys.vspx?edit=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
+                      xhtml_title="Edit"
+                      xhtml_alt="Edit"
+                    />
+                  </td>
+                  <td nowrap="nowrap">
+                    <v:url name="ur2" value='<img src="images/icons/trash_16.png" hspace="3" border="0"/>Delete'
+                      format="%s"
+                      url="--sprintf ('login_keys.vspx?del=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
+                      xhtml_title="Delete"
+                      xhtml_alt="Delete"
+                      xhtml_class="img_button"
+                    />
+                  </td>
+                </tr>
+              </v:template>
+            </v:template>
+            <v:template name="maps_footer" type="simple">
+              <tr>
+                <td colspan="3" class="listing_col_action">
+                  <vm:ds-navigation data-set="maps" type="set" />
+                </td>
+              </tr>
+            </v:template>
+          </v:data-set>
+        </table>
+        <div class="fm">
+          <table>
+            <tr>
+              <th width="70px">
+                <label for="a_name">API Name</label>
+              </th>
+              <td>
+                <v:select-list name="a_name" value="" xhtml_id="a_name" error-glyph="*">
+                  <v:item name="Twitter API" value="Twitter API"/>
+                  <v:item name="LinkedIn API" value="LinkedIn API"/>
+                </v:select-list>
+              </td>
+            </tr>
+            <tr>
+              <th>
+                <label for="a_key">Key</label>
+              </th>
+              <td>
+                <v:text name="a_key" value="" xhtml_size="110" xhtml_id="a_key" error-glyph="*" />
+              </td>
+            </tr>
+            <tr>
+              <th>
+                <label for="a_secret">Secret</label>
+              </th>
+              <td>
+                <v:text name="a_secret" value="" xhtml_size="110" xhtml_id="a_secret" error-glyph="*" />
+              </td>
+            </tr>
+            <tr>
+              <th>
+              </th>
+              <td>
+                <v:button name="cancel1" value="Cancel" action="simple" enabled="--equ(isnull(self.lk_edit),0)">
+                  <v:on-post>
+                    self.a_name.ufl_value := '';
+                    self.a_key.ufl_value := '';
+                    self.a_secret.ufl_value := '';
+                    self.lk_edit := null;
+
+                    self.save1.vc_data_bind (e);
+                    control.vc_enabled := 0;
+                  </v:on-post>
+                </v:button>
+                <v:button name="save1" value="--case when self.lk_edit is null then 'Add' else 'Update' end" action="simple">
+                  <v:on-post>
+                    if (not self.vc_is_valid)
+                      return;
+
+                    declare exit handler for sqlstate '23000'
+                    {
+                      rollback work;
+                      self.vc_is_valid := 0;
+                      self.vc_error_message := 'The values entered conflict with other data. Please supply correct new values.';
+                      return;
+                    };
+                    if (self.lk_edit is null)
+                    {
+                      insert into OAUTH..APP_REG (A_OWNER, A_NAME, A_KEY, A_SECRET)
+                        values (0, self.a_name.ufl_value, self.a_key.ufl_value, self.a_secret.ufl_value);
+                    }
+                    else
+                    {
+                      update OAUTH..APP_REG
+                         set A_NAME = self.a_name.ufl_value,
+                             A_KEY = self.a_key.ufl_value,
+                             A_SECRET = self.a_secret.ufl_value
+                       where A_ID = self.lk_edit;
+                    }
+                    self.a_name.ufl_value := '';
+                    self.a_key.ufl_value := '';
+                    self.a_secret.ufl_value := '';
+                    self.lk_edit := null;
+
+                    control.vc_data_bind (e);
+                    self.maps.vc_data_bind (e);
+                  </v:on-post>
+                </v:button>
+              </td>
+            </tr>
+          </table>
+        </div>
+      </vm:body>
+    </vm:pagewrapper>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Framework/mail.vspx b/appsrc/ODS-Framework/mail.vspx
index 5b572e9..c4426b2 100644
--- a/appsrc/ODS-Framework/mail.vspx
+++ b/appsrc/ODS-Framework/mail.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: mail.vspx,v 1.5 2008/02/08 13:49:24 source Exp $
+ -  $Id: mail.vspx,v 1.5.2.1 2010/09/20 10:15:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/mail_preview.vspx b/appsrc/ODS-Framework/mail_preview.vspx
index 0191a87..0452207 100644
--- a/appsrc/ODS-Framework/mail_preview.vspx
+++ b/appsrc/ODS-Framework/mail_preview.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: mail_preview.vspx,v 1.5 2007/02/27 21:19:45 source Exp $
+ -  $Id: mail_preview.vspx,v 1.5.2.1 2010/09/20 10:15:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/make_ods_vad.xml b/appsrc/ODS-Framework/make_ods_vad.xml
index 47567a6..b81e483 100644
--- a/appsrc/ODS-Framework/make_ods_vad.xml
+++ b/appsrc/ODS-Framework/make_ods_vad.xml
@@ -5,12 +5,12 @@
   <name package="Framework">
     <prop name="Title" value="ODS Framework"/>
     <prop name="Developer" value="OpenLink Software"/>
-    <prop name="Copyright" value="(C) 1998-2010 OpenLink Software"/>
+    <prop name="Copyright" value="(C) 1998-2011 OpenLink Software"/>
     <prop name="Download" value="http://www.openlinksw.com/virtuoso"/>
     <prop name="Download" value="http://www.openlinksw.co.uk/virtuoso"/>
   </name>
-  <version package="1.73.23">
-    <prop name="Release Date" value="2010-07-09 18:24"/>
+  <version package="1.80.92">
+    <prop name="Release Date" value="2011-03-30 01:46"/>
     <prop name="Build" value="Release, optimized"/>
   </version>
 </caption>
@@ -49,8 +49,8 @@
     <![CDATA[
       declare rc any; 
       registry_set('_wa_path_', '/DAV/VAD/wa/');
-      registry_set('_wa_version_', '1.73.23');
-      registry_set('_wa_build_', '2010-07-09 18:24');
+      registry_set('_wa_version_', '1.80.92');
+      registry_set('_wa_build_', '2011-03-30 01:46');
       DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/sn.sql', 1, 'report', 1);
       DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/hosted_services.sql', 1, 'report', 1);
       DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/registration_xml.sql', 1, 'report', 1);
@@ -105,10 +105,15 @@
       DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/ods_api.sql', 1, 'report', 1);
       DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/ods_api_users.sql', 1, 'report', 1);
       DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/ods_controllers.sql', 1, 'report', 1);
+      DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/webfinger.sql', 1, 'report', 1);
+      DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/salmon.sql', 1, 'report', 1);
+      DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/SWD.sql', 1, 'report', 1);
+      DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/ods_upstream.sql', 1, 'report', 1);
       DB.DBA.VHOST_REMOVE (lpath=>'/oauth');
       DB.DBA.VHOST_DEFINE (lpath=>'/oauth', ppath=>'/DAV/VAD/wa/oauth/', vsp_user=>'dba', is_dav=>1, is_brws=>0, def_page=>'index.vsp');
       if (server_https_port () is not null) 
 	DB.DBA.wa_redefine_vhosts (); 
+	    DB.DBA.WA_USER_OL_ACCOUNTS_SET_UP (); 
     ]]>
   </sql>
   <sql purpose="pre-uninstall">
@@ -119,6 +124,7 @@
 </ddls>
 <resources>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/DET_RDFData.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/SWD.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/aboutus.html" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/accounts.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/add_rule.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
@@ -189,6 +195,7 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/plugins/smiley/images/wink_smile.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/plugins/specialchar/dialogs/specialchar.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/plugins/specialchar/lang/en.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/plugins/styles/styles/default.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/plugins/table/dialogs/table.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/plugins/tabletools/dialogs/tableCell.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
@@ -204,6 +211,7 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/skins/kama/dialog.css" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/skins/kama/editor.css" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/skins/kama/icons.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/skins/kama/icons_rtl.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/skins/kama/images/dialog_sides.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/skins/kama/images/dialog_sides.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ckeditor/skins/kama/images/dialog_sides_rtl.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
@@ -356,6 +364,7 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/database_32.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/dav_16.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/del_16.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/disconnect_16.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/docs_16.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/docs_32.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/edit_16.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
@@ -373,6 +382,7 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/group_16.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/group_24.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/last_16.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/link_16.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/lock_16.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/mail_16.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/mail_24.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
@@ -455,6 +465,7 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/icons/wiki_24.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/info.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/lft_nav_grad1.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/linkedin-large.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/lock.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/login-bg.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/mail_16.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
@@ -576,6 +587,17 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/10.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/11.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/12.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/book.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/camera.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/car.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/coffee.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/creditcards.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/dollar.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/drink.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/football.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/house.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/info.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/mail.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/p01.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/p02.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/p03.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
@@ -588,6 +610,9 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/p10.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/p11.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/p12.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/shield.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/shoppingcart.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/markers/star.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/progress.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/resize.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/shadow_bottom.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
@@ -596,6 +621,7 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/submenu.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/sw-cube.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/throbber.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/throbber_small.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/virt_power_no_border.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/winround_arrow_lb.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/oat/winround_arrow_lt.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
@@ -640,6 +666,7 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/search.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/sel_nav2_grad2.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/sel_nav_grad2.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/select.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/service.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/services/amazon.jpg" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/services/ameba.jpg" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
@@ -706,6 +733,7 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/services/youtube.jpg" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/services/zooomr.jpg" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/side_box_bkg_grad.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/images/sign-in-with-twitter-d.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/sioc_button.gif" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/sioc_button.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/images/skin/default/default_widget.png" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
@@ -774,7 +802,10 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/join.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ldap.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ldap_search.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/linkedin_login.vsp" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/login.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/login.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/login_keys.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/mail.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/mail_preview.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/map_svc.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
@@ -936,12 +967,13 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ods_ubiquity.css" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ods_ubiquity.html" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ods_ubiquity.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
-  <file overwrite="yes" type="dav" source="data" target_uri="wa/oid_login.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/ods_upstream.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/openid.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/openid.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/openid_helper.vsp" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/openid_login.css" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/openid_login.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/openid_oauth_test.vsp" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/opensocial.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/pass_recovery.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ping_log.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
@@ -956,10 +988,12 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/rdfb.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/rdfm.css" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/rdfm.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/register.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/register.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/registration_xml.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/related_apps.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/s3.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/salmon.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/scot.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/search.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/search_ajax.vsp" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
@@ -1011,18 +1045,31 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/tools.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/trs_export.xml" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/trs_export_all.xml" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/twitter_login.vsp" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/typeahead.css" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/typeahead.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/ufoaf.xml" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uhome.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_acl.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_acls.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_ann.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_buss.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_buss_0.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_buss_1.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_buss_2.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_buss_3.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_bz.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_groups.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_grp.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_knows.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_ldap.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_ldap_include.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_likes.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_nav.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_offerlist.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_others.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_owns.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_personal.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_personal_0.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_personal_1.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
@@ -1034,10 +1081,13 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_prj.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_pwd.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_related.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_sec.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_svc.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_val.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_validation.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_visb.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_wishlist.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/uiedit_ws.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/url_rew.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/url_rule.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/user_rdf.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
@@ -1053,6 +1103,7 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/users/users.xsl" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/users_select.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/users_select.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/validate.js" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/vhost.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/vhost_simple.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/view.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
@@ -1064,6 +1115,8 @@
   <file overwrite="yes" type="dav" source="data" target_uri="wa/wa_template.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/web_header.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/web_svc.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/webfinger.sql" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
+  <file overwrite="yes" type="dav" source="data" target_uri="wa/webid_select.vspx" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/winrect.css" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/winround.css" dav_owner="dav" dav_grp="administrators" dav_perm="110100100NN" makepath="yes"/>
   <file overwrite="yes" type="dav" source="data" target_uri="wa/yadis.vsp" dav_owner="dav" dav_grp="administrators" dav_perm="111101101NN" makepath="yes"/>
diff --git a/appsrc/ODS-Framework/make_vad.sh b/appsrc/ODS-Framework/make_vad.sh
index 140ece9..6cbc79d 100755
--- a/appsrc/ODS-Framework/make_vad.sh
+++ b/appsrc/ODS-Framework/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.57.2.7 2010/06/28 09:46:12 source Exp $
+#  $Id: make_vad.sh,v 1.57.2.13 2011/02/03 10:26:15 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -337,7 +337,7 @@ sticker_init() {
   echo "  <name package=\"Framework\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS Framework\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
@@ -440,10 +440,15 @@ sticker_init() {
   echo "      DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/ods_api.sql', 1, 'report', 1);" >> $STICKER
   echo "      DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/ods_api_users.sql', 1, 'report', 1);" >> $STICKER
   echo "      DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/ods_controllers.sql', 1, 'report', 1);" >> $STICKER
+  echo "      DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/webfinger.sql', 1, 'report', 1);" >> $STICKER
+  echo "      DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/salmon.sql', 1, 'report', 1);" >> $STICKER
+  echo "      DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/SWD.sql', 1, 'report', 1);" >> $STICKER
+  echo "      DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wa/ods_upstream.sql', 1, 'report', 1);" >> $STICKER
   echo "      DB.DBA.VHOST_REMOVE (lpath=>'/oauth');" >> $STICKER
   echo "      DB.DBA.VHOST_DEFINE (lpath=>'/oauth', ppath=>'/DAV/VAD/wa/oauth/', vsp_user=>'dba', is_dav=>1, is_brws=>0, def_page=>'index.vsp');" >> $STICKER
   echo "      if (server_https_port () is not null) " >> $STICKER
   echo "	DB.DBA.wa_redefine_vhosts (); " >> $STICKER
+  echo "	    DB.DBA.WA_USER_OL_ACCOUNTS_SET_UP (); " >> $STICKER
   echo "    ]]>" >> $STICKER
   echo "  </sql>" >> $STICKER
   echo "  <sql purpose=\"pre-uninstall\">" >> $STICKER
diff --git a/appsrc/ODS-Framework/map_svc.vspx b/appsrc/ODS-Framework/map_svc.vspx
index adb428c..6e16078 100644
--- a/appsrc/ODS-Framework/map_svc.vspx
+++ b/appsrc/ODS-Framework/map_svc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: map_svc.vspx,v 1.6 2008/02/08 13:49:24 source Exp $
+ -  $Id: map_svc.vspx,v 1.6.2.2 2011/03/08 13:28:14 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -55,10 +55,9 @@
 	      <tr class="listing_header_row">
 		  <th>Host</th>
 		  <th>Provider</th>
-		  <th>Action</th>
+      		  <th width="5%">Action</th>
 	      </tr>
-	      <v:data-set name="maps" sql="select WMH_HOST, WMH_SVC, WMH_KEY, WMH_ID from WA_MAP_HOSTS"
-		  scrollable="1" editable="1" nrows="1000">
+	        <v:data-set name="maps" sql="select WMH_HOST, WMH_SVC, WMH_KEY, WMH_ID from WA_MAP_HOSTS" scrollable="1" editable="1" nrows="1000">
 		  <v:before-data-bind>
 if (not e.ve_is_post and self.del_svc is not null)
 {
@@ -88,14 +87,14 @@ if (not e.ve_is_post and control.te_rowset[3] = self.edit_svc)
 			      </td>
 			      <td>
 				  <v:label name="la1" value="--(control.vc_parent as vspx_row_template).te_rowset[1]"/>
-
 			      </td>
-			      <td>
-				  <v:url name="ur2" value='<img src="images/icons/del_16.png" hspace="3" border="0"/>Delete'
+          			  <td nowrap="nowrap">
+          				  <v:url name="ur2" value='<img src="images/icons/trash_16.png" hspace="3" border="0"/>Delete'
 				      format="%s"
 				      url="--sprintf ('map_svc.vspx?del=%d', (control.vc_parent as vspx_row_template).te_rowset[3])"
 				      xhtml_title="Delete"
 				      xhtml_alt="Delete"
+          				      xhtml_class="img_button"
 				      />
 			      </td>
 			  </tr>
@@ -112,23 +111,28 @@ if (not e.ve_is_post and control.te_rowset[3] = self.edit_svc)
 	      </v:data-set>
 	  </table>
 	  <div class="fm">
-	      <fieldset>
-		  <label for="host1">Host & port</label>
+  	      <fieldset class="form">
+  	        <div>
+        		  <label class="form" for="host1">Host & port</label>
 		  <v:text name="host1" value="" xhtml_id="host1" error-glyph="*">
-		      <v:validator name="v_httphost" test="regexp" regexp="^[0-9A-Za-z_:.-]+\$"
-			  message="You should provide a valid host name."/>
-		  </v:text><br/>
-		  <label for="sl1">Mapping Service</label>
+      		      <v:validator name="v_httphost" test="regexp" regexp="^[0-9A-Za-z_:.-]+\$" message="You should provide a valid host name."/>
+  		        </v:text>
+  	        </div>
+  	        <div>
+        		  <label class="form" for="sl1">Mapping Service</label>
 		  <v:select-list name="sl1" xhtml_id="sl1" error-glyph="*">
 		      <v:item name="Google" value="GOOGLE" />
 		      <v:item name="Yahoo" value="YAHOO" />
-		  </v:select-list><br />
-		  <label for="key1">Key</label>
-		  <v:text name="key1" value="" xhtml_size="110" xhtml_id="key1" error-glyph="*">
-		      <v:validator test="length" min="1" max="4096"
-			  message="Key can not be empty nor longer than 4000 characters"/>
-		  </v:text><br />
-	      <span class="fm_ctl_btn">
+        		  </v:select-list>
+  	        </div>
+  	        <div>
+        		  <label class="form" for="key1">Key</label>
+        		  <v:text name="key1" value="" xhtml_size="80" xhtml_id="key1" error-glyph="*">
+        		    <v:validator test="length" min="1" max="4096" message="Key can not be empty nor longer than 4000 characters"/>
+        		  </v:text>
+  	        </div>
+  	        <div>
+        		  <label class="form"> </label>
 		  <v:button name="cancel1" value="Cancel" action="simple" enabled="--equ(isnull(self.edit_svc),0)">
 		      <v:on-post>
 self.host1.ufl_value := '';
@@ -159,8 +163,8 @@ if (self.edit_svc is null)
 }
 else
 {
-  update wa_map_hosts set
-      WMH_HOST = self.host1.ufl_value,
+                    update wa_map_hosts
+                       set WMH_HOST = self.host1.ufl_value,
 	       WMH_SVC = self.sl1.ufl_value,
 	       WMH_KEY = self.key1.ufl_value
 		   where WMH_ID = self.edit_svc;
@@ -173,7 +177,7 @@ control.vc_data_bind (e);
 self.maps.vc_data_bind (e);
 		      </v:on-post>
 		  </v:button>
-	      </span>
+	          </div>
 	  </fieldset>
       </div>
       </vm:body>
diff --git a/appsrc/ODS-Framework/member.vspx b/appsrc/ODS-Framework/member.vspx
index ce5a57b..2ca2972 100644
--- a/appsrc/ODS-Framework/member.vspx
+++ b/appsrc/ODS-Framework/member.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: member.vspx,v 1.6 2008/03/13 20:50:05 source Exp $
+ -  $Id: member.vspx,v 1.6.2.1 2010/09/20 10:15:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/member_edit.vspx b/appsrc/ODS-Framework/member_edit.vspx
index 14af762..9ba1494 100644
--- a/appsrc/ODS-Framework/member_edit.vspx
+++ b/appsrc/ODS-Framework/member_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: member_edit.vspx,v 1.5 2008/02/19 11:21:22 source Exp $
+ -  $Id: member_edit.vspx,v 1.5.2.1 2010/09/20 10:15:22 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/members.vspx b/appsrc/ODS-Framework/members.vspx
index 672f529..8f9fecf 100644
--- a/appsrc/ODS-Framework/members.vspx
+++ b/appsrc/ODS-Framework/members.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: members.vspx,v 1.12.2.2 2010/03/15 15:50:11 source Exp $
+ -  $Id: members.vspx,v 1.12.2.6 2010/11/11 12:38:18 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -21,27 +21,32 @@
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  -
 -->
-<v:page name="blog_home_page"
+<v:page name="members_page"
+        fast-render="1"
         xmlns:vm="http://www.openlinksw.com/vspx/ods/"
         xmlns:v="http://www.openlinksw.com/vspx/"
         style="index.xsl"
         doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
         doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
   <vm:page>
     <vm:header>
+      <script type="text/javascript" src="tbl.js">;</script>
       <vm:title>Application Members</vm:title>
     </vm:header>
     <v:on-init>
       <![CDATA[
-        select WAI_MEMBER_MODEL, WAI_IS_PUBLIC, WAI_MEMBERS_VISIBLE, WAI_INST, WAI_NAME, WAI_TYPE_NAME, WAI_DESCRIPTION
-          into self.imodel, self.is_public, self.is_visible, self.inst, self.iname, self.wa_type, self.idesc
-          from WA_INSTANCE
+        select WAI_MEMBER_MODEL, WAI_IS_PUBLIC, WAI_MEMBERS_VISIBLE, WAI_INST, WAI_NAME, WAI_TYPE_NAME, WAI_DESCRIPTION, deserialize(WAI_ACL)
+          into self.imodel, self.is_public, self.is_visible, self.inst, self.iname, self.wa_type, self.idesc, self.iacl
+          from DB.DBA.WA_INSTANCE
          where WAI_ID = self.iid;
         if (self.instance_descr is null)
           self.instance_descr := WA_GET_APP_NAME (coalesce(get_keyword('wa_name', self.vc_event.ve_params), (select WAI_TYPE_NAME from WA_INSTANCE where WAI_ID = get_keyword('wai_id', self.vc_event.ve_params)), ''));
         if (self.instance_descr = 'Blog')
+        {
           self.ihome := self.inst.wa_home_url();
-        if (self.wa_type in ('oMail'))
+        }
+        else if (self.wa_type in ('oMail'))
         {
           declare tmp varchar;
 
@@ -67,42 +72,39 @@
       <vm:variable name="inst" type="db.dba.web_app" default="null" persist="0" />
       <vm:variable name="wa_name" type="varchar" default="null" persist="0" param-name="wa_name"/>
       <vm:variable name="wa_type" type="varchar" default="null" persist="0"/>
-      <vm:variable name="imodel" type="int" default="null" persist="0"/>
-      <vm:variable name="is_public" type="int" default="null" persist="0"/>
-      <vm:variable name="is_visible" type="int" default="null" persist="0"/>
-      <vm:variable name="iid" type="int" default="null" persist="0" param-name="wai_id"/>
+      <vm:variable name="imodel" type="integer" default="null" persist="0"/>
+      <vm:variable name="is_public" type="integer" default="null" persist="0"/>
+      <vm:variable name="is_visible" type="integer" default="null" persist="0"/>
+      <vm:variable name="iid" type="integer" default="null" persist="0" param-name="wai_id"/>
       <vm:variable name="iname" type="varchar" default="null" persist="0"/>
       <vm:variable name="idesc" type="varchar" default="null" persist="0"/>
       <vm:variable name="ihome" type="varchar" default="null" persist="0"/>
       <vm:variable name="instance_descr" type="varchar" default="null" persist="0" />
+      <vm:variable name="iacl" type="any" default="null" persist="0" />
       <vm:variable name="wa_domain" type="varchar" default="null" persist="0"/>
-      <vm:variable name="domains" type="varchar" default="null" persist="0"/>
-      <vm:variable name="switch_adv" type="int" default="0" persist="0"/>
-      <vm:variable name="page_type" type="varchar" default="'edit'" persist="0"/>
       <vm:variable name="member_filter" type="varchar" default="'%'" persist="0"/>
       <vm:navigation on="settings"/>
       <vm:navigation1 on="services"/>
-      <vm:rawheader>
-        <h1 class="page_title"><v:label render-only="1" value="--self.iname || ' Members'" name="rah1" /></h1>
-      </vm:rawheader>
       <vm:body>
         <vm:login redirect="login.vspx"/>
-        <?vsp
-          if (self.wa_type not in ('oDrive', 'oMail', 'IM'))
-          {
-        ?>
-        <input type="hidden" name="page" value="membership"/>
-        <?vsp
-          if (self.wa_type in ('oWiki') and self.imodel = 1)
-          {
-            ;
-          }
-          else
-          {
-        ?>
+        <h3 class="page_title">
+          <v:label value="--self.iname"/>
+        </h3>
+  		  <v:button name="mem_Back" value="''" action="simple" style="url" xhtml_class="img_button">
+          <v:before-render>
+            <![CDATA[
+              control.ufl_value := '<img src="images/icons/go_16.png" border="0" /> Back to Applications';
+            ]]>
+          </v:before-render>
+ 		      <v:on-post>
+     			  self.vc_redirect ('services.vspx');
+ 		      </v:on-post>
+  		  </v:button>
+        <v:template name="template_01" type="simple" enabled="--case when self.wa_type in ('oDrive', 'oMail', 'IM') or (self.imodel = 1) then 0 else 1 end">
+          <fieldset>
+            <legend><b>Members</b></legend>
         <div>
           <?vsp
-          {
             declare cnt, cnt1 int;
             select count(*) into cnt from WA_INVITATIONS where WI_U_ID = self.u_id and WI_INSTANCE = self.iname;
             select count(*) into cnt1 from WA_MEMBER where WAM_INST = self.iname and WAM_STATUS > 2;
@@ -113,7 +115,6 @@
           <img src="images/icons/go_16.png" border="0" alt="Sent Invitations" /> <v:url name="app_inv_url" url="--sprintf ('app_sent_inv.vspx?wai_name=%U&wai_id=%d', self.iname, self.iid)" value="--sprintf ('You have %d pending Invitation(s)', cnt)" render-only="1"/>
           <?vsp
             }
-          }
           ?>
           <img src="images/icons/go_16.png" border="0" alt="Invite" /> <v:url name="app_inv1_url" url="--sprintf ('members_inv.vspx?wai_id=%d', self.iid)" value="Invite someone to join" render-only="1"/>
         </div>
@@ -178,19 +179,23 @@
                 <v:before-render>
                   control.vc_enabled := length((control as vspx_data_set).ds_rows_cache);
                 </v:before-render>
-                <v:template name="template2" type="repeat">
-                  <v:template name="template_ne4" type="if-not-exists">
-                    <tr><td colspan="4">No matching records</td></tr>
+
+                    <v:template name="ds_members_repeat" type="repeat">
+
+                      <v:template name="ds_members_empty" type="if-not-exists">
+                        <tr>
+                          <td colspan="4">No matching records</td>
+                        </tr>
                   </v:template>
 
-                  <v:template name="template99" type="edit">
+                      <v:template name="ds_members_edit2" type="edit">
                     <v:form name="upf" type="update" method="POST"  table="WA_MEMBER" if-not-exists="nothing">
                       <v:key name="upd_WAM_USER" column="WAM_USER" value="--self.ds_members.ds_current_row.te_rowset[2]" default="null"/>
                       <v:key name="upd_WAM_INST" column="WAM_INST" value="--self.iname" default="null"/>
                       <v:template name="template6" type="simple">
                       <tr>
                         <td>
-                          <v:label format="%s" name="ds_members_update_label_0" value="--self.ds_members.ds_current_row.te_rowset[0]"/>
+                              <v:label format="%s" value="--self.ds_members.ds_current_row.te_rowset[0]"/>
                         </td>
                         <td>
                           <v:data-list
@@ -226,13 +231,14 @@
                     </v:template>
                   </v:form>
                 </v:template>
-                <v:template name="template4" type="browse">
+
+                    <v:template name="ds_members_browse" type="browse">
                   <tr>
                     <td nowrap="1" width="20%">
-                      <v:label name="ds_members_name" value="--(control.vc_parent as vspx_row_template).te_rowset[0]" format="%s"/>
+                          <v:label value="--(control.vc_parent as vspx_row_template).te_rowset[0]" format="%s"/>
                     </td>
                     <td nowrap="1">
-                      <v:label name="ds_members_type" value="" format="%s" >
+                          <v:label value="" format="%s" >
                         <v:after-data-bind>
                           <![CDATA[
                             declare _type_name, _status any;
@@ -466,7 +472,8 @@
 
                     if (isnull(self.d_deleted))
                       self.d_deleted := vector();
-                    if (mode) {
+                        if (mode)
+                        {
                       declare tmp any;
                       tmp := vector();
                       for (N := 0; N < length(self.d_added); N := N + 1)
@@ -487,7 +494,7 @@
                     for (select U_NAME from DB.DBA.WA_MEMBER,DB.DBA.SYS_USERS where U_ID = WAM_USER and WAM_STATUS <> 1  and WAM_INST = self.iname) do
                     {
                       self.str_alreadymembers:=self.str_alreadymembers||','||U_NAME;
-                    };
+                        }
                     self.str_alreadyinlist :=  '';
 
                     declare exit handler for not found { goto _end; };
@@ -520,7 +527,7 @@
                 <vm:variable name="str_alreadymembers" type="varchar" default="''" persist="0" />
                 <div style="padding: 0 0 0.5em 0;">
                   <v:text name="member_name" type="hidden" value="--''" format="%s"/>
-                  <input type="button" value="Add member(s) to invite list" onClick="javascript:windowShow('users_select.vspx?mode=u&dst=m&src=s&params=member_name:s1;', 600)" class="button"/>
+                      <input type="button" value="Add member(s) to invite list" onClick="javascript:windowShow('users_select.vspx?mode=u&dst=mc&src=s&params=member_name:s1;', 600)" class="button"/>
                 </div>
                 <?vsp
                   if(length(self.d_added)>0)
@@ -589,8 +596,6 @@
                   <v:button name="btn_invite" action="simple" value="Invite member(s)" xhtml_class="form-button" enabled="--length(self.d_added)">
                     <v:on-post>
                       <![CDATA[
-                        self.current_member_model := (select WAI_MEMBER_MODEL from WA_INSTANCE where WAI_ID = self.iid);
-
                         -- check if user exists
                         declare _u_id, _u_name any;
                         declare model_type integer;
@@ -643,7 +648,7 @@
                           }
                           -- create session
                           declare _expire, _sid any;
-                          if (self.current_member_model = 2)
+                              if (self.imodel = 2)
                           {
                             _sid := md5 (concat (datestring (dateadd ('second', N, now())), http_client_ip(), http_path()));
                             _expire := coalesce((select top 1 WS_REGISTRATION_EMAIL_EXPIRY from WA_SETTINGS), 1);
@@ -681,7 +686,7 @@
                               goto nextcycle;
                             };
 
-                            if (self.current_member_model = 2)
+                                if (self.imodel = 2)
                             {
                               insert soft WA_MEMBER(WAM_USER, WAM_INST, WAM_MEMBER_TYPE, WAM_STATUS)
                                 values(_u_id, self.iname, model_type, 4);
@@ -716,12 +721,66 @@
              </td>
            </tr>
         </table>
-        <vm:variable name="current_member_model" type="int" default="0" persist="0"/>
       </v:form>
+          </fieldset>
+        </v:template>
+        <v:template name="template_02" type="simple">
+          <fieldset>
+            <legend><b>ACL</b></legend>
+            <table>
+              <tr>
+                <td width="100%">
+                  <table id="s_tbl" class="listing" style="width: 100%;" cellspacing="0">
+                    <thead>
+                      <tr class="listing_header_row">
+                        <th width="1%" nowrap="nowrap">Access Type</th>
+                        <th nowrap="nowrap">WebID</th>
+                        <th width="1%" align="center" nowrap="nowrap">ACL: (R)ead, (W)rite</th>
+                        <th width="1%">Action</th>
+                      </tr>
+                    </thead>
+                    <tr id="s_tr_no"><td colspan="4"><b>No WebID Security</b></td></tr>
+              		  <![CDATA[
+              		    <script type="text/javascript">
       <?vsp
-          }
+                        declare N integer;
+
+                        if (self.wa_type in ('oDrive'))
+                          self.iacl := ODRIVE.WA.aci_load (sprintf('/DAV/home/%s/', self.u_name));
+
+                        for (N := 0; N < length (self.iacl); N := N + 1)
+                        {
+                          http (sprintf ('ODSInitArray.push(function(){TBL.createRow("s", null, {fld_1: {mode: 50, value: "%s", onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, className: "_validate_ _webid_", value: "%s", readOnly: %s, imgCssText: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', self.iacl[N][2], self.iacl[N][1], case when self.iacl[N][2] = 'public' then 'true' else 'false' end, case when self.iacl[N][2] = 'public' then 'display: none;' else '' end, self.iacl[N][3], self.iacl[N][4], self.iacl[N][5]));
         }
       ?>
+              		    </script>
+              		  ]]>
+                  </table>
+                </td>
+                <td valign="top" nowrap="nowrap">
+                  <span class="button pointer" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 50, onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, className: '_validate_ _webid_'}, fld_3: {mode: 52, value: [1, 0, 0], tdCssText: 'width: 1%; text-align: center;'}});"><img src="/ods/images/icons/add_16.png" border="0" class="button" alt="Add Security" title="Add Security" /> Add</span><br /><br />
+                </td>
+              </tr>
+            </table>
+            <v:button name="btn_acl_update" action="simple" value="Update" xhtml_class="form-button">
+              <v:on-post>
+                <![CDATA[
+                  self.iacl := DB.DBA.wa_acl_params (e.ve_params);
+                  update DB.DBA.WA_INSTANCE
+                     set WAI_ACL = serialize (self.iacl)
+                   where WAI_ID = self.iid;
+
+                  if (self.wa_type in ('oDrive'))
+                    ODRIVE.WA.DAV_PROP_SET (sprintf('/DAV/home/%s/', self.u_name), 'virt:aci_meta_n3', ODRIVE.WA.aci_n3 (self.iacl));
+
+                  commit work;
+
+       		        self.vc_data_bind(e);
+                ]]>
+              </v:on-post>
+            </v:button>
+          </fieldset>
+        </v:template>
       </vm:body>
     </vm:pagewrapper>
   </vm:page>
diff --git a/appsrc/ODS-Framework/members_inv.vspx b/appsrc/ODS-Framework/members_inv.vspx
index dde61d8..a25aa9f 100644
--- a/appsrc/ODS-Framework/members_inv.vspx
+++ b/appsrc/ODS-Framework/members_inv.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: members_inv.vspx,v 1.7 2008/09/19 20:42:41 source Exp $
+ -  $Id: members_inv.vspx,v 1.7.2.1 2010/09/20 10:15:23 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/moat_ruleset_tags.vspx b/appsrc/ODS-Framework/moat_ruleset_tags.vspx
index cbfd31d..0a8f2ca 100644
--- a/appsrc/ODS-Framework/moat_ruleset_tags.vspx
+++ b/appsrc/ODS-Framework/moat_ruleset_tags.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: moat_ruleset_tags.vspx,v 1.1 2008/02/11 12:54:43 source Exp $
+ -  $Id: moat_ruleset_tags.vspx,v 1.1.2.1 2010/09/20 10:15:23 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/moat_tags.vspx b/appsrc/ODS-Framework/moat_tags.vspx
index b1676df..89fb0f5 100644
--- a/appsrc/ODS-Framework/moat_tags.vspx
+++ b/appsrc/ODS-Framework/moat_tags.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: moat_tags.vspx,v 1.3 2008/03/14 16:03:19 source Exp $
+ -  $Id: moat_tags.vspx,v 1.3.2.1 2010/09/20 10:15:23 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/myhome.vspx b/appsrc/ODS-Framework/myhome.vspx
index 35e243c..dca5edd 100644
--- a/appsrc/ODS-Framework/myhome.vspx
+++ b/appsrc/ODS-Framework/myhome.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: myhome.vspx,v 1.15.2.1 2009/07/17 14:46:47 source Exp $
+ -  $Id: myhome.vspx,v 1.15.2.3 2010/09/20 10:15:23 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -42,6 +42,9 @@
         <vm:login redirect="myhome.vspx"/>
         <vm:dash-my-whats-new />
         <vm:dash-my-dataspaces />
+        <vm:if test="_get_ods_fb_settings(vector())">
+          <vm:dash-my-facebook />
+        </vm:if>
         <vm:if test="wa_vad_check ('blog2') is not null">
           <vm:dash-my-blog />
         </vm:if>
@@ -74,9 +77,6 @@
         <vm:if test="wa_vad_check ('oGallery') is not null">
           <vm:dash-my-photos />
         </vm:if>
-        <vm:if test="_get_ods_fb_settings(vector(),self.u_id)">
-          <vm:dash-my-facebook />
-        </vm:if>
         <vm:if test="wa_vad_check ('oMail') is not null and 1=0">
           <vm:dash-my-guestbook />
         </vm:if>
diff --git a/appsrc/ODS-Framework/nav_framework.css b/appsrc/ODS-Framework/nav_framework.css
index c929f5d..a911aeb 100644
--- a/appsrc/ODS-Framework/nav_framework.css
+++ b/appsrc/ODS-Framework/nav_framework.css
@@ -763,24 +763,6 @@ div.conn_info_bubble div.rt {
 div.conn_info_bubble ul.menu a {
   color: #0066CC;}
 
-div.login_dialog {
-  font-size: 9pt;
-  position: absolute;
-  background-color: #fff;
-  border: 1px solid #336;
-  text-align: left;
-  padding: 0;
-  margin: 0}
-
-div.login_dialog label {width: 100px;
-  float: left;
- text-align: left;
-  margin: 23px 5px 0px 0px;}
-
-#loginErrDiv {
- padding-left: 40px;
- height : 14px;}
-
 div.sect { 
   padding: 0px 10px 0px 10px;}
 
@@ -788,166 +770,13 @@ div.sect {
   float: left;
   clear: both;
   width: 850px;
-  height: 300px;
+  height: 280px;
   color: #5f6366;
   background-color: #d9e9f2;
   text-align: left;}
-#id_col { float: left; clear: left}
-#form_col { float: left; margin-bottom: 50px;}
-#login_form_ctr {
-  margin: 20px;
-  border: 2px solid #b6d4e3;
-  background-color: #e0f0f9;}
-
-#login_form {
-  margin: 10px;
-  width: 450px;}
 
 #login_page img.id_logo {
-  margin: 50px 50px 50px 40px}
-
-#login_page h1 {
-  margin-left: 50px;
-  margin-right: 6px;}
-
-#login_page h2 {
-  font-size: 10pt;
-  margin-left: 10px}
-#login_page label {
-  display: block;
-  width: 100px;
-  float: left;
-  margin: 4px 0 10px 4px}
-
-#login_page .tab_bar li a img {
-  margin: 0 3px 0 0;
-  padding: 0;
-  vertical-align: middle}
-
-#loginUserName {
-  display: block;
-  width: 170px;
-  float: left;
-  margin-bottom: 10px}
-
-#loginUserPass {
-  display: block;
-  width: 170px;
-  float: left;
-  margin-bottom: 10px}
-#loginOpenIdUrl {
-  display: block;
-  width: 170px;
-  float: left;
-  margin-bottom: 10px}
-#login_frm_cb_remember_me {
-  display: block;
-  float: left;
-  margin-top: 5px;
-  margin-bottom: 10px}
-#login_page br {
-  clear: left}
-#loginBtn  {
-  margin-left: 100px;
-  font-weight: normal;
-  font-size: 8pt;
-  border: 1px solid #555;
-  background-color: #ddf;
-  color: #333;
-  margin: 3px}
-
-#loginBtn:hover {
-  background-color: #eef;}
-
-#loginX509  {
-  margin-left: 100px;
-  font-weight: normal;
-  font-size: 8pt;
-  border: 1px solid #555;
-  background-color: #ddf;
-  color: #333;
-  margin: 3px}
-
-#loginX509:hover {
-  background-color: #eef;}
-
-#signupBtn {
-  margin-left: 100px;
-  font-weight: normal;
-  font-size: 8pt;
-  border: 1px solid #555;
-  background-color: #ddf;
-  color: #333;
-  margin: 3px}
-
-#signupBtn:hover {
-  background-color: #eef;}
-
-#loginCloseBtn  {
-float: right;
-cursor: pointer;
-color: #000;
-  padding: 3px 5px 0px 0px;}
-
-div.login_error_ctr {
-  margin: 0;
-  padding: 0;
-  width: 100%;
-  background-color: #fff}
-p.login_error {
-  padding: 0;
-  padding-top: 5px;
-  margin-top: 10px;
-  margin: 5px;
-  width: 100%}
-p.login_error img {
-  vertical-align: middle;
-  margin-right: 3px;}
-#login_form a.pwd_recovery_url {
-  font-size: 8pt;
-  display: block;
-  margin-left: 100px;
-  margin-top: 5px;
-  color: #255}
-
-#loginThrobber {
-padding: 0px 0px 4px 82px;
-  color:#999;}
-
-#loginThrobber img
-{
- width:16px;
- height:16px;
- vertical-align:middle;
-}
-#loginForgot {
-  font-size: 8pt;
-  margin-left: 3px;
-  cursor: pointer;
-  text-decoration: underline;
-}
-
-#login_form div.login_frm_button_row {
-  margin-top: 6px;
-  margin-left: 100px;}
-
-h1.page_title img.openid_logo { margin-right: 6px; }
-
-#login_form_ctr p.login_frm_guide { margin: 6px; }
-
-p.login_frm_guide span.openid_client_name { font-weight: bold; }
-
-#cb_openid {
-  margin-left: 100px;
-  float: left;}
-
-#login_form label.cb {
-  clear: none;
-  float: left;}
-
-#login_form div.openid_selector {
-  float: left;
-  width: 100%;}
+  margin: 50px 25px 25px 30px}
 
 /* Error page */
 
@@ -1224,3 +1053,82 @@ div.map_user_data
   width:200px;
   overflow:hidden;
 }
+
+div.form {
+  width: 550px;
+  background-color: #FFF;
+  margin: 5px;
+}
+
+div.header {
+  width: 100%;
+  padding: 5px 0 5px 0;
+  background-color: #F6F6F6;
+  text-align: center;
+  font-size: 14px;
+  font-weight: bold;
+}
+
+div.footer {
+  width: 100%;
+  padding: 5px 0 5px 0;
+  background-color: #F6F6F6;
+  text-align: center;
+  font-size: 14px;
+  font-weight: bold;
+}
+
+table.form {
+  width: 100%;
+}
+
+table.form th {
+  text-align: right;
+  padding-right: 3px;
+  margin-bottom: 5px;
+  white-space: nowrap;
+}
+
+table.form td {
+  padding-left: 3px;
+  margin-bottom: 5px;
+  white-space: nowrap;
+}
+
+.tabs {
+	margin-top: 24px;
+	list-style-type: none;
+	padding-bottom: 1px;
+	padding-left: 0.5em;
+}
+
+.tabs li {
+	display: inline;
+	padding: 1px 3px;
+	margin-left: 0.1em;
+	cursor: pointer;
+  border-top: 1px solid #aaa;
+  border-left: 1px solid #aaa;
+  border-right: 1px solid #aaa;
+  -moz-border-radius-topleft: 3px;
+  -moz-border-radius-topright: 3px;
+  -webkit-border-top-left-radius: 3px;
+  -webkit-border-top-right-radius: 3px;
+	background-color: #EFEFEF;
+	z-index: 10;
+}
+
+.tabs li.tab_selected {
+	background-color: #FFF;
+}
+
+.tabs li.tab:hover {
+	background-color: #FFF;
+}
+
+#lf_close {
+  float: right;
+  cursor: pointer;
+  color: #000;
+  padding: 3px 5px 0px 0px;
+}
diff --git a/appsrc/ODS-Framework/nav_framework.js b/appsrc/ODS-Framework/nav_framework.js
index 2407aad..6098d40 100644
--- a/appsrc/ODS-Framework/nav_framework.js
+++ b/appsrc/ODS-Framework/nav_framework.js
@@ -1,6 +1,27 @@
+/*
+ *
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *
+ *  Copyright (C) 1998-2010 OpenLink Software
+ *
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
 // TODO: move template functions to OAT
 //
-
 function get_param(name) {
   var regexS = "[\\?&]"+name+"=([^&#]*)";
   var regex = new RegExp( regexS );
@@ -49,10 +70,6 @@ function replaceTemplateClass(elm, class_name, content) {
     }
 }
 
-function _def(_v) {
-  return typeof (_v) != 'undefined';
-}
-
 function is_elem(node) {
   return (node.nodeType == 1) ? true : false;
 }
@@ -67,9 +84,9 @@ function append_elem(_src, _dst) {
 }
 
 function tpl_elem_repl(_src, _dst) {
-	if (_dst.hasChildNodes) {
+	if (_dst.hasChildNodes)
       OAT.Dom.clear (_dst);
-    }
+
   append_elem (_src, _dst);
   return _dst;
 }
@@ -81,10 +98,9 @@ function ODSDOMSwapElem(old_elem, new_elem, tmp) {
 }
 
 function dd(txt) {
-	if (typeof console == 'object' && typeof console.debug == 'function') {
+	if (typeof console == 'object' && typeof console.debug == 'function')
 	    console.debug(txt);
 	}
-}
 
 function getMetaContents(metaKey) {
     var m = document.getElementsByTagName ('meta');
@@ -120,9 +136,9 @@ function onEnterDown(e) {
 
 function buildObjByAttributes(elm) {
    var obj = {};
-	for ( var i = 0; i < elm.attributes.length; i++) {
+	for ( var i = 0; i < elm.attributes.length; i++)
 	   obj[elm.attributes[i].nodeName] = OAT.Xml.textValue (elm.attributes[i]);
-       }
+
    return obj;
 }
 
@@ -174,15 +190,12 @@ function buildObjByChildNodes(elm) {
 }
 
 function replaceChild(newElm, oldElm) {
-	if (typeof (newElm) == 'undefined' || typeof (oldElm) == 'undefined'
-			|| typeof (oldElm.parentNode) == 'undefined')
+	if (typeof (newElm) == 'undefined' || typeof (oldElm) == 'undefined' || typeof (oldElm.parentNode) == 'undefined')
 	return;
 
     OAT.Dom.hide (oldElm);
     oldElm.parentNode.insertBefore (newElm, oldElm);
     OAT.Dom.unlink (oldElm);
-
-    return;
 }
 
 function inverseSelected(parentDiv) {
@@ -209,7 +222,7 @@ ODS.Preferences = {
   root              : document.location.protocol + '//' + document.location.host,
   svcEndpoint       : "/ods_services/Http/",
   activitiesEndpoint: "/activities/feeds/activities/user/",
-  version           : "24.01.2008-1.21"
+	version : "10.09.2010"
 };
 
 ODS.app = {
@@ -344,8 +357,7 @@ ODS.ico = {
 	}
 };
 
-ODS.paginator = function(iSet, containerTop, containerBottom, callback,
-		customItemsPerPage) {
+ODS.paginator = function(iSet, containerTop, containerBottom, callback, customItemsPerPage) {
     var self = this;
 
     this.elmTop    = $(containerTop);
@@ -361,17 +373,14 @@ ODS.paginator = function(iSet, containerTop, containerBottom, callback,
     this.endIndex     = false;
     this.iSet         = iSet;
     this.currenISet   = new Array();
-	this.idTop = typeof (self.elmTop.id) != 'undefined' ? self.elmTop.id
-			: 'pagerTop';
-	this.idBottom = typeof (self.elmBottom.id) != 'undefined' ? self.elmBottom.id
-			: 'pagerBottom';
+	this.idTop = typeof (self.elmTop.id) != 'undefined' ? self.elmTop.id : 'pagerTop';
+	this.idBottom = typeof (self.elmBottom.id) != 'undefined' ? self.elmBottom.id : 'pagerBottom';
 
     this.itemsPerPage = 5;
 
     if (typeof (customItemsPerPage) == 'number')
 	this.itemsPerPage = customItemsPerPage;
-	else if (typeof (customItemsPerPage) != 'undefined'
-			&& !isNaN(parseInt(customItemsPerPage, 10)))
+	else if (typeof (customItemsPerPage) != 'undefined' && !isNaN(parseInt(customItemsPerPage, 10)))
 		this.itemsPerPage = parseInt (customItemsPerPage, 10);
 
 	this.first = function() {
@@ -519,10 +528,7 @@ ODS.paginator = function(iSet, containerTop, containerBottom, callback,
 
 		}
 
-			OAT.Dom
-					.append( [ elmA, elmImg,
-							OAT.Dom.text(settings[elmType].txt) ]);
-
+			OAT.Dom.append( [ elmA, elmImg, OAT.Dom.text(settings[elmType].txt)]);
 	    return elmA;
 	}
 
@@ -574,202 +580,24 @@ ODS.session = function(customEndpoint) {
     this.invitationsId = false;
 
     this.endpoint = ODS.Preferences.svcEndpoint;
-
-	this.openId = {
-		server : false,
-		   delegate:false,
-		   sig:false,
-		   identity:false,
-		   assoc_handle:false,
-		signed : false
-	};
-
   if (typeof (customEndpoint) != 'undefined' && length (customEndpoint))
 	this.endpoint = customEndpoint;
 
-	this.start = function() {
-	var data = '';
-
-	var callback = function (xmlString) {
-	    var xmlDoc = OAT.Xml.createXmlDoc (xmlString);
-			if (!self.isErr(xmlDoc)) {
-				resXmlNodes = OAT.Xml.xpath(xmlDoc,
-						'/sessionStart_response/session', {});
-		    self.sid = OAT.Xml.textValue (resXmlNodes[0]);
-        	    OAT.MSG.send (self, "WA_SES_TOKEN_RECEIVED", {});
-		}
-	};
-	OAT.AJAX.POST (self.endpoint + "sessionStart", data, callback, options);
-    };
-
-	this.validate = function(mode) {
-		function showLoginErr(errMsg) {
-			if (typeof (nav.showLoginErr) == "function") {
-		    if (typeof (errMsg) != 'undefined')
-			nav.showLoginErr (errMsg);
-		    else
-			nav.showLoginErr ();
-			} else if (typeof (errMsg) != 'undefined')
-		    alert (errMsg);
-	    return;
-	}
-    var selectedTab = $('loginDiv').loginTab.tabs[$('loginDiv').loginTab.selectedIndex];
-		if (selectedTab.key.id == 'loginT1') {
-			if (($('loginUserName').value.length == 0)
-					|| ($('loginUserPass').value.length == 0)) {
-			showLoginErr ();
-			return;
-		    }
-			var data = 'sid='
-					+ self.sid
-					+ '&realm=wa'
-					+ '&userName='
-					+ $('loginUserName').value
-					+ '&authStr='
-					+ OAT.Crypto.sha(self.sid + $('loginUserName').value
-							+ $('loginUserPass').value);
-			var callback = function(xmlString) {
-		    var xmlDoc = OAT.Xml.createXmlDoc (xmlString);
-				if (!self.isErr(xmlDoc)) {
-					self.userName = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-							'/sessionValidate_response/userName', {})[0]);
-					self.userId = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-							'/sessionValidate_response/userId', {})[0]);
-					self.userIsDba = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-							'/sessionValidate_response/dba', {})[0]);
-          $('loginErrDiv').innerHTML = '';
-
-          OAT.MSG.send (self, "WA_SES_VALIDBIND", {});
-				} else {
-					OAT.MSG.send(self, "WA_SES_INVALID", {retryLogIn: true});
-        }
-      };
-			OAT.AJAX.POST(self.endpoint + "sessionValidate", data, callback,
-					options);
-		} else if (selectedTab.key.id == 'loginT2') {
-			if ($('loginOpenIdUrl').value.length == 0) {
-			showLoginErr ();
-			return;
-		    }
-
-
-		$('loginErrDiv').innerHTML = '';
-
-		var openIdUrl = $('loginOpenIdUrl').value;
-		var data = 'realm=wa&openIdUrl=' + encodeURIComponent (openIdUrl);
-		var callback = function (xmlString) {
-		    var xmlDoc = OAT.Xml.createXmlDoc (xmlString);
-
-				if (!self.isErr(xmlDoc)) {
-					self.openId.version = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/openIdServer_response/version', {})[0]);
-					self.openId.server = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/openIdServer_response/server', {})[0]);
-					self.openId.delegate = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/openIdServer_response/delegate', {})[0]);
-
-			    if (!self.openId.server || self.openId.server.length == 0)
-				showLoginErr (' Cannot locate OpenID server');
-
-			    var oidIdent = openIdUrl;
-
-			    if (self.openId.delegate || self.openId.delegate.length > 0)
-				oidIdent = self.openId.delegate;
-
-					var thisPage = document.location.protocol + '//' + document.location.host + document.location.pathname
-						+ '?oid-srv=' + encodeURIComponent(self.openId.server);
-
-					var trustRoot = document.location.protocol + '//'
-							+ document.location.host;
-
-					var checkImmediate = self.openId.server
-							+ '?openid.mode=checkid_setup'
-						+ '&openid.return_to=' + encodeURIComponent(thisPage);
-
-          if (self.openId.version == '1.0')
-            checkImmediate +='&openid.identity=' + encodeURIComponent(oidIdent)
-                           + '&openid.trust_root=' + encodeURIComponent(trustRoot);
-
-          if (self.openId.version == '2.0')
-            checkImmediate += '&openid.ns=' + encodeURIComponent('http://specs.openid.net/auth/2.0')
-              + '&openid.claimed_id=' + encodeURIComponent(oidIdent) //encodeURIComponent('http://specs.openid.net/auth/2.0/identifier_select')
-              + '&openid.identity=' + encodeURIComponent(oidIdent) //encodeURIComponent('http://specs.openid.net/auth/2.0/identifier_select')
-
-			    document.location = checkImmediate;
-				} else {
-					OAT.MSG.send(self, "WA_SES_INVALID", {retryLogIn: true});
-			}
-		};
-			OAT.AJAX.POST(self.endpoint + "openIdServer", data, callback, options);
-		} else if (selectedTab.key.id == 'loginT3') {
-			if (!nav.facebookData || !nav.facebookData.uid) {
-        showLoginErr ();
-        return;
-      }
-			var data = 'sid=' + self.sid + '&realm=wa&facebookUID='
-					+ nav.facebookData.uid;
-			var callback = function(xmlString) {
-        var xmlDoc = OAT.Xml.createXmlDoc (xmlString);
-				if (!self.isErr(xmlDoc)) {
-					self.userName = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-							'/sessionValidate_response/userName', {})[0]);
-					self.userId = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-							'/sessionValidate_response/userId', {})[0]);
-					self.userIsDba = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-							'/sessionValidate_response/dba', {})[0]);
-          $('loginErrDiv').innerHTML = '';
-
-          OAT.MSG.send (self, "WA_SES_VALIDBIND", {});
-				} else {
-					OAT.MSG.send(self, "WA_SES_INVALID", {retryLogIn: true});
-        }
-      };
-			OAT.AJAX.POST(self.endpoint + "sessionValidate", data, callback,
-					options);
-		} else if (selectedTab.key.id == 'loginT4') {
-      var data = 'sid=' + self.sid + '&realm=wa&X509=1';
-			var callback = function(xmlString) {
-        var xmlDoc = OAT.Xml.createXmlDoc (xmlString);
-				if (!self.isErr(xmlDoc)) {
-					self.userName = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-							'/sessionValidate_response/userName', {})[0]);
-					self.userId = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-							'/sessionValidate_response/userId', {})[0]);
-					self.userIsDba = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-							'/sessionValidate_response/dba', {})[0]);
-          $('loginErrDiv').innerHTML = '';
-
-          OAT.MSG.send (self, "WA_SES_VALIDBIND", {});
-				} else {
-					OAT.MSG.send(self, "WA_SES_INVALID", {retryLogIn : true});
-        }
-      };
-			OAT.AJAX.POST(self.endpoint + "sessionValidate", data, callback,
-					options);
-	    }
-    };
-
 	this.validateSid = function() {
-
-//    var data = 'sid='+self.sid+'&realm=wa&userName='+$('userName').value+'&authStr='+OAT.Crypto.sha(self.sid+$('userName').value+$('userPass').value);
-
 	var data = 'sid=' + self.sid + '&realm=wa';
-
 		var callback = function(xmlString) {
 	    var xmlDoc = OAT.Xml.createXmlDoc (xmlString);
-
 			if (!self.isErr(xmlDoc)) {
-		    self.userName = OAT.Xml.textValue (OAT.Xml.xpath (xmlDoc,
-								      '/sessionValidate_response/userName', {})[0]);
-		    self.userId = OAT.Xml.textValue (OAT.Xml.xpath (xmlDoc,
-								    '/sessionValidate_response/userId', {})[0]);
-		    self.userIsDba = OAT.Xml.textValue (OAT.Xml.xpath (xmlDoc,
-								       '/sessionValidate_response/dba', {})[0]);
+				self.userName = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/sessionValidate_response/userName', {})[0]);
+				self.userId = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/sessionValidate_response/userId', {})[0]);
+				self.userIsDba = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/sessionValidate_response/dba', {})[0]);
 		    OAT.MSG.send (self, "WA_SES_VALIDBIND", {});
 			} else {
 		    self.sid = false;
         	    OAT.MSG.send (self, "WA_SES_INVALID", {});
 		}
 	};
-		OAT.AJAX.POST(self.endpoint + "sessionValidate", data, callback,
-				options);
+		OAT.AJAX.POST(self.endpoint + "sessionValidate", data, callback, options);
     };
 
 	this.end = function() {
@@ -788,56 +616,6 @@ ODS.session = function(customEndpoint) {
 	OAT.AJAX.POST (self.endpoint+"sessionEnd", data, callback, options);
     };
 
-	this.openIdVerify = function() {
-	var uriParams = OAT.Dom.uriParams ();
-    var openIdServer       = uriParams['oid-srv'];
-    var openIdSig          = uriParams['openid.sig'];
-    var openIdIdentity     = uriParams['openid.identity'];
-    var openIdAssoc_handle = uriParams['openid.assoc_handle'];
-    var openIdSigned       = uriParams['openid.signed'];
-
-    var url = openIdServer +
-      '?openid.mode=check_authentication' +
-      '&openid.assoc_handle=' + encodeURIComponent (openIdAssoc_handle) +
-      '&openid.sig='          + encodeURIComponent (openIdSig) +
-      '&openid.signed='       + encodeURIComponent (openIdSigned);
-
-    var sig = openIdSigned.split(',');
-    for (var i = 0; i < sig.length; i++)
-    {
-		var _key = sig[i].trim ();
-      if (_key != 'mode' &&
-          _key != 'signed' &&
-          _key != 'assoc_handle')
-      {
-			var _val = uriParams['openid.' + _key];
-			if (_val != '')
-          url += '&openid.' + _key + '=' + encodeURIComponent (_val);
-		    }
-	    }
-		var data = 'realm=wa'
-		    + '&openIdUrl=' + encodeURIComponent(url)
-				+ '&openIdIdentity=' + encodeURIComponent(openIdIdentity);
-
-		var callback = function(xmlString) {
-	    var xmlDoc = OAT.Xml.createXmlDoc (xmlString);
-
-			if (!self.isErr(xmlDoc)) {
-				self.sid = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/openIdCheckAuthentication_response/session', {})[0]);
-				self.userName = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/openIdCheckAuthentication_response/userName', {})[0]);
-				self.userId = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/openIdCheckAuthentication_response/userId', {})[0]);
-
-        OAT.MSG.send (self, "WA_SES_VALIDBIND", {});
-			} else {
-				var errMsg = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/error_response/error_msg', {})[0]);
-
-				OAT.MSG.send(self, "WA_SES_INVALID", {retryLogIn: true, msg: errMsg});
-		    return;
-		}
-	};
-		OAT.AJAX.POST(self.endpoint + "openIdCheckAuthentication", data, callback, optionsSynch);
-    };
-
 	this.usersGetInfo = function(users, fields, callbackFunction) {
 		var data = 'sid=' + self.sid + '&realm=' + self.realm + '&usersStr='
 				+ encodeURIComponent(users) + '&fieldsStr='
@@ -857,12 +635,9 @@ ODS.session = function(customEndpoint) {
 
 	this.isErr = function(xmlDoc) {
 	var errXmlNodes = OAT.Xml.xpath (xmlDoc, '//error_response', {});
-
 		if (errXmlNodes.length) {
-			var errCode = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-					'/error_response/error_code', {})[0]);
-			var errMsg = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-					'/error_response/error_msg', {})[0]);
+			var errCode = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/error_response/error_code', {})[0]);
+			var errMsg = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/error_response/error_msg', {})[0]);
 		dd ('ERROR - msg: ' + errMsg + ' code: ' + errCode);
 		return 1;
 	    }
@@ -919,8 +694,7 @@ ODS.session = function(customEndpoint) {
     };
 
 	this.invitationRemove = function(invitationId) {
-		self.invitationsId = self
-				.arrRemoveElm(self.invitationsId, invitationId);
+		self.invitationsId = self.arrRemoveElm(self.invitationsId, invitationId);
     };
 
     // XXX: Looks like generic util functions which should not be session methods
@@ -928,8 +702,7 @@ ODS.session = function(customEndpoint) {
 	this.arrAddElm = function(arr, elmId) {
 	if (!arr)
 	    arr = new Array ();
-		else if (typeof (arr) != 'object'
-				|| (typeof (arr) == 'object' && typeof (arr.push) != 'function'))
+		else if (typeof (arr) != 'object' || (typeof (arr) == 'object' && typeof (arr.push) != 'function'))
 		return;
 
 	arr.push (elmId);
@@ -938,8 +711,7 @@ ODS.session = function(customEndpoint) {
     };
 
 	this.arrRemoveElm = function(arr, elmId) {
-		if (typeof (arr) != 'object'
-				|| (typeof (arr) == 'object' && typeof (arr.find) != 'function'))
+		if (typeof (arr) != 'object' || (typeof (arr) == 'object' && typeof (arr.find) != 'function'))
 	    return;
 
     var arrPos = arr.find (elmId);
@@ -1017,34 +789,16 @@ ODS.Nav = function(navOptions) {
 		tab : false
 	};
 
-	function preValidate() {
-	if ($('loginBtn'))
-	    $('loginBtn').disabled=true;
-	if ($('signupBtn'))
-	    $('signupBtn').disabled=true;
-	if ($('loginCloseBtn'))
-	    OAT.Dom.hide ($('loginCloseBtn'));
-
-	self.showLoginThrobber ();
-	self.session.validate ();
-    }
-
-	OAT.MSG.attach(self.session, "WA_SES_TOKEN_RECEIVED", function() {
-			OAT.Event.detach ('loginBtn', 'click', preValidate);
-			OAT.Event.attach ('loginBtn','click',preValidate);
-			$('loginUserPass').tokenReceived = true;
-			$('loginOpenIdUrl').tokenReceived = true;
-	});
-
-	OAT.MSG.attach(self.session, "WA_SES_VALIDBIND", function() {
+	OAT.MSG.attach(
+	  self.session,
+	  "WA_SES_VALIDBIND",
+	  function() {
 			self.createCookie ('sid', self.session.sid, 1);
 			self.userLogged = 1;
-		self.session.usersGetInfo(self.session.userId, 'fullName', function(
-				xmlDoc) {
+  		self.session.usersGetInfo(self.session.userId, 'fullName', function(xmlDoc) {
 			self.setLoggedUserInfo(xmlDoc);
 		});
-		self.connectionsGet(self.session.userId,
-				'fullName,photo,homeLocation,dataspace', function(xmlDocRet) {
+  		self.connectionsGet(self.session.userId, 'fullName,photo,homeLocation,dataspace', function(xmlDocRet) {
 					self.updateConnectionsSession(xmlDocRet);
 				});
 			self.initLeftBar ();
@@ -1054,12 +808,14 @@ ODS.Nav = function(navOptions) {
 			self.connections.userId = self.session.userId;
 
 			OAT.Dimmer.hide();
-		OAT.MSG.send(self.session, "WA_SES_VALIDATION_END", {
-			sessionValid : 1
-		});
-	});
-
-	OAT.MSG.attach(self.session, "WA_SES_INVALID", function(src, msg, event) {
+  		OAT.MSG.send(self.session, "WA_SES_VALIDATION_END", {sessionValid: 1});
+  	}
+  );
+
+	OAT.MSG.attach(
+	  self.session,
+	  "WA_SES_INVALID",
+	  function(src, msg, event) {
 			self.showLoginThrobber ('hide');
 			if ($('loginBtn'))
 			    $('loginBtn').disabled = false;
@@ -1082,20 +838,18 @@ ODS.Nav = function(navOptions) {
 
 				if (!$('loginDiv'))
 				    self.logIn ();
-				return;
 		} else {
-			if (typeof (event.sessionEnd) != 'undefined'
-					&& event.sessionEnd == true) {
+  			if (typeof (event.sessionEnd) != 'undefined' && event.sessionEnd == true) {
 				   document.location.hash = '';
 				   document.location.href = 'index.html';
 			} else {
 				OAT.MSG.send(self.session, "WA_SES_VALIDATION_END", {sessionValid: 0});
 			}
     }
-	});
-
-	OAT.MSG
-			.attach(self.session,
+  	}
+	);
+	OAT.MSG.attach(
+	  self.session,
 					"WA_SES_VALIDATION_END",
 					function(src, msg, event) {
 			self.showLoginThrobber ('hide');
@@ -1106,10 +860,8 @@ ODS.Nav = function(navOptions) {
 
 			// XXX
 			var q_pos = document.location.href.indexOf ('?');
-					var pos1 = document.location.href
-							.indexOf('/dataspace/person/');
-					var pos2 = document.location.href
-							.indexOf('/dataspace/organization/');
+			var pos1 = document.location.href.indexOf('/dataspace/person/');
+			var pos2 = document.location.href.indexOf('/dataspace/organization/');
 
 			if (q_pos > -1 && pos1 > q_pos) 
 			    pos1 = -1;
@@ -1146,18 +898,16 @@ ODS.Nav = function(navOptions) {
 				defaultAction = document.location.hash;
 						if (defaultAction == '#invitations') {
 							if (self.session.userName) {
-								self.invitationsGet('fullName,photo,home',
-										self.renderInvitations);
-								document.location.href = document.location.href
-										.split('#')[0] + '#';
+						self.invitationsGet('fullName,photo,home',self.renderInvitations);
+						document.location.href = document.location.href.split('#')[0] + '#';
 							} else {
 					    self.logIn ();
 				    }
-						} else if (defaultAction.indexOf('#/person/') > -1
-								|| defaultAction.indexOf('#/organization/') > -1) {
+				}
+				else if (defaultAction.indexOf('#/person/') > -1 || defaultAction.indexOf('#/organization/') > -1)
+				{
 					var profileId = document.location.href.split ('#')[1];
-							document.location.href = document.location.href
-									.split('#')[0] + '#';
+					document.location.href = document.location.href.split('#')[0] + '#';
 
 					var profileType = profileId.split ('/')[1];
 					profileId = profileId.split ('/')[2];
@@ -1168,47 +918,54 @@ ODS.Nav = function(navOptions) {
 						self.profile.set ('/' + profileId);
 						self.initProfile();
 					    }
-						} else {
+				}
+				else
+				{
 							if (defaultAction.indexOf('#msg') > -1) {
 					    var msg = defaultAction.replace('#msg=','');
 					    self.dimmerMsg (msg);
 
-								self.loadVspx(self
-										.expandURL(self.ods + 'sfront.vspx'));
-								document.location.href = document.location.href
-										.split('#')[0] + '#';
+						self.loadVspx(self.frontPage());
+						document.location.href = document.location.href.split('#')[0] + '#';
 							} else if (defaultAction.indexOf('#fhref') > -1) {
-								var fhref = defaultAction
-										.replace('#fhref=', '');
+						var fhref = defaultAction.replace('#fhref=', '');
 					    self.loadVspx (self.expandURL (fhref));
-								document.location.href = document.location.href
-										.split('#')[0] + '#';
+						document.location.href = document.location.href.split('#')[0] + '#';
 							} else {
-								self.loadVspx(self
-										.expandURL(self.ods + 'sfront.vspx'));
+						self.loadVspx(self.frontPage());
   			}
       }
-					} else {
-			    self.loadVspx (self.expandURL (self.ods + 'sfront.vspx'));
+			}
+			else
+			{
+				self.loadVspx(self.frontPage());
   		}
-				});
+		}
+	);
 
-	OAT.MSG.attach(self, "WA_PROFILE_UPDATED", function() {
+	OAT.MSG.attach(
+	  self,
+	  "WA_PROFILE_UPDATED",
+	  function() {
 			if (self.profile.show)
 			    self.showProfile ();
 			self.profile.show = false;
 			//			self.profile.ciMap.expandMap ();
-		    });
+		}
+	);
 
-	OAT.MSG.attach(self, "WA_CONNECTIONS_UPDATED", function() {
+	OAT.MSG.attach(
+	  self,
+	  "WA_CONNECTIONS_UPDATED",
+	  function() {
 			if (self.connections.show)
 			    self.showConnections ();
 			self.connections.show = false;
-		    });
+	  }
+	);
 
 	this.setLoggedUserInfo = function(xmlDoc) {
-		var userDisplayName = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-				'/usersGetInfo_response/user/fullName', {})[0]);
+		var userDisplayName = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/fullName', {})[0]);
 	if (userDisplayName == '')
 	    userDisplayName = self.session.userName;
 	$('aUserProfile').innerHTML = userDisplayName;
@@ -1236,8 +993,7 @@ ODS.Nav = function(navOptions) {
 			      self.loadVspx (self.expandURL (self.ods + 'services.vspx'));
 			  });
 
-		OAT.Dom.append( [ rootDiv, appTitle ], [ appTitle,
-				appTitleApplicationA, OAT.Dom.text(' '), appTitleEditA ]);
+		OAT.Dom.append( [ rootDiv, appTitle ], [ appTitle, appTitleApplicationA, OAT.Dom.text(' '), appTitleEditA ]);
 
 	var ulApp = OAT.Dom.create ("ul");
 	ulApp.id = 'APP_MENU';
@@ -1256,8 +1012,7 @@ ODS.Nav = function(navOptions) {
 	OAT.Dom.append ([rootDiv, ftApp], [ftApp, ftAppA]);
 
 		function renderAppNav(xmlDoc) {
-			var resXmlNodes = OAT.Xml.xpath(xmlDoc,
-					'//installedPackages_response/application', {});
+			var resXmlNodes = OAT.Xml.xpath(xmlDoc, '//installedPackages_response/application', {});
 
 			for ( var i = 0; i < resXmlNodes.length; i++) {
        		    var packageName = OAT.Xml.textValue (resXmlNodes[i]);
@@ -1301,52 +1056,9 @@ ODS.Nav = function(navOptions) {
     self.installedPackages (renderAppNav);
   }
 
-	this.loadFacebookData = function(cb) {
-    var x = function (data) {
-      var o = null;
-      try {
-        o = OAT.JSON.parse(data);
-			} catch (e) {
-				o = null;
-			}
-      self.facebookData = o;
-			if (cb) {
-				cb();
-			}
-    }
-    OAT.AJAX.GET ('/ods/api/user.getFacebookData', false, x);
-  }
-
-	this.showFacebookData = function(skip) {
-    var label = $('loginFBData');
-    if (!label)
-      return;
-    label.innerHTML = '';
-		if (self.facebookData && self.facebookData.name) {
-      label.innerHTML = 'Connect as <b><i>' + self.facebookData.name + '</i></b></b>';
-		} else if (!skip) {
-			self.loadFacebookData(function() {
-				self.showFacebookData(true);
-			});
-    }
-  }
-
-	this.hideFacebookData = function() {
-    var label = $('loginFBData');
-    if (!label)
-      return;
-    label.innerHTML = '';
-		if (self.facebookData) {
-      var o = {}
-      o.api_key = self.facebookData.api_key;
-      o.secret = self.facebookData.secret;
-      self.facebookData = o;
-    }
-  }
-
 	this.appCheck = function(xmlDoc) {
 		var url = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-				'/createApplication_response/application/url', {})[0]);
+				'/createApplication_response/application/url|/checkApplication_response/application/url', {})[0]);
 	self.loadVspx (self.expandURL (url));
 	self.wait ();
     };
@@ -1356,17 +1068,8 @@ ODS.Nav = function(navOptions) {
 	OAT.Dom.clear (rootDiv);
     var odsHomeA = OAT.Dom.create ('a', {})
     odsHomeA.id = 'ODS_HOME_LNK';
-    
 	odsHomeA.innerHTML = '<img class="ods_logo" src="images/odslogosml_new.png" alt="Site Home"/>';
-	if (self.session.userName)
-			OAT.Event.attach(odsHomeA, "click", function() {
-				  self.loadVspx (self.expandURL (self.ods + 'myhome.vspx'));
-			      });
-	else
-			OAT.Event.attach(odsHomeA, "click", function() {
-				  self.loadVspx (self.ods + 'sfront.vspx');
-			      });
-
+	  OAT.Event.attach(odsHomeA, "click", function() {self.loadVspx(self.frontPage());});
 	OAT.Dom.append ([rootDiv, odsHomeA]);
     };
 
@@ -1415,34 +1118,26 @@ ODS.Nav = function(navOptions) {
 		function renderCommunityMenu(xmlDoc) {
 	    OAT.Dom.clear (communityMenuBodyUl);
 
-			var packageInstalled = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-						  '//userCommunities_response/community_package',{})[0]);
+			var packageInstalled = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '//userCommunities_response/community_package', {})[0]);
 			if (packageInstalled == 0) {
 		    OAT.Dom.hide ($('communities_menu'));
 		    return;
 		}
 
-			var communities = OAT.Xml.xpath(xmlDoc,
-					'//userCommunities_response/community', {});
-
+			var communities = OAT.Xml.xpath(xmlDoc, '//userCommunities_response/community', {});
 			for ( var i = 0; i < communities.length; i++) {
 		    var communityMenuBodyLi = OAT.Dom.create ('li',{},'menu_item');
-				var communityMenuBodyLiA = OAT.Dom.create('a', {
-					cursor : 'pointer'
-				});
+				var communityMenuBodyLiA = OAT.Dom.create('a', {cursor: 'pointer'});
 
-				communityMenuBodyLiA.innerHTML = OAT.Xml
-						.textValue(communities[i].childNodes[0]);
-				communityMenuBodyLiA.homepage = OAT.Xml
-						.textValue(communities[i].childNodes[1]);
+				communityMenuBodyLiA.innerHTML = OAT.Xml.textValue(communities[i].childNodes[0]);
+				communityMenuBodyLiA.homepage = OAT.Xml.textValue(communities[i].childNodes[1]);
 
 				OAT.Event.attach(communityMenuBodyLiA, "click", function(e) {
 					  var t = eTarget(e);
 					  self.loadVspx (self.expandURL (t.homepage));
 				      });
 
-				OAT.Dom.append( [ communityMenuBodyUl, communityMenuBodyLi ], [
-						communityMenuBodyLi, communityMenuBodyLiA ]);
+				OAT.Dom.append( [ communityMenuBodyUl, communityMenuBodyLi ], [communityMenuBodyLi, communityMenuBodyLiA ]);
 		}
 
 			if (i == 0 && !self.session.userName) {
@@ -1456,9 +1151,7 @@ ODS.Nav = function(navOptions) {
 		    OAT.Dom.append ([communityMenuBodyUl, communityMenuBodyLi]);
 
 		    var communityMenuBodyLi  = OAT.Dom.create ('li', {}, 'menu_item');
-				var communityMenuBodyLiA = OAT.Dom.create('a', {
-					cursor : 'pointer'
-				});
+				var communityMenuBodyLiA = OAT.Dom.create('a', {cursor : 'pointer'});
 		    communityMenuBodyLiA.innerHTML = 'Join a community now';
 		    communityMenuBodyLiA.homepage = 'search.vspx?apps=apps&q=Community';
 
@@ -1471,9 +1164,7 @@ ODS.Nav = function(navOptions) {
 						communityMenuBodyLi, communityMenuBodyLiA ]);
 
 		    var communityMenuBodyLi  = OAT.Dom.create ('li', {}, 'menu_item');
-				var communityMenuBodyLiA = OAT.Dom.create('a', {
-					cursor : 'pointer'
-				});
+				var communityMenuBodyLiA = OAT.Dom.create('a', {cursor : 'pointer'});
 
 		    communityMenuBodyLiA.innerHTML = 'Create a community';
 		    communityMenuBodyLiA.homepage  = 'index_inst.vspx?wa_name=Community';
@@ -1538,9 +1229,7 @@ ODS.Nav = function(navOptions) {
 			}
 		}
 
-	    var newMsgCount = OAT.Xml.textValue (OAT.Xml.xpath (xmlDoc,
-								'//userMessages_response/new_message_count',{})[0]);
-
+			var newMsgCount = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '//userMessages_response/new_message_count', {})[0]);
 	    $('newMsgCountSpan').innerHTML='('+newMsgCount+')';
 
 	    var messagesMenu = new OAT.Menu ();
@@ -2008,8 +1697,7 @@ ODS.Nav = function(navOptions) {
 		var containerTab = OAT.Dom.create ("div");
 		containerTab.id = 'conversationTab';
 
-				var messages = OAT.Xml.xpath(xmlDoc,
-						'//userMessages_response/message', {});
+				var messages = OAT.Xml.xpath(xmlDoc, '//userMessages_response/message', {});
 				for ( var i = 0; i < messages.length; i++) {
 			var msg = buildObjByChildNodes (messages[i]);
 					if (msg.sender['@id'] == self.session.userId) {
@@ -2146,22 +1834,13 @@ ODS.Nav = function(navOptions) {
 			for ( var i = 0; i < connMenuItems.childNodes.length; i++) {
 				if (connMenuItems.childNodes[i].nodeName == 'LI'
 						&& connMenuItems.childNodes[i].className != 'menu_separator'
-						&& connMenuItems.childNodes[i].innerHTML
-								.indexOf('loadVspx') == -1) {
-					if (connMenuItems.childNodes[i].innerHTML
-							.indexOf('Invitations') != -1)
-				    OAT.Event.attach (connMenuItems.childNodes[i], "click",
-						      function () {
-									self.invitationsGet('fullName,photo,home',
-											self.renderInvitations)
+						&& connMenuItems.childNodes[i].innerHTML.indexOf('loadVspx') == -1) {
+					if (connMenuItems.childNodes[i].innerHTML.indexOf('Invitations') != -1)
+						OAT.Event.attach(connMenuItems.childNodes[i], "click", function() {
+							self.invitationsGet('fullName,photo,home', self.renderInvitations)
 						      });
-					else if (connMenuItems.childNodes[i].innerHTML
-							.indexOf('Find People') != -1)
-						OAT.Event
-								.attach(
-										connMenuItems.childNodes[i],
-										"click",
-							      function () {
+					else if (connMenuItems.childNodes[i].innerHTML.indexOf('Find People') != -1)
+						OAT.Event.attach(connMenuItems.childNodes[i], "click", function() {
 								  if ($('search_lst_sort'))
 								      $('search_lst_sort').selectedIndex = 0;
 								  if ($('search_focus_sel'))
@@ -2169,18 +1848,10 @@ ODS.Nav = function(navOptions) {
 								  self.showSearch ();
 							      });
 					else {
-						OAT.Event
-								.attach(
-										connMenuItems.childNodes[i],
-										"click",
-							      function () {
+						OAT.Event.attach(connMenuItems.childNodes[i], "click", function() {
 								  self.connections.show = true;
 								  self.connections.userId = self.session.userId;
-											self
-													.connectionsGet(
-															self.connections.userId,
-							   'fullName,photo,homeLocation,dataspace',
-							   self.updateConnectionsInterface)
+							self.connectionsGet(self.connections.userId, 'fullName,photo,homeLocation,dataspace', self.updateConnectionsInterface)
 							      });
 				}
 			}
@@ -2195,16 +1866,13 @@ ODS.Nav = function(navOptions) {
 	    connInterfaceTab.go (0);
 	}
 
-		if (self.session.userName) {
+		if (self.session.userName)
 		renderConnectionsMenu ();
-	    }
 
 	var loginfoDiv = $('ODS_BAR_RC');
 	OAT.Dom.clear (loginfoDiv);
 
-		var aSettings = OAT.Dom.create("a", {
-			cursor : 'pointer'
-		});
+		var aSettings = OAT.Dom.create("a", {cursor: 'pointer'});
 
 		OAT.Event.attach(aSettings, "click", function() {
 			      self.loadVspx (self.expandURL (self.ods + 'app_settings.vspx'));
@@ -2212,9 +1880,7 @@ ODS.Nav = function(navOptions) {
 
     aSettings.innerHTML = 'Application Settings';
 
-		var aSiteSettings = OAT.Dom.create("a", {
-			cursor : 'pointer'
-		});
+		var aSiteSettings = OAT.Dom.create("a", {cursor: 'pointer'});
 
 		OAT.Event.attach(aSiteSettings, "click", function() {
 			      self.loadVspx (self.expandURL (self.ods + 'site_settings.vspx'));
@@ -2222,12 +1888,8 @@ ODS.Nav = function(navOptions) {
 
 	aSiteSettings.innerHTML = 'Site Settings';
 
-		var aUserProfile = OAT.Dom.create("a", {
-			cursor : 'pointer'
-		});
-
+		var aUserProfile = OAT.Dom.create("a", {cursor : 'pointer'});
 	aUserProfile.id = 'aUserProfile';
-
 		OAT.Event.attach(aUserProfile, "click", function() {
           self.profile.show = true;
           self.profile.set (self.session.userId);
@@ -2253,9 +1915,7 @@ ODS.Nav = function(navOptions) {
 
 	OAT.Event.attach (aLogout, "click", self.session.end);
 
-		var aSignUp = OAT.Dom.create("a", {
-			cursor : 'pointer'
-		});
+		var aSignUp = OAT.Dom.create("a", {cursor: 'pointer'});
 
 		OAT.Event.attach(aSignUp, "click", function() {
 			self.loadVspx(self.ods + 'register.vspx?');
@@ -2275,16 +1935,15 @@ ODS.Nav = function(navOptions) {
     aHelp.innerHTML = 'Help';
 
 		if (self.userLogged && self.session.userIsDba == 1) {
-			OAT.Dom.append( [ rootDiv, loginfoDiv ], [ loginfoDiv, aSettings,
-					aSiteSettings, aUserProfile, aLogout, aHelp ]);
-    } else {
-			if (self.userLogged && self.session.userIsDba == 0) {
-				OAT.Dom.append( [ rootDiv, loginfoDiv ], [ loginfoDiv,
-						aSettings, aUserProfile, aLogout, aHelp ]);
-      } else {
-				OAT.Dom.append( [ rootDiv, loginfoDiv ], [ loginfoDiv, aLogin,
-						aSignUp, aHelp ]);
+			OAT.Dom.append( [ rootDiv, loginfoDiv ], [ loginfoDiv, aSettings, aSiteSettings, aUserProfile, aLogout, aHelp ]);
+		}
+		else if (self.userLogged && self.session.userIsDba == 0)
+	  {
+		  OAT.Dom.append( [ rootDiv, loginfoDiv ], [ loginfoDiv, aSettings, aUserProfile, aLogout, aHelp ]);
       }
+		else
+		{
+			OAT.Dom.append( [ rootDiv, loginfoDiv ], [ loginfoDiv, aLogin, aSignUp, aHelp ]);
     }
     var x = function (data) {
       try {
@@ -2301,14 +1960,14 @@ ODS.Nav = function(navOptions) {
 				} catch (e) {
 					o = null;
 				}
-				if (o && o.sslPort) {
+				if (o && o.sslPort && !$('ssl_link')) {
 	  var hostname = document.location.hostname;
 	  if (o.sslHost && o.sslHost.length > 0)
 	    hostname = o.sslHost;
           aSSL = OAT.Dom.create ("a");
+					aSSL.id = 'ssl_link';
 	  if (o.sslPort != '443')
-						aSSL.href = 'https://' + hostname + ':' + o.sslPort
-								+ '/ods/index.html?alog=1';
+						aSSL.href = 'https://' + hostname + ':' + o.sslPort + '/ods/index.html?alog=1';
 	  else
             aSSL.href = 'https://' + hostname + '/ods/index.html?alog=1';
           var aImg = OAT.Dom.create ('img');
@@ -2318,8 +1977,9 @@ ODS.Nav = function(navOptions) {
         }
       }
       OAT.AJAX.GET ('/ods/api/server.getInfo?info=sslPort', false, x);
-    } else {
-			if (!self.userLogged) {
+		}
+		else if (!self.userLogged && self.regData.sslEnable && self.regData.sslAutomaticEnable)
+	  {
       var x = function (data) {
         var o = null;
         try {
@@ -2333,10 +1993,8 @@ ODS.Nav = function(navOptions) {
             self.logIn();
 						if (self.alog && get_param('alog') == '1') {
 		  self.alog = false;
-							$('loginDiv').loginTab.selectedIndex = 3;
-		  OAT.Dom.hide ($('login_page'));
-		  self.showLoginThrobber ();
-  							OAT.MSG.attach(self.session, "WA_SES_TOKEN_RECEIVED", function() {self.session.validate();});
+							lfTab.go(3);
+              lfLoginSubmit(self.afterLogin);
 						}
 		}
 	    }
@@ -2344,18 +2002,6 @@ ODS.Nav = function(navOptions) {
 			  OAT.AJAX.GET('/ods/api/user.getFOAFSSLData?sslFOAFCheck=1&sslLoginCheck=1', false, x);
 			}
       }
-		self.loadFacebookData(function() {
-			if (self.facebookData)
-				FB.init(self.facebookData.api_key, "fb_dummy.vsp", {
-					ifUserConnected : function() {
-						self.showFacebookData();
-					},
-					ifUserNotConnected : function() {
-						self.hideFacebookData();
-		}
-				});
-		});
-    }
 
 	this.showUserProfile = function() {
     self.profile.show = true;
@@ -2381,8 +2027,7 @@ ODS.Nav = function(navOptions) {
 						&& $('search_focus_sel').value == 'on_advanced'
 						&& typeof ($('search_focus_advanced')) != 'undefined') {
 
-					var advancedFocusCB = $('search_focus_advanced')
-							.getElementsByTagName('input');
+					var advancedFocusCB = $('search_focus_advanced').getElementsByTagName('input');
 					for ( var i = 0; i < advancedFocusCB.length; i++) {
 						if (advancedFocusCB[i].type == 'checkbox'
 								&& advancedFocusCB[i].checked)
@@ -2416,8 +2061,7 @@ ODS.Nav = function(navOptions) {
 
 				for ( var i = 0; i < searchFocusOptions.length; i++) {
 					if (typeof (searchVal2Pack[searchFocusOptions[i].value]) != 'undefined') {
-						var pack = OAT.Xml
-								.xpath(
+						var pack = OAT.Xml.xpath(
 										xmlDoc,
 										"//installedPackages_response/application[text()='"
 												+ searchVal2Pack[searchFocusOptions[i].value]
@@ -2441,8 +2085,7 @@ ODS.Nav = function(navOptions) {
 				for ( var i = 0; i < advancedFocusCB.length; i++) {
 					if (advancedFocusCB[i].type == 'checkbox') {
 						if (typeof (searchVal2Pack[advancedFocusCB[i].value]) != 'undefined') {
-							var pack = OAT.Xml
-									.xpath(
+							var pack = OAT.Xml.xpath(
 											xmlDoc,
 											"//installedPackages_response/application[text()='"
 													+ searchVal2Pack[advancedFocusCB[i].value]
@@ -2514,13 +2157,10 @@ ODS.Nav = function(navOptions) {
 			$('search_textbox_searchC').callback = function(e) {
 				var t = eTarget(e);
 				if (t && t.value && t.value.trim().length > 1) {
-					self.search(self.getSearchOptions(t),
-							self.renderSearchResults);
-					self.searchContacts('keywords=' + t.value,
-							self.renderSearchResultsMap);
+					self.search(self.getSearchOptions(t), self.renderSearchResults);
+					self.searchContacts('keywords=' + t.value, self.renderSearchResultsMap);
 				} else if ($('search_focus_sel').value == 'on_people') {
-					self.searchContacts(self.getSearchOptions(t),
-							self.renderSearchResults);
+					self.searchContacts(self.getSearchOptions(t), self.renderSearchResults);
 				    self.searchContacts ('', self.renderSearchResultsMap);
 				} else if (t && t.value && t.value.trim().length < 2) {
 					self.dimmerMsg ('Invalid keyword string entered.');
@@ -2528,8 +2168,7 @@ ODS.Nav = function(navOptions) {
 				    }
 		    };
 
-			OAT.Event.attach($('search_textbox_searchC'), "keypress",
-					onEnterDown);
+			OAT.Event.attach($('search_textbox_searchC'), "keypress", onEnterDown);
 	    }
 
         OAT.Event.attach ($('search_textbox_searchC'), "keypress", onEnterDown);
@@ -2539,13 +2178,10 @@ ODS.Nav = function(navOptions) {
 			var t = $('search_textbox_searchC');
 
 				if (t && t.value && t.value.trim().length > 1) {
-					self.search(self.getSearchOptions(t),
-							self.renderSearchResults);
-					self.searchContacts('keywords=' + t.value,
-							self.renderSearchResultsMap);
+					self.search(self.getSearchOptions(t), self.renderSearchResults);
+					self.searchContacts('keywords=' + t.value, self.renderSearchResultsMap);
 				} else if ($('search_focus_sel').value == 'on_people') {
-					self.searchContacts(self.getSearchOptions(t),
-							self.renderSearchResults);
+					self.searchContacts(self.getSearchOptions(t), self.renderSearchResults);
 				    self.searchContacts ('', self.renderSearchResultsMap);
 				} else if (t && t.value && t.value.trim().length < 2) {
 					self.dimmerMsg ('Invalid keyword string entered.');
@@ -2734,8 +2370,7 @@ ODS.Nav = function(navOptions) {
 	self.wait ('hide');
 	self.searchObj.map.removeAllMarkers ();
 
-		var mapResults = OAT.Xml.xpath(xmlDoc,
-				'//searchContacts_response/search_result', {});
+		var mapResults = OAT.Xml.xpath(xmlDoc, '//searchContacts_response/search_result', {});
 	self.searchObj.map.geoCoordArr = new Array();
 
 		for ( var i = 0; i < mapResults.length; i++) {
@@ -2745,10 +2380,8 @@ ODS.Nav = function(navOptions) {
 		htmlDiv.innerHTML = result.html;
 
 			self.searchObj.map.addMarker(result.uid, result.latitude,
-					result.longitude, false, false, false, self.searchObj.map
-							.ref(self.searchObj.map, htmlDiv));
-			self.searchObj.map.geoCoordArr.push(new Array(result.latitude,
-					result.longitude));
+					result.longitude, false, false, false, self.searchObj.map.ref(self.searchObj.map, htmlDiv));
+			self.searchObj.map.geoCoordArr.push(new Array(result.latitude, result.longitude));
 	    }
 
 	self.searchObj.map.optimalPosition (self.searchObj.map.geoCoordArr);
@@ -2764,17 +2397,13 @@ ODS.Nav = function(navOptions) {
 	if ($('search_textbox_searchC').value.length > 0)
 	    $('search_textbox').value = '';
 
-		var results = OAT.Xml.xpath(xmlDoc, '//search_response/search_result',
-				{});
-		var results_contacts = OAT.Xml.xpath(xmlDoc,
-				'//searchContacts_response/search_result', {});
+		var results = OAT.Xml.xpath(xmlDoc, '//search_response/search_result', {});
+		var results_contacts = OAT.Xml.xpath(xmlDoc, '//searchContacts_response/search_result', {});
 
 	if (results_contacts && results_contacts.length > 0)
 	    results = results.concat (results_contacts);
 
-		var resultsPagination = new ODS.paginator(results, $('top_pager'),
-				$('bottom_pager'), renderResultsPage);
-
+		var resultsPagination = new ODS.paginator(results, $('top_pager'), $('bottom_pager'), renderResultsPage);
 		function renderResultsPage(paginationCtrl) {
 	    OAT.Dom.clear ($('search_listing'));
 
@@ -2806,8 +2435,7 @@ ODS.Nav = function(navOptions) {
 					    aElms[k].uid = aElms[k].rel.split ('#')[1];
 					    aElms[k].fullName = aElms[k].rel.split ('#')[2];
 
-							OAT.Event
-									.attach(
+							OAT.Event.attach(
 											aElms[k],
 											"click",
 											function(e) {
@@ -2815,20 +2443,14 @@ ODS.Nav = function(navOptions) {
 								if (t.tagName == 'IMG')
 								    t = t.parentNode;
 
-												self
-														.connectionSet(
+												self.connectionSet(
 																t.uid,
 																1,
 										    function () {
-																	self.session
-																			.connectionAdd(
-																					t.uid,
-														    t.fullName);
-																	self.session
-																			.invitationAdd(t.uid);
+																	self.session.connectionAdd(t.uid, t.fullName);
+																	self.session.invitationAdd(t.uid);
 											self.connections.show = true;
-																	self
-																			.connectionsGet(
+																	self.connectionsGet(
 																					self.session.userId,
 													     'fullName,photo,homeLocation,dataspace',
 													     self.updateConnectionsInterface);
@@ -2846,8 +2468,7 @@ ODS.Nav = function(navOptions) {
 					}
 				}
 					OAT.Dom.append( [ $('search_listing'), resultLi ], [
-							resultLi, resultDiv ], [ resultDiv, resultCB,
-							resultInnerDiv ]);
+							resultLi, resultDiv ], [ resultDiv, resultCB, resultInnerDiv ]);
 			}
 		}
 	}
@@ -2960,250 +2581,79 @@ ODS.Nav = function(navOptions) {
 
 	this.logIn = function() {
     // XXX: add later #destroy previous session and session cookie#
-	self.session.start ();
 
 	var loginDiv = $('loginDiv');
-		if (!self.logindiv) {
-		var loginDiv = OAT.Dom.create ('div', {}, 'login_dialog');
-		loginDiv.id = 'loginDiv';
-		OAT.Dom.show ($('login_page'));
-
-		var loginTab = new OAT.Tab ('loginPCtr');
-		loginTab.add ('loginT1', 'loginP1');
-		loginTab.add ('loginT2', 'loginP2');
-			if (self.regData.openidEnable)
-				OAT.Dom.show('loginT2');
-			loginTab.add('loginT3', 'loginP3');
-			if (self.facebookData && self.regData.facebookEnable) {
-        self.showFacebookData(true);
-        OAT.Dom.show('loginT3');
-        $('loginBtn').value = 'Facebook Login';
-      }
-        loginTab.add('loginT4', 'loginP4');
-			var toGo = 0;
-			if ((document.location.protocol == 'https:') && self.sslData && self.sslData.certLogin && self.regData.sslEnable) {
-				OAT.Dom.show('loginT4');
-				$('loginBtn').value = 'WebID Login';
-				toGo = 3;
-
-				if (self.sslData.iri) {
-          var label = OAT.Dom.create('label');
-          label.innerHTML = 'IRI';
-          var span = OAT.Dom.create('span');
-          span.innerHTML = '<b>' + self.sslData.iri + '</b>';
-          OAT.Dom.append ([$('loginP4'), label, span, OAT.Dom.create('br')]);
-        }
-				if (self.sslData.firstName) {
-          var label = OAT.Dom.create('label');
-          label.innerHTML = 'First Name';
-          var span = OAT.Dom.create('span');
-          span.innerHTML = '<b>' + self.sslData.firstName + '</b>';
-          OAT.Dom.append ([$('loginP4'), label, span, OAT.Dom.create('br')]);
-        }
-				if (self.sslData.family_name) {
-          var label = OAT.Dom.create('label');
-          label.innerHTML = 'Family Name';
-          var span = OAT.Dom.create('span');
-          span.innerHTML = '<b>' + self.sslData.family_name + '</b>';
-          OAT.Dom.append ([$('loginP4'), label, span, OAT.Dom.create('br')]);
-        }
-				if (self.sslData.mbox) {
-          var label = OAT.Dom.create('label');
-          label.innerHTML = 'E-Mail';
-          var span = OAT.Dom.create('span');
-          span.innerHTML = '<b>' + self.sslData.mbox + '</b>';
-          OAT.Dom.append ([$('loginP4'), label, span, OAT.Dom.create('br')]);
-        }
-      }
-			loginTab.go(toGo);
-
-			OAT.Event.attach('loginT1', 'click', function() {
-                        $('loginBtn').value = 'Login';
-				      $('loginErrDiv').innerHTML = '';
-                          if (!OAT.Browser.isIE)
-					  $('loginUserName').focus();
-			});
-			OAT.Event.attach('loginT2', 'click', function() {
-                        $('loginBtn').value = 'Login';
-				      OAT.Dom.hide ($('loginForgot'));
-				      $('loginErrDiv').innerHTML = '';
-                          if (!OAT.Browser.isIE)
-					  $('loginOpenIdUrl').focus();
-			});
-			OAT.Event.attach('loginT3', 'click', function() {
-                          $('loginBtn').value = 'Facebook Login';
-                          OAT.Dom.hide ($('loginForgot'));
-                          $('loginErrDiv').innerHTML = '';
-			});
-			OAT.Event.attach('loginT4', 'click', function() {
-				$('loginBtn').value = 'WebID Login';
-                        OAT.Dom.hide ($('loginForgot'));
-                        $('loginErrDiv').innerHTML = '';
-			});
-
-			OAT.Event.attach($('loginCloseBtn'), "click", OAT.Dimmer.hide);
-
-			OAT.Event.attach($('signupBtn'), "click", function() {
-				      self.session.sid = false;
+		if (!self.loginDiv) {
+  	  $('lf_close').onclick = OAT.Dimmer.hide;
+  		$('lf_login').onclick = function() {
+        lfLoginSubmit(self.afterLogin);
+  		};
+  		$('lf_register').onclick = function() {
 				      OAT.Dimmer.hide ();
+  			self.session.sid = false;
 				      self.loadVspx (self.expandURL (self.ods + 'register.vspx'));
-				  });
-
-			if ($('loginUserName')) {
-				$('loginUserName').callback = function() {
-			    if ($('loginUserPass'))
-				$('loginUserPass').focus();
-			    return;
 			};
-
-			OAT.Event.attach ($('loginUserName'), "keypress", onEnterDown);
-		    }
-
-			if ($('loginUserPass')) {
-			$('loginUserPass').tokenReceived = false;
-
-				$('loginUserPass').callback = function() {
-					if (this.tokenReceived) {
-				    self.showLoginThrobber ();
-				    self.session.validate ();
-					} else {
-						if ($('loginErrDiv').innerHTML
-								.indexOf('Please wait ...') == -1)
-							$('loginErrDiv').innerHTML = '<img src="images/warn_16.png" style="vertical-align: text-bottom; ' + 'padding: 3px 3px 0px 0px;" >Please wait ...';
-						setTimeout(function() {
-							$('loginUserPass').callback()
-						}, 500);
-				}
-			};
-
-			OAT.Event.attach ($('loginUserPass'), "keypress", onEnterDown);
-		    }
-
-			if ($('loginOpenIdUrl')) {
-			$('loginOpenIdUrl').tokenReceived = false;
-
-			$('loginOpenIdUrl').callback = function () {
-					if (this.tokenReceived) {
-				    self.showLoginThrobber ();
-				    self.session.validate ();
-					} else {
-						if ($('loginErrDiv').innerHTML
-								.indexOf('Please wait ...') == -1)
-							$('loginErrDiv').innerHTML = '<img src="images/warn_16.png" style="vertical-align: text-bottom; ' + 'padding: 3px 3px 0px 0px;" >Please wait ...';
-						setTimeout(function() {
-							$('loginOpenIdUrl').callback()
-						}, 500);
-				}
+		  lfInit();
+	    var inputs = $("lf").getElementsByTagName('input');
+      for (var i = 0; i < inputs.length; i++) {
+        obj = inputs[i];
+				obj.tokenReceived = true;
+				obj.callback = function() {
+					if (this.tokenReceived)
+            lfLoginSubmit(self.afterLogin);
 			};
-
-			OAT.Event.attach($('loginOpenIdUrl'), "keypress", onEnterDown);
-		    }
-
-			if ($('loginForgot')) {
-				OAT.Event.attach($('loginForgot'), "click", function() {
-					      OAT.Dimmer.hide ();
-					self.loadVspx(self.expandURL(self.ods
-							+ 'pass_recovery.vspx?usr='
-							+ encodeURIComponent($('loginUserName').value)))
-						  });
-		    }
-
-		OAT.Dom.append ([loginDiv, $('login_page')]);
-
-		self.logindiv = loginDiv;
-		self.logindiv.loginTab = loginTab;
+				OAT.Event.attach(obj, "keypress", onEnterDown);
 	    }
 
-		if (!loginDiv) {
-		loginDiv = OAT.Dom.create ('div', {}, 'login_dialog');
+			var loginDiv = OAT.Dom.create('div');
 		loginDiv.id = 'loginDiv';
-
-		var titleDiv = OAT.Dom.create ('div', {}, 'dlg_title');
-		titleDiv.id = 'loginTitle';
-
-		var titleTxt=OAT.Dom.create ('h3');
-		titleTxt.innerHTML = 'Sign In';
-
-			var closeBtn = OAT.Dom.create("span", {
-				cssFloat : 'right',
-						       cursor      : 'pointer',
-						       color       : '#ddf',
-				paddingRight : '5px'
-			})
-
-		closeBtn.innerHTML = 'x';
-		OAT.Event.attach (closeBtn, "click", OAT.Dimmer.hide);
-		OAT.Dom.append ([titleDiv, closeBtn, titleTxt]);
-
-		var errDiv = OAT.Dom.create ('div');
-		errDiv.id = 'loginErrDiv';
-		errDiv.innerHTML = '';
-
-		var ctrlDiv = OAT.Dom.create ('div', {cssClear: 'left'});
-		ctrlDiv.id = 'loginCtrl';
-
-		var rowA = OAT.Dom.create ('div');
-		var unameLabel = OAT.Dom.create ('label');
-		unameLabel.htmlFor   = 'userName';
-		unameLabel.innerHTML = 'Member ID';
-
-		var unameInput = OAT.Dom.create ('input');
-		unameInput.id = "userName";
-
-		var rowB = OAT.Dom.create ('div');
-		var upassLabel = OAT.Dom.create ('label');
-		upassLabel.htmlFor = 'userPass';
-		upassLabel.innerHTML = 'Password';
-		var upassInput = OAT.Dom.create ('input');
-		upassInput.type = 'password';
-		upassInput.id = "userPass";
-
-		var btnDiv = OAT.Dom.create ('div', {textAlign: 'center'});
-		var loginBtn = OAT.Dom.create ('input', {margin: '20px 5px 20px 105px'});
-		loginBtn.id = 'loginBtn';
-		loginBtn.type = 'button';
-		loginBtn.value = 'Sign In';
-
-		var signupBtn = OAT.Dom.create ('input', {margin: '20px 5px 20px 5px'});
-		signupBtn.type = 'button';
-		signupBtn.value = 'Sign Up!';
-
-			OAT.Event.attach(signupBtn, "click", function() {
-				      self.session.sid = false;
-				      OAT.Dimmer.hide;
-				      self.loadVspx (self.expandURL (self.ods + 'register.vspx'));
-			});
-
-			OAT.Dom.append( [ document.body, loginDiv ], [ loginDiv, titleDiv,
-					errDiv, ctrlDiv ], [ ctrlDiv, rowA, rowB, btnDiv ], [ rowA,
-					unameLabel, unameInput ], [ rowB, upassLabel, upassInput ],
-                  [btnDiv,loginBtn,signupBtn]);
+			OAT.Dom.show($('login_page'));
+			OAT.Dom.append([loginDiv, $('login_page')]);
+			self.loginDiv = loginDiv;
 	    }
-
 	OAT.Dimmer.show (loginDiv);
 	OAT.Dom.center (loginDiv, 1, 1);
+		pageFocus('lf_page_'+lfTab.selectedIndex);
+	};
 
-// fix for missing cursor in FF
-		if (OAT.Browser.isGecko) {
-		$('loginUserName').style.position   = 'fixed';
-		$('loginUserName').style.marginLeft = '105px';
-
-		$('loginUserPass').style.position   = 'fixed';
-		$('loginUserPass').style.marginLeft = '105px';
+	this.afterLogin = function(data) {
+    var xml = OAT.Xml.createXmlDoc(data);
+    if (!hasError(xml)) {
+      lfAttempts = 0;
+      OAT.Dom.hide('lf_forget');
+
+      var session = self.session;
+      session.sid = OAT.Xml.textValue(xml.getElementsByTagName('sid')[0]);
+			session.userName = OAT.Xml.textValue(xml.getElementsByTagName('userName')[0]);
+			session.userId = OAT.Xml.textValue(xml.getElementsByTagName('userId')[0]);
+			session.userIsDba = OAT.Xml.textValue(xml.getElementsByTagName('dba')[0]);
+		  OAT.MSG.send(session, "WA_SES_VALIDBIND", {});
+    } else {
+      lfAttempts++;
+
+      var code = '';
+    	var error = xml.getElementsByTagName('failed')[0];
+      if (error) {
+        code = error.getElementsByTagName('code')[0];
+        if (code)
+          code = OAT.Xml.textValue(code);
+      }
 
-		$('loginOpenIdUrl').style.position   = 'fixed';
-		$('loginOpenIdUrl').style.marginLeft = '105px';
+      if (code != '22000')
+      OAT.Dom.show('lf_forget');
+    }
+    return false;
 	    }
-	$('loginUserName').focus ();
-    };
 
 	this.showLoginThrobber = function(throbberState) {
 	var throbber = $('loginThrobber');
 
+    if (throbber)
 		if (throbber.style.display != 'none' || throbberState == 'hide') {
 		OAT.Dom.hide (throbber);
-		} else
+  		} else {
 	    OAT.Dom.show (throbber);
+  		}
 
 	return;
     }
@@ -3222,7 +2672,7 @@ ODS.Nav = function(navOptions) {
 		if ($('loginDiv').loginTab.selectedIndex == 1)
 		    errMsg = 'Invalid OpenID URL';
 		else
-		    errMsg = 'Invalid Member ID or Password';
+				errMsg = 'Invalid User ID or Password';
 	    }
 		if ($('loginDiv').loginTab.selectedIndex == 0
 				&& $('loginUserName').value.length > 0) {
@@ -3439,19 +2889,11 @@ ODS.Nav = function(navOptions) {
 						};
 					    self.logIn ();
 					});
-
 			OAT.Dom.append ([elmParent,elm]);
 		    }
-
-//            OAT.Dom.hide(elm);
-
 	    }
-
-
     OAT.MSG.send (self, "WA_CONNECTIONS_UPDATED", {});
-
 // END render connection Interface
-
     };
 
 	this.initProfile = function() {
@@ -3562,30 +3004,28 @@ ODS.Nav = function(navOptions) {
 					     '/usersGetInfo_response/user/userName',{})[0]);
 
 	self.profile.userName = userProfileName;
-
-		var userDisplayName = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-					      '/usersGetInfo_response/user/fullName',{})[0]);
-
-	self.profile.userFullName = userDisplayName;
-
-		var userProfilePhoto = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-					      '/usersGetInfo_response/user/photo',{})[0]);
-
-		var userProfileDataspace = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-					      '/usersGetInfo_response/user/dataspace',{})[0]);
-		var userFOAFURI = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-				      '/usersGetInfo_response/user/foaf_ds', {})[0]);
-
-		var userSIOCURI = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-				      '/usersGetInfo_response/user/sioc_ds', {})[0]);
-
+		var userDisplayName = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/fullName', {})[0]);
 	if (userDisplayName == '')
 	    userDisplayName = self.profile.userName;
+		self.profile.userFullName = userDisplayName;
 
-		$('userProfilePhotoName').innerHTML = '<h3>' + userDisplayName + '</h3>';
+		var userProfileDataspace = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/dataspace', {})[0]);
+		var userFOAFURI = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/foaf_ds', {})[0]);
+		var userSIOCURI = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/sioc_ds', {})[0]);
 
-		$('userProfilePhotoImg').src = userProfilePhoto ? userProfilePhoto: 'images/missing_profile_picture.png';
-	$('userProfilePhotoImg').alt = userDisplayName;
+		$('userProfilePhotoName').innerHTML = '<h3>' + userDisplayName + '</h3>';
+ 		$('ProfilePhoto').innerHTML = '';
+ 		var userProfilePhoto = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/photo', {})[0]);
+    if (userProfilePhoto) {
+      var img = OAT.Dom.create('img');
+      img.className = 'prof_photo';
+      img.src = userProfilePhoto;
+      img.alt = userDisplayName;
+      img.rel = 'foaf:depiction';
+      $('userProfilePhoto').appendChild(img);
+  	} else {
+      $('userProfilePhoto').innerHTML = '<br /><b>Photo Not Available</b><br /><br />';
+  	}
 
 	var gems = $('profileUserGems').getElementsByTagName ("a");
 
@@ -3932,8 +3372,7 @@ ODS.Nav = function(navOptions) {
 		    d.setDate (d.getDate () - 1);
 
 		    var titleObj = OAT.Dom.create ('h3', {}, 'date');
-				OAT.Dom
-						.append( [ titleObj, OAT.Dom.text(weekday[d.getDay()]) ]);
+				OAT.Dom.append( [ titleObj, OAT.Dom.text(weekday[d.getDay()]) ]);
 
 				obj[d.getFullYear() + '-' + pZero(d.getMonth() + 1) + '-' + pZero(d.getDate())] = {
 					title : weekday[d.getDay()],
@@ -3975,8 +3414,7 @@ ODS.Nav = function(navOptions) {
 			if (!cont)
 				return;
 
-			var xmlDoc = OAT.Xml.createXmlDoc(OAT.Xml
-					.removeDefaultNamespace(xmlString));
+			var xmlDoc = OAT.Xml.createXmlDoc(OAT.Xml.removeDefaultNamespace(xmlString));
 	    var entries = OAT.Xml.xpath (xmlDoc, '/feed/entry',{});
 
 			for ( var i = 0; i < entries.length; i++) {
@@ -4069,23 +3507,14 @@ ODS.Nav = function(navOptions) {
 	}
 
 		function renderContactInformationBlock(xmlDoc) {
-			var titledFullname = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-					'/usersGetInfo_response/user/title', {})[0])
+			var titledFullname =
+			    OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/title', {})[0])
 					+ ' '
-					+ OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,
-							'/usersGetInfo_response/user/fullName', {})[0]);
+					+ OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/fullName', {})[0]);
 
-	    var photo = OAT.Xml.textValue (OAT.Xml.xpath (xmlDoc,
-							  '/usersGetInfo_response/user/photo',{})[0]);
-	    if (photo.length < 1)
-		photo = 'images/missing_person_tnail.png';
-
-			var _home = OAT.Xml.xpath(xmlDoc,
-					'/usersGetInfo_response/user/home', {});
-			var _business = OAT.Xml.xpath(xmlDoc,
-					'/usersGetInfo_response/user/organization', {});
-			var _im = OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/im',
-					{})[0];
+			var _home = OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/home', {});
+			var _business = OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/organization', {});
+			var _im = OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/im', {})[0];
 
 	    OAT.Dom.clear ($('ciP3'));
 
@@ -4096,67 +3525,56 @@ ODS.Nav = function(navOptions) {
 	  var _li = OAT.Dom.create ('li');
 	  _li.innerHTML = _im.childNodes[i].nodeName + ': ';
 
-				OAT.Dom.append( [ _ul, _li,
-						OAT.Dom.text(OAT.Xml.textValue(_im.childNodes[i])), ]);
+				OAT.Dom.append( [ _ul, _li, OAT.Dom.text(OAT.Xml.textValue(_im.childNodes[i]))]);
 		}
 
 	    var organization = {};
-
 			for ( var i = 0; i < _business[0].childNodes.length; i++) {
-				organization[_business[0].childNodes[i].nodeName] = OAT.Xml
-						.textValue(_business[0].childNodes[i]);
+				organization[_business[0].childNodes[i].nodeName] = OAT.Xml.textValue(_business[0].childNodes[i]);
 		}
 
 			$('ciP2title').innerHTML = '<a href="'
-					+ ((organization.url.indexOf('http://') >= 0) ? organization.url
-							: 'http://' + organization.url) + '">'
+					+ ((organization.url.indexOf('http://') >= 0) ? organization.url : 'http://' + organization.url) + '">'
 					+ organization.title + '</a>';
-			$('ciP2address').innerHTML = organization.address1
-					+ organization.address2;
-			$('ciP2city').innerHTML = (organization.city.length) > 0 ? organization.city + ', '
-					: organization.city;
+			$('ciP2address').innerHTML = organization.address1 + organization.address2;
+			$('ciP2city').innerHTML = (organization.city.length) > 0 ? organization.city + ', ' : organization.city;
 	    $('ciP2state').innerHTML   = organization.state;
-			$('ciP2zip').innerHTML = (organization.state.length + organization.zip.length) > 0 ? organization.zip + ', '
-					: ' ';
+			$('ciP2zip').innerHTML = (organization.state.length + organization.zip.length) > 0 ? organization.zip + ', ' : ' ';
 	    $('ciP2country').innerHTML = organization.country;
-			$('ciP2tel').innerHTML = (organization.mobile.length > 0) ? organization.phone
-					+ ', ' + organization.mobile
-					: organization.phone;
-
-  //      var organizationA=OAT.Dom.create('a');
-  //      organizationA.href= (organization.url.indexOf('http://')>=0) ?  organization.url : 'http://'+organization.url;
-  //      organizationA.target='_blank';
-  //      organizationA.innerHTML=organization.title;
-  //      OAT.Dom.append([$('ciP2'),
-  //                      organizationA,
-  //                      OAT.Dom.create('br'),
-  //                      OAT.Dom.text(organization.address1+organization.address2),
-  //                      OAT.Dom.create('br'),
-  //                      OAT.Dom.text(organization.city+', '+organization.state+' '+organization.zip+', '+organization.country)
-  //                     ]);
+			$('ciP2tel').innerHTML = (organization.mobile.length > 0) ? organization.phone + ', ' + organization.mobile : organization.phone;
 
 	    var home = {};
 
 			for ( var i = 0; i < _home[0].childNodes.length; i++) {
-				home[_home[0].childNodes[i].nodeName] = OAT.Xml
-						.textValue(_home[0].childNodes[i]);
+				home[_home[0].childNodes[i].nodeName] = OAT.Xml.textValue(_home[0].childNodes[i]);
 		}
 
-	    $('ciP1photo').src           = photo;
+			var photo = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/usersGetInfo_response/user/photo', {})[0]);
+			$('ciP1photo').innerHTML = '';
+      if (photo) {
+        var img = OAT.Dom.create('img');
+        img.className = 'photo';
+        img.src = photo;
+        img.alt = 'photo';
+        img.rel = 'foaf:depiction';
+        $('ciP1photo').appendChild(img);
+    	}
+
+			$('ciP1uri').href = this.nav.profile.personal_uri;
+  		var x = function(data) {
+			  $('ciP1qrcode').src = 'data:image/jpg;base64,' + data;
+  		};
+      OAT.AJAX.GET ('/ods/api/qrcode?data='+encodeURIComponent(this.nav.profile.personal_uri), null, x, ajaxOptions);
+
 	    $('ciP1fn').innerHTML        = titledFullname;
 	    $('ciP1org').innerHTML       = organization.title;
 	    $('ciP1email').style.display = 'none';
 	    $('ciP1address').innerHTML   = home.address1+home.address2;
 	    $('ciP1city').innerHTML      = home.city.length ? home.city+', ' : '';
 	    $('ciP1state').innerHTML     = home.state;
-			$('ciP1zip').innerHTML = (home.state.length + home.zip.length) > 0 ? home.zip + ', '
-					: home.zip;
+			$('ciP1zip').innerHTML = (home.state.length + home.zip.length) > 0 ? home.zip + ', ' : home.zip;
 	    $('ciP1country').innerHTML   = home.country;
-
- //       $('ciP1tel').style.display='none';
-
-			$('ciP1tel').innerHTML = (home.mobile.length > 0) ? home.phone
-					+ ', ' + home.mobile : home.phone;
+			$('ciP1tel').innerHTML = (home.mobile.length > 0) ? home.phone + ', ' + home.mobile : home.phone;
 
 	    //  	    self.profile.ciMap.centerAndZoom (home.latitude,home.longitude,8); /* africa, middle zoom */
 	    //	    self.profile.ciMap.addTypeControl ();
@@ -4230,12 +3648,10 @@ ODS.Nav = function(navOptions) {
 //      self.profile.ciMap.optimalPosition(new Array(self.profile.ciMap.homeLocation,self.profile.ciMap.workLocation));
 
       $('sm_personal').href = this.nav.profile.personal_uri;
-			$('sm_openid').href = this.nav.profile.personal_uri.replace(
-					'#this', '');
+			$('sm_openid').href = this.nav.profile.personal_uri.replace('#this', '');
       $('sm_foaf').href = this.nav.profile.foaf_uri;
       $('sm_sioc').href = this.nav.profile.sioc_uri;
-			$('sm_dataspace').href = this.nav.profile.personal_uri.replace(
-					'#this', '');
+			$('sm_dataspace').href = this.nav.profile.personal_uri.replace('#this', '');
       $('sm_vcard').href = this.nav.profile.vcard;
 
 	    return;
@@ -4322,8 +3738,7 @@ ODS.Nav = function(navOptions) {
 	//	renderSematicMagic ();
 
 		function renderDataspaceUl(xmlDoc) {
-	    var resXmlNodes = OAT.Xml.xpath (xmlDoc,
-					     '//applicationsGet_response/application',{});
+			var resXmlNodes = OAT.Xml.xpath(xmlDoc, '//applicationsGet_response/application', {});
 	    var ulDS = $('ds_list');
 
 	    OAT.Dom.clear (ulDS);
@@ -4331,8 +3746,7 @@ ODS.Nav = function(navOptions) {
 			for ( var i = 0; i < resXmlNodes.length; i++) {
 		    var applicationObj = buildObjByAttributes (resXmlNodes[i]);
 
-				applicationObj.selfTextValue = OAT.Xml
-						.textValue(resXmlNodes[i]);
+				applicationObj.selfTextValue = OAT.Xml.textValue(resXmlNodes[i]);
 
 				if (applicationObj.disable != '0'
 						&& applicationObj.url.length > 0) {
@@ -4393,11 +3807,9 @@ ODS.Nav = function(navOptions) {
 
 	    OAT.Dom.clear (discussionsDiv);
 
-	    var resXmlNodes = OAT.Xml.xpath (xmlDoc,
-					     '//userDiscussionGroups_response/discussionGroup',{});
+			var resXmlNodes = OAT.Xml.xpath(xmlDoc, '//userDiscussionGroups_response/discussionGroup', {});
 
 	    var discussionGroup = {}
-
 			for ( var i = 0; i < resXmlNodes.length; i++) {
 		    discussionGroup = buildObjByChildNodes (resXmlNodes[i]);
 
@@ -4414,8 +3826,7 @@ ODS.Nav = function(navOptions) {
 		    if (i == 0)
 			OAT.Dom.append ([discussionsDiv, discussionA]);
 		    else
-					OAT.Dom.append( [ discussionsDiv, OAT.Dom.text(', '),
-							discussionA ]);
+					OAT.Dom.append( [ discussionsDiv, OAT.Dom.text(', '), discussionA ]);
 		}
 
 	    $('discussionsTitleTxt').innerHTML = 'Discussion Groups (' + (i) + ')';
@@ -4445,8 +3856,7 @@ ODS.Nav = function(navOptions) {
 			    if (i == 0)
 				OAT.Dom.append ([interestsP,interestA]);
 			    else
-						OAT.Dom.append( [ interestsP, OAT.Dom.text(', '),
-								interestA ]);
+						OAT.Dom.append( [ interestsP, OAT.Dom.text(', '), interestA ]);
 			}
 		}
 
@@ -4458,8 +3868,7 @@ ODS.Nav = function(navOptions) {
 	if (self.session.sid && self.session.userId == self.profile.userId)
 	    self.applicationsGet (false, false, 'own', renderDataspaceUl);
 		else if (self.profile.userId)
-			self.applicationsGet(self.profile.userId, false, 'all',
-					renderDataspaceUl);
+			self.applicationsGet(self.profile.userId, false, 'all', renderDataspaceUl);
 
 //    self.installedPackages(renderDataspaceUl);
 
@@ -4472,8 +3881,7 @@ ODS.Nav = function(navOptions) {
 
 		if (self.session.sid) {
 		OAT.Dom.show ($('groups_w'));
-			self.discussionGroupsGet(self.profile.userId,
-					renderDiscussionGroups);
+			self.discussionGroupsGet(self.profile.userId, renderDiscussionGroups);
 		} else
 	    OAT.Dom.hide ($('groups_w'));
 
@@ -4591,14 +3999,19 @@ ODS.Nav = function(navOptions) {
 	iframe.src = (url);
     };
 
+	this.frontPage = function() {
+		if (this.session.userName)
+			return this.expandURL(this.ods + 'myhome.vspx');
+
+		return this.expandURL(this.ods + 'sfront.vspx');
+	};
+
 	this.loadRDFB = function(url, useFrame) {
 		if (typeof (url) == 'undefined')
 			return;
 
 	if (url.indexOf (document.location.protocol + '//') < 0)
-			var rdfbUrl = '/rdfbrowser/index.html?uri=' + encodeURIComponent(self
-					.odsLink()
-					+ url);
+			var rdfbUrl = '/rdfbrowser/index.html?uri=' + encodeURIComponent(self.odsLink()+ url);
 	else
 	    var rdfbUrl = '/rdfbrowser/index.html?uri=' + encodeURIComponent (url);
 
@@ -4614,11 +4027,9 @@ ODS.Nav = function(navOptions) {
 
 		if (self.session.userName) {
 		if (url.indexOf ('?') >- 1)
-				retUrl = url + '&sid=' + self.session.sid + '&realm='
-						+ self.session.realm;
+				retUrl = url + '&sid=' + self.session.sid + '&realm='+ self.session.realm;
 		else
-				retUrl = url + '?sid=' + self.session.sid + '&realm='
-						+ self.session.realm;
+				retUrl = url + '?sid=' + self.session.sid + '&realm='+ self.session.realm;
 	    }
 	return retUrl;
     };
@@ -4678,14 +4089,10 @@ ODS.Nav = function(navOptions) {
 				  });
 		} else
       setTimeout ('OAT.Dimmer.hide ()', 5000)
-		OAT.Event.attach(div, "click", function() {
-				  OAT.Dimmer.hide ();
-			      });
+		OAT.Event.attach(div, "click", function() {OAT.Dimmer.hide();});
 
 	OAT.Dimmer.hide ();
-		OAT.Dimmer.show(div, {
-			popup : true
-		});
+		OAT.Dimmer.show(div, {popup : true});
 	OAT.Dom.center (div, 1, 1);
 
 	if (typeof (callback) == "function")
@@ -4694,9 +4101,7 @@ ODS.Nav = function(navOptions) {
 
 	var ajaxOptions = {
 		auth : OAT.AJAX.AUTH_BASIC,
-		onerror : function(request) {
-			dd(request.getStatus());
-		}
+		onerror : function(request) {dd(request.getStatus());}
     };
 
   this.installedPackages = function (callbackFunction) {
@@ -4733,8 +4138,7 @@ ODS.Nav = function(navOptions) {
 			callbackFunction(xmlDoc);
 		}
 	};
-		OAT.AJAX.POST(self.session.endpoint + "applicationsGet", data,
-				callback, ajaxOptions);
+		OAT.AJAX.POST(self.session.endpoint + "applicationsGet", data, callback, ajaxOptions);
     };
 
   this.checkApplication = function (applicationType, callbackFunction) {
@@ -4744,8 +4148,7 @@ ODS.Nav = function(navOptions) {
 	if (applicationType == 'InstantMessenger')
 	    applicationType = 'Instant Messenger';
 
-		var data = 'sid=' + self.session.sid + '&application='
-				+ encodeURIComponent(applicationType);
+		var data = 'sid=' + self.session.sid + '&application=' + encodeURIComponent(applicationType);
 		var callback = function(xmlString) {
 	    var xmlDoc = OAT.Xml.createXmlDoc (xmlString);
 			if (!self.session.isErr(xmlDoc)) {
@@ -4755,8 +4158,7 @@ ODS.Nav = function(navOptions) {
 		    self.wait();
 		}
     }
-		OAT.AJAX.POST(self.session.endpoint + "checkApplication", data,
-				callback, ajaxOptions);
+		OAT.AJAX.POST(self.session.endpoint + "checkApplication", data, callback, ajaxOptions);
 	};
 
   this.userCommunities = function (callbackFunction) {
@@ -4914,9 +4316,7 @@ ODS.Nav = function(navOptions) {
 			callbackFunction (xmlDoc);
 		}
 	};
-
-		OAT.AJAX.POST(self.session.endpoint + "userMessageSend", data,
-				callback, optionsSynch);
+		OAT.AJAX.POST(self.session.endpoint + "userMessageSend", data, callback, optionsSynch);
     };
 
 	this.userMessageStatusSet = function(msgId, msgStatus, callbackFunction) {
@@ -4929,8 +4329,7 @@ ODS.Nav = function(navOptions) {
 			callbackFunction (xmlDoc);
 		}
 	};
-		OAT.AJAX.POST(self.session.endpoint + "userMessageStatusSet", data,
-				callback, ajaxOptions);
+		OAT.AJAX.POST(self.session.endpoint + "userMessageStatusSet", data, callback, ajaxOptions);
     };
 
 	this.search = function(searchParamsStr, callbackFunction) {
@@ -4945,8 +4344,7 @@ ODS.Nav = function(navOptions) {
 			callbackFunction (xmlDoc);
 		}
 	};
-		OAT.AJAX.POST(self.session.endpoint + "search", data, callback,
-				optionsSynch);
+		OAT.AJAX.POST(self.session.endpoint + "search", data, callback, optionsSynch);
     };
 
 	this.searchContacts = function(searchParamsStr, callbackFunction) {
@@ -4959,8 +4357,7 @@ ODS.Nav = function(navOptions) {
 			callbackFunction (xmlDoc);
 		}
 	};
-		OAT.AJAX.POST(self.session.endpoint + "searchContacts", data, callback,
-				optionsSynch);
+		OAT.AJAX.POST(self.session.endpoint + "searchContacts", data, callback, optionsSynch);
     };
 
 	this.tagSearchResult = function(tagParamsStr, callbackFunction) {
@@ -4986,21 +4383,12 @@ ODS.Nav = function(navOptions) {
 
 			if (!self.session.isErr(xmlDoc)) {
 		  if (!self.serverOptions.uriqaDefaultHost)
-					self.serverOptions.uriqaDefaultHost = OAT.Xml
-							.textValue(OAT.Xml
-									.xpath(
-											xmlDoc,
-											'/serverSettings_response/uriqaDefaultHost',
-											{})[0]);
+					self.serverOptions.uriqaDefaultHost = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,'/serverSettings_response/uriqaDefaultHost',{})[0]);
 
-//                                               self.serverOptions.useRDFB=OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/serverSettings_response/useRDFB',{})[0]);
-
-		  if (OAT.Xml.textValue (OAT.Xml.xpath (xmlDoc,
-							'/serverSettings_response/useRDFB', {})[0]) == '1')
+				if (OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,'/serverSettings_response/useRDFB', {})[0]) == '1')
 		      self.serverOptions.useRDFB = 1;
 
-		  var googleKey = OAT.Xml.textValue (OAT.Xml.xpath (xmlDoc,
-								    '/serverSettings_response/googleMpasKey',{})[0]);
+				var googleKey = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc, '/serverSettings_response/googleMpasKey', {})[0]);
 		  if (googleKey != '')
 		      window._apiKey = googleKey;
 	      }
@@ -5066,9 +4454,7 @@ ODS.Nav = function(navOptions) {
 
 	    var selectedUid = false;
 
-			var container = OAT.Dom.create("div", {
-				textAlign : 'center'
-			});
+			var container = OAT.Dom.create("div", {textAlign : 'center'});
 	    container.id = 'sendBlockWin';
 
 			var _span = OAT.Dom.create('span', {
@@ -5107,11 +4493,7 @@ ODS.Nav = function(navOptions) {
 			}
 		}
 
-			OAT.Event
-					.attach(
-							userList,
-							"change",
-			      function (e) {
+			OAT.Event.attach(userList, "change", function(e) {
 				  var t = eTarget (e);
 
 				  if (t.options[t.selectedIndex].value == -1)
@@ -5126,9 +4508,7 @@ ODS.Nav = function(navOptions) {
 				  userList.style.color = '#000';
 			      });
 
-			var msgText = OAT.Dom.create('textarea', {
-				width : '97%'
-			});
+			var msgText = OAT.Dom.create('textarea', {width : '97%'});
 	    msgText.id  = 'msgTextWin';
 
 	    var sendBtn  = OAT.Dom.create ('input');
@@ -5256,24 +4636,16 @@ ODS.Nav = function(navOptions) {
 															t.uid,
 									       1,
 									       function (xmlDoc) {
-																var msg = OAT.Xml
-																		.textValue(OAT.Xml
-																				.xpath(
-																						xmlDoc,
-														     '/connectionSet_response/message',
-										                                     {})[0]);
-																if (msg
-																		&& msg.length > 0)
+																var msg = OAT.Xml.textValue(OAT.Xml.xpath(xmlDoc,'/connectionSet_response/message',{})[0]);
+																if (msg && msg.length > 0)
 							     // self.dimmerMsg (msg);
 							     ;
 																else {
 																	self.session.connectionAdd(t.uid);
 																	self.session.invitationAdd(t.uid);
 										       }
-
 										   self.connections.show = true;
-																self
-																		.connectionsGet(
+																self.connectionsGet(
 																				self.session.userId,
 													'fullName,photo,homeLocation,dataspace',
 													self.updateConnectionsInterface);
@@ -5310,8 +4682,6 @@ ODS.Nav = function(navOptions) {
 			} else
 		OAT.Dom.hide (links[3].parentNode);
 
-			var winType = OAT.Browser.isIE ? OAT.WinData.TYPE_RECT
-					: OAT.WinData.TYPE_ROUND
 	    var obj = {
 		title         : connObj.fullName,
 		content       : connContent,
@@ -5319,10 +4689,8 @@ ODS.Nav = function(navOptions) {
 		result_control: false,
 		activation    : "click",
 		enabledButtons: "c",
-		visibleButtons: "c",
-		type          :winType
+				visibleButtons : "c"
 	    };
-
 	    OAT.Anchor.assign (elm, obj);
 	}
 
@@ -5371,41 +4739,47 @@ ODS.Nav = function(navOptions) {
     var uriParams = OAT.Dom.uriParams();
     var cookieSid = this.readCookie ('sid');
 
-	if (!self.session.sid && typeof (uriParams['openid.signed']) != 'undefined'
-			&& uriParams['openid.signed'] != '') {
-	    self.session.openId.server       = uriParams['oid-srv'];
-	    self.session.openId.sig          = uriParams['openid.sig'];
-	    self.session.openId.identity     = uriParams['openid.identity'];
-	    self.session.openId.assoc_handle = uriParams['openid.assoc_handle'];
-	    self.session.openId.signed       = uriParams['openid.signed'];
-
-	    self.session.openIdVerify ();
-	} else if (!self.session.sid
-			&& typeof (uriParams['openid.mode']) != 'undefined'
-			&& uriParams['openid.mode'] == 'cancel') {
-		OAT.MSG.send(self.session, "WA_SES_INVALID", {
-			retryLogIn : true,
-			msg : 'OpenID Authentication Failed'
-		});
-	} else if (typeof (uriParams.sid) != 'undefined' && uriParams.sid != '') {
+	if (!self.session.sid && typeof (uriParams['openid.signed']) != 'undefined' && uriParams['openid.signed'] != '')
+	{
+	  self.logIn();
+		lfTab.go(1);
+	}
+	else if (!self.session.sid && (typeof (uriParams['oauth_verifier']) != 'undefined' && uriParams['oauth_verifier'] != '') && (typeof (uriParams['oauth_token']) != 'undefined' && uriParams['oauth_token'] != ''))
+	{
+	  self.logIn();
+	  if (uriParams['oid-mode'] == 'twitter')
+		lfTab.go(4);
+		else
+		  lfTab.go(5);
+	}
+	else if (!self.session.sid && typeof (uriParams['openid.mode']) != 'undefined' && uriParams['openid.mode'] == 'cancel')
+	{
+	  self.logIn();
+	}
+	else if (typeof (uriParams.sid) != 'undefined' && uriParams.sid != '')
+	{
 		    self.session.sid = uriParams.sid;
 		    self.session.validateSid ();
-	} else if (!self.session.sid && cookieSid) {
+	}
+	else if (!self.session.sid && cookieSid)
+	{
 			self.session.sid = cookieSid;
 			self.session.validateSid ();
-	} else {
-		OAT.MSG.send(self.session, "WA_SES_VALIDATION_END", {
-			sessionValid : 0
-		});
+	}
+	else
+	{
+		OAT.MSG.send(self.session, "WA_SES_VALIDATION_END", {sessionValid: 0});
 		    }
 
-	OAT.Event.attach($('vspxApp'), "load", function() {self.hide_app_throbber();});
-	OAT.Event.attach(
-					$('vspxApp'),
-					"load",
-		      function () {
+	OAT.Event.attach($('vspxApp'), "load", function() {
+	  self.hide_app_throbber();
+	});
+	OAT.Event.attach($('vspxApp'), "load", function() {
 						if (!self.session.sid) {
 							var getParams = OAT.Browser.isIE ? $('vspxApp').contentWindow.location.href: $('vspxApp').contentDocument.location.search;
+		  if (getParams.indexOf('oid-mode=') > -1)
+		    return;
+
 							if (getParams.indexOf('sid=') > -1) {
 								var iframeSid = getParams.substring(getParams.indexOf('sid=') + 4, getParams.length);
 								iframeSid = iframeSid.substring(0, iframeSid.indexOf('&'));
@@ -5496,25 +4870,19 @@ function initNav() {
 	options = {
 		auth : OAT.AJAX.AUTH_BASIC,
 	       noSecurityCookie : 1,
-		onerror : function(request) {
-			dd(request.getStatus());
-		}
+		onerror: function(request) {dd(request.getStatus());}
     };
 
 	optionsSynch = {
 		auth : OAT.AJAX.AUTH_BASIC,
 		    async   : false,
-		onerror : function(request) {
-			dd(request.getStatus());
-		}
+		onerror: function(request) {dd(request.getStatus());}
     };
 
 	optionsGet = {
 		auth : OAT.AJAX.AUTH_NONE,
 		  noSecurityCookie : 1,
-		onerror : function(request) {
-			dd(request.getStatus());
-		}
+		onerror : function(request) {dd(request.getStatus());}
     };
 
     var vpsize = OAT.Dom.getViewport ();
diff --git a/appsrc/ODS-Framework/nav_framework_api.sql b/appsrc/ODS-Framework/nav_framework_api.sql
index 4f0d16a..78bcd3b 100644
--- a/appsrc/ODS-Framework/nav_framework_api.sql
+++ b/appsrc/ODS-Framework/nav_framework_api.sql
@@ -1,5 +1,5 @@
 --
---  $Id: nav_framework_api.sql,v 1.23.2.12 2010/07/05 08:26:09 source Exp $
+--  $Id: nav_framework_api.sql,v 1.23.2.19 2011/01/25 14:11:28 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -112,7 +112,7 @@ wa_exec_no_error('drop procedure DB.DBA.usersinfo_sql');
 wa_exec_no_error('drop procedure DB.DBA.VSPX_EXPIRE_ANONYMOUS_SESSIONS');
 wa_exec_no_error('drop procedure DB.DBA.xml_nodename');
 
-USE "ODS";
+USE ODS;
 
 create procedure sessionStart (in realm varchar :='wa') __SOAP_HTTP 'text/xml'
 {
@@ -190,7 +190,7 @@ create procedure sessionValidateX509 (
   set_user_id ('dba');
   fingerPrint := get_certificate_info (6);
   for (select cast (UC_CERT as varchar) cert,
-              U_NAME uname
+              U_NAME uName
          from DB.DBA.WA_USER_CERTS,
               DB.DBA.SYS_USERS
         where UC_U_ID = U_ID
@@ -199,12 +199,17 @@ create procedure sessionValidateX509 (
   {
     info := get_certificate_info (9, cert);
     if (not isarray (info))
-      return 0;
-    agent := get_certificate_info (7, null, null, null, '2.5.29.17');
-    if (agent is null or agent not like 'URI:%')
-      return 0;
-    agent := subseq (agent, 4);
-
+      return NULL;
+    agent := ODS.ODS_API.SSL_WEBID_GET ();
+    if (agent is null)
+      {
+	agent := DB.DBA.FOAF_SSL_WEBFINGER ();
+	if (agent is not null)
+	  goto authenticated;
+	agent := ODS..FINGERPOINT_WEBID_GET ();
+	if (agent is null)
+	  return NULL;
+      }
     declare exit handler for sqlstate '*'
     {
       rollback work;
@@ -235,6 +240,7 @@ create procedure sessionValidateX509 (
     if (graph is not null)
       exec (sprintf ('SPARQL clear graph <%s>', graph), st, msg);
     commit work;
+    authenticated:
     retValue := vector (uName);
   }
 _exit:;
@@ -263,7 +269,7 @@ create procedure sessionValidate (
 
   if (facebookUID <> 0)
   {
-    userName := (select U_NAME from DB.DBA.WA_USER_INFO, DB.DBA.SYS_USERS where WAUI_U_ID = U_ID and WAUI_FACEBOOK_LOGIN_ID = facebookUID);
+    userName := (select U_NAME from DB.DBA.WA_USER_INFO, DB.DBA.SYS_USERS where WAUI_U_ID = U_ID and WAUI_FACEBOOK_ID = facebookUID);
     if (isnull (userName))
       goto _authbad;
 
@@ -910,8 +916,9 @@ create procedure checkApplication (
     http ('<name>' || wainstance_name || '</name>', resXml);
     http ('<url>' || application_url || '</url>',resXml);
     http ('</application>', resXml);
+
+    httpResXml (resXml, 'checkApplication');
   }
-  httpResXml (resXml, 'createApplication');
   return '';
 }
 ;
@@ -1644,19 +1651,19 @@ _err:
 grant execute on userMessageStatusSet to GDATA_ODS;
 
 create procedure openIdServer (
-  in openIdUrl varchar,
-  in mode varchar := null) __SOAP_HTTP 'text/xml'
+  in openIdUrl varchar) __SOAP_HTTP 'text/xml'
 {
   declare errCode integer;
   declare errMsg varchar;
   declare resXml any;
+  declare profilePage varchar;
 
   resXml  := string_output ();
   errCode := 0;
   errMsg  := '';
 
   declare hdr, xt, loc any;
-  declare url, cnt, oi_version, oi_srv, oi2_srv, oi_delegate varchar;
+  declare url, xrds_url, cnt, oi_version, oi_srv, oi2_srv, oi_delegate, oi_params, oi_priority, webid varchar;
   declare exit handler for sqlstate '*'
   {
     errCode:=501;
@@ -1668,9 +1675,17 @@ create procedure openIdServer (
   oi_srv := null;
   oi2_srv := null;
   oi_delegate := null;
+  oi_params := 'sreg';
+  profilePage := ODS.DBA.WF_PROFILE_GET (openIdUrl);
+  if (profilePage is not null)
+    openIdUrl := profilePage;
+  if (openIdUrl like '%@%' and profilePage is null)
+    {
+      webid := ODS..FINGERPOINT_WEBID_GET (null, openIdUrl);
+      if (webid is not null)
+	  openIdUrl := normalize_url_like_browser (webid);
+	}
 
-  if (DB.DBA.is_empty_or_null (mode))
-  {
     url := openIdUrl;
 again:
   hdr := null;
@@ -1683,6 +1698,13 @@ again:
   }
     if (http_request_header (hdr, 'Content-Type') <> 'application/xrds+xml')
     {
+  	xrds_url := http_request_header (hdr, 'X-XRDS-Location');
+  	if (xrds_url is not null)
+	  {
+	    cnt := http_client (xrds_url, n_redirects=>15);
+	    goto _xrds;
+	  }
+
   xt := xtree_doc (cnt, 2);
   oi_srv := cast (xpath_eval ('//link[contains (@rel, "openid.server")]/@href', xt) as varchar);
       oi2_srv := cast (xpath_eval ('//link[contains (@rel, "openid2.provider")]/@href', xt) as varchar);
@@ -1692,24 +1714,53 @@ again:
         oi_version := '2.0';
         oi_srv := oi2_srv;
       }
-    } else {
+  }
+  else
+  {
+  _xrds:;
       xt := xtree_doc (cnt);
+
+    -- version 2.0
+    oi_srv := cast (xpath_eval ('/XRDS/XRD/Service[Type/text() = "http://specs.openid.net/auth/2.0/signon"]/URI/text()', xt) as varchar);
+    if (not isnull (oi_srv))
+    {
+      oi_priority := cast (xpath_eval ('/XRDS/XRD/Service[Type/text() = "http://specs.openid.net/auth/2.0/signon"]/@priority', xt) as varchar);
       oi_version := '2.0';
-      oi_srv := cast (xpath_eval ('//XRD/Service/URI', xt) as varchar);
+      goto _params;
     }
+
+    -- version 1.1
+    oi_srv := cast (xpath_eval ('/XRDS/XRD/Service[Type/text() = "http://openid.net/signon/1.1"]/URI/text()', xt) as varchar);
+    if (not isnull (oi_srv))
+    {
+      oi_priority := cast (xpath_eval ('/XRDS/XRD/Service[Type/text() = "http://openid.net/signon/1.1"]/@priority', xt) as varchar);
+      oi_version := '1.1';
+      goto _params;
   }
-  else if (mode = 'google')
+
+    -- version 1.0
+    oi_srv := cast (xpath_eval ('/XRDS/XRD/Service[Type/text() = "http://openid.net/signon/1.0"]/URI/text()', xt) as varchar);
+    if (not isnull (oi_srv))
   {
-    oi_version := '2.0';
-    oi_srv := 'https://www.google.com/accounts/o8/ud';
+      oi_priority := cast (xpath_eval ('/XRDS/XRD/Service[Type/text() = "http://openid.net/signon/1.0"]/@priority', xt) as varchar);
+      oi_version := '1.1';
+    }
+  _params:;
+    if (isnull (oi_srv))
+      signal ('501', 'Invalid OpenID URL');
+
+    if (not isnull (xpath_eval (sprintf ('/XRDS/XRD/Service[@priority = "%s"]/Type[text() = "http://openid.net/srv/ax/1.0"]/text()', oi_priority), xt)))
+      oi_params := 'ax';
   }
 
+_exit:;
   http('<version>'||oi_version||'</version>',resXml);
   http('<server>'||oi_srv||'</server>',resXml);
   http('<delegate>'||oi_delegate||'</delegate>',resXml);
+  http('<identity>'||openIdUrl||'</identity>',resXml);
+  http('<params>'||oi_params||'</params>',resXml);
 
 _end:
-
   if(errCode<>0)
      httpErrXml(errCode,errMsg,'openIdServer');
   else
@@ -2198,7 +2249,7 @@ nf:
    declare errCode integer;
    declare errMsg  varchar;
    errCode := 1;
-   errMsg  := 'Authentication incorrect.';
+   errMsg  := 'Invalid or expired session.';
 
    httpErrXml(errCode,errMsg,'isSessionValid');
 
diff --git a/appsrc/ODS-Framework/new_inst.vspx b/appsrc/ODS-Framework/new_inst.vspx
index 42df6b8..481d086 100644
--- a/appsrc/ODS-Framework/new_inst.vspx
+++ b/appsrc/ODS-Framework/new_inst.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: new_inst.vspx,v 1.21.2.1 2009/10/12 21:49:59 source Exp $
+ -  $Id: new_inst.vspx,v 1.21.2.4 2010/09/20 10:15:23 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -39,8 +39,6 @@
 
         if (self.wa_type in ('oDrive', 'oMail', 'IM'))
         {
-          self.imodel := 1;
-          self.is_public := 0;
           self.is_visible := 0;
         }
         self.domains := '<domains/>';
@@ -327,29 +325,14 @@
         return;
       };
       id := call (h) (self.inst, connection_get ('vspx_user'));
-      if (self.wa_type not in ('oMail', 'IM'))
+      if (self.wa_type not in ('oMail', 'IM') and self.switch_adv = 1)
       {
-        self.is_public := get_keyword ('is_public1', self.vc_event.ve_params);
+        self.is_public := self.is_public1.ufl_selected;
       }
       if (self.wa_type not in ('oDrive', 'oMail', 'IM') and self.switch_adv = 1)
       {
         self.is_visible := self.is_visible1.ufl_selected;
       }
-      declare N integer;
-      declare suffix, tmp_s varchar;
-
-      tmp_s := vector();
-      for (N := 0; N < length (e.ve_params); N := N + 4)
-      {
-        if ((e.ve_params [N] like 's_fld_2_%') and (trim (e.ve_params [N+1]) <> ''))
-        {
-          suffix := replace (e.ve_params [N], 's_fld_2_', '');
-          tmp_s := vector_concat (tmp_s, vector (vector (get_keyword ('s_fld_1_'||suffix, e.ve_params, ''), get_keyword ('s_fld_2_'||suffix, e.ve_params,''), get_keyword ('s_fld_3_'||suffix, e.ve_params,''))));
-        }
-      }
-      tmp_s := vector_concat (vector (vector ('v1.0', length (tmp_s))), tmp_s);
-      self.acl := serialize (tmp_s);
-
       self.ilic := self.ilic1.ufl_value;
       update WA_INSTANCE
          set WAI_MEMBER_MODEL = self.imodel1.ufl_value,
@@ -357,8 +340,7 @@
              WAI_MEMBERS_VISIBLE = self.is_visible,
              WAI_NAME = self.inst.wa_name,
 	           WAI_DESCRIPTION = self.idesc1.ufl_value,
-	           WAI_LICENSE = self.ilic1.ufl_value,
-	           WAI_ACL = self.acl
+	           WAI_LICENSE = self.ilic1.ufl_value
              where WAI_ID = id;
       -- VD creation
       {
@@ -487,10 +469,9 @@
       <vm:variable name="inst" type="db.dba.web_app" default="null" persist="0" />
       <vm:variable name="wa_name" type="varchar" default="null" persist="0" param-name="wa_name"/>
       <vm:variable name="wa_type" type="varchar" default="null" persist="0"/>
-      <vm:variable name="imodel" type="int" default="2" persist="0"/>
-      <vm:variable name="is_public" type="int" default="1" persist="0"/>
+      <vm:variable name="imodel" type="int" default="1" persist="0"/>
+      <vm:variable name="is_public" type="int" default="0" persist="0"/>
       <vm:variable name="is_visible" type="int" default="1" persist="0"/>
-      <vm:variable name="acl" type="any" default="null" persist="0"/>
       <vm:variable name="iid" type="int" default="null" persist="0"/>
       <vm:variable name="iname" type="varchar" default="null" persist="0"/>
       <vm:variable name="ihome" type="varchar" default="null" persist="0"/>
@@ -518,8 +499,7 @@
           <div id="main">
 	          <div class="box">
       	      <v:local-variable name="dummy">
-           		  <v:before-data-bind>
-           		    <![CDATA[
+           		  <v:before-data-bind><![CDATA[
                   if ((exists (select 1  from WA_TYPES  where WAT_NAME =self.wa_name
                       and ( WAT_MAXINST=0 or WAT_MAXINST <= (select WMIC_INSTCOUNT from WA_MEMBER_INSTCOUNT where WMIC_TYPE_NAME=WAT_NAME  and WMIC_UID =self.u_id))))
                       or  self.wa_name='Discussion'
@@ -546,8 +526,7 @@
             		    if (self.wa_cnt = 0)
             		      self.promo := '';
             		  }
-        		      ]]>
-      		      </v:before-data-bind>
+      		      ]]></v:before-data-bind>
       	      </v:local-variable>
 	            <v:form type="simple" method="POST" name="aform1">
 	              <v:template name="maxinst_exceed" type="simple" condition="self.maxinstexceeded = 1 and self.wa_name<>'Discussion'">
@@ -613,9 +592,7 @@
                              else if (self.wa_type = 'IM')
                              {
                                _iname := sprintf ('%s%d', self.u_first_name, _cnt);
-                             }
-                             else
-                             {
+                             } else {
                                _iname := sprintf ('%s\'s %s (%d)', self.u_first_name, app_suff, _cnt);
                              }
                            }
@@ -676,15 +653,6 @@
   		                 }
                     ]]>
 		                </v:before-data-bind>
-		                <br />
-                    <input type="hidden" name="tabNo" xhtml_id="tabNo" value="0"/>
-                    <div id="p" class="c1">
-                      <div class="tabs">
-                        <div onclick="javascript: showTab('p', 2, 0);" class="tab activeTab" id="p_tab_0">Main</div>
-                        <div onclick="javascript: showTab('p', 2, 1);" class="tab" id="p_tab_1">Access</div>
-                      </div>
-                      <div class="contents">
-                        <div id="p_content_0" class="tabContent">
 		                <table  class="ctl_grp" >
                     <vm:instance-settings />
                     <v:after-data-bind>
@@ -702,16 +670,9 @@
                         }
                       ]]>
     		            </v:after-data-bind>
-                          </table>
-                        </div>
-                        <div id="p_content_1" class="tabContent" style="display: none;">
-      		                <table class="ctl_grp" width="100%">
-                            <vm:instance-sharing />
-                          </table>
-                        </div>
-                      </div>
-                      <br />
-                      <div>
+                  		<tr>
+                  		  <td colspan="3">
+                  		    <span class="fm_ctl_btn">
                 <v:button action="simple" name="cancel1" value="Cancel" >
                   <v:on-post>
                     <![CDATA[
@@ -735,8 +696,10 @@
 		      self.vc_redirect ('services.vspx');
                   </v:on-post>
                 </v:button>
-                      </div>
-                    </div>
+                  	      </span>
+                  	    </td>
+                	    </tr>
+	                  </table>
 	    </v:template>
 	    <v:template name="tmpl_inst_ck" type="simple" condition="self.promo = 'promo'">
 	      <h2>
@@ -750,7 +713,7 @@
 		  <th>Your own <?V self.wa_desc ?></th>
 		</tr>
 		<?vsp
-		declare inx int;
+                    		declare inx integer;
 		inx := 0;
                     		for (select WAM_INST, WAM_HOME_PAGE from WA_MEMBER where WAM_APP_TYPE = self.wa_name and WAM_USER = self.u_id and WAM_MEMBER_TYPE = 1) do
 		   {
diff --git a/appsrc/ODS-Framework/oauth/default.css b/appsrc/ODS-Framework/oauth/default.css
index 8eee9aa..4dbec62 100644
--- a/appsrc/ODS-Framework/oauth/default.css
+++ b/appsrc/ODS-Framework/oauth/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.1 2008/12/05 09:44:05 source Exp $
+ *  $Id: default.css,v 1.1.2.1 2010/09/20 10:15:35 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Framework/oauth/error.vspx b/appsrc/ODS-Framework/oauth/error.vspx
index d40fd11..59ad67f 100644
--- a/appsrc/ODS-Framework/oauth/error.vspx
+++ b/appsrc/ODS-Framework/oauth/error.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: error.vspx,v 1.1 2008/12/05 09:44:05 source Exp $
+ -  $Id: error.vspx,v 1.1.2.1 2010/09/20 10:15:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/oauth/foaf_ssl.sql b/appsrc/ODS-Framework/oauth/foaf_ssl.sql
index e1aeb8d..7264010 100644
--- a/appsrc/ODS-Framework/oauth/foaf_ssl.sql
+++ b/appsrc/ODS-Framework/oauth/foaf_ssl.sql
@@ -34,6 +34,98 @@ create procedure FOAF_SSL_QR_BY_ACCOUNT (in gr varchar, in agent varchar)
 }
 ;
 
+create procedure FOAF_SSL_WEBID_GET (in cert any := null)
+{
+  declare agent, alts any;
+  agent := get_certificate_info (7, cert, 0, '', '2.5.29.17');
+  if (agent is not null)
+    {
+      alts := regexp_replace (agent, ',[ ]*', ',', 1, null);
+      alts := split_and_decode (alts, 0, '\0\0,:');
+      if (alts is null)
+	return null;
+      agent := get_keyword ('URI', alts);
+    }
+  return agent;
+}
+;
+
+create procedure FOAF_SSL_MAIL_GET (in cert any := null)
+{
+  declare alts, mail any;
+  mail := get_certificate_info (10, cert, 0, '', 'emailAddress');
+  if (mail is null)
+    {
+      alts := get_certificate_info (7, cert, 0, '', '2.5.29.17');
+      if (alts is not null)
+	{
+	  alts := regexp_replace (alts, ',[ ]*', ',', 1, null);
+	  alts := split_and_decode (alts, 0, '\0\0,:');
+	  mail := get_keyword ('email', alts);
+	}
+    }
+  return mail;
+}
+;
+
+
+--
+-- WHEN USE try_loading_webid must clear the graph named as webid
+-- 
+create procedure FOAF_SSL_WEBFINGER (in cert any := null, in try_loading_webid int := 0)
+{
+  declare mail, webid, domain, host_info, xrd, template, url any;
+  declare xt, xd, tmpcert any;
+
+  mail := FOAF_SSL_MAIL_GET (cert);
+  if (mail is null)
+    return null;
+
+  declare exit handler for sqlstate '*'
+    {
+      -- connection error or parse error
+      return null;
+    };
+
+  domain := subseq (mail, position ('@', mail));
+  host_info := http_get (sprintf ('http://%s/.well-known/host-meta', domain));
+  xd := xtree_doc (host_info);
+  template := cast (xpath_eval ('/XRD/Link[@rel="lrdd"]/@template', xd) as varchar);
+  url := replace (template, '{uri}', 'acct:' || mail);
+  xrd := http_get (url);
+  xd := xtree_doc (xrd);
+  xt := xpath_eval ('/XRD/Property[@type="certificate"]/@href', xd, 0);
+  foreach (any x in xt) do
+    {
+      x := cast (x as varchar);
+      tmpcert := http_get (x);
+      if (get_certificate_info (6, cert, 0, '') = get_certificate_info (6, tmpcert, 0, ''))
+	{
+	  webid := null;
+	  if (try_loading_webid)
+	    {
+	      declare hf, gr, graph, qr, stat, msg any;
+	  webid := cast (xpath_eval ('/XRD/Property[@type="webid"]/@href', xd) as varchar);
+	      hf := rfc1808_parse_uri (webid);
+	      hf[5] := '';
+	      gr := DB.DBA.vspx_uri_compose (hf);
+	      graph := uuid ();
+	      qr := sprintf ('sparql load <%S> into graph <%S>', gr, graph);
+	      stat := '00000';
+	      exec (qr, stat, msg);
+	      commit work;
+	      if (stat = '00000')
+		return graph;
+	      else
+		return null;
+	    }
+	  return coalesce (webid, 'acct:' || mail);
+	}
+    }
+  return null;
+}
+;
+
 create procedure DB.DBA.FOAF_MOD (in m any)
 {
   declare modulus any;
@@ -55,7 +147,6 @@ create procedure FOAF_SSL_AUTH_GEN (in realm varchar, in allow_nobody int := 0)
   declare agent varchar;
   declare acc int;
   acc := 0;
-
   declare exit handler for sqlstate '*'
     {
       rollback work;
@@ -63,18 +154,25 @@ create procedure FOAF_SSL_AUTH_GEN (in realm varchar, in allow_nobody int := 0)
     }
   ;
 
+  gr := uuid ();
   info := get_certificate_info (9);
   fing := get_certificate_info (6);
-  agent := get_certificate_info (7, null, null, null, '2.5.29.17');
-
-  if (not isarray (info) or agent is null)
-    return 0;
+  agent := FOAF_SSL_WEBID_GET ();
 
-  alts := regexp_replace (agent, ',[ ]*', ',', 1, null);
-  alts := split_and_decode (alts, 0, '\0\0,:');
-  if (alts is null)
+  if (not isarray (info))
     return 0;
-  agent := get_keyword ('URI', alts);
+  if (agent is null)
+    {
+      agent := FOAF_SSL_WEBFINGER ();
+      if (agent is not null)
+	{
+	  goto authenticated;
+	}
+      else
+	{
+	  agent := ODS..FINGERPOINT_WEBID_GET ();
+	}
+    }
   if (agent is null)
     return 0;
 
@@ -83,10 +181,8 @@ create procedure FOAF_SSL_AUTH_GEN (in realm varchar, in allow_nobody int := 0)
       connection_set ('SPARQLUserId', VS_UID);
       return 1;
     }
-
   hf := rfc1808_parse_uri (agent);
   hf[5] := '';
-  gr := uuid ();
   graph := DB.DBA.vspx_uri_compose (hf);
   qr := sprintf ('sparql load <%S> into graph <%S>', graph, gr);
   stat := '00000';
@@ -104,6 +200,7 @@ create procedure FOAF_SSL_AUTH_GEN (in realm varchar, in allow_nobody int := 0)
 	  if (_row[0] = cast (info[1] as varchar) and DB.DBA.FOAF_MOD (_row[1]) = bin2hex (info[2]))
     {
       declare arr, uid any;
+	      authenticated:
       uid := coalesce ((select FS_UID from FOAF_SSL_ACL where FS_URI = agent), 'nobody');
       if ('nobody' = uid and allow_nobody = 0)
 	goto err_ret;
@@ -191,9 +288,10 @@ create procedure FOAF_SSL_AUTH_ACL (in acl varchar, in realm varchar)
 {
   declare stat, msg, meta, data, info, qr, hf, graph, fing, gr, modulus, alts any;
   declare agent varchar;
-  declare acc, rc int;
+  declare acc, rc, wf int;
   acc := 0;
   rc := 0;
+  wf := 0;  -- authenticated via webfinger
   declare exit handler for sqlstate '*'
     {
       rollback work;
@@ -203,16 +301,15 @@ create procedure FOAF_SSL_AUTH_ACL (in acl varchar, in realm varchar)
 
   info := get_certificate_info (9);
   fing := get_certificate_info (6);
-  agent := get_certificate_info (7, null, null, null, '2.5.29.17');
+  agent := FOAF_SSL_WEBID_GET ();
 
   if (not isarray (info) or agent is null)
     return 0;
-
-  alts := regexp_replace (agent, ',[ ]*', ',', 1, null);
-  alts := split_and_decode (alts, 0, '\0\0,:');
-  if (alts is null)
-    return 0;
-  agent := get_keyword ('URI', alts);
+  if (agent is null)
+    {
+      agent := FOAF_SSL_WEBFINGER ();
+      wf := 1;
+    }
   if (agent is null)
     return 0;
 
@@ -226,9 +323,13 @@ create procedure FOAF_SSL_AUTH_ACL (in acl varchar, in realm varchar)
       return 1;
     }
 
+  gr := uuid ();
+
+  if (wf) 
+    goto authenticated;
+
   hf := rfc1808_parse_uri (agent);
   hf[5] := '';
-  gr := uuid ();
   graph := DB.DBA.vspx_uri_compose (hf);
   qr := sprintf ('sparql load <%S> into graph <%S>', graph, gr);
   stat := '00000';
@@ -244,6 +345,7 @@ create procedure FOAF_SSL_AUTH_ACL (in acl varchar, in realm varchar)
         {
 	  if (_row [0] = cast (info[1] as varchar) and DB.DBA.FOAF_MOD (_row [1]) = bin2hex (info[2]))
     {
+	      authenticated:
       insert into VSPX_SESSION (VS_SID, VS_REALM, VS_UID, VS_EXPIRY) values (fing, realm, 'nobody', now ());
       rc := 1;
       goto err_ret;
diff --git a/appsrc/ODS-Framework/oauth/login.vspx b/appsrc/ODS-Framework/oauth/login.vspx
index 07e562f..9fe1086 100644
--- a/appsrc/ODS-Framework/oauth/login.vspx
+++ b/appsrc/ODS-Framework/oauth/login.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: login.vspx,v 1.1 2008/12/05 09:44:05 source Exp $
+ -  $Id: login.vspx,v 1.1.2.2 2010/09/20 10:15:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -51,7 +51,7 @@
 	      <div id="login_form_ctr">
 		<v:template type="if-no-login" name="login_if_no_login">
 		  <div id="login_form">
-		    <label for="login_frm_username">Member ID</label>
+		    <label for="login_frm_username">User ID</label>
 		    <v:text xhtml_id="login_frm_username" name="username" value=""/><br/>
 		    <label for="password">Password</label>
 		    <v:text xhtml_id="login_frm_password" name="password" value="" type="password"/><br/>
diff --git a/appsrc/ODS-Framework/oauth/make_vad.sh b/appsrc/ODS-Framework/oauth/make_vad.sh
index dd81b6f..0b4ab7f 100755
--- a/appsrc/ODS-Framework/oauth/make_vad.sh
+++ b/appsrc/ODS-Framework/oauth/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.7.2.2 2010/01/07 16:55:13 source Exp $
+#  $Id: make_vad.sh,v 1.7.2.4 2011/02/03 10:26:15 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -252,7 +252,7 @@ sticker_init() {
   echo "  <name package=\"$VAD_NAME\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"$VAD_DESC\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
diff --git a/appsrc/ODS-Framework/oauth/oauth.sql b/appsrc/ODS-Framework/oauth/oauth.sql
index 8230836..960bd8d 100644
--- a/appsrc/ODS-Framework/oauth/oauth.sql
+++ b/appsrc/ODS-Framework/oauth/oauth.sql
@@ -1,5 +1,5 @@
 --
---  $Id: oauth.sql,v 1.2.2.1 2009/12/24 13:52:08 source Exp $
+--  $Id: oauth.sql,v 1.2.2.4 2010/09/20 10:15:35 source Exp $
 --
 --  OAuth protocol support.
 --
@@ -275,6 +275,37 @@ create procedure OAUTH..request_token (
 }
 ;
 
+create procedure OAUTH..hybrid_request_token (in sid varchar, in oauth_consumer_key varchar)
+{
+  declare ret, tok, sec varchar;
+  declare app_sec, url, meth, params, cookie, oauth_client_ip, timest, nonce varchar;
+  declare lines any;
+  declare app_id int;
+
+  declare exit handler for not found {
+    signal ('22023', 'Can not verify request, missing oauth_consumer_key or oauth_token');
+  };
+
+  select a_secret, a_id into app_sec, app_id from OAUTH..APP_REG where a_key = oauth_consumer_key;
+
+  url := get_requested_url ();
+  params := http_request_get ('QUERY_STRING');
+  meth := http_request_get ('REQUEST_METHOD');
+
+  get_key_and_secret (tok, sec);
+  sec := '';
+
+  oauth_client_ip := http_client_ip ();
+  timest := datediff ('second', stringdate ('1970-1-1'), now ());
+  nonce := xenc_rand_bytes (8, 1);
+
+  insert into OAUTH..SESSIONS (s_sid, s_nonce, s_timestamp, s_req_key, s_req_secret, s_a_id, s_method, s_state, s_ip)
+    values (sid, nonce, timest, tok, sec, app_id, meth, 2, oauth_client_ip);
+  commit work;
+  return tok;
+}
+;
+
 create procedure OAUTH..access_token (
   in oauth_consumer_key varchar,
   in oauth_token varchar,
@@ -554,7 +585,7 @@ create procedure OAUTH..parse_response (in sid any := null, in consumer_key varc
 }
 ;
 
-create procedure OAUTH..sign_request (in meth varchar := 'GET', in url varchar, in params varchar := '', in consumer_key varchar, in sid varchar := null) __SOAP_HTTP 'text/plain'
+create procedure OAUTH..sign_request (in meth varchar := 'GET', in url varchar, in params varchar := '', in consumer_key varchar, in sid varchar := null, in tz int := 0) __SOAP_HTTP 'text/plain'
 {
   declare signature, timest, nonce varchar;
   declare ret varchar;
@@ -562,6 +593,8 @@ create procedure OAUTH..sign_request (in meth varchar := 'GET', in url varchar,
 
   nonce := xenc_rand_bytes (8, 1);
   timest := datediff ('second', stringdate ('1970-1-1'), now ());
+  if (tz)
+    timest := timest - timezone (now()) * 60; 
   if (length (params) and params not like '%&')
     params := params || '&';
 
@@ -590,7 +623,7 @@ create procedure OAUTH..sign_request (in meth varchar := 'GET', in url varchar,
 }
 ;
 
-create procedure OAUTH..signed_request_header (in meth varchar := 'GET', in url varchar, in params varchar := '', in consumer_key varchar, in oauth_secret varchar := '', in sid varchar := null) __SOAP_HTTP 'text/plain'
+create procedure OAUTH..signed_request_header (in meth varchar := 'GET', in url varchar, in params varchar := '', in consumer_key varchar, in oauth_secret varchar := '', in sid varchar := null, in tz int := 0) __SOAP_HTTP 'text/plain'
 {
   declare signature, timest, nonce varchar;
   declare ret varchar;
@@ -600,6 +633,8 @@ create procedure OAUTH..signed_request_header (in meth varchar := 'GET', in url
 
   nonce := xenc_rand_bytes (8, 1);
   timest := datediff ('second', stringdate ('1970-1-1'), now ()) - (timezone (now()) * 60);
+  if (tz)
+    timest := timest - timezone (now()) * 60; 
   if (length (params) and params not like '%&')
     params := params || '&';
 
@@ -616,7 +651,7 @@ create procedure OAUTH..signed_request_header (in meth varchar := 'GET', in url
     params := hf[4] || '&' || params;
   params := OAUTH..normalize_params (params);
   url := OAUTH..normalize_url (url, vector ());
-  dbg_obj_print (params);
+  --dbg_obj_print (params);
 
   declare exit handler for not found {signal ('OAUTH', 'Cannot find secret');};
   select a_secret into consumer_secret from OAUTH..APP_REG where a_key = consumer_key;
@@ -632,7 +667,7 @@ create procedure OAUTH..signed_request_header (in meth varchar := 'GET', in url
 	 ret := ret || ' ' || arr[inx] || '="' || sprintf ('%U', arr[inx+1]) || '"' || ','; 
      }
   ret := rtrim (ret, ',');   
-  dbg_obj_print (ret);
+  --dbg_obj_print (ret);
   return ret;
 }
 ;
diff --git a/appsrc/ODS-Framework/oauth/oauth_apps.vspx b/appsrc/ODS-Framework/oauth/oauth_apps.vspx
index dec4bf5..c4c49f1 100644
--- a/appsrc/ODS-Framework/oauth/oauth_apps.vspx
+++ b/appsrc/ODS-Framework/oauth/oauth_apps.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: oauth_apps.vspx,v 1.1.2.1 2010/01/07 16:55:13 source Exp $
+ -  $Id: oauth_apps.vspx,v 1.1.2.2 2010/09/20 10:15:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/oauth/oauth_authorize.vspx b/appsrc/ODS-Framework/oauth/oauth_authorize.vspx
index eac7790..ccc1c71 100644
--- a/appsrc/ODS-Framework/oauth/oauth_authorize.vspx
+++ b/appsrc/ODS-Framework/oauth/oauth_authorize.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: oauth_authorize.vspx,v 1.1.2.1 2010/01/07 16:55:13 source Exp $
+ -  $Id: oauth_authorize.vspx,v 1.1.2.3 2010/09/20 10:15:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -140,7 +140,7 @@
 		  </h2>
               <div id="login_form">
                 <form> <!-- just to keep validator happy on this mockup -->
-		  <label for="login_frm_username">Member ID</label>
+		  <label for="login_frm_username">User ID</label>
 		  <v:text name="username" type="hidden" value="--self._uname" xhtml_id="login_frm_username" /><?V self._uname ?><br />
 		  <label for="password">Password</label>
 		  <v:text name="password" value="" xhtml_id="login_frm_password" type="password" />
diff --git a/appsrc/ODS-Framework/oauth/oauth_error.vspx b/appsrc/ODS-Framework/oauth/oauth_error.vspx
index c01a98d..66b54b6 100644
--- a/appsrc/ODS-Framework/oauth/oauth_error.vspx
+++ b/appsrc/ODS-Framework/oauth/oauth_error.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: oauth_error.vspx,v 1.1 2008/12/05 09:44:05 source Exp $
+ -  $Id: oauth_error.vspx,v 1.1.2.1 2010/09/20 10:15:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/oauth/sel_user.vspx b/appsrc/ODS-Framework/oauth/sel_user.vspx
index ad1854d..8db41de 100644
--- a/appsrc/ODS-Framework/oauth/sel_user.vspx
+++ b/appsrc/ODS-Framework/oauth/sel_user.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!--
  -
- -  $Id: sel_user.vspx,v 1.1 2009/03/18 09:33:23 source Exp $
+ -  $Id: sel_user.vspx,v 1.1.2.1 2010/09/20 10:15:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/oauth/sparql_acl.vspx b/appsrc/ODS-Framework/oauth/sparql_acl.vspx
index ecd90ed..e0b79d7 100644
--- a/appsrc/ODS-Framework/oauth/sparql_acl.vspx
+++ b/appsrc/ODS-Framework/oauth/sparql_acl.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sparql_acl.vspx,v 1.3.2.3 2010/01/07 16:55:13 source Exp $
+ -  $Id: sparql_acl.vspx,v 1.3.2.4 2010/09/20 10:15:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/oauth/vad_version b/appsrc/ODS-Framework/oauth/vad_version
index ed453e6..01c08cf 100644
--- a/appsrc/ODS-Framework/oauth/vad_version
+++ b/appsrc/ODS-Framework/oauth/vad_version
@@ -1 +1 @@
-1.0.56
+1.0.68
diff --git a/appsrc/ODS-Framework/oauth_apps.vspx b/appsrc/ODS-Framework/oauth_apps.vspx
index 444fb93..e684796 100644
--- a/appsrc/ODS-Framework/oauth_apps.vspx
+++ b/appsrc/ODS-Framework/oauth_apps.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: oauth_apps.vspx,v 1.3 2008/07/02 07:31:10 source Exp $
+ -  $Id: oauth_apps.vspx,v 1.3.2.2 2011/03/08 13:28:14 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -62,7 +62,7 @@
 		  <th>Application</th>
 		  <th>Token</th>
 		  <th>Secret</th>
-		  <th>Action</th>
+                		  <th width="5%">Action</th>
 	      </tr>
 	      <v:data-set name="oauth" sql="select a_id, a_name, a_descr, a_key, a_secret, a_url, a_cb_url, a_status
 		  from OAUTH.DBA.APP_REG where a_owner = :self.u_id"
@@ -94,12 +94,13 @@ if (not e.ve_is_post and self.del_oauth is not null)
 				      format="%s" render-only="1"/>
 
 			      </td>
-			      <td>
-				  <v:url name="ur2" value='<img src="images/icons/del_16.png" hspace="3" border="0"/>Delete'
+                			    <td nowrap="nowrap">
+                				    <v:url name="ur2" value='<img src="images/icons/trash_16.png" hspace="3" border="0"/>Delete'
 				      format="%s"
 				      url="--sprintf ('oauth_apps.vspx?del=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
 				      xhtml_title="Delete"
 				      xhtml_alt="Delete"
+                				      xhtml_class="img_button"
 				      />
 			      </td>
 			  </tr>
diff --git a/appsrc/ODS-Framework/oauth_sid.vsp b/appsrc/ODS-Framework/oauth_sid.vsp
index 23dcc4c..fdebdd1 100644
--- a/appsrc/ODS-Framework/oauth_sid.vsp
+++ b/appsrc/ODS-Framework/oauth_sid.vsp
@@ -146,7 +146,7 @@
           <a href="/ods/privacy.html">Privacy</a> |
           <a href="/ods/rabuse.vspx">Report Abuse</a>
           <div class="copyright">
-            Copyright © 1998-2010 OpenLink Software
+            Copyright © 1998-2011 OpenLink Software
           </div>
         </div>
       </div>
diff --git a/appsrc/ODS-Framework/ods_api.sql b/appsrc/ODS-Framework/ods_api.sql
index 686eb69..a12c15c 100644
--- a/appsrc/ODS-Framework/ods_api.sql
+++ b/appsrc/ODS-Framework/ods_api.sql
@@ -18,7 +18,7 @@
 --  in inst_name varchar,         -- desired name for the instance
 --  in owner varchar,             -- username of the owner of the instance
 --  in model int := 0,            -- refers to Membership model (Open,Closed,Invitation only,Approval based
---  in pub int := 1,              -- refers to Visible to public property
+--  in pub int := 0,              -- refers to Visible to public property
 --  in inst_descr varchar := null -- description for the instance
 --
 -- result is INTEGER (instance id)if successful, otherwise varchar - ERROR MESSAGE
@@ -313,7 +313,7 @@ create procedure ODS_CREATE_USER (
                  'SQL_ENABLE', 0));
    update SYS_USERS set U_ACCOUNT_DISABLED = _mail_verify_on where U_ID = uid;
    DAV_MAKE_DIR ('/DAV/home/', http_dav_uid (), http_admin_gid (), '110100100R');
-   DAV_MAKE_DIR ('/DAV/home/' || _username || '/', uid, http_nogroup_gid (), '110100100R');
+  DAV_MAKE_DIR ('/DAV/home/' || _username || '/', uid, http_nogroup_gid (), '110100000R');
 
   declare _det_col_id integer;
   _det_col_id := DB.DBA.DAV_MAKE_DIR ('/DAV/home/'||_username||'/RDFData/', uid, http_nogroup_gid (), '110100100N');
@@ -437,8 +437,8 @@ create procedure ODS_CREATE_NEW_APP_INST (
   in app_type varchar,
   in inst_name varchar,
   in owner varchar,
-  in model int := null,
-  in pub int := null,
+  in model integer := 1,
+  in pub integer := 0,
   in inst_descr varchar := null)
 {
   declare inst web_app;
@@ -485,10 +485,6 @@ create procedure ODS_CREATE_NEW_APP_INST (
           };
    select WAT_TYPE into ty from WA_TYPES where WAT_NAME = app_type;
   }
-  if (isnull (model))
-    model := case when app_type in ('oDrive', 'oMail', 'IM') then 1 else 0 end;
-  if (isnull (pub))
-    pub := case when app_type in ('oDrive', 'oMail', 'IM') then 0 else 1 end;
   visible := case when app_type in ('oDrive', 'oMail', 'IM') then 0 else 1 end;
 
   inst := __udt_instantiate_class (fix_identifier_case (ty), 0);
@@ -552,10 +548,23 @@ create procedure ODS_CREATE_NEW_APP_INST (
        goto relaxing;
      };
     if (app_type <> 'oWiki')
+    {
    lpath := DB.DBA.wa_set_url_t (inst);
-    if (app_type = 'oWiki')
+      if ((lpath like '%.vspx') or (lpath like '%.vsp'))
+      {
+        declare pos integer;
+
+        pos := strrchr (lpath, '/');
+        if (not isnull (pos))
+          lpath := subseq (lpath, 0, pos);
+      }
+    }
+    else if (app_type = 'oWiki')
+    {
       DB.DBA.WA_SET_APP_URL (id, lpath, null, '{Default Domain}', null, null, null, 1);
+    }
    DB.DBA.WA_SET_APP_URL (id, lpath, null, DB.DBA.wa_default_domain (), null, null, null, 1);
+    if (app_type <> 'oMail')
    DB.DBA.WA_SET_APP_URL (id, lpath, null, '{Default HTTPS}', null, null, null, 1);
  }
 relaxing:
@@ -814,7 +823,7 @@ create procedure ODS..openid_url_set (
   in uid integer,
   in url varchar)
 {
-  declare oi_ident, hdr, cnt, xt, oi_srv, oi2_srv, oi_delegate any;
+  declare oi_ident, hdr, cnt, xt, oi_srv, oi2_srv, oi_delegate, profile_page, xrds, xrds_url any;
 
   declare exit handler for sqlstate '*'
     {
@@ -828,6 +837,15 @@ create procedure ODS..openid_url_set (
       goto clear_auth;
     }
 
+  profile_page := ODS.DBA.WF_PROFILE_GET (url);
+  if (profile_page is not null)
+    url := profile_page;
+  else  
+    {
+      profile_page := ODS..FINGERPOINT_WEBID_GET (null, url);
+      if (profile_page is not null)
+	url := profile_page;
+    }
   oi_ident := url;
 again:
   hdr := null;
@@ -844,16 +862,30 @@ again:
   oi_srv := cast (xpath_eval ('//link[contains (@rel, "openid.server")]/@href', xt) as varchar);
   oi2_srv := cast (xpath_eval ('//link[contains (@rel, "openid2.provider")]/@href', xt) as varchar);
   oi_delegate := cast (xpath_eval ('//link[contains (@rel, "openid.delegate")]/@href', xt) as varchar);
+  xrds_url := http_request_header (hdr, 'X-XRDS-Location');
 
   if (oi2_srv is not null)
     oi_srv := oi2_srv;
 
+  if (oi_srv is null and xrds_url is not null)
+    {
+       xrds := http_client (xrds_url, n_redirects=>15);
+       xrds := xtree_doc (xrds);
+       oi_srv := cast (xpath_eval ('/XRDS/XRD/Service[Type/text() = "http://specs.openid.net/auth/2.0/signon"]/URI/text()', xrds) as varchar);
+    }
+
   if (oi_srv is null)
     return 'Cannot locate OpenID server.';
 
   if (oi_delegate is not null)
     oi_ident := oi_delegate;
 
+  -- if we want to change OpenID URI to local we would get same as it is will find delegate
+  if (exists (select 1 from WA_USER_INFO where WAUI_OPENID_URL = oi_ident and WAUI_U_ID = uid))
+    {
+      oi_ident := url;
+    }
+
   if (exists (select 1 from WA_USER_INFO where WAUI_OPENID_URL = oi_ident and WAUI_U_ID <> uid))
     return 'This OpenID identity is already registered.';
 
diff --git a/appsrc/ODS-Framework/ods_bar.vspx b/appsrc/ODS-Framework/ods_bar.vspx
index ad8ffc4..d9dab29 100644
--- a/appsrc/ODS-Framework/ods_bar.vspx
+++ b/appsrc/ODS-Framework/ods_bar.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: ods_bar.vspx,v 1.4 2008/10/31 16:07:19 source Exp $
+ -  $Id: ods_bar.vspx,v 1.4.2.1 2010/09/20 10:15:23 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/ods_controllers.sql b/appsrc/ODS-Framework/ods_controllers.sql
index 10e9584..f179ed4 100644
--- a/appsrc/ODS-Framework/ods_controllers.sql
+++ b/appsrc/ODS-Framework/ods_controllers.sql
@@ -1,5 +1,5 @@
 --
---  $Id: ods_controllers.sql,v 1.19.2.42 2010/07/05 08:26:09 source Exp $
+--  $Id: ods_controllers.sql,v 1.19.2.61 2011/03/26 14:22:25 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -164,6 +164,15 @@ create procedure check_authentication_ssl (
 }
 ;
 
+create procedure normalize_url_like_browser (in x varchar)
+{
+  declare h any;
+  h := rfc1808_parse_uri (x);
+  h [5] := '';
+  return DB.DBA.vspx_uri_compose (h);
+}
+;
+
 create procedure get_ses (in uname varchar)
 {
   declare params, lines any;
@@ -278,6 +287,12 @@ create procedure isJsonObject (inout o any)
 }
 ;
 
+create procedure array2obj (in V any)
+{
+  return vector_concat (jsonObject (), V);
+}
+;
+
 create procedure obj2json (
   in o any,
   in d integer := 10,
@@ -331,7 +346,7 @@ create procedure obj2json (
   	        S := subseq (S, length (nsArray[M])+1);
         }
   	  }
-  	  retValue := retValue || S || ':' || obj2json (o[N+1], d-1, nsArray, attributePrefix);
+  	  retValue := retValue || '"' || S || '":' || obj2json (o[N+1], d-1, nsArray, attributePrefix);
   	  if (N <> length(o)-2)
   		  retValue := retValue || ', ';
   	}
@@ -436,19 +451,7 @@ create procedure obj2xml (
 
 create procedure params2json (in o any)
 {
-  declare N integer;
-  declare retValue any;
-
-	retValue := '{';
-	for (N := 0; N < length(o); N := N + 2)
-	{
-	  retValue := retValue || o[N] || ':' || obj2json (o[N+1]);
-	  if (N <> length(o)-2)
-		  retValue := retValue || ', ';
-	}
-	retValue := retValue || '}';
-
-	return retValue;
+  return obj2json (array2obj(o));
 }
 ;
 
@@ -483,17 +486,66 @@ create procedure dav_path_normalize (
 }
 ;
 
+-- QRCode
+create procedure ODS.ODS_API."make_curie" (
+  in url varchar) __soap_http 'text/plain'
+{
+  if (__proc_exists ('WS.CURI.curi_make_curi') is null)
+    return url;
+
+  declare curie, chost, dhost varchar;
+  declare lines any;
+
+  lines := http_request_header ();
+  curie := WS.CURI.curi_make_curi (url);
+  dhost := registry_get ('URIQADefaultHost');
+  chost := http_request_header(lines, 'Host', null, dhost);
+
+  return sprintf ('http://%s/c/%s', chost, curie);
+}
+;
+
+create procedure ODS.ODS_API."qrcode" (
+  in data any,
+  in width int := 120,
+  in height int := 120,
+  in scale int := 4) __soap_http 'text/plain'
+{
+  declare qrcode_bytes, mixed_content, content varchar;
+  declare qrcode any;
+
+  if (__proc_exists ('QRcode encodeString8bit', 2) is null)
+    return null;
+
+  declare exit handler for sqlstate '*' { return null; };
+
+  content := "IM CreateImageBlob" (width, height, 'white', 'jpg');
+  qrcode := "QRcode encodeString8bit" (data);
+  qrcode_bytes := aref_set_0 (qrcode, 0);
+  mixed_content := "IM PasteQRcode" (qrcode_bytes, qrcode[1], qrcode[2], scale, scale, 0, 0, cast (content as varchar), length (content));
+  mixed_content := encode_base64 (cast (mixed_content as varchar));
+  mixed_content := replace (mixed_content, '\r\n', '');
+
+  return mixed_content;
+}
+;
+
 -- Ontology Info
 create procedure ODS.ODS_API."ontology.classes" (
-  in ontology varchar) __soap_http 'application/json'
+  in ontology varchar,
+  in dependentOntology varchar := null) __soap_http 'application/json'
 {
   declare S, data any;
-  declare tmp, classes, retValue any;
+  declare tmp, classes, retValue, dependency any;
 
   set_user_id ('dba');
   -- load ontology
   ODS.ODS_API."ontology.load" (ontology, 0);
 
+  dependency := '';
+  if (not isnull (dependentOntology))
+    dependency := sprintf (' || (str(?sc) like "%s%%")', dependentOntology);
+
   -- select classes ontology
   classes := vector ();
   S := sprintf(
@@ -509,7 +561,7 @@ create procedure ODS.ODS_API."ontology.classes" (
          '\n          OPTIONAL ' ||
          '\n          { ' ||
          '\n            ?c rdfs:subClassOf ?sc .' ||
-         '\n            filter ((str(?sc) = \'\') || ((str(?sc) like "%s%%") && not (str(?sc) like "nodeID://%%"))).' ||
+         '\n              filter ((str(?sc) = \'\') || (((str(?sc) like "%s%%")%s) && not (str(?sc) like "nodeID://%%"))).' ||
          '\n          }.' ||
          '\n          filter (str(?c) like "%s%%").' ||
          '\n        }' ||
@@ -519,7 +571,7 @@ create procedure ODS.ODS_API."ontology.classes" (
          '\n            OPTIONAL ' ||
          '\n            { ' ||
          '\n              ?c rdfs:subClassOf ?sc .' ||
-         '\n              filter ((str(?sc) = \'\') || ((str(?sc) like "%s%%") && not (str(?sc) like "nodeID://%%"))).' ||
+         '\n              filter ((str(?sc) = \'\') || (((str(?sc) like "%s%%")%s) && not (str(?sc) like "nodeID://%%"))).' ||
          '\n            }.' ||
          '\n            filter (str(?c) like "%s%%").' ||
          '\n          }' ||
@@ -527,8 +579,10 @@ create procedure ODS.ODS_API."ontology.classes" (
          '\n  ORDER BY ?c ?sc',
          ontology,
          ontology,
+         dependency,
          ontology,
          ontology,
+         dependency,
          ontology);
   data := ODS.ODS_API."ontology.sparql" (S);
   foreach (any item in data) do
@@ -561,7 +615,7 @@ create procedure ODS.ODS_API."ontology.classProperties" (
          '\n SELECT ?p ?t ?r1' ||
          '\n   FROM <%s>' ||
          '\n  WHERE {' ||
-         '\n          {?p a owl:ObjectProperty} UNION {?p a owl:DatatypeProperty} .' ||
+         '\n          {?p a owl:ObjectProperty} UNION {?p a owl:DatatypeProperty} UNION {?p a owl:Property} .' ||
          '\n          ?p rdf:type ?t .' ||
          '\n          optional {?p rdfs:range ?r1} .' ||
          '\n            {' ||
@@ -608,7 +662,8 @@ create procedure ODS.ODS_API."ontology.classProperties" (
           properties := vector_concat (properties, vector (ODS.ODS_API."ontology.objectProperty" (property)));
       property := vector (item[0], vector (), vector ());
     }
-    if (ODS.ODS_API."ontology.normalize"(item[1]) = 'owl:ObjectProperty')
+    tmp := ODS.ODS_API."ontology.normalize"(item[1]);
+    if (tmp = 'owl:ObjectProperty')
     {
       tmp := ODS.ODS_API."ontology.normalize"(item[2]);
       if (tmp not like 'nodeID:%')
@@ -618,7 +673,7 @@ create procedure ODS.ODS_API."ontology.classProperties" (
         property[1] := vector_concat (property[1], ODS.ODS_API."ontology.collection" (ontology, tmp));
       }
     }
-    if (ODS.ODS_API."ontology.normalize"(item[1]) = 'owl:DatatypeProperty')
+    else if (tmp = 'owl:DatatypeProperty')
     {
       property[2] := vector_concat (property[2], vector (ODS.ODS_API."ontology.normalize" (coalesce (item[2], 'xsd:string'))));
     }
@@ -735,12 +790,14 @@ create procedure ODS.ODS_API."ontology.array" ()
                  'gr',   'http://purl.org/goodrelations/v1#',
                  'ibis', 'http://purl.org/ibis#',
                  'ical', 'http://www.w3.org/2002/12/cal/icaltzd#',
+                 'like', 'http://ontologi.es/like#',
                  'mo',   'http://purl.org/ontology/mo/',
                  'movie','http://www.csd.abdn.ac.uk/~ggrimnes/dev/imdb/IMDB#',
                  'owl',  'http://www.w3.org/2002/07/owl#',
                  'rdf',  'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
                  'rdfs', 'http://www.w3.org/2000/01/rdf-schema#',
                  'rel',  'http://purl.org/vocab/relationship/',
+                 'rev',  'http://purl.org/stuff/rev#',
                  'sioc', 'http://rdfs.org/sioc/ns#',
                  'sioct','http://rdfs.org/sioc/types#',
                  'xsd',  'http://www.w3.org/2001/XMLSchema#'
@@ -869,7 +926,8 @@ _again:
 
 create procedure ODS.ODS_API."lookup.list" (
   in "key" varchar,
-  in "param" varchar := '')  __soap_http 'text/plain'
+  in "param" varchar := '',
+  in "depend" varchar := '')  __soap_http 'text/plain'
 {
   if ("key" = 'onlineAccounts')
   {
@@ -937,6 +995,34 @@ create procedure ODS.ODS_API."lookup.list" (
       || '\n'|| 'Zooomr'
     );
   }
+  else if ("key" = 'webIDs')
+  {
+    declare uname, S varchar;
+
+    S := '';
+    if (ods_check_auth (uname))
+    {
+      declare uid integer;
+      declare paramTest varchar;
+      declare sql, st, msg, meta, rows any;
+
+      uid := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+      paramTest := '';
+      if ("param" <> '')
+        paramTest := sprintf (' and a.P_IRI like ''%%%s%%''', "param");
+
+      sql := sprintf ('select ''Person'' F1, a.P_IRI F2, a.P_NAME F3 from AB.WA.PERSONS a, DB.DBA.WA_MEMBER b, DB.DBA.WA_INSTANCE c where a.P_DOMAIN_ID = c.WAI_ID and c.WAI_TYPE_NAME = ''AddressBook'' and c.WAI_NAME = b.WAM_INST and B.WAM_MEMBER_TYPE = 1 and b.WAM_USER = %d and DB.DBA.is_empty_or_null (a.P_IRI) <> 1 %s', uid, paramTest);
+      set_user_id ('dba');
+      st := '00000';
+      exec (sql, st, msg, vector (), 0, meta, rows);
+      if (st = '00000')
+      {
+        foreach (any row in rows) do
+          S := S || case when S <> '' then '\n' else '' end || row[1];
+      }
+    }
+    http (S);
+  }
   else if ("key" = 'Industry')
   {
     http ('<items>');
@@ -1011,6 +1097,40 @@ create procedure ODS.ODS_API."lookup.list" (
 }
 ;
 
+create procedure ODS..getDefaultHttps ()
+{
+  declare host, port, tmp varchar;
+  host := null; port := null;
+  for select top 1 HP_HOST, HP_LISTEN_HOST from  DB.DBA.HTTP_PATH, DB.DBA.WA_DOMAINS
+    where HP_PPATH like '/DAV/VAD/wa/%' and WD_HOST = HP_HOST and WD_LISTEN_HOST = HP_LISTEN_HOST
+	and WD_LPATH = HP_LPATH and HP_HOST not like '*sslini*' and HP_SECURITY = 'SSL' and length (HP_HOST) do
+	 {
+	    tmp := split_and_decode (HP_LISTEN_HOST, 0, '\0\0:');
+	    if (length (tmp) = 2)
+	      tmp := tmp[1];
+	    else
+	      tmp := HP_LISTEN_HOST;
+	    host := HP_HOST;
+	    port := tmp;  
+	    if (port <> '443')
+	      host := host || ':' || port;
+	 }
+  if (server_https_port () is not null and host is null)
+    {
+      host := registry_get ('URIQADefaultHost');
+      tmp := split_and_decode (host, 0, '\0\0:');
+      if (length (tmp) = 2)
+	tmp := tmp[0];
+      else
+	tmp := host;
+      port := server_https_port (); 
+      if (port <> '443')
+	host := host || ':' || port;
+    }
+  return host;
+}
+;
+
 -- Server Info
 create procedure ODS.ODS_API."server.getInfo" (
   in info varchar) __soap_http 'application/json'
@@ -1041,12 +1161,29 @@ create procedure ODS.ODS_API."server.getInfo" (
   }
   else if (info = 'regData')
   {
-    for (select TOP 1 WS_REGISTER, WS_REGISTER_OPENID, WS_REGISTER_FACEBOOK, WS_REGISTER_SSL, WS_REGISTER_AUTOMATIC_SSL from DB.DBA.WA_SETTINGS) do
+    for (select TOP 1 WS_REGISTER, WS_REGISTER_OPENID, WS_REGISTER_FACEBOOK, WS_REGISTER_TWITTER, WS_REGISTER_LINKEDIN, WS_REGISTER_SSL, WS_REGISTER_AUTOMATIC_SSL from DB.DBA.WA_SETTINGS) do
     {
+      declare facebookEnable, twitterEnable, linkedinEnable integer;
+      declare facebookOptions any;
+
+      facebookEnable := WS_REGISTER_FACEBOOK;
+      if ((facebookEnable = 1) and (not DB.DBA._get_ods_fb_settings (facebookOptions)))
+        facebookEnable := 0;
+
+      twitterEnable := WS_REGISTER_TWITTER;
+      if ((twitterEnable = 1) and (not exists (select 1 from OAUTH.DBA.APP_REG where a_owner = 0 and a_name = 'Twitter API')))
+        twitterEnable := 0;
+
+      linkedinEnable := WS_REGISTER_LINKEDIN;
+      if ((linkedinEnable = 1) and (not exists (select 1 from OAUTH.DBA.APP_REG where a_owner = 0 and a_name = 'LinkedIn API')))
+        linkedinEnable := 0;
+
   	  retValue := vector (
   	                      'register', WS_REGISTER,
   	                      'openidEnable', WS_REGISTER_OPENID,
-  	                      'facebookEnable', WS_REGISTER_FACEBOOK,
+  	                      'facebookEnable', facebookEnable,
+  	                      'twitterEnable', twitterEnable,
+  	                      'linkedinEnable', linkedinEnable,
   	                      'sslEnable', WS_REGISTER_SSL,
   	                      'sslAutomaticEnable', WS_REGISTER_AUTOMATIC_SSL
   	                     );
@@ -1080,7 +1217,7 @@ create procedure ODS.ODS_API."address.geoData" (
         lng
     ))
   {
-    retValue := vector ('lat', lat, 'lng', lng);
+    retValue := vector ('lat', sprintf ('%.6f', coalesce (lat, 0.00)), 'lng', sprintf ('%.6f', coalesce (lng, 0.00)));
   }
   return params2json (retValue);
 }
@@ -1099,7 +1236,7 @@ create procedure ODS.ODS_API."user.register" (
 	in mode integer := 0,
 	in data any := null) __soap_http 'text/xml'
 {
-  declare sid, rc any;
+  declare sid, rc, xmlData any;
   declare exit handler for sqlstate '*'
   {
     rollback work;
@@ -1117,7 +1254,7 @@ create procedure ODS.ODS_API."user.register" (
 	}
 	else if (mode = 2)
 	{
-	  -- facebook
+	  -- Facebook
 	  data := json_parse (data);
     name := DB.DBA.WA_MAKE_NICK (coalesce (get_keyword ('nick', data), replace (get_keyword ('name', data), ' ', '')));
     "email" := null;
@@ -1133,6 +1270,24 @@ create procedure ODS.ODS_API."user.register" (
     "email" := get_keyword ('mbox', data);
     "password" := uuid ();
 	}
+	else if (mode = 4)
+	{
+	  -- Twitter
+    xmlData := xml_tree_doc (data);
+    if (xpath_eval ('string(/users/user/id)', xmlData))
+      name := cast (xpath_eval ('string(/users/user/screen_name)', xmlData) as varchar);
+
+    "password" := uuid ();
+	}
+	else if (mode = 5)
+	{
+	  -- LinkedIn
+    xmlData := xml_tree_doc (data);
+    if (xpath_eval ('string(/person/first-name)', xmlData))
+      name := cast (xpath_eval ('string(/person/first-name)', xmlData) as varchar);
+
+    "password" := uuid ();
+	}
   if (name is null or length (name) < 1 or length (name) > 20)
     signal ('23023', 'Login name cannot be empty or longer then 20 chars');
 
@@ -1156,7 +1311,7 @@ create procedure ODS.ODS_API."user.register" (
   if ((mode = 1) and get_keyword ('openid_url', data) is not null and exists (select 1 from DB.DBA.WA_USER_INFO where WAUI_OPENID_URL = get_keyword ('openid_url', data)))
     signal ('23023', 'This OpenID identity is already registered.');
 
-  if ((mode = 2) and exists (select 1 from DB.DBA.WA_USER_INFO where WAUI_FACEBOOK_LOGIN_ID = get_keyword ('uid', data)))
+  if ((mode = 2) and exists (select 1 from DB.DBA.WA_USER_INFO where WAUI_FACEBOOK_ID = get_keyword ('uid', data)))
     signal ('23023', 'This Facebook identity is already registered.');
 
   rc := DB.DBA.ODS_CREATE_USER (name, "password", "email");
@@ -1183,7 +1338,7 @@ create procedure ODS.ODS_API."user.register" (
     DB.DBA.WA_USER_EDIT (name, 'WAUI_FIRST_NAME'   , get_keyword ('firstName', data));
     DB.DBA.WA_USER_EDIT (name, 'WAUI_LAST_NAME'    , get_keyword ('family_name', data));
     DB.DBA.WA_USER_EDIT (name, 'WAUI_GENDER'       , get_keyword ('gender', data));
-    DB.DBA.WA_USER_EDIT (name, 'WAUI_FACEBOOK_LOGIN_ID', get_keyword ('uid', data));
+    DB.DBA.WA_USER_EDIT (name, 'WAUI_FACEBOOK_ID', get_keyword ('uid', data));
   }
   else if (mode = 3)
   {
@@ -1204,13 +1359,26 @@ create procedure ODS.ODS_API."user.register" (
     DB.DBA.WA_USER_EDIT (name, 'WAUI_BORG_HOMEPAGE', get_keyword ('organizationHomepage', data));
     DB.DBA.WA_USER_EDIT (name, 'WAUI_BORG'         , get_keyword ('organizationTitle', data));
     DB.DBA.WA_USER_EDIT (name, 'WAUI_FOAF'         , get_keyword ('iri', data));
-    --DB.DBA.WA_USER_EDIT (name, 'WAUI_CERT'         , client_attr ('client_certificate'));
-    --DB.DBA.WA_USER_EDIT (name, 'WAUI_CERT_LOGIN'   , 1);
+
     declare cert any;
     cert := client_attr ('client_certificate');
     insert into DB.DBA.WA_USER_CERTS (UC_U_ID, UC_CERT, UC_FINGERPRINT, UC_LOGIN) 
 	values (rc, cert, get_certificate_info (6, cert, 0, ''), 1);
   }
+  else if (mode = 4)
+  {
+    DB.DBA.WA_USER_EDIT (name, 'WAUI_FULL_NAME'    , xpath_eval ('string(/users/user/name)', xmlData));
+    insert into DB.DBA.WA_USER_OL_ACCOUNTS (WUO_U_ID, WUO_TYPE, WUO_NAME, WUO_URL)
+      values (rc, 'P', 'Twitter', sprintf ('http://twitter.com/%U', name));
+  }
+  else if (mode = 5)
+  {
+    DB.DBA.WA_USER_EDIT (name, 'WAUI_FIRST_NAME'    , xpath_eval ('string(/person/first-name)', xmlData));
+    DB.DBA.WA_USER_EDIT (name, 'WAUI_LAST_NAME'     , xpath_eval ('string(/person/last-name)', xmlData));
+    insert into DB.DBA.WA_USER_OL_ACCOUNTS (WUO_U_ID, WUO_TYPE, WUO_NAME, WUO_URL)
+      values (rc, 'P', 'LinkedIn', cast (xpath_eval ('string(/person/public-profile-url)', xmlData) as varchar));
+  }
+
   sid := DB.DBA.vspx_sid_generate ();
   insert into DB.DBA.VSPX_SESSION (VS_SID, VS_REALM, VS_UID, VS_EXPIRY)
     values (sid, 'wa', name, now ());
@@ -1218,6 +1386,101 @@ create procedure ODS.ODS_API."user.register" (
 }
 ;
 
+create procedure ODS.ODS_API.twitterServer (
+  in hostUrl varchar) __SOAP_HTTP 'text/plain'
+{
+  declare token, result, url, sid, oauth_token, return_url any;
+
+  token := ODS.ODS_API.get_oauth_tok ('Twitter API');
+  sid := md5 (datestring (now ()));
+  return_url := sprintf ('%s&sid=%U', hostUrl, sid);
+  url := OAUTH..sign_request ('GET', 'http://twitter.com/oauth/request_token', sprintf ('oauth_callback=%U', return_url), token, null, 1);
+  result := http_get (url);
+  sid := OAUTH..parse_response (sid, token, result);
+
+  OAUTH..set_session_data (sid, vector());
+  oauth_token := OAUTH..get_auth_token (sid);
+
+  return sprintf ('http://twitter.com/oauth/authenticate?oauth_token=%U', oauth_token);
+}
+;
+
+create procedure ODS.ODS_API.twitterVerify (
+  in sid varchar,
+  in oauth_verifier varchar,
+  in oauth_token varchar) __SOAP_HTTP 'text/xml'
+{
+  declare tmp, screen_name, header, auth any;
+  declare token, result, url, return_url any;
+
+  token := ODS.ODS_API.get_oauth_tok ('Twitter API');
+  url := OAUTH..sign_request (
+    'GET',
+    'http://twitter.com/oauth/access_token',
+    sprintf ('oauth_token=%U&oauth_verifier=%U', oauth_token, oauth_verifier),
+    token,
+    sid,
+    1);
+  result := http_get (url);
+  sid := OAUTH..parse_response (sid, token, result);
+  tmp := split_and_decode (result, 0);
+  screen_name := get_keyword ('screen_name', tmp);
+
+  auth := OAUTH..signed_request_header ('GET', 'http://api.twitter.com/1/users/lookup.xml', sprintf ('screen_name=%U', screen_name), token, '', sid, 0);
+  url := sprintf ('http://api.twitter.com/1/users/lookup.xml?screen_name=%U', screen_name);
+  result := http_get (url, header, 'GET', auth);
+  OAUTH..session_terminate (sid);
+
+  return result;
+}
+;
+
+create procedure ODS.ODS_API.linkedinServer (
+  in hostUrl varchar) __SOAP_HTTP 'text/plain'
+{
+  declare token, result, url, sid, oauth_token, return_url any;
+
+  token := ODS.ODS_API.get_oauth_tok ('LinkedIn API');
+  sid := md5 (datestring (now ()));
+  return_url := sprintf ('%s&sid=%U', hostUrl, sid);
+  url := OAUTH..sign_request ('GET', 'https://api.linkedin.com/uas/oauth/requestToken', sprintf ('oauth_callback=%U', return_url), token, null, 1);
+  result := http_get (url);
+  sid := OAUTH..parse_response (sid, token, result);
+
+  OAUTH..set_session_data (sid, vector());
+  oauth_token := OAUTH..get_auth_token (sid);
+
+  return sprintf ('https://www.linkedin.com/uas/oauth/authenticate?oauth_token=%U', oauth_token);
+}
+;
+
+create procedure ODS.ODS_API.linkedinVerify (
+  in sid varchar,
+  in oauth_verifier varchar,
+  in oauth_token varchar) __SOAP_HTTP 'text/xml'
+{
+  declare tmp, header, auth any;
+  declare token, result, url, return_url any;
+
+  token := ODS.ODS_API.get_oauth_tok ('LinkedIn API');
+  url := OAUTH..sign_request (
+    'GET',
+    'https://api.linkedin.com/uas/oauth/accessToken',
+    sprintf ('oauth_token=%U&oauth_verifier=%U', oauth_token, oauth_verifier),
+    token,
+    sid,
+    1);
+  result := http_get (url);
+  sid := OAUTH..parse_response (sid, token, result);
+
+  url := OAUTH..sign_request ('GET', 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,industry,public-profile-url,date-of-birth)', '', token, sid, 1);
+  result := http_get (url);
+  OAUTH..session_terminate (sid);
+
+  return result;
+}
+;
+
 --! Authenticate ODS account using name & password hash
 --! Will estabilish a session in VSPX_SESSION table
 create procedure ODS.ODS_API."user.authenticate" (
@@ -1225,20 +1488,30 @@ create procedure ODS.ODS_API."user.authenticate" (
 	in password_hash varchar := null,
 	in facebookUID integer := null,
 	in openIdUrl varchar := null,
-	in openIdIdentity varchar := null) __soap_http 'text/xml'
+	in openIdIdentity varchar := null,
+  in oauthMode varchar := null,
+  in oauthSid varchar := null,
+  in oauthVerifier varchar := null,
+  in oauthToken varchar := null) __soap_http 'text/xml'
 {
   declare uname varchar;
-  declare sid varchar;
+  declare sid, tmp varchar;
   declare exit handler for sqlstate '*'
   {
     rollback work;
-    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
+    return ods_serialize_sql_error (__SQL_STATE, substring(__SQL_MESSAGE, 1, coalesce(strstr(__SQL_MESSAGE, '<>'), length(__SQL_MESSAGE))));
   };
 
+  tmp := (select WAB_DISABLE_UNTIL from DB.DBA.WA_BLOCKED_IP where WAB_IP = http_client_ip ());
+  --if (tmp is not null and tmp > now ())
+  --  signal ('22023', 'Too many failed attempts. Try again in an hour.<>');
+
   uname := null;
     if (not isnull (facebookUID))
     {
-      uname := (select U_NAME from DB.DBA.WA_USER_INFO, DB.DBA.SYS_USERS where WAUI_U_ID = U_ID and WAUI_FACEBOOK_LOGIN_ID = facebookUID);
+    uname := (select U_NAME from DB.DBA.WA_USER_INFO, DB.DBA.SYS_USERS where WAUI_U_ID = U_ID and WAUI_FACEBOOK_ID = facebookUID);
+    if (isnull (uname) and (oauthMode = 'linkedin'))
+      signal ('22023', 'The Facebook account is not registered.<>');
     }
   else if (not isnull (openIdUrl))
     {
@@ -1247,12 +1520,63 @@ create procedure ODS.ODS_API."user.authenticate" (
       commit work;
       vResult := http_client (openIdUrl);
       if (vResult not like '%is_valid:%true\n%')
-    {
-        signal ('22023', 'OpenID Authentication Failed');
-    }
+      signal ('22023', 'OpenID Authentication Failed.<>');
 
     uname := (select U_NAME from DB.DBA.WA_USER_INFO, DB.DBA.SYS_USERS where WAUI_U_ID = U_ID and rtrim (WAUI_OPENID_URL, '/') = rtrim (openIdIdentity, '/'));
     }
+  else if (not isnull (oauthMode))
+  {
+    declare tmp, url, token, result, screen_name, profile_url any;
+
+    if (oauthMode = 'twitter')
+    {
+    token := ODS.ODS_API.get_oauth_tok ('Twitter API');
+    url := OAUTH..sign_request ('GET',
+                                'http://twitter.com/oauth/access_token',
+  		                            sprintf ('oauth_token=%U&oauth_verifier=%U', oauthToken, oauthVerifier),
+		                            token,
+  		                            oauthSid,
+		                            1);
+    result := http_get (url);
+      OAUTH..parse_response (oauthSid, token, result);
+    tmp := split_and_decode (result, 0);
+    screen_name := get_keyword ('screen_name', tmp);
+
+    uname := (select U_NAME
+                from DB.DBA.SYS_USERS,
+                     DB.DBA.WA_USER_OL_ACCOUNTS
+               where WUO_U_ID = U_ID
+                 and WUO_URL = sprintf ('http://twitter.com/%U', screen_name));
+  }
+    else if (oauthMode = 'linkedin')
+    {
+      token := ODS.ODS_API.get_oauth_tok ('LinkedIn API');
+      url := OAUTH..sign_request ('GET',
+                                  'https://api.linkedin.com/uas/oauth/accessToken',
+  		                            sprintf ('oauth_token=%U&oauth_verifier=%U', oauthToken, oauthVerifier),
+  		                            token,
+  		                            oauthSid,
+  		                            1);
+      result := http_get (url);
+      OAUTH..parse_response (oauthSid, token, result);
+      url := OAUTH..sign_request ('GET', 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,industry,public-profile-url,date-of-birth)', '', token, oauthSid, 1);
+      result := http_get (url);
+      profile_url := cast (xpath_eval ('/person/public-profile-url', xtree_doc (result)) as varchar);
+
+      uname := (select U_NAME
+                  from DB.DBA.SYS_USERS,
+                       DB.DBA.WA_USER_OL_ACCOUNTS
+                 where WUO_U_ID = U_ID
+                   and WUO_URL = profile_url);
+    }
+    OAUTH..session_terminate (oauthSid);
+
+    if (isnull (uname) and (oauthMode = 'twitter'))
+      signal ('22000', 'The Twitter account is not registered.\n Please enter your Twitter account data in ODS ''Edit Profile/Personal/Online Accounts'' \nfor a successful authentication.<>');
+
+    if (isnull (uname) and (oauthMode = 'linkedin'))
+      signal ('22000', 'The LinkedIn account is not registered.\n Please enter your LinkedIn account data in ODS ''Edit Profile/Personal/Online Accounts'' \nfor a successful authentication.<>');
+  }
   else
   {
     if (not ods_check_auth (uname))
@@ -1262,9 +1586,15 @@ create procedure ODS.ODS_API."user.authenticate" (
     return ods_auth_failed ();
 
   sid := DB.DBA.vspx_sid_generate ();
-  insert into DB.DBA.VSPX_SESSION (VS_SID, VS_REALM, VS_UID, VS_EXPIRY)
-    values (sid, 'wa', uname, now ());
-  return '<sid>' || sid  || '</sid>';
+  insert into DB.DBA.VSPX_SESSION (VS_SID, VS_REALM, VS_UID, VS_STATE, VS_EXPIRY)
+    values (sid, 'wa', uname, serialize (vector ('vspx_user', uname)), now ());
+  return
+    '<root>' ||
+      '<sid>' || sid  || '</sid>' ||
+      '<userName>' || uname || '</userName>' ||
+      '<userId>' || cast (username2id (uname) as varchar) || '</userId>' ||
+      '<dba>' || cast (is_dba (uname) as varchar) || '</dba>' ||
+    '</root>';
 }
 ;
 
@@ -1276,6 +1606,22 @@ create procedure ODS.ODS_API."user.login" (
 }
 ;
 
+create procedure ODS.ODS_API."user.validate" () __soap_http 'text/xml'
+{
+  declare uname varchar;
+  declare exit handler for sqlstate '*'
+  {
+    rollback work;
+    http_rewrite();
+    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
+  };
+  if (not ods_check_auth (uname))
+    return ods_auth_failed ();
+
+  return ods_serialize_int_res (1);
+}
+;
+
 create procedure ODS.ODS_API."user.logout" () __soap_http 'text/plain'
 {
   declare uname varchar;
@@ -1356,6 +1702,9 @@ create procedure ODS.ODS_API."user.update.fields" (
   in mailSignature varchar := null,
   in sumary varchar := null,
   in appSetting varchar := null,
+  in spbEnable varchar := null,
+  in inSearch varchar := null,
+  in showActive varchar := null,
   in webIDs varchar := null,
   in interests varchar := null,
   in topicInterests varchar := null,
@@ -1422,9 +1771,6 @@ create procedure ODS.ODS_API."user.update.fields" (
   in securitySecretAnswer varchar := null,
   in securitySiocLimit varchar := null,
 
-  in certificate varchar := null,
-  in certificateLogin varchar := null,
-
   in photo varchar := null,
   in photoContent varchar := null,
 
@@ -1434,7 +1780,7 @@ create procedure ODS.ODS_API."user.update.fields" (
   in mode varchar := null,
   in onlineAccounts varchar := null) __soap_http 'text/xml'
 {
-  declare uname varchar;
+  declare rc, uid, uname any;
   declare exit handler for sqlstate '*' {
     rollback work;
     return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
@@ -1465,7 +1811,12 @@ create procedure ODS.ODS_API."user.update.fields" (
   ODS.ODS_API."user.update.field" (uname, 'WAUI_WEBPAGE', homepage);
   ODS.ODS_API."user.update.field" (uname, 'WAUI_MSIGNATURE', mailSignature);
   ODS.ODS_API."user.update.field" (uname, 'WAUI_SUMMARY', sumary);
+
   ODS.ODS_API."user.update.field" (uname, 'WAUI_APP_ENABLE', atoi(appSetting));
+  ODS.ODS_API."user.update.field" (uname, 'WAUI_SPB_ENABLE', atoi(spbEnable));
+  ODS.ODS_API."user.update.field" (uname, 'WAUI_SEARCHABLE', atoi(inSearch));
+  ODS.ODS_API."user.update.field" (uname, 'WAUI_SHOWACTIVE', atoi(showActive));
+
   ODS.ODS_API."user.update.field" (uname, 'WAUI_FOAF', webIDs);
   ODS.ODS_API."user.update.field" (uname, 'WAUI_INTERESTS', interests);
   ODS.ODS_API."user.update.field" (uname, 'WAUI_INTEREST_TOPICS', topicInterests);
@@ -1529,36 +1880,26 @@ create procedure ODS.ODS_API."user.update.fields" (
   ODS.ODS_API."user.update.field" (uname, 'WAUI_BMESSAGING', businessMessaging);
 
   -- Security
-  ODS.ODS_API."user.update.field" (uname, 'WAUI_OPENID_URL', securityOpenID);
+  uid := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+  rc := ODS..openid_url_set (uid, securityOpenID);
+  if (not isnull (rc))
+    signal ('23023', rc);
 
-  ODS.ODS_API."user.update.field" (uname, 'WAUI_FACEBOOK_LOGIN_ID', securityFacebookID);
+  if (not DB.DBA.is_empty_or_null (securityFacebookID))
+  {
+    if (exists (select 1 from DB.DBA.WA_USER_INFO where WAUI_U_ID <> uid and WAUI_FACEBOOK_ID = securityFacebookID))
+      signal ('23023', 'This Facebook identity is already registered.');
+  }
+  ODS.ODS_API."user.update.field" (uname, 'WAUI_FACEBOOK_ID', securityFacebookID);
 
   ODS.ODS_API."user.update.field" (uname, 'SEC_QUESTION', securitySecretQuestion);
   ODS.ODS_API."user.update.field" (uname, 'SEC_ANSWER', securitySecretAnswer);
   if (not isnull (securitySiocLimit))
     DB.DBA.USER_SET_OPTION (uname, 'SIOC_POSTS_QUERY_LIMIT', atoi (securitySiocLimit));
 
-  --XXX: obsolete
-  ODS.ODS_API."user.update.field" (uname, 'WAUI_CERT', certificate);
-  ODS.ODS_API."user.update.field" (uname, 'WAUI_CERT_LOGIN', certificateLogin);
-
   -- Photo & Audio
   ODS.ODS_API."user.upload.internal" (uname, photo, photoContent, audio, audioContent);
 
-  if (not isnull (onlineAccounts))
-  {
-    declare _u_id integere;
-
-    _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
-    for (select fld1, fld2 from DB.DBA.WA_USER_INTERESTS (txt) (fld1 varchar, fld2 varchar) P where txt = onlineAccounts) do
-	  {
-	    if (length (fld1) and not exists (select 1 from DB.DBA.WA_USER_OL_ACCOUNTS where WUO_U_ID = _u_id and WUO_TYPE = 'P' and WUO_NAME = fld1 and WUO_URL = fld2))
-	    {
-        insert into DB.DBA.WA_USER_OL_ACCOUNTS (WUO_NAME, WUO_URL, WUO_U_ID, WUO_TYPE)
-          values (fld1, fld2, _u_id, 'P');
-	    }
-	  }
-  }
   return ods_serialize_int_res (1);
 }
 ;
@@ -1686,6 +2027,7 @@ create procedure ODS.ODS_API."user.password_change" (
 {
   declare uname, msg varchar;
   declare rc integer;
+  declare tmp, userPassword, noPassword varchar;
   declare exit handler for sqlstate '*'
   {
     rollback work;
@@ -1701,6 +2043,14 @@ create procedure ODS.ODS_API."user.password_change" (
   rc := -1;
   msg := 'Success';
   set_user_id ('dba');
+  for (select U_NAME, U_PASSWORD from DB.DBA.SYS_USERS, DB.DBA.WA_USER_INFO where WAUI_U_ID = U_ID and U_NAME = uname) do
+  {
+    userPassword := pwd_magic_calc (U_NAME, U_PASSWORD, 1);
+    tmp := uuid ();
+    tmp := subseq (tmp, strrchr (tmp, '-'));
+    if ((userPassword like '%'||tmp) and (regexp_match ('[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}', userPassword) is not null))
+      old_password := userPassword;
+  }
   DB.DBA.USER_CHANGE_PASSWORD (uname, old_password, new_password);
   rc := 1;
 ret:
@@ -1745,7 +2095,6 @@ create procedure ODS.ODS_API."user.upload.internal" (
   in audioContent varchar := null)
 {
   -- Photo
-  -- dbg_obj_print('photo', length(photoContent), length(photo));
   if (length(photo) and length(photoContent))
   {
     declare rc, uid integer;
@@ -1801,7 +2150,6 @@ create procedure ODS.ODS_API."user.upload.internal" (
   }
 
   -- Audio
-  -- dbg_obj_print('audio', length(audioContent), length(audio));
   if (length(audio) and length (audioContent))
   {
     declare rc, uid integer;
@@ -1931,41 +2279,59 @@ create procedure ODS.ODS_API."user.get" (
 
 create procedure ODS.ODS_API."user.info" (
   in name varchar := null,
-  in "short" varchar := null) __soap_http 'text/xml'
+  in "short" varchar := '0') __soap_http 'text/xml'
 {
   declare uname varchar;
-  declare rc integer;
+  declare rc, tmp, userPassword, noPassword integer;
   declare exit handler for sqlstate '*'
   {
     rollback work;
     http_rewrite();
     return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
   };
-  if (not ods_check_auth (uname))
+  if (not ods_check_auth (uname) and isnull (name))
     return ods_auth_failed ();
 
-  if (isnull (name))
+  if (isinteger (uname))
+    uname := null;
+
+  if (not isnull (uname) and isnull (name))
     name := uname;
+
+  if (not isnull (uname) and (uname <> name))
+    return ods_serialize_sql_error ('37000', 'Bad  user''s name paramater');
+
   if (not exists (select 1 from DB.DBA.SYS_USERS where U_NAME = name))
     return ods_serialize_sql_error ('37000', 'The item is not found');
 
   for (select * from DB.DBA.SYS_USERS, DB.DBA.WA_USER_INFO where WAUI_U_ID = U_ID and U_NAME = name) do
   {
+    userPassword := pwd_magic_calc (U_NAME, U_PASSWORD, 1);
+    tmp := uuid ();
+    tmp := subseq (tmp, strrchr (tmp, '-'));
+    noPassword := case when (userPassword like '%'||tmp) and (regexp_match ('[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}', userPassword) is not null) then '1' else '0' end;
+
     http ('<user>');
 
     -- Personal
     ods_xml_item ('uid',       U_ID);
+    ods_xml_item ('iri',        SIOC..person_iri (SIOC..user_obj_iri (U_NAME)));
     ods_xml_item ('name',      U_NAME);
     ods_xml_item ('nickName',  WAUI_NICK);
-    ods_xml_item ('iri',       SIOC..person_iri (SIOC..user_obj_iri (U_NAME)));
-    ods_xml_item ('mail',      U_E_MAIL);
-    ods_xml_item ('title',     WAUI_TITLE);
     ods_xml_item ('firstName', WAUI_FIRST_NAME);
     ods_xml_item ('lastName',  WAUI_LAST_NAME);
     ods_xml_item ('fullName',  WAUI_FULL_NAME);
+
+    if (isnull (uname))
+      goto _notLogged;
+
+    ods_xml_item ('noPassword', noPassword);
+    ods_xml_item ('mail',       U_E_MAIL);
+    ods_xml_item ('title',      WAUI_TITLE);
     ods_xml_item ('homepage',  WAUI_WEBPAGE);
+    ods_xml_item ('qrcode',     ODS.ODS_API."qrcode"(WAUI_WEBPAGE));
 
-    if (not isnull ("short"))
+    if ("short" = '0')
     {
       -- Personal
       ods_xml_item ('gender',                 WAUI_GENDER);
@@ -2033,26 +2399,32 @@ create procedure ODS.ODS_API."user.info" (
 
       -- Security
       ods_xml_item ('securityOpenID',         WAUI_OPENID_URL);
-      ods_xml_item ('securityFacebookID',     WAUI_FACEBOOK_LOGIN_ID);
+      ods_xml_item ('securityFacebookID',     WAUI_FACEBOOK_ID);
+      if (not isnull (WAUI_FACEBOOK_ID))
+      {
+        declare fb_options any;
+        declare fb DB.DBA.Facebook;
+
+        if (DB.DBA._get_ods_fb_settings (fb_options))
+        {
+          fb := new DB.DBA.Facebook(fb_options[0], fb_options[1], http_param (), http_request_header ());
+          rc := fb.api_client.users_getInfo(WAUI_FACEBOOK_ID, 'name');
+          ods_xml_item ('securityFacebookName', serialize_to_UTF8_xml (xpath_eval('string(/users_getInfo_response/user/name)', rc)));
+        }
+      }
       ods_xml_item ('securitySecretQuestion', WAUI_SEC_QUESTION);
       ods_xml_item ('securitySecretAnswer',   WAUI_SEC_ANSWER);
       ods_xml_item ('securitySiocLimit',      DB.DBA.USER_GET_OPTION (U_NAME, 'SIOC_POSTS_QUERY_LIMIT'));
 
-      if (0) -- certificate is not longer part of user_info table
-	{
-      ods_xml_item ('certificate',            WAUI_CERT);
-      if (length(WAUI_CERT))
-      {
-        ods_xml_item ('certificateSubject',   get_certificate_info (2, cast (WAUI_CERT as varchar), 0, ''));
-        ods_xml_item ('certificateAgentID',   replace (get_certificate_info (7, cast (WAUI_CERT as varchar), 0, '', '2.5.29.17'), 'URI:', ''));
-      }
-      ods_xml_item ('certificateLogin',       WAUI_CERT_LOGIN);
-	}
       ods_xml_item ('appSetting',             cast (WAUI_APP_ENABLE as varchar));
+      ods_xml_item ('spbEnable',              cast (WAUI_SPB_ENABLE as varchar));
+      ods_xml_item ('inSearch',               cast (WAUI_SEARCHABLE as varchar));
+      ods_xml_item ('showActive',             cast (WAUI_SHOWACTIVE as varchar));
 
       ods_xml_item ('photo',                  WAUI_PHOTO_URL);
       ods_xml_item ('audio',                  WAUI_AUDIO_CLIP);
     }
+  _notLogged:;
     http ('</user>');
   }
   return '';
@@ -2066,7 +2438,7 @@ create procedure ODS.ODS_API."user.info.webID" (
   declare N, M, L integer;
   declare foafGraph varchar;
   declare S, st, msg, data, meta, cleanMeta any;
-  declare V, metaName, metaValue, _names, _values, _newValue any;
+  declare V, tmp, metaName, metaValue, _names, _values, _newValue any;
 
   V := jsonObject ();
   set_user_id ('dba');
@@ -2165,7 +2537,6 @@ create procedure ODS.ODS_API."user.info.webID" (
       if ((N > 0) and (metaName not like 'x_%'))
         goto _skip;
 
-      -- dbg_obj_print('', metaName, metaValue);
       metaValue := data[N][M];
       if (metaName like 'x_%')
       {
@@ -2219,9 +2590,17 @@ create procedure ODS.ODS_API."user.info.webID" (
     exec (S, st, msg, vector (), 0, meta, data);
     if (st = '00000' and length (data))
     {
-      ODS.ODS_API.set_keyword ('rsaPublicExponent', V, data[0][0]);
-      ODS.ODS_API.set_keyword ('rsaModulus', V, data[0][1]);
+      declare C any;
+
+      C := vector ();
+      for (N := 0; N < length (data); N := N + 1)
+        C := vector_concat (C, vector (vector_concat (jsonObject (), vector ('rsaNo', N, 'rsaPublicExponent', data[N][0], 'rsaModulus', data[N][1]))));
+
+      ODS.ODS_API.set_keyword ('rsaPublicKey', V, C);
     }
+    tmp := get_keyword ('homepage', V);
+    if (not isnull (tmp))
+      ODS.ODS_API.set_keyword ('qrcode', V, ODS.ODS_API."qrcode"(tmp));
   }
 
 _exit:;
@@ -2231,6 +2610,41 @@ _exit:;
 }
 ;
 
+create procedure ODS.ODS_API."user.certificateUrl" () __soap_http 'application/json'
+{
+  declare uname, rc, ua, url, webId any;
+  declare exit handler for sqlstate '*'
+  {
+    rollback work;
+    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
+  };
+  if (not ods_check_auth (uname))
+    return ods_auth_failed ();
+
+  rc := null;
+  ua := http_request_header (http_request_header (), 'User-Agent');
+  if (coalesce (strstr (ua, 'MSIE'), -1) > 0 or regexp_match ('Mozilla.*Windows.*Firefox.*\.NET CLR .*', ua) is not null)
+  {
+    declare svc_url varchar;
+
+    rc := '';
+    url := (select  top 1 WS_CERT_GEN_URL from DB.DBA.WA_SETTINGS);
+    if (length (url))
+    {
+      for (select U_NAME, U_FULL_NAME, U_E_MAIL, WAUI_BORG, WAUI_BCOUNTRY
+             from DB.DBA.SYS_USERS,
+                  DB.DBA.WA_USER_INFO
+     	      where U_NAME = uname and U_ID = WAUI_U_ID) do
+      {
+        webId := sioc..person_iri (sioc..user_obj_iri (U_NAME));
+        rc := sprintf ('%s?uri=%U&name=%U&email=%U&organization=%U', url, webId, coalesce (U_FULL_NAME, U_NAME), coalesce (U_E_MAIL, ''), coalesce (WAUI_BORG, ''));
+      }
+    }
+  }
+  return obj2json(rc, 10);
+}
+;
+
 create procedure ODS.ODS_API."user.search" (
   in pattern varchar) __soap_http 'text/xml'
 {
@@ -2855,6 +3269,21 @@ create procedure ODS.ODS_API."user.annotation.delete" (
 }
 ;
 
+create procedure ODS.ODS_API."user.onlineAccounts.uri" (
+  in url varchar) __soap_http 'text/plain'
+{
+  declare rc varchar;
+
+  rc := null;
+  if (__proc_exists ('DB.DBA.RDF_PROXY_ENTITY_IRI'))
+    rc := DB.DBA.RDF_PROXY_ENTITY_IRI(url);
+  if (isnull (rc))
+    rc := url || '#this';
+
+  return rc;
+}
+;
+
 create procedure ODS.ODS_API."user.onlineAccounts.list" (
   in "type" varchar) __soap_http 'application/json'
 {
@@ -2870,9 +3299,9 @@ create procedure ODS.ODS_API."user.onlineAccounts.list" (
 
   _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
   retValue := vector();
-  for (select WUO_ID, WUO_NAME, WUO_URL from DB.DBA.WA_USER_OL_ACCOUNTS where WUO_TYPE = "type" and WUO_U_ID = _u_id) do
+  for (select WUO_ID, WUO_NAME, WUO_URL, WUO_URI from DB.DBA.WA_USER_OL_ACCOUNTS where WUO_TYPE = "type" and WUO_U_ID = _u_id) do
   {
-    retValue := vector_concat (retValue, vector (vector (WUO_ID, WUO_NAME, WUO_URL)));
+    retValue := vector_concat (retValue, vector (vector (WUO_ID, WUO_NAME, WUO_URL, WUO_URI)));
   }
   return obj2json (retValue);
 }
@@ -2881,6 +3310,7 @@ create procedure ODS.ODS_API."user.onlineAccounts.list" (
 create procedure ODS.ODS_API."user.onlineAccounts.new" (
   in name varchar,
   in url varchar,
+  in uri varchar := null,
   in "type" varchar) __soap_http 'text/xml'
 {
   declare uname varchar;
@@ -2897,8 +3327,8 @@ create procedure ODS.ODS_API."user.onlineAccounts.new" (
   rc := (select WUO_ID from DB.DBA.WA_USER_OL_ACCOUNTS where WUO_U_ID = _u_id and WUO_TYPE = "type" and WUO_NAME = name and WUO_URL = url);
   if (isnull (rc))
   {
-  insert into DB.DBA.WA_USER_OL_ACCOUNTS (WUO_U_ID, WUO_TYPE, WUO_NAME, WUO_URL)
-    values (_u_id, "type", name, url);
+    insert into DB.DBA.WA_USER_OL_ACCOUNTS (WUO_U_ID, WUO_TYPE, WUO_NAME, WUO_URL, WUO_URI)
+      values (_u_id, "type", name, url, uri);
   rc := (select max (WUO_ID) from DB.DBA.WA_USER_OL_ACCOUNTS);
   }
   return ods_serialize_int_res (rc);
@@ -2909,6 +3339,7 @@ create procedure ODS.ODS_API."user.onlineAccounts.delete" (
   in id integer := null,
   in name varchar := null,
   in url varchar := null,
+  in uri varchar := null,
   in "type" varchar) __soap_http 'text/xml'
 {
   declare uname varchar;
@@ -2929,7 +3360,8 @@ create procedure ODS.ODS_API."user.onlineAccounts.delete" (
      where WUO_U_ID = _u_id
        and WUO_TYPE = "type"
        and (name is null or WUO_NAME = name)
-       and (url  is null or WUO_URL = url);
+       and (url  is null or WUO_URL = url)
+       and (uri  is null or WUO_URI = uri);
   } else {
     delete
       from DB.DBA.WA_USER_OL_ACCOUNTS
@@ -3052,7 +3484,7 @@ create procedure ODS.ODS_API."user.favorites.get" (
   declare uname varchar;
   declare retValue any;
   declare _u_id integer;
-  declare label, uri, properties any;
+  declare flag, label, uri, properties any;
   declare exit handler for sqlstate '*' {
     rollback work;
     return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
@@ -3061,11 +3493,13 @@ create procedure ODS.ODS_API."user.favorites.get" (
     return ods_auth_failed ();
 
   _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+  flag := '1';
   label := '';
   uri := '';
   properties := vector();
-  for (select WUF_ID, WUF_LABEL, WUF_URI, WUF_PROPERTIES from DB.DBA.WA_USER_FAVORITES where WUF_ID = id and WUF_U_ID = _u_id) do
+  for (select WUF_ID, WUF_FLAG, WUF_LABEL, WUF_URI, WUF_PROPERTIES from DB.DBA.WA_USER_FAVORITES where WUF_ID = id and WUF_U_ID = _u_id) do
   {
+    flag := WUF_FLAG;
     label := WUF_LABEL;
     uri := WUF_URI;
     properties := deserialize (WUF_PROPERTIES);
@@ -3089,13 +3523,14 @@ create procedure ODS.ODS_API."user.favorites.get" (
                                               )
                                       )
                        );
-  retValue := vector_concat (jsonObject (), vector ('id', id, 'label', label, 'uri', uri, 'properties', properties));
+  retValue := vector_concat (jsonObject (), vector ('id', id, 'flag', flag, 'label', label, 'uri', uri, 'properties', properties));
   return obj2json (retValue);
     }
 ;
 
 create procedure ODS.ODS_API."user.favorites.update" (
   in id integer,
+  in flag varchar := '1',
   in label varchar,
   in uri varchar,
   in properties varchar)
@@ -3114,12 +3549,13 @@ create procedure ODS.ODS_API."user.favorites.update" (
   properties := json_parse (properties);
   if (isnull (id))
   {
-    insert into DB.DBA.WA_USER_FAVORITES (WUF_U_ID, WUF_TYPE, WUF_CLASS, WUF_LABEL, WUF_URI, WUF_PROPERTIES)
-      values (_u_id, 'http://rdfs.org/sioc/ns#', 'sioc:Item', label, uri, serialize (properties));
+    insert into DB.DBA.WA_USER_FAVORITES (WUF_U_ID, WUF_FLAG, WUF_TYPE, WUF_CLASS, WUF_LABEL, WUF_URI, WUF_PROPERTIES)
+      values (_u_id, flag, 'http://rdfs.org/sioc/ns#', 'sioc:Item', label, uri, serialize (properties));
     rc := (select max (WUF_ID) from DB.DBA.WA_USER_FAVORITES);
   } else {
     update DB.DBA.WA_USER_FAVORITES
-       set WUF_LABEL = label,
+       set WUF_FLAG = flag,
+           WUF_LABEL = label,
            WUF_URI = uri,
            WUF_PROPERTIES = serialize (properties)
      where WUF_ID = id;
@@ -3130,21 +3566,23 @@ create procedure ODS.ODS_API."user.favorites.update" (
 ;
 
 create procedure ODS.ODS_API."user.favorites.new" (
+  in flag varchar := '1',
   in label varchar,
   in uri varchar,
   in properties varchar) __soap_http 'text/xml'
 {
-  return ODS.ODS_API."user.favorites.update" (null, label, uri, properties);
+  return ODS.ODS_API."user.favorites.update" (null, flag, label, uri, properties);
 }
 ;
 
 create procedure ODS.ODS_API."user.favorites.edit" (
   in id integer,
+  in flag varchar := '1',
   in label varchar,
   in uri varchar,
   in properties varchar) __soap_http 'text/xml'
 {
-  return ODS.ODS_API."user.favorites.update" (id, label, uri, properties);
+  return ODS.ODS_API."user.favorites.update" (id, flag, label, uri, properties);
 }
 ;
 
@@ -3364,7 +3802,8 @@ create procedure ODS.ODS_API."user.mades.delete" (
 }
 ;
 
-create procedure ODS.ODS_API."user.offers.list" () __soap_http 'application/json'
+create procedure ODS.ODS_API."user.offers.list" (
+  in type varchar := '1') __soap_http 'application/json'
   {
   declare uname varchar;
   declare _u_id integer;
@@ -3378,7 +3817,7 @@ create procedure ODS.ODS_API."user.offers.list" () __soap_http 'application/json
 
   _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
   retValue := vector();
-  for (select WUOL_ID, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = _u_id) do
+  for (select WUOL_ID, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = _u_id and WUOL_TYPE = type) do
   {
     retValue := vector_concat (retValue, vector (vector (WUOL_ID, WUOL_OFFER, WUOL_COMMENT)));
   }
@@ -3391,7 +3830,7 @@ create procedure ODS.ODS_API."user.offers.get" (
 {
   declare uname varchar;
   declare _u_id integer;
-  declare name, comment, products, retValue any;
+  declare flag, name, comment, products, retValue any;
   declare exit handler for sqlstate '*' {
     rollback work;
     return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
@@ -3400,11 +3839,13 @@ create procedure ODS.ODS_API."user.offers.get" (
     return ods_auth_failed ();
 
   _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+  flag := '1';
   name := '';
   comment := '';
   products := vector ();
-  for (select WUOL_ID, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES from DB.DBA.WA_USER_OFFERLIST where WUOL_ID = id) do
+  for (select WUOL_ID, WUOL_FLAG, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES from DB.DBA.WA_USER_OFFERLIST where WUOL_ID = id) do
   {
+    flag := WUOL_FLAG;
     name := WUOL_OFFER;
     comment := WUOL_COMMENT;
     products := deserialize (WUOL_PROPERTIES);
@@ -3412,6 +3853,7 @@ create procedure ODS.ODS_API."user.offers.get" (
   retValue := vector_concat (jsonObject (),
                              vector (
                                      'id', id,
+                                     'flag', flag,
                                      'name', name,
                                      'comment', comment,
                                      'properties', vector (vector_concat (ODS..jsonObject (), vector ('id', '0', 'ontology', 'http://purl.org/goodrelations/v1#', 'items', get_keyword ('products', products, vector ()))))
@@ -3423,6 +3865,8 @@ create procedure ODS.ODS_API."user.offers.get" (
 
 create procedure ODS.ODS_API."user.offers.update" (
   in id integer,
+  in type varchar := '1',
+  in flag varchar := '1',
   in name varchar,
   in comment varchar,
   in properties any) __soap_http 'text/xml'
@@ -3445,14 +3889,15 @@ create procedure ODS.ODS_API."user.offers.update" (
   properties := vector_concat (ODS..jsonObject (), vector ('version', '1.0', 'products', products));
   if (isnull (id))
   {
-    insert into DB.DBA.WA_USER_OFFERLIST (WUOL_U_ID, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES)
-      values (_u_id, name, comment, serialize (properties));
+    insert into DB.DBA.WA_USER_OFFERLIST (WUOL_U_ID, WUOL_TYPE, WUOL_FLAG, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES)
+      values (_u_id, type, flag, name, comment, serialize (properties));
     id := (select max (WUOL_ID) from DB.DBA.WA_USER_OFFERLIST);
   }
   else
   {
     update DB.DBA.WA_USER_OFFERLIST
-       set WUOL_OFFER = name,
+       set WUOL_FLAG = flag,
+           WUOL_OFFER = name,
            WUOL_COMMENT = comment,
            WUOL_PROPERTIES = serialize (properties)
      where WUOL_ID = id;
@@ -3462,21 +3907,25 @@ create procedure ODS.ODS_API."user.offers.update" (
 ;
 
 create procedure ODS.ODS_API."user.offers.new" (
+  in type varchar := '1',
+  in flag varchar := '1',
   in name varchar,
   in comment varchar,
   in properties any := null) __soap_http 'text/xml'
 {
-  return ODS.ODS_API."user.offers.update" (null, name, comment, properties);
+  return ODS.ODS_API."user.offers.update" (null, type, flag, name, comment, properties);
 }
 ;
 
 create procedure ODS.ODS_API."user.offers.edit" (
   in id integer,
+  in type varchar := '1',
+  in flag varchar := '1',
   in name varchar,
   in comment varchar,
   in properties any := null) __soap_http 'text/xml'
 {
-  return ODS.ODS_API."user.offers.update" (id, name, comment, properties);
+  return ODS.ODS_API."user.offers.update" (id, type, flag, name, comment, properties);
 }
 ;
 
@@ -3505,6 +3954,93 @@ create procedure ODS.ODS_API."user.offers.delete" (
 
 create procedure ODS.ODS_API."user.seeks.list" () __soap_http 'application/json'
 {
+  return ODS.ODS_API."user.offers.list"('2');
+}
+;
+
+create procedure ODS.ODS_API."user.seeks.get" (
+  in id integer) __soap_http 'application/json'
+{
+  return ODS.ODS_API."user.offers.get"(id);
+}
+;
+
+create procedure ODS.ODS_API."user.seeks.new" (
+  in type varchar := '2',
+  in flag varchar := '1',
+  in name varchar,
+  in comment varchar,
+  in properties any := null) __soap_http 'text/xml'
+{
+  return ODS.ODS_API."user.offers.update" (null, type, flag, name, comment, properties);
+}
+;
+
+create procedure ODS.ODS_API."user.seeks.edit" (
+  in id integer,
+  in type varchar := '2',
+  in flag varchar := '1',
+  in name varchar,
+  in comment varchar,
+  in properties any := null) __soap_http 'text/xml'
+{
+  return ODS.ODS_API."user.offers.update" (id, type, flag, name, comment, properties);
+}
+;
+
+create procedure ODS.ODS_API."user.seeks.delete" (
+  in id integer) __soap_http 'text/xml'
+{
+  return ODS.ODS_API."user.offers.update" (id);
+}
+;
+
+create procedure ODS.ODS_API."user.owns.list" (
+  in type varchar := '3') __soap_http 'application/json'
+{
+  return ODS.ODS_API."user.offers.list"(type);
+}
+;
+
+create procedure ODS.ODS_API."user.owns.get" (
+  in id integer) __soap_http 'application/json'
+{
+  return ODS.ODS_API."user.offers.get"(id);
+}
+;
+
+create procedure ODS.ODS_API."user.owns.new" (
+  in type varchar := '3',
+  in flag varchar := '1',
+  in name varchar,
+  in comment varchar,
+  in properties any := null) __soap_http 'text/xml'
+{
+  return ODS.ODS_API."user.offers.update" (null, type, flag, name, comment, properties);
+}
+;
+
+create procedure ODS.ODS_API."user.owns.edit" (
+  in id integer,
+  in type varchar := '3',
+  in flag varchar := '1',
+  in name varchar,
+  in comment varchar,
+  in properties any := null) __soap_http 'text/xml'
+{
+ return ODS.ODS_API."user.offers.update" (id, type, flag, name, comment, properties);
+}
+;
+
+create procedure ODS.ODS_API."user.owns.delete" (
+  in id integer) __soap_http 'text/xml'
+{
+  return ODS.ODS_API."user.offers.update" (id);
+}
+;
+
+create procedure ODS.ODS_API."user.likes.list" () __soap_http 'application/json'
+{
   declare uname varchar;
   declare _u_id integer;
   declare retValue any;
@@ -3517,20 +4053,20 @@ create procedure ODS.ODS_API."user.seeks.list" () __soap_http 'application/json'
 
   _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
   retValue := vector();
-  for (select WUWL_ID, WUWL_BARTER, WUWL_COMMENT, WUWL_PROPERTIES from DB.DBA.WA_USER_WISHLIST where WUWL_U_ID = _u_id) do
+  for (select WUL_ID, WUL_URI, WUL_TYPE, WUL_NAME, WUL_COMMENT, WUL_PROPERTIES from DB.DBA.WA_USER_LIKES where WUL_U_ID = _u_id) do
   {
-    retValue := vector_concat (retValue, vector (vector (WUWL_ID, WUWL_BARTER, WUWL_COMMENT)));
+    retValue := vector_concat (retValue, vector (vector (WUL_ID, WUL_URI, case when (WUL_TYPE = 'L') then 'Like' else 'DisLike' end, WUL_NAME, WUL_COMMENT)));
   }
   return obj2json (retValue);
 }
 ;
 
-create procedure ODS.ODS_API."user.seeks.get" (
+create procedure ODS.ODS_API."user.likes.get" (
   in id integer) __soap_http 'application/json'
   {
   declare uname varchar;
   declare _u_id integer;
-  declare name, comment, products, retValue any;
+  declare flag, uri, type, name, comment, products, retValue any;
   declare exit handler for sqlstate '*' {
     rollback work;
     return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
@@ -3539,29 +4075,41 @@ create procedure ODS.ODS_API."user.seeks.get" (
     return ods_auth_failed ();
 
   _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+  flag := '';
+  uri := '';
+  type := '';
   name := '';
   comment := '';
   products := vector ();
-  for (select WUWL_ID, WUWL_BARTER, WUWL_COMMENT, WUWL_PROPERTIES from DB.DBA.WA_USER_WISHLIST where WUWL_ID = id) do
+  for (select WUL_ID, WUL_FLAG, WUL_URI, WUL_TYPE, WUL_NAME, WUL_COMMENT, WUL_PROPERTIES from DB.DBA.WA_USER_LIKES where WUL_ID = id) do
     {
-    name := WUWL_BARTER;
-    comment := WUWL_COMMENT;
-    products := deserialize (WUWL_PROPERTIES);
+    flag := WUL_FLAG;
+    uri := WUL_URI;
+    type := WUL_TYPE;
+    name := WUL_NAME;
+    comment := WUL_COMMENT;
+    products := deserialize (WUL_PROPERTIES);
     }
   retValue := vector_concat (jsonObject (),
                              vector (
                                      'id', id,
+                                     'flag', flag,
+                                     'uri', uri,
+                                     'type', type,
                                      'name', name,
                                      'comment', comment,
-                                     'properties', vector (vector_concat (ODS..jsonObject (), vector ('id', '0', 'ontology', 'http://purl.org/goodrelations/v1#', 'items', get_keyword ('products', products, vector ()))))
+                                     'properties', vector (vector_concat (ODS..jsonObject (), vector ('id', '0', 'ontology', 'http://ontologi.es/like#', 'items', get_keyword ('products', products, vector ()))))
                                     )
                             );
   return obj2json (retValue);
   }
 ;
 
-create procedure ODS.ODS_API."user.seeks.update" (
+create procedure ODS.ODS_API."user.likes.update" (
   in id integer,
+  in flag varchar := '1',
+  in uri varchar,
+  in type varchar,
   in name varchar,
   in comment varchar,
   in properties any) __soap_http 'text/xml'
@@ -3584,42 +4132,51 @@ create procedure ODS.ODS_API."user.seeks.update" (
   properties := vector_concat (ODS..jsonObject (), vector ('version', '1.0', 'products', products));
   if (isnull (id))
   {
-    insert into DB.DBA.WA_USER_WISHLIST (WUWL_U_ID, WUWL_BARTER, WUWL_COMMENT, WUWL_PROPERTIES)
-      values (_u_id, name, comment, serialize (properties));
-    id := (select max (WUWL_ID) from DB.DBA.WA_USER_WISHLIST);
+    insert into DB.DBA.WA_USER_LIKES (WUL_U_ID, WUL_FLAG, WUL_URI, WUL_TYPE, WUL_NAME, WUL_COMMENT, WUL_PROPERTIES)
+      values (_u_id, flag, uri, type, name, comment, serialize (properties));
+    id := (select max (WUL_ID) from DB.DBA.WA_USER_LIKES);
   }
   else
   {
-  update DB.DBA.WA_USER_WISHLIST
-       set WUWL_BARTER = name,
-           WUWL_COMMENT = comment,
-           WUWL_PROPERTIES = serialize (properties)
-     where WUWL_ID = id;
+    update DB.DBA.WA_USER_LIKES
+       set WUL_FLAG = flag,
+           WUL_URI = uri,
+           WUL_TYPE = type,
+           WUL_NAME = name,
+           WUL_COMMENT = comment,
+           WUL_PROPERTIES = serialize (properties)
+     where WUL_ID = id;
   }
   return ods_serialize_int_res (id);
 }
 ;
 
-create procedure ODS.ODS_API."user.seeks.new" (
+create procedure ODS.ODS_API."user.likes.new" (
+  in flag varchar := '1',
+  in uri varchar,
+  in type varchar,
   in name varchar,
   in comment varchar,
   in properties any := null) __soap_http 'text/xml'
 {
-  return ODS.ODS_API."user.seeks.update" (null, name, comment, properties);
+  return ODS.ODS_API."user.likes.update" (null, flag, uri, type, name, comment, properties);
 }
 ;
 
-create procedure ODS.ODS_API."user.seeks.edit" (
+create procedure ODS.ODS_API."user.likes.edit" (
   in id integer,
+  in flag varchar := '1',
+  in uri varchar,
+  in type varchar,
   in name varchar,
   in comment varchar,
   in properties any := null) __soap_http 'text/xml'
 {
-  return ODS.ODS_API."user.seeks.update" (id, name, comment, properties);
+  return ODS.ODS_API."user.likes.update" (id, flag, uri, type, name, comment, properties);
 }
 ;
 
-create procedure ODS.ODS_API."user.seeks.delete" (
+create procedure ODS.ODS_API."user.likes.delete" (
   in id integer) __soap_http 'text/xml'
 {
   declare uname varchar;
@@ -3634,32 +4191,390 @@ create procedure ODS.ODS_API."user.seeks.delete" (
 
   _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
 
-  delete from DB.DBA.WA_USER_WISHLIST where WUWL_ID = id and WUWL_U_ID = _u_id;
+  delete from DB.DBA.WA_USER_LIKES where WUL_ID = id and WUL_U_ID = _u_id;
   rc := row_count ();
 
   return ods_serialize_int_res (rc);
 }
 ;
 
-create procedure ODS.ODS_API.appendProperty (
-  inout V any,
-  in propertyName varchar,
+create procedure ODS.ODS_API."user.knows.list" () __soap_http 'application/json'
+{
+  declare uname varchar;
+  declare _u_id integer;
+  declare retValue any;
+  declare exit handler for sqlstate '*' {
+    rollback work;
+    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
+  };
+  if (not ods_check_auth (uname))
+    return ods_auth_failed ();
+
+  _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+  retValue := vector();
+  for (select WUK_ID, WUK_URI, WUK_LABEL from DB.DBA.WA_USER_KNOWS where WUK_U_ID = _u_id) do
+  {
+    retValue := vector_concat (retValue, vector (vector (WUK_ID, WUK_URI, WUK_LABEL)));
+  }
+  return obj2json (retValue);
+}
+;
+
+create procedure ODS.ODS_API."user.knows.get" (
+  in id integer) __soap_http 'application/json'
+{
+  declare uname varchar;
+  declare _u_id integer;
+  declare flag, uri, label, retValue any;
+  declare exit handler for sqlstate '*' {
+    rollback work;
+    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
+  };
+  if (not ods_check_auth (uname))
+    return ods_auth_failed ();
+
+  _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+  flag := '';
+  uri := '';
+  label := '';
+  for (select WUK_ID, WUK_FLAG, WUK_URI, WUK_LABEL from DB.DBA.WA_USER_KNOWS where WUK_ID = id) do
+  {
+    flag := WUK_FLAG;
+    uri := WUK_URI;
+    label := WUK_LABEL;
+  }
+  retValue := vector_concat (jsonObject (),
+                             vector (
+                                     'id', id,
+                                     'flag', flag,
+                                     'uri', uri,
+                                     'label', label
+                                    )
+                            );
+  return obj2json (retValue);
+}
+;
+
+create procedure ODS.ODS_API."user.knows.update" (
+  in id integer,
+  in flag varchar := '1',
+  in uri varchar,
+  in label varchar) __soap_http 'text/xml'
+{
+  declare uname varchar;
+  declare _u_id integer;
+  declare products, ontologies any;
+  declare exit handler for sqlstate '*' {
+    rollback work;
+    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
+  };
+  if (not ods_check_auth (uname))
+    return ods_auth_failed ();
+
+  _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+  if (isnull (id))
+  {
+    if (not exists (select 1 from DB.DBA.WA_USER_KNOWS where WUK_U_ID = _u_id and WUK_URI = uri))
+    {
+      insert into DB.DBA.WA_USER_KNOWS (WUK_U_ID, WUK_FLAG, WUK_URI, WUK_LABEL)
+        values (_u_id, flag, uri, label);
+      id := (select max (WUK_ID) from DB.DBA.WA_USER_KNOWS);
+    } else {
+      id := 0;
+    }
+  }
+  else
+  {
+    update DB.DBA.WA_USER_KNOWS
+       set WUK_FLAG = flag,
+           WUK_URI = uri,
+           WUK_LABEL = label
+     where WUK_ID = id;
+  }
+  return ods_serialize_int_res (id);
+}
+;
+
+create procedure ODS.ODS_API."user.knows.new" (
+  in flag varchar := '1',
+  in uri varchar,
+  in label varchar) __soap_http 'text/xml'
+{
+  return ODS.ODS_API."user.knows.update" (null, flag, uri, label);
+}
+;
+
+create procedure ODS.ODS_API."user.knows.edit" (
+  in id integer,
+  in flag varchar := '1',
+  in uri varchar,
+  in label varchar) __soap_http 'text/xml'
+{
+  return ODS.ODS_API."user.knows.update" (id, flag, uri, label);
+}
+;
+
+create procedure ODS.ODS_API."user.knows.delete" (
+  in id integer) __soap_http 'text/xml'
+{
+  declare uname varchar;
+  declare rc integer;
+  declare _u_id integer;
+  declare exit handler for sqlstate '*' {
+    rollback work;
+    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
+  };
+  if (not ods_check_auth (uname))
+    return ods_auth_failed ();
+
+  _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+
+  delete from DB.DBA.WA_USER_KNOWS where WUK_ID = id and WUK_U_ID = _u_id;
+  rc := row_count ();
+
+  return ods_serialize_int_res (rc);
+}
+;
+
+create procedure ODS.ODS_API."user.certificates.list" () __soap_http 'application/json'
+{
+  declare uname varchar;
+  declare _u_id integer;
+  declare retValue any;
+  declare exit handler for sqlstate '*' {
+    rollback work;
+    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
+  };
+  if (not ods_check_auth (uname))
+    return ods_auth_failed ();
+
+  _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+  retValue := vector();
+  for (select UC_ID, UC_CERT, UC_TS, UC_FINGERPRINT, UC_LOGIN, UC_FINGERPRINT from DB.DBA.WA_USER_CERTS where UC_U_ID = _u_id order by UC_TS desc) do
+  {
+    retValue := vector_concat (retValue, vector (vector (UC_ID, get_certificate_info (2, cast (UC_CERT as varchar), 0, ''), DB.DBA.wa_abs_date (UC_TS), UC_FINGERPRINT, case when UC_LOGIN = 1 then 'Yes' else 'No' end)));
+  }
+  return obj2json (retValue);
+}
+;
+
+create procedure ODS.ODS_API."user.certificates.get" (
+  in id integer) __soap_http 'application/json'
+{
+  declare uname varchar;
+  declare _u_id integer;
+  declare subject, agentID, fingerPrint, certificate, enableLogin, retValue any;
+  declare exit handler for sqlstate '*' {
+    rollback work;
+    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
+  };
+  if (not ods_check_auth (uname))
+    return ods_auth_failed ();
+
+  _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+  subject := '';
+  agentID := '';
+  fingerPrint := '';
+  certificate := '';
+  enableLogin := 0;
+  for (select UC_ID, UC_CERT, UC_LOGIN, UC_FINGERPRINT from DB.DBA.WA_USER_CERTS where UC_ID = id and UC_U_ID = _u_id) do
+  {
+    subject := get_certificate_info (2, UC_CERT, 0, '');
+    agentID := ODS.ODS_API.SSL_WEBID_GET (UC_CERT);
+    fingerPrint := get_certificate_info (6, UC_CERT, 0, '');
+    certificate := UC_CERT;
+    enableLogin := UC_LOGIN;
+  }
+  retValue := vector_concat (jsonObject (),
+                             vector (
+                                     'id', id,
+                                     'subject', subject,
+                                     'agentID', agentID,
+                                     'fingerPrint', fingerPrint,
+                                     'certificate', certificate,
+                                     'enableLogin', enableLogin
+                                    )
+                            );
+  return obj2json (retValue);
+}
+;
+
+create procedure ODS.ODS_API."user.certificates.update" (
+  in id integer,
+  in certificate varchar,
+  in enableLogin integer)
+{
+  declare uname, agent varchar;
+  declare _u_id integer;
+  declare exit handler for sqlstate '*' {
+    rollback work;
+    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
+  };
+  if (not ods_check_auth (uname))
+    return ods_auth_failed ();
+
+  _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+
+  agent := ODS.ODS_API.SSL_WEBID_GET (certificate);
+  if ((agent is null and length (certificate)) or (0 = length (certificate)))
+	  signal ('', 'The certificate must be in PEM format and must have Alternate Name attribute.');
+
+	if (id is null)
+  {
+    insert into DB.DBA.WA_USER_CERTS (UC_U_ID, UC_CERT, UC_FINGERPRINT, UC_LOGIN)
+      values (_u_id, certificate, get_certificate_info (6, certificate, 0, ''), enableLogin);
+    id := (select max (UC_ID) from DB.DBA.WA_USER_CERTS);
+	}
+	else
+	{
+	  update DB.DBA.WA_USER_CERTS
+	     set UC_CERT = certificate,
+			     UC_FINGERPRINT = get_certificate_info (6, certificate, 0, ''),
+				   UC_LOGIN = enableLogin
+		 where UC_U_ID = _u_id
+		   and UC_ID = id;
+  }
+  return ods_serialize_int_res (id);
+}
+;
+
+create procedure ODS.ODS_API."user.certificates.new" (
+  in certificate varchar,
+  in enableLogin integer) __soap_http 'text/xml'
+{
+  return ODS.ODS_API."user.certificates.update" (null, certificate, enableLogin);
+}
+;
+
+create procedure ODS.ODS_API."user.certificates.edit" (
+  in id integer,
+  in certificate varchar,
+  in enableLogin integer) __soap_http 'text/xml'
+{
+  return ODS.ODS_API."user.certificates.update" (id, certificate, enableLogin);
+}
+;
+
+create procedure ODS.ODS_API."user.certificates.delete" (
+  in id integer) __soap_http 'text/xml'
+{
+  declare uname varchar;
+  declare rc integer;
+  declare _u_id integer;
+  declare exit handler for sqlstate '*' {
+    rollback work;
+    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
+  };
+  if (not ods_check_auth (uname))
+    return ods_auth_failed ();
+
+  _u_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+
+  delete from DB.DBA.WA_USER_CERTS where UC_ID = id and UC_U_ID = _u_id;
+  rc := row_count ();
+
+  return ods_serialize_int_res (rc);
+}
+;
+
+create procedure ODS.ODS_API.appendPropertyTitle (
+  in title varchar)
+{
+  declare M integer;
+  declare V any;
+
+  V := vector ('Mr', 'Mrs', 'Dr', 'Ms', 'Sir');
+  for (M := 0; M < length (V); M := M + 1)
+  {
+    if (lcase (title) like (lcase (V[M])|| '%'))
+      return V[M];
+  }
+  return '';
+}
+;
+
+create procedure ODS.ODS_API.appendProperty (
+  inout V any,
+  in propertyName varchar,
   in propertyValue any,
   in propertyNS varchar := '')
 {
-  if (not isnull (propertyValue))
+  if (not DB.DBA.is_empty_or_null (propertyValue) and isstring (propertyValue) and propertyValue not like 'nodeID:%' and isnull (get_keyword (propertyName, V)))
   {
     if (propertyNS <> '')
     {
       if (propertyValue like propertyNS || '%')
         propertyValue := substring (propertyValue, length (propertyNS) + 1, length (propertyValue));
     }
+    if (propertyValue like 'mailto:%')
+    {
+      propertyValue := replace (propertyValue, 'mailto:', '');
+    }
+    else if (propertyValue like 'tel:%')
+    {
+      propertyValue := replace (propertyValue, 'tel:', '');
+    }
+    else if (propertyName = 'title')
+    {
+      propertyValue := appendPropertyTitle (propertyValue);
+    }
     V := vector_concat (V, vector (propertyName, propertyValue));
   }
   return V;
 }
 ;
 
+create procedure ODS.ODS_API.appendPropertyArray (
+  inout V any,
+  inout N integer,
+  in propertyName varchar,
+  in propertyValue any,
+  in meta any,
+  in data any)
+{
+  declare M integer;
+  declare property varchar;
+  declare newPropertyArray, propertyArray any;
+
+  property := replace (propertyName, '_array', '');
+  N := N + 1;
+  if (not DB.DBA.is_empty_or_null (propertyValue) and isstring (propertyValue) and (propertyValue not like 'nodeID:%'))
+  {
+    newPropertyArray := vector_concat (jsonObject(), vector ('value', propertyValue));
+
+    propertyArray := get_keyword (property, V);
+    if (isnull (propertyArray))
+      propertyArray := vector ();
+
+    for (M := 0; M < length (propertyArray); M := M + 1)
+    {
+      if (get_keyword ('value', propertyArray[M]) = propertyValue)
+        goto _exit;
+    }
+
+    while ((N < length(meta)) and (meta[N] like property || '_%'))
+    {
+      if (not DB.DBA.is_empty_or_null (data[N]) and isstring (data[N]) and (data[N] not like 'nodeID:%'))
+        newPropertyArray := vector_concat (newPropertyArray, vector (replace (meta[N], property||'_', ''), data[N]));
+
+      N := N + 1;
+    }
+
+    propertyArray := vector_concat (propertyArray, vector (newPropertyArray));
+    ODS.ODS_API.set_keyword (property, V, propertyArray);
+  }
+  else
+  {
+  _exit:;
+    while ((N < length(meta)) and (meta[N] like property || '_%'))
+      N := N + 1;
+  }
+
+  N := N - 1;
+  return V;
+}
+;
+
 grant execute on DB.DBA.RDF_GRAB to SPARQL_SELECT;
 grant execute on DB.DBA.RDF_GRAB_SINGLE_ASYNC to SPARQL_SELECT;
 
@@ -3696,6 +4611,20 @@ create procedure ODS.ODS_API.vector_contains(
 }
 ;
 
+create procedure ODS.ODS_API.simplifyMeta (
+  in abMeta any)
+{
+  declare N integer;
+  declare newMeta any;
+
+  newMeta := vector ();
+  for (N := 0; N < length (abMeta[0]); N := N + 1)
+    newMeta := vector_concat (newMeta, vector (abMeta[0][N][0]));
+
+  return newMeta;
+}
+;
+
 create procedure ODS.ODS_API.set_keyword (
   in    name   varchar,
   inout params any,
@@ -3717,20 +4646,30 @@ _end:
 }
 ;
 
-create procedure ODS.ODS_API.get_foaf_data_array (
+create procedure ODS.ODS_API.graph_create ()
+{
+  return 'http://local.virt/ods/' || cast (rnd (1000) as varchar);
+}
+;
+
+create procedure ODS.ODS_API.graph_clear (
+  in graph varchar)
+{
+  commit work;
+  exec (sprintf ('SPARQL clear graph <%s>', graph));
+}
+;
+
+create procedure ODS.ODS_API.getFOAFDataArray (
   in foafIRI varchar,
-  in spongerMode integer := 1,
   in sslFOAFCheck integer := 0,
   in sslLoginCheck integer := 0)
 {
-  declare N, M integer;
-  declare S, IRI, foafGraph, _identity, _loc_idn varchar;
-  declare V, st, msg, data, meta any;
+  declare N integer;
+  declare S, SQLs, IRI, foafGraph, _identity, _loc_idn varchar;
+  declare V, st, msg, rows, meta any;
   declare certLogin, certLoginEnable any;
-  declare "title", "name", "nick", "firstName", "givenname", "family_name", "mbox", "gender", "birthday", "lat", "lng" any;
-  declare "icqChatID", "msnChatID", "aimChatID", "yahooChatID", "skypeChatID", "workplaceHomepage", "homepage", "phone", "organizationTitle", "keywords", "depiction", "resume" any;
-  declare "interest", "topic_interest", "onlineAccounts", "sameAs" any;
-  declare "vInterest", "vTopic_interest", "vOnlineAccounts", "vSameAs" any;
+  declare personUri any;
   declare host, port, arr any;
   declare info any;
 
@@ -3750,41 +4689,74 @@ create procedure ODS.ODS_API.get_foaf_data_array (
   V := rfc1808_parse_uri (trim (foafIRI));
   V[5] := '';
   IRI := DB.DBA.vspx_uri_compose (V);
+
   V := vector ();
-  foafGraph := 'http://local.virt/FOAF/' || cast (rnd (1000) as varchar);
-  if (spongerMode)
+  foafGraph := ODS.ODS_API.graph_create ();
+  sqls := vector (sprintf ('sparql
+                            define input:storage ""
+                            prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+                            prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+                            prefix foaf: <http://xmlns.com/foaf/0.1/>
+                            select ?iri
+          		                from <%s>
+                             where {
+                                     ?personalProfileDocument a foaf:PersonalProfileDocument;
+                                                              foaf:primaryTopic ?iri .
+                                   }', foafGraph),
+                  sprintf ('sparql
+                            define input:storage ""
+                            prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+                            prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+                            prefix foaf: <http://xmlns.com/foaf/0.1/>
+                            select ?iri
+          		                from <%s>
+                             where {
+                                     ?iri a foaf:Person.
+                                   } ', foafGraph)
+                 );
+
+  personUri := ODS.ODS_API.getPersonUri (
+                 sprintf ('sparql load <%s> into graph <%s>', IRI, foafGraph),
+                 sqls,
+                 IRI,
+                 foafGraph
+               );
+  if (isnull (personUri))
   {
-    S := sprintf ('sparql define get:soft "soft" define input:grab-destination <%s> select * from <%S> where { ?s ?p ?o }', foafGraph, IRI);
-  } else {
-    S := sprintf ('sparql load <%s> into graph <%s>', IRI, foafGraph);
+  personUri := ODS.ODS_API.getPersonUri (
+                 sprintf ('sparql define get:soft "soft" define get:uri <%s> select * from <%s> where { ?s ?p ?o }', IRI, foafGraph),
+                 sqls,
+                 IRI,
+                 foafGraph
+               );
   }
-  st := '00000';
-  commit work;
-  exec (S, st, msg, vector (), 0);
-  if (st <> '00000')
+  if (isnull (personUri))
     goto _exit;
+
   commit work;
   set isolation='committed';
   if (sslFOAFCheck)
   {
     if (not is_https_ctx ())
       goto _exit;
+
     info := get_certificate_info (9);
-    st := '00000';
     S := DB.DBA.FOAF_SSL_QR (foafGraph, _loc_idn);       
+
+    st := '00000';
     commit work;
-    exec (S, st, msg, vector (), 0, meta, data);
-    if (st = '00000' and length (data)) 
+    exec (S, st, msg, vector (), vector ('use_cache', 1), meta, rows);
+    if (st = '00000' and length (rows))
       {
-	foreach (any _row in data) do 
+	    foreach (any _row in rows) do
 	  {
 	    if (_row[0] = cast (info[1] as varchar) and DB.DBA.FOAF_MOD (_row[1]) = bin2hex (info[2]))
-	      goto loginin;
+  	      goto _loginIn;
 	  }
       }
       goto _exit;
   }
-loginin:
+_loginIn:
   certLogin := 0;
   certLoginEnable := 0;
   if (is_https_ctx ())
@@ -3795,6 +4767,70 @@ loginin:
       certLoginEnable := coalesce (UC_LOGIN, 0);
   }
   }
+  V := ODS.ODS_API.extractFOAFDataArray (personUri, foafGraph);
+
+  if (is_https_ctx () and isnull (get_keyword (V, 'mbox')))
+  {
+    declare X, Y any;
+
+    X := vector ();
+    info := get_certificate_info (2);
+    Y := split_and_decode (info, 0, '\0\0/');
+    for (N := 0; N < length (Y); N := N + 1)
+      X := vector_concat (X, split_and_decode (Y[N], 0, '\0\0='));
+
+    appendProperty (V, 'mbox', get_keyword ('emailAddress', X));
+  }
+
+  if (certLogin and length (V))
+    appendProperty (V, 'certLogin', cast (certLogin as varchar));
+
+_exit:;
+  ODS.ODS_API.graph_clear (foafGraph);
+  -- dbg_obj_print ('V', V);
+  return V;
+}
+;
+
+create procedure ODS.ODS_API.getPersonUri (
+  in S varchar,
+  in SQLs any,
+  in iri varchar,
+  in graph varchar)
+{
+  declare N integer;
+  declare st, msg, rows, meta any;
+
+  ODS.ODS_API.graph_clear (graph);
+
+  st := '00000';
+  commit work;
+  exec (S, st, msg, vector (), vector ('use_cache', 1));
+  if (st <> '00000')
+    return null;
+
+  for (N := 0; N < length(SQLs); n := N + 1)
+  {
+    st := '00000';
+    commit work;
+    exec (SQLs[N], st, msg, vector (), vector ('use_cache', 1), meta, rows);
+    if (st = '00000' and (length (rows) > 0))
+    {
+      return rows[0][0];
+    }
+  }
+  return null;
+}
+;
+
+create procedure ODS.ODS_API.extractFOAFDataArray (
+  in iri varchar,
+  in graph varchar)
+{
+  declare N integer;
+  declare S varchar;
+  declare V, S, st, msg, rows, meta any;
+
   S := sprintf ('sparql
                  define input:storage ""
                   prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
@@ -3803,7 +4839,9 @@ loginin:
                   prefix foaf: <http://xmlns.com/foaf/0.1/>
                   prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
                   prefix bio: <http://vocab.org/bio/0.1/>
-                 select ?person
+                 select ?iri
+                        ?type
+                        ?personalProfileDocument
                         ?title
                          ?name
                          ?nick
@@ -3827,173 +4865,86 @@ loginin:
                          ?keywords
                          ?depiction
                         ?resume
-                         ?interest
+                        ?interest_array
                          ?interest_label
-                        ?topic_interest
+                        ?topic_interest_array
                         ?topic_interest_label
-                        ?onlineAccount
+                        ?onlineAccount_array
                         ?onlineAccount_url
-                        ?sameAs
+                        ?sameAs_array
+                        ?knows_array
+                        ?knows_nick
 		               from <%s>
                    where {
-                           {
-                             [] a foaf:PersonalProfileDocument ;
-                             foaf:primaryTopic ?person .
-                             optional { ?person foaf:name ?name } .
-                             optional { ?person foaf:title ?title } .
-                             optional { ?person foaf:nick ?nick } .
-                             optional { ?person foaf:firstName ?firstName } .
-                             optional { ?person foaf:givenname ?givenname } .
-                             optional { ?person foaf:family_name ?family_name } .
-                             optional { ?person foaf:mbox ?mbox } .
-                             optional { ?person foaf:gender ?gender } .
-                             optional { ?person foaf:birthday ?birthday } .
-                             optional { ?person foaf:based_near ?b1 . ?b1 geo:lat ?lat ; geo:long ?lng . } .
-                             optional { ?person foaf:icqChatID ?icqChatID } .
-                             optional { ?person foaf:msnChatID ?msnChatID } .
-                             optional { ?person foaf:aimChatID ?aimChatID } .
-                             optional { ?person foaf:yahooChatID ?yahooChatID } .
-  	                        optional { ?person foaf:holdsAccount ?holdsAccount .
+                          ?iri rdf:type ?type .
+                          optional { ?personalProfileDocument foaf:primaryTopic ?iri }.
+                            optional { ?iri foaf:name ?name } .
+                            optional { ?iri foaf:title ?title } .
+                            optional { ?iri foaf:nick ?nick } .
+                            optional { ?iri foaf:firstName ?firstName } .
+                            optional { ?iri foaf:givenname ?givenname } .
+                            optional { ?iri foaf:family_name ?family_name } .
+                            optional { ?iri foaf:mbox ?mbox } .
+                            optional { ?iri foaf:gender ?gender } .
+                            optional { ?iri foaf:birthday ?birthday } .
+                          optional { ?iri foaf:based_near ?b1 .
+                                     ?b1 geo:lat ?lat ;
+                                         geo:long ?lng . } .
+                            optional { ?iri foaf:icqChatID ?icqChatID } .
+                            optional { ?iri foaf:msnChatID ?msnChatID } .
+                            optional { ?iri foaf:aimChatID ?aimChatID } .
+                            optional { ?iri foaf:yahooChatID ?yahooChatID } .
+  	                        optional { ?iri foaf:holdsAccount ?holdsAccount .
   	                                   ?holdsAccount foaf:accountServiceHomepage ?accountServiceHomepage ;
   	                                                 foaf:accountName ?skypeChatID.
                                        filter (str(?accountServiceHomepage) like ''skype%%'').
                                      } .
-                             optional { ?person foaf:workplaceHomepage ?workplaceHomepage } .
-                             optional { ?person foaf:homepage ?homepage } .
-                             optional { ?person foaf:phone ?phone } .
-                             optional { ?person foaf:depiction ?depiction } .
-                             optional { ?person bio:keywords ?keywords } .
+                            optional { ?iri foaf:workplaceHomepage ?workplaceHomepage } .
+                            optional { ?iri foaf:homepage ?homepage } .
+                            optional { ?iri foaf:phone ?phone } .
+                            optional { ?iri foaf:depiction ?depiction } .
+                            optional { ?iri bio:keywords ?keywords } .
                              optional { ?organization a foaf:Organization }.
                              optional { ?organization foaf:homepage ?workplaceHomepage }.
                              optional { ?organization dc:title ?organizationTitle }.
-                             optional { ?person foaf:interest ?interest .
-                                        ?interest rdfs:label ?interest_label. } .
-                            optional { ?person foaf:topic_interest ?topic_interest .
-                                       ?topic_interest rdfs:label ?topic_interest_label. } .
-                            optional { ?person foaf:holdsAccount ?oa .
-                                       ?oa a foaf:OnlineAccount.
-                                       ?oa foaf:accountServiceHomepage ?onlineAccount_url.
-                                       ?oa foaf:accountName ?onlineAccount. } .
-                            optional { ?person owl:sameAs ?sameAs } .
-                            optional { ?person bio:olb ?resume } .
-                           }
-                        }', foafGraph);
+                            optional { ?iri foaf:interest ?interest_array .
+                                       ?interest_array rdfs:label ?interest_label. } .
+                            optional { ?iri foaf:topic_interest ?topic_interest_array .
+                                       ?topic_interest_array rdfs:label ?topic_interest_label. } .
+                            optional { ?iri foaf:holdsAccount ?oa .
+                                       ?oa a foaf:OnlineAccount;
+                                           foaf:accountServiceHomepage ?onlineAccount_url;
+                                           foaf:accountName ?onlineAccount_array. } .
+                            optional { ?iri owl:sameAs ?sameAs_array } .
+                            optional { ?iri bio:olb ?resume } .
+                            optional { ?iri foaf:knows ?knows_array .
+                                       optional { ?knows_array foaf:nick ?knows_nick } .
+                                       optional { ?knows_array foaf:name ?knows_name } .
+                                     } .
+                          filter (?iri = iri(?::0)).
+                        }', graph);
+  V := vector ();
+  st := '00000';
   commit work;
-  exec (S, st, msg, vector (), 0, meta, data);
-  M := 0;
-  "interest" := '';
-  "topic_interest" := '';
-  "onlineAccounts" := '';
-  "sameAs" := '';
-  "vInterest" := vector ();
-  "vTopic_interest" := vector ();
-  "vOnlineAccounts" := vector ();
-  "vSameAs" := vector ();
-  for (N := 0; N < length (data); N := N + 1)
+  exec (S, st, msg, vector (iri), vector ('use_cache', 1), meta, rows);
+  if (st = '00000')
+  {
+  meta := ODS.ODS_API.simplifyMeta(meta);
+  foreach (any row in rows) do
   {
-    if (_identity = data[N][0])
+    N := 0;
+    while (N < length(meta))
     {
-      if (M = 0)
+      if (meta[N] like '%_array')
     {
-        M := 1;
-        "title" := data[N][1];
-        "name" := data[N][2];
-        "nick" := data[N][3];
-        "firstName" := data[N][4];
-        "givenname" := data[N][5];
-        "family_name" := data[N][6];
-        "mbox" := data[N][7];
-        if (isnull ("mbox") and is_https_ctx ())
-        {
-          declare L integer;
-          declare V, X any;
-  
-          X := vector ();
-          info := get_certificate_info (2);
-          V := split_and_decode (info, 0, '\0\0/');
-          for (L := 0; L < length (V); L := L + 1)
-            X := vector_concat (X, split_and_decode (V[L], 0, '\0\0='));
-            
-          "mbox" := get_keyword ('emailAddress', X);
-        }       
-        "gender" := lcase (data[N][8]);
-        "birthday" := data[N][9];
-        "lat" := data[N][10];
-        "lng" := data[N][11];
-        "icqChatID" := data[N][12];
-        "msnChatID" := data[N][13];
-        "aimChatID" := data[N][14];
-        "yahooChatID" := data[N][15];
-        "skypeChatID" := data[N][16];
-        "workplaceHomepage" := data[N][17];
-        "homepage" := data[N][18];
-        "phone" := data[N][19];
-        "organizationTitle" := data[N][20];
-        "keywords" := data[N][21];
-        "depiction" := data[N][22];
-        "resume" := data[N][23];
-
-          appendProperty (V, 'certLogin', certLogin);
-        appendProperty (V, 'certLoginEnable', certLoginEnable);
-        appendProperty (V, 'iri', foafIRI);                                   -- FOAF IRI
-        appendProperty (V, 'nickName', coalesce ("nick", "name"));            -- WAUI_NICK
-    appendProperty (V, 'title', "title");		   -- WAUI_TITLE
-    appendProperty (V, 'name', "name");			   -- WAUI_FULL_NAME
-    appendProperty (V, 'firstName', coalesce ("firstName", "givenname")); -- WAUI_FIRST_NAME
-    appendProperty (V, 'family_name', "family_name");	   -- WAUI_LAST_NAME
-    appendProperty (V, 'mbox', "mbox", 'mailto:');	   -- E_MAIL
-    appendProperty (V, 'birthday', "birthday");		   -- WAUI_BIRTHDAY
-    appendProperty (V, 'gender', "gender");		   -- WAUI_GENDER
-    appendProperty (V, 'lat', "lat");			   -- WAUI_LAT
-    appendProperty (V, 'lng', "lng");			   -- WAUI_LNG
-    appendProperty (V, 'icqChatID', "icqChatID");	   -- WAUI_ICQ
-    appendProperty (V, 'msnChatID', "msnChatID");	   -- WAUI_MSN
-    appendProperty (V, 'aimChatID', "aimChatID");	   -- WAUI_AIM
-    appendProperty (V, 'yahooChatID', "yahooChatID");	   -- WAUI_YAHOO
-        appendProperty (V, 'skypeChatID', "skypeChatID");	                    -- WAUI_SKYPE
-    appendProperty (V, 'workplaceHomepage', "workplaceHomepage"); -- WAUI_BORG_HOMEPAGE
-    appendProperty (V, 'homepage', "homepage");		   -- WAUI_WEBPAGE
-    appendProperty (V, 'phone', "phone", 'tel:');	   -- WAUI_HPHONE
-        appendProperty (V, 'organizationHomepage', "workplaceHomepage");      -- WAUI_BORG_HOMEPAGE
-      appendProperty (V, 'organizationTitle', "organizationTitle");         -- WAUI_
-      appendProperty (V, 'tags', "keywords");                               -- WAUI_
-      appendProperty (V, 'depiction', "depiction");                         -- WAUI_
-    }
-      if (data[N][24] is not null and data[N][24] <> '' and not ODS.ODS_API.vector_contains ("vInterest", data[N][24]))
-      {
-        "interest" := "interest" || data[N][24] || ';' || data[N][25] || '\n';
-        "vInterest" := vector_concat ("vInterest", vector (data[N][24]));
-      }
-      if (data[N][26] is not null and data[N][26] <> '' and not ODS.ODS_API.vector_contains ("vTopic_interest", data[N][26]))
-      {
-        "topic_interest" := "topic_interest" || data[N][26] || ';' || data[N][27] || '\n';
-        "vTopic_interest" := vector_concat ("vTopic_interest", vector (data[N][26]));
-      }
-      if (data[N][28] is not null and data[N][28] <> '' and not ODS.ODS_API.vector_contains ("vOnlineAccounts", data[N][28]))
-      {
-        "onlineAccounts" := "onlineAccounts" || data[N][28] || ';' || data[N][29] || '\n';
-        "vOnlineAccounts" := vector_concat ("vOnlineAccounts", vector (data[N][28]));
-      }
-      if (data[N][30] is not null and data[N][30] <> '' and not ODS.ODS_API.vector_contains ("vSameAs", data[N][30]))
-      {
-        "sameAs" := "sameAs" || data[N][30] || '\n';
-        "vSameAs" := vector_concat ("vSameAs", vector (data[N][30]));
+        appendPropertyArray (V, N, meta[N], row[N], meta, row);
+      } else {
+        appendProperty (V, meta[N], row[N]);
       }
+      N := N + 1;
+    }
   }
   }
-  if (certLogin <> '')
-    appendProperty (V, 'certLogin', certLogin);
-  if ("interest" <> '')
-    appendProperty (V, 'interest', "interest");
-  if ("topic_interest" <> '')
-    appendProperty (V, 'topic_interest', "topic_interest");
-  if ("onlineAccounts" <> '')
-    appendProperty (V, 'onlineAccounts', "onlineAccounts");
-  if ("sameAs" <> '')
-    appendProperty (V, 'sameAs', "sameAs");
-
-_exit:;
-  exec (sprintf ('SPARQL clear graph <%s>', foafGraph), st, msg, vector (), 0);
  return V;
   }
 ;
@@ -4010,25 +4961,60 @@ create procedure ODS.ODS_API."user.getFOAFData" (
   {
     return case when outputMode then obj2json (null) else null end;
   };
-  V := ODS.ODS_API.get_foaf_data_array (foafIRI, spongerMode, sslFOAFCheck, sslLoginCheck);
+  V := ODS.ODS_API.getFOAFDataArray (foafIRI, sslFOAFCheck, sslLoginCheck);
   return case when outputMode then params2json (V) else V end;
 }
 ;
 
+create procedure ODS.ODS_API.SSL_WEBID_GET (in cert any := null)
+{
+  return DB.DBA.FOAF_SSL_WEBID_GET (cert);
+}
+;
+
 create procedure ODS.ODS_API."user.getFOAFSSLData" (
   in sslFOAFCheck integer := 0,
   in outputMode integer := 1,
   in sslLoginCheck integer := 0) __soap_http 'application/json'
 {
-  declare foafIRI any;
+  declare foafIRI, alts any;
   declare V any;
 
-  foafIRI := get_certificate_info (7, null, null, null, '2.5.29.17');
-  if (not isnull (foafIRI) and (foafIRI like 'URI:%'))
+  foafIRI := ODS.ODS_API.SSL_WEBID_GET ();
+  if (not isnull (foafIRI))
   {
-    foafIRI := subseq (foafIRI, 4);
-    V := ODS.ODS_API."user.getFOAFData" (foafIRI, 0, sslFOAFCheck, outputMode, sslLoginCheck);
-    return V;
+    try_auth:
+    V := ODS.ODS_API.getFOAFDataArray (foafIRI, sslFOAFCheck, sslLoginCheck);
+    return case when outputMode then params2json (V) else V end;
+  }
+  else if (is_https_ctx ()) -- try webfinger
+  {
+    declare agent any;
+    agent := DB.DBA.FOAF_SSL_WEBFINGER ();
+    if (agent is not null)
+      {
+	declare certLogin, certLoginEnable any;
+	certLogin := 0;
+	certLoginEnable := 0;
+	V := vector ();
+	for (select UC_LOGIN from DB.DBA.WA_USER_CERTS where UC_FINGERPRINT = get_certificate_info (6)) do
+	  {
+	    certLogin := 1;
+	    certLoginEnable := coalesce (UC_LOGIN, 0);
+	    appendProperty (V, 'certLogin', certLogin);
+	    appendProperty (V, 'certLoginEnable', certLoginEnable);
+	    appendProperty (V, 'iri', agent);
+	    appendProperty (V, 'mbox', get_certificate_info (10, null, 0, '', 'emailAddress'));
+	    appendProperty (V, 'name', get_certificate_info (10, null, 0, '', 'CN'));
+	    return case when outputMode then params2json (V) else V end;
+	  }
+      }
+    else
+      {
+	foafIRI := ODS..FINGERPOINT_WEBID_GET ();
+	if (foafIRI is not null)
+	  goto try_auth;
+      }
   }
   return case when outputMode then obj2json (null) else null end;
 }
@@ -4083,6 +5069,103 @@ create procedure ODS.ODS_API."user.getFacebookData" (
 }
 ;
 
+create procedure ODS.ODS_API."user.getKnowsData" (
+  in sourceURI varchar,
+  in spongerMode integer := 0) __soap_http 'application/json'
+{
+  declare N integer;
+  declare S, sourceIRI, foafGraph varchar;
+  declare V, st, msg, data, meta any;
+  declare knows, seeAlso, nick, name, uri, label any;
+
+  set_user_id ('dba');
+
+  V := rfc1808_parse_uri (trim (sourceURI));
+  V[5] := '';
+  sourceIRI := DB.DBA.vspx_uri_compose (V);
+
+  -- V := vector (vector_concat (jsonObject (), vector ('label', 'mara', 'uri', 'http://mara.com#this')));
+  V := vector ();
+  foafGraph := 'http://local.virt/FOAF/' || cast (rnd (1000) as varchar);
+  if (spongerMode)
+  {
+    S := sprintf ('sparql define get:soft "soft" define input:grab-destination <%s> select * from <%S> where { ?s ?p ?o }', foafGraph, sourceIRI);
+  } else {
+    S := sprintf ('sparql load <%s> into graph <%s>', sourceIRI, foafGraph);
+  }
+  st := '00000';
+  commit work;
+  exec (S, st, msg, vector (), 0);
+  if (st <> '00000')
+    goto _exit;
+
+  S := sprintf ('sparql
+                 define input:storage ""
+                 prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+                 prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+                 prefix dc: <http://purl.org/dc/elements/1.1/>
+                 prefix foaf: <http://xmlns.com/foaf/0.1/>
+                 select ?knows
+                        ?nick
+                        ?name
+		               from <%s>
+                  where {
+                          [] a foaf:PersonalProfileDocument ;
+                             foaf:primaryTopic ?person .
+                          ?person foaf:knows ?knows.
+                          optional {?knows foaf:nick ?nick.}
+                          optional {?knows foaf:name ?name.}
+                        }
+                  order by ?knows', foafGraph);
+  commit work;
+  exec (S, st, msg, vector (), 0, meta, data);
+  if (st <> '00000')
+    goto _exit;
+
+  knows := '';
+  nick := '';
+  name := '';
+  for (N := 0; N < length (data); N := N + 1)
+  {
+    if (knows <> data[N][0])
+    {
+      if (knows <> '')
+      {
+        -- store data
+        uri := knows;
+        if (uri not like 'nodeID:%')
+        {
+          label := name;
+          if (label = '')
+          {
+            label := nick;
+          }
+          else if (nick <> '')
+          {
+            label := name || ' (' || nick || ')';
+          }
+          V := vector_concat (V, vector (vector_concat (jsonObject (), vector ('uri', uri, 'label', label))));
+        }
+      }
+
+      -- start new collect data
+      knows := data[N][0];
+      nick := '';
+      name := '';
+    }
+    if ((nick = '') and not DB.DBA.is_empty_or_null (data[N][1]))
+      nick := data[N][1];
+
+    if ((name = '') and not DB.DBA.is_empty_or_null (data[N][2]))
+      name := data[N][2];
+  }
+
+_exit:;
+  exec (sprintf ('SPARQL clear graph <%s>', foafGraph), st, msg, vector (), 0);
+  return obj2json (V);
+}
+;
+
 -- Application instance activity
 create procedure ODS.ODS_API."instance.create" (
 	in "type" varchar,
@@ -4496,6 +5579,8 @@ DB.DBA.VHOST_DEFINE (lpath=>'/ods/api', ppath=>'/SOAP/Http', soap_user=>'ODS_API
 
 grant execute on ODS.ODS_API.error_handler to ODS_API;
 
+grant execute on ODS.ODS_API."qrcode" to ODS_API;
+
 grant execute on ODS.ODS_API."ontology.classes" to ODS_API;
 grant execute on ODS.ODS_API."ontology.classProperties" to ODS_API;
 grant execute on ODS.ODS_API."ontology.objects" to ODS_API;
@@ -4503,12 +5588,18 @@ grant execute on ODS.ODS_API."ontology.objects" to ODS_API;
 grant execute on ODS.ODS_API."lookup.list" to ODS_API;
 
 grant execute on ODS.ODS_API."server.getInfo" to ODS_API;
-
 grant execute on ODS.ODS_API."address.geoData" to ODS_API;
 
+grant execute on ODS.ODS_API."twitterServer" to ODS_API;
+grant execute on ODS.ODS_API."twitterVerify" to ODS_API;
+
+grant execute on ODS.ODS_API."linkedinServer" to ODS_API;
+grant execute on ODS.ODS_API."linkedinVerify" to ODS_API;
+
 grant execute on ODS.ODS_API."user.register" to ODS_API;
 grant execute on ODS.ODS_API."user.authenticate" to ODS_API;
 grant execute on ODS.ODS_API."user.login" to ODS_API;
+grant execute on ODS.ODS_API."user.validate" to ODS_API;
 grant execute on ODS.ODS_API."user.logout" to ODS_API;
 grant execute on ODS.ODS_API."user.update" to ODS_API;
 grant execute on ODS.ODS_API."user.update.fields" to ODS_API;
@@ -4522,6 +5613,7 @@ grant execute on ODS.ODS_API."user.disable" to ODS_API;
 grant execute on ODS.ODS_API."user.get" to ODS_API;
 grant execute on ODS.ODS_API."user.info" to ODS_API;
 grant execute on ODS.ODS_API."user.info.webID" to ODS_API;
+grant execute on ODS.ODS_API."user.certificateUrl" to ODS_API;
 grant execute on ODS.ODS_API."user.search" to ODS_API;
 grant execute on ODS.ODS_API."user.invite" to ODS_API;
 grant execute on ODS.ODS_API."user.invitation" to ODS_API;
@@ -4540,6 +5632,7 @@ grant execute on ODS.ODS_API."user.thingOfInterest.new" to ODS_API;
 grant execute on ODS.ODS_API."user.thingOfInterest.delete" to ODS_API;
 grant execute on ODS.ODS_API."user.annotation.new" to ODS_API;
 grant execute on ODS.ODS_API."user.annotation.delete" to ODS_API;
+grant execute on ODS.ODS_API."user.onlineAccounts.uri" to ODS_API;
 grant execute on ODS.ODS_API."user.onlineAccounts.list" to ODS_API;
 grant execute on ODS.ODS_API."user.onlineAccounts.new" to ODS_API;
 grant execute on ODS.ODS_API."user.onlineAccounts.delete" to ODS_API;
@@ -4566,6 +5659,27 @@ grant execute on ODS.ODS_API."user.seeks.get" to ODS_API;
 grant execute on ODS.ODS_API."user.seeks.new" to ODS_API;
 grant execute on ODS.ODS_API."user.seeks.edit" to ODS_API;
 grant execute on ODS.ODS_API."user.seeks.delete" to ODS_API;
+grant execute on ODS.ODS_API."user.owns.list" to ODS_API;
+grant execute on ODS.ODS_API."user.owns.get" to ODS_API;
+grant execute on ODS.ODS_API."user.owns.new" to ODS_API;
+grant execute on ODS.ODS_API."user.owns.edit" to ODS_API;
+grant execute on ODS.ODS_API."user.owns.delete" to ODS_API;
+grant execute on ODS.ODS_API."user.likes.list" to ODS_API;
+grant execute on ODS.ODS_API."user.likes.get" to ODS_API;
+grant execute on ODS.ODS_API."user.likes.new" to ODS_API;
+grant execute on ODS.ODS_API."user.likes.edit" to ODS_API;
+grant execute on ODS.ODS_API."user.likes.delete" to ODS_API;
+grant execute on ODS.ODS_API."user.knows.list" to ODS_API;
+grant execute on ODS.ODS_API."user.knows.get" to ODS_API;
+grant execute on ODS.ODS_API."user.knows.new" to ODS_API;
+grant execute on ODS.ODS_API."user.knows.edit" to ODS_API;
+grant execute on ODS.ODS_API."user.knows.delete" to ODS_API;
+grant execute on ODS.ODS_API."user.certificates.list" to ODS_API;
+grant execute on ODS.ODS_API."user.certificates.get" to ODS_API;
+grant execute on ODS.ODS_API."user.certificates.new" to ODS_API;
+grant execute on ODS.ODS_API."user.certificates.edit" to ODS_API;
+grant execute on ODS.ODS_API."user.certificates.delete" to ODS_API;
+grant execute on ODS.ODS_API."user.getKnowsData" to ODS_API;
 grant execute on ODS.ODS_API."user.getFOAFData" to ODS_API;
 grant execute on ODS.ODS_API."user.getFOAFSSLData" to ODS_API;
 grant execute on ODS.ODS_API."user.getFacebookData" to ODS_API;
diff --git a/appsrc/ODS-Framework/ods_ubiquity.html b/appsrc/ODS-Framework/ods_ubiquity.html
index 2e218de..3bab0c3 100644
--- a/appsrc/ODS-Framework/ods_ubiquity.html
+++ b/appsrc/ODS-Framework/ods_ubiquity.html
@@ -18,7 +18,7 @@
      </p>
     </div>
     <div id="footer">
-      <div id="ft_t">Copyright © 1998-2010 OpenLink Software</div>
+      <div id="ft_t">Copyright © 1998-2011 OpenLink Software</div>
       <div id="ft_b">
         <a href="http://virtuoso.openlinksw.com" title="OpenLink Virtuoso"><img class="powered_by" src="/ods/images/PoweredByVirtuoso.gif" alt="Powered by OpenLink Virtuoso"/></a>
       </div>
diff --git a/appsrc/ODS-Framework/ods_ubiquity.js b/appsrc/ODS-Framework/ods_ubiquity.js
index 1bbdbf9..e5e30bd 100644
--- a/appsrc/ODS-Framework/ods_ubiquity.js
+++ b/appsrc/ODS-Framework/ods_ubiquity.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: ods_ubiquity.js,v 1.23.2.6 2010/01/25 16:10:53 source Exp $
+ *  $Id: ods_ubiquity.js,v 1.23.2.7 2010/09/20 10:15:23 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Framework/ods_upstream.sql b/appsrc/ODS-Framework/ods_upstream.sql
new file mode 100644
index 0000000..2306320
--- /dev/null
+++ b/appsrc/ODS-Framework/ods_upstream.sql
@@ -0,0 +1,180 @@
+--set ignore_params=on;
+
+use ODS;
+
+create procedure ODS.ODS_API.get_oauth_tok (in app varchar)
+{
+  declare uid int;
+  return (select a_key from OAUTH..APP_REG where a_name = app and a_owner = 0);
+}
+;
+
+create procedure ODS.ODS_API.oauth_allowed (in uri varchar) __SOAP_HTTP 'text/plain'
+{
+  if (uri like 'http://twitter.com/%' or uri like 'http://www.linkedin.com/in/%')
+    return 1;
+  return 0;
+}
+;
+
+create procedure ODS.ODS_API.oauth_connect (in uri varchar) __SOAP_HTTP 'text/plain'
+{
+  if (uri like 'http://twitter.com/%') 
+    return ODS.ODS_API.oauth_connect_twitter (uri);
+  else if (uri like 'http://www.linkedin.com/in/%')
+    return ODS.ODS_API.oauth_connect_linkedin (uri);
+  else 
+    return '';  
+}
+;
+
+create procedure ODS.ODS_API.oauth_connect_twitter (in uri varchar) __SOAP_HTTP 'text/plain'
+{
+  declare tok, res, url, sid, oauth_tok, ret_url, screen_name, tmp, params any;
+  params := http_param ();
+  sid := {?'sid'};
+  screen_name := null;
+  tok := ODS.ODS_API.get_oauth_tok ('Twitter API');
+  if ({?'login'} is not null)
+    {
+      sid := md5 (datestring (now ()));
+      ret_url := sprintf ('http://%{WSHost}s%s?sid=%U&uri=%U', http_path(), sid, uri);
+      url := OAUTH..sign_request ('GET', 'http://twitter.com/oauth/request_token', sprintf ('oauth_callback=%U', ret_url), tok, null, 1); 
+      res := http_get (url);
+      dbg_obj_print (res);
+      sid := OAUTH..parse_response (sid, tok, res);
+
+      OAUTH..set_session_data (sid, params);
+      oauth_tok := OAUTH..get_auth_token (sid);
+      url := sprintf ('http://twitter.com/oauth/authenticate?oauth_token=%U', oauth_tok);
+      --http_status_set (302);
+      --http_header (sprintf ('Location: %s\r\n', url)); 
+      return url;
+    }
+  else if ({?'oauth_verifier'} is not null)
+    {
+      declare header, auth any;
+      dbg_obj_print (params);
+      url := OAUTH..sign_request ('GET', 'http://twitter.com/oauth/access_token', 
+		sprintf ('oauth_token=%U&oauth_verifier=%U', {?'oauth_token'}, {?'oauth_verifier'}), 
+			tok, sid, 1);
+      dbg_obj_print (url);
+      res := http_get (url);
+      dbg_obj_print (res);
+      sid := OAUTH..parse_response (sid, tok, res);
+      tmp := split_and_decode (res, 0);
+      screen_name := get_keyword ('screen_name', tmp);  
+
+      -- auth := OAUTH..signed_request_header ('GET', 'http://api.twitter.com/1/users/lookup.xml', sprintf ('screen_name=%U', screen_name), tok, '', sid, 0);
+      -- url := sprintf ('http://api.twitter.com/1/users/lookup.xml?screen_name=%U', screen_name);
+      -- dbg_obj_print_vars (url, auth);
+      -- res := http_get (url, header, 'GET', auth);
+      -- dbg_printf ('%s', res);
+      update DB.DBA.WA_USER_OL_ACCOUNTS set WUO_OAUTH_SID = sid where WUO_URL = uri;
+      commit work;
+      http_header ('Content-Type: text/html\r\n');
+      http ('<script type="text/javascript">');      
+      http ('  window.opener.location.reload();');
+      http ('  window.opener.focus ();');
+      http ('  window.close ();');
+      http ('</script>');
+      return'';
+    }
+  return null;
+}
+;
+
+create procedure ODS.ODS_API.oauth_connect_linkedin (in uri varchar) __SOAP_HTTP 'text/plain'
+{
+  declare tok, res, url, sid, oauth_tok, ret_url, screen_name, tmp, params, profile_url any;
+  params := http_param ();
+  sid := {?'sid'};
+  profile_url := null;
+  tok := ODS.ODS_API.get_oauth_tok ('LinkedIn API');
+  if ({?'login'} is not null)
+    {
+      sid := md5 (datestring (now ()));
+      ret_url := sprintf ('http://%{WSHost}s%s?sid=%U&uri=%U', http_path(), sid, uri);
+      url := OAUTH..sign_request ('GET', 'https://api.linkedin.com/uas/oauth/requestToken', sprintf ('oauth_callback=%U', ret_url), tok, null, 1); 
+      res := http_get (url);
+      dbg_obj_print_vars (url, res);
+      sid := OAUTH..parse_response (sid, tok, res);
+
+      OAUTH..set_session_data (sid, params);
+      oauth_tok := OAUTH..get_auth_token (sid);
+      url := sprintf ('https://www.linkedin.com/uas/oauth/authenticate?oauth_token=%U', oauth_tok);
+      return url;
+    }
+  else if ({?'oauth_verifier'} is not null)
+    {
+      declare header, auth any;
+      dbg_obj_print (params);
+      url := OAUTH..sign_request ('GET', 'https://api.linkedin.com/uas/oauth/accessToken', 
+		sprintf ('oauth_token=%U&oauth_verifier=%U', {?'oauth_token'}, {?'oauth_verifier'}), 
+			tok, sid, 1);
+      dbg_obj_print (url);
+      res := http_get (url);
+      dbg_obj_print (res);
+      sid := OAUTH..parse_response (sid, tok, res);
+
+      url := OAUTH..sign_request ('GET', 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,industry,public-profile-url,date-of-birth)', '', tok, sid, 1);
+      dbg_obj_print_vars (url);
+      res := http_get (url);
+      dbg_printf ('%s', res);
+      update DB.DBA.WA_USER_OL_ACCOUNTS set WUO_OAUTH_SID = sid where WUO_URL = uri;
+      commit work;
+      http_header ('Content-Type: text/html\r\n');
+      http ('<script type="text/javascript">');      
+      http ('  window.opener.location.reload();');
+      http ('  window.opener.focus ();');
+      http ('  window.close ();');
+      http ('</script>');
+      return'';
+    }
+  return null;
+}
+;
+
+create procedure ODS.ODS_API.oauth_disconnect (in uri varchar) __SOAP_HTTP 'text/plain'
+{
+  for select WUO_OAUTH_SID from DB.DBA.WA_USER_OL_ACCOUNTS where WUO_URL = uri do
+    {
+      OAUTH..session_terminate (WUO_OAUTH_SID);
+    }
+  update DB.DBA.WA_USER_OL_ACCOUNTS set WUO_OAUTH_SID = null where WUO_URL = uri;
+  return null;
+}
+;
+
+create procedure ODS.ODS_API.twitter_status_update (in txt varchar, in sid varchar)
+{
+  declare url, auth, header, res, tok, pars varchar;
+  txt := "LEFT" (txt, 140);
+  url := 'http://api.twitter.com/1/statuses/update.xml';
+  pars := sprintf ('status=%U&trim_user=1', txt);
+  tok := ODS.ODS_API.get_oauth_tok ('Twitter API');
+  auth := OAUTH..signed_request_header ('POST', url, pars, tok, '', sid, 0);
+  res := http_get (url, header, 'POST', auth, pars);
+  dbg_obj_print_vars (header);
+  return res;
+}
+;
+
+create procedure ODS.ODS_API.twitter_status_delete (in id varchar, in sid varchar)
+{
+  declare url, auth, header, res, tok, pars varchar;
+  url := sprintf ('http://api.twitter.com/1/statuses/destroy/%s.xml', id);
+  pars := sprintf ('trim_user=1');
+  tok := ODS.ODS_API.get_oauth_tok ('Twitter API');
+  auth := OAUTH..signed_request_header ('POST', url, pars, tok, '', sid, 0);
+  res := http_get (url, header, 'POST', auth, pars);
+  dbg_obj_print_vars (header);
+  return res;
+}
+;
+
+grant execute on ODS.ODS_API.oauth_allowed to ODS_API;
+grant execute on ODS.ODS_API.oauth_connect to ODS_API;
+grant execute on ODS.ODS_API.oauth_disconnect to ODS_API;
+
+use DB;
diff --git a/appsrc/ODS-Framework/oid_login.vspx b/appsrc/ODS-Framework/oid_login.vspx
deleted file mode 100644
index 28d8609..0000000
--- a/appsrc/ODS-Framework/oid_login.vspx
+++ /dev/null
@@ -1,56 +0,0 @@
-<!--
- -
- -  $Id: oid_login.vspx,v 1.1 2007/05/22 12:00:58 source Exp $
- -
- -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- -  project.
- -
- -  Copyright (C) 1998-2006 OpenLink Software
- -
- -  This project is free software; you can redistribute it and/or modify it
- -  under the terms of the GNU General Public License as published by the
- -  Free Software Foundation; only version 2 of the License, dated June 1991.
- -
- -  This program is distributed in the hope that it will be useful, but
- -  WITHOUT ANY WARRANTY; without even the implied warranty of
- -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- -  General Public License for more details.
- -
- -  You should have received a copy of the GNU General Public License along
- -  with this program; if not, write to the Free Software Foundation, Inc.,
- -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- -
--->
-<v:page name="blog-home-page"
-        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
-        xmlns:v="http://www.openlinksw.com/vspx/"
-        style="index.xsl"
-        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
-        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-  <vm:page>
-    <vm:header>
-      <vm:title>Virtuoso Web Applications</vm:title>
-    </vm:header>
-    <vm:pagewrapper>
-      <vm:rawheader caption=""/>
-      <vm:body default-input="username">
-        <div id="login_page">
-          <h1 class="page_title">
-            <?vsp
-              declare copy varchar;
-              copy := (select top 1 WS_WEB_TITLE from WA_SETTINGS);
-
-              if (copy = '' or copy is null)
-                http(sys_stat ('st_host_name'));
-              else
-                http(copy);
-            ?>
-          </h1>
-          <vm:login mode="oid"/>
-        </div>
-      </vm:body>
-    </vm:pagewrapper>
-  </vm:page>
-</v:page>
-
-
diff --git a/appsrc/ODS-Framework/openid.sql b/appsrc/ODS-Framework/openid.sql
index 252f19d..5d73996 100644
--- a/appsrc/ODS-Framework/openid.sql
+++ b/appsrc/ODS-Framework/openid.sql
@@ -1,5 +1,5 @@
 --
---  $Id: openid.sql,v 1.17.2.2 2010/07/07 18:53:57 source Exp $
+--  $Id: openid.sql,v 1.17.2.6 2010/09/20 10:15:24 source Exp $
 --
 --  OpenID protocol support.
 --
@@ -58,10 +58,14 @@ OPENID_INIT ();
 
 create procedure yadis (in uname varchar, in tp varchar := null)
 {
-  declare url, srv varchar;
+  declare url, ssl, srv varchar;
   if (tp not in ('person/', 'organization/'))
     tp := '';
   url := db.dba.wa_link (1, '/dataspace/'||tp||uname);
+  ssl := ODS..getDefaultHttps ();
+  if (exists (select 1 from DB..WA_SETTINGS where WS_HTTPS = 1) and ssl is not null)
+    srv := 'https://' || ssl || '/openid';
+  else  
   srv := db.dba.wa_link (1, '/openid');
   for select WAUI_OPENID_URL, WAUI_OPENID_SERVER, WAUI_NICK
     from DB.DBA.WA_USER_INFO, DB.DBA.SYS_USERS where WAUI_U_ID = U_ID and U_NAME = uname
@@ -112,6 +116,22 @@ create procedure sreg_ns_v1 ()
   return 'http://openid.net/extensions/sreg/1.1';
 }
 ;
+
+create procedure oauth_ns ()
+{
+  return 'http://specs.openid.net/extensions/oauth/1.0';
+}
+;
+
+create procedure check_session (in _identity varchar, in sid varchar)
+{
+  declare uname varchar;
+  uname := oid_get_user_id (_identity);
+  delete from DB.DBA.VSPX_SESSION where VS_SID = sid and VS_REALM = 'wa' and VS_UID <> uname;
+  return row_count ();
+}
+;
+
 create procedure server
 	(
 	 in "openid.mode" varchar := 'unknown'
@@ -119,8 +139,8 @@ create procedure server
 	__SOAP_HTTP 'text/html'
 {
   declare ret, lines, params, oid_sid, cookies_vec any;
-  declare ns varchar;
-  declare ver int;
+  declare ns, oauth_ns, op varchar;
+  declare ver, pos int;
 
   params := http_param ();
   lines := http_request_header ();
@@ -131,11 +151,25 @@ create procedure server
   cookies_vec := DB.DBA.vsp_ua_get_cookie_vec (lines);
   oid_sid := get_keyword ('openid.sid', cookies_vec);
   ns := get_keyword ('openid.ns', params, 'http://openid.net/signon/1.1');
+  oauth_ns := 'openid.oauth.';	
+  pos := position (oauth_ns (), params);
+  if (pos > 1)
+    {
+      declare tmp any;
+      tmp := params [pos - 2];
+      tmp := sprintf_inverse (tmp, '%s.%s.%s', 0);
+      if (length (tmp) = 3 and tmp[0] = 'openid' and tmp[1] = 'ns')
+	oauth_ns := 'openid.' || tmp[2] || '.';
+    }
 
   if (ns = ns_v2 ())
     ver := 2;
   else
     ver := 1;
+  if (is_https_ctx ())
+    op := sprintf ('https://%{WSHost}s/openid');
+  else  
+    op := sprintf ('http://%{WSHost}s/openid');
 
   if ("openid.mode" = 'associate')
     ret := associate (ver,
@@ -155,7 +189,10 @@ create procedure server
 	0,
 	get_keyword ('openid.sreg.required', params),
 	get_keyword ('openid.sreg.optional', params),
-	get_keyword ('openid.sreg.policy_url', params)
+	get_keyword ('openid.sreg.policy_url', params),
+	get_keyword (oauth_ns || 'consumer', params),
+	get_keyword (oauth_ns || 'scope', params),
+	op
 	);
   else if ("openid.mode" = 'checkid_setup')
     ret := checkid_setup (
@@ -167,7 +204,10 @@ create procedure server
 	oid_sid,
 	get_keyword ('openid.sreg.required', params),
 	get_keyword ('openid.sreg.optional', params),
-	get_keyword ('openid.sreg.policy_url', params)
+	get_keyword ('openid.sreg.policy_url', params),
+	get_keyword (oauth_ns || 'consumer', params),
+	get_keyword (oauth_ns || 'scope', params),
+	op
 	);
   else if ("openid.mode" = 'check_authentication')
     ret := check_authentication (
@@ -450,11 +490,14 @@ create procedure checkid_immediate
 	 in flag int := 0, -- called via checkid_setup
 	 in sreg_required varchar := null,
 	 in sreg_optional varchar := null,
-	 in policy_url varchar := null
+	 in policy_url varchar := null,
+	 in oauth_consumer varchar := null,
+	 in oauth_scope varchar := null,
+	 in op varchar := null
     	)
 {
   declare signature, rhf, delim any;
-  declare login, hdr, usr, ns, ns_sign varchar;
+  declare login, hdr, usr, ns, ns_sign, tok, oauthf, oauth_resp varchar;
 
   if (trust_root is null)
     trust_root := _identity;
@@ -463,10 +506,12 @@ create procedure checkid_immediate
     return 'error:no_identity';
   if (length (return_to) = 0)
     return 'error:no_return_to';
-
---  dbg_obj_print ('checkid_immediate', sid, ' ver ', ver);
+  check_session (_identity, sid);
+  --dbg_obj_print_vars ('checkid_immediate', sid, ver);
   ns := '';
   ns_sign := '';
+  oauthf := ''; 
+  oauth_resp := '';
   if (isstring (ver))
     ver := atoi (ver);
   if (ver = 2)
@@ -484,9 +529,13 @@ create procedure checkid_immediate
       else
         delim := '?';
       login :=
-      sprintf ('%s?return_to=%U&identity=%U&assoc_handle=%U&trust_root=%U&sreg_required=%U&sreg_optional=%U&policy_url=%U&ver=%d',
-	    get_login_url (_identity), return_to, _identity, coalesce (assoc_handle, ''), trust_root,
-	    coalesce (sreg_required, ''), coalesce (sreg_optional, ''), coalesce (policy_url, ''), ver);
+      sprintf ('%s?return_to=%U&identity=%U&assoc_handle=%U&trust_root=%U&sreg_required=%U&sreg_optional=%U&policy_url=%U&ver=%d&op_endpoint=%U',
+	    get_login_url (_identity), return_to, _identity, coalesce (assoc_handle, ''), coalesce (trust_root, ''),
+	    coalesce (sreg_required, ''), coalesce (sreg_optional, ''), coalesce (policy_url, ''), ver, op);
+      if (length (oauth_consumer))
+        {
+          login := login || sprintf ('&oauth_consumer=%U&oauth_scope=%U', oauth_consumer, oauth_scope);
+        }	  
       --dbg_obj_print (sprintf ('Location: %s?openid.mode=id_res&openid.user_setup_url=%U\r\n', return_to, login));
       http_header (http_header_get () || sprintf ('Location: %s%sopenid.mode=id_res%s&openid.user_setup_url=%U\r\n',
 	    return_to, delim, ns, login));
@@ -582,6 +631,11 @@ create procedure checkid_immediate
 		  values (assoc_handle, ss_key, ss_key_data, '3DES', dateadd ('hour', 1, now()));
 	    }
 	}
+      -- make OAuth request_token call 
+      if (length (oauth_consumer) > 0)	  
+	tok := OAUTH..hybrid_request_token (sid, oauth_consumer);	  
+      else
+        tok := null;	
 
       rhf := WS.WS.PARSE_URI (return_to);
       if (rhf[4] <> '')
@@ -600,10 +654,15 @@ create procedure checkid_immediate
 
       if (ver = 2)
 	{
-	  declare op, nonce varchar;
-	  op := db.dba.wa_link (1, '/openid');
-	  if (0 and is_https_ctx ())
-	    op := 'https://' || DB.DBA.WA_HTTPS() || '/openid';
+	  declare nonce varchar;
+	  --op := db.dba.wa_link (1, '/openid');
+	  if (op is null)
+	    {
+	  if (is_https_ctx ())
+	    op := sprintf ('https://%{WSHost}s/openid');
+	  else  
+	    op := sprintf ('http://%{WSHost}s/openid');
+	    }
 	  nonce := DB.DBA.date_iso8601 (dt_set_tz (curdatetime (0), 0)) || cast (msec_time () as varchar);
 	  ns := sprintf ('&openid.ns=%U&openid.ns.sreg=%U&openid.op_endpoint=%U&openid.response_nonce=%U&openid.claimed_id=%U',
 	  ns_v2 (), sreg_ns_v1 (), op, nonce, _identity);
@@ -634,7 +693,20 @@ create procedure checkid_immediate
 		}
 	    }
 	}
-
+      -- add ns.oauth, oauth.request_token and oauth.scope to the signature string
+      if (tok is not null)
+        {
+	  oauthf := ',ns.oauth,oauth.request_token';
+	  http (sprintf ('ns.oauth:%s\x0A', oauth_ns ()), ses);
+	  http (sprintf ('oauth.request_token:%s\x0A', tok), ses);
+	  oauth_resp := sprintf ('&openid.ns.oauth=%U&openid.oauth.request_token=%U', oauth_ns (), tok);
+	  if (length (oauth_scope) > 0)
+	    {
+	      oauthf := oauthf || ',oauth.scope';
+	      http (sprintf ('oauth.scope:%s\x0A', oauth_scope), ses);
+	      oauth_resp := oauth_resp || sprintf ('&openid.oauth.scope=%U', oauth_scope);
+	    }
+        }	  
 
       if (user <> 'OpenID')
         set_user_id ('OpenID');
@@ -648,9 +720,9 @@ create procedure checkid_immediate
       if (length (assoc_handle) = 0)
 	assoc_handle := '';
       hdr :=  sprintf ('Location: %s%sopenid.mode=id_res%s&openid.identity=%U&openid.return_to=%U'||
-      			'&openid.assoc_handle=%U&openid.signed=%U&openid.sig=%U%s%s\r\n',
+      			'&openid.assoc_handle=%U&openid.signed=%U&openid.sig=%U%s%s%s\r\n',
 	    		return_to, delim, ns, _identity, return_to, coalesce (assoc_handle, ''),
-			ns_sign||'mode,identity,return_to,assoc_handle'||sregf, signature, inv, sreg);
+			ns_sign||'mode,identity,return_to,assoc_handle'||sregf||oauthf, signature, inv, sreg, oauth_resp);
 --      dbg_obj_print ('hdr:', hdr);
       http_header (http_header_get () || hdr);
     }
@@ -668,10 +740,14 @@ create procedure checkid_setup
 	 in sid varchar,
 	 in sreg_required varchar := null,
 	 in sreg_optional varchar := null,
-	 in policy_url varchar := null
+	 in policy_url varchar := null,
+	 in oauth_consumer varchar := null,
+	 in oauth_scope varchar := null,
+	 in op varchar := null
 	 )
 {
   declare rhf, delim, login, ss_key any;
+  check_session (_identity, sid);
   if (not exists (select 1 from DB.DBA.VSPX_SESSION where VS_SID = sid and VS_REALM = 'wa'))
     {
       rhf := WS.WS.PARSE_URI (return_to);
@@ -682,14 +758,19 @@ create procedure checkid_setup
       http_request_status ('HTTP/1.1 302 Found');
 
       login :=
-      sprintf ('%s?return_to=%U&identity=%U&assoc_handle=%U&trust_root=%U&sreg_required=%U&sreg_optional=%U&policy_url=%U&ver=%d',
-	    get_login_url (_identity), return_to, _identity, coalesce (assoc_handle, ''), trust_root,
-	    coalesce (sreg_required, ''), coalesce (sreg_optional, ''), coalesce (policy_url, ''), ver);
+      sprintf ('%s?return_to=%U&identity=%U&assoc_handle=%U&trust_root=%U&sreg_required=%U&sreg_optional=%U&policy_url=%U&ver=%d&op_endpoint=%U',
+	    get_login_url (_identity), return_to, _identity, coalesce (assoc_handle, ''), coalesce (trust_root, ''),
+	    coalesce (sreg_required, ''), coalesce (sreg_optional, ''), coalesce (policy_url, ''), ver, op);
+      if (length (oauth_consumer))
+        {
+          login := login || sprintf ('&oauth_consumer=%U&oauth_scope=%U', oauth_consumer, oauth_scope);
+        }	  
       http_header (http_header_get () || sprintf ('Location: %s\r\n', login));
       --http_header (http_header_get () || sprintf ('Location: %s%sopenid.mode=cancel\r\n', return_to, delim));
       return '';
     }
-  return checkid_immediate (ver, _identity, assoc_handle, return_to, trust_root, sid, 1, sreg_required, sreg_optional, policy_url);
+  return checkid_immediate (ver, _identity, assoc_handle, return_to, trust_root, sid, 1, sreg_required, sreg_optional, policy_url, 
+      oauth_consumer, oauth_scope, op);
 };
 
 create procedure cancel (in ver int := 1, in return_to varchar)
@@ -731,8 +812,20 @@ create procedure oid_set_sid (in sid varchar, in pars any)
 
 create procedure oid_get_user_id (in _identity any)
 {
-  declare iarr, uname any;
+  declare iarr, uname, webid any;
+  declare webid, gr varchar;    
   uname := null;
+  --dbg_obj_print_vars (_identity);
+  if (strchr (_identity, '@') is not null)
+    { 
+      gr := sioc..get_graph ();
+      webid := (SPARQL 
+	       PREFIX owl: <http://www.w3.org/2002/07/owl#> 
+	       PREFIX foaf: <http://xmlns.com/foaf/0.1/>	 
+	       SELECT ?openid WHERE { graph `iri(?:gr)` { ?webid owl:sameAs `iri(?:_identity)` ; foaf:openid ?openid . }});
+      if (webid is not null)
+        _identity := webid;	
+    }	 
   if (regexp_match ('http://[^/]+/dataspace/(person|organization)/.+', _identity) is not null)
     {
       iarr := sprintf_inverse (_identity, 'http://%s/dataspace/%s/%s', 1);
@@ -796,11 +889,13 @@ create procedure get_login_url (in _identity any)
   uname := oid_get_user_id (_identity);
   whenever not found goto nf;
   select UC_CERT, UC_LOGIN into cert, enabled from DB.DBA.WA_USER_CERTS, DB.DBA.SYS_USERS where UC_U_ID = U_ID and U_NAME = uname;
-  if (length (cert) and enabled)
+  if (length (cert) and enabled) -- was and exists (select 1 from DB..WA_SETTINGS where WS_HTTPS = 1))
     {
       return wa_ssl_link (1, 'openid_login.vspx');
     }
   nf:
+  if (is_https_ctx ())
+    return sprintf ('https://%{WSHost}s/ods/openid_login.vspx');
   return DB.DBA.wa_link(1, 'openid_login.vspx');
 }
 ;
diff --git a/appsrc/ODS-Framework/openid_helper.vsp b/appsrc/ODS-Framework/openid_helper.vsp
index e119bb4..602ec02 100644
--- a/appsrc/ODS-Framework/openid_helper.vsp
+++ b/appsrc/ODS-Framework/openid_helper.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: openid_helper.vsp,v 1.3 2008/03/13 20:50:05 source Exp $
+--  $Id: openid_helper.vsp,v 1.3.2.1 2010/09/20 10:15:24 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Framework/openid_login.vspx b/appsrc/ODS-Framework/openid_login.vspx
index 39d9b93..8c9b43b 100644
--- a/appsrc/ODS-Framework/openid_login.vspx
+++ b/appsrc/ODS-Framework/openid_login.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: openid_login.vspx,v 1.8.2.2 2010/01/07 16:55:13 source Exp $
+ -  $Id: openid_login.vspx,v 1.8.2.8 2011/02/03 10:26:15 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -21,7 +21,7 @@
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  -
 -->
-<v:page name="blog-home-page"
+<v:page name="openid-login-page"
         xmlns:vm="http://www.openlinksw.com/vspx/ods/"
         xmlns:v="http://www.openlinksw.com/vspx/"
         style="index.xsl"
@@ -45,6 +45,9 @@
   <v:variable name="_sreg_required" type="varchar" default="null" persist="0" param-name="sreg_required" />
   <v:variable name="_sreg_optional" type="varchar" default="null" persist="0" param-name="sreg_optional" />
   <v:variable name="_policy_url" type="varchar" default="null" persist="0" param-name="policy_url" />
+  <v:variable name="_oauth_consumer" type="varchar" default="null" persist="0" param-name="oauth_consumer" />
+  <v:variable name="_oauth_scope" type="varchar" default="null" persist="0" param-name="oauth_scope" />
+  <v:variable name="_op_endpoint" type="varchar" default="null" persist="0" param-name="op_endpoint" />
   <v:variable name="_ver" type="varchar" default="1" persist="0" param-name="ver" />
   <v:variable name="_uname" type="varchar" default="null" persist="0" />
   <v:on-init><![CDATA[
@@ -55,11 +58,13 @@
 
     if (self._identity is null)
       {
-        self.vc_redirect ('login.vspx');
+        signal ('42000', 'Unknown identity.');
       }
     if (self._uname is null)
       {
-        tmp := rtrim (self._identity, '/');
+        tmp := self._identity;
+	again:
+        tmp := rtrim (tmp, '/');
         pos := strrchr (tmp, '/');
         if (pos is not null)
 	  {
@@ -69,15 +74,30 @@
 	    if (length (real_uid))
 	      self._uname := real_uid;
 	  }
+	else if (strchr (tmp, '@') is not null)  
+	  {
+	     declare webid, idn, gr, h varchar;    
+	     gr := sioc..get_graph ();
+	     idn := self._identity;
+	     tmp := (SPARQL 
+	       PREFIX owl: <http://www.w3.org/2002/07/owl#> 
+	       PREFIX foaf: <http://xmlns.com/foaf/0.1/>	 
+	       SELECT ?openid WHERE { graph `iri(?:gr)` { ?webid owl:sameAs `iri(?:idn)` ; foaf:openid ?openid . }});
+	     goto again;        
+	  }
 	else
-          self.vc_redirect ('login.vspx');
+          {
+            signal ('42000', sprintf ('Can not find ODS member for identity "%s"', self._identity));
+      }
       }
 
     cookie_vec := vsp_ua_get_cookie_vec(self.vc_event.ve_lines);
-    if (get_keyword('sid', self.vc_event.ve_params) is null and get_keyword('sid', cookie_vec) is not null
+    if (get_keyword('sid', self.vc_event.ve_params) is null 
+        and get_keyword('sid', cookie_vec) is not null
     	and self._identity is not null)
       {
 	sid := get_keyword('sid', cookie_vec);
+        if (not OPENID.DBA.check_session (self._identity, sid))
 	self.vc_event.ve_params := OPENID.DBA.oid_set_sid (sid, self.vc_event.ve_params);
 	  }
     if (get_keyword ('sid', self.vc_event.ve_params) is null and is_https_ctx ())
@@ -85,8 +105,11 @@
 	declare gr, stat, msg varchar;
 	declare rc int;
 	declare vec any;
+	gr := null;
 	rc := sioc.DBA.foaf_check_ssl_int (null, gr);
-	if (rc)
+	if (not rc)
+	gr := FOAF_SSL_WEBFINGER (null, 1);
+	if (gr is not null)
 	  {
 	    vec := OPENID.DBA.get_user_details (gr, self._identity);
 	    if (vec is not null)
@@ -133,7 +156,7 @@
 		  </h2>
               <div id="login_form">
                 <form> <!-- just to keep validator happy on this mockup -->
-		  <label for="login_frm_username">Member ID</label>
+		  <label for="login_frm_username">User ID</label>
 		  <v:text name="username" type="hidden" value="--self._uname" xhtml_id="login_frm_username" /><?V self._uname ?><br />
 		  <label for="password">Password</label>
 		  <v:text name="password" value="" xhtml_id="login_frm_password" type="password" />
@@ -198,7 +221,7 @@
           </div> <!-- form_col -->
 	  <v:template type="if-login" name="login_if_login"><?vsp
 	 OPENID..checkid_immediate (self._ver, self._identity, self._assoc_handle, self._return_to, self._trust_root, self.sid, 0,
-         self._sreg_required, self._sreg_optional, self._policy_url);
+         self._sreg_required, self._sreg_optional, self._policy_url, self._oauth_consumer, self._oauth_scope, self._op_endpoint);
 	 ?></v:template>
         <v:on-post><![CDATA[
   declare cook_str, expire varchar;
@@ -239,7 +262,6 @@
       self.vc_authenticated := 0;
       control.vl_authenticated := 0;
       connection_vars_set (null);
-      self.vc_redirect ('login.vspx');
       return;
     }
   else if (length (self.sid) and self.login_ip is null)
@@ -258,7 +280,7 @@
           <a href="/ods/privacy.html">Privacy</a> |
           <a href="/ods/rabuse.vspx">Report Abuse</a>
           <div class="copyright">
-            Copyright © 1998-2010 OpenLink Software
+            Copyright © 1998-2011 OpenLink Software
           </div>
         </div> <!-- FT_R -->
       </div>
diff --git a/appsrc/ODS-Framework/openid_oauth_test.vsp b/appsrc/ODS-Framework/openid_oauth_test.vsp
new file mode 100644
index 0000000..6967745
--- /dev/null
+++ b/appsrc/ODS-Framework/openid_oauth_test.vsp
@@ -0,0 +1,235 @@
+<?vsp 
+  declare open_id_url, oid_sig, oid_srv, oid_assoc_handle, oid_sig, oid_signed, error_message, tok, akey, sid, resp varchar;
+  declare step int;
+
+  error_message := ''; akey := '';
+  oid_sig := get_keyword ('openid.sig', params);
+  --oid_identity := get_keyword ('openid.identity', params);
+  oid_assoc_handle := get_keyword ('openid.assoc_handle', params);
+  oid_signed := get_keyword ('openid.signed', params);
+  oid_srv := get_keyword ('oid-srv', params);
+  open_id_url := get_keyword ('open_id_url', params, null);
+  tok := get_keyword ('okey', params, '');
+  akey := get_keyword ('openid.oauth.request_token', params, get_keyword ('akey', params, ''));
+  step := 0;
+--  dbg_obj_print_vars (params);
+  if ({?'back'})
+    OAUTH..session_terminate (get_keyword ('sid', params));
+  sid := get_keyword ('sid', params, xenc_rand_bytes (10, 1));
+  if (length (oid_sig))
+    {
+      declare url, pars, sig varchar;
+
+      url := sprintf ('%s?openid.mode=check_authentication&openid.assoc_handle=%U&openid.sig=%U&openid.signed=%U',
+      oid_srv, oid_assoc_handle, oid_sig, oid_signed);
+
+      pars := params;
+
+      sig := split_and_decode (oid_signed, 0, '\0\0,');
+      foreach (any el in sig) do
+        {
+          el := trim (el);
+          if (el not in ('mode', 'signed', 'assoc_handle'))
+          {
+            declare val any;
+            val := get_keyword ('openid.'||el, pars, '');
+            if (val <> '')
+              url := url || sprintf ('&openid.'||el||'=%U', val);
+          }
+        }
+	error_message := 'Login failed';
+        {
+          declare resp any;
+          declare exit handler for sqlstate '*'
+          {
+            goto auth_failed1;
+          };
+          resp := HTTP_CLIENT (url);
+          if (resp not like '%is_valid:%true\n%')
+            goto auth_failed1;
+        }
+        error_message := 'Login successful';
+        step := 1;
+      }
+    else if (get_keyword ('exec', params, '') <> '' and length (open_id_url))
+      {
+        declare hdr, xt, uoid, is_agreed any;
+        declare url, cnt, oi_ident, oi_srv, oi_delegate, host, this_page, trust_root, check_immediate varchar;
+        declare oi2_srv varchar;
+
+        host := http_request_header (lines, 'Host');
+
+        this_page := 'http://' || host || http_path ();
+        trust_root := 'http://' || host;
+
+        declare exit handler for sqlstate '*'
+        {
+          error_message := 'Invalid OpenID URL';
+          goto auth_failed1;
+        };
+
+        url := open_id_url;
+        oi_ident := url;
+        hdr := null;
+        cnt := DB.DBA.HTTP_CLIENT_EXT (url=>url, headers=>hdr, n_redirects=>15);
+        xt := xtree_doc (cnt, 2);
+        oi_srv := null; --cast (xpath_eval ('//link[contains (@rel, "openid.server")]/@href', xt) as varchar);
+        oi2_srv := cast (xpath_eval ('//link[contains (@rel, "openid2.provider")]/@href', xt) as varchar);
+        oi_delegate := cast (xpath_eval ('//link[contains (@rel, "openid.delegate")]/@href', xt) as varchar);
+
+        if (oi2_srv is not null)
+          oi_srv := oi2_srv;
+
+        if (oi_srv is null)
+          signal ('22023', 'Cannot locate OpenID server');
+
+        if (oi_delegate is not null)
+          oi_ident := oi_delegate;
+
+        this_page := this_page || sprintf ('?oid-srv=%U&okey=%U&sid=%U', oi_srv, tok, sid);
+
+        --dbg_obj_print_vars (oi2_srv);
+	check_immediate :=
+           sprintf 
+	     ('%s?openid.ns=%U&openid.ns.sreg=%U&openid.mode=checkid_setup&openid.identity=%U&openid.claimed_id=%U&openid.return_to=%U&openid.realm=%U',
+              oi_srv, OPENID..ns_v2 (), OPENID..sreg_ns_v1 (), oi_ident, oi_ident, this_page, trust_root);
+           if (length (tok))
+	     check_immediate := check_immediate || 
+		sprintf ('&openid.ns.oauth=%U&openid.oauth.consumer=%U', OPENID..oauth_ns (), tok);
+        http_status_set (302);
+        http_header (sprintf ('Location: %s\r\n', check_immediate));
+        return;
+      }
+    else if (get_keyword ('atok', params, '') <> '')    	
+      {
+        declare access_token, url varchar;
+	declare tmp any;
+	insert into OAUTH..CLI_SESSIONS (cs_sid, cs_token, cs_secret) values (sid, akey, '');
+	commit work;
+	url :=  OAUTH..sign_request ('GET', sprintf ('http://%{WSHost}s/OAuth/access_token'), '', tok, sid);
+	--dbg_obj_print_vars (url);
+	tmp := http_get (url);
+	--dbg_obj_print (tmp);
+	sid := OAUTH..parse_response (sid, tok, tmp);
+        step := 2;
+      }
+   else if (get_keyword ('run', params, '') <> '')
+      {
+        declare ep, pars, meth, url, req_url varchar;
+        ep := {?'ep'};
+        meth := {?'meth'};
+        pars := {?'pars'};
+        tok := OAUTH..get_consumer_key (sid);
+        url := sprintf ('%s%s', ep, meth);
+        req_url := OAUTH..sign_request ('GET', url, pars, tok, sid);
+        resp := http_client (req_url);
+        step := 3;
+      } 
+  auth_failed1:;
+?>
+<html>
+  <head>
+    <title>OpenID OAuth Extension test client</title>
+    <link rel="stylesheet" href="/ods/default.css" type="text/css" />
+  <style type="text/css">
+    html {
+      margin: 0;
+      padding: 0;
+    }
+
+    body {
+      font-family: gill sans, sans-serif;
+      font-size: 80%;
+      margin: 0;
+      padding: 1.2em 2em;
+    }
+
+    #header {
+      width: 100%;
+      float: left;
+      clear: left;
+      border-bottom: 2px solid #696;
+      margin: 0 0 1.2em;
+      padding: 0 0 0.3em;
+    }
+
+    #main-content
+    {
+     margin-left: 5px;
+     color: #000033;
+     padding-bottom: 5px;
+     padding-top: 0px;
+    }
+
+    h3.section {
+      color: #005395;
+      font-size: small;
+      margin-bottom: 0;
+      padding-bottom: 3px;
+      padding-top: 7px;
+    }
+    textarea
+    {
+     width: 500px;
+     font-size: 12px;
+     font-family: "Courier New", Courier, monospace;
+     overflow: visible;
+     /*overflow-y: hidden;*/
+     border: 1px solid #000;
+     padding: 3px;
+    }
+
+
+    label
+    {
+      font-weight: bold;
+    }
+
+    #footer {
+      width: 100%;
+      float: left;
+      clear: left;
+      border-top: 2px solid #696;
+      margin: 1.2em 0 0;
+      padding: 0.3em;
+      background-color: #fff;
+    }
+  </style>
+  <head>
+  <body>
+    <div>
+      <div style="padding: 10px; background-color: #D9E9F2;">
+        <img src="/ods/images/odslogo_200.png" alt="ODS logo icon" />
+      </div>
+      <div id="main-content">
+     <h1>OpenID OAuth Extension test client</h1>
+     <p><?V error_message ?></p>
+     <form method="get" action="<?V http_path () ?>">
+     <input type="hidden" value="<?V sid ?>" name="sid" />
+     <fieldset>
+     <?vsp if (step = 0) { ?> 
+     <label>OpenID URL</label> <input type="text" size="70" name="open_id_url" /><br/>
+     <label>Consumer Key (token)</label> <input type="text" size="70" name="okey" value="<?V tok ?>"/><br/>
+     <input type="submit" name="exec" value="Submit" /><br/>
+     <?vsp } ?>
+     <?vsp if (step = 1) { ?> 
+     <label>Consumer Key (token)</label> <input type="text" size="70" name="okey" value="<?V tok ?>"/><br/>
+     <label>Authorized Key (token)</label> <input type="text" size="70" name="akey" value="<?V akey ?>"/><br/>
+     <input type="submit" value="Get Access token" name="atok" />
+     <?vsp } ?>
+     <?vsp if (step = 2) { ?> 
+     <label>API Endpoint</label> <input type="text" size="70" name="ep" value="<?V sprintf ('http://localhost:%s/ods/api/', server_http_port ())  ?>"/><br/>
+     <label>Method</label> <input type="text" size="70" name="meth" value=""/><br/>
+     <label>Paremeters</label> <input type="text" size="70" name="pars" value=""/><br/>
+     <input type="submit" value="Execute" name="run" />
+     <?vsp } ?>
+     <?vsp if (step = 3) { ?>
+     <textarea name="resp" rows="20" cols="80"><?V resp ?></textarea><br/> 
+     <input type="submit" value="Start Over" name="back" />
+     <?vsp } ?>
+     </fieldset>
+     </form>
+     </div>
+    </div>
+  </body>
+</html>
diff --git a/appsrc/ODS-Framework/opensocial.sql b/appsrc/ODS-Framework/opensocial.sql
index c731f37..ff51d73 100644
--- a/appsrc/ODS-Framework/opensocial.sql
+++ b/appsrc/ODS-Framework/opensocial.sql
@@ -251,6 +251,11 @@ create procedure feed_act_head (in uid varchar, in srcId int, inout ses any)
 -- no alternate for now
 -- http (sprintf ('<link rel="alternate" type="text/html" href="%s"/>\n', url), ses);
   http (sprintf ('<link rel="self" type="application/atom+xml" href="%s"/>\n', url), ses);
+  for select SH_URL from ODS.DBA.SVC_HOST where SH_PROTO = 'PubSubHub' do 
+    {
+      http (sprintf ('<link rel="hub" href="%s"/>\n', SH_URL), ses);
+    }
+  http (sprintf ('<link rel="salmon" href="http://%{WSHost}s/ods/salmon"/>\n'), ses);
   http (sprintf ('<author><name>%s</name></author>\n', fname), ses);
 }
 ;
diff --git a/appsrc/ODS-Framework/pass_recovery.vspx b/appsrc/ODS-Framework/pass_recovery.vspx
index 5e8a4cf..165d86a 100644
--- a/appsrc/ODS-Framework/pass_recovery.vspx
+++ b/appsrc/ODS-Framework/pass_recovery.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: pass_recovery.vspx,v 1.5 2006/10/26 20:44:33 source Exp $
+ -  $Id: pass_recovery.vspx,v 1.5.2.1 2010/09/20 10:15:24 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/ping_log.vspx b/appsrc/ODS-Framework/ping_log.vspx
index 8f9f227..b32bf60 100644
--- a/appsrc/ODS-Framework/ping_log.vspx
+++ b/appsrc/ODS-Framework/ping_log.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ping_log.vspx,v 1.2 2006/10/26 20:44:33 source Exp $
+ -  $Id: ping_log.vspx,v 1.2.2.1 2010/09/20 10:15:24 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/ping_svc.vspx b/appsrc/ODS-Framework/ping_svc.vspx
index 2485848..dff8f92 100644
--- a/appsrc/ODS-Framework/ping_svc.vspx
+++ b/appsrc/ODS-Framework/ping_svc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ping_svc.vspx,v 1.3.2.1 2010/05/26 15:25:25 source Exp $
+ -  $Id: ping_svc.vspx,v 1.3.2.4 2011/03/08 13:28:15 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -27,7 +27,9 @@
         xmlns:v="http://www.openlinksw.com/vspx/"
         style="index.xsl"
         doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
-        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+        fast-render="1">
+
   <vm:page>
     <vm:header>
       <vm:title>Notification Services</vm:title>
@@ -54,10 +56,9 @@
 	      <tr class="listing_header_row">
 		  <th>Provider</th>
 		  <th>Endpoint</th>
-		  <th>Action</th>
+      		  <th width="5%">Action</th>
 	      </tr>
-	      <v:data-set name="maps" sql="select SH_URL, SH_NAME, SH_PROTO, SH_ID, SH_METHOD from ODS..SVC_HOST where SH_ID > 0"
-		  scrollable="1" editable="1" nrows="1000">
+          <v:data-set name="maps" sql="select SH_URL, SH_NAME, SH_PROTO, SH_ID, SH_METHOD from ODS..SVC_HOST where SH_ID > 0" scrollable="1" editable="1" nrows="0">
 		  <v:before-data-bind>
 if (not e.ve_is_post and self.del_svc is not null)
 {
@@ -88,14 +89,14 @@ if (not e.ve_is_post and control.te_rowset[3] = self.edit_svc)
 			      </td>
 			      <td>
 				  <v:label name="la1" value="--(control.vc_parent as vspx_row_template).te_rowset[0]"/>
-
 			      </td>
-			      <td>
-				  <v:url name="ur2" value='<img src="images/icons/del_16.png" hspace="3" border="0"/>Delete'
+          			  <td nowrap="nowrap">
+                    <v:url name="ur2" value='<img src="images/icons/trash_16.png" hspace="3" border="0"/>Delete'
 				      format="%s"
 				      url="--sprintf ('ping_svc.vspx?del=%d', (control.vc_parent as vspx_row_template).te_rowset[3])"
 				      xhtml_title="Delete"
 				      xhtml_alt="Delete"
+        				      xhtml_class="img_button"
 				      />
 			      </td>
 			  </tr>
@@ -112,26 +113,32 @@ if (not e.ve_is_post and control.te_rowset[3] = self.edit_svc)
 	      </v:data-set>
 	  </table>
 	  <div class="fm">
-	      <fieldset>
-		  <label for="endp1">Endpoint URL</label>
-		  <v:text name="endp1" value="" xhtml_id="endp1" error-glyph="*" xhtml_size="110">
-		      <v:validator name="v_httphost" test="regexp" regexp="^http[s]?://[0-9A-Za-z_:.-][/]*[^ ]*+\$"
-			  message="You should provide a valid host name."/>
-		  </v:text><br/>
-		  <label for="ps1">Notification Service</label>
+          <fieldset class="form">
+            <div>
+              <label class="form" for="endp1">Endpoint URL</label>
+              <v:text name="endp1" value="" xhtml_id="endp1" error-glyph="*" xhtml_size="80">
+              <v:validator name="v_httphost" test="regexp" regexp="^http[s]?://[0-9A-Za-z_:.-][/]*[^ ]*+\$" message="You should provide a valid host name."/>
+            </v:text>
+            </div>
+            <div>
+              <label class="form" for="ps1">Notification Service</label>
 		  <v:text name="ps1" xhtml_id="ps1" error-glyph="*" value="" />
-		  <br />
-		  <label for="proto1">Protocol</label>
+            </div>
+            <div>
+              <label class="form" for="proto1">Protocol</label>
 		  <v:select-list name="proto1" value="" xhtml_id="proto1" error-glyph="*">
 			<v:item name="xml-rpc" value="xml-rpc"/>
 			<v:item name="soap" value="soap"/>
 			<v:item name="REST" value="REST"/>
 			<v:item name="PubSubHub" value="PubSubHub"/>
-		  </v:select-list><br />
-		  <label for="meth1">Method</label>
-		  <v:text name="meth1" value="" xhtml_size="110" xhtml_id="meth1" error-glyph="*" default_value="weblogUpdates.ping">
-		  </v:text><br />
-	      <span class="fm_ctl_btn">
+            </v:select-list>
+            </div>
+            <div>
+              <label class="form" for="meth1">Method</label>
+              <v:text name="meth1" value="" xhtml_size="80" xhtml_id="meth1" error-glyph="*" default_value="weblogUpdates.ping" />
+            </div>
+            <div>
+              <label class="form"> </label>
 		  <v:button name="cancel1" value="Cancel" action="simple" enabled="--equ(isnull(self.edit_svc),0)">
 		      <v:on-post>
 self.endp1.ufl_value := '';
@@ -160,13 +167,12 @@ declare exit handler for sqlstate '23000'
 if (self.edit_svc is null)
 {
   insert into ODS..SVC_HOST (SH_URL,SH_NAME,SH_PROTO,SH_METHOD)
-  values (self.endp1.ufl_value, self.ps1.ufl_value, self.proto1.ufl_value, self.meth1.ufl_value)
-  ;
+                      values (self.endp1.ufl_value, self.ps1.ufl_value, self.proto1.ufl_value, self.meth1.ufl_value);
 }
 else
 {
-  update ODS..SVC_HOST set
-    SH_URL = self.endp1.ufl_value,
+                    update ODS..SVC_HOST 
+                       set SH_URL = self.endp1.ufl_value,
     SH_NAME = self.ps1.ufl_value,
     SH_PROTO = self.proto1.ufl_value,
     SH_METHOD = self.meth1.ufl_value
@@ -177,11 +183,12 @@ self.ps1.ufl_value := '';
 self.proto1.ufl_value := '';
 self.meth1.ufl_value := '';
 self.edit_svc := null;
+                  
 control.vc_data_bind (e);
 self.maps.vc_data_bind (e);
 		      </v:on-post>
 		  </v:button>
-	      </span>
+            </div>
 	  </fieldset>
       </div>
       </vm:body>
diff --git a/appsrc/ODS-Framework/popup_browser.vspx b/appsrc/ODS-Framework/popup_browser.vspx
index 737e7f4..3eb42f0 100644
--- a/appsrc/ODS-Framework/popup_browser.vspx
+++ b/appsrc/ODS-Framework/popup_browser.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: popup_browser.vspx,v 1.5 2008/03/13 20:50:05 source Exp $
+ -  $Id: popup_browser.vspx,v 1.5.2.1 2010/09/20 10:15:24 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/privacy.html b/appsrc/ODS-Framework/privacy.html
index 2b57f6f..c555b0b 100644
--- a/appsrc/ODS-Framework/privacy.html
+++ b/appsrc/ODS-Framework/privacy.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
  -
- -  $Id: privacy.html,v 1.6 2008/03/13 20:50:05 source Exp $
+ -  $Id: privacy.html,v 1.6.2.1 2010/09/20 10:15:24 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/provinces.sql b/appsrc/ODS-Framework/provinces.sql
index 7c8c355..51128ab 100644
--- a/appsrc/ODS-Framework/provinces.sql
+++ b/appsrc/ODS-Framework/provinces.sql
@@ -1,5 +1,5 @@
 --
---  $Id: provinces.sql,v 1.4 2008/03/13 20:50:05 source Exp $
+--  $Id: provinces.sql,v 1.4.2.2 2010/12/10 16:04:14 source Exp $
 --
 --  Provinces list
 
@@ -22,6 +22,7 @@
 --  with this program; if not, write to the Free Software Foundation, Inc.,
 --  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 --
+--  
 
 INSERT SOFT DB.DBA.WA_PROVINCE(WP_COUNTRY,WP_PROVINCE) VALUES('Afghanistan','Badakhshan');
 INSERT SOFT DB.DBA.WA_PROVINCE(WP_COUNTRY,WP_PROVINCE) VALUES('Afghanistan','Badghis');
diff --git a/appsrc/ODS-Framework/rabuse.vspx b/appsrc/ODS-Framework/rabuse.vspx
index 780e513..b136f10 100644
--- a/appsrc/ODS-Framework/rabuse.vspx
+++ b/appsrc/ODS-Framework/rabuse.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rabuse.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: rabuse.vspx,v 1.4.2.1 2010/09/20 10:15:25 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/rdf_storage.vspx b/appsrc/ODS-Framework/rdf_storage.vspx
index ff71183..35bd121 100644
--- a/appsrc/ODS-Framework/rdf_storage.vspx
+++ b/appsrc/ODS-Framework/rdf_storage.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: rdf_storage.vspx,v 1.5 2008/03/13 20:50:05 source Exp $
+ -  $Id: rdf_storage.vspx,v 1.5.2.1 2010/09/20 10:15:25 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/rdfb.js b/appsrc/ODS-Framework/rdfb.js
index 35372b3..d88e949 100644
--- a/appsrc/ODS-Framework/rdfb.js
+++ b/appsrc/ODS-Framework/rdfb.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: rdfb.js,v 1.13.2.2 2010/01/14 16:04:14 source Exp $
+ *  $Id: rdfb.js,v 1.13.2.5 2010/10/13 12:16:48 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -237,7 +237,8 @@ OAT.Dereference = {
 	rdfb.addTab("browser","Browser",{});
 	rdfb.addTab("triples","Raw triples",{});
 	rdfb.addTab("svg","SVG Graph",{});
-	rdfb.addTab("map","Yahoo Map",{provider:OAT.MapData.TYPE_Y});
+	// rdfb.addTab("map","Yahoo Map",{provider:OAT.MapData.TYPE_Y});
+  rdfb.addTab("map","Google Map",{provider:OAT.Map.TYPE_G3});
 	rdfb.addTab("timeline","Timeline",{});
 	rdfb.addTab("images","Images",{});
 	rdfb.addTab("tagcloud","Tag Cloud",{});
@@ -288,7 +289,7 @@ OAT.Dereference = {
 		IO.doLoadWQX(obj.load,true);
 	} else {
 		$('about_oat_version').innerHTML = OAT.Preferences.version;
-		var ver = "$Id: rdfb.js,v 1.13.2.2 2010/01/14 16:04:14 source Exp $";
+		var ver = "$Id: rdfb.js,v 1.13.2.5 2010/10/13 12:16:48 source Exp $";
 		var r = ver.match(/main\.js,v ([^ ]+)/);
 		$('about_version').innerHTML = r[1];
 		dialogs.connection.show();
diff --git a/appsrc/ODS-Framework/register.js b/appsrc/ODS-Framework/register.js
new file mode 100644
index 0000000..8ec7a7d
--- /dev/null
+++ b/appsrc/ODS-Framework/register.js
@@ -0,0 +1,488 @@
+/*
+ *
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *
+ *  Copyright (C) 1998-2010 OpenLink Software
+ *
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+var rfTab;
+var rfFacebookData;
+var rfSslData;
+var rfOptions;
+var rfAjaxs = 0;
+
+function rfRowValue(tbl, label, value, leftTag) {
+  if (!leftTag) {
+    leftTag = 'th';
+  }
+  var tr = OAT.Dom.create('tr');
+  var th = OAT.Dom.create(leftTag);
+  th.width = '20%';
+  th.innerHTML = label;
+  tr.appendChild(th);
+  if (value) {
+    var td = OAT.Dom.create('td');
+    td.innerHTML = value;
+    tr.appendChild(td);
+  }
+  tbl.appendChild(tr);
+}
+
+function rfRowInput(tbl, label, fName) {
+  var tr = OAT.Dom.create('tr');
+  tr.id = 'tr+'+fName;
+
+  var th = OAT.Dom.create('th');
+  th.width = '30%';
+  th.innerHTML = label + '<div style="font-weight: normal; display: inline; color: red;"> *</div>';
+  tr.appendChild(th);
+
+  var td = OAT.Dom.create('td');
+  tr.appendChild(td);
+
+  var fld = OAT.Dom.create('input');
+  fld.type = 'type';
+  fld.id = fName;
+  fld.name = fld.id;
+  td.appendChild(fld);
+
+  tbl.appendChild(tr);
+}
+
+function rfInit() {
+  if (!$("rf")) {return;}
+
+  var regData;
+  var x = function (data) {
+    try {
+      regData = OAT.JSON.parse(data);
+    } catch (e) { regData = {}; }
+  }
+  OAT.AJAX.GET ('/ods/api/server.getInfo?info=regData', false, x, {async: false});
+
+  rfTab = new OAT.Tab("rf_content", {goCallback: rfCallback});
+  rfTab.add("rf_tab_0", "rf_page_0");
+  if (regData.openidEnable)
+    OAT.Dom.show('rf_tab_1');
+  rfTab.add("rf_tab_1", "rf_page_1");
+  rfTab.add("rf_tab_2", "rf_page_2");
+  rfTab.add("rf_tab_3", "rf_page_3");
+  rfTab.add("rf_tab_4", "rf_page_4");
+  rfTab.add("rf_tab_5", "rf_page_5");
+  rfTab.go(0);
+
+  var uriParams = OAT.Dom.uriParams();
+  if (uriParams['oid-form'] == 'rf') {
+    OAT.Dom.show('rf');
+    if (uriParams['oid-mode'] == 'twitter') {
+      rfTab.go(4);
+      $('rf_is_agreed').checked = true;
+      var x = function (data) {
+        var xml = OAT.Xml.createXmlDoc(data);
+        var user = xml.getElementsByTagName('user')[0];
+        if (user && user.getElementsByTagName('id')[0]) {
+          hiddenCreate('twitter-data', null, data);
+          var tbl = $('rf_table_4');
+          rfRowValue(tbl, 'Login Name', OAT.Xml.textValue(user.getElementsByTagName('screen_name')[0]));
+          rfRowInput(tbl, 'E-Mail', 'rf_twitter_email');
+        }
+        else
+        {
+          alert('Twitter Authentication Failed');
+        }
+      }
+      var S = "/ods/api/twitterVerify"+
+        '?sid=' + encodeURIComponent(uriParams['sid']) +
+        '&oauth_verifier=' + encodeURIComponent(uriParams['oauth_verifier']) +
+        '&oauth_token=' + encodeURIComponent(uriParams['oauth_token']);
+
+      OAT.AJAX.POST (S, null, x);
+    } else if (uriParams['oid-mode'] == 'linkedin') {
+      rfTab.go(5);
+      $('rf_is_agreed').checked = true;
+      var x = function (data) {
+        var xml = OAT.Xml.createXmlDoc(data);
+        var user = xml.getElementsByTagName('person')[0];
+        if (user && user.getElementsByTagName('id')[0]) {
+          hiddenCreate('linkedin-data', null, data);
+          var tbl = $('rf_table_5');
+          rfRowValue(tbl, 'Login Name', OAT.Xml.textValue(user.getElementsByTagName('first-name')[0]));
+          rfRowInput(tbl, 'E-Mail', 'rf_linkedin_email');
+        }
+        else
+        {
+          alert('LinkedIn Authentication Failed');
+        }
+      }
+      var S = "/ods/api/linkedinVerify"+
+        '?sid=' + encodeURIComponent(uriParams['sid']) +
+        '&oauth_verifier=' + encodeURIComponent(uriParams['oauth_verifier']) +
+        '&oauth_token=' + encodeURIComponent(uriParams['oauth_token']);
+
+      OAT.AJAX.POST (S, null, x);
+    } else {
+    rfTab.go(1);
+    if (typeof (uriParams['openid.signed']) != 'undefined' && uriParams['openid.signed'] != '') {
+      var x = function (params, param, data, property) {
+        if (params[param] && params[param].length != 0)
+          data[property] = params[param];
+      }
+      var data = {};
+      var ns;
+      for (var prop in uriParams) {
+        if (uriParams.hasOwnProperty(prop) && (uriParams[prop] == 'http://openid.net/srv/ax/1.0')) {
+          ns = prop.replace('openid.ns.', '');
+          break;
+        }
+      }
+      if (ns) {
+        x(uriParams, 'openid.'+ns+'.value.country', data, 'homeCountry');
+        x(uriParams, 'openid.'+ns+'.value.email', data, 'mbox');
+        x(uriParams, 'openid.'+ns+'.value.firstname', data, 'firstName');
+        x(uriParams, 'openid.'+ns+'.value.fname', data, 'name');
+        x(uriParams, 'openid.'+ns+'.value.language', data, 'language');
+        x(uriParams, 'openid.'+ns+'.value.lastname', data, 'family_name');
+        x(uriParams, 'openid.'+ns+'.value.fname', data, 'nick');
+        x(uriParams, 'openid.'+ns+'.value.timezone', data, 'timezone');
+      } else {
+        x(uriParams, 'openid.sreg.nickname', data, 'nick');
+        x(uriParams, 'openid.sreg.email', data, 'mbox');
+        x(uriParams, 'openid.sreg.fullname', data, 'name');
+        x(uriParams, 'openid.sreg.dob', data, 'birthday');
+        x(uriParams, 'openid.sreg.gender', data, 'gender');
+        x(uriParams, 'openid.sreg.postcode', data, 'homeCode');
+        x(uriParams, 'openid.sreg.country', data, 'homeCountry');
+        x(uriParams, 'openid.sreg.timezone', data, 'homeTimezone');
+        x(uriParams, 'openid.sreg.language', data, 'language');
+      }
+      x(uriParams, 'openid.identity', data, 'openid_url');
+      x(uriParams, 'oid-srv', data, 'openid_server');
+
+      $('rf_openId').value = uriParams['openid.identity'];
+      $('rf_is_agreed').checked = true;
+      if (!data['nick'] || !data['mbox']) {
+        hiddenCreate('oid-data', null, OAT.JSON.stringify(data));
+        var tbl = $('rf_table_1');
+        if (!data['nick'])
+          rfRowInput(tbl, 'Login Name', 'rf_openid_uid');
+        if (!data['mbox'])
+          rfRowInput(tbl, 'E-Mail', 'rf_openid_email');
+      } else {
+        var q = 'mode=1&data=' + encodeURIComponent(OAT.JSON.stringify(data));
+        OAT.AJAX.POST ("/ods/api/user.register", q, rfAfterSignup);
+      }
+    }
+    else if (typeof (uriParams['openid.mode']) != 'undefined' && uriParams['openid.mode'] == 'cancel')
+    {
+      alert('OpenID Authentication Failed');
+    }
+    }
+  }
+  if (regData.facebookEnable) {
+    rfLoadFacebookData(function() {
+      if (rfFacebookData)
+        FB.init(rfFacebookData.api_key, "/ods/fb_dummy.vsp", {
+          ifUserConnected : function() {
+            rfShowFacebookData();
+          },
+          ifUserNotConnected : function() {
+            rfHideFacebookData();
+          }
+        });
+    });
+  }
+  if (regData.twitterEnable) {
+    OAT.Dom.show("rf_tab_4");
+  }
+  if (regData.linkedinEnable) {
+    OAT.Dom.show("rf_tab_5");
+  }
+
+  if ((document.location.protocol == 'https:') && regData.sslEnable) {
+    var x = function(data) {
+      try {
+        rfSslData = OAT.JSON.parse(data);
+      } catch (e) {
+        rfSslData = null;
+      }
+      if (rfSslData && rfSslData.iri && !rfSslData.certLogin) {
+        var prefix = 'rf';
+        OAT.Dom.show(prefix+"_tab_3");
+        var tbl = $(prefix+'_table_3');
+        if (tbl) {
+          rfRowValue(tbl, 'WebID', rfSslData.iri);
+          if (rfSslData.firstName)
+            rfRowValue(tbl, 'First Name', rfSslData.firstName);
+          if (rfSslData.family_name)
+            rfRowValue(tbl, 'Family Name', rfSslData.family_name);
+          if (rfSslData.mbox)
+            rfRowValue(tbl, 'E-Mail', rfSslData.mbox);
+          rfTab.go(3);
+        }
+      }
+    }
+    OAT.AJAX.GET('/ods/api/user.getFOAFSSLData?sslFOAFCheck=1', '', x);
+  }
+}
+
+function rfCallback(oldIndex, newIndex) {
+  if (newIndex == 0)
+    $('rf_signup').value = 'Sign Up';
+  else if (newIndex == 1)
+    $('rf_signup').value = 'OpenID Sign Up';
+  else if (newIndex == 2)
+    $('rf_signup').value = 'Facebook Sign Up';
+  else if (newIndex == 3)
+    $('rf_signup').value = 'WebID Sign Up';
+  else if (newIndex == 4)
+    $('rf_signup').value = 'Twitter Sign Up';
+  else if (newIndex == 5)
+    $('rf_signup').value = 'LinkedIn Sign Up';
+
+  pageFocus('rf_page_'+newIndex);
+}
+
+function rfStart() {
+  rfAjaxs++;
+  $('rf_signup').disabled = true;
+	OAT.Dom.hide('rf_close');
+	OAT.Dom.show('rf_throbber');
+}
+
+function rfEnd() {
+  rfAjaxs--;
+  if (rfAjaxs == 0) {
+    OAT.Dom.hide('rf_throbber');
+  	OAT.Dom.show('rf_close');
+    $('rf_signup').disabled = false;
+  }
+}
+
+function rfSignupSubmit(event) {
+  if (rfTab.selectedIndex == 0) {
+    if ($v('rf_uid') == '')
+      return showError('Bad username. Please correct!');
+    if ($v('rf_email') == '')
+      return showError('Bad mail. Please correct!');
+    if ($v('rf_password') == '')
+      return showError('Bad password. Please correct!');
+    if ($v('rf_password') != $v('rf_password2'))
+      return showError('Bad password. Please retype!');
+  } else if (rfTab.selectedIndex == 1) {
+    if ($v('rf_openId') == '')
+      return showError('Bad openID. Please correct!');
+  } else if (rfTab.selectedIndex == 2) {
+    if (!rfFacebookData || !rfFacebookData.uid)
+      return showError('Invalid Facebook UserID');
+  } else if (rfTab.selectedIndex == 3) {
+    if (!rfSslData || !rfSslData.iri)
+      return showError('Invalid WebID UserID');
+  }
+  if (!$('rf_is_agreed').checked)
+    return showError('You have not agreed to the Terms of Service!');
+
+  var q = 'mode=' + encodeURIComponent(rfTab.selectedIndex);
+  if (rfTab.selectedIndex == 0) {
+    q +='&name=' + encodeURIComponent($v('rf_uid'))
+      + '&password=' + encodeURIComponent($v('rf_password'))
+      + '&email=' + encodeURIComponent($v('rf_email'));
+  }
+  else if (rfTab.selectedIndex == 1) {
+    if (!$('oid-data')) {
+      rfOpenIdAuthenticate('rf');
+      return false;
+    }
+    q += '&data=' + encodeURIComponent($v('oid-data'));
+    if ($('rf_openid_uid'))
+      q +='&name=' + encodeURIComponent($v('rf_openid_uid'));
+    if ($('rf_openid_email'))
+      q +='&email=' + encodeURIComponent($v('rf_openid_email'));
+  }
+  else if (rfTab.selectedIndex == 2) {
+    q += '&data=' + encodeURIComponent(OAT.JSON.stringify(rfFacebookData))
+  }
+  else if (rfTab.selectedIndex == 3) {
+    q +='&data=' + encodeURIComponent(OAT.JSON.stringify(rfSslData));
+    if ($('rf_webid_uid'))
+      q +='&name=' + encodeURIComponent($v('rf_webid_uid'));
+    if ($('rf_webid_email'))
+      q +='&email=' + encodeURIComponent($v('rf_webid_email'));
+  }
+  else if (rfTab.selectedIndex == 4) {
+    if (!$('twitter-data')) {
+      twitterAuthenticate('rf');
+      return false;
+    }
+    q +='&data=' + encodeURIComponent($v('twitter-data'));
+    if ($('rf_twitter_email'))
+      q +='&email=' + encodeURIComponent($v('rf_twitter_email'));
+  }
+  else if (rfTab.selectedIndex == 5) {
+    if (!$('linkedin-data')) {
+      linkedinAuthenticate('rf');
+      return false;
+    }
+    q +='&data=' + encodeURIComponent($v('linkedin-data'));
+    if ($('rf_linkedin_email'))
+      q +='&email=' + encodeURIComponent($v('rf_linkedin_email'));
+  }
+  OAT.AJAX.POST("/ods/api/user.register", q, rfAfterSignup, rfOptions);
+  return false;
+}
+
+function rfAfterSignup(data) {
+  var xml = OAT.Xml.createXmlDoc(data);
+  if (!hasError(xml)) {
+    var form = document.forms['page_form'];
+    hiddenCreate('sid', form, OAT.Xml.textValue(xml.getElementsByTagName('sid')[0]));
+    hiddenCreate('realm', form, 'wa');
+    document.forms['page_form'].submit();
+  }
+  return false;
+}
+
+function rfOpenIdAuthenticate(prefix) {
+  var q = 'openIdUrl=' + encodeURIComponent($v(prefix+'_openId'));
+  var x = function (data) {
+    var xml = OAT.Xml.createXmlDoc(data);
+    var error = OAT.Xml.xpath (xml, '//error_response', {});
+    if (error.length)
+      showError('Invalied OpenID Server');
+
+    var oidServer = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/server', {})[0]);
+    if (!oidServer || !oidServer.length)
+      showError(' Cannot locate OpenID server');
+
+    var oidVersion = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/version', {})[0]);
+    var oidDelegate = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/delegate', {})[0]);
+		var oidUrl = OAT.Xml.textValue(OAT.Xml.xpath(xml, '/openIdServer_response/identity', {})[0]);
+    var oidParams = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/params', {})[0]);
+    if (!oidParams || !oidParams.length)
+      oidParams = 'sreg';
+
+    var oidIdent = oidUrl;
+    if (oidDelegate && oidDelegate.length)
+      oidIdent = oidDelegate;
+
+    var thisPage  = document.location.protocol +
+      '//' +
+      document.location.host +
+      document.location.pathname +
+      '?oid-form=' + prefix +
+      '&oid-srv=' + encodeURIComponent (oidServer);
+
+    var trustRoot = document.location.protocol + '//' + document.location.host;
+
+    var S = oidServer + ((oidServer.lastIndexOf('?') != -1)? '&': '?') +
+      'openid.mode=checkid_setup' +
+      '&openid.return_to=' + encodeURIComponent(thisPage);
+
+    if (oidVersion == '1.0')
+      S +='&openid.identity=' + encodeURIComponent(oidIdent)
+        + '&openid.trust_root=' + encodeURIComponent(trustRoot);
+
+    if (oidVersion == '2.0')
+      S +='&openid.ns=' + encodeURIComponent('http://specs.openid.net/auth/2.0')
+        + '&openid.claimed_id=' + encodeURIComponent(oidIdent)
+        + '&openid.identity=' + encodeURIComponent(oidIdent)
+
+    if (oidParams = 'sreg')
+      S +='&openid.sreg.optional='+encodeURIComponent('fullname,nickname,dob,gender,postcode,country,timezone')
+        + '&openid.sreg.required=' + encodeURIComponent('email,nickname');
+
+    if (oidParams = 'ax')
+      S +='&openid.ns.ax=http://openid.net/srv/ax/1.0'
+        + '&openid.ax.mode=fetch_request'
+        + '&openid.ax.required=country,email,firstname,fname,language,lastname,timezone'
+        + '&openid.ax.type.country=http://axschema.org/contact/country/home'
+        + '&openid.ax.type.email=http://axschema.org/contact/email'
+        + '&openid.ax.type.firstname=http://axschema.org/namePerson/first'
+        + '&openid.ax.type.fname=http://axschema.org/namePerson'
+        + '&openid.ax.type.language=http://axschema.org/pref/language'
+        + '&openid.ax.type.lastname=http://axschema.org/namePerson/last'
+        + '&openid.ax.type.timezone=http://axschema.org/pref/timezone';
+
+    document.location = S;
+  }
+  OAT.AJAX.POST ("/ods_services/Http/openIdServer", q, x);
+}
+
+function twitterAuthenticate(prefix) {
+  var thisPage  = document.location.protocol +
+    '//' +
+    document.location.host +
+    document.location.pathname +
+    '?oid-mode=twitter&oid-form=' + prefix;
+
+  var x = function (data) {
+    document.location = data;
+  }
+  OAT.AJAX.POST ("/ods/api/twitterServer?hostUrl="+encodeURIComponent(thisPage), null, x);
+}
+
+function linkedinAuthenticate(prefix) {
+  var thisPage  = document.location.protocol +
+    '//' +
+    document.location.host +
+    document.location.pathname +
+    '?oid-mode=linkedin&oid-form=' + prefix;
+
+  var x = function (data) {
+    document.location = data;
+  }
+  OAT.AJAX.POST ("/ods/api/linkedinServer?hostUrl="+encodeURIComponent(thisPage), null, x);
+}
+
+function rfLoadFacebookData(cb) {
+  var x = function(data) {
+    try {
+      rfFacebookData = OAT.JSON.parse(data);
+    } catch (e) {
+      rfFacebookData = null;
+    }
+    if (rfFacebookData)
+      OAT.Dom.show("rf_tab_2");
+
+    if (cb) {cb()};
+  }
+  OAT.AJAX.GET('/ods/api/user.getFacebookData?fields=uid,name,first_name,last_name,sex,birthday', '', x);
+}
+
+function rfShowFacebookData(skip) {
+  var rfLabel = $('rf_facebookData');
+  if (rfLabel) {
+    rfLabel.innerHTML = '';
+    if (rfFacebookData && rfFacebookData.name) {
+      rfLabel.innerHTML = 'Connected as <b><i>' + rfFacebookData.name + '</i></b></b>';
+    } else if (!skip) {
+      rfLoadFacebookData(function() {self.rfShowFacebookData(true);});
+    }
+  }
+}
+
+function rfHideFacebookData() {
+  var label = $('rf_facebookData');
+  if (label)
+    label.innerHTML = '';
+  if (rfFacebookData) {
+    var o = {}
+    o.api_key = rfFacebookData.api_key;
+    o.secret = rfFacebookData.secret;
+    rfFacebookData = o;
+  }
+}
diff --git a/appsrc/ODS-Framework/register.vspx b/appsrc/ODS-Framework/register.vspx
index 4437721..4bac869 100644
--- a/appsrc/ODS-Framework/register.vspx
+++ b/appsrc/ODS-Framework/register.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: register.vspx,v 1.6.2.1 2010/03/12 09:10:13 source Exp $
+ -  $Id: register.vspx,v 1.6.2.3 2010/09/22 13:55:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -35,16 +35,19 @@
     <vm:pagewrapper>
       <vm:rawheader caption="Account Registration"/>
       <vm:body default-input="reguid">
-        <div class="splash">
-          <div class="box">
-            <table>
-              <tr>
-                <td id="RB" valign="top">
+        <div style="margin-left: 20px;">
+          <h1 class="page_title">
+            <?vsp
+              declare copy varchar;
+
+              copy := (select top 1 WS_WEB_TITLE from WA_SETTINGS);
+              if (copy = '' or copy is null)
+                http(sys_stat ('st_host_name'));
+              else
+                http(copy);
+            ?>
+          </h1>
                   <vm:register-form/>
-                </td>
-              </tr>
-            </table>
-        </div>
         </div>
       </vm:body>
     </vm:pagewrapper>
diff --git a/appsrc/ODS-Framework/registration_xml.sql b/appsrc/ODS-Framework/registration_xml.sql
index ac3927b..bcd40e5 100644
--- a/appsrc/ODS-Framework/registration_xml.sql
+++ b/appsrc/ODS-Framework/registration_xml.sql
@@ -1,5 +1,5 @@
 --
---  $Id: registration_xml.sql,v 1.3 2006/08/14 14:33:16 source Exp $
+--  $Id: registration_xml.sql,v 1.3.2.1 2010/09/20 10:15:25 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Framework/related_apps.vspx b/appsrc/ODS-Framework/related_apps.vspx
index bec7bf7..52a42fd 100644
--- a/appsrc/ODS-Framework/related_apps.vspx
+++ b/appsrc/ODS-Framework/related_apps.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: related_apps.vspx,v 1.1 2008/04/17 09:10:36 source Exp $
+ -  $Id: related_apps.vspx,v 1.1.2.2 2010/11/11 12:38:18 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -34,8 +34,9 @@
     </vm:header>
     <vm:pagewrapper>
       <v:variable name="wai_id" type="int" default="null" param-name="wai_id"/>
-      <v:variable name="edit_id" type="int" default="null" param-name="edit" />
-      <v:variable name="del_id" type="int" default="null" param-name="del" />
+
+      <v:variable name="rel_mode" type="varchar" default="'REL/browse'"/>
+    	<v:variable name="rel_id" type="any" default="null" />
 
       <vm:navigation on="settings"/>
       <vm:navigation1 on="services"/>
@@ -43,135 +44,185 @@
       <vm:body>
 	<vm:login redirect="index.vspx"/>
         <div class="box">
-	    <h3>
-		Applications related to "<?V (select WAI_NAME from WA_INSTANCE where WAI_ID = self.wai_id) ?>"
-	    </h3>
-          <div>
-	    <v:form type="simple" method="POST" xhtml_enctype="multipart/form-data">
-	      <v:template type="simple" name="tm1">
+          <h3>Applications related to "<?V (select WAI_NAME from WA_INSTANCE where WAI_ID = self.wai_id) ?>"</h3>
+          <vm:if test="self.rel_mode = 'REL/browse'">
+            <?vsp
+              if (0)
+              {
+            ?>
+              <v:button name="rel_dButton" action="simple" value="Delete">
+                <v:on-post>
+                  <![CDATA[
+                    delete from DB.DBA.WA_RELATED_APPS where RA_ID = get_keyword ('rel_id', self.vc_page.vc_event.ve_params) and RA_WAI_ID = self.wai_id;
+                    self.vc_data_bind(e);
+                  ]]>
+                </v:on-post>
+              </v:button>
+            <?vsp
+              }
+            ?>
+            <input type="hidden" name="rel_id" id="rel_id" value="" />
+            <div style="padding: 0 0 0.5em 0;">
+        		  <v:button name="rel_Back" value="''" action="simple" style="url" xhtml_class="img_button">
+                <v:before-render>
+                  <![CDATA[
+                    control.ufl_value := '<img src="images/icons/go_16.png" border="0" /> Back to Applications';
+                  ]]>
+                </v:before-render>
+       		      <v:on-post>
+           			  self.vc_redirect ('services.vspx');
+       		      </v:on-post>
+        		  </v:button>
+              <v:button name="rel_aButton" action="simple" style="url" value="''" xhtml_class="img_button">
+                <v:before-render>
+                  <![CDATA[
+                    control.ufl_value := '<img src="images/icons/add_16.png" border="0" /> Add';
+                  ]]>
+                </v:before-render>
+                <v:on-post>
+                  <![CDATA[
+                    self.rel_mode := 'REL/add';
+                    self.rel_uri.ufl_value := null;
+                    self.rel_label.ufl_value := null;
+
+                    self.vc_data_bind(e);
+                  ]]>
+                </v:on-post>
+              </v:button>
+            </div>
+
+      	    <v:data-set name="rel_ds"
+      	                sql="select RA_ID, RA_URI, RA_LABEL from DB.DBA.WA_RELATED_APPS where RA_WAI_ID = :self.wai_id"
+      		              scrollable="1"
+      		              editable="1"
+      		              nrows="0">
+
+              <v:template name="rel_ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
 	  <table class="listing" rules="groups">
-	      <colgroup>
-		  <col/>
-		  <col/>
-		  <col/>
-	      </colgroup>
 	      <tr class="listing_header_row">
 		  <th>Description</th>
 		  <th>URI</th>
-		  <th>Action</th>
+            		    <th width="50px">Action</th>
 	      </tr>
-	      <v:data-set name="dset"
-		  sql="select RA_ID, RA_URI, RA_LABEL from WA_RELATED_APPS where RA_WAI_ID = :self.wai_id"
-		  scrollable="1" editable="1" nrows="1000">
-		  <v:before-data-bind>
-if (not e.ve_is_post and self.del_id is not null)
-{
-  delete from WA_RELATED_APPS where RA_WAI_ID = self.wai_id and RA_ID = self.del_id;
-}
-		  </v:before-data-bind>
-
-		  <v:template name="dst_rep" type="repeat">
-		      <v:template name="dset_brows" type="browse">
-			  <v:after-data-bind>
-if (not e.ve_is_post and control.te_rowset[0] = self.edit_id)
-{
-  self.a_pat.ufl_value := control.te_rowset[2];
-  self.a_url.ufl_value := control.te_rowset[1];
-}
-	                  </v:after-data-bind>
-			  <tr class="<?V case when self.edit_id = control.te_rowset[0] then 'listing_row_selected' when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
-			      <td>
-				  <v:url name="dset_ur1"
-				      value='--concat ('<img src="images/icons/edit_16.png" hspace="3" border="0"/>', (control.vc_parent as vspx_row_template).te_rowset[2])'
-				      format="%s"
-				      url="--sprintf ('related_apps.vspx?edit=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
-				      xhtml_title="Edit"
-				      xhtml_alt="Edit"
-				      />
+                </table>
+              </v:template>
+
+              <v:template name="rel_ds_repeat" type="repeat" name-to-remove="" set-to-remove="">
+
+                <v:template name="rel_ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
+                  <table>
+                    <tr align="center">
+                      <td colspan="3">No Related Applications</td>
+                    </tr>
+                  </table>
+                </v:template>
+
+                <v:template name="rel_ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
+                  <table>
+        			      <tr class="<?V case when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
+                      <td nowrap="nowrap" width="50%">
+                        <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('RA_LABEL')" format="%s" name="rel_ds_browse_l1"/>
 			      </td>
-			      <td>
-				  <v:label name="lr1" value="--(control.vc_parent as vspx_row_template).te_rowset[1]"/>
+                      <td nowrap="nowrap" width="50%">
+                        <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('RA_URI')" format="%s" name="rel_ds_browse_l2"/>
 			      </td>
-			      <td>
-				  <v:url name="dset_ur2" value='<img src="images/icons/del_16.png" hspace="3" border="0"/>Delete'
-				      format="%s"
-				      url="--sprintf ('related_apps.vspx?del=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
-				      xhtml_title="Delete"
-				      xhtml_alt="Delete"
-				      />
+                      <td nowrap="nowrap">
+                        <v:button name="rel_eButton" action="simple" style="url" value="''" xhtml_class="img_button">
+                          <v:before-render>
+                            <![CDATA[
+                              control.ufl_value := '<img src="images/icons/edit_16.png" border="0" alt="Edit Seek" title="Edit Seek"/> Edit';
+                            ]]>
+                          </v:before-render>
+                          <v:on-post>
+                            <![CDATA[
+                              self.rel_mode := 'REL/edit';
+                              self.rel_id := (control.vc_parent as vspx_row_template).te_column_value('RA_ID');
+                              select RA_URI,
+                                     RA_LABEL
+                                into self.rel_uri.ufl_value,
+                                     self.rel_label.ufl_value
+                                from DB.DBA.WA_RELATED_APPS
+                               where RA_ID = self.rel_id;
+
+                              self.vc_data_bind(e);
+                            ]]>
+                          </v:on-post>
+                        </v:button>
+                        <span class="button pointer" onclick="javascript: if (confirm('Are you sure you want to delete this record?')) {$('rel_id').value = <?V (control as vspx_row_template).te_column_value('RA_ID') ?>; doPost('page_form', 'rel_dButton');}">
+                          <img class="button" src="/ods/images/icons/trash_16.png"/> Delete
+                        </span>
 			      </td>
 			  </tr>
+                  </table>
 		      </v:template>
+
 		  </v:template>
 
-		  <v:template name="dset_footer" type="simple">
-		      <tr>
-			  <td colspan="3" class="listing_col_action">
-			      <vm:ds-navigation data-set="dset" type="set" />
-			  </td>
-		      </tr>
+      		    <v:template name="rel_ds_footer" type="simple" name-to-remove="table" set-to-remove="top">
+                <table>
+                </table>
 		  </v:template>
 	      </v:data-set>
-	  </table>
+
+          </vm:if>
+
+          <vm:if test="self.rel_mode <> 'REL/browse'">
 	  <div class="fm">
-	      <fieldset>
-	      <v:form name="addf" type="simple" method="POST">
-		  <label for="a_pat">Description</label><br/>
-		  <v:text name="a_pat" value="" xhtml_id="a_pat" xhtml_size="50" error-glyph="*">
-		      <v:validator test="sql" expression="length(trim(control.ufl_value)) < 2" message="Description can not be empty"/>
-		  </v:text>
-		  <br/>
-		  <label for="a_url">URI</label><br/>
-		  <v:text name="a_url" value="" xhtml_id="a_url" xhtml_size="100"/>
+      				<table>
+      				  <tr>
+      				    <th width="100px">
+      		          Description
+      		        </th>
+      		        <td>
+                    <v:text name="rel_label" value="" xhtml_id="rel_label" xhtml_size="100" xhtml_class="_validate_" />
+                  </td>
+                </tr>
+      				  <tr>
+      				    <th>
+      		          URI
+      		        </th>
+      		        <td>
+                    <v:text name="rel_uri" value="" xhtml_id="rel_uri" xhtml_size="100" xhtml_class="_validate_" />
+                  </td>
+                </tr>
+                <tr>
+                  <td></td>
+                  <td>
 		  <br />
-	      <span class="fm_ctl_btn">
-		  <v:button name="cancel1" value="Cancel" action="simple" enabled="--equ(isnull(self.edit_id),0)">
+          		      <v:button name="rel_Cancel" value="Cancel" action="simple">
 		      <v:on-post>
-self.a_pat.ufl_value := null;
-self.a_url.ufl_value := null;
-self.edit_id := null;
-self.save1.vc_data_bind (e);
-control.vc_enabled := 0;
+                        self.rel_mode := 'REL/browse';
+                        self.vc_data_bind (e);
 		      </v:on-post>
 		  </v:button>
-		  <v:button name="save1" value="--case when self.edit_id is null then 'Add' else 'Update' end" action="simple">
+          		      <v:button name="rel_Save" value="--case when self.rel_mode = 'REL/add' then 'Add' else 'Update' end" action="simple" xhtml_onclick="return validateInputs(this);">
 		      <v:on-post><![CDATA[
-declare url, pat varchar;
-if (not self.vc_is_valid)
+                        if (self.vc_is_valid = 0)
   return;
 
-url := self.a_url.ufl_value;
-pat := self.a_pat.ufl_value;
-if (not length (url))
+                        if (self.rel_mode = 'REL/add')
   {
-    self.vc_is_valid := 0;
-    self.vc_error_message := 'The URI cannot be empty';
-    return;
+                          insert into DB.DBA.WA_RELATED_APPS (RA_URI, RA_LABEL, RA_WAI_ID)
+                            values (self.rel_uri.ufl_value, self.rel_label.ufl_value, self.wai_id);
   }
-if (self.edit_id is not null)
-  update WA_RELATED_APPS set RA_URI = url, RA_LABEL = pat where RA_WAI_ID = self.wai_id and RA_ID = self.edit_id;
 else
-  insert into WA_RELATED_APPS (RA_URI, RA_LABEL, RA_WAI_ID) values (url, pat, self.wai_id);
-self.edit_id := null;
-self.a_pat.ufl_value := null;
-self.a_url.ufl_value := null;
-control.vc_data_bind (e);
-self.cancel1.vc_data_bind (e);
-self.dset.vc_data_bind (e);
+                        {
+                          update DB.DBA.WA_RELATED_APPS
+                             set RA_URI = self.rel_uri.ufl_value,
+                                 RA_LABEL = self.rel_label.ufl_value
+                           where RA_WAI_ID = self.wai_id
+                             and RA_ID = self.rel_id;
+                        }
+
+                        self.rel_mode := 'REL/browse';
+                        self.vc_data_bind (e);
 ]]></v:on-post>
 		  </v:button>
-		  <v:button name="back1" value="Back to Applications" action="simple">
-		      <v:on-post>
-			  self.vc_redirect ('services.vspx');
-		      </v:on-post>
-		  </v:button>
-	      </span>
-	    </v:form>
-	  </fieldset>
-      </div>
-    </v:template>
-	</v:form>
+                  </td>
+                </tr>
+              </table>
           </div>
+          </vm:if>
         </div>
       </vm:body>
     </vm:pagewrapper>
diff --git a/appsrc/ODS-Framework/salmon.sql b/appsrc/ODS-Framework/salmon.sql
new file mode 100644
index 0000000..ddf501c
--- /dev/null
+++ b/appsrc/ODS-Framework/salmon.sql
@@ -0,0 +1,283 @@
+use ODS;
+
+create procedure ODS.ODS_API."salmon_endpoint" () __SOAP_HTTP 'text/plain'
+{
+  declare body, xt, msg, sig, enc, orig, alg, data_type, m, ks, rc any;
+
+  set_user_id ('dba');
+  body := http_param ('content');
+  if (body = 0)
+    body := http_body_read ();
+  if (length (body) = 0)
+    body := http_param ('magic_env');  
+  xt := xtree_doc (body);
+  msg := cast (xpath_eval ('/env/data', xt) as varchar);
+  data_type := cast (xpath_eval ('/env/data/@type', xt) as varchar);
+  enc := cast (xpath_eval ('/env/encoding', xt) as varchar);
+  sig := cast (xpath_eval ('/env/sig', xt) as varchar);
+  alg := cast (xpath_eval ('/env/alg', xt) as varchar);
+  orig := msg;
+  orig := regexp_replace (orig, '[^A-Za-z0-9\\-_=]', '', 1, null);
+  sig  := regexp_replace (sig, '[^A-Za-z0-9\\-_=]', '', 1, null);
+  --dbg_obj_print_vars (enc, sig, alg, data_type, orig);
+  if (enc <> 'base64url')
+    signal ('SALM0', 'Encoding is not supported');
+  if (alg <> 'RSA-SHA256')
+    signal ('SALM0', 'Signing Algorithm is not supported');
+  -- get the key
+  msg := decode_base64 (replace (replace (msg, '-', '+'), '_', '/'));
+  --k := ods..sp_decode_rsa_key ('data:application/magic-public-key,RSA.mVgY8RN6URBTstndvmUUPb4UZTdwvwmddSKE5z_jvKUEK6yk1u3rrC9yN8k6FilGj9K0eeUPe2hf4Pj-5CmHww.AQAB');    
+  --k := ods..sp_decode_rsa_key ('data:application/magic-public-key,RSA.mVgY8RN6URBTstndvmUUPb4UZTdwvwmddSKE5z_jvKUEK6yk1u3rrC9yN8k6FilGj9K0eeUPe2hf4Pj-5CmHww==.AQAB.Lgy_yL3hsLBngkFdDw1Jy9TmSRMiH6yihYetQ8jy-jZXdsZXd8V5ub3kuBHHk4M39i3TduIkcrjcsiWQb77D8Q==');
+  --m := concat (orig, '.', sp_base64url (data_type), '.', sp_base64url (enc), '.', sp_base64url (alg)); 
+  m := orig;
+  ks := sp_webfinger_users_keys (msg);
+  rc := 0;
+  foreach (any k in ks) do
+    {
+--      dbg_obj_print (k);
+      --dbg_obj_print_vars (m, k, xenc_dsig_sign (m, k, sp_meth ('rsa-sha256')), sig);
+      if (xenc_dsig_verify (m, k, sp_meth ('rsa-sha256'), replace (replace (sig, '-', '+'), '_', '/')))
+	{
+	  rc := 1;
+	  goto endc;
+	}
+    }
+  endc:
+  foreach (any k in ks) do
+    {
+      xenc_key_remove (k);
+    }
+  if (not rc)
+    signal ('SALM1', 'Invalid signature');
+  --dbg_obj_print_vars (msg);
+  sp_process_message (msg);
+  return msg;
+}
+;
+
+create procedure sp_process_message (in msg varchar)
+{
+  declare xt, xp, arr, mail, graph, uname, uid, content any;
+  xt := xtree_doc (msg);
+  xp := cast (xpath_eval ('/entry/link[@rel="salmon"]/@href', xt) as varchar);
+  if (xp is not null) -- mention
+    {
+      arr :=  WS.WS.PARSE_URI (xp);
+      mail := arr[2];
+      graph := sioc..get_graph ();
+      uname := (select top 1 U_NAME from DB.DBA.SYS_USERS where U_E_MAIL = mail order by U_ID);
+      if (uname is null)
+	{
+	  uname := (sparql define input:storage "" 
+	  prefix owl: <http://www.w3.org/2002/07/owl#> 
+	  prefix foaf: <http://xmlns.com/foaf/0.1/> 
+	  select ?nick 
+	  where { graph `iri(?:graph)` { ?s owl:sameAs `iri(?:xp)` ; foaf:nick ?nick . }});
+	}
+      if (uname is null)
+	signal ('22023', sprintf ('The user account "%s" does not exist', xp));
+      uid := (select U_ID from DB.DBA.SYS_USERS where U_NAME = uname);
+      content := cast (xpath_eval ('/entry/content', xt) as varchar);
+      insert into DB.DBA.WA_MESSAGES (WM_SENDER_UID, WM_RECIPIENT_UID, WM_TS, WM_MESSAGE, WM_SENDER_MSGSTATUS, WM_RECIPIENT_MSGSTATUS)
+	   values (http_dav_uid (), uid, now(), content, 0, 0);
+--      dbg_obj_print (uname);
+      return;
+    }
+  xp := trim (cast (xpath_eval ('/entry/in-reply-to', xt) as varchar), ' \t\n\r');
+--  dbg_obj_print_vars (xp);
+  if (xp is not null and xp like 'http://%/dataspace/%/weblog/%/%')
+    {
+      declare postid, uri, name, comment, title, rc varchar;
+      arr := sprintf_inverse (xp, 'http://%s/dataspace/%s/weblog/%s/%s', 0);
+      postid := arr [3];
+      name := cast (xpath_eval ('/entry/author/name', xt) as varchar);
+      uri  := cast (xpath_eval ('/entry/author/uri', xt) as varchar);
+      mail := '';
+      arr :=  WS.WS.PARSE_URI (uri);
+      if (arr[0] = '')
+	uri := 'acct:' || arr[2];
+      title  := cast (xpath_eval ('/entry/title', xt) as varchar);
+      comment  := cast (xpath_eval ('/entry/content', xt) as varchar);
+      rc := ODS.ODS_API."weblog.comment.new" (postid, title, name, mail, uri, comment);
+--      dbg_obj_print_vars (postid, title, name, uri, comment, rc);
+    }
+}
+;
+
+create procedure sp_template ()
+{
+  declare ses any;
+  ses := string_output ();
+  http('<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n', ses);
+  http('<me:env xmlns:me=\'http://salmon-protocol.org/ns/magic-env\'>\n', ses);
+  http('  <me:data type=\'application/atom+xml\'>\n', ses);
+  http('%s\n', ses);
+  http('  </me:data>\n', ses);
+  http('  <me:encoding>base64url</me:encoding>\n', ses);
+  http('  <me:alg>RSA-SHA256</me:alg>\n', ses);
+  http('  <me:sig>', ses); http('%s', ses); http('</me:sig>\n', ses);
+  http('</me:env>\n', ses);
+  return string_output_string (ses);
+}
+;
+
+create procedure sp_sign (in msg varchar, in uname varchar)
+{
+  declare m, s, k, x varchar;
+  k := (select WAUI_SALMON_KEY from DB.DBA.WA_USER_INFO, DB.DBA.SYS_USERS where WAUI_U_ID = U_ID and U_NAME = uname);
+  if (k is null)
+    signal ('22023', 'Cannot find key to sign');
+  x := encode_base64 (msg);
+  x := replace (x, '/', '_');
+  x := replace (x, '+', '-');
+  m := regexp_replace (x, '[^A-Za-z0-9\\-_=]', '', 1, null);
+  set_user_id (uname);
+  set_qualifier ('ODS');
+  s := xenc_dsig_sign (m, k, sp_meth ('rsa-sha256'));
+  msg := sprintf (sp_template (), x, replace (replace (s, '/', '_'), '+', '-'));
+  return msg;
+}
+;
+
+create procedure sp_webfinger_users_keys (in x any)
+{
+  declare ret, xrd, acct any;
+  
+  acct := cast (xpath_eval ('/entry/author/uri', xtree_doc (x)) as varchar);
+  xrd := WF_USER_XRD_GET (acct);
+  ret := sp_load_rsa_keys (xrd);
+  return ret;
+}
+;
+
+create procedure sp_meth (in x any)
+{
+  return concat ('http://www.w3.org/2000/09/xmldsig#', x);
+}
+;
+
+create procedure sp_base64url (in x any)
+{
+  x := encode_base64 (x);
+  x := replace (x, '/', '_');
+  x := replace (x, '+', '-');
+  x := regexp_replace (x, '[^A-Za-z0-9\\-_=]', '', 1, null);
+  return x;
+}
+;
+
+create procedure sp_decode_base64url (in x any)
+{
+  x := replace (x, '_', '/');
+  x := replace (x, '-', '+');
+  return decode_base64 (x);
+}
+;
+
+create procedure sp_decode_rsa_key (in x any)
+{
+  declare a, n, kr any;
+  a := null;
+  n := null;
+  if (x like 'data:application/magic-public-key,RSA.%.%.%')
+    a := sprintf_inverse (x, 'data:application/magic-public-key,RSA.%s.%s.%s', 0);
+  else if (x like 'data:application/magic-public-key,RSA.%.%')
+    a := sprintf_inverse (x, 'data:application/magic-public-key,RSA.%s.%s', 0);
+--  dbg_obj_print_vars (a);  
+  kr := xenc_rand_bytes (8, 1);
+  if (length (a) = 2)
+    n := xenc_key_RSA_construct (kr, sp_decode_base64url (a[0]), sp_decode_base64url (a[1]));
+  else if (length (a) = 3)
+    n := xenc_key_RSA_construct (kr, sp_decode_base64url (a[0]), sp_decode_base64url (a[1]), sp_decode_base64url (a[2]));
+  return n;
+}
+;
+
+create procedure sp_load_rsa_keys (in x any)
+{
+  declare xd, xp, ret, n any;
+  
+  if (isstring (x))
+    xd := xtree_doc (x);
+  else
+    xd := x;
+  xp := xpath_eval ('//*[@rel="magic-public-key"]/@href', xd, 0);
+--  dbg_obj_print (xp);
+  vectorbld_init (ret);
+  foreach (any e in xp) do
+    {
+      n := sp_decode_rsa_key (cast (e as varchar));
+      if (n is not null)
+	vectorbld_acc (ret, n);
+    }
+  vectorbld_final (ret);
+  return ret;
+}
+;
+
+create procedure sp_send_all_mentioned (in sender varchar, in refid varchar, in msg varchar)
+{
+  declare xt, xp any;
+  xt := xtree_doc (msg, 2);
+  xp := xpath_eval ('//a[not (img)]/@href', xt, 0);
+  foreach (any x in xp) do
+    {
+      x := cast (x as varchar);
+      if (x like 'mailto:%' or x like 'acct:%')
+	{
+	  declare exit handler for sqlstate '*' { goto next; };
+	  sp_message_mention (sender, x, refid, msg);
+	  next:;
+	}
+    }
+}
+;
+
+create procedure sp_message_mention (in sender varchar, in acct varchar, in refid varchar, in msg varchar)
+{
+  declare ses any;
+  declare sender_name, sender_email, ep, m, xrd varchar;
+
+  xrd := WF_USER_XRD_GET (acct);
+  ep := cast (xpath_eval ('/XRD/Link[@rel="salmon"]/@href', xrd) as varchar);
+
+  for select U_FULL_NAME, U_E_MAIL from DB.DBA.SYS_USERS where U_NAME = sender do
+    {
+      sender_name := coalesce (U_FULL_NAME, sender); 
+      sender_email := U_E_MAIL;
+    }
+  ses := string_output ();
+  http ('<entry xmlns="http://www.w3.org/2005/Atom">\n', ses);
+  http ('    <author>\n', ses);
+  http ('      <name>%V</name>\n', ses);
+  http ('      <uri>%V</uri>\n', ses);
+  http ('    </author>\n', ses);
+  http ('    <id>%V</id>\n', ses);
+  http ('    <link rel="salmon" href="%V" />\n', ses); 
+  -- XXX: for reply message
+  --http ('    <updated>%V</updated>', ses);
+  --http ('    <thr:in-reply-to xmlns:thr="http://purl.org/syndication/thread/1.0" ref="%V"/>', ses);
+  --http ('    <title>%V</title>', ses);
+  http ('    <content>%V</content>\n', ses);
+  http ('</entry>\n', ses);
+  ses := string_output_string (ses);
+  m := sprintf (ses, sender_name, sender_email, refid, acct, msg);
+  return sp_client (ep, m, sender);
+}
+;
+
+create procedure sp_client (in ep varchar, in msg varchar, in uid varchar)
+{
+  declare ret any;
+  commit work;
+  ret := http_get (ep, null, 'GET', 'Content-Type: application/magic-envelope+xml', ods..sp_sign (msg, uid));
+  return ret;
+}
+;
+
+grant execute on ODS.ODS_API."salmon_endpoint" to ODS_API;
+
+DB.DBA.VHOST_REMOVE (lpath=>'/ods/salmon');
+DB.DBA.VHOST_DEFINE (lpath=>'/ods/salmon', ppath=>'/SOAP/Http/salmon_endpoint', soap_user=>'ODS_API');
+
+use DB;
diff --git a/appsrc/ODS-Framework/scot.sql b/appsrc/ODS-Framework/scot.sql
index 33da1c7..8354b3d 100644
--- a/appsrc/ODS-Framework/scot.sql
+++ b/appsrc/ODS-Framework/scot.sql
@@ -1,7 +1,7 @@
 --
 --  scot.sql
 --
---  $Id: scot.sql,v 1.7.2.1 2009/11/17 21:37:41 source Exp $
+--  $Id: scot.sql,v 1.7.2.2 2010/09/20 10:15:25 source Exp $
 --
 --  Procedures to support the SCOT Ontology RDF data in ODS.
 --
diff --git a/appsrc/ODS-Framework/search.vspx b/appsrc/ODS-Framework/search.vspx
index 2f3d5c4..58146a7 100644
--- a/appsrc/ODS-Framework/search.vspx
+++ b/appsrc/ODS-Framework/search.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: search.vspx,v 1.28.2.5 2010/03/12 09:10:13 source Exp $
+ -  $Id: search.vspx,v 1.28.2.7 2010/10/13 12:16:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -241,16 +241,13 @@
         http (arr[2], ses);
         return;
       }
-      else if (not isarray (arr))
-      {
+      if (not isarray (arr))
         return;
-      }
 
       foreach (any elm in arr) do
       {
         self.gdata_cat_str (elm, ses);
       }
-      return;
     ]]>
   </v:method>
 
@@ -1375,8 +1372,8 @@ if (self.on_type = 'discussion' or self.on_type = 'nntpf')
       <v:template name="rdf_search_tmpl2" type="simple" condition="self.page = 5">
 	<!-- RDF search -->
 	<script type="text/javascript">
-	  var featureList = ["rdfbrowser","dimmer","ajax","dialog","grid","graphsvg","map","timeline",
-	  "menu","dialog","xml","tagcloud","fresnel"];
+	  var featureList = ["rdfbrowser","rdfstore","rdftabs","tab","dimmer","ajax","dialog","grid","graphsvg","map","timeline","menu","xml","tagcloud","fresnel"];
+    OAT.Preferences.imagePath = '/ods/images/oat/';
 	  OAT.Loader.load(featureList, RDFBInit);
 	</script>
 	<div id="throbber">
diff --git a/appsrc/ODS-Framework/search_ajax.vsp b/appsrc/ODS-Framework/search_ajax.vsp
index 7620c90..25c5875 100644
--- a/appsrc/ODS-Framework/search_ajax.vsp
+++ b/appsrc/ODS-Framework/search_ajax.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---   $Id: search_ajax.vsp,v 1.5 2008/03/13 20:50:06 source Exp $
+--   $Id: search_ajax.vsp,v 1.5.2.1 2010/09/20 10:15:25 source Exp $
 --
 --   AJAX Handler for the google map control
 --
diff --git a/appsrc/ODS-Framework/security.vspx b/appsrc/ODS-Framework/security.vspx
index 4147455..b5cbc48 100644
--- a/appsrc/ODS-Framework/security.vspx
+++ b/appsrc/ODS-Framework/security.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: security.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: security.vspx,v 1.4.2.1 2010/09/20 10:15:25 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/semping.sql b/appsrc/ODS-Framework/semping.sql
index 96611a7..ccb9c5d 100644
--- a/appsrc/ODS-Framework/semping.sql
+++ b/appsrc/ODS-Framework/semping.sql
@@ -40,6 +40,9 @@ DB.DBA.EXEC_STMT (
 			PR_FLAG		int default 0,
 			primary key (PR_IRI)
     			)', 0);
+DB.DBA.EXEC_STMT ('create table PING_LOCK (ID int primary key)', 0);
+
+insert soft PING_LOCK values (0);
 
 create trigger PING_RULES_I after insert on PING_RULES referencing new as N
 {
@@ -76,6 +79,13 @@ create trigger PING_RULES_D after delete on PING_RULES referencing old as O
 create procedure CLI_PING (in src varchar, in tgt varchar)
 {
   declare aq any;
+  -- debug code
+  -- dbg_obj_print ('CLI_PING:', current_proc_name (1));
+  if (registry_get ('semping-debug') = 'on') 
+    {
+      dbg_obj_print_vars (src, tgt);
+      return; 
+    }   
   insert soft CLI_QUEUE (CQ_SOURCE, CQ_TARGET) values (src, tgt);
   commit work;
       aq := async_queue (1);
@@ -168,43 +178,59 @@ create procedure "semping-rest" (in source varchar, in target varchar) returns v
 -- pingback server
 create procedure "pingback.ping" (in source varchar, in target varchar) 
 {
-  declare aq, hf any;
+  declare aq, hf, xx any;
   declare qr, src, tgt, srcgr, tgtgr, pred, mail varchar;
 
-  -- dbg_obj_print_vars (source, target);
 
   if (http_acl_get ('SemanticPingback', source, target) = 1)
     {
       signal ('42000', 'Access denied');
     }
 
-  hf := rfc1808_parse_uri (source); hf[5] := '';
-  src := WS.WS.VFS_URI_COMPOSE (hf);
-  hf := rfc1808_parse_uri (target); hf[5] := '';
-  tgt := WS.WS.VFS_URI_COMPOSE (hf);
-
+  -- dbg_obj_print ('------------------------------------');
+  -- dbg_obj_print_vars (source, target);
   set_user_id ('dba');
 
   srcgr := 'urn:temp.semping.src:' || uuid ();
   tgtgr := 'urn:temp.semping.tgt:' || uuid ();
+
+  set isolation = 'serializable';
+  select id into xx from PING_LOCK where ID = 0 for update;
+
+  hf := rfc1808_parse_uri (source); hf[5] := '';
+  src := WS.WS.VFS_URI_COMPOSE (hf);
   sparql load ?:src into graph ?:srcgr;
+  hf := rfc1808_parse_uri (target); hf[5] := '';
+  tgt := WS.WS.VFS_URI_COMPOSE (hf);
   sparql load ?:tgt into graph ?:tgtgr;
 
   pred := (sparql select ?p where { graph `iri(?:srcgr)` { `iri(?:source)` ?p `iri(?:target)` . }});
+  if (0 and pred is null)
+    {
+      declare src1 any;
+      src1 := (sparql prefix sioc: <http://rdfs.org/sioc/ns#> select ?s where { graph `iri(?:srcgr)` { `iri(?:source)` sioc:reply_of ?s . }});
+      if (src1 is not null)
+	{
+	  hf := rfc1808_parse_uri (src1); hf[5] := '';
+	  src := WS.WS.VFS_URI_COMPOSE (hf);
+	  sparql load ?:src into graph ?:srcgr;
+	  pred := (sparql prefix sioc: <http://rdfs.org/sioc/ns#> select ?p where { graph `iri(?:srcgr)` { `iri(?:src1)` ?p `iri(?:target)` . }});
+	}
+    }
   mail := (sparql prefix foaf: <http://xmlns.com/foaf/0.1/> select ?mbox where { graph `iri(?:tgtgr)` { `iri(?:target)` foaf:mbox ?mbox . }}); 
 
---  dbg_obj_print_vars (pred, mail);
-
-  sparql clear iri (?:srcgr);
-  sparql clear iri (?:tgtgr);
+  -- dbg_obj_print_vars (pred, mail);
+  sparql clear graph iri(?:srcgr);
+  sparql clear graph iri(?:tgtgr);
 
   if (mail like 'mailto:%')
     mail := subseq (mail, 7);
 
   if (pred is null)
-    signal ('22023', 'Source does not contains any rellation to target');
+    signal ('22023', 'Source does not contains any relation to target');
 
-  insert soft PINGBACKS (P_SOURCE, P_TARGET, P_PROP, P_MAIL, P_IP, P_STATE) 
+--  dbg_obj_print_vars (source, target, pred, mail);
+  insert replacing PINGBACKS (P_SOURCE, P_TARGET, P_PROP, P_MAIL, P_IP, P_STATE) 
       values (source, target, pred, mail, http_client_ip (), 0);
 
   if (0 = row_count ())
@@ -228,11 +254,11 @@ create procedure GET_TEMPLATE ()
       sprintf ('X-Mailer: OpenLink Virtuoso Mail Client (%s)\r\n', sys_stat('st_dbms_ver')) ||
       'Content-Type: text/plain\r\n' ||
       'Subject: Semantic Pingback Notification\r\n\r\n' ||
-      'The entity <s> is updated with relation <p> connecting to your WebID: <t>\r\n' ||
-      'You may wish add the reciprocal relation in your space.\r\n' ||
+      'The Data Space Entity: <s> has been updated with a new relation <p> that references <t> .\r\n'||
+      'You may also wish to make a reciprocal entry in your Data Space.' ||
       '\r\n' ||
-      'You are receiving this e-mail because you are enabled pingback notification for WebID <t>.\r\n' ||
-      'Please do not answer on this e-mail, it is automatically generated as semantic pingback notification.\r\n' 
+      'Note: you are receiving this mail because you enabled Semantic Pingback notification (with email as notice mechanism)\r\n'||
+      'for your Personal Profile Management Data Space for WebID: <t>. You do not need to respond to this automated email.'
       ;
 }
 ;
diff --git a/appsrc/ODS-Framework/semping_app.vspx b/appsrc/ODS-Framework/semping_app.vspx
index 439f774..b7dc4f9 100644
--- a/appsrc/ODS-Framework/semping_app.vspx
+++ b/appsrc/ODS-Framework/semping_app.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: semping_app.vspx,v 1.1.4.2 2010/06/30 14:31:42 source Exp $
+ -  $Id: semping_app.vspx,v 1.1.4.6 2011/03/08 13:28:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -27,7 +27,9 @@
         xmlns:v="http://www.openlinksw.com/vspx/"
         style="index.xsl"
         doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
-        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+        fast-render="1">
+
   <vm:page>
     <vm:header>
       <vm:title>Semantic Pingback Setup</vm:title>
@@ -62,7 +64,7 @@
                 		  <th>Application Instance IRI</th>
                 		  <th>E-mail for notification</th>
                 		  <th>Automatic update</th>
-                		  <th>Action</th>
+                  		  <th width="5%">Action</th>
                 	  </tr>
                 	  <v:data-set name="ds1" sql="select PR_IRI, PR_EMAIL, PR_FLAG from SEMPING.DBA.PING_RULES where PR_U_ID = :self.u_id"
                 		  scrollable="1" editable="1" nrows="1000">
@@ -83,21 +85,18 @@
                 				    />
                 			    </td>
                 			    <td>
-                				    <v:label name="la3" value="--(control.vc_parent as vspx_row_template).te_rowset[1]"
-                				      format="%s" render-only="1"/>
-
+                    				    <v:label name="la3" value="--(control.vc_parent as vspx_row_template).te_rowset[1]" format="%s" render-only="1"/>
                 			    </td>
                 			    <td>
-                				    <v:label name="la2" value="--case (control.vc_parent as vspx_row_template).te_rowset[2] when 1 then 'Yes' else 'No' end"
-                				      format="%s" render-only="1"/>
-
+                    				    <v:label name="la2" value="--case (control.vc_parent as vspx_row_template).te_rowset[2] when 1 then 'Yes' else 'No' end" format="%s" render-only="1"/>
                 			    </td>
-                			    <td>
-                				    <v:url name="ur2" value='<img src="images/icons/del_16.png" hspace="3" border="0"/>Delete'
+                    			    <td nowrap="nowrap">
+                    				    <v:url name="ur2" value='<img src="images/icons/trash_16.png" hspace="3" border="0"/>Delete'
                 				      format="%s"
                 				      url="--sprintf ('semping_app.vspx?del=%U', (control.vc_parent as vspx_row_template).te_rowset[0])"
                 				      xhtml_title="Delete"
                 				      xhtml_alt="Delete"
+                    				      xhtml_class="img_button"
                 				      />
                 			    </td>
                 			  </tr>
@@ -114,27 +113,34 @@
                 	  </v:data-set>
                 	  </table>
                   	  <div class="fm">
-                  	    <fieldset>
-                  		  <label for="a_name">Application name</label>
+                  	    <fieldset class="form">
+                  	      <div>
+                    		    <label class="form" for="a_name">Application name</label>
                   		  <v:data-list
                   		      name="a_name"
+                  		        xhtml_id="a_name"
 				      sql="select WAM_INST, IRI from (select WAM_INST, sioc..forum_iri (WAM_APP_TYPE, WAM_INST, null) as IRI 
-				      		from DB..WA_MEMBER where WAM_USER = self.u_id and WAM_MEMBER_TYPE = 1 
-						union all select 'Personal Profile' as inst, sioc..person_iri (sioc..user_iri (U_ID)) 
+                				      		   from DB..WA_MEMBER
+                				      		  where WAM_USER = self.u_id and WAM_MEMBER_TYPE = 1
+                						        union all
+                						       select 'Personal Profile Manager' as inst, sioc..person_iri (sioc..user_iri (U_ID))
 						from DB..SYS_USERS where U_ID = self.u_id) x 
 						where not exists (select 1 from SEMPING..PING_RULES where x.IRI = PR_IRI and PR_U_ID = self.u_id)"
                   		      key-column="iri"
                   		      value-column="wam_inst"
-                  		      xhtml_id="a_name" error-glyph="*">
-				  </v:data-list><br />
-				  <label for="mail">E-mail address for notification</label> 
-				  <v:text name="mail" xhtml_size="50" />
-				  <br />
-				  <v:check-box name="flag" xhtml_id="flag" value="1" />
-				  <label for="flag">Add Relations Automatically</label> 
-				  <br />
-
-                 	      <span class="fm_ctl_btn">
+                  		        error-glyph="*">
+  			                    </v:data-list>
+                  	      </div>
+                  	      <div>
+  			                    <label class="form" for="mail">E-mail address for notification</label>
+                  				  <v:text name="mail" xhtml_id="mail" xhtml_size="50" default_value="--(select U_E_MAIL from SYS_USERS where U_ID = self.u_id)"/>
+                  	      </div>
+                  	      <div>
+                  				  <label class="form">&nbsp;</label>
+                  				  <label><v:check-box name="flag" xhtml_id="flag" value="1" />Add Relations Automatically</label>
+                  	      </div>
+                  	      <div>
+                  				  <label class="form"> </label>
                   		  <v:button name="save1" value="Add" action="simple">
                   		    <v:on-post><![CDATA[
                             if (not self.vc_is_valid)
@@ -145,7 +151,7 @@
                             self.a_name.vc_data_bind (e);
                           ]]></v:on-post>
                   		  </v:button>
-                	      </span>
+                  	      </div>
                   	  </fieldset>
                      </div>
                 	</v:form>
diff --git a/appsrc/ODS-Framework/semping_log.vspx b/appsrc/ODS-Framework/semping_log.vspx
index 886fa51..f36002f 100644
--- a/appsrc/ODS-Framework/semping_log.vspx
+++ b/appsrc/ODS-Framework/semping_log.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: semping_log.vspx,v 1.1.4.2 2010/07/05 08:26:09 source Exp $
+ -  $Id: semping_log.vspx,v 1.1.4.3 2010/09/20 10:15:26 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/server.vspx b/appsrc/ODS-Framework/server.vspx
index 25209b6..ff8a823 100644
--- a/appsrc/ODS-Framework/server.vspx
+++ b/appsrc/ODS-Framework/server.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: server.vspx,v 1.5 2008/02/08 13:49:24 source Exp $
+ -  $Id: server.vspx,v 1.5.2.1 2010/09/20 10:15:26 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/services.vspx b/appsrc/ODS-Framework/services.vspx
index 0282ff9..23fd767 100644
--- a/appsrc/ODS-Framework/services.vspx
+++ b/appsrc/ODS-Framework/services.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: services.vspx,v 1.9 2008/04/17 09:10:36 source Exp $
+ -  $Id: services.vspx,v 1.9.2.4 2010/11/11 12:38:18 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -22,7 +22,7 @@
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  -
 -->
-<v:page name="blog-home-page"
+<v:page name="services-page"
         xmlns:vm="http://www.openlinksw.com/vspx/ods/"
         xmlns:v="http://www.openlinksw.com/vspx/"
 	style="index.xsl"
@@ -87,10 +87,11 @@
 	      Search in
 	    </td>
 	    <td>
-	      <v:data-list name="howto" value="--self.filt_app"
+                        <v:data-list name="howto"
+                                     value="--self.filt_app"
 		sql="select '%' as WAT_NAME, 'Any' as WAT_LABEL from WA_SETTINGS union all select WAT_NAME, WA_GET_APP_NAME (WAT_NAME) as WAT_LABEL from WA_TYPES"
-		key-column="WAT_NAME" value-column="WAT_LABEL"
-		>
+                                     key-column="WAT_NAME"
+                                     value-column="WAT_LABEL">
 	      </v:data-list>
 	    </td>
 	  </tr>
@@ -105,9 +106,7 @@
 		<v:item name="Member" value="2"/>
 		<v:on-post>
 		  if (e.ve_initiator = control)
-		  {
 		    self.filt_own := control.ufl_value;
-		  }
 		</v:on-post>
 	      </v:select-list>
 	    </td>
@@ -153,8 +152,8 @@
   </table>
   <v:data-source name="mdss" expression-type="sql" nrows="-1" initial-offset="0">
     <v:expression></v:expression>
-    <v:before-data-bind><![CDATA[
-
+                <v:before-data-bind>
+                  <![CDATA[
       declare cond, ord any;
 
       control.ds_parameters := null;
@@ -185,17 +184,14 @@
       if (self.app_sort_by = 4)
         ord := cast (self.app_sort_by as varchar);
       else
-        ord := sprintf ('lower (%s)',
-            case self.app_sort_by when 2 then 'WAI_DESCRIPTION' when 3 then 'WAI_NAME' when 9 then 'WAI_APP_NAME' end);
-
+                    ord := sprintf ('lower (%s)', case self.app_sort_by when 2 then 'WAI_DESCRIPTION' when 3 then 'WAI_NAME' when 9 then 'WAI_APP_NAME' end);
 
-	control.ds_sql := 'select WAI_ID, WAI_DESCRIPTION, WAI_NAME, WAM_STATUS, WAI_INST, WAM_MEMBER_TYPE, WAI_TYPE_NAME, WAI_IS_FROZEN,
-        WA_GET_APP_NAME (WAI_TYPE_NAME) as WAI_APP_NAME, WAI_IS_PUBLIC
-        from WA_INSTANCE, WA_MEMBER where ' || cond ||
+                  control.ds_sql := 'select WAI_ID, WAI_DESCRIPTION, WAI_NAME, WAM_STATUS, WAI_INST, WAM_MEMBER_TYPE, WAI_TYPE_NAME, WAI_IS_FROZEN, WA_GET_APP_NAME (WAI_TYPE_NAME) as WAI_APP_NAME, WAI_IS_PUBLIC ' ||
+                                    '  from WA_INSTANCE, WA_MEMBER where ' ||
+                                    cond ||
 	' order by ' || ord;
-
-
-    ]]></v:before-data-bind>
+                  ]]>
+                </v:before-data-bind>
     <v:column name="WAI_ID" label="Id" />
     <v:column name="WAI_DESCRIPTION" label="Description" />
     <v:column name="WAI_NAME" label="Name" />
@@ -285,32 +281,13 @@
 		<?vsp
 		    }
 		?>
-                <v:button style="url" value="--coalesce((control.vc_parent as vspx_row_template).te_rowset[2], 'owner')" action="simple" name="membership_enter">
-                  <v:on-post>
-                    <v:script>
-                      <![CDATA[
-                        declare h, id, ss any;
-                        declare inst web_app;
-                        inst := (control.vc_parent as vspx_row_template).te_rowset[4];
-                        ss := null;
-                        declare exit handler for sqlstate 'NOPAT'
-                        {
-                          self.vc_is_valid := 0;
-                          self.vc_error_message := regexp_match ('[^\r\n]*', __SQL_MESSAGE);
-                          return;
-                        };
-                        h := udt_implements_method(inst, 'wa_front_page');
-                        id := call (h) (inst, ss);
-                      ]]>
-                    </v:script>
-                  </v:on-post>
-                </v:button>
+                            <a href="<?vsp http (wa_utf8_to_wide (SIOC..forum_iri ((control as vspx_row_template).te_rowset[6], (control as vspx_row_template).te_rowset[2]) || sprintf ('?sid=%s&realm=%s', self.sid, self.realm))); ?>"><?V wa_utf8_to_wide((control as vspx_row_template).te_rowset[2]) ?></a>
               </td>
               <td>
-                <v:label value="--(control.vc_parent as vspx_row_template).te_rowset[8]" format="%s"/>
+                            <?V (control as vspx_row_template).te_rowset[8] ?>
               </td>
               <td>
-                <v:label value="--coalesce((control.vc_parent as vspx_row_template).te_rowset[1], 'owner')" format="%s"/>
+                            <?V coalesce ((control as vspx_row_template).te_rowset[1], 'owner') ?>
               </td>
               <td>
                 <vm:label value="" format="(%s)">
@@ -321,13 +298,10 @@
                           control.ufl_value := 'owner';
                         else
                           control.ufl_value :=
-                          (select
-                           WMT_NAME
-                          from
-                            WA_MEMBER_TYPE
-                          where
-                            WMT_APP = (control.vc_parent as vspx_row_template).te_rowset[6] and
-                            WMT_ID = (control.vc_parent as vspx_row_template).te_rowset[5]);
+                                      (select WMT_NAME
+                                         from WA_MEMBER_TYPE
+                                        where WMT_APP = (control.vc_parent as vspx_row_template).te_rowset[6]
+                                          and WMT_ID = (control.vc_parent as vspx_row_template).te_rowset[5]);
                       ]]>
                     </v:script>
                   </v:before-render>
@@ -481,7 +455,7 @@
                     <![CDATA[
                       control.ufl_value := '<img src="images/icons/group_16.png" border="0" alt="Members (application)" title="Members (application)"/> Members';
 		      if ((control.vc_parent as vspx_row_template).te_rowset[7] = 1 or
-		        (control.vc_parent as vspx_row_template).te_rowset[6] in ('oDrive', 'oMail', 'IM'))
+                                    (control.vc_parent as vspx_row_template).te_rowset[6] in ('oMail', 'IM'))
 		        control.vc_enabled := 0;
                     ]]>
                   </v:after-data-bind>
@@ -506,15 +480,7 @@
                           http_header(sprintf('Location: services.vspx?sid=%s&realm=%s\r\n', self.sid, self.realm));
                           return;
                         }
-
-                        --declare h, id, ss any;
-                        --declare inst web_app;
-                        --inst := (control.vc_parent as vspx_row_template).te_rowset[4];
-                        --ss := null;
-                        --h := udt_implements_method (inst, 'wa_membership_edit_form');
-			--id := call (h) (inst, ss);
-			self.vc_redirect (sprintf ('members.vspx?wai_id=%d',
-				(control.vc_parent as vspx_row_template).te_rowset[0]));
+                                  self.vc_redirect (sprintf ('members.vspx?wai_id=%d', (control.vc_parent as vspx_row_template).te_rowset[0]));
                       ]]>
                     </v:script>
                   </v:on-post>
@@ -527,8 +493,7 @@
                   <v:after-data-bind>
                     <![CDATA[
                       control.ufl_value := '<img src="images/icons/group_16.png" border="0" alt="Related (applications)" title="Related (applications)"/> Related';
-		      if ((control.vc_parent as vspx_row_template).te_rowset[7] = 1 or
-		        (control.vc_parent as vspx_row_template).te_rowset[6] in ('oDrive', 'oMail', 'IM'))
+                                if ((control.vc_parent as vspx_row_template).te_rowset[7] = 1)
 		        control.vc_enabled := 0;
                     ]]>
                   </v:after-data-bind>
@@ -550,8 +515,7 @@
 			    self.vc_redirect ('services.vspx');
                             return;
                           }
-			self.vc_redirect (sprintf ('related_apps.vspx?wai_id=%d',
-			   (control.vc_parent as vspx_row_template).te_rowset[0]));
+                                  self.vc_redirect (sprintf ('related_apps.vspx?wai_id=%d', (control.vc_parent as vspx_row_template).te_rowset[0]));
                       ]]>
                     </v:script>
                   </v:on-post>
diff --git a/appsrc/ODS-Framework/settings.vspx b/appsrc/ODS-Framework/settings.vspx
index 33af764..8aed575 100644
--- a/appsrc/ODS-Framework/settings.vspx
+++ b/appsrc/ODS-Framework/settings.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: settings.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: settings.vspx,v 1.4.2.1 2010/09/20 10:15:26 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sfoaf.xml b/appsrc/ODS-Framework/sfoaf.xml
index 8281f5e..fc50daa 100644
--- a/appsrc/ODS-Framework/sfoaf.xml
+++ b/appsrc/ODS-Framework/sfoaf.xml
@@ -1,7 +1,7 @@
 <?xml version ='1.0' encoding='UTF-8'?>
 <!--
  -
- -  $Id: sfoaf.xml,v 1.3 2008/03/13 20:50:06 source Exp $
+ -  $Id: sfoaf.xml,v 1.3.2.1 2010/09/20 10:15:26 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sfront.vspx b/appsrc/ODS-Framework/sfront.vspx
index 722710b..53ba84a 100644
--- a/appsrc/ODS-Framework/sfront.vspx
+++ b/appsrc/ODS-Framework/sfront.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sfront.vspx,v 1.6 2008/03/13 20:50:06 source Exp $
+ -  $Id: sfront.vspx,v 1.6.2.1 2010/09/20 10:15:26 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sioc.sql b/appsrc/ODS-Framework/sioc.sql
index c1daa4f..a9c6ce9 100644
--- a/appsrc/ODS-Framework/sioc.sql
+++ b/appsrc/ODS-Framework/sioc.sql
@@ -1,7 +1,7 @@
 --
 --  sioc.sql
 --
---  $Id: sioc.sql,v 1.79.2.32 2010/07/05 08:26:09 source Exp $
+--  $Id: sioc.sql,v 1.79.2.45 2011/03/08 13:28:16 source Exp $
 --
 --  Procedures to support the SIOC Ontology RDF data in ODS.
 --
@@ -79,8 +79,7 @@ create procedure get_graph_new (
     return sprintf ('http://%s/dataspace/protected/%s',arr[0],arr[1]);
   }
   return null;
-}
-;
+};
 
 create procedure get_ods_link ()
 {
@@ -230,6 +229,16 @@ create procedure cert_iri (in s varchar)
   return concat ('http://www.w3.org/ns/auth/cert#', s);
 };
 
+create procedure rev_iri (in s varchar)
+{
+  return concat ('http://purl.org/stuff/rev#', s);
+};
+
+create procedure like_iri (in s varchar)
+{
+  return concat ('http://ontologi.es/like#', s);
+};
+
 create procedure rsa_iri (in s varchar)
 {
   return concat ('http://www.w3.org/ns/auth/rsa#', s);
@@ -240,9 +249,9 @@ create procedure offer_iri (in s varchar)
   return concat ('http://purl.org/goodrelations/v1#', s);
 };
 
-create procedure wishlist_iri (in s varchar)
+create procedure acl_iri (in s varchar)
 {
-  return concat ('http://purl.org/vocab/barter/0.1/', s);
+  return concat ('http://www.w3.org/ns/auth/acl#', s);
 };
 
 create procedure make_href (in u varchar)
@@ -459,6 +468,21 @@ create procedure wishlist_forum_iri (in wai_name varchar, in wai_member varchar)
   return forum_iri ('wishlist', wai_name, wai_member);
 };
 
+create procedure ownslist_forum_iri (in wai_name varchar, in wai_member varchar)
+{
+  return forum_iri ('ownslist', wai_name, wai_member);
+};
+
+create procedure like_forum_iri (in wai_name varchar, in wai_member varchar)
+{
+  return forum_iri ('like', wai_name, wai_member);
+};
+
+create procedure dislike_forum_iri (in wai_name varchar, in wai_member varchar)
+{
+  return forum_iri ('dislike', wai_name, wai_member);
+};
+
 create procedure favorite_forum_iri (in wai_name varchar, in wai_member varchar)
 {
   return forum_iri ('favoritethings', wai_name, wai_member);
@@ -489,6 +513,9 @@ create procedure ods_sioc_forum_ext_type (in app varchar)
 	'Calendar',      ext_iri ('Calendar'),
 	'OfferList',     ext_iri ('OfferList'),
 	'WishList',      ext_iri ('WishList'),
+	'OwnsList',      ext_iri ('OwnsList'),
+	'Likes',         ext_iri ('Likes'),
+	'DisLikes',      ext_iri ('DisLikes'),
 	'FavoriteThings',ext_iri ('FavoriteThings')
 	), app);
 };
@@ -513,6 +540,9 @@ create procedure ods_sioc_forum_type (in app varchar)
 	'Calendar',      'Container',
 	'OfferList',     'Container',
 	'WishList',      'Container',
+	'OwnsList',      'Container',
+	'Likes',         'Container',
+	'DisLikes',      'Container',
 	'FavoriteThings','Container'
 	), app);
   return sioc_iri (pclazz);
@@ -635,6 +665,11 @@ create procedure wishlist_item_iri (in forum_iri varchar, in ID integer)
   return forum_iri || '/' || cast (ID as varchar);
 };
 
+create procedure likes_item_iri (in forum_iri varchar, in ID integer)
+{
+  return forum_iri || '/' || cast (ID as varchar);
+};
+
 create procedure favorite_item_iri (in forum_iri varchar, in ID integer)
 {
   return forum_iri || '/' || cast (ID as varchar);
@@ -718,39 +753,60 @@ create procedure sioc_user (in graph_iri varchar, in iri varchar, in u_name varc
 
 };
 
-create procedure wa_user_pub_info (in flags varchar, in fld int)
+create procedure wa_user_check (inout txt varchar, inout flags varchar, in fld integer)
 {
-  declare r any;
+  declare exit handler for sqlstate '*' { return 0; };
+
+  if (isnull (txt))
+    return 0;
+
+  if ((internal_type (txt) <> 211) and not length (txt))
+    return 0;
+
   if (length (flags) <= fld)
     return 0;
-  r := atoi (chr (flags[fld]));
-  if (r = 1)
+
+  if (atoi (chr (flags[fld])) <= 2)
     return 1;
+
   return 0;
 };
 
-create procedure wa_pub_info (in txt varchar, in flags varchar, in fld int)
+create procedure wa_user_graph (inout flags varchar, in fld integer, inout public_graph_iri varchar, inout protected_graph_iri varchar)
 {
-  if (length (txt) and wa_user_pub_info (flags, fld))
-    return 1;
-  return 0;
+  if (atoi (chr (flags[fld])) <= 1)
+    return public_graph_iri;
+
+  return protected_graph_iri;
 };
 
-create procedure wa_user_priv_info (in flags varchar, in fld int)
+create procedure wa_user_pub_info (in flags varchar, in fld integer)
 {
-  declare r any;
   if (length (flags) <= fld)
     return 0;
-  r := atoi (chr (flags[fld]));
-  if (r = 2)
+
+  if (atoi (chr (flags[fld])) = 1)
     return 1;
+
   return 0;
 };
 
-create procedure wa_priv_info (in txt varchar, in flags varchar, in fld int)
+create procedure wa_pub_info (in txt varchar, in flags varchar, in fld integer)
 {
-  if (length (txt) and wa_user_priv_info (flags, fld))
+  if (length (txt) and wa_user_pub_info (flags, fld))
     return 1;
+
+  return 0;
+};
+
+create procedure wa_user_protected_check (in flags varchar, in fld integer)
+{
+  if (length (flags) <= fld)
+    return 0;
+
+  if (atoi (chr (flags[fld])) = 2)
+    return 1;
+
   return 0;
 };
 
@@ -775,9 +831,9 @@ create procedure sioc_user_cert (in graph_iri varchar, in person_iri varchar, in
 ;
 
 create procedure sioc_user_info (
-    in graph_iri varchar,
+    in public_graph_iri varchar,
     in in_iri varchar,
-    in old_is_org integer,
+    in is_org integer,
     in flags varchar,
     in waui_first_name varchar,
     in waui_last_name varchar,
@@ -789,13 +845,16 @@ create procedure sioc_user_info (
     in msn varchar := null,
     in aim varchar := null,
     in yahoo varchar := null,
+    in skype varchar := null,
     in birthday datetime := null,
     in org varchar := null,
     in phone varchar := null,
+    in hb_latlng integer := 0,
     in lat float := null,
     in lng float := null,
+    in blat float := null,
+    in blng float := null,
     in webpage varchar := null,
-    -- new props
     in photo varchar := null,
     in org_page varchar := null,
     in resume varchar := null,
@@ -808,60 +867,20 @@ create procedure sioc_user_info (
     in hstate varchar := null,
     in hcountry varchar := null,
     in ext_urls any := null,
-    in hb_latlng int := 0,
     in cert any := null
     )
 {
-  declare org_iri, iri any;
-  declare addr_iri any;
-  declare giri, crt_iri, crt_exp, crt_mod, protected varchar;
-  declare ev_iri, hf any;
-  declare is_person int;
+  declare work_graph_iri, protected_graph_iri, ev_iri, addr_iri, org_iri, iri, giri, crt_iri, crt_exp, crt_mod, protected varchar;
+  declare hf, V any;
+  declare N, is_person integer;
 
   if (in_iri is null)
     return;
 
-  if (not isnull (old_is_org))
-  {
-    iri := person_iri (in_iri, '', old_is_org);
-  org_iri := iri || '#org';
-  addr_iri := iri || '#addr';
-  ev_iri := iri || '#event';
-  crt_iri := iri || '#cert';
-  crt_exp := iri || '#cert_exp';
-  crt_mod := iri || '#cert_mod';
-  giri := iri || '#based_near';
-    iri := person_iri (in_iri, tp=>old_is_org);
-
-  delete_quad_sp (graph_iri, iri, foaf_iri ('firstName'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('family_name'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('name'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('mbox'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('gender'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('icqChatID'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('msnChatID'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('aimChatID'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('yahooChatID'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('birthday'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('organization'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('phone'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('based_near'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('homepage'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('depiction'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('interest'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('topic_interest'));
-  delete_quad_sp (graph_iri, iri, foaf_iri ('workplaceHomepage'));
-  delete_quad_sp (graph_iri, iri, bio_iri ('olb'));
-  delete_quad_sp (graph_iri, iri, owl_iri ('sameAs'));
-  delete_quad_s_or_o (graph_iri, ev_iri, ev_iri);
-  delete_quad_s_or_o (graph_iri, org_iri, org_iri);
-  delete_quad_s_or_o (graph_iri, addr_iri, addr_iri);
-  delete_quad_s_or_o (graph_iri, giri, giri);
-  delete_quad_s_or_o (graph_iri, crt_iri, crt_iri);
-  delete_quad_s_or_o (graph_iri, crt_exp, crt_exp);
-  delete_quad_s_or_o (graph_iri, crt_mod, crt_mod);
-  }
+  V := sprintf_inverse (in_iri, 'http://%s/dataspace/%s#this', 1);
+  protected_graph_iri := public_graph_iri || '/protected/' || V[1];
 
+  sioc_user_info_delete (vector (public_graph_iri, protected_graph_iri), in_iri, is_org);
   ods_sioc_result (in_iri);
 
   iri := person_iri (in_iri, '');
@@ -875,54 +894,81 @@ create procedure sioc_user_info (
   iri := person_iri (in_iri);
   is_person := case when (iri like '%/organization/%') then 0 else 1 end;
 
-  if (is_person and length (waui_first_name) and wa_user_pub_info (flags, 1))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('firstName'), waui_first_name);
-  if (is_person and length (waui_last_name) and wa_user_pub_info (flags, 2))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('family_name'), waui_last_name);
+  if (is_person and wa_user_check (waui_first_name, flags, 1))
+    DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 1, public_graph_iri, protected_graph_iri), iri, foaf_iri ('firstName'), waui_first_name);
 
-  if (length (full_name) and wa_user_pub_info (flags, 3))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('name'), full_name);
-  if (length (mail) and wa_user_pub_info (flags, 4))
-    DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('mbox'), 'mailto:' || mail);
-
-  if (is_person and length (gender) and wa_user_pub_info (flags, 5))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('gender'), gender);
-  if (length (icq) and wa_user_pub_info (flags, 10))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('icqChatID'), icq);
-  if (length (msn) and wa_user_pub_info (flags, 14))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('msnChatID'), msn);
-  if (length (aim) and wa_user_pub_info (flags, 12))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('aimChatID'), aim);
-  if (length (yahoo) and wa_user_pub_info (flags, 13))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('yahooChatID'), yahoo);
-  if (birthday is not null and wa_user_pub_info (flags, 6))
+  if (is_person and wa_user_check (waui_last_name, flags, 2))
+    DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 2, public_graph_iri, protected_graph_iri), iri, foaf_iri ('family_name'), waui_last_name);
+
+  if (wa_user_check (full_name, flags, 3))
+    DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 3, public_graph_iri, protected_graph_iri), iri, foaf_iri ('name'), full_name);
+
+  if (wa_user_check (mail, flags, 4))
     {
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('birthday'), substring (datestring(coalesce (birthday, now())), 6, 5));
-      DB.DBA.ODS_QUAD_URI (graph_iri, ev_iri, rdf_iri ('type'), bio_iri ('Birth'));
-      DB.DBA.ODS_QUAD_URI (graph_iri, iri, bio_iri ('event'), ev_iri);
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, ev_iri, dc_iri ('date'), substring (datestring(birthday), 1, 10));
+      work_graph_iri := wa_user_graph (flags, 4, public_graph_iri, protected_graph_iri);
+      DB.DBA.ODS_QUAD_URI (work_graph_iri, iri, foaf_iri ('mbox'), 'mailto:' || mail);
+      DB.DBA.ODS_QUAD_URI (work_graph_iri, iri, owl_iri ('sameAs'), 'acct:' || mail);
     }
-  if (length (phone) and wa_user_pub_info (flags, 18) and wa_user_pub_info (flags, 25))
+
+  if (is_person and wa_user_check (gender, flags, 5))
+    DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 5, public_graph_iri, protected_graph_iri), iri, foaf_iri ('gender'), gender);
+
+  if (wa_user_check (icq, flags, 10))
+    DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 10, public_graph_iri, protected_graph_iri), iri, foaf_iri ('icqChatID'), icq);
+
+  if (wa_user_check (msn, flags, 14))
+    DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 14, public_graph_iri, protected_graph_iri), iri, foaf_iri ('msnChatID'), msn);
+
+  if (wa_user_check (aim, flags, 12))
+    DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 12, public_graph_iri, protected_graph_iri), iri, foaf_iri ('aimChatID'), aim);
+
+  if (wa_user_check (yahoo, flags, 13))
+    DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 13, public_graph_iri, protected_graph_iri), iri, foaf_iri ('yahooChatID'), yahoo);
+
+  if (wa_user_check (skype, flags, 11))
+    sioc_user_account (wa_user_graph (flags, 11, public_graph_iri, protected_graph_iri), iri, skype, 'skype:' || skype || '?chat');
+
+  if (wa_user_check (birthday, flags, 6))
+    {
+      work_graph_iri := wa_user_graph (flags, 6, public_graph_iri, protected_graph_iri);
+      DB.DBA.ODS_QUAD_URI_L (work_graph_iri, iri, foaf_iri ('birthday'), substring (datestring(coalesce (birthday, now())), 6, 5));
+      DB.DBA.ODS_QUAD_URI (work_graph_iri, ev_iri, rdf_iri ('type'), bio_iri ('Birth'));
+      DB.DBA.ODS_QUAD_URI (work_graph_iri, iri, bio_iri ('event'), ev_iri);
+      DB.DBA.ODS_QUAD_URI_L (work_graph_iri, ev_iri, dc_iri ('date'), substring (datestring(birthday), 1, 10));
+    }
+
+  if (wa_user_check (phone, flags, 18))
     {
       phone := replace (replace (replace (phone, '-', ''), ',', ''), ' ', '');
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('phone'), 'tel:' || phone);
+      DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 18, public_graph_iri, protected_graph_iri), iri, foaf_iri ('phone'), 'tel:' || phone);
+    }
+
+  N := 39;
+  if (hb_latlng)
+    {
+    N := 47;
+    lat := blat;
+    lng := lng;
     }
-  if (lat is not null and lng is not null and wa_user_pub_info (flags, (case when hb_latlng = 0 then 39 else 47 end)))
+  if (lat is not null and wa_user_check (lng, flags, N))
     {
-      DB.DBA.ODS_QUAD_URI (graph_iri, giri, rdf_iri ('type'), geo_iri ('Point'));
-      DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('based_near'), giri);
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, giri, geo_iri ('lat'), sprintf ('%.06f', coalesce (lat, 0)));
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, giri, geo_iri ('long'), sprintf ('%.06f', coalesce (lng, 0)));
+      work_graph_iri := wa_user_graph (flags, N, public_graph_iri, protected_graph_iri);
+      DB.DBA.ODS_QUAD_URI (work_graph_iri, giri, rdf_iri ('type'), geo_iri ('Point'));
+      DB.DBA.ODS_QUAD_URI (work_graph_iri, iri, foaf_iri ('based_near'), giri);
+      DB.DBA.ODS_QUAD_URI_L (work_graph_iri, giri, geo_iri ('lat'), sprintf ('%.06f', coalesce (lat, 0)));
+      DB.DBA.ODS_QUAD_URI_L (work_graph_iri, giri, geo_iri ('long'), sprintf ('%.06f', coalesce (lng, 0)));
     }
-  if (wa_pub_info (photo, flags, 37))
-    DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('depiction'), DB.DBA.WA_LINK (1, photo));
 
-  if (is_person and length (org) and length (org_page) and wa_user_pub_info (flags, 20))
+  if (wa_user_check (photo, flags, 37))
+    DB.DBA.ODS_QUAD_URI (wa_user_graph (flags, 37, public_graph_iri, protected_graph_iri), iri, foaf_iri ('depiction'), DB.DBA.WA_LINK (1, photo));
+
+  if (is_person and length (org) and wa_user_check (org_page, flags, 20))
     {
-      DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('workplaceHomepage'), org_page);
-      DB.DBA.ODS_QUAD_URI (graph_iri, org_iri, rdf_iri ('type') , foaf_iri ('Organization'));
-      DB.DBA.ODS_QUAD_URI (graph_iri, org_iri, foaf_iri ('homepage'), org_page);
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, org_iri, dc_iri ('title'), org);
+      work_graph_iri := wa_user_graph (flags, 20, public_graph_iri, protected_graph_iri);
+      DB.DBA.ODS_QUAD_URI (work_graph_iri, iri, foaf_iri ('workplaceHomepage'), org_page);
+      DB.DBA.ODS_QUAD_URI (work_graph_iri, org_iri, rdf_iri ('type') , foaf_iri ('Organization'));
+      DB.DBA.ODS_QUAD_URI (work_graph_iri, org_iri, foaf_iri ('homepage'), org_page);
+      DB.DBA.ODS_QUAD_URI_L (work_graph_iri, org_iri, dc_iri ('title'), org);
     }
 
   if (is_person and length (interests))
@@ -931,11 +977,9 @@ create procedure sioc_user_info (
 	{
 	  if (length (interest))
 	    {
-  	      DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('interest'), interest);
+  	      DB.DBA.ODS_QUAD_URI (public_graph_iri, iri, foaf_iri ('interest'), interest);
 	      if (length (label))
-		{
-  		      DB.DBA.ODS_QUAD_URI_L (graph_iri, interest, rdfs_iri ('label'), label);
-		}
+  		      DB.DBA.ODS_QUAD_URI_L (public_graph_iri, interest, rdfs_iri ('label'), label);
 	    }
 	}
     }
@@ -946,48 +990,71 @@ create procedure sioc_user_info (
   	  {
   	    if (length (interest))
   	    {
-  	      DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('topic_interest'), interest);
+  	      DB.DBA.ODS_QUAD_URI (public_graph_iri, iri, foaf_iri ('topic_interest'), interest);
   	      if (length (label))
-  		    {
-  		      DB.DBA.ODS_QUAD_URI_L (graph_iri, interest, rdfs_iri ('label'), label);
-  		    }
+  		      DB.DBA.ODS_QUAD_URI_L (public_graph_iri, interest, rdfs_iri ('label'), label);
   	    }
   	  }
     }
 
-  if (wa_pub_info (hcountry,  flags, 16) or
-      wa_pub_info (hstate,    flags, 59) or
-      wa_pub_info (hcity,     flags, 58) or
-      wa_pub_info (hcode,     flags, 57) or
-      wa_pub_info (haddress1, flags, 15) or
-      wa_pub_info (haddress2, flags, 15)
+  if (wa_user_check (hcountry,  flags, 16) or
+      wa_user_check (hstate,    flags, 59) or
+      wa_user_check (hcity,     flags, 58) or
+      wa_user_check (hcode,     flags, 57) or
+      wa_user_check (haddress1, flags, 15) or
+      wa_user_check (haddress2, flags, 15)
      )
     {
-      DB.DBA.ODS_QUAD_URI (graph_iri, iri, vcard_iri ('ADR'), addr_iri);
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, rdf_iri ('type'), vcard_iri ('home'));
-      if (wa_pub_info (hcountry, flags, 16))
-        DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, vcard_iri ('Country'), hcountry);
-      if (wa_pub_info (hstate, flags, 59))
-	      DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, vcard_iri ('Region'), hstate);
-      if (wa_pub_info (hcity, flags, 58))
-	      DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, vcard_iri ('Locality'), hcity);
-      if (wa_pub_info (hcode, flags, 57))
-	      DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, vcard_iri ('Pobox'), hcode);
-      if (wa_pub_info (haddress1, flags, 15))
-	      DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, vcard_iri ('Street'), haddress1);
-      if (wa_pub_info (haddress2, flags, 15))
-	      DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, vcard_iri ('Extadd'), haddress2);
-    }
-
-  if (is_person and wa_pub_info (resume, flags, 34))
+      if (
+          wa_user_pub_info (flags, 16) or
+          wa_user_pub_info (flags, 59) or
+          wa_user_pub_info (flags, 58) or
+          wa_user_pub_info (flags, 57) or
+          wa_user_pub_info (flags, 15) or
+          wa_user_pub_info (flags, 15)
+         )
+      {
+        DB.DBA.ODS_QUAD_URI (public_graph_iri, iri, vcard_iri ('ADR'), addr_iri);
+        DB.DBA.ODS_QUAD_URI_L (public_graph_iri, addr_iri, rdf_iri ('type'), vcard_iri ('home'));
+      }
+      if (
+          wa_user_protected_check (flags, 16) or
+          wa_user_protected_check (flags, 59) or
+          wa_user_protected_check (flags, 58) or
+          wa_user_protected_check (flags, 57) or
+          wa_user_protected_check (flags, 15) or
+          wa_user_protected_check (flags, 15)
+         )
     {
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, bio_iri ('olb'), resume);
+        DB.DBA.ODS_QUAD_URI (protected_graph_iri, iri, vcard_iri ('ADR'), addr_iri);
+        DB.DBA.ODS_QUAD_URI_L (protected_graph_iri, addr_iri, rdf_iri ('type'), vcard_iri ('home'));
+      }
+      if (wa_user_check (hcountry, flags, 16))
+        DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 16, public_graph_iri, protected_graph_iri), addr_iri, vcard_iri ('Country'), hcountry);
+
+      if (wa_user_check (hstate, flags, 59))
+	      DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 59, public_graph_iri, protected_graph_iri), addr_iri, vcard_iri ('Region'), hstate);
+
+      if (wa_user_check (hcity, flags, 58))
+	      DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 58, public_graph_iri, protected_graph_iri), addr_iri, vcard_iri ('Locality'), hcity);
+
+      if (wa_user_check (hcode, flags, 57))
+	      DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 57, public_graph_iri, protected_graph_iri), addr_iri, vcard_iri ('Pobox'), hcode);
+
+      if (wa_user_check (haddress1, flags, 15))
+	      DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 15, public_graph_iri, protected_graph_iri), addr_iri, vcard_iri ('Street'), haddress1);
+
+      if (wa_user_check (haddress2, flags, 15))
+	      DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 15, public_graph_iri, protected_graph_iri), addr_iri, vcard_iri ('Extadd'), haddress2);
     }
 
-  if (wa_pub_info (webpage, flags, 7))
-    DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('homepage'), webpage);
+  if (is_person and wa_user_check (resume, flags, 34))
+      DB.DBA.ODS_QUAD_URI_L (wa_user_graph (flags, 34, public_graph_iri, protected_graph_iri), iri, bio_iri ('olb'), resume);
 
-  if (length (ext_urls) and wa_pub_info (ext_urls, flags, 8))
+  if (wa_user_check (webpage, flags, 7))
+    DB.DBA.ODS_QUAD_URI (wa_user_graph (flags, 7, public_graph_iri, protected_graph_iri), iri, foaf_iri ('homepage'), webpage);
+
+  if (wa_user_check (ext_urls, flags, 8))
     {
       declare arr any;
       ext_urls := blob_to_string (ext_urls);
@@ -997,11 +1064,10 @@ create procedure sioc_user_info (
       foreach (any u in arr) do
 	{
 	  if (length (trim (u)))
-	    {
-   	      DB.DBA.ODS_QUAD_URI (graph_iri, iri, owl_iri ('sameAs'), u);
-	    }
+   	      DB.DBA.ODS_QUAD_URI (wa_user_graph (flags, 8, public_graph_iri, protected_graph_iri), iri, owl_iri ('sameAs'), u);
 	}
     }
+
   protected := null;
   if (server_https_port () is not null)
     {
@@ -1025,7 +1091,8 @@ create procedure sioc_user_info (
       hf := rfc1808_parse_uri (iri);
       hf[5] := '';
       hf[0] := 'https';
-      for select top 1 HP_HOST, HP_LISTEN_HOST from DB.DBA.HTTP_PATH 
+      for select top 1 HP_HOST, HP_LISTEN_HOST
+            from DB.DBA.HTTP_PATH
 	where HP_LPATH = '/dataspace' and HP_SECURITY = 'SSL' and HP_LISTEN_HOST <> '*sslini*' do
 	  {
 	    declare pos int;
@@ -1040,255 +1107,89 @@ create procedure sioc_user_info (
       hf[1] := host;
       protected := DB.DBA.vspx_uri_compose (hf);
     }
+
   if (protected is not null)
-    {
-      DB.DBA.ODS_QUAD_URI (graph_iri, iri, rdfs_iri ('seeAlso'), protected);
-    }
+    DB.DBA.ODS_QUAD_URI (public_graph_iri, iri, rdfs_iri ('seeAlso'), protected);
+
   -- disabled, see above function
   if (0 and length (cert))
 	{
 	  declare info, modulus, exponent any;
 
 	  info := get_certificate_info (9, cast (cert as varchar), 0);
-    --      dbg_obj_print (info);
 	  if (info is not null and isarray (info) and cast (info[0] as varchar) = 'RSAPublicKey')
 	    {
-    	  DB.DBA.ODS_QUAD_URI (graph_iri, crt_iri, cert_iri ('identity'), iri);
+    	  DB.DBA.ODS_QUAD_URI (public_graph_iri, crt_iri, cert_iri ('identity'), iri);
 	      modulus := info[2];
 	      exponent := info[1];
-    	  DB.DBA.ODS_QUAD_URI (graph_iri, crt_iri, rdf_iri ('type'), rsa_iri ('RSAPublicKey'));
-
-	  DB.DBA.ODS_QUAD_URI_L_TYPED (graph_iri,crt_iri, rsa_iri ('modulus'), bin2hex (modulus), cert_iri ('hex'), null);
-	  DB.DBA.ODS_QUAD_URI_L_TYPED (graph_iri,crt_iri, rsa_iri ('public_exponent'), cast (exponent as varchar), cert_iri ('int'), null);
+    	  DB.DBA.ODS_QUAD_URI (public_graph_iri, crt_iri, rdf_iri ('type'), rsa_iri ('RSAPublicKey'));
+    	  DB.DBA.ODS_QUAD_URI_L_TYPED (public_graph_iri, crt_iri, rsa_iri ('modulus'), bin2hex (modulus), cert_iri ('hex'), null);
+    	  DB.DBA.ODS_QUAD_URI_L_TYPED (public_graph_iri, crt_iri, rsa_iri ('public_exponent'), cast (exponent as varchar), cert_iri ('int'), null);
     	  --DB.DBA.ODS_QUAD_URI (graph_iri, crt_iri, rsa_iri ('modulus'), crt_mod);
     	  --DB.DBA.ODS_QUAD_URI (graph_iri, crt_iri, rsa_iri ('public_exponent'), crt_exp);
     	  --DB.DBA.ODS_QUAD_URI_L (graph_iri, crt_mod, cert_iri ('hex'), bin2hex (modulus));
     	  --DB.DBA.ODS_QUAD_URI_L (graph_iri, crt_exp, cert_iri ('decimal'), cast (exponent as varchar));
 	    }
 	}
-  sioc_user_private_info (graph_iri,
-                          in_iri,
-                          flags,
-                          waui_first_name,
-                          waui_last_name,
-                          title,
-                          full_name,
-                          mail,
-                          gender,
-                          icq,
-                          msn,
-                          aim,
-                          yahoo,
-                          birthday,
-                          org,
-                          phone,
-                          lat,
-                          lng,
-                          webpage,
-                          photo,
-                          org_page,
-                          resume,
-                          interests,
-                          interestTopics,
-                          haddress1,
-                          haddress2,
-                          hcode,
-                          hcity,
-                          hstate,
-                          hcountry,
-                          ext_urls,
-                          hb_latlng);
-};
-
-create procedure sioc_user_private_info (
-    in graph_iri varchar,
+};
+
+create procedure sioc_user_info_delete (
+    in graphs varchar,
     in in_iri varchar,
-    in flags varchar,
-    in waui_first_name varchar,
-    in waui_last_name varchar,
-    in title varchar := null,
-    in full_name varchar := null,
-    in mail varchar := null,
-    in gender varchar := null,
-    in icq varchar := null,
-    in msn varchar := null,
-    in aim varchar := null,
-    in yahoo varchar := null,
-    in birthday datetime := null,
-    in org varchar := null,
-    in phone varchar := null,
-    in lat float := null,
-    in lng float := null,
-    in webpage varchar := null,
-    in photo varchar := null,
-    in org_page varchar := null,
-    in resume varchar := null,
-    in interests any := null,
-    in interestTopics any := null,
-    in haddress1 varchar := null,
-    in haddress2 varchar := null,
-    in hcode varchar := null,
-    in hcity varchar := null,
-    in hstate varchar := null,
-    in hcountry varchar := null,
-    in ext_urls any := null,
-    in hb_latlng int := 0
+    in is_org integer
   )
 {
-  declare org_iri, iri any;
-  declare addr_iri any;
-  declare giri varchar;
-  declare ev_iri any;
-  declare is_person int;
-  declare arr any;
+  declare ev_iri, addr_iri, org_iri, iri, giri, crt_iri, crt_exp, crt_mod varchar;
 
-  if (iri is null)
+  if (in_iri is null)
     return;
-  is_person := 1;
-  iri := person_iri (in_iri, '');
-  arr := sprintf_inverse (in_iri, 'http://%s/dataspace/%s#this', 1);
-  graph_iri := graph_iri || '/protected/' || arr[1];
 
-  exec (sprintf ('sparql clear graph <%S>', graph_iri));
+  if (is_org is null)
+    return;
 
+  iri      := person_iri (in_iri, '', is_org);
   org_iri := iri || '#org';
   addr_iri := iri || '#addr';
   ev_iri := iri || '#event';
+  crt_iri  := iri || '#cert';
+  crt_exp  := iri || '#cert_exp';
+  crt_mod  := iri || '#cert_mod';
   giri := iri || '#based_near';
-  iri := person_iri (in_iri);
-  if (iri like '%/organization/%')
-    is_person := 0;
-
-  ods_sioc_result (iri);
-
-  if (is_person and length (waui_first_name) and wa_user_priv_info (flags, 1))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('firstName'), waui_first_name);
-  if (is_person and length (waui_last_name) and wa_user_priv_info (flags, 2))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('family_name'), waui_last_name);
-
-  if (is_person and length (gender) and wa_user_priv_info (flags, 5))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('gender'), gender);
-  if (length (icq) and wa_user_priv_info (flags, 10))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('icqChatID'), icq);
-  if (length (msn) and wa_user_priv_info (flags, 14))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('msnChatID'), msn);
-  if (length (aim) and wa_user_priv_info (flags, 12))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('aimChatID'), aim);
-  if (length (yahoo) and wa_user_priv_info (flags, 13))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('yahooChatID'), yahoo);
-
-  if (length (full_name) and wa_user_priv_info (flags, 3))
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('name'), full_name);
-  if (length (mail) and wa_user_priv_info (flags, 4))
-    DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('mbox'), 'mailto:' || mail);
-
-  if (birthday is not null and wa_user_priv_info (flags, 6))
-    {
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('birthday'), substring (datestring(coalesce (birthday, now())), 6, 5));
-      DB.DBA.ODS_QUAD_URI (graph_iri, ev_iri, rdf_iri ('type'), bio_iri ('Birth'));
-      DB.DBA.ODS_QUAD_URI (graph_iri, iri, bio_iri ('event'), ev_iri);
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, ev_iri, dc_iri ('date'), substring (datestring(birthday), 1, 10));
-    }
-  if (length (phone) and wa_user_priv_info (flags, 18) and wa_user_priv_info (flags, 25))
-    {
-      phone := replace (replace (replace (phone, '-', ''), ',', ''), ' ', '');
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, foaf_iri ('phone'), 'tel:' || phone);
-    }
-  if (lat is not null and lng is not null and wa_user_priv_info (flags, (case when hb_latlng = 0 then 39 else 47 end)))
-    {
-
-      DB.DBA.ODS_QUAD_URI (graph_iri, giri, rdf_iri ('type'), geo_iri ('Point'));
-      DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('based_near'), giri);
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, giri, geo_iri ('lat'), sprintf ('%.06f', coalesce (lat, 0)));
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, giri, geo_iri ('long'), sprintf ('%.06f', coalesce (lng, 0)));
-    }
-  if (wa_priv_info (photo, flags, 37))
-    DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('depiction'), DB.DBA.WA_LINK (1, photo));
-
-  if (is_person and length (org) and length (org_page) and wa_user_priv_info (flags, 20))
-    {
-      DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('workplaceHomepage'), org_page);
-      DB.DBA.ODS_QUAD_URI (graph_iri, org_iri, rdf_iri ('type') , foaf_iri ('Organization'));
-      DB.DBA.ODS_QUAD_URI (graph_iri, org_iri, foaf_iri ('homepage'), org_page);
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, org_iri, dc_iri ('title'), org);
-    }
-
-  if (is_person and length (interests))
-    {
-      for (select interest, label from DB.DBA.WA_USER_INTERESTS (txt) (interest varchar, label varchar) P where txt = interests) do
-  	  {
-  	    if (length (interest))
-  	    {
-  	      DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('interest'), interest);
-  	      if (length (label))
-  		    {
-  		      DB.DBA.ODS_QUAD_URI_L (graph_iri, interest, rdfs_iri ('label'), label);
-  		    }
-  	    }
-  	  }
-    }
-
-  if (is_person and length (interestTopics))
-    {
-      for (select interest, label from DB.DBA.WA_USER_INTERESTS (txt) (interest varchar, label varchar) P where txt = interestTopics) do
-  	  {
-  	    if (length (interest))
-  	    {
-  	      if (length (label))
-  		    {
-  		      DB.DBA.ODS_QUAD_URI_L (graph_iri, interest, rdfs_iri ('label'), label);
-  		    }
-  	    }
-  	  }
-    }
+  iri      := person_iri (in_iri, tp=>is_org);
 
-  if (wa_priv_info (hcountry,  flags, 16) or
-      wa_priv_info (hstate,    flags, 59) or
-      wa_priv_info (hcity,     flags, 58) or
-      wa_priv_info (hcode,     flags, 57) or
-      wa_priv_info (haddress1, flags, 15) or
-      wa_priv_info (haddress2, flags, 15)
-     )
-    {
-      DB.DBA.ODS_QUAD_URI (graph_iri, iri, vcard_iri ('ADR'), addr_iri);
-      DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, rdf_iri ('type'), vcard_iri ('home'));
-      if (wa_priv_info (hcountry, flags, 16))
-        DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, vcard_iri ('Country'), hcountry);
-      if (wa_priv_info (hstate, flags, 59))
-	      DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, vcard_iri ('Region'), hstate);
-      if (wa_priv_info (hcity, flags, 58))
-	      DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, vcard_iri ('Locality'), hcity);
-      if (wa_priv_info (hcode, flags, 57))
-	      DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, vcard_iri ('Pobox'), hcode);
-      if (wa_priv_info (haddress1, flags, 15))
-	      DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, vcard_iri ('Street'), haddress1);
-      if (wa_priv_info (haddress2, flags, 15))
-	      DB.DBA.ODS_QUAD_URI_L (graph_iri, addr_iri, vcard_iri ('Extadd'), haddress2);
-    }
-
-  if (is_person and wa_priv_info (resume, flags, 34))
-    {
-    DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, bio_iri ('olb'), resume);
-    }
-
-  if (wa_priv_info (webpage, flags, 7))
-    DB.DBA.ODS_QUAD_URI (graph_iri, iri, foaf_iri ('homepage'), webpage);
-
-  if (length (ext_urls) and wa_priv_info (ext_urls, flags, 8))
-    {
-      ext_urls := blob_to_string (ext_urls);
-      ext_urls := replace (ext_urls, '\r', '\n');
-      ext_urls := replace (ext_urls, '\n\n', '\n');
-      arr := split_and_decode (ext_urls, 0, '\0\0\n');
-      foreach (any u in arr) do
-    	{
-    	  if (length (trim (u)))
+  declare N integer;
+  foreach (varchar graph_iri in graphs) do
   	    {
- 	      DB.DBA.ODS_QUAD_URI (graph_iri, iri, owl_iri ('sameAs'), u);
-   	    }
+    delete_quad_sp (graph_iri, iri, foaf_iri ('firstName'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('family_name'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('name'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('mbox'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('gender'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('icqChatID'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('msnChatID'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('aimChatID'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('yahooChatID'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('birthday'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('organization'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('phone'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('based_near'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('homepage'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('depiction'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('interest'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('topic_interest'));
+    delete_quad_sp (graph_iri, iri, foaf_iri ('workplaceHomepage'));
+    delete_quad_sp (graph_iri, iri, bio_iri ('olb'));
+    delete_quad_sp (graph_iri, iri, owl_iri ('sameAs'));
+    delete_quad_s_or_o (graph_iri, ev_iri, ev_iri);
+    delete_quad_s_or_o (graph_iri, org_iri, org_iri);
+    delete_quad_s_or_o (graph_iri, addr_iri, addr_iri);
+    delete_quad_s_or_o (graph_iri, giri, giri);
+    delete_quad_s_or_o (graph_iri, crt_iri, crt_iri);
+    delete_quad_s_or_o (graph_iri, crt_exp, crt_exp);
+    delete_quad_s_or_o (graph_iri, crt_mod, crt_mod);
     	}
     }
-};
+;
 
 create procedure sioc_user_project (in graph_iri varchar, in iri varchar, in  nam varchar, in  url varchar, in descr varchar, in piri varchar := null)
 {
@@ -1370,48 +1271,63 @@ create procedure sioc_goodRelation_details (in graph_iri varchar, in forum_iri v
     properties := get_keyword ('properties', product);
     foreach (any property in properties) do
     {
-      declare propertyType, propertyName, propertyValue any;
+      declare propertyType, propertyName, propertyValue, propertyLanguage any;
 
       propertyType := get_keyword ('type', property);
       propertyValue := get_keyword ('value', property);
       propertyName := ODS.ODS_API."ontology.denormalize" (get_keyword ('name', property));
-      if (propertyType = 'data')
+      if (propertyType = 'object')
+      {
+        DB.DBA.ODS_QUAD_URI (graph_iri, iri, propertyName, ODS.ODS_API."ontology.denormalize" (propertyValue));
+      }
+      else if (propertyType = 'data')
       {
-        --dbg_obj_princ ('data: ', iri, propertyName, propertyValue);
         DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, propertyName, propertyValue);
       }
-      else if (propertyType = 'object')
+      else
       {
-        --dbg_obj_princ ('obj: ', iri, propertyName, ODS.ODS_API."ontology.denormalize" (propertyValue));
-        DB.DBA.ODS_QUAD_URI (graph_iri, iri, propertyName, ODS.ODS_API."ontology.denormalize" (propertyValue));
+        propertyLanguage := get_keyword ('language', property);
+        DB.DBA.ODS_QUAD_URI_L_TYPED (graph_iri, iri, propertyName, propertyValue, ODS.ODS_API."ontology.denormalize" (propertyType), propertyLanguage);
   }
     }
   }
 }
 ;
 
-create procedure sioc_user_offerlist (in user_id integer, in ol_id integer, in ol_offer varchar, in ol_comment varchar, in ol_properties varchar)
+create procedure sioc_user_offerlist (in user_id integer, in ol_id integer, in ol_type varchar, in ol_flag varchar, in ol_offer varchar, in ol_comment varchar, in ol_properties varchar)
 {
-  declare user_name any;
+  declare user_name, forum_type any;
   declare graph_iri, forum_iri, user_iri, iri, obj any;
   declare exit handler for sqlstate '*'
   {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  graph_iri := get_graph ();
   user_iri := user_iri (user_id);
   user_name := (select U_NAME from DB.DBA.SYS_USERS where U_ID = user_id);
+  graph_iri := sioc_user_graph (user_name, ol_flag);
+  if (isnull (graph_iri))
+    return;
+
+  if        (ol_type = '1') {
+    forum_type := 'OfferList';
   forum_iri := offerlist_forum_iri (ol_offer, user_name);
+  } else if (ol_type = '2') {
+    forum_type := 'WishList';
+    forum_iri := wishlist_forum_iri (ol_offer, user_name);
+  } else if (ol_type = '3') {
+    forum_type := 'OwnsList';
+    forum_iri := ownslist_forum_iri (ol_offer, user_name);
+  }
   if (DB.DBA.is_empty_or_null (trim (ol_comment)))
     ol_comment := ol_offer;
-  sioc_forum (graph_iri, graph_iri, forum_iri, ol_offer, 'OfferList', ol_comment, null, user_name);
+  sioc_forum (graph_iri, graph_iri, forum_iri, ol_offer, forum_type, ol_comment, null, user_name);
 
   obj := deserialize (ol_properties);
   sioc_goodRelation_details (graph_iri, forum_iri, user_iri, obj);
 };
 
-create procedure sioc_user_offerlist_delete (in user_id integer, in ol_id integer, in ol_offer varchar, in ol_comment varchar, in ol_properties varchar)
+create procedure sioc_user_offerlist_delete (in user_id integer, in ol_id integer, in ol_type varchar, in ol_flag varchar, in ol_offer varchar, in ol_comment varchar, in ol_properties varchar)
 {
   declare N integer;
   declare user_name any;
@@ -1422,8 +1338,17 @@ create procedure sioc_user_offerlist_delete (in user_id integer, in ol_id intege
     return;
   };
   user_name := (select U_NAME from DB.DBA.SYS_USERS where U_ID = user_id);
-  graph_iri := get_graph ();
+  graph_iri := sioc_user_graph (user_name, ol_flag);
+  if (isnull (graph_iri))
+    return;
+
+  if        (ol_type = '1') {
   forum_iri := offerlist_forum_iri (ol_offer, user_name);
+  } else if (ol_type = '2') {
+    forum_iri := wishlist_forum_iri (ol_offer, user_name);
+  } else if (ol_type = '3') {
+    forum_iri := ownslist_forum_iri (ol_offer, user_name);
+  }
   delete_quad_s_or_o (graph_iri, forum_iri, forum_iri);
 
   obj := deserialize (ol_properties);
@@ -1435,67 +1360,185 @@ create procedure sioc_user_offerlist_delete (in user_id integer, in ol_id intege
   }
 };
 
-create procedure sioc_user_wishlist (in user_id integer, in wl_id integer, in wl_wish varchar, in wl_comment varchar, in wl_properties varchar)
+create procedure sioc_user_graph (in user_name varchar, in flag varchar)
+{
+  declare graph_iri varchar;
+
+  if (flag = '1')
+  {
+  graph_iri := get_graph ();
+  }
+  else if (flag = '2')
+  {
+    graph_iri := get_graph () || '/protected/' || user_name;
+  }
+  else
+  {
+    graph_iri := null;
+  }
+  return graph_iri;
+}
+;
+
+create procedure sioc_user_likes (in user_id integer, in l_id integer, in l_flag varchar, in l_uri varchar, in l_type varchar, in l_name varchar, in l_comment varchar, in l_properties varchar)
 {
   declare user_name any;
-  declare graph_iri, forum_iri, user_iri, iri, obj any;
+  declare graph_iri, forum_iri, forum_name, like_property, user_iri, iri, obj any;
   declare exit handler for sqlstate '*'
-{
+  {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  graph_iri := get_graph ();
   user_iri := user_iri (user_id);
   user_name := (select U_NAME from DB.DBA.SYS_USERS where U_ID = user_id);
-  forum_iri := wishlist_forum_iri (wl_wish, user_name);
-  if (DB.DBA.is_empty_or_null (trim (wl_comment)))
-    wl_comment := wl_wish;
-  sioc_forum (graph_iri, graph_iri, forum_iri, wl_wish, 'WishList', wl_comment, null, user_name);
+  graph_iri := sioc_user_graph (user_name, l_flag);
+  if (isnull (graph_iri))
+    return;
 
-  obj := deserialize (wl_properties);
-  sioc_goodRelation_details (graph_iri, forum_iri, user_iri, obj);
-};
+  if (l_type = 'L')
+  {
+    forum_iri := like_forum_iri (l_name, user_name);
+    forum_name := 'Likes';
+    like_property := 'likes';
+  } else {
+    forum_iri := dislike_forum_iri (l_name, user_name);
+    forum_name := 'DisLikes';
+    like_property := 'dislikes';
+  }
+  if (DB.DBA.is_empty_or_null (trim (l_comment)))
+    l_comment := l_name;
+  sioc_forum (graph_iri, graph_iri, forum_iri, l_name, forum_name, l_comment, null, user_name);
+  DB.DBA.ODS_QUAD_URI (graph_iri, user_iri, like_iri (like_property), forum_iri);
+  DB.DBA.ODS_QUAD_URI (graph_iri, forum_iri, rdfs_iri ('seeAlso'), l_uri);
+
+  declare N integer;
+  declare tmp, products, properties, iri any;
+
+  products := get_keyword ('products', deserialize (l_properties));
+  foreach (any product in products) do
+  {
+    iri := likes_item_iri (forum_iri, get_keyword ('id', product));
+	  DB.DBA.ODS_QUAD_URI (graph_iri, iri, sioc_iri ('has_container'), forum_iri);
+	  DB.DBA.ODS_QUAD_URI (graph_iri, forum_iri, sioc_iri ('container_of'), iri);
+    DB.DBA.ODS_QUAD_URI (graph_iri, iri, rdf_iri ('type'), ODS.ODS_API."ontology.denormalize" (get_keyword ('className', product)));
+
+    properties := get_keyword ('properties', product);
+    foreach (any property in properties) do
+    {
+      declare propertyType, propertyName, propertyValue any;
 
-create procedure sioc_user_wishlist_delete (in user_id integer, in wl_id integer, in wl_wish varchar, in wl_comment varchar, in wl_properties varchar)
+      propertyType := get_keyword ('type', property);
+      propertyValue := get_keyword ('value', property);
+      propertyName := ODS.ODS_API."ontology.denormalize" (get_keyword ('name', property));
+      if (propertyType = 'data')
+      {
+        --dbg_obj_princ ('data: ', iri, propertyName, propertyValue);
+        DB.DBA.ODS_QUAD_URI_L (graph_iri, iri, propertyName, propertyValue);
+      }
+      else if (propertyType = 'object')
+      {
+        --dbg_obj_princ ('obj: ', iri, propertyName, ODS.ODS_API."ontology.denormalize" (propertyValue));
+        DB.DBA.ODS_QUAD_URI (graph_iri, iri, propertyName, ODS.ODS_API."ontology.denormalize" (propertyValue));
+      }
+    }
+  }
+}
+;
+
+create procedure sioc_user_likes_delete (in user_id integer, in l_id integer, in l_flag varchar, in l_uri varchar, in l_type varchar, in l_name varchar, in l_comment varchar, in l_properties varchar)
 {
   declare N integer;
   declare user_name any;
-  declare graph_iri, forum_iri, iri, obj, products any;
+  declare graph_iri, forum_iri, iri, products any;
   declare exit handler for sqlstate '*'
   {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
   user_name := (select U_NAME from DB.DBA.SYS_USERS where U_ID = user_id);
-  graph_iri := get_graph ();
-  forum_iri := wishlist_forum_iri (wl_wish, user_name);
+  graph_iri := sioc_user_graph (user_name, l_flag);
+  if (isnull (graph_iri))
+    return;
+
+  if (l_type = 'L')
+  {
+    forum_iri := like_forum_iri (l_name, user_name);
+  } else {
+    forum_iri := dislike_forum_iri (l_name, user_name);
+  }
   delete_quad_s_or_o (graph_iri, forum_iri, forum_iri);
 
-  obj := deserialize (wl_properties);
-  products := get_keyword ('products', obj);
+  products := get_keyword ('products', deserialize (l_properties));
   for (N := 0; N < length (products); N := N + 1)
   {
-    iri := wishlist_item_iri (forum_iri, get_keyword ('id', products[N]));
+    iri := likes_item_iri (forum_iri, N+1);
     delete_quad_s_or_o (graph_iri, iri, iri);
   }
-};
+}
+;
 
-create procedure sioc_user_favorite (in user_id integer, in f_id integer, in f_type varchar, in f_label varchar, in f_uri varchar, in f_class varchar, in f_properties any)
+create procedure sioc_user_knows (in user_id integer, in k_id integer, in k_flag varchar, in k_uri varchar, in l_label varchar)
 {
   declare user_name any;
-  declare graph_iri, forum_iri, user_iri, iri any;
+  declare graph_iri, forum_iri, forum_name, like_property, user_iri, iri, obj any;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  user_iri := user_iri (user_id);
+  user_name := (select U_NAME from DB.DBA.SYS_USERS where U_ID = user_id);
+  graph_iri := sioc_user_graph (user_name, k_flag);
+  if (isnull (graph_iri))
+    return;
+
+  DB.DBA.ODS_QUAD_URI (graph_iri, user_iri, foaf_iri ('knows'), k_uri);
+}
+;
+
+create procedure sioc_user_knows_delete (in user_id integer, in k_id integer, in k_flag varchar, in k_uri varchar, in l_label varchar)
+{
+  declare user_name any;
+  declare graph_iri, forum_iri, forum_name, like_property, user_iri, iri, obj any;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  user_iri := user_iri (user_id);
+  user_name := (select U_NAME from DB.DBA.SYS_USERS where U_ID = user_id);
+  graph_iri := sioc_user_graph (user_name, k_flag);
+  if (isnull (graph_iri))
+    return;
+
+  delete_quad_s_p_o (graph_iri, user_iri, foaf_iri ('knows'), k_uri);
+}
+;
+
+-- favorites
+create procedure sioc_user_favorite (in user_id integer, in f_id integer, in f_flag varchar, in f_type varchar, in f_label varchar, in f_uri varchar, in f_class varchar, in f_properties any, in f_create integer := 0)
+{
+  declare user_name any;
+  declare graph_iri, forum_iri, forum_name, user_iri, iri any;
   declare exit handler for sqlstate '*'
   {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  graph_iri := get_graph ();
   user_iri := user_iri (user_id);
   user_name := (select U_NAME from DB.DBA.SYS_USERS where U_ID = user_id);
+
+  forum_name := forum_name (user_name, 'FavoriteThings');
   forum_iri := favorite_forum_iri (forum_name (user_name, 'FavoriteThings'), user_name);
+  -- first favorites?
+  if (f_create or ((select count (WUF_ID) from DB.DBA.WA_USER_FAVORITES where WUF_U_ID = user_id) = 1))
+    sioc_forum (get_graph (), get_graph (), forum_iri, forum_name, 'FavoriteThings', null, null, user_name);
+
+  graph_iri := sioc_user_graph (user_name, f_flag);
+  if (isnull (graph_iri))
+    return;
 
   iri := favorite_item_iri (forum_iri, f_id);
-  delete_quad_s_or_o (graph_iri, iri, iri);
 
   DB.DBA.ODS_QUAD_URI (graph_iri, iri, sioc_iri ('has_container'), forum_iri);
   DB.DBA.ODS_QUAD_URI (graph_iri, forum_iri, sioc_iri ('container_of'), iri);
@@ -1520,19 +1563,55 @@ create procedure sioc_user_favorite (in user_id integer, in f_id integer, in f_t
   }
 };
 
-create procedure sioc_user_account (in graph_iri varchar, in iri varchar, in  nam varchar, in  url varchar)
+create procedure sioc_user_favorite_delete (in user_id integer, in f_id integer, in f_flag varchar, in f_type varchar, in f_label varchar, in f_uri varchar, in f_class varchar, in f_properties any)
 {
-  declare acc_iri, pers_iri any;
+  declare user_id, user_name any;
+  declare graph_iri, forum_iri, iri any;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  user_name := (select U_NAME from DB.DBA.SYS_USERS where U_ID = user_id);
+  forum_iri := favorite_forum_iri (forum_name (user_name, 'FavoriteThings'), user_name);
+  -- no more favorites?
+  if ((select count (WUF_ID) from DB.DBA.WA_USER_FAVORITES where WUF_U_ID = user_id) = 0)
+    SIOC..delete_quad_s_or_o (graph_iri (), forum_iri, forum_iri);
+
+  graph_iri := sioc_user_graph (user_name, f_flag);
+  if (isnull (graph_iri))
+    return;
+
+  iri := favorite_item_iri (forum_iri, f_id);
+  delete_quad_s_or_o (graph_iri, iri, iri);
+};
+
+
+create procedure sioc_user_account (in graph_iri varchar, in iri varchar, in name varchar, in url varchar, in uri varchar := null)
+{
+  declare pers_iri any;
+
   pers_iri := person_iri (iri);
-  acc_iri := person_ola_iri (iri, nam);
+  if (isnull (uri))
+    uri := person_ola_iri (iri, name);
   -- XXX, have to know if this is URL
-  DB.DBA.ODS_QUAD_URI (graph_iri, acc_iri, rdf_iri ('type'), foaf_iri ('OnlineAccount'));
-  DB.DBA.ODS_QUAD_URI (graph_iri, acc_iri, foaf_iri ('accountServiceHomepage'), url);
-  DB.DBA.ODS_QUAD_URI_L (graph_iri, acc_iri, foaf_iri ('accountName'), nam);
-  DB.DBA.ODS_QUAD_URI (graph_iri, pers_iri, foaf_iri ('holdsAccount'), acc_iri);
+  DB.DBA.ODS_QUAD_URI (graph_iri, uri, rdf_iri ('type'), foaf_iri ('OnlineAccount'));
+  DB.DBA.ODS_QUAD_URI (graph_iri, uri, foaf_iri ('accountServiceHomepage'), url);
+  DB.DBA.ODS_QUAD_URI_L (graph_iri, uri, foaf_iri ('accountName'), name);
+  DB.DBA.ODS_QUAD_URI (graph_iri, pers_iri, foaf_iri ('holdsAccount'), uri);
 };
--- Group
 
+create procedure sioc_user_account_delete (in graph_iri varchar, in iri varchar, in name varchar, in uri varchar := null)
+{
+  declare pers_iri any;
+
+  pers_iri := person_iri (iri);
+  if (isnull (uri))
+    uri := person_ola_iri (iri, name);
+  delete_quad_s_or_o (graph_iri, uri, uri);
+};
+
+-- Group
 create procedure sioc_group (in graph_iri varchar, in iri varchar, in u_name varchar)
 {
   if (iri is not null)
@@ -1756,7 +1835,7 @@ create procedure ods_sioc_post (
 		    do_ann := 1;
 		    creator := arr[0];
 		  }
-      else if (arr[1] not in ('socialnetwork', 'offerlist', 'wishlist', 'favoritethings'))
+      else if (arr[1] not in ('socialnetwork', 'offerlist', 'wishlist', 'ownslist', 'favoritethings'))
 	    {
 		do_atom := 1;
 	    }
@@ -2086,7 +2165,7 @@ create procedure fill_ods_sioc_online (in doall int := 0, in iri_result int := 1
 create procedure fill_ods_sioc (in doall int := 0)
 {
   declare iri, site_iri, graph_iri, sioc_version varchar;
-  declare notCreated, cpt, deadl, cnt int;
+  declare fCreate, cpt, deadl, cnt int;
 
   declare exit handler for sqlstate '*', not found
     {
@@ -2204,17 +2283,6 @@ create procedure fill_ods_sioc (in doall int := 0)
                   declare kwd any;
 		  declare lat, lng real;
 
-		  if (WAUI_LATLNG_HBDEF)
-		    {
-		      lat := WAUI_BLAT;
-		      lng :=  WAUI_BLNG;
-		    }
-		  else
-		    {
-		      lat := WAUI_LAT;
-		      lng :=  WAUI_LNG;
-		    }
-
 		  if (WAUI_SITE_NAME is not null)
 		    DB.DBA.ODS_QUAD_URI_L (graph_iri, u_site_iri, dc_iri ('title'), WAUI_SITE_NAME);
 
@@ -2232,11 +2300,15 @@ create procedure fill_ods_sioc (in doall int := 0)
 		                  WAUI_MSN,
 		                  WAUI_AIM,
 		                  WAUI_YAHOO,
+		                  WAUI_SKYPE,
 		                  WAUI_BIRTHDAY,
 		                  WAUI_BORG,
 	              	    case when length (WAUI_HPHONE) then WAUI_HPHONE when length (WAUI_HMOBILE) then WAUI_HMOBILE else WAUI_BPHONE end,
-			lat,
-			lng,
+            					WAUI_LATLNG_HBDEF,
+		                  WAUI_LAT,
+		                  WAUI_LNG,
+		                  WAUI_BLAT,
+		                  WAUI_BLNG,
 			WAUI_WEBPAGE,
 			WAUI_PHOTO_URL,
 			WAUI_BORG_HOMEPAGE,
@@ -2250,19 +2322,29 @@ create procedure fill_ods_sioc (in doall int := 0)
 			WAUI_HSTATE,
 			WAUI_HCOUNTRY,
 			WAUI_FOAF,
-                			WAUI_LATLNG_HBDEF,
 					WAUI_CERT
 			);
+
 		  kwd := DB.DBA.WA_USER_TAG_GET (U_NAME);
 		  if (length (kwd))
 		    DB.DBA.ODS_QUAD_URI_L (graph_iri, person_iri, bio_iri ('keywords'), kwd);
+
+      -- update WebAccess graph
+      for (select distinct WACL_USER_ID from DB.DBA.WA_GROUPS_ACL) do
+      {
+        delete from DB.DBA.RDF_QUAD where G = DB.DBA.RDF_IID_OF_QNAME (SIOC..acl_groups_graph (WACL_USER_ID));
+      }
+      for (select * from DB.DBA.WA_GROUPS_ACL) do
+      {
+        wa_groups_acl_insert (WACL_USER_ID, WACL_NAME, WACL_WEBIDS);
+      }
 		  for select WUP_NAME, WUP_URL, WUP_DESC, WUP_IRI from DB.DBA.WA_USER_PROJECTS where WUP_U_ID = U_ID do
 		    {
 		      sioc_user_project (graph_iri, iri, WUP_NAME, WUP_URL, WUP_DESC, WUP_IRI);
 		    }
-		  for select WUO_NAME, WUO_URL from DB.DBA.WA_USER_OL_ACCOUNTS where WUO_U_ID = U_ID do
+		  for select WUO_NAME, WUO_URL, WUO_URI from DB.DBA.WA_USER_OL_ACCOUNTS where WUO_U_ID = U_ID do
 		    {
-		      sioc_user_account (graph_iri, iri, WUO_NAME, WUO_URL);
+		      sioc_user_account (graph_iri, iri, WUO_NAME, WUO_URL, WUO_URI);
 		    }
 		  for select WUR_LABEL, WUR_SEEALSO_IRI, WUR_P_IRI from DB.DBA.WA_USER_RELATED_RES where WUR_U_ID = U_ID do
 		    {
@@ -2272,29 +2354,24 @@ create procedure fill_ods_sioc (in doall int := 0)
 		    {
           sioc_user_bioevent (graph_iri, iri, WUB_ID, WUB_EVENT, WUB_DATE, WUB_PLACE);
 		    }
-		  for select WUOL_U_ID, WUOL_ID, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = U_ID do
+		  for select WUOL_U_ID, WUOL_ID, WUOL_TYPE, WUOL_FLAG, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = U_ID do
 		    {
-          sioc_user_offerlist (WUOL_U_ID, WUOL_ID, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES);
+		      sioc_user_offerlist (WUOL_U_ID, WUOL_ID, WUOL_TYPE, WUOL_FLAG, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES);
 		    }
-		  for select WUWL_U_ID, WUWL_ID, WUWL_BARTER, WUWL_COMMENT, WUWL_PROPERTIES from DB.DBA.WA_USER_WISHLIST where WUWL_U_ID = U_ID do
+		  for select WUL_U_ID, WUL_ID, WUL_FLAG, WUL_URI, WUL_TYPE, WUL_NAME, WUL_COMMENT, WUL_PROPERTIES from DB.DBA.WA_USER_LIKES where WUL_U_ID = U_ID do
 		      {
-          sioc_user_wishlist (WUWL_U_ID, WUWL_ID, WUWL_BARTER, WUWL_COMMENT, WUWL_PROPERTIES);
+		      sioc_user_likes (WUL_U_ID, WUL_ID, WUL_FLAG, WUL_URI, WUL_TYPE, WUL_NAME, WUL_COMMENT, WUL_PROPERTIES);
 		    }
-		  notCreated := 1;
-		  for select WUF_U_ID, WUF_ID, WUF_TYPE, WUF_LABEL, WUF_URI, WUF_CLASS, WUF_PROPERTIES from DB.DBA.WA_USER_FAVORITES where WUF_U_ID = U_ID do
+		  for select WUK_U_ID, WUK_ID, WUK_FLAG, WUK_URI, WUK_LABEL from DB.DBA.WA_USER_KNOWS where WUK_U_ID = U_ID do
 		    {
-		      -- create FavoriteThings Container
-		      if (notCreated)
-		      {
-            forum_name := forum_name (U_NAME, 'FavoriteThings');
-      	    forum_iri := favorite_forum_iri (forum_name, U_NAME);
-		        sioc_forum (graph_iri, graph_iri, forum_iri, forum_name, 'FavoriteThings', null, null, U_NAME);
-		        notCreated := 0;
-		      }
-          sioc_user_favorite (WUF_U_ID, WUF_ID, WUF_TYPE, WUF_LABEL, WUF_URI, WUF_CLASS, WUF_PROPERTIES);
+		      sioc_user_knows (WUK_U_ID, WUK_ID, WUK_FLAG, WUK_URI, WUK_LABEL);
+		    }
+		  fCreate := 1;
+		  for select WUF_U_ID, WUF_ID, WUF_FLAG, WUF_TYPE, WUF_LABEL, WUF_URI, WUF_CLASS, WUF_PROPERTIES from DB.DBA.WA_USER_FAVORITES where WUF_U_ID = U_ID do
+		    {
+		      sioc_user_favorite (WUF_U_ID, WUF_ID, WUF_FLAG, WUF_TYPE, WUF_LABEL, WUF_URI, WUF_CLASS, WUF_PROPERTIES, fCreate);
+		      fCreate := 0;
 		    }
-		  if (length (WAUI_SKYPE))
-		    sioc_user_account (graph_iri, iri, WAUI_SKYPE, 'skype:'||WAUI_SKYPE||'?chat');
 		  for select UC_ID, UC_CERT from DB.DBA.WA_USER_CERTS where UC_U_ID = U_ID do
 		    {
 		      sioc_user_cert (graph_iri, person_iri, UC_ID, UC_CERT);
@@ -2920,16 +2997,7 @@ create trigger WA_USER_INFO_SIOC_U after update on DB.DBA.WA_USER_INFO referenci
   delete_quad_sp (graph_iri, u_site_iri, dc_iri ('title'));
   if (N.WAUI_SITE_NAME is not null)
     DB.DBA.ODS_QUAD_URI_L (graph_iri, u_site_iri, dc_iri ('title'), N.WAUI_SITE_NAME);
-  if (N.WAUI_LATLNG_HBDEF)
-    {
-      lat := N.WAUI_BLAT;
-      lng :=  N.WAUI_BLNG;
-    }
-  else
-    {
-      lat := N.WAUI_LAT;
-      lng :=  N.WAUI_LNG;
-    }
+
   niri := person_iri (iri, tp=>N.WAUI_IS_ORG);
   if (O.WAUI_IS_ORG <> N.WAUI_IS_ORG)
     {
@@ -2955,6 +3023,9 @@ create trigger WA_USER_INFO_SIOC_U after update on DB.DBA.WA_USER_INFO referenci
 	    and O = iri_to_id (foaf_iri ('Organization'));
 	}
     }
+  if (length (O.WAUI_SKYPE))
+    sioc_user_account_delete (graph_iri, iri, O.WAUI_SKYPE);
+
   sioc_user_info (graph_iri,
                   iri,
                   O.WAUI_IS_ORG,
@@ -2969,11 +3040,15 @@ create trigger WA_USER_INFO_SIOC_U after update on DB.DBA.WA_USER_INFO referenci
         		      N.WAUI_MSN,
         		      N.WAUI_AIM,
         		      N.WAUI_YAHOO,
+                  N.WAUI_SKYPE,
         		      N.WAUI_BIRTHDAY,
         		      N.WAUI_BORG,
         	        case when length (N.WAUI_HPHONE) then N.WAUI_HPHONE when length (N.WAUI_HMOBILE) then N.WAUI_HMOBILE else N.WAUI_BPHONE end,
-			lat,
-			lng,
+          				N.WAUI_LATLNG_HBDEF,
+	                N.WAUI_LAT,
+	                N.WAUI_LNG,
+	                N.WAUI_BLAT,
+	                N.WAUI_BLNG,
 			N.WAUI_WEBPAGE,
 			N.WAUI_PHOTO_URL,
 			N.WAUI_BORG_HOMEPAGE,
@@ -2987,7 +3062,6 @@ create trigger WA_USER_INFO_SIOC_U after update on DB.DBA.WA_USER_INFO referenci
 			N.WAUI_HSTATE,
 			N.WAUI_HCOUNTRY,
 			N.WAUI_FOAF,
-            			N.WAUI_LATLNG_HBDEF,
 				N.WAUI_CERT
 			);
   for select US_IRI, US_KEY from DB.DBA.WA_USER_SVC where US_U_ID = N.WAUI_U_ID and length (US_IRI) do
@@ -2998,16 +3072,76 @@ create trigger WA_USER_INFO_SIOC_U after update on DB.DBA.WA_USER_INFO referenci
 	sas_iri := sas_iri || sprintf ('&login=%U', uname);
       DB.DBA.ODS_QUAD_URI (graph_iri, niri, owl_iri ('sameAs'), sas_iri);
     }
-  if (length (O.WAUI_SKYPE))
-    {
-      del_iri := person_ola_iri (iri, O.WAUI_SKYPE);
-      delete_quad_s_or_o (graph_iri, del_iri, del_iri);
-    }
-  if (length (N.WAUI_SKYPE))
-    sioc_user_account (graph_iri, iri, N.WAUI_SKYPE, 'skype:'||N.WAUI_SKYPE||'?chat');
+
   return;
 };
 
+create procedure wa_user_acl_insert (
+  inout user_iri varchar,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  graph_iri := SIOC..acl_clean_iri (user_iri) || '/webaccess';
+  SIOC..acl_insert (graph_iri, SIOC..person_iri (user_iri), acl);
+}
+;
+
+create procedure wa_user_acl_delete (
+  inout user_iri varchar,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  graph_iri := SIOC..acl_clean_iri (user_iri) || '/webaccess';
+  SIOC..acl_delete (graph_iri, SIOC..person_iri (user_iri), acl);
+}
+;
+
+create trigger WA_USER_INFO_SIOC_ACL_I after insert on DB.DBA.WA_USER_INFO order 100 referencing new as N
+{
+  if (coalesce (N.WAUI_ACL, '') <> '')
+  {
+    contact_acl_insert (person_iri (user_iri (N.WAUI_U_ID)), N.WAUI_ACL);
+
+    SIOC..acl_ping2 (N.WAUI_U_ID,
+                     person_iri (user_iri (N.WAUI_U_ID)),
+                     null,
+                     N.WAUI_ACL);
+  }
+}
+;
+
+create trigger WA_USER_INFO_SIOC_ACL_U after update (WAUI_ACL) on DB.DBA.WA_USER_INFO order 100 referencing old as O, new as N
+{
+  if (coalesce (O.WAUI_ACL, '') <> '')
+    wa_user_acl_delete (person_iri (user_iri (O.WAUI_U_ID)), O.WAUI_ACL);
+
+  if (coalesce (N.WAUI_ACL, '') <> '')
+    wa_user_acl_insert (person_iri (user_iri (N.WAUI_U_ID)), N.WAUI_ACL);
+
+    SIOC..acl_ping2 (N.WAUI_U_ID,
+                     person_iri (user_iri (N.WAUI_U_ID)),
+                     null,
+                     N.WAUI_ACL);
+}
+;
+
+create trigger WA_USER_INFO_SIOC_ACL_D before delete on DB.DBA.WA_USER_INFO order 100 referencing old as O
+{
+  if (coalesce (O.WAUI_ACL, '') <> '')
+    wa_user_acl_delete (person_iri (user_iri (O.WAUI_U_ID)), O.WAUI_ACL);
+}
+;
+
 create trigger WA_USER_PROJECT_SIOC_I after insert on DB.DBA.WA_USER_PROJECTS referencing new as N
 {
   declare graph_iri, iri any;
@@ -3060,7 +3194,7 @@ create trigger WA_USER_OL_ACCOUNTS_SIOC_I after insert on DB.DBA.WA_USER_OL_ACCO
 
   graph_iri := get_graph ();
   iri := user_iri (N.WUO_U_ID);
-  sioc_user_account (graph_iri, iri, N.WUO_NAME, N.WUO_URL);
+  sioc_user_account (graph_iri, iri, N.WUO_NAME, N.WUO_URL, N.WUO_URI);
 };
 
 create trigger WA_USER_OL_ACCOUNTS_SIOC_U after update on DB.DBA.WA_USER_OL_ACCOUNTS referencing old as O, new as N
@@ -3073,22 +3207,17 @@ create trigger WA_USER_OL_ACCOUNTS_SIOC_U after update on DB.DBA.WA_USER_OL_ACCO
 
   graph_iri := get_graph ();
   iri := user_iri (N.WUO_U_ID);
-  del_iri := person_ola_iri (iri, O.WUO_NAME);
-  delete_quad_s_or_o (graph_iri, del_iri, del_iri);
-  sioc_user_account (graph_iri, iri, N.WUO_NAME, N.WUO_URL);
+  sioc_user_account_delete (graph_iri, iri, N.WUO_NAME, N.WUO_URI);
+  sioc_user_account (graph_iri, iri, N.WUO_NAME, N.WUO_URL, N.WUO_URI);
 };
 
 create trigger WA_USER_OL_ACCOUNTS_SIOC_D after delete on DB.DBA.WA_USER_OL_ACCOUNTS referencing old as O
 {
-  declare graph_iri, iri, opiri, del_iri any;
   declare exit handler for sqlstate '*' {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  graph_iri := get_graph ();
-  iri := user_iri (O.WUO_U_ID);
-  del_iri := person_ola_iri (iri, O.WUO_NAME);
-  delete_quad_s_or_o (graph_iri, del_iri, del_iri);
+  sioc_user_account_delete (get_graph (), user_iri (O.WUO_U_ID), O.WUO_NAME, O.WUO_URI);
 };
 
 -- Bioevents
@@ -3105,95 +3234,127 @@ create trigger WA_USER_BIOEVENTS_SIOC_I after insert on DB.DBA.WA_USER_BIOEVENTS
   sioc_user_bioevent (graph_iri, user_iri, N.WUB_ID, N.WUB_EVENT, N.WUB_DATE, N.WUB_PLACE);
 };
 
-create trigger WA_USER_BIOEVENTS_SIOC_U after update on DB.DBA.WA_USER_BIOEVENTS referencing old as O, new as N
+create trigger WA_USER_BIOEVENTS_SIOC_U after update on DB.DBA.WA_USER_BIOEVENTS referencing old as O, new as N
+{
+  declare graph_iri, user_iri any;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  graph_iri := get_graph ();
+  user_iri := user_iri (N.WUB_U_ID);
+  sioc_user_bioevent (graph_iri, user_iri, N.WUB_ID, N.WUB_EVENT, N.WUB_DATE, N.WUB_PLACE);
+};
+
+create trigger WA_USER_BIOEVENTS_SIOC_D after delete on DB.DBA.WA_USER_BIOEVENTS referencing old as O
+{
+  declare graph_iri, user_iri, person_iri, bio_iri any;
+  declare exit handler for sqlstate '*' {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  graph_iri := get_graph ();
+  user_iri := user_iri (O.WUB_U_ID);
+  person_iri := person_iri (user_iri, '');
+  bio_iri := person_bio_iri (person_iri, cast (O.WUB_ID as varchar));
+  delete_quad_s_or_o (graph_iri, bio_iri, bio_iri);
+};
+
+-- Offer List
+create trigger WA_USER_OFFERLIST_SIOC_I after insert on DB.DBA.WA_USER_OFFERLIST referencing new as N
+{
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  sioc_user_offerlist (N.WUOL_U_ID, N.WUOL_ID, N.WUOL_TYPE, N.WUOL_FLAG, N.WUOL_OFFER, N.WUOL_COMMENT, N.WUOL_PROPERTIES);
+};
+
+create trigger WA_USER_OFFERLIST_SIOC_U after update on DB.DBA.WA_USER_OFFERLIST referencing old as O, new as N
 {
-  declare graph_iri, user_iri any;
   declare exit handler for sqlstate '*'
   {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  graph_iri := get_graph ();
-  user_iri := user_iri (N.WUB_U_ID);
-  sioc_user_bioevent (graph_iri, user_iri, N.WUB_ID, N.WUB_EVENT, N.WUB_DATE, N.WUB_PLACE);
+  sioc_user_offerlist_delete (O.WUOL_U_ID, O.WUOL_ID, O.WUOL_TYPE, O.WUOL_FLAG, O.WUOL_OFFER, O.WUOL_COMMENT, O.WUOL_PROPERTIES);
+  sioc_user_offerlist (N.WUOL_U_ID, N.WUOL_ID, N.WUOL_TYPE, N.WUOL_FLAG, N.WUOL_OFFER, N.WUOL_COMMENT, N.WUOL_PROPERTIES);
 };
 
-create trigger WA_USER_BIOEVENTS_SIOC_D after delete on DB.DBA.WA_USER_BIOEVENTS referencing old as O
+create trigger WA_USER_OFFERLIST_SIOC_D after delete on DB.DBA.WA_USER_OFFERLIST referencing old as O
 {
-  declare graph_iri, user_iri, person_iri, bio_iri any;
-  declare exit handler for sqlstate '*' {
+  declare exit handler for sqlstate '*'
+  {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  graph_iri := get_graph ();
-  user_iri := user_iri (O.WUB_U_ID);
-  person_iri := person_iri (user_iri, '');
-  bio_iri := person_bio_iri (person_iri, cast (O.WUB_ID as varchar));
-  delete_quad_s_or_o (graph_iri, bio_iri, bio_iri);
+  sioc_user_offerlist_delete (O.WUOL_U_ID, O.WUOL_ID, O.WUOL_TYPE, O.WUOL_FLAG, O.WUOL_OFFER, O.WUOL_COMMENT, O.WUOL_PROPERTIES);
 };
 
--- Offer List
-create trigger WA_USER_OFFERLIST_SIOC_I after insert on DB.DBA.WA_USER_OFFERLIST referencing new as N
+-- Likes
+create trigger WA_USER_LIKES_SIOC_I after insert on DB.DBA.WA_USER_LIKES referencing new as N
 {
   declare exit handler for sqlstate '*'
   {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  sioc_user_offerlist (N.WUOL_U_ID, N.WUOL_ID, N.WUOL_OFFER, N.WUOL_COMMENT, N.WUOL_PROPERTIES);
+  sioc_user_likes (N.WUL_U_ID, N.WUL_ID, N.WUL_FLAG, N.WUL_URI, N.WUL_TYPE, N.WUL_NAME, N.WUL_COMMENT, N.WUL_PROPERTIES);
 };
 
-create trigger WA_USER_OFFERLIST_SIOC_U after update on DB.DBA.WA_USER_OFFERLIST referencing old as O, new as N
+create trigger WA_USER_LIKES_SIOC_U after update on DB.DBA.WA_USER_LIKES referencing old as O, new as N
 {
   declare exit handler for sqlstate '*'
   {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  sioc_user_offerlist_delete (O.WUOL_U_ID, O.WUOL_ID, O.WUOL_OFFER, O.WUOL_COMMENT, O.WUOL_PROPERTIES);
-  sioc_user_offerlist (N.WUOL_U_ID, N.WUOL_ID, N.WUOL_OFFER, N.WUOL_COMMENT, N.WUOL_PROPERTIES);
+  sioc_user_likes_delete (O.WUL_U_ID, O.WUL_ID, O.WUL_FLAG, O.WUL_URI, O.WUL_TYPE, O.WUL_NAME, O.WUL_COMMENT, O.WUL_PROPERTIES);
+  sioc_user_likes (N.WUL_U_ID, N.WUL_ID, N.WUL_FLAG, N.WUL_URI, N.WUL_TYPE, N.WUL_NAME, N.WUL_COMMENT, N.WUL_PROPERTIES);
 };
 
-create trigger WA_USER_OFFERLIST_SIOC_D after delete on DB.DBA.WA_USER_OFFERLIST referencing old as O
+create trigger WA_USER_LIKES_SIOC_D after delete on DB.DBA.WA_USER_LIKES referencing old as O
 {
   declare exit handler for sqlstate '*'
   {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  sioc_user_offerlist_delete (O.WUOL_U_ID, O.WUOL_ID, O.WUOL_OFFER, O.WUOL_COMMENT, O.WUOL_PROPERTIES);
+  sioc_user_likes_delete (O.WUL_U_ID, O.WUL_ID, O.WUL_FLAG, O.WUL_URI, O.WUL_TYPE, O.WUL_NAME, O.WUL_COMMENT, O.WUL_PROPERTIES);
 };
 
--- Wish List
-create trigger WA_USER_WISHLIST_SIOC_I after insert on DB.DBA.WA_USER_WISHLIST referencing new as N
+-- Knows
+create trigger WA_USER_KNOWS_SIOC_I after insert on DB.DBA.WA_USER_KNOWS referencing new as N
 {
   declare exit handler for sqlstate '*'
   {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  sioc_user_wishlist (N.WUWL_U_ID, N.WUWL_ID, N.WUWL_BARTER, N.WUWL_COMMENT, N.WUWL_PROPERTIES);
+  sioc_user_knows (N.WUK_U_ID, N.WUK_ID, N.WUK_FLAG, N.WUK_URI, N.WUK_LABEL);
 };
 
-create trigger WA_USER_WISHLIST_SIOC_U after update on DB.DBA.WA_USER_WISHLIST referencing old as O, new as N
+create trigger WA_USER_KNOWS_SIOC_U after update on DB.DBA.WA_USER_KNOWS referencing old as O, new as N
 {
   declare exit handler for sqlstate '*'
   {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  sioc_user_wishlist_delete (O.WUWL_U_ID, O.WUWL_ID, O.WUWL_BARTER, O.WUWL_COMMENT, O.WUWL_PROPERTIES);
-  sioc_user_wishlist (N.WUWL_U_ID, N.WUWL_ID, N.WUWL_BARTER, N.WUWL_COMMENT, N.WUWL_PROPERTIES);
+  sioc_user_knows_delete (O.WUK_U_ID, O.WUK_ID, O.WUK_FLAG, O.WUK_URI, O.WUK_LABEL);
+  sioc_user_knows (N.WUK_U_ID, N.WUK_ID, N.WUK_FLAG, N.WUK_URI, N.WUK_LABEL);
 };
 
-create trigger WA_USER_WISHLIST_SIOC_D after delete on DB.DBA.WA_USER_WISHLIST referencing old as O
+create trigger WA_USER_KNOWS_SIOC_D after delete on DB.DBA.WA_USER_KNOWS referencing old as O
 {
   declare exit handler for sqlstate '*'
   {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  sioc_user_wishlist_delete (O.WUWL_U_ID, O.WUWL_ID, O.WUWL_BARTER, O.WUWL_COMMENT, O.WUWL_PROPERTIES);
+  sioc_user_knows_delete (O.WUK_U_ID, O.WUK_ID, O.WUK_FLAG, O.WUK_URI, O.WUK_LABEL);
 };
 
 -- Favorite Things
@@ -3225,26 +3386,18 @@ create trigger WA_USER_FAVORITES_SIOC_U after update on DB.DBA.WA_USER_FAVORITES
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
+  sioc_user_favorite_delete (O.WUF_U_ID, O.WUF_ID, O.WUF_TYPE, O.WUF_LABEL, O.WUF_URI, O.WUF_CLASS, O.WUF_PROPERTIES);
   sioc_user_favorite (N.WUF_U_ID, N.WUF_ID, N.WUF_TYPE, N.WUF_LABEL, N.WUF_URI, N.WUF_CLASS, N.WUF_PROPERTIES);
 };
 
 create trigger WA_USER_FAVORITES_SIOC_D after delete on DB.DBA.WA_USER_FAVORITES referencing old as O
 {
-  declare user_id, user_name any;
-  declare graph_iri, forum_iri, iri any;
   declare exit handler for sqlstate '*'
   {
     sioc_log_message (__SQL_MESSAGE);
     return;
   };
-  user_id := O.WUF_U_ID;
-  user_name := (select U_NAME from DB.DBA.SYS_USERS where U_ID = user_id);
-  graph_iri := get_graph ();
-  forum_iri := favorite_forum_iri (forum_name (user_name, 'FavoriteThings'), user_name);
-  iri := offerlist_item_iri (forum_iri, O.WUF_ID);
-  delete_quad_s_or_o (graph_iri, iri, iri);
-  if ((select count (WUF_ID) from DB.DBA.WA_USER_FAVORITES where WUF_U_ID = user_id) = 0)
-    SIOC..delete_quad_s_or_o (graph_iri, forum_iri, forum_iri);
+  sioc_user_favorite_delete (O.WUF_U_ID, O.WUF_ID, O.WUF_TYPE, O.WUF_LABEL, O.WUF_URI, O.WUF_CLASS, O.WUF_PROPERTIES);
 };
 
 -- Related
@@ -3552,6 +3705,484 @@ create trigger WA_INSTANCE_SIOC_U before update on DB.DBA.WA_INSTANCE referencin
     }
 };
 
+--
+-- ACL
+--
+create procedure SIOC..acl_clean_iri (
+  inout iri varchar)
+{
+  declare clean_iri varchar;
+  declare N any;
+
+  clean_iri := iri;
+  N := strchr (clean_iri, '#');
+	if (N >= 0)
+    clean_iri := subseq (clean_iri, 0, N);
+
+  return clean_iri;
+}
+;
+
+create procedure SIOC..acl_groups_graph (
+  in user_id integer)
+{
+  return sprintf ('http://%s/dataspace/private/%U', get_cname (), (select U_NAME from DB.DBA.SYS_USERS where U_ID = user_id));
+}
+;
+
+create procedure SIOC..acl_group_iri (
+  in user_id integer,
+  in group_name varchar)
+  {
+  return sprintf ('http://%s/dataspace/%U/group/%U', get_cname (), (select U_NAME from DB.DBA.SYS_USERS where U_ID = user_id), group_name);
+}
+;
+
+create procedure SIOC..acl_graph (
+  in iType varchar,
+  in iName varchar)
+{
+  return SIOC..forum_iri (DB.DBA.wa_type_to_app (iType), iName) || '/webaccess';
+}
+;
+
+create procedure SIOC..acl_insert (
+  inout graph_iri varchar,
+  inout iri varchar,
+  inout acl any)
+{
+  declare acl_iri, clean_iri varchar;
+  declare N, aclArray any;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+
+  clean_iri := SIOC..acl_clean_iri (iri);
+  aclArray := deserialize (acl);
+  for (N := 0; N < length (aclArray); N := N + 1)
+  {
+    acl_iri := clean_iri || sprintf('#acl%d', N);
+
+    DB.DBA.ODS_QUAD_URI (graph_iri, acl_iri, rdf_iri ('type'), acl_iri ('Authorization'));
+    DB.DBA.ODS_QUAD_URI (graph_iri, acl_iri, acl_iri ('accessTo'), iri);
+    if (aclArray[N][2] = 'person')
+    {
+      DB.DBA.ODS_QUAD_URI (graph_iri, acl_iri, acl_iri ('agent'), aclArray[N][1]);
+    }
+    else if (aclArray[N][2] = 'group')
+    {
+      DB.DBA.ODS_QUAD_URI (graph_iri, acl_iri, acl_iri ('agentClass'), aclArray[N][1]);
+    }
+    else if (aclArray[N][2] = 'public')
+    {
+      DB.DBA.ODS_QUAD_URI (graph_iri, acl_iri, acl_iri ('agentClass'), foaf_iri('Agent'));
+    }
+    if (aclArray[N][3])
+      DB.DBA.ODS_QUAD_URI (graph_iri, acl_iri, acl_iri ('mode'), acl_iri('Read'));
+    if (aclArray[N][4])
+      DB.DBA.ODS_QUAD_URI (graph_iri, acl_iri, acl_iri ('mode'), acl_iri('Write'));
+    if (aclArray[N][5])
+      DB.DBA.ODS_QUAD_URI (graph_iri, acl_iri, acl_iri ('mode'), acl_iri('Control'));
+  }
+}
+;
+
+create procedure SIOC..acl_delete (
+  inout graph_iri varchar,
+  inout iri varchar,
+  inout acl any)
+{
+  declare acl_iri, clean_iri varchar;
+  declare N, aclArray any;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+
+  clean_iri := SIOC..acl_clean_iri (iri);
+  aclArray := deserialize (acl);
+  for (N := 0; N < length (aclArray); N := N + 1)
+  {
+    acl_iri := clean_iri || sprintf('#acl%d', N);
+    delete_quad_s_or_o (graph_iri, acl_iri, acl_iri);
+  }
+}
+;
+
+create procedure SIOC..acl_webID ()
+{
+  declare retIRI varchar;
+  declare foafIRI, foafGraph, loadIRI, localIRI any;
+  declare S, V, info, st, msg, data, meta any;
+
+  if (not is_https_ctx ())
+  {
+    retIRI := null;
+    goto _exit;
+  }
+
+  retIRI := connection_get ('vspx_vebid');
+  if (not isnull (retIRI))
+  {
+    if (retIRI = '')
+      retIRI := null;
+    goto _exit;
+  }
+
+  foafIRI := trim (get_certificate_info (7, null, null, null, '2.5.29.17'));
+  V := regexp_replace (foafIRI, ',[ ]*', ',', 1, null);
+  V := split_and_decode (V, 0, '\0\0,:');
+  if (V is null)
+    V := vector ();
+  foafIRI := get_keyword ('URI', V);
+  if (isnull (foafIRI))
+  {
+    retIRI := DB.DBA.FOAF_SSL_WEBFINGER ();
+    if (not isnull (retIRI))
+      goto _set;
+    retIRI := ODS.DBA.FINGERPOINT_WEBID_GET ();
+    goto _set;
+  }
+
+  foafGraph := 'http://local.virt/FOAF/' || cast (rnd (1000) as varchar);
+  localIRI := foafIRI;
+  V := rfc1808_parse_uri (localIRI);
+  if (cfg_item_value (virtuoso_ini_path (), 'URIQA', 'DynamicLocal') = '1' and V[1] = registry_get ('URIQADefaultHost'))
+  {
+    V [0] := 'local';
+    V [1] := '';
+    localIRI := db.dba.vspx_uri_compose (V);
+  }
+  V := rfc1808_parse_uri (foafIRI);
+  V[5] := '';
+  loadIRI := DB.DBA.vspx_uri_compose (V);
+
+  S := sprintf ('sparql load <%s> into graph <%s>', loadIRI, foafGraph);
+  st := '00000';
+  exec (S, st, msg, vector (), 0);
+  if (st = '00000')
+  {
+  S := sprintf (' sparql define input:storage "" ' ||
+                ' prefix cert: <http://www.w3.org/ns/auth/cert#> ' ||
+                ' prefix rsa: <http://www.w3.org/ns/auth/rsa#> ' ||
+                ' select (str (bif:coalesce (?exp_val, ?exp))) ' ||
+                '        (str (bif:coalesce (?mod_val, ?mod))) ' ||
+                '   from <%s> ' ||
+                '  where { ' ||
+                '          ?id cert:identity <%s> ; ' ||
+                '              rsa:public_exponent ?exp ; ' ||
+                '              rsa:modulus ?mod . ' ||
+                '          optional { ?exp cert:decimal ?exp_val . ' ||
+                '          ?mod cert:hex ?mod_val . } ' ||
+                '        }',
+                foafGraph,
+                localIRI);
+  exec (S, st, msg, vector (), 0, meta, data);
+    if (st = '00000')
+    {
+      info := get_certificate_info (9);
+  foreach (any _row in data) do
+  {
+    if (_row[0] = cast (info[1] as varchar) and lower (regexp_replace (_row[1], '[^A-Z0-9a-f]', '', 1, null)) = bin2hex (info[2]))
+    {
+          retIRI := foafIRI;
+          goto _break;
+        }
+      }
+    }
+  }
+_break:;
+  exec (sprintf ('SPARQL clear graph <%s>', foafGraph), st, msg, vector (), 0);
+
+_set:;
+  connection_set ('vspx_vebid', coalesce (retIRI, ''));
+
+_exit:;
+  return retIRI;
+}
+;
+
+create procedure SIOC..acl_check (
+  in acl_graph_iri varchar,
+  in acl_groups_iri varchar,
+  in acl_iris any)
+{
+  declare N, M, I integer;
+  declare tmp, rc, foafIRI, acl_iri varchar;
+  declare IRIs any;
+
+  rc := '';
+  foafIRI := SIOC..acl_webID ();
+  if (isnull (foafIRI))
+    goto _exit;
+
+  IRIs := vector (vector(), vector(), vector());
+      for (N := 0; N < length (acl_iris); N := N + 1)
+      {
+    tmp := '';
+    acl_iri := acl_iris[N];
+    for ( sparql
+          define input:storage ""
+          prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+          prefix foaf: <http://xmlns.com/foaf/0.1/>
+          prefix acl: <http://www.w3.org/ns/auth/acl#>
+          select ?p1 ?p2 ?p3 ?mode
+           where {
+                   {
+                     graph `iri(?:acl_graph_iri)`
+                     {
+                       ?rule rdf:type acl:Authorization ;
+                             acl:accessTo `iri(?:acl_iri)` ;
+                             acl:agent `iri(?:foafIRI)` ;
+                             acl:agent ?p1 .
+                       OPTIONAL {?rule acl:mode ?mode .} .
+                     }
+                   }
+                   union
+        {
+                     graph `iri(?:acl_graph_iri)`
+                     {
+                       ?rule rdf:type acl:Authorization ;
+                             acl:accessTo `iri(?:acl_iri)` ;
+                             acl:agentClass foaf:Agent ;
+                             acl:agentClass ?p2 .
+                       OPTIONAL {?rule acl:mode ?mode .} .
+                     }
+                   }
+                   union
+          {
+                     graph `iri(?:acl_graph_iri)`
+            {
+                       ?rule rdf:type acl:Authorization ;
+                             acl:accessTo `iri(?:acl_iri)` ;
+                             acl:agentClass ?p3 .
+                       OPTIONAL {?rule acl:mode ?mode .} .
+                     }
+                     graph `iri(?:acl_groups_iri)`
+                     {
+                       ?p3 rdf:type foaf:Group ;
+                           foaf:member `iri(?:foafIRI)` .
+                     }
+            }
+          }
+           order by ?p3 ?p2 ?p1 DESC(?mode)) do
+    {
+      if      (not isnull ("p1"))
+        I := 0;
+      else if (not isnull ("p2"))
+        I := 1;
+      else if (not isnull ("p3"))
+        I := 2;
+      else
+        goto _skip;
+
+      tmp := coalesce ("p1", coalesce ("p2", "p3"));
+      for (M := 0; M < length (IRIs[I]); M := M + 1)
+      {
+        if (tmp = IRIs[I][M])
+          goto _skip;
+        }
+      if ("mode" like '%#Write')
+      {
+        rc := 'W';
+        goto _exit;
+      }
+      if ("mode" like '%#Read')
+        rc := 'R';
+
+      IRIs[I] := vector_concat (IRIs[I], vector (tmp));
+
+    _skip:;
+    }
+  }
+
+_exit:;
+  return rc;
+}
+;
+
+create procedure SIOC..acl_list (
+  in acl_graph_iri varchar,
+  in acl_groups_iri varchar,
+  in acl_iri varchar)
+{
+  declare rc, foafIRI varchar;
+
+  result_names (rc);
+
+  foafIRI := SIOC..acl_webID ();
+  if (isnull (foafIRI))
+    return;
+
+  for ( sparql
+        define input:storage ""
+        prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+        prefix foaf: <http://xmlns.com/foaf/0.1/>
+        prefix acl: <http://www.w3.org/ns/auth/acl#>
+        select distinct ?iri
+         where {
+                 {
+                   graph `iri(?:acl_graph_iri)`
+                   {
+                     ?rule rdf:type acl:Authorization ;
+                           acl:accessTo ?iri ;
+                           acl:agent `iri(?:foafIRI)` .
+                     filter (?iri != ?:acl_iri).
+                   }
+                 }
+                 union
+                 {
+                   graph `iri(?:acl_graph_iri)`
+                   {
+                     ?rule rdf:type acl:Authorization ;
+                           acl:accessTo ?iri ;
+                           acl:agentClass foaf:Agent .
+                     filter (?iri != ?:acl_iri).
+                   }
+                 }
+                 union
+                 {
+                   graph `iri(?:acl_graph_iri)`
+                   {
+                     ?rule rdf:type acl:Authorization ;
+                           acl:accessTo ?iri ;
+                           acl:agentClass ?group .
+                     filter (?iri != ?:acl_iri).
+                   }
+                   graph `iri(?:acl_groups_iri)`
+                   {
+                     ?group rdf:type foaf:Group ;
+                         foaf:member `iri(?:foafIRI)` .
+                   }
+                 }
+               }
+         order by ?iri) do
+  {
+    result ("iri");
+  }
+}
+;
+
+create procedure SIOC..acl_ping (
+  in instance_id integer,
+  in iri varchar,
+  in oldAcl any,
+  in newAcl any)
+{
+  declare user_id integer;
+
+  user_id := (select WAM_USER
+                from DB.DBA.WA_MEMBER,
+                     DB.DBA.WA_INSTANCE
+               where WAM_MEMBER_TYPE = 1
+                 and WAM_INST = WAI_NAME
+                 and WAI_ID = instance_id);
+  SIOC..acl_ping2 (user_id, iri, oldAcl, newAcl);
+}
+;
+
+create procedure SIOC..acl_ping2 (
+  in user_id integer,
+  in iri varchar,
+  in oldAcl any,
+  in newAcl any)
+{
+  declare N, M integer;
+  declare graph, newAclArray, oldAclArray any;
+
+  if (not DB.DBA.WA_USER_SPB_ENABLE (user_id))
+    return;
+
+  if (isnull (newAclArray))
+    return;
+
+  graph := SIOC..get_graph ();
+  newAclArray := deserialize (newAcl);
+  oldAclArray := deserialize (oldAcl);
+  for (N := 0; N < length (newAclArray); N := N + 1)
+  {
+    if (newAclArray[N][2] = 'person')
+    {
+      if (not isnull (oldAclArray))
+      {
+        for (M := 0; M < length (oldAclArray); M := M + 1)
+        {
+          if ((oldAclArray[M][2] = 'person') and (oldAclArray[M][1] = newAclArray[N][1]))
+          {
+            goto _skip;
+          }
+        }
+      }
+      if (newAclArray[N][1] not like graph || '%')
+        SEMPING.DBA.CLI_PING (iri, newAclArray[N][1]);
+    }
+  _skip:;
+  }
+}
+;
+
+create procedure SIOC..wa_instance_acl_insert (
+  inout type_name varchar,
+  inout name varchar,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  iri := SIOC..forum_iri (DB.DBA.wa_type_to_app (type_name), name);
+  graph_iri := SIOC..acl_graph (type_name, name);
+
+  SIOC..acl_insert (graph_iri, iri, acl);
+}
+;
+
+create procedure SIOC..wa_instance_acl_delete (
+  inout type_name varchar,
+  inout name varchar,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+
+  iri := SIOC..forum_iri (DB.DBA.wa_type_to_app (type_name), name);
+  graph_iri := SIOC..acl_graph (type_name, name);
+
+  SIOC..acl_delete (graph_iri, iri, acl);
+}
+;
+
+create trigger WA_INSTANCE_ACL_I after insert on DB.DBA.WA_INSTANCE order 100 referencing new as N
+{
+  if (coalesce (N.WAI_ACL, '') <> '')
+    SIOC..wa_instance_acl_insert (N.WAI_TYPE_NAME, N.WAI_NAME, N.WAI_ACL);
+}
+;
+
+create trigger WA_INSTANCE_ACL_U after update on DB.DBA.WA_INSTANCE order 100 referencing old as O, new as N
+{
+  if ((coalesce (O.WAI_ACL, '') <> '') and (coalesce (O.WAI_ACL, '') <> coalesce (N.WAI_ACL, '')))
+    SIOC..wa_instance_acl_delete (O.WAI_TYPE_NAME, O.WAI_NAME, O.WAI_ACL);
+  if ((coalesce (N.WAI_ACL, '') <> '') and (coalesce (O.WAI_ACL, '') <> coalesce (N.WAI_ACL, '')))
+    SIOC..wa_instance_acl_insert (N.WAI_TYPE_NAME, N.WAI_NAME, N.WAI_ACL);
+}
+;
+
+create trigger WA_INSTANCE_ACL_D before delete on DB.DBA.WA_INSTANCE order 100 referencing old as O
+{
+  if (coalesce (O.WAI_ACL, '') <> '')
+    SIOC..wa_instance_acl_delete (O.WAI_TYPE_NAME, O.WAI_NAME, O.WAI_ACL);
+}
+;
 
 -- DB.DBA.SYS_ROLE_GRANTS
 create trigger SYS_ROLE_GRANTS_SIOC_I after insert on DB.DBA.SYS_ROLE_GRANTS referencing new as N
@@ -3756,6 +4387,100 @@ create trigger WA_USER_CERTS_D after delete on DB.DBA.WA_USER_CERTS referencing
 }
 ;
 
+-------------------------------------------------------------------------------
+--
+create procedure waGraph ()
+{
+  return sprintf ('http://%s/webdav/webaccess', get_cname ());
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure waGroup (
+  in id integer,
+  in name varchar)
+{
+  return sprintf ('%s/%s#%U', waGraph (), (select U_NAME from DB.DBA.SYS_USERS where U_ID = id), name);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure wa_groups_acl_insert (
+  inout id integer,
+  inout name varchar,
+  inout webIDs any)
+{
+  declare N integer;
+  declare graph_iri, group_iri varchar;
+  declare tmp any;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  graph_iri := SIOC..acl_groups_graph (id);
+  group_iri := SIOC..acl_group_iri (id, name);
+  DB.DBA.ODS_QUAD_URI (graph_iri, group_iri, rdf_iri ('type'), foaf_iri ('Group'));
+  tmp := split_and_decode (webIDs, 0, '\0\0\n');
+  for (N := 0; N < length (tmp); N := N + 1)
+  {
+    if (length (tmp[N]))
+      DB.DBA.ODS_QUAD_URI (graph_iri, group_iri, foaf_iri ('member'), tmp[N]);
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure wa_groups_acl_delete (
+  inout id integer,
+  inout name varchar)
+{
+  declare graph_iri, group_iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  graph_iri := SIOC..acl_groups_graph (id);
+  group_iri := SIOC..acl_group_iri (id, name);
+  delete_quad_s_or_o (graph_iri, group_iri, group_iri);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger WA_GROUPS_ACL_SIOC_I after insert on DB.DBA.WA_GROUPS_ACL referencing new as N
+{
+  wa_groups_acl_insert (N.WACL_USER_ID,
+                        N.WACL_NAME,
+                        N.WACL_WEBIDS);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger WA_GROUPS_ACL_SIOC_U after update on DB.DBA.WA_GROUPS_ACL referencing old as O, new as N
+{
+  wa_groups_acl_delete (O.WACL_USER_ID,
+                        O.WACL_NAME);
+  wa_groups_acl_insert (N.WACL_USER_ID,
+                        N.WACL_NAME,
+                        N.WACL_WEBIDS);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger WA_GROUPS_ACL_SIOC_D before delete on DB.DBA.WA_GROUPS_ACL referencing old as O
+{
+  wa_groups_acl_delete (O.WACL_USER_ID,
+                        O.WACL_NAME);
+}
+;
+
 create function std_pref (in iri varchar, in rev int := 0)
 {
   declare v any;
@@ -4036,6 +4761,9 @@ create procedure sioct_n3 ()
   http ('<http://rdfs.org/sioc/types#Wiki> rdfs:subClassOf <http://rdfs.org/sioc/ns#Container> .\n', ses);
   http ('<http://rdfs.org/sioc/types#WishList> rdfs:subClassOf <http://rdfs.org/sioc/ns#Container> .\n', ses);
   http ('<http://rdfs.org/sioc/types#OfferList> rdfs:subClassOf <http://rdfs.org/sioc/ns#Container> .\n', ses);
+  http ('<http://rdfs.org/sioc/types#OwnsList> rdfs:subClassOf <http://rdfs.org/sioc/ns#Container> .\n', ses);
+  http ('<http://rdfs.org/sioc/types#Likes> rdfs:subClassOf <http://rdfs.org/sioc/ns#Container> .\n', ses);
+  http ('<http://rdfs.org/sioc/types#DisLikes> rdfs:subClassOf <http://rdfs.org/sioc/ns#Container> .\n', ses);
   http ('<http://sw.deri.org/2005/04/wikipedia/wikiont.owl#Article> rdfs:subClassOf <http://rdfs.org/sioc/ns#Post> .\n', ses);
   http ('<http://usefulinc.com/ns/doap#Project> rdfs:subClassOf <http://rdfs.org/sioc/ns#Item> .\n', ses);
   http ('<http://www.isi.edu/webscripter/communityreview/abstract-review-o#Review> rdfs:subClassOf <http://rdfs.org/sioc/ns#Item> .\n', ses);
@@ -4073,8 +4801,7 @@ create procedure std_pref_declare ()
          ' prefix bio: <http://vocab.org/bio/0.1/> \n' ||
 	 ' prefix cert: <' || cert_iri ('') || '> \n' ||
 	 ' prefix rsa: <' || rsa_iri ('') || '> \n' ||
-	 ' prefix gr: <' || offer_iri ('') || '> \n' ||
-	 ' prefix wl: <' || wishlist_iri ('') || '> \n'
+	 ' prefix gr: <' || offer_iri ('') || '> \n'
 	 ;
 };
 
@@ -4112,6 +4839,7 @@ create procedure foaf_check_ssl_int (in iri varchar, out graph varchar)
   declare stat, msg, meta, data, info, qr, hf, gr any;
   declare agent varchar;
   declare rc int;
+  declare groups_iri, arr any;
 
   graph := null;
   rc := 0;
@@ -4123,14 +4851,25 @@ create procedure foaf_check_ssl_int (in iri varchar, out graph varchar)
 
   set_user_id ('dba');
   info := get_certificate_info (9);
-  agent := get_certificate_info (7, null, null, null, '2.5.29.17');
+  agent := ODS.ODS_API.SSL_WEBID_GET (); 
+  if (agent is null)
+    agent := ODS..FINGERPOINT_WEBID_GET ();
 
 --  dbg_obj_print (info, agent);
-  if (not isarray (info) or agent is null or agent not like 'URI:%')
+  if (not isarray (info) or agent is null)
+    return 0;
+
+  -- old check
+  -- if (iri is not null and not foaf_check_friend (iri, agent))
+  --  return 0;
+
+  -- ACL check
+  arr := sprintf_inverse (iri, 'http://%s/dataspace/person/%s#this', 1);
+  if (length (arr) <> 2)
     return 0;
 
-  agent := subseq (agent, 4);
-  if (iri is not null and not foaf_check_friend (iri, agent))
+  groups_iri := sprintf ('http://%s/dataspace/private/%s', arr[0], arr[1]);
+  if (SIOC..acl_check (SIOC..acl_clean_iri (iri) || '/webaccess', groups_iri, vector (iri)) = '')
     return 0;
 
   -- agent := fix_uri (agent);
@@ -4155,8 +4894,6 @@ create procedure foaf_check_ssl_int (in iri varchar, out graph varchar)
     rc := 1;
 	}
     }
---  dbg_obj_print (stat, data);
-  --dbg_obj_print (rc);
   return rc;
 }
 ;
@@ -4423,6 +5160,7 @@ create procedure compose_foaf (in u_name varchar, in fmt varchar := 'n3', in p i
 	    ?event_iri bio:date ?bioDate .
 	    ?event_iri bio:place ?bioPlace .
 	    ?person pingback:to ?pb .
+	    ?person foaf:made `iri (bif:sprintf (''http://%%{WSHost}s/ods/describe?uri=%%U'', ?mbox))` .
 	  }
 	  WHERE
 	  {
@@ -4430,6 +5168,7 @@ create procedure compose_foaf (in u_name varchar, in fmt varchar := 'n3', in p i
 	    {
 	      {
 	      ?person foaf:holdsAccount <%s/%s#this> .
+		optional { ?person foaf:mbox ?mbox . } .  
 	      optional { ?person foaf:made ?made . ?made dc:identifier ?ident . ?made dc:title ?made_title . optional { ?made a ?made_type . } } .
 	      optional { ?person foaf:interest ?interest } .
 	      optional { ?interest rdfs:label ?interest_label  } .
@@ -4481,6 +5220,33 @@ create procedure compose_foaf (in u_name varchar, in fmt varchar := 'n3', in p i
         union  
         {
             ?container foaf:maker ?person;
+              a sioct:OwnsList ;
+              rdfs:label ?label .
+            OPTIONAL { ?container sioc:container_of ?grSubject.
+                       ?grSubject ?grProperty ?grObject.
+                     } .
+          }
+          union
+          {
+            ?container foaf:maker ?person ;
+              a sioct:Likes ;
+              rdfs:label ?label .
+            OPTIONAL { ?container sioc:container_of ?grSubject.
+                       ?grSubject ?grProperty ?grObject.
+                     } .
+          }
+          union
+          {
+            ?container foaf:maker ?person ;
+              a sioct:DisLikes ;
+              rdfs:label ?label .
+            OPTIONAL { ?container sioc:container_of ?grSubject.
+                       ?grSubject ?grProperty ?grObject.
+                     } .
+          }
+          union
+          {
+            ?container foaf:maker ?person ;
               a sioct:FavoriteThings .
             OPTIONAL {?container sioc:container_of ?grSubject.
                       ?grSubject ?grProperty ?grObject.
diff --git a/appsrc/ODS-Framework/site_settings.vspx b/appsrc/ODS-Framework/site_settings.vspx
index 9e8a58d..fa8c12c 100644
--- a/appsrc/ODS-Framework/site_settings.vspx
+++ b/appsrc/ODS-Framework/site_settings.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: site_settings.vspx,v 1.8.2.1 2010/07/05 08:26:09 source Exp $
+ -  $Id: site_settings.vspx,v 1.8.2.3 2011/01/31 11:17:30 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -93,9 +93,9 @@
 	<tr>
 	  <td>
 	    <img src="images/icons/go_16.png" border="0" alt="" />
-	    <v:url name="appl7" value="Mapping Services" url="map_svc.vspx" render-only="1" />
+              <v:url name="appl7" value="Login Authentication Keys" url="login_keys.vspx" render-only="1" />
 	    <div>
-	      Mapping services providers.
+                Login authentication keys.
 	    </div>
 	  </td>
 	  <td>
@@ -109,9 +109,9 @@
 	<tr>
 	  <td>
 	    <img src="images/icons/go_16.png" border="0" alt="" />
-	    <v:url name="appl9" value="Users Administration" url="accounts.vspx" render-only="1" />
+              <v:url name="appl7" value="Mapping Services" url="map_svc.vspx" render-only="1" />
 	    <div>
-	     Enable or disable user accounts.
+                Mapping services providers.
 	    </div>
 	  </td>
 	  <td>
@@ -125,9 +125,9 @@
 	<tr>
 	  <td>
 	    <img src="images/icons/go_16.png" border="0" alt="" />
-	    <v:url name="appl11" value="RDF Data" url="rdf_storage.vspx" render-only="1" />
+              <v:url name="appl9" value="Users Administration" url="accounts.vspx" render-only="1" />
 	    <div>
-	      RDF Data Administration
+                Enable or disable user accounts.
 	    </div>
 	  </td>
 	  <td>
@@ -141,12 +141,17 @@
 	<tr>
 	  <td>
 	    <img src="images/icons/go_16.png" border="0" alt="" />
-	    <v:url name="appl11" value="Semantic Pingback Log" url="semping_log.vspx" render-only="1" />
+              <v:url name="appl11" value="RDF Data" url="rdf_storage.vspx" render-only="1" />
 	    <div>
-	      Semantic Pingback
+                RDF Data Administration
 	    </div>
 	  </td>
 	  <td>
+              <img src="images/icons/go_16.png" border="0" alt="" />
+              <v:url name="appl11" value="Semantic Pingback Log" url="semping_log.vspx" render-only="1" />
+              <div>
+                Semantic Pingback
+              </div>
 	  </td>
 	</tr>
       </table>
diff --git a/appsrc/ODS-Framework/sn.sql b/appsrc/ODS-Framework/sn.sql
index d00956c..aa68acd 100644
--- a/appsrc/ODS-Framework/sn.sql
+++ b/appsrc/ODS-Framework/sn.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sn.sql,v 1.6.2.2 2009/12/15 23:14:36 source Exp $
+--  $Id: sn.sql,v 1.6.2.3 2010/09/20 10:15:26 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Framework/sn_connections.vspx b/appsrc/ODS-Framework/sn_connections.vspx
index 07b722b..0a3375b 100644
--- a/appsrc/ODS-Framework/sn_connections.vspx
+++ b/appsrc/ODS-Framework/sn_connections.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: sn_connections.vspx,v 1.9 2008/03/13 20:50:06 source Exp $
+ -  $Id: sn_connections.vspx,v 1.9.2.1 2010/09/20 10:15:26 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sn_delete.vspx b/appsrc/ODS-Framework/sn_delete.vspx
index b783a3c..e932da4 100644
--- a/appsrc/ODS-Framework/sn_delete.vspx
+++ b/appsrc/ODS-Framework/sn_delete.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sn_delete.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: sn_delete.vspx,v 1.4.2.1 2010/09/20 10:15:27 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sn_export.vspx b/appsrc/ODS-Framework/sn_export.vspx
index 824c218..f36b6da 100644
--- a/appsrc/ODS-Framework/sn_export.vspx
+++ b/appsrc/ODS-Framework/sn_export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sn_export.vspx,v 1.5 2007/05/07 14:07:31 source Exp $
+ -  $Id: sn_export.vspx,v 1.5.2.1 2010/09/20 10:15:27 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sn_make_inv.vspx b/appsrc/ODS-Framework/sn_make_inv.vspx
index cfc2913..5b68bf3 100644
--- a/appsrc/ODS-Framework/sn_make_inv.vspx
+++ b/appsrc/ODS-Framework/sn_make_inv.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sn_make_inv.vspx,v 1.5 2006/10/25 20:55:54 source Exp $
+ -  $Id: sn_make_inv.vspx,v 1.5.2.1 2010/09/20 10:15:27 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sn_profile.vspx b/appsrc/ODS-Framework/sn_profile.vspx
index 831f0e9..facabcb 100644
--- a/appsrc/ODS-Framework/sn_profile.vspx
+++ b/appsrc/ODS-Framework/sn_profile.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sn_profile.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: sn_profile.vspx,v 1.4.2.1 2010/09/20 10:15:27 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sn_rec_inv.vspx b/appsrc/ODS-Framework/sn_rec_inv.vspx
index 62c4d2b..ed11abe 100644
--- a/appsrc/ODS-Framework/sn_rec_inv.vspx
+++ b/appsrc/ODS-Framework/sn_rec_inv.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sn_rec_inv.vspx,v 1.5 2008/01/21 15:47:42 source Exp $
+ -  $Id: sn_rec_inv.vspx,v 1.5.2.1 2010/09/20 10:15:27 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sn_sent_inv.vspx b/appsrc/ODS-Framework/sn_sent_inv.vspx
index d4393f3..6109dc0 100644
--- a/appsrc/ODS-Framework/sn_sent_inv.vspx
+++ b/appsrc/ODS-Framework/sn_sent_inv.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sn_sent_inv.vspx,v 1.5 2008/03/13 20:50:06 source Exp $
+ -  $Id: sn_sent_inv.vspx,v 1.5.2.1 2010/09/20 10:15:27 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sn_settings.vspx b/appsrc/ODS-Framework/sn_settings.vspx
index 3f36f0a..9fe98e2 100644
--- a/appsrc/ODS-Framework/sn_settings.vspx
+++ b/appsrc/ODS-Framework/sn_settings.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sn_settings.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: sn_settings.vspx,v 1.4.2.1 2010/09/20 10:15:27 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sn_user_export.vspx b/appsrc/ODS-Framework/sn_user_export.vspx
index 6236900..727043a 100644
--- a/appsrc/ODS-Framework/sn_user_export.vspx
+++ b/appsrc/ODS-Framework/sn_user_export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sn_user_export.vspx,v 1.6 2008/08/05 14:11:15 source Exp $
+ -  $Id: sn_user_export.vspx,v 1.6.2.1 2010/09/20 10:15:27 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sparql_load.vspx b/appsrc/ODS-Framework/sparql_load.vspx
index 1af43f0..6ae2e45 100644
--- a/appsrc/ODS-Framework/sparql_load.vspx
+++ b/appsrc/ODS-Framework/sparql_load.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: sparql_load.vspx,v 1.7 2008/03/13 20:50:06 source Exp $
+ -  $Id: sparql_load.vspx,v 1.7.2.1 2010/09/20 10:15:27 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sparql_save.vspx b/appsrc/ODS-Framework/sparql_save.vspx
index ae63be9..13279f3 100644
--- a/appsrc/ODS-Framework/sparql_save.vspx
+++ b/appsrc/ODS-Framework/sparql_save.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: sparql_save.vspx,v 1.5 2007/02/27 21:19:46 source Exp $
+ -  $Id: sparql_save.vspx,v 1.5.2.1 2010/09/20 10:15:27 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/sql_rdf.sql b/appsrc/ODS-Framework/sql_rdf.sql
index 872e4e2..8c53b34 100644
--- a/appsrc/ODS-Framework/sql_rdf.sql
+++ b/appsrc/ODS-Framework/sql_rdf.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sql_rdf.sql,v 1.18 2008/03/13 20:50:06 source Exp $
+--  $Id: sql_rdf.sql,v 1.18.2.1 2010/09/20 10:15:27 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Framework/stat.vspx b/appsrc/ODS-Framework/stat.vspx
index 7a6899a..2933917 100644
--- a/appsrc/ODS-Framework/stat.vspx
+++ b/appsrc/ODS-Framework/stat.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: stat.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: stat.vspx,v 1.4.2.1 2010/09/20 10:15:27 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/tags.sql b/appsrc/ODS-Framework/tags.sql
index ae2c54f..ddbbebd 100644
--- a/appsrc/ODS-Framework/tags.sql
+++ b/appsrc/ODS-Framework/tags.sql
@@ -1,5 +1,5 @@
 --
---  $Id: tags.sql,v 1.7 2008/04/17 09:10:36 source Exp $
+--  $Id: tags.sql,v 1.7.2.1 2010/09/20 10:15:27 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Framework/tags.vspx b/appsrc/ODS-Framework/tags.vspx
index 722f4f3..87ea615 100644
--- a/appsrc/ODS-Framework/tags.vspx
+++ b/appsrc/ODS-Framework/tags.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: tags.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: tags.vspx,v 1.4.2.1 2010/09/20 10:15:28 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/tbl.js b/appsrc/ODS-Framework/tbl.js
index add3e29..184f880 100644
--- a/appsrc/ODS-Framework/tbl.js
+++ b/appsrc/ODS-Framework/tbl.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: tbl.js,v 1.2.2.11 2010/07/06 23:09:10 source Exp $
+ *  $Id: tbl.js,v 1.2.2.24 2011/03/08 13:28:16 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -18,9 +18,111 @@
  *  You should have received a copy of the GNU General Public License along
  *  with this program; if not, write to the Free Software Foundation, Inc.,
  *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
  */
-
+var serviceList = [
+  ["twelveseconds.jpg", "http://12seconds.tv/", "12seconds"],
+  ["amazon.jpg", "http://www.amazon.com/", "Amazon.com"],
+  ["ameba.jpg", "http://www.ameba.jp/", "Ameba"],
+  ["backtype.jpg", "http://www.backtype.com/", "Backtype"],
+  ["blog.jpg", "http://en.wikipedia.org/wiki/Blog/", "Blog"],
+  ["brightkite.jpg", "http://brightkite.com/", "brightkite.com"],
+  ["feed.jpg", "http://en.wikipedia.org/wiki/Web_feed/", "Custom RSS/Atom"],
+  ["dailymotion.jpg", "http://www.dailymotion.com/", "Dailymotion"],
+  ["delicious.jpg", "http://del.icio.us/", "Del.icio.us"],
+  ["digg.jpg", "http://www.digg.com/", "Digg"],
+  ["diigo.jpg", "http://www.diigo.com/", "Diigo"],
+  ["disqus.jpg", "http://www.disqus.com/", "Disqus"],
+  ["facebook.jpg", "http://www.facebook.com/", "Facebook"],
+  ["flickr.jpg", "http://www.flickr.com/", "Flickr"],
+  ["fotolog.jpg", "http://www.fotolog.com/", "Fotolog"],
+  ["friendfeed.jpg", "http://www.friendfeed.com/", "FriendFeed"],
+  ["furl.jpg", "http://www.furl.net/", "Furl"],
+  ["googletalk.jpg", "http://talk.google.com/", "Gmail/Google Talk"],
+  ["goodreads.jpg", "http://www.goodreads.com/", "Goodreads"],
+  ["googlereader.jpg", "http://reader.google.com/", "Google Reader"],
+  ["googleshared.jpg", "http://www.google.com/s2/sharing/stuff/", "Google Shared Stuff"],
+  ["identica.jpg", "http://identi.ca/", "identi.ca"],
+  ["ilike.jpg", "http://www.ilike.com/", "iLike"],
+  ["intensedebate.jpg", "http://www.intensedebate.com/", "Intense Debate"],
+  ["jaiku.jpg", "http://www.jaiku.com/", "Jaiku"],
+  ["joost.jpg", "http://www.joost.com/", "Joost"],
+  ["lastfm.jpg", "http://www.last.fm/user/", "Last.fm"],
+  ["librarything.jpg", "http://www.librarything.com/", "LibraryThing"],
+  ["linkedin.jpg", "http://www.linkedin.com/in/", "LinkedIn"],
+  ["livejournal.jpg", "http://www.livejournal.com/", "LiveJournal"],
+  ["magnolia.jpg", "http://ma.gnolia.com/", "Ma.gnolia"],
+  ["meneame.jpg", "http://meneame.net/", "meneame"],
+  ["misterwong.jpg", "http://www.mister-wong.com/", "Mister Wong"],
+  ["mixx.jpg", "http://www.mixx.com/", "Mixx"],
+  ["myspace.jpg", "http://www.myspace.com/", "MySpace"],
+  ["netflix.jpg", "http://www.netflix.com/", "Netflix"],
+  ["netvibes.jpg", "http://www.netvibes.com/", "Netvibes"],
+  ["pandora.jpg", "http://www.pandora.com/", "Pandora"],
+  ["photobucket.jpg", "http://www.photobucket.com/", "Photobucket"],
+  ["picasa.jpg", "http://picasaweb.google.com/", "Picasa Web Albums"],
+  ["plurk.jpg", "http://www.plurk.com/", "Plurk"],
+  ["polyvore.jpg", "http://www.polyvore.com/", "Polyvore"],
+  ["pownce.jpg", "http://pownce.com/", "Pownce"],
+  ["reddit.jpg", "http://reddit.com/", "Reddit"],
+  ["seesmic.jpg", "http://www.seesmic.com/", "Seesmic"],
+  ["skyrock.jpg", "http://www.skyrock.com/", "Skyrock"],
+  ["slideshare.jpg", "http://www.slideshare.net/", "SlideShare"],
+  ["smotri.jpg", "http://smotri.com/", "Smotri.com"],
+  ["smugmug.jpg", "http://www.smugmug.com/", "SmugMug"],
+  ["stumbleupon.jpg", "http://www.stumbleupon.com/", "StumbleUpon"],
+  ["tipjoy.jpg", "http://tipjoy.com/", "tipjoy"],
+  ["tumblr.jpg", "http://www.tumblr.com/", "Tumblr"],
+  ["twine.jpg", "http://www.twine.com/", "Twine"],
+  ["twitter.jpg", "http://twitter.com/", "Twitter"],
+  ["upcoming.jpg", "http://upcoming.yahoo.com/", "Upcoming"],
+  ["vimeo.jpg", "http://www.vimeo.com/", "Vimeo"],
+  ["wakoopa.jpg", "http://wakoopa.com/", "Wakoopa"],
+  ["yahoo.jpg", "http://www.yahoo.com/", "Yahoo"],
+  ["yelp.jpg", "http://www.yelp.com/", "Yelp"],
+  ["youtube.jpg", "http://www.youtube.com/", "YouTube"],
+  ["zooomr.jpg", "http://www.zooomr.com/", "Zooomr"]
+]
 var TBL = new Object();
+TBL.setServiceUrl = function(fld)
+{
+  for (N = 0; N < serviceList.length; N = N + 1)
+  {
+    if (fld.value == serviceList[N][2])
+    {
+      if (fld.input) {fld = fld.input;}
+
+      $(fld.name.replace(/fld_1_/, 'fld_2_')).value = serviceList[N][1]+$v('c_nick');
+
+      var S = '/ods/api/user.onlineAccounts.uri?url='+encodeURIComponent(serviceList[N][1]+$v('c_nick'));
+      var x = function(data) {
+        $(fld.name.replace(/fld_1_/, 'fld_3_')).value = data;
+      }
+      OAT.AJAX.GET(S, '', x);
+      return;
+    }
+  }
+}
+
+TBL.No = function (tbl, prefix, options)
+{
+  var No = options.No;
+  if (!$(prefix+'_no')) {
+  	var fld = OAT.Dom.create("input");
+    fld.type = 'hidden';
+    fld.name = prefix+'_no';
+    fld.id = fld.name;
+    fld.value = '0';
+    tbl.appendChild(fld);
+  }
+  if (No) {
+    $(prefix+'_no').value = No;
+  } else {
+    No = $v(prefix+'_no');
+  }
+  return parseInt(No)
+}
+
 TBL.createRow = function (prefix, No, optionObject)
 {
   if (No != null)
@@ -37,37 +139,13 @@ TBL.createRow = function (prefix, No, optionObject)
       var options = {btn_1: {mode: 0}};
       for (var p in optionObject) {options[p] = optionObject[p]; }
 
-      No = options.No;
-        if (!$(prefix+'_no')) {
-        	var fld = OAT.Dom.create("input");
-          fld.type = 'hidden';
-          fld.name = prefix+'_no';
-          fld.id = fld.name;
-          fld.value = '0';
-          tbl.appendChild(fld);
-        }
-      if (No) {
-        $(prefix+'_no').value = No;
-      } else {
-        No = $v(prefix+'_no');
-      }
-      No = parseInt(No)
-
+      No = TBL.No(tbl, prefix, options);
       OAT.Dom.hide (prefix+'_tr_no');
 
       var tr = OAT.Dom.create('tr');
       tr.id = prefix+'_tr_' + No;
       tbl.appendChild(tr);
 
-      if (options.id) {
-      	var fld = OAT.Dom.create("input");
-        fld.type = 'hidden';
-        fld.name = prefix + '_fld_0_' + No;
-        fld.id = fld.name;
-        fld.value = options.id;
-        tr.appendChild(fld);
-      }
-
       // fields
       for (var fld in options)
       {
@@ -91,6 +169,14 @@ TBL.createRow = function (prefix, No, optionObject)
       td.id = prefix+'_td_'+ No+'_btn';
       td.style.whiteSpace = 'nowrap';
       tr.appendChild(td);
+      if (options.id) {
+      	var fld = OAT.Dom.create("input");
+        fld.type = 'hidden';
+        fld.name = prefix + '_fld_0_' + No;
+        fld.id = fld.name;
+        fld.value = options.id;
+        td.appendChild(fld);
+      }
       for (var btn in options)
       {
         if (btn.indexOf('btn') == 0)
@@ -122,9 +208,11 @@ TBL.createViewRow = function (prefix, options)
   var tbl = $(prefix+'_tbl');
   if (tbl)
   {
+    var No = TBL.No(tbl, prefix, options);
     OAT.Dom.hide (prefix+'_tr_no');
 
     var tr = OAT.Dom.create('tr');
+    tr.id = prefix+'_tr_' + No;
     tbl.appendChild(tr);
 
     // fields
@@ -147,6 +235,7 @@ TBL.createViewRow = function (prefix, options)
           td.innerHTML = fldOptions.value;
         }
       }
+      $(prefix+'_no').value = No + 1;
     }
   }
 }
@@ -159,8 +248,7 @@ TBL.deleteRow = function (prefix, No, ask) {
   OAT.Dom.unlink(prefix+'_tr_'+No+'_items');
   OAT.Dom.unlink(prefix+'_tr_'+No+'_properties');
     var No = parseInt($(prefix+'_no').value);
-    for (var N = 0; N < No; N++)
-    {
+  for (var N = 0; N < No; N++) {
       if ($(prefix+'_tr_'+N))
         return;
     }
@@ -168,6 +256,15 @@ TBL.deleteRow = function (prefix, No, ask) {
   return true;
 }
 
+TBL.clean = function (prefix) {
+  var No = parseInt($(prefix+'_no').value);
+  for (var N = 0; N < No; N++)
+    OAT.Dom.unlink(prefix+'_tr_'+N);
+
+  OAT.Dom.show(prefix+'_tr_no');
+  return true;
+}
+
 TBL.createCellSelect = function (fldName) {
 	var fld = OAT.Dom.create("select");
   fld.name = fldName;
@@ -212,13 +309,17 @@ TBL.createCell0 = function (td, prefix, fldName, No, fldOptions) {
 
 TBL.createCell1 = function (td, prefix, fldName, No, fldOptions) {
   var fld = TBL.createCell0 (td, prefix, fldName, No, fldOptions)
+  if (document.forms[0].elements['sid']) {
   td.appendChild(OAT.Dom.text(' '));
   var img = OAT.Dom.create('img');
-  img.src = 'image/select.gif';
+  img.src = '/ods/images/select.gif';
   img.className = "pointer";
-  img.onclick = function (){windowShow('users_select.vspx?dst=m&params='+fldName+':s1;',520)};
+    var F = (fldOptions.form)? '&form='+fldOptions.form: '';
+    var M = (fldOptions.formMode)? '&mode='+fldOptions.formMode: '';
+    img.onclick = function (){TBL.windowShow('/ods/users_select.vspx?dst=mc&params='+fldName+':s1;'+F+M)};
 
   td.appendChild(img);
+  }
   return fld;
 }
 
@@ -231,15 +332,32 @@ TBL.createCell2 = function (td, prefix, fldName, No, fldOptions) {
   return fld.input;
 }
 
+TBL.createCell3 = function (td, prefix, fldName, No, fldOptions) {
+  var fld = TBL.createCell0 (td, prefix, fldName, No, fldOptions)
+  fld.onclick = function(){datePopup(fldName);};
+  return fld;
+}
+
+TBL.createCell4 = function (td, prefix, fldName, No, fldOptions) {
+	var fld = TBL.createCellSelect(fldName);
+  TBL.selectOption(fld, fldOptions.value, 'public', '1');
+  TBL.selectOption(fld, fldOptions.value, 'acl', '2');
+  TBL.selectOption(fld, fldOptions.value, 'private', '3');
+
+  td.appendChild(fld);
+  return fld;
+}
+
 TBL.createCell10 = function (td, prefix, fldName, No, fldOptions) {
-  var fld = TBL.createCellCombolist(td, fldOptions.value, {name: fldName, onchange: setServiceUrl});
+  var fld = TBL.createCellCombolist(td, fldOptions.value, {name: fldName, onchange: TBL.setServiceUrl});
   fld.input.setAttribute("autocomplete", "off");
   for (N = 0; N < serviceList.length; N = N + 1)
     fld.addOption('<img src="/ods/images/services/'+serviceList[N][0]+'"/> '+serviceList[N][2], serviceList[N][2]);
 
-	var ta = new TypeAhead(fld.input.id, 'onlineAccounts', '');
-	fld.input.onchange = setServiceUrl;
+	var ta = new TypeAhead(fld.input.id, 'onlineAccounts');
+	fld.input.onchange = TBL.setServiceUrl;
 	fld.input.form.onsubmit = CheckSubmit;
+	fld.input.setAttribute('autocomplete', 'off');
 	taVars[taVars.length] = ta;
 
   return fld.input;
@@ -258,6 +376,7 @@ TBL.createCell11 = function (td, prefix, fldName, No, fldOptions) {
 TBL.createCell20 = function (td, prefix, fldName, No, fldOptions) {
   var fld = TBL.createCellCombolist(td, fldOptions.value, {name: fldName});
 
+	fld.addOption('foaf:knows');
 	fld.addOption('rel:acquaintanceOf');
 	fld.addOption('rel:ambivalentOf');
 	fld.addOption('rel:ancestorOf');
@@ -511,7 +630,34 @@ TBL.createCell47 = function (td, prefix, fldName, No, fldOptions) {
     propertyType = 'object';
   }
   else if (ontologyClassProperty && ontologyClassProperty.datatypeProperties) {
-    var fld = OAT.Dom.create('input');
+    var fldClassName = '';
+    propertyType = ontologyClassProperty.datatypeProperties;
+    if ((propertyType == 'xsd:byte')    ||
+        (propertyType == 'xsd:short')   ||
+        (propertyType == 'xsd:int')     ||
+        (propertyType == 'xsd:integer') ||
+        (propertyType == 'xsd:long')) {
+      fldClassName = '_validate_ _int_';
+    } else if (propertyType == 'xsd:float') {
+      fldClassName = '_validate_ _float_';
+    } else if (propertyType == 'xsd:date') {
+      fldClassName = '_validate_ _date_';
+    } else if (propertyType == 'xsd:dateTime') {
+      fldClassName = '_validate_ _dateTime_';
+    } else if (propertyType == 'xsd:string') {
+    } else if (propertyType == 'xsd:boolean') {
+    } else if (propertyType == 'rdfs:Literal') {
+    } else {
+      propertyType = 'data';
+    }
+  	var fld;
+  	var fldLanguage;
+    if (propertyType == 'xsd:boolean') {
+    	fld = TBL.createCellSelect(fldName);
+      TBL.selectOption(fld, property.value, 'Yes', 'true');
+      TBL.selectOption(fld, property.value, 'No', 'false');
+    } else {
+      fld = OAT.Dom.create('input');
     fld.type = 'text';
     fld.id = fldName;
     fld.name = fld.id;
@@ -520,8 +666,17 @@ TBL.createCell47 = function (td, prefix, fldName, No, fldOptions) {
       fld.defaultValue = fld.value;
     }
     fld.style.width = '95%';
+      if ((propertyType == 'xsd:date') || (propertyType == 'xsd:dateTime')) {
+        fld.onclick = function(){datePopup(fldName);};
+      }
+      if (fldClassName != '')
+        fld.className = fldClassName;
+    }
     td.appendChild(fld);
-    propertyType = 'data';
+    if (fldLanguage) {
+      td.appendChild(OAT.Dom.text(' '));
+      td.appendChild(fldLanguage);
+    }
   }
   var fld = OAT.Dom.create('input');
   fld.type = 'hidden';
@@ -553,9 +708,200 @@ TBL.createCell48 = function (td, prefix, fldName, No, fldOptions) {
     td.innerHTML = 'URI';
   }
   else if (ontologyClassProperty && ontologyClassProperty.datatypeProperties) {
+    if (ontologyClassProperty.datatypeProperties == 'xsd:byte')  {
+      td.innerHTML = 'Byte';
+    } else if (ontologyClassProperty.datatypeProperties == 'xsd:short')  {
+      td.innerHTML = 'Short';
+    } else if ((ontologyClassProperty.datatypeProperties == 'xsd:int') ||
+               (ontologyClassProperty.datatypeProperties == 'xsd:integer')) {
+      td.innerHTML = 'Integer';
+    } else if (ontologyClassProperty.datatypeProperties == 'xsd:long') {
+      td.innerHTML = 'Long';
+    } else if (ontologyClassProperty.datatypeProperties == 'xsd:float') {
+      td.innerHTML = 'Float';
+    } else if (ontologyClassProperty.datatypeProperties == 'xsd:date') {
+      td.innerHTML = 'Date';
+    } else if (ontologyClassProperty.datatypeProperties == 'xsd:dateTime') {
+      td.innerHTML = 'DateTime';
+    } else if (ontologyClassProperty.datatypeProperties == 'xsd:boolean') {
+      td.innerHTML = 'Logical';
+    } else {
     td.innerHTML = 'Literal';
   }
 }
+}
+
+TBL.createCell49 = function (td, prefix, fldName, No, fldOptions) {
+  if (!td) {return;}
+
+  // clear
+  td.innerHTML = '';
+
+  // get product
+  var item = fldOptions.item;
+  if (!item) {return;}
+
+  // get property
+  var property = fldOptions.value;
+  if (!property) {return;}
+
+  // get property data
+  var ontologyClassProperty = RDF.getOntologyClassProperty(item.className, property.name);
+  if (ontologyClassProperty && ontologyClassProperty.datatypeProperties) {
+    var propertyType = ontologyClassProperty.datatypeProperties;
+    if ((propertyType != 'xsd:byte')    &&
+        (propertyType != 'xsd:short')   &&
+        (propertyType != 'xsd:int')     &&
+        (propertyType != 'xsd:integer') &&
+        (propertyType != 'xsd:long')    &&
+        (propertyType != 'xsd:float')   &&
+        (propertyType != 'xsd:date')    &&
+        (propertyType != 'xsd:dateTime')&&
+        (propertyType != 'xsd:boolean'))
+    {
+      var property = fldOptions.value;
+      fldOptions.value = null;
+      var fld = TBL.createCell0 (td, prefix, fldName, No, fldOptions)
+      if (property.language) {
+        fld.value = property.language;
+      } else {
+        fld.value = '';
+      }
+      fld.defaultValue = fld.value;
+      fld.style.width = '20px';
+    }
+  }
+}
+
+TBL.changeCell50 = function (srcFld) {
+  var srcValue = $v(srcFld.name);
+  var dstName = srcFld.name.replace('fld_1', 'fld_2');
+  var dstFld = $(dstName);
+  var dstImg = $(dstName+'_img');
+  if (srcValue == 'public') {
+    dstFld.value = 'foaf:Agent';
+    dstFld.readOnly = true;
+  } else {
+    if (dstFld.value == 'foaf:Agent')
+      dstFld.value = '';
+    dstFld.readOnly = false;
+  }
+  if (srcValue == 'public') {
+    OAT.Dom.hide(dstImg);
+  } else {
+    OAT.Dom.show(dstImg);
+  }
+}
+
+TBL.viewCell50 = function (td, prefix, fldName, No, fldOptions) {
+	if (fldOptions.value == "public") {
+	  td.innerHTML = "Public";
+	} else if (fldOptions.value == "group") {
+	  td.innerHTML = "Group";
+	} else {
+	  td.innerHTML = "Personal";
+	}
+}
+
+TBL.createCell50 = function (td, prefix, fldName, No, fldOptions) {
+	var fld = OAT.Dom.create("select");
+	fld.name = fldName;
+	fld.id = fldName;
+	TBL.selectOption(fld, fldOptions.value, "Personal", "person");
+	TBL.selectOption(fld, fldOptions.value, "Group", "group");
+	TBL.selectOption(fld, fldOptions.value, "Public", "public");
+  if (fldOptions.onchange)
+    fld.onclick = fldOptions.onchange;
+
+  td.appendChild(fld);
+  return fld;
+}
+
+TBL.createCell51 = function (td, prefix, fldName, No, fldOptions)
+{
+  var fld = TBL.createCell0 (td, prefix, fldName, No, fldOptions)
+  if (document.forms[0].elements['sid']) {
+  td.appendChild(OAT.Dom.text(' '));
+  var img = OAT.Dom.image('/ods/images/select.gif');
+  img.id = fldName+'_img';
+  img.className = "pointer";
+  img.onclick = function (){TBL.webidShow(fld, fldOptions.form)};
+  if (fldOptions.imgCssText)
+    img.style.cssText = fldOptions.imgCssText;
+
+  td.appendChild(img);
+  }
+  return fld;
+}
+
+TBL.createCell52 = function (td, prefix, fldName, No, fldOptions, disabled) {
+  function cb(td, prefix, fldName, No, fldOptions, disabled, ndx) {
+  	var fld = OAT.Dom.create("input");
+    fld.type = 'checkbox';
+    fld.id = fldName;
+    fld.name = fld.id;
+    fld.value = 1;
+    if (fldOptions.value && fldOptions.value[ndx])
+      fld.checked = true;
+    if (fldOptions.onclick)
+      fld.onclick = fldOptions.onclick;
+    if (disabled)
+      fld.disabled = disabled;
+    td.appendChild(fld);
+  }
+  var suffix = '';
+  if (fldOptions.suffix)
+    suffix = fldOptions.suffix;
+  cb(td, prefix, fldName+'_r'+suffix, No, fldOptions, disabled, 0);
+  cb(td, prefix, fldName+'_w'+suffix, No, fldOptions, disabled, 1);
+  // cb(td, prefix, fldName+'_x'+suffix, No, fldOptions, disabled, 2);
+}
+
+TBL.viewCell52 = function (td, prefix, fldName, No, fldOptions) {
+  TBL.createCell52(td, prefix, fldName, No, fldOptions, true);
+}
+
+TBL.clickCell52 = function (fld)
+{
+  var fldName = fld.name;
+  if (fldName.indexOf('_deny') != -1) {
+    fldName = fldName.replace('_deny', '_grant');
+    fldName = fldName.replace('fld_4', 'fld_3');
+  }
+  else if (fldName.indexOf('_grant') != -1) {
+    fldName = fldName.replace('_grant', '_deny');
+    fldName = fldName.replace('fld_3', 'fld_4');
+  }
+  $(fldName).checked = false;
+}
+
+TBL.createCell53 = function (td, prefix, fldName, No, fldOptions)
+{
+  var fld = TBL.createCell0 (td, prefix, fldName, No, fldOptions)
+  td.appendChild(OAT.Dom.text(' '));
+  var img = OAT.Dom.image('/ods/images/select.gif');
+  img.id = fldName+'_img';
+  img.className = "pointer";
+  img.onclick = function (){TBL.webidShow(fld)};
+  if (fldOptions.imgCssText)
+    img.style.cssText = fldOptions.imgCssText;
+
+  td.appendChild(img);
+  return fld;
+}
+
+
+TBL.createCell54 = function (td, prefix, fldName, No, fldOptions)
+{
+  var fld = TBL.createCell53 (td, prefix, fldName, No, fldOptions);
+
+	var ta = new TypeAhead(fld.id, 'webIDs', {checkMode: 1});
+	fld.setAttribute('autocomplete', 'off');
+	fld.form.onsubmit = CheckSubmit;
+	taVars[taVars.length] = ta;
+
+  return fld;
+}
 
 TBL.createButton0 = function (td, prefix, fldName, No, fldOptions)
 {
@@ -667,3 +1013,99 @@ TBL.createButton43 = function (td, prefix, fldName, No, fldOptions)
   td.appendChild(fld);
   return fld;
 }
+
+TBL.createButton44 = function (td, prefix, fldName, No, fldOptions)
+{
+  var enabled = fldOptions["enabled"];
+
+  if (enabled == "0")
+    return;
+
+  var fld = OAT.Dom.create('span');
+  fld.id = fldName;
+  OAT.Dom.addClass(fld, 'button pointer');
+
+  var img = OAT.Dom.create('img');
+  var txt;
+  if (!fldOptions["oauth_sid"] || !fldOptions["oauth_sid"].length)
+    {
+      img.src = '/ods/images/icons/link_16.png';
+      img.alt = 'Link';
+      img.title = fld.alt;
+      txt = OAT.Dom.text(' Link');
+    }
+  else
+    {
+      img.src = '/ods/images/icons/disconnect_16.png';
+      img.alt = 'Unlink';
+      img.title = fld.alt;
+      txt = OAT.Dom.text(' Unlink');
+    }
+  OAT.Dom.addClass(img, 'button');
+  fld.appendChild(img);
+  fld.appendChild(txt);
+
+  td.appendChild(fld);
+  fld.onclick = function() 
+    { 
+      var url, x;
+      if (!fldOptions["oauth_sid"] || !fldOptions["oauth_sid"].length)
+	{
+	  url = '/ods/api/oauth_connect?uri=' + encodeURIComponent(fldOptions["profile_url"]) + 
+	      '&login=1&oauth_sid=' + encodeURIComponent(fldOptions["oauth_sid"]);
+	  x = function (data)
+	    {
+	      if (data.length)
+		{
+		  var win = window.open (
+		      data, 
+		      null, 
+		      "width=700,height=420,top=100,left=100,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
+		  win.window.focus();
+		}
+	      else
+		{
+		  alert ("This service cannot be linked.");
+		}
+	    }
+	}
+      else
+	{
+	  if (!confirm('Please confirm removal of associated session'))
+	    return;
+	  url = '/ods/api/oauth_disconnect?uri=' + encodeURIComponent(fldOptions["profile_url"]);
+	  x = function (data) 
+	    {
+	      window.location.reload ();
+	    };
+	}
+      OAT.AJAX.GET(url, '', x);
+    };
+}
+
+TBL.webidShow = function(obj, frmName)
+{
+  var S = 'p';
+  if (obj.id.replace('fld_2', 'fld_1') != obj.id)
+    S = $v(obj.id.replace('fld_2', 'fld_1'));
+
+  var F = '';
+  if (frmName)
+    F = '&form='+frmName;
+
+  TBL.windowShow('/ods/webid_select.vspx?mode='+S.charAt(0)+'&params='+obj.id+':s1;'+F);
+}
+
+TBL.windowShow = function(sPage, width, height)
+{
+  if (!width)
+    width = 700;
+  if (!height)
+    height = 420;
+  if (document.forms[0].elements['sid'])
+    sPage += '&sid=' + document.forms[0].elements['sid'].value;
+  if (document.forms[0].elements['realm'])
+    sPage += '&realm=' + document.forms[0].elements['realm'].value;
+  win = window.open(sPage, null, "width="+width+",height="+height+",top=100,left=100,status=yes,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
+  win.window.focus();
+}
diff --git a/appsrc/ODS-Framework/terms.html b/appsrc/ODS-Framework/terms.html
index 48cf3f2..ea83148 100644
--- a/appsrc/ODS-Framework/terms.html
+++ b/appsrc/ODS-Framework/terms.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
  -
- -  $Id: terms.html,v 1.5 2008/03/13 20:50:06 source Exp $
+ -  $Id: terms.html,v 1.5.2.1 2010/09/20 10:15:28 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/tools.vspx b/appsrc/ODS-Framework/tools.vspx
index 9ad64a0..ed7a7ba 100644
--- a/appsrc/ODS-Framework/tools.vspx
+++ b/appsrc/ODS-Framework/tools.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: tools.vspx,v 1.4 2006/10/17 14:07:19 source Exp $
+ -  $Id: tools.vspx,v 1.4.2.1 2010/09/20 10:15:28 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/trs_export.xml b/appsrc/ODS-Framework/trs_export.xml
index 5a0a74e..4f026a1 100644
--- a/appsrc/ODS-Framework/trs_export.xml
+++ b/appsrc/ODS-Framework/trs_export.xml
@@ -1,7 +1,7 @@
 <?xml version ='1.0' encoding='UTF-8'?>
 <!--
  -
- -  $Id: trs_export.xml,v 1.3 2008/03/13 20:50:06 source Exp $
+ -  $Id: trs_export.xml,v 1.3.2.1 2010/09/20 10:15:28 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/trs_export_all.xml b/appsrc/ODS-Framework/trs_export_all.xml
index 5784fe4..5dc11cb 100644
--- a/appsrc/ODS-Framework/trs_export_all.xml
+++ b/appsrc/ODS-Framework/trs_export_all.xml
@@ -1,7 +1,7 @@
 <?xml version ='1.0' encoding='UTF-8'?>
 <!--
  -  
- -  $Id: trs_export_all.xml,v 1.1 2008/04/17 09:10:36 source Exp $
+ -  $Id: trs_export_all.xml,v 1.1.2.1 2010/09/20 10:15:28 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/twitter_login.vsp b/appsrc/ODS-Framework/twitter_login.vsp
new file mode 100644
index 0000000..d521e7a
--- /dev/null
+++ b/appsrc/ODS-Framework/twitter_login.vsp
@@ -0,0 +1,75 @@
+<?vsp 
+  declare tok, res, url, sid, oauth_tok, ret_url, screen_name, tmp any;
+
+  sid := {?'sid'};
+  screen_name := null;
+  tok := ODS.ODS_API.get_oauth_tok ('Twitter API');
+
+  if ({?'login'} is not null)
+    {
+      sid := md5 (datestring (now ()));
+      ret_url := sprintf ('http://%{WSHost}s%s?sid=%U', http_path(), sid);
+      url := OAUTH..sign_request ('GET', 'http://twitter.com/oauth/request_token', sprintf ('oauth_callback=%U', ret_url), tok, null, 1); 
+      res := http_get (url);
+      dbg_obj_print (res);
+      sid := OAUTH..parse_response (sid, tok, res);
+
+      OAUTH..set_session_data (sid, params);
+      oauth_tok := OAUTH..get_auth_token (sid);
+      url := sprintf ('http://twitter.com/oauth/authenticate?oauth_token=%U', oauth_tok);
+      http_status_set (302);
+      http_header (sprintf ('Location: %s\r\n', url)); 
+      return;
+    }
+  else if ({?'oauth_verifier'} is not null)
+    {
+      declare header, auth any;
+      dbg_obj_print (params);
+      url := OAUTH..sign_request ('GET', 'http://twitter.com/oauth/access_token', 
+		sprintf ('oauth_token=%U&oauth_verifier=%U', {?'oauth_token'}, {?'oauth_verifier'}), 
+			tok, sid, 1);
+      dbg_obj_print (url);
+      res := http_get (url);
+      dbg_obj_print (res);
+      sid := OAUTH..parse_response (sid, tok, res);
+      tmp := split_and_decode (res, 0);
+      screen_name := get_keyword ('screen_name', tmp);  
+
+      auth := OAUTH..signed_request_header ('GET', 'http://api.twitter.com/1/users/lookup.xml', sprintf ('screen_name=%U', screen_name), tok, '', sid,0);
+      url := sprintf ('http://api.twitter.com/1/users/lookup.xml?screen_name=%U', screen_name);
+      dbg_obj_print_vars (url, auth);
+      res := http_get (url, header, 'GET', auth);
+      dbg_printf ('%s', res);
+      OAUTH..session_terminate (sid); 
+    }
+?>
+<html>
+  <head>
+  </head>
+  <body>
+   <?vsp 
+      if (screen_name is not null)
+        {
+           http_value (sprintf ('OAuth login suceeded, screeen name : %s', screen_name), 'div');
+           if (exists (select 1 from DB.DBA.WA_USER_OL_ACCOUNTS where WUO_URL = sprintf ('http://twitter.com/%U', screen_name)))
+             {
+               declare uname varchar;
+               uname := (select U_NAME from SYS_USERS, WA_USER_OL_ACCOUNTS where WUO_U_ID = U_ID and 
+			WUO_URL = sprintf ('http://twitter.com/%U', screen_name));
+	       http_value (sprintf ('You are logged in as ODS account: %s', uname), 'b');
+               sid := vspx_sid_generate ();
+               insert into VSPX_SESSION (VS_SID, VS_REALM, VS_UID, VS_EXPIRY, VS_STATE) 
+			values (sid, 'wa', uname, now (), serialize (vector ('vspx_user', uname)));
+
+               ?><br/><a href="/ods/?sid=<?V sid ?>&realm=wa">Continue to ODS</a><?vsp
+             }
+           else
+             http_value ('Can not match screen name against ODS account, please verify account settings', 'b');  
+        }
+      else 
+        {
+          ?><a href="<?V http_path () ?>?login=1"><img src="images/sign-in-with-twitter-d.png" border="0"/></a><?vsp
+        } 
+   ?>
+  </body>
+</html>
diff --git a/appsrc/ODS-Framework/typeahead.css b/appsrc/ODS-Framework/typeahead.css
index 57d8003..6f51a60 100644
--- a/appsrc/ODS-Framework/typeahead.css
+++ b/appsrc/ODS-Framework/typeahead.css
@@ -1,4 +1,4 @@
-/* $Id: typeahead.css,v 1.1.2.2 2009/10/29 21:08:03 source Exp $ */
+/* $Id: typeahead.css,v 1.1.2.3 2010/09/20 10:15:28 source Exp $ */
 .THHideDropDown {
 	display: none;
 }
diff --git a/appsrc/ODS-Framework/typeahead.js b/appsrc/ODS-Framework/typeahead.js
index 4d2fd78..9d4cc56 100644
--- a/appsrc/ODS-Framework/typeahead.js
+++ b/appsrc/ODS-Framework/typeahead.js
@@ -3,18 +3,16 @@
 // Copyright (c) 2005 Cédric Savarese <pro at 4213miles.com>
 // This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
 
-// Change Log
-// v1.1 Added Suggestion drop-down ('google suggests' style)
-
-// Modified By Anton Avramov for OpenLink eCRM purposes
-// $Id: typeahead.js,v 1.1.2.2 2009/10/29 21:08:03 source Exp $
-// Modified By Anton Avramov for OpenLink eCRM purposes
-// $Id: typeahead.js,v 1.1.2.2 2009/10/29 21:08:03 source Exp $
-
-function TypeAhead(pInputId,pKey,pDepend)
+// Modified for OpenLink eCRM and ODS purposes
+//
+function TypeAhead (id, key, optObj)
 {
-	this.typeAheadServiceURL = "/ods/api/lookup.list?key=" + encodeURIComponent(pKey);
-	this.inputId = pInputId;		    // id of the text input
+	this.options = {
+		checkMode: 0
+	}
+	for (var p in optObj) { this.options[p] = optObj[p]; }
+	this.typeAheadServiceURL = "/ods/api/lookup.list?key=" + encodeURIComponent(key);
+	this.inputId = id;		    // id of the text input
 	this.inputElement = null;		    // reference to the text input element
 	this.suggestions = new Array();	// list of suggestions retrieved for the given input id
 	this.suggestedText = "";		    // latest suggested text
@@ -23,13 +21,10 @@ function TypeAhead(pInputId,pKey,pDepend)
 	this.hasFocus = 0;
 	var suggestedIndex = 0;			    // index of the selected suggestion in the Drop Down list (changed w/ up & down arrows)
 	var isWaitingForSuggestions = false;
+
 	var self = this;				        // TypeAhead object reference
-	var HTTPReq; 					          // HTTP Request object reference
-	var HTTPReqPost;
-	//var pressedKeyCount=0;
-	this.depend = $(pDepend);
 
-	var debugOutput = $('eCRMdebugOutput'); // Debug Output
+	var debugOutput = $(self.options.debug);    // Debug Output
 	function debug(text)
 	{
 		if(typeof debugOutput != "undefined" && debugOutput)
@@ -39,26 +34,23 @@ function TypeAhead(pInputId,pKey,pDepend)
 	this.init = function()
 	{
 		debug("TypeAhead Object Initialization");
-		if(window.ActiveXObject)
-			HTTPReq = new ActiveXObject("Microsoft.XMLHTTP");
-		else
-			HTTPReq = new XMLHttpRequest();
 
-		if (HTTPReq)
-		{
-			if(!self.inputElement && self.inputId) self.inputElement = $(self.inputId);
-			if(self.inputElement)
-			{
+		if (!self.inputElement && self.inputId)
+		  self.inputElement = $(self.inputId);
+
+		if (!self.inputElement)
+		  return;
+
 				// create markup for drop-down list of suggestions
 				self.suggestionDropDown = $("THDropDown-" + self.inputId);
 				if(!self.suggestionDropDown)
 				{
 					var pos = OAT.Dom.position(self.inputElement);
-					self.suggestionDropDown = document.createElement('DIV');
+			self.suggestionDropDown = document.createElement('div');
 					self.suggestionDropDown.id = "THDropDown-" + self.inputId;
 					self.suggestionDropDown.className = "THHideDropDown";
 					self.suggestionDropDown = self.inputElement.parentNode.insertBefore(self.suggestionDropDown, self.inputElement.nextSibling);
-					self.suggestionDropDown.style.top =  (pos[1] + self.inputElement.offsetHeight + 2).toString() + "px";
+			self.suggestionDropDown.style.top =  (pos[1] + self.inputElement.offsetHeight + 1).toString() + "px";
 					self.suggestionDropDown.style.left = pos[0].toString() + "px";
 					self.suggestionDropDown.style.width = self.inputElement.offsetWidth.toString() + "px";
 				}
@@ -66,7 +58,8 @@ function TypeAhead(pInputId,pKey,pDepend)
 				//self.getSuggestions();
 				//handle user input
 				self.inputElement.onkeyup = function (evt) {
-					if(!evt) evt = window.event;
+			if (!evt)
+			  evt = window.event;
 
 					switch(evt.keyCode) {
 						case 8: // backspace
@@ -82,7 +75,9 @@ function TypeAhead(pInputId,pKey,pDepend)
 							self.getSuggestions();
 							return; // no suggest on backspace
 						case 40:	// arrow down
-							if(suggestedIndex < self.suggestions.length) suggestedIndex ++;
+					if (suggestedIndex < self.suggestions.length)
+					  suggestedIndex ++;
+
 							self.suggest();
 							self.divScroll();
 							break;
@@ -92,20 +87,24 @@ function TypeAhead(pInputId,pKey,pDepend)
 							self.divScroll();
 							break;
 						case 33:	// page up
-							if(suggestedIndex > self.divPageSize()) suggestedIndex -= self.divPageSize();
-							else suggestedIndex = 1;
+					if (suggestedIndex > self.divPageSize()) {
+					  suggestedIndex -= self.divPageSize();
+					} else {
+					  suggestedIndex = 1;
+					}
 							self.suggest();
 							self.divScroll();
 							break;
 						case 34:	// page down
-							if(suggestedIndex < self.suggestions.length - self.divPageSize()) suggestedIndex += self.divPageSize();
-							else suggestedIndex = self.suggestions.length;
+					if (suggestedIndex < self.suggestions.length - self.divPageSize()) {
+					  suggestedIndex += self.divPageSize();
+					} else {
+					  suggestedIndex = self.suggestions.length;
+					}
 							self.suggest();
 							self.divScroll();
 							break;
 						default:
-						  //if(!evt.keyCode == 9)
-								//pressedKeyCount--;
 							if (self.userText != self.inputElement.value) {
 								suggestedIndex = 0;
 								self.userText = self.inputElement.value.toLowerCase();
@@ -113,17 +112,12 @@ function TypeAhead(pInputId,pKey,pDepend)
 							}
 					}
 				}
+
 				self.inputElement.onkeydown = function (evt) {
-					if(!evt) evt = window.event;
-					//if(evt.keyCode != 8 &&
-					//	 evt.keyCode != 46 &&
-					//	 evt.keyCode != 40 &&
-					//	 evt.keyCode != 38 &&
-					//	 evt.keyCode != 33 &&
-					//	 evt.keyCode != 33 &&
-					//	 evt.keyCode != 9)
-					//	pressedKeyCount++;
+			if (!evt)
+			  evt = window.event;
 				}
+
 				self.inputElement.onfocus = function(evt) {
 					self.hasFocus = 1;
 					self.userText = self.inputElement.value;
@@ -139,39 +133,39 @@ function TypeAhead(pInputId,pKey,pDepend)
 					   },500);
 				}
 			}
-		}
-	}
 
 	this.getSuggestions = function(text)
 	{
-		if(text) self.userText = text;
-		HTTPReq.abort();
-		HTTPReq.onreadystatechange = self.populateSuggestions;
-		var sURL = self.typeAheadServiceURL + "&input="+encodeURIComponent(self.userText);
-		if (self.depend)
-		  sURL += "&depend="+encodeURIComponent(self.depend.value);
-		HTTPReq.open("GET", sURL, true);
-		HTTPReq.send(null);
-		debug("request sent: " + sURL);
-	}
+		if (text)
+		  self.userText = text;
 
-	this.populateSuggestions = function(evt)
-	{
-	  if (HTTPReq.readyState == 4)
-	  {
-	  	self.suggestions = HTTPReq.responseText.split("\n").clean("");
-		  debug("response: "+ HTTPReq.responseText);
+    var x = function (data) {
+	  	self.suggestions = data.split("\n").clean("");
+		  debug("response: "+ data);
 		  if(isWaitingForSuggestions) self.showSuggestionList();
 	  }
+		var S = self.typeAheadServiceURL + "&param="+encodeURIComponent(self.userText);
+
+    var inputForm = self.inputElement.form;
+    if (inputForm && inputForm.sid)
+		  S += "&realm=" + encodeURIComponent(inputForm.realm.value) + "&sid="+encodeURIComponent(inputForm.sid.value);
+
+		if (self.options.depend)
+		  S += "&depend="+encodeURIComponent(self.options.depend.value);
+
+    OAT.AJAX.GET (S, false, x);
+		debug("request sent: " + S);
 	}
 
 	this.suggest = function(text)
 	{
-		if (!HTTPReq) return;
-		if (text) self.userText = text;
-		//if(self.userText == "") return;
-		self.suggestedText = "";
+		if (text)
+		  self.userText = text;
+
+		if (self.userText == "")
+		  return;
 
+		self.suggestedText = "";
 		if (suggestedIndex==0)
 		{
 			//search for one matching suggestion
@@ -237,7 +231,8 @@ function TypeAhead(pInputId,pKey,pDepend)
     var htmlList="";
     for (var i=0; i < self.suggestions.length; i++)
     {
-      if (self.suggestions[i].toLowerCase().indexOf(self.userText.toLowerCase()) == 0)
+      var j = self.suggestions[i].toLowerCase().indexOf(self.userText.toLowerCase());
+      if (((self.options.checkMode == 0) && (j == 0)) || ((self.options.checkMode == 1) && (j >= 0)))
       {
         htmlList += "<li";
         if (suggestedIndex-1 == i)
@@ -245,13 +240,15 @@ function TypeAhead(pInputId,pKey,pDepend)
         htmlList += " onclick='var x = $(\"" + self.inputId + "\"); x.value=\"" + self.suggestions[i] + "\"; if (x.onchange) x.onchange(x);' onmouseover='this.className+=\" THLIHover\"' onmouseout='this.className=this.className.replace(\"THLIHover\",\"\")' >" + self.suggestions[i] + "</li>";
       }
     }
-    if (htmlList=="")
-      if (!isWaitingForSuggestions)
+    if (htmlList == "") {
+      if (!isWaitingForSuggestions) {
         self.suggestionDropDown.innerHTML = "<ul><li>loading more suggestions...</li></ul>";
-      else
+      } else {
         self.suggestionDropDown.innerHTML = "<ul><li>no suggestion available</li></ul>";
-    else
+      }
+    } else {
       self.suggestionDropDown.innerHTML = "<ul>"+htmlList+"</ul>";
+    }
     self.suggestionDropDown.className = self.suggestionDropDown.className.replace("THHideDropDown","THShowDropDown");
   }
 
@@ -319,7 +316,7 @@ Array.prototype.clean = function(to_delete)
   return this;
 }
 
-taVars = new Array();
+var taVars = new Array();
 function CheckSubmit()
 {
   for (var i=0; i < taVars.length; i++)
diff --git a/appsrc/ODS-Framework/ufoaf.xml b/appsrc/ODS-Framework/ufoaf.xml
index 1fd4f24..2cdfcf1 100644
--- a/appsrc/ODS-Framework/ufoaf.xml
+++ b/appsrc/ODS-Framework/ufoaf.xml
@@ -1,7 +1,7 @@
 <?xml version ='1.0' encoding='UTF-8'?>
 <!--
  -
- -  $Id: ufoaf.xml,v 1.14 2008/03/13 20:50:06 source Exp $
+ -  $Id: ufoaf.xml,v 1.14.2.1 2010/09/20 10:15:28 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/uhome.vspx b/appsrc/ODS-Framework/uhome.vspx
index fba9bd4..a3a896c 100644
--- a/appsrc/ODS-Framework/uhome.vspx
+++ b/appsrc/ODS-Framework/uhome.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: uhome.vspx,v 1.7.2.2 2009/08/14 12:56:37 source Exp $
+ -  $Id: uhome.vspx,v 1.7.2.3 2010/09/20 10:15:28 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/uiedit.vspx b/appsrc/ODS-Framework/uiedit.vspx
index 323660e..f299015 100644
--- a/appsrc/ODS-Framework/uiedit.vspx
+++ b/appsrc/ODS-Framework/uiedit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: uiedit.vspx,v 1.23.2.14 2010/07/05 08:26:09 source Exp $
+ -  $Id: uiedit.vspx,v 1.23.2.21 2010/12/07 11:11:30 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -66,6 +66,7 @@
     <vm:pagewrapper vm_onunload="checkPageLeave (document.forms['page_form'])">
       <v:variable persist="temp" name="msg_msg" type="varchar" default="''"/>
       <v:variable name="tabNo" type="integer" param-name="tabNo" default="0"/>
+      <v:variable name="tabSubNo" type="integer" param-name="tabSubNo" default="0"/>
       <v:variable name="pg" type="integer" param-name="page" default="1"/>
       <v:variable name="is_org" type="integer" default="0" />
       <vm:rawheader caption="Edit your personal data"/>
@@ -111,10 +112,7 @@ function swPersShow ()
 }
 function swOrg (cb)
 {
-  if (cb.checked == true)
-    swPersHide ();
-  else
-    swPersShow ();
+              (cb.checked)? swPersHide(): swPersShow();
 }
 function checkRest (form, sel)
 {
@@ -132,10 +130,7 @@ function checkRest (form, sel)
     }
 }
             ODSInitArray.push ( function () {
-              OAT.Loader.load(["json", "ws", "calendar", "combolist"], function(){OAT.MSG.send(OAT, 'PAGE_LOADED');});
-            });
-            ODSInitArray.push ( function () {
-              (<?V self.is_org ?>)? swPersHide(): swPersShow();
+              OAT.Loader.load(["json", "ws", "calendar", "combolist"], function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){(<?V self.is_org ?>)? swPersHide(): swPersShow();}); OAT.MSG.send(OAT, 'PAGE_LOADED');});
             });
           ]]>
         </script>
@@ -145,6 +140,7 @@ function checkRest (form, sel)
           <input type="hidden" name="dirty_force_global" id="dirty_force_global" value="<?vsp http(get_keyword ('dirty_force_global', self.vc_event.ve_params, 'false')); ?>"/>
           <input type="hidden" name="page" value="<?V self.pg ?>"/>
           <input type="hidden" name="tabNo" id="tabNo" value="<?V self.tabNo ?>"/>
+          <input type="hidden" name="tabSubNo" id="tabSubNo" value="<?V self.tabSubNo ?>"/>
         </div>
     <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
     <tr valign='top'>
@@ -152,117 +148,13 @@ function checkRest (form, sel)
         <table cellpadding='10' cellspacing='0' border='0' width='100%'>
           <tr>
             <td class="tab_deck">
-              <table cellpadding="0" cellspacing="0" border="0" class="navtab_tabs_ctr">
-        		    <tr class="navtab_row">
-        		      <?vsp
-        		         declare btn varchar;
-
-                          btn := case self.pg
-                                   when 1 then 'user_s_personal_' || cast (self.tabNo as varchar)
-                                   when 2 then 'user_s_business_' || cast (self.tabNo as varchar)
-                                   else ''
-                                 end;
-        		      ?>
-        		      <script type="text/javascript">
-        			      def_btn = '<?V btn ?>';
-        		      </script>
-                        <td class="<?V case when self.pg = 1 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
-                          <v:url name="b_url01"
-                                 value="Personal"
-                                 format="%s"
-                                 url="--sprintf('uiedit.vspx?page=1')"
-                                 xhtml_class="tab"/>
-                  </td>
-                        <td class="<?V case when self.pg = 2 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
-                          <v:url name="b_url02"
-                                 value="Business"
-                                 format="%s"
-                                 url="--sprintf('uiedit.vspx?page=2')"
-                                 xhtml_class="tab"/>
-                        </td>
-                        <td class="<?V case when self.pg = 3 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
-                          <v:url name="b_url03"
-                                 value="Security"
-                                 format="%s"
-                                 url="--sprintf('uiedit.vspx?page=3')"
-                                 xhtml_class="tab"/>
-                        </td>
-                        <td class="<?V case when self.pg = 4 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
-                          <v:url name="b_url04"
-                                 value="Associations & Web Services"
-                                 format="%s"
-                                 url="--sprintf('uiedit.vspx?page=4')"
-                                 xhtml_class="tab"/>
-                        </td>
-                        <td class="<?V case when self.pg = 8 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
-                          <v:url name="b_url08"
-                                 value="Annotations"
-                                 format="%s"
-                                 url="--sprintf('uiedit.vspx?page=8')"
-                                 xhtml_class="tab"/>
-                        </td>
-                        <td class="<?V case when self.pg = 9 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
-                          <v:url name="b_url09"
-                                 value="Validation"
-                                 format="%s"
-                                 url="--sprintf('uiedit.vspx?page=9')"
-                                 xhtml_class="tab"/>
-                        </td>
-                        <td class="<?V case when self.pg = 10 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
-                          <v:url name="b_url11"
-                                 value="LDAP Servers"
-                                 format="%s"
-                                 url="--sprintf('uiedit.vspx?page=10')"
-                                 xhtml_class="tab"/>
-                        </td>
-                  <td class="page_tab_empty" align="center" width="100%">
-                     <table cellpadding="0" cellspacing="0">
-                        <tr>
-                          <td width="100%" >
-                          </td>
-                        </tr>
-                     </table>
-                  </td>
-                    </tr>
+                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="navtab_tabs_ctr">
+                        <v:include url="uiedit_nav.vspx"/>
                   </table>
                  <table class="tab_page">
                     <tr>
                       <td valign="top" class="tab_page">
-                        <v:template name="template1"
-                                    type="simple"
-                                    enabled="-- equ (get_keyword('page', self.vc_event.ve_params, '1'), '1')">
                           <v:include url="uiedit_personal.vspx"/>
-                        </v:template>
-                        <v:template name="template2"
-                                    type="simple"
-                                    enabled="-- equ (get_keyword('page', self.vc_event.ve_params),'2')">
-                            <v:include url="uiedit_buss.vspx"/>
-                        </v:template>
-                        <v:template name="template3"
-                                    type="simple"
-                                    enabled="-- equ (get_keyword('page', self.vc_event.ve_params), '3')">
-                            <v:include url="uiedit_pwd.vspx"/>
-                        </v:template>
-                        <v:template name="template4"
-                                     type="simple"
-                                     enabled="-- equ (get_keyword('page', self.vc_event.ve_params), '4')">
-                            <v:include url="uiedit_svc.vspx"/>
-                        </v:template>
-                        <v:template name="template8"
-                                     type="simple"
-                                     enabled="-- equ (get_keyword('page', self.vc_event.ve_params), '8')">
-                            <v:include url="uiedit_related.vspx"/>
-                        </v:template>
-                          <v:template name="template9"
-                                     type="simple"
-                                      enabled="-- equ (get_keyword('page', self.vc_event.ve_params), '9')">
-                            <v:include url="uiedit_validation.vspx"/>
-                          </v:template>
-                          <v:template name="template10"
-                                      type="simple"
-                                      enabled="-- equ (get_keyword('page', self.vc_event.ve_params), '10')">
-                          <v:include url="uiedit_ldap.vspx"/>
-                        </v:template>
                       </td>
                     </tr>
                   </table>
diff --git a/appsrc/ODS-Framework/uiedit_acl.vspx b/appsrc/ODS-Framework/uiedit_acl.vspx
new file mode 100644
index 0000000..2ab2d31
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_acl.vspx
@@ -0,0 +1,170 @@
+<?xml version="1.0"?>
+<!--
+ -
+ -  $Id: uiedit_acl.vspx,v 1.1.4.2 2010/11/09 20:18:23 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="ui_profile"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+	      style="index.xsl"
+	      fast-render="1"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+  <v:method name="addProperty" arglist="in obj any, in objProperty varchar, in paramsProperty varchar, in params any">
+    <![CDATA[
+      declare tmp ay;
+
+      tmp := trim (get_keyword (paramsProperty, params));
+      if (not is_empty_or_null (tmp))
+        obj := vector_concat (obj, vector (objProperty, tmp));
+      return obj;
+    ]]>
+  </v:method>
+
+  <v:method name="jsonObject" arglist="">
+    <![CDATA[
+      return subseq (soap_box_structure ('x', 1), 0, 2);
+    ]]>
+  </v:method>
+
+  <v:method name="checkBox" arglist="in checkField varchar, inout properties any">
+    <![CDATA[
+      declare S varchar;
+
+      S := '';
+      if (get_keyword (checkField, properties, '0') <> '0')
+        S := 'checked="checked"';
+      http (sprintf ('<input type="checkbox" name="%s" id="%s" value="1" %s />', checkField, checkField, S));
+    ]]>
+  </v:method>
+
+  <vm:page>
+    <vm:header>
+      <script type="text/javascript" src="tbl.js">;</script>
+      <script type="text/javascript" src="typeahead.js">;</script>
+      <link rel="stylesheet" href="typeahead.css" type="text/css" />
+      <vm:title>Edit your personal data</vm:title>
+    </vm:header>
+    <vm:pagewrapper vm_onunload="checkPageLeave (document.forms['page_form'])">
+      <v:variable persist="temp" name="msg_msg" type="varchar" default="''"/>
+      <v:variable name="tabNo" type="integer" param-name="tabNo" default="0"/>
+      <v:variable name="pg" type="integer" param-name="page" default="1"/>
+      <v:variable name="is_org" type="integer" default="0" />
+      <vm:rawheader caption="Edit your personal data"/>
+      <vm:navigation-new on="settings"/>
+      <vm:subnavigation-new on="site"/>
+      <vm:body>
+        <v:before-data-bind>
+          <![CDATA[
+            self.is_org := coalesce ((select WAUI_IS_ORG from WA_USER_INFO where WAUI_U_ID = self.u_id), 0);
+          ]]>
+        </v:before-data-bind>
+        <script type="text/javascript">
+          <![CDATA[
+            function getFileName(form, from, to)
+            {
+              var S = from.value;
+              var N;
+              var fname;
+              if (S.lastIndexOf('\\') > 0)
+                N = S.lastIndexOf('\\')+1;
+              else
+                N = S.lastIndexOf('/')+1;
+              fname = S.substr(N,S.length);
+              to.value = fname;
+            }
+            function swPersHide ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Organization Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.hide('pers_'+i);
+              OAT.Dom.hide('p_url_2');
+            }
+            function swPersShow ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Personal Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.show('pers_'+i);
+              OAT.Dom.show('p_url_2');
+            }
+            function swOrg (cb)
+            {
+              (cb.checked)? swPersHide(): swPersShow();
+            }
+            function checkRest (form, sel)
+            {
+              var i;
+              if (sel.selectedIndex == 0)
+                return;
+              for (i = 0; i < form.elements.length; i++)
+              {
+                var contr = form.elements[i];
+                if (contr != null && contr != sel && contr.type == "select-one")
+                {
+                  if (contr.selectedIndex == sel.selectedIndex)
+                    contr.selectedIndex = 0;
+                }
+              }
+            }
+            ODSInitArray.push ( function () {
+              OAT.Loader.load(["json", "ws", "calendar", "combolist"], function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){(<?V self.is_org ?>)? swPersHide(): swPersShow();}); OAT.MSG.send(OAT, 'PAGE_LOADED');});
+            });
+          ]]>
+        </script>
+        <vm:login redirect="index.vspx"/>
+        <div class="message">
+          <v:label name="pwd_msg" value="--self.msg_msg" />
+          <input type="hidden" name="dirty_force_global" id="dirty_force_global" value="<?vsp http(get_keyword ('dirty_force_global', self.vc_event.ve_params, 'false')); ?>"/>
+          <input type="hidden" name="page" value="<?V self.pg ?>"/>
+          <input type="hidden" name="tabNo" id="tabNo" value="<?V self.tabNo ?>"/>
+        </div>
+        <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
+          <tr valign='top'>
+            <td>
+              <table cellpadding='10' cellspacing='0' border='0' width='100%'>
+                <tr>
+                  <td class="tab_deck">
+                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="navtab_tabs_ctr">
+                      <v:include name="nav" url="uiedit_nav.vspx"/>
+                    </table>
+                    <table class="tab_page">
+                      <tr>
+                        <td valign="top" class="tab_page">
+                          <v:include url="uiedit_acls.vspx"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </td>
+                </tr>
+              </table>
+            </td>
+          </tr>
+        </table>
+      </vm:body>
+    </vm:pagewrapper>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_acls.vspx b/appsrc/ODS-Framework/uiedit_acls.vspx
new file mode 100644
index 0000000..354b36f
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_acls.vspx
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: uiedit_acls.vspx,v 1.1.4.2 2010/11/09 20:18:23 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2010 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="acl-sharing"
+        fast-render="1"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        style="index.xsl"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+  <v:before-data-bind>
+    <![CDATA[
+      select deserialize (WAUI_ACL)
+        into self.iAcl
+        FROM DB.DBA.WA_USER_INFO
+       where WAUI_U_ID = self.u_id;
+    ]]>
+  </v:before-data-bind>
+  <v:variable name="iAcl" type="any" default="null" persist="0" />
+  <h3>Profile Sharing</h3>
+  <table>
+    <tr>
+      <td width="100%">
+        <table id="s_tbl" class="listing" style="width: 100%;" cellspacing="0">
+          <thead>
+            <tr class="listing_header_row">
+              <th width="1%" nowrap="nowrap">Access Type</th>
+              <th nowrap="nowrap">WebID</th>
+              <th width="1%" align="center" nowrap="nowrap">ACL: (R)ead, (W)rite</th>
+              <th width="1%">Action</th>
+            </tr>
+          </thead>
+          <tr id="s_tr_no"><td colspan="4"><b>No WebID Security</b></td></tr>
+    		  <![CDATA[
+    		    <script type="text/javascript">
+            <?vsp
+              declare N integer;
+
+              for (N := 0; N < length (self.iAcl); N := N + 1)
+              {
+                http (sprintf ('ODSInitArray.push(function(){TBL.createRow("s", null, {fld_1: {mode: 50, value: "%s", onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, className: "_validate_ _webid_", value: "%s", readOnly: %s, imgCssText: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', self.iacl[N][2], self.iacl[N][1], case when self.iacl[N][2] = 'public' then 'true' else 'false' end, case when self.iacl[N][2] = 'public' then 'display: none;' else '' end, self.iacl[N][3], self.iacl[N][4], self.iacl[N][5]));
+              }
+            ?>
+    		    </script>
+    		  ]]>
+        </table>
+      </td>
+      <td valign="top" nowrap="nowrap">
+        <span class="button pointer" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 50, onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, className: '_validate_ _webid_'}, fld_3: {mode: 52, value: [1, 0, 0], tdCssText: 'width: 1%; text-align: center;'}});"><img src="/ods/images/icons/add_16.png" border="0" class="button" alt="Add Security" title="Add Security" /> Add</span><br /><br />
+      </td>
+    </tr>
+  </table>
+  <v:button name="btn_acl_update" action="simple" value="Update" xhtml_class="form-button">
+    <v:on-post>
+      <![CDATA[
+        self.iAcl := DB.DBA.wa_acl_params (e.ve_params);
+        WA_USER_EDIT (self.u_name, 'WAUI_ACL', serialize (self.iAcl));
+
+        self.vc_data_bind(e);
+      ]]>
+    </v:on-post>
+  </v:button>
+
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_ann.vspx b/appsrc/ODS-Framework/uiedit_ann.vspx
new file mode 100644
index 0000000..ae1ee54
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_ann.vspx
@@ -0,0 +1,170 @@
+<?xml version="1.0"?>
+<!--
+ -
+ -  $Id: uiedit_ann.vspx,v 1.1.4.2 2010/09/27 14:45:39 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="ui_profile"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+	      style="index.xsl"
+	      fast-render="1"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+  <v:method name="addProperty" arglist="in obj any, in objProperty varchar, in paramsProperty varchar, in params any">
+    <![CDATA[
+      declare tmp ay;
+
+      tmp := trim (get_keyword (paramsProperty, params));
+      if (not is_empty_or_null (tmp))
+        obj := vector_concat (obj, vector (objProperty, tmp));
+      return obj;
+    ]]>
+  </v:method>
+
+  <v:method name="jsonObject" arglist="">
+    <![CDATA[
+      return subseq (soap_box_structure ('x', 1), 0, 2);
+    ]]>
+  </v:method>
+
+  <v:method name="checkBox" arglist="in checkField varchar, inout properties any">
+    <![CDATA[
+      declare S varchar;
+
+      S := '';
+      if (get_keyword (checkField, properties, '0') <> '0')
+        S := 'checked="checked"';
+      http (sprintf ('<input type="checkbox" name="%s" id="%s" value="1" %s />', checkField, checkField, S));
+    ]]>
+  </v:method>
+
+  <vm:page>
+    <vm:header>
+      <script type="text/javascript" src="tbl.js">;</script>
+      <script type="text/javascript" src="typeahead.js">;</script>
+      <link rel="stylesheet" href="typeahead.css" type="text/css" />
+      <vm:title>Edit your personal data</vm:title>
+    </vm:header>
+    <vm:pagewrapper vm_onunload="checkPageLeave (document.forms['page_form'])">
+      <v:variable persist="temp" name="msg_msg" type="varchar" default="''"/>
+      <v:variable name="tabNo" type="integer" param-name="tabNo" default="0"/>
+      <v:variable name="pg" type="integer" param-name="page" default="1"/>
+      <v:variable name="is_org" type="integer" default="0" />
+      <vm:rawheader caption="Edit your personal data"/>
+      <vm:navigation-new on="settings"/>
+      <vm:subnavigation-new on="site"/>
+      <vm:body>
+        <v:before-data-bind>
+          <![CDATA[
+            self.is_org := coalesce ((select WAUI_IS_ORG from WA_USER_INFO where WAUI_U_ID = self.u_id), 0);
+          ]]>
+        </v:before-data-bind>
+        <script type="text/javascript">
+          <![CDATA[
+            function getFileName(form, from, to)
+            {
+              var S = from.value;
+              var N;
+              var fname;
+              if (S.lastIndexOf('\\') > 0)
+                N = S.lastIndexOf('\\')+1;
+              else
+                N = S.lastIndexOf('/')+1;
+              fname = S.substr(N,S.length);
+              to.value = fname;
+            }
+            function swPersHide ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Organization Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.hide('pers_'+i);
+              OAT.Dom.hide('p_url_2');
+            }
+            function swPersShow ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Personal Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.show('pers_'+i);
+              OAT.Dom.show('p_url_2');
+            }
+            function swOrg (cb)
+            {
+              (cb.checked)? swPersHide(): swPersShow();
+            }
+            function checkRest (form, sel)
+            {
+              var i;
+              if (sel.selectedIndex == 0)
+                return;
+              for (i = 0; i < form.elements.length; i++)
+              {
+                var contr = form.elements[i];
+                if (contr != null && contr != sel && contr.type == "select-one")
+                {
+                  if (contr.selectedIndex == sel.selectedIndex)
+                    contr.selectedIndex = 0;
+                }
+              }
+            }
+            ODSInitArray.push ( function () {
+              OAT.Loader.load(["json", "ws", "calendar", "combolist"], function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){(<?V self.is_org ?>)? swPersHide(): swPersShow();}); OAT.MSG.send(OAT, 'PAGE_LOADED');});
+            });
+          ]]>
+        </script>
+        <vm:login redirect="index.vspx"/>
+        <div class="message">
+          <v:label name="pwd_msg" value="--self.msg_msg" />
+          <input type="hidden" name="dirty_force_global" id="dirty_force_global" value="<?vsp http(get_keyword ('dirty_force_global', self.vc_event.ve_params, 'false')); ?>"/>
+          <input type="hidden" name="page" value="<?V self.pg ?>"/>
+          <input type="hidden" name="tabNo" id="tabNo" value="<?V self.tabNo ?>"/>
+        </div>
+        <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
+          <tr valign='top'>
+            <td>
+              <table cellpadding='10' cellspacing='0' border='0' width='100%'>
+                <tr>
+                  <td class="tab_deck">
+                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="navtab_tabs_ctr">
+                        <v:include name="nav" url="uiedit_nav.vspx"/>
+                    </table>
+                    <table class="tab_page">
+                      <tr>
+                        <td valign="top" class="tab_page">
+                            <v:include url="uiedit_related.vspx"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </td>
+                </tr>
+              </table>
+            </td>
+          </tr>
+        </table>
+      </vm:body>
+    </vm:pagewrapper>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_buss.vspx b/appsrc/ODS-Framework/uiedit_buss.vspx
index 81480de..a2e9fb0 100644
--- a/appsrc/ODS-Framework/uiedit_buss.vspx
+++ b/appsrc/ODS-Framework/uiedit_buss.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_buss.vspx,v 1.19.2.5 2009/10/09 16:44:51 source Exp $
+ -  $Id: uiedit_buss.vspx,v 1.19.2.7 2010/09/27 14:45:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -33,10 +33,10 @@
     <br />
     <div id="b" class="c1">
       <div class="tabs">
-      <v:url name="b_url_0" value="Main" url="--sprintf('uiedit.vspx?page=2&tabNo=0')" xhtml_class="--case when self.tabNo = 0 then 'tabX activeTabX' else 'tabX' end"/>
-      <v:url name="b_url_1" value="Address" url="--sprintf('uiedit.vspx?page=2&tabNo=1')" xhtml_class="--case when self.tabNo = 1 then 'tabX activeTabX' else 'tabX' end"/>
-      <v:url name="b_url_2" value="Online Accounts" url="--sprintf('uiedit.vspx?page=2&tabNo=2')" xhtml_class="--case when self.tabNo = 2 then 'tabX activeTabX' else 'tabX' end"/>
-      <v:url name="b_url_3" value="Messaging Services" url="--sprintf('uiedit.vspx?page=2&tabNo=3')" xhtml_class="--case when self.tabNo = 3 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="b_url_0" value="Main" url="--sprintf('uiedit_bz.vspx?page=2&tabNo=0')" xhtml_class="--case when self.tabNo = 0 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="b_url_1" value="Address" url="--sprintf('uiedit_bz.vspx?page=2&tabNo=1')" xhtml_class="--case when self.tabNo = 1 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="b_url_2" value="Online Accounts" url="--sprintf('uiedit_bz.vspx?page=2&tabNo=2')" xhtml_class="--case when self.tabNo = 2 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="b_url_3" value="Messaging Services" url="--sprintf('uiedit_bz.vspx?page=2&tabNo=3')" xhtml_class="--case when self.tabNo = 3 then 'tabX activeTabX' else 'tabX' end"/>
       </div>
       <div class="contents">
       <v:template name="buss_template_0" type="simple" enabled="-- equ (self.tabNo, 0)">
diff --git a/appsrc/ODS-Framework/uiedit_buss_0.vspx b/appsrc/ODS-Framework/uiedit_buss_0.vspx
index 4bae5e9..0d1a289 100644
--- a/appsrc/ODS-Framework/uiedit_buss_0.vspx
+++ b/appsrc/ODS-Framework/uiedit_buss_0.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_buss_0.vspx,v 1.1.2.2 2009/10/09 16:44:51 source Exp $
+ -  $Id: uiedit_buss_0.vspx,v 1.1.2.4 2010/11/09 20:18:23 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -313,7 +313,7 @@
             <v:select-list name="set_business_0" value="0" xhtml_onchange='javascript: setSelectLists (this.value, this.form, "sel_")'>
               <v:item name="*no change*"  value="0" />
               <v:item name="public"  value="1" />
-              <v:item name="friends" value="2" />
+              <v:item name="acl" value="2" />
               <v:item name="private" value="3" />
             </v:select-list>
           </td>
diff --git a/appsrc/ODS-Framework/uiedit_buss_1.vspx b/appsrc/ODS-Framework/uiedit_buss_1.vspx
index 411dcc9..5d13957 100644
--- a/appsrc/ODS-Framework/uiedit_buss_1.vspx
+++ b/appsrc/ODS-Framework/uiedit_buss_1.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_buss_1.vspx,v 1.2.2.5 2010/03/12 09:10:13 source Exp $
+ -  $Id: uiedit_buss_1.vspx,v 1.2.2.8 2011/01/25 14:11:28 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -278,7 +278,7 @@
                   control.ufl_selected := self.blatlng_def;
               </v:after-data-bind>
             </v:check-box>
-            <label for="set_blatlng_def">Default map location</label>
+            <label for="set_blatlng_def">Use as default map location</label>
           </td>
         </tr>
         <tr>
@@ -308,7 +308,7 @@
             <v:select-list name="set_business_1" value="0" xhtml_onchange='javascript: setSelectLists (this.value, this.form, "sel_")'>
               <v:item name="*no change*"  value="0" />
               <v:item name="public"  value="1" />
-              <v:item name="friends" value="2" />
+              <v:item name="acl" value="2" />
               <v:item name="private" value="3" />
             </v:select-list>
           </td>
diff --git a/appsrc/ODS-Framework/uiedit_buss_2.vspx b/appsrc/ODS-Framework/uiedit_buss_2.vspx
index 6de80bc..6fc5046 100644
--- a/appsrc/ODS-Framework/uiedit_buss_2.vspx
+++ b/appsrc/ODS-Framework/uiedit_buss_2.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_buss_2.vspx,v 1.1.2.6 2010/03/18 10:17:26 source Exp $
+ -  $Id: uiedit_buss_2.vspx,v 1.1.2.11 2010/09/21 11:46:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -53,7 +53,8 @@
           {
 			      update WA_USER_OL_ACCOUNTS
 			         set WUO_NAME = trim (params [N+1]),
-			             WUO_URL = trim (get_keyword ('y1_fld_2_'||suffix, params, ''))
+			             WUO_URL = trim (get_keyword ('y1_fld_2_'||suffix, params, '')),
+			             WUO_URI = trim (get_keyword ('y1_fld_3_'||suffix, params, ''))
 			       where WUO_ID = id;
             IDx := vector_concat (IDx, vector (id));
           }
@@ -77,8 +78,8 @@
           id := cast (get_keyword ('y1_fld_0_'||suffix, params, '-1') as integer);
           if ((id = -1) and (trim (get_keyword ('y1_fld_2_'||suffix, params, '')) <> ''))
           {
-			      insert into WA_USER_OL_ACCOUNTS ( WUO_NAME, WUO_URL, WUO_U_ID, WUO_TYPE)
-		          values (trim (params [N+1]), trim (get_keyword ('y1_fld_2_'||suffix, params, '')), self.u_id, 'B');
+			      insert into WA_USER_OL_ACCOUNTS ( WUO_NAME, WUO_URL, WUO_URI, WUO_U_ID, WUO_TYPE)
+		          values (trim (params [N+1]), trim (get_keyword ('y1_fld_2_'||suffix, params, '')), trim (get_keyword ('y1_fld_3_'||suffix, params, '')), self.u_id, 'B');
           }
         }
       }
@@ -92,15 +93,18 @@
     <div>
       <table class="ctl_grp">
         <tr>
-          <td width="600px">
+          <td width="800px">
             <table id="y1_tbl" class="listing">
                 <tr class="listing_header_row">
-                  <th>
-                    Select from Service List ot Type New One
+                <th width="30%">
+                  Select from Service List or Type New One
                   </th>
-                  <th>
-                    Member Home Page URL
+                <th width="30%">
+                  Member Home Page URI
                   </th>
+                <th width="30%">
+                  Account URI
+                </th>
                 <th width="65px">
                     Action
                   </th>
@@ -108,9 +112,9 @@
             		  <![CDATA[
             		    <script type="text/javascript">
             		    <?vsp
-                  for (select WUO_ID, WUO_NAME, WUO_URL from WA_USER_OL_ACCOUNTS where WUO_TYPE = 'B' and WUO_U_ID = self.u_id) do
+                  for (select WUO_ID, WUO_NAME, WUO_URL, WUO_URI from WA_USER_OL_ACCOUNTS where WUO_TYPE = 'B' and WUO_U_ID = self.u_id) do
                   {
-                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("y1", null, {id: "%d", fld_1: {mode: 10, value: "%s"}, fld_2: {value: "%s", className: "_validate_ _url_ _canEmpty_"}});});', WUO_ID, WUO_NAME, WUO_URL));
+                    http (sprintf ('ODSInitArray.push(function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("y1", null, {id: "%d", fld_1: {mode: 10, value: "%s"}, fld_2: {value: "%s", className: "_validate_ _uri_ _canEmpty_"}, fld_3: {value: "%s"}});});});', WUO_ID, WUO_NAME, WUO_URL, WUO_URI));
                   }
             		    ?>
             		    </script>
@@ -119,7 +123,7 @@
             </table>
           </td>
           <td valign="top" nowrap="1">
-            <span class="button pointer" onclick="TBL.createRow('y1', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+            <span class="button pointer" onclick="TBL.createRow('y1', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _uri_ _canEmpty_'}, fld_3: {}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
           </td>
         </tr>
       </table>
diff --git a/appsrc/ODS-Framework/uiedit_buss_3.vspx b/appsrc/ODS-Framework/uiedit_buss_3.vspx
index 674cdfc..dfd12ac 100644
--- a/appsrc/ODS-Framework/uiedit_buss_3.vspx
+++ b/appsrc/ODS-Framework/uiedit_buss_3.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_buss_3.vspx,v 1.1.2.4 2010/03/18 10:17:26 source Exp $
+ -  $Id: uiedit_buss_3.vspx,v 1.1.2.7 2010/11/09 20:18:23 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -188,7 +188,7 @@
         <?vsp
           for (select m_label, m_id from DB.DBA.WA_USER_INTERESTS (txt) (m_label varchar, m_id varchar) P where txt = self.bmessaging) do
           {
-              http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("y2", null, {fld_1: {value: "%s"}, fld_2: {value: "%s", cssText: "width: 216px;"}});});', m_label, m_id));
+              http (sprintf ('ODSInitArray.push(function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("y2", null, {fld_1: {value: "%s"}, fld_2: {value: "%s", cssText: "width: 216px;"}});});});', m_label, m_id));
           }
         ?>
    		    </script>
@@ -201,7 +201,7 @@
             <v:select-list name="set_business_3" value="0" xhtml_onchange='javascript: setSelectLists (this.value, this.form, "sel_")'>
               <v:item name="*no change*"  value="0" />
               <v:item name="public"  value="1" />
-              <v:item name="friends" value="2" />
+              <v:item name="acl" value="2" />
               <v:item name="private" value="3" />
             </v:select-list>
           </td>
diff --git a/appsrc/ODS-Framework/uiedit_bz.vspx b/appsrc/ODS-Framework/uiedit_bz.vspx
new file mode 100644
index 0000000..ae8c87a
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_bz.vspx
@@ -0,0 +1,170 @@
+<?xml version="1.0"?>
+<!--
+ -
+ -  $Id: uiedit_bz.vspx,v 1.1.4.2 2010/09/27 14:45:40 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="ui_profile"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+	      style="index.xsl"
+	      fast-render="1"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+  <v:method name="addProperty" arglist="in obj any, in objProperty varchar, in paramsProperty varchar, in params any">
+    <![CDATA[
+      declare tmp ay;
+
+      tmp := trim (get_keyword (paramsProperty, params));
+      if (not is_empty_or_null (tmp))
+        obj := vector_concat (obj, vector (objProperty, tmp));
+      return obj;
+    ]]>
+  </v:method>
+
+  <v:method name="jsonObject" arglist="">
+    <![CDATA[
+      return subseq (soap_box_structure ('x', 1), 0, 2);
+    ]]>
+  </v:method>
+
+  <v:method name="checkBox" arglist="in checkField varchar, inout properties any">
+    <![CDATA[
+      declare S varchar;
+
+      S := '';
+      if (get_keyword (checkField, properties, '0') <> '0')
+        S := 'checked="checked"';
+      http (sprintf ('<input type="checkbox" name="%s" id="%s" value="1" %s />', checkField, checkField, S));
+    ]]>
+  </v:method>
+
+  <vm:page>
+    <vm:header>
+      <script type="text/javascript" src="tbl.js">;</script>
+      <script type="text/javascript" src="typeahead.js">;</script>
+      <link rel="stylesheet" href="typeahead.css" type="text/css" />
+      <vm:title>Edit your personal data</vm:title>
+    </vm:header>
+    <vm:pagewrapper vm_onunload="checkPageLeave (document.forms['page_form'])">
+      <v:variable persist="temp" name="msg_msg" type="varchar" default="''"/>
+      <v:variable name="tabNo" type="integer" param-name="tabNo" default="0"/>
+      <v:variable name="pg" type="integer" param-name="page" default="1"/>
+      <v:variable name="is_org" type="integer" default="0" />
+      <vm:rawheader caption="Edit your personal data"/>
+      <vm:navigation-new on="settings"/>
+      <vm:subnavigation-new on="site"/>
+      <vm:body>
+        <v:before-data-bind>
+          <![CDATA[
+            self.is_org := coalesce ((select WAUI_IS_ORG from WA_USER_INFO where WAUI_U_ID = self.u_id), 0);
+          ]]>
+        </v:before-data-bind>
+        <script type="text/javascript">
+          <![CDATA[
+            function getFileName(form, from, to)
+            {
+              var S = from.value;
+              var N;
+              var fname;
+              if (S.lastIndexOf('\\') > 0)
+                N = S.lastIndexOf('\\')+1;
+              else
+                N = S.lastIndexOf('/')+1;
+              fname = S.substr(N,S.length);
+              to.value = fname;
+            }
+            function swPersHide ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Organization Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.hide('pers_'+i);
+              OAT.Dom.hide('p_url_2');
+            }
+            function swPersShow ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Personal Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.show('pers_'+i);
+              OAT.Dom.show('p_url_2');
+            }
+            function swOrg (cb)
+            {
+              (cb.checked)? swPersHide(): swPersShow();
+            }
+            function checkRest (form, sel)
+            {
+              var i;
+              if (sel.selectedIndex == 0)
+                return;
+              for (i = 0; i < form.elements.length; i++)
+              {
+                var contr = form.elements[i];
+                if (contr != null && contr != sel && contr.type == "select-one")
+                {
+                  if (contr.selectedIndex == sel.selectedIndex)
+                    contr.selectedIndex = 0;
+                }
+              }
+            }
+            ODSInitArray.push ( function () {
+              OAT.Loader.load(["json", "ws", "calendar", "combolist"], function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){(<?V self.is_org ?>)? swPersHide(): swPersShow();}); OAT.MSG.send(OAT, 'PAGE_LOADED');});
+            });
+          ]]>
+        </script>
+        <vm:login redirect="index.vspx"/>
+        <div class="message">
+          <v:label name="pwd_msg" value="--self.msg_msg" />
+          <input type="hidden" name="dirty_force_global" id="dirty_force_global" value="<?vsp http(get_keyword ('dirty_force_global', self.vc_event.ve_params, 'false')); ?>"/>
+          <input type="hidden" name="page" value="<?V self.pg ?>"/>
+          <input type="hidden" name="tabNo" id="tabNo" value="<?V self.tabNo ?>"/>
+        </div>
+        <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
+          <tr valign='top'>
+            <td>
+              <table cellpadding='10' cellspacing='0' border='0' width='100%'>
+                <tr>
+                  <td class="tab_deck">
+                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="navtab_tabs_ctr">
+                        <v:include name="nav" url="uiedit_nav.vspx"/>
+                    </table>
+                    <table class="tab_page">
+                      <tr>
+                        <td valign="top" class="tab_page">
+                            <v:include url="uiedit_buss.vspx"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </td>
+                </tr>
+              </table>
+            </td>
+          </tr>
+        </table>
+      </vm:body>
+    </vm:pagewrapper>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_groups.vspx b/appsrc/ODS-Framework/uiedit_groups.vspx
new file mode 100644
index 0000000..b58c32b
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_groups.vspx
@@ -0,0 +1,617 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: uiedit_groups.vspx,v 1.1.4.7 2011/03/08 13:28:17 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2010 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="wa-groups"
+        fast-render="1"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        style="index.xsl"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+  <v:variable name="fg_mode" type="varchar" default="'browse'"/>
+
+  <v:variable name="fg_id" type="integer" default="null"/>
+  <v:variable name="fg_name" param-name="name" type="varchar" default="''"/>
+  <v:variable name="fg_description" type="varchar" default="''"/>
+  <v:variable name="fg_members" type="any" default="null"/>
+
+  <h3>User Groups Addministration</h3>
+  <vm:if test="self.fg_mode = 'browse'">
+    <fieldset>
+      <legend><b>ODS groups</b></legend>
+  	<v:data-source name="fgrc" expression-type="sql" nrows="0" initial-offset="10">
+      <v:before-data-bind>
+        <![CDATA[
+            control.ds_sql := sprintf('select b.WAG_ID, a.U_NAME, a.U_FULL_NAME from DB.DBA.SYS_USERS a, DB.DBA.WA_GROUPS b where a.U_ID=b.WAG_GROUP_ID and a.U_IS_ROLE=1 and b.WAG_USER_ID=\'%d\' order by U_NAME', self.u_id);
+        ]]>
+      </v:before-data-bind>
+    </v:data-source>
+    <v:data-set name="fg" data-source="self.fgrc" scrollable="1">
+      <div style="padding: 0 0 0.5em 0;">
+        <v:button name="fgCreate" action="simple" style="url" value="''" xhtml_class="img_button">
+          <v:before-render>
+            <![CDATA[
+              control.ufl_value := '<img src="images/icons/add_16.png" border="0" /> Add';
+            ]]>
+          </v:before-render>
+          <v:on-post>
+            <![CDATA[
+                self.fg_name := '';
+                self.fg_description := '';
+                self.fg_members := vector ();
+                self.fg_mode := 'fgCreate';
+
+     		      self.vc_data_bind(e);
+            ]]>
+          </v:on-post>
+        </v:button>
+      </div>
+      <v:template name="fg_header" type="simple" name-to-remove="table" set-to-remove="bottom">
+        <table id="groups" class="listing" cellspacing="0">
+          <tr class="listing_header_row">
+              <th>Name</th>
+              <th>Description</th>
+              <th width="1%">Actions</th>
+          </tr>
+        </table>
+      </v:template>
+
+      <v:template name="fg_repeat" type="repeat" name-to-remove="" set-to-remove="">
+
+        <v:template name="fg_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
+          <table>
+            <tr align="center">
+                <td colspan="3">No own regular groups</td>
+            </tr>
+          </table>
+        </v:template>
+
+        <v:template name="fg_browse" type="browse" name-to-remove="table" set-to-remove="both">
+          <table>
+              <tr>
+                <td nowrap="nowrap">
+                  <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('U_NAME')" format="%s"/>
+                </td>
+                <td nowrap="nowrap">
+                  <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('U_FULL_NAME')" format="%s"/>
+                </td>
+                <td nowrap="nowrap">
+                  <v:button name="fgEdit" action="simple" style="url" value="''" xhtml_class="img_button">
+                    <v:before-render>
+                      <![CDATA[
+                        control.ufl_value := '<img src="/ods/images/icons/edit_16.png" border="0" /> Edit';
+                      ]]>
+                    </v:before-render>
+                    <v:on-post>
+                      <![CDATA[
+                        self.fg_id := (control.vc_parent as vspx_row_template).te_column_value('WAG_ID');
+                        select a.U_NAME,
+                               a.U_FULL_NAME
+                          into self.fg_name,
+                               self.fg_description
+                          from DB.DBA.SYS_USERS a,
+                               DB.DBA.WA_GROUPS b
+                         where a.U_IS_ROLE   = 1
+                           and a.U_ID      = b.WAG_GROUP_ID
+                           and b.WAG_ID      = self.fg_id;
+
+                        self.fg_members := vector ();
+                        for (select b.U_NAME
+                               from DB.DBA.SYS_ROLE_GRANTS a,
+                                    DB.DBA.SYS_USERS b,
+                                    DB.DBA.SYS_USERS c
+                              where a.GI_SUPER = b.U_ID
+                                and a.GI_GRANT = c.U_ID
+                                and a.GI_DIRECT = '1'
+                                and c.U_NAME = self.fg_name) do
+                        {
+                          self.fg_members := vector_concat (self.fg_members, vector (U_NAME));
+                        }
+                        self.fg_mode := 'fgUpdate';
+
+              		      self.vc_data_bind(e);
+                      ]]>
+                    </v:on-post>
+                  </v:button>
+                  <v:button name="fgDelete" action="simple" style="url" value="''" xhtml_class="img_button">
+                    <v:before-render>
+                      <![CDATA[
+                        control.ufl_value := '<img src="/ods/images/icons/trash_16.png" border="0" /> Delete';
+                      ]]>
+                    </v:before-render>
+                    <v:on-post>
+                      <![CDATA[
+                        self.fg_id := (control.vc_parent as vspx_row_template).te_column_value('WAG_ID');
+                        delete from DB.DBA.SYS_USERS where U_ID in (select WAG_GROUP_ID from DB.DBA.WA_GROUPS where WAG_ID = self.fg_id);
+                        delete from DB.DBA.WA_GROUPS where WAG_ID = self.fg_id;
+
+              		      self.vc_data_bind(e);
+                      ]]>
+                    </v:on-post>
+                  </v:button>
+                </td>
+              </tr>
+            </table>
+          </v:template>
+
+        </v:template>
+
+        <v:template name="fg_navigation" type="simple" name-to-remove="table" set-to-remove="top">
+          <table>
+            <tr align="center">
+              <td colspan="3">
+                <vm:ds-navigation data-set="fg"/>
+              </td>
+            </tr>
+          </table>
+        </v:template>
+      </v:data-set>
+    </fieldset>
+
+    <fieldset>
+      <legend><b>WebID groups</b></legend>
+    	<v:data-source name="fg2rc" expression-type="sql" nrows="0" initial-offset="10">
+        <v:before-data-bind>
+          <![CDATA[
+            control.ds_sql := sprintf('select WACL_ID, WACL_NAME, WACL_DESCRIPTION from WA_GROUPS_ACL where WACL_USER_ID=%d order by WACL_NAME', self.u_id);
+          ]]>
+        </v:before-data-bind>
+      </v:data-source>
+      <v:data-set name="fg2" data-source="self.fg2rc" scrollable="1">
+        <div style="padding: 0 0 0.5em 0;">
+          <v:button name="fg2Create" action="simple" style="url" value="''" xhtml_class="img_button">
+            <v:before-render>
+              <![CDATA[
+                control.ufl_value := '<img src="images/icons/add_16.png" border="0" /> Add';
+              ]]>
+            </v:before-render>
+            <v:on-post>
+              <![CDATA[
+                self.fg_name := '';
+                self.fg_description := '';
+                self.fg_members := null;
+                self.fg_mode := 'fg2Create';
+
+       		      self.vc_data_bind(e);
+              ]]>
+            </v:on-post>
+          </v:button>
+        </div>
+        <v:template name="fg2_header" type="simple" name-to-remove="table" set-to-remove="bottom">
+          <table id="groups" class="listing" cellspacing="0">
+            <tr class="listing_header_row">
+              <th>Name</th>
+              <th>IRI</th>
+              <th width="1%">Actions</th>
+            </tr>
+          </table>
+        </v:template>
+
+        <v:template name="fg2_repeat" type="repeat" name-to-remove="" set-to-remove="">
+
+          <v:template name="fg2_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
+            <table>
+              <tr align="center">
+                <td colspan="3">No ACL groups</td>
+              </tr>
+            </table>
+          </v:template>
+
+          <v:template name="fg2_browse" type="browse" name-to-remove="table" set-to-remove="both">
+            <table>
+            <tr class="<?V case when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
+              <td nowrap="nowrap">
+                <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WACL_NAME')" format="%s"/>
+              </td>
+              <td nowrap="nowrap">
+                <v:label value="--SIOC..acl_group_iri (self.u_id, (control.vc_parent as vspx_row_template).te_column_value('WACL_NAME'))" format="%s"/>
+              </td>
+              <td nowrap="nowrap">
+                  <v:button name="fg2Edit" action="simple" style="url" value="''" xhtml_class="img_button">
+                  <v:before-render>
+                    <![CDATA[
+                      control.ufl_value := '<img src="/ods/images/icons/edit_16.png" border="0" /> Edit';
+                    ]]>
+                  </v:before-render>
+                  <v:on-post>
+                    <![CDATA[
+                        self.fg_id := (control.vc_parent as vspx_row_template).te_column_value('WACL_ID');
+                      select WACL_NAME,
+                             WACL_DESCRIPTION,
+                             WACL_WEBIDS
+                          into self.fg_name,
+                               self.fg_description,
+                               self.fg_members
+                        from WA_GROUPS_ACL
+                         where WACL_ID = self.fg_id;
+
+                        self.fg_mode := 'fg2Update';
+            		      self.vc_data_bind(e);
+                    ]]>
+                  </v:on-post>
+                </v:button>
+                  <v:button name="fg2Delete" action="simple" style="url" value="''" xhtml_class="img_button">
+                  <v:before-render>
+                    <![CDATA[
+                      control.ufl_value := '<img src="/ods/images/icons/trash_16.png" border="0" /> Delete';
+                    ]]>
+                  </v:before-render>
+                  <v:on-post>
+                    <![CDATA[
+                        self.fg_id := (control.vc_parent as vspx_row_template).te_column_value('WACL_ID');
+                        delete from DB.DBA.WA_GROUPS_ACL where WACL_ID = self.fg_id;
+
+            		      self.vc_data_bind(e);
+                    ]]>
+                  </v:on-post>
+                </v:button>
+              </td>
+            </tr>
+          </table>
+        </v:template>
+
+      </v:template>
+
+      <v:template type="simple" name-to-remove="table" set-to-remove="top">
+        <table>
+          <tr align="center">
+            <td colspan="3">
+                <vm:ds-navigation data-set="fg2"/>
+            </td>
+          </tr>
+        </table>
+      </v:template>
+
+    </v:data-set>
+    </fieldset>
+  </vm:if>
+
+  <vm:if test="self.fg_mode in ('fgCreate', 'fgUpdate')">
+    <h4><v:label format="%s" value="--concat(initcap(subseq(self.fg_mode, 2)), ' ODS Group')"/></h4>
+    <div id="fg_page" class="tabContent">
+      <ul id="fg_tabs" class="tabs">
+        <li id="fg_tab_0"><b>Main</b></li>
+        <li id="fg_tab_1"><b>Users</b></li>
+      </ul>
+      <div style="background-color: #fff; min-height: 150px; min-width: 650px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+        <div id="fg_content">
+        </div>
+        <div id="fg_page_0" class="tabContent">
+          <table class="form-body" cellspacing="0">
+            <tr>
+              <th>
+                <v:label for="fgName" value="Group name"/>
+              </th>
+              <td>
+                <v:text name="fgName" value="--self.fg_name" type="--either(equ(self.fg_mode, 'fgCreate'), 'plain', 'hidden')" xhtml_size="40" />
+                <vm:if test="self.fg_mode = 'fgUpdate'">
+                  <span class="text"><v:label value="--self.fg_name"/></span>
+                </vm:if>
+              </td>
+            </tr>
+            <tr>
+              <th>
+                <v:label for="fgDescription" value="Group description"/>
+              </th>
+              <td>
+                <v:text name="fgDescription" value="--self.fg_description" xhtml_size="80" />
+              </td>
+            </tr>
+          </table>
+        </div>
+
+        <div id="fg_page_1" class="tabContent">
+          <table>
+            <tr>
+              <td width="800px">
+                <table id="x_tbl" class="listing" cellspacing="0">
+                  <tr class="listing_header_row">
+                    <th>
+                      Name
+                    </th>
+                    <th width="1%">
+                      Action
+                    </th>
+                  </tr>
+            		  <![CDATA[
+            		    <script type="text/javascript">
+                    <?vsp
+            		      declare N varchar;
+
+                      for (N := 0; N < length (self.fg_members); N := N + 1)
+                      {
+                        http (sprintf ('ODSInitArray.push(function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x", null, {fld_1: {mode: 1, value: "%s"}});});});', self.fg_members[N]));
+                      }
+                    ?>
+            		    </script>
+            		  ]]>
+                  <tr id="x_tr_no"><td colspan="2"><b>No Members</b></td></tr>
+                </table>
+              </td>
+              <td valign="top" nowrap="nowrap">
+                <span class="button pointer" onclick="javascript: TBL.createRow('x', null, {fld_1: {mode: 1}});"><img src="/ods/images/icons/add_16.png" class="button" border="0" alt="Add Security" title="Add Security" /> Add</span>
+              </td>
+            </tr>
+          </table>
+        </div>
+      </div>
+      <script>
+        <![CDATA[
+          function createFGTabs() {
+            var fgTab = new OAT.Tab("fg_content");
+            fgTab.add("fg_tab_0", "fg_page_0");
+            fgTab.add("fg_tab_1", "fg_page_1");
+            fgTab.go(0);
+          }
+          ODSInitArray.push(function(){OAT.Loader.load(["tab"], function(){createFGTabs();});});
+        ]]>
+      </script>
+    </div>
+
+    <div class="new-form-footer">
+      <v:button name="fgSave" action="simple" value="--initcap (subseq (self.fg_mode, 2))" xhtml_class="form-button" xhtml_onclick="return validateInputs(this);">
+        <v:on-post>
+          <![CDATA[
+            declare N integer;
+            declare uid, gid integer;
+            declare params any;
+            declare exit handler for SQLSTATE '*'
+            {
+              if (__SQL_STATE = 'TEST')
+              {
+                self.vc_error_message := wa_clear(__SQL_MESSAGE);
+                self.vc_is_valid := 0;
+                return;
+              }
+              resignal;
+            };
+
+            params := self.vc_page.vc_event.ve_params;
+            self.fg_name := trim (self.fgName.ufl_value);
+            self.fg_description := trim (self.fgDescription.ufl_value);
+            self.fg_members := vector();
+            for (N := 0; N < length (params); N := N + 2)
+            {
+              if ((params [N] like 'x_fld_1_%') and (trim (params [N+1]) <> ''))
+              {
+                self.fg_members := vector_concat (self.fg_members, split_and_decode (trim (trim (params [N+1]), ','), 0, '\0\0,'));
+              }
+            }
+
+            self.fg_name := wa_validate (self.fg_name, vector('name', 'Group name', 'class', 'varchar', 'minLength', 1, 'maxLength', 128));
+            self.fg_description := wa_validate (self.fg_description, vector('name', 'Group description', 'class', 'varchar', 'minLength', 0, 'maxLength', 255));
+
+            uid := self.u_id;
+            gid := (select a.U_ID
+                      from DB.DBA.SYS_USERS a,
+                           DB.DBA.WA_GROUPS b
+                     where a.U_ID = b.WAG_GROUP_ID
+                       and a.U_NAME = self.fg_name
+                       and a.U_IS_ROLE = 1
+                       and b.WAG_USER_ID <> uid);
+            if (not isnull(gid))
+              signal('TEST', 'Group already exists for another user. Please choose another name!<>');
+
+            gid := (select U_ID from DB.DBA.SYS_USERS where U_NAME = self.fg_name);
+            if (self.fg_mode = 'fgCreate')
+            {
+              if (not isnull(gid))
+                signal('TEST', 'Group already exists. Please choose another name!<>');
+
+              gid := USER_ROLE_CREATE(self.fg_name);
+              -- make owner
+              insert soft DB.DBA.WA_GROUPS (WAG_USER_ID, WAG_GROUP_ID) values(uid, gid);
+            }
+            update DB.DBA.SYS_USERS set U_FULL_NAME = self.fg_description, U_DAV_ENABLE = 1 where U_NAME = self.fg_name;
+
+            -- delete members
+            for (select b.U_NAME
+                   from DB.DBA.SYS_ROLE_GRANTS a, DB.DBA.SYS_USERS b, DB.DBA.SYS_USERS c
+                  where a.GI_SUPER = b.U_ID and a.GI_GRANT = c.U_ID and c.U_NAME = self.fg_name and a.GI_DIRECT = '1') do
+            {
+              if (not ODRIVE.WA.vector_contains (self.fg_members, U_NAME))
+              {
+                declare continue handler for sqlstate '*' { goto _delete;};
+                USER_REVOKE_ROLE (U_NAME, self.fg_name);
+              _delete:;
+              }
+            }
+
+            -- add members
+            for (N := 0; N < length(self.fg_members); N := N + 1)
+            {
+              declare continue handler for sqlstate '*' { goto _add;};
+              USER_GRANT_ROLE (self.fg_members[N], self.fg_name);
+            _add:;
+            }
+
+            self.fg_mode := 'browse';
+     		    self.vc_data_bind(e);
+          ]]>
+        </v:on-post>
+      </v:button>
+      <v:button  name="fgCancel" action="simple" value="Cancel" xhtml_class="form-button">
+        <v:on-post>
+          <![CDATA[
+            self.fg_mode := 'browse';
+     		    self.vc_data_bind(e);
+          ]]>
+        </v:on-post>
+      </v:button>
+    </div>
+  </vm:if>
+
+  <vm:if test="self.fg_mode in ('fg2Create', 'fg2Update')">
+    <h4><v:label format="%s" value="--concat(initcap(subseq(self.fg_mode, 3)), ' ACL Group')"/></h4>
+    <div id="fg2_page" class="tabContent">
+      <ul id="fg2_tabs" class="tabs">
+        <li id="fg2_tab_0"><b>Main</b></li>
+        <li id="fg2_tab_1"><b>WebIDs</b></li>
+      </ul>
+      <div style="background-color: #fff; min-height: 150px; min-width: 650px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+        <div id="fg2_content">
+        </div>
+        <div id="fg2_page_0" class="tabContent">
+          <table class="ctl_grp" cellspacing="0">
+            <tr>
+              <th>
+                <v:label for="fg2Name" value="Group name"/>
+              </th>
+              <td>
+                <v:text name="fg2Name" value="--self.fg_name" xhtml_size="40" />
+              </td>
+            </tr>
+            <tr>
+              <th>
+                <v:label for="fg2Description" value="Group description"/>
+              </th>
+              <td>
+                <v:text name="fg2Description" value="--self.fg_description" xhtml_size="80" />
+              </td>
+            </tr>
+          </table>
+        </div>
+
+        <div id="fg2_page_1" class="tabContent" style="display: none;">
+          <table>
+            <tr>
+              <td width="800px">
+                <table id="x_tbl" class="listing" cellspacing="0">
+                  <tr class="listing_header_row">
+                    <th>
+                      Personal WebID
+                    </th>
+                    <th width="1%">
+                      Action
+                    </th>
+                  </tr>
+            		  <![CDATA[
+            		    <script type="text/javascript">
+                    <?vsp
+            		      declare N varchar;
+
+         		          self.fg_members := split_and_decode (self.fg_members, 0, '\0\0\n');
+                      if ((self.fg_mode = 'fg2Create') and (length(self.fg_members) = 0))
+         		            self.fg_members := vector (SIOC..person_iri (SIOC..user_iri (self.u_id)));
+
+                      for (N := 0; N < length (self.fg_members); N := N + 1)
+                      {
+                        if (length (self.fg_members[N]))
+                          http (sprintf ('ODSInitArray.push(function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x", null, {fld_1: {mode: 54, className: "_validate_ _uri_", value: "%s"}});});});', self.fg_members[N]));
+                      }
+                    ?>
+            		    </script>
+            		  ]]>
+                  <tr id="x_tr_no"><td colspan="2"><b>No Personal WebIDs</b></td></tr>
+                </table>
+              </td>
+              <td valign="top" nowrap="nowrap">
+                <span class="button pointer" onclick="javascript: TBL.createRow('x', null, {fld_1: {mode: 54, className: '_validate_ _uri_'}});"><img src="/ods/images/icons/add_16.png" border="0" class="button" alt="Add Security" title="Add Security" /> Add</span>
+              </td>
+            </tr>
+          </table>
+        </div>
+      </div>
+      <script>
+        <![CDATA[
+          function createFG2Tabs() {
+            var fg2Tab = new OAT.Tab("fg2_content");
+            fg2Tab.add("fg2_tab_0", "fg2_page_0");
+            fg2Tab.add("fg2_tab_1", "fg2_page_1");
+            fg2Tab.go(0);
+          }
+          ODSInitArray.push(function(){OAT.Loader.load(["tab"], function(){createFG2Tabs();});});
+        ]]>
+      </script>
+
+      <div class="new-form-footer">
+        <v:button name="fg2Cancel" action="simple" value="Cancel" xhtml_class="form-button">
+          <v:on-post>
+            <![CDATA[
+              self.fg_mode := 'browse';
+       		    self.vc_data_bind(e);
+            ]]>
+          </v:on-post>
+        </v:button>
+        <v:button name="fg2Save" action="simple" value="--initcap (subseq (self.fg_mode, 3))" xhtml_class="form-button" xhtml_onclick="return validateInputs(this);">
+          <v:on-post>
+            <![CDATA[
+              declare N integer;
+              declare params any;
+              declare exit handler for SQLSTATE '*'
+              {
+                if (__SQL_STATE = 'TEST')
+                {
+                  self.vc_error_message := wa_clear(__SQL_MESSAGE);
+                  self.vc_is_valid := 0;
+                  return;
+                }
+                resignal;
+              };
+
+              params := self.vc_page.vc_event.ve_params;
+              self.fg_name := trim (self.fg2Name.ufl_value);
+              self.fg_description := trim (self.fg2Description.ufl_value);
+
+              self.fg_name := wa_validate (self.fg_name, vector('name', 'Group name', 'class', 'varchar', 'minLength', 1, 'maxLength', 128));
+              self.fg_description := wa_validate (self.fg_description, vector('name', 'Group description', 'class', 'varchar', 'minLength', 0, 'maxLength', 255));
+              if (exists (select 1 from WA_GROUPS_ACL where WACL_ID <> self.fg_id and WACL_USER_ID = self.u_id and WACL_NAME = self.fg_name))
+              {
+                self.vc_error_message := 'Dublicate group name';
+                self.vc_is_valid := 0;
+                return;
+              }
+
+              self.fg_members := '';
+              for (N := 0; N < length (params); N := N + 2)
+              {
+                if ((params [N] like 'x_fld_1_%') and (trim (params [N+1]) <> ''))
+                {
+                  self.fg_members := self.fg_members || trim (params [N+1]) || '\n';
+                }
+              }
+              if (self.fg_mode = 'fg2Create')
+              {
+                insert into WA_GROUPS_ACL (WACL_USER_ID, WACL_NAME, WACL_DESCRIPTION,  WACL_WEBIDS)
+                  values (self.u_id, self.fg_name, self.fg_description, self.fg_members);
+              } else {
+                update WA_GROUPS_ACL
+                   set WACL_NAME = self.fg_name,
+                       WACL_DESCRIPTION = self.fg_description,
+                       WACL_WEBIDS = self.fg_members
+                 where WACL_ID = self.fg_id
+                   and WACL_USER_ID = self.u_id;
+              }
+
+              self.fg_mode := 'browse';
+       		    self.vc_data_bind(e);
+            ]]>
+          </v:on-post>
+        </v:button>
+      </div>
+    </div>
+  </vm:if>
+
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_grp.vspx b/appsrc/ODS-Framework/uiedit_grp.vspx
new file mode 100644
index 0000000..a28484b
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_grp.vspx
@@ -0,0 +1,170 @@
+<?xml version="1.0"?>
+<!--
+ -
+ -  $Id: uiedit_grp.vspx,v 1.1.4.2 2010/09/27 14:45:40 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="ui_profile"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+	      style="index.xsl"
+	      fast-render="1"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+  <v:method name="addProperty" arglist="in obj any, in objProperty varchar, in paramsProperty varchar, in params any">
+    <![CDATA[
+      declare tmp ay;
+
+      tmp := trim (get_keyword (paramsProperty, params));
+      if (not is_empty_or_null (tmp))
+        obj := vector_concat (obj, vector (objProperty, tmp));
+      return obj;
+    ]]>
+  </v:method>
+
+  <v:method name="jsonObject" arglist="">
+    <![CDATA[
+      return subseq (soap_box_structure ('x', 1), 0, 2);
+    ]]>
+  </v:method>
+
+  <v:method name="checkBox" arglist="in checkField varchar, inout properties any">
+    <![CDATA[
+      declare S varchar;
+
+      S := '';
+      if (get_keyword (checkField, properties, '0') <> '0')
+        S := 'checked="checked"';
+      http (sprintf ('<input type="checkbox" name="%s" id="%s" value="1" %s />', checkField, checkField, S));
+    ]]>
+  </v:method>
+
+  <vm:page>
+    <vm:header>
+      <script type="text/javascript" src="tbl.js">;</script>
+      <script type="text/javascript" src="typeahead.js">;</script>
+      <link rel="stylesheet" href="typeahead.css" type="text/css" />
+      <vm:title>Edit your personal data</vm:title>
+    </vm:header>
+    <vm:pagewrapper vm_onunload="checkPageLeave (document.forms['page_form'])">
+      <v:variable persist="temp" name="msg_msg" type="varchar" default="''"/>
+      <v:variable name="tabNo" type="integer" param-name="tabNo" default="0"/>
+      <v:variable name="pg" type="integer" param-name="page" default="1"/>
+      <v:variable name="is_org" type="integer" default="0" />
+      <vm:rawheader caption="Edit your personal data"/>
+      <vm:navigation-new on="settings"/>
+      <vm:subnavigation-new on="site"/>
+      <vm:body>
+        <v:before-data-bind>
+          <![CDATA[
+            self.is_org := coalesce ((select WAUI_IS_ORG from WA_USER_INFO where WAUI_U_ID = self.u_id), 0);
+          ]]>
+        </v:before-data-bind>
+        <script type="text/javascript">
+          <![CDATA[
+            function getFileName(form, from, to)
+            {
+              var S = from.value;
+              var N;
+              var fname;
+              if (S.lastIndexOf('\\') > 0)
+                N = S.lastIndexOf('\\')+1;
+              else
+                N = S.lastIndexOf('/')+1;
+              fname = S.substr(N,S.length);
+              to.value = fname;
+            }
+            function swPersHide ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Organization Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.hide('pers_'+i);
+              OAT.Dom.hide('p_url_2');
+            }
+            function swPersShow ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Personal Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.show('pers_'+i);
+              OAT.Dom.show('p_url_2');
+            }
+            function swOrg (cb)
+            {
+              (cb.checked)? swPersHide(): swPersShow();
+            }
+            function checkRest (form, sel)
+            {
+              var i;
+              if (sel.selectedIndex == 0)
+                return;
+              for (i = 0; i < form.elements.length; i++)
+              {
+                var contr = form.elements[i];
+                if (contr != null && contr != sel && contr.type == "select-one")
+                {
+                  if (contr.selectedIndex == sel.selectedIndex)
+                    contr.selectedIndex = 0;
+                }
+              }
+            }
+            ODSInitArray.push ( function () {
+              OAT.Loader.load(["json", "ws", "calendar", "combolist"], function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){(<?V self.is_org ?>)? swPersHide(): swPersShow();}); OAT.MSG.send(OAT, 'PAGE_LOADED');});
+            });
+          ]]>
+        </script>
+        <vm:login redirect="index.vspx"/>
+        <div class="message">
+          <v:label name="pwd_msg" value="--self.msg_msg" />
+          <input type="hidden" name="dirty_force_global" id="dirty_force_global" value="<?vsp http(get_keyword ('dirty_force_global', self.vc_event.ve_params, 'false')); ?>"/>
+          <input type="hidden" name="page" value="<?V self.pg ?>"/>
+          <input type="hidden" name="tabNo" id="tabNo" value="<?V self.tabNo ?>"/>
+        </div>
+        <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
+          <tr valign='top'>
+            <td>
+              <table cellpadding='10' cellspacing='0' border='0' width='100%'>
+                <tr>
+                  <td class="tab_deck">
+                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="navtab_tabs_ctr">
+                        <v:include name="nav" url="uiedit_nav.vspx"/>
+                    </table>
+                    <table class="tab_page">
+                      <tr>
+                        <td valign="top" class="tab_page">
+                            <v:include url="uiedit_groups.vspx"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </td>
+                </tr>
+              </table>
+            </td>
+          </tr>
+        </table>
+      </vm:body>
+    </vm:pagewrapper>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_knows.vspx b/appsrc/ODS-Framework/uiedit_knows.vspx
new file mode 100644
index 0000000..90fd70e
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_knows.vspx
@@ -0,0 +1,360 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: uiedit_knows.vspx,v 1.1.4.2 2010/12/07 11:11:31 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2010 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="uiedit-knows"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        style="index.xsl"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+	      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+  <v:variable name="k_mode" type="varchar" default="'K/browse'"/>
+
+	<v:variable name="k_id" type="any" default="null" />
+
+	<v:form name="usr_personal_11" type="simple" method="POST" xhtml_enctype="multipart/form-data">
+    <h3>Social Network</h3>
+    <vm:if test="self.k_mode = 'K/browse'">
+      <?vsp
+        if (0)
+        {
+      ?>
+        <v:button name="k_dButton" action="simple" value="Delete">
+          <v:on-post>
+            <![CDATA[
+              delete from DB.DBA.WA_USER_KNOWS where WUK_ID = get_keyword ('k_id', self.vc_page.vc_event.ve_params) and WUK_U_ID = self.u_id;
+              self.vc_data_bind(e);
+            ]]>
+          </v:on-post>
+        </v:button>
+      <?vsp
+        }
+      ?>
+      <input type="hidden" name="k_id" id="k_id" value="" />
+      <div style="padding: 0 0 0.5em 0;">
+        <v:button name="k_aButton" action="simple" style="url" value="''" xhtml_class="img_button">
+          <v:before-render>
+            <![CDATA[
+              control.ufl_value := '<img src="images/icons/add_16.png" border="0" /> Add';
+            ]]>
+          </v:before-render>
+          <v:on-post>
+            <![CDATA[
+              self.k_mode := 'K/add';
+              self.k_flag.ufl_value := null;
+              self.k_uri.ufl_value := null;
+              self.k_label.ufl_value := null;
+
+              self.vc_data_bind(e);
+            ]]>
+          </v:on-post>
+        </v:button>
+        <v:button name="k_iButton" action="simple" style="url" value="''" xhtml_class="img_button">
+          <v:before-render>
+            <![CDATA[
+              control.ufl_value := '<img src="images/icons/go_16.png" border="0" /> Import';
+            ]]>
+          </v:before-render>
+          <v:on-post>
+            <![CDATA[
+              self.k_mode := 'K/import';
+
+              self.vc_data_bind(e);
+            ]]>
+          </v:on-post>
+        </v:button>
+      </div>
+
+	    <v:data-set name="k_ds"
+	                sql="select WUK_ID, WUK_URI, WUK_LABEL from DB.DBA.WA_USER_KNOWS where WUK_U_ID = :self.u_id"
+		              scrollable="1"
+		              editable="1"
+		              nrows="10">
+
+        <v:template name="k_ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
+      	  <table class="listing" rules="groups">
+      	    <tr class="listing_header_row">
+      		    <th width="50%">Label</th>
+      		    <th width="50%">URI</th>
+      		    <th width="50px">Action</th>
+      	    </tr>
+          </table>
+        </v:template>
+
+        <v:template name="k_ds_repeat" type="repeat" name-to-remove="" set-to-remove="">
+
+          <v:template name="k_ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
+            <table>
+              <tr align="center">
+                <td colspan="3">No Knows</td>
+              </tr>
+            </table>
+          </v:template>
+
+          <v:template name="k_ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
+            <table>
+  			      <tr class="<?V case when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
+                <td nowrap="nowrap" width="50%">
+                  <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WUK_LABEL')" format="%s" name="k_ds_browse_2_label"/>
+                </td>
+                <td nowrap="nowrap" width="50%">
+                  <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WUK_URI')" format="%s" name="k_ds_browse_1_label"/>
+                </td>
+                <td nowrap="nowrap">
+                  <v:button name="k_eButton" action="simple" style="url" value="''" xhtml_class="img_button">
+                    <v:before-render>
+                      <![CDATA[
+                        control.ufl_value := '<img src="images/icons/edit_16.png" border="0" alt="Edit Like" title="Edit Like"/> Edit';
+                      ]]>
+                    </v:before-render>
+                    <v:on-post>
+                      <![CDATA[
+                        self.k_mode := 'K/edit';
+                        self.k_id := (control.vc_parent as vspx_row_template).te_column_value('WUK_ID');
+                        select WUK_FLAG,
+                               WUK_URI,
+                               WUK_LABEL
+                          into self.k_flag.ufl_value,
+                               self.k_uri.ufl_value,
+                               self.k_label.ufl_value
+                          from DB.DBA.WA_USER_KNOWS
+                         where WUK_ID = self.k_id;
+
+                        self.vc_data_bind(e);
+                      ]]>
+                    </v:on-post>
+                  </v:button>
+                  <span class="button pointer" onclick="javascript: if (confirm('Are you sure you want to delete this record?')) {$('k_id').value = <?V (control as vspx_row_template).te_column_value('WUK_ID') ?>; doPost('page_form', 'k_dButton');}">
+                    <img class="button" src="/ods/images/icons/trash_16.png"/> Delete
+                  </span>
+  			        </td>
+  			      </tr>
+            </table>
+		      </v:template>
+		    </v:template>
+
+		    <v:template name="k_ds_footer" type="simple" name-to-remove="table" set-to-remove="top">
+          <table>
+          </table>
+		    </v:template>
+	    </v:data-set>
+
+    </vm:if>
+
+    <vm:if test="self.k_mode = 'K/import'">
+      <script type="text/javascript">
+        <![CDATA[
+          function knowsData() {
+            if (!validateField($('k_import')))
+              return;
+
+          	var S = '/ods/api/user.getKnowsData?sourceURI=' + encodeURIComponent($v('k_import'));
+          	var x = function(data) {
+          		var o = null;
+          		try {
+          			o = OAT.JSON.parse(data);
+          		} catch (e) {
+          			o = null;
+          		}
+          		if (o) {
+	              for ( var i = 0; i < o.length; i++) {
+                  TBL.createRow('k', null, {fld_1: {mode: 4, value: '1'}, fld_2: {value: o[i].uri, readOnly: true}, fld_3: {value: o[i].label, readOnly: true}});
+  	            }
+          		} else {
+          			alert('No data founded');
+          		}
+          	}
+          	OAT.AJAX.GET(S, '', x, {onstart : function() {OAT.Dom.show('k_import_image')}, onend : function() {OAT.Dom.hide('k_import_image')}});
+          }
+        ]]>
+      </script>
+  	  <div class="fm">
+				<table>
+				  <tr>
+				    <th width="100px">
+		          Source
+		        </th>
+            <td>
+              <input type="text" name="k_import" id="k_import" value="" size="100" class="_validate_ _uri_" />
+              <input type="button" value="Download" onclick="javascript: knowsData(); return false;" class="button" />
+              <img id="k_import_image" alt="Import knows URIs" src="/ods/images/oat/Ajax_throbber.gif" style="display: none" />
+            </td>
+          </tr>
+          <tr>
+            <th></th>
+            <td>
+              <table id="k_tbl" class="listing">
+                <thead>
+                  <tr class="listing_header_row">
+                    <th>
+                      Access
+                    </th>
+                    <th width="50%">
+                      URI
+                    </th>
+                    <th width="50%">
+                      Label
+                    </th>
+                    <th width="65px">
+                      Action
+                    </th>
+                  </tr>
+                </thead>
+                <tr id="k_tr_no"><td colspan="3"><b>No downloaded items</b></td></tr>
+              </table>
+            </td>
+          </tr>
+          <tr>
+            <th></th>
+            <td>
+              <br />
+    		      <v:button name="user_ci_personal_11" value="Cancel" action="simple">
+    		        <v:on-post>
+                  self.k_mode := 'K/browse';
+                  self.vc_data_bind (e);
+    		        </v:on-post>
+    		      </v:button>
+    		      <v:button name="user_si_personal_11" value="Import" action="simple">
+    		        <v:on-post>
+    		          <![CDATA[
+                    declare N integer;
+                    declare uri, flag, label, suffix, params any;
+
+                    params := self.vc_page.vc_event.ve_params;
+                    for (N := 0; N < length (params); N := N + 2)
+                    {
+                      if (params [N] like 'k_fld_1_%')
+                      {
+                        suffix := replace (params [N], 'k_fld_1_', '');
+                        flag :=  trim (params [N+1]);
+                        uri :=  trim (get_keyword ('k_fld_2_'||suffix, params, ''));
+                        label :=  trim (get_keyword ('k_fld_3_'||suffix, params, ''));
+                        if ((uri <> '') and not exists (select 1 from DB.DBA.WA_USER_KNOWS where WUK_U_ID = self.u_id and WUK_URI = uri))
+                        {
+                          insert into DB.DBA.WA_USER_KNOWS (WUK_U_ID, WUK_FLAG, WUK_URI, WUK_LABEL)
+                            values (self.u_id, flag, uri, label);
+                        }
+                      }
+                    }
+
+                    self.k_mode := 'K/browse';
+                    self.vc_data_bind (e);
+                  ]]>
+                </v:on-post>
+              </v:button>
+            </td>
+          </tr>
+        </table>
+  	  </div>
+    </vm:if>
+
+    <vm:if test="self.k_mode in ('K/add', 'K/edit')">
+  	  <div class="fm">
+				<table>
+				  <tr>
+				    <th width="100px">
+		          Access
+		        </th>
+		        <td>
+              <v:select-list name="k_flag" xhtml_id="k_flag">
+                <v:item name="public" value="1" />
+                <v:item name="acl" value="2" />
+                <v:item name="private" value="3" />
+              </v:select-list>
+            </td>
+          </tr>
+				  <tr>
+				    <th>
+		          Label (*)
+		        </th>
+		        <td>
+              <v:text name="k_label" value="" xhtml_id="k_label" xhtml_size="50" xhtml_class="_validate_" />
+            </td>
+          </tr>
+				  <tr>
+				    <th>
+		          URI (*)
+		        </th>
+		        <td>
+              <v:text name="k_uri" value="" xhtml_id="k_uri" xhtml_size="50" xhtml_class="_validate_ _uri_" />
+            </td>
+          </tr>
+				  <tr>
+				    <th>
+		        </th>
+		        <td>
+		          <label>
+              	<v:check-box name="k_ping" value="1"/>
+              	Issue Semantic Pingback
+              </label>
+            </td>
+          </tr>
+          <tr>
+            <td></td>
+            <td>
+              <br />
+    		      <v:button name="user_c_personal_11" value="Cancel" action="simple">
+    		        <v:on-post>
+                  self.k_mode := 'K/browse';
+                  self.vc_data_bind (e);
+    		        </v:on-post>
+    		      </v:button>
+    		      <v:button name="user_s_personal_11" value="--case when self.k_mode = 'K/add' then 'Add' else 'Update' end" action="simple" xhtml_onclick="return validateInputs(this);">
+    		        <v:on-post><![CDATA[
+                  if (self.vc_is_valid = 0)
+                    return;
+
+                  if (self.k_mode = 'K/add')
+                  {
+                    if (exists (select 1 from DB.DBA.WA_USER_KNOWS where WUK_U_ID = self.u_id and WUK_URI = self.k_uri.ufl_value))
+                    {
+                      self.vc_error_message := 'A "Knows" with same URI already exists, please specify unique URI.';
+                      self.vc_is_valid := 0;
+                      return;
+                    }
+                    insert into DB.DBA.WA_USER_KNOWS (WUK_U_ID, WUK_FLAG, WUK_URI, WUK_LABEL)
+                      values (self.u_id, self.k_flag.ufl_value, self.k_uri.ufl_value, self.k_label.ufl_value);
+                  }
+                  else
+                  {
+                    update DB.DBA.WA_USER_KNOWS
+                       set WUK_FLAG = self.k_flag.ufl_value,
+                           WUK_URI = self.k_uri.ufl_value,
+                           WUK_LABEL = self.k_label.ufl_value
+                     where WUK_ID = self.k_id;
+                  }
+          	      if (self.k_ping.ufl_selected)
+                    SEMPING.DBA.CLI_PING (sioc..person_iri (sioc..user_iri (self.u_id)), self.k_uri.ufl_value);
+
+                  self.k_mode := 'K/browse';
+                  self.vc_data_bind (e);
+                ]]></v:on-post>
+              </v:button>
+            </td>
+          </tr>
+        </table>
+      </div>
+    </vm:if>
+	</v:form>
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_ldap.vspx b/appsrc/ODS-Framework/uiedit_ldap.vspx
index 6ecb9ba..cb1b972 100644
--- a/appsrc/ODS-Framework/uiedit_ldap.vspx
+++ b/appsrc/ODS-Framework/uiedit_ldap.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_ldap.vspx,v 1.5.2.4 2010/03/12 09:10:13 source Exp $
+ -  $Id: uiedit_ldap.vspx,v 1.5.2.7 2010/09/27 14:45:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -22,601 +22,149 @@
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  -
 -->
-<v:page name="ldap-page"
+<v:page name="ui_profile"
         xmlns:vm="http://www.openlinksw.com/vspx/ods/"
         xmlns:v="http://www.openlinksw.com/vspx/"
         style="index.xsl"
+	      fast-render="1"
         doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
         doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
-  <v:method name="render_select1" arglist="inout name any">
+  <v:method name="addProperty" arglist="in obj any, in objProperty varchar, in paramsProperty varchar, in params any">
     <![CDATA[
-  	  declare s1, s2, s3, s4 varchar;
+      declare tmp ay;
 
-  	  s1 := either (equ (name, 'uid'), 'selected', '');
-  	  s2 := either (equ (name, 'cn'), 'selected', '');
-  	  s3 := either (equ (name, 'mail'), 'selected', '');
-  	  s4 := either (equ (name, 'title'), 'selected', '');
-
-  	  http (sprintf ('<select name="sel_%s" onchange="checkRest (this.form, this)">', name));
-  	  http ('<option value="skip">--</option>');
-  	  http (sprintf ('<option value="nick" %s>Login Name</option>', s1));
-  	  http (sprintf ('<option value="name" %s>Name</option>', s2));
-  	  http (sprintf ('<option value="mbox" %s>E-Mail</option>', s3));
-  	  http (sprintf ('<option value="title" %s>Title</option>', s4));
-  	  http ('</select>');
+      tmp := trim (get_keyword (paramsProperty, params));
+      if (not is_empty_or_null (tmp))
+        obj := vector_concat (obj, vector (objProperty, tmp));
+      return obj;
 	  ]]>
 	</v:method>
 
-	<v:method name="render_select" arglist="inout name any">
+  <v:method name="jsonObject" arglist="">
     <![CDATA[
-      declare N any;
-      declare S, T any;
-
-      T := '';
-      if (not isnull (self.v_maps))
-        for (N := 0; N < length (self.v_maps); N := N + 2)
-          if (self.v_maps[N] = name)
-            T := self.v_maps[N+1];
-
-      http (sprintf ('<select name="sel_%s" onchange="checkRest (this.form, this)">', name));
-      http ('<option value="skip">--</option>');
-      for (N := 0; N < length (self.v_fields); N := N + 2)
-      {
-        S := '';
-        if (self.v_fields[N] = T)
-          S := ' selected="selected"';
-        http (sprintf ('<option value="%s"%s>%s</option>', self.v_fields[N], S, self.v_fields[N+1]));
-      }
-      http ('</select>');
-    ]]>
-  </v:method>
-
-
-  <v:method name="ldap_value" arglist="inout data any">
-    <![CDATA[
-      return case when isstring (data) then data else data[0] end;
+      return subseq (soap_box_structure ('x', 1), 0, 2);
 	  ]]>
 	</v:method>
 
-  <v:method name="ldap_pattern" arglist="in pattern any">
+  <v:method name="checkBox" arglist="in checkField varchar, inout properties any">
     <![CDATA[
-      declare N integer;
-
-      for (N := 0; N < length (self.v_maps); N := N + 2)
-        if (self.v_maps [N+1] = pattern)
-          return self.v_maps [N];
-
-      return '';
-	  ]]>
-	</v:method>
-
-  <v:method name="ldap_data" arglist="inout data any, in pattern any">
-    <![CDATA[
-      declare M integer;
-
-      for (M := 0; M < length (data); M := M + 2)
-        if (data[M] = pattern)
-          return self.ldap_value (data[M+1]);
+      declare S varchar;
 
-      return '';
+      S := '';
+      if (get_keyword (checkField, properties, '0') <> '0')
+        S := 'checked="checked"';
+      http (sprintf ('<input type="checkbox" name="%s" id="%s" value="1" %s />', checkField, checkField, S));
 	  ]]>
 	</v:method>
 
-  <v:variable name="v_mode" type="varchar" default="'LDAP/browse'"/>
-  <v:variable name="v_step" type="varchar" default="''"/>
-
-  <v:variable name="v_name" type="varchar" default="''"/>
-  <v:variable name="v_host" type="varchar" default="''"/>
-  <v:variable name="v_port" type="varchar" default="'389'"/>
-  <v:variable name="v_base_dn" type="varchar" default="''"/>
-  <v:variable name="v_bind_dn" type="varchar" default="''"/>
-  <v:variable name="v_password" type="varchar" default="''"/>
-  <v:variable name="v_default" type="integer" default="0"/>
-  <v:variable name="v_search" type="varchar" default="'(cn=*)'"/>
-  <v:variable persist="temp" name="v_fields" type="any" default="null"/>
-  <v:variable persist="0" name="v_maps" type="any" default="null"/>
-  <v:variable persist="0" name="v_data" type="any" default="null"/>
-
-  <h3>LDAP Servers Addministration</h3>
-  <vm:if test="self.v_mode = 'LDAP/browse'">
-    <v:data-source name="dsrc" expression-type="sql" nrows="10" initial-offset="0">
+  <vm:page>
+    <vm:header>
+      <script type="text/javascript" src="tbl.js">;</script>
+      <script type="text/javascript" src="typeahead.js">;</script>
+      <link rel="stylesheet" href="typeahead.css" type="text/css" />
+      <vm:title>Edit your personal data</vm:title>
+    </vm:header>
+    <vm:pagewrapper vm_onunload="checkPageLeave (document.forms['page_form'])">
+      <v:variable persist="temp" name="msg_msg" type="varchar" default="''"/>
+      <v:variable name="tabNo" type="integer" param-name="tabNo" default="0"/>
+      <v:variable name="pg" type="integer" param-name="page" default="1"/>
+      <v:variable name="is_org" type="integer" default="0" />
+      <vm:rawheader caption="Edit your personal data"/>
+      <vm:navigation-new on="settings"/>
+      <vm:subnavigation-new on="site"/>
+      <vm:body>
       <v:before-data-bind>
         <![CDATA[
-          control.ds_sql := sprintf ('select * from LDAP..LDAP_SERVERS where LS_USER_ID = %d', self.u_id);
+            self.is_org := coalesce ((select WAUI_IS_ORG from WA_USER_INFO where WAUI_U_ID = self.u_id), 0);
         ]]>
       </v:before-data-bind>
-    </v:data-source>
-    <v:data-set name="ds" data-source="self.dsrc" scrollable="1">
-      <div style="padding: 0 0 0.5em 0;">
-        <v:button name="lButton_1" action="simple" style="url" value="''" xhtml_class="img_button">
-          <v:before-render>
-            <![CDATA[
-              control.ufl_value := '<img src="images/icons/add_16.png" border="0" /> Add';
-            ]]>
-          </v:before-render>
-          <v:on-post>
-            <![CDATA[
-              self.v_mode := 'LDAP/add';
-              self.v_step := '1';
-              self.v_name := '';
-              self.v_host := '';
-              self.v_port := '389';
-              self.v_base_dn := '';
-              self.v_bind_dn := '';
-              self.v_password := '';
-              self.v_maps := null;
-              self.v_data := null;
-              self.v_default := 1;
-              if (not isnull (LDAP..ldap_default (self.u_id)))
-                self.v_default := 0;
-
-              self.vc_data_bind(e);
-            ]]>
-          </v:on-post>
-        </v:button>
-      </div>
-
-      <v:template name="ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
-        <table id="ldap" class="listing ldap" cellspacing="0">
-          <tr class="listing_header_row">
-            <th>LDAP Name</th>
-            <th>LDAP Server Host</th>
-            <th>Is Default</th>
-		        <th width="50px">Action</th>
-          </tr>
-        </table>
-      </v:template>
-
-      <v:template name="ds_repeat" type="repeat" name-to-remove="" set-to-remove="">
-
-        <v:template name="ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
-          <table>
-            <tr align="center">
-              <td colspan="3">No LDAP servers</td>
-            </tr>
-          </table>
-        </v:template>
-
-        <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
-          <table>
-            <tr>
-              <td nowrap="nowrap">
-                <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('LS_NAME')" format="%s"/>
-              </td>
-              <td nowrap="nowrap">
-                <v:label value="--sprintf ('%s:%s', (control.vc_parent as vspx_row_template).te_column_value('LS_HOST'), (control.vc_parent as vspx_row_template).te_column_value('LS_PORT'))" format="%s"/>
-              </td>
-              <td nowrap="nowrap">
-                <v:label value="--case when ((control.vc_parent as vspx_row_template).te_column_value('LS_DEFAULT') = 1) then 'Yes' else '' end" format="%s"/>
-              </td>
-              <td nowrap="nowrap">
-                <v:button name="lButton_2" action="simple" style="url" value="''" xhtml_class="img_button">
-                  <v:before-render>
-                    <![CDATA[
-                      control.ufl_value := '<img src="images/icons/confg_16.png" border="0" alt="Edit LDAP Server" title="Edit LDAP Server"/> Edit';
-                    ]]>
-                  </v:before-render>
-                  <v:on-post>
-                    <![CDATA[
-                      self.v_mode := 'LDAP/edit';
-                      self.v_step := '1';
-                      self.v_name := (control.vc_parent as vspx_row_template).te_column_value('LS_NAME');
-                      select LS_HOST,
-                             LS_PORT,
-                             LS_BASE_DN,
-                             LS_BIND_DN,
-                             LS_PASSWORD,
-                             LS_DEFAULT,
-                             deserialize (LS_MAPS)
-                        into self.v_host,
-                             self.v_port,
-                             self.v_base_dn,
-                             self.v_bind_dn,
-                             self.v_password,
-                             self.v_default,
-                             self.v_maps
-                        from LDAP..LDAP_SERVERS
-                       where LS_USER_ID = self.u_id
-                         and LS_NAME = self.v_name;
-
-                      self.vc_data_bind(e);
-                    ]]>
-                  </v:on-post>
-                </v:button>
-                <v:button name="lButton_3" action="simple" style="url" value="''" xhtml_class="img_button">
-                  <v:before-render>
-                    <![CDATA[
-                      control.ufl_value := '<img src="images/icons/trash_16.png" border="0" alt="Delete LDAP Server" title="Delete LDAP Server"/> Delete';
-                    ]]>
-                  </v:before-render>
-                  <v:on-post>
-                    <![CDATA[
-                      delete from LDAP..LDAP_SERVERS where LS_USER_ID = self.u_id and LS_NAME = (control.vc_parent as vspx_row_template).te_column_value('LS_NAME');
-
-                      self.vc_data_bind(e);
-                    ]]>
-                  </v:on-post>
-                </v:button>
-                <v:button name="lButton_4" action="simple" style="url" value="''" xhtml_class="img_button">
-                  <v:before-render>
+        <script type="text/javascript">
                     <![CDATA[
-                      control.ufl_value := '<img src="images/icons/foaf.png" border="0" alt="Generate FOAF" title="Generate FOAF"/>';
-                    ]]>
-                  </v:before-render>
-                  <v:on-post>
-                    <![CDATA[
-                      self.v_name := (control.vc_parent as vspx_row_template).te_column_value('LS_NAME');
-                      self.v_mode := 'LDAP/foaf';
-
-                      declare host varchar;
-
-                      select LS_HOST,
-                             LS_PORT,
-                             LS_BASE_DN,
-                             LS_BIND_DN,
-                             LS_PASSWORD,
-                             LS_DEFAULT,
-                             deserialize (LS_MAPS)
-                        into self.v_host,
-                             self.v_port,
-                             self.v_base_dn,
-                             self.v_bind_dn,
-                             self.v_password,
-                             self.v_default,
-                             self.v_maps
-                        from LDAP..LDAP_SERVERS
-                       where LS_USER_ID = self.u_id
-                         and LS_NAME = self.v_name;
-
-                      connection_set ('LDAP_VERSION', 2);
-                     	host := 'ldap://' || self.v_host || ':' || self.v_port;
-                      self.v_search := '(cn=*)';
-                      self.v_data := ldap_search (host, 0, self.v_base_dn, self.v_search, self.v_bind_dn, self.v_password);
-                      self.vc_data_bind(e);
-                    ]]>
-                  </v:on-post>
-                </v:button>
-              </td>
-            </tr>
-          </table>
-        </v:template>
-
-      </v:template>
-
-      <v:template type="simple" name-to-remove="table" set-to-remove="top">
-        <table>
-          <tr align="center">
-            <td colspan="4">
-              <vm:ds-navigation data-set="ds"/>
-            </td>
-          </tr>
-        </table>
-      </v:template>
-
-    </v:data-set>
-  </vm:if>
-  <v:template name="lTemplate" type="simple" enabled="--case when (self.v_mode = 'LDAP/foaf') then 1 else 0 end">
-    <div><v:label value="--'Export from LDAP Server ' || self.v_name || ' to FOAF'" /></div>
-    <div style="height: 400px; overflow: auto;">
-      <table id="lfoaf" class="listing" cellspacing="0">
-        <tr class="listing_header_row">
-          <th width="1%">
-            <input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, 'cb_item')" />
-          </th>
-          <th>Login Name</th>
-          <th>Description</th>
-        </tr>
-        <?vsp
-          declare N, M integer;
-          declare data, loginPattern, loginData, namePattern any;
-
-          loginPattern := self.ldap_pattern ('P_NAME');
-          namePattern := self.ldap_pattern ('P_FULL_NAME');
-
-          for (N := 0; N < length (self.v_data); N := N + 2) {
-    	      if (self.v_data [N] = 'entry') {
-    	        data := self.v_data [N+1];
-    	        loginData := self.ldap_data (data, loginPattern);
-    	        if (loginData <> '') {
-    	  ?>
-    	  <tr>
-    	    <td width="1%">
-             <?vsp http (sprintf ('<input type="checkbox" name="cb_item" value="%d"', N+1)); ?>
-    		  </td>
-    		  <td>
-    		    <?V substring (loginData, 1, 50) ?>
-    		  </td>
-    		  <td>
-    		    <?V substring (self.ldap_data (data, namePattern), 1, 50) ?>
-    		  </td>
-        </tr>
-    	  <?vsp
-    	        }
-    	      }
-          }
-        ?>
-      </table>
-    </div>
-    <div class="new-form-footer">
-      <v:button name="lButton_5" action="simple" value="Generate FOAF" xhtml_class="form-button">
-        <v:on-post>
-          <![CDATA[
-            declare N, M, L, isFounded integer;
-            declare params, data, loginPattern, loginData, sStream, foafNames any;
-            declare foafName varchar;
-
-            loginPattern := self.ldap_pattern ('P_NAME');
-
-            sStream := string_output();
-            http ('<rdf:RDF xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\n', sStream);
-
-            foafNames := LDAP..foaf_fields ();
-            params := e.ve_params;
-            for (N := 0; N < length (params); N := N + 4)
+            function getFileName(form, from, to)
             {
-              if (params[N] = 'cb_item')
-              {
-                isFounded := 0;
-                data := self.v_data [cast (params[N+1] as integer)];
-    	          loginData := self.ldap_data (data, loginPattern);
-    	          if (loginData <> '')
-    	          {
-                  http (sprintf ('  <foaf:Person rdf:about="%s">\n', loginData), sStream);
-                  for (M := 0; M < length (data); M := M + 2)
+              var S = from.value;
+              var N;
+              var fname;
+              if (S.lastIndexOf('\\') > 0)
+                N = S.lastIndexOf('\\')+1;
+              else
+                N = S.lastIndexOf('/')+1;
+              fname = S.substr(N,S.length);
+              to.value = fname;
+            }
+            function swPersHide ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Organization Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.hide('pers_'+i);
+              OAT.Dom.hide('p_url_2');
+            }
+            function swPersShow ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Personal Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.show('pers_'+i);
+              OAT.Dom.show('p_url_2');
+            }
+            function swOrg (cb)
                   {
-                    if (data[M] <> loginPattern)
+              (cb.checked)? swPersHide(): swPersShow();
+            }
+            function checkRest (form, sel)
                     {
-                      for (L := 0; L < length (self.v_maps); L := L + 2)
+              var i;
+              if (sel.selectedIndex == 0)
+                return;
+              for (i = 0; i < form.elements.length; i++)
                       {
-                        if (self.v_maps [L] = data[M])
+                var contr = form.elements[i];
+                if (contr != null && contr != sel && contr.type == "select-one")
                         {
-                          foafName := get_keyword (self.v_maps[L+1], foafNames);
-                          if (not isnull (foafName))
-                            http (sprintf ('    <foaf:%s>%V</foaf:%s>\n', foafName, self.ldap_value (data[M+1]), foafName), sStream);
-                          goto _exit3;
-                        }
+                  if (contr.selectedIndex == sel.selectedIndex)
+                    contr.selectedIndex = 0;
                       }
                     }
-                  _exit3:;
                   }
-                  http ('  </foaf:Person>\n', sStream);
-                }
-              }
-            }
-            http ('</rdf:RDF>', sStream);
-
-            http_rewrite ();
-            http_request_status ('HTTP/1.1 200 OK');
-            http_header ('Content-Type: application/x-download\r\n');
-            http_header ('Content-Disposition: inline; filename="ldap.foaf"\r\n');
-            http (string_output_string (sStream));
-            http_flush ();
-
-            self.v_maps := null;
-            self.v_data := null;
-            self.v_mode := 'LDAP/browse';
-            self.vc_data_bind(e);
-          ]]>
-        </v:on-post>
-      </v:button>
-      <v:button name="lButton_6" action="simple" value="Back" xhtml_class="form-button">
-        <v:on-post>
-          <![CDATA[
-            self.v_mode := 'LDAP/browse';
-            self.vc_data_bind(e);
+            ODSInitArray.push ( function () {
+              OAT.Loader.load(["json", "ws", "calendar", "combolist"], function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){(<?V self.is_org ?>)? swPersHide(): swPersShow();}); OAT.MSG.send(OAT, 'PAGE_LOADED');});
+            });
           ]]>
-        </v:on-post>
-      </v:button>
+        </script>
+        <vm:login redirect="index.vspx"/>
+        <div class="message">
+          <v:label name="pwd_msg" value="--self.msg_msg" />
+          <input type="hidden" name="dirty_force_global" id="dirty_force_global" value="<?vsp http(get_keyword ('dirty_force_global', self.vc_event.ve_params, 'false')); ?>"/>
+          <input type="hidden" name="page" value="<?V self.pg ?>"/>
+          <input type="hidden" name="tabNo" id="tabNo" value="<?V self.tabNo ?>"/>
     </div>
-  </v:template>
-
-  <vm:if test="(self.v_mode in ('LDAP/add', 'LDAP/edit')) and (self.v_step = '1')">
-    <table class="ctl_grp" cellspacing="0">
-      <tr>
-        <td colspan="2" align="left">
-          <h3>LDAP Server</h3>
-        </td>
-      </tr>
-      <tr>
-        <th width="30%">
-          <vm:label for="ldap_name" value="LDAP server name"/>
-        </th>
-        <td>
-          <v:text name="ldap_name" null-value="--''" value="--self.v_name" xhtml_size="70"/>
-        </td>
-      </tr>
-      <tr>
-        <th>
-          <vm:label for="ldap_host" value="Host URL"/>
-        </th>
-        <td>
-          <v:text name="ldap_host" null-value="--''" value="--self.v_host" xhtml_size="70"/>
-        </td>
-      </tr>
-      <tr>
-        <th>
-          <vm:label for="ldap_port" value="Host port"/>
-        </th>
-        <td>
-          <v:text name="ldap_port" null-value="--''" value="--self.v_port" xhtml_size="10"/>
-        </td>
-      </tr>
-      <tr>
-        <th>
-          <v:label for="ldap_base_dn" value="Base DN"/>
-        </th>
-        <td>
-          <v:text name="ldap_base_dn" null-value="--''" value="--self.v_base_dn" xhtml_size="70"/>
-        </td>
-      </tr>
-      <tr>
-        <th>
-          <v:label for="ldap_bind_dn" value="Bind DN"/>
-        </th>
+        <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
+          <tr valign='top'>
         <td>
-          <v:text name="ldap_bind_dn" null-value="--''" value="--self.v_bind_dn" xhtml_size="70"/>
-        </td>
-      </tr>
+              <table cellpadding='10' cellspacing='0' border='0' width='100%'>
       <tr>
-        <th>
-          <v:label for="ldap_password" value="Password"/>
-        </th>
-        <td>
-          <v:text name="ldap_password" type="password" null-value="--''" value="--self.v_password" xhtml_size="30"/>
-        </td>
-      </tr>
+                  <td class="tab_deck">
+                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="navtab_tabs_ctr">
+                        <v:include name="nav" url="uiedit_nav.vspx"/>
+                    </table>
+                    <table class="tab_page">
       <tr>
-        <th>
-          <v:label for="ldap_search" value="Search string"/>
-        </th>
-        <td>
-          <v:text name="ldap_search" null-value="--''" value="--self.v_search" xhtml_size="70"/>
+                        <td valign="top" class="tab_page">
+                            <v:include url="uiedit_ldap_include.vspx"/>
         </td>
       </tr>
-      <vm:if test="(self.v_default <> 1)">
-        <tr>
-          <th/>
-          <td>
-            <v:check-box name="ldap_default" xhtml_id="ldap_default" is-boolean="1" true-value="1" false-value="0" value="0" />
-            <vm:label for="ldap_default" value="Set as default LDAP server"/>
+                    </table>
           </td>
         </tr>
-      </vm:if>
     </table>
-    <div class="new-form-footer">
-      <v:button name="lButton_7" action="simple" value="Next" xhtml_class="form-button">
-        <v:on-post>
-          <![CDATA[
-          	declare host varchar;
-
-            self.v_name := trim (self.ldap_name.ufl_value);
-            self.v_host := trim (self.ldap_host.ufl_value);
-            self.v_port := trim (self.ldap_port.ufl_value);
-            self.v_base_dn := trim (self.ldap_base_dn.ufl_value);
-            self.v_bind_dn := trim (self.ldap_bind_dn.ufl_value);
-            self.v_password := trim (self.ldap_password.ufl_value);
-            self.v_search := trim (self.ldap_search.ufl_value);
-            if (self.v_default <> 1)
-              self.v_default := cast (self.ldap_default.ufl_value as integer);
-
-          	declare exit handler for sqlstate '*'
-          	{
-          	  self.vc_error_message := 'Unknown LDAP server. Please, check parameters!';
-          	  self.vc_is_valid := 0;
-          	  return;
-          	};
-            connection_set ('LDAP_VERSION', 2);
-          	host := 'ldap://' || self.v_host || ':' || self.v_port;
-            self.v_data := ldap_search (host, 0, self.v_base_dn, self.v_search, self.v_bind_dn, self.v_password);
-
-            self.v_step := '2';
-            self.vc_data_bind(e);
-          ]]>
-        </v:on-post>
-      </v:button>
-      <v:button name="lButton_8" action="simple" value="Cancel" xhtml_class="form-button">
-        <v:on-post>
-          <![CDATA[
-            self.v_mode := 'LDAP/browse';
-            self.v_maps := NULL;
-            self.v_data := NULL;
-            self.vc_data_bind(e);
-          ]]>
-        </v:on-post>
-      </v:button>
-    </div>
-  </vm:if>
-  <vm:if test="(self.v_mode in ('LDAP/add', 'LDAP/edit')) and (self.v_step = '2')">
-    <div style="height: 400px; overflow: auto;">
-      <table id="ldap" class="listing" cellspacing="0">
-        <tr class="listing_header_row">
-          <th>LDAP Property</th>
-          <th>User Property</th>
-          <th>Sample Data (based on first record)</th>
-        </tr>
-        <?vsp
-          declare N, M integer;
-          declare data any;
-
-          self.v_fields := LDAP..contact_fields ();
-          for (N := 0; N < length (self.v_data); N := N + 2)
-          {
-    	      if (self.v_data [N] = 'entry')
-    	      {
-    	        data := self.v_data [N+1];
-    	        for (M := 0; M < length (data); M := M + 2)
-    	        {
-    	  ?>
-    	  <tr>
-    	    <td>
-    		    <?V data[M] ?>
-    		  </td>
-    		  <td class="listing_col" nowrap="1">
-    		    <?vsp
-    		      self.render_select (data[M]);
-    		    ?>
-    		  </td>
-    		  <td>
-    		    <?V substring (case when isstring (data[M+1]) then data[M+1] else data[M+1][0] end, 1, 50) ?>
     		  </td>
         </tr>
-    	  <?vsp
-              }
-              goto _end;
-    	      }
-          }
-        _end:;
-        ?>
       </table>
-    </div>
-    <div class="new-form-footer">
-      <v:button name="lButton_9" action="simple" value="Save" xhtml_class="form-button">
-        <v:on-post>
-          <![CDATA[
-            declare N integer;
-            declare params any;
-
-            params := e.ve_params;
-            self.v_maps := vector ();
-            for (N := 0; N < length (params); N := N + 2)
-              if (params[N] like 'sel_%')
-              {
-                if (params[N+1] <> 'skip')
-                {
-                  self.v_maps := vector_concat (self.v_maps, vector (substring (params[N], 5, length (params[N])), params[N+1]));
-                } else {
-                  self.v_maps := vector_concat (self.v_maps, vector (substring (params[N], 5, length (params[N])), ''));
-                }
-              }
-
-            insert replacing LDAP..LDAP_SERVERS (LS_USER_ID, LS_NAME, LS_HOST, LS_PORT, LS_BASE_DN, LS_BIND_DN, LS_PASSWORD, LS_DEFAULT, LS_MAPS)
-              values (self.u_id, self.v_name, self.v_host, self.v_port, self.v_base_dn, self.v_bind_dn, self.v_password, self.v_default, serialize (self.v_maps));
-
-            if (self.v_default = 1)
-              update LDAP..LDAP_SERVERS
-                 set LS_DEFAULT = 0
-               where LS_USER_ID = self.u_id
-                 and LS_NAME <> self.v_name;
-
-            self.v_mode := 'LDAP/browse';
-            self.v_maps := NULL;
-            self.v_data := NULL;
-            self.vc_data_bind(e);
-          ]]>
-        </v:on-post>
-      </v:button>
-      <v:button name="lButton_10" action="simple" value="Cancel" xhtml_class="form-button">
-        <v:on-post>
-          <![CDATA[
-            self.v_mode := 'LDAP/browse';
-            self.v_maps := NULL;
-            self.v_data := NULL;
-            self.vc_data_bind(e);
-          ]]>
-        </v:on-post>
-      </v:button>
-    </div>
-  </vm:if>
-
+      </vm:body>
+    </vm:pagewrapper>
+  </vm:page>
 </v:page>
diff --git a/appsrc/ODS-Framework/uiedit_ldap_include.vspx b/appsrc/ODS-Framework/uiedit_ldap_include.vspx
new file mode 100644
index 0000000..2b6e5b0
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_ldap_include.vspx
@@ -0,0 +1,603 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: uiedit_ldap_include.vspx,v 1.1.4.3 2010/12/07 11:11:31 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="ldap-page"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        style="index.xsl"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+	<v:method name="render_select" arglist="inout name any">
+    <![CDATA[
+      declare N any;
+      declare S, T any;
+
+      T := '';
+      if (not isnull (self.v_maps))
+        for (N := 0; N < length (self.v_maps); N := N + 2)
+          if (self.v_maps[N] = name)
+            T := self.v_maps[N+1];
+
+      http (sprintf ('<select name="sel_%s" onchange="checkRest (this.form, this)">', name));
+      http ('<option value="skip">--</option>');
+      for (N := 0; N < length (self.v_fields); N := N + 2)
+      {
+        S := '';
+        if (self.v_fields[N] = T)
+          S := ' selected="selected"';
+        http (sprintf ('<option value="%s"%s>%s</option>', self.v_fields[N], S, self.v_fields[N+1]));
+      }
+      http ('</select>');
+    ]]>
+  </v:method>
+
+
+  <v:method name="ldap_value" arglist="inout data any">
+    <![CDATA[
+      return case when isstring (data) then data else data[0] end;
+	  ]]>
+	</v:method>
+
+  <v:method name="ldap_pattern" arglist="in pattern any">
+    <![CDATA[
+      declare N integer;
+
+      for (N := 0; N < length (self.v_maps); N := N + 2)
+        if (self.v_maps [N+1] = pattern)
+          return self.v_maps [N];
+
+      return '';
+	  ]]>
+	</v:method>
+
+  <v:method name="ldap_data" arglist="inout data any, in pattern any">
+    <![CDATA[
+      declare M integer;
+
+      for (M := 0; M < length (data); M := M + 2)
+        if (data[M] = pattern)
+          return self.ldap_value (data[M+1]);
+
+      return '';
+	  ]]>
+	</v:method>
+
+  <v:variable name="v_mode" type="varchar" default="'LDAP/browse'"/>
+  <v:variable name="v_step" type="varchar" default="''"/>
+
+  <v:variable name="v_name" type="varchar" default="''"/>
+  <v:variable name="v_host" type="varchar" default="''"/>
+  <v:variable name="v_port" type="varchar" default="'389'"/>
+  <v:variable name="v_base_dn" type="varchar" default="''"/>
+  <v:variable name="v_bind_dn" type="varchar" default="''"/>
+  <v:variable name="v_password" type="varchar" default="''"/>
+  <v:variable name="v_default" type="integer" default="0"/>
+  <v:variable name="v_search" type="varchar" default="'(cn=*)'"/>
+  <v:variable persist="temp" name="v_fields" type="any" default="null"/>
+  <v:variable persist="0" name="v_maps" type="any" default="null"/>
+  <v:variable persist="0" name="v_data" type="any" default="null"/>
+
+  <h3>LDAP Servers Addministration</h3>
+  <vm:if test="self.v_mode = 'LDAP/browse'">
+    <v:data-source name="dsrc" expression-type="sql" nrows="10" initial-offset="0">
+      <v:before-data-bind>
+        <![CDATA[
+          control.ds_sql := sprintf ('select * from LDAP..LDAP_SERVERS where LS_USER_ID = %d', self.u_id);
+        ]]>
+      </v:before-data-bind>
+    </v:data-source>
+    <v:data-set name="ds" data-source="self.dsrc" scrollable="1">
+      <div style="padding: 0 0 0.5em 0;">
+        <v:button name="lButton_1" action="simple" style="url" value="''" xhtml_class="img_button">
+          <v:before-render>
+            <![CDATA[
+              control.ufl_value := '<img src="images/icons/add_16.png" border="0" /> Add';
+            ]]>
+          </v:before-render>
+          <v:on-post>
+            <![CDATA[
+              self.v_mode := 'LDAP/add';
+              self.v_step := '1';
+              self.v_name := '';
+              self.v_host := '';
+              self.v_port := '389';
+              self.v_base_dn := '';
+              self.v_bind_dn := '';
+              self.v_password := '';
+              self.v_maps := null;
+              self.v_data := null;
+              self.v_default := 1;
+              if (not isnull (LDAP..ldap_default (self.u_id)))
+                self.v_default := 0;
+
+              self.vc_data_bind(e);
+            ]]>
+          </v:on-post>
+        </v:button>
+      </div>
+
+      <v:template name="ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
+        <table id="ldap" class="listing ldap" cellspacing="0">
+          <tr class="listing_header_row">
+            <th>LDAP Name</th>
+            <th>LDAP Server Host</th>
+            <th>Is Default</th>
+		        <th width="50px">Action</th>
+          </tr>
+        </table>
+      </v:template>
+
+      <v:template name="ds_repeat" type="repeat" name-to-remove="" set-to-remove="">
+
+        <v:template name="ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
+          <table>
+            <tr align="center">
+              <td colspan="3">No LDAP servers</td>
+            </tr>
+          </table>
+        </v:template>
+
+        <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
+          <table>
+            <tr class="<?V case when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
+              <td nowrap="nowrap">
+                <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('LS_NAME')" format="%s"/>
+              </td>
+              <td nowrap="nowrap">
+                <v:label value="--sprintf ('%s:%s', (control.vc_parent as vspx_row_template).te_column_value('LS_HOST'), (control.vc_parent as vspx_row_template).te_column_value('LS_PORT'))" format="%s"/>
+              </td>
+              <td nowrap="nowrap">
+                <v:label value="--case when ((control.vc_parent as vspx_row_template).te_column_value('LS_DEFAULT') = 1) then 'Yes' else '' end" format="%s"/>
+              </td>
+              <td nowrap="nowrap">
+                <v:button name="lButton_2" action="simple" style="url" value="''" xhtml_class="img_button">
+                  <v:before-render>
+                    <![CDATA[
+                      control.ufl_value := '<img src="images/icons/confg_16.png" border="0" alt="Edit LDAP Server" title="Edit LDAP Server"/> Edit';
+                    ]]>
+                  </v:before-render>
+                  <v:on-post>
+                    <![CDATA[
+                      self.v_mode := 'LDAP/edit';
+                      self.v_step := '1';
+                      self.v_name := (control.vc_parent as vspx_row_template).te_column_value('LS_NAME');
+                      select LS_HOST,
+                             LS_PORT,
+                             LS_BASE_DN,
+                             LS_BIND_DN,
+                             LS_PASSWORD,
+                             LS_DEFAULT,
+                             deserialize (LS_MAPS)
+                        into self.v_host,
+                             self.v_port,
+                             self.v_base_dn,
+                             self.v_bind_dn,
+                             self.v_password,
+                             self.v_default,
+                             self.v_maps
+                        from LDAP..LDAP_SERVERS
+                       where LS_USER_ID = self.u_id
+                         and LS_NAME = self.v_name;
+
+                      self.vc_data_bind(e);
+                    ]]>
+                  </v:on-post>
+                </v:button>
+                <v:button name="lButton_3" action="simple" style="url" value="''" xhtml_class="img_button">
+                  <v:before-render>
+                    <![CDATA[
+                      control.ufl_value := '<img src="images/icons/trash_16.png" border="0" alt="Delete LDAP Server" title="Delete LDAP Server"/> Delete';
+                    ]]>
+                  </v:before-render>
+                  <v:on-post>
+                    <![CDATA[
+                      delete from LDAP..LDAP_SERVERS where LS_USER_ID = self.u_id and LS_NAME = (control.vc_parent as vspx_row_template).te_column_value('LS_NAME');
+
+                      self.vc_data_bind(e);
+                    ]]>
+                  </v:on-post>
+                </v:button>
+                <v:button name="lButton_4" action="simple" style="url" value="''" xhtml_class="img_button">
+                  <v:before-render>
+                    <![CDATA[
+                      control.ufl_value := '<img src="images/icons/foaf.png" border="0" alt="Generate FOAF" title="Generate FOAF"/>';
+                    ]]>
+                  </v:before-render>
+                  <v:on-post>
+                    <![CDATA[
+                      self.v_name := (control.vc_parent as vspx_row_template).te_column_value('LS_NAME');
+                      self.v_mode := 'LDAP/foaf';
+
+                      declare host varchar;
+
+                      select LS_HOST,
+                             LS_PORT,
+                             LS_BASE_DN,
+                             LS_BIND_DN,
+                             LS_PASSWORD,
+                             LS_DEFAULT,
+                             deserialize (LS_MAPS)
+                        into self.v_host,
+                             self.v_port,
+                             self.v_base_dn,
+                             self.v_bind_dn,
+                             self.v_password,
+                             self.v_default,
+                             self.v_maps
+                        from LDAP..LDAP_SERVERS
+                       where LS_USER_ID = self.u_id
+                         and LS_NAME = self.v_name;
+
+                      connection_set ('LDAP_VERSION', 2);
+                     	host := 'ldap://' || self.v_host || ':' || self.v_port;
+                      self.v_search := '(cn=*)';
+                      self.v_data := ldap_search (host, 0, self.v_base_dn, self.v_search, self.v_bind_dn, self.v_password);
+                      self.vc_data_bind(e);
+                    ]]>
+                  </v:on-post>
+                </v:button>
+              </td>
+            </tr>
+          </table>
+        </v:template>
+
+      </v:template>
+
+      <v:template type="simple" name-to-remove="table" set-to-remove="top">
+        <table>
+          <tr align="center">
+            <td colspan="4">
+              <vm:ds-navigation data-set="ds"/>
+            </td>
+          </tr>
+        </table>
+      </v:template>
+
+    </v:data-set>
+  </vm:if>
+  <v:template name="lTemplate" type="simple" enabled="--case when (self.v_mode = 'LDAP/foaf') then 1 else 0 end">
+    <div><v:label value="--'Export from LDAP Server ' || self.v_name || ' to FOAF'" /></div>
+    <div style="height: 400px; overflow: auto;">
+      <table id="lfoaf" class="listing" cellspacing="0">
+        <tr class="listing_header_row">
+          <th width="1%">
+            <input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, 'cb_item')" />
+          </th>
+          <th>Login Name</th>
+          <th>Description</th>
+        </tr>
+        <?vsp
+          declare N, M integer;
+          declare data, loginPattern, loginData, namePattern any;
+
+          loginPattern := self.ldap_pattern ('P_NAME');
+          namePattern := self.ldap_pattern ('P_FULL_NAME');
+
+          for (N := 0; N < length (self.v_data); N := N + 2) {
+    	      if (self.v_data [N] = 'entry') {
+    	        data := self.v_data [N+1];
+    	        loginData := self.ldap_data (data, loginPattern);
+    	        if (loginData <> '') {
+    	  ?>
+    	  <tr>
+    	    <td width="1%">
+             <?vsp http (sprintf ('<input type="checkbox" name="cb_item" value="%d"', N+1)); ?>
+    		  </td>
+    		  <td>
+    		    <?V substring (loginData, 1, 50) ?>
+    		  </td>
+    		  <td>
+    		    <?V substring (self.ldap_data (data, namePattern), 1, 50) ?>
+    		  </td>
+        </tr>
+    	  <?vsp
+    	        }
+    	      }
+          }
+        ?>
+      </table>
+    </div>
+    <div class="new-form-footer">
+      <v:button name="lButton_5" action="simple" value="Generate FOAF" xhtml_class="form-button">
+        <v:on-post>
+          <![CDATA[
+            declare N, M, L, isFounded integer;
+            declare params, data, loginPattern, loginData, sStream, foafNames any;
+            declare foafName varchar;
+
+            loginPattern := self.ldap_pattern ('P_NAME');
+
+            sStream := string_output();
+            http ('<rdf:RDF xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\n', sStream);
+
+            foafNames := LDAP..foaf_fields ();
+            params := e.ve_params;
+            for (N := 0; N < length (params); N := N + 4)
+            {
+              if (params[N] = 'cb_item')
+              {
+                isFounded := 0;
+                data := self.v_data [cast (params[N+1] as integer)];
+    	          loginData := self.ldap_data (data, loginPattern);
+    	          if (loginData <> '')
+    	          {
+                  http (sprintf ('  <foaf:Person rdf:about="%s">\n', loginData), sStream);
+                  for (M := 0; M < length (data); M := M + 2)
+                  {
+                    if (data[M] <> loginPattern)
+                    {
+                      for (L := 0; L < length (self.v_maps); L := L + 2)
+                      {
+                        if (self.v_maps [L] = data[M])
+                        {
+                          foafName := get_keyword (self.v_maps[L+1], foafNames);
+                          if (not isnull (foafName))
+                            http (sprintf ('    <foaf:%s>%V</foaf:%s>\n', foafName, self.ldap_value (data[M+1]), foafName), sStream);
+                          goto _exit3;
+                        }
+                      }
+                    }
+                  _exit3:;
+                  }
+                  http ('  </foaf:Person>\n', sStream);
+                }
+              }
+            }
+            http ('</rdf:RDF>', sStream);
+
+            http_rewrite ();
+            http_request_status ('HTTP/1.1 200 OK');
+            http_header ('Content-Type: application/x-download\r\n');
+            http_header ('Content-Disposition: inline; filename="ldap.foaf"\r\n');
+            http (string_output_string (sStream));
+            http_flush ();
+
+            self.v_maps := null;
+            self.v_data := null;
+            self.v_mode := 'LDAP/browse';
+            self.vc_data_bind(e);
+          ]]>
+        </v:on-post>
+      </v:button>
+      <v:button name="lButton_6" action="simple" value="Back" xhtml_class="form-button">
+        <v:on-post>
+          <![CDATA[
+            self.v_mode := 'LDAP/browse';
+            self.vc_data_bind(e);
+          ]]>
+        </v:on-post>
+      </v:button>
+    </div>
+  </v:template>
+
+  <vm:if test="(self.v_mode in ('LDAP/add', 'LDAP/edit')) and (self.v_step = '1')">
+    <table class="ctl_grp" cellspacing="0">
+      <tr>
+        <td colspan="2" align="left">
+          <h3>LDAP Server</h3>
+        </td>
+      </tr>
+      <tr>
+        <th width="30%">
+          <vm:label for="ldap_name" value="LDAP server name"/>
+        </th>
+        <td>
+          <v:text name="ldap_name" null-value="--''" value="--self.v_name" xhtml_size="70"/>
+        </td>
+      </tr>
+      <tr>
+        <th>
+          <vm:label for="ldap_host" value="Host URL"/>
+        </th>
+        <td>
+          <v:text name="ldap_host" null-value="--''" value="--self.v_host" xhtml_size="70"/>
+        </td>
+      </tr>
+      <tr>
+        <th>
+          <vm:label for="ldap_port" value="Host port"/>
+        </th>
+        <td>
+          <v:text name="ldap_port" null-value="--''" value="--self.v_port" xhtml_size="10"/>
+        </td>
+      </tr>
+      <tr>
+        <th>
+          <v:label for="ldap_base_dn" value="Base DN"/>
+        </th>
+        <td>
+          <v:text name="ldap_base_dn" null-value="--''" value="--self.v_base_dn" xhtml_size="70"/>
+        </td>
+      </tr>
+      <tr>
+        <th>
+          <v:label for="ldap_bind_dn" value="Bind DN"/>
+        </th>
+        <td>
+          <v:text name="ldap_bind_dn" null-value="--''" value="--self.v_bind_dn" xhtml_size="70"/>
+        </td>
+      </tr>
+      <tr>
+        <th>
+          <v:label for="ldap_password" value="Password"/>
+        </th>
+        <td>
+          <v:text name="ldap_password" type="password" null-value="--''" value="--self.v_password" xhtml_size="30"/>
+        </td>
+      </tr>
+      <tr>
+        <th>
+          <v:label for="ldap_search" value="Search string"/>
+        </th>
+        <td>
+          <v:text name="ldap_search" null-value="--''" value="--self.v_search" xhtml_size="70"/>
+        </td>
+      </tr>
+      <vm:if test="(self.v_default <> 1)">
+        <tr>
+          <th/>
+          <td>
+            <v:check-box name="ldap_default" xhtml_id="ldap_default" is-boolean="1" true-value="1" false-value="0" value="0" />
+            <vm:label for="ldap_default" value="Set as default LDAP server"/>
+          </td>
+        </tr>
+      </vm:if>
+    </table>
+    <div class="new-form-footer">
+      <v:button name="lButton_7" action="simple" value="Next" xhtml_class="form-button">
+        <v:on-post>
+          <![CDATA[
+          	declare host varchar;
+
+            self.v_name := trim (self.ldap_name.ufl_value);
+            self.v_host := trim (self.ldap_host.ufl_value);
+            self.v_port := trim (self.ldap_port.ufl_value);
+            self.v_base_dn := trim (self.ldap_base_dn.ufl_value);
+            self.v_bind_dn := trim (self.ldap_bind_dn.ufl_value);
+            self.v_password := trim (self.ldap_password.ufl_value);
+            self.v_search := trim (self.ldap_search.ufl_value);
+            if (self.v_default <> 1)
+              self.v_default := cast (self.ldap_default.ufl_value as integer);
+
+          	declare exit handler for sqlstate '*'
+          	{
+          	  self.vc_error_message := 'Unknown LDAP server. Please, check parameters!';
+          	  self.vc_is_valid := 0;
+          	  return;
+          	};
+            connection_set ('LDAP_VERSION', 2);
+          	host := 'ldap://' || self.v_host || ':' || self.v_port;
+            self.v_data := ldap_search (host, 0, self.v_base_dn, self.v_search, self.v_bind_dn, self.v_password);
+
+            self.v_step := '2';
+            self.vc_data_bind(e);
+          ]]>
+        </v:on-post>
+      </v:button>
+      <v:button name="lButton_8" action="simple" value="Cancel" xhtml_class="form-button">
+        <v:on-post>
+          <![CDATA[
+            self.v_mode := 'LDAP/browse';
+            self.v_maps := NULL;
+            self.v_data := NULL;
+            self.vc_data_bind(e);
+          ]]>
+        </v:on-post>
+      </v:button>
+    </div>
+  </vm:if>
+  <vm:if test="(self.v_mode in ('LDAP/add', 'LDAP/edit')) and (self.v_step = '2')">
+    <div style="height: 400px; overflow: auto;">
+      <table id="ldap" class="listing" cellspacing="0">
+        <tr class="listing_header_row">
+          <th>LDAP Property</th>
+          <th>User Property</th>
+          <th>Sample Data (based on first record)</th>
+        </tr>
+        <?vsp
+          declare N, M integer;
+          declare data any;
+
+          self.v_fields := LDAP..contact_fields ();
+          for (N := 0; N < length (self.v_data); N := N + 2)
+          {
+    	      if (self.v_data [N] = 'entry')
+    	      {
+    	        data := self.v_data [N+1];
+    	        for (M := 0; M < length (data); M := M + 2)
+    	        {
+    	  ?>
+    	  <tr>
+    	    <td>
+    		    <?V data[M] ?>
+    		  </td>
+    		  <td class="listing_col" nowrap="1">
+    		    <?vsp
+    		      self.render_select (data[M]);
+    		    ?>
+    		  </td>
+    		  <td>
+    		    <?V substring (case when isstring (data[M+1]) then data[M+1] else data[M+1][0] end, 1, 50) ?>
+    		  </td>
+        </tr>
+    	  <?vsp
+              }
+              goto _end;
+    	      }
+          }
+        _end:;
+        ?>
+      </table>
+    </div>
+    <div class="new-form-footer">
+      <v:button name="lButton_9" action="simple" value="Save" xhtml_class="form-button">
+        <v:on-post>
+          <![CDATA[
+            declare N integer;
+            declare params any;
+
+            params := e.ve_params;
+            self.v_maps := vector ();
+            for (N := 0; N < length (params); N := N + 2)
+              if (params[N] like 'sel_%')
+              {
+                if (params[N+1] <> 'skip')
+                {
+                  self.v_maps := vector_concat (self.v_maps, vector (substring (params[N], 5, length (params[N])), params[N+1]));
+                } else {
+                  self.v_maps := vector_concat (self.v_maps, vector (substring (params[N], 5, length (params[N])), ''));
+                }
+              }
+
+            insert replacing LDAP..LDAP_SERVERS (LS_USER_ID, LS_NAME, LS_HOST, LS_PORT, LS_BASE_DN, LS_BIND_DN, LS_PASSWORD, LS_DEFAULT, LS_MAPS)
+              values (self.u_id, self.v_name, self.v_host, self.v_port, self.v_base_dn, self.v_bind_dn, self.v_password, self.v_default, serialize (self.v_maps));
+
+            if (self.v_default = 1)
+              update LDAP..LDAP_SERVERS
+                 set LS_DEFAULT = 0
+               where LS_USER_ID = self.u_id
+                 and LS_NAME <> self.v_name;
+
+            self.v_mode := 'LDAP/browse';
+            self.v_maps := NULL;
+            self.v_data := NULL;
+            self.vc_data_bind(e);
+          ]]>
+        </v:on-post>
+      </v:button>
+      <v:button name="lButton_10" action="simple" value="Cancel" xhtml_class="form-button">
+        <v:on-post>
+          <![CDATA[
+            self.v_mode := 'LDAP/browse';
+            self.v_maps := NULL;
+            self.v_data := NULL;
+            self.vc_data_bind(e);
+          ]]>
+        </v:on-post>
+      </v:button>
+    </div>
+  </vm:if>
+
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_likes.vspx b/appsrc/ODS-Framework/uiedit_likes.vspx
new file mode 100644
index 0000000..b879bb3
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_likes.vspx
@@ -0,0 +1,306 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: uiedit_likes.vspx,v 1.1.4.3 2010/12/07 11:11:31 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2010 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="foaf-import-page"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        style="index.xsl"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+	      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+  <v:variable name="ld_mode" type="varchar" default="'LD/browse'"/>
+
+	<v:variable name="ld_id" type="any" default="null" />
+	<v:variable name="ld_properties" type="any" default="null" />
+	<v:variable name="ld_newProperties" type="any" default="null" />
+
+	<v:form name="usr_personal_10" type="simple" method="POST" xhtml_enctype="multipart/form-data">
+    <h3>Like & DisLikes</h3>
+    <vm:if test="self.ld_mode = 'LD/browse'">
+      <?vsp
+        if (0)
+        {
+      ?>
+        <v:button name="ld_dButton" action="simple" value="Delete">
+          <v:on-post>
+            <![CDATA[
+              delete from DB.DBA.WA_USER_LIKES where WUL_ID = get_keyword ('ld_id', self.vc_page.vc_event.ve_params) and WUL_U_ID = self.u_id;
+              self.vc_data_bind(e);
+            ]]>
+          </v:on-post>
+        </v:button>
+      <?vsp
+        }
+      ?>
+      <input type="hidden" name="ld_id" id="ld_id" value="" />
+      <div style="padding: 0 0 0.5em 0;">
+        <v:button name="ld_aButton" action="simple" style="url" value="''" xhtml_class="img_button">
+          <v:before-render>
+            <![CDATA[
+              control.ufl_value := '<img src="images/icons/add_16.png" border="0" /> Add';
+            ]]>
+          </v:before-render>
+          <v:on-post>
+            <![CDATA[
+              self.ld_mode := 'LD/add';
+              self.ld_flag.ufl_value := null;
+              self.ld_uri.ufl_value := null;
+              self.ld_type.ufl_value := null;
+              self.ld_name.ufl_value := null;
+              self.ld_comment.ufl_value := null;
+              self.ld_properties := ODS..jsonObject ();
+              self.ld_newProperties := vector (vector_concat (ODS..jsonObject (), vector ('id', '0', 'ontology', 'http://ontologi.es/like#', 'items', get_keyword ('products', self.ld_properties, vector ()))));
+
+              self.vc_data_bind(e);
+            ]]>
+          </v:on-post>
+        </v:button>
+      </div>
+
+	    <v:data-set name="ld_ds"
+	                sql="select WUL_ID, WUL_TYPE, WUL_URI, WUL_NAME from DB.DBA.WA_USER_LIKES where WUL_U_ID = :self.u_id"
+		              scrollable="1"
+		              editable="1"
+		              nrows="0">
+
+        <v:template name="ld_ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
+      	  <table class="listing" rules="groups">
+      	    <tr class="listing_header_row">
+      		    <th width="10%">Type</th>
+      		    <th width="45%">Label</th>
+      		    <th width="40%">URI</th>
+      		    <th width="50px">Action</th>
+      	    </tr>
+          </table>
+        </v:template>
+
+        <v:template name="ld_ds_repeat" type="repeat" name-to-remove="" set-to-remove="">
+
+          <v:template name="ld_ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
+            <table>
+              <tr align="center">
+                <td colspan="4">No Likes/DisLikes</td>
+              </tr>
+            </table>
+          </v:template>
+
+          <v:template name="ld_ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
+            <table>
+  			      <tr class="<?V case when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
+                <td nowrap="nowrap">
+                  <v:label value="--case when (control.vc_parent as vspx_row_template).te_column_value('WUL_TYPE') = 'L' then 'Like' else 'DisLike' end" format="%s" name="ld_ds_browse_1_label"/>
+                </td>
+                <td nowrap="nowrap">
+                  <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WUL_NAME')" format="%s" name="ld_ds_browse_2_label"/>
+                </td>
+                <td nowrap="nowrap">
+                  <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WUL_URI')" format="%s" name="ld_ds_browse_3_label"/>
+                </td>
+                <td nowrap="nowrap">
+                  <v:button name="ld_eButton" action="simple" style="url" value="''" xhtml_class="img_button">
+                    <v:before-render>
+                      <![CDATA[
+                        control.ufl_value := '<img src="images/icons/edit_16.png" border="0" alt="Edit Like" title="Edit Like"/> Edit';
+                      ]]>
+                    </v:before-render>
+                    <v:on-post>
+                      <![CDATA[
+                        self.ld_mode := 'LD/edit';
+                        self.ld_id := (control.vc_parent as vspx_row_template).te_column_value('WUL_ID');
+                        select WUL_FLAG,
+                               WUL_URI,
+                               WUL_TYPE,
+                               WUL_NAME,
+                               WUL_COMMENT,
+                               deserialize (WUL_PROPERTIES)
+                          into self.ld_flag.ufl_value,
+                               self.ld_uri.ufl_value,
+                               self.ld_type.ufl_value,
+                               self.ld_name.ufl_value,
+                               self.ld_comment.ufl_value,
+                               self.ld_properties
+                          from DB.DBA.WA_USER_LIKES
+                         where WUL_ID = self.ld_id;
+
+                        self.ld_newProperties := vector (vector_concat (ODS..jsonObject (), vector ('id', '0', 'ontology', 'http://ontologi.es/like#', 'items', get_keyword ('products', self.ld_properties, vector ()))));
+                        self.vc_data_bind(e);
+                      ]]>
+                    </v:on-post>
+                  </v:button>
+                  <span class="button pointer" onclick="javascript: if (confirm('Are you sure you want to delete this record?')) {$('ld_id').value = <?V (control as vspx_row_template).te_column_value('WUL_ID') ?>; doPost('page_form', 'ld_dButton');}">
+                    <img class="button" src="/ods/images/icons/trash_16.png"/> Delete
+                  </span>
+  			        </td>
+  			      </tr>
+            </table>
+		      </v:template>
+		    </v:template>
+
+		    <v:template name="ld_ds_footer" type="simple" name-to-remove="table" set-to-remove="top">
+          <table>
+          </table>
+		    </v:template>
+	    </v:data-set>
+
+    </vm:if>
+
+    <vm:if test="self.ld_mode <> 'LD/browse'">
+  	  <div class="fm">
+				<table>
+				  <tr>
+				    <th width="100px">
+		          Access
+		        </th>
+		        <td>
+              <v:select-list name="ld_flag" xhtml_id="ld_flag">
+                <v:item name="public" value="1" />
+                <v:item name="acl" value="2" />
+                <v:item name="private" value="3" />
+              </v:select-list>
+            </td>
+          </tr>
+				  <tr>
+				    <th>
+		          Type
+		        </th>
+		        <td>
+              <v:select-list name="ld_type" xhtml_id="ld_type">
+                <v:item name="Like" value="L"/>
+                <v:item name="DisLike" value="DL"/>
+              </v:select-list>
+            </td>
+          </tr>
+				  <tr>
+				    <th>
+		          Label (*)
+		        </th>
+		        <td>
+              <v:text name="ld_name" value="" xhtml_id="ld_name" xhtml_size="50" xhtml_class="_validate_" />
+            </td>
+          </tr>
+				  <tr>
+				    <th>
+		          URI (*)
+		        </th>
+		        <td>
+              <v:text name="ld_uri" value="" xhtml_id="ld_uri" xhtml_size="50" xhtml_class="_validate_ _uri_" />
+            </td>
+          </tr>
+				  <tr>
+				    <th valign="top">
+		          Comment
+		        </th>
+		        <td>
+              <v:textarea name="ld_comment" value="" xhtml_id="ld_comment" xhtml_rows="5" xhtml_cols="50"/>
+            </td>
+          </tr>
+				  <tr>
+				    <th valign="top">
+		          Properties
+		        </th>
+		        <td width="800px">
+              <table id="ld_tbl" class="listing">
+                <tbody id="ld_tbody">
+                  <tr id="ld_throbber">
+                    <td>
+                      <img src="/ods/images/oat/Ajax_throbber.gif" />
+                    </td>
+                  </tr>
+                </tbody>
+              </table>
+              <input type="hidden" id="ld_no" name="ld_no" value="1" />
+              <script type="text/javascript">
+                <![CDATA[
+                  ODSInitArray.push (function (){
+                    OAT.Loader.load(["ajax", "json", "combolist"], function(){
+                      RDF.tablePrefix = 'ld';
+                      RDF.tableOptions = {itemType: {fld_1: {cssText: "display: none;"}, btn_1: {cssText: "display: none;"}}};
+                      RDF.itemTypes = <?vsp http (replace (ODS..obj2json (self.ld_newProperties, 10), 'class:', 'className:')); ?>;
+                      RDF.showItemTypes();
+                    });
+                  });
+                ]]>
+              </script>
+            </td>
+          </tr>
+          <tr>
+            <td></td>
+            <td>
+              <br />
+    		      <v:button name="user_c_personal_10" value="Cancel" action="simple">
+    		        <v:on-post>
+                  self.ld_mode := 'LD/browse';
+                  self.vc_data_bind (e);
+    		        </v:on-post>
+    		      </v:button>
+    		      <v:button name="user_s_personal_10" value="--case when self.ld_mode = 'LD/add' then 'Add' else 'Update' end" action="simple" xhtml_onclick="return validateInputs(this);">
+    		        <v:on-post><![CDATA[
+                  if (self.vc_is_valid = 0)
+                    return;
+
+                  declare ontologies, IDs any;
+                  declare products any;
+
+                  IDs := vector ();
+                  ontologies := vector ();
+                  self.getItems ('ld', 'gr', ontologies, IDs);
+                  products := vector ();
+                  if (length (ontologies))
+                    products := get_keyword ('items', ontologies[0], vector());
+
+                  self.ld_properties := vector_concat (ODS..jsonObject (), vector ('version', '1.0', 'products', products));
+                  if (self.ld_mode = 'LD/add')
+                  {
+                    if (exists (select 1 from DB.DBA.WA_USER_LIKES where WUL_U_ID = self.u_id and WUL_NAME = self.ld_name.ufl_value))
+                    {
+                      self.vc_error_message := 'A "Like/DisLike" with same name already exists, please specify unique name.';
+                      self.vc_is_valid := 0;
+                      return;
+                    }
+                    insert into DB.DBA.WA_USER_LIKES (WUL_U_ID, WUL_FLAG, WUL_URI, WUL_TYPE, WUL_NAME, WUL_COMMENT, WUL_PROPERTIES)
+                      values (self.u_id, self.ld_flag.ufl_value, self.ld_uri.ufl_value, self.ld_type.ufl_value, self.ld_name.ufl_value, self.ld_comment.ufl_value, serialize (self.ld_properties));
+                  }
+                  else
+                  {
+                    update DB.DBA.WA_USER_LIKES
+                       set WUL_FLAG = self.ld_flag.ufl_value,
+                           WUL_URI = self.ld_uri.ufl_value,
+                           WUL_TYPE = self.ld_type.ufl_value,
+                           WUL_NAME = self.ld_name.ufl_value,
+                           WUL_COMMENT = self.ld_comment.ufl_value,
+                           WUL_PROPERTIES = serialize (self.ld_properties)
+                     where WUL_ID = self.ld_id;
+                  }
+
+                  self.ld_mode := 'LD/browse';
+                  self.vc_data_bind (e);
+                ]]></v:on-post>
+              </v:button>
+            </td>
+          </tr>
+        </table>
+      </div>
+    </vm:if>
+	</v:form>
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_nav.vspx b/appsrc/ODS-Framework/uiedit_nav.vspx
new file mode 100644
index 0000000..e2430de
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_nav.vspx
@@ -0,0 +1,82 @@
+<v:page name="ui_profile"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+	xmlns:v="http://www.openlinksw.com/vspx/">
+<tr class="navtab_row">
+  <?vsp
+    declare btn varchar;
+
+    btn := case self.pg
+             when 1 then 'user_s_personal_' || cast (self.tabNo as varchar)
+             when 2 then 'user_s_business_' || cast (self.tabNo as varchar)
+             else ''
+           end;
+  ?>
+  <script type="text/javascript">
+    def_btn = '<?V btn ?>';
+  </script>
+<td class="<?V case when self.pg = 1 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
+  <v:url name="b_url01"
+         value="Personal"
+         format="%s"
+         url="--sprintf('uiedit.vspx?page=1')"
+         xhtml_class="tab"/>
+</td>
+<td class="<?V case when self.pg = 2 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
+  <v:url name="b_url02"
+         value="Business"
+         format="%s"
+         url="--sprintf('uiedit_bz.vspx?page=2')"
+         xhtml_class="tab"/>
+</td>
+<td class="<?V case when self.pg = 3 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
+  <v:url name="b_url03"
+         value="Security"
+         format="%s"
+         url="--sprintf('uiedit_sec.vspx?page=3')"
+         xhtml_class="tab"/>
+</td>
+<td class="<?V case when self.pg = 4 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
+  <v:url name="b_url04"
+         value="Associations & Web Services"
+         format="%s"
+         url="--sprintf('uiedit_ws.vspx?page=4')"
+         xhtml_class="tab"/>
+</td>
+<td class="<?V case when self.pg = 5 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
+  <v:url name="b_url05"
+         value="Annotations"
+         format="%s"
+         url="--sprintf('uiedit_ann.vspx?page=5')"
+         xhtml_class="tab"/>
+</td>
+<td class="<?V case when self.pg = 7 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
+  <v:url name="b_url7"
+         value="LDAP Servers"
+         format="%s"
+         url="--sprintf('uiedit_ldap.vspx?page=7')"
+         xhtml_class="tab"/>
+</td>
+<td class="<?V case when self.pg = 8 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
+  <v:url name="b_url8"
+         value="Groups"
+         format="%s"
+         url="--sprintf('uiedit_grp.vspx?page=8')"
+         xhtml_class="tab"/>
+</td>
+<td class="<?V case when self.pg = 9 then 'navtab_sel' else 'navtab' end ?>" nowrap="1">
+  <v:url name="b_url8"
+         value="ACL Sharing"
+         format="%s"
+         url="--sprintf('uiedit_acl.vspx?page=9')"
+         xhtml_class="tab"/>
+</td>
+<td class="page_tab_empty" align="center" width="100%">
+   <table cellpadding="0" cellspacing="0">
+      <tr>
+        <td width="100%"> 
+        </td>
+      </tr>
+   </table>
+</td>
+</tr>
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_offerlist.vspx b/appsrc/ODS-Framework/uiedit_offerlist.vspx
index 1ff9e58..5853b73 100644
--- a/appsrc/ODS-Framework/uiedit_offerlist.vspx
+++ b/appsrc/ODS-Framework/uiedit_offerlist.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_offerlist.vspx,v 1.1.2.9 2010/07/05 08:26:09 source Exp $
+ -  $Id: uiedit_offerlist.vspx,v 1.1.2.13 2011/02/16 20:58:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,10 +32,11 @@
   <v:variable name="ol_mode" type="varchar" default="'OL/browse'"/>
 
 	<v:variable name="ol_id" type="any" default="null" />
+	<v:variable name="ol_type" type="varchar" default="'1'" />
 	<v:variable name="ol_properties" type="any" default="null" />
 	<v:variable name="ol_newProperties" type="any" default="null" />
 
-	<v:form name="usr_personal_8" type="simple" method="POST" xhtml_enctype="multipart/form-data">
+	<v:form name="usr_personal_054" type="simple" method="POST" xhtml_enctype="multipart/form-data">
     <h3>My Offers (GoodRelations Ontologies)</h3>
     <vm:if test="self.ol_mode = 'OL/browse'">
       <?vsp
@@ -64,6 +65,7 @@
           <v:on-post>
             <![CDATA[
               self.ol_mode := 'OL/add';
+              self.ol_flag.ufl_value := null;
               self.ol_offer.ufl_value := null;
               self.ol_comment.ufl_value := null;
               self.ol_properties := ODS..jsonObject ();
@@ -76,7 +78,7 @@
       </div>
 
 	    <v:data-set name="ol_ds"
-	                sql="select WUOL_ID, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = :self.u_id"
+	                sql="select WUOL_ID, WUOL_OFFER, WUOL_COMMENT from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = :self.u_id and WUOL_TYPE = :self.ol_type"
 		              scrollable="1"
 		              editable="1"
 		              nrows="10">
@@ -117,10 +119,12 @@
                       <![CDATA[
                         self.ol_mode := 'OL/edit';
                         self.ol_id := (control.vc_parent as vspx_row_template).te_column_value('WUOL_ID');
-                        select WUOL_OFFER,
+                        select WUOL_FLAG,
+                               WUOL_OFFER,
                                WUOL_COMMENT,
                                deserialize (WUOL_PROPERTIES)
-                          into self.ol_offer.ufl_value,
+                          into self.ol_flag.ufl_value,
+                               self.ol_offer.ufl_value,
                                self.ol_comment.ufl_value,
                                self.ol_properties
                           from DB.DBA.WA_USER_OFFERLIST
@@ -154,6 +158,18 @@
 				<table>
 				  <tr>
 				    <th width="100px">
+		          Access
+		        </th>
+		        <td>
+              <v:select-list name="ol_flag" xhtml_id="ol_flag">
+                <v:item name="public" value="1" />
+                <v:item name="acl" value="2" />
+                <v:item name="private" value="3" />
+              </v:select-list>
+            </td>
+          </tr>
+				  <tr>
+				    <th>
   		          Offer Name
 		        </th>
 		        <td>
@@ -175,6 +191,11 @@
               <td width="800px">
                 <table id="ol_tbl" class="listing">
                   <tbody id="ol_tbody">
+                  <tr id="ol_throbber">
+                    <td>
+                      <img src="/ods/images/oat/Ajax_throbber.gif" />
+                    </td>
+                  </tr>
                   </tbody>
 			  </table>
                 <input type="hidden" id="ol_no" name="ol_no" value="1" />
@@ -196,13 +217,13 @@
             <td></td>
             <td>
               <br />
-  		      <v:button name="user_c_personal_8" value="Cancel" action="simple">
+    		      <v:button name="user_c_personal_054" value="Cancel" action="simple">
 		        <v:on-post>
                 self.ol_mode := 'OL/browse';
                 self.vc_data_bind (e);
 		        </v:on-post>
 		      </v:button>
-  		      <v:button name="user_s_personal_8" value="--case when self.ol_mode = 'OL/add' then 'Add' else 'Update' end" action="simple" xhtml_onclick="return validateInputs(this);">
+    		      <v:button name="user_s_personal_054" value="--case when self.ol_mode = 'OL/add' then 'Add' else 'Update' end" action="simple" xhtml_onclick="return validateInputs(this);">
 		        <v:on-post><![CDATA[
                 if (self.vc_is_valid = 0)
                   return;
@@ -220,19 +241,20 @@
                 self.ol_properties := vector_concat (ODS..jsonObject (), vector ('version', '1.0', 'products', products));
                 if (self.ol_mode = 'OL/add')
               {
-                    if (exists (select 1 from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = self.u_id and WUOL_OFFER = self.ol_offer.ufl_value))
+                    if (exists (select 1 from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = self.u_id and WUOL_TYPE = self.ol_type and WUOL_OFFER = self.ol_offer.ufl_value))
                     {
                       self.vc_error_message := 'An offer with same name already exists, please specify unique name.';
                       self.vc_is_valid := 0;
                       return;
                     }
-                  insert into DB.DBA.WA_USER_OFFERLIST (WUOL_U_ID, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES)
-                  values (self.u_id, self.ol_offer.ufl_value, self.ol_comment.ufl_value, serialize (self.ol_properties));
+                    insert into DB.DBA.WA_USER_OFFERLIST (WUOL_U_ID, WUOL_TYPE, WUOL_FLAG, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES)
+                      values (self.u_id, self.ol_type, self.ol_flag.ufl_value, self.ol_offer.ufl_value, self.ol_comment.ufl_value, serialize (self.ol_properties));
               }
               else
               {
                   update DB.DBA.WA_USER_OFFERLIST
-                   set WUOL_OFFER = self.ol_offer.ufl_value,
+                       set WUOL_FLAG = self.ol_flag.ufl_value,
+                           WUOL_OFFER = self.ol_offer.ufl_value,
                        WUOL_COMMENT = self.ol_comment.ufl_value,
                        WUOL_PROPERTIES = serialize (self.ol_properties)
                    where WUOL_ID = self.ol_id;
diff --git a/appsrc/ODS-Framework/uiedit_others.vspx b/appsrc/ODS-Framework/uiedit_others.vspx
new file mode 100644
index 0000000..2e2aef5
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_others.vspx
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: uiedit_others.vspx,v 1.1.4.2 2010/12/07 11:11:31 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="user_edit_buss"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/"
+        style="index.xsl"
+        xmlns:xhtml="http://www.w3.org/1999/xhtml"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/">
+
+  <div id="o" class="c1">
+    <div class="tabs">
+      <v:url name="o_url_0" xhtml_id="o_url_0" value="Biographical Events" url="--sprintf('uiedit.vspx?page=1&tabNo=5&tabSubNo=0')" xhtml_class="--case when self.tabSubNo = 0 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="o_url_1" xhtml_id="o_url_1" value="Owns"                url="--sprintf('uiedit.vspx?page=1&tabNo=5&tabSubNo=1')" xhtml_class="--case when self.tabSubNo = 1 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="o_url_2" xhtml_id="o_url_2" value="Favorite Things"     url="--sprintf('uiedit.vspx?page=1&tabNo=5&tabSubNo=2')" xhtml_class="--case when self.tabSubNo = 2 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="o_url_3" xhtml_id="o_url_3" value="Creator Of"          url="--sprintf('uiedit.vspx?page=1&tabNo=5&tabSubNo=3')" xhtml_class="--case when self.tabSubNo = 3 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="o_url_4" xhtml_id="o_url_4" value="My Offers"           url="--sprintf('uiedit.vspx?page=1&tabNo=5&tabSubNo=4')" xhtml_class="--case when self.tabSubNo = 4 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="o_url_5" xhtml_id="o_url_5" value="Offers I Seek"       url="--sprintf('uiedit.vspx?page=1&tabNo=5&tabSubNo=5')" xhtml_class="--case when self.tabSubNo = 5 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="o_url_6" xhtml_id="o_url_6" value="Likes & DisLikes"    url="--sprintf('uiedit.vspx?page=1&tabNo=5&tabSubNo=6')" xhtml_class="--case when self.tabSubNo = 6 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="o_url_7" xhtml_id="o_url_7" value="Social Network"    url="--sprintf('uiedit.vspx?page=1&tabNo=5&tabSubNo=7')" xhtml_class="--case when self.tabSubNo = 7 then 'tabX activeTabX' else 'tabX' end"/>
+    </div>
+    <div class="contents">
+      <v:template name="others_template_0" type="simple" enabled="-- equ (self.tabSubNo, 0)">
+        <v:include url="uiedit_personal_5.vspx"/>
+      </v:template>
+      <v:template name="others_template_1" type="simple" enabled="-- equ (self.tabSubNo, 1)">
+        <v:include url="uiedit_owns.vspx"/>
+      </v:template>
+      <v:template name="others_template_2" type="simple" enabled="-- equ (self.tabSubNo, 2)">
+        <v:include url="uiedit_personal_6.vspx"/>
+      </v:template>
+      <v:template name="others_template_3" type="simple" enabled="-- equ (self.tabSubNo, 3)">
+        <v:include url="uiedit_prj.vspx"/>
+      </v:template>
+      <v:template name="others_template_4" type="simple" enabled="-- equ (self.tabSubNo, 4)">
+        <v:include url="uiedit_offerlist.vspx"/>
+      </v:template>
+      <v:template name="others_template_5" type="simple" enabled="-- equ (self.tabSubNo, 5)">
+        <v:include url="uiedit_wishlist.vspx"/>
+      </v:template>
+      <v:template name="others_template_6" type="simple" enabled="-- equ (self.tabSubNo, 6)">
+        <v:include url="uiedit_likes.vspx"/>
+      </v:template>
+      <v:template name="others_template_7" type="simple" enabled="-- equ (self.tabSubNo, 7)">
+        <v:include url="uiedit_knows.vspx"/>
+      </v:template>
+    </div>
+  </div>
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_owns.vspx b/appsrc/ODS-Framework/uiedit_owns.vspx
new file mode 100644
index 0000000..ff10bc1
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_owns.vspx
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: uiedit_owns.vspx,v 1.1.4.3 2011/02/16 20:58:17 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2010 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="owns-page"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        style="index.xsl"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+	      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+  <v:variable name="ow_mode" type="varchar" default="'OW/browse'"/>
+
+	<v:variable name="ow_id" type="any" default="null" />
+	<v:variable name="ow_type" type="varchar" default="'3'" />
+	<v:variable name="ow_properties" type="any" default="null" />
+	<v:variable name="ow_newProperties" type="any" default="null" />
+
+	<v:form name="usr_personal_051" type="simple" method="POST" xhtml_enctype="multipart/form-data">
+    <h3>Owns (GoodRelations Ontologies)</h3>
+    <vm:if test="self.ow_mode = 'OW/browse'">
+      <?vsp
+        if (0)
+        {
+      ?>
+        <v:button name="ow_dButton" action="simple" value="Delete">
+          <v:on-post>
+            <![CDATA[
+              delete from DB.DBA.WA_USER_OFFERLIST where WUOL_ID = get_keyword ('ow_id', self.vc_page.vc_event.ve_params) and WUOL_U_ID = self.u_id;
+              self.vc_data_bind(e);
+            ]]>
+          </v:on-post>
+        </v:button>
+      <?vsp
+        }
+      ?>
+      <input type="hidden" name="ow_id" id="ow_id" value="" />
+      <div style="padding: 0 0 0.5em 0;">
+        <v:button name="ow_aButton" action="simple" style="url" value="''" xhtml_class="img_button">
+          <v:before-render>
+            <![CDATA[
+              control.ufl_value := '<img src="images/icons/add_16.png" border="0" /> Add';
+            ]]>
+          </v:before-render>
+          <v:on-post>
+            <![CDATA[
+              self.ow_mode := 'OW/add';
+              self.ow_flag.ufl_value := null;
+              self.ow_offer.ufl_value := null;
+              self.ow_comment.ufl_value := null;
+              self.ow_properties := ODS..jsonObject ();
+              self.ow_newProperties := vector (vector_concat (ODS..jsonObject (), vector ('id', '0', 'ontology', 'http://purl.org/goodrelations/v1#', 'items', get_keyword ('products', self.ow_properties, vector ()))));
+
+              self.vc_data_bind(e);
+            ]]>
+          </v:on-post>
+        </v:button>
+      </div>
+
+	    <v:data-set name="ow_ds"
+	                sql="select WUOL_ID, WUOL_OFFER, WUOL_COMMENT from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = :self.u_id and WUOL_TYPE = :self.ow_type"
+		              scrollable="1"
+		              editable="1"
+		              nrows="10">
+
+        <v:template name="ow_ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
+      	  <table class="listing" rules="groups">
+      	    <tr class="listing_header_row">
+      		    <th>Name</th>
+      		    <th width="50px">Action</th>
+      	    </tr>
+          </table>
+        </v:template>
+
+        <v:template name="ow_ds_repeat" type="repeat" name-to-remove="" set-to-remove="">
+
+          <v:template name="ow_ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
+            <table>
+              <tr align="center">
+                <td colspan="2">No Owns</td>
+              </tr>
+            </table>
+          </v:template>
+
+          <v:template name="ow_ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
+            <table>
+  			      <tr class="<?V case when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
+                <td nowrap="nowrap" width="100%">
+                  <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WUOL_OFFER')" format="%s" name="ow_ds_browse_1_label"/>
+                </td>
+                <td nowrap="nowrap">
+                  <v:button name="ow_eButton" action="simple" style="url" value="''" xhtml_class="img_button">
+                    <v:before-render>
+                      <![CDATA[
+                        control.ufl_value := '<img src="images/icons/edit_16.png" border="0" alt="Edit Owns" title="Edit Owns"/> Edit';
+                      ]]>
+                    </v:before-render>
+                    <v:on-post>
+                      <![CDATA[
+                        self.ow_mode := 'OW/edit';
+                        self.ow_id := (control.vc_parent as vspx_row_template).te_column_value('WUOL_ID');
+                        select WUOL_FLAG,
+                               WUOL_OFFER,
+                               WUOL_COMMENT,
+                               deserialize (WUOL_PROPERTIES)
+                          into self.ow_flag.ufl_value,
+                               self.ow_offer.ufl_value,
+                               self.ow_comment.ufl_value,
+                               self.ow_properties
+                          from DB.DBA.WA_USER_OFFERLIST
+                         where WUOL_ID = self.ow_id;
+
+                        self.ow_newProperties := vector (vector_concat (ODS..jsonObject (), vector ('id', '0', 'ontology', 'http://purl.org/goodrelations/v1#', 'items', get_keyword ('products', self.ow_properties, vector ()))));
+                        self.vc_data_bind(e);
+                      ]]>
+                    </v:on-post>
+                  </v:button>
+                  <span class="button pointer" onclick="javascript: if (confirm('Are you sure you want to delete this record?')) {$('ow_id').value = <?V (control as vspx_row_template).te_column_value('WUOL_ID') ?>; doPost('page_form', 'ow_dButton');}">
+                    <img class="button" src="/ods/images/icons/trash_16.png"/> Delete
+                  </span>
+  			        </td>
+  			      </tr>
+            </table>
+		      </v:template>
+		    </v:template>
+
+		    <v:template name="ow_ds_footer" type="simple" name-to-remove="table" set-to-remove="top">
+          <table>
+          </table>
+		    </v:template>
+	    </v:data-set>
+
+    </vm:if>
+
+    <vm:if test="self.ow_mode <> 'OW/browse'">
+  	  <div class="fm">
+				<table>
+				  <tr>
+				    <th width="100px">
+		          Access
+		        </th>
+		        <td>
+              <v:select-list name="ow_flag" xhtml_id="ow_flag">
+                <v:item name="public" value="1" />
+                <v:item name="acl" value="2" />
+                <v:item name="private" value="3" />
+              </v:select-list>
+            </td>
+          </tr>
+				  <tr>
+				    <th>
+		          Name
+		        </th>
+		        <td>
+              <v:text name="ow_offer" value="" xhtml_id="ow_offer" xhtml_size="50" xhtml_class="_validate_" />
+            </td>
+          </tr>
+				  <tr>
+				    <th valign="top">
+		          Comment
+		        </th>
+		        <td>
+              <v:textarea name="ow_comment" value="" xhtml_id="ow_comment" xhtml_rows="5" xhtml_cols="50"/>
+            </td>
+          </tr>
+				  <tr>
+				    <th valign="top">
+		          Products
+		        </th>
+		        <td width="800px">
+              <table id="ow_tbl" class="listing">
+                <tbody id="ow_tbody">
+                  <tr id="ow_throbber">
+                    <td>
+                      <img src="/ods/images/oat/Ajax_throbber.gif" />
+                    </td>
+                  </tr>
+                </tbody>
+              </table>
+              <input type="hidden" id="ow_no" name="ow_no" value="1" />
+              <script type="text/javascript">
+                <![CDATA[
+                  ODSInitArray.push (function (){
+                    OAT.Loader.load(["ajax", "json", "combolist"], function(){
+                      RDF.tablePrefix = 'ow';
+                      RDF.tableOptions = {itemType: {fld_1: {cssText: "display: none;"}, btn_1: {cssText: "display: none;"}}};
+                      RDF.itemTypes = <?vsp http (replace (ODS..obj2json (self.ow_newProperties, 10), 'class:', 'className:')); ?>;
+                      RDF.showItemTypes();
+                    });
+                  });
+                ]]>
+              </script>
+            </td>
+          </tr>
+          <tr>
+            <td></td>
+            <td>
+              <br />
+    		      <v:button name="user_c_personal_051" value="Cancel" action="simple">
+    		        <v:on-post>
+                  self.ow_mode := 'OW/browse';
+                  self.vc_data_bind (e);
+    		        </v:on-post>
+    		      </v:button>
+    		      <v:button name="user_s_personal_051" value="--case when self.ow_mode = 'OW/add' then 'Add' else 'Update' end" action="simple" xhtml_onclick="return validateInputs(this);">
+    		        <v:on-post><![CDATA[
+                  if (self.vc_is_valid = 0)
+                    return;
+
+                  declare ontologies, IDs any;
+                  declare products any;
+
+                  IDs := vector ();
+                  ontologies := vector ();
+                  self.getItems ('ow', 'gr', ontologies, IDs);
+                  products := vector ();
+                  if (length (ontologies))
+                    products := get_keyword ('items', ontologies[0], vector());
+
+                  self.ow_properties := vector_concat (ODS..jsonObject (), vector ('version', '1.0', 'products', products));
+                  if (self.ow_mode = 'OW/add')
+                  {
+                    if (exists (select 1 from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = self.u_id and WUOL_TYPE = self.ow_type and WUOL_OFFER = self.ow_offer.ufl_value))
+                    {
+                      self.vc_error_message := 'An offer with same name already exists, please specify unique name.';
+                      self.vc_is_valid := 0;
+                      return;
+                    }
+                    insert into DB.DBA.WA_USER_OFFERLIST (WUOL_U_ID, WUOL_TYPE, WUOL_FLAG, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES)
+                      values (self.u_id, self.ow_type, self.ow_flag.ufl_value, self.ow_offer.ufl_value, self.ow_comment.ufl_value, serialize (self.ow_properties));
+                  }
+                  else
+                  {
+                    update DB.DBA.WA_USER_OFFERLIST
+                       set WUOL_FLAG = self.ow_flag.ufl_value,
+                           WUOL_OFFER = self.ow_offer.ufl_value,
+                           WUOL_COMMENT = self.ow_comment.ufl_value,
+                           WUOL_PROPERTIES = serialize (self.ow_properties)
+                     where WUOL_ID = self.ow_id;
+                  }
+
+                  self.ow_mode := 'OW/browse';
+                  self.vc_data_bind (e);
+                ]]></v:on-post>
+              </v:button>
+            </td>
+          </tr>
+        </table>
+      </div>
+    </vm:if>
+	</v:form>
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_personal.vspx b/appsrc/ODS-Framework/uiedit_personal.vspx
index c499ccc..37c7371 100644
--- a/appsrc/ODS-Framework/uiedit_personal.vspx
+++ b/appsrc/ODS-Framework/uiedit_personal.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_personal.vspx,v 1.33.2.20 2010/07/06 23:09:10 source Exp $
+ -  $Id: uiedit_personal.vspx,v 1.33.2.24 2011/02/18 15:42:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -86,7 +86,7 @@
       declare L integer;
       declare re, reParts any;
       declare itemProperties any;
-      declare property, propNo, propName, propValue, propType any;
+      declare property, propNo, propName, propValue, propType, propLanguage any;
 
 
               itemProperties := vector ();
@@ -102,7 +102,8 @@
                   propName := trim (params[L+1]);
           propType := get_keyword (prefix || '_item_'||ontologyNo||'_prop_'||itemNo||'_fld_2_'||propNo, params, 'data');
           propValue := get_keyword (prefix || '_item_'||ontologyNo||'_prop_'||itemNo||'_fld_3_'||propNo, params);
-                  property := vector_concat (ODS..jsonObject (), vector ('name', propName, 'value', propValue, 'type', propType));
+          propLanguage := get_keyword (prefix || '_item_'||ontologyNo||'_prop_'||itemNo||'_fld_4_'||propNo, params);
+          property := vector_concat (ODS..jsonObject (), vector ('name', propName, 'value', propValue, 'type', propType, 'language', propLanguage));
                   itemProperties := vector_concat (itemProperties, vector (property));
                 }
       _skip:;
@@ -118,12 +119,8 @@
       <v:url name="p_url_1" xhtml_id="p_url_1" value="Main" url="--sprintf('uiedit.vspx?page=1&tabNo=1')" xhtml_class="--case when self.tabNo = 1 then 'tabX activeTabX' else 'tabX' end"/>
       <v:url name="p_url_2" xhtml_id="p_url_2" value="Address" url="--sprintf('uiedit.vspx?page=1&tabNo=2')" xhtml_class="--case when self.tabNo = 2 then 'tabX activeTabX' else 'tabX' end"/>
       <v:url name="p_url_3" xhtml_id="p_url_3" value="Online Accounts" url="--sprintf('uiedit.vspx?page=1&tabNo=3')" xhtml_class="--case when self.tabNo = 3 then 'tabX activeTabX' else 'tabX' end"/>
-      <v:url name="p_url_5" xhtml_id="p_url_4" value="Messaging Services" url="--sprintf('uiedit.vspx?page=1&tabNo=4')" xhtml_class="--case when self.tabNo = 4 then 'tabX activeTabX' else 'tabX' end"/>
-      <v:url name="p_url_4" xhtml_id="p_url_5" value="Biographical Events" url="--sprintf('uiedit.vspx?page=1&tabNo=5')" xhtml_class="--case when self.tabNo = 5 then 'tabX activeTabX' else 'tabX' end"/>
-      <v:url name="p_url_6" xhtml_id="p_url_6" value="Favorite Things" url="--sprintf('uiedit.vspx?page=1&tabNo=6')" xhtml_class="--case when self.tabNo = 6 then 'tabX activeTabX' else 'tabX' end"/>
-      <v:url name="p_url_7" xhtml_id="p_url_7" value="Creator Of" url="--sprintf('uiedit.vspx?page=1&tabNo=7')" xhtml_class="--case when self.tabNo = 7 then 'tabX activeTabX' else 'tabX' end"/>
-      <v:url name="p_url_8" xhtml_id="p_url_8" value="My Offers" url="--sprintf('uiedit.vspx?page=1&tabNo=8')" xhtml_class="--case when self.tabNo = 8 then 'tabX activeTabX' else 'tabX' end"/>
-      <v:url name="p_url_9" xhtml_id="p_url_9" value="Offers I Seek" url="--sprintf('uiedit.vspx?page=1&tabNo=9')" xhtml_class="--case when self.tabNo = 9 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="p_url_4" xhtml_id="p_url_4" value="Messaging Services" url="--sprintf('uiedit.vspx?page=1&tabNo=4')" xhtml_class="--case when self.tabNo = 4 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="p_url_5" xhtml_id="p_url_5" value="Others"             url="--sprintf('uiedit.vspx?page=1&tabNo=5&tabSubNo=0')" xhtml_class="--case when self.tabNo = 5 then 'tabX activeTabX' else 'tabX' end"/>
       </div>
       <div class="contents">
       <v:template name="personal_template_0" type="simple" enabled="-- equ (self.tabNo, 0)">
@@ -142,19 +139,7 @@
         <v:include url="uiedit_personal_4.vspx"/>
               </v:template>
       <v:template name="personal_template_5" type="simple" enabled="-- equ (self.tabNo, 5)">
-        <v:include url="uiedit_personal_5.vspx"/>
-              </v:template>
-      <v:template name="personal_template_6" type="simple" enabled="-- equ (self.tabNo, 6)">
-        <v:include url="uiedit_personal_6.vspx"/>
-          </v:template>
-      <v:template name="personal_template_7" type="simple" enabled="-- equ (self.tabNo, 7)">
-        <v:include url="uiedit_prj.vspx"/>
-      </v:template>
-      <v:template name="personal_template_8" type="simple" enabled="-- equ (self.tabNo, 8)">
-        <v:include url="uiedit_offerlist.vspx"/>
-      </v:template>
-      <v:template name="personal_template_9" type="simple" enabled="-- equ (self.tabNo, 9)">
-        <v:include url="uiedit_wishlist.vspx"/>
+        <v:include url="uiedit_others.vspx"/>
       </v:template>
         </div>
     </div>
diff --git a/appsrc/ODS-Framework/uiedit_personal_0.vspx b/appsrc/ODS-Framework/uiedit_personal_0.vspx
index 4851cd7..f361819 100644
--- a/appsrc/ODS-Framework/uiedit_personal_0.vspx
+++ b/appsrc/ODS-Framework/uiedit_personal_0.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_personal_0.vspx,v 1.1.2.4 2010/05/26 15:25:25 source Exp $
+ -  $Id: uiedit_personal_0.vspx,v 1.1.2.8 2011/01/25 14:11:29 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -65,7 +65,7 @@
       declare M integer;
       declare V any;
 
-      V := vector ('Mr', 'Mrs', 'Dr', 'Ms');
+      V := vector ('Mr', 'Mrs', 'Dr', 'Ms', 'Sir');
       for (M := 0; M < length (V); M := M + 1)
         if (lcase (title) like (lcase (V[M])|| '%'))
           return V[M];
@@ -74,6 +74,54 @@
 	  ]]>
 	</v:method>
 
+  <v:method name="show_data" arglist="inout data any, inout labels any">
+    <![CDATA[
+      declare N, M integer;
+      declare format varchar;
+      declare value any;
+
+      for (N := 0; N < length (data); N := N + 1)
+  	  {
+  	    format := '%s';
+        for (M := 0; M < length (labels); M := M + 1)
+    	  {
+    	    value := get_keyword (labels[M], data[N]);
+    	    if (length (value))
+    	    {
+     	      http (sprintf (format, value));
+    	      format := ' (%s)';
+    	    }
+   	    }
+ 	      http ('<br />');
+  	  }
+	  ]]>
+	</v:method>
+
+  <v:method name="data2string" arglist="inout data any, inout labels any">
+    <![CDATA[
+      declare N, M integer;
+      declare S, format varchar;
+      declare value any;
+
+      S := '';
+      for (N := 0; N < length (data); N := N + 1)
+  	  {
+  	    format := '';
+        for (M := 0; M < length (labels); M := M + 1)
+    	  {
+    	    value := get_keyword (labels[M], data[N]);
+    	    if (length (value))
+    	    {
+            S := S || value || format;
+    	      format := ';';
+    	    }
+   	    }
+        S := S || '\n';
+  	  }
+  	  return S;
+	  ]]>
+	</v:method>
+
   <v:method name="savePersonal_0" arglist="">
     <![CDATA[
       declare params any;
@@ -85,14 +133,12 @@
       if (self.iMode = 0)
       {
         commit work;
-        if (self.i_source_0.ufl_selected)
+        if (self.i_source_0.ufl_selected or (self.iLDAP = 0))
         {
           declare data any;
 
           self.i_source := 0;
-          data := ODS.ODS_API.get_foaf_data_array (self.foaf_url.ufl_value, 0);
-          if (length (data) = 0)
-            data := ODS.ODS_API.get_foaf_data_array (self.foaf_url.ufl_value, 1);
+          data := ODS.ODS_API.getFOAFDataArray (self.foaf_url.ufl_value);
           if (length (data) = 0)
           {
             self.vc_error_message := 'The specified URL doesn\'t contains personal FOAF profile.';
@@ -120,6 +166,7 @@
           self.iTopicInterests := get_keyword ('topic_interest', data);
           self.iOnlineAccounts := get_keyword ('onlineAccounts', data);
           self.iSameAs := get_keyword ('sameAs', data);
+          self.iKnows := get_keyword ('knows', data);
           self.iTags := get_keyword ('tags', data);
 
           self.iMode := 1;
@@ -245,33 +292,63 @@
         if (get_keyword ('cb_item_iLng', params, '0') = '1')
           DB.DBA.WA_USER_EDIT (self.u_name, 'WAUI_LNG', self.iLng);
         if (get_keyword ('cb_item_iTags', params, '0') = '1')
+        {
           if (not isnull (self.iTags))
           {
             self.iTags := DB.DBA.WA_TAG_PREPARE(self.iTags);
             if (DB.DBA.WA_VALIDATE_TAGS(self.iTags))
               WA_USER_TAG_SET(http_nobody_uid(), self.u_id, self.iTags);
           }
+        }
         if (get_keyword ('cb_item_iSameAs', params, '0') = '1')
-          DB.DBA.WA_USER_EDIT (self.u_name, 'WAUI_FOAF', self.iSameAs);
+          DB.DBA.WA_USER_EDIT (self.u_name, 'WAUI_FOAF', self.data2string (self.iSameAs, vector ('value')));
         if (get_keyword ('cb_item_iResume', params, '0') = '1')
           DB.DBA.WA_USER_EDIT (self.u_name, 'WAUI_RESUME', self.iResume);
         if (get_keyword ('cb_item_iInterests', params, '0') = '1')
-          DB.DBA.WA_USER_EDIT (self.u_name, 'WAUI_INTERESTS', self.iInterests);
+          DB.DBA.WA_USER_EDIT (self.u_name, 'WAUI_INTERESTS', self.data2string (self.iInterests, vector ('value', 'label')));
         if (get_keyword ('cb_item_iTopicInterests', params, '0') = '1')
-          DB.DBA.WA_USER_EDIT (self.u_name, 'WAUI_INTEREST_TOPICS', self.iTopicInterests);
+          DB.DBA.WA_USER_EDIT (self.u_name, 'WAUI_INTEREST_TOPICS', self.data2string (self.iTopicInterests, vector ('value', 'label')));
         if (get_keyword ('cb_item_iOnlineAccounts', params, '0') = '1')
+        {
           if (length (self.iOnlineAccounts))
           {
+            declare fld1, fld2 any;
+
             delete from DB.DBA.WA_USER_OL_ACCOUNTS where WUO_U_ID = self.u_id;
-            for (select fld1, fld2 from DB.DBA.WA_USER_INTERESTS (txt) (fld1 varchar, fld2 varchar) P where txt = self.iOnlineAccounts) do
+            foreach (any item in self.iOnlineAccounts) do
         	  {
+              fld1 := get_keyword ('value', item);
         	    if (length (fld1))
         	    {
+                fld2 := get_keyword ('url', item);
                 insert into DB.DBA.WA_USER_OL_ACCOUNTS ( WUO_NAME, WUO_URL, WUO_U_ID, WUO_TYPE)
                   values (fld1, fld2, self.u_id, 'P');
         	    }
         	  }
           }
+        }
+        if (get_keyword ('cb_item_iKnows', params, '0') = '1')
+        {
+          if (length (self.iKnows))
+          {
+            declare fld1, fld2 any;
+
+            delete from DB.DBA.WA_USER_OL_ACCOUNTS where WUO_U_ID = self.u_id;
+            foreach (any item in self.iKnows) do
+        	  {
+              fld1 := get_keyword ('value', item);
+        	    if (length (fld1))
+        	    {
+                if (not exists (select 1 from DB.DBA.WA_USER_KNOWS where WUK_U_ID = self.u_id and WUK_URI = fld1))
+                {
+                  fld2 := get_keyword ('nick', item, get_keyword ('name', item, ''));
+                  insert into DB.DBA.WA_USER_KNOWS (WUK_U_ID, WUK_FLAG, WUK_URI, WUK_LABEL)
+                    values (self.u_id, '1', fld1, fld2);
+                }
+        	    }
+        	  }
+          }
+        }
         commit work;
         self.iMode := 0;
       }
@@ -279,6 +356,7 @@
   </v:method>
 
   <v:variable name="iMode" type="integer" default="0"/>
+  <v:variable name="iLDAP" type="integer" default="0"/>
 
   <v:variable name="iTitle" type="varchar" default="null" />
   <v:variable name="iName" type="varchar" default="null" />
@@ -297,10 +375,11 @@
   <v:variable name="iHomepage" type="varchar" default="null" />
   <v:variable name="iPhone" type="varchar" default="null" />
   <v:variable name="iResume" type="varchar" default="null" />
-  <v:variable name="iInterests" type="varchar" default="null" />
-  <v:variable name="iTopicInterests" type="varchar" default="null" />
-  <v:variable name="iOnlineAccounts" type="varchar" default="null" />
-  <v:variable name="iSameAs" type="varchar" default="null" />
+  <v:variable name="iInterests" type="any" default="null" />
+  <v:variable name="iTopicInterests" type="any" default="null" />
+  <v:variable name="iOnlineAccounts" type="any" default="null" />
+  <v:variable name="iSameAs" type="any" default="null" />
+  <v:variable name="iKnows" type="any" default="null" />
   <v:variable name="iTags" type="varchar" default="null" />
 
   <v:variable name="i_source" type="any" default="-1" />
@@ -315,6 +394,7 @@
         self.usr_personal_0.vc_focus := 1;
         self.usr_personal_0.vc_set_childs_focus(1, e);
       }
+      self.iLDAP := (select count(*) from LDAP..LDAP_SERVERS where LS_USER_ID = self.u_id);
     ]]>
   </v:before-data-bind>
 
@@ -324,22 +404,25 @@
         <table class="ctl_grp">
           <tr>
             <td nowrap="nowrap">
-              <v:radio-button name="i_source_0" xhtml_id="i_source_0" group-name="i_source" value="0">
+              <label>
+                <v:radio-button name="i_source_0" xhtml_id="i_source_0" group-name="i_source" value="0" xhtml_style="--case when self.iLDAP > 0 then '' else 'display: none' end">
                 <v:before-render>
                   <![CDATA[
                     control.ufl_selected := either (lte(self.i_source, 0), 1, 0);
                   ]]>
                 </v:before-render>
               </v:radio-button>
-              <![CDATA[ ]]>
-              <b><label for="i_source_0">Profile Document URL</label></b>
+                Profile Document URL
+              </label>
             </td>
             <td>
-              <v:text name="foaf_url" xhtml_id="foaf_url" value="" xhtml_onfocus="javascript: document.forms[0].i_source[0].checked=true;" xhtml_size="70"/>
+              <v:text name="foaf_url" xhtml_id="foaf_url" value="" xhtml_onfocus="javascript: $(\'i_source_0\').checked=true;" xhtml_size="70"/>
             </td>
           </tr>
+          <v:template name="iTemplate_x" type="simple" condition="self.iLDAP">
           <tr>
             <td nowrap="nowrap">
+                <label>
               <v:radio-button name="i_source_1" xhtml_id="i_source_1" group-name="i_source" value="1">
                 <v:before-render>
                   <![CDATA[
@@ -347,8 +430,8 @@
                   ]]>
                 </v:before-render>
               </v:radio-button>
-              <![CDATA[ ]]>
-              <b><label for="i_source_1">LDAP Server</label></b>
+                  <b>LDAP Server</b>
+                </label>
             </td>
             <td>
               <v:data-list name="f_lName"
@@ -356,9 +439,10 @@
                            key-column="LS_NAME"
                            value-column="LS_NAME"
                            sql="select '' as LS_NAME from SYS_USERS where U_ID = 0 union all select LS_NAME from LDAP..LDAP_SERVERS where LS_USER_ID = self.u_id"
-                           xhtml_onfocus="javascript: document.forms[0].i_source[1].checked=true;" />
+                             xhtml_onfocus="javascript: $(\'i_source_1\').checked=true;" />
             </td>
           </tr>
+          </v:template>
         </table>
       </v:template>
       <v:template name="iTemplate_0" type="simple" condition="self.iMode">
@@ -496,84 +580,41 @@
             <tr>
               <td valign="top"><input type="checkbox" name="cb_item_iSameAs" id="cb_item_iSameAs" value="1" /></td>
               <td valign="top">Other Personal URIs (WebIDs)</td>
-              <td>
-                <?vsp
-                  for (select fld1, fld2 from DB.DBA.WA_USER_INTERESTS (txt) (fld1 varchar, fld2 varchar) P where txt = self.iSameAs) do
-              	  {
-              	    if (length (fld1))
-              	    {
-              	      http (fld1);
-              	      http ('<br />');
-              	    }
-              	  }
-                ?>
-              </td>
+              <td><?vsp self.show_data (self.iSameAs, vector ('value')); ?></td>
             </tr>
           </v:template>
           <v:template name="iTemplate_17" type="simple" condition="length (self.iInterests)">
             <tr>
               <td valign="top"><input type="checkbox" name="cb_item_iInterests" id="cb_item_iInterests" value="1" /></td>
               <td valign="top">Resource URI indicating thing of interest</td>
-              <td>
-                <?vsp
-                  for (select fld1, fld2 from DB.DBA.WA_USER_INTERESTS (txt) (fld1 varchar, fld2 varchar) P where txt = self.iInterests) do
-              	  {
-              	    if (length (fld1))
-              	    {
-              	      http (fld1);
-              	      if (length (fld2))
-              		      http (sprintf (' (%s)', fld2));
-              	      http ('<br />');
-              	    }
-              	  }
-                ?>
-              </td>
+              <td><?vsp self.show_data (self.iInterests, vector ('value', 'label')); ?></td>
             </tr>
           </v:template>
           <v:template name="iTemplate_18" type="simple" condition="length (self.iTopicInterests)">
             <tr>
               <td valign="top"><input type="checkbox" name="cb_item_iTopicInterests" id="cb_item_iTopicInterests" value="1" /></td>
               <td valign="top">Web page URL indicating a topic of interest   </td>
-              <td>
-                <?vsp
-                  for (select fld1, fld2 from DB.DBA.WA_USER_INTERESTS (txt) (fld1 varchar, fld2 varchar) P where txt = self.iTopicInterests) do
-              	  {
-              	    if (length (fld1))
-              	    {
-              	      http (fld1);
-              	      if (length (fld2))
-              		      http (sprintf (' (%s)', fld2));
-              	      http ('<br />');
-              	    }
-              	  }
-                ?>
-              </td>
+              <td><?vsp self.show_data (self.iTopicInterests, vector ('value', 'label')); ?></td>
             </tr>
           </v:template>
           <v:template name="iTemplate_19" type="simple" condition="length (self.iOnlineAccounts)">
             <tr>
               <td valign="top"><input type="checkbox" name="cb_item_iOnlineAccounts" id="cb_item_iOnlineAccounts" value="1" /></td>
               <td valign="top">Online Accounts</td>
-              <td>
-                <?vsp
-                  for (select fld1, fld2 from DB.DBA.WA_USER_INTERESTS (txt) (fld1 varchar, fld2 varchar) P where txt = self.iOnlineAccounts) do
-              	  {
-              	    if (length (fld1))
-              	    {
-              	      http (fld1);
-              	      if (length (fld2))
-              		      http (sprintf (' (%s)', fld2));
-              	      http ('<br />');
-              	    }
-              	  }
-                ?>
-              </td>
+              <td><?vsp self.show_data (self.iOnlineAccounts, vector ('value', 'url')); ?></td>
+            </tr>
+          </v:template>
+          <v:template name="iTemplate_21" type="simple" condition="length (self.iKnows)">
+            <tr>
+              <td valign="top"><input type="checkbox" name="cb_item_iKnows" id="cb_item_iKnows" value="1" /></td>
+              <td valign="top">Knows URIs</td>
+              <td><?vsp self.show_data (self.iKnows, vector ('value')); ?></td>
             </tr>
           </v:template>
         </table>
       </v:template>
       <br />
-      <div>
+      <div class="fm_btn_row clearfix">
         <v:button name="user_c_personal_0" value="Cancel" action="simple" xhtml_onclick="javascript: return initLoadProfile();">
           <v:on-post>
             self.vc_redirect (sprintf ('uhome.vspx?ufname=%U&l=1', self.u_name));
diff --git a/appsrc/ODS-Framework/uiedit_personal_1.vspx b/appsrc/ODS-Framework/uiedit_personal_1.vspx
index 8e69d5d..80f1117 100644
--- a/appsrc/ODS-Framework/uiedit_personal_1.vspx
+++ b/appsrc/ODS-Framework/uiedit_personal_1.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_personal_1.vspx,v 1.1.2.10 2010/04/09 14:40:26 source Exp $
+ -  $Id: uiedit_personal_1.vspx,v 1.1.2.16 2011/01/25 14:11:29 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -256,6 +256,7 @@
       WA_USER_EDIT (self.u_name, 'WAUI_FOAF', self.efoaf);
 
       WA_USER_EDIT (self.u_name, 'WAUI_APP_ENABLE', atoi (self.app_enable.ufl_value));
+      WA_USER_EDIT (self.u_name, 'WAUI_SPB_ENABLE', self.spb_enable.ufl_selected);
       -- change user_text data
       WA_USER_TEXT_SET (self.u_id, WA_GET_USER_INFO (0, self.u_id, WA_USER_VISIBILITY (self.u_name), 0, 1));
     ]]>
@@ -277,11 +278,12 @@
   <v:variable persist="0" name="photo" type="varchar" default="''"/>
   <v:variable persist="0" name="audio" type="varchar" default="''"/>
 
-  <v:variable persist="0" name="issearch" type="int" default="1"/>
+  <v:variable persist="0" name="inSearch" type="int" default="1"/>
   <v:variable persist="0" name="showactive" type="int" default="1"/>
   <v:variable persist="0" name="interests" type="varchar" default="''"/>
   <v:variable persist="0" name="interestTopics" type="varchar" default="''"/>
   <v:variable persist="0" name="appEnable" type="integer" default="0"/>
+  <v:variable persist="0" name="spbEnable" type="integer" default="0"/>
 
   <v:variable name="sav0" type="varchar" default="'1'" />
   <v:variable name="sav1" type="varchar" default="'1'" />
@@ -324,6 +326,7 @@
              WAUI_INTERESTS,
              WAUI_INTEREST_TOPICS,
              WAUI_APP_ENABLE,
+             WAUI_SPB_ENABLE,
              WAUI_NICK,
              U_E_MAIL
         INTO self.utitle,
@@ -338,11 +341,12 @@
              self.summ,
              self.photo,
              self.audio,
-             self.issearch,
+             self.inSearch,
              self.showactive,
              self.interests,
              self.interestTopics,
              self.appEnable,
+             self.spbEnable,
              self.nick,
              self.email
         FROM WA_USER_INFO,
@@ -426,7 +430,6 @@
                     control.ufl_selected := self.is_org;
                 </v:after-data-bind>
               </v:check-box>
-              <![CDATA[ ]]>
               <b>Organization</b>
             </label>
           </td>
@@ -440,6 +443,8 @@
               <v:item name="Mrs" value="Mrs"/>
               <v:item name="Dr" value="Dr"/>
               <v:item name="Ms" value="Ms"/>
+              <v:item name="Sir" value="Sir"/>
+
               <v:before-data-bind>
                 <![CDATA[
                   control.ufl_value := self.utitle;
@@ -485,8 +490,7 @@
         </tr>
         <tr>
           <th>
-            <label for="regmail">E-mail<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
-            <span class="explain"> (mandatory field)</span>
+            <label for="regmail">E-mail<span style="font-weight: normal; color:red;"> *</span><span class="small">Mandatory field, used for notifications, etc.</span></label>
           </th>
           <td class="listing_col" nowrap="nowrap">
             <v:text xhtml_id="regmail" name="regmail" value="--self.email" xhtml_class="_validate_ _mail_" xhtml_style="width:216px" xhtml_onblur="javascript: validateField(this);" />
@@ -548,7 +552,7 @@
                      <?vsp
                        for (select interest from DB.DBA.WA_USER_INTERESTS (txt) (interest varchar) P where txt = self.efoaf) do
                        {
-                           http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x1", null, {fld_1: {value: "%s", className: "_validate_ _url_ _canEmpty_"}});});', interest));
+                           http (sprintf ('ODSInitArray.push(function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x1", null, {fld_1: {value: "%s", className: "_validate_ _webid_ _canEmpty_"}});});});', interest));
                        }
                      ?>
                 		   </script>
@@ -557,7 +561,7 @@
                    </table>
                  </td>
                  <td valign="top" nowrap="1">
-                   <span class="button pointer" onclick="TBL.createRow('x1', null, {fld_1: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                   <span class="button pointer" onclick="TBL.createRow('x1', null, {fld_1: {className: '_validate_ _webid_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                    <vm:u-prop-select name="sel_8" value="self.sav8" />
                  </td>
                </tr>
@@ -565,7 +569,7 @@
            </td>
          </tr>
          <tr id="pers_17" class="initial_hidden">
-           <th><label for="m_sign">Mail Signature</label></th>
+           <th><label for="m_sign">Mail Signature<span class="small">Automatically added to mails sent by you</span></label></th>
            <td class="listing_col" nowrap="1">
              <v:textarea name="m_sign" value="--self.msign" xhtml_rows="4" xhtml_cols="80" fmt-function="wa_utf8_to_wide" error-glyph="*">
                <v:validator test="length" min="0" max="255" name="vv_m_sign1" message="Mail Signature cannot be longer then 255 chars" empty-allowed="1"/>
@@ -581,8 +585,8 @@
            </td>
          </tr>
          <tr>
-          <th><label for="s_tags">Tags</label>
-            <span class="explain"> (comma separated list of keywords)</span>
+          <th>
+            <label for="s_tags">Tags<span class="small">(comma separated list of keywords)</span></label>
           </th>
           <td class="listing_col" nowrap="1">
             <v:textarea name="s_tag" value="--WA_USER_TAG_GET(self.u_name)" xhtml_cols="50" xhtml_rows="5" />
@@ -593,7 +597,7 @@
          </tr>
          <tr>
            <th>
-             <label for="e_int">Web page URL indicating a topic of interest</label>
+             <label>Interest topics<span class="small">Web page URLs indicating topics of interest</span></label>
            </th>
            <td class="listing_col" nowrap="1">
              <table>
@@ -618,12 +622,12 @@
                      <?vsp
                        for (select interest, label from DB.DBA.WA_USER_INTERESTS (txt) (interest varchar, label varchar) P where txt = self.interests) do
                        {
-                           http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x2", null, {fld_1: {value: "%s", className: "_validate_ _url_ _canEmpty_"}, fld_2: {value: "%s"}});});', interest, label));
+                           http (sprintf ('ODSInitArray.push(function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x2", null, {fld_1: {value: "%s", className: "_validate_ _url_ _canEmpty_"}, fld_2: {value: "%s"}});});});', interest, label));
                        }
                      ?>
                 		   </script>
                   	 ]]>
-                     <tr id="x2_tr_no"><td colspan="3"><b>No Topic of Interests</b></td></tr>
+                     <tr id="x2_tr_no"><td colspan="3"><b>No Interests Defined</b></td></tr>
                    </table>
                  </td>
                  <td valign="top" nowrap="1">
@@ -636,7 +640,7 @@
          </tr>
          <tr>
            <th>
-             <label for="e_int2">Resource URI indicating thing of interest</label>
+             <label>Interests<span class="small">Resource URIs indicating thing of interest</span></label>
            </th>
            <td class="listing_col" nowrap="1">
              <table>
@@ -661,12 +665,12 @@
                      <?vsp
                        for (select interest, label from DB.DBA.WA_USER_INTERESTS (txt) (interest varchar, label varchar) P where txt = self.interestTopics) do
                        {
-                           http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x3", null, {fld_1: {value: "%s", className: "_validate_ _url_ _canEmpty_"}, fld_2: {value: "%s"}});});', interest, label));
+                           http (sprintf ('ODSInitArray.push(function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x3", null, {fld_1: {value: "%s", className: "_validate_ _url_ _canEmpty_"}, fld_2: {value: "%s"}});});});', interest, label));
                        }
                      ?>
                 		   </script>
                   	 ]]>
-                     <tr id="x3_tr_no"><td colspan="3"><b>No Thing of Interests</b></td></tr>
+                     <tr id="x3_tr_no"><td colspan="3"><b>No interest URIs</b></td></tr>
                    </table>
                  </td>
                  <td valign="top" nowrap="1">
@@ -802,10 +806,24 @@
            <td> </td>
            <td>
              <label>
+           	   <v:check-box name="spb_enable" value="1" xhtml_id="spb_enable">
+                 <v:after-data-bind>
+                   if (not e.ve_is_post)
+                     control.ufl_selected := self.spbEnable;
+                 </v:after-data-bind>
+               </v:check-box>
+               <b>Enable Semantic Pingback for ACLs</b>
+             </label>
+           </td>
+         </tr>
+         <tr>
+           <td> </td>
+           <td>
+             <label>
                <v:check-box name="in_search" value="1" xhtml_id="in_search" >
                  <v:after-data-bind>
                    if (not e.ve_is_post)
-                     control.ufl_selected := self.issearch;
+                     control.ufl_selected := self.inSearch;
                  </v:after-data-bind>
                </v:check-box>
                <b>Include my profile in search results</b>
@@ -831,7 +849,7 @@
             <v:select-list name="set_personal_1" xhtml_id="set_personal_1" value="0" xhtml_onchange='javascript: setSelectLists (this.value, this.form, "sel_")'>
               <v:item name="*no change*"  value="0" />
               <v:item name="public"  value="1" />
-              <v:item name="friends" value="2" />
+              <v:item name="acl" value="2" />
               <v:item name="private" value="3" />
             </v:select-list>
           </td>
diff --git a/appsrc/ODS-Framework/uiedit_personal_2.vspx b/appsrc/ODS-Framework/uiedit_personal_2.vspx
index 5657981..3d12873 100644
--- a/appsrc/ODS-Framework/uiedit_personal_2.vspx
+++ b/appsrc/ODS-Framework/uiedit_personal_2.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_personal_2.vspx,v 1.2.2.4 2010/03/12 09:10:13 source Exp $
+ -  $Id: uiedit_personal_2.vspx,v 1.2.2.7 2011/01/25 14:11:29 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -277,7 +277,7 @@
               </v:after-data-bind>
             <br/>
             </v:check-box>
-            <label for="set_hlatlng_def">Default map location</label>
+            <label for="set_hlatlng_def">Use as default map location</label>
           </td>
         </tr>
         <tr>
@@ -307,7 +307,7 @@
             <v:select-list name="set_personal_2" xhtml_id="set_personal_2" value="0" xhtml_onchange='javascript: setSelectLists (this.value, this.form, "sel_")'>
               <v:item name="*no change*"  value="0" />
               <v:item name="public"  value="1" />
-              <v:item name="friends" value="2" />
+              <v:item name="acl" value="2" />
               <v:item name="private" value="3" />
             </v:select-list>
           </td>
diff --git a/appsrc/ODS-Framework/uiedit_personal_3.vspx b/appsrc/ODS-Framework/uiedit_personal_3.vspx
index 4c6faad..793214a 100644
--- a/appsrc/ODS-Framework/uiedit_personal_3.vspx
+++ b/appsrc/ODS-Framework/uiedit_personal_3.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_personal_3.vspx,v 1.1.2.5 2010/03/18 10:17:26 source Exp $
+ -  $Id: uiedit_personal_3.vspx,v 1.1.2.11 2010/10/07 13:22:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -53,7 +53,8 @@
           {
             update WA_USER_OL_ACCOUNTS
                set WUO_NAME = trim (params [N+1]),
-                   WUO_URL = trim (get_keyword ('x4_fld_2_'||suffix, params, ''))
+                   WUO_URL = trim (get_keyword ('x4_fld_2_'||suffix, params, '')),
+                   WUO_URI = trim (get_keyword ('x4_fld_3_'||suffix, params, ''))
              where WUO_ID = id;
             IDc := vector_concat (IDc, vector (id));
           }
@@ -77,8 +78,8 @@
           id := cast (get_keyword ('x4_fld_0_'||suffix, params, '-1') as integer);
           if ((id = -1) and (trim (get_keyword ('x4_fld_2_'||suffix, params, '')) <> ''))
         {
-            insert into WA_USER_OL_ACCOUNTS ( WUO_NAME, WUO_URL, WUO_U_ID, WUO_TYPE)
-              values (trim (params [N+1]), trim (get_keyword ('x4_fld_2_'||suffix, params, '')), self.u_id, 'P');
+            insert into WA_USER_OL_ACCOUNTS ( WUO_NAME, WUO_URL, WUO_URI, WUO_U_ID, WUO_TYPE)
+              values (trim (params [N+1]), trim (get_keyword ('x4_fld_2_'||suffix, params, '')), trim (get_keyword ('x4_fld_3_'||suffix, params, '')), self.u_id, 'P');
           }
         }
       }
@@ -107,15 +108,18 @@
     <div>
       <table class="ctl_grp">
         <tr>
-          <td width="600px">
+          <td width="800px">
             <table id="x4_tbl" class="listing">
                 <tr class="listing_header_row">
                   <th>
-                  Select from Service List ot Type New One
+                  Select from Service List or Type New One
                   </th>
                 <th>
-                  Member Home Page URL
+                  Member Home Page URI
                   </th>
+                <th>
+                  Account URI
+                </th>
                 <th width="65px">
                     Action
                   </th>
@@ -123,9 +127,23 @@
             		  <![CDATA[
             		    <script type="text/javascript">
             		    <?vsp
-                  for (select WUO_ID, WUO_NAME, WUO_URL from WA_USER_OL_ACCOUNTS where WUO_TYPE = 'P' and WUO_U_ID = self.u_id) do
+                  for (select WUO_ID, WUO_NAME, WUO_URL, WUO_URI, WUO_OAUTH_SID from WA_USER_OL_ACCOUNTS where WUO_TYPE = 'P' and WUO_U_ID = self.u_id) do
                   {
-                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x4", null, {id: "%d", fld_1: {mode: 10, value: "%s"}, fld_2: {value: "%s", className: "_validate_ _url_ _canEmpty_"}});});', WUO_ID, WUO_NAME, WUO_URL));
+		     http (sprintf (
+		     	'ODSInitArray.push ( function () {
+				OAT.MSG.attach (OAT, "PAGE_LOADED", 
+				function () { 
+				 	TBL.createRow ("x4", null, 
+					{ 
+						id: "%d", 
+						fld_1: {mode: 10, value: "%s"}, 
+						fld_2: {value: "%s", className: "_validate_ _uri_ _canEmpty_"}, 
+						fld_3: {value: "%s"},
+						btn_1: {mode: 0},
+						btn_2: {mode: 44, profile_url: "%s", oauth_sid: "%s", enabled: "%d"},
+					});
+				});
+			});', WUO_ID, WUO_NAME, WUO_URL, WUO_URI, WUO_URL, coalesce (WUO_OAUTH_SID, ''), ODS.ODS_API.oauth_allowed (WUO_URL)));
                   }
             		    ?>
             		    </script>
@@ -134,7 +152,7 @@
             </table>
           </td>
           <td valign="top" nowrap="1">
-            <span class="button pointer" onclick="TBL.createRow('x4', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+            <span class="button pointer" onclick="TBL.createRow('x4', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _uri_ _canEmpty_'}, fld_3: {}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
           </td>
         </tr>
       </table>
diff --git a/appsrc/ODS-Framework/uiedit_personal_4.vspx b/appsrc/ODS-Framework/uiedit_personal_4.vspx
index 06485cd..973e2dc 100644
--- a/appsrc/ODS-Framework/uiedit_personal_4.vspx
+++ b/appsrc/ODS-Framework/uiedit_personal_4.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_personal_4.vspx,v 1.1.2.7 2010/06/30 14:31:03 source Exp $
+ -  $Id: uiedit_personal_4.vspx,v 1.1.2.10 2010/11/09 20:18:23 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -186,7 +186,7 @@
             		    <?vsp
             for (select m_label, m_id from DB.DBA.WA_USER_INTERESTS (txt) (m_label varchar, m_id varchar) P where txt = self.messaging) do
                   {
-              http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x6", null, {fld_1: {value: "%s"}, fld_2: {value: "%s", cssText: "width: 216px;"}});});', m_label, m_id));
+              http (sprintf ('ODSInitArray.push(function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x6", null, {fld_1: {value: "%s"}, fld_2: {value: "%s", cssText: "width: 216px;"}});});});', m_label, m_id));
                   }
             		    ?>
             		    </script>
@@ -199,7 +199,7 @@
             <v:select-list name="set_personal_4" xhtml_id="set_personal_4" value="0" xhtml_onchange='javascript: setSelectLists (this.value, this.form, "sel_")'>
               <v:item name="*no change*"  value="0" />
               <v:item name="public"  value="1" />
-              <v:item name="friends" value="2" />
+              <v:item name="acl" value="2" />
               <v:item name="private" value="3" />
             </v:select-list>
           </td>
diff --git a/appsrc/ODS-Framework/uiedit_personal_5.vspx b/appsrc/ODS-Framework/uiedit_personal_5.vspx
index 65f3a17..3ce2fa0 100644
--- a/appsrc/ODS-Framework/uiedit_personal_5.vspx
+++ b/appsrc/ODS-Framework/uiedit_personal_5.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_personal_5.vspx,v 1.1.2.6 2010/06/30 14:31:03 source Exp $
+ -  $Id: uiedit_personal_5.vspx,v 1.1.2.9 2010/09/20 10:15:30 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -129,7 +129,7 @@
               <?vsp
                   for (select WUB_ID, WUB_EVENT, WUB_DATE, WUB_PLACE from WA_USER_BIOEVENTS where WUB_U_ID = self.u_id) do
                 {
-                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x5", null, {id: "%d", fld_1: {mode: 11, value: "%s"}, fld_2: {value: "%s"}, fld_3: {value: "%s"}});});', WUB_ID, WUB_EVENT, WUB_DATE, WUB_PLACE));
+                    http (sprintf ('ODSInitArray.push(function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("x5", null, {id: "%d", fld_1: {mode: 11, value: "%s"}, fld_2: {mode: 3, value: "%s"}, fld_3: {value: "%s"}});});});', WUB_ID, WUB_EVENT, WUB_DATE, WUB_PLACE));
                 }
               ?>
    		    </script>
@@ -138,7 +138,7 @@
             </table>
           </td>
           <td valign="top" nowrap="1">
-            <span class="button pointer" onclick="TBL.createRow('x5', null, {fld_1: {mode: 11}, fld_2: {}, fld_3: {}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+            <span class="button pointer" onclick="TBL.createRow('x5', null, {fld_1: {mode: 11}, fld_2: {mode: 3}, fld_3: {}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
           </td>
         </tr>
       </table>
diff --git a/appsrc/ODS-Framework/uiedit_personal_6.vspx b/appsrc/ODS-Framework/uiedit_personal_6.vspx
index 9142ace..d7b028d 100644
--- a/appsrc/ODS-Framework/uiedit_personal_6.vspx
+++ b/appsrc/ODS-Framework/uiedit_personal_6.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_personal_6.vspx,v 1.1.2.8 2010/06/30 14:31:03 source Exp $
+ -  $Id: uiedit_personal_6.vspx,v 1.1.2.10 2010/12/07 11:11:31 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -63,6 +63,7 @@
           <v:on-post>
             <![CDATA[
               self.r_mode := 'R/add';
+              self.r_flag.ufl_value := null;
               self.r_label.ufl_value := null;
               self.r_uri.ufl_value := null;
               self.r_properties := vector ();
@@ -82,8 +83,8 @@
         <v:template name="r_ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
       	  <table class="listing" rules="groups">
       	    <tr class="listing_header_row">
-      		    <th>Label</th>
-      		    <th>URI</th>
+      		    <th width="50%">Label</th>
+      		    <th width="50%">URI</th>
       		    <th width="1%" nowrap="nowrap">Action</th>
       	    </tr>
           </table>
@@ -94,7 +95,7 @@
           <v:template name="r_ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
             <table>
               <tr>
-                <td colspan="3">No 'Favorites' Items</td>
+                <td colspan="3">No Favorites</td>
               </tr>
             </table>
           </v:template>
@@ -119,10 +120,12 @@
                       <![CDATA[
                         self.r_mode := 'R/edit';
                         self.r_id := (control.vc_parent as vspx_row_template).te_column_value('WUF_ID');
-                        select WUF_LABEL,
+                        select WUF_FLAG,
+                               WUF_LABEL,
                                WUF_URI,
                                deserialize (WUF_PROPERTIES)
-                          into self.r_label.ufl_value,
+                          into self.r_flag.ufl_value,
+                               self.r_label.ufl_value,
                                self.r_uri.ufl_value,
                                self.r_properties
                           from DB.DBA.WA_USER_FAVORITES
@@ -175,7 +178,19 @@
   	  <div class="fm">
 				<table>
         <tr>
-				    <th width="120px">
+				    <th width="100px">
+		          Access
+		        </th>
+		        <td>
+              <v:select-list name="r_flag" xhtml_id="r_flag">
+                <v:item name="public" value="1" />
+                <v:item name="acl" value="2" />
+                <v:item name="private" value="3" />
+              </v:select-list>
+            </td>
+          </tr>
+				  <tr>
+				    <th>
 		          Label (*)
                   </th>
 		        <td>
@@ -192,7 +207,7 @@
                 </tr>
 				  <tr>
 				    <th valign="top">
-		          Item Properties
+		          Properties
 		        </th>
 		        <td width="800px">
               <table id="r_tbl" class="listing">
@@ -252,11 +267,12 @@
                     properties := self.getProperties('r', params, '0', '0');
                     if (self.r_mode = 'R/add')
                     {
-                      insert into DB.DBA.WA_USER_FAVORITES (WUF_U_ID, WUF_TYPE, WUF_CLASS, WUF_LABEL, WUF_URI, WUF_PROPERTIES)
-                        values (self.u_id, 'http://rdfs.org/sioc/ns#', 'sioc:Item', self.r_label.ufl_value, self.r_uri.ufl_value, serialize (properties));
+                      insert into DB.DBA.WA_USER_FAVORITES (WUF_U_ID, WUF_FLAG, WUF_TYPE, WUF_CLASS, WUF_LABEL, WUF_URI, WUF_PROPERTIES)
+                        values (self.u_id, self.r_flag.ufl_value, 'http://rdfs.org/sioc/ns#', 'sioc:Item', self.r_label.ufl_value, self.r_uri.ufl_value, serialize (properties));
                     } else {
                       update DB.DBA.WA_USER_FAVORITES
-                         set WUF_LABEL = self.r_label.ufl_value,
+                         set WUF_FLAG = self.r_flag.ufl_value,
+                             WUF_LABEL = self.r_label.ufl_value,
                              WUF_URI = self.r_uri.ufl_value,
                              WUF_PROPERTIES = serialize (properties)
                        where WUF_ID = self.r_id;
diff --git a/appsrc/ODS-Framework/uiedit_prj.vspx b/appsrc/ODS-Framework/uiedit_prj.vspx
index 75ab881..1b4f727 100644
--- a/appsrc/ODS-Framework/uiedit_prj.vspx
+++ b/appsrc/ODS-Framework/uiedit_prj.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_prj.vspx,v 1.12.2.5 2010/06/28 09:46:28 source Exp $
+ -  $Id: uiedit_prj.vspx,v 1.12.2.6 2010/09/20 10:15:30 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/uiedit_pwd.vspx b/appsrc/ODS-Framework/uiedit_pwd.vspx
index 2415be7..80b6388 100644
--- a/appsrc/ODS-Framework/uiedit_pwd.vspx
+++ b/appsrc/ODS-Framework/uiedit_pwd.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_pwd.vspx,v 1.15.2.6 2010/07/05 08:26:09 source Exp $
+ -  $Id: uiedit_pwd.vspx,v 1.15.2.15 2011/03/08 13:28:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -41,6 +41,7 @@
   <v:variable persist="0" name="fbLoginID" type="varchar" default="''"/>
   <v:variable persist="0" name="tab_no" type="int" default="0" param-name="tabNo"/>
   <v:variable persist="temp" name="cert_del"  type="int" default="0" param-name="cert_del"/>
+  <v:variable persist="temp" name="key_del"  type="varchar" default="null" param-name="key_del"/>
   <v:variable persist="0" name="cert_edit" type="int" default="null" param-name="cert_edit"/>
     <v:before-data-bind>
       <![CDATA[
@@ -50,7 +51,7 @@
              WAUI_SEC_ANSWER,
              pwd_magic_calc (U_NAME, U_PASSWORD, 1),
 	     WAUI_OPENID_URL,
-		   WAUI_FACEBOOK_LOGIN_ID
+		         WAUI_FACEBOOK_ID
         INTO self.secretq,
              self.secreta,
              pwd,
@@ -85,25 +86,61 @@
  <br/>
   <div id="b" class="c1">
     <div class="tabs">
-      <v:url name="sec_url_0" value="Password Settings" url="--sprintf('uiedit.vspx?page=3&tabNo=0')" xhtml_class="--case when self.tabNo = 0 then 'tabX activeTabX' else 'tabX' end"/>
-      <v:url name="sec_url_3" value="Password recovery" url="--sprintf('uiedit.vspx?page=3&tabNo=3')" xhtml_class="--case when self.tabNo = 3 then 'tabX activeTabX' else 'tabX' end"/>
-      <v:url name="sec_url_1" value="OpenID" url="--sprintf('uiedit.vspx?page=3&tabNo=1')" xhtml_class="--case when self.tabNo = 1 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="sec_url_0" value="Password" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=0')" xhtml_class="--case when self.tabNo = 0 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="sec_url_3" value="Password recovery" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=3')" xhtml_class="--case when self.tabNo = 3 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="sec_url_1" value="OpenID" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=1')" xhtml_class="--case when self.tabNo = 1 then 'tabX activeTabX' else 'tabX' end"/>
     <vm:if test="not isnull (self.fb)">
-	<v:url name="sec_url_2" value="Facebook" url="--sprintf('uiedit.vspx?page=3&tabNo=2')" xhtml_class="--case when self.tabNo = 2 then 'tabX activeTabX' else 'tabX' end"/>
+	<v:url name="sec_url_2" value="Facebook" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=2')" xhtml_class="--case when self.tabNo = 2 then 'tabX activeTabX' else 'tabX' end"/>
     </vm:if>
-      <v:url name="sec_url_4" value="Limits" url="--sprintf('uiedit.vspx?page=3&tabNo=4')" xhtml_class="--case when self.tabNo = 4 then 'tabX activeTabX' else 'tabX' end"/>
-      <v:url name="sec_url_5" value="X.509 Certificates" url="--sprintf('uiedit.vspx?page=3&tabNo=5')" xhtml_class="--case when self.tabNo = 5 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="sec_url_4" value="Limits" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=4')" xhtml_class="--case when self.tabNo = 4 then 'tabX activeTabX' else 'tabX' end"/>
+  <?vsp 
+       declare ua any;
+       ua := http_request_header (http_request_header (), 'User-Agent');
+       if (coalesce (strstr (ua, 'MSIE'), -1) > 0 or regexp_match ('Mozilla.*Windows.*Firefox.*\.NET CLR .*', ua) is not null)
+       {
+	 declare svc_url varchar;
+	 svc_url := (select  top 1 WS_CERT_GEN_URL from DB.DBA.WA_SETTINGS);
+
+          if (length (svc_url))
+          {
+            for (select U_NAME, U_FULL_NAME, U_E_MAIL, WAUI_BORG, WAUI_BCOUNTRY
+                   from SYS_USERS, VSPX_SESSION, WA_USER_INFO
+                  where VS_SID = self.sid and VS_REALM = 'wa' and VS_UID = U_NAME and U_ID = WAUI_U_ID) do
+            {
+            declare url, webid varchar;
+
+            webid := sioc..person_iri (sioc..user_obj_iri (U_NAME));
+              url := sprintf ('%s?uri=%U&name=%U&email=%U&organization=%U', svc_url, webid, coalesce (U_FULL_NAME, U_NAME), coalesce (U_E_MAIL, ''), coalesce (WAUI_BORG, ''));
+
+     ?>
+ 	  <a name="sec_url" href='<?vsp http (url); ?>' class="tabX">Certificate Generator</a>
+     <?vsp
+	     }
+	   }
+	  else if (regexp_match ('Mozilla.*Windows.*Firefox.*\.NET CLR .*', ua) is not null)
+	  goto no_gen_svc;
+	 }
+	 else
+        {
+	  no_gen_svc:;
+      ?>
+      <v:url name="sec_url_6" value="Certificate Generator" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=6')" xhtml_class="--case when self.tabNo = 6 then 'tabX activeTabX' else 'tabX' end"/>
+      <?vsp
+          }
+       ?>
+      <v:url name="sec_url_5" value="X.509 Certificates" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=5')" xhtml_class="--case when self.tabNo = 5 then 'tabX activeTabX' else 'tabX' end"/>
+      <v:url name="sec_url_6" value="Private Keys" url="--sprintf('uiedit_sec.vspx?page=3&tabNo=7')" xhtml_class="--case when self.tabNo = 7 then 'tabX activeTabX' else 'tabX' end"/>
     </div>
     <div class="contents">
-  <v:form name="usr_pwd" type="simple" method="POST" action="uiedit.vspx?page=3">
+  <v:form name="usr_pwd" type="simple" method="POST" action="uiedit_sec.vspx?page=3">
       <v:template name="sec_tmpl_0" type="simple" enabled="-- equ (self.tab_no, 0)">
 	  <input type="hidden" value="0" name="tabNo" /> 
-    <fieldset>
-			<legend><b>Password Settings</b></legend>
+          <h2>Change login password</h2>
+          <p class="fm_expln">For your security, please use a password not found in a dictionary, consisting of both letters, and numbers or non-alphanumeric characters.</p>
 			<table>
 	      <?vsp if (not self.no_pwd) { ?>
               <tr>
-                <th><label for="opwd1">Old password</label></th>
+                <th width="135px"><label for="opwd1">Old password</label></th>
                 <td>
                   <v:text xhtml_id="opwd1" name="opwd1" value="" type="password" error-glyph="*"/>
                 </td>
@@ -189,17 +226,17 @@
                 </td>
               </tr>
       </table>
-    </fieldset>
       </v:template>
       <v:template name="sec_tmpl_1" type="simple" enabled="-- equ (self.tab_no, 1)">
 	  <input type="hidden" value="1" name="tabNo" /> 
-    <fieldset>
-			<legend><b>OpenID</b></legend>
+          <br />
 			<table>
               <tr>
-                <th><label for="oid_url1">OpenID URL</label></th>
+              <th width="135px">
+                <label for="oid_url1">OpenID URL</label>
+              </th>
                 <td nowrap="nowrap">
-          <v:text error-glyph="*" xhtml_id="oid_url1" name="oid_url1" value="--self.oid_urlv" xhtml_size="100" xhtml_class="_validate_ _url_ _canEmpty_" xhtml_onblur="javascript: validateField(this);" />
+            <v:text error-glyph="*" xhtml_id="oid_url1" name="oid_url1" value="--self.oid_urlv" xhtml_size="100" xhtml_class="_validate_ _uri_ _canEmpty_" xhtml_onblur="javascript: validateField(this);" />
                   <div style="display:inline; color:red;"><v:error-summary match="oid_url1" /></div>
                 </td>
               </tr>
@@ -221,7 +258,7 @@
 			    self.vc_error_message := err;
 			    return;
 			  }
-                    self.vc_redirect ('uiedit.vspx?page=3&tabNo=1');
+                    self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=1');
                       ]]>
                     </v:on-post>
 		</v:button>
@@ -229,26 +266,37 @@
                 </td>
               </tr>
       </table>
-    </fieldset>
       </v:template>
     <vm:if test="not isnull (self.fb)">
       <v:template name="sec_tmpl_2" type="simple" enabled="-- equ (self.tab_no, 2)">
 	  <input type="hidden" value="2" name="tabNo" /> 
-      <fieldset>
-  			<legend><b>Facebook</b></legend>
+            <br />
   			<table>
         <tr>
-          <th><label>Saved Facebook ID</label></th>
+                <th width="135px">
+                  <label>Saved Facebook ID</label>
+                </th>
           <td nowrap="nowrap">
             <?vsp
-              if (isnull (self.fbLoginID))
+              if (DB.DBA.is_empty_or_null (self.fbLoginID))
               {
                 http ('not yet');
               } else {
+                {
+                  declare exit handler for sqlstate '*'
+                	{
+                    http ('bad connection/user');
+                	  goto _next;
+                	};
                 declare _res any;
-                _res := self.fb.api_client.users_getInfo(self.fbLoginID, 'name');
 
-                http (serialize_to_UTF8_xml (xpath_eval('string(/users_getInfo_response/user/name)', _res)));
+                  _res := serialize_to_UTF8_xml (xpath_eval('string(/users_getInfo_response/user/name)', self.fb.api_client.users_getInfo(self.fbLoginID, 'name')));
+                  if (DB.DBA.is_empty_or_null (_res))
+                    signal ('23023', '');
+
+                  http (_res);
+                }
+              _next:;
               }
             ?>
           </td>
@@ -275,14 +323,14 @@
                     if (self.vc_is_valid = 0)
                       return;
 
-                    if (exists (select 1 from WA_USER_INFO where WAUI_U_ID <> self.u_id and WAUI_FACEBOOK_LOGIN_ID = self.fb._user))
+                    if (exists (select 1 from WA_USER_INFO where WAUI_U_ID <> self.u_id and WAUI_FACEBOOK_ID = self.fb._user))
                     {
                       self.vc_error_message := 'This Facebook identity is already registered.';
                       self.vc_is_valid := 0;
                       return;
                     }
-                    WA_USER_EDIT (self.u_name, 'WAUI_FACEBOOK_LOGIN_ID', self.fb._user);
-                    self.vc_redirect ('uiedit.vspx?page=3&tabNo=2');
+                    WA_USER_EDIT (self.u_name, 'WAUI_FACEBOOK_ID', self.fb._user);
+                    self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=2');
                   ]]>
                 </v:on-post>
               </v:button>
@@ -292,8 +340,8 @@
                     if (self.vc_is_valid = 0)
                       return;
 
-                    WA_USER_EDIT (self.u_name, 'WAUI_FACEBOOK_LOGIN_ID', null);
-                    self.vc_redirect ('uiedit.vspx?page=3&tabNo=2');
+                    WA_USER_EDIT (self.u_name, 'WAUI_FACEBOOK_ID', null);
+                    self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=2');
                   ]]>
                 </v:on-post>
               </v:button>
@@ -301,16 +349,17 @@
                 </td>
               </tr>
         </table>
-      </fieldset>
 </v:template>
     </vm:if>
       <v:template name="sec_tmpl_3" type="simple" enabled="-- equ (self.tab_no, 3)">
 	  <input type="hidden" value="3" name="tabNo" /> 
-    <fieldset>
-			<legend><b>Password Recovery</b></legend>
+          <h2>Password recovery questions</h2>
+          <p class="fm_expln">Manage password recovery procedure. Set verification question / answer.</p>
 			<table>
               <tr>
-                <th><label for="sec_question">Secret question</label></th>
+              <th width="135px">
+                <label for="sec_question">Secret question</label>
+              </th>
                 <td nowrap="nowrap">
                   <v:text error-glyph="*" name="sec_question" xhtml_id="sec_qst" value="--self.secretq">
                     <v:validator test="length" min="0" max="800" message="Security question cannot be longer then 800 chars" empty-allowed="1" name="vv_secq1"/>
@@ -355,7 +404,7 @@
 
                         WA_USER_EDIT (self.u_name, 'SEC_QUESTION', self.sec_question.ufl_value);
                         WA_USER_EDIT (self.u_name, 'SEC_ANSWER', self.sec_answer.ufl_value);
-                    self.vc_redirect ('uiedit.vspx?page=3&tabNo=3');
+                    self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=3');
                       ]]>
                     </v:on-post>
 		</v:button>
@@ -363,15 +412,13 @@
                 </td>
               </tr>
       </table>
-    </fieldset>
   </v:template>
       <v:template name="sec_tmpl_4" type="simple" enabled="-- equ (self.tab_no, 4)">
 	  <input type="hidden" value="4" name="tabNo" /> 
-    <fieldset>
-			<legend><b>Applications restrictions</b></legend>
+          <h2>Applications restrictions</h2>
 			<table>
               <tr>
-                <th><label for="sioc_limit1">SIOC query result limit</label></th>
+              <th width="135px"><label for="sioc_limit1">SIOC query result limit</label></th>
                 <td nowrap="nowrap">
             <v:text error-glyph="*" xhtml_id="sioc_limit1" name="sioc_limit1" value="--self.sioc_limit" />
                   <div style="display:inline; color:red;"><v:error-summary match="sioc_limit" /></div>
@@ -397,7 +444,7 @@
                     }
 
                     USER_SET_OPTION (self.u_name, 'SIOC_POSTS_QUERY_LIMIT', self.sioc_limit1.ufl_value);
-                    self.vc_redirect ('uiedit.vspx?page=3&tabNo=4');
+                    self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=4');
                       ]]>
                     </v:on-post>
 		</v:button>
@@ -405,27 +452,34 @@
                 </td>
               </tr>
       </table>
-    </fieldset>
   </v:template>
       <v:template name="sec_tmpl_5" type="simple" enabled="-- equ (self.tab_no, 5)">
+          <h2>User Certificates</h2>
+          <p>Manage certificates used for authentication.</p>
 	  <input type="hidden" value="5" name="tabNo" /> 
 	  <table class="listing">
 	      <tr class="listing_header_row">
 		  <th>Subject</th>
+		  <th>Created</th>
+		  <th>Fingerprint</th>
 		  <th>Login enabled</th>
 		  <th>Action</th>
 	      </tr>
 		  <?vsp 
 		  if (self.cert_del is not null)
 		    delete from WA_USER_CERTS where UC_ID = self.cert_del and UC_U_ID = self.u_id;
-		  for select UC_ID, UC_CERT, UC_LOGIN, UC_FINGERPRINT from WA_USER_CERTS where UC_U_ID = self.u_id do {
+
+              for (select UC_ID, UC_CERT, UC_LOGIN, UC_FINGERPRINT, UC_TS from WA_USER_CERTS where UC_U_ID = self.u_id order by UC_TS desc) do
+              {
 		  ?>
 		  <tr>
 		      <td><?vsp http_value (get_certificate_info (2, cast (UC_CERT as varchar), 0, ''), 'b'); ?></td>
+		      <td><?vsp http_value (wa_abs_date (UC_TS), 'b'); ?></td>
+		      <td><?vsp http_value (UC_FINGERPRINT, 'b'); ?></td>
 		      <td><?V case when UC_LOGIN = 1 then 'Yes' else 'No' end ?></td>
 		      <td>
-			  <v:url name="ce1" value="Edit" url="--sprintf ('uiedit.vspx?page=3&tabNo=5&cert_edit=%d', UC_ID)" render-only="1"/>
-			  <v:url name="ce2" value="Delete" url="--sprintf ('uiedit.vspx?page=3&tabNo=5&cert_del=%d', UC_ID)" render-only="1"/>
+			  <v:url name="ce1" value="Edit" url="--sprintf ('uiedit_sec.vspx?page=3&tabNo=5&cert_edit=%d', UC_ID)" render-only="1"/>
+			  <v:url name="ce2" value="Delete" url="--sprintf ('uiedit_sec.vspx?page=3&tabNo=5&cert_del=%d', UC_ID)" render-only="1"/>
 		      </td>
 		  </tr>	    
 		  <?vsp 
@@ -433,9 +487,8 @@
 		  ?>
 	  </table>
 	  <br/>
-    <fieldset>
-			<legend><b>X.509 Certificate</b></legend>
-			<table>
+          <h3>X.509 Certificate</h3>
+			<table width="100%">
       <tr>
 	  <td colspan="2" align="left">
 	      <?vsp if (length (self.certificate_content)) { ?>
@@ -448,7 +501,7 @@
 	      <div>
 		  <label>Agent ID:</label>
 		  <?vsp
-		          http_value (replace (get_certificate_info (7, cast(self.certificate_content as varchar), 0, '', '2.5.29.17'), 'URI:', ''),'b');
+  		          http_value (ODS.ODS_API.SSL_WEBID_GET (cast(self.certificate_content as varchar)),'b');
 		  ?>
 	      </div>
   	        <div>
@@ -460,9 +513,6 @@
 	      <?vsp } ?>
 	    <v:textarea name="cert1" value="--self.certificate_content" xhtml_cols="70" xhtml_rows="20" />
   	          <!--?vsp if (not length (self.certificate_content) and xenc_key_exists ('id_rsa')) { ?-->
-	    <iframe id="cert" src="cert.vsp?sid=<?V self.sid ?>" width="200" height="200" frameborder="0" scrolling="no">
-	       <p>Your browser does not support iframes.</p>
-	   </iframe>
   	        <!--?vsp } ?-->
 	</td>
       </tr>
@@ -483,18 +533,22 @@
         <td colspan="2" class="ctrl">
           <span class="fm_ctl_btn">
               <v:button name="bt_cncl_6" value="Cancel" action="simple" >
-		  <v:on-post><![CDATA[
-                    self.vc_redirect ('uiedit.vspx?page=3&tabNo=5');
-		    ]]></v:on-post>
+                      <v:on-post>
+                        <![CDATA[
+                    self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=5');
+                        ]]>
+                      </v:on-post>
             </v:button>
             <v:button name="bt_set2" value="Save Certificate" action="simple">
               <v:on-post>
                 <![CDATA[
-		  declare agent varchar;
+  		    declare agent, mail varchar;
+
                   if(self.vc_is_valid = 0)
                     return;
-                  agent := get_certificate_info (7, self.cert1.ufl_value, 0, '', '2.5.29.17');
-                    if ((agent is null and length (self.cert1.ufl_value)) or (0 = length (self.cert1.ufl_value)))
+                    agent := ODS.ODS_API.SSL_WEBID_GET (self.cert1.ufl_value);
+                    mail := FOAF_SSL_MAIL_GET (self.cert1.ufl_value);
+                    if ((agent is null and mail is null and length (self.cert1.ufl_value)) or (0 = length (self.cert1.ufl_value)))
 		    {
                       self.vc_is_valid := 0;
 		      self.vc_error_message := 'The certificate must be in PEM format and must have Alternate Name attribute.';
@@ -502,19 +556,20 @@
 		    }
 		    if (self.cert_edit is null)
                       {
-		        insert into WA_USER_CERTS (UC_U_ID, UC_CERT, UC_FINGERPRINT, UC_LOGIN) 
-		         values (self.u_id, self.cert1.ufl_value, get_certificate_info (6, self.cert1.ufl_value, 0, ''), self.cert_login.ufl_selected);
+		        insert into WA_USER_CERTS (UC_U_ID, UC_CERT, UC_FINGERPRINT, UC_LOGIN, UC_TS) 
+		         values (self.u_id, self.cert1.ufl_value, get_certificate_info (6, self.cert1.ufl_value, 0, ''), self.cert_login.ufl_selected, now ());
 		      }
 		    else
 		      {
-		        update WA_USER_CERTS set UC_CERT = self.cert1.ufl_value, 
+                            update WA_USER_CERTS
+                               set UC_CERT = self.cert1.ufl_value,
 			 	UC_FINGERPRINT = get_certificate_info (6, self.cert1.ufl_value, 0, ''),
 				UC_LOGIN = self.cert_login.ufl_selected
 				where UC_U_ID = self.u_id and UC_ID = self.cert_edit ;
 			self.cert_edit := null;	
 		      }   
 		    commit work;  
-                    self.vc_redirect ('uiedit.vspx?page=3&tabNo=5');
+                    self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=5');
                 ]]>
               </v:on-post>
             </v:button>
@@ -522,7 +577,226 @@
         </td>
       </tr>
     </table>
-    </fieldset>
+  </v:template>
+      <v:template name="sec_tmpl_6" type="simple" enabled="-- equ (self.tab_no, 6)">
+	  <input type="hidden" value="6" name="tabNo" />
+            <h3>X.509 Certificate Parameters</h3>
+            <iframe id="cert" src="cert.vsp?sid=<?V self.sid ?>" width="650" height="270" frameborder="0" scrolling="auto">
+  	            <p>Your browser does not support iframes.</p>
+  	          </iframe>
+  </v:template>
+      <v:template name="sec_tmpl_7" type="simple" enabled="-- equ (self.tab_no, 7)">
+	  <input type="hidden" value="7" name="tabNo" />
+	  <table class="listing">
+	      <tr class="listing_header_row">
+		  <th>Name</th>
+		  <th>Type</th>
+		  <th>Action</th>
+	      </tr>
+		  <?vsp
+		  declare key_no, sk int;
+		  if (self.key_del is not null)
+		    {
+		      USER_KEY_DELETE (self.u_name, self.key_del);
+                      set_user_id (self.u_name);
+		      xenc_key_remove (self.key_del);
+		      set_user_id ('dba');
+		    }
+		  key_no := 0;
+		  sk := (select WAUI_SALMON_KEY from WA_USER_INFO where WAUI_U_ID = self.u_id);
+              for (select xenc_key, xenc_type from ods_user_keys (username) (xenc_key varchar, xenc_type varchar) x where username = self.u_name) do
+              {
+		  ?>
+		  <tr>
+		      <td>
+			  <?vsp if (sk = xenc_key) { ?>
+			  <input type="radio" name="defk" value="<?V xenc_key ?>" checked="true"/>
+			  <?vsp } else { ?>
+			  <input type="radio" name="defk" value="<?V xenc_key ?>" />
+			  <?vsp } ?>
+			  <?vsp http_value (xenc_key, 'b'); ?>
+		      </td>
+		      <td><?vsp http_value (xenc_type, 'b'); ?></td>
+		      <td>
+			  <v:url name="ce7" value="Delete" url="--sprintf ('uiedit_sec.vspx?page=3&tabNo=7&key_del=%U', xenc_key)" render-only="1"/>
+		      </td>
+		  </tr>
+		  <?vsp
+		      key_no := key_no + 1;
+		    }
+		  if (not key_no)
+		    http ('<tr><td colspan="4">No keys</td></tr>');   
+		  ?>
+	  </table>
+	  <br/>
+            <span class="fm_ctl_btn">
+              <v:button name="bt_def_1" value="Remove Default" action="simple" >
+              <v:on-post>
+                <![CDATA[
+		      update WA_USER_INFO set WAUI_SALMON_KEY = null where WAUI_U_ID = self.u_id;
+		      self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=7');
+                ]]>
+              </v:on-post>
+              </v:button>
+              <v:button name="bt_def_2" value="Set Default" action="simple" >
+              <v:on-post>
+                <![CDATA[
+		    declare k any;
+
+		    k := get_keyword ('defk', params, null);
+		      update WA_USER_INFO set WAUI_SALMON_KEY = k where WAUI_U_ID = self.u_id;
+                    self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=7');
+                ]]>
+              </v:on-post>
+	    </v:button>
+	</span>
+          <br/><br/>
+    <fieldset>
+			<legend><b>Private Key</b></legend>
+            <table>
+        <tr>
+                <th width="135px">
+		Key Name
+                </th>
+	      <td align="left">
+		  <v:text name="kn" value="">
+		  </v:text>
+  	      </td>
+        </tr>
+        <tr>
+                <td></td>
+                <td>
+                  <label>
+		<v:check-box name="inpsel" value="1" xhtml_id="inpsel" auto-submit="1">
+                      <v:after-data-bind>
+                        <![CDATA[
+			if (e.ve_is_post and e.ve_initiator is not null and e.ve_initiator.vc_name = control.vc_name)
+			  {
+                            control.ufl_selected := atoi (get_keyword ('inpsel', e.ve_params, '0')); 
+			  }
+                        ]]>
+                      </v:after-data-bind>
+		</v:check-box>
+		    Import key from local file
+		</label>
+	    </td>
+	</tr>
+	<v:template type="simple" condition="self.inpsel.ufl_selected">
+        <tr>
+                  <th>
+		File to import	
+                  </th>
+	      <td align="left">
+		  <input type="file" name="k_value" value="Select Key"/>
+  	      </td>
+        </tr>
+        <tr>
+                  <th>
+                    File Password
+                  </th>
+  	      <td align="left">
+		  <v:text name="k_pwd" type="password" value="" /><br/>
+	      </td>
+	  </tr>
+      </v:template>
+	<v:template type="simple" condition="not self.inpsel.ufl_selected">
+        <tr>
+                  <th>
+		Key Type
+                  </th>
+  	      <td align="left">
+		  <v:select-list name="kt">
+		      <v:item name="RSA" value="RSA"/>
+		      <v:item name="DSA" value="DSA"/>
+		  </v:select-list>
+  	      </td>
+        </tr>
+        <tr>
+                  <th>
+		Key Length
+                  </th>
+  	      <td align="left">
+		  <v:select-list name="kl">
+		      <v:item name="512" value="512"/>
+		      <v:item name="1024" value="1024"/>
+		      <v:item name="2048" value="2048"/>
+		  </v:select-list>
+  	      </td>
+        </tr>
+    </v:template>
+        <tr>
+          <td colspan="2" class="ctrl">
+            <span class="fm_ctl_btn">
+              <v:button name="bt_cncl_7" value="Cancel" action="simple" >
+                      <v:on-post>
+                        <![CDATA[
+                    self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=7');
+                        ]]>
+                      </v:on-post>
+              </v:button>
+              <v:button name="bt_gen7" value="Generate Key" action="simple" enabled="--equ (self.inpsel.ufl_selected, 0)">
+                <v:on-post>
+                  <![CDATA[
+  		    declare agent, mail varchar;
+
+                    if (self.vc_is_valid = 0)
+		      return;
+
+		    declare exit handler for sqlstate '*', not found
+		    {
+		       self.vc_error_message := __SQL_MESSAGE;
+		       self.vc_is_valid := 0;
+		       return;
+		    };
+		    if (not length (self.kn.ufl_value))
+                      {
+		        self.vc_error_message := 'You must specify key name';
+			self.vc_is_valid := 0;
+			return;
+		      }  
+		    declare kl int;
+                    
+		    kl := atoi (self.kl.ufl_value);
+		    set_user_id (self.u_name); 
+		    set_qualifier ('DB');
+		    if (self.kt.ufl_value = 'RSA')
+		      {
+		        xenc_key_RSA_create (self.kn.ufl_value, kl);
+		      }
+		    else if (self.kt.ufl_value = 'DSA')
+		      { 
+		        xenc_key_DSA_create (self.kn.ufl_value, kl);
+		      }
+		    USER_KEY_STORE (self.u_name, self.kn.ufl_value, self.kt.ufl_value, 'DER', '');
+                    set_user_id ('dba');
+                    self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=7');
+                  ]]>
+                </v:on-post>
+              </v:button>
+              <v:button name="bt_set7" value="Import Key" action="simple" enabled="--equ (self.inpsel.ufl_selected, 1)">
+                <v:on-post>
+                  <![CDATA[
+  		    declare agent, mail varchar;
+
+                    if (self.vc_is_valid = 0)
+                      return;
+		    declare exit handler for sqlstate '*', not found
+		    {
+		       self.vc_error_message := __SQL_MESSAGE;
+		       self.vc_is_valid := 0;
+		       return;
+		    };
+		    set_user_id (self.u_name);
+		    USER_KEY_LOAD (self.kn.ufl_value, get_keyword ('k_value', e.ve_params), 'X.509', 'PKCS12', self.k_pwd.ufl_value, null, 1);
+                    self.vc_redirect ('uiedit_sec.vspx?page=3&tabNo=7');
+                  ]]>
+                </v:on-post>
+              </v:button>
+            </span>
+          </td>
+        </tr>
+      </table>
+  </fieldset>
   </v:template>
     </v:form>
 </div>
diff --git a/appsrc/ODS-Framework/uiedit_related.vspx b/appsrc/ODS-Framework/uiedit_related.vspx
index 4a0fe05..85b94a1 100644
--- a/appsrc/ODS-Framework/uiedit_related.vspx
+++ b/appsrc/ODS-Framework/uiedit_related.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_related.vspx,v 1.9.2.4 2010/06/28 09:46:12 source Exp $
+ -  $Id: uiedit_related.vspx,v 1.9.2.6 2010/09/27 14:45:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,7 +32,7 @@
 	<v:variable name="del_related" type="int" default="null" param-name="del" />
 	<v:variable name="rel_iri" type="varchar" default="'rdfs:seeAlso'" persist="temp" />
   <h3>These are other statements made via RDF Triples</h3>
-  <v:form type="simple" method="POST" xhtml_enctype="multipart/form-data" action="uiedit.vspx?page=8">
+  <v:form type="simple" method="POST" xhtml_enctype="multipart/form-data" action="uiedit_ann.vspx?page=8">
 	  <table class="listing" rules="groups">
 	      <tr class="listing_header_row">
         <th>URI</th>
@@ -66,7 +66,7 @@ if (not e.ve_is_post and control.te_rowset[0] = self.edit_related)
 				  <v:url name="related_ur1"
 				      value='--concat ('<img src="images/icons/edit_16.png" hspace="3" border="0"/>', (control.vc_parent as vspx_row_template).te_rowset[1])'
 				      format="%s"
-                    url="--sprintf ('uiedit.vspx?page=8&edit=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
+                    url="--sprintf ('uiedit_ann.vspx?page=8&edit=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
 				      xhtml_title="Edit"
 				      xhtml_alt="Edit"
 				      />
@@ -77,7 +77,7 @@ if (not e.ve_is_post and control.te_rowset[0] = self.edit_related)
             <td nowrap="nowrap">
               <v:url name="related_ur2" value='<img src="images/icons/trash_16.png" hspace="3" border="0"/>Delete'
 				      format="%s"
-                url="--sprintf ('uiedit.vspx?page=8&del=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
+                url="--sprintf ('uiedit_ann.vspx?page=8&del=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
 				      xhtml_title="Delete"
 				      xhtml_alt="Delete"
                 xhtml_class="img_button"
diff --git a/appsrc/ODS-Framework/uiedit_sec.vspx b/appsrc/ODS-Framework/uiedit_sec.vspx
new file mode 100644
index 0000000..afee9ad
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_sec.vspx
@@ -0,0 +1,170 @@
+<?xml version="1.0"?>
+<!--
+ -
+ -  $Id: uiedit_sec.vspx,v 1.1.4.2 2010/09/27 14:45:40 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="ui_profile"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+	      style="index.xsl"
+	      fast-render="1"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+  <v:method name="addProperty" arglist="in obj any, in objProperty varchar, in paramsProperty varchar, in params any">
+    <![CDATA[
+      declare tmp ay;
+
+      tmp := trim (get_keyword (paramsProperty, params));
+      if (not is_empty_or_null (tmp))
+        obj := vector_concat (obj, vector (objProperty, tmp));
+      return obj;
+    ]]>
+  </v:method>
+
+  <v:method name="jsonObject" arglist="">
+    <![CDATA[
+      return subseq (soap_box_structure ('x', 1), 0, 2);
+    ]]>
+  </v:method>
+
+  <v:method name="checkBox" arglist="in checkField varchar, inout properties any">
+    <![CDATA[
+      declare S varchar;
+
+      S := '';
+      if (get_keyword (checkField, properties, '0') <> '0')
+        S := 'checked="checked"';
+      http (sprintf ('<input type="checkbox" name="%s" id="%s" value="1" %s />', checkField, checkField, S));
+    ]]>
+  </v:method>
+
+  <vm:page>
+    <vm:header>
+      <script type="text/javascript" src="tbl.js">;</script>
+      <script type="text/javascript" src="typeahead.js">;</script>
+      <link rel="stylesheet" href="typeahead.css" type="text/css" />
+      <vm:title>Edit your personal data</vm:title>
+    </vm:header>
+    <vm:pagewrapper vm_onunload="checkPageLeave (document.forms['page_form'])">
+      <v:variable persist="temp" name="msg_msg" type="varchar" default="''"/>
+      <v:variable name="tabNo" type="integer" param-name="tabNo" default="0"/>
+      <v:variable name="pg" type="integer" param-name="page" default="1"/>
+      <v:variable name="is_org" type="integer" default="0" />
+      <vm:rawheader caption="Edit your personal data"/>
+      <vm:navigation-new on="settings"/>
+      <vm:subnavigation-new on="site"/>
+      <vm:body>
+        <v:before-data-bind>
+          <![CDATA[
+            self.is_org := coalesce ((select WAUI_IS_ORG from WA_USER_INFO where WAUI_U_ID = self.u_id), 0);
+          ]]>
+        </v:before-data-bind>
+        <script type="text/javascript">
+          <![CDATA[
+            function getFileName(form, from, to)
+            {
+              var S = from.value;
+              var N;
+              var fname;
+              if (S.lastIndexOf('\\') > 0)
+                N = S.lastIndexOf('\\')+1;
+              else
+                N = S.lastIndexOf('/')+1;
+              fname = S.substr(N,S.length);
+              to.value = fname;
+            }
+            function swPersHide ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Organization Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.hide('pers_'+i);
+              OAT.Dom.hide('p_url_2');
+            }
+            function swPersShow ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Personal Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.show('pers_'+i);
+              OAT.Dom.show('p_url_2');
+            }
+            function swOrg (cb)
+            {
+              (cb.checked)? swPersHide(): swPersShow();
+            }
+            function checkRest (form, sel)
+            {
+              var i;
+              if (sel.selectedIndex == 0)
+                return;
+              for (i = 0; i < form.elements.length; i++)
+              {
+                var contr = form.elements[i];
+                if (contr != null && contr != sel && contr.type == "select-one")
+                {
+                  if (contr.selectedIndex == sel.selectedIndex)
+                    contr.selectedIndex = 0;
+                }
+              }
+            }
+            ODSInitArray.push ( function () {
+              OAT.Loader.load(["json", "ws", "calendar", "combolist"], function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){(<?V self.is_org ?>)? swPersHide(): swPersShow();}); OAT.MSG.send(OAT, 'PAGE_LOADED');});
+            });
+          ]]>
+        </script>
+        <vm:login redirect="index.vspx"/>
+        <div class="message">
+          <v:label name="pwd_msg" value="--self.msg_msg" />
+          <input type="hidden" name="dirty_force_global" id="dirty_force_global" value="<?vsp http(get_keyword ('dirty_force_global', self.vc_event.ve_params, 'false')); ?>"/>
+          <input type="hidden" name="page" value="<?V self.pg ?>"/>
+          <input type="hidden" name="tabNo" id="tabNo" value="<?V self.tabNo ?>"/>
+        </div>
+        <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
+          <tr valign='top'>
+            <td>
+              <table cellpadding='10' cellspacing='0' border='0' width='100%'>
+                <tr>
+                  <td class="tab_deck">
+                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="navtab_tabs_ctr">
+                        <v:include name="nav" url="uiedit_nav.vspx"/>
+                    </table>
+                    <table class="tab_page">
+                      <tr>
+                        <td valign="top" class="tab_page">
+                            <v:include url="uiedit_pwd.vspx"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </td>
+                </tr>
+              </table>
+            </td>
+          </tr>
+        </table>
+      </vm:body>
+    </vm:pagewrapper>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_svc.vspx b/appsrc/ODS-Framework/uiedit_svc.vspx
index 9e3848d..f99b7d1 100644
--- a/appsrc/ODS-Framework/uiedit_svc.vspx
+++ b/appsrc/ODS-Framework/uiedit_svc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_svc.vspx,v 1.14.2.2 2010/03/12 09:10:13 source Exp $
+ -  $Id: uiedit_svc.vspx,v 1.14.2.6 2010/09/27 14:45:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,7 +32,7 @@
 	<v:variable name="del_svc" type="int" default="null" param-name="del" />
 	<v:variable name="names" type="any" default="null" persist="temp" />
 	<h3>External Web Services Settings</h3>
-  <v:form type="simple" method="POST" xhtml_enctype="multipart/form-data" action="uiedit.vspx?page=4">
+  <v:form type="simple" method="POST" xhtml_enctype="multipart/form-data" action="uiedit_ws.vspx?page=4">
 	  <table class="listing" rules="groups">
 	      <tr class="listing_header_row">
 		  <th>Service</th>
@@ -63,7 +63,7 @@ if (not e.ve_is_post and control.te_rowset[0] = self.edit_svc)
 				      value='--concat ('<img src="images/icons/edit_16.png" hspace="3" border="0"/>',
 				      get_keyword ((control.vc_parent as vspx_row_template).te_rowset[1], self.names))'
 				      format="%s"
-                       url="--sprintf ('uiedit.vspx?page=4&edit=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
+                       url="--sprintf ('uiedit_ws.vspx?page=4&edit=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
 				      xhtml_title="Edit"
 				      xhtml_alt="Edit"
 				      />
@@ -74,7 +74,7 @@ if (not e.ve_is_post and control.te_rowset[0] = self.edit_svc)
               <td nowrap="nowrap">
                 <v:url name="ur4" value='<img src="images/icons/trash_16.png" hspace="3" border="0"/>Delete'
 				      format="%s"
-                       url="--sprintf ('uiedit.vspx?page=4&del=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
+                       url="--sprintf ('uiedit_ws.vspx?page=4&del=%d', (control.vc_parent as vspx_row_template).te_rowset[0])"
 				      xhtml_title="Delete"
 				      xhtml_alt="Delete"
                        xhtml_class="img_button"
@@ -98,17 +98,14 @@ if (not e.ve_is_post and control.te_rowset[0] = self.edit_svc)
 		  <label for="svc_name">Service</label>
         <br />
 		  <v:select-list name="svc_name">
-		      <v:item name="Amazon API" value="AmazonKey"/>
-		      <v:item name="Amazon WishList" value="AmazonID"/>
-		      <v:item name="Ebay" value="EbayID"/>
-		      <v:item name="FaceBook" value="FBKey"/>
-		      <v:item name="Flickr" value="FlickrKey"/>
-		      <v:item name="Google Associates" value="GoogleAdsenseID"/>
-		      <v:item name="Google API" value="GoogleKey"/>
           <v:on-init>
             <![CDATA[
 declare v any;
 declare sel, val any;
+
+              control.vsl_items := vector ('Amazon API', 'Amazon WishList', 'Ebay', 'FaceBook', 'Flickr', 'Google Associates', 'Google API');
+              control.vsl_item_values := vector ('AmazonKey', 'AmazonID', 'EbayID', 'FBKey', 'FlickrKey', 'GoogleAdsenseID', 'GoogleKey');
+
 val := control.vsl_items;
 sel := control.vsl_item_values;
 v := make_array (length (sel)*2, 'any');
@@ -134,10 +131,13 @@ for (declare i, l int, i := 0, l := length (sel); i < l; i := i + 1)
   {
      if (position (sel[i], ex) = 0 or sel[i] = self.svc_name.ufl_value)
        {
+                  if ((sel[i] <> 'FBKey') or (self.u_id = http_dav_uid ()))
+                  {
          newn := vector_concat (newn, vector (val[i]));
          newv := vector_concat (newv, vector (sel[i]));
        }
   }
+              }
 control.vsl_items := newn;
 control.vsl_item_values := newv;
 control.vs_set_selected ();
@@ -156,7 +156,9 @@ control.vs_set_selected ();
           if (__proc_exists ('DB.DBA.FB_SIG') is not null)
           {
         ?>
-		  <v:browse-button name="fbt1" value="Get FaceBook session" child-window-options="scrollbars=yes, resizable=yes, menubar=no, height=800, width=800" selector="fb_popup.vspx" style="button"/>
+        <v:template name="template_fb2" type="simple" enabled="--equ(self.u_id, http_dav_uid ())">
+          <v:browse-button name="fbt1" xhtml_id="fbt1" value="Get FaceBook session" child-window-options="scrollbars=yes, resizable=yes, menubar=no, height=800, width=800" selector="fb_popup.vspx" style="button"/>
+        </v:template>
         <?vsp
           }
         ?>
diff --git a/appsrc/ODS-Framework/uiedit_val.vspx b/appsrc/ODS-Framework/uiedit_val.vspx
new file mode 100644
index 0000000..719dacc
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_val.vspx
@@ -0,0 +1,170 @@
+<?xml version="1.0"?>
+<!--
+ -
+ -  $Id: uiedit_val.vspx,v 1.1.4.2 2010/09/27 14:45:41 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="ui_profile"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+	      style="index.xsl"
+	      fast-render="1"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+  <v:method name="addProperty" arglist="in obj any, in objProperty varchar, in paramsProperty varchar, in params any">
+    <![CDATA[
+      declare tmp ay;
+
+      tmp := trim (get_keyword (paramsProperty, params));
+      if (not is_empty_or_null (tmp))
+        obj := vector_concat (obj, vector (objProperty, tmp));
+      return obj;
+    ]]>
+  </v:method>
+
+  <v:method name="jsonObject" arglist="">
+    <![CDATA[
+      return subseq (soap_box_structure ('x', 1), 0, 2);
+    ]]>
+  </v:method>
+
+  <v:method name="checkBox" arglist="in checkField varchar, inout properties any">
+    <![CDATA[
+      declare S varchar;
+
+      S := '';
+      if (get_keyword (checkField, properties, '0') <> '0')
+        S := 'checked="checked"';
+      http (sprintf ('<input type="checkbox" name="%s" id="%s" value="1" %s />', checkField, checkField, S));
+    ]]>
+  </v:method>
+
+  <vm:page>
+    <vm:header>
+      <script type="text/javascript" src="tbl.js">;</script>
+      <script type="text/javascript" src="typeahead.js">;</script>
+      <link rel="stylesheet" href="typeahead.css" type="text/css" />
+      <vm:title>Edit your personal data</vm:title>
+    </vm:header>
+    <vm:pagewrapper vm_onunload="checkPageLeave (document.forms['page_form'])">
+      <v:variable persist="temp" name="msg_msg" type="varchar" default="''"/>
+      <v:variable name="tabNo" type="integer" param-name="tabNo" default="0"/>
+      <v:variable name="pg" type="integer" param-name="page" default="1"/>
+      <v:variable name="is_org" type="integer" default="0" />
+      <vm:rawheader caption="Edit your personal data"/>
+      <vm:navigation-new on="settings"/>
+      <vm:subnavigation-new on="site"/>
+      <vm:body>
+        <v:before-data-bind>
+          <![CDATA[
+            self.is_org := coalesce ((select WAUI_IS_ORG from WA_USER_INFO where WAUI_U_ID = self.u_id), 0);
+          ]]>
+        </v:before-data-bind>
+        <script type="text/javascript">
+          <![CDATA[
+            function getFileName(form, from, to)
+            {
+              var S = from.value;
+              var N;
+              var fname;
+              if (S.lastIndexOf('\\') > 0)
+                N = S.lastIndexOf('\\')+1;
+              else
+                N = S.lastIndexOf('/')+1;
+              fname = S.substr(N,S.length);
+              to.value = fname;
+            }
+            function swPersHide ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Organization Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.hide('pers_'+i);
+              OAT.Dom.hide('p_url_2');
+            }
+            function swPersShow ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Personal Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.show('pers_'+i);
+              OAT.Dom.show('p_url_2');
+            }
+            function swOrg (cb)
+            {
+              (cb.checked)? swPersHide(): swPersShow();
+            }
+            function checkRest (form, sel)
+            {
+              var i;
+              if (sel.selectedIndex == 0)
+                return;
+              for (i = 0; i < form.elements.length; i++)
+              {
+                var contr = form.elements[i];
+                if (contr != null && contr != sel && contr.type == "select-one")
+                {
+                  if (contr.selectedIndex == sel.selectedIndex)
+                    contr.selectedIndex = 0;
+                }
+              }
+            }
+            ODSInitArray.push ( function () {
+              OAT.Loader.load(["json", "ws", "calendar", "combolist"], function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){(<?V self.is_org ?>)? swPersHide(): swPersShow();}); OAT.MSG.send(OAT, 'PAGE_LOADED');});
+            });
+          ]]>
+        </script>
+        <vm:login redirect="index.vspx"/>
+        <div class="message">
+          <v:label name="pwd_msg" value="--self.msg_msg" />
+          <input type="hidden" name="dirty_force_global" id="dirty_force_global" value="<?vsp http(get_keyword ('dirty_force_global', self.vc_event.ve_params, 'false')); ?>"/>
+          <input type="hidden" name="page" value="<?V self.pg ?>"/>
+          <input type="hidden" name="tabNo" id="tabNo" value="<?V self.tabNo ?>"/>
+        </div>
+        <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
+          <tr valign='top'>
+            <td>
+              <table cellpadding='10' cellspacing='0' border='0' width='100%'>
+                <tr>
+                  <td class="tab_deck">
+                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="navtab_tabs_ctr">
+                        <v:include name="nav" url="uiedit_nav.vspx"/>
+                    </table>
+                    <table class="tab_page">
+                      <tr>
+                        <td valign="top" class="tab_page">
+                            <v:include url="uiedit_validation.vspx"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </td>
+                </tr>
+              </table>
+            </td>
+          </tr>
+        </table>
+      </vm:body>
+    </vm:pagewrapper>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Framework/uiedit_validation.vspx b/appsrc/ODS-Framework/uiedit_validation.vspx
index 7adde29..b99c6ce 100644
--- a/appsrc/ODS-Framework/uiedit_validation.vspx
+++ b/appsrc/ODS-Framework/uiedit_validation.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_validation.vspx,v 1.3.2.2 2009/08/12 11:51:57 source Exp $
+ -  $Id: uiedit_validation.vspx,v 1.3.2.5 2011/03/23 12:18:30 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -27,39 +27,55 @@
         xmlns:v="http://www.openlinksw.com/vspx/"
         style="index.xsl"
         doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
-        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+        fast-render="1">
+
+  <vm:page>
+    <vm:header>
+      <vm:title>Semantic Pingback Setup</vm:title>
+    </vm:header>
+    <vm:pagewrapper >
+      <v:variable persist="temp" name="msg_msg" type="varchar" default="''"/>
+      <v:variable name="edit_semping" type="varchar" default="null" param-name="edit" />
+      <v:variable name="del_semping" type="varchar" default="null" param-name="del" />
+      <vm:rawheader caption="Edit your personal data"/>
+      <vm:navigation-new on="settings"/>
+      <vm:subnavigation-new on="site"/>
+      <vm:body>
+	      <vm:login redirect="index.vspx"/>
 
   <h3>Fields for validation</h3>
   <div style="height: 400px; overflow: auto;">
     <table id="lvalidation" class="listing" cellspacing="0">
       <tr class="listing_header_row">
-        <td width="1%">
-          <input type="checkbox" name="cb_name_all" value="Select All" onclick="selectAllCheckboxes(this, 'cb_item')" />
-        </td>
+              <td width="1%"></td>
+              <th>Field</th>
+              <th width="1%"></th>
         <th>Field</th>
       </tr>
       <?vsp
-        declare N integer;
+              declare N, M integer;
         declare fields, data any;
 
         fields := LDAP..contact_fields ();
         data := coalesce ((select deserialize (LV_FIELDS) from LDAP..LDAP_VALIDATION where LV_USER_ID = self.u_id), vector());
-        for (N := 0; N < length (fields); N := N + 2)
+              M := length (fields) / 2;
+              for (N := 0; N < M; N := N + 2)
         {
   	  ?>
   	  <tr>
   	    <td width="1%">
-  	      <?vsp
-            declare S varchar;
-            S := '';
-            if (get_keyword (fields[N], data, '') <> '')
-              S := 'checked="checked"';
-            http (sprintf ('<input type="checkbox" %s name="cb_item" value="%s"', S, fields[N]));
-          ?>
+        	      <?vsp http (sprintf ('<input type="checkbox" %s name="cb_item" value="%s"', case when (get_keyword (fields[N], data, '') <> '') then 'checked="checked"' else '' end, fields[N])); ?>
   		  </td>
-  		  <td >
+        		  <td width="50%">
   		    <?V fields[N+1] ?>
   		  </td>
+        	    <td width="1%">
+        	      <?vsp http (sprintf ('<input type="checkbox" %s name="cb_item" value="%s"', case when (get_keyword (fields[M+N], data, '') <> '') then 'checked="checked"' else '' end, fields[M+N])); ?>
+        		  </td>
+        		  <td width="50%">
+        		    <?V fields[M+N+1] ?>
+        		  </td>
       </tr>
   	  <?vsp
         }
@@ -88,5 +104,7 @@
       </v:on-post>
     </v:button>
   </div>
-
+      </vm:body>
+    </vm:pagewrapper>
+  </vm:page>
 </v:page>
diff --git a/appsrc/ODS-Framework/uiedit_visb.vspx b/appsrc/ODS-Framework/uiedit_visb.vspx
index 62d2c62..19b45eb 100644
--- a/appsrc/ODS-Framework/uiedit_visb.vspx
+++ b/appsrc/ODS-Framework/uiedit_visb.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: uiedit_visb.vspx,v 1.4 2006/08/16 00:04:13 source Exp $
+ -  $Id: uiedit_visb.vspx,v 1.4.2.2 2010/11/09 20:18:23 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -24,6 +24,6 @@
 -->
 <v:page name="main_tabs_props" xmlns:v="http://www.openlinksw.com/vspx/">
     <v:item name="public" value="1" />
-    <v:item name="friends" value="2" />
+    <v:item name="acl" value="2" />
     <v:item name="private" value="3" />
 </v:page>
diff --git a/appsrc/ODS-Framework/uiedit_wishlist.vspx b/appsrc/ODS-Framework/uiedit_wishlist.vspx
index cdec5b4..9c4890a 100644
--- a/appsrc/ODS-Framework/uiedit_wishlist.vspx
+++ b/appsrc/ODS-Framework/uiedit_wishlist.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uiedit_wishlist.vspx,v 1.1.2.10 2010/07/05 08:26:09 source Exp $
+ -  $Id: uiedit_wishlist.vspx,v 1.1.2.14 2011/02/16 20:58:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -32,11 +32,12 @@
   <v:variable name="wl_mode" type="varchar" default="'WL/browse'"/>
 
 	<v:variable name="wl_id" type="any" default="null" />
+	<v:variable name="wl_type" type="varchar" default="'2'" />
 	<v:variable name="wl_properties" type="any" default="null" />
 	<v:variable name="wl_newProperties" type="any" default="null" />
 
-	<v:form name="usr_personal_9" type="simple" method="POST" xhtml_enctype="multipart/form-data">
-    <h3>Offers I Seek (GoodRelations Ontologies)</h3>
+	<v:form name="usr_personal_055" type="simple" method="POST" xhtml_enctype="multipart/form-data">
+    <h3>My Offers (GoodRelations Ontologies)</h3>
     <vm:if test="self.wl_mode = 'WL/browse'">
       <?vsp
         if (0)
@@ -45,7 +46,7 @@
         <v:button name="wl_dButton" action="simple" value="Delete">
           <v:on-post>
             <![CDATA[
-              delete from DB.DBA.WA_USER_WISHLIST where WUWL_ID = get_keyword ('wl_id', self.vc_page.vc_event.ve_params) and WUWL_U_ID = self.u_id;
+              delete from DB.DBA.WA_USER_OFFERLIST where WUOL_ID = get_keyword ('wl_id', self.vc_page.vc_event.ve_params) and WUOL_U_ID = self.u_id;
               self.vc_data_bind(e);
             ]]>
           </v:on-post>
@@ -64,9 +65,10 @@
           <v:on-post>
             <![CDATA[
               self.wl_mode := 'WL/add';
+              self.wl_flag.ufl_value := null;
               self.wl_offer.ufl_value := null;
               self.wl_comment.ufl_value := null;
-        self.wl_properties := self.jsonObject();
+              self.wl_properties := ODS..jsonObject ();
               self.wl_newProperties := vector (vector_concat (ODS..jsonObject (), vector ('id', '0', 'ontology', 'http://purl.org/goodrelations/v1#', 'items', get_keyword ('products', self.wl_properties, vector ()))));
 
               self.vc_data_bind(e);
@@ -76,7 +78,7 @@
       </div>
 
 	    <v:data-set name="wl_ds"
-	                sql="select WUWL_ID, WUWL_BARTER, WUWL_COMMENT, WUWL_PROPERTIES from DB.DBA.WA_USER_WISHLIST where WUWL_U_ID = :self.u_id"
+	                sql="select WUOL_ID, WUOL_OFFER, WUOL_COMMENT from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = :self.u_id and WUOL_TYPE = :self.wl_type"
 		              scrollable="1"
 		              editable="1"
 		              nrows="10">
@@ -84,7 +86,7 @@
         <v:template name="wl_ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
 	  <table class="listing" rules="groups">
 	    <tr class="listing_header_row">
-      		    <th>Seek</th>
+      		    <th>Offer</th>
       		    <th width="50px">Action</th>
 	    </tr>
           </table>
@@ -95,7 +97,7 @@
           <v:template name="wl_ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
             <table>
               <tr align="center">
-                <td colspan="2">No Seeks</td>
+                <td colspan="2">No Offers</td>
               </tr>
             </table>
           </v:template>
@@ -104,34 +106,36 @@
             <table>
   			      <tr class="<?V case when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
                 <td nowrap="nowrap" width="100%">
-                  <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WUWL_BARTER')" format="%s" name="wl_ds_browse_l1"/>
+                  <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('WUOL_OFFER')" format="%s" name="wl_ds_browse_1_label"/>
                 </td>
                 <td nowrap="nowrap">
                   <v:button name="wl_eButton" action="simple" style="url" value="''" xhtml_class="img_button">
                     <v:before-render>
                       <![CDATA[
-                        control.ufl_value := '<img src="images/icons/edit_16.png" border="0" alt="Edit Seek" title="Edit Seek"/> Edit';
+                        control.ufl_value := '<img src="images/icons/edit_16.png" border="0" alt="Edit Offer" title="Edit Offer"/> Edit';
                       ]]>
                     </v:before-render>
                     <v:on-post>
                       <![CDATA[
                         self.wl_mode := 'WL/edit';
-                        self.wl_id := (control.vc_parent as vspx_row_template).te_column_value('WUWL_ID');
-                        select WUWL_BARTER,
-                               WUWL_COMMENT,
-                               deserialize (WUWL_PROPERTIES)
-                          into self.wl_offer.ufl_value,
+                        self.wl_id := (control.vc_parent as vspx_row_template).te_column_value('WUOL_ID');
+                        select WUOL_FLAG,
+                               WUOL_OFFER,
+                               WUOL_COMMENT,
+                               deserialize (WUOL_PROPERTIES)
+                          into self.wl_flag.ufl_value,
+                               self.wl_offer.ufl_value,
                                self.wl_comment.ufl_value,
                                self.wl_properties
-                          from DB.DBA.WA_USER_WISHLIST
-                         where WUWL_ID = self.wl_id;
+                          from DB.DBA.WA_USER_OFFERLIST
+                         where WUOL_ID = self.wl_id;
 
                         self.wl_newProperties := vector (vector_concat (ODS..jsonObject (), vector ('id', '0', 'ontology', 'http://purl.org/goodrelations/v1#', 'items', get_keyword ('products', self.wl_properties, vector ()))));
                         self.vc_data_bind(e);
                       ]]>
                     </v:on-post>
                   </v:button>
-                  <span class="button pointer" onclick="javascript: if (confirm('Are you sure you want to delete this record?')) {$('wl_id').value = <?V (control as vspx_row_template).te_column_value('WUWL_ID') ?>; doPost('page_form', 'wl_dButton');}">
+                  <span class="button pointer" onclick="javascript: if (confirm('Are you sure you want to delete this record?')) {$('wl_id').value = <?V (control as vspx_row_template).te_column_value('WUOL_ID') ?>; doPost('page_form', 'wl_dButton');}">
                     <img class="button" src="/ods/images/icons/trash_16.png"/> Delete
                   </span>
 			        </td>
@@ -154,7 +158,19 @@
 				<table>
 				  <tr>
 				    <th width="100px">
-  		          Seek Name
+		          Access
+		        </th>
+		        <td>
+              <v:select-list name="wl_flag" xhtml_id="wl_flag">
+                <v:item name="public" value="1" />
+                <v:item name="acl" value="2" />
+                <v:item name="private" value="3" />
+              </v:select-list>
+            </td>
+          </tr>
+				  <tr>
+				    <th>
+		          Offer Name
 		        </th>
 		        <td>
               <v:text name="wl_offer" value="" xhtml_id="wl_offer" xhtml_size="50" xhtml_class="_validate_" />
@@ -175,6 +191,11 @@
               <td width="800px">
                 <table id="wl_tbl" class="listing">
                   <tbody id="wl_tbody">
+                  <tr id="wl_throbber">
+                    <td>
+                      <img src="/ods/images/oat/Ajax_throbber.gif" />
+                    </td>
+                  </tr>
                   </tbody>
 			  </table>
                 <input type="hidden" id="wl_no" name="wl_no" value="1" />
@@ -196,13 +217,13 @@
             <td></td>
             <td>
               <br />
-  		      <v:button name="user_c_personal_9" value="Cancel" action="simple">
+    		      <v:button name="user_c_personal_055" value="Cancel" action="simple">
 		        <v:on-post>
                 self.wl_mode := 'WL/browse';
                 self.vc_data_bind (e);
 		        </v:on-post>
 		      </v:button>
-  		      <v:button name="user_s_personal_9" value="--case when self.wl_mode = 'WL/add' then 'Add' else 'Update' end" action="simple" xhtml_onclick="return validateInputs(this);">
+    		      <v:button name="user_s_personal_055" value="--case when self.wl_mode = 'WL/add' then 'Add' else 'Update' end" action="simple" xhtml_onclick="return validateInputs(this);">
 		        <v:on-post><![CDATA[
                 if (self.vc_is_valid = 0)
                   return;
@@ -220,22 +241,23 @@
                   self.wl_properties := vector_concat (ODS..jsonObject (), vector ('version', '1.0', 'products', products));
                 if (self.wl_mode = 'WL/add')
               {
-                    if (exists (select 1 from DB.DBA.WA_USER_WISHLIST where WUWL_U_ID = self.u_id and WUWL_BARTER = self.wl_offer.ufl_value))
+                    if (exists (select 1 from DB.DBA.WA_USER_OFFERLIST where WUOL_U_ID = self.u_id and WUOL_TYPE = self.wl_type and WUOL_OFFER = self.wl_offer.ufl_value))
                     {
-                      self.vc_error_message := 'A seek with same name already exists, please specify unique name.';
+                      self.vc_error_message := 'An offer with same name already exists, please specify unique name.';
                       self.vc_is_valid := 0;
                       return;
                     }
-                  insert into DB.DBA.WA_USER_WISHLIST (WUWL_U_ID, WUWL_BARTER, WUWL_COMMENT, WUWL_PROPERTIES)
-                  values (self.u_id, self.wl_offer.ufl_value, self.wl_comment.ufl_value, serialize (self.wl_properties));
+                    insert into DB.DBA.WA_USER_OFFERLIST (WUOL_U_ID, WUOL_TYPE, WUOL_FLAG, WUOL_OFFER, WUOL_COMMENT, WUOL_PROPERTIES)
+                      values (self.u_id, self.wl_type, self.wl_flag.ufl_value, self.wl_offer.ufl_value, self.wl_comment.ufl_value, serialize (self.wl_properties));
               }
               else
               {
-                  update DB.DBA.WA_USER_WISHLIST
-                   set WUWL_BARTER = self.wl_offer.ufl_value,
-                       WUWL_COMMENT = self.wl_comment.ufl_value,
-                       WUWL_PROPERTIES = serialize (self.wl_properties)
-                   where WUWL_ID = self.wl_id;
+                    update DB.DBA.WA_USER_OFFERLIST
+                       set WUOL_FLAG = self.wl_flag.ufl_value,
+                           WUOL_OFFER = self.wl_offer.ufl_value,
+                           WUOL_COMMENT = self.wl_comment.ufl_value,
+                           WUOL_PROPERTIES = serialize (self.wl_properties)
+                     where WUOL_ID = self.wl_id;
               }
 
                 self.wl_mode := 'WL/browse';
diff --git a/appsrc/ODS-Framework/uiedit_ws.vspx b/appsrc/ODS-Framework/uiedit_ws.vspx
new file mode 100644
index 0000000..caf1cf2
--- /dev/null
+++ b/appsrc/ODS-Framework/uiedit_ws.vspx
@@ -0,0 +1,170 @@
+<?xml version="1.0"?>
+<!--
+ -
+ -  $Id: uiedit_ws.vspx,v 1.1.4.2 2010/09/27 14:45:41 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<v:page name="ui_profile"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+	      style="index.xsl"
+	      fast-render="1"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+  <v:method name="addProperty" arglist="in obj any, in objProperty varchar, in paramsProperty varchar, in params any">
+    <![CDATA[
+      declare tmp ay;
+
+      tmp := trim (get_keyword (paramsProperty, params));
+      if (not is_empty_or_null (tmp))
+        obj := vector_concat (obj, vector (objProperty, tmp));
+      return obj;
+    ]]>
+  </v:method>
+
+  <v:method name="jsonObject" arglist="">
+    <![CDATA[
+      return subseq (soap_box_structure ('x', 1), 0, 2);
+    ]]>
+  </v:method>
+
+  <v:method name="checkBox" arglist="in checkField varchar, inout properties any">
+    <![CDATA[
+      declare S varchar;
+
+      S := '';
+      if (get_keyword (checkField, properties, '0') <> '0')
+        S := 'checked="checked"';
+      http (sprintf ('<input type="checkbox" name="%s" id="%s" value="1" %s />', checkField, checkField, S));
+    ]]>
+  </v:method>
+
+  <vm:page>
+    <vm:header>
+      <script type="text/javascript" src="tbl.js">;</script>
+      <script type="text/javascript" src="typeahead.js">;</script>
+      <link rel="stylesheet" href="typeahead.css" type="text/css" />
+      <vm:title>Edit your personal data</vm:title>
+    </vm:header>
+    <vm:pagewrapper vm_onunload="checkPageLeave (document.forms['page_form'])">
+      <v:variable persist="temp" name="msg_msg" type="varchar" default="''"/>
+      <v:variable name="tabNo" type="integer" param-name="tabNo" default="0"/>
+      <v:variable name="pg" type="integer" param-name="page" default="1"/>
+      <v:variable name="is_org" type="integer" default="0" />
+      <vm:rawheader caption="Edit your personal data"/>
+      <vm:navigation-new on="settings"/>
+      <vm:subnavigation-new on="site"/>
+      <vm:body>
+        <v:before-data-bind>
+          <![CDATA[
+            self.is_org := coalesce ((select WAUI_IS_ORG from WA_USER_INFO where WAUI_U_ID = self.u_id), 0);
+          ]]>
+        </v:before-data-bind>
+        <script type="text/javascript">
+          <![CDATA[
+            function getFileName(form, from, to)
+            {
+              var S = from.value;
+              var N;
+              var fname;
+              if (S.lastIndexOf('\\') > 0)
+                N = S.lastIndexOf('\\')+1;
+              else
+                N = S.lastIndexOf('/')+1;
+              fname = S.substr(N,S.length);
+              to.value = fname;
+            }
+            function swPersHide ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Organization Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.hide('pers_'+i);
+              OAT.Dom.hide('p_url_2');
+            }
+            function swPersShow ()
+            {
+              var lb = $('lb_1');
+              if (lb)
+                lb.innerHTML = 'Personal Webpage';
+              for (i = 1; i <= 20; i++)
+                OAT.Dom.show('pers_'+i);
+              OAT.Dom.show('p_url_2');
+            }
+            function swOrg (cb)
+            {
+              (cb.checked)? swPersHide(): swPersShow();
+            }
+            function checkRest (form, sel)
+            {
+              var i;
+              if (sel.selectedIndex == 0)
+                return;
+              for (i = 0; i < form.elements.length; i++)
+              {
+                var contr = form.elements[i];
+                if (contr != null && contr != sel && contr.type == "select-one")
+                {
+                  if (contr.selectedIndex == sel.selectedIndex)
+                    contr.selectedIndex = 0;
+                }
+              }
+            }
+            ODSInitArray.push ( function () {
+              OAT.Loader.load(["json", "ws", "calendar", "combolist"], function(){OAT.MSG.attach(OAT, "PAGE_LOADED", function(){(<?V self.is_org ?>)? swPersHide(): swPersShow();}); OAT.MSG.send(OAT, 'PAGE_LOADED');});
+            });
+          ]]>
+        </script>
+        <vm:login redirect="index.vspx"/>
+        <div class="message">
+          <v:label name="pwd_msg" value="--self.msg_msg" />
+          <input type="hidden" name="dirty_force_global" id="dirty_force_global" value="<?vsp http(get_keyword ('dirty_force_global', self.vc_event.ve_params, 'false')); ?>"/>
+          <input type="hidden" name="page" value="<?V self.pg ?>"/>
+          <input type="hidden" name="tabNo" id="tabNo" value="<?V self.tabNo ?>"/>
+        </div>
+        <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
+          <tr valign='top'>
+            <td>
+              <table cellpadding='10' cellspacing='0' border='0' width='100%'>
+                <tr>
+                  <td class="tab_deck">
+                    <table width="100%" cellpadding="0" cellspacing="0" border="0" class="navtab_tabs_ctr">
+                        <v:include name="nav" url="uiedit_nav.vspx"/>
+                    </table>
+                    <table class="tab_page">
+                      <tr>
+                        <td valign="top" class="tab_page">
+                            <v:include url="uiedit_svc.vspx"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </td>
+                </tr>
+              </table>
+            </td>
+          </tr>
+        </table>
+      </vm:body>
+    </vm:pagewrapper>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Framework/url_rew.sql b/appsrc/ODS-Framework/url_rew.sql
index 30050d1..27b7b9b 100644
--- a/appsrc/ODS-Framework/url_rew.sql
+++ b/appsrc/ODS-Framework/url_rew.sql
@@ -1,7 +1,7 @@
 --
 --  url_rev.sql
 --
---  $Id: url_rew.sql,v 1.35.2.4 2010/07/09 14:36:48 source Exp $
+--  $Id: url_rew.sql,v 1.35.2.8 2010/09/21 11:46:16 source Exp $
 --
 --  URL rewrite rules for ODS
 --
@@ -247,6 +247,12 @@ create procedure DB.DBA.ODS_DET_REF (in par varchar, in fmt varchar, in val varc
 -- ODS IRI rewrite rules
 -- IMPORTANT: all rules are processed and last matching will win
 --
+create procedure DB.DBA.ODS_URLREW_XRDS (in path varchar)
+{
+  return sprintf ('X-XRDS-Location: http://%{WSHost}s%s/yadis.xrds', path);
+}
+;
+
 
 -- Person IRI as HTML
 DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_person_html', 1,
@@ -257,7 +263,7 @@ DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_person_html', 1,
     NULL,
     2,
     NULL,
-    'X-XRDS-Location: yadis.xrds\r\n');
+    '^{sql:DB.DBA.ODS_URLREW_XRDS}^');
 
 DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_person_yadis', 1,
     '/dataspace/(person/|organization/)?([^/#\\?]*)', vector('type', 'uname'), 1,
@@ -348,6 +354,15 @@ DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_discussion_home_html', 1,
     NULL,
     2);
 
+-- Discussion apps pages
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_discussion_page', 1,
+    '/dataspace/discussion/([^/\\.\?]*)(.vspx|.vsp|.css|.js)',
+    vector('page', 'ext'), 2,
+    '/nntpf/%s%s', vector('page', 'ext'),
+    'DB.DBA.ODS_ITEM_PAGE',
+    NULL,
+    1);
+
 -- Discussion group page
 DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_discussion_html', 1,
     '/dataspace/discussion/([^/\\?]*)', vector('grp'), 1,
@@ -545,11 +560,13 @@ DB.DBA.HTTP_VARIANT_ADD ('ods_rule_list1', 'iid%20%28([0-9]*)%29\x24', 'iid%20%2
 create procedure DB.DBA.ODS_URLREW_HDR (in in_path varchar)
 {
   declare host, lines, exts any;
-  declare links, tmp, path varchar;
+  declare links, tmp, path, mail, uname varchar;
 
   lines := http_request_header ();
   host := http_request_header (lines, 'Host', null, '');
   links := '';
+  mail := null;
+  uname := null;
 --  dbg_obj_print_vars (in_path);
   exts := 
   vector (
@@ -561,6 +578,13 @@ create procedure DB.DBA.ODS_URLREW_HDR (in in_path varchar)
   path := regexp_replace (in_path, '/(about|foaf|sioc)\\.([a-z0-9]+)\x24', '', 1, null);	
   if (regexp_match ('/dataspace/(person|organization)/([^/]+)\x24', path) is not null)
     {
+      declare a any;
+      a := sprintf_inverse (path, '/dataspace/%s/%s', 1);
+      if (length (a) = 2)
+	{
+	mail := (select U_E_MAIL from DB.DBA.SYS_USERS where U_NAME = a[1]);
+	  uname := a[1];
+	}
       tmp := path || '#this';
     }
   else
@@ -570,6 +594,8 @@ create procedure DB.DBA.ODS_URLREW_HDR (in in_path varchar)
   links := 'Link: ';
   links := links || sprintf ('<http://%s%s>; rel="http://xmlns.com/foaf/0.1/primaryTopic",', host, tmp);
   links := links || sprintf ('\r\n <http://%s%s>; rev="describedby",', host, tmp);
+  if (uname is not null)
+    links := links || sprintf ('\r\n <http://%s/activities/feeds/activities/user/%U>; rel="http://schemas.google.com/g/2010#updates-from"; type="application/atom+xml",', host, uname);
   tmp := regexp_replace (in_path, '\\.([a-z0-9]+)\x24', '', 1, null);	
   if (tmp = in_path)
     {
@@ -586,6 +612,8 @@ create procedure DB.DBA.ODS_URLREW_HDR (in in_path varchar)
 	  host, tmp, ss[0], ss[2], ss[1]);
 	}
     }
+  if (mail is not null)
+    links := links || sprintf ('\r\n <http://%s/ods/describe?uri=%U>; rel="webfinger",', host, 'acct:' || mail);
   links := rtrim (links, ',');
   return links;
 }
@@ -649,6 +677,7 @@ DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_rule_list1', 1,
 	  'ods_apml',
 	  'ods_feed_html',
 	  'ods_inst_html',
+	  'ods_discussion_page',
 	  'ods_discussion_home_html',
 	  'ods_discussion_html',
 	  'ods_item_html',
diff --git a/appsrc/ODS-Framework/url_rule.vspx b/appsrc/ODS-Framework/url_rule.vspx
index 5c1614a..2994bd3 100644
--- a/appsrc/ODS-Framework/url_rule.vspx
+++ b/appsrc/ODS-Framework/url_rule.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: url_rule.vspx,v 1.2 2008/04/17 09:10:36 source Exp $
+ -  $Id: url_rule.vspx,v 1.2.2.2 2011/01/25 14:11:29 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -43,7 +43,9 @@
       <vm:navigation1 on="services"/>
       <vm:rawheader caption="Content Hyperlinking Rules"/>
       <vm:body>
-	<script type="text/javascript"><![CDATA[
+	      <vm:login redirect="index.vspx" />
+        <script type="text/javascript">
+          <![CDATA[
 function selectAllCheckboxes (form, btn)
 {
   for (var i = 0; i < form.elements.length; i = i + 1) {
@@ -62,15 +64,15 @@ function selectAllCheckboxes (form, btn)
     btn.value = 'Select All';
   btn.focus();
 }
-]]></script>
-	<vm:login redirect="index.vspx"/>
-	<v:before-data-bind><![CDATA[
-	  if (self.aps_id is null)
+          ]]>
+        </script>
+        <v:before-data-bind>
+          <![CDATA[
+            if ((self.aps_id is null) and (self.u_id is not null))
 	    {
               declare ap_name varchar;
 	      ap_name := sprintf ('Hyperlinking-%d', self.u_id);
-              self.aps_id := (select APS_ID from SYS_ANN_PHRASE_SET where APS_OWNER_UID =
-	        self.u_id and APS_NAME = ap_name);
+              self.aps_id := (select APS_ID from SYS_ANN_PHRASE_SET where APS_OWNER_UID = self.u_id and APS_NAME = ap_name);
               if (self.aps_id is null)
                 {
 		  declare c_id, s_id int;
@@ -81,7 +83,8 @@ function selectAllCheckboxes (form, btn)
 		  self.aps_id := s_id;
   		}
             }
-	  ]]></v:before-data-bind>
+          ]]>
+        </v:before-data-bind>
         <div class="box">
           <p>
           </p>
@@ -104,7 +107,9 @@ function selectAllCheckboxes (form, btn)
 	      </tr>
 	      <v:data-set name="dset"
 		  sql="select AP_TEXT, AP_LINK_DATA, AP_CHKSUM from SYS_ANN_PHRASE where AP_APS_ID = :self.aps_id"
-		  scrollable="1" editable="1" nrows="1000">
+                              scrollable="1"
+                              editable="1"
+                              nrows="1000">
 		  <v:before-data-bind>
 if (not e.ve_is_post and self.del_id is not null)
 {
@@ -178,7 +183,8 @@ control.vc_enabled := 0;
 		      </v:on-post>
 		  </v:button>
 		  <v:button name="save1" value="--case when self.edit_id is null then 'Add' else 'Update' end" action="simple">
-		      <v:on-post><![CDATA[
+                        <v:on-post>
+                          <![CDATA[
 declare url, pat varchar;
 if (not self.vc_is_valid)
   return;
@@ -198,20 +204,22 @@ self.a_url.ufl_value := null;
 control.vc_data_bind (e);
 self.cancel1.vc_data_bind (e);
 self.dset.vc_data_bind (e);
-]]></v:on-post>
+                          ]]>
+                        </v:on-post>
 		  </v:button>
 	      </span>
 	    </v:form>
 	    <v:form name="impf" type="simple" method="POST">
 	      <span class="fm_ctl_btn">
 		  <v:button action="simple" name="exp_btn1" value="Export"
-		      xhtml_onclick="--sprintf ('javascript: window.open (\'href_export.xml?:u=%d&contenttype=application/octet-stream&content-filename=hyperlinking_rules.xml\', \'export\', \'\'); return false', self.u_id)"
-		      enabled="--coalesce ((select top 1 1 from SYS_ANN_PHRASE, SYS_ANN_PHRASE_SET where  AP_APS_ID  = APS_ID and  APS_NAME = sprintf ('Hyperlinking-%d', self.u_id)), 0)">
+                          xhtml_onclick="--sprintf ('javascript: window.open (\'href_export.xml?:u=%d&contenttype=application/octet-stream&content-filename=hyperlinking_rules.xml\', \'export\', \'\'); return false', coalesce (self.u_id, -1))"
+                          enabled="--coalesce ((select top 1 1 from SYS_ANN_PHRASE, SYS_ANN_PHRASE_SET where  AP_APS_ID  = APS_ID and  APS_NAME = sprintf ('Hyperlinking-%d', coalesce (self.u_id, -1))), 0)">
 		  </v:button>
 		  <v:text type="file" name="exp_file" value="">
 		  </v:text>
 		  <v:button action="simple" name="imp_btn4" value="Import from File">
-		      <v:on-post><![CDATA[
+                        <v:on-post>
+                          <![CDATA[
 declare f, i, arr, xt, xp, phrase, href any;
 
 f := self.exp_file.ufl_value;
@@ -236,20 +244,24 @@ foreach (any p in xp) do
   }
 ap_add_phrases (self.aps_id, arr);
 self.tm1.vc_data_bind (e);
-			  ]]></v:on-post>
+                          ]]>
+                        </v:on-post>
 		  </v:button>
 		    <v:button name="import1" value="Import from MOAT" action="simple">
-		      <v:on-post><![CDATA[
+                        <v:on-post>
+                          <![CDATA[
 self.pg := 2;
 self.tm1.vc_enabled := 0;
 self.tm2.vc_enabled := 1;
-			]]></v:on-post>
+                          ]]>
+                        </v:on-post>
 		    </v:button>
 	      </span>
 	    </v:form>
 	      <span class="fm_ctl_btn">
 		    <v:button name="del_sel" value="Delete selected" action="simple">
-			<v:on-post><![CDATA[
+                      <v:on-post>
+                        <![CDATA[
 declare i, phrase any;
 
 i := 0;
@@ -259,8 +271,8 @@ while ((phrase := adm_next_checkbox ('cb_', params, i)))
   }
 if (row_count ())
   self.tm1.vc_data_bind (e);
-
-			]]></v:on-post>
+                        ]]>
+                      </v:on-post>
 		    </v:button>
 	      </span>
 	  </fieldset>
@@ -298,14 +310,17 @@ if (row_count ())
 	    <v:form name="impf2" type="simple" method="POST">
 	      <span class="fm_ctl_btn">
 		    <v:button name="cancel2" value="Cancel" action="simple">
-		      <v:on-post><![CDATA[
+                        <v:on-post>
+                          <![CDATA[
 self.pg := 1;
 self.tm1.vc_data_bind (e);
 self.tm2.vc_enabled := 0;
-			]]></v:on-post>
+                          ]]>
+                        </v:on-post>
 		    </v:button>
 		    <v:button name="import2" value="Import" action="simple">
-		      <v:on-post><![CDATA[
+                        <v:on-post>
+                          <![CDATA[
 declare arr, val, i, len, url any;
 
 arr := vector ();
@@ -323,7 +338,8 @@ ap_add_phrases (self.aps_id, arr);
 self.pg := 1;
 self.tm1.vc_data_bind (e);
 self.tm2.vc_enabled := 0;
-			]]></v:on-post>
+                          ]]>
+                        </v:on-post>
 		    </v:button>
 	      </span>
 	    </v:form>
diff --git a/appsrc/ODS-Framework/user_rdf.sql b/appsrc/ODS-Framework/user_rdf.sql
index e880183..8829dfe 100644
--- a/appsrc/ODS-Framework/user_rdf.sql
+++ b/appsrc/ODS-Framework/user_rdf.sql
@@ -1,5 +1,5 @@
 --
---  $Id: user_rdf.sql,v 1.8 2009/01/19 11:22:06 source Exp $
+--  $Id: user_rdf.sql,v 1.8.2.1 2010/09/20 10:15:31 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Framework/user_template.vspx b/appsrc/ODS-Framework/user_template.vspx
index f1d9352..8f41751 100644
--- a/appsrc/ODS-Framework/user_template.vspx
+++ b/appsrc/ODS-Framework/user_template.vspx
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: user_template.vspx,v 1.6 2007/04/04 09:37:52 source Exp $
+ -  $Id: user_template.vspx,v 1.6.2.1 2010/09/20 10:15:31 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/users/css/users.css b/appsrc/ODS-Framework/users/css/users.css
index b346064..e73d441 100644
--- a/appsrc/ODS-Framework/users/css/users.css
+++ b/appsrc/ODS-Framework/users/css/users.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: users.css,v 1.2.2.7 2010/06/25 11:13:27 source Exp $
+ *  $Id: users.css,v 1.2.2.9 2010/12/20 12:27:09 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -36,7 +36,7 @@ body {
 }
 
 .logo {
-  margin: 40px;
+  margin: 15px;
 }
 
 #ob {
diff --git a/appsrc/ODS-Framework/users/js/users.js b/appsrc/ODS-Framework/users/js/users.js
index 9b039ac..8586f85 100644
--- a/appsrc/ODS-Framework/users/js/users.js
+++ b/appsrc/ODS-Framework/users/js/users.js
@@ -170,13 +170,10 @@ function isErr(xmlDoc) {
 	return 0;
 }
 
-function widgetToggle (elm)
-{
+function widgetToggle(elm) {
   var _divs = elm.parentNode.parentNode.parentNode.getElementsByTagName ('div');
-  for (var i = 0; i < _divs.length; i++)
-  {
-    if (_divs[i].className == 'w_content')
-    {
+  for (var i = 0; i < _divs.length; i++) {
+    if (_divs[i].className == 'w_content') {
        if (_divs[i].style.display == 'none')
          OAT.Dom.show (_divs[i]);
        else
@@ -494,7 +491,7 @@ function buildObjByChildNodes(elm) {
 var lfTab;
 var rfTab;
 var ufTab;
-var pfPages = [['pf_page_0_0', 'pf_page_0_1', 'pf_page_0_2', 'pf_page_0_3', 'pf_page_0_4', 'pf_page_0_5', 'pf_page_0_6', 'pf_page_0_7', 'pf_page_0_8', 'pf_page_0_9'], ['pf_page_1_0', 'pf_page_1_1', 'pf_page_1_2', 'pf_page_1_3'], ['pf_page_2']];
+var pfPages = [['pf_page_0_0', 'pf_page_0_1', 'pf_page_0_2', 'pf_page_0_3', 'pf_page_0_4', 'pf_page_0_5', 'pf_page_0_6', 'pf_page_0_7', 'pf_page_0_8', 'pf_page_0_9', 'pf_page_0_10'], ['pf_page_1_0', 'pf_page_1_1', 'pf_page_1_2', 'pf_page_1_3'], ['pf_page_2_0', 'pf_page_2_1', 'pf_page_2_2', 'pf_page_2_3', 'pf_page_2_4', 'pf_page_2_5', 'pf_page_2_6']];
 
 var setupWin;
 var cRDF;
@@ -504,10 +501,11 @@ var userData;
 var sslData;
 var aclData;
 var facebookData;
+var validateSession = false;
 
 // init
-function myInit() {
-	// CalendarPopup
+function init()
+{
 	OAT.Preferences.imagePath = "/ods/images/oat/";
 	OAT.Preferences.stylePath = "/ods/oat/styles/";
 	OAT.Preferences.showAjax = false;
@@ -519,6 +517,19 @@ function myInit() {
   }
   OAT.AJAX.GET ('/ods/api/server.getInfo?info=regData', false, x, {async: false});
 
+  var uriParams = OAT.Dom.uriParams();
+  var startForm;
+  if (typeof (uriParams['sid']) != 'undefined' && uriParams['sid'] != '') {
+    $('sid').value = uriParams['sid'];
+    var S = '/ods/api/user.validate?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm'));
+    var x = function (data) {
+      var xml = OAT.Xml.createXmlDoc(data);
+      if (!hasError(xml)) {
+        validateSession = true;
+      }
+    }
+    OAT.AJAX.GET (S, false, x, {async: false});
+  }
 	if ($("lf")) {
     lfTab = new OAT.Tab("lf_content", {goCallback: lfCallback});
 		lfTab.add("lf_tab_0", "lf_page_0");
@@ -527,18 +538,44 @@ function myInit() {
 		lfTab.add("lf_tab_1", "lf_page_1");
 		lfTab.add("lf_tab_2", "lf_page_2");
 		lfTab.add("lf_tab_3", "lf_page_3");
+    if (regData.twitterEnable)
+      OAT.Dom.show('lf_tab_4');
+    lfTab.add("lf_tab_4", "lf_page_4");
+    if (regData.linkedinEnable)
+      OAT.Dom.show('lf_tab_5');
+    lfTab.add("lf_tab_5", "lf_page_5");
 		lfTab.go(0);
-    var uriParams = OAT.Dom.uriParams();
     if (uriParams['oid-form'] == 'lf') {
-      $('lf_openId').value = uriParams['openid.identity'];
+      startForm = 'lf';
       OAT.Dom.show('lf');
       OAT.Dom.hide('rf');
+      if (uriParams['oid-mode'] == 'twitter') {
+        lfTab.go(4);
+        OAT.AJAX.POST ('/ods/api/user.authenticate' +
+          '?oauthMode=twitter' +
+          '&oauthSid=' + encodeURIComponent(uriParams['sid']) +
+          '&oauthVerifier=' + encodeURIComponent(uriParams['oauth_verifier']) +
+          '&oauthToken=' + encodeURIComponent(uriParams['oauth_token']), null, afterLogin);
+      }
+      else if (uriParams['oid-mode'] == 'linkedin')
+      {
+        lfTab.go(5);
+        OAT.AJAX.POST ('/ods/api/user.authenticate' +
+          '?oauthMode=linkedin' +
+          '&oauthSid=' + encodeURIComponent(uriParams['sid']) +
+          '&oauthVerifier=' + encodeURIComponent(uriParams['oauth_verifier']) +
+          '&oauthToken=' + encodeURIComponent(uriParams['oauth_token']), null, afterLogin);
+      }
+      else
+      {
+        $('lf_openId').value = uriParams['openid.identity'];
       lfTab.go(1);
       if (typeof (uriParams['openid.signed']) != 'undefined' && uriParams['openid.signed'] != '') {
-        OAT.AJAX.POST ("/ods/api/user.authenticate", openIdLoginURL(uriParams), afterLogin);
+          OAT.AJAX.POST ('/ods/api/user.authenticate', openIdLoginURL(uriParams), afterLogin);
       } else if (typeof (uriParams['openid.mode']) != 'undefined' && uriParams['openid.mode'] == 'cancel') {
       alert('OpenID Authentication Failed');
     }
+      }
 				}
 	}
 	if ($("rf")) {
@@ -549,12 +586,69 @@ function myInit() {
 		rfTab.add("rf_tab_1", "rf_page_1");
 		rfTab.add("rf_tab_2", "rf_page_2");
 		rfTab.add("rf_tab_3", "rf_page_3");
+    if (regData.twitterEnable)
+      OAT.Dom.show('rf_tab_4');
+    rfTab.add("rf_tab_4", "rf_page_4");
+    if (regData.linkedinEnable)
+      OAT.Dom.show('rf_tab_5');
+    rfTab.add("rf_tab_5", "rf_page_5");
 		rfTab.go(0);
 
-    var uriParams = OAT.Dom.uriParams();
     if (uriParams['oid-form'] == 'rf') {
+      startForm = 'rf';
       OAT.Dom.hide('lf');
       OAT.Dom.show('rf');
+      if (uriParams['oid-mode'] == 'twitter') {
+        rfTab.go(4);
+        $('rf_is_agreed').checked = true;
+        var x = function (data) {
+          var xml = OAT.Xml.createXmlDoc(data);
+          var user = xml.getElementsByTagName('user')[0];
+          if (user && user.getElementsByTagName('id')[0]) {
+            hiddenCreate('twitter-data', null, data);
+            var tbl = $('rf_table_4');
+            addProfileRowValue(tbl, 'Login Name', tagValue(user, 'screen_name'));
+            addProfileRowInput(tbl, 'E-Mail', 'rf_twitter_email');
+          }
+          else
+          {
+            alert('Twitter Authentication Failed');
+          }
+        }
+        var S = "/ods/api/twitterVerify"+
+          '?sid=' + encodeURIComponent(uriParams['sid']) +
+          '&oauth_verifier=' + encodeURIComponent(uriParams['oauth_verifier']) +
+          '&oauth_token=' + encodeURIComponent(uriParams['oauth_token']);
+
+        OAT.AJAX.POST (S, null, x);
+      }
+      else if (uriParams['oid-mode'] == 'linkedin')
+      {
+        rfTab.go(5);
+        $('rf_is_agreed').checked = true;
+        var x = function (data) {
+          var xml = OAT.Xml.createXmlDoc(data);
+          var user = xml.getElementsByTagName('person')[0];
+          if (user && user.getElementsByTagName('id')[0]) {
+            hiddenCreate('linkedin-data', null, data);
+            var tbl = $('rf_table_5');
+            rfRowValue(tbl, 'Login Name', OAT.Xml.textValue(user.getElementsByTagName('first-name')[0]));
+            rfRowInput(tbl, 'E-Mail', 'rf_linkedin_email');
+          }
+          else
+          {
+            alert('LinkedIn Authentication Failed');
+          }
+        }
+        var S = "/ods/api/linkedinVerify"+
+          '?sid=' + encodeURIComponent(uriParams['sid']) +
+          '&oauth_verifier=' + encodeURIComponent(uriParams['oauth_verifier']) +
+          '&oauth_token=' + encodeURIComponent(uriParams['oauth_token']);
+
+        OAT.AJAX.POST (S, null, x);
+      }
+      else
+      {
 	    rfTab.go(1);
       if (typeof (uriParams['openid.signed']) != 'undefined' && uriParams['openid.signed'] != '') {
         var x = function (params, param, data, property) {
@@ -562,15 +656,22 @@ function myInit() {
             data[property] = params[param];
         }
         var data = {};
-        if (typeof (uriParams['openid.ns.ax']) != 'undefined' && uriParams['openid.ns.ax'] == 'http://openid.net/srv/ax/1.0') {
-          x(uriParams, 'openid.ax.value.country', data, 'homeCountry');
-          x(uriParams, 'openid.ax.value.email', data, 'mbox');
-          x(uriParams, 'openid.ax.value.firstname', data, 'firstName');
-          x(uriParams, 'openid.ax.value.fname', data, 'name');
-          x(uriParams, 'openid.ax.value.language', data, 'language');
-          x(uriParams, 'openid.ax.value.lastname', data, 'family_name');
-          x(uriParams, 'openid.ax.value.fname', data, 'nick');
-          x(uriParams, 'openid.ax.value.timezone', data, 'timezone');
+        var ns;
+        for (var prop in uriParams) {
+          if (uriParams.hasOwnProperty(prop) && (uriParams[prop] == 'http://openid.net/srv/ax/1.0')) {
+            ns = prop.replace('openid.ax.', '');
+            break;
+          }
+        }
+        if (ns) {
+          x(uriParams, 'openid.'+ns+'.value.country', data, 'homeCountry');
+          x(uriParams, 'openid.'+ns+'.value.email', data, 'mbox');
+          x(uriParams, 'openid.'+ns+'.value.firstname', data, 'firstName');
+          x(uriParams, 'openid.'+ns+'.value.fname', data, 'name');
+          x(uriParams, 'openid.'+ns+'.value.language', data, 'language');
+          x(uriParams, 'openid.'+ns+'.value.lastname', data, 'family_name');
+          x(uriParams, 'openid.'+ns+'.value.fname', data, 'nick');
+          x(uriParams, 'openid.'+ns+'.value.timezone', data, 'timezone');
         } else {
         x(uriParams, 'openid.sreg.nickname', data, 'nick');
         x(uriParams, 'openid.sreg.email', data, 'mbox');
@@ -603,6 +704,7 @@ function myInit() {
       {
         alert('OpenID Authentication Failed');
 				}
+      }
 			}
 		}
 	if ($("lf") || $("rf") || $("pf")) {
@@ -680,71 +782,119 @@ function myInit() {
     }
     OAT.AJAX.GET ('/ods/api/server.getInfo?info=sslPort', false, x);
   }
-	if ($("uf")) {
-		ufTab = new OAT.Tab("uf_content");
-		ufTab.add("uf_tab_0", "uf_page_0");
-		ufTab.add("uf_tab_1", "uf_page_1");
-		ufTab.add("uf_tab_2", "uf_page_2");
-		ufTab.add("uf_tab_3", "uf_page_3");
-		ufTab.add("uf_tab_4", "uf_page_4");
-		ufTab.go(0);
-		if ($("uf_rdf_content")) {
-      try {
-  			cRDF = new OAT.RDFMini($("uf_rdf_content"), {showSearch : false});
-      } catch (e) {}
-    }
-	}
 	if ($('pf')) {
 	  var obj = $('formTab');
-	  if (!obj) {hiddenCreate('formSubtab', null, '0');}
-	  var obj = $('formSubtab');
-	  if (!obj) {hiddenCreate('formSubtab', null, '0');}
-
-    OAT.Event.attach("pf_tab_0", 'click', function(){pfTabSelect('pf_tab_', 0, 'pf_tab_0_');});
-    OAT.Event.attach("pf_tab_1", 'click', function(){pfTabSelect('pf_tab_', 1, 'pf_tab_1_');});
-    OAT.Event.attach("pf_tab_2", 'click', function(){pfTabSelect('pf_tab_', 2, 'pf_tab_0_');});
+    if (!obj) {hiddenCreate('formTab2', null, '0');}
+    var obj = $('formTab2');
+    if (!obj) {hiddenCreate('formTab2', null, '0');}
+    var obj = $('formTab3');
+    if (!obj) {hiddenCreate('formTab3', null, '0');}
+
+    OAT.Event.attach("pf_tab_0", 'click', function(){pfTabSelect('pf_tab_', 0);});
+    OAT.Event.attach("pf_tab_1", 'click', function(){pfTabSelect('pf_tab_', 1);});
+    OAT.Event.attach("pf_tab_2", 'click', function(){pfTabSelect('pf_tab_', 2);});
     pfTabInit('pf_tab_', $v('formTab'));
 
-    OAT.Event.attach("pf_tab_0_0", 'click', function(){pfTabSelect('pf_tab_0_', 0);});
-    OAT.Event.attach("pf_tab_0_1", 'click', function(){pfTabSelect('pf_tab_0_', 1);});
-    OAT.Event.attach("pf_tab_0_2", 'click', function(){pfTabSelect('pf_tab_0_', 2);});
-    OAT.Event.attach("pf_tab_0_3", 'click', function(){pfTabSelect('pf_tab_0_', 3);});
-    OAT.Event.attach("pf_tab_0_4", 'click', function(){pfTabSelect('pf_tab_0_', 4);});
-    OAT.Event.attach("pf_tab_0_5", 'click', function(){pfTabSelect('pf_tab_0_', 5);});
-    OAT.Event.attach("pf_tab_0_6", 'click', function(){pfTabSelect('pf_tab_0_', 6);});
-    OAT.Event.attach("pf_tab_0_7", 'click', function(){pfTabSelect('pf_tab_0_', 7);});
-    OAT.Event.attach("pf_tab_0_8", 'click', function(){pfTabSelect('pf_tab_0_', 8);});
-    OAT.Event.attach("pf_tab_0_9", 'click', function(){pfTabSelect('pf_tab_0_', 9);});
-    pfTabInit('pf_tab_0_', $v('formSubtab'));
-
-    OAT.Event.attach("pf_tab_1_0", 'click', function(){pfTabSelect('pf_tab_1_', 0);});
-    OAT.Event.attach("pf_tab_1_1", 'click', function(){pfTabSelect('pf_tab_1_', 1);});
-    OAT.Event.attach("pf_tab_1_2", 'click', function(){pfTabSelect('pf_tab_1_', 2);});
-    OAT.Event.attach("pf_tab_1_3", 'click', function(){pfTabSelect('pf_tab_1_', 3);});
-    pfTabInit('pf_tab_1_', $v('formSubtab'));
+    OAT.Event.attach("pf_tab_0_0", 'click', function(){pfTabSelect('pf_tab_0_', 0, 0);});
+    OAT.Event.attach("pf_tab_0_1", 'click', function(){pfTabSelect('pf_tab_0_', 0, 1);});
+    OAT.Event.attach("pf_tab_0_2", 'click', function(){pfTabSelect('pf_tab_0_', 0, 2);});
+    OAT.Event.attach("pf_tab_0_3", 'click', function(){pfTabSelect('pf_tab_0_', 0, 3);});
+    OAT.Event.attach("pf_tab_0_4", 'click', function(){pfTabSelect('pf_tab_0_', 0, 4);});
+    OAT.Event.attach("pf_tab_0_5", 'click', function(){pfTabSelect('pf_tab_0_', 0, 5);});
+    pfTabInit('pf_tab_0_', $v('formTab2'));
+
+    OAT.Event.attach("pf_tab_0_5_0", 'click', function(){pfTabSelect('pf_tab_0_5_', 0, 5, 0);});
+    OAT.Event.attach("pf_tab_0_5_1", 'click', function(){pfTabSelect('pf_tab_0_5_', 0, 5, 1);});
+    OAT.Event.attach("pf_tab_0_5_2", 'click', function(){pfTabSelect('pf_tab_0_5_', 0, 5, 2);});
+    OAT.Event.attach("pf_tab_0_5_3", 'click', function(){pfTabSelect('pf_tab_0_5_', 0, 5, 3);});
+    OAT.Event.attach("pf_tab_0_5_4", 'click', function(){pfTabSelect('pf_tab_0_5_', 0, 5, 4);});
+    OAT.Event.attach("pf_tab_0_5_5", 'click', function(){pfTabSelect('pf_tab_0_5_', 0, 5, 5);});
+    OAT.Event.attach("pf_tab_0_5_6", 'click', function(){pfTabSelect('pf_tab_0_5_', 0, 5, 6);});
+    OAT.Event.attach("pf_tab_0_5_7", 'click', function(){pfTabSelect('pf_tab_0_5_', 0, 5, 7);});
+    pfTabInit('pf_tab_0_5_', $v('formTab3'));
+
+    OAT.Event.attach("pf_tab_1_0", 'click', function(){pfTabSelect('pf_tab_1_', 1, 0);});
+    OAT.Event.attach("pf_tab_1_1", 'click', function(){pfTabSelect('pf_tab_1_', 1, 1);});
+    OAT.Event.attach("pf_tab_1_2", 'click', function(){pfTabSelect('pf_tab_1_', 1, 2);});
+    OAT.Event.attach("pf_tab_1_3", 'click', function(){pfTabSelect('pf_tab_1_', 1, 3);});
+    pfTabInit('pf_tab_1_', $v('formTab2'));
+
+    OAT.Event.attach("pf_tab_2_0", 'click', function(){pfTabSelect('pf_tab_2_', 2, 0);});
+    OAT.Event.attach("pf_tab_2_1", 'click', function(){pfTabSelect('pf_tab_2_', 2, 1);});
+    OAT.Event.attach("pf_tab_2_2", 'click', function(){pfTabSelect('pf_tab_2_', 2, 2);});
+    OAT.Event.attach("pf_tab_2_3", 'click', function(){pfTabSelect('pf_tab_2_', 2, 3);});
+    OAT.Event.attach("pf_tab_2_4", 'click', function(){pfTabSelect('pf_tab_2_', 2, 4);});
+    var x = function (data) {
+      var url;
+      try {
+        var url = OAT.JSON.parse(data);
+      } catch (e) { url = null; }
+      if (url != null) {
+        if (url != '') {
+          var a = OAT.Dom.create('a');
+          a.href = url;
+          a.innerHTML = 'Certificate Generator';
+          a.style.cssText = 'color: #000; text-decoration: none;';
+          $("pf_tab_2_5").innerHTML = '';
+          $("pf_tab_2_5").appendChild(a);
+          OAT.Dom.show("pf_tab_2_5");
+        }
+      } else {
+        OAT.Event.attach("pf_tab_2_5", 'click', function(){pfTabSelect('pf_tab_2_', 2, 5);});
+      OAT.Dom.show("pf_tab_2_5");
+      }
+    }
+    OAT.AJAX.GET ('/ods/api/user.certificateUrl?sid='+encodeURIComponent($v('sid'))+'&realm='+encodeURIComponent($v('realm')), false, x, {async: false});
+    OAT.Event.attach("pf_tab_2_6", 'click', function(){pfTabSelect('pf_tab_2_', 2, 6);});
+
+    pfTabInit('pf_tab_2_', $v('formTab2'));
 	}
+  if (!startForm) {
+    var userName;
+    if (typeof (uriParams['userName']) != 'undefined' && uriParams['userName'] != '')
+      userName = uriParams['userName'];
+
+    if (validateSession || userName)
+      selectProfile(userName);
+  }
+
+  OAT.MSG.send(OAT, 'PAGE_LOADED');
 }
 
-function lfCallback(oldIndex, newIndex) {
+function lfCallback(oldIndex, newIndex)
+{
   if (newIndex == 0)
     $('lf_login').value = 'Login';
-  if (newIndex == 1)
+  else if (newIndex == 1)
     $('lf_login').value = 'OpenID Login';
-  if (newIndex == 2)
+  else if (newIndex == 2)
     $('lf_login').value = 'Facebook Login';
-  if (newIndex == 3)
+  else if (newIndex == 3)
     $('lf_login').value = 'WebID Login';
+  else if (newIndex == 4)
+    $('lf_login').value = 'Twitter Login';
+  else if (newIndex == 5)
+    $('lf_login').value = 'LinkedIn Login';
+
+  pageFocus('lf_page_'+newIndex);
 }
 
-function rfCallback(oldIndex, newIndex) {
+function rfCallback(oldIndex, newIndex)
+{
   if (newIndex == 0)
     $('rf_signup').value = 'Sign Up';
-  if (newIndex == 1)
+  else if (newIndex == 1)
     $('rf_signup').value = 'OpenID Sign Up';
-  if (newIndex == 2)
+  else if (newIndex == 2)
     $('rf_signup').value = 'Facebook Sign Up';
-  if (newIndex == 3)
+  else if (newIndex == 3)
     $('rf_signup').value = 'WebID Sign Up';
+  else if (newIndex == 4)
+    $('rf_signup').value = 'Twitter Sign Up';
+  else if (newIndex == 5)
+    $('rf_signup').value = 'LinkedIn Sign Up';
+
+  pageFocus('rf_page_'+newIndex);
 }
 
 function myCancel(prefix)
@@ -752,6 +902,7 @@ function myCancel(prefix)
   needToConfirm = false;
   OAT.Dom.show(prefix+'_list');
   OAT.Dom.hide(prefix+'_form');
+  OAT.Dom.hide(prefix+'_import');
   $('formMode').value = '';
   return false;
 }
@@ -759,41 +910,109 @@ function myCancel(prefix)
 function mySubmit(prefix)
 {
   needToConfirm = false;
-  if (validateInputs($(prefix+'_id'), prefix)) {
-    if (prefix == 'pf06') {
+  if (($v('formMode') == 'import') || validateInputs($(prefix+'_id'), prefix)) {
+    if (prefix == 'pf051') {
+      var S = '/ods/api/user.owns.'+ $v('formMode') +'?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm'))
+              + '&id=' + encodeURIComponent($v('pf051_id'))
+              + '&flag=' + encodeURIComponent($v('pf051_flag'))
+              + '&name=' + encodeURIComponent($v('pf051_name'))
+              + '&comment=' + encodeURIComponent($v('pf051_comment'))
+              + '&properties=' + encodeURIComponent(prepareItems('ow'));
+      OAT.AJAX.GET(S, '', function(data){pfShowOffers();});
+    }
+    if (prefix == 'pf052') {
       var S = '/ods/api/user.favorites.'+ $v('formMode') +'?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm'))
-              + '&id=' + encodeURIComponent($v('pf06_id'))
-              + '&label=' + encodeURIComponent($v('pf06_label'))
-              + '&uri=' + encodeURIComponent($v('pf06_uri'))
+              + '&id=' + encodeURIComponent($v('pf052_id'))
+              + '&flag=' + encodeURIComponent($v('pf052_flag'))
+              + '&label=' + encodeURIComponent($v('pf052_label'))
+              + '&uri=' + encodeURIComponent($v('pf052_uri'))
               + '&properties=' + encodeURIComponent(prepareProperties('r'));
       OAT.AJAX.GET(S, '', function(data){pfShowFavorites();});
     }
-    if (prefix == 'pf07') {
+    if (prefix == 'pf053') {
     	var S = '/ods/api/user.mades.'+ $v('formMode') +'?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm'))
-              + '&id=' + encodeURIComponent($v('pf07_id'))
-              + '&property=' + encodeURIComponent($v('pf07_property'))
-              + '&url=' + encodeURIComponent($v('pf07_url'))
-              + '&description=' + encodeURIComponent($v('pf07_description'));
+              + '&id=' + encodeURIComponent($v('pf053_id'))
+              + '&property=' + encodeURIComponent($v('pf053_property'))
+              + '&url=' + encodeURIComponent($v('pf053_url'))
+              + '&description=' + encodeURIComponent($v('pf053_description'));
     	OAT.AJAX.GET(S, '', function(data){pfShowMades();});
     }
-    if (prefix == 'pf08') {
+    if (prefix == 'pf054') {
     	var S = '/ods/api/user.offers.'+ $v('formMode') +'?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm'))
-              + '&id=' + encodeURIComponent($v('pf08_id'))
-              + '&name=' + encodeURIComponent($v('pf08_name'))
-              + '&comment=' + encodeURIComponent($v('pf08_comment'))
+              + '&id=' + encodeURIComponent($v('pf054_id'))
+              + '&flag=' + encodeURIComponent($v('pf054_flag'))
+              + '&name=' + encodeURIComponent($v('pf054_name'))
+              + '&comment=' + encodeURIComponent($v('pf054_comment'))
               + '&properties=' + encodeURIComponent(prepareItems('ol'));
     	OAT.AJAX.GET(S, '', function(data){pfShowOffers();});
     }
-    if (prefix == 'pf09') {
+    if (prefix == 'pf055') {
     	var S = '/ods/api/user.seeks.'+ $v('formMode') +'?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm'))
-              + '&id=' + encodeURIComponent($v('pf09_id'))
-              + '&name=' + encodeURIComponent($v('pf09_name'))
-              + '&comment=' + encodeURIComponent($v('pf09_comment'))
+              + '&id=' + encodeURIComponent($v('pf055_id'))
+              + '&flag=' + encodeURIComponent($v('pf055_flag'))
+              + '&name=' + encodeURIComponent($v('pf055_name'))
+              + '&comment=' + encodeURIComponent($v('pf055_comment'))
               + '&properties=' + encodeURIComponent(prepareItems('wl'));
     	OAT.AJAX.GET(S, '', function(data){pfShowSeeks();});
     }
+    if (prefix == 'pf056') {
+      var S = '/ods/api/user.likes.'+ $v('formMode') +'?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm'))
+              + '&id=' + encodeURIComponent($v('pf056_id'))
+              + '&flag=' + encodeURIComponent($v('pf056_flag'))
+              + '&uri=' + encodeURIComponent($v('pf056_uri'))
+              + '&type=' + encodeURIComponent($v('pf056_type'))
+              + '&name=' + encodeURIComponent($v('pf056_name'))
+              + '&comment=' + encodeURIComponent($v('pf056_comment'))
+              + '&properties=' + encodeURIComponent(prepareItems('ld'));
+      OAT.AJAX.GET(S, '', function(data){pfShowLikes();});
+    }
+    if (prefix == 'pf057') {
+      var items = [];
+      if ($v('formMode') == 'import') {
+        var form = $('page_form');
+        for (var N = 0; N < form.elements.length; N++)
+        {
+          if (!form.elements[N])
+            continue;
+
+          var ctrl = form.elements[N];
+          if (typeof(ctrl.type) == 'undefined')
+            continue;
+
+          if (ctrl.name.indexOf("k_fld_1_") != 0)
+            continue;
+
+          var suffix = ctrl.name.replace("k_fld_1_", "");
+          items.push(["", $v("k_fld_1_"+suffix), $v("k_fld_2_"+suffix), $v("k_fld_3_"+suffix)]);
+        }
+        $('formMode').value = 'new';
+        TBL.clean('k');
+      } else {
+        items = [[$v("pf057_id"), $v("pf057_flag"), $v("pf057_uri"), $v("pf057_label")]];
+      }
+      for (var N = 0; N < items.length; N++) {
+        var S = '/ods/api/user.knows.'+ $v('formMode') +'?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm'))
+                + '&id=' + encodeURIComponent(items[N][0])
+                + '&flag=' + encodeURIComponent(items[N][1])
+                + '&uri=' + encodeURIComponent(items[N][2])
+                + '&label=' + encodeURIComponent(items[N][3]);
+        if (N == items.length-1) {
+          OAT.AJAX.GET(S, '', function(data){pfShowKnows();});
+        } else {
+          OAT.AJAX.GET(S, null, null);
+        }
+      }
+    }
+    if (prefix == 'pf26') {
+      var S = '/ods/api/user.certificates.'+ $v('formMode') +'?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm'))
+              + '&id=' + encodeURIComponent($v('pf26_id'))
+              + '&certificate=' + encodeURIComponent($v('pf26_certificate'))
+              + '&enableLogin=' + encodeURIComponent($('pf26_enableLogin').checked? '1': '0');
+      OAT.AJAX.GET(S, '', function(data){pfShowCertificates();});
+    }
     OAT.Dom.show(prefix+'_list');
     OAT.Dom.hide(prefix+'_form');
+    OAT.Dom.hide(prefix+'_import');
     $('formMode').value = '';
   }
   return false;
@@ -802,12 +1021,16 @@ function mySubmit(prefix)
 function submitItems()
 {
   if ($('items')) {
-    if ($v('formTab') == '0' && $v('formSubtab') == '6' && $v('formMode') != '')
+    if ($v('formTab') == '0' && $v('formTab2') == '5' && $v('formTab3') == '1' && $v('formMode') != '')
+      $('items').value = prepareItems('ow');
+    if ($v('formTab') == '0' && $v('formTab2') == '5' && $v('formTab3') == '2' && $v('formMode') != '')
       $('items').value = prepareProperties('r');
-    if ($v('formTab') == '0' && $v('formSubtab') == '8' && $v('formMode') != '')
+    if ($v('formTab') == '0' && $v('formTab2') == '5' && $v('formTab3') == '4' && $v('formMode') != '')
       $('items').value = prepareItems('ol');
-    if ($v('formTab') == '0' && $v('formSubtab') == '9' && $v('formMode') != '')
+    if ($v('formTab') == '0' && $v('formTab2') == '5' && $v('formTab3') == '5' && $v('formMode') != '')
       $('items').value = prepareItems('wl');
+    if ($v('formTab') == '0' && $v('formTab2') == '5' && $v('formTab3') == '6' && $v('formMode') != '')
+      $('items').value = prepareItems('ld');
   }
 }
 
@@ -817,17 +1040,52 @@ function myBeforeSubmit()
   submitItems()
 }
 
+function myValidateInputs(fld)
+{
+  var form = fld.form;
+  var formTab = parseInt($v('formTab'));
+  var formTab2 = parseInt($v('formTab2'));
+  var div = $(pfPages[formTab][formTab2]);
+
+  for (var i = 0; i < form.elements.length; i++)
+  {
+    if (!form.elements[i])
+      continue;
+
+    var ctrl = form.elements[i];
+    if (typeof(ctrl.type) == 'undefined')
+      continue;
+
+    if (ctrl.disabled)
+      continue;
+
+     if (!OAT.Dom.isChild(ctrl, div))
+      continue;
+
+    if (OAT.Dom.isClass(ctrl, 'dummy'))
+      continue;
+
+    if (OAT.Dom.isClass(ctrl, '_validate_'))
+    {
+      retValue = validateField(ctrl);
+      if (!retValue)
+        return retValue;
+    }
+  }
+  return true;
+}
+
 var needToConfirm = true;
 function myCheckLeave (form)
 {
   var formTab = parseInt($v('formTab'));
-  var formSubtab = parseInt($v('formSubtab'));
-  var div = $(pfPages[formTab][formSubtab]);
+  var formTab2 = parseInt($v('formTab2'));
+  var div = $(pfPages[formTab][formTab2]);
   var dirty = false;
   var retValue = true;
 
   submitItems()
-  if (needToConfirm && (formTab < 2))
+  if (needToConfirm && (formTab < 3))
   {
     for (var i = 0; i < form.elements.length; i++)
     {
@@ -844,9 +1102,6 @@ function myCheckLeave (form)
       if (ctrl.disabled)
         continue;
 
-      if (ctrl.disabled)
-        continue;
-
 			if (OAT.Dom.isClass(ctrl, 'dummy'))
         continue;
 
@@ -883,9 +1138,13 @@ function myCheckLeave (form)
       if ($('form'))
       {
         if (retValue) {
+          retValue = myValidateInputs($('formTab'));
+          if (retValue) {
           hiddenCreate('pf_update', null, 'x');
           form.submit();
         }
+        }
+        retValue = false;
       } else {
         retValue = !retValue;
       }
@@ -898,8 +1157,8 @@ function pfSetACLSelects (obj)
 {
   var form = obj.form;
   var formTab = parseInt($v('formTab'));
-  var formSubtab = parseInt($v('formSubtab'));
-  var div = $(pfPages[formTab][formSubtab]);
+  var formTab2 = parseInt($v('formTab2'));
+  var div = $(pfPages[formTab][formTab2]);
 
   for (var i = 0; i < form.elements.length; i++)
   {
@@ -934,29 +1193,44 @@ function pfParam(fldName)
   return S;
 }
 
-function pfTabSelect(tabPrefix, newIndex, subtabPrefix) {
+function pfTabSelect(tabPrefix, newIndex, newIndex2, newIndex3)
+{
   $('formMode').value = '';
-  if (subtabPrefix) {
-    if ($v('formTab') == newIndex) {return;}
+  if (newIndex3 != null) {
+    if ($v('formTab3') == newIndex3) {return;}
+  } else if (newIndex2 != null) {
+    if ($v('formTab2') == newIndex2) {return;}
   } else {
-    if ($v('formSubtab') == newIndex) {return;}
+    if ($v('formTab') == newIndex) {return;}
   }
   if ($('form')) {
-    var S = '?'+pfParam('sid')+pfParam('realm')+pfParam('form');
-    if (subtabPrefix) {
-      S += '&formTab='+newIndex+'&formSubtab=0';
-    } else {
-      S += pfParam('formTab')+'&formSubtab='+newIndex;
-    }
+    var S = '?'+pfParam('sid')+pfParam('realm')+pfParam('form')+'&formTab='+newIndex;
+    if (newIndex2)
+      S += '&formTab2='+newIndex2;
+
+    if (newIndex3)
+      S += '&formTab3='+newIndex3;
+
     document.location = document.location.protocol + '//' + document.location.host + document.location.pathname + S;
     return;
   }
   if (myCheckLeave($('page_form'))) {
-    if (subtabPrefix) {
+    if (newIndex3) {
       $('formTab').value = newIndex;
-      $('formSubtab').value = 0;
-    } else {
-      $('formSubtab').value = newIndex;
+      $('formTab2').value = newIndex2;
+      $('formTab3').value = newIndex3;
+    }
+    else if (newIndex2)
+    {
+      $('formTab').value = newIndex;
+      $('formTab2').value = newIndex2;
+      $('formTab3').value = 0;
+    }
+    else
+    {
+      $('formTab').value = newIndex;
+      $('formTab2').value = 0;
+      $('formTab3').value = 0;
     }
     ufProfileLoad();
   } else {
@@ -978,7 +1252,8 @@ function pfTabInit(tabPrefix, newIndex) {
   }
 }
 
-function pfShowRows(prefix, values, delimiters, showRow, acl, aclName) {
+function pfShowRows(prefix, values, delimiters, showRow, acl, aclName)
+{
   var rowCount = 0;
   var tbl = prefix+'_tbl';
 	var tmpLines = values.split(delimiters[0]);
@@ -1000,7 +1275,8 @@ function pfShowRows(prefix, values, delimiters, showRow, acl, aclName) {
   fieldACLUpdate(acl, aclName);
 }
 
-function pfShowBioEvents(prefix, showRow) {
+function pfShowBioEvents(prefix, showRow)
+{
   var x = function (data)
   {
     var rowCount = 0;
@@ -1023,7 +1299,8 @@ function pfShowBioEvents(prefix, showRow) {
 	OAT.AJAX.GET('/ods/api/user.bioEvents.list?sid='+encodeURIComponent($v('sid'))+'&realm='+encodeURIComponent($v('realm')), '', x);
 }
 
-function pfShowOnlineAccounts(prefix, accountType, showRow) {
+function pfShowOnlineAccounts(prefix, accountType, showRow)
+{
   var x = function (data)
   {
     var rowCount = 0;
@@ -1046,7 +1323,8 @@ function pfShowOnlineAccounts(prefix, accountType, showRow) {
 	OAT.AJAX.GET('/ods/api/user.onlineAccounts.list?sid='+encodeURIComponent($v('sid'))+'&realm='+encodeURIComponent($v('realm'))+'&type='+accountType, '', x);
 }
 
-function pfShowItem(api, prefix, names, cb) {
+function pfShowItem(api, prefix, names, cb)
+{
   var x = function (data)
   {
 		var o = null;
@@ -1060,7 +1338,12 @@ function pfShowItem(api, prefix, names, cb) {
     	  var name = names[N];
     	  var fld = $(prefix+'_'+name);
     	  if (fld && (o[name] != null))
-    	    fld.value = o[name];
+          if (fld.tagName == 'SPAN')
+          {
+            fld.innerHTML = o[name];
+          } else {
+            fieldValue(fld, o[name]);
+          }
     	}
     	if (cb) {cb(o);}
     }
@@ -1068,7 +1351,8 @@ function pfShowItem(api, prefix, names, cb) {
   OAT.AJAX.GET('/ods/api/'+api+'?sid='+encodeURIComponent($v('sid'))+'&realm='+encodeURIComponent($v('realm'))+'&id='+$v(prefix+'_id'), '', x);
 }
 
-function pfShowList(api, prefix, noMsg, cols, idIndex, cb) {
+function pfShowList(api, prefix, noMsg, cols, idIndex, cb)
+{
   var x = function (data)
   {
     function buttonShow (elm, actionButton, srcButton, textButton) {
@@ -1126,41 +1410,70 @@ function pfShowList(api, prefix, noMsg, cols, idIndex, cb) {
 	OAT.AJAX.GET('/ods/api/'+api+'?sid='+encodeURIComponent($v('sid'))+'&realm='+encodeURIComponent($v('realm')), '', x);
 }
 
-function pfDeleteListObject(api, id, cb) {
+function pfDeleteListObject(api, id, cb)
+{
   if (confirm('Are you sure you want to delete this record?')) {
     var deleteApi = api.replace('list', 'delete');
 	  OAT.AJAX.GET('/ods/api/'+deleteApi+'?sid='+encodeURIComponent($v('sid'))+'&realm='+encodeURIComponent($v('realm'))+'&id='+id, '', cb);
 	}
 }
 
-function pfEditListObject(prefix, id) {
+function pfEditListObject(prefix, id)
+{
   hiddenCreate(prefix+'_id', $('page_form'), id);
   $('formMode').value = 'edit';
   if ($v('mode') == 'html') {
-    if (prefix == 'pf06')
+    if (prefix == 'pf051')
+      pfShowOwn('edit', id);
+    if (prefix == 'pf052')
       pfShowFavorite('edit', id);
-    if (prefix == 'pf07')
+    if (prefix == 'pf053')
       pfShowMade('edit', id);
-    if (prefix == 'pf08')
+    if (prefix == 'pf054')
       pfShowOffer('edit', id);
-    if (prefix == 'pf09')
+    if (prefix == 'pf055')
       pfShowSeek('edit', id);
+    if (prefix == 'pf056')
+      pfShowLike('edit', id);
+    if (prefix == 'pf057')
+      pfShowKnow('edit', id);
+    if (prefix == 'pf26')
+      pfShowCertificate('edit', id);
     return false;
   }
   $('page_form').submit();
 }
 
-function pfShowMode(prefix, mode, id) {
+function pfShowMode(prefix, mode, id)
+{
   if (mode) {
     OAT.Dom.hide(prefix+'_list');
+    if (mode == 'import') {
+      OAT.Dom.show(prefix+'_import');
+    } else {
     OAT.Dom.show(prefix+'_form');
+    }
     hiddenCreate(prefix+'_id', $('page_form'), id);
     $('formMode').value = mode;
   }
 }
 
-function pfShowFavorite(mode, id) {
-  pfShowMode('pf06', mode, id)
+function pfShowOwn(mode, id)
+{
+  pfShowMode('pf051', mode, id);
+  var x = function (obj) {
+    $('ow_tbody').innerHTML = '';
+    RDF.tablePrefix = 'ow';
+    RDF.tableOptions = {itemType: {fld_1: {cssText: "display: none;"}, btn_1: {cssText: "display: none;"}}};
+    RDF.itemTypes = obj.properties;
+    RDF.showItemTypes();
+  }
+  pfShowItem('user.owns.get', 'pf051', ['flag', 'name', 'comment'], x);
+}
+
+function pfShowFavorite(mode, id)
+{
+  pfShowMode('pf052', mode, id);
   var x = function (obj) {
     $('r_tbody').innerHTML = '<tr id="r_item_0_tr_0_properties"><td></td><td></td><td valign="top"></td></tr>';
     RDF.tablePrefix = 'r';
@@ -1170,23 +1483,23 @@ function pfShowFavorite(mode, id) {
       function(){
         RDF.loadClassProperties(
           RDF.getOntologyClass('sioc:Item'),
-          function(){
-            RDF.showPropertiesTable(RDF.itemTypes[0].items[0]);
-          }
+          function(){RDF.showPropertiesTable(RDF.itemTypes[0].items[0]);}
         );
       }
     )
   }
-  pfShowItem('user.favorites.get', 'pf06', ['label', 'uri'], x);
+  pfShowItem('user.favorites.get', 'pf052', ['flag', 'label', 'uri'], x);
 }
 
-function pfShowMade(mode, id) {
-  pfShowMode('pf07', mode, id)
-  pfShowItem('user.mades.get', 'pf07', ['property', 'uri', 'description']);
+function pfShowMade(mode, id)
+{
+  pfShowMode('pf053', mode, id);
+  pfShowItem('user.mades.get', 'pf053', ['property', 'uri', 'description']);
 }
 
-function pfShowOffer(mode, id) {
-  pfShowMode('pf08', mode, id)
+function pfShowOffer(mode, id)
+{
+  pfShowMode('pf054', mode, id);
   var x = function (obj) {
     $('ol_tbody').innerHTML = '';
     RDF.tablePrefix = 'ol';
@@ -1194,11 +1507,12 @@ function pfShowOffer(mode, id) {
     RDF.itemTypes = obj.properties;
     RDF.showItemTypes();
   }
-  pfShowItem('user.offers.get', 'pf08', ['name', 'comment'], x);
+  pfShowItem('user.offers.get', 'pf054', ['flag', 'name', 'comment'], x);
 }
 
-function pfShowSeek(mode, id) {
-  pfShowMode('pf09', mode, id)
+function pfShowSeek(mode, id)
+{
+  pfShowMode('pf055', mode, id);
   var x = function(obj) {
     $('wl_tbody').innerHTML = '';
     RDF.tablePrefix = 'wl';
@@ -1206,23 +1520,71 @@ function pfShowSeek(mode, id) {
     RDF.itemTypes = obj.properties;
     RDF.showItemTypes();
   }
-  pfShowItem('user.seeks.get', 'pf09', ['name', 'comment'], x);
+  pfShowItem('user.seeks.get', 'pf055', ['flag', 'name', 'comment'], x);
+}
+
+function pfShowLike(mode, id)
+{
+  pfShowMode('pf056', mode, id);
+  var x = function(obj) {
+    $('ld_tbody').innerHTML = '';
+    RDF.tablePrefix = 'ld';
+    RDF.tableOptions = {itemType: {fld_1: {cssText: "display: none;"}, btn_1: {cssText: "display: none;"}}};
+    RDF.itemTypes = obj.properties;
+    RDF.showItemTypes();
+  }
+  pfShowItem('user.likes.get', 'pf056', ['flag', 'type', 'uri', 'name'], x);
+}
+
+function pfShowKnow(mode, id) {
+  pfShowMode('pf057', mode, id);
+  pfShowItem('user.knows.get', 'pf057', ['flag', 'uri', 'label']);
+}
+
+function pfShowCertificate(mode, id) {
+  pfShowMode('pf26', mode, id);
+  if (mode == 'new') {
+    OAT.Dom.hide("pf26_form_0");
+    OAT.Dom.hide("pf26_form_1");
+    OAT.Dom.hide("pf26_form_2");
+  } else {
+    OAT.Dom.show("pf26_form_0");
+    OAT.Dom.show("pf26_form_1");
+    OAT.Dom.show("pf26_form_2");
+  }
+  pfShowItem('user.certificates.get', 'pf26', ['subject', 'agentID', 'fingerPrint', 'certificate', 'enableLogin']);
+}
+
+function pfShowOwns() {
+  pfShowList('user.owns.list', 'pf051', 'No Items', [1, 2], 0, function (data){pfShowOwns();});
 }
 
 function pfShowFavorites() {
-  pfShowList('user.favorites.list', 'pf06', 'No Items', [3, 4], 0, function (data){pfShowFavorites();});
+  pfShowList('user.favorites.list', 'pf052', 'No Items', [3, 4], 0, function (data){pfShowFavorites();});
 }
 
 function pfShowMades() {
-  pfShowList('user.mades.list', 'pf07', 'No Items', [1, 3], 0, function (data){pfShowMades();});
+  pfShowList('user.mades.list', 'pf053', 'No Items', [1, 3], 0, function (data){pfShowMades();});
 }
 
 function pfShowOffers() {
-  pfShowList('user.offers.list', 'pf08', 'No Items', [1, 2], 0, function (data){pfShowOffers();});
+  pfShowList('user.offers.list', 'pf054', 'No Items', [1, 2], 0, function (data){pfShowOffers();});
 }
 
 function pfShowSeeks() {
-  pfShowList('user.seeks.list', 'pf09', 'No Items', [1, 2], 0, function (data){pfShowSeeks();});
+  pfShowList('user.seeks.list', 'pf055', 'No Items', [1, 2], 0, function (data){pfShowSeeks();});
+}
+
+function pfShowLikes() {
+  pfShowList('user.likes.list', 'pf056', 'No Items', [2, 1, 3], 0, function (data){pfShowLikes();});
+}
+
+function pfShowKnows() {
+  pfShowList('user.knows.list', 'pf057', 'No Items', [2, 1], 0, function (data){pfShowKnows();});
+}
+
+function pfShowCertificates() {
+  pfShowList('user.certificates.list', 'pf26', 'No Items', [1, 2, 3, 4], 0, function (data){pfShowCertificates();});
 }
 
 function isShow(element) {
@@ -1242,10 +1604,7 @@ function loadFacebookData(cb) {
 		if (facebookData && regData.facebookEnable) {
 			OAT.Dom.show("lf_tab_2");
 			OAT.Dom.show("rf_tab_2");
-			OAT.Dom.show("pf_facebook");
-			OAT.Dom.show("pf_facebook1");
-			OAT.Dom.show("pf_facebook2");
-			OAT.Dom.show("pf_facebook3");
+      OAT.Dom.show("pf_tab_2_3");
 		}
 		if (cb) {cb()};
 	}
@@ -1257,13 +1616,21 @@ function showFacebookData(skip) {
 	var rfLabel = $('rf_facebookData');
 	var pfLabel = $('pf_facebookData');
 	if (lfLabel || rfLabel || pfLabel) {
-  	if (lfLabel) {lfLabel.innerHTML = '';}
-  	if (rfLabel) {rfLabel.innerHTML = '';}
-  	if (pfLabel) {pfLabel.innerHTML = '';}
+    if (lfLabel)
+      lfLabel.innerHTML = '';
+    if (rfLabel)
+      rfLabel.innerHTML = '';
+    if (pfLabel)
+      pfLabel.innerHTML = '';
   	if (facebookData && facebookData.name) {
-  		if (lfLabel) {lfLabel.innerHTML = 'Connect as <b><i>' + facebookData.name + '</i></b></b>'};
-  		if (rfLabel) {rfLabel.innerHTML = 'Connect as <b><i>' + facebookData.name + '</i></b></b>'};
-  		if (pfLabel) {pfLabel.innerHTML = 'Connect as <b><i>' + facebookData.name + '</i></b></b>'};
+      if (lfLabel)
+        lfLabel.innerHTML = 'Connected as <b><i>' + facebookData.name + '</i></b></b>';
+      if (rfLabel)
+        rfLabel.innerHTML = 'Connected as <b><i>' + facebookData.name + '</i></b></b>';
+      if (pfLabel) {
+        pfLabel.innerHTML = 'Connected as <b><i>' + facebookData.name + '</i></b></b>'
+        hiddenCreate('pf_securityFacebookID', null, facebookData.uid);
+      }
   	}
   	else if (!skip) {
   		self.loadFacebookData(function() {self.showFacebookData(true);});
@@ -1278,6 +1645,9 @@ function hideFacebookData() {
 	var label = $('rf_facebookData');
 	if (label)
   	label.innerHTML = '';
+  var label = $('pf_facebookData');
+  if (label)
+    label.innerHTML = '';
 	if (facebookData) {
 	var o = {}
 	o.api_key = facebookData.api_key;
@@ -1286,22 +1656,6 @@ function hideFacebookData() {
 }
 }
 
-function hiddenCreate(objName, objForm, objValue) {
-	var obj = $(objName);
-	if (!obj) {
-		obj = OAT.Dom.create("input");
-		obj.setAttribute("type", "hidden");
-		obj.setAttribute("name", objName);
-		obj.setAttribute("id", objName);
-		if (!objForm)
-			objForm = document.forms[0];
-		objForm.appendChild(obj);
-	}
-	if (objValue)
-		obj.setAttribute("value", objValue);
-	return obj;
-}
-
 function tagValue(xml, tName) {
   var str;
   try {
@@ -1317,9 +1671,7 @@ function tagValue(xml, tName) {
   return str;
 }
 
-function fieldUpdate(xml, tName, fName, acl, aclName) {
-  var obj = $(fName);
-  var str = tagValue(xml, tName);
+function fieldValue(obj, str) {
 	if (obj.type == 'select-one') {
     var o = obj.options;
 		for ( var i = 0; i < o.length; i++) {
@@ -1338,6 +1690,12 @@ function fieldUpdate(xml, tName, fName, acl, aclName) {
     obj.value = str;
 		obj.defaultValue = str;
   }
+}
+
+function fieldUpdate(xml, tName, fName, acl, aclName) {
+  var obj = $(fName);
+  var str = tagValue(xml, tName);
+  fieldValue(obj, str);
 	if (!aclName)
 	  aclName = 'pf_acl_' + tName;
   fieldACLUpdate(acl, aclName, tName);
@@ -1354,7 +1712,7 @@ function fieldACLUpdate(acl, aclName, tName) {
   		var o = obj.options;
   		if (o.length == 0) {
 			 o[0] = new Option('public', '1');
-			 o[1] = new Option('friends', '2');
+       o[1] = new Option('acl', '2');
 			 o[2] = new Option('private', '3');
   		}
   		for ( var i = 0; i < o.length; i++) {
@@ -1446,19 +1804,18 @@ function afterAuthenticate(xml) {
   return false;
 }
 
-function selectProfile() {
+function selectProfile(userName) {
   // UI Profile
   var S = '/ods/api/user.info?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm'));
-  OAT.AJAX.GET(S, '', selectProfileCallbackNew);
+  if (userName)
+    S += '&name=' + encodeURIComponent(userName);
 
-  // Old UI Profile
-  // var S = '/ods/api/user.info?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm')) + '&short=1';
-  // OAT.AJAX.GET(S, '', selectProfileCallback);
+  OAT.AJAX.GET(S, '', selectProfileCallbackNew);
 }
 
 function selectProfileCallbackNew(data) {
   var xml = OAT.Xml.createXmlDoc(data);
-	if (!hasError(xml)) {
+  if (!hasError(xml, false)) {
   	/* user data */
    	var user = xml.getElementsByTagName('user')[0];
 		if (user) {
@@ -1473,6 +1830,8 @@ function selectProfileCallbackNew(data) {
       var S = '/ods/api/user.info.webID?webID=' + encodeURIComponent(tagValue(user, 'iri'));
       OAT.AJAX.GET(S, '', x);
     }
+  } else {
+    logoutSubmit();
   }
 }
 
@@ -1482,7 +1841,14 @@ function showProfileNew(xmlDoc) {
     var x = function(data) {
       var xslDoc = OAT.Xml.createXmlDoc(data);
       var result = OAT.Xml.transformXSLT(xmlDoc, xslDoc);
-      div.innerHTML = result.documentElement.innerHTML;
+      if (result) {
+        showTitle('profile');
+        OAT.Dom.hide("lf");
+        OAT.Dom.hide("rf");
+        OAT.Dom.show("uf");
+        OAT.Dom.hide("pf");
+        div.innerHTML = OAT.Xml.serializeXmlDoc(result);
+    }
     }
     OAT.AJAX.GET('users.xsl', false, x);
   }
@@ -1733,15 +2099,18 @@ function loginSubmit(mode, prefix) {
 
 		q += '&facebookUID=' + facebookData.uid;
 	} else if (mode == 3) {
+  } else if (mode == 4) {
+    twitterAuthenticate('lf');
+    return false;
+  } else if (mode == 5) {
+    linkedinAuthenticate('lf');
+    return false;
   } else {
 		if (($(prefix+'_uid').value.length == 0) || ($(prefix+'_password').value.length == 0))
-			return showError('Invalid Member ID or Password');
+      return showError('Invalid User ID or Password');
 
-		q += 'user_name='
-				+ encodeURIComponent($v(prefix+'_uid'))
-				+ '&password_hash='
-				+ encodeURIComponent(OAT.Crypto.sha($v(prefix+'_uid')
-						+ $v(prefix+'_password')));
+    q +='user_name=' + encodeURIComponent($v(prefix+'_uid'))
+      + '&password_hash=' + encodeURIComponent(OAT.Crypto.sha($v(prefix+'_uid') + $v(prefix+'_password')));
     }
 	OAT.AJAX.POST("/ods/api/user.authenticate", q, afterLogin);
 	return false;
@@ -1753,6 +2122,7 @@ function afterLogin(data, prefix) {
 		/* user data */
 		$('sid').value = OAT.Xml.textValue(xml.getElementsByTagName('sid')[0]);
 		$('realm').value = 'wa';
+    validateSession = true;
 		var T = $('form');
 		if (T) {
 			T.value = ((prefix == 'rf')? 'profile': 'user');
@@ -1788,7 +2158,7 @@ function userSubmit() {
 function profileSubmit() {
   $('form').value='profile';
   $('formTab').value=0;
-  $('formSubtab').value=0;
+  $('formTab2').value=0;
   $('page_form').submit();
 
   return false;
@@ -1820,7 +2190,8 @@ function ufProfileSubmit() {
   showTitle('user');
 
 	$('formTab').value = '0';
-	$('formSubtab').value = '0';
+  $('formTab2').value = '0';
+  $('formTab3').value = '0';
   updateList('pf_homecountry', 'Country');
   updateList('pf_businesscountry', 'Country');
   updateList('pf_businessIndustry', 'Industry');
@@ -1829,26 +2200,35 @@ function ufProfileSubmit() {
 
 function ufProfileLoad(No) {
     var formTab = parseInt($v('formTab'));
-    var formSubtab = parseInt($v('formSubtab'));
+  var formTab2 = parseInt($v('formTab2'));
+  var formTab3 = parseInt($v('formTab3'));
   if (No == 1) {
-    formSubtab++;
+    formTab2++;
     if (
-        ((formTab == 1) && (formSubtab > 3)) ||
-        (formTab > 1)
+        ((formTab == 1) && (formTab2 > 3)) ||
+        ((formTab == 2) && (formTab2 > 5))
        )
     {
       formTab++;
-      formSubtab = 0;
+      formTab2 = 0;
       pfTabInit('pf_tab_', formTab);
     }
+    if ($('pf_tab_'+formTab+'_'+formTab2).style.display == 'none')
+      formTab2++;
     $('formTab').value = "" + formTab;
-    $('formSubtab').value = "" + formSubtab;
+    $('formTab2').value = "" + formTab2;
+    $('formTab3').value = "" + formTab3;
   }
-  if ((formTab == 0) && (formSubtab > 5)) {
+  if ((formTab == 0) && (formTab2 > 4)) {
     OAT.Dom.hide('pf_footer_0');
   } else {
     OAT.Dom.show('pf_footer_0');
   }
+  if ((formTab == 2) && (formTab2 > 4)) {
+    OAT.Dom.hide('pf_footer_2');
+  } else {
+    OAT.Dom.show('pf_footer_2');
+  }
   pfCleanFOAFData();
   ufCleanTablesData("x1");
   ufCleanTablesData("x2");
@@ -1896,7 +2276,7 @@ function ufProfileCallback(data) {
 			fieldUpdate(user, 'gender', 'pf_gender', aclData);
 			fieldUpdate(user, 'birthday', 'pf_birthday', aclData);
 			fieldUpdate(user, 'homepage', 'pf_homepage', aclData);
-      pfShowRows("x1", tagValue(user, "webIDs"), ["\n"], function(prefix, val1){TBL.createRow(prefix, null, {fld_1: {value: val1, className: '_validate_ _url_ _canEmpty_'}});}, aclData, 'pf_acl_webIDs');
+      pfShowRows("x1", tagValue(user, "webIDs"), ["\n"], function(prefix, val1){TBL.createRow(prefix, null, {fld_1: {value: val1, className: '_validate_ _webid_ _canEmpty_'}});}, aclData, 'pf_acl_webIDs');
 			fieldUpdate(user, 'mailSignature', 'pf_mailSignature');
 			fieldUpdate(user, 'summary', 'pf_summary', aclData);
 			fieldUpdate(user, 'photo', 'pf_photo', aclData);
@@ -1904,6 +2284,9 @@ function ufProfileCallback(data) {
 			fieldUpdate(user, 'audio', 'pf_audio', aclData);
 			fieldUpdate(user, 'audioContent', 'pf_audioContent');
 			fieldUpdate(user, 'appSetting', 'pf_appSetting');
+      fieldUpdate(user, 'spbEnable', 'pf_spbEnable');
+      fieldUpdate(user, 'inSearch', 'pf_inSearch');
+      fieldUpdate(user, 'showActive', 'pf_showActive');
       pfShowRows("x2", tagValue(user, "interests"), ["\n", ";"], function(prefix, val1, val2){TBL.createRow(prefix, null, {fld_1: {value: val1, className: '_validate_ _url_ _canEmpty_'}, fld_2: {value: val2}});}, aclData, 'pf_acl_interests');
       pfShowRows("x3", tagValue(user, "topicInterests"), ["\n", ";"], function(prefix, val1, val2){TBL.createRow(prefix, null, {fld_1: {value: val1, className: '_validate_ _url_ _canEmpty_'}, fld_2: {value: val2}});}, aclData, 'pf_acl_topicInterests');
 
@@ -1924,27 +2307,42 @@ function ufProfileCallback(data) {
       fieldUpdate(user, 'homeMobile',             'pf_homeMobile');
 
 			// online accounts
-      pfShowOnlineAccounts("x4", "P", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1, className: '_validate_ _url_ _canEmpty_'}, fld_2: {value: val2}});});
+      pfShowOnlineAccounts("x4", "P", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1}, fld_2: {value: val2, className: '_validate_ _uri_ _canEmpty_'}});});
 
       // bio events
       pfShowBioEvents("x5", function(prefix, val0, val1, val2, val3){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 11, value: val1}, fld_2: {value: val2}, fld_3: {value: val3}});});
 
-      // made
-      if (($v('formTab') == "0") && ($v('formSubtab') == "6"))
+      // owns
+      if (($v('formTab') == "0") && ($v('formTab2') == "5") && ($v('formTab3') == "1"))
+        pfShowOwns();
+
+      // favorites
+      if (($v('formTab') == "0") && ($v('formTab2') == "5") && ($v('formTab3') == "2"))
         pfShowFavorites();
 
       // made
-      if (($v('formTab') == "0") && ($v('formSubtab') == "7"))
+      if (($v('formTab') == "0") && ($v('formTab2') == "5") && ($v('formTab3') == "3"))
         pfShowMades();
 
       // offer
-      if (($v('formTab') == "0") && ($v('formSubtab') == "8"))
+      if (($v('formTab') == "0") && ($v('formTab2') == "5") && ($v('formTab3') == "4"))
         pfShowOffers();
 
       // seek
-      if (($v('formTab') == "0") && ($v('formSubtab') == "9"))
+      if (($v('formTab') == "0") && ($v('formTab2') == "5") && ($v('formTab3') == "5"))
         pfShowSeeks();
 
+      // likes
+      if (($v('formTab') == "0") && ($v('formTab2') == "5") && ($v('formTab3') == "6"))
+        pfShowLikes();
+
+      if (($v('formTab') == "0") && ($v('formTab2') == "5") && ($v('formTab3') == "7"))
+        pfShowKnows();
+
+      // seek
+      if (($v('formTab') == "2") && ($v('formTab2') == "6"))
+        pfShowCertificates();
+
 			// contact
 			fieldUpdate(user, 'icq', 'pf_icq', aclData);
 			fieldUpdate(user, 'skype', 'pf_skype', aclData);
@@ -1985,7 +2383,7 @@ function ufProfileCallback(data) {
       fieldUpdate(user, 'businessMobile',         'pf_businessMobile');
 
 			// online accounts
-      pfShowOnlineAccounts("y1", "B", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1, className: '_validate_ _url_ _canEmpty_'}, fld_2: {value: val2}});});
+      pfShowOnlineAccounts("y1", "B", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1}, fld_2: {value: val2, className: '_validate_ _uri_ _canEmpty_'}});});
 
 			// contact
 			fieldUpdate(user, 'businessIcq', 'pf_businessIcq', aclData);
@@ -1996,8 +2394,20 @@ function ufProfileCallback(data) {
       pfShowRows("y2", tagValue(user, "businessMessaging"), ["\n", ";"], function(prefix, val1, val2){TBL.createRow(prefix, null, {fld_1: {value: val1}, fld_2: {value: val2, cssText: 'width: 220px;'}});});
 
       // security
+      if (tagValue(user, 'noPassword') == '1') {
+        OAT.Dom.hide('tr_oldPassword');
+      } else {
+        OAT.Dom.show('tr_oldPassword');
+      }
 			fieldUpdate(user, 'securityOpenID', 'pf_securityOpenID');
 
+      var S = tagValue(user, 'securityFacebookID');
+      if (S) {
+        $('span_facebookName').innerHTML = tagValue(user, 'securityFacebookName');
+      } else {
+        $('span_facebookName').innerHTML = 'not yet';
+      }
+
 			fieldUpdate(user, 'securitySecretQuestion', 'pf_securitySecretQuestion');
       fieldUpdate(user, 'securitySecretAnswer',   'pf_securitySecretAnswer');
 
@@ -2027,11 +2437,11 @@ function ufProfileCallback(data) {
 	    }
 	    S = tagValue(user, 'certificate');
 	    if (S) {
-	      OAT.Dom.hide('iframe_certificate');
-	      $('iframe_certificate').src = '';
+        OAT.Dom.hide('cert');
+        $('cert').src = '';
 	    } else {
-	      OAT.Dom.show('iframe_certificate');
-	      $('iframe_certificate').src = '/ods/cert.vsp?sid=' + encodeURIComponent($v('sid'));
+        OAT.Dom.show('cert');
+        $('cert').src = '/ods/cert.vsp?sid=' + encodeURIComponent($v('sid'));
 	    }
       showTitle('profile');
 
@@ -2039,8 +2449,10 @@ function ufProfileCallback(data) {
       OAT.Dom.hide("uf");
       OAT.Dom.show("pf");
 			pfTabInit('pf_tab_', $v('formTab'));
-      pfTabInit('pf_tab_0_', $v('formSubtab'));
-      pfTabInit('pf_tab_1_', $v('formSubtab'));
+      pfTabInit('pf_tab_0_', $v('formTab2'));
+      pfTabInit('pf_tab_1_', $v('formTab2'));
+      pfTabInit('pf_tab_2_', $v('formTab2'));
+      pfTabInit('pf_tab_0_5_', $v('formTab3'));
     }
   }
 }
@@ -2189,45 +2601,49 @@ function preparePropertiesWork(prefix, ontologyNo, itemNo) {
         var propertyName = ctrl.value;
     var propertyType = $v(prefix+"_item_"+ontologyNo+"_prop_"+itemNo+"_fld_2_"+propertyNo);
     var propertyValue = $v(prefix+"_item_"+ontologyNo+"_prop_"+itemNo+"_fld_3_"+propertyNo);
+    var propertyLanguage = $v(prefix+"_item_"+ontologyNo+"_prop_"+itemNo+"_fld_4_"+propertyNo);
         if (propertyType == 'object') {
           var item = RDF.getItemByName(propertyValue);
           if (item)
             propertyValue = item.id;
         }
-        itemProperties.push({"name": propertyName, "value": propertyValue, "type": propertyType});
+    itemProperties.push({"name": propertyName, "value": propertyValue, "type": propertyType, "language": propertyLanguage});
       }
   return itemProperties;
 }
 
 function pfUpdateSubmit(No) {
-	$('pf_oldPassword').value = '';
-	$('pf_newPassword').value = '';
-	$('pf_newPassword2').value = '';
+  if (!myValidateInputs($('formTab')))
+    return false;
 
   var formTab = parseInt($v('formTab'));
-  var formSubtab = parseInt($v('formSubtab'));
-  if ((formTab == 0) && (formSubtab == 3))
+  var formTab2 = parseInt($v('formTab2'));
+  if ((formTab == 0) && (formTab2 == 3))
   {
     updateOnlineAccounts('x4', 'P');
     ufProfileLoad(No);
   }
-  else if ((formTab == 0) && (formSubtab == 5))
+  else if ((formTab == 0) && (formTab2 == 5))
   {
     updateBioEvents('x5');
     ufProfileLoad(No);
   }
-  else if ((formTab == 1) && (formSubtab == 2))
+  else if ((formTab == 1) && (formTab2 == 2))
   {
     updateOnlineAccounts('y1', 'B');
     ufProfileLoad(No);
   }
+  else if ((formTab == 2) && (formTab2 == 0))
+  {
+    pfChangeSubmit();
+  }
   else
   {
     var A = '';
   	var S = '/ods/api/user.update.fields?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm'))
     if (formTab == 0)
     {
-      if (formSubtab == 0)
+      if (formTab2 == 0)
       {
         // Import
         if ($v('cb_item_i_name') == '1')
@@ -2281,7 +2697,7 @@ function pfUpdateSubmit(No) {
         if ($v('cb_item_i_onlineAccounts') == '1')
           S += '&onlineAccounts=' + encodeURIComponent($v('i_onlineAccounts'));
       }
-      if (formSubtab == 1)
+      else if (formTab2 == 1)
       {
         S +='&nickName=' + encodeURIComponent($v('pf_nickName'))
         + '&mail=' + encodeURIComponent($v('pf_mail'))
@@ -2295,6 +2711,9 @@ function pfUpdateSubmit(No) {
         + '&mailSignature=' + encodeURIComponent($v('pf_mailSignature'))
           + '&summary=' + encodeURIComponent($v('pf_summary'))
         + '&appSetting=' + encodeURIComponent($v('pf_appSetting'))
+          + '&spbEnable=' + encodeURIComponent($('pf_spbEnable').checked? '1': '0')
+          + '&inSearch=' + encodeURIComponent($('pf_inSearch').checked? '1': '0')
+          + '&showActive=' + encodeURIComponent($('pf_showActive').checked? '1': '0')
         + '&webIDs=' + encodeTableData("x1", ["\n"])
         + '&interests=' + encodeTableData("x2", ["\n", ";"])
         + '&topicInterests=' + encodeTableData("x3", ["\n", ";"]);
@@ -2313,7 +2732,7 @@ function pfUpdateSubmit(No) {
           + '&audio=' + $v('pf_acl_audio')
           + '&photo=' + $v('pf_acl_photo');
       }
-      if (formSubtab == 2)
+      else if (formTab2 == 2)
       {
         S +='&defaultMapLocation=' + encodeURIComponent($v('pf_homeDefaultMapLocation'))
 			+ '&homeCountry=' + encodeURIComponent($v('pf_homecountry'))
@@ -2337,7 +2756,7 @@ function pfUpdateSubmit(No) {
   			  + '&homeLatitude=' + $v('pf_acl_homeLatitude')
   			  + '&homePhone=' + $v('pf_acl_homePhone');
   	  }
-      if (formSubtab == 4)
+      else if (formTab2 == 4)
       {
         S +='&icq=' + encodeURIComponent($v('pf_icq'))
         + '&skype=' + encodeURIComponent($v('pf_skype'))
@@ -2354,7 +2773,7 @@ function pfUpdateSubmit(No) {
     }
     else if (formTab == 1)
     {
-      if (formSubtab == 0)
+      if (formTab2 == 0)
       {
         S +='&businessIndustry=' + encodeURIComponent($v('pf_businessIndustry'))
   			+ '&businessOrganization=' + encodeURIComponent($v('pf_businessOrganization'))
@@ -2380,7 +2799,7 @@ function pfUpdateSubmit(No) {
           + '&businessNetwork=' + $v('pf_acl_businessNetwork')
           + '&businessResume=' + $v('pf_acl_businessResume');
   	  }
-      if (formSubtab == 1)
+      else if (formTab2 == 1)
       {
         S +='&businessCountry=' + encodeURIComponent($v('pf_businesscountry'))
         + '&businessState=' + encodeURIComponent($v('pf_businessstate'))
@@ -2403,7 +2822,7 @@ function pfUpdateSubmit(No) {
   			  + '&businessLatitude=' + $v('pf_acl_businesslat')
   			  + '&businessPhone=' + $v('pf_acl_businessPhone')
   	  }
-      if (formSubtab == 3)
+      else if (formTab2 == 3)
       {
         S +='&businessIcq=' + encodeURIComponent($v('pf_businessIcq'))
         + '&businessSkype=' + encodeURIComponent($v('pf_businessSkype'))
@@ -2420,42 +2839,38 @@ function pfUpdateSubmit(No) {
   	}
     else if (formTab == 2)
     {
-      if (No == 31)
+      if (formTab2 == 1)
       {
-        S += '&securityOpenID=' + encodeURIComponent($v('pf_securityOpenID'));
+        S += '&securitySecretQuestion=' + encodeURIComponent($v('pf_securitySecretQuestion')) +
+             '&securitySecretAnswer=' + encodeURIComponent($v('pf_securitySecretAnswer'));
     	}
-      else if (No == 32)
+      else if (formTab2 == 2)
       {
-        S += '&securityFacebookID=' + encodeURIComponent(facebookData.uid);
+        S += '&securityOpenID=' + encodeURIComponent($v('pf_securityOpenID'));
     	}
-      else if (No == 33)
+      else if (formTab2 == 3)
       {
-        S += '&securityFacebookID=';
+        if (No == 2)
+        {
+          S += '&securityFacebookID=';
+        } else {
+        S += '&securityFacebookID=' + encodeURIComponent(facebookData.uid);
     	}
-      else if (No == 34)
+      }
+      else if (formTab2 == 4)
       {
         S += '&securitySiocLimit=' + encodeURIComponent($v('pf_securitySiocLimit'));
     	}
-      else if (No == 35)
-      {
-        S += '&securitySecretQuestion=' + encodeURIComponent($v('pf_securitySecretQuestion')) +
-             '&securitySecretAnswer=' + encodeURIComponent($v('pf_securitySecretAnswer'));
-    	}
-      else if (No == 36)
-      {
-        S += '&certificate=' + encodeURIComponent($v('pf_certificate')) +
-    		     '&certificateLogin=' + encodeURIComponent($v('pf_certificateLogin'));
-    	}
-      else if (No == 37)
-      {
-        S += '&certificate=&certificateLogin=0';
-    	}
   	}
   	if (A != '')
   	  OAT.AJAX.GET('/ods/api/user.acl.update?sid=' + encodeURIComponent($v('sid')) + '&realm=' + encodeURIComponent($v('realm')) + '&acls=' + encodeURIComponent(A), false, null, {async: false});
 
-  	OAT.AJAX.GET(S, '', function(data){ if((formTab == 0) && (formSubtab == 1)) {$('page_form').submit();}; pfUpdateCallback(data, No);});
+    OAT.AJAX.GET(S, '', function(data){ if((formTab == 0) && (formTab2 == 1)) {$('page_form').submit();}; pfUpdateCallback(data, No);});
   }
+  $('pf_oldPassword').value = '';
+  $('pf_newPassword').value = '';
+  $('pf_newPassword2').value = '';
+
   return false;
 }
 
@@ -2510,7 +2925,7 @@ function pfCleanFOAFData() {
 }
 
 function pfGetFOAFData(iri) {
-	var S = '/ods/api/user.getFOAFData?foafIRI=' + encodeURIComponent(iri);
+  var S = '/ods/api/user.getFOAFData?spongerMode=1&foafIRI=' + encodeURIComponent(iri);
 	var x = function(data) {
 		var o = null;
 		try {
@@ -2544,10 +2959,11 @@ function pfGetFOAFData(iri) {
 			pfSetFOAFValue(tbody, o.organizationHomepage, 'Organization Homepage', 'i_businessHomePage');
 			pfSetFOAFValue(tbody, o.resume,               'Resume',                       'i_summary');
 			pfSetFOAFValue(tbody, o.tags,                 'Tags',                  'i_tags');
-			pfSetFOAFValue(tbody, o.sameAs,               'Other Personal URIs (WebIDs)', 'i_sameAs', ['URI'], ['\n']);
-			pfSetFOAFValue(tbody, o.interest,             'Topic of Interest',     'i_interests', ['URL', 'Label'], ['\n', ';']);
-			pfSetFOAFValue(tbody, o.topic_interest,       'Thing of Interest',     'i_topicInterests', ['URI', 'Label'], ['\n', ';']);
-			pfSetFOAFValue(tbody, o.onlineAccounts,       'Online Accounts',              'i_onlineAccounts', ['Label', 'URI'], ['\n', ';']);
+      pfSetFOAFValue(tbody, o.sameAs,               'Other Personal URIs (WebIDs)', 'i_sameAs', ['URI'], ['value']);
+      pfSetFOAFValue(tbody, o.interest,             'Topic of Interest',            'i_interests', ['URL', 'Label'], ['value', 'label']);
+      pfSetFOAFValue(tbody, o.topic_interest,       'Thing of Interest',            'i_topicInterests', ['URI', 'Label'], ['value', 'label']);
+      pfSetFOAFValue(tbody, o.onlineAccounts,       'Online Accounts',              'i_onlineAccounts', ['Label', 'URI'], ['value', 'uri']);
+      pfSetFOAFValue(tbody, o.knows,                'Social Network',               'i_knows', ['URI', 'Name'], ['value', 'name']);
 		} else {
 			alert('No data founded for \'' + iri + '\'');
 		}
@@ -2564,7 +2980,7 @@ function pfGetFOAFData(iri) {
 	});
 }
 
-function pfSetFOAFValue(tbody, fValue, fTitle, fName, fHeaders, fDelimiters) {
+function pfSetFOAFValue(tbody, fValue, fTitle, fName, fHeaders, fLabels) {
   if (fValue) {
     var tr = OAT.Dom.create('tr');
     tbody.appendChild(tr);
@@ -2601,24 +3017,23 @@ function pfSetFOAFValue(tbody, fValue, fTitle, fName, fHeaders, fDelimiters) {
         thx.appendChild(OAT.Dom.text(fHeaders[N]));
         trx.appendChild(thx);
       }
-    	var lines = fValue.split(fDelimiters[0]);
-    	for ( var N = 0; N < lines.length; N++) {
-    	  if (lines[N] != '') {
-    	    var V;
-      		if (fDelimiters.length == 1) {
-      			V = [lines[N]];
-      		} else {
-      			V = lines[N].split(fDelimiters[1]);
-      		}
+      tmp = '';
+      for ( var N = 0; N < fValue.length; N++) {
           var trx = OAT.Dom.create('tr');
           tbl.appendChild(trx);
-        	for ( var M = 0; M < V.length; M++) {
+        for ( var M = 0; M < fLabels.length; M++) {
             var tdx = OAT.Dom.create('td');
-            tdx.appendChild(OAT.Dom.text(V[M]));
+          var tmpValue = OAT.Dom.text(fValue[N][fLabels[M]]);
+          if (tmpValue)
+            tdx.appendChild(tmpValue);
             trx.appendChild(tdx);
+          if (tmpValue)
+            tmp += tmpValue;
+          tmp += ';';
           }
+        tmp += '\n';
       	}
-    	}
+      fValue = tmp;
     } else {
       td.appendChild(OAT.Dom.text(fValue));
     }
@@ -2739,6 +3154,24 @@ function rfSignupSubmit(event) {
 		if ($('rf_webid_email'))
 		  q +='&email=' + encodeURIComponent($v('rf_webid_email'));
 	}
+  else if (rfTab.selectedIndex == 4) {
+    if (!$('twitter-data')) {
+      twitterAuthenticate('rf');
+      return false;
+    }
+    q +='&data=' + encodeURIComponent($v('twitter-data'));
+    if ($('rf_twitter_email'))
+      q +='&email=' + encodeURIComponent($v('rf_twitter_email'));
+  }
+  else if (rfTab.selectedIndex == 5) {
+    if (!$('linkedin-data')) {
+      linkedinAuthenticate('rf');
+      return false;
+    }
+    q +='&data=' + encodeURIComponent($v('linkedin-data'));
+    if ($('rf_linkedin_email'))
+      q +='&email=' + encodeURIComponent($v('rf_linkedin_email'));
+  }
 	OAT.AJAX.POST("/ods/api/user.register", q, afterSignup);
 	return false;
 }
@@ -2758,8 +3191,8 @@ function openIdLoginURL(uriParams) {
   var openIdAssoc_handle = uriParams['openid.assoc_handle'];
   var openIdSigned       = uriParams['openid.signed'];
 
-  var url = openIdServer +
-    '?openid.mode=check_authentication' +
+  var url = openIdServer + ((openIdServer.lastIndexOf('?') != -1)? '&': '?') +
+    'openid.mode=check_authentication' +
     '&openid.assoc_handle=' + encodeURIComponent (openIdAssoc_handle) +
     '&openid.sig='          + encodeURIComponent (openIdSig) +
     '&openid.signed='       + encodeURIComponent (openIdSigned);
@@ -2788,15 +3221,19 @@ function openIdAuthenticate(prefix) {
     if (error.length)
       showError('Invalied OpenID Server');
 
-    var oidVersion = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/version', {})[0]);
     var oidServer = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/server', {})[0]);
-    var oidDelegate = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/delegate', {})[0]);
-
-    if (!(oidServer && oidServer.length > 0))
+    if (!oidServer || !oidServer.length)
       showError(' Cannot locate OpenID server');
 
-    var oidIdent = $v(prefix+'_openId');
-    if (oidDelegate && oidDelegate.length > 0)
+    var oidVersion = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/version', {})[0]);
+    var oidDelegate = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/delegate', {})[0]);
+		var oidUrl = OAT.Xml.textValue(OAT.Xml.xpath(xml, '/openIdServer_response/identity', {})[0]);
+    var oidParams = OAT.Xml.textValue (OAT.Xml.xpath (xml, '/openIdServer_response/params', {})[0]);
+    if (!oidParams || !oidParams.length)
+      oidParams = 'sreg';
+
+    var oidIdent = oidUrl;
+    if (oidDelegate && oidDelegate.length)
       oidIdent = oidDelegate;
 
     var thisPage  = document.location.protocol +
@@ -2808,8 +3245,8 @@ function openIdAuthenticate(prefix) {
 
     var trustRoot = document.location.protocol + '//' + document.location.host;
 
-    var S = oidServer +
-      '?openid.mode=checkid_setup' +
+    var S = oidServer + ((oidServer.lastIndexOf('?') != -1)? '&': '?') +
+      'openid.mode=checkid_setup' +
       '&openid.return_to=' + encodeURIComponent(thisPage);
 
     if (oidVersion == '1.0')
@@ -2818,13 +3255,15 @@ function openIdAuthenticate(prefix) {
 
     if (oidVersion == '2.0')
       S +='&openid.ns=' + encodeURIComponent('http://specs.openid.net/auth/2.0')
-        + '&openid.claimed_id=' + encodeURIComponent('http://specs.openid.net/auth/2.0/identifier_select')
-        + '&openid.identity=' + encodeURIComponent('http://specs.openid.net/auth/2.0/identifier_select')
+        + '&openid.claimed_id=' + encodeURIComponent(oidIdent)
+        + '&openid.identity=' + encodeURIComponent(oidIdent)
 
     if (prefix == 'rf') {
-      if (oidVersion == '1.0')
-      S += '&openid.sreg.optional='+encodeURIComponent('fullname,nickname,dob,gender,postcode,country,timezone') + '&openid.sreg.required=' + encodeURIComponent('email,nickname');
-      if (oidVersion == '2.0')
+      if (oidParams = 'sreg')
+        S +='&openid.sreg.optional='+encodeURIComponent('fullname,nickname,dob,gender,postcode,country,timezone')
+          + '&openid.sreg.required=' + encodeURIComponent('email,nickname');
+
+      if (oidParams = 'ax')
         S +='&openid.ns.ax=http://openid.net/srv/ax/1.0'
           + '&openid.ax.mode=fetch_request'
           + '&openid.ax.required=country,email,firstname,fname,language,lastname,timezone'
@@ -2841,9 +3280,30 @@ function openIdAuthenticate(prefix) {
   OAT.AJAX.POST ("/ods_services/Http/openIdServer", q, x);
 }
 
-function showError(msg) {
-	alert(msg);
-	return false;
+function twitterAuthenticate(prefix) {
+  var thisPage  = document.location.protocol +
+    '//' +
+    document.location.host +
+    document.location.pathname +
+    '?oid-mode=twitter&oid-form=' + prefix;
+
+  var x = function (data) {
+    document.location = data;
+  }
+  OAT.AJAX.POST ("/ods/api/twitterServer?hostUrl="+encodeURIComponent(thisPage), null, x);
+}
+
+function linkedinAuthenticate(prefix) {
+  var thisPage  = document.location.protocol +
+    '//' +
+    document.location.host +
+    document.location.pathname +
+    '?oid-mode=linkedin&oid-form=' + prefix;
+
+  var x = function (data) {
+    document.location = data;
+  }
+  OAT.AJAX.POST ("/ods/api/linkedinServer?hostUrl="+encodeURIComponent(thisPage), null, x);
 }
 
 function showTitle(txt) {
@@ -2852,8 +3312,41 @@ function showTitle(txt) {
   {
     if ((txt == 'user') || (txt == 'profile')) {
       OAT.Dom.show(T);
+      OAT.Dom.show('ob_left_01');
+      OAT.Dom.show('ob_right_logout');
+      if (validateSession) {
+        OAT.Dom.show('ob_left_02');
+        $('ob_right_logout').innerHTML = 'Logout';
+      } else {
+        OAT.Dom.hide('ob_left_02');
+        $('ob_right_logout').innerHTML = 'Login';
+      }
     } else {
       OAT.Dom.hide(T);
+      OAT.Dom.hide('ob_right_logout');
     }
   }
 }
+
+function knowsData() {
+  if (!validateField($('k_import')))
+    return;
+
+	var S = '/ods/api/user.getKnowsData?sourceURI=' + encodeURIComponent($v('k_import'));
+	var x = function(data) {
+		var o = null;
+		try {
+			o = OAT.JSON.parse(data);
+		} catch (e) {
+			o = null;
+		}
+		if (o) {
+      for ( var i = 0; i < o.length; i++) {
+        TBL.createRow('k', null, {fld_1: {mode: 4, value: '1'}, fld_2: {value: o[i].uri, readOnly: true}, fld_3: {value: o[i].label, readOnly: true}});
+      }
+		} else {
+			alert('No data founded');
+		}
+	}
+	OAT.AJAX.GET(S, '', x, {onstart : function() {OAT.Dom.show('k_import_image')}, onend : function() {OAT.Dom.hide('k_import_image')}});
+}
diff --git a/appsrc/ODS-Framework/users/users.html b/appsrc/ODS-Framework/users/users.html
index bb53364..02c6518 100644
--- a/appsrc/ODS-Framework/users/users.html
+++ b/appsrc/ODS-Framework/users/users.html
@@ -12,10 +12,11 @@
     <script type="text/javascript" src="/ods/common.js"></script>
     <script type="text/javascript" src="/ods/typeahead.js"></script>
     <script type="text/javascript" src="/ods/tbl.js"></script>
+    <script type="text/javascript" src="/ods/validate.js"></script>
     <script type="text/javascript">
       // OAT
       var toolkitPath="/ods/oat";
-      var featureList = ["ajax", "json", "tab", "combolist", "calendar", "crypto", "rdfmini", "grid", "graphsvg", "tagcloud", "map", "timeline", "anchor"];
+      var featureList = ["ajax", "json", "tab", "combolist", "calendar", "rdfmini", "grid", "graphsvg", "tagcloud", "map", "timeline", "anchor"];
     </script>
     <script type="text/javascript" src="/ods/oat/loader.js"></script>
     <script type="text/javascript">
@@ -34,8 +35,6 @@
         }
         return true;
       }
-      OAT.MSG.attach(OAT, 'PAGE_LOADED', myInit);
-      window.onload = function(){OAT.MSG.send(OAT, 'PAGE_LOADED');};
       document.onkeypress=navigate;
     </script>
   </head>
@@ -52,7 +51,7 @@
       <input type="hidden" name="formMode" id="formMode" value="" />
       <div id="ob">
         <div id="ob_left" style="display: none;">
-          <b>User</b>: <span id="ob_left_name"></span>, <b>Profile</b>: <a href="#" onclick="javascript: return ufProfileSubmit();">Edit</a> / <a href="#" onclick="javascript: return pfCancelSubmit();">View</a>
+          <span id="ob_left_01"><b>User</b>: <span id="ob_left_name"></span></span><span id="ob_left_02">, <b>Profile</b>: <a href="#" onclick="javascript: return ufProfileSubmit();">Edit</a> / <a href="#" onclick="javascript: return pfCancelSubmit();">View</a></span>
         </div>
         <div id="ob_right"><a href="#" id="ob_right_logout" onclick="javascript: return logoutSubmit();" style="display: none;">Logout</a></div>
       </div>
@@ -65,13 +64,15 @@
             <td valign="top">
               <div id="lf" class="form">
                 <div class="header">
-                  User login
+                  Please identify yourself
                 </div>
                 <ul id="lf_tabs" class="tabs">
-                  <li id="lf_tab_0" title="ODS">ODS</li>
+                  <li id="lf_tab_0" title="Digest">Digest</li>
                   <li id="lf_tab_1" title="OpenID" style="display: none;">OpenID</li>
                   <li id="lf_tab_2" title="Facebook" style="display: none;">Facebook</li>
                   <li id="lf_tab_3" title="WebID" style="display: none;">WebID</li>
+                  <li id="lf_tab_4" title="Twitter" style="display: none;">Twitter</li>
+                  <li id="lf_tab_5" title="LinkedIn" style="display: none;">LinkedIn</li>
                 </ul>
                 <div style="min-height: 120px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                   <div id="lf_content"></div>
@@ -79,10 +80,10 @@
                 <table class="form" cellspacing="5">
                   <tr>
                     <th width="30%">
-                      <label for="lf_uid">Member ID</label>
+                          <label for="lf_uid">User ID</label>
                     </th>
                     <td nowrap="nowrap">
-                      <input type="text" name="lf_uid" value="" id="lf_uid" />
+                          <input type="text" name="lf_uid" value="" id="lf_uid" style="width: 150px;" />
                     </td>
                   </tr>
                   <tr>
@@ -90,7 +91,7 @@
                       <label for="lf_password">Password</label>
                     </th>
                     <td nowrap="nowrap">
-                      <input type="password" name="lf_password" value="" id="lf_password" />
+                          <input type="password" name="lf_password" value="" id="lf_password" style="width: 150px;" />
                     </td>
                   </tr>
                     </table>
@@ -102,7 +103,7 @@
                           <label for="lf_openId">OpenID URL</label>
                     </th>
                         <td nowrap="nowrap">
-                          <input type="text" name="lf_openId" value="" id="lf_openId" class="openId" size="40"/>
+                          <input type="text" name="lf_openId" value="" id="lf_openId" style="width: 300px;" />
                         </td>
                   </tr>
                     </table>
@@ -125,6 +126,32 @@
                     <table id="lf_table_3" class="form" cellspacing="5">
                     </table>
                   </div>
+                  <div id="lf_page_4" class="tabContent" style="display: none">
+                    <table id="lf_table_4" class="form" cellspacing="5">
+                      <tr>
+                        <th width="30%">
+                        </th>
+                        <td>
+                          <span id="lf_twitter" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="lf_twitterButton" src="/ods/images/sign-in-with-twitter-d.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                  <div id="lf_page_5" class="tabContent" style="display: none;">
+                    <table id="lf_table_5" class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%">
+                        </th>
+                        <td>
+                          <span id="lf_linkedin" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="lf_linkedinButton" src="/ods/images/linkedin-large.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
                 </div>
                 <div class="footer">
                   <input type="button" name="lf_login" value="Login" id="lf_login" onclick="javascript: return lfLoginSubmit();" />
@@ -134,27 +161,29 @@
 
               <div id="rf" class="form" style="display: none">
                 <div class="header">
-                  User register
+                  User Registration
                 </div>
                 <ul id="rf_tabs" class="tabs">
-                  <li id="rf_tab_0" title="ODS">ODS</li>
+                  <li id="rf_tab_0" title="Digest">Digest</li>
                   <li id="rf_tab_1" title="OpenID" style="display: none;">OpenID</li>
                   <li id="rf_tab_2" title="Facebook" style="display: none;">Facebook</li>
                   <li id="rf_tab_3" title="WebID" style="display: none;">WebID</li>
+                  <li id="rf_tab_4" title="Twitter" style="display: none;">Twitter</li>
+                  <li id="rf_tab_5" title="LinkedIn" style="display: none;">LinkedIn</li>
                 </ul>
                 <div style="min-height: 135px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                   <div id="rf_content"></div>
                   <div id="rf_page_0" class="tabContent" >
                     <table id="rf_table_0" class="form" cellspacing="5">
-                      <tr id="rf_login_1">
+                      <tr>
                         <th>
                           <label for="rf_uid">Login Name<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td nowrap="nowrap">
-                          <input type="text" name="rf_uid" value="" id="rf_uid" />
+                          <input type="text" name="rf_uid" value="" id="rf_uid" style="width: 150px;" />
                         </td>
                       </tr>
-                      <tr id="rf_login_2">
+                      <tr>
                         <th>
                           <label for="rf_email">E-mail<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
@@ -162,20 +191,20 @@
                           <input type="text" name="rf_email" value="" id="rf_email" size="40"/>
                         </td>
                       </tr>
-                      <tr id="rf_login_3">
+                      <tr>
                         <th>
                           <label for="rf_password">Password<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td nowrap="nowrap">
-                          <input type="password" name="rf_password" value="" id="rf_password" />
+                          <input type="password" name="rf_password" value="" id="rf_password" style="width: 150px;" />
                         </td>
                       </tr>
-                      <tr id="rf_login_4">
+                      <tr>
                         <th>
                           <label for="rf_password2">Password (verify)<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td nowrap="nowrap">
-                          <input type="password" name="rf_password2" value="" id="rf_password2" />
+                          <input type="password" name="rf_password2" value="" id="rf_password2" style="width: 150px;" />
                         </td>
                       </tr>
                     </table>
@@ -210,6 +239,32 @@
                     <table id="rf_table_3" class="form" cellspacing="5">
                     </table>
                   </div>
+                  <div id="rf_page_4" class="tabContent" style="display: none">
+                    <table id="rf_table_4" class="form" cellspacing="5">
+                      <tr>
+                        <th width="30%">
+                        </th>
+                        <td>
+                          <span id="rf_twitter" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="rf_twitterButton" src="/ods/images/sign-in-with-twitter-d.png" border="0"/></a>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                  <div id="rf_page_5" class="tabContent" style="display: none;">
+                    <table id="rf_table_5" class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%">
+                        </th>
+                        <td>
+                          <span id="rf_linkedin" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="rf_linkedinButton" src="/ods/images/linkedin-large.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
                 </div>
                 <div>
                   <table class="form" cellspacing="5">
@@ -234,123 +289,6 @@
 
                 <div id="uf_div_new" style="clear: both;">
                 </div>
-                <div id="uf_div" style="clear: both; display: none;">
-              	  <div id="u_profile_l">
-              	    <div id="user_info_w" class="widget user_info_w">
-              	      <div class="w_title" id="userProfilePhotoName">
-              	        <h3></h3>
-              	      </div>
-              	      <div class="w_content">
-                        <div class="user_img_ctr">
-                          <a href="javascript:void(0)">
-                       		  <img alt="Profile image" id="userProfilePhotoImg" rel="foaf:depiction" class="prof_photo" src="/ods/images/profile.png"/>
-                          </a>
-                        </div> <!-- user_img_ctr -->
-                        <div class="gems_ctr">
-                          <div class="prof_user_gems" id="profileUserGems">
-                            <div class="gem">
-                              <a href="javascript:void(0)" id="uf_foaf_gem" target="_blank"><img src="/ods/images/icons/foaf.png" alt="FOAF"/></a>
-                            </div>
-                            <div class="gem">
-                              <a href="javascript:void(0)" id="uf_sioc_gem" target="_blank"><img src="/ods/images/icons/sioc_button.png" alt="SIOC"/></a>
-                            </div>
-                            <div class="gem">
-                              <a href="javascript:void(0)" id="uf_vcard_gem" target="_blank"><img src="/ods/images/icons/vcard.png" alt="VCARD"/></a>
-                            </div>
-                          </div> <!-- prof_user_gems -->
-                        </div> <!-- gems_ctr -->
-                      </div> <!-- w_content -->
-          	        </div> <!-- .widget -->
-
-            	      <div id="ds_w" class="widget ds_w">
-            	        <div class="w_title">
-                        <h3>Data Space</h3>
-          		          <div class="w_title_bar_btns">
-                    		  <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                    		</div> <!-- w_title_bar_btns -->
-          	          </div> <!-- w_title -->
-            	        <div class="w_content">
-                        <ul class="ds_list" id="ds_list">
-                        </ul> <!-- ds_list -->
-                        <div class="cmd_ctr"> </div>
-                      </div> <!-- w_content -->
-                    </div> <!-- .widget -->
-
-              	    <div id="connections_w" class="widget connections_w">
-              	      <div class="w_title">
-                        <h3 id="connPTitleTxt">Connections</h3>
-                        <div class="w_title_bar_btns">
-                          <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                        </div> <!-- w_title_bar_btns -->
-              	      </div> <!-- w_title -->
-            	        <div class="w_content" id="connP1" style="height: 200px;">
-                      </div> <!-- w_content -->
-            	      </div> <!-- .widget -->
-
-                    <div id="groups_w" class="widget groups_w" style="display: none;">
-            	        <div class="w_title">
-            	          <h3 id="discussionsTitleTxt">Discussion Groups ()</h3>
-            	        </div>
-            	        <div class="w_content" id="discussionsCtr">
-                      </div> <!-- w_content -->
-            	      </div> <!-- .widget -->
-          	      </div>
-
-              	  <div id="u_profile_r" style="width: 100%;">
-                    <div class="widget w_contact" about="#THIS" instanceof="foaf:Person">
-                      <div class="w_title">
-                        <h3>Contact Information</h3>
-                        <div class="w_title_bar_btns">
-                    		  <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                    		</div>
-                      </div>
-                      <div class="w_content">
-                <ul id="uf_tabs" class="tabs">
-                  <li id="uf_tab_0" title="Personal">Personal</li>
-                  <li id="uf_tab_1" title="Messaging Services">Messaging Services</li>
-                  <li id="uf_tab_2" title="Home">Home</li>
-                  <li id="uf_tab_3" title="Business">Business</li>
-                  <li id="uf_tab_4" title="Data Explorer">Data Explorer</li>
-                </ul>
-                <div style="min-height: 180px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
-                  <div id="uf_content"></div>
-                  <div id="uf_page_0" class="tabContent" >
-                    <table id="uf_table_0" class="form" cellspacing="5">
-                    </table>
-                  </div>
-                  <div id="uf_page_1" class="tabContent" >
-                    <table id="uf_table_1" class="form" cellspacing="5">
-                    </table>
-                  </div>
-                  <div id="uf_page_2" class="tabContent" >
-                    <table id="uf_table_2" class="form" cellspacing="5">
-                    </table>
-                  </div>
-                  <div id="uf_page_3" class="tabContent" >
-                    <table id="uf_table_3" class="form" cellspacing="5">
-                </table>
-                  </div>
-                  <div id="uf_page_4" class="tabContent" >
-                    <div id="uf_rdf_content">
-                       
-                    </div>
-                  </div>
-                </div>
-                      </div>
-                    </div>
-
-                    <div id="notify" class="notify_w widget">
-                      <div class="w_title">
-                        <h3>Activities</h3>
-                        <div class="w_title_bar_btns">
-                      	  <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                      	</div> <!-- w_title_bar_btns -->
-                      </div>
-                      <div class="w_content" id="notify_content">
-                      </div>
-                    </div>
-                  </div>
-                </div>
               </div>
 
               <div id="pf" class="form" style="width: 100%; display: none;">
@@ -365,18 +303,14 @@
                 <div style="min-height: 180px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                   <div id="pf_page_0" class="tabContent" style="display:none;">
                     <ul id="pf_tabs_0" class="tabs">
-                      <li id="pf_tab_0_0" title="Import">Profile Import</li>
-                      <li id="pf_tab_0_1" title="Main">Main</li>
-                      <li id="pf_tab_0_2" title="Address">Address</li>
-                      <li id="pf_tab_0_3" title="Online Accounts">Online Accounts</li>
-                      <li id="pf_tab_0_4" title="Messaging Services">Messaging Services</li>
-                      <li id="pf_tab_0_5" title="Biographical Events">Biographical Events</li>
-                      <li id="pf_tab_0_6" title="Favorite Things">Favorite Things</li>
-                      <li id="pf_tab_0_7" title="Creator Of">Creator Of</li>
-                      <li id="pf_tab_0_8" title="My Offers">My Offers</li>
-                      <li id="pf_tab_0_9" title="Offers I Seek">Offers I Seek</li>
+                      <li id="pf_tab_0_0">Profile Import</li>
+                      <li id="pf_tab_0_1">Main</li>
+                      <li id="pf_tab_0_2">Address</li>
+                      <li id="pf_tab_0_3">Online Accounts</li>
+                      <li id="pf_tab_0_4">Messaging Services</li>
+                      <li id="pf_tab_0_5">Others</li>
                     </ul>
-                    <div style="min-height: 180px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                    <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                       <div id="pf_page_0_0" class="tabContent" style="display:none;">
                     <table class="form" cellspacing="5">
                       <tr>
@@ -431,6 +365,7 @@
                             <option value="Mrs">Mrs</option>
                             <option value="Dr">Dr</option>
                             <option value="Ms">Ms</option>
+                                <option value="Sir">Sir</option>
                           </select>
                               <select name="pf_acl_title" id="pf_acl_title">
                               </select>
@@ -483,8 +418,8 @@
                         <td>
                           <select name="pf_gender" value="" id="pf_gender">
                                 <option></option>
-                            <option value="male">Male</option>
-                            <option value="female">Female</option>
+                                <option value="Male">Male</option>
+                                <option value="Female">Female</option>
                           </select>
                               <select name="pf_acl_gender" id="pf_acl_gender">
                               </select>
@@ -533,7 +468,7 @@
                                     </table>
                                   </td>
                                   <td valign="top" nowrap="nowrap">
-                                    <span class="button pointer" onclick="TBL.createRow('x1', null, {fld_1: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                                    <span class="button pointer" onclick="TBL.createRow('x1', null, {fld_1: {className: '_validate_ _webid_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                                     <select name="pf_acl_webIDs" id="pf_acl_webIDs">
                                     </select>
                                   </td>
@@ -676,6 +611,33 @@
                             </td>
                           </tr>
                           <tr>
+                            <td> </td>
+                            <td>
+                              <label>
+                           	    <input type="checkbox" id="pf_spbEnable" name="pf_spbEnable" value="1">
+                                <b>Enable Semantic Pingback for ACLs</b>
+                              </label>
+                            </td>
+                          </tr>
+                          <tr>
+                            <td> </td>
+                            <td>
+                             <label>
+                               <input type="checkbox" id="pf_inSearch" name="pf_inSearch" value="1">
+                               <b>Include my profile in search results</b>
+                             </label>
+                            </td>
+                          </tr>
+                          <tr>
+                            <td> </td>
+                            <td>
+                             <label>
+                               <input type="checkbox" id="pf_showActive" name="pf_showActive" value="1">
+                               <b>Include in User active information</b>
+                             </label>
+                            </td>
+                          </tr>
+                          <tr>
                             <th>
                               <label for="pf_set_0_1">Set access for all fields as </label>
                             </th>
@@ -683,7 +645,7 @@
                               <select name="pf_set_0_1" id="pf_set_0_1" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
@@ -807,7 +769,7 @@
                               <input type="text" name="pf_homelng" value="" id="pf_homelng" style="width: 110px;" />
                               <label>
                                 <input type="checkbox" name="pf_homeDefaultMapLocation" id="pf_homeDefaultMapLocation" onclick="javascript: setDefaultMapLocation('home', 'business');" />
-                                Default Map Location
+                                Use as default map location
                               </label>
                         </td>
                       </tr>
@@ -839,7 +801,7 @@
                               <select name="pf_set_0_2" id="pf_set_0_2" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                         </td>
@@ -858,7 +820,7 @@
                                       Select from Service List ot Type New One
                                     </th>
                                     <th>
-                                      Member Home Page URL
+                                      Member Home Page URI
                                     </th>
                                     <th width="65px">
                                       Action
@@ -869,7 +831,7 @@
                               </table>
                             </td>
                             <td valign="top" nowrap="1">
-                              <span class="button pointer" onclick="TBL.createRow('x4', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                              <span class="button pointer" onclick="TBL.createRow('x4', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _uri_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                             </td>
                           </tr>
                         </table>
@@ -943,7 +905,7 @@
                               <select name="pf_set_0_4" id="pf_set_0_4" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
@@ -952,6 +914,18 @@
                       </div>
 
                       <div id="pf_page_0_5" class="tabContent" style="display:none;">
+                        <ul id="pf_tabs_0_5" class="tabs">
+                          <li id="pf_tab_0_5_0">Biographical Events</li>
+                          <li id="pf_tab_0_5_1">Others</li>
+                          <li id="pf_tab_0_5_2">Favorite Things</li>
+                          <li id="pf_tab_0_5_3">Creator Of</li>
+                          <li id="pf_tab_0_5_4">My Offers</li>
+                          <li id="pf_tab_0_5_5">Offers I Seek</li>
+                          <li id="pf_tab_0_5_6">Likes & DisLikes</li>
+                          <li id="pf_tab_0_5_7">Social Network</li>
+                        </ul>
+                        <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                          <div id="pf_page_0_5_0" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                           <tr>
                             <td width="600px">
@@ -982,32 +956,112 @@
                         </table>
                       </div>
 
-                      <div id="pf_page_0_6" class="tabContent" style="display:none;">
+                          <div id="pf_page_0_5_1" class="tabContent" style="display:none;">
+                            <h3>Owns</h3>
+                            <div id="pf051_list">
+                              <div style="padding: 0 0 0.5em 0;">
+                                <span onclick="javascript: pfShowOwn('new', '0');" class="button pointer"><img class="button" border="0" title="Add Offer" alt="Add Offer" src="/ods/images/icons/add_16.png"> Add</span>
+                              </div>
+                          	  <table id="pf051_tbl" class="listing">
+                          	    <thead>
+                          	      <tr class="listing_header_row">
+                            		    <th width="50%">Name</th>
+                            		    <th width="50%">Description</th>
+                            		    <th width="1%" nowrap="nowrap">Action</th>
+                          	      </tr>
+                                </thead>
+                          	    <tbody id="pf051_tbody">
+                          	    </tbody>
+                              </table>
+                            </div>
+                            <div id="pf051_form" style="display: none;">
+                              <table class="form" cellspacing="5">
+                  		    		  <tr>
+                                  <th width="25%">
+                  		              Access
+                  		            </th>
+                  		            <td>
+                                    <select name="pf051_flag" id="pf051_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Name (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf051_name" id="pf051_name" value="" class="_validate_" style="width: 400px;">
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Comment
+                                  </th>
+                                  <td>
+                                    <textarea name="pf051_comment" id="pf051_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                                  </td>
+                                </tr>
+                  		    		  <tr>
+                  		    		    <th valign="top">
+                  		              Products
+                  		            </th>
+                  		            <td width="800px">
+                                    <table id="ow_tbl" class="listing">
+                                      <tbody id="ow_tbody">
+                                      </tbody>
+                                    </table>
+                                    <input type="hidden" id="ow_no" name="ow_no" value="1" />
+                                  </td>
+                                </tr>
+                              </table>
+                              <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf051');"/>
+                                <input type="submit" name="pf_update051" value="Save" onclick="return mySubmit('pf051');"/>
+                              </div>
+                            </div>
+                          </div>
+
+                          <div id="pf_page_0_5_2" class="tabContent" style="display:none;">
                         <h3>My Offers</h3>
-                        <div id="pf06_list">
+                            <div id="pf052_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: pfShowFavorite('new', '0');" class="button pointer"><img class="button" border="0" title="Add Favorite" alt="Add Favorite" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf06_tbl" class="listing">
+                          	  <table id="pf052_tbl" class="listing">
                                 <thead>
                                   <tr class="listing_header_row">
-                        		    <th>Label</th>
-                        		    <th>URI</th>
+                            		    <th width="50%">Label</th>
+                            		    <th width="50%">URI</th>
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf06_tbody">
+                          	    <tbody id="pf052_tbody">
                       	    </tbody>
                           </table>
                         </div>
-                        <div id="pf06_form" style="display: none;">
+                            <div id="pf052_form" style="display: none;">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
+                  		              Access
+                  		            </th>
+                  		            <td>
+                                    <select name="pf052_flag" id="pf052_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
                                 Label (*)
                                     </th>
                               <td>
-                                <input type="text" name="pf06_label" id="pf06_label" value="" class="_validate_" style="width: 400px;">
+                                    <input type="text" name="pf052_label" id="pf052_label" value="" class="_validate_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -1015,7 +1069,7 @@
                                 External URI
                                     </th>
                               <td>
-                                <input type="text" name="pf06_uri" id="pf06_uri" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
+                                    <input type="text" name="pf052_uri" id="pf052_uri" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
                               </td>
                                   </tr>
                             <tr>
@@ -1031,18 +1085,19 @@
                           </tr>
                         </table>
                           <div class="footer">
-                            <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf06');"/>
-                            <input type="submit" name="pf_update06" value="Save" onclick="return mySubmit('pf06');"/>
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf052');"/>
+                                <input type="submit" name="pf_update052" value="Save" onclick="return mySubmit('pf052');"/>
                           </div>
                         </div>
                       </div>
-                      <div id="pf_page_0_7" class="tabContent" style="display:none;">
+
+                          <div id="pf_page_0_5_3" class="tabContent" style="display:none;">
                         <h3>Creator Of</h3>
-                        <div id="pf07_list">
+                            <div id="pf053_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: pfShowMade('new', '0');" class="button pointer"><img class="button" border="0" title="Add Creator Of" alt="Add Creator Of" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf07_tbl" class="listing">
+                          	  <table id="pf053_tbl" class="listing">
                       	    <thead>
                       	      <tr class="listing_header_row">
                         		    <th>Property</th>
@@ -1050,11 +1105,11 @@
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf07_tbody">
+                          	    <tbody id="pf053_tbody">
                       	    </tbody>
                           </table>
                         </div>
-                        <div id="pf07_form" style="display: none;">
+                            <div id="pf053_form" style="display: none;">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
@@ -1065,7 +1120,7 @@
                                   function p_init ()
                                   {
                                     var fld = new OAT.Combolist([]);
-                                    fld.input.name = 'pf07_property';
+                                        fld.input.name = 'pf053_property';
                                     fld.input.id = fld.input.name;
                                     fld.input.style.width = "400px";
                                     $("if_opt").appendChild(fld.div);
@@ -1082,7 +1137,7 @@
                                 URI
                               </th>
                               <td>
-                                <input type="text" name="pf07_url" id="pf07_url" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
+                                    <input type="text" name="pf053_url" id="pf053_url" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -1090,7 +1145,7 @@
                                 Description (*)
                               </th>
                               <td>
-                                <textarea name="pf07_description" id="pf07_description" style="width: 400px;"></textarea>
+                                    <textarea name="pf053_description" id="pf053_description" style="width: 400px;"></textarea>
                               </td>
                             </tr>
                             <tr>
@@ -1101,37 +1156,50 @@
                             </tr>
                           </table>
                       <div class="footer">
-                            <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf07');"/>
-                            <input type="submit" name="pf_update07" value="Save" onclick="return mySubmit('pf07');"/>
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf053');"/>
+                                <input type="submit" name="pf_update053" value="Save" onclick="return mySubmit('pf053');"/>
                           </div>
                         </div>
                       </div>
-                      <div id="pf_page_0_8" class="tabContent" style="display:none;">
+
+                          <div id="pf_page_0_5_4" class="tabContent" style="display:none;">
                         <h3>My Offers</h3>
-                        <div id="pf08_list">
+                            <div id="pf054_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: pfShowOffer('new', '0');" class="button pointer"><img class="button" border="0" title="Add Offer" alt="Add Offer" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf08_tbl" class="listing">
+                          	  <table id="pf054_tbl" class="listing">
                       	    <thead>
                       	      <tr class="listing_header_row">
-                        		    <th>Name</th>
-                        		    <th>Description</th>
+                            		    <th width="50%">Name</th>
+                            		    <th width="50%">Description</th>
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf08_tbody">
+                          	    <tbody id="pf054_tbody">
                       	    </tbody>
                           </table>
                         </div>
-                        <div id="pf08_form" style="display: none;">
+                            <div id="pf054_form" style="display: none;">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
-                                Name
+                  		              Access
                               </th>
                               <td>
-                                <input type="text" name="pf08_name" id="pf08_name" value="" class="_validate_" style="width: 400px;">
+                                    <select name="pf054_flag" id="pf054_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Name (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf054_name" id="pf054_name" value="" class="_validate_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -1139,7 +1207,7 @@
                                 Comment
                               </th>
                               <td>
-                                <textarea name="pf08_comment" id="pf08_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                                    <textarea name="pf054_comment" id="pf054_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
                               </td>
                             </tr>
                   				  <tr>
@@ -1156,37 +1224,50 @@
                             </tr>
                           </table>
                           <div class="footer">
-                            <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf08');"/>
-                            <input type="submit" name="pf_update08" value="Save" onclick="return mySubmit('pf08');"/>
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf054');"/>
+                                <input type="submit" name="pf_update054" value="Save" onclick="return mySubmit('pf054');"/>
                           </div>
                         </div>
                       </div>
-                      <div id="pf_page_0_9" class="tabContent" style="display:none;">
+
+                          <div id="pf_page_0_5_5" class="tabContent" style="display:none;">
                         <h3>Offers I Seek</h3>
-                        <div id="pf09_list">
+                            <div id="pf055_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: pfShowSeek('new', '0');" class="button pointer"><img class="button" border="0" title="Add Seek" alt="Add Seek" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf09_tbl" class="listing">
+                          	  <table id="pf055_tbl" class="listing">
                       	    <thead>
                       	      <tr class="listing_header_row">
-                        		    <th>Name</th>
-                        		    <th>Description</th>
+                            		    <th width="50%">Name</th>
+                            		    <th width="50%">Description</th>
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf09_tbody">
+                          	    <tbody id="pf055_tbody">
                       	    </tbody>
                           </table>
                         </div>
-                        <div id="pf09_form" style="display: none;">
+                            <div id="pf055_form" style="display: none;">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
-                                Name
+                  		              Access
                               </th>
                               <td>
-                                <input type="text" name="pf09_name" id="pf09_name" value="" class="_validate_" style="width: 400px;">
+                                    <select name="pf055_flag" id="pf055_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Name (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf055_name" id="pf055_name" value="" class="_validate_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -1194,7 +1275,7 @@
                                 Comment
                               </th>
                               <td>
-                                <textarea name="pf09_comment" id="pf09_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                                    <textarea name="pf055_comment" id="pf055_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
                               </td>
                             </tr>
                   				  <tr>
@@ -1211,8 +1292,203 @@
                             </tr>
                           </table>
                           <div class="footer">
-                            <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf09');"/>
-                            <input type="submit" name="pf_update09" value="Save" onclick="return mySubmit('pf09');"/>
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf055');"/>
+                                <input type="submit" name="pf_update055" value="Save" onclick="return mySubmit('pf055');"/>
+                          </div>
+                        </div>
+                      </div>
+
+                          <div id="pf_page_0_5_6" class="tabContent" style="display:none;">
+                        <h3>Likes & DisLikes</h3>
+                            <div id="pf056_list">
+                          <div style="padding: 0 0 0.5em 0;">
+                            <span onclick="javascript: pfShowLike('new', '0');" class="button pointer"><img class="button" border="0" title="Add Like" alt="Add Like" src="/ods/images/icons/add_16.png"> Add</span>
+                          </div>
+                          	  <table id="pf056_tbl" class="listing">
+                      	    <thead>
+                      	      <tr class="listing_header_row">
+                            		    <th width="10%">Type</th>
+                            		    <th width="45%">URI</th>
+                            		    <th width="45%">Name</th>
+                        		    <th width="1%" nowrap="nowrap">Action</th>
+                      	      </tr>
+                            </thead>
+                          	    <tbody id="pf056_tbody">
+                      	    </tbody>
+                          </table>
+                        </div>
+                            <div id="pf056_form" style="display: none;">
+                          <table class="form" cellspacing="5">
+                            <tr>
+                              <th width="25%">
+                  		              Access
+                  		            </th>
+                  		            <td>
+                                    <select name="pf056_flag" id="pf056_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                Type
+                              </th>
+                              <td>
+                                    <select name="pf056_type" id="pf056_type">
+                                  <option value="L">Like</option>
+                                  <option value="DL">DisLike</option>
+                                </select>
+                              </td>
+                            </tr>
+                            <tr>
+                              <th>
+                                    URI (*)
+                              </th>
+                              <td>
+                                    <input type="text" name="pf056_uri" id="pf056_uri" value="" class="_validate_ _uri_" style="width: 400px;">
+                              </td>
+                            </tr>
+                            <tr>
+                              <th>
+                                    Name (*)
+                              </th>
+                              <td>
+                                    <input type="text" name="pf056_name" id="pf056_name" value="" class="_validate_" style="width: 400px;">
+                              </td>
+                            </tr>
+                            <tr>
+                              <th>
+                                Comment
+                              </th>
+                              <td>
+                                    <textarea name="pf056_comment" id="pf056_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                              </td>
+                            </tr>
+                  				  <tr>
+                  				    <th valign="top">
+		                            Properties
+                  		        </th>
+                  		        <td width="800px">
+                                <table id="ld_tbl" class="listing">
+                                  <tbody id="ld_tbody">
+                                  </tbody>
+                                </table>
+                                <input type="hidden" id="ld_no" name="ld_no" value="1" />
+                              </td>
+                            </tr>
+                          </table>
+                          <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf056');"/>
+                                <input type="submit" name="pf_update056" value="Save" onclick="return mySubmit('pf056');"/>
+                              </div>
+                            </div>
+                          </div>
+
+                          <div id="pf_page_0_5_7" class="tabContent" style="display:none;">
+                            <h3>Knows</h3>
+                            <div id="pf057_list">
+                              <div style="padding: 0 0 0.5em 0;">
+                                <span onclick="javascript: pfShowKnow('new', '0');" class="button pointer"><img class="button" border="0" title="Add Know" alt="Add Know" src="/ods/images/icons/add_16.png"> Add</span>
+                                <span onclick="javascript: pfShowKnow('import', '0');" class="button pointer"><img class="button" border="0" title="Import Know" alt="Add Know" src="/ods/images/icons/add_16.png"> Import</span>
+                              </div>
+                          	  <table id="pf057_tbl" class="listing">
+                          	    <thead>
+                          	      <tr class="listing_header_row">
+                            		    <th width="50%">Label</th>
+                            		    <th width="50%">URI</th>
+                            		    <th width="1%" nowrap="nowrap">Action</th>
+                          	      </tr>
+                                </thead>
+                          	    <tbody id="pf057_tbody">
+                          	    </tbody>
+                              </table>
+                            </div>
+                            <div id="pf057_import" style="display: none;">
+                              <table>
+                      				  <tr>
+                      				    <th width="100px">
+                      		          Source
+                      		        </th>
+                                  <td>
+                                    <input type="text" class="_validate_ _uri_" size="100" value="" id="k_import" name="k_import">
+                                    <input type="button" class="button" onclick="javascript: knowsData(); return false;" value="Download">
+                                    <img style="display: none;" src="/ods/images/oat/Ajax_throbber.gif" alt="Import knows URIs" id="k_import_image">
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                  </th><td>
+                                    <table class="listing" id="k_tbl">
+                                      <thead>
+                                        <tr class="listing_header_row">
+                                          <th>
+                                            Access
+                                          </th>
+                                          <th width="50%">
+                                            URI
+                                          </th>
+                                          <th width="50%">
+                                            Label
+                                          </th>
+                                          <th width="65px">
+                                            Action
+                                          </th>
+                                        </tr>
+                                      </thead>
+                                      <tbody>
+                                        <tr id="k_tr_no">
+                                           <td colspan="3">
+                                             <b>No downloaded items</b>
+                                           </td>
+                                        </tr>
+                                      </tbody>
+                                    </table>
+                                  </td>
+                                </tr>
+                              </table>
+                              <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf057');"/>
+                                <input type="submit" name="pf_update057" value="Import" onclick="return mySubmit('pf057');"/>
+                              </div>
+                            </div>
+                            <div id="pf057_form" style="display: none;">
+                              <table class="form" cellspacing="5">
+                  		    		  <tr>
+                                  <th width="25%">
+                  		              Access
+                  		            </th>
+                  		            <td>
+                                    <select name="pf057_flag" id="pf057_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    URI (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf057_uri" id="pf057_uri" value="" class="_validate_ _uri_" style="width: 400px;">
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Label (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf057_label" id="pf057_label" value="" class="_validate_" style="width: 400px;">
+                                  </td>
+                                </tr>
+                              </table>
+                              <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf057');"/>
+                                <input type="submit" name="pf_update057" value="Save" onclick="return mySubmit('pf057');"/>
+                              </div>
+                            </div>
                           </div>
                         </div>
                       </div>
@@ -1232,7 +1508,7 @@
                       <li id="pf_tab_1_2" title="Online Accounts">Online Accounts</li>
                       <li id="pf_tab_1_3" title="Messaging Services">Messaging Services</li>
                     </ul>
-                    <div style="min-height: 180px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                    <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                       <div id="pf_page_1_0" class="tabContent" style="display:none;">
                     <table class="form" cellspacing="5">
                       <tr>
@@ -1389,7 +1665,7 @@
                               <select name="pf_set_1_0" id="pf_set_1_0" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
@@ -1513,7 +1789,7 @@
                               <input type="text" name="pf_businesslng" value="" id="pf_businesslng" style="width: 110px;" />
                               <label>
                                 <input type="checkbox" name="pf_businessDefaultMapLocation" id="pf_businessDefaultMapLocation" onclick="javascript: setDefaultMapLocation('business', 'home');" />
-                                Default Map Location
+                                Use as default map location
                               </label>
                         </td>
                       </tr>
@@ -1545,7 +1821,7 @@
                               <select name="pf_set_1_1" id="pf_set_1_1" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                         </td>
@@ -1575,7 +1851,7 @@
                               </table>
                             </td>
                             <td valign="top" nowrap="1">
-                              <span class="button pointer" onclick="TBL.createRow('y1', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                              <span class="button pointer" onclick="TBL.createRow('y1', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _uri_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                         </td>
                       </tr>
                         </table>
@@ -1649,7 +1925,7 @@
                               <select name="pf_set_1_3" id="pf_set_1_3" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
@@ -1666,103 +1942,60 @@
                   </div>
 
                   <div id="pf_page_2" class="tabContent" style="display:none;">
+                    <ul id="pf_tabs_2" class="tabs">
+                      <li id="pf_tab_2_0" title="Password">Password</li>
+                      <li id="pf_tab_2_1" title="Password Recovery">Password Recovery</li>
+                      <li id="pf_tab_2_2" title="OpenID">OpenID</li>
+                      <li id="pf_tab_2_3" title="Facebook" style="display:none;">Facebook</li>
+                      <li id="pf_tab_2_4" title="Limits">Limits</li>
+                      <li id="pf_tab_2_5" title="Certificate Generator" style="display:none;">Certificate Generator</li>
+                      <li id="pf_tab_2_6" title="X.509 Certificates">X.509 Certificates</li>
+                    </ul>
+                    <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                      <div id="pf_page_2_0" class="tabContent" style="display:none;">
+                        <h2>Change login password</h2>
+                        <p class="fm_expln">For your security, please use a password not found in a dictionary, consisting of both letters, and numbers or non-alphanumeric characters.</p>
                     <table class="form" cellspacing="5">
                       <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Password Settings
-                        </th>
+                            <td align="center" colspan="2">
+                              <span id="pf_change_txt"></span>
+                            </td>
                       </tr>
-                      <tr>
-                        <th width="30%" nowrap="nowrap">
+                          <tr id="tr_oldPassword">
+                            <th width="30%">
                           <label for="pf_oldPassword">Old Password</label>
                         </th>
-                        <td nowrap="nowrap">
+                            <td>
                           <input type="password" name="pf_oldPassword" value="" id="pf_oldPassword" />
                         </td>
                       </tr>
                       <tr>
-                        <th>
+                            <th width="30%">
                           <label for="pf_newPassword">New Password</label>
                         </th>
-                        <td nowrap="nowrap">
+                            <td>
                           <input type="password" name="pf_newPassword" value="" id="pf_newPassword" />
                         </td>
                       </tr>
                       <tr>
                         <th>
-                          <label for="pf_password">Repeat Password</label>
+                              <label for="pf_newPassword2">Repeat Password</label>
                         </th>
-                        <td nowrap="nowrap">
+                            <td>
                           <input type="password" name="pf_newPassword2" value="" id="pf_newPassword2" />
                         </td>
                       </tr>
-                      <tr>
-                        <th>
-                        </th>
-                        <td nowrap="nowrap">
-                          <input type="button" name="pf_change" value="Change" onclick="javascript: return pfChangeSubmit();" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          OpenID
-                        </th>
-                      </tr>
-                      <tr>
-                        <th>
-                          <label for="pf_securityOpenID">OpenID URL</label>
-                        </th>
-                        <td nowrap="nowrap">
-                          <input type="text" name="pf_securityOpenID" value="" id="pf_securityOpenID" style="width: 220px;" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th>
-                        </th>
-                        <td nowrap="nowrap">
-                          <input type="submit" name="pf_update" value="Change" onclick="return pfUpdateSubmit(31);"/>
-                        </td>
-                      </tr>
-                      <tr id="pf_facebook" style="display:none;">
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Facebook
-                        </th>
-                      </tr>
-                      <tr id="pf_facebook1" style="display:none;">
-                        <th>
-                          Saved Facebook ID
-                        </th>
-                        <td nowrap="nowrap">
-                        </td>
-                      </tr>
-                      <tr id="pf_facebook2" style="display:none;">
-                        <th>
-                        </th>
-                        <td nowrap="nowrap">
-                          <span id="pf_facebookData" style="min-height: 20px;"></span>
-                          <br />
-                          <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
-                          <fb:login-button autologoutlink="true"></fb:login-button>
-                        </td>
-                      </tr>
-                      <tr id="pf_facebook3" style="display:none;">
-                        <th>
-                        </th>
-                        <td nowrap="nowrap">
-                          <input type="submit" name="pf_update" value="Change" onclick="return pfUpdateSubmit(32);"/>
-                          <input type="submit" name="pf_update" value="Clear" onclick="return pfUpdateSubmit(33);" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Password Recovery
-                        </th>
-                      </tr>
+                        </table>
+                      </div>
+                      <div id="pf_page_2_1" class="tabContent" style="display:none;">
+                        <h2>Password recovery questions</h2>
+                        <p class="fm_expln">Manage password recovery procedure. Set verification question / answer.</p>
+                        <table class="form" cellspacing="5">
                       <tr>
                         <th>
                           <label for="pf_securitySecretQuestion">Secret Question</label>
                         </th>
-                        <td id="td_securitySecretQuestion" nowrap="nowrap">
+                            <td id="td_securitySecretQuestion">
                           <script type="text/javascript">
                             function categoryCombo ()
                             {
@@ -1785,90 +2018,149 @@
                         <th>
                           <label for="pf_securitySecretAnswer">Secret Answer</label>
                         </th>
-                        <td nowrap="nowrap">
+                            <td>
                           <input type="text" name="pf_securitySecretAnswer" value="" id="pf_securitySecretAnswer"  style="width: 220px;" />
                         </td>
                       </tr>
+                        </table>
+                      </div>
+                      <div id="pf_page_2_2" class="tabContent" style="display:none;">
+                        <table class="form" cellspacing="5">
                       <tr>
                         <th>
+                              <label for="pf_openID">OpenID URL</label>
                         </th>
-                        <td nowrap="nowrap">
-                          <input type="submit" name="pf_update" value="Change" onclick="return pfUpdateSubmit(34);"/>
+                            <td>
+                              <input type="text" name="pf_openID" value="" id="pf_openID" style="width: 220px;" />
                         </td>
                       </tr>
+                        </table>
+                      </div>
+                      <div id="pf_page_2_3" class="tabContent" style="display:none;">
+                        <table class="form" cellspacing="5">
                       <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Applications restrictions
+                            <th>
+                              Saved Facebook ID
                         </th>
+                            <td>
+                              <span id="span_facebookName"></span>
+                            </td>
                       </tr>
                       <tr>
                         <th>
-                          <label for="pf_securitySiocLimit">SIOC Query Result Limit  </label>
                         </th>
-                        <td nowrap="nowrap">
-                          <input type="text" name="pf_securitySiocLimit" value="" id="pf_securitySiocLimit" />
+                            <td>
+                              <span id="pf_facebookData" style="min-height: 20px;"></span>
+                              <br />
+                              <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
+                              <fb:login-button autologoutlink="true"></fb:login-button>
                         </td>
                       </tr>
+                        </table>
+                      </div>
+                      <div id="pf_page_2_4" class="tabContent" style="display:none;">
+                        <table class="form" cellspacing="5">
                       <tr>
                         <th>
+                              <label for="pf_securitySiocLimit">SIOC Query Result Limit</label>
                         </th>
-                        <td nowrap="nowrap">
-                          <input type="submit" name="pf_update" value="Change" onclick="return pfUpdateSubmit(35);"/>
+                            <td>
+                              <input type="text" name="pf_securitySiocLimit" value="" id="pf_securitySiocLimit" />
                         </td>
                       </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          X.509 Certificate
-                        </th>
+                        </table>
+                      </div>
+
+                      <div id="pf_page_2_5" class="tabContent" style="display:none;">
+            	          <iframe id="cert" src="/ods/cert.vsp" width="650" height="270" frameborder="0" scrolling="no">
+            	            <p>Your browser does not support iframes.</p>
+            	          </iframe>
+                      </div>
+
+                      <div id="pf_page_2_6" class="tabContent" style="display:none;">
+                        <h3>X.509 Certificates</h3>
+                        <div id="pf26_list">
+                          <div style="padding: 0 0 0.5em 0;">
+                            <span onclick="javascript: pfShowCertificate('new', '0');" class="button pointer"><img class="button" border="0" title="Add Seek" alt="Add Seek" src="/ods/images/icons/add_16.png"> Add</span>
+                          </div>
+                      	  <table id="pf26_tbl" class="listing">
+                      	    <thead>
+                      	      <tr class="listing_header_row">
+                        		    <th>Subject</th>
+                          		  <th>Created</th>
+                          		  <th>Fingerprint</th>
+                          		  <th>Login enabled</th>
+                        		    <th width="1%" nowrap="nowrap">Action</th>
                       </tr>
-                      <tr id="tr_certificateSubject" style="display: none;">
+                            </thead>
+                      	    <tbody id="pf26_tbody">
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowCertificates();});
+                              </script>
+                      	    </tbody>
+                          </table>
+                        </div>
+                        <div id="pf26_form" style="display: none;">
+                          <table class="form" cellspacing="5">
+                            <tr id="pf26_form_0">
                         <th>
                 	    	  Subject
                         </th>
-                        <td nowrap="nowrap">
-                    		  <span id="span_certificateSubject"></span>
+                              <td>
+                          		  <span id="pf26_subject"></span>
                     		</td>
                       </tr>
-                      <tr id="tr_certificateAgentID" style="display: none;">
+                            <tr id="pf26_form_1">
                         <th>
                 	    	  Agent ID
                         </th>
-                        <td nowrap="nowrap">
-                    		  <span id="span_certificateAgentID"></span>
+                              <td>
+                          		  <span id="pf26_agentID"></span>
+                          		</td>
+                            </tr>
+                            <tr id="pf26_form_2">
+                              <th>
+                      	    	  Fingerprint
+                              </th>
+                              <td>
+                          		  <span id="pf26_fingerPrint"></span>
                     		</td>
                       </tr>
                       <tr>
                         <th valign="top">
-                          <label for="pf_certificate">Certificate</label>
+                                <label for="pf26_certificate">Certificate</label>
                         </th>
-                        <td nowrap="nowrap">
-                          <textarea name="pf_certificate" id="pf_certificate" rows="20" style="width: 540px;"></textarea>
-              	          <iframe id="iframe_certificate" src="" width="200" height="200" frameborder="0" scrolling="no" style="display: none;">
-              	            <p>Your browser does not support iframes.</p>
-              	          </iframe>
+                              <td>
+                                <textarea name="pf26_certificate" id="pf26_certificate" rows="20" style="width: 560px;"></textarea>
                         </td>
                       </tr>
                       <tr>
                         <th></th>
-                        <td nowrap="nowrap">
+                              <td>
                           <label>
-                            <input type="checkbox" name="pf_certificateLogin" id="pf_certificateLogin" value="1" />
+                                  <input type="checkbox" name="pf26_enableLogin" id="pf26_enableLogin" value="1"/>
                             Enable Automatic WebID Login
                           </label>
                         </td>
                       </tr>
-                      <tr>
-                        <th>
-                        </th>
-                        <td nowrap="nowrap">
-                          <input type="submit" name="pf_update" value="Change" onclick="return pfUpdateSubmit(36);" />
-                          <input type="submit" name="pf_update" value="Clear" onclick="return pfUpdateSubmit(37);" />
-                          <input type="submit" name="pf_update" value="Refresh" onclick="return pfUpdateSubmit(99);" />
-                        </td>
-                      </tr>
                     </table>
+                          <script type="text/javascript">
+                            OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowCertificate();});
+                          </script>
                     <div class="footer">
+                            <input type="submit" name="pf_cancel2" value="Cancel" onclick="return myCancel('pf26');"/>
+                            <input type="submit" name="pf_update26" value="Save" onclick="return mySubmit('pf26');"/>
+                          </div>
+                        </div>
+                      </div>
+
+                      <div id="pf_footer_2" class="footer">
                       <input type="submit" name="pf_cancel" value="Cancel" onclick="return pfCancelSubmit();"/>
+                        <input type="submit" name="pf_clear" value="Clear" onclick="return pfUpdateSubmit(2);"/>
+                        <input type="submit" name="pf_update" value="Save" onclick="return pfUpdateSubmit(0);"/>
+                        <input type="submit" name="pf_next" value="Save & Next" onclick="return pfUpdateSubmit(1);"/>
+                      </div>
+
                   </div>
                 </div>
                 </div>
@@ -1884,7 +2176,7 @@
      <div id="FT_R">
        <a href="/ods/faq.html">FAQ</a> | <a href="/ods/privacy.html">Privacy</a> | <a href="/ods/rabuse.vspx">Report Abuse</a>
        <div>
-         Copyright © 1999-2010 OpenLink Software
+            Copyright © 1999-2011 OpenLink Software
        </div>
      </div>
     </div>
diff --git a/appsrc/ODS-Framework/users/users.jsp b/appsrc/ODS-Framework/users/users.jsp
index 6862e6d..6c0126e 100644
--- a/appsrc/ODS-Framework/users/users.jsp
+++ b/appsrc/ODS-Framework/users/users.jsp
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
  -
- -  $Id: users.jsp,v 1.5.2.21 2010/06/30 14:31:03 source Exp $
+ -  $Id: users.jsp,v 1.5.2.38 2011/03/26 14:22:25 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -61,22 +61,19 @@
     <script type="text/javascript" src="/ods/common.js"></script>
     <script type="text/javascript" src="/ods/typeahead.js"></script>
     <script type="text/javascript" src="/ods/tbl.js"></script>
+    <script type="text/javascript" src="/ods/validate.js"></script>
     <script type="text/javascript">
       // OAT
       var toolkitPath="/ods/oat";
-      var featureList = ["ajax", "json", "tab", "combolist", "calendar", "crypto", "rdfmini", "grid", "graphsvg", "tagcloud", "map", "timeline", "anchor"];
+      var featureList = ["ajax", "json", "tab", "combolist", "calendar", "rdfmini", "grid", "graphsvg", "tagcloud", "map", "timeline", "anchor"];
     </script>
     <script type="text/javascript" src="/ods/oat/loader.js"></script>
-    <script type="text/javascript">
-      OAT.MSG.attach(OAT, 'PAGE_LOADED', myInit);
-      window.onload = function(){OAT.MSG.send(OAT, 'PAGE_LOADED');};
-    </script>
   </head>
   <%!
     XPathFactory factory = XPathFactory.newInstance();
     XPath xpath = factory.newXPath();
     Document $_acl = null;
-    String[] $_ACL = {"public", "1", "friends", "2", "private", "3"};
+    String[] $_ACL = {"public", "1", "acl", "2", "private", "3"};
 
     Document createDocument (String S)
     {
@@ -270,6 +267,16 @@
       return null;
     }
 
+    String getParameterDefault(List items, HttpServletRequest req, String param, String defaultValue)
+      throws IOException, FileUploadException
+    {
+      String value = getParameter(items, req, param);
+      if (value == null)
+        value = defaultValue;
+
+      return value;
+    }
+
     public String convertStreamToString(InputStream in)
       throws IOException
     {
@@ -294,33 +301,57 @@
       // Parse the request
       items = upload.parseRequest(request);
     }
+
+    String $_retValue;
+    Document $_document = null;
+    String params = null;
+
+    Boolean $_validate = false;
+    String $_error = "";
+    String $_userName = getParameter(items, request, "userName");
+    String $_sid = getParameter(items, request, "sid");
+    String $_realm = "wa";
+    if ($_sid != null) {
+      params = httpParam( "", "sid", $_sid) +
+               httpParam("&", "realm", $_realm);
+      if ($_userName != null)
+        params += httpParam( "&", "name", $_userName);
+
+      $_retValue = httpRequest ("POST", "user.validate", params);
+      if ($_retValue.indexOf("<result>") == 0)
+      {
+        $_validate = true;
+      }
+    }
+
     String $_form = null;
     String $_oidForm = getParameter(items, request, "oid-form");
     if ($_oidForm == null) {
       $_form = getParameter(items, request, "form");
+      if ($_userName != null) {
+        $_form = "user";
+      } else {
+        $_form = "login";
+      }
     } else {
       if ($_oidForm.equals("lf"))
         $_form = "login";
       if ($_oidForm.equals("rf"))
         $_form = "register";
     }
-    if ($_form == null)
-      $_form = "login";
+
     int $_formTab = 0;
     if (getParameter(items, request, "formTab") != null)
       $_formTab = Integer.parseInt(getParameter(items, request, "formTab"));
-    int $_formSubtab = 0;
-    if (getParameter(items, request, "formSubtab") != null)
-      $_formSubtab = Integer.parseInt(getParameter(items, request, "formSubtab"));
+    int $_formTab2 = 0;
+    if (getParameter(items, request, "formTab2") != null)
+      $_formTab2 = Integer.parseInt(getParameter(items, request, "formTab2"));
+    int $_formTab3 = 0;
+    if (getParameter(items, request, "formTab3") != null)
+      $_formTab3 = Integer.parseInt(getParameter(items, request, "formTab3"));
     String $_formMode = "";
     if (getParameter(items, request, "formMode") != null)
       $_formMode = getParameter(items, request, "formMode");
-    String $_sid = getParameter(items, request, "sid");
-    String $_realm = "wa";
-    String $_error = "";
-    String $_retValue;
-    Document $_document = null;
-    String params = null;
 
     try
     {
@@ -332,13 +363,31 @@
 
       if ($_form.equals("profile"))
       {
-        if (getParameter(items, request, "pf_update06") != null)
+        if (getParameter(items, request, "pf_update051") != null)
+        {
+          params = httpParam( "", "sid", $_sid) +
+                   httpParam("&", "realm", $_realm) +
+                   httpParam("&", "id", getParameter(items, request, "pf051_id")) +
+                   httpParam("&", "flag", getParameter(items, request, "pf051_flag")) +
+                   httpParam("&", "name", getParameter(items, request, "pf051_name")) +
+                   httpParam("&", "comment", getParameter(items, request, "pf051_comment")) +
+                   httpParam("&", "properties", getParameter(items, request, "items"));
+          $_retValue = httpRequest ("POST", "user.owns."+$_formMode, params);
+          if ($_retValue.indexOf("<failed>") == 0)
+          {
+		        $_document = createDocument($_retValue);
+            throw new Exception(xpathEvaluate($_document, "/failed/message"));
+          }
+          $_formMode = "";
+        }
+        else if (getParameter(items, request, "pf_update052") != null)
         {
           params = httpParam( "", "sid", $_sid) +
                    httpParam("&", "realm", $_realm) +
-                   httpParam("&", "id", getParameter(items, request, "pf06_id")) +
-                   httpParam("&", "label", getParameter(items, request, "pf06_label")) +
-                   httpParam("&", "uri", getParameter(items, request, "pf06_uri")) +
+                   httpParam("&", "id", getParameter(items, request, "pf052_id")) +
+                   httpParam("&", "flag", getParameter(items, request, "pf052_flag")) +
+                   httpParam("&", "label", getParameter(items, request, "pf052_label")) +
+                   httpParam("&", "uri", getParameter(items, request, "pf052_uri")) +
                    httpParam("&", "properties", getParameter(items, request, "items"));
           $_retValue = httpRequest ("POST", "user.favorites."+$_formMode, params);
           if ($_retValue.indexOf("<failed>") == 0)
@@ -348,14 +397,14 @@
           }
           $_formMode = "";
         }
-        else if (getParameter(items, request, "pf_update07") != null)
+        else if (getParameter(items, request, "pf_update053") != null)
         {
           params = httpParam( "", "sid", $_sid) +
                    httpParam("&", "realm", $_realm) +
-                   httpParam("&", "id", getParameter(items, request, "pf07_id")) +
-                   httpParam("&", "property", getParameter(items, request, "pf07_property")) +
-                   httpParam("&", "url", getParameter(items, request, "pf07_url")) +
-                   httpParam("&", "description", getParameter(items, request, "pf07_description"));
+                   httpParam("&", "id", getParameter(items, request, "pf053_id")) +
+                   httpParam("&", "property", getParameter(items, request, "pf053_property")) +
+                   httpParam("&", "url", getParameter(items, request, "pf053_url")) +
+                   httpParam("&", "description", getParameter(items, request, "pf053_description"));
           $_retValue = httpRequest ("POST", "user.mades."+$_formMode, params);
           if ($_retValue.indexOf("<failed>") == 0)
           {
@@ -364,13 +413,14 @@
           }
           $_formMode = "";
         }
-        else if (getParameter(items, request, "pf_update08") != null)
+        else if (getParameter(items, request, "pf_update054") != null)
         {
           params = httpParam( "", "sid", $_sid) +
                    httpParam("&", "realm", $_realm) +
-                   httpParam("&", "id", getParameter(items, request, "pf08_id")) +
-                   httpParam("&", "name", getParameter(items, request, "pf08_name")) +
-                   httpParam("&", "comment", getParameter(items, request, "pf08_comment")) +
+                   httpParam("&", "id", getParameter(items, request, "pf054_id")) +
+                   httpParam("&", "flag", getParameter(items, request, "pf054_flag")) +
+                   httpParam("&", "name", getParameter(items, request, "pf054_name")) +
+                   httpParam("&", "comment", getParameter(items, request, "pf054_comment")) +
                    httpParam("&", "properties", getParameter(items, request, "items"));
           $_retValue = httpRequest ("POST", "user.offers."+$_formMode, params);
           if ($_retValue.indexOf("<failed>") == 0)
@@ -380,13 +430,14 @@
           }
           $_formMode = "";
         }
-        else if (getParameter(items, request, "pf_update09") != null)
+        else if (getParameter(items, request, "pf_update055") != null)
         {
           params = httpParam( "", "sid", $_sid) +
                    httpParam("&", "realm", $_realm) +
-                   httpParam("&", "id", getParameter(items, request, "pf09_id")) +
-                   httpParam("&", "name", getParameter(items, request, "pf09_name")) +
-                   httpParam("&", "comment", getParameter(items, request, "pf09_comment")) +
+                   httpParam("&", "id", getParameter(items, request, "pf055_id")) +
+                   httpParam("&", "flag", getParameter(items, request, "pf055_flag")) +
+                   httpParam("&", "name", getParameter(items, request, "pf055_name")) +
+                   httpParam("&", "comment", getParameter(items, request, "pf055_comment")) +
                    httpParam("&", "properties", getParameter(items, request, "items"));
           $_retValue = httpRequest ("POST", "user.seeks."+$_formMode, params);
           if ($_retValue.indexOf("<failed>") == 0)
@@ -396,11 +447,92 @@
           }
           $_formMode = "";
         }
+        else if (getParameter(items, request, "pf_update056") != null)
+        {
+          params = httpParam( "", "sid", $_sid) +
+                   httpParam("&", "realm", $_realm) +
+                   httpParam("&", "id", getParameter(items, request, "pf056_id")) +
+                   httpParam("&", "flag", getParameter(items, request, "pf056_flag")) +
+                   httpParam("&", "uri", getParameter(items, request, "pf056_uri")) +
+                   httpParam("&", "type", getParameter(items, request, "pf056_type")) +
+                   httpParam("&", "name", getParameter(items, request, "pf056_name")) +
+                   httpParam("&", "comment", getParameter(items, request, "pf056_comment")) +
+                   httpParam("&", "properties", getParameter(items, request, "items"));
+          $_retValue = httpRequest ("POST", "user.likes."+$_formMode, params);
+          if ($_retValue.indexOf("<failed>") == 0)
+          {
+		        $_document = createDocument($_retValue);
+            throw new Exception(xpathEvaluate($_document, "/failed/message"));
+          }
+          $_formMode = "";
+        }
+        else if (getParameter(items, request, "pf_update057") != null)
+        {
+          List items2 = new ArrayList();
+          if ($_formMode.equals("import"))
+          {
+            Enumeration keys = request.getParameterNames();
+    		    while (keys.hasMoreElements())
+    		    {
+    		      String key = (String)keys.nextElement();
+              if (key.indexOf("k_fld_1_") == 0)
+              {
+                String suffix = key.replace("k_fld_1_", "");
+                items2.add(new String[]{"",
+                                        getParameter(items, request, "k_fld_1_"+suffix),
+                                        getParameter(items, request, "k_fld_2_"+suffix),
+                                        getParameter(items, request, "k_fld_3_"+suffix)
+                                       }
+                          );
+              }
+            }
+            $_formMode = "new";
+          } else {
+            items2.add(new String[]{getParameter(items, request, "pf057_id"),
+                                    getParameter(items, request, "pf057_flag"),
+                                    getParameter(items, request, "pf057_uri"),
+                                    getParameter(items, request, "pf057_label")
+                                   }
+                      );
+          }
+          for (int N = 0; N < items2.size(); N++)
+          {
+            String[] item = (String[])items2.get(N);
+            params = httpParam( "", "sid", $_sid) +
+                     httpParam("&", "realm", $_realm) +
+                     httpParam("&", "id", item[0]) +
+                     httpParam("&", "flag", item[1]) +
+                     httpParam("&", "uri", item[2]) +
+                     httpParam("&", "label", item[3]);
+            $_retValue = httpRequest ("POST", "user.knows."+$_formMode, params);
+            if ($_retValue.indexOf("<failed>") == 0)
+            {
+  		        $_document = createDocument($_retValue);
+              throw new Exception($_formMode + xpathEvaluate($_document, "/failed/message"));
+            }
+          }
+          $_formMode = "";
+        }
+        else if (getParameter(items, request, "pf_update26") != null)
+        {
+          params = httpParam( "", "sid", $_sid) +
+                   httpParam("&", "realm", $_realm) +
+                   httpParam("&", "id", getParameter(items, request, "pf26_id")) +
+                   httpParam("&", "certificate", getParameter(items, request, "pf26_certificate")) +
+                   httpParam("&", "enableLogin", getParameter(items, request, "pf26_enableLogin"));
+          $_retValue = httpRequest ("POST", "user.certificates."+$_formMode, params);
+          if ($_retValue.indexOf("<failed>") == 0)
+          {
+		        $_document = createDocument($_retValue);
+            throw new Exception(xpathEvaluate($_document, "/failed/message"));
+          }
+          $_formMode = "";
+        }
         else if (getParameter(items, request, "pf_cancel2") != null)
         {
           $_formMode = "";
         }
-        else if ((getParameter(items, request, "pf_update") != null) || (getParameter(items, request, "pf_next") != null))
+        else if ((getParameter(items, request, "pf_update") != null) || (getParameter(items, request, "pf_next") != null) || (getParameter(items, request, "pf_clear") != null))
         {
           $_formMode = "";
           String tmp = "";
@@ -408,11 +540,11 @@
           String suffix = "";
           Enumeration keys;
           try {
-            if ((($_formTab == 0) && ($_formSubtab == 3)) || (($_formTab == 1) && ($_formSubtab == 2)))
+            if ((($_formTab == 0) && ($_formTab2 == 3)) || (($_formTab == 1) && ($_formTab2 == 2)))
             {
               String accountType = "P";
               prefix = "x4";
-              if (($_formTab == 1) && ($_formSubtab == 2))
+              if (($_formTab == 1) && ($_formTab2 == 2))
               {
                 accountType = "B";
                 prefix = "y1";
@@ -445,7 +577,7 @@
                 }
       		    }
             }
-            else if (($_formTab == 0) && ($_formSubtab == 5))
+            else if (($_formTab == 0) && ($_formTab2 == 5))
             {
               prefix = "x5";
               params = httpParam( "", "sid", $_sid) + httpParam ("&", "realm", $_realm);
@@ -476,12 +608,30 @@
                 }
       		    }
             }
+            else if (($_formTab == 2) && ($_formTab2 == 0))
+            {
+              params = httpParam( "", "sid", $_sid) +
+                       httpParam("&", "realm", $_realm) +
+                       httpParam("&", "new_password", getParameter(items, request, "pf_newPassword"));
+              if (getParameter(items, request, "pf_oldPassword") == null)
+              {
+                params+= httpParam("&", "old_password", "x");
+              } else {
+                params+= httpParam("&", "old_password", getParameter(items, request, "pf_oldPassword"));
+              }
+              $_retValue = httpRequest ("POST", "user.password_change", params);
+              if ($_retValue.indexOf("<failed>") == 0)
+              {
+    		        $_document = createDocument($_retValue);
+                throw new Exception(xpathEvaluate($_document, "/failed/message"));
+              }
+            }
             else
             {
               params = httpParam ( "", "sid", $_sid) + httpParam ("&", "realm", $_realm);
               if ($_formTab == 0)
               {
-                if ($_formSubtab == 0)
+                if ($_formTab2 == 0)
                 {
                   // Import
                   if ("1".equals(getParameter(items, request, "cb_item_i_name")))
@@ -535,7 +685,7 @@
                   if ("1".equals(getParameter(items, request, "cb_item_i_onlineAccounts")))
                     params += httpParam ("&", "onlineAccounts", getParameter(items, request, "i_onlineAccounts"));
                 }
-                else if ($_formSubtab == 1)
+                else if ($_formTab2 == 1)
                 {
                   params +=
                        httpParam ("&", "nickName"              , getParameter(items, request, "pf_nickName")) +
@@ -550,6 +700,9 @@
                        httpParam ("&", "mailSignature"         , getParameter(items, request, "pf_mailSignature")) +
                        httpParam ("&", "summary"               , getParameter(items, request, "pf_summary")) +
                        httpParam ("&", "appSetting"            , getParameter(items, request, "pf_appSetting")) +
+                       httpParam ("&", "spbEnable"             , getParameterDefault(items, request, "pf_spbEnable", "0")) +
+                       httpParam ("&", "inSearch"              , getParameterDefault(items, request, "pf_inSearch", "0")) +
+                       httpParam ("&", "showActive"            , getParameterDefault(items, request, "pf_showActive", "0")) +
                        httpParam ("&", "photo"                 , getParameter(items, request, "pf_photo")) +
                        httpParam ("&", "photoContent"          , getParameter(items, request, "pf_photoContent")) +
                        httpParam ("&", "audio"                 , getParameter(items, request, "pf_audio")) +
@@ -626,7 +779,7 @@
             		  }
                   params += httpParam ("&", "topicInterests", tmp);
                 }
-                if ($_formSubtab == 2)
+                if ($_formTab2 == 2)
                 {
                   params +=
                        httpParam ("&", "homeDefaultMapLocation", getParameter(items, request, "pf_homeDefaultMapLocation")) +
@@ -643,7 +796,7 @@
                        httpParam ("&", "homePhoneExt"          , getParameter(items, request, "pf_homePhoneExt")) +
                        httpParam ("&", "homeMobile"            , getParameter(items, request, "pf_homeMobile"));
                 }
-                if ($_formSubtab == 4)
+                if ($_formTab2 == 4)
                 {
                   params +=
                        httpParam ("&", "icq"                   , getParameter(items, request, "pf_icq")) +
@@ -667,7 +820,7 @@
               }
               if ($_formTab == 1)
               {
-                if ($_formSubtab == 0)
+                if ($_formTab2 == 0)
                 {
                   params +=
                        httpParam ("&", "businessIndustry"      , getParameter(items, request, "pf_businessIndustry")) +
@@ -683,7 +836,7 @@
                        httpParam ("&", "businessNetwork"       , getParameter(items, request, "pf_businessNetwork")) +
                        httpParam ("&", "businessResume"        , getParameter(items, request, "pf_businessResume"));
                 }
-                if ($_formSubtab == 1)
+                if ($_formTab2 == 1)
                 {
                   params +=
                        httpParam ("&", "businessCountry"       , getParameter(items, request, "pf_businesscountry")) +
@@ -699,7 +852,7 @@
                        httpParam ("&", "businessPhoneExt"      , getParameter(items, request, "pf_businessPhoneExt")) +
                        httpParam ("&", "businessMobile"        , getParameter(items, request, "pf_businessMobile"));
                 }
-                if ($_formSubtab == 3)
+                if ($_formTab2 == 3)
                 {
                   params +=
                        httpParam ("&", "businessIcq"          , getParameter(items, request, "pf_businessIcq")) +
@@ -723,40 +876,30 @@
               }
               if ($_formTab == 2)
               {
-                String securityNo = getParameter(items, request, "securityNo");
-                if (securityNo == null)
-                  securityNo = "";
-
-                if (securityNo.equals("1"))
-                  params +=
-                       httpParam ("&", "securityOpenID", getParameter(items, request, "pf_securityOpenID"));
-
-                if (securityNo.equals("2"))
-                  params +=
-                       httpParam ("&", "securityFacebookID", getParameter(items, request, "pf_securityFacebookID"));
-
-                if (securityNo.equals("3"))
-                  params +=
-                       "&securityFacebookID=";
-
-                if (securityNo.equals("4"))
+                if ($_formTab2 == 1)
                   params +=
                        httpParam ("&", "securitySecretQuestion", getParameter(items, request, "pf_securitySecretQuestion")) +
                        httpParam ("&", "securitySecretAnswer", getParameter(items, request, "pf_securitySecretAnswer"));
 
-                if (securityNo.equals("5"))
+                if ($_formTab2 == 2)
                   params +=
-                       httpParam ("&", "securitySiocLimit", getParameter(items, request, "pf_securitySiocLimit"));
+                       httpParam ("&", "securityOpenID", getParameter(items, request, "pf_securityOpenID"));
 
-                if (securityNo.equals("6"))
+                if ($_formTab2 == 3)
+                {
+                  if (getParameter(items, request, "pf_clear") != null)
+                  {
+                    params +=
+                         httpParam ("&", "securityFacebookID", "");
+                  } else {
                   params +=
-                       httpParam ("&", "certificate", getParameter(items, request, "pf_certificate")) +
-                       httpParam ("&", "certificateLogin", (getParameter(items, request, "pf_certificateLogin") != null)? getParameter(items, request, "pf_certificateLogin"): "0");
+                       httpParam ("&", "securityFacebookID", getParameter(items, request, "pf_securityFacebookID"));
+                  }
+                }
 
-                if (securityNo.equals("7"))
+                if ($_formTab2 == 4)
                   params +=
-                       "&certificate=&certificateLogin=0";
-
+                       httpParam ("&", "securitySiocLimit", getParameter(items, request, "pf_securitySiocLimit"));
               }
             $_retValue = httpRequest ("POST", "user.update.fields", params);
             if ($_retValue.indexOf("<failed>") == 0)
@@ -797,15 +940,17 @@
             }
             if (getParameter(items, request, "pf_next") != null)
             {
-              $_formSubtab += 1;
+              $_formTab2 += 1;
               if (
-                  (($_formTab == 1) && ($_formSubtab > 3)) ||
-                  ($_formTab > 1)
+                  (($_formTab == 1) && ($_formTab2 > 3)) ||
+                  (($_formTab == 2) && ($_formTab2 > 5))
                  )
               {
                 $_formTab += 1;
-                $_formSubtab = 0;
+                $_formTab2 = 0;
               }
+              if ($_formTab == 3)
+                $_formTab = 0;
             }
           }
           catch (Exception e)
@@ -826,7 +971,7 @@
         {
           $_form = "profile";
           $_formTab = 0;
-          $_formSubtab = 0;
+          $_formTab2 = 0;
         }
       }
 
@@ -836,8 +981,8 @@
         {
           params = httpParam ( "", "sid"   , $_sid) +
                    httpParam ("&", "realm" , $_realm);
-          if ($_form.equals("profile"))
-            params += httpParam ("&", "short", "0");
+          if ($_form.equals("user") && $_userName != null)
+            params += httpParam ("&", "name", $_userName);
           $_retValue = httpRequest ("POST", "user.info", params);
 		      $_document = createDocument($_retValue);
           if ("".compareTo(xpathEvaluate($_document, "/failed/message")) != 0)
@@ -878,13 +1023,14 @@
     }
   %>
   <body>
-    <form name="page_form" id="page_form" method="post" enctype="<% out.print(($_form.equals("profile") && ($_formTab == 0) && ($_formSubtab == 1))? "multipart/form-data": "application/x-www-form-urlencoded"); %>" action="users.jsp">
+    <form name="page_form" id="page_form" method="post" enctype="<% out.print(($_form.equals("profile") && ($_formTab == 0) && ($_formTab2 == 1))? "multipart/form-data": "application/x-www-form-urlencoded"); %>" action="users.jsp">
       <input type="hidden" name="mode" id="mode" value="jsp" />
       <input type="hidden" name="sid" id="sid" value="<% out.print($_sid); %>" />
       <input type="hidden" name="realm" id="realm" value="<% out.print($_realm); %>" />
       <input type="hidden" name="form" id="form" value="<% out.print($_form); %>" />
       <input type="hidden" name="formTab" id="formTab" value="<% out.print($_formTab); %>" />
-      <input type="hidden" name="formSubtab" id="formSubtab" value="<% out.print($_formSubtab); %>" />
+      <input type="hidden" name="formTab2" id="formTab2" value="<% out.print($_formTab2); %>" />
+      <input type="hidden" name="formTab3" id="formTab3" value="<% out.print($_formTab3); %>" />
       <input type="hidden" name="formMode" id="formMode" value="<% out.print($_formMode); %>" />
       <input type="hidden" name="items" id="items" value="" />
       <input type="hidden" name="securityNo" id="securityNo" value="" />
@@ -903,9 +1049,16 @@
         <%
           if (($_form != "login") && ($_form != "register"))
           {
+            if ($_validate)
+            {
         %>
           <a href="#" onclick="javascript: return logoutSubmit();">Logout</a>
         <%
+            } else {
+        %>
+          <a href="#" onclick="javascript: return logoutSubmit();">Login</a>
+        <%
+            }
           }
         %>
       </div>
@@ -929,13 +1082,15 @@
                   }
                 %>
                 <div class="header">
-                  User login
+                  Please identify yourself
                 </div>
                 <ul id="lf_tabs" class="tabs">
-                  <li id="lf_tab_0" title="ODS">ODS</li>
+                  <li id="lf_tab_0" title="Digest">Digest</li>
                   <li id="lf_tab_1" title="OpenID" style="display: none;">OpenID</li>
                   <li id="lf_tab_2" title="Facebook" style="display: none;">Facebook</li>
                   <li id="lf_tab_3" title="WebID" style="display: none;">WebID</li>
+                  <li id="lf_tab_4" title="Twitter" style="display: none;">Twitter</li>
+                  <li id="lf_tab_5" title="LinkedIn" style="display: none;">LinkedIn</li>
                 </ul>
                 <div style="min-height: 120px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                   <div id="lf_content"></div>
@@ -943,10 +1098,10 @@
                 <table class="form" cellspacing="5">
                   <tr>
                     <th width="30%">
-                      <label for="lf_uid">Member ID</label>
+                          <label for="lf_uid">User ID</label>
                     </th>
                         <td>
-                      <input type="text" name="lf_uid" value="" id="lf_uid" />
+                          <input type="text" name="lf_uid" value="" id="lf_uid" style="width: 150px;" />
                     </td>
                   </tr>
                   <tr>
@@ -954,7 +1109,7 @@
                       <label for="lf_password">Password</label>
                     </th>
                         <td>
-                      <input type="password" name="lf_password" value="" id="lf_password" />
+                          <input type="password" name="lf_password" value="" id="lf_password" style="width: 150px;" />
                     </td>
                   </tr>
                     </table>
@@ -966,7 +1121,7 @@
                           <label for="lf_openId">OpenID URL</label>
                     </th>
                         <td>
-                          <input type="text" name="lf_openId" value="" id="lf_openId" class="openId" size="40"/>
+                          <input type="text" name="lf_openId" value="" id="lf_openId" style="width: 300px;" />
                         </td>
                   </tr>
                     </table>
@@ -989,6 +1144,32 @@
                     <table id="lf_table_3" class="form" cellspacing="5">
                     </table>
                   </div>
+                  <div id="lf_page_4" class="tabContent" style="display: none">
+                    <table id="lf_table_4" class="form" cellspacing="5">
+                      <tr>
+                        <th width="30%">
+                        </th>
+                        <td>
+                          <span id="lf_twitter" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="lf_twitterButton" src="/ods/images/sign-in-with-twitter-d.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                  <div id="lf_page_5" class="tabContent" style="display: none;">
+                    <table id="lf_table_5" class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%">
+                        </th>
+                        <td>
+                          <span id="lf_linkedin" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="lf_linkedinButton" src="/ods/images/linkedin-large.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
                 </div>
                 <div class="footer">
                   <input type="submit" name="lf_login" value="Login" id="lf_login" onclick="javascript: return lfLoginSubmit();" />
@@ -1002,27 +1183,29 @@
               %>
               <div id="rf" class="form">
                 <div class="header">
-                  User register
+                  User Registration
                 </div>
                 <ul id="rf_tabs" class="tabs">
-                  <li id="rf_tab_0" title="ODS">ODS</li>
+                  <li id="rf_tab_0" title="Digest">Digest</li>
                   <li id="rf_tab_1" title="OpenID" style="display: none;">OpenID</li>
                   <li id="rf_tab_2" title="Facebook" style="display: none;">Facebook</li>
                   <li id="rf_tab_3" title="WebID" style="display: none;">WebID</li>
+                  <li id="rf_tab_4" title="Twitter" style="display: none;">Twitter</li>
+                  <li id="rf_tab_5" title="LinkedIn" style="display: none;">LinkedIn</li>
                 </ul>
                 <div style="min-height: 135px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                   <div id="rf_content"></div>
                   <div id="rf_page_0" class="tabContent" >
                     <table id="rf_table_0" class="form" cellspacing="5">
-                      <tr id="rf_login_1">
+                      <tr>
                         <th width="30%">
                           <label for="rf_uid">Login Name<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td>
-                          <input type="text" name="rf_uid" value="" id="rf_uid" />
+                          <input type="text" name="rf_uid" value="" id="rf_uid" style="width: 150px;" />
                         </td>
                       </tr>
-                      <tr id="rf_login_2">
+                      <tr>
                         <th>
                           <label for="rf_email">E-mail<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
@@ -1030,20 +1213,20 @@
                           <input type="text" name="rf_email" value="" id="rf_email" size="40"/>
                         </td>
                       </tr>
-                      <tr id="rf_login_3">
+                      <tr>
                         <th>
                           <label for="rf_password">Password<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td>
-                          <input type="password" name="rf_password" value="" id="rf_password" />
+                          <input type="password" name="rf_password" value="" id="rf_password" style="width: 150px;" />
                         </td>
                       </tr>
-                      <tr id="rf_login_4">
+                      <tr>
                         <th>
                           <label for="rf_password2">Password (verify)<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td>
-                          <input type="password" name="rf_password2" value="" id="rf_password2" />
+                          <input type="password" name="rf_password2" value="" id="rf_password2" style="width: 150px;" />
                         </td>
                       </tr>
                     </table>
@@ -1078,6 +1261,32 @@
                     <table id="rf_table_3" class="form" cellspacing="5">
                     </table>
                   </div>
+                  <div id="rf_page_4" class="tabContent" style="display: none">
+                    <table id="rf_table_4" class="form" cellspacing="5">
+                      <tr>
+                        <th width="30%">
+                        </th>
+                        <td>
+                          <span id="rf_twitter" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="rf_twitterButton" src="/ods/images/sign-in-with-twitter-d.png" border="0"/></a>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                  <div id="rf_page_5" class="tabContent" style="display: none;">
+                    <table id="rf_table_5" class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%">
+                        </th>
+                        <td>
+                          <span id="rf_linkedin" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="rf_linkedinButton" src="/ods/images/linkedin-large.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
                 </div>
                 <div>
                   <table class="form" cellspacing="5">
@@ -1103,131 +1312,14 @@
                 <div class="header">
                   User profile
                 </div>
-
                 <div id="uf_div_new" style="clear: both;">
                 </div>
-                <div id="uf_div" style="clear: both; display: none;">
-              	  <div id="u_profile_l">
-              	    <div id="user_info_w" class="widget user_info_w">
-              	      <div class="w_title" id="userProfilePhotoName">
-              	        <h3></h3>
-              	      </div>
-              	      <div class="w_content">
-                        <div class="user_img_ctr">
-                          <a href="javascript:void(0)">
-                       		  <img alt="Profile image" id="userProfilePhotoImg" rel="foaf:depiction" class="prof_photo" src="/ods/images/profile.png"/>
-                          </a>
-                        </div> <!-- user_img_ctr -->
-                        <div class="gems_ctr">
-                          <div class="prof_user_gems" id="profileUserGems">
-                            <div class="gem">
-                              <a href="javascript:void(0)" id="uf_foaf_gem" target="_blank"><img src="/ods/images/icons/foaf.png" alt="FOAF"/></a>
-                            </div>
-                            <div class="gem">
-                              <a href="javascript:void(0)" id="uf_sioc_gem" target="_blank"><img src="/ods/images/icons/sioc_button.png" alt="SIOC"/></a>
-                            </div>
-                            <div class="gem">
-                              <a href="javascript:void(0)" id="uf_vcard_gem" target="_blank"><img src="/ods/images/icons/vcard.png" alt="VCARD"/></a>
-                            </div>
-                          </div> <!-- prof_user_gems -->
-                        </div> <!-- gems_ctr -->
-                      </div> <!-- w_content -->
-          	        </div> <!-- .widget -->
-
-            	      <div id="ds_w" class="widget ds_w">
-            	        <div class="w_title">
-                        <h3>Data Space</h3>
-          		          <div class="w_title_bar_btns">
-                    		  <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                    		</div> <!-- w_title_bar_btns -->
-          	          </div> <!-- w_title -->
-            	        <div class="w_content">
-                        <ul class="ds_list" id="ds_list">
-                        </ul> <!-- ds_list -->
-                        <div class="cmd_ctr"> </div>
-                      </div> <!-- w_content -->
-                    </div> <!-- .widget -->
-
-              	    <div id="connections_w" class="widget connections_w">
-              	      <div class="w_title">
-                        <h3 id="connPTitleTxt">Connections</h3>
-                        <div class="w_title_bar_btns">
-                          <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                        </div> <!-- w_title_bar_btns -->
-              	      </div> <!-- w_title -->
-            	        <div class="w_content" id="connP1" style="height: 200px;">
-                      </div> <!-- w_content -->
-            	      </div> <!-- .widget -->
-
-                    <div id="groups_w" class="widget groups_w" style="display: none;">
-            	        <div class="w_title">
-            	          <h3 id="discussionsTitleTxt">Discussion Groups ()</h3>
-            	        </div>
-            	        <div class="w_content" id="discussionsCtr">
-                      </div> <!-- w_content -->
-            	      </div> <!-- .widget -->
-          	      </div>
-
-              	  <div id="u_profile_r" style="width: 100%;">
-                    <div class="widget w_contact" about="#THIS" instanceof="foaf:Person">
-                      <div class="w_title">
-                        <h3>Contact Information</h3>
-                        <div class="w_title_bar_btns">
-                    		  <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                    		</div>
-                      </div>
-                      <div class="w_content">
-                <ul id="uf_tabs" class="tabs">
-                  <li id="uf_tab_0" title="Personal">Personal</li>
-                  <li id="uf_tab_1" title="Messaging Services">Messaging Services</li>
-                  <li id="uf_tab_2" title="Home">Home</li>
-                  <li id="uf_tab_3" title="Business">Business</li>
-                  <li id="uf_tab_4" title="Data Explorer">Data Explorer</li>
-                </ul>
-                <div style="min-height: 180px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
-                  <div id="uf_content"></div>
-                  <div id="uf_page_0" class="tabContent" >
-                    <table id="uf_table_0" class="form" cellspacing="5">
-                    </table>
-                  </div>
-                          <div id="uf_page_1" class="tabContent" style="display: none">
-                    <table id="uf_table_1" class="form" cellspacing="5">
-                    </table>
-                  </div>
-                          <div id="uf_page_2" class="tabContent" style="display: none">
-                    <table id="uf_table_2" class="form" cellspacing="5">
-                    </table>
-                  </div>
-                          <div id="uf_page_3" class="tabContent" style="display: none">
-                    <table id="uf_table_3" class="form" cellspacing="5">
-                </table>
-                  </div>
-                          <div id="uf_page_4" class="tabContent" style="display: none">
-                    <div id="uf_rdf_content">
-                       
-                    </div>
-                  </div>
                   <script type="text/javascript">
-                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){selectProfile();});
-                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){cRDF.open("<% out.print(xpathEvaluate($_document, "/user/iri")); %>");});
+                  <%
+                    out.print(String.format("OAT.MSG.attach(OAT, 'PAGE_LOADED', function (){selectProfile('%s');});", $_userName));
+                  %>
                   </script>
                 </div>
-                      </div>
-                    </div>
-
-                    <div id="notify" class="notify_w widget">
-                      <div class="w_title">
-                        <h3>Activities</h3>
-                        <div class="w_title_bar_btns">
-                      	  <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                      	</div> <!-- w_title_bar_btns -->
-                      </div>
-                      <div class="w_content" id="notify_content">
-                      </div>
-                    </div>
-                  </div>
-                </div>
-              </div>
               <%
               }
               if ($_form.equals("profile"))
@@ -1249,20 +1341,24 @@
                   <li id="pf_tab_2" title="Security">Security</li>
                 </ul>
                 <div style="min-height: 180px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                  <%
+                  if ($_formTab == 0)
+                  {
+                  %>
                   <div id="pf_page_0" class="tabContent" style="display:none;">
                     <ul id="pf_tabs_0" class="tabs">
-                      <li id="pf_tab_0_0" title="Import">Profile Import</li>
-                      <li id="pf_tab_0_1" title="Main">Main</li>
-                      <li id="pf_tab_0_2" title="Address">Address</li>
-                      <li id="pf_tab_0_3" title="Online Accounts">Online Accounts</li>
-                      <li id="pf_tab_0_4" title="Messaging Services">Messaging Services</li>
-                      <li id="pf_tab_0_5" title="Biographical Events">Biographical Events</li>
-                      <li id="pf_tab_0_6" title="Favorite Things">Favorite Things</li>
-                      <li id="pf_tab_0_7" title="Creator Of">Creator Of</li>
-                      <li id="pf_tab_0_8" title="My Offers">My Offers</li>
-                      <li id="pf_tab_0_9" title="Offers I Seek">Offers I Seek</li>
+                      <li id="pf_tab_0_0">Profile Import</li>
+                      <li id="pf_tab_0_1">Main</li>
+                      <li id="pf_tab_0_2">Address</li>
+                      <li id="pf_tab_0_3">Online Accounts</li>
+                      <li id="pf_tab_0_4">Messaging Services</li>
+                      <li id="pf_tab_0_5">Others</li>
                     </ul>
-                    <div style="min-height: 180px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                    <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                      <%
+                      if ($_formTab2 == 0)
+                      {
+                      %>
                       <div id="pf_page_0_0" class="tabContent" style="display:none;">
                     <table class="form" cellspacing="5">
                       <tr>
@@ -1288,6 +1384,11 @@
                           </tbody>
                         </table>
                       </div>
+                      <%
+                      }
+                      if ($_formTab2 == 1)
+                      {
+                      %>
                       <div id="pf_page_0_1" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                           <tr>
@@ -1315,7 +1416,7 @@
                             <option></option>
                             <%
                               {
-                                String[] V = {"Mr", "Mrs", "Dr", "Ms"};
+                                    String[] V = {"Mr", "Mrs", "Dr", "Ms", "Sir"};
                                 String S = xpathEvaluate($_document, "/user/title");
                                 for (int N = 0; N < V.length; N++)
                                   out.print("<option" + ((V[N].equals(S)) ? (" selected=\"selected\""): ("")) + ">" + V[N] + "</option>");
@@ -1452,12 +1553,12 @@
                                       </thead>
                                       <tr id="x1_tr_no" style="display: none;"><td colspan="2"><b>No Personal URIs</b></td></tr>
                                       <script type="text/javascript">
-                                        OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowRows("x1", '<% out.print(xpathEvaluate($_document, "/user/webIDs").replace("\n", "\\n")); %>', ["\n"], function(prefix, val1){TBL.createRow(prefix, null, {fld_1: {value: val1, className: '_validate_ _url_ _canEmpty_'}});});});
+                                        OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowRows("x1", '<% out.print(xpathEvaluate($_document, "/user/webIDs").replace("\n", "\\n")); %>', ["\n"], function(prefix, val1){TBL.createRow(prefix, null, {fld_1: {value: val1, className: '_validate_ _webid_ _canEmpty_'}});});});
                                       </script>
                                     </table>
                                   </td>
                                   <td valign="top" nowrap="nowrap">
-                                    <span class="button pointer" onclick="TBL.createRow('x1', null, {fld_1: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                                    <span class="button pointer" onclick="TBL.createRow('x1', null, {fld_1: {className: '_validate_ _webid_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                                     <select name="pf_acl_webIDs" id="pf_acl_webIDs">
                                       <%
                                         {
@@ -1641,6 +1742,39 @@
                             </td>
                           </tr>
                           <tr>
+                            <td> </td>
+                            <td>
+                              <label>
+                                <%
+                                  out.print("<input type=\"checkbox\" id=\"pf_spbEnable\" name=\"pf_spbEnable\" value=\"1\" " + ("1".equals(xpathEvaluate($_document, "/user/spbEnable")) ? ("checked=\"checked\"") : ("")) + ">");
+                                %>
+                                <b>Enable Semantic Pingback for ACLs</b>
+                              </label>
+                            </td>
+                          </tr>
+                          <tr>
+                            <td> </td>
+                            <td>
+                             <label>
+                                <%
+                                  out.print("<input type=\"checkbox\" id=\"pf_inSearch\" name=\"pf_inSearch\" value=\"1\" " + ("1".equals(xpathEvaluate($_document, "/user/inSearch")) ? ("checked=\"checked\"") : ("")) + ">");
+                                %>
+                               <b>Include my profile in search results</b>
+                             </label>
+                            </td>
+                          </tr>
+                          <tr>
+                            <td> </td>
+                            <td>
+                             <label>
+                                <%
+                                  out.print("<input type=\"checkbox\" id=\"pf_showActive\" name=\"pf_showActive\" value=\"1\" " + ("1".equals(xpathEvaluate($_document, "/user/showActive")) ? ("checked=\"checked\"") : ("")) + ">");
+                                %>
+                               <b>Include in User active information</b>
+                             </label>
+                            </td>
+                          </tr>
+                          <tr>
                             <th>
                               <label for="pf_set_0_1">Set access for all fields as </label>
                             </th>
@@ -1648,14 +1782,18 @@
                               <select name="pf_set_0_1" id="pf_set_0_1" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
                           </tr>
                     </table>
                   </div>
-
+                      <%
+                      }
+                      if ($_formTab2 == 2)
+                      {
+                      %>
                       <div id="pf_page_0_2" class="tabContent" style="display:none;">
                     <table class="form" cellspacing="5">
                       <tr>
@@ -1785,7 +1923,7 @@
                               <input type="text" name="pf_homelng" value="<% out.print(xpathEvaluate($_document, "/user/homeLongitude")); %>" id="pf_homelng" style="width: 110px;" />
                               <label>
                                 <input type="checkbox" name="pf_homeDefaultMapLocation" id="pf_homeDefaultMapLocation" onclick="javascript: setDefaultMapLocation('home', 'business');" />
-                                Default Map Location
+                                Use as default map location
                               </label>
                         </td>
                       </tr>
@@ -1820,14 +1958,18 @@
                               <select name="pf_set_0_2" id="pf_set_0_2" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                         </td>
                       </tr>
                     </table>
                   </div>
-
+                      <%
+                      }
+                      if ($_formTab2 == 3)
+                      {
+                      %>
                       <div id="pf_page_0_3" class="tabContent" style="display:none;">
                         <input type="hidden" name="c_nick" value="<% out.print(xpathEvaluate($_document, "/user/nickName")); %>" id="c_nick" />
                     <table class="form" cellspacing="5">
@@ -1840,7 +1982,7 @@
                                       Select from Service List ot Type New One
                         </th>
                                     <th>
-                                      Member Home Page URL
+                                      Member Home Page URI
                                     </th>
                                     <th width="65px">
                                       Action
@@ -1849,17 +1991,21 @@
                                 </thead>
                                 <tr id="x4_tr_no" style="display: none;"><td colspan="3"><b>No Services</b></td></tr>
                                 <script type="text/javascript">
-                                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOnlineAccounts("x4", "P", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1, className: '_validate_ _url_ _canEmpty_'}, fld_2: {value: val2}});});});
+                                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOnlineAccounts("x4", "P", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1}, fld_2: {value: val2, className: '_validate_ _uri_ _canEmpty_'}});});});
                                 </script>
                               </table>
                             </td>
                             <td valign="top" nowrap="1">
-                              <span class="button pointer" onclick="TBL.createRow('x4', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                              <span class="button pointer" onclick="TBL.createRow('x4', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _uri_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                         </td>
                       </tr>
                         </table>
                       </div>
-
+                      <%
+                      }
+                      if ($_formTab2 == 4)
+                      {
+                      %>
                       <div id="pf_page_0_4" class="tabContent" style="display:none;">
                         <table id="x6_tbl" class="form" cellspacing="5">
                       <tr>
@@ -1943,7 +2089,7 @@
                               <select name="pf_set_0_4" id="pf_set_0_4" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
@@ -1953,8 +2099,28 @@
                           </script>
                         </table>
                       </div>
-
+                      <%
+                      }
+                      if ($_formTab2 == 5)
+                      {
+                      %>
                       <div id="pf_page_0_5" class="tabContent" style="display:none;">
+                        <ul id="pf_tabs_0_5" class="tabs">
+                          <li id="pf_tab_0_5_0">Biographical Events</li>
+                          <li id="pf_tab_0_5_1">Owns</li>
+                          <li id="pf_tab_0_5_2">Favorite Things</li>
+                          <li id="pf_tab_0_5_3">Creator Of</li>
+                          <li id="pf_tab_0_5_4">My Offers</li>
+                          <li id="pf_tab_0_5_5">Offers I Seek</li>
+                          <li id="pf_tab_0_5_6">Likes & DisLikes</li>
+                          <li id="pf_tab_0_5_7">Social Network</li>
+                        </ul>
+                        <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                          <%
+                          if ($_formTab3 == 0)
+                          {
+                          %>
+                          <div id="pf_page_0_5_0" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                           <tr>
                             <td width="600px">
@@ -1987,52 +2153,158 @@
                           </tr>
                         </table>
                       </div>
-
                       <%
-                      if ($_formTab == 0)
-                      {
-                        if ($_formSubtab == 6)
-                        {
-                      %>
-                      <div id="pf_page_0_6" class="tabContent" style="display:none;">
-                        <h3>Favorites</h3>
-                        <%
-                          if ($_formMode == "")
+                          }
+                          if ($_formTab3 == 1)
                           {
-                        %>
-                        <div id="pf06_list">
-                          <div style="padding: 0 0 0.5em 0;">
-                            <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add 'Fovorite'" alt="Add 'Fovorite'" src="/ods/images/icons/add_16.png"> Add</span>
-                          </div>
-                      	  <table id="pf06_tbl" class="listing">
-                                <thead>
-                                  <tr class="listing_header_row">
-                        		    <th>Label</th>
-                        		    <th>URI</th>
-                        		    <th width="1%" nowrap="nowrap">Action</th>
-                                  </tr>
+                          %>
+                          <div id="pf_page_0_5_1" class="tabContent" style="display:none;">
+                            <h3>Owns</h3>
+                            <%
+                              if ($_formMode == "")
+                              {
+                            %>
+                            <div id="pf051_list">
+                              <div style="padding: 0 0 0.5em 0;">
+                                <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Offer" alt="Add Offer" src="/ods/images/icons/add_16.png"> Add</span>
+                              </div>
+                          	  <table id="pf051_tbl" class="listing">
+                          	    <thead>
+                          	      <tr class="listing_header_row">
+                            		    <th width="50%">Name</th>
+                            		    <th width="50%">Description</th>
+                            		    <th width="1%" nowrap="nowrap">Action</th>
+                          	      </tr>
                                 </thead>
-                      	    <tbody id="pf06_tbody">
+                          	    <tbody id="pf051_tbody">
                                   <script type="text/javascript">
-                                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowFavorites();});
+                                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOwns();});
                                   </script>
-                                </tbody>
+                          	    </tbody>
                               </table>
-                        </div>
-                        <%
-                          }
-                          else
-                          {
-                            out.print("<input type=\"hidden\" id=\"pf06_id\" name=\"pf06_id\" value=\"" + ((getParameter(items, request, "pf06_id") != null) ? getParameter(items, request, "pf06_id"): "0") + "\" />");
-                        %>
-                        <div id="pf06_form">
-                          <table class="form" cellspacing="5">
-                            <tr>
-                              <th width="25%">
+                            </div>
+                            <%
+                              }
+                              else
+                      {
+                                out.print("<input type=\"hidden\" id=\"pf051_id\" name=\"pf051_id\" value=\"" + ((getParameter(items, request, "pf051_id") != null) ? getParameter(items, request, "pf051_id"): "0") + "\" />");
+                            %>
+                            <div id="pf051_form">
+                              <table class="form" cellspacing="5">
+                      				  <tr>
+                                  <th width="25%">
+                      		          Access
+                      		        </th>
+                      		        <td>
+                                    <select name="pf051_flag" id="pf051_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Name (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf051_name" id="pf051_name" value="" class="_validate_" style="width: 400px;">
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Comment
+                                  </th>
+                                  <td>
+                                    <textarea name="pf051_comment" id="pf051_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                                  </td>
+                                </tr>
+                      				  <tr>
+                      				    <th valign="top">
+                      		          Products
+                      		        </th>
+                      		        <td width="800px">
+                                    <table id="ow_tbl" class="listing">
+                                      <tbody id="ow_tbody">
+                                        <tr id="ow_throbber">
+                                          <td>
+                                            <img src="/ods/images/oat/Ajax_throbber.gif" />
+                                          </td>
+                                        </tr>
+                                      </tbody>
+                                    </table>
+                                    <input type="hidden" id="ow_no" name="ow_no" value="1" />
+                                  </td>
+                                </tr>
+                              </table>
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOwn();});
+                              </script>
+                              <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                                <input type="submit" name="pf_update051" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf051');"/>
+                              </div>
+                            </div>
+                            <%
+                              }
+                            %>
+                          </div>
+                          <%
+                          }
+                          if ($_formTab3 == 2)
+                        {
+                      %>
+                          <div id="pf_page_0_5_2" class="tabContent" style="display:none;">
+                        <h3>Favorites</h3>
+                        <%
+                          if ($_formMode == "")
+                          {
+                        %>
+                            <div id="pf052_list">
+                          <div style="padding: 0 0 0.5em 0;">
+                            <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add 'Favorite'" alt="Add 'Favorite'" src="/ods/images/icons/add_16.png"> Add</span>
+                          </div>
+                          	  <table id="pf052_tbl" class="listing">
+                                <thead>
+                                  <tr class="listing_header_row">
+                            		    <th width="50%">Label</th>
+                            		    <th width="50%">URI</th>
+                        		    <th width="1%" nowrap="nowrap">Action</th>
+                                  </tr>
+                                </thead>
+                          	    <tbody id="pf052_tbody">
+                                  <script type="text/javascript">
+                                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowFavorites();});
+                                  </script>
+                                </tbody>
+                              </table>
+                        </div>
+                        <%
+                          }
+                          else
+                          {
+                                out.print("<input type=\"hidden\" id=\"pf052_id\" name=\"pf052_id\" value=\"" + ((getParameter(items, request, "pf052_id") != null) ? getParameter(items, request, "pf052_id"): "0") + "\" />");
+                        %>
+                            <div id="pf052_form">
+                          <table class="form" cellspacing="5">
+                            <tr>
+                              <th width="25%">
+                      		          Access
+                      		        </th>
+                      		        <td>
+                                    <select name="pf052_flag" id="pf052_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
                                 Label (*)
                               </th>
                               <td>
-                                <input type="text" name="pf06_label" id="pf06_label" value="" class="_validate_" style="width: 400px;">
+                                    <input type="text" name="pf052_label" id="pf052_label" value="" class="_validate_" style="width: 400px;">
                             </td>
                             </tr>
                             <tr>
@@ -2040,7 +2312,7 @@
                                 External URI
                               </th>
                               <td>
-                                <input type="text" name="pf06_uri" id="pf06_uri" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
+                                    <input type="text" name="pf052_uri" id="pf052_uri" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -2060,7 +2332,7 @@
                           </script>
                           <div class="footer">
                             <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false; "/>
-                            <input type="submit" name="pf_update06" value="Save" onclick="myBeforeSubmit(); return validateInputs(this);"/>
+                                <input type="submit" name="pf_update052" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf052');"/>
                           </div>
                       </div>
                       <%
@@ -2069,20 +2341,20 @@
                       </div>
                       <%
                         }
-                        else if ($_formSubtab == 7)
+                          if ($_formTab3 == 3)
                         {
                       %>
-                      <div id="pf_page_0_7" class="tabContent" style="display:none;">
+                          <div id="pf_page_0_5_3" class="tabContent" style="display:none;">
                         <h3>Creator Of</h3>
                         <%
                           if ($_formMode == "")
                           {
                         %>
-                        <div id="pf07_list">
+                            <div id="pf053_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Creator Of" alt="Add Creator Of" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf07_tbl" class="listing">
+                          	  <table id="pf053_tbl" class="listing">
                       	    <thead>
                       	      <tr class="listing_header_row">
                         		    <th>Property</th>
@@ -2090,7 +2362,7 @@
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf07_tbody">
+                          	    <tbody id="pf053_tbody">
                               <script type="text/javascript">
                                 OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowMades();});
                               </script>
@@ -2101,9 +2373,9 @@
                           }
                           else
                           {
-                              out.print("<input type=\"hidden\" id=\"pf07_id\" name=\"pf07_id\" value=\"" + ((getParameter(items, request, "pf07_id") != null) ? getParameter(items, request, "pf07_id"): "0") + "\" />");
+                                out.print("<input type=\"hidden\" id=\"pf053_id\" name=\"pf053_id\" value=\"" + ((getParameter(items, request, "pf053_id") != null) ? getParameter(items, request, "pf053_id"): "0") + "\" />");
                         %>
-                        <div id="pf07_form">
+                            <div id="pf053_form">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
@@ -2114,7 +2386,7 @@
                                   function p_init ()
                                   {
                                     var fld = new OAT.Combolist([]);
-                                    fld.input.name = 'pf07_property';
+                                        fld.input.name = 'pf053_property';
                                     fld.input.id = fld.input.name;
                                     fld.input.style.width = "400px";
                                     $("if_opt").appendChild(fld.div);
@@ -2131,7 +2403,7 @@
                                 URI
                               </th>
                               <td>
-                                <input type="text" name="pf07_url" id="pf07_url" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
+                                    <input type="text" name="pf053_url" id="pf053_url" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -2139,7 +2411,7 @@
                                 Description (*)
                               </th>
                               <td>
-                                <textarea name="pf07_description" id="pf07_description" style="width: 400px;"></textarea>
+                                    <textarea name="pf053_description" id="pf053_description" style="width: 400px;"></textarea>
                               </td>
                             </tr>
                             <tr>
@@ -2154,7 +2426,7 @@
                           </script>
                           <div class="footer">
                             <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false; "/>
-                            <input type="submit" name="pf_update07" value="Save" onclick="needToConfirm = false; return validateInputs(this);"/>
+                                <input type="submit" name="pf_update053" value="Save" onclick="needToConfirm = false; return validateInputs(this, 'pf053');"/>
                           </div>
                         </div>
                         <%
@@ -2163,28 +2435,28 @@
                       </div>
                       <%
                         }
-                        else if ($_formSubtab == 8)
+                          if ($_formTab3 == 4)
                         {
                       %>
-                      <div id="pf_page_0_8" class="tabContent" style="display:none;">
+                          <div id="pf_page_0_5_4" class="tabContent" style="display:none;">
                         <h3>My Offers</h3>
                         <%
                           if ($_formMode == "")
                           {
                         %>
-                        <div id="pf08_list">
+                            <div id="pf054_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Offer" alt="Add Offer" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf08_tbl" class="listing">
+                          	  <table id="pf054_tbl" class="listing">
                       	    <thead>
                       	      <tr class="listing_header_row">
-                        		    <th>Name</th>
-                        		    <th>Description</th>
+                            		    <th width="50%">Name</th>
+                            		    <th width="50%">Description</th>
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf08_tbody">
+                          	    <tbody id="pf054_tbody">
                               <script type="text/javascript">
                                 OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOffers();});
                               </script>
@@ -2195,16 +2467,28 @@
                           }
                           else
                           {
-                            out.print("<input type=\"hidden\" id=\"pf08_id\" name=\"pf08_id\" value=\"" + ((getParameter(items, request, "pf08_id") != null) ? getParameter(items, request, "pf08_id"): "0") + "\" />");
+                                out.print("<input type=\"hidden\" id=\"pf054_id\" name=\"pf054_id\" value=\"" + ((getParameter(items, request, "pf054_id") != null) ? getParameter(items, request, "pf054_id"): "0") + "\" />");
                         %>
-                        <div id="pf08_form">
+                            <div id="pf054_form">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
-                                Name
+                      		          Access
+                      		        </th>
+                      		        <td>
+                                    <select name="pf054_flag" id="pf054_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Name (*)
                               </th>
                               <td>
-                                <input type="text" name="pf08_name" id="pf08_name" value="" class="_validate_" style="width: 400px;">
+                                    <input type="text" name="pf054_name" id="pf054_name" value="" class="_validate_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -2212,7 +2496,7 @@
                                 Comment
                               </th>
                               <td>
-                                <textarea name="pf08_comment" id="pf08_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                                    <textarea name="pf054_comment" id="pf054_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
                               </td>
                             </tr>
                   				  <tr>
@@ -2222,6 +2506,11 @@
                   		        <td width="800px">
                                 <table id="ol_tbl" class="listing">
                                   <tbody id="ol_tbody">
+                                    <tr id="ol_throbber">
+                                      <td>
+                                        <img src="/ods/images/oat/Ajax_throbber.gif" />
+                                      </td>
+                                    </tr>
                                   </tbody>
                                 </table>
                                 <input type="hidden" id="ol_no" name="ol_no" value="1" />
@@ -2233,7 +2522,7 @@
                           </script>
                           <div class="footer">
                             <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
-                            <input type="submit" name="pf_update08" value="Save" onclick="myBeforeSubmit(); return validateInputs(this);"/>
+                                <input type="submit" name="pf_update054" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf054');"/>
                           </div>
                         </div>
                         <%
@@ -2242,28 +2531,28 @@
                       </div>
                       <%
                         }
-                        else if ($_formSubtab == 9)
+                          if ($_formTab3 == 5)
                         {
                       %>
-                      <div id="pf_page_0_9" class="tabContent" style="display:none;">
+                          <div id="pf_page_0_5_5" class="tabContent" style="display:none;">
                         <h3>Offers I Seek</h3>
                         <%
                           if ($_formMode == "")
                           {
                         %>
-                        <div id="pf09_list">
+                            <div id="pf055_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Seek" alt="Add Seek" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf09_tbl" class="listing">
+                          	  <table id="pf055_tbl" class="listing">
                       	    <thead>
                       	      <tr class="listing_header_row">
-                        		    <th>Name</th>
-                        		    <th>Description</th>
+                            		    <th width="50%">Name</th>
+                            		    <th width="50%">Description</th>
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf09_tbody">
+                          	    <tbody id="pf055_tbody">
                               <script type="text/javascript">
                                 OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowSeeks();});
                               </script>
@@ -2274,16 +2563,28 @@
                           }
                           else
                           {
-                            out.print("<input type=\"hidden\" id=\"pf09_id\" name=\"pf09_id\" value=\"" + ((getParameter(items, request, "pf09_id") != null) ? getParameter(items, request, "pf09_id"): "0") + "\" />");
+                                out.print("<input type=\"hidden\" id=\"pf055_id\" name=\"pf055_id\" value=\"" + ((getParameter(items, request, "pf055_id") != null) ? getParameter(items, request, "pf055_id"): "0") + "\" />");
                         %>
-                        <div id="pf09_form">
+                            <div id="pf055_form">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
-                                Name
+                      		          Access
+                      		        </th>
+                      		        <td>
+                                    <select name="pf055_flag" id="pf055_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Name (*)
                               </th>
                               <td>
-                                <input type="text" name="pf09_name" id="pf09_name" value="" class="_validate_" style="width: 400px;">
+                                    <input type="text" name="pf055_name" id="pf055_name" value="" class="_validate_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -2291,7 +2592,7 @@
                                 Comment
                               </th>
                               <td>
-                                <textarea name="pf09_comment" id="pf09_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                                    <textarea name="pf055_comment" id="pf055_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
                               </td>
                             </tr>
                   				  <tr>
@@ -2301,6 +2602,11 @@
                   		        <td width="800px">
                                 <table id="wl_tbl" class="listing">
                                   <tbody id="wl_tbody">
+                                    <tr id="wl_throbber">
+                                      <td>
+                                        <img src="/ods/images/oat/Ajax_throbber.gif" />
+                                      </td>
+                                    </tr>
                                   </tbody>
                                 </table>
                                 <input type="hidden" id="wl_no" name="wl_no" value="1" />
@@ -2312,7 +2618,7 @@
                           </script>
                           <div class="footer">
                             <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
-                            <input type="submit" name="pf_update09" value="Save" onclick="myBeforeSubmit(); return validateInputs(this);"/>
+                                <input type="submit" name="pf_update055" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf055');"/>
                           </div>
                         </div>
                         <%
@@ -2321,21 +2627,278 @@
                       </div>
                       <%
                         }
+                          if ($_formTab3 == 6)
+                        {
+                      %>
+                          <div id="pf_page_0_5_6" class="tabContent" style="display:none;">
+                        <h3>Likes & DisLikes</h3>
+                        <%
+                          if ($_formMode == "")
+                          {
+                        %>
+                            <div id="pf056_list">
+                          <div style="padding: 0 0 0.5em 0;">
+                            <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Like" alt="Add Like" src="/ods/images/icons/add_16.png"> Add</span>
+                          </div>
+                          	  <table id="pf056_tbl" class="listing">
+                      	    <thead>
+                      	      <tr class="listing_header_row">
+                            		    <th width="10%">Type</th>
+                            		    <th width="45%">URI</th>
+                            		    <th width="45%">Name</th>
+                        		    <th width="1%" nowrap="nowrap">Action</th>
+                      	      </tr>
+                            </thead>
+                          	    <tbody id="pf056_tbody">
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowLikes();});
+                              </script>
+                      	    </tbody>
+                          </table>
+                        </div>
+                        <%
+                          }
+                          else
+                          {
+                                out.print("<input type=\"hidden\" id=\"pf056_id\" name=\"pf056_id\" value=\"" + ((getParameter(items, request, "pf056_id") != null) ? getParameter(items, request, "pf056_id"): "0") + "\" />");
+                        %>
+                            <div id="pf056_form">
+                          <table class="form" cellspacing="5">
+                            <tr>
+                              <th width="25%">
+                      		          Access
+                      		        </th>
+                      		        <td>
+                                    <select name="pf056_flag" id="pf056_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                Type
+                              </th>
+                              <td>
+                                    <select name="pf056_type" id="pf056_type">
+                                  <option value="L">Like</option>
+                                  <option value="DL">DisLike</option>
+                                </select>
+                              </td>
+                            </tr>
+                            <tr>
+                              <th>
+                                    URI (*)
+                              </th>
+                              <td>
+                                    <input type="text" name="pf056_uri" id="pf056_uri" value="" class="_validate_ _uri_" style="width: 400px;">
+                              </td>
+                            </tr>
+                            <tr>
+                              <th>
+                                    Name (*)
+                              </th>
+                              <td>
+                                    <input type="text" name="pf056_name" id="pf056_name" value="" class="_validate_" style="width: 400px;">
+                              </td>
+                            </tr>
+                            <tr>
+                              <th>
+                                Comment
+                              </th>
+                              <td>
+                                    <textarea name="pf056_comment" id="pf056_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                              </td>
+                            </tr>
+                  				  <tr>
+                  				    <th valign="top">
+                  		          Properties
+                  		        </th>
+                  		        <td width="800px">
+                                <table id="ld_tbl" class="listing">
+                                  <tbody id="ld_tbody">
+                                    <tr id="ld_throbber">
+                                      <td>
+                                        <img src="/ods/images/oat/Ajax_throbber.gif" />
+                                      </td>
+                                    </tr>
+                                  </tbody>
+                                </table>
+                                <input type="hidden" id="ld_no" name="ld_no" value="1" />
+                              </td>
+                            </tr>
+                          </table>
+                          <script type="text/javascript">
+                            OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowLike();});
+                          </script>
+                          <div class="footer">
+                            <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                                <input type="submit" name="pf_update056" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf056');"/>
+                              </div>
+                            </div>
+                            <%
+                              }
+                            %>
+                          </div>
+                          <%
+                          }
+                          if ($_formTab3 == 7)
+                          {
+                          %>
+                          <div id="pf_page_0_5_7" class="tabContent" style="display:none;">
+                            <h3>Knows</h3>
+                            <%
+                              if ($_formMode.equals(""))
+                              {
+                            %>
+                            <div id="pf057_list">
+                              <div style="padding: 0 0 0.5em 0;">
+                                <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Knows" alt="Add Knows" src="/ods/images/icons/add_16.png"> Add</span>
+                                <span onclick="javascript: $('formMode').value = 'import'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Import Knows" alt="Import Knows" src="/ods/images/icons/add_16.png"> Import</span>
+                              </div>
+                          	  <table id="pf057_tbl" class="listing">
+                          	    <thead>
+                          	      <tr class="listing_header_row">
+                            		    <th width="50%">Label</th>
+                            		    <th width="50%">URI</th>
+                            		    <th width="1%" nowrap="nowrap">Action</th>
+                          	      </tr>
+                                </thead>
+                          	    <tbody id="pf057_tbody">
+                                  <script type="text/javascript">
+                                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowKnows();});
+                                  </script>
+                          	    </tbody>
+                              </table>
+                        </div>
+                        <%
+                          }
+                              else if ($_formMode.equals("import"))
+                              {
+                        %>
+                            <div id="pf057_import">
+                              <table>
+                      				  <tr>
+                      				    <th width="100px">
+                      		          Source
+                      		        </th>
+                                  <td>
+                                    <input type="text" class="_validate_ _uri_" size="100" value="" id="k_import" name="k_import">
+                                    <input type="button" class="button" onclick="javascript: knowsData(); return false;" value="Download">
+                                    <img style="display: none;" src="/ods/images/oat/Ajax_throbber.gif" alt="Import knows URIs" id="k_import_image">
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                  </th><td>
+                                    <table class="listing" id="k_tbl">
+                                      <thead>
+                                        <tr class="listing_header_row">
+                                          <th>
+                                            Access
+                                          </th>
+                                          <th width="50%">
+                                            URI
+                                          </th>
+                                          <th width="50%">
+                                            Label
+                                          </th>
+                                          <th width="65px">
+                                            Action
+                                          </th>
+                                        </tr>
+                                      </thead>
+                                      <tbody>
+                                        <tr id="k_tr_no">
+                                           <td colspan="3">
+                                             <b>No downloaded items</b>
+                                           </td>
+                                        </tr>
+                                      </tbody>
+                                    </table>
+                                  </td>
+                                </tr>
+                              </table>
+                              <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                                <input type="submit" name="pf_update057" value="Import" onclick="myBeforeSubmit(); return true;"/>
+                              </div>
+                      </div>
+                      <%
+                        }
                         else
                         {
+                                out.print("<input type=\"hidden\" id=\"pf057_id\" name=\"pf057_id\" value=\"" + ((getParameter(items, request, "pf057_id") != null) ? getParameter(items, request, "pf057_id"): "0") + "\" />");
+                            %>
+                            <div id="pf057_form">
+                              <table class="form" cellspacing="5">
+                      				  <tr>
+                                  <th width="25%">
+                      		          Access
+                      		        </th>
+                      		        <td>
+                                    <select name="pf057_flag" id="pf057_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    URI (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf057_uri" id="pf057_uri" value="" class="_validate_ _uri_" style="width: 400px;">
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Label (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf057_label" id="pf057_label" value="" class="_validate_" style="width: 400px;">
+                                  </td>
+                                </tr>
+                              </table>
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowKnow();});
+                              </script>
+                              <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                                <input type="submit" name="pf_update057" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf057');"/>
+                              </div>
+                            </div>
+                            <%
+                              }
+                            %>
+                          </div>
+                          <%
+                          }
+                          %>
+                        </div>
+                      </div>
+                      <%
+                      }
+                      if ($_formTab2 < 5)
+                      {
                       %>
                       <div class="footer">
                         <input type="submit" name="pf_cancel" value="Cancel" onclick="needToConfirm = false;"/>
-                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit ();"/>
-                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit ();"/>
+                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
                       </div>
                       <%
                         }
-                      }
                       %>
                     </div>
                   </div>
-
+                  <%
+                  }
+                  if ($_formTab == 1)
+                  {
+                  %>
                   <div id="pf_page_1" class="tabContent" style="display:none;">
                     <ul id="pf_tabs_1" class="tabs">
                       <li id="pf_tab_1_0" title="Main">Main</li>
@@ -2343,7 +2906,11 @@
                       <li id="pf_tab_1_2" title="Online Accounts">Online Accounts</li>
                       <li id="pf_tab_1_3" title="Messaging Services">Messaging Services</li>
                     </ul>
-                    <div style="min-height: 180px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                    <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                      <%
+                      if ($_formTab2 == 0)
+                      {
+                      %>
                       <div id="pf_page_1_0" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                       <tr>
@@ -2550,14 +3117,18 @@
                               <select name="pf_set_1_0" id="pf_set_1_0" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                         </td>
                       </tr>
                         </table>
                       </div>
-
+                      <%
+                      }
+                      if ($_formTab2 == 1)
+                      {
+                      %>
                       <div id="pf_page_1_1" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                           <tr>
@@ -2687,7 +3258,7 @@
                               <input type="text" name="pf_businesslng" value="<% out.print(xpathEvaluate($_document, "/user/businessLongitude")); %>" id="pf_businesslng" style="width: 110px;" />
                               <label>
                                 <input type="checkbox" name="pf_businessDefaultMapLocation" id="pf_businessDefaultMapLocation" onclick="javascript: setDefaultMapLocation('business', 'business');" />
-                                Default Map Location
+                                Use as default map location
                               </label>
                             </td>
                           </tr>
@@ -2722,13 +3293,18 @@
                               <select name="pf_set_1_1" id="pf_set_1_1" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
                           </tr>
                         </table>
                       </div>
+                      <%
+                      }
+                      if ($_formTab2 == 2)
+                      {
+                      %>
                       <div id="pf_page_1_2" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                           <tr>
@@ -2740,7 +3316,7 @@
                                       Select from Service List ot Type New One
                                     </th>
                                     <th>
-                                      Member Home Page URL
+                                      Member Home Page URI
                                     </th>
                                     <th width="65px">
                                       Action
@@ -2749,17 +3325,21 @@
                                 </thead>
                                 <tr id="y1_tr_no" style="display: none;"><td colspan="3"><b>No Services</b></td></tr>
                                 <script type="text/javascript">
-                                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOnlineAccounts("y1", "B", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1, className: '_validate_ _url_ _canEmpty_'}, fld_2: {value: val2}});});});
+                                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOnlineAccounts("y1", "B", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1}, fld_2: {value: val2, className: '_validate_ _uri_ _canEmpty_'}});});});
                                 </script>
                               </table>
                             </td>
                             <td valign="top" nowrap="1">
-                              <span class="button pointer" onclick="TBL.createRow('y1', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                              <span class="button pointer" onclick="TBL.createRow('y1', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _uri_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                             </td>
                           </tr>
                         </table>
                       </div>
-
+                      <%
+                      }
+                      if ($_formTab2 == 3)
+                      {
+                      %>
                       <div id="pf_page_1_3" class="tabContent" style="display:none;">
                         <table id="y2_tbl" class="form" cellspacing="5">
                           <tr>
@@ -2843,7 +3423,7 @@
                               <select name="pf_set_1_3" id="pf_set_1_3" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
@@ -2853,27 +3433,49 @@
                           </script>
                     </table>
                   </div>
-
+                      <%
+                      }
+                      %>
                       <div class="footer">
                         <input type="submit" name="pf_cancel" value="Cancel" onclick="needToConfirm = false;"/>
-                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit ();"/>
-                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit ();"/>
+                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
                       </div>
                     </div>
                   </div>
-
+                  <%
+                  }
+                  if ($_formTab == 2)
+                  {
+                  %>
                   <div id="pf_page_2" class="tabContent" style="display:none;">
+                    <ul id="pf_tabs_2" class="tabs">
+                      <li id="pf_tab_2_0" title="Password">Password</li>
+                      <li id="pf_tab_2_1" title="Password Recovery">Password Recovery</li>
+                      <li id="pf_tab_2_2" title="OpenID">OpenID</li>
+                      <li id="pf_tab_2_3" title="Facebook" style="display:none;">Facebook</li>
+                      <li id="pf_tab_2_4" title="Limits">Limits</li>
+                      <li id="pf_tab_2_5" title="Certificate Generator" style="display:none;">Certificate Generator</li>
+                      <li id="pf_tab_2_6" title="X.509 Certificates">X.509 Certificates</li>
+                    </ul>
+                    <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                      <%
+                      if ($_formTab2 == 0)
+                      {
+                      %>
+                      <div id="pf_page_2_0" class="tabContent" style="display:none;">
+                        <h2>Change login password</h2>
+                        <p class="fm_expln">For your security, please use a password not found in a dictionary, consisting of both letters, and numbers or non-alphanumeric characters.</p>
                     <table class="form" cellspacing="5">
                       <tr>
                         <td align="center" colspan="2">
                           <span id="pf_change_txt"></span>
                         </td>
                       </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Password Settings
-                        </th>
-                      </tr>
+                          <%
+                          if (xpathEvaluate($_document, "/user/noPassword").equals("0"))
+                          {
+                          %>
                       <tr>
                         <th width="30%">
                           <label for="pf_oldPassword">Old Password</label>
@@ -2882,8 +3484,11 @@
                           <input type="password" name="pf_oldPassword" value="" id="pf_oldPassword" />
                         </td>
                       </tr>
+                          <%
+                          }
+                          %>
                       <tr>
-                        <th>
+                            <th width="30%">
                           <label for="pf_newPassword">New Password</label>
                         </th>
                         <td>
@@ -2901,65 +3506,18 @@
                       <tr>
                         <th>
                         </th>
-                        <td>
-                          <input type="button" name="pf_change" value="Change" onclick="javascript: return pfChangeSubmit();" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          OpenID
-                        </th>
-                      </tr>
-                      <tr>
-                        <th>
-                          <label for="pf_securityOpenID">OpenID URL</label>
-                        </th>
-                        <td>
-                          <input type="text" name="pf_securityOpenID" value="<% out.print(xpathEvaluate($_document, "/user/securityOpenID")); %>" id="pf_securityOpenID" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th>
-                        </th>
-                        <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '1'; needToConfirm = false;" />
-                        </td>
-                      </tr>
-                      <tr id="pf_facebook" style="display:none;">
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Facebook
-                        </th>
-                      </tr>
-                      <tr id="pf_facebook1" style="display:none;">
-                        <th>
-                          Saved Facebook ID
-                        </th>
-                        <td>
-                        </td>
-                      </tr>
-                      <tr id="pf_facebook2" style="display:none;">
-                        <th>
-                        </th>
-                        <td>
-                          <span id="pf_facebookData" style="min-height: 20px;"></span>
-                          <br />
-                          <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
-                          <fb:login-button autologoutlink="true"></fb:login-button>
-                        </td>
-                      </tr>
-                      <tr id="pf_facebook3" style="display:none;">
-                        <th>
-                        </th>
-                        <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '2'; needToConfirm = false;"/>
-                          <input type="submit" name="pf_update" value="Clear" onclick="$('securityNo').value = '3'; needToConfirm = false;" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Password Recovery
-                        </th>
                       </tr>
+                        </table>
+                      </div>
+                      <%
+                      }
+                      if ($_formTab2 == 1)
+                      {
+                      %>
+                      <div id="pf_page_2_1" class="tabContent" style="display:none;">
+                        <h2>Password recovery questions</h2>
+                        <p class="fm_expln">Manage password recovery procedure. Set verification question / answer.</p>
+                        <table class="form" cellspacing="5">
                       <tr>
                         <th>
                           <label for="pf_securitySecretQuestion">Secret Question</label>
@@ -2991,40 +3549,128 @@
                           <input type="text" name="pf_securitySecretAnswer" value="<% out.print(xpathEvaluate($_document, "/user/securitySecretAnswer")); %>" id="pf_securitySecretAnswer" style="width: 220px;" />
                         </td>
                       </tr>
+                        </table>
+                      </div>
+                      <%
+                      }
+                      if ($_formTab2 == 2)
+                      {
+                      %>
+                      <div id="pf_page_2_2" class="tabContent" style="display:none;">
+                        <table class="form" cellspacing="5">
                       <tr>
                         <th>
+                              <label for="pf_openID">OpenID URL</label>
                         </th>
                         <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '4'; needToConfirm = false;" />
+                              <input type="text" name="pf_openID" value="<% out.print(xpathEvaluate($_document, "/user/securityOpenID")); %>" id="pf_openID" style="width: 220px;" />
                         </td>
                       </tr>
+                        </table>
+                      </div>
+                      <%
+                      }
+                      if ($_formTab2 == 3)
+                      {
+                      %>
+                      <div id="pf_page_2_3" class="tabContent" style="display:none;">
+                        <table class="form" cellspacing="5">
                       <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Applications restrictions
-                        </th>
-                      </tr>
-                      <tr>
-                        <th>
-                          <label for="pf_securitySiocLimit">SIOC Query Result Limit  </label>
+                            <th>
+                              Saved Facebook ID
                         </th>
-                        <td>
-                          <input type="text" name="pf_securitySiocLimit" value="<% out.print(xpathEvaluate($_document, "/user/securitySiocLimit")); %>" id="pf_securitySiocLimit" />
-                        </td>
+                            <td>
+                              <%
+                                if ((xpathEvaluate($_document, "/user/securityFacebookID") != null) && (xpathEvaluate($_document, "/user/securityFacebookID") != ""))
+                                {
+                                  out.print(xpathEvaluate($_document, "/user/securityFacebookName"));
+                                } else {
+                                  out.print("not yet");
+                                }
+                              %>
+                            </td>
                       </tr>
                       <tr>
                         <th>
                         </th>
                         <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '5'; needToConfirm = false;" />
+                              <span id="pf_facebookData" style="min-height: 20px;"></span>
+                              <br />
+                              <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
+                              <fb:login-button autologoutlink="true"></fb:login-button>
                         </td>
                       </tr>
+                        </table>
+                      </div>
+                      <%
+                      }
+                      if ($_formTab2 == 4)
+                      {
+                      %>
+                      <div id="pf_page_2_4" class="tabContent" style="display:none;">
+                        <table class="form" cellspacing="5">
                       <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          X.509 Certificate
+                            <th>
+                              <label for="pf_securitySiocLimit">SIOC Query Result Limit</label>
                         </th>
+                            <td>
+                              <input type="text" name="pf_securitySiocLimit" value="<% out.print(xpathEvaluate($_document, "/user/securitySiocLimit")); %>" id="pf_securitySiocLimit" />
+                            </td>
                       </tr>
+                        </table>
+                      </div>
+                      <%
+                      }
+                      if ($_formTab2 == 5)
+                      {
+                      %>
+                      <div id="pf_page_2_5" class="tabContent" style="display:none;">
+            	          <iframe id="cert" src="/ods/cert.vsp?sid=<% out.print($_sid); %>" width="650" height="270" frameborder="0" scrolling="no">
+            	            <p>Your browser does not support iframes.</p>
+            	          </iframe>
+                      </div>
+                      <%
+                      }
+                      if ($_formTab2 == 6)
+                      {
+                      %>
+                      <div id="pf_page_2_6" class="tabContent" style="display:none;">
+                        <h3>X.509 Certificates</h3>
               	      <%
-              	        if (xpathEvaluate($_document, "/user/certificateSubject").length() != 0)
+                          if ($_formMode == "")
+                          {
+                        %>
+                        <div id="pf26_list">
+                          <div style="padding: 0 0 0.5em 0;">
+                            <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add 'Fovorite'" alt="Add 'Fovorite'" src="/ods/images/icons/add_16.png"> Add</span>
+                          </div>
+                      	  <table id="pf26_tbl" class="listing">
+                      	    <thead>
+                      	      <tr class="listing_header_row">
+                        		    <th>Subject</th>
+                          		  <th>Created</th>
+                          		  <th>Fingerprint</th>
+                          		  <th>Login enabled</th>
+                        		    <th width="1%" nowrap="nowrap">Action</th>
+                      	      </tr>
+                            </thead>
+                      	    <tbody id="pf26_tbody">
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowCertificates();});
+                              </script>
+                      	    </tbody>
+                          </table>
+                        </div>
+                        <%
+                          }
+                          else
+                          {
+                            out.print("<input type=\"hidden\" id=\"pf26_id\" name=\"pf26_id\" value=\"" + ((getParameter(items, request, "pf26_id") != null) ? getParameter(items, request, "pf26_id"): "0") + "\" />");
+                        %>
+                        <div id="pf26_form">
+                          <table class="form" cellspacing="5">
+                            <%
+                            if ($_formMode.equals("edit"))
               	        {
               	      %>
                       <tr>
@@ -3032,7 +3678,7 @@
                 	    	  Subject
                         </th>
                         <td>
-                    		  <% out.print(xpathEvaluate($_document, "/user/certificateSubject")); %>
+                          		  <span id="pf26_subject"></span>
                     		</td>
                       </tr>
                       <tr>
@@ -3040,7 +3686,15 @@
                 	    	  Agent ID
                         </th>
                         <td>
-                    		  <% out.print(xpathEvaluate($_document, "/user/certificateAgentID")); %>
+                          		  <span id="pf26_agentID"></span>
+                          		</td>
+                            </tr>
+                            <tr>
+                              <th>
+                      	    	  Fingerprint
+                              </th>
+                              <td>
+                          		  <span id="pf26_fingerPrint"></span>
                     		</td>
                       </tr>
             	        <%
@@ -3048,45 +3702,60 @@
             	        %>
                       <tr>
                         <th valign="top">
-                          <label for="pf_certificate">Certificate</label>
+                                <label for="pf26_certificate">Certificate</label>
                         </th>
                         <td>
-                          <textarea name="pf_certificate" id="pf_certificate" rows="20" style="width: 540px;"><% out.print(xpathEvaluate($_document, "/user/certificate")); %></textarea>
-              	          <%
-              	            if (xpathEvaluate($_document, "/user/certificateSubject").length() == 0)
-              	            {
-              	          %>
-                	          <iframe id="cert" src="/ods/cert.vsp?sid=<% out.print($_sid); %>" width="200" height="200" frameborder="0" scrolling="no">
-                	            <p>Your browser does not support iframes.</p>
-                	          </iframe>
-              	          <%
-              	            }
-              	          %>
+                                <textarea name="pf26_certificate" id="pf26_certificate" rows="20" style="width: 560px;"></textarea>
                         </td>
                       </tr>
                       <tr>
                         <th></th>
                         <td>
                           <label>
-                            <% out.print("<input type=\"checkbox\" name=\"pf_certificateLogin\" id=\"pf_certificateLogin\" value=\"1\"" + ((xpathEvaluate($_document, "/user/certificateLogin").equals("1"))? " checked=\"checked\"": "") + " />"); %>
+                                  <input type="checkbox" name="pf26_enableLogin" id="pf26_enableLogin" value="1"/>
                             Enable Automatic WebID Login
                           </label>
                         </td>
                       </tr>
-                      <tr>
-                        <th>
-                        </th>
-                        <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '6'; needToConfirm = false;" />
-                          <input type="submit" name="pf_update" value="Remove" onclick="$('securityNo').value = '7'; needToConfirm = false;" />
-                          <input type="submit" name="pf_update" value="Refresh" onclick="$('securityNo').value = '99'; needToConfirm = false;" />
-                        </td>
-                      </tr>
                     </table>
+                          <script type="text/javascript">
+                            OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowCertificate();});
+                          </script>
+                          <div class="footer">
+                            <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                            <input type="submit" name="pf_update26" value="Save" onclick="needToConfirm = false; return validateInputs(this, 'pf26');"/>
+                          </div>
+                        </div>
+                        <%
+                          }
+                        %>
+                      </div>
+                      <%
+                        }
+                      if ($_formTab2 < 5)
+                        {
+                      %>
                     <div class="footer">
                       <input type="submit" name="pf_cancel" value="Cancel" onclick="needToConfirm = false;"/>
+                        <%
+                        if (($_formTab2 == 3) && (xpathEvaluate($_document, "/user/securityFacebookID") != null))
+                          {
+                        %>
+                        <input type="submit" name="pf_clear" value="Clear" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                        <%
+                          }
+                        %>
+                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                      </div>
+                      <%
+                        }
+                      %>
                   </div>
                 </div>
+                  <%
+                  }
+                  %>
                 </div>
               </div>
               <%
@@ -3104,7 +3773,7 @@
       <div id="FT_R">
         <a href="/ods/faq.html">FAQ</a> | <a href="/ods/privacy.html">Privacy</a> | <a href="/ods/rabuse.vspx">Report Abuse</a>
         <div>
-          Copyright © 1999-2010 OpenLink Software
+          Copyright © 1999-2011 OpenLink Software
         </div>
       </div>
      </div>
diff --git a/appsrc/ODS-Framework/users/users.php b/appsrc/ODS-Framework/users/users.php
index ef3638e..00e1c09 100644
--- a/appsrc/ODS-Framework/users/users.php
+++ b/appsrc/ODS-Framework/users/users.php
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
  -
- -  $Id: users.php,v 1.6.2.23 2010/06/30 14:31:04 source Exp $
+ -  $Id: users.php,v 1.6.2.40 2011/03/26 14:22:26 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -36,16 +36,13 @@
     <script type="text/javascript" src="/ods/common.js"></script>
     <script type="text/javascript" src="/ods/typeahead.js"></script>
     <script type="text/javascript" src="/ods/tbl.js"></script>
+    <script type="text/javascript" src="/ods/validate.js"></script>
     <script type="text/javascript">
       // OAT
       var toolkitPath="/ods/oat";
-      var featureList = ["ajax", "json", "tab", "combolist", "calendar", "crypto", "rdfmini", "grid", "graphsvg", "tagcloud", "map", "timeline", "anchor"];
+      var featureList = ["ajax", "json", "tab", "combolist", "calendar", "rdfmini", "grid", "graphsvg", "tagcloud", "map", "timeline", "anchor"];
     </script>
     <script type="text/javascript" src="/ods/oat/loader.js"></script>
-    <script type="text/javascript">
-      OAT.MSG.attach(OAT, 'PAGE_LOADED', myInit);
-      window.onload = function(){OAT.MSG.send(OAT, 'PAGE_LOADED');};
-    </script>
   </head>
   <?php
     function parseUrl($url) {
@@ -162,19 +159,40 @@
 
     $_REQUEST = array_merge($_GET, $_POST);
     $_error = "";
+    $_validate = 0;
+    $_sid = (isset ($_REQUEST['sid'])) ? $_REQUEST['sid'] : "";
+    $_realm = "wa";
+    if ($_sid <> '')
+    {
+      $_url = sprintf("%s/user.validate?sid=%s&realm=%s", apiURL(), $_sid, $_realm);
+      $_result = file_get_contents($_url);
+      if (substr_count($_result, "<result>") <> 0)
+      {
+        $_validate = 1;
+      }
+    }
+    $_userName = (isset ($_REQUEST['userName'])) ? $_REQUEST['userName'] : "";
     if (isset ($_REQUEST['oid-form'])) {
       if ($_REQUEST['oid-form'] == 'lf')
         $_form = "login";
       if ($_REQUEST['oid-form'] == 'rf')
         $_form = "register";
     } else {
-    $_form = (isset ($_REQUEST['form'])) ? $_REQUEST['form'] : "login";
+      $_form = (isset ($_REQUEST['form'])) ? $_REQUEST['form'] : "";
+      if ($_form == "")
+      {
+        if ($_userName == "")
+        {
+          $_form = "login";
+        } else {
+          $_form = "user";
+        }
+      }
     }
     $_formTab = intval((isset ($_REQUEST['formTab'])) ? $_REQUEST['formTab'] : "0");
-    $_formSubtab = intval((isset ($_REQUEST['formSubtab'])) ? $_REQUEST['formSubtab'] : "0");
+    $_formTab2 = intval((isset ($_REQUEST['formTab2'])) ? $_REQUEST['formTab2'] : "0");
+    $_formTab3 = intval((isset ($_REQUEST['formTab3'])) ? $_REQUEST['formTab3'] : "0");
     $_formMode = (isset ($_REQUEST['formMode'])) ? $_REQUEST['formMode'] : "";
-    $_sid = $_REQUEST['sid'];
-    $_realm = "wa";
 
       if ($_form == "login")
       {
@@ -188,35 +206,60 @@
       {
           $_form = "profile";
         $_formTab = 0;
-        $_formSubtab = 0;
+        $_formTab2 = 0;
+        $_formTab3 = 0;
       }
       }
 
       if ($_form == "profile")
       {
-      if (isset ($_REQUEST['pf_update06']) && ($_REQUEST['pf_update06'] <> ""))
+      if (isset ($_REQUEST['pf_update051']) && ($_REQUEST['pf_update051'] <> ""))
+      {
+        $_url = sprintf (
+                          "%s/user.owns.%s?sid=%s&realm=%s&id=%s&flag=%s&name=%s&comment=%s&properties=%s",
+                          apiURL(),
+                          $_formMode,
+                          $_sid,
+                          $_realm,
+                          myUrlencode ($_REQUEST ["pf051_id"]),
+                          myUrlencode ($_REQUEST ["pf051_flag"]),
+                          myUrlencode ($_REQUEST ["pf051_name"]),
+                          myUrlencode ($_REQUEST ["pf051_comment"]),
+                          myUrlencode (str_replace ('\"', '"', $_REQUEST ["items"]))
+                        );
+        $_result = file_get_contents($_url);
+        if (substr_count($_result, "<failed>") <> 0)
+        {
+          $_xml = simplexml_load_string($_result);
+          $_error = $_xml->failed->message;
+          $_form = "login";
+        }
+        $_formMode = "";
+      }
+      else if (isset ($_REQUEST['pf_update052']) && ($_REQUEST['pf_update052'] <> ""))
       {
         $_url = sprintf (
-                          "%s/user.favorites.%s?sid=%s&realm=%s&id=%s&label=%s&uri=%s&properties=%s",
+                          "%s/user.favorites.%s?sid=%s&realm=%s&id=%s&flag=%s&label=%s&uri=%s&properties=%s",
                           apiURL(),
                           $_formMode,
                           $_sid,
                           $_realm,
-                          myUrlencode ($_REQUEST ["pf06_id"]),
-                          myUrlencode ($_REQUEST ["pf06_label"]),
-                          myUrlencode ($_REQUEST ["pf06_uri"]),
+                          myUrlencode ($_REQUEST ["pf052_id"]),
+                          myUrlencode ($_REQUEST ["pf052_flag"]),
+                          myUrlencode ($_REQUEST ["pf052_label"]),
+                          myUrlencode ($_REQUEST ["pf052_uri"]),
                           myUrlencode (str_replace ('\"', '"', $_REQUEST ["items"]))
                         );
         $_result = file_get_contents($_url);
         if (substr_count($_result, "<failed>") <> 0)
         {
           $_xml = simplexml_load_string($_result);
-          $_error = $_xml->failed->message;;
+          $_error = $_xml->failed->message;
           $_form = "login";
         }
         $_formMode = "";
       }
-      else if (isset ($_REQUEST['pf_update07']) && ($_REQUEST['pf_update07'] <> ""))
+      else if (isset ($_REQUEST['pf_update053']) && ($_REQUEST['pf_update053'] <> ""))
       {
         $_url = sprintf (
                           "%s/user.mades.%s?sid=%s&realm=%s&id=%s&property=%s&url=%s&description=%s",
@@ -224,60 +267,155 @@
                           $_formMode,
                           $_sid,
                           $_realm,
-                          myUrlencode ($_REQUEST ["pf07_id"]),
-                          myUrlencode ($_REQUEST ["pf07_property"]),
-                          myUrlencode ($_REQUEST ["pf07_url"]),
-                          myUrlencode ($_REQUEST ["pf07_description"])
+                          myUrlencode ($_REQUEST ["pf053_id"]),
+                          myUrlencode ($_REQUEST ["pf053_property"]),
+                          myUrlencode ($_REQUEST ["pf053_url"]),
+                          myUrlencode ($_REQUEST ["pf053_description"])
                         );
         $_result = file_get_contents($_url);
         if (substr_count($_result, "<failed>") <> 0)
         {
           $_xml = simplexml_load_string($_result);
-          $_error = $_xml->failed->message;;
+          $_error = $_xml->failed->message;
+          $_form = "login";
+        }
+        $_formMode = "";
+      }
+      else if (isset ($_REQUEST['pf_update054']) && ($_REQUEST['pf_update054'] <> ""))
+      {
+        $_url = sprintf (
+                          "%s/user.offers.%s?sid=%s&realm=%s&id=%s&flag=%s&name=%s&comment=%s&properties=%s",
+                          apiURL(),
+                          $_formMode,
+                          $_sid,
+                          $_realm,
+                          myUrlencode ($_REQUEST ["pf054_id"]),
+                          myUrlencode ($_REQUEST ["pf054_flag"]),
+                          myUrlencode ($_REQUEST ["pf054_name"]),
+                          myUrlencode ($_REQUEST ["pf054_comment"]),
+                          myUrlencode (str_replace ('\"', '"', $_REQUEST ["items"]))
+                        );
+        $_result = file_get_contents($_url);
+        if (substr_count($_result, "<failed>") <> 0)
+        {
+          $_xml = simplexml_load_string($_result);
+          $_error = $_xml->failed->message;
           $_form = "login";
         }
         $_formMode = "";
       }
-      else if (isset ($_REQUEST['pf_update08']) && ($_REQUEST['pf_update08'] <> ""))
+      else if (isset ($_REQUEST['pf_update055']) && ($_REQUEST['pf_update055'] <> ""))
       {
         $_url = sprintf (
-                          "%s/user.offers.%s?sid=%s&realm=%s&id=%s&name=%s&comment=%s&properties=%s",
+                          "%s/user.seeks.%s?sid=%s&realm=%s&id=%s&flag=%s&name=%s&comment=%s&properties=%s",
                           apiURL(),
                           $_formMode,
                           $_sid,
                           $_realm,
-                          myUrlencode ($_REQUEST ["pf08_id"]),
-                          myUrlencode ($_REQUEST ["pf08_name"]),
-                          myUrlencode ($_REQUEST ["pf08_comment"]),
+                          myUrlencode ($_REQUEST ["pf055_id"]),
+                          myUrlencode ($_REQUEST ["pf055_flag"]),
+                          myUrlencode ($_REQUEST ["pf055_name"]),
+                          myUrlencode ($_REQUEST ["pf055_comment"]),
                           myUrlencode (str_replace ('\"', '"', $_REQUEST ["items"]))
                         );
         $_result = file_get_contents($_url);
         if (substr_count($_result, "<failed>") <> 0)
         {
           $_xml = simplexml_load_string($_result);
-          $_error = $_xml->failed->message;;
+          $_error = $_xml->failed->message;
           $_form = "login";
         }
         $_formMode = "";
       }
-      else if (isset ($_REQUEST['pf_update09']) && ($_REQUEST['pf_update09'] <> ""))
+      else if (isset ($_REQUEST['pf_update056']) && ($_REQUEST['pf_update056'] <> ""))
       {
         $_url = sprintf (
-                          "%s/user.seeks.%s?sid=%s&realm=%s&id=%s&name=%s&comment=%s&properties=%s",
+                          "%s/user.likes.%s?sid=%s&realm=%s&id=%s&flag=%s&uri=%s&type=%s&name=%s&comment=%s&properties=%s",
                           apiURL(),
                           $_formMode,
                           $_sid,
                           $_realm,
-                          myUrlencode ($_REQUEST ["pf09_id"]),
-                          myUrlencode ($_REQUEST ["pf09_name"]),
-                          myUrlencode ($_REQUEST ["pf09_comment"]),
+                          myUrlencode ($_REQUEST ["pf056_id"]),
+                          myUrlencode ($_REQUEST ["pf056_flag"]),
+                          myUrlencode ($_REQUEST ["pf056_uri"]),
+                          myUrlencode ($_REQUEST ["pf056_type"]),
+                          myUrlencode ($_REQUEST ["pf056_name"]),
+                          myUrlencode ($_REQUEST ["pf056_comment"]),
                           myUrlencode (str_replace ('\"', '"', $_REQUEST ["items"]))
                         );
         $_result = file_get_contents($_url);
         if (substr_count($_result, "<failed>") <> 0)
         {
           $_xml = simplexml_load_string($_result);
-          $_error = $_xml->failed->message;;
+          $_error = $_xml->failed->message;
+          $_form = "login";
+        }
+        $_formMode = "";
+      }
+      else if (isset ($_REQUEST['pf_update057']) && ($_REQUEST['pf_update057'] <> ""))
+      {
+        $N = 0;
+        $items = array();
+        if ($_formMode == "import")
+        {
+          foreach($_REQUEST as $name => $value)
+          {
+            if (substr_count($name, "k_fld_1_") <> 0)
+            {
+              $_sufix = str_replace("k_fld_1_", "", $name);
+              $_flag = $value;
+              $_uri = $_REQUEST["k_fld_2_".$_sufix];
+              $_label = $_REQUEST["k_fld_3_".$_sufix];
+              $items[$N] = array("", $_flag, $_uri, $_label);
+              $N++;
+            }
+          }
+          $_formMode = "new";
+        } else {
+          $items[$N] = array($_REQUEST ["pf057_id"], $_REQUEST ["pf057_flag"], $_REQUEST ["pf057_uri"], $_REQUEST ["pf057_label"]);
+        }
+        foreach ($items as $item)
+        {
+          $_url = sprintf (
+                            "%s/user.knows.%s?sid=%s&realm=%s&id=%s&flag=%s&uri=%s&label=%s",
+                            apiURL(),
+                            $_formMode,
+                            $_sid,
+                            $_realm,
+                            myUrlencode ($item[0]),
+                            myUrlencode ($item[1]),
+                            myUrlencode ($item[2]),
+                            myUrlencode ($item[3])
+                          );
+          $_result = file_get_contents($_url);
+          if (substr_count($_result, "<failed>") <> 0)
+          {
+            $_xml = simplexml_load_string($_result);
+            $_error = $_xml->failed->message;
+            $_form = "login";
+
+            break;
+          }
+        }
+        $_formMode = "";
+      }
+      else if (isset ($_REQUEST['pf_update26']) && ($_REQUEST['pf_update26'] <> ""))
+      {
+        $_url = sprintf (
+                          "%s/user.certificates.%s?sid=%s&realm=%s&id=%s&certificate=%s&enableLogin=%s",
+                          apiURL(),
+                          $_formMode,
+                          $_sid,
+                          $_realm,
+                          myUrlencode ($_REQUEST ["pf26_id"]),
+                          myUrlencode ($_REQUEST ["pf26_certificate"]),
+                          myUrlencode ($_REQUEST ["pf26_enableLogin"])
+                        );
+        $_result = file_get_contents($_url);
+        if (substr_count($_result, "<failed>") <> 0)
+        {
+          $_xml = simplexml_load_string($_result);
+          $_error = $_xml->failed->message;
           $_form = "login";
         }
         $_formMode = "";
@@ -288,15 +426,16 @@
       }
       else if (
           (isset ($_REQUEST['pf_update']) && ($_REQUEST['pf_update'] <> "")) ||
-          (isset ($_REQUEST['pf_next']) && ($_REQUEST['pf_next'] <> ""))
+                (isset ($_REQUEST['pf_next']) && ($_REQUEST['pf_next'] <> ""))     ||
+                (isset ($_REQUEST['pf_clear']) && ($_REQUEST['pf_clear'] <> ""))
          )
       {
         $_formMode = "";
-        if ((($_formTab == 0) && ($_formSubtab == 3)) || (($_formTab == 1) && ($_formSubtab == 2)))
+        if ((($_formTab == 0) && ($_formTab2 == 3)) || (($_formTab == 1) && ($_formTab2 == 2)))
         {
           $_prefix = "x4";
           $_accountType = "P";
-          if (($_formTab == 1) && ($_formSubtab == 2))
+          if (($_formTab == 1) && ($_formTab2 == 2))
         {
             $_prefix = "y1";
             $_accountType = "B";
@@ -306,7 +445,7 @@
         if (substr_count($_result, "<failed>") <> 0)
           {
           $_xml = simplexml_load_string($_result);
-          $_error = $_xml->failed->message;;
+            $_error = $_xml->failed->message;
             $_form = "login";
           }
           foreach($_REQUEST as $name => $value)
@@ -323,13 +462,13 @@
               if (substr_count($_result, "<failed>") <> 0)
               {
                 $_xml = simplexml_load_string($_result);
-                $_error = $_xml->failed->message;;
+                $_error = $_xml->failed->message;
                 $_form = "login";
               }
             }
           }
         }
-        else if (($_formTab == 0) && ($_formSubtab == 5))
+        else if (($_formTab == 0) && ($_formTab2 == 5))
         {
           $_prefix = "x5";
           $_url = apiURL()."/user.bioEvents.delete?sid=".$_sid."&realm=".$_realm;
@@ -337,7 +476,7 @@
           if (substr_count($_result, "<failed>") <> 0)
           {
             $_xml = simplexml_load_string($_result);
-            $_error = $_xml->failed->message;;
+            $_error = $_xml->failed->message;
             $_form = "login";
           }
           foreach($_REQUEST as $name => $value)
@@ -354,19 +493,42 @@
               if (substr_count($_result, "<failed>") <> 0)
               {
                 $_xml = simplexml_load_string($_result);
-                $_error = $_xml->failed->message;;
+                $_error = $_xml->failed->message;
                 $_form = "login";
               }
             }
           }
         }
+        else if (($_formTab == 2) && ($_formTab2 == 0))
+        {
+          if ($_REQUEST ["pf_newPassword"] != $_REQUEST ["pf_newPassword2"])
+          {
+            $_error = 'Bad new password. Please retype!';
+          } else {
+            $_url = sprintf (
+                              "%s/user.password_change?sid=%s&realm=%s&old_password=%s&new_password=%s",
+                              apiURL(),
+                              $_sid,
+                              $_realm,
+                              myUrlencode ($_REQUEST ["pf_oldPassword"]),
+                              myUrlencode ($_REQUEST ["pf_newPassword"])
+                            );
+            $_result = file_get_contents($_url);
+            if (substr_count($_result, "<failed>") <> 0)
+            {
+              $_xml = simplexml_load_string($_result);
+              $_error = $_xml->failed->message;
+              $_form = "login";
+            }
+          }
+        }
         else
         {
           $_url = apiURL()."/user.update.fields";
           $_params = "sid=".$_sid."&realm=".$_realm;
           if ($_formTab == 0)
           {
-            if ($_formSubtab == 0)
+            if ($_formTab2 == 0)
             {
               // Import
               if ($_REQUEST['cb_item_i_name'] == '1')
@@ -420,7 +582,7 @@
               if ($_REQUEST['cb_item_i_onlineAccounts'] == '1')
                 $_params .= '&onlineAccounts=' . myUrlencode ($_REQUEST['i_onlineAccounts']);
             }
-            else if ($_formSubtab == 1)
+            else if ($_formTab2 == 1)
             {
               // Main
               $_params .=
@@ -436,6 +598,9 @@
                   "&mailSignature=".          myUrlencode ($_REQUEST['pf_mailSignature']).
                   "&summary=".                myUrlencode ($_REQUEST['pf_summary']).
                   "&appSetting=".             myUrlencode ($_REQUEST['pf_appSetting']).
+                  "&spbEnable=".              myUrlencode ($_REQUEST['pf_spbEnable']).
+                  "&inSearch=".               myUrlencode ($_REQUEST['pf_inSearch']).
+                  "&showActive=".             myUrlencode ($_REQUEST['pf_showActive']).
                   "&photo=".                  myUrlencode ($_REQUEST['pf_photo']).
                   "&audio=".                  myUrlencode ($_REQUEST['pf_audio']);
               if ($_FILES['pf_photoContent']['size'] > 0)
@@ -482,7 +647,7 @@
               }
               $_params .= "&topicInterests=" . myUrlencode ($_tmp);
             }
-            if ($_formSubtab == 2)
+            if ($_formTab2 == 2)
             {
               $_params .=
                   "&homeDefaultMapLocation=". myUrlencode ($_REQUEST['pf_homeDefaultMapLocation']).
@@ -499,7 +664,7 @@
                   "&homePhoneExt=".           myUrlencode ($_REQUEST['pf_homePhoneExt']).
                   "&homeMobile=".             myUrlencode ($_REQUEST['pf_homeMobile']);
             }
-            if ($_formSubtab == 4)
+            if ($_formTab2 == 4)
             {
               $_params .=
                   "&icq=".                    myUrlencode ($_REQUEST['pf_icq']).
@@ -521,7 +686,7 @@
           }
           if ($_formTab == 1)
           {
-            if ($_formSubtab == 0)
+            if ($_formTab2 == 0)
             {
               $_params .=
                   "&businessIndustry=".       myUrlencode ($_REQUEST['pf_businessIndustry']).
@@ -537,7 +702,7 @@
                   "&businessNetwork=".        myUrlencode ($_REQUEST['pf_businessNetwork']).
                   "&businessResume=".         myUrlencode ($_REQUEST['pf_businessResume']);
             }
-            if ($_formSubtab == 1)
+            if ($_formTab2 == 1)
             {
               $_params .=
                   "&businessCountry=".        myUrlencode ($_REQUEST['pf_businesscountry']).
@@ -553,7 +718,7 @@
                   "&businessPhoneExt=".       myUrlencode ($_REQUEST['pf_businessPhoneExt']).
                   "&businessMobile=".         myUrlencode ($_REQUEST['pf_businessMobile']);
             }
-            if ($_formSubtab == 3)
+            if ($_formTab2 == 3)
             {
               $_params .=
                   "&businessIcq=".            myUrlencode ($_REQUEST['pf_businessIcq']).
@@ -575,38 +740,36 @@
           }
           if ($_formTab == 2)
           {
-            if ($_REQUEST['securityNo'] == "1")
-              $_params .=
-                  "&securityOpenID=" . myUrlencode ($_REQUEST['pf_securityOpenID']);
-
-            if ($_REQUEST['securityNo'] == "2")
+            if ($_formTab2 == 1)
               $_params .=
-                  "&securityFacebookID=" . myUrlencode ($_REQUEST['pf_securityFacebookID']);
+                  "&securitySecretQuestion=" . myUrlencode ($_REQUEST['pf_securitySecretQuestion']).
+                  "&securitySecretAnswer=" . myUrlencode ($_REQUEST['pf_securitySecretAnswer']);
 
-            if ($_REQUEST['securityNo'] == "3")
+            if ($_formTab2 == 2)
               $_params .=
-                  "&securityFacebookID=";
+                  "&securityOpenID=" . myUrlencode ($_REQUEST['pf_securityOpenID']);
 
-            if ($_REQUEST['securityNo'] == "4")
+            if ($_formTab2 == 3)
+            {
+              if (isset ($_REQUEST['pf_clear']) && ($_REQUEST['pf_clear'] <> ""))
+              {
+                $_params .=
+                    "&securityFacebookID=";
+              } else {
               $_params .=
-                  "&securitySecretQuestion=" . myUrlencode ($_REQUEST['pf_securitySecretQuestion']).
-                  "&securitySecretAnswer=" . myUrlencode ($_REQUEST['pf_securitySecretAnswer']);
+                  "&securityFacebookID=" . myUrlencode ($_REQUEST['pf_securityFacebookID']);
+              }
+            }
 
-            if ($_REQUEST['securityNo'] == "5")
+            if ($_formTab2 == 4)
               $_params .=
                   "&securitySiocLimit=" . myUrlencode ($_REQUEST['pf_securitySiocLimit']);
-            if ($_REQUEST['securityNo'] == "6")
-              $_params .=
-                  "&certificate=" . myUrlencode ($_REQUEST['pf_certificate']) .
-                  "&certificateLogin=" . myUrlencode ((isset($_REQUEST['pf_certificateLogin']))? $_REQUEST['pf_certificateLogin']: "0");
-            if ($_REQUEST['securityNo'] == "7")
-              $_params .= "&certificate=&certificateLogin=";
           }
           $_result = postRequest($_url, $_params);
           if (substr_count($_result, "<failed>") <> 0)
           {
             $_xml = simplexml_load_string($_result);
-            $_error = $_xml->failed->message;;
+            $_error = $_xml->failed->message;
             $_form = "login";
           }
           $_url = apiURL()."/user.acl.update";
@@ -616,26 +779,28 @@
             if (substr_count($name, 'pf_acl_') <> 0)
               $_tmp = $_tmp . str_replace("pf_acl_", "", $name) . "=" . $value . '&';
           }
-          $_params = "sid=".$_sid."&realm=".$_realm."&acls=" . myUrlencode ($_tmp);;
+          $_params = "sid=".$_sid."&realm=".$_realm."&acls=" . myUrlencode ($_tmp);
           $_result = postRequest($_url, $_params);
           if (substr_count($_result, "<failed>") <> 0)
           {
             $_xml = simplexml_load_string($_result);
-            $_error = $_xml->failed->message;;
+            $_error = $_xml->failed->message;
             $_form = "login";
           }
         }
         if (isset ($_REQUEST['pf_next']) && ($_REQUEST['pf_next'] <> ""))
         {
-          $_formSubtab = $_formSubtab + 1;
+          $_formTab2 = $_formTab2 + 1;
           if (
-              (($_formTab == 1) && ($_formSubtab > 3)) ||
-              ($_formTab > 1)
+              (($_formTab == 1) && ($_formTab2 > 3)) ||
+              (($_formTab == 2) && ($_formTab2 > 6))
              )
           {
             $_formTab = $_formTab + 1;
-            $_formSubtab = 0;
+            $_formTab2 = 0;
           }
+          if ($_formTab == 3)
+            $_formTab = 0;
           }
       }
       else if (isset ($_REQUEST['pf_cancel']) && ($_REQUEST['pf_cancel'] <> ""))
@@ -647,8 +812,9 @@
     if (($_form == "user") || ($_form == "profile"))
         {
       $_url = sprintf ("%s/user.info?sid=%s&realm=%s", apiURL(), $_sid, $_realm);
-      if ($_form == "profile")
-        $_url .= "&short=0";
+      if (($_form == "user") && ($_userName <> ""))
+        $_url .= sprintf ("&name=%s", $_userName);
+
       $_result = getRequest ($_url);
       $_xml = simplexml_load_string($_result);
       if (substr_count($_result, "<failed>") <> 0)
@@ -671,7 +837,7 @@
         $_industries = selectList ('Industry', '');
         $_countries = selectList ('Country', '');
         }
-        $ACL = array ('public', '1', 'friends', '2', 'private', '3');
+        $ACL = array ('public', '1', 'acl', '2', 'private', '3');
       }
       }
 
@@ -688,7 +854,8 @@
       <input type="hidden" name="realm" id="realm" value="<?php print($_realm); ?>" />
       <input type="hidden" name="form" id="form" value="<?php print($_form); ?>" />
       <input type="hidden" name="formTab" id="formTab" value="<?php print($_formTab); ?>" />
-      <input type="hidden" name="formSubtab" id="formSubtab" value="<?php print($_formSubtab); ?>" />
+      <input type="hidden" name="formTab2" id="formTab2" value="<?php print($_formTab2); ?>" />
+      <input type="hidden" name="formTab3" id="formTab3" value="<?php print($_formTab3); ?>" />
       <input type="hidden" name="formMode" id="formMode" value="<?php print($_formMode); ?>" />
       <input type="hidden" name="items" id="items" value="" />
       <input type="hidden" name="securityNo" id="securityNo" value="" />
@@ -696,16 +863,26 @@
         <div id="ob_left">
           <?php
             if (($_form == "profile") || ($_form == "user"))
-              print sprintf ('<b>User</b>: %s, <b>Profile</b>: <a href="#" onclick="javascript: return profileSubmit();">Edit</a> / <a href="#" onclick="javascript: return userSubmit();">View</a>', $_xml->fullName);
+              print sprintf ('<b>User</b>: %s', $_xml->fullName);
+
+            if ($_validate == 1)
+              print sprintf (', <b>Profile</b>: <a href="#" onclick="javascript: return profileSubmit();">Edit</a> / <a href="#" onclick="javascript: return userSubmit();">View</a>');
           ?>
         </div>
         <div id="ob_right">
         <?php
           if (($_form <> 'login') && ($_form <> 'register'))
           {
+            if ($_validate == 1)
+            {
         ?>
           <a href="#" onclick="javascript: return logoutSubmit();">Logout</a> 
         <?php
+            } else {
+        ?>
+          <a href="#" onclick="javascript: return logoutSubmit();">Login</a> 
+        <?php
+            }
           }
         ?>
       </div>
@@ -729,13 +906,15 @@
                   }
                 ?>
                 <div class="header">
-                  User login
+                  Please identify yourself
                 </div>
                 <ul id="lf_tabs" class="tabs">
-                  <li id="lf_tab_0" title="ODS">ODS</li>
+                  <li id="lf_tab_0" title="Digest">Digest</li>
                   <li id="lf_tab_1" title="OpenID" style="display: none;">OpenID</li>
                   <li id="lf_tab_2" title="Facebook" style="display: none;">Facebook</li>
                   <li id="lf_tab_3" title="WebID" style="display: none;">WebID</li>
+                  <li id="lf_tab_4" title="Twitter" style="display: none;">Twitter</li>
+                  <li id="lf_tab_5" title="LinkedIn" style="display: none;">LinkedIn</li>
                 </ul>
                 <div style="min-height: 120px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                   <div id="lf_content"></div>
@@ -743,10 +922,10 @@
                 <table class="form" cellspacing="5">
                   <tr>
                     <th width="30%">
-                      <label for="lf_uid">Member ID</label>
+                          <label for="lf_uid">User ID</label>
                     </th>
                         <td>
-                      <input type="text" name="lf_uid" value="" id="lf_uid" />
+                          <input type="text" name="lf_uid" value="" id="lf_uid" style="width: 150px;" />
                     </td>
                   </tr>
                   <tr>
@@ -754,7 +933,7 @@
                       <label for="lf_password">Password</label>
                     </th>
                         <td>
-                      <input type="password" name="lf_password" value="" id="lf_password" />
+                          <input type="password" name="lf_password" value="" id="lf_password" style="width: 150px;" />
                     </td>
                   </tr>
                     </table>
@@ -766,7 +945,7 @@
                           <label for="lf_openId">OpenID URL</label>
                     </th>
                         <td>
-                          <input type="text" name="lf_openId" value="" id="lf_openId" class="openId" size="40"/>
+                          <input type="text" name="lf_openId" value="" id="lf_openId" style="width: 300px;" />
                         </td>
                   </tr>
                     </table>
@@ -789,6 +968,32 @@
                     <table id="lf_table_3" class="form" cellspacing="5">
                     </table>
                   </div>
+                  <div id="lf_page_4" class="tabContent" style="display: none">
+                    <table id="lf_table_4" class="form" cellspacing="5">
+                      <tr>
+                        <th width="30%">
+                        </th>
+                        <td>
+                          <span id="lf_twitter" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="lf_twitterButton" src="/ods/images/sign-in-with-twitter-d.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                  <div id="lf_page_5" class="tabContent" style="display: none;">
+                    <table id="lf_table_5" class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%">
+                        </th>
+                        <td>
+                          <span id="lf_linkedin" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="lf_linkedinButton" src="/ods/images/linkedin-large.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
                 </div>
                 <div class="footer">
                   <input type="submit" name="lf_login" value="Login" id="lf_login" onclick="javascript: return lfLoginSubmit();" />
@@ -802,27 +1007,29 @@
               ?>
               <div id="rf" class="form">
                 <div class="header">
-                  User register
+                  User Registration
                 </div>
                 <ul id="rf_tabs" class="tabs">
-                  <li id="rf_tab_0" title="ODS">ODS</li>
+                  <li id="rf_tab_0" title="Digest">Digest</li>
                   <li id="rf_tab_1" title="OpenID" style="display: none;">OpenID</li>
                   <li id="rf_tab_2" title="Facebook" style="display: none;">Facebook</li>
                   <li id="rf_tab_3" title="WebID" style="display: none;">WebID</li>
+                  <li id="rf_tab_4" title="Twitter" style="display: none;">Twitter</li>
+                  <li id="rf_tab_5" title="LinkedIn" style="display: none;">LinkedIn</li>
                 </ul>
                 <div style="min-height: 135px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                   <div id="rf_content"></div>
                   <div id="rf_page_0" class="tabContent" style="display: none">
                     <table id="rf_table_0" class="form" cellspacing="5">
-                      <tr id="rf_login_1">
+                      <tr>
                         <th width="30%">
                           <label for="rf_uid">Login Name<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td>
-                          <input type="text" name="rf_uid" value="" id="rf_uid" />
+                          <input type="text" name="rf_uid" value="" id="rf_uid" style="width: 150px;" />
                         </td>
                       </tr>
-                      <tr id="rf_login_2">
+                      <tr>
                         <th>
                           <label for="rf_email">E-mail<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
@@ -830,20 +1037,20 @@
                           <input type="text" name="rf_email" value="" id="rf_email" size="40"/>
                         </td>
                       </tr>
-                      <tr id="rf_login_3">
+                      <tr>
                         <th>
                           <label for="rf_password">Password<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td>
-                          <input type="password" name="rf_password" value="" id="rf_password" />
+                          <input type="password" name="rf_password" value="" id="rf_password" style="width: 150px;" />
                         </td>
                       </tr>
-                      <tr id="rf_login_4">
+                      <tr>
                         <th>
                           <label for="rf_password2">Password (verify)<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td>
-                          <input type="password" name="rf_password2" value="" id="rf_password2" />
+                          <input type="password" name="rf_password2" value="" id="rf_password2" style="width: 150px;" />
                         </td>
                       </tr>
                     </table>
@@ -878,6 +1085,32 @@
                     <table id="rf_table_3" class="form" cellspacing="5">
                     </table>
                   </div>
+                  <div id="rf_page_4" class="tabContent" style="display: none">
+                    <table id="rf_table_4" class="form" cellspacing="5">
+                      <tr>
+                        <th width="30%">
+                        </th>
+                        <td>
+                          <span id="rf_twitter" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="rf_twitterButton" src="/ods/images/sign-in-with-twitter-d.png" border="0"/></a>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                  <div id="rf_page_5" class="tabContent" style="display: none;">
+                    <table id="rf_table_5" class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%">
+                        </th>
+                        <td>
+                          <span id="rf_linkedin" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="rf_linkedinButton" src="/ods/images/linkedin-large.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
                 </div>
                 <div>
                   <table class="form" cellspacing="5">
@@ -903,132 +1136,14 @@
                 <div class="header">
                   User profile
                 </div>
-
                 <div id="uf_div_new" style="clear: both;">
                 </div>
-                <div id="uf_div" style="clear: both; display: none;">
-              	  <div id="u_profile_l">
-              	    <div id="user_info_w" class="widget user_info_w">
-              	      <div class="w_title" id="userProfilePhotoName">
-              	        <h3></h3>
-              	      </div>
-              	      <div class="w_content">
-                        <div class="user_img_ctr">
-                          <a href="javascript:void(0)">
-                       		  <img alt="Profile image" id="userProfilePhotoImg" rel="foaf:depiction" class="prof_photo" src="/ods/images/profile.png"/>
-                          </a>
-                        </div> <!-- user_img_ctr -->
-                        <div class="gems_ctr">
-                          <div class="prof_user_gems" id="profileUserGems">
-                            <div class="gem">
-                              <a href="javascript:void(0)" id="uf_foaf_gem" target="_blank"><img src="/ods/images/icons/foaf.png" alt="FOAF"/></a>
-                            </div>
-                            <div class="gem">
-                              <a href="javascript:void(0)" id="uf_sioc_gem" target="_blank"><img src="/ods/images/icons/sioc_button.png" alt="SIOC"/></a>
-                            </div>
-                            <div class="gem">
-                              <a href="javascript:void(0)" id="uf_vcard_gem" target="_blank"><img src="/ods/images/icons/vcard.png" alt="VCARD"/></a>
-                            </div>
-                          </div> <!-- prof_user_gems -->
-                        </div> <!-- gems_ctr -->
-                      </div> <!-- w_content -->
-          	        </div> <!-- .widget -->
-
-            	      <div id="ds_w" class="widget ds_w">
-            	        <div class="w_title">
-                        <h3>Data Space</h3>
-          		          <div class="w_title_bar_btns">
-                    		  <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                    		</div> <!-- w_title_bar_btns -->
-          	          </div> <!-- w_title -->
-            	        <div class="w_content">
-                        <ul class="ds_list" id="ds_list">
-                        </ul> <!-- ds_list -->
-                        <div class="cmd_ctr"> </div>
-                      </div> <!-- w_content -->
-                    </div> <!-- .widget -->
-
-              	    <div id="connections_w" class="widget connections_w">
-              	      <div class="w_title">
-                        <h3 id="connPTitleTxt">Connections</h3>
-                        <div class="w_title_bar_btns">
-                          <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                        </div> <!-- w_title_bar_btns -->
-              	      </div> <!-- w_title -->
-            	        <div class="w_content" id="connP1" style="height: 200px;">
-                      </div> <!-- w_content -->
-            	      </div> <!-- .widget -->
-
-                    <div id="groups_w" class="widget groups_w" style="display: none;">
-            	        <div class="w_title">
-            	          <h3 id="discussionsTitleTxt">Discussion Groups ()</h3>
-            	        </div>
-            	        <div class="w_content" id="discussionsCtr">
-                      </div> <!-- w_content -->
-            	      </div> <!-- .widget -->
-          	      </div>
-
-              	  <div id="u_profile_r" style="width: 100%;">
-                    <div class="widget w_contact" about="#THIS" instanceof="foaf:Person">
-                      <div class="w_title">
-                        <h3>Contact Information</h3>
-                        <div class="w_title_bar_btns">
-                    		  <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                    		</div>
-                      </div>
-                      <div class="w_content">
-                <ul id="uf_tabs" class="tabs">
-                  <li id="uf_tab_0" title="Personal">Personal</li>
-                  <li id="uf_tab_1" title="Messaging Services">Messaging Services</li>
-                  <li id="uf_tab_2" title="Home">Home</li>
-                  <li id="uf_tab_3" title="Business">Business</li>
-                  <li id="uf_tab_4" title="Data Explorer">Data Explorer</li>
-                </ul>
-                <div style="min-height: 180px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
-                  <div id="uf_content"></div>
-                  <div id="uf_page_0" class="tabContent" >
-                    <table id="uf_table_0" class="form" cellspacing="5">
-                    </table>
-                  </div>
-                          <div id="uf_page_1" class="tabContent" style="display: none">
-                    <table id="uf_table_1" class="form" cellspacing="5">
-                    </table>
-                  </div>
-                          <div id="uf_page_2" class="tabContent" style="display: none">
-                    <table id="uf_table_2" class="form" cellspacing="5">
-                    </table>
-                  </div>
-                          <div id="uf_page_3" class="tabContent" style="display: none">
-                    <table id="uf_table_3" class="form" cellspacing="5">
-                </table>
-                  </div>
-                          <div id="uf_page_4" class="tabContent" style="display: none">
-                    <div id="uf_rdf_content">
-                       
-                    </div>
-                  </div>
                   <script type="text/javascript">
-                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){selectProfile();});
-                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){cRDF.open("<?php print($_xml->iri); ?>");});
+                  <?php
+                    print sprintf ("OAT.MSG.attach(OAT, 'PAGE_LOADED', function (){selectProfile('%s');});", $_userName);
+                  ?>
                   </script>
                 </div>
-                      </div>
-                    </div>
-
-                    <div id="notify" class="notify_w widget">
-                      <div class="w_title">
-                        <h3>Activities</h3>
-                        <div class="w_title_bar_btns">
-                      	  <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                      	</div> <!-- w_title_bar_btns -->
-                      </div>
-                      <div class="w_content" id="notify_content">
-                      </div>
-                    </div>
-                  </div>
-                </div>
-              </div>
-
               <?php
               }
               if ($_form == 'profile')
@@ -1051,20 +1166,24 @@
                   <li id="pf_tab_2" title="Security">Security</li>
                 </ul>
                 <div style="min-height: 180px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                  <?php
+                  if ($_formTab == 0)
+                  {
+                  ?>
                   <div id="pf_page_0" class="tabContent" style="display:none;">
                     <ul id="pf_tabs_0" class="tabs">
-                      <li id="pf_tab_0_0" title="Import">Profile Import</li>
-                      <li id="pf_tab_0_1" title="Main">Main</li>
-                      <li id="pf_tab_0_2" title="Address">Address</li>
-                      <li id="pf_tab_0_3" title="Online Accounts">Online Accounts</li>
-                      <li id="pf_tab_0_4" title="Messaging Services">Messaging Services</li>
-                      <li id="pf_tab_0_5" title="Biographical Events">Biographical Events</li>
-                      <li id="pf_tab_0_6" title="Favorite Things">Favorite Things</li>
-                      <li id="pf_tab_0_7" title="Creator Of">Creator Of</li>
-                      <li id="pf_tab_0_8" title="My Offers">My Offers</li>
-                      <li id="pf_tab_0_9" title="Offers I Seek">Offers I Seek</li>
+                      <li id="pf_tab_0_0">Profile Import</li>
+                      <li id="pf_tab_0_1">Main</li>
+                      <li id="pf_tab_0_2">Address</li>
+                      <li id="pf_tab_0_3">Online Accounts</li>
+                      <li id="pf_tab_0_4">Messaging Services</li>
+                      <li id="pf_tab_0_5">Others</li>
                     </ul>
-                    <div style="min-height: 180px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                    <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                      <?php
+                      if ($_formTab2 == 0)
+                      {
+                      ?>
                       <div id="pf_page_0_0" class="tabContent" style="display:none;">
                     <table class="form" cellspacing="5">
                       <tr>
@@ -1090,6 +1209,11 @@
                           </tbody>
                         </table>
                       </div>
+                      <?php
+                      }
+                      if ($_formTab2 == 1)
+                      {
+                      ?>
                       <div id="pf_page_0_1" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                           <tr>
@@ -1116,7 +1240,7 @@
                           <select name="pf_title" id="pf_title">
                                 <option></option>
                             <?php
-                              $X = array ("Mr", "Mrs", "Dr", "Ms");
+                                  $X = array ("Mr", "Mrs", "Dr", "Ms". "Sir");
                               for ($N = 0; $N < count ($X); $N += 1)
                                 print sprintf("<option %s>%s</option>", ((strcmp($X[$N], $_xml->title) == 0) ? "selected=\"selected\"" : ""), $X[$N]);
                             ?>
@@ -1255,12 +1379,12 @@
                                       </thead>
                                       <tr id="x1_tr_no" style="display: none;"><td colspan="2"><b>No Personal URIs</b></td></tr>
                                       <script type="text/javascript">
-                                        OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowRows("x1", '<?php print(str_replace("\n", "\\n", $_xml->webIDs)); ?>', ["\n"], function(prefix, val1){TBL.createRow(prefix, null, {fld_1: {value: val1, className: '_validate_ _url_ _canEmpty_'}});});});
+                                        OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowRows("x1", '<?php print(str_replace("\n", "\\n", $_xml->webIDs)); ?>', ["\n"], function(prefix, val1){TBL.createRow(prefix, null, {fld_1: {value: val1, className: '_validate_ _webid_ _canEmpty_'}});});});
                                       </script>
                                     </table>
                                   </td>
                                   <td valign="top" nowrap="nowrap">
-                                    <span class="button pointer" onclick="TBL.createRow('x1', null, {fld_1: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                                    <span class="button pointer" onclick="TBL.createRow('x1', null, {fld_1: {className: '_validate_ _webid_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                                     <select name="pf_acl_webIDs" id="pf_acl_webIDs">
                                       <?php
                                         for ($N = 0; $N < count ($ACL); $N += 2)
@@ -1435,6 +1559,39 @@
                             </td>
                           </tr>
                           <tr>
+                            <td> </td>
+                            <td>
+                              <label>
+                                <?php
+                                  print sprintf("<input type=\"checkbox\" id=\"pf_spbEnable\" name=\"pf_spbEnable\" value=\"1\" %s>", ((strcmp("1", $_xml->spbEnable) == 0) ? "checked=\"checked\"" : ""));
+                                ?>
+                                <b>Enable Semantic Pingback for ACLs</b>
+                              </label>
+                            </td>
+                          </tr>
+                          <tr>
+                            <td> </td>
+                            <td>
+                             <label>
+                                <?php
+                                  print sprintf("<input type=\"checkbox\" id=\"pf_inSearch\" name=\"pf_inSearch\" value=\"1\" %s>", ((strcmp("1", $_xml->inSearch) == 0) ? "checked=\"checked\"" : ""));
+                                ?>
+                               <b>Include my profile in search results</b>
+                             </label>
+                            </td>
+                          </tr>
+                          <tr>
+                            <td> </td>
+                            <td>
+                             <label>
+                                <?php
+                                  print sprintf("<input type=\"checkbox\" id=\"pf_showActive\" name=\"pf_showActive\" value=\"1\" %s>", ((strcmp("1", $_xml->showActive) == 0) ? "checked=\"checked\"" : ""));
+                                ?>
+                               <b>Include in User active information</b>
+                             </label>
+                            </td>
+                          </tr>
+                          <tr>
                             <th>
                               <label for="pf_set_0_1">Set access for all fields as </label>
                             </th>
@@ -1442,14 +1599,18 @@
                               <select name="pf_set_0_1" id="pf_set_0_1" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
                           </tr>
                     </table>
                   </div>
-
+                      <?php
+                      }
+                      if ($_formTab2 == 2)
+                      {
+                      ?>
                       <div id="pf_page_0_2" class="tabContent" style="display:none;">
                     <table class="form" cellspacing="5">
                       <tr>
@@ -1581,7 +1742,7 @@
                               <input type="text" name="pf_homelng" value="<?php print($_xml->homeLongitude); ?>" id="pf_homelng" style="width: 110px;" />
                               <label>
                                 <input type="checkbox" name="pf_homeDefaultMapLocation" id="pf_homeDefaultMapLocation" onclick="javascript: setDefaultMapLocation('home', 'business');" />
-                                Default Map Location
+                                Use as default map location
                               </label>
                         </td>
                       </tr>
@@ -1617,14 +1778,18 @@
                               <select name="pf_set_0_2" id="pf_set_0_2" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                         </td>
                       </tr>
                     </table>
                   </div>
-
+                      <?php
+                      }
+                      if ($_formTab2 == 3)
+                      {
+                      ?>
                       <div id="pf_page_0_3" class="tabContent" style="display:none;">
                         <input type="hidden" name="c_nick" value="<?php print($_xml->nickName); ?>" id="c_nick" />
                         <table class="form" cellspacing="5">
@@ -1637,7 +1802,7 @@
                                       Select from Service List ot Type New One
                                     </th>
                                     <th>
-                                      Member Home Page URL
+                                      Member Home Page URI
                                     </th>
                                     <th width="65px">
                                       Action
@@ -1646,17 +1811,21 @@
                                 </thead>
                                 <tr id="x4_tr_no" style="display: none;"><td colspan="3"><b>No Services</b></td></tr>
                                 <script type="text/javascript">
-                                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOnlineAccounts("x4", "P", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1, className: '_validate_ _url_ _canEmpty_'}, fld_2: {value: val2}});});});
+                                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOnlineAccounts("x4", "P", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1}, fld_2: {value: val2, className: '_validate_ _uri_ _canEmpty_'}});});});
                                 </script>
                               </table>
                             </td>
                             <td valign="top" nowrap="1">
-                              <span class="button pointer" onclick="TBL.createRow('x4', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                              <span class="button pointer" onclick="TBL.createRow('x4', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _uri_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                             </td>
                           </tr>
                         </table>
                       </div>
-
+                      <?php
+                      }
+                      if ($_formTab2 == 4)
+                      {
+                      ?>
                       <div id="pf_page_0_4" class="tabContent" style="display:none;">
                         <table id="x6_tbl" class="form" cellspacing="5">
                           <tr>
@@ -1745,7 +1914,7 @@
                               <select name="pf_set_0_4" id="pf_set_0_4" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
@@ -1755,8 +1924,28 @@
                           </script>
                         </table>
                       </div>
-
+                      <?php
+                      }
+                      if ($_formTab2 == 5)
+                      {
+                      ?>
                       <div id="pf_page_0_5" class="tabContent" style="display:none;">
+                        <ul id="pf_tabs_0_5" class="tabs">
+                          <li id="pf_tab_0_5_0">Biographical Events</li>
+                          <li id="pf_tab_0_5_1">Owns</li>
+                          <li id="pf_tab_0_5_2">Favorite Things</li>
+                          <li id="pf_tab_0_5_3">Creator Of</li>
+                          <li id="pf_tab_0_5_4">My Offers</li>
+                          <li id="pf_tab_0_5_5">Offers I Seek</li>
+                          <li id="pf_tab_0_5_6">Likes & DisLikes</li>
+                          <li id="pf_tab_0_5_7">Social Network</li>
+                        </ul>
+                        <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                          <?php
+                          if ($_formTab3 == 0)
+                          {
+                          ?>
+                          <div id="pf_page_0_5_0" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                           <tr>
                             <td width="600px">
@@ -1789,52 +1978,158 @@
                           </tr>
                         </table>
                       </div>
-
                       <?php
-                      if ($_formTab == 0)
-                      {
-                        if ($_formSubtab == 6)
-                        {
-                      ?>
-                      <div id="pf_page_0_6" class="tabContent" style="display:none;">
-                        <h3>Favorites</h3>
-                        <?php
-                          if ($_formMode == "")
+                          }
+                          if ($_formTab3 == 1)
                           {
-                        ?>
-                        <div id="pf06_list">
-                          <div style="padding: 0 0 0.5em 0;">
-                            <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add 'Fovorite'" alt="Add 'Fovorite'" src="/ods/images/icons/add_16.png"> Add</span>
-                          </div>
-                      	  <table id="pf06_tbl" class="listing">
-                                <thead>
-                                  <tr class="listing_header_row">
-                        		    <th>Label</th>
-                        		    <th>URI</th>
-                        		    <th width="1%" nowrap="nowrap">Action</th>
-                                  </tr>
+                          ?>
+                          <div id="pf_page_0_5_1" class="tabContent" style="display:none;">
+                            <h3>Owns</h3>
+                            <?php
+                              if ($_formMode == "")
+                              {
+                            ?>
+                            <div id="pf051_list">
+                              <div style="padding: 0 0 0.5em 0;">
+                                <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Offer" alt="Add Offer" src="/ods/images/icons/add_16.png"> Add</span>
+                              </div>
+                          	  <table id="pf051_tbl" class="listing">
+                          	    <thead>
+                          	      <tr class="listing_header_row">
+                            		    <th width="50%">Name</th>
+                            		    <th width="50%">Description</th>
+                            		    <th width="1%" nowrap="nowrap">Action</th>
+                          	      </tr>
                                 </thead>
-                      	    <tbody id="pf06_tbody">
+                          	    <tbody id="pf051_tbody">
                                   <script type="text/javascript">
-                                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowFavorites();});
+                                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOwns();});
                                   </script>
-                                </tbody>
+                          	    </tbody>
                               </table>
-                        </div>
-                        <?php
+                            </div>
+                            <?php
+                              }
+                              else
+                      {
+                                print sprintf("<input type=\"hidden\" id=\"pf051_id\" name=\"pf051_id\" value=\"%s\" />", (isset ($_REQUEST['pf051_id'])) ? $_REQUEST['pf051_id'] : "0");
+                            ?>
+                            <div id="pf051_form">
+                              <table class="form" cellspacing="5">
+                      				  <tr>
+                                  <th width="25%">
+                      		          Access
+                      		        </th>
+                      		        <td>
+                                    <select name="pf051_flag" id="pf051_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Name (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf051_name" id="pf051_name" value="" class="_validate_" style="width: 400px;">
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Comment
+                                  </th>
+                                  <td>
+                                    <textarea name="pf051_comment" id="pf051_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                                  </td>
+                                </tr>
+                      				  <tr>
+                      				    <th valign="top">
+                      		          Products
+                      		        </th>
+                      		        <td width="800px">
+                                    <table id="ow_tbl" class="listing">
+                                      <tbody id="ow_tbody">
+                                        <tr id="ow_throbber">
+                                          <td>
+                                            <img src="/ods/images/oat/Ajax_throbber.gif" />
+                                          </td>
+                                        </tr>
+                                      </tbody>
+                                    </table>
+                                    <input type="hidden" id="ow_no" name="ow_no" value="1" />
+                                  </td>
+                                </tr>
+                              </table>
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOwn();});
+                              </script>
+                              <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                                <input type="submit" name="pf_update051" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf051');"/>
+                              </div>
+                            </div>
+                            <?php
+                              }
+                            ?>
+                          </div>
+                          <?php
+                          }
+                          if ($_formTab3 == 2)
+                        {
+                      ?>
+                          <div id="pf_page_0_5_2" class="tabContent" style="display:none;">
+                        <h3>Favorites</h3>
+                        <?php
+                          if ($_formMode == "")
+                          {
+                        ?>
+                            <div id="pf052_list">
+                          <div style="padding: 0 0 0.5em 0;">
+                            <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add 'Favorite'" alt="Add 'Favorite'" src="/ods/images/icons/add_16.png"> Add</span>
+                          </div>
+                          	  <table id="pf052_tbl" class="listing">
+                                <thead>
+                                  <tr class="listing_header_row">
+                            		    <th width="50%">Label</th>
+                            		    <th width="50%">URI</th>
+                        		    <th width="1%" nowrap="nowrap">Action</th>
+                                  </tr>
+                                </thead>
+                          	    <tbody id="pf052_tbody">
+                                  <script type="text/javascript">
+                                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowFavorites();});
+                                  </script>
+                                </tbody>
+                              </table>
+                        </div>
+                        <?php
                           }
                           else
                           {
-                            print sprintf("<input type=\"hidden\" id=\"pf06_id\" name=\"pf06_id\" value=\"%s\" />", (isset ($_REQUEST['pf06_id'])) ? $_REQUEST['pf06_id'] : "0");
+                                print sprintf("<input type=\"hidden\" id=\"pf052_id\" name=\"pf052_id\" value=\"%s\" />", (isset ($_REQUEST['pf052_id'])) ? $_REQUEST['pf052_id'] : "0");
                         ?>
-                        <div id="pf06_form">
+                            <div id="pf052_form">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
+                      		          Access
+                      		        </th>
+                      		        <td>
+                                    <select name="pf052_flag" id="pf052_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
                                 Label (*)
                               </th>
                               <td>
-                                <input type="text" name="pf06_label" id="pf06_label" value="" class="_validate_" style="width: 400px;">
+                                    <input type="text" name="pf052_label" id="pf052_label" value="" class="_validate_" style="width: 400px;">
                             </td>
                             </tr>
                             <tr>
@@ -1842,7 +2137,7 @@
                                 External URI
                               </th>
                               <td>
-                                <input type="text" name="pf06_uri" id="pf06_uri" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
+                                    <input type="text" name="pf052_uri" id="pf052_uri" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
                             </td>
                           </tr>
                             <tr>
@@ -1862,7 +2157,7 @@
                           </script>
                           <div class="footer">
                             <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false; "/>
-                            <input type="submit" name="pf_update06" value="Save" onclick="myBeforeSubmit(); return validateInputs(this);"/>
+                                <input type="submit" name="pf_update052" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf052');"/>
                           </div>
                       </div>
                       <?php
@@ -1871,20 +2166,20 @@
                       </div>
                       <?php
                         }
-                        else if ($_formSubtab == 7)
+                          if ($_formTab3 == 3)
                         {
                       ?>
-                      <div id="pf_page_0_7" class="tabContent" style="display:none;">
+                          <div id="pf_page_0_5_3" class="tabContent" style="display:none;">
                         <h3>Creator Of</h3>
                         <?php
                           if ($_formMode == "")
                           {
                         ?>
-                        <div id="pf07_list">
+                            <div id="pf053_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Creator Of" alt="Add Creator Of" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf07_tbl" class="listing">
+                          	  <table id="pf053_tbl" class="listing">
                       	    <thead>
                       	      <tr class="listing_header_row">
                         		    <th>Property</th>
@@ -1892,7 +2187,7 @@
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf07_tbody">
+                          	    <tbody id="pf053_tbody">
                               <script type="text/javascript">
                                 OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowMades();});
                               </script>
@@ -1903,9 +2198,9 @@
                           }
                           else
                           {
-                              print sprintf("<input type=\"hidden\" id=\"pf07_id\" name=\"pf07_id\" value=\"%s\" />", (isset ($_REQUEST['pf07_id'])) ? $_REQUEST['pf07_id'] : "0");
+                                print sprintf("<input type=\"hidden\" id=\"pf053_id\" name=\"pf053_id\" value=\"%s\" />", (isset ($_REQUEST['pf053_id'])) ? $_REQUEST['pf053_id'] : "0");
                         ?>
-                        <div id="pf07_form">
+                            <div id="pf053_form">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
@@ -1916,7 +2211,7 @@
                                   function p_init ()
                                   {
                                     var fld = new OAT.Combolist([]);
-                                    fld.input.name = 'pf07_property';
+                                        fld.input.name = 'pf053_property';
                                     fld.input.id = fld.input.name;
                                     fld.input.style.width = "400px";
                                     $("if_opt").appendChild(fld.div);
@@ -1933,7 +2228,7 @@
                                 URI
                               </th>
                               <td>
-                                <input type="text" name="pf07_url" id="pf07_url" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
+                                    <input type="text" name="pf053_url" id="pf053_url" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -1941,7 +2236,7 @@
                                 Description (*)
                               </th>
                               <td>
-                                <textarea name="pf07_description" id="pf07_description" style="width: 400px;"></textarea>
+                                    <textarea name="pf053_description" id="pf053_description" style="width: 400px;"></textarea>
                               </td>
                             </tr>
                             <tr>
@@ -1956,7 +2251,7 @@
                           </script>
                           <div class="footer">
                             <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false; "/>
-                            <input type="submit" name="pf_update07" value="Save" onclick="needToConfirm = false; return validateInputs(this);"/>
+                                <input type="submit" name="pf_update053" value="Save" onclick="needToConfirm = false; return validateInputs(this, 'pf053);"/>
                           </div>
                         </div>
                         <?php
@@ -1965,28 +2260,28 @@
                       </div>
                       <?php
                         }
-                        else if ($_formSubtab == 8)
+                          if ($_formTab3 == 4)
                         {
                       ?>
-                      <div id="pf_page_0_8" class="tabContent" style="display:none;">
+                          <div id="pf_page_0_5_4" class="tabContent" style="display:none;">
                         <h3>My Offers</h3>
                         <?php
                           if ($_formMode == "")
                           {
                         ?>
-                        <div id="pf08_list">
+                            <div id="pf054_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Offer" alt="Add Offer" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf08_tbl" class="listing">
+                          	  <table id="pf054_tbl" class="listing">
                       	    <thead>
                       	      <tr class="listing_header_row">
-                        		    <th>Name</th>
-                        		    <th>Description</th>
+                            		    <th width="50%">Name</th>
+                            		    <th width="50%">Description</th>
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf08_tbody">
+                          	    <tbody id="pf054_tbody">
                               <script type="text/javascript">
                                 OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOffers();});
                               </script>
@@ -1997,16 +2292,28 @@
                           }
                           else
                           {
-                            print sprintf("<input type=\"hidden\" id=\"pf08_id\" name=\"pf08_id\" value=\"%s\" />", (isset ($_REQUEST['pf08_id'])) ? $_REQUEST['pf08_id'] : "0");
+                                print sprintf("<input type=\"hidden\" id=\"pf054_id\" name=\"pf054_id\" value=\"%s\" />", (isset ($_REQUEST['pf054_id'])) ? $_REQUEST['pf054_id'] : "0");
                         ?>
-                        <div id="pf08_form">
+                            <div id="pf054_form">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
-                                Name
+                      		          Access
                               </th>
                               <td>
-                                <input type="text" name="pf08_name" id="pf08_name" value="" class="_validate_" style="width: 400px;">
+                                    <select name="pf054_flag" id="pf054_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Name (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf054_name" id="pf054_name" value="" class="_validate_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -2014,7 +2321,7 @@
                                 Comment
                               </th>
                               <td>
-                                <textarea name="pf08_comment" id="pf08_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                                    <textarea name="pf054_comment" id="pf054_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
                               </td>
                             </tr>
                   				  <tr>
@@ -2024,6 +2331,11 @@
                   		        <td width="800px">
                                 <table id="ol_tbl" class="listing">
                                   <tbody id="ol_tbody">
+                                    <tr id="ol_throbber">
+                                      <td>
+                                        <img src="/ods/images/oat/Ajax_throbber.gif" />
+                                      </td>
+                                    </tr>
                                   </tbody>
                                 </table>
                                 <input type="hidden" id="ol_no" name="ol_no" value="1" />
@@ -2035,7 +2347,7 @@
                           </script>
                           <div class="footer">
                             <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
-                            <input type="submit" name="pf_update08" value="Save" onclick="myBeforeSubmit(); return validateInputs(this);"/>
+                                <input type="submit" name="pf_update054" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf054');"/>
                           </div>
                         </div>
                         <?php
@@ -2044,28 +2356,28 @@
                       </div>
                       <?php
                         }
-                        else if ($_formSubtab == 9)
+                          if ($_formTab3 == 5)
                         {
                       ?>
-                      <div id="pf_page_0_9" class="tabContent" style="display:none;">
+                          <div id="pf_page_0_5_5" class="tabContent" style="display:none;">
                         <h3>Offers I Seek</h3>
                         <?php
                           if ($_formMode == "")
                           {
                         ?>
-                        <div id="pf09_list">
+                            <div id="pf055_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Seek" alt="Add Seek" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf09_tbl" class="listing">
+                          	  <table id="pf055_tbl" class="listing">
                       	    <thead>
                       	      <tr class="listing_header_row">
-                        		    <th>Name</th>
-                        		    <th>Description</th>
+                            		    <th width="50%">Name</th>
+                            		    <th width="50%">Description</th>
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf09_tbody">
+                          	    <tbody id="pf055_tbody">
                               <script type="text/javascript">
                                 OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowSeeks();});
                               </script>
@@ -2076,16 +2388,28 @@
                           }
                           else
                           {
-                            print sprintf("<input type=\"hidden\" id=\"pf09_id\" name=\"pf09_id\" value=\"%s\" />", (isset ($_REQUEST['pf09_id'])) ? $_REQUEST['pf09_id'] : "0");
+                                print sprintf("<input type=\"hidden\" id=\"pf055_id\" name=\"pf055_id\" value=\"%s\" />", (isset ($_REQUEST['pf055_id'])) ? $_REQUEST['pf055_id'] : "0");
                         ?>
-                        <div id="pf09_form">
+                            <div id="pf055_form">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
-                                Name
+                      		          Access
+                      		        </th>
+                      		        <td>
+                                    <select name="pf055_flag" id="pf055_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Name (*)
                               </th>
                               <td>
-                                <input type="text" name="pf09_name" id="pf09_name" value="" class="_validate_" style="width: 400px;">
+                                    <input type="text" name="pf055_name" id="pf055_name" value="" class="_validate_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -2093,7 +2417,7 @@
                                 Comment
                               </th>
                               <td>
-                                <textarea name="pf09_comment" id="pf09_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                                    <textarea name="pf055_comment" id="pf055_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
                               </td>
                             </tr>
                   				  <tr>
@@ -2103,6 +2427,11 @@
                   		        <td width="800px">
                                 <table id="wl_tbl" class="listing">
                                   <tbody id="wl_tbody">
+                                    <tr id="wl_throbber">
+                                      <td>
+                                        <img src="/ods/images/oat/Ajax_throbber.gif" />
+                                      </td>
+                                    </tr>
                                   </tbody>
                                 </table>
                                 <input type="hidden" id="wl_no" name="wl_no" value="1" />
@@ -2114,7 +2443,7 @@
                           </script>
                           <div class="footer">
                             <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
-                            <input type="submit" name="pf_update09" value="Save" onclick="myBeforeSubmit(); return validateInputs(this);"/>
+                                <input type="submit" name="pf_update055" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf055');"/>
                           </div>
                         </div>
                         <?php
@@ -2123,21 +2452,278 @@
                       </div>
                       <?php
                         }
+                          if ($_formTab3 == 6)
+                        {
+                      ?>
+                          <div id="pf_page_0_5_6" class="tabContent" style="display:none;">
+                        <h3>Likes &amp DisLikes</h3>
+                        <?php
+                          if ($_formMode == "")
+                          {
+                        ?>
+                            <div id="pf056_list">
+                          <div style="padding: 0 0 0.5em 0;">
+                            <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Like" alt="Add Like" src="/ods/images/icons/add_16.png"> Add</span>
+                          </div>
+                          	  <table id="pf056_tbl" class="listing">
+                      	    <thead>
+                      	      <tr class="listing_header_row">
+                            		    <th width="10%">Type</th>
+                            		    <th width="45%">URI</th>
+                            		    <th width="45%">Name</th>
+                        		    <th width="1%" nowrap="nowrap">Action</th>
+                      	      </tr>
+                            </thead>
+                          	    <tbody id="pf056_tbody">
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowLikes();});
+                              </script>
+                      	    </tbody>
+                          </table>
+                        </div>
+                        <?php
+                          }
+                          else
+                          {
+                                print sprintf("<input type=\"hidden\" id=\"pf056_id\" name=\"pf056_id\" value=\"%s\" />", (isset ($_REQUEST['pf056_id'])) ? $_REQUEST['pf056_id'] : "0");
+                        ?>
+                            <div id="pf056_form">
+                          <table class="form" cellspacing="5">
+                            <tr>
+                              <th width="25%">
+                      		          Access
+                      		        </th>
+                      		        <td>
+                                    <select name="pf056_flag" id="pf056_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                Type
+                              </th>
+                              <td>
+                                    <select name="pf056_type" id="pf056_type">
+                                  <option value="L">Like</option>
+                                  <option value="DL">DisLike</option>
+                                </select>
+                              </td>
+                            </tr>
+                            <tr>
+                              <th>
+                                    URI (*)
+                              </th>
+                              <td>
+                                    <input type="text" name="pf056_uri" id="pf056_uri" value="" class="_validate_ _uri_" style="width: 400px;">
+                              </td>
+                            </tr>
+                            <tr>
+                              <th>
+                                    Name (*)
+                              </th>
+                              <td>
+                                    <input type="text" name="pf056_name" id="pf056_name" value="" class="_validate_" style="width: 400px;">
+                              </td>
+                            </tr>
+                            <tr>
+                              <th>
+                                Comment
+                              </th>
+                              <td>
+                                    <textarea name="pf056_comment" id="pf056_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                              </td>
+                            </tr>
+                  				  <tr>
+                  				    <th valign="top">
+		                            Properties
+                  		        </th>
+                  		        <td width="800px">
+                                <table id="ld_tbl" class="listing">
+                                  <tbody id="ld_tbody">
+                                    <tr id="ld_throbber">
+                                      <td>
+                                        <img src="/ods/images/oat/Ajax_throbber.gif" />
+                                      </td>
+                                    </tr>
+                                  </tbody>
+                                </table>
+                                <input type="hidden" id="ld_no" name="ld_no" value="1" />
+                              </td>
+                            </tr>
+                          </table>
+                          <script type="text/javascript">
+                            OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowLike();});
+                          </script>
+                          <div class="footer">
+                            <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                                <input type="submit" name="pf_update056" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf056');"/>
+                              </div>
+                            </div>
+                            <?php
+                              }
+                            ?>
+                          </div>
+                          <?php
+                          }
+                          if ($_formTab3 == 7)
+                          {
+                          ?>
+                          <div id="pf_page_0_5_7" class="tabContent" style="display:none;">
+                            <h3>Knows</h3>
+                            <?php
+                              if ($_formMode == "")
+                              {
+                            ?>
+                            <div id="pf057_list">
+                              <div style="padding: 0 0 0.5em 0;">
+                                <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Knows" alt="Add Knows" src="/ods/images/icons/add_16.png"> Add</span>
+                                <span onclick="javascript: $('formMode').value = 'import'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Import Knows" alt="Import Knows" src="/ods/images/icons/go_16.png"> Import</span>
+                              </div>
+                          	  <table id="pf057_tbl" class="listing">
+                          	    <thead>
+                          	      <tr class="listing_header_row">
+                            		    <th width="50%">Label</th>
+                            		    <th width="50%">URI</th>
+                            		    <th width="1%" nowrap="nowrap">Action</th>
+                          	      </tr>
+                                </thead>
+                          	    <tbody id="pf057_tbody">
+                                  <script type="text/javascript">
+                                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowKnows();});
+                                  </script>
+                          	    </tbody>
+                              </table>
+                        </div>
+                        <?php
+                          }
+                              else if ($_formMode == "import")
+                              {
+                        ?>
+                            <div id="pf057_import">
+                              <table>
+                      				  <tr>
+                      				    <th width="100px">
+                      		          Source
+                      		        </th>
+                                  <td>
+                                    <input type="text" class="_validate_ _uri_" size="100" value="" id="k_import" name="k_import">
+                                    <input type="button" class="button" onclick="javascript: knowsData(); return false;" value="Download">
+                                    <img style="display: none;" src="/ods/images/oat/Ajax_throbber.gif" alt="Import knows URIs" id="k_import_image">
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                  </th><td>
+                                    <table class="listing" id="k_tbl">
+                                      <thead>
+                                        <tr class="listing_header_row">
+                                          <th>
+                                            Access
+                                          </th>
+                                          <th width="50%">
+                                            URI
+                                          </th>
+                                          <th width="50%">
+                                            Label
+                                          </th>
+                                          <th width="65px">
+                                            Action
+                                          </th>
+                                        </tr>
+                                      </thead>
+                                      <tbody>
+                                        <tr id="k_tr_no">
+                                           <td colspan="3">
+                                             <b>No downloaded items</b>
+                                           </td>
+                                        </tr>
+                                      </tbody>
+                                    </table>
+                                  </td>
+                                </tr>
+                              </table>
+                              <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                                <input type="submit" name="pf_update057" value="Import" onclick="myBeforeSubmit(); return true;"/>
+                              </div>
+                      </div>
+                      <?php
+                        }
                         else
                         {
+                                print sprintf("<input type=\"hidden\" id=\"pf057_id\" name=\"pf057_id\" value=\"%s\" />", (isset ($_REQUEST['pf057_id'])) ? $_REQUEST['pf057_id'] : "0");
+                            ?>
+                            <div id="pf057_form">
+                              <table class="form" cellspacing="5">
+                      				  <tr>
+                                  <th width="25%">
+                      		          Access
+                      		        </th>
+                      		        <td>
+                                    <select name="pf057_flag" id="pf057_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    URI (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf057_uri" id="pf057_uri" value="" class="_validate_ _uri_" style="width: 400px;">
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Label (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf057_label" id="pf057_label" value="" class="_validate_" style="width: 400px;">
+                                  </td>
+                                </tr>
+                              </table>
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowKnow();});
+                              </script>
+                              <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                                <input type="submit" name="pf_update057" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf057');"/>
+                              </div>
+                            </div>
+                            <?php
+                              }
+                            ?>
+                          </div>
+                          <?php
+                          }
+                          ?>
+                        </div>
+                      </div>
+                      <?php
+                      }
+                      if ($_formTab2 < 5)
+                      {
                       ?>
                       <div class="footer">
                         <input type="submit" name="pf_cancel" value="Cancel" onclick="needToConfirm = false;"/>
-                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit ();"/>
-                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit ();"/>
+                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
                       </div>
                       <?php
                         }
-                      }
                       ?>
                     </div>
                   </div>
-
+                  <?php
+                  }
+                  if ($_formTab == 1)
+                  {
+                  ?>
                   <div id="pf_page_1" class="tabContent" style="display:none;">
                     <ul id="pf_tabs_1" class="tabs">
                       <li id="pf_tab_1_0" title="Main">Main</li>
@@ -2145,7 +2731,11 @@
                       <li id="pf_tab_1_2" title="Online Accounts">Online Accounts</li>
                       <li id="pf_tab_1_3" title="Messaging Services">Messaging Services</li>
                     </ul>
-                    <div style="min-height: 180px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                    <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                      <?php
+                      if ($_formTab2 == 0)
+                      {
+                      ?>
                       <div id="pf_page_1_0" class="tabContent" style="display:none;">
                     <table class="form" cellspacing="5">
                       <tr>
@@ -2352,14 +2942,18 @@
                               <select name="pf_set_1_0" id="pf_set_1_0" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
                           </tr>
                         </table>
                       </div>
-
+                      <?php
+                      }
+                      if ($_formTab2 == 1)
+                      {
+                      ?>
                       <div id="pf_page_1_1" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                           <tr>
@@ -2491,7 +3085,7 @@
                               <input type="text" name="pf_businesslng" value="<?php print($_xml->businessLongitude); ?>" id="pf_businesslng" style="width: 110px;" />
                               <label>
                                 <input type="checkbox" name="pf_businessDefaultMapLocation" id="pf_businessDefaultMapLocation" onclick="javascript: setDefaultMapLocation('business', 'home');" />
-                                Default Map Location
+                                Use as default map location
                               </label>
                         </td>
                       </tr>
@@ -2527,14 +3121,18 @@
                               <select name="pf_set_1_1" id="pf_set_1_1" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                         </td>
                       </tr>
                         </table>
                       </div>
-
+                      <?php
+                      }
+                      if ($_formTab2 == 2)
+                      {
+                      ?>
                       <div id="pf_page_1_2" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                       <tr>
@@ -2546,7 +3144,7 @@
                                       Select from Service List ot Type New One
                         </th>
                         <th>
-                                      Member Home Page URL
+                                      Member Home Page URI
                         </th>
                                     <th width="65px">
                                       Action
@@ -2555,17 +3153,21 @@
                                 </thead>
                                 <tr id="y1_tr_no" style="display: none;"><td colspan="3"><b>No Services</b></td></tr>
                                 <script type="text/javascript">
-                                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOnlineAccounts("y1", "B", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1, className: '_validate_ _url_ _canEmpty_'}, fld_2: {value: val2}});});});
+                                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOnlineAccounts("y1", "B", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1}, fld_2: {value: val2, className: '_validate_ _uri_ _canEmpty_'}});});});
                                 </script>
                               </table>
                             </td>
                             <td valign="top" nowrap="1">
-                              <span class="button pointer" onclick="TBL.createRow('y1', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                              <span class="button pointer" onclick="TBL.createRow('y1', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _uri_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                         </td>
                       </tr>
                         </table>
                       </div>
-
+                      <?php
+                      }
+                      if ($_formTab2 == 3)
+                      {
+                      ?>
                       <div id="pf_page_1_3" class="tabContent" style="display:none;">
                         <table id="y2_tbl" class="form" cellspacing="5">
                       <tr>
@@ -2654,7 +3256,7 @@
                               <select name="pf_set_1_3" id="pf_set_1_3" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
@@ -2664,27 +3266,52 @@
                           </script>
                     </table>
                   </div>
-
+                      <?php
+                      }
+                      ?>
                       <div class="footer">
                         <input type="submit" name="pf_cancel" value="Cancel" onclick="needToConfirm = false;"/>
-                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit ();"/>
-                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit ();"/>
+                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
                       </div>
                     </div>
                   </div>
-
+                  <?php
+                  }
+                  if ($_formTab == 2)
+                  {
+                  ?>
                   <div id="pf_page_2" class="tabContent" style="display:none;">
+                    <ul id="pf_tabs_2" class="tabs">
+                      <li id="pf_tab_2_0" title="Password">Password</li>
+                      <li id="pf_tab_2_1" title="Password Recovery">Password Recovery</li>
+                      <li id="pf_tab_2_2" title="OpenID">OpenID</li>
+                      <li id="pf_tab_2_3" title="Facebook" style="display:none;">Facebook</li>
+                      <li id="pf_tab_2_4" title="Limits">Limits</li>
+                      <li id="pf_tab_2_5" title="Certificate Generator" style="display:none;">Certificate Generator</li>
+                      <li id="pf_tab_2_6" title="X.509 Certificates">X.509 Certificates</li>
+                    </ul>
+                    <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                      <?php
+                      if ($_formTab2 == 0)
+                      {
+                      ?>
+                      <div id="pf_page_2_0" class="tabContent" style="display:none;">
+                        <?php
+                          print $_xml->noPassword;
+                        ?>
+                        <h2>Change login password</h2>
+                        <p class="fm_expln">For your security, please use a password not found in a dictionary, consisting of both letters, and numbers or non-alphanumeric characters.</p>
                     <table class="form" cellspacing="5">
                       <tr>
                         <td align="center" colspan="2">
                           <span id="pf_change_txt"></span>
                         </td>
                       </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Password Settings
-                        </th>
-                      </tr>
+                          <?php
+                          if ($_xml->noPassword == '0')
+                          {
+                          ?>
                       <tr>
                         <th width="30%">
                           <label for="pf_oldPassword">Old Password</label>
@@ -2693,8 +3320,11 @@
                           <input type="password" name="pf_oldPassword" value="" id="pf_oldPassword" />
                         </td>
                       </tr>
+                          <?php
+                          }
+                          ?>
                       <tr>
-                        <th>
+                            <th width="30%">
                           <label for="pf_newPassword">New Password</label>
                         </th>
                         <td>
@@ -2712,65 +3342,18 @@
                       <tr>
                         <th>
                         </th>
-                        <td>
-                          <input type="button" name="pf_change" value="Change" onclick="javascript: return pfChangeSubmit();" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          OpenID
-                        </th>
-                      </tr>
-                      <tr>
-                        <th>
-                          <label for="pf_openID">OpenID URL</label>
-                        </th>
-                        <td>
-                          <input type="text" name="pf_securityOpenID" value="<?php print($_xml->securityOpenID); ?>" id="pf_securityOpenID" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th>
-                        </th>
-                        <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '1'; needToConfirm = false;" />
-                        </td>
-                      </tr>
-                      <tr id="pf_facebook" style="display:none;">
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Facebook
-                        </th>
-                      </tr>
-                      <tr id="pf_facebook1" style="display:none;">
-                        <th>
-                          Saved Facebook ID
-                        </th>
-                        <td>
-                        </td>
-                      </tr>
-                      <tr id="pf_facebook2" style="display:none;">
-                        <th>
-                        </th>
-                        <td>
-                          <span id="pf_facebookData" style="min-height: 20px;"></span>
-                          <br />
-                          <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
-                          <fb:login-button autologoutlink="true"></fb:login-button>
-                        </td>
-                      </tr>
-                      <tr id="pf_facebook3" style="display:none;">
-                        <th>
-                        </th>
-                        <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '2'; needToConfirm = false;"/>
-                          <input type="submit" name="pf_update" value="Clear" onclick="$('securityNo').value = '3'; needToConfirm = false;" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Password Recovery
-                        </th>
                       </tr>
+                        </table>
+                      </div>
+                      <?php
+                      }
+                      if ($_formTab2 == 1)
+                      {
+                      ?>
+                      <div id="pf_page_2_1" class="tabContent" style="display:none;">
+                        <h2>Password recovery questions</h2>
+                        <p class="fm_expln">Manage password recovery procedure. Set verification question / answer.</p>
+                        <table class="form" cellspacing="5">
                       <tr>
                         <th>
                           <label for="pf_securitySecretQuestion">Secret Question</label>
@@ -2802,40 +3385,128 @@
                           <input type="text" name="pf_securitySecretAnswer" value="<?php print($_xml->securitySecretAnswer); ?>" id="pf_securitySecretAnswer" style="width: 220px;" />
                         </td>
                       </tr>
+                        </table>
+                      </div>
+                      <?php
+                      }
+                      if ($_formTab2 == 2)
+                      {
+                      ?>
+                      <div id="pf_page_2_2" class="tabContent" style="display:none;">
+                        <table class="form" cellspacing="5">
                       <tr>
                         <th>
+                              <label for="pf_openID">OpenID URL</label>
                         </th>
                         <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '4'; needToConfirm = false;" />
+                              <input type="text" name="pf_openID" value="<?php print($_xml->securityOpenID); ?>" id="pf_openID" style="width: 220px;" />
                         </td>
                       </tr>
+                        </table>
+                      </div>
+                      <?php
+                      }
+                      if ($_formTab2 == 3)
+                      {
+                      ?>
+                      <div id="pf_page_2_3" class="tabContent" style="display:none;">
+                        <table class="form" cellspacing="5">
                       <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Applications restrictions
+                            <th>
+                              Saved Facebook ID
                         </th>
+                            <td>
+                              <?php
+                                if (isset ($_xml->securityFacebookID))
+                                {
+                                  print ($_xml->securityFacebookName);
+                                } else {
+                                  print ('not yet');
+                                }
+                              ?>
+                            </td>
                       </tr>
                       <tr>
                         <th>
-                          <label for="pf_securitySiocLimit">SIOC Query Result Limit  </label>
                         </th>
                         <td>
-                          <input type="text" name="pf_securitySiocLimit" value="<?php print($_xml->securitySiocLimit); ?>" id="pf_securitySiocLimit" />
+                              <span id="pf_facebookData" style="min-height: 20px;"></span>
+                              <br />
+                              <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
+                              <fb:login-button autologoutlink="true"></fb:login-button>
                         </td>
                       </tr>
+                        </table>
+                      </div>
+                      <?php
+                      }
+                      if ($_formTab2 == 5)
+                      {
+                      ?>
+                      <div id="pf_page_2_4" class="tabContent" style="display:none;">
+                        <table class="form" cellspacing="5">
                       <tr>
                         <th>
+                              <label for="pf_securitySiocLimit">SIOC Query Result Limit</label>
                         </th>
                         <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '5'; needToConfirm = false;" />
+                              <input type="text" name="pf_securitySiocLimit" value="<?php print($_xml->securitySiocLimit); ?>" id="pf_securitySiocLimit" />
                         </td>
                       </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          X.509 Certificate
-                        </th>
+                        </table>
+                      </div>
+                      <?php
+                      }
+                      if ($_formTab2 == 5)
+                      {
+                      ?>
+                      <div id="pf_page_2_5" class="tabContent" style="display:none;">
+            	          <iframe id="cert" src="/ods/cert.vsp?sid=<?php print($_sid); ?>" width="650" height="270" frameborder="0" scrolling="no">
+            	            <p>Your browser does not support iframes.</p>
+            	          </iframe>
+                      </div>
+                      <?php
+                      }
+                      if ($_formTab2 == 6)
+                      {
+                      ?>
+                      <div id="pf_page_2_6" class="tabContent" style="display:none;">
+                        <h3>X.509 Certificates</h3>
+                        <?php
+                          if ($_formMode == '')
+                          {
+                        ?>
+                        <div id="pf26_list">
+                          <div style="padding: 0 0 0.5em 0;">
+                            <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add 'Fovorite'" alt="Add 'Fovorite'" src="/ods/images/icons/add_16.png"> Add</span>
+                          </div>
+                      	  <table id="pf26_tbl" class="listing">
+                      	    <thead>
+                      	      <tr class="listing_header_row">
+                        		    <th>Subject</th>
+                          		  <th>Created</th>
+                          		  <th>Fingerprint</th>
+                          		  <th>Login enabled</th>
+                        		    <th width="1%" nowrap="nowrap">Action</th>
                       </tr>
+                            </thead>
+                      	    <tbody id="pf26_tbody">
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowCertificates();});
+                              </script>
+                      	    </tbody>
+                          </table>
+                        </div>
               	      <?php
-              	        if (strlen ($_xml->certificate) <> 0)
+                          }
+                          else
+                          {
+                            print sprintf("<input type=\"hidden\" id=\"pf26_id\" name=\"pf26_id\" value=\"%s\" />", (isset ($_REQUEST['pf26_id'])) ? $_REQUEST['pf26_id'] : "0");
+                        ?>
+                        <div id="pf26_form">
+                          <table class="form" cellspacing="5">
+                            <?php
+                            if ($_formMode == 'edit')
               	        {
               	      ?>
                       <tr>
@@ -2843,7 +3514,7 @@
                 	    	  Subject
                         </th>
                         <td>
-                    		  <?php print($_xml->certificateSubject); ?>
+                          		  <span id="pf26_subject"></span>
                     		</td>
                       </tr>
                       <tr>
@@ -2851,7 +3522,15 @@
                 	    	  Agent ID
                         </th>
                         <td>
-                    		  <?php print($_xml->certificateAgentID); ?>
+                          		  <span id="pf26_agentID"></span>
+                          		</td>
+                            </tr>
+                            <tr>
+                              <th>
+                      	    	  Fingerprint
+                              </th>
+                              <td>
+                          		  <span id="pf26_fingerPrint"></span>
                     		</td>
                       </tr>
             	        <?php
@@ -2859,45 +3538,60 @@
             	        ?>
                       <tr>
                         <th valign="top">
-                          <label for="pf_certificate">Certificate</label>
+                                <label for="pf26_certificate">Certificate</label>
                         </th>
                         <td>
-                          <textarea name="pf_certificate" id="pf_certificate" rows="20" style="width: 540px;"><?php print($_xml->certificate); ?></textarea>
-              	          <?php
-              	            if (strlen($_xml->certificate) == 0)
-              	            {
-              	          ?>
-                	          <iframe id="cert" src="/ods/cert.vsp?sid=<?php print($_sid); ?>" width="200" height="200" frameborder="0" scrolling="no">
-                	            <p>Your browser does not support iframes.</p>
-                	          </iframe>
-              	          <?php
-              	            }
-              	          ?>
+                                <textarea name="pf26_certificate" id="pf26_certificate" rows="20" style="width: 560px;"></textarea>
                         </td>
                       </tr>
                       <tr>
                         <th></th>
                         <td>
                           <label>
-                            <?php print (sprintf ("<input type=\"checkbox\" name=\"pf_certificateLogin\" id=\"pf_certificateLogin\" value=\"1\" %s/>", ($_xml->certificateLogin == '1')? "checked=\"checked\"": "")); ?>
+                                  <input type="checkbox" name="pf26_enableLogin" id="pf26_enableLogin" value="1"/>
                             Enable Automatic WebID Login
                           </label>
                         </td>
                       </tr>
-                      <tr>
-                        <th>
-                        </th>
-                        <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '6'; needToConfirm = false;" />
-                          <input type="submit" name="pf_update" value="Remove" onclick="$('securityNo').value = '7'; needToConfirm = false;" />
-                          <input type="submit" name="pf_update" value="Refresh" onclick="$('securityNo').value = '99'; needToConfirm = false;" />
-                        </td>
-                      </tr>
                     </table>
+                          <script type="text/javascript">
+                            OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowCertificate();});
+                          </script>
+                          <div class="footer">
+                            <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                            <input type="submit" name="pf_update26" value="Save" onclick="needToConfirm = false; return validateInputs(this, 'pf26');"/>
+                          </div>
+                        </div>
+                        <?php
+                          }
+                        ?>
+                      </div>
+                      <?php
+                        }
+                      if ($_formTab2 < 5)
+                        {
+                      ?>
                     <div class="footer">
                       <input type="submit" name="pf_cancel" value="Cancel" onclick="needToConfirm = false;"/>
+                        <?php
+                        if (($_formTab2 == 3) and isset($_xml->securityFacebookID))
+                        {
+                        ?>
+                        <input type="submit" name="pf_clear" value="Clear" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                        <?php
+                        }
+                        ?>
+                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                      </div>
+                      <?php
+                        }
+                      ?>
                   </div>
                 </div>
+                  <?php
+                  }
+                  ?>
                 </div>
               </div>
               <?php
@@ -2915,7 +3609,7 @@
       <div id="FT_R">
         <a href="/ods/faq.html">FAQ</a> | <a href="/ods/privacy.html">Privacy</a> | <a href="/ods/rabuse.vspx">Report Abuse</a>
         <div>
-          Copyright © 1999-2010 OpenLink Software
+          Copyright © 1999-2011 OpenLink Software
         </div>
       </div>
      </div>
diff --git a/appsrc/ODS-Framework/users/users.rb b/appsrc/ODS-Framework/users/users.rb
index 24800a0..93441bf 100644
--- a/appsrc/ODS-Framework/users/users.rb
+++ b/appsrc/ODS-Framework/users/users.rb
@@ -31,10 +31,10 @@ def login_form()
     <div id="lf" class="form">
       #{display_error()}
       <div class="header">
-        User login
+        Please identify yourself
       </div>
       <ul id="lf_tabs" class="tabs">
-        <li id="lf_tab_0" title="ODS">ODS</li>
+        <li id="lf_tab_0" title="Digest">Digest</li>
         <li id="lf_tab_1" title="OpenID">OpenID</li>
         <li id="lf_tab_2" title="Facebook" style="display: none;">Facebook</li>
         <li id="lf_tab_3" title="WebID" style="display: none;">WebID</li>
@@ -45,7 +45,7 @@ def login_form()
       <table class="form" cellspacing="5">
         <tr>
           <th width="30%">
-            <label for="lf_uid">Member ID</label>
+                <label for="lf_uid">User ID</label>
           </th>
           <td nowrap="nowrap">
             <input type="text" name="lf_uid" value="" id="lf_uid" />
@@ -964,6 +964,9 @@ def main()
     <link rel="stylesheet" type="text/css" href="/ods/rdfm.css" />
     <script type="text/javascript" src="/ods/users/js/users.js"></script>
     <script type="text/javascript" src="/ods/common.js"></script>
+    <script type="text/javascript" src="/ods/typeahead.js"></script>
+    <script type="text/javascript" src="/ods/tbl.js"></script>
+    <script type="text/javascript" src="/ods/validate.js"></script>
     <script type="text/javascript">
       // OAT
       var toolkitPath="/ods/oat";
@@ -1009,7 +1012,7 @@ def main()
       <div id="FT_R">
         <a href="/ods/faq.html">FAQ</a> | <a href="/ods/privacy.html">Privacy</a> | <a href="/ods/rabuse.vspx">Report Abuse</a>
         <div>
-          Copyright © 1999-2010 OpenLink Software
+          Copyright © 1999-2011 OpenLink Software
         </div>
       </div>
      </div>
diff --git a/appsrc/ODS-Framework/users/users.vsp b/appsrc/ODS-Framework/users/users.vsp
index dac0afd..8076da9 100644
--- a/appsrc/ODS-Framework/users/users.vsp
+++ b/appsrc/ODS-Framework/users/users.vsp
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!--
  -
- -  $Id: users.vsp,v 1.1.2.22 2010/06/30 14:31:04 source Exp $
+ -  $Id: users.vsp,v 1.1.2.39 2011/03/26 14:22:26 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -36,21 +36,18 @@
     <script type="text/javascript" src="/ods/common.js"></script>
     <script type="text/javascript" src="/ods/typeahead.js"></script>
     <script type="text/javascript" src="/ods/tbl.js"></script>
+    <script type="text/javascript" src="/ods/validate.js"></script>
     <script type="text/javascript">
       // OAT
       var toolkitPath="/ods/oat";
-      var featureList = ["ajax", "json", "tab", "combolist", "calendar", "crypto", "rdfmini", "grid", "graphsvg", "tagcloud", "map", "timeline", "anchor"];
+      var featureList = ["ajax", "json", "tab", "combolist", "calendar", "rdfmini", "grid", "graphsvg", "tagcloud", "map", "timeline", "anchor"];
     </script>
     <script type="text/javascript" src="/ods/oat/loader.js"></script>
-    <script type="text/javascript">
-      OAT.MSG.attach(OAT, 'PAGE_LOADED', myInit);
-      window.onload = function(){OAT.MSG.send(OAT, 'PAGE_LOADED');};
-    </script>
   </head>
   <?vsp
     declare N integer;
     declare vHostUrl, vUrl, vParams, vResult, vRequest, vRespond any;
-    declare tmp, suffix, vSid, vRealm, vError, vForm, vFormTab, vFormSubtab, vFormMode, vXml, vAcl, xAcl, vLists, vList, items any;
+    declare tmp, suffix, vValidate, vSid, vRealm, vUserName, vError, vForm, vFormTab, vFormTab2, vFormTab3, vFormMode, vXml, vAcl, xAcl, vLists, vList, items any;
 
       vHostUrl := http_request_header (http_request_header () , 'Host' , null , sys_connected_server_address ());
       if (isstring (vHostUrl) and strchr (vHostUrl , ':') is null)
@@ -83,18 +80,53 @@
     };
 
     vError := '';
+    vValidate := 0;
+    vSid := get_keyword ('sid', params, '');
+    vRealm := 'wa';
+    if (vSid <> '')
+    {
+      vUrl := sprintf ('%s/user.validate?sid=%s&realm=%s', vHostUrl, vSid, vRealm);
+      commit work;
+      vResult := http_client_ext (
+                   vUrl,
+                   http_method=>'GET',
+                   http_headers=>vRequest,
+                   headers=>vRespond
+                 );
+      if (vRespond[0] like 'HTTP/1._ 2__ %')
+      {
+        vXml := xml_tree_doc (vResult);
+        if (xpath_eval ('/result/code', vXml))
+          vValidate := 1;
+      }
+    }
+    vUserName := get_keyword ('userName', params);
     if (get_keyword ('oid-form', params) = 'lf')
+    {
       vForm := 'login';
+    }
     else if (get_keyword ('oid-form', params) = 'rf')
+    {
       vForm := 'register';
+    }
     else
-    vForm := get_keyword ('form', params, 'login');
+    {
+      vForm := get_keyword ('form', params);
+      if (isnull (vForm))
+      {
+        if (isnull (vUserName))
+        {
+          vForm := 'login';
+        } else {
+          vForm := 'user';
+        }
+      }
+    }
     vFormTab := atoi(get_keyword ('formTab', params, '0'));
-    vFormSubtab := atoi(get_keyword ('formSubtab', params, '0'));
+    vFormTab2 := atoi(get_keyword ('formTab2', params, '0'));
+    vFormTab3 := atoi(get_keyword ('formTab3', params, '0'));
     vFormMode := get_keyword ('formMode', params, '');
-    vSid := get_keyword ('sid', params);
-    vRealm := 'wa';
-    xAcl := vector ('public', '1', 'friends', '2', 'private', '3');
+    xAcl := vector ('public', '1', 'acl', '2', 'private', '3');
 
     if (vForm = 'login')
     {
@@ -106,17 +138,51 @@
 
     if (vForm = 'profile')
     {
-      if (get_keyword ('pf_update06', params, '') <> '')
+      if (get_keyword ('pf_update051', params, '') <> '')
+      {
+        vUrl := sprintf (
+                         '%s/user.owns.%s?sid=%U&realm=%U&id=%U&flag=%U&name=%U&comment=%U&properties=%U',
+                         vHostUrl,
+                         vFormMode,
+                         vSid,
+                         vRealm,
+                         get_keyword ('pf051_id', params, ''),
+                         get_keyword ('pf051_flag', params, ''),
+                         get_keyword ('pf051_name', params, ''),
+                         get_keyword ('pf051_comment', params, ''),
+                         get_keyword ('items', params, '')
+                        );
+        commit work;
+        vResult := http_client_ext (vUrl, http_method=>'GET', http_headers=>vRequest, headers=>vRespond);
+        if (vRespond[0] like 'HTTP/1._ 4__ %' or vRespond[0] like 'HTTP/1._ 5__ %')
+        {
+          vError := vRespond[0];
+          vForm := 'login';
+        }
+        else
+        {
+          vXml := xml_tree_doc (vResult);
+          if (xpath_eval ('/failed/message', vXml))
+          {
+            vError := xpath_eval ('string (/failed/message)', vXml);
+            if (xpath_eval ('string (/failed/code)', vXml) <> '23023')
+              vForm := 'login';
+          }
+        }
+        vFormMode := '';
+      }
+      else if (get_keyword ('pf_update052', params, '') <> '')
       {
         vUrl := sprintf (
-                         '%s/user.favorites.%s?sid=%U&realm=%U&id=%U&label=%U&uri=%U&properties=%U',
+                         '%s/user.favorites.%s?sid=%U&realm=%U&id=%U&flag=%U&label=%U&uri=%U&properties=%U',
                          vHostUrl,
                          vFormMode,
                          vSid,
                          vRealm,
-                         get_keyword ('pf06_id', params, ''),
-                         get_keyword ('pf06_label', params, ''),
-                         get_keyword ('pf06_uri', params, ''),
+                         get_keyword ('pf052_id', params, ''),
+                         get_keyword ('pf052_flag', params, ''),
+                         get_keyword ('pf052_label', params, ''),
+                         get_keyword ('pf052_uri', params, ''),
                          get_keyword ('items', params, '[]')
                         );
         commit work;
@@ -138,7 +204,7 @@
         }
         vFormMode := '';
       }
-      if (get_keyword ('pf_update07', params, '') <> '')
+      if (get_keyword ('pf_update053', params, '') <> '')
       {
         vUrl := sprintf (
                          '%s/user.mades.%s?sid=%U&realm=%U&id=%U&property=%U&url=%U&description=%U',
@@ -146,10 +212,43 @@
                          vFormMode,
                          vSid,
                          vRealm,
-                         get_keyword ('pf07_id', params, ''),
-                         get_keyword ('pf07_property', params, ''),
-                         get_keyword ('pf07_url', params, ''),
-                         get_keyword ('pf07_description', params, '')
+                         get_keyword ('pf053_id', params, ''),
+                         get_keyword ('pf053_property', params, ''),
+                         get_keyword ('pf053_url', params, ''),
+                         get_keyword ('pf053_description', params, '')
+                        );
+        commit work;
+        vResult := http_client_ext (vUrl, http_method=>'GET', http_headers=>vRequest, headers=>vRespond);
+        if (vRespond[0] like 'HTTP/1._ 4__ %' or vRespond[0] like 'HTTP/1._ 5__ %')
+        {
+          vError := vRespond[0];
+          vForm := 'login';
+        }
+        else
+        {
+          vXml := xml_tree_doc (vResult);
+          if (xpath_eval ('/failed/message', vXml))
+          {
+            vError := xpath_eval ('string (/failed/message)', vXml);
+            if (xpath_eval ('string (/failed/code)', vXml) <> '23023')
+            vForm := 'login';
+          }
+        }
+        vFormMode := '';
+      }
+      else if (get_keyword ('pf_update054', params, '') <> '')
+      {
+        vUrl := sprintf (
+                         '%s/user.offers.%s?sid=%U&realm=%U&id=%U&flag=%U&name=%U&comment=%U&properties=%U',
+                         vHostUrl,
+                         vFormMode,
+                         vSid,
+                         vRealm,
+                         get_keyword ('pf054_id', params, ''),
+                         get_keyword ('pf054_flag', params, ''),
+                         get_keyword ('pf054_name', params, ''),
+                         get_keyword ('pf054_comment', params, ''),
+                         get_keyword ('items', params, '')
                         );
         commit work;
         vResult := http_client_ext (vUrl, http_method=>'GET', http_headers=>vRequest, headers=>vRespond);
@@ -170,17 +269,18 @@
         }
         vFormMode := '';
       }
-      else if (get_keyword ('pf_update08', params, '') <> '')
+      else if (get_keyword ('pf_update055', params, '') <> '')
       {
         vUrl := sprintf (
-                         '%s/user.offers.%s?sid=%U&realm=%U&id=%U&name=%U&comment=%U&properties=%U',
+                         '%s/user.seeks.%s?sid=%U&realm=%U&id=%U&flag=%U&name=%U&comment=%U&properties=%U',
                          vHostUrl,
                          vFormMode,
                          vSid,
                          vRealm,
-                         get_keyword ('pf08_id', params, ''),
-                         get_keyword ('pf08_name', params, ''),
-                         get_keyword ('pf08_comment', params, ''),
+                         get_keyword ('pf055_id', params, ''),
+                         get_keyword ('pf055_flag', params, ''),
+                         get_keyword ('pf055_name', params, ''),
+                         get_keyword ('pf055_comment', params, ''),
                          get_keyword ('items', params, '')
                         );
         commit work;
@@ -202,17 +302,20 @@
         }
         vFormMode := '';
       }
-      else if (get_keyword ('pf_update09', params, '') <> '')
+      else if (get_keyword ('pf_update056', params, '') <> '')
       {
         vUrl := sprintf (
-                         '%s/user.seeks.%s?sid=%U&realm=%U&id=%U&name=%U&comment=%U&properties=%U',
+                         '%s/user.likes.%s?sid=%U&realm=%U&id=%U&flag=%U&uri=%U&type=%U&name=%U&comment=%U&properties=%U',
                          vHostUrl,
                          vFormMode,
                          vSid,
                          vRealm,
-                         get_keyword ('pf09_id', params, ''),
-                         get_keyword ('pf09_name', params, ''),
-                         get_keyword ('pf09_comment', params, ''),
+                         get_keyword ('pf056_id', params, ''),
+                         get_keyword ('pf056_flag', params, ''),
+                         get_keyword ('pf056_uri', params, ''),
+                         get_keyword ('pf056_type', params, 'L'),
+                         get_keyword ('pf056_name', params, ''),
+                         get_keyword ('pf056_comment', params, ''),
                          get_keyword ('items', params, '')
                         );
         commit work;
@@ -229,7 +332,108 @@
           {
             vError := xpath_eval ('string (/failed/message)', vXml);
             if (xpath_eval ('string (/failed/code)', vXml) <> '23023')
+              vForm := 'login';
+          }
+        }
+        vFormMode := '';
+      }
+      else if (get_keyword ('pf_update057', params, '') <> '')
+      {
+        declare suffix, flag, uri, label varchar;
+        declare N, items any;
+
+        items := vector ();
+        if (vFormMode <> 'import')
+        {
+          items := vector_concat (items,
+                                  vector (vector (get_keyword ('pf057_id', params, ''),
+                                                  get_keyword ('pf057_flag', params, ''),
+                                                  get_keyword ('pf057_uri', params, ''),
+                                                  get_keyword ('pf057_label', params, '')
+                                                 )
+                                          )
+                                 );
+
+        } else {
+          for (N := 0; N < length (params); N := N + 2)
+          {
+            if (params [N] like 'k_fld_1_%')
+            {
+              suffix := replace (params [N], 'k_fld_1_', '');
+              flag :=  trim (params [N+1]);
+              uri :=  trim (get_keyword ('k_fld_2_'||suffix, params, ''));
+              label :=  trim (get_keyword ('k_fld_3_'||suffix, params, ''));
+              items := vector_concat (items, vector (vector ('', flag, uri, label)));
+            }
+          }
+          vFormMode := 'new';
+        }
+        foreach (any item in items) do
+        {
+          vUrl := sprintf (
+                           '%s/user.knows.%s?sid=%U&realm=%U&id=%U&flag=%U&uri=%U&label=%U',
+                           vHostUrl,
+                           vFormMode,
+                           vSid,
+                           vRealm,
+                           item[0],
+                           item[1],
+                           item[2],
+                           item[3]
+                          );
+          commit work;
+          vResult := http_client_ext (vUrl, http_method=>'GET', http_headers=>vRequest, headers=>vRespond);
+          if (vRespond[0] like 'HTTP/1._ 4__ %' or vRespond[0] like 'HTTP/1._ 5__ %')
+          {
+            vError := vRespond[0];
             vForm := 'login';
+
+            goto _exit057;
+          }
+          else
+          {
+            vXml := xml_tree_doc (vResult);
+            if (xpath_eval ('/failed/message', vXml))
+            {
+              vError := xpath_eval ('string (/failed/message)', vXml);
+              if (xpath_eval ('string (/failed/code)', vXml) <> '23023')
+              {
+                vForm := 'login';
+                goto _exit057;
+              }
+            }
+          }
+        }
+      _exit057:;
+        vFormMode := '';
+      }
+      else if (get_keyword ('pf_update26', params, '') <> '')
+      {
+        vUrl := sprintf (
+                         '%s/user.certificates.%s?sid=%U&realm=%U&id=%U&certificate=%U&enableLogin=%U',
+                         vHostUrl,
+                         vFormMode,
+                         vSid,
+                         vRealm,
+                         get_keyword ('pf26_id', params, ''),
+                         get_keyword ('pf26_certificate', params, ''),
+                         get_keyword ('pf26_enableLogin', params, '0')
+                        );
+        commit work;
+        vResult := http_client_ext (vUrl, http_method=>'GET', http_headers=>vRequest, headers=>vRespond);
+        if (vRespond[0] like 'HTTP/1._ 4__ %' or vRespond[0] like 'HTTP/1._ 5__ %')
+        {
+          vError := vRespond[0];
+          vForm := 'login';
+        }
+        else
+        {
+          vXml := xml_tree_doc (vResult);
+          if (xpath_eval ('/failed/message', vXml))
+          {
+            vError := xpath_eval ('string (/failed/message)', vXml);
+            if (xpath_eval ('string (/failed/code)', vXml) <> '23023')
+              vForm := 'login';
           }
         }
         vFormMode := '';
@@ -238,16 +442,16 @@
       {
         vFormMode := '';
       }
-      else if ((get_keyword ('pf_update', params, '') <> '') or (get_keyword ('pf_next', params, '') <> ''))
+      else if ((get_keyword ('pf_update', params, '') <> '') or (get_keyword ('pf_next', params, '') <> '') or (get_keyword ('pf_clear', params, '') <> ''))
       {
         vFormMode := '';
-        if (((vFormTab = 0) and (vFormSubtab = 3)) or ((vFormTab = 1) and (vFormSubtab = 2)))
+        if (((vFormTab = 0) and (vFormTab2 = 3)) or ((vFormTab = 1) and (vFormTab2 = 2)))
         {
           declare accountType, prefix any;
 
           accountType := 'P';
           prefix := 'x4';
-          if ((vFormTab = 1) and (vFormSubtab = 2))
+          if ((vFormTab = 1) and (vFormTab2 = 2))
           {
             accountType := 'B';
             prefix := 'y1';
@@ -298,7 +502,7 @@
             }
           }
         }
-        else if ((vFormTab = 0) and (vFormSubtab = 5))
+        else if ((vFormTab = 0) and (vFormTab2 = 5))
         {
           vUrl := vHostUrl || '/user.bioEvents.delete?sid=' || vSid || '&realm=' || vRealm || '&type=P';
           commit work;
@@ -346,13 +550,43 @@
             }
           }
         }
+        else if ((vFormTab = 2) and (vFormTab2 = 0))
+        {
+          if (get_keyword ('pf_newPassword', params, '') <> get_keyword ('pf_newPassword2', params, ''))
+          {
+            vError := 'Bad new password. Please retype!';
+          } else {
+            vUrl := vHostUrl  || '/user.password_change?' ||
+                    'sid=' || vSid ||
+                    '&realm=' || vRealm ||
+                    '&old_password=' || sprintf ('%U', get_keyword ('pf_oldPassword', params, '')) ||
+                    '&new_password=' || sprintf ('%U', get_keyword ('pf_newPassword', params, ''));
+            commit work;
+            vResult := http_client_ext (vUrl, http_method=>'GET', http_headers=>vRequest, headers=>vRespond);
+            if (vRespond[0] like 'HTTP/1._ 4__ %' or vRespond[0] like 'HTTP/1._ 5__ %')
+            {
+              vError := vRespond[0];
+              vForm := 'login';
+            }
+            else
+            {
+              vXml := xml_tree_doc (vResult);
+              if (xpath_eval ('/failed/message', vXml))
+              {
+                vError := xpath_eval ('string (/failed/message)', vXml);
+                if (xpath_eval ('string (/failed/code)', vXml) <> '23023')
+                  vForm := 'login';
+              }
+            }
+          }
+        }
         else
         {
           vUrl := vHostUrl  || '/user.update.fields';
           vParams := 'sid=' || vSid || '&realm=' || vRealm;
           if (vFormTab = 0)
       {
-            if (vFormSubtab = 0)
+            if (vFormTab2 = 0)
             {
               -- Import
               if (get_keyword ('cb_item_i_name', params, '') = '1')
@@ -406,7 +640,7 @@
               if (get_keyword ('cb_item_i_onlineAccounts', params, '') = '1')
                 vParams := vParams || sprintf ('&onlineAccounts=%U', get_keyword ('i_onlineAccounts', params, ''));
             }
-            if (vFormSubtab = 1)
+            if (vFormTab2 = 1)
             {
               -- Main
               vParams := vParams ||
@@ -422,6 +656,9 @@
                   '&mailSignature=' ||          sprintf ('%U', get_keyword ('pf_mailSignature', params, '')) ||
                   '&summary=' ||       sprintf ('%U', get_keyword ('pf_summary', params, '')) ||
                   '&appSetting=' ||    sprintf ('%U', get_keyword ('pf_appSetting', params, '0')) ||
+                  '&spbEnable=' ||     sprintf ('%U', get_keyword ('pf_spbEnable', params, '0')) ||
+                  '&inSearch=' ||      sprintf ('%U', get_keyword ('pf_inSearch', params, '0')) ||
+                  '&showActive=' ||    sprintf ('%U', get_keyword ('pf_showActive', params, '0')) ||
                   '&photo=' ||         sprintf ('%U', get_keyword ('pf_photo', params, '')) ||
                   '&photoContent=' ||  sprintf ('%U', get_keyword ('pf_photoContent', params, '')) ||
                   '&audio=' ||         sprintf ('%U', get_keyword ('pf_audio', params, '')) ||
@@ -458,7 +695,7 @@
               }
               vParams := vParams || sprintf ('&topicInterests=%U', tmp);
             }
-            if (vFormSubtab = 2)
+            if (vFormTab2 = 2)
             {
               vParams := vParams ||
                 '&homeDefaultMapLocation=' || sprintf ('%U', get_keyword ('pf_homeDefaultMapLocation', params, '')) ||
@@ -475,7 +712,7 @@
                   '&homePhoneExt=' ||           sprintf ('%U', get_keyword ('pf_homePhoneExt', params, '')) ||
                   '&homeMobile=' ||             sprintf ('%U', get_keyword ('pf_homeMobile', params, ''));
             }
-            if (vFormSubtab = 4)
+            if (vFormTab2 = 4)
             {
               vParams := vParams ||
                   '&icq=' ||                    sprintf ('%U', get_keyword ('pf_icq', params, '')) ||
@@ -497,7 +734,7 @@
           }
           if (vFormTab = 1)
           {
-            if (vFormSubtab = 0)
+            if (vFormTab2 = 0)
             {
               vParams := vParams ||
                 '&businessIndustry=' ||       sprintf ('%U', get_keyword ('pf_businessIndustry', params, '')) ||
@@ -513,7 +750,7 @@
                   '&businessNetwork=' ||        sprintf ('%U', get_keyword ('pf_businessNetwork', params, '')) ||
                   '&businessResume=' ||         sprintf ('%U', get_keyword ('pf_businessResume', params, ''));
             }
-            if (vFormSubtab = 1)
+            if (vFormTab2 = 1)
             {
               vParams := vParams ||
                 '&businessCountry=' ||        sprintf ('%U', get_keyword ('pf_businesscountry', params, '')) ||
@@ -529,7 +766,7 @@
                   '&businessPhoneExt=' ||  sprintf ('%U', get_keyword ('pf_businessPhoneExt', params, '')) ||
                   '&businessMobile=' ||         sprintf ('%U', get_keyword ('pf_businessMobile', params, ''));
             }
-            if (vFormSubtab = 3)
+            if (vFormTab2 = 3)
             {
               vParams := vParams ||
                   '&businessIcq=' ||            sprintf ('%U', get_keyword ('pf_businessIcq', params, '')) ||
@@ -551,32 +788,31 @@
           }
           if (vFormTab = 2)
           {
-            declare securityNo any;
+            -- Passrord recovery
+            if (vFormTab2 = 1)
+              vParams := vParams ||
+                  '&securitySecretQuestion=' || sprintf ('%U', get_keyword ('pf_securitySecretQuestion', params, '')) ||
+                  '&securitySecretAnswer=' || sprintf ('%U', get_keyword ('pf_securitySecretAnswer', params, ''));
 
-            securityNo := get_keyword('securityNo', params, '');
-            if (securityNo = '1')
+            -- OpenID
+            if (vFormTab2 = 2)
               vParams := vParams || '&securityOpenID=' || sprintf ('%U', get_keyword ('pf_openID', params, ''));
 
-            if (securityNo = '2')
+            -- Facebook
+            if (vFormTab2 = 3)
+            {
+              if (get_keyword ('pf_clear', params, '') <> '')
+              {
+                vParams := vParams || '&securityFacebookID=';
+              } else {
               vParams := vParams || '&securityFacebookID=' || sprintf ('%U', get_keyword ('pf_securityFacebookID', params, ''));
+              }
+            }
 
-            if (securityNo = '3')
-              vParams := vParams || '&securityFacebookID=';
-
-            if (securityNo = '4')
-              vParams := vParams ||
-                '&securitySecretQuestion=' || sprintf ('%U', get_keyword ('pf_securitySecretQuestion', params, '')) ||
-                  '&securitySecretAnswer=' ||   sprintf ('%U', get_keyword ('pf_securitySecretAnswer', params, ''));
-
-            if (securityNo = '5')
+            -- Limits
+            if (vFormTab2 = 4)
               vParams := vParams || '&securitySiocLimit=' || sprintf ('%U', get_keyword ('pf_securitySiocLimit', params, ''));
 
-            if (securityNo = '6')
-              vParams := vParams ||
-                  '&certificate=' || sprintf ('%U', get_keyword ('pf_certificate', params, '')) ||
-                  '&certificateLogin=' || sprintf ('%U', get_keyword ('pf_certificateLogin', params, '0'));
-            if (securityNo = '7')
-              vParams := vParams || '&certificate=&certificateLogin=';
           }
         commit work;
         vResult := http_client_ext (
@@ -633,15 +869,17 @@
         }
         if (get_keyword ('pf_next', params, '') <> '')
         {
-          vFormSubtab := vFormSubtab + 1;
+          vFormTab2 := vFormTab2 + 1;
           if (
-              ((vFormTab = 1) and (vFormSubtab > 3)) or
-              (vFormTab > 1)
+              ((vFormTab = 1) and (vFormTab2 > 3)) or
+              ((vFormTab = 2) and (vFormTab2 > 6))
              )
           {
             vFormTab := vFormTab + 1;
-            vFormSubtab := 0;
+            vFormTab2 := 0;
           }
+          if (vFormTab > 2)
+            vFormTab := 0;
         }
       }
       else if (get_keyword ('pf_cancel', params, '') <> '')
@@ -655,7 +893,7 @@
       if (get_keyword ('uf_profile', params, '') <> '')
       {
         vFormTab := 0;
-        vFormSubtab := 0;
+        vFormTab2 := 0;
         vForm := 'profile';
     }
     }
@@ -663,8 +901,8 @@
     if ((vForm = 'user') or (vForm = 'profile'))
     {
       vUrl := sprintf ('%s/user.info?sid=%s&realm=%s', vHostUrl, vSid, vRealm);
-      if (vForm = 'profile')
-        vUrl := vUrl || '&short=0';
+      if ((vForm = 'user') and not isnull (vUserName))
+        vUrl := vUrl || sprintf ('&name=%s', vUserName);
       commit work;
       vResult := http_client_ext (
                    vUrl,
@@ -753,7 +991,8 @@
       <input type="hidden" name="realm" id="realm" value="<?V vRealm ?>" />
       <input type="hidden" name="form" id="form" value="<?V vForm ?>" />
       <input type="hidden" name="formTab" id="formTab" value="<?V vFormTab ?>" />
-      <input type="hidden" name="formSubtab" id="formSubtab" value="<?V vFormSubtab ?>" />
+      <input type="hidden" name="formTab2" id="formTab2" value="<?V vFormTab2 ?>" />
+      <input type="hidden" name="formTab3" id="formTab3" value="<?V vFormTab3 ?>" />
       <input type="hidden" name="formMode" id="formMode" value="<?V vFormMode ?>" />
       <input type="hidden" name="items" id="items" value="" />
       <input type="hidden" name="securityNo" id="securityNo" value="" />
@@ -761,16 +1000,27 @@
         <div id="ob_left">
           <?vsp
             if (vForm in ('user', 'profile'))
-              http (sprintf ('<b>User</b>: %s, <b>Profile</b>: <a href="#" onclick="javascript: return profileSubmit();">Edit</a> / <a href="#" onclick="javascript: return userSubmit();">View</a>', xpath_eval ('string (/user/fullName)', vXml)));
+            {
+              http (sprintf ('<b>User</b>: %s', xpath_eval ('string (/user/fullName)', vXml)));
+              if (vValidate)
+                http (sprintf (', <b>Profile</b>: <a href="#" onclick="javascript: return profileSubmit();">Edit</a> / <a href="#" onclick="javascript: return userSubmit();">View</a>'));
+            }
           ?>
         </div>
         <div id="ob_right">
         <?vsp
-          if ((vForm <> 'login') and (vForm <> 'register'))
+          if (vForm in ('user', 'profile'))
+          {
+            if (vValidate)
           {
         ?>
           <a href="#" onclick="javascript: return logoutSubmit();">Logout</a> 
         <?vsp
+            } else {
+        ?>
+          <a href="#" onclick="javascript: return logoutSubmit();">Login</a> 
+        <?vsp
+            }
           }
         ?>
       </div>
@@ -792,13 +1042,15 @@
                     http ('<div class="error">' || vError || '</div>');
                 ?>
                 <div class="header">
-                  User login
+                  Please identify yourself
                 </div>
                 <ul id="lf_tabs" class="tabs">
-                  <li id="lf_tab_0" title="ODS">ODS</li>
+                  <li id="lf_tab_0" title="Digest">Digest</li>
                   <li id="lf_tab_1" title="OpenID" style="display: none;">OpenID</li>
                   <li id="lf_tab_2" title="Facebook" style="display: none;">Facebook</li>
                   <li id="lf_tab_3" title="WebID" style="display: none;">WebID</li>
+                  <li id="lf_tab_4" title="Twitter" style="display: none;">Twitter</li>
+                  <li id="lf_tab_5" title="LinkedIn" style="display: none;">LinkedIn</li>
                 </ul>
                 <div style="min-height: 120px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                   <div id="lf_content"></div>
@@ -806,10 +1058,10 @@
                 <table class="form" cellspacing="5">
                   <tr>
                     <th width="30%">
-                      <label for="lf_uid">Member ID</label>
+                          <label for="lf_uid">User ID</label>
                     </th>
                         <td>
-                      <input type="text" name="lf_uid" value="" id="lf_uid" />
+                          <input type="text" name="lf_uid" value="" id="lf_uid" style="width: 150px;" />
                     </td>
                   </tr>
                   <tr>
@@ -817,7 +1069,7 @@
                       <label for="lf_password">Password</label>
                     </th>
                         <td>
-                      <input type="password" name="lf_password" value="" id="lf_password" />
+                          <input type="password" name="lf_password" value="" id="lf_password" style="width: 150px;" />
                     </td>
                   </tr>
                     </table>
@@ -829,7 +1081,7 @@
                           <label for="lf_openId">OpenID URL</label>
                     </th>
                         <td>
-                          <input type="text" name="lf_openId" value="" id="lf_openId" class="openId"  style="width: 220px;" />
+                          <input type="text" name="lf_openId" value="" id="lf_openId" style="width: 300px;" />
                         </td>
                   </tr>
                     </table>
@@ -852,6 +1104,32 @@
                     <table id="lf_table_3" class="form" cellspacing="5">
                     </table>
                   </div>
+                  <div id="lf_page_4" class="tabContent" style="display: none">
+                    <table id="lf_table_4" class="form" cellspacing="5">
+                      <tr>
+                        <th width="30%">
+                        </th>
+                        <td>
+                          <span id="lf_twitter" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="lf_twitterButton" src="/ods/images/sign-in-with-twitter-d.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                  <div id="lf_page_5" class="tabContent" style="display: none;">
+                    <table id="lf_table_5" class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%">
+                        </th>
+                        <td>
+                          <span id="lf_linkedin" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="lf_linkedinButton" src="/ods/images/linkedin-large.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
                 </div>
                 <div class="footer">
                   <input type="submit" name="lf_login" value="Login" id="lf_login" onclick="javascript: return lfLoginSubmit();" />
@@ -865,48 +1143,50 @@
               ?>
               <div id="rf" class="form">
                 <div class="header">
-                  User register
+                  User Registration
                 </div>
                 <ul id="rf_tabs" class="tabs">
-                  <li id="rf_tab_0" title="ODS">ODS</li>
+                  <li id="rf_tab_0" title="Digest">Digest</li>
                   <li id="rf_tab_1" title="OpenID" style="display: none;">OpenID</li>
                   <li id="rf_tab_2" title="Facebook" style="display: none;">Facebook</li>
                   <li id="rf_tab_3" title="WebID" style="display: none;">WebID</li>
+                  <li id="rf_tab_4" title="Twitter" style="display: none;">Twitter</li>
+                  <li id="rf_tab_5" title="LinkedIn" style="display: none;">LinkedIn</li>
                 </ul>
                 <div style="min-height: 135px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                   <div id="rf_content"></div>
                   <div id="rf_page_0" class="tabContent" >
                     <table id="rf_table_0" class="form" cellspacing="5">
-                      <tr id="rf_login_1">
-                        <th>
+                      <tr>
+                        <th width="30%">
                           <label for="rf_uid">Login Name<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td>
-                          <input type="text" name="rf_uid" value="" id="rf_uid" />
+                          <input type="text" name="rf_uid" value="" id="rf_uid" style="width: 150px;" />
                         </td>
                       </tr>
-                      <tr id="rf_login_2">
+                      <tr>
                         <th>
                           <label for="rf_email">E-mail<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td>
-                          <input type="text" name="rf_email" value="" id="rf_email" size="40"/>
+                          <input type="text" name="rf_email" value="" id="rf_email" style="width: 300px;" />
                         </td>
                       </tr>
-                      <tr id="rf_login_3">
+                      <tr>
                         <th>
                           <label for="rf_password">Password<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td>
-                          <input type="password" name="rf_password" value="" id="rf_password" />
+                          <input type="password" name="rf_password" value="" id="rf_password" style="width: 150px;" />
                         </td>
                       </tr>
-                      <tr id="rf_login_4">
+                      <tr>
                         <th>
                           <label for="rf_password2">Password (verify)<div style="font-weight: normal; display:inline; color:red;"> *</div></label>
                         </th>
                         <td>
-                          <input type="password" name="rf_password2" value="" id="rf_password2" />
+                          <input type="password" name="rf_password2" value="" id="rf_password2" style="width: 150px;" />
                         </td>
                       </tr>
                     </table>
@@ -918,7 +1198,7 @@
                           <label for="rf_openId">OpenID</label>
                         </th>
                         <td>
-                          <input type="text" name="rf_openId" value="" id="rf_openId" size="40"/>
+                          <input type="text" name="rf_openId" value="" id="rf_openId" style="width: 300px;" />
                         </td>
                       </tr>
                     </table>
@@ -941,6 +1221,32 @@
                     <table id="rf_table_3" class="form" cellspacing="5">
                     </table>
                   </div>
+                  <div id="rf_page_4" class="tabContent" style="display: none">
+                    <table id="rf_table_4" class="form" cellspacing="5">
+                      <tr>
+                        <th width="30%">
+                        </th>
+                        <td>
+                          <span id="rf_twitter" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="rf_twitterButton" src="/ods/images/sign-in-with-twitter-d.png" border="0"/></a>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
+                  <div id="rf_page_5" class="tabContent" style="display: none;">
+                    <table id="rf_table_5" class="form" cellspacing="5">
+                      <tr>
+                        <th width="20%">
+                        </th>
+                        <td>
+                          <span id="rf_linkedin" style="min-height: 20px;"></span>
+                          <br />
+                          <img id="rf_linkedinButton" src="/ods/images/linkedin-large.png" border="0"/>
+                        </td>
+                      </tr>
+                    </table>
+                  </div>
                 </div>
                 <div>
                   <table class="form" cellspacing="5">
@@ -966,133 +1272,30 @@
                 <div class="header">
                   User profile
                 </div>
+                <div id="uf_div" style="clear: both;">
+                <?vsp
+                  declare xt any;
 
-                <div id="uf_div_new" style="clear: both;">
-                </div>
-                <div id="uf_div" style="clear: both; display: none;">
-              	  <div id="u_profile_l">
-              	    <div id="user_info_w" class="widget user_info_w">
-              	      <div class="w_title" id="userProfilePhotoName">
-              	        <h3></h3>
-              	      </div>
-              	      <div class="w_content">
-                        <div class="user_img_ctr">
-                          <a href="javascript:void(0)">
-                       		  <img alt="Profile image" id="userProfilePhotoImg" rel="foaf:depiction" class="prof_photo" src="/ods/images/profile.png"/>
-                          </a>
-                        </div> <!-- user_img_ctr -->
-                        <div class="gems_ctr">
-                          <div class="prof_user_gems" id="profileUserGems">
-                            <div class="gem">
-                              <a href="javascript:void(0)" id="uf_foaf_gem" target="_blank"><img src="/ods/images/icons/foaf.png" alt="FOAF"/></a>
-                            </div>
-                            <div class="gem">
-                              <a href="javascript:void(0)" id="uf_sioc_gem" target="_blank"><img src="/ods/images/icons/sioc_button.png" alt="SIOC"/></a>
-                            </div>
-                            <div class="gem">
-                              <a href="javascript:void(0)" id="uf_vcard_gem" target="_blank"><img src="/ods/images/icons/vcard.png" alt="VCARD"/></a>
-                            </div>
-                          </div> <!-- prof_user_gems -->
-                        </div> <!-- gems_ctr -->
-                      </div> <!-- w_content -->
-          	        </div> <!-- .widget -->
-
-            	      <div id="ds_w" class="widget ds_w">
-            	        <div class="w_title">
-                        <h3>Data Space</h3>
-          		          <div class="w_title_bar_btns">
-                    		  <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                    		</div> <!-- w_title_bar_btns -->
-          	          </div> <!-- w_title -->
-            	        <div class="w_content">
-                        <ul class="ds_list" id="ds_list">
-                        </ul> <!-- ds_list -->
-                        <div class="cmd_ctr"> </div>
-                      </div> <!-- w_content -->
-                    </div> <!-- .widget -->
-
-              	    <div id="connections_w" class="widget connections_w">
-              	      <div class="w_title">
-                        <h3 id="connPTitleTxt">Connections</h3>
-                        <div class="w_title_bar_btns">
-                          <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                        </div> <!-- w_title_bar_btns -->
-              	      </div> <!-- w_title -->
-            	        <div class="w_content" id="connP1" style="height: 200px;">
-                      </div> <!-- w_content -->
-            	      </div> <!-- .widget -->
-
-                    <div id="groups_w" class="widget groups_w" style="display: none;">
-            	        <div class="w_title">
-            	          <h3 id="discussionsTitleTxt">Discussion Groups ()</h3>
-            	        </div>
-            	        <div class="w_content" id="discussionsCtr">
-                      </div> <!-- w_content -->
-            	      </div> <!-- .widget -->
-          	      </div>
+                  vUrl := sprintf ('%s/user.info.webID?webID=%s', vHostUrl, xpath_eval ('string(/user/iri)', vXml));
+                  commit work;
+                  vResult := http_client_ext (
+                               vUrl,
+                               http_method=>'GET',
+                               http_headers=>vRequest,
+                               headers=>vRespond
+                             );
+                  if (vRespond[0] like 'HTTP/1._ 4__ %' or vRespond[0] like 'HTTP/1._ 5__ %')
+                    goto _skip;
 
-              	  <div id="u_profile_r" style="width: 100%;">
-                    <div class="widget w_contact" about="#THIS" instanceof="foaf:Person">
-                      <div class="w_title">
-                        <h3>Contact Information</h3>
-                        <div class="w_title_bar_btns">
-                    		  <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                    		</div>
-                      </div>
-                      <div class="w_content">
-                <ul id="uf_tabs" class="tabs">
-                  <li id="uf_tab_0" title="Personal">Personal</li>
-                  <li id="uf_tab_1" title="Messaging Services">Messaging Services</li>
-                  <li id="uf_tab_2" title="Home">Home</li>
-                  <li id="uf_tab_3" title="Business">Business</li>
-                  <li id="uf_tab_4" title="Data Explorer">Data Explorer</li>
-                </ul>
-                <div style="min-height: 180px; border: 1px solid #aaa; margin: -13px 5px 5px 5px;">
-                  <div id="uf_content"></div>
-                  <div id="uf_page_0" class="tabContent" >
-                    <table id="uf_table_0" class="form" cellspacing="5">
-                    </table>
-                  </div>
-                  <div id="uf_page_1" class="tabContent" style="display: none">
-                    <table id="uf_table_1" class="form" cellspacing="5">
-                    </table>
-                  </div>
-                  <div id="uf_page_2" class="tabContent" style="display: none">
-                    <table id="uf_table_2" class="form" cellspacing="5">
-                    </table>
-                  </div>
-                  <div id="uf_page_3" class="tabContent" style="display: none">
-                    <table id="uf_table_3" class="form" cellspacing="5">
-                </table>
-                  </div>
-                  <div id="uf_page_4" class="tabContent" style="display: none">
-                    <div id="uf_rdf_content">
-                       
-                    </div>
-                  </div>
-                  <script type="text/javascript">
-                            // OAT.MSG.attach(OAT, "PAGE_LOADED", function (){cRDF.open("<?V xpath_eval ('string (/user/iri)', vXml) ?>");});
-                  </script>
-                </div>
-                      </div>
-                    </div>
+                  vXml := xml_tree_doc (vResult);
+                  if (xpath_eval ('/failed/message', vXml))
+                    goto _skip;
 
-                    <div id="notify" class="notify_w widget">
-                      <div class="w_title">
-                        <h3>Activities</h3>
-                        <div class="w_title_bar_btns">
-                      	  <img src="/ods/images/skin/default/menu_dd_handle_close.png" alt="Minimize" class="w_toggle" onclick="widgetToggle(this);"/>
-                      	</div> <!-- w_title_bar_btns -->
-                      </div>
-                      <div class="w_content" id="notify_content">
-                        .
-                      </div>
-                    </div>
-                  </div>
+                  xt := xslt ('file://vad/vsp/wa/users/users.xsl', vXml);
+                  http_value (xt);
+                _skip:;
+                ?>
                 </div>
-                <script type="text/javascript">
-                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){selectProfile();});
-                </script>
               </div>
               <?vsp
               }
@@ -1113,25 +1316,25 @@
                   <li id="pf_tab_2" title="Security">Security</li>
                 </ul>
                 <div style="min-height: 180px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                  <?vsp
+                  if (vFormTab = 0)
+                  {
+                  ?>
                   <div id="pf_page_0" class="tabContent" style="display:none;">
                     <ul id="pf_tabs_0" class="tabs">
-                      <li id="pf_tab_0_0" title="Import">Profile Import</li>
-                      <li id="pf_tab_0_1" title="Main">Main</li>
-                      <li id="pf_tab_0_2" title="Address">Address</li>
-                      <li id="pf_tab_0_3" title="Online Accounts">Online Accounts</li>
-                      <li id="pf_tab_0_4" title="Messaging Services">Messaging Services</li>
-                      <li id="pf_tab_0_5" title="Biographical Events">Biographical Events</li>
-                      <li id="pf_tab_0_6" title="Favorite Things">Favorite Things</li>
-                      <li id="pf_tab_0_7" title="Creator Of">Creator Of</li>
-                      <li id="pf_tab_0_8" title="My Offers">My Offers</li>
-                      <li id="pf_tab_0_9" title="Offers I Seek">Offers I Seek</li>
+                      <li id="pf_tab_0_0">Profile Import</li>
+                      <li id="pf_tab_0_1">Main</li>
+                      <li id="pf_tab_0_2">Address</li>
+                      <li id="pf_tab_0_3">Online Accounts</li>
+                      <li id="pf_tab_0_4">Messaging Services</li>
+                      <li id="pf_tab_0_5">Others</li>
                     </ul>
-                    <div style="min-height: 180px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
-                      <div id="pf_page_0_0" class="tabContent" style="display:none;">
+                    <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                         <?vsp
-                        if ((vFormTab = 0) and (vFormSubtab = 0))
+                      if (vFormTab2 = 0)
                         {
                         ?>
+                      <div id="pf_page_0_0" class="tabContent" style="display:none;">
                     <table class="form" cellspacing="5">
                       <tr>
                             <th>
@@ -1155,15 +1358,13 @@
                           <tbody id="i_tbody">
                           </tbody>
                         </table>
-                        <?vsp
-                        }
-                        ?>
                       </div>
-                      <div id="pf_page_0_1" class="tabContent" style="display:none;">
                         <?vsp
-                        if ((vFormTab = 0) and (vFormSubtab = 1))
+                      }
+                      if (vFormTab2 = 1)
                         {
                         ?>
+                      <div id="pf_page_0_1" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                           <tr>
                             <th>
@@ -1189,7 +1390,7 @@
                           <select name="pf_title" id="pf_title">
                             <option></option>
                             <?vsp
-                              items := vector ('Mr', 'Mrs', 'Dr', 'Ms');
+                                  items := vector ('Mr', 'Mrs', 'Dr', 'Ms', 'Sir');
                               foreach (any item in items) do
                                 http (sprintf('<option %s>%s</option>', case when (item = xpath_eval ('string (/user/title)', vXml)) then 'selected="selected"' else '' end, item));
                             ?>
@@ -1294,7 +1495,7 @@
                         </td>
                       </tr>
                       <tr>
-                        <th>
+                            <th valign="top">
                           <label for="pf_homepage">Personal Webpage</label>
                         </th>
                         <td>
@@ -1308,7 +1509,7 @@
                         </td>
                       </tr>
                       <tr>
-                            <th>
+                            <th valign="top">
                               <label for="pf_foaf">Other Personal URIs (Web IDs)</label>
                         </th>
                             <td valign="top">
@@ -1328,12 +1529,12 @@
                                       </thead>
                                       <tr id="x1_tr_no" style="display: none;"><td colspan="2"><b>No Personal URIs</b></td></tr>
                                       <script type="text/javascript">
-                                        OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowRows("x1", "<?V replace(cast (xpath_eval ('string (/user/webIDs)', vXml) as varchar), '\n', '\\n') ?>", ["\n"], function(prefix, val1){TBL.createRow(prefix, null, {fld_1: {value: val1, className: '_validate_ _url_ _canEmpty_'}});});});
+                                        OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowRows("x1", "<?V replace(cast (xpath_eval ('string (/user/webIDs)', vXml) as varchar), '\n', '\\n') ?>", ["\n"], function(prefix, val1){TBL.createRow(prefix, null, {fld_1: {value: val1, className: '_validate_ _webid_ _canEmpty_'}});});});
                                       </script>
                                     </table>
                                   </td>
                                   <td valign="top" nowrap="nowrap">
-                                    <span class="button pointer" onclick="TBL.createRow('x1', null, {fld_1: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                                    <span class="button pointer" onclick="TBL.createRow('x1', null, {fld_1: {className: '_validate_ _webid_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                                     <select name="pf_acl_webIDs" id="pf_acl_webIDs">
                                       <?vsp
                                         for (N := 0; N < length (xAcl); N := N + 2)
@@ -1346,7 +1547,7 @@
                         </td>
                       </tr>
                       <tr>
-                        <th>
+                            <th valign="top">
                               <label for="pf_mailSignature">Mail Signature</label>
                         </th>
                         <td>
@@ -1354,7 +1555,7 @@
                         </td>
                       </tr>
                       <tr>
-                        <th>
+                            <th valign="top">
                               <label for="pf_summary">Summary</label>
                         </th>
                             <td valign="top" >
@@ -1368,7 +1569,7 @@
                         </td>
                       </tr>
                       <tr>
-                        <th>
+                            <th valign="top">
                               <label>Web page URL indicating a topic of interest</label>
                         </th>
                             <td valign="top">
@@ -1508,29 +1709,59 @@
                             </td>
                           </tr>
                           <tr>
-                            <th>
-                              <label for="pf_set_0_1">Set access for all fields as </label>
+                            <td> </td>
+                            <td>
+                              <label>
+                                <?vsp
+                                  http (sprintf('<input type="checkbox" id="pf_spbEnable" name="pf_spbEnable" value="1" %s>', case when (xpath_eval ('string (/user/spbEnable)', vXml) = '1') then 'checked="checked"' else '' end));
+                                ?>
+                                <b>Enable Semantic Pingback for ACLs</b>
+                              </label>
+                            </td>
+                          </tr>
+                          <tr>
+                            <td> </td>
+                            <td>
+                             <label>
+                                <?vsp
+                                  http (sprintf('<input type="checkbox" id="pf_inSearch" name="pf_inSearch" value="1" %s>', case when (xpath_eval ('string (/user/inSearch)', vXml) = '1') then 'checked="checked"' else '' end));
+                                ?>
+                               <b>Include my profile in search results</b>
+                             </label>
+                            </td>
+                          </tr>
+                          <tr>
+                            <td> </td>
+                            <td>
+                             <label>
+                                <?vsp
+                                  http (sprintf('<input type="checkbox" id="pf_showActive" name="pf_showActive" value="1" %s>', case when (xpath_eval ('string (/user/showActive)', vXml) = '1') then 'checked="checked"' else '' end));
+                                ?>
+                               <b>Include in User active information</b>
+                             </label>
+                            </td>
+                          </tr>
+                          <tr>
+                            <th>
+                              <label for="pf_set_0_1">Set access for all fields as </label>
                             </th>
                             <td>
                               <select name="pf_set_0_1" id="pf_set_0_1" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
                           </tr>
                     </table>
-                        <?vsp
-                        }
-                        ?>
                   </div>
-
-                      <div id="pf_page_0_2" class="tabContent" style="display:none;">
                         <?vsp
-                        if ((vFormTab = 0) and (vFormSubtab = 2))
+                      }
+                      if (vFormTab2 = 2)
                         {
                         ?>
+                      <div id="pf_page_0_2" class="tabContent" style="display:none;">
                     <table class="form" cellspacing="5">
                       <tr>
                         <th width="30%">
@@ -1665,7 +1896,7 @@
                               <input type="text" name="pf_homelng" value="<?V xpath_eval ('string (/user/homeLongitude)', vXml) ?>" id="pf_homelng" style="width: 110px;" />
                               <label>
                                 <input type="checkbox" name="pf_homeDefaultMapLocation" id="pf_homeDefaultMapLocation" onclick="javascript: setDefaultMapLocation('home', 'business');" />
-                                Default Map Location
+                                Use as default map location
                               </label>
                         </td>
                       </tr>
@@ -1701,22 +1932,19 @@
                               <select name="pf_set_0_2" id="pf_set_0_2" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                         </td>
                       </tr>
                     </table>
-                        <?vsp
-                        }
-                        ?>
                   </div>
-
-                      <div id="pf_page_0_3" class="tabContent" style="display:none;">
                         <?vsp
-                        if ((vFormTab = 0) and (vFormSubtab = 3))
+                      }
+                      if (vFormTab2 = 3)
                         {
                         ?>
+                      <div id="pf_page_0_3" class="tabContent" style="display:none;">
                         <input type="hidden" name="c_nick" value="<?V xpath_eval ('string (/user/nickName)', vXml) ?>" id="c_nick" />
                     <table class="form" cellspacing="5">
                       <tr>
@@ -1728,7 +1956,7 @@
                                       Select from Service List ot Type New One
                         </th>
                                     <th>
-                                      Member Home Page URL
+                                      Member Home Page URI
                                     </th>
                                     <th width="65px">
                                       Action
@@ -1737,25 +1965,22 @@
                                 </thead>
                                 <tr id="x4_tr_no" style="display: none;"><td colspan="3"><b>No Services</b></td></tr>
                                 <script type="text/javascript">
-                                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOnlineAccounts("x4", "P", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1, className: '_validate_ _url_ _canEmpty_'}, fld_2: {value: val2}});});});
+                                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOnlineAccounts("x4", "P", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1}, fld_2: {value: val2, className: '_validate_ _uri_ _canEmpty_'}});});});
                                 </script>
                               </table>
                             </td>
                             <td valign="top" nowrap="1">
-                              <span class="button pointer" onclick="TBL.createRow('x4', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                              <span class="button pointer" onclick="TBL.createRow('x4', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _uri_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                             </td>
                           </tr>
                         </table>
-                        <?vsp
-                        }
-                        ?>
                       </div>
-
-                      <div id="pf_page_0_4" class="tabContent" style="display:none;">
                         <?vsp
-                        if ((vFormTab = 0) and (vFormSubtab = 4))
+                      }
+                      if (vFormTab2 = 4)
                         {
                         ?>
+                      <div id="pf_page_0_4" class="tabContent" style="display:none;">
                         <table id="x6_tbl" class="form" cellspacing="5">
                           <tr>
                             <th width="30%">
@@ -1843,7 +2068,7 @@
                               <select name="pf_set_0_4" id="pf_set_0_4" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
@@ -1852,16 +2077,29 @@
                             OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowRows("x6", "<?V replace(cast (xpath_eval ('string (/user/messaging)', vXml) as varchar), '\n', '\\n') ?>", ["\n", ";"], function(prefix, val1, val2){TBL.createRow(prefix, null, {fld_1: {value: val1}, fld_2: {value: val2, cssText: 'width: 220px;'}});});});
                           </script>
                         </table>
+                      </div>
                         <?vsp
                         }
+                      if (vFormTab2 = 5)
+                      {
                         ?>
-                      </div>
-
                       <div id="pf_page_0_5" class="tabContent" style="display:none;">
+                        <ul id="pf_tabs_0_5" class="tabs">
+                          <li id="pf_tab_0_5_0">Biographical Events</li>
+                          <li id="pf_tab_0_5_1">Owns</li>
+                          <li id="pf_tab_0_5_2">Favorite Things</li>
+                          <li id="pf_tab_0_5_3">Creator Of</li>
+                          <li id="pf_tab_0_5_4">My Offers</li>
+                          <li id="pf_tab_0_5_5">Offers I Seek</li>
+                          <li id="pf_tab_0_5_6">Likes & DisLikes</li>
+                          <li id="pf_tab_0_5_7">Social Network</li>
+                        </ul>
+                        <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
                         <?vsp
-                        if ((vFormTab = 0) and (vFormSubtab = 5))
+                          if (vFormTab3 = 0)
                         {
                         ?>
+                          <div id="pf_page_0_5_0" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                           <tr>
                             <td width="600px">
@@ -1893,28 +2131,119 @@
                             </td>
                           </tr>
                         </table>
+                          </div>
                         <?vsp
                         }
+                          if (vFormTab3 = 1)
+                          {
+                          ?>
+                          <div id="pf_page_0_5_1" class="tabContent" style="display:none;">
+                            <h3>Owns</h3>
+                            <?vsp
+                              if (vFormMode = '')
+                              {
                         ?>
+                            <div id="pf051_list">
+                              <div style="padding: 0 0 0.5em 0;">
+                                <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Offer" alt="Add Offer" src="/ods/images/icons/add_16.png"> Add</span>
+                              </div>
+                          	  <table id="pf051_tbl" class="listing">
+                          	    <thead>
+                          	      <tr class="listing_header_row">
+                            		    <th>Name</th>
+                            		    <th>Description</th>
+                            		    <th width="1%" nowrap="nowrap">Action</th>
+                          	      </tr>
+                                </thead>
+                          	    <tbody id="pf051_tbody">
+                                  <script type="text/javascript">
+                                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOwns();});
+                                  </script>
+                          	    </tbody>
+                              </table>
                       </div>
-
                       <?vsp
-                      if (vFormTab = 0)
+                              }
+                              else
                       {
-                        if (vFormSubtab = 6)
+                                http (sprintf ('<input type="hidden" id="pf051_id" name="pf051_id" value="%s" />', get_keyword ('pf051_id', params, '0')));
+                            ?>
+                            <div id="pf051_form">
+                              <table class="form" cellspacing="5">
+              		        		  <tr>
+                                  <th width="25%">
+              		                  Access
+              		                </th>
+              		                <td>
+                                    <select name="pf051_flag" id="pf051_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Name
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf051_name" id="pf051_name" value="" class="_validate_" style="width: 400px;">
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Comment
+                                  </th>
+                                  <td>
+                                    <textarea name="pf051_comment" id="pf051_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                                  </td>
+                                </tr>
+              		        		  <tr>
+              		        		    <th valign="top">
+              		                  Products
+              		                </th>
+              		                <td width="800px">
+                                    <table id="ow_tbl" class="listing">
+                                      <tbody id="ow_tbody">
+                                        <tr id="ow_throbber">
+                                          <td>
+                                            <img src="/ods/images/oat/Ajax_throbber.gif" />
+                                          </td>
+                                        </tr>
+                                      </tbody>
+                                    </table>
+                                    <input type="hidden" id="ow_no" name="ow_no" value="1" />
+                                  </td>
+                                </tr>
+                              </table>
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOwn();});
+                              </script>
+                              <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                                <input type="submit" name="pf_update051" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf051');"/>
+                              </div>
+                            </div>
+                            <?vsp
+                              }
+                            ?>
+                          </div>
+                          <?vsp
+                          }
+                          if (vFormTab3 = 2)
                         {
                       ?>
-                      <div id="pf_page_0_6" class="tabContent" style="display:none;">
+                          <div id="pf_page_0_5_2" class="tabContent" style="display:none;">
                         <h3>Favorites</h3>
                         <?vsp
                           if (vFormMode = '')
                         {
                         ?>
-                        <div id="pf06_list">
+                            <div id="pf052_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add 'Fovorite'" alt="Add 'Fovorite'" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf06_tbl" class="listing">
+                          	  <table id="pf052_tbl" class="listing">
                                 <thead>
                                   <tr class="listing_header_row">
                         		    <th>Label</th>
@@ -1922,7 +2251,7 @@
                         		    <th width="1%" nowrap="nowrap">Action</th>
                                   </tr>
                                 </thead>
-                      	    <tbody id="pf06_tbody">
+                          	    <tbody id="pf052_tbody">
                                   <script type="text/javascript">
                                     OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowFavorites();});
                                   </script>
@@ -1933,16 +2262,28 @@
                           }
                           else
                           {
-                            http (sprintf ('<input type="hidden" id="pf06_id" name="pf06_id" value="%s" />', get_keyword ('pf06_id', params, '0')));
+                                http (sprintf ('<input type="hidden" id="pf052_id" name="pf052_id" value="%s" />', get_keyword ('pf052_id', params, '0')));
                         ?>
-                        <div id="pf06_form">
+                            <div id="pf052_form">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
+              		                  Access
+              		                </th>
+              		                <td>
+                                    <select name="pf052_flag" id="pf052_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
                                 Label (*)
                               </th>
                               <td>
-                                <input type="text" name="pf06_label" id="pf06_label" value="" class="_validate_" style="width: 400px;">
+                                    <input type="text" name="pf052_label" id="pf052_label" value="" class="_validate_" style="width: 400px;">
                             </td>
                             </tr>
                             <tr>
@@ -1950,7 +2291,7 @@
                                 External URI
                               </th>
                               <td>
-                                <input type="text" name="pf06_uri" id="pf06_uri" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
+                                    <input type="text" name="pf052_uri" id="pf052_uri" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
                             </td>
                           </tr>
                             <tr>
@@ -1970,7 +2311,7 @@
                           </script>
                           <div class="footer">
                             <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false; "/>
-                            <input type="submit" name="pf_update06" value="Save" onclick="myBeforeSubmit(); return validateInputs(this);"/>
+                                <input type="submit" name="pf_update052" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf052');"/>
                           </div>
                         </div>
                         <?vsp
@@ -1979,20 +2320,20 @@
                       </div>
                       <?vsp
                         }
-                        else if (vFormSubtab = 7)
+                          if (vFormTab3 = 3)
                         {
                       ?>
-                      <div id="pf_page_0_7" class="tabContent" style="display:none;">
+                          <div id="pf_page_0_5_3" class="tabContent" style="display:none;">
                         <h3>Creator Of</h3>
                         <?vsp
                           if (vFormMode = '')
                           {
                         ?>
-                        <div id="pf07_list">
+                            <div id="pf053_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add 'Creator Of'" alt="Add 'Creator Of'" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf07_tbl" class="listing">
+                          	  <table id="pf053_tbl" class="listing">
                       	    <thead>
                       	      <tr class="listing_header_row">
                         		    <th>Made Property</th>
@@ -2000,7 +2341,7 @@
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf07_tbody">
+                          	    <tbody id="pf053_tbody">
                               <script type="text/javascript">
                                 OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowMades();});
                               </script>
@@ -2011,9 +2352,9 @@
                           }
                           else
                           {
-                            http (sprintf ('<input type="hidden" id="pf07_id" name="pf07_id" value="%s" />', get_keyword ('pf07_id', params, '0')));
+                                http (sprintf ('<input type="hidden" id="pf053_id" name="pf053_id" value="%s" />', get_keyword ('pf053_id', params, '0')));
                         ?>
-                        <div id="pf07_form">
+                            <div id="pf053_form">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
@@ -2024,7 +2365,7 @@
                                   function p_init ()
                                   {
                                     var fld = new OAT.Combolist([]);
-                                    fld.input.name = 'pf07_property';
+                                        fld.input.name = 'pf053_property';
                                     fld.input.id = fld.input.name;
                                     fld.input.style.width = "400px";
                                     $("if_opt").appendChild(fld.div);
@@ -2041,7 +2382,7 @@
                                 URI
                               </th>
                               <td>
-                                <input type="text" name="pf07_url" id="pf07_url" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
+                                    <input type="text" name="pf053_url" id="pf053_url" value="" class="_validate_ _url_ _canEmpty_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -2049,7 +2390,7 @@
                                 Description (*)
                               </th>
                               <td>
-                                <textarea name="pf07_description" id="pf07_description" style="width: 400px;"></textarea>
+                                    <textarea name="pf053_description" id="pf053_description" style="width: 400px;"></textarea>
                               </td>
                             </tr>
                             <tr>
@@ -2064,7 +2405,7 @@
                           </script>
                           <div class="footer">
                             <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false; "/>
-                            <input type="submit" name="pf_update07" value="Save" onclick="needToConfirm = false; return validateInputs(this);"/>
+                                <input type="submit" name="pf_update053" value="Save" onclick="needToConfirm = false; return validateInputs(this, 'pf053');"/>
                           </div>
                         </div>
                         <?vsp
@@ -2073,20 +2414,20 @@
                       </div>
                       <?vsp
                         }
-                        else if (vFormSubtab = 8)
+                          if (vFormTab3 = 4)
                         {
                       ?>
-                      <div id="pf_page_0_8" class="tabContent" style="display:none;">
+                          <div id="pf_page_0_5_4" class="tabContent" style="display:none;">
                         <h3>My Offers</h3>
                         <?vsp
                           if (vFormMode = '')
                           {
                         ?>
-                        <div id="pf08_list">
+                            <div id="pf054_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Offer" alt="Add Offer" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf08_tbl" class="listing">
+                          	  <table id="pf054_tbl" class="listing">
                       	    <thead>
                       	      <tr class="listing_header_row">
                         		    <th>Name</th>
@@ -2094,7 +2435,7 @@
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf08_tbody">
+                          	    <tbody id="pf054_tbody">
                               <script type="text/javascript">
                                 OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOffers();});
                               </script>
@@ -2105,16 +2446,28 @@
                           }
                           else
                           {
-                            http (sprintf ('<input type="hidden" id="pf08_id" name="pf08_id" value="%s" />', get_keyword ('pf08_id', params, '0')));
+                                http (sprintf ('<input type="hidden" id="pf054_id" name="pf054_id" value="%s" />', get_keyword ('pf054_id', params, '0')));
                         ?>
-                        <div id="pf08_form">
+                            <div id="pf054_form">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
+              		                  Access
+              		                </th>
+              		                <td>
+                                    <select name="pf054_flag" id="pf054_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
                                 Name
                               </th>
                               <td>
-                                <input type="text" name="pf08_name" id="pf08_name" value="" class="_validate_" style="width: 400px;">
+                                    <input type="text" name="pf054_name" id="pf054_name" value="" class="_validate_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -2122,7 +2475,7 @@
                                 Comment
                               </th>
                               <td>
-                                <textarea name="pf08_comment" id="pf08_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                                    <textarea name="pf054_comment" id="pf054_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
                               </td>
                             </tr>
                   				  <tr>
@@ -2132,6 +2485,11 @@
                   		        <td width="800px">
                                 <table id="ol_tbl" class="listing">
                                   <tbody id="ol_tbody">
+                                    <tr id="ol_throbber">
+                                      <td>
+                                        <img src="/ods/images/oat/Ajax_throbber.gif" />
+                                      </td>
+                                    </tr>
                                   </tbody>
                                 </table>
                                 <input type="hidden" id="ol_no" name="ol_no" value="1" />
@@ -2143,7 +2501,7 @@
                           </script>
                           <div class="footer">
                             <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
-                            <input type="submit" name="pf_update08" value="Save" onclick="myBeforeSubmit(); return validateInputs(this);"/>
+                                <input type="submit" name="pf_update054" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf054');"/>
                           </div>
                         </div>
                         <?vsp
@@ -2152,20 +2510,20 @@
                       </div>
                       <?vsp
                         }
-                        else if (vFormSubtab = 9)
+                          if (vFormTab3 = 5)
                         {
                       ?>
-                      <div id="pf_page_0_9" class="tabContent" style="display:none;">
+                          <div id="pf_page_0_5_5" class="tabContent" style="display:none;">
                         <h3>Offers I Seek</h3>
                         <?vsp
                           if (vFormMode = '')
                           {
                         ?>
-                        <div id="pf09_list">
+                            <div id="pf055_list">
                           <div style="padding: 0 0 0.5em 0;">
                             <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Seek" alt="Add Seek" src="/ods/images/icons/add_16.png"> Add</span>
                           </div>
-                      	  <table id="pf09_tbl" class="listing">
+                          	  <table id="pf055_tbl" class="listing">
                       	    <thead>
                       	      <tr class="listing_header_row">
                         		    <th>Name</th>
@@ -2173,7 +2531,7 @@
                         		    <th width="1%" nowrap="nowrap">Action</th>
                       	      </tr>
                             </thead>
-                      	    <tbody id="pf09_tbody">
+                          	    <tbody id="pf055_tbody">
                               <script type="text/javascript">
                                 OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowSeeks();});
                               </script>
@@ -2184,16 +2542,28 @@
                           }
                           else
                           {
-                            http (sprintf ('<input type="hidden" id="pf09_id" name="pf09_id" value="%s" />', get_keyword ('pf09_id', params, '0')));
+                                http (sprintf ('<input type="hidden" id="pf055_id" name="pf055_id" value="%s" />', get_keyword ('pf055_id', params, '0')));
                         ?>
-                        <div id="pf09_form">
+                            <div id="pf055_form">
                           <table class="form" cellspacing="5">
                             <tr>
                               <th width="25%">
+              		                  Access
+              		                </th>
+              		                <td>
+                                    <select name="pf055_flag" id="pf055_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
                                 Name
                               </th>
                               <td>
-                                <input type="text" name="pf09_name" id="pf09_name" value="" class="_validate_" style="width: 400px;">
+                                    <input type="text" name="pf055_name" id="pf055_name" value="" class="_validate_" style="width: 400px;">
                               </td>
                             </tr>
                             <tr>
@@ -2201,7 +2571,7 @@
                                 Comment
                               </th>
                               <td>
-                                <textarea name="pf09_comment" id="pf09_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                                    <textarea name="pf055_comment" id="pf055_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
                               </td>
                             </tr>
                   				  <tr>
@@ -2211,6 +2581,11 @@
                   		        <td width="800px">
                                 <table id="wl_tbl" class="listing">
                                   <tbody id="wl_tbody">
+                                    <tr id="wl_throbber">
+                                      <td>
+                                        <img src="/ods/images/oat/Ajax_throbber.gif" />
+                                      </td>
+                                    </tr>
                                   </tbody>
                                 </table>
                                 <input type="hidden" id="wl_no" name="wl_no" value="1" />
@@ -2222,7 +2597,7 @@
                           </script>
                           <div class="footer">
                             <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
-                            <input type="submit" name="pf_update09" value="Save" onclick="myBeforeSubmit(); return validateInputs(this);"/>
+                                <input type="submit" name="pf_update055" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf055');"/>
                           </div>
                         </div>
                         <?vsp
@@ -2231,21 +2606,278 @@
                       </div>
                       <?vsp
                         }
+                          if (vFormTab3 = 6)
+                        {
+                      ?>
+                          <div id="pf_page_0_5_6" class="tabContent" style="display:none;">
+                        <h3>Likes & DisLikes</h3>
+                        <?vsp
+                          if (vFormMode = '')
+                          {
+                        ?>
+                            <div id="pf056_list">
+                          <div style="padding: 0 0 0.5em 0;">
+                            <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Like" alt="Add Like" src="/ods/images/icons/add_16.png"> Add</span>
+                          </div>
+                          	  <table id="pf056_tbl" class="listing">
+                      	    <thead>
+                      	      <tr class="listing_header_row">
+                            		    <th width="10%">Type</th>
+                            		    <th width="45%">URI</th>
+                            		    <th width="45%">Name</th>
+                        		    <th width="1%" nowrap="nowrap">Action</th>
+                      	      </tr>
+                            </thead>
+                          	    <tbody id="pf056_tbody">
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowLikes();});
+                              </script>
+                      	    </tbody>
+                          </table>
+                        </div>
+                        <?vsp
+                          }
+                          else
+                          {
+                                http (sprintf ('<input type="hidden" id="pf056_id" name="pf056_id" value="%s" />', get_keyword ('pf056_id', params, '0')));
+                        ?>
+                            <div id="pf056_form">
+                          <table class="form" cellspacing="5">
+                            <tr>
+                              <th width="25%">
+              		                  Access
+              		                </th>
+              		                <td>
+                                    <select name="pf056_flag" id="pf056_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                Type
+                              </th>
+                              <td>
+                                    <select name="pf056_type" id="pf056_type">
+                                  <option value="L">Like</option>
+                                  <option value="DL">DisLike</option>
+                                </select>
+                              </td>
+                            </tr>
+                            <tr>
+                              <th>
+                                    URI (*)
+                              </th>
+                              <td>
+                                    <input type="text" name="pf056_uri" id="pf056_uri" value="" class="_validate_ _uri_" style="width: 400px;">
+                              </td>
+                            </tr>
+                            <tr>
+                              <th>
+                                    Name (*)
+                              </th>
+                              <td>
+                                    <input type="text" name="pf056_name" id="pf056_name" value="" class="_validate_" style="width: 400px;">
+                              </td>
+                            </tr>
+                            <tr>
+                              <th>
+                                Comment
+                              </th>
+                              <td>
+                                    <textarea name="pf056_comment" id="pf056_comment" class="_validate_ _canEmpty_" style="width: 400px;"></textarea>
+                              </td>
+                            </tr>
+                  				  <tr>
+                  				    <th valign="top">
+		                            Properties
+                  		        </th>
+                  		        <td width="800px">
+                                <table id="ld_tbl" class="listing">
+                                  <tbody id="ld_tbody">
+                                    <tr id="ld_throbber">
+                                      <td>
+                                        <img src="/ods/images/oat/Ajax_throbber.gif" />
+                                      </td>
+                                    </tr>
+                                  </tbody>
+                                </table>
+                                <input type="hidden" id="ld_no" name="ld_no" value="1" />
+                              </td>
+                            </tr>
+                          </table>
+                          <script type="text/javascript">
+                            OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowLike();});
+                          </script>
+                          <div class="footer">
+                            <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                                <input type="submit" name="pf_update056" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf056');"/>
+                              </div>
+                            </div>
+                            <?vsp
+                              }
+                            ?>
+                          </div>
+                          <?vsp
+                          }
+                          if (vFormTab3 = 7)
+                          {
+                          ?>
+                          <div id="pf_page_0_5_7" class="tabContent" style="display:none;">
+                            <h3>Social Network</h3>
+                            <?vsp
+                              if (vFormMode = '')
+                              {
+                            ?>
+                            <div id="pf057_list">
+                              <div style="padding: 0 0 0.5em 0;">
+                                <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add Knows" alt="Add Knows" src="/ods/images/icons/add_16.png"> Add</span>
+                                <span onclick="javascript: $('formMode').value = 'import'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Import Knows" alt="Import Knows" src="/ods/images/icons/go_16.png"> Import</span>
+                          </div>
+                          	  <table id="pf057_tbl" class="listing">
+                          	    <thead>
+                          	      <tr class="listing_header_row">
+                            		    <th width="50%">Label</th>
+                            		    <th width="50%">URI</th>
+                            		    <th width="1%" nowrap="nowrap">Action</th>
+                          	      </tr>
+                                </thead>
+                          	    <tbody id="pf057_tbody">
+                                  <script type="text/javascript">
+                                    OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowKnows();});
+                                  </script>
+                          	    </tbody>
+                              </table>
+                        </div>
+                        <?vsp
+                          }
+                              else if (vFormMode = 'import')
+                              {
+                        ?>
+                            <div id="pf057_import">
+                              <table>
+                      				  <tr>
+                      				    <th width="100px">
+                      		          Source
+                      		        </th>
+                                  <td>
+                                    <input type="text" class="_validate_ _uri_" size="100" value="" id="k_import" name="k_import">
+                                    <input type="button" class="button" onclick="javascript: knowsData(); return false;" value="Download">
+                                    <img style="display: none;" src="/ods/images/oat/Ajax_throbber.gif" alt="Import knows URIs" id="k_import_image">
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                  </th><td>
+                                    <table class="listing" id="k_tbl">
+                                      <thead>
+                                        <tr class="listing_header_row">
+                                          <th>
+                                            Access
+                                          </th>
+                                          <th width="50%">
+                                            URI
+                                          </th>
+                                          <th width="50%">
+                                            Label
+                                          </th>
+                                          <th width="65px">
+                                            Action
+                                          </th>
+                                        </tr>
+                                      </thead>
+                                      <tbody>
+                                        <tr id="k_tr_no">
+                                           <td colspan="3">
+                                             <b>No downloaded items</b>
+                                           </td>
+                                        </tr>
+                                      </tbody>
+                                    </table>
+                                  </td>
+                                </tr>
+                              </table>
+                              <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                                <input type="submit" name="pf_update057" value="Import" onclick="myBeforeSubmit(); return true;"/>
+                              </div>
+                      </div>
+                      <?vsp
+                        }
                         else
                         {
+                                http (sprintf ('<input type="hidden" id="pf057_id" name="pf057_id" value="%s" />', get_keyword ('pf057_id', params, '0')));
+                            ?>
+                            <div id="pf057_form">
+                              <table class="form" cellspacing="5">
+              		        		  <tr>
+                                  <th width="25%">
+              		                  Access
+              		                </th>
+              		                <td>
+                                    <select name="pf057_flag" id="pf057_flag">
+                                      <option value="1">public</option>
+                                      <option value="2">acl</option>
+                                      <option value="3">private</option>
+                                    </select>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    URI (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf057_uri" id="pf057_uri" value="" class="_validate_ _uri_" style="width: 400px;">
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <th>
+                                    Label (*)
+                                  </th>
+                                  <td>
+                                    <input type="text" name="pf057_label" id="pf057_label" value="" class="_validate_" style="width: 400px;">
+                                  </td>
+                                </tr>
+                              </table>
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowKnow();});
+                              </script>
+                              <div class="footer">
+                                <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                                <input type="submit" name="pf_update057" value="Save" onclick="myBeforeSubmit(); return validateInputs(this, 'pf057');"/>
+                              </div>
+                            </div>
+                            <?vsp
+                              }
+                            ?>
+                          </div>
+                          <?vsp
+                          }
+                          ?>
+                        </div>
+                      </div>
+                    </div>
+                    <?vsp
+                    }
+                    if (vFormTab2 < 5)
+                    {
                       ?>
                       <div class="footer">
                         <input type="submit" name="pf_cancel" value="Cancel" onclick="needToConfirm = false;"/>
-                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit ();"/>
-                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit ();"/>
+                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
                       </div>
                       <?vsp
                         }
-                      }
                       ?>
                     </div>
-                  </div>
-
+                  <?vsp
+                  }
+                  if (vFormTab = 1)
+                  {
+                  ?>
                   <div id="pf_page_1" class="tabContent" style="display:none;">
                     <ul id="pf_tabs_1" class="tabs">
                       <li id="pf_tab_1_0" title="Main">Main</li>
@@ -2253,7 +2885,11 @@
                       <li id="pf_tab_1_2" title="Online Accounts">Online Accounts</li>
                       <li id="pf_tab_1_3" title="Messaging Services">Messaging Services</li>
                     </ul>
-                    <div style="min-height: 180px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                    <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                      <?vsp
+                      if (vFormTab2 = 0)
+                      {
+                      ?>
                       <div id="pf_page_1_0" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                           <tr>
@@ -2461,14 +3097,18 @@
                               <select name="pf_set_1_0" id="pf_set_1_0" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
                           </tr>
                         </table>
                       </div>
-
+                      <?vsp
+                      }
+                      if (vFormTab2 = 1)
+                      {
+                      ?>
                       <div id="pf_page_1_1" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                           <tr>
@@ -2602,7 +3242,7 @@
                               <input type="text" name="pf_businesslng" value="<?V xpath_eval ('string (/user/businessLongitude)', vXml) ?>" id="pf_businesslng" style="width: 110px;" />
                               <label>
                                 <input type="checkbox" name="pf_businessDefaultMapLocation" id="pf_businessDefaultMapLocation" onclick="javascript: setDefaultMapLocation('business', 'home');" />
-                                Default Map Location
+                                Use as default map location
                               </label>
                         </td>
                       </tr>
@@ -2638,14 +3278,18 @@
                               <select name="pf_set_1_1" id="pf_set_1_1" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                         </td>
                       </tr>
                         </table>
                       </div>
-
+                      <?vsp
+                      }
+                      if (vFormTab2 = 2)
+                      {
+                      ?>
                       <div id="pf_page_1_2" class="tabContent" style="display:none;">
                         <table class="form" cellspacing="5">
                       <tr>
@@ -2657,7 +3301,7 @@
                                       Select from Service List ot Type New One
                         </th>
                         <th>
-                                      Member Home Page URL
+                                      Member Home Page URI
                         </th>
                                     <th width="65px">
                                       Action
@@ -2666,17 +3310,21 @@
                                 </thead>
                                 <tr id="y1_tr_no" style="display: none;"><td colspan="3"><b>No Services</b></td></tr>
                                 <script type="text/javascript">
-                                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOnlineAccounts("y1", "B", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 1, value: val1, className: '_validate_ _url_ _canEmpty_'}, fld_2: {value: val2}});});});
+                                  OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowOnlineAccounts("y1", "B", function(prefix, val0, val1, val2){TBL.createRow(prefix, null, {id: val0, fld_1: {mode: 10, value: val1}, fld_2: {value: val2, className: '_validate_ _uri_ _canEmpty_'}});});});
                                 </script>
                               </table>
                             </td>
                             <td valign="top" nowrap="1">
-                              <span class="button pointer" onclick="TBL.createRow('y1', null, {fld_1: {mode: 1}, fld_2: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
+                              <span class="button pointer" onclick="TBL.createRow('y1', null, {fld_1: {mode: 10}, fld_2: {className: '_validate_ _url_ _canEmpty_'}});"><img class="button" src="/ods/images/icons/add_16.png" border="0" alt="Add Row" title="Add Row" /> Add</span>
                         </td>
                       </tr>
                         </table>
                       </div>
-
+                      <?vsp
+                      }
+                      if (vFormTab2 = 3)
+                      {
+                      ?>
                       <div id="pf_page_1_3" class="tabContent" style="display:none;">
                         <table id="y2_tbl" class="form" cellspacing="5">
                       <tr>
@@ -2765,7 +3413,7 @@
                               <select name="pf_set_1_3" id="pf_set_1_3" value="0" class="dummy" onchange="javascript: pfSetACLSelects (this)">
                                 <option value="0">*no change*</option>
                                 <option value="1">public</option>
-                                <option value="2">friends</option>
+                                <option value="2">acl</option>
                                 <option value="3">private</option>
                               </select>
                             </td>
@@ -2775,27 +3423,49 @@
                           </script>
                     </table>
                       </div>
-
+                      <?vsp
+                      }
+                      ?>
                       <div class="footer">
                         <input type="submit" name="pf_cancel" value="Cancel" onclick="needToConfirm = false;"/>
-                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit ();"/>
-                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit ();"/>
+                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
                       </div>
                     </div>
                   </div>
-
+                  <?vsp
+                  }
+                  if (vFormTab = 2)
+                  {
+                  ?>
                   <div id="pf_page_2" class="tabContent" style="display:none;">
+                    <ul id="pf_tabs_2" class="tabs">
+                      <li id="pf_tab_2_0" title="Password">Password</li>
+                      <li id="pf_tab_2_1" title="Password Recovery">Password Recovery</li>
+                      <li id="pf_tab_2_2" title="OpenID">OpenID</li>
+                      <li id="pf_tab_2_3" title="Facebook" style="display:none;">Facebook</li>
+                      <li id="pf_tab_2_4" title="Limits">Limits</li>
+                      <li id="pf_tab_2_5" title="Certificate Generator" style="display:none;">Certificate Generator</li>
+                      <li id="pf_tab_2_6" title="X.509 Certificates">X.509 Certificates</li>
+                    </ul>
+                    <div style="min-height: 180px; min-width: 650px; border-top: 1px solid #aaa; margin: -13px 5px 5px 5px;">
+                      <?vsp
+                      if (vFormTab2 = 0)
+                      {
+                      ?>
+                      <div id="pf_page_2_0" class="tabContent" style="display:none;">
+                        <h2>Change login password</h2>
+                        <p class="fm_expln">For your security, please use a password not found in a dictionary, consisting of both letters, and numbers or non-alphanumeric characters.</p>
                     <table class="form" cellspacing="5">
                       <tr>
                         <td align="center" colspan="2">
                           <span id="pf_change_txt"></span>
                         </td>
                       </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Password Settings
-                        </th>
-                      </tr>
+                          <?vsp
+                          if (xpath_eval ('string (/user/noPassword)', vXml) = '0')
+                          {
+                          ?>
                       <tr>
                         <th width="30%">
                           <label for="pf_oldPassword">Old Password</label>
@@ -2804,8 +3474,11 @@
                           <input type="password" name="pf_oldPassword" value="" id="pf_oldPassword" />
                         </td>
                       </tr>
+                          <?vsp
+                          }
+                          ?>
                       <tr>
-                        <th>
+                            <th width="30%">
                           <label for="pf_newPassword">New Password</label>
                         </th>
                         <td>
@@ -2823,65 +3496,18 @@
                       <tr>
                         <th>
                         </th>
-                        <td>
-                          <input type="button" name="pf_change" value="Change" onclick="javascript: return pfChangeSubmit();" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          OpenID
-                        </th>
-                      </tr>
-                      <tr>
-                        <th>
-                          <label for="pf_openID">OpenID URL</label>
-                        </th>
-                        <td>
-                          <input type="text" name="pf_openID" value="<?V xpath_eval ('string (/user/securityOpenID)', vXml) ?>" id="pf_openID" style="width: 220px;" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th>
-                        </th>
-                        <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '1'; needToConfirm = false;" />
-                        </td>
-                      </tr>
-                      <tr id="pf_facebook" style="display:none;">
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Facebook
-                        </th>
-                      </tr>
-                      <tr id="pf_facebook1" style="display:none;">
-                        <th>
-                          Saved Facebook ID
-                        </th>
-                        <td>
-                        </td>
-                      </tr>
-                      <tr id="pf_facebook2" style="display:none;">
-                        <th>
-                        </th>
-                        <td>
-                          <span id="pf_facebookData" style="min-height: 20px;"></span>
-                          <br />
-                          <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
-                          <fb:login-button autologoutlink="true"></fb:login-button>
-                        </td>
-                      </tr>
-                      <tr id="pf_facebook3" style="display:none;">
-                        <th>
-                        </th>
-                        <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="return pfUpdateSubmit(32);"/>
-                          <input type="submit" name="pf_update" value="Clear" onclick="return pfUpdateSubmit(33);" />
-                        </td>
-                      </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Password Recovery
-                        </th>
                       </tr>
+                        </table>
+                      </div>
+                      <?vsp
+                      }
+                      if (vFormTab2 = 1)
+                      {
+                      ?>
+                      <div id="pf_page_2_1" class="tabContent" style="display:none;">
+                        <h2>Password recovery questions</h2>
+                        <p class="fm_expln">Manage password recovery procedure. Set verification question / answer.</p>
+                        <table class="form" cellspacing="5">
                       <tr>
                         <th>
                           <label for="pf_securitySecretQuestion">Secret Question</label>
@@ -2913,44 +3539,128 @@
                           <input type="text" name="pf_securitySecretAnswer" value="<?V xpath_eval ('string (/user/securitySecretAnswer)', vXml) ?>" id="pf_securitySecretAnswer" style="width: 220px;" />
                         </td>
                       </tr>
+                        </table>
+                      </div>
+                      <?vsp
+                      }
+                      if (vFormTab2 = 2)
+                      {
+                      ?>
+                      <div id="pf_page_2_2" class="tabContent" style="display:none;">
+                        <table class="form" cellspacing="5">
                       <tr>
                         <th>
+                              <label for="pf_openID">OpenID URL</label>
                         </th>
                         <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '2'; needToConfirm = false;"/>
+                              <input type="text" name="pf_openID" value="<?V xpath_eval ('string (/user/securityOpenID)', vXml) ?>" id="pf_openID" style="width: 220px;" />
                         </td>
                       </tr>
+                        </table>
+                      </div>
+                      <?vsp
+                      }
+                      if (vFormTab2 = 3)
+                      {
+                      ?>
+                      <div id="pf_page_2_3" class="tabContent" style="display:none;">
+                        <table class="form" cellspacing="5">
                       <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          Applications restrictions
+                            <th>
+                              Saved Facebook ID
                         </th>
+                            <td>
+                              <?vsp
+                                if (isnull (xpath_eval ('/user/securityFacebookID', vXml)))
+                                {
+                                  http ('not yet');
+                                } else {
+                                  http (xpath_eval ('string (/user/securityFacebookName)', vXml));
+                                }
+                              ?>
+                            </td>
                       </tr>
                       <tr>
                         <th>
-                          <label for="pf_securitySiocLimit">SIOC Query Result Limit  </label>
                         </th>
                         <td>
-                          <input type="text" name="pf_securitySiocLimit" value="<?V xpath_eval ('string (/user/securitySiocLimit)', vXml) ?>" id="pf_securitySiocLimit" />
+                              <span id="pf_facebookData" style="min-height: 20px;"></span>
+                              <br />
+                              <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
+                              <fb:login-button autologoutlink="true"></fb:login-button>
                         </td>
                       </tr>
+                        </table>
+                      </div>
+                      <?vsp
+                      }
+                      if (vFormTab2 = 4)
+                      {
+                      ?>
+                      <div id="pf_page_2_4" class="tabContent" style="display:none;">
+                        <table class="form" cellspacing="5">
                       <tr>
                         <th>
+                              <label for="pf_securitySiocLimit">SIOC Query Result Limit</label>
                         </th>
                         <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '3'; needToConfirm = false;" />
+                              <input type="text" name="pf_securitySiocLimit" value="<?V xpath_eval ('string (/user/securitySiocLimit)', vXml) ?>" id="pf_securitySiocLimit" />
                         </td>
                       </tr>
-                      <tr>
-                        <th style="text-align: left; background-color: #F6F6F6;" colspan="2">
-                          X.509 Certificate
-                        </th>
+                        </table>
+                      </div>
+                      <?vsp
+                      }
+                      if (vFormTab2 = 5)
+                      {
+                      ?>
+                      <div id="pf_page_2_5" class="tabContent" style="display:none;">
+            	          <iframe id="cert" src="/ods/cert.vsp?sid=<?V vSid ?>" width="650" height="270" frameborder="0" scrolling="no">
+            	            <p>Your browser does not support iframes.</p>
+            	          </iframe>
+                      </div>
+                      <?vsp
+                      }
+                      if (vFormTab2 = 6)
+                      {
+                      ?>
+                      <div id="pf_page_2_6" class="tabContent" style="display:none;">
+                        <h3>X.509 Certificates</h3>
+                        <?vsp
+                          if (vFormMode = '')
+                          {
+                        ?>
+                        <div id="pf26_list">
+                          <div style="padding: 0 0 0.5em 0;">
+                            <span onclick="javascript: $('formMode').value = 'new'; $('page_form').submit();" class="button pointer"><img class="button" border="0" title="Add 'Fovorite'" alt="Add 'Fovorite'" src="/ods/images/icons/add_16.png"> Add</span>
+                          </div>
+                      	  <table id="pf26_tbl" class="listing">
+                      	    <thead>
+                      	      <tr class="listing_header_row">
+                        		    <th>Subject</th>
+                          		  <th>Created</th>
+                          		  <th>Fingerprint</th>
+                          		  <th>Login enabled</th>
+                        		    <th width="1%" nowrap="nowrap">Action</th>
                       </tr>
+                            </thead>
+                      	    <tbody id="pf26_tbody">
+                              <script type="text/javascript">
+                                OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowCertificates();});
+                              </script>
+                      	    </tbody>
+                          </table>
+                        </div>
               	      <?vsp
-              	        declare certificate, certificateLogin any;
-
-              	        certificate := xpath_eval ('string (/user/certificate)', vXml);
-              	        certificateLogin := xpath_eval ('string (/user/certificateLogin)', vXml);
-              	        if (length (certificate))
+                          }
+                          else
+                          {
+                            http (sprintf ('<input type="hidden" id="pf26_id" name="pf26_id" value="%s" />', get_keyword ('pf26_id', params, '0')));
+                        ?>
+                        <div id="pf26_form">
+                          <table class="form" cellspacing="5">
+                            <?vsp
+                            if (vFormMode = 'edit')
               	        {
               	      ?>
                       <tr>
@@ -2958,7 +3668,7 @@
                 	    	  Subject
                         </th>
                         <td>
-                    		  <?vsp http_value (xpath_eval ('string (/user/certificateSubject)', vXml), 'b'); ?>
+                          		  <span id="pf26_subject"></span>
                     		</td>
                       </tr>
                       <tr>
@@ -2966,7 +3676,15 @@
                 	    	  Agent ID
                         </th>
                         <td>
-                    		  <?vsp http_value (xpath_eval ('string (/user/certificateAgentID)', vXml),'b'); ?>
+                          		  <span id="pf26_agentID"></span>
+                          		</td>
+                            </tr>
+                            <tr>
+                              <th>
+                      	    	  Fingerprint
+                              </th>
+                              <td>
+                          		  <span id="pf26_fingerPrint"></span>
                     		</td>
                       </tr>
             	        <?vsp
@@ -2974,45 +3692,60 @@
             	        ?>
                       <tr>
                         <th valign="top">
-                          <label for="pf_certificate">Certificate  </label>
+                                <label for="pf26_certificate">Certificate</label>
                         </th>
                         <td>
-                          <textarea name="pf_certificate" id="pf_certificate" rows="20" style="width: 540px;"><?V certificate ?></textarea>
-              	          <?vsp
-              	            if (not length (certificate) and xenc_key_exists ('id_rsa'))
-              	            {
-              	          ?>
-                	          <iframe id="cert" src="/ods/cert.vsp?sid=<?V vSid ?>" width="200" height="200" frameborder="0" scrolling="no">
-                	            <p>Your browser does not support iframes.</p>
-                	          </iframe>
-              	          <?vsp
-              	            }
-              	          ?>
+                                <textarea name="pf26_certificate" id="pf26_certificate" rows="20" style="width: 560px;"></textarea>
                         </td>
                       </tr>
                       <tr>
                         <th></th>
                         <td>
                           <label>
-                            <?vsp http (sprintf ('<input type="checkbox" name="pf_certificateLogin" id="pf_certificateLogin" value="1" %s/>', case when certificateLogin = '1' then 'checked="checked"' else '' end)); ?>
+                                  <input type="checkbox" name="pf26_enableLogin" id="pf26_enableLogin" value="1"/>
                             Enable Automatic WebID Login
                           </label>
                         </td>
                       </tr>
-                      <tr>
-                        <th>
-                        </th>
-                        <td>
-                          <input type="submit" name="pf_update" value="Change" onclick="$('securityNo').value = '4'; needToConfirm = false;" />
-                          <input type="submit" name="pf_update" value="Remove" onclick="$('securityNo').value = '5'; needToConfirm = false;" />
-                          <input type="submit" name="pf_update" value="Refresh" onclick="$('securityNo').value = '99'; needToConfirm = false;" />
-                        </td>
-                      </tr>
                     </table>
+                          <script type="text/javascript">
+                            OAT.MSG.attach(OAT, "PAGE_LOADED", function (){pfShowCertificate();});
+                          </script>
+                          <div class="footer">
+                            <input type="submit" name="pf_cancel2" value="Cancel" onclick="needToConfirm = false;"/>
+                            <input type="submit" name="pf_update26" value="Save" onclick="needToConfirm = false; return validateInputs(this, 'pf26');"/>
+                          </div>
+                        </div>
+                        <?vsp
+                          }
+                        ?>
+                      </div>
+                      <?vsp
+                        }
+                      if (vFormTab2 < 5)
+                        {
+                      ?>
                     <div class="footer">
                       <input type="submit" name="pf_cancel" value="Cancel" onclick="needToConfirm = false;"/>
+                        <?vsp
+                        if ((vFormTab2 = 3) and not isnull (xpath_eval ('/user/securityFacebookID', vXml)))
+                        {
+                        ?>
+                        <input type="submit" name="pf_clear" value="Clear" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                        <?vsp
+                        }
+                        ?>
+                        <input type="submit" name="pf_update" value="Save" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                        <input type="submit" name="pf_next" value="Save & Next" onclick="myBeforeSubmit(); return myValidateInputs(this);"/>
+                      </div>
+                      <?vsp
+                        }
+                      ?>
                   </div>
                 </div>
+                  <?vsp
+                  }
+                  ?>
                 </div>
               </div>
               <?vsp
@@ -3030,7 +3763,7 @@
       <div id="FT_R">
         <a href="/ods/faq.html">FAQ</a> | <a href="/ods/privacy.html">Privacy</a> | <a href="/ods/rabuse.vspx">Report Abuse</a>
         <div>
-          Copyright © 1999-2010 OpenLink Software
+          Copyright © 1999-2011 OpenLink Software
         </div>
       </div>
     </div>
diff --git a/appsrc/ODS-Framework/users/users.xsl b/appsrc/ODS-Framework/users/users.xsl
new file mode 100644
index 0000000..40f7364
--- /dev/null
+++ b/appsrc/ODS-Framework/users/users.xsl
@@ -0,0 +1,563 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ -
+ -  $Id: users.xsl,v 1.1.4.6 2010/12/20 12:27:09 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2009 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mail="http://www.openlinksw.com/mail/">
+  <xsl:output method="html" indent="yes" omit-xml-declaration="no" encoding="utf-8"/>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="/">
+    <div class="vcard">
+      <xsl:call-template name="personal"/>
+      <xsl:call-template name="rsa"/>
+      <xsl:call-template name="address"/>
+      <xsl:call-template name="contact"/>
+      <xsl:call-template name="sameAs"/>
+      <xsl:call-template name="interest"/>
+      <xsl:call-template name="topicInterest"/>
+      <xsl:call-template name="made"/>
+      <xsl:call-template name="knows"/>
+    </div>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template name="personal">
+    <div>
+      <div class="PF_header">Personal Data</div>
+      <table class="PF_form">
+        <xsl:apply-templates select="user/nick"/>
+        <xsl:apply-templates select="user/depiction"/>
+        <xsl:apply-templates select="user/title"/>
+        <xsl:apply-templates select="user/gender"/>
+        <xsl:apply-templates select="user/name"/>
+        <xsl:apply-templates select="user/firstName"/>
+        <xsl:apply-templates select="user/family_name"/>
+        <xsl:apply-templates select="user/birthday"/>
+      </table>
+    </div>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template name="rsa">
+    <xsl:if test="user/rsaPublicKey">
+    <div>
+      <div class="PF_header">RSA Public Key</div>
+      <table class="PF_form">
+        <xsl:apply-templates select="user/iri"/>
+          <xsl:apply-templates select="user/rsaPublicKey"/>
+      </table>
+    </div>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template name="address">
+    <div class="adr">
+      <div class="PF_header">Address Info</div>
+      <table class="PF_form">
+        <xsl:apply-templates select="user/country"/>
+        <xsl:apply-templates select="user/region"/>
+        <xsl:apply-templates select="user/locality"/>
+        <xsl:apply-templates select="user/pobox"/>
+        <xsl:apply-templates select="user/street"/>
+        <xsl:apply-templates select="user/extadd"/>
+      </table>
+    </div>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template name="contact">
+    <div>
+      <div class="PF_header">Contact Info</div>
+      <table class="PF_form">
+        <xsl:apply-templates select="user/homepage"/>
+        <xsl:apply-templates select="user/qrcode"/>
+        <xsl:apply-templates select="user/phone"/>
+        <xsl:apply-templates select="user/mbox"/>
+        <xsl:apply-templates select="user/icqChatID"/>
+        <xsl:apply-templates select="user/msnChatID"/>
+        <xsl:apply-templates select="user/aimChatID"/>
+        <xsl:apply-templates select="user/yahooChatID"/>
+        <xsl:apply-templates select="user/skypeChatID"/>
+        <xsl:apply-templates select="user/onlineAccount"/>
+      </table>
+    </div>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template name="sameAs">
+    <xsl:if test="user/sameAs">
+      <div>
+        <div class="PF_header">Other WebIDs</div>
+        <table class="PF_form">
+          <xsl:apply-templates select="user/sameAs"/>
+        </table>
+      </div>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template name="interest">
+    <xsl:if test="user/interest">
+      <div>
+        <div class="PF_header">Interests</div>
+        <table class="PF_form">
+          <xsl:apply-templates select="user/interest"/>
+        </table>
+      </div>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template name="topicInterest">
+    <xsl:if test="user/topicInterest">
+      <div>
+        <div class="PF_header">Topic of Interests</div>
+        <table class="PF_form">
+          <xsl:apply-templates select="user/topicInterest"/>
+        </table>
+      </div>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template name="made">
+    <xsl:if test="user/made">
+      <div>
+        <div class="PF_header">Made</div>
+        <table class="PF_form">
+          <xsl:apply-templates select="user/made"/>
+        </table>
+      </div>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template name="knows">
+    <xsl:if test="user/knows">
+      <div>
+        <div class="PF_header">Knows</div>
+        <table class="PF_form">
+          <xsl:apply-templates select="user/knows"/>
+        </table>
+      </div>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template name="profileLine">
+    <xsl:param name="label"/>
+    <xsl:param name="value"/>
+    <xsl:param name="RDFa"/>
+    <xsl:if test="$value != ''">
+    <tr>
+        <th>
+          <xsl:value-of select="$label"/>
+        </th>
+        <td>
+          <xsl:choose>
+            <xsl:when test="$RDFa">
+              <span>
+                <xsl:attribute name="class">
+                  <xsl:value-of select="$RDFa"/>
+                </xsl:attribute>
+                <xsl:value-of select="$value"/>
+              </span>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+          </xsl:choose>
+        </td>
+    </tr>
+    </xsl:if>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template name="profileLinePhoto">
+    <xsl:param name="label"/>
+    <xsl:param name="value"/>
+    <tr>
+      <th><xsl:value-of select="$label"/></th>
+      <td>
+        <image>
+          <xsl:attribute name="src">
+            <xsl:value-of select="$value"/>
+          </xsl:attribute>
+        </image>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="name">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Name</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+      <xsl:with-param name="RDFa">fn</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="depiction">
+    <xsl:call-template name="profileLinePhoto">
+      <xsl:with-param name="label">Photo</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="title">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Title</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+      <xsl:with-param name="RDFa">honorific-prefix</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="gender">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Gender</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="nick">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Nick</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="firstName">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">First Name</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+       <xsl:with-param name="RDFa">given-name</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="family_name">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Family Name</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+      <xsl:with-param name="RDFa">family-name</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="birthday">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Birthday</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+      <xsl:with-param name="RDFa">bday</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="iri">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">WebID</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="rsaModulus">
+    <tr>
+      <th>Modulus (hexadecimal)</th>
+      <td style="font-family: monospace;">
+        <xsl:call-template name="showHex">
+          <xsl:with-param name="offset" select="1" />
+          <xsl:with-param name="value" select="." />
+        </xsl:call-template>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="rsaPublicExponent">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Modulus (decimal)</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="country">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Country</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+      <xsl:with-param name="RDFa">country-name</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="region">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Region</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+      <xsl:with-param name="RDFa">region</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="locality">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">City</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+      <xsl:with-param name="RDFa">locality</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="pobox">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">PO Box</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+      <xsl:with-param name="RDFa">postal-code</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="street">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Address</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+      <xsl:with-param name="RDFa">street-address</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="extadd">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Address</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="homepage">
+    <tr>
+      <th>Homepage</th>
+      <td>
+        <a>
+          <xsl:attribute name="href">
+            <xsl:value-of select="."/>
+          </xsl:attribute>
+          <xsl:value-of select="."/>
+        </a>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="qrcode">
+    <tr>
+      <th></th>
+      <td>
+        <img>
+          <xsl:attribute name="src">data:image/jpg;base64,<xsl:value-of select="."/></xsl:attribute>
+        </img>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="phone">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Phone</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+      <xsl:with-param name="RDFa">tel</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="mbox">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Mail</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+      <xsl:with-param name="RDFa">email</xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="icqChatID">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">ICQ</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="msnChatID">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">MSN</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="aimChatID">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">AIM</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="yahooChatID">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Yahoo</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="skypeChatID">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Skype</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="onlineAccount">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label"><xsl:value-of select="label"/></xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="url"/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="rsaPublicKey">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label">Key No</xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="rsaNo+1"/></xsl:with-param>
+    </xsl:call-template>
+    <xsl:apply-templates select="rsaPublicExponent"/>
+    <xsl:apply-templates select="rsaModulus"/>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="interest|topicInterest">
+    <tr>
+      <th></th>
+      <td>
+        <xsl:choose>
+          <xsl:when test="url">
+            <a>
+              <xsl:attribute name="href">
+                <xsl:value-of select="url"/>
+              </xsl:attribute>
+              <xsl:choose>
+                <xsl:when test="label">
+                  <xsl:value-of select="label"/>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="url"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </a>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="label"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="knows">
+    <tr>
+      <th>Person</th>
+      <td>
+        <xsl:if test="nick">
+          <b>Name</b>: <xsl:value-of select="nick"/><div></div>
+        </xsl:if>
+        <xsl:if test="iri">
+          <b>WebID</b>: <a>
+            <xsl:attribute name="href">
+              <xsl:value-of select="iri"/>
+            </xsl:attribute>
+            <xsl:value-of select="iri"/>
+          </a><div></div>
+        </xsl:if>
+        <xsl:if test="seeAlso">
+          <b>SeeAlso</b>:  <a>
+            <xsl:attribute name="href">
+              <xsl:value-of select="seeAlso"/>
+            </xsl:attribute>
+            <xsl:value-of select="seeAlso"/>
+          </a>
+        </xsl:if>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="sameAs|made">
+    <tr>
+      <th></th>
+      <td>
+        <a>
+          <xsl:attribute name="href">
+            <xsl:value-of select="."/>
+          </xsl:attribute>
+          <xsl:value-of select="."/>
+        </a>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template match="*">
+    <xsl:call-template name="profileLine">
+      <xsl:with-param name="label"><xsl:value-of select ="local-name()"/></xsl:with-param>
+      <xsl:with-param name="value"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
+  </xsl:template>
+
+  <!-- ========================================================================== -->
+  <xsl:template name="showHex">
+    <xsl:param name="offset" />
+    <xsl:param name="value" />
+    <xsl:if test="$offset < string-length($value)">
+      <xsl:if test="(($offset mod 32) = 1) and ($offset > 1)">
+        <div></div>
+      </xsl:if>
+      <xsl:value-of select="substring($value, $offset, 2)"/><xsl:text> </xsl:text>
+      <xsl:call-template name="showHex">
+        <xsl:with-param name="offset" select="$offset+2" />
+        <xsl:with-param name="value"  select="$value" />
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:template>
+
+  <!--========================================================================-->
+</xsl:stylesheet>
diff --git a/appsrc/ODS-Framework/users_select.js b/appsrc/ODS-Framework/users_select.js
index 6e782ff..f7e1f7b 100644
--- a/appsrc/ODS-Framework/users_select.js
+++ b/appsrc/ODS-Framework/users_select.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: users_select.js,v 1.3.2.1 2010/03/15 15:50:15 source Exp $
+ *  $Id: users_select.js,v 1.3.2.4 2010/10/13 12:16:49 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -20,7 +20,13 @@
  *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  *
  */
-// ---------------------------------------------------------------------------
+function myPost(frmName, fldName, fldValue)
+{
+  var frm = document.forms[frmName];
+  hiddenCreate(fldName, frm, fldValue);
+  frm.submit();
+}
+
 function selectAllCheckboxes (form, btn)
 {
   for (var i = 0; i < form.elements.length; i = i + 1) {
@@ -40,7 +46,6 @@ function selectAllCheckboxes (form, btn)
   btn.focus();
 }
 
-// ---------------------------------------------------------------------------
 function countSelected (form, txt)
 {
   var count = 1;
@@ -56,20 +61,6 @@ function countSelected (form, txt)
   return count;
 }
 
-// ---------------------------------------------------------------------------
-function getSelected (form, txt)
-{
-  if ((form != null) && (txt != null)) {
-    for (var i = 0; i < form.elements.length; i++) {
-      var obj = form.elements[i];
-      if ((obj != null) && (obj.type == "checkbox") && (obj.name.indexOf (txt) != -1) && obj.checked)
-        return (obj.name).substr(txt.length);
-    }
-  }
-  return '';
-}
-
-// ---------------------------------------------------------------------------
 function anySelected (form, txt, selectionMsq, mode)
 {
   if ((form != null) && (txt != null)) {
@@ -88,34 +79,15 @@ function anySelected (form, txt, selectionMsq, mode)
   return true;
 }
 
-// ---------------------------------------------------------------------------
-function singleSelected (form, txt, zeroMsq, moreMsg, mode)
-{
-  var count = countSelected(form, txt);
-  if (count == 0) {
-    if (zeroMsq != null)
-      alert(zeroMsq);
-    return false;
-  }
-  if (count > 1) {
-    if (moreMsg != null)
-      alert(moreMsg);
-    return false;
-  }
-  return true;
-}
-
-// ---------------------------------------------------------------------------
 function confirmAction(confirmMsq, form, txt, selectionMsq) {
   if (anySelected (form, txt, selectionMsq))
     return confirm(confirmMsq);
   return false;
 }
 
-// ---------------------------------------------------------------------------
 function trim(sString, ch)
 {
-  if (ch == null)
+  if (!ch)
     ch = ' ';
   while (sString.substring(0,1) == ch)
     sString = sString.substring(1, sString.length);
@@ -126,101 +98,135 @@ function trim(sString, ch)
   return sString;
 }
 
+function rowSelected(tr)
+{
+  var cbInput;
+  var s1Input;
+  var s2Input;
+  var inputs = tr.getElementsByTagName('input');
+  for (var i = 0; i < inputs.length; i++) {
+    if (inputs[i].name == 'cb_item')
+      cbInput = inputs[i];
+    if (inputs[i].name == 's1_item')
+      s1Input = inputs[i];
+    if (inputs[i].name == 's2_item')
+      s2Input = inputs[i];
+  }
+  if (cbInput) {
+    cbInput.checked = !cbInput.checked;
+    updateChecked(cbInput, cbInput.name);
+  }
+  else if (s1Input)
+  {
+    commitChecked(s1Input.form, s1Input.value);
+  }
+}
 
-// ---------------------------------------------------------------------------
-//
-function rowSelect(obj)
+function commitChecked(srcForm, s1Value, s2Value)
 {
+  var dstForm = eval('window.opener.document.'+$v('form'));
+  if (!dstForm)
+    return false;
+
   var submitMode = false;
-  if (window.document.F1.elements['src'])
-    if (window.document.F1.elements['src'].value.indexOf('s') != -1)
+  if (srcForm.elements['src'] && (srcForm.elements['src'].value.indexOf('s') != -1)) {
       submitMode = true;
-  if (submitMode)
-    if (window.opener.document.F1)
-      if (window.opener.document.F1.elements['submitting'])
+    if (dstForm && dstForm.elements['submitting'])
         return false;
+  }
   var closeMode = true;
-  if (window.document.F1.elements['dst'])
-    if (window.document.F1.elements['dst'].value.indexOf('c') == -1)
-      closeMode = false;
   var singleMode = true;
-  if (window.document.F1.elements['dst'])
-    if (window.document.F1.elements['dst'].value.indexOf('s') == -1)
+  if (srcForm.elements['dst']) {
+    if (srcForm.elements['dst'].value.indexOf('c') == -1)
+      closeMode = false;
+    if (srcForm.elements['dst'].value.indexOf('s') == -1)
       singleMode = false;
-
-  var s2 = (obj.name).replace('b1', 's2');
-  var s1 = (obj.name).replace('b1', 's1');
+  }
 
   var myRe = /^(\w+):(\w+);(.*)?/;
-  var params = window.document.forms['F1'].elements['params'].value;
+  var params = srcForm.elements['params'].value;
   var myArray;
+  if (dstForm) {
   while(true) {
     myArray = myRe.exec(params);
-    if (myArray == undefined)
+      if (!myArray)
       break;
-    if (myArray.length > 2)
-      if (window.opener.document.F1)
-        if (window.opener.document.F1.elements[myArray[1]]) {
+
+      if (myArray.length > 2) {
+        var dstField = dstForm.elements[myArray[1]];
+        if (dstField) {
           if (myArray[2] == 's1')
-            if (window.opener.document.F1.elements[myArray[1]])
-              rowSelectValue(window.opener.document.F1.elements[myArray[1]], window.document.F1.elements[s1], singleMode, submitMode);
-          if (myArray[2] == 's2')
-            if (window.opener.document.F1.elements[myArray[1]])
-              rowSelectValue(window.opener.document.F1.elements[myArray[1]], window.document.F1.elements[s2], singleMode, submitMode);
+            setSelected(dstField, s1Value, singleMode);
+          else if (myArray[2] == 's2')
+            setSelected(dstField, s2Value, singleMode);
+        }
         }
+
     if (myArray.length < 4)
       break;
+
     params = '' + myArray[3];
   }
+  }
   if (submitMode) {
-    window.opener.createHidden('F1', 'submitting', 'yes');
-    window.opener.document.F1.submit();
+    // dstForm.hiddenCreate('submitting', dstForm, 'yes');
+    dstForm.submit();
   }
   if (closeMode)
     window.close();
 }
 
-// ---------------------------------------------------------------------------
-function rowSelectValue(dstField, srcField, singleMode, submitMode)
+function addChecked (srcForm, checkboxName, selectionMsq)
 {
+  if (!anySelected (srcForm, checkboxName, selectionMsq, 'confirm'))
+    return false;
+
+  return commitChecked(srcForm, srcForm.s1.value, srcForm.s2.value);
+}
+
+function setSelected(dstField, srcValue, singleMode) {
   if (singleMode) {
-    dstField.value = trim(srcField.value, ',');
+		dstField.value = srcValue;
   } else {
+		dstField.value = trim(dstField.value);
+		dstField.value = trim(dstField.value, ',');
+		dstField.value = trim(dstField.value);
+		if (dstField.value.indexOf(srcValue) == -1) {
     if (dstField.value == '') {
-      dstField.value = srcField.value;
+				dstField.value = srcValue;
     } else {
-      srcField.value = trim(srcField.value , ',');
-      var aSrc = srcField.value.split(',');
-
-      dstField.value = dstField.value + ',';
-      for (var i = 0; i < aSrc.length; i = i + 1) {
-        if (aSrc[i] != '')
-          if (dstField.value.indexOf(aSrc[i]+',') == -1)
-            dstField.value = dstField.value + trim(aSrc[i], ',') + ',';
+				dstField.value = dstField.value + ',' + srcValue;
       }
     }
-    dstField.value = trim(dstField.value, ',');
   }
 }
 
-// ---------------------------------------------------------------------------
-function updateChecked(form, objName)
+function updateChecked(obj, objName, event)
 {
-  for (var i = 0; i < form.elements.length; i = i + 1) {
-    var obj = form.elements[i];
+  if (event)
+	  event.cancelBubble = true;
+  var objForm = obj.form;
+
+  var s1Value = objForm.s1.value;
+  s1Value = trim(s1Value);
+  s1Value = trim(s1Value, ',');
+  s1Value = trim(s1Value);
+  s1Value = s1Value + ',';
+  for (var i = 0; i < objForm.elements.length; i = i + 1) {
+    var obj = objForm.elements[i];
     if (obj != null && obj.type == "checkbox" && obj.name == objName) {
       if (obj.checked) {
-        if (form.s1.value.indexOf(obj.value+',') == -1)
-          form.s1.value = form.s1.value + obj.value+',';
+        if (s1Value.indexOf(obj.value+',') == -1)
+          s1Value = s1Value + obj.value + ',';
       } else {
-        form.s1.value = (form.s1.value).replace(obj.value+',', '');
+        s1Value = (s1Value).replace(obj.value+',', '');
       }
     }
   }
+  objForm.s1.value = trim(s1Value, ',');
 }
 
-// ---------------------------------------------------------------------------
-function addChecked (form, txt, selectionMsq)
+function addChecked2 (form, txt, selectionMsq)
 {
   var openerForm = eval('window.opener.document.'+$v('form'));
   if (!openerForm)
@@ -251,10 +257,10 @@ function addChecked (form, txt, selectionMsq)
       if (openerForm.elements[myArray[1]]) {
           if (myArray[2] == 's1')
           if (openerForm.elements[myArray[1]])
-            rowSelectValue(openerForm.elements[myArray[1]], form.elements[s1], singleMode, submitMode);
+            setSelected(openerForm.elements[myArray[1]], form.elements[s1], singleMode, submitMode);
           if (myArray[2] == 's2')
           if (openerForm.elements[myArray[1]])
-            rowSelectValue(openerForm.elements[myArray[1]], form.elements[s2], singleMode, submitMode);
+            setSelected(openerForm.elements[myArray[1]], form.elements[s2], singleMode, submitMode);
         }
     if (myArray.length < 4)
       break;
diff --git a/appsrc/ODS-Framework/users_select.vspx b/appsrc/ODS-Framework/users_select.vspx
index 4c0fc6b..7c609f2 100644
--- a/appsrc/ODS-Framework/users_select.vspx
+++ b/appsrc/ODS-Framework/users_select.vspx
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
- -  $Id: users_select.vspx,v 1.5.2.2 2010/03/15 15:50:15 source Exp $
+ -
+ -  $Id: users_select.vspx,v 1.5.2.7 2010/11/19 16:50:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -104,29 +105,29 @@ input.button {
       http(sprintf('<a href="#" onClick="javascript: myPost(''page_form'', ''sortColumn'', ''%s''); return false;" alt="%s" title="%s">%s%s</a>', columnName, altStr, altStr, titleName, imageStr));
     ]]>
   </v:method>
+
   <v:method name="sortChange" arglist="in columnName varchar">
     <![CDATA[
-      if (columnName = '')
-        return;
+        if (columnName <> '')
+        {
       self.ds.vc_reset();
-      if (self.v_order = columnName) {
+          if (self.v_order = columnName)
+          {
         self.v_direction := either(equ(self.v_direction, 'asc'), 'desc', 'asc');
       } else {
         self.v_direction := 'asc';
-      }
       self.v_order := columnName;
+          }
+        }
     ]]>
   </v:method>
+
   <v:method name="isMultiple" arglist="in dst any">
     <![CDATA[
-      declare pos integer;
-
-      pos := strstr(self.v_dst, 'm');
-      if (not isnull(pos))
-        return 1;
-      return 0;
+        return case when isnull (strstr (self.v_dst, 'm')) then 0 else 1 end;
     ]]>
   </v:method>
+
     <v:before-data-bind>
       <![CDATA[
         if (self.v_mode = 'g')
@@ -137,6 +138,10 @@ input.button {
         {
           self.v_filter := 'u';
         }
+        else if (self.v_mode like 's_%')
+        {
+          self.v_filter := 'u';
+        }
       ]]>
     </v:before-data-bind>
 
@@ -145,7 +150,6 @@ input.button {
     <vm:variables>
       <v:variable name="v_params" param-name="params" type="varchar"/>
       <v:variable name="v_mode" persist="0" param-name="mode" type="varchar" default="''"/>
-        <v:variable name="v_form" persist="0" param-name="form" type="varchar" default="'page_form'"/>
         <v:variable name="v_filter" persist="0" type="varchar" default="''"/>
       <v:variable name="v_value" persist="0" type="varchar" default="''"/>
       <v:variable name="v_mask" persist="0" type="varchar" default="''"/>
@@ -158,6 +162,7 @@ input.button {
         <v:variable name="v_s2" persist="0" param-name="s2" type="varchar" default="''" />
     </vm:variables>
   <vm:body>
+        <vm:login redirect="index.vspx"/>
       <?vsp http(sprintf('<input type="hidden" name="sid"   id="sid"   value="%s"/>', get_keyword('sid', self.vc_page.vc_event.ve_params))); ?>
       <?vsp http(sprintf('<input type="hidden" name="realm" id="realm" value="%s"/>', get_keyword('realm', self.vc_page.vc_event.ve_params))); ?>
         <?vsp http(sprintf('<input type="hidden" name="form"  id="form"  value="%s"/>', get_keyword('form', self.vc_page.vc_event.ve_params, 'page_form'))); ?>
@@ -168,7 +173,7 @@ input.button {
       <v:text name="params" type="hidden" value="--self.v_params"/>
         <div style="padding: 0.2em;">
         <div style="padding: 0 0 0.5em 0;">
-          &nbsp;<a href="#" onClick="javascript: if (opener != null) opener.focus(); window.close();"><img src="images/icons/close_16.png" border="0" alt="Close" title="Close" />&nbsp;Close</a>
+            <span class="button pointer" onclick="javascript: if (opener != null) opener.focus(); window.close();"><img class="button" src="/ods/images/icons/close_16.png" border="0" alt="Close" title="Close" /> Close</span>
         </div>
         <div class="boxHeader">
             Show
@@ -188,7 +193,7 @@ input.button {
           <v:button action="simple" value="Filter" xhtml_class="button">
             <v:on-post>
               <![CDATA[
-                self.v_filter := get_keyword('filter', self.vc_page.vc_event.ve_params, self.v_filter);
+                  self.v_filter := get_keyword('filter', e.ve_params, self.v_filter);
                 self.v_how := self.how.ufl_value;
                 self.v_value := trim(self.value.ufl_value);
                 self.vc_data_bind (e);
@@ -230,13 +235,18 @@ input.button {
                   {
                     group_sql := sprintf('select ''Group'' U_TYPE, a.U_NAME, coalesce(a.U_FULL_NAME, a.U_NAME) U_FULL_NAME from DB.DBA.SYS_USERS a where (a.U_IS_ROLE=1) and (upper(a.U_NAME) like upper(\'%s\') and (U_ID<>5) and (U_ID<>6))', self.v_mask);
                   } else {
-                    group_sql := sprintf('select ''Group'' U_TYPE, a.U_NAME, coalesce(a.U_FULL_NAME, a.U_NAME) U_FULL_NAME from DB.DBA.SYS_USERS a, ODRIVE.WA.GROUPS b, DB.DBA.SYS_USERS c where (a.U_ID=b.GROUP_ID) and (a.U_IS_ROLE=1) and (b.USER_ID=c.U_ID) and (c.U_NAME=\'%s\') and (upper(a.U_NAME) like upper(\'%s\') and (a.U_ID<>5) and (a.U_ID<>6))', self.u_name, self.v_mask);
+                    group_sql := sprintf('select ''Group'' U_TYPE, a.U_NAME, coalesce(a.U_FULL_NAME, a.U_NAME) U_FULL_NAME from DB.DBA.SYS_USERS a, DB.DBA.WA_GROUPS b, DB.DBA.SYS_USERS c where (a.U_ID=b.WAG_GROUP_ID) and (a.U_IS_ROLE=1) and (b.WAG_USER_ID=c.U_ID) and (c.U_NAME=\'%s\') and (upper(a.U_NAME) like upper(\'%s\') and (a.U_ID<>5) and (a.U_ID<>6))', self.u_name, self.v_mask);
                   }
               }
               if (self.v_filter <> 'g')
               {
+                  if (self.v_mode = 's_bmk')
+                  {
+                    user_sql := sprintf('select ''User'' U_TYPE, b.U_NAME, coalesce(b.U_FULL_NAME, \'\') U_FULL_NAME from BMK..GRANTS_VIEW a, DB.DBA.SYS_USERS b where (b.U_ACCOUNT_DISABLED=0) and upper(b.U_NAME) like upper(\'%s\') and a.GW_ID = %d and a.U_ID = b.U_ID', self.v_mask, self.u_id);
+                  } else {
                 user_sql := sprintf('select ''User'' U_TYPE, U_NAME, coalesce(U_FULL_NAME, \'\') U_FULL_NAME from WS.WS.SYS_DAV_USER where (U_ACCOUNT_DISABLED=0) and (upper(U_NAME) like upper(\'%s\') and (U_ID<>5) and (U_ID<>6))', self.v_mask);
               }
+                }
                 if (user_sql = '')
                 {
                 control.ds_sql := group_sql;
@@ -270,33 +280,24 @@ input.button {
         <v:data-set name="ds" data-source="self.dsrc" scrollable="1">
             <v:template name="ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
               <table id="users" class="listing" cellspacing="0">
-              <thead class="sortHeader">
                 <tr class="listing_header_row">
-                  <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
+                  <vm:if test="self.isMultiple(self.v_dst)">
                     <th class="checkbox" width="1%">
-                      <?vsp
-                          http('<input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, ''cb_item''); updateChecked(this.form, ''cb_item''); "/>');
-                      ?>
+                      <input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, 'cb_item'); updateChecked(this, 'cb_item'); "/>
                     </th>
-                  </v:template>
-                  <v:template type="simple" enabled="-- case when (self.v_mode = '') then 1 else 0 end">
+                  </vm:if>
+                  <vm:if test="self.v_mode = ''">
                     <th>
-                      <v:label value="Type" format="%s"/>
+                      Type
                     </th>
-                  </v:template>
+                  </vm:if>
                   <th>
                     <?vsp self.sortColumn('Name', 'U_NAME'); ?>
                   </th>
                   <th>
                     <?vsp self.sortColumn('Description', 'U_FULL_NAME'); ?>
                   </th>
-                  <v:template type="simple" enabled="--neq(self.isMultiple(self.v_dst), 1)">
-                      <th width="1%">
-                        Action
-                    </th>
-                  </v:template>
                 </tr>
-              </thead>
             </table>
           </v:template>
 
@@ -305,47 +306,40 @@ input.button {
             <v:template name="ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
               <table>
                 <tr align="center">
-                  <?vsp http(sprintf('<td colspan="%d">No records</td>', either(equ(self.v_mode,''),4,3))); ?>
+                    <td colspan="<?V either(equ(self.v_mode,''),3,2)+self.isMultiple(self.v_dst) ?>">
+                      No records
+                    </td>
                 </tr>
               </table>
             </v:template>
 
             <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
                 <table>
-                <tr class="<?V case when mod(control.te_ctr,2) = 0 then 'listing_row_odd' else 'listing_row_even' end ?>">
-                  <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
+                  <tr onclick="rowSelected(this);" class="pointer <?V case when mod(control.te_ctr+1,2) = 0 then 'listing_row_odd' else 'listing_row_even' end ?>">
+                    <vm:if test="self.isMultiple(self.v_dst)">
                     <td  align="center">
                       <?vsp
-                        declare pos integer;
                         declare S, name any;
 
-                        name := (control.vc_parent as vspx_row_template).te_column_value('U_NAME');
-                        S := '';
-                        pos := strstr(self.v_s1, concat(name, ','));
-                        if (not isnull(pos))
-                          S := 'checked="checked"';
-                        http (sprintf ('<input type="checkbox" name="cb_item" value="%s" %s onclick="javascript: updateChecked(this.form, ''cb_item''); " />', name, S));
+                          name := (control as vspx_row_template).te_column_value('U_NAME');
+                          S := case when isnull (strstr(self.v_s1, concat(name, ','))) then '' else 'checked="checked"' end;
+                          http (sprintf ('<input type="checkbox" name="cb_item" value="%s" %s onclick="javascript: updateChecked(this, ''cb_item'', event); " />', name, S));
                       ?>
                     </td>
-                  </v:template>
-                  <v:template type="simple" enabled="-- case when (self.v_mode = '') then 1 else 0 end">
+                    </vm:if>
+                    <vm:if test="self.v_mode = ''">
                     <td nowrap="nowrap">
-                      <v:label value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('U_TYPE')" format="%s"/>
+                        <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('U_TYPE')" format="%s"/>
                     </td>
-                  </v:template>
+                    </vm:if>
                   <td nowrap="nowrap">
+                      <input name="s1_item" type="hidden" value="<?V (control as vspx_row_template).te_column_value('U_NAME') ?>" />
                     <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('U_NAME')" format="%s"/>
                   </td>
                   <td nowrap="nowrap">
+                      <input name="s2_item" type="hidden" value="<?V (control as vspx_row_template).te_column_value('U_FULL_NAME') ?>" />
                     <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('U_FULL_NAME')" format="%s"/>
                   </td>
-                  <v:template type="simple" enabled="--neq(self.isMultiple(self.v_dst), 1)">
-                    <td nowrap="nowrap">
-                      <v:text name="s1" type="hidden" value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('U_NAME')"/>
-                      <v:text name="s2" type="hidden" value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('U_FULL_NAME')"/>
-                      <v:button name="b1" action="simple" value="select" xhtml_alt="Select" xhtml_onclick="javascript: rowSelect(this); return false;" xhtml_class="button"/>
-                    </td>
-                  </v:template>
                 </tr>
               </table>
             </v:template>
@@ -355,20 +349,20 @@ input.button {
           <v:template type="simple" name-to-remove="table" set-to-remove="top">
             <table>
               <tr align="center">
-                <?vsp http(sprintf('<td colspan="%d">', either(equ(self.v_mode,''),4,3))); ?>
+                  <td colspan="<?V either(equ(self.v_mode,''),3,2)+self.isMultiple(self.v_dst) ?>">
                   <vm:ds-members-navigation data-set="ds"/>
-                <?vsp http('</td>'); ?>
+                  </td>
               </tr>
             </table>
           </v:template>
 
         </v:data-set>
-        <v:template type="simple" enabled="--equ(self.isMultiple(self.v_dst), 1)">
+          <vm:if test="self.isMultiple(self.v_dst)">
           <div style="padding: 0 0 0.5em 0;">
             <hr />
               <a href="#" onclick="javascript: return addChecked(document.forms['page_form'], 'cb_item', 'No users were selected for addition. No groups were selected for addition.');" class="button2">&nbsp;Add selected</a>
           </div>
-        </v:template>
+          </vm:if>
       </div>
   </vm:body>
     </vm:pagewrapper>
diff --git a/appsrc/ODS-Framework/vad_version b/appsrc/ODS-Framework/vad_version
index c83001d..5debac5 100644
--- a/appsrc/ODS-Framework/vad_version
+++ b/appsrc/ODS-Framework/vad_version
@@ -1 +1 @@
-1.73.23
+1.80.92
diff --git a/appsrc/ODS-Framework/validate.js b/appsrc/ODS-Framework/validate.js
new file mode 100644
index 0000000..a886d6a
--- /dev/null
+++ b/appsrc/ODS-Framework/validate.js
@@ -0,0 +1,159 @@
+/*
+ *
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *
+ *  Copyright (C) 1998-2010 OpenLink Software
+ *
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+*/
+
+function validateError(fld, msg)
+{
+  alert(msg);
+  setTimeout(function(){fld.focus();}, 1);
+  return false;
+}
+
+function validateInt(fld)
+{
+  var regex = /^[0-9]+$/
+  if (!regex.test(fld.value))
+    return validateError(fld, 'Invalid integer value: ' + fld.value);
+
+  return true;
+}
+
+function validateFloat(fld)
+{
+  var regex = /^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/
+  if (!regex.test(fld.value))
+    return validateError(fld, 'Invalid float value: ' + fld.value);
+
+  return true;
+}
+
+function validateDate(fld)
+{
+  var regex = /^((?:19|20)[0-9][0-9])[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$/
+  if (!regex.test(fld.value))
+    return validateError(fld, 'Invalid date value: ' + fld.value);
+
+  return true;
+}
+
+function validateDateTime(fld)
+{
+  var regex = /^((?:19|20)[0-9][0-9])[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])( ([01]?[0-9]|[2][0-3])(:[0-5][0-9])?)?$/
+  if (!regex.test(fld.value))
+    return validateError(fld, 'Invalid date value: ' + fld.value);
+
+  return true;
+}
+
+function validateMail(fld)
+{
+  if ((fld.value.length == 0) || (fld.value.length > 40))
+    return validateError(fld, 'E-mail address cannot be empty or longer then 40 chars');
+
+  var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
+  if (!regex.test(fld.value))
+    return validateError(fld, 'Invalid E-mail address');
+
+  return true;
+}
+
+function validateURL(fld)
+{
+  var regex = /^(ftp|http|https):(\/\/)?(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
+  if (!regex.test(fld.value))
+    return validateError(fld, 'Invalid URL address : ' + fld.value);
+
+  return true;
+}
+
+function validateURI(fld)
+{
+  var regex = /^([a-z0-9+.-]+):(\/\/)?(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
+  var mail = /^acct:([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
+  if (!regex.test(fld.value) && !mail.test(fld.value))
+    return validateError(fld, 'Invalid URI address : ' + fld.value);
+
+  return true;
+}
+
+function validateWebID(fld)
+{
+  if (fld.value == 'foaf:Agent')
+    return true;
+
+  var regex = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
+  if (regex.test(fld.value))
+    return true;
+
+  var regex  = /^acct:([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-:])+)+\.?([a-zA-Z0-9]{0,4})+$/;
+  if (regex.test(fld.value))
+    return true;
+
+  var regex = /^acct:([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
+  if (regex.test(fld.value))
+    return true;
+
+  return validateError(fld, 'Invalid URI address');
+}
+
+function validateField(fld)
+{
+  if ((fld.value.length == 0) && OAT.Dom.isClass(fld, '_canEmpty_'))
+    return true;
+  if (OAT.Dom.isClass(fld, '_int_'))
+    return validateInt(fld);
+  if (OAT.Dom.isClass(fld, '_float_'))
+    return validateFloat(fld);
+  if (OAT.Dom.isClass(fld, '_date_'))
+    return validateDate(fld);
+  if (OAT.Dom.isClass(fld, '_dateTime_'))
+    return validateDateTime(fld);
+  if (OAT.Dom.isClass(fld, '_mail_'))
+    return validateMail(fld);
+  if (OAT.Dom.isClass(fld, '_url_'))
+    return validateURL(fld);
+  if (OAT.Dom.isClass(fld, '_uri_'))
+    return validateURI(fld);
+  if (OAT.Dom.isClass(fld, '_webid_'))
+    return validateWebID(fld);
+  if (fld.value.length == 0)
+    return validateError(fld, 'Field cannot be empty');
+  return true;
+}
+
+function validateInputs(fld, prefix)
+{
+  var retValue = true;
+  var form = fld.form;
+  for (i = 0; i < form.elements.length; i++)
+  {
+    var fld = form.elements[i];
+    if (prefix && (fld.name.indexOf(prefix) != 0))
+      continue;
+    if (OAT.Dom.isClass(fld, '_validate_'))
+    {
+      retValue = validateField(fld);
+      if (!retValue)
+        return retValue;
+    }
+  }
+  return retValue;
+}
diff --git a/appsrc/ODS-Framework/version.base b/appsrc/ODS-Framework/version.base
index ec63514..7facc89 100644
--- a/appsrc/ODS-Framework/version.base
+++ b/appsrc/ODS-Framework/version.base
@@ -1 +1 @@
-9
+36
diff --git a/appsrc/ODS-Framework/version.curr b/appsrc/ODS-Framework/version.curr
index 262393c..5b6e52f 100644
--- a/appsrc/ODS-Framework/version.curr
+++ b/appsrc/ODS-Framework/version.curr
@@ -1 +1 @@
-7322
+8092
diff --git a/appsrc/ODS-Framework/vhost.vspx b/appsrc/ODS-Framework/vhost.vspx
index 2310dcf..0b91419 100644
--- a/appsrc/ODS-Framework/vhost.vspx
+++ b/appsrc/ODS-Framework/vhost.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vhost.vspx,v 1.10 2008/03/13 20:50:06 source Exp $
+ -  $Id: vhost.vspx,v 1.10.2.1 2010/09/20 10:15:31 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/vhost_simple.vspx b/appsrc/ODS-Framework/vhost_simple.vspx
index 7329d31..3ff94dc 100644
--- a/appsrc/ODS-Framework/vhost_simple.vspx
+++ b/appsrc/ODS-Framework/vhost_simple.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vhost_simple.vspx,v 1.4 2008/03/13 20:50:06 source Exp $
+ -  $Id: vhost_simple.vspx,v 1.4.2.1 2010/09/20 10:15:31 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/view.vspx b/appsrc/ODS-Framework/view.vspx
index a60dbb7..994683d 100644
--- a/appsrc/ODS-Framework/view.vspx
+++ b/appsrc/ODS-Framework/view.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: view.vspx,v 1.5 2008/03/13 20:50:06 source Exp $
+ -  $Id: view.vspx,v 1.5.2.1 2010/09/20 10:15:31 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/view_file.vspx b/appsrc/ODS-Framework/view_file.vspx
index 74f652a..fcf4f6b 100644
--- a/appsrc/ODS-Framework/view_file.vspx
+++ b/appsrc/ODS-Framework/view_file.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: view_file.vspx,v 1.6 2008/03/13 20:50:06 source Exp $
+ -  $Id: view_file.vspx,v 1.6.2.1 2010/09/20 10:15:31 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/wa_login.vspx b/appsrc/ODS-Framework/wa_login.vspx
index d8f6e31..e328fb2 100644
--- a/appsrc/ODS-Framework/wa_login.vspx
+++ b/appsrc/ODS-Framework/wa_login.vspx
@@ -1,7 +1,6 @@
-<?xml version="1.0"?>
 <!--
  -
- -  $Id: wa_login.vspx,v 1.4 2006/08/16 00:04:13 source Exp $
+ -  $Id: wa_login.vspx,v 1.4.2.2 2011/03/23 12:18:30 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/wa_maps.sql b/appsrc/ODS-Framework/wa_maps.sql
index 8c2f4f6..d4295da 100644
--- a/appsrc/ODS-Framework/wa_maps.sql
+++ b/appsrc/ODS-Framework/wa_maps.sql
@@ -1,5 +1,5 @@
 --
---  $Id: wa_maps.sql,v 1.7.2.1 2009/10/09 16:44:51 source Exp $
+--  $Id: wa_maps.sql,v 1.7.2.3 2010/12/10 16:04:14 source Exp $
 --
 --  Procedures to support the WA maps handling.
 --
@@ -21,6 +21,7 @@
 --  with this program; if not, write to the Free Software Foundation, Inc.,
 --  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 --
+--
 
 -- the public API to call for filling up the coordinates.
 -- returns the lat and lng.
diff --git a/appsrc/ODS-Framework/wa_maps.vspx b/appsrc/ODS-Framework/wa_maps.vspx
index b6d6ebf..5df9ce8 100644
--- a/appsrc/ODS-Framework/wa_maps.vspx
+++ b/appsrc/ODS-Framework/wa_maps.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: wa_maps.vspx,v 1.8 2008/03/13 20:50:06 source Exp $
+ -  $Id: wa_maps.vspx,v 1.8.2.1 2010/09/20 10:15:32 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/wa_search_procs.sql b/appsrc/ODS-Framework/wa_search_procs.sql
index 9684a1e..3fbf2f3 100644
--- a/appsrc/ODS-Framework/wa_search_procs.sql
+++ b/appsrc/ODS-Framework/wa_search_procs.sql
@@ -1,5 +1,5 @@
 --
---  $Id: wa_search_procs.sql,v 1.25 2008/03/13 20:50:06 source Exp $
+--  $Id: wa_search_procs.sql,v 1.25.2.1 2010/09/20 10:15:32 source Exp $
 --
 --  Procedures to support the WA search.
 --
diff --git a/appsrc/ODS-Framework/wa_template.sql b/appsrc/ODS-Framework/wa_template.sql
index 933e2eb..f3764f9 100644
--- a/appsrc/ODS-Framework/wa_template.sql
+++ b/appsrc/ODS-Framework/wa_template.sql
@@ -1,5 +1,5 @@
 --
---  $Id: wa_template.sql,v 1.4 2006/10/17 14:07:20 source Exp $
+--  $Id: wa_template.sql,v 1.4.2.1 2010/09/20 10:15:32 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Framework/web_header.vspx b/appsrc/ODS-Framework/web_header.vspx
index 354346a..8301205 100644
--- a/appsrc/ODS-Framework/web_header.vspx
+++ b/appsrc/ODS-Framework/web_header.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: web_header.vspx,v 1.5.2.1 2010/03/12 09:10:13 source Exp $
+ -  $Id: web_header.vspx,v 1.5.2.2 2010/09/20 10:15:32 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Framework/web_svc.sql b/appsrc/ODS-Framework/web_svc.sql
index d53f3e8..aa8e7ab 100644
--- a/appsrc/ODS-Framework/web_svc.sql
+++ b/appsrc/ODS-Framework/web_svc.sql
@@ -1,5 +1,5 @@
 --
---  $Id: web_svc.sql,v 1.7.2.3 2010/06/09 13:45:51 source Exp $
+--  $Id: web_svc.sql,v 1.7.2.6 2010/11/19 16:50:50 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -64,6 +64,18 @@ DB.DBA.wa_add_col ('ODS.DBA.APP_PING_LOG', 'APL_FEED_URL', 'varchar default null
 
 DB.DBA.wa_exec_no_error_log('create index APP_PING_LOG_IDX1 on ODS.DBA.APP_PING_LOG (APL_STAT, APL_WAI_ID)');
 
+DB.DBA.wa_exec_no_error_log(
+'create table ACT_PING_LOG (
+    APL_HOST_ID int references SVC_HOST (SH_ID) on update cascade on delete cascade,
+    APL_URI IRI_ID,
+    APL_WA_ID int references DB.DBA.WA_ACTIVITIES (WA_ID) on update cascade on delete cascade,
+    APL_STAT int default 0,
+    APL_TS timestamp,
+    APL_SENT datetime,
+    APL_ERROR long varchar,
+    APL_SEQ integer identity,
+    primary key (APL_URI, APL_HOST_ID, APL_STAT, APL_SEQ))');
+
 insert soft SVC_HOST (SH_ID, SH_URL, SH_NAME, SH_PROTO) values (0, '', '--', '');
 
 insert soft SVC_HOST (SH_ID, SH_URL, SH_NAME, SH_PROTO) values (1, 'http://rpc.weblogs.com/RPC2', 'Weblog.com', 'xml-rpc');
@@ -126,7 +138,7 @@ again:
       _inst := null;
       fetch cr into _host_id, _wai_id, nam, _inst, _title, _url, seq, _feed_url;
       commit work;
-      for select SH_URL, SH_PROTO, SH_METHOD from SVC_HOST where SH_ID = _host_id do
+      for select SH_URL, SH_PROTO, SH_METHOD, SH_NAME from SVC_HOST where SH_ID = _host_id do
 	  {
 
 	    if (isstring (SH_PROTO) and SH_PROTO <> '' and _inst is not null)
@@ -178,6 +190,14 @@ again:
 			  rc := DB.DBA.XMLRPC_CALL (SH_URL, 'weblogUpdates.extendedPing', vector (nam, url, url, _feed_url));
 			}
 		    }
+		  else if (SH_PROTO = 'REST' and lower (SH_NAME) = 'twitter')
+		    {
+		      declare sid any;
+		      sid := (select WUO_OAUTH_SID from DB.DBA.WA_USER_OL_ACCOUNTS, DB.DBA.WA_MEMBER 
+		      	where WAM_USER = WUO_U_ID and WAM_INST = _inst and WUO_NAME = 'Twitter');
+	              if (length (sid))
+ 		        ODS.ODS_API.twitter_status_update (_title, sid);	
+		    }
 		  else if (SH_PROTO = 'REST')
 		    {
 		      declare hf, ping_url any;
@@ -308,6 +328,103 @@ create procedure PSH_SUBSCRIBE_LINK ()
   return 'http://' || DB.DBA.WA_CNAME() || '/psh/subscribe.vsp';
 };
 
+create procedure PSH_ACTIVITY_PING (in ep_url varchar, in _feed_url varchar)
+{
+  declare hf, rc any;
+  rc := null;
+  declare exit handler for sqlstate '*'
+    {
+      return __SQL_MESSAGE;
+    };
+  http_get (ep_url, hf, 'POST', null, sprintf ('hub.mode=publish&hub.url=%U', _feed_url));
+  if (isarray (hf) and length (hf) and hf[0] not like 'HTTP/1._ 204 %')
+    {
+      rc := hf[0];
+    }
+  return rc;
+}
+;
+
+create procedure SVC_PROCESS_ACT_PINGS ()
+{
+  declare _host_id, rc, dedl, seq int;
+  declare nam, use_pings, _url, _title, _feed_url varchar;
+  declare _inst DB.DBA.web_app;
+
+  declare cr cursor for select APL_HOST_ID, APL_URI, APL_SEQ from ACT_PING_LOG where APL_STAT = 0;
+
+  dedl := 0;
+
+  declare exit handler for sqlstate '40001'
+    {
+      rollback work;
+      close cr;
+      dedl := dedl + 1;
+      if (dedl < 5)
+	goto again;
+    };
+
+again:
+  whenever not found goto ret;
+  open cr (prefetch 1);
+  while (1)
+    {
+      _inst := null;
+      fetch cr into _host_id, _feed_url, seq;
+      commit work;
+      for select SH_URL, SH_PROTO, SH_METHOD, SH_NAME from SVC_HOST where SH_ID = _host_id and SH_PROTO = 'PubSubHub' do
+	  {
+	    rc := PSH_ACTIVITY_PING (SH_URL, id_to_iri (_feed_url));
+	    if (rc is not null)
+	      {
+		update ACT_PING_LOG set APL_ERROR = rc, APL_STAT = 2, APL_SENT = now ()
+		    where APL_URI = _feed_url and APL_HOST_ID = _host_id and APL_STAT = 0 and APL_SEQ = seq;
+		commit work;
+	      }
+	  }
+      update ACT_PING_LOG set APL_STAT = 1, APL_SENT = now () where APL_URI = _feed_url and APL_HOST_ID = _host_id and APL_STAT = 0 and APL_SEQ = seq;
+      commit work;
+      next:;
+    }
+  ret:
+  close cr;
+  return;
+};
+
+create trigger WA_ACTIVITIES_I after insert on DB.DBA.WA_ACTIVITIES referencing new as N
+{
+  declare url, cname, uid any;
+  cname := DB.DBA.WA_CNAME ();
+  uid := (select U_NAME from DB.DBA.SYS_USERS where U_ID = N.WA_U_ID);
+  url := sprintf ('http://%s/activities/feeds/activities/user/%s/source/%d', cname, uid, N.WA_SRC_ID);
+  ACT_PING (N.WA_ID, url);
+}
+;
+
+create trigger WA_ACTIVITIES_U after update on DB.DBA.WA_ACTIVITIES referencing old as O, new as N
+{
+  declare url, cname, uid any;
+  cname := DB.DBA.WA_CNAME ();
+  uid := (select U_NAME from DB.DBA.SYS_USERS where U_ID = N.WA_U_ID);
+  url := sprintf ('http://%s/activities/feeds/activities/user/%s', cname, uid);
+  ACT_PING (N.WA_ID, url);
+}
+;
+
+
+create procedure ACT_PING (in act_id varchar, in act_url varchar)
+{
+  declare act_iri any;
+  act_iri := iri_to_id (act_url);
+  for select SH_ID from ODS.DBA.SVC_HOST where SH_PROTO = 'PubSubHub' do 
+    {
+      if (not exists (select 1 from ACT_PING_LOG where APL_WA_ID = act_id and APL_HOST_ID = SH_ID and APL_STAT = 0 and APL_URI = act_iri))
+	insert into ACT_PING_LOG (APL_URI, APL_HOST_ID, APL_STAT, APL_WA_ID)
+	    values (act_iri, SH_ID, 0, act_id);
+    }
+};
+
+
 use DB;
 
 create function WA_APP_PING_TGT_AGG_init (inout _agg any)
diff --git a/appsrc/ODS-Framework/webfinger.sql b/appsrc/ODS-Framework/webfinger.sql
new file mode 100644
index 0000000..79b7fed
--- /dev/null
+++ b/appsrc/ODS-Framework/webfinger.sql
@@ -0,0 +1,288 @@
+--
+--  $Id: webfinger.sql,v 1.1.4.13 2011/02/18 15:42:46 source Exp $
+--
+--  Webfinger & fingerpoint protocol support.
+--
+--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+--  project.
+--
+--  Copyright (C) 1998-2010 OpenLink Software
+--
+--  This project is free software; you can redistribute it and/or modify it
+--  under the terms of the GNU General Public License as published by the
+--  Free Software Foundation; only version 2 of the License, dated June 1991.
+--
+--  This program is distributed in the hope that it will be useful, but
+--  WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+--  General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License along
+--  with this program; if not, write to the Free Software Foundation, Inc.,
+--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+--
+
+use ODS;
+
+-- XXX: obsoleted by server side host meta see below
+create procedure "host-meta" () __SOAP_HTTP 'application/xrd+xml'
+{
+  declare host varchar;
+  host := http_host ();
+  http ('<?xml version="1.0" encoding="UTF-8"?>\n');
+  http ('<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/xrd/1.0">\n');
+  http (sprintf ('<hm:Host>%s</hm:Host>\n', host));
+  http (sprintf ('<Link rel="lrdd" template="http://%s/ods/describe?uri={uri}">\n', host));
+  http ('<Title>Resource Descriptor</Title>\n');
+  http ('</Link>\n');
+  http ('</XRD>\n');
+  return '';
+}
+;
+
+create procedure "describe" (in "uri" varchar, in format varchar := 'xml') __SOAP_HTTP 'application/xrd+xml'
+{
+  declare host, mail, uname, accept varchar;
+  declare arr, tmp, graph, uri_copy, lines any;
+  host := http_host ();
+  arr := WS.WS.PARSE_URI ("uri");
+  graph := sioc..get_graph ();
+  if (arr [0] = '' or arr[0] = 'mailto')
+    "uri" := 'acct:' || arr[2];
+  else if (arr [0] = 'http')
+    {
+      tmp := (sparql define input:storage "" 
+        prefix foaf: <http://xmlns.com/foaf/0.1/> 
+      	select ?mbox where 
+	 { graph `iri(?:graph)` { `iri(?:uri_copy)` foaf:mbox ?mbox }});
+      if (tmp is not null)
+        {
+	  arr := WS.WS.PARSE_URI (tmp);
+    "uri" := 'acct:' || arr[2];
+	}	  
+    } 
+  uri_copy := "uri";
+  mail := arr[2];
+  uname := (select top 1 U_NAME from DB.DBA.SYS_USERS where U_E_MAIL = mail order by U_ID);
+  if (uname is null)
+    {
+      uname := (sparql define input:storage "" 
+      	prefix owl: <http://www.w3.org/2002/07/owl#> 
+        prefix foaf: <http://xmlns.com/foaf/0.1/> 
+      	select ?nick 
+         where { graph `iri(?:graph)` { ?s owl:sameAs `iri(?:uri_copy)` ; foaf:nick ?nick . }});
+    }
+
+  if (uname is null)
+    signal ('22023', sprintf ('The user account "%s" does not exist', "uri"));
+  http ('<?xml version="1.0" encoding="UTF-8"?>\n');
+  http ('<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/xrd/1.0">\n');
+  http (sprintf ('<Subject>%s</Subject>\n', "uri"));
+  http (sprintf ('  <Alias>%s</Alias>\n', sioc..user_doc_iri (uname)));
+  --http (sprintf ('  <Link rel="http://openid.net/signon/1.1/provider" href="http://%{WSHost}s/openid" />\n'));
+  http (sprintf ('  <Link rel="http://specs.openid.net/auth/2.0/provider" href="%s" />\n', sioc..user_doc_iri (uname)));
+  http (sprintf ('<Link rel="http://xmlns.com/foaf/0.1/openid" href="%s"/>\n', sioc..user_doc_iri (uname)));
+  http (sprintf ('  <Link rel="%s" href="%s" />\n', sioc..owl_iri ('sameAs'), sioc..person_iri (sioc..user_obj_iri (uname))));
+  http (sprintf ('<Link rel="http://webfinger.net/rel/profile-page" type="text/html" href="%s" />\n', 
+	sioc..person_iri (sioc..user_obj_iri (uname), '')));
+  --http (sprintf ('<Link rel="http://portablecontacts.net/spec/1.0#me" href="%s" />\n', sioc..user_doc_iri (uname)));
+  --http (sprintf ('<Link rel="http://microformats.org/profile/hcard" type="text/html" href="http://%s/ods/uhome.vspx?ufname=%s" />\n', host, uname));
+  http (sprintf ('<Property type="webid" href="%s" />\n', sioc..person_iri (sioc..user_obj_iri (uname))));
+  http (sprintf ('  <Link rel="me" href="%s" />\n', sioc..person_iri (sioc..user_obj_iri (uname))));
+  http (sprintf ('<Link rel="http://schemas.google.com/g/2010#updates-from" href="http://%s/activities/feeds/activities/user/%U" type="application/atom+xml" />\n', host, uname));
+  for select * from DB.DBA.WA_USER_CERTS, DB.DBA.SYS_USERS where UC_U_ID = U_ID and U_NAME = uname do
+    {
+      http (sprintf ('<Property type="certificate" href="http://%s/ods/certs/pem/%d" />\n', host, UC_ID));
+    }
+  for select WUO_NAME, WUO_URL, WUO_URI from DB.DBA.WA_USER_OL_ACCOUNTS, DB.DBA.SYS_USERS where U_NAME = uname and WUO_U_ID = U_ID do
+    {
+      http (sprintf ('  <Link rel="http://xmlns.com/foaf/0.1/OnlineAccount" href="%V"><Title>%V</Title></Link>\n', WUO_URI, WUO_NAME));
+    }
+  http (sprintf ('<Link rel="http://xmlns.com/foaf/0.1/made" href="http://%s%s?uri=%s" />\n', host, http_path (), "uri"));
+  http (sprintf ('  <Link rel="describedby" href="%s" type="text/html" />\n', sioc..person_iri (sioc..user_obj_iri (uname), '')));
+  http (sprintf ('  <Link rel="describedby" href="%s/foaf.rdf" type="application/rdf+xml" />\n', sioc..person_iri (sioc..user_obj_iri (uname), '')));
+  for select WAM_HOME_PAGE, WAM_INST, WAM_APP_TYPE 
+    from DB.DBA.SYS_USERS, DB.DBA.WA_MEMBER where WAM_USER = U_ID and U_NAME = uname and WAM_MEMBER_TYPE = 1 do
+    {
+      declare url varchar; 
+      url := sioc..forum_iri (WAM_APP_TYPE, WAM_INST, uname);
+      http (sprintf ('<Link rel="http://xmlns.com/foaf/0.1/made" href="%s" />\n', url));
+    }
+  set_user_id (uname);
+  set_qualifier ('DB');
+  for select WAUI_SALMON_KEY from DB.DBA.WA_USER_INFO, DB.DBA.SYS_USERS where WAUI_U_ID = U_ID and U_NAME = uname do
+    {
+      declare x any;
+      if (WAUI_SALMON_KEY is not null and xenc_key_exists (WAUI_SALMON_KEY))
+	{
+	  declare exit handler for sqlstate '*' { goto nextk; };
+	  x := xenc_pubkey_magic_export (WAUI_SALMON_KEY);
+	  http (sprintf ('  <Link rel="magic-public-key" href="data:application/magic-public-key,%s" />\n', replace (replace (x, '+', '-'), '/', '_')));
+	  nextk:;
+	}
+    }
+  --for select xenc_key, xenc_type from DB.DBA.ods_user_keys (username) (xenc_key varchar, xenc_type varchar) x where username = uname do
+  --  {
+  --  }
+  set_user_id ('dba');
+  http (sprintf ('  <Link rel="salmon" href="http://%s/ods/salmon" />\n', host));
+  http ('</XRD>\n');
+  lines := http_request_header ();
+  accept := DB.DBA.HTTP_RDF_GET_ACCEPT_BY_Q (http_request_header_full (lines, 'Accept', '*/*'));
+  if (format = 'json' or accept = 'application/json')
+    {
+      http_header ('Content-Type: applicaition/json\r\n');
+    http_xslt ('http://local.virt/xrd2json');
+    }
+  return '';
+}
+;
+
+create procedure "certs" (in "id" int, in format varchar) __SOAP_HTTP 'text/plain'
+{
+  for select UC_CERT from DB.DBA.WA_USER_CERTS where UC_ID = "id" do
+    http (UC_CERT);
+  return '';
+}
+;
+
+create procedure WF_INIT ()
+{
+  if (__proc_exists ('WS.WS.host_meta_add') is not null)
+    {
+      WS.WS.host_meta_add ('ODS.webfinger', '<Link rel="lrdd" template="http://%{WSHost}s/ods/describe?uri={uri}"/>');
+    }
+  else
+    {
+DB.DBA.VHOST_REMOVE (lpath=>'/.well-known');
+DB.DBA.VHOST_DEFINE (lpath=>'/.well-known', ppath=>'/SOAP/Http', soap_user=>'ODS_API');
+    }
+}
+;
+
+WF_INIT ()
+;    
+
+DB.DBA.VHOST_REMOVE (lpath=>'/ods/describe');
+DB.DBA.VHOST_DEFINE (lpath=>'/ods/describe', ppath=>'/SOAP/Http/describe', soap_user=>'ODS_API');
+DB.DBA.VHOST_REMOVE (lpath=>'/ods/certs');
+DB.DBA.VHOST_DEFINE (lpath=>'/ods/certs', ppath=>'/SOAP/Http/certs', soap_user=>'ODS_API', opts=>vector ('url_rewrite', 'ods_certs_list1'));
+
+DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_certs_list1', 1, vector ('ods_cert_rule1'));
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_cert_rule1', 1,
+    '/ods/certs/([^/]*)/([^/]*)\x24',
+    vector('format', 'id'), 3,
+    '/ods/certs?id=%s&format=%s', vector('id', 'format'),
+    null,
+    null,
+    2);
+
+grant execute on ODS.DBA."host-meta" to ODS_API;
+grant execute on ODS.DBA."describe" to ODS_API;
+grant execute on ODS.DBA."certs" to ODS_API;
+
+create procedure WF_USER_XRD_GET (in acct varchar)
+{
+  declare mail, webid, domain, host_info, xrd, template, url any;
+  declare xt, xd, tmpcert, h, ret any;
+
+  h := rfc1808_parse_uri (acct);
+  if (h[0] = '' or h[0] = 'acct' or h[0] = 'mailto')
+    mail := h[2];
+  else   
+    mail := acct; 
+
+  if (mail is null or position ('@', mail) = 0)
+    return null;
+
+  declare exit handler for sqlstate '*'
+    {
+      -- connection error or parse error
+      return null;
+    };
+
+  domain := subseq (mail, position ('@', mail));
+  commit work;
+  host_info := http_get (sprintf ('http://%s/.well-known/host-meta', domain));
+  xd := xtree_doc (host_info);
+  template := cast (xpath_eval ('/XRD/Link[@rel="lrdd"]/@template', xd) as varchar);
+  url := replace (template, '{uri}', 'acct:' || mail);
+  xrd := http_get (url);
+  xd := xtree_doc (xrd);
+  return xd;
+}
+;
+
+create procedure WF_PROFILE_GET (in acct varchar)
+{
+  declare xt, xd any;
+
+  xd := WF_USER_XRD_GET (acct);
+  if (isnull (xd))
+    return null;
+
+  xt := cast (xpath_eval ('/XRD/Link[@rel="http://webfinger.net/rel/profile-page"]/@href', xd) as varchar);
+  return xt;
+}
+;
+
+create procedure FINGERPOINT_WEBID_GET (in cert varchar := null, in mail varchar := null)
+{
+  declare webid, domain, page, template, url, fp, links, head, xd, tmpcert, res, tmp, link, qr, xp any;
+
+  res := null;
+  declare exit handler for sqlstate '*'
+    {
+      -- connection error or parse error
+      return null;
+    };
+
+  if (mail is null)
+    mail := DB.DBA.FOAF_SSL_MAIL_GET (cert);
+  else
+    {
+      declare h any;
+      h := rfc1808_parse_uri (mail);
+      if (h[0] = '' or h[0] = 'acct' or h[0] = 'mailto')
+        mail := h[2];
+    }
+  if (mail is null or position ('@', mail) = 0)
+    return null;
+
+  domain := subseq (mail, position ('@', mail));
+  page := http_get (sprintf ('http://%s/', domain), head, 'GET', null, null, null, 15);
+  links := http_request_header_full (head, 'Link');
+  if (links is null)
+    return null;
+  links := regexp_replace (links, ',[ \n\t]*', ',', 1, null);
+  links := regexp_replace (links, ';[ \n\t]*', ';', 1, null);
+  links := split_and_decode (links, 0, '\0\0,');
+  foreach (varchar str in links) do
+    {
+      link := split_and_decode (str, 0, '\0\0;');
+      link := ltrim(rtrim (link[0], '>'), '<');
+      tmp := subseq (str, position (';', str));
+      tmp := split_and_decode (tmp, 0, '\0\0;=');
+      if (get_keyword ('rel', tmp) = '"http://ontologi.es/sparql#fingerpoint"')
+	{
+	  fp := link;
+	  goto do_check;
+	}
+    }
+  return null;
+  do_check:
+--  dbg_obj_print_vars (fp);
+  if (strchr (fp, '?') is null)
+    fp := fp || '?';
+  else  
+    fp := fp || '&';
+  qr := sprintf ('prefix owl: <%s> SELECT ?webid WHERE {{ ?webid owl:sameAs <acct:%s> } UNION { <acct:%s> owl:sameAs ?webid }}',
+  	sioc..owl_iri (''), mail, mail);
+  url := sprintf ('%squery=%U', fp, qr); 
+  page := http_get (url);
+  res := cast (xpath_eval ('/sparql/results/result/binding[@name="webid"]/uri/text()', xtree_doc (page)) as varchar);
+  return res;
+}
+;
+
+use DB;
diff --git a/appsrc/ODS-Framework/webid_select.vspx b/appsrc/ODS-Framework/webid_select.vspx
new file mode 100644
index 0000000..3932dd1
--- /dev/null
+++ b/appsrc/ODS-Framework/webid_select.vspx
@@ -0,0 +1,297 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: webid_select.vspx,v 1.1.4.5 2010/10/13 12:16:49 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2009 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<script type="text/javascript" src="/ods/users_select.js"></script>
+<script type="text/javascript" src="/ods/oat/loader.js"></script>
+<v:page name="webid_select"
+        style="index.xsl"
+        fast-render="1"
+        xmlns:v="http://www.openlinksw.com/vspx/"
+        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN">
+
+  <vm:page>
+    <vm:header>
+      <vm:title>Select users to invite</vm:title>
+      <link rel="stylesheet" type="text/css" href="default.css" />
+      <style type="text/css">
+        a {
+          text-decoration: none;
+        }
+        a:active {
+          text-decoration: none;
+        }
+        a:visited {
+          text-decoration: none;
+        }
+        a:hover {
+          text-decoration: none;
+        }
+        .listing_row_odd:hover, .listing_row_even:hover {
+         	background-color: #eec;
+        }
+        div.boxHeader {
+          background-color: #EFEFEF;
+          margin: 0 0 0.5em 0;
+          padding: 2px;
+          border: 1px solid #7F94A5;
+          vertical-align: middle;
+        }
+        input.button {
+          margin: .2em 0 .1em 0;
+          font-size: .8em;
+          font-family: verdana, sans-serif;
+          color: #ffffff;
+          font-weight: bold;
+          border: solid 1px;
+          border-color: #7F94A5;
+          background: #99b3c5;
+        }
+        .button2 {
+          font-size: .8em;
+          font-family: verdana, sans-serif;
+          color: #ffffff;
+          font-weight: bold;
+          padding: 0.1em 1em 0.1em 1em ;
+          border: solid 1px;
+          border-color: #7F94A5;
+          background: #99b3c5;
+        }
+      </style>
+    </vm:header>
+
+    <v:method name="sortColumn" arglist="in titleName varchar, in columnName varchar">
+      <![CDATA[
+        declare altStr, directionStr, imageStr varchar;
+
+        if (self.v_order = columnName and self.v_direction = 'desc') {
+          directionStr := 'Ascending';
+          imageStr := ' <img src="images/icons/orderdown_16.png" border="0" alt="Down"/>';
+        } else if (self.v_order = columnName and self.v_direction = 'asc') {
+          directionStr := 'Descending';
+          imageStr := ' <img src="images/icons/orderup_16.png" border="0" alt="Up"/>';
+        } else {
+          directionStr := 'Ascending';
+          imageStr := '  ';
+        }
+        altStr := sprintf('Sort Rows on %s in %s Order', titleName, directionStr);
+        http(sprintf('<a href="#" onClick="javascript: myPost(''page_form'', ''sortColumn'', ''%s''); return false;" alt="%s" title="%s">%s%s</a>', columnName, altStr, altStr, titleName, imageStr));
+      ]]>
+    </v:method>
+
+    <v:method name="sortChange" arglist="in columnName varchar">
+      <![CDATA[
+        if (columnName <> '')
+        {
+        self.ds.vc_reset();
+          if (self.v_order = columnName)
+          {
+          self.v_direction := either(equ(self.v_direction, 'asc'), 'desc', 'asc');
+        } else {
+          self.v_direction := 'asc';
+        self.v_order := columnName;
+          }
+        }
+      ]]>
+    </v:method>
+
+    <v:method name="isMultiple" arglist="in dst any">
+      <![CDATA[
+        return case when isnull (strstr (self.v_dst, 'm')) then 0 else 1 end;
+      ]]>
+    </v:method>
+
+    <v:before-data-bind>
+      <![CDATA[
+        if (isnull(self.v_filter))
+          self.v_filter := self.v_mode;
+      ]]>
+    </v:before-data-bind>
+
+    <vm:pagewrapper odsbar="no" >
+      <vm:variables>
+        <v:variable name="v_params" param-name="params" type="varchar"/>
+        <v:variable name="v_mode" persist="0" param-name="mode" type="varchar" default="''"/>
+        <v:variable name="v_value" persist="0" type="varchar" default="''"/>
+        <v:variable name="v_filter" persist="0" type="varchar" default="null"/>
+        <v:variable name="v_order" persist="0" type="varchar" default="'F2'" />
+        <v:variable name="v_direction" persist="0" type="varchar" default="'asc'" />
+        <v:variable name="v_src" persist="0" param-name="src" type="varchar" default="''" />
+        <v:variable name="v_dst" persist="0" param-name="dst" type="varchar" default="'sc'" />
+        <v:variable name="v_s1" persist="0" param-name="s1" type="varchar" default="''" />
+        <v:variable name="v_s2" persist="0" param-name="s2" type="varchar" default="''" />
+      </vm:variables>
+      <vm:body>
+        <vm:login redirect="index.vspx"/>
+        <input type="hidden" name="sid"   id="sid"   value="<?V get_keyword('sid', self.vc_page.vc_event.ve_params) ?>" />
+        <input type="hidden" name="realm" id="realm" value="<?V get_keyword('realm', self.vc_page.vc_event.ve_params) ?> " />
+        <input type="hidden" name="form"  id="form"  value="<?V get_keyword('form', self.vc_page.vc_event.ve_params, 'page_form') ?> " />
+        <input type="hidden" name="src"   id="src"   value="<?V get_keyword('src', self.vc_page.vc_event.ve_params, '') ?>" />
+        <input type="hidden" name="dst"   id="dst"   value="<?V get_keyword('dst', self.vc_page.vc_event.ve_params, 'sc') ?>" />
+        <input type="hidden" name="s1"    id="s1"    value="<?V get_keyword('s1', self.vc_page.vc_event.ve_params, '') ?>" />
+        <input type="hidden" name="s2"    id="s2"    value="<?V get_keyword('s2', self.vc_page.vc_event.ve_params, '') ?>" />
+        <v:text name="params" type="hidden" value="--self.v_params"/>
+        <div style="padding: 0.2em;">
+          <div style="padding: 0 0 0.5em 0;">
+            <span class="button pointer" onclick="javascript: if (opener != null) opener.focus(); window.close();"><img class="button" src="/ods/images/icons/close_16.png" border="0" alt="Close" title="Close" /> Close</span>
+          </div>
+          <vm:if test="self.v_mode = ''">
+          <div class="boxHeader">
+            Show
+              <v:select-list name="filter" value="--self.v_filter">
+              <v:item name="Persons & Groups" value="" />
+              <v:item name="Persons" value="p" />
+              <v:item name="Groups" value="g" />
+            </v:select-list>
+          </div>
+          </vm:if>
+          <v:data-source name="dsrc" expression-type="sql" nrows="10" initial-offset="0">
+            <v:before-data-bind>
+              <![CDATA[
+                declare user_sql, group_sql varchar;
+
+                user_sql := '';
+                group_sql := '';
+                if (self.v_filter <> 'p')
+                {
+                  group_sql := sprintf ('select ''Group'' F1, SIOC..acl_group_iri (%d, WACL_NAME) F2, WACL_DESCRIPTION F3 from WA_GROUPS_ACL where WACL_USER_ID = %d', self.u_id, self.u_id);
+                }
+                if (self.v_filter <> 'g')
+                {
+                  if (DB.DBA.wa_check_app ('AddressBook', self.u_id))
+                  {
+                    user_sql := sprintf ('select ''Person'' F1, a.P_IRI F2, a.P_NAME F3 from AB.WA.PERSONS a, DB.DBA.WA_MEMBER b, DB.DBA.WA_INSTANCE c where a.P_DOMAIN_ID = c.WAI_ID and c.WAI_TYPE_NAME = ''AddressBook'' and c.WAI_NAME = b.WAM_INST and B.WAM_MEMBER_TYPE = 1 and b.WAM_USER = %d and DB.DBA.is_empty_or_null (a.P_IRI) <> 1', self.u_id);
+                  } else {
+                    user_sql := 'select ''Person'' F1, '''' F2, '''' F3 from DB.DBA.SYS_USERS where 0 = 1';
+                  }
+                }
+                if (user_sql = '')
+                {
+                  control.ds_sql := group_sql;
+                }
+                else if (group_sql = '')
+                {
+                  control.ds_sql := user_sql;
+                }
+                else
+                {
+                  control.ds_sql := concat('select F1, F2, F3 from (', user_sql, ' union ' , group_sql, ') x ');
+                }
+                self.sortChange(get_keyword('sortColumn', e.ve_params, ''));
+                control.ds_sql := concat(control.ds_sql, ' order by ', self.v_order, ' ', self.v_direction);
+              ]]>
+            </v:before-data-bind>
+            <v:after-data-bind>
+              control.ds_make_statistic ();
+            </v:after-data-bind>
+          </v:data-source>
+          <v:data-set name="ds" data-source="self.dsrc" scrollable="1">
+            <v:template name="ds_header" type="simple" name-to-remove="table" set-to-remove="bottom">
+              <table id="webids" class="listing" cellspacing="0">
+                <tr class="listing_header_row">
+                  <vm:if test="self.isMultiple(self.v_dst)">
+                    <th class="checkbox" width="1%">
+                      <input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, 'cb_item'); updateChecked(this, 'cb_item'); "/>
+                    </th>
+                  </vm:if>
+                  <vm:if test="self.v_mode = ''">
+                    <th>
+                      Type
+                    </th>
+                  </vm:if>
+                  <th>
+                    <?vsp self.sortColumn('WebID', 'F2'); ?>
+                  </th>
+                  <th>
+                    <?vsp self.sortColumn('Description', 'F3'); ?>
+                  </th>
+                </tr>
+              </table>
+            </v:template>
+
+            <v:template name="ds_repeat" type="repeat" name-to-remove="" set-to-remove="">
+
+              <v:template name="ds_empty" type="if-not-exists" name-to-remove="table" set-to-remove="both">
+                <table>
+                  <td colspan="<?V either(equ(self.v_mode,''),3,2)+self.isMultiple(self.v_dst) ?>">
+                    No records
+                  </td>
+                </table>
+              </v:template>
+
+              <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
+                <table>
+                  <tr onclick="rowSelected(this);" class="pointer <?V case when mod(control.te_ctr,2) = 0 then 'listing_row_odd' else 'listing_row_even' end ?>">
+                    <vm:if test="self.isMultiple(self.v_dst)">
+                      <td  align="center">
+                        <?vsp
+                          declare S, name any;
+
+                          name := (control as vspx_row_template).te_column_value('U_NAME');
+                          S := case when isnull (strstr(self.v_s1, concat(name, ','))) then '' else 'checked="checked"' end;
+                          http (sprintf ('<input type="checkbox" name="cb_item" value="%s" %s onclick="javascript: updateChecked(this, ''cb_item'', event); " />', name, S));
+                        ?>
+                      </td>
+                    </vm:if>
+                    <vm:if test="self.v_mode = ''">
+                      <td nowrap="nowrap">
+                        <v:label value="--((control.vc_parent).vc_parent as vspx_row_template).te_column_value('F1')" format="%s"/>
+                      </td>
+                    </vm:if>
+                    <td nowrap="nowrap">
+                      <input name="s1_item" type="hidden" value="<?V (control as vspx_row_template).te_column_value('F2') ?>" />
+                      <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('F2')" format="%s"/>
+                    </td>
+                    <td nowrap="nowrap">
+                      <input name="s2_item" type="hidden" value="<?V (control as vspx_row_template).te_column_value('F3') ?>" />
+                      <v:label value="--(control.vc_parent as vspx_row_template).te_column_value('F3')" format="%s"/>
+                    </td>
+                  </tr>
+                </table>
+              </v:template>
+
+            </v:template>
+
+            <v:template type="simple" name-to-remove="table" set-to-remove="top">
+              <table>
+                <tr align="center">
+                  <td colspan="<?V either(equ(self.v_mode,''),3,2)+self.isMultiple(self.v_dst) ?>">
+                    <vm:ds-navigation data-set="ds"/>
+                  </td>
+                </tr>
+              </table>
+            </v:template>
+
+          </v:data-set>
+          <vm:if test="self.isMultiple(self.v_dst)">
+            <div style="padding: 0 0 0.5em 0;">
+              <hr />
+              <a href="#" onclick="javascript: addChecked(document.forms['page_form'], 'cb_item', 'No users were selected for addition. No groups were selected for addition.');" class="button2">&nbsp;Add selected</a>
+            </div>
+          </vm:if>
+        </div>
+      </vm:body>
+    </vm:pagewrapper>
+  </vm:page>
+</v:page>
diff --git a/appsrc/ODS-Gallery/Makefile.in b/appsrc/ODS-Gallery/Makefile.in
index e6e1d21..10a3d10 100644
--- a/appsrc/ODS-Gallery/Makefile.in
+++ b/appsrc/ODS-Gallery/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-Gallery/make_vad.sh b/appsrc/ODS-Gallery/make_vad.sh
index 2cd7e65..010088d 100755
--- a/appsrc/ODS-Gallery/make_vad.sh
+++ b/appsrc/ODS-Gallery/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.22.2.7 2010/07/05 08:24:49 source Exp $
+#  $Id: make_vad.sh,v 1.22.2.9 2011/02/03 10:26:16 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -226,7 +226,7 @@ sticker_init() {
   echo "  <name package=\"Gallery\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS Gallery\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
diff --git a/appsrc/ODS-Gallery/sql/create_tables.sql b/appsrc/ODS-Gallery/sql/create_tables.sql
index e6c84e1..653e9dc 100644
--- a/appsrc/ODS-Gallery/sql/create_tables.sql
+++ b/appsrc/ODS-Gallery/sql/create_tables.sql
@@ -1,5 +1,5 @@
 --
---  $Id: create_tables.sql,v 1.9 2008/02/28 21:23:30 source Exp $
+--  $Id: create_tables.sql,v 1.9.2.1 2010/09/20 10:15:36 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/create_triggers.sql b/appsrc/ODS-Gallery/sql/create_triggers.sql
index e187ac0..a8baa67 100644
--- a/appsrc/ODS-Gallery/sql/create_triggers.sql
+++ b/appsrc/ODS-Gallery/sql/create_triggers.sql
@@ -1,5 +1,5 @@
 --
---  $Id: create_triggers.sql,v 1.4.2.1 2010/05/31 21:59:14 source Exp $
+--  $Id: create_triggers.sql,v 1.4.2.2 2010/09/20 10:15:36 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/photo-wa-install.sql b/appsrc/ODS-Gallery/sql/photo-wa-install.sql
index f2c38ba..32b3277 100644
--- a/appsrc/ODS-Gallery/sql/photo-wa-install.sql
+++ b/appsrc/ODS-Gallery/sql/photo-wa-install.sql
@@ -1,5 +1,5 @@
 --
---  $Id: photo-wa-install.sql,v 1.16.2.1 2010/05/18 10:40:38 source Exp $
+--  $Id: photo-wa-install.sql,v 1.16.2.2 2010/09/20 10:15:36 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/photo-wa-uninstall.sql b/appsrc/ODS-Gallery/sql/photo-wa-uninstall.sql
index a33840a..63ed3b1 100644
--- a/appsrc/ODS-Gallery/sql/photo-wa-uninstall.sql
+++ b/appsrc/ODS-Gallery/sql/photo-wa-uninstall.sql
@@ -1,5 +1,5 @@
 --
---  $Id: photo-wa-uninstall.sql,v 1.8 2008/02/22 13:07:23 source Exp $
+--  $Id: photo-wa-uninstall.sql,v 1.8.2.1 2010/09/20 10:15:36 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/procedures/comments.sql b/appsrc/ODS-Gallery/sql/procedures/comments.sql
index 46f3733..3953fe6 100644
--- a/appsrc/ODS-Gallery/sql/procedures/comments.sql
+++ b/appsrc/ODS-Gallery/sql/procedures/comments.sql
@@ -1,5 +1,5 @@
 --
---  $Id: comments.sql,v 1.10 2008/02/28 21:23:30 source Exp $
+--  $Id: comments.sql,v 1.10.2.1 2010/09/20 10:15:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/procedures/common.sql b/appsrc/ODS-Gallery/sql/procedures/common.sql
index 0c17728..3753377 100644
--- a/appsrc/ODS-Gallery/sql/procedures/common.sql
+++ b/appsrc/ODS-Gallery/sql/procedures/common.sql
@@ -1,5 +1,5 @@
 --
---  $Id: common.sql,v 1.5 2008/02/26 20:23:21 source Exp $
+--  $Id: common.sql,v 1.5.2.1 2010/09/20 10:15:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/procedures/dav_api.sql b/appsrc/ODS-Gallery/sql/procedures/dav_api.sql
index 879e0ff..c407380 100644
--- a/appsrc/ODS-Gallery/sql/procedures/dav_api.sql
+++ b/appsrc/ODS-Gallery/sql/procedures/dav_api.sql
@@ -1,5 +1,5 @@
 --
---  $Id: dav_api.sql,v 1.13.2.1 2009/06/22 14:22:41 source Exp $
+--  $Id: dav_api.sql,v 1.13.2.2 2010/09/20 10:15:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/procedures/exec_no_error.sql b/appsrc/ODS-Gallery/sql/procedures/exec_no_error.sql
index a2fa29a..b425a86 100644
--- a/appsrc/ODS-Gallery/sql/procedures/exec_no_error.sql
+++ b/appsrc/ODS-Gallery/sql/procedures/exec_no_error.sql
@@ -1,5 +1,5 @@
 --
---  $Id: exec_no_error.sql,v 1.5 2008/02/19 11:10:50 source Exp $
+--  $Id: exec_no_error.sql,v 1.5.2.1 2010/09/20 10:15:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/procedures/images.sql b/appsrc/ODS-Gallery/sql/procedures/images.sql
index 37e7e41..d817496 100644
--- a/appsrc/ODS-Gallery/sql/procedures/images.sql
+++ b/appsrc/ODS-Gallery/sql/procedures/images.sql
@@ -1,5 +1,5 @@
 --
---  $Id: images.sql,v 1.9 2008/06/04 08:14:38 source Exp $
+--  $Id: images.sql,v 1.9.2.1 2010/09/20 10:15:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/procedures/nntp.sql b/appsrc/ODS-Gallery/sql/procedures/nntp.sql
index 37579bb..cf341b3 100644
--- a/appsrc/ODS-Gallery/sql/procedures/nntp.sql
+++ b/appsrc/ODS-Gallery/sql/procedures/nntp.sql
@@ -1,5 +1,5 @@
 --
---  $Id: nntp.sql,v 1.2 2009/01/05 15:00:48 source Exp $
+--  $Id: nntp.sql,v 1.2.2.1 2010/09/20 10:15:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/procedures/photo_api.sql b/appsrc/ODS-Gallery/sql/procedures/photo_api.sql
index bc01ca8..923b0da 100644
--- a/appsrc/ODS-Gallery/sql/procedures/photo_api.sql
+++ b/appsrc/ODS-Gallery/sql/procedures/photo_api.sql
@@ -1,5 +1,5 @@
 --
---  $Id: photo_api.sql,v 1.4.2.2 2009/12/08 23:25:22 source Exp $
+--  $Id: photo_api.sql,v 1.4.2.3 2010/09/20 10:15:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/procedures/procedures.sql b/appsrc/ODS-Gallery/sql/procedures/procedures.sql
index 8ec7873..c92acc7 100644
--- a/appsrc/ODS-Gallery/sql/procedures/procedures.sql
+++ b/appsrc/ODS-Gallery/sql/procedures/procedures.sql
@@ -1,5 +1,5 @@
 --
---  $Id: procedures.sql,v 1.14 2009/03/09 09:51:40 source Exp $
+--  $Id: procedures.sql,v 1.14.2.1 2010/09/20 10:15:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/procedures/rss.sql b/appsrc/ODS-Gallery/sql/procedures/rss.sql
index 6f1e09e..8f765f5 100644
--- a/appsrc/ODS-Gallery/sql/procedures/rss.sql
+++ b/appsrc/ODS-Gallery/sql/procedures/rss.sql
@@ -1,5 +1,5 @@
 --
---  $Id: rss.sql,v 1.3.2.2 2010/07/05 08:24:49 source Exp $
+--  $Id: rss.sql,v 1.3.2.3 2010/09/20 10:15:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/procedures/sioc.sql b/appsrc/ODS-Gallery/sql/procedures/sioc.sql
index 3932ffa..be3f171 100644
--- a/appsrc/ODS-Gallery/sql/procedures/sioc.sql
+++ b/appsrc/ODS-Gallery/sql/procedures/sioc.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sioc.sql,v 1.19.2.3 2010/05/18 10:40:38 source Exp $
+--  $Id: sioc.sql,v 1.19.2.4 2010/09/20 10:15:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/sql/procedures/types.sql b/appsrc/ODS-Gallery/sql/procedures/types.sql
index 740cd4a..98ba241 100644
--- a/appsrc/ODS-Gallery/sql/procedures/types.sql
+++ b/appsrc/ODS-Gallery/sql/procedures/types.sql
@@ -1,5 +1,5 @@
 --
---  $Id: types.sql,v 1.8.2.1 2010/05/31 21:59:14 source Exp $
+--  $Id: types.sql,v 1.8.2.2 2010/09/20 10:15:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/www-root/css/gallery.css b/appsrc/ODS-Gallery/www-root/css/gallery.css
index 72768b8..93ba432 100644
--- a/appsrc/ODS-Gallery/www-root/css/gallery.css
+++ b/appsrc/ODS-Gallery/www-root/css/gallery.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: gallery.css,v 1.13 2008/02/28 21:23:30 source Exp $
+ *  $Id: gallery.css,v 1.13.2.1 2010/09/20 10:15:38 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Gallery/www-root/css/timeline.css b/appsrc/ODS-Gallery/www-root/css/timeline.css
index 439c219..c105a20 100644
--- a/appsrc/ODS-Gallery/www-root/css/timeline.css
+++ b/appsrc/ODS-Gallery/www-root/css/timeline.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: timeline.css,v 1.2 2008/02/19 11:10:51 source Exp $
+ *  $Id: timeline.css,v 1.2.2.1 2010/09/20 10:15:38 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
diff --git a/appsrc/ODS-Gallery/www-root/css/upload.css b/appsrc/ODS-Gallery/www-root/css/upload.css
index 872578f..f9c099e 100644
--- a/appsrc/ODS-Gallery/www-root/css/upload.css
+++ b/appsrc/ODS-Gallery/www-root/css/upload.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: upload.css,v 1.2 2006/05/31 13:13:02 source Exp $
+ *  $Id: upload.css,v 1.2.2.1 2010/09/20 10:15:38 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Gallery/www-root/image.vsp b/appsrc/ODS-Gallery/www-root/image.vsp
index e845e0c..bae7120 100644
--- a/appsrc/ODS-Gallery/www-root/image.vsp
+++ b/appsrc/ODS-Gallery/www-root/image.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: image.vsp,v 1.5 2007/07/26 15:18:53 source Exp $
+--  $Id: image.vsp,v 1.5.2.1 2010/09/20 10:15:38 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/www-root/index.vspx b/appsrc/ODS-Gallery/www-root/index.vspx
index ea297b5..21ac1d3 100644
--- a/appsrc/ODS-Gallery/www-root/index.vspx
+++ b/appsrc/ODS-Gallery/www-root/index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: index.vspx,v 1.4 2006/08/14 14:33:16 source Exp $
+ -  $Id: index.vspx,v 1.4.2.1 2010/09/20 10:15:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Gallery/www-root/js/calendar.js b/appsrc/ODS-Gallery/www-root/js/calendar.js
index c99a0eb..7d991fa 100644
--- a/appsrc/ODS-Gallery/www-root/js/calendar.js
+++ b/appsrc/ODS-Gallery/www-root/js/calendar.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: calendar.js,v 1.1.2.2 2010/03/12 09:14:46 source Exp $
+ *  $Id: calendar.js,v 1.1.2.3 2010/09/20 10:15:38 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Gallery/www-root/js/dataset.js b/appsrc/ODS-Gallery/www-root/js/dataset.js
index 943afb2..a41e1e3 100644
--- a/appsrc/ODS-Gallery/www-root/js/dataset.js
+++ b/appsrc/ODS-Gallery/www-root/js/dataset.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: dataset.js,v 1.6 2008/02/07 10:09:46 source Exp $
+ *  $Id: dataset.js,v 1.6.2.1 2010/09/20 10:15:38 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Gallery/www-root/js/gallery.js b/appsrc/ODS-Gallery/www-root/js/gallery.js
index 5272eb8..e053c4f 100644
--- a/appsrc/ODS-Gallery/www-root/js/gallery.js
+++ b/appsrc/ODS-Gallery/www-root/js/gallery.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: gallery.js,v 1.23.2.2 2010/01/29 20:21:30 source Exp $
+ *  $Id: gallery.js,v 1.23.2.3 2010/09/20 10:15:38 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Gallery/www-root/js/map.js b/appsrc/ODS-Gallery/www-root/js/map.js
index 105e8ce..133cc23 100644
--- a/appsrc/ODS-Gallery/www-root/js/map.js
+++ b/appsrc/ODS-Gallery/www-root/js/map.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: map.js,v 1.3.2.1 2010/03/12 09:14:46 source Exp $
+ *  $Id: map.js,v 1.3.2.2 2010/09/20 10:15:38 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Gallery/www-root/js/ui.js b/appsrc/ODS-Gallery/www-root/js/ui.js
index 890aa0d..62d3897 100644
--- a/appsrc/ODS-Gallery/www-root/js/ui.js
+++ b/appsrc/ODS-Gallery/www-root/js/ui.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: ui.js,v 1.10 2008/02/22 13:07:23 source Exp $
+ *  $Id: ui.js,v 1.10.2.1 2010/09/20 10:15:38 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Gallery/www-root/portal/index.vsp b/appsrc/ODS-Gallery/www-root/portal/index.vsp
index 425a0fe..7d34317 100644
--- a/appsrc/ODS-Gallery/www-root/portal/index.vsp
+++ b/appsrc/ODS-Gallery/www-root/portal/index.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: index.vsp,v 1.19.2.1 2010/05/31 21:59:14 source Exp $
+--  $Id: index.vsp,v 1.19.2.2 2010/09/20 10:15:38 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/www-root/proxy.vsp b/appsrc/ODS-Gallery/www-root/proxy.vsp
index 9b23e7b..e9d5c4d 100644
--- a/appsrc/ODS-Gallery/www-root/proxy.vsp
+++ b/appsrc/ODS-Gallery/www-root/proxy.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: proxy.vsp,v 1.4 2008/02/22 13:07:23 source Exp $
+--  $Id: proxy.vsp,v 1.4.2.1 2010/09/20 10:15:38 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Gallery/www-root/upload.vspx b/appsrc/ODS-Gallery/www-root/upload.vspx
index 2bc15c8..bc28029 100644
--- a/appsrc/ODS-Gallery/www-root/upload.vspx
+++ b/appsrc/ODS-Gallery/www-root/upload.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: upload.vspx,v 1.9.2.1 2010/03/12 09:14:46 source Exp $
+ -  $Id: upload.vspx,v 1.9.2.2 2010/09/20 10:15:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Gallery/xslt/index.xsl b/appsrc/ODS-Gallery/xslt/index.xsl
index 33aa02b..5372471 100644
--- a/appsrc/ODS-Gallery/xslt/index.xsl
+++ b/appsrc/ODS-Gallery/xslt/index.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: index.xsl,v 1.20.2.2 2010/03/12 09:14:46 source Exp $
+ -  $Id: index.xsl,v 1.20.2.3 2010/09/20 10:15:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Gallery/xslt/rss2atom.xsl b/appsrc/ODS-Gallery/xslt/rss2atom.xsl
index 9e66158..bb2537d 100644
--- a/appsrc/ODS-Gallery/xslt/rss2atom.xsl
+++ b/appsrc/ODS-Gallery/xslt/rss2atom.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom.xsl,v 1.3.2.1 2010/05/31 21:59:14 source Exp $
+ -  $Id: rss2atom.xsl,v 1.3.2.2 2010/09/20 10:15:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Gallery/xslt/rss2atom03.xsl b/appsrc/ODS-Gallery/xslt/rss2atom03.xsl
index 6bada18..831f2e6 100644
--- a/appsrc/ODS-Gallery/xslt/rss2atom03.xsl
+++ b/appsrc/ODS-Gallery/xslt/rss2atom03.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom03.xsl,v 1.2.2.1 2010/05/31 21:59:14 source Exp $
+ -  $Id: rss2atom03.xsl,v 1.2.2.2 2010/09/20 10:15:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Gallery/xslt/rss2mrss.xsl b/appsrc/ODS-Gallery/xslt/rss2mrss.xsl
index be2c9c5..b47f42b 100644
--- a/appsrc/ODS-Gallery/xslt/rss2mrss.xsl
+++ b/appsrc/ODS-Gallery/xslt/rss2mrss.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2mrss.xsl,v 1.2 2006/05/31 13:13:02 source Exp $
+ -  $Id: rss2mrss.xsl,v 1.2.2.1 2010/09/20 10:15:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Gallery/xslt/rss2rdf.xsl b/appsrc/ODS-Gallery/xslt/rss2rdf.xsl
index e6fbc62..217b089 100644
--- a/appsrc/ODS-Gallery/xslt/rss2rdf.xsl
+++ b/appsrc/ODS-Gallery/xslt/rss2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2rdf.xsl,v 1.2 2006/05/31 13:13:02 source Exp $
+ -  $Id: rss2rdf.xsl,v 1.2.2.1 2010/09/20 10:15:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Gallery/xslt/rss2xbel.xsl b/appsrc/ODS-Gallery/xslt/rss2xbel.xsl
index f914b65..854bfd2 100644
--- a/appsrc/ODS-Gallery/xslt/rss2xbel.xsl
+++ b/appsrc/ODS-Gallery/xslt/rss2xbel.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2xbel.xsl,v 1.2 2006/05/31 13:13:02 source Exp $
+ -  $Id: rss2xbel.xsl,v 1.2.2.1 2010/09/20 10:15:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Gallery/xslt/upload.xsl b/appsrc/ODS-Gallery/xslt/upload.xsl
index 9a38dea..6c7b72a 100644
--- a/appsrc/ODS-Gallery/xslt/upload.xsl
+++ b/appsrc/ODS-Gallery/xslt/upload.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: upload.xsl,v 1.3 2008/02/19 11:10:51 source Exp $
+ -  $Id: upload.xsl,v 1.3.2.1 2010/09/20 10:15:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Gallery/xslt/wsdl2js.xsl b/appsrc/ODS-Gallery/xslt/wsdl2js.xsl
index 56dc336..6cada8a 100644
--- a/appsrc/ODS-Gallery/xslt/wsdl2js.xsl
+++ b/appsrc/ODS-Gallery/xslt/wsdl2js.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" ?>
 <!--
  -
- -  $Id: wsdl2js.xsl,v 1.3 2006/06/01 19:42:56 source Exp $
+ -  $Id: wsdl2js.xsl,v 1.3.2.1 2010/09/20 10:15:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Polls/Makefile.in b/appsrc/ODS-Polls/Makefile.in
index ad9998f..76ce073 100644
--- a/appsrc/ODS-Polls/Makefile.in
+++ b/appsrc/ODS-Polls/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-Polls/make_vad.sh b/appsrc/ODS-Polls/make_vad.sh
index 95b6cb9..4f62096 100755
--- a/appsrc/ODS-Polls/make_vad.sh
+++ b/appsrc/ODS-Polls/make_vad.sh
@@ -28,7 +28,7 @@ export LANG LC_ALL
 
 MODE=$1
 LOGDIR=`pwd`
-VERSION="1.1.30"
+VERSION="1.1.33"
 LOGFILE="${LOGDIR}/vad_make.log"
 STICKER_DAV="vad_dav.xml"
 STICKER_FS="vad_filesystem.xml"
@@ -224,7 +224,7 @@ sticker_init() {
   echo "  <name package=\"Polls\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS Polls Manager\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
@@ -236,8 +236,8 @@ sticker_init() {
   echo "<dependencies>" >> $STICKER
   echo "  <require>" >> $STICKER
   echo "    <name package=\"Framework\"/>" >> $STICKER
-  echo "    <versions_later package=\"1.73.21\">" >> $STICKER
-  echo "      <prop name=\"Date\" value=\"2010-07-08 12:00\" />" >> $STICKER
+  echo "    <versions_later package=\"1.76.62\">" >> $STICKER
+  echo "      <prop name=\"Date\" value=\"2010-09-27 12:00\" />" >> $STICKER
   echo "      <prop name=\"Comment\" value=\"An incompatible version of the ODS Framework\" />" >> $STICKER
   echo "    </versions_later>" >> $STICKER
   echo "  </require>" >> $STICKER
@@ -379,8 +379,8 @@ then
 fi
 virtuoso_shutdown
 STOP_SERVER
-chmod 644 $VAD_DAV
-chmod 644 $VAD_FS
+chmod 644 ods_polls_dav.vad
+chmod 644 ods_polls_filesystem.vad
 directory_clean
 
 CHECK_LOG
diff --git a/appsrc/ODS-Polls/sql/polls-a-api.sql b/appsrc/ODS-Polls/sql/polls-a-api.sql
index f443e41..0b8c4d9 100644
--- a/appsrc/ODS-Polls/sql/polls-a-api.sql
+++ b/appsrc/ODS-Polls/sql/polls-a-api.sql
@@ -1,5 +1,5 @@
 --
---  $Id: polls-a-api.sql,v 1.8.2.2 2009/12/08 23:25:22 source Exp $
+--  $Id: polls-a-api.sql,v 1.8.2.4 2010/10/07 13:22:06 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -302,9 +302,9 @@ create procedure ODS.ODS_API."poll.activate" (
   if (not exists (select 1 from POLLS.WA.POLL where P_ID = poll_id))
     return ods_serialize_sql_error ('37000', 'The item is not found');
 
-  if (POLLS.WA.poll_is_activated (poll_id))
+  if (POLLS.WA.poll_is_activated (inst_id, poll_id))
     signal ('POLLS', 'The Poll is already activated');
-  if (not POLLS.WA.poll_enable_activate (poll_id))
+  if (not POLLS.WA.poll_enable_activate (inst_id, poll_id))
     signal ('POLLS', 'The activation is not allowed');
 
   POLLS.WA.poll_active (poll_id);
@@ -333,9 +333,9 @@ create procedure ODS.ODS_API."poll.close" (
 
   if (not exists (select 1 from POLLS.WA.POLL where P_ID = poll_id))
     return ods_serialize_sql_error ('37000', 'The item is not found');
-  if (POLLS.WA.poll_is_closed (poll_id))
+  if (POLLS.WA.poll_is_closed (inst_id, poll_id))
     signal ('POLLS', 'The poll is already closed');
-  if (not POLLS.WA.poll_enable_close (poll_id))
+  if (not POLLS.WA.poll_enable_close (inst_id, poll_id))
     signal ('POLLS', 'The close is not allowed');
   POLLS.WA.poll_close (poll_id);
   return ods_serialize_int_res (1);
@@ -364,7 +364,7 @@ create procedure ODS.ODS_API."poll.clear" (
   rc := 0;
   if (not exists (select 1 from POLLS.WA.POLL where P_ID = poll_id))
     return ods_serialize_sql_error ('37000', 'The item is not found');
-  if (not POLLS.WA.poll_enable_clear (poll_id))
+  if (not POLLS.WA.poll_enable_clear (inst_id, poll_id))
     signal ('POLLS', 'The clear is not allowed');
   POLLS.WA.poll_clear (poll_id);
   return ods_serialize_int_res (1);
@@ -387,7 +387,7 @@ create procedure ODS.ODS_API."poll.vote" (
   if (not exists (select 1 from POLLS.WA.POLL where P_ID = poll_id))
     return ods_serialize_sql_error ('37000', 'The item is not found');
 
-  if (not POLLS.WA.poll_enable_vote (poll_id))
+  if (not POLLS.WA.poll_enable_vote (inst_id, poll_id))
     signal ('POLLS', 'The vote is not allowed');
 
   rc := POLLS.WA.vote_insert (poll_id, client_attr ('client_ip'));
@@ -445,7 +445,7 @@ create procedure ODS.ODS_API."poll.result" (
 
   if (not exists (select 1 from POLLS.WA.POLL where P_ID = poll_id))
     return ods_serialize_sql_error ('37000', 'The item is not found');
-  if (not POLLS.WA.poll_enable_result (poll_id))
+  if (not POLLS.WA.poll_enable_result (inst_id, poll_id))
   {
     signal ('POLLS', 'The result is not allowed');
   }
diff --git a/appsrc/ODS-Polls/sql/polls-a-code.sql b/appsrc/ODS-Polls/sql/polls-a-code.sql
index d7c2179..07d333a 100644
--- a/appsrc/ODS-Polls/sql/polls-a-code.sql
+++ b/appsrc/ODS-Polls/sql/polls-a-code.sql
@@ -1,5 +1,5 @@
 --
---  $Id: polls-a-code.sql,v 1.20.2.9 2010/07/09 14:37:01 source Exp $
+--  $Id: polls-a-code.sql,v 1.20.2.15 2010/11/09 20:11:18 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -19,6 +19,68 @@
 --  with this program; if not, write to the Free Software Foundation, Inc.,
 --  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 --
+
+-------------------------------------------------------------------------------
+--
+-- ACL Functions
+--
+-------------------------------------------------------------------------------
+--
+create procedure POLLS.WA.acl_condition (
+  in domain_id integer,
+  in id integer := null)
+{
+  if (not is_https_ctx ())
+    return 0;
+
+  if (exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_ACL is not null))
+    return 1;
+
+  if (exists (select 1 from POLLS.WA.POLL where P_ID = id and P_ACL is not null))
+    return 1;
+
+  return 0;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure POLLS.WA.acl_check (
+  in domain_id integer,
+  in id integer := null)
+{
+  declare rc varchar;
+  declare graph_iri, groups_iri, acl_iris any;
+
+  rc := '';
+  if (POLLS.WA.acl_condition (domain_id, id))
+  {
+    acl_iris := vector (POLLS.WA.forum_iri (domain_id));
+    if (not isnull (id))
+      acl_iris := vector (SIOC..poll_post_iri (domain_id, id), POLLS.WA.forum_iri (domain_id));
+
+    graph_iri := POLLS.WA.acl_graph (domain_id);
+    groups_iri := SIOC..acl_groups_graph (POLLS.WA.domain_owner_id (domain_id));
+    rc := SIOC..acl_check (graph_iri, groups_iri, acl_iris);
+  }
+  return rc;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure POLLS.WA.acl_list (
+  in domain_id integer)
+{
+  declare graph_iri, groups_iri, iri any;
+
+  iri := POLLS.WA.forum_iri (domain_id);
+  graph_iri := POLLS.WA.acl_graph (domain_id);
+  groups_iri := SIOC..acl_groups_graph (POLLS.WA.domain_owner_id (domain_id));
+  return SIOC..acl_list (graph_iri, groups_iri, iri);
+}
+;
+
 -------------------------------------------------------------------------------
 --
 -- Session Functions
@@ -36,14 +98,16 @@ create procedure POLLS.WA.session_domain (
   };
 
   options := http_map_get('options');
-  if (not is_empty_or_null (options))
+  if (not DB.DBA.is_empty_or_null (options))
+  {
     domain_id := get_keyword ('domain', options);
-  if (is_empty_or_null (domain_id)) 
+  }
+  if (DB.DBA.is_empty_or_null (domain_id))
   {
     aPath := split_and_decode (trim (http_path (), '/'), 0, '\0\0/');
     domain_id := cast(aPath[1] as integer);
   }
-  if (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id))
+  if (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_TYPE_NAME = 'Polls'))
     domain_id := -1;
 
 _end:;
@@ -56,62 +120,27 @@ _end:;
 create procedure POLLS.WA.session_restore(
   inout params any)
 {
-  declare aPath, domain_id, user_id, user_name, user_role, sid, realm, options any;
-
-  declare exit handler for sqlstate '*' {
-    domain_id := -2;
-    goto _end;
-  };
-
-  sid := get_keyword('sid', params, '');
-  realm := get_keyword('realm', params, '');
+  declare domain_id, account_id, account_rights any;
 
-  options := http_map_get('options');
-  if (not is_empty_or_null(options))
-    domain_id := get_keyword('domain', options);
-  if (is_empty_or_null (domain_id)) 
-  {
-    aPath := split_and_decode (trim (http_path (), '/'), 0, '\0\0/');
-    domain_id := cast(aPath[1] as integer);
-  }
-  if (not exists(select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and domain_id <> -2))
-    domain_id := -1;
+  domain_id := POLLS.WA.session_domain (params);
+  account_id := http_nobody_uid ();
 
-_end:
-  domain_id := cast(domain_id as integer);
-  user_id := -1;
   for (select U.U_ID,
               U.U_NAME,
               U.U_FULL_NAME
          from DB.DBA.VSPX_SESSION S,
               WS.WS.SYS_DAV_USER U
-        where S.VS_REALM = realm
-          and S.VS_SID   = sid
+        where S.VS_REALM = get_keyword ('realm', params, 'wa')
+          and S.VS_SID   = get_keyword ('sid', params, '')
           and S.VS_UID   = U.U_NAME) do
   {
-    user_id   := U_ID;
-    user_name := POLLS.WA.user_name(U_NAME, U_FULL_NAME);
-    user_role := POLLS.WA.access_role(domain_id, U_ID);
-  }
-  if ((user_id = -1) and (domain_id >= 0) and (not exists(select 1 from DB.DBA.WA_INSTANCE where WAI_ID = domain_id and WAI_IS_PUBLIC = 1)))
-    domain_id := -1;
-
-  if (user_id = -1)
-    if (domain_id = -1) {
-      user_role := 'expire';
-      user_name := 'Expire session';
-    } else if (domain_id = -2) {
-      user_role := 'public';
-      user_name := 'Public User';
-    } else {
-      user_role := 'guest';
-      user_name := 'Guest User';
+    account_id := U_ID;
     }
-
-  return vector('domain_id', domain_id,
-                'user_id',   user_id,
-                'user_name', user_name,
-                'user_role', user_role
+  account_rights := POLLS.WA.access_rights (domain_id, account_id);
+  return vector (
+                 'domain_id', domain_id,
+                 'account_id',   account_id,
+                 'account_rights', account_rights
                );
 }
 ;
@@ -121,7 +150,8 @@ _end:
 -- Freeze Functions
 --
 -------------------------------------------------------------------------------
-create procedure POLLS.WA.frozen_check(in domain_id integer)
+create procedure POLLS.WA.frozen_check (
+  in domain_id integer)
 {
   declare exit handler for not found { return 1; };
 
@@ -144,7 +174,8 @@ create procedure POLLS.WA.frozen_check(in domain_id integer)
 
 -------------------------------------------------------------------------------
 --
-create procedure POLLS.WA.frozen_page(in domain_id integer)
+create procedure POLLS.WA.frozen_page (
+  in domain_id integer)
 {
   return (select WAI_FREEZE_REDIRECT from DB.DBA.WA_INSTANCE where WAI_ID = domain_id);
 }
@@ -159,64 +190,21 @@ create procedure POLLS.WA.check_admin(
   in user_id integer) returns integer
 {
   declare group_id integer;
-  group_id := (select U_GROUP from SYS_USERS where U_ID = user_id);
 
-  if (user_id = 0)
-    return 1;
-  if (user_id = http_dav_uid ())
-    return 1;
-  if (group_id = 0)
-    return 1;
-  if (group_id = http_dav_uid ())
-    return 1;
-  if(group_id = http_dav_uid()+1)
+  if ((user_id = 0) or (user_id = http_dav_uid ()))
     return 1;
-  return 0;
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure POLLS.WA.check_grants(in domain_id integer, in user_id integer, in role_name varchar)
-{
-  whenever not found goto _end;
 
-  if (POLLS.WA.check_admin(user_id))
-    return 1;
-  if (role_name is null or role_name = '')
-    return 0;
-  if (role_name = 'admin')
-    return 0;
-  if (role_name = 'guest') {
-    if (exists(select 1
-                 from SYS_USERS A,
-                      WA_MEMBER B,
-                      WA_INSTANCE C
-                where A.U_ID = user_id
-                  and B.WAM_USER = A.U_ID
-                  and B.WAM_INST = C.WAI_NAME
-                  and C.WAI_ID = domain_id))
-      return 1;
-  }
-  if (role_name = 'owner')
-    if (exists(select 1
-                 from SYS_USERS A,
-                      WA_MEMBER B,
-                      WA_INSTANCE C
-                where A.U_ID = user_id
-                  and B.WAM_USER = A.U_ID
-                  and B.WAM_MEMBER_TYPE = 1
-                  and B.WAM_INST = C.WAI_NAME
-                  and C.WAI_ID = domain_id))
+  group_id := (select U_GROUP from SYS_USERS where U_ID = user_id);
+  if ((group_id = 0) or (group_id = http_dav_uid ()) or (group_id = http_dav_uid()+1))
       return 1;
-_end:
+
   return 0;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure POLLS.WA.check_grants2(in role_name varchar, in page_name varchar)
+create procedure POLLS.WA.check_grants (in role_name varchar, in page_name varchar)
 {
   declare tree any;
 
@@ -229,52 +217,67 @@ create procedure POLLS.WA.check_grants2(in role_name varchar, in page_name varch
 
 -------------------------------------------------------------------------------
 --
-create procedure POLLS.WA.access_role(in domain_id integer, in user_id integer)
+create procedure POLLS.WA.access_rights (
+  in domain_id integer,
+  in account_id integer)
 {
-  whenever not found goto _end;
+  declare rc varchar;
+
+  if (domain_id <= 0)
+    return null;
 
-  if (POLLS.WA.check_admin (user_id))
-    return 'admin';
+  if (POLLS.WA.check_admin (account_id))
+    return 'W';
 
   if (exists(select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
                 and B.WAM_MEMBER_TYPE = 1
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
-    return 'owner';
+    return 'W';
 
   if (exists(select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
                 and B.WAM_MEMBER_TYPE = 2
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
-    return 'author';
+    return 'W';
+
+  if (is_https_ctx ())
+  {
+    rc := POLLS.WA.acl_check (domain_id);
+    if (rc <> '')
+      return rc;
+  }
 
   if (exists(select 1
                from SYS_USERS A,
                     WA_MEMBER B,
                     WA_INSTANCE C
-              where A.U_ID = user_id
+               where A.U_ID = account_id
                 and B.WAM_USER = A.U_ID
                 and B.WAM_INST = C.WAI_NAME
                 and C.WAI_ID = domain_id))
-    return 'reader';
+    return 'R';
 
-  if (exists(select 1
-               from SYS_USERS A
-              where A.U_ID = user_id))
-    return 'guest';
+  if (exists (select 1
+                from DB.DBA.WA_INSTANCE
+               where WAI_ID = domain_id
+                 and WAI_IS_PUBLIC = 1))
+    return 'R';
 
-_end:
-  return 'public';
+  if (is_https_ctx () and exists (select 1 from POLLS.WA.acl_list (id)(iri varchar) x where x.id = domain_id))
+    return '';
+
+  return null;
 }
 ;
 
@@ -315,11 +318,11 @@ create procedure POLLS.WA.menu_tree ()
   S :=
 '<?xml version="1.0" ?>
 <menu_tree>
-  <node name="home" url="polls.vspx"            id="1"   allowed="public guest reader author owner admin">
-    <node name="11" url="polls.vspx"            id="11"  allowed="public guest reader author owner admin"/>
-    <node name="12" url="search.vspx"          id="12"  allowed="public guest reader author owner admin"/>
-    <node name="13" url="error.vspx"           id="13"  allowed="public guest reader author owner admin"/>
-    <node name="14" url="settings.vspx"        id="14"  allowed="reader author owner admin"/>
+  <node name="home" url="polls.vspx"           id="1"   allowed="W R">
+    <node name="11" url="polls.vspx"           id="11"  allowed="W R"/>
+    <node name="12" url="search.vspx"          id="12"  allowed="W R"/>
+    <node name="13" url="error.vspx"           id="13"  allowed="W R"/>
+    <node name="14" url="settings.vspx"        id="14"  allowed="W"/>
   </node>
 </menu_tree>';
 
@@ -360,7 +363,7 @@ create procedure POLLS.WA.iri_fix (
   {
     declare V any;
 
-    V := rfc1808_parse_uri (S);
+    V := rfc1808_parse_uri (cast (S as varchar));
     V [0] := 'https';
     V [1] := http_request_header (http_request_header(), 'Host', null, registry_get ('URIQADefaultHost'));
     S := DB.DBA.vspx_uri_compose (V);
@@ -829,6 +832,15 @@ create procedure POLLS.WA.forum_iri (
 
 -------------------------------------------------------------------------------
 --
+create procedure POLLS.WA.acl_graph (
+  in domain_id integer)
+{
+  return SIOC..acl_graph ('Polls', POLLS.WA.domain_name (domain_id));
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure POLLS.WA.page_url (
   in domain_id integer,
   in page varchar := null,
@@ -1960,90 +1972,70 @@ create procedure POLLS.WA.dt_format(
   in pDate datetime,
   in pFormat varchar := 'd.m.Y')
 {
-  declare
-    N integer;
-  declare
-    ch,
-    S varchar;
+  declare N integer;
+  declare ch, S varchar;
+
+  declare exit handler for sqlstate '*' {
+    return '';
+  };
 
   S := '';
-  N := 1;
-  while (N <= length(pFormat))
+  for (N := 1; N <= length(pFormat); N := N + 1)
   {
     ch := substring(pFormat, N, 1);
     if (ch = 'M')
     {
       S := concat(S, xslt_format_number(month(pDate), '00'));
-    } else {
-      if (ch = 'm')
+    }
+    else if (ch = 'm')
       {
         S := concat(S, xslt_format_number(month(pDate), '##'));
-      } else
-      {
-        if (ch = 'Y')
+    }
+    else if (ch = 'Y')
         {
           S := concat(S, xslt_format_number(year(pDate), '0000'));
-        } else
-        {
-          if (ch = 'y')
+    }
+    else if (ch = 'y')
           {
             S := concat(S, substring(xslt_format_number(year(pDate), '0000'),3,2));
-          } else {
-            if (ch = 'd')
+    }
+    else if (ch = 'd')
             {
               S := concat(S, xslt_format_number(dayofmonth(pDate), '##'));
-            } else
-            {
-              if (ch = 'D')
+    }
+    else if (ch = 'D')
               {
                 S := concat(S, xslt_format_number(dayofmonth(pDate), '00'));
-              } else
-              {
-                if (ch = 'H')
+    }
+    else if (ch = 'H')
                 {
                   S := concat(S, xslt_format_number(hour(pDate), '00'));
-                } else
-                {
-                  if (ch = 'h')
+    }
+    else if (ch = 'h')
                   {
                     S := concat(S, xslt_format_number(hour(pDate), '##'));
-                  } else
-                  {
-                    if (ch = 'N')
+    }
+    else if (ch = 'N')
                     {
                       S := concat(S, xslt_format_number(minute(pDate), '00'));
-                    } else
-                    {
-                      if (ch = 'n')
+    }
+    else if (ch = 'n')
                       {
                         S := concat(S, xslt_format_number(minute(pDate), '##'));
-                      } else
-                      {
-                        if (ch = 'S')
+    }
+    else if (ch = 'S')
                         {
                           S := concat(S, xslt_format_number(second(pDate), '00'));
-                        } else
-                        {
-                          if (ch = 's')
+    }
+    else if (ch = 's')
                           {
                             S := concat(S, xslt_format_number(second(pDate), '##'));
-                          } else
+    }
+    else
                           {
                             S := concat(S, ch);
-                          };
-                        };
-                      };
-                    };
-                  };
-                };
-              };
-            };
-          };
-        };
-      };
-    };
-    N := N + 1;
-  };
+    }
+  }
   return S;
 }
 ;
@@ -2054,15 +2046,9 @@ create procedure POLLS.WA.dt_deformat(
   in pString varchar,
   in pFormat varchar := 'd.m.Y')
 {
-  declare
-    y,
-    m,
-    d integer;
-  declare
-    N,
-    I integer;
-  declare
-    ch varchar;
+  declare y, m, d integer;
+  declare N, I integer;
+  declare ch varchar;
 
   N := 1;
   I := 0;
@@ -2516,6 +2502,18 @@ create procedure POLLS.WA.poll_update (
 }
 ;
 
+create procedure POLLS.WA.poll_acl (
+  in domain_id integer,
+  in id integer,
+  in acl any)
+{
+  update POLLS.WA.POLL
+     set P_ACL = acl
+   where P_DOMAIN_ID = domain_id
+     and P_ID = id;
+}
+;
+
 -------------------------------------------------------------------------------
 --
 create procedure POLLS.WA.poll_delete (
@@ -2596,6 +2594,26 @@ create procedure POLLS.WA.poll_description (
 
 -------------------------------------------------------------------------------
 --
+create procedure POLLS.WA.poll_rights (
+  in domain_id integer,
+  in id integer,
+  in access_role varchar)
+{
+  declare retValue varchar;
+
+  retValue := '';
+  if (exists (select 1 from POLLS.WA.POLL where P_ID = id and P_DOMAIN_ID = domain_id))
+  {
+    retValue := POLLS.WA.acl_check (domain_id, id);
+    if (retValue = '')
+      retValue := access_role;
+  }
+  return retValue;
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure POLLS.WA.poll_is_draft (
   in state any,
   in date_start any,
@@ -2670,15 +2688,15 @@ create procedure POLLS.WA.poll_is_voted (
 -------------------------------------------------------------------------------
 --
 create procedure POLLS.WA.poll_enable_edit (
+  in domain_id integer,
   in poll_id integer,
-  in user_role varchar := 'owner')
+  in permissions varchar := 'W')
 {
-  if (user_role in ('public', 'guest'))
-    return 0;
-
-  for (select P_STATE, P_DATE_START from POLLS.WA.POLL where P_ID = poll_id) do
+  if (permissions = 'W')
+  {
+    for (select P_STATE, P_DATE_START from POLLS.WA.POLL where P_DOMAIN_ID = domain_id and P_ID = poll_id) do
     return POLLS.WA.poll_is_draft (P_STATE, P_DATE_START, now ());
-
+  }
   return 0;
 }
 ;
@@ -2686,13 +2704,11 @@ create procedure POLLS.WA.poll_enable_edit (
 -------------------------------------------------------------------------------
 --
 create procedure POLLS.WA.poll_enable_delete (
+  in domain_id integer,
   in poll_id integer,
-  in user_role varchar := 'owner')
+  in permissions varchar := 'W')
 {
-  if (user_role in ('public', 'guest'))
-    return 0;
-
-  if (exists (select 1 from POLLS.WA.POLL where P_ID = poll_id))
+  if ((permissions = 'W') and exists (select 1 from POLLS.WA.POLL where P_DOMAIN_ID = domain_id and P_ID = poll_id))
     return 1;
 
   return 0;
@@ -2702,15 +2718,15 @@ create procedure POLLS.WA.poll_enable_delete (
 -------------------------------------------------------------------------------
 --
 create procedure POLLS.WA.poll_enable_activate (
+  in domain_id integer,
   in poll_id integer,
-  in user_role varchar := 'owner')
+  in permissions varchar := 'W')
 {
-  if (user_role in ('public', 'guest'))
-    return 0;
-
-  for (select P_STATE, P_DATE_START from POLLS.WA.POLL where P_ID = poll_id) do
+  if (permissions = 'W')
+  {
+    for (select P_STATE, P_DATE_START from POLLS.WA.POLL where P_DOMAIN_ID = domain_id and P_ID = poll_id) do
     return POLLS.WA.poll_is_draft (P_STATE, P_DATE_START);
-
+  }
   return 0;
 }
 ;
@@ -2718,15 +2734,15 @@ create procedure POLLS.WA.poll_enable_activate (
 -------------------------------------------------------------------------------
 --
 create procedure POLLS.WA.poll_is_activated (
+  in domain_id integer,
   in poll_id integer,
-  in user_role varchar := 'owner')
+  in permissions varchar := 'W')
 {
-  if (user_role in ('public', 'guest'))
-    return 0;
-
-  for (select P_STATE, P_DATE_START, P_DATE_END from POLLS.WA.POLL where P_ID = poll_id) do
+  if (permissions <> '')
+  {
+    for (select P_STATE, P_DATE_START, P_DATE_END from POLLS.WA.POLL where P_DOMAIN_ID = domain_id and P_ID = poll_id) do
     return POLLS.WA.poll_is_active (P_STATE, P_DATE_START, P_DATE_END);
-
+  }
   return 0;
 }
 ;
@@ -2734,15 +2750,15 @@ create procedure POLLS.WA.poll_is_activated (
 -------------------------------------------------------------------------------
 --
 create procedure POLLS.WA.poll_enable_close (
+  in domain_id integer,
   in poll_id integer,
-  in user_role varchar := 'owner')
+  in permissions varchar := 'W')
 {
-  if (user_role in ('public', 'guest'))
-    return 0;
-
-  for (select P_STATE, P_DATE_START, P_DATE_END from POLLS.WA.POLL where P_ID = poll_id) do
+  if (permissions = 'W')
+  {
+    for (select P_STATE, P_DATE_START, P_DATE_END from POLLS.WA.POLL where P_DOMAIN_ID = domain_id and P_ID = poll_id) do
     return POLLS.WA.poll_is_active (P_STATE, P_DATE_START, P_DATE_END);
-
+  }
   return 0;
 }
 ;
@@ -2750,15 +2766,15 @@ create procedure POLLS.WA.poll_enable_close (
 -------------------------------------------------------------------------------
 --
 create procedure POLLS.WA.poll_is_closed (
+  in domain_id integer,
   in poll_id integer,
-  in user_role varchar := 'owner')
+  in permissions varchar := 'W')
 {
-  if (user_role in ('public', 'guest'))
-    return 0;
-
-  for (select P_STATE, P_DATE_END from POLLS.WA.POLL where P_ID = poll_id) do
+  if (permissions <> '')
+  {
+    for (select P_STATE, P_DATE_END from POLLS.WA.POLL where P_DOMAIN_ID = domain_id and P_ID = poll_id) do
     return POLLS.WA.poll_is_close (P_STATE, P_DATE_END);
-
+  }
   return 0;
 }
 ;
@@ -2766,16 +2782,16 @@ create procedure POLLS.WA.poll_is_closed (
 -------------------------------------------------------------------------------
 --
 create procedure POLLS.WA.poll_enable_clear (
+  in domain_id integer,
   in poll_id integer,
-  in user_role varchar := 'owner')
+  in permissions varchar := 'W')
 {
-  if (user_role in ('public', 'guest'))
-    return 0;
-
-  for (select P_VOTES, P_STATE, P_DATE_START, P_DATE_END from POLLS.WA.POLL where P_ID = poll_id) do
+  if (permissions = 'W')
+  {
+    for (select P_VOTES, P_STATE, P_DATE_START, P_DATE_END from POLLS.WA.POLL where P_DOMAIN_ID = domain_id and P_ID = poll_id) do
     if ((P_VOTES > 0) and (POLLS.WA.poll_is_active (P_STATE, P_DATE_START, P_DATE_END)))
         return 1;
-
+  }
   return 0;
 }
 ;
@@ -2783,11 +2799,12 @@ create procedure POLLS.WA.poll_enable_clear (
 -------------------------------------------------------------------------------
 --
 create procedure POLLS.WA.poll_enable_vote (
+  in domain_id integer,
   in poll_id integer)
 {
   declare client_id varchar;
 
-  for (select * from POLLS.WA.POLL where P_ID = poll_id) do
+  for (select * from POLLS.WA.POLL where P_DOMAIN_ID = domain_id and P_ID = poll_id) do
   {
     if (not (POLLS.WA.poll_is_active (P_STATE, P_DATE_START, P_DATE_END)))
       return 0;
@@ -2813,6 +2830,7 @@ create procedure POLLS.WA.poll_enable_vote (
 --
 -------------------------------------------------------------------------------
 create procedure POLLS.WA.poll_enable_result (
+  in domain_id integer,
   in poll_id integer)
 {
   declare client_id varchar;
@@ -2821,7 +2839,7 @@ create procedure POLLS.WA.poll_enable_result (
   for (select P.*, V.V_CLIENT_ID
          from POLLS.WA.POLL P
                 left join POLLS.WA.VOTE V on V.V_POLL_ID = P.P_ID and V.V_CLIENT_ID = client_id
-        where P.P_ID = poll_id) do {
+        where P.P_DOMAIN_ID = domain_id and P.P_ID = poll_id) do {
     if (P_VOTES = 0)
       return -5;
     if (POLLS.WA.poll_is_draft (P_STATE, P_DATE_START))
@@ -2934,7 +2952,8 @@ create procedure POLLS.WA.answer_insert (
 create procedure POLLS.WA.search_sql (
   inout domain_id integer,
   inout account_id integer,
-  inout data varchar,
+  in account_rights varchar,
+  in data varchar,
   in maxRows varchar := '')
 {
   declare S, T, tmp, where2, delimiter2 varchar;
@@ -2974,9 +2993,16 @@ create procedure POLLS.WA.search_sql (
          '  and p.P_DOMAIN_ID <> <DOMAIN_ID> \n' ||
          '  and POLLS.WA.poll_is_draft (P_STATE, P_DATE_START) <> 1 <TEXT> <TAGS> <WHERE> \n';
   }
-
   S := 'select <MAX> * from (' || S || ') x';
-
+  if (account_rights = '')
+  {
+    if (is_https_ctx ())
+    {
+      S := S || ' where SIOC..poll_post_iri (<DOMAIN_ID>, x.P_ID) in (select a.iri from POLLS.WA.acl_list (id)(iri varchar) a where a.id = <DOMAIN_ID>)';
+    } else {
+      S := S || ' where 1=0';
+    }
+  }
   T := '';
   tmp := POLLS.WA.xml_get('keywords', data);
   if (not is_empty_or_null(tmp)) {
@@ -3015,43 +3041,52 @@ create procedure POLLS.WA.search_sql (
 
 -------------------------------------------------------------------------------
 --
+create procedure POLLS.WA.dashboard_rs(
+  in p0 integer)
+{
+  declare c0 integer;
+  declare c1 varchar;
+  declare c2 datetime;
+
+  result_names(c0, c1, c2);
+  for (select top 10 *
+         from (select P_ID,
+                      P_NAME,
+                      P_UPDATED
+                 from POLLS.WA.POLL
+                where P_DOMAIN_ID = p0
+                order by P_UPDATED desc
+              ) x
+      ) do
+  {
+    result (P_ID, P_NAME, coalesce (P_UPDATED, now ()));
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure POLLS.WA.dashboard_get(
-  in domain_id integer,
-  in user_id integer)
+  in domain_id integer)
 {
-  declare ses any;
+  declare account_id integer;
+  declare aStream any;
 
-  ses := string_output ();
-  http ('<poll-db>', ses);
-  for select top 10 *
-        from (select a.P_NAME,
-                     SIOC..poll_post_iri (domain_id, P_ID) P_URI,
-                     a.P_UPDATED
-                from POLLS.WA.POLL a,
-                     DB.DBA.WA_INSTANCE b,
-                     DB.DBA.WA_MEMBER c
-                where a.P_DOMAIN_ID = domain_id
-                  and b.WAI_ID = a.P_DOMAIN_ID
-                  and c.WAM_INST = b.WAI_NAME
-                  and c.WAM_USER = user_id
-                order by a.P_UPDATED desc
-             ) x do {
-
-    declare uname, full_name varchar;
-
-    uname := (select coalesce (U_NAME, '') from DB.DBA.SYS_USERS where U_ID = user_id);
-    full_name := (select coalesce (coalesce (U_FULL_NAME, U_NAME), '') from DB.DBA.SYS_USERS where U_ID = user_id);
-
-    http ('<poll>', ses);
-    http (sprintf ('<dt>%s</dt>', date_iso8601 (P_UPDATED)), ses);
-    http (sprintf ('<title><![CDATA[%s]]></title>', P_NAME), ses);
-    http (sprintf ('<link><![CDATA[%s]]></link>', P_URI), ses);
-    http (sprintf ('<from><![CDATA[%s]]></from>', full_name), ses);
-    http (sprintf ('<uid>%s</uid>', uname), ses);
-    http ('</poll>', ses);
+  account_id := POLLS.WA.domain_owner_id (domain_id);
+  aStream := string_output ();
+  http ('<poll-db>', aStream);
+  for (select x.* from POLLS.WA.dashboard_rs(p0)(_id integer, _name varchar, _time datetime) x where p0 = domain_id) do
+  {
+    http ('<poll>', aStream);
+    http (sprintf ('<dt>%s</dt>', date_iso8601 (_time)), aStream);
+    http (sprintf ('<title><![CDATA[%s]]></title>', _name), aStream);
+    http (sprintf ('<link>%V</link>', SIOC..poll_post_iri (domain_id, _id)), aStream);
+    http (sprintf ('<from><![CDATA[%s]]></from>', POLLS.WA.account_fullName (account_id)), aStream);
+    http (sprintf ('<uid>%s</uid>', POLLS.WA.account_name (account_id)), aStream);
+    http ('</poll>', aStream);
   }
-  http ('</poll-db>', ses);
-  return string_output_string (ses);
+  http ('</poll-db>', aStream);
+  return string_output_string (aStream);
 }
 ;
 
diff --git a/appsrc/ODS-Polls/sql/polls-a-table.sql b/appsrc/ODS-Polls/sql/polls-a-table.sql
index 2f45de5..41fb4a8 100644
--- a/appsrc/ODS-Polls/sql/polls-a-table.sql
+++ b/appsrc/ODS-Polls/sql/polls-a-table.sql
@@ -1,5 +1,5 @@
 --
---  $Id: polls-a-table.sql,v 1.5 2008/03/21 12:29:14 source Exp $
+--  $Id: polls-a-table.sql,v 1.5.2.2 2010/09/22 13:57:04 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -48,8 +48,6 @@ POLLS.WA.exec_no_error('
     P_DOMAIN_ID integer not null,
     P_NAME varchar,
     P_DESCRIPTION varchar,
-    P_CREATED datetime,
-    P_UPDATED datetime,
     P_DATE_START datetime,
     P_DATE_END datetime,
     P_MODE char (1) default \'S\',          -- S - single question; M - multiple questions
@@ -61,11 +59,18 @@ POLLS.WA.exec_no_error('
     P_TAGS varchar,
     P_VOTED datetime,
     P_VOTES integer default 0,
+    P_ACL long varchar,
+    P_CREATED datetime,
+    P_UPDATED datetime,
 
     primary key(P_ID)
   )
 ');
 
+POLLS.WA.exec_no_error (
+  'alter table POLLS.WA.POLL add P_ACL long varchar', 'C', 'POLLS.WA.POLL', 'P_ACL'
+);
+
 POLLS.WA.exec_no_error ('
   create trigger POLL_AI after insert on POLLS.WA.POLL referencing new as N
   {
diff --git a/appsrc/ODS-Polls/sql/polls-a-wa.sql b/appsrc/ODS-Polls/sql/polls-a-wa.sql
index d9b1cf2..da1713e 100644
--- a/appsrc/ODS-Polls/sql/polls-a-wa.sql
+++ b/appsrc/ODS-Polls/sql/polls-a-wa.sql
@@ -1,5 +1,5 @@
 --
---  $Id: polls-a-wa.sql,v 1.3 2008/03/21 12:29:14 source Exp $
+--  $Id: polls-a-wa.sql,v 1.3.2.4 2010/09/22 13:57:04 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -65,19 +65,6 @@ create procedure POLLS.WA.exec_no_error(in expr varchar, in execType varchar :=
 --
 create procedure POLLS.WA.vhost()
 {
-  declare
-    iIsDav integer;
-  declare
-    sHost varchar;
-
-  -- Add a virtual directory for Polls - public www -------------------------
-  sHost := registry_get('_polls_path_');
-  if (cast(sHost as varchar) = '0')
-    sHost := '/apps/polls/';
-  iIsDav := 1;
-  if (isnull(strstr(sHost, '/DAV')))
-    iIsDav := 0;
-
   DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
     'ods_rule_polls',
     1,
@@ -159,6 +146,12 @@ POLLS.WA.exec_no_error (
 )
 ;
 
+POLLS.WA.exec_no_error (
+  'alter type wa_polls add overriding method wa_dashboard () returns any'
+)
+;
+
+
 -------------------------------------------------------------------------------
 --
 -- wa_polls methods
@@ -183,8 +176,15 @@ create method wa_id_string() for wa_polls
 --
 create method wa_drop_instance () for wa_polls
 {
+  for (select HP_LPATH as _lpath,
+              HP_HOST as _vhost,
+              HP_LISTEN_HOST as _lhost
+         from DB.DBA.HTTP_PATH
+        where HP_LPATH = '/polls/' || self.PollsID) do
+  {
+    VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+  }
   POLLS.WA.domain_delete (self.PollsID);
-  VHOST_REMOVE(lpath => concat ('/polls/', self.PollsID));
   (self as web_app).wa_drop_instance ();
 }
 ;
@@ -205,9 +205,7 @@ create method wa_notify_member_changed(in account int, in otype int, in ntype in
 --
 create method wa_new_inst (in login varchar) for wa_polls
 {
-  declare
-    iUserID,
-    iWaiID integer;
+  declare iUserID, iWaiID integer;
 
   iUserID := (select U_ID from DB.DBA.SYS_USERS where U_NAME = login);
   if (isnull(iUserID))
@@ -226,9 +224,9 @@ create method wa_new_inst (in login varchar) for wa_polls
   update WA_INSTANCE set WAI_INST = self where WAI_ID = iWaiID;
 
   -- Add a virtual directory for Polls - public www -------------------------
-  VHOST_REMOVE(lpath    => concat('/polls/', self.PollsID));
-  VHOST_DEFINE(lpath    => concat('/polls/', self.PollsID),
-               ppath    => concat(self.get_param('host'), 'www/'),
+  VHOST_REMOVE(lpath    => '/polls/' || self.PollsID);
+  VHOST_DEFINE(lpath    => '/polls/' || self.PollsID,
+               ppath    => self.get_param('host') || 'www/',
                ses_vars => 1,
                is_dav   => self.get_param('isDAV'),
                is_brws  => 0,
@@ -351,13 +349,34 @@ create method get_param (in param varchar) for wa_polls
 
 -------------------------------------------------------------------------------
 --
-create method wa_dashboard_last_item () for wa_polls
+create method wa_dashboard () for wa_polls
 {
-  declare domainID, userID integer;
+  declare iWaiID integer;
+
+  iWaiID := self.PollsID;
+  return (select XMLAGG ( XMLELEMENT ( 'dash-row',
+                                       XMLATTRIBUTES ( 'normal' as "class",
+                                                       POLLS.WA.dt_format(_time, 'Y/M/D H:N') as "time",
+                                                       self.wa_name as "application"
+                                                      ),
+                                       XMLELEMENT ( 'dash-data',
+	                                                  XMLATTRIBUTES ( concat (N'<a href="', cast (SIOC..poll_post_iri (iWaiID, _id) as nvarchar), N'">', POLLS.WA.utf2wide (_title), N'</a>') as "content",
+	                                                                  0 as "comments"
+	                                                                )
+                                          	      )
+                                     )
+                     	  )
+            from POLLS.WA.dashboard_rs(p0)(_id integer, _title varchar, _time datetime) x
+           where p0 = iWaiID
+         );
+}
+;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  userID := (select WAM_USER from WA_MEMBER B where WAM_INST = self.wa_name and WAM_MEMBER_TYPE = 1);
-  return POLLS.WA.dashboard_get (domainID, userID);
+-------------------------------------------------------------------------------
+--
+create method wa_dashboard_last_item () for wa_polls
+{
+  return POLLS.WA.dashboard_get (self.PollsID);
 }
 ;
 
@@ -367,10 +386,9 @@ create method wa_rdf_url (in vhost varchar, in lhost varchar) for wa_polls
 {
   declare domainID, userID integer;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  userID := (select WAM_USER from WA_MEMBER B where WAM_INST= self.wa_name and WAM_MEMBER_TYPE = 1);
-
-  return concat(POLLS.WA.dav_url2(domainID, userID), 'Polls.rdf');
+  domainID := self.PollsID;
+  userID := POLLS.WA.domain_owner_id (domainID);
+  return POLLS.WA.dav_url2(domainID, userID) || 'Polls.rdf';
 }
 ;
 
@@ -400,3 +418,40 @@ create method wa_update_instance (in oldValues any, in newValues any) for wa_pol
   return (self as web_app).wa_update_instance (oldValues, newValues);
 }
 ;
+
+-------------------------------------------------------------------------------
+--
+create procedure POLLS.WA.path_upgrade ()
+{
+  declare _new_lpath varchar;
+
+  if (registry_get ('polls_path_upgrade2') = '1')
+    return;
+
+  for (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_TYPE_NAME = 'Polls') do
+  {
+    for (select HP_LPATH as _lpath,
+                HP_HOST as _vhost,
+                HP_LISTEN_HOST as _lhost
+           from DB.DBA.HTTP_PATH
+          where HP_LPATH = '/polls/' || cast (WAI_ID as varchar) || '/polls.vspx') do
+    {
+      _new_lpath := '/polls/' || cast (WAI_ID as varchar);
+      if (exists (select 1 from DB.DBA.HTTP_PATH where HP_LPATH = _new_lpath and HP_HOST  = _vhost and HP_LISTEN_HOST = _lhost))
+      {
+        VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+      } else {
+        update DB.DBA.HTTP_PATH
+           set HP_LPATH = _new_lpath
+         where HP_LPATH = _lpath
+           and HP_HOST  = _vhost
+           and HP_LISTEN_HOST = _lhost;
+        http_map_del (_lpath, _vhost, _lhost);
+        VHOST_MAP_RELOAD (vhost=>_vhost, lhost=>_lhost, lpath=>_new_lpath);
+      }
+    }
+  }
+  registry_set ('polls_path_upgrade2', '1');
+}
+;
+POLLS.WA.path_upgrade ();
diff --git a/appsrc/ODS-Polls/sql/polls-d.sql b/appsrc/ODS-Polls/sql/polls-d.sql
index a5332a3..38b0b07 100644
--- a/appsrc/ODS-Polls/sql/polls-d.sql
+++ b/appsrc/ODS-Polls/sql/polls-d.sql
@@ -1,5 +1,5 @@
 --
---  $Id: polls-d.sql,v 1.6.2.1 2009/08/12 11:51:57 source Exp $
+--  $Id: polls-d.sql,v 1.6.2.3 2010/09/20 10:15:39 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -57,6 +57,15 @@ POLLS.WA.exec_no_error ('DROP type wa_polls');
 -- Views
 POLLS.WA.exec_no_error ('DROP view POLLS..TAGS_VIEW');
 
+-- Registry
+registry_remove ('_polls_path_');
+registry_remove ('_polls_version_');
+registry_remove ('_polls_build_');
+registry_remove ('polls_settings_update');
+registry_remove ('polls_index_version');
+registry_remove ('polls_path_upgrade2');
+registry_remove ('__ods_polls_sioc_init');
+
 -- Procedures
 create procedure POLLS.WA.drop_procedures()
 {
diff --git a/appsrc/ODS-Polls/sql/sioc_polls.sql b/appsrc/ODS-Polls/sql/sioc_polls.sql
index f74bf30..43ad6b9 100644
--- a/appsrc/ODS-Polls/sql/sioc_polls.sql
+++ b/appsrc/ODS-Polls/sql/sioc_polls.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sioc_polls.sql,v 1.9.2.3 2009/11/17 21:37:41 source Exp $
+--  $Id: sioc_polls.sql,v 1.9.2.7 2010/10/13 12:15:33 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -64,6 +64,25 @@ create procedure fill_ods_polls_sioc (in graph_iri varchar, in site_iri varchar,
   declare c_iri, creator_iri varchar;
 
   {
+    for (select WAI_ID,
+                WAI_TYPE_NAME,
+                WAI_NAME,
+                WAI_ACL
+           from DB.DBA.WA_INSTANCE
+          where ((_wai_name is null) or (WAI_NAME = _wai_name))
+            and WAI_TYPE_NAME = 'Polls') do
+    {
+      graph_iri := SIOC..acl_graph (WAI_TYPE_NAME, WAI_NAME);
+      exec (sprintf ('sparql clear graph <%s>', graph_iri));
+      SIOC..wa_instance_acl_insert (WAI_TYPE_NAME, WAI_NAME, WAI_ACL);
+      for (select P_DOMAIN_ID, P_ID, P_ACL
+             from POLLS.WA.POLL
+            where P_DOMAIN_ID = WAI_ID and P_ACL is not null) do
+      {
+        poll_acl_insert (P_DOMAIN_ID, P_ID, P_ACL);
+      }
+    }
+
     id := -1;
     deadl := 3;
     cnt := 0;
@@ -273,6 +292,96 @@ create trigger POLLS_SIOC_D before delete on POLLS.WA.POLL referencing old as O
 
 -------------------------------------------------------------------------------
 --
+create procedure poll_acl_insert (
+  inout domain_id integer,
+  inout poll_id integer,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  iri := SIOC..poll_post_iri (domain_id, poll_id);
+  graph_iri := POLLS.WA.acl_graph (domain_id);
+
+  SIOC..acl_insert (graph_iri, iri, acl);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure poll_acl_delete (
+  inout domain_id integer,
+  inout poll_id integer,
+  inout acl any)
+{
+  declare graph_iri, iri varchar;
+  declare exit handler for sqlstate '*'
+  {
+    sioc_log_message (__SQL_MESSAGE);
+    return;
+  };
+  iri := SIOC..poll_post_iri (domain_id, poll_id);
+  graph_iri := POLLS.WA.acl_graph (domain_id);
+
+  SIOC..acl_delete (graph_iri, iri, acl);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger POLL_SIOC_ACL_I after insert on POLLS.WA.POLL order 100 referencing new as N
+{
+  if (coalesce (N.P_ACL, '') <> '')
+  {
+    poll_acl_insert (N.P_DOMAIN_ID,
+                     N.P_ID,
+                     N.P_ACL);
+
+    SIOC..acl_ping (N.P_DOMAIN_ID,
+                    SIOC..poll_post_iri (N.P_DOMAIN_ID, N.P_ID),
+                    null,
+                    N.P_ACL);
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger POLL_SIOC_ACL_U after update (P_ACL) on POLLS.WA.POLL order 100 referencing old as O, new as N
+{
+  if (coalesce (O.P_ACL, '') <> '')
+    poll_acl_delete (O.P_DOMAIN_ID,
+                     O.P_ID,
+                     O.P_ACL);
+
+  if (coalesce (N.P_ACL, '') <> '')
+    poll_acl_insert (N.P_DOMAIN_ID,
+                     N.P_ID,
+                     N.P_ACL);
+
+  SIOC..acl_ping (N.P_DOMAIN_ID,
+                  SIOC..poll_post_iri (N.P_DOMAIN_ID, N.P_ID),
+                  O.P_ACL,
+                  N.P_ACL);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create trigger POLL_SIOC_ACL_D before delete on POLLS.WA.POLL order 100 referencing old as O
+{
+  if (coalesce (O.P_ACL, '') <> '')
+    poll_acl_delete (O.P_DOMAIN_ID,
+                     O.P_ID,
+                     O.P_ACL);
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure polls_comment_insert (
 	in graph_iri varchar,
 	in forum_iri varchar,
diff --git a/appsrc/ODS-Polls/www/ajax.vsp b/appsrc/ODS-Polls/www/ajax.vsp
index 2566664..5a53ec9 100644
--- a/appsrc/ODS-Polls/www/ajax.vsp
+++ b/appsrc/ODS-Polls/www/ajax.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: ajax.vsp,v 1.1 2009/01/30 16:48:31 source Exp $
+--  $Id: ajax.vsp,v 1.1.2.1 2010/09/20 10:15:40 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Polls/www/conversation.vspx b/appsrc/ODS-Polls/www/conversation.vspx
index 1caabc6..abe9ace 100644
--- a/appsrc/ODS-Polls/www/conversation.vspx
+++ b/appsrc/ODS-Polls/www/conversation.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: conversation.vspx,v 1.3.2.1 2010/01/29 20:21:31 source Exp $
+ -  $Id: conversation.vspx,v 1.3.2.2 2010/09/20 10:15:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Polls/www/css/style.css b/appsrc/ODS-Polls/www/css/style.css
index 53c13aa..b3383f6 100644
--- a/appsrc/ODS-Polls/www/css/style.css
+++ b/appsrc/ODS-Polls/www/css/style.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: style.css,v 1.8.2.5 2010/04/15 18:46:37 source Exp $
+ *  $Id: style.css,v 1.8.2.7 2010/10/07 13:22:06 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -20,65 +20,53 @@
  *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  *
  */
-
-body
-{
+body {
   padding: 0;
   margin: 0;
   font-family: Verdana, Arial, Helvetica, Sans-Serif;
   font-size: 9pt;
 }
 
-a
-{
+a {
   text-decoration: none;
 }
 
-a:active
-{
+a:active {
   text-decoration: none;
 }
 
-a:visited
-{
+a:visited {
   text-decoration: none;
 }
 
-a:hover
-{
+a:hover {
   text-decoration: underline;
 }
 
-.link
-{
+.link {
   color: blue;
 	cursor: pointer;
 }
 
-#MTB
-{
+#MTB {
   width: 100%;
   left: 0px;
   right: 0px;
 }
 
-#LC
-{
+#LC {
   width: 170px;
   padding-top: 5px;
   vertical-align: top;
 }
 
-#RC
-{
+#RC {
   padding-top: 5px;
   vertical-align: top;
 }
 
 /* Footer */
-
-#FT
-{
+#FT {
   width: 100%;
   position: relative;
   bottom: 0px;
@@ -92,8 +80,7 @@ a:hover
   background-image: url(../image/ods_main_footer.png);
 }
 
-#FT_L
-{
+#FT_L {
   float: left;
   clear: left;
   margin-top: 10px;
@@ -101,8 +88,7 @@ a:hover
   border: 1px solid #788;
 }
 
-#FT_R
-{
+#FT_R {
   float: right;
   clear: right;
   margin-top: 10px;
@@ -111,22 +97,18 @@ a:hover
   color: #788;
 }
 
-#FT_R a
-{
+#FT_R a {
   text-decoration: none;
   color: inherit;
 }
 
 /* Left side within MT */
-
-.page_head
-{
+.page_head {
   width: 100%;
   background-color: #b0cde4;
 }
 
-.left_container
-{
+.left_container {
   background-color: #EFEFEF;
   border: 1px solid #7f94a5;
   -moz-border-radius: 5px;
@@ -136,69 +118,57 @@ a:hover
   width: auto;
 }
 
-.left_container div, .left_container a
-{
+.left_container div, .left_container a {
   display: block;
   padding: 3px;
   margin: 3px;
 }
 
-.left_container a
-{
+.left_container a {
   text-decoration: none;
 }
 
-.left_container a:hover
-{
+.left_container a:hover {
   color: black;
   background: #99b3c5;
 }
 
-.navigator_info
-{
+.navigator_info {
   font-size: smaller;
 }
 
-.copyright
-{
+.copyright {
   font-size: 75%;
   text-align: right;
   padding-right: 5px;
   border-top: 1px solid silver;
 }
 
-.system_info
-{
+.system_info {
   font-size: 75%;
 }
 
-.page_title
-{
+.page_title {
   font-size: 12pt;
   font-weight: bold;
 }
 
-.main_page_area
-{
+.main_page_area {
   background-color: white;
   width: 100%;
 }
 
-.page_section_head
-{
+.page_section_head {
   font-size: 12pt;
   font-weight: bold;
 }
 
-table.sub_page_area
-{
+table.sub_page_area {
   width: 100%;
 }
 
 /* Label */
-
-.error
-{
+.error {
   color: red;
   font-weight: bold;
   margin: 3px 0px 3px 0px;
@@ -207,120 +177,27 @@ table.sub_page_area
   text-align: center;
 }
 
-.attention_marker
-{
+.attention_marker {
   color: #ff0033;
 }
 
-.subpage_header_area
-{
-  margin: 3px 0px 3px 0px;
-  border: 1pt solid silver;
-}
-
-.page_header_area
-{
-  border: 1pt solid silver;
-  position: relative;
-  bottom:15pt;
-}
-
-/* The main navigation bar */
-.nav_bar
-{
-  display: block;
-  padding: 0;
-  margin: 0;
-  line-height: 1.9em;
-  font-size: 0.9em;
-}
-
-.nav_bar td.sel
-{
-}
-
-.nav_bar td
-{
-  background: #ddd;
-}
-
-.nav_bar td.filler
-{
-  background: #b0cde4;
-  width: 100%;
-}
-
-.nav_bar a
-{
-  display: block;
-  color: #444;
-  text-decoration: none;
-  font-weight: bold;
-  background: #99b3c5;
-  background-image: url(../image/stl_blu2_grad.gif);
-  background-repeat: repeat-x;
-  margin: 0;
-  padding: 0.25em 1em;
-  border-left: 1px solid #fff;
-  border-top: 1px solid #fff;
-  border-right: 1px solid #aaa;
-  white-space: nowrap;
-}
-
-.nav_bar a.les
-{
-  background: #b0cde4;
-  background-image: url(../image/sel_nav_grad2.gif);
-}
-
-.nav_bar a.les:hover
-{
-  color: black;
-  background: #99b3c5;
-}
-
-.nav_bar a:hover,
-.nav_bar a:active,
-.nav_bar a.sel:link,
-.nav_bar a.sel:visited
-{
-  background: #b0cde4;
-  background-image: url(../image/sel_nav_grad2.gif);
-  color: #000;
-}
-
-.nav_seperator {
-  left: 0px;
-  top: 0px;
-  width: 100%;
-  background-color: #b0cde4;
-  line-height: 2.6em;
-  color: #b0cde4;
-}
-
-/*
-  Fields
-*/
-input[readonly]
-{
+/* Fields */
+input[readonly] {
   background: #EFEFEF;
 }
 
-.readonly
-{
+.readonly {
   background: #EFEFEF;
 }
 
-/* ====== lists ====== */
-table#list
-{
+/* lists */
+table#list {
   width: 100%;
   border: solid #7f94a5;
   border-width: 1px 1px 2px 1px;
 }
 
-table#list th
-{
+table#list th {
   font-size: 0.9em;
   font-weight: bold;
   text-align: center;
@@ -330,8 +207,7 @@ table#list th
   border-width: 0px 1px 1px 0px;
 }
 
-table#list th:last-child
-{
+table#list th:last-child {
   border-width: 0px 0px 1px 0px;
 }
 
@@ -342,77 +218,31 @@ table#list thead input {
   background-color: #b0cde4;
 }
 
-/*====== trees ======*/
-.tree_main
-{
-  border: solid #7f94a5;
-  border-width: 1px 1px 1px 1px;
-  padding: 3px;
-  height: 400px;
-  overflow: auto;
-  font-weight: bold;
-}
-
-/*====== news ======*/
-.polls_main
-{
+/* Panes */
+.pane_main {
   width: 100%;
+  min-height: 500px;
   position: relative;
 }
 
-.polls_left
-{
+.pane_left {
   width: 33.3%;
-  float: left;
-}
-
-.polls_left_sub
-{
-  width: 100%;
-  float: left;
-  overflow: auto;
-  border: solid #7f94a5;
-  border-width: 1px
-}
-
-.polls_left_sub1
-{
-  width: 100%;
-  height: 500px;
+  height: 100%;
   float: left;
   overflow: auto;
   border: solid #7f94a5;
   border-width: 1px
 }
 
-.polls_left_sub2
-{
-  width: 100%;
-  height: 150px;
-  float: left;
-  margin-top: 12px;
-  background-color: #EFEFEF;
-  border: solid #7f94a5;
-  border-width: 1px
-}
-
-.polls_left_sub2 div
-{
-  padding: 3px;
-  margin: 3px;
-}
-
-.polls_right
-{
+.pane_right {
   width: 66.3%;
-  min-height: 500px;
+  height: 100%;
   float: right;
   border: solid #7f94a5;
   border-width: 0px;;
 }
 
-#polls_header
-{
+#polls_header {
   font-size: 1em;
   padding: 3px;
   background-color: #EFEFEF;
@@ -420,8 +250,7 @@ table#list thead input {
   border-width: 0px 0px 1px 0px;
 }
 
-#polls_subheader
-{
+#polls_subheader {
   font-size: 0.9em;
   padding: 2px;
   background-color: #b0cde4;
@@ -429,51 +258,36 @@ table#list thead input {
   border-width: 0px 0px 2px 0px;
 }
 
-/* ====== rows ====== */
-.td_border
-{
+/* rows */
+.td_border {
   border: solid #7f94a5;
   border-width: 1px 0px 1px 0px;
 }
 
-.tr_0
-{
+.tr_0 {
   border: solid #7f94a5;
   border-width: 0px 0px 1px 0px;
   background-color: #F5F5EE;
 }
 
-.tr_1
-{
+.tr_1 {
   border: solid #7f94a5;
   border-width: 0px 0px 1px 0px;
 }
 
-.tr_select
-{
+.tr_select {
   background-color: #FFFFCC;
 }
 
-.read
-{
+.read {
 }
 
-.unread
-{
+.unread {
   font-weight: bold;
 }
 
-/*====== forms ======*/
-.body-scroll
-{
-  background-color: white;
-  height: 30em;
-  width: auto;
-  overflow: auto;
-}
-
-.from-button
-{
+/* forms */
+.from-button {
   margin: .8em 0 .8em 0;
   font-size: .8em;
   font-family: verdana, sans-serif;
@@ -574,23 +388,8 @@ input.nolink4 {
 }
 
 
-.pane-label
-{
-  font-weight: bold;
-  background-color: #EFEFEF;
-  border: 1px solid #000;
-  border-bottom-width: 0px;
-  border-color: #7f94a5;
-  padding: 2px 10px 2px 10px;
-  position: relative;
-  text-decoration: none;
-  top: -1px;
-  z-index: 100;
-}
-
 /* New */
-.form-header
-{
+.form-header {
   font-size: 1.1em;
   font-weight: bold;
   margin: 0 0 6px 0;
@@ -600,8 +399,7 @@ input.nolink4 {
   background-color: #b0cde4;
 }
 
-.form-footer
-{
+.form-footer {
   margin: 6px 0px;
   text-align: center;
   height: 20px;
@@ -611,58 +409,30 @@ input.nolink4 {
   background-color: #b0cde4;
 }
 
-.form-header
-{
-  font-size: 13px;
-  font-weight: bold;
-  margin: 0 0 8px 0;
-  padding: 0px 0px 3px 4px;
-  border: solid #7f94a5;
-  border-width: 1px 1px 1px 10px;
-  background-color: #b0cde4;
-}
-
-.form-footer
-{
-  margin: 6px 0px;
-  text-align: center;
-  border: solid 1px #7f94a5;
-  background-color: #b0cde4;
-  height: 20px;
-  padding-top: 0px;
-  padding-bottom: 2px;
-}
-
-.form-body
-{
+.form-body {
   width: 100%;
   font-size: 1em;
 }
 
-.form-body td
-{
+.form-body td {
   padding: 2px;
 }
 
-.form-body th
-{
+.form-body th {
   text-align: right;
   padding: 4px;
 }
 
-.td_label
-{
+.td_label {
   text-align: right;
   padding-right: 1em;
 }
 
-.td_simple
-{
+.td_simple {
   border-width: 0px 0px 0px 0px;
 }
 
-.tab_page
-{
+.tab_page {
   font-size: 10pt;
   border-width: 1px 1px 1px 1px;
   background-color: white;
@@ -673,42 +443,17 @@ input.nolink4 {
   height: 100%;
 }
 
-.clear
-{
+.clear {
   width: 100%;
   padding: 0px;
   border-width: 0;
 }
 
-.clear td
-{
+.clear td {
   padding: 0px;
   border-width: 0;
 }
 
-.form-body2
-{
-  width: 100%;
-  border: solid #7f94a5;
-  border-width: 1px 1px 2px 1px;
-  background-color: #EFEFEF;
-}
-
-.form-body2-td
-{
-  padding: 2px;
-  border: solid #7f94a5;
-  border-width: 0px 1px 1px 0px;
-}
-
-.form-body2-th
-{
-  text-align: right;
-  padding: 4px;
-  border: solid #7f94a5;
-  border-width: 0px 1px 1px 0px;
-}
-
 div.boxHeader {
   background-color: #EFEFEF;
   margin: 0 0 0.5em 0;
@@ -717,9 +462,8 @@ div.boxHeader {
   vertical-align: middle;
 }
 
-/*====== Grids ======*/
-.grid
-{
+/* Grids */
+.grid {
   width: 100%;
   border: solid #7f94a5;
   border-width: 1px 1px 2px 1px;
@@ -729,8 +473,7 @@ div.boxHeader {
   border-bottom: 1px solid #fff;
 }
 
-.polls_grid
-{
+.polls_grid {
   width: 100%;
 }
 
@@ -738,15 +481,12 @@ div.boxHeader {
   border-bottom: 1px solid #fff;
 }
 
-thead.sortHeader tr
-{
+thead.sortHeader tr {
   background-image: url(../image/stl_blu1_grad.gif);
   background-repeat: repeat-x;
 }
 
-/* make the TH elements pretty */
-thead.sortHeader th
-{
+thead.sortHeader th {
   font-size: 1em;
   font-weight: bold;
   text-align: left;
@@ -755,20 +495,16 @@ thead.sortHeader th
   border-width: 0px 1px 1px 0px;
 }
 
-thead.sortHeader th.checkbox
-{
+thead.sortHeader th.checkbox {
   text-align: center;
   padding: 0;
 }
 
-thead.sortHeader th:last-child
-{
+thead.sortHeader th:last-child {
   border-width: 0px 0px 1px 0px;
 }
 
-/* make the A elements pretty. makes for nice clickable headers                */
-thead.sortHeader a, thead.sortHeader a:link, thead.sortHeader a:visited
-{
+thead.sortHeader a, thead.sortHeader a:link, thead.sortHeader a:visited {
   color: #000;
   font-weight: bold;
   display: block;
@@ -776,10 +512,7 @@ thead.sortHeader a, thead.sortHeader a:link, thead.sortHeader a:visited
   width: 100%
 }
 
-/* make the A elements pretty. makes for nice clickable headers                */
-/* WARNING: swapping the background on hover may cause problems in WinIE 6.x   */
-thead.sortHeader a:hover
-{
+thead.sortHeader a:hover {
   color: #000;
   font-weight: bold;
   display: block;
@@ -787,28 +520,7 @@ thead.sortHeader a:hover
   width: 100%
 }
 
-/*====== New forms ======*/
-.new-form-header
-{
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 0 0 6px 0;
-  padding: 0px 0px 2px 4px;
-  border: solid #7f94a5;
-  border-width: 1px 1px 1px 10px;
-  background-color: #b0cde4;
-}
-
-.new-form-footer
-{
-  font-size: 1.1em;
-  font-weight: bold;
-  margin: 6px 0 0 0;
-  text-align: center;
-  border: solid 1px #7f94a5;
-  background-color: #b0cde4;
-}
-
+/* New forms */
 .new-form-body
 {
   font-size: 1em;
@@ -818,38 +530,28 @@ thead.sortHeader a:hover
   background-color: #EFEFEF;
 }
 
-.no-border
-{
-  border-width: 0;
-}
-
-.new-form-body table
-{
+.new-form-body table {
   width: 100%;
   background-color: #EFEFEF;
 }
 
-.new-form-body table td
-{
+.new-form-body table td {
   padding: 2px;
 }
 
-.new-form-body table td.text
-{
+.new-form-body table td.text {
   font-style: italic;
   font-weight: bold;
   padding: 2px;
 }
 
-.new-form-body table th
-{
+.new-form-body table th {
   text-align: right;
   white-space: nowrap;
   padding: 4px;
 }
 
-.text
-{
+.text {
   font-style: italic;
   font-weight: bold;
   padding: 2px;
@@ -858,7 +560,6 @@ thead.sortHeader a:hover
 /* tabs */
 div.c1 {
   width: 100%;
-  padding-top: 0.5em;
 }
 
 div.tabs {
@@ -908,20 +609,18 @@ div.activeTab {
   border-color: #7f94a5;
 }
 
-/*====== Toolbars ======*/
+/* Toolbars */
 div.toolbar {
 }
 
-img.toolbar
-{
+img.toolbar {
   display: block;
   float: left;
   margin-top: 10px;
   background-color: #7F94A5;
 }
 
-a.toolbar
-{
+a.toolbar {
   display: block;
   float: left;
   width: 70px;
@@ -933,8 +632,7 @@ a.toolbar
   text-align: center;
 }
 
-span.toolbar
-{
+span.toolbar {
   display: block;
   float: left;
   width: 70px;
@@ -946,12 +644,11 @@ span.toolbar
   text-align: center;
 }
 
-span.toolbarLabel
-{
+span.toolbarLabel {
   font-size: 0.8em;
 }
 
-/*====== Vote ======*/
+/* Vote */
 .vote-poll {
   font-size: 1.2em;
   font-weight: bold;
@@ -969,8 +666,7 @@ span.toolbarLabel
   padding-left: 7em;
 }
 
-#vote-result-table
-{
+#vote-result-table {
   width: auto;
   margin-left: 7em;
   border: solid #7f94a5;
@@ -978,14 +674,12 @@ span.toolbarLabel
   background-color: #EFEFEF;
 }
 
-#vote-result-table thead tr
-{
+#vote-result-table thead tr {
   background-image: url(../image/stl_blu1_grad.gif);
   background-repeat: repeat-x;
 }
 
-#vote-result-table td
-{
+#vote-result-table td {
   padding: 2px;
 }
 
@@ -996,7 +690,7 @@ span.toolbarLabel
   padding: 4px;
 }
 
-/*-------------- charts -----------*/
+/* charts */
 
 .legend {
 	background-color: #fff;
@@ -1030,21 +724,18 @@ span.toolbarLabel
 }
 
 /* Comments */
-div.cm_node_top
-{
+div.cm_node_top {
   padding-left: 1em;
   margin-left: 0px;
 }
 
-div.cm_node
-{
+div.cm_node {
   padding-left: 1em;
   margin-left: 0px;
   border-left: 2px #e0e0e0 solid;
 }
 
-div.comment-section
-{
+div.comment-section {
   padding: 0 0px 0 2px;
   font-size: 1.1em;
   font-weight: bold;
@@ -1053,25 +744,21 @@ div.comment-section
   background-color: #b0cde4;
 }
 
-div.comment
-{
+div.comment {
   margin-top: 5px;
 }
 
-div.comment-footer
-{
+div.comment-footer {
   margin: 1px;
   color: gray;
 }
 
-div.comment-header
-{
+div.comment-header {
   border-bottom: 1px #cccccc solid;
   font-size: 1.1em;
 }
 
-div.comment-button
-{
+div.comment-button {
   margin: 1px;
   padding-top: 5px;
   border-top: 1px #cccccc solid;
@@ -1119,3 +806,23 @@ td.calendar_selected {
 .calendar_special {
 	color: #c55;
 }
+
+.pointer {
+  cursor: pointer;
+}
+
+span.button {
+  background: none repeat scroll 0 0 #99B3C5;
+  border: 1px solid #7F94A5;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  color: #FFFFFF;
+  font-size: 0.8em;
+  font-weight: bold;
+  padding: 3px 4px 1px;
+  text-decoration:none;
+}
+
+img.button {
+  margin-bottom: -3px;
+}
diff --git a/appsrc/ODS-Polls/www/error.vspx b/appsrc/ODS-Polls/www/error.vspx
index 436eb22..bac2697 100644
--- a/appsrc/ODS-Polls/www/error.vspx
+++ b/appsrc/ODS-Polls/www/error.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
-  -  $Id: error.vspx,v 1.2 2007/05/31 08:29:45 source Exp $
+  -  $Id: error.vspx,v 1.2.2.1 2010/09/20 10:15:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Polls/www/export.vspx b/appsrc/ODS-Polls/www/export.vspx
index 5bb7f07..9e6ff99 100644
--- a/appsrc/ODS-Polls/www/export.vspx
+++ b/appsrc/ODS-Polls/www/export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
-  -  $Id: export.vspx,v 1.4.2.2 2010/05/31 21:59:14 source Exp $
+  -  $Id: export.vspx,v 1.4.2.4 2010/10/07 13:22:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -86,7 +86,7 @@
 
         state := '00000';
         sqlParams := vector();
-        sql := POLLS.WA.search_sql (self.domain_id, self.account_id, data);
+        sql := POLLS.WA.search_sql (self.domain_id, self.account_id, self.account_rights, 'R', data);
         exec(sql, state, msg, sqlParams, 0, meta, rows);
         if (state <> '00000')
           goto _error;
diff --git a/appsrc/ODS-Polls/www/gems.vsp b/appsrc/ODS-Polls/www/gems.vsp
index b7052cd..40f55f2 100644
--- a/appsrc/ODS-Polls/www/gems.vsp
+++ b/appsrc/ODS-Polls/www/gems.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: gems.vsp,v 1.1.2.1 2010/05/31 21:59:14 source Exp $
+--  $Id: gems.vsp,v 1.1.2.3 2010/10/07 13:22:06 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -35,30 +35,8 @@
     if (not _authorized)
     {
       _authorized := 1;
-      _authorizeVector := DB.DBA.vsp_auth_vec (http_request_header());
-      if (_authorizeVector = 0)
-      {
-        _authorized := 0;
-      } else {
-        if (get_keyword ('authtype', _authorizeVector) <> 'basic')
-        {
+      if (not ODS..ods_check_auth (_user, _domain_id, 'reader'))
           _authorized := 0;
-        } else {
-          _user := get_keyword ('username', _authorizeVector, '');
-          _password := get_keyword ('pass', _authorizeVector, '');
-          if (not DB.DBA.web_user_password_check (_user, _password))
-          {
-            _authorized := 0;
-          } else {
-            _user_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = _user);
-            _role := POLLS.WA.access_role (_domain_id, _user_id);
-            if (_role not in ('admin', 'owner'))
-            {
-              _authorized := 0;
-            }
-          }
-        }
-      }
     }
     http_rewrite ();
     if (not _authorized)
diff --git a/appsrc/ODS-Polls/www/js/polls.js b/appsrc/ODS-Polls/www/js/polls.js
index 4aabd0f..a926320 100644
--- a/appsrc/ODS-Polls/www/js/polls.js
+++ b/appsrc/ODS-Polls/www/js/polls.js
@@ -19,6 +19,15 @@
  *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  *
 */
+function setFooter() {
+  if ($('pane_main')) {
+    var wDims = OAT.Dom.getViewport()
+    var hDims = OAT.Dom.getWH('FT')
+    var cPos = OAT.Dom.position('pane_main')
+    $('pane_main').style.height = (wDims[1] - hDims[1] - cPos[1] - 20) + 'px';
+  }
+}
+
 function urlParam(fldName)
 {
   var O = document.forms[0].elements[fldName];
@@ -27,13 +36,6 @@ function urlParam(fldName)
   return '';
 }
 
-function myA(obj) {
-  if (obj.href) {
-    document.location = obj.href + '?' + urlParam('sid') + urlParam('realm');
-    return false;
-  }
-}
-
 function myPost(frm_name, fld_name, fld_value) {
   createHidden(frm_name, fld_name, fld_value);
   document.forms[frm_name].submit();
diff --git a/appsrc/ODS-Polls/www/polls.vspx b/appsrc/ODS-Polls/www/polls.vspx
index 0466ec1..2eb63c6 100644
--- a/appsrc/ODS-Polls/www/polls.vspx
+++ b/appsrc/ODS-Polls/www/polls.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: polls.vspx,v 1.18.2.3 2010/02/10 22:17:02 source Exp $
+ -  $Id: polls.vspx,v 1.18.2.6 2010/10/13 12:15:33 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -36,15 +36,21 @@
       if (self.pPoll <> '')
       {
         self.v_id := cast (self.pPoll as integer);
-        if (POLLS.WA.poll_enable_edit (self.v_id, self.account_role))
+        if (POLLS.WA.poll_enable_edit (self.domain_id, self.v_id, POLLS.WA.poll_rights (self.domain_id, self.v_id, self.account_rights)))
         {
           self.v_step := '';
           self.pAction := 'edit';
-        } else if (POLLS.WA.poll_enable_vote (self.v_id)) {
+        }
+        else if (POLLS.WA.poll_enable_vote (self.domain_id, self.v_id))
+        {
           self.pAction := 'vote';
-        } else if (POLLS.WA.poll_enable_result (self.v_id) > 0) {
+        }
+        else if (POLLS.WA.poll_enable_result (self.domain_id, self.v_id) > 0)
+        {
           self.pAction := 'result';
-        } else {
+        }
+        else
+        {
           self.pAction := 'browse';
         }
       }
@@ -53,17 +59,13 @@
 
   <v:method name="toolbarLabel" arglist="in cmd varchar">
     <![CDATA[
-      if (self.pLabels = 0)
-        return '';
-      return sprintf ('<br /><span class="toolbarLabel">%s</span>', cmd);
+      return case when (self.pLabels = 0) then '' else sprintf ('<br /><span class="toolbarLabel">%s</span>', cmd) end;
     ]]>
   </v:method>
 
   <v:method name="toolbarEnable" arglist="in cmd varchar">
     <![CDATA[
-      if ((cmd = 'Poll/Create') and ((self.account_role in ('public', 'guest')) or (self.pMode = 'PublicPolls')))
-        return 0;
-      return 1;
+      return case when (cmd = 'Poll/Create') and ((self.account_rights <> 'W') or (self.pMode = 'PublicPolls')) then 0 else 1 end;
     ]]>
   </v:method>
 
@@ -274,6 +276,7 @@
       <v:variable name="v_date_start" type="any" default="null" />
       <v:variable name="v_date_end_mode" type="integer" default="0" />
       <v:variable name="v_date_end" type="any" default="null" />
+      <v:variable name="v_acl" type="varchar" default="null"/>
       <v:variable persist="0" name="v_number" type="integer" default="1" />
       <v:variable persist="0" name="v_questions" type="any" default="null" />
       <v:variable persist="0" name="v_deleted" type="any" default="null" />
@@ -388,8 +391,8 @@
           </span>
 
         </div>
-        <div style="clear: both;" />
-      <div class="polls_main">
+      <br style="clear: both;" />
+      <div id="pane_main" class="pane_main">
         <?vsp
           if (0)
           {
@@ -458,8 +461,7 @@
         <?vsp
           }
         ?>
-        <div class="polls_left">
-          <div class="polls_left_sub1">
+        <div class="pane_left">
             <?vsp
               declare tMin, tMax integer;
               declare tClass, tStyle varchar;
@@ -520,8 +522,7 @@
               }
             ?>
           </div>
-        </div>
-        <div class="polls_right">
+        <div class="pane_right">
           <v:template type="simple" enabled="--case when (self.pAction = 'browse') then 1 else 0 end">
             <v:data-source name="dsrc" expression-type="sql" nrows="0" initial-offset="0">
               <v:before-data-bind>
@@ -541,7 +542,7 @@
 
                   control.ds_nrows := POLLS.WA.settings_rows (self.settings);
                   control.ds_parameters := vector ();
-                  control.ds_sql := POLLS.WA.search_sql (self.domain_id, self.account_id, data);
+                  control.ds_sql := POLLS.WA.search_sql (self.domain_id, self.account_id, self.account_rights, data);
                 ]]>
               </v:before-data-bind>
               <v:after-data-bind>
@@ -555,7 +556,7 @@
                 <table id="polls" class="polls_grid" cellspacing="0">
                   <thead class="sortHeader">
                     <tr>
-                      <v:template type="simple" enabled="--case when ((self.account_role in ('public', 'guest')) or (self.pMode = 'PublicPolls')) then 0 else 1 end">
+                      <v:template type="simple" enabled="--case when ((self.account_rights <> 'W') or (self.pMode = 'PublicPolls')) then 0 else 1 end">
                         <th class="checkbox" width="1%">
                           <input type="checkbox" name="cb_all" value="Select All" onclick="selectAllCheckboxes(this, 'cb_item')" />
                         </th>
@@ -593,7 +594,7 @@
                 <v:template name="ds_browse" type="browse" name-to-remove="table" set-to-remove="both">
                   <table>
                     <tr>
-                      <v:template type="simple" enabled="--case when ((self.account_role in ('public', 'guest')) or (self.pMode = 'PublicPolls')) then 0 else 1 end">
+                      <v:template type="simple" enabled="--case when ((self.account_rights <> 'W') or (self.pMode = 'PublicPolls')) then 0 else 1 end">
                         <td align="center" valign="top">
                           <?vsp
                             declare S varchar;
@@ -609,37 +610,38 @@
                       <td valign="top">
                         <?vsp
                           declare N, id, did integer;
-                          declare title, actions, tags any;
+                          declare title, actions, tags, permissions any;
 
                           id := (control as vspx_row_template).te_column_value('P_ID');
                           did := (control as vspx_row_template).te_column_value('P_DOMAIN_ID');
                           title := (control as vspx_row_template).te_column_value('P_NAME');
                           tags := (control as vspx_row_template).te_column_value('P_TAGS');
+                          permissions := POLLS.WA.poll_rights (self.domain_id, id, self.account_rights);
 
-                          if (POLLS.WA.poll_enable_edit (id, self.account_role))
+                          if (POLLS.WA.poll_enable_edit (self.domain_id, id, permissions))
                           {
-                            http (sprintf ('<div style="float: left; font-weight: bold;"><a id="poll_%d" href="%s" onclick="javascript: vspxPost (\'pt_browse\', \'pt_action\', \'edit\', \'pt_value\', \'%d\'); return false;" title="Edit %s" class="app link">%s</a></div>', id, SIOC..poll_post_iri (self.domain_id, id), id, title, POLLS.WA.stringCut(title, self.pChars)));
+                            http (sprintf ('<div style="float: left; font-weight: bold;"><a id="poll_%d" href="%s" onclick="javascript: vspxPost (\'pt_browse\', \'pt_action\', \'edit\', \'pt_value\', \'%d\'); return false;" title="Edit %s" class="app link">%s</a></div>', id, POLLS.WA.utf2wide (SIOC..poll_post_iri (self.domain_id, id)), id, title, POLLS.WA.stringCut(title, self.pChars)));
                           } else {
                             http (sprintf ('<div style="float: left; font-weight: bold;">%s</div>', title));
                           }
                             
                           actions := '';
-                          if (POLLS.WA.poll_enable_vote (id))
+                          if (POLLS.WA.poll_enable_vote (self.domain_id, id))
                             actions := actions || either (equ (actions, ''), '', ' | ') || sprintf ('<span onclick="javascript: vspxPost (\'pt_browse\', \'pt_action\', \'vote\', \'pt_value\', \'%d\');" title="Vote %s" class="link">vote</span>', id, title);
 
-                          if (POLLS.WA.poll_enable_clear (id, self.account_role))
+                          if (POLLS.WA.poll_enable_clear (self.domain_id, id, permissions))
                             actions := actions || either (equ (actions, ''), '', ' | ') || sprintf ('<span onclick="javascript: if (confirm (\'Are you sure that you want to clear all votes?\')) vspxPost (\'pt_browse\', \'pt_action\', \'clear\', \'pt_value\', \'%d\'); " title="Clear %s" class="link">clear</span>', id, title);
 
-                          if (POLLS.WA.poll_enable_result (id) > 0)
+                          if (POLLS.WA.poll_enable_result (self.domain_id, id) > 0)
                             actions := actions || either (equ (actions, ''), '', ' | ') || sprintf ('<span onclick="javascript: vspxPost (\'pt_browse\', \'pt_action\', \'result\', \'pt_value\', \'%d\');" title="Results of %s" class="link">result</span>', id, title);
 
-                          if (POLLS.WA.poll_enable_activate (id, self.account_role))
+                          if (POLLS.WA.poll_enable_activate (self.domain_id, id, permissions))
                             actions := actions || either (equ (actions, ''), '', ' | ') || sprintf ('<span onclick="javascript: if (confirm (\'Are you sure that you want to activate this poll?\')) vspxPost (\'pt_browse\', \'pt_action\', \'active\', \'pt_value\', \'%d\'); " title="Activate %s" class="link">activate</span>', id, title);
 
-                          if (POLLS.WA.poll_enable_close (id, self.account_role))
+                          if (POLLS.WA.poll_enable_close (self.domain_id, id, permissions))
                             actions := actions || either (equ (actions, ''), '', ' | ') || sprintf ('<span onclick="javascript: if (confirm (\'Are you sure that you want to close this poll?\')) vspxPost (\'pt_browse\', \'pt_action\', \'close\', \'pt_value\', \'%d\'); " title="Close %s" class="link">close</span>', id, title);
 
-                          if (POLLS.WA.poll_enable_edit (id, self.account_role) = 1)
+                          if (POLLS.WA.poll_enable_edit (self.domain_id, id, permissions) = 1)
                             actions := actions || either (equ (actions, ''), '', ' | ') || sprintf ('<span onclick="javascript: vspxPost (\'pt_browse\', \'pt_action\', \'edit\', \'pt_value\', \'%d\');" title="Edit %s" class="link">edit</span>', id, title);
 
                           if (POLLS.WA.discussion_check () and POLLS.WA.conversation_enable (self.domain_id))
@@ -696,7 +698,7 @@
           </v:template>
 
           <v:template type="simple" enabled="--case when (self.pAction = 'tag') then 1 else 0 end">
-            <div class="new-form-header">
+            <div class="form-header">
               <v:label format="%s" value="Tag poll(s)" />
             </div>
             <div class="new-form-body">
@@ -712,7 +714,7 @@
                 <?vsp self.myTags ('t_tag'); ?>
               </table>
             </div>
-            <div class="new-form-footer">
+            <div class="form-footer">
               <v:button action="simple" value="Tag" xhtml_class="form-button">
                 <v:on-post>
                   <![CDATA[
@@ -772,7 +774,8 @@
                          P_VOTE_RESULT_BEFORE,
                          P_VOTE_RESULT_OPENED,
                          POLLS.WA.dt_date (P_DATE_START),
-                         POLLS.WA.dt_date (P_DATE_END)
+                         POLLS.WA.dt_date (P_DATE_END),
+                         P_ACL
                     into self.v_name,
                          self.v_description,
                          self.v_tags,
@@ -781,7 +784,8 @@
                          self.v_vote_result_before,
                          self.v_vote_result_opened,
                          self.v_date_start,
-                         self.v_date_end
+                         self.v_date_end,
+                         self.v_acl
                     from POLLS.WA.POLL
                    where P_ID = self.v_id;
 
@@ -823,6 +827,7 @@
                   self.v_date_end := POLLS.WA.dt_date (dateadd ('day', 60, now ()));
                   self.v_questions := vector ();
                   self.v_deleted := vector ();
+                  self.v_acl := null;
                 }
 
                 self.v_name := get_keyword ('p_name', params, self.v_name);
@@ -837,11 +842,13 @@
                 self.v_date_end_mode := cast(get_keyword ('p_date_end_mode', params, self.v_date_end_mode) as integer);
                 self.v_date_end := get_keyword ('p_date_end', params, self.v_date_end);
 
-                if (not isnull(get_keyword ('text', params))) {
+                if (not isnull(get_keyword ('text', params)))
+                {
                   declare qParams any;
 
                   qParams := vector ();
-                  for (N := 0; N < length (params); N := N + 2) {
+                  for (N := 0; N < length (params); N := N + 2)
+                  {
                     if (params[N] like 'pq_%')
                       qParams := vector_concat (qParams, vector(replace (params[N], 'rq_', ''), params[N+1]));
                   }
@@ -851,7 +858,7 @@
             </v:before-data-bind>
 
             <v:template type="simple" enabled="-- case when (self.v_step = '0') then 1 else 0 end">
-              <div class="new-form-header">
+              <div class="form-header">
                 <v:label format="%s" value="--'Create Poll - Step 1: Select poll type'" />
               </div>
               <div class="new-form-body">
@@ -884,7 +891,7 @@
                   </tr>
                 </table>
               </div>
-              <div class="new-form-footer">
+              <div class="form-footer">
                 <v:button action="simple" value="Next" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
@@ -907,11 +914,17 @@
 
 
             <v:template type="simple" enabled="-- case when (self.v_step = '1') then 1 else 0 end">
-              <div class="new-form-header">
+              <div class="form-header">
                 <v:label format="%s" value="--case when (self.pAction = 'create') then 'Create Poll - Step 2: Parameters' else 'Update Poll - Step 1: Parameters' end" />
               </div>
-              <div class="new-form-body">
-                <table cellspacing="0">
+              <div id="p" class="c1">
+                <div class="tabs">
+                   <vm:tabCaption tab="p" tabsCount="2" tabNo="0" caption="Main" />
+                   <vm:tabCaption tab="p" tabsCount="2" tabNo="1" caption="Sharing" />
+                </div>
+                <div class="contents">
+                  <div id="p_content_0" class="tabContent">
+                    <table class="form-body" cellspacing="0">
                   <tr>
                     <th>
                       <v:label for="p_name" value="-- case when (self.v_mode = 'S') then 'Question (*)' else 'Poll Name (*)' end" />
@@ -1035,7 +1048,61 @@
                   </tr>
                 </table>
               </div>
-              <div class="new-form-footer">
+                  <div id="p_content_1" class="tabContent" style="display: none;">
+                    <table class="form-body" cellspacing="0">
+                      <tr>
+                        <td style="width: 90%; background-color: white;">
+                          <table id="s_tbl" width="100%" cellspacing="0">
+                            <thead class="sortHeader">
+                              <tr>
+                                <th width="15%">Type</th>
+                                <th>Value</th>
+                                <th width="1%" nowrap="nowrap">ACL: (R)ead, (W)rite</th>
+                                <th width="50px">Action</th>
+                              </tr>
+                            </thead>
+                      		  <![CDATA[
+                      		    <script type="text/javascript">
+                              <?vsp
+                                declare N, L integer;
+                                declare acl, aType, aAccess any;
+
+                                L := 0;
+                                acl := (select WAI_ACL from DB.DBA.WA_INSTANCE where WAI_ID = self.domain_id);
+                                acl := case when isnull (acl) then vector () else deserialize (acl) end;
+                                for (N := 0; N < length (acl); N := N + 1)
+                                {
+                                  L := L + 1;
+                                  http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}, fld_4: {value: "Inherited"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
+                                }
+                                acl := deserialize (self.v_acl);
+                                for (N := 0; N < length (acl); N := N + 1)
+                                {
+                                  L := L + 1;
+                                  if (self.v_mode <> 'view')
+                                  {
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("s", null, {fld_1: {mode: 50, value: "%s", onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: "F1", tdCssText: "white-space: nowrap;", className: "_validate_ _webid_", value: "%s", readOnly: %s, imgCssText: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', acl[N][2], acl[N][1], case when acl[N][2] = 'public' then 'true' else 'false' end, case when acl[N][2] = 'public' then 'display: none;' else '' end, acl[N][3], acl[N][4], acl[N][5]));
+                                  } else {
+                                    http (sprintf ('OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createViewRow("s", {fld_1: {mode: 50, value: "%s"}, fld_2: {value: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; white-space: nowrap; text-align: center;"}});});', acl[N][2], acl[N][1], acl[N][3], acl[N][4], acl[N][5]));
+                                  }
+                                }
+                              ?>
+                      		    </script>
+                      		  ]]>
+                            <tr id="s_tr_no" style="display: <?V case when L=0 then '' else 'none' end ?>;"><td colspan="<?V case when self.v_mode='view' then 3 else 4 end ?>"><b>No Shares</b></td></tr>
+                      		</table>
+                      	</td>
+                        <vm:if test="self.v_mode <> 'view'">
+                          <td valign="top" nowrap="nowrap">
+                            <img class="pointer" src="/ods/images/icons/add_16.png" border="0" alt="Add Share" title="Add Share" onclick="javascript: TBL.createRow('s', null, {fld_1: {mode: 50, onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, form: 'F1', tdCssText: 'white-space: nowrap;', className: '_validate_ _webid_'}, fld_3: {mode: 52, value: [1, 0, 0], tdCssText: 'width: 1%; white-space: nowrap; text-align: center;'}});" />
+                          </td>
+                        </vm:if>
+                      </tr>
+                    </table>
+                  </div>
+                </div>
+              </div>
+              <div class="form-footer">
                 <v:button action="simple" value="Back" enabled="-- case when (self.pAction = 'create') then 1 else 0 end" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
@@ -1090,7 +1157,7 @@
                         POLLS.WA.set_keyword ('$text', qParams, self.v_name);
                         self.qSet (qParams);
                       }
-
+                      self.v_acl := serialize (DB.DBA.wa_acl_params (params));
                       self.v_step := '2';
                       self.vc_data_bind(e);
                     ]]>
@@ -1108,7 +1175,7 @@
             </v:template>
 
             <v:template type="simple" enabled="-- case when (self.v_step = '2') then 1 else 0 end">
-              <div class="new-form-header">
+              <div class="form-header">
                 <v:label format="%s" value="--case when (self.pAction = 'create') then 'Create Poll - Step 3: Questions' else 'Update Poll - Step 2: Questions' end" />
               </div>
               <div class="new-form-body">
@@ -1370,7 +1437,7 @@
                   </tr>
                 </table>
               </div>
-              <div class="new-form-footer">
+              <div class="form-footer">
                 <v:button action="simple" value="Back" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
@@ -1440,6 +1507,7 @@
                                                          self.v_date_end,
                                                          self.v_mode
                                                         );
+                      POLLS.WA.poll_acl (self.domain_id, self.v_id, self.v_acl);
 
                       for (N := 0; N < length (self.v_questions); N := N + 1)
                       {
@@ -1487,7 +1555,7 @@
             </v:template>
 
             <v:template type="simple" enabled="-- case when (self.v_step = '3') then 1 else 0 end">
-              <div class="new-form-header">
+              <div class="form-header">
                 <v:label format="%s" value="--case when (self.pAction = 'create') then 'Create Poll - Preview' else 'Update Poll - Preview' end" />
               </div>
               <div class="new-form-body">
@@ -1555,7 +1623,7 @@
                   }
                 ?>
               </div>
-              <div class="new-form-footer">
+              <div class="form-footer">
                 <v:button action="simple" value="Back" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
@@ -1570,7 +1638,7 @@
           </v:template>
 
           <v:template type="simple" enabled="--case when (self.pAction = 'vote') then 1 else 0 end">
-            <div class="new-form-header">
+            <div class="form-header">
               <v:label format="%s" value="Poll vote" />
             </div>
             <div class="new-form-body">
@@ -1632,7 +1700,7 @@
                 }
               ?>
             </div>
-            <div class="new-form-footer">
+            <div class="form-footer">
               <v:button action="simple" value="Vote" xhtml_onclick="javascript: return checkVote(this);" xhtml_class="form-button">
                 <v:on-post>
                   <![CDATA[
@@ -1688,7 +1756,7 @@
           </v:template>
 
           <v:template type="simple" enabled="--case when (self.pAction = 'result') then 1 else 0 end">
-            <div class="new-form-header">
+            <div class="form-header">
               Vote results
             </div>
             <div class="new-form-body">
@@ -1697,7 +1765,7 @@
                 declare tmp, Q, S, answers, vt, aValue, aCount any;
                 declare rChart, rLegends, rPercents, rFlag any;
 
-                tmp := POLLS.WA.poll_enable_result (self.v_id);
+                tmp := POLLS.WA.poll_enable_result (self.domain_id, self.v_id);
                 if (tmp = -1)
                 {
                   http ('<p class="vote-poll">Poll is not activated and results can not be shown</p>');
@@ -1825,7 +1893,7 @@
               _end:;
               ?>
             </div>
-            <div class="new-form-footer">
+            <div class="form-footer">
               <v:button action="simple" name="r_back" value="Back" xhtml_class="form-button">
                 <v:on-post>
                   <![CDATA[
diff --git a/appsrc/ODS-Polls/www/polls_login.vspx b/appsrc/ODS-Polls/www/polls_login.vspx
index 34609c1..12d6215 100644
--- a/appsrc/ODS-Polls/www/polls_login.vspx
+++ b/appsrc/ODS-Polls/www/polls_login.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
-  -  $Id: polls_login.vspx,v 1.2 2007/03/30 23:18:28 source Exp $
+  -  $Id: polls_login.vspx,v 1.2.2.3 2010/10/07 13:22:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -27,32 +27,38 @@
   <v:after-data-bind>
     <![CDATA[
       declare page_name varchar;
+      declare vh, lh, hf, ods_path any;
 
       set_qualifier ('DB');
       page_name := POLLS.WA.page_name ();
       if (page_name = 'error.vspx')
         return;
 
-      if (POLLS.WA.check_grants2 (self.account_role, page_name))
+      if (POLLS.WA.check_grants (self.account_rights, page_name))
         return;
 
-      declare vh, lh, hf, ods_path any;
+      if (isnull (self.account_rights) and not is_empty_or_null (self.sid))
+      {
+        self.vc_redirect (sprintf ('/ods/error.vspx?__PAGE=%U&__SQL_STATE=%U&__SQL_MESSAGE=%U', 'home.vspx', '23023', 'You have no access rights for the application!'));
+        return;
+      }
 
+      if (isnull (self.account_rights))
+      {
       vh := http_map_get ('vhost');
       lh := http_map_get ('lhost');
       hf := http_request_header (lines, 'Host');
-
       if (hf is not null and exists (select 1 from HTTP_PATH where HP_HOST = vh and HP_LISTEN_HOST = lh and HP_LPATH = '/ods'))
-        ods_path := 'http://' || hf || '/ods/';
-      else
+        {
+          ods_path := DB.DBA.WA_GET_PROTOCOL() || hf || '/ods/';
+        } else {
         ods_path := DB.DBA.WA_LINK (1, '/ods/');
-
-      if (self.account_role = 'expire') {
-
+        }
         http_request_status ('HTTP/1.1 302 Found');
         http_header (sprintf('Location: %slogin.vspx?URL=%U\r\n', ods_path, HTTP_REQUESTED_URL()));;
         return;
       }
+      if (page_name <> 'polls.vspx')
       self.vc_redirect('polls.vspx');
     ]]>
   </v:after-data-bind>
diff --git a/appsrc/ODS-Polls/www/search.vspx b/appsrc/ODS-Polls/www/search.vspx
index 32e1a55..93536fa 100644
--- a/appsrc/ODS-Polls/www/search.vspx
+++ b/appsrc/ODS-Polls/www/search.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: search.vspx,v 1.12.2.4 2010/07/09 14:37:01 source Exp $
+ -  $Id: search.vspx,v 1.12.2.7 2010/10/13 12:15:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -35,7 +35,6 @@
       tmp := POLLS.WA.vector_unique(tmp);
       self.v_tags := POLLS.WA.vector2tags(tmp);
 
-      if (not (self.account_role in ('public', 'guest')))
         self.v_own := self.f_own.ufl_selected;
       self.v_public := self.f_public.ufl_selected;
     ]]>
@@ -101,7 +100,7 @@
 
       state := '00000';
       sqlParams := vector();
-      sql := POLLS.WA.search_sql (self.domain_id, self.account_id, data);
+      sql := POLLS.WA.search_sql (self.domain_id, self.account_id, self.account_rights, data);
       exec(sql, state, msg, sqlParams, 0, meta, result);
       if (state = '00000')
       {
@@ -190,7 +189,7 @@
   </v:after-data-bind>
   <v:before-render>
     <![CDATA[
-      self.F1.uf_action := POLLS.WA.page_url (self.domain_id, 'search.vspx');
+      self.F1.uf_action := POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id, 'search.vspx'));
     ]]>
   </v:before-render>
   <vm:pagetitle>Search results</vm:pagetitle>
@@ -248,7 +247,6 @@
             self.v_tags := POLLS.WA.vector2tags(self.v_tags);
           }
           -- options
-          if (not (self.account_role in ('public', 'guest')))
             self.v_own := self.f_own.ufl_selected;
           self.v_public := self.f_public.ufl_selected;
 
@@ -449,7 +447,6 @@
                     <v:text name="f_tags" value="--self.v_tags" fmt-function="POLLS.WA.utf2wide" xhtml_class="textbox" xhtml_size="60"/>
                   </td>
                 </tr>
-                <vm:if test="(self.account_role <> 'public') and (self.account_role <> 'shared')">
                   <tr>
                     <th/>
                     <td>
@@ -457,7 +454,6 @@
                       <b><vm:label for="f_own" value="Search in my polls"/></b>
                     </td>
                   </tr>
-                </vm:if>
                 <tr>
                   <th/>
                   <td>
@@ -523,7 +519,7 @@
           <v:button action="simple" value="Cancel" xhtml_class="form-button">
             <v:on-post>
               <![CDATA[
-                self.vc_redirect (POLLS.WA.page_url (self.domain_id));
+                self.vc_redirect (POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id)));
               ]]>
             </v:on-post>
           </v:button>
@@ -540,14 +536,7 @@
                 <v:button action="simple" style="url" value="Advanced" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
-                      self.vc_is_valid := 1;
-                      self.v_step := 0;
-                      self.v_mode := 'advanced';
-                      self.ds_data := vector();
-                      self.ds_meta := vector();
-                      self.ds_tags := vector();
-                      self.f_own.ufl_selected := 1;
-                      self.vc_data_bind(e);
+                      self.vc_redirect (POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id, 'search.vspx?mode=advanced')));
                     ]]>
                   </v:on-post>
                 </v:button>
@@ -555,7 +544,7 @@
                 <v:button action="simple" style="url" value="Cancel" xhtml_class="form-button">
                   <v:on-post>
                     <![CDATA[
-                      self.vc_redirect (POLLS.WA.page_url (self.domain_id));
+                      self.vc_redirect (POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id)));
                     ]]>
                   </v:on-post>
                 </v:button>
diff --git a/appsrc/ODS-Polls/www/settings.vspx b/appsrc/ODS-Polls/www/settings.vspx
index 6e4d307..b93450f 100644
--- a/appsrc/ODS-Polls/www/settings.vspx
+++ b/appsrc/ODS-Polls/www/settings.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
-  -  $Id: settings.vspx,v 1.6.2.1 2010/07/09 14:37:01 source Exp $
+  -  $Id: settings.vspx,v 1.6.2.5 2010/10/13 12:15:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -33,11 +33,11 @@
     <vm:pagebody>
       <v:before-render>
         <![CDATA[
-          self.F1.uf_action := AB.WA.page_url (self.domain_id, 'settings.vspx');
+          self.F1.uf_action := POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id, 'settings.vspx'));
         ]]>
       </v:before-render>
       <v:text name="tabNo" xhtml_id="tabNo" type="hidden" value="--self.v_tabNo"/>
-      <div class="new-form-header">
+      <div class="form-header">
         Preferences
       </div>
       <div id="p" class="c1">
@@ -160,7 +160,7 @@
           </div>
         </div>
       </div>
-      <div class="new-form-footer">
+      <div class="form-footer">
         <v:button action="simple" value="Save" xhtml_class="form-button">
           <v:on-post>
             <![CDATA[
@@ -211,7 +211,7 @@
     					    POLLS.WA.nntp_fill (self.domain_id);
     					}
 
-              self.vc_redirect (POLLS.WA.page_url (self.domain_id));
+              self.vc_redirect (POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id)));
             ]]>
           </v:on-post>
         </v:button>
@@ -220,14 +220,14 @@
             <![CDATA[
               delete from POLLS.WA.SETTINGS where S_DOMAIN_ID = self.domain_id;
 
-              self.vc_redirect (POLLS.WA.page_url (self.domain_id, 'settings.vspx'));
+              self.vc_redirect (POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id, 'settings.vspx')));
             ]]>
           </v:on-post>
         </v:button>
         <v:button action="simple" value="Cancel" xhtml_class="form-button">
           <v:on-post>
             <![CDATA[
-              self.vc_redirect (POLLS.WA.page_url (self.domain_id));
+              self.vc_redirect (POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id)));
             ]]>
           </v:on-post>
         </v:button>
diff --git a/appsrc/ODS-Polls/www/tags.vspx b/appsrc/ODS-Polls/www/tags.vspx
index e049330..c5d2a6b 100644
--- a/appsrc/ODS-Polls/www/tags.vspx
+++ b/appsrc/ODS-Polls/www/tags.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: tags.vspx,v 1.2.2.1 2010/02/10 22:17:03 source Exp $
+ -  $Id: tags.vspx,v 1.2.2.2 2010/09/20 10:15:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Polls/www/template/popup.vspx b/appsrc/ODS-Polls/www/template/popup.vspx
index 8925be0..cb98c52 100644
--- a/appsrc/ODS-Polls/www/template/popup.vspx
+++ b/appsrc/ODS-Polls/www/template/popup.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: popup.vspx,v 1.4.2.3 2010/03/12 09:14:46 source Exp $
+ -  $Id: popup.vspx,v 1.4.2.5 2010/10/07 13:22:07 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -58,8 +58,7 @@
       <vm:variables>
         <v:variable persist="0" name="domain_id" type="integer" default="-1"/>
         <v:variable persist="0" name="account_id" type="integer" default="-1"/>
-        <v:variable persist="0" name="account_role" type="varchar" default="'public'"/>
-        <v:variable persist="0" name="accountName" type="varchar" default="'Public User'"/>
+        <v:variable persist="0" name="account_rights" type="varchar" default="''"/>
         <v:variable persist="0" name="settings" type="any" />
       </vm:variables>
       <v:on-init>
@@ -73,8 +72,7 @@
           aSessInfo := POLLS.WA.session_restore (params);
           self.domain_id := cast(get_keyword('domain_id', aSessInfo, '-1') as integer);
           self.account_id := cast(get_keyword('user_id', aSessInfo, '-1') as integer);
-          self.account_role := get_keyword('user_role', aSessInfo, '');
-          self.accountName := get_keyword('user_name', aSessInfo, '');
+          self.account_rights := get_keyword ('account_rights', aSessInfo);
           self.settings := POLLS.WA.settings (self.domain_id);
         ]]>
       </v:on-init>
diff --git a/appsrc/ODS-Polls/www/template/template.vspx b/appsrc/ODS-Polls/www/template/template.vspx
index 07621ba..eac041c 100644
--- a/appsrc/ODS-Polls/www/template/template.vspx
+++ b/appsrc/ODS-Polls/www/template/template.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: template.vspx,v 1.17.2.6 2010/04/09 14:39:32 source Exp $
+ -  $Id: template.vspx,v 1.17.2.8 2010/10/07 13:22:07 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -76,6 +76,10 @@
       		// init tabs
           showTab('p', 2, 0);
           showTab('s', 2, 0);
+
+          setFooter();
+          window.onresize = function() {setFooter();}
+
           OAT.MSG.send(OAT, 'PAGE_LOADED');
         }
         OAT.MSG.attach(OAT, 'PAGE_LOADED2', myInit);
@@ -88,10 +92,8 @@
     <v:page xmlns:v="http://www.openlinksw.com/vspx/">
         <v:variable persist="0" name="domain_id" type="integer" default="-1" />
         <v:variable persist="0" name="account_id" type="integer" default="-1" />
-        <v:variable persist="0" name="account_role" type="varchar" default="'public'" />
-        <v:variable persist="0" name="accountName" type="varchar" default="'Public User'" />
+      <v:variable persist="0" name="account_rights" type="varchar" default="''" />
       <v:variable persist="0" name="owner_id" type="integer" default="null" />
-      <v:variable persist="0" name="ownerName" type="varchar" default="null" />
         <v:variable persist="0" name="settings" type="any" />
       <v:on-init>
         <![CDATA[
@@ -104,10 +106,8 @@
           aSessInfo := POLLS.WA.session_restore (params);
           self.domain_id := cast(get_keyword('domain_id', aSessInfo, '-1') as integer);
           self.account_id := cast(get_keyword('user_id', aSessInfo, '-1') as integer);
-          self.account_role := get_keyword('user_role', aSessInfo, '');
-          self.accountName := get_keyword('user_name', aSessInfo, '');
+          self.account_rights := get_keyword ('account_rights', aSessInfo);
           self.owner_id := POLLS.WA.domain_owner_id (self.domain_id);
-          self.ownerName := POLLS.WA.domain_owner_name (self.domain_id);
           self.settings := vector_concat (vector ('app', DB.DBA.WA_USER_APP_ENABLE (self.account_id)), POLLS.WA.settings (self.domain_id));
         ]]>
       </v:on-init>
diff --git a/appsrc/ODS-Polls/www/template/template.xsl b/appsrc/ODS-Polls/www/template/template.xsl
index 5a8434e..34d0355 100644
--- a/appsrc/ODS-Polls/www/template/template.xsl
+++ b/appsrc/ODS-Polls/www/template/template.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
-  -  $Id: template.xsl,v 1.15.2.3 2010/07/09 14:37:01 source Exp $
+  -  $Id: template.xsl,v 1.15.2.6 2010/10/13 12:15:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -147,7 +147,7 @@
       <xsl:copy-of select="."/>
     </xsl:for-each>
     <xsl:apply-templates select="vm:init"/>
-    <v:form name="F1" method="POST" type="simple" action="--POLLS.WA.page_url (self.domain_id)" xhtml_enctype="multipart/form-data">
+    <v:form name="F1" method="POST" type="simple" action="--POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id))" xhtml_enctype="multipart/form-data">
       <ods:ods-bar app_type='Polls'/>
       <div id="app_area" style="clear: right;">
       <div style="background-color: #fff;">
@@ -169,7 +169,7 @@
                       params := e.ve_params;
                       q := trim (get_keyword ('q', params, ''));
                       S := case when q <> ''then sprintf ('&q=%s&step=1', q) else '' end;
-                      self.vc_redirect (POLLS.WA.page_url (self.domain_id, sprintf ('search.vspx?mode=%s%s', get_keyword ('select', params, 'advanced'), S)));
+                      self.vc_redirect (POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id, sprintf ('search.vspx?mode=%s%s', get_keyword ('select', params, 'advanced'), S))));
                       self.vc_data_bind(e);
                      ]]>
               </v:on-post>
@@ -179,10 +179,10 @@
             ?>
             <div style="float: right; text-align: right; padding-right: 0.5em; padding-top: 20px;">
               <v:text name="q" value="" fmt-function="POLLS.WA.utf2wide" xhtml_onkeypress="javascript: if (checkNotEnter(event)) return true; vspxPost(\'searchHead\', \'select\', \'simple\'); return false;"/>
-              <xsl:call-template name="nbsp"/>
-              <v:url url="--POLLS.WA.page_url (self.domain_id, 'search.vspx?mode=simple', self.sid, self.realm)" xhtml_onclick="javascript: vspxPost(\'searchHead\', \'select\', \'simple\'); return false;" value="Search" xhtml_title="simple Search" />
+              &nbsp;
+              <a href="<?vsp http (POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id, 'search.vspx?mode=simple', self.sid, self.realm))); ?>" onclick="vspxPost('searchHead', 'select', 'simple'); return false;" title="Simple Search">Search</a>
             |
-              <v:url url="--POLLS.WA.page_url (self.domain_id, 'search.vspx?mode=advanced', self.sid, self.realm)" xhtml_onclick="javascript: vspxPost(\'searchHead\', \'select\', \'advanced\'); return false;" value="Advanced" xhtml_title="Advanced Search" />
+              <a href="<?vsp http (POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id, 'search.vspx?mode=advanced', self.sid, self.realm))); ?>" onclick="vspxPost('searchHead', 'select', 'advanced'); return false;" title="Advanced">Advanced</a>
           </div>
         </v:template>
       </div>
@@ -191,11 +191,11 @@
             <?vsp http (POLLS.WA.utf2wide (POLLS.WA.banner_links (self.domain_id, self.sid, self.realm))); ?>
           </div>
           <div style="float: right; padding-right: 0.5em;">
-        <v:template type="simple" enabled="--case when (self.account_role in ('public', 'guest')) then 0 else 1 end">
-              <v:url url="--POLLS.WA.page_url (self.domain_id, 'settings.vspx', self.sid, self.realm)" value="Preferences" xhtml_title="Preferences"/>
+            <vm:if test="self.account_rights = 'W'">
+              <a href="<?vsp http (POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id, 'settings.vspx', self.sid, self.realm))); ?>" title="Preferences">Preferences</a>
               |
-        </v:template>
-            <a href="--POLLS.WA.page_url (self.domain_id, 'about.vsp')" onclick="javascript: POLLS.aboutDialog(); return false;" title="About">About</a>
+            </vm:if>
+            <a href="<?vsp http (POLLS.WA.utf2wide (POLLS.WA.page_url (self.domain_id, 'about.vsp'))); ?>" onclick="javascript: POLLS.aboutDialog(); return false;" title="About">About</a>
       </div>
           <p style="clear: both; line-height: 0.1em" />
         </div>  
@@ -221,7 +221,11 @@
           </td>
         </tr>
       </table>
-      <div id="FT">
+        <?vsp
+          declare C any;
+          C := vsp_ua_get_cookie_vec(self.vc_event.ve_lines);
+        ?>
+        <div id="FT" style="display: <?V case when get_keyword ('interface', C, '') = 'js' then 'none' else '' end ?>">
         <div id="FT_L">
           <a href="http://www.openlinksw.com/virtuoso">
             <img alt="Powered by OpenLink Virtuoso Universal Server" src="image/virt_power_no_border.png" border="0" />
@@ -254,7 +258,7 @@
           http ('<div style="border-top: 1px solid #7f94a5;"></div>');
         }
 
-        S := POLLS.WA.gems_url (self.domain_id);
+        S := POLLS.WA.utf2wide (POLLS.WA.gems_url (self.domain_id));
         http (sprintf('<a href="%sPolls.%s" target="_blank" title="%s export" alt="%s export" class="gems"><img src="image/rss-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'rss', 'RSS', 'RSS', 'RSS', 'RSS'));
         http (sprintf('<a href="%sPolls.%s" target="_blank" title="%s export" alt="%s export" class="gems"><img src="image/blue-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'atom', 'ATOM', 'ATOM', 'ATOM', 'Atom'));
         http (sprintf('<a href="%sPolls.%s" target="_blank" title="%s export" alt="%s export" class="gems"><img src="image/rdf-icon-16.gif" border="0" alt="%s export" /> %s</a>', S, 'rdf', 'RDF', 'RDF', 'RDF', 'RDF'));
@@ -452,16 +456,4 @@
     </div>
   </xsl:template>
 
-  <!--=========================================================================-->
-  <xsl:template name="nbsp">
-    <xsl:param name="count" select="1"/>
-    <xsl:if test="$count != 0">
-      <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
-      <xsl:call-template name="nbsp">
-        <xsl:with-param name="count" select="$count - 1"/>
-      </xsl:call-template>
-    </xsl:if>
-  </xsl:template>
-  <!--=========================================================================-->
-
 </xsl:stylesheet>
diff --git a/appsrc/ODS-Polls/xslt/rss2atom.xsl b/appsrc/ODS-Polls/xslt/rss2atom.xsl
index dc38459..d23445d 100644
--- a/appsrc/ODS-Polls/xslt/rss2atom.xsl
+++ b/appsrc/ODS-Polls/xslt/rss2atom.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom.xsl,v 1.2.2.1 2010/05/31 21:59:14 source Exp $
+ -  $Id: rss2atom.xsl,v 1.2.2.2 2010/09/20 10:15:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Polls/xslt/rss2atom03.xsl b/appsrc/ODS-Polls/xslt/rss2atom03.xsl
index 3e2ee58..8dfd327 100644
--- a/appsrc/ODS-Polls/xslt/rss2atom03.xsl
+++ b/appsrc/ODS-Polls/xslt/rss2atom03.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom03.xsl,v 1.2 2007/05/10 10:48:10 source Exp $
+ -  $Id: rss2atom03.xsl,v 1.2.2.1 2010/09/20 10:15:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Polls/xslt/rss2rdf.xsl b/appsrc/ODS-Polls/xslt/rss2rdf.xsl
index f02a03d..1620653 100644
--- a/appsrc/ODS-Polls/xslt/rss2rdf.xsl
+++ b/appsrc/ODS-Polls/xslt/rss2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
-  -  $Id: rss2rdf.xsl,v 1.2 2007/05/10 10:48:10 source Exp $
+  -  $Id: rss2rdf.xsl,v 1.2.2.1 2010/09/20 10:15:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Polls/xslt/rss2xbel.xsl b/appsrc/ODS-Polls/xslt/rss2xbel.xsl
index ed6d3ec..408ccf1 100644
--- a/appsrc/ODS-Polls/xslt/rss2xbel.xsl
+++ b/appsrc/ODS-Polls/xslt/rss2xbel.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -  
-  -  $Id: rss2xbel.xsl,v 1.1 2007/02/27 21:42:33 source Exp $
+  -  $Id: rss2xbel.xsl,v 1.1.2.1 2010/09/20 10:15:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/Makefile.in b/appsrc/ODS-WebMail/Makefile.in
index 930c5ed..771ffc8 100644
--- a/appsrc/ODS-WebMail/Makefile.in
+++ b/appsrc/ODS-WebMail/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-WebMail/make_vad.sh b/appsrc/ODS-WebMail/make_vad.sh
index 87c0187..1454b3d 100755
--- a/appsrc/ODS-WebMail/make_vad.sh
+++ b/appsrc/ODS-WebMail/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.34.2.14 2010/07/09 14:37:01 source Exp $
+#  $Id: make_vad.sh,v 1.34.2.25 2011/03/28 16:04:22 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -30,7 +30,7 @@ export LANG LC_ALL
 
 MODE=$1
 LOGDIR=`pwd`
-VERSION="1.4.111"
+VERSION="1.5.117"
 LOGFILE="${LOGDIR}/vad_make.log"
 STICKER_DAV="vad_dav.xml"
 STICKER_FS="vad_filesystem.xml"
@@ -45,7 +45,7 @@ VAD_DAV="$VAD_NAME"_dav.vad
 VAD_FS="$VAD_NAME"_filesystem.vad
 DSN="$HOST:$PORT"
 HOST_OS=`uname -s | grep WIN`
-NEED_VERSION=04.50.2905
+NEED_VERSION=06.01.3127	 	# VOS
 
 if [ "x$HOST_OS" != "x" ]
 then
@@ -225,7 +225,7 @@ sticker_init() {
   echo "  <name package=\"Mail\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS Mail\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
@@ -237,8 +237,8 @@ sticker_init() {
   echo "<dependencies>" >> $STICKER
   echo "  <require>" >> $STICKER
   echo "    <name package=\"Framework\"/>" >> $STICKER
-  echo "    <versions_later package=\"1.73.21\">" >> $STICKER
-  echo "      <prop name=\"Date\" value=\"2010-07-08 12:00\" />" >> $STICKER
+  echo "    <versions_later package=\"1.77.42\">" >> $STICKER
+  echo "      <prop name=\"Date\" value=\"2010-11-01 12:00\" />" >> $STICKER
   echo "      <prop name=\"Comment\" value=\"An incompatible version of the ODS Framework\" />" >> $STICKER
   echo "    </versions_later>" >> $STICKER
   echo "  </require>" >> $STICKER
diff --git a/appsrc/ODS-WebMail/sql/DET_oMail.sql b/appsrc/ODS-WebMail/sql/DET_oMail.sql
index 7b3d617..b0c5d1c 100644
--- a/appsrc/ODS-WebMail/sql/DET_oMail.sql
+++ b/appsrc/ODS-WebMail/sql/DET_oMail.sql
@@ -1,5 +1,5 @@
 --
---  $Id: DET_oMail.sql,v 1.6 2007/02/27 21:19:46 source Exp $
+--  $Id: DET_oMail.sql,v 1.6.2.2 2010/09/20 10:15:41 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -671,8 +671,8 @@ create procedure "oMail_DAV_FC_PRED_METAS" (inout pred_metas any)
     'RES_MOD_TIME',		vector ('MESSAGES'	, 0, 'datetime'	, 'coalesce (RCV_DATE, SND_DATE)'	),
     'RES_PERMS',		vector ('MESSAGES'	, 0, 'varchar'	, '(''110000000RR'')'	),
     'RES_CONTENT',		vector ('MSG_PARTS'	, 0, 'text'	, 'TDATA'	),
-    'PROP_NAME',		vector ('MESSAGES'	, 0, 'varchar'	, '(''Content'')'	),
-    'PROP_VALUE',		vector ('MESSAGES'	, 1, 'text'	, 'TDATA'	),
+    'PROP_NAME',    vector ('MSG_PARTS'  , 0, 'varchar'  , '(''Content'')'  ),
+    'PROP_VALUE',    vector ('MSG_PARTS'  , 1, 'text'  , 'TDATA'  ),
     'RES_TAGS',			vector ('MESSAGES'	, 0, 'varchar'  , '('''')'	), -- 'varchar', not 'text-tag' because there's no free-text on union
     'RES_PUBLIC_TAGS',		vector ('MESSAGES'	, 0, 'varchar'	, '('''')'	),
     'RES_PRIVATE_TAGS',		vector ('MESSAGES'	, 0, 'varchar'	, '('''')'	),
diff --git a/appsrc/ODS-WebMail/sql/eml/eml-create-code.sql b/appsrc/ODS-WebMail/sql/eml/eml-create-code.sql
index 53add22..69789de 100644
--- a/appsrc/ODS-WebMail/sql/eml/eml-create-code.sql
+++ b/appsrc/ODS-WebMail/sql/eml/eml-create-code.sql
@@ -1,5 +1,5 @@
 --
---  $Id: eml-create-code.sql,v 1.42.2.13 2010/07/09 14:37:01 source Exp $
+--  $Id: eml-create-code.sql,v 1.42.2.23 2011/02/14 13:03:13 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -253,13 +253,13 @@ create procedure OMAIL.WA.omail_address2xml(
       }
     }
     if (_count = 1)
-      return either(length(_name),trim(_name),trim(_addr));
+      return either(length (_name),OMAIL.WA.utl_decode_field (trim (_name)),trim (_addr));
     if (_count = 2)
       return trim (_addr);
     if (length(_name) > 0)
-      _name  := sprintf('<name><![CDATA[%s]]></name>',trim(_name),_x);
+      _name  := sprintf ('<name>%V</name>',OMAIL.WA.utl_decode_field (trim (_name)),_x);
     if (length(_addr) > 0)
-      _addr  := sprintf('<email><![CDATA[%s]]></email>',_addr);
+      _addr  := sprintf ('<email>%V</email>',_addr);
 
     _rs := sprintf('%s<%s>%s%s</%s>',_rs,_node,_name,_addr,_node);
   }
@@ -280,7 +280,8 @@ create procedure OMAIL.WA.omail_replyAddress(
   _found := 0;
   _rs    := '';
   _array := xpath_eval('/addres_list/*', xml_tree_doc(xml_tree( _address)),0);
-  for (N := 0; N < length(_array); N := N + 1) {
+  for (N := 0; N < length (_array); N := N + 1)
+  {
     _s := '';
     _n := cast(xpath_eval('name()', _array[N]) as varchar);
     _m := cast(xpath_eval('./email', _array[N]) as varchar);
@@ -338,7 +339,8 @@ create procedure OMAIL.WA.omail_array2string(
 
   _del := '';
   _rs  := '';
-  for (N := 0; N < length(_array); N := N + 1) {
+  for (N := 0; N < length (_array); N := N + 1)
+  {
     _rs  := sprintf('%s%s%s', _rs, _del, cast(aref(_array, N) as varchar));
     _del := _delimiter;
   }
@@ -349,27 +351,38 @@ create procedure OMAIL.WA.omail_array2string(
 -------------------------------------------------------------------------------
 --
 create procedure OMAIL.WA.array2xml(
-  in V any)
+  in V any,
+  in lowerCase integer := 1,
+  in root varchar := null)
 {
   declare N integer;
   declare S, node, value varchar;
 
   S  := '';
-  for (N := 0; N < length(V); N := N + 2) {
-  	if (isstring(V[N])) {
-  	  node := lower(cast(V[N] as varchar));
-  	  if (isarray(V[N+1]) and not isstring(V[N+1])) {
+  for (N := 0; N < length (V); N := N + 2)
+  {
+    if (isstring(V[N]))
+    {
+      node := cast (V[N] as varchar);
+      if (lowerCase)
+        node := lcase (node);
+      if (isarray(V[N+1]) and not isstring(V[N+1]))
+      {
   	    value := OMAIL.WA.array2xml(V[N+1]) ;
-
-  	  } else if (isnull(V[N+1])) {
+      }
+      else if (isnull (V[N+1]))
+      {
   	    value := '';
-
-  	  } else {
+      }
+      else
+      {
   	    value := cast(V[N+1] as varchar);
   	  }
   	  S := sprintf('%s<%s>%s</%s>\n', S, node, value, node);
     }
   }
+  if (not isnull (root))
+    S := sprintf ('<%s>%s</%s>', root, S, root);
   return S;
 }
 ;
@@ -498,30 +511,30 @@ create procedure OMAIL.WA.omail_attachments_copy(
   in  _msg_id     integer,
   in  _re_msg_id  integer)
 {
-  declare _freetext_id,_part_id,_cnt integer;
+  declare _freetext_id, _part_id integer;
 
   _part_id := coalesce((select MAX(PART_ID) from OMAIL.WA.MSG_PARTS  where   DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id), 0);
-  _cnt := 0;
-
-  for (select DOMAIN_ID V_DOMAIN_ID,USER_ID V_USER_ID,TYPE_ID V_TYPE_ID,CONTENT_ID V_CONTENT_ID,BDATA V_BDATA,DSIZE V_DSIZE,APARAMS V_APARAMS,PDEFAULT V_PDEFAULT,FNAME V_FNAME
+  for (select DOMAIN_ID _DOMAIN_ID,
+              USER_ID _USER_ID,
+              TYPE_ID _TYPE_ID,
+              CONTENT_ID _CONTENT_ID,
+              BDATA _BDATA,
+              DSIZE _DSIZE,
+              APARAMS _APARAMS,
+              PDEFAULT _PDEFAULT,
+              FNAME _FNAME
          from OMAIL.WA.MSG_PARTS
         where DOMAIN_ID = _domain_id
           and USER_ID   = _user_id
           and MSG_ID    = _re_msg_id
-          and PDEFAULT <> 1)
-  do {
-    _freetext_id := sequence_next ('OMAIL.WA.omail_seq_eml_freetext_id');
+          and PDEFAULT <> 1) do
+  {
     _part_id := _part_id + 1;
+    _freetext_id := sequence_next ('OMAIL.WA.omail_seq_eml_freetext_id');
     insert into OMAIL.WA.MSG_PARTS (DOMAIN_ID,USER_ID,MSG_ID,PART_ID,TYPE_ID,CONTENT_ID,BDATA,DSIZE,APARAMS,PDEFAULT,FNAME,FREETEXT_ID)
-      values (V_DOMAIN_ID,V_USER_ID,_msg_id,_part_id,V_TYPE_ID,V_CONTENT_ID,V_BDATA,V_DSIZE,V_APARAMS,V_PDEFAULT,V_FNAME,_freetext_id);
-    _cnt := _cnt + 1;
+      values (_DOMAIN_ID,_USER_ID,_msg_id,_part_id,_TYPE_ID,_CONTENT_ID,_BDATA,_DSIZE,_APARAMS,_PDEFAULT,_FNAME,_freetext_id);
   }
-
-  update OMAIL.WA.MESSAGES
-     set ATTACHED = ATTACHED + _cnt
-   where DOMAIN_ID = _domain_id
-     and USER_ID   = _user_id
-     and MSG_ID    = _msg_id;
+  OMAIL.WA.omail_update_msg_attached (_domain_id, _user_id, _msg_id);
 }
 ;
 
@@ -534,7 +547,7 @@ create procedure OMAIL.WA.omail_box(
 {
   -- www procedure
 
-  declare _rs,_sid,_realm,_bp,_sql_result1,_sql_result2,_faction,_pnames,_ip varchar;
+  declare _rs, _sid, _realm, _bp, _sql_result1, _sql_result2, _sql_result3, _faction, _pnames, _ip varchar;
   declare _order,_direction,_params,_page_params any;
   declare _user_info, _settings any;
   declare _pageSize, _domain_id, _user_id, _folder_id, _msg_id integer;
@@ -589,7 +602,7 @@ create procedure OMAIL.WA.omail_box(
   OMAIL.WA.getOrderDirection (_order, _direction);
 
   -- Check Params for illegal values---------------------------------------------------
-  if (OMAIL.WA.omail_check_folder_id(_domain_id,_user_id, get_keyword ('folder_id',_params)) = 0)
+  if (OMAIL.WA.folder_check_id (_domain_id,_user_id, get_keyword ('folder_id',_params)) = 0)
   {
     -- check FOLDER_ID
     OMAIL.WA.utl_redirect(sprintf('err.vsp?sid=%s&realm=%s&err=%d',_sid,_realm,1100));
@@ -626,30 +639,29 @@ create procedure OMAIL.WA.omail_box(
 
   -- Form Action---------------------------------------------------------------------
   if (_faction = 'move')
-  { -- > 'move msg to folder'
-    _rs := OMAIL.WA.omail_move_msg(_domain_id,_user_id,params);
-    if (_rs = '1')
     {
+    -- > 'move msg to folder'
+    OMAIL.WA.messages_move (_domain_id, _user_id, params);
       _bp := OMAIL.WA.omail_params2str(_pnames,_params,',');
-      OMAIL.WA.utl_redirect_adv(sprintf('box.vsp?sid=%s&realm=%s&bp=%s',_sid,_realm,_bp),params);
-      return;
-    }
-    _bp := OMAIL.WA.omail_params2str(_pnames,_params,',');
+
     OMAIL.WA.utl_redirect_adv(sprintf('box.vsp?sid=%s&realm=%s&bp=%s',_sid,_realm,_bp),params);
     return;
   }
   if (_faction = 'delete')
-  { -- > 'move msg to trash or delete if it's in trash'
-    OMAIL.WA.omail_delete_message(_domain_id,_user_id,params,_params);
+  {
+    -- > 'move msg to trash or delete if it's in trash'
+    OMAIL.WA.messages_delete (_domain_id,_user_id, params);
     _bp := OMAIL.WA.omail_params2str(_pnames,_params,',');
 
     OMAIL.WA.utl_redirect_adv(sprintf('box.vsp?sid=%s&realm=%s&bp=%s',_sid,_realm,_bp),params);
     return;
   }
   if (_faction = 'erase')
-  { -- > 'unconditional delete'
-    OMAIL.WA.omail_del_message(_domain_id,_user_id,cast(get_keyword('ch_msg',params) as integer));
+  {
+    -- > 'unconditional delete'
+    OMAIL.WA.message_erase (_domain_id, _user_id, cast (get_keyword ('ch_msg', params) as integer));
     _bp := OMAIL.WA.omail_params2str(_pnames,_params,',');
+
     OMAIL.WA.utl_redirect_adv(sprintf('box.vsp?sid=%s&realm=%s&bp=%s',_sid,_realm,_bp),params);
     return;
   }
@@ -658,7 +670,7 @@ create procedure OMAIL.WA.omail_box(
   aset(_page_params,0,vector('sid',_sid));
   aset(_page_params,1,vector('realm',_realm));
   aset(_page_params,2,vector('folder_id',get_keyword('folder_id',_params)));
-  aset (_page_params,3,vector ('folder_type', OMAIL.WA.omail_folder_type (_domain_id, _user_id, get_keyword ('folder_id',_params))));
+  aset (_page_params, 3, vector ('folder_type', OMAIL.WA.folder_type (_domain_id, _user_id, get_keyword ('folder_id',_params))));
   aset (_page_params,4,vector ('bp',OMAIL.WA.omail_params2str(_pnames,_params,',')));
   aset (_page_params,5,vector ('user_info', OMAIL.WA.array2xml(_user_info)));
 
@@ -672,8 +684,9 @@ create procedure OMAIL.WA.omail_box(
   OMAIL.WA.omail_set_settings(_domain_id, _user_id, 'base_settings', _settings);
 
   -- SQL Statement-------------------------------------------------------------------
-  _sql_result1 := OMAIL.WA.omail_msg_list(_domain_id,_user_id,_params);
-  _sql_result2 := OMAIL.WA.omail_folders_list (_domain_id, _user_id, vector ());
+  _sql_result1 := OMAIL.WA.messages_list (_domain_id, _user_id, _params);
+  _sql_result2 := OMAIL.WA.folders_list (_domain_id, _user_id);
+  _sql_result3 := OMAIL.WA.folders_combo_list (_domain_id, _user_id, OMAIL.WA.omail_getp ('folder_id', _params));
 
   -- XML structure-------------------------------------------------------------------
   _rs := '';
@@ -681,6 +694,7 @@ create procedure OMAIL.WA.omail_box(
   _rs := sprintf ('%s<groupBy>%d</groupBy>',_rs, get_keyword ('groupBy', _settings));
   _rs := sprintf('%s<messages>%s</messages>' ,_rs,_sql_result1);
   _rs := sprintf('%s%s' ,_rs,_sql_result2);
+  _rs := sprintf ('%s%s', _rs, _sql_result3);
   _rs := sprintf('%s%s' ,_rs,OMAIL.WA.omail_external_params_xml(params));
   _rs := sprintf('%s%s' ,_rs,OMAIL.WA.omail_external_params_lines(params,_params));
 
@@ -725,7 +739,7 @@ create procedure OMAIL.WA.omail_ch_pop3(
   if (get_keyword ('fa_save.x',params,'') <> '')
   {
     -- > save or edit account
-    _error := OMAIL.WA.omail_save_pop3_acc(_domain_id, _user_id, params);
+    _error := OMAIL.WA.external_account_update (_domain_id, _user_id, params);
     if (_error = 0)
     {
       OMAIL.WA.utl_redirect (sprintf ('ch_pop3.vsp?sid=%s&realm=%s', _sid, _realm));
@@ -737,7 +751,7 @@ create procedure OMAIL.WA.omail_ch_pop3(
   if (OMAIL.WA.omail_getp ('action',_params) = 1)
   {
     -- > check now account
-    _error := OMAIL.WA.omail_ch_pop3_acc_now(_domain_id,_user_id,OMAIL.WA.omail_getp('acc_id',_params), _new_msg);
+    _error := OMAIL.WA.external_account_check (OMAIL.WA.omail_getp ('acc_id',_params), _new_msg);
     if (_error = 0)
     {
       OMAIL.WA.utl_redirect(sprintf('ch_pop3.vsp?sid=%s&realm=%s&cp=0,0,%d,%d',_sid,_realm,_new_msg,OMAIL.WA.omail_getp('acc_id',_params)));
@@ -749,7 +763,7 @@ create procedure OMAIL.WA.omail_ch_pop3(
   if (OMAIL.WA.omail_getp ('action',_params) = 2)
   {
     -- > check all acc
-    _error := OMAIL.WA.omail_ch_pop3_acc_all (_domain_id, _user_id);
+    _error := OMAIL.WA.external_account_check_all (_domain_id, _user_id);
     if (_error = 0)
     {
       OMAIL.WA.utl_redirect(sprintf('box.vsp?sid=%s&realm=%s',_sid,_realm));
@@ -760,8 +774,8 @@ create procedure OMAIL.WA.omail_ch_pop3(
   }
   if (OMAIL.WA.omail_getp ('action',_params) = 3)
   {
-    -- > check all acc
-    _error := OMAIL.WA.omail_del_pop3_acc (_domain_id, _user_id, OMAIL.WA.omail_getp ('acc_id',_params));
+    -- > save or edit account
+    _error := OMAIL.WA.external_account_delete (_domain_id, _user_id, _params);
     if (_error = 0)
     {
       OMAIL.WA.utl_redirect(sprintf('ch_pop3.vsp?sid=%s&realm=%s',_sid,_realm));
@@ -777,7 +791,7 @@ create procedure OMAIL.WA.omail_ch_pop3(
   aset(_page_params,2,vector('user_info',OMAIL.WA.array2xml(_user_info)));
 
   -- SQL Statement-------------------------------------------------------------------
-  _sql_result1 := OMAIL.WA.omail_get_pop3_acc (_domain_id, _user_id, OMAIL.WA.omail_getp ('acc_id',_params));
+  _sql_result1 := OMAIL.WA.external_account_get (_domain_id, _user_id, OMAIL.WA.omail_getp ('acc_id',_params));
   _node := case when (OMAIL.WA.omail_getp ('acc_id',_params) = 0) then 'accounts' else 'account' end;
 
   -- XML structure-------------------------------------------------------------------
@@ -795,46 +809,62 @@ create procedure OMAIL.WA.omail_ch_pop3(
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_ch_pop3_acc_schedule ()
+create procedure OMAIL.WA.external_account_info (
+  in    _domain_id integer,
+  in    _user_id integer,
+  in    _source_id integer,
+  inout _server varchar,
+  inout _user varchar,
+  inout _password varchar)
 {
-  declare _new_msg integer;
+  declare _retValue integer;
+
+  _retValue := 0;
+  for (select * from OMAIL.WA.EXTERNAL_ACCOUNT where EA_DOMAIN_ID = _domain_id and EA_USER_ID = _user_id and EA_ID = _source_id and EA_TYPE = 'imap') do
+  {
+    _server := sprintf ('%s:%d', EA_HOST, EA_PORT);
+    _user := EA_USER;
+    _password := pwd_magic_calc ('pop3', EA_PASSWORD);
 
-  for (select DOMAIN_ID, USER_ID, ACC_ID
-         from OMAIL.WA.EXTERNAL_POP_ACC
-        where CH_INTERVAL = 1
-          and (LAST_CHECK is null or LAST_CHECK < dateadd ('day', -1, now()))
+    _retValue := 1;
+  }
+  return _retValue;
+}
+;
 
-        union all
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.external_account_schedule ()
+{
+  declare msg_count integer;
 
-       select DOMAIN_ID, USER_ID, ACC_ID
-         from OMAIL.WA.EXTERNAL_POP_ACC
-        where CH_INTERVAL = 2
-          and (LAST_CHECK is null or LAST_CHECK < dateadd ('hour', -1, now()))
+  for (select EA_ID
+         from OMAIL.WA.EXTERNAL_ACCOUNT
+        where (EA_CHECK_DATE is null or EA_CHECK_DATE < dateadd (case when EA_CHECK_INTERVAL = 1 then 'day' else 'hour' end, -1, now()))
       ) do
   {
-    OMAIL.WA.omail_ch_pop3_acc_now (DOMAIN_ID, USER_ID, ACC_ID, _new_msg);
+    OMAIL.WA.external_account_check (EA_ID, msg_count);
   }
-  return 0;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_ch_pop3_acc_all(
-  in _domain_id integer,
-  in _user_id integer)
+create procedure OMAIL.WA.external_account_check_all (
+  in domain_id integer,
+  in user_id integer)
 {
-  declare _new_msg integer;
+  declare msg_count integer;
 
     -- check all accounts
-  for (select ACC_ID
-         from OMAIL.WA.EXTERNAL_POP_ACC
-          where DOMAIN_ID = _domain_id
-            and USER_ID = _user_id
-          and LAST_CHECK < dateadd ('minute', -1, now())
+  for (select EA_ID
+         from OMAIL.WA.EXTERNAL_ACCOUNT
+        where EA_DOMAIN_ID = domain_id
+          and EA_USER_ID = user_id
+          and EA_CHECK_DATE < dateadd ('minute', -1, now())
       ) do
   {
-      OMAIL.WA.omail_ch_pop3_acc_now(_domain_id,_user_id,ACC_ID,_new_msg);
+    OMAIL.WA.external_account_check (EA_ID, msg_count);
   }
   return 0;
 }
@@ -842,485 +872,1032 @@ create procedure OMAIL.WA.omail_ch_pop3_acc_all(
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_ch_pop3_acc_now(
-  in _domain_id integer,
-  in _user_id   integer,
-  in _acc_id    integer,
-  out _new_msg  integer)
+create procedure OMAIL.WA.external_account_check (
+  in id integer,
+  out msg_count integer)
 {
-  declare _messages,_mlist any;
-  declare N,_check,_buffer integer;
+  declare _error, _checked, _folders, _folderNames, _folderParts, _folderDelimiter, _folderId, _folderParentId, _folderName, _folderPath any;
+  declare _msgId, _messages, _mlist any;
+  declare N, M, _server, _connectType, _password, _check, _buffer integer;
 
   DECLARE EXIT HANDLER FOR SQLSTATE '2E000'
   {
     -- bad_server:
-    OMAIL.WA.omail_ch_pop3_acc_update(_domain_id, _user_id, _acc_id, 1);
+    OMAIL.WA.external_account_check_set (id, 1);
     return 1811;
   };
   DECLARE EXIT HANDLER FOR SQLSTATE '08006'
   {
     -- bad_user:
-    OMAIL.WA.omail_ch_pop3_acc_update(_domain_id, _user_id, _acc_id, 2);
+    OMAIL.WA.external_account_check_set (id, 2);
     return 1812;
   };
   DECLARE EXIT HANDLER FOR SQLSTATE '08001'
   {
     -- Cannot connect in pop3_get
-    OMAIL.WA.omail_ch_pop3_acc_update(_domain_id, _user_id, _acc_id, 3);
+    OMAIL.WA.external_account_check_set (id, 3);
     return 1813;
   };
+  DECLARE EXIT HANDLER FOR SQLSTATE '*'
+  {
+    --dbg_obj_print ('', __SQL_STATE, __SQL_MESSAGE);
+    ;
+  };
 
   commit work;
-
-  for (select *
-         from OMAIL.WA.EXTERNAL_POP_ACC
-        where DOMAIN_ID = _domain_id
-          and USER_ID = _user_id
-          and ACC_ID = _acc_id
-      ) do
+  for (select * from OMAIL.WA.EXTERNAL_ACCOUNT where EA_ID = id) do
   {
-    -- POP3 parameters ---------------------------------------------------------
-    POP_SERVER := concat(POP_SERVER,':', cast(POP_PORT as varchar));
-    USER_PASS  := pwd_magic_calc ('pop3',USER_PASS);
+    -- server parameters ---------------------------------------------------------
+    _server := sprintf ('%s:%d', EA_HOST, EA_PORT);
+    _connectType := case when EA_CONNECT_TYPE = 'ssl' then 1 else 0 end;
+    _password := pwd_magic_calc ('pop3', EA_PASSWORD);
     _buffer    := 10000000;
     _mlist     := vector();
 
-    -- get list with unique msg ids from server --------------------------------
-    _messages := pop3_get (POP_SERVER, USER_NAME, USER_PASS, 10000000, 'UIDL');
+    if (EA_TYPE = 'pop3')
+    {
+      -- get list with unique msg ids from server
+      _messages := pop3_get (_server, EA_USER, _password, _buffer, 'UIDL', null, _connectType);
 
-    -- check for duplicate messages --------------------------------------------
+      -- check for duplicate messages
     for (N := 0; N < length (_messages); N := N + 1)
     {
-      if (exists (select 1 from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_SOURCE = ACC_ID and UNIQ_MSG_ID = _messages[N]))
+        if (exists (select 1 from OMAIL.WA.MESSAGES where DOMAIN_ID = EA_DOMAIN_ID and USER_ID = EA_USER_ID and MSG_SOURCE = EA_ID and UNIQ_MSG_ID = _messages[N]))
         _mlist := vector_concat (_mlist, vector (_messages[N]));
     }
+      _messages := pop3_get (_server, EA_USER, _password, _buffer, either (equ (EA_MCOPY, 0), 'DELETE', ''), _mlist, _connectType);
 
-    _messages := pop3_get (POP_SERVER, USER_NAME, USER_PASS, _buffer, either(equ(MCOPY,0),'DELETE',''), _mlist);
-
-    -- insert message into DB --------------------------------------------------
+      -- insert messages
+      msg_count := length (_messages);
     for (N := 0; N < length (_messages); N := N + 1)
     {
-      OMAIL.WA.omail_receive_message (_domain_id, _user_id, null, _messages[N][1], subseq (_messages[N][0], 0, 100), ACC_ID, FOLDER_ID);
+        OMAIL.WA.omail_receive_message (EA_DOMAIN_ID, EA_USER_ID, null, _messages[N][1], subseq (_messages[N][0], 0, 100), EA_ID, EA_FOLDER_ID);
+      }
+    }
+    if (EA_TYPE = 'imap')
+    {
+      declare X integer;
+      declare X2 string;
+
+      X2 := '';
+
+      -- check authentication
+      imap_get (_server, EA_USER, _password, _buffer);
+
+      -- load folders
+      msg_count := 0;
+      _folders := imap_get (_server, EA_USER, _password, _buffer, 'list', '*');
+      if (length (_folders))
+      {
+        _checked := vector ();
+        foreach (any _folder in _folders) do
+        {
+          _folderParts := regexp_parse('\\((.*)\\)\\s\\"(.*)\\"\\s\\"(.*)\\"', _folder, 0);
+          if (length (_folderParts) = 8)
+          {
+            _error := 0;
+            _folderPath := '';
+            _folderParentId := EA_FOLDER_ID;
+            _folderDelimiter := subseq (_folder, _folderParts[4], _folderParts[5]);
+            _folderName := subseq (_folder, _folderParts[6], _folderParts[7]);
+            _folderParts := split_and_decode (_folderName, 0, '\0\0' || _folderDelimiter);
+            for (M := 0; M < length (_folderParts); M := M + 1)
+            {
+              _folderPath := trim (_folderPath || _folderDelimiter || _folderParts[M], _folderDelimiter);
+              _folderId := OMAIL.WA.folder_name_exists (EA_DOMAIN_ID, EA_USER_ID, _folderParentId, _folderParts[M]);
+              if (_folderId = 0)
+              {
+                _folderId := OMAIL.WA.folder_create (EA_DOMAIN_ID, EA_USER_ID, vector ('parent_id', _folderParentId, 'name', _folderParts[M], 'data', _folderPath, 'source', EA_ID), _error);
+                if (_error <> 0)
+                  goto _exit;
+              }
+              _folderParentId := _folderId;
+            }
+            if ((_folderPath = _folderName) and not OMAIL.WA.vector_contains (_checked, _folderName))
+            {
+              _checked := vector_concat (_checked, vector (_folderName));
+              _messages := imap_get (_server, EA_USER, _password, _buffer, 'select', _folderName);
+              -- dbg_obj_print ('', _folderName, length (_messages));
+              foreach (any _message in _messages) do
+              {
+                _msgId := (select MSG_ID from OMAIL.WA.MESSAGES where DOMAIN_ID = EA_DOMAIN_ID and USER_ID = EA_USER_ID and MSG_SOURCE = EA_ID and UNIQ_MSG_ID = _message[0]);
+                if (isnull (_msgId))
+                {
+                  -- if (X < 1)
+                  -- {
+                  --   declare tmp any;
+                  --
+                  --   tmp :=  mime_tree(_message[2]);
+                  --   if (not (isarray(tmp)))
+                  --   {
+                  --     X2 := X2 || _message[2] || '\n\n--------------------------\n\n';
+                  --     X := X + 1;
+                  --     dbg_obj_print ('', mime_header(_message[2]));
+                  --   }
+                  -- }
+
+                  if (OMAIL.WA.omail_receive_message (EA_DOMAIN_ID, EA_USER_ID, null, _message[2], _message[0], EA_ID, _folderId, 1))
+                    msg_count := msg_count + 1;
+                }
+                else
+                {
+                  OMAIL.WA.message_move (EA_DOMAIN_ID, EA_USER_ID, _msgId, _folderId, 0);
+                }
+              }
+            }
+          _exit:;
+          }
+        }
+        for (select FOLDER_ID, DATA from OMAIL.WA.FOLDERS where DOMAIN_ID = EA_DOMAIN_ID and USER_ID = EA_USER_ID and F_SOURCE = EA_ID) do
+        {
+          if (not is_empty_or_null (DATA) and not OMAIL.WA.vector_contains (_checked, DATA))
+          {
+            OMAIL.WA.folder_erase (EA_DOMAIN_ID, EA_USER_ID, FOLDER_ID, 0);
+          }
+        }
+      }
+      -- string_to_file (sprintf('bad-imap-mail%d.dmp', id), X2, 0);
     }
-    -- count new messages ------------------------------------------------------
-    _new_msg := length(_messages);
 
     -- set flag for successful download ----------------------------------------
-    OMAIL.WA.omail_ch_pop3_acc_update(_domain_id, _user_id, _acc_id, 0);
+    OMAIL.WA.external_account_check_set (id, 0);
   }
   return 0;
 }
 ;
 
-create procedure OMAIL.WA.omail_ch_pop3_acc_update(
-  in _domain_id  integer,
-  in _user_id    integer,
-  in _acc_id     integer,
-  in _error      integer)
+create procedure OMAIL.WA.external_account_check_set (
+  in id integer,
+  in error integer)
 {
-  update OMAIL.WA.EXTERNAL_POP_ACC
-     set LAST_CHECK = now(),
-         CH_ERROR   = _error
-   where DOMAIN_ID  = _domain_id
-     and USER_ID    = _user_id
-     and ACC_ID     = _acc_id;
+  update OMAIL.WA.EXTERNAL_ACCOUNT
+     set EA_CHECK_DATE = now(),
+         EA_CHECK_ERROR = error
+   where EA_ID = id;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_check_folder_id(
+create procedure OMAIL.WA.external_account_update (
   in _domain_id  integer,
   in _user_id    integer,
-  in _folder_id  integer)
+  inout _params any)
 {
-  return coalesce ((select 1 from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id), 0);
+  declare _id, _check_interval, _mcopy, _folder_id, _error, _port integer;
+  declare _name, _type, _host, _connect_type, _user, _password, _folder_name varchar;
+
+  _id             := cast (get_keyword ('id', _params, 0) as integer);
+  _name           := trim (get_keyword ('name', _params));
+  _type           := trim (get_keyword ('type', _params, 'pop3'));
+  _host           := trim (get_keyword ('host', _params));
+  _port           := cast (get_keyword ('port', _params, case when _type = 'pop3' then 110 else 143 end) as integer);
+  _connect_type   := trim (get_keyword ('connect_type', _params, 'none'));
+  _user           := trim (get_keyword ('user', _params,''));
+  _password       := trim (get_keyword ('password', _params));
+  _check_interval := cast (get_keyword ('check_interval', _params, 2) as integer);
+  _mcopy          := cast (get_keyword ('mcopy', _params, 1) as integer);
+  _folder_id      := cast (get_keyword ('folder_id', _params, case when _type = 'pop3' then 100 else 0 end) as integer);
+  _folder_name    := trim (get_keyword ('folder_name', _params));
+
+  OMAIL.WA.test (_name, vector ('name', 'Account Name', 'class', 'varchar', 'canEmpty', 0));
+  OMAIL.WA.test (_host, vector ('name', 'Server Address', 'class', 'varchar', 'canEmpty', 0));
+  OMAIL.WA.test (_user, vector ('name', 'User Name', 'class', 'varchar', 'canEmpty', 0));
+  OMAIL.WA.test (_folder_name, vector ('name', 'Folder Name', 'class', 'folder', 'canEmpty', case when _type = 'pop3' or _id <> 0 then 1 else 0 end, 'minLength', 1, 'maxLength', 20));
+  if (length (_folder_name))
+  {
+    declare _folderParams any;
+
+    _folderParams := vector ('parent_id', _folder_id, 'name', _folder_name);
+    if (_type = 'imap')
+      _folderParams := vector_concat (_folderParams, vector ('systemFlag', 'S'));
+    if (_type = 'imap')
+      _folderParams := vector_concat (_folderParams, vector ('seqNo', 10));
+
+    _folder_id := OMAIL.WA.folder_create (_domain_id, _user_id, _folderParams, _error);
+    if (_error <> 0)
+      return _error;
 }
-;
+  OMAIL.WA.test (_folder_id, vector ('name', 'Folder', 'class', 'integer', 'canEmpty', case when _id <> 0 then 0 else 1 end));
 
--------------------------------------------------------------------------------
---
-create procedure OMAIL.WA.omail_check_folder_name(
-  in _domain_id   integer,
-  in _user_id     integer,
-  in _parent_id   integer,
-  in _folder_name varchar,
-  in _folder_id   integer := 0)
+  if (_id <> 0)
 {
-  declare retValue integer;
+    update OMAIL.WA.EXTERNAL_ACCOUNT
+       set EA_NAME = _name,
+           EA_TYPE = _type,
+           EA_HOST = _host,
+           EA_PORT = _port,
+           EA_CONNECT_TYPE = _connect_type,
+           EA_USER = _user,
+           EA_FOLDER_ID = _folder_id,
+           EA_CHECK_INTERVAL = _check_interval,
+           EA_MCOPY = _mcopy
+     where EA_DOMAIN_ID = _domain_id
+       and EA_USER_ID = _user_id
+       and EA_ID = _id;
 
-  retValue := coalesce((select FOLDER_ID from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = _parent_id and NAME = _folder_name), 0);
-  if (_folder_id = 0)
-    return retValue;
-  if (retValue = 0)
-    return retValue;
-  if (retValue <> _folder_id)
-    return 1;
-  return 0;
+    if (_password <> '**********')
+    {
+      update OMAIL.WA.EXTERNAL_ACCOUNT
+         set EA_PASSWORD = pwd_magic_calc ('pop3', _password)
+       where EA_DOMAIN_ID = _domain_id
+         and EA_USER_ID = _user_id
+         and EA_ID = _id;
 }
-;
-
--------------------------------------------------------------------------------
---
-create procedure OMAIL.WA.omail_folder_isTrash(
-  in  _domain_id integer,
-  in  _user_id   integer,
-  in  _folder_id integer,
-  out _error     integer)
+  }
+  else
 {
-  declare _parent_loc integer;
-  _error := 0;
-  whenever not found goto err_exit;
-  if (_folder_id = 110)
-    return -1;
+    insert into OMAIL.WA.EXTERNAL_ACCOUNT (EA_DOMAIN_ID, EA_USER_ID, EA_NAME, EA_TYPE, EA_HOST, EA_PORT, EA_CONNECT_TYPE, EA_USER, EA_PASSWORD, EA_FOLDER_ID, EA_CHECK_INTERVAL, EA_MCOPY, EA_CHECK_ERROR)
+      values (_domain_id, _user_id, _name, _type, _host, _port, _connect_type, _user, pwd_magic_calc ('pop3', _password), _folder_id, _check_interval, _mcopy, 0);
 
-  select PARENT_ID into _parent_loc from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id;
+    _id := (select EA_ID from OMAIL.WA.EXTERNAL_ACCOUNT where EA_DOMAIN_ID = _domain_id and EA_USER_ID = _user_id and EA_NAME = _name);
+  }
+  if (_type = 'imap')
+    update OMAIL.WA.FOLDERS set F_SOURCE = _id where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id;
 
-  if (_parent_loc = 110)
-    return -1;
-  if (_parent_loc is null)
     return 0;
-  return OMAIL.WA.omail_folder_isTrash(_domain_id,_user_id,_parent_loc,_error);
-
-err_exit:
-  _error := 1602;
-  return;
 }
 ;
 
+
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_folder_isSmart(
+create procedure OMAIL.WA.external_account_delete (
   in  _domain_id integer,
   in  _user_id   integer,
-  in  _folder_id integer)
+  inout _params any)
 {
-  if ((select SMART_FLAG from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id) = 'S')
-    return 1;
+  declare _id, _path any;
+
+  _id := OMAIL.WA.omail_getp ('acc_id', _params);
+  for (select * from OMAIL.WA.EXTERNAL_ACCOUNT where EA_DOMAIN_ID = _domain_id and EA_USER_ID = _user_id and EA_ID = _id and EA_TYPE = 'imap') do
+  {
+    _path := (select PATH from OMAIl.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = EA_FOLDER_ID and F_SOURCE = _id);
+    if (not isnull (_path))
+    {
+      for (select FOLDER_ID from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and F_SOURCE = _id and PATH like _path || '%' order by PATH desc) do
+      {
+        OMAIL.WA.folder_erase (_domain_id, _user_id, FOLDER_ID, 0);
+      }
+    }
+  }
+  delete
+    from OMAIL.WA.EXTERNAL_ACCOUNT
+   where EA_DOMAIN_ID = _domain_id
+     and EA_USER_ID = _user_id
+     and EA_ID = _id;
+
   return 0;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_folder_isSystem(
+create procedure OMAIL.WA.folders_list (
   in  _domain_id integer,
-  in  _user_id   integer,
-  in  _folder_id integer)
+  in _user_id integer)
 {
-  if ((select SYSTEM_FLAG from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id) = 'S')
-    return 1;
-  return 0;
+  return sprintf ('<folders>\n%s\n</folders>', OMAIL.WA.folders_list_work (_domain_id, _user_id));
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_folder_type (
+create procedure OMAIL.WA.folders_combo_list (
   in  _domain_id integer,
   in  _user_id   integer,
-  in  _folder_id integer)
+  in _folder_id any := null)
 {
-  if (OMAIL.WA.omail_folder_isSmart (_domain_id, _user_id, _folder_id))
-    return 'R';
-  if (_folder_id in (100, 110, 125))
-    return 'R';
-  return 'S';
+  declare _start_id, _source, _path any;
+
+  OMAIL.WA.imap_folder_info (_domain_id, _user_id, _folder_id, _start_id, _source, _path);
+  return sprintf ('<foldersCombo>\n%s\n</foldersCombo>', OMAIL.WA.folders_list_work (_domain_id, _user_id, _start_id, _source));
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_check_parent(
+create procedure OMAIL.WA.folders_list_work (
   in _domain_id integer,
   in _user_id   integer,
-  in _folder_id  integer,
-  in _parent_id integer)
+  in _folder_id  integer := 0,
+  in _source     integer := null,
+  in _level      integer := 0,
+  in _ftree      varchar := '')
 {
-  declare _parent_loc integer;
-  WHENEVER NOT FOUND GOTO ERR_EXIT;
-
-  if (_parent_id is null)
-    return 0;
+  declare _rs,_s,_ftree_loc varchar;
+  declare _all_cnt,_new_cnt,N,_len,_all_size integer;
 
-  select PARENT_ID
-    INTO _parent_loc
-    from OMAIL.WA.FOLDERS
-   where DOMAIN_ID = _domain_id
-     and USER_ID = _user_id
-     and FOLDER_ID = _parent_id;
+  N := 0;
+  _rs := '';
+  _len := (select COUNT(*) from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = _folder_id and (coalesce(F_SOURCE, 0) = _source or isnull (_source)));
+  for (select * from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = _folder_id and (coalesce(F_SOURCE, 0) = _source or isnull (_source)) order by SEQ_NO, NAME) do
+  {
+    OMAIL.WA.messages_count(_domain_id, _user_id, FOLDER_ID, _all_cnt, _new_cnt, _all_size);
+    if (length (_ftree) > 0)
+      _ftree := concat(substring(_ftree,1,(length (_ftree)-16)),replace (substring(_ftree,length (_ftree)-15,16),'<fnode>-</fnode>','<fnode>.</fnode>'));
 
-  if ((_parent_loc = _folder_id) or (_parent_id = _folder_id))
-    return 1401;
-  if (_parent_loc is null)
-    return 0;
-  return OMAIL.WA.omail_check_parent(_domain_id,_user_id,_folder_id,_parent_loc);
+    _ftree := replace (_ftree, 'F', 'I');
+    _ftree_loc := sprintf ('%s<fnode>%s</fnode>', _ftree, case when (N + 1 = _len) then '-' else 'F' end);
 
-ERR_EXIT:
-  return 1402;
+    _rs := sprintf ('%s<folder id="%d" systemFlag="%s" smartFlag="%s" source="%d">\n', _rs, FOLDER_ID, SYSTEM_FLAG, SMART_FLAG, coalesce(F_SOURCE, 0));
+    _rs := sprintf ('%s<name>%V</name>\n', _rs, NAME);
+    _rs := sprintf ('%s<level str="%s" num="%d" />\n', _rs, repeat('~',_level),_level);
+    _rs := sprintf ('%s<ftree>%s</ftree>\n', _rs, _ftree_loc);
+    _rs := sprintf ('%s<all_cnt>%d</all_cnt>\n', _rs ,_all_cnt);
+    _rs := sprintf ('%s<all_size>%d</all_size>\n', _rs, _all_size);
+    _rs := sprintf ('%s<new_cnt>%d</new_cnt>\n', _rs, _new_cnt);
+    _s  := OMAIL.WA.folders_list_work (_domain_id, _user_id, FOLDER_ID, _source, _level+1, _ftree_loc);
+    if (_s <> '')
+      _rs := sprintf ('%s<folders>\n%s\n</folders>\n', _rs, _s);
+    _rs := sprintf ('%s</folder>\n', _rs);
+    N := N + 1;
+  }
+  return _rs;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_check_interval(
-  in _value  any,
-  in _lt integer,
-  in _gt integer)
+create procedure OMAIL.WA.folder_test (
+  in  _params any)
 {
-  declare exit handler for SQLSTATE '*' {return 0;};
+  declare tmp, tmp2 any;
 
-  _value := cast(_value as integer);
-  if ((_value >= _lt) and (_value <= _gt))
-    return 1;
-  return 0;
+  if (isnull (_params))
+    return;
+
+  tmp := get_keyword ('q_after', _params);
+  OMAIL.WA.test (tmp, vector ('name', 'Received after', 'type', 'date', 'canEmpty', 1));
+  tmp := get_keyword ('q_before', _params);
+  OMAIL.WA.test (tmp, vector ('name', 'Received before', 'type', 'date', 'canEmpty', 1));
+  tmp := get_keyword ('q_from', _params);
+  if ((tmp <> '') and is_empty_or_null (OMAIL.WA.email_search_str (tmp)))
+    signal ('TEST', 'Field ''From'' contains invalid characters!<>');
+  tmp := get_keyword ('q_to', _params);
+  if ((tmp <> '') and is_empty_or_null (OMAIL.WA.email_search_str (tmp)))
+    signal ('TEST', 'Field ''To'' contains invalid characters!<>');
+  tmp := get_keyword ('q_body', _params);
+  if (tmp <> '')
+  {
+    OMAIL.WA.test (tmp, vector ('name', 'Body', 'class', 'free-text'));
+    if (is_empty_or_null (FTI_MAKE_SEARCH_STRING (tmp)) and (tmp <> ''))
+      signal ('TEST', 'Field ''Body'' contains invalid characters!<>');
+  }
+  tmp := get_keyword ('q_tags', _params);
+  OMAIL.WA.test (tmp, vector ('name', 'Tags', 'class', 'tags', 'message', 'One of the tags is too short or contains bad characters or is a noise word!'));
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_cnt_message(
+create procedure OMAIL.WA.folder_name (
   in  _domain_id integer,
   in  _user_id   integer,
-  in  _folder_id integer,
-  out _all_cnt  integer,
-  out _new_cnt  integer,
-  out _all_size integer )
+  in _folder_id integer)
 {
-  select COUNT(*),
-         SUM(either(MSTATUS,0,1)),
-         SUM(DSIZE)
-    INTO _all_cnt,_new_cnt,_all_size
-    from OMAIL.WA.MESSAGES
-   where PARENT_ID IS NULL
-     and DOMAIN_ID = _domain_id
-     and USER_ID   = _user_id
-     and FOLDER_ID = _folder_id;
-
-  _new_cnt  := either(isnull(_new_cnt),0,_new_cnt);
-  _all_size := either(isnull(_all_size),0,_all_size);
+  return coalesce((select NAME from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id), '');
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_cnt_msg(
-  in _mstatus varchar,
-  in _status varchar,
-  in _value integer) returns integer
+create procedure OMAIL.WA.folder_create (
+  in  _domain_id integer,
+  in  _user_id integer,
+  in  _params any,
+  out _error integer)
 {
-  if (_mstatus = _status)
-    return _value;
-  return 0;
+  return OMAIL.WA.folder_edit (_domain_id, _user_id, 0, 0, _params, _error);
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_construct_mail(
-  inout path any,
-  inout lines any,
-  inout params any)
+create procedure OMAIL.WA.folder_create_path (
+  in  _domain_id integer,
+  in  _user_id integer,
+  in  _path varchar,
+  in  _delimiter varchar,
+  in  _params any,
+  out _error integer)
 {
-  -- www procedure
-
-  declare _sql_result1,_sql_result2,_xslt_url,_rs,_boundary any;
-  declare _user_id,_msg_id integer;
-  _rs := '';
-  _user_id := 1001;
-  _msg_id  := 1009;
-
-  _xslt_url := OMAIL.WA.omail_xslt_full('construct_mail.xsl');
+  declare M, _folder_id, _parent_id integer;
+  declare _parts any;
 
-  _sql_result1 := sprintf('%s',OMAIL.WA.omail_open_message(_user_id,vector('msg_id',_msg_id),1,1));
-  _sql_result2 := sprintf('%s',OMAIL.WA.omail_select_attachment(_user_id,_msg_id,1));
-  _boundary := sprintf('------_NextPart_%s',md5(cast(now() as varchar)));
-
-  -- XML structure-------------------------------------------------------------------
-  _rs := sprintf('%s<message>', _rs);
-  _rs := sprintf('%s<boundary>%s</boundary>', _rs,_boundary);
-  _rs := sprintf('%s%s',_rs,_sql_result1);
-  _rs := sprintf('%s%s',_rs,_sql_result2);
-  _rs := sprintf('%s</message>', _rs);
-
-  -- XSL Transformation--------------------------------------------------------------
-
-  declare _view varchar;
-  _view := get_keyword('vv',params,'h');
-  OMAIL.WA.utl_myhttp (_view, _rs, _xslt_url, null, null, null);
-  return;
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure OMAIL.WA.omail_convert_date (IN atime  datetime ){
-
-  declare result,d,e,h,m,y varchar;
-  declare m_time datetime;
-
-  m_time := atime;
-
-  d := either(lt(cast(dayofmonth(m_time) as integer),10),sprintf('%d%d',0,dayofmonth(m_time)),cast(dayofmonth(m_time)as varchar));
-  m := either(lt(cast(month(m_time)      as integer),10),sprintf('%d%d',0,month(m_time)) ,cast(month(m_time)as varchar));
-  h := either(lt(cast(hour(m_time)       as integer),10),sprintf('%d%d',0,hour(m_time)) ,cast(hour(m_time)as varchar));
-  e := either(lt(cast(minute(m_time)     as integer),10),sprintf('%d%d',0,minute(m_time)) ,cast(minute(m_time)as varchar));
-  y := cast(year(m_time)as varchar);
-
-  result := sprintf('%s:%s %s.%s.%s',h,e,m,d,y);
-
-  RETURN result;
+  _folder_id := 0;
+  _parent_id := 0;
+  _parts := split_and_decode (_path, 0, '\0\0' || _delimiter);
+  for (M := 0; M < length (_parts); M := M + 1)
+  {
+    _folder_id := OMAIL.WA.folder_name_exists (_domain_id, _user_id, _parent_id, _parts[M]);
+    if (_folder_id = 0)
+      _folder_id := OMAIL.WA.folder_create (_domain_id, _user_id, vector_concat (_params, vector ('parent_id', _parent_id, 'name', _parts[M])), _error);
+    if (_error <> 0)
+      return 0;
+    _parent_id := _folder_id;
+  }
+  return _folder_id;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_convert_date_split (in atime  datetime ){
-  declare _rs,d,e,h,m,y,s,w varchar;
-  declare m_time datetime;
-
-  m_time := atime;
-  if (isnull(atime)) return '';
-
-  h := either(lt(cast(hour(m_time) as integer),10),sprintf('%d%d',0,hour(m_time)),cast(hour(m_time)as varchar));
-  e := either(lt(cast(minute(m_time) as integer),10),sprintf('%d%d',0,minute(m_time)),cast(minute(m_time)as varchar));
-  s := either(lt(cast(second(m_time) as integer),10),sprintf('%d%d',0,second (m_time)),cast(second(m_time)as varchar));
-  d := either(lt(cast(dayofmonth(m_time) as integer),10),sprintf('%d%d',0,dayofmonth(m_time)),cast(dayofmonth(m_time)as varchar));
-  m := either(lt(cast(month(m_time) as integer),10),sprintf('%d%d',0,month(m_time)),cast(month(m_time)as varchar));
-  w := cast(dayofweek(m_time) as varchar);
-  y := cast(year(m_time)as varchar);
+create procedure OMAIL.WA.folder_edit (
+  in  _domain_id integer,
+  in  _user_id integer,
+  in  _folder_id integer,
+  in  _action_id integer,
+  in  _params any,
+  out _error integer)
+{
+  declare N, _trash_id, _parent_id integer;
+  declare _folder_name, _folder_name2 varchar;
+  declare _data, _smartFlag any;
 
-  _rs := '';
-  --_rs := sprintf('<ddate>');
-  _rs := sprintf('%s<hour>%s</hour>',_rs,h);
-  _rs := sprintf('%s<minute>%s</minute>',_rs,e);
-  _rs := sprintf('%s<second>%s</second>',_rs,s);
-  _rs := sprintf('%s<day>%s</day>',_rs,d);
-  _rs := sprintf('%s<wday>%s</wday>',_rs,w);
-  _rs := sprintf('%s<month>%s</month>',_rs,m);
-  _rs := sprintf('%s<year>%s</year>',_rs,y);
-  --_rs := sprintf('%s</ddate>',_rs);
-
-  RETURN _rs;
+  _error := 0;
+  if (_action_id = 0)
+  {
+    -- edit folder
+    _parent_id := get_keyword ('parent_id', _params);
+    _folder_name := get_keyword ('name', _params);
+    if (length (_folder_name) > 20)
+    {
+      _error := 1201;
+    }
+    else if (length (_folder_name) < 1)
+    {
+      _error := 1202;
+    }
+    else if (OMAIL.WA.folder_name_exists (_domain_id, _user_id, _parent_id, _folder_name, _folder_id))
+    {
+      _error := 1203;
+    }
+    else
+    {
+      _data := get_keyword ('data', _params);
+      _smartFlag := get_keyword ('smartFlag', _params, 'N');
+      if (_smartFlag = 'S')
+      {
+        OMAIL.WA.folder_test (_data);
+        _data := serialize (_data);
+      }
+      if (_folder_id = 0)
+      {
+        _folder_id := sequence_next('OMAIL.WA.omail_seq_eml_folder_id');
+        insert into OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, SYSTEM_FLAG, SMART_FLAG, SEQ_NO, NAME, DATA, F_SOURCE)
+          values (_domain_id, _user_id, _folder_id, _parent_id, get_keyword ('systemFlag', _params, 'N'), _smartFlag, get_keyword ('seqNo', _params, 0), _folder_name, _data, get_keyword ('source', _params));
+      }
+      else
+      {
+        _error := OMAIL.WA.folder_check_parent (_domain_id, _user_id, _folder_id, _parent_id);
+        if (_error = 0)
+        {
+          update OMAIL.WA.FOLDERS
+             set PARENT_ID = _parent_id,
+                 NAME      = _folder_name,
+                 DATA      = _data
+           where DOMAIN_ID = _domain_id
+             and USER_ID   = _user_id
+             and FOLDER_ID = _folder_id;
+        }
+      }
+      return _folder_id;
+    }
+  }
+  else if (_action_id = 1)
+  {
+    -- delete (move) folder
+    OMAIL.WA.folder_delete (_domain_id, _user_id, _folder_id);
+  }
+  else if (_action_id = 2)
+  {
+    -- empty folder
+    for (select MSG_ID from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id) do
+      OMAIL.WA.message_delete (_domain_id, _user_id, MSG_ID);
+  }
 }
 ;
 
------------------------------------------------------------------------------
+-------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_dav_api_params(
-  inout userInfo any,
-  out vspx_user varchar,
-  out vspx_pwd varchar)
+create procedure OMAIL.WA.folder_delete (
+  in _domain_id integer,
+  in _user_id integer,
+  in _folder_id integer,
+  in _full_mode integer := 1)
 {
-  declare vspx_uid integer;
+  if (OMAIL.WA.folder_isSystem (_domain_id, _user_id, _folder_id))
+    return;
 
-  vspx_uid := get_keyword('user_id', userInfo);
-  vspx_user := coalesce((select U_NAME from WS.WS.SYS_DAV_USER where U_ID = vspx_uid), '');
-  vspx_pwd := coalesce((select U_PWD from WS.WS.SYS_DAV_USER where U_ID = vspx_uid), '');
-  if (vspx_pwd[0] = 0)
-    vspx_pwd := pwd_magic_calc(vspx_user, vspx_pwd, 1);
+  if (OMAIL.WA.folder_isSmart(_domain_id, _user_id, _folder_id))
+    return OMAIL.WA.folder_erase (_domain_id, _user_id, _folder_id, _full_mode);
+
+  if (OMAIL.WA.folder_isErasable (_domain_id, _user_id, _folder_id))
+    return OMAIL.WA.folder_erase (_domain_id, _user_id, _folder_id, _full_mode);
+
+  -- move to trash
+  return OMAIL.WA.folder_move (_domain_id, _user_id, _folder_id, OMAIL.WA.folder_trash (_domain_id, _user_id, _folder_id));
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_date2xml (in atime  time ){
-  declare _rs,d,e,h,m,y,s,w varchar;
-  declare m_time TIME;
+create procedure OMAIL.WA.folder_erase (
+  in _domain_id integer,
+  in _user_id integer,
+  in _folder_id integer,
+  in _full_mode integer := 1)
+{
+  declare _parent_id integer;
+
+  for (select MSG_ID from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id) do
+  {
+    if (not OMAIL.WA.message_erase (_domain_id, _user_id, MSG_ID, _full_mode))
+      return 0;
+  }
+  for (select FOLDER_ID from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = _folder_id) do
+  {
+    if (not OMAIL.WA.folder_erase (_domain_id, _user_id, FOLDER_ID, _full_mode))
+      return 0;
+  }
 
-  m_time := atime;
-  if (isnull(atime)) return '';
+  _parent_id := (select PARENT_ID from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id);
+  if (not is_empty_or_null (_parent_id))
+  {
+    update OMAIL.WA.EXTERNAL_ACCOUNT
+       set EA_FOLDER_ID = _parent_id
+     where EA_DOMAIN_ID = _domain_id
+       and EA_USER_ID   = _user_id
+       and EA_FOLDER_ID = _folder_id;
+  }
 
-  h := either(lt(cast(hour(m_time) as integer),10),sprintf('%d%d',0,hour(m_time)),cast(hour(m_time)as varchar));
-  e := either(lt(cast(minute(m_time) as integer),10),sprintf('%d%d',0,minute(m_time)),cast(minute(m_time)as varchar));
-  s := either(lt(cast(second(m_time) as integer),10),sprintf('%d%d',0,second (m_time)),cast(second(m_time)as varchar));
-  d := either(lt(cast(dayofmonth(m_time) as integer),10),sprintf('%d%d',0,dayofmonth(m_time)),cast(dayofmonth(m_time)as varchar));
-  m := either(lt(cast(month(m_time) as integer),10),sprintf('%d%d',0,month(m_time)),cast(month(m_time)as varchar));
-  w := cast(dayofweek(m_time) as varchar);
-  y := cast(year(m_time)as varchar);
+  if (_full_mode and not OMAIL.WA.imap_folder_erase (_domain_id, _user_id, _folder_id))
+    return 0;
 
-  _rs := '';
-  --_rs := sprintf('<ddate>');
-  _rs := sprintf('%s<hour>%s</hour>',_rs,h);
-  _rs := sprintf('%s<minute>%s</minute>',_rs,e);
-  _rs := sprintf('%s<second>%s</second>',_rs,s);
-  _rs := sprintf('%s<day>%s</day>',_rs,d);
-  _rs := sprintf('%s<wday>%s</wday>',_rs,w);
-  _rs := sprintf('%s<month>%s</month>',_rs,m);
-  _rs := sprintf('%s<year>%s</year>',_rs,y);
-  --_rs := sprintf('%s</ddate>',_rs);
+  delete
+    from OMAIL.WA.FOLDERS
+   where DOMAIN_ID = _domain_id
+     and USER_ID = _user_id
+     and FOLDER_ID = _folder_id;
 
-  return _rs;
+  return 1;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_del_folder(
+create procedure OMAIL.WA.folder_move (
   in _domain_id integer,
   in _user_id   integer,
   in _folder_id integer,
-  in _mode      integer)
+  in _parent_id integer)
 {
-  for (select MSG_ID from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id) do
-    OMAIL.WA.omail_del_message(_domain_id,_user_id, MSG_ID);
+  declare N integer;
+  declare _folder_name, _folder_name2 varchar;
 
-  for (select FOLDER_ID from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = _folder_id) do
-    OMAIL.WA.omail_del_folder(_domain_id,_user_id,FOLDER_ID, _mode);
+  N := 1;
+  _folder_name := OMAIL.WA.folder_name (_domain_id, _user_id, _folder_id);
+  _folder_name2 := _folder_name;
+  while (OMAIL.WA.folder_name_exists (_domain_id, _user_id, _parent_id, _folder_name2) and OMAIL.WA.folder_name_exists (_domain_id, _user_id, _folder_id, _folder_name2))
+  {
+    _folder_name2 := sprintf ('%s (%d)', _folder_name, N);
+    N := N + 1;
+  }
+  if (_folder_name <> _folder_name2)
+  {
+    if (not OMAIL.WA.folder_rename (_domain_id, _user_id, _folder_id, _folder_name2))
+      return 0;
+  }
+
+  if (not OMAIL.WA.imap_folder_move (_domain_id, _user_id, _folder_id, _parent_id))
+    return 0;
+
+  update OMAIL.WA.FOLDERS
+     set PARENT_ID = _parent_id
+   where DOMAIN_ID = _domain_id
+     and USER_ID   = _user_id
+     and FOLDER_ID = _folder_id;
 
-  if (_mode = 1)
+  return 1;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_rename (
+  in _domain_id integer,
+  in _user_id   integer,
+  in _folder_id integer,
+  in _name      varchar)
   {
-    declare _parent_id integer;
+  if (not OMAIL.WA.imap_folder_rename (_domain_id, _user_id, _folder_id, _name))
+    return 0;
 
-    _parent_id := (select PARENT_ID from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id);
-    if (not isnull(_parent_id))
-      update OMAIL.WA.EXTERNAL_POP_ACC
-         set FOLDER_ID = _parent_id
+  update OMAIL.WA.FOLDERS
+     set NAME = _name
        where DOMAIN_ID = _domain_id
          and USER_ID   = _user_id
          and FOLDER_ID = _folder_id;
 
-    delete from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id;
-  }
-}
-;
+  return 1;
+  }
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_check_id (
+  in _domain_id integer,
+  in _user_id   integer,
+  in _folder_id integer)
+{
+  return coalesce ((select 1 from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id), 0);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_name_exists (
+  in _domain_id integer,
+  in _user_id   integer,
+  in _parent_id   integer,
+  in _folder_name varchar,
+  in _folder_id   integer := 0)
+{
+  declare retValue integer;
+
+  retValue := coalesce ((select FOLDER_ID from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = _parent_id and NAME = _folder_name), 0);
+  if (_folder_id = 0)
+    return retValue;
+
+  if (retValue = 0)
+    return retValue;
+
+  if (retValue <> _folder_id)
+    return 1;
+
+  return 0;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_isTrash (
+  in  _domain_id integer,
+  in  _user_id   integer,
+  in  _folder_id integer)
+{
+  if (_folder_id = 110)
+    return 1;
+
+  for (select PARENT_ID, F_TYPE from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id) do
+  {
+    if (PARENT_ID = 110)
+      return 1;
+
+    if (F_TYPE = 'TRASH')
+      return 1;
+
+    if (PARENT_ID)
+      return OMAIL.WA.folder_isTrash(_domain_id, _user_id, PARENT_ID);
+  }
+  return 0;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_isSpam (
+  in  _domain_id integer,
+  in  _user_id   integer,
+  in  _folder_id integer)
+{
+  if (_folder_id = 125)
+    return 1;
+
+  for (select PARENT_ID, F_TYPE from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id) do
+  {
+    if (PARENT_ID = 125)
+      return 1;
+
+    if (F_TYPE = 'SPAM')
+      return 1;
+
+    if (PARENT_ID)
+      return OMAIL.WA.folder_isSpam(_domain_id, _user_id, PARENT_ID);
+  }
+  return 0;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_isErasable (
+  in  _domain_id integer,
+  in  _user_id   integer,
+  in  _folder_id integer)
+{
+  if (OMAIL.WA.folder_isTrash(_domain_id, _user_id, _folder_id))
+    return 1;
+
+  if (OMAIL.WA.folder_isSpam(_domain_id, _user_id, _folder_id))
+    return 1;
+
+  return 0;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_isSmart (
+  in  _domain_id integer,
+  in  _user_id   integer,
+  in  _folder_id integer)
+{
+  if ((select SMART_FLAG from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id) = 'S')
+    return 1;
+
+  return 0;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_isSystem(
+  in  _domain_id integer,
+  in  _user_id   integer,
+  in  _folder_id integer)
+{
+  if ((select SYSTEM_FLAG from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id) = 'S')
+    return 1;
+
+  return 0;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_trash (
+  in  _domain_id integer,
+  in  _user_id   integer,
+  in  _folder_id integer)
+{
+  declare _source integer;
+
+  _source := coalesce((select F_SOURCE from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id), 0);
+  for (select FOLDER_ID from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and coalesce (F_SOURCE, 0) = _source and F_TYPE = 'TRASH') do
+    return FOLDER_ID;
+
+  return 110;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_type (
+  in  _domain_id integer,
+  in  _user_id   integer,
+  in  _folder_id integer)
+{
+  declare _parent_id integer;
+
+  if (_folder_id in (100, 110, 125))
+    return 'R';
+
+  if (_folder_id in (120, 130))
+    return 'S';
+
+  if (OMAIL.WA.folder_isSmart (_domain_id, _user_id, _folder_id))
+    return 'R';
+
+  for (select F_TYPE, PARENT_ID from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id) do
+  {
+    if (F_TYPE in ('INBOX', 'TRASH', 'SPAM'))
+      return 'R';
+
+    if (F_TYPE in ('SENT', 'DRAFTS'))
+      return 'S';
+
+    if (PARENT_ID > 0)
+      return OMAIL.WA.folder_type (_domain_id, _user_id, PARENT_ID);
+  }
+  return 'R';
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_check_parent (
+  in _domain_id integer,
+  in _user_id   integer,
+  in _folder_id integer,
+  in _parent_id integer)
+{
+  declare _parent_loc integer;
+  WHENEVER NOT FOUND GOTO ERR_EXIT;
+
+  if (_parent_id is null)
+    return 0;
+
+  select PARENT_ID
+    INTO _parent_loc
+    from OMAIL.WA.FOLDERS
+   where DOMAIN_ID = _domain_id
+     and USER_ID = _user_id
+     and FOLDER_ID = _parent_id;
+
+  if ((_parent_loc = _folder_id) or (_parent_id = _folder_id))
+    return 1401;
+
+  if (is_empty_or_null(_parent_loc))
+    return 0;
+
+  return OMAIL.WA.folder_check_parent (_domain_id, _user_id, _folder_id, _parent_loc);
+
+ERR_EXIT:
+  return 1402;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.imap_folder_info (
+  in _domain_id integer,
+  in _user_id integer,
+  in _folder_id integer,
+  inout _source_start_id integer,
+  inout _source_id integer,
+  inout _path varchar)
+{
+  declare _retValue integer;
+
+  _source_id := 0;
+  _path := '';
+  _source_start_id := 0;
+  for (select DATA, F_SOURCE from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id and F_SOURCE <> 0) do
+  {
+    _retValue := 1;
+    _source_id := F_SOURCE;
+    _path := DATA;
+    _source_start_id := (select FOLDER_ID from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = 0 and F_SOURCE = _source_id);
+  }
+  return _retValue;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.imap_folder_erase (
+  in _domain_id integer,
+  in _user_id integer,
+  in _folder_id integer)
+{
+  declare _start_id, _source, _folder any;
+  declare _server, _user, _password, _buffer, _retCode any;
+  declare exit handler for SQLSTATE '*' {return 0;};
+
+  if (not OMAIL.WA.imap_folder_info (_domain_id, _user_id, _folder_id, _start_id, _source, _folder))
+    return 1;
+
+  if (not OMAIL.WA.external_account_info (_domain_id, _user_id, _source, _server, _user, _password))
+    return 0;
+
+  _buffer := 10000000;
+  _retCode := imap_get (_server, _user, _password, _buffer, 'delete', _folder);
+  -- dbg_obj_print ('imap_folder_erase', _retCode);
+
+  return 1;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.imap_folder_move (
+  in _domain_id integer,
+  in _user_id integer,
+  in _folder_id integer,
+  in _parent_id integer)
+{
+  declare _start_id, _source, _folder, _newFolder any;
+  declare _start_id2, _source2, _folder2 any; -- parent
+  declare _server, _user, _password, _buffer, _retCode any;
+  declare exit handler for SQLSTATE '*' {return 0;};
+
+  if (not OMAIL.WA.imap_folder_info (_domain_id, _user_id, _folder_id, _start_id, _source, _folder))
+    return 1;
+
+  if (not OMAIL.WA.imap_folder_info (_domain_id, _user_id, _parent_id, _start_id2, _source2, _folder2))
+    return 0;
+
+  if (_source <> _source2)
+    return 0;
+
+  if (not OMAIL.WA.external_account_info (_domain_id, _user_id, _source, _server, _user, _password))
+    return 0;
+
+  _newFolder := _folder2 || '.' || OMAIL.WA.folder_name (_domain_id, _user_id, _folder_id);
+  _buffer := 10000000;
+  _retCode := imap_get (_server, _user, _password, _buffer, 'rename', '', vector (_folder, _newFolder));
+  -- dbg_obj_print ('imap_folder_move', _retCode);
+
+  return 1;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.imap_folder_rename (
+  in _domain_id integer,
+  in _user_id integer,
+  in _folder_id integer,
+  in _name varchar)
+{
+  declare _start_id, _source, _folder, _newFolder any;
+  declare _server, _user, _password, _buffer, _retCode any;
+  declare exit handler for SQLSTATE '*' {return 0;};
+
+  if (not OMAIL.WA.imap_folder_info (_domain_id, _user_id, _folder_id, _start_id, _source, _folder))
+    return 1;
+
+  if (not OMAIL.WA.external_account_info (_domain_id, _user_id, _source, _server, _user, _password))
+    return 0;
+
+  _newFolder := _folder || '.' || _name;
+  _buffer := 10000000;
+  _retCode := imap_get (_server, _user, _password, _buffer, 'rename', '', vector (_folder, _newFolder));
+  -- dbg_obj_print ('imap_folder_rename', _retCode);
+
+  return 1;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.omail_check_interval(
+  in _value  any,
+  in _lt integer,
+  in _gt integer)
+{
+  declare exit handler for SQLSTATE '*' {return 0;};
+
+  _value := cast (_value as integer);
+  if ((_value >= _lt) and (_value <= _gt))
+    return 1;
+  return 0;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.omail_construct_mail (
+  inout path any,
+  inout lines any,
+  inout params any)
+{
+  -- www procedure
+
+  declare _sql_result1,_sql_result2,_xslt_url,_rs,_boundary any;
+  declare _user_id,_msg_id integer;
+
+  _rs := '';
+  _user_id := 1001;
+  _msg_id  := 1009;
 
--------------------------------------------------------------------------------
---
-create procedure OMAIL.WA.omail_del_message(
-  in _domain_id integer,
-  in _user_id   integer,
-  in _msg_id    integer)
-{
-  for (select MSG_ID from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = _msg_id) do
-    OMAIL.WA.omail_del_message(_domain_id,_user_id, MSG_ID);
+  _xslt_url := OMAIL.WA.omail_xslt_full('construct_mail.xsl');
 
-  DELETE
-    from OMAIL.WA.MSG_PARTS
-   where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id;
+  _sql_result1 := sprintf ('%s',OMAIL.WA.omail_open_message(_user_id, vector ('msg_id', _msg_id), 1, 1));
+  _sql_result2 := sprintf ('%s',OMAIL.WA.omail_select_attachment(_user_id,_msg_id,1));
+  _boundary := sprintf ('------_NextPart_%s', md5(cast (now() as varchar)));
 
-  DELETE
-    from OMAIL.WA.MESSAGES
-   where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id;
+  -- XML structure-------------------------------------------------------------------
+  _rs := sprintf ('%s<message>', _rs);
+  _rs := sprintf ('%s<boundary>%s</boundary>', _rs, _boundary);
+  _rs := sprintf ('%s%s', _rs, _sql_result1);
+  _rs := sprintf ('%s%s', _rs, _sql_result2);
+  _rs := sprintf ('%s</message>', _rs);
 
-  commit work;
+  -- XSL Transformation--------------------------------------------------------------
+  declare _view varchar;
+  _view := get_keyword ('vv', params, 'h');
+  OMAIL.WA.utl_myhttp (_view, _rs, _xslt_url, null, null, null);
+  return;
 }
 ;
 
--------------------------------------------------------------------------------
+-----------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_del_pop3_acc(
-  in _domain_id integer,
-  in _user_id   integer,
-  in _del_acc_id integer)
+create procedure OMAIL.WA.omail_dav_api_params(
+  inout userInfo any,
+  out vspx_user varchar,
+  out vspx_pwd varchar)
 {
-  DELETE
-    from OMAIL.WA.EXTERNAL_POP_ACC
-   where DOMAIN_ID = _domain_id
-     and USER_ID = _user_id
-     and ACC_ID = _del_acc_id;
+  declare vspx_uid integer;
 
-  return 0;
+  vspx_uid := get_keyword ('user_id', userInfo);
+  vspx_user := coalesce((select U_NAME from WS.WS.SYS_DAV_USER where U_ID = vspx_uid), '');
+  vspx_pwd := coalesce((select U_PWD from WS.WS.SYS_DAV_USER where U_ID = vspx_uid), '');
+  if (vspx_pwd[0] = 0)
+    vspx_pwd := pwd_magic_calc(vspx_user, vspx_pwd, 1);
 }
 ;
 
@@ -1333,7 +1910,7 @@ create procedure OMAIL.WA.omail_delete_attachment(
   in  _part_id    integer,
   out _error      integer)
 {
-   DELETE
+  delete
      from OMAIL.WA.MSG_PARTS
     where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id and PART_ID = _part_id;
 
@@ -1537,42 +2114,19 @@ create procedure OMAIL.WA.url_fix (
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_delete_message(
-  in _domain_id integer,
-  in _user_id   integer,
-  inout params  any,
-  inout _params any)
-{
-  declare N integer;
-
-  if (OMAIL.WA.omail_getp ('folder_id',_params) = 110)
-  {
-    for (N := 0; N < length (params); N := N + 2)
-    {
-      if (params[N] = 'ch_msg')
-        OMAIL.WA.omail_del_message(_domain_id, _user_id, cast(params[N + 1] as integer));
-    }
-  }
-  else
-  {
-    OMAIL.WA.omail_setparam('fid', params, 110);
-    OMAIL.WA.omail_move_msg(_domain_id, _user_id, params);
-  }
-}
-;
-
--------------------------------------------------------------------------------
---
 create procedure OMAIL.WA.omail_delete_user_data(
  in _domain_id integer,
  in _user_id integer)
 {
   delete from OMAIL.WA.MSG_PARTS        where DOMAIN_ID = _domain_id and USER_ID = _user_id;
   delete from OMAIL.WA.MESSAGES         where DOMAIN_ID = _domain_id and USER_ID = _user_id;
-  delete from OMAIL.WA.EXTERNAL_POP_ACC where DOMAIN_ID = _domain_id and USER_ID = _user_id;
+  delete from OMAIL.WA.EXTERNAL_ACCOUNT where EA_DOMAIN_ID = _domain_id and EA_USER_ID = _user_id;
+
   for (select FOLDER_ID from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = 0) do
-    OMAIL.WA.omail_del_folder (_domain_id, _user_id, FOLDER_ID, 1);
+    OMAIL.WA.folder_erase (_domain_id, _user_id, FOLDER_ID, 0);
+
   delete from OMAIL.WA.SETTINGS         where DOMAIN_ID = _domain_id and USER_ID = _user_id;
+
   if (_domain_id <> 1)
     OMAIL.WA.nntp_update (_domain_id, 1, 0);
 }
@@ -1755,338 +2309,87 @@ create procedure OMAIL.WA.omail_folders(
       data := vector_concat (data, vector ('q_tags', get_keyword ('q_tags', params, '')));
       data := vector_concat (data, vector ('q_fid', get_keyword ('q_fid', params,'')));
       data := vector_concat (data, vector ('q_attach', get_keyword ('q_attach', params,'')));
-      data := vector_concat (data, vector ('q_read', get_keyword ('q_read', params,'')));
-      data := vector_concat (data, vector ('q_after', get_keyword ('q_after', params, '')));
-      data := vector_concat (data, vector ('q_before', get_keyword ('q_before', params, '')));
-    }
-    folderData := vector ('folder_id', _folder_id,
-                          'parent_id', _parent_id,
-                          'systemFlag', _systemFlag,
-                          'smartFlag', _smartFlag,
-                          'name', _folder_name,
-                          'data', data
-                         );
-
-    if (_folder_id = 0)
-      OMAIL.WA.omail_folder_create (_domain_id, _user_id, folderData, _error);
-    else
-      OMAIL.WA.omail_folder_edit (_domain_id, _user_id, _folder_id, 0, folderData, _error);
-
-    if (_error = 0)
-    {
-      OMAIL.WA.utl_redirect (sprintf ('folders.vsp?sid=%s&realm=%s', _sid, _realm));
-    } else {
-      OMAIL.WA.utl_redirect(sprintf('err.vsp?sid=%s&realm=%s&err=%d',_sid,_realm,_error));
-    }
-    return;
-  }
-  else if (get_keyword ('fa_cancel.x',params,'') <> '')
-  {
-    OMAIL.WA.utl_redirect (sprintf ('folders.vsp?sid=%s&realm=%s', _sid, _realm));
-    return;
-  }
-
-  _folder_id := cast (get_keyword ('folder_id', _params, '0') as integer);
-  _faction := get_keyword ('faction', _params, '');
-  if ((_faction = -1) or (_faction = -2))
-  {
-    -- create normal and smart folders
-    _sql_result1 := OMAIL.WA.folder_list (_domain_id, _user_id, _faction);
-  }
-  else if (_faction = 1)
-  {
-    -- edit folder
-    _sql_result1 := OMAIL.WA.folder_list (_domain_id, _user_id, _folder_id);
-  }
-  else if ((_faction = 2) or (_faction = 3))
-  {
-    -- empty and delete folder
-    OMAIL.WA.omail_folder_edit (_domain_id, _user_id, _folder_id, _faction-1, null, _error);
-  }
-  else if (get_keyword ('folder_id', params, '') <> '')
-  {
-    _sql_result1 := _sql_result1 || sprintf ('<object id="%s" systemFlag="%s" smartFlag="%s">', get_keyword ('folder_id', params), get_keyword ('systemFlag', _params, 'N'), get_keyword ('smartFlag', params, 'N'));
-    _sql_result1 := _sql_result1 || sprintf ('<name>%V</name>', get_keyword ('name', params, ''));
-    _sql_result1 := _sql_result1 || sprintf ('<parent_id>%s</parent_id>', get_keyword ('parent_id', params, ''));
-    if (get_keyword ('smartFlag', params, 'N') = 'S')
-    {
-      _sql_result1 := _sql_result1 || '<query>';
-      _sql_result1 := _sql_result1 || sprintf ('<q_from><![CDATA[%s]]></q_from>', get_keyword ('q_from', params, ''));
-      _sql_result1 := _sql_result1 || sprintf ('<q_to><![CDATA[%s]]></q_to>', get_keyword ('q_to', params, ''));
-      _sql_result1 := _sql_result1 || sprintf ('<q_subject><![CDATA[%s]]></q_subject>', get_keyword ('q_subject', params, ''));
-      _sql_result1 := _sql_result1 || sprintf ('<q_body><![CDATA[%s]]></q_body>', get_keyword ('q_body', params, ''));
-      _sql_result1 := _sql_result1 || sprintf ('<q_tags><![CDATA[%s]]></q_tags>', get_keyword ('q_tags', params, ''));
-      _sql_result1 := _sql_result1 || sprintf ('<q_fid>%s</q_fid>', get_keyword ('q_fid', params, ''));
-      _sql_result1 := _sql_result1 || sprintf ('<q_attach>%s</q_attach>', get_keyword ('q_attach', params, ''));
-      _sql_result1 := _sql_result1 || sprintf ('<q_read>%s</q_read>', get_keyword ('q_read', params, ''));
-      _sql_result1 := _sql_result1 || sprintf ('<q_after>%s</q_after>', get_keyword ('q_after', params, ''));
-      _sql_result1 := _sql_result1 || sprintf ('<q_before>%s</q_before>', get_keyword ('q_before', params, ''));
-      _sql_result1 := _sql_result1 || '</query>';
-    }
-    _sql_result1 := _sql_result1 || '</object>';
-  }
-
-  -- Page Params---------------------------------------------------------------
-  aset(_page_params,0,vector('sid',_sid));
-  aset(_page_params,1,vector('realm',_realm));
-  aset (_page_params,2,vector ('user_info', OMAIL.WA.array2xml(_user_info)));
-
-  -- XML structure-------------------------------------------------------------
-  _rs := OMAIL.WA.omail_page_params(_page_params) ||
-         _sql_result1 ||
-         OMAIL.WA.omail_folders_list (_domain_id, _user_id, vector ());
-  return _rs;
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure OMAIL.WA.omail_folder_name(
-  in _domain_id   integer,
-  in _user_id     integer,
-  in _folder_id   integer)
-{
-  return coalesce((select NAME from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id), '');
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure OMAIL.WA.omail_folder_test (
-  in  _params any)
-{
-  declare tmp, tmp2 any;
-
-  if (isnull (_params))
-    return;
-  tmp := get_keyword ('q_after', _params);
-  OMAIL.WA.test (tmp, vector ('name', 'Received after', 'type', 'date', 'canEmpty', 1));
-  tmp := get_keyword ('q_before', _params);
-  OMAIL.WA.test (tmp, vector ('name', 'Received before', 'type', 'date', 'canEmpty', 1));
-  tmp := get_keyword ('q_from', _params);
-  if ((tmp <> '') and is_empty_or_null (OMAIL.WA.omail_email_search_str (tmp)))
-    signal ('TEST', 'Field ''From'' contains invalid characters!<>');
-  tmp := get_keyword ('q_to', _params);
-  if ((tmp <> '') and is_empty_or_null (OMAIL.WA.omail_email_search_str (tmp)))
-    signal ('TEST', 'Field ''To'' contains invalid characters!<>');
-  tmp := get_keyword ('q_body', _params);
-  if (tmp <> '')
-  {
-    OMAIL.WA.test (tmp, vector ('name', 'Body', 'class', 'free-text'));
-    if (is_empty_or_null (FTI_MAKE_SEARCH_STRING (tmp)) and (tmp <> ''))
-      signal ('TEST', 'Field ''Body'' contains invalid characters!<>');
-  }
-  tmp := get_keyword ('q_tags', _params);
-  OMAIL.WA.test (tmp, vector ('name', 'Tags', 'class', 'tags', 'message', 'One of the tags is too short or contains bad characters or is a noise word!'));
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure OMAIL.WA.omail_folder_create (
-  in  _domain_id   integer,
-  in  _user_id     integer,
-  in  _params      any,
-  out _error       integer)
-{
-  declare _folder_id, _parent_id integer;
-  declare _folder_name varchar;
-  declare _data any;
-
-  _error := 0;
-  _parent_id := get_keyword ('parent_id', _params);
-  _folder_name := get_keyword ('name', _params);
-  if (length (_folder_name) > 20)
-    _error := 1201;
-
-  else if (length (_folder_name) < 2)
-    _error := 1202;
-
-  else if (OMAIL.WA.omail_check_folder_name (_domain_id, _user_id, _parent_id, _folder_name))
-    _error := 1203;
-
-  else
-  {
-    OMAIL.WA.omail_folder_test (get_keyword ('data', _params));
-    _folder_id := sequence_next('OMAIL.WA.omail_seq_eml_folder_id');
-    _data := serialize (get_keyword ('data', _params));
-    insert into OMAIL.WA.FOLDERS(DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, SYSTEM_FLAG, SMART_FLAG, NAME, DATA)
-      values (_domain_id, _user_id, _folder_id, _parent_id, get_keyword ('systemFlag', _params, 'N'), get_keyword ('smartFlag', _params, 'N'), _folder_name, _data);
-
-    return _folder_id;
-  }
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure OMAIL.WA.omail_folder_edit (
-  in  _domain_id   integer,
-  in  _user_id     integer,
-  in  _folder_id   integer,
-  in  _action_id   integer,
-  in  _params      any,
-  out _error       integer)
-{
-  declare _parent_id integer;
-  declare _folder_name varchar;
-  declare _data any;
-
-  _error := 0;
-  if (_action_id = 0)
-  {
-    -- edit folder
-    _parent_id := get_keyword ('parent_id', _params);
-    _folder_name := get_keyword ('name', _params);
-    if (length (_folder_name) > 20)
-    {
-      _error := 1201;
-    }
-    else if (length (_folder_name) < 2)
-    {
-      _error := 1202;
-    }
-    else if (OMAIL.WA.omail_check_folder_name(_domain_id, _user_id, _parent_id, _folder_name, _folder_id))
-    {
-      _error := 1203;
-    }
-    else
-    {
-      OMAIL.WA.omail_folder_test (get_keyword ('data', _params));
-      _error := OMAIL.WA.omail_check_parent (_domain_id, _user_id, _folder_id, _parent_id);
-      if (_error = 0)
-      {
-        update OMAIL.WA.FOLDERS
-           set PARENT_ID = _parent_id,
-               NAME      = _folder_name,
-               DATA      = serialize (get_keyword ('data', _params))
-         where DOMAIN_ID = _domain_id
-           and USER_ID   = _user_id
-           and FOLDER_ID = _folder_id;
-      }
-    }
-  }
-  else if (_action_id = 1)
-  {
-    -- delete(move to Trash) folder and message
-    _parent_id := 110;
-    _error := OMAIL.WA.omail_check_parent(_domain_id, _user_id, _folder_id, _parent_id);
-    if (_error = 0)
-    {
-      if (OMAIL.WA.omail_folder_isTrash (_domain_id,_user_id,_folder_id,_error) = -1)
-      {
-        if (_error = 0)
-          OMAIL.WA.omail_del_folder(_domain_id,_user_id,_folder_id, 1);
-      }
-      else if (OMAIL.WA.omail_folder_isSmart(_domain_id, _user_id, _folder_id))
-      {
-        if (not OMAIL.WA.omail_folder_isSystem(_domain_id, _user_id, _folder_id))
-          OMAIL.WA.omail_del_folder(_domain_id,_user_id,_folder_id, 1);
-      }
-      else
-      {
-        if (_error = 0)
-        {
-          declare N integer;
-          declare _folder_name, _folder_name2 varchar;
-
-          N := 2;
-          _folder_name := (select NAME from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id);
-          _folder_name2 := _folder_name;
-
-          while (OMAIL.WA.omail_check_folder_name(_domain_id, _user_id, _parent_id, _folder_name2))
-          {
-            _folder_name2 := sprintf ('%s-%d', _folder_name, N);
-            N := N + 1;
-          }
-          update OMAIL.WA.FOLDERS
-             set NAME = concat ('_x_y_z_', _folder_name2)
-           where DOMAIN_ID = _domain_id
-             and USER_ID   = _user_id
-             and FOLDER_ID = _folder_id;
-          update OMAIL.WA.FOLDERS
-             set PARENT_ID = _parent_id
-           where DOMAIN_ID = _domain_id
-             and USER_ID   = _user_id
-             and FOLDER_ID = _folder_id;
-          update OMAIL.WA.FOLDERS
-             set NAME = _folder_name2
-           where DOMAIN_ID = _domain_id
-             and USER_ID   = _user_id
-             and FOLDER_ID = _folder_id;
-        }
-      }
+      data := vector_concat (data, vector ('q_read', get_keyword ('q_read', params,'')));
+      data := vector_concat (data, vector ('q_after', get_keyword ('q_after', params, '')));
+      data := vector_concat (data, vector ('q_before', get_keyword ('q_before', params, '')));
     }
-  }
-  else if (_action_id = 2)
-{
-    -- empty folder to Trash
-    _parent_id := 110;
-    if (OMAIL.WA.omail_folder_isTrash(_domain_id, _user_id, _folder_id, _error) = -1)
+    folderData := vector ('folder_id', _folder_id,
+                          'parent_id', _parent_id,
+                          'systemFlag', _systemFlag,
+                          'smartFlag', _smartFlag,
+                          'name', _folder_name,
+                          'data', data
+                         );
+
+    if (_folder_id = 0)
+    {
+      OMAIL.WA.folder_create (_domain_id, _user_id, folderData, _error);
+    } else {
+      OMAIL.WA.folder_edit (_domain_id, _user_id, _folder_id, 0, folderData, _error);
+    }
+    if (_error = 0)
     {
-      if (_error = 0)
-        OMAIL.WA.omail_del_folder(_domain_id,_user_id,_folder_id,0);
+      OMAIL.WA.utl_redirect (sprintf ('folders.vsp?sid=%s&realm=%s', _sid, _realm));
     } else {
-      if (_error = 0)
-        update OMAIL.WA.MESSAGES set FOLDER_ID = _parent_id where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id;
+      OMAIL.WA.utl_redirect(sprintf('err.vsp?sid=%s&realm=%s&err=%d',_sid,_realm,_error));
     }
+    return;
+  }
+  else if (get_keyword ('fa_cancel.x',params,'') <> '')
+  {
+    OMAIL.WA.utl_redirect (sprintf ('folders.vsp?sid=%s&realm=%s', _sid, _realm));
+    return;
   }
-  return;
-}
-;
 
--------------------------------------------------------------------------------
---
-create procedure OMAIL.WA.omail_folders_list(
-  in _domain_id integer,
-  in _user_id   integer,
-  inout _params any)
+  _folder_id := cast (get_keyword ('folder_id', _params, '0') as integer);
+  _faction := get_keyword ('faction', _params, '');
+  if ((_faction = -1) or (_faction = -2))
+  {
+    -- create normal and smart folders
+    _sql_result1 := OMAIL.WA.folder_list (_domain_id, _user_id, _faction);
+  }
+  else if (_faction = 1)
+  {
+    -- edit folder
+    _sql_result1 := OMAIL.WA.folder_list (_domain_id, _user_id, _folder_id);
+}
+  else if ((_faction = 2) or (_faction = 3))
 {
-  return sprintf ('<folders>\n%s\n</folders>', OMAIL.WA.omail_folders_list_recu (_domain_id, _user_id, 0, _params, 0, ''));
+    -- empty and delete folder
+    OMAIL.WA.folder_edit (_domain_id, _user_id, _folder_id, _faction-1, null, _error);
 }
-;
-
--------------------------------------------------------------------------------
---
-create procedure OMAIL.WA.omail_folders_list_recu(
-  in    _domain_id  integer,
-  in    _user_id     integer,
-  in    _folder_id  integer,
-  inout _params      any,
-  in    _level      integer,
-  in    _ftree      varchar)
+  else if (get_keyword ('folder_id', params, '') <> '')
 {
-  declare _rs,_s,_ftree_loc varchar;
-  declare _all_cnt,_new_cnt,N,_len,_all_size integer;
-
-  N := 0;
-  _rs := '';
-  _len := (select COUNT(*) from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = _folder_id);
-  for (select * from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = _folder_id order by SEQ_NO, NAME) do
+    _sql_result1 := _sql_result1 || sprintf ('<object id="%s" systemFlag="%s" smartFlag="%s">', get_keyword ('folder_id', params), get_keyword ('systemFlag', _params, 'N'), get_keyword ('smartFlag', params, 'N'));
+    _sql_result1 := _sql_result1 || sprintf ('<name>%V</name>', get_keyword ('name', params, ''));
+    _sql_result1 := _sql_result1 || sprintf ('<parent_id>%s</parent_id>', get_keyword ('parent_id', params, ''));
+    if (get_keyword ('smartFlag', params, 'N') = 'S')
   {
-    OMAIL.WA.omail_cnt_message(_domain_id,_user_id,FOLDER_ID,_all_cnt,_new_cnt,_all_size);
-    if (length (_ftree) > 0)
-      _ftree := concat(substring(_ftree,1,(length (_ftree)-16)),replace (substring(_ftree,length (_ftree)-15,16),'<fnode>-</fnode>','<fnode>.</fnode>'));
-    _ftree := replace (_ftree,'F','I');
-    if (N + 1 = _len)
-    {
-       _ftree_loc := sprintf ('%s<fnode>%s</fnode>',_ftree,'-');
-    } else {
-       _ftree_loc := sprintf ('%s<fnode>%s</fnode>',_ftree,'F');
+      _sql_result1 := _sql_result1 || '<query>';
+      _sql_result1 := _sql_result1 || sprintf ('<q_from><![CDATA[%s]]></q_from>', get_keyword ('q_from', params, ''));
+      _sql_result1 := _sql_result1 || sprintf ('<q_to><![CDATA[%s]]></q_to>', get_keyword ('q_to', params, ''));
+      _sql_result1 := _sql_result1 || sprintf ('<q_subject><![CDATA[%s]]></q_subject>', get_keyword ('q_subject', params, ''));
+      _sql_result1 := _sql_result1 || sprintf ('<q_body><![CDATA[%s]]></q_body>', get_keyword ('q_body', params, ''));
+      _sql_result1 := _sql_result1 || sprintf ('<q_tags><![CDATA[%s]]></q_tags>', get_keyword ('q_tags', params, ''));
+      _sql_result1 := _sql_result1 || sprintf ('<q_fid>%s</q_fid>', get_keyword ('q_fid', params, ''));
+      _sql_result1 := _sql_result1 || sprintf ('<q_attach>%s</q_attach>', get_keyword ('q_attach', params, ''));
+      _sql_result1 := _sql_result1 || sprintf ('<q_read>%s</q_read>', get_keyword ('q_read', params, ''));
+      _sql_result1 := _sql_result1 || sprintf ('<q_after>%s</q_after>', get_keyword ('q_after', params, ''));
+      _sql_result1 := _sql_result1 || sprintf ('<q_before>%s</q_before>', get_keyword ('q_before', params, ''));
+      _sql_result1 := _sql_result1 || '</query>';
     }
-    _rs := sprintf ('%s<folder id="%d" systemFlag="%s" smartFlag="%s">\n', _rs, FOLDER_ID, SYSTEM_FLAG, SMART_FLAG);
-    _rs := sprintf ('%s<name><![CDATA[%s]]></name>\n',_rs,NAME);
-    _rs := sprintf ('%s<level str="%s" num="%d" />\n',_rs,repeat('~',_level),_level);
-    _rs := sprintf ('%s<ftree>%s</ftree>\n', _rs,_ftree_loc);
-    _rs := sprintf ('%s<all_cnt>%d</all_cnt>\n', _rs ,_all_cnt);
-    _rs := sprintf ('%s<all_size>%d</all_size>\n', _rs,_all_size);
-    _rs := sprintf ('%s<new_cnt>%d</new_cnt>\n', _rs,_new_cnt);
-    _s  := OMAIL.WA.omail_folders_list_recu(_domain_id,_user_id,FOLDER_ID,_params,_level+1,_ftree_loc);
-    if (_s <> '')
-      _rs := sprintf ('%s<folders>\n%s\n</folders>\n', _rs, _s);
-    _rs := sprintf ('%s</folder>\n', _rs);
-    N := N + 1;
+    _sql_result1 := _sql_result1 || '</object>';
   }
+
+  -- Page Params---------------------------------------------------------------
+  aset (_page_params,0,vector ('sid', _sid));
+  aset (_page_params,1,vector ('realm', _realm));
+  aset (_page_params,2,vector ('user_info', OMAIL.WA.array2xml(_user_info)));
+
+  -- XML structure-------------------------------------------------------------
+  _rs := OMAIL.WA.omail_page_params(_page_params) ||
+         _sql_result1 ||
+         OMAIL.WA.folders_list (_domain_id, _user_id);
   return _rs;
 }
 ;
@@ -2197,7 +2500,7 @@ create procedure OMAIL.WA.omail_filters (
   declare _rs, _sid, _realm, _node, _sql_result varchar;
   declare _page_params, _user_info any;
   declare _folder_id, _filter_id, _filter_name, _filter_active, _filter_mode, _filter_criteria, _filter_actions any;
-  declare fField, fCriteria, fValue, fAction any;
+  declare fField, fCriteria, fValue, fAction, fSuffix any;
 
   declare exit handler for SQLSTATE '*'
   {
@@ -2219,29 +2522,26 @@ create procedure OMAIL.WA.omail_filters (
     _filter_name := get_keyword ('filter_name', params);
     _filter_active := cast (get_keyword ('filter_active', params, 0) as integer);
     _filter_mode := cast (get_keyword ('filter_mode', params, 0) as integer);
-    _filter_criteria := OMAIL.WA.dc_xml ('criteria');
     C := 0;
-    seqNo := cast (get_keyword ('search_seqNo', params, '0') as integer);
-    for (N := 0; N < seqNo; N := N + 1)
+    A := 0;
+    _filter_criteria := OMAIL.WA.dc_xml ('criteria');
+    _filter_actions := OMAIL.WA.dc_xml ('actions');
+    for (N := 0; N < length (params); N := N + 2)
     {
-      fField := get_keyword (sprintf ('search_field_0_%d', N), params);
-      if (not isnull (fField))
+      if (params[N] like 'search_fld_1_%')
       {
-        fCriteria := get_keyword (sprintf ('search_field_1_%d', N), params);
-        fValue := get_keyword (sprintf ('search_field_2_%d', N), params);
+        fField := params[N+1];
+        fSuffix := replace (params [N], 'search_fld_1_', '');
+        fCriteria := get_keyword ('search_fld_2_' || fSuffix, params);
+        fValue := get_keyword ('search_fld_3_' || fSuffix, params);
         OMAIL.WA.dc_set_criteria (_filter_criteria, cast (C as varchar), fField, fCriteria, fValue);
         C := C + 1;
       }
-    }
-    _filter_actions := OMAIL.WA.dc_xml ('actions');
-    A := 0;
-    seqNo := cast (get_keyword ('action_seqNo', params, '0') as integer);
-    for (N := 0; N < seqNo; N := N + 1)
-    {
-      fAction := get_keyword (sprintf ('action_field_0_%d', N), params);
-      if (not isnull (fAction))
+      else if (params[N] like 'action_fld_1_%')
       {
-        fValue := get_keyword (sprintf ('action_field_1_%d', N), params);
+        fAction := params[N+1];
+        fSuffix := replace (params [N], 'action_fld_1_', '');
+        fValue := get_keyword ('action_fld_2_' || fSuffix, params);
         OMAIL.WA.dc_set_action (_filter_actions, cast (A as varchar), fAction, fValue);
         A := A + 1;
       }
@@ -2256,11 +2556,9 @@ create procedure OMAIL.WA.omail_filters (
     for (N := 0; N < length (params); N := N + 2)
     {
       if (params[N] = 'cb_item')
-      {
         OMAIL.WA.filter_delete (_user_id, cast (params[N+1] as integer));
       }
     }
-  }
   else if (get_keyword ('fa_run.x', params,'') <> '')
   {
     declare _filter_ids any;
@@ -2269,10 +2567,8 @@ create procedure OMAIL.WA.omail_filters (
     for (N := 0; N < length (params); N := N + 2)
     {
       if (params[N] = 'cb_item')
-      {
         _filter_ids := vector_concat (_filter_ids, vector (cast (params[N+1] as integer)));
       }
-    }
     _folder_id := cast (get_keyword ('folder_id', params) as integer);
     OMAIL.WA.filter_run (_domain_id, _user_id, _folder_id, _filter_ids);
   }
@@ -2292,7 +2588,7 @@ create procedure OMAIL.WA.omail_filters (
   -- XML structure-------------------------------------------------------------------
   _rs := OMAIL.WA.omail_page_params (_page_params) ||
          OMAIL.WA.filter_list (_user_id, _filter_id) ||
-         OMAIL.WA.omail_folders_list (_domain_id, _user_id, vector ());
+         OMAIL.WA.folders_list (_domain_id, _user_id);
   return _rs;
 }
 ;
@@ -2529,11 +2825,11 @@ create procedure OMAIL.WA.filter_apply (
         st := '00000';
         exec ('select ' || patternExpression, st, msg, vector (), 0, meta, rows);
         if (('00000' = st) and length (rows))
-        {
           conditionResult := rows[0][0];
-        }
+
         if ((conditionResult = 0) and (_filter[1] = 1))
           goto _end;
+
         if ((conditionResult = 1) and (_filter[1] = 0))
           goto _apply;
       }
@@ -2603,6 +2899,22 @@ create procedure OMAIL.WA.filter_value (
     data := get_keyword ('address', _fields);
     retValue := OMAIL.WA.omail_address2str (_valueType, data, 2);
   }
+  else if (_valueType in ('ssl', 'sslVerified', 'webID', 'webIDVerified'))
+  {
+    data := get_keyword ('options', _fields);
+    retValue := null;
+    if (not isnull (data))
+      retValue := cast (xpath_eval ('//' || _valueType, xml_tree_doc (xml_tree (data))) as varchar);
+
+    if (isnull (retValue))
+    {
+      if (_valueType in ('ssl', 'sslVerified', 'webIDVerified'))
+      retValue := '0';
+
+      if (_valueType in ('webID'))
+        retValue := '';
+    }
+  }
   else
   {
     retValue := cast (get_keyword_ucase (_valueType, _fields) as varchar);
@@ -2617,17 +2929,23 @@ create procedure OMAIL.WA.message_move (
   in _domain_id integer,
   in _user_id integer,
   in _msg_id integer,
-  in _folder_id any)
+  in _folder_id any,
+  in _full_mode integer := 1)
 {
   declare _old_folder_id integer;
 
   _old_folder_id := (select FOLDER_ID from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id);
-  if (not isnull (_old_folder_id) and (_old_folder_id <> _folder_id))
-  {
+  if (isnull (_old_folder_id) and (_old_folder_id = _folder_id))
+    return;
+
+  if (_full_mode and not OMAIL.WA.imap_message_move (_domain_id, _user_id, _msg_id, _folder_id))
+    return;
+
     update OMAIL.WA.MESSAGES
        set FOLDER_ID = _folder_id
-     where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id;
-  }
+   where DOMAIN_ID = _domain_id
+     and USER_ID = _user_id
+     and MSG_ID = _msg_id;
 }
 ;
 
@@ -2714,59 +3032,259 @@ create procedure OMAIL.WA.message_forward (
 }
 ;
 
--------------------------------------------------------------------------------
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.message_delete (
+  in    _domain_id  integer,
+  in    _user_id     integer,
+  in _msg_id integer,
+  in _full_mode integer := 1)
+{
+  declare _folder_id integer;
+
+  _folder_id := (select FOLDER_ID from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id);
+
+  -- check delete
+  if (OMAIL.WA.folder_isErasable (_domain_id, _user_id, _folder_id))
+    return OMAIL.WA.message_erase (_domain_id, _user_id, _msg_id, _full_mode);
+
+  -- move
+  return OMAIL.WA.message_move (_domain_id, _user_id, _msg_id, OMAIL.WA.folder_trash (_domain_id, _user_id, _folder_id), _full_mode);
+  }
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.message_erase (
+  in _domain_id integer,
+  in _user_id integer,
+  in _msg_id integer,
+  in _full_mode integer := 1)
+  {
+  for (select MSG_ID from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = _msg_id) do
+    OMAIL.WA.message_erase (_domain_id,_user_id, MSG_ID, _full_mode);
+
+  if (_full_mode and not OMAIL.WA.imap_message_erase (_domain_id, _user_id, _msg_id))
+    return 0;
+
+  delete
+    from OMAIL.WA.MSG_PARTS
+   where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id;
+
+  delete
+    from OMAIL.WA.MESSAGES
+   where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id;
+
+  commit work;
+
+  return 1;
+}
+;
+
+---------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.message_tag (
+  in _domain_id integer,
+  in _user_id integer,
+  in _msg_id integer,
+  in _tags varchar)
+{
+  declare _old_tags varchar;
+
+  _old_tags := (select TAGS from OMAIL.WA.MSG_PARTS where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID =_msg_id and PART_ID = 1);
+  update OMAIL.WA.MSG_PARTS
+     set TAGS = OMAIL.WA.tags_join (_tags, _old_tags)
+   where DOMAIN_ID = _domain_id
+     and USER_ID = _user_id
+     and MSG_ID =_msg_id
+     and PART_ID = 1;
+}
+;
+
+---------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.message_priority (
+  in _domain_id integer,
+  in _user_id integer,
+  in _msg_id integer,
+  in _priority integer)
+{
+  update OMAIL.WA.MESSAGES
+     set PRIORITY = _priority
+   where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id;
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.message_folder (
+  in _domain_id integer,
+  in _user_id integer,
+  in _msg_id integer)
+{
+  return (select FOLDER_ID from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.messages_move (
+  in _domain_id integer,
+  in _user_id   integer,
+  inout _params any)
+{
+  declare N, _folder_id integer;
+
+  _folder_id  := cast (get_keyword ('fid', _params, '') as integer);
+  for (N := 0; N < length (_params); N := N + 2)
+  {
+    if (_params[N] = 'ch_msg')
+      OMAIL.WA.message_move (_domain_id, _user_id, cast (_params[N + 1] as integer), _folder_id);
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.messages_delete (
+  in _domain_id integer,
+  in _user_id   integer,
+  inout params  any)
+{
+  declare N integer;
+
+  for (N := 0; N < length (params); N := N + 2)
+  {
+    if (params[N] = 'ch_msg')
+      OMAIL.WA.message_delete (_domain_id, _user_id, cast (params[N + 1] as integer));
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.messages_count (
+  in  _domain_id integer,
+  in  _user_id   integer,
+  in  _folder_id integer,
+  out _all_cnt   integer,
+  out _new_cnt   integer,
+  out _all_size  integer)
+{
+  select COUNT(*),
+         SUM(either(MSTATUS,0,1)),
+         SUM(DSIZE)
+    INTO _all_cnt,
+         _new_cnt,
+         _all_size
+    from OMAIL.WA.MESSAGES
+   where PARENT_ID IS NULL
+     and DOMAIN_ID = _domain_id
+     and USER_ID   = _user_id
+     and FOLDER_ID = _folder_id;
+
+  _new_cnt  := either (isnull (_new_cnt), 0, _new_cnt);
+  _all_size := either (isnull (_all_size), 0, _all_size);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.message_folder (
+  in _domain_id integer,
+  in _user_id integer,
+  in _msg_id integer)
+{
+  return (select FOLDER_ID from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id);
+}
+;
+
+-----------------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.message_delete (
-  in    _domain_id  integer,
-  in    _user_id     integer,
-  in _msg_id integer)
+create procedure OMAIL.WA.imap_message_info (
+  in _domain_id integer,
+  in _user_id integer,
+  in _msg_id integer,
+  inout _folder_id integer,
+  inout _source_id integer,
+  inout _unique_id integer)
 {
-  declare _folder_id integer;
+  declare _server, _password, _buffer, _folder, _retCode any;
 
-  _folder_id := (select FOLDER_ID from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id);
-  if (_folder_id = 110)
-  {
-    OMAIL.WA.omail_del_message (_domain_id, _user_id, _msg_id);
-  }
-  else
+  for (select FOLDER_ID, MSG_SOURCE, UNIQ_MSG_ID from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id and MSG_SOURCE > 0) do
   {
-    OMAIL.WA.message_delete (_domain_id, _user_id, _msg_id, 110);
+    _folder_id := FOLDER_ID;
+    _source_id := MSG_SOURCE;
+    _unique_id := UNIQ_MSG_ID;
+
+    return 1;
   }
+  return 0;
 }
 ;
 
----------------------------------------------------------------------------------
+-----------------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.message_tag (
+create procedure OMAIL.WA.imap_message_erase (
   in _domain_id integer,
   in _user_id integer,
-  in _msg_id integer,
-  in _tags varchar)
+  in _msg_id integer)
 {
-  declare _old_tags varchar;
+  declare _folder_id, _source_id, _unique_id integer;
+  declare _server, _user, _password, _buffer, _folder, _retCode any;
+  declare exit handler for SQLSTATE '*' {return 0;};
 
-  _old_tags := (select TAGS from OMAIL.WA.MSG_PARTS where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID =_msg_id and PART_ID = 1);
-  update OMAIL.WA.MSG_PARTS
-     set TAGS = OMAIL.WA.tags_join (_tags, _old_tags)
-   where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID =_msg_id and PART_ID = 1;
+  if (not OMAIL.WA.imap_message_info (_domain_id, _user_id, _msg_id, _folder_id, _source_id, _unique_id))
+    return 1;
+
+  if (not OMAIL.WA.external_account_info (_domain_id, _user_id, _source_id, _server, _user, _password))
+    return 0;
+
+  _folder := (select DATA from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id);
+  if (isnull (_folder))
+    return 0;
+
+  _buffer := 10000000;
+  _retCode := imap_get (_server, _user, _password, _buffer, 'message_delete', _folder, vector (cast (_unique_id as integer)));
+  -- dbg_obj_print ('imap_message_erase', _retCode);
+
+  return 1;
     }
 ;
 
----------------------------------------------------------------------------------
+-----------------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.message_priority (
+create procedure OMAIL.WA.imap_message_move (
   in _domain_id integer,
   in _user_id integer,
   in _msg_id integer,
-  in _priority integer)
+  in _move_id integer)
 {
-  update OMAIL.WA.MESSAGES
-     set PRIORITY = _priority
-   where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id;
-}
-;
+  declare _folder_id, _source_id, _unique_id integer;
+  declare _server, _user, _password, _buffer, _folder, _move, _retCode any;
+  declare exit handler for SQLSTATE '*' {return 0;};
 
--------------------------------------------------------------------------------
+  if (not OMAIL.WA.imap_message_info (_domain_id, _user_id, _msg_id, _folder_id, _source_id, _unique_id))
+    return 1;
+
+  if (not OMAIL.WA.external_account_info (_domain_id, _user_id, _source_id, _server, _user, _password))
+    return 0;
+
+  _folder := (select DATA from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id);
+  if (isnull (_folder))
+    return 0;
+
+  _move := (select DATA from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _move_id and F_SOURCE = _source_id);
+  if (isnull(_move))
+    return 0;
+
+  _buffer := 10000000;
+  _retCode := imap_get (_server, _user, _password, _buffer, 'message_copy', _folder, vector (_move, cast (_unique_id as integer)));
+  _retCode := imap_get (_server, _user, _password, _buffer, 'message_delete', _folder, vector (cast (_unique_id as integer)));
+
+  return 1;
+}
+;-------------------------------------------------------------------------------
 --
 create procedure OMAIL.WA.omail_form_select(
   in aname     varchar,
@@ -2878,7 +3396,7 @@ create procedure OMAIL.WA.omail_get_encoding(
   if (_element = '')
     _element := 'content-transfer-encoding';
   _aparams_xml := xml_tree_doc(xml_tree(_params,2));
-  _encoding := (cast(xpath_eval(concat('//',_element), _aparams_xml) as varchar));
+  _encoding := (cast (xpath_eval ('//' || _element, _aparams_xml) as varchar));
   _encoding := either(isnull(_encoding),'',_encoding);
 
   return _encoding;
@@ -2897,7 +3415,7 @@ create procedure OMAIL.WA.omail_get_message(
   declare _to, _cc, _bcc, _dcc, _body, _tags, _type_id, _aparams varchar;
 
   _fields := vector();
-  for (select MSG_ID, FOLDER_ID, SRV_MSG_ID, REF_ID, MSTATUS, ATTACHED, ADDRESS, RCV_DATE, SND_DATE, MHEADER, DSIZE, PRIORITY, SUBJECT, ADDRES_INFO, PARENT_ID
+  for (select MSG_ID, FOLDER_ID, SRV_MSG_ID, REF_ID, MSTATUS, ATTACHED, ADDRESS, RCV_DATE, SND_DATE, MHEADER, DSIZE, PRIORITY, SUBJECT, ADDRES_INFO, PARENT_ID, M_OPTIONS, MSG_SOURCE, UNIQ_MSG_ID
          from OMAIL.WA.MESSAGES
         where DOMAIN_ID = _domain_id
           and USER_ID   = _user_id
@@ -2909,6 +3427,18 @@ create procedure OMAIL.WA.omail_get_message(
     _dcc := OMAIL.WA.omail_address2str('dcc', ADDRESS, 0);
     PARENT_ID := coalesce (PARENT_ID,0);
 
+    if (MSG_SOURCE > 0)
+    {
+      declare _size, _count integer;
+
+      for (select DSIZE from OMAIL.WA.MSG_PARTS where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id) do
+      {
+        _size := _size + DSIZE;
+        _count := _count + 1;
+      }
+      if (_size = 0 and _count <= 1)
+        OMAIL.WA.omail_receive_message_imap_body (_domain_id, _user_id, _msg_id, PARENT_ID, FOLDER_ID, MSG_SOURCE, UNIQ_MSG_ID);
+    }
     for (select TYPE_ID, TDATA, APARAMS, TAGS
            from OMAIL.WA.MSG_PARTS
           where DOMAIN_ID = _domain_id
@@ -2923,10 +3453,33 @@ create procedure OMAIL.WA.omail_get_message(
     }
     if (_part_id <> 1)
       _tags := OMAIL.WA.tags_select(_domain_id, _user_id, _msg_id);
-    _fields := vector('_res',1,'msg_id',MSG_ID,'to',_to,'cc',_cc,'bcc',_bcc,'dcc',_dcc,'address',ADDRESS,'subject',SUBJECT,'tags',_tags,'mt',_type_id,'type_id',_type_id,'priority',PRIORITY,'message',cast(_body as varchar),'folder_id',FOLDER_ID,'mstatus',MSTATUS,'attached',ATTACHED,'rcv_date',RCV_DATE,'dsize',DSIZE,'aparams',_aparams,'srv_msg_id',SRV_MSG_ID,'ref_id',REF_ID,'parent_id',PARENT_ID,'header',MHEADER);
+    _fields := vector ('_res', 1,
+                       'msg_id', MSG_ID,
+                       'to', _to,
+                       'cc', _cc,
+                       'bcc', _bcc,
+                       'dcc', _dcc,
+                       'address', ADDRESS,
+                       'subject', SUBJECT,
+                       'tags', _tags,
+                       'mt', _type_id,
+                       'type_id', _type_id,
+                       'priority', PRIORITY,
+                       'message', cast (_body as varchar),
+                       'folder_id', FOLDER_ID,
+                       'mstatus', MSTATUS,
+                       'attached', ATTACHED,
+                       'rcv_date', RCV_DATE,
+                       'dsize', DSIZE,
+                       'aparams', _aparams,
+                       'srv_msg_id', SRV_MSG_ID,
+                       'ref_id', REF_ID,
+                       'parent_id', PARENT_ID,
+                       'header', MHEADER,
+                       'options', M_OPTIONS);
 
     for (N := 0; N < length(_fields); N := N + 1)
-      aset(_fields, N, coalesce(_fields[N], ''));
+      _fields[N] := coalesce(_fields[N], '');
   }
   return _fields;
 }
@@ -2970,8 +3523,7 @@ create procedure OMAIL.WA.omail_get_mime_parts(
   inout _part_id    integer,
   inout _source     any,
   inout _mime_parts any,
-  in    _level       integer,
-  in    _certificate any := null)
+  in    _level       integer)
 {
   declare N,_body_beg,_body_end,_type_id,_pdefault,_dsize,_content_id,_att_fname,_freetext_id integer;
   declare _aparams,_encoding,_mime_type,_body,_dispos,_att_name varchar;
@@ -2982,7 +3534,7 @@ create procedure OMAIL.WA.omail_get_mime_parts(
     {
       if (isarray (aref (_mime_parts[N], 2)))
       {
-        OMAIL.WA.omail_get_mime_parts (_domain_id, _user_id, _msg_id, _parent_id, _folder_id, _part_id, _source, aref(_mime_parts[N],2), _level + 1, _certificate);
+        OMAIL.WA.omail_get_mime_parts (_domain_id, _user_id, _msg_id, _parent_id, _folder_id, _part_id, _source, aref(_mime_parts[N],2), _level + 1);
       }
       else if (isarray(aref(aref(_mime_parts[N],1),2)))
       {
@@ -3032,50 +3584,6 @@ create procedure OMAIL.WA.omail_get_mime_parts(
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_get_certificate (
-  inout _source      any,
-  inout _mime_parts  any)
-{
-  declare N,_body_beg,_body_end integer;
-  declare _encoding, _mime_type, _body, _dispos varchar;
-  declare _mime_part any;
-
-  _body := null;
-  for (N := 0; N < length (_mime_parts); N := N + 1)
-  {
-    _mime_part := _mime_parts[N];
-    if (isarray (_mime_part[0]))
-    {
-      if (isarray (_mime_part[2]))
-        goto _continue;
-
-      if (isarray (_mime_part[1][2]))
-        goto _continue;
-
-      _mime_type   := get_keyword_ucase('Content-Type',_mime_part[0],'');
-      if (_mime_type = 'application/x-pkcs7-signature')
-      {
-        -- dbg_obj_print (_mime_part[0]);
-        _encoding := get_keyword_ucase('Content-Transfer-Encoding', _mime_part[0], '');
-        _dispos   := get_keyword_ucase('Content-Disposition', _mime_part[0], '');
-        _body_beg := _mime_part[1][0];
-        _body_end := _mime_part[1][1];
-        _body     := subseq (blob_to_string (_source), _body_beg, _body_end + 1);
-        if (_encoding = 'base64')
-          _body   := decode_base64(_body);
-        --dbg_obj_print ('', length (_body));
-        --string_to_file ('source.eml', _source, 0);
-        --string_to_file ('cert.der', _body, 0);
-      }
-    }
-  _continue:;
-  }
-  return _body;
-}
-;
-
--------------------------------------------------------------------------------
---
 create procedure OMAIL.WA.omail_get_mimetype_name(
   in  _id   integer,
   out _name varchar)
@@ -3109,65 +3617,61 @@ create procedure OMAIL.WA.omail_get_mm_priority(
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_get_pop3_acc(
+create procedure OMAIL.WA.external_account_get (
   in _domain_id integer,
   in _user_id   integer,
-  in _acc_id    integer)
+  in _id integer)
 {
-  declare _rs,_sql_result1 varchar;
-  declare N integer;
+  declare _rs, _sql varchar;
 
-  N := 0;
   _rs  := '';
-
-  _sql_result1 := OMAIL.WA.omail_folders_list (_domain_id, _user_id, vector ());
-  if (_acc_id = 0)
+  _sql := OMAIL.WA.folders_list (_domain_id, _user_id);
+  if (_id = 0)
   { -- list
-    for (select * from OMAIL.WA.EXTERNAL_POP_ACC where DOMAIN_ID = _domain_id and USER_ID = _user_id) do
-    {
-      _rs  := sprintf('%s<acc>',_rs);
-      _rs  := sprintf('%s<acc_id>%d</acc_id>', _rs, ACC_ID);
-      _rs  := sprintf('%s<acc_name><![CDATA[%s]]></acc_name>', _rs, ACC_NAME);
-      _rs  := sprintf('%s<pop_server><![CDATA[%s]]></pop_server>', _rs, POP_SERVER);
-      _rs  := sprintf('%s<pop_port>%d</pop_port>',_rs, POP_PORT);
-      _rs  := sprintf('%s<user_name><![CDATA[%s]]></user_name>',_rs, USER_NAME);
-      _rs  := sprintf('%s<folder_id>%d</folder_id>',_rs, FOLDER_ID);
-      _rs  := sprintf('%s<last_check><![CDATA[%s]]></last_check>',_rs, case when isnull(LAST_CHECK) then '' else cast(LAST_CHECK as varchar) end);
-      _rs  := sprintf('%s<ch_error>%d</ch_error>',_rs, CH_ERROR);
-      _rs  := sprintf('%s%s', _rs, _sql_result1);
-      _rs  := sprintf('%s<intervals>%d</intervals>',_rs,CH_INTERVAL);
-      _rs  := sprintf('%s</acc>',_rs);
-      N := N + 1;
-    }
-  }
-  else if (_acc_id = -1)
+    for (select * from OMAIL.WA.EXTERNAL_ACCOUNT where EA_DOMAIN_ID = _domain_id and EA_USER_ID = _user_id) do
+    {
+      _rs  := sprintf ('%s<account>', _rs);
+      _rs  := sprintf ('%s<id>%d</id>', _rs, EA_ID);
+      _rs  := sprintf ('%s<name>%V</name>', _rs, EA_NAME);
+      _rs  := sprintf ('%s<type>%s</type>', _rs, EA_TYPE);
+      _rs  := sprintf ('%s<host>%V</host>', _rs, EA_HOST);
+      _rs  := sprintf ('%s<port>%d</port>', _rs, EA_PORT);
+      _rs  := sprintf ('%s<connect_type>%s</connect_type>', _rs, EA_TYPE);
+      _rs  := sprintf ('%s<user>%V</user>', _rs, EA_USER);
+      _rs  := sprintf ('%s<folder_id>%d</folder_id>', _rs, EA_FOLDER_ID);
+      _rs  := sprintf ('%s<check_date>%V</check_date>', _rs, case when isnull (EA_CHECK_DATE) then '' else cast (EA_CHECK_DATE as varchar) end);
+      _rs  := sprintf ('%s<check_error>%d</check_error>', _rs, EA_CHECK_ERROR);
+      _rs  := sprintf ('%s<check_interval>%d</check_interval>', _rs, EA_CHECK_INTERVAL);
+      _rs  := sprintf ('%s</account>', _rs);
+    }
+  }
+  else if (_id = -1)
   { -- new
-      _rs  := sprintf('%s<acc_edit>',_rs);
-      _rs  := sprintf('%s<acc_id>%d</acc_id>',_rs,0);
-      _rs  := sprintf('%s<pop_port>%d</pop_port>',_rs,110);
-      _rs  := sprintf('%s<mcopy>%d</mcopy>',_rs,0);
-      _rs  := sprintf('%s%s',_rs,_sql_result1);
-      _rs  := sprintf('%s<intervals>%d</intervals>',_rs,1);
-      _rs  := sprintf('%s<mcopy>%d</mcopy>',_rs,1);
-      _rs  := sprintf('%s</acc_edit>',_rs);
+    _rs  := '<id>0</id>' ||
+            '<port>100</port>' ||
+            '<check_interval>1</check_interval>' ||
+            '<mcopy>1</mcopy>' ||
+            _sql;
 
   }
   else
   { -- edit
-    for (select * from OMAIL.WA.EXTERNAL_POP_ACC where DOMAIN_ID = _domain_id and USER_ID = _user_id and ACC_ID = _acc_id) do
-    {
-      _rs  := sprintf('%s<acc_edit>',_rs);
-      _rs  := sprintf('%s<acc_id>%d</acc_id>', _rs, ACC_ID);
-      _rs  := sprintf('%s<acc_name><![CDATA[%s]]></acc_name>', _rs, ACC_NAME);
-      _rs  := sprintf('%s<pop_server><![CDATA[%s]]></pop_server>', _rs, POP_SERVER);
-      _rs  := sprintf('%s<pop_port>%d</pop_port>',_rs,POP_PORT);
-      _rs  := sprintf('%s<user_name><![CDATA[%s]]></user_name>', _rs, USER_NAME);
-      _rs  := sprintf('%s<user_pass><![CDATA[%s]]></user_pass>',_rs,'**********');
-      _rs  := sprintf('%s<folder_id>%d</folder_id>', _rs, FOLDER_ID);
-      _rs  := sprintf('%s%s',_rs,_sql_result1);
-      _rs  := sprintf('%s<intervals>%d</intervals>',_rs, CH_INTERVAL);
-      _rs  := sprintf('%s<mcopy>%d</mcopy>',_rs, MCOPY);
-      _rs  := sprintf('%s</acc_edit>',_rs);
+    for (select * from OMAIL.WA.EXTERNAL_ACCOUNT where EA_DOMAIN_ID = _domain_id and EA_USER_ID = _user_id and EA_ID = _id) do
+    {
+      _rs := sprintf ('<id>%d</id>', EA_ID) ||
+             sprintf ('<name>%V</name>', EA_NAME) ||
+             sprintf ('<type>%s</type>', EA_TYPE) ||
+             sprintf ('<host>%V</host>', EA_HOST) ||
+             sprintf ('<port>%d</port>', EA_PORT) ||
+             sprintf ('<connect_type>%s</connect_type>', EA_CONNECT_TYPE) ||
+             sprintf ('<user>%V</user>', EA_USER) ||
+             sprintf ('<password>%V</password>', '**********') ||
+             sprintf ('<folder_id>%d</folder_id>', EA_FOLDER_ID) ||
+             sprintf ('<mcopy>%d</mcopy>', EA_MCOPY) ||
+             sprintf ('<check_date>%V</check_date>', case when isnull (EA_CHECK_DATE) then '' else cast (EA_CHECK_DATE as varchar) end) ||
+             sprintf ('<check_error>%d</check_error>', EA_CHECK_ERROR) ||
+             sprintf ('<check_interval>%d</check_interval>', EA_CHECK_INTERVAL) ||
+             _sql;
     }
   }
   return _rs;
@@ -3186,8 +3690,10 @@ create procedure OMAIL.WA.omail_get_settings (
 
   _settings := coalesce((select deserialize(SVALUES) from OMAIL.WA.SETTINGS where DOMAIN_ID = _domain_id and USER_ID = _user_id and SNAME = _keyword), vector ());
   for (N := 1; N < length(_settings); N := N + 2)
+  {
     if (isnull(_settings[N]))
       aset(_settings, N, '');
+  }
 
   if (mod(length(_settings),2) <> 0)
     _settings := vector_concat(_settings,vector(''));
@@ -3240,6 +3746,34 @@ create procedure OMAIL.WA.omail_get_settings (
   if (OMAIL.WA.omail_getp('conversation', _settings) not in (0,1))
     OMAIL.WA.omail_setparam('conversation',_settings, 0);
 
+  if (isnull (OMAIL.WA.omail_getp ('security_sign', _settings)))
+  {
+    OMAIL.WA.omail_setparam ('security_sign', _settings, '');
+  } else {
+    if (not OMAIL.WA.certificateExist (_user_id, OMAIL.WA.omail_getp ('security_sign', _settings)))
+    {
+      OMAIL.WA.omail_setparam ('security_sign', _settings, '');
+    }
+  }
+  if ((OMAIL.WA.omail_getp ('security_sign_mode', _settings) not in (0, 1)) or (OMAIL.WA.omail_getp ('security_sign', _settings) = ''))
+  {
+    OMAIL.WA.omail_setparam ('security_sign_mode', _settings, 0);
+  }
+
+  if (isnull (OMAIL.WA.omail_getp ('security_encrypt', _settings)))
+  {
+    OMAIL.WA.omail_setparam ('security_encrypt', _settings, '');
+  } else {
+    if (not OMAIL.WA.certificateExist (_user_id, OMAIL.WA.omail_getp ('security_encrypt', _settings)))
+    {
+      OMAIL.WA.omail_setparam ('security_encrypt', _settings, '');
+    }
+  }
+  if ((OMAIL.WA.omail_getp ('security_encrypt_mode', _settings) not in (0, 1)) or (OMAIL.WA.omail_getp ('security_encrypt', _settings) = ''))
+  {
+    OMAIL.WA.omail_setparam ('security_encrypt_mode', _settings, 0);
+  }
+
   OMAIL.WA.omail_setparam ('discussion', _settings, OMAIL.WA.discussion_check ());
   OMAIL.WA.omail_setparam('update_flag', _settings, 0);
 
@@ -3264,6 +3798,33 @@ create procedure OMAIL.WA.omail_set_settings_data(
 
 -------------------------------------------------------------------------------
 --
+create procedure OMAIL.WA.dashboard_rs (
+  in p0 integer,
+  in p1 integer)
+{
+  declare S, posts, _id, _title, _time any;
+  declare c0 integer;
+  declare c1 varchar;
+  declare c2 datetime;
+
+  result_names(c0, c1, c2);
+  S := OMAIL.WA.dashboard_get (p0, p1);
+  if (S <> '')
+  {
+    posts := xpath_eval ('//mail', xml_tree_doc (xml_tree(S)), 0);
+    foreach (any post in posts) do
+    {
+      _id    := cast (xpath_eval ('@id', post) as integer);
+      _title := serialize_to_UTF8_xml (xpath_eval ('string(./title)', post));
+      _time  := stringdate (xpath_eval ('string(./dt)', post));
+      result (_id, _title, _time);
+    }
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create procedure OMAIL.WA.dashboard_get(
   in _domain_id integer,
   in _user_id integer)
@@ -3304,7 +3865,8 @@ create procedure OMAIL.WA.dashboard_update(
   stream := string_output ();
   http ('<mail-db>', stream);
 
-  if (not is_empty_or_null(dashboard)) {
+  if (not is_empty_or_null(dashboard))
+  {
     declare xt, xp, xn any;
     declare i, l int;
 
@@ -3318,7 +3880,8 @@ create procedure OMAIL.WA.dashboard_update(
     i := 0;
     if ((l = 10) and isnull(xn))
       i := 1;
-    for (;i < l; i := i + 1) {
+    for (;i < l; i := i + 1)
+    {
       if (cast(xpath_eval ('number(@id)', xp[i], 1) as integer) <> _msg_id)
   	    http (serialize_to_UTF8_xml (xp[i]), stream);
   	}
@@ -3329,7 +3892,7 @@ create procedure OMAIL.WA.dashboard_update(
          '<mail id="%d">'||
            '<title><![CDATA[%s]]></title>'||
            '<dt>%s</dt>'||
-           '<link>%s</link>' ||
+           '<link>%V</link>' ||
            '<from><![CDATA[%s]]></from>'||
            '<email><![CDATA[%s]]></email>'||
          '</mail>',
@@ -3357,14 +3920,16 @@ create procedure OMAIL.WA.dashboard_delete(
   stream := string_output ();
   http ('<mail-db>', stream);
 
-  if (not is_empty_or_null(dashboard)) {
+  if (not is_empty_or_null(dashboard))
+  {
     declare xt, xp any;
     declare i, l int;
 
     xt := xtree_doc (dashboard);
     xp := xpath_eval ('/mail-db/*', xt, 0);
     l := length (xp);
-    for (i := 0; i < l; i := i + 1) {
+    for (i := 0; i < l; i := i + 1)
+    {
       if (cast(xpath_eval ('number(@id)', xp[i], 1) as integer) <> _msg_id)
   	    http (serialize_to_UTF8_xml (xp[i]), stream);
 	  }
@@ -3505,13 +4070,20 @@ create procedure OMAIL.WA.omail_init_user_data(
   in _user_id   integer,
   in _address   varchar := null)
 {
-  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME) values (_domain_id, _user_id, 100, 0,   'Inbox');
-  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME) values (_domain_id, _user_id, 110, 0,   'Trash');
-  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME) values (_domain_id, _user_id, 120, 0,   'Sent');
-  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME) values (_domain_id, _user_id, 130, 0,   'Draft');
-  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME) values (_domain_id, _user_id, 125, 0,   'Spam');
-  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME) values (_domain_id, _user_id, 115, 0,   'Smart Folders');
-  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME) values (_domain_id, _user_id, 116, 115, 'Unread Mails');
+  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME, F_TYPE)
+    values (_domain_id, _user_id, 100, 0, 'Inbox', 'INBOX');
+  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME, F_TYPE)
+    values (_domain_id, _user_id, 110, 0, 'Trash', 'TRASH');
+  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME, F_TYPE)
+    values (_domain_id, _user_id, 120, 0, 'Sent', 'SENT');
+  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME, F_TYPE)
+    values (_domain_id, _user_id, 130, 0, 'Drafts', 'DRAFTS');
+  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME, F_TYPE)
+    values (_domain_id, _user_id, 125, 0, 'Spam', 'SPAM');
+  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME)
+    values (_domain_id, _user_id, 115, 0, 'Smart Folders');
+  insert soft OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, FOLDER_ID, PARENT_ID, NAME)
+    values (_domain_id, _user_id, 116, 115, 'Unread Mails');
 
   update OMAIL.WA.FOLDERS
      set PARENT_ID = 0, SEQ_NO = 1, NAME = 'Inbox', SYSTEM_FLAG = 'S'
@@ -3523,7 +4095,7 @@ create procedure OMAIL.WA.omail_init_user_data(
      set PARENT_ID = 0, SEQ_NO = 2, NAME = 'Sent', SYSTEM_FLAG = 'S'
    where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = 120;
   update OMAIL.WA.FOLDERS
-     set PARENT_ID = 0, SEQ_NO = 3, NAME = 'Draft', SYSTEM_FLAG = 'S'
+     set PARENT_ID = 0, SEQ_NO = 3, NAME = 'Drafts', SYSTEM_FLAG = 'S'
    where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = 130;
   update OMAIL.WA.FOLDERS
      set PARENT_ID = 0, SEQ_NO = 4, NAME = 'Spam', SYSTEM_FLAG = 'S'
@@ -3550,7 +4122,7 @@ create procedure OMAIL.WA.omail_welcome_msg(
 {
   declare _text any;
 
-  _text := OMAIL.WA.omail_welcome_msg_1('Mail admin','admin at domain.com',_address,_address,OMAIL.WA.omail_tstamp_to_mdate(now()));
+  _text := OMAIL.WA.omail_welcome_msg_1 ('Mail admin','admin at domain.com',_address,_address,OMAIL.WA.dt_rfc822(now()));
   OMAIL.WA.omail_receive_message(_domain_id,_user_id, null, _text, null, -1, 100);
 }
 ;
@@ -3730,7 +4302,7 @@ create procedure OMAIL.WA.omail_message(
 {
   -- www procedure
 
-  declare _rs,_sid,_realm,_op,_sql_result1,_sql_result2,_sql_result3,_sql_result4,_sql_result5,_pnames varchar;
+  declare _rs, _sid, _realm, _op, _sql_result1, _sql_result2, _sql_result3, _sql_result4, _sql_result5, _sql_result6, _pnames varchar;
   declare _params,_page_params any;
   declare _user_info,_settings any;
   declare _user_id,_folder_id,_error,_domain_id integer;
@@ -3765,25 +4337,18 @@ create procedure OMAIL.WA.omail_message(
   -- Form Action---------------------------------------------------------------------
   if (get_keyword ('fa_move.x', params,'') <> '')
   {
-    _rs := OMAIL.WA.omail_move_msg(_domain_id,_user_id,params);
-    if (_rs = '1')
-    {
-      OMAIL.WA.omail_setparam('folder_id',_params,atoi(_folder_id));
-      _op := OMAIL.WA.omail_params2str(_pnames,_params,',');
-      OMAIL.WA.utl_redirect(sprintf('open.vsp?sid=%s&realm=%s&op=%s%s',_sid,_realm,_op,OMAIL.WA.omail_external_params_url(params)));
-      return;
-    } else {
+    OMAIL.WA.messages_move (_domain_id, _user_id, params);
       _op := OMAIL.WA.omail_params2str(_pnames,_params,',');
       OMAIL.WA.utl_redirect(sprintf('open.vsp?sid=%s&realm=%s&op=%s',_sid,_realm,_op));
       return;
     }
-
-  }
   else if (get_keyword ('fa_mark.x', params,'') <> '')
-  { -- > 'mark msg'
+  {
+    -- > 'mark msg'
     OMAIL.WA.omail_setparam('ch_mstatus',_params,1);
     OMAIL.WA.omail_mark_msg(_domain_id,_user_id, OMAIL.WA.omail_getp('msg_id',_params), atoi(get_keyword('ms',params,'1')));
-    if (_error = 0){
+    if (_error = 0)
+    {
       _op := OMAIL.WA.omail_params2str(_pnames,_params,',');
        OMAIL.WA.utl_redirect(sprintf('open.vsp?sid=%s&realm=%s&op=%s%s',_sid,_realm,_op,OMAIL.WA.omail_external_params_url(params)));
       return;
@@ -3824,8 +4389,9 @@ create procedure OMAIL.WA.omail_message(
   _sql_result1 := OMAIL.WA.omail_open_message(_domain_id,_user_id,_params, 1, 1);
   _sql_result2 := OMAIL.WA.omail_select_next_prev(_domain_id,_user_id,_params);
   _sql_result3 := OMAIL.WA.omail_select_attachment(_domain_id,_user_id,OMAIL.WA.omail_getp ('msg_id',_params), 0);
-  _sql_result5 := OMAIL.WA.omail_select_attachment_msg(_domain_id,_user_id,OMAIL.WA.omail_getp ('msg_id',_params), 0);
-  _sql_result4 := OMAIL.WA.omail_folders_list (_domain_id, _user_id, _params);
+  _sql_result4 := OMAIL.WA.omail_select_attachment_msg(_domain_id, _user_id, OMAIL.WA.omail_getp ('msg_id',_params), 0);
+  _sql_result5 := OMAIL.WA.folders_list (_domain_id, _user_id);
+  _sql_result6 := OMAIL.WA.folders_combo_list (_domain_id, _user_id, OMAIL.WA.message_folder (_domain_id, _user_id, OMAIL.WA.omail_getp ('msg_id',_params)));
 
   -- Page Params---------------------------------------------------------------------
   aset(_page_params,0,vector('sid',_sid));
@@ -3835,15 +4401,11 @@ create procedure OMAIL.WA.omail_message(
   aset(_page_params,4,vector('user_info',OMAIL.WA.array2xml(_user_info)));
 
   -- XML structure-------------------------------------------------------------------
-  _rs := '';
-  _rs := sprintf('%s%s',_rs,OMAIL.WA.omail_page_params(_page_params));
+  _rs := OMAIL.WA.omail_page_params(_page_params);
   _rs := sprintf('%s<message>', _rs);
-  _rs := sprintf('%s%s',_rs,_sql_result1);
-  _rs := sprintf('%s%s',_rs,_sql_result2);
+  _rs := sprintf ('%s%s%s', _rs, _sql_result1, _sql_result2);
   _rs := sprintf('%s</message>', _rs);
-  _rs := sprintf('%s%s',_rs,_sql_result3);
-  _rs := sprintf('%s%s',_rs,_sql_result5);
-  _rs := sprintf('%s%s',_rs,_sql_result4);
+  _rs := sprintf ('%s%s%s%s%s', _rs, _sql_result3, _sql_result4, _sql_result5, _sql_result6);
   _rs := sprintf('%s%s',_rs,OMAIL.WA.omail_external_params_xml(params));
 
   return _rs;
@@ -3880,7 +4442,10 @@ create procedure OMAIL.WA.omail_message_body_parse(
 
   update OMAIL.WA.MSG_PARTS
      set CONTENT_ID = OMAIL.WA.omail_message_body_parse_func(_content_id,PART_ID,_body)
-   where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id and PDEFAULT = 0;
+   where DOMAIN_ID = _domain_id
+     and USER_ID = _user_id
+     and MSG_ID = _msg_id
+     and PDEFAULT = 0;
 }
 ;
 
@@ -3925,8 +4490,8 @@ create procedure OMAIL.WA.omail_message_list(
          from OMAIL.WA.MESSAGES
         where USER_ID = _user_id
           and FOLDER_ID = _folder_id
-        ORDER BY MSTATUS)
-  do {
+        ORDER BY MSTATUS) do
+  {
     if (N >= (_skipped + _pageSize))
       return _rs;
     _rows := vector(SUBJECT,ATTACHED,ADDRESS,DSIZE,MSG_ID,MSTATUS,PRIORITY,RCV_DATE);
@@ -3940,39 +4505,7 @@ create procedure OMAIL.WA.omail_message_list(
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_move_msg(
-  in _domain_id integer,
-  in _user_id   integer,
-  inout _params any)
-{
-  declare N,_folder_id integer;
-  declare _sql varchar;
-  declare _msgs,_sql_params,_pit any;
-
-  _msgs := vector();
-  _pit  := vector();
-  _folder_id  := cast(get_keyword('fid',_params,'') as integer);
-  for (N := 0; N < length (_params); N := N + 2)
-  {
-    if (_params[N] = 'ch_msg')
-    {
-      _msgs := vector_concat(_msgs,vector(cast(_params[N + 1] as integer)));
-      _pit  := vector_concat(_pit,vector('?'));
-    }
-  }
-  if (length (_msgs) > 0)
-  {
-    _sql := sprintf ('update OMAIL.WA.MESSAGES set FOLDER_ID = ? where DOMAIN_ID = ? and USER_ID = ? and MSG_ID IN (%s)',OMAIL.WA.omail_array2string(_pit,','));
-    _sql_params := vector_concat(vector(_folder_id,_domain_id,_user_id),_msgs); -- [0]folder_id,[1]domain_id,[2]user_id,[3][4]... -> MSG_IDs
-    return OMAIL.WA.omail_select_exec(_sql,_sql_params);
-  }
-  return '0';
-}
-;
-
--------------------------------------------------------------------------------
---
-create procedure OMAIL.WA.omail_msg_list(
+create procedure OMAIL.WA.messages_list (
   in _domain_id integer,
   in _user_id integer,
   in _params any)
@@ -4356,7 +4889,7 @@ _NOT_FOUND:
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_email_search_str(
+create procedure OMAIL.WA.email_search_str(
   in S varchar)
 {
   declare N, L integer;
@@ -4473,14 +5006,14 @@ create procedure OMAIL.WA.omail_msg_search(
     }
 
     _aquery := '';
-    tmp := OMAIL.WA.omail_email_search_str(get_keyword('q_from', _params, ''));
+    tmp := OMAIL.WA.email_search_str(get_keyword ('q_from', _params, ''));
     if ((tmp = '') and (get_keyword('q_from', _params, '') <> ''))
       signal ('TEST', 'Field ''From'' contains invalid characters!<>');
 
     if (tmp <> '')
       _aquery := sprintf('%s and //from[text-contains(.,"%s")]', _aquery, tmp);
 
-    tmp := OMAIL.WA.omail_email_search_str(get_keyword('q_to', _params, ''));
+    tmp := OMAIL.WA.email_search_str (get_keyword ('q_to', _params, ''));
     if ((tmp = '') and (get_keyword('q_to', _params, '') <> ''))
       signal ('TEST', 'Field ''To'' contains invalid characters!<>');
     if (tmp <> '')
@@ -4543,7 +5076,7 @@ create procedure OMAIL.WA.omail_msg_search(
     _sql := _sql_statm;
 
     _aquery := '';
-    tmp := OMAIL.WA.omail_email_search_str(get_keyword('q', _params, ''));
+    tmp := OMAIL.WA.email_search_str(get_keyword ('q', _params, ''));
     if (tmp <> '') {
       _aquery := sprintf('and //*[text-contains(.,"%s")]', tmp);
 
@@ -4595,7 +5128,7 @@ create procedure OMAIL.WA.omail_open_message(
   _realm     := get_keyword('realm',_params,'');
   _dload_url := sprintf('dload.vsp?sid=%s&realm=%s&dp=%s',_sid,_realm,'%d,%d');
 
-  if ((OMAIL.WA.omail_getp ('re_mode',_params) = 1) or (OMAIL.WA.omail_getp ('re_mode',_params) = 2))
+  if (OMAIL.WA.omail_getp ('re_mode', _params) in (1, 2))
   {
     -- user make reply msg (1 - reply; 2 - reply to all)
     --
@@ -4734,9 +5267,8 @@ create procedure OMAIL.WA.omail_open_message(
     {
     _ab_id := OMAIL.WA.check_app (_user_id, 'AddressBook');
     if (_ab_id <> 0)
-      _addContact := AB.WA.ab_url (_ab_id);
+        _addContact := AB.WA.forum_iri (_ab_id);
     }
-
     _rs := sprintf ('%s<msg_id>%d</msg_id>\n', _rs, get_keyword ('msg_id', _fields));
     _rs := sprintf ('%s<ref_id>%s</ref_id>\n', _rs, get_keyword ('ref_id', _fields));
     _rs := sprintf('%s<parent_id>%d</parent_id>\n', _rs, get_keyword('parent_id',_fields));
@@ -4750,12 +5282,13 @@ create procedure OMAIL.WA.omail_open_message(
     _rs := sprintf ('%s<tags>%s</tags>\n', _rs, get_keyword ('tags', _fields));
     _rs := sprintf('%s<mime_list>%s</mime_list>\n', _rs, _mime_list);
     _rs := sprintf ('%s<rcv_date>%s</rcv_date>\n', _rs, cast(get_keyword ('rcv_date', _fields) as varchar));
-    _rs := sprintf ('%s<to_snd_date>%s</to_snd_date>\n', _rs, OMAIL.WA.omail_tstamp_to_mdate (get_keyword ('rcv_date', _fields, '')));
+    _rs := sprintf ('%s<to_snd_date>%s</to_snd_date>\n', _rs, OMAIL.WA.dt_rfc822 (get_keyword ('rcv_date', _fields, '')));
     _rs := sprintf ('%s<address>%s</address>\n', _rs, get_keyword ('address', _fields));
     _rs := sprintf ('%s<mheader><![CDATA[%s]]></mheader>\n', _rs, coalesce(get_keyword ('header', _fields), ''));
     _rs := sprintf('%s<replyTo><![CDATA[%s]]></replyTo>\n', _rs, _replyTo);
     _rs := sprintf('%s<displayName><![CDATA[%s]]></displayName>\n', _rs, _displayName);
     _rs := sprintf ('%s<addContact>%s</addContact>\n', _rs, OMAIL.WA.xml2string (_addContact));
+    _rs := sprintf ('%s%s\n', _rs, get_keyword ('options', _fields));
 
     if ((_type_id = 10110) and (OMAIL.WA.omail_getp ('_html_parse',_params) <> 0))
     {
@@ -4839,40 +5372,35 @@ create procedure OMAIL.WA.omail_open_message_full(
   in    _user_id    integer,
   in    _msg_id     any)
 {
-  declare _boundary,_b,_e,_rs,folder_id,srv_msg_id,ref_id,mstatus,attached,address,rcv_date,snd_date,mheader,dsize,priority,subject,addres_info,parent_id,N,_hh any;
-  _rs  := '';
-  N := 0;
+  declare _boundary,_b,_e,_rs,mstatus,attached,address,mheader,N,_hh any;
 
-      select MHEADER
-        INTO mheader
-        from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID =_msg_id;
-
-      mheader := coalesce(mheader,'');
+  mheader := coalesce( (select MHEADER from OMAIL.WA.MESSAGES where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID =_msg_id), '');
       _b := locate('boundary="',mheader,1);
-      if (_b > 0){
+  if (_b > 0)
+  {
         _e := locate('"',mheader,_b+10);
         _boundary := sprintf('<boundary>%s</boundary>\n',subseq(mheader,_b+9,_e-1));
       } else {
         _boundary := '';
-      };
+  }
 
       -- decode message body
-      _hh := sprintf('<mheader><![CDATA[%s]]></mheader>\n',mheader);
-      _hh := sprintf('%s%s\n',_hh,_boundary);
-
-
-      for (select TYPE_ID,CONTENT_ID,FNAME,TDATA,BDATA,PDEFAULT,APARAMS,PART_ID
+  N := 0;
+  _rs := '';
+  _hh := sprintf ('<mheader><![CDATA[%s]]></mheader>\n%s\n', mheader, _boundary);
+  for (select TDATA, BDATA, APARAMS
              from OMAIL.WA.MSG_PARTS
-            where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id and PDEFAULT = 1)
-      do{
+        where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id and PDEFAULT = 1) do
+  {
           _rs := sprintf('%s<mbody>\n',_rs);
           _rs := sprintf('%s<aparams>%s</aparams>\n',_rs,coalesce(APARAMS,''));
           _rs := sprintf('%s<mtext><![CDATA[%s]]></mtext>\n',_rs,coalesce(TDATA,BDATA));
           _rs := sprintf('%s</mbody>\n',_rs);
           N := N + 1;
-      };
+  }
 
-      if (N > 1){
+  if (N > 1)
+  {
          _hh := sprintf('%s<alternative>\n',_hh);
          _hh := sprintf ('%s<boundary2>%s</boundary2>\n', _hh,sprintf ('------2_NextPart_%s',md5 (concat (cast (now() as varchar), 'xx'))));
          _hh := sprintf('%s%s',_hh,_rs);
@@ -4880,10 +5408,8 @@ create procedure OMAIL.WA.omail_open_message_full(
 
       } else {
          _hh := sprintf('%s%s',_hh,_rs);
-      };
-
-  _hh := sprintf('%s%s',_hh,OMAIL.WA.omail_select_attachment(_domain_id,_user_id,_msg_id,1));
-  return _hh;
+  }
+  return _hh || OMAIL.WA.omail_select_attachment(_domain_id, _user_id, _msg_id, 1);
 }
 ;
 
@@ -4899,8 +5425,8 @@ create procedure OMAIL.WA.omail_open_message_images(
 {
   for(select MSG_ID,PART_ID,CONTENT_ID
         from OMAIL.WA.MSG_PARTS
-       where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id and TYPE_ID >= _type_id and TYPE_ID < (_type_id + 10000) and CONTENT_ID IS NOT NULL)
-  do {
+        where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id and TYPE_ID >= _type_id and TYPE_ID < (_type_id + 10000) and CONTENT_ID IS NOT NULL) do
+  {
     _body := replace(_body,concat('cid:',CONTENT_ID),sprintf(_url,MSG_ID,PART_ID));
   }
 }
@@ -4936,17 +5462,14 @@ create procedure OMAIL.WA.omail_params2str(
   in _params     any,
   in _separator varchar)
 {
-  declare _string,_names_arr,_values_arr any;
-  declare _len,N,_int integer;
+  declare _string, _names_arr any;
+  declare N integer;
+
   _string := '';
   _names_arr  := split_and_decode(_names,0,concat('\0\0',_separator));
+  for (N := 0; N < length (_names_arr); N := N + 1)
+    _string := sprintf ('%s,%d',_string, get_keyword(_names_arr[N], _params, ''));
 
-  N := 0;
-  _len := length(_names_arr);
-  while(N < _len){
-     _string := sprintf('%s,%d',_string,get_keyword(aref(_names_arr,N),_params,''));
-     N := N + 1;
-  }
   return substring(_string,2,length(_string));
 }
 ;
@@ -4990,22 +5513,19 @@ create procedure OMAIL.WA.omail_preview(
   _params := OMAIL.WA.omail_str2params(_pnames,get_keyword('wp',params,'100,0,0,0'),',');
 
   -- SQL Statement-------------------------------------------------------------------
-  if (OMAIL.WA.omail_getp('msg_id',_params) <> 0) {
+  if (OMAIL.WA.omail_getp ('msg_id',_params) <> 0)
+  {
     _sql_result1 := sprintf('%s',OMAIL.WA.omail_open_message(_domain_id,_user_id,OMAIL.WA.omail_getp('msg_id',_params),1,1));
     _sql_result2 := sprintf('%s',OMAIL.WA.omail_select_attachment(_domain_id,_user_id,OMAIL.WA.omail_getp('msg_id',_params),0));
-    if (length(_sql_result1) = 0) {
+    if (length (_sql_result1) = 0)
+    {
       OMAIL.WA.utl_redirect(sprintf('write.vsp?sid=%s&realm=%s&wp=%d',_sid,_realm,0));
       return;
     }
   }
 
   -- XML structure-------------------------------------------------------------------
-  _rs := '';
-  _rs := sprintf('%s<message>', _rs);
-  _rs := sprintf('%s%s',_rs,_sql_result1);
-  _rs := sprintf('%s</message>', _rs);
-
-  return _rs;
+  return '<message>' || _sql_result1 || '</message>';
 }
 ;
 
@@ -5045,8 +5565,8 @@ create procedure OMAIL.WA.omail_print(
   OMAIL.WA.omail_setparam('realm',_params,_realm);
 
   -- SQL Statement-------------------------------------------------------------------
-  _sql_result1 := sprintf('%s',OMAIL.WA.omail_open_message(_domain_id,_user_id,_params,1,1));
-  _sql_result3 := sprintf('%s',OMAIL.WA.omail_select_attachment(_domain_id,_user_id,OMAIL.WA.omail_getp('msg_id',_params),0));
+  _sql_result1 := OMAIL.WA.omail_open_message (_domain_id, _user_id, _params, 1, 1);
+  _sql_result3 := OMAIL.WA.omail_select_attachment (_domain_id, _user_id, OMAIL.WA.omail_getp ('msg_id', _params), 0);
 
   -- Page Params---------------------------------------------------------------------
   aset(_page_params,0,vector('sid',_sid));
@@ -5056,13 +5576,7 @@ create procedure OMAIL.WA.omail_print(
   aset(_page_params,4,vector('user_info',OMAIL.WA.array2xml(_user_info)));
 
   -- XML structure-------------------------------------------------------------------
-  _rs := '';
-  _rs := sprintf('%s%s',_rs,OMAIL.WA.omail_page_params(_page_params));
-  _rs := sprintf('%s<message>', _rs);
-  _rs := sprintf('%s%s',_rs,_sql_result1);
-  _rs := sprintf('%s</message>', _rs);
-  _rs := sprintf('%s%s',_rs,_sql_result3);
-
+  _rs := OMAIL.WA.omail_page_params (_page_params) || '<message>' || _sql_result1 || '</message>' || _sql_result3;
   return _rs;
 }
 ;
@@ -5086,7 +5600,7 @@ create procedure OMAIL.WA.spam_clean_schedule ()
               and FOLDER_ID = 125
               and RCV_DATE < dateadd ('day', -_days, _now)) do
       {
-        OMAIL.WA.omail_del_message(_domain_id, _user_id, _msg_id);
+        OMAIL.WA.message_erase (_domain_id, _user_id, _msg_id);
       }
     }
   }
@@ -5185,9 +5699,10 @@ create procedure OMAIL.WA.omail_receive_message(
   inout _source      any,
   in    _uniq_msg_id integer,
   in    _msg_source  integer, -- ( '-1' ->SMTP; '0' ->inside; '>0' - from POP3 account)
-  in    _folder_id   integer)
+  in    _folder_id   integer,
+  in    _mode        integer := 0)
 {
-  declare _subject, _tags, _from, _returnPath, _to, _cc, _bcc, _srv_msg_id, _ref_id, _mime_type, _protocol, _certificate, _address, _address_info, _mstatus, _attached, _mheader, _att_fname varchar;
+  declare _subject, _tags, _from, _returnPath, _to, _cc, _bcc, _srv_msg_id, _ref_id, _mime_type, _protocol, _options, _address, _address_info, _mstatus, _attached, _mheader, _att_fname varchar;
   declare _body, _bodys, _parts, _attrs,_snd_date,_rcv_date,_body_parts,_message,_usern, _settings any;
   declare _body_beg, _body_end,_msg_id,_priority,_dsize,N,_freetext_id integer;
 
@@ -5195,22 +5710,21 @@ create procedure OMAIL.WA.omail_receive_message(
     signal('0001','Not a mail msg');
 
   _message := mime_tree(_source);
+  if (not (isarray (_message)) and _mode)
+    _message := vector (mime_header (_source), vector (3, 0), 0);
+
   if (not(isarray(_message)))
     return 0;
 
-  _attrs   := aref(_message, 0);
-  _bodys   := aref(_message, 1);
-  _parts   := aref(_message, 2);
-
-  if (not(isarray(_attrs)))
+  if (not (isarray(_message[0])))
     return 0;
 
-  --dbg_obj_print ('_attrs', _attrs);
-  --dbg_obj_print ('_bodys', _bodys);
-  --dbg_obj_print ('_parts', _parts);
+  _attrs := _message[0];
+  _bodys := _message[1];
+  _parts := _message[2];
+
   _msg_id        := sequence_next ('OMAIL.WA.omail_seq_eml_msg_id');
   _freetext_id   := sequence_next ('OMAIL.WA.omail_seq_eml_freetext_id');
-  _subject       := get_keyword_ucase('Subject',_attrs,'');
   _from          := get_keyword_ucase('From',_attrs,'');
   _returnPath    := get_keyword_ucase ('Return-Path',_attrs, '');
   _to            := get_keyword_ucase('To',_attrs,'');
@@ -5224,41 +5738,74 @@ create procedure OMAIL.WA.omail_receive_message(
   if (_mime_type = '')
     _mime_type := 'text/plain';
 
+  _options       := vector ();
   _mstatus       := 0;
   _attached      := 0;
   _tags          := '';
   _settings      := OMAIL.WA.omail_get_settings (_domain_id, _user_id, 'base_settings');
 
-  -- signature
+  -- encrypted
   --
-  _certificate   := null;
-  --dbg_obj_print ('_mime_type', _mime_type);
-  if (_mime_type = 'multipart/signed')
+  if (_mime_type = 'application/x-pkcs7-mime')
   {
-    if (get_keyword_ucase ('protocol', _attrs, '') = 'application/x-pkcs7-signature')
-      _certificate := OMAIL.WA.omail_get_certificate (_source, _parts);
+    declare _decrypted, _keys any;
+
+    _keys := OMAIL.WA.certificate (_domain_id, _user_id);
+    _source := smime_decrypt (_source, _keys[0], _keys[1], null);
+    _message := mime_tree (_source);
+    if (not (isarray (_message)) and _mode)
+      _message := vector (mime_header (_source), vector (3, 0), 0);
+
+    if (not (isarray (_message)))
+      return 0;
+
+    if (not (isarray(_message[0])))
+      return 0;
+
+    _attrs := _message[0];
+    _bodys := _message[1];
+    _parts := _message[2];
   }
-  --dbg_obj_print (now());
-  --dbg_obj_print ('_certificate', _certificate);
-  --string_to_file (uuid () || '.eml', _source, 0);
-  if (not isnull (_certificate))
+  _mime_type := get_keyword_ucase ('Content-Type', _attrs, '');
+  _subject   := OMAIL.WA.utl_decode_field (get_keyword_ucase ('Subject',_attrs,''));
+
+  -- signature
+  --
+  if (_mime_type = 'multipart/signed')
   {
-    declare x any;
+    if (get_keyword_ucase ('protocol', _attrs, '') in ('application/x-pkcs7-signature', 'application/pkcs7-signature'))
+    {
+      declare tmp, certificate any;
 
-    x := file_to_string ('smime/X.eml');
-    -- dbg_obj_print ('verify0: ', smime_verify (x, vector (file_to_string ('ca-bundle.crt'))));
-    -- dbg_obj_print ('verify1: ', smime_verify (_source, vector (file_to_string ('ca-bundle.crt'))));
-    -- dbg_obj_print (get_certificate_info (1, _certificate, 1, null, null));
-    -- dbg_obj_print (get_certificate_info (2, _certificate, 1, null, null));
-    -- dbg_obj_print (get_certificate_info (3, _certificate, 1, null, null));
-    -- dbg_obj_print (get_certificate_info (4, _certificate, 1, null, null));
-    -- dbg_obj_print (get_certificate_info (5, _certificate, 1, null, null));
-    -- dbg_obj_print (get_certificate_info (6, _certificate, 1, null, null));
-    -- dbg_obj_print (get_certificate_info (7, _certificate, 1, null, null));
-    -- dbg_obj_print (get_certificate_info (8, _certificate, 1, null, null));
-    -- dbg_obj_print (get_certificate_info (9, _certificate, 1, null, null));
+      certificate := null;
+      {
+        declare continue handler for SQLSTATE '*'
+        {
+          -- dbg_obj_print ('', __SQL_STATE, __SQL_MESSAGE);
+          _options := vector ();
+          goto _1;
+        };
+        tmp := smime_verify (_source, X509_ROOT_CA_CERTS (), certificate);
   }
+      OMAIL.WA.omail_setparam ('ssl', _options, 1);
+      if (not isnull (tmp))
+        OMAIL.WA.omail_setparam ('sslVerified', _options, 1);
+
+    _1:;
+      if (not isnull (certificate))
+      {
+        declare webID any;
 
+        webID := DB.DBA.FOAF_SSL_WEBID_GET (certificate[0]);
+        if (not isnull (webID))
+        {
+          OMAIL.WA.omail_setparam ('webID', _options, webID);
+          if (DB.DBA.FOAF_CHECK_WEBID (webID))
+            OMAIL.WA.omail_setparam ('webIDVerified', _options, 1);
+        }
+      }
+    }
+  }
   -- spam sender?
   if (cast(get_keyword ('spam', _settings, '0') as integer) > 0)
   {
@@ -5313,16 +5860,16 @@ create procedure OMAIL.WA.omail_receive_message(
     _priority  := 3;
   }
 
-  _address  := '<addres_list>';
-  _address  := sprintf('%s%s',_address,OMAIL.WA.omail_address2xml('to', _to,0));
-  _address  := sprintf('%s%s',_address,OMAIL.WA.omail_address2xml('from', _from,0));
-  _address  := sprintf('%s%s',_address,OMAIL.WA.omail_address2xml('cc', _cc,0));
-  _address  := sprintf('%s%s',_address,OMAIL.WA.omail_address2xml('bcc', _bcc,0));
-  _address  := sprintf('%s</addres_list>',_address);
+  _address  := '<addres_list>' ||
+              OMAIL.WA.omail_address2xml ('to',   _to,   0) ||
+              OMAIL.WA.omail_address2xml ('from', _from, 0) ||
+              OMAIL.WA.omail_address2xml ('cc',   _cc,   0) ||
+              OMAIL.WA.omail_address2xml ('bcc',  _bcc,  0) ||
+              '</addres_list>';
 
   _rcv_date := now();
-  _snd_date := http_string_date (_snd_date);
-  _mheader  := substring(subseq (_source, 0, aref(_bodys,0) - 3),1,1000);
+  _snd_date := OMAIL.WA.dt_convert (_snd_date);
+  _mheader  := subseq (_source, 0, case when (_bodys[0]-3) < 1000 then _bodys[0]-3 else 1000 end);
   _dsize    := length(_source);
 
   _srv_msg_id := replace(_srv_msg_id,'<','');
@@ -5332,32 +5879,54 @@ create procedure OMAIL.WA.omail_receive_message(
   _subject    := replace(_subject,'>','>');
   _subject    := replace(_subject,'<','<');
 
-  insert into OMAIL.WA.MESSAGES(FREETEXT_ID,DOMAIN_ID,MSG_ID,USER_ID,ADDRES_INFO,FOLDER_ID,MSTATUS,ATTACHED,ADDRESS,RCV_DATE,SND_DATE,MHEADER,DSIZE,PRIORITY,SUBJECT,SRV_MSG_ID,REF_ID,PARENT_ID,UNIQ_MSG_ID,MSG_SOURCE)
-    values (_freetext_id,_domain_id,_msg_id,_user_id,_address_info,_folder_id,_mstatus,_attached,_address,_rcv_date,_snd_date,_mheader,_dsize,_priority,_subject,_srv_msg_id,_ref_id,_parent_id,_uniq_msg_id,_msg_source);
+  insert into OMAIL.WA.MESSAGES (FREETEXT_ID, DOMAIN_ID, MSG_ID, USER_ID, ADDRES_INFO, FOLDER_ID, MSTATUS, ATTACHED, ADDRESS, RCV_DATE, SND_DATE, MHEADER, DSIZE, PRIORITY, SUBJECT, SRV_MSG_ID, REF_ID, PARENT_ID, UNIQ_MSG_ID, MSG_SOURCE, M_CONTENT, M_OPTIONS)
+    values (_freetext_id,_domain_id,_msg_id,_user_id,_address_info,_folder_id,_mstatus,_attached,_address,_rcv_date,_snd_date,_mheader, _dsize, _priority, _subject,_srv_msg_id, _ref_id, _parent_id, _uniq_msg_id, _msg_source, _source, OMAIL.WA.array2xml(_options, 0, 'options'));
+
+  -- parts
+  OMAIL.WA.omail_receive_message_parts (_domain_id, _user_id, _msg_id, _freetext_id, _parent_id, _folder_id, _mime_type, _source, _bodys, _parts);
+
+  OMAIL.WA.omail_update_msg_size (_domain_id,_user_id,_msg_id);
+  OMAIL.WA.omail_update_msg_attached (_domain_id,_user_id,_msg_id);
+  OMAIL.WA.filter_run_message (_domain_id, _user_id, _msg_id);
+
+  return 1;
+}
+;
 
-  ----------------------------------------------------------------------------
-  -- PARTS -------------------------------------------------------------------
-  ----------------------------------------------------------------------------
-  declare _mime_parts,_aparams any;
-  declare _encoding, _fname varchar;
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.omail_receive_message_parts (
+  in  _domain_id   integer,
+  in  _user_id     integer,
+  in  _msg_id      integer,
+  in  _freetext_id integer,
+  in  _parent_id   integer,
+  in  _folder_id   integer,
+  in  _mime_type   varchar,
+  in  _source      varchar,
+  in  _bodys       any,
+  in  _parts       any)
+{
+  declare _aparams any;
+  declare _body, _tags, _fname varchar;
   declare _part_id,_type_id,_pdefault integer;
-  _part_id := 1;
-  _fname   := '';
 
+  _part_id := 1;
   if (isarray(_parts))
   {
     -- mime body
-    OMAIL.WA.omail_get_mime_parts (_domain_id, _user_id, _msg_id, _parent_id, _folder_id, _part_id, _source, _parts, 0, _certificate);
+    OMAIL.WA.omail_get_mime_parts (_domain_id, _user_id, _msg_id, _parent_id, _folder_id, _part_id, _source, _parts, 0);
   }
   else
   {
     -- plain text or special body
-    _body_beg  := aref(_bodys,0);
-    _body_end  := aref(_bodys,1);
-    _body      := subseq (blob_to_string (_source), _body_beg, _body_end + 1);
-    _dsize     := length(_body);
+    _fname     := '';
+    _body      := subseq (blob_to_string (_source), _bodys[0], _bodys[1] + 1);
     _type_id   := OMAIL.WA.res_get_mimetype_id(_mime_type);
     _pdefault  := 1;
+    if (not _freetext_id)
+      _freetext_id := sequence_next ('OMAIL.WA.omail_seq_eml_freetext_id');
+
     if (_type_id not in (10100, 10110))
     {
       _aparams  := OMAIL.WA.array2xml(vector('content-type','text/plain'));
@@ -5371,12 +5940,45 @@ create procedure OMAIL.WA.omail_receive_message(
     _aparams := OMAIL.WA.array2xml(vector('content-type',_mime_type));
     _tags := OMAIL.WA.tags_rules(_user_id, _body);
     insert into OMAIL.WA.MSG_PARTS(DOMAIN_ID,MSG_ID,USER_ID,PART_ID,TYPE_ID,TDATA,TAGS,DSIZE,APARAMS,PDEFAULT,FREETEXT_ID,FNAME)
-      values (_domain_id,_msg_id,_user_id,_part_id,_type_id,_body,_tags,_dsize,_aparams,_pdefault,_freetext_id,_fname);
+      values (_domain_id, _msg_id, _user_id, _part_id, _type_id, _body, _tags, length (_body), _aparams, _pdefault, _freetext_id, _fname);
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.omail_receive_message_imap_body (
+  in _domain_id integer,
+  in _user_id   integer,
+  in _msg_id    integer,
+  in _parent_id integer,
+  in _folder_id integer,
+  in _source_id integer,
+  in _unique_id integer)
+{
+  declare _message, _messages, _mime_type any;
+  declare _server, _user, _password, _buffer, _folder, _retCode any;
+
+  if (not OMAIL.WA.external_account_info (_domain_id, _user_id, _source_id, _server, _user, _password))
+    return 0;
+
+  _folder := (select DATA from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _folder_id);
+  if (isnull (_folder))
+    return 0;
+
+  _buffer := 10000000;
+  _messages := imap_get (_server, _user, _password, _buffer, 'fetch', _folder, vector (cast (_unique_id as integer)));
+  if (length (_messages) = 1)
+  {
+    _message := mime_tree(_messages[0][1]);
+    if (not (isarray(_message)))
+      return 0;
 
+    -- parts
+    _mime_type := get_keyword_ucase ('Content-Type', _message[0], '');
+    delete from OMAIL.WA.MSG_PARTS where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id;
+    OMAIL.WA.omail_receive_message_parts (_domain_id, _user_id, _msg_id, 0, _parent_id, _folder_id, _mime_type, _messages[0][1], _message[1], _message[2]);
   }
-  OMAIL.WA.omail_update_msg_size(_domain_id,_user_id,_msg_id);
-  OMAIL.WA.omail_update_msg_attached(_domain_id,_user_id,_msg_id);
-  OMAIL.WA.filter_run_message (_domain_id, _user_id, _msg_id);
   return 1;
 }
 ;
@@ -5391,23 +5993,17 @@ create procedure OMAIL.WA.omail_result2xml(
 {
   declare _i integer;
   declare _rs,_cell varchar;
-  declare _val any;
-  _rs := '';
-  _i := 0;
 
   if (_ind < _skipped)
     return '';
 
-  _rs   := sprintf('<message>');
-  while(_i < length(_descr)){
-    _cell := lower (aref(_descr,_i));
-    _val  := aref(_rows,_i);
-    _val  := replace(_val,'&','&');
-
-    _rs := sprintf('%s<%s>%s</%s>',_rs,_cell,cast(_val as varchar),_cell);
-    _i := _i + 1;
+  _rs := '<message>';
+  for (_i := 0; _i < length (_descr); _i := _i + 1)
+  {
+    _cell := lower (_descr[_i]);
+    _rs   := sprintf ('%s<%s>%V</%s>', _rs, _cell, cast (_rows[_i] as varchar), _cell);
   }
-  return sprintf('%s</message>',_rs);
+  return _rs || '</message>';
 }
 ;
 
@@ -5423,7 +6019,7 @@ create procedure OMAIL.WA.omail_save_msg(
   declare _address,_subject,_tags,_mheader,_mstatus,_from,_to,_cc,_bcc,_dcc,_address_info,_pdata,_aparams,_ref_id varchar;
   declare _folder_id,_priority,_dsize,_attached,_part_id,_type_id,_dsize,_pdefault,_freetext_id,_msg_source integer;
   declare _rcv_date, _snd_date any;
-  declare _rfc_id, _rfc_references any;
+  declare _options, _rfc_id, _rfc_references any;
 
   _error := 0;
 
@@ -5439,20 +6035,14 @@ create procedure OMAIL.WA.omail_save_msg(
   _pdefault   := 1;
   _msg_source := 0; -- '-1' ->from SMTP; '0' ->inside; '>0' - from POP3 account
 
-  _from := trim(get_keyword('from',_params, ''));
-  if (_from = '')
-    _from := get_keyword('email', get_keyword('user_info', _params, ''), '');
-
+  _from := trim (get_keyword ('from',_params, get_keyword ('email', get_keyword ('user_info', _params, ''), '')));
   _to   := trim(get_keyword('to', _params,''));
   _cc   := trim(get_keyword('cc', _params,''));
   _bcc  := trim(get_keyword('bcc', _params,''));
   _dcc  := trim(get_keyword('dcc', _params,''));
 
   _part_id := 1;
-  _type_id := 10100;
-  if (get_keyword('mt',_params,'') = 'html')
-    _type_id := 10110;
-
+  _type_id := case when (get_keyword ('mt', _params,'') = 'html') then 10110 else 10100 end;
   _pdata   := get_keyword('message',_params,'');
   _dsize   := length(_pdata);
   _aparams := '<params/>';
@@ -5467,40 +6057,48 @@ create procedure OMAIL.WA.omail_save_msg(
 
     _dcc_address := OMAIL.WA.dcc_address(_dcc, _from);
     if (isnull(strstr(_cc, _dcc_address)))
+    {
       if (_cc = '')
         _cc := _dcc_address;
       else
         _cc := concat(_cc, ', ', _dcc_address);
+    }
     if (_dcc_address <> '')
     {
-      _dcc_addresses := '';
-      _dcc_addresses := _dcc_addresses || OMAIL.WA.omail_address2xml('to', _from,0);
-      _dcc_addresses := _dcc_addresses || OMAIL.WA.omail_address2xml('to', _to,  0);
-      _dcc_addresses := _dcc_addresses || OMAIL.WA.omail_address2xml('to', _cc,  0);
-      _dcc_addresses := _dcc_addresses || OMAIL.WA.omail_address2xml('to', _bcc, 0);
-      _dcc_addresses := sprintf('<addres_list>%s</addres_list>', _dcc_addresses);
+      _dcc_addresses := '<addres_list>' ||
+                        OMAIL.WA.omail_address2xml ('to', _from,0) ||
+                        OMAIL.WA.omail_address2xml ('to', _to,  0) ||
+                        OMAIL.WA.omail_address2xml ('to', _cc,  0) ||
+                        OMAIL.WA.omail_address2xml ('to', _bcc, 0) ||
+                        '</addres_list>';
       OMAIL.WA.dcc_update(_dcc_address, _dcc_addresses);
     }
   }
 
   _address_info := OMAIL.WA.omail_address2xml('to', _to, 1); -- return first name or address
-  _address :=  '<addres_list>';
-  _address :=  sprintf('%s%s', _address, OMAIL.WA.omail_address2xml('from', _from,0));
-  _address :=  sprintf('%s%s', _address, OMAIL.WA.omail_address2xml('to',   _to,  0));
-  _address :=  sprintf('%s%s', _address, OMAIL.WA.omail_address2xml('cc',   _cc,  0));
-  _address :=  sprintf('%s%s', _address, OMAIL.WA.omail_address2xml('bcc', _bcc,  0));
-  _address :=  sprintf('%s%s', _address, OMAIL.WA.omail_address2xml('dcc', _dcc,  0));
-  _address :=  sprintf('%s</addres_list>',_address);
+  _address :=  '<addres_list>' ||
+               OMAIL.WA.omail_address2xml ('from', _from, 0) ||
+               OMAIL.WA.omail_address2xml ('to',   _to,   0) ||
+               OMAIL.WA.omail_address2xml ('cc',   _cc,   0) ||
+               OMAIL.WA.omail_address2xml ('bcc',  _bcc,  0) ||
+               OMAIL.WA.omail_address2xml ('dcc',  _dcc,  0) ||
+               '</addres_list>';
 
   _rfc_id  :=  get_keyword('rfc_id', _params,'');
   _rfc_references := get_keyword('rfc_references', _params,'');
+
+  _options := vector ();
+  OMAIL.WA.omail_setparam ('securitySign', _options, get_keyword ('ssign', _params, '0'));
+  if (not isnull (VAD_CHECK_VERSION ('Addressbook')))
+  OMAIL.WA.omail_setparam ('securityEncrypt', _options, get_keyword ('sencrypt', _params, '0'));
+
   if (_msg_id = 0)
   {
     _msg_id      := sequence_next ('OMAIL.WA.omail_seq_eml_msg_id');
     _freetext_id := sequence_next ('OMAIL.WA.omail_seq_eml_freetext_id');
 
-    insert into OMAIL.WA.MESSAGES (DOMAIN_ID,MSG_ID,USER_ID,ADDRES_INFO,FOLDER_ID,MSTATUS,ATTACHED,ADDRESS,RCV_DATE,SND_DATE,MHEADER,DSIZE,PRIORITY,SUBJECT,SRV_MSG_ID,REF_ID,FREETEXT_ID,MSG_SOURCE, M_RFC_ID, M_RFC_REFERENCES)
-      values (_domain_id,_msg_id,_user_id,_address_info,_folder_id,_mstatus,_attached,_address,_rcv_date,_snd_date,_mheader,_dsize,_priority,_subject,OMAIL.WA.rfc_id(),_ref_id,_freetext_id,_msg_source, _rfc_id, _rfc_references);
+    insert into OMAIL.WA.MESSAGES (DOMAIN_ID, MSG_ID, USER_ID, ADDRES_INFO, FOLDER_ID, MSTATUS, ATTACHED, ADDRESS, RCV_DATE, SND_DATE, MHEADER, DSIZE, PRIORITY, SUBJECT, SRV_MSG_ID, REF_ID, FREETEXT_ID, MSG_SOURCE, M_RFC_ID, M_RFC_REFERENCES, M_OPTIONS)
+      values (_domain_id, _msg_id, _user_id, _address_info, _folder_id, _mstatus, _attached, _address, _rcv_date, _snd_date, _mheader, _dsize, _priority, _subject, OMAIL.WA.rfc_id(), _ref_id, _freetext_id, _msg_source, _rfc_id, _rfc_references, OMAIL.WA.array2xml(_options, 0, 'options'));
 
     insert into OMAIL.WA.MSG_PARTS(DOMAIN_ID,MSG_ID,USER_ID,PART_ID,TYPE_ID,TDATA,TAGS,DSIZE,APARAMS,PDEFAULT,FREETEXT_ID)
       values (_domain_id,_msg_id,_user_id,_part_id,_type_id,_pdata,_tags,_dsize,_aparams,_pdefault,_freetext_id);
@@ -5514,7 +6112,8 @@ create procedure OMAIL.WA.omail_save_msg(
            RCV_DATE    = _rcv_date,
            DSIZE       = cast(_dsize as varchar),
            PRIORITY    = _priority,
-           SUBJECT     = _subject
+           SUBJECT     = _subject,
+           M_OPTIONS   = OMAIL.WA.array2xml(_options, 0, 'options')
      where DOMAIN_ID   = _domain_id
        and USER_ID     = _user_id
        and MSG_ID      = _msg_id;
@@ -5536,71 +6135,6 @@ create procedure OMAIL.WA.omail_save_msg(
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_save_pop3_acc(
-  in _domain_id integer,
-  in _user_id   integer,
-  inout _params any)
-{
-  declare _acc_id,_ch_interval,_mcopy,_del_acc_id,_folder_id,_error,_pop_port integer;
-  declare _acc_name,_pop_server,_user_name,_user_pass,_fname varchar;
-
-  _acc_name    := trim(get_keyword('acc_name', _params, '~no name~'));
-  _pop_server  := trim(get_keyword('pop_server', _params,''));
-  _user_name   := trim(get_keyword('user_name', _params,''));
-  _user_pass   := get_keyword('user_pass', _params);
-  _fname       := get_keyword('fname', _params);
-  _pop_port    := cast(get_keyword('pop_port', _params,110) as integer);
-  _ch_interval := cast(get_keyword('ch_interval', _params, 2) as integer);
-  _mcopy       := cast(get_keyword('mcopy', _params, 1) as integer);
-  _acc_id      := cast(get_keyword('acc_id', _params, 0) as integer);
-  _del_acc_id  := cast(get_keyword('del_acc_id', _params, 0) as integer);
-  _folder_id   := cast(get_keyword('fid',_params, 100) as integer);
-
-  OMAIL.WA.test(_acc_name, vector('name', 'Account Name', 'class', 'varchar', 'canEmpty', 0));
-  OMAIL.WA.test(_pop_server, vector('name', 'Server Address', 'class', 'varchar', 'canEmpty', 0));
-  OMAIL.WA.test(_user_name, vector('name', 'User Name', 'class', 'varchar', 'canEmpty', 0));
-
-  if (length (_fname) <> 0)
-  {
-    OMAIL.WA.test(_fname, vector('name', 'Folder name', 'class', 'folder', 'type', 'varchar', 'minLength', 2, 'maxLength', 20));
-    _folder_id := OMAIL.WA.omail_folder_create(_domain_id,_user_id, vector ('parent_id', _folder_id, 'name', _fname), _error);
-    if (_error <> 0)
-      return _error;
-  }
-
-  if (_acc_id <> 0)
-  {
-    update OMAIL.WA.EXTERNAL_POP_ACC
-       set ACC_NAME = _acc_name,
-           POP_SERVER = _pop_server,
-           POP_PORT = _pop_port,
-           USER_NAME = _user_name,
-           FOLDER_ID = _folder_id,
-           CH_INTERVAL = _ch_interval,
-           MCOPY = _mcopy
-     where DOMAIN_ID = _domain_id
-       and USER_ID = _user_id
-       and ACC_ID = _acc_id;
-
-    if (_user_pass <> '**********')
-    {
-      update OMAIL.WA.EXTERNAL_POP_ACC
-         set USER_PASS = pwd_magic_calc ('pop3',_user_pass)
-       where DOMAIN_ID = _domain_id
-         and USER_ID = _user_id
-         and ACC_ID = _acc_id;
-    }
-  } else {
-    _acc_id := sequence_next ('OMAIL.WA.omail_seq_eml_external_acc_id');
-    insert into OMAIL.WA.EXTERNAL_POP_ACC(DOMAIN_ID,USER_ID,ACC_ID,ACC_NAME,POP_SERVER,POP_PORT,USER_NAME,USER_PASS,FOLDER_ID,CH_INTERVAL,MCOPY,CH_ERROR)
-      values (_domain_id,_user_id,_acc_id,_acc_name,_pop_server,_pop_port,_user_name,pwd_magic_calc ('pop3',_user_pass),_folder_id,_ch_interval,_mcopy,0);
-  };
-  return 0;
-}
-;
-
--------------------------------------------------------------------------------
---
 create procedure OMAIL.WA.omail_search(
   inout path any,
   inout lines any,
@@ -5729,21 +6263,21 @@ create procedure OMAIL.WA.omail_search(
   -- Form Action---------------------------------------------------------------------
   if (get_keyword ('fa_cancel.x',params,'') <> '')
   {
-    OMAIL.WA.utl_doredirect(sprintf ('box.vsp?sid=%s&realm=%s&bp=100', _sid, _realm));
+    OMAIL.WA.utl_doredirect(sprintf ('box.vsp?sid=%s&realm=%s&bp=100', _sid, _realm), get_keyword ('domain_id', _user_info));
     return;
   }
   else if (get_keyword ('fa_save.x', params, '') <> '')
   {
-    OMAIL.WA.utl_doredirect(sprintf ('folders.vsp?sid=%s&realm=%s&folder_id=0&smartFlag=S&parent_id=115&%s', _sid, _realm, replace (tmp, '&', '&q_')));
+    OMAIL.WA.utl_doredirect(sprintf ('folders.vsp?sid=%s&realm=%s&folder_id=0&smartFlag=S&parent_id=115&%s', _sid, _realm, replace (tmp, '&', '&q_')), get_keyword ('domain_id', _user_info));
     return;
   }
   else if (get_keyword ('fa_move.x', params,'') <> '')
   {
-    _rs := OMAIL.WA.omail_move_msg(_domain_id,_user_id,params);
+    _rs := OMAIL.WA.messages_move(_domain_id, _user_id, params);
   }
   else if (get_keyword ('fa_delete.x', params,'') <> '')
   {
-    OMAIL.WA.omail_delete_message(_domain_id,_user_id,params,_params);
+    OMAIL.WA.messages_delete (_domain_id, _user_id, params);
   }
   else if (get_keyword ('fa_group.x', params, '') <> '')
   {
@@ -5767,7 +6301,7 @@ create procedure OMAIL.WA.omail_search(
   aset(_page_params,5,vector('user_info', OMAIL.WA.array2xml(_user_info)));
 
   -- SQL Statement-------------------------------------------------------------------
-  _sql_result2 := OMAIL.WA.omail_folders_list(_domain_id,_user_id,vector ());
+  _sql_result2 := OMAIL.WA.folders_list(_domain_id, _user_id);
 
   -- XML structure-------------------------------------------------------------------
   _rs := '';
@@ -5819,6 +6353,7 @@ create procedure OMAIL.WA.omail_select_attachment(
           and USER_ID    = _user_id
           and MSG_ID     = _msg_id
           and PDEFAULT   = 0
+          and FNAME      <> 'smime.p7s'
         ORDER BY TYPE_ID) do
   {
     OMAIL.WA.omail_get_mimetype_name(TYPE_ID,_mime_type);
@@ -5836,7 +6371,8 @@ create procedure OMAIL.WA.omail_select_attachment(
 
     BDATA := coalesce(BDATA,TDATA);
     if (_mode = 1)
-      if (_encoding = 'base64') {
+      if (_encoding = 'base64')
+      {
         _rs := sprintf('%s<bdata>%s</bdata>', _rs, encode_base64(blob_to_string(BDATA)));
       } else {
         BDATA := replace(blob_to_string(BDATA),']]>',']]>]]<![CDATA[>');
@@ -5848,7 +6384,7 @@ create procedure OMAIL.WA.omail_select_attachment(
     else
       _buff2 := sprintf('%s<attachment>%s</attachment>',_buff2,_rs);
     _rs := '';
-  };
+  }
 
   if (length(_buff2) > 0)
     _buff2 := sprintf('<attachments>%s</attachments>',_buff2);
@@ -5977,10 +6513,8 @@ create procedure OMAIL.WA.omail_select_next_prev_exec(
   _buf := '';
   if (isarray(_rows))
   {
-    _ind := 0;
     _len := length(_rows);
-
-    while (_ind < _len)
+    for (_ind := 0; _ind < _len; _ind := _ind + 1)
     {
       if (_rows[_ind][0] = OMAIL.WA.omail_getp ('msg_id',_params))
       {
@@ -5990,7 +6524,6 @@ create procedure OMAIL.WA.omail_select_next_prev_exec(
         return _rs;
       }
       _buf := _rows[_ind][0];
-      _ind := _ind + 1;
     }
   }
   return _rs;
@@ -6035,8 +6568,9 @@ create procedure OMAIL.WA.omail_send_msg(
   in    _skip      varchar,
   out   _error     integer)
 {
-  declare _sql_result1,_sql_result2,_xslt_url,_xslt_url2,_rs,_boundary,_body any;
-
+  declare _sql_result1, _sql_result2, _xslt_url, _xslt_url2, _xslt_url3, _tmp, _body any;
+  declare _sender, _rec, _smtp_server any;
+  declare _sid, _realm, _fields, _settings, _signed, _sencrypt, _type_id, _replyTo, _displayName, _dloadUrl any;
   declare exit handler for SQLSTATE '2E000'
   {
     _error := 1901;
@@ -6051,38 +6585,119 @@ create procedure OMAIL.WA.omail_send_msg(
   _error     := 0;
   _xslt_url  := OMAIL.WA.omail_xslt_full('construct_mail.xsl');
   _xslt_url2 := OMAIL.WA.omail_xslt_full('construct_recip.xsl');
+  _xslt_url3 := OMAIL.WA.omail_xslt_full ('construct_body.xsl');
 
-  OMAIL.WA.omail_setparam('msg_id', _params, _msg_id);
-  OMAIL.WA.omail_setparam('_html_parse', _params, 0);
+  -- Open Message
+  --
+  _fields    := OMAIL.WA.omail_get_message(_domain_id, _user_id, _msg_id, 1);
+  _type_id   := OMAIL.WA.omail_getp ('type_id', _fields);
 
-  -- execute procedure ---------------------------------------------------------
-  _sql_result1 := OMAIL.WA.omail_open_message(_domain_id,_user_id, _params, 1, 0);
-  OMAIL.WA.omail_message_body_parse(_domain_id,_user_id,_msg_id,_sql_result1);
+  -- Get Settings
+  _settings := OMAIL.WA.omail_get_settings(_domain_id, _user_id, 'base_settings');
+
+  _replyTo := trim (get_keyword ('msg_reply', _settings, ''));
+  if (is_empty_or_null(_replyTo))
+    _replyTo := OMAIL.WA.omail_address2str ('from', OMAIL.WA.omail_getp ('address', _fields), 3);
+
+  _displayName := '';
+  if (get_keyword ('msg_name', _settings, 0))
+  {
+    _displayName := trim (get_keyword ('msg_name_txt',_settings, ''));
+    if (_displayName = '')
+      _displayName := coalesce((select U_FULL_NAME from DB.DBA.SYS_USERS where U_ID = _user_id), '');
+  }
+  _sql_result1 := sprintf ('<ref_id>%s</ref_id>\n', get_keyword ('ref_id', _fields)) ||
+                  sprintf ('<subject><![CDATA[%s]]></subject>\n', get_keyword ('subject', _fields)) ||
+                  sprintf ('<priority>%d</priority>\n', get_keyword ('priority', _fields)) ||
+                  sprintf ('<to_snd_date>%s</to_snd_date>\n', OMAIL.WA.dt_rfc822 (get_keyword ('rcv_date', _fields, ''))) ||
+                  sprintf ('<address>%s</address>\n', get_keyword ('address', _fields)) ||
+                  sprintf ('<replyTo><![CDATA[%s]]></replyTo>\n', _replyTo) ||
+                  sprintf ('<displayName><![CDATA[%s]]></displayName>\n', _displayName) ||
+                  sprintf ('<type_id>%d</type_id>\n', get_keyword ('type_id', _fields));
+
+  -- Decode Message Body
+  _body := OMAIL.WA.omail_getp ('message', _fields);
+
+  OMAIL.WA.utl_decode_qp (_body, OMAIL.WA.omail_get_encoding (OMAIL.WA.omail_getp ('aparams', _fields), ''));
+  _sid      := get_keyword ('sid',_params,'');
+  _realm    := get_keyword ('realm',_params,'');
+  _dloadUrl := sprintf ('dload.vsp?sid=%s&realm=%s&dp=%s', _sid, _realm, '%d,%d');
+  OMAIL.WA.omail_open_message_images (_domain_id, _user_id, _msg_id, 20000, _dloadUrl, _body); -- 20000 -> images
+
+  _body := replace (_body,']]>',']]>]]<![CDATA[>');
+  OMAIL.WA.omail_message_body_parse (_domain_id, _user_id, _msg_id, _body);
+
+  _signed := OMAIL.WA.omail_getp ('ssign', _params);
+  if (_signed = '1')
+  {
+    declare _certificate any;
+
+    set_user_id (OMAIL.WA.account_name (_user_id));
+    _certificate := xenc_pem_export (get_keyword ('security_sign', _settings), 1);
+    set_user_id ('dba');
+    if (isnull (_certificate))
+      signal ('08006', '');
+
+    _tmp := '<message>' ||
+            sprintf ('<boundary>%s</boundary>', '------_NextPart_' || md5 (cast (now() as varchar))) ||
+            sprintf ('<charset>%s</charset>', 'us-ascii') ||
+            sprintf ('<srv_msg_id>%s</srv_msg_id>', OMAIL.WA.rfc_id ()) ||
+            sprintf ('<type_id>%d</type_id>\n', get_keyword ('type_id', _fields)) ||
+            sprintf ('<mbody><mtext><![CDATA[%s]]></mtext></mbody>\n', _body) ||
+            OMAIL.WA.omail_select_attachment (_domain_id, _user_id, _msg_id, 1) ||
+            '</message>';
+    _tmp := xslt (_xslt_url3, xml_tree_doc (xml_tree (_tmp)));
+    _tmp := replace (cast (_tmp as varchar), CHR(10), '\r\n');
+    _body := smime_sign (_tmp, _certificate, _certificate, '', vector (), flags=>4*16);
+
+    _sql_result2 := '';
+  } else {
   _sql_result2 := OMAIL.WA.omail_select_attachment(_domain_id,_user_id,_msg_id,1);
-  _boundary    := sprintf('------_NextPart_%s',md5(cast(now() as varchar)));
+  }
+  _sql_result1 := _sql_result1 || sprintf ('<mbody><mtext><![CDATA[%s]]></mtext></mbody>\n', _body);
 
   -- XML structure -------------------------------------------------------------
-  _body := '<message>';
-  _body := sprintf('%s<boundary>%s</boundary>', _body, _boundary);
-  _body := sprintf('%s<charset>%s</charset>', _body, 'us-ascii');
-  _body := sprintf ('%s<srv_msg_id>%s</srv_msg_id>', _body, OMAIL.WA.rfc_id ());
-  _body := sprintf('%s%s%s</message>', _body, _sql_result1, _sql_result2);
+  _body := '<message>' ||
+           sprintf ('<boundary>%s</boundary>', '------_NextPart_' || md5 (cast (now() as varchar))) ||
+           sprintf ('<charset>%s</charset>', 'us-ascii') ||
+           sprintf ('<srv_msg_id>%s</srv_msg_id>', OMAIL.WA.rfc_id ()) ||
+           sprintf ('<signed>%s</signed>', _signed) ||
+           _sql_result1 ||
+           _sql_result2 ||
+           '</message>';
   _body := xslt(_xslt_url, xml_tree_doc(xml_tree(_body)));
+  _body := replace (cast (_body as varchar), CHR(10), '\r\n');
 
-  _body := cast(_body as varchar);
-  _body := replace(_body, CHR(10), '\r\n');
-
-  declare _sender, _rec, _smtp_server any;
-
-  _sender      := cast(xslt(_xslt_url2, xml_tree_doc(xml_tree(concat('<fr>',_sql_result1,'</fr>')))) as varchar);
-  _rec         := cast(xslt(_xslt_url2, xml_tree_doc(xml_tree(concat('<to>',_sql_result1,'</to>')))) as varchar);
-
+  _sender := cast (xslt (_xslt_url2, xml_tree_doc (xml_tree (concat ('<fr>', sprintf ('<address>%s</address>\n', get_keyword ('address', _fields)), '</fr>')))) as varchar);
+  _rec    := cast (xslt (_xslt_url2, xml_tree_doc (xml_tree (concat ('<to>', sprintf ('<address>%s</address>\n', get_keyword ('address', _fields)), '</to>')))) as varchar);
   if (not isnull (_skip))
   {
     _rec := replace(_rec, sprintf('<%s>', _skip), '');
-    _rec := trim(_rec);
-    _rec := trim(_rec, ',');
-    _rec := trim(_rec);
+    _rec := trim (trim (_rec), ',');
+  }
+  _rec := trim (_rec);
+  _sencrypt := OMAIL.WA.omail_getp ('sencrypt', _params);
+  if (_sencrypt = '1')
+  {
+    declare N integer;
+    declare _addr, _addrs, _cert, _certs any;
+
+    _certs := vector ();
+    _addrs := split_and_decode (_rec, 0, '\0\0,');
+    for (N := 0; N < length (_addrs); N := N + 1)
+    {
+      _addr := _addrs[N];
+      _addr := replace (_addr, '<', '');
+      _addr := replace (_addr, '>', '');
+      _addr := replace (_addr, '\t', '');
+      _addr := trim (_addr);
+      _cert := AB.WA.contact_certificate (_user_id, _addr);
+      if (isnull (_cert) or (get_certificate_info (10, _cert, 0, '', 'emailAddress') <> _addr))
+        signal ('08006', '');
+
+      _certs := vector_concat (_certs, vector (_cert));
+    }
+    _body := smime_encrypt (_body, _certs, 'aes256');
   }
   _smtp_server := cfg_item_value(virtuoso_ini_path(), 'HTTPServer', 'DefaultMailServer');
   smtp_send(_smtp_server, _sender, _rec, _body);
@@ -6099,7 +6714,7 @@ create procedure OMAIL.WA.omail_send_msg(
          and MSG_ID    = _msg_id;
     } else {
       -- delete msg
-      OMAIL.WA.omail_del_message(_domain_id, _user_id, _msg_id);
+      OMAIL.WA.message_erase (_domain_id, _user_id, _msg_id);
     }
   }
 }
@@ -6210,14 +6825,23 @@ create procedure OMAIL.WA.omail_set_mail(
       OMAIL.WA.omail_setparam ('spam_msg_action', _settings, cast (get_keyword ('spam_msg_action', params, '0') as integer));
     }
     OMAIL.WA.omail_setparam ('spam_msg_state', _settings, cast (get_keyword ('spam_msg_state', params, '0') as integer));
-    if (OMAIL.WA.omail_check_interval (get_keyword ('spam_msg_clean', params), 0, 1000))
       -- check clean spam interval
+    if (OMAIL.WA.omail_check_interval (get_keyword ('spam_msg_clean', params), 0, 1000))
+    {
       OMAIL.WA.omail_setparam ('spam_msg_clean', _settings, cast (get_keyword ('spam_msg_clean', params, '0') as integer));
-    else
+    } else {
       OMAIL.WA.utl_redirect (sprintf ('err.vsp?sid=%s&realm=%s&err=%d',_sid,_realm,1702));
+    }
 
     OMAIL.WA.omail_setparam ('spam_msg_header', _settings, cast (get_keyword ('spam_msg_header', params, '0') as integer));
     OMAIL.WA.omail_setparam('spam', _settings, cast(get_keyword ('spam', params, '0') as integer));
+
+    -- security
+    OMAIL.WA.omail_setparam ('security_sign', _settings, get_keyword ('security_sign', params, ''));
+    OMAIL.WA.omail_setparam ('security_sign_mode', _settings, cast (get_keyword ('security_sign_mode', params, '0') as integer));
+    OMAIL.WA.omail_setparam ('security_encrypt', _settings, get_keyword ('security_encrypt', params, ''));
+    OMAIL.WA.omail_setparam ('security_encrypt_mode', _settings, cast (get_keyword ('security_encrypt_mode', params, '0') as integer));
+
     OMAIL.WA.omail_setparam('conversation', _settings, cast(get_keyword('conversation', params, '0') as integer));
 
     OMAIL.WA.omail_setparam('update_flag', _settings, 1);
@@ -6228,7 +6852,7 @@ create procedure OMAIL.WA.omail_set_mail(
   }
   if ((get_keyword ('fa_cancel.x',params,'') <> '') or (get_keyword ('fa_save.x',params,'') <> ''))
   {
-    OMAIL.WA.utl_doredirect(sprintf('box.vsp?sid=%s&realm=%s&bp=100',_sid,_realm));
+    OMAIL.WA.utl_doredirect(sprintf ('box.vsp?sid=%s&realm=%s&bp=100', _sid, _realm), get_keyword ('domain_id', _user_info));
     return;
   }
 
@@ -6250,6 +6874,10 @@ create procedure OMAIL.WA.omail_set_mail(
   _rs := sprintf ('%s<spam_msg_clean>%d</spam_msg_clean>', _rs, OMAIL.WA.omail_getp ('spam_msg_clean', _settings));
   _rs := sprintf ('%s<spam_msg_header>%d</spam_msg_header>', _rs, OMAIL.WA.omail_getp ('spam_msg_header', _settings));
   _rs := sprintf ('%s<spam>%d</spam>', _rs, OMAIL.WA.omail_getp('spam', _settings));
+  _rs := sprintf ('%s<security_sign>%V%s</security_sign>', _rs, OMAIL.WA.omail_getp ('security_sign', _settings), OMAIL.WA.certificateList (_user_id, OMAIL.WA.omail_getp ('security_sign', _settings)));
+  _rs := sprintf ('%s<security_sign_mode>%d</security_sign_mode>', _rs, OMAIL.WA.omail_getp ('security_sign_mode', _settings));
+  _rs := sprintf ('%s<security_encrypt>%V%s</security_encrypt>', _rs, OMAIL.WA.omail_getp ('security_encrypt', _settings), OMAIL.WA.certificateList (_user_id, OMAIL.WA.omail_getp ('security_encrypt', _settings)));
+  _rs := sprintf ('%s<security_encrypt_mode>%d</security_encrypt_mode>', _rs, OMAIL.WA.omail_getp ('security_encrypt_mode', _settings));
   _rs := sprintf('%s<conversation>%d</conversation>', _rs, OMAIL.WA.omail_getp('conversation', _settings));
   _rs := sprintf('%s<discussion>%d</discussion>', _rs, OMAIL.WA.discussion_check ());
   _rs := sprintf('%s</settings>', _rs);
@@ -6326,14 +6954,13 @@ create procedure OMAIL.WA.omail_smtp_message_deliver(
   {
     _domain_id := (select C_DOMAIN_ID from OMAIL.WA.CONVERSATION where C_ADDRESS = _recipient);
     if (isnull(_domain_id))
-      goto _end;
+      return 0;
+
     _user_id   := OMAIL.WA.domain_owner_id(_domain_id);
   }
   _source := OMAIL.WA.omail_receive_message (_domain_id, _user_id, null, _source, null, _msg_source, _folder_id);
-  return 1;
 
-_end:
-  return 0;
+  return 1;
 }
 ;
 
@@ -6369,19 +6996,17 @@ create procedure OMAIL.WA.omail_split_decode_cast(
   declare _len,_ind integer;
 
   _params := split_and_decode(_string,_decode,_separator);
-
-  _ind := 0;
   _len := length(_params);
-  while(_ind < _len){
+  for (_ind := 0; _ind < _len; _ind := _ind + 1)
     aset(_params,_ind,cast(_params[_ind] as integer));
-    _ind := _ind + 1;
-  }
 
-  if (_len < _length){
-    while(_ind < _length){
+  if (_len < _length)
+  {
+    while (_ind < _length)
+    {
       _params := vector_concat(_params,vector(0));
       _ind := _ind + 1;
-    };
+    }
   }
   return _params;
 }
@@ -6549,8 +7174,9 @@ create procedure OMAIL.WA.omail_tools(
 
   -- Form Action---------------------------------------------------------------------
   if (_params[2] = 1)
-  { -- > confirm action
-    OMAIL.WA.omail_folder_edit (_domain_id, _user_id, _params[0], _params[1], null, _error);
+  {
+    -- > confirm action
+    OMAIL.WA.folder_edit (_domain_id, _user_id, _params[0], _params[1], null, _error);
     if (_error <> 0)
       OMAIL.WA.utl_redirect(sprintf('err.vsp?sid=%s&realm=%s&err=%d',_sid,_realm,_error));
     else if (_params[3] = 1)
@@ -6571,7 +7197,7 @@ create procedure OMAIL.WA.omail_tools(
   aset(_page_params,0,vector('sid', _sid));
   aset(_page_params,1,vector('realm', _realm));
   aset(_page_params,2,vector('object_id', _params[0]));
-  aset(_page_params,3,vector('object_name', sprintf('<![CDATA[%s]]>', OMAIL.WA.omail_folder_name(_domain_id, _user_id, _params[0]))));
+  aset (_page_params,3,vector ('object_name', sprintf ('<![CDATA[%s]]>', OMAIL.WA.folder_name(_domain_id, _user_id, _params[0]))));
   aset(_page_params,4,vector('tp',_tp));
   aset(_page_params,5,vector('user_info', OMAIL.WA.array2xml(_user_info)));
 
@@ -6780,7 +7406,7 @@ create procedure OMAIL.WA.omail_tools_action(
     _sql_result1 := sprintf ('<parent_id>%s</parent_id>', cast (coalesce (_parent_id, '') as varchar));
     _sql_statm   := vector ('select FOLDER_ID,NAME from OMAIL.WA.FOLDERS where DOMAIN_ID = ? and USER_ID = ? and PARENT_ID');
     _sql_params  := vector(vector(_domain_id,_user_id,''),vector(''));-- user_id
-    _sql_result1 := sprintf ('%s%s', _sql_result1, OMAIL.WA.omail_folders_list(_domain_id,_user_id,vector ()));
+    _sql_result1 := sprintf ('%s%s', _sql_result1, OMAIL.WA.folders_list(_domain_id, _user_id));
   }
   else if (_action_id = 1)
   { -- delete folder
@@ -6840,41 +7466,6 @@ create procedure OMAIL.WA.omail_tools_action(
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.omail_tstamp_to_mdate(in atime time)
-{
-  ----------------------------------------------------------
-  -- Get mail format time GMT
-  --      and return "DAY, DD MON YYYY HH:MI:SS {+,-}HHMM"
-  ------------------------------------------------------------
-
-  declare result,d,e,h,m,y,s,k,z,zh,zm,zz varchar;
-  declare m_time TIME;
-  declare daysofweek,months any;
-  daysofweek := vector('01','SUN','02','Mon','03','Thu','04','Wed','05','Thu','06','Fri','07','Sat');
-  months := vector('01','Jan','02','Feb','03','Mar','04','Apr','05','May','06','Jun','07','Jul','08','Aug','09','Sep','10','Oct','11','Nov','12','Dec');
-  m_time := atime;
-
-  d  := either(lt(cast(dayofmonth(m_time) as integer),10),sprintf('%d%d',0,dayofmonth(m_time)),cast(dayofmonth(m_time)as varchar));
-  m  := either(lt(cast(month(m_time)      as integer),10),sprintf('%d%d',0,month(m_time)) ,cast(month(m_time)     as varchar));
-  h  := either(lt(cast(hour(m_time)       as integer),10),sprintf('%d%d',0,hour(m_time)) ,cast(hour(m_time)      as varchar));
-  e  := either(lt(cast(minute(m_time)     as integer),10),sprintf('%d%d',0,minute(m_time)) ,cast(minute(m_time)    as varchar));
-  s  := either(lt(cast(second(m_time)     as integer),10),sprintf('%d%d',0,second (m_time)) ,cast(second(m_time)    as varchar));
-  k  := either(lt(cast(dayofweek(m_time)  as integer),10),sprintf('%d%d',0,dayofweek(m_time)) ,cast(dayofweek(m_time) as varchar));
-  y  := cast(year(m_time)as varchar);
-  z  := timezone(m_time);
-  if (z < 0) {zz := '-'; z := z-(2*z);} else{ zz := '+';};
-  zh := either(lt(cast((z/60)    as integer),10),sprintf('%d%d',0,(z/60)) ,cast((z/60)   as varchar));
-  zm := either(lt(cast(mod(z,60) as integer),10),sprintf('%d%d',0,mod(z,60)),cast(mod(z,60)as varchar));
-  z  := sprintf('%s%s%s',zz,zh,zm);
-  z  := cast(z as varchar);
-  result := sprintf('%s, %s %s %s %s:%s:%s %s',get_keyword(k,daysofweek,''),d,get_keyword(m,months,''),y, h,e,s,z);
-
-  RETURN result;
-}
-;
-
--------------------------------------------------------------------------------
---
 create procedure OMAIL.WA.omail_update_msg_attached(
   in _domain_id integer,
   in _user_id   integer,
@@ -6884,7 +7475,7 @@ create procedure OMAIL.WA.omail_update_msg_attached(
   select COUNT(*)
     INTO _attached
     from OMAIL.WA.MSG_PARTS
-   where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id and PDEFAULT <> 1;
+   where DOMAIN_ID = _domain_id and USER_ID = _user_id and MSG_ID = _msg_id and PDEFAULT <> 1 and FNAME <> 'smime.p7s';
 
   update OMAIL.WA.MESSAGES
      set ATTACHED = _attached
@@ -6959,7 +7550,7 @@ create procedure OMAIL.WA.omail_write(
 
   -- Set constants  -------------------------------------------------------------------
   _sql_params  := vector(0,0,0,0,0,0);
-  _page_params := vector (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+  _page_params := vector (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
   _sql_result1 := '';
   _sql_result2 := '';
   _faction     := '';
@@ -7131,19 +7722,23 @@ create procedure OMAIL.WA.omail_write(
   aset (_page_params, 8, vector ('spam_msg_clean', get_keyword ('spam_msg_clean', _settings, '0')));
   aset (_page_params, 9, vector ('spam_msg_header', get_keyword ('spam_msg_header', _settings, '0')));
   aset (_page_params,10, vector ('spam', get_keyword ('spam', _settings, '0')));
-  aset (_page_params,11, vector ('conversation', get_keyword ('conversation', _settings, '0')));
-  aset (_page_params,12, vector ('discussion', OMAIL.WA.discussion_check ()));
+  aset (_page_params,11, vector ('security_sign', get_keyword ('security_sign', _settings, '')));
+  aset (_page_params,12, vector ('security_sign_mode', get_keyword ('security_sign_mode', _settings, '0')));
+  aset (_page_params,13, vector ('security_encrypt', get_keyword ('security_encrypt', _settings, '')));
+  aset (_page_params,14, vector ('security_encrypt_mode', get_keyword ('security_encrypt_mode', _settings, '0')));
+  aset (_page_params,15, vector ('conversation', get_keyword ('conversation', _settings, '0')));
+  aset (_page_params,16, vector ('discussion', OMAIL.WA.discussion_check ()));
 
   -- If massage is saved, that we open the Draft folder in Folders tree
   if (OMAIL.WA.omail_getp('msg_id',_params) <> 0)
-    aset (_page_params, 13, vector ('folder_id', 130));
+    aset (_page_params, 17, vector ('folder_id', 130));
 
   -- XML structure-------------------------------------------------------------------
   _rs := '';
   _rs := sprintf('%s%s\n',_rs,OMAIL.WA.omail_page_params(_page_params));
   _rs := sprintf('%s%s\n',_rs,either(OMAIL.WA.omail_getp('preview',_params),'<preview/>',''));
   _rs := sprintf('%s<msg_id>%d</msg_id>',_rs,OMAIL.WA.omail_getp('msg_id',_params));
-  _rs := sprintf ('%s%s',_rs,OMAIL.WA.omail_folders_list(_domain_id, _user_id, vector ()));
+  _rs := sprintf ('%s%s', _rs, OMAIL.WA.folders_list(_domain_id, _user_id));
   _rs := sprintf('%s<message>\n', _rs);
   _rs := sprintf('%s%s\n',_rs,_sql_result1);
   _rs := sprintf('%s</message>\n', _rs);
@@ -7397,13 +7992,14 @@ create procedure OMAIL.WA.omail_mails (
   _rs := sprintf ('%s<mails>', _rs);
 
   declare S, name varchar;
-  declare st, msg, meta, rows any;
+  declare IRIs, st, msg, meta, rows any;
 
+  IRIs := vector ();
   S := 'sparql
-        PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-        select ?nick, ?firstName, ?family_name, ?mbox, ?mbox_sha1sum
+        prefix foaf: <http://xmlns.com/foaf/0.1/>
+        select ?nick, ?firstName, ?family_name, ?mbox, ?mbox_sha1sum, ?x
         from <%s>
-        WHERE
+        where
         {
           <%s> foaf:knows ?x.
           optional { ?x foaf:nick ?nick}.
@@ -7415,18 +8011,52 @@ create procedure OMAIL.WA.omail_mails (
 	S := sprintf (S, SIOC..get_graph (), SIOC..person_iri (SIOC..user_iri (_user_id)));
   st := '00000';
   exec (S, st, msg, vector (), 0, meta, rows);
-  if ('00000' = st) {
-    foreach (any row in rows) do {
+  if ('00000' = st)
+  {
+    foreach (any row in rows) do
+    {
       name := '';
       if (not isnull (row[0]))
         name := row[0];
       if ((not isnull (row[1])) and (not isnull (row[2])))
         name := row[1] || ' ' || row[2];
       if (not isnull (row[3]))
+      {
         _rs := sprintf ('%s<mail><name>%s</name><email>%s</email></mail>', _rs, name, OMAIL.WA.xml2string (OMAIL.WA.omail_composeAddr (name, row[3])));
-      if (not isnull (row[4]))
+      }
+      else if (not isnull (row[4]))
+      {
         _rs := sprintf ('%s<mail><name>%s</name><email>%s</email></mail>', _rs, name, OMAIL.WA.xml2string (OMAIL.WA.omail_composeAddr (name, row[4])));
     }
+      IRIs := vector_concat (IRIs, vector (row[5]));
+    }
+  }
+  S := 'select P_NAME, P_FIRST_NAME, P_LAST_NAME, P_MAIL, P_ID, P_DOMAIN_ID
+          from AB.WA.PERSONS
+         where DB.DBA.is_empty_or_null (P_MAIL) = 0
+           and P_DOMAIN_ID in (select WAI_ID
+                                 from DB.DBA.WA_MEMBER,
+                                      DB.DBA.WA_INSTANCE
+                                where WAM_USER = ?
+                                  and WAM_MEMBER_TYPE = 1
+                                  and WAM_INST = WAI_NAME)
+       ';
+  st := '00000';
+  exec (S, st, msg, vector (_user_id), 0, meta, rows);
+  if ('00000' = st)
+  {
+    foreach (any row in rows) do
+    {
+      if (not OMAIL.WA.vector_contains (IRIs, SIOC..socialnetwork_contact_iri (row[5], row[4])))
+      {
+        name := '';
+        if (not DB.DBA.is_empty_or_null (row[0]))
+          name := row[0];
+        if ((not DB.DBA.is_empty_or_null (row[1])) and (not DB.DBA.is_empty_or_null (row[2])))
+          name := row[1] || ' ' || row[2];
+        _rs := sprintf ('%s<mail><name>%s</name><email>%s</email></mail>', _rs, name, OMAIL.WA.xml2string (OMAIL.WA.omail_composeAddr (name, row[3])));
+      }
+    }
   }
   _rs := sprintf ('%s</mails>', _rs);
   return _rs;
@@ -7501,31 +8131,37 @@ create procedure OMAIL.WA.omail_api_unshare(
 {
   OMAIL.WA.omail_api_share_check_params(pApp_id,pUser_id,pObj_id,pObj_type,pGranted_uid,'RO');
 
-  if (isnull(pGranted_uid) and isnull(pObj_id)){
+  if (isnull (pGranted_uid) and isnull (pObj_id))
+  {
     -- delete all share rules
     delete from OMAIL.WA.SHARES where APP_ID = pApp_id and USER_ID = pUser_id;
 
     return 1;
-  } else if (isnull(pObj_id)){
+  }
+  if (isnull (pObj_id))
+  {
     -- delete all share rules for current GRANTED_UID
-    delete from OMAIL.WA.SHARES where APP_ID = pApp_id and USER_ID = pUser_id and GRANTED_UID = pGranted_uid;
+    delete
+      from OMAIL.WA.SHARES
+     where APP_ID = pApp_id and USER_ID = pUser_id and GRANTED_UID = pGranted_uid;
 
     return 2;
-
-  } else if (isnull(pGranted_uid)){
+  }
+  if (isnull (pGranted_uid))
+  {
     -- delete all share rules for current pObj_id
-    delete from OMAIL.WA.SHARES
+    delete
+      from OMAIL.WA.SHARES
            where   APP_ID = pApp_id and USER_ID = pUser_id and OBJ_ID = pObj_id and OBJ_TYPE = pObj_type;
 
     return 3;
-
-  } else {
+  }
     -- delete all share rules for current pObj_id and current GRANTED_UID
-    delete from OMAIL.WA.SHARES
+  delete
+    from OMAIL.WA.SHARES
          where   APP_ID = pApp_id and USER_ID = pUser_id and OBJ_ID = pObj_id and OBJ_TYPE = pObj_type and GRANTED_UID = pGranted_uid;
 
     return 4;
-  };
 }
 ;
 
@@ -7662,7 +8298,7 @@ create procedure OMAIL.WA.omail_api_message_send(
   sBody := sprintf('%s<boundary>%s</boundary>',sBody,sBoundary);
   sBody := sprintf('%s<charset_default>%s</charset_default>',sBody,'windows-1251');
   sBody := sprintf('%s<srv_msg_id>%s</srv_msg_id>',sBody,md5(concat(cast(now() as varchar))));
-  sBody := sprintf('%s<to_snd_date>%s</to_snd_date>',sBody,OMAIL.WA.omail_tstamp_to_mdate(now()));
+  sBody := sprintf ('%s<to_snd_date>%s</to_snd_date>',sBody,OMAIL.WA.dt_rfc822(now()));
   sBody := sprintf('%s%s',sBody,pXMLMsg);
   sBody := sprintf('%s%s',sBody,aBodyXML);
   sBody := sprintf('%s</message>',sBody);
@@ -7784,7 +8420,8 @@ create procedure OMAIL.WA.test (
 {
   declare valueType, valueClass, valueName, valueMessage, tmp any;
 
-  declare exit handler for SQLSTATE '*' {
+  declare exit handler for SQLSTATE '*'
+  {
     if (not is_empty_or_null(valueMessage))
       signal ('TEST', valueMessage || '<>');
     if (__SQL_STATE = 'EMPTY')
@@ -7809,8 +8446,9 @@ create procedure OMAIL.WA.test (
     signal ('TEST', 'Unknown validation error!<>');
     --resignal;
   };
-
+  if (isstring (value))
   value := trim(value);
+
   if (is_empty_or_null(params))
     return value;
 
@@ -7840,7 +8478,8 @@ create procedure OMAIL.WA.test (
   }
   value := OMAIL.WA.validate2 (valueClass, value);
 
-  if (valueType = 'integer') {
+  if (valueType = 'integer')
+  {
     tmp := get_keyword('minValue', params);
     if ((not isnull(tmp)) and (value < tmp))
       signal('MIN', cast(tmp as varchar));
@@ -7877,14 +8516,16 @@ create procedure OMAIL.WA.validate2 (
   in propertyType varchar,
   in propertyValue varchar)
 {
-  declare exit handler for SQLSTATE '*' {
+  declare exit handler for SQLSTATE '*'
+  {
     if (__SQL_STATE = 'CLASS')
       resignal;
     signal('TYPE', propertyType);
     return;
   };
 
-  if (propertyType = 'boolean') {
+  if (propertyType = 'boolean')
+  {
     if (propertyValue not in ('Yes', 'No'))
       goto _error;
   } else if (propertyType = 'integer') {
@@ -7989,7 +8630,8 @@ create procedure OMAIL.WA.validate_freeTexts (
   declare w varchar;
 
   w := regexp_match ('["][^"]+["]|[''][^'']+['']|[^"'' ]+', S, 1);
-  while (w is not null) {
+  while (w is not null)
+  {
     w := trim (w, '"'' ');
     if (not OMAIL.WA.validate_freeText(w))
       return 0;
@@ -8110,8 +8752,10 @@ create procedure OMAIL.WA.vector_unique(
   declare N, M integer;
 
   aResult := vector();
-  for (N := 0; N < length(aVector); N := N + 1) {
-    if ((minLength = 0) or (length(aVector[N]) >= minLength)) {
+  for (N := 0; N < length (aVector); N := N + 1)
+  {
+    if ((minLength = 0) or (length (aVector[N]) >= minLength))
+    {
       for (M := 0; M < length(aResult); M := M + 1)
         if (trim(aResult[M]) = trim(aVector[N]))
           goto _next;
@@ -8133,11 +8777,13 @@ create procedure OMAIL.WA.vector2str(
   declare N integer;
 
   aResult := '';
-  for (N := 0; N < length(aVector); N := N + 1) {
+  for (N := 0; N < length (aVector); N := N + 1)
+  {
     tmp := trim(aVector[N]);
     if (strchr (tmp, ' ') is not null)
       tmp := concat('''', tmp, '''');
-    if (N = 0) {
+    if (N = 0)
+    {
       aResult := tmp;
     } else {
       aResult := concat(aResult, delimiter, tmp);
@@ -8207,7 +8853,8 @@ create procedure OMAIL.WA.ft2vector(
 
   aResult := vector();
   w := regexp_match ('["][^"]+["]|[''][^'']+['']|[^"'' ]+', S, 1);
-  while (w is not null) {
+  while (w is not null)
+  {
     w := trim (w, '"'' ');
     if (upper(w) not in ('AND', 'NOT', 'NEAR', 'OR') and length (w) > 1 and not vt_is_noise (OMAIL.WA.wide2utf(w), 'utf-8', 'x-ViDoc'))
       aResult := vector_concat(aResult, vector(w));
@@ -8222,7 +8869,8 @@ create procedure OMAIL.WA.ft2vector(
 create procedure OMAIL.WA.tag_prepare(
   inout tag varchar)
 {
-  if (not is_empty_or_null(tag)) {
+  if (not is_empty_or_null(tag))
+  {
     tag := trim(tag);
     tag := replace(tag, '  ', ' ');
   }
@@ -8242,7 +8890,8 @@ create procedure OMAIL.WA.tag_delete(
   new_tags := OMAIL.WA.tags2vector (tags);
   tags := '';
   N := 0;
-  foreach (any new_tag in new_tags) do {
+  foreach (any new_tag in new_tags) do
+  {
     if (isstring(T) and (new_tag <> T))
       tags := concat(tags, ',', new_tag);
     if (isinteger(T) and (N <> T))
@@ -8357,7 +9006,8 @@ create procedure OMAIL.WA.vector2tags(
 
   aResult := '';
   for (N := 0; N < length(aVector); N := N + 1)
-    if (N = 0) {
+    if (N = 0)
+    {
       aResult := trim(aVector[N]);
     } else {
       aResult := concat(aResult, ',', trim(aVector[N]));
@@ -8375,7 +9025,8 @@ create procedure OMAIL.WA.tags2unique(
   declare N, M integer;
 
   aResult := vector();
-  for (N := 0; N < length(aVector); N := N + 1) {
+  for (N := 0; N < length (aVector); N := N + 1)
+  {
     for (M := 0; M < length(aResult); M := M + 1)
       if (trim(lcase(aResult[M])) = trim(lcase(aVector[N])))
         goto _next;
@@ -8479,90 +9130,70 @@ create procedure OMAIL.WA.dt_format(
   in pDate datetime,
   in pFormat varchar := 'd.m.Y')
 {
-  declare
-    N integer;
-  declare
-    ch,
-    S varchar;
+  declare N integer;
+  declare ch, S varchar;
+
+  declare exit handler for sqlstate '*' {
+    return '';
+  };
 
   S := '';
-  N := 1;
-  while (N <= length(pFormat))
+  for (N := 1; N <= length(pFormat); N := N + 1)
   {
     ch := substring(pFormat, N, 1);
     if (ch = 'M')
     {
       S := concat(S, xslt_format_number(month(pDate), '00'));
-    } else {
-      if (ch = 'm')
+    }
+    else if (ch = 'm')
       {
         S := concat(S, xslt_format_number(month(pDate), '##'));
-      } else
-      {
-        if (ch = 'Y')
+    }
+    else if (ch = 'Y')
         {
           S := concat(S, xslt_format_number(year(pDate), '0000'));
-        } else
-        {
-          if (ch = 'y')
+    }
+    else if (ch = 'y')
           {
             S := concat(S, substring(xslt_format_number(year(pDate), '0000'),3,2));
-          } else {
-            if (ch = 'd')
+    }
+    else if (ch = 'd')
             {
               S := concat(S, xslt_format_number(dayofmonth(pDate), '##'));
-            } else
-            {
-              if (ch = 'D')
+    }
+    else if (ch = 'D')
               {
                 S := concat(S, xslt_format_number(dayofmonth(pDate), '00'));
-              } else
-              {
-                if (ch = 'H')
+    }
+    else if (ch = 'H')
                 {
                   S := concat(S, xslt_format_number(hour(pDate), '00'));
-                } else
-                {
-                  if (ch = 'h')
+    }
+    else if (ch = 'h')
                   {
                     S := concat(S, xslt_format_number(hour(pDate), '##'));
-                  } else
-                  {
-                    if (ch = 'N')
+    }
+    else if (ch = 'N')
                     {
                       S := concat(S, xslt_format_number(minute(pDate), '00'));
-                    } else
-                    {
-                      if (ch = 'n')
+    }
+    else if (ch = 'n')
                       {
                         S := concat(S, xslt_format_number(minute(pDate), '##'));
-                      } else
-                      {
-                        if (ch = 'S')
+    }
+    else if (ch = 'S')
                         {
                           S := concat(S, xslt_format_number(second(pDate), '00'));
-                        } else
-                        {
-                          if (ch = 's')
+    }
+    else if (ch = 's')
                           {
                             S := concat(S, xslt_format_number(second(pDate), '##'));
-                          } else
+    }
+    else
                           {
                             S := concat(S, ch);
-                          };
-                        };
-                      };
-                    };
-                  };
-                };
-              };
-            };
-          };
-        };
-      };
-    };
-    N := N + 1;
-  };
+    }
+  }
   return S;
 }
 ;
@@ -8636,12 +9267,17 @@ create procedure OMAIL.WA.dt_convert(
   in pString varchar,
   in pDefault any := null)
 {
-  declare exit handler for sqlstate '*' { goto _next; };
+  declare exit handler for sqlstate '*' { goto _1; };
   return stringdate(pString);
-_next:
-  declare exit handler for sqlstate '*' { goto _end; };
+
+_1:
+  declare exit handler for sqlstate '*' { goto _2; };
   return http_string_date(pString);
 
+_2:
+  declare exit handler for sqlstate '*' { goto _end; };
+  return OMAIL.WA.dt_fromRFC822 (pString);
+
 _end:
   return pDefault;
 }
@@ -8665,6 +9301,84 @@ create procedure OMAIL.WA.dt_iso8601 (
 }
 ;
 
+-------------------------------------------------------------------------------
+--
+-- Get mail format time GMT
+--      and return "DAY, DD MON YYYY HH:MI:SS {+,-}HHMM"
+--
+------------------------------------------------------------
+create procedure OMAIL.WA.dt_rfc822 (
+  inout pDateTime datetime)
+{
+  declare d, e, h, m, y, s, k, z, zh, zm, zz varchar;
+  declare days, months any;
+
+  days := vector ('01','SUN','02','Mon','03','Thu','04','Wed','05','Thu','06','Fri','07','Sat');
+  months := vector ('01','Jan','02','Feb','03','Mar','04','Apr','05','May','06','Jun','07','Jul','08','Aug','09','Sep','10','Oct','11','Nov','12','Dec');
+
+  d  := xslt_format_number (dayofmonth (pDateTime), '00');
+  m  := xslt_format_number (month (pDateTime), '00');
+  h  := xslt_format_number (hour (pDateTime), '00');
+  e  := xslt_format_number (minute (pDateTime), '00');
+  s  := xslt_format_number (second (pDateTime), '00');
+  k  := xslt_format_number (dayofweek (pDateTime), '00');
+  y  := cast (year (pDateTime) as varchar);
+  z  := timezone (pDateTime);
+  if (z < 0)
+  {
+    zz := '-';
+    z := z-(2*z);
+  } else {
+    zz := '+';
+  }
+  zh := xslt_format_number (z/60, '00');
+  zm := xslt_format_number (mod (z, 60), '00');
+
+  return sprintf ('%s, %s %s %s %s:%s:%s %s%s%s', get_keyword (k, days), d, get_keyword (m, months), y, h, e, s, zz, zh, zm);
+}
+;
+
+-------------------------------------------------------------------------------
+--
+-- Get mail format "DAY, DD MON YYYY HH:MI:SS {+,-}HHMM"
+--		  and return "DD.MM.YYYY HH:MI:SS" GMT
+--
+-------------------------------------------------------------------------------
+create procedure OMAIL.WA.dt_fromRFC822 (
+  in _mdate varchar)
+{
+	declare _arr, months, rs, tzone_z, tzone_h, tzone_m any;
+	declare d, m, y, hms, tzone varchar;
+
+	_arr := split_and_decode (trim(_mdate), 0, '\0\0 ');
+	if (length(_arr) = 6)
+	{
+	  months := vector ('JAN', '01', 'FEB', '02', 'MAR', '03', 'APR', '04', 'MAY', '05', 'JUN', '06', 'JUL', '07', 'AUG', '08', 'SEP', '09', 'OCT', '10', 'NOV', '11', 'DEC', '12');
+		d   := _arr[1];
+		m   := get_keyword (upper(_arr[2]), months);
+		y   := _arr[3];
+		hms := _arr[4];
+		tzone   := _arr[5];
+		tzone_z := substring (tzone, 1, 1);
+		tzone_h := atoi (substring (tzone, 2, 2));
+		tzone_m := atoi (substring (tzone, 4, 2));
+	  if (tzone_z = '+')
+	  {
+	    tzone_h := tzone_h - 2 * tzone_h;
+	    tzone_m := tzone_m - 2 * tzone_m;
+		}
+	  rs := stringdate (sprintf ('%s.%s.%s %s', m, d, y, hms));
+	  rs := dateadd ('hour',   tzone_h, rs);
+	  rs := dateadd ('minute', tzone_m, rs);
+	}
+	else
+	{
+	  rs := stringdate('01.01.1900 00:00:00'); -- set system date
+	}
+	return rs;
+}
+;
+
 -----------------------------------------------------------------------------------------
 --
 create procedure OMAIL.WA.dt_string (
@@ -8777,7 +9491,8 @@ create procedure OMAIL.WA.dt_WeekDay (
   declare dw integer;
 
   dw := dayofweek (dt);
-  if (weekStarts = 'm') {
+  if (weekStarts = 'm')
+  {
     if (dw = 1)
       return 7;
     return dw - 1;
@@ -8842,8 +9557,8 @@ create procedure OMAIL.WA.dt_BeginOfYear (
 
   if (isnull (dt))
     return dt;
-  CAL.WA.dt_dateDecode (dt, pYear, pMonth, pDay);
-  return CAL.WA.dt_dateEncode (pYear, 1, 1);
+  OMAIL.WA.dt_dateDecode (dt, pYear, pMonth, pDay);
+  return OMAIL.WA.dt_dateEncode (pYear, 1, 1);
 }
 ;
 
@@ -9018,8 +9733,8 @@ create procedure OMAIL.WA.nntp_update (
     return;
 
   nInstance := OMAIL.WA.domain_nntp_name (_domain_id);
-  if (oConversation = 1 and nConversation = 0) {
-
+  if (oConversation = 1 and nConversation = 0)
+  {
     delete from DB.DBA.NEWS_MULTI_MSG where NM_GROUP = nntpGroup;
     nntpGroup := (select NG_GROUP from DB..NEWS_GROUPS where NG_NAME = nInstance);
     delete from DB.DBA.NEWS_MULTI_MSG where NM_GROUP = nntpGroup;
@@ -9057,7 +9772,8 @@ create procedure OMAIL.WA.mail_address_split (
 
   person := '';
   pos := strchr (author, '<');
-  if (pos is not NULL) {
+  if (pos is not NULL)
+  {
     person := "LEFT" (author, pos);
     email := subseq (author, pos, length (author));
     email := replace (email, '<', '');
@@ -9088,7 +9804,8 @@ create procedure OMAIL.WA.nntp_decode_subject (
   str := replace (str, '\t', '');
 
   match := regexp_match ('=\\?[^\\?]+\\?[A-Z]\\?[^\\?]+\\?=', str);
-  while (match is not null and inx > 0) {
+  while (match is not null and inx > 0)
+  {
     declare enc, ty, dat, tmp, cp, dec any;
 
     cp := match;
@@ -9155,10 +9872,12 @@ create procedure OMAIL.WA.nntp_process_parts (
   is_allowed := 0;
   i1 := 0;
   l1 := length (amime);
-  while (i1 < l1) {
+  while (i1 < l1)
+  {
     declare elm any;
     elm := trim(amime[i1]);
-    if (mime1 like elm) {
+    if (mime1 like elm)
+    {
       is_allowed := 1;
       i1 := l1;
     }
@@ -9168,7 +9887,8 @@ create procedure OMAIL.WA.nntp_process_parts (
   declare _cnt_disp any;
   _cnt_disp := get_keyword_ucase('Content-Disposition', part, '');
 
-  if (is_allowed and (any_part or (name1 <> '' and _cnt_disp in ('attachment', 'inline')))) {
+  if (is_allowed and (any_part or (name1 <> '' and _cnt_disp in ('attachment', 'inline'))))
+  {
     name := name1;
     mime := mime1;
     enc := get_keyword_ucase ('Content-Transfer-Encoding', part, '');
@@ -9268,7 +9988,8 @@ create procedure DB.DBA.MAIL_NEWS_MSG_I (
     st := tree[1][0];
     en := tree[1][1];
 
-    if (en > st + 5) {
+    if (en > st + 5)
+    {
 	    last := subseq (N_NM_BODY, en - 4, en);
   	  if (last = '\r\n.\r')
 	      en := en - 4;
@@ -9314,7 +10035,8 @@ create procedure DB.DBA.MAIL_NEWS_MSG_I (
   	  if (elm[1] not like 'text/%')
 	      signal ('CONVX', sprintf ('The post contains parts of type [%s] which is prohibited.', elm[1]));
 	  }
-    if (length (cset) and cset <> 'UTF-8') {
+    if (length (cset) and cset <> 'UTF-8')
+    {
 	    declare exit handler for sqlstate '2C000' { goto next_2;};
 	    content := charset_recode (content, cset, 'UTF-8');
 	  }
@@ -9367,7 +10089,6 @@ create procedure DB.DBA.MAIL_NEWS_MSG_I (
         if(locate('ods.mail',_ngroups[i]))
         {
            _use_ngroup:=_ngroups[i];
-      
       if(length(_use_ngroup)=0)
             signal ('CONVX', 'There is no ODS mail newsgroup to post.');
       
@@ -9564,7 +10285,11 @@ create procedure OMAIL.WA.dc_predicateMetas (inout anArray any)
     'rcv_date'    , vector (1, 'Date',        'datetime', 'datetime', vector ('size', '10', 'onclick', 'datePopup(\'-FIELD-\')', 'button', '<img id="-FIELD-_select" border="0" src="/oMail/i/pick_calendar.gif" onclick="javascript: datePopup(\'-FIELD-\');" />')),
     'priority'    , vector (1, 'Priority',    'priority', 'integer',  vector ()),
     'status'      , vector (0, 'Status',      'varchar',  'varchar',  vector ()),
-    'dsize'       , vector (1, 'Size',        'integer',  'integer',  vector ())
+    'dsize'        , vector (1, 'Size',              'integer',  'integer',  vector ()),
+    'ssl'          , vector (1, 'Signed',            'boolean',  'boolean',  vector ()),
+    'sslVerified'  , vector (1, 'Signed (Verified)', 'boolean',  'boolean',  vector ()),
+    'webID'        , vector (1, 'WebID',             'varchar',  'varchar',  vector ()),
+    'webIDVerified', vector (1, 'WebID (Verified)',  'boolean',  'boolean',  vector ())
   );
 }
 ;
@@ -9574,10 +10299,9 @@ create procedure OMAIL.WA.dc_predicateMetas (inout anArray any)
 create procedure OMAIL.WA.dc_compareMetas (inout anArray any)
 {
   anArray := vector (
-    '=',                      vector ('equal to'                 , vector ('integer', 'datetime', 'varchar', 'address', 'priority'), 1, 'case when (^{value}^ = ^{pattern}^) then 1 else 0 end'),
-    '<>',                     vector ('not equal to'             , vector ('integer', 'datetime', 'varchar', 'address', 'priority'), 1, 'case when (^{value}^ <> ^{pattern}^) then 1 else 0 end'),
-    '<',                      vector ('less than'                , vector ('integer', 'datetime', 'priority')                      , 1, 'case when (^{value}^ < ^{pattern}^) then 1 else 0 end'),
-    '<=',                     vector ('less than or equal to'    , vector ('integer', 'datetime', 'priority')                      , 1, 'case when (^{value}^ <= ^{pattern}^) then 1 else 0 end'),
+    '=',                      vector ('equal to'                 , vector ('integer', 'datetime', 'varchar', 'address', 'priority', 'boolean'), 1, 'case when (^{value}^ = ^{pattern}^) then 1 else 0 end'),
+    '<>',                     vector ('not equal to'             , vector ('integer', 'datetime', 'varchar', 'address', 'priority', 'boolean'), 1, 'case when (^{value}^ <> ^{pattern}^) then 1 else 0 end'),
+    '<',                      vector ('less than'                , vector ('integer', 'datetime', 'priority'), 1, 'case when (^{value}^ <= ^{pattern}^) then 1 else 0 end'),
     '>',                      vector ('greater than'             , vector ('integer', 'datetime', 'priority')                      , 1, 'case when (^{value}^ > ^{pattern}^) then 1 else 0 end'),
     '>=',                     vector ('greater than or equal to' , vector ('integer', 'datetime', 'priority')                      , 1, 'case when (^{value}^ >= ^{pattern}^) then 1 else 0 end'),
     'like',                   vector ('like'                     , vector ('varchar', 'address')                                   , 1, 'case when (^{value}^ like ^{pattern}^) then 1 else 0 end'),
@@ -9812,3 +10536,68 @@ create procedure OMAIL.WA.tmp_update ()
 OMAIL.WA.tmp_update ()
 ;
 
+-----------------------------------------------------------------------------------------
+--
+-- Certificates
+--
+-----------------------------------------------------------------------------------------
+create procedure OMAIL.WA.certificateExist (
+  in user_id integer,
+  in certificate varchar)
+{
+  if (exists (select 1
+                from DB.DBA.ods_user_keys (username) (xenc_key varchar) x
+               where username = OMAIL.WA.account_name (user_id)
+                 and x.xenc_key = certificate))
+    return 1;
+
+  return 0;
+}
+;
+
+-----------------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.certificateList (
+  in user_id integer,
+  in certificate varchar)
+{
+  declare S varchar;
+  declare stream any;
+
+  stream := string_output ();
+  http ('<certificates>', stream);
+
+  if ((certificate <> '') and not OMAIL.WA.certificateExist (user_id, certificate))
+    certificate := (select WAUI_SALMON_KEY from WA_USER_INFO where WAUI_U_ID = user_id);
+
+  for (select x.xenc_key, x.xenc_type
+         from DB.DBA.ods_user_keys (username) (xenc_key varchar, xenc_type varchar) x
+        where username = OMAIL.WA.account_name (user_id)) do
+  {
+    S := case when (xenc_key = certificate) then ' selected="selected"' else '' end;
+    http (sprintf ('<certificate%s>%V</certificate>', S, xenc_key), stream);
+  }
+  http ('</certificates>', stream);
+
+  return string_output_string (stream);
+}
+;
+
+-----------------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.certificate (
+  in _domain_id integer,
+  in _user_id integer)
+{
+  declare _settings, _name, _certificate, _pem, _key varchar;
+
+  _settings := OMAIL.WA.omail_get_settings (_domain_id, _user_id, 'base_settings');
+  _name := OMAIL.WA.omail_getp ('security_encrypt', _settings);
+  set_user_id (OMAIL.WA.account_name (_user_id));
+  _pem := xenc_pem_export(_name);
+  _key := xenc_pem_export(_name, 1);
+  set_user_id ('dba');
+
+  return vector (_pem, _key);
+}
+;
\ No newline at end of file
diff --git a/appsrc/ODS-WebMail/sql/eml/eml-create-tables.sql b/appsrc/ODS-WebMail/sql/eml/eml-create-tables.sql
index bc16d4f..e9ea418 100644
--- a/appsrc/ODS-WebMail/sql/eml/eml-create-tables.sql
+++ b/appsrc/ODS-WebMail/sql/eml/eml-create-tables.sql
@@ -1,5 +1,5 @@
 --
---  $Id: eml-create-tables.sql,v 1.9.2.3 2009/09/02 14:49:08 source Exp $
+--  $Id: eml-create-tables.sql,v 1.9.2.6 2011/01/25 14:12:06 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -19,7 +19,8 @@
 --  with this program; if not, write to the Free Software Foundation, Inc.,
 --  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 --
-
+-------------------------------------------------------------------------------
+--
 OMAIL.WA.exec_no_error (
  'create table OMAIL.WA.MESSAGES (
     DOMAIN_ID        INTEGER         NOT NULL,
@@ -42,6 +43,8 @@ OMAIL.WA.exec_no_error (
     PRIORITY         INTEGER         NOT NULL,
     SUBJECT          VARCHAR(255),
     ADDRES_INFO      VARCHAR(255)    NOT NULL,
+    M_CONTENT        LONG VARCHAR,
+    M_OPTIONS        LONG VARCHAR,
     M_RFC_ID         VARCHAR,
     M_RFC_HEADER     LONG VARCHAR,
     M_RFC_REFERENCES VARCHAR,
@@ -57,6 +60,16 @@ OMAIL.WA.exec_no_error (
 ;
 
 OMAIL.WA.exec_no_error (
+  'alter table OMAIL.WA.MESSAGES add M_CONTENT LONG VARCHAR', 'C', 'OMAIL.WA.MESSAGES', 'M_CONTENT'
+)
+;
+
+OMAIL.WA.exec_no_error (
+  'alter table OMAIL.WA.MESSAGES add M_OPTIONS LONG VARCHAR', 'C', 'OMAIL.WA.MESSAGES', 'M_OPTIONS'
+)
+;
+
+OMAIL.WA.exec_no_error (
   'alter table OMAIL.WA.MESSAGES add M_RFC_ID VARCHAR', 'C', 'OMAIL.WA.MESSAGES', 'M_RFC_ID'
 )
 ;
@@ -71,6 +84,8 @@ OMAIL.WA.exec_no_error (
 )
 ;
 
+-------------------------------------------------------------------------------
+--
 OMAIL.WA.exec_no_error (
  'create table OMAIL.WA.MSG_PARTS (
     DOMAIN_ID   INTEGER         NOT NULL,
@@ -98,6 +113,8 @@ OMAIL.WA.exec_no_error (
 )
 ;
 
+-------------------------------------------------------------------------------
+--
 OMAIL.WA.exec_no_error (
  'create table OMAIL.WA.FOLDERS (
     DOMAIN_ID   integer         not null,
@@ -110,6 +127,8 @@ OMAIL.WA.exec_no_error (
     NAME        varchar         not null,
     PATH        varchar,
     DATA        long varchar,
+    F_TYPE      varchar,
+    F_SOURCE    integer,
 
     PRIMARY KEY (DOMAIN_ID,USER_ID,FOLDER_ID)
   )'
@@ -142,32 +161,228 @@ OMAIL.WA.exec_no_error (
 ;
 
 OMAIL.WA.exec_no_error (
+  'alter table OMAIL.WA.FOLDERS add F_TYPE varchar', 'C', 'OMAIL.WA.FOLDERS', 'F_TYPE'
+)
+;
+
+OMAIL.WA.exec_no_error (
+  'alter table OMAIL.WA.FOLDERS add F_SOURCE integer', 'C', 'OMAIL.WA.FOLDERS', 'F_SOURCE'
+)
+;
+
+OMAIL.WA.exec_no_error (
   'CREATE UNIQUE INDEX FOLDERS_NAME_ID ON OMAIL.WA.FOLDERS (DOMAIN_ID, USER_ID, PARENT_ID, NAME)'
 )
 ;
 
+OMAIL.WA.exec_no_error('
+  create trigger FOLDERS_AI after insert on OMAIL.WA.FOLDERS referencing new as N {
+    OMAIL.WA.folder_trigger (N.DOMAIN_ID, N.USER_ID, N.FOLDER_ID, N.PARENT_ID, N.NAME, N.F_TYPE);
+  }
+');
+
+OMAIL.WA.exec_no_error('
+  create trigger FOLDERS_AU after update on OMAIL.WA.FOLDERS referencing old as O, new as N {
+    OMAIL.WA.folder_trigger (N.DOMAIN_ID, N.USER_ID, N.FOLDER_ID, N.PARENT_ID, N.NAME, N.F_TYPE);
+  }
+');
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_trigger (
+  in _domain_id integer,
+  in _user_id integer,
+  in _folder_id integer,
+  in _parent_id integer,
+  in _name varchar,
+  in _type varchar)
+{
+  declare _path varchar;
+
+  _path := coalesce((select PATH from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and FOLDER_ID = _parent_id), '') || '/' || _name;
+
+  set triggers off;
+  update OMAIL.WA.FOLDERS
+     set PATH = _path
+   where DOMAIN_ID = _domain_id
+     and USER_ID = _user_id
+     and FOLDER_ID = _folder_id;
+  OMAIL.WA.folder_paths (_domain_id, _user_id, _folder_id, _path);
+  set triggers on;
+
+  if (DB.DBA.is_empty_or_null (_type))
+  {
+    declare _type varchar;
+
+    _type := '';
+    if (ucase (_name) like 'INBOX%')
+      _type := 'INBOX';
+
+    if (ucase (_name) like 'TRASH%')
+      _type := 'TRASH';
+
+    if (ucase (_name) like 'SENT%')
+      _type := 'SENT';
+
+    if (ucase (_name) like 'DRAFT%')
+      _type := 'DRAFT';
+
+    if (ucase (_name) like 'SPAM%')
+      _type := 'SPAM';
+
+    if (_type <> '')
+    {
+      set triggers off;
+      update OMAIL.WA.FOLDERS
+         set SYSTEM_FLAG = 'S',
+             F_TYPE = _type
+       where DOMAIN_ID = _domain_id
+         and USER_ID = _user_id
+         and FOLDER_ID = _folder_id;
+      set triggers on;
+    }
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.folder_paths (
+  in _domain_id integer,
+  in _user_id integer,
+  in _parent_id integer,
+  in _path varchar)
+{
+  declare _folder_id integer;
+
+  for (select NAME, FOLDER_ID from OMAIL.WA.FOLDERS where DOMAIN_ID = _domain_id and USER_ID = _user_id and PARENT_ID = _parent_id) do
+  {
+    _folder_id := FOLDER_ID;
+    update OMAIL.WA.FOLDERS
+       set PATH = _path || '/' || NAME
+     where DOMAIN_ID = _domain_id
+       and USER_ID = _user_id
+       and FOLDER_ID = _folder_id;
+    OMAIL.WA.folder_paths (_domain_id, _user_id, _folder_id, _path || '/' || NAME);
+  }
+}
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.mail_folder_type ()
+{
+  if (registry_get ('mail_folder_type') = '1')
+    return;
+
+  update OMAIL.WA.FOLDERS set F_TYPE = 'INBOX' where FOLDER_ID = 100;
+  update OMAIL.WA.FOLDERS set F_TYPE = 'TRASH' where FOLDER_ID = 110;
+  update OMAIL.WA.FOLDERS set F_TYPE = 'SENT'  where FOLDER_ID = 120;
+  update OMAIL.WA.FOLDERS set F_TYPE = 'DRAFT' where FOLDER_ID = 130;
+  update OMAIL.WA.FOLDERS set F_TYPE = 'SPAM'  where FOLDER_ID = 125;
+
+  registry_set ('mail_folder_type', '1');
+}
+;
+
+OMAIL.WA.mail_folder_type ()
+;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.mail_folder_path ()
+{
+  if (registry_get ('mail_folder_path') = '1')
+    return;
+
+  for (select distinct DOMAIN_ID, USER_ID from OMAIL.WA.FOLDERS where PARENT_ID = 0) do
+  {
+    OMAIL.WA.folder_paths(DOMAIN_ID, USER_ID, 0, '');
+  }
+
+  registry_set ('mail_folder_path', '1');
+}
+;
+
+OMAIL.WA.mail_folder_path ()
+;
+
+-------------------------------------------------------------------------------
+--
 OMAIL.WA.exec_no_error (
- 'create table OMAIL.WA.EXTERNAL_POP_ACC(
-    DOMAIN_ID   INTEGER      NOT NULL,
-    USER_ID     INTEGER      NOT NULL,
-    ACC_ID      INTEGER      NOT NULL,
-    ACC_NAME    VARCHAR(100) NOT NULL,
-    POP_SERVER  VARCHAR(100) NOT NULL,
-    POP_PORT    INTEGER      NOT NULL,
-    USER_NAME   VARCHAR(100) NOT NULL,
-    USER_PASS   VARCHAR(100) NOT NULL,
-    CH_INTERVAL INTEGER      NOT NULL,
-    MCOPY       INTEGER      NOT NULL,
-    FOLDER_ID   INTEGER      NOT NULL,
-    LAST_CHECK  DATETIME,
-    CH_ERROR    INTEGER      NOT NULL,
-
-    PRIMARY KEY (DOMAIN_ID,USER_ID,ACC_ID)
+ 'create table OMAIL.WA.EXTERNAL_ACCOUNT (
+    EA_ID             integer      identity,
+    EA_DOMAIN_ID      integer      not null,
+    EA_USER_ID        integer      not null,
+    EA_NAME           varchar      not null,
+    EA_TYPE           varchar      default \'pop3\',
+    EA_HOST           varchar      not null,
+    EA_PORT           integer      not null,
+    EA_CONNECT_TYPE   varchar      default \'none\',
+    EA_USER           varchar      not null,
+    EA_PASSWORD       varchar      not null,
+    EA_MCOPY          integer      not null,
+    EA_FOLDER_ID      integer      default 100,
+    EA_CHECK_INTERVAL integer      not null,
+    EA_CHECK_DATE     datetime,
+    EA_CHECK_ERROR    integer,
+
+    PRIMARY KEY (EA_ID)
   )'
 )
 ;
 
 OMAIL.WA.exec_no_error (
+  'CREATE UNIQUE INDEX EXTERNAL_ACCOUNT_NAME_ID ON OMAIL.WA.EXTERNAL_ACCOUNT (EA_DOMAIN_ID, EA_USER_ID, EA_NAME)'
+)
+;
+
+create procedure OMAIL.WA.upgrade ()
+{
+  if (registry_get ('omail_accounts_upgrade') = '1')
+    return;
+
+  OMAIL.WA.exec_no_error (
+   'insert into OMAIL.WA.EXTERNAL_ACCOUNT(
+      EA_DOMAIN_ID,
+      EA_USER_ID,
+      EA_NAME,
+      EA_HOST,
+      EA_PORT,
+      EA_CONNECT_TYPE,
+      EA_USER,
+      EA_PASSWORD,
+      EA_MCOPY,
+      EA_FOLDER_ID,
+      EA_CHECK_INTERVAL,
+      EA_CHECK_DATE,
+      EA_CHECK_ERROR)
+    select
+      DOMAIN_ID,
+      USER_ID,
+      ACC_NAME,
+      POP_SERVER,
+      POP_PORT,
+      POP_TYPE,
+      USER_NAME,
+      USER_PASS,
+      MCOPY,
+      FOLDER_ID,
+      CH_INTERVAL,
+      LAST_CHECK,
+      CH_ERROR
+    from OMAIL.WA.EXTERNAL_POP_ACC
+    '
+  );
+
+  registry_set ('omail_accounts_upgrade', '1');
+}
+;
+OMAIL.WA.upgrade ();
+
+-------------------------------------------------------------------------------
+--
+OMAIL.WA.exec_no_error (
   'create table OMAIL.WA.MIME_HANDLERS(
     ID      INTEGER     NOT NULL,
     TYPE_ID INTEGER     NOT NULL,
@@ -179,6 +394,8 @@ OMAIL.WA.exec_no_error (
 )
 ;
 
+-------------------------------------------------------------------------------
+--
 OMAIL.WA.exec_no_error (
   'create table OMAIL.WA.SETTINGS(
     DOMAIN_ID   INTEGER      NOT NULL,
@@ -191,6 +408,8 @@ OMAIL.WA.exec_no_error (
 )
 ;
 
+-------------------------------------------------------------------------------
+--
 OMAIL.WA.exec_no_error (
   'create table OMAIL.WA.SHARES (
     SHARE_ID    INTEGER         NOT NULL,
@@ -206,6 +425,8 @@ OMAIL.WA.exec_no_error (
 )
 ;
 
+-------------------------------------------------------------------------------
+--
 OMAIL.WA.exec_no_error (
   'create table OMAIL.WA.CONVERSATION (
     C_ID integer identity,
@@ -224,6 +445,8 @@ OMAIL.WA.exec_no_error (
 )
 ;
 
+-------------------------------------------------------------------------------
+--
 OMAIL.WA.exec_no_error (
   'create table OMAIL.WA.FILTERS (
     F_ID integer identity,
@@ -294,7 +517,7 @@ OMAIL.WA.exec_no_error (
 )
 ;
 
--- CREATE TRIGERS --------------------------------------------------------------
+-- CREATE TRIGGERS -------------------------------------------------------------
 
 OMAIL.WA.exec_no_error (
   'CREATE TRIGGER EML_MESSAGES_A_I after insert on OMAIL.WA.MESSAGES referencing new as N
@@ -549,12 +772,17 @@ create procedure OMAIL.WA.dsize_update (in _domain_id integer, in _user_id integ
 --
 create procedure OMAIL.WA.MESSAGES_ADDRESS_HOOK (inout vtb any, inout d_id any, in mode any)
 {
-  declare _user_id, _folder_id, _address any;
+  declare S, _user_id, _folder_id, _address, _options any;
 
-  select USER_ID, FOLDER_ID, ADDRESS into _user_id, _folder_id, _address from OMAIL.WA.MESSAGES where FREETEXT_ID = d_id;
+  select USER_ID, FOLDER_ID, ADDRESS, M_OPTIONS into _user_id, _folder_id, _address, _options from OMAIL.WA.MESSAGES where FREETEXT_ID = d_id;
 
+  S := '';
   if (not isnull(_address))
-    vt_batch_feed (vtb, _address, mode, 1);
+    S := S || _address;
+  if (not isnull(_options))
+    S := S || _options;
+  if (S <> '')
+    vt_batch_feed (vtb, S, mode, 1);
   if (not isnull(_folder_id))
     vt_batch_feed (vtb, sprintf ('^F%d', _folder_id), mode);
   if (not isnull(_user_id))
@@ -568,7 +796,9 @@ create procedure OMAIL.WA.MESSAGES_ADDRESS_HOOK (inout vtb any, inout d_id any,
 --
 create procedure OMAIL.WA.drop_index ()
 {
-  if (registry_get ('mail_index_version') <> '1')
+  if (registry_get ('mail_index_version') = '2')
+    return;
+
     OMAIL.WA.exec_no_error('drop table OMAIL.WA.MESSAGES_ADDRESS_WORDS');
 }
 ;
@@ -593,15 +823,9 @@ create procedure OMAIL.WA.MESSAGES_ADDRESS_UNINDEX_HOOK (inout vtb any, inout d_
 ;
 
 OMAIL.WA.exec_no_error(
-  'create text xml index on OMAIL.WA.MESSAGES (ADDRESS) with key FREETEXT_ID not insert CLUSTERED WITH (FOLDER_ID) using function'
+  'create text xml index on OMAIL.WA.MESSAGES (ADDRESS) with key FREETEXT_ID not insert CLUSTERED WITH (FOLDER_ID) using function language \'x-ViDoc\''
 )
 ;
-
-OMAIL.WA.VT_INDEX_OMAIL_WA_MESSAGES ()
-;
-DB.DBA.vt_batch_update ('OMAIL.WA.MESSAGES', 'off', null)
-;
-
 -------------------------------------------------------------------------------
 --
 create procedure OMAIL.WA.MSG_PARTS_TDATA_HOOK (inout vtb any, inout d_id any, in mode any)
@@ -637,7 +861,9 @@ create procedure OMAIL.WA.MSG_PARTS_TDATA_HOOK (inout vtb any, inout d_id any, i
 --
 create procedure OMAIL.WA.drop_index()
 {
-  if (registry_get ('mail_index_version') <> '1')
+  if (registry_get ('mail_index_version') = '2')
+    return;
+
     OMAIL.WA.exec_no_error ('drop table OMAIL.WA.MSG_PARTS_TDATA_WORDS');
 }
 ;
@@ -661,26 +887,26 @@ create procedure OMAIL.WA.MSG_PARTS_TDATA_unindex_hook (inout vtb any, inout d_i
   }
 ;
 
-OMAIL.WA.exec_no_error('
-  create text index on OMAIL.WA.MSG_PARTS(TDATA) with key FREETEXT_ID not insert CLUSTERED WITH (TAGS) using function
-')
-;
-
-OMAIL.WA.vt_index_OMAIL_WA_MSG_PARTS ()
-;
-DB.DBA.vt_batch_update('OMAIL.WA.MSG_PARTS', 'off', null)
+OMAIL.WA.exec_no_error(
+  'create text index on OMAIL.WA.MSG_PARTS(TDATA) with key FREETEXT_ID not insert CLUSTERED WITH (TAGS) using function language \'x-ViDoc\''
+)
 ;
 
 -------------------------------------------------------------------------------
 --
-registry_set ('mail_index_version', '1')
+registry_set ('mail_index_version', '2')
 ;
 
 -------------------------------------------------------------------------------
 --
 OMAIL.WA.exec_no_error ('
+  delete from DB.DBA.SYS_SCHEDULED_EVENT where SE_NAME = \'WebMail External POP3 Scheduler\'
+')
+;
+
+OMAIL.WA.exec_no_error ('
   insert replacing DB.DBA.SYS_SCHEDULED_EVENT (SE_NAME, SE_START, SE_SQL, SE_INTERVAL)
-    values(\'WebMail External POP3 Scheduler\', now(), \'OMAIL.WA.omail_ch_pop3_acc_schedule ()\', 10)
+    values(\'WebMail External Account Scheduler\', now(), \'OMAIL.WA.external_account_schedule ()\', 10)
 ')
 ;
 
diff --git a/appsrc/ODS-WebMail/sql/eml/eml-dev-code.sql b/appsrc/ODS-WebMail/sql/eml/eml-dev-code.sql
index 0eee5d6..8bcd3a2 100644
--- a/appsrc/ODS-WebMail/sql/eml/eml-dev-code.sql
+++ b/appsrc/ODS-WebMail/sql/eml/eml-dev-code.sql
@@ -1,5 +1,5 @@
 --
---  $Id: eml-dev-code.sql,v 1.2 2006/05/31 13:13:03 source Exp $
+--  $Id: eml-dev-code.sql,v 1.2.2.1 2010/09/20 10:15:42 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-WebMail/sql/omail-api.sql b/appsrc/ODS-WebMail/sql/omail-api.sql
index a2993ca..12885b7 100644
--- a/appsrc/ODS-WebMail/sql/omail-api.sql
+++ b/appsrc/ODS-WebMail/sql/omail-api.sql
@@ -1,5 +1,5 @@
 --
---  $Id: omail-api.sql,v 1.2.2.1 2009/08/20 22:38:14 source Exp $
+--  $Id: omail-api.sql,v 1.2.2.2 2010/09/20 10:15:41 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-WebMail/sql/omail-wa-install.sql b/appsrc/ODS-WebMail/sql/omail-wa-install.sql
index 6974ad8..a838be2 100644
--- a/appsrc/ODS-WebMail/sql/omail-wa-install.sql
+++ b/appsrc/ODS-WebMail/sql/omail-wa-install.sql
@@ -1,5 +1,5 @@
 --
---  $Id: omail-wa-install.sql,v 1.6 2007/11/28 10:33:36 source Exp $
+--  $Id: omail-wa-install.sql,v 1.6.2.4 2011/01/25 14:12:05 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -113,6 +113,7 @@ create procedure OMAIL.WA.omail_install()
                ses_vars   => 1
               );
 
+  if ((select count(*) from DB.DBA.WA_DOMAINS) = 0)
   insert replacing DB.DBA.WA_DOMAINS(WD_DOMAIN) values('domain.com');
 }
 ;
@@ -165,6 +166,11 @@ OMAIL.WA.exec_no_error(
 ;
 
 OMAIL.WA.exec_no_error(
+  'alter type wa_mail add overriding method wa_dashboard () returns any'
+)
+;
+
+OMAIL.WA.exec_no_error(
   'alter type wa_mail add method wa_dashboard_last_item () returns any'
 )
 ;
@@ -295,11 +301,10 @@ create method wa_state_edit_form(inout stream any) for wa_mail
     sSid := (select VS_SID from VSPX_SESSION where VS_REALM = 'wa' and VS_UID = connection_get('vspx_user'));
     http_request_status ('HTTP/1.1 302 Found');
     http_header(sprintf('Location: %s?sid=%s&realm=%s\r\n', WS.WS.EXPAND_URL(self.wa_home_url(), 'set_mail.vsp'), sSid, 'wa'));
-  } else {
-    signal('42001', 'Not a owner');
-  }
   return;
 }
+  signal('42001', 'Not a owner');
+}
 ;
 
 -------------------------------------------------------------------------------
@@ -377,11 +382,14 @@ create method get_param (in param varchar) for wa_mail
   declare retValue any;
 
   retValue := null;
-  if (param = 'host') {
+  if (param = 'host')
+  {
     retValue := registry_get('_oMail_path_');
     if (cast(retValue as varchar) = '0')
       retValue := '/apps/oMail/';
-  } if (param = 'isDAV') {
+  }
+  else if (param = 'isDAV')
+  {
     retValue := 1;
     if (isnull(strstr(self.get_param('host'), '/DAV/VAD')))
       retValue := 0;
@@ -392,12 +400,39 @@ create method get_param (in param varchar) for wa_mail
 
 -------------------------------------------------------------------------------
 --
+create method wa_dashboard () for wa_mail
+{
+  declare domainID, userID integer;
+
+  domainID := self.wa_id ();
+  userID := OMAIL.WA.domain_owner_id (domainID);
+  return (select XMLAGG ( XMLELEMENT ( 'dash-row',
+                                       XMLATTRIBUTES ( 'normal' as "class",
+                                                       OMAIL.WA.dt_format(_time, 'Y/M/D H:N') as "time",
+                                                       self.wa_name as "application"
+                                                      ),
+                                       XMLELEMENT ( 'dash-data',
+	                                                  XMLATTRIBUTES ( concat (N'<a href="', cast (SIOC..mail_post_iri (domainID, _id) as nvarchar), N'">', OMAIL.WA.utf2wide (_title), N'</a>') as "content",
+	                                                                  0 as "comments"
+	                                                                )
+                                          	      )
+                                     )
+                     	  )
+            from OMAIL.WA.dashboard_rs(p0, p1)(_id integer, _title varchar, _time datetime) x
+           where p0 = 1
+             and p1 = userID
+         );
+}
+;
+
+-------------------------------------------------------------------------------
+--
 create method wa_dashboard_last_item () for wa_mail
 {
   declare waID, domainID, userID integer;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  userID := (select WAM_USER from WA_MEMBER B where WAM_INST= self.wa_name and WAM_MEMBER_TYPE = 1);
+  domainID := self.wa_id ();
+  userID := OMAIL.WA.domain_owner_id (domainID);
   waID := coalesce((select top 1 WAI_ID from DB.DBA.WA_MEMBER, DB.DBA.WA_INSTANCE where WAM_INST = WAI_NAME and WAM_USER = userID and WAI_TYPE_NAME = 'oMail' order by WAI_ID), 0);
   if (waID = domainID)
     domainID := 1;
@@ -411,9 +446,31 @@ create method wa_rdf_url (in vhost varchar, in lhost varchar) for wa_mail
 {
   declare domainID, userID integer;
 
-  domainID := (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_NAME = self.wa_name);
-  userID := (select WAM_USER from WA_MEMBER B where WAM_INST= self.wa_name and WAM_MEMBER_TYPE = 1);
-
+  domainID := self.wa_id ();
+  userID := OMAIL.WA.domain_owner_id (domainID);
   return sprintf('http://' || DB.DBA.http_get_host () || '/oMail/res/export.vsp?output=about&did=%d&uid=%d', domainID, userID);
 }
 ;
+
+-------------------------------------------------------------------------------
+--
+create procedure OMAIL.WA.path_upgrade ()
+{
+  if (registry_get ('omail_path_upgrade2') = '1')
+    return;
+
+  for (select WAI_ID from DB.DBA.WA_INSTANCE where WAI_TYPE_NAME = 'oMail') do
+  {
+    for (select HP_LPATH as _lpath,
+                HP_HOST as _vhost,
+                HP_LISTEN_HOST as _lhost
+           from DB.DBA.HTTP_PATH
+          where HP_LPATH = '/oMail/' || cast (WAI_ID as varchar) || '/box.vsp') do
+    {
+      VHOST_REMOVE (vhost=>_vhost, lhost=>_lhost, lpath=>_lpath);
+    }
+  }
+  registry_set ('omail_path_upgrade2', '1');
+}
+;
+OMAIL.WA.path_upgrade ();
diff --git a/appsrc/ODS-WebMail/sql/omail-wa-uninstall.sql b/appsrc/ODS-WebMail/sql/omail-wa-uninstall.sql
index c4d2c77..1dda50f 100644
--- a/appsrc/ODS-WebMail/sql/omail-wa-uninstall.sql
+++ b/appsrc/ODS-WebMail/sql/omail-wa-uninstall.sql
@@ -1,5 +1,5 @@
 --
---  $Id: omail-wa-uninstall.sql,v 1.11 2008/09/10 11:19:29 source Exp $
+--  $Id: omail-wa-uninstall.sql,v 1.11.2.4 2011/01/25 14:12:05 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -45,14 +45,28 @@ create procedure OMAIL.WA.uninstall ()
 OMAIL.WA.uninstall ()
 ;
 
+create procedure OMAIL.WA.uninstall ()
+{
+  for select DB.DBA.DAV_SEARCH_PATH (COL_ID, 'C') path from WS.WS.SYS_DAV_COL where COL_DET = 'oMail' do
+  {
+    DB.DBA.DAV_DELETE_INT (path, 1, null, null, 0);
+    commit work;
+  }
+}
+;
+OMAIL.WA.uninstall ()
+;
+
 -- Scheduler
 OMAIL.WA.exec_no_error('DELETE FROM DB.DBA.SYS_SCHEDULED_EVENT WHERE SE_NAME = \'WebMail External POP3 Scheduler\'');
+OMAIL.WA.exec_no_error ('DELETE FROM DB.DBA.SYS_SCHEDULED_EVENT WHERE SE_NAME = \'WebMail External Scheduler\'');
 OMAIL.WA.exec_no_error ('DELETE FROM DB.DBA.SYS_SCHEDULED_EVENT WHERE SE_NAME = \'WebMail Spam Clean Scheduler\'');
 
 -- Tables
 OMAIL.WA.exec_no_error('DROP TABLE OMAIL.WA.MSG_PARTS_TDATA_WORDS');
 OMAIL.WA.exec_no_error('DROP TABLE OMAIL.WA.MESSAGES_ADDRESS_WORDS');
 OMAIL.WA.exec_no_error('DROP TABLE OMAIL.WA.MIME_HANDLERS');
+OMAIL.WA.exec_no_error ('DROP TABLE OMAIL.WA.EXTERNAL_ACCOUNT');
 OMAIL.WA.exec_no_error('DROP TABLE OMAIL.WA.EXTERNAL_POP_ACC');
 OMAIL.WA.exec_no_error('DROP TABLE OMAIL.WA.MSG_PARTS');
 OMAIL.WA.exec_no_error('DROP TABLE OMAIL.WA.MESSAGES');
@@ -74,6 +88,16 @@ vhost_remove (lpath=>'/oMail/res');
 OMAIL.WA.exec_no_error('delete from WA_TYPES where WAT_NAME = \'oMail\'');
 OMAIL.WA.exec_no_error('drop type wa_mail');
 
+-- Registry
+registry_remove ('_oMail_path_');
+registry_remove ('_oMail_version_');
+registry_remove ('_oMail_build_');
+registry_remove ('_oMail_spam_');
+registry_remove ('omail_version_upgrade');
+registry_remove ('omail_path_upgrade2');
+registry_remove ('mail_index_version');
+registry_remove ('__ods_mail_sioc_init');
+
 -- Procedures
 create procedure OMAIL.WA.omail_drop_procedures()
 {
@@ -120,5 +144,44 @@ OMAIL.WA.exec_no_error ('DROP procedure ODS.ODS_API."mail.folder.rename"');
 OMAIL.WA.exec_no_error ('DROP procedure ODS.ODS_API."mail.options.set"');
 OMAIL.WA.exec_no_error ('DROP procedure ODS.ODS_API."mail.options.get"');
 
+-- dropping DET procs
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_AUTHENTICATE"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_NORM"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_GET_CONFIG"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_FNMERGE"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_FNSPLIT"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_FIXNAME"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_COMPOSE_NAME"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_SEARCH_ID_IMPL"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_AUTHENTICATE_HTTP"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_GET_PARENT"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_COL_CREATE"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_COL_MOUNT"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_COL_MOUNT_HERE"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_DELETE"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_RES_UPLOAD"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_PROP_REMOVE"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_PROP_SET"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_PROP_GET"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_PROP_LIST"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_COLNAME_OF_FOLDER"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_RESNAME_OF_MAIL"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_DIR_SINGLE"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_DIR_LIST"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_FC_PRED_METAS"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_FC_TABLE_METAS"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_FC_PRINT_WHERE"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_DIR_FILTER"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_SEARCH_ID"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_SEARCH_PATH"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_RES_UPLOAD_COPY"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_RES_UPLOAD_MOVE"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_RES_CONTENT"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_SYMLINK"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_LOCK"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_UNLOCK"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_IS_LOCKED"');
+OMAIL.WA.exec_no_error ('DROP procedure DB.DBA."oMail_DAV_LIST_LOCKS"');
+
 -- final proc
 OMAIL.WA.exec_no_error('DROP procedure OMAIL.WA.exec_no_error');
diff --git a/appsrc/ODS-WebMail/sql/res/res-create-code-data.sql b/appsrc/ODS-WebMail/sql/res/res-create-code-data.sql
index e26c2c8..e5db713 100644
--- a/appsrc/ODS-WebMail/sql/res/res-create-code-data.sql
+++ b/appsrc/ODS-WebMail/sql/res/res-create-code-data.sql
@@ -1,5 +1,5 @@
 --
---  $Id: res-create-code-data.sql,v 1.3.2.1 2009/10/28 21:32:15 source Exp $
+--  $Id: res-create-code-data.sql,v 1.3.2.3 2011/03/08 13:25:12 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -216,6 +216,8 @@ OMAIL.WA.res_mime_create(30540,'application/x-zip-compressed', '')
 ;
 OMAIL.WA.res_mime_create(30550,'application/x-gzip-compressed', '')
 ;
+OMAIL.WA.res_mime_create(30560,'application/ics', '')
+;
 
 -- audio - ID 40xxx ------------------------------------------------------------
 OMAIL.WA.res_mime_create(40100,'audio/basic', '')
diff --git a/appsrc/ODS-WebMail/sql/res/res-create-code.sql b/appsrc/ODS-WebMail/sql/res/res-create-code.sql
index 0f921e7..77eb772 100644
--- a/appsrc/ODS-WebMail/sql/res/res-create-code.sql
+++ b/appsrc/ODS-WebMail/sql/res/res-create-code.sql
@@ -1,5 +1,5 @@
 --
---  $Id: res-create-code.sql,v 1.3 2006/10/17 14:11:10 source Exp $
+--  $Id: res-create-code.sql,v 1.3.2.1 2010/09/20 10:15:42 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-WebMail/sql/res/res-create-tables.sql b/appsrc/ODS-WebMail/sql/res/res-create-tables.sql
index 58d519f..d11393e 100644
--- a/appsrc/ODS-WebMail/sql/res/res-create-tables.sql
+++ b/appsrc/ODS-WebMail/sql/res/res-create-tables.sql
@@ -1,5 +1,5 @@
 --
---  $Id: res-create-tables.sql,v 1.2 2006/05/31 13:13:03 source Exp $
+--  $Id: res-create-tables.sql,v 1.2.2.1 2010/09/20 10:15:42 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-WebMail/sql/sioc_mail.sql b/appsrc/ODS-WebMail/sql/sioc_mail.sql
index 9642f07..0172550 100644
--- a/appsrc/ODS-WebMail/sql/sioc_mail.sql
+++ b/appsrc/ODS-WebMail/sql/sioc_mail.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sioc_mail.sql,v 1.7.2.1 2009/11/17 21:37:41 source Exp $
+--  $Id: sioc_mail.sql,v 1.7.2.2 2010/09/20 10:15:41 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-WebMail/sql/utl/utl-create-code.sql b/appsrc/ODS-WebMail/sql/utl/utl-create-code.sql
index 756ceb2..0ae703c 100644
--- a/appsrc/ODS-WebMail/sql/utl/utl-create-code.sql
+++ b/appsrc/ODS-WebMail/sql/utl/utl-create-code.sql
@@ -1,5 +1,5 @@
 --
---  $Id: utl-create-code.sql,v 1.4.2.1 2009/05/11 07:39:15 source Exp $
+--  $Id: utl-create-code.sql,v 1.4.2.4 2010/09/20 10:15:42 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -128,20 +128,23 @@ create procedure OMAIL.WA.utl_myhttp(
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.utl_redirect(in afull_location varchar)
+create procedure OMAIL.WA.utl_redirect(in full_location varchar)
 {
-  signal('90001',afull_location);
+  signal('90001', full_location);
   return;
 }
 ;
 
 -------------------------------------------------------------------------------
 --
-create procedure OMAIL.WA.utl_doredirect(in afull_location varchar)
+create procedure OMAIL.WA.utl_doredirect(in full_location varchar, in domain_id integer := null)
 {
+  if (not isnull (domain_id) and (coalesce (strstr (full_location, 'http'), -1) <> 0))
+    full_location := OMAIL.WA.domain_sioc_url (domain_id) || '/' || full_location;
+
   http_rewrite();
   http_request_status('HTTP/1.1 302');
-  http_header(sprintf('Location: %s \r\n',afull_location));
+  http_header(sprintf('Location: %s \r\n', full_location));
 
   return;
 }
@@ -168,3 +171,54 @@ create procedure OMAIL.WA.utl_redirect_adv(
 	return;
 }
 ;
+
+create procedure OMAIL.WA.utl_decode_field (in str varchar)
+{
+  declare match varchar;
+  declare inx int;
+
+  inx := 50;
+
+  match := regexp_match ('=\\?[^\\?]+\\?[A-Z]\\?[^\\?]+\\?=', str);
+  while (match is not null and inx > 0)
+    {
+      declare enc, ty, dat, tmp, cp, dec any;
+
+      cp := match;
+      tmp := regexp_match ('^=\\?[^\\?]+\\?[A-Z]\\?', match);
+
+      match := substring (match, length (tmp)+1, length (match) - length (tmp) - 2);
+
+      enc := regexp_match ('=\\?[^\\?]+\\?', tmp);
+
+      tmp := replace (tmp, enc, '');
+
+      enc := trim (enc, '?=');
+      ty := trim (tmp, '?');
+
+      if (ty = 'B')
+	{
+	  dec := decode_base64 (match);
+	}
+      else if (ty = 'Q')
+	{
+	  dec := uudecode (match, 12);
+	}
+      else
+	{
+	  dec := '';
+	}
+      declare exit handler for sqlstate '2C000'
+	{
+	  return;
+	};
+      dec := charset_recode (dec, enc, 'UTF-8');
+
+      str := replace (str, cp, dec);
+
+      --dbg_printf ('encoded=[%s] enc=[%s] type=[%s] decoded=[%s]', match, enc, ty, dec);
+      match := regexp_match ('=\\?[^\\?]+\\?[A-Z]\\?[^\\?]+\\?=', str);
+      inx := inx - 1;
+    }
+  return str;
+};
diff --git a/appsrc/ODS-WebMail/sql/wa_search_mail.sql b/appsrc/ODS-WebMail/sql/wa_search_mail.sql
index 01a12cb..982217e 100644
--- a/appsrc/ODS-WebMail/sql/wa_search_mail.sql
+++ b/appsrc/ODS-WebMail/sql/wa_search_mail.sql
@@ -1,5 +1,5 @@
 --
---  $Id: wa_search_mail.sql,v 1.3 2007/05/29 10:41:23 source Exp $
+--  $Id: wa_search_mail.sql,v 1.3.2.1 2010/09/20 10:15:42 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-WebMail/www-root/mail/i/css/print.css b/appsrc/ODS-WebMail/www-root/mail/i/css/print.css
index 1c50075..44e59a9 100644
--- a/appsrc/ODS-WebMail/www-root/mail/i/css/print.css
+++ b/appsrc/ODS-WebMail/www-root/mail/i/css/print.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: print.css,v 1.2 2006/05/31 13:13:03 source Exp $
+ *  $Id: print.css,v 1.2.2.1 2010/09/20 10:15:43 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-WebMail/www-root/mail/i/css/styles.css b/appsrc/ODS-WebMail/www-root/mail/i/css/styles.css
index cdace6d..e582e43 100644
--- a/appsrc/ODS-WebMail/www-root/mail/i/css/styles.css
+++ b/appsrc/ODS-WebMail/www-root/mail/i/css/styles.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: styles.css,v 1.9.2.3 2010/01/14 16:04:14 source Exp $
+ *  $Id: styles.css,v 1.9.2.5 2010/09/20 10:15:43 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -27,6 +27,11 @@ body {
   font-family: Verdana, Arial, Helvetica, Sans-Serif;
   font-size: 12px}
 
+.pointer
+{
+  cursor: pointer;
+}
+
 /*
   Fields
 */
@@ -908,3 +913,20 @@ td.calendar_selected {
 .calendar_special {
 	color: #c55;
 }
+
+/* tbl inputs */
+span.button {
+  background: none repeat scroll 0 0 #99B3C5;
+  border: 1px solid #7F94A5;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  color: #FFFFFF;
+  font-size: 0.8em;
+  font-weight: bold;
+  padding: 3px 4px 1px;
+  text-decoration:none;
+}
+
+img.button {
+  margin-bottom: -3px;
+}
diff --git a/appsrc/ODS-WebMail/www-root/mail/i/js/script.js b/appsrc/ODS-WebMail/www-root/mail/i/js/script.js
index eecdb9b..0ca01b2 100644
--- a/appsrc/ODS-WebMail/www-root/mail/i/js/script.js
+++ b/appsrc/ODS-WebMail/www-root/mail/i/js/script.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: script.js,v 1.11.2.6 2010/07/09 14:37:01 source Exp $
+ *  $Id: script.js,v 1.11.2.11 2011/02/14 13:03:14 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -364,7 +364,7 @@ function coloriseRow(obj, checked) {
 function windowShow(sPage, width, height)
 {
   if (width == null)
-    width = 500;
+    width = 520;
   if (height == null)
     height = 420;
   sPage = sPage + '&return=F1&sid=' + document.forms[0].elements['sid'].value + '&realm=' + document.forms[0].elements['realm'].value;
@@ -451,8 +451,37 @@ function davBrowse (fld)
   OAT.WebDav.open(options);
 }
 
-var OMAIL = new Object();
+function accountChange (obj)
+{
+  if (obj.name == 'type') {
+    if (obj.value == 'pop3') {
+      $('connect_type').value = 'none';
+      $('port').value = '110';
+      $('folder_id').value = '100';
 
+      $('connect_type').disabled = false;
+      $('folder_id').disabled = false;
+    }
+    if (obj.value == 'imap') {
+      $('connect_type').value = 'none';
+      $('port').value = '143';
+      $('folder_id').value = '0';
+
+      $('connect_type').disabled = true;
+      $('folder_id').disabled = true;
+    }
+  }
+  if (obj.name == 'connect_type') {
+    if (obj.value == 'ssl') {
+      $('port').value = '995';
+    }
+    if (obj.value == 'none') {
+      $('port').value = '110';
+    }
+  }
+}
+
+var OMAIL = new Object();
 OMAIL.forms = new Object();
 
 OMAIL.trim = function (sString, sChar)
@@ -624,454 +653,26 @@ OMAIL.formParams = function (doc)
   return S;
 }
 
-OMAIL.searchRowAction = function (rowID)
-{
-  var tbody = $('search_tbody');
-  if (tbody)
-  {
-    var seqNo = parseInt($v('search_seqNo'));
-    if (seqNo == rowID)
-    {
-      var img = $('search_img_3_' + seqNo);
-      if (img)
-        img.src = '/oMail/i/del_16.png';
-      OAT.Dom.unlink('search_tr');
-      var tr = OAT.Dom.create('tr');
-      tr.id = 'search_tr';
-      var td = OAT.Dom.create('td');
-      td.colSpan = '6';
-      td.appendChild(OAT.Dom.create('hr'));
-      tr.appendChild(td);
-      tbody.appendChild(tr);
-
-      seqNo++;
-      $('search_seqNo').value = seqNo;
-      OMAIL.searchRowCreate(seqNo);
-    }
-    else
-    {
-      OAT.Dom.unlink('search_tr_'+rowID);
-    }
-  }
-}
-
-OMAIL.searchRowCreate = function (rowID, values)
-{
-  var tbody = $('search_tbody');
-  if (tbody)
-  {
-    var seqNo = parseInt($v('search_seqNo'));
-    var tr = OAT.Dom.create('tr');
-    tr.id = 'search_tr_' + rowID;
-    if (seqNo != rowID)
-    {
-      tr_line = $('search_tr');
-      tbody.insertBefore(tr, tr_line);
-    }
-    else
-    {
-      tbody.appendChild(tr);
-    }
-    if (!values)
-      values = new Object();
-
-    var td = OAT.Dom.create('td');
-    td.id = 'search_td_0_' + rowID;
-    tr.appendChild(td);
-    OMAIL.searchColumnCreate(rowID, 0, values['field_0']);
-
-    var td = OAT.Dom.create('td');
-    td.id = 'search_td_1_' + rowID;
-    tr.appendChild(td);
-    if (values['field_1'])
-      OMAIL.searchColumnCreate(rowID, 1, values['field_1']);
-
-    var td = OAT.Dom.create('td');
-    td.id = 'search_td_2_' + rowID;
-    tr.appendChild(td);
-    if (values['field_2'])
-      OMAIL.searchColumnCreate(rowID, 2, values['field_2']);
-
-    var td = OAT.Dom.create('td');
-    td.id = 'search_td_3_' + rowID;
-    var imgSrc = (seqNo != rowID)? '/oMail/i/del_16.png': '/oMail/i/add_16.png';
-    var img = OAT.Dom.image(imgSrc);
-    img.id = 'search_img_3_' + rowID;
-    img.onclick = function (){OMAIL.searchRowAction(rowID)};
-    td.appendChild(img);
-    tr.appendChild(td);
-  }
-}
-
-OMAIL.searchColumnsInit = function (rowID, columnNo)
-{
-  var tr = $('search_tr_' + rowID);
-  if (tr)
-  {
-    var tds = tr.getElementsByTagName("td");
-    for (var i = columnNo; i < tds.length-1; i++)
-    {
-      tds[i].innerHTML = '';
-    }
-    if (columnNo == 0)
-    {
-      OMAIL.searchColumnCreate(rowID, columnNo)
-    }
-  }
-}
-
-OMAIL.searchColumnCreate = function (rowID, columnNo, columnValue)
-{
-  var tr = $('search_tr_' + rowID);
-  if (tr)
-  {
-    var td = $('search_td_' + columnNo + '_' + rowID);
-    if (td)
-    {
-      var predicate = OMAIL.searchGetPredicate(rowID);
-      if (columnNo == 0)
-      {
-        var field = OAT.Dom.create('select');
-        field.id = 'search_field_' + columnNo + '_' + rowID;
-        field.name = field.id;
-        field.style.width = '95%';
-        OAT.Dom.option('', '', field);
-        for (var i = 0; i < OMAIL.searchPredicates.length; i = i + 2)
-        {
-          if (OMAIL.searchPredicates[i+1][0] == 1)
-          {
-            OAT.Dom.option(OMAIL.searchPredicates[i+1][1], OMAIL.searchPredicates[i], field);
-          }
-        }
-        if (columnValue)
-          field.value = columnValue;
-        field.onchange = function(){OMAIL.searchColumnChange(this)};
-        td.appendChild(field);
-      }
-      if (predicate && (columnNo == 1))
-      {
-        var field = OAT.Dom.create('select');
-        field.id = 'search_field_' + columnNo + '_' + rowID;
-        field.name = field.id;
-        field.style.width = '95%';
-        OAT.Dom.option('', '', field);
-        var predicateType = predicate[2];
-        for (var i = 0; i < OMAIL.searchCompares.length; i = i + 2)
-        {
-          var compareTypes = OMAIL.searchCompares[i+1][1];
-          for (var j = 0; j < compareTypes.length; j++)
-          {
-            if (compareTypes[j] == predicateType)
-            {
-              OAT.Dom.option(OMAIL.searchCompares[i+1][0], OMAIL.searchCompares[i], field);
-            }
-          }
-        }
-        if (columnValue)
-          field.value = columnValue;
-        field.onchange = function(){OMAIL.searchColumnChange(this)};
-        td.appendChild(field);
-      }
-      if (predicate && (columnNo == 2))
-      {
-        var fieldCompare = $('search_field_1_' + rowID);
-        if (!fieldCompare) {return;}
-        var compare;
-        for (var i = 0; i < OMAIL.searchCompares.length; i = i + 2)
-        {
-          if (OMAIL.searchCompares[i] == fieldCompare.value)
-          {
-            compare = OMAIL.searchCompares[i+1];
-          }
-        }
-        if (!compare) {return;}
-        if (compare[2] == 0) {return;}
-        if (predicate[2] == 'priority')
-        {
-          var field = OAT.Dom.create("select");
-          OAT.Dom.option('Normal', '3', field);
-          OAT.Dom.option('Lowest', '5', field);
-          OAT.Dom.option('Low', '4', field);
-          OAT.Dom.option('High', '2', field);
-          OAT.Dom.option('Highest', '1', field);
-        }
-        else
-        {
-          var field = OAT.Dom.create("input");
-          field.type = 'text';
-        }
-        field.id = 'search_field_' + columnNo + '_' + rowID;
-        field.name = field.id;
-        field.style.width = '93%';
-        if (columnValue)
-          field.value = columnValue;
-        td.appendChild(field);
-
-        for (var i = 0; i < predicate[4].length; i = i + 2)
-        {
-          if (predicate[4][i] == 'size')
-          {
-            field['size'] = predicate[4][i+1];
-            field.style.width = null;
-          }
-          if (predicate[4][i] == 'onclick')
-          {
-            OAT.Event.attach(field, "click", new Function((predicate[4][i+1]).replace(/-FIELD-/g, field.id)));
-          }
-          if (predicate[4][i] == 'button')
-          {
-            var span = OAT.Dom.create("span");
-            span.innerHTML = ' ' + (predicate[4][i+1]).replace(/-FIELD-/g, field.id);
-            td.appendChild(span);
-          }
-        }
-      }
-    }
-  }
-}
-
-OMAIL.searchColumnChange = function (obj)
-{
-  var parts = obj.id.split('_');
-  var columnNo = parseInt(parts[2]);
-  var rowID = parts[3];
-  var predicate = OMAIL.searchGetPredicate(rowID);
-  if (columnNo == 0)
-  {
-    OMAIL.searchColumnsInit(rowID, 1);
-    if (obj.value == '') {return;}
-    if (predicate) {OMAIL.searchColumnCreate(rowID, 1);}
-  }
-  if (columnNo == 1)
-  {
-    OMAIL.searchColumnsInit(rowID, 2);
-    if (obj.value == '') {return;}
-    if (predicate) {OMAIL.searchColumnCreate(rowID, 2);}
-  }
-}
-
-OMAIL.searchGetPredicate = function (rowID)
-{
-  var field = $('search_field_0_' + rowID)
-  if (field)
-  {
-    for (var i = 0; i < OMAIL.searchPredicates.length; i = i + 2)
-    {
-      if (OMAIL.searchPredicates[i] == field.value)
+OMAIL.searchGetPredicate = function (No)
       {
+  var fld = $('search_fld_1_' + No)
+  if (fld) {
+    for (var i = 0; i < OMAIL.searchPredicates.length; i += 2) {
+      if (OMAIL.searchPredicates[i] == fld.value)
         return OMAIL.searchPredicates[i+1];
       }
     }
-  }
-  return null;
-}
-
-OMAIL.searchGetCompares = function (predicate)
-{
-  if (predicate)
-  {
-  }
   return null;
 }
 
-OMAIL.actionRowAction = function (rowID)
-{
-  var tbody = $('action_tbody');
-  if (tbody)
-  {
-    var seqNo = parseInt($v('action_seqNo'));
-    if (seqNo == rowID)
-    {
-      var img = $('action_img_2_' + seqNo);
-      if (img)
-        img.src = '/oMail/i/del_16.png';
-      OAT.Dom.unlink('action_tr');
-      var tr = OAT.Dom.create('tr');
-      tr.id = 'action_tr';
-      var td = OAT.Dom.create('td');
-      td.colSpan = '6';
-      td.appendChild(OAT.Dom.create('hr'));
-      tr.appendChild(td);
-      tbody.appendChild(tr);
-
-      seqNo++;
-      $('action_seqNo').value = seqNo;
-      OMAIL.actionRowCreate(seqNo);
-    }
-    else
-    {
-      OAT.Dom.unlink('action_tr_'+rowID);
-    }
-  }
-}
-
-OMAIL.actionRowCreate = function (rowID, values)
-{
-  var tbody = $('action_tbody');
-  if (tbody)
-  {
-    var seqNo = parseInt($v('action_seqNo'));
-    var tr = OAT.Dom.create('tr');
-    tr.id = 'action_tr_' + rowID;
-    if (seqNo != rowID)
-    {
-      tr_line = $('action_tr');
-      tbody.insertBefore(tr, tr_line);
-    }
-    else
-    {
-      tbody.appendChild(tr);
-    }
-    if (!values)
-      values = new Object();
-
-    var td = OAT.Dom.create('td');
-    td.id = 'action_td_0_' + rowID;
-    tr.appendChild(td);
-    OMAIL.actionColumnCreate(rowID, 0, values['field_0']);
-
-    var td = OAT.Dom.create('td');
-    td.id = 'action_td_1_' + rowID;
-    tr.appendChild(td);
-    if (values['field_1'])
-      OMAIL.actionColumnCreate(rowID, 1, values['field_1']);
-
-    var td = OAT.Dom.create('td');
-    td.id = 'action_td_2_' + rowID;
-    var imgSrc = (seqNo != rowID)? '/oMail/i/del_16.png': '/oMail/i/add_16.png';
-    var img = OAT.Dom.image(imgSrc);
-    img.id = 'action_img_2_' + rowID;
-    img.onclick = function (){OMAIL.actionRowAction(rowID)};
-    td.appendChild(img);
-    tr.appendChild(td);
-  }
-}
-
-OMAIL.actionColumnsInit = function (rowID, columnNo)
-{
-  var tr = $('action_tr_' + rowID);
-  if (tr)
-  {
-    var tds = tr.getElementsByTagName("td");
-    for (var i = columnNo; i < tds.length-1; i++)
-    {
-      tds[i].innerHTML = '';
-    }
-    if (columnNo == 0)
-    {
-      OMAIL.actionColumnCreate(rowID, columnNo)
-    }
-  }
-}
-
-OMAIL.actionColumnCreate = function (rowID, columnNo, columnValue)
-{
-  var tr = $('action_tr_' + rowID);
-  if (tr)
-  {
-    var td = $('action_td_' + columnNo + '_' + rowID);
-    if (td)
-    {
-      var predicate = OMAIL.actionGetPredicate(rowID);
-      if (columnNo == 0)
-      {
-        var field = OAT.Dom.create('select');
-        field.id = 'action_field_' + columnNo + '_' + rowID;
-        field.name = field.id;
-        field.style.width = '95%';
-        OAT.Dom.option('', '', field);
-        for (var i = 0; i < OMAIL.searchActions.length; i = i + 2)
-        {
-          if (OMAIL.searchActions[i+1][0] == 1)
-          {
-            OAT.Dom.option(OMAIL.searchActions[i+1][1], OMAIL.searchActions[i], field);
-          }
-        }
-        if (columnValue)
-          field.value = columnValue;
-        field.onchange = function(){OMAIL.actionColumnChange(this)};
-        td.appendChild(field);
-      }
-      if (columnNo == 1)
-      {
-        var value_0 = $v('action_field_0_' + rowID);
-        if (value_0 && (value_0 != ''))
-        {
-          var fieldParams;
-          for (var i = 0; i < OMAIL.searchActions.length; i = i + 2)
-          {
-            if ((OMAIL.searchActions[i] == value_0) && (OMAIL.searchActions[i+1][0] == 1))
-            {
-              fieldParams = OMAIL.searchActions[i+1];
-            }
-          }
-          if (fieldParams)
-          {
-            if (fieldParams[2])
-            {
-              if (fieldParams[2] == 'input')
-              {
-                var field = OAT.Dom.create("input");
-                field.type = 'text';
-              }
-              else if (fieldParams[2] == 'select')
-              {
-                var field = OAT.Dom.create("select");
-                if (fieldParams[3] == 'folder')
-                {
-                  for (var i = 0; i < OMAIL.searchFolders.length; i = i + 2)
-                  {
-                    OAT.Dom.option(OMAIL.searchFolders[i+1], OMAIL.searchFolders[i], field);
-                  }
-                }
-                else if (fieldParams[3] == 'priority')
-                {
-                  OAT.Dom.option('Normal', '3', field);
-                  OAT.Dom.option('Lowest', '5', field);
-                  OAT.Dom.option('Low', '4', field);
-                  OAT.Dom.option('High', '2', field);
-                  OAT.Dom.option('Highest', '1', field);
-                }
-              }
-              field.id = 'action_field_' + columnNo + '_' + rowID;
-              field.name = field.id;
-              field.style.width = '93%';
-              if (columnValue)
-                field.value = columnValue;
-              td.appendChild(field);
-            }
-          }
-        }
-      }
-    }
-  }
-}
-
-OMAIL.actionColumnChange = function (obj)
-{
-  var parts = obj.id.split('_');
-  var columnNo = parseInt(parts[2]);
-  var rowID = parts[3];
-  var predicate = OMAIL.actionGetPredicate(rowID);
-  if (columnNo == 0)
-  {
-    OMAIL.actionColumnsInit(rowID, 1);
-    if (obj.value == '') {return;}
-  }
-  if (predicate)
-  {
-    OMAIL.actionColumnCreate(rowID, 1)
-  }
-}
-
-OMAIL.actionGetPredicate = function (rowID)
+OMAIL.actionGetPredicate = function (No)
 {
-  var field = $('action_field_0_' + rowID)
-  if (field)
+  var fld = $('action_fld_1_' + No)
+  if (fld)
   {
     for (var i = 0; i < OMAIL.searchActions.length; i = i + 2)
     {
-      if (OMAIL.searchActions[i] == field.value)
+      if (OMAIL.searchActions[i] == fld.value)
       {
         return OMAIL.searchActions[i+1];
       }
@@ -1086,7 +687,7 @@ OMAIL.aboutDialog = function ()
   if (aboutDiv) {OAT.Dom.unlink(aboutDiv);}
   aboutDiv = OAT.Dom.create('div', {width:'430px', height:'150px'});
   aboutDiv.id = 'aboutDiv';
-  aboutDialog = new OAT.Dialog('About ODS Webmail', aboutDiv, {width:430, buttons: 0, resize:0, modal:1});
+  aboutDialog = new OAT.Dialog('About ODS Webmail', aboutDiv, {width:445, buttons: 0, resize:0, modal:1});
 	aboutDialog.cancel = aboutDialog.hide;
 
   var x = function (txt) {
diff --git a/appsrc/ODS-WebMail/www-root/mail/i/js/tbl.js b/appsrc/ODS-WebMail/www-root/mail/i/js/tbl.js
new file mode 100644
index 0000000..fab74bf
--- /dev/null
+++ b/appsrc/ODS-WebMail/www-root/mail/i/js/tbl.js
@@ -0,0 +1,226 @@
+/*
+ *  $Id: tbl.js,v 1.1.4.3 2010/09/20 10:15:43 source Exp $
+ *
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *
+ *  Copyright (C) 1998-2010 OpenLink Software
+ *
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+*/
+
+TBL.changeCell40 = function (obj)
+{
+  var parts = obj.id.split('_');
+  var prefix = parts[0];
+  var No = parts[3];
+
+  var td = $(prefix+'_td_'+No+'_2');
+  td.innerHTML = '';
+  TBL.createCell41(td, prefix, prefix+'_fld_2_'+No, No, {});
+
+  var td = $(prefix+'_td_'+No+'_3');
+  td.innerHTML = '';
+  TBL.createCell42(td, prefix, prefix+'_fld_3_'+No, No, {});
+}
+
+TBL.createCell40 = function (td, prefix, fldName, No, fldOptions)
+{
+  var fld = OAT.Dom.create('select');
+  fld.id = fldName;
+  fld.name = fld.id;
+  fld.style.width = '95%';
+  OAT.Dom.option('', '', fld);
+  for (var i = 0; i < OMAIL.searchPredicates.length; i = i + 2) {
+    if (OMAIL.searchPredicates[i+1][0] == 1)
+      OAT.Dom.option(OMAIL.searchPredicates[i+1][1], OMAIL.searchPredicates[i], fld);
+  }
+  if (fldOptions.value)
+    fld.value = fldOptions.value;
+  fld.onchange = function(){TBL.changeCell40(this)};
+
+  td.appendChild(fld);
+  return fld;
+}
+
+TBL.changeCell41 = function (obj)
+{
+  var parts = obj.id.split('_');
+  var prefix = parts[0];
+  var No = parts[3];
+
+  var td = $(prefix+'_td_'+No+'_3');
+  td.innerHTML = '';
+  TBL.createCell42(td, prefix, prefix+'_fld_3_'+No, No, {});
+}
+
+TBL.createCell41 = function (td, prefix, fldName, No, fldOptions)
+{
+  var predicate = OMAIL.searchGetPredicate(No);
+  if (!predicate)
+    return;
+
+  var fld = OAT.Dom.create('select');
+  fld.id = fldName;
+  fld.name = fld.id;
+  fld.style.width = '95%';
+  OAT.Dom.option('', '', fld);
+  var predicateType = predicate[2];
+  for (var i = 0; i < OMAIL.searchCompares.length; i = i + 2) {
+    var compareTypes = OMAIL.searchCompares[i+1][1];
+    for (var j = 0; j < compareTypes.length; j++) {
+      if (compareTypes[j] == predicateType)
+        OAT.Dom.option(OMAIL.searchCompares[i+1][0], OMAIL.searchCompares[i], fld);
+    }
+  }
+  if (fldOptions.value)
+    fld.value = fldOptions.value;
+  fld.onchange = function(){TBL.changeCell41(this)};
+
+  td.appendChild(fld);
+  return fld;
+}
+
+TBL.createCell42 = function (td, prefix, fldName, No, fldOptions)
+{
+  var predicate = OMAIL.searchGetPredicate(No);
+  if (!predicate)
+    return;
+
+  var fld_2 = $(fldName.replace('fld_3', 'fld_2'));
+  if (!fld_2)
+    return;
+
+  var compare;
+  for (var i = 0; i < OMAIL.searchCompares.length; i = i + 2) {
+    if (OMAIL.searchCompares[i] == fld_2.value)
+      compare = OMAIL.searchCompares[i+1];
+  }
+  if (!compare || (compare[2] == 0))
+    return;
+
+  if (predicate[2] == 'priority') {
+    var fld = OAT.Dom.create("select");
+    OAT.Dom.option('Normal', '3', fld);
+    OAT.Dom.option('Lowest', '5', fld);
+    OAT.Dom.option('Low', '4', fld);
+    OAT.Dom.option('High', '2', fld);
+    OAT.Dom.option('Highest', '1', fld);
+  }
+  else if (predicate[2] == 'boolean') {
+    var fld = OAT.Dom.create("select");
+    OAT.Dom.option('Yes', '1', fld);
+    OAT.Dom.option('No', '0', fld);
+  }
+  else
+  {
+    var fld = OAT.Dom.create("input");
+    fld.type = 'text';
+  }
+  fld.id = fldName;
+  fld.name = fld.id;
+  fld.style.width = '93%';
+  if (fldOptions.value)
+    fld.value = fldOptions.value;
+  td.appendChild(fld);
+
+  for (var i = 0; i < predicate[4].length; i += 2) {
+    if (predicate[4][i] == 'size') {
+      fld['size'] = predicate[4][i+1];
+      fld.style.width = null;
+    }
+    if (predicate[4][i] == 'onclick')
+      OAT.Event.attach(fld, "click", new Function((predicate[4][i+1]).replace(/-fld-/g, fld.id)));
+
+    if (predicate[4][i] == 'button') {
+      var span = OAT.Dom.create("span");
+      span.innerHTML = ' ' + (predicate[4][i+1]).replace(/-FIELD-/g, fld.id);
+      td.appendChild(span);
+    }
+  }
+  return fld;
+}
+
+TBL.changeCell45 = function (obj)
+{
+  var parts = obj.id.split('_');
+  var prefix = parts[0];
+  var No = parts[3];
+  var td = $(prefix+'_td_'+No+'_2');
+
+  td.innerHTML = '';
+  TBL.createCell46(td, prefix, prefix+'_fld_2_'+No, No, {});
+}
+
+TBL.createCell45 = function (td, prefix, fldName, No, fldOptions)
+{
+  var fld = OAT.Dom.create('select');
+  fld.id = fldName;
+  fld.name = fld.id;
+  fld.style.width = '95%';
+  OAT.Dom.option('', '', fld);
+  for (var i = 0; i < OMAIL.searchActions.length; i = i + 2) {
+    if (OMAIL.searchActions[i+1][0] == 1)
+      OAT.Dom.option(OMAIL.searchActions[i+1][1], OMAIL.searchActions[i], fld);
+  }
+  if (fldOptions.value)
+    fld.value = fldOptions.value;
+  fld.onchange = function(){TBL.changeCell45(this)};
+
+  td.appendChild(fld);
+  return fld;
+}
+
+TBL.createCell46 = function (td, prefix, fldName, No, fldOptions) {
+  var val = $v(fldName.replace('fld_2', 'fld_1'));
+  if (val && (val != '')) {
+    var fldParams;
+    for (var i = 0; i < OMAIL.searchActions.length; i += 2) {
+      if ((OMAIL.searchActions[i] == val) && (OMAIL.searchActions[i+1][0] == 1))
+        fldParams = OMAIL.searchActions[i+1];
+    }
+    if (!fldParams || !fldParams[2])
+      return;
+
+    if (fldParams[2] == 'input') {
+      var fld = OAT.Dom.create("input");
+      fld.type = 'text';
+    }
+    else if (fldParams[2] == 'select')
+    {
+      var fld = OAT.Dom.create("select");
+      if (fldParams[3] == 'folder') {
+        for (var i = 0; i < OMAIL.searchFolders.length; i = i + 2)
+          OAT.Dom.option(OMAIL.searchFolders[i+1], OMAIL.searchFolders[i], fld);
+      }
+      else if (fldParams[3] == 'priority')
+      {
+        OAT.Dom.option('Normal', '3', fld);
+        OAT.Dom.option('Lowest', '5', fld);
+        OAT.Dom.option('Low', '4', fld);
+        OAT.Dom.option('High', '2', fld);
+        OAT.Dom.option('Highest', '1', fld);
+      }
+    }
+    fld.id = fldName;
+    fld.name = fld.id;
+    fld.style.width = '93%';
+    if (fldOptions.value)
+      fld.value = fldOptions.value;
+
+    td.appendChild(fld);
+    return fld;
+  }
+}
diff --git a/appsrc/ODS-WebMail/www-root/mail/p/p.vsp b/appsrc/ODS-WebMail/www-root/mail/p/p.vsp
index 5649a82..93889ab 100644
--- a/appsrc/ODS-WebMail/www-root/mail/p/p.vsp
+++ b/appsrc/ODS-WebMail/www-root/mail/p/p.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: p.vsp,v 1.3 2006/07/31 15:35:28 source Exp $
+--  $Id: p.vsp,v 1.3.2.1 2010/09/20 10:15:43 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-WebMail/www-root/mail/p/tags.xml b/appsrc/ODS-WebMail/www-root/mail/p/tags.xml
index f84c793..e6c1ad0 100644
--- a/appsrc/ODS-WebMail/www-root/mail/p/tags.xml
+++ b/appsrc/ODS-WebMail/www-root/mail/p/tags.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: tags.xml,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: tags.xml,v 1.2.2.1 2010/09/20 10:15:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/www-root/mail/p/tags.xsl b/appsrc/ODS-WebMail/www-root/mail/p/tags.xsl
index eb056e4..ef13f96 100644
--- a/appsrc/ODS-WebMail/www-root/mail/p/tags.xsl
+++ b/appsrc/ODS-WebMail/www-root/mail/p/tags.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: tags.xsl,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: tags.xsl,v 1.2.2.1 2010/09/20 10:15:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/www-root/portal.vsp b/appsrc/ODS-WebMail/www-root/portal.vsp
index cb5a257..bc76bff 100644
--- a/appsrc/ODS-WebMail/www-root/portal.vsp
+++ b/appsrc/ODS-WebMail/www-root/portal.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: portal.vsp,v 1.21 2008/12/09 00:46:31 source Exp $
+--  $Id: portal.vsp,v 1.21.2.2 2010/09/20 10:15:42 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -27,7 +27,7 @@
   declare wa_home_title, wa_home_link, user_name, user_fullName, procName, procID, S varchar;
   declare hParams, hLines, vOptions, geoParams, settings, app any;
 
-  declare exit handler for sqlstate '90001' { OMAIL.WA.utl_doredirect(__sql_message); return;};
+  declare exit handler for sqlstate '90001' { OMAIL.WA.utl_doredirect(__sql_message, waID); return;};
   declare exit handler for sqlstate '90005' { return; }; --download
   declare exit handler for sqlstate '42001' { http('404'); return;}; --not found
   declare exit handler for sqlstate 'TEST'
diff --git a/appsrc/ODS-WebMail/www-root/res/export.vsp b/appsrc/ODS-WebMail/www-root/res/export.vsp
index 98ea3c9..f28bfd2 100644
--- a/appsrc/ODS-WebMail/www-root/res/export.vsp
+++ b/appsrc/ODS-WebMail/www-root/res/export.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: export.vsp,v 1.5 2007/05/10 10:48:32 source Exp $
+--  $Id: export.vsp,v 1.5.2.1 2010/09/20 10:15:43 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-WebMail/www-root/res/flush.vsp b/appsrc/ODS-WebMail/www-root/res/flush.vsp
index 08965dc..5073770 100644
--- a/appsrc/ODS-WebMail/www-root/res/flush.vsp
+++ b/appsrc/ODS-WebMail/www-root/res/flush.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: flush.vsp,v 1.5 2008/11/13 14:36:55 source Exp $
+--  $Id: flush.vsp,v 1.5.2.1 2010/09/20 10:15:43 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-WebMail/www-root/res/image.vsp b/appsrc/ODS-WebMail/www-root/res/image.vsp
index 538c23f..f68e30a 100644
--- a/appsrc/ODS-WebMail/www-root/res/image.vsp
+++ b/appsrc/ODS-WebMail/www-root/res/image.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: image.vsp,v 1.3 2006/07/31 15:35:29 source Exp $
+--  $Id: image.vsp,v 1.3.2.1 2010/09/20 10:15:43 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-WebMail/xslt/addr.xsl b/appsrc/ODS-WebMail/xslt/addr.xsl
index a64d517..b412fb9 100644
--- a/appsrc/ODS-WebMail/xslt/addr.xsl
+++ b/appsrc/ODS-WebMail/xslt/addr.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: addr.xsl,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: addr.xsl,v 1.2.2.2 2010/09/20 10:15:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -45,7 +45,8 @@
   			}
   		}
   	</script>
-    <form action="write.vsp" method="post" enctype="multipart/form-data" name="f1">
+    <form method="post" enctype="multipart/form-data" name="f1">
+      <xsl:attribute name="action"><xsl:value-of select="$iri" />/write.vsp</xsl:attribute>
       <xsl:call-template name="addr"/>
     </form>
   </xsl:template>
diff --git a/appsrc/ODS-WebMail/xslt/attach.xsl b/appsrc/ODS-WebMail/xslt/attach.xsl
index 71c7a13..298692a 100644
--- a/appsrc/ODS-WebMail/xslt/attach.xsl
+++ b/appsrc/ODS-WebMail/xslt/attach.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: attach.xsl,v 1.3 2007/11/19 11:08:56 source Exp $
+ -  $Id: attach.xsl,v 1.3.2.2 2010/09/20 10:15:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -26,7 +26,8 @@
   <xsl:include href="common.xsl"/>
   <!-- ====================================================================================== -->
   <xsl:template match="page">
-    <form action="attach.vsp" method="post" enctype="multipart/form-data" name="f1">
+    <form method="post" enctype="multipart/form-data" name="f1">
+      <xsl:attribute name="action"><xsl:value-of select="$iri" />/attach.vsp</xsl:attribute>
       <script>
         function windowShow(sPage)
         {
diff --git a/appsrc/ODS-WebMail/xslt/base.xsl b/appsrc/ODS-WebMail/xslt/base.xsl
index 4b18212..53b21d9 100644
--- a/appsrc/ODS-WebMail/xslt/base.xsl
+++ b/appsrc/ODS-WebMail/xslt/base.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: base.xsl,v 1.3 2006/07/24 23:08:50 source Exp $
+ -  $Id: base.xsl,v 1.3.2.4 2011/01/25 14:12:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -86,9 +86,12 @@
 
     <xsl:choose>
       <xsl:when test="$url = ''">
-       <xsl:variable name="url">/</xsl:variable>
+        <xsl:variable name="url"><xsl:value-of select="$iri" /></xsl:variable>
        <xsl:variable name="label">Home</xsl:variable>
       </xsl:when>
+      <xsl:when test="not(starts-with($url, 'javascript')) and not(starts-with($url, 'http'))">
+        <xsl:variable name="url"><xsl:value-of select="$iri" />/<xsl:value-of select="$url" /></xsl:variable>
+      </xsl:when>
     </xsl:choose>
 
     <xsl:choose>
@@ -288,13 +291,15 @@
   <!-- ========================================================================== -->
   <xsl:template name="make_select">
     <xsl:param name="name"/>
+    <xsl:param name="id" />
     <xsl:param name="selected"/>
     <xsl:param name="selected_def"/>
     <xsl:param name="list"/>
     <xsl:param name="listname"/>
     <xsl:param name="treelist">0</xsl:param>
     <xsl:param name="size">1</xsl:param>
-    <xsl:param name="class">-1</xsl:param>
+    <xsl:param name="class" />
+    <xsl:param name="style" />
     <xsl:param name="onclick">-1</xsl:param>
     <xsl:param name="onchange">-1</xsl:param>
     <xsl:param name="onblur">-1</xsl:param>
@@ -313,9 +318,15 @@
       <xsl:attribute name="size"><xsl:value-of select="$size"/></xsl:attribute>
 
       <!-- process conditional attributes -->
-      <xsl:if test="$class != '-1'">
+      <xsl:if test="$id">
+        <xsl:attribute name="id"><xsl:value-of select="$id" /></xsl:attribute>
+      </xsl:if>
+      <xsl:if test="$class">
         <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
       </xsl:if>
+      <xsl:if test="$style">
+        <xsl:attribute name="style"><xsl:value-of select="$style" /></xsl:attribute>
+      </xsl:if>
       <xsl:if test="$onclick != '-1'">
         <xsl:attribute name="onClick"><xsl:value-of select="$onclick"/></xsl:attribute>
       </xsl:if>
diff --git a/appsrc/ODS-WebMail/xslt/box.xsl b/appsrc/ODS-WebMail/xslt/box.xsl
index 302d200..bb544d5 100644
--- a/appsrc/ODS-WebMail/xslt/box.xsl
+++ b/appsrc/ODS-WebMail/xslt/box.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: box.xsl,v 1.5.2.4 2009/09/17 14:21:17 source Exp $
+ -  $Id: box.xsl,v 1.5.2.8 2011/02/14 13:03:14 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -28,7 +28,8 @@
 
   <!-- ====================================================================================== -->
   <xsl:template match="page">
-    <form action="box.vsp" method="post" name="f1">
+    <form method="post" name="f1">
+      <xsl:attribute name="action"><xsl:value-of select="$iri" />/box.vsp</xsl:attribute>
       <xsl:call-template name="hid_sid"/>
       <input type="hidden" name="bp">
         <xsl:attribute name="value"><xsl:value-of select="bp"/></xsl:attribute>
@@ -227,11 +228,11 @@
           <xsl:variable name="open_url">javascript:Go(<xsl:value-of select="msg_id" />,'<xsl:value-of select="subject" />')</xsl:variable>
         </xsl:when>
         <xsl:when test="/page/folder_id = 130">
-          <xsl:variable name="open_url">write.vsp?sid=<xsl:value-of select="$sid" />&realm=<xsl:value-of select="$realm" />&wp=<xsl:value-of select="msg_id" />
+          <xsl:variable name="open_url"><xsl:value-of select="$iri" />/write.vsp?sid=<xsl:value-of select="$sid" />&realm=<xsl:value-of select="$realm" />&wp=<xsl:value-of select="msg_id" />
           </xsl:variable>
         </xsl:when>
         <xsl:otherwise>
-          <xsl:variable name="open_url">open.vsp?sid=<xsl:value-of select="$sid" />&realm=<xsl:value-of select="$realm" />&op=<xsl:value-of select="msg_id" />,<xsl:value-of select="position" />
+          <xsl:variable name="open_url"><xsl:value-of select="$iri" />/open.vsp?sid=<xsl:value-of select="$sid" />&realm=<xsl:value-of select="$realm" />&op=<xsl:value-of select="msg_id" />,<xsl:value-of select="position" />
           </xsl:variable>
         </xsl:otherwise>
       </xsl:choose>
@@ -313,11 +314,11 @@
         <xsl:variable name="open_url">javascript:Go(<xsl:value-of select="msg_id"/>,'<xsl:value-of select="subject"/>')</xsl:variable>
       </xsl:when>
       <xsl:when test="/page/folder_id = 130">
-        <xsl:variable name="open_url">write.vsp?sid=<xsl:value-of select="$sid"/>&realm=<xsl:value-of select="$realm"/>&wp=<xsl:value-of select="msg_id"/>
+        <xsl:variable name="open_url"><xsl:value-of select="$iri" />/write.vsp?sid=<xsl:value-of select="$sid" />&realm=<xsl:value-of select="$realm" />&wp=<xsl:value-of select="msg_id" />
         </xsl:variable>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:variable name="open_url">open.vsp?sid=<xsl:value-of select="$sid"/>&realm=<xsl:value-of select="$realm"/>&op=<xsl:value-of select="msg_id"/>,<xsl:value-of select="position"/>
+        <xsl:variable name="open_url"><xsl:value-of select="$iri" />/open.vsp?sid=<xsl:value-of select="$sid" />&realm=<xsl:value-of select="$realm" />&op=<xsl:value-of select="msg_id" />,<xsl:value-of select="position" />
         </xsl:variable>
       </xsl:otherwise>
     </xsl:choose>
@@ -413,13 +414,13 @@
           <tr>
             <td>
               <xsl:call-template name="nbsp"/>Move selected to
-              <xsl:apply-templates select="folders" mode="combo" />
+              <xsl:apply-templates select="foldersCombo" mode="combo" />
               <xsl:call-template name="make_href">
                 <xsl:with-param name="url">javascript: if (anySelected(document.f1, 'ch_msg', 'No messages were selected to be moved.')) formSubmit('fa_move.x', '1'); </xsl:with-param>
                 <xsl:with-param name="title">Move</xsl:with-param>
                 <xsl:with-param name="img">/oMail/i/move_16.png</xsl:with-param>
                 <xsl:with-param name="img_label"> Move</xsl:with-param>
-                <xsl:with-param name="class">button</xsl:with-param>
+                <xsl:with-param name="class">button2</xsl:with-param>
               </xsl:call-template>
             </td>
             <td class="right">
@@ -430,7 +431,7 @@
                   <xsl:with-param name="label">Delete All</xsl:with-param>
                   <xsl:with-param name="img">/oMail/i/del_16.png</xsl:with-param>
                   <xsl:with-param name="img_label"> Delete All</xsl:with-param>
-                  <xsl:with-param name="class">button</xsl:with-param>
+                  <xsl:with-param name="class">button2</xsl:with-param>
                 </xsl:call-template>
               </xsl:if>
               <xsl:call-template name="make_href">
@@ -438,7 +439,7 @@
                 <xsl:with-param name="lable">Delete Selected</xsl:with-param>
                 <xsl:with-param name="img">/oMail/i/del_16.png</xsl:with-param>
                 <xsl:with-param name="img_label"> Delete</xsl:with-param>
-                <xsl:with-param name="class">button</xsl:with-param>
+                <xsl:with-param name="class">button2</xsl:with-param>
               </xsl:call-template>
             </td>
           </tr>
diff --git a/appsrc/ODS-WebMail/xslt/ch_pop3.xsl b/appsrc/ODS-WebMail/xslt/ch_pop3.xsl
index 4e2ddad..433a732 100644
--- a/appsrc/ODS-WebMail/xslt/ch_pop3.xsl
+++ b/appsrc/ODS-WebMail/xslt/ch_pop3.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: ch_pop3.xsl,v 1.6.2.2 2009/08/24 19:53:36 source Exp $
+ -  $Id: ch_pop3.xsl,v 1.6.2.6 2011/01/25 14:12:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -28,21 +28,30 @@
 
   <!-- ====================================================================================== -->
   <xsl:template match="page">
-    <form action="ch_pop3.vsp" method="post" name="dacc">
+    <form method="post" name="dacc">
+      <xsl:attribute name="action"><xsl:value-of select="$iri" />/ch_pop3.vsp</xsl:attribute>
       <xsl:call-template name="hid_sid"/>
       <xsl:apply-templates select="accounts"/>
-      <xsl:apply-templates select="account"/>
+      <xsl:apply-templates select="account" mode="update"/>
     </form>
   </xsl:template>
+
   <!-- ====================================================================================== -->
   <xsl:template match="accounts">
   	<div>
 	    <xsl:call-template name="make_href">
 	      <xsl:with-param name="url">ch_pop3.vsp</xsl:with-param>
 	      <xsl:with-param name="params">cp=-1</xsl:with-param>
-	      <xsl:with-param name="label">Create POP3 Account</xsl:with-param>
+	      <xsl:with-param name="label">Create Account</xsl:with-param>
 	      <xsl:with-param name="img">/oMail/i/add_16.png</xsl:with-param>
-	      <xsl:with-param name="img_label"> Create POP3 Account</xsl:with-param>
+	      <xsl:with-param name="img_label"> Create Account</xsl:with-param>
+	      <xsl:with-param name="class">button2</xsl:with-param>
+	    </xsl:call-template>
+	    <xsl:call-template name="make_href">
+        <xsl:with-param name="url">ch_pop3.vsp</xsl:with-param>
+        <xsl:with-param name="label">Check All</xsl:with-param>
+        <xsl:with-param name="title">Check all external mail accounts now</xsl:with-param>
+        <xsl:with-param name="params">cp=<xsl:value-of select="id"/>,2</xsl:with-param>
 	      <xsl:with-param name="class">button2</xsl:with-param>
 	    </xsl:call-template>
 	  </div>
@@ -50,58 +59,58 @@
     <table width="100%" cellpadding="0" cellspacing="0" border="0" class="content">
       <thead>
         <tr>
-          <th>Accounts</th>
+          <th>Account</th>
           <th>Options</th>
           <th width="10%">Action</th>
         </tr>
       </thead>
-      <xsl:apply-templates select="acc"/>
+      <xsl:apply-templates select="account" mode="list"/>
       <xsl:call-template name="empty_row">
-        <xsl:with-param name="count" select="count(acc)"/>
+        <xsl:with-param name="count" select="count(account)"/>
         <xsl:with-param name="colspan" select="3"/>
             </xsl:call-template>
     </table>
   </xsl:template>
 
   <!-- ====================================================================================== -->
-  <xsl:template match="acc">
+  <xsl:template match="account" mode="list">
     <tr class="msgRow">
       <td>
-        <b><xsl:value-of select="acc_name"/></b>
+        <b><xsl:value-of select="name"/></b>
       </td>
       <td>
         Checked <xsl:call-template name="intervals"/>
-        <xsl:if test="string(last_check) != ''">
-          <font size="-2">(last check <xsl:apply-templates select="last_check"/>
+        <xsl:if test="string(check_date) != ''">
+          <font size="-2">(last check <xsl:apply-templates select="check_date"/>
             <xsl:call-template name="nbsp"/>
             <xsl:call-template name="nbsp"/>
             <xsl:choose>
-              <xsl:when test="ch_error = 0">
+              <xsl:when test="check_error = 0">
                 <font color="#208D2A">successful</font>
               </xsl:when>
-              <xsl:when test="ch_error = 1">
+              <xsl:when test="check_error = 1">
                 <a href="javascript:alert('Click \'Edit\' and check you server name.');">
                   <font size="-2" color="#ff0000">error - bad server name</font>
                 </a>
               </xsl:when>
-              <xsl:when test="ch_error = 2">
+              <xsl:when test="check_error = 2">
                 <a href="javascript:alert('Click \'Edit\' and check you user name and password.');">
                   <font size="-2" color="#ff0000">error - bad user name or pass</font>
                 </a>
               </xsl:when>
-              <xsl:when test="ch_error = 3">
-                <a href="javascript:alert('Our server cannot connect to POP3 server. Click \'Edit\' and check server settings or contact your network administrator.');">
-                  <font size="-2" color="#ff0000">error - can't connect to POP3 server</font>
+              <xsl:when test="check_error = 3">
+                <a href="javascript:alert('Our server cannot connect to mail server. Click \'Edit\' and check server settings or contact your network administrator.');">
+                  <font size="-2" color="#ff0000">error - can't connect to mail server</font>
                 </a>
               </xsl:when>
               <xsl:otherwise>
-                <font color="#ff0000">error:<xsl:value-of select="ch_error"/>
+                <font color="#ff0000">error:<xsl:value-of select="check_error"/>
                 </font>
               </xsl:otherwise>
             </xsl:choose>
   	      )</font>
         </xsl:if>
-        <xsl:if test="acc_id = /page/ch_acc_id">
+        <xsl:if test="id = /page/ch_acc_id">
           <a>
             <xsl:attribute name="href">box.vsp?sid=<xsl:value-of select="$sid"/>&realm=<xsl:value-of select="$realm"/>&bp=<xsl:value-of select="folder_id"/></xsl:attribute>
             <font color="#FF0000">
@@ -116,16 +125,16 @@
       <td nowrap="nowrap">
         <xsl:call-template name="make_href">
           <xsl:with-param name="url">ch_pop3.vsp</xsl:with-param>
-          <xsl:with-param name="label">Check Now</xsl:with-param>
-          <xsl:with-param name="title">Check pop3 account now</xsl:with-param>
-          <xsl:with-param name="params">cp=<xsl:value-of select="acc_id"/>,1</xsl:with-param>
+          <xsl:with-param name="label">Check</xsl:with-param>
+          <xsl:with-param name="title">Check mail account now</xsl:with-param>
+          <xsl:with-param name="params">cp=<xsl:value-of select="id"/>,1</xsl:with-param>
           <xsl:with-param name="class">button2</xsl:with-param>
         </xsl:call-template>
         <xsl:call-template name="nbsp"/>
         <xsl:call-template name="make_href">
           <xsl:with-param name="url">ch_pop3.vsp</xsl:with-param>
-          <xsl:with-param name="params">cp=<xsl:value-of select="acc_id"/></xsl:with-param>
-          <xsl:with-param name="label">Edit POP3 Account</xsl:with-param>
+          <xsl:with-param name="params">cp=<xsl:value-of select="id"/></xsl:with-param>
+          <xsl:with-param name="label">Edit Account</xsl:with-param>
           <xsl:with-param name="img">/oMail/i/edit_16.png</xsl:with-param>
           <xsl:with-param name="img_label"> Edit</xsl:with-param>
           <xsl:with-param name="class">button2</xsl:with-param>
@@ -133,9 +142,9 @@
         <xsl:call-template name="nbsp"/>
         <xsl:call-template name="make_href">
           <xsl:with-param name="url">ch_pop3.vsp</xsl:with-param>
-          <xsl:with-param name="params">cp=<xsl:value-of select="acc_id"/>,3</xsl:with-param>
+          <xsl:with-param name="params">cp=<xsl:value-of select="id"/>,3</xsl:with-param>
           <xsl:with-param name="onclick">javascript: return confirm('Are you sure you want to delete this account?');</xsl:with-param>
-          <xsl:with-param name="label">Delete POP3 Account</xsl:with-param>
+          <xsl:with-param name="label">Delete Account</xsl:with-param>
           <xsl:with-param name="img">/oMail/i/del_16.png</xsl:with-param>
           <xsl:with-param name="img_label"> Delete</xsl:with-param>
           <xsl:with-param name="class">button2</xsl:with-param>
@@ -146,7 +155,7 @@
   <!-- ====================================================================================== -->
   <xsl:template name="intervals">
     <xsl:choose>
-      <xsl:when test="intervals = 1">
+      <xsl:when test="check_interval = 1">
         daily
       </xsl:when>
       <xsl:otherwise>
@@ -161,48 +170,32 @@
       <xsl:with-param name="format" select="'%d.%m.%Y'"/>
     </xsl:call-template>
   </xsl:template>
+
   <!-- ====================================================================================== -->
-  <xsl:template match="account">
-    <table width="600" cellpadding="0" cellspacing="0" class="content">
-      <colgroup>
-        <col class="w160"/>
-        <col/>
-      </colgroup>
+  <xsl:template match="account" mode="update">
+    <table width="650" cellpadding="0" cellspacing="0" class="content">
       <caption>
-        <span>Manage your external mail box</span>
+        <span>
+          <xsl:choose>
+            <xsl:when test="id > 0">
+              Update external mail account
+            </xsl:when>
+            <xsl:otherwise>
+              Create external mail account
+            </xsl:otherwise>
+          </xsl:choose>
+        </span>
       </caption>
-      <xsl:apply-templates select="acc_edit"/>
-      <tfoot>
         <tr>
-          <th colspan="3">
-            <xsl:call-template name="make_submit">
-              <xsl:with-param name="name">fa_save</xsl:with-param>
-              <xsl:with-param name="value">Save</xsl:with-param>
-              <xsl:with-param name="alt">Save</xsl:with-param>
-            </xsl:call-template>
-            <xsl:call-template name="make_submit">
-              <xsl:with-param name="name">fa_cancel</xsl:with-param>
-              <xsl:with-param name="value">Cancel</xsl:with-param>
-              <xsl:with-param name="alt">Cancel</xsl:with-param>
-            </xsl:call-template>
-          </th>
-        </tr>
-      </tfoot>
-    </table>
-  </xsl:template>
-
-  <!-- ====================================================================================== -->
-  <xsl:template match="acc_edit">
-    <tr>
-      <th>
-        <label for="acc">Account Name</label>
+        <th width="25%">
+          <label for="name">Name</label>
       </th>
       <td>
-        <input type="hidden" name="acc_id">
-          <xsl:attribute name="value"><xsl:value-of select="acc_id"/></xsl:attribute>
+          <input type="hidden" name="id">
+            <xsl:attribute name="value"><xsl:value-of select="id"/></xsl:attribute>
         </input>
-        <input type="text" name="acc_name" id="acc">
-          <xsl:attribute name="value"><xsl:value-of select="acc_name"/></xsl:attribute>
+          <input type="text" name="name" id="name" style="width: 300px;">
+            <xsl:attribute name="value"><xsl:value-of select="name"/></xsl:attribute>
         </input>
       </td>
       <td>
@@ -211,11 +204,53 @@
     </tr>
     <tr>
       <th>
-        <label for="server">Server Address</label>
+        <label for="type">Server Type</label>
+      </th>
+      <td colspan="2">
+        <xsl:call-template name="make_select">
+            <xsl:with-param name="name">type</xsl:with-param>
+            <xsl:with-param name="id">type</xsl:with-param>
+            <xsl:with-param name="selected"><xsl:value-of select="type"/></xsl:with-param>
+            <xsl:with-param name="list">pop3:POP3;imap:IMAP;</xsl:with-param>
+            <xsl:with-param name="style">width: 100px;</xsl:with-param>
+            <xsl:with-param name="onchange">javascript: accountChange(this);</xsl:with-param>
+            <xsl:with-param name="disabled">
+              <xsl:choose>
+                <xsl:when test="type = 'imap'">1</xsl:when>
+                <xsl:otherwise>-1</xsl:otherwise>
+              </xsl:choose>
+            </xsl:with-param>
+          </xsl:call-template>
+        </td>
+      </tr>
+      <tr>
+        <th>
+          <label for="connect_type">Connection Type</label>
+        </th>
+        <td colspan="2">
+          <xsl:call-template name="make_select">
+            <xsl:with-param name="name">connect_type</xsl:with-param>
+            <xsl:with-param name="id">connect_type</xsl:with-param>
+            <xsl:with-param name="selected"><xsl:value-of select="connect_type"/></xsl:with-param>
+          <xsl:with-param name="list">none:None;ssl:SSL/TSL;</xsl:with-param>
+          <xsl:with-param name="style">width: 100px;</xsl:with-param>
+            <xsl:with-param name="onchange">javascript: accountChange(this);</xsl:with-param>
+            <xsl:with-param name="disabled">
+              <xsl:choose>
+                <xsl:when test="type = 'imap'">1</xsl:when>
+                <xsl:otherwise>-1</xsl:otherwise>
+              </xsl:choose>
+            </xsl:with-param>
+        </xsl:call-template>
+      </td>
+    </tr>
+    <tr>
+      <th>
+          <label for="host">Server Address</label>
       </th>
       <td>
-        <input type="text" name="pop_server" id="server">
-          <xsl:attribute name="value"><xsl:value-of select="pop_server"/></xsl:attribute>
+          <input type="text" name="host" id="host" style="width: 300px;">
+            <xsl:attribute name="value"><xsl:value-of select="host"/></xsl:attribute>
         </input>
       </td>
       <td>
@@ -224,11 +259,11 @@
     </tr>
     <tr>
       <th>
-        <label for="port">Port</label>
+        <label for="port">Server Port</label>
       </th>
       <td>
-        <input type="text" name="pop_port" id="port">
-          <xsl:attribute name="value"><xsl:value-of select="pop_port"/></xsl:attribute>
+          <input type="text" name="port" id="port" style="width: 100px;">
+            <xsl:attribute name="value"><xsl:value-of select="port"/></xsl:attribute>
         </input>
       </td>
       <td>
@@ -240,8 +275,8 @@
         <label for="user">User Name</label>
       </th>
       <td>
-        <input type="text" name="user_name" id="user">
-          <xsl:attribute name="value"><xsl:value-of select="user_name"/></xsl:attribute>
+          <input type="text" name="user" id="user" style="width: 100px;">
+            <xsl:attribute name="value"><xsl:value-of select="user" /></xsl:attribute>
         </input>
       </td>
       <td>
@@ -250,64 +285,95 @@
     </tr>
     <tr>
       <th>
-        <label for="pass">Password</label>
+          <label for="password">Password</label>
       </th>
-      <td>
-        <input type="password" name="user_pass" id="pass">
-          <xsl:attribute name="value"><xsl:value-of select="user_pass"/></xsl:attribute>
+      <td colspan="2">
+          <input type="password" name="password" id="password" style="width: 100px;">
+            <xsl:attribute name="value"><xsl:value-of select="password"/></xsl:attribute>
         </input>
       </td>
     </tr>
     <tr>
       <th>
-        <label for="fid">Store In</label>
+          <label for="folder_id">Store In</label>
       </th>
       <td colspan="2">
         <xsl:apply-templates select="folders" mode="combo">
-          <xsl:with-param name="ID" select="'fid'" />
+            <xsl:with-param name="ID" select="'folder_id'" />
           <xsl:with-param name="showPath" select="1" />
-          <xsl:with-param name="selectID" select="/page/account/acc_edit/folder_id" />
-        </xsl:apply-templates> / <input type="text" name="fname"/>
+            <xsl:with-param name="selectID" select="folder_id" />
+          <xsl:with-param name="style">min-width: 100px;</xsl:with-param>
+            <xsl:with-param name="startOption"> </xsl:with-param>
+            <xsl:with-param name="disabled">
+              <xsl:choose>
+                <xsl:when test="type = 'imap'">1</xsl:when>
+                <xsl:otherwise>-1</xsl:otherwise>
+              </xsl:choose>
+            </xsl:with-param>
+          </xsl:apply-templates> / <input type="text" name="folder_name" style="width: 185px" />
       </td>
     </tr>
     <tr>
       <th>Check Interval</th>
-      <td>
-        <input type="radio" name="ch_interval" value="1" id="ed">
-          <xsl:if test="intervals = 1">
+      <td colspan="2">
+        <label>
+            <input type="radio" name="check_interval" value="1" id="ed">
+              <xsl:if test="check_interval = 1">
             <xsl:attribute name="checked"/>
           </xsl:if>
         </input>
-        <label for="ed">Every Day</label>
-      </td>
-      <td>
-        <input type="radio" name="ch_interval" value="2" id="eh">
-          <xsl:if test="intervals = 2">
+          Every Day
+        </label>
+        <label>
+            <input type="radio" name="check_interval" value="2" id="eh">
+              <xsl:if test="check_interval != 1">
             <xsl:attribute name="checked"/>
           </xsl:if>
         </input>
-        <label for="eh">Every Hour</label>
+          Every Hour
+        </label>
       </td>
     </tr>
     <tr>
       <th>
         <label for="org">After get</label>
       </th>
-      <td>
+      <td colspan="2">
+        <label>
         <input type="radio" name="mcopy" value="1" id="org">
           <xsl:if test="mcopy = 1">
             <xsl:attribute name="checked"/>
           </xsl:if>
-        </input> Leave original
-      </td>
-      <td>
+          </input>
+          Leave original
+        </label>
+        <label>
         <input type="radio" name="mcopy" value="0">
-          <xsl:if test="mcopy = 0">
+              <xsl:if test="mcopy != 1">
             <xsl:attribute name="checked"/>
           </xsl:if>
-        </input> Delete from server
+          </input>
+          Delete from server
+        </label>
 	    </td>
     </tr>
+      <tfoot>
+        <tr>
+          <th colspan="3">
+            <xsl:call-template name="make_submit">
+              <xsl:with-param name="name">fa_save</xsl:with-param>
+              <xsl:with-param name="value">Save</xsl:with-param>
+              <xsl:with-param name="alt">Save</xsl:with-param>
+            </xsl:call-template>
+            <xsl:call-template name="make_submit">
+              <xsl:with-param name="name">fa_cancel</xsl:with-param>
+              <xsl:with-param name="value">Cancel</xsl:with-param>
+              <xsl:with-param name="alt">Cancel</xsl:with-param>
+            </xsl:call-template>
+          </th>
+        </tr>
+      </tfoot>
+    </table>
   </xsl:template>
 
   <!-- ====================================================================================== -->
diff --git a/appsrc/ODS-WebMail/xslt/common.xsl b/appsrc/ODS-WebMail/xslt/common.xsl
index 29f3dd3..7bae5bf 100644
--- a/appsrc/ODS-WebMail/xslt/common.xsl
+++ b/appsrc/ODS-WebMail/xslt/common.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
  -
- -  $Id: common.xsl,v 1.25.2.5 2010/04/09 14:39:32 source Exp $
+ -  $Id: common.xsl,v 1.25.2.10 2011/02/14 13:03:14 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -26,6 +26,7 @@
   <xsl:output method="xhtml" indent="yes" omit-xml-declaration="no" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Strict //EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
   <xsl:include href="base.xsl"/>
 
+  <xsl:variable name="iri" select="//user_info/domain_path"/>
   <xsl:variable name="sid" select="/page/sid"/>
   <xsl:variable name="realm" select="/page/realm"/>
   <xsl:variable name="fid" select="/page/folder_id"/>
@@ -98,7 +99,7 @@
                     <xsl:call-template name="make_href">
                         <xsl:with-param name="params" />
                       <xsl:with-param name="url">ch_pop3.vsp</xsl:with-param>
-                      <xsl:with-param name="label">External POP3 Accounts</xsl:with-param>
+                        <xsl:with-param name="label">External Accounts</xsl:with-param>
                     </xsl:call-template>
                   </li>
                 </ul>
@@ -160,8 +161,7 @@
       </head>
       <body style="margin: 5px; font-size: 9pt;">
         <div style="padding: 0 0 0.5em 0;">
-          <img src="/oMail/i/close_16.png" border="0" onClick="javascript: if (opener != null) opener.focus(); window.close();" alt="Close" title="Close" /><a href="#" onClick="javascript: if (opener != null) opener.focus(); window.close();"  alt="Close" title="Close"> Close</a>
-          <hr/>
+          <span class="button pointer" onclick="javascript: if (opener != null) opener.focus(); window.close();"><img class="button" src="/ods/images/icons/close_16.png" border="0" alt="Close" title="Close" /> Close</span>
         </div>
         <xsl:apply-templates/>
         <div id="FT">
@@ -251,6 +251,8 @@
       var featureList=["ajax", "json", "anchor", "dialog", "dav", "combolist", "calendar"];
     </script>
     <script type="text/javascript" src="/ods/oat/loader.js"></script>
+    <script type="text/javascript" src="/ods/tbl.js"></script>
+    <script type="text/javascript" src="/oMail/i/js/tbl.js"></script>
     <script type="text/javascript" src="/ods/app.js"></script>
     <script type="text/javascript">
       function myInit() {
@@ -313,14 +315,14 @@
       <div style="background-color: #fff;">
         <div style="float: left;">
           <xsl:call-template name="make_href">
-          <xsl:with-param name="params" />
-            <xsl:with-param name="url"><xsl:value-of select="//user_info/domain_path" /></xsl:with-param>
+          <xsl:with-param name="url"></xsl:with-param>
             <xsl:with-param name="title">Mail Home</xsl:with-param>
             <xsl:with-param name="img">/oMail/i/omailbanner_sml.jpg</xsl:with-param>
           </xsl:call-template>
         </div>
         <div style="float: right; text-align: right; padding-right: 0.5em; padding-top: 20px;">
-        <form name="FS" action="search.vsp" method="get">
+        <form name="FS" method="get">
+          <xsl:attribute name="action"><xsl:value-of select="$iri" />/search.vsp</xsl:attribute>
           <xsl:call-template name="hid_sid"/>
           <input type="text" name="q" value=""/>
           <input type="hidden" name="search.x" value="x"/>
diff --git a/appsrc/ODS-WebMail/xslt/common_folders.xsl b/appsrc/ODS-WebMail/xslt/common_folders.xsl
index 02ecdca..c173996 100644
--- a/appsrc/ODS-WebMail/xslt/common_folders.xsl
+++ b/appsrc/ODS-WebMail/xslt/common_folders.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: common_folders.xsl,v 1.3.2.3 2009/09/02 14:49:08 source Exp $
+ -  $Id: common_folders.xsl,v 1.3.2.6 2011/01/25 14:12:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -209,9 +209,50 @@
     <xsl:param name="scope" select="'N'" />
     <xsl:param name="selectID" select="-1" />
     <xsl:param name="skipID" select="-1" />
+    <xsl:param name="disabled">-1</xsl:param>
+    <xsl:param name="style" />
     <select>
       <xsl:attribute name="name"><xsl:value-of select="$ID"/></xsl:attribute>
       <xsl:attribute name="id"><xsl:value-of select="$ID"/></xsl:attribute>
+      <xsl:if test="$style">
+        <xsl:attribute name="style"><xsl:value-of select="$style" /></xsl:attribute>
+      </xsl:if>
+      <xsl:if test="$disabled != -1">
+        <xsl:attribute name="disabled"><xsl:value-of select="$disabled" /></xsl:attribute>
+      </xsl:if>
+      <xsl:if test="$startOption != ''">
+        <option value="0"><xsl:value-of select="$startOption"/></option>
+      </xsl:if>
+      <xsl:apply-templates select="folder" mode="combo">
+        <xsl:with-param name="path" select="$path" />
+        <xsl:with-param name="showPath" select="$showPath" />
+        <xsl:with-param name="scope" select="$scope" />
+        <xsl:with-param name="selectID" select="$selectID" />
+        <xsl:with-param name="skipID" select="$skipID" />
+      </xsl:apply-templates>
+    </select>
+  </xsl:template>
+
+  <!-- ====================================================================================== -->
+  <xsl:template match="foldersCombo" mode="combo">
+    <xsl:param name="ID" select="'fid'" />
+    <xsl:param name="path" />
+    <xsl:param name="showPath" select="0" />
+    <xsl:param name="startOption" select="''" />
+    <xsl:param name="scope" select="'N'" />
+    <xsl:param name="selectID" select="-1" />
+    <xsl:param name="skipID" select="-1" />
+    <xsl:param name="disabled">-1</xsl:param>
+    <xsl:param name="style" />
+    <select>
+      <xsl:attribute name="name"><xsl:value-of select="$ID"/></xsl:attribute>
+      <xsl:attribute name="id"><xsl:value-of select="$ID"/></xsl:attribute>
+      <xsl:if test="$style">
+        <xsl:attribute name="style"><xsl:value-of select="$style" /></xsl:attribute>
+      </xsl:if>
+      <xsl:if test="$disabled != -1">
+        <xsl:attribute name="disabled"><xsl:value-of select="$disabled" /></xsl:attribute>
+      </xsl:if>
       <xsl:if test="$startOption != ''">
         <option value="0"><xsl:value-of select="$startOption"/></option>
       </xsl:if>
diff --git a/appsrc/ODS-WebMail/xslt/construct_body.xsl b/appsrc/ODS-WebMail/xslt/construct_body.xsl
new file mode 100644
index 0000000..581694b
--- /dev/null
+++ b/appsrc/ODS-WebMail/xslt/construct_body.xsl
@@ -0,0 +1,128 @@
+<?xml version="1.0"?>
+<!--
+ -
+ -  $Id: construct_body.xsl,v 1.1.4.2 2010/11/09 20:12:59 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2009 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:output method="text"/>
+  <xsl:variable name="content_transfer_encoding">8bit</xsl:variable>
+  <xsl:variable name="charset_def">windows-1251</xsl:variable>
+  <xsl:variable name="charset">
+    <xsl:choose>
+      <xsl:when test="/message/charset != ''">
+        <xsl:value-of select="/message/charset"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$charset_def"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <!-- ====================================================================================== -->
+  <xsl:template match="message">Content-Type: <xsl:call-template name="content_type"/>;
+<xsl:call-template name="content_transfer_encoding"/>;
+
+<xsl:call-template name="mbody"/>
+  </xsl:template>
+  <!-- ====================================================================================== -->
+  <xsl:template name="content_type">
+    <xsl:choose>
+      <xsl:when test="count(attachments) > 0">multipart/mixed</xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="mime_type"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <!-- BODY ===================================================================== -->
+  <xsl:template name="mbody">
+    <xsl:choose>
+      <xsl:when test="count(attachments) > 0">
+        <xsl:call-template name="multipart"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="mbody/mtext"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <!-- BODY ===================================================================== -->
+  <xsl:template name="multipart">
+ This is a multi-part message in MIME format.
+
+--<xsl:value-of select="boundary"/>
+Content-Type: <xsl:call-template name="mime_type"/>;
+	charset="<xsl:value-of select="$charset"/>"
+Content-Transfer-Encoding: <xsl:value-of select="$content_transfer_encoding"/>
+    <xsl:text>
+
+</xsl:text>
+    <xsl:value-of select="mbody/mtext"/>
+
+--<xsl:value-of select="boundary"/>
+    <xsl:apply-templates select="attachments/attachment"/>--
+</xsl:template>
+  <!-- ATT ===================================================================== -->
+  <xsl:template match="attachments/attachment">
+Content-Type: <xsl:value-of select="mime_type"/>;
+	name="<xsl:value-of select="pname"/>"
+Content-Transfer-Encoding: <xsl:choose>
+      <xsl:when test="type_id > 19999">base64</xsl:when>
+      <xsl:otherwise>8 bit</xsl:otherwise>
+    </xsl:choose>
+Content-Disposition: attachment;
+<xsl:choose>
+      <xsl:when test="string-length(content_id) > 0">Content-ID: <<xsl:value-of select="content_id"/>></xsl:when>
+      <xsl:otherwise>	filename="<xsl:value-of select="pname"/>"</xsl:otherwise>
+    </xsl:choose>
+    <xsl:text>
+
+</xsl:text>
+    <xsl:value-of select="bdata"/>
+
+--<xsl:value-of select="//boundary"/>
+  </xsl:template>
+  <!-- MIME-TYPE ============================================================== -->
+  <xsl:template name="mime_type">
+    <xsl:choose>
+      <xsl:when test="type_id = 10110">text/html</xsl:when>
+      <xsl:when test="type_id = 10100">text/plain</xsl:when>
+      <xsl:when test="mime_type = 'html'">text/html</xsl:when>
+      <xsl:when test="mime_type = 'text'">text/plain</xsl:when>
+      <xsl:when test="mime_type = 'txt'">text/plain</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="mime_type"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <!-- CONTENT_TRANSFER_ENCODING ============================================================== -->
+  <xsl:template name="content_transfer_encoding">
+    <xsl:choose>
+      <xsl:when test="count(attachments) = 0">	charset="<xsl:value-of select="$charset"/>"
+Content-Transfer-Encoding: <xsl:value-of select="$content_transfer_encoding"/>
+      </xsl:when>
+      <xsl:otherwise>	boundary="<xsl:value-of select="boundary"/>"</xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  <!-- Ref ID ============================================================== -->
+  <xsl:template match="ref_id">
+    <xsl:if test="string-length(.) > 0">
+References: <<xsl:value-of select="."/>></xsl:if>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/appsrc/ODS-WebMail/xslt/construct_mail.xsl b/appsrc/ODS-WebMail/xslt/construct_mail.xsl
index 1a35ff8..2cd0957 100644
--- a/appsrc/ODS-WebMail/xslt/construct_mail.xsl
+++ b/appsrc/ODS-WebMail/xslt/construct_mail.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: construct_mail.xsl,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: construct_mail.xsl,v 1.2.2.2 2010/11/09 20:12:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -41,14 +41,20 @@
 Date: <xsl:value-of select="to_snd_date"/>
 Reply-To: <xsl:apply-templates select="displayName"/><xsl:text> </xsl:text><<xsl:apply-templates select="replyTo"/>>
 Message-ID: <<xsl:value-of select="srv_msg_id"/>>
-MIME-Version: 1.0
-Content-Type: <xsl:call-template name="content_type"/>;
-<xsl:call-template name="content_transfer_encoding"/>;
 X-Priority: <xsl:value-of select="priority"/>
     <xsl:apply-templates select="ref_id"/>
 X-MSMail-Priority: Normal
+<xsl:choose>
+  <xsl:when test="/message/signed = '1'">
+    <xsl:call-template name="mbody"/>
+  </xsl:when>
+  <xsl:otherwise>MIME-Version: 1.0
+Content-Type: <xsl:call-template name="content_type"/>;
+<xsl:call-template name="content_transfer_encoding"/>;
 
 <xsl:call-template name="mbody"/>
+</xsl:otherwise>
+</xsl:choose>
   </xsl:template>
   <!-- ====================================================================================== -->
   <xsl:template match="address/addres_list/from | address/addres_list/to">
diff --git a/appsrc/ODS-WebMail/xslt/construct_mail_pop3.xsl b/appsrc/ODS-WebMail/xslt/construct_mail_pop3.xsl
index a99d885..06ce1f1 100644
--- a/appsrc/ODS-WebMail/xslt/construct_mail_pop3.xsl
+++ b/appsrc/ODS-WebMail/xslt/construct_mail_pop3.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: construct_mail_pop3.xsl,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: construct_mail_pop3.xsl,v 1.2.2.1 2010/09/20 10:15:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/xslt/construct_recip.xsl b/appsrc/ODS-WebMail/xslt/construct_recip.xsl
index cf70e0b..1ca1e61 100644
--- a/appsrc/ODS-WebMail/xslt/construct_recip.xsl
+++ b/appsrc/ODS-WebMail/xslt/construct_recip.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: construct_recip.xsl,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: construct_recip.xsl,v 1.2.2.1 2010/09/20 10:15:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/xslt/date_time.xsl b/appsrc/ODS-WebMail/xslt/date_time.xsl
index 324cddd..60f5448 100644
--- a/appsrc/ODS-WebMail/xslt/date_time.xsl
+++ b/appsrc/ODS-WebMail/xslt/date_time.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: date_time.xsl,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: date_time.xsl,v 1.2.2.1 2010/09/20 10:15:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/xslt/err.xsl b/appsrc/ODS-WebMail/xslt/err.xsl
index 0632af8..6fb8b16 100644
--- a/appsrc/ODS-WebMail/xslt/err.xsl
+++ b/appsrc/ODS-WebMail/xslt/err.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: err.xsl,v 1.3 2006/08/14 20:58:57 source Exp $
+ -  $Id: err.xsl,v 1.3.2.1 2010/09/20 10:15:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/xslt/errors.xml b/appsrc/ODS-WebMail/xslt/errors.xml
index e4e0756..b718f6d 100644
--- a/appsrc/ODS-WebMail/xslt/errors.xml
+++ b/appsrc/ODS-WebMail/xslt/errors.xml
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: errors.xml,v 1.5 2008/04/17 09:05:13 source Exp $
+ -  $Id: errors.xml,v 1.5.2.2 2011/01/25 14:12:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -103,7 +103,7 @@
   </error>
   <error id="1902">
     <title>Bad recipient(s) e-mail address specified</title>
-    <descr>You typed an invalid email address in one of the address fields (TO, CC or BCC).  The format for email address is </descr>
+    <descr>You typed an invalid email address in one of the address fields (TO, CC or BCC).</descr>
     <decision>Please, go <back page="write.vsp" p="wp"/>, check or correct the email address in one of the address fields and re-send..</decision>
     <button page="write.vsp" p="wp"/>
   </error>
diff --git a/appsrc/ODS-WebMail/xslt/export/rss2atom.xsl b/appsrc/ODS-WebMail/xslt/export/rss2atom.xsl
index 285d734..f70655f 100644
--- a/appsrc/ODS-WebMail/xslt/export/rss2atom.xsl
+++ b/appsrc/ODS-WebMail/xslt/export/rss2atom.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom.xsl,v 1.3.2.1 2010/05/31 21:59:15 source Exp $
+ -  $Id: rss2atom.xsl,v 1.3.2.2 2010/09/20 10:15:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/xslt/export/rss2atom03.xsl b/appsrc/ODS-WebMail/xslt/export/rss2atom03.xsl
index 2862392..9c19759 100644
--- a/appsrc/ODS-WebMail/xslt/export/rss2atom03.xsl
+++ b/appsrc/ODS-WebMail/xslt/export/rss2atom03.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2atom03.xsl,v 1.3 2007/05/10 10:48:32 source Exp $
+ -  $Id: rss2atom03.xsl,v 1.3.2.1 2010/09/20 10:15:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/xslt/export/rss2rdf.xsl b/appsrc/ODS-WebMail/xslt/export/rss2rdf.xsl
index a5419ef..1120bf7 100644
--- a/appsrc/ODS-WebMail/xslt/export/rss2rdf.xsl
+++ b/appsrc/ODS-WebMail/xslt/export/rss2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2rdf.xsl,v 1.5 2007/05/10 10:48:32 source Exp $
+ -  $Id: rss2rdf.xsl,v 1.5.2.1 2010/09/20 10:15:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/xslt/export/rss2xbel.xsl b/appsrc/ODS-WebMail/xslt/export/rss2xbel.xsl
index 4a8e6d7..b3ae4c6 100644
--- a/appsrc/ODS-WebMail/xslt/export/rss2xbel.xsl
+++ b/appsrc/ODS-WebMail/xslt/export/rss2xbel.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: rss2xbel.xsl,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: rss2xbel.xsl,v 1.2.2.1 2010/09/20 10:15:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/xslt/filters.xsl b/appsrc/ODS-WebMail/xslt/filters.xsl
index 953477c..e4e1c0b 100644
--- a/appsrc/ODS-WebMail/xslt/filters.xsl
+++ b/appsrc/ODS-WebMail/xslt/filters.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: filters.xsl,v 1.1.2.2 2010/03/12 09:13:16 source Exp $
+ -  $Id: filters.xsl,v 1.1.2.5 2010/09/20 10:15:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -28,7 +28,8 @@
 
   <!-- ====================================================================================== -->
   <xsl:template match="page">
-    <form action="filters.vsp" method="post" name="f1">
+    <form method="post" name="f1">
+      <xsl:attribute name="action"><xsl:value-of select="$iri" />/filters.vsp</xsl:attribute>
       <xsl:call-template name="hid_sid"/>
       <xsl:apply-templates select="filters"/>
       <xsl:apply-templates select="filter[@type='edit']"/>
@@ -173,10 +174,10 @@
 	    </tr>
 	    <tr>
 	      <td colspan="2">
-		      <input name="search_seqNo" id="search_seqNo" type="hidden">
-		      	<xsl:attribute name="value"><xsl:value-of select="count(criteria/entry)" /></xsl:attribute>
-     		  </input>
-		      <table id="searchProperties" class="form-list" style="width: 100%;" cellspacing="0">
+		      <table style="width: 100%;" cellspacing="0">
+		        <tr>
+		          <td width="100%">
+      		      <table id="search_tbl" class="form-list" style="width: 100%;" cellspacing="0">
 		        <thead>
 		          <tr>
 		            <th id="search_th_0" width="33%">Field</th>
@@ -186,30 +187,36 @@
 		          </tr>
 		        </thead>
 		        <tbody id="search_tbody">
-		          <tr id="search_tr">
-		            <td colspan="4">
-		              <hr />
-		            </td>
+      		          <tr id="search_tr_no">
+      		            <td colspan="3">No Criteria</td>
 		          </tr>
 		    		    <script type="text/javascript">
 						      <xsl:for-each select="criteria/entry">
-		                OAT.MSG.attach(OAT, "PAGE_LOADED", function(){OMAIL.searchRowCreate('<xsl:value-of select="@ID" />', {field_0:'<xsl:value-of select="@field" />', field_1:'<xsl:value-of select="@criteria" />', field_2:'<xsl:value-of select="." />'});});
+      					        OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow("search", null, {fld_1: {mode: 40, value: "<xsl:value-of select="@field" />"}, fld_2: {mode: 41, value: "<xsl:value-of select="@criteria" />"}, fld_3: {mode: 42, value: "<xsl:value-of select="." />"}});});
 		    		      </xsl:for-each>
-                  OAT.MSG.attach(OAT, "PAGE_LOADED", function(){OMAIL.searchRowCreate('<xsl:value-of select="count(criteria/entry)" />');});
 		    		    </script>
 		        </tbody>
 		      </table>
 	      </td>
+      	      <td nowrap="nowrap" valign="top">
+    	          <span class="button pointer">
+    	            <xsl:attribute name="onclick">javascript: TBL.createRow('search', null, {fld_1: {mode: 40}, fld_2: {mode: 41}, fld_3: {mode: 42}});</xsl:attribute>
+                  <img border="0" title="Add Criteria" alt="Add Criteria" class="button" src="/ods/images/icons/add_16.png" /> Add
+    	          </span>
+      	      </td>
+     	      </tr>
+     	    </table>
+     	  </td>
 	    </tr>
 	    <tr>
         <th colspan="2" style="background-color: #EAEAEE; text-align: center;">Actions</th>
 	    </tr>
 	    <tr>
 	      <td colspan="2">
-		      <input name="action_seqNo" id="action_seqNo" type="hidden">
-		      	<xsl:attribute name="value"><xsl:value-of select="count(actions/entry)" /></xsl:attribute>
-     		  </input>
-		      <table id="actionProperties" class="form-list" style="width: 100%;" cellspacing="0">
+		      <table style="width: 100%;" cellspacing="0">
+		        <tr>
+		          <td width="100%">
+      		      <table id="action_tbl" class="form-list" style="width: 100%;" cellspacing="0">
 		        <thead>
 		          <tr>
 		            <th id="action_th_0" width="50%">Action</th>
@@ -218,20 +225,26 @@
 		          </tr>
 		        </thead>
 		        <tbody id="action_tbody">
-		          <tr id="action_tr">
-		            <td colspan="3">
-		              <hr />
-		            </td>
+      		          <tr id="action_tr_no">
+      		            <td colspan="3">No Actions</td>
 		          </tr>
 		    		    <script type="text/javascript">
 						      <xsl:for-each select="actions/entry">
-		                OAT.MSG.attach(OAT, "PAGE_LOADED", function(){OMAIL.actionRowCreate('<xsl:value-of select="@ID" />', {field_0:'<xsl:value-of select="@action" />', field_1:'<xsl:value-of select="." />'});});
+      	                OAT.MSG.attach(OAT, "PAGE_LOADED", function(){TBL.createRow('action', null, {fld_1: {mode: 45, value: '<xsl:value-of select="@action" />'}, fld_2: {mode:46, value: '<xsl:value-of select="." />'}});});
 		    		      </xsl:for-each>
-                  OAT.MSG.attach(OAT, "PAGE_LOADED", function(){OMAIL.actionRowCreate('<xsl:value-of select="count(actions/entry)" />');});
 		    		    </script>
 		        </tbody>
 		      </table>
 	      </td>
+      	      <td nowrap="nowrap" valign="top">
+    	          <span class="button pointer">
+    	            <xsl:attribute name="onclick">javascript: TBL.createRow('action', null, {fld_1: {mode: 45}, fld_2: {mode: 46}});</xsl:attribute>
+                  <img border="0" title="Add Action" alt="Add Action" class="button" src="/ods/images/icons/add_16.png" /> Add
+    	          </span>
+      	      </td>
+     	      </tr>
+     	    </table>
+     	  </td>
 	    </tr>
       <tfoot>
         <tr>
diff --git a/appsrc/ODS-WebMail/xslt/folders.xsl b/appsrc/ODS-WebMail/xslt/folders.xsl
index 0861165..01dd3b4 100644
--- a/appsrc/ODS-WebMail/xslt/folders.xsl
+++ b/appsrc/ODS-WebMail/xslt/folders.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: folders.xsl,v 1.3.2.3 2010/01/14 16:04:14 source Exp $
+ -  $Id: folders.xsl,v 1.3.2.5 2010/09/20 10:15:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -36,7 +36,8 @@
         <xsl:variable name="next_ord" select="1"/>
       </xsl:otherwise>
     </xsl:choose>
-    <form name="f1" action="folders.vsp" method="post">
+    <form name="f1" method="post">
+      <xsl:attribute name="action"><xsl:value-of select="$iri" />/folders.vsp</xsl:attribute>
       <xsl:call-template name="hid_sid"/>
       <xsl:choose>
         <xsl:when test="object/@id">
diff --git a/appsrc/ODS-WebMail/xslt/handlers.xsl b/appsrc/ODS-WebMail/xslt/handlers.xsl
index 6538978..cfec7dc 100644
--- a/appsrc/ODS-WebMail/xslt/handlers.xsl
+++ b/appsrc/ODS-WebMail/xslt/handlers.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: handlers.xsl,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: handlers.xsl,v 1.2.2.1 2010/09/20 10:15:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/xslt/html_parse.xsl b/appsrc/ODS-WebMail/xslt/html_parse.xsl
index 1ce6065..55811a7 100644
--- a/appsrc/ODS-WebMail/xslt/html_parse.xsl
+++ b/appsrc/ODS-WebMail/xslt/html_parse.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: html_parse.xsl,v 1.3 2007/10/17 20:29:22 source Exp $
+ -  $Id: html_parse.xsl,v 1.3.2.2 2011/03/08 13:25:12 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -112,7 +112,7 @@
     </tr>
   </xsl:template>
   <!-- td ========================================================================== -->
-  <xsl:template match="td">
+  <xsl:template match="td|th">
     <td>
       <xsl:if test="@colspan != ''">
         <xsl:attribute name="colspan"><xsl:value-of select="@colspan"/></xsl:attribute>
@@ -176,6 +176,12 @@
       <xsl:apply-templates/>
     </br>
   </xsl:template>
+  <!-- hr ========================================================================== -->
+  <xsl:template match="hr">
+    <hr>
+      <xsl:apply-templates/>
+    </hr>
+  </xsl:template>
   <!-- u ========================================================================== -->
   <xsl:template match="u">
     <u>
diff --git a/appsrc/ODS-WebMail/xslt/html_parse2.xsl b/appsrc/ODS-WebMail/xslt/html_parse2.xsl
index 0c3c0dd..11a03f6 100644
--- a/appsrc/ODS-WebMail/xslt/html_parse2.xsl
+++ b/appsrc/ODS-WebMail/xslt/html_parse2.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: html_parse2.xsl,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: html_parse2.xsl,v 1.2.2.2 2011/03/08 13:25:12 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -105,7 +105,7 @@
     </tr>
   </xsl:template>
   <!-- td ========================================================================== -->
-  <xsl:template match="td">
+  <xsl:template match="td|th">
     <td>
       <xsl:if test="@colspan != ''">
         <xsl:attribute name="colspan"><xsl:value-of select="@colspan"/></xsl:attribute>
@@ -164,6 +164,12 @@
       <xsl:apply-templates/>
     </br>
   </xsl:template>
+  <!-- hr ========================================================================== -->
+  <xsl:template match="hr">
+    <hr>
+      <xsl:apply-templates/>
+    </hr>
+  </xsl:template>
   <!-- u ========================================================================== -->
   <xsl:template match="u">
     <u>
diff --git a/appsrc/ODS-WebMail/xslt/mails.xsl b/appsrc/ODS-WebMail/xslt/mails.xsl
index 62b5a29..b1e7b1f 100644
--- a/appsrc/ODS-WebMail/xslt/mails.xsl
+++ b/appsrc/ODS-WebMail/xslt/mails.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: mails.xsl,v 1.1 2007/05/04 15:16:32 source Exp $
+ -  $Id: mails.xsl,v 1.1.2.1 2010/09/20 10:15:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/xslt/open.xsl b/appsrc/ODS-WebMail/xslt/open.xsl
index d967d0a..edab24d 100644
--- a/appsrc/ODS-WebMail/xslt/open.xsl
+++ b/appsrc/ODS-WebMail/xslt/open.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: open.xsl,v 1.11.2.2 2009/08/24 19:53:36 source Exp $
+ -  $Id: open.xsl,v 1.11.2.6 2011/01/25 14:12:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -31,6 +31,7 @@
   <!-- ====================================================================================== -->
   <xsl:template match="page">
     <form method="post" name="f1">
+      <xsl:attribute name="action"><xsl:value-of select="$iri" />/open.vsp</xsl:attribute>
       <xsl:call-template name="hid_sid"/>
       <xsl:call-template name="msg_tools"/>
       <xsl:apply-templates select="message"/>
@@ -136,6 +137,27 @@
           </xsl:choose>
         </td>
       </tr>
+      <!-- Options -->
+      <xsl:if test="options/ssl = 1">
+        <tr>
+          <th>Options</th>
+          <td>
+            Signed: <b>Yes</b>
+            <xsl:choose>
+              <xsl:when test="options/sslVerified = 1">
+                <b><i>(verified)</i></b>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:if test="options/webID != ''">; WebID: <b><xsl:value-of select="options/webID" /></b>
+                  <xsl:if test="options/webIDVerified">
+                    (<img src="/ods/images/icons/lock_16.png" height="14" />)
+                  </xsl:if>
+                </xsl:if>
+              </xsl:otherwise>
+            </xsl:choose>
+          </td>
+        </tr>
+      </xsl:if>
       <!-- Tags -->
       <tr>
         <th>Comma separated tags</th>
@@ -582,7 +604,7 @@
           <tr>
             <th class="left">
               <label for="fid">Move to folder</label>
-              <xsl:apply-templates select="folders" mode="combo"/>
+              <xsl:apply-templates select="foldersCombo" mode="combo" />
               <xsl:call-template name="make_href">
                 <xsl:with-param name="url">javascript: formSubmit('fa_move.x', '1'); </xsl:with-param>
                 <xsl:with-param name="title">Move</xsl:with-param>
diff --git a/appsrc/ODS-WebMail/xslt/search.xsl b/appsrc/ODS-WebMail/xslt/search.xsl
index ef3e217..6cc2018 100644
--- a/appsrc/ODS-WebMail/xslt/search.xsl
+++ b/appsrc/ODS-WebMail/xslt/search.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: search.xsl,v 1.6.2.5 2010/01/14 16:04:14 source Exp $
+ -  $Id: search.xsl,v 1.6.2.7 2010/09/20 10:15:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -24,11 +24,14 @@
 -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
   <xsl:include href="box.xsl"/>
+
   <!-- ====================================================================================== -->
   <xsl:variable name="fid" select="/page/fid"/>
+
   <!-- ====================================================================================== -->
   <xsl:template match="page">
-    <form action="search.vsp" method="post" name="f1">
+    <form method="post" name="f1">
+      <xsl:attribute name="action"><xsl:value-of select="$iri" />/search.vsp</xsl:attribute>
       <xsl:call-template name="hid_sid"/>
       <input type="hidden" name="bp">
         <xsl:attribute name="value"><xsl:value-of select="bp"/></xsl:attribute>
diff --git a/appsrc/ODS-WebMail/xslt/sendok.xsl b/appsrc/ODS-WebMail/xslt/sendok.xsl
index a28c434..fcd36dd 100644
--- a/appsrc/ODS-WebMail/xslt/sendok.xsl
+++ b/appsrc/ODS-WebMail/xslt/sendok.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sendok.xsl,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: sendok.xsl,v 1.2.2.1 2010/09/20 10:15:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-WebMail/xslt/set_mail.xsl b/appsrc/ODS-WebMail/xslt/set_mail.xsl
index 4974095..dffd15d 100644
--- a/appsrc/ODS-WebMail/xslt/set_mail.xsl
+++ b/appsrc/ODS-WebMail/xslt/set_mail.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: set_mail.xsl,v 1.9.2.1 2009/05/11 07:39:15 source Exp $
+ -  $Id: set_mail.xsl,v 1.9.2.4 2010/11/09 20:12:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -26,7 +26,8 @@
   <xsl:include href="common.xsl"/>
   <!-- ====================================================================================== -->
   <xsl:template match="page">
-    <form action="set_mail.vsp" method="post" name="f1">
+    <form method="post" name="f1">
+      <xsl:attribute name="action"><xsl:value-of select="$iri" />/set_mail.vsp</xsl:attribute>
       <xsl:call-template name="hid_sid"/>
       <table width="100%" cellpadding="0" cellspacing="0" align="center" class="content">
         <colgroup>
@@ -80,6 +81,14 @@
     <xsl:apply-templates select="spam_msg_clean"/>
     <xsl:apply-templates select="spam_msg_header"/>
     <xsl:apply-templates select="spam"/>
+    <tr>
+      <th style="background-color: #EAEAEE;" />
+      <th style="background-color: #EAEAEE; text-align: left;">Security</th>
+    </tr>
+    <xsl:apply-templates select="security_sign"/>
+    <xsl:apply-templates select="security_sign_mode"/>
+    <xsl:apply-templates select="security_encrypt"/>
+    <xsl:apply-templates select="security_encrypt_mode"/>
   </xsl:template>
   <!-- ====================================================================================== -->
   <xsl:template match="msg_name">
@@ -190,14 +199,15 @@
     <tr>
       <th>Discussion</th>
       <td>
+        <label>
         <xsl:call-template name="make_checkbox">
           <xsl:with-param name="name">conversation</xsl:with-param>
-          <xsl:with-param name="id">conversation</xsl:with-param>
           <xsl:with-param name="value">1</xsl:with-param>
           <xsl:with-param name="checked"><xsl:if test=". = 1">1</xsl:if></xsl:with-param>
           <xsl:with-param name="disabled"><xsl:choose><xsl:when test="../discussion = 0">1</xsl:when><xsl:otherwise>-1</xsl:otherwise></xsl:choose></xsl:with-param>
         </xsl:call-template>
-        <label for="conversation">Enable discussion on this instance</label>
+          Enable discussion on this instance
+        </label>
       </td>
     </tr>
     <xsl:if test="../discussion = 0">
@@ -301,7 +311,6 @@
     </tr>
   </xsl:template>
   <!-- ====================================================================================== -->
-  <!-- ====================================================================================== -->
   <xsl:template match="spam">
     <tr>
       <th>Allow messages from</th>
@@ -315,4 +324,79 @@
     </tr>
   </xsl:template>
   <!-- ====================================================================================== -->
+  <xsl:template match="security_sign">
+    <tr>
+      <th>Digitally signing (with certificate)</th>
+      <td>
+        <select name="security_sign">
+          <option></option>
+          <xsl:apply-templates select="certificates/certificate" />
+        </select>
+      </td>
+    </tr>
+  </xsl:template>
+  <!-- ====================================================================================== -->
+  <xsl:template match="security_sign_mode">
+    <tr>
+      <th></th>
+      <td>
+        <label>
+          <xsl:call-template name="make_checkbox">
+            <xsl:with-param name="name">security_sign_mode</xsl:with-param>
+            <xsl:with-param name="value">1</xsl:with-param>
+            <xsl:with-param name="checked"><xsl:if test=". = 1">1</xsl:if></xsl:with-param>
+          </xsl:call-template>
+          Digitally sign messages (by default)
+        </label>
+      </td>
+    </tr>
+  </xsl:template>
+  <!-- ====================================================================================== -->
+  <xsl:template match="security_encrypt">
+    <tr>
+      <th>Encryption (with certificate)</th>
+      <td>
+        <select name="security_encrypt">
+          <option></option>
+          <xsl:apply-templates select="certificates/certificate" />
+        </select>
+      </td>
+    </tr>
+  </xsl:template>
+  <!-- ====================================================================================== -->
+  <xsl:template match="security_encrypt_mode">
+    <tr>
+      <th></th>
+      <td>
+        <label>
+          <input type="radio" name="security_encrypt_mode" value="0">
+            <xsl:if test="../security_encrypt_mode = 0">
+              <xsl:attribute name="checked"/>
+            </xsl:if>
+          </input>
+  			  Never (do not use encryption)
+  	    </label>
+  	    <br />
+        <label>
+          <input type="radio" name="security_encrypt_mode" value="1">
+            <xsl:if test="../security_encrypt_mode = 1">
+              <xsl:attribute name="checked"/>
+            </xsl:if>
+          </input>
+  			  Required (can't send message unless all recipeints have certificates)
+  	    </label>
+      </td>
+    </tr>
+  </xsl:template>
+  <!-- ====================================================================================== -->
+  <xsl:template match="certificate">
+    <option>
+      <xsl:value-of select="."/>
+      <xsl:if test="@selected">
+        <xsl:attribute name="selected">1</xsl:attribute>
+      </xsl:if>
+    </option>
+    <xsl:apply-templates select="certificates/certificate" />
+  </xsl:template>
+  <!-- ====================================================================================== -->
 </xsl:stylesheet>
diff --git a/appsrc/ODS-WebMail/xslt/tools.xsl b/appsrc/ODS-WebMail/xslt/tools.xsl
index be9b4ab..8b888ba 100644
--- a/appsrc/ODS-WebMail/xslt/tools.xsl
+++ b/appsrc/ODS-WebMail/xslt/tools.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: tools.xsl,v 1.2.2.1 2009/05/11 07:39:15 source Exp $
+ -  $Id: tools.xsl,v 1.2.2.3 2010/09/20 10:15:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -50,7 +50,8 @@
     <caption>
       <span>Edit folder</span>
     </caption>
-    <form action="tools.vsp" method="post">
+    <form method="post">
+      <xsl:attribute name="action"><xsl:value-of select="$iri" />/tools.vsp</xsl:attribute>
       <xsl:call-template name="hid_sid"/>
       <input type="hidden" name="tp">
         <xsl:attribute name="value"><xsl:value-of select="/page/tp"/>,1</xsl:attribute>
diff --git a/appsrc/ODS-WebMail/xslt/write.xsl b/appsrc/ODS-WebMail/xslt/write.xsl
index 44074a5..d880e68 100644
--- a/appsrc/ODS-WebMail/xslt/write.xsl
+++ b/appsrc/ODS-WebMail/xslt/write.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: write.xsl,v 1.8.2.3 2010/01/29 20:21:31 source Exp $
+ -  $Id: write.xsl,v 1.8.2.6 2010/11/09 20:12:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -93,7 +93,8 @@
 
       ]]>
     </script>
-    <form name="f1" action="write.vsp" method="post" enctype="multipart/form-data" onSubmit="javascript: returnValue(document.forms['f1'].elements['mt']); return true;">
+    <form name="f1" method="post" enctype="multipart/form-data" onSubmit="javascript: returnValue(document.forms['f1'].elements['mt']); return true;">
+      <xsl:attribute name="action"><xsl:value-of select="$iri" />/write.vsp</xsl:attribute>
       <xsl:call-template name="hid_sid"/>
       <input type="hidden" name="wp">
         <xsl:attribute name="value"><xsl:value-of select="wp"/></xsl:attribute>
@@ -254,16 +255,17 @@
           <xsl:call-template name="nbsp"/>
         </th>
         <td>
-          <input type="checkbox" name="mt" value="html" id="addr_mt" onClick="javascript: toggleTab(this);">
+          <label>
+            <input type="checkbox" name="mt" value="html" onclick="javascript: toggleTab(this);">
             <xsl:if test="message/type_id = 10110">
               <xsl:attribute name="checked">checked</xsl:attribute>
             </xsl:if>
           </input>
-          <label for="addr_mt">HTML format</label>
-          <xsl:call-template name="nbsp">
-            <xsl:with-param name="count" select="4"/>
-          </xsl:call-template>
-          <select name="priority" id="addr_pr">
+            HTML format
+          </label>
+          |
+          <label>
+            <select name="priority">
             <option value="3">
               <xsl:if test="message/priority = 3">
                 <xsl:attribute name="selected">1</xsl:attribute>
@@ -285,18 +287,53 @@
                 <xsl:attribute name="selected">1</xsl:attribute>
               </xsl:if>Highest</option>
           </select>
-          <xsl:call-template name="nbsp"/>
-          <label for="addr_pr">Priority</label>
-          <xsl:call-template name="nbsp">
-            <xsl:with-param name="count" select="4"/>
-          </xsl:call-template>
+            Priority
+          </label>
+          |
+          <label>
           <input type="checkbox" name="scopy" value="1">
             <xsl:if test="//save_copy = 1">
               <xsl:attribute name="checked">checked</xsl:attribute>
             </xsl:if>
           </input>
-          <label for="scopy">Save copy in "Sent" folder</label>
-          <xsl:call-template name="nbsp"/>
+            Save copy in "Sent" folder
+          </label>
+          <xsl:if test="//security_sign_mode = 1">
+            |
+            <label>
+              <input type="checkbox" name="ssign" value="1">
+                <xsl:choose>
+                  <xsl:when test="message/options/securitySign">
+                    <xsl:if test="message/options/securitySign = 1">
+                      <xsl:attribute name="checked">checked</xsl:attribute>
+                    </xsl:if>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:attribute name="checked">checked</xsl:attribute>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </input>
+              Digitally sign
+            </label>
+          </xsl:if>
+          <xsl:if test="//security_encrypt_mode = 1">
+            |
+            <label>
+              <input type="checkbox" name="sencrypt" value="1">
+                <xsl:choose>
+                  <xsl:when test="message/options/securityEncrypt">
+                    <xsl:if test="message/options/securityEncrypt = 1">
+                      <xsl:attribute name="checked">checked</xsl:attribute>
+                    </xsl:if>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:attribute name="checked">checked</xsl:attribute>
+                  </xsl:otherwise>
+                </xsl:choose>
+              </input>
+              Encrypt
+            </label>
+          </xsl:if>
         </td>
       </tr>
       <tr>
diff --git a/appsrc/ODS-Wiki/Makefile.in b/appsrc/ODS-Wiki/Makefile.in
index 49eae98..1407247 100644
--- a/appsrc/ODS-Wiki/Makefile.in
+++ b/appsrc/ODS-Wiki/Makefile.in
@@ -224,6 +224,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-Wiki/Skins/default/PostProcess.xslt b/appsrc/ODS-Wiki/Skins/default/PostProcess.xslt
index d50a69a..7355730 100644
--- a/appsrc/ODS-Wiki/Skins/default/PostProcess.xslt
+++ b/appsrc/ODS-Wiki/Skins/default/PostProcess.xslt
@@ -28,7 +28,7 @@
                 xmlns:wv="http://www.openlinksw.com/Virtuoso/WikiV/"
                 xmlns:fn2="http://www.w3.org/2004/07/xpath-functions">
 
-<!-- $Id: PostProcess.xslt,v 1.20 2008/02/19 11:13:57 source Exp $ -->
+<!-- $Id: PostProcess.xslt,v 1.20.2.1 2010/09/20 10:15:48 source Exp $ -->
 
   <xsl:output
     method="html"
diff --git a/appsrc/ODS-Wiki/Skins/default/default.css b/appsrc/ODS-Wiki/Skins/default/default.css
index a950a04..fb5ce7d 100644
--- a/appsrc/ODS-Wiki/Skins/default/default.css
+++ b/appsrc/ODS-Wiki/Skins/default/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.9.2.5 2010/01/29 20:21:31 source Exp $
+ *  $Id: default.css,v 1.9.2.7 2011/03/26 14:21:52 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -1263,3 +1263,7 @@ td.cpDayColumnHeader
 {
     clear: left;
 }
+.save1
+{
+  width: 300px;
+}
diff --git a/appsrc/ODS-Wiki/atom.sql b/appsrc/ODS-Wiki/atom.sql
index b9be685..a5d5be6 100644
--- a/appsrc/ODS-Wiki/atom.sql
+++ b/appsrc/ODS-Wiki/atom.sql
@@ -1,7 +1,7 @@
 --
 --  atom.sql
 --
---  $Id: atom.sql,v 1.9.2.4 2009/12/13 23:28:00 source Exp $
+--  $Id: atom.sql,v 1.9.2.7 2011/03/26 14:21:51 source Exp $
 --
 --  Atom publishing protocol support.
 --
@@ -303,6 +303,7 @@ create procedure WV.WIKI.gdata (
 
   declare exit handler for sqlstate '*'
   {
+    -- dbg_obj_print ('', __SQL_STATE, __SQL_MESSAGE);
     if (__SQL_STATE = 'BLOGV')
       http_request_status ('HTTP/1.1 409 Conflict');
     resignal;
@@ -372,9 +373,7 @@ create procedure WV.WIKI.gdata (
         }
       }
     }
-    else
-    {
-    if (_content_type in ('application/atom+xml', 'application/x.atom+xml', 'text/xml', 'application/xml'))
+    else if (_content_type in ('application/atom+xml', 'application/x.atom+xml', 'text/xml', 'application/xml'))
     {
       _content := string_output_string (http_body_read ());
       if (length (_content))
@@ -382,7 +381,6 @@ create procedure WV.WIKI.gdata (
         xt := xml_tree_doc (xml_tree (_content));
         xml_tree_doc_encoding (xt, 'utf-8');
     }      
-    }
     _atomVersion := cast (xpath_eval ('[ xmlns:wv="http://www.openlinksw.com/Virtuoso/WikiV/" ] /entry/wv:version', xt) as varchar);
       if (isnull (_atomVersion) or (_atomVersion not in ('2.0', '3.0')))
     {
@@ -399,15 +397,11 @@ create procedure WV.WIKI.gdata (
         if (topic.ti_id)
           topic.ti_find_metadata_by_id ();
 
-        if ((_method in ('PUT', 'DELETE')) and (topic.ti_id = 0))
-    {
-          _status := 'HTTP/1.1 404 Not Found';
-        }
-        else if (_method in ('PUT', 'POST'))
+        if (_method in ('PUT', 'POST'))
         {
       content := cast (xpath_eval ('/entry/content/text()', xt) as varchar);
           WV.WIKI.UPLOADPAGE (topic.ti_col_id, topic.ti_local_name || '.txt', content, _user);
-          if (_method = 'POST')
+          if (topic.ti_id = 0)
       _status := 'HTTP/1.1 201 Created';
 
           -- update attachments
@@ -449,6 +443,8 @@ create procedure WV.WIKI.gdata (
     }
     else if (_method = 'DELETE')
     {
+          if (topic.ti_id <> 0)
+          {
           declare attachment_path varchar;
 
           attachment_path := DB.DBA.DAV_SEARCH_PATH (topic.ti_col_id, 'C') || topic.ti_local_name || '/';
@@ -458,6 +454,7 @@ create procedure WV.WIKI.gdata (
         }
     }
   }
+  }
 
 _exit:;
   _content := http_body_read ();
diff --git a/appsrc/ODS-Wiki/conv.sql b/appsrc/ODS-Wiki/conv.sql
index 61f4b62..068f4c1 100644
--- a/appsrc/ODS-Wiki/conv.sql
+++ b/appsrc/ODS-Wiki/conv.sql
@@ -1,5 +1,5 @@
 --
---  $Id: conv.sql,v 1.10 2008/04/17 09:07:09 source Exp $
+--  $Id: conv.sql,v 1.10.2.1 2010/09/20 10:15:46 source Exp $
 --  
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/drop.sql b/appsrc/ODS-Wiki/drop.sql
index 6a1870b..2523de5 100644
--- a/appsrc/ODS-Wiki/drop.sql
+++ b/appsrc/ODS-Wiki/drop.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: drop.sql,v 1.16 2008/01/25 13:42:49 source Exp $
+--  $Id: drop.sql,v 1.16.2.2 2011/01/31 11:17:53 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -109,7 +109,17 @@ WV.WIKI.SILENT_EXEC('drop trigger WS.WS.Wiki_TopicTextSparql_AI');
 WV.WIKI.SILENT_EXEC('drop trigger WS.WS.Wiki_TopicTextSparql_AU');
 WV.WIKI.SILENT_EXEC('drop trigger DB.DBA.Wiki_TopicTextSparql_AI');
 WV.WIKI.SILENT_EXEC('drop trigger DB.DBA.Wiki_TopicTextSparql_AU');
+
+WV.WIKI.SILENT_EXEC('drop trigger WS.WS.WIKI_SYS_DAV_PROP_AI');
+WV.WIKI.SILENT_EXEC('drop trigger WS.WS.WIKI_SYS_DAV_PROP_BU');
+WV.WIKI.SILENT_EXEC('drop trigger WS.WS.WIKI_SYS_DAV_PROP_BD');
+
+WV.WIKI.SILENT_EXEC('drop trigger WS.WS.WIKI_SYS_DAV_RES_AI');
+WV.WIKI.SILENT_EXEC('drop trigger WS.WS.WIKI_SYS_DAV_RES_AU');
+WV.WIKI.SILENT_EXEC('drop trigger WS.WS.WIKI_SYS_DAV_RES_BD');
+
 WV.WIKI.SILENT_EXEC('drop trigger DB.DBA.SYS_USERS_WIKI_USERS_U');
+
 WV.WIKI.SILENT_EXEC('drop trigger DB.DBA.WIKI_WA_MEMBERSHIP');
 WV.WIKI.SILENT_EXEC('drop trigger DB.DBA.WIKI_WA_MEMBERSHIP_OPEN');
 WV.WIKI.SILENT_EXEC('drop trigger DB.DBA.WIKI_WA_MEMBERSHIP_CLOSE');
diff --git a/appsrc/ODS-Wiki/export.sql b/appsrc/ODS-Wiki/export.sql
index c306db3..febd8c6 100644
--- a/appsrc/ODS-Wiki/export.sql
+++ b/appsrc/ODS-Wiki/export.sql
@@ -1,5 +1,5 @@
 --
---  $Id: export.sql,v 1.8 2008/02/19 11:13:57 source Exp $
+--  $Id: export.sql,v 1.8.2.1 2010/09/20 10:15:46 source Exp $
 --  
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/generate_drop_proc.sh b/appsrc/ODS-Wiki/generate_drop_proc.sh
index 547815c..8110367 100755
--- a/appsrc/ODS-Wiki/generate_drop_proc.sh
+++ b/appsrc/ODS-Wiki/generate_drop_proc.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: generate_drop_proc.sh,v 1.3.2.1 2009/04/16 15:26:53 source Exp $
+#  $Id: generate_drop_proc.sh,v 1.3.2.2 2010/09/20 10:15:46 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
diff --git a/appsrc/ODS-Wiki/http/HTMLtoWiki.xslt b/appsrc/ODS-Wiki/http/HTMLtoWiki.xslt
index fd584c9..2912633 100644
--- a/appsrc/ODS-Wiki/http/HTMLtoWiki.xslt
+++ b/appsrc/ODS-Wiki/http/HTMLtoWiki.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: HTMLtoWiki.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: HTMLtoWiki.xslt,v 1.2.2.1 2010/09/20 10:15:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspAttachmentDeleteConfirm.xslt b/appsrc/ODS-Wiki/http/VspAttachmentDeleteConfirm.xslt
index ef664fb..804cf8e 100644
--- a/appsrc/ODS-Wiki/http/VspAttachmentDeleteConfirm.xslt
+++ b/appsrc/ODS-Wiki/http/VspAttachmentDeleteConfirm.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspAttachmentDeleteConfirm.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: VspAttachmentDeleteConfirm.xslt,v 1.2.2.1 2010/09/20 10:15:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspChangeLog.xslt b/appsrc/ODS-Wiki/http/VspChangeLog.xslt
index 811e0a6..f31f80f 100644
--- a/appsrc/ODS-Wiki/http/VspChangeLog.xslt
+++ b/appsrc/ODS-Wiki/http/VspChangeLog.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspChangeLog.xslt,v 1.3 2007/02/27 21:19:46 source Exp $
+ -  $Id: VspChangeLog.xslt,v 1.3.2.1 2010/09/20 10:15:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspMail.xslt b/appsrc/ODS-Wiki/http/VspMail.xslt
index 5ade5c0..b2a0cc2 100644
--- a/appsrc/ODS-Wiki/http/VspMail.xslt
+++ b/appsrc/ODS-Wiki/http/VspMail.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspMail.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: VspMail.xslt,v 1.2.2.1 2010/09/20 10:15:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspNoteCompile.xslt b/appsrc/ODS-Wiki/http/VspNoteCompile.xslt
index fe5aacd..a3e0aaa 100644
--- a/appsrc/ODS-Wiki/http/VspNoteCompile.xslt
+++ b/appsrc/ODS-Wiki/http/VspNoteCompile.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspNoteCompile.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: VspNoteCompile.xslt,v 1.2.2.1 2010/09/20 10:15:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspReportError.xslt b/appsrc/ODS-Wiki/http/VspReportError.xslt
index 1002c15..faf37ed 100644
--- a/appsrc/ODS-Wiki/http/VspReportError.xslt
+++ b/appsrc/ODS-Wiki/http/VspReportError.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspReportError.xslt,v 1.4 2007/03/16 17:20:13 source Exp $
+ -  $Id: VspReportError.xslt,v 1.4.2.1 2010/09/20 10:15:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspSearch.xslt b/appsrc/ODS-Wiki/http/VspSearch.xslt
index 5bccf95..f1e050a 100644
--- a/appsrc/ODS-Wiki/http/VspSearch.xslt
+++ b/appsrc/ODS-Wiki/http/VspSearch.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspSearch.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: VspSearch.xslt,v 1.2.2.1 2010/09/20 10:15:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspTopicAttach.xslt b/appsrc/ODS-Wiki/http/VspTopicAttach.xslt
index be47e9f..986ecbf 100644
--- a/appsrc/ODS-Wiki/http/VspTopicAttach.xslt
+++ b/appsrc/ODS-Wiki/http/VspTopicAttach.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspTopicAttach.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: VspTopicAttach.xslt,v 1.2.2.1 2010/09/20 10:15:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspTopicAttachManage.xslt b/appsrc/ODS-Wiki/http/VspTopicAttachManage.xslt
index 9f4ba93..9fb4b00 100644
--- a/appsrc/ODS-Wiki/http/VspTopicAttachManage.xslt
+++ b/appsrc/ODS-Wiki/http/VspTopicAttachManage.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspTopicAttachManage.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: VspTopicAttachManage.xslt,v 1.2.2.1 2010/09/20 10:15:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspTopicCreate.xslt b/appsrc/ODS-Wiki/http/VspTopicCreate.xslt
index ac76e59..272023e 100644
--- a/appsrc/ODS-Wiki/http/VspTopicCreate.xslt
+++ b/appsrc/ODS-Wiki/http/VspTopicCreate.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspTopicCreate.xslt,v 1.3.2.1 2010/01/29 20:21:31 source Exp $
+ -  $Id: VspTopicCreate.xslt,v 1.3.2.2 2010/09/20 10:15:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspTopicDelete.xslt b/appsrc/ODS-Wiki/http/VspTopicDelete.xslt
index c42cb1f..7866055 100644
--- a/appsrc/ODS-Wiki/http/VspTopicDelete.xslt
+++ b/appsrc/ODS-Wiki/http/VspTopicDelete.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspTopicDelete.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: VspTopicDelete.xslt,v 1.2.2.1 2010/09/20 10:15:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspTopicEdit.xslt b/appsrc/ODS-Wiki/http/VspTopicEdit.xslt
index 2c75824..2c10952 100644
--- a/appsrc/ODS-Wiki/http/VspTopicEdit.xslt
+++ b/appsrc/ODS-Wiki/http/VspTopicEdit.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspTopicEdit.xslt,v 1.2.2.1 2010/01/29 20:21:31 source Exp $
+ -  $Id: VspTopicEdit.xslt,v 1.2.2.2 2010/09/20 10:15:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspTopicHistory.xslt b/appsrc/ODS-Wiki/http/VspTopicHistory.xslt
index a7e526e..79ed5a8 100644
--- a/appsrc/ODS-Wiki/http/VspTopicHistory.xslt
+++ b/appsrc/ODS-Wiki/http/VspTopicHistory.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspTopicHistory.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: VspTopicHistory.xslt,v 1.2.2.1 2010/09/20 10:15:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspTopicMoreOps.xslt b/appsrc/ODS-Wiki/http/VspTopicMoreOps.xslt
index 1546d3c..f75e558 100644
--- a/appsrc/ODS-Wiki/http/VspTopicMoreOps.xslt
+++ b/appsrc/ODS-Wiki/http/VspTopicMoreOps.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspTopicMoreOps.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: VspTopicMoreOps.xslt,v 1.2.2.1 2010/09/20 10:15:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspTopicRename.xslt b/appsrc/ODS-Wiki/http/VspTopicRename.xslt
index 4d1a770..3ed769f 100644
--- a/appsrc/ODS-Wiki/http/VspTopicRename.xslt
+++ b/appsrc/ODS-Wiki/http/VspTopicRename.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspTopicRename.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: VspTopicRename.xslt,v 1.2.2.1 2010/09/20 10:15:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/VspTopicReports.xslt b/appsrc/ODS-Wiki/http/VspTopicReports.xslt
index 2923818..752229e 100644
--- a/appsrc/ODS-Wiki/http/VspTopicReports.xslt
+++ b/appsrc/ODS-Wiki/http/VspTopicReports.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspTopicReports.xslt,v 1.3.2.1 2009/06/04 14:56:22 source Exp $
+ -  $Id: VspTopicReports.xslt,v 1.3.2.4 2011/01/05 14:01:13 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -26,15 +26,11 @@
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:xhtml="http://www.w3.org/TR/xhtml1/strict"
                 xmlns:wv="http://www.openlinksw.com/Virtuoso/WikiV/" >
-<xsl:output
-   method="html"
-   encoding="utf-8"
-/>
+
+  <xsl:output method="html" encoding="utf-8"/>
 
 <xsl:include href="common.xsl"/>
 <xsl:include href="template.xsl"/>
-<xsl:param name="sid"/>
-<xsl:param name="realm"/>
 
 <xsl:param name="sid"/>
 <xsl:param name="realm"/>
@@ -46,6 +42,18 @@
   </xsl:copy>
 </xsl:template>
   
+  <xsl:template match="Referers">
+    <h3>Topics that link to
+    <xsl:call-template name="wikiref">
+      <xsl:with-param name="wikiref_cont"><xsl:value-of select="$ti_cluster_name"/>.<xsl:value-of select="$ti_local_name"/></xsl:with-param>
+    </xsl:call-template>:</h3>
+    <ul>
+      <xsl:apply-templates select="Link">
+        <xsl:sort select="@LOCALNAME"/>
+      </xsl:apply-templates>
+    </ul>
+  </xsl:template>
+
 <xsl:template match="Link">
 <li>
   <xsl:call-template name="wikiref">
@@ -54,20 +62,11 @@
     <xsl:with-param name="wikiref_cont"><xsl:value-of select="@CLUSTERNAME"/>.<xsl:value-of select="@LOCALNAME"/></xsl:with-param>
   </xsl:call-template>
 <xsl:if test="@Abstract"> -- <xsl:value-of select="@Abstract"/></xsl:if>
+      <xsl:if test="@UPDATED_ON"> (<i>last updated by <b><xsl:value-of select="@UPDATED_BY"/></b> on <b><xsl:value-of select="@UPDATED_ON"/></b></i>)</xsl:if>
+      <!--<xsl:if test="@CREATED_ON"> (<i>created by <b><xsl:value-of select="@CREATED_BY"/></b> on <b><xsl:value-of select="@CREATED_ON"/></b></i>)</xsl:if>-->
 </li>
 </xsl:template>
 
-<xsl:template match="Referers">
- <h3>Topics that link to 
- <xsl:call-template name="wikiref">
-   <xsl:with-param name="wikiref_cont"><xsl:value-of select="$ti_cluster_name"/>.<xsl:value-of select="$ti_local_name"/></xsl:with-param>
- </xsl:call-template>:</h3>
- <ul>
-   <xsl:apply-templates>
-   </xsl:apply-templates>
- </ul>
-</xsl:template>
-
 <xsl:template match="ClusterIndex">
 <h3>This is a list of all topics of the cluster "<xsl:value-of select="$ti_cluster_name"/>":</h3>
 <ul>
diff --git a/appsrc/ODS-Wiki/http/VspTopicView.xslt b/appsrc/ODS-Wiki/http/VspTopicView.xslt
index 90c40b1..4c7d184 100644
--- a/appsrc/ODS-Wiki/http/VspTopicView.xslt
+++ b/appsrc/ODS-Wiki/http/VspTopicView.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: VspTopicView.xslt,v 1.21.2.1 2009/05/11 07:39:15 source Exp $
+ -  $Id: VspTopicView.xslt,v 1.21.2.2 2010/09/20 10:15:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/XmlAtomFeed.xslt b/appsrc/ODS-Wiki/http/XmlAtomFeed.xslt
index bf784db..b6eeee7 100644
--- a/appsrc/ODS-Wiki/http/XmlAtomFeed.xslt
+++ b/appsrc/ODS-Wiki/http/XmlAtomFeed.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: XmlAtomFeed.xslt,v 1.3.2.1 2010/01/07 16:57:09 source Exp $
+ -  $Id: XmlAtomFeed.xslt,v 1.3.2.3 2011/02/03 10:26:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -41,7 +41,7 @@
      <title >oWiki <xsl:value-of select="@cluster"/> Weblog</title>
     </xsl:if>
     <link  rel="alternate"><xsl:value-of select="@home"/></link>
-    <copyright >Copyright (c) 1998-2010, OpenLink Software</copyright>
+    <copyright >Copyright (c) 1998-2011, OpenLink Software</copyright>
     <author >
       <name><xsl:value-of select="@name"/></name>
       <email><xsl:value-of select="@email"/></email>
diff --git a/appsrc/ODS-Wiki/http/XmlRDFFeed.xslt b/appsrc/ODS-Wiki/http/XmlRDFFeed.xslt
index a3732fc..bff9695 100644
--- a/appsrc/ODS-Wiki/http/XmlRDFFeed.xslt
+++ b/appsrc/ODS-Wiki/http/XmlRDFFeed.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: XmlRDFFeed.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: XmlRDFFeed.xslt,v 1.2.2.1 2010/09/20 10:15:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/XmlRssFeed.xslt b/appsrc/ODS-Wiki/http/XmlRssFeed.xslt
index c2963a6..7544d48 100644
--- a/appsrc/ODS-Wiki/http/XmlRssFeed.xslt
+++ b/appsrc/ODS-Wiki/http/XmlRssFeed.xslt
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: XmlRssFeed.xslt,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: XmlRssFeed.xslt,v 1.2.2.1 2010/09/20 10:15:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/advanced_search.vspx b/appsrc/ODS-Wiki/http/advanced_search.vspx
index 5b1ebf8..d93a170 100644
--- a/appsrc/ODS-Wiki/http/advanced_search.vspx
+++ b/appsrc/ODS-Wiki/http/advanced_search.vspx
@@ -23,7 +23,7 @@
 <?vsp WV.WIKI.VSPHEADER (path,params,lines, 'Advanced Search');
 
 ?>
-<!-- $Id: advanced_search.vspx,v 1.15.2.1 2009/05/22 19:55:00 source Exp $ -->
+<!-- $Id: advanced_search.vspx,v 1.15.2.2 2010/09/20 10:15:50 source Exp $ -->
  <v:page name="main" 
 	style="comp.xsl" 
 	on-error-redirect="../main/" 
diff --git a/appsrc/ODS-Wiki/http/attachment.vsp b/appsrc/ODS-Wiki/http/attachment.vsp
index eb86438..3ffe8e8 100644
--- a/appsrc/ODS-Wiki/http/attachment.vsp
+++ b/appsrc/ODS-Wiki/http/attachment.vsp
@@ -1,6 +1,6 @@
 <?vsp 
 --  
---  $Id: attachment.vsp,v 1.1 2007/07/26 15:27:46 source Exp $
+--  $Id: attachment.vsp,v 1.1.2.1 2010/09/20 10:15:50 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/http/common.css b/appsrc/ODS-Wiki/http/common.css
index 016695a..a6a3bd5 100644
--- a/appsrc/ODS-Wiki/http/common.css
+++ b/appsrc/ODS-Wiki/http/common.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: common.css,v 1.6 2008/04/17 09:07:09 source Exp $
+ *  $Id: common.css,v 1.6.2.1 2010/09/20 10:15:50 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Wiki/http/common.xsl b/appsrc/ODS-Wiki/http/common.xsl
index 5c50397..d6869e9 100644
--- a/appsrc/ODS-Wiki/http/common.xsl
+++ b/appsrc/ODS-Wiki/http/common.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
  -
- -  $Id: common.xsl,v 1.14.2.1 2010/01/29 20:21:31 source Exp $
+ -  $Id: common.xsl,v 1.14.2.3 2011/01/25 14:13:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -86,11 +86,11 @@
         <xsl:attribute name="href">javascript: alert('You are in Preview mode! Save your article first.');</xsl:attribute>
       </xsl:when>
       <xsl:when test="$linkisbad = 1">
-  <xsl:attribute name="href"><xsl:value-of select="wv:ReadOnlyWikiWordHREF2($ti_cluster_name, at href,$sid,$realm, $baseadjust, '')" />?parent=<xsl:value-of select="$ti_local_name"/></xsl:attribute>
+        <xsl:attribute name="href"><xsl:value-of select="wv:ReadOnlyWikiWordHREF2($ti_cluster_name, @href, $sid, $realm)" />&parent=<xsl:value-of select="$ti_local_name"/></xsl:attribute>
         <xsl:attribute name="class">wikiword</xsl:attribute>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:attribute name="href"><xsl:value-of select="wv:ReadOnlyWikiWordHREF2($ti_cluster_name, at href,$sid,$realm, $baseadjust, '')" /></xsl:attribute>
+        <xsl:attribute name="href"><xsl:value-of select="wv:ReadOnlyWikiWordHREF2($ti_cluster_name, @href, $sid, $realm)" /></xsl:attribute>
         <xsl:attribute name="class">wikiword</xsl:attribute>
       </xsl:otherwise>
     </xsl:choose>
@@ -131,7 +131,7 @@
       <xsl:when test="($ti_local_name = '') or ($donotresolve = 1) or (wv:QueryWikiWordLink($ti_cluster_name, $ti_local_name) > 0) or ($sys = '1') or ($id  != '')">
         <a>
           <xsl:attribute name="href">
-            <xsl:value-of select="wv:ReadOnlyWikiWordHREF2($ti_cluster_name,$ti_local_name, $sid, $realm, $baseadjust, string($wikiref_params))"/>
+            <xsl:value-of select="wv:ReadOnlyWikiWordHREF2($ti_cluster_name,$ti_local_name, $sid, $realm, string($wikiref_params))"/>
           </xsl:attribute>
           <xsl:if test="$target">
             <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
@@ -155,7 +155,7 @@
       <xsl:copy-of select="$wikiref_cont"/>
       <a>
           <xsl:attribute name="href">
-            <xsl:value-of select="wv:ReadOnlyWikiWordHREF2($ti_cluster_name, $ti_local_name, $sid, $realm, $baseadjust, string (wv:collect_pairs ($wikiref_params, concat ('WikiCluster=', $ti_cluster_name))))"/>
+            <xsl:value-of select="wv:ReadOnlyWikiWordHREF2($ti_cluster_name, $ti_local_name, $sid, $realm, string (wv:collect_pairs ($wikiref_params, concat ('WikiCluster=', $ti_cluster_name))))"/>
           </xsl:attribute>?
         <xsl:if test="$target">
           <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
@@ -169,7 +169,7 @@
   </xsl:choose>
 </xsl:template>
 <xsl:template name="back-button">
-    <form action="{wv:ReadOnlyWikiWordHREF2($ti_cluster_name, $ti_local_name, $sid, $realm, $baseadjust, '')}" method="get">
+    <form action="{wv:ReadOnlyWikiWordHREF2($ti_cluster_name, $ti_local_name, $sid, $realm)}" method="get">
     <xsl:call-template name="security_hidden_inputs"/>
     <input type="submit" name="command" value="Back to the topic"></input>
   </form>
@@ -330,10 +330,10 @@
        </a>
      </xsl:if>
      <a id="users-link"
-       href="{wv:ReadOnlyWikiWordHREF2 ('Main', 'WikiUsers', $sid, $realm, $baseadjust, '')}">Users
+       href="{wv:ReadOnlyWikiWordHREF2 ('Main', 'WikiUsers', $sid, $realm)}">Users
      </a>
      <a id="macros-link"
-       href="{wv:ReadOnlyWikiWordHREF2 ('Main', 'WMacros', $sid, $realm, $baseadjust, '')}">Macros
+       href="{wv:ReadOnlyWikiWordHREF2 ('Main', 'WMacros', $sid, $realm)}">Macros
      </a>
      <div id="virtuoso-info">
        <ul class="left_nav">
diff --git a/appsrc/ODS-Wiki/http/comp.xsl b/appsrc/ODS-Wiki/http/comp.xsl
index d68559d..ac7792a 100644
--- a/appsrc/ODS-Wiki/http/comp.xsl
+++ b/appsrc/ODS-Wiki/http/comp.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: comp.xsl,v 1.14 2008/04/17 09:07:09 source Exp $
+ -  $Id: comp.xsl,v 1.14.2.1 2010/09/20 10:15:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/conversation.vspx b/appsrc/ODS-Wiki/http/conversation.vspx
index cf35691..7b0c977 100644
--- a/appsrc/ODS-Wiki/http/conversation.vspx
+++ b/appsrc/ODS-Wiki/http/conversation.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?> 
 <!--  
  -
- -  $Id: conversation.vspx,v 1.10 2008/01/21 15:35:02 source Exp $
+ -  $Id: conversation.vspx,v 1.10.2.1 2010/09/20 10:15:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/default.css b/appsrc/ODS-Wiki/http/default.css
index 06e822d..e385e95 100644
--- a/appsrc/ODS-Wiki/http/default.css
+++ b/appsrc/ODS-Wiki/http/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.2 2006/05/31 13:13:03 source Exp $
+ *  $Id: default.css,v 1.2.2.1 2010/09/20 10:15:50 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Wiki/http/export.vspx b/appsrc/ODS-Wiki/http/export.vspx
index f59b3c5..c7e5b7b 100644
--- a/appsrc/ODS-Wiki/http/export.vspx
+++ b/appsrc/ODS-Wiki/http/export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: export.vspx,v 1.7 2008/01/21 15:35:02 source Exp $
+ -  $Id: export.vspx,v 1.7.2.1 2010/09/20 10:15:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/export.xsl b/appsrc/ODS-Wiki/http/export.xsl
index 7c10737..ae6efc8 100644
--- a/appsrc/ODS-Wiki/http/export.xsl
+++ b/appsrc/ODS-Wiki/http/export.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: export.xsl,v 1.2 2006/05/31 13:13:03 source Exp $
+ -  $Id: export.xsl,v 1.2.2.1 2010/09/20 10:15:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/fault.vspx b/appsrc/ODS-Wiki/http/fault.vspx
index 601f996..a66a7dd 100644
--- a/appsrc/ODS-Wiki/http/fault.vspx
+++ b/appsrc/ODS-Wiki/http/fault.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -  
- -  $Id: fault.vspx,v 1.1 2007/03/16 17:20:13 source Exp $
+ -  $Id: fault.vspx,v 1.1.2.1 2010/09/20 10:15:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/gems.vsp b/appsrc/ODS-Wiki/http/gems.vsp
index 04e27e6..40714c4 100644
--- a/appsrc/ODS-Wiki/http/gems.vsp
+++ b/appsrc/ODS-Wiki/http/gems.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: gems.vsp,v 1.10 2007/07/26 15:27:46 source Exp $
+--  $Id: gems.vsp,v 1.10.2.1 2010/09/20 10:15:51 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/http/history.vspx b/appsrc/ODS-Wiki/http/history.vspx
index dca3fa3..32b9189 100644
--- a/appsrc/ODS-Wiki/http/history.vspx
+++ b/appsrc/ODS-Wiki/http/history.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: history.vspx,v 1.6.2.1 2009/06/04 14:56:22 source Exp $
+ -  $Id: history.vspx,v 1.6.2.2 2010/09/20 10:15:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/html2docbook.xsl b/appsrc/ODS-Wiki/http/html2docbook.xsl
index bbf8298..a16b641 100644
--- a/appsrc/ODS-Wiki/http/html2docbook.xsl
+++ b/appsrc/ODS-Wiki/http/html2docbook.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?> 
 <!--  
  -
- -  $Id: html2docbook.xsl,v 1.6 2008/03/14 17:52:52 source Exp $
+ -  $Id: html2docbook.xsl,v 1.6.2.1 2010/09/20 10:15:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/login.vsp b/appsrc/ODS-Wiki/http/login.vsp
index fad44b1..53de825 100644
--- a/appsrc/ODS-Wiki/http/login.vsp
+++ b/appsrc/ODS-Wiki/http/login.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: login.vsp,v 1.5 2006/10/17 14:16:41 source Exp $
+--  $Id: login.vsp,v 1.5.2.1 2010/09/20 10:15:51 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/http/login.vspx b/appsrc/ODS-Wiki/http/login.vspx
index bb4a58a..0a7977c 100644
--- a/appsrc/ODS-Wiki/http/login.vspx
+++ b/appsrc/ODS-Wiki/http/login.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: login.vspx,v 1.4 2008/02/19 11:13:57 source Exp $
+ -  $Id: login.vspx,v 1.4.2.1 2010/09/20 10:15:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/macros.xml b/appsrc/ODS-Wiki/http/macros.xml
index f0fa136..3b032c1 100644
--- a/appsrc/ODS-Wiki/http/macros.xml
+++ b/appsrc/ODS-Wiki/http/macros.xml
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: macros.xml,v 1.2 2007/11/13 22:14:01 source Exp $
+ -  $Id: macros.xml,v 1.2.2.1 2010/09/20 10:15:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/main.vsp b/appsrc/ODS-Wiki/http/main.vsp
index cfcd727..a4acccf 100644
--- a/appsrc/ODS-Wiki/http/main.vsp
+++ b/appsrc/ODS-Wiki/http/main.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: main.vsp,v 1.26.2.2 2010/01/29 20:21:31 source Exp $
+--  $Id: main.vsp,v 1.26.2.5 2011/03/26 14:21:52 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -165,7 +165,6 @@ major_exit_handler:
 	    }
 	  if (__SQL_STATE = 'WVRLD')
 	    {
-        --???WV.WIKI.redirect ();
 	      http_request_status ('HTTP/1.1 302 Found');
         http_header (sprintf('Location: ?%V\r\n', _sid, _realm, __SQL_MESSAGE));
 	      return;
@@ -195,9 +194,11 @@ error_report:
 	  declare _ext_params any;
 	  _ext_params := _topic.ti_xslt_vector (WV.WIKI.MAKE_PARAMS (_user, _uid, params, _base_adjust));
     http_value (
-      WV.WIKI.VSPXSLT ('PostProcess.xslt', WV.WIKI.VSPXSLT ( 'VspReportError.xslt', XMLELEMENT ('error', XMLATTRIBUTES (error_id as "id")), _ext_params),
+      WV.WIKI.VSPXSLT (
+        'PostProcess.xslt',
+        WV.WIKI.VSPXSLT ( 'VspReportError.xslt', XMLELEMENT ('error', XMLATTRIBUTES (error_id as "id")), _ext_params),
       _ext_params,
-      WV.WIKI.CLUSTERPARAM ( _topic.ti_cluster_id , 'skin', 'default')));
+        WV.WIKI.SKIN_PARAMS (_topic.ti_cluster_id , vector())));
 	  WV.WIKI.VSPFOOTER (path,params,lines);
 	  return;
   };
@@ -224,7 +225,7 @@ cont:
 	declare wa_home_link varchar;
 	wa_home_link := registry_get ('wa_home_link');
 	if (isinteger(wa_home_link))
-	 wa_home_link :='/wa/';
+        wa_home_link :='/ods/';
         http_request_status ('HTTP/1.1 302 Found');
 	if (_cmd = 'wa_redirect')
         http_header (sprintf('Location: %s/uiedit.vspx?sid=%s&realm=wa\r\n', wa_home_link, sid));
@@ -478,13 +479,13 @@ content:
     }
 
   if (_cmd = 'upstream_now') {
-    declare exit handler for sqlstate '42WV9' {
+    declare exit handler for sqlstate '42WV9'
+    {
       if (_user <> 'WikiGuest')
         goto major_exit_handler;
+
       http_rewrite();
       WV.WIKI.redirect (sprintf('%s/login.vspx?URL=%U', WV..ODS_LINK(lines), 'http://' || DB.DBA.WA_GET_HOST() || http_path() || '?command=upstream_now&' || _parent));
---      http_request_status ('HTTP/1.1 302 Found');
---      http_header (http_header_get() || sprintf('Location: %s/login.vspx?URL=%U\r\n',  WV..ODS_LINK(lines), 'http://' || DB.DBA.WA_GET_HOST() || http_path() || '?command=upstream_now&' || _parent));
       return;
     };
     declare _filename varchar;
@@ -539,22 +540,33 @@ content:
           goto content;
         }
       declare _vspx, _type varchar;
+
       _type := '';
       if (_cmd = 'maintenance')
+      {
         _vspx := 'ops.vspx';
-      if (_cmd = 'web')
+      }
+      else if (_cmd = 'web')
+      {
         _vspx := 'export.vspx';
-      if (_cmd = 'doc') {
+      }
+      else if (_cmd = 'doc')
+      {
         _vspx := 'export.vspx';
         _type := 'docbook';
       }
-      if (_cmd = 'revisions')
+      else if (_cmd = 'revisions')
+      {
         _vspx := 'history.vspx';
-      if (_cmd = 'tags')
+      }
+      else if (_cmd = 'tags')
+      {
         _vspx := 'tags.vspx';
-      if (_cmd = 'tag')
+      }
+      else if (_cmd = 'tag')
+      {
         _vspx := 'tag.vspx';
-
+      }
       WV.WIKI.VSPTOPICRESOURCE (_vspx, _type, _topic, WV.WIKI.MAKE_PARAMS (_user, _uid, params, _base_adjust));
       goto do_nothing;
     }
@@ -581,13 +593,12 @@ create_or_view:
       declare exit handler for sqlstate '42WV9' {
 	if (_user <> 'WikiGuest')
 	  goto major_exit_handler;
+
+        _title := sprintf ('?goto_title=%U', coalesce (_title, ''));
   	http_rewrite();
         http_request_status ('HTTP/1.1 302 Found');
-	if (_title is not null)
-	  _title := sprintf ('?goto_title=%U', _title);
-	else
-	  _title := '';
         http_header (http_header_get() || sprintf('Location: %s/login.vspx?URL=%U\r\n',  WV..ODS_LINK(lines), 'http://' || DB.DBA.WA_GET_HOST() || http_path() || _title || '?' ||  _parent));
+
         return;
       };
       WV.WIKI.VSPTOPICCREATE (path, lines, _cluster, _topic.ti_raw_title, WV.WIKI.MAKE_PARAMS (_user, _uid, params, _base_adjust));
diff --git a/appsrc/ODS-Wiki/http/ops.vspx b/appsrc/ODS-Wiki/http/ops.vspx
index c9a790b..2e279ad 100644
--- a/appsrc/ODS-Wiki/http/ops.vspx
+++ b/appsrc/ODS-Wiki/http/ops.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ops.vspx,v 1.12 2008/01/21 15:35:02 source Exp $
+ -  $Id: ops.vspx,v 1.12.2.3 2011/01/25 14:13:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -59,8 +59,9 @@
 	self.source_page := WV.WIKI.READONLYWIKIWORDLINK (_topic.ti_cluster_name,_topic.ti_local_name);
 	self.topic := _topic;
         self.sid := get_keyword('sid', params);
-        self.realm := get_keyword('realm', params, 'wiki');
-        if (self.topic.ti_local_name = WV.WIKI.CLUSTERPARAM (self.topic.ti_cluster_id, 'index-page', 'WelcomeVisitors')) {
+        self.realm := get_keyword('realm', params, 'wa');
+        if (self.topic.ti_local_name = WV.WIKI.CLUSTERPARAM (self.topic.ti_cluster_id, 'index-page', 'WelcomeVisitors'))
+        {
 	    self.allow_delete := 'disabled';
 	    self.allow_rename := 'disabled';
 	  }
@@ -73,15 +74,18 @@
     </v:before-data-bind>
     <v:after-data-bind>
       <![CDATA[
-        if (not self.vc_authenticated) {
+        declare pwd varchar;
+
+        if (not self.vc_authenticated)
+        {
           http_rewrite();
           http_request_status ('HTTP/1.1 302 Found');
           http_header (http_header_get() || sprintf('Location: %slogin.vspx?URL=%U\r\n', WV..ODS_LINK (self.vc_event.ve_lines), sprintf ('http://%s/wiki/resources/ops.vspx?id=%d', WV.WIKI.GET_HOST(), self.id)));
           return;
         }
-        declare pwd varchar;
 	pwd := (select pwd_magic_calc (U_NAME, U_PASSWORD, 1) from DB.DBA.SYS_USERS where U_NAME = self.vspx_user);
-        if (DAV_HIDE_ERROR (DAV_AUTHENTICATE (self.topic.ti_res_id, 'R', '_1_', self.vspx_user, pwd)) is null) {
+        if (DAV_HIDE_ERROR (DAV_AUTHENTICATE (self.topic.ti_res_id, 'R', '_1_', self.vspx_user, pwd)) is null)
+        {
 	    self.allow_delete := 'disabled';
 	    self.allow_rename := 'disabled';
 	    self.allow_set_parent := 'disabled';
@@ -100,18 +104,20 @@
      <vm:page title="Actions">
       <vm:body>
 	  <div class="wiki-error"><v:error-summary/></div>
-	    <v:label name="topic_name" value="--self.source_page"/>
+        <v:label name="topic_name" value="--'Maitanance: ' || self.source_page"/>
 	    <v:form type="simple" method="POST">
           <v:login name="wiki_login" realm="wa" mode="url">
             <v:template name='inl' type='if-no-login'/>
           </v:login>
 
 	     <v:template name="topic_info" type="simple">
-	      <table>
-	        <tr bgcolor="#DFFFDF">
-		  <td/>
-		  <td>
-                  <v:button name="delete_btn" value="Delete Topic..." action="simple" xhtml_disabled="--self.allow_delete"
+            <br />
+            <br />
+            <div style=" background-color: #DDEEEE">
+              <fieldset>
+          			<legend><b>Delete topic</b></legend>
+                <br />
+                <v:button name="delete_btn" value="Delete" action="simple" xhtml_disabled="--self.allow_delete"
                     xhtml_onclick="javascript: return confirm (\'If you really want to delete the topic, click OK.\');">
                     <v:on-post>
                       <![CDATA[
@@ -128,105 +134,139 @@
 		      ]]>
 		    </v:on-post>
 		   </v:button>
-		  </td>
-		</tr>
-		<tr bgcolor="#FFDFFF">
+              </fieldset>
+              <fieldset>
+          			<legend><b>Copy Topic</b></legend>
+          			<table cellpadding="2">
+          			  <tr>
+          			    <th align="right" width="180px">
+                      Copy topic name
+                    </th>
 		 <td>
-                  <v:text name="copy_topic_name" value="--concat('CopyOf', self.topic.ti_local_name)" error-glyph="*">
-                  </v:text>
+                      <v:text name="copy_topic_name" value="--concat('CopyOf', self.topic.ti_local_name)" error-glyph="*" xhtml_style="width: 300px" />
                 </td>
-                <td>
+          			  </tr>
+          			  <tr>
+          			    <td colspan="2">
+                      <br />
                   <v:button name="copy_btn" value="\ \ Copy Topic\ \ \ " action="simple" xhtml_disabled="--self.allow_copy">
                     <v:on-post>
                       <![CDATA[
-                        if (trim (self.copy_topic_name.ufl_value) <> WV.WIKI.CONVERTTITLETOWIKIWORD (trim (self.copy_topic_name.ufl_value))) {
+                            if (trim (self.copy_topic_name.ufl_value) <> WV.WIKI.CONVERTTITLETOWIKIWORD (trim (self.copy_topic_name.ufl_value)))
+                            {
                           self.vc_error_message := 'Topic name is not WikiWord';
                           self.vc_is_valid := 0;
                           self.set_message (e, '');
                           return;
                         }
                         declare _new_name varchar;
-                        _new_name := trim (self.copy_topic_name.ufl_value);
                         declare _new_topic WV.WIKI.TOPICINFO;
+
+                            _new_name := trim (self.copy_topic_name.ufl_value);
                         _new_topic := WV.WIKI.TOPICINFO();
                         _new_topic.ti_cluster_id := self.topic.ti_cluster_id;
                         _new_topic.ti_cluster_name := self.topic.ti_cluster_name;
                         _new_topic.ti_local_name := _new_name;
                         _new_topic.ti_find_id_by_local_name();
-                        if (_new_topic.ti_id <> 0) {
+                            if (_new_topic.ti_id <> 0)
+                            {
                           self.vc_error_message := 'Topic ' || self.topic.ti_cluster_name || '.' || _new_topic.ti_local_name || ' exists already';
                           self.vc_is_valid := 0;
                           self.set_message (e, '');
                           return;
                         }
-                        ;
                         WV.WIKI.COPYTOPIC (_new_name, self.topic, self.vspx_user);
                       ]]>
                     </v:on-post>
                   </v:button>
                 </td>
               </tr>
-              <tr bgcolor="#FFDFFF">
+          			</table>
+              </fieldset>
+              <fieldset>
+          			<legend><b>Rename Topic</b></legend>
+          			<table cellpadding="2">
+          			  <tr>
+          			    <th align="right" width="180px">
+                      Rename topic name
+                    </th>
                 <td>
-		   <v:text name="new_topic_name" value="--self.topic.ti_local_name" error-glyph="*">
-		   </v:text>
-		   <br/>
+                      <v:text name="new_topic_name" value="--self.topic.ti_local_name" error-glyph="*" xhtml_style="width: 300px" />
+                    </td>
+          			  </tr>
+          			  <tr>
+          			    <th>
+                    </th>
+                    <td>
+                      <label>
 		   <v:check-box name="fix_refs" value="1" initial-checked="1"/>
 		   Fix references on all pages in cluster
+                      </label>
 		 </td>
-		 <td valign="top">
+          			  </tr>
+          			  <tr>
+          			    <td colspan="2">
+                      <br />
 		  <v:button name="rename_btn" value="Rename Topic" action="simple" xhtml_disabled="--self.allow_rename">
                     <v:on-post>
                       <![CDATA[
-                        if (trim (self.new_topic_name.ufl_value) <> WV.WIKI.CONVERTTITLETOWIKIWORD (trim (self.new_topic_name.ufl_value))) {
+                            declare index_page varchar;
+                            declare _new_name varchar;
+                            declare _other_topic WV.WIKI.TOPICINFO;
+
+                            if (trim (self.new_topic_name.ufl_value) <> WV.WIKI.CONVERTTITLETOWIKIWORD (trim (self.new_topic_name.ufl_value)))
+                            {
                           self.vc_error_message := 'Topic name is not WikiWord';
                           self.vc_is_valid := 0;
                           self.set_message (e, '');
 		       return;
                         }
-		     declare index_page varchar;
                         index_page := WV.WIKI.CLUSTERPARAM (self.topic.ti_cluster_id, 'index-page', 'WelcomeVisitors');
-                        if (self.topic.ti_local_name = index_page) {
+                            if (self.topic.ti_local_name = index_page)
+                            {
 		         self.vc_error_message := 'Can not rename index topic';
 			 self.vc_is_valid := 0;
 			 self.set_message (e, '');
 			 return;
 		       }
-		     declare _new_name varchar;
 		     _new_name := trim (self.new_topic_name.ufl_value);
-		     declare _other_topic WV.WIKI.TOPICINFO;
 		     _other_topic := WV.WIKI.TOPICINFO();
 		     _other_topic.ti_cluster_id := self.topic.ti_cluster_id;
 		     _other_topic.ti_local_name := _new_name;
 		     _other_topic.ti_find_id_by_local_name();
-                        if (_other_topic.ti_id <> 0) {
+                            if (_other_topic.ti_id <> 0)
+                            {
 		         self.vc_error_message := 'Topic ' || self.topic.ti_cluster_name || '.' || _other_topic.ti_local_name || ' exists already';
 			 self.vc_is_valid := 0;
 			 self.set_message (e, '');
 			 return;
 		       }
-		     ;
-		
-                        if (self.fix_refs.ufl_selected) {
+                            if (self.fix_refs.ufl_selected)
+                            {
 		         declare topics_changed int;
                           declare topics any;
+                              declare msg varchar;
+                              declare n integer;
+
 			 topics_changed := WV.WIKI.CHANGE_WORD_IN_CLUSTER (self.topic.ti_cluster_name,
 			 	self.topic.ti_local_name,
 				_new_name,
                             self.vspx_user,
                             topics);
-                          declare msg varchar;
                           msg := sprintf ('%ld topics has been changed', topics_changed);
-                          if (not isnull (topics)) {
-                            declare n integer;
-                            for (n:=0;n<length(topics);n:=n+1) {
-                              msg := msg || (sprintf ('<br /><a href="%s">%s</a>', WV.WIKI.READONLYWIKIWORDHREF2 (self.topic.ti_cluster_name, topics[n], self.sid, self.realm,'',''), topics[n]));
+                              if (not isnull (topics))
+                              {
+                                for (n := 0; n < length(topics); n := n + 1)
+                                {
+                                  msg := msg || (sprintf ('<br /><a href="%s">%s</a>', WV.WIKI.READONLYWIKIWORDHREF2 (self.topic.ti_cluster_name, topics[n], self.sid, self.realm), topics[n]));
                             }
                           }
                           self.set_message (e, msg);
 		       }
 		     else
+                            {
 			 self.set_message (e, '');
+                            }
                         WV.WIKI.RENAMETOPIC2 (self.topic, self.vspx_user, self.topic.ti_cluster_id, _new_name);
                         self.source_page := WV.WIKI.READONLYWIKIWORDLINK (self.topic.ti_cluster_name, _other_topic.ti_local_name);
                         self.topic := _other_topic;
@@ -236,12 +276,21 @@
 		  </v:button>
 		 </td>
 		</tr>
-		<tr bgcolor="#DFFFFF">
+          			</table>
+              </fieldset>
+              <fieldset>
+          			<legend><b>Change parent</b></legend>
+          			<table cellpadding="2">
+          			  <tr>
+          			    <th align="right" width="180px">
+                      Parent
+                    </th>
 		 <td>
-		   <select name="parent_topic">
+                      <select name="parent_topic" style="width: 300px">
 <?vsp		  
 			http ('<option value="0">**no parent**</option>');
-                      for select LocalName, TopicId from WV.WIKI.TOPIC where ClusterId = self.topic.ti_cluster_id order by LocalName do {
+                          for select LocalName, TopicId from WV.WIKI.TOPIC where ClusterId = self.topic.ti_cluster_id order by LocalName do
+                          {
 			    if (self.topic.ti_parent_id = TopicId)
 			      http (sprintf ('<option value="%ld" selected="selected">%s</option>', TopicId, LocalName));
 			    else
@@ -250,26 +299,37 @@
 ?>
 		   </select>
 		 </td>
-	 	 <td>
+          			  </tr>
+          			  <tr>
+          			    <td colspan="2">
+                      <br />
 		   <v:button name="set_new_parent" value="Set New Parent" action="simple" xhtml_disabled="--self.allow_set_parent">
 		     <v:on-post>
 		     <![CDATA[
 		       declare _pid int;
-		       _pid := cast (self.parent_topic as integer);
 		       declare _error varchar;
+
+                            _pid := cast (self.parent_topic as integer);
 		       _error := WV.WIKI.TOPICSETPARENT (self.topic.ti_id, _pid);
-                        if (_error is not null) {
+                            if (_error is not null)
+                            {
 			   self.vc_error_message := _error;
 			   self.vc_is_valid := 0;
 			 }		      
 		       else
+                            {
 		         self.vc_redirect(sprintf ('ops.vspx?id=%ld', self.topic.ti_id));
+                            }
 		       self.set_message (e, '');
 		      ]]>
 		      </v:on-post>
 		    </v:button>
 		  </td>
 		</tr>
+          			</table>
+              </fieldset>
+            </div>
+            <table>
 	      <tr>
 	        <td colspan="2">
 		  <vm:back-button/>
@@ -290,6 +350,6 @@
        </vm:body>
      </vm:page>
      </v:page>
-<?vsp WV.WIKI.VSPFOOTER (path,params,lines);
-
+  <?vsp
+    WV.WIKI.VSPFOOTER (path,params,lines);
 ?>
diff --git a/appsrc/ODS-Wiki/http/owiki.css b/appsrc/ODS-Wiki/http/owiki.css
index 1fd4835..ba7647d 100644
--- a/appsrc/ODS-Wiki/http/owiki.css
+++ b/appsrc/ODS-Wiki/http/owiki.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: owiki.css,v 1.3 2007/02/27 21:19:46 source Exp $
+ *  $Id: owiki.css,v 1.3.2.1 2010/09/20 10:15:52 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Wiki/http/permissions.vspx b/appsrc/ODS-Wiki/http/permissions.vspx
index 9ca1252..bbf0ad9 100644
--- a/appsrc/ODS-Wiki/http/permissions.vspx
+++ b/appsrc/ODS-Wiki/http/permissions.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: permissions.vspx,v 1.4 2006/08/14 14:33:16 source Exp $
+ -  $Id: permissions.vspx,v 1.4.2.1 2010/09/20 10:15:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/redirect.vsp b/appsrc/ODS-Wiki/http/redirect.vsp
index fa3e397..ac8516a 100644
--- a/appsrc/ODS-Wiki/http/redirect.vsp
+++ b/appsrc/ODS-Wiki/http/redirect.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: redirect.vsp,v 1.4 2006/10/18 21:26:35 source Exp $
+--  $Id: redirect.vsp,v 1.4.2.1 2010/09/20 10:15:52 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/http/remove_tag.vspx b/appsrc/ODS-Wiki/http/remove_tag.vspx
index 5b61a6b..f2c8eae 100644
--- a/appsrc/ODS-Wiki/http/remove_tag.vspx
+++ b/appsrc/ODS-Wiki/http/remove_tag.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -  
- -  $Id: remove_tag.vspx,v 1.1 2007/02/27 21:19:46 source Exp $
+ -  $Id: remove_tag.vspx,v 1.1.2.1 2010/09/20 10:15:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/revision_delete.vspx b/appsrc/ODS-Wiki/http/revision_delete.vspx
index d70b0a8..6dc649a 100644
--- a/appsrc/ODS-Wiki/http/revision_delete.vspx
+++ b/appsrc/ODS-Wiki/http/revision_delete.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: revision_delete.vspx,v 1.5 2008/04/17 09:07:09 source Exp $
+ -  $Id: revision_delete.vspx,v 1.5.2.1 2010/09/20 10:15:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/revision_rollback.vspx b/appsrc/ODS-Wiki/http/revision_rollback.vspx
index 7da808c..6f51a7f 100644
--- a/appsrc/ODS-Wiki/http/revision_rollback.vspx
+++ b/appsrc/ODS-Wiki/http/revision_rollback.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: revision_rollback.vspx,v 1.6 2008/04/17 09:07:09 source Exp $
+ -  $Id: revision_rollback.vspx,v 1.6.2.1 2010/09/20 10:15:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/search.vsp b/appsrc/ODS-Wiki/http/search.vsp
index db37310..36b67ed 100644
--- a/appsrc/ODS-Wiki/http/search.vsp
+++ b/appsrc/ODS-Wiki/http/search.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: search.vsp,v 1.3 2006/07/31 15:35:29 source Exp $
+--  $Id: search.vsp,v 1.3.2.1 2010/09/20 10:15:52 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/http/search.vspx b/appsrc/ODS-Wiki/http/search.vspx
index 7ebdf07..dadbc63 100644
--- a/appsrc/ODS-Wiki/http/search.vspx
+++ b/appsrc/ODS-Wiki/http/search.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: search.vspx,v 1.3 2006/08/14 14:33:16 source Exp $
+ -  $Id: search.vspx,v 1.3.2.1 2010/09/20 10:15:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/settings.vspx b/appsrc/ODS-Wiki/http/settings.vspx
index 2dcb0a9..611d79a 100644
--- a/appsrc/ODS-Wiki/http/settings.vspx
+++ b/appsrc/ODS-Wiki/http/settings.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: settings.vspx,v 1.17.2.1 2009/12/13 23:28:00 source Exp $
+ -  $Id: settings.vspx,v 1.17.2.3 2011/03/26 14:21:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -47,6 +47,7 @@
   <v:variable name="_cluster" type="integer"/>
     <v:variable name="new_topic_template" type="varchar" default="''" persist="0"/>
     <v:variable name="new_category_template" type="varchar" default="''" persist="0"/>
+  <v:variable name="skin_source" type="varchar" default="'Local'" persist="0"/>
     <v:variable name="skin2_vhost_regexp" type="varchar" default="''" persist="0"/>
     <v:variable name="sync_message" type="varchar" default="''"/>
   <v:variable name="enabled" type="varchar" default="'1'"/>
@@ -82,6 +83,9 @@
       self.index_page := WV.WIKI.CLUSTERPARAM (self.cluster_name, 'index-page', 'WelcomeVisitors');
       self.new_topic_template := WV.WIKI.CLUSTERPARAM (self.cluster_name, 'new-topic-template', '');
       self.new_category_template := WV.WIKI.CLUSTERPARAM (self.cluster_name, 'new-category-template', '');
+      self.skin_source := WV.WIKI.CLUSTERPARAM (self.cluster_name, 'skin-source', '');
+      if ((self.skin_source <> 'WebDAV') and (self.skin_source <> 'URL'))
+        self.skin_source := 'Local';
       self.skin2_vhost_regexp := WV.WIKI.CLUSTERPARAM (self.cluster_name, 'skin2-vhost-regexp', '');
 
                 if (self.delicious_enable is null)
@@ -195,15 +199,54 @@
             </td>
           </tr>
                       <tr>
+                        <th valign="top">Skin source:</th>
+                        <td>
+                          <label>
+                            <v:radio-button name="wiki_skin_source_0" xhtml_id="wiki_skin_source_0" group-name="wiki_skin_source" value="Local" xhtml_onchange="javascript: destinationChange(this, {show: [\'wiki_skin\', \'wiki_skin2\'], hide: [\'wiki_skin_text\', \'wiki_skin2_text\']});">
+                              <v:before-render>
+                                <![CDATA[
+                                  control.ufl_selected := either (equ (self.skin_source, 'Local'), 1, 0);
+                                ]]>
+                              </v:before-render>
+                            </v:radio-button>
+                            <b>Local</b>
+                          </label>
+                          <br />
+                          <label>
+                            <v:radio-button name="wiki_skin_source_1" xhtml_id="wiki_skin_source_1" group-name="wiki_skin_source" value="WebDAV" xhtml_onchange="javascript: destinationChange(this, {hide: [\'wiki_skin\', \'wiki_skin2\'], show: [\'wiki_skin_text\', \'wiki_skin2_text\']});">
+                              <v:before-render>
+                                <![CDATA[
+                                  control.ufl_selected := either (equ (self.skin_source, 'WebDAV'), 1, 0);
+                                ]]>
+                              </v:before-render>
+                            </v:radio-button>
+                            <b>WebDAV</b>
+                          </label>
+                          <br />
+                          <label>
+                            <v:radio-button name="wiki_skin_source_2" xhtml_id="wiki_skin_source_2" group-name="wiki_skin_source" value="URL" xhtml_onchange="javascript: destinationChange(this, {hide: [\'wiki_skin\', \'wiki_skin2\'], show: [\'wiki_skin_text\', \'wiki_skin2_text\']});">
+                              <v:before-render>
+                                <![CDATA[
+                                  control.ufl_selected := either (equ (self.skin_source, 'URL'), 1, 0);
+                                ]]>
+                              </v:before-render>
+                            </v:radio-button>
+                            <b>URL</b>
+                          </label>
+                        </td>
+                      </tr>
+                      <tr>
                         <th>Primary Skin:</th>
                         <td>
-                          <v:data-list name="wiki_skin" value="--"WV"."Wiki"."ClusterParam" (self.cluster_name, 'skin', 'default')" list-document="--self.skins" list-match="/skins/skin" list-key-path="." list-value-path="." xhtml_class="save1" />
+                          <v:data-list name="wiki_skin" xhtml_id="wiki_skin" value="--WV.Wiki.ClusterParam (self.cluster_name, 'skin', 'default')" list-document="--self.skins" list-match="/skins/skin" list-key-path="." list-value-path="." xhtml_class="save1" xhtml_style="--sprintf('display: %s;', case when (self.skin_source = 'Local') then '' else 'none' end)" />
+                          <v:text name="wiki_skin_text" xhtml_id="wiki_skin_text" format="%s" value="--WV.Wiki.ClusterParam (self.cluster_name, 'skin', '')" xhtml_class="save1" xhtml_style="--sprintf('display: %s;', case when (self.skin_source = 'Local') then 'none' else '' end)" />
                         </td>
                       </tr>
                       <tr>
                         <th>Secondary Skin:</th>
                         <td>
-                          <v:data-list name="wiki_skin_2" value="--"WV"."Wiki"."ClusterParam" (self.cluster_name, 'skin2', 'default')" list-document="--self.skins" list-match="/skins/skin" list-key-path="." list-value-path="." xhtml_title=" used when host matches the regular expression below " xhtml_class="save1" />
+                          <v:data-list name="wiki_skin2" xhtml_id="wiki_skin2" value="--WV.Wiki.ClusterParam (self.cluster_name, 'skin2', 'default')" list-document="--self.skins" list-match="/skins/skin" list-key-path="." list-value-path="." xhtml_title=" used when host matches the regular expression below " xhtml_class="save1" xhtml_style="--sprintf('display: %s;', case when (self.skin_source = 'Local') then '' else 'none' end)" />
+                          <v:text name="wiki_skin2_text" xhtml_id="wiki_skin2_text" format="%s" value="--WV.Wiki.ClusterParam (self.cluster_name, 'skin2', '')" xhtml_class="save1"  xhtml_style="--sprintf('display: %s;', case when (self.skin_source = 'Local') then 'none' else '' end)" />
                         </td>
                       </tr>
                       <tr>
@@ -230,13 +273,28 @@
                             <![CDATA[
                                 if (not self.vc_is_valid)
                                   return;
+
                                 WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'index-page', self.index_page_name.ufl_value);
+                                if (self.wiki_skin_source_0.ufl_selected)
+                                  WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'skin-source', 'Local');
+                                if (self.wiki_skin_source_1.ufl_selected)
+                                  WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'skin-source', 'WebDAV');
+                                if (self.wiki_skin_source_2.ufl_selected)
+                                  WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'skin-source', 'URL');
+                                if (self.wiki_skin_source_0.ufl_selected)
+                                {
                                 WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'skin', self.wiki_skin.ufl_value);
-                                WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'skin2', self.wiki_skin_2.ufl_value);
+                                  WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'skin2', self.wiki_skin2.ufl_value);
+                                } else {
+                                  WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'skin', self.wiki_skin_text.ufl_value);
+                                  WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'skin2', self.wiki_skin2_text.ufl_value);
+                                }
                                 if (WV.WIKI.TRIM(self.skin2_vhost_regexp_text.ufl_value) = '')
+                                {
                                   WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'skin2-vhost-regexp', NULL);
-                                else
+                                } else {
                                   WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'skin2-vhost-regexp', WV.WIKI.TRIM (self.skin2_vhost_regexp_text.ufl_value));
+                                }
                                 WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'plugin', self.wiki_plugin.ufl_value);
 
                               self.vc_data_bind (e);
@@ -296,9 +354,8 @@
                     	  <td colspan="2">
                     	    <?vsp
                             declare S varchar;
-                            S := '';
-                            if (self.delicious_enable = 1)
-                              S := 'checked="checked"';
+
+                            S := case when (self.delicious_enable = 1) then 'checked="checked"' else '' end;
                             http(sprintf('<input type="checkbox" name="cls3_delicioustoggle" id="cls3_delicioustoggle" value="1" %s onclick="deliciousToggle (this)" class="save3" />', S));
                           ?>
                           <vm:label for="cls3_delicioustoggle" value="Toggle Integration"/>
@@ -307,19 +364,19 @@
                       <tr id="delicious1">
                         <th>User Name:</th>
                         <td align="left">
-                          <v:text name="delicious_user" format="%s" value="--WV.Wiki.ClusterParam (self.cluster_name, 'delicious_user', '')" xhtml_class="save3" />
+                          <v:text name="delicious_user" format="%s" value="--WV.Wiki.ClusterParam (self.cluster_name, 'delicious_user', '')" xhtml_class="save1" />
                         </td>
                       </tr>
                       <tr id="delicious2">
                         <th>Password: <br/>(leave it empty to keep old password)</th>
                         <td align="left">
-                          <v:text type="password" name="delicious_passwd" xhtml_class="save3" />
+                          <v:text type="password" name="delicious_passwd" xhtml_class="save1" />
                         </td>
                       </tr>
                       <tr id="delicious3">
                         <th>Minimum of update interval: <br/>(in minutes)</th>
                         <td align="left">
-                          <v:text name="delicious_update_interval" value="--WV.Wiki.ClusterParam (self.cluster_name, 'delicious_update_interval', 600)/60" xhtml_class="save3">
+                          <v:text name="delicious_update_interval" value="--WV.Wiki.ClusterParam (self.cluster_name, 'delicious_update_interval', 600)/60" xhtml_class="save1">
                             <v:validator test="regexp" regexp="^[0-9]+$" message="Number is expected" runat="client"/>
                             <v:validator test="value" min="10" max="999999" empty-allowed="0" message="number greater than 10 and less than 999999 is expected" runat="client"/>
                           </v:text>
@@ -342,9 +399,8 @@
                       	  <td colspan="2">
                       	    <?vsp
                               declare S varchar;
-                              S := '';
-                              if (self.webmail_enable = 1)
-                                S := 'checked="checked"';
+
+                              S := case when (self.webmail_enable = 1) then 'checked="checked"' else '' end;
                               http(sprintf('<input type="checkbox" name="cls3_webmailtoggle" id="cls3_webmailtoggle" value="1" %s onclick="webmailToggle (this)" class="save3" />', S));
                             ?>
                             <vm:label for="cls3_webmailtoggle" value="Toggle integration"/>
@@ -353,7 +409,7 @@
                         <tr id="webmail1">
                           <th>E-mail Domain:</th>
 	    <td>
-                            <v:data-list name="webmail_domains" value="--WV.Wiki.ClusterParam (self.cluster_name, 'webmail_domain', 'domain.com')" list-document="--self.domains" list-match="/domains/domain" list-key-path="." list-value-path="." xhtml_class="save3" />
+                            <v:data-list name="webmail_domains" value="--WV.Wiki.ClusterParam (self.cluster_name, 'webmail_domain', 'domain.com')" list-document="--self.domains" list-match="/domains/domain" list-key-path="." list-value-path="." xhtml_class="save1" />
                           </td>
                         </tr>
                       </v:template>
@@ -372,7 +428,7 @@
                     <tr>
                         <th>E-mail Obfuscation:</th>
 		      <td>
-                          <v:data-list name="email_obfuscation" value="--WV.Wiki.ClusterParam (self.cluster_name, 'email-obfuscate', 'NONE')" list-document="--self.email_obfuscation_types" list-match="/email_obfuscation_types/type" list-key-path="." list-value-path="." xhtml_class="save3" />
+                          <v:data-list name="email_obfuscation" value="--WV.Wiki.ClusterParam (self.cluster_name, 'email-obfuscate', 'NONE')" list-document="--self.email_obfuscation_types" list-match="/email_obfuscation_types/type" list-key-path="." list-value-path="." xhtml_class="save1" />
 		      </td>
                     </tr>
                       <tr>
@@ -383,7 +439,7 @@
 	  <tr>
                         <th>API key (32 characters long):</th>
 	    <td>
-                          <v:text error-glyph="*" name="technorati_api_key_f" value="--self.technorati_api_key" xhtml_size="40" xhtml_class="save3">
+                          <v:text error-glyph="*" name="technorati_api_key_f" value="--self.technorati_api_key" xhtml_size="40" xhtml_class="save1">
                             <v:validator test="regexp" regexp="^[a-z0-9]{32}$|^[ ]*$" message="API key is expected" runat="client"/>
                           </v:text>
                         </td>
@@ -398,9 +454,8 @@
                     	  <td colspan="2">
                     	    <?vsp
                             declare S varchar;
-                            S := '';
-                            if (self.conv_enable = 1)
-                              S := 'checked="checked"';
+
+                            S := case when (self.conv_enable = 1) then 'checked="checked"' else '' end;
                             http (sprintf ('<input type="checkbox" name="cls3_conversationtoggle" id="cls3_conversationtoggle" value="1" %s class="save3" />', S));
                           ?>
                           <vm:label for="cls3_conversationtoggle" value="Toggle Discussion (NNTP Integration)"/>
@@ -430,10 +485,12 @@
                                 cluster_id := self._cluster;
                                 self.delicious_enable := cast (get_keyword ('cls3_delicioustoggle', e.ve_params, '2') as integer);
                                 WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'delicious_enabled', self.delicious_enable);
-                                if (self.delicious_enable = 1) {
+                                if (self.delicious_enable = 1)
+                                {
                                   WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'delicious_user', self.delicious_user.ufl_value);
                                   WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'delicious_update_interval', cast (self.delicious_update_interval.ufl_value as integer) * 60);
-                                  if (self.delicious_passwd.ufl_value is not null and self.delicious_passwd.ufl_value <> '') {
+                                  if (self.delicious_passwd.ufl_value is not null and self.delicious_passwd.ufl_value <> '')
+                                  {
                                     WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'delicious_digest', encode_base64 (self.delicious_user.ufl_value || ':' || self.delicious_passwd.ufl_value) );
                                     WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'delicious_password', self.delicious_passwd.ufl_value);
                                   }
@@ -442,8 +499,10 @@
                                 }
                                 self.webmail_enable := cast (get_keyword ('cls3_webmailtoggle', e.ve_params, '2') as integer);
                                 WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'webmail_enabled', self.webmail_enable);
-                                if (self.webmail_enable = 1) {
-                                  if (WV.WIKI.CLUSTERPARAM (self.cluster_name, 'webmail_initialized') is null) {
+                                if (self.webmail_enable = 1)
+                                {
+                                  if (WV.WIKI.CLUSTERPARAM (self.cluster_name, 'webmail_initialized') is null)
+                                  {
                                     DB.DBA.VAD_LOAD_SQL_FILE('/DAV/VAD/wiki/webmail.sql', 1, 'report', 1);
                                     WV.WIKI.SETCLUSTERPARAM (self.cluster_name, 'webmail_initialized', 1);
                                   }
@@ -531,25 +590,25 @@
                    <tr>
                                 <th>Name:</th>
                       <td>
-                                  <v:text name="upstream_name" value="--get_keyword ('name', self.defval, '')" xhtml_title=" if you change the name in edit mode, a new upstream will be added!" xhtml_class="save4" />
+                                  <v:text name="upstream_name" value="--get_keyword ('name', self.defval, '')" xhtml_title=" if you change the name in edit mode, a new upstream will be added!" xhtml_class="save1" />
                       </td>
                    </tr>
                               <tr>
                                 <th>URL:</th>
                                 <td>
-                                  <v:text name="upstream_url" value="--get_keyword ('uri', self.defval, '')" xhtml_class="save4" />
+                                  <v:text name="upstream_url" value="--get_keyword ('uri', self.defval, '')" xhtml_class="save1" />
                                 </td>
                               </tr>
                               <tr>
                                 <th>User:</th>
                                 <td>
-                                  <v:text name="upstream_user" value="--get_keyword ('user', self.defval, '')" xhtml_class="save4"/>
+                                  <v:text name="upstream_user" value="--get_keyword ('user', self.defval, '')" xhtml_class="save1"/>
                                 </td>
                               </tr>
                               <tr>
                                 <th>Password:</th>
                                 <td>
-                                  <v:text name="upstream_password" type="password" value="--get_keyword ('passwd', self.defval, '')" xhtml_class="save4" />
+                                  <v:text name="upstream_password" type="password" value="--get_keyword ('passwd', self.defval, '')" xhtml_class="save1" />
                                 </td>
                                   </tr>
                               <v:hidden name="id2" value="--get_keyword('id', self.defval)"/>
@@ -664,9 +723,8 @@
                     	    <br/>
                     	    <?vsp
                             declare S varchar;
-                            S := '';
-                            if (WV.WIKI.CLUSTERPARAM (self.cluster_name, 'syscalls', 2) = 1)
-                              S := 'checked="checked"';
+
+                            S := case when (WV.WIKI.CLUSTERPARAM (self.cluster_name, 'syscalls', 2) = 1) then 'checked="checked"' else '' end;
                             http(sprintf('<input type="checkbox" name="cls5_inlinemacros" id="cls5_inlinemacros" value="1" %s class="save5" />', S));
                           ?>
                           <vm:label for="cls5_inlinemacros" value="Inline Macros"/>
@@ -676,9 +734,8 @@
                     	  <td colspan="2">
                     	    <?vsp
                             declare S varchar;
-                            S := '';
-                            if (WV.WIKI.CLUSTERPARAM (self.cluster_name, 'qwiki', 2) = 2)
-                              S := 'checked="checked"';
+
+                            S := case when (WV.WIKI.CLUSTERPARAM (self.cluster_name, 'qwiki', 2) = 2) then 'checked="checked"' else '' end;
                             http(sprintf('<input type="checkbox" name="cls5_interlinks" id="cls5_interlinks" value="2" %s class="save5" />', S));
                           ?>
                           <vm:label for="cls5_interlinks" value="Inter Cluster Autolinks"/>
diff --git a/appsrc/ODS-Wiki/http/tag.vspx b/appsrc/ODS-Wiki/http/tag.vspx
index a5baf83..aef31cc 100644
--- a/appsrc/ODS-Wiki/http/tag.vspx
+++ b/appsrc/ODS-Wiki/http/tag.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: tag.vspx,v 1.6 2007/02/27 21:19:46 source Exp $
+ -  $Id: tag.vspx,v 1.6.2.1 2010/09/20 10:15:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/tags.vspx b/appsrc/ODS-Wiki/http/tags.vspx
index 7042cf6..a53b5d4 100644
--- a/appsrc/ODS-Wiki/http/tags.vspx
+++ b/appsrc/ODS-Wiki/http/tags.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: tags.vspx,v 1.7 2007/12/10 10:09:10 source Exp $
+ -  $Id: tags.vspx,v 1.7.2.1 2010/09/20 10:15:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -22,7 +22,7 @@
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  -
 -->
-<!-- $Id: tags.vspx,v 1.7 2007/12/10 10:09:10 source Exp $ -->
+<!-- $Id: tags.vspx,v 1.7.2.1 2010/09/20 10:15:53 source Exp $ -->
     <v:page 
 	  name="main" 
 	  style="comp.xsl"
diff --git a/appsrc/ODS-Wiki/http/template.xsl b/appsrc/ODS-Wiki/http/template.xsl
index afad577..42fcbc8 100644
--- a/appsrc/ODS-Wiki/http/template.xsl
+++ b/appsrc/ODS-Wiki/http/template.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
  -
- -  $Id: template.xsl,v 1.3 2007/08/06 09:33:04 source Exp $
+ -  $Id: template.xsl,v 1.3.2.1 2010/09/20 10:15:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/toolbar.vspx b/appsrc/ODS-Wiki/http/toolbar.vspx
index 4394b3f..79bc1d5 100644
--- a/appsrc/ODS-Wiki/http/toolbar.vspx
+++ b/appsrc/ODS-Wiki/http/toolbar.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: toolbar.vspx,v 1.3 2006/08/14 14:33:16 source Exp $
+ -  $Id: toolbar.vspx,v 1.3.2.1 2010/09/20 10:15:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/wiki_decor.vspx b/appsrc/ODS-Wiki/http/wiki_decor.vspx
index bf1c32a..fcf5e1f 100644
--- a/appsrc/ODS-Wiki/http/wiki_decor.vspx
+++ b/appsrc/ODS-Wiki/http/wiki_decor.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: wiki_decor.vspx,v 1.3 2006/08/14 14:33:16 source Exp $
+ -  $Id: wiki_decor.vspx,v 1.3.2.1 2010/09/20 10:15:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/appsrc/ODS-Wiki/http/wiki_style.xsl b/appsrc/ODS-Wiki/http/wiki_style.xsl
index dfa057b..64b8ef5 100644
--- a/appsrc/ODS-Wiki/http/wiki_style.xsl
+++ b/appsrc/ODS-Wiki/http/wiki_style.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1" ?>
 <!--
  -
- -  $Id: wiki_style.xsl,v 1.2.2.2 2010/01/07 16:57:09 source Exp $
+ -  $Id: wiki_style.xsl,v 1.2.2.4 2011/02/03 10:26:17 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -107,7 +107,7 @@
                  </tr>
               </table>
          </table>
-	 <div class="copyright">Copyright &copy; 1998-2010 OpenLink Software</div>-->
+	 <div class="copyright">Copyright &copy; 1998-2011 OpenLink Software</div>-->
 	 <xsl:processing-instruction name="vsp">
 		declare ht_stat varchar;
 		ht_stat := http_request_status_get ();
diff --git a/appsrc/ODS-Wiki/http/wikiview.vsp b/appsrc/ODS-Wiki/http/wikiview.vsp
index eb26125..2f593a5 100644
--- a/appsrc/ODS-Wiki/http/wikiview.vsp
+++ b/appsrc/ODS-Wiki/http/wikiview.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: wikiview.vsp,v 1.3 2006/07/31 15:35:29 source Exp $
+--  $Id: wikiview.vsp,v 1.3.2.1 2010/09/20 10:15:53 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/js/wiki.js b/appsrc/ODS-Wiki/js/wiki.js
index 1c8004a..14cdb52 100644
--- a/appsrc/ODS-Wiki/js/wiki.js
+++ b/appsrc/ODS-Wiki/js/wiki.js
@@ -173,3 +173,37 @@ function checkPageLeave (form, tab)
   }
   return ret;
 }
+
+function destinationChange(obj, actions) {
+  if (!obj.checked)
+    return;
+  if (!actions)
+    return;
+  if (actions.hide) {
+    var a = actions.hide;
+    for ( var i = 0; i < a.length; i++) {
+      var o = $(a[i])
+      if (o) {
+        OAT.Dom.hide(o);
+      }
+    }
+  }
+  if (actions.show) {
+    var a = actions.show;
+    for ( var i = 0; i < a.length; i++) {
+      var o = $(a[i])
+      if (o) {
+        OAT.Dom.show(o);
+      }
+    }
+  }
+  if (actions.clear) {
+    var a = actions.clear;
+    for ( var i = 0; i < a.length; i++) {
+      var o = $(a[i])
+      if (o && o.value) {
+        o.value = '';
+      }
+    }
+  }
+}
diff --git a/appsrc/ODS-Wiki/make_vad.sh b/appsrc/ODS-Wiki/make_vad.sh
index b08728b..285d529 100755
--- a/appsrc/ODS-Wiki/make_vad.sh
+++ b/appsrc/ODS-Wiki/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.30.2.5 2010/03/15 15:49:34 source Exp $
+#  $Id: make_vad.sh,v 1.30.2.7 2011/02/03 10:26:16 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -255,7 +255,7 @@ sticker_init() {
   echo "  <name package=\"Wiki\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"ODS Wiki\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
diff --git a/appsrc/ODS-Wiki/plugin/Makefile.in b/appsrc/ODS-Wiki/plugin/Makefile.in
index db078af..a8bb96a 100644
--- a/appsrc/ODS-Wiki/plugin/Makefile.in
+++ b/appsrc/ODS-Wiki/plugin/Makefile.in
@@ -227,6 +227,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/appsrc/ODS-Wiki/plugin/creole_maclex.c b/appsrc/ODS-Wiki/plugin/creole_maclex.c
index 2c701bd..59a591d 100644
--- a/appsrc/ODS-Wiki/plugin/creole_maclex.c
+++ b/appsrc/ODS-Wiki/plugin/creole_maclex.c
@@ -503,7 +503,7 @@ char *creolemacyytext;
 #line 1 "./creole_maclex.l"
 #line 2 "./creole_maclex.l"
 /*
- *  $Id: creole_maclex.l,v 1.2 2009/03/18 23:49:58 source Exp $
+ *  $Id: creole_maclex.l,v 1.2.2.1 2010/09/20 10:15:53 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -687,7 +687,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( creolemacyytext, creolemacyyleng, 1, creolemacyyout )
+#define ECHO do { if (fwrite( creolemacyytext, creolemacyyleng, 1, creolemacyyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
diff --git a/appsrc/ODS-Wiki/plugin/creole_maclex.l b/appsrc/ODS-Wiki/plugin/creole_maclex.l
index 06c7cd4..b03d622 100644
--- a/appsrc/ODS-Wiki/plugin/creole_maclex.l
+++ b/appsrc/ODS-Wiki/plugin/creole_maclex.l
@@ -1,6 +1,6 @@
 %{
 /*
- *  $Id: creole_maclex.l,v 1.2 2009/03/18 23:49:58 source Exp $
+ *  $Id: creole_maclex.l,v 1.2.2.1 2010/09/20 10:15:53 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Wiki/plugin/creole_wikilex.c b/appsrc/ODS-Wiki/plugin/creole_wikilex.c
index b30dae9..2be8ff1 100644
--- a/appsrc/ODS-Wiki/plugin/creole_wikilex.c
+++ b/appsrc/ODS-Wiki/plugin/creole_wikilex.c
@@ -11459,7 +11459,7 @@ char *creolewikiyytext;
 #line 1 "./creole_wikilex.l"
 #line 2 "./creole_wikilex.l"
 /*
- *  $Id: creole_wikilex.l,v 1.4.2.1 2010/07/05 15:01:11 source Exp $
+ *  $Id: creole_wikilex.l,v 1.4.2.2 2010/09/20 10:15:53 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -12258,7 +12258,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( creolewikiyytext, creolewikiyyleng, 1, creolewikiyyout )
+#define ECHO do { if (fwrite( creolewikiyytext, creolewikiyyleng, 1, creolewikiyyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
diff --git a/appsrc/ODS-Wiki/plugin/creole_wikilex.l b/appsrc/ODS-Wiki/plugin/creole_wikilex.l
index 6bf42bb..ff7fad9 100644
--- a/appsrc/ODS-Wiki/plugin/creole_wikilex.l
+++ b/appsrc/ODS-Wiki/plugin/creole_wikilex.l
@@ -1,6 +1,6 @@
 %{
 /*
- *  $Id: creole_wikilex.l,v 1.4.2.1 2010/07/05 15:01:11 source Exp $
+ *  $Id: creole_wikilex.l,v 1.4.2.2 2010/09/20 10:15:53 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Wiki/plugin/maclex.c b/appsrc/ODS-Wiki/plugin/maclex.c
index 078dab0..7164dad 100644
--- a/appsrc/ODS-Wiki/plugin/maclex.c
+++ b/appsrc/ODS-Wiki/plugin/maclex.c
@@ -503,7 +503,7 @@ char *macyytext;
 #line 1 "./maclex.l"
 #line 2 "./maclex.l"
 /*
- *  $Id: maclex.l,v 1.4 2009/03/18 23:49:58 source Exp $
+ *  $Id: maclex.l,v 1.4.2.1 2010/09/20 10:15:53 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -687,7 +687,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( macyytext, macyyleng, 1, macyyout )
+#define ECHO do { if (fwrite( macyytext, macyyleng, 1, macyyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
diff --git a/appsrc/ODS-Wiki/plugin/maclex.l b/appsrc/ODS-Wiki/plugin/maclex.l
index 5c1f59c..8128586 100644
--- a/appsrc/ODS-Wiki/plugin/maclex.l
+++ b/appsrc/ODS-Wiki/plugin/maclex.l
@@ -1,6 +1,6 @@
 %{
 /*
- *  $Id: maclex.l,v 1.4 2009/03/18 23:49:58 source Exp $
+ *  $Id: maclex.l,v 1.4.2.1 2010/09/20 10:15:53 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Wiki/plugin/media_maclex.c b/appsrc/ODS-Wiki/plugin/media_maclex.c
index 1a0d05f..454c475 100644
--- a/appsrc/ODS-Wiki/plugin/media_maclex.c
+++ b/appsrc/ODS-Wiki/plugin/media_maclex.c
@@ -503,7 +503,7 @@ char *mediamacyytext;
 #line 1 "./media_maclex.l"
 #line 2 "./media_maclex.l"
 /*
- *  $Id: media_maclex.l,v 1.3 2009/03/18 23:49:58 source Exp $
+ *  $Id: media_maclex.l,v 1.3.2.1 2010/09/20 10:15:53 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -687,7 +687,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( mediamacyytext, mediamacyyleng, 1, mediamacyyout )
+#define ECHO do { if (fwrite( mediamacyytext, mediamacyyleng, 1, mediamacyyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
diff --git a/appsrc/ODS-Wiki/plugin/media_maclex.l b/appsrc/ODS-Wiki/plugin/media_maclex.l
index 4865c94..0d1591a 100644
--- a/appsrc/ODS-Wiki/plugin/media_maclex.l
+++ b/appsrc/ODS-Wiki/plugin/media_maclex.l
@@ -1,6 +1,6 @@
 %{
 /*
- *  $Id: media_maclex.l,v 1.3 2009/03/18 23:49:58 source Exp $
+ *  $Id: media_maclex.l,v 1.3.2.1 2010/09/20 10:15:53 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Wiki/plugin/media_wikilex.c b/appsrc/ODS-Wiki/plugin/media_wikilex.c
index 7f6f664..9639ee9 100644
--- a/appsrc/ODS-Wiki/plugin/media_wikilex.c
+++ b/appsrc/ODS-Wiki/plugin/media_wikilex.c
@@ -14450,7 +14450,7 @@ char *mediawikiyytext;
 #line 1 "./media_wikilex.l"
 #line 2 "./media_wikilex.l"
 /*
- *  $Id: media_wikilex.l,v 1.7.2.1 2010/07/05 15:01:11 source Exp $
+ *  $Id: media_wikilex.l,v 1.7.2.2 2010/09/20 10:15:54 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -15178,7 +15178,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( mediawikiyytext, mediawikiyyleng, 1, mediawikiyyout )
+#define ECHO do { if (fwrite( mediawikiyytext, mediawikiyyleng, 1, mediawikiyyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
diff --git a/appsrc/ODS-Wiki/plugin/media_wikilex.l b/appsrc/ODS-Wiki/plugin/media_wikilex.l
index 7e3a0f4..6139eee 100644
--- a/appsrc/ODS-Wiki/plugin/media_wikilex.l
+++ b/appsrc/ODS-Wiki/plugin/media_wikilex.l
@@ -1,6 +1,6 @@
 %{
 /*
- *  $Id: media_wikilex.l,v 1.7.2.1 2010/07/05 15:01:11 source Exp $
+ *  $Id: media_wikilex.l,v 1.7.2.2 2010/09/20 10:15:54 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Wiki/plugin/mediawiki.c b/appsrc/ODS-Wiki/plugin/mediawiki.c
index 0a46de6..640271d 100644
--- a/appsrc/ODS-Wiki/plugin/mediawiki.c
+++ b/appsrc/ODS-Wiki/plugin/mediawiki.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: mediawiki.c,v 1.5 2008/04/17 09:07:09 source Exp $
+ *  $Id: mediawiki.c,v 1.5.2.1 2010/09/20 10:15:54 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Wiki/plugin/wikilex.c b/appsrc/ODS-Wiki/plugin/wikilex.c
index b95f067..cfa6f28 100644
--- a/appsrc/ODS-Wiki/plugin/wikilex.c
+++ b/appsrc/ODS-Wiki/plugin/wikilex.c
@@ -11348,7 +11348,7 @@ char *wikiyytext;
 #line 1 "./wikilex.l"
 #line 2 "./wikilex.l"
 /*
- *  $Id: wikilex.l,v 1.15.2.1 2010/07/05 15:01:11 source Exp $
+ *  $Id: wikilex.l,v 1.15.2.2 2010/09/20 10:15:54 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -12025,7 +12025,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( wikiyytext, wikiyyleng, 1, wikiyyout )
+#define ECHO do { if (fwrite( wikiyytext, wikiyyleng, 1, wikiyyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
diff --git a/appsrc/ODS-Wiki/plugin/wikilex.l b/appsrc/ODS-Wiki/plugin/wikilex.l
index f83eb45..2a34ab9 100644
--- a/appsrc/ODS-Wiki/plugin/wikilex.l
+++ b/appsrc/ODS-Wiki/plugin/wikilex.l
@@ -1,6 +1,6 @@
 %{
 /*
- *  $Id: wikilex.l,v 1.15.2.1 2010/07/05 15:01:11 source Exp $
+ *  $Id: wikilex.l,v 1.15.2.2 2010/09/20 10:15:54 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Wiki/plugin/wikiv.c b/appsrc/ODS-Wiki/plugin/wikiv.c
index 5b335d9..3a64f6e 100644
--- a/appsrc/ODS-Wiki/plugin/wikiv.c
+++ b/appsrc/ODS-Wiki/plugin/wikiv.c
@@ -1,5 +1,5 @@
 /*
- * $Id: wikiv.c,v 1.6 2008/04/17 09:07:09 source Exp $
+ * $Id: wikiv.c,v 1.6.2.1 2010/09/20 10:15:54 source Exp $
  *  
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/appsrc/ODS-Wiki/plugins.sql b/appsrc/ODS-Wiki/plugins.sql
index 3e120c2..bf8b6e0 100644
--- a/appsrc/ODS-Wiki/plugins.sql
+++ b/appsrc/ODS-Wiki/plugins.sql
@@ -1,5 +1,5 @@
 --
---  $Id: plugins.sql,v 1.4 2008/01/30 11:58:56 source Exp $
+--  $Id: plugins.sql,v 1.4.2.1 2010/09/20 10:15:46 source Exp $
 --
 --  Atom publishing protocol support.
 --
diff --git a/appsrc/ODS-Wiki/postinstall.sql b/appsrc/ODS-Wiki/postinstall.sql
index 6a44a0b..1719446 100644
--- a/appsrc/ODS-Wiki/postinstall.sql
+++ b/appsrc/ODS-Wiki/postinstall.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: postinstall.sql,v 1.15 2008/01/21 15:35:02 source Exp $
+--  $Id: postinstall.sql,v 1.15.2.1 2010/09/20 10:15:46 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/proc_on.sql b/appsrc/ODS-Wiki/proc_on.sql
index 3b16ad1..89dd649 100644
--- a/appsrc/ODS-Wiki/proc_on.sql
+++ b/appsrc/ODS-Wiki/proc_on.sql
@@ -1,5 +1,5 @@
 --
---  $Id: proc_on.sql,v 1.44.2.6 2010/03/15 15:49:41 source Exp $
+--  $Id: proc_on.sql,v 1.44.2.13 2011/03/26 14:21:51 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -84,8 +84,8 @@ create method ti_xslt_vector (in params any) returns any for WV.WIKI.TOPICINFO
     'ti_attach_col_id_2'	, cast (self.ti_attach_col_id_2 as varchar),
     'ti_mod_time'		, cast (self.ti_mod_time as varchar),
     'ti_e_mail'			, cast (self.ti_e_mail as varchar),
-    'ti_rev_id'			, cast (self.ti_rev_id as varchar) );
---    'ti_entity'			, serialize_to_UTF8_xml (self.ti_get_entity (null, 0)) );
+    'ti_rev_id'      , cast (self.ti_rev_id as varchar)
+  );
   _res := vector_concat (_res, self.ti_env);
   if (params is not null)
     _res := vector_concat (_res, params);
@@ -155,12 +155,7 @@ create method ti_fill_cluster_by_id () returns any for WV.WIKI.TOPICINFO
 
 create method ti_find_id_by_local_name () returns any for WV.WIKI.TOPICINFO
 {
-  declare _colon, _dot integer;
-  declare _id integer;
-  self.ti_id := coalesce (
-    (select TopicId from WV.WIKI.TOPIC where LocalName = self.ti_local_name and ClusterId = self.ti_cluster_id),
-    (select TopicId from WV.WIKI.TOPIC where LocalName2 = self.ti_local_name and ClusterId = self.ti_cluster_id),
-    0 );
+  self.ti_id := coalesce ((select TopicId from WV.WIKI.TOPIC where LocalName = self.ti_local_name and ClusterId = self.ti_cluster_id), 0 );
 }
 ;
 
@@ -184,13 +179,15 @@ create method ti_find_id_by_raw_title () returns any for WV.WIKI.TOPICINFO
 
 create method ti_find_metadata_by_id () returns any for WV.WIKI.TOPICINFO
 {
-  for select top 1 ClusterId, ResId, ResXmlId, TopicTypeId, LocalName, LocalName2, TitleText, Abstract, MailBox, ParentId, AuthorId
-  from WV.WIKI.TOPIC where TopicId = self.ti_id do {
+  for (select top 1 ClusterId, ResId, ResXmlId, TopicTypeId, LocalName, TitleText, Abstract, MailBox, ParentId, AuthorId
+         from WV.WIKI.TOPIC
+        where TopicId = self.ti_id) do
+  {
     self.ti_cluster_id := ClusterId;
     self.ti_res_id := ResId;
     self.ti_type_id := TopicTypeId;
     self.ti_local_name := LocalName;
-    self.ti_local_name_2 := LocalName2;
+    self.ti_local_name_2 := LocalName;
     self.ti_title_text := TitleText;
     self.ti_abstract := Abstract;
     self.ti_e_mail := MailBox;
@@ -201,12 +198,9 @@ create method ti_find_metadata_by_id () returns any for WV.WIKI.TOPICINFO
   if (self.ti_abstract is null)
     self.ti_abstract := (select WAI_DESCRIPTION from DB.DBA.WA_INSTANCE where WAI_TYPE_NAME = 'oWiki' and WAI_NAME = self.ti_cluster_name);
 
-
-  --dbg_obj_print ('after:',self.ti_rev_id);
-  
   declare _mod_time datetime;
   declare _author varchar; 
-  declare _author_id int;
+  declare _author_id integer;
 
   declare _dav_auth, _dav_pwd varchar;
   WV.WIKI.GETDAVAUTH (_dav_auth, _dav_pwd);
@@ -215,7 +209,7 @@ create method ti_find_metadata_by_id () returns any for WV.WIKI.TOPICINFO
     {
       declare content, type varchar;
       declare path varchar;
-      declare author_id int;
+      declare author_id integer;
       if (self.ti_rev_id <> 0)
 	{
 	  path := DB.DBA.DAV_SEARCH_PATH (self.ti_col_id, 'C') || 'VVC/' || self.ti_local_name || '.txt/' ||
@@ -238,12 +232,11 @@ create method ti_find_metadata_by_id () returns any for WV.WIKI.TOPICINFO
           self.ti_text := cast (content as varchar);
         }
       else
+      {
         WV.WIKI.APPSIGNAL (11001, 'Can not get topic content (revision: ' || case when self.ti_rev_id = 0 then 'last' else cast (self.ti_rev_id as varchar) end || ')',  vector () );
-	  --dbg_obj_print ('xxx 2');	
+      }
       self.ti_mod_time := DAV_HIDE_ERROR (DAV_PROP_GET (path, ':getlastmodified', _dav_auth, _dav_pwd));
-	  --dbg_obj_print ('xxx y', self.ti_author_id);	
       self.ti_author := coalesce ( 
-	-- (select AuthorName from WV.WIKI.TOPIC where ResId = self.ti_res_id), 
 	(select UserName from WV.WIKI.USERS where UserId = self.ti_author_id), 
 	WV.WIKI.USER_WIKI_NAME_2(self.ti_author_id), 
 	'Unknown');
@@ -262,10 +255,13 @@ create method ti_find_metadata_by_id () returns any for WV.WIKI.TOPICINFO
 
 create method ti_find_metadata_by_res_id () returns any for WV.WIKI.TOPICINFO
 {
-  declare _topic_id int;
+  declare _topic_id integer;
+
   _topic_id := (select TopicId from WV.WIKI.TOPIC where ResId = self.ti_res_id);
   if (_topic_id is null)
+  {
     self.ti_id := 0;
+  }
   else
     {
       self.ti_id := _topic_id;
@@ -308,7 +304,7 @@ create method ti_run_lexer (in _env any) returns varchar for WV.WIKI.TOPICINFO
 }
 ;
 
-create method ti_get_entity (in _env any, in _ext int) returns any for WV.WIKI.TOPICINFO
+create method ti_get_entity (in _env any, in _ext integer) returns any for WV.WIKI.TOPICINFO
 {
 
   --dbg_obj_print ('get_entity');
@@ -372,7 +368,7 @@ create method ti_compile_page () returns any for WV.WIKI.TOPICINFO
   declare _ent any;
   declare _abstract nvarchar;
   declare _diskdumpdir any; -- Name of directory to dump pages; for debugging purposes.
-  declare dosioc int;
+  declare dosioc integer;
   
   if (exists (select top 1 1 from DB.DBA.WA_INSTANCE
      where WAI_TYPE_NAME = 'oWiki' and WAI_NAME = self.ti_cluster_name and WAI_IS_PUBLIC = 1))
@@ -390,31 +386,20 @@ create method ti_compile_page () returns any for WV.WIKI.TOPICINFO
         concat (_diskdumpdir, '/', self.ti_cluster_name, '/', self.ti_local_name, '.txt'),
         coalesce (self.ti_text, ''), -2);
     }
-  --dbg_obj_print ('ti_compile_page 2');
-
   if (self.ti_author_id is null or 0 = self.ti_author_id)
     self.ti_author_id := coalesce ((select U_ID from DB.DBA.SYS_USERS where U_NAME=connection_get ('vspx_user')), http_dav_uid());
   if (dosioc)
     sioc..wiki_sioc_post (self);
 
-  self.ti_local_name_2 := WV.WIKI.SINGULARPLURAL (self.ti_local_name);
-  --dbg_obj_print ('ti_compile_page 3');
-
+  self.ti_local_name_2 := self.ti_local_name;
   self.ti_curuser_wikiname := 'WikiGuest';
-  --dbg_obj_print ('ti_compile_page 4');
   self.ti_curuser_username := 'WikiGuest';
-  --dbg_obj_print ('ti_compile_page 5');
   self.ti_base_adjust := '';
-  --dbg_obj_print ('ti_compile_page 6');
   _ent := self.ti_get_entity (null,1);
-  --dbg_obj_print ('ti_compile_page 7', _ent);
   _abstract := xpath_eval ('string(//abstract)', _ent);
-  --dbg_obj_print ('ti_compile_page 8');
   if (_abstract = N'')
     _abstract := null;
-  --dbg_obj_print ('ti_compile_page 9');
   
-  --dbg_obj_print ('ti_compile_page 4444');
   delete from WV.WIKI.TOPIC where TopicId = self.ti_id;
   insert into WV.WIKI.TOPIC (TopicId, ClusterId, ResId, LocalName, LocalName2, Abstract, MailBox)
   values (self.ti_id, self.ti_cluster_id, self.ti_res_id, self.ti_local_name, self.ti_local_name_2, _abstract, self.ti_e_mail);
@@ -512,9 +497,11 @@ create method ti_compile_page () returns any for WV.WIKI.TOPICINFO
 	  }
 	_ctr := _ctr + 1;
       }
-    update WV.WIKI.LINK set DestId = self.ti_id
-    where DestId = 0 and DestClusterName = self.ti_cluster_name and
-      (DestLocalName = self.ti_local_name or DestLocalName = self.ti_local_name_2 );
+    update WV.WIKI.LINK
+       set DestId = self.ti_id
+     where DestId = 0
+       and DestClusterName = self.ti_cluster_name
+       and DestLocalName = self.ti_local_name;
 
     if ((_categories <> '') and
 	(WV.WIKI.CLUSTERPARAM (self.ti_cluster_id, 'delicious_enabled', 2) = 1))
@@ -603,14 +590,14 @@ create function WA_SEARCH_WIKI_GET_EXCERPT_HTML (in _current_user_id integer, in
 }
 ;
 
-create procedure WA_SEARCH_DAV_OR_WIKI_GET_EXCERPT_HTML
-	(in current_user_id int,
-	 in RES_ID int,
+create procedure WA_SEARCH_DAV_OR_WIKI_GET_EXCERPT_HTML (
+   in current_user_id integer,
+   in RES_ID integer,
 	 in _WORDS_VECTOR any,
 	 in RES_CONTENT any,
 	 in RES_FULL_PATH varchar,
-	 in RES_OWNER int,
-	 in RES_COL int)
+   in RES_OWNER integer,
+   in RES_COL integer)
 {
   if (exists (select 1 from WV.WIKI.CLUSTERS where ColId = RES_COL))
     return WA_SEARCH_WIKI_GET_EXCERPT_HTML (current_user_id, RES_ID, _WORDS_VECTOR, RES_CONTENT, RES_FULL_PATH, RES_OWNER);
@@ -623,7 +610,7 @@ create procedure WA_SEARCH_DAV_OR_WIKI_GET_EXCERPT_HTML
 create procedure WV.WIKI.UPDATE_LINKS (
 	in _topic WV.WIKI.TOPICINFO,
 	in _links any,
-	in _type int) -- 0 - WikiWord, 1 - Qualified WW, 2 - forcedlink
+  in _type integer) -- 0 - WikiWord, 1 - Qualified WW, 2 - forcedlink
 {
   foreach (any _a in _links) do
     {
@@ -636,7 +623,7 @@ create procedure WV.WIKI.UPDATE_LINKS (
 create procedure WV.WIKI.UPDATE_LINK_1 (
 	in _topic WV.WIKI.TOPICINFO,
 	in _href varchar,
-	in _type int) -- 0 - WikiWord, 1 - Qualified WW, 2 - forcedlink
+  in _type integer) -- 0 - WikiWord, 1 - Qualified WW, 2 - forcedlink
 {
   declare _cluster varchar;
   declare _local_name varchar;
@@ -676,7 +663,7 @@ create procedure WV.WIKI.UPDATE_LINK_1 (
 ;
   	
  
-create function WV.WIKI.POSTPROCESS_LINKS (in _cluster_id int)
+create function WV.WIKI.POSTPROCESS_LINKS (in _cluster_id integer)
 {
   for select LinkId as _link_id, c.ClusterId as DestClusterId, 
   	DestLocalName, t.LocalName as FromLocalName,
@@ -705,7 +692,7 @@ create function WV.WIKI.POSTPROCESS_LINKS (in _cluster_id int)
 
 -- _res_is_vect means result in vector
 -- _total - number of version in report, 0 means not such constraint
-create method ti_revisions(in _res_is_vect int, in _total int) returns any for WV.WIKI.TOPICINFO
+create method ti_revisions(in _res_is_vect integer, in _total integer) returns any for WV.WIKI.TOPICINFO
 {
   declare exit handler for sqlstate '*' {
     --dbg_obj_print (__SQL_STATE, __SQL_MESSAGE);
@@ -720,14 +707,14 @@ create method ti_revisions(in _res_is_vect int, in _total int) returns any for W
     _res := XMLELEMENT ('Versions');
   path := DB.DBA.DAV_SEARCH_PATH (self.ti_col_id, 'C') || 'VVC/' || self.ti_local_name || '.txt/';
   revs := DB.DBA.DAV_DIR_LIST (path, 0, 'dav', (select pwd_magic_calc (U_NAME, U_PWD, 1) from WS.WS.SYS_DAV_USER where U_ID = http_dav_uid()));
-  declare _max, _min int;
+  declare _max, _min integer;
   _max := 0;
   _min := -1;
   if (isarray (revs))
     {
       if (not _res_is_vect)
         _ent := xpath_eval ('/Versions', _res);
-      declare idx int;
+      declare idx integer;
       for (idx := length (revs) - 1 ; idx >= 0; idx:=idx - 1)
         {	
 	  declare _file any;
@@ -738,7 +725,7 @@ create method ti_revisions(in _res_is_vect int, in _total int) returns any for W
 	      	   ( aref (_file, 10) <> 'last' ) and
 		   ( aref (_file, 10) not like '%.diff') )
 	        {
-		  declare _num int;
+      declare _num integer;
 		  _num := atoi (aref (_file, 10));
 		  if (_min < 0)
 		    _min := _num;
@@ -759,7 +746,7 @@ create method ti_revisions(in _res_is_vect int, in _total int) returns any for W
   	{
 	  for (idx := _min; idx <= _max; idx := idx + 1)
 	    {
-	      declare _i int;
+        declare _i integer;
 	      _i := idx;
 	      if (_res_is_vect)
 	        vectorbld_acc (_res, cast (_i as varchar));
@@ -826,7 +813,7 @@ create method ti_report_mails () returns any for WV.WIKI.TOPICINFO
 }
 ;
 
-create procedure WV.WIKI.DOTREEPARENT (in _topic_id int, in _ent any, in depth int)
+create procedure WV.WIKI.DOTREEPARENT (in _topic_id integer, in _ent any, in depth integer)
 {
   if (depth > WV.WIKI.MAXPARENTDEPTH())
     return _ent;
@@ -940,7 +927,7 @@ create method ti_get_tags () for WV.WIKI.TOPICINFO
   }
   ;
   declare _tags any;
-  declare _nobody_uid, _curr_uid int;
+  declare _nobody_uid, _curr_uid integer;
   --dbg_obj_print ('get_tags 1');
   _nobody_uid := (select U_ID from DB.DBA.SYS_USERS where U_NAME = 'nobody');
   --dbg_obj_print ('get_tags 2');
@@ -974,97 +961,169 @@ create method ti_get_tags () for WV.WIKI.TOPICINFO
 }
 ;
 
-
 -- Triggers
-
-create trigger "Wiki_ClusterInsert" after insert on WS.WS.SYS_DAV_PROP order 100 referencing new as N
+create trigger "Wiki_ClusterDeleteContent" before delete on WV.WIKI.CLUSTERS referencing old as O
+{
+  declare exit handler for sqlstate '*'
 {
-  declare exit handler for sqlstate '*' {
  	resignal;
   }; 
-  declare _cname varchar;
-  declare _src_col integer;
-  declare _owner integer;
-  declare _group integer;
-  if (N.PROP_NAME = 'WikiCluster')
-    {
-      _cname := N.PROP_VALUE;
-      _src_col := N.PROP_PARENT_ID;
-      select COL_OWNER, COL_GROUP into _owner, _group from WS.WS.SYS_DAV_COL where COL_ID = _src_col;
-      if (_group is null)
-	_group := WV.WIKI.WIKIADMINGID();
-      WV.WIKI.CREATECLUSTER (_cname, _src_col, _owner, _group);
-    }
+  DB.DBA.DAV_DELETE (WS.WS.COL_PATH(O.ColId), 1, 'dav', (select pwd_magic_calc (U_NAME, U_PWD, 1) from WS.WS.SYS_DAV_USER where U_ID = http_dav_uid()));
+  delete from WA_INSTANCE where WAI_TYPE_NAME = 'oWiki' and (WAI_INST as wa_wikiv).cluster_id = O.ClusterId;
+  delete from WV.WIKI.CLUSTERSETTINGS where ClusterId = O.ClusterId;
+  delete from WA_MEMBER where WAM_APP_TYPE = 'oWiki' and WAM_INST = O.ClusterName;
+  WV.WIKI.USERROLE_DROP(O.ClusterName || 'Readers');
+  WV.WIKI.USERROLE_DROP(O.ClusterName || 'Writers');
+  DB.DBA.VHOST_REMOVE(lpath=>'/wiki/' || O.ClusterName);
 }
 ;
 
-create trigger "Wiki_ClusterDelete" before delete on WS.WS.SYS_DAV_PROP order 100 referencing old as O
-{
-  declare exit handler for sqlstate '*' {
- 	resignal;
-  }; 
-  if (O.PROP_NAME = 'WikiCluster')
+create procedure WV.WIKI.SIOC_ADD_ATTACHMENT (inout _topic WV.WIKI.TOPICINFO, in att varchar)
     {
-      for select ClusterId as _cid, ColId as _col_id from WV.WIKI.CLUSTERS where ClusterName = O.PROP_VALUE or ColId = O.PROP_PARENT_ID do {
-	  DeleteCluster (_cid);
-	}
-    }  
+   sioc..wiki_sioc_attachment (_topic, att);
 }
 ;
 
-create trigger "Wiki_ClusterDeleteContent" before delete on WV.WIKI.CLUSTERS referencing old as O
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_ClusterInsert')
+;
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_ClusterUpdate')
+;
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_ClusterDelete')
+;
+
+-- new triggers
+wiki_exec_no_error ('drop trigger WS.WS.WIKI_SYS_DAV_PROP_AI')
+;
+create trigger "WIKI_SYS_DAV_PROP_AI" after insert on WS.WS.SYS_DAV_PROP order 100 referencing new as N
 {
   declare exit handler for sqlstate '*' {
  	resignal;
   }; 
-  DB.DBA.DAV_DELETE (WS.WS.COL_PATH(O.ColId), 1, 'dav', (select pwd_magic_calc (U_NAME, U_PWD, 1) from WS.WS.SYS_DAV_USER where U_ID = http_dav_uid()));
-  delete from WA_INSTANCE where WAI_TYPE_NAME = 'oWiki' and (WAI_INST as wa_wikiv).cluster_id = O.ClusterId;
-  delete from WV.WIKI.CLUSTERSETTINGS where ClusterId = O.ClusterId;
-  delete from WA_MEMBER where WAM_APP_TYPE = 'oWiki' and WAM_INST = O.ClusterName;
-  WV.WIKI.USERROLE_DROP(O.ClusterName || 'Readers');
-  WV.WIKI.USERROLE_DROP(O.ClusterName || 'Writers');
-  DB.DBA.VHOST_REMOVE(lpath=>'/wiki/' || O.ClusterName);
+
+  if ((N.PROP_NAME <> 'WikiCluster') or (N.PROP_TYPE <> 'C'))
+    return;
+
+  for (select COL_OWNER, COL_GROUP from WS.WS.SYS_DAV_COL where COL_ID = N.PROP_PARENT_ID) do
+    WV.WIKI.CREATECLUSTER (N.PROP_VALUE, N.PROP_PARENT_ID, COL_OWNER, coalesce (COL_GROUP, WV.WIKI.WIKIADMINGID()));
 }
 ;
 
+wiki_exec_no_error ('drop trigger WS.WS.WIKI_SYS_DAV_PROP_BU')
+;
+create trigger "WIKI_SYS_DAV_PROP_BU" before update on WS.WS.SYS_DAV_PROP order 100 referencing old as O, new as N
+{
+  if ((O.PROP_NAME = 'WikiCluster' or N.PROP_NAME = 'WikiCluster') and (N.PROP_TYPE = 'C'))
+    WV.WIKI.APPSIGNAL (11001, 'Cluster "&ClusterName;" can not be changed by updating DAV property WikiCluster', vector ('ClusterName', O.PROP_VALUE));
+}
+;
 
-create trigger "Wiki_ClusterUpdate" before update on WS.WS.SYS_DAV_PROP order 100 referencing old as O, new as N
+wiki_exec_no_error ('drop trigger WS.WS.WIKI_SYS_DAV_PROP_BD')
+;
+create trigger "WIKI_SYS_DAV_PROP_BD" before delete on WS.WS.SYS_DAV_PROP order 100 referencing old as O
 {
-  if (O.PROP_NAME = 'WikiCluster' or N.PROP_NAME = 'WikiCluster')
+  declare exit handler for sqlstate '*'
     {
-      WV.WIKI.APPSIGNAL (11001, 'Cluster "&ClusterName;" can not be changed by updating DAV property WikiCluster',
-	 vector ('ClusterName', O.PROP_VALUE) );
-    }
+    resignal;
+  };
+
+  if ((O.PROP_NAME <> 'WikiCluster') or (O.PROP_TYPE <> 'C'))
+    return;
+
+  for (select ClusterId from WV.WIKI.CLUSTERS where ClusterName = O.PROP_VALUE or ColId = O.PROP_PARENT_ID) do
+    DeleteCluster (ClusterId);
 }
 ;
 
-create trigger "Wiki_TopicTextInsertPerms" after insert on WS.WS.SYS_DAV_RES order 999 referencing new as N
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_TopicTextInsertMeta')
+;
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_TopicTextInsert')
+;
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_TopicTextInsertPerms')
+;
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_TopicTextAttachment')
+;
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_TopicTextSparql_AI')
+;
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_TopicTextUpdate')
+;
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_TopicTextUpdatePerms')
+;
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_TopicTextSparql_AU')
+;
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_TopicTextDelete')
+;
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_TopicTextAttachment_D')
+;
+wiki_exec_no_error ('drop trigger WS.WS.Wiki_AttachmentDelete')
+;
+
+-- new triggers
+wiki_exec_no_error ('drop trigger WS.WS.WIKI_SYS_DAV_RES_AI')
+;
+create trigger "WIKI_SYS_DAV_RES_AI" after insert on WS.WS.SYS_DAV_RES order 1 referencing new as N
 {
+  declare _id any;
   declare _cluster_name varchar;
-  _cluster_name :=  (select ClusterName from WV.WIKI.TOPIC natural join WV.WIKI.CLUSTERS
-	where ResId = N.RES_ID);
-  if (_cluster_name is null)
+  declare _topic WV.WIKI.TOPICINFO;
+  declare exit handler for sqlstate '*'
+  {
+    -- dbg_obj_princ (__SQL_STATE, __SQL_MESSAGE);
+    rollback work;
    return;
+  };
 
+  _cluster_name := (select ClusterName from WV.WIKI.CLUSTERS where ColId = N.RES_COL);
+  if (not isnull (_cluster_name))
+  {
+    if (N.RES_NAME like '%.txt')
+    {
+      -- Topic Insert
+      _topic := WV.WIKI.TOPICINFO ();
+      _topic.ti_cluster_name := _cluster_name;
+      _topic.ti_fill_cluster_by_name ();
+      _topic.ti_id := WV.WIKI.NEWPLAINTOPICID ();
+      _topic.ti_res_id := N.RES_ID;
+      _topic.ti_default_cluster := _cluster_name;
+      _topic.ti_local_name := WV.WIKI.FILENAMETOWIKINAME (cast (N.RES_NAME as varchar));
+      _topic.ti_text := cast (N.RES_CONTENT as varchar);
+      _topic.ti_e_mail := WV.WIKI.MAILBOXFORTOPICNEW (_topic.ti_id, _cluster_name, _topic.ti_local_name);
+      _topic.ti_compile_page ();
+      _topic.ti_register_for_upstream('I');
+      WV..ADD_HIST_ENTRY (_topic.ti_cluster_name, _topic.ti_local_name, 'N', '1.0');
+
+      if (exists (select * from DB.DBA.WA_MEMBER where WAM_INST = _topic.ti_cluster_name and WAM_APP_TYPE = 'oWiki' and WAM_IS_PUBLIC = 1) and __proc_exists ('DB.DBA.WA_NEW_WIKI_IN'))
+      {
+        for (select U_FULL_NAME, U_NAME from DB.DBA.SYS_USERS where U_ID = N.RES_OWNER) do
+        {
+          _topic.ti_fill_url();
+          DB.DBA.WA_NEW_WIKI_IN (WV.WIKI.NORMALIZEWIKIWORDLINK (_topic.ti_cluster_name, _topic.ti_local_name), _topic.ti_url || '?', _topic.ti_id);
+          insert into WV.WIKI.DASHBOARD (WD_TIME, WD_TITLE, WD_UNAME, WD_UID, WD_URL)
+            values (now(), subseq (_topic.ti_text, 0, 200), U_FULL_NAME, U_NAME, _topic.ti_url || '?');
+        }
+      }
+
+      -- Topic Update Permissions
   SET TRIGGERS OFF;
   WV.WIKI.UPDATEGRANTS_FOR_RES_OR_COL ( _cluster_name, N.RES_ID, 'R');
   SET TRIGGERS ON;
-}
-;
 
+      -- Topic Sparql
+      if (N.RES_TYPE = 'application/sparql-query')
+        WV.WIKI.TopicTextSparql (N.RES_COL, N.RES_FULL_PATH, N.RES_OWNER);
+    }
+  }
 
-create trigger "Wiki_TopicTextAttachment" after insert on WS.WS.SYS_DAV_RES order 999 referencing new as N
-{
-  declare _id any;
+  -- attachment
   _id :=  DB.DBA.DAV_HIDE_ERROR (DB.DBA.DAV_PROP_GET_INT(N.RES_COL, 'C', 'oWiki:topic-id', 0));
-  if (_id is not null)
+  if (not isnull(_id))
     {
-      _id := deserialize (_id);
       declare _topic WV.WIKI.TOPICINFO;
+
       _topic := WV.WIKI.TOPICINFO();
-      _topic.ti_id := _id;
+    _topic.ti_id := deserialize (_id);
       _topic.ti_find_metadata_by_id ();
-      if (_topic.ti_res_id) {
+    if (_topic.ti_res_id)
+    {
         WV.WIKI.SIOC_ADD_ATTACHMENT (_topic, N.RES_NAME);
         WV..ADD_HIST_ENTRY(_topic.ti_cluster_name, _topic.ti_local_name, 'A', N.RES_NAME);
       }
@@ -1072,129 +1131,83 @@ create trigger "Wiki_TopicTextAttachment" after insert on WS.WS.SYS_DAV_RES orde
 }
 ;
 
-create procedure WV.WIKI.SIOC_ADD_ATTACHMENT (inout _topic WV.WIKI.TOPICINFO, in att varchar)
-    {
-      sioc..wiki_sioc_attachment (_topic, att);
-    }
+wiki_exec_no_error ('drop trigger WS.WS.WIKI_SYS_DAV_RES_AU')
 ;
+create trigger "WIKI_SYS_DAV_RES_AU" after update on WS.WS.SYS_DAV_RES order 1 referencing old as O, new as N
+{
+  declare _id integer;
+  declare _cluster_name, _local_name varchar;
+  declare _topic WV.WIKI.TOPICINFO;
+  declare exit handler for sqlstate '*'
+  {
+    --dbg_obj_princ (__SQL_STATE, __SQL_MESSAGE);
+    resignal;
+  };
+  if (N.RES_NAME like '%.txt')
+  {
+    _id := coalesce ((select TopicId from WV.WIKI.TOPIC where ResId = O.RES_ID), 0);
+    if (((O.RES_ID <> N.RES_ID) or (O.RES_COL <> N.RES_COL)) and (_id <> 0))
+      WV.WIKI.DELETETOPIC (_id);
 
-create trigger "Wiki_TopicTextAttachment_D" before delete on WS.WS.SYS_DAV_RES order 10 referencing old as O
+    _cluster_name := (select ClusterName from WV.WIKI.CLUSTERS where ColId = N.RES_COL);
+    if (not isnull (_cluster_name))
 {
-  declare _id any;
-  _id :=  DB.DBA.DAV_HIDE_ERROR (DB.DBA.DAV_PROP_GET_INT(O.RES_COL, 'C', 'oWiki:topic-id', 0));
-  if (_id is not null)
+      if (O.RES_CONTENT <> N.RES_CONTENT)
     {
-      _id := deserialize (_id);
-      declare _topic WV.WIKI.TOPICINFO;
       _topic := WV.WIKI.TOPICINFO();
-      _topic.ti_id := _id;
-      _topic.ti_find_metadata_by_id ();
-      if (_topic.ti_res_id)
+        _topic.ti_cluster_name := _cluster_name;
+        _topic.ti_fill_cluster_by_name ();
+        _local_name := WV.WIKI.FILENAMETOWIKINAME (cast (N.RES_NAME as varchar));
+        if (_id = 0)
 	{
-	  sioc..wiki_sioc_attachment_delete (_topic, O.RES_NAME);
-          WV..ADD_HIST_ENTRY(_topic.ti_cluster_name, _topic.ti_local_name, 'a', O.RES_NAME);
+          _id := WV.WIKI.NEWPLAINTOPICID ();
+          _topic.ti_e_mail := WV.WIKI.MAILBOXFORTOPICNEW (_id, _cluster_name, _local_name);
+          WV..ADD_HIST_ENTRY(_cluster_name, _local_name, 'N', '');
 	}
+        else
+        {
+          _topic.ti_e_mail := (select MailBox from WV.WIKI.TOPIC where TopicId = _id);
+          WV..ADD_HIST_ENTRY(_cluster_name, _local_name, 'U', sprintf ('1.%d', (select max(RV_ID) from ws.ws.sys_dav_res_version where RV_RES_ID = N.RES_ID)));
     }
+        _topic.ti_id := _id;
+        _topic.ti_res_id := N.RES_ID;
+        _topic.ti_default_cluster := _cluster_name;
+        _topic.ti_local_name := _local_name;
+        _topic.ti_text := cast (N.RES_CONTENT as varchar);
+        _topic.ti_compile_page ();
+        _topic.ti_register_for_upstream ('U');
 }
-;
-
-
-
-create trigger "Wiki_TopicTextUpdatePerms" after insert on WS.WS.SYS_DAV_RES order 999 referencing new as N
-{
-  declare _cluster_name varchar;
-  _cluster_name :=  (select ClusterName from WV.WIKI.TOPIC natural join WV.WIKI.CLUSTERS
-	where ResId = N.RES_ID);
-  if (_cluster_name is null)
-   return;
 
+      -- Topic Update Permissions
   SET TRIGGERS OFF;
   WV.WIKI.UPDATEGRANTS_FOR_RES_OR_COL ( _cluster_name, N.RES_ID, 'R');
   SET TRIGGERS ON;
+
+      -- Topic Sparql
+      if (N.RES_TYPE = 'application/sparql-query')
+        WV.WIKI.TopicTextSparql (N.RES_COL, N.RES_FULL_PATH, N.RES_OWNER);
+    }
+  }
 }
 ;
 
-
-create trigger "Wiki_TopicTextInsertMeta" after insert on WS.WS.SYS_DAV_RES order 1 referencing new as N
+wiki_exec_no_error ('drop trigger WS.WS.WIKI_SYS_DAV_RES_BD')
+;
+create trigger "WIKI_SYS_DAV_RES_BD" before delete on WS.WS.SYS_DAV_RES order 1 referencing old as O
 {
+  declare _id integer;
   declare _cluster_name varchar;
-  whenever not found goto skip;
-  select ClusterName into _cluster_name from WV.WIKI.CLUSTERS where ColId = N.RES_COL;
-  connection_set ('oWiki Topic', N.RES_NAME);
-  connection_set ('oWiki Cluster', _cluster_name);
-  skip: ;
-}
-;
-
-
-create trigger "Wiki_TopicTextInsert" after insert on WS.WS.SYS_DAV_RES order 100 referencing new as N
+  declare _topic WV.WIKI.TOPICINFO;
+  declare exit handler for sqlstate '*'
 {
-  declare exit handler for sqlstate '*' {
     --dbg_obj_princ (__SQL_STATE, __SQL_MESSAGE);
     resignal;
   };
-
-  if (N.RES_NAME not like '%.txt')
-    return;
-  declare _newtopic WV.WIKI.TOPICINFO;
-  declare _cluster_name varchar;
-  whenever not found goto skip;
-  select ClusterName into _cluster_name from WV.WIKI.CLUSTERS where ColId = N.RES_COL;
-  _newtopic := WV.WIKI.TOPICINFO ();
-  _newtopic.ti_cluster_name := _cluster_name;
-  _newtopic.ti_fill_cluster_by_name ();
-  _newtopic.ti_id := WV.WIKI.NEWPLAINTOPICID ();
-  _newtopic.ti_res_id := N.RES_ID;
-  _newtopic.ti_default_cluster := _cluster_name;
-  _newtopic.ti_local_name := WV.WIKI.FILENAMETOWIKINAME (cast (N.RES_NAME as varchar));
-  _newtopic.ti_text := cast (N.RES_CONTENT as varchar);
-  _newtopic.ti_e_mail := WV.WIKI.MAILBOXFORTOPICNEW (_newtopic.ti_id, _cluster_name, _newtopic.ti_local_name);
-  _newtopic.ti_compile_page ();
-  _newtopic.ti_register_for_upstream('I');
-  WV..ADD_HIST_ENTRY(_newtopic.ti_cluster_name, _newtopic.ti_local_name, 'N', '1.0');
-  connection_set ('oWiki Topic', N.RES_NAME);
-  connection_set ('oWiki Cluster', _cluster_name);
-  declare _perms varchar;
-  _perms := N.RES_PERMS;
-  --dbg_obj_princ ( WS.WS.ACL_PARSE (dav_prop_get ('/DAV/home/dav/wiki/Main/BlogFAQ.txt', ':virtacl', 'dav','dav')));
-  declare exit handler for sqlstate '*' {
-    --dbg_obj_princ (__SQL_STATE, ' ', __SQL_MESSAGE);
-    rollback work;
-    return;
-  };
-  --dbg_obj_princ (1, WS.WS.ACL_PARSE (dav_prop_get ('/DAV/home/dav/wiki/Main/BlogFAQ.txt', ':virtacl', 'dav','dav')));
-  -- notify wa dashboard about the stuff
-  if (exists (select * from DB.DBA.WA_MEMBER where
-  	WAM_INST = _newtopic.ti_cluster_name
-	and WAM_APP_TYPE = 'oWiki'
-	and WAM_IS_PUBLIC = 1))
-  if (__proc_exists ('DB.DBA.WA_NEW_WIKI_IN'))
-     {
-       declare _uname, _uid varchar;
-       select U_FULL_NAME, U_NAME into _uname, _uid from DB.DBA.SYS_USERS where U_ID = N.RES_OWNER;
-       _newtopic.ti_fill_url();
-       DB.DBA.WA_NEW_WIKI_IN (WV.WIKI.NORMALIZEWIKIWORDLINK (_newtopic.ti_cluster_name, _newtopic.ti_local_name), _newtopic.ti_url || '?', _newtopic.ti_id);
-       insert into WV.WIKI.DASHBOARD (WD_TIME, WD_TITLE, WD_UNAME, WD_UID, WD_URL)
-	  values (now(), subseq (_newtopic.ti_text, 0, 200), _uname, _uid, _newtopic.ti_url || '?');
-     }
-  --dbg_obj_princ (2,  WS.WS.ACL_PARSE (dav_prop_get ('/DAV/home/dav/wiki/Main/BlogFAQ.txt', ':virtacl', 'dav','dav')));
-  skip: ;
-}
-;
-
-create trigger "Wiki_TopicTextDelete" before delete on WS.WS.SYS_DAV_RES order 100 referencing old as O
+  if (O.RES_NAME like '%.txt')
+  {
+    _id := (select TopicId from WV.WIKI.TOPIC where ResId = O.RES_ID);
+    if (not isnull (_id))
 {
-  --dbg_obj_princ ('Wiki_TopicTextDelete: ', O.RES_ID, ' >  ', O.RES_FULL_PATH);
-  declare exit handler for sqlstate '*' {
-	--dbg_obj_print (__SQL_STATE, __SQL_MESSAGE);
-  	resignal;
-  };
-  if (O.RES_NAME not like '%.txt')
-    return;
-  declare _id integer;
-  whenever not found goto skip;
-  select TopicId into _id from WV.WIKI.TOPIC where ResId = O.RES_ID;
-  declare _topic WV.WIKI.TOPICINFO;
   _topic := WV.WIKI.TOPICINFO();
   _topic.ti_id := _id;
   _topic.ti_find_metadata_by_id ();
@@ -1204,113 +1217,36 @@ create trigger "Wiki_TopicTextDelete" before delete on WS.WS.SYS_DAV_RES order 1
   delete from WV.WIKI.SEMANTIC_OBJ where SO_OBJECT_ID = _id;
   WV.WIKI.DELETETOPIC (_id);
   WV.WIKI.DELETE_INLINE_MACRO_FUNCS_1 (_topic);
-  for select P_NAME from DB.DBA.SYS_PROCEDURES 
-    where P_NAME like WV.WIKI.INLINE_MACRO_NAME (_topic.ti_cluster_name, _topic.ti_local_name, null) do {
+      for (select P_NAME from DB.DBA.SYS_PROCEDURES where P_NAME like WV.WIKI.INLINE_MACRO_NAME (_topic.ti_cluster_name, _topic.ti_local_name, null)) do
+      {
     exec ('drop procedure ' || P_NAME);
   }
-  skip: ;
 }
-;
-
-create trigger "Wiki_TopicTextUpdate" after update on WS.WS.SYS_DAV_RES order 100 referencing old as O, new as N
-{
-  --dbg_obj_print ('Wiki_TopicTextUpdate', N.RES_FULL_PATH, connection_get ('oWiki trigger'));
-  declare exit handler for sqlstate '*' {
-	--dbg_obj_princ (__SQL_STATE, __SQL_MESSAGE);
- 	resignal;
-  }; 
-  if (N.RES_NAME not like '%.txt')
-    return;
-  declare _id integer;
-  _id := coalesce ((select TopicId from WV.WIKI.TOPIC where ResId = O.RES_ID), 0);
-  if (O.RES_ID <> N.RES_ID or O.RES_COL <> N.RES_COL)
-    {
-      if (_id <> 0)
-        WV.WIKI.DELETETOPIC (_id);
     }
-  if (O.RES_CONTENT = N.RES_CONTENT)
-    return;
-  declare _newtopic WV.WIKI.TOPICINFO;
-  declare _cluster_name, _local_name varchar;
-  --dbg_obj_princ (1);
-  whenever not found goto skip_insert;
-  select ClusterName into _cluster_name from WV.WIKI.CLUSTERS where ColId = N.RES_COL;
-  --dbg_obj_princ (2);
-  _newtopic := WV.WIKI.TOPICINFO ();
-  _newtopic.ti_cluster_name := _cluster_name;
-  _newtopic.ti_fill_cluster_by_name ();
-  _local_name := WV.WIKI.FILENAMETOWIKINAME (cast (N.RES_NAME as varchar));
-  if (_id = 0)
+  _id := DB.DBA.DAV_HIDE_ERROR (DB.DBA.DAV_PROP_GET_INT (O.RES_COL, 'C', 'oWiki:topic-id', 0));
+  if (not isnull (_id))
     {
-      _id := WV.WIKI.NEWPLAINTOPICID ();
-      _newtopic.ti_e_mail := WV.WIKI.MAILBOXFORTOPICNEW (_id, _cluster_name, _local_name);
-      WV..ADD_HIST_ENTRY(_cluster_name, _local_name, 'N', '');
-    }
-  else
+    _topic := WV.WIKI.TOPICINFO();
+    _topic.ti_id := deserialize (_id);
+    _topic.ti_find_metadata_by_id ();
+    if (_topic.ti_res_id)
     {
-    _newtopic.ti_e_mail := (select MailBox from WV.WIKI.TOPIC where TopicId = _id);
-      WV..ADD_HIST_ENTRY(_cluster_name, _local_name, 'U', sprintf ('1.%d', (select max(RV_ID) from ws.ws.sys_dav_res_version where RV_RES_ID = N.RES_ID)));
+      sioc..wiki_sioc_attachment_delete (_topic, O.RES_NAME);
+      WV..ADD_HIST_ENTRY(_topic.ti_cluster_name, _topic.ti_local_name, 'a', O.RES_NAME);
     }
-      
-  _newtopic.ti_id := _id;
-  _newtopic.ti_res_id := N.RES_ID;
-  _newtopic.ti_default_cluster := _cluster_name;
-  _newtopic.ti_local_name := _local_name;
-  _newtopic.ti_text := cast (N.RES_CONTENT as varchar);
---  dbg_obj_princ (3, _newtopic);
-  _newtopic.ti_compile_page ();
-  _newtopic.ti_register_for_upstream ('U');
-  connection_set ('oWiki Topic', _local_name);
-  connection_set ('oWiki Cluster', _cluster_name);
-  skip_insert: ;
-  --dbg_obj_princ (4);
 }
-;
-
-wiki_exec_no_error ('drop trigger WS.WS.Wiki_AttachemntDelete')
-;
-
-create trigger "Wiki_AttachmentDelete" before delete on WS.WS.SYS_DAV_RES order 100 referencing old as O
-{
 	delete from WV.WIKI.ATTACHMENTINFONEW where ResPath = O.RES_FULL_PATH;
 }
 ;
 
-wiki_exec_no_error ('drop trigger DB.DBA.Wiki_TopicTextSparql_AI')
-;
-wiki_exec_no_error ('drop trigger DB.DBA.Wiki_TopicTextSparql_AU')
-;
-create trigger "Wiki_TopicTextSparql_AI" after insert on WS.WS.SYS_DAV_RES order 999 referencing new as N
-{
-  if (N.RES_TYPE <> 'application/sparql-query')
-    return;
-
-  if (not exists (select 1 from WV.WIKI.CLUSTERS where ColID = N.RES_COL))
-    return;
-
-  WV.WIKI.TopicTextSparql (N.RES_COL, N.RES_FULL_PATH, N.RES_OWNER);
-}
-;
-
-create trigger "Wiki_TopicTextSparql_AU" after update on WS.WS.SYS_DAV_RES order 999 referencing new as N
-{
-  if (N.RES_TYPE <> 'application/sparql-query')
-    return;
-
-  if (not exists (select 1 from WV.WIKI.CLUSTERS where ColID = N.RES_COL))
-    return;
-
-  WV.WIKI.TopicTextSparql (N.RES_COL, N.RES_FULL_PATH, N.RES_OWNER);
-}
-;
-
-
 -- Rendering routines
-
 create function WV.WIKI.NORMALIZEWIKIWORDLINK (
-  inout _default_cluster varchar, inout _href varchar) returns varchar
-{ -- Converts dirty WikiLink to a proper normalized qualified WikiLink.
+  inout _default_cluster varchar,
+  inout _href varchar) returns varchar
+{
+  -- Converts dirty WikiLink to a proper normalized qualified WikiLink.
   declare _topic WV.WIKI.TOPICINFO;
+
   _topic := WV.WIKI.TOPICINFO ();
   _topic.ti_raw_name := _href;
   _topic.ti_default_cluster := _default_cluster;
@@ -1323,9 +1259,12 @@ grant execute on WV.WIKI.NORMALIZEWIKIWORDLINK to public
 ;
 
 create function WV.WIKI.READONLYWIKIWORDLINK (
-  in _default_cluster varchar, in _href varchar) returns varchar
-{ -- Converts dirty WikiLink into link in form Cluster/LocalName
+  in _default_cluster varchar,
+  in _href varchar) returns varchar
+{
+  -- Converts dirty WikiLink into link in form Cluster/LocalName
   declare _topic WV.WIKI.TOPICINFO;
+
   _topic := WV.WIKI.TOPICINFO ();
   _topic.ti_raw_name := _href;
   _topic.ti_default_cluster := _default_cluster;
@@ -1337,69 +1276,45 @@ create function WV.WIKI.READONLYWIKIWORDLINK (
 }
 ;
 
-create function WV.WIKI.READONLYWIKIWORDHREF (
-  inout _default_cluster varchar, 
-  inout _href varchar,
-  in _sid varchar,
-  in _realm varchar,
-  in _base_adjust varchar,
-  in _params any
-) returns varchar
-{ -- Converts dirty WikiLink into path of form Cluster/LocalName
-  declare _topic WV.WIKI.TOPICINFO;
-  _topic := WV.WIKI.TOPICINFO ();
-  _topic.ti_raw_name := _href;
-  _topic.ti_default_cluster := _default_cluster;
-  _topic.ti_parse_raw_name ();
-  declare url_params varchar;
-  if (isstring(_params))  
-    url_params :=  WV.WIKI.URL_PARAMS (_params); --WV.WIKI.COLLECT_PAIRS (_params)); --, WV.WIKI.COLLECT_PAIRS (WV.WIKI.PAIR ('sid', _sid), WV.WIKI.PAIR('realm', _realm))));
-  if (url_params <> '')
-    return sprintf ('%s%U/%U?%s', _base_adjust, _topic.ti_cluster_name, _topic.ti_local_name, url_params);
-  return sprintf ('%s%U/%U', _base_adjust, _topic.ti_cluster_name, _topic.ti_local_name);
-}
-;
-
 create function WV.WIKI.READONLYWIKIWORDHREF2 (
   inout _cluster_name varchar,
   inout _topic_name varchar,
   in _sid varchar,
   in _realm varchar,
-  in _base_adjust varchar,
-  in _params any
-) returns varchar
+  in _params any := '') returns varchar
 {
   declare url_params varchar;
-  if (isstring(_params)) {
+
+  if (isstring (_params))
     url_params :=  WV.WIKI.URL_PARAMS (_params);
-  }
-  if (url_params = '') {
+
+  if (url_params = '')
+  {
     if (isstring(_sid) and _sid <> '')
       url_params := 'sid=' || _sid;
     if (isstring(_realm) and _realm <> '')
-      if (url_params <> '') {
+      if (url_params <> '')
+      {
         url_params := url_params || '&realm=' || _realm;
       } else {
       url_params := 'realm=' || _realm;
     }
   }
---  if (url_params <> '')
---    return sprintf ('%s/%s?%s', SIOC..wiki_cluster_iri (_cluster_name), _topic_name, url_params);
---  return sprintf ('%s/%s', SIOC..wiki_cluster_iri (_cluster_name), _topic_name);
   if (url_params <> '')
     return sprintf ('%s%s?%s', WV.WIKI.wiki_cluster_uri (_cluster_name), _topic_name, url_params);
+
   return sprintf ('%s%s', WV.WIKI.wiki_cluster_uri (_cluster_name), _topic_name);
 
-};
+}
+;
 
 create function WV.WIKI.READONLYWIKIIRI (
   in _cluster_name varchar,
-  in _topic_name varchar
-) returns varchar
+  in _topic_name varchar) returns varchar
 {
---  return sprintf ('%s/%s', SIOC..wiki_cluster_iri (_cluster_name), _topic_name);
   return sprintf ('%s%s', WV.WIKI.wiki_cluster_uri (_cluster_name), _topic_name);
-};
+}
+;
 
 create procedure WV.WIKI.wiki_cluster_uri (in cluster_name varchar)
 {
@@ -1410,7 +1325,7 @@ create procedure WV.WIKI.wiki_cluster_uri (in cluster_name varchar)
 }
 ;
 
-create procedure WV.WIKI.wiki_post_uri (in cluster_name varchar, in cluster_id int, in localname varchar)
+create procedure WV.WIKI.wiki_post_uri (in cluster_name varchar, in cluster_id integer, in localname varchar)
 {
   cluster_name := cast (cluster_name as varchar);
   declare owner varchar;
@@ -1560,11 +1475,8 @@ in user_id integer)
 }
 ;
 
-
 grant execute on WV.WIKI.READONLYWIKIWORDLINK to public
 ;
-grant execute on WV.WIKI.READONLYWIKIWORDHREF to public
-;
 grant execute on WV.WIKI.READONLYWIKIWORDHREF2 to public
 ;
 grant execute on WV.WIKI.READONLYWIKIIRI to public
@@ -1576,8 +1488,6 @@ grant execute on WV.WIKI.wiki_cluster_uri to public
 
 xpf_extension ('http://www.openlinksw.com/Virtuoso/WikiV/:ReadOnlyWikiWordLink', 'WV.WIKI.READONLYWIKIWORDLINK')
 ;
-xpf_extension ('http://www.openlinksw.com/Virtuoso/WikiV/:ReadOnlyWikiWordHREF', 'WV.WIKI.READONLYWIKIWORDHREF')
-;
 xpf_extension ('http://www.openlinksw.com/Virtuoso/WikiV/:ReadOnlyWikiWordHREF2', 'WV.WIKI.READONLYWIKIWORDHREF2')
 ;
 xpf_extension ('http://www.openlinksw.com/Virtuoso/WikiV/:ReadOnlyWikiIRI', 'WV.WIKI.READONLYWIKIIRI')
@@ -1742,7 +1652,7 @@ create function WV.WIKI.CREATEDAVCOLLECTION (in _col_parent integer, in _col_nam
   if (_group is null)
     _group := coalesce (WV.WIKI.WIKIADMINGID(), http_dav_uid() + 1);
 
- declare _res int;
+ declare _res integer;
   _res := DB.DBA.DAV_SEARCH_ID (DB.DBA.DAV_SEARCH_PATH (_col_parent, 'C') || _col_name || '/', 'C');
   if (_res > 0)
 	return _res;
@@ -1855,14 +1765,14 @@ create procedure WV.WIKI.CREATEROLES (in _cname varchar)
 }
 ;
 
-create procedure WV.WIKI.UPDATEACL (in _article varchar, in _gid int, in _bitmask int, in _auth_name varchar, in _auth_pwd varchar)
+create procedure WV.WIKI.UPDATEACL (in _article varchar, in _gid integer, in _bitmask integer, in _auth_name varchar, in _auth_pwd varchar)
 {
   --dbg_obj_princ ('UPDATEACL: ', _article, ' ', _gid, ' ', '_bitmask', ' ');
   declare _acl any;
   _acl := DB.DBA.DAV_PROP_GET(_article, ':virtacl', _auth_name, _auth_pwd);
   if (not isinteger (_acl))
     {
-      declare _res int;
+      declare _res integer;
       declare _new_acl, _old_acl any;
       _acl := cast (_acl as varbinary);
       _old_acl := _acl;
@@ -1884,7 +1794,7 @@ create procedure WV.WIKI.UPDATEACL (in _article varchar, in _gid int, in _bitmas
 
 create procedure WV.WIKI.UPDATEGRANTS (in _cname varchar, in signalerror int:=0)
 {
-  declare _readers, _writers int;
+  declare _readers, _writers integer;
   _readers := ( select U_ID from DB.DBA.SYS_USERS where U_NAME = _cname || 'Readers'
   			and U_IS_ROLE = 1 );
   _writers := ( select U_ID from DB.DBA.SYS_USERS where U_NAME = _cname || 'Writers'
@@ -1915,9 +1825,9 @@ create procedure WV.WIKI.UPDATEGRANTS (in _cname varchar, in signalerror int:=0)
 }
 ;
 
-create procedure WV.WIKI.UPDATEGRANTS_FOR_RES_OR_COL (in _cname varchar, in _res_id int, in _type varchar(1):='R')
+create procedure WV.WIKI.UPDATEGRANTS_FOR_RES_OR_COL (in _cname varchar, in _res_id integer, in _type varchar(1):='R')
 {
-  declare _readers, _writers int;
+  declare _readers, _writers integer;
   declare _path varchar;
   declare _owner, _pwd varchar;
   
@@ -1937,7 +1847,7 @@ create procedure WV.WIKI.UPDATEGRANTS_FOR_RES_OR_COL (in _cname varchar, in _res
 	where U_NAME = _owner;
 
 
---      declare _cluster_id int;
+--      declare _cluster_id integer;
 --      _cluster_id := (select ClusterId from WV.WIKI.CLUSTERS where ClusterName = _cname);
 --     update WS.WS.SYS_DAV_COL set COL_PERMS = WV.WIKI.GETDEFAULTPERMS (_cluster_id)
 --      	where COL_ID = _res_id;
@@ -1951,12 +1861,12 @@ create procedure WV.WIKI.UPDATEGRANTS_FOR_RES_OR_COL (in _cname varchar, in _res
   
 
 -- create all parent collections
-create procedure WV.WIKI.ENSURE_DIR_REC (in _paths any, in _last_index int)
+create procedure WV.WIKI.ENSURE_DIR_REC (in _paths any, in _last_index integer)
 {
   --dbg_obj_princ ('WV.WIKI.ENSURE_DIR_REC ', _paths, _last_index);
   if (_last_index <= 2) -- /DAV
     return 1;
-  declare _col_id int;
+  declare _col_id integer;
   declare _full_path varchar;
   _full_path := WV.WIKI.STRJOIN ('/', subseq (_paths, 0, _last_index)) || '/';
   _col_id := DAV_SEARCH_ID (_full_path, 'C');
@@ -1982,12 +1892,12 @@ create procedure WV.WIKI.DAV_HOME_CREATE(in user_name varchar) returns varchar
   select U_HOME, U_ID into user_home, user_id  from DB.DBA.SYS_USERS where U_NAME = user_name;
   user_home := coalesce ( user_home, '/DAV/home/' || user_name || '/');
   
-  declare _res_id int;
+  declare _res_id integer;
   _res_id := DAV_SEARCH_ID (user_home, 'C');
   if (DAV_HIDE_ERROR (_res_id) is not null)
     goto create_wiki_home;
   -- create home
-  declare _last int;
+  declare _last integer;
   if (length(user_home) > 0)
     _last := user_home[length(user_home)-1];
   else
@@ -2031,7 +1941,7 @@ create procedure WV.WIKI.CREATECLUSTER (in _cname varchar, in _src_col integer,
   declare _uname, _gname, _home varchar;
   declare _wikiuname, _wikigname varchar;
   declare _parent, _main, _histcol, _xmlcol, _attachcol integer;
-  declare _res int;
+  declare _res integer;
 -- Preparing user name
   _uname := coalesce ((select U_NAME from DB.DBA.SYS_USERS where U_ID = _owner and U_IS_ROLE = 0), NULL);
   if (_uname is null)
@@ -2109,7 +2019,7 @@ next:
 
   _xmlcol := WV.WIKI.CREATEDAVCOLLECTION (_main, 'xml', _owner, _group);
   _attachcol := WV.WIKI.CREATEDAVCOLLECTION (_main, 'attach', _owner, _group);
-  declare _cluster_id int;
+  declare _cluster_id integer;
   _cluster_id := WV.WIKI.NEWCLUSTERID();
   insert into WV.WIKI.CLUSTERS (ClusterId, ClusterName, ColId, ColHistoryId, ColXmlId, ColAttachId, AdminId, C_NEWS_ID)
     values (_cluster_id, _cname, _main, _histcol, _xmlcol, _attachcol, _owner, 'oWiki-' || _cname);
@@ -2162,7 +2072,7 @@ next:
 
 
 create procedure WV.WIKI.UPLOADPAGE (
-	in _col_id int,
+  in _col_id integer,
 	in _name varchar, 
 	in _text any, 
 	in _owner varchar, 
@@ -2171,7 +2081,7 @@ create procedure WV.WIKI.UPLOADPAGE (
 	in _overwrite int :=1)
 {
   --dbg_obj_princ ('WV.WIKI.UPLOADPAGE ',  _col_id,  _name, _text , _owner,  _cluster_id ,_user);
-  declare _res_id int;
+  declare _res_id integer;
   if (_cluster_id = 0)
     _cluster_id := (select ClusterId from WV.WIKI.CLUSTERS where ColId = _col_id);
   declare _perms, _path varchar;
@@ -2193,7 +2103,7 @@ create procedure WV.WIKI.UPLOADPAGE (
      coalesce ( (select Token from WV.WIKI.LOCKTOKEN where UserName = _user and ResPath = _path), 1));
   connection_set ('oWiki_cluster_id', null);
   declare wiki_user varchar;
-  declare user_id int;
+  declare user_id integer;
   user_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = _user);
   wiki_user := WV.WIKI.USER_WIKI_NAME_2 (user_id);
   update WV.WIKI.TOPIC set AuthorName = 'Main.' || wiki_user 
@@ -2208,8 +2118,8 @@ create procedure WV.WIKI.UPLOADPAGE (
 ;
 
 create procedure WV.WIKI.CREATEINITIALPAGE (in _page varchar, 
-	in _main int, 
-	in _owner_id int, 
+  in _main integer,
+  in _owner_id integer,
 	in _templ_root varchar:='Main',
 	in _overwrite int:=1)
 {
@@ -2242,7 +2152,7 @@ create procedure WV.WIKI.DELETETOPIC (in _id integer)
 }
 ;
 
-create procedure WV.WIKI.DROPCLUSTERUPSTREAM (in _cid int)
+create procedure WV.WIKI.DROPCLUSTERUPSTREAM (in _cid integer)
 {
   for select UP_ID from WV.DBA.UPSTREAM where UP_CLUSTER_ID = _cid do {
     delete from WV.DBA.UPSTREAM_LOG where UL_UPSTREAM_ID = UP_ID;
@@ -2252,7 +2162,7 @@ create procedure WV.WIKI.DROPCLUSTERUPSTREAM (in _cid int)
 }
 ;
 
-create procedure WV.WIKI.DROPCLUSTERCONTENT (in _cid int)
+create procedure WV.WIKI.DROPCLUSTERCONTENT (in _cid integer)
 {
   declare _topic WV.WIKI.TOPICINFO;
   _topic := WV.WIKI.TOPICINFO ();
@@ -2433,26 +2343,25 @@ create procedure WV.WIKI.APPSIGNAL (in _errno integer, in _text varchar, in _dat
 create procedure WV.WIKI.GETATTCOLID (in _topic WV.WIKI.TOPICINFO)
 {
   declare _col_path varchar;
-  declare _attachment_col_id int;
+  declare _attachment_col_id integer;
   _col_path := DB.DBA.DAV_SEARCH_PATH (_topic.ti_col_id, 'C');
   _attachment_col_id := DB.DBA.DAV_SEARCH_ID ( _col_path || _topic.ti_local_name || '/', 'C');
 
-  if (_attachment_col_id < 0)
-	_attachment_col_id := DB.DBA.DAV_SEARCH_ID ( _col_path || _topic.ti_local_name_2 || '/', 'C');
   return _attachment_col_id;
 }
 ;
 
 create procedure WV.WIKI.ATTACH2 (
-  in _uid int,
+  in _uid integer,
   in _filename varchar,
   in _type varchar,
   in id integer,
   inout _text any,
   in comment varchar)
 {
-  declare _attachment_col_id int;
+  declare _attachment_col_id integer;
   declare _topic WV.WIKI.TOPICINFO;
+
   _topic := WV.WIKI.TOPICINFO ();
   _topic.ti_id := id;
   _topic.ti_find_metadata_by_id ();
@@ -2497,7 +2406,7 @@ create procedure WV.WIKI.ATTACHMENTACTION (
   _topic.ti_find_metadata_by_id ();
   _topic.ti_register_for_upstream('U');
 
-  declare _attachment_col_id int;
+  declare _attachment_col_id integer;
   _attachment_col_id := WV.WIKI.GETATTCOLID (_topic);
   DB.DBA.DAV_DELETE (concat (WS.WS.COL_PATH(_attachment_col_id), _attachment_name), 1, 'dav', (select pwd_magic_calc (U_NAME, U_PWD, 1) from WS.WS.SYS_DAV_USER where U_ID = http_dav_uid()));
 }
@@ -2512,7 +2421,7 @@ create function WV.WIKI.MAXPARENTDEPTH ()
 }
 ;
 
-create procedure WV.WIKI.CHECKPARENT (in _topic_id int, in _parent int, in _depth int)
+create procedure WV.WIKI.CHECKPARENT (in _topic_id integer, in _parent integer, in _depth integer)
 {
   if (_parent = 0)
     return 0;
@@ -2524,7 +2433,7 @@ create procedure WV.WIKI.CHECKPARENT (in _topic_id int, in _parent int, in _dept
 }
 ;
 
-create procedure WV.WIKI.TOPICSETPARENT (in _topic_id int, in _parent int)
+create procedure WV.WIKI.TOPICSETPARENT (in _topic_id integer, in _parent integer)
 {
   if (WV.WIKI.CHECKPARENT (_topic_id, _parent, 0) = -1)
     {
@@ -2554,7 +2463,7 @@ create procedure WV.WIKI.ISWIKIWORD (in _nm varchar)
 
 create procedure WV.WIKI.RENAMETOPIC (in _topic WV.WIKI.TOPICINFO,
 	in _user varchar, 
-	in new_cluster int, 
+  in new_cluster integer,
 	in new_name varchar)
 {
   new_name := trim (new_name);
@@ -2567,7 +2476,7 @@ create procedure WV.WIKI.RENAMETOPIC (in _topic WV.WIKI.TOPICINFO,
   _from := DB.DBA.DAV_SEARCH_PATH (_topic.ti_res_id, 'R');
   _to := DB.DBA.DAV_SEARCH_PATH ( (select ColId from WV.WIKI.CLUSTERS where ClusterId = new_cluster) , 'C') || new_name || '.txt';
  
-  declare _res int;
+  declare _res integer;
   _res := DB.DBA.DAV_MOVE_INT (_from, _to, 1, 
     'dav', (select pwd_magic_calc (U_NAME, U_PWD, 1) from WS.WS.SYS_DAV_USER where U_ID = http_dav_uid()), 1, 
     coalesce (WV.WIKI.GET_LOCKTOKEN (_topic.ti_res_id), 1));
@@ -2583,7 +2492,8 @@ create procedure WV.WIKI.COPYTOPIC (
   in old_topic WV.WIKI.TOPICINFO,
 	in vspx_user varchar)
 {
-  declare exit handler for sqlstate '*' {
+  declare exit handler for sqlstate '*'
+  {
     --dbg_obj_print (__SQL_STATE, __SQL_MESSAGE);
     goto fin;
   };
@@ -2593,7 +2503,7 @@ create procedure WV.WIKI.COPYTOPIC (
 	  signal ('XXXXX', 'Invalid topic name');
 
 	declare _content, _type  varchar;
-	declare _owner_uid int;
+  declare _owner_uid integer;
 	_owner_uid := (select COL_OWNER from WS.WS.SYS_DAV_COL where COL_ID = old_topic.ti_col_id);
   if (0 < DB.DBA.DAV_RES_CONTENT_INT (old_topic.ti_res_id, _content, _type, 0, 0)) {
     if (new_topic_name like 'Category%')
@@ -2604,7 +2514,7 @@ create procedure WV.WIKI.COPYTOPIC (
 
   -- copy attachments
 
-  -- declare _author_uid int;
+  -- declare _author_uid integer;
   -- _author_uid := (select U_ID from DB.DBA.SYS_USERS where U_NAME = vspx_user);
   declare attachments_path varchar;
   attachments_path := WS.WS.COL_PATH(old_topic.ti_col_id) || old_topic.ti_local_name || '/';
@@ -2622,7 +2532,7 @@ create procedure WV.WIKI.COPYTOPIC (
   	  if (_topic.ti_id is not null and _topic.ti_id > 0) {
   	    _topic.ti_find_metadata_by_id();
   	    foreach (any att_spec in attachment_list) do	{
-    		  declare res_id int;
+          declare res_id integer;
     		  declare att_type varchar;
     		  declare att_content, att_content2 any;
     		  res_id := DB.DBA.DAV_RES_CONTENT_INT (DB.DBA.DAV_SEARCH_ID (attachments_path || att_spec, 'R'),
@@ -2638,7 +2548,7 @@ create procedure WV.WIKI.COPYTOPIC (
     		    if (_topic.ti_attach_col_id = 0
     			    or (coalesce(DAV_HIDE_ERROR (DAV_PROP_GET_INT (att_id, 'R', 'oWiki:md5', null, null, 0)), '') <> md5 (cast (att_content as varbinary))))
     			  {
-  				    declare _res int;
+              declare _res integer;
   				    _res := WV.WIKI.ATTACH2 (_owner_uid, att_spec, att_type,	_topic.ti_id,	att_content,	' -- ');
   				    commit work;
   				    result (att_spec);
@@ -2676,12 +2586,14 @@ fin:
 }
 ;
 
-create procedure WV.WIKI.RENAMETOPIC2 (in _topic WV.WIKI.TOPICINFO,
+create procedure WV.WIKI.RENAMETOPIC2 (
+  in _topic WV.WIKI.TOPICINFO,
 	in _user varchar,
-	in new_cluster int,
+  in new_cluster integer,
 	in new_name varchar)
 {
-  declare exit handler for sqlstate '*' {
+  declare exit handler for sqlstate '*'
+  {
     --dbg_obj_print (__SQL_STATE, __SQL_MESSAGE);
     rollback work;
     return;
@@ -2691,15 +2603,28 @@ create procedure WV.WIKI.RENAMETOPIC2 (in _topic WV.WIKI.TOPICINFO,
   if (new_name = '')
 	signal ('XXXXX', 'Invalid topic name');
 
+  declare _res integer;
+  declare old_cluster_name, old_name varchar;
   declare _from, _to varchar;
+  declare wiki_user varchar;
+  declare user_id integer;
+
+  old_cluster_name := _topic.ti_cluster_name;
+  old_name := _topic.ti_local_name;
+
+  _topic.ti_register_for_upstream ('D');
   _from := DB.DBA.DAV_SEARCH_PATH (_topic.ti_res_id, 'R');
   _to := DB.DBA.DAV_SEARCH_PATH ( (select ColId from WV.WIKI.CLUSTERS where ClusterId = new_cluster) , 'C') || new_name || '.txt';
-
-  declare _res int;
-  _res := DB.DBA.DAV_MOVE_INT (_from, _to, 1,
-    'dav', (select pwd_magic_calc (U_NAME, U_PWD, 1) from WS.WS.SYS_DAV_USER where U_ID = http_dav_uid()), 1,
-    coalesce (WV.WIKI.GET_LOCKTOKEN (_topic.ti_res_id), 1));
-  if (DAV_HIDE_ERROR (_res) is null) {
+  _res := DB.DBA.DAV_MOVE_INT (_from,
+                               _to,
+                               1,
+                               'dav',
+                               WV.WIKI.user_password (http_dav_uid()),
+                               1,
+                               coalesce (WV.WIKI.GET_LOCKTOKEN (_topic.ti_res_id), 1)
+                              );
+  if (DAV_HIDE_ERROR (_res) is null)
+  {
     WV.WIKI.APPSIGNAL (11002, '&Topic; can not be moved to &NewTopic; due to DAV_MOVE fail: &Result;',
        vector ('Topic', _topic.ti_local_name, 'NewTopic', new_name, 'Result', _res));
     return;
@@ -2707,37 +2632,51 @@ create procedure WV.WIKI.RENAMETOPIC2 (in _topic WV.WIKI.TOPICINFO,
 
   -- rename/move attachments' collection
   declare _attachments_path varchar;
+
   _attachments_path := WS.WS.COL_PATH(_topic.ti_col_id) || _topic.ti_local_name || '/';
-  if (DB.DBA.DAV_SEARCH_ID (_attachments_path, 'C') > 0) {
-    declare _attfrom, _attto varchar;
-    _attfrom := _attachments_path;
-    _attto := WS.WS.COL_PATH(_topic.ti_col_id) || new_name || '/';
-    declare _attres int;
-    _attres := DB.DBA.DAV_MOVE_INT (_attfrom, _attto, 1,
-      'dav', (select pwd_magic_calc (U_NAME, U_PWD, 1) from WS.WS.SYS_DAV_USER where U_ID = http_dav_uid()), 1, 1);
-    if (DAV_HIDE_ERROR (_attres) is null) {
-      WV.WIKI.APPSIGNAL (11002, 'Attachments of &Topic; can not be moved to &NewTopic; due to DAV_MOVE fail: &Result;',
-         vector ('Topic', _topic.ti_local_name, 'NewTopic', new_name, 'Result', _attres));
+  if (DB.DBA.DAV_SEARCH_ID (_attachments_path, 'C') > 0)
+  {
+    _from := _attachments_path;
+    _to := WS.WS.COL_PATH(_topic.ti_col_id) || new_name || '/';
+    _res := DB.DBA.DAV_MOVE_INT (_from,
+                                 _to,
+                                 1,
+                                 'dav',
+                                 WV.WIKI.user_password (http_dav_uid()),
+                                 1,
+                                 1
+                                );
+    if (DAV_HIDE_ERROR (_res) is null)
+    {
+      WV.WIKI.APPSIGNAL (11002,
+                         'Attachments of &Topic; can not be moved to &NewTopic; due to DAV_MOVE fail: &Result;',
+                         vector ('Topic', _topic.ti_local_name, 'NewTopic', new_name, 'Result', _res)
+                        );
       return;
     }
   }
-  declare wiki_user varchar;
-  declare user_id int;
   user_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = _user);
   wiki_user := WV.WIKI.USER_WIKI_NAME_2 (user_id);
   update WV.WIKI.TOPIC
-    set AuthorName = 'Main.' || wiki_user
-  	  , AuthorId = user_id
-  	  , LocalName = new_name
-  	  , LocalName2 = WV.WIKI.SINGULARPLURAL (new_name)
+     set AuthorName = 'Main.' || wiki_user,
+         AuthorId = user_id,
+         LocalName = new_name,
+         LocalName2 = WV.WIKI.SINGULARPLURAL (new_name)
      where ResId = _topic.ti_res_id;
 
+  update WV.DBA.HIST
+     set H_TOPIC = new_name
+   where H_CLUSTER = old_cluster_name
+     and H_TOPIC = old_name;
+
+  _topic.ti_register_for_upstream ('I');
+
   commit work;
 }
 ;
 
 
-create procedure WV.WIKI.GETFULLDAVPATH (in col_id int, in _res_id int, in local_name varchar)
+create procedure WV.WIKI.GETFULLDAVPATH (in col_id integer, in _res_id integer, in local_name varchar)
 {
   declare _res_path varchar;
   _res_path := DB.DBA.DAV_SEARCH_PATH (_res_id, 'R');
@@ -2768,7 +2707,7 @@ create function WV.WIKI.CHECKWRITEACCESS (in _u_id integer,
 ;
 
 -- returns lock token, or null
-create function WV.WIKI.GET_LOCKTOKEN (in res_id int)
+create function WV.WIKI.GET_LOCKTOKEN (in res_id integer)
 {
   declare res_path varchar;
   res_path := DB.DBA.DAV_SEARCH_PATH (res_id, 'R');
@@ -2783,12 +2722,12 @@ create function WV.WIKI.GETLOCK (in _path varchar, in _uname varchar) returns in
 {
   -- while DAV_LOCK does not work...
   declare _token, op_token varchar;
-  declare _res_id int;
+  declare _res_id integer;
   _res_id := DAV_SEARCH_ID (_path, 'R');
   _token := (select Token from WV.WIKI.LOCKTOKEN
   	where ResPath = _path);
   declare _type varchar;
-  declare _res int;
+  declare _res integer;
   _type := 'R';
 --  if (0 < (_res := DB.DBA.DAV_IS_LOCKED_INT (_res_id, _type, _token)))
 --    {
@@ -2843,7 +2782,7 @@ create function WV.WIKI.LOCKEXPIRATION ()
 
 create function WV.WIKI.PARAM (in _user any, in _param varchar, in _defval any:=null) returns any
 {
-  declare _uid int;
+  declare _uid integer;
   if (isstring (_user))
     _uid := (select U_ID from DB.DBA.SYS_USERS where U_NAME = _user);
   else
@@ -2862,7 +2801,7 @@ create function WV.WIKI.PARAM (in _user any, in _param varchar, in _defval any:=
 
 create function WV.WIKI.GETCLUSTERID (in _cluster any) returns int
 {
-  declare _cl_id int;
+  declare _cl_id integer;
   if (isstring (_cluster))
     _cl_id := (select ClusterId from WV.WIKI.CLUSTERS where ClusterName = _cluster);
   else
@@ -2873,7 +2812,7 @@ create function WV.WIKI.GETCLUSTERID (in _cluster any) returns int
 }
 ;
 
-create function WV.WIKI.GETCLUSTERNAME (in _cluster int) returns varchar
+create function WV.WIKI.GETCLUSTERNAME (in _cluster integer) returns varchar
 {
   return (select ClusterName from WV.WIKI.CLUSTERS where ClusterId = _cluster);
 }
@@ -2902,7 +2841,7 @@ xpf_extension ('http://www.openlinksw.com/Virtuoso/WikiV/:ClusterParam', 'WV.WIK
 
 create procedure WV.WIKI.SETPARAM (in _user any, in _param varchar, in _val any)
 {
-  declare _uid int;
+  declare _uid integer;
   if (isstring (_user))
     _uid := (select U_ID from DB.DBA.SYS_USERS where U_NAME = _user);
   else
@@ -2934,7 +2873,7 @@ create function WV.WIKI.MAKECATEGORYSHORTNAME (in _name varchar) returns varchar
 ;
 
 
-create function WV.WIKI.TOUCHCATEGORY (in _cluster_id int, in fullname varchar, in is_pub int) returns varchar
+create function WV.WIKI.TOUCHCATEGORY (in _cluster_id integer, in fullname varchar, in is_pub integer) returns varchar
 {
   declare _catname varchar;
   _catname := WV.WIKI.MAKECATEGORYSHORTNAME (fullname);
@@ -2965,8 +2904,8 @@ create function WV.WIKI.DIUCATEGORYLINK (
 { 
   -- creates local category if needed, returns wikiword				       
   declare _cat varchar;
-  declare _c_id int;
-  declare _c_col_id, _owner int;
+  declare _c_id integer;
+  declare _c_col_id, _owner integer;
   _c_id := connection_get ('ClusterId');
   _c_col_id := connection_get ('ColId');
   _owner := connection_get ('Owner');
@@ -3006,13 +2945,13 @@ create procedure WV.WIKI.DELICIOUSSIGNAL (in _cluster any, in _err varchar)
 }
 ;
 	
-create function WV.WIKI.DELICIOUSUPDATEFUNCTION (in _is_full int, in last_date datetime)
+create function WV.WIKI.DELICIOUSUPDATEFUNCTION (in _is_full integer, in last_date datetime)
 {
   ;
 }
 ;
 
-create procedure WV.WIKI.DELICIOUSSYNC (in _cluster int, in _user varchar)
+create procedure WV.WIKI.DELICIOUSSYNC (in _cluster integer, in _user varchar)
 {
   --dbg_obj_princ ('WV.WIKI.DELICIOUSSYNC: ', _cluster, ' ', _user);
   declare _deluser, _delpassword varchar;
@@ -3061,7 +3000,7 @@ create method ti_fill_url () for WV.WIKI.TOPICINFO
 }
 ;
 
-create procedure WV.WIKI.MAKECATEGORYNAMELIST (in _cluster int, in _category_names any)
+create procedure WV.WIKI.MAKECATEGORYNAMELIST (in _cluster integer, in _category_names any)
 {
   declare _res, _fullname varchar;
   declare idx integer;
@@ -3094,7 +3033,7 @@ create function WV.WIKI.MAKEDELICIOUSDATESTAMP (in dt datetime)
 ;
 	
 
-create procedure WV.WIKI.DELICIOUSPUBLISH (in _topic_id int, in _category_names any)
+create procedure WV.WIKI.DELICIOUSPUBLISH (in _topic_id integer, in _category_names any)
 {
   declare _topic WV.WIKI.TOPICINFO;
   _topic := WV.WIKI.TOPICINFO ();
@@ -3129,10 +3068,9 @@ create procedure WV.WIKI.DELICIOUSPUBLISH (in _topic_id int, in _category_names
 create function WV.WIKI.PARSEPARAM (in arg varchar) returns any
 {
   declare _res any;
+
   _res := split_and_decode (arg, 0, '\0\0=');
-  aset (_res, 1, subseq ( subseq ( aref (_res, 1), 
-				   0, length (aref (_res, 1)) - 1),
-			  1));
+  aset (_res, 1, subseq (subseq (_res[1], 0, length (_res[1]) - 1), 1));
   return _res;
 }
 ;
@@ -3151,11 +3089,11 @@ create function WV.WIKI.PARSEMACROARGS (in args varchar, in flatten int := 0) re
     }
   vectorbld_final (_args);
   --dbg_obj_print (_args);
-  declare _len int;
+  declare _len integer;
   
   _len := length (_args);
   _res := make_array (_len, 'any');
-  declare idx int;
+  declare idx integer;
   idx := 0;
   while (idx < length (_args))
     {
@@ -3179,7 +3117,7 @@ create function WV.WIKI.PARSEMACROARGS (in args varchar, in flatten int := 0) re
 
 create function WV.WIKI.GETMACROPARAM (in params any, in name varchar, in defval varchar:='') returns varchar
 {
-  declare _idx int;
+  declare _idx integer;
   declare _name varchar;
   _idx := 0;
   _name := lcase (name);
@@ -3197,7 +3135,7 @@ create function WV.WIKI.CHECKACCESS (in _u_id integer,
 					   in _res_id integer,
 					   in res_cluster_id integer,
 					   in _res_col_id integer,
-					   in is_write int,
+             in is_write integer,
 					   in error_message varchar:= NULL) returns integer
 {
   declare acc_str varchar;
@@ -3227,7 +3165,7 @@ err:
 ;
 
 
-create function WV.WIKI.GETDEFAULTPERMS (in _cluster_id int) returns varchar
+create function WV.WIKI.GETDEFAULTPERMS (in _cluster_id integer) returns varchar
 {
   if (exists (select 1 from WV.WIKI.CLUSTERS
 			where ClusterId = _cluster_id
@@ -3237,7 +3175,7 @@ create function WV.WIKI.GETDEFAULTPERMS (in _cluster_id int) returns varchar
   return '110000000RM';
 
   declare perms varchar;
-  declare model int;
+  declare model integer;
   model := connection_get ('WikiMemberModel');
   if (model is null)
     model := coalesce ( (select WAI_MEMBER_MODEL  from WA_INSTANCE 
@@ -3251,8 +3189,8 @@ create function WV.WIKI.GETDEFAULTPERMS (in _cluster_id int) returns varchar
 }
 ;
   
-
-create procedure WV.WIKI.ADDHISTORYITEM (in _topic WV.WIKI.ADDHISTORYITEM, 
+create procedure WV.WIKI.ADDHISTORYITEM (
+  in _topic WV.WIKI.ADDHISTORYITEM,
 					       in _filename varchar, 
 					       in _action varchar, 
 					       in _context varchar,
@@ -3262,10 +3200,10 @@ create procedure WV.WIKI.ADDHISTORYITEM (in _topic WV.WIKI.ADDHISTORYITEM,
 }
 ;
 					       
-create procedure WV.WIKI.PRINTLENGTH (in sz int)
+create procedure WV.WIKI.PRINTLENGTH (
+  in sz integer)
 {
-  declare sz_postfix any;
-  declare offs int;
+  declare offs integer;
 
   offs := 0;
 
@@ -3308,7 +3246,8 @@ create procedure WV.WIKI.ADDLINK (in _topic WV.WIKI.TOPICINFO,
 }
 ;  
 
-create procedure WV.WIKI.NORMALIZETOWIKIWORD (in _name varchar)
+create procedure WV.WIKI.NORMALIZETOWIKIWORD (
+  in _name varchar)
 {
   if (length (_name) = 0)
 	return _name;
@@ -3350,7 +3289,7 @@ create procedure WV.WIKI.GETCOLLECTIONS (in _path varchar, in recursive int:= 0)
 
 create procedure WV.WIKI.DELETEATTACHMENTLINKS (
 	in _topic WV.WIKI.TOPICINFO,
-	in _uid int,
+  in _uid integer,
 	in _attachment varchar)
 {
   declare _path, _user varchar;
@@ -3440,7 +3379,7 @@ create function WV.WIKI.DIFFS (in _cluster varchar, in file_name varchar, inout
 
 create procedure WV..TOPIC_LIST(in _coll varchar)
 {
-  declare _cid int;
+  declare _cid integer;
   _cid := DB.DBA.DAV_SEARCH_ID (_coll, 'C');
   if (_cid < 0)
     return vector();
@@ -3456,7 +3395,7 @@ create procedure WV..TOPIC_LIST(in _coll varchar)
 
 create procedure WV..COLLECTION_LIST(in _coll varchar)
 {
-  declare _cid int;
+  declare _cid integer;
   _cid := DB.DBA.DAV_SEARCH_ID (_coll, 'C');
   if (_cid < 0)
     return vector();
@@ -3479,9 +3418,9 @@ create procedure WV.WIKI.IMPORT (in _cluster varchar,
 	in checkpoint_cnt int:=1000)	 
 {
   declare cluster_path varchar;
-  declare cluster_col_id, cluster_id int;
-  declare rc int;
-  declare checkpoint_idx int;
+  declare cluster_col_id, cluster_id integer;
+  declare rc integer;
+  declare checkpoint_idx integer;
 
   cluster_col_id := (select ColId from WV.WIKI.CLUSTERS where ClusterName = _cluster);
   if (cluster_col_id is null)
@@ -3499,7 +3438,7 @@ create procedure WV.WIKI.IMPORT (in _cluster varchar,
   if(checkpoint_cnt > 0)
     checkpoint_idx := 1;
 
-  declare owner int;
+  declare owner integer;
   owner := (select U_ID from DB.DBA.SYS_USERS where U_NAME = auth);
 
   declare update_list any;
@@ -3598,7 +3537,7 @@ create procedure WV.WIKI.IMPORT (in _cluster varchar,
 	--dbg_obj_princ (_topic);
 		  foreach (any att_spec in attachment_list) do
 		    {
-		      declare res_id int;
+      declare res_id integer;
 		  declare att_type varchar;
 		  declare att_content, att_content2 any;
 --		  dbg_obj_princ ('get ', attachments_path || file_spec || '/' || att_spec);
@@ -3624,7 +3563,7 @@ create procedure WV.WIKI.IMPORT (in _cluster varchar,
 				  -- if (isblob(content) or isstring (content))
 					 --dbg_obj_princ ('>', cast (content as varchar), '\n>',  cast (att_content as varchar));
 			  	    --dbg_obj_princ ('attach ', att_spec[10], ' ', att_type);
-				    declare _res int;
+            declare _res integer;
 				    _res := WV.WIKI.ATTACH2 (owner,
 					  	  att_spec,
 			   		 att_type,
@@ -3694,7 +3633,7 @@ create procedure WV.WIKI.CHECK_TOPIC (
 -- generates new password, login can be used, but it is not necessary
 create procedure WV.WIKI.GENERATE_NEW_PASSWORD (in login varchar)
 {
-  declare idx int;
+  declare idx integer;
   declare pwd varchar2;
   pwd := make_string (8);
   for (idx:=0; idx<6; idx:=idx+1)
@@ -3723,7 +3662,7 @@ create procedure WV.WIKI.IMPORT_USERS (in usersinfo any,
 	in clusters any := NULL, 
 	in add_to_owners integer:= 0)
 {
-  declare idx int;
+  declare idx integer;
   if (not isarray (usersinfo))
     signal ('WV200', 'Userinfo array is expected to be array of array of three elements');
   for (idx:=0; idx<length(usersinfo); idx:=idx+1)
@@ -3739,7 +3678,7 @@ create procedure WV.WIKI.IMPORT_USERS (in usersinfo any,
       secquestion := usersinfo[idx][3];
       secanswer := usersinfo[idx][4];
 
-      declare uid int;
+      declare uid integer;
       uid := (select U_ID from SYS_USERS where U_NAME = login);
       if (uid is null)
         {
@@ -3780,7 +3719,7 @@ create procedure WV.WIKI.IMPORT_USERS (in usersinfo any,
 	 }
       foreach (varchar cl in clusters) do
         {
-	  declare membership_type int;
+    declare membership_type integer;
 	  if (add_to_owners)
 	    membership_type := 1;
 	  else
@@ -3902,7 +3841,7 @@ create procedure WV.WIKI.ADD_MACRO_TO_TOPICS (
   _topic.ti_find_id_by_local_name();
   if (_topic.ti_id = 0)
     return;
-  declare rc,owner int;
+  declare rc,owner integer;
   
   rc := DAV_AUTHENTICATE (_topic.ti_res_id, 'R', '_1_', auth, pwd);
   if (rc < 0)
@@ -3947,14 +3886,14 @@ create procedure WV.WIKI.CHANGE_WORD_IN_CLUSTER (in _cluster varchar,
   --dbg_obj_princ ('next: ', _topic.ti_local_name, _auth);
   
   _topics := vector ();
-  declare cnt int;
+  declare cnt integer;
   cnt := 0;
   for select OrigId from WV.WIKI.LINK
   	where DestId = _topic.ti_id
   do { 
     --dbg_obj_princ ('next: ', OrigId);
     declare _r_topic WV.WIKI.TOPICINFO;
-    declare _owner int;
+    declare _owner integer;
     _r_topic := WV.WIKI.TOPICINFO();
     _r_topic.ti_id := OrigId;
     _r_topic.ti_find_metadata_by_id();
@@ -4030,7 +3969,7 @@ create function WV.WIKI.REPLACE_WORD (
   declare ss any;
   ss := string_output ();
 
-  declare idx int;
+  declare idx integer;
   idx := 0;
   while (idx < length (_text))
     {
@@ -4066,7 +4005,7 @@ create function WV.WIKI.CATEGORY_TO_TAG (in _cat varchar)
 
 -- looks for category in topics first
 -- if failed, creates new category
-create function WV.WIKI.TAG_TO_CATEGORY (in _tag varchar, in _cluster_id int)
+create function WV.WIKI.TAG_TO_CATEGORY (in _tag varchar, in _cluster_id integer)
 {
   declare _cat_name varchar;
   _cat_name := lcase ('Category' || _tag);
@@ -4114,9 +4053,9 @@ auth_validation_fail:
 }
 ;
 	 
-create procedure WV.WIKI.INC_COMMITCOUNTER (in _uid int)
+create procedure WV.WIKI.INC_COMMITCOUNTER (in _uid integer)
 {
-  declare _cnt int;
+  declare _cnt integer;
   whenever not found goto ins;
   declare cr cursor for select Cnt from WV.WIKI.COMMITCOUNTER where AuthorId = _uid for update;
   open cr;
@@ -4169,7 +4108,7 @@ create procedure WV.WIKI.ADD_SYSINFO_VECT (in _text varchar,
 	in _info any, in encode_ft int := 0)
 {
   --dbg_obj_princ ('WV.WIKI.ADD_SYSINFO_VECT ', _text, ' ', _info);
-  declare i int;
+  declare i integer;
   declare _sysinfo_text varchar;
   _sysinfo_text := null;
   for (i:=0; i<(length (_info)/2) ;i:=i+1)
@@ -4222,7 +4161,7 @@ create trigger "Wiki_TaggingUpdate" after update on WS.WS.SYS_DAV_TAG referencin
 }
 ;
 
-create procedure WV.WIKI.UPDATE_TAG_SYSINFO (in _res_id int, in _tags varchar)
+create procedure WV.WIKI.UPDATE_TAG_SYSINFO (in _res_id integer, in _tags varchar)
 {
   declare vtb any;
   vtb := vt_batch();
@@ -4232,12 +4171,12 @@ create procedure WV.WIKI.UPDATE_TAG_SYSINFO (in _res_id int, in _tags varchar)
   return;
 
   --dbg_obj_princ ('WV.WIKI.UPDATE_TAG_SYSINFO: ', _res_id, _tags);
-      declare _col_id int;
+      declare _col_id integer;
       declare _topic_file_name, _full_path varchar;
       declare _content varchar;
-      declare _owner int;
+      declare _owner integer;
       declare _auth varchar;
-      declare _nobody_uid int;
+      declare _nobody_uid integer;
       declare _all_tags any;
 
       _all_tags := (select vector_agg (WV.WIKI.ZIP ('tag', split_and_decode (DT_TAGS, 0, '\0\0,')))
@@ -4250,7 +4189,7 @@ create procedure WV.WIKI.UPDATE_TAG_SYSINFO (in _res_id int, in _tags varchar)
             
       _auth := coalesce (connection_get ('vspx_user'), 'WikiGuest');     
        --dbg_obj_princ (_owner, _auth, _col_id, _topic_file_name, WV.WIKI.ADD_SYSINFO_VECT (_content, WV.WIKI.FLATTEN (_all_tags)));
-      declare res int;
+      declare res integer;
       connection_set ('oWiki trigger', 1);
 
       declare _owner_login varchar;
@@ -4271,13 +4210,12 @@ create procedure WV.WIKI.UPDATE_TAG_SYSINFO (in _res_id int, in _tags varchar)
 
 create procedure WV.WIKI.SET_AUTOVERSION()
 {
-  for select ColId from WV.WIKI.CLUSTERS, WS.WS.SYS_DAV_COL
-    where COL_ID = ColId and COL_AUTO_VERSIONING is not null and COL_AUTO_VERSIONING <> 'A' do
+  for (select ColId from WV.WIKI.CLUSTERS, WS.WS.SYS_DAV_COL where COL_ID = ColId and COL_AUTO_VERSIONING is not null and COL_AUTO_VERSIONING <> 'A') do
     {
       declare _auth, _pwd varchar;
+
       WV.WIKI.GETDAVAUTH (_auth, _pwd);
-      DAV_SET_VERSIONING_CONTROL (
-        DAV_SEARCH_PATH(ColId, 'C'), NULL, 'A', _auth, _pwd);
+    DAV_SET_VERSIONING_CONTROL (DAV_SEARCH_PATH(ColId, 'C'), NULL, 'A', _auth, _pwd);
     }
 }
 ;
@@ -4292,20 +4230,15 @@ create procedure WV.WIKI.STALE (in _path varchar)
 create procedure WV.WIKI.STALE_ALL_XSLTS()
 {
   declare _prefix varchar;
+
   _prefix := 'virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:/DAV/VAD/wiki/Root/';
-  -- Skins
-  for select COL_NAME from WS.WS.SYS_DAV_COL 
-    where COL_PARENT = DB.DBA.DAV_SEARCH_ID ('/DAV/VAD/wiki/Root/Skins/', 'C') do
+  for (select COL_NAME from WS.WS.SYS_DAV_COL where COL_PARENT = DB.DBA.DAV_SEARCH_ID ('/DAV/VAD/wiki/Root/Skins/', 'C')) do
      {
        WV.WIKI.STALE (_prefix || 'Skins/' || COL_NAME || '/PostProcess.xslt');
-        --dbg_obj_princ (_prefix || 'Skins/' || COL_NAME || '/PostProcess.xslt');
      }
-  for select RES_NAME from WS.WS.SYS_DAV_RES 
-    where RES_COL = DB.DBA.DAV_SEARCH_ID ('/DAV/VAD/wiki/Root/', 'C') 
-    and RES_NAME like '%.xsl%' do
+  for (select RES_NAME from WS.WS.SYS_DAV_RES where RES_COL = DB.DBA.DAV_SEARCH_ID ('/DAV/VAD/wiki/Root/', 'C') and RES_NAME like '%.xsl%') do
      {
        WV.WIKI.STALE (_prefix || RES_NAME);
-        --dbg_obj_princ (_prefix || RES_NAME);
      }
 }
 ;
@@ -4317,10 +4250,9 @@ create trigger "Wiki_TopicDelete" before delete on WV.WIKI.TOPIC referencing old
 }
 ;
 
-      
 create procedure WV.WIKI.ADD_USER (in user_name varchar, in cluster_name varchar)
 {
-  declare membership_type, uid int;
+  declare membership_type, uid integer;
   membership_type := 1;
   uid := (select U_ID from DB.DBA.SYS_USERS where U_NAME = user_name);
   if (exists (select * from WV.WIKI.CLUSTERS where ClusterName = cluster_name))
@@ -4329,7 +4261,8 @@ create procedure WV.WIKI.ADD_USER (in user_name varchar, in cluster_name varchar
 	         values (uid, cluster_name, membership_type, 1);
       commit work;
       -- needed to launch trigger
-      update WA_MEMBER set WAM_STATUS = 1
+    update WA_MEMBER
+       set WAM_STATUS = 1
         where WAM_USER = uid
 	  and WAM_INST = cluster_name
 	  and WAM_MEMBER_TYPE = membership_type;
@@ -4339,7 +4272,8 @@ create procedure WV.WIKI.ADD_USER (in user_name varchar, in cluster_name varchar
 
 create procedure WV.WIKI.DROP_ALL_MEMBERS ()
 {
-  for select WAI_NAME from DB.DBA.WA_INSTANCE where WAI_TYPE_NAME = 'oWiki' do {
+  for (select WAI_NAME from DB.DBA.WA_INSTANCE where WAI_TYPE_NAME = 'oWiki') do
+  {
     delete from DB.DBA.WA_MEMBER where WAM_INST = WAI_NAME;
   }
 }
@@ -4351,7 +4285,7 @@ create procedure WV.WIKI.USER_WIKI_NAME(in user_name varchar)
 }
 ;
 
-create procedure WV.WIKI.USER_WIKI_NAME_2(in user_id int)
+create procedure WV.WIKI.USER_WIKI_NAME_2(in user_id integer)
 {
   return cast (WV.WIKI.CONVERTTITLETOWIKIWORD( (select USERNAME from WV.WIKI.USERS where USERID = user_id) ) as varchar);
 }
@@ -4384,10 +4318,9 @@ create procedure WV.WIKI.TEMPLATE_TOPIC(in template_name varchar)
 }
 ;
 
-create procedure WV.WIKI.REPLACE_BULK (in _text varchar,
-	in _repls any)
+create procedure WV.WIKI.REPLACE_BULK (in _text varchar, in _repls any)
 {
-  declare idx int;
+  declare idx integer;
   for (idx:=0; idx<length(_repls); idx:=idx+2)
     {
       _text := replace (_text, _repls[idx], coalesce (_repls[idx+1], ''));
@@ -4396,13 +4329,12 @@ create procedure WV.WIKI.REPLACE_BULK (in _text varchar,
 }
 ;
 
-create procedure WV.WIKI.CREATE_HOME_PAGE_TOPIC (inout _template WV.WIKI.TOPICINFO,
+create procedure WV.WIKI.CREATE_HOME_PAGE_TOPIC (
+  inout _template WV.WIKI.TOPICINFO,
   	in home_page varchar,
-	in user_id int)
+  in user_id integer)
 {
-  for select U_NAME,USERNAME, U_E_MAIL, coalesce (U_FULL_NAME, U_NAME) as _full_name from DB.DBA.SYS_USERS, WV.WIKI.USERS 
-	where U_ID = user_id 
-	and U_ID = USERID do
+  for select U_NAME,USERNAME, U_E_MAIL, coalesce (U_FULL_NAME, U_NAME) as _full_name from DB.DBA.SYS_USERS, WV.WIKI.USERS where U_ID = user_id and U_ID = USERID do
   {
     declare _text varchar;
     _text := WV.WIKI.REPLACE_BULK (cast (_template.ti_text as varchar), 
@@ -4467,28 +4399,28 @@ create trigger WIKI_USERS_U after update on WV.WIKI.USERS order 100 referencing
 
 create trigger SYS_USERS_WIKI_USERS_U after update on DB.DBA.SYS_USERS order 100 referencing old as O, new as N
 {
-  if (N.U_FULL_NAME is null) {
+  if (N.U_FULL_NAME is null)
+  {
     update WV.WIKI.USERS
          set USERNAME = WV.WIKI.USER_WIKI_NAME(N.U_NAME)
        where USERID = N.U_ID;
-  } else {
-    if (O.U_FULL_NAME <> N.U_FULL_NAME) {
+  }
+  else if (O.U_FULL_NAME <> N.U_FULL_NAME)
+  {
       update WV.WIKI.USERS 
 	set USERNAME = WV.WIKI.USER_WIKI_NAME(N.U_FULL_NAME) 
 	where USERID = N.U_ID;
     }
 }
-}
 ;
 
 create procedure
 WS.WS.META_WIKI_HOOK (inout vtb any, inout r_id any)
 {
-  --dbg_obj_princ ('WS.WS.META_WIKI_HOOK: ', r_id);
   declare exit handler for sqlstate '*' {
-    --dbg_obj_princ (__SQL_STATE, ' ', __SQL_MESSAGE);
     return;
   };
+
   declare _cluster varchar;
   _cluster := (select ClusterName from WV.WIKI.TOPIC natural join WV.WIKI.CLUSTERS 
 	where ResId = r_id);
@@ -4496,31 +4428,25 @@ WS.WS.META_WIKI_HOOK (inout vtb any, inout r_id any)
     _cluster := (select ClusterName from WV.WIKI.CLUSTERS where ClusterId = connection_get ('oWiki_cluster_id'));
   if (_cluster is not null)
     {
-      -- it is a wiki
-      foreach (varchar tag in (select split_and_decode (DT_TAGS, 0, '\0\0,')
-       	from WS.WS.SYS_DAV_TAG where DT_RES_ID = r_id)) 
-      do 
+    foreach (varchar tag in (select split_and_decode (DT_TAGS, 0, '\0\0,') from WS.WS.SYS_DAV_TAG where DT_RES_ID = r_id)) do
         {
---	dbg_obj_princ ('adding tag: ', tag); 
           vt_batch_feed (vtb, WV.WIKI.SYSINFO_PRED () || ' tag ' || tag, 0);
         }
       vt_batch_feed (vtb, WV.WIKI.SYSINFO_PRED () || ' cluster ', 0);
       vt_batch_feed (vtb, WV.WIKI.SYSINFO_PRED () || ' cluster ' || _cluster, 0);
-      --dbg_obj_princ (WV.WIKI.SYSINFO_PRED () || ' cluster ' || _cluster);
     }
 }
 ;
 
-
 create procedure WV.WIKI.UPGRADE__UPDATE_AUTHOR_ID()
 {
-  for select ResId as _res_id from WV.WIKI.TOPIC where AuthorId is null do {
-    declare _max_ver int;
+  for select ResId as _res_id from WV.WIKI.TOPIC where AuthorId is null do
+  {
+    declare _max_ver integer;
     _max_ver := (select max(RV_ID) from WS.WS.SYS_DAV_RES_VERSION where RV_RES_ID = _res_id);
     if (_max_ver is not null)
       {
-         update WV.WIKI.TOPIC set AuthorId = (select U_ID from DB.DBA.SYS_USERS, WS.WS.SYS_DAV_RES_VERSION where RV_ID = _max_ver and RV_WHO = U_NAME and RV_RES_ID = _res_id)
-	   where ResId = _res_id;
+      update WV.WIKI.TOPIC set AuthorId = (select U_ID from DB.DBA.SYS_USERS, WS.WS.SYS_DAV_RES_VERSION where RV_ID = _max_ver and RV_WHO = U_NAME and RV_RES_ID = _res_id) where ResId = _res_id;
       }
   }
 }
@@ -4669,7 +4595,7 @@ fin:
 }
 ;
 
-create function WV.WIKI.RESOURCE_CANONICAL (in res_id int)
+create function WV.WIKI.RESOURCE_CANONICAL (in res_id integer)
 {
   return DB.DBA.DAV_SEARCH_PATH (res_id, 'R');
 }
@@ -4690,7 +4616,7 @@ create function WV.WIKI.DELETE_INLINE_MACRO_FUNCS_1 (inout _topic WV.WIKI.TOPICI
 }
 ;
 
-create function WV.WIKI.DELETE_INLINE_MACRO_FUNCS (in _topicid int)
+create function WV.WIKI.DELETE_INLINE_MACRO_FUNCS (in _topicid integer)
 {
   declare _topic WV.WIKI.TOPICINFO;
   _topic := WV.WIKI.TOPICINFO();
@@ -4764,14 +4690,14 @@ create function WA_SEARCH_WIKI_GET_EXCERPT_HTML (in _current_user_id integer, in
 }
 ;
 
-create procedure WA_SEARCH_DAV_OR_WIKI_GET_EXCERPT_HTML
-	(in current_user_id int,
-	 in RES_ID int,
+create procedure WA_SEARCH_DAV_OR_WIKI_GET_EXCERPT_HTML (
+  in current_user_id integer,
+  in RES_ID integer,
 	 in _WORDS_VECTOR any,
 	 in RES_CONTENT any,
 	 in RES_FULL_PATH varchar,
-	 in RES_OWNER int,
-	 in RES_COL int)
+  in RES_OWNER integer,
+  in RES_COL integer)
 {
   if (exists (select 1 from WV.WIKI.CLUSTERS where ColId = RES_COL))
     return WA_SEARCH_WIKI_GET_EXCERPT_HTML (current_user_id, RES_ID, _WORDS_VECTOR, RES_CONTENT, RES_FULL_PATH, RES_OWNER);
@@ -4801,7 +4727,7 @@ create procedure WV.WIKI.CANONICAL_PATH(in _path varchar, in _collectionp int :=
   vectorbld_init(_recon_path);
   if (_path[0] = ascii('/'))
     vectorbld_acc (_recon_path, '');
-  declare _st int;
+  declare _st integer;
   foreach (varchar part in _parts) do {
     if (part <> '') 
       { 
@@ -4849,7 +4775,7 @@ create procedure WV.WIKI.MERGE_HTTP_PATH(in resource varchar, in _path varchar)
 
 create procedure WV.WIKI.PUT_NEW_FILES(in _cname varchar, in _overwrite int:=0, in _pattern varchar := '%')
 {
-  declare _main int;
+  declare _main integer;
   declare _owner varchar;
   _main := (select COLID from WV.WIKI.CLUSTERS where CLUSTERNAME = _cname);
   _owner := WV.WIKI.CLUSTERPARAM (_cname, 'creator', 'dav');
@@ -4875,7 +4801,7 @@ create procedure ADD_HIST_ENTRY (in _cluster varchar,
 	in _op varchar(1),
 	in _ver varchar)
 {
-  declare idx int;
+  declare idx integer;
   idx := 0;
   -- maximum 10 entries allowed.
   for select H_ID as _id from HIST where H_CLUSTER = _cluster 
@@ -5188,6 +5114,13 @@ create procedure WV.WIKI.TopicTextSparql (
 ;
 
 
+create procedure WV.WIKI.user_password (
+  in user_id integer)
+{
+  return coalesce ((select pwd_magic_calc(U_NAME, U_PWD, 1) from WS.WS.SYS_DAV_USER where U_ID = user_id), '');
+}
+;
+
 use DB
 ;
 
diff --git a/appsrc/ODS-Wiki/proc_on_api.sql b/appsrc/ODS-Wiki/proc_on_api.sql
index dfd1a4c..96b4afc 100644
--- a/appsrc/ODS-Wiki/proc_on_api.sql
+++ b/appsrc/ODS-Wiki/proc_on_api.sql
@@ -1,5 +1,5 @@
 --
---  $Id: proc_on_api.sql,v 1.1.2.4 2009/12/08 23:25:22 source Exp $
+--  $Id: proc_on_api.sql,v 1.1.2.6 2011/03/26 14:21:51 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -697,6 +697,10 @@ create procedure ODS.ODS_API."wiki.options.set" (
   {
     WV.WIKI.SETCLUSTERPARAM (clusterName, 'new-topic-template', "value");
   }
+  else if (name = 'skinSource')
+  {
+    WV.WIKI.SETCLUSTERPARAM (clusterName, 'skin-source', "value");
+  }
   else if (name = 'primarySkin')
   {
     WV.WIKI.SETCLUSTERPARAM (clusterName, 'skin', "value");
@@ -793,6 +797,10 @@ create procedure ODS.ODS_API."wiki.options.get" (
   {
     "value" := WV.WIKI.CLUSTERPARAM (clusterName, 'index-page', 'WelcomeVisitors');
   }
+  else if (name = 'skinSource')
+  {
+    "value" := WV.WIKI.CLUSTERPARAM (clusterName, 'skin-source', 'Local');
+  }
   else if (name = 'primarySkin')
   {
     "value" := WV.WIKI.CLUSTERPARAM (clusterName, 'skin', 'default');
diff --git a/appsrc/ODS-Wiki/proc_on_macro.sql b/appsrc/ODS-Wiki/proc_on_macro.sql
index bf20b78..9344a03 100644
--- a/appsrc/ODS-Wiki/proc_on_macro.sql
+++ b/appsrc/ODS-Wiki/proc_on_macro.sql
@@ -1,5 +1,5 @@
 --
---  $Id: proc_on_macro.sql,v 1.22.2.3 2010/01/07 16:57:09 source Exp $
+--  $Id: proc_on_macro.sql,v 1.22.2.5 2011/01/31 11:17:53 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -601,28 +601,20 @@ create function WV.WIKI.MACRO_SEARCH (inout _data varchar, inout _context any, i
       vt_batch_feed (vt, exp, 0, 0, 'x-ViDoc');
       war := vt_batch_strings_array (vt);
       m := length (war);
-      n := 0;
-      while (n < m)
+    for (n := 0; n < m; n := n + 2)
         {
-	  declare word1 varchar;
 	  if (war[n] <> 'AND' and war[n] <> 'NOT' and war[n] <> 'NEAR' and war[n] <> 'OR' and length (war[n]) > 1 and not vt_is_noise (war[n], 'utf-8', 'x-ViDoc'))
-	    {
-	      word1 := war[n];
-	      hit_words := vector_concat (hit_words, vector (word1));
-	    }
-	  n := n + 2;
+        hit_words := vector_concat (hit_words, vector (war[n]));
 	}
 end_parse:
       declare site_cr cursor for select RES_ID, U_NAME, RES_NAME, length (RES_CONTENT) as RES_LEN, WV.WIKI.DATEFORMAT(RES_CR_TIME) as RES_CR_TIME_STR,RES_PERMS, RES_FULL_PATH
                             from WS.WS.SYS_DAV_RES, DB.DBA.SYS_USERS
-                            where
-                             contains (RES_CONTENT, concat ('[__lang ''x-ViDoc''] ',exp1))
+                                where contains (RES_CONTENT, concat ('[__lang ''x-ViDoc''] ',exp1))
                              and RES_FULL_PATH like searchPath || '%.txt'
 			     and U_ID = RES_OWNER;
       declare cluster_cr cursor for select RES_ID, U_NAME, RES_NAME, length (RES_CONTENT) as RES_LEN, WV.WIKI.DATEFORMAT(RES_CR_TIME) as RES_CR_TIME_STR,RES_PERMS, RES_FULL_PATH
                             from WS.WS.SYS_DAV_RES, DB.DBA.SYS_USERS
-                            where
-                             contains (RES_CONTENT, concat ('[__lang ''x-ViDoc''] ',exp1))
+                                   where contains (RES_CONTENT, concat ('[__lang ''x-ViDoc''] ',exp1))
                              and RES_FULL_PATH like searchPath || '%.txt'
 			     and U_ID = RES_OWNER
 			     and RES_COL = _cluster_col_id;
@@ -644,7 +636,7 @@ whenever sqlstate '37000' goto failed;
 			<th align="left" width="10%">Size</th>
 			<th align="left" width="10%">Owner</th>
 			<th align="left" width="10%">Date</th></tr>', _ctx);
- 	while (1=1) {
+    while (1) {
 	  if (_cluster_search = 1)
 		fetch cluster_cr into _res_id, _u_name, _res_name, _res_len, _cr_time, _perms, _full_path;
 	  else
diff --git a/appsrc/ODS-Wiki/proc_on_vsp.sql b/appsrc/ODS-Wiki/proc_on_vsp.sql
index 96d09b2..0d83432 100644
--- a/appsrc/ODS-Wiki/proc_on_vsp.sql
+++ b/appsrc/ODS-Wiki/proc_on_vsp.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: proc_on_vsp.sql,v 1.44.2.5 2010/03/15 15:49:42 source Exp $
+--  $Id: proc_on_vsp.sql,v 1.44.2.9 2011/03/26 14:21:51 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -91,12 +91,8 @@ create function WV.WIKI.VSPTOPICCREATE (
     {
       _template := '%META:TOPICPARENT{name="' || get_keyword('parent', params) || '"}%\n' || _template;
     }
-  WV.WIKI.SET_TEMP_TEXT (_topic.ti_cluster_name, _topic.ti_local_name, 
-	coalesce (get_keyword ('temp-text', params), _template),
-	params);
-
-  _ext_params := _topic.ti_xslt_vector (vector_concat (params,
-	 vector ('is_new', '1'))); 
+  WV.WIKI.SET_TEMP_TEXT (_topic.ti_cluster_name, _topic.ti_local_name, coalesce (get_keyword ('temp-text', params), _template), params);
+  _ext_params := _topic.ti_xslt_vector (vector_concat (params, vector ('is_new', '1')));
 
   declare _artiles any;
   
@@ -107,10 +103,7 @@ create function WV.WIKI.VSPTOPICCREATE (
 			LocalName)))
 		  from WV.WIKI.TOPIC where ClusterId = _topic.ti_cluster_id and LocalName like cast ('%' || _topic.ti_local_name || '%' as varchar)); 
 
-  http_value (
-    WV.WIKI.VSPXSLT ( 'VspTopicCreate.xslt',
-      _artiles,
-       _ext_params));
+  http_value (WV.WIKI.VSPXSLT ( 'VspTopicCreate.xslt', _artiles, _ext_params));
 }
 ;
 
@@ -144,7 +137,6 @@ create function WV.WIKI.VSPTOPICVIEW (
       http_rewrite();
       WV.WIKI.redirect (sprintf ('%s/login.vspx?URL=%U',  WV..ODS_LINK(lines), 'http://' || DB.DBA.WA_GET_HOST() || http_path() || '?command=null'));
       return;
-      --resignal;
     }
   }
   ;
@@ -188,7 +180,6 @@ ins:
   		values (_topic.ti_id, 1);
     }
   whenever not found default;
-  --dbg_obj_princ (_topic.ti_get_entity (null,1));
   if (get_keyword ('selected', params, 'main') = 'talks')
     _topic.ti_text := '%COMMENTS%\n';
 
@@ -199,28 +190,24 @@ ins:
     _ext_params := vector_concat (_ext_params, vector ('qwikidisabled', '1'));
 
   declare _tree varchar;
---  _tree := WV.WIKI.CLUSTERPARAM (_topic.ti_cluster_id, 'tree', 'hide');
+
   _tree := 'hide';
   _ext_params := vector_concat (_ext_params, vector ('tree', _tree));
-
---  declare _tree_content any;
---  _tree_content := WV.WIKI.CLUSTER_TREE_BUILD (_topic.ti_cluster_id, _topic.ti_cluster_name);
---  _tree_content := xtree_doc(_tree_content, 2);
---  _ext_params := vector_concat (_ext_params, vector ('tree_content', _tree_content));
-
   _xhtml := _topic.ti_get_entity(null, 1);
-
   if (_command not in ('docbook'))
+  {
    _xhtml := WV.WIKI.VSPXSLT ( 'VspTopicView.xslt', _xhtml, _ext_params);
+  }
   if (_command = 'xmlraw')
     {
       http_rewrite ();
       http_value (_xhtml); 
       return 0;
     }
-  else if (_command = 'docbook')
+  if (_command = 'docbook')
 	{
-	  _xhtml:= '<html xmlns="http://www.w3.org/1999/xhtml">
+    _xhtml :=
+'<html xmlns="http://www.w3.org/1999/xhtml">
 		<head>
 	  <title>' || _topic.ti_local_name || '</title>
 	</head>
@@ -232,8 +219,6 @@ ins:
 
 	  return 0;
     }
-  declare _skin varchar;
-  _skin := coalesce (get_keyword  ('skin2', params), get_keyword ('skin', params), 'default');
 
   declare _creator varchar;
   _creator := WV.WIKI.CLUSTERPARAM (_topic.ti_cluster_id, 'creator', 'dav');  
@@ -252,10 +237,12 @@ ins:
   _ext_params := vector_concat (_ext_params, vector ('ods-bar', _ods_bar, 'ods-app', _app_js));
   http_rewrite ();
   http_header ('Content-Type: text/html; charset=UTF-8\r\n');
-  _xhtml :=  WV.WIKI.VSPXSLT ( 'PostProcess.xslt', _xhtml, vector_concat (_ext_params), _skin );
+  _xhtml := WV.WIKI.VSPXSLT ( 'PostProcess.xslt', _xhtml, vector_concat (_ext_params), WV.WIKI.SKIN_PARAMS (_topic.ti_cluster_id, params));
   http_header ('Content-Type: text/html; charset=UTF-8\r\n');
   if (WV.WIKI.CLUSTERPARAM (_topic.ti_cluster_id, 'email-obfuscate') is not null)
+  {
   http_value (_xhtml);
+  }
   else
     {
        declare _content any;
@@ -296,10 +283,9 @@ create function WV.WIKI.VSPTOPICVIEW_TEMP (
 
       http_header ('Content-Type: text/html; charset=UTF-8\r\n');
       declare _content any;
-      _xhtml := XMLELEMENT ('html', 
-		 XMLELEMENT ('body'));
-      _content := xpath_eval ('//body', _xhtml);
             
+    _xhtml := XMLELEMENT ('html', XMLELEMENT ('body'));
+    _content := xpath_eval ('//body', _xhtml);
       foreach (any elem in xpath_eval ('//div[@class="topic-text"]/*', WV.WIKI.VSPXSLT ('VspTopicView.xslt', _topic.ti_get_entity(null, 0), _ext_params), 0)) do 
        {
 	 XMLAppendChildren (_content, elem);
@@ -334,8 +320,7 @@ create function WV.WIKI.VSPTOPICVIEW_PLAIN (
   http_rewrite();
   _xhtml := XMLELEMENT ('html', 
 		XMLELEMENT ('body', 
-		  xpath_eval ('//div[@class="topic-text"]', WV.WIKI.VSPXSLT ('VspTopicView.xslt', _topic.ti_get_entity (null,0),
-			      _ext_params))));
+      xpath_eval ('//div[@class="topic-text"]', WV.WIKI.VSPXSLT ('VspTopicView.xslt', _topic.ti_get_entity (null, 0), _ext_params))));
   http_header ('Content-Type: text/html; charset=UTF-8\r\n');
   http_value (_xhtml);
 }
@@ -415,12 +400,6 @@ create function WV.WIKI.VSPTOPICPREVIEW (
     }
   
   _topic.ti_text := _topic_text;
-   
---  if (0 = WS.WS.CHECK_READ_ACCESS (_uid, _topic.ti_res_id))
---    {
---      VspReportFailedReadAccess (path, params, lines, _topic.ti_cluster_name, _topic.ti_local_name, '');
---      return;
---    }
   _topic.ti_curuser_wikiname := coalesce ((select UserName from WV.WIKI.USERS where UserId=_uid), '?');
   _topic.ti_curuser_username := coalesce ((select U_NAME from DB.DBA.SYS_USERS where U_ID=_uid), '?');
   _topic.ti_base_adjust := _base_adjust;
@@ -440,10 +419,13 @@ create function WV.WIKI.VSPTOPICREFERERS (
 {
   declare _uid integer;
   declare _base_adjust varchar;
-  _uid := get_keyword ('uid', params);
-  _base_adjust := get_keyword ('baseadjust', params);
   declare _report any;
   declare _text varchar;
+  declare _ext_params any;
+
+  _uid := get_keyword ('uid', params);
+  _base_adjust := get_keyword ('baseadjust', params);
+
   -- _topic.ti_http_debug_print('VspTopicReferers: info about current topic');
   if (get_keyword ('command', params) = 'refby') 
     {
@@ -452,14 +434,22 @@ create function WV.WIKI.VSPTOPICREFERERS (
 					     XMLELEMENT ('Link',
 							 XMLATTRIBUTES (c.ClusterName as "CLUSTERNAME",
 									n.LocalName as "LOCALNAME",
+                            u.U_NAME as "CREATED_BY",
+                            WV.WIKI.DATEFORMAT (n.T_CREATE_TIME) as "CREATED_ON",
+                            u2.U_NAME as "UPDATED_BY",
+                            WV.WIKI.DATEFORMAT (r.RES_MOD_TIME) as "UPDATED_ON",
 									n.Abstract as "ABSTRACT") ) ) )
-		  from (
-			select distinct n2.LocalName, n2.Abstract, n2.ClusterId
-			from WV.WIKI.LINK as l inner join WV.WIKI.TOPIC as n2 on (l.OrigId = n2.TopicId)
+                  from (select distinct n2.LocalName, n2.T_CREATE_TIME, n2.AuthorId, n2.RESID, n2.Abstract, n2.ClusterId
+                          from WV.WIKI.LINK as l
+                                 inner join WV.WIKI.TOPIC as n2 on (l.OrigId = n2.TopicId)
 			 where l.DestId = _topic.ti_id
 			 and n2.ClusterId = _topic.ti_cluster_id
 			) as n
-		  inner join WV.WIKI.CLUSTERS as c on (c.ClusterId = n.ClusterId) );
+                        inner join WV.WIKI.CLUSTERS as c on (c.ClusterId = n.ClusterId)
+                        inner join DB.DBA.SYS_USERS as u on (u.U_ID = n.AuthorId)
+                        inner join WS.WS.SYS_DAV_RES r on (n.RESID = r.RES_ID)
+                        inner join DB.DBA.SYS_USERS as u2 on (u2.U_ID = r.RES_OWNER)
+                 order by c.ClusterName, n.LocalName);
     }
   else
     {
@@ -468,22 +458,29 @@ create function WV.WIKI.VSPTOPICREFERERS (
 					     XMLELEMENT ('Link',
 							 XMLATTRIBUTES (c.ClusterName as "CLUSTERNAME",
 									n.LocalName as "LOCALNAME",
+                            u.U_NAME as "CREATED_BY",
+                            WV.WIKI.DATEFORMAT (n.T_CREATE_TIME) as "CREATED_ON",
+                            u2.U_NAME as "UPDATED_BY",
+                            WV.WIKI.DATEFORMAT (r.RES_MOD_TIME) as "UPDATED_ON",
 									n.Abstract as "ABSTRACT") ) ) )
-		  from (
-			select distinct n2.LocalName, n2.Abstract, n2.ClusterId
-			from WV.WIKI.LINK as l inner join WV.WIKI.TOPIC as n2 on (l.OrigId = n2.TopicId)
+                  from (select distinct n2.LocalName, n2.T_CREATE_TIME, n2.AuthorId, n2.RESID, n2.Abstract, n2.ClusterId
+                          from WV.WIKI.LINK as l
+                                 inner join WV.WIKI.TOPIC as n2 on (l.OrigId = n2.TopicId)
 			 where l.DestId = _topic.ti_id 
 			) as n
-		  inner join WV.WIKI.CLUSTERS as c on (c.ClusterId = n.ClusterId) );
+                        inner join WV.WIKI.CLUSTERS as c on (c.ClusterId = n.ClusterId)
+                        inner join DB.DBA.SYS_USERS as u on (u.U_ID = n.AuthorId)
+                        inner join WS.WS.SYS_DAV_RES r on (n.RESID = r.RES_ID)
+                        inner join DB.DBA.SYS_USERS as u2 on (u2.U_ID = r.RES_OWNER)
+                 order by c.ClusterName desc, n.LocalName desc);
     }
-  declare _ext_params any;
-  _ext_params := vector_concat (_topic.ti_xslt_vector(params),
-  	vector ('donotresolve', 1));
-  http_value (WV.WIKI.VSPXSLT ( 'PostProcess.xslt', 
-    WV.WIKI.VSPXSLT ( 'VspTopicReports.xslt', _report,
-      _ext_params),
+  _ext_params := vector_concat (_topic.ti_xslt_vector(params), vector ('donotresolve', 1));
+  http_value (
+    WV.WIKI.VSPXSLT (
+      'PostProcess.xslt',
+                               WV.WIKI.VSPXSLT ( 'VspTopicReports.xslt', _report, _ext_params),
    _ext_params,
-   coalesce (get_keyword  ('skin2', params), get_keyword ('skin', params), WV.WIKI.CLUSTERPARAM ( _topic.ti_cluster_id , 'skin', 'default' ))));
+      WV.WIKI.SKIN_PARAMS (_topic.ti_cluster_id, params)));
 }
 ;
 
@@ -506,17 +503,14 @@ create function WV.WIKI.VSPCLUSTERINDEX (
 	    XMLATTRIBUTES (_topic.ti_cluster_name as CLUSTERNAME, n.LocalName as LOCALNAME, n.Abstract ABSTRACT) ) ) )
       from WV.WIKI.TOPIC n where n.ClusterId = _topic.ti_cluster_id ) );
   declare _ext_params any;
-  _ext_params := vector_concat (_topic.ti_xslt_vector(params),
-  	vector ('donotresolve', 1));
+  _ext_params := vector_concat (_topic.ti_xslt_vector(params), vector ('donotresolve', 1));
 
---  dbg_obj_print (_report);
   http_value (
-    WV.WIKI.VSPXSLT ('PostProcess.xslt', 
-	   WV.WIKI.VSPXSLT ( 'VspTopicReports.xslt', _report,
-	   _ext_params),
+    WV.WIKI.VSPXSLT (
+      'PostProcess.xslt',
+      WV.WIKI.VSPXSLT ( 'VspTopicReports.xslt', _report, _ext_params),
 	 _ext_params,
-	 coalesce (get_keyword  ('skin2', params), get_keyword ('skin', params), WV.WIKI.CLUSTERPARAM ( _topic.ti_cluster_id , 'skin', 'default' ))));
-
+      WV.WIKI.SKIN_PARAMS (_topic.ti_cluster_id, params)));
 }
 ;
 
@@ -555,7 +549,8 @@ create function WV.WIKI.VSPCLUSTERMEMBERS (
   XMLAppendChildren(_xml, XMLELEMENT ('ul'));
   _ent := xpath_eval ('/ul', _xml);
 
-  foreach (any p in _res) do {
+  foreach (any p in _res) do
+  {
     if (_last_char <> p[0][0])
       XMLAppendChildren (_ent, XMLELEMENT ('li', XMLELEMENT ('A', XMLATTRIBUTES (subseq (p[0], 0, 1) as "name", 'noapp' as "class"), subseq (p[0],0,1))));
     _last_char := p[0][0];
@@ -563,16 +558,13 @@ create function WV.WIKI.VSPCLUSTERMEMBERS (
   }
 
   declare _ext_params any;
-  _ext_params := vector_concat (_topic.ti_xslt_vector(params),
-  	vector ('donotresolve', 1));
 
+  _ext_params := vector_concat (_topic.ti_xslt_vector(params), vector ('donotresolve', 1));
   http_value (
     WV.WIKI.VSPXSLT ('PostProcess.xslt',
-	   WV.WIKI.VSPXSLT ( 'VspTopicReports.xslt', _xml,
-	   _ext_params),
+      WV.WIKI.VSPXSLT ( 'VspTopicReports.xslt', _xml, _ext_params),
 	 _ext_params,
-	 coalesce (get_keyword  ('skin2', params), get_keyword ('skin', params), WV.WIKI.CLUSTERPARAM ( _topic.ti_cluster_id , 'skin', 'default' ))));
-
+      WV.WIKI.SKIN_PARAMS (_topic.ti_cluster_id, params)));
 }
 ;
 
@@ -618,29 +610,49 @@ create function WV.WIKI.VSPTOPICRESOURCE (
 }
 ;
 
-create function WV.WIKI.VSPXSLT (in _xslt_name varchar, inout _src any, inout _params any, in _skin_name varchar:=null) returns any
+create function WV.WIKI.SKIN_PARAMS (
+  in cluster_id integer,
+  in params any)
+{
+  declare skinParams any;
+
+  skinParams := vector ('skin', coalesce (get_keyword ('skin2', params), get_keyword ('skin', params), WV.WIKI.CLUSTERPARAM (cluster_id , 'skin', 'default')));
+  skinParams := vector_concat (skinParams, vector ('skin-source', get_keyword ('skin-source', params, WV.WIKI.CLUSTERPARAM (cluster_id , 'skin-source', 'Local'))));
+
+  return skinParams;
+}
+;
+
+create function WV.WIKI.VSPXSLT (in _xslt_name varchar, inout _src any, inout _params any, in _skinParams any := null) returns any
 {
   declare _xslt_folder varchar;
-  if (_skin_name is null)
-    _xslt_folder := '/DAV/VAD/wiki/Root/';
-  else
-    _xslt_folder := '/DAV/VAD/wiki/Root/Skins/' || _skin_name || '/';
-  --dbg_obj_print (concat ('virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:' || _xslt_folder, _xslt_name));
-  return
---    xslt ( concat ('file://', _xslt_name), _src,
     
-    xslt ( concat ('virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:' || _xslt_folder, _xslt_name), _src,
-      vector_concat (_params, vector ('env', _params))
-    );
+  if (_skinParams is null)
+  {
+    _xslt_folder := 'virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:/DAV/VAD/wiki/Root/' || _xslt_name;
+  }
+  else
+  {
+    if (get_keyword ('skin-source', _skinParams) = 'WebDAV')
+    {
+      _xslt_folder := 'virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:' || get_keyword ('skin', _skinParams) || '/' || _xslt_name;
+    }
+    else if (get_keyword ('skin-source', _skinParams) = 'URL')
+    {
+      _xslt_folder := get_keyword ('skin', _skinParams) || '/' || _xslt_name;
+    }
+    else
+    {
+      _xslt_folder := 'virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:/DAV/VAD/wiki/Root/Skins/' || coalesce (get_keyword ('skin', _skinParams), 'default') || '/' || _xslt_name;
+    }
+  }
+  return xslt (_xslt_folder, _src, vector_concat (_params, vector ('env', _params)));
 }
 ;  
 
 create function WV.WIKI.VSPHTTPXSLT (in _xslt_name varchar, inout _params any) returns any
 {
-  return
-    http_xslt ( concat ('virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:/DAV/VAD/wiki/Root/', _xslt_name), 
-      vector_concat (_params, vector ('env', _params))
-    );
+  return http_xslt ( concat ('virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:/DAV/VAD/wiki/Root/', _xslt_name), vector_concat (_params, vector ('env', _params)));
 }
 ;  
 
@@ -661,21 +673,18 @@ create procedure WV.WIKI.VSPXGETUID (in web_login varchar, inout realm varchar,
 }
 ;
   
-
 create function WV.WIKI.AUTHENTICATE (in _user varchar, in _pwd varchar)
 {
-   --dbg_obj_princ ('WV.WIKI.AUTHENTICATE ', _user, ' ', _pwd);
   declare _uid int;
   declare _e_mail varchar;
   whenever not found goto notf;
   select U_ID, U_E_MAIL into _uid, _e_mail from DB.DBA.SYS_USERS where U_NAME = _user;
-  for select (wai_inst as wa_wikiv).cluster_id as cluster_id
-    from WA_INSTANCE join WA_MEMBER 
-  	on (WAM_INST = WAI_NAME) 
+  for (select (wai_inst as wa_wikiv).cluster_id as cluster_id
+         from WA_INSTANCE
+                join WA_MEMBER on (WAM_INST = WAI_NAME)
 	where udt_instance_of (WAI_INST, fix_identifier_case ('DB.DBA.wa_wikiv')) 
-	  and WAM_USER = _uid
-  do {
-        --dbg_obj_princ ('cluster: ', cluster_id);
+          and WAM_USER = _uid) do
+  {
     if (WV.WIKI.CLUSTERPARAM (cluster_id, 'ldap_enabled', 2) = 1)
       {
         declare ldap_user varchar;
@@ -687,13 +696,12 @@ create function WV.WIKI.AUTHENTICATE (in _user varchar, in _pwd varchar)
   }
 usual:  
   return DB.DBA.web_user_password_check (_user, _pwd);
+
 notf:
-   --dbg_obj_princ ('notf');
   return 0;
 }
 ;
 
-  
 create procedure WV.WIKI.VSPCHECKWEBAUTH (
   inout path any, inout params any, inout lines any )
 {
@@ -712,7 +720,6 @@ create procedure WV.WIKI.VSPCHECKWEBAUTH (
   if (0 = auth)
     {
       _reason := '. No authorization data are provided by your browser now';
-      --dbg_obj_print ('auth', auth);
       goto auth_get;
     }
 
@@ -923,16 +930,22 @@ create procedure  WV.WIKI.GETCMDTITLE (inout params any)
   _cmd_title := get_keyword ('command', params);
   if (_cmd_title like '%attach')
    return ' | Attachments';
-  else if (_cmd_title = 'mops')
+
+  if (_cmd_title = 'mops')
    return ' | More Actions on Topic';
-  else if (_cmd_title = 'edit')
+
+  if (_cmd_title = 'edit')
    return ' | Edit';
-  else if (_cmd_title = 'preview' and get_keyword ('Cancel', params) is null)
+
+  if (_cmd_title = 'preview' and get_keyword ('Cancel', params) is null)
    return ' | Preview';
-  else if (_cmd_title = 'refby')
+
+  if (_cmd_title = 'refby')
    return ' | Ref-by';
-  else if (_cmd_title = 'index')
+
+  if (_cmd_title = 'index')
    return ' | Index';
+
   return '';
 }
 ;
@@ -951,17 +964,16 @@ create procedure WV.WIKI.VSPHEADER (
   declare _skin, _topic_title varchar;
   if (isstring (topic_or_title))
     {      
-      _skin := 'default';
       _topic_title := topic_or_title;
+    _skin := 'default';
     }
   else
     {
       _topic := topic_or_title;
-      _skin := WV.WIKI.CLUSTERPARAM ( _topic.ti_cluster_id , 'skin', 'default');
       _topic_title := _topic.ti_raw_title;
+    _skin := get_keyword ('skin', WV.WIKI.SKIN_PARAMS (_topic.ti_cluster_id, params));
     }
 
-  _skin := coalesce (get_keyword  ('skin2', params), get_keyword ('skin', params), _skin);
   http ('<html><head>');
   http ('<title>oWiki | ');
   http (_topic_title || WV.WIKI.GETCMDTITLE (params));
@@ -1118,14 +1130,20 @@ create function WV.WIKI.VSPREPORTPAGEARGS (
 		      http (sprintf ('(%d characters were truncated)', length (_val) - 160), _ses);
 	            }
 	          else
+          {
 		    http_value (_val, 'CODE', _ses);
                 }
             }
+      }
 	  else
+      {
 	    http ('*******', _ses);
 	}
+    }
       else
+    {
         http('] = ??? }');
+    }
       idx := idx + 1;
       if (idx < length (params))
         http('] , ', _ses);
@@ -1264,10 +1282,11 @@ whenever not found goto nf;
     {
 nf:
        path := subseq (path, 1);
-         
     }
   else
+  {
     path := subseq (path, (length (split_and_decode (domain, 0, '\0\0/')) - 2));
+  }
   if (path[0] = 'Atom') 
     {
       _cluster := null;
@@ -1342,9 +1361,7 @@ nf:
            _startofs := 2;
            goto next2;
          }
-      --dbg_obj_print (_jpath);
-      if ( (_jpath not like 'wiki/main/%') and
-	   (_jpath <>  'wiki/Atom/') )
+    if ((_jpath not like 'wiki/main/%') and (_jpath <> 'wiki/Atom/'))
         WV.WIKI.APPSIGNAL (11002, 'Path &url; to resource must start from "/wiki/main/"', vector('url', http_path()));
       path := subseq (path, 2);     
     }
@@ -1385,20 +1402,19 @@ next2:
       _attach := concat (_attach, '/', aref (path, _idx));
       _idx := _idx + 1;
     }
-  declare _primary_skin, _second_skin varchar;
+  declare _skin_source, _primary_skin, _second_skin varchar;
 cont:
+  _skin_source := WV.WIKI.CLUSTERPARAM ( _cluster , 'skin-source', 'Local' );
   if (_cluster is not null)
     _primary_skin := WV.WIKI.CLUSTERPARAM ( _cluster , 'skin', 'default' );
   _second_skin := null;
   declare skin2_regexp varchar;
   skin2_regexp := WV.WIKI.CLUSTERPARAM ( _cluster, 'skin2-vhost-regexp', null);
 whenever sqlstate '2201B' goto next;
-  if (skin2_regexp is not null and
-      regexp_match (skin2_regexp, _host) is not null)
+  if (skin2_regexp is not null and regexp_match (skin2_regexp, _host) is not null)
     _second_skin := WV.WIKI.CLUSTERPARAM ( _cluster , 'skin2', 'default');  
 next: 
-  return vector ('skin', _primary_skin,
-  	 	 'skin2', _second_skin);
+  return vector ('skin-source', _skin_source, 'skin', _primary_skin, 'skin2', _second_skin);
 }
 ;
 
@@ -1479,10 +1495,7 @@ create function WV.WIKI.VSPTOPICATTACH (
 
   declare _ext_params any;
   _ext_params := _topic.ti_xslt_vector (params); 
-  http_value (
-     WV.WIKI.VSPXSLT ( 'VspTopicAttach.xslt',
-      _topic.ti_report_attachments(),
-      _ext_params));
+  http_value (WV.WIKI.VSPXSLT ( 'VspTopicAttach.xslt', _topic.ti_report_attachments(), _ext_params));
 }
 ;
 
@@ -1528,8 +1541,10 @@ create procedure WV.WIKI.VSPDELETECONFIRM(
   in _xslt_params any)
 {
   http_value (
-     WV.WIKI.VSPXSLT ( 'VspAttachmentDeleteConfirm.xslt',                                                 xtree_doc ('<a/>'),
-      vector_concat (_topic.ti_xslt_vector(_xslt_params), vector ('attachment', _attachment) )));
+    WV.WIKI.VSPXSLT ( 'VspAttachmentDeleteConfirm.xslt',
+    xtree_doc ('<a/>'),
+    vector_concat (_topic.ti_xslt_vector(_xslt_params), vector ('attachment', _attachment)))
+  );
 }
 ;
 
@@ -1704,12 +1719,9 @@ create function WV.WIKI.VSPMAILVIEW (
 
   http_value (
     WV.WIKI.VSPXSLT ('PostProcess.xslt',
-    WV.WIKI.VSPXSLT ( 'VspMail.xslt',
-      _doc,
-      _ext_params),
+      WV.WIKI.VSPXSLT ('VspMail.xslt', _doc, _ext_params),
     _ext_params,
-    coalesce (get_keyword  ('skin2', params), get_keyword ('skin', params), WV.WIKI.CLUSTERPARAM ( _topic.ti_cluster_id , 'skin', 'default' ))));
-
+      WV.WIKI.SKIN_PARAMS (_topic.ti_cluster_id, params)));
 }
 ;
 
@@ -1803,42 +1815,6 @@ _exit:;
 }
 ;
 
---create function WV.WIKI.GET_QHOST (in hostname varchar, in portname varchar)
---{
---  if (portname <> '80')
---    return hostname || ':' || portname;
---  return hostname;
---}
---;
---
----- stolen from Blog2
---create function WV.WIKI.GET_HOST ()
---{
---  declare ret varchar;
---  if (is_http_ctx ())
---    {
---      ret := http_request_header (http_request_header (), 'Host', null, sys_connected_server_address ());
---      if (isstring (ret) and strchr (ret, ':') is null)
---        {
---          declare hp varchar;
---          declare hpa any;
---          hp := sys_connected_server_address ();
---          hpa := split_and_decode (hp, 0, '\0\0:');
---          ret := WV.WIKI.GET_QHOST (ret, hpa[1]);
---        }
---    }
---  else
---   {
---     ret := sys_connected_server_address ();
---     if (ret is null)
---       ret := WV.WIKI.GET_QHOST (sys_stat ('st_host_name'),server_http_port ());
---   }
---
---  return ret;
---}
---;
-
-
 create function WV.WIKI.MAKE_CLUSTER_PATH (in cluster_name varchar)
 {
   declare _clusterPath, _home varchar;
@@ -1985,10 +1961,8 @@ create function WV.WIKI.TEXTFORMATTINGRULES (in _cluster_id int, in _base_adjust
   declare exit handler for sqlstate '*' {
   --dbg_obj_print ('4');
     return '';
-  }
-  ;
-  return  xpath_eval ('//div[@class="topic-text"]', WV.WIKI.VSPXSLT ('VspTopicView.xslt', _topic.ti_get_entity (null,1), 
-	vector_concat (vector ('baseadjust', _base_adjust),_topic.ti_xslt_vector())));
+  };
+  return xpath_eval ('//div[@class="topic-text"]', WV.WIKI.VSPXSLT ('VspTopicView.xslt', _topic.ti_get_entity (null, 1), vector_concat (vector ('baseadjust', _base_adjust), _topic.ti_xslt_vector())));
 }
 ;
 
@@ -2015,7 +1989,6 @@ create function WV.WIKI.DIFF_DAV_PATH (
 }
 ;
 
-				       
 create function WV.WIKI.VSPDIFF (
   inout path any, inout lines any,
   inout _topic WV.WIKI.TOPICINFO,
@@ -2034,27 +2007,22 @@ create function WV.WIKI.VSPDIFF (
   WV.WIKI.CHECKREADACCESS (_uid, _topic.ti_res_id, _topic.ti_cluster_id, _topic.ti_col_id);
   
   declare _auth, _pwd varchar;
-  WV.WIKI.GETDAVAUTH (_auth, _pwd);
-
 
+  WV.WIKI.GETDAVAUTH (_auth, _pwd);
   if (0 < DB.DBA.DAV_RES_CONTENT (WV.WIKI.DIFF_DAV_PATH (_topic, _rev), content, type, _auth, _pwd))
     {
         content := blob_to_string (content);
       declare _report, _xml_content any;
       _xml_content := xtree_doc ('<text><![CDATA[' || content || ']]></text>');
       _report := XMLELEMENT ('Diff',
-			 XMLATTRIBUTES (_rev as "from",
-					cast (_rev as int) + 1 as "to"),
-			 _xml_content);
+    XMLATTRIBUTES (_rev as "from", cast (_rev as int) + 1 as "to"), _xml_content);
       declare _ext_params any;
-      _ext_params := vector_concat (_topic.ti_xslt_vector (params), 
-      	vector ('back_to_rev', 1));
+    _ext_params := vector_concat (_topic.ti_xslt_vector (params), vector ('back_to_rev', 1));
       http_value (
 	  WV.WIKI.VSPXSLT ( 'PostProcess.xslt', 
-	    WV.WIKI.VSPXSLT ( 'VspTopicReports.xslt', _report,
-	      _ext_params),
+        WV.WIKI.VSPXSLT ( 'VspTopicReports.xslt', _report, _ext_params),
 	    _ext_params,
-	    coalesce (get_keyword  ('skin2', params), get_keyword ('skin', params), WV.WIKI.CLUSTERPARAM ( _topic.ti_cluster_id , 'skin', 'default' ))));
+        WV.WIKI.SKIN_PARAMS (_topic.ti_cluster_id, params)));
     }
   return NULL;
 }
@@ -2286,8 +2254,6 @@ create function WV.WIKI.VECTOR_DROP_KEYWORD (in v any, in keyword any)
 }
 ;
 
-  
-
 create procedure WV.WIKI.ADDCATEGORY_PREFIX (in vect_of_words any)
 {
   declare res any;
@@ -2451,7 +2417,6 @@ create function WV.WIKI.FUNCALL4(in procname varchar, in v1 any, in v2 any, in v
 }
 ;
 
-	
 grant execute on WV.WIKI.FUNCALL0 to public
 ;
 grant execute on WV.WIKI.FUNCALL1 to public
diff --git a/appsrc/ODS-Wiki/proc_tmp.sql b/appsrc/ODS-Wiki/proc_tmp.sql
index 38a09a2..6fc975c 100644
--- a/appsrc/ODS-Wiki/proc_tmp.sql
+++ b/appsrc/ODS-Wiki/proc_tmp.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: proc_tmp.sql,v 1.6 2006/06/27 14:41:31 source Exp $
+--  $Id: proc_tmp.sql,v 1.6.2.1 2010/09/20 10:15:47 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/retry.sh b/appsrc/ODS-Wiki/retry.sh
index 431ae0e..26c89f1 100755
--- a/appsrc/ODS-Wiki/retry.sh
+++ b/appsrc/ODS-Wiki/retry.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: retry.sh,v 1.2 2006/05/31 13:13:03 source Exp $
+#  $Id: retry.sh,v 1.2.2.1 2010/09/20 10:15:47 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
diff --git a/appsrc/ODS-Wiki/schema_on.sql b/appsrc/ODS-Wiki/schema_on.sql
index 78eda56..3303402 100644
--- a/appsrc/ODS-Wiki/schema_on.sql
+++ b/appsrc/ODS-Wiki/schema_on.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: schema_on.sql,v 1.16 2008/02/19 11:13:57 source Exp $
+--  $Id: schema_on.sql,v 1.16.2.2 2011/01/31 11:17:53 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -657,7 +657,8 @@ as (
 ;
 
 wiki_exec_no_error ('
-alter type WV.WIKI.TOPICINFO add method ti_register_for_upstream (in optype varchar(1)) returns any')
+  alter type WV.WIKI.TOPICINFO add method ti_register_for_upstream (in optype varchar(1)) returns any'
+)
 ;
 
 wiki_exec_no_error ('
@@ -675,6 +676,11 @@ create table WV..UPSTREAM (
 ;
 
 wiki_exec_no_error ('
+  alter table WV..UPSTREAM add UP_RCLUSTER varchar
+')
+;
+
+wiki_exec_no_error ('
 create table WV..UPSTREAM_ENTRY (
        UE_ID int identity,
        UE_STREAM_ID int references WV..UPSTREAM (UP_ID),
diff --git a/appsrc/ODS-Wiki/semantics.sql b/appsrc/ODS-Wiki/semantics.sql
index d6470b0..02a33ff 100644
--- a/appsrc/ODS-Wiki/semantics.sql
+++ b/appsrc/ODS-Wiki/semantics.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: semantics.sql,v 1.3 2006/08/14 14:33:16 source Exp $
+--  $Id: semantics.sql,v 1.3.2.1 2010/09/20 10:15:47 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/setup.isql b/appsrc/ODS-Wiki/setup.isql
index 292c0be..c76a689 100644
--- a/appsrc/ODS-Wiki/setup.isql
+++ b/appsrc/ODS-Wiki/setup.isql
@@ -1,5 +1,5 @@
 --  
---  $Id: setup.isql,v 1.2 2006/05/31 13:13:03 source Exp $
+--  $Id: setup.isql,v 1.2.2.1 2010/09/20 10:15:47 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/setup_vad.sql b/appsrc/ODS-Wiki/setup_vad.sql
index 3dcba21..cac09f3 100644
--- a/appsrc/ODS-Wiki/setup_vad.sql
+++ b/appsrc/ODS-Wiki/setup_vad.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: setup_vad.sql,v 1.7 2008/01/21 15:35:02 source Exp $
+--  $Id: setup_vad.sql,v 1.7.2.2 2011/01/31 11:17:53 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -20,7 +20,11 @@
 --  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 --  
 --  
-create procedure WV.WIKI.SILENT_EXEC (in code varchar) { whenever sqlstate '*' goto cont; exec (code); commit work; return; cont: rollback work; };
+create procedure WV.WIKI.SILENT_EXEC (in code varchar)
+{
+  whenever sqlstate '*' goto cont; exec (code); commit work; return; cont: rollback work;
+};
+
 create procedure WV.WIKI.USERROLE_DROP (in _role varchar)
 {
   if ((_role is not null) and (_role <> ''))
diff --git a/appsrc/ODS-Wiki/sioc.sql b/appsrc/ODS-Wiki/sioc.sql
index e349a8b..2908341 100644
--- a/appsrc/ODS-Wiki/sioc.sql
+++ b/appsrc/ODS-Wiki/sioc.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sioc.sql,v 1.14.2.2 2009/12/01 14:21:18 source Exp $
+--  $Id: sioc.sql,v 1.14.2.3 2010/09/20 10:15:47 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/upstream.sql b/appsrc/ODS-Wiki/upstream.sql
index c6dbef1..618f98a 100644
--- a/appsrc/ODS-Wiki/upstream.sql
+++ b/appsrc/ODS-Wiki/upstream.sql
@@ -1,7 +1,7 @@
 --
 --  upstream.sql
 --
---  $Id: upstream.sql,v 1.9.2.6 2010/05/26 15:26:09 source Exp $
+--  $Id: upstream.sql,v 1.9.2.8 2011/01/31 11:17:53 source Exp $
 --
 --  Atom publishing protocol support.
 --
@@ -24,13 +24,7 @@
 --  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 --
 
-wiki_exec_no_error ('
-   alter table WV..UPSTREAM add UP_RCLUSTER varchar
-')
-;
-
-use WV
-;
+use WV;
 
 -------------------------------------------------------------------------------
 --
@@ -43,30 +37,30 @@ create method ti_register_for_upstream (in action varchar(1)) returns any for WV
     {
     if (action = 'D')
     {
-      if (exists (select 1 from UPSTREAM_ENTRY where UE_STREAM_ID = UP_ID and UE_TOPIC_ID = self.ti_id and UE_OP = 'I' and UE_STATUS is null))
+      if (exists (select 1 from WV..UPSTREAM_ENTRY where UE_STREAM_ID = UP_ID and UE_TOPIC_ID = self.ti_id and UE_OP = 'I' and UE_STATUS is null))
       {
-        delete from UPSTREAM_ENTRY where UE_STREAM_ID = UP_ID and UE_TOPIC_ID = self.ti_id and UE_STATUS is null;
+        delete from WV..UPSTREAM_ENTRY where UE_STREAM_ID = UP_ID and UE_TOPIC_ID = self.ti_id and UE_STATUS is null;
       }
       else 
       {
-        if (exists (select 1 from UPSTREAM_ENTRY where UE_STREAM_ID = UP_ID and UE_TOPIC_ID = self.ti_id and UE_OP = 'U' and UE_STATUS is null))
+        if (exists (select 1 from WV..UPSTREAM_ENTRY where UE_STREAM_ID = UP_ID and UE_TOPIC_ID = self.ti_id and UE_OP = 'U' and UE_STATUS is null))
         {
-          delete from UPSTREAM_ENTRY where UE_STREAM_ID = UP_ID and UE_TOPIC_ID = self.ti_id and UE_OP = 'U' and UE_STATUS is null;
+          delete from WV..UPSTREAM_ENTRY where UE_STREAM_ID = UP_ID and UE_TOPIC_ID = self.ti_id and UE_OP = 'U' and UE_STATUS is null;
         }
-        insert into UPSTREAM_ENTRY (UE_STREAM_ID, UE_CLUSTER_NAME, UE_LOCAL_NAME, UE_OP)
+        insert into WV..UPSTREAM_ENTRY (UE_STREAM_ID, UE_CLUSTER_NAME, UE_LOCAL_NAME, UE_OP)
           values (UP_ID, self.ti_cluster_name, self.ti_local_name, action);
       }
     }
     else if (action = 'I')
     {
-      insert into UPSTREAM_ENTRY (UE_STREAM_ID, UE_TOPIC_ID, UE_CLUSTER_NAME, UE_LOCAL_NAME, UE_OP)
+      insert into WV..UPSTREAM_ENTRY (UE_STREAM_ID, UE_TOPIC_ID, UE_CLUSTER_NAME, UE_LOCAL_NAME, UE_OP)
         values (UP_ID, self.ti_id, self.ti_cluster_name, self.ti_local_name, action);
     }
     else if (action = 'U')
     {
-      if (not exists (select 1 from UPSTREAM_ENTRY where UE_STREAM_ID = UP_ID and UE_TOPIC_ID = self.ti_id and (UE_OP = 'I' or UE_OP = 'U') and UE_STATUS is null))
+      if (not exists (select 1 from WV..UPSTREAM_ENTRY where UE_STREAM_ID = UP_ID and UE_TOPIC_ID = self.ti_id and (UE_OP = 'I' or UE_OP = 'U') and UE_STATUS is null))
       {
-        insert into UPSTREAM_ENTRY (UE_STREAM_ID, UE_TOPIC_ID, UE_CLUSTER_NAME, UE_LOCAL_NAME, UE_OP)
+        insert into WV..UPSTREAM_ENTRY (UE_STREAM_ID, UE_TOPIC_ID, UE_CLUSTER_NAME, UE_LOCAL_NAME, UE_OP)
           values (UP_ID, self.ti_id, self.ti_cluster_name, self.ti_local_name, action);
       }
     }
@@ -78,7 +72,7 @@ create method ti_register_for_upstream (in action varchar(1)) returns any for WV
 --
 create procedure WV..PROCESS_UPSTREAMS ()
 {
-  declare cr static cursor for select UE_ID, UE_STREAM_ID, UE_TOPIC_ID, UE_LOCAL_NAME, UE_OP from UPSTREAM_ENTRY where UE_STATUS is null order by UE_ID;
+  declare cr static cursor for select UE_ID, UE_STREAM_ID, UE_TOPIC_ID, UE_LOCAL_NAME, UE_OP from WV..UPSTREAM_ENTRY where UE_STATUS is null order by UE_ID;
   
   declare id, streamID, topicID, res int;
   declare localName, action varchar;
@@ -94,7 +88,7 @@ _again:
   close cr;
 
   res := WV..PROCESS_UPSTREAM_ENTRY (action, streamID, topicID, localName);
-  update UPSTREAM_ENTRY set UE_LAST_TRY = now(), UE_STATUS = res where UE_ID = id;
+  update WV..UPSTREAM_ENTRY set UE_LAST_TRY = now(), UE_STATUS = res where UE_ID = id;
   commit work;
   open cr (exclusive, prefetch 1);
   fetch cr bookmark bm into id, streamID, topicID, localName, action;
@@ -109,10 +103,10 @@ _complete:
 --
 create procedure WV..UPSTREAM_SCHEDULED_JOB ()
 {
-  delete from UPSTREAM_ENTRY where UE_STATUS = 1;
+  delete from WV..UPSTREAM_ENTRY where UE_STATUS = 1;
   commit work;
   PROCESS_UPSTREAMS();
-  update UPSTREAM_ENTRY set UE_STATUS = null where UE_STATUS <> 1;
+  update WV..UPSTREAM_ENTRY set UE_STATUS = null where UE_STATUS <> 1;
 }
 ;
 
@@ -121,10 +115,10 @@ create procedure WV..UPSTREAM_SCHEDULED_JOB ()
 create procedure WV.WIKI.UPSTREAM_TOPIC_NOW (
   in topicID integer)
 {
-  delete from UPSTREAM_ENTRY where UE_STATUS = 1 and UE_TOPIC_ID = topicID;
+  delete from WV..UPSTREAM_ENTRY where UE_STATUS = 1 and UE_TOPIC_ID = topicID;
   commit work;
 
-  declare cr static cursor for select UE_ID, UE_STREAM_ID, UE_LOCAL_NAME, UE_OP from UPSTREAM_ENTRY where UE_STATUS is null and UE_TOPIC_ID = topicID order by UE_ID;
+  declare cr static cursor for select UE_ID, UE_STREAM_ID, UE_LOCAL_NAME, UE_OP from WV..UPSTREAM_ENTRY where UE_STATUS is null and UE_TOPIC_ID = topicID order by UE_ID;
 
   declare id, streamID, res integer;
   declare localName, action varchar;
@@ -140,7 +134,7 @@ _again:
   close cr;
 
   res := WV..PROCESS_UPSTREAM_ENTRY (action, streamID, topicID, localName);
-  update UPSTREAM_ENTRY set UE_LAST_TRY = now(), UE_STATUS = res where UE_ID = id and UE_TOPIC_ID = topicID;
+  update WV..UPSTREAM_ENTRY set UE_LAST_TRY = now(), UE_STATUS = res where UE_ID = id and UE_TOPIC_ID = topicID;
   commit work;
   open cr (exclusive, prefetch 1);
   fetch cr bookmark bm into id, streamID, localName, action;
@@ -148,7 +142,7 @@ _again:
 
 _complete:
   close cr;
-  update UPSTREAM_ENTRY set UE_STATUS = null where UE_STATUS <> 1 and UE_TOPIC_ID = topicID;
+  update WV..UPSTREAM_ENTRY set UE_STATUS = null where UE_STATUS <> 1 and UE_TOPIC_ID = topicID;
 }
 ;
 
@@ -184,7 +178,7 @@ create procedure WV..PROCESS_UPSTREAM_ENTRY (
     }
     else if (action = 'U')
     {
-      rc := WV..PROCESS_ATOM_ENTRY ('PUT', streamID, topic, coalesce (topic.ti_local_name, localName));
+      rc := WV..PROCESS_ATOM_ENTRY ('POST', streamID, topic, coalesce (topic.ti_local_name, localName));
     }
   }
 _next:
@@ -369,7 +363,7 @@ create procedure WV..UPSTREAM_ALL (
 {
   for (select topicID from WV.WIKI.TOPIC, UPSTREAM where CLUSTERID = UP_CLUSTER_ID and UP_ID = streamID) do
 {
-      insert into UPSTREAM_ENTRY (UE_STREAM_ID, UE_TOPIC_ID, UE_OP)
+    insert into WV..UPSTREAM_ENTRY (UE_STREAM_ID, UE_TOPIC_ID, UE_OP)
       values (streamID, topicID, 'I');
   }
 }
@@ -379,10 +373,6 @@ create procedure WV..UPSTREAM_ALL (
 insert replacing DB.DBA.SYS_SCHEDULED_EVENT (SE_NAME, SE_START, SE_SQL, SE_INTERVAL) values ('wiki upstream', now(), 'WV..UPSTREAM_SCHEDULED_JOB()', 5)
 ;
 
-
-use DB
-;
-
 create trigger WIKI_UPSTREAM_D before delete on WV..UPSTREAM order 10 referencing old as O
 {
    delete from WV..UPSTREAM_ENTRY where UE_STREAM_ID = O.UP_ID;
diff --git a/appsrc/ODS-Wiki/vad_version b/appsrc/ODS-Wiki/vad_version
index 7142cfd..dbe0684 100644
--- a/appsrc/ODS-Wiki/vad_version
+++ b/appsrc/ODS-Wiki/vad_version
@@ -1 +1 @@
-1.05.4464
+1.05.4514
diff --git a/appsrc/ODS-Wiki/version.curr b/appsrc/ODS-Wiki/version.curr
index a63b563..bc14fa0 100644
--- a/appsrc/ODS-Wiki/version.curr
+++ b/appsrc/ODS-Wiki/version.curr
@@ -1 +1 @@
-4464
+4514
diff --git a/appsrc/ODS-Wiki/wa_integration.sql b/appsrc/ODS-Wiki/wa_integration.sql
index fd0c455..97a69b6 100644
--- a/appsrc/ODS-Wiki/wa_integration.sql
+++ b/appsrc/ODS-Wiki/wa_integration.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: wa_integration.sql,v 1.26.2.1 2010/02/02 19:41:07 source Exp $
+--  $Id: wa_integration.sql,v 1.26.2.2 2010/09/20 10:15:48 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/wa_search_wiki.sql b/appsrc/ODS-Wiki/wa_search_wiki.sql
index 0604ea6..7456cef 100644
--- a/appsrc/ODS-Wiki/wa_search_wiki.sql
+++ b/appsrc/ODS-Wiki/wa_search_wiki.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: wa_search_wiki.sql,v 1.4 2006/08/14 14:33:16 source Exp $
+--  $Id: wa_search_wiki.sql,v 1.4.2.1 2010/09/20 10:15:48 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/appsrc/ODS-Wiki/webmail.sql b/appsrc/ODS-Wiki/webmail.sql
index dd7608f..0b7fd24 100644
--- a/appsrc/ODS-Wiki/webmail.sql
+++ b/appsrc/ODS-Wiki/webmail.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: webmail.sql,v 1.5 2008/04/17 09:07:09 source Exp $
+--  $Id: webmail.sql,v 1.5.2.1 2010/09/20 10:15:48 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/binsrc/Makefile.in b/binsrc/Makefile.in
index 1594d6f..98c4828 100644
--- a/binsrc/Makefile.in
+++ b/binsrc/Makefile.in
@@ -200,6 +200,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/VirtuosoClient.Net/BufferType.cs b/binsrc/VirtuosoClient.Net/BufferType.cs
index 0b28482..57a1a37 100644
--- a/binsrc/VirtuosoClient.Net/BufferType.cs
+++ b/binsrc/VirtuosoClient.Net/BufferType.cs
@@ -19,7 +19,7 @@
 //  
 //  
 //
-// $Id: BufferType.cs,v 1.3.2.1 2009/06/15 13:24:12 source Exp $
+// $Id: BufferType.cs,v 1.3.2.2 2011/03/14 15:53:52 source Exp $
 //
 
 using System;
@@ -114,10 +114,12 @@ namespace OpenLink.Data.Virtuoso
 				    value.ToString ()));
 				return Convert.ChangeType (value, value.GetType());
 			  }
-                        if (value is SqlExtendedString)
+            if (value is SqlExtendedString)
 				return value;
-                        if (value is SqlRdfBox)
+            if (value is SqlRdfBox)
 				return value;
+            if (value is System.Byte[] && type != value.GetType())
+                return value;
 			if (type == typeof (string))
 				return value.ToString ();
 
diff --git a/binsrc/VirtuosoClient.Net/ConnectionOptions.cs b/binsrc/VirtuosoClient.Net/ConnectionOptions.cs
index b480fb3..d2b5700 100644
--- a/binsrc/VirtuosoClient.Net/ConnectionOptions.cs
+++ b/binsrc/VirtuosoClient.Net/ConnectionOptions.cs
@@ -19,7 +19,7 @@
 //  
 //  
 //
-// $Id: ConnectionOptions.cs,v 1.3.2.2 2010/03/01 00:31:41 source Exp $
+// $Id: ConnectionOptions.cs,v 1.3.2.4 2010/12/21 12:29:58 source Exp $
 //
 
 using System;
@@ -187,14 +187,20 @@ namespace OpenLink.Data.Virtuoso
 		internal const string ENCRYPT = "Encrypt";
 		internal const string PERSISTSECURITYINFO = "PersistSecurityInfo";
 		internal const string PERSIST_SECURITY_INFO = "Persist Security Info";
-		internal const string CONNECTTIMEOUT = "Connect Timeout";
-		internal const string CONNECTIONTIMEOUT = "Connection Timeout";
-		internal const string CONNECTIONLIFETIME = "Connection Lifetime";
-		internal const string MINPOOLSIZE = "Min Pool Size";
-		internal const string MAXPOOLSIZE = "Max Pool Size";
+		internal const string CONNECTTIMEOUT = "ConnectTimeout";
+		internal const string CONNECT_TIMEOUT = "Connect Timeout";
+		internal const string CONNECTIONTIMEOUT = "ConnectionTimeout";
+		internal const string CONNECTION_TIMEOUT = "Connection Timeout";
+		internal const string CONNECTIONLIFETIME = "ConnectionLifetime";
+		internal const string CONNECTION_LIFETIME = "Connection Lifetime";
+		internal const string MINPOOLSIZE = "MinPoolSize";
+		internal const string MIN_POOL_SIZE = "Min Pool Size";
+		internal const string MAXPOOLSIZE = "MaxPoolSize";
+		internal const string MAX_POOL_SIZE = "Max Pool Size";
 		internal const string POOLING = "Pooling";
 		internal const string ENLIST = "Enlist";
-		internal const string ROUNDROBIN = "Round Robin";
+		internal const string ROUNDROBIN = "RoundRobin";
+		internal const string ROUND_ROBIN = "Round Robin";
 
 		private BooleanOption odbc;
 		private ListOption host;
@@ -262,13 +268,19 @@ namespace OpenLink.Data.Virtuoso
 			options.Add (PERSISTSECURITYINFO, persistSecurityInfo);
 			options.Add (PERSIST_SECURITY_INFO, persistSecurityInfo);
 			options.Add (CONNECTTIMEOUT, connectionTimeout);
+			options.Add (CONNECT_TIMEOUT, connectionTimeout);
 			options.Add (CONNECTIONTIMEOUT, connectionTimeout);
+			options.Add (CONNECTION_TIMEOUT, connectionTimeout);
 			options.Add (CONNECTIONLIFETIME, connectionLifetime);
+			options.Add (CONNECTION_LIFETIME, connectionLifetime);
 			options.Add (MINPOOLSIZE, minPoolSize);
+			options.Add (MIN_POOL_SIZE, minPoolSize);
 			options.Add (MAXPOOLSIZE, maxPoolSize);
+			options.Add (MAX_POOL_SIZE, maxPoolSize);
 			options.Add (POOLING, pooling);
 			options.Add (ENLIST, enlist);
 			options.Add (ROUNDROBIN, roundrobin);
+			options.Add (ROUND_ROBIN, roundrobin);
 		}
 
 		internal void Reset ()
diff --git a/binsrc/VirtuosoClient.Net/IInnerConnection.cs b/binsrc/VirtuosoClient.Net/IInnerConnection.cs
index 32ec76a..01a02ad 100644
--- a/binsrc/VirtuosoClient.Net/IInnerConnection.cs
+++ b/binsrc/VirtuosoClient.Net/IInnerConnection.cs
@@ -19,7 +19,7 @@
 //  
 //  
 //
-// $Id: IInnerConnection.cs,v 1.3 2009/01/22 23:00:18 source Exp $
+// $Id: IInnerConnection.cs,v 1.3.2.2 2010/12/17 17:40:44 source Exp $
 //
 
 using System;
diff --git a/binsrc/VirtuosoClient.Net/InnerConnectionBase.cs b/binsrc/VirtuosoClient.Net/InnerConnectionBase.cs
index 95df7a5..80f2314 100644
--- a/binsrc/VirtuosoClient.Net/InnerConnectionBase.cs
+++ b/binsrc/VirtuosoClient.Net/InnerConnectionBase.cs
@@ -19,7 +19,7 @@
 //  
 //  
 //
-// $Id: InnerConnectionBase.cs,v 1.3 2009/01/22 23:00:18 source Exp $
+// $Id: InnerConnectionBase.cs,v 1.3.2.2 2010/12/17 17:40:44 source Exp $
 //
 
 using System;
diff --git a/binsrc/VirtuosoClient.Net/Makefile.in b/binsrc/VirtuosoClient.Net/Makefile.in
index 6b7030a..0f7cff3 100644
--- a/binsrc/VirtuosoClient.Net/Makefile.in
+++ b/binsrc/VirtuosoClient.Net/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/VirtuosoClient.Net/ManagedCommand.cs b/binsrc/VirtuosoClient.Net/ManagedCommand.cs
index 8ba0fd7..c600371 100644
--- a/binsrc/VirtuosoClient.Net/ManagedCommand.cs
+++ b/binsrc/VirtuosoClient.Net/ManagedCommand.cs
@@ -19,7 +19,7 @@
 //  
 //  
 //
-// $Id: ManagedCommand.cs,v 1.3.2.1 2010/02/11 16:25:01 source Exp $
+// $Id: ManagedCommand.cs,v 1.3.2.4 2011/02/16 20:44:35 source Exp $
 //
 
 using System;
@@ -325,7 +325,7 @@ namespace OpenLink.Data.Virtuoso
 				  Cancel ();
             }
 
-			if (pendingFuture != null)
+			if (pendingFuture != null && connection.futures != null)
 			{
 				connection.futures.Remove (pendingFuture);
 				pendingFuture = null;
@@ -372,6 +372,9 @@ namespace OpenLink.Data.Virtuoso
 			else
 			{
 				Debug.Assert (column.bufferType != null);
+				if (data is DateTimeMarshaler)
+                                  data = ((IConvertData)data).ConvertData(typeof(DateTime));
+				else
 				data = column.bufferType.ConvertValue (data);
 			}
 			return data;
diff --git a/binsrc/VirtuosoClient.Net/ManagedConnection.cs b/binsrc/VirtuosoClient.Net/ManagedConnection.cs
index 52bba77..7e7b36a 100644
--- a/binsrc/VirtuosoClient.Net/ManagedConnection.cs
+++ b/binsrc/VirtuosoClient.Net/ManagedConnection.cs
@@ -19,7 +19,7 @@
 //  
 //  
 //
-// $Id: ManagedConnection.cs,v 1.5.2.1 2010/02/09 16:13:47 source Exp $
+// $Id: ManagedConnection.cs,v 1.5.2.3 2010/12/17 17:40:44 source Exp $
 //
 
 using System;
@@ -273,32 +273,32 @@ namespace OpenLink.Data.Virtuoso
 		{
 		        Debug.WriteLineIf (CLI.FnTrace.Enabled, String.Format (
 			      "ManagedConnection.EndTransaction ({0})", commit));
-			CLI.CompletionType completion = commit ? 
-			    CLI.CompletionType.SQL_COMMIT : 
-			    CLI.CompletionType.SQL_ROLLBACK;
-			Future future = new Future (
-			    Service.Transaction, (int) completion, null);
-			object result = null;
-			try 
-			{
-				futures.Add (future);
-				future.SendRequest (Session);
-				result = future.GetNextResult (Session, futures);
-				Debug.WriteLineIf (CLI.FnTrace.Enabled, String.Format (
+			  CLI.CompletionType completion = commit ? 
+			      CLI.CompletionType.SQL_COMMIT : 
+			      CLI.CompletionType.SQL_ROLLBACK;
+			  Future future = new Future (
+			      Service.Transaction, (int) completion, null);
+			  object result = null;
+			  try 
+			  {
+			 	  futures.Add (future);
+				  future.SendRequest (Session);
+				  result = future.GetNextResult (Session, futures);
+				  Debug.WriteLineIf (CLI.FnTrace.Enabled, String.Format (
 				      "ManagedConnection.EndTransaction ({0}) success", commit));
-			}
-			finally
-			{
-				futures.Remove (future);
-			}
-			if (result is object[])
-			{
-			  Debug.WriteLineIf (CLI.FnTrace.Enabled, String.Format (
+			  }
+			  finally
+			  {
+				  futures.Remove (future);
+			  }
+			  if (result is object[])
+			  {
+			    Debug.WriteLineIf (CLI.FnTrace.Enabled, String.Format (
 				"ManagedConnection.EndTransaction ({0}) error", commit));
-				object[] results = (object[]) result;
-				errors.AddServerError ((string) results[1], null, (string) results[2]);
-				Diagnostics.HandleErrors (CLI.ReturnCode.SQL_ERROR, this);
-			}
+				  object[] results = (object[]) result;
+				  errors.AddServerError ((string) results[1], null, (string) results[2]);
+				  Diagnostics.HandleErrors (CLI.ReturnCode.SQL_ERROR, this);
+			  }
 
 			autocommit = true;
 			isolation = CLI.IsolationLevel.SQL_TXN_READ_COMMITED;
diff --git a/binsrc/VirtuosoClient.Net/RPC.cs b/binsrc/VirtuosoClient.Net/RPC.cs
index 149b784..efb8a4a 100644
--- a/binsrc/VirtuosoClient.Net/RPC.cs
+++ b/binsrc/VirtuosoClient.Net/RPC.cs
@@ -19,7 +19,7 @@
 //  
 //  
 //
-// $Id: RPC.cs,v 1.5 2009/02/06 15:37:37 source Exp $
+// $Id: RPC.cs,v 1.5.2.1 2011/02/16 20:44:36 source Exp $
 //
 
 using System;
@@ -88,6 +88,7 @@ namespace OpenLink.Data.Virtuoso
 		DV_IRI_ID_8 = 244,
 		DV_INT64    = 247,
 		DV_RDF	= 246,
+		DV_ANY	= 242,
                 
 	}
 
diff --git a/binsrc/VirtuosoClient.Net/VirtuosoCommand.cs b/binsrc/VirtuosoClient.Net/VirtuosoCommand.cs
index 7a3e821..e55f73f 100644
--- a/binsrc/VirtuosoClient.Net/VirtuosoCommand.cs
+++ b/binsrc/VirtuosoClient.Net/VirtuosoCommand.cs
@@ -19,7 +19,7 @@
 //  
 //  
 //
-// $Id: VirtuosoCommand.cs,v 1.7.2.1 2010/04/16 12:36:08 source Exp $
+// $Id: VirtuosoCommand.cs,v 1.7.2.2 2011/02/21 13:36:39 source Exp $
 //
 
 using System;
@@ -32,6 +32,7 @@ using System.Text;
 using System.ComponentModel;
 using System.Drawing;
 #endif
+using System.Text.RegularExpressions;
 
 #if ODBC_CLIENT
 namespace OpenLink.Data.VirtuosoOdbcClient
@@ -462,11 +463,18 @@ namespace OpenLink.Data.Virtuoso
 			{
 				if (!isPrepared)
 				{
+					text = replaceNamedParams (text);
 					innerCommand.Prepare (text);
 				}
 			}
 			else
 			{
+				if (parameters != null && parameters.Count > 0)
+				{
+					VirtuosoParameterCollection _parameters = handleNamedParams (text, parameters);
+					Debug.Assert (_parameters.Count == parameters.Count, "Count mismatch in reordered parameter array");
+					text = replaceNamedParams(text);
+				}
 				innerCommand.SetParameters (parameters);
 				if (!isPrepared)
 				{
@@ -702,5 +710,52 @@ innerCommand != null)
                     }
                 }
 #endif
+
+		// Replaces any '@<name>' named parameters in the SQL command 
+		// with '?' placeholders.
+		internal string replaceNamedParams (string sql) 
+		{
+			string paramPattern = @"@\w+";
+			Regex paramRegEx = new Regex(paramPattern);
+			return paramRegEx.Replace(sql, "?");
+		}
+
+		// Reorders the parameter collection so that the order of named
+		// parameters in the collection matches their order in the SQL 
+		// command.
+		internal VirtuosoParameterCollection handleNamedParams (string sql, VirtuosoParameterCollection _parameters)
+		{
+			string paramPattern = @"@\w+";
+			Regex paramRegEx =  new Regex(paramPattern);
+			Match match = paramRegEx.Match(sql);
+
+			// If statement doesn't contain any named parameters
+			if (!match.Success)
+				return _parameters;
+
+			VirtuosoParameterCollection newParameters = new VirtuosoParameterCollection (this);
+
+			while(match.Success)
+			{ 
+				string paramName = String.Copy(match.Value);
+
+				if (_parameters.IndexOf (paramName) >= 0)
+					newParameters.Add (_parameters[_parameters.IndexOf (paramName)]);
+				else
+				{
+					// Seems param name saved in parameter 
+					// collection may or may not have a 
+					// leading @
+					string paramNameWithoutPrefix = String.Copy(paramName.Substring(1));
+					if (_parameters.IndexOf (paramNameWithoutPrefix) >= 0)
+					newParameters.Add (_parameters[_parameters.IndexOf (paramNameWithoutPrefix)]);
+				}
+
+		 		match = match.NextMatch();
+			}
+   
+			return newParameters;
+		}
+
 	}
 }
diff --git a/binsrc/VirtuosoClient.Net/VirtuosoConnection.cs b/binsrc/VirtuosoClient.Net/VirtuosoConnection.cs
index 58fa0d8..693f533 100644
--- a/binsrc/VirtuosoClient.Net/VirtuosoConnection.cs
+++ b/binsrc/VirtuosoClient.Net/VirtuosoConnection.cs
@@ -19,7 +19,7 @@
 //  
 //  
 //
-// $Id: VirtuosoConnection.cs,v 1.10.2.2 2010/04/16 12:33:54 source Exp $
+// $Id: VirtuosoConnection.cs,v 1.10.2.4 2010/12/17 17:40:44 source Exp $
 //
 
 using System;
diff --git a/binsrc/VirtuosoClient.Net/VirtuosoConnectionStringBuilder.cs b/binsrc/VirtuosoClient.Net/VirtuosoConnectionStringBuilder.cs
index fd97e1b..20de9b9 100644
--- a/binsrc/VirtuosoClient.Net/VirtuosoConnectionStringBuilder.cs
+++ b/binsrc/VirtuosoClient.Net/VirtuosoConnectionStringBuilder.cs
@@ -19,7 +19,7 @@
 //  
 //  
 //
-// $Id: VirtuosoConnectionStringBuilder.cs,v 1.3.2.1 2010/03/01 00:31:41 source Exp $
+// $Id: VirtuosoConnectionStringBuilder.cs,v 1.3.2.2 2010/12/17 17:40:44 source Exp $
 //
 
 using System;
@@ -263,7 +263,7 @@ namespace OpenLink.Data.Virtuoso
     {
         get
         {
-            string key = ConnectionOptions.CONNECTIONTIMEOUT;
+            string key = ConnectionOptions.CONNECTION_TIMEOUT;
             if (ContainsKey(ConnectionOptions.CONNECTTIMEOUT))
                key = ConnectionOptions.CONNECTTIMEOUT;
 
@@ -288,7 +288,7 @@ namespace OpenLink.Data.Virtuoso
         }
         set 
 		{ 
-            string key = ConnectionOptions.CONNECTIONTIMEOUT;
+            string key = ConnectionOptions.CONNECTION_TIMEOUT;
             if (ContainsKey(ConnectionOptions.CONNECTTIMEOUT))
                key = ConnectionOptions.CONNECTTIMEOUT;
 
@@ -300,8 +300,12 @@ namespace OpenLink.Data.Virtuoso
     {
         get
         {
+            string key = ConnectionOptions.CONNECTION_LIFETIME;
+            if (ContainsKey(ConnectionOptions.CONNECTIONLIFETIME))
+               key = ConnectionOptions.CONNECTIONLIFETIME;
+
             object value;
-            if (base.TryGetValue(ConnectionOptions.CONNECTIONLIFETIME, out value))
+            if (base.TryGetValue(key, out value))
             {
                if (value is uint)
                    return (uint)value;
@@ -311,22 +315,32 @@ namespace OpenLink.Data.Virtuoso
                    uintVal = (uint)ConnectionOptions.DEFAULT_CONN_LIFETIME;
 
                // Change the stored value type to uint.
-               this[ConnectionOptions.CONNECTIONLIFETIME] = uintVal;
+               this[key] = uintVal;
                return uintVal;
             }
             else
                return (uint)ConnectionOptions.DEFAULT_CONN_LIFETIME;
 
         }
-        set { this[ConnectionOptions.CONNECTIONLIFETIME] = value; }
+        set 
+        { 
+            string key = ConnectionOptions.CONNECTION_LIFETIME;
+            if (ContainsKey(ConnectionOptions.CONNECTIONLIFETIME))
+               key = ConnectionOptions.CONNECTIONLIFETIME;
+            this[key] = value; 
+        }
     }
 
     public uint MinPoolSize
     {
         get
         {
+            string key = ConnectionOptions.MIN_POOL_SIZE;
+            if (ContainsKey(ConnectionOptions.MINPOOLSIZE))
+               key = ConnectionOptions.MINPOOLSIZE;
+
             object value;
-            if (base.TryGetValue(ConnectionOptions.MINPOOLSIZE, out value))
+            if (base.TryGetValue(key, out value))
             {
                if (value is uint)
                    return (uint)value;
@@ -336,21 +350,31 @@ namespace OpenLink.Data.Virtuoso
                    uintVal = (uint)ConnectionOptions.DEFAULT_MIN_POOL_SIZE;
 
                // Change the stored value type to uint.
-               this[ConnectionOptions.MINPOOLSIZE] = uintVal;
+               this[key] = uintVal;
                return uintVal;
             }
             else
                return (uint)ConnectionOptions.DEFAULT_MIN_POOL_SIZE;
         }
-        set { this[ConnectionOptions.MINPOOLSIZE] = value; }
+        set 
+        { 
+            string key = ConnectionOptions.MIN_POOL_SIZE;
+            if (ContainsKey(ConnectionOptions.MINPOOLSIZE))
+               key = ConnectionOptions.MINPOOLSIZE;
+            this[key] = value; 
+        }
     }
 
     public uint MaxPoolSize
     {
         get
         {
+            string key = ConnectionOptions.MAX_POOL_SIZE;
+            if (ContainsKey(ConnectionOptions.MAXPOOLSIZE))
+               key = ConnectionOptions.MAXPOOLSIZE;
+
             object value;
-            if (base.TryGetValue(ConnectionOptions.MAXPOOLSIZE.ToString(), out value))
+            if (base.TryGetValue(key.ToString(), out value))
             {
                if (value is uint)
                    return (uint)value;
@@ -360,13 +384,19 @@ namespace OpenLink.Data.Virtuoso
                    uintVal = (uint)ConnectionOptions.DEFAULT_MAX_POOL_SIZE;
 
                // Change the stored value type to uint.
-               this[ConnectionOptions.MAXPOOLSIZE] = uintVal;
+               this[key] = uintVal;
                return uintVal;
             }
             else
                return (uint)ConnectionOptions.DEFAULT_MAX_POOL_SIZE;
         }
-        set { this[ConnectionOptions.MAXPOOLSIZE] = value; }
+        set 
+        { 
+            string key = ConnectionOptions.MAX_POOL_SIZE;
+            if (ContainsKey(ConnectionOptions.MAXPOOLSIZE))
+               key = ConnectionOptions.MAXPOOLSIZE;
+            this[key] = value; 
+        }
     }
 
     public bool Pooling
@@ -419,8 +449,12 @@ namespace OpenLink.Data.Virtuoso
     {
         get
         {
+            string key = ConnectionOptions.ROUND_ROBIN;
+            if (ContainsKey(ConnectionOptions.ROUNDROBIN))
+               key = ConnectionOptions.ROUNDROBIN;
+
             object value;
-            if (base.TryGetValue(ConnectionOptions.ROUNDROBIN, out value))
+            if (base.TryGetValue(key, out value))
             {
                 if (value is bool)
                     return (bool)value;
@@ -429,13 +463,19 @@ namespace OpenLink.Data.Virtuoso
 				if (!bool.TryParse(value.ToString(), out bVal))
 				    bVal = ConnectionOptions.DEFAULT_ROUND_ROBIN;
 				// Change the stored value type to bool.
-				this[ConnectionOptions.ROUNDROBIN] = bVal;
+				this[key] = bVal;
 				return bVal;
 			}
            return ConnectionOptions.DEFAULT_ROUND_ROBIN;
 
         }
-        set { this[ConnectionOptions.ROUNDROBIN] = value; }
+        set 
+        { 
+           string key = ConnectionOptions.ROUND_ROBIN;
+           if (ContainsKey(ConnectionOptions.ROUNDROBIN))
+               key = ConnectionOptions.ROUNDROBIN;
+           this[key] = value; 
+        }
     }
 
 #endregion
diff --git a/binsrc/VirtuosoClient.Net/VirtuosoDataAdapter.cs b/binsrc/VirtuosoClient.Net/VirtuosoDataAdapter.cs
index 3996f18..e20de4f 100644
--- a/binsrc/VirtuosoClient.Net/VirtuosoDataAdapter.cs
+++ b/binsrc/VirtuosoClient.Net/VirtuosoDataAdapter.cs
@@ -19,7 +19,7 @@
 //  
 //  
 // 
-// $Id: VirtuosoDataAdapter.cs,v 1.4 2008/12/15 10:10:45 source Exp $
+// $Id: VirtuosoDataAdapter.cs,v 1.4.2.1 2010/12/07 11:31:19 source Exp $
 //
 
 using System;
@@ -42,7 +42,7 @@ namespace OpenLink.Data.Virtuoso
 {
     public sealed class VirtuosoConstants
     {
-        public const string AssemblyVersion = "5.5.3015.1";
+        public const string AssemblyVersion = "06.02.3128.1";
         public const string VirtuosoDesignSN = 
             VirtuosoDesignNSPrefix 
             + ", Version=" + AssemblyVersion
diff --git a/binsrc/VirtuosoClient.Net/VirtuosoDataReader.cs b/binsrc/VirtuosoClient.Net/VirtuosoDataReader.cs
index 2d7fdff..4da9cba 100644
--- a/binsrc/VirtuosoClient.Net/VirtuosoDataReader.cs
+++ b/binsrc/VirtuosoClient.Net/VirtuosoDataReader.cs
@@ -19,12 +19,13 @@
 //  
 //  
 //
-// $Id: VirtuosoDataReader.cs,v 1.7.2.2 2009/08/19 07:32:24 source Exp $
+// $Id: VirtuosoDataReader.cs,v 1.7.2.4 2011/03/14 15:53:52 source Exp $
 //
 
 using System;
 using System.Data;
 using System.Data.Common;
+using System.Text;
 
 using System.Diagnostics;
 using System.Runtime.InteropServices;
@@ -741,8 +742,21 @@ namespace OpenLink.Data.Virtuoso
 			object cd = GetColumnData (i);
 			if (cd is String)
 			  return (String) cd;
-			else
-			  return cd.ToString ();
+            else if (cd is System.Byte[])
+            {
+                byte[] v = (byte[])cd;
+                StringBuilder buf = new StringBuilder(v.Length*2);
+                string hex = "0123456789ABCDEF";
+
+                for (int j = 0; j < v.Length; j++)
+                {
+                  buf.Append(hex[(v[j] >> 4) & 0x0f]);
+                  buf.Append(hex[v[j] & 0x0f]);
+                }
+                return buf.ToString();
+            }
+            else
+                return cd.ToString();
 		}
 
 #if ADONET2
@@ -845,14 +859,38 @@ namespace OpenLink.Data.Virtuoso
                 		if (column.data is IConvertData)
                     			return ((IConvertData)column.data).ConvertData(type);
                 		else if (column.data is IConvertible)
+                          {
+                            switch (column.data.GetType().FullName)
+                            {
+                                case "System.Int32":
+                                case "System.Single":
+                                case "System.Double":
+                                case "System.Decimal":
+                                case "System.DateTime":
+                                case "System.TimeSpan":
+                                    return column.data;
+                                default:
                     			return Convert.ChangeType(column.data, type);
+                            }
+                          }
                         	else if (column.data is SqlExtendedString)
                                 	return column.data;
                         	else if (column.data is SqlRdfBox)
                                 	return column.data;
                 		else
+                          {
+                            switch (column.data.GetType().FullName)
+                            {
+                                case "System.DateTime":
+                                case "System.DateTimeOffset":
+                                case "System.TimeSpan":
+                                case "System.Byte[]":
+                                    return column.data;
+                                default:
                     			return column.data.ToString();
             		}
+                          }
+            		}
             		else
 				return column.data;
 		}
diff --git a/binsrc/VirtuosoClient.Net/VirtuosoTransaction.cs b/binsrc/VirtuosoClient.Net/VirtuosoTransaction.cs
index de3a785..80d1c34 100644
--- a/binsrc/VirtuosoClient.Net/VirtuosoTransaction.cs
+++ b/binsrc/VirtuosoClient.Net/VirtuosoTransaction.cs
@@ -19,7 +19,7 @@
 //  
 //  
 //
-// $Id: VirtuosoTransaction.cs,v 1.3 2008/12/15 10:10:45 source Exp $
+// $Id: VirtuosoTransaction.cs,v 1.3.2.2 2010/12/17 17:40:44 source Exp $
 //
 
 using System;
diff --git a/binsrc/b3s/Makefile.in b/binsrc/b3s/Makefile.in
index ac328ac..72dbf57 100644
--- a/binsrc/b3s/Makefile.in
+++ b/binsrc/b3s/Makefile.in
@@ -186,6 +186,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/b3s/VirtTripleLoader/src/virtTripleLoaderInit/VirtTripleLoaderInit.java b/binsrc/b3s/VirtTripleLoader/src/virtTripleLoaderInit/VirtTripleLoaderInit.java
index bf6516b..c0b2426 100644
--- a/binsrc/b3s/VirtTripleLoader/src/virtTripleLoaderInit/VirtTripleLoaderInit.java
+++ b/binsrc/b3s/VirtTripleLoader/src/virtTripleLoaderInit/VirtTripleLoaderInit.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtTripleLoaderInit.java,v 1.1.2.2 2010/02/01 12:44:31 source Exp $
+ *  $Id: VirtTripleLoaderInit.java,v 1.1.2.3 2011/03/08 15:43:44 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -84,7 +84,7 @@ public class VirtTripleLoaderInit {
 	private static final Integer myMajorVer = 0;
 	private static final Integer myMinorVer = 1;
 	private static final Integer myBuild = 0;
-	private static final String myCopyright = "Copyright (c) 2008-2010 OpenLink Software";
+	private static final String myCopyright = "Copyright (c) 2008-2011 OpenLink Software";
 
 	private static final String virtConnectUrlDef = "jdbc:virtuoso://neo:1111";
 	private static final String virtUserDef = "dba";
diff --git a/binsrc/b3s/bbc_demo_queries.vsp b/binsrc/b3s/bbc_demo_queries.vsp
index d461c30..60eff72 100644
--- a/binsrc/b3s/bbc_demo_queries.vsp
+++ b/binsrc/b3s/bbc_demo_queries.vsp
@@ -140,7 +140,7 @@ where {
         <img alt="Linked Data" src="/fct/images/LoDLogo.gif"/>
       </a>
       <br/>
-      <span class="copyright">Copyright © 2010 OpenLink Software</span>
+      <span class="copyright">Copyright © 2009-2011 OpenLink Software</span>
       <div id="FT_L"/>
       <div id="FT_R"/>
     </div> <!-- #FT -->
diff --git a/binsrc/b3s/cl_prx.sql b/binsrc/b3s/cl_prx.sql
index 3a3f240..862675b 100644
--- a/binsrc/b3s/cl_prx.sql
+++ b/binsrc/b3s/cl_prx.sql
@@ -1,5 +1,5 @@
 --
---  $Id: cl_prx.sql,v 1.1.2.4 2009/09/18 16:20:26 source Exp $
+--  $Id: cl_prx.sql,v 1.1.2.5 2010/09/20 09:51:10 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -238,8 +238,17 @@ DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ext_fctabout_http_proxy_rule_4', 1,
     '/describe/\\?uri=(.*)', vector ('g'), 1,
     '/fct/rdfdesc/description.vsp?g=%s', vector ('g'), null, null, 2);
 
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ext_fctabout_http_proxy_rule_5', 1,
+    '/describe/\\?uri=([^\&]*)\&graph=([^\&]*)', vector ('g', 'graph'), 2,
+    '/fct/rdfdesc/description.vsp?g=%s&graph=%s', vector ('g', 'graph'), null, null, 2);
+
 DB.DBA.URLREWRITE_CREATE_RULELIST ('ext_fctabout_http_proxy_rule_list1', 1, 
-    vector ('ext_fctabout_http_proxy_rule_1', 'ext_fctabout_http_proxy_rule_2', 'ext_fctabout_http_proxy_rule_3', 'ext_fctabout_http_proxy_rule_4'));
+    vector ('ext_fctabout_http_proxy_rule_1', 
+      	    'ext_fctabout_http_proxy_rule_2', 
+	    'ext_fctabout_http_proxy_rule_3', 
+	    'ext_fctabout_http_proxy_rule_4',
+	    'ext_fctabout_http_proxy_rule_5'
+	    ));
 
 DB.DBA.VHOST_REMOVE (lpath=>'/describe');
 DB.DBA.VHOST_DEFINE (lpath=>'/describe', ppath=>'/SOAP/Http/EXT_HTTP_PROXY_1', soap_user=>'PROXY',
diff --git a/binsrc/b3s/complete.sql b/binsrc/b3s/complete.sql
index 8d28705..9b7fab8 100644
--- a/binsrc/b3s/complete.sql
+++ b/binsrc/b3s/complete.sql
@@ -1,5 +1,5 @@
 --
---  $Id: complete.sql,v 1.1.2.7 2010/02/01 12:44:31 source Exp $
+--  $Id: complete.sql,v 1.1.2.8 2011/03/24 15:50:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -181,7 +181,7 @@ create procedure
 cmp_uri (in str varchar)
 {
   declare with_ns varchar;
-  declare nss, iris any;
+  declare nss, iris, exact_iri any;
 
 --  dbg_printf ('cmp_uri\n');
 
@@ -200,10 +200,13 @@ cmp_uri (in str varchar)
 
 --  dbg_obj_print ('ns with ', str, ' = ', nss);
 
-  if (length (nss) = 0)
-    return cmp_find_iri (str);
+  exact_iri := cmp_find_iri (str);
 
   vectorbld_init (iris);
+  foreach (any x in exact_iri) do
+    {
+      vectorbld_acc (iris, vector (x));
+    }
   foreach (any x in nss) do
     {
       vectorbld_acc (iris, cmp_find_iri (x, 1));
diff --git a/binsrc/b3s/complete_cl.sql b/binsrc/b3s/complete_cl.sql
index 17ffc51..e678ce2 100644
--- a/binsrc/b3s/complete_cl.sql
+++ b/binsrc/b3s/complete_cl.sql
@@ -2,6 +2,7 @@
 create procedure
 urilbl_ac_init_db () 
 {
+  --pl_debug+
   declare n, n_ins, n_strange integer;
   declare o_str varchar;
   declare daq any;
@@ -43,7 +44,9 @@ urilbl_ac_init_db ()
 
       o_str := "LEFT"(o_str, 512);
 
-      insert soft rdf_label option (into daq) (rl_o, rl_ro_id, rl_text, rl_lang) values (o, id, urilbl_ac_ruin_label (o_str), lng);
+      --if (not exists (select 1 from rdf_label where rl_o = o))
+	--insert into rdf_label option (into daq) (rl_o, rl_ro_id, rl_text, rl_lang) values (o, id, urilbl_ac_ruin_label (o_str), lng);
+      insert soft rdf_label (rl_o, rl_ro_id, rl_text, rl_lang) values (o, id, urilbl_ac_ruin_label (o_str), lng);
 
      cont:;
       n := n + 1;
diff --git a/binsrc/b3s/demo_queries.vsp b/binsrc/b3s/demo_queries.vsp
index 76aa0b1..416548e 100644
--- a/binsrc/b3s/demo_queries.vsp
+++ b/binsrc/b3s/demo_queries.vsp
@@ -113,7 +113,7 @@ function get_and_encode_query (q_elm)
         <img alt="Linked Data" src="/fct/images/LoDLogo.gif"/>
       </a>
       <br/>
-      <span class="copyright">Copyright © 2010 OpenLink Software</span>
+      <span class="copyright">Copyright © 2009-2011 OpenLink Software</span>
       <div id="FT_L"/>
       <div id="FT_R"/>
     </div> <!-- #FT -->
diff --git a/binsrc/b3s/facet.js b/binsrc/b3s/facet.js
index 5e25f2b..ac1a93c 100644
--- a/binsrc/b3s/facet.js
+++ b/binsrc/b3s/facet.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: facet.js,v 1.1.2.7 2010/03/12 13:34:37 source Exp $
+ *  $Id: facet.js,v 1.1.2.11 2011/01/05 20:58:19 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -122,8 +122,25 @@ function ac_hide_thr ()
 var lbl_ac; // XXX Global var ugly as sin OAT.AJAX really needs a way of passing arbitrary obj to callback
 var uri_ac;
 
+// an ugly resize handler overriding CSS size for result
+//
+
+function resize_handler ()
+{
+    var wp_width = OAT.Dom.getViewport ()[0];
+
+    if ($('res')) 
+      {
+        var _w = (wp_width-230)+'px';
+        $('res').style.width = _w;
+      }
+}
+
 function init()
 {
+    resize_handler ();
+    OAT.Event.attach (window, 'resize', resize_handler);
+
     if ($('main_srch')) {
     uri_ac = new OAT.Autocomplete('new_uri_txt',
 			          'new_uri_val',
@@ -159,6 +176,10 @@ function init()
                                 function () { window.external.AddSearchProvider(location.protocol+'//'+location.host+'/fct/opensearchdescription.vsp'); });
           }
     }
+    if ($('fct_ft')) {
+        var ct = $('fct_ft_fm');
+	OAT.Anchor.assign ('fct_ft', {content: ct});
+    }
 }
 
 // opts = { loader: function  - function gets called when user hits tab or stops entering text
@@ -353,3 +374,47 @@ function fct_sel_neg (cb)
   else
     a.href = a.href + '&exclude=yes';
 }
+
+function fct_set_pivot_page_size()
+{
+  var pg_size = $('pivot_pg_size').value;
+  pg_size = parseInt(pg_size);
+  if (isNaN(pg_size) || pg_size < 0)
+    pg_size = 0;
+  else if (pg_size > 1000)
+    pg_size = 1000;
+
+  $('pivot_pg_size').value = pg_size.toString();
+
+  var a = $('pivot_a_mpc');
+  var href = a.href;
+  href = href.replace(/limit=\d+/, 'limit='+pg_size);
+  a.setAttribute("href", href);
+}
+
+function fct_set_pivot_qrcode_opt()
+{
+  var qrcode_flag = $('pivot_qrcode').checked ? 1 : 0;
+  var a = $('pivot_a_mpc');
+  var href = a.href;
+  href = href.replace(/qrcodes=\d+/, 'qrcodes='+qrcode_flag);
+  a.setAttribute("href", href);
+}
+
+function fct_set_pivot_subj_uri_opt()
+{
+  var opt = $('CXML_redir_for_subjs').value;
+  var a = $('pivot_a_mpc');
+  var href = a.href;
+  href = href.replace(/CXML_redir_for_subjs=[^&]*&/, 'CXML_redir_for_subjs='+opt+'&');
+  a.setAttribute("href", href);
+}
+
+function fct_set_pivot_href_opt()
+{
+  var opt = $('CXML_redir_for_hrefs').value;
+  var a = $('pivot_a_mpc');
+  var href = a.href;
+  href = href.replace(/CXML_redir_for_hrefs=[^&]*&/, 'CXML_redir_for_hrefs='+opt+'&');
+  a.setAttribute("href", href);
+}
diff --git a/binsrc/b3s/facet.sql b/binsrc/b3s/facet.sql
index 9be2cf8..b6d9607 100644
--- a/binsrc/b3s/facet.sql
+++ b/binsrc/b3s/facet.sql
@@ -1,5 +1,5 @@
 --
---  $Id: facet.sql,v 1.1.2.18 2010/07/05 08:30:36 source Exp $
+--  $Id: facet.sql,v 1.1.2.25 2011/03/24 15:50:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -154,7 +154,7 @@ FCT_LABEL (in x any, in g_id iri_id_8, in ctx varchar)
   label_iri := iri_id_from_num (atoi (registry_get ('fct_label_iri')));
   best_str := null;
   best_l := 0;
-  for select o, p from rdf_quad  where s = x and p in (rdf_super_sub_list (ctx, label_iri, 3)) do
+  for select o, p from rdf_quad table option (index primary key) where s = x and p in (rdf_super_sub_list (ctx, label_iri, 3)) do
     {
       if (is_rdf_box (o) or isstring (o))
 	{
@@ -245,7 +245,7 @@ FCT_LABEL_S (in x any, in g_id iri_id_8, in ctx varchar, in lng varchar)
   declare q, best_q, str_lang, lng_pref any;
 
   if (not isiri_id (x))
-    return vector (null, 1);
+    return null;
   rdf_check_init ();
   label_iri := iri_id_from_num (atoi (registry_get ('fct_label_iri')));
   best_str := null;
@@ -346,7 +346,6 @@ bibo:shortTitle rdfs:subPropertyOf virtrdf:label .
 <http://s.opencalais.com/1/type/er/Company> rdfs:subClassOf gr:BusinessEntity .
 gr:BusinessEntity rdfs:subClassOf foaf:Organization .
 <http://dbpedia.org/ontology/Company> rdfs:subClassOf gr:BusinessEntity .
-<http://dbpedia.org/property/name> rdfs:subPropertyOf foaf:name .
 <http://www.w3.org/2002/12/cal/ical#summary> rdfs:subPropertyOf rdfs:label .
 <http://usefulinc.com/ns/doap#name> rdfs:subPropertyOf rdfs:label .
 <http://linkedopencommerce.com/schemas/icecat/v1/hasModelName> rdfs:subPropertyOf virtrdf:label .
@@ -358,6 +357,7 @@ og:longitude rdfs:subPropertyOf geo:long .
 <http://uberblic.org/ontology/latitude> rdfs:subPropertyOf geo:lat .
 <http://uberblic.org/ontology/longitude> rdfs:subPropertyOf geo:long .
 <http://linkedopencommerce.com/schemas/icecat/v1/hasCategory> rdfs:subPropertyOf rdf:type .
+<http://poolparty.punkt.at/demozone/ont#title> rdfs:subPropertyOf virtrdf:label .
 ', 'xx', 'facets');
 
 rdfs_rule_set ('facets', 'facets');
@@ -471,7 +471,8 @@ fct_lang (in x any)
 }
 ;
 
-create procedure fct_get_mode (in tree any, in xp any)
+create procedure 
+fct_get_mode (in tree any, in xp any)
 {
   declare view_type varchar;
   view_type := cast (xpath_eval (xp, tree, 1) as varchar);
@@ -493,8 +494,11 @@ fct_xml_wrap (in tree any, in txt any)
   declare n_cols int;
   n_cols := fct_n_cols(tree);
 
+--  dbg_printf ('fct_xml_wrap: view_type: %s', view_type);
 --  dbg_printf ('n_cols: %d', n_cols);
 
+--  dbg_obj_print (xpath_eval ('//query/text', tree, 1));
+ 
   if (n_cols = 2)
     {
       if (view_type = 'text')
@@ -529,6 +533,19 @@ fct_xml_wrap (in tree any, in txt any)
 				     "res") 
 				     from (sparql ', ntxt);
 	}
+      else if (view_type = 'entities-list' or view_type = 'list' or view_type = 'propval-list')
+        {
+	  http (sprintf ('select xmlelement ("result", xmlattributes (''%s'' as "type"),
+                          xmlagg (xmlelement ("row",
+                                              xmlelement ("column",
+                                                          xmlattributes (fct_lang ("c1") as "xml:lang",
+                                                                         fct_dtp ("c1") as "datatype",
+                                                                         fct_short_form(__ro2sq("c1")) as "shortform"),
+                                                          __ro2sq ("c1")),
+                                              xmlelement ("column",
+                                                          fct_label ("c1", 0, ''facets'' )))))
+              from (sparql define output:valmode "LONG" ', view_type), ntxt);
+        }
       else
 	{
 	  http (sprintf ('select xmlelement ("result", xmlattributes (''%s'' as "type"),
@@ -547,7 +564,7 @@ fct_xml_wrap (in tree any, in txt any)
 	}
      }
   if (n_cols = 1)
-    http ('select xmlelement ("result", xmlattributes ('''' as "type"),
+    http (sprintf ('select xmlelement ("result", xmlattributes (''%s'' as "type"),
     			xmlagg (xmlelement ("row",
 				xmlelement ("column",
 						xmlattributes (fct_lang ("c1") as "xml:lang",
@@ -556,7 +573,7 @@ fct_xml_wrap (in tree any, in txt any)
                                                                fct_sparql_ser ("c1") as "sparql_ser"),
 							       __ro2sq ("c1")),
 				xmlelement ("column", fct_label ("c1", 0, ''facets'' )))))
-	     from (sparql define output:valmode "LONG"', ntxt);
+	     from (sparql define output:valmode "LONG"', view_type), ntxt);
   if (n_cols = 3)
     http ('select xmlelement ("result", xmlattributes ('''' as "type"),
                               xmlagg (xmlelement ("row",
@@ -585,6 +602,7 @@ fct_n_cols (in tree any)
 {
   declare tp varchar;
   tp := cast (xpath_eval ('//view/@type', tree, 1) as varchar);
+--  dbg_printf ('fct_n_cols: tp: %s', tp);
   if ('list' = tp)
     return 1;
   else if ('geo' = tp)
@@ -632,7 +650,7 @@ element_split (in val any)
 ;
 
 create procedure
-fct_view (in tree any, in this_s int, in txt any, in pre any, in post any)
+fct_view (in tree any, in this_s int, in txt any, in pre any, in post any, in plain integer := 0)
 {
   declare lim, offs int;
   declare mode varchar;
@@ -644,7 +662,9 @@ fct_view (in tree any, in this_s int, in txt any, in pre any, in post any)
 
   mode := fct_get_mode (tree, './@type');
 
-  if ('list' = mode)
+--  dbg_printf('fct_view: view mode: %s', mode);
+
+  if ('list' = mode or 'propval-list' = mode)
     {
       http (sprintf ('select distinct ?s%d as ?c1 ', this_s), pre);
       http (sprintf (' order by desc (<LONG::IRI_RANK> (?s%d)) ', this_s), post);
@@ -655,7 +675,11 @@ fct_view (in tree any, in this_s int, in txt any, in pre any, in post any)
       http (sprintf ('select ?s%d as ?c1 count (*) as ?c2 ', this_s), pre);
       http (sprintf (' group by ?s%d order by desc 2', this_s), post);
     }
-
+  if ('entities-list' = mode)
+    {
+      http (sprintf ('select distinct ?s%d as ?c1 ', this_s), pre);
+      http (sprintf (' order by desc (<LONG::IRI_RANK> (?s%d)) ', this_s), post);
+    }
   if ('properties' = mode)
     {
       if (length (fct_inf_clause (tree)) > 0)
@@ -688,8 +712,7 @@ fct_view (in tree any, in this_s int, in txt any, in pre any, in post any)
       http (sprintf (' ?s%d a ?s%dc .', this_s, this_s), txt);
       http (sprintf (' group by ?s%dc order by desc 2', this_s), post);
     }
-
-  if ('text' = mode)
+  if ('text' = mode or ('text-d' = mode and plain = 1))
     {
       declare exp any;
 
@@ -744,9 +767,6 @@ fct_view (in tree any, in this_s int, in txt any, in pre any, in post any)
 
     }
 
---  dbg_printf ('Pre : %s', string_output_string (pre));
---  dbg_printf ('Post: %s', string_output_string(post));
-
   fct_post (tree, post, lim, offs);
 
 }
@@ -795,25 +815,29 @@ fct_cond (in tree any, in this_s int, in txt any)
 ;
 
 create procedure
-fct_text_1 (in tree any,
-	    in this_s int,
-	    inout max_s int,
-	    in txt any,
-	    in pre any,
-	    in post any)
+fct_cond_range (in tree any, in this_s int, in txt any)
 {
-  declare c any;
-  declare i, len int;
+  declare hi, lo varchar;
 
-  c := xpath_eval ('./node()', tree, 0);
+  lo := xpath_eval ('./@lo', tree);
+  hi := xpath_eval ('./@hi', tree);
 
-  for (i := 0; i < length (c); i := i + 1)
-    {
-      fct_text (c[i], this_s, max_s, txt, pre, post);
-    }
+  if (lo <> '' and hi <> '') { 
+    http(sprintf (' filter (?s%d >= %s && ?s%d <= %s) .', this_s, lo, this_s, hi), txt);
+  }
+  else if (lo <> '') 
+  {
+    http(sprintf (' filter (?s%d >= %s) .', this_s, lo), txt);
+  }
+  else if (hi <> '') 
+  {
+    http(sprintf (' filter (?s%d <= %s) .', this_s, hi), txt);
+  }
+  else return;
 }
 ;
 
+
 create procedure 
 fct_curie_iri (in curie varchar)
 {
@@ -848,17 +872,43 @@ fct_curie (in curie varchar)
 ;
 
 create procedure
+fct_text_1 (in tree any,
+	    in this_s int,
+	    inout max_s int,
+	    in txt any,
+	    in pre any,
+	    in post any,
+            in plain integer := 0)
+{
+  declare c any;
+  declare i, len int;
+
+  c := xpath_eval ('./node()', tree, 0);
+
+  for (i := 0; i < length (c); i := i + 1)
+    {
+      fct_text (c[i], this_s, max_s, txt, pre, post, plain);
+    }
+}
+;
+
+create procedure
 fct_text (in tree any,
 	  in this_s int,
 	  inout max_s int,
 	  in txt any,
 	  in pre any,
-	  in post any)
+	  in post any,
+	  in plain integer := 0)
 {
   declare n varchar;
 
   n := cast (xpath_eval ('name ()', tree, 1) as varchar);
 
+--  dbg_printf('fct_text pre: %s, post: %s', string_output_string(pre), string_output_string(post));
+--  dbg_printf('           n: %s', n);
+--  dbg_obj_print (tree);
+
   if ('class' = n)
     {
       declare ciri varchar;
@@ -867,6 +917,10 @@ fct_text (in tree any,
 	{
 	  http (sprintf (' filter (!bif:exists ((select (1) where { ?s%d a <%s> } ))) .', this_s, ciri), txt);
 	}
+      else if (ciri is null) 
+        {
+	  http (sprintf ('?s%d a ?s%d .', this_s, this_s+1), txt); 
+        }
       else
 	{
 	  http (sprintf ('?s%d a <%s> .', this_s, ciri), txt);
@@ -877,15 +931,19 @@ fct_text (in tree any,
   if ('query' = n)
     {
       max_s := 1;
-      fct_text_1 (tree, 1, max_s, txt, pre, post);
+      fct_text_1 (tree, 1, max_s, txt, pre, post, plain);
       return;
     }
 
   if (n = 'text')
     {
-      declare prop, sc_opt, v varchar;
+      declare prop, sc_opt, v, txs_qr varchar;
+      declare txs_arr any;
+      declare wlimit int;
+
       v := cast (xpath_eval ('//view/@type', tree) as varchar);
       prop := cast (xpath_eval ('./@property', tree, 1) as varchar);
+
       if ('text' = v or 'text-d' = v)
         sc_opt := ' option (score ?sc) ';
       else
@@ -895,29 +953,40 @@ fct_text (in tree any,
       else
 	prop := sprintf ('?s%dtextp', this_s);
 
-      http (sprintf (' ?s%d %s ?o%d . ?o%d bif:contains  ''%s'' %s .', this_s, prop, this_s, this_s,
-		     fti_make_search_string (charset_recode (xpath_eval ('string (.)', tree), '_WIDE_', 'UTF-8')), sc_opt), txt);
+      wlimit := registry_get ('fct_text_query_limit');
+      if (isstring (wlimit))
+        wlimit := atoi (wlimit);
+      if (0 = wlimit)
+        wlimit := 100;	
+      txs_qr := fti_make_search_string_inner (charset_recode (xpath_eval ('string (.)', tree), '_WIDE_', 'UTF-8'), txs_arr);	
+      if (length (txs_arr) > wlimit)
+	signal ('22023', 'The request is too large');
+      http (sprintf (' ?s%d %s ?o%d . ?o%d bif:contains  ''%s'' %s .', this_s, prop, this_s, this_s, txs_qr, sc_opt), txt);
     }
 
   if ('property' = n)
     {
       declare new_s int;
       declare piri varchar;
+      declare flt_expr varchar;
+
       max_s := max_s + 1;
       new_s := max_s;
+
       piri := fct_curie (cast (xpath_eval ('./@iri', tree, 1) as varchar));
+
       if (cast (xpath_eval ('./@exclude', tree) as varchar) = 'yes')
 	{
 	  http (sprintf (' filter (!bif:exists ((select (1) where { ?s%d <%s> ?v%d } ))) .', this_s, piri, new_s), txt);
 	  max_s := max_s - 1;
 	  new_s := max_s;
-	  fct_text_1 (tree, new_s, max_s, txt, pre, post);
+	  fct_text_1 (tree, new_s, max_s, txt, pre, post, plain);
 	  return;
 	}
       else
 	{
 	  http (sprintf (' ?s%d <%s> ?s%d .', this_s, piri, new_s), txt);
-	  fct_text_1 (tree, new_s, max_s, txt, pre, post);
+	  fct_text_1 (tree, new_s, max_s, txt, pre, post, plain);
 	}
     }
 
@@ -927,7 +996,7 @@ fct_text (in tree any,
       max_s := max_s + 1;
       new_s := max_s;
       http (sprintf (' ?s%d <%s> ?s%d .', new_s, fct_curie (cast (xpath_eval ('./@iri', tree, 1) as varchar)), this_s), txt);
-      fct_text_1 (tree, new_s, max_s, txt, pre, post);
+      fct_text_1 (tree, new_s, max_s, txt, pre, post, plain);
     }
 
   if ('value' = n)
@@ -935,15 +1004,20 @@ fct_text (in tree any,
       fct_cond (tree, this_s, txt);
     }
 
-  if (n = 'view')
+  if ('value-range' = n)
     {
-      fct_view (tree, this_s, txt, pre, post);
+      fct_cond_range (tree, this_s, txt);
+    }
+
+  if ('view' = n)
+    {
+      fct_view (tree, this_s, txt, pre, post, plain);
     }
 }
 ;
 
 create procedure
-fct_query (in tree any)
+fct_query (in tree any, in plain integer := 0)
 {
   declare s, add_graph int;
   declare txt, pre, post any;
@@ -958,7 +1032,7 @@ fct_query (in tree any)
   if (xpath_eval ('//view[@type="graphs"]', tree) is not null)
     add_graph := 1;
 
-  fct_text (xpath_eval ('//query', tree), 0, s, txt, pre, post);
+  fct_text (xpath_eval ('//query', tree), 0, s, txt, pre, post, plain);
 
   http (' where {', pre);
   if (add_graph) http (' graph ?g { ', pre);
@@ -1029,8 +1103,6 @@ fct_exec (in tree any,
   offs := xpath_eval ('//view/@offset', tree);
   lim := xpath_eval ('//view/@limit', tree);
 
-  -- db_activity ();
-
   results := vector (null, null, null);
   more := vector ();
 
@@ -1060,8 +1132,6 @@ fct_exec (in tree any,
   else
     results[0] := res[0][0];
 
--- dbg_obj_print (results);
-
   inx := 1;
 
   foreach (varchar tp in more) do
@@ -1097,9 +1167,8 @@ fct_exec (in tree any,
                                xmlelement ("view", xmlattributes (offs as "offset", lim as "limit")),
                                results[0], results[1], results[2]);
 
-  --string_to_file ('ret.xml', serialize_to_UTF8_xml (res), -2);
+  --String_to_file ('ret.xml', serialize_to_UTF8_xml (res), -2);
 
---  dbg_obj_print (res);
   return res;
 }
 ;
diff --git a/binsrc/b3s/facet.vsp b/binsrc/b3s/facet.vsp
index 8a796d8..f344861 100644
--- a/binsrc/b3s/facet.vsp
+++ b/binsrc/b3s/facet.vsp
@@ -5,7 +5,8 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
 <title>Precision Search & Find</title>
-<link rel="stylesheet" media="screen" type="text/css" href="styles/default.css"/>
+
+<link id="ss" rel="stylesheet" media="screen" type="text/css" href="styles/default.css"/>
 
 <?vsp
   fct_gen_opensearch_link();
@@ -49,15 +50,15 @@
             <select id="inf_sel" onchange="javascript:inf_cb();"><?vsp b3s_render_inf_opts (); ?></select><br/>
           </li>
         </ul>
-      </div> <!-- settings-popup -->
-    </li-->
+      </div> 
+    </li--><!--settings-popup-->
   </ul>
 </div><!-- #HD -->
 <div id="MD">
 <?vsp 
 --
 -- 
---  $Id: facet.vsp,v 1.1.2.10 2010/05/26 21:48:39 source Exp $
+--  $Id: facet.vsp,v 1.1.2.13 2011/03/08 15:43:44 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -160,11 +161,15 @@ footer:;
   ?>
   <br/>
   <?vsp fct_virt_info (); ?><br /> 
-  <span class="copyright">Copyright © 2010 OpenLink Software</span>
+  <span class="copyright">Copyright © 2009-2011 OpenLink Software</span>
   <div id="FT_L"></div>
   <div id="FT_R"></div>
 </div>
 </div> <!-- #PG -->
+<div id="fct_ft_fm" style="display:none">
+  <input type="text" name="txt"/>
+  <button>Set</button>
+</div>
     <?vsp if (isstring (registry_get ('urchinTracker'))) { ?>
     <script type="text/javascript">
 	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
diff --git a/binsrc/b3s/facet_doc.html b/binsrc/b3s/facet_doc.html
index bae8220..1497033 100644
--- a/binsrc/b3s/facet_doc.html
+++ b/binsrc/b3s/facet_doc.html
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
 --
---  $Id: facet_doc.html,v 1.1.2.7 2010/02/01 12:44:31 source Exp $
+--  $Id: facet_doc.html,v 1.1.2.8 2011/03/08 15:43:44 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -115,7 +115,7 @@
 <div id="FT">
   <a href="http://virtuoso.openlinksw.com/"><img src="/fct/images/virt_power_no_border.png" alt="Powered by OpenLink Virtuoso"/></a>
   <a href="http://linkeddata.org"><img src="/fct/images/LoDLogo.gif" alt="Linked Data"/></a><br/>
-  <span class="copyright">Copyright © 2010 OpenLink Software</span>
+  <span class="copyright">Copyright © 2009-2011 OpenLink Software</span>
   <div id="FT_L"></div>
   <div id="FT_R"></div>
 </div>
diff --git a/binsrc/b3s/facet_svc.sql b/binsrc/b3s/facet_svc.sql
index dc27c84..58474a4 100644
--- a/binsrc/b3s/facet_svc.sql
+++ b/binsrc/b3s/facet_svc.sql
@@ -1,5 +1,5 @@
 --
---  $Id: facet_svc.sql,v 1.1.2.5 2009/09/28 21:25:41 source Exp $
+--  $Id: facet_svc.sql,v 1.1.2.9 2011/01/05 20:58:19 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -25,6 +25,20 @@ cl_exec ('registry_set (''fct_max_timeout'',''10000'')');
 DB.DBA.VHOST_REMOVE (lpath=>'/fct/service');
 DB.DBA.VHOST_DEFINE (lpath=>'/fct/service', ppath=>'/SOAP/Http/fct_svc', soap_user=>'dba');
 
+create procedure fct_init ()
+{
+  if (__proc_exists ('WS.WS.host_meta_add') is not null)
+    {
+      WS.WS.host_meta_add ('FCT.service', '<Link rel="http://openlinksw.com/virtuoso/fct/service" href="http://%{WSHost}s/fct/service"/>');
+      WS.WS.host_meta_add ('FCT.browser', '<Link rel="http://openlinksw.com/virtuoso/fct/browser" href="http://%{WSHost}s/fct/"/>');
+      WS.WS.host_meta_add ('FCT.describe', 
+      	'<Link rel="http://openlinksw.com/virtuoso/fct/resource-descriptor" template="http://%{WSHost}s/describe/?url={uri}"/>');
+    }
+}
+;
+
+fct_init ();
+
 create procedure fct_svc_log (in qr varchar, in lines varchar)
 {
   declare fname, ua any;
@@ -32,8 +46,7 @@ create procedure fct_svc_log (in qr varchar, in lines varchar)
     return;
   ua := http_request_header (lines, 'User-Agent');
   fname := sprintf ('fctlogs/fct%02d%02d%04d.log', dayofmonth(now ()), month (now()), year (now ()));
-  string_to_file (fname, sprintf ('***\n* %s\n* %s\n* %s\n* %s\n', date_rfc1123 (now ()), http_client_ip (), qr, ua
-      ), -1);
+  string_to_file (fname, sprintf ('***\n* %s\n* %s\n* %s\n* %s\n', date_rfc1123 (now ()), http_client_ip (), qr, ua), -1);
 }
 ;
 
@@ -51,6 +64,7 @@ fct_svc_exec (in tree any, in timeout int, in accept varchar, in lines any)
   sqls := '00000';
   ret := '';
   qr := fct_query (xpath_eval ('//query', tree, 1));
+--  dbg_obj_print(qr);
   if (xmlout)
     qr2 := fct_xml_wrap (tree, qr);
   else
diff --git a/binsrc/b3s/facet_view.sql b/binsrc/b3s/facet_view.sql
index 16448e2..0a302a5 100644
--- a/binsrc/b3s/facet_view.sql
+++ b/binsrc/b3s/facet_view.sql
@@ -1,5 +1,5 @@
 --
---  $Id: facet_view.sql,v 1.1.2.25 2010/06/08 21:58:48 source Exp $
+--  $Id: facet_view.sql,v 1.1.2.32 2011/03/24 15:50:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -23,7 +23,8 @@
 --set ignore_params=on;
 -- Facets web page
 
-registry_set ('_fct_xslt_', case when registry_get('_fct_url_') = 0 then 'file://fct/' else registry_get('_fct_url_') end);
+registry_set ('_fct_xslt_', 
+              case when registry_get('_fct_url_') = 0 then 'file://fct/' else registry_get('_fct_url_') end);
 
 create procedure
 fct_view_pos (in tree any)
@@ -63,6 +64,10 @@ fct_view_info (in tree any, in ctx int, in txt any)
     {
       http ('Displaying List of Distinct Entity Names ordered by Count', txt);
     }
+  if ('entities-list' = mode)
+    {
+      http ('Displaying matching entities', txt);
+    }
   if ('geo' = mode)
     {
       http ('Displaying Places associated with Entities', txt);
@@ -90,10 +95,12 @@ fct_view_info (in tree any, in ctx int, in txt any)
     }
   if ('text' = mode or 'text-d' = mode)
     {
-      http ('Displaying Ranked Enitity Names and Text summaries', txt);
+      http ('Displaying Ranked Entity Names and Text summaries', txt);
     }
 --  if (offs)
 --    http (sprintf ('  values %d - %d', 1 + offs, lim), txt);
+  
+
   http (' where:</h3>', txt);
 }
 ;
@@ -234,19 +241,21 @@ fct_query_info (in tree any,
       prop := cast (xpath_eval ('./@property', tree, 1) as varchar);
 
       if (prop is not null)
-        http (sprintf (' %s has <span class="iri"><a href="/fct/facet.vsp?sid=%d&cmd=drop_text_prop">%s</a></span> containing text <span class="value">"%s"</span>. ', 
+        http (sprintf (' %s has <span class="iri"><a href="#"/fct/facet.vsp?sid=%d&cmd=drop_text_prop">%s</a></span> containing text <span class="value">"%s"</span>. ', 
                      fct_var_tag (this_s, ctx),
                        connection_get ('sid'),
                        fct_short_form (prop),
                        charset_recode (xpath_eval ('string (.)', tree), '_WIDE_', 'UTF-8')), txt);
       else
-        http(sprintf (' %s has <a class="qry_info_cmd" href="/fct/facet.vsp?sid=%d&cmd=set_view&type=text-properties&limit=20&offset=0&cno=%d">any %s</a> with %s <span class="value">"%s"</span>. ', 
+        http(sprintf (' %s has <a class="qry_info_cmd" href="/fct/facet.vsp?sid=%d&cmd=set_view&type=text-properties&limit=20&offset=0&cno=%d">any %s</a> with %s <span class="value">"%s"</span> <a href="/fct/facet.vsp?sid=%d&cmd=drop_text">Drop</a>. ', 
                       fct_var_tag (this_s, ctx), 
                       connection_get('sid'), 
                       cno,
 		      fct_p_term (),
 		      fct_o_term (),
-		      charset_recode (xpath_eval ('string (.)', tree), '_WIDE_', 'UTF-8')), txt);
+		      charset_recode (xpath_eval ('string (.)', tree), '_WIDE_', 'UTF-8'),
+                      connection_get('sid')), 
+             txt);
 
     }
   else if ('property' = n)
@@ -300,6 +309,41 @@ fct_query_info (in tree any,
 		     cno),
             txt);
     }
+  if ('value-range' = n)
+    {
+      declare hi, lo any;	
+      hi := xpath_eval ('./@hi', tree);
+      lo := xpath_eval ('./@lo', tree);
+
+      if (hi <> '' and lo <> '') {
+--	http (sprintf (' %s is between <a class="edit_lo" href="#">%s</a> and <a href="edit_hi" href="#">%s</a> . <a class="qry_nfo_cmd" href="/fct/facet.vsp?sid=%d&cmd=drop_cond&cno=%d">Drop</a>', 
+
+	http (sprintf (' %s is between <a class="edit_lo" href="#">%s</a> and <a href="edit_hi" href="#">%s</a> . <a class="qry_nfo_cmd" href="/fct/facet.vsp?sid=%d&cmd=drop_cond&cno=%d">Drop</a>', 
+                       fct_var_tag (this_s, ctx), 
+                       cast (lo as varchar),
+                       cast (hi as varchar),
+		       connection_get ('sid'),
+                       cno),
+              txt);
+      }
+      else if (hi <> '') {
+       	http (sprintf (' %s <= <a class="edit_lo" href="#">%s</a> . <a class="qry_nfo_cmd" href="/fct/facet.vsp?sid=%d&cmd=drop_cond&cno=%d">Drop</a>', 
+                       fct_var_tag (this_s, ctx), 
+                       cast (hi as varchar),
+		       connection_get ('sid'),
+                       cno),
+              txt);
+	
+      }
+      else if (lo <> '') {
+       	http (sprintf (' %s >= <a class="edit_lo" href="#">%s</a> . <a class="qry_nfo_cmd" href="/fct/facet.vsp?sid=%d&cmd=drop_cond&cno=%d">Drop</a>', 
+                       fct_var_tag (this_s, ctx), 
+                       cast (lo as varchar),
+		       connection_get ('sid'),
+                       cno),
+              txt);
+      }
+    }
   if (ctx)
     http ('<br/>', txt);
   else
@@ -344,6 +388,15 @@ fct_view_link (in tp varchar, in msg varchar, in txt any, in tip any := null)
 ;
 
 create procedure
+fct_ft_a (in txt any)
+{
+  http(sprintf ('<li><form><label for="ft_q">Text</label><input type="hidden" name="cmd" value="text"/><input type="hidden" name="sid" value="%d"/><input type="text" name="q"/><input type="submit" value="Set"/></li>', 
+                 connection_get('sid')), 
+                 txt);
+}
+;
+
+create procedure
 fct_set_conn_tlogy (in tree any)
 {
   declare c_term, s_term varchar;
@@ -377,6 +430,11 @@ fct_nav (in tree any,
       return;
     }
 
+  if (xpath_eval ('//query/text', tree) is null)
+    {
+      fct_ft_a (txt);
+    }
+
   if ('classes' <> tp)
     if (connection_get('c_term') = 'class') 
 	fct_view_link ('classes', 'Classes', txt);
@@ -412,6 +470,11 @@ fct_nav (in tree any,
 	fct_view_link ('list', 'Show Matching Values', txt, 'Displaying Ranked Enitity Names and Text summaries');
     }
 
+  if ('full-text' <> tp and not xpath_eval ('//query/text', tree)) 
+    {
+      fct_view_link ('full-text', 'Text', txt,'Add full-text constraint');
+    }
+
   if ('geo' <> tp)
     {
       --fct_view_link ('geo', 'Map', txt);
@@ -450,7 +513,7 @@ fct_nav (in tree any,
 create procedure
 fct_view_type (in vt varchar)
 {
-  if (vt in ('properties', 'classes', 'properties-in', 'text-properties', 'list', 'list-count'))
+  if (vt in ('properties', 'classes', 'properties-in', 'text-properties', 'list', 'list-count', 'propval-list'))
     return vt;
 -- return 'properties';
   if (vt = 'geo')
@@ -475,6 +538,9 @@ fct_view_cmd (in tp varchar)
   if ('classes' = tp)
     return 'set_class';
 
+  if ('full-text' = tp)
+    return 'set_text';
+
   return 'select_value';
 }
 ;
@@ -483,11 +549,23 @@ cl_exec ('registry_set (''fct_timeout'', ''0'')');
 cl_exec ('registry_set (''fct_timeout_max'', ''20000'')');
 
 create procedure
+fct_set_default_qry (inout tree any)
+{
+
+  tree := xslt (registry_get ('_fct_xslt_') || 'fct_set_default.xsl',
+                tree,
+		vector ('pos', 1, 'op', 'class', 'iri', 'http://www.w3.org/2000/01/rdf-schema#Class'));
+
+}
+;
+
+create procedure
 fct_web (in tree any)
 {
   declare sqls, msg, tp varchar;
   declare start_time int;
   declare reply, md, res, qr, qr2, txt any;
+  declare p_qry varchar;
   declare timeout int;
  
   timeout := connection_get ('timeout');
@@ -495,7 +573,20 @@ fct_web (in tree any)
   if (not isinteger(timeout)) 
     timeout := atoi(timeout);
 
+--
+-- Empty query - get classes as default qry
+--
+
+  if (xpath_eval('/query/*[not(name()=''view'')]', tree) is null)
+    { 
+      if (xpath_eval('/query/view[@type=''classes'']', tree) is null)
+	fct_set_default_qry (tree);
+    }
+
   reply := fct_exec (tree, timeout);
+  p_qry := fct_query (tree, 1); -- get "plain" query text
+
+--  dbg_obj_print (reply);
 
   txt := string_output ();
 
@@ -505,6 +596,10 @@ fct_web (in tree any)
 
   http('<div id="sparql_a_ctr"></div>', txt);
 
+  if (DB.DBA.VAD_CHECK_VERSION('fct_pivot_bridge') is not NULL) {
+      http('<div id="pivot_a_ctr"></div>', txt);
+  }
+
   http ('</div>', txt);
 
   tp := cast (xpath_eval ('//view/@type', tree) as varchar);
@@ -522,13 +617,15 @@ fct_web (in tree any)
 			    'query',
 			    tree,
 			    's_term', 
-			    fct_p_term (),
-			    'p_term', 
 			    fct_s_term (),
+			    'p_term', 
+			    fct_p_term (),
 			    'o_term', 
 			    fct_o_term (),
 			    't_term', 
-			    fct_t_term ()
+			    fct_t_term (),
+                            'p_qry',
+                            p_qry
 			    )),
 	      null, txt);
 
@@ -617,9 +714,23 @@ fct_drop_cond (in tree any, in sid int, in cno int)
 ;
 
 create procedure
-fct_drop_text_prop (in tree any, in sid int)
+fct_drop_text (in tree any, in sid int)
 {
+  declare txt varchar;
+  txt := xpath_eval ('//text', tree);
+  
+  tree := xslt (registry_get ('_fct_xslt_') || 'fct_drop_text.xsl', tree, vector ('text', txt, 'prop', 'none'));
 
+  update fct_state set fct_state = tree where fct_sid = sid;
+  commit work;
+
+  fct_web (tree);
+}
+;
+
+create procedure
+fct_drop_text_prop (in tree any, in sid int)
+{
   declare txt varchar;
   txt := xpath_eval ('//text', tree);
   
@@ -640,6 +751,7 @@ fct_set_view (in tree     any,
               in offs     int, 
               in loc_prop varchar := null)
 {
+
   declare pos int;
   pos := fct_view_pos (tree);
 
@@ -715,18 +827,21 @@ fct_open_property  (in tree any,
 		        'op', 'prop',
 			'name', name,
 			'iri', iri,
-			'type', 'list',
+			'type', 'propval-list',
 			'limit', 20,
 			'offset', 0,
 			'exclude', exclude));
 
   if (xpath_eval ('//view', tree) is null)
+    {
+
     tree := xslt (registry_get ('_fct_xslt_') || 'fct_set_view.xsl', tree, 
                   vector ('pos', pos, 
                   'op', 'view', 
                   'type', 'properties', 
                   'limit', 20, 
                   'offset', 0));
+    }
 
   update fct_state
     set fct_state = tree
@@ -975,17 +1090,34 @@ fct_load (in from_stored int)
 ;
 
 create procedure 
+fct_create_ses () 
+{
+  declare sid int;
+  declare new_tree any;
+
+  sid := sequence_next ('fct_seq');
+  new_tree := xtree_doc('<query inference="" same-as="" view3="" s-term="" c-term=""/>');
+
+  insert into fct_state (fct_sid, fct_state)
+         values (sid, new_tree);
+
+  return vector (sid, new_tree);
+}
+;
+
+create procedure 
 fct_new ()
 {
   declare sid int;
+  declare r_v any;
+
   sid := http_param ('sid');
 
   if (0 = sid)
     {
       no_ses:
-      sid := sequence_next ('fct_seq');
-      insert into fct_state (fct_sid, fct_state)
-        values (sid, '<query inference="" same-as="" view3="" s-term="" c-term=""/>');
+      r_v := fct_create_ses (); 
+      sid := r_v[0];
     }
   else
     {
@@ -1101,6 +1233,7 @@ fct_new ()
 }
 ;
 
+-- /* options */
 create procedure
 fct_set_inf (in tree any, in sid int)
 {
@@ -1155,11 +1288,12 @@ fct_set_inf (in tree any, in sid int)
 	           <option value="eav" '); http_value ( case when sel_s_term = 'e' then 'selected="true"' else '' end ); http ('>Entity-Attribute-Value</option>
 	           <option value="spo" '); http_value ( case when sel_s_term = 's' then 'selected="true"' else '' end ); http ('>Subject-Predicate-Object</option>
 	       	 </select><br/>
+<!--		 
                  <input type="checkbox" 
                         name="view3" 
                         value="yes" 
                         id="view3" '); http_value ( case when selected_view3 = 'yes' then 'checked="true"' end  ); http ('> 
-                 <label class="rt_ckb" for="view3">Show Values, Types, Properties simultaneously</label><br>
+                 <label class="rt_ckb" for="view3">Show Values, Types, Properties simultaneously</label><br> -->
                </div>
 <!--               <div class="fm_sect">
                  <h3>Limits</h3>
@@ -1296,6 +1430,212 @@ fct_select_value (in tree any,
 ;
 
 create procedure 
+fct_validate_xsd_float (in str varchar) {
+  declare ret varchar;
+
+  ret := regexp_match ('^[-+]?([0-9]+(\.[0-9]*)?|\.[0-9]+)([eE][-+]?[0-9]+)$', str); -- simple case
+
+  if (ret is not null) 
+  {
+    return ret;
+  }
+  ret := regexp_match ('^"([^\\\D"]|\\.|[-+]?([0-9]+(\.[0-9]*)?|\.[0-9]+)([eE][-+]?[0-9]+)?|INF|-INF|NaN)"\\^\\^(xsd\\:double|xsd\\:float)',str);
+  return ret;
+
+}
+;
+
+create procedure 
+fct_validate_xsd_decimal (in str varchar) { 
+  return regexp_match ('^"([^\\"]|\\.|[-+]?([0-9]+(\.[0-9]*)?|\.[0-9]+)?)"\\^\\^xsd\\:decimal',str);
+}
+;
+
+create procedure
+fct_validate_xsd_int (in str varchar) 
+{
+  declare ret varchar;
+
+  ret := regexp_match ('^[-+]?[0-9]+$', str); -- simple integers
+  if (ret is not null) 
+  {
+    return ret;
+  }
+  ret := regexp_match ('^"([^\\"]|\\.|[-+]?([0-9]+))"\\^\\^(xsd:int|xsd:integer)$', str);
+  return ret;
+
+}
+;
+
+create procedure 
+fct_validate_xsd_date (in str varchar) {
+  return regexp_match ('^"-?[0-9][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9](Z|[-+]?[0-2][0-9]\\:[0-5][0-9])?"\\^\\^xsd\\:date$', str);
+}
+;
+
+create procedure
+fct_validate_xsd_datetime (in str varchar) 
+{
+  declare retval varchar;
+
+  retval := regexp_match ('^"-?[0-9][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]\\:[0-5][0-9](Z|[-+]?[0-2][0-9]\\:[0-5][0-9])+"\\^\\^xsd\\:dateTime$', str);
+  return retval;
+}
+;
+
+create procedure 
+fct_validate_xsd_str (in str varchar) {
+  declare retval varchar;
+
+  retval := regexp_match ('^"([^\\"\\'']|.*)"(@([a-zA-Z0-9]+)?)(-[a-zA-Z0-9]+)*$', str);
+
+--  if (retval is null) {
+--    retval := sprintf ('''%s''', regexp_replace (str,'["'']','', 1, null));
+--  }
+  return retval;
+}
+;
+
+create procedure 
+fct_validate_cond_input (in str varchar) 
+{
+  declare retval varchar;
+
+  retval := coalesce (fct_validate_xsd_int(str), 
+                      fct_validate_xsd_float (str),
+                      fct_validate_xsd_decimal(str),
+                      fct_validate_xsd_datetime(str),
+                      fct_validate_xsd_date(str),
+                      fct_validate_xsd_str (str));
+
+  return retval;
+}
+;
+
+create procedure 
+fct_validate_xsd_float (in str varchar) {
+  declare ret varchar;
+
+  ret := regexp_match ('^[-+]?([0-9]+(\.[0-9]*)?|\.[0-9]+)([eE][-+]?[0-9]+)$', str); -- simple case
+
+  if (ret is not null) 
+  {
+    return ret;
+  }
+  ret := regexp_match ('^"([^\\\D"]|\\.|[-+]?([0-9]+(\.[0-9]*)?|\.[0-9]+)([eE][-+]?[0-9]+)?|INF|-INF|NaN)"\\^\\^(xsd\\:double|xsd\\:float)',str);
+  return ret;
+
+}
+;
+
+create procedure 
+fct_validate_xsd_decimal (in str varchar) { 
+  return regexp_match ('^"([^\\"]|\\.|[-+]?([0-9]+(\.[0-9]*)?|\.[0-9]+)?)"\\^\\^xsd\\:decimal',str);
+}
+;
+
+create procedure
+fct_validate_xsd_int (in str varchar) 
+{
+  declare ret varchar;
+
+  ret := regexp_match ('^[-+]?[0-9]+$', str); -- simple integers
+  if (ret is not null) 
+  {
+    return ret;
+  }
+  ret := regexp_match ('^"([^\\"]|\\.|[-+]?([0-9]+))"\\^\\^(xsd:int|xsd:integer)$', str);
+  return ret;
+
+}
+;
+
+create procedure 
+fct_validate_xsd_date (in str varchar) {
+  return regexp_match ('^"-?[0-9][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9](Z|[-+]?[0-2][0-9]\\:[0-5][0-9])?"\\^\\^xsd\\:date$', str);
+}
+;
+
+create procedure
+fct_validate_xsd_datetime (in str varchar) 
+{
+  declare retval varchar;
+
+  retval := regexp_match ('^"-?[0-9][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]\\:[0-5][0-9](Z|[-+]?[0-2][0-9]\\:[0-5][0-9])+"\\^\\^xsd\\:dateTime$', str);
+  return retval;
+}
+;
+
+create procedure 
+fct_validate_xsd_str (in str varchar) {
+  declare retval varchar;
+
+  retval := regexp_match ('^"([^\\"\\'']|.*)"(@([a-zA-Z0-9]+)?)(-[a-zA-Z0-9]+)*$', str);
+
+--  if (retval is null) {
+--    retval := sprintf ('''%s''', regexp_replace (str,'["'']','', 1, null));
+--  }
+  return retval;
+}
+;
+
+create procedure 
+fct_validate_cond_input (in str varchar) 
+{
+  declare retval varchar;
+
+  retval := coalesce (fct_validate_xsd_int(str), 
+                      fct_validate_xsd_float (str),
+                      fct_validate_xsd_decimal(str),
+                      fct_validate_xsd_datetime(str),
+                      fct_validate_xsd_date(str),
+                      fct_validate_xsd_str (str));
+
+  return retval;
+}
+;
+
+create procedure 
+fct_value_range (in tree any, 
+                 in sid int, 
+                 in lang varchar, 
+                 in dtp varchar,
+                 in lo varchar,
+                 in hi varchar)
+{
+  declare pos int;
+
+  pos := fct_view_pos (tree);
+
+  lo := fct_validate_cond_input (lo);
+  hi := fct_validate_cond_input (hi);
+
+  if (lo is null and hi is null) 
+  {
+    fct_web (tree);
+    return;
+  }
+  else
+  {
+  tree := xslt (registry_get ('_fct_xslt_') || 'fct_set_view.xsl',
+                tree,
+		vector ('pos', pos, 'op', 'value-range', 'hi', hi, 'lo', lo, 'lang', lang, 'datatype', dtp));
+
+  tree := xslt (registry_get ('_fct_xslt_') || 'fct_set_view.xsl',
+                tree,
+                vector ('pos', 0, 'op', 'view', 'type', 'list', 'limit', 20, 'offset', 0));
+
+  update fct_state set fct_state = tree where fct_sid = sid;
+
+  commit work;
+  } 
+
+  fct_web (tree);
+}
+;
+
+
+create procedure 
 fct_gen_opensearch_link ()
 {
   declare uriqa_str varchar;
@@ -1351,16 +1691,23 @@ fct_vsp ()
   goto exec;
 
   no_ses:
-  if (s_for is not null) {
-    sid := sequence_next ('fct_seq');
-      tree := xtree_doc ('<query inference="" same-as="" view3="" s-term="" c-term=""/>');
-
+  declare r_v any;
 
-    insert into fct_state (fct_sid, fct_state)
-      values (sid, tree);
+  if (s_for is not null) 
+    {
+      r_v := fct_create_ses();
+      sid := r_v[0];
+      tree := r_v[1];
 
     cmd := 'text';
     }
+  else if ('new_with_class' = cmd) 
+    {
+      r_v := fct_create_ses();
+      sid := r_v[0];
+      tree := r_v[1];
+      cmd := 'set_class';
+    }
   else
     goto do_new_ses;
 
@@ -1419,6 +1766,8 @@ exec:;
     fct_drop_cond (tree, sid, atoi (http_param ('cno')));
   else if ('drop_text_prop' = cmd) 
     fct_drop_text_prop (tree, sid);
+  else if ('drop_text' = cmd)
+    fct_drop_text (tree, sid);
   else if ('set_class' = cmd)
     fct_set_class (tree, sid, http_param ('iri'), http_param ('exclude'));
   else if ('open' = cmd)
@@ -1441,6 +1790,13 @@ exec:;
 		      http_param ('lang'),
 		      http_param ('datatype'),
 		      http_param ('op'));
+  else if ('value_range' = cmd)
+    fct_value_range (tree, 
+                     sid, 
+                     http_param('lang'),
+                     http_param('datatype'),
+                     http_param('lo'),
+                     http_param('hi'));
   else if ('save' = cmd)
     fct_save (tree, 
 	      sid,
@@ -1483,16 +1839,15 @@ create procedure fct_virt_info ()
 }
 ;
 
--- /* page header */
+--  page header
+
 create procedure fct_page_head ()
 {
   http ('<div id="hd_l">
-    <h1>
-      <div id="logo">
+    <h1 id="logo">
         <a href="/fct/facet.vsp">
 	   <img src="/fct/images/openlink_site_logo.png" alt="OpenLink Software"/>
         </a>
-      </div>
     </h1>
     <div id="homelink"></div>
   </div> <!-- hd_l -->
diff --git a/binsrc/b3s/fct_drop_cond.xsl b/binsrc/b3s/fct_drop_cond.xsl
index 3260877..8e1f6b1 100644
--- a/binsrc/b3s/fct_drop_cond.xsl
+++ b/binsrc/b3s/fct_drop_cond.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
 --
---  $Id: fct_drop_cond.xsl,v 1.1.2.1 2009/04/17 11:07:29 source Exp $
+--  $Id: fct_drop_cond.xsl,v 1.1.2.2 2010/10/06 21:39:50 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -36,12 +36,14 @@
 <xsl:param name="cno"/>
 
 
-<xsl:template match = "class | value">
+<xsl:template match = "class | value | value-range">
 
   <xsl:if test="$cno != count (./ancestor::*[name () = 'class' or
-	                                     name () = 'value']) +
+	                                     name () = 'value' or
+                                             name () = 'value-range']) +
                       count (./preceding::*[name () = 'class' or 
-                                            name () = 'value'])">
+                                            name () = 'value' or
+                                            name () = 'value-range'])">
     <xsl:copy>
       <xsl:apply-templates select="@* | node()"/>
     </xsl:copy>
diff --git a/binsrc/b3s/fct_drop_text.xsl b/binsrc/b3s/fct_drop_text.xsl
new file mode 100644
index 0000000..5603c97
--- /dev/null
+++ b/binsrc/b3s/fct_drop_text.xsl
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+--
+--  $Id: fct_drop_text.xsl,v 1.1.2.1 2010/12/12 18:09:27 source Exp $
+--
+--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+--  project.
+--
+--  Copyright (C) 1998-2009 OpenLink Software
+--
+--  This project is free software; you can redistribute it and/or modify it
+--  under the terms of the GNU General Public License as published by the
+--  Free Software Foundation; only version 2 of the License, dated June 1991.
+--
+--  This program is distributed in the hope that it will be useful, but
+--  WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+--  General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License along
+--  with this program; if not, write to the Free Software Foundation, Inc.,
+--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+--
+-->
+<xsl:stylesheet version="1.0" 
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="text">
+</xsl:template>
+
+<xsl:template match="@* | node()">
+  <xsl:copy>
+    <xsl:apply-templates select="@* | node()"/>
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/binsrc/b3s/fct_set_default.xsl b/binsrc/b3s/fct_set_default.xsl
new file mode 100644
index 0000000..d5aa92a
--- /dev/null
+++ b/binsrc/b3s/fct_set_default.xsl
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ -  
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -  
+ -  Copyright (C) 1998-2009 OpenLink Software
+ -  
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -  
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -  
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -  
+ -  
+-->
+<xsl:stylesheet version="1.0"
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match = "view">
+</xsl:template>
+
+
+<xsl:template match = "query | property |property-of">
+    <xsl:copy>
+      <xsl:apply-templates select="@* | node()" />
+      <xsl:element name="view">
+        <xsl:attribute name="type">classes</xsl:attribute>
+        <xsl:attribute name="limit">20</xsl:attribute>
+      </xsl:element>
+    </xsl:copy>
+</xsl:template>
+
+<xsl:template match="@* | node()">
+  <xsl:copy>
+    <xsl:apply-templates select="@* | node()"/>
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/binsrc/b3s/fct_set_view.xsl b/binsrc/b3s/fct_set_view.xsl
index 622c09b..7ffaac3 100644
--- a/binsrc/b3s/fct_set_view.xsl
+++ b/binsrc/b3s/fct_set_view.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
 --
---  $Id: fct_set_view.xsl,v 1.1.2.4 2009/09/28 21:25:41 source Exp $
+--  $Id: fct_set_view.xsl,v 1.1.2.6 2010/10/22 21:12:24 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -34,6 +34,8 @@
 <xsl:param name="name"/>
 <xsl:param name="timeout"/>
 <xsl:param name="location-prop"/>
+<xsl:param name="lo"/>
+<xsl:param name="hi"/>
 
 <xsl:template match = "query | property |property-of">
 
@@ -111,7 +113,7 @@
       <xsl:when test="$op = 'class'">
         <class iri="{$iri}"/>
         <xsl:element name="view">
-            <xsl:attribute name="type"></xsl:attribute>
+            <xsl:attribute name="type">list</xsl:attribute>
 	  <xsl:attribute name="limit"> <xsl:value-of select="$limit"/></xsl:attribute>
 	  <xsl:attribute name="offset"> <xsl:value-of select="$offset"/></xsl:attribute>
 	</xsl:element>
@@ -133,6 +135,20 @@
       </value>
     </xsl:if>
 
+      <xsl:if test="$op = 'value-range' and
+	            $pos = count (./ancestor::*[name () = 'query' or
+		                                name () = 'property' or
+			                        name () = 'property-of']) +
+                           count (./preceding::*[name () = 'query' or
+			                         name () = 'property' or
+				                 name () = 'property-of'])">
+        <value-range xml:lang="{$lang}"
+	       datatype="{$datatype}"
+               hi="{$hi}"
+               lo="{$lo}">
+        </value-range>
+      </xsl:if>
+
   </xsl:copy>
 </xsl:if>
 
diff --git a/binsrc/b3s/fct_vsp.xsl b/binsrc/b3s/fct_vsp.xsl
index d8af258..a366a81 100644
--- a/binsrc/b3s/fct_vsp.xsl
+++ b/binsrc/b3s/fct_vsp.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
 --
---  $Id: fct_vsp.xsl,v 1.1.2.11 2010/06/08 21:58:48 source Exp $
+--  $Id: fct_vsp.xsl,v 1.1.2.18 2011/03/24 15:50:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -32,6 +32,7 @@
 <xsl:param name="p_term"/>
 <xsl:param name="o_term"/>
 <xsl:param name="t_term"/>
+<xsl:param name="p_qry"/>
 
 <xsl:template match = "facets">
 <div id="res">
@@ -167,8 +168,18 @@ function init(){
 	    </xsl:with-param>
 	  </xsl:call-template>
         </xsl:for-each>
-      </xsl:when>
+      </xsl:when> <!-- multiple results -->
       <xsl:otherwise>
+        <xsl:if test="/facets/result/@type='propval-list'">
+          <!--form>
+            <input type="hidden" name="cmd" value="value_range"/>
+            <input type="hidden" name="sid"><xsl:attribute name="value"><xsl:value-of select="$sid"/></xsl:attribute></input>
+            Value range between <input name="lo" type="text"/>
+            and <input name="hi" type="text"/>
+            <input type="submit" value="set"/>
+            <span class="info">Plain integer, or RDF datatype (Ex: "1988-01-01"^^xsd:date, "Neubauten"@de)</span>
+          </form-->                
+        </xsl:if>
         <xsl:for-each select="/facets/result">
 	  <xsl:call-template name="render-result">
 	    <xsl:with-param name="view-type"><xsl:value-of select="$type"/></xsl:with-param>
@@ -199,10 +210,49 @@ function init(){
 </div> <!-- #res -->
 <script type="text/javascript">
   var sparql_a = OAT.Dom.create('a',{}, 'sparql_a');
-  sparql_a.href='sparql.vsp?q=<xsl:value-of select="urlify (/facets/sparql)"/>'
+  sparql_a.href='/sparql?qtxt=<xsl:value-of select="urlify ($p_qry)"/>'
   sparql_a.innerHTML = 'View query as SPARQL';
   OAT.Dom.append (['sparql_a_ctr',sparql_a]);
 </script>
+<xsl:if test="$type = 'default'">
+<script type="text/javascript">
+  if ($('pivot_a_ctr')) {
+	  var pivot_a = OAT.Dom.create('a',{}, 'pivot_a');
+      pivot_a.href='/pivot_collections/pivot.vsp?sid=<xsl:value-of select="$sid"/>&limit=75&qrcodes=0&CXML_redir_for_subjs=&CXML_redir_for_hrefs=&q=<xsl:value-of select="urlify (normalize-space(/facets/sparql))"/>'
+	  pivot_a.innerHTML = 'Make Pivot collection';
+      pivot_a.id = 'pivot_a_mpc';
+
+      var pivot_pg = OAT.Dom.create('span', {}, 'pivot_pg');
+      pivot_pg.innerHTML = '  ( <a  href="#" title="Sets the maximum number of entities displayed in a PivotViewer page. Entities on other pages are accessible via Related Collections links. A value of 0 disables paging, displaying all entities in a single PivotViewer page. Range: 0..1000">Page size</a> <input type="text" onblur="fct_set_pivot_page_size()" id="pivot_pg_size" size="4" maxlength="4" value="75" />  )';
+	  var pivot_qrcode_opts = OAT.Dom.create('span', {}, 'pivot_qrcode_opts');
+	  pivot_qrcode_opts.innerHTML = '  <a href="#" title="Include a QRcode adjacent to each item\'s image">with QRcodes</a><input type="checkbox" onclick="fct_set_pivot_qrcode_opt()" id="pivot_qrcode" />';
+
+	  var pivot_link_opts = OAT.Dom.create('span', {}, 'pivot_link_opts');
+	  pivot_link_opts.innerHTML = '  \
+          <!--\
+	  <a href="#" title="Sets the CXML type of subject URIs to String or Link, optionally performing a DESCRIBE on the subject">Style for RDF subjects</a> \
+	  <select id="CXML_redir_for_subjs" onchange="fct_set_pivot_subj_uri_opt()">\
+	  		<option value="" selected="true">Convert to string facets</option>\
+			<option value="121">Make plain links</option>\
+			<option value="LOCAL_PIVOT">Make SPARQL DESCRIBE Pivot links</option>\
+			<option value="LOCAL_TTL">Make SPARQL DESCRIBE download links (TTL)</option>\
+			<option value="LOCAL_CXML">Make SPARQL DESCRIBE download links (CXML)</option>\
+		</select>\
+		  \
+                -->\
+		<a href="#" title="Sets the CXML type of resource URIs to String or Link, optionally performing a DESCRIBE on the resource">CXML link behavior</a> \
+		<select id="CXML_redir_for_hrefs" onchange="fct_set_pivot_href_opt()">\
+			<option value="" selected="true">Local faceted navigation links</option>\
+			<option value="121">External resource links</option>\
+			<option value="LOCAL_PIVOT">External faceted navigation links</option>\
+			<option value="LOCAL_TTL">External description resource (TTL)</option>\
+			<option value="LOCAL_CXML">External description resource (CXML)</option>\
+		</select>';
+
+      OAT.Dom.append (['pivot_a_ctr',pivot_a,pivot_pg,pivot_qrcode_opts,pivot_link_opts]);
+  }
+</script>
+</xsl:if>
 </xsl:template>
 
 <xsl:template name="render-pager">
@@ -236,19 +286,19 @@ function init(){
     <xsl:choose>
       <xsl:when test="$view-type = 'properties'">
 	<div class="dbg"><xsl:value-of select="$view-type"/></div>
-	<tr><th><xsl:value-of select="$p_term"/></th><th>Label</th><th>Count</th></tr>
+	<tr><th><xsl:value-of select="$p_term"/></th><!--th>Label</th--><th>Count</th></tr>
       </xsl:when>
       <xsl:when test="$view-type = 'list-count'">
 	<div class="dbg"><xsl:value-of select="$view-type"/></div>
-	<tr><th><xsl:value-of select="$s_term"/></th><th>Title</th><th>Count</th></tr>
+	<tr><th><xsl:value-of select="$s_term"/></th><!--th>Title</th--><th>Count</th></tr>
       </xsl:when>
       <xsl:when test="$view-type = 'text-properties'">
 	<div class="dbg"><xsl:value-of select="$view-type"/></div>
-	<tr><th><xsl:value-of select="$p_term"/></th><th>Label</th><th>Count</th></tr>
+	<tr><th><xsl:value-of select="$p_term"/></th><!--th>Label</th--><th>Count</th></tr>
       </xsl:when>
       <xsl:when test="$view-type = 'properties-in'">
 	<div class="dbg"><xsl:value-of select="$view-type"/></div>
-	<tr><th><xsl:value-of select="$p_term"/></th><th>Label</th><th>Count</th></tr>
+	<tr><th><xsl:value-of select="$p_term"/></th><!--th>Label</th--><th>Count</th></tr>
       </xsl:when>
       <xsl:when test="$view-type = 'list'">
 	<div class="dbg"><xsl:value-of select="$view-type"/></div>
@@ -256,7 +306,7 @@ function init(){
       </xsl:when>
       <xsl:when test="$view-type = 'classes'">
 	<div class="dbg"><xsl:value-of select="$view-type"/></div>
-	<tr><th><xsl:value-of select="$t_term"/></th><th>Label</th><th>Count</th></tr>
+	<tr><th><xsl:value-of select="$t_term"/></th><!--th>Label</th--><th>Count</th></tr>
       </xsl:when>
       <xsl:when test="$view-type = 'text' or $view-type = 'text-d'">
 	<div class="dbg"><xsl:value-of select="$view-type"/></div>
@@ -280,14 +330,11 @@ function init(){
             </td>
 	</xsl:if>
 	    <td>
-	      <xsl:if test="'url' = column[1]/@dataview-type">
-		<a>
-		  <xsl:attribute name="href">
+	      <xsl:if test="'url' = column[1]/@datatype">
+		<a><xsl:attribute name="href">
 		    /describe/?url=<xsl:value-of select="urlify (column[1])"/>&sid=<xsl:value-of select="$sid"/>
 		  </xsl:attribute>
-		  <xsl:attribute name="class">describe</xsl:attribute>
-		    Describe
-		</a>
+		  <xsl:attribute name="class">describe</xsl:attribute>Describe</a>
 	      </xsl:if>
 	      <xsl:if test="$view-type = 'properties' or $view-type = 'classes'">
 		  <input type="checkbox" name="cb" value="{position (.)}" checked="true" onclick="javascript:fct_sel_neg (this)"/>
@@ -309,6 +356,9 @@ function init(){
 		  <xsl:value-of select="column[1]"/>
 		</xsl:attribute>
 		<xsl:choose>
+		  <xsl:when test="'' != string (column[2])">
+		      <xsl:value-of select="column[2]"/>
+		  </xsl:when>
 		  <xsl:when test="'' != column[1]/@shortform">
 		    <xsl:value-of select="column[1]/@shortform"/>
 		  </xsl:when>
@@ -318,14 +368,16 @@ function init(){
 		</xsl:choose>
 	      </a>
 	    </td>
-	    <td>
+	    <!--td>
 	      <xsl:choose>
-		<xsl:when test="'' != ./@shortform"><xsl:value-of select="./@shortform"/></xsl:when>
+		  <xsl:when test="'' != ./@shortform">
+		      <xsl:value-of select="./@shortform"/>
+		  </xsl:when>
 		<xsl:otherwise>
 		  <xsl:value-of select="column[2]"/>
 		</xsl:otherwise>
 	      </xsl:choose>
-	    </td>
+	    </td-->
 	    <td>
 	      <xsl:apply-templates select="column[3]"/>
 	    </td>
diff --git a/binsrc/b3s/images/goout.gif b/binsrc/b3s/images/sponge.png
similarity index 100%
copy from binsrc/b3s/images/goout.gif
copy to binsrc/b3s/images/sponge.png
diff --git a/binsrc/b3s/make_vad.sh b/binsrc/b3s/make_vad.sh
old mode 100644
new mode 100755
index 49af661..e3682f0
--- a/binsrc/b3s/make_vad.sh
+++ b/binsrc/b3s/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.1.2.6 2010/02/01 12:44:31 source Exp $
+#  $Id: make_vad.sh,v 1.1.2.7 2011/03/08 15:43:44 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -267,7 +267,7 @@ sticker_init() {
   echo "  <name package=\"$VAD_NAME\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"$VAD_DESC\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
diff --git a/binsrc/b3s/rdfdesc/description.sql b/binsrc/b3s/rdfdesc/description.sql
index f8a2356..94969cb 100644
--- a/binsrc/b3s/rdfdesc/description.sql
+++ b/binsrc/b3s/rdfdesc/description.sql
@@ -1,5 +1,5 @@
 --
---  $Id: description.sql,v 1.1.2.18 2010/07/08 13:23:48 source Exp $
+--  $Id: description.sql,v 1.1.2.27 2011/03/25 16:19:26 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -148,14 +148,19 @@ b3s_handle_ses (inout _path any, inout _lines any, inout _params any)
 }
 ;
 
-create procedure b3s_type (in subj varchar, out url varchar)
+-- XXX should probably find the most specific if more than one class and inference rule is set
+
+create procedure b3s_type (in subj varchar, 
+                           in _from varchar, 
+                           out url varchar, 
+                           out c_iri varchar)
 {
   declare meta, data, ll any;
   ll := 'unknown';
   url := 'javascript:void()';
   if (length (subj))
     {
-      exec (sprintf ('sparql select ?l ?tp  { <%S> a ?tp . optional { ?tp rdfs:label ?l } }', subj), 
+      exec (sprintf ('sparql select ?l ?tp %s where { <%S> a ?tp . optional { ?tp rdfs:label ?l } }', _from, subj), 
 	  null, null, vector (), 100, meta, data);
       if (length (data))
 	{
@@ -164,6 +169,7 @@ create procedure b3s_type (in subj varchar, out url varchar)
 	  else  
 	    ll := b3s_uri_local_part (data[0][1]);
 	  url := b3s_http_url (data[0][1]);
+          c_iri := data[0][1];
 	}
     }
   return ll;
@@ -210,7 +216,7 @@ b3s_render_inf_opts ()
     {
       if (RS_NAME = inf) 
         {
-          http (sprintf ('<option value="%s" selected="true">%s</option>', RS_NAME, RS_NAME));
+          http (sprintf ('<option value="%s" selected="selected">%s</option>', RS_NAME, RS_NAME));
           f := 1;
         }
       else 
@@ -218,7 +224,7 @@ b3s_render_inf_opts ()
     }
 
   if (f = 0)
-    http ('<option value="**none**" selected="true">None</option>');
+    http ('<option value="**none**" selected="selected">None</option>');
   else 
     http ('<option value="**none**">None</option>');
 }
@@ -308,9 +314,9 @@ b3s_render_ses_params ()
   s := connection_get ('sas');
   sid := connection_get ('sid');
 
-  if (i is not null) i := '&inf=' || i;
-  if (s is not null) i := i || '&sas=' || s;
-  if (sid is not null) i := i || '&sid=' || sid;
+  if (i is not null) i := '&inf=' || sprintf ('%U', i);
+  if (s is not null) i := i || '&sas=' || sprintf ('%V', s);
+  if (sid is not null) i := i || '&sid=' || sprintf ('%V', sid);
 
   if (i is not null) return i;
   else return '';
@@ -394,9 +400,18 @@ create procedure b3s_label_get (inout data any, in langs any)
 	    }
 	 }
      }
+   if (__tag of rdf_box = __tag (label))
+     label := rdf_box_data (label);
    if (not isstring (label))
      label := cast (label as varchar);
-   label := regexp_replace (label, '<[^>]+>', '', 1, null);  
+   --label := regexp_replace (label, '<[^>]+>', '', 1, null);  
+  if (0 and sys_stat ('cl_run_local_only'))
+    {
+   label := xpath_eval ('string(.)', xtree_doc (label, 2));
+   label := charset_recode (label, '_WIDE_', 'UTF-8');
+    }
+  else
+    label := cast (xtree_doc (label, 2) as varchar);
    return label;
 }
 ;
@@ -475,6 +490,18 @@ b3s_uri_curie (in uri varchar)
 }
 ;
 
+create procedure b3s_prop_label (in uri any)
+{
+  declare ll varchar;
+  ll := (select top 1 __ro2sq (O) from DB.DBA.RDF_QUAD where S = __i2idn (uri) and P = __i2idn ('http://www.w3.org/2000/01/rdf-schema#label') OPTION (QUIETCAST));
+  if (length (ll) = 0)
+    ll := b3s_uri_curie (uri);
+  if (isstring (ll) and ll like 'opl%:isDescribedUsing')
+    ll := 'Described Using Terms From';  
+  return ll;
+}
+;
+
 create procedure
 b3s_trunc_uri (in s varchar, in maxlen int := 80)
 {
@@ -492,7 +519,7 @@ b3s_trunc_uri (in s varchar, in maxlen int := 80)
 ;
 
 create procedure 
-b3s_http_url (in url varchar, in sid varchar := null)
+b3s_http_url (in url varchar, in sid varchar := null, in _from varchar := null)
 {
   declare host, pref, more, i varchar;
 
@@ -504,6 +531,8 @@ b3s_http_url (in url varchar, in sid varchar := null)
 --    more := '';
 
   i := b3s_render_ses_params();
+  if (length (_from))
+    i := sprintf ('%s&graph=%U', i, _from);
   
   return sprintf ('/describe/?url=%U%s', url, i);
 };
@@ -514,7 +543,7 @@ b3s_http_print_l (in p_text any, inout odd_position int, in r int := 0, in sid v
    declare short_p, p_prefix, int_redirect, url any;
 
    odd_position :=  odd_position + 1;
-   p_prefix := b3s_uri_curie (p_text);
+   p_prefix := b3s_prop_label (p_text);
    url := b3s_http_url (p_text, sid);
 
    if (not length (p_text))
@@ -535,8 +564,40 @@ b3s_http_print_l (in p_text any, inout odd_position int, in r int := 0, in sid v
 }
 ;
 
+create procedure b3s_label (in _S any, in langs any)
+{
+  declare best_str, meta, data any;
+  declare best_q, q float;
+  declare lang, stat, msg varchar;
+
+  stat := '00000';
+  exec (sprintf ('sparql define input:inference "virtrdf-label" '||
+  'select ?o (lang(?o)) where { <%S> virtrdf:label ?o }', _S), stat, msg, vector (), 0, meta, data);
+  if (stat <> '00000')
+    return '';
+  best_str := '';
+  best_q := 0;
+  if (length (data))
+    {
+      for (declare i, l int, i := 0, l := length (data); i < l; i := i + 1)
+	{
+	  q := rdfdesc_get_lang_by_q (langs, data[i][1]);
+	  --dbg_obj_print (data[i][0], langs, data[i][1], q);
+          if (q > best_q)
+	    {
+	      best_str := data[i][0];
+	      best_q := q;
+	    }
+	}
+    }
+  if (__tag (best_str) = 246)
+    best_str := rdf_box_data (best_str);
+  return best_str;
+}
+;
+
 create procedure 
-b3s_http_print_r (in _object any, in sid varchar, in prop any, in label any, in rel int := 1, in acc any := null)
+b3s_http_print_r (in _object any, in sid varchar, in prop any, in langs any, in rel int := 1, in acc any := null, in _from varchar := null)
 {
    declare lang, rdfs_type, rdfa, visible any;
 
@@ -588,7 +649,22 @@ again:
        http (sprintf ('<!-- %d -->', length (_url)));
 
        rdfa := b3s_rel_print (prop, rel, 0);
-       http (sprintf ('<a class="uri" %s href="%s">%s</a>', rdfa, b3s_http_url (_url, sid), b3s_uri_curie(_url)));
+       if (http_mime_type (_url) like 'image/%')
+	 http (sprintf ('<a class="uri" %s href="%s"><img src="%s" height="160" style="border-width:0" alt="External Image" /></a>', rdfa, b3s_http_url (_url, sid, _from), _url));
+       else
+	 {
+	   declare lbl any;
+	   lbl := '';
+	   if (registry_get ('fct_desc_value_labels') = '1' and (__tag (_object) = 243 or (isstring (_object) and __box_flags (_object) = 1)))
+	     lbl := b3s_label (_url, langs);
+	   if ((not isstring(lbl)) or length (lbl) = 0)
+	     lbl := b3s_uri_curie(_url);
+	   -- XXX: must encode as wide label to print correctly  
+	   --http (sprintf ('<a class="uri" %s href="%s">%V</a>', rdfa, b3s_http_url (_url, sid, _from), lbl));
+	   http (sprintf ('<a class="uri" %s href="%s">', rdfa, b3s_http_url (_url, sid, _from)));
+	   http_value (charset_recode (lbl, 'UTF-8', '_WIDE_'));
+	   http (sprintf ('</a>'));
+	 }
        --if (registry_get ('fct_sponge') = '1' and _url like 'http://%' or _url like 'https://%')
        --	 http (sprintf (' <a class="uri" href="%s&sp=1"><img src="/fct/images/goout.gif" title="Sponge" border="0"/></a>', 
        --	       b3s_http_url (_url, sid)));
@@ -648,6 +724,18 @@ again:
        http (cast (_object as varchar));
        http ('</span>');
      }
+   else if (__tag (_object) = 222)
+     {
+       http (sprintf ('<span %s>', rdfa));
+       http (cast (_object as varchar));
+       http ('</span>');
+     }
+   else if (__tag (_object) = 126)
+     {
+       http (sprintf ('<span %s>', rdfa));
+       http ('<binary object>');
+       http ('</span>');
+     }
    else
      http (sprintf ('FIXME %i', __tag (_object)));
 
@@ -683,3 +771,164 @@ create procedure b3s_page_get_short (in val any)
 }
 ;
 
+create procedure fct_links_hdr (in subj any, in desc_link any)
+{
+  declare links varchar;
+  desc_link := sprintf ('http://%{WSHost}s%s', desc_link);
+  links := 'Link: ';
+  links := links || 
+  sprintf ('<%s&output=application%%2Frdf%%2Bxml>; rel="alternate"; type="application/rdf+xml"; title="Structured Descriptor Document (RDF/XML format)",', desc_link);
+  links := links || 
+  sprintf ('<%s&output=text%%2Fn3>; rel="alternate"; type="text/n3"; title="Structured Descriptor Document (N3/Turtle format)",', desc_link);
+  links := links || 
+  sprintf ('<%s&output=application%%2Frdf%%2Bjson>; rel="alternate"; type="application/rdf+json"; title="Structured Descriptor Document (RDF/JSON format)",', desc_link);
+  links := links || 
+  sprintf ('<%s&output=application%%2Fatom%%2Bxml>; rel="alternate"; type="application/atom+xml"; title="Structured Descriptor Document (OData/Atom format)",', desc_link);
+  links := links || 
+  sprintf ('<%s&output=application%%2Fodata%%2Bjson>; rel="alternate"; type="application/odata+json"; title="Structured Descriptor Document (OData/JSON format)",', desc_link);
+  links := links || 
+  sprintf ('<%s&output=text%%2Fcxml>; rel="alternate"; type="text/cxml"; title="Structured Descriptor Document (CXML format)",', desc_link);
+  links := links || 
+  sprintf ('<%s&output=text%%2Fcsv>; rel="alternate"; type="text/csv"; title="Structured Descriptor Document (CSV format)",', desc_link);
+  links := links || sprintf ('<%s>; rel="http://xmlns.com/foaf/0.1/primaryTopic",', subj);
+  links := links || sprintf ('<%s>; rev="describedby"\r\n', subj);
+  http_header (http_header_get () || links);
+}
+;
+
+
+create procedure fct_links_mup (in subj any, in desc_link any)
+{
+  declare links varchar;
+  desc_link := sprintf ('http://%{WSHost}s%s', desc_link);
+  links := '';
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=application%%2Frdf%%2Bxml" rel="alternate" type="application/rdf+xml"  title="Structured Descriptor Document (RDF/XML format)" />\n', desc_link);
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=text%%2Fn3" rel="alternate" type="text/n3" title="Structured Descriptor Document (N3/Turtle format)" />\n', desc_link);
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=application%%2Frdf%%2Bjson" rel="alternate" type="application/rdf+json" title="Structured Descriptor Document (RDF/JSON format)" />\n', desc_link);
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=application%%2Fatom%%2Bxml" rel="alternate" type="application/atom+xml" title="Structured Descriptor Document (OData/Atom format)" />\n', desc_link);
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=application%%2Fatom%%2Bjson" rel="alternate" type="application/atom+json" title="Structured Descriptor Document (OData/JSON format)" />\n', desc_link);
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=text%%2Fcxml" rel="alternate" type="text/cxml" title="Structured Descriptor Document (CXML format)" />\n', desc_link);
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=text%%2Fcsv" rel="alternate" type="text/csv" title="Structured Descriptor Document (CSV format)" />\n', desc_link);
+  links := links || repeat (' ', 5) || sprintf ('<link href="%V" rel="http://xmlns.com/foaf/0.1/primaryTopic" />\n', subj);
+  links := links || repeat (' ', 5) || sprintf ('<link href="%V" rev="describedby" />\n', subj);
+  http (links);
+}
+;
+
+create procedure
+fct_make_selector (in subj any, in sid integer) 
+{
+  return null;
+}	
+;
+
+create procedure fct_make_qr_code (in data_to_qrcode any, in src_width int := 120, in src_height int := 120, in qr_scale int := 4)
+{
+  declare qrcode_bytes, mixed_content, content varchar;
+  declare qrcode any;
+
+  if (__proc_exists ('QRcode encodeString8bit', 2) is null)
+    return null;
+
+  declare exit handler for sqlstate '*' { return null; };
+
+  content := "IM CreateImageBlob" (src_width, src_height, 'white', 'jpg');
+  qrcode := "QRcode encodeString8bit" (data_to_qrcode);
+  qrcode_bytes := aref_set_0 (qrcode, 0);
+  mixed_content := "IM PasteQRcode" (qrcode_bytes, qrcode[1], qrcode[2], qr_scale, qr_scale, 0, 0, cast (content as varchar), length (content));
+  mixed_content := encode_base64 (cast (mixed_content as varchar));
+  mixed_content := replace (mixed_content, '\r\n', '');
+  return mixed_content;
+}
+;
+
+create procedure fct_make_curie (in url varchar, in lines any)
+{
+  declare curie, chost, dhost varchar;
+  if (__proc_exists ('WS.CURI.curi_make_curi') is null)
+    return url;
+  curie := WS.CURI.curi_make_curi (url);
+  dhost := registry_get ('URIQADefaultHost');
+  chost := http_request_header(lines, 'Host', null, dhost);
+  return sprintf ('http://%s/c/%s', chost, curie);
+}
+;
+
+
+create procedure DB.DBA.SPARQL_DESC_DICT_LOD_PHYSICAL (in subj_dict any, in consts any, in good_graphs any, in bad_graphs any, in storage_name any, in options any)
+{
+  declare all_subj_descs, phys_subjects, sorted_good_graphs, sorted_bad_graphs, g_dict, res any;
+  declare uid, graphs_listed, g_ctr, good_g_count, bad_g_count, s_ctr, all_s_count, phys_s_count integer;
+  declare gs_app_callback, gs_app_uid varchar;
+
+  if (isinteger (consts))
+    goto normal;
+
+  uid := get_keyword ('uid', options, http_nobody_uid());
+  gs_app_callback := get_keyword ('gs-app-callback', options);
+  if (gs_app_callback is not null)
+    gs_app_uid := get_keyword ('gs-app-uid', options);
+
+  phys_subjects := dict_list_keys (subj_dict, 0);
+  phys_subjects := vector_concat (phys_subjects, consts);
+  phys_s_count := length (phys_subjects);
+  if (__tag of integer = __tag (good_graphs))
+    {
+      g_dict := dict_new ();
+      vectorbld_init (sorted_bad_graphs);
+      foreach (any g in bad_graphs) do
+	{
+	  if (isiri_id (g) and g < min_bnode_iri_id ())
+	    vectorbld_acc (sorted_bad_graphs, g);
+	}
+      vectorbld_final (sorted_bad_graphs);
+      for (s_ctr := phys_s_count - 1; s_ctr >= 0; s_ctr := s_ctr - 1)
+	{
+	  declare subj, graph any;
+	  subj := phys_subjects [s_ctr];
+	  graph := coalesce ((select top 1 G as g1 from DB.DBA.RDF_QUAD where O = subj and 0 = position (G, sorted_bad_graphs) and
+	    __rgs_ack_cbk (G, uid, 1) and
+	    (gs_app_callback is null or bit_and (1, call (gs_app_callback) (G, gs_app_uid))) ) );
+	  if (graph is not null)
+	    dict_put (g_dict, graph, 0);
+	}
+      sorted_good_graphs := dict_list_keys (g_dict, 0);
+      if (0 = length (sorted_good_graphs))
+	{
+	  g_dict := dict_new ();
+	  for (s_ctr := phys_s_count - 1; s_ctr >= 0; s_ctr := s_ctr - 1)
+	    {
+	      declare subj, graph any;
+	      subj := phys_subjects [s_ctr];
+	      graph := coalesce ((select top 1 G as g1 from DB.DBA.RDF_QUAD where S = subj and 0 = position (G, sorted_bad_graphs) and
+		__rgs_ack_cbk (G, uid, 1) and
+		(gs_app_callback is null or bit_and (1, call (gs_app_callback) (G, gs_app_uid))) ) );
+	      if (graph is not null)
+		dict_put (g_dict, graph, 0);
+	    }
+	  sorted_good_graphs := dict_list_keys (g_dict, 1);
+	}
+      if (0 < length (sorted_good_graphs))
+	good_graphs := sorted_good_graphs;
+    }
+  normal:
+  return DB.DBA.SPARQL_DESC_DICT (subj_dict, consts, good_graphs, bad_graphs, storage_name, options);
+}
+;
+
+create procedure DB.DBA.SPARQL_DESC_DICT_LOD (in subj_dict any, in consts any, in good_graphs any, in bad_graphs any, in storage_name any, in options any)
+{
+  return DB.DBA.SPARQL_DESC_DICT (subj_dict, consts, good_graphs, bad_graphs, storage_name, options);
+}
+;
+
+grant execute on DB.DBA.SPARQL_DESC_DICT_LOD_PHYSICAL to "SPARQL_SELECT";
+grant execute on DB.DBA.SPARQL_DESC_DICT_LOD to "SPARQL_SELECT";
+
diff --git a/binsrc/b3s/rdfdesc/description.vsp b/binsrc/b3s/rdfdesc/description.vsp
index c57f55b..ebbda4d 100644
--- a/binsrc/b3s/rdfdesc/description.vsp
+++ b/binsrc/b3s/rdfdesc/description.vsp
@@ -1,9 +1,10 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" version="XHTML+RDFa 1.0">
 <?vsp
 --
 --
---  $Id: description.vsp,v 1.1.2.24 2010/07/08 13:23:48 source Exp $
+--  $Id: description.vsp,v 1.1.2.37 2011/03/25 16:19:26 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -33,9 +34,16 @@
    declare dbg_out any;
    declare inf_parm varchar;
   declare ses_parms varchar;
-  declare all_langs, dset any;
-  declare iri_type, iri_uri varchar;
-
+  declare all_langs, lang_parm any;
+  declare c_iri, iri_type, iri_uri, _F, _from, topof varchar;
+  declare page, n_per_page, lim, ofs, dis_next int;
+  declare vis, printed, _skip, _last int;
+  declare all_lang any;
+  declare curr_pred any;
+  declare dt1, dt2, count_str, tbinf, ua varchar;
+
+  n_per_page := 100;
+  dis_next := 0;
    dbg_enable := get_keyword ('dbg', params);
    if (dbg_enable = '1') 
      {
@@ -57,6 +65,12 @@
 
    b3s_parse_inf (sid, params);
    inf := b3s_render_inf_clause ();
+  tbinf := connection_get ('inf');
+  if (tbinf is not null)
+    tbinf := sprintf ('TABLE OPTION (WITH \'%s\')', tbinf);
+  else
+    tbinf := '';
+  
 
   ses_parms := b3s_render_ses_params ();
 
@@ -64,12 +78,36 @@
   if (host is null)
    host := http_request_header (http_request_header (), 'Host');  
    langs := http_request_header_full (lines, 'Accept-Language', 'en');
+  ua :=   http_request_header (lines, 'User-Agent');
   all_langs := b3s_get_lang_acc (lines);
-  dset := get_keyword ('lang', params, '');
-  if (length (dset))
-    all_langs := vector (dset, 1.0);
+  lang_parm := get_keyword ('lang', params, '');
+  if (length (lang_parm))
+    {
+      all_langs := vector (lang_parm, 1.0);
+      langs := lang_parm;
+    }
    gr := get_keyword ('g', params, '');
-
+  _from := get_keyword ('graph', params, '');
+--  dbg_obj_print_vars (gr, _F);
+  if (length (_from))
+    _F := concat ('FROM <', _from, '>');
+  else
+    _F := '';
+
+   _last := atoi (get_keyword ('lp', params, '0'));
+  if ({?'prev'} is not null)  
+    page := atoi (get_keyword ('op', params, '0'));
+  else if ({?'first'} is not null)  
+    page := 0; 
+  else if ({?'last'} is not null)  
+    page := _last;
+  else if ({?'next'} is not null) 
+    page := atoi (get_keyword ('p', params, '0'));
+  else if ({?'go'} is not null) 
+    page := atoi (get_keyword ('gp', params, '1')) - 1;
+  else 
+    page := atoi (get_keyword ('p', params, '1')) - 1;
+  --topof := '';
   b3s_dbg_out (dbg_out, 'sid     : ' || sid);
   b3s_dbg_out (dbg_out, 'gr      : ' || gr);
 
@@ -80,13 +118,14 @@
 
    page_resource_uri := gr;
    page_resource_uri := replace (page_resource_uri, '%23', '#');
+  page_resource_uri := replace (page_resource_uri, ' ', '%20');
    
    _S := page_resource_uri; 
    proxy_iri := page_resource_uri;
 
   b3s_dbg_out (dbg_out, 'page_resource_uri: ' || page_resource_uri);
 
-  if (get_keyword ('sp', params) = '1')
+  if (get_keyword ('sp', params) = '1' and 0 = length (_F))
     {
       DB.DBA.EXEC_AS (sprintf ('sparql define input:storage "" define get:soft "soft" SELECT * from <%S> where { ?x ?y ?z . }', gr), 'SPARQL');
       DB.DBA.VT_INC_INDEX_DB_DBA_RDF_OBJ ();
@@ -98,7 +137,7 @@
    http_header ('Cache-Control: no-cache, must-revalidate\r\nPragma: no-cache\r\n');
    label := ''; _subject := '';
 
-   qry_str := sprintf ('sparql define input:inference "facets" select ?o (lang(?o)) where { <%S> virtrdf:label ?o }', _S);
+  qry_str := sprintf ('sparql define input:inference "facets" select ?o (lang(?o)) %s where { <%S> virtrdf:label ?o }', _F, _S);
    b3s_dbg_out (dbg_out, 'qry: ' || qry_str);
 
 --dbg_obj_print (qry_str);
@@ -107,9 +146,9 @@
 
    label := b3s_label_get (data, langs);
    true_label := label;
-  iri_type := b3s_type (_S, iri_uri);
+  iri_type := b3s_type (_S, _F, iri_uri, c_iri);
 
-   qry_str := sprintf ('sparql %s prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix dc: <http://purl.org/dc/elements/1.1/> select ?o (lang(?o)) where { <%S> rdfs:comment ?o }', inf, _S);
+  qry_str := sprintf ('sparql %s prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix dc: <http://purl.org/dc/elements/1.1/> select ?o (lang(?o)) %s where { <%S> rdfs:comment ?o }', inf, _F, _S);
 --    dbg_obj_print (qry_str);
 
    b3s_dbg_out (dbg_out, 'qry: ' || qry_str);
@@ -118,22 +157,66 @@
 
    _subject := b3s_label_get (data, langs);
 
-  rdf_link := sprintf ('/sparql?query=%U', sprintf ('%s DESCRIBE <%s>', b3s_render_inf_clause(), _S)); 
-
-  declare __res_desc varchar;
-
+  rdf_link := sprintf ('/sparql?query=%U', sprintf ('define sql:describe-mode "LOD" %s DESCRIBE <%s>', b3s_render_inf_clause(), _S)); 
+
+  declare __res_desc, qs, qv, best_variant, accept varchar;
+  declare best_q, curr float;
+  declare inx int;
+
+  accept := http_request_header_full (lines, 'Accept', 'text/html');
+  if (accept = '*/*')
+    accept := 'text/html';
+  -- accepted types
+  qs := vector ('text/html', 'application/xhtml+xml', 'text/n3', 'text/rdf+n3', 'application/rdf+xml', 'application/json', 'text/plain');
+  -- quality prefs
+  qv := vector (        0.5,                     0.7, 	    0.8,           0.8,                   1.0,                0.7,          0.1);
+  best_q := 0;
+  best_variant := null;
+  inx := 0;
+  foreach (varchar q in qs) do
+    {
+      curr := DB.DBA.URLREWRITE_CALC_QS (accept, q);
+      curr := curr;
+      if (best_q < curr)
+        {
+	  best_q := curr;
+	  best_variant := q;
+	} 
+      inx := inx + 1;
+    }
+  if (best_variant is null)
+    {
+      http_rewrite ();
+      http_status_set (406);
+      http_header ('Alternates: ');
+      http_header (http_header_get () || sprintf ('{ "http://%{WSHost}s/describe/?url=%U" 0.5 {type text/html}}', gr));
+      inx := 0;
+      foreach (varchar q in qs) do
+        {
+	  if (q  not in ('text/html', 'application/xhtml+xml'))
+	    http_header (http_header_get () || sprintf (', { "http://%{WSHost}s%s&format=%U" %.2f {type %s}}', rdf_link, q, qv[inx], q));
+          inx := inx + 1;
+	}
+      http_header (http_header_get () || '\r\n');
+      return; 
+    }
+  if (best_variant is not null and best_variant not in ('text/html', 'application/xhtml+xml'))
+    {
+      http_rewrite ();
+      http_status_set (303);
+      http_header (sprintf ('TCN: choice\r\nVary: negotiate,accept\r\nLocation: http://%{WSHost}s%s&format=%U\r\n', rdf_link, best_variant));
+      return; 
+    }
   __res_desc := b3s_uri_curie(page_resource_uri);
-
+  fct_links_hdr (_S, rdf_link);
   if (not length (label))
-    label := page_resource_uri;
+    label := b3s_trunc_uri (page_resource_uri);
   --http_flush (1);
 ?>
-
-<!-- header -->
 <head>
     <base href="http://<?V host ?>/fct/rdfdesc/" />
-    <title>About: <?vsp http (sprintf ('%s', label)); ?></title>
-    <link rel="alternate" type="application/rdf+xml" href="<?=rdf_link?>" title="RDF" />
+    <title>About: <?vsp http (label); ?></title>
+    <!--link rel="alternate" type="application/rdf+xml" href="<?=rdf_link?>" title="RDF" /-->
 
     <link rel="stylesheet" type="text/css" href="styles/default.css"  charset="utf-8" />
     <link rel="stylesheet" type="text/css" href="styles/highlighter.css" charset="utf-8" />
@@ -142,6 +225,7 @@
     </script>
     <script type="text/javascript" src="/fct/oat/toolkit/loader.js"></script>
     <script type="text/javascript" src="s/description.js"></script>
+<?vsp fct_links_mup (_S, rdf_link); ?>
 </head>
   <body about="<?V page_resource_uri ?>">
     <div id="PG">
@@ -173,86 +257,169 @@
     </div> <!-- #HD -->
     <div id="MD">
         <div class="page_resource_info">
-      <h2>About: <a href="<?= case when page_resource_uri like 'nodeID://%' then b3s_http_url (page_resource_uri) else page_resource_uri end ?>"><?vsp http (sprintf ('%s', label)); ?></a></h2>
+	<h2>About: <a href="<?= case when page_resource_uri like 'nodeID://%' then b3s_http_url (page_resource_uri) else page_resource_uri end ?>"><?vsp http (label); ?></a>   <a href="/describe/?url=<?U page_resource_uri ?>&sid=<?V sid ?>&sp=1" title="Click to generate local descriptor data for this entity" id="sp_link" rel="nofollow"><img src="/fct/images/sponge.png" title="Click to generate local descriptor data for this entity" alt="Generate local descriptor data" /></a></h2>
       <div class="ds_inf_info"> 
 	    An Entity of Type : <a href="<?V iri_uri ?>"><?V iri_type ?></a>, 
-	    within Data Space : <a href="http://<?V host ?>"><?V host ?></a>
+	    within Data Space : <a href="http://<?V host ?>"><?V host ?></a><br/>
+<?vsp 
+  declare _ciri varchar;
+
+  if (c_iri = 'http://www.w3.org/2000/01/rdf-schema#Class') {
+    _ciri := gr;
+  }
+  else {
+    _ciri := c_iri;
+  }
+
+  if (sid) { 
+?>
+
+  <a class="fct_sel_as_type" 
+     title="Use as class in facets" 
+     href="/fct/facet.vsp?sid=<?V sid ?>&cmd=set_class&iri=<?/ _ciri ?>">Constrain facet on this type</a>
+
+<?vsp 
+  } else { ?>
+  <a class="fct_sel_as_type" 
+     title="Start new facet session with type" 
+     href="/fct/facet.vsp?cmd=new_with_class&iri=<?/ _ciri ?>">Start faceted browsing from this Type</a>
+<?vsp
+  } 
+  declare qrimg any;
+  qrimg := fct_make_qr_code (fct_make_curie ('http://' || host || b3s_http_url (page_resource_uri), lines));
+  if (qrimg is not null and strcasestr (ua, 'Mobile') is null) {
+?>
+	  <img id="qrcode" alt="QRcode image" src="data:image/jpg;base64,<?V qrimg ?>"/>
+<?vsp } ?>
       </div>
         </div>
-          <?vsp if (_subject <> '') { ?>
+<?vsp 
+if (_subject <> '') { 
+?>
             <p class="subj_desc"><?vsp http (sprintf ('%s', _subject)); ?></p>
-  <?vsp } else { ?>
+<?vsp 
+} else { 
+?>
   <p class="subj_delim"></p>
-          <?vsp } ?>
-<!--                <li><a href="/fct/facet.vsp?sid=<?V sid ?>&cmd=set_class&iri=<?V gr ?>">Choose <?V ''?> as Type</a></li>
-                <li><a href="/fct/facet.vsp?sid=<?V sid ?>&cmd=open_property">Choose <?V ''?> as Property (p)</a></li>
+<?vsp 
+} 
+?>
+<!--            <li><a href="/fct/facet.vsp?sid=<?V sid ?>&cmd=set_class&iri=<?V gr ?>">Choose <?V ''?> as Type</a></li>
+                <li><a href="/fct/facet.vsp?sid=<?V sid ?>&cmd=open_property">Choose <?V ''?> as Property (p)</a></li>
                 <li><a href="">Choose <?V ''?> as Value (o)</a></li> -->
 <!-- proptable -->
       <table class="description">
 
 <?vsp
-      declare vis, printed int;
-      declare all_lang any;
-      declare curr_pred any;
 
       if (connection_get ('s_term') = 's')
         http ('<tr><th class="property">Properties</th><th class="value">Objects</th></tr>');
       else
         http ('<tr><th class="property">Attributes</th><th class="value">Values</th></tr>');
-
       all_lang := vector ('*', 1.0);
-      qry_str := sprintf ('select "p" as PRED, "o" as OBJECT from (sparql %s select distinct ?p ?o where { <%S> ?p ?o }) sp order by 1', inf, _S);
+      topof := sprintf (' TOP %d, %d  ', n_per_page * page, n_per_page);
+      _skip := n_per_page * page;
+
+      if (length (_F) or 1 = sys_stat ('cl_run_local_only'))
+      { 
+      dt1 := sprintf ('select id_to_iri ("p") as PRED, __ro2sq ("o") as OBJECT LONG VARCHAR, 0 as FLAG int from (sparql %s define output:valmode "LONG" select distinct ?p ?o %s where { <%S> ?p ?o }  order by 1) sp1', inf, _F, _S);
+      }
+      else
+      {
+      dt1 := sprintf ('select id_to_iri ("p") as PRED, __ro2sq ("o") as OBJECT LONG VARCHAR, 0 as FLAG int from (SELECT DISTINCT p, o FROM DB.DBA.RDF_QUAD %s where s = __i2idn (\'%s\' , 1) ORDER BY 1 ASC OPTION (QUIETCAST)) sp1', tbinf, _S);
+      }
+      dt2 := sprintf ('select id_to_iri ("p") as PRED, __ro2sq ("o") as OBJECT LONG VARCHAR, 1 as FLAG int from (sparql %s define output:valmode "LONG" select distinct ?p ?o %s where { ?o ?p <%S> } order by 1) sp2', inf, _F, _S);
+
+      --topof := '';
+      qry_str := sprintf ('select %s PRED, OBJECT, FLAG from (%s UNION ALL %s) un0', topof, dt1, dt2);
+      --dbg_printf ('%s', qry_str);
+      if (_last = 0)
+        { 
+	  if (length (_F) or 1 = sys_stat ('cl_run_local_only'))
+            {
+	      dt1 := sprintf ('select count(*) as cnt from (sparql %s define output:valmode "LONG" select distinct ?p ?o %s where { <%S> ?p ?o }  order by 1) sp1', inf, _F, _S);
+	    }
+          else
+	    {
+              dt1 := sprintf ('select count(*) as cnt from (SELECT DISTINCT p, o FROM DB.DBA.RDF_QUAD %s where s = __i2idn (\'%s\' , 1) ORDER BY 1 ASC OPTION (QUIETCAST)) sp1', tbinf, _S);
+	    }
+	  dt2 := sprintf ('select count(*) as cnt from (sparql %s define output:valmode "LONG" select distinct ?p ?o %s where { ?o ?p <%S> } order by 1) sp2', inf, _F, _S);
+	  count_str := sprintf ('select sum (cnt) from (%s UNION ALL %s) un0', dt1, dt2);
+	  --dbg_printf ('%s', count_str);
+	  exec (count_str, null, null, vector (), 0, meta, data);
+	  _last := data[0][0]; -- sum is supposed to have always number
+	  _last := _last / n_per_page;
+        }
+      
       exec (qry_str, null, null, vector (), 0, null, null, h1); 
       curr_pred := '';
+      inx := 0;
       while (0 = exec_next (h1, null, null, data))	
 	{
-           declare PRED, OBJECT any;
+           declare PRED, OBJECT, FLAG any;
+	   --if (inx <= _skip)
+	   --  goto nxt1;
 	   pred := data[0];  
            object := data[1];
+           FLAG := data[2];
 	   if (not length (PRED))
 	     goto nxt1;
 
 	   if (curr_pred <> pred)
 	     {
                if (curr_pred <> '') http ('</ul></td></tr>');
-	       b3s_http_print_l (PRED, odd_position, 0, sid);
+	       b3s_http_print_l (PRED, odd_position, flag, sid);
 	       curr_pred := pred;
 	     }
-           vis := b3s_http_print_r (OBJECT, sid, PRED, true_label, 1, all_langs);
+           vis := b3s_http_print_r (OBJECT, sid, PRED, langs, 1, all_langs, _from);
 	   nxt1:;
-	}
-      exec_close (h1);
-      if (curr_pred <> '') http ('</ul></td></tr>');
-
-      qry_str := sprintf ('select "p" as PRED, "o" as OBJECT from (sparql %s select distinct ?p ?o where { ?o ?p <%S> }) sp order by 1', inf, _S);
-      exec (qry_str, null, null, vector (), 0, null, null, h1); 
-      inx := 0;	
-      curr_pred := '';
-      while (0 = exec_next (h1, null, null, data))	
-	{
-           declare PRED, OBJECT any;
-	   PRED := data[0];  
-	   OBJECT := data[1];
 	   inx := inx + 1;
-	   if (not length (PRED))
-	     goto nxt2;
-	   if (curr_pred <> pred)
-		  {	
-               if (curr_pred <> '') http ('</ul></td></tr>');
-	       b3s_http_print_l (PRED, odd_position, 1, sid);
-	       curr_pred := pred;
-	     }
-           vis := b3s_http_print_r (OBJECT, sid, PRED, true_label, 0, all_langs);
-	   nxt2:;
 	}
       exec_close (h1);
       if (curr_pred <> '') http ('</ul></td></tr>');
+--      dbg_obj_print (inx);
+      if (inx < n_per_page)
+        dis_next := 1;
+
        if  (odd_position = 0)
 	 {
 	    http ('<tr><td colspan="2"><p>No further information is available.</p></td></tr>');
 	 }
 ?>
       </table>
+      <div id="nav">
+	  <form action="/describe/" method="get">
+	  <div>
+	      <input type="hidden" name="url" value="<?V gr ?>" />
+	      <?vsp if (connection_get ('inf') is not null) { ?>
+	      <input type="hidden" name="inf" value="<?V connection_get ('inf') ?>" />
+	      <?vsp } ?>
+	      <?vsp if (connection_get ('sas') is not null) { ?>
+	      <input type="hidden" name="sas" value="<?V connection_get ('sas') ?>" />
+	      <?vsp } ?>
+	      <input type="hidden" name="p" value="<?V page + 1 ?>"/>
+	      <?vsp if (sid is not null) { ?>
+	      <input type="hidden" name="sid" value="<?V sid ?>"/>
+	      <?vsp } ?>
+	      <input type="hidden" name="lp" value="<?V _last ?>"/>
+	      <?vsp if (topof <> '' and _last > 0) {  if (1 or page > 0) { ?>   
+	      <button type="submit" value="" name="first" <?vsp if (page <= 0) { http ('disabled="disabled"'); } ?>>◂◂ First</button>
+	       
+	      <input type="hidden" name="op" value="<?V page - 1 ?>"/>
+	      <button type="submit" value="" name="prev" <?vsp if (page <= 0) { http ('disabled="disabled"'); } ?>>◂ Prev</button>
+	         
+	<?vsp } if (1 or not dis_next) { ?>   
+	      <button type="submit" value="" name="next" <?vsp if (dis_next) { http ('disabled="disabled"'); } ?>>Next ▸</button>
+	        
+	      <button type="submit" value="" name="last" <?vsp if (dis_next) { http ('disabled="disabled"'); } ?>>Last ▸▸</button>
+	          
+	       Page <?V page + 1 ?> of <?V _last + 1 ?>     
+	       <input type="text" value="<?V page + 1 ?>" size="5" name="gp" />   
+	       <button type="submit" value="" name="go">Go</button>
+	<?vsp } } ?>
+	</div>
+	</form>
+      </div>
     </div> <!--  #MD -->
     <?vsp b3s_render_dbg_out (dbg_out); ?>
 <!-- footer -->
@@ -261,24 +428,43 @@
         Explore alternative Linked Data Views & Meshups using:
         <a href="http://linkeddata.uriburner.com/ode/?uri=<?vsp http_url (page_resource_uri); ?>">OpenLink Data Explorer</a> 
             Raw Data in:
-        <a href="<?=rdf_link || sprintf ('&output=%U', 'text/rdf+n3') ?>">N3</a> |
-        <a href="<?=rdf_link || sprintf ('&output=%U', 'application/rdf+xml') ?>">RDF/XML</a> |
-        <a href="<?=rdf_link || sprintf ('&output=%U', 'application/rdf+json')?>">RDF/JSON</a>
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'text/cxml')?>">CXML</a> |
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'text/csv')?>">CSV</a> | RDF (
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'text/plain') ?>">N-Triples</a>
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'text/rdf+n3') ?>">N3/Turtle</a>
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'application/rdf+json')?>">JSON</a> 
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'application/rdf+xml') ?>">XML</a> ) | OData (
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'application/atom+xml')?>">Atom</a> 
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'application/odata+json')?>">JSON</a> )
            <a href="/fct/facet_doc.html">About</a>   
       </div> <!-- #ft_t -->
       <div id="ft_b">
-        <a href="http://linkeddata.org/"><img alt="This material is Open Knowledge" src="/fct/images/LoDLogo.gif" border="0"></a>  
-        <a href="http://dbpedia.org/sparql"><img alt="W3C Semantic Web Technology" src="/fct/images/sw-sparql-blue.png" border="0"></a>
-        <a href="<?=rdf_link?>" title="RDF data"><img src="/fct/images/sw-rdf-blue.png" alt="[RDF Data]"></a>
-        <a href="http://www.opendefinition.org/"><img alt="This material is Open Knowledge" src="/fct/images/od_80x15_red_green.png" border="0"></a>
+        <a href="http://linkeddata.org/"><img alt="This material is Open Knowledge" src="/fct/images/LoDLogo.gif" style="border-width:0"/></a>  
+        <a href="http://dbpedia.org/sparql"><img alt="W3C Semantic Web Technology" src="/fct/images/sw-sparql-blue.png" style="border-width:0"/></a>
+        <a href="<?=rdf_link?>" title="RDF data"><img src="/fct/images/sw-rdf-blue.png" alt="[RDF Data]" style="border-width:0"/></a>
+        <a href="http://www.opendefinition.org/"><img alt="This material is Open Knowledge" src="/fct/images/od_80x15_red_green.png" style="border-width:0"/></a>
 	<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" 
-	    src="/fct/images/creativecommons.png" /></a><br />
+	    src="/fct/images/creativecommons.png" /></a>
+	<span about=""
+	resource="http://www.w3.org/TR/rdfa-syntax"
+	rel="dc:conformsTo" xmlns:dc="http://purl.org/dc/terms/">
+	<a href="http://validator.w3.org/check?uri=referer"><img
+	    src="http://www.w3.org/Icons/valid-xhtml-rdfa"
+	    alt="Valid XHTML + RDFa" height="27" /></a>
+	</span>
+	<br />
 	This work is licensed under a 
 	<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 Unported License</a>.<br />
 	<?vsp fct_virt_info (); ?><br /> 
-        Copyright © 2010 OpenLink Software
+	Copyright © 2009-2011 OpenLink Software 
       </div> <!-- #ft_b -->
     </div> <!-- #FT -->
     </div> <!-- #PG -->
+<!--    <div id="fct_selector_tpl" style="display:none">
+      <h3></h3>
+      <p class="fct_sel_expln"></p>
+      <div class="form_row"><label for=""></label><input type="text" class="prop_val_lo"/></div><br/>
+      <div class="form_row"><label for=""></label><input type="text" class="prop_val_hi"/></div>
+    </div -->
  </body>
 </html>
diff --git a/binsrc/b3s/rdfdesc/settings.vsp b/binsrc/b3s/rdfdesc/settings.vsp
index 64597d4..704fdfe 100644
--- a/binsrc/b3s/rdfdesc/settings.vsp
+++ b/binsrc/b3s/rdfdesc/settings.vsp
@@ -1,4 +1,5 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <?vsp 
   declare host,gr,page_resource_uri,_S varhar;
@@ -74,7 +75,7 @@
       </div> <!-- #ft_t -->
       <div id="ft_b">
 	<?vsp fct_virt_info (); ?><br /> 
-	Copyright © 2010 OpenLink Software | <a href="/fct/facet_doc.html">About</a>
+	Copyright © 2009-2011 OpenLink Software | <a href="/fct/facet_doc.html">About</a>
       </div> <!-- #ft_b -->
     </div> <!-- #FT -->
   </div> <!-- #PG -->
diff --git a/binsrc/b3s/rdfdesc/usage.vsp b/binsrc/b3s/rdfdesc/usage.vsp
index c939733..280498b 100644
--- a/binsrc/b3s/rdfdesc/usage.vsp
+++ b/binsrc/b3s/rdfdesc/usage.vsp
@@ -1,9 +1,10 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <?vsp
 --
 --
---  $Id: usage.vsp,v 1.1.2.14 2010/06/08 21:58:49 source Exp $
+--  $Id: usage.vsp,v 1.1.2.18 2011/03/24 15:47:56 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -144,18 +145,18 @@
 <!-- proptable -->
     <div id="TAB_ROW">
 	<div class="tab <?vsp http (case when tp = 1 then ' tab_selected' else '' end); ?>">
-        <a href="<?V http_path () ?>?g=<?U _S ?>&tp=1<?V ses_parms ?>">Referenced by Graphs</a>
+        <a href="<?V http_path () ?>?g=<?U _S ?>&tp=1<?V ses_parms ?>">Source Graphs</a>
         </div>
 	<div class="tab <?vsp http (case when tp = 2 then ' tab_selected' else '' end); ?>">
-        <a href="<?V http_path () ?>?g=<?U _S ?>&tp=2<?V ses_parms ?>">Source Graphs</a>
+        <a href="<?V http_path () ?>?g=<?U _S ?>&tp=2<?V ses_parms ?>">Referenced by Graphs</a>
         </div>
 	<div class="tab <?vsp http (case when tp = 3 then ' tab_selected' else '' end); ?>">
           <a title="A list of other identifiers for the current entity."
-           href="<?V http_path () ?>?g=<?U _S ?>&tp=3<?V ses_parms ?>">Direct co-references</a>
+           href="<?V http_path () ?>?g=<?U _S ?>&tp=3<?V ses_parms ?>">Direct coreferences</a>
         </div>
 	<div class="tab <?vsp http (case when tp = 4 then ' tab_selected' else '' end); ?>">
           <a title="A list of indirect identifiers for the current entity based on Inverse Functional Property values."
-           href="<?V http_path () ?>?g=<?U _S ?>&tp=4<?V ses_parms ?>">Indirect co-references</a>
+           href="<?V http_path () ?>?g=<?U _S ?>&tp=4<?V ses_parms ?>">Indirect coreferences</a>
         </div>
       </div> <!-- TAB_ROW -->
 
@@ -255,13 +256,13 @@
       </div> <!-- #ft_t -->
       <div id="ft_b">
         <a href="http://virtuoso.openlinksw.com" title="OpenLink Virtuoso"><img class="powered_by" src="/fct/images/virt_power_no_border.png" alt="Powered by OpenLink Virtuoso"/></a>
-        <a href="http://linkeddata.org/"><img alt="This material is Open Knowledge" src="/fct/images/LoDLogo.gif" border="0"></a>  
-        <a href="http://dbpedia.org/sparql"><img alt="W3C Semantic Web Technology" src="/fct/images/sw-sparql-blue.png" border="0"></a>
-        <a href="<?=rdf_link?>" title="RDF data"><img src="/fct/images/sw-rdf-blue.png" alt="[RDF Data]"></a>
-        <a href="http://www.opendefinition.org/"><img alt="This material is Open Knowledge" src="/fct/images/od_80x15_red_green.png" border="0"></a>
+      <a href="http://linkeddata.org/"><img alt="This material is Open Knowledge" src="/fct/images/LoDLogo.gif" style="border-width:0" /></a>  
+      <a href="http://dbpedia.org/sparql"><img alt="W3C Semantic Web Technology" src="/fct/images/sw-sparql-blue.png" style="border-width:0" /></a>
+      <a href="<?=rdf_link?>" title="RDF data"><img src="/fct/images/sw-rdf-blue.png" alt="[RDF Data]" style="border-width:0" /></a>
+      <a href="http://www.opendefinition.org/"><img alt="This material is Open Knowledge" src="/fct/images/od_80x15_red_green.png" style="border-width:0" /></a>
       <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="/fct/images/creativecommons.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 Unported License</a>. <br/>
       <?vsp fct_virt_info (); ?><br /> 
-      <span class="copyright">Copyright © 2010 OpenLink Software</span>
+      <span class="copyright">Copyright © 2009-2011 OpenLink Software</span>
       </div> <!-- #ft_b -->
     </div> <!-- #FT -->
  </body>
diff --git a/binsrc/b3s/s/description.js b/binsrc/b3s/s/description.js
index c0e34ed..1e9a8e5 100644
--- a/binsrc/b3s/s/description.js
+++ b/binsrc/b3s/s/description.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: description.js,v 1.1.2.2 2009/10/26 09:26:40 source Exp $
+ *  $Id: description.js,v 1.1.2.3 2010/10/22 21:12:25 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -126,3 +126,13 @@ function sas_cb ()
     else parms['sas'] = 'no';
     window.location = href+uri_parms_string(parms);
 }
+
+function sponge_cb ()
+{
+    var loc = window.location;
+    var href = loc.protocol+'//'+loc.host+loc.pathname;
+    var parms = OAT.Dom.uriParams();
+
+    parms['should-sponge'] = $v('should-sponge');
+    window.location = href+uri_parms_string(parms);
+}
diff --git a/binsrc/b3s/styles/default.css b/binsrc/b3s/styles/default.css
index 0e71ee9..e54b9dd 100644
--- a/binsrc/b3s/styles/default.css
+++ b/binsrc/b3s/styles/default.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: default.css,v 1.1.2.13 2010/06/16 10:50:44 source Exp $
+ *  $Id: default.css,v 1.1.2.18 2011/01/05 20:58:20 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -171,7 +171,7 @@ div.doc_ctr { margin: 10px; }
 div.main_actions { float: left; clear: left; width: 100%; text-align: left;}
 div.main_expln { float: left; clear: left; text-align: center; width: 100%;}
 
-#res { float: left; clear: left; margin: 5px 0px 0px 0px; width: 80%}
+#res { float: left; clear: left; margin: 5px 0px 0px 0px; width: 78%}
 #res h3 { margin-top: 0; margin-left: 5px;}
 
 #new_search_txt {}
@@ -240,7 +240,7 @@ table.description ul.obj {
   margin-left: auto;
   margin-right: auto}
 
-#TAB_ROW { width: 800px; margin-left: auto; margin-right: auto;}
+#TAB_ROW { width: 780px; margin-left: auto; margin-right: auto;}
 
 
 div.tab { 
@@ -491,7 +491,7 @@ div.featured .expln { text-align: left;}
 #featured_list { font-size: 9pt;}
 #featured_list td { font-size: 9pt;}
 
-table.sparql_qry_list { width: 80%; margin-left: auto; margin-right: auto}
+table.sparql_qry_list { width: 78%; margin-left: auto; margin-right: auto}
 table.sparql_qry_list td.title { font-weight: bold; }  
 table.sparql_qry_list td.expln { width: 50%; }  
 
@@ -512,3 +512,21 @@ div#dbg_output {
   font-size: 8pt;
 }
 
+span.pivot_pg a, 
+span.pivot_qrcode_opts a,
+span.pivot_link_opts a { text-decoration: none; }
+
+span.pivot_pg a:hover,
+span.pivot_qrcode_opts a:hover,
+span.pivot_link_opts a:hover { text-decoration: underline; }
+
+div#nav {
+    float: left;
+    clear: left;
+    text-align: center;
+    margin-left: 50px;
+}
+
+a#sp_link { font-size: 11pt; font-weight:normal; }
+
+#qrcode { position:fixed; top:100px; right: 30px; z-index: 0; } 
diff --git a/binsrc/b3s/vad_version b/binsrc/b3s/vad_version
index fba132c..d5580fe 100644
--- a/binsrc/b3s/vad_version
+++ b/binsrc/b3s/vad_version
@@ -1 +1 @@
-1.7.82
+1.9.28
diff --git a/binsrc/b3s/www/search.sql b/binsrc/b3s/www/search.sql
index e32039c..ed286af 100644
--- a/binsrc/b3s/www/search.sql
+++ b/binsrc/b3s/www/search.sql
@@ -1,5 +1,5 @@
 --
---  $Id: search.sql,v 1.1.2.8 2010/06/24 15:34:31 source Exp $
+--  $Id: search.sql,v 1.1.2.9 2011/03/24 15:50:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -205,7 +205,7 @@ create procedure head_get (in num varchar)
     vector ('Vendor', 'Offer', 'Business Function', 'Customer Type', 'Offer Object', 'Type of Good', 'Price'),
 --    vector ('Total Products'),
     vector ('Cafe URI', 'Latitude', 'Longitude', 'Cafe Name', 'Church Name', 'Count'),
-    vector ('Road', 'Service', 'Latitude', 'Longitude'),
+    vector ('Road', 'Latitude', 'Longitude'),
     vector ('City URI', 'Distance (km)'),
     vector ('Geometry URI', 'Latitude', 'Longitude'),
     vector ('SKOS Broader', 'SKOS Narrower', 'SKOS Level', 'Entity URI', 'Entity Name', 'Geo Point'),
@@ -852,17 +852,17 @@ s3 := '\')) .
       if (isnull(val)  or val = '') val := '52.000';
 
       s1 :=
-      'sparql SELECT ?road ?services ?lat ?long WHERE ' ||
+      'sparql SELECT ?road ?lat ?long WHERE ' ||
       '  { ' ||
       '    { ' ||
-      '     ?services dbpprop:road ?road . ' ||
+--      '     ?services dbpprop:road ?road . ' ||
       '      ?road a yago:MotorwaysInEngland . ' ||
       '      ?services dbpprop:lat ?lat . ' ||
       '      ?services dbpprop:long ?long . ' ||
       '    } ' ||
       '    UNION ' ||
       '    { ' ||
-      '      ?services dbpprop:road ?road . ' ||
+--      '      ?services dbpprop:road ?road . ' ||
       '      ?road a yago:MotorwaysInScotland . ' ||
       '      ?services dbpprop:lat ?lat . ' ||
       '      ?services dbpprop:long ?long . ' ||
@@ -876,7 +876,7 @@ s3 := '\')) .
   else if (smode='15')
   {
     if (isnull(val)  or val = '') val := 'http://dbpedia.org/resource/London';
-    if (isnull(val2)  or val2 = '') val2 := 'http://dbpedia.org/ontology/City';
+    if (isnull(val2)  or val2 = '') val2 := 'http://dbpedia.org/ontology/PopulatedPlace';
     if (isnull(val3)  or val3 = '') val3 := '10';
     s1 := 'sparql SELECT DISTINCT ?m ( bif:round(bif:st_distance (?geo, ?gm)) ) ' ||
     ' WHERE { <';
@@ -899,15 +899,16 @@ s3 := '\')) .
     s1 := 'sparql SELECT DISTINCT ?s (bif:round(?lat)) AS ?lat (bif:round(?long)) AS ?long ' ||
       ' WHERE ' ||
       '   { ' ||
-      '     { ' ||
-      '       SELECT ?g ?s WHERE  ' ||
-      '         {  ' ||
-      '           graph ?g { ' ||
-      '             ?s geo:geometry ?geo }  ' ||
-      '         } ' ||
-      '       LIMIT 100  ' ||
-      '     } ' ||
+      --'     { ' ||
+      --'       SELECT ?g ?s WHERE  ' ||
+      --'         {  ' ||
+      --'           graph ?g { ' ||
+      --'             ?s geo:geometry ?geo }  ' ||
+      --'         } ' ||
+      --'       LIMIT 100  ' ||
+      --'     } ' ||
       '     graph ?g { ' ||
+      '       ?s geo:geometry ?geo . ' ||
       '       ?s geo:lat ?lat . ' ||
       '       ?s geo:long ?long . } ' ||
       '     FILTER (datatype (?lat) IN (xsd:integer, xsd:float, xsd:double)) . ' ||
@@ -1006,7 +1007,7 @@ s3 := '\')) .
   {
     if (isnull(val)    or val = '') val := 'http://dbpedia.org/resource/Oxford';
     if (isnull(val2)  or val2 = '') val2 := '5';
-    if (isnull(val3)  or val3 = '') val3 := 'http://dbpedia.org/ontology/established';
+    if (isnull(val3)  or val3 = '') val3 := 'http://dbpedia.org/property/established';
     if (isnull(val4)  or val4 = '') val4 := 'en';
 
     validate_input(val);
diff --git a/binsrc/bpel/Makefile.in b/binsrc/bpel/Makefile.in
index c09b74a..a5e36d5 100644
--- a/binsrc/bpel/Makefile.in
+++ b/binsrc/bpel/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/bpel/make_vad.sh b/binsrc/bpel/make_vad.sh
index 93c9b48..74ae80b 100755
--- a/binsrc/bpel/make_vad.sh
+++ b/binsrc/bpel/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.13.2.1 2010/01/07 16:58:12 source Exp $
+#  $Id: make_vad.sh,v 1.13.2.2 2011/02/03 10:36:50 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -318,7 +318,7 @@ sticker_init() {
   echo "  <name package=\"bpel4ws\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"BPEL4WS\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
diff --git a/binsrc/bpel/tests/interop/site/bpel4ws/interop.xsl b/binsrc/bpel/tests/interop/site/bpel4ws/interop.xsl
index e695d7a..3b82487 100644
--- a/binsrc/bpel/tests/interop/site/bpel4ws/interop.xsl
+++ b/binsrc/bpel/tests/interop/site/bpel4ws/interop.xsl
@@ -155,7 +155,7 @@
 	<A class="m_n" href="http://virtuoso.openlinksw.com/interop/index.htm#">Privacy</A>
       </div>
       <div class="copyright">
-	<xsl:text disable-output-escaping="yes">Copyright &copy; 1998-2010 OpenLink Software</xsl:text>
+	<xsl:text disable-output-escaping="yes">Copyright &copy; 1998-2011 OpenLink Software</xsl:text>
       </div>
     </td>
   </tr>
diff --git a/binsrc/cached_resources/Makefile.in b/binsrc/cached_resources/Makefile.in
index c3b2384..dbe9e49 100644
--- a/binsrc/cached_resources/Makefile.in
+++ b/binsrc/cached_resources/Makefile.in
@@ -162,6 +162,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/cached_resources/cached_resources.c b/binsrc/cached_resources/cached_resources.c
index d94676d..4b7c14c 100644
--- a/binsrc/cached_resources/cached_resources.c
+++ b/binsrc/cached_resources/cached_resources.c
@@ -4250,7 +4250,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "\n",
 "# Don't forget to change version, both here and in DB.DBA.SPARQL_RELOAD_QM_GRAPH, to force reload.\n",
 "<http://www.openlinksw.com/sparql/virtrdf-data-formats.ttl>\n",
-"  virtrdf:version '2010-03-22 0003v6g' ;\n",
+"  virtrdf:version '2010-08-29 0001v6g' ;\n",
 "  virtrdf:item\n",
 "    rdfdf:default-iid ,				rdfdf:default-iid-nullable ,\n",
 "    rdfdf:default-iid-nonblank ,		rdfdf:default-iid-nonblank-nullable ,\n",
@@ -4327,7 +4327,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" __bft (__id2i (^{tree}^), 2)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" NULL\";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" __i2idn (^{tree}^)\";		# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" __i2idn (^{sqlval-of-tree}^)\";			# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" __i2idn (^{tree}^)\";			# STRING REQUIRED ... makes short by uri\n",
 "# Misc\n",
@@ -4430,7 +4430,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" __rdf_strsqlval (^{tree}^, 0)\";	# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL (^{sqlval-of-tree}^, __i2id(^{datatype-of-tree}^), ^{language-of-tree}^)\";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" DB.DBA.RDF_OBJ_OF_SQLVAL (^{tree}^)\";		# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" DB.DBA.RDF_OBJ_OF_SQLVAL (^{sqlval-of-tree}^)\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" DB.DBA.RDF_OBJ_OF_LONG (^{tree}^)\";		# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" __i2idn (^{tree}^)\";	# STRING REQUIRED ... makes short by uri\n",
 "# Templates of expressions that find existing short values from other representations\n",
@@ -4501,7 +4501,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" ^{tree}^\";					# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" (case (coalesce (^{datatype-of-tree}^, 'http://www.w3.org/2001/XMLSchema#string')) when 'http://www.w3.org/2001/XMLSchema#string' then ^{sqlval-of-tree}^ else NULL end)\";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" (case (isstring (^{tree}^)) when 0 then NULL else (^{tree}^) end)\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" (case (isstring (^{sqlval-of-tree}^)) when 0 then NULL else (^{sqlval-of-tree}^) end)\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" __rdf_strsqlval (^{tree}^)\" ;	# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" NULL\" ;						# STRING REQUIRED ... makes short by uri\n",
 "  virtrdf:qmfShortOfNiceSqlvalTmpl \" ^{tree}^\" ;	# STRING OPTIONAL\n",
@@ -4631,8 +4631,8 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" ^{tree-0}^\";				# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" ^{sqlval-of-tree}^^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^\";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" (case (isstring (^{tree}^)) when 0 then NULL else (^{tree}^) end)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
-"  virtrdf:qmfShortOfLongTmpl \" __rdf_strsqlval (^{tree}^)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^\" ;	# STRING REQUIRED ... makes short by long\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" (case (isstring (^{sqlval-of-tree}^)) when 0 then NULL else (^{sqlval-of-tree}^) end)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfLongTmpl \" __rdf_strsqlval (^{sqlval-of-tree}^)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^\" ;	# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" NULL\" ;						# STRING REQUIRED ... makes short by uri\n",
 "  virtrdf:qmfShortOfNiceSqlvalTmpl \" ^{tree}^^{as-name-0}^^{comma-cut}^NULL^{as-name-1}^\" ;				# STRING OPTIONAL\n",
 "  virtrdf:qmfDtpOfNiceSqlval 182 ;\n",
@@ -4677,6 +4677,13 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  rdf:type virtrdf:QuadMapFormat;\n",
 "  virtrdf:qmfName \"sql-longvarchar\";\n",
 "  virtrdf:inheritFrom rdfdf:sql-varchar;\n",
+"  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal\n",
+"  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order\n",
+"  virtrdf:qmfSqlvalTmpl \" cast (^{alias-dot}^^{column}^ as varchar)\";		# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
+"  virtrdf:qmfSqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";			# STRING REQUIRED ... SQL value from short\n",
+"  virtrdf:qmfBoolOfShortTmpl \" (case (length (^{tree}^)) when 0 then 0 else 1 end)\";	# STRING REQUIRED ... boolean value from short\n",
+"  virtrdf:qmfIidOfShortTmpl \" __i2id (cast (^{tree}^ as varchar))\";\n",
+"  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "  virtrdf:qmfSuperFormats rdfdf:sql-longvarchar-SuperFormats\n",
 ".\n",
 "\n",
@@ -4703,6 +4710,13 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  rdf:type virtrdf:QuadMapFormat;\n",
 "  virtrdf:qmfName \"sql-longvarchar-dt\";\n",
 "  virtrdf:inheritFrom rdfdf:sql-varchar-dt;\n",
+"  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal\n",
+"  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order\n",
+"  virtrdf:qmfSqlvalTmpl \" cast (^{alias-dot}^^{column}^ as varchar)\";		# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
+"  virtrdf:qmfSqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";			# STRING REQUIRED ... SQL value from short\n",
+"  virtrdf:qmfBoolOfShortTmpl \" (case (length (^{tree}^)) when 0 then 0 else 1 end)\";	# STRING REQUIRED ... boolean value from short\n",
+"  virtrdf:qmfIidOfShortTmpl \" __i2id (cast (^{tree}^ as varchar))\";\n",
+"  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "  virtrdf:qmfSuperFormats rdfdf:sql-longvarchar-dt-SuperFormats\n",
 ".\n",
 "\n",
@@ -4729,6 +4743,13 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  rdf:type virtrdf:QuadMapFormat;\n",
 "  virtrdf:qmfName \"sql-longvarchar-lang\";\n",
 "  virtrdf:inheritFrom rdfdf:sql-varchar-lang;\n",
+"  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal\n",
+"  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order\n",
+"  virtrdf:qmfSqlvalTmpl \" cast (^{alias-dot}^^{column}^ as varchar)\";		# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
+"  virtrdf:qmfSqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";			# STRING REQUIRED ... SQL value from short\n",
+"  virtrdf:qmfBoolOfShortTmpl \" (case (length (^{tree}^)) when 0 then 0 else 1 end)\";	# STRING REQUIRED ... boolean value from short\n",
+"  virtrdf:qmfIidOfShortTmpl \" __i2id (cast (^{tree}^ as varchar))\";\n",
+"  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "  virtrdf:qmfSuperFormats rdfdf:sql-longvarchar-lang-SuperFormats\n",
 ".\n",
 "\n",
@@ -4774,7 +4795,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" ^{tree}^\";					# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" (case (coalesce (^{datatype-of-tree}^, 'http://www.w3.org/2001/XMLSchema#string')) when 'http://www.w3.org/2001/XMLSchema#string' then ^{sqlval-of-tree}^ else NULL end)\";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" (case (isstring (^{tree}^)) when 0 then NULL else (^{tree}^) end)\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" (case (isstring (^{sqlval-of-tree}^)) when 0 then NULL else (^{sqlval-of-tree}^) end)\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" DB.DBA.RDF_WIDESTRSQLVAL_OF_LONG (^{tree}^)\" ;	# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" NULL\" ;						# STRING REQUIRED ... makes short by uri\n",
 "  virtrdf:qmfShortOfNiceSqlvalTmpl \" ^{tree}^\" ;				# STRING OPTIONAL\n",
@@ -4904,7 +4925,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" ^{tree-0}^\";				# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" ^{sqlval-of-tree}^^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^\";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" (case (isstring (^{tree}^)) when 0 then NULL else (^{tree}^) end)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" (case (isstring (^{sqlval-of-tree}^)) when 0 then NULL else (^{sqlval-of-tree}^) end)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" __rdf_strsqlval (^{tree}^)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^\" ;	# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" NULL\" ;						# STRING REQUIRED ... makes short by uri\n",
 "  virtrdf:qmfShortOfNiceSqlvalTmpl \" ^{tree}^^{as-name-0}^^{comma-cut}^NULL^{as-name-1}^\" ;				# STRING OPTIONAL\n",
@@ -4950,6 +4971,13 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  rdf:type virtrdf:QuadMapFormat;\n",
 "  virtrdf:qmfName \"sql-longnvarchar\";\n",
 "  virtrdf:inheritFrom rdfdf:sql-nvarchar;\n",
+"  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal\n",
+"  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order\n",
+"  virtrdf:qmfSqlvalTmpl \" cast (^{alias-dot}^^{column}^ as nvarchar)\";		# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
+"  virtrdf:qmfSqlvalOfShortTmpl \" cast (^{tree}^ as nvarchar)\";			# STRING REQUIRED ... SQL value from short\n",
+"  virtrdf:qmfBoolOfShortTmpl \" (case (length (^{tree}^)) when 0 then 0 else 1 end)\";	# STRING REQUIRED ... boolean value from short\n",
+"  virtrdf:qmfIidOfShortTmpl \" __i2id (cast (^{tree}^ as nvarchar))\";\n",
+"  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as nvarchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "  virtrdf:qmfSuperFormats rdfdf:sql-longnvarchar-SuperFormats\n",
 ".\n",
 "\n",
@@ -4976,6 +5004,13 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  rdf:type virtrdf:QuadMapFormat;\n",
 "  virtrdf:qmfName \"sql-longnvarchar-dt\";\n",
 "  virtrdf:inheritFrom rdfdf:sql-nvarchar-dt;\n",
+"  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal\n",
+"  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order\n",
+"  virtrdf:qmfSqlvalTmpl \" cast (^{alias-dot}^^{column}^ as nvarchar)\";		# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
+"  virtrdf:qmfSqlvalOfShortTmpl \" cast (^{tree}^ as nvarchar)\";			# STRING REQUIRED ... SQL value from short\n",
+"  virtrdf:qmfBoolOfShortTmpl \" (case (length (^{tree}^)) when 0 then 0 else 1 end)\";	# STRING REQUIRED ... boolean value from short\n",
+"  virtrdf:qmfIidOfShortTmpl \" __i2id (cast (^{tree}^ as nvarchar))\";\n",
+"  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as nvarchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "  virtrdf:qmfSuperFormats rdfdf:sql-longnvarchar-dt-SuperFormats\n",
 ".\n",
 "\n",
@@ -5002,6 +5037,13 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  rdf:type virtrdf:QuadMapFormat;\n",
 "  virtrdf:qmfName \"sql-longnvarchar-lang\";\n",
 "  virtrdf:inheritFrom rdfdf:sql-nvarchar-lang;\n",
+"  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal\n",
+"  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order\n",
+"  virtrdf:qmfSqlvalTmpl \" cast (^{alias-dot}^^{column}^ as nvarchar)\";		# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
+"  virtrdf:qmfSqlvalOfShortTmpl \" cast (^{tree}^ as nvarchar)\";			# STRING REQUIRED ... SQL value from short\n",
+"  virtrdf:qmfBoolOfShortTmpl \" (case (length (^{tree}^)) when 0 then 0 else 1 end)\";	# STRING REQUIRED ... boolean value from short\n",
+"  virtrdf:qmfIidOfShortTmpl \" __i2id (cast (^{tree}^ as nvarchar))\";\n",
+"  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as nvarchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "  virtrdf:qmfSuperFormats rdfdf:sql-longnvarchar-lang-SuperFormats\n",
 ".\n",
 "\n",
@@ -5029,7 +5071,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfName \"sql-longvarbinary\";\n",
 "  virtrdf:qmfShortTmpl \" ^{alias-dot}^^{column}^\";				# STRING REQUIRED \"short\" value template, can be NULL\n",
 "  virtrdf:qmfLongTmpl \" ^{alias-dot}^^{column}^\";				# STRING REQUIRED \"long\" value template, can be NULL\n",
-"  virtrdf:qmfSqlvalTmpl \" ^{alias-dot}^^{column}^\";				# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
+"  virtrdf:qmfSqlvalTmpl \" cast (^{alias-dot}^^{column}^ as varbinary)\";		# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
 "  virtrdf:qmfBoolTmpl \" 1\";							# STRING REQUIRED Boolean value template, can be NULL\n",
 "# Templates of booleans that tell whether the short is of some sort:\n",
 "  virtrdf:qmfIsrefOfShortTmpl \" 0\";						# STRING REQUIRED ... whether the short is ref\n",
@@ -5038,21 +5080,21 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfIslitOfShortTmpl \" 1\";						# STRING REQUIRED ... whether the short is literal\n",
 "# Templates that convert short value into other types (can be applied to both field and not field expression)\n",
 "  virtrdf:qmfLongOfShortTmpl \" ^{tree}^\";					# STRING REQUIRED ... long from short\n",
-"  virtrdf:qmfSqlvalOfShortTmpl \" ^{tree}^\";					# STRING REQUIRED ... SQL value from short\n",
+"  virtrdf:qmfSqlvalOfShortTmpl \" cast (^{tree}^ as varbinary)\";			# STRING REQUIRED ... SQL value from short\n",
 "  virtrdf:qmfDatatypeOfShortTmpl \" 'http://www.w3.org/2001/XMLSchema#octetStream'\";  # STRING REQUIRED ... datatype IRI STRING from short\n",
 "  virtrdf:qmfLanguageOfShortTmpl \" NULL\";					# STRING REQUIRED ... language ID STRING from short\n",
 "  virtrdf:qmfBoolOfShortTmpl \" 1\";						# STRING REQUIRED ... boolean value from short\n",
 "  virtrdf:qmfIidOfShortTmpl \" NULL\";\n",
 "  virtrdf:qmfUriOfShortTmpl \" NULL\";						# STRING REQUIRED ... URI STRING from short\n",
-"  virtrdf:qmfStrsqlvalOfShortTmpl \" ^{tree}^\";					# STRING REQUIRED ... SQL representation of the STRING value of short\n",
+"  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#octetStream' then ^{sqlval-of-tree}^ else NULL end)\";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" (case (__tag (^{tree}^)) when 131 then (^{tree}^) else NULL end)\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" (case (__tag (^{sqlval-of-tree}^)) when 131 then (^{sqlval-of-tree}^) else NULL end)\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" (case (__tag (^{tree}^)) when 131 then (^{tree}^) else NULL end)\";	# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" NULL\";						# STRING REQUIRED ... makes short by uri\n",
 "# Misc\n",
-"  virtrdf:qmfIsBijection 1;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal\n",
-"  virtrdf:qmfIsStable 1;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order\n",
+"  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal\n",
+"  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order\n",
 "  virtrdf:qmfCmpFuncName \"DB.DBA.RDF_VARBINARY_CMP\";				# STRING REQUIRED Name of comparison function that acts like strcmp but args are of this type\n",
 "  virtrdf:qmfTypeminTmpl \" ''\";							# STRING REQUIRED Template of expn that returns the smallest value of the type of value of arg\n",
 "  virtrdf:qmfTypemaxTmpl \" '\\\\xFF\\\\xFF\\\\xFF\\\\xFF\\\\xFF\\\\xFF'\";			# STRING REQUIRED Template of expn that returns the biggest possible value of the type of value of arg\n",
@@ -5110,7 +5152,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" __spfi (^{custom-string-1}^, ^{tree}^)\";	# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" NULL\";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" __spfinv (^{tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[0]\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" __spfinv (^{sqlval-of-tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[0]\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" __spfinv (__id2i (^{tree}^), ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[0]\";	# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" __spfinv (^{tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[0]\";	# STRING REQUIRED ... makes short by uri\n",
 "# Misc\n",
@@ -5204,7 +5246,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#integer' then ^{sqlval-of-tree}^ else NULL end)\";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" ^{sqlval-of-tree}^\";				# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" NULL\";						# STRING REQUIRED ... makes short by uri\n",
 "# Misc\n",
@@ -5315,7 +5357,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#double' then ^{sqlval-of-tree}^ else NULL end)\";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" ^{sqlval-of-tree}^\";				# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" NULL\";						# STRING REQUIRED ... makes short by uri\n",
 "# Misc\n",
@@ -5382,7 +5424,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#numeric' then ^{sqlval-of-tree}^ else NULL end)\";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" ^{sqlval-of-tree}^\";				# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" NULL\";						# STRING REQUIRED ... makes short by uri\n",
 "# Misc\n",
@@ -5493,7 +5535,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#date' then ^{sqlval-of-tree}^ else NULL end)\";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" ^{sqlval-of-tree}^\";				# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" NULL\";						# STRING REQUIRED ... makes short by uri\n",
 "# Misc\n",
@@ -5564,7 +5606,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#time' then ^{sqlval-of-tree}^ else NULL end)\";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" ^{sqlval-of-tree}^\";				# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" NULL\";						# STRING REQUIRED ... makes short by uri\n",
 "# Misc\n",
@@ -5632,7 +5674,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{tree}^ as varchar)\";		# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#datetime' then ^{sqlval-of-tree}^ else NULL end)\";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" ^{sqlval-of-tree}^\";				# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \" ^{tree}^\";					# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \" NULL\";						# STRING REQUIRED ... makes short by uri\n",
 "# Misc\n",
@@ -5699,7 +5741,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" __spfi (^{custom-string-1}^, ^{comma-list-begin}^ ^{tree-N}^^{end}^)\";	# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \"^{comma-list-begin}^ __spfinv (^{tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[^{N}^]^{as-name-N}^^{end}^\";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \"^{comma-list-begin}^ __spfinv (^{tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[^{N}^]^{as-name-N}^^{end}^\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl		\"^{comma-list-begin}^ __spfinv (^{sqlval-of-tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[^{N}^]^{as-name-N}^^{end}^\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \"^{comma-list-begin}^ __spfinv (__id2in (^{tree}^), ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[^{N}^]^{as-name-N}^^{end}^\";	# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \"^{comma-list-begin}^ __spfinv (^{tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[^{N}^]^{as-name-N}^^{end}^\";	# STRING REQUIRED ... makes short by uri\n",
 "#wrong:  virtrdf:qmfShortOfNiceSqlvalTmpl \"^{comma-list-begin}^ ^{N-aref-of-spfinv}^^{as-name-N}^^{end}^\";	# ... works like qmfShortOfSqlvalTmpl for values of one selected data type, not suitable for other types\n",
@@ -5753,7 +5795,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfName \"multipart-uri-fn-nullable\";\n",
 "  virtrdf:qmfShortTmpl \"^{comma-list-begin}^ ^{alias-N-dot}^^{column-N}^^{as-name-N}^^{end}^\";	# STRING REQUIRED \"short\" value template, can be NULL\n",
 "  virtrdf:qmfLongTmpl \" __i2id (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{alias-N-dot}^^{column-N}^^{end}^))\";	# STRING REQUIRED \"long\" value template, can be NULL\n",
-"  virtrdf:qmfSqlvalTmpl \" ^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{alias-N-dot}^^{column-N}^^{end}^)\";	# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
+"  virtrdf:qmfSqlvalTmpl \" __bft (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{alias-N-dot}^^{column-N}^^{end}^), 1)\";	# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
 "  virtrdf:qmfBoolTmpl \" NULL\";							# STRING REQUIRED Boolean value template, can be NULL\n",
 "# Templates of booleans that tell whether the short is of some sort:\n",
 "  virtrdf:qmfIsrefOfShortTmpl \" 1\";						# STRING REQUIRED ... whether the short is ref\n",
@@ -5762,16 +5804,16 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfIslitOfShortTmpl \" 0\";						# STRING REQUIRED ... whether the short is literal\n",
 "# Templates that convert short value into other types (can be applied to both field and not field expression)\n",
 "  virtrdf:qmfLongOfShortTmpl \" __i2id (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^))\";	# STRING REQUIRED ... long from short\n",
-"  virtrdf:qmfSqlvalOfShortTmpl \" ^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^)\";		# STRING REQUIRED ... SQL value from short\n",
+"  virtrdf:qmfSqlvalOfShortTmpl \" __bft (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^), 1)\";		# STRING REQUIRED ... SQL value from short\n",
 "  virtrdf:qmfDatatypeOfShortTmpl \" 'http://www.w3.org/2001/XMLSchema#anyURI'\";# STRING REQUIRED ... datatype IRI STRING from short\n",
 "  virtrdf:qmfLanguageOfShortTmpl \" NULL\";					# STRING REQUIRED ... language ID STRING from short\n",
 "  virtrdf:qmfBoolOfShortTmpl \" NULL\";						# STRING REQUIRED ... boolean value from short\n",
 "  virtrdf:qmfIidOfShortTmpl \" __i2id (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^))\";\n",
-"  virtrdf:qmfUriOfShortTmpl \" ^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^)\";		# STRING REQUIRED ... URI STRING from short\n",
+"  virtrdf:qmfUriOfShortTmpl \" __bft (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^), 1)\";		# STRING REQUIRED ... URI STRING from short\n",
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" ^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^)\";	# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \"^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{tree}^)^{as-name-N}^^{end}^\";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \"^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{tree}^)^{as-name-N}^^{end}^\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \"^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{sqlval-of-tree}^)^{as-name-N}^^{end}^\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \"^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (__id2in (^{tree}^))^{as-name-N}^^{end}^\";	# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \"^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{tree}^)^{as-name-N}^^{end}^\";	# STRING REQUIRED ... makes short by uri\n",
 "# Misc\n",
@@ -5819,7 +5861,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^) as varchar)\";	# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \"^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{tree}^)^{as-name-N}^^{end}^\";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \"^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{tree}^)^{as-name-N}^^{end}^\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \"^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{sqlval-of-tree}^)^{as-name-N}^^{end}^\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \"^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (__ro2sq /*l*/ (^{tree}^))^{as-name-N}^^{end}^\";	# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \"^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{tree}^)^{as-name-N}^^{end}^\";	# STRING REQUIRED ... makes short by literal\n",
 "# Misc\n",
@@ -5919,7 +5961,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfName \"zeropart-uri-fn-nullable\";\n",
 "  virtrdf:qmfShortTmpl \"1 /*zeropart*/\";	# STRING REQUIRED \"short\" value template, can be NULL\n",
 "  virtrdf:qmfLongTmpl \" __i2id (^{custom-verbatim-1}^ ())\";			# STRING REQUIRED \"long\" value template, can be NULL\n",
-"  virtrdf:qmfSqlvalTmpl \" ^{custom-verbatim-1}^ ()\";				# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
+"  virtrdf:qmfSqlvalTmpl \" __bft (^{custom-verbatim-1}^ (), 1)\";				# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
 "  virtrdf:qmfBoolTmpl \" NULL\";							# STRING REQUIRED Boolean value template, can be NULL\n",
 "# Templates of booleans that tell whether the short is of some sort:\n",
 "  virtrdf:qmfIsrefOfShortTmpl \" 1\";						# STRING REQUIRED ... whether the short is ref\n",
@@ -5928,12 +5970,12 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfIslitOfShortTmpl \" 0\";						# STRING REQUIRED ... whether the short is literal\n",
 "# Templates that convert short value into other types (can be applied to both field and not field expression)\n",
 "  virtrdf:qmfLongOfShortTmpl \" __i2id (^{custom-verbatim-1}^ ())\";		# STRING REQUIRED ... long from short\n",
-"  virtrdf:qmfSqlvalOfShortTmpl \" ^{custom-verbatim-1}^ ()\";			# STRING REQUIRED ... SQL value from short\n",
+"  virtrdf:qmfSqlvalOfShortTmpl \" __bft (^{custom-verbatim-1}^ (), 1)\";		# STRING REQUIRED ... SQL value from short\n",
 "  virtrdf:qmfDatatypeOfShortTmpl \" 'http://www.w3.org/2001/XMLSchema#anyURI'\";# STRING REQUIRED ... datatype IRI STRING from short\n",
 "  virtrdf:qmfLanguageOfShortTmpl \" NULL\";					# STRING REQUIRED ... language ID STRING from short\n",
 "  virtrdf:qmfBoolOfShortTmpl \" NULL\";						# STRING REQUIRED ... boolean value from short\n",
 "  virtrdf:qmfIidOfShortTmpl \" __i2id (^{custom-verbatim-1}^ ())\";\n",
-"  virtrdf:qmfUriOfShortTmpl \" ^{custom-verbatim-1}^ ()\";			# STRING REQUIRED ... URI STRING from short\n",
+"  virtrdf:qmfUriOfShortTmpl \" __bft (^{custom-verbatim-1}^ (), 1)\";		# STRING REQUIRED ... URI STRING from short\n",
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" ^{custom-verbatim-1}^ ()\";			# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \"1 /*zeropart*/\";				# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
@@ -6015,7 +6057,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfName \"sql-varchar-uri-fn\";\n",
 "  virtrdf:qmfShortTmpl \" ^{alias-dot}^^{column}^\";				# STRING REQUIRED \"short\" value template, can be NULL\n",
 "  virtrdf:qmfLongTmpl \" __i2id (^{custom-verbatim-1}^ (^{alias-dot}^^{column}^))\";	# STRING REQUIRED \"long\" value template, can be NULL\n",
-"  virtrdf:qmfSqlvalTmpl \" ^{custom-verbatim-1}^ (^{alias-dot}^^{column}^)\";	# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
+"  virtrdf:qmfSqlvalTmpl \" __bft (^{custom-verbatim-1}^ (^{alias-dot}^^{column}^), 1)\";	# STRING REQUIRED \"sqlval\" value template, can be NULL\n",
 "  virtrdf:qmfBoolTmpl \" NULL\";							# STRING REQUIRED Boolean value template, can be NULL\n",
 "# Templates of booleans that tell whether the short is of some sort:\n",
 "  virtrdf:qmfIsrefOfShortTmpl \" 1\";						# STRING REQUIRED ... whether the short is ref\n",
@@ -6024,16 +6066,16 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfIslitOfShortTmpl \" 0\";						# STRING REQUIRED ... whether the short is literal\n",
 "# Templates that convert short value into other types (can be applied to both field and not field expression)\n",
 "  virtrdf:qmfLongOfShortTmpl \" __i2id (^{custom-verbatim-1}^ (^{tree}^))\";	# STRING REQUIRED ... long from short\n",
-"  virtrdf:qmfSqlvalOfShortTmpl \" ^{custom-verbatim-1}^ (^{tree}^)\";	# STRING REQUIRED ... SQL value from short\n",
+"  virtrdf:qmfSqlvalOfShortTmpl \" __bft (^{custom-verbatim-1}^ (^{tree}^), 1)\";		# STRING REQUIRED ... SQL value from short\n",
 "  virtrdf:qmfDatatypeOfShortTmpl \" 'http://www.w3.org/2001/XMLSchema#anyURI'\";# STRING REQUIRED ... datatype IRI STRING from short\n",
 "  virtrdf:qmfLanguageOfShortTmpl \" NULL\";					# STRING REQUIRED ... language ID STRING from short\n",
 "  virtrdf:qmfBoolOfShortTmpl \" NULL\";						# STRING REQUIRED ... boolean value from short\n",
 "  virtrdf:qmfIidOfShortTmpl \" __i2id (^{custom-verbatim-1}^ (^{tree}^))\";\n",
-"  virtrdf:qmfUriOfShortTmpl \" ^{custom-verbatim-1}^ (^{tree}^)\";		# STRING REQUIRED ... URI STRING from short\n",
+"  virtrdf:qmfUriOfShortTmpl \" __bft (^{custom-verbatim-1}^ (^{tree}^), 1)\";		# STRING REQUIRED ... URI STRING from short\n",
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" ^{custom-verbatim-1}^ (^{tree}^)\";	# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" NULL\";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" ^{custom-verbatim-1}^_INVERSE (^{tree}^)\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" ^{custom-verbatim-1}^_INVERSE (^{sqlval-of-tree}^)\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \"  ^{custom-verbatim-1}^_INVERSE (__id2in (^{tree}^))\";	# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \"  ^{custom-verbatim-1}^_INVERSE (^{tree}^)\";		# STRING REQUIRED ... makes short by uri\n",
 "# Misc\n",
@@ -6192,7 +6234,7 @@ static const char * cres_virtrdf_data_formats_ttl[] =
 "  virtrdf:qmfStrsqlvalOfShortTmpl \" cast (^{custom-verbatim-1}^ (^{tree}^) as varchar)\";	# STRING REQUIRED ... SQL representation of the STRING value of short\n",
 "# Templates of expressions that make short values from other representations\n",
 "  virtrdf:qmfShortOfTypedsqlvalTmpl \" NULL\";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language\n",
-"  virtrdf:qmfShortOfSqlvalTmpl \" ^{custom-verbatim-1}^_INVERSE (^{tree}^)\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
+"  virtrdf:qmfShortOfSqlvalTmpl \" ^{custom-verbatim-1}^_INVERSE (^{sqlval-of-tree}^)\";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type\n",
 "  virtrdf:qmfShortOfLongTmpl \"  ^{custom-verbatim-1}^_INVERSE (__ro2sq /*l*/ (^{tree}^))\";	# STRING REQUIRED ... makes short by long\n",
 "  virtrdf:qmfShortOfUriTmpl \"  ^{custom-verbatim-1}^_INVERSE (^{tree}^)\";		# STRING REQUIRED ... makes short by uri\n",
 "# Misc\n",
diff --git a/binsrc/cached_resources/openlinksw-sparql/virtrdf-data-formats.ttl b/binsrc/cached_resources/openlinksw-sparql/virtrdf-data-formats.ttl
index 4935a5c..711b18a 100644
--- a/binsrc/cached_resources/openlinksw-sparql/virtrdf-data-formats.ttl
+++ b/binsrc/cached_resources/openlinksw-sparql/virtrdf-data-formats.ttl
@@ -41,7 +41,7 @@ bif:spatial_contains virtrdf:isSpecialPredicate bif:spatial_contains .
 
 # Don't forget to change version, both here and in DB.DBA.SPARQL_RELOAD_QM_GRAPH, to force reload.
 <http://www.openlinksw.com/sparql/virtrdf-data-formats.ttl>
-  virtrdf:version '2010-03-22 0003v6g' ;
+  virtrdf:version '2010-08-29 0001v6g' ;
   virtrdf:item
     rdfdf:default-iid ,				rdfdf:default-iid-nullable ,
     rdfdf:default-iid-nonblank ,		rdfdf:default-iid-nonblank-nullable ,
@@ -118,7 +118,7 @@ rdfdf:default-iid
   virtrdf:qmfStrsqlvalOfShortTmpl " __bft (__id2i (^{tree}^), 2)";		# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " NULL";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " __i2idn (^{tree}^)";		# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " __i2idn (^{sqlval-of-tree}^)";			# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " __i2idn (^{tree}^)";			# STRING REQUIRED ... makes short by uri
 # Misc
@@ -221,7 +221,7 @@ rdfdf:default
   virtrdf:qmfStrsqlvalOfShortTmpl " __rdf_strsqlval (^{tree}^, 0)";	# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL (^{sqlval-of-tree}^, __i2id(^{datatype-of-tree}^), ^{language-of-tree}^)";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " DB.DBA.RDF_OBJ_OF_SQLVAL (^{tree}^)";		# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " DB.DBA.RDF_OBJ_OF_SQLVAL (^{sqlval-of-tree}^)";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " DB.DBA.RDF_OBJ_OF_LONG (^{tree}^)";		# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " __i2idn (^{tree}^)";	# STRING REQUIRED ... makes short by uri
 # Templates of expressions that find existing short values from other representations
@@ -292,7 +292,7 @@ rdfdf:sql-varchar
   virtrdf:qmfStrsqlvalOfShortTmpl " ^{tree}^";					# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " (case (coalesce (^{datatype-of-tree}^, 'http://www.w3.org/2001/XMLSchema#string')) when 'http://www.w3.org/2001/XMLSchema#string' then ^{sqlval-of-tree}^ else NULL end)";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " (case (isstring (^{tree}^)) when 0 then NULL else (^{tree}^) end)";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " (case (isstring (^{sqlval-of-tree}^)) when 0 then NULL else (^{sqlval-of-tree}^) end)";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " __rdf_strsqlval (^{tree}^)" ;	# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " NULL" ;						# STRING REQUIRED ... makes short by uri
   virtrdf:qmfShortOfNiceSqlvalTmpl " ^{tree}^" ;	# STRING OPTIONAL
@@ -422,8 +422,8 @@ rdfdf:sql-varchar-lang
   virtrdf:qmfStrsqlvalOfShortTmpl " ^{tree-0}^";				# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " ^{sqlval-of-tree}^^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " (case (isstring (^{tree}^)) when 0 then NULL else (^{tree}^) end)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
-  virtrdf:qmfShortOfLongTmpl " __rdf_strsqlval (^{tree}^)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^" ;	# STRING REQUIRED ... makes short by long
+  virtrdf:qmfShortOfSqlvalTmpl " (case (isstring (^{sqlval-of-tree}^)) when 0 then NULL else (^{sqlval-of-tree}^) end)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfLongTmpl " __rdf_strsqlval (^{sqlval-of-tree}^)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^" ;	# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " NULL" ;						# STRING REQUIRED ... makes short by uri
   virtrdf:qmfShortOfNiceSqlvalTmpl " ^{tree}^^{as-name-0}^^{comma-cut}^NULL^{as-name-1}^" ;				# STRING OPTIONAL
   virtrdf:qmfDtpOfNiceSqlval 182 ;
@@ -468,6 +468,13 @@ rdfdf:sql-longvarchar
   rdf:type virtrdf:QuadMapFormat;
   virtrdf:qmfName "sql-longvarchar";
   virtrdf:inheritFrom rdfdf:sql-varchar;
+  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal
+  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order
+  virtrdf:qmfSqlvalTmpl " cast (^{alias-dot}^^{column}^ as varchar)";		# STRING REQUIRED "sqlval" value template, can be NULL
+  virtrdf:qmfSqlvalOfShortTmpl " cast (^{tree}^ as varchar)";			# STRING REQUIRED ... SQL value from short
+  virtrdf:qmfBoolOfShortTmpl " (case (length (^{tree}^)) when 0 then 0 else 1 end)";	# STRING REQUIRED ... boolean value from short
+  virtrdf:qmfIidOfShortTmpl " __i2id (cast (^{tree}^ as varchar))";
+  virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as varchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
   virtrdf:qmfSuperFormats rdfdf:sql-longvarchar-SuperFormats
 .
 
@@ -494,6 +501,13 @@ rdfdf:sql-longvarchar-dt
   rdf:type virtrdf:QuadMapFormat;
   virtrdf:qmfName "sql-longvarchar-dt";
   virtrdf:inheritFrom rdfdf:sql-varchar-dt;
+  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal
+  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order
+  virtrdf:qmfSqlvalTmpl " cast (^{alias-dot}^^{column}^ as varchar)";		# STRING REQUIRED "sqlval" value template, can be NULL
+  virtrdf:qmfSqlvalOfShortTmpl " cast (^{tree}^ as varchar)";			# STRING REQUIRED ... SQL value from short
+  virtrdf:qmfBoolOfShortTmpl " (case (length (^{tree}^)) when 0 then 0 else 1 end)";	# STRING REQUIRED ... boolean value from short
+  virtrdf:qmfIidOfShortTmpl " __i2id (cast (^{tree}^ as varchar))";
+  virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as varchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
   virtrdf:qmfSuperFormats rdfdf:sql-longvarchar-dt-SuperFormats
 .
 
@@ -520,6 +534,13 @@ rdfdf:sql-longvarchar-lang
   rdf:type virtrdf:QuadMapFormat;
   virtrdf:qmfName "sql-longvarchar-lang";
   virtrdf:inheritFrom rdfdf:sql-varchar-lang;
+  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal
+  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order
+  virtrdf:qmfSqlvalTmpl " cast (^{alias-dot}^^{column}^ as varchar)";		# STRING REQUIRED "sqlval" value template, can be NULL
+  virtrdf:qmfSqlvalOfShortTmpl " cast (^{tree}^ as varchar)";			# STRING REQUIRED ... SQL value from short
+  virtrdf:qmfBoolOfShortTmpl " (case (length (^{tree}^)) when 0 then 0 else 1 end)";	# STRING REQUIRED ... boolean value from short
+  virtrdf:qmfIidOfShortTmpl " __i2id (cast (^{tree}^ as varchar))";
+  virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as varchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
   virtrdf:qmfSuperFormats rdfdf:sql-longvarchar-lang-SuperFormats
 .
 
@@ -565,7 +586,7 @@ rdfdf:sql-nvarchar
   virtrdf:qmfStrsqlvalOfShortTmpl " ^{tree}^";					# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " (case (coalesce (^{datatype-of-tree}^, 'http://www.w3.org/2001/XMLSchema#string')) when 'http://www.w3.org/2001/XMLSchema#string' then ^{sqlval-of-tree}^ else NULL end)";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " (case (isstring (^{tree}^)) when 0 then NULL else (^{tree}^) end)";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " (case (isstring (^{sqlval-of-tree}^)) when 0 then NULL else (^{sqlval-of-tree}^) end)";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " DB.DBA.RDF_WIDESTRSQLVAL_OF_LONG (^{tree}^)" ;	# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " NULL" ;						# STRING REQUIRED ... makes short by uri
   virtrdf:qmfShortOfNiceSqlvalTmpl " ^{tree}^" ;				# STRING OPTIONAL
@@ -695,7 +716,7 @@ rdfdf:sql-nvarchar-lang
   virtrdf:qmfStrsqlvalOfShortTmpl " ^{tree-0}^";				# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " ^{sqlval-of-tree}^^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " (case (isstring (^{tree}^)) when 0 then NULL else (^{tree}^) end)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " (case (isstring (^{sqlval-of-tree}^)) when 0 then NULL else (^{sqlval-of-tree}^) end)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " __rdf_strsqlval (^{tree}^)^{as-name-0}^^{comma-cut}^(^{language-of-tree}^)^{as-name-1}^" ;	# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " NULL" ;						# STRING REQUIRED ... makes short by uri
   virtrdf:qmfShortOfNiceSqlvalTmpl " ^{tree}^^{as-name-0}^^{comma-cut}^NULL^{as-name-1}^" ;				# STRING OPTIONAL
@@ -741,6 +762,13 @@ rdfdf:sql-longnvarchar
   rdf:type virtrdf:QuadMapFormat;
   virtrdf:qmfName "sql-longnvarchar";
   virtrdf:inheritFrom rdfdf:sql-nvarchar;
+  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal
+  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order
+  virtrdf:qmfSqlvalTmpl " cast (^{alias-dot}^^{column}^ as nvarchar)";		# STRING REQUIRED "sqlval" value template, can be NULL
+  virtrdf:qmfSqlvalOfShortTmpl " cast (^{tree}^ as nvarchar)";			# STRING REQUIRED ... SQL value from short
+  virtrdf:qmfBoolOfShortTmpl " (case (length (^{tree}^)) when 0 then 0 else 1 end)";	# STRING REQUIRED ... boolean value from short
+  virtrdf:qmfIidOfShortTmpl " __i2id (cast (^{tree}^ as nvarchar))";
+  virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as nvarchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
   virtrdf:qmfSuperFormats rdfdf:sql-longnvarchar-SuperFormats
 .
 
@@ -767,6 +795,13 @@ rdfdf:sql-longnvarchar-dt
   rdf:type virtrdf:QuadMapFormat;
   virtrdf:qmfName "sql-longnvarchar-dt";
   virtrdf:inheritFrom rdfdf:sql-nvarchar-dt;
+  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal
+  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order
+  virtrdf:qmfSqlvalTmpl " cast (^{alias-dot}^^{column}^ as nvarchar)";		# STRING REQUIRED "sqlval" value template, can be NULL
+  virtrdf:qmfSqlvalOfShortTmpl " cast (^{tree}^ as nvarchar)";			# STRING REQUIRED ... SQL value from short
+  virtrdf:qmfBoolOfShortTmpl " (case (length (^{tree}^)) when 0 then 0 else 1 end)";	# STRING REQUIRED ... boolean value from short
+  virtrdf:qmfIidOfShortTmpl " __i2id (cast (^{tree}^ as nvarchar))";
+  virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as nvarchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
   virtrdf:qmfSuperFormats rdfdf:sql-longnvarchar-dt-SuperFormats
 .
 
@@ -793,6 +828,13 @@ rdfdf:sql-longnvarchar-lang
   rdf:type virtrdf:QuadMapFormat;
   virtrdf:qmfName "sql-longnvarchar-lang";
   virtrdf:inheritFrom rdfdf:sql-nvarchar-lang;
+  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal
+  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order
+  virtrdf:qmfSqlvalTmpl " cast (^{alias-dot}^^{column}^ as nvarchar)";		# STRING REQUIRED "sqlval" value template, can be NULL
+  virtrdf:qmfSqlvalOfShortTmpl " cast (^{tree}^ as nvarchar)";			# STRING REQUIRED ... SQL value from short
+  virtrdf:qmfBoolOfShortTmpl " (case (length (^{tree}^)) when 0 then 0 else 1 end)";	# STRING REQUIRED ... boolean value from short
+  virtrdf:qmfIidOfShortTmpl " __i2id (cast (^{tree}^ as nvarchar))";
+  virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as nvarchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
   virtrdf:qmfSuperFormats rdfdf:sql-longnvarchar-lang-SuperFormats
 .
 
@@ -820,7 +862,7 @@ rdfdf:sql-longvarbinary
   virtrdf:qmfName "sql-longvarbinary";
   virtrdf:qmfShortTmpl " ^{alias-dot}^^{column}^";				# STRING REQUIRED "short" value template, can be NULL
   virtrdf:qmfLongTmpl " ^{alias-dot}^^{column}^";				# STRING REQUIRED "long" value template, can be NULL
-  virtrdf:qmfSqlvalTmpl " ^{alias-dot}^^{column}^";				# STRING REQUIRED "sqlval" value template, can be NULL
+  virtrdf:qmfSqlvalTmpl " cast (^{alias-dot}^^{column}^ as varbinary)";		# STRING REQUIRED "sqlval" value template, can be NULL
   virtrdf:qmfBoolTmpl " 1";							# STRING REQUIRED Boolean value template, can be NULL
 # Templates of booleans that tell whether the short is of some sort:
   virtrdf:qmfIsrefOfShortTmpl " 0";						# STRING REQUIRED ... whether the short is ref
@@ -829,21 +871,21 @@ rdfdf:sql-longvarbinary
   virtrdf:qmfIslitOfShortTmpl " 1";						# STRING REQUIRED ... whether the short is literal
 # Templates that convert short value into other types (can be applied to both field and not field expression)
   virtrdf:qmfLongOfShortTmpl " ^{tree}^";					# STRING REQUIRED ... long from short
-  virtrdf:qmfSqlvalOfShortTmpl " ^{tree}^";					# STRING REQUIRED ... SQL value from short
+  virtrdf:qmfSqlvalOfShortTmpl " cast (^{tree}^ as varbinary)";			# STRING REQUIRED ... SQL value from short
   virtrdf:qmfDatatypeOfShortTmpl " 'http://www.w3.org/2001/XMLSchema#octetStream'";  # STRING REQUIRED ... datatype IRI STRING from short
   virtrdf:qmfLanguageOfShortTmpl " NULL";					# STRING REQUIRED ... language ID STRING from short
   virtrdf:qmfBoolOfShortTmpl " 1";						# STRING REQUIRED ... boolean value from short
   virtrdf:qmfIidOfShortTmpl " NULL";
   virtrdf:qmfUriOfShortTmpl " NULL";						# STRING REQUIRED ... URI STRING from short
-  virtrdf:qmfStrsqlvalOfShortTmpl " ^{tree}^";					# STRING REQUIRED ... SQL representation of the STRING value of short
+  virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as varchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#octetStream' then ^{sqlval-of-tree}^ else NULL end)";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " (case (__tag (^{tree}^)) when 131 then (^{tree}^) else NULL end)";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " (case (__tag (^{sqlval-of-tree}^)) when 131 then (^{sqlval-of-tree}^) else NULL end)";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " (case (__tag (^{tree}^)) when 131 then (^{tree}^) else NULL end)";	# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " NULL";						# STRING REQUIRED ... makes short by uri
 # Misc
-  virtrdf:qmfIsBijection 1;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal
-  virtrdf:qmfIsStable 1;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order
+  virtrdf:qmfIsBijection 0;							# INTEGER REQUIRED Nonzero if the format is bijection so long values are equal IFF short values of the type are equal
+  virtrdf:qmfIsStable 0;							# INTEGER REQUIRED Nonzero if sql values are in order IFF of short values are in order
   virtrdf:qmfCmpFuncName "DB.DBA.RDF_VARBINARY_CMP";				# STRING REQUIRED Name of comparison function that acts like strcmp but args are of this type
   virtrdf:qmfTypeminTmpl " ''";							# STRING REQUIRED Template of expn that returns the smallest value of the type of value of arg
   virtrdf:qmfTypemaxTmpl " '\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF'";			# STRING REQUIRED Template of expn that returns the biggest possible value of the type of value of arg
@@ -901,7 +943,7 @@ rdfdf:sql-varchar-uri
   virtrdf:qmfStrsqlvalOfShortTmpl " __spfi (^{custom-string-1}^, ^{tree}^)";	# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " NULL";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " __spfinv (^{tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[0]";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " __spfinv (^{sqlval-of-tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[0]";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " __spfinv (__id2i (^{tree}^), ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[0]";	# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " __spfinv (^{tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[0]";	# STRING REQUIRED ... makes short by uri
 # Misc
@@ -995,7 +1037,7 @@ rdfdf:sql-integer
   virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as varchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#integer' then ^{sqlval-of-tree}^ else NULL end)";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " ^{sqlval-of-tree}^";				# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " NULL";						# STRING REQUIRED ... makes short by uri
 # Misc
@@ -1106,7 +1148,7 @@ rdfdf:sql-doubleprecision
   virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as varchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#double' then ^{sqlval-of-tree}^ else NULL end)";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " ^{sqlval-of-tree}^";				# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " NULL";						# STRING REQUIRED ... makes short by uri
 # Misc
@@ -1173,7 +1215,7 @@ rdfdf:sql-numeric
   virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as varchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#numeric' then ^{sqlval-of-tree}^ else NULL end)";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " ^{sqlval-of-tree}^";				# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " NULL";						# STRING REQUIRED ... makes short by uri
 # Misc
@@ -1284,7 +1326,7 @@ rdfdf:sql-date
   virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as varchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#date' then ^{sqlval-of-tree}^ else NULL end)";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " ^{sqlval-of-tree}^";				# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " NULL";						# STRING REQUIRED ... makes short by uri
 # Misc
@@ -1355,7 +1397,7 @@ rdfdf:sql-time
   virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as varchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#time' then ^{sqlval-of-tree}^ else NULL end)";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " ^{sqlval-of-tree}^";				# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " NULL";						# STRING REQUIRED ... makes short by uri
 # Misc
@@ -1423,7 +1465,7 @@ rdfdf:sql-datetime
   virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{tree}^ as varchar)";		# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " (case (^{datatype-of-tree}^)) when 'http://www.w3.org/2001/XMLSchema#datetime' then ^{sqlval-of-tree}^ else NULL end)";	# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " ^{sqlval-of-tree}^";				# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl " ^{tree}^";					# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl " NULL";						# STRING REQUIRED ... makes short by uri
 # Misc
@@ -1490,7 +1532,7 @@ rdfdf:multipart-uri
   virtrdf:qmfStrsqlvalOfShortTmpl " __spfi (^{custom-string-1}^, ^{comma-list-begin}^ ^{tree-N}^^{end}^)";	# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl "^{comma-list-begin}^ __spfinv (^{tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[^{N}^]^{as-name-N}^^{end}^";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl "^{comma-list-begin}^ __spfinv (^{tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[^{N}^]^{as-name-N}^^{end}^";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl		"^{comma-list-begin}^ __spfinv (^{sqlval-of-tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[^{N}^]^{as-name-N}^^{end}^";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl "^{comma-list-begin}^ __spfinv (__id2in (^{tree}^), ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[^{N}^]^{as-name-N}^^{end}^";	# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl "^{comma-list-begin}^ __spfinv (^{tree}^, ^{custom-string-1}^, 2^{opt-comma-arg-dtps}^)[^{N}^]^{as-name-N}^^{end}^";	# STRING REQUIRED ... makes short by uri
 #wrong:  virtrdf:qmfShortOfNiceSqlvalTmpl "^{comma-list-begin}^ ^{N-aref-of-spfinv}^^{as-name-N}^^{end}^";	# ... works like qmfShortOfSqlvalTmpl for values of one selected data type, not suitable for other types
@@ -1544,7 +1586,7 @@ rdfdf:multipart-uri-fn-nullable
   virtrdf:qmfName "multipart-uri-fn-nullable";
   virtrdf:qmfShortTmpl "^{comma-list-begin}^ ^{alias-N-dot}^^{column-N}^^{as-name-N}^^{end}^";	# STRING REQUIRED "short" value template, can be NULL
   virtrdf:qmfLongTmpl " __i2id (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{alias-N-dot}^^{column-N}^^{end}^))";	# STRING REQUIRED "long" value template, can be NULL
-  virtrdf:qmfSqlvalTmpl " ^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{alias-N-dot}^^{column-N}^^{end}^)";	# STRING REQUIRED "sqlval" value template, can be NULL
+  virtrdf:qmfSqlvalTmpl " __bft (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{alias-N-dot}^^{column-N}^^{end}^), 1)";	# STRING REQUIRED "sqlval" value template, can be NULL
   virtrdf:qmfBoolTmpl " NULL";							# STRING REQUIRED Boolean value template, can be NULL
 # Templates of booleans that tell whether the short is of some sort:
   virtrdf:qmfIsrefOfShortTmpl " 1";						# STRING REQUIRED ... whether the short is ref
@@ -1553,16 +1595,16 @@ rdfdf:multipart-uri-fn-nullable
   virtrdf:qmfIslitOfShortTmpl " 0";						# STRING REQUIRED ... whether the short is literal
 # Templates that convert short value into other types (can be applied to both field and not field expression)
   virtrdf:qmfLongOfShortTmpl " __i2id (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^))";	# STRING REQUIRED ... long from short
-  virtrdf:qmfSqlvalOfShortTmpl " ^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^)";		# STRING REQUIRED ... SQL value from short
+  virtrdf:qmfSqlvalOfShortTmpl " __bft (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^), 1)";		# STRING REQUIRED ... SQL value from short
   virtrdf:qmfDatatypeOfShortTmpl " 'http://www.w3.org/2001/XMLSchema#anyURI'";# STRING REQUIRED ... datatype IRI STRING from short
   virtrdf:qmfLanguageOfShortTmpl " NULL";					# STRING REQUIRED ... language ID STRING from short
   virtrdf:qmfBoolOfShortTmpl " NULL";						# STRING REQUIRED ... boolean value from short
   virtrdf:qmfIidOfShortTmpl " __i2id (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^))";
-  virtrdf:qmfUriOfShortTmpl " ^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^)";		# STRING REQUIRED ... URI STRING from short
+  virtrdf:qmfUriOfShortTmpl " __bft (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^), 1)";		# STRING REQUIRED ... URI STRING from short
   virtrdf:qmfStrsqlvalOfShortTmpl " ^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^)";	# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl "^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{tree}^)^{as-name-N}^^{end}^";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl "^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{tree}^)^{as-name-N}^^{end}^";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl "^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{sqlval-of-tree}^)^{as-name-N}^^{end}^";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl "^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (__id2in (^{tree}^))^{as-name-N}^^{end}^";	# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl "^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{tree}^)^{as-name-N}^^{end}^";	# STRING REQUIRED ... makes short by uri
 # Misc
@@ -1610,7 +1652,7 @@ rdfdf:multipart-literal-fn-nullable
   virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{custom-verbatim-1}^ (^{comma-list-begin}^ ^{tree-N}^^{end}^) as varchar)";	# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl "^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{tree}^)^{as-name-N}^^{end}^";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl "^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{tree}^)^{as-name-N}^^{end}^";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl "^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{sqlval-of-tree}^)^{as-name-N}^^{end}^";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl "^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (__ro2sq /*l*/ (^{tree}^))^{as-name-N}^^{end}^";	# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl "^{comma-list-begin}^ ^{custom-verbatim-1}^_INV_^{N1}^ (^{tree}^)^{as-name-N}^^{end}^";	# STRING REQUIRED ... makes short by literal
 # Misc
@@ -1710,7 +1752,7 @@ rdfdf:zeropart-uri-fn-nullable
   virtrdf:qmfName "zeropart-uri-fn-nullable";
   virtrdf:qmfShortTmpl "1 /*zeropart*/";	# STRING REQUIRED "short" value template, can be NULL
   virtrdf:qmfLongTmpl " __i2id (^{custom-verbatim-1}^ ())";			# STRING REQUIRED "long" value template, can be NULL
-  virtrdf:qmfSqlvalTmpl " ^{custom-verbatim-1}^ ()";				# STRING REQUIRED "sqlval" value template, can be NULL
+  virtrdf:qmfSqlvalTmpl " __bft (^{custom-verbatim-1}^ (), 1)";				# STRING REQUIRED "sqlval" value template, can be NULL
   virtrdf:qmfBoolTmpl " NULL";							# STRING REQUIRED Boolean value template, can be NULL
 # Templates of booleans that tell whether the short is of some sort:
   virtrdf:qmfIsrefOfShortTmpl " 1";						# STRING REQUIRED ... whether the short is ref
@@ -1719,12 +1761,12 @@ rdfdf:zeropart-uri-fn-nullable
   virtrdf:qmfIslitOfShortTmpl " 0";						# STRING REQUIRED ... whether the short is literal
 # Templates that convert short value into other types (can be applied to both field and not field expression)
   virtrdf:qmfLongOfShortTmpl " __i2id (^{custom-verbatim-1}^ ())";		# STRING REQUIRED ... long from short
-  virtrdf:qmfSqlvalOfShortTmpl " ^{custom-verbatim-1}^ ()";			# STRING REQUIRED ... SQL value from short
+  virtrdf:qmfSqlvalOfShortTmpl " __bft (^{custom-verbatim-1}^ (), 1)";		# STRING REQUIRED ... SQL value from short
   virtrdf:qmfDatatypeOfShortTmpl " 'http://www.w3.org/2001/XMLSchema#anyURI'";# STRING REQUIRED ... datatype IRI STRING from short
   virtrdf:qmfLanguageOfShortTmpl " NULL";					# STRING REQUIRED ... language ID STRING from short
   virtrdf:qmfBoolOfShortTmpl " NULL";						# STRING REQUIRED ... boolean value from short
   virtrdf:qmfIidOfShortTmpl " __i2id (^{custom-verbatim-1}^ ())";
-  virtrdf:qmfUriOfShortTmpl " ^{custom-verbatim-1}^ ()";			# STRING REQUIRED ... URI STRING from short
+  virtrdf:qmfUriOfShortTmpl " __bft (^{custom-verbatim-1}^ (), 1)";		# STRING REQUIRED ... URI STRING from short
   virtrdf:qmfStrsqlvalOfShortTmpl " ^{custom-verbatim-1}^ ()";			# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl "1 /*zeropart*/";				# STRING REQUIRED ... makes short by SQL value with specified type and/or language
@@ -1806,7 +1848,7 @@ rdfdf:sql-varchar-uri-fn
   virtrdf:qmfName "sql-varchar-uri-fn";
   virtrdf:qmfShortTmpl " ^{alias-dot}^^{column}^";				# STRING REQUIRED "short" value template, can be NULL
   virtrdf:qmfLongTmpl " __i2id (^{custom-verbatim-1}^ (^{alias-dot}^^{column}^))";	# STRING REQUIRED "long" value template, can be NULL
-  virtrdf:qmfSqlvalTmpl " ^{custom-verbatim-1}^ (^{alias-dot}^^{column}^)";	# STRING REQUIRED "sqlval" value template, can be NULL
+  virtrdf:qmfSqlvalTmpl " __bft (^{custom-verbatim-1}^ (^{alias-dot}^^{column}^), 1)";	# STRING REQUIRED "sqlval" value template, can be NULL
   virtrdf:qmfBoolTmpl " NULL";							# STRING REQUIRED Boolean value template, can be NULL
 # Templates of booleans that tell whether the short is of some sort:
   virtrdf:qmfIsrefOfShortTmpl " 1";						# STRING REQUIRED ... whether the short is ref
@@ -1815,16 +1857,16 @@ rdfdf:sql-varchar-uri-fn
   virtrdf:qmfIslitOfShortTmpl " 0";						# STRING REQUIRED ... whether the short is literal
 # Templates that convert short value into other types (can be applied to both field and not field expression)
   virtrdf:qmfLongOfShortTmpl " __i2id (^{custom-verbatim-1}^ (^{tree}^))";	# STRING REQUIRED ... long from short
-  virtrdf:qmfSqlvalOfShortTmpl " ^{custom-verbatim-1}^ (^{tree}^)";	# STRING REQUIRED ... SQL value from short
+  virtrdf:qmfSqlvalOfShortTmpl " __bft (^{custom-verbatim-1}^ (^{tree}^), 1)";		# STRING REQUIRED ... SQL value from short
   virtrdf:qmfDatatypeOfShortTmpl " 'http://www.w3.org/2001/XMLSchema#anyURI'";# STRING REQUIRED ... datatype IRI STRING from short
   virtrdf:qmfLanguageOfShortTmpl " NULL";					# STRING REQUIRED ... language ID STRING from short
   virtrdf:qmfBoolOfShortTmpl " NULL";						# STRING REQUIRED ... boolean value from short
   virtrdf:qmfIidOfShortTmpl " __i2id (^{custom-verbatim-1}^ (^{tree}^))";
-  virtrdf:qmfUriOfShortTmpl " ^{custom-verbatim-1}^ (^{tree}^)";		# STRING REQUIRED ... URI STRING from short
+  virtrdf:qmfUriOfShortTmpl " __bft (^{custom-verbatim-1}^ (^{tree}^), 1)";		# STRING REQUIRED ... URI STRING from short
   virtrdf:qmfStrsqlvalOfShortTmpl " ^{custom-verbatim-1}^ (^{tree}^)";	# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " NULL";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " ^{custom-verbatim-1}^_INVERSE (^{tree}^)";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " ^{custom-verbatim-1}^_INVERSE (^{sqlval-of-tree}^)";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl "  ^{custom-verbatim-1}^_INVERSE (__id2in (^{tree}^))";	# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl "  ^{custom-verbatim-1}^_INVERSE (^{tree}^)";		# STRING REQUIRED ... makes short by uri
 # Misc
@@ -1983,7 +2025,7 @@ rdfdf:sql-varchar-literal-fn
   virtrdf:qmfStrsqlvalOfShortTmpl " cast (^{custom-verbatim-1}^ (^{tree}^) as varchar)";	# STRING REQUIRED ... SQL representation of the STRING value of short
 # Templates of expressions that make short values from other representations
   virtrdf:qmfShortOfTypedsqlvalTmpl " NULL";					# STRING REQUIRED ... makes short by SQL value with specified type and/or language
-  virtrdf:qmfShortOfSqlvalTmpl " ^{custom-verbatim-1}^_INVERSE (^{tree}^)";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
+  virtrdf:qmfShortOfSqlvalTmpl " ^{custom-verbatim-1}^_INVERSE (^{sqlval-of-tree}^)";	# STRING REQUIRED ... makes short by sqlvalue with no language and a datatype specified by SQL type
   virtrdf:qmfShortOfLongTmpl "  ^{custom-verbatim-1}^_INVERSE (__ro2sq /*l*/ (^{tree}^))";	# STRING REQUIRED ... makes short by long
   virtrdf:qmfShortOfUriTmpl "  ^{custom-verbatim-1}^_INVERSE (^{tree}^)";		# STRING REQUIRED ... makes short by uri
 # Misc
diff --git a/binsrc/config/config.guess b/binsrc/config/config.guess
index 951383e..dc84c68 100755
--- a/binsrc/config/config.guess
+++ b/binsrc/config/config.guess
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+#   Free Software Foundation, Inc.
 
-timestamp='2007-05-17'
+timestamp='2009-11-20'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -27,16 +27,16 @@ timestamp='2007-05-17'
 # the same distribution terms that you use for the rest of that program.
 
 
-# Originally written by Per Bothner <per at bothner.com>.
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches at gnu.org> and include a ChangeLog
+# entry.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
 # exits with 0.  Otherwise, it exits with 1.
 #
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -56,8 +56,8 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -170,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-			| grep __ELF__ >/dev/null
+			| grep -q __ELF__
 		then
 		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
 		    # Return netbsd for either.  FIX?
@@ -324,14 +324,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	case `/usr/bin/uname -p` in
 	    sparc) echo sparc-icl-nx7; exit ;;
 	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
     sun4H:SunOS:5.*:*)
 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
-    i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
-	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit ;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
@@ -532,7 +551,7 @@ EOF
 		echo rs6000-ibm-aix3.2
 	fi
 	exit ;;
-    *:AIX:*:[45])
+    *:AIX:*:[456])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
@@ -640,7 +659,7 @@ EOF
 	    # => hppa64-hp-hpux11.23
 
 	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-		grep __LP64__ >/dev/null
+		grep -q __LP64__
 	    then
 		HP_ARCH="hppa2.0w"
 	    else
@@ -791,18 +810,24 @@ EOF
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
-    *:Interix*:[3456]*)
+    *:Interix*:*)
     	case ${UNAME_MACHINE} in
-	    x86) 
+	    x86)
 		echo i586-pc-interix${UNAME_RELEASE}
 		exit ;;
-	    EM64T | authenticamd)
+	    authenticamd | genuineintel | EM64T)
 		echo x86_64-unknown-interix${UNAME_RELEASE}
 		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
 	esac ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
 	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -832,8 +857,29 @@ EOF
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
     arm*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	else
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	fi
 	exit ;;
     avr32*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -847,6 +893,17 @@ EOF
     frv:Linux:*:*)
     	echo frv-unknown-linux-gnu
 	exit ;;
+    i*86:Linux:*:*)
+	LIBC=gnu
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	exit ;;
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
@@ -856,74 +913,33 @@ EOF
     m68*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
-    mips:Linux:*:*)
+    mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
 	#undef CPU
-	#undef mips
-	#undef mipsel
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mipsel
+	CPU=${UNAME_MACHINE}el
 	#else
 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips
+	CPU=${UNAME_MACHINE}
 	#else
 	CPU=
 	#endif
 	#endif
 EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-	;;
-    mips64:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips64
-	#undef mips64el
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mips64el
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips64
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
 	echo or32-unknown-linux-gnu
 	exit ;;
-    ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
-	exit ;;
-    ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
+    padre:Linux:*:*)
+	echo sparc-unknown-linux-gnu
 	exit ;;
-    alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-	  EV5)   UNAME_MACHINE=alphaev5 ;;
-	  EV56)  UNAME_MACHINE=alphaev56 ;;
-	  PCA56) UNAME_MACHINE=alphapca56 ;;
-	  PCA57) UNAME_MACHINE=alphapca56 ;;
-	  EV6)   UNAME_MACHINE=alphaev6 ;;
-	  EV67)  UNAME_MACHINE=alphaev67 ;;
-	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
@@ -933,8 +949,11 @@ EOF
 	  *)    echo hppa-unknown-linux-gnu ;;
 	esac
 	exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
@@ -954,72 +973,9 @@ EOF
     x86_64:Linux:*:*)
 	echo x86_64-unknown-linux-gnu
 	exit ;;
-    xtensa:Linux:*:*)
-    	echo xtensa-unknown-linux-gnu
+    xtensa*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
-    i*86:Linux:*:*)
-	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us. cd to the root directory to prevent
-	# problems with other programs or directories called `ld' in the path.
-	# Set LC_ALL=C to ensure ld outputs messages in English.
-	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-			 | sed -ne '/supported targets:/!d
-				    s/[ 	][ 	]*/ /g
-				    s/.*supported targets: *//
-				    s/ .*//
-				    p'`
-        case "$ld_supported_targets" in
-	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-		;;
-	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit ;;
-	  coff-i386)
-		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-		exit ;;
-	  "")
-		# Either a pre-BFD a.out linker (linux-gnuoldld) or
-		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-		exit ;;
-	esac
-	# Determine whether the default compiler is a.out or elf
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <features.h>
-	#ifdef __ELF__
-	# ifdef __GLIBC__
-	#  if __GLIBC__ >= 2
-	LIBC=gnu
-	#  else
-	LIBC=gnulibc1
-	#  endif
-	# else
-	LIBC=gnulibc1
-	# endif
-	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-	LIBC=gnu
-	#else
-	LIBC=gnuaout
-	#endif
-	#endif
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^LIBC/{
-		s: ::g
-		p
-	    }'`"
-	test x"${LIBC}" != x && {
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-		exit
-	}
-	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
-	;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 	# earlier versions are messed up and put the nodename in both
@@ -1048,7 +1004,7 @@ EOF
     i*86:syllable:*:*)
 	echo ${UNAME_MACHINE}-pc-syllable
 	exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
 	echo i386-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
     i*86:*DOS:*:*)
@@ -1092,8 +1048,11 @@ EOF
     pc:*:*:*)
 	# Left here for compatibility:
         # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i386.
-	echo i386-pc-msdosdjgpp
+        # the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configury will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
         exit ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
@@ -1131,6 +1090,16 @@ EOF
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
           && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
 	echo m68k-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
@@ -1143,7 +1112,7 @@ EOF
     rs6000:LynxOS:2.*:*)
 	echo rs6000-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
 	echo powerpc-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
     SM[BE]S:UNIX_SV:*:*)
@@ -1206,6 +1175,9 @@ EOF
     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
 	echo i586-pc-beos
 	exit ;;
+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
+	echo i586-pc-haiku
+	exit ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
 	exit ;;
@@ -1233,6 +1205,16 @@ EOF
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
 	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
 	    unknown) UNAME_PROCESSOR=powerpc ;;
 	esac
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1314,6 +1296,9 @@ EOF
     i*86:rdos:*:*)
 	echo ${UNAME_MACHINE}-pc-rdos
 	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1474,9 +1459,9 @@ This script, last modified $timestamp, has failed to recognize
 the operating system you are using. It is advised that you
 download the most up to date version of the config scripts from
 
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be
diff --git a/binsrc/config/config.sub b/binsrc/config/config.sub
index c060f44..2a55a50 100755
--- a/binsrc/config/config.sub
+++ b/binsrc/config/config.sub
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+#   Free Software Foundation, Inc.
 
-timestamp='2007-04-29'
+timestamp='2009-11-20'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -32,13 +32,16 @@ timestamp='2007-04-29'
 
 
 # Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# diff and a properly formatted GNU ChangeLog entry.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
 # Otherwise, we print the canonical config type on stdout and succeed.
 
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
 # that are meaningful with *any* GNU software.
@@ -72,8 +75,8 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -122,6 +125,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
   uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -148,10 +152,13 @@ case $os in
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray)
+	-apple | -axis | -knuth | -cray | -microblaze)
 		os=
 		basic_machine=$1
 		;;
+        -bluegene*)
+	        os=-cnk
+		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
 		basic_machine=$1
@@ -249,13 +256,16 @@ case $basic_machine in
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore | mep \
+	| maxq | mb | microblaze | mcore | mep | metag \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
-	| mips64vr | mips64vrel \
+	| mips64octeon | mips64octeonel \
 	| mips64orion | mips64orionel \
+	| mips64r5900 | mips64r5900el \
+	| mips64vr | mips64vrel \
 	| mips64vr4100 | mips64vr4100el \
 	| mips64vr4300 | mips64vr4300el \
 	| mips64vr5000 | mips64vr5000el \
@@ -268,6 +278,7 @@ case $basic_machine in
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
+	| moxie \
 	| mt \
 	| msp430 \
 	| nios | nios2 \
@@ -276,20 +287,22 @@ case $basic_machine in
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
+	| rx \
 	| score \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
 	| spu | strongarm \
 	| tahoe | thumb | tic4x | tic80 | tron \
+	| ubicom32 \
 	| v850 | v850e \
 	| we32k \
 	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
-	| z8k)
+	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12)
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
 		os=-none
@@ -329,14 +342,17 @@ case $basic_machine in
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
-	| mips64vr-* | mips64vrel-* \
+	| mips64octeon-* | mips64octeonel-* \
 	| mips64orion-* | mips64orionel-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mips64vr-* | mips64vrel-* \
 	| mips64vr4100-* | mips64vr4100el-* \
 	| mips64vr4300-* | mips64vr4300el-* \
 	| mips64vr5000-* | mips64vr5000el-* \
@@ -357,21 +373,26 @@ case $basic_machine in
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
-	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| romp-* | rs6000-* | rx-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
 	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
 	| tahoe-* | thumb-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
 	| tron-* \
+	| ubicom32-* \
 	| v850-* | v850e-* | vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
-	| xstormy16-* | xtensa-* \
+	| xstormy16-* | xtensa*-* \
 	| ymp-* \
-	| z8k-*)
+	| z8k-* | z80-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
 		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
@@ -435,6 +456,10 @@ case $basic_machine in
 		basic_machine=m68k-apollo
 		os=-bsd
 		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -443,10 +468,26 @@ case $basic_machine in
 		basic_machine=ns32k-sequent
 		os=-dynix
 		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
 		;;
+        cegcc)
+		basic_machine=arm-unknown
+		os=-cegcc
+		;;
 	convex-c1)
 		basic_machine=c1-convex
 		os=-bsd
@@ -475,8 +516,8 @@ case $basic_machine in
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16c)
-		basic_machine=cr16c-unknown
+	cr16)
+		basic_machine=cr16-unknown
 		os=-elf
 		;;
 	crds | unos)
@@ -514,6 +555,10 @@ case $basic_machine in
 		basic_machine=m88k-motorola
 		os=-sysv3
 		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
 	djgpp)
 		basic_machine=i586-pc
 		os=-msdosdjgpp
@@ -668,6 +713,14 @@ case $basic_machine in
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	m88k-omron*)
 		basic_machine=m88k-omron
 		;;
@@ -679,6 +732,9 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
+        microblaze)
+		basic_machine=microblaze-xilinx
+		;;
 	mingw32)
 		basic_machine=i386-pc
 		os=-mingw32
@@ -813,6 +869,14 @@ case $basic_machine in
 		basic_machine=i860-intel
 		os=-osf
 		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
 	pbd)
 		basic_machine=sparc-tti
 		;;
@@ -1021,6 +1085,10 @@ case $basic_machine in
 		basic_machine=tic6x-unknown
 		os=-coff
 		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
+		;;
 	tx39)
 		basic_machine=mipstx39-unknown
 		;;
@@ -1096,6 +1164,10 @@ case $basic_machine in
 		basic_machine=z8k-unknown
 		os=-sim
 		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
 	none)
 		basic_machine=none-none
 		os=-none
@@ -1134,7 +1206,7 @@ case $basic_machine in
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
 	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1184,6 +1256,9 @@ case $os in
         # First match some system type aliases
         # that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
+        -auroraux)
+	        os=-auroraux
+		;;
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
 		;;
@@ -1204,10 +1279,11 @@ case $os in
 	# Each alternative MUST END IN A *, to match a version number.
 	# -sysv* is not here because it comes later, after sysvr4.
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* \
+	      | -aos* | -aros* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1216,7 +1292,7 @@ case $os in
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-	      | -chorusos* | -chorusrdb* \
+	      | -chorusos* | -chorusrdb* | -cegcc* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
 	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
@@ -1226,7 +1302,7 @@ case $os in
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1356,6 +1432,9 @@ case $os in
 	-zvmoe)
 		os=-zvmoe
 		;;
+	-dicos*)
+		os=-dicos
+		;;
 	-none)
 		;;
 	*)
@@ -1553,7 +1632,7 @@ case $basic_machine in
 			-sunos*)
 				vendor=sun
 				;;
-			-aix*)
+			-cnk*|-aix*)
 				vendor=ibm
 				;;
 			-beos*)
diff --git a/binsrc/config/depcomp b/binsrc/config/depcomp
index e5f9736..df8eea7 100755
--- a/binsrc/config/depcomp
+++ b/binsrc/config/depcomp
@@ -1,10 +1,10 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2007-03-29.01
+scriptversion=2009-04-28.21; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
+# Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@ scriptversion=2007-03-29.01
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -87,6 +85,15 @@ if test "$depmode" = dashXmstdout; then
    depmode=dashmstdout
 fi
 
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+   # This is just like msvisualcpp but w/o cygpath translation.
+   # Just convert the backslash-escaped backslashes to single forward
+   # slashes to satisfy depend.m4
+   cygpath_u="sed s,\\\\\\\\,/,g"
+   depmode=msvisualcpp
+fi
+
 case "$depmode" in
 gcc3)
 ## gcc 3 implements dependency tracking that does exactly what
@@ -192,14 +199,14 @@ sgi)
 ' < "$tmpdepfile" \
     | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
     tr '
-' ' ' >> $depfile
-    echo >> $depfile
+' ' ' >> "$depfile"
+    echo >> "$depfile"
 
     # The second pass generates a dummy entry for each header file.
     tr ' ' '
 ' < "$tmpdepfile" \
    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> $depfile
+   >> "$depfile"
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile
@@ -328,7 +335,12 @@ hp2)
   if test -f "$tmpdepfile"; then
     sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
     # Add `dependent.h:' lines.
-    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+    sed -ne '2,${
+	       s/^ *//
+	       s/ \\*$//
+	       s/$/:/
+	       p
+	     }' "$tmpdepfile" >> "$depfile"
   else
     echo "#dummy" > "$depfile"
   fi
@@ -404,7 +416,7 @@ dashmstdout)
 
   # Remove the call to Libtool.
   if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
+    while test "X$1" != 'X--mode=compile'; do
       shift
     done
     shift
@@ -455,32 +467,39 @@ makedepend)
   "$@" || exit $?
   # Remove any Libtool call
   if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
+    while test "X$1" != 'X--mode=compile'; do
       shift
     done
     shift
   fi
   # X makedepend
   shift
-  cleared=no
-  for arg in "$@"; do
+  cleared=no eat=no
+  for arg
+  do
     case $cleared in
     no)
       set ""; shift
       cleared=yes ;;
     esac
+    if test $eat = yes; then
+      eat=no
+      continue
+    fi
     case "$arg" in
     -D*|-I*)
       set fnord "$@" "$arg"; shift ;;
     # Strip any option that makedepend may not understand.  Remove
     # the object too, otherwise makedepend will parse it as a source file.
+    -arch)
+      eat=yes ;;
     -*|$object)
       ;;
     *)
       set fnord "$@" "$arg"; shift ;;
     esac
   done
-  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  obj_suffix=`echo "$object" | sed 's/^.*\././'`
   touch "$tmpdepfile"
   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   rm -f "$depfile"
@@ -500,7 +519,7 @@ cpp)
 
   # Remove the call to Libtool.
   if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
+    while test "X$1" != 'X--mode=compile'; do
       shift
     done
     shift
@@ -538,13 +557,27 @@ cpp)
 
 msvisualcpp)
   # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout, regardless of -o,
-  # because we must use -o when running libtool.
+  # always write the preprocessed file to stdout.
   "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
   IFS=" "
   for arg
   do
     case "$arg" in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
 	set fnord "$@"
 	shift
@@ -557,16 +590,23 @@ msvisualcpp)
 	;;
     esac
   done
-  "$@" -E |
-  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  "$@" -E 2>/dev/null |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
   echo "	" >> "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
+msvcmsys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
 none)
   exec "$@"
   ;;
@@ -585,5 +625,6 @@ exit 0
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
diff --git a/binsrc/config/install-sh b/binsrc/config/install-sh
index a5897de..6781b98 100755
--- a/binsrc/config/install-sh
+++ b/binsrc/config/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2006-12-25.00
+scriptversion=2009-04-28.21; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -515,5 +515,6 @@ done
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
diff --git a/binsrc/config/missing b/binsrc/config/missing
index 1c8ff70..28055d2 100755
--- a/binsrc/config/missing
+++ b/binsrc/config/missing
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2006-05-10.23
+scriptversion=2009-04-28.21; # UTC
 
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
-#   Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,7 @@ scriptversion=2006-05-10.23
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
@@ -89,6 +87,9 @@ Supported PROGRAM values:
   tar          try tar, gnutar, gtar, then tar without non-portable flags
   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
 
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
 Send bug reports to <bug-automake at gnu.org>."
     exit $?
     ;;
@@ -106,15 +107,22 @@ Send bug reports to <bug-automake at gnu.org>."
 
 esac
 
+# normalize program name to check for.
+program=`echo "$1" | sed '
+  s/^gnu-//; t
+  s/^gnu//; t
+  s/^g//; t'`
+
 # Now exit if we have it, but it failed.  Also exit now if we
 # don't have it and --version was passed (most likely to detect
-# the program).
+# the program).  This is about non-GNU programs, so use $1 not
+# $program.
 case $1 in
-  lex|yacc)
+  lex*|yacc*)
     # Not GNU programs, they don't have --version.
     ;;
 
-  tar)
+  tar*)
     if test -n "$run"; then
        echo 1>&2 "ERROR: \`tar' requires --run"
        exit 1
@@ -138,7 +146,7 @@ esac
 
 # If it does not exist, or fails to run (possibly an outdated version),
 # try to emulate it.
-case $1 in
+case $program in
   aclocal*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
@@ -148,7 +156,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch aclocal.m4
     ;;
 
-  autoconf)
+  autoconf*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`${configure_ac}'.  You might want to install the
@@ -157,7 +165,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch configure
     ;;
 
-  autoheader)
+  autoheader*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acconfig.h' or \`${configure_ac}'.  You might want
@@ -187,7 +195,7 @@ WARNING: \`$1' is $msg.  You should only need it if
 	   while read f; do touch "$f"; done
     ;;
 
-  autom4te)
+  autom4te*)
     echo 1>&2 "\
 WARNING: \`$1' is needed, but is $msg.
          You might have modified some files without having the
@@ -210,7 +218,7 @@ WARNING: \`$1' is needed, but is $msg.
     fi
     ;;
 
-  bison|yacc)
+  bison*|yacc*)
     echo 1>&2 "\
 WARNING: \`$1' $msg.  You should only need it if
          you modified a \`.y' file.  You may need the \`Bison' package
@@ -240,7 +248,7 @@ WARNING: \`$1' $msg.  You should only need it if
     fi
     ;;
 
-  lex|flex)
+  lex*|flex*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.l' file.  You may need the \`Flex' package
@@ -263,7 +271,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     fi
     ;;
 
-  help2man)
+  help2man*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
 	 you modified a dependency of a manual page.  You may need the
@@ -277,11 +285,11 @@ WARNING: \`$1' is $msg.  You should only need it if
     else
 	test -z "$file" || exec >$file
 	echo ".ab help2man is required to generate this page"
-	exit 1
+	exit $?
     fi
     ;;
 
-  makeinfo)
+  makeinfo*)
     echo 1>&2 "\
 WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -310,7 +318,7 @@ WARNING: \`$1' is $msg.  You should only need it if
     touch $file
     ;;
 
-  tar)
+  tar*)
     shift
 
     # We have already tried tar in the generic part.
@@ -363,5 +371,6 @@ exit 0
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
 # End:
diff --git a/binsrc/dav/DET_DynaRes.sql b/binsrc/dav/DET_DynaRes.sql
new file mode 100644
index 0000000..2fb1435
--- /dev/null
+++ b/binsrc/dav/DET_DynaRes.sql
@@ -0,0 +1,893 @@
+--
+--  $Id: DET_DynaRes.sql,v 1.1.2.2 2010/12/10 15:20:48 source Exp $
+--
+--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+--  project.
+--
+--  Copyright (C) 1998-2010 OpenLink Software
+--
+--  This project is free software; you can redistribute it and/or modify it
+--  under the terms of the GNU General Public License as published by the
+--  Free Software Foundation; only version 2 of the License, dated June 1991.
+--
+--  This program is distributed in the hope that it will be useful, but
+--  WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+--  General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License along
+--  with this program; if not, write to the Free Software Foundation, Inc.,
+--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+--
+
+use DB
+;
+
+-- drop table WS.WS.DYNA_RES;
+
+create table WS.WS.DYNA_RES (
+  DR_RES_ID integer not null primary key,
+  DR_DETCOL_ID integer not null,
+  DR_NAME varchar not null,
+  DR_PERMS varchar not null,
+  DR_OWNER_UID integer not null,
+  DR_OWNER_GID integer not null,
+  DR_CREATED_DT datetime not null,
+  DR_MODIFIED_DT datetime,
+  DR_REFRESH_DT datetime,
+  DR_DELETE_DT datetime,
+  DR_REFRESH_SECONDS integer,
+  DR_MIME varchar not null,
+  DR_EXEC_STMT varchar,
+  DR_EXEC_PARAMS long varchar,
+  DR_EXEC_UNAME varchar,
+  DR_LAST_LENGTH integer,
+  DR_CONTENT long varchar )
+create unique index DYNA_RES_DETCOL_NAME on WS.WS.DYNA_RES (DR_DETCOL_ID, DR_NAME)
+create index DYNA_RES_REFRESH_DT on WS.WS.DYNA_RES (DR_REFRESH_DT)
+create index DYNA_RES_DELETE_DT on WS.WS.DYNA_RES (DR_DELETE_DT)
+;
+
+create function "DynaRes_ACCESS_PARAMS" (in detcol_id any, out access varchar, out gid integer, out uid integer)
+{
+  declare access_tmp varchar;
+  whenever not found goto ret;
+  access := '000000000N';
+  gid := http_nogroup_gid ();
+  uid := http_nobody_uid ();
+  if (isinteger (detcol_id))
+  {
+    select COL_PERMS, COL_GROUP, COL_OWNER into access_tmp, gid, uid from WS.WS.SYS_DAV_COL where COL_ID = detcol_id;
+  }
+  access[0] := access_tmp[0];
+  access[1] := access_tmp[1];
+--  access[3] := access_tmp[3];
+ret:
+  ;
+}
+;
+
+--| This matches DAV_AUTHENTICATE (in id any, in what char(1), in req varchar, in a_uname varchar, in a_pwd varchar, in a_uid integer := null)
+--| The difference is that the DET function should not check whether the pair of name and password is valid; the auth_uid is not a null already.
+create function "DynaRes_DAV_AUTHENTICATE" (in id any, in what char(1), in req varchar, in auth_uname varchar, in auth_pwd varchar, in auth_uid integer)
+{
+  declare pgid, puid integer;
+  declare pperms varchar;
+  -- dbg_obj_princ ('DynaRes_DAV_AUTHENTICATE (', id, what, req, auth_uname, auth_pwd, auth_uid, http_dav_uid(), ')');
+  if (auth_uid < 0)
+    return -12;
+  whenever not found goto nf_col_or_res;
+  select DR_PERMS, DR_OWNER_UID, DR_OWNER_GID into pperms, puid, pgid from WS.WS.DYNA_RES where DR_DETCOL_ID = id[1] and DR_RES_ID = id[3];
+  if (not ('110' like req))
+    return -13;
+  if (DAV_CHECK_PERM (pperms, req, auth_uid, http_nogroup_gid(), pgid, puid))
+    {
+      -- dbg_obj_princ ('DynaRes_DAV_AUTHENTICATE_HTTP" permits');
+      return auth_uid;
+    }
+  return -13;
+nf_col_or_res:
+  return -1;
+}
+;
+
+--| This exactly matches DAV_AUTHENTICATE_HTTP (in id any, in what char(1), in req varchar, in can_write_http integer, inout a_lines any, inout a_uname varchar, inout a_pwd varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer
+--| The function should fully check access because DAV_AUTHENTICATE_HTTP do nothing with auth data either before or after calling this DET function.
+--| Unlike DAV_AUTHENTICATE, user name passed to DAV_AUTHENTICATE_HTTP header may not match real DAV user.
+--| If DET call is successful, DAV_AUTHENTICATE_HTTP checks whether the user have read permission on mount point collection.
+--| Thus even if DET function allows anonymous access, the whole request may fail if mountpoint is not readable by public.
+create function "DynaRes_DAV_AUTHENTICATE_HTTP" (in id any, in what char(1), in req varchar, in can_write_http integer, inout a_lines any, inout a_uname varchar, inout a_pwd varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer
+{
+  declare rc integer;
+  declare puid, pgid integer;
+  declare u_password, pperms varchar;
+  declare allow_anon integer;
+  -- dbg_obj_princ ('DynaRes_DAV_AUTHENTICATE_HTTP" (', id, what, req, can_write_http, a_lines, a_uname, a_pwd, ', [a_uid], [a_gid], [perms])');
+  if (length (req) <> 3)
+    return -15;
+  whenever not found goto nf_col_or_res;
+  select DR_PERMS, DR_OWNER_UID, DR_OWNER_GID into pperms, puid, pgid from WS.WS.DYNA_RES where DR_DETCOL_ID = id[1] and DR_RES_ID = id[3];
+  if (pperms is null)
+    return -1;
+  if ((what <> 'R') and (what <> 'C'))
+    return -14;
+  allow_anon := WS.WS.PERM_COMP (substring (cast (pperms as varchar), 7, 3), req);
+  if (a_uid is null)
+    {
+      if ((not allow_anon) or ('' <> WS.WS.FINDPARAM (a_lines, 'Authorization:')))
+      rc := WS.WS.GET_DAV_AUTH (a_lines, allow_anon, can_write_http, a_uname, u_password, a_uid, a_gid, _perms);
+      if (rc < 0)
+        return rc;
+    }
+  if (isinteger (a_uid))
+    {
+      if (a_uid < 0)
+  return a_uid;
+     if (a_uid = 1) -- Anonymous FTP
+  {
+          a_uid := 0;
+    a_gid := 0;
+  }
+    }
+  if (DAV_CHECK_PERM (pperms, req, a_uid, a_gid, pgid, puid))
+    {
+      -- dbg_obj_princ ('DynaRes_DAV_AUTHENTICATE_HTTP" permits');
+      return a_uid;
+    }
+  return -13;
+
+nf_col_or_res:
+  return -1;
+}
+;
+
+
+--| This matches DAV_GET_PARENT (in id any, in st char(1), in path varchar) returns any
+create function "DynaRes_DAV_GET_PARENT" (in id any, in st char(1), in path varchar) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_GET_PARENT (', id, st, path, ')');
+  if ('R' <> st)
+    return -1; -- no subdirs ATM
+  return id[1];
+}
+;
+
+--| When DAV_COL_CREATE_INT calls DET function, authentication, check for lock and check for overwrite are passed, uid and gid are translated from strings to IDs.
+--| Check for overwrite, but the deletion of previously existing collection should be made by DET function.
+create function "DynaRes_DAV_COL_CREATE" (in detcol_id any, in path_parts any, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_COL_CREATE (', detcol_id, path_parts, permissions, uid, gid, auth_uid, ')');
+  return -20;
+}
+;
+
+--| It looks like that this is redundant and should be removed at all.
+create function "DynaRes_DAV_COL_MOUNT" (in detcol_id any, in path_parts any, in full_mount_path varchar, in mount_det varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_COL_MOUNT (', detcol_id, path_parts, full_mount_path, mount_det, permissions, uid, gid, auth_uid, ')');
+  return -20;
+}
+;
+
+--| It looks like that this is redundant and should be removed at all.
+create function "DynaRes_DAV_COL_MOUNT_HERE" (in parent_id any, in full_mount_path varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_COL_MOUNT_HERE (', parent_id, full_mount_path, permissions, uid, gid, auth_uid, ')');
+  return -20;
+}
+;
+
+
+--| When DAV_DELETE_INT calls DET function, authentication and check for lock are passed.
+create function "DynaRes_DAV_DELETE" (in detcol_id any, in path_parts any, in what char(1), in silent integer, in auth_uid integer) returns integer
+{
+  declare id any;
+  -- dbg_obj_princ ('DynaRes_DAV_DELETE (', detcol_id, path_parts, what, silent, auth_uid, ')');
+  if ('R' <> what)
+    return -20;
+  id := "DynaRes_DAV_SEARCH_ID" (detcol_id, path_parts, what);
+  if (DAV_HIDE_ERROR (id) is null)
+    return id;
+  delete from WS.WS.DYNA_RES where DR_RES_ID = id[3] and DR_DETCOL_ID = id[1];
+  return 0;
+}
+;
+
+--| When DAV_RES_UPLOAD_STRSES_INT calls DET function, authentication and check for locks are performed before the call.
+--| There's a special problem, known as 'Transaction deadlock after reading from HTTP session'.
+--| The DET function should do only one INSERT of the 'content' into the table and do it as late as possible.
+--| The function should return -29 if deadlocked or otherwise broken after reading blob from HTTP.
+create function "DynaRes_DAV_RES_UPLOAD" (in detcol_id any, in path_parts any, inout content any, in type varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_RES_UPLOAD (', detcol_id, path_parts, ', [content], ', content, type, permissions, uid, gid, auth_uid, ')');
+  declare res_depth, rc int;
+  return -20;
+}
+;
+
+
+--| When DAV_PROP_REMOVE_INT calls DET function, authentication and check for locks are performed before the call.
+--| The check whether it's a system name or not is _not_ permitted.
+create function "DynaRes_DAV_PROP_REMOVE" (in id any, in what char(0), in propname varchar, in silent integer, in auth_uid integer) returns integer
+{
+  -- dbg_obj_princ ('DynaRes_DAV_PROP_REMOVE (', id, what, propname, silent, auth_uid, ')');
+  return -20;
+}
+;
+
+--| When DAV_PROP_SET_INT calls DET function, authentication and check for locks are performed before the call.
+--| The check whether it's a system property or not is _not_ permitted and the function should return -16 for live system properties.
+create function "DynaRes_DAV_PROP_SET" (in id any, in what char(0), in propname varchar, in propvalue any, in overwrite integer, in auth_uid integer) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_PROP_SET (', id, what, propname, propvalue, overwrite, auth_uid, ')');
+  if (propname[0] = 58)
+    {
+      return -16;
+    }
+  return -20;
+}
+;
+
+--| When DAV_PROP_GET_INT calls DET function, authentication and check whether it's a system property are performed before the call.
+create function "DynaRes_DAV_PROP_GET" (in id any, in what char(0), in propname varchar, in auth_uid integer)
+{
+  -- dbg_obj_princ ('DynaRes_DAV_PROP_GET (', id, what, propname, auth_uid, ')');
+  return -11;
+}
+;
+
+--| When DAV_PROP_LIST_INT calls DET function, authentication is performed before the call.
+--| The returned list should contain only user properties.
+create function "DynaRes_DAV_PROP_LIST" (in id any, in what char(0), in propmask varchar, in auth_uid integer)
+{
+  -- dbg_obj_princ ('DynaRes_DAV_PROP_LIST (', id, what, propmask, auth_uid, ')');
+  return vector ();
+}
+;
+
+--| When DAV_PROP_GET_INT or DAV_DIR_LIST_INT calls DET function, authentication is performed before the call.
+create function "DynaRes_DAV_DIR_SINGLE" (in id any, in what char(0), in path any, in auth_uid integer) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_DIR_SINGLE (', id, what, path, auth_uid, ')');
+  declare fullpath, rightcol, resname varchar;
+  declare access varchar;
+  declare ownergid, owner_uid integer;
+  fullpath := '';
+  "DynaRes_ACCESS_PARAMS" (id[1], access, ownergid, owner_uid);
+  resname := coalesce ((select DR_NAME from WS.WS.DYNA_RES where DR_RES_ID = id[3] and DR_DETCOL_ID = id[1]));
+  if (resname is null)
+    return -1;
+  fullpath := concat(DAV_SEARCH_PATH (id[1], 'C'), resname);
+  if ('C' = what)
+    {
+      declare maxrcvdate datetime;
+      return vector (fullpath, 'C', 0, now(),
+        id,
+        --access,
+        '100000000NN',
+        ownergid, owner_uid, now(), 'dav/unix-directory', resname);
+    }
+-- The rest is for resources.
+  for (select DR_NAME, DR_LAST_LENGTH, DR_CREATED_DT, DR_PERMS, DR_OWNER_UID, DR_OWNER_GID, DR_MODIFIED_DT, DR_MIME
+    from WS.WS.DYNA_RES where DR_RES_ID = id[3] and DR_DETCOL_ID = id[1]) do
+    {
+      return vector (fullpath || DR_NAME, 'R', coalesce (DR_LAST_LENGTH, 1024), DR_CREATED_DT,
+        id, DR_PERMS, DR_OWNER_GID, DR_OWNER_UID, DR_MODIFIED_DT, DR_MIME, DR_NAME );
+    }
+  return -1;
+}
+;
+
+--| When DAV_PROP_GET_INT or DAV_DIR_LIST_INT calls DET function, authentication is performed before the call.
+create function "DynaRes_DAV_DIR_LIST" (in detcol_id any, in path_parts any, in detcol_path varchar, in name_mask varchar, in recursive integer, in auth_uid integer) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_DIR_LIST (', detcol_id, path_parts, detcol_path, name_mask, recursive, auth_uid, ')');
+  declare top_davpath varchar;
+  declare res any;
+  declare top_id any;
+  declare what char (1);
+  declare access varchar;
+  declare ownergid, owner_uid integer;
+  vectorbld_init (res);
+  "DynaRes_ACCESS_PARAMS" (detcol_id, access, ownergid, owner_uid);
+  if ((0 = length (path_parts)) or ('' = path_parts[length (path_parts) - 1]))
+    what := 'C';
+  else
+    what := 'R';
+  if ('C' = what and 1 = length(path_parts))
+    top_id := vector (UNAME'DynaRes', detcol_id, null);
+  else
+    top_id := "DynaRes_DAV_SEARCH_ID" (detcol_id, path_parts, what);
+  if (DAV_HIDE_ERROR (top_id) is null)
+    {
+      return vector();
+    }
+  top_davpath := DAV_CONCAT_PATH (detcol_path, path_parts);
+  if ('R' = what)
+    {
+      return vector ("DynaRes_DAV_DIR_SINGLE" (top_id, what, top_davpath, auth_uid));
+    }
+  if (top_id[2] is null)
+    {
+      for (select DR_RES_ID, DR_NAME, DR_LAST_LENGTH, DR_CREATED_DT, DR_PERMS, DR_OWNER_UID, DR_OWNER_GID, DR_MODIFIED_DT, DR_MIME
+        from WS.WS.DYNA_RES where DR_DETCOL_ID = detcol_id) do
+        {
+          vectorbld_acc (res, vector (top_davpath || DR_NAME, 'R', coalesce (DR_LAST_LENGTH, 1024), DR_CREATED_DT,
+            vector (UNAME'DynaRes', detcol_id, null, DR_RES_ID), DR_PERMS, DR_OWNER_GID, DR_OWNER_UID, DR_MODIFIED_DT, DR_MIME, DR_NAME ) );
+        }
+      goto finalize_res;
+    }
+finalize_res:
+  vectorbld_final (res);
+  return res;
+}
+;
+
+
+create procedure "DynaRes_DAV_FC_PRED_METAS" (inout pred_metas any)
+{
+  pred_metas := vector (
+    'RES_ID',		vector ('DYNA_RES'	, 0, 'any'	, 'vector (UNAME''DynaRes'', DR_DETCOL_ID, null, DR_RES_ID)'	),
+    'RES_ID_SERIALIZED',vector ('DYNA_RES'	, 0, 'varchar'	, 'serialize (vector (UNAME''DynaRes'', DR_DETCOL_ID, null, DR_RES_ID))' ),
+    'RES_NAME',		vector ('DYNA_RES'		, 0, 'varchar'	, 'DR_NAME'	),
+    'RES_FULL_PATH',	vector ('DYNA_RES'	, 0, 'varchar'	, 'concat (DAV_CONCAT_PATH (_param.detcolpath, null), DR_NAME)'	),
+    'RES_TYPE',		vector ('DYNA_RES'	, 0, 'varchar'	, 'DR_MIME'	),
+    'RES_OWNER_ID',	vector ('DYNA_RES'	, 0, 'integer'	, 'DR_OWNER_UID'	),
+    'RES_OWNER_NAME',	vector ('DYNA_RES'	, 0, 'varchar'	, '(select U_NAME from DB.DBA.SYS_USERS where U_ID=DR_OWNER_UID)'	),
+    'RES_GROUP_ID',	vector ('DYNA_RES'	, 0, 'integer'	, 'DR_OWNER_GID'	),
+    'RES_GROUP_NAME',	vector ('DYNA_RES'	, 0, 'varchar'	, '(select U_NAME from DB.DBA.SYS_USERS where U_ID=DR_OWNER_GID)'	),
+    'RES_COL_FULL_PATH',vector ('DYNA_RES'	, 0, 'varchar'	, '(_param.detcolpath'	),
+    'RES_COL_NAME',	vector ('DYNA_RES'	, 0, 'varchar'	, 'null'	),
+    -- 'RES_COL_ID',	vector ('SYS_DAV_RES'	, 0, 'varchar'	, 'RES_COL'	),
+    'RES_CR_TIME',	vector ('DYNA_RES'	, 0, 'datetime' , 'DR_CREATED_DT'	),
+    'RES_MOD_TIME',	vector ('DYNA_RES'	, 0, 'datetime' , 'DR_MODIFIED_DT'	),
+    'RES_PERMS',	vector ('DYNA_RES'	, 0, 'varchar'	, 'DR_PERMS'	),
+    'RES_CONTENT',	vector ('DYNA_RES'	, 0, 'text'	, 'coalesce (DR_CONTENT, ''(dynamic)'')'	),
+    'PROP_NAME',	vector ('DYNA_RES'	, 0, 'varchar'	, '(''Content'')'	),
+    'PROP_VALUE',	vector ('DYNA_RES'	, 1, 'text'	, 'coalesce (DR_CONTENT, ''(dynamic)'')'	),
+    'RES_TAGS',		vector ('DYNA_RES'	, 0, 'varchar'	, '('''')'	), -- 'varchar', not 'text-tag' because there's no free-text on union
+    'RES_PUBLIC_TAGS',	vector ('DYNA_RES'	, 0, 'varchar'	, '('''')'	),
+    'RES_PRIVATE_TAGS',	vector ('DYNA_RES'	, 0, 'varchar'	, '('''')'	),
+    'RDF_PROP',		vector ('DYNA_RES'	, 1, 'varchar'	, NULL	),
+    'RDF_VALUE',	vector ('DYNA_RES'	, 2, 'XML'	, NULL	),
+    'RDF_OBJ_VALUE',	vector ('DYNA_RES'	, 3, 'XML'	, NULL	)
+    );
+}
+;
+
+create procedure "DynaRes_DAV_FC_TABLE_METAS" (inout table_metas any)
+{
+	table_metas := vector (
+	'DYNA_RES'	 , vector (	'\n	inner join WS.WS.DYNA_RES as ^{alias}^ on ((^{alias}^.DR_RES_ID = _top.DR_RES_ID)^{andpredicates}^)'	,
+						'DR_CONTENT'	, 'DR_CONTENT'	, '[__quiet] /' )
+--	'SYS_BLOG_OWNERS' , vector (	'\n	left outer join BLOG.DBA.SYS_BLOG_OWNERS as ^{alias}^ on ((^{alias}^.BI_BLOG_ID = _top.B_BLOG_ID)^{andpredicates}^)'	,
+--					'\n	exists (select 1 from BLOG.DBA.SYS_BLOG_OWNERS as ^{alias}^ where (^{alias}^.BI_BLOG_ID = _top.B_BLOG_ID)^{andpredicates}^)'	,
+--						NULL		, NULL		, NULL	)
+--	'SYS_DAV_COL'	, vector (	'\n	inner join WS.WS.SYS_DAV_COL as ^{alias}^ on ((^{alias}^.COL_ID = _param.detcol)^{andpredicates}^)'	,
+--					'\n	exists (select 1 from WS.WS.SYS_DAV_COL as ^{alias}^ where (^{alias}^.COL_ID = _param.detcol)^{andpredicates}^)'	,
+--						NULL		, NULL		, NULL	),
+--	'SYS_DAV_GROUP'	, vector (	'\n	left outer join WS.WS.SYS_DAV_GROUP as ^{alias}^ on ((^{alias}^.G_ID = _top.RES_GROUP)^{andpredicates}^)'	,
+--					'\n	exists (select 1 from WS.WS.SYS_DAV_GROUP as ^{alias}^ where (^{alias}^.G_ID = _top.RES_GROUP)^{andpredicates}^)'	,
+--						NULL		, NULL		, NULL	)--,
+--	'SYS_DAV_PROP'	, vector (	'\n	inner join WS.WS.SYS_DAV_PROP as ^{alias}^ on ((^{alias}^.PROP_PARENT_ID = _top.RES_ID) and (^{alias}^.PROP_TYPE = ''R'')^{andpredicates}^)'	,
+--					'\n	exists (select 1 from WS.WS.SYS_DAV_PROP as ^{alias}^ where (^{alias}^.PROP_PARENT_ID = _top.RES_ID) and (^{alias}^.PROP_TYPE = ''R'')^{andpredicates}^)'	,
+--						'PROP_VALUE'	, 'PROP_VALUE'	, '[__quiet __davprop xmlns:virt="virt"] .'	),
+--	'public-tags'	, vector (	'\n	inner join WS.WS.SYS_DAV_TAG as ^{alias}^ on ((^{alias}^.DT_RES_ID = _top.RES_ID) and (^{alias}^.DT_U_ID = http_nobody_uid())^{andpredicates}^)'	,
+--					'\n	exists (select 1 from WS.WS.SYS_DAV_TAG as ^{alias}^ where (^{alias}^.DT_RES_ID = _top.RES_ID) and (^{alias}^.DT_U_ID = http_nobody_uid())^{andpredicates}^)'	,
+--						'DT_TAGS'	, 'DT_TAGS'	, NULL	),
+--	'private-tags'	, vector (	'\n	inner join WS.WS.SYS_DAV_TAG as ^{alias}^ on ((^{alias}^.DT_RES_ID = _top.RES_ID) and (^{alias}^.DT_U_ID = ^{uid}^)^{andpredicates}^)'	,
+--					'\n	exists (select 1 from WS.WS.SYS_DAV_TAG as ^{alias}^ where (^{alias}^.DT_RES_ID = _top.RES_ID) and (^{alias}^.DT_U_ID = ^{uid}^)^{andpredicates}^)'	,
+--						'DT_TAGS'	, 'DT_TAGS'	, NULL	),
+--	'all-tags'		, vector (	'\n	inner join (select * from WS.WS.SYS_DAV_TAG ^{alias}^_pub where ^{alias}^_pub.DT_U_ID = http_nobody_uid() union select * from WS.WS.SYS_DAV_TAG ^{alias}^_prv where ^{alias}^_prv.DT_U_ID = ^{uid}^) as ^{alias}^ on ((^{alias}^.DT_RES_ID = _top.RES_ID)^{andpredicates}^)'	,
+--					'\n	exists (select 1 from (select * from WS.WS.SYS_DAV_TAG ^{alias}^_pub where ^{alias}^_pub.DT_U_ID = http_nobody_uid() union select * from WS.WS.SYS_DAV_TAG ^{alias}^_prv where ^{alias}^_prv.DT_U_ID = ^{uid}^) as ^{alias}^ where (^{alias}^.DT_RES_ID = _top.RES_ID)^{andpredicates}^)'	,
+--						'DT_TAGS'	, 'DT_TAGS'	, NULL	)
+	);
+}
+;
+
+
+-- This prints the fragment that starts after 'FROM WS.WS.DYNA_RES' and contains the rest of FROM and whole 'WHERE'
+create function "DynaRes_DAV_FC_PRINT_WHERE" (inout filter any, in param_uid integer) returns varchar
+{
+  declare pred_metas, cmp_metas, table_metas any;
+  declare used_tables any;
+  -- dbg_obj_princ ('DynaRes_POST_DAV_FC_PRINT_WHERE (', filter, param_uid, ')');
+  "DynaRes_POST_DAV_FC_PRED_METAS" (pred_metas);
+  DAV_FC_CMP_METAS (cmp_metas);
+  "DynaRes_POST_DAV_FC_TABLE_METAS" (table_metas);
+  used_tables := vector (
+    'DYNA_RES', vector ('DYNA_RES', '_top', null, vector (), vector (), vector ())
+    );
+  return DAV_FC_PRINT_WHERE_INT (filter, pred_metas, cmp_metas, table_metas, used_tables, param_uid);
+}
+;
+
+--| When DAV_DIR_FILTER_INT calls DET function, authentication is performed before the call and compilation is initialized.
+create function "DynaRes_DAV_DIR_FILTER" (in detcol_id any, in path_parts any, in detcol_path any, inout compilation any, in recursive integer, in auth_uid integer) returns any
+{
+  declare st, access, qry_text, execstate, execmessage varchar;
+  declare res any;
+  declare cond_list, execmeta, execrows any;
+  declare condtext, cond_key varchar;
+  declare ownergid, owner_uid integer;
+  -- dbg_obj_princ ('DynaRes_DAV_DIR_FILTER (', detcol_id, path_parts, detcol_path, compilation, recursive, auth_uid, ')');
+  "DynaRes_ACCESS_PARAMS" (detcol_id, access, ownergid, owner_uid);
+  vectorbld_init (res);
+  cond_list := get_keyword ('', compilation);
+  -- dbg_obj_princ ('cond_list is ', cond_list);
+  condtext := "DynaRes_POST_DAV_FC_PRINT_WHERE" (cond_list, auth_uid);
+  -- dbg_obj_princ ('\r\ncondtext2 ', condtext, '\r\n');
+  compilation := vector_concat (compilation, vector (cond_key, condtext));
+  -- dbg_obj_princ ('\r\ncompilation ', compilation, '\r\n');
+  execstate := '00000';
+  qry_text := 'select DAV_CONCAT_PATH (?, _top.DR_NAME),
+  ''R'', _top.DR_LAST_LENGTH, coalesce (_top.DR_MODIFIED_DT, now ()),
+  vector (UNAME''DynaRes'', _top.DR_DETCOL_ID, null, _top.DR_RES_ID),
+  _top.DR_PERMS, _top.DR_OWNER_GID, _top.DR_OWNER_UID, _top.DR_CREATED_DT, ''text/plain'', _top.DR_NAME
+from WS.WS.DYNA_RES as _top where _top.DR_DETCOL_ID = ? ' || condtext;
+  -- dbg_obj_princ ('Collection of dynamic resources, qry_text = ', qry_text);
+  exec (qry_text, execstate, execmessage,
+    vector (detcol_path, detcol_id),
+    100000000, execmeta, execrows );
+  -- dbg_obj_princ ('Collection of blog posts: execstate = ', execstate, ', execmessage = ', execmessage);
+  if ('00000' <> execstate)
+    signal (execstate, execmessage || ' in ' || qry_text);
+  vectorbld_concat_acc (res, execrows);
+
+finalize:
+  vectorbld_final (res);
+  return res;
+}
+;
+
+--| When DAV_PROP_GET_INT or DAV_DIR_LIST_INT calls DET function, authentication is performed before the call.
+create function "DynaRes_DAV_SEARCH_ID" (in detcol_id any, in path_parts any, in what char(1)) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_SEARCH_ID (', detcol_id, path_parts, what, ')');
+  if (path_parts[0] = '' or path_parts[0] is null)
+    return -1;
+  declare colpath, c_name varchar;
+  declare c_res_id, len integer;
+  declare access varchar;
+  declare ownergid, owner_uid integer;
+  "DynaRes_ACCESS_PARAMS" (detcol_id, access, ownergid, owner_uid);
+  len := length (path_parts);
+  if (0 = len)
+    {
+      if ('C' <> what)
+        {
+          -- dbg_obj_princ ('resource with empty path - no items');
+          return -1;
+        }
+      return vector (UNAME'DynaRes', detcol_id, null, null);
+    }
+  if ('' = path_parts[len - 1])
+    {
+      if ('C' <> what)
+        {
+          -- dbg_obj_princ ('resource without a name - no items');
+          return -1;
+        }
+    }
+  else
+    {
+      if ('R' <> what)
+        {
+          -- dbg_obj_princ ('non-resource with a name - no items');
+          return -1;
+        }
+    }
+  c_res_id := coalesce ((select DR_RES_ID
+    from WS.WS.DYNA_RES where DR_DETCOL_ID = detcol_id and DR_NAME = path_parts[len - 1]));
+  if (c_res_id is null)
+    return -1;
+  return vector (UNAME'DynaRes', detcol_id, null, c_res_id);
+}
+;
+
+--| When DAV_SEARCH_PATH_INT calls DET function, authentication is performed before the call.
+create function "DynaRes_DAV_SEARCH_PATH" (in id any, in what char(1)) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_SEARCH_PATH (', id, what, ')');
+  return NULL;
+}
+;
+
+--| When DAV_COPY_INT calls DET function, authentication and check for locks are performed before the call, but no check for existing/overwrite.
+create function "DynaRes_DAV_RES_UPLOAD_COPY" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite_flags integer, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_RES_UPLOAD_COPY (', detcol_id, path_parts, source_id, what, overwrite_flags, permissions, uid, gid, auth_uid, ')');
+  return -20;
+}
+;
+
+--| When DAV_COPY_INT calls DET function, authentication and check for locks are performed before the call, but no check for existing/overwrite.
+create function "DynaRes_DAV_RES_UPLOAD_MOVE" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite_flags integer, in auth_uid integer) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_RES_UPLOAD_MOVE (', detcol_id, path_parts, source_id, what, overwrite_flags, auth_uid, ')');
+  return -20;
+}
+;
+
+--| When DAV_RES_CONTENT or DAV_RES_COPY_INT or DAV_RES_MOVE_INT calls DET function, authentication is made.
+--| If content_mode is 1 then content is a valid output stream before the call.
+create function "DynaRes_DAV_RES_CONTENT" (in id any, inout content any, out type varchar, in content_mode integer) returns integer
+{
+  -- dbg_obj_princ ('DynaRes_DAV_RES_CONTENT (', id, ', [content], [type], ', content_mode, ')');
+  declare c cursor for select
+    DR_NAME, DR_PERMS, DR_OWNER_UID, DR_OWNER_GID, DR_CREATED_DT, DR_MODIFIED_DT, DR_REFRESH_DT, DR_DELETE_DT,
+    DR_REFRESH_SECONDS, DR_MIME, DR_EXEC_STMT, deserialize (DR_EXEC_PARAMS), DR_EXEC_UNAME, DR_CONTENT
+    from WS.WS.DYNA_RES where DR_RES_ID = id[3] and DR_DETCOL_ID = id[1] for update;
+  declare c_name, c_perms varchar;
+  declare c_owner_uid, c_owner_gid integer;
+  declare c_created_dt, c_modified_dt, c_refresh_dt, c_delete_dt datetime;
+  declare c_refresh_seconds integer;
+  declare c_mime, c_exec_stmt varchar;
+  declare c_exec_params any;
+  declare c_exec_uname varchar;
+  declare c_last_length integer;
+  declare c_content any;
+  declare stat, msg varchar;
+  declare mdta, rset any;
+  set isolation = 'committed';
+  for (select DR_MIME, DR_CONTENT from WS.WS.DYNA_RES
+    where DR_RES_ID = id[3] and DR_DETCOL_ID = id[1] and DR_MODIFIED_DT is not null
+   and (DR_REFRESH_DT is null or DR_REFRESH_DT > now())
+   and (DR_DELETE_DT is null or DR_DELETE_DT > now()) ) do
+    {
+      type := DR_MIME;
+      if ((content_mode = 0) or (content_mode = 2))
+        content := DR_CONTENT;
+      else if (content_mode = 1)
+        http (DR_CONTENT, content);
+      else if (content_mode = 3)
+        http (DR_CONTENT);
+      return 0;
+    }
+  set isolation = 'serializable';
+  whenever not found goto nf;
+  open c;
+  fetch c into c_name, c_perms, c_owner_uid, c_owner_gid, c_created_dt, c_modified_dt, c_refresh_dt, c_delete_dt,
+    c_refresh_seconds, c_mime, c_exec_stmt, c_exec_params, c_exec_uname, c_content;
+  if (c_modified_dt is not null
+    and (c_refresh_dt is null or c_refresh_dt > now())
+    and (c_delete_dt is null or c_delete_dt > now()) )
+    {
+      -- dbg_obj_princ ('content is fresh');
+      type := c_mime;
+      close c;
+      goto content_ready;
+    }
+  if (c_delete_dt is not null and c_delete_dt <= now())
+    {
+      -- dbg_obj_princ ('should be deleted');
+      delete from WS.WS.DYNA_RES where current of c;
+      return -1;
+    }
+  update WS.WS.DYNA_RES set DR_MODIFIED_DT = null where current of c;
+  set_user_id (c_exec_uname, 1);
+  stat := '00000';
+  -- dbg_obj_princ ('About to exec (', c_exec_stmt, stat, msg, c_exec_params, 1, '[mdta], [rset])');
+  exec (c_exec_stmt, stat, msg, c_exec_params, 1, mdta, rset);
+  if (stat <> '00000')
+    {
+      update WS.WS.DYNA_RES set DR_MODIFIED_DT = c_modified_dt where current of c;
+      commit work;
+      signal (stat, msg);
+    }
+  c_content := rset[0][0];
+  update WS.WS.DYNA_RES set DR_MODIFIED_DT = now(), DR_REFRESH_DT = dateadd ('second', c_refresh_seconds, now()),
+    DR_LAST_LENGTH=length (c_content), DR_CONTENT=c_content
+  where current of c;
+  commit work;
+  type := c_mime;
+  close c;
+
+content_ready:
+  if ((content_mode = 0) or (content_mode = 2))
+    content := c_content;
+  else if (content_mode = 1)
+    http (c_content, content);
+  else if (content_mode = 3)
+    http (c_content);
+  return 0;
+
+nf:
+  return -1;
+}
+;
+
+--| This adds an extra access path to the existing resource or collection.
+create function "DynaRes_DAV_SYMLINK" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in uid integer, in gid integer, in auth_uid integer) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_SYMLINK (', detcol_id, path_parts, source_id, overwrite, uid, gid, auth_uid, ')');
+  return -20;
+}
+;
+
+--| This gets a list of resources and/or collections as it is returned by DAV_DIR_LIST and and writes the list of quads (old_id, 'what', old_full_path, dereferenced_id, dereferenced_full_path).
+create function "DynaRes_DAV_DEREFERENCE_LIST" (in detcol_id any, inout report_array any) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_DEREFERENCE_LIST (', detcol_id, report_array, ')');
+  return -20;
+}
+;
+
+--| This gets one of reference quads returned by ..._DAV_REREFERENCE_LIST() and returns a record (new_full_path, new_dereferenced_full_path, name_may_vary).
+create function "DynaRes_DAV_RESOLVE_PATH" (in detcol_id any, inout reference_item any, inout old_base varchar, inout new_base varchar) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_RESOLVE_PATH (', detcol_id, reference_item, old_base, new_base, ')');
+  return -20;
+}
+;
+
+--| There's no API function to lock for a while (do we need such?) The "LOCK" DAV method checks that all parameters are valid but does not check for existing locks.
+create function "DynaRes_DAV_LOCK" (in path any, in id any, in type char(1), inout locktype varchar, inout scope varchar, in token varchar, inout owner_name varchar, inout owned_tokens varchar, in depth varchar, in timeout_sec integer, in auth_uid integer) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_LOCK (', id, type, locktype, scope, token, owner_name, owned_tokens, depth, timeout_sec, owner_name, auth_uid, ')');
+  return -20;
+}
+;
+
+
+--| There's no API function to unlock for a while (do we need such?) The "UNLOCK" DAV method checks that all parameters are valid but does not check for existing locks.
+create function "DynaRes_DAV_UNLOCK" (in id any, in type char(1), in token varchar, in auth_uid integer)
+{
+  -- dbg_obj_princ ('DynaRes_DAV_UNLOCK (', id, type, token, auth_uid, ')');
+  return -27;
+}
+;
+
+--| The caller does not check if id is valid.
+--| This returns -1 if id is not valid, 0 if all existing locks are listed in owned_tokens whitespace-delimited list, 1 for soft 2 for hard lock.
+create function "DynaRes_DAV_IS_LOCKED" (inout id any, inout type char(1), in owned_tokens varchar) returns integer
+{
+  -- dbg_obj_princ ('DynaRes_DAV_IS_LOCKED (', id, type, owned_tokens, ')');
+  return 0;
+}
+;
+
+
+--| The caller does not check if id is valid.
+--| This returns -1 if id is not valid, list of tuples (LOCK_TYPE, LOCK_SCOPE, LOCK_TOKEN, LOCK_TIMEOUT, LOCK_OWNER, LOCK_OWNER_INFO) otherwise.
+create function "DynaRes_DAV_LIST_LOCKS" (in id any, in type char(1), in recursive integer) returns any
+{
+  -- dbg_obj_princ ('DynaRes_DAV_LIST_LOCKS" (', id, type, recursive);
+  return vector ();
+}
+;
+
+
+create procedure "DynaRes_CF_PROPNAME_TO_COLNAME" (in prop varchar)
+{
+  return NULL;
+--  return get_keyword (prop, vector (
+--        'http://purl.org/rss/1.0/title', 'BLOG_INFO.BI_TITLE',
+--        'http://purl.org/rss/1.0/copyright', 'BLOG_INFO.BI_COPYRIGHT',
+--        'http://purl.org/rss/1.0/description', 'BLOG_INFO.BI_ABOUT',
+--        'http://purl.org/rss/1.0/link', '"DynaRes_CF_COMPOSE_BLOG_LINK" (BLOG_INFO.BI_BLOG_ID)',
+--        'http://purl.org/rss/1.0/lastBuildDate', 'cast (BLOG_INFO.BI_LAST_UPDATE as varchar)' ) );
+}
+;
+
+create procedure "DynaRes_CF_FEED_FROM_AND_WHERE" (in detcol_id integer, in cfc_id integer, inout rfc_list_cond any, inout filter_data any, in distexpn varchar, in auth_uid integer)
+{
+  declare where_clause, from_clause varchar;
+  declare access varchar;
+  declare ownergid, owner_uid, proppos, filter_len, filter_idx integer;
+  -- dbg_obj_princ ('DynaRes_CF_FEED_FROM_AND_WHERE (', detcol_id, cfc_id, rfc_list_cond, filter_data, distexpn, auth_uid, ')');
+  "DynaRes_ACCESS_PARAMS" (detcol_id, access, ownergid, owner_uid);
+  -- dbg_obj_princ ('"DynaRes_ACCESS_PARAMS" (', detcol_id, ',...) reports ', access, ownergid, owner_uid );
+  from_clause := '
+  from
+    WS.WS.DYNA_RES as DR
+';
+  where_clause := 'DR.DETCOL_ID = ' || cast (detcol_id as varchar);
+  filter_len := length (filter_data);
+  for (filter_idx := 0; filter_idx < (filter_len - 3); filter_idx := filter_idx + 4)
+    {
+      declare mode integer;
+      declare cmp_col, cmp_val varchar;
+      cmp_col := "DynaRes_CF_PROPNAME_TO_COLNAME" (filter_data [filter_idx]);
+      cmp_val := filter_data [filter_idx + 2];
+      -- dbg_obj_princ ('cmp_col=', cmp_col, ', cmp_val=', cmp_val);
+      if (cmp_col is null)
+        {
+          if ('' <> cmp_val)
+            {
+              where_clause := '1 = 2';
+              goto where_clause_complete;
+            }
+          goto where_oper_complete;
+        }
+      if (where_clause <> '')
+        where_clause := where_clause || ' and ';
+      mode := filter_data [filter_idx + 3];
+      if (mode = 0)
+        where_clause := where_clause || sprintf ('(%s = %s)', cmp_col, WS.WS.STR_SQL_APOS (cmp_val));
+      else if (mode = 4)
+        where_clause := where_clause || sprintf ('(%s is null)', cmp_col);
+      else -- truncation
+        where_clause := where_clause || sprintf ('(%s between %s and %s)', cmp_col, WS.WS.STR_SQL_APOS (cmp_val), WS.WS.STR_SQL_APOS (cmp_val || '\377\377\377\377'));
+where_oper_complete:
+      ;
+    }
+where_clause_complete:
+  if (where_clause <> '')
+    return from_clause || ' where ' || where_clause;
+  return from_clause;
+}
+;
+
+
+create procedure "DynaRes_CF_LIST_PROP_DISTVALS" (in detcol_id integer, in cfc_id integer, in rfc_spath varchar, inout rfc_list_cond any, in schema_uri varchar, inout filter_data any, inout distval_dict any, in auth_uid integer)
+{
+  declare distprop, distexpn varchar;
+  declare from_and_where_text, qry_text varchar;
+  declare execstate, execmessage varchar;
+  declare execmeta, execrows any;
+  -- dbg_obj_princ ('DynaRes_CF_LIST_PROP_DISTVALS (', detcol_id, cfc_id, rfc_spath, rfc_list_cond, schema_uri, filter_data, distval_dict, auth_uid, ')');
+  if (schema_uri = 'http://purl.org/rss/1.0/')
+    { -- channel description
+      distprop := filter_data[length (filter_data) - 2];
+      distexpn := "DynaRes_CF_PROPNAME_TO_COLNAME" (distprop);
+      if (distexpn is null)
+        {
+          dict_put (distval_dict, '! empty property value !', 1);
+          return;
+        }
+      from_and_where_text := Blog_CF_FEED_FROM_AND_WHERE (detcol_id, cfc_id, rfc_list_cond, filter_data, distexpn, auth_uid);
+      qry_text := 'select distinct ' || distexpn || from_and_where_text;
+      execstate := '00000';
+      execmessage := 'OK';
+      -- dbg_obj_princ ('Will exec: ', qry_text);
+      exec (qry_text,
+        execstate, execmessage,
+        vector (), 100000000, execmeta, execrows );
+      -- dbg_obj_princ ('exec returns: ', execstate, execmessage, execrows);
+      if (isarray (execrows))
+        foreach (any execrow in execrows) do
+          {
+            dict_put (distval_dict, "CatFilter_ENCODE_CATVALUE" (execrow[0]), 1);
+          }
+      return;
+    }
+}
+;
+
+create function "DynaRes_CF_GET_RDF_HITS" (in detcol_id integer, in cfc_id integer, in rfc_spath varchar, inout rfc_list_cond any, in schema_uri varchar, inout filter_data any, in detcol_path varchar, in make_diritems integer, in auth_uid integer) returns any
+{
+  declare from_and_where_text, qry_text varchar;
+  declare execstate, execmessage varchar;
+  declare acc_len, acc_ctr integer;
+  declare execmeta, acc any;
+  declare access varchar;
+  declare ownergid, owner_uid integer;
+  -- dbg_obj_princ ('\n\n\nDynaRes_CF_GET_RDF_HITS (', detcol_id, cfc_id, rfc_spath, rfc_list_cond, schema_uri, filter_data, make_diritems, auth_uid, ')');
+  acc := vector ();
+  acc_len := 0;
+  if (schema_uri = 'http://purl.org/rss/1.0/')
+    { -- channel description
+      "DynaRes_ACCESS_PARAMS" (detcol_id, access, ownergid, owner_uid);
+      from_and_where_text := Blog_CF_FEED_FROM_AND_WHERE (detcol_id, cfc_id, rfc_list_cond, filter_data, 'DR.DR_NAME', auth_uid);
+      qry_text := 'select DR.DR_NAME' || from_and_where_text;
+      execstate := '00000';
+      execmessage := 'OK';
+      -- dbg_obj_princ ('Will exec: ', qry_text);
+      exec (qry_text,
+        execstate, execmessage,
+        vector (), 100000000, execmeta, acc );
+      -- dbg_obj_princ ('exec returns: ', execstate, execmessage, acc);
+      acc_len := length (acc);
+      acc_ctr := 0;
+      while (acc_ctr < acc_len)
+  {
+    declare r_id integer;
+    declare fullname varchar;
+    declare full_id, diritm any;
+    r_id := acc[acc_ctr][0];
+    full_id := vector (UNAME'DynaRes', detcol_id, r_id, owner_uid, null, null);
+    if (make_diritems = 1)
+      {
+        diritm := "DynaRes_DAV_DIR_SINGLE" (full_id, 'R', '(fake path)', auth_uid);
+        if (DAV_HIDE_ERROR (diritm) is not null)
+    {
+      diritm [0] := DAV_CONCAT_PATH (detcol_path, diritm[10]); -- now we can remove the fake path.
+                  acc [acc_ctr] := diritm;
+            acc_ctr := acc_ctr + 1;
+    }
+        else --collision in the air: someone just removed the resource from the disk :(
+    {
+      if (acc_len > 1)
+        {
+          acc [acc_ctr] := acc [acc_len - 1];
+                      acc_len := acc_len - 1;
+          -- no need in acc_ctr := acc_ctr + 1;
+        }
+    }
+            }
+          else
+      {
+        acc [acc_ctr] := full_id;
+              acc_ctr := acc_ctr + 1;
+            }
+  }
+    }
+  if (acc_len < length (acc)) -- There were collisions in the air
+    {
+      acc := subseq (acc, 0, acc_len);
+    }
+  -- dbg_obj_princ ('DynaRes_CF_GET_RDF_HITS_RES_IDS (', detcol_id, cfc_id, rfc_spath, rfc_list_cond, schema_uri, filter_data, make_diritems, auth_uid, ') returns ', acc);
+  return acc;
+}
+;
+
+create function "DynaRes_INSERT_RESOURCE" (in detcol_id integer, inout content any, in fname varchar := null,
+  in perms varchar := null, in owner_uid integer := null, in owner_gid integer := null,
+  in refresh_seconds integer := null, in ttl_seconds integer := 172800, in mime varchar := null,
+  in exec_stmt varchar := null, in exec_params any := null, in exec_uname varchar := 'nobody')
+{
+  if (refresh_seconds is not null and exec_stmt is null)
+    signal ('DR001', 'Can not refresh a resource without some statement specified to execute');
+  if ((exec_uname <> USER) and (USER <> 'dba'))
+    signal ('DR002', 'Only dba can set UID of other user for refreshing statement of a dynamic resource');
+  if (refresh_seconds is not null and refresh_seconds < 5)
+    signal ('DR003', 'The refresh interfal should be not less than 5 seconds');
+  if (ttl_seconds is not null and ttl_seconds < 180)
+    signal ('DR004', 'The time to live interfal should be not less than 180 seconds');
+  if (exec_stmt is null and content is null)
+    signal ('DR005', 'No content and no statement to execute, so nothing to create');
+  if (not exists (select top 1 1 from WS.WS.SYS_DAV_COL where COL_ID = detcol_id and COL_DET='DynaRes'))
+    signal ('DR006', 'The DET collection ID is not valid');
+  if (fname is not null and exists (select top 1 1 from WS.WS.DYNA_RES where DR_NAME = fname and DR_DETCOL_ID = detcol_id))
+    signal ('DR007', sprintf ('The dynamic resource "%.500s" already exists', fname));
+  if (content is null)
+    {
+      declare stat, msg varchar;
+      declare mdta, rset any;
+      stat := '00000';
+      exec (exec_stmt, stat, msg, exec_params, 1, mdta, rset);
+      if (stat <> '00000')
+        signal (stat, msg);
+      content := rset[0][0];
+      if (content is null)
+        signal ('DR007', 'No content and the statement returns NULL, so nothing to create');
+    }
+  insert replacing WS.WS.DYNA_RES (
+  DR_RES_ID,
+  DR_DETCOL_ID,
+  DR_NAME,
+  DR_PERMS,
+  DR_OWNER_UID,
+  DR_OWNER_GID,
+  DR_CREATED_DT,
+  DR_MODIFIED_DT,
+  DR_REFRESH_DT,
+  DR_DELETE_DT,
+  DR_REFRESH_SECONDS,
+  DR_MIME,
+  DR_EXEC_STMT,
+  DR_EXEC_PARAMS,
+  DR_EXEC_UNAME,
+  DR_LAST_LENGTH,
+  DR_CONTENT)
+values (
+  sequence_next ('WS.WS.DYNA_RES_ID'),
+  detcol_id,
+  coalesce (fname, sprintf ('%.100s - untitled resource - made by %.100s', cast (now() as varchar), USER)),
+  coalesce (perms, '110000000N'),
+  coalesce (owner_uid, http_dav_uid()),
+  coalesce (owner_gid, http_nogroup_gid()),
+  now(),
+  now(),
+  case when (refresh_seconds is null) then null else dateadd ('second', refresh_seconds, now()) end,
+  case when (ttl_seconds is null) then null else dateadd ('second', ttl_seconds, now()) end,
+  refresh_seconds,
+  coalesce (mime, 'text/plain'),
+  exec_stmt,
+  serialize (exec_params),
+  exec_uname,
+  length (content),
+  content );
+}
+;
diff --git a/binsrc/dav/DET_ResFilter.sql b/binsrc/dav/DET_ResFilter.sql
index aca107e..8bb8d94 100644
--- a/binsrc/dav/DET_ResFilter.sql
+++ b/binsrc/dav/DET_ResFilter.sql
@@ -1,5 +1,5 @@
 --
---  $Id: DET_ResFilter.sql,v 1.1 2007/03/26 14:47:01 source Exp $
+--  $Id: DET_ResFilter.sql,v 1.1.2.1 2010/12/10 15:19:38 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/binsrc/dav/Makefile.in b/binsrc/dav/Makefile.in
index 3b7d4be..4af3631 100644
--- a/binsrc/dav/Makefile.in
+++ b/binsrc/dav/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/dav/dav.sql b/binsrc/dav/dav.sql
index 266f6ab..805f88c 100644
--- a/binsrc/dav/dav.sql
+++ b/binsrc/dav/dav.sql
@@ -1,5 +1,5 @@
 --
---  $Id: dav.sql,v 1.20.2.6 2010/06/25 11:16:07 source Exp $
+--  $Id: dav.sql,v 1.20.2.10 2011/03/08 13:39:20 source Exp $
 --
 --  WebDAV support.
 --
@@ -2868,6 +2868,11 @@ authenticated:
     }
 
 request_auth:
+  _u_name := null;
+  _u_password := null;
+  _uid := null;
+  _gid := null;
+  _perms := null;
   if (allow_anon)
     {
       _uid := http_nobody_uid ();
@@ -3198,8 +3203,7 @@ not_found:
   -- delete all associated url entries
   if (O.RES_FULL_PATH <> full_path)
     {
-      update WS.WS.VFS_URL set VU_ETAG = '' where concat ('/DAV/', VU_ROOT, VU_URL) = O.RES_FULL_PATH;
---      delete from WS.WS.VFS_QUEUE where concat ('/DAV/', VQ_ROOT, VQ_URL) = O.RES_FULL_PATH;
+      update WS.WS.VFS_URL set VU_ETAG = '' where VU_RES_ID = O.RES_ID;
     }
   -- end of urls removal
   WS.WS.DAV_VSP_DEF_REMOVE (O.RES_FULL_PATH);
@@ -3357,8 +3361,6 @@ nfg:;
       repl_text (pub, '"DB.DBA.DAV_COL_D" (?, 1)', old_col_path);
     }
 -- END REPLICATION
--- WebRobot URLs update
-  update WS.WS.VFS_URL set VU_ETAG = '' where substring (concat ('/DAV/', VU_ROOT, VU_URL), 1, length (old_col_path)) = old_col_path;
   WS.WS.UPDCHILD (res, full_path, _pflags, repl);
   set triggers on;
   if (ascii('R') = _pflags[9])
@@ -3386,8 +3388,12 @@ create procedure WS.WS.UPDCHILD (in col integer, in root_path varchar, in _pflag
   declare c_cur cursor for select COL_ID, COL_NAME, COL_MOD_TIME, COL_PERMS, COL_OWNER, COL_GROUP
       from WS.WS.SYS_DAV_COL where COL_PARENT = col;
 
-  for select RES_FULL_PATH from WS.WS.SYS_DAV_RES where RES_COL = col and RES_NAME like '%.vsp' do
+  for select RES_ID, RES_NAME, RES_FULL_PATH from WS.WS.SYS_DAV_RES where RES_COL = col do
     {
+      -- WebRobot URLs update
+      update WS.WS.VFS_URL set VU_ETAG = '' where VU_RES_ID = RES_ID;
+      -- drop VSPs
+      if (RES_NAME like '%.vsp')
       WS.WS.DAV_VSP_DEF_REMOVE (RES_FULL_PATH);
     }
   -- dbg_obj_princ ('WS.WS.UPDCHILD (', col, root_path, _pflags, repl, ') updates RES_FULL_PATH');
@@ -3640,15 +3646,7 @@ create trigger SYS_DAV_RES_FULL_PATH_D after delete on WS.WS.SYS_DAV_RES
     }
 -- END REPLICATION
   -- delete all associated url entries
-  update WS.WS.VFS_URL set VU_ETAG = '' where concat ('/DAV/', VU_ROOT, VU_URL) = RES_FULL_PATH;
-  delete from WS.WS.VFS_QUEUE where concat ('/DAV/', VQ_ROOT, VQ_URL) = RES_FULL_PATH;
-  if (RES_NAME = 'index.html')
-    {
-      delete from WS.WS.VFS_URL  where concat ('/DAV/', VU_ROOT, VU_URL) = WS.WS.COL_PATH (RES_COL);
-      if (not exists (select 1 from WS.WS.VFS_SITE where
-	    concat ('/DAV/', VS_ROOT, VS_URL) = WS.WS.COL_PATH (RES_COL)))
-        delete from WS.WS.VFS_QUEUE where concat ('/DAV/', VQ_ROOT, VQ_URL) = WS.WS.COL_PATH (RES_COL);
-    }
+  update WS.WS.VFS_URL set VU_ETAG = '' where VU_RES_ID = RES_ID;
   if (RES_TYPE = 'text/xsl')
     xslt_stale (concat ('virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:', RES_FULL_PATH));
   -- Properties of resource lives as it
@@ -3672,15 +3670,6 @@ create trigger SYS_DAV_COL_D before delete on WS.WS.SYS_DAV_COL order 100
       -- dbg_obj_princ ('COLL DEL: ', pub, ' -> ' ,col_path);
       repl_text (pub, '"DB.DBA.DAV_COL_D" (?, 0)', col_path);
     }
-  -- delete all associated url entries
-  if (COL_PARENT = 1)
-    {
-      update WS.WS.VFS_URL set VU_ETAG = ''  where VU_ROOT = COL_NAME;
-      delete from WS.WS.VFS_QUEUE where VQ_ROOT = COL_NAME
-	  and VQ_URL <> (select VS_URL from WS.WS.VFS_SITE where VS_ROOT = COL_NAME);
-      delete from DB.DBA.SYS_SCHEDULED_EVENT
-	  where "RIGHT"(SE_NAME, length (COL_NAME) + 2) = concat ('/', COL_NAME, ')');
-    }
   -- Properties of collection lives as it
   delete from WS.WS.SYS_DAV_PROP where PROP_TYPE = 'C' and PROP_PARENT_ID = COL_ID;
   delete from WS.WS.SYS_DAV_LOCK where LOCK_PARENT_TYPE = 'C' and LOCK_PARENT_ID = COL_ID;
diff --git a/binsrc/dav/dav_api.sql b/binsrc/dav/dav_api.sql
index d8f6f28..d4f7ec8 100644
--- a/binsrc/dav/dav_api.sql
+++ b/binsrc/dav/dav_api.sql
@@ -1,5 +1,5 @@
 --
---  $Id: dav_api.sql,v 1.17.2.13 2010/07/05 14:58:08 source Exp $
+--  $Id: dav_api.sql,v 1.17.2.23 2010/12/10 15:18:16 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -1538,7 +1538,7 @@ DAV_AUTHENTICATE (in id any, in what char(1), in req varchar, in a_uname varchar
 
   if (a_uid < 0)
   {
-    if (DAV_AUTHENTICATE_SSL_CONDITION (id, what))
+    if (DAV_AUTHENTICATE_SSL_CONDITION ())
       goto _check_ssl;
 
     return a_uid;
@@ -1609,20 +1609,12 @@ DAV_AUTHENTICATE (in id any, in what char(1), in req varchar, in a_uname varchar
     -- dbg_obj_princ ('WS.WS.ACL_IS_GRANTED (', pacl, oid, DAV_REQ_CHARS_TO_BITMASK (req), ') returns nonzero, DAV_AUTHENTICATE returns', a_uid);
     return a_uid;
   }
-  if (DAV_AUTHENTICATE_SSL_CONDITION (id, what))
+  if (DAV_AUTHENTICATE_SSL_CONDITION ())
   {
   _check_ssl:
-    declare _perms, _res_full_path varchar;
-    declare a_gid, _res_id int;
+    declare _perms, a_gid any;
 
-    _res_id := id;
-    _res_full_path := DAV_SEARCH_PATH (_res_id, what);
-    if (isstring (_res_full_path) and _res_full_path like '%,acl')
-    {
-      _res_full_path := regexp_replace (_res_full_path, ',acl\x24', '');
-      _res_id := DAV_SEARCH_ID (_res_full_path, what);
-    }
-    if (DAV_AUTHENTICATE_SSL (_res_id, what, _res_full_path, req, a_uid, a_gid, _perms))
+    if (DAV_AUTHENTICATE_SSL (id, what, null, req, a_uid, a_gid, _perms))
       return a_uid;
   }
 
@@ -1643,6 +1635,7 @@ DAV_AUTHENTICATE_HTTP (in id any, in what char(1), in req varchar, in can_write_
   declare u_password, pperms, resName, resPath varchar;
   declare allow_anon integer;
   declare pacl varbinary;
+
   what := upper (what);
   -- dbg_obj_princ ('DAV_AUTHENTICATE_HTTP (', id, what, req, can_write_http, a_lines, a_uname, a_pwd, a_uid, a_gid, _perms, ')');
 
@@ -1691,21 +1684,10 @@ DAV_AUTHENTICATE_HTTP (in id any, in what char(1), in req varchar, in can_write_
       rc := WS.WS.GET_DAV_AUTH (a_lines, allow_anon, can_write_http, a_uname, u_password, a_uid, a_gid, _perms);
       if (rc < 0)
       {
-        declare _res_full_path varchar;
-        declare _res_id int;
-        -- dbg_obj_princ ('DAV_AUTHENTICATE_HTTP returns ', rc, ' (after WS.WS.GET_DAV_AUTH (', a_lines, allow_anon, can_write_http, a_uname, u_password, a_uid, a_gid, _perms, ')');
-        if (isstring (resPath) and resPath like '%,acl')
-        {
-          _res_full_path := regexp_replace (resPath, ',acl\x24', '');
-          _res_id := DAV_SEARCH_ID (_res_full_path, what);
-        }
-        else
-        {
-          _res_full_path := resPath;
-          _res_id := id;
-        }
-        if (DAV_AUTHENTICATE_SSL (_res_id, what, _res_full_path, req, a_uid, a_gid, _perms))
+        if (DAV_AUTHENTICATE_SSL (id, what, null, req, a_uid, a_gid, _perms))
           return a_uid;
+
+          return rc;	
       }
     }
   }
@@ -1759,30 +1741,47 @@ nf_col_or_res:
 ;
 
 create function
-DAV_AUTHENTICATE_SSL_CONDITION (in id any, in what char(1)) returns integer
+DAV_AUTHENTICATE_SSL_ITEM (
+  inout id any,
+  inout what char(1),
+  inout path varchar) returns integer
 {
-  if (is_https_ctx () and what = 'R' and
-      __proc_exists (fix_identifier_case ('sioc.DBA.dav_res_iri')) is not null and
-      exists (select 1 from WS.WS.SYS_DAV_PROP where PROP_PARENT_ID = id and PROP_TYPE = what and PROP_NAME = 'virt:aci_meta_n3'))
+  declare pos integer;
+
+  if (isnull (path))
+    path := DAV_SEARCH_PATH (id, what);
+
+  if (isstring (path) and path like '%,acl')
   {
-    return 1;
+    path := regexp_replace (path, ',acl\x24', '');
+    pos := strrchr (path, '/');
+    if (not isnull (pos))
+      what := 'C';
+    id := DAV_SEARCH_ID (path, what);
   }
-  return 0;
 }
 ;
 
 create function
-DAV_AUTHENTICATE_SSL (in id any, in what char(1), in path varchar, in req varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer
+DAV_AUTHENTICATE_SSL_CONDITION () returns integer
 {
-  declare rc integer;
+  if (is_https_ctx () and (__proc_exists ('SIOC.DBA.get_graph') is not null))
+    return 1;
 
-  rc := 0;
-  if (not DAV_AUTHENTICATE_SSL_CONDITION (id, what))
-    goto _exit;
+  return 0;
+}
+;
 
-  declare graph, foafIRI, foafGraph, loadIRI, localIRI any;
+create function
+DAV_AUTHENTICATE_SSL_WEBID ()
+{
+  declare retIRI varchar;
+  declare graph, baseGraph, foafIRI, foafGraph, loadIRI, localIRI any;
   declare S, V, info, st, msg, data, meta any;
 
+  retIRI := null;
+
+  set_user_id ('dba');
   foafIRI := trim (get_certificate_info (7, null, null, null, '2.5.29.17'));
   V := regexp_replace (foafIRI, ',[ ]*', ',', 1, null);
   V := split_and_decode (V, 0, '\0\0,:');
@@ -1790,10 +1789,21 @@ DAV_AUTHENTICATE_SSL (in id any, in what char(1), in path varchar, in req varcha
     V := vector ();
   foafIRI := get_keyword ('URI', V);
   if (isnull (foafIRI))
-    goto _exit;
-
-  set_user_id ('dba');
-
+    {
+      if (__proc_exists ('DB.DBA.FOAF_SSL_WEBFINGER') is not null)
+	{
+	    retIRI := DB.DBA.FOAF_SSL_WEBFINGER ();
+	    if (not isnull (retIRI))
+	      goto _exit;
+	}
+      if (__proc_exists ('ODS.DBA.FINGERPOINT_WEBID_GET') is not null)
+	{
+	    retIRI := ODS.DBA.FINGERPOINT_WEBID_GET ();
+	    if (not isnull (retIRI))
+	goto _exit;
+    }
+  } else {
+    foafGraph := 'http://local.virt/FOAF/' || cast (rnd (1000) as varchar);
   localIRI := foafIRI;
   V := rfc1808_parse_uri (localIRI);
   if (is_https_ctx () and
@@ -1807,14 +1817,11 @@ DAV_AUTHENTICATE_SSL (in id any, in what char(1), in path varchar, in req varcha
   V := rfc1808_parse_uri (foafIRI);
   V[5] := '';
   loadIRI := DB.DBA.vspx_uri_compose (V);
-  foafGraph := 'http://local.virt/FOAF/' || cast (rnd (1000) as varchar);
   S := sprintf ('sparql load <%s> into graph <%s>', loadIRI, foafGraph);
   st := '00000';
   exec (S, st, msg, vector (), 0);
-  if (st <> '00000')
-    goto _exit;
-
-  info := get_certificate_info (9);
+    if (st = '00000')
+    {
   S := sprintf (' sparql define input:storage "" ' ||
                 ' prefix cert: <http://www.w3.org/ns/auth/cert#> ' ||
                 ' prefix rsa: <http://www.w3.org/ns/auth/rsa#> ' ||
@@ -1831,82 +1838,168 @@ DAV_AUTHENTICATE_SSL (in id any, in what char(1), in path varchar, in req varcha
                 foafGraph,
                 localIRI);
   exec (S, st, msg, vector (), 0, meta, data);
-  if (st <> '00000' or length (data) = 0)
-    goto _exit;
-
+      if (st = '00000')
+      {
+        info := get_certificate_info (9);
   foreach (any _row in data) do
   {
     if (_row[0] = cast (info[1] as varchar) and
         lower (regexp_replace (_row[1], '[^A-Z0-9a-f]', '', 1, null)) = bin2hex (info[2]))
     {
-      declare resMode varchar;
-
-      graph := SIOC.DBA.dav_res_iri (path);
-      --dbg_obj_print ('graph', graph);
-      resMode := '';
-      if (req[2] = ascii ('1'))
-        resMode := 'Control';
-      else if (req[1] = ascii ('1'))
-        resMode := 'Write';
-      else if (req[0] = ascii ('1'))
-        resMode := 'Read';
-
-      S := sprintf (' sparql \n' ||
-        ' define input:storage "" \n' ||
-        ' prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n' ||
-        ' prefix foaf: <http://xmlns.com/foaf/0.1/> \n' ||
-        ' prefix acl: <http://www.w3.org/ns/auth/acl#> \n' ||
-        ' select * \n' ||
-        '   from <%s> \n' ||
-        '  where { \n' ||
-        '          { \n' ||
-        '            ?rule rdf:type acl:Authorization ; \n' ||
-        '                  acl:accessTo <%s> ; \n' ||
-        '                  acl:mode acl:%s ; \n' ||
-        '                  acl:agent <%s>. \n' ||
-        '          } \n' ||
-        '          union \n' ||
-        '          { \n' ||
-        '            ?rule rdf:type acl:Authorization ; \n' ||
-        '                  acl:accessTo <%s> ; \n' ||
-        '                  acl:mode acl:%s ; \n' ||
-        '                  acl:agentClass foaf:Agent. \n' ||
-        '          } \n' ||
-        '          union \n' ||
-        '          { \n' ||
-        '            ?rule rdf:type acl:Authorization ; \n' ||
-        '                  acl:accessTo <%s> ; \n' ||
-        '                  acl:mode acl:%s ; \n' ||
-        '                  acl:agentClass ?group. \n' ||
-        '                  ?group rdf:type foaf:Group ; \n' ||
-        '                  foaf:member <%s>. \n' ||
-        '          } \n' ||
-        '        }\n',
-        graph,
-        graph,
-        resMode,
-        foafIRI,
-        graph,
-        resMode,
-        graph,
-        resMode,
-        foafIRI);
-      commit work;
-      exec (S, st, msg, vector (), 0, meta, data);
-      if (st = '00000' and length (data))
+            retIRI := foafIRI;
+            goto _break;
+          }
+        }
+      }
+    }
+  _break:;
+    exec (sprintf ('SPARQL clear graph <%s>', foafGraph), st, msg, vector (), 0);
+  }
+_exit:
+  return retIRI;
+}
+;
+
+create function
+DAV_AUTHENTICATE_SSL (
+  in id any,
+  in what char(1),
+  in path varchar,
+  in req varchar,
+  inout a_uid integer,
+  inout a_gid integer,
+  inout _perms varchar) returns integer
+{
+  declare rc, M, N, L, I integer;
+  declare graph, grpGraph, foafIRI, reqMode, realMode, IRIs any;
+  declare tmp, T, V, S, st, msg, meta, row, rows any;
+
+  rc := 0;
+  req := replace (req, '_', '0');
+  reqMode := vector (req[0]-48, req[1]-48, req[2]-48);
+  realMode := vector (0, 0, 0);
+  IRIs := vector (vector(), vector(), vector());
+  DAV_AUTHENTICATE_SSL_ITEM (id, what, path);
+  if (not DAV_AUTHENTICATE_SSL_CONDITION ())
+    goto _exit;
+
+  set_user_id ('dba');
+  foafIRI := DAV_AUTHENTICATE_SSL_WEBID ();
+  if (isnull (foafIRI))
+    goto _exit;
+
+  tmp := '/';
+  V := vector ();
+  T := split_and_decode (trim (path, '/'), 0, '\0\0/');
+  for (N := 0; N < length (T)-1; N := N + 1)
+  {
+    tmp := tmp || T[N] || '/';
+    V := vector_concat (vector (tmp), V);
+  }
+  V := vector_concat (vector (path), V);
+  grpGraph := SIOC.DBA.get_graph () || '/private/%';
+  for (N := 0; N < length (V); N := N + 1)
+  {
+    if (N <> 0)
+    {
+      what := 'C';
+      id := DAV_SEARCH_ID (V[N], what);
+    }
+    if (exists (select 1 from WS.WS.SYS_DAV_PROP where PROP_PARENT_ID = id and PROP_TYPE = what and PROP_NAME = 'virt:aci_meta_n3'))
+    {
+      tmp := null;
+      graph := WS.WS.DAV_IRI (V[N]);
+      for (
+        sparql
+        define input:storage ""
+        prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+        prefix foaf: <http://xmlns.com/foaf/0.1/>
+        prefix acl: <http://www.w3.org/ns/auth/acl#>
+        select ?p1 ?p2 ?p3 ?mode
+         where {
+                 {
+                   graph `iri(?:graph)`
+                   {
+                     ?rule rdf:type acl:Authorization ;
+                           acl:accessTo `iri(?:graph)` ;
+                           acl:mode ?mode ;
+                           acl:agent `iri(?:foafIRI)` ;
+                           acl:agent ?p1 .
+                   }
+                 }
+                 union
+                 {
+                   graph `iri(?:graph)`
+                   {
+                     ?rule rdf:type acl:Authorization ;
+                           acl:accessTo `iri(?:graph)` ;
+                           acl:mode ?mode ;
+                           acl:agentClass foaf:Agent ;
+                           acl:agentClass ?p2 .
+                   }
+                 }
+                 union
+                 {
+                   graph `iri(?:graph)`
+                   {
+                     ?rule rdf:type acl:Authorization ;
+                           acl:accessTo `iri(?:graph)` ;
+                           acl:mode ?mode ;
+                           acl:agentClass ?p3 .
+                   }
+                   graph ?g
+                   {
+                     ?p3 rdf:type foaf:Group ;
+                         foaf:member `iri(?:foafIRI)` .
+                     filter (?g like (?:grpGraph)) .
+                   }
+                 }
+               }
+         order by ?p3 ?p2 ?p1 ?mode) do
+      {
+        if      (not isnull (p1))
+          I := 0;
+        else if (not isnull (p2))
+          I := 1;
+        else if (not isnull (p3))
+          I := 2;
+        else
+          goto _skip;
+
+        if (tmp <> coalesce (p1, coalesce (p2, p3)))
+        {
+          tmp := coalesce (p1, coalesce (p2, p3));
+          for (M := 0; M < length (IRIs[I]); M := M + 1)
+          {
+            if (tmp = IRIs[I][M])
+              goto _skip;
+          }
+        }
+
+        if      (mode like '%#Read')
+          realMode[0] := 1;
+        else if (mode like '%#Write')
+          realMode[1] := 1;
+        else if (mode like '%#Control')
+          realMode[2] := 1;
+
+        if ((reqMode[0] <= realMode[0]) and (reqMode[1] <= realMode[1]) and (reqMode[2] <= realMode[2]))
       {
         a_uid := http_nobody_uid ();
         a_gid := http_nogroup_gid ();
-        _perms := req || req || '--';
         rc := 1;
-        goto _break;
+          goto _exit;
+        }
+        IRIs[I] := vector_concat (IRIs[I], vector (tmp));
+
+      _skip:;
       }
     }
   }
-_break:;
-  exec (sprintf ('SPARQL clear graph <%s>', foafGraph), st, msg, vector (), 0);
 
 _exit:;
+  _perms := replace (sprintf ('%d%d%d', realMode[0], realMode[1], realMode[2]), '0', '_');
+  -- dbg_obj_print ('DAV_AUTHENTICATE_SSL:', rc, req, _perms);
   return rc;
 }
 ;
@@ -2091,6 +2184,36 @@ DAV_RES_UPLOAD_STRSES_INT (
     in check_locks any := 1 -- must be here to match arg order for DAV replication.
     )
 {
+  declare rc, old_log_mode, new_log_mode any;
+  old_log_mode := log_enable (null);
+  -- we disable row auto commit since there are triggers reading blobs, we do that even in atomic mode since this is vital for dav uploads
+  new_log_mode := bit_and (old_log_mode, 1);
+  old_log_mode := log_enable (bit_or (new_log_mode, 4), 1);
+  rc := DAV_RES_UPLOAD_STRSES_INT_INNER (path, content, type, permissions, uid, gid, auth_uname, auth_pwd, extern, cr_time, mod_time, _rowguid, ouid, ogid, check_locks);
+  log_enable (bit_or (old_log_mode, 4), 1);
+  return rc;
+}
+;
+
+create procedure
+DAV_RES_UPLOAD_STRSES_INT_INNER (
+    in path varchar,
+    inout content any,
+    in type varchar := '',
+    in permissions varchar := '110100000RR',
+    in uid any := 'dav',
+    in gid any := 'administrators',
+    in auth_uname varchar := null,
+    in auth_pwd varchar := null,
+    in extern integer := 1,
+    in cr_time datetime := null,
+    in mod_time datetime := null,
+    in _rowguid varchar := null,
+    in ouid integer := null,
+    in ogid integer := null,
+    in check_locks any := 1 -- must be here to match arg order for DAV replication.
+    )
+{
   declare auth_uid, pid, puid, pgid, rc, id integer;
   declare pperms, name varchar;
   declare par any;
@@ -3425,6 +3548,29 @@ DAV_PROP_SET_RAW (
     in auto_version varchar:=NULL
 ) returns integer
 {
+  declare rc, old_log_mode, new_log_mode any;
+  old_log_mode := log_enable (null);
+  -- we disable row auto commit since there are triggers reading blobs, we do that even in atomic mode since this is vital for dav uploads
+  new_log_mode := bit_and (old_log_mode, 1);
+  old_log_mode := log_enable (bit_or (new_log_mode, 4), 1);
+  rc := DAV_PROP_SET_RAW_INNER (id, st, propname, propvalue, overwrite, auth_uid, locked, auto_version);
+  log_enable (bit_or (old_log_mode, 4), 1);
+  return rc;
+}
+;
+
+create function
+DAV_PROP_SET_RAW_INNER (
+    inout id integer,
+    in st char(0),
+    inout propname varchar,
+    inout propvalue any,
+    in overwrite integer,
+    in auth_uid integer,
+    in locked int:=0,
+    in auto_version varchar:=NULL
+) returns integer
+{
   declare pid integer;
   declare resv any;
   declare can_patch_access integer;
@@ -4223,6 +4369,44 @@ create function DAV_COL_PATH_BOUNDARY (in path varchar) returns varchar
 
 -- Web Access Control
 --
+create trigger SYS_DAV_COL_WAC_U after update on WS.WS.SYS_DAV_COL order 100 referencing new as N, old as O
+{
+  declare aciContent, oldPath, newPath, update_acl any;
+
+  if (connection_get ('dav_acl_sync') = 1)
+    return;
+
+  if ((O.COL_NAME = N.COL_NAME) and (O.COL_PARENT = N.COL_PARENT))
+    return;
+
+  aciContent := (select PROP_VALUE from WS.WS.SYS_DAV_PROP where PROP_PARENT_ID = N.COL_ID and PROP_TYPE = 'C' and PROP_NAME = 'virt:aci_meta_n3');
+  if (aciContent is null)
+    return;
+
+  oldPath := WS.WS.COL_PATH (O.COL_PARENT) || O.COL_NAME || '/';
+  newPath := WS.WS.COL_PATH (N.COL_PARENT) || N.COL_NAME || '/';
+  update_acl := 1;
+
+  WS.WS.WAC_DELETE (oldPath, update_acl);
+  WS.WS.WAC_INSERT (newPath, aciContent, N.COL_OWNER, N.COL_GROUP, update_acl);
+}
+;
+
+create trigger SYS_DAV_COL_WAC_D after delete on WS.WS.SYS_DAV_COL order 100 referencing old as O
+{
+  declare update_acl integer;
+  declare path varchar;
+
+  if (connection_get ('dav_acl_sync') = 1)
+    return;
+
+  path := WS.WS.COL_PATH (O.COL_ID);
+  update_acl := 1;
+
+  WS.WS.WAC_DELETE (path, update_acl);
+}
+;
+
 create trigger SYS_DAV_RES_WAC_U after update on WS.WS.SYS_DAV_RES order 100 referencing new as N, old as O
 {
   declare aciContent, oldPath, newPath, update_acl any;
@@ -4281,335 +4465,339 @@ create trigger SYS_DAV_RES_WAC_D after delete on WS.WS.SYS_DAV_RES order 100 ref
 
 create trigger SYS_DAV_PROP_WAC_I after insert on WS.WS.SYS_DAV_PROP order 100 referencing new as N
 {
-  if ((N.PROP_TYPE <> 'R') or (N.PROP_NAME <> 'virt:aci_meta_n3'))
+  if (N.PROP_NAME <> 'virt:aci_meta_n3')
     return;
 
-  declare resPath any;
-  for select RES_FULL_PATH, RES_OWNER, RES_GROUP from WS.WS.SYS_DAV_RES where RES_ID = N.PROP_PARENT_ID do
-    WS.WS.WAC_INSERT (RES_FULL_PATH, N.PROP_VALUE, RES_OWNER, RES_GROUP, 1);
+  declare _path, _owner, _group any;
+  declare exit handler for not found { return; };
+
+  if (N.PROP_TYPE = 'R')
+  {
+    select RES_FULL_PATH, RES_OWNER, RES_GROUP
+      into _path, _owner, _group
+      from WS.WS.SYS_DAV_RES
+     where RES_ID = N.PROP_PARENT_ID;
+  } else {
+    select DAV_SEARCH_PATH (COL_ID, N.PROP_TYPE), COL_OWNER, COL_GROUP
+      into _path, _owner, _group
+      from WS.WS.SYS_DAV_COL
+     where COL_ID = N.PROP_PARENT_ID;
+  }
+  WS.WS.WAC_INSERT (_path, N.PROP_VALUE, _owner, _group, 1);
 }
 ;
 
-create trigger SYS_DAV_PROP_WAC_U after update on WS.WS.SYS_DAV_PROP order 100 referencing new as N, old as O
+create trigger SYS_DAV_PROP_WAC_U after update (PROP_NAME, PROP_VALUE) on WS.WS.SYS_DAV_PROP order 100 referencing new as N, old as O
 {
-  if ((N.PROP_TYPE <> 'R') or (N.PROP_NAME <> 'virt:aci_meta_n3'))
+  if (N.PROP_NAME <> 'virt:aci_meta_n3')
     return;
 
-  declare resPath any;
-  for select RES_FULL_PATH, RES_OWNER, RES_GROUP from WS.WS.SYS_DAV_RES where RES_ID = N.PROP_PARENT_ID do
+  declare _path, _owner, _group any;
+  declare exit handler for not found { return; };
+
+  if (N.PROP_TYPE = 'R')
     {
-      WS.WS.WAC_DELETE (RES_FULL_PATH, 1);
-      WS.WS.WAC_INSERT (RES_FULL_PATH, N.PROP_VALUE, RES_OWNER, RES_GROUP, 1);
+    select RES_FULL_PATH, RES_OWNER, RES_GROUP
+      into _path, _owner, _group
+      from WS.WS.SYS_DAV_RES
+     where RES_ID = N.PROP_PARENT_ID;
+  } else {
+    select DAV_SEARCH_PATH (COL_ID, N.PROP_TYPE), COL_OWNER, COL_GROUP
+      into _path, _owner, _group
+      from WS.WS.SYS_DAV_COL
+     where COL_ID = N.PROP_PARENT_ID;
     }
+  WS.WS.WAC_DELETE (_path, 1);
+  WS.WS.WAC_INSERT (_path, N.PROP_VALUE, _owner, _group, 1);
 }
 ;
 
 create trigger SYS_DAV_PROP_WAC_D after delete on WS.WS.SYS_DAV_PROP order 100 referencing old as O
 {
-  if ((O.PROP_TYPE <> 'R') or (O.PROP_NAME <> 'virt:aci_meta_n3'))
+  if (O.PROP_NAME <> 'virt:aci_meta_n3')
     return;
 
-  declare resPath any;
-  for select RES_FULL_PATH from WS.WS.SYS_DAV_RES where RES_ID = O.PROP_PARENT_ID do
-    WS.WS.WAC_DELETE (RES_FULL_PATH, 1);
+  declare _path any;
+  declare exit handler for not found { return; };
+
+  if (O.PROP_TYPE = 'R')
+  {
+    select RES_FULL_PATH
+      into _path
+      from WS.WS.SYS_DAV_RES
+     where RES_ID = O.PROP_PARENT_ID;
+  } else {
+    select DAV_SEARCH_PATH (COL_ID, O.PROP_TYPE)
+      into _path
+      from WS.WS.SYS_DAV_COL
+     where COL_ID = O.PROP_PARENT_ID;
+  }
+  WS.WS.WAC_DELETE (_path, 1);
 }
 ;
 
-create procedure WS.WS.WAC_INSERT (in resPath varchar, in aciContent any, in uid int, in gid int, in update_acl int)
+create procedure WS.WS.WAC_INSERT (
+  in path varchar,
+  in aciContent any,
+  in uid integer,
+  in gid integer,
+  in update_acl integer)
 {
-  declare graph, waGraph varchar;
-
-  if (
-      length (aciContent) = 0 or
-      __proc_exists (fix_identifier_case ('sioc.DBA.dav_res_iri')) is null or
-      __proc_exists (fix_identifier_case ('sioc.DBA.waGraph')) is null
-     )
-    return;
+  --dbg_obj_print ('WAC_INSERT', path);
+  declare graph varchar;
 
-  graph := SIOC.DBA.dav_res_iri (resPath);
-  waGraph := sprintf ('http://%s/webdav/webaccess', SIOC.DBA.get_cname ());
-  {
-    declare continue handler for SQLSTATE '*'
-    {
-      dbg_obj_print('', __SQL_STATE, __SQL_MESSAGE);
-      return;
-    };
+  graph := WS.WS.DAV_IRI (path);
     aciContent := cast (blob_to_string (aciContent) as varchar);
     if (update_acl)
     {
       connection_set ('dav_acl_sync', 1);
-      DAV_RES_UPLOAD_STRSES_INT (resPath || ',acl', aciContent, 'text/n3', '110100000RR', uid, gid, null, null, 0);
+    DAV_RES_UPLOAD_STRSES_INT (rtrim (path, '/') || ',acl', aciContent, 'text/n3', '110100000RR', uid, gid, null, null, 0);
       connection_set ('dav_acl_sync', null);
     }
     DB.DBA.TTLP (aciContent, graph, graph);
-    DB.DBA.RDF_GRAPH_GROUP_CREATE (waGraph, 1);
-    DB.DBA.RDF_GRAPH_GROUP_INS (waGraph, graph);
-  }
 }
 ;
 
-create procedure WS.WS.WAC_DELETE (in resPath varchar, in update_acl int)
+create procedure WS.WS.WAC_DELETE (
+  in path varchar,
+  in update_acl integer)
 {
-  declare graph, waGraph, st, msg varchar;
+  --dbg_obj_print ('WAC_DELETE', path);
+  declare graph, st, msg varchar;
 
-  if (__proc_exists (fix_identifier_case ('sioc.DBA.dav_res_iri')) is null or
-      __proc_exists (fix_identifier_case ('sioc.DBA.waGraph')) is null
-     )
-    return;
+  graph := WS.WS.DAV_IRI (path);
+    if (update_acl)
+    {
+      connection_set ('dav_acl_sync', 1);
+    DAV_DELETE_INT (rtrim (path, '/') || ',acl', 1, null, null, 0, 0);
+      connection_set ('dav_acl_sync', null);
+    }
+  exec (sprintf ('sparql clear graph <%s>', graph), st, msg);
+  }
+;
+
+create procedure WS.WS.DAV_IRI (
+  in path varchar)
+{
+  declare S, host any;
 
-  if (update_acl)
+  S := string_output ();
+  http_dav_url (path, null, S);
+  S := string_output_string (S);
+
+  host := cfg_item_value (virtuoso_ini_path (), 'URIQA', 'DefaultHost');
+  if (host is null)
   {
-    connection_set ('dav_acl_sync', 1);
-    DAV_DELETE_INT (resPath || ',acl', 1, null, null, 0, 0);
-    connection_set ('dav_acl_sync', null);
+    host := sys_stat ('st_host_name');
+    if (server_http_port () <> '80')
+      host := host ||':'|| server_http_port ();
   }
-  graph := SIOC.DBA.dav_res_iri (resPath);
-  waGraph := sprintf ('http://%s/webdav/webaccess', SIOC.DBA.get_cname ());
-  exec (sprintf ('sparql clear graph <%S>', graph), st, msg);
-  DB.DBA.RDF_GRAPH_GROUP_DEL (waGraph, graph);
+
+  return sprintf ('http://%s%s', host, S);
 }
 ;
 
 -- ACL - WebDAV Collection
-create trigger SYS_DAV_COL_ACL_I after insert on WS.WS.SYS_DAV_COL order 10 referencing new as NC
-{
-  declare
-    N,
-    colID,
-    parentID integer;
-  declare
-    aAcl,
-    aParentAcl any;
+create trigger SYS_DAV_COL_ACL_I after insert on WS.WS.SYS_DAV_COL order 9 referencing new as NC
+{
+  declare N, colID, parentID integer;
+  declare aAcl, aParentAcl any;
+
   -- dbg_obj_princ ('trigger SYS_DAV_COL_ACL_I (', NC.COL_ID, ')');
   aAcl := WS.WS.ACL_PARSE(NC.COL_ACL, '01', 0);
-  N := 0;
-  while (N < length(aAcl))
+  foreach (any acl in aAcl) do
   {
-    insert replacing
-      WS.WS.SYS_DAV_ACL_INVERSE(AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)
-      values(either(equ(aAcl[N][1],0), 'R', 'G'), NC.COL_ID, 'C', aAcl[N][0]);
-
-    N := N + 1;
+    insert replacing WS.WS.SYS_DAV_ACL_INVERSE (AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)
+      values (either(equ(acl[1],0), 'R', 'G'), NC.COL_ID, 'C', acl[0]);
   }
 
-  colID := NC.COL_ID;
-  parentID := NC.COL_PARENT;
+  aParentAcl := (select WS.WS.ACL_PARSE (COL_ACL, '123', 0) from WS.WS.SYS_DAV_COL c where c.COL_ID = NC.COL_PARENT);
+  if (isnull(aParentAcl))
+    return;
+
   aAcl := WS.WS.ACL_PARSE(NC.COL_ACL, '012', 0);
-  aParentAcl := (select WS.WS.ACL_PARSE(COL_ACL, '123', 0) from WS.WS.SYS_DAV_COL c where c.COL_ID = parentID);
-  if (not isnull(aParentAcl))
-  {
     set triggers off;
-    update
-      WS.WS.SYS_DAV_COL c
-    set
-      COL_ACL = WS.WS.ACL_COMPOSE(vector_concat(aAcl, WS.WS.ACL_MAKE_INHERITED(aParentAcl)))
-    where
-      c.COL_ID = colID;
-  }
+  update WS.WS.SYS_DAV_COL
+     set COL_ACL = WS.WS.ACL_COMPOSE (vector_concat (aAcl, WS.WS.ACL_MAKE_INHERITED(aParentAcl)))
+   where COL_ID = NC.COL_ID;
   -- dbg_obj_princ ('trigger SYS_DAV_COL_ACL_I (', NC.COL_ID, ') done');
 }
 ;
 
-create function WS.WS.ACL_CONTAINS_GRANTEE_AND_FLAG (inout acl any, in grantee integer, in flag char(1)) returns integer
+create function WS.WS.ACL_CONTAINS_GRANTEE_AND_FLAG (inout aAcl any, in grantee integer, in flag char(1)) returns integer
 {
-  declare N integer;
-  N := length (acl);
-  while (N > 0)
+  foreach (any acl in aAcl) do
     {
-      N := N - 1;
-      if ((grantee = acl[N][0]) and (flag = either(equ(acl[N][1],0), 'R', 'G')))
+    if ((grantee = acl[0]) and (flag = either(equ(acl[1],0), 'R', 'G')))
         return 1;
     }
   return 0;
 }
 ;
 
-create trigger SYS_DAV_COL_ACL_U after update on WS.WS.SYS_DAV_COL order 10 referencing new as NC
+create trigger SYS_DAV_COL_ACL_U after update (COL_ACL) on WS.WS.SYS_DAV_COL order 9 referencing new as N, old as O
 {
-  declare
-    N,
-    aiGrantee integer;
-  declare
-    aiFlag varchar;
-  declare
-    aAcl any;
-  -- dbg_obj_princ ('trigger SYS_DAV_COL_ACL_U (', NC.COL_ID, ')');
-  aAcl := WS.WS.ACL_PARSE(NC.COL_ACL, '01', 0);
+  declare aAcl, aLog any;
+  -- dbg_obj_princ (now(), 'trigger SYS_DAV_COL_ACL_U (', N.COL_ID, ')');
 
-  delete from WS.WS.SYS_DAV_ACL_INVERSE
-    where AI_PARENT_ID = NC.COL_ID
+  aAcl := WS.WS.ACL_PARSE (O.COL_ACL, '01', 0);
+  delete
+    from WS.WS.SYS_DAV_ACL_INVERSE
+   where AI_PARENT_ID = O.COL_ID
       and AI_PARENT_TYPE = 'C'
       and not WS.WS.ACL_CONTAINS_GRANTEE_AND_FLAG (aAcl, AI_GRANTEE_ID, AI_FLAG);
 
-  N := 0;
-  while (N < length(aAcl))
+  aAcl := WS.WS.ACL_PARSE (N.COL_ACL, '01', 0);
+  foreach (any acl in aAcl) do
   {
-    insert replacing
-      WS.WS.SYS_DAV_ACL_INVERSE(AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)
-      values(either(equ(aAcl[N][1],0), 'R', 'G'), NC.COL_ID, 'C', aAcl[N][0]);
-    N := N + 1;
+    insert replacing WS.WS.SYS_DAV_ACL_INVERSE (AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)
+      values (either (equ (acl[1], 0), 'R', 'G'), N.COL_ID, 'C', acl[0]);
   }
 
+  declare exit handler for sqlstate '*'
+  {
+    log_enable (aLog, 1);
+    resignal;
+  };
+
   set triggers off;
-  WS.WS.ACL_UPDATE (COL_ID, WS.WS.ACL_PARSE(NC.COL_ACL, '123', 0));
-  -- dbg_obj_princ ('trigger SYS_DAV_COL_ACL_U (', NC.COL_ID, ') done');
+
+  aLog := log_enable (0, 1);
+  WS.WS.ACL_UPDATE (N.COL_ID, WS.WS.ACL_PARSE (N.COL_ACL, '123', 0));
+  log_enable (aLog, 1);
+  log_text ('WS.WS.ACL_UPDATE (?, ?)', N.COL_ID, WS.WS.ACL_PARSE (N.COL_ACL, '123', 0));
 }
 ;
 
-create trigger SYS_DAV_COL_ACL_D after delete on WS.WS.SYS_DAV_COL order 10
+create trigger SYS_DAV_COL_ACL_D after delete on WS.WS.SYS_DAV_COL order 9 referencing old as O
 {
-  -- dbg_obj_princ ('trigger SYS_DAV_COL_ACL_D (', COL_ID, ')');
-  delete from WS.WS.SYS_DAV_ACL_INVERSE where AI_PARENT_TYPE = 'C' and AI_PARENT_ID = COL_ID;
-  -- dbg_obj_princ ('trigger SYS_DAV_COL_ACL_D (', COL_ID, ') done');
+  -- dbg_obj_princ ('trigger SYS_DAV_COL_ACL_D (', O.COL_ID, ')');
+  delete
+    from WS.WS.SYS_DAV_ACL_INVERSE
+   where AI_PARENT_TYPE = 'C'
+     and AI_PARENT_ID = O.COL_ID;
+  -- dbg_obj_princ ('trigger SYS_DAV_COL_ACL_D (', O.COL_ID, ') done');
 }
 ;
 
-
 -- ACL - WebDAV Resource
 --
-create trigger SYS_DAV_RES_ACL_I after insert on WS.WS.SYS_DAV_RES order 10 referencing new as NR
-{
-  declare
-    N,
-    resID integer;
-  declare
-    aAcl any;
-  declare
-    aParentAcl varbinary;
-  -- dbg_obj_princ ('trigger SYS_DAV_RES_ACL_I (', NR.RES_ID, ')');
-
-  aAcl := WS.WS.ACL_PARSE(NR.RES_ACL, '0', 0);
-  N := 0;
-  while (N < length(aAcl))
-  {
-    insert replacing
-      WS.WS.SYS_DAV_ACL_INVERSE(AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)
-      values(either(equ(aAcl[N][1],0), 'R', 'G'), NR.RES_ID, 'R', aAcl[N][0]);
+create trigger SYS_DAV_RES_ACL_I after insert on WS.WS.SYS_DAV_RES order 9 referencing new as N
+{
+  declare aAcl any;
+  declare aParentAcl varbinary;
+  -- dbg_obj_princ ('trigger SYS_DAV_RES_ACL_I (', N.RES_ID, ')');
 
-    N := N + 1;
+  aAcl := WS.WS.ACL_PARSE (N.RES_ACL, '0', 0);
+  foreach (any acl in aAcl) do
+  {
+    insert replacing WS.WS.SYS_DAV_ACL_INVERSE (AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)
+      values (either(equ(acl[1],0), 'R', 'G'), N.RES_ID, 'R', acl[0]);
   }
 
-  resID := NR.RES_ID;
-  aParentAcl := (select WS.WS.ACL_PARSE(COL_ACL, '123', 0) from WS.WS.SYS_DAV_COL where COL_ID = NR.RES_COL);
+  aParentAcl := (select WS.WS.ACL_PARSE (COL_ACL, '123', 0) from WS.WS.SYS_DAV_COL where COL_ID = N.RES_COL);
   if (not isnull(aParentAcl))
   {
     set triggers off;
-    update
-      WS.WS.SYS_DAV_RES
-    set
-      RES_ACL = WS.WS.ACL_COMPOSE(vector_concat(aAcl, WS.WS.ACL_MAKE_INHERITED(aParentAcl)))
-    where
-      RES_ID = resID;
+    update WS.WS.SYS_DAV_RES
+       set RES_ACL = WS.WS.ACL_COMPOSE (vector_concat(aAcl, WS.WS.ACL_MAKE_INHERITED(aParentAcl)))
+     where RES_ID = N.RES_ID;
   }
-  -- dbg_obj_princ ('trigger SYS_DAV_RES_ACL_I (', NR.RES_ID, ') done');
+  -- dbg_obj_princ ('trigger SYS_DAV_RES_ACL_I (', N.RES_ID, ') done');
 }
 ;
 
-create trigger SYS_DAV_RES_ACL_U after update on WS.WS.SYS_DAV_RES order 10 referencing new as NR
+create trigger SYS_DAV_RES_ACL_U after update (RES_ACL) on WS.WS.SYS_DAV_RES order 9 referencing new as N, old as O
 {
-  declare
-    N,
-    aiGrantee integer;
-  declare
-    aiFlag varchar;
-  declare
-    aAcl any;
-  -- dbg_obj_princ ('trigger SYS_DAV_RES_ACL_U (', NR.RES_ID, ')');
+  declare aAcl any;
+  -- dbg_obj_princ ('trigger SYS_DAV_RES_ACL_U (', N.RES_ID, ')');
 
-  aAcl := WS.WS.ACL_PARSE(NR.RES_ACL, '0', 0);
-
-  delete from WS.WS.SYS_DAV_ACL_INVERSE
-    where
-      AI_PARENT_ID = NR.RES_ID
+  aAcl := WS.WS.ACL_PARSE (O.RES_ACL, '0', 0);
+  delete
+    from WS.WS.SYS_DAV_ACL_INVERSE
+   where AI_PARENT_ID = O.RES_ID
       and AI_PARENT_TYPE = 'R'
       and not WS.WS.ACL_CONTAINS_GRANTEE_AND_FLAG (aAcl, AI_GRANTEE_ID, AI_FLAG);
 
-  N := 0;
-  while (N < length(aAcl))
+  aAcl := WS.WS.ACL_PARSE (N.RES_ACL, '0', 0);
+  foreach (any acl in aAcl) do
   {
-    insert replacing
-      WS.WS.SYS_DAV_ACL_INVERSE(AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)
-      values(either(equ(aAcl[N][1],0), 'R', 'G'), NR.RES_ID, 'R', aAcl[N][0]);
-
-    N := N + 1;
+    insert replacing WS.WS.SYS_DAV_ACL_INVERSE (AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)
+      values (either (equ (acl[1],0), 'R', 'G'), N.RES_ID, 'R', acl[0]);
   }
-  -- dbg_obj_princ ('trigger SYS_DAV_RES_ACL_U (', NR.RES_ID, ') done');
+  -- dbg_obj_princ ('trigger SYS_DAV_RES_ACL_U (', N.RES_ID, ') done');
 }
 ;
 
-create trigger SYS_DAV_RES_ACL_D after delete on WS.WS.SYS_DAV_RES order 10
+create trigger SYS_DAV_RES_ACL_D after delete on WS.WS.SYS_DAV_RES order 9 referencing old as O
 {
-  -- dbg_obj_princ ('trigger SYS_DAV_RES_ACL_D (', RES_ID, ')');
-  delete from WS.WS.SYS_DAV_ACL_INVERSE where AI_PARENT_TYPE = 'R' and AI_PARENT_ID = RES_ID;
-  -- dbg_obj_princ ('trigger SYS_DAV_RES_ACL_D (', RES_ID, ') done');
+  -- dbg_obj_princ ('trigger SYS_DAV_RES_ACL_D (', O.RES_ID, ')');
+  delete
+    from WS.WS.SYS_DAV_ACL_INVERSE
+   where AI_PARENT_TYPE = 'R'
+     and AI_PARENT_ID = O.RES_ID;
+  -- dbg_obj_princ ('trigger SYS_DAV_RES_ACL_D (', O.RES_ID, ') done');
 }
 ;
 
-create procedure WS.WS.ACL_UPDATE (in pId integer, in pParentAcl any)
+create procedure WS.WS.ACL_UPDATE (in id integer, in parentAcl any)
 {
-  declare
-    aNew any;
-
-  WS.WS.ACL_MAKE_INHERITED(pParentAcl);
+  declare nAcl any;
+  -- dbg_obj_princ ('procedure WS.WS.ACL_UPDATE (', id, ')');
 
-  for select RES_ID as iResID, WS.WS.ACL_PARSE(RES_ACL, '0', 0) as aAcl from WS.WS.SYS_DAV_RES where RES_COL = pId do
+  WS.WS.ACL_MAKE_INHERITED (parentAcl);
+  for select RES_ID as resID, RES_ACL as aAcl from WS.WS.SYS_DAV_RES where RES_COL = id do
   {
-    update
-      WS.WS.SYS_DAV_RES
-    set
-      RES_ACL = WS.WS.ACL_COMPOSE(vector_concat(aAcl, pParentAcl))
-    where
-      RES_ID = iResID;
+    nAcl := WS.WS.ACL_COMPOSE (vector_concat (WS.WS.ACL_PARSE (aAcl, '0', 0), parentAcl));
+    if (not ((nAcl = aAcl) or (isnull (nAcl) and isnull (aAcl))))
+    {
+      update WS.WS.SYS_DAV_RES
+         set RES_ACL = nAcl
+       where RES_ID = resID;
   }
-
-  for select COL_ID as iColID, WS.WS.ACL_COMPOSE(vector_concat(WS.WS.ACL_PARSE(COL_ACL, '012', 0), pParentAcl)) as aAcl from WS.WS.SYS_DAV_COL where COL_PARENT = pId do
+  }
+  for select COL_ID as colID, COL_ACL as aAcl from WS.WS.SYS_DAV_COL where COL_PARENT = id do
   {
-    update
-      WS.WS.SYS_DAV_COL
-    set
-      COL_ACL = aAcl
-    where
-      COL_ID = iColID;
-    WS.WS.ACL_UPDATE(iColID, WS.WS.ACL_PARSE(aAcl, '123', 0));
+    nAcl := WS.WS.ACL_COMPOSE (vector_concat (WS.WS.ACL_PARSE (aAcl, '012', 0), parentAcl));
+    if (not ((nAcl = aAcl) or (isnull (nAcl) and isnull (aAcl))))
+    {
+      update WS.WS.SYS_DAV_COL
+         set COL_ACL = nAcl
+       where COL_ID = colID;
+      WS.WS.ACL_UPDATE(colID, WS.WS.ACL_PARSE (nAcl, '123', 0));
+    }
   }
 }
 ;
 
-create procedure WS.WS.ACL_MAKE_INHERITED (inout pAcl any)
+create procedure WS.WS.ACL_MAKE_INHERITED (
+  inout aAcl any)
 {
-  declare
-    aTmp any;
-  declare
-    N integer;
+  declare tmp any;
+  declare N integer;
 
-  N := 0;
-  while (N < length(pAcl))
+  for (N := 0; N < length (aAcl); N := N + 1)
   {
-    aTmp := pAcl[N];
-    aset(aTmp, 2, 3);
-    aset(pAcl, N, aTmp);
-    N := N + 1;
+    tmp := aAcl[N];
+    aset (tmp, 2, 3);
+    aset (aAcl, N, tmp);
   }
-  return pAcl;
+  return aAcl;
 }
 ;
 
 
-create procedure WS.WS.ACL_DBG(in vb varbinary) returns varchar
+create procedure WS.WS.ACL_DBG (
+  in vb varbinary) returns varchar
 {
-  declare
-    N integer;
-  declare
-    aResult varchar;
+  declare N integer;
+  declare aResult varchar;
 
   aResult := '';
   vb := cast(vb as varchar);
-
-  N := 0;
-  while (N < length(vb))
+  for (N := 0; N < length (vb); N := N + 1)
   {
-    aResult := concat(aResult, cast(vb[N] as varchar), ', ');
-    N := N + 1;
+    aResult := aResult || cast (vb[N] as varchar) || ', ';
   }
   return aResult;
 }
@@ -4619,10 +4807,8 @@ create procedure WS.WS.ACL_DBG(in vb varbinary) returns varchar
 --
 create procedure WS.WS.ACL_SERIALIZE_INT(in I integer) returns varbinary
 {
-  declare
-    N integer;
-  declare
-    aResult varchar;
+  declare N integer;
+  declare aResult varchar;
 
   aResult:=repeat('\0',4);
 
@@ -4650,11 +4836,9 @@ create procedure WS.WS.ACL_SERIALIZE_INT(in I integer) returns varbinary
 --
 create procedure WS.WS.ACL_DESERIALIZE_INT(in vb varbinary) returns integer
 {
-  declare
-    vc varchar;
+  declare vc varchar;
 
   vc := cast(vb as varchar);
-
   return bit_or(bit_or(bit_or(bit_shift(aref(vc, 0), 24), bit_shift(aref(vc, 1), 16)), bit_shift(aref(vc, 2), 8)), aref(vc, 3));
 }
 ;
@@ -4694,9 +4878,7 @@ create procedure WS.WS.ACL_CREATE() returns varbinary
 -------------------------------------------------------------------------------
 create procedure WS.WS.ACL_IS_VALID (in acl varbinary) returns integer
 {
-  declare
-    iAclLength,
-    iAceSize integer;
+  declare iAclLength, iAceSize integer;
 
   -- dbg_obj_princ ('WS.WS.ACL_IS_VALID (', sprintf('%U', cast (acl as varchar)), ')');
   if (internal_type_name(internal_type(acl)) <> 'VARBINARY')
@@ -4731,17 +4913,13 @@ create procedure WS.WS.ACL_IS_VALID (in acl varbinary) returns integer
 -------------------------------------------------------------------------------
 create procedure WS.WS.ACL_ADD_ENTRY(inout acl varbinary, in uid integer, in bitmask integer, in is_grant integer, in inheritance integer := 0) returns varbinary
 {
-  declare
-    N,
-    bFound integer;
-  declare
-    aAcl any;
+  declare N, bFound integer;
+  declare aAcl any;
 
   aAcl := WS.WS.ACL_PARSE(acl);
 
   bFound := 0;
-  N := 0;
-  while (N < length(aAcl))
+  for (N := 0; N < length (aAcl); N := N + 1)
   {
     if ((aAcl[N][0] = uid) and (aAcl[N][2] = inheritance))
     {
@@ -4755,8 +4933,7 @@ create procedure WS.WS.ACL_ADD_ENTRY(inout acl varbinary, in uid integer, in bit
         aset(aAcl, N, vector(aAcl[N][0], aAcl[N][1], aAcl[N][2], bit_and(aAcl[N][3], bit_not(bitmask))));
       }
     }
-    N := N + 1;
-  };
+  }
 
   if (not bFound)
     aAcl := vector_concat(aAcl, vector(vector(uid, is_grant, inheritance, bitmask)));
@@ -4776,15 +4953,11 @@ create procedure WS.WS.ACL_ADD_ENTRY(inout acl varbinary, in uid integer, in bit
 -------------------------------------------------------------------------------
 create procedure WS.WS.ACL_REMOVE_ENTRY(inout acl varbinary, in uid integer, in bitmask integer, in inheritance integer := 0) returns varbinary
 {
-  declare
-    N integer;
-  declare
-    aAcl any;
+  declare N integer;
+  declare aAcl any;
 
   aAcl := WS.WS.ACL_PARSE(acl);
-
-  N := 0;
-  while (N < length(aAcl))
+  for (N := 0; N < length(aAcl); N := N + 1)
   {
     if ((aAcl[N][0] = uid) and (aAcl[N][2] = inheritance))
     {
@@ -4797,7 +4970,6 @@ create procedure WS.WS.ACL_REMOVE_ENTRY(inout acl varbinary, in uid integer, in
         aset(aAcl, N, vector(aAcl[N][0], aAcl[N][1], aAcl[N][2], bit_and(aAcl[N][3], bitmask)));
       }
     }
-    N := N + 1;
   }
   acl := WS.WS.ACL_COMPOSE(aAcl);
 
@@ -4812,13 +4984,10 @@ create procedure WS.WS.ACL_REMOVE_ENTRY(inout acl varbinary, in uid integer, in
 -------------------------------------------------------------------------------
 create procedure WS.WS.ACL_IS_GRANTED(in acl varbinary, in uid integer, in bitmask integer) returns integer
 {
-  declare
-    N, lenAcl integer;
-  declare
-    aAcl any;
+  declare N, lenAcl integer;
+  declare aAcl any;
   declare ids any;
-  declare
-    or_acc integer;
+  declare or_acc integer;
 
   if (isnull(acl))
     return 0;
@@ -4881,17 +5050,14 @@ create procedure WS.WS.ACL_OWNER(in acl varbinary) returns integer
 -- Returns an array with: (owner entry1, entry2,...) where each entry is (grantee is_grant bits).
 --
 -------------------------------------------------------------------------------
-create procedure WS.WS.ACL_PARSE(in acl varbinary, in inheritance varchar := '0123', in error integer := 1) returns any
-{
-  declare
-    sAcl varchar;
-  declare
-    N,
-    I,
-    T,
-    iAceSize integer;
-  declare
-    aAcl any;
+create procedure WS.WS.ACL_PARSE (
+  in acl varbinary,
+  in inheritance varchar := '0123',
+  in error integer := 1) returns any
+{
+  declare sAcl varchar;
+  declare N, I, T, aclSize integer;
+  declare aAcl any;
 
   if (acl is null)
     return vector ();
@@ -4907,24 +5073,21 @@ create procedure WS.WS.ACL_PARSE(in acl varbinary, in inheritance varchar := '01
     return vector ();
   }
 
-  iAceSize := WS.WS.ACL_GET_ACESIZE(acl);
+  aclSize := WS.WS.ACL_GET_ACESIZE (acl);
   sAcl := cast(acl as varchar);
 
-  aAcl := vector ();
-  N := 1;
-  while (N <= iAceSize)
+  vectorbld_init (aAcl);
+  for (N := 1; N <= aclSize; N := N + 1)
   {
     T := WS.WS.ACL_DESERIALIZE_INT(cast (substring(sAcl, 8*N+5, 4) as varbinary));
     I := abs(bit_and(bit_shift(T, -29), 3));
     if (not isnull(strchr(inheritance, cast(I as varchar))))
-      aAcl := vector_concat(aAcl,
-                            vector(vector(WS.WS.ACL_DESERIALIZE_INT(cast (substring(sAcl, 8*N+1, 4) as varbinary)),
+      vectorbld_acc (aAcl, vector (WS.WS.ACL_DESERIALIZE_INT (cast (substring (sAcl, 8*N+1, 4) as varbinary)),
                                           abs(bit_shift(T, -31)),
                                           I,
-                                          abs(bit_and(T, 536870911)))));
-    N := N + 1;
+                                   abs (bit_and (T, 536870911))));
   }
-
+  vectorbld_final (aAcl);
   return aAcl;
 }
 ;
@@ -4934,31 +5097,26 @@ create procedure WS.WS.ACL_PARSE(in acl varbinary, in inheritance varchar := '01
 -- Returns an array with: (owner entry1, entry2,...) where each entry is (grantee is_grant bits).
 --
 -------------------------------------------------------------------------------
-create procedure WS.WS.ACL_COMPOSE(in aAcl vector) returns varbinary
+create procedure WS.WS.ACL_COMPOSE (
+  in aAcl vector) returns varbinary
 {
   declare sAcl varchar;
   declare bAcl varbinary;
   declare N, I, J integer;
 
   sAcl := '';
-  I := 1;
-  while (I < 4)
+  for (I := 1; I < 4; I := I + 1)
   {
-    J := 0;
-    while (J < 2)
+    for (J := 0; J < 2; J := J + 1)
     {
-      N := 0;
-      while (N < length(aAcl))
+      foreach (any acl in aAcl) do
       {
-        if ((aAcl[N][1]=J) and ((aAcl[N][2]=I) or ((aAcl[N][2]=0) and (I=1))) and aAcl[N][3])
+        if ((acl[1]=J) and ((acl[2]=I) or ((acl[2]=0) and (I=1))) and acl[3])
           sAcl := concat(sAcl,
-                         cast(WS.WS.ACL_SERIALIZE_INT(aAcl[N][0]) as varchar),
-                         cast(WS.WS.ACL_SERIALIZE_INT(bit_shift(aAcl[N][1],31)+bit_shift(aAcl[N][2],29)+aAcl[N][3]) as varchar));
-        N := N + 1;
+                         cast(WS.WS.ACL_SERIALIZE_INT(acl[0]) as varchar),
+                         cast(WS.WS.ACL_SERIALIZE_INT(bit_shift(acl[1],31)+bit_shift(acl[2],29)+acl[3]) as varchar));
       }
-      J := J + 1;
     }
-    I := I + 1;
   }
 
   bAcl := cast(concat(cast(WS.WS.ACL_SERIALIZE_INT(length(sAcl)+8) as varchar),
diff --git a/binsrc/dav/dav_meta.sql b/binsrc/dav/dav_meta.sql
index adf8c32..adbce9e 100644
--- a/binsrc/dav/dav_meta.sql
+++ b/binsrc/dav/dav_meta.sql
@@ -1,5 +1,5 @@
 --
---  $Id: dav_meta.sql,v 1.12 2009/02/13 10:09:13 source Exp $
+--  $Id: dav_meta.sql,v 1.12.2.1 2010/09/22 13:58:32 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -1618,6 +1618,11 @@ create function IMC_TO_XML (in _src varchar)
   while (line_idx < lines_count)
     {
       line := lines [line_idx];
+      while ((line_idx+1 < lines_count) and (chr (lines [line_idx+1][0]) = ' ' or chr (lines [line_idx+1][0]) = '\t'))
+        {
+          line := line || subseq (lines [line_idx+1], 1);
+          line_idx := line_idx + 1;
+        }
       if (line = '')
         goto next_line;
       if (regexp_match ('^([A-Za-z0-9-]+[.])?((BEGIN)|(begin)):([A-Z]+)\044', line) is not null)
diff --git a/binsrc/dav/dav_rdf_quad.sql b/binsrc/dav/dav_rdf_quad.sql
index fad3e4c..3d523a3 100644
--- a/binsrc/dav/dav_rdf_quad.sql
+++ b/binsrc/dav/dav_rdf_quad.sql
@@ -1,5 +1,5 @@
 --
---  $Id: dav_rdf_quad.sql,v 1.4 2009/02/13 10:09:13 source Exp $
+--  $Id: dav_rdf_quad.sql,v 1.4.2.1 2010/09/27 14:42:19 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -55,8 +55,10 @@ create procedure DB.DBA.DAV_REPLICATE_ALL_TO_RDF_QUAD (in enable integer)
   uriqa_default_host := cfg_item_value (virtuoso_ini_path (), 'URIQA','DefaultHost');
   if (uriqa_default_host is null or uriqa_default_host = '')
     signal ('OBLOM', 'No uriqa_default_host!');
-  --new_dav_graph := sprintf ('http://%s/DAV', uriqa_default_host);
+  if (cfg_item_value (virtuoso_ini_path (), 'URIQA', 'DynamicLocal') = '1')
   new_dav_graph := 'local:/DAV';
+  else
+    new_dav_graph := sprintf ('http://%s/DAV', uriqa_default_host);
   exec ('checkpoint');
   __atomic (1);
   DB.DBA.RDF_DELETE_ENTIRE_GRAPH (new_dav_graph, 1);
diff --git a/binsrc/dav/davddk.sql b/binsrc/dav/davddk.sql
index 43a6af4..f0ef84e 100644
--- a/binsrc/dav/davddk.sql
+++ b/binsrc/dav/davddk.sql
@@ -1,5 +1,5 @@
 --
---  $Id: davddk.sql,v 1.13.2.2 2009/12/24 13:54:11 source Exp $
+--  $Id: davddk.sql,v 1.13.2.5 2011/01/05 12:52:53 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -1266,6 +1266,8 @@ insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/opml+xml
 ;
 insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/rdf+xml','rdf')
 ;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/rdf+xml','owl')
+;
 insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/annotea+xml','annotea')
 ;
 update WS.WS.SYS_DAV_RES_TYPES set T_TYPE='application/rdf+xml' where T_TYPE <> 'application/rdf+xml' and T_EXT = 'rdf'
@@ -1546,8 +1548,1361 @@ insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/rdf+ttl','ttl')
 ;
 insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/rdf+n3','n3')
 ;
-
-select count(*) from WS.WS.SYS_DAV_RES_TYPES where http_mime_type_add (T_EXT, T_TYPE)
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-ms-application','application')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-ms-manifest','manifest')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','deploy')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','msp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','msu')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-ms-vsto','vsto')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/xaml+xml','xaml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-ms-xbap','xbap')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/applixware','aw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/atomcat+xml','atomcat')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/atomsvc+xml','atomsvc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/atom+xml','atom')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/ccxml+xml','ccxml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/cu-seeme','cu')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/davmount+xml','davmount')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/dssc+der','dssc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/dssc+xml','xdssc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/ecmascript','ecma')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/emma+xml','emma')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/epub+zip','epub')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/font-tdpfr','pfr')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/hyperstudio','stk')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/ipfix','ipfix')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/java-archive','jar')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/java-serialized-object','ser')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/json','json')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/lost+xml','lostxml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/marc','mrc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/mathematica','ma')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/mathematica','nb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/mathematica','mb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/mathml+xml','mathml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/mbox','mbox')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/mediaservercontrol+xml','mscml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/mp4','mp4s')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/msword','dot')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/mxf','mxf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','lrf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','so')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','iso')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','dmg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','dist')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','distz')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','pkg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','bpk')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','dump')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/octet-stream','elc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/oebps-package+xml','opf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/ogg','ogx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/onenote','onetoc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/onenote','onetoc2')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/onenote','onetmp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/onenote','onepkg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/patch-ops-error+xml','xer')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/pgp-encrypted','pgp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/pgp-signature','sig')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/pics-rules','prf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/pkcs10','p10')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/pkcs7-mime','p7m')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/pkcs7-mime','p7c')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/pkcs7-signature','p7s')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/pkix-cert','cer')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/pkixcmp','pki')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/pkix-crl','crl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/pkix-pkipath','pkipath')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/pls+xml','pls')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/prs.cww','cww')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/reginfo+xml','rif')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/relax-ng-compact-syntax','rnc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/resource-lists-diff+xml','rld')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/resource-lists+xml','rl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/rls-services+xml','rs')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/rsd+xml','rsd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/sbml+xml','sbml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/scvp-cv-request','scq')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/scvp-cv-response','scs')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/scvp-vp-request','spq')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/scvp-vp-response','spp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/sdp','sdp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/set-payment-initiation','setpay')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/set-registration-initiation','setreg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/shf+xml','shf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/sparql-query','rq')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/sparql-results+xml','srx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/srgs','gram')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/srgs+xml','grxml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/ssml+xml','ssml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.3gpp2.tcap','tcap')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.3gpp.pic-bw-large','plb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.3gpp.pic-bw-small','psb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.3gpp.pic-bw-var','pvb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.3m.post-it-notes','pwn')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.accpac.simply.aso','aso')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.accpac.simply.imp','imp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.acucobol','acu')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.acucorp','atc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.acucorp','acutc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.adobe.air-application-installer-package+zip','air')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.adobe.xdp+xml','xdp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.adobe.xfdf','xfdf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.airzip.filesecure.azf','azf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.airzip.filesecure.azs','azs')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.amazon.ebook','azw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.americandynamics.acc','acc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.amiga.ami','ami')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.android.package-archive','apk')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.anser-web-certificate-issue-initiation','cii')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.anser-web-funds-transfer-initiation','fti')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.antix.game-component','atx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.apple.installer+xml','mpkg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.apple.mpegurl','m3u8')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.aristanetworks.swi','swi')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.audiograph','aep')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.blueice.multipass','mpm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.bmi','bmi')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.businessobjects','rep')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.chemdraw+xml','cdxml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.chipnuts.karaoke-mmd','mmd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.cinderella','cdy')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.claymore','cla')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.cloanto.rp9','rp9')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.clonk.c4group','c4g')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.clonk.c4group','c4d')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.clonk.c4group','c4f')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.clonk.c4group','c4p')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.clonk.c4group','c4u')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.commonspace','csp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.contact.cmsg','cdbcmsg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.cosmocaller','cmc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.crick.clicker','clkx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.crick.clicker.keyboard','clkk')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.crick.clicker.palette','clkp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.crick.clicker.template','clkt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.crick.clicker.wordbank','clkw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.criticaltools.wbs+xml','wbs')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ctc-posml','pml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.cups-ppd','ppd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.curl.car','car')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.curl.pcurl','pcurl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.data-vision.rdz','rdz')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.denovo.fcselayout-link','fe_launch')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.dna','dna')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.dolby.mlp','mlp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.dpgraph','dpg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.dreamfactory','dfac')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.dynageo','geo')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ecowin.chart','mag')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.enliven','nml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.epson.esf','esf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.epson.msf','msf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.epson.quickanime','qam')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.epson.salt','slt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.epson.ssf','ssf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.eszigno3+xml','es3')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.eszigno3+xml','et3')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ezpix-album','ez2')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ezpix-package','ez3')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fdf','fdf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fdsn.mseed','mseed')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fdsn.seed','seed')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fdsn.seed','dataless')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.flographit','gph')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fluxtime.clip','ftc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.framemaker','fm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.framemaker','frame')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.framemaker','maker')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.framemaker','book')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.frogans.fnc','fnc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.frogans.ltf','ltf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fsc.weblaunch','fsc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fujitsu.oasys','oas')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fujitsu.oasys2','oa2')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fujitsu.oasys3','oa3')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fujitsu.oasysgp','fg5')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fujitsu.oasysprs','bh2')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fujixerox.ddd','ddd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fujixerox.docuworks','xdw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fujixerox.docuworks.binder','xbd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.fuzzysheet','fzs')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.genomatix.tuxedo','txd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.geogebra.file','ggb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.geogebra.tool','ggt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.geometry-explorer','gex')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.geometry-explorer','gre')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.geonext','gxt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.geoplan','g2w')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.geospace','g3w')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.gmx','gmx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.google-earth.kml+xml','kml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.google-earth.kmz','kmz')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.grafeq','gqf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.grafeq','gqs')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.groove-account','gac')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.groove-help','ghf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.groove-identity-message','gim')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.groove-injector','grv')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.groove-tool-message','gtm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.groove-tool-template','tpl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.groove-vcard','vcg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.handheld-entertainment+xml','zmm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.hbci','hbci')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.hhe.lesson-player','les')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.hp-hpgl','hpgl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.hp-hpid','hpid')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.hp-hps','hps')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.hp-jlyt','jlt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.hp-pcl','pcl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.hp-pclxl','pclxl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.hydrostatix.sof-data','sfd-hdstx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.hzn-3d-crossword','x3d')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ibm.minipay','mpy')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ibm.modcap','afp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ibm.modcap','listafp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ibm.modcap','list3820')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ibm.rights-management','irm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ibm.secure-container','sc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.iccprofile','icc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.iccprofile','icm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.igloader','igl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.immervision-ivp','ivp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.immervision-ivu','ivu')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.intercon.formnet','xpw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.intercon.formnet','xpx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.intu.qbo','qbo')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.intu.qfx','qfx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ipunplugged.rcprofile','rcprofile')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.irepository.package+xml','irp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.is-xpr','xpr')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.jam','jam')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.jcp.javame.midlet-rms','rms')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.jisp','jisp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.joost.joda-archive','joda')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kahootz','ktz')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kahootz','ktr')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kde.karbon','karbon')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kde.kchart','chrt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kde.kformula','kfo')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kde.kivio','flw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kde.kontour','kon')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kde.kpresenter','kpr')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kde.kpresenter','kpt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kde.kspread','ksp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kde.kword','kwd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kde.kword','kwt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kenameaapp','htke')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kidspiration','kia')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kinar','kne')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kinar','knp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.kodak-descriptor','sse')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.llamagraphics.life-balance.desktop','lbd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.llamagraphics.life-balance.exchange+xml','lbe')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.lotus-1-2-3','123')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.lotus-approach','apr')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.lotus-freelance','pre')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.lotus-notes','nsf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.lotus-organizer','org')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.lotus-screencam','scm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.lotus-wordpro','lwp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.macports.portpkg','portpkg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mcd','mcd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.medcalcdata','mc1')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mediastation.cdkey','cdkey')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mfer','mwf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mfmp','mfm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.micrografx.flo','flo')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.micrografx.igx','igx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mif','mif')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mobius.daf','daf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mobius.dis','dis')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mobius.mbk','mbk')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mobius.mqy','mqy')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mobius.msl','msl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mobius.plc','plc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mobius.txf','txf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mophun.application','mpn')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mophun.certificate','mpc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mozilla.xul+xml','xul')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-artgalry','cil')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-cab-compressed','cab')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.mseq','mseq')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-excel','xlm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-excel','xla')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-excel','xlc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-excel','xlt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-excel','xlw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-excel.addin.macroenabled.12','xlam')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-excel.sheet.binary.macroenabled.12','xlsb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-excel.sheet.macroenabled.12','xlsm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-excel.template.macroenabled.12','xltm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-fontobject','eot')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-htmlhelp','chm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-ims','ims')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-lrm','lrm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-pki.seccat','cat')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-pki.stl','stl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-powerpoint','pps')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-powerpoint','pot')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-powerpoint.addin.macroenabled.12','ppam')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-powerpoint.presentation.macroenabled.12','pptm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-powerpoint.slide.macroenabled.12','sldm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-powerpoint.slideshow.macroenabled.12','ppsm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-powerpoint.template.macroenabled.12','potm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-project','mpt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-word.document.macroenabled.12','docm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-word.template.macroenabled.12','dotm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-works','wps')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-works','wks')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-works','wcm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-works','wdb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-wpl','wpl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ms-xpsdocument','xps')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.musician','mus')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.muvee.style','msty')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.neurolanguage.nlu','nlu')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.noblenet-directory','nnd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.noblenet-sealer','nns')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.noblenet-web','nnw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.nokia.n-gage.data','ngdat')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.nokia.n-gage.symbian.install','n-gage')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.nokia.radio-preset','rpst')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.nokia.radio-presets','rpss')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.novadigm.edm','edm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.novadigm.edx','edx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.novadigm.ext','ext')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.oasis.opendocument.chart-template','otc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.oasis.opendocument.formula-template','odft')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.oasis.opendocument.graphics-template','otg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.oasis.opendocument.image-template','oti')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.oasis.opendocument.presentation-template','otp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.oasis.opendocument.spreadsheet-template','ots')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.oasis.opendocument.text-master','otm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.oasis.opendocument.text-template','ott')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.oasis.opendocument.text-web','oth')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.olpc-sugar','xo')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.oma.dd2+xml','dd2')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.openofficeorg.extension','oxt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.openxmlformats-officedocument.presentationml.presentation','pptx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.openxmlformats-officedocument.presentationml.slide','sldx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.openxmlformats-officedocument.presentationml.slideshow','ppsx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.openxmlformats-officedocument.presentationml.template','potx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','xlsx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.openxmlformats-officedocument.spreadsheetml.template','xltx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.openxmlformats-officedocument.wordprocessingml.document','docx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.openxmlformats-officedocument.wordprocessingml.template','dotx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.osgi.dp','dp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.palm','pqa')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.palm','oprc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.pawaafile','paw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.pg.format','str')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.pg.osasli','ei6')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.picsel','efif')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.pmi.widget','wg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.pocketlearn','plf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.powerbuilder6','pbd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.previewsystems.box','box')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.proteus.magazine','mgz')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.publishare-delta-tree','qps')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.pvi.ptid1','ptid')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.quark.quarkxpress','qxd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.quark.quarkxpress','qxt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.quark.quarkxpress','qwd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.quark.quarkxpress','qwt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.quark.quarkxpress','qxl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.quark.quarkxpress','qxb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.realvnc.bed','bed')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.recordare.musicxml','mxl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.recordare.musicxml+xml','musicxml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.rim.cod','cod')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.route66.link66+xml','link66')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sailingtracker.track','st')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.seemail','see')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sema','sema')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.semd','semd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.semf','semf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.shana.informed.formdata','ifm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.shana.informed.formtemplate','itp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.shana.informed.interchange','iif')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.shana.informed.package','ipk')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.simtech-mindmapper','twd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.simtech-mindmapper','twds')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.smaf','mmf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.smart.teacher','teacher')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.solent.sdkm+xml','sdkm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.solent.sdkm+xml','sdkd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.spotfire.dxp','dxp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.spotfire.sfs','sfs')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.stardivision.calc','sdc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.stardivision.draw','sda')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.stardivision.impress','sdd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.stardivision.math','smf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.stardivision.writer','sdw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.stardivision.writer','vor')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.stardivision.writer-global','sgl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sun.xml.calc','sxc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sun.xml.calc.template','stc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sun.xml.draw','sxd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sun.xml.draw.template','std')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sun.xml.impress','sxi')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sun.xml.impress.template','sti')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sun.xml.math','sxm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sun.xml.writer','sxw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sun.xml.writer.global','sxg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sun.xml.writer.template','stw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sus-calendar','sus')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.sus-calendar','susp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.svd','svd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.symbian.install','sis')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.symbian.install','sisx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.syncml.dm+wbxml','bdm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.syncml.dm+xml','xdm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.syncml+xml','xsm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.tao.intent-module-archive','tao')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.tmobile-livetv','tmo')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.trid.tpt','tpt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.triscape.mxs','mxs')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.trueapp','tra')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ufdl','ufd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.ufdl','ufdl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.uiq.theme','utz')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.umajin','umj')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.unity','unityweb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.uoml+xml','uoml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.vcx','vcx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.visio','vsd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.visio','vst')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.visio','vss')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.visio','vsw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.visionary','vis')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.vsf','vsf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.wap.wbxml','wbxml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.wap.wmlc','wmlc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.wap.wmlscriptc','wmlsc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.webturbo','wtb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.wolfram.player','nbp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.wordperfect','wpd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.wqd','wqd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.wt.stf','stf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.xara','xar')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.xfdl','xfdl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.yamaha.hv-dic','hvd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.yamaha.hv-script','hvs')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.yamaha.hv-voice','hvp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.yamaha.openscoreformat','osf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.yamaha.openscoreformat.osfpvg+xml','osfpvg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.yamaha.smaf-audio','saf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.yamaha.smaf-phrase','spf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.yellowriver-custom-menu','cmp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.zul','zir')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.zul','zirz')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/vnd.zzazz.deck+xml','zaz')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/voicexml+xml','vxml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/winhlp','hlp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/wspolicy+xml','wspolicy')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-abiword','abw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-ace-compressed','ace')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-authorware-bin','aab')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-authorware-bin','x32')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-authorware-bin','u32')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-authorware-bin','vox')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-authorware-map','aam')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-authorware-seg','aas')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-bittorrent','torrent')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-bzip','bz')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-bzip2','bz2')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-bzip2','boz')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-chat','chat')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-debian-package','deb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-debian-package','udeb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-director','cst')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-director','cct')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-director','cxt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-director','w3d')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-director','fgd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-director','swa')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-doom','wad')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-dtbncx+xml','ncx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-dtbook+xml','dtb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-dtbresource+xml','res')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/xenc+xml','xenc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-font-bdf','bdf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-font-ghostscript','gsf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-font-linux-psf','psf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-font-otf','otf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-font-pcf','pcf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-font-snf','snf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-font-ttf','ttf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-font-ttf','ttc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-font-type1','pfa')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-font-type1','pfb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-font-type1','pfm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-font-type1','afm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-gnumeric','gnumeric')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/xhtml+xml','xhtml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/xhtml+xml','xht')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-java-jnlp-file','jnlp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-mobipocket-ebook','prc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-mobipocket-ebook','mobi')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msbinder','obd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-mscardfile','crd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msclip','clp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msdownload','dll')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msdownload','com')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msdownload','bat')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msdownload','msi')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msmediaview','mvb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msmediaview','m13')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msmediaview','m14')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msmetafile','wmf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msmoney','mny')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-mspublisher','pub')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msschedule','scd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-msterminal','trm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-ms-wmd','wmd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-ms-wmz','wmz')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-mswrite','wri')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/xop+xml','xop')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-pkcs12','p12')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-pkcs12','pfx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-pkcs7-certificates','p7b')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-pkcs7-certificates','spc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-pkcs7-certreqresp','p7r')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-rar-compressed','rar')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-silverlight-app','xap')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/xslt+xml','xslt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/xspf+xml','xspf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-stuffitx','sitx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-tex-tfm','tfm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/xv+xml','mxml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/xv+xml','xhvml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/xv+xml','xvml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/xv+xml','xvm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-x509-ca-cert','der')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-x509-ca-cert','crt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-xfig','fig')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('application/x-xpinstall','xpi')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/adpcm','adp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/midi','rmi')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/mp4','mp4a')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/mpeg','mp2a')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/mpeg','m2a')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/mpeg','m3a')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/ogg','oga')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/ogg','spx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/vnd.digital-winds','eol')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/vnd.dra','dra')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/vnd.dts','dts')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/vnd.dts.hd','dtshd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/vnd.lucent.voice','lvp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/vnd.ms-playready.media.pya','pya')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/vnd.nuera.ecelp4800','ecelp4800')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/vnd.nuera.ecelp7470','ecelp7470')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/vnd.nuera.ecelp9600','ecelp9600')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/x-aac','aac')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/x-mpegurl','m3u')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/x-ms-wax','wax')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/x-ms-wma','wma')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('audio/x-pn-realaudio-plugin','rmp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('chemical/x-cdx','cdx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('chemical/x-cif','cif')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('chemical/x-cmdf','cmdf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('chemical/x-cml','cml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('chemical/x-csml','csml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/cgm','cgm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/g3fax','g3')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/prs.btif','btif')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/svg+xml','svgz')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.adobe.photoshop','psd')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.djvu','djvu')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.djvu','djv')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.dwg','dwg')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.dxf','dxf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.fastbidsheet','fbs')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.fpx','fpx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.fst','fst')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.fujixerox.edmics-mmr','mmr')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.fujixerox.edmics-rlc','rlc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.ms-modi','mdi')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.net-fpx','npx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.wap.wbmp','wbmp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/vnd.xiff','xif')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/x-cmx','cmx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/x-freehand','fh')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/x-freehand','fhc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/x-freehand','fh4')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/x-freehand','fh5')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/x-freehand','fh7')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/x-icon','ico')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/x-pcx','pcx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/x-pict','pic')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('image/x-pict','pct')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('message/rfc822','eml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('message/rfc822','mime')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('model/vnd.dwf','dwf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('model/vnd.gdl','gdl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('model/vnd.gtw','gtw')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('model/vnd.mts','mts')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('model/vnd.vtu','vtu')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/calendar','ifb')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/plain','text')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/plain','conf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/plain','def')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/plain','list')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/plain','log')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/plain','in')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/prs.lines.tag','dsc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/uri-list','uri')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/uri-list','uris')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/uri-list','urls')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/vnd.curl','curl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/vnd.curl.dcurl','dcurl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/vnd.curl.mcurl','mcurl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/vnd.curl.scurl','scurl')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/vnd.fly','fly')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/vnd.fmi.flexstor','flx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/vnd.graphviz','gv')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/vnd.in3d.3dml','3dml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/vnd.in3d.spot','spot')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/vnd.sun.j2me.app-descriptor','jad')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/vnd.wap.wml','wml')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/vnd.wap.wmlscript','wmls')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-asm','s')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-asm','asm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-c','c')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-c','cc')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-c','cxx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-c','cpp')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-c','h')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-c','hh')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-c','dic')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-fortran','f')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-fortran','for')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-fortran','f77')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-fortran','f90')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-java-source','java')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-pascal','p')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-pascal','pas')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-uuencode','uu')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('text/x-vcalendar','vcs')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/3gpp2','3g2')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/h261','h261')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/h263','h263')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/h264','h264')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/jpeg','jpgv')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/jpm','jpm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/jpm','jpgm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/mj2','mj2')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/mj2','mjp2')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/mp4','mp4v')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/mp4','mpg4')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/mpeg','m1v')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/mpeg','m2v')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/ogg','ogv')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/vnd.fvt','fvt')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/vnd.mpegurl','mxu')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/vnd.mpegurl','m4u')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/vnd.ms-playready.media.pyv','pyv')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/vnd.vivo','viv')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/x-f4v','f4v')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/x-fli','fli')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/x-flv','flv')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/x-m4v','m4v')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/x-ms-asf','asf')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/x-ms-asf','asx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/x-ms-wm','wm')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/x-ms-wmv','wmv')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/x-ms-wmx','wmx')
+;
+insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values ('video/x-ms-wvx','wvx')
+;
+
+select count(*) from WS.WS.SYS_DAV_RES_TYPES where http_mime_type_add (T_EXT, T_TYPE)
+;
+
+create trigger SYS_DAV_RES_TYPES_I after insert on WS.WS.SYS_DAV_RES_TYPES referencing new as N
+{
+  http_mime_type_add (N.T_EXT, N.T_TYPE);
+}
+;
+
+create trigger SYS_DAV_RES_TYPES_U after update on WS.WS.SYS_DAV_RES_TYPES referencing old as O, new as N
+{
+  http_mime_type_add (N.T_EXT, N.T_TYPE);
+  http_mime_type_add (O.T_EXT, null);
+}
+;
+
+create trigger SYS_DAV_RES_TYPES_D after delete on WS.WS.SYS_DAV_RES_TYPES referencing old as O
+{
+  http_mime_type_add (O.T_EXT, null);
+}
 ;
 
 create procedure
diff --git a/binsrc/driver/Makefile.in b/binsrc/driver/Makefile.in
index 02da851..21720fa 100644
--- a/binsrc/driver/Makefile.in
+++ b/binsrc/driver/Makefile.in
@@ -255,6 +255,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/driver/virt_vers.c b/binsrc/driver/virt_vers.c
index e481244..80a2afb 100644
--- a/binsrc/driver/virt_vers.c
+++ b/binsrc/driver/virt_vers.c
@@ -4,6 +4,6 @@
 
 char version[] = "\
 OpenLink Virtuoso ODBC Driver\n\
-Version 06.01.3127 as of Fri Jul  9 18:21:29 CEST 2010.\n\
-Compiled for Linux 2.6.30.10-105.2.23.fc11.x86_64\n\
+Version 06.01.3127 as of Wed Mar 30 01:45:44 CEST 2011.\n\
+Compiled for Linux 2.6.34.7-56.fc13.x86_64\n\
 Copyright (C) OpenLink Software.\n";
diff --git a/binsrc/driver/virt_vers_r.c b/binsrc/driver/virt_vers_r.c
index 6b8b2c1..4496f80 100644
--- a/binsrc/driver/virt_vers_r.c
+++ b/binsrc/driver/virt_vers_r.c
@@ -4,6 +4,6 @@
 
 char version[] = "\
 OpenLink Virtuoso ODBC Driver (multi threaded)\n\
-Version 06.01.3127 as of Fri Jul  9 18:21:37 CEST 2010.\n\
-Compiled for Linux 2.6.30.10-105.2.23.fc11.x86_64\n\
+Version 06.01.3127 as of Wed Mar 30 01:46:04 CEST 2011.\n\
+Compiled for Linux 2.6.34.7-56.fc13.x86_64\n\
 Copyright (C) OpenLink Software.\n";
diff --git a/binsrc/driver/virt_vers_ru.c b/binsrc/driver/virt_vers_ru.c
index ebc6cf3..ad3d287 100644
--- a/binsrc/driver/virt_vers_ru.c
+++ b/binsrc/driver/virt_vers_ru.c
@@ -4,6 +4,6 @@
 
 char version[] = "\
 OpenLink Virtuoso ODBC Driver (Unicode)(multi threaded)\n\
-Version 06.01.3127 as of Fri Jul  9 18:21:40 CEST 2010.\n\
-Compiled for Linux 2.6.30.10-105.2.23.fc11.x86_64\n\
+Version 06.01.3127 as of Wed Mar 30 01:46:09 CEST 2011.\n\
+Compiled for Linux 2.6.34.7-56.fc13.x86_64\n\
 Copyright (C) OpenLink Software.\n";
diff --git a/binsrc/driver/virt_vers_u.c b/binsrc/driver/virt_vers_u.c
index 96f01b6..3d9661d 100644
--- a/binsrc/driver/virt_vers_u.c
+++ b/binsrc/driver/virt_vers_u.c
@@ -4,6 +4,6 @@
 
 char version[] = "\
 OpenLink Virtuoso ODBC Driver (Unicode)\n\
-Version 06.01.3127 as of Fri Jul  9 18:21:38 CEST 2010.\n\
-Compiled for Linux 2.6.30.10-105.2.23.fc11.x86_64\n\
+Version 06.01.3127 as of Wed Mar 30 01:46:05 CEST 2011.\n\
+Compiled for Linux 2.6.34.7-56.fc13.x86_64\n\
 Copyright (C) OpenLink Software.\n";
diff --git a/binsrc/hibernate/Makefile.in b/binsrc/hibernate/Makefile.in
index b214b0b..a965566 100644
--- a/binsrc/hibernate/Makefile.in
+++ b/binsrc/hibernate/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/hosting/Makefile.in b/binsrc/hosting/Makefile.in
index 9592a9b..d9e6adc 100644
--- a/binsrc/hosting/Makefile.in
+++ b/binsrc/hosting/Makefile.in
@@ -179,6 +179,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/hosting/mono/Makefile.in b/binsrc/hosting/mono/Makefile.in
index 1fe9fcf..485be25 100644
--- a/binsrc/hosting/mono/Makefile.in
+++ b/binsrc/hosting/mono/Makefile.in
@@ -278,6 +278,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/hosting/mono/sql_code_clr.c b/binsrc/hosting/mono/sql_code_clr.c
index aa208ff..2905e50 100644
--- a/binsrc/hosting/mono/sql_code_clr.c
+++ b/binsrc/hosting/mono/sql_code_clr.c
@@ -7,6 +7,7 @@
 /* import_clr.sql */
 
 static const char *proc0 = 
+"#line 37 \"[executable]/import_clr.sql\"\n"
 "create procedure DB.DBA.CACHE_ASSEMBLY_TO_DISK (in _asm_name varchar, in server_exe varchar)\n"
 "{\n"
 "declare _code varchar;\n"
@@ -15,9 +16,10 @@ static const char *proc0 =
 "\n"
 "string_to_file (server_exe || _asm_name || \'.dll\', _code, -2);\n"
 "}\n"
-"--src import_clr.sql:36\n";
+"--src import_clr.sql:35\n";
 
 static const char *proc1 = 
+"#line 47 \"[executable]/import_clr.sql\"\n"
 "create procedure DB.DBA.CLR_CREATE_LIBRARY (in asm_name varchar, in internal_name varchar,\n"
 "in auto_register integer, in perm_mode integer)\n"
 "{\n"
@@ -40,9 +42,10 @@ static const char *proc1 =
 "DB..import_clr (internal_name, NULL, unrestricted => perm_mode - 1);\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:46\n";
+"--src import_clr.sql:45\n";
 
 static const char *proc2 = 
+"#line 71 \"[executable]/import_clr.sql\"\n"
 "create procedure DB.DBA.CLR_CREATE_LIBRARY_UI (in asm_name varchar, in mtd_name varchar, in perm_mode integer)\n"
 "{\n"
 "\n"
@@ -58,17 +61,19 @@ static const char *proc2 =
 "\n"
 "DB..import_clr (short_name, mtd_name, unrestricted => perm_mode);\n"
 "}\n"
-"--src import_clr.sql:70\n";
+"--src import_clr.sql:69\n";
 
 static const char *proc3 = 
+"#line 89 \"[executable]/import_clr.sql\"\n"
 "create procedure DB.DBA.CLR_CREATE_ASSEMBLY (in asm_name varchar, in internal_name varchar,\n"
 "in auto_register integer, in perm_mode integer)\n"
 "{\n"
 "DB.DBA.CLR_CREATE_LIBRARY (asm_name, internal_name, auto_register, perm_mode);\n"
 "}\n"
-"--src import_clr.sql:88\n";
+"--src import_clr.sql:87\n";
 
 static const char *proc4 = 
+"#line 97 \"[executable]/import_clr.sql\"\n"
 "create procedure DB.DBA.CLR_DROP_LIBRARY (in internal_name varchar)\n"
 "{\n"
 "if (exists (select 1 from DB.DBA.CLR_VAC where VAC_INTERNAL_NAME = internal_name))\n"
@@ -78,7 +83,7 @@ static const char *proc4 =
 "commit work;\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:96\n";
+"--src import_clr.sql:95\n";
 
 static const char *udt0 = 
 "create type Assembly language clr external name \'mscorlib/System.Reflection.Assembly\'\n"
@@ -162,6 +167,7 @@ static const char *udt5 =
 "\n";
 
 static const char *proc5 = 
+"#line 190 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_ref_import (in assm_names varchar, in classes varchar, in unrestricted integer := 0,\n"
 "in _is_add_virtual integer := 0)\n"
 "{\n"
@@ -304,9 +310,10 @@ static const char *proc5 =
 "\n"
 "return ses;\n"
 "}\n"
-"--src import_clr.sql:189\n";
+"--src import_clr.sql:188\n";
 
 static const char *proc6 = 
+"#line 334 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_describe_class_type (inout ses any, in class _Type, in _is_add_virtual integer,\n"
 "in _base_type_str varchar, in under_name varchar, inout _base_type _Type)\n"
 "{\n"
@@ -460,9 +467,10 @@ static const char *proc6 =
 "idx := idx + 1;\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:333\n";
+"--src import_clr.sql:332\n";
 
 static const char *proc7 = 
+"#line 490 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_describe_parameters (inout ses any, in parameters any)\n"
 "{\n"
 "declare _name, _type_s, _type_esc_s, _pltype, _soaptype, _reftype varchar;\n"
@@ -513,9 +521,10 @@ static const char *proc7 =
 "\n"
 "ses_print (\'\\n</parameters>\', ses);\n"
 "}\n"
-"--src import_clr.sql:489\n";
+"--src import_clr.sql:488\n";
 
 static const char *proc8 = 
+"#line 542 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_describe_returns (inout ses any, in _type _Type)\n"
 "{\n"
 "declare _type_s, _type_esc_s varchar;\n"
@@ -533,9 +542,10 @@ static const char *proc8 =
 "_type_esc_s, _type_s,\n"
 "cast (clr_type_to_schema_type (_type_s, _is_primitive, _is_array) as varchar), _plescape), ses);\n"
 "}\n"
-"--src import_clr.sql:541\n";
+"--src import_clr.sql:540\n";
 
 static const char *proc9 = 
+"#line 561 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_type_is_primitive (in clr_type varchar)\n"
 "{\n"
 "clr_type := cast (clr_type as varchar);\n"
@@ -552,9 +562,10 @@ static const char *proc9 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src import_clr.sql:560\n";
+"--src import_clr.sql:559\n";
 
 static const char *proc10 = 
+"#line 579 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_type_to_pl_type (in clr_type varchar, in is_primitive int,\n"
 "in is_array int, inout _plescape int)\n"
 "returns varchar\n"
@@ -577,9 +588,10 @@ static const char *proc10 =
 "_plescape := 1;\n"
 "return clr_type;\n"
 "}\n"
-"--src import_clr.sql:578\n";
+"--src import_clr.sql:577\n";
 
 static const char *proc11 = 
+"#line 603 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_type_to_schema_type (in clr_type varchar, in is_primitive int, in is_array int)\n"
 "{\n"
 "clr_type := cast (clr_type as varchar);\n"
@@ -595,24 +607,27 @@ static const char *proc11 =
 "\n"
 "return clr_type;\n"
 "}\n"
-"--src import_clr.sql:602\n";
+"--src import_clr.sql:601\n";
 
 static const char *proc12 = 
+"#line 620 \"[executable]/import_clr.sql\"\n"
 "create procedure if_array (in clr_type varchar)\n"
 "{\n"
 "if (strstr (clr_type, \'[\')) return 1;\n"
 "return 0;\n"
 "}\n"
-"--src import_clr.sql:619\n";
+"--src import_clr.sql:618\n";
 
 static const char *proc13 = 
+"#line 627 \"[executable]/import_clr.sql\"\n"
 "create procedure ses_print (in _in any, inout ses any)\n"
 "{\n"
 "http (_in, ses);\n"
 "}\n"
-"--src import_clr.sql:626\n";
+"--src import_clr.sql:625\n";
 
 static const char *proc14 = 
+"#line 633 \"[executable]/import_clr.sql\"\n"
 "create procedure import_clr (in files any, in classes any, in _is_write_output integer := 0,\n"
 "in unrestricted integer := 0, in _is_return_sql integer := 0)\n"
 "{\n"
@@ -652,9 +667,10 @@ static const char *proc14 =
 "if (_is_return_sql)\n"
 "return  clr_make_human_read (all_pl);\n"
 "}\n"
-"--src import_clr.sql:632\n";
+"--src import_clr.sql:631\n";
 
 static const char *proc15 = 
+"#line 674 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_make_human_read (in _res varchar)\n"
 "{\n"
 "_res := replace (_res, \'    \', \' \');\n"
@@ -710,7 +726,7 @@ static const char *proc15 =
 "\n"
 "return _res;\n"
 "}\n"
-"--src import_clr.sql:673\n";
+"--src import_clr.sql:672\n";
 
 static const char *udt6 = 
 "create type \"Virt_aspx_VirtHost\"\n"
@@ -733,14 +749,16 @@ static const char *udt6 =
 "\n";
 
 static const char *proc16 = 
+"#line 753 \"[executable]/import_clr.sql\"\n"
 "create procedure WS.WS.__http_handler_asmx (in full_name varchar, inout params any,\n"
 "inout lines any, inout hdl_mode any)\n"
 "{\n"
 "return WS.WS.__http_handler_aspx (full_name, params, lines, hdl_mode);\n"
 "}\n"
-"--src import_clr.sql:752\n";
+"--src import_clr.sql:751\n";
 
 static const char *proc17 = 
+"#line 760 \"[executable]/import_clr.sql\"\n"
 "create procedure\n"
 "aspx_get_host (in lines any)\n"
 "{\n"
@@ -756,9 +774,10 @@ static const char *proc17 =
 "}\n"
 "return ret;\n"
 "}\n"
-"--src import_clr.sql:759\n";
+"--src import_clr.sql:758\n";
 
 static const char *proc18 = 
+"#line 778 \"[executable]/import_clr.sql\"\n"
 "create procedure WS.WS.__http_handler_aspx (in full_name varchar, inout params any,\n"
 "inout lines any, inout hdl_mode any)\n"
 "{\n"
@@ -882,9 +901,10 @@ static const char *proc18 =
 "\n"
 "return cast (ret [0] as varchar);\n"
 "}\n"
-"--src import_clr.sql:777\n";
+"--src import_clr.sql:776\n";
 
 static const char *proc19 = 
+"#line 904 \"[executable]/import_clr.sql\"\n"
 "create procedure\n"
 "aspx_sys_mkdir (in path varchar)\n"
 "{\n"
@@ -909,9 +929,10 @@ static const char *proc19 =
 "idx := idx + 1;\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:903\n";
+"--src import_clr.sql:902\n";
 
 static const char *proc20 = 
+"#line 931 \"[executable]/import_clr.sql\"\n"
 "create procedure\n"
 "aspx_copy_dav_dir_to_file_system (in dav_path varchar, in abs_path varchar, out path varchar)\n"
 "{\n"
@@ -949,9 +970,10 @@ static const char *proc20 =
 "}\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:930\n";
+"--src import_clr.sql:929\n";
 
 static const char *proc21 = 
+"#line 971 \"[executable]/import_clr.sql\"\n"
 "create procedure unimport_clr (in files any, in classes any, in _is_write_output integer := 0)\n"
 "{\n"
 "declare _xml, _xmlv any;\n"
@@ -998,9 +1020,10 @@ static const char *proc21 =
 "}\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:970\n";
+"--src import_clr.sql:969\n";
 
 static const char *proc22 = 
+"#line 1020 \"[executable]/import_clr.sql\"\n"
 "create procedure import_get_types_int (in sel_name varchar)\n"
 "{\n"
 "declare asm Assembly;\n"
@@ -1066,9 +1089,10 @@ static const char *proc22 =
 "\n"
 "return vector ();\n"
 "}\n"
-"--src import_clr.sql:1019\n";
+"--src import_clr.sql:1018\n";
 
 static const char *proc23 = 
+"#line 1100 \"[executable]/import_clr.sql\"\n"
 "create procedure import_clr_grant_to_public (in files any, in classes any)\n"
 "{\n"
 "declare _xml, _xmlv any;\n"
@@ -1090,9 +1114,10 @@ static const char *proc23 =
 "}\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:1099\n";
+"--src import_clr.sql:1098\n";
 
 static const char *proc24 = 
+"#line 1123 \"[executable]/import_clr.sql\"\n"
 "create procedure import_get_assem_names\n"
 "(inout assem_name varchar, inout full_name varchar, inout short_name varchar)\n"
 "{\n"
@@ -1120,7 +1145,7 @@ static const char *proc24 =
 "short_name := \"LEFT\" (full_name, strstr (full_name, \',\'));\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:1122\n";
+"--src import_clr.sql:1121\n";
 
 #undef isp_schema
 #define isp_schema(x) isp_schema_1(x)
diff --git a/binsrc/hosting/mono/tests/Makefile.in b/binsrc/hosting/mono/tests/Makefile.in
index e2027ef..7e5bf00 100644
--- a/binsrc/hosting/mono/tests/Makefile.in
+++ b/binsrc/hosting/mono/tests/Makefile.in
@@ -162,6 +162,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/hosting/perl/Makefile.in b/binsrc/hosting/perl/Makefile.in
index 789c129..b541e4c 100644
--- a/binsrc/hosting/perl/Makefile.in
+++ b/binsrc/hosting/perl/Makefile.in
@@ -209,6 +209,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/hosting/php/Makefile.in b/binsrc/hosting/php/Makefile.in
index d397727..14f1cce 100644
--- a/binsrc/hosting/php/Makefile.in
+++ b/binsrc/hosting/php/Makefile.in
@@ -207,6 +207,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/hosting/php/hosting_php.c b/binsrc/hosting/php/hosting_php.c
index e966676..26a0b2a 100644
--- a/binsrc/hosting/php/hosting_php.c
+++ b/binsrc/hosting/php/hosting_php.c
@@ -1,7 +1,7 @@
 /*
  *  hosting_php.c
  *
- *  $Id: hosting_php.c,v 1.4 2008/04/23 10:54:26 source Exp $
+ *  $Id: hosting_php.c,v 1.4.2.1 2010/11/08 12:35:44 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -22,6 +22,8 @@
  *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#undef MALLOC_DEBUG
+
 #include "import_gate_virtuoso.h"
 #include "hosting.h"
 #include "sqlver.h"
@@ -237,6 +239,7 @@ virtm_http_handler (void *cli, char *err, int max_len,
   memset (&file_handle, 0, sizeof (file_handle));
   file_handle.type = ZEND_HANDLE_FILENAME;
   file_handle.filename = SG (request_info).path_translated;
+  file_handle.free_filename = 0;
 
   if (php_request_startup (TSRMLS_C) != FAILURE)
     {
@@ -249,9 +252,8 @@ virtm_http_handler (void *cli, char *err, int max_len,
   hret[1] = (box_t) strses_string (req.r_hdr_session);
   *head_ret = (char *) hret;
 
-  ret_str = strses_string (req.ret_session);
+  ret_str = req.ret_session;
 
-  strses_free (req.ret_session);
   strses_free (req.s_hdr_session);
   strses_free (req.r_hdr_session);
 
@@ -307,6 +309,7 @@ bif_php_str (caddr_t *qst, caddr_t *err, state_slot_t **args)
       memset (&file_handle, 0, sizeof (file_handle));
       file_handle.type = ZEND_HANDLE_FILENAME;
       file_handle.filename = tmpfn;
+      file_handle.free_filename = 0;
 
       php_execute_script (&file_handle TSRMLS_CC);
 
@@ -640,7 +643,7 @@ PHP_MINFO_FUNCTION (virtuoso)
   php_info_print_table_start ();
   php_info_print_table_row (2, "Plugin Version", DBMS_SRV_VER);
   php_info_print_table_row (2, "Build Date", __DATE__);
-  php_info_print_table_row (2, "Revision", "$Revision: 1.4 $");
+  php_info_print_table_row (2, "Revision", "$Revision: 1.4.2.1 $");
   php_info_print_table_end ();
 
   DISPLAY_INI_ENTRIES ();
diff --git a/binsrc/hosting/python/Makefile.in b/binsrc/hosting/python/Makefile.in
index 7c5e349..11fe8bc 100644
--- a/binsrc/hosting/python/Makefile.in
+++ b/binsrc/hosting/python/Makefile.in
@@ -212,6 +212,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/hosting/python/hosting_python.c b/binsrc/hosting/python/hosting_python.c
index 527ff13..b1be0a0 100644
--- a/binsrc/hosting/python/hosting_python.c
+++ b/binsrc/hosting/python/hosting_python.c
@@ -1,7 +1,7 @@
 /*
  *  hosting_python.c
  *
- *  $Id: hosting_python.c,v 1.2.2.1 2010/04/14 13:55:08 source Exp $
+ *  $Id: hosting_python.c,v 1.2.2.2 2011/01/25 14:29:06 source Exp $
  *
  *  Virtuoso Python hosting plugin
  *  
@@ -109,14 +109,16 @@ start_python_interpreter (char *err, int max_len)
 
   PyEval_AcquireLock();
   tstate = Py_NewInterpreter ();
-  define_virtuoso_module (tstate->interp);
 
   if (!tstate)
     {
-      SET_ERR ("Unable to start the Python interpretter");
+      SET_ERR ("Unable to start the Python interpreter");
     }
-  else
-    interp = tstate->interp;
+
+  interp = tstate->interp;
+
+  define_virtuoso_module (interp);
+
   PyThreadState_Clear (tstate);
   PyEval_ReleaseThread(tstate);
   PyThreadState_Delete (tstate);
@@ -131,7 +133,7 @@ init_python_thread (PyInterpreterState *istate, char *err, int max_len)
 
   if (!tstate)
     {
-      SET_ERR ("Unbale to make a thread state");
+      SET_ERR ("Unable to make a thread state");
       return NULL;
     }
   PyEval_AcquireThread(tstate);
diff --git a/binsrc/hosting/ruby/Makefile.in b/binsrc/hosting/ruby/Makefile.in
index 2a40ead..55fc106 100644
--- a/binsrc/hosting/ruby/Makefile.in
+++ b/binsrc/hosting/ruby/Makefile.in
@@ -210,6 +210,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/isparql/Makefile.in b/binsrc/isparql/Makefile.in
index d9d5d3d..b608c28 100644
--- a/binsrc/isparql/Makefile.in
+++ b/binsrc/isparql/Makefile.in
@@ -186,6 +186,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/isparql/auth.vsp b/binsrc/isparql/auth.vsp
index 6c0e6ee..385f255 100644
--- a/binsrc/isparql/auth.vsp
+++ b/binsrc/isparql/auth.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: auth.vsp,v 1.4.2.1 2009/06/10 19:49:06 source Exp $
+--  $Id: auth.vsp,v 1.4.2.3 2011/01/25 14:08:45 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -22,27 +22,9 @@
 --
 --
 
-  declare _u_name varchar;
-  declare _u_password varchar;
-
-  _u_name := get_keyword ('username', params);
-  if (_u_name = '' or isnull (_u_name)) goto nf;
-
-  {
-    whenever not found goto nf;
-    select U_PWD
-      into _u_password from WS.WS.SYS_DAV_USER
-     where U_NAME = _u_name and U_ACCOUNT_DISABLED = 0;
-  }
-  if (_u_password is null) goto nf;
-
-  if (DB.DBA.vsp_auth_verify_pass (vector('authtype','basic','username',_u_name,'pass',get_keyword ('pass', params,'')), _u_name,'','','','','','',_u_password))
-	{
-	  http('OK');
-	  return;
-  }
-
-  nf:;
-  http('Unauthorized');
+-- This page used to be evil. Full of goodness now.
 
+  http_rewrite();
+  http_request_status ('HTTP/1.1 400 Bad Request');
+  http('Not available. Begone.');
 ?>
diff --git a/binsrc/isparql/defaults.js b/binsrc/isparql/defaults.js
index 7982ee7..83c0d5c 100644
--- a/binsrc/isparql/defaults.js
+++ b/binsrc/isparql/defaults.js
@@ -1,14 +1,19 @@
 if (typeof iSPARQL == 'undefined')
     iSPARQL = {};
 
+iSPARQL.addthis_loaded = false;
+
 iSPARQL.Defaults = {
     endpoints: [ "/sparql",
 		 "http://uriburner.com/sparql",
 		 "http://dbpedia.org/sparql",
+                 "http://loc.openlinksw.com/sparql",
 		 "http://lod.openlinksw.com/sparql",
 		 "http://bbc.openlinksw.com/sparql",
 		 "http://demo.openlinksw.com/sparql",
 		 "http://myopenlink.net:8890/sparql/",
+		 "http://linkedgeodata.org/sparql",
+		 "http://sparql.reegle.info/",
 //		 "http://www.govtrack.us/sparql",
 		 "http://services.data.gov.uk/education/sparql",
 		 "http://services.data.gov.uk/crime/sparql",
@@ -36,12 +41,24 @@ iSPARQL.Defaults = {
     grabAll:      false,
     graph:        '',
     queryTimeout: 2000, // ms
-    auth:         {user:'dav',pass:'dav',endpoint:'./auth.vsp'},
+    auth:         {user:'dav',password:'dav'},
     tab:          0,
+    anchorMode:   0, /* 0:describe, 1:get data items,2:Open in new window */
     maxrows:      50,
+    view:         1,
     endpoint:     '/sparql',
+    pivotInstalled: false,
+    addthis_key: false,
+    locOpts: {             /* XXX all except minAcc not implemented yet */
+	cacheLocTO:  2000, /* Milliseconds timeout to improve non-expired cached location accuracy */
+	coarseLocTO: 2000, /* Milliseconds to wait for coarse loc in last cached location validation attempt */
+	minAcc:      500,  /* default min. accuracy requested for location queries, in metres, after which the query fires */
+	autoApply:   true, /* Automatically execute location query when min. accuracy is achieved. */
+	cacheExpiry: 10    /* minutes a cached location is deemed accurate */
+    },
 
  /* See maps.js indexed by OAT.Map.TYPE_* */
+
     mapProviderNames: [
 	"None", 
 	"Google Maps", 
@@ -58,22 +75,27 @@ iSPARQL.Defaults = {
 	var qp = false;
 	var p = OAT.Dom.uriParams();
 	
-	if (p['default-graph-uri']) { iSPARQL.Defaults.graph = p['default-graph-uri']; qp = true; }
-	if (p['defaultGraph'])      { iSPARQL.Defaults.graph = p['defaultGraph']; qp = true; }
-	if (p['query'])             { iSPARQL.Defaults.query = p['query']; qp = true; }
-	if (p['sponge'])            { iSPARQL.Defaults.sponge = p['sponge']; qp = true; }
-	if (p['should_sponge'])     { iSPARQL.Defaults.sponge = p['should_sponge']; qp = true; }
+	if (p['default-graph-uri']) { iSPARQL.Settings.graph  = p['default-graph-uri']; qp = true; }
+	if (p['defaultGraph'])      { iSPARQL.Settings.graph  = p['defaultGraph']; qp = true; }
+	if (p['query']) { 
+	    iSPARQL.Settings.query  = p['query']; 
+	    qp = true; 
+	}
+	if (p['sponge'])            { iSPARQL.Settings.sponge = p['sponge']; qp = true; }
+	if (p['should_sponge'])     { iSPARQL.Settings.sponge = p['should_sponge']; qp = true; }
 	if (p['view']) {
-	    var tabInx = parseInt(page_params['view']);
-	    if (!isNaN(tabInx) && tabinx >= 0 && tabInx < 3)
-		iSPARQL.Defaults.tab = tabInx;
+	    var tabInx = parseInt(p['view']);
+	    if (!isNaN(tabInx) && tabInx >= 0 && tabInx < 3)
+		iSPARQL.Settings.tab = tabInx;
+	    else 
+		iSPARQL.Settings.tab = 1;
 	    qp = true;
 	}
-	if (p['endpoint']) { iSPARQL.Defaults.endpoint = p['endpoint']; qp = true;}
-	if (p['resultview']) { iSPARQL.Defaults.resultView = p['resultview']; qp = true;}
-	if (qp) iSPARQL.Defaults.qp_override = qp;
-	if (p['__DEBUG']) iSPARQL.Preferences.debug = true;
-	if (p['maxrows']) iSPARQL.Defaults.maxrows = parseInt(p['maxrows']);
+	if (p['endpoint']) { iSPARQL.Settings.endpoint = p['endpoint']; qp = true;}
+	if (p['resultview']) { iSPARQL.Settings.resultView = p['resultview']; qp = true;}
+	if (qp) iSPARQL.Settings.qp_override = qp;
+	if (p['__DEBUG']) iSPARQL.Settings.debug = true;
+	if (p['maxrows']) iSPARQL.Settings.maxrows = parseInt(p['maxrows']);
     },
 
     //
@@ -135,33 +157,16 @@ iSPARQL.Defaults = {
 	    iSPARQL.Defaults.map_type = OAT.Map.TYPE_OL;
 	    break;
 	}
-	iSPARQL.Defaults.handlePageParams();
     }
-    
 };
 
 // curie, prefix, selected by default
 
 
-iSPARQL.Preferences = {
+iSPARQL.Settings = {
     xslt:'/isparql/xslt/',
     debug:true
-};
+}
+
+
 
-// Should be taken care by init.
-
-/* var iSPARQL = {
-    dataObj:{
-	data:false,
-	query:"",
-	endpoint:"",
- 	defaultGraph:"",
-	graphs:[],
-	namedGraphs:[],
-	prefixes:[],			// FIXME: prefixes?
-	pragmas:[],
-	canvas:false,
-	metaData:false
-        maxrows: 0;
-    }
-};*/
\ No newline at end of file
diff --git a/binsrc/isparql/defaults.vsp b/binsrc/isparql/defaults.vsp
index 5a05702..b12ec8b 100644
--- a/binsrc/isparql/defaults.vsp
+++ b/binsrc/isparql/defaults.vsp
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <?vsp 
 --  
---  $Id: defaults.vsp,v 1.1.2.5 2010/04/26 07:53:25 source Exp $
+--  $Id: defaults.vsp,v 1.1.2.9 2011/03/08 13:09:00 source Exp $
 --  
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -69,12 +69,27 @@
   api_key := registry_get ('iSPARQL_API_KEY');
   if (0 = api_key) api_key := '';
   
+  declare pivot_installed varchar;
+  pivot_installed := 'false';
+
+  if (DB.DBA.VAD_CHECK_VERSION('PivotViewer') is not NULL)
+      pivot_installed := 'true';
+
+  declare curi_installed varchar;
+  curi_installed := 'false';
+
+  if (DB.DBA.VAD_CHECK_VERSION('c_uri') is not NULL)
+	curi_installed := 'true';
+
+  declare addthis_key varchar;
+  addthis_key := registry_get ('iSPARQL_ADDTHIS_KEY');
+
+  if ('1' = addthis_key) addthis_key := 'xa-4ce13e0065cdadc0';
 ?>
 {  graph: '<?vsp http(replace(default_dgu,'\'','\\\'')); ?>',
    query: '<?vsp http(replace(def_qry,'\'','\\\'')); ?>',
    sponge:'<?vsp http(replace(fixed_sponge,'\'','\\\'')); ?>',
    auth: {
-       endpoint:'./auth.vsp',
        user:    '<?vsp http(replace(default_user,'\'','\\\'')); ?>',
        pass:    '<?vsp http(replace(default_pass,'\'','\\\'')); ?>'
    },<?vsp 
@@ -85,5 +100,12 @@
 ?>
    map_type: '<?= map_type ?>',
    api_key: '<?=api_key ?>',
+<?vsp if (0 = addthis_key) { ?>
+   addthis_key: false,
+<?vsp } else { ?>
+   addthis_key: '<?= addthis_key ?>',
+<?vsp } ?>
+   pivotInstalled: <?= pivot_installed ?>,
+   curiInstalled: <?= curi_installed ?>,
    setup_done: <?= setup_done ?>
 }
diff --git a/binsrc/isparql/execute.html b/binsrc/isparql/execute.html
index 3b123f5..0195750 100644
--- a/binsrc/isparql/execute.html
+++ b/binsrc/isparql/execute.html
@@ -3,7 +3,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <!--
 
-  $Id: execute.html,v 1.12.2.10 2010/03/12 09:01:02 source Exp $
+  $Id: execute.html,v 1.12.2.17 2011/03/29 11:03:35 source Exp $
 
   This file is part of the OpenLink Ajax Toolkit (OAT) project
 
@@ -26,26 +26,31 @@
 <head>
 
   <script type="text/javascript">
-window.YMAPPID = 'yahoo-id';
-var featureList=["ajax","json","dimmer","grid","anchor","resize","xml","tab","sparql","rdfstore","rdfmini","map","ghostdrag"];
-function init() {
-  var startRef = function() {
-    OAT.Dom.show("throbber");
-    OAT.Dom.hide("result");
-  }
+var featureList=["ajax","json","dimmer","grid","anchor","resize","xml","tab",
+                 "sparql","rdfstore","rdfmini","map","ghostdrag"];
 
-  var endRef = function() {
-    OAT.Dom.hide("throbber");
-    OAT.Dom.show("result");
-  }
+function locCancelH() {
+  
+}
+
+function init() {
 
+  OAT.Dom.hide("result");
   OAT.Event.attach("throbber","click",OAT.AJAX.cancelAll);
   OAT.Preferences.imagePath = "/isparql/toolkit/images/";
 
   var qe = new QueryExec({div:"result"});
+  OAT.MSG.attach(qe, "iSPARQL_QE_DONE", function (m,s,l) { iSPARQL.StatusUI.hide(); OAT.Dom.show("result") });
 
   iSPARQL.Defaults.init();
 
+  for (i in iSPARQL.Defaults)
+    iSPARQL.Settings[i] = iSPARQL.Defaults[i];
+
+  iSPARQL.Defaults.handlePageParams();
+
+  iSPARQL.StatusUI.init();
+
   var opts = OAT.Dom.uriParams();
 
   if ("file" in opts) {
@@ -58,17 +63,24 @@ function init() {
     f.appendChild(a);
   }
 
-  OAT.Dom.hide("throbber");
+  var lc = [];
 
-  iSPARQL.locationCache = new iSPARQL.LocationCache (10, [], true);
+  if (qe.detectLocationMacros(iSPARQL.Settings.query)) {
+    iSPARQL.StatusUI.statMsg ("Initializing geolocation service …");
 
-  if (qe.detectLocationMacros(iSPARQL.Defaults.query)) {
-    var loc = new iSPARQL.locationAcquireUI ({useCB: qe.executeWithLocation, 
+    if (!iSPARQL.locationCache) {
+      if (!!localStorage && !!localStorage.iSPARQL_locationCache)
+	lc = localStorage.iSPARQL_locationCache;
+	iSPARQL.locationCache = new iSPARQL.LocationCache (10, lc, true);
+      }
+      var locUI = new iSPARQL.locationAcquireUI ({useCB: qe.executeWithLocation, 
                                               cancelCB: false,
-					      cbParm: iSPARQL.Defaults,
+		                                  cbParm: iSPARQL.Settings,
 					      cache: iSPARQL.locationCache});
+      iSPARQL.StatusUI.hide();
+      locUI.refresh();
   } else {
-    qe.execute(iSPARQL.Defaults);
+      qe.execute(iSPARQL.Settings);
   }   
 }
   </script>
@@ -83,6 +95,8 @@ function init() {
   <meta name="viewport" content="width = device-width"/>
 
   <link rel="apple-touch-icon" href="/isparql/images/mob_home_icon.png"/>
+  <meta name="apple-mobile-web-app-capable" content="yes" />
+  <meta name="apple-mobile-web-status-bar-style" content="black-translucent" />
 
   <link type="text/css" rel="stylesheet" href="/isparql/styles/execute.css"/>
   <link type="text/css" rel="stylesheet" href="/isparql/styles/dialog.css"/>
@@ -95,26 +109,71 @@ function init() {
 </head>
 
 <body>
-  <div id="file"></div><p></p>
-  <div id="throbber" style="text-align: center;">
-    <div id="expln">
-      <img style="margin: auto; cursor:pointer;" src="/isparql/toolkit/images/throbber.gif" />
+  <div id="file"></div>
+  <div id="splash">
+    <div id="splash_inner">
+      <div id="splash_hd">
+        <img src="images/openlinklogo_wstrap_2008_no_motto.png" alt="OpenLink Software"/>
+      </div>
+      <div class="msg" id="statMsgMain">iSPARQL Initialization</div>
+      <div class="msg" id="statMsgElem">Loading</div>
+	
+      <img src="/isparql/toolkit/images/throbber.gif" id="splashThrobber" style="display:none"/>
+
+      <noscript>
+        <img src="/isparql/images/stop_32.png" alt="error"/>
+        <div class="error statMsgError">
+          iSPARQL cannot work without JavaScript<br/>
+	  Either your browser has no JavaScript, or it is currently disabled.
     </div>
-  </div> <!-- throbber -->
+      </noscript>
+
+      <img src="/isparql/images/stop_32.png" alt="error" id="splashErrorImg" style="display:none"/>
+      <div class="error" id="statMsgErr"></div>
+      <div id="splash_ver"></div>
+      <div id="splash_copyr">Copyright © 2006-2011 OpenLink Software</div>
+      <div id="splash_foot" class="opl_motto">Making Technology Work For You ™</div>
+    </div> <!-- #splash_inner -->
+  </div> <!-- #splash -->
 
   <div id="locAcquireUI" style="display:none">
     <div id="locAcquireUI_inner">
       <div id="locAcquireMsg">
-        <h3>Acquiring location <img id="locAcquireThrobber" src="/isparql/toolkit/images/throbber.gif"/></h3>
+        <div id="locAcquireTitleC">
+	  <h3 id="locAcquireTitleT">Locating</h3>
+          <img id="locAcquireThrobber" alt="throbber" src="/isparql/toolkit/images/throbber_small.gif"/>
+        </div>
         <table id="locAcquireCurrent">
-          <tr><th>Latitude</th><td id="locAcquireLatCtr">N/A</td></tr>
-          <tr><th>Longitude</th><td id="locAcquireLonCtr">N/A</td></tr>
-          <tr><th>Accuracy</th><td id="locAcquireAccCtr">N/A</td></tr>
+          <tr>
+            <td><label for="locAcquireManualLatInput">Latitude</label></td>
+            <td id="locAcquireLatCtr">
+	      <input type="text" 
+                     class="locAcquireForm" 
+                     id="locAcquireManualLatInput"/>
+            </td>
+          </tr>
+          <tr>
+	    <td><label for="locAcquireManualLonInput">Longitude</label></td>
+	    <td id="locAcquireLonCtr">
+	      <input type="text" 
+                     class="locAcquireForm" 
+                     id="locAcquireManualLonInput"/>
+            </td>
+          </tr>
+          <tr>
+            <td>Accuracy</td>
+            <td id="locAcquireAccCtr">N/A</td></tr>
         </table>
       </div>
+      <div id="locAcquireGeocodeForm" style="display:none">
+        <label for="locAcquireAddrInput"></label>
+        <input type="text" class="locAcquireForm" id="locAcquireAddrInput"/>
+      </div>
       <div id="locAcquireErrMsg"></div>
       <div id="locAcquireBtnCtr">
         <button id="locAcquireUseBtn">Use</button>
+	<button id="locAcquireGeocodeBtn">Enter Address</button>
+	<button id="locAcquireManualBtn">Manual</button>
         <button id="locAcquireRefreshBtn">Refresh</button>
         <button id="locAcquireCancelBtn">Cancel</button>
       </div>
@@ -123,9 +182,11 @@ function init() {
   <div id="result">
   </div>
   <p class="copyright">
-    Dynamic <a href="http://dbpedia.org/resource/linkeddata">Linked Data Page</a><br/>
+    <span class="dyn_page">Dynamic <a href="http://dbpedia.org/resource/linkeddata">Linked Data Page</a></span>
     <a href="http://www.openlinksw.com/virtuoso">
-      <img border="0" src="/isparql/images/virt_power_no_border.png" alt="Powered by OpenLink Virtuoso Universal Server"/>
+      <img border="0" 
+           src="/isparql/images/virt_power_no_border.png" 
+           alt="Powered by OpenLink Virtuoso Universal Server"/>
     </a>
   </p>
 </body>
diff --git a/binsrc/isparql/execute.js b/binsrc/isparql/execute.js
index e7aaef9..c0bd6d8 100644
--- a/binsrc/isparql/execute.js
+++ b/binsrc/isparql/execute.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: execute.js,v 1.32.2.18 2010/06/28 09:33:06 source Exp $
+ *  $Id: execute.js,v 1.32.2.33 2011/03/29 22:51:20 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -13,6 +13,8 @@
 	iSPARQL query executer & visualizer
 */
 
+// XXX move defaultPrefixes to be handled by defaults.js
+
 window.defaultPrefixes = [
 				 		 {"label":'foaf', "uri":'http://xmlns.com/foaf/0.1/'},
 						 {"label":'owl', "uri":'http://www.w3.org/2002/07/owl#'},
@@ -55,6 +57,16 @@ window.defaultPrefixes = [
     {"label":'dbpedia',    "uri":'http://dbpedia.org/resource/'}
 ];
 
+iSPARQL.ResultType = {
+    RESSET: 0,
+    GRAPH: 1,
+    ERROR: 666
+};
+
+//
+// XXX any object put in CircularBuffer must have a serialize() method
+//
+
 iSPARQL.CircularBuffer = function (len, initList) {
     var self = this;
     this._length = len;
@@ -62,6 +74,35 @@ iSPARQL.CircularBuffer = function (len, initList) {
     this._ptr = 0;
     this._fill = 0;
 
+	this.serialize = function () {
+		var ser_buf = [];
+		for (i = 1;i<self._buf.length;i++) {
+			if (typeof self._buf[i] == 'object')
+				ser_buf[i] = self._buf[i].serialize();
+			else ser_buf[i] = self._buf[i];
+		}
+
+		var o = {
+			buf: self.ser_buf,
+			length: self._length,
+			ptr: self._ptr,
+			fill: self._fill
+		}
+		return OAT.JSON.serialize (o);
+	}
+
+	this.initFromSerialized = function (s) {
+		var o = OAT.JSON.deserialize (s);
+		if (o != null) {
+			self._length = o.length;
+			self._buf = o.buf;
+			self._ptr = o.ptr;
+			self._fill = o.fill;
+			return true;
+		}
+		return false;
+	}
+
     this.append = function (item) {
 	if (self._fill < self._length) {
 	    self._buf.append(item);
@@ -167,15 +208,14 @@ var QueryExec = function(optObj) {
 	this.cacheIndex = -1;
 	this.dom = {};
 	this.tab = false;
-	this.store = new OAT.RDFStore(false);
 	this.mini = false;
     	this.miniplnk = false;
     	this.mRDFCtr = false;
 
 	this.init = function() {
 		this.dom.result = OAT.Dom.create("div");
-		this.dom.request = OAT.Dom.create("div");
-		this.dom.response = OAT.Dom.create("pre");
+		this.dom.request = OAT.Dom.create("div", {className:'ep_request'}); 
+		this.dom.response = OAT.Dom.create("pre",{className:'ep_response'});
 		this.dom.query = OAT.Dom.create("pre");
 //	this.dom.select = OAT.Dom.create("select");
 //	OAT.Dom.option("Machine-readable","1",this.dom.select);
@@ -215,7 +255,6 @@ var QueryExec = function(optObj) {
 		OAT.IRIDB.insertIRI (window.defaultPrefixes[i].uri, window.defaultPrefixes[i].label);
 	}
 
-	iSPARQL.StatusUI.statMsg ("Initializing geolocation service …");
     };
 
 	this.initNav = function() {
@@ -233,29 +272,39 @@ var QueryExec = function(optObj) {
 		self.dom.prev.title = "Back";
 		self.dom.next.title = "Forward";
 		self.dom.last.title = "Last";
-		OAT.Dom.append([self.dom.ul,self.dom.first,self.dom.prev,self.dom.next,self.dom.last]);
+		self.dom.pos_ind = OAT.Dom.create("li",{},"nav");
+		
+		OAT.Dom.append([self.dom.ul,self.dom.first,self.dom.prev,self.dom.pos_ind,self.dom.next,self.dom.last]);
+		
 		OAT.Event.attach(self.dom.first,"click",function(){
 			if (self.cacheIndex > 0) {
+				var old = self.cacheIndex;
 				self.cacheIndex = 0;
-				self.draw()
+				self.nav(old);
 			}
 		});
+		
 		OAT.Event.attach(self.dom.prev,"click",function(){
 			if (self.cacheIndex > 0) {
+				var old = self.cacheIndex;
 				self.cacheIndex--;
-				self.draw();
+				self.nav(old);
 			}
 		});
+		
 		OAT.Event.attach(self.dom.next,"click",function(){
 			if (self.cacheIndex > -1 && self.cacheIndex < self.cache.length-1) {
+				var old = self.cacheIndex;
 				self.cacheIndex++;
-				self.draw();
+				self.nav(old);
 			}
 		});
+		
 		OAT.Event.attach(self.dom.last,"click",function(){
 			if (self.cacheIndex > -1 && self.cacheIndex < self.cache.length-1) {
+				var old = self.cacheIndex;
 				self.cacheIndex = self.cache.length-1;
-				self.draw();
+				self.nav(old);
 			}
 		});
 		self.refreshNav();
@@ -285,6 +334,12 @@ var QueryExec = function(optObj) {
 			deactivate(self.dom.next);
 			deactivate(self.dom.last);
 		}
+		self.dom.pos_ind.innerHTML = 
+			'<span class="nav_pos_ind"><span class="nav_cache_pos">' + 
+			(self.cacheIndex + 1) + 
+			'</span>(<span class="nav_cache_max">' +
+			self.cache.length +
+			'</span>)</span>';
     };
 
     this.isNew = function(opts) {
@@ -338,20 +393,73 @@ var QueryExec = function(optObj) {
 		return arr.join("&");
     };
 
+    this.resultType = function(data) {
+		if (data.documentElement == null) return iSPARQL.ResultType.ERROR; // OPERA returns XMLDocument with all members null
+		if (data.documentElement.localName == "sparql")
+			return iSPARQL.ResultType.RESSET;
+		if (data.documentElement.localName == "RDF")
+			return iSPARQL.ResultType.GRAPH;
+		if (data.documentElement.localName == "parsererror")
+			return iSPARQL.ResultType.ERROR;
+    };
+	
+    //
+    // Cache incoming result set or graph
+    //
+	
      this.addResponse = function(request,opts,wasError,data) { /* Cache and visualize */
 		if (OAT.AnchorData.window) { OAT.AnchorData.window.close(); }
 
-	if (self.isNew(opts) || (self.cache[self.cacheIndex].wasError && !wasError)) {
-			var cache = {
-				opts:opts,
+		var rt;
+        var to = false;
+		
+		if (!wasError) {
+			rt = self.resultType (data);
+			if (rt == iSPARQL.ResultType.ERROR) wasError = true;
+		}
+		else {
+			rt = iSPARQL.ResultType.ERROR;
+			if (data.match (/Error SR171/))
+				to = true;
+		}
+		
+			var cacheItem = {
+				resType: rt,
 				wasError:wasError,
+				timeOut:to,
+				opts:opts,
 				request:request,
-				data:data
+				data:data,
+				txt:OAT.Xml.serializeXmlDoc (data),
+				store: new OAT.RDFStore(),
+				dom: {}
 			}
-			self.cache.push(cache);
+			
+			cacheItem.dom.query_c    = OAT.Dom.create ("div",{className: "query_c"});
+			cacheItem.dom.result_c   = OAT.Dom.create ("div",{className: "result_c"});
+			cacheItem.dom.request_c  = OAT.Dom.create ("div",{className: "request_c"});
+			cacheItem.dom.response_c = OAT.Dom.create ("div",{className: "response_c"});
+			
+		var req_href;
+		
+		if (opts.endpoint && !opts.endpoint.match (/^http/))
+			req_href = unescape(request.substring(4));
+		else
+			req_href = 
+			document.location.protocol + "//" +
+			document.location.host + "?" + request;
+		
+		if (rt == iSPARQL.ResultType.GRAPH)
+			var r_url = cacheItem.store.addXmlDoc(data, req_href); //, req_href);
+
+			var old = self.cacheIndex;
+		
+			self.cache.push(cacheItem);
 			self.cacheIndex = self.cache.length-1;
-		}
+
 		self.draw();
+
+		if (old>=0) self.nav(old);
     };
 
     this.makeMiniRDFPlinkURI = function (caller,msg,o) {
@@ -367,14 +475,95 @@ var QueryExec = function(optObj) {
 	if (opts.endpoint)
 	    xparm = xparm + "&endpoint="  + opts.endpoint;
 
-        xparm = xparm + "&resultview=" + self.mini.options.tabs[o.tabIndex][0];
+		xparm = xparm + "&resultview=" + item.mini.options.tabs[o.tabIndex][0];
 	xparm += "&maxrows=" + (opts.maxrows ? opts.maxrows : "");
-
+		xparm += "&view=" + opts.view;
 	plnk.target = "_blank";
 	plnk.href= nloca.protocol + "//" + nloca.host + "/isparql/view/" + xparm;
 
+		if (iSPARQL.Settings.shorten_uris) 
+			iSPARQL.Common.shortenURI (plnk);
+				
     }
 
+    this._makeAddThisURL = function (o) {
+		var item = self.cache[self.cacheIndex];
+		var opts = item.opts;
+		var request = item.request;
+		var plnk = self.addthis_ctr;
+		
+		var nloca = document.location;
+		
+		var xparm = "?query=" + encodeURIComponent(opts.query);
+		
+		if (opts.endpoint)
+			xparm = xparm + "&endpoint="  + opts.endpoint;
+
+		xparm = xparm + "&resultview=" + item.mini.options.tabs[o.tabIndex][0];
+		xparm += "&maxrows=" + (opts.maxrows ? opts.maxrows : "");
+		
+		plnk.target = "_blank";
+
+		var _u = nloca.protocol + "//" + nloca.host + "/isparql/view/" + xparm;
+		var _t = 'iSPARQL execute';
+
+		try {
+//			var addthis_share = { 
+//				url: _u, 
+//				title: _t,
+//				description: 'iSPARQL Query Execution Permalink'
+//			};
+
+			$('addthis_ctr').setAttribute('addthis:url', _u);
+			$('addthis_ctr').setAttribute('addthis:title', _t);
+
+			addthis.update('share','url',_u);
+			addthis.update('share','title',_t);
+			addthis.update('config','ui_cobrand','iSPARQL');
+
+			addthis.button ('#addthis_ctr'); //,{pubid:iSPARQL.Settings.addthis_key},addthis_share);
+			addthis.init();
+			
+			// XXX		if (iSPARQL.Settings.shorten_uris) 
+			//			iSPARQL.Common.shortenURI (plnk);
+			
+		} catch (e) {};
+	}
+
+	this.makeLoadHandler = function (c,m,o) {
+		return (function (e) {
+			iSPARQL.addthis_loaded=true;
+			self._makeAddThisURL(o)
+		});
+	}
+
+	this.makeLoadRSHandler = function (c,m,o,_s) {
+		return (function (e) {
+			if (_s.readyState == 'loaded' || script.readyState == 'complete') {
+				iSPARQL.addthis_loaded=true;
+				self._makeAddThisURL(o)
+			}
+		});
+	}
+
+	this.makeAddThisURL = function (caller, msg, o) {
+		if (!iSPARQL.addthis_loaded) {
+			var _s = document.createElement("script");
+			_s.type = "text/javascript";
+			
+			if (_s.addEventListener) {
+				_s.addEventListener("load", self.makeLoadHandler(caller,msg,o), false);
+				_s.addEventListener("error", function() { iSPARQL.addthis_loaded=false; } ,false);
+			} else {
+				_s.attachEvent("onreadystatechange", self.makeLoadRSHandler(caller,msg,o,_s));
+			}
+
+			_s.src = "http://s7.addthis.com/js/250/addthis_widget.js#username="+iSPARQL.Settings.addthis_key;
+			document.getElementsByTagName("head")[0].appendChild(_s);
+		}
+		else self._makeAddThisURL(o);
+	}
+    
     this.parseTabIndex = function (rvVal, tabs) {
 	for (var i=0;i < tabs.length;i++) {
 	    if (rvVal == tabs[i][0]) return i;
@@ -390,8 +579,8 @@ var QueryExec = function(optObj) {
     this.renderResultValue = function (val, opts) {
 	if (val.restype == self.RESULT_TYPE.URI) {
 	    var a = OAT.Dom.create("a");
-	    a.innerHTML = self.store.simplify (val.value);
-	    a.href="#";
+			a.innerHTML = self.cache[self.cacheIndex].store.simplify (val.value);
+	    a.href = val.value;
 	    self.processLink(a, val.value);
 	    return a;
 	}
@@ -483,7 +672,36 @@ var QueryExec = function(optObj) {
 	}
     };
 
-    this.makeExecPermalink = function () {
+//
+// XXX produces URLs which are invalid
+//
+    
+    this.makePivotPermalink = function (ctr) {
+	var item = self.cache[self.cacheIndex];
+	var opts = item.opts;
+
+	a = OAT.Dom.create("a");
+	a.innerHTML = "Make Pivot";
+	var xparm = document.location.protocol + '//' + document.location.host + 
+	    "/sparql/?query=" + encodeURIComponent(opts.query) + 
+	    "&endpoint=" + opts.endpoint;
+	xparm += "&maxrows=" + (opts.maxrows ? opts.maxrows : "");
+	xparm += "&default-graph-uri=" + (opts.defaultGraph ? opts.defaultGraph : "");
+	xparm += "&format=text/cxml";
+	a.href = document.location.protocol + '//' + document.location.host + 
+	    '/PivotViewer/' + "?url=" + encodeURIComponent(xparm);
+	a.target = "_blank";
+	var spc = OAT.Dom.create("span");
+		spc.innerHTML = " | ";
+
+		if (iSPARQL.Settings.shorten_uris)
+			iSPARQL.Common.shortenURI (a);
+		
+		OAT.Dom.append([ctr,a, spc]);
+		
+    };
+
+    this.makeExecPermalink = function (ctr) {
 	var item = self.cache[self.cacheIndex];
 	var opts = item.opts;
 	var request = item.request;
@@ -495,20 +713,43 @@ var QueryExec = function(optObj) {
 	var xparm = "?query=" + encodeURIComponent(opts.query) + "&endpoint="  + opts.endpoint;
 	xparm += "&maxrows=" + (opts.maxrows ? opts.maxrows : "");
 	xparm += "&default-graph-uri=" + (opts.defaultGraph ? opts.defaultGraph : "");
+		xparm += "&view=" + opts.view;
 
 	execURIa.href = nloca.protocol + "//" + nloca.host + "/isparql/view/" + xparm;
 	
+		if (iSPARQL.Settings.shorten_uris) 
+			iSPARQL.Common.shortenURI (execURIa);
+			
 	execURIa.target = "_blank";
 	
-	OAT.Dom.append([self.dom.result,execURIa]);
+		OAT.Dom.append([ctr,execURIa]);
     };
 
     this.drawSparqlResultSet = function (resSet) {
-	OAT.Dom.clear(self.dom.result);
+		var item = self.cache[self.cacheIndex];
+		self.dom.plnk_ctr = OAT.Dom.create("div", {className: "result_plnk_ctr"});
 
-	self.makeExecPermalink ();
-	
-	var grid = new OAT.Grid (self.dom.result);
+		if (iSPARQL.Settings.pivotInstalled) 
+			self.makePivotPermalink(self.dom.plnk_ctr);
+
+		self.makeExecPermalink (self.dom.plnk_ctr);
+
+		var anchor_pref_ctr = OAT.Dom.create("div", {className: "anchor_pref_ctr"});
+		anchor_label = OAT.Dom.create("label", {htmlFor: "anchor_pref_sel"});
+		anchor_label.innerHTML = "Anchor behavior:";
+		anchor_pref_sel = OAT.Dom.create ("select", {id: "anchor_pref_sel"});
+		anchor_pref_sel.options.add (new Option ("Describe",0));
+		anchor_pref_sel.options.add (new Option ("Get Data Items",1));
+		anchor_pref_sel.options.add (new Option ("Open Web Page",2));
+
+		OAT.Event.attach(anchor_pref_sel, 'change', function () {
+			iSPARQL.Settings.anchorMode = ($('anchor_pref_sel').selectedIndex);
+		});
+
+		OAT.Dom.append ([item.dom.result_c, self.dom.plnk_ctr, anchor_pref_ctr]);
+        OAT.Dom.append ([anchor_pref_ctr, anchor_label, anchor_pref_sel]);
+
+		var grid = new OAT.Grid (item.dom.result_c);
 	grid.createHeader(resSet.variables);
 
 	for (var z=0;z<resSet.results.length;z++) {
@@ -548,24 +789,9 @@ var QueryExec = function(optObj) {
 			}
 		}
 
-/*
-	var h = OAT.Dom.create("h3");
-		h.innerHTML = "This page is about:";
-	
-		if (entCount) {
-			var ul = OAT.Dom.create("ul");
-			for (var p in entities) {
-				var li = OAT.Dom.create("li");
-				ul.appendChild(li);
-				li.innerHTML = p;
-			}
-	    OAT.Dom.append([self.dom.result,ul]);
-		}
-*/	
-
 	self.makeExecPermalink ();
 
-	var data_root = self.store.data.all[0];
+		var data_root = self.cache[cacheIndex].store.data.all[0];
 		var ns_var = "http://www.w3.org/2005/sparql-results#resultVariable";
 		var ns_var2 = "http://www.w3.org/2005/sparql-results#variable";
 		var ns_sol = "http://www.w3.org/2005/sparql-results#solution";
@@ -618,7 +844,7 @@ var QueryExec = function(optObj) {
 
 					if (!value) value = "";
 
-					var simple = self.store.simplify(value);
+					var simple = self.cache[cacheIndex].store.simplify(value);
 					simplified_row[index] = simple;
 				}
 			}
@@ -630,7 +856,7 @@ var QueryExec = function(optObj) {
 				if (val.match(/^(http|urn|doi)/i)) { /* a++ */
 					var a = OAT.Dom.create("a");
 					a.innerHTML = simplified_row[j];
-					a.href = "#";
+		    a.href = val;
 					var v = grid.rows[grid.rows.length-1].cells[j].value;
 					OAT.Dom.clear(v);
 					OAT.Dom.append([v,a]);
@@ -640,13 +866,22 @@ var QueryExec = function(optObj) {
 		}
     };
 
+	this.makeParserErrorMsg = function (data) {
+		var msg = '<h3 class="error">XML Parser error</h3>\n';
+		if (data.documentElement)
+		msg += '<p class="error_msg">'+data.documentElement.textContent+ '</p>\n';
+		else 
+			msg += '<p class="error_msg">The result XML contained invalid data and could not be processed by the browser\'s XML parser.</p>';
+		return msg;
+	};
+
     this.makeErrorMsg = function (data) {
 	 var msg = '';
 	var r = data.match(/Error (..[0-9]{3})/);
 	if (r) {
-	    msg="<h3>SPARQL Processor Error ("+ r[1] + ")</h3>\n"
+			msg='<h3 class="error">SPARQL Processor Error ('+ r[1] + ')</h3>\n'
 	    if (r[1] == "HT404")
-		msg += "<p>Resource not found<br/>Check your query and try again</p>";
+				msg += "<p class=\"error_msg\">Resource not found<br/>Check your query and try again</p>";
 	}
 	else if (data.match(/Error HTCLI/)) {
 	    msg = "<h3>Proxy connection error</h3><p>The proxy could not connect to the endpoint ";
@@ -663,13 +898,52 @@ var QueryExec = function(optObj) {
 
     this.makeErrorResp = function (data) {
 	var txt = OAT.Xml.serializeXmlDoc(data);
-	 if (txt.length == 0 || txt == false) 
-	    txt = data;
-	txt = "<pre>"+txt+"</pre>";
+
+		if (txt.length == 0 || txt == false) txt = data;
+
+		txt = txt.replace(/</g,"<");
+		txt = txt.replace(/>/g,">");
+
 	return txt;
     };
 
-	this.draw = function() {
+    this.nav = function (old) {
+		var item = self.cache[self.cacheIndex];
+		var oldItem = self.cache[old];
+
+//		lastIndex = item.mini.select.selectedIndex;
+
+		OAT.Dom.clear(self.dom.result);
+		OAT.Dom.clear(self.dom.request);
+		OAT.Dom.clear(self.dom.query);
+		OAT.Dom.clear(self.dom.response);
+
+		OAT.Dom.append ([self.dom.result, item.dom.result_c],
+						[self.dom.request, item.dom.request_c],
+						[self.dom.query, item.dom.query_c],
+						[self.dom.response, item.dom.response_c]);
+
+//
+// TODO store full query context obj in cache and add functions to restore
+//
+
+		iSPARQL.dataObj.query        = item.opts.query;
+		iSPARQL.dataObj.defaultGraph = item.opts.defaultGraph;
+		iSPARQL.dataObj.maxrows      = item.opts.maxrows;
+		iSPARQL.dataObj.namedGraphs  = item.opts.namedGraphs;
+		iSPARQL.dataObj.pragmas      = item.opts.pragmas;
+
+		iSPARQL.endpointOpts.setEndpoint (null, item.opts.endpoint);
+
+		adv.redraw();
+//		if (!item.wasError && qbe) qbe.loadFromString(iSPARQL.dataObj.query);
+
+		self.refreshNav();
+	};
+
+	// called only when new result is received
+
+    this.draw = function(refresh) {
 		var item = self.cache[self.cacheIndex];
 		var opts = item.opts;
 		var request = item.request;
@@ -678,44 +952,75 @@ var QueryExec = function(optObj) {
 
 		if (self.options.executeCallback) { self.options.executeCallback(item); }
 
-		OAT.Dom.clear(self.dom.request);
+		// Generate request page
+
 		var r = decodeURIComponent(request);
 		var parts = r.split("&");
 		var req = OAT.Dom.create("pre");
-		OAT.Dom.append([self.dom.request,req]);
+
+		OAT.Dom.append([item.dom.request_c, req]);
 
 		for (var i=0;i<parts.length;i++) { req.innerHTML += OAT.Xml.escape(parts[i])+"\n"; }
 
-		OAT.Dom.clear(self.dom.query);
+		// Generate query page
 
 		var a = OAT.Dom.create("a");
 		a.innerHTML = "Query Permalink";
 	var xparm = "?query=" + encodeURIComponent(opts.query) + "&endpoint=" + opts.endpoint;
 	xparm += "&maxrows=" + (opts.maxrows ? opts.maxrows : "");
 	xparm += "&default-graph-uri=" + (opts.defaultGraph ? opts.defaultGraph : "");
+		xparm += "&view=" + opts.view;
 	a.href = document.location.protocol + '//' + document.location.host + '/isparql/' + xparm;
 		a.target = "_blank";
 
+		if (iSPARQL.Settings.shorten_uris)
+			iSPARQL.Common.shortenURI(a);
+		
 		var q = OAT.Dom.create("pre");
 		q.innerHTML = OAT.Xml.escape(opts.query);
 
-		OAT.Dom.append([self.dom.query,a,q]);
+		OAT.Dom.append([item.dom.query_c,a,q]);
+		
+		// Parsererror here applies only to FireFox. WebKit tries its best trying to parse the document 
+		// as far as it can, so in most cases we'll have a piece of graph to process and never get to the error.
 
-	if (wasError && !data.match(/Error SR171/)) { // Timeout SR171 means there may be data to display
+		if (wasError) {
+			if (typeof data != "string" && item.resType == iSPARQL.ResultType.ERROR) {
+				if (!data.documentElement || data.documentElement.localName == "parsererror") {
+					item.dom.result_c.innerHTML = self.makeParserErrorMsg (data);
+					item.dom.response_c.innerHTML = self.makeErrorResp (data);
+				}
+			}
+			else if (typeof data == "string" && !data.match(/Error SR171/)) { // Timeout SR171 means there may be data to displa
 			/* trap http codes */
-	    self.dom.result.innerHTML = self.makeErrorMsg (data);
-	    self.dom.response.innerHTML = self.makeErrorResp (data);
-	    self.tab.go(0); // buggy JS in FireFox...
-	    self.refreshNav();
-	    return;
+			item.dom.result_c.innerHTML = self.makeErrorMsg (data);
+			item.dom.response_c.innerHTML = self.makeErrorResp (data);
+		} 
 		} else {
-			var txt = OAT.Xml.serializeXmlDoc(data);
-	    var xmlTxt = txt; // Used if we have to draw a result set - need to remove namespace, etc.
-			txt = OAT.Xml.escape(txt);
-			self.dom.response.innerHTML = txt;
-
-			if (opts.query.match(/describe/i) || opts.query.match(/construct/i)) {
-				/* rdf mini */
+			// Generate Response page 
+
+			var xmlTxt = item.txt; // Used if we have to draw a result set - need to remove namespace, etc.
+			var txt = OAT.Xml.escape(xmlTxt);
+			var resp_p = OAT.Dom.create ("pre");
+			resp_p.innerHTML = txt;
+			
+			OAT.Dom.append ([item.dom.response_c, resp_p]);
+
+			var ua = navigator.userAgent.toLowerCase();
+		
+			if (ua.search ("iphone") || 
+				ua.search ("ipod") ||
+				ua.search ("android") ||
+				ua.search ("symbian") ||
+				ua.search ("S60"))
+				
+				map_h = OAT.Dom.getViewport()[1].toString()+'px';
+			else 
+				map_h = "600px";
+
+			//	generate Result
+			
+			if (item.resType == iSPARQL.ResultType.GRAPH) { // Use RDFMini to show Graphs
 				var lastIndex = 0;
 				var tabs = [
 					["navigator","Navigator"],
@@ -728,45 +1033,82 @@ var QueryExec = function(optObj) {
 		      {provider:iSPARQL.Defaults.map_type, 
 					markerMode:OAT.RDFTabsData.MARKER_MODE_AUTO,
 					clickPopup:true,
-					hoverPopup:false}] 
+					  hoverPopup:false,
+					  height: map_h}] 
 				];
 
-				if(self.mini) {
-					lastIndex = self.mini.select.selectedIndex;
-		    OAT.Dom.clear (self.dom.result);
-		    OAT.Dom.append ([self.dom.result, self.miniplnk, self.mRDFCtr]);
-				}
-		else {
 		    lastIndex = self.parseTabIndex (opts.resultView, tabs);
+				var c_i = self.cacheIndex;
+				
+				self.plnk_ctr = OAT.Dom.create ("div",{className:"result_plnk_ctr"}); 
+				
 		self.miniplnk = OAT.Dom.create ("a");
 		self.miniplnk.innerHTML = "Permalink";
-		self.mRDFCtr = OAT.Dom.create ("div");
-		self.mRDFCtr.id = "mini_rdf_ctr";
-	        OAT.Dom.clear (self.dom.result);
-		OAT.Dom.append ([self.dom.result, self.miniplnk, self.mRDFCtr]);
-		    self.mini = new OAT.RDFMini(self.mRDFCtr,{tabs:tabs,
-							      showSearch:false});
-		}
-		self.tab.go(0); // got to do here or maps won't resize properly.
-				self.mini.processLink = self.processLink;
-				self.mini.store.addXmlDoc(data);
-				self.mini.select.selectedIndex = lastIndex;
-//		self.mini.redraw();
+
+/*					self.addthis_ctr.innerHtml = '<div id="sharelink" class="addthis_toolbox addthis_default_style "' + 
+						'addthis:url=""' + 
+						'addthis:title="iSPARQL Execute">' +
+						'<a href="http://www.addthis.com/bookmark.php?v=250&username=' + iSPARQL.Settings.addthis_key + '"' +
+						'   class="addthis_button_compact">Share</a>' +
+						'<span class="addthis_separator">|</span>' +
+						'<a class="addthis_button_preferred_1"></a>' +
+						'<a class="addthis_button_preferred_2"></a>' +
+						'<a class="addthis_button_preferred_3"></a>' +
+						'<a class="addthis_button_preferred_4"></a>' +
+						'</div>'
+				}
+*/
+//				item.content = OAT.Dom.create ("div",{className: "rdf_mini_ctr"});
+				
+
+				if (iSPARQL.Settings.pivotInstalled) 
+					self.makePivotPermalink(self.plnk_ctr);
+
+				var mini_c = OAT.Dom.create("div",{className: "rdf_mini_ctr"});
+				
+				item.mini = new OAT.RDFMini(mini_c,{tabs:tabs,
+													showSearch:false,
+													store: item.store});
+
+				OAT.Dom.append([item.dom.result_c, self.plnk_ctr, mini_c]);
+				
+				//		self.tab.go(0); // got to do here or maps won't resize properly.
+				//		self.cache[self.cacheIndex].mini.processLink = self.processLink;
+				//		self.cache[self.cacheIndex].mini.store.addXmlDoc(data);
+				
+				item.mini.select.selectedIndex = lastIndex;
+				item.mini.redraw();
+				
+				OAT.Dom.append ([self.plnk_ctr, self.miniplnk]);
+				
+				var ua = navigator.userAgent;
+				
+				//				if (iSPARQL.Settings.addthis_key && !OAT.Browser.isScreenOnly) {
+				//					self.addthis_ctr = OAT.Dom.create ("a",{id: "addthis_ctr",
+				//															className: "addthis_button"});
+				//					self.addthis_ctr.innerHTML='<img src="http://s7.addthis.com/static/btn/sm-plus.gif" alt="Share"/>';
+				//					OAT.Dom.append ([self.plnk_ctr, self.addthis_ctr]);
+			//					self.makeAddThisURL (false,false,{tabIndex:lastIndex});
+				//					OAT.MSG.attach (item.mini, 'RDFMINI_VIEW_CHANGED', self.makeAddThisURL);
+				//				}
+				
 		self.makeMiniRDFPlinkURI (false,false,{tabIndex:lastIndex});
-		 OAT.MSG.attach (self.mini, 'RDFMINI_VIEW_CHANGED', self.makeMiniRDFPlinkURI);
+				OAT.MSG.attach (item.mini, 'RDFMINI_VIEW_CHANGED', self.makeMiniRDFPlinkURI);
+				
+
 			} else {
 		if (data.firstChild.tagName == 'sparql' && 
 		    data.firstChild.namespaceURI == 'http://www.w3.org/2005/sparql-results#') {		    
 		    var rs = self.parseSparqlResultSet (data);
 		    self.drawSparqlResultSet (rs);
-		} else {
-				/* own table */
-				self.store.clear();
-				self.store.addXmlDoc(data);
-				self.drawTable();
 			}
 		}
 	}
+
+		OAT.Dom.append ([self.dom.result, item.dom.result_c],
+						[self.dom.request, item.dom.request_c],
+						[self.dom.query, item.dom.query_c],
+						[self.dom.response, item.dom.response_c]);
 		self.tab.go(0);
 		self.refreshNav();
     };
@@ -855,7 +1197,7 @@ var QueryExec = function(optObj) {
 			return ul;
 	};
 
-		var obj = {
+/*		var obj = {
 			title:"URL",
 			content:genRef,
 			newHref:href,
@@ -863,9 +1205,22 @@ var QueryExec = function(optObj) {
 			height:100,
 			result_control:false,
 			activation:"click"
-		};
+		}; */
+		
+		OAT.Event.attach (domNode, 'click', function (event) {
+			switch (iSPARQL.Settings.anchorMode) {
+			case 0:
+				dereferenceRef(event);
+				break;
+			case 1:
+				selectRef(event);
+				break;
+			default:
+				OAT.Event.prevent(event);
+				window.open(href);
+			}
+		});
 
-		OAT.Anchor.assign(domNode,obj);
 
 //	var img1 = OAT.Dom.create("img",{paddingLeft:"3px",cursor:"pointer"});
 //	img1.title = "Describe Data Source";
@@ -905,6 +1260,7 @@ var QueryExec = function(optObj) {
 
     this.executeWithLocation = function (optObj, loc) {
 	optObj.procQuery = self.processLocationMacros (optObj.query, loc);
+		
 	self.execute (optObj)
     }
 
@@ -924,6 +1280,7 @@ var QueryExec = function(optObj) {
 		var callback = function(data) {
 			self.addResponse(request,optObj,0,data);
 			if (opts.callback) { opts.callback(data); }
+	    OAT.MSG.send (self,"iSPARQL_QE_DONE",self);
 	};
 
 		var onerror = function(xhr) {
diff --git a/binsrc/isparql/images/chrome-logo.png b/binsrc/isparql/images/chrome-logo.png
old mode 100755
new mode 100644
diff --git a/binsrc/isparql/images/firefox-logo.png b/binsrc/isparql/images/firefox-logo.png
old mode 100755
new mode 100644
diff --git a/binsrc/isparql/images/opera-logo.png b/binsrc/isparql/images/opera-logo.png
old mode 100755
new mode 100644
diff --git a/binsrc/isparql/images/safari-logo.png b/binsrc/isparql/images/safari-logo.png
old mode 100755
new mode 100644
diff --git a/binsrc/isparql/images/virt_power_no_border.png b/binsrc/isparql/images/virt_power_no_border.png
old mode 100755
new mode 100644
diff --git a/binsrc/isparql/index.html b/binsrc/isparql/index.html
index 9f58970..1f59f4a 100644
--- a/binsrc/isparql/index.html
+++ b/binsrc/isparql/index.html
@@ -1,9 +1,9 @@
-<?xml version="1.0" ?>
+<?xml version="1.0" ?> <!-- -*- tab-width: 4 -*- -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <!--
 
-  $Id: index.html,v 1.37.2.15 2010/06/28 09:33:06 source Exp $
+  $Id: index.html,v 1.37.2.23 2011/03/23 11:56:21 source Exp $
 
   This file is part of the OpenLink Ajax Toolkit (OAT) project
 
@@ -30,6 +30,8 @@
   <meta name="viewport" content="width=device-width"/>
 
   <link rel="apple-touch-icon" href="/isparql/images/mob_home_icon.png"/>
+  <meta name="apple-mobile-web-app-capable" content="yes" />
+  <meta name="apple-mobile-web-status-bar-style" content="black-translucent" />
 
   <link type="text/css" rel="stylesheet" href="/isparql/styles/style.css"/>
   <link type="text/css" rel="stylesheet" href="/isparql/styles/execute.css"/>
@@ -58,6 +60,8 @@ var featureList = ["keyboard","dimmer","tab","ajax","combolist","win","tree","gr
 
   <script type="text/javascript">
 
+// XXX should be done in defaults.js
+
 function myInit() {
   OAT.Preferences.imagePath = '/isparql/toolkit/images/';
   OAT.Preferences.stylePath = '/isparql/toolkit/styles/';
@@ -84,37 +88,81 @@ OAT.MSG.attach(OAT, 'OAT_LOAD', myInit);
           <img src="images/openlinklogo_wstrap_2008_no_motto.png" alt="OpenLink Software"/>
 	</div>
         <div class="msg" id="statMsgMain">iSPARQL Initialization</div>
-        <div class="msg" id="statMsgElem">Loading…</div>
-        <img src="/isparql/toolkit/images/throbber.gif" id="splashThrobber"/>
+        <div class="msg" id="statMsgElem">Loading</div>
+	
+        <img src="/isparql/toolkit/images/throbber.gif" id="splashThrobber" style="display:none"/>
+
+        <noscript>
+          <img src="/isparql/images/stop_32.png" alt="error"/>
+          <div class="error statMsgError">
+            iSPARQL is a JavaScript application.<br/>
+	        JavaScript is not available. This may mean that you are running on a browser that has no JavaScript support, 
+            or JavaScript is disabled. Please use a browser that supports JavaScript, or enable JavaScript for this page.
+	  </div>
+        </noscript>
+
         <img src="/isparql/images/stop_32.png" alt="error" id="splashErrorImg" style="display: none"/>
         <div class="error" id="statMsgErr"></div>
 	<div id="splash_ver"></div>
-        <div id="splash_copyr">Copyright © 2010 OpenLink Software</div>
+        <div id="splash_copyr">Copyright © 2006-2011 OpenLink Software</div>
         <div id="splash_foot" class="opl_motto">Making Technology Work For You ™</div>
       </div> <!-- #splash_inner -->
     </div> <!-- #splash -->
 
-    <div id="locAcquireUI" style="display:none;position:absolute">
+    <div id="locAcquireUI" style="display:none;position:absolute"> <!-- location acquire UI template. -->
       <div id="locAcquireUI_inner">
         <div id="locAcquireMsg">
-          <h3>Acquiring location <img id="locAcquireThrobber" src="/isparql/toolkit/images/throbber.gif"/></h3>
+          <div id="locAcquireTitleC">
+		    <h3 id="locAcquireTitleT">Locating</h3>
+            <img id="locAcquireThrobber" alt="throbber" src="/isparql/toolkit/images/throbber_small.gif"/>
+          </div>
           <table id="locAcquireCurrent">
-            <tr><th>Latitude</th><td id="locAcquireLatCtr">N/A</td></tr>
-            <tr><th>Longitude</th><td id="locAcquireLonCtr">N/A</td></tr>
-            <tr><th>Accuracy</th><td id="locAcquireAccCtr">N/A</td></tr>
+            <tr>
+              <td><label for="locAcquireManualLatInput">Latitude</label></td>
+              <td id="locAcquireLatCtr">
+	            <input type="text" 
+                       class="locAcquireForm" 
+                       id="locAcquireManualLatInput" />
+              </td>
+            </tr>
+            <tr>
+	          <td><label for="locAcquireManualLonInput">Longitude</label></td>
+	          <td id="locAcquireLonCtr">
+	            <input type="text" 
+                       class="locAcquireForm" 
+                       id="locAcquireManualLonInput" />
+              </td>
+            </tr>
+            <tr>
+              <td>Accuracy</td>
+              <td id="locAcquireAccCtr">N/A</td>
+            </tr>
           </table>
+        </div> <!-- #locAcquireMsg -->
+        <div id="locAcquireGeocodeForm" style="display:none">
+          <label for="locAcquireAddrInput">Address:</label>
+          <input type="text" class="locAcquireForm" id="locAcquireAddrInput"/>
         </div>
         <div id="locAcquireErrMsg"></div>
         <div id="locAcquireBtnCtr">
           <button id="locAcquireUseBtn">Use</button>
+	      <button id="locAcquireGeocodeBtn">Enter Address</button>
+	      <button id="locAcquireManualBtn">Manual</button>
           <button id="locAcquireRefreshBtn">Refresh</button>
           <button id="locAcquireCancelBtn">Cancel</button>
         </div>
-      </div> 
+      </div> <!-- #locAcquireUI_inner -->
     </div> <!-- #locAcquireUI -->
 
     <div id="page_content" style="display:none;">
       <ul id="menu">
+        <li>iSPARQL
+          <ul id="menu_isparql_down" class="menu_isparql" style="display:none">
+            <li id="menu_b_prefs">Preferences…</li>
+	    	<li class="noclose"><hr/></li>
+	    	<li id="menu_b_about">About iSPARQL…</li>
+          </ul>
+        </li>
         <li>File
           <ul id="menu_file_down" class="menu_file" style="display:none;">
 	    <li id="menu_b_reset">Reset</li>
@@ -127,9 +175,7 @@ OAT.MSG.attach(OAT, 'OAT_LOAD', myInit);
         </li>
         <li>Help
 	  <ul class="menu_help" style="display:none;">
-	    <li id="menu_b_help">iSPARQL Help…
-	    <li class="noclose"><hr/></li>
-	    <li id="menu_b_about">About iSPARQL…</li>
+	        <li id="menu_b_help">iSPARQL Help…</li>
 	  </ul>
         </li>
         <li id="login_b">Login</li>
@@ -291,6 +337,15 @@ ASK WHERE
 			{
 			?s ?p ?o .
 			}">Ask</option>
+                  <option value="CONSTRUCT { ?thing rdfs:type ?type;
+              foaf:name ?name;
+              geo:geometry ?geo .}
+WHERE     {	?thing a ?type;
+              foaf:name ?name; 
+              geo:geometry ?geo .
+			  FILTER (bif:st_intersects (?geo, bif:st_point (__P_LAT__,__P_LON__), 200))
+          } 
+">Proximity query</option>
 		</select>
 		<select name="tool" id="tool" onchange="tool_invoke()">
 		  <option value="">-- Statement Help --</option>
@@ -313,8 +368,14 @@ ASK WHERE
 		  <option value="tool_put('FILTER regex( str(?name), "Jane", "i" ) .')">put Regexp Filter</option>
 		  <option value="tool_put('FILTER ( bound(?x) ) .')">put Bound Filter</option>
 		  <option value="tool_put('FILTER ( ?date > "2005-01-01T00:00:00Z"^^xsd:dateTime ) .')">put Date Filter</option>
+		          <option value="tool_put('FILTER ( bif:st_intersects (?geo, bif:st_point(__P_LAT__, __P_LON__),200)) .')">put Proximity Filter</option>
+		          <option value="tool_put('__P_LAT__')">insert Latitude Macro</option>
+		          <option value="tool_put('__P_LON__')">insert Longitude Macro</option>
 		</select>
-		<a href="#" onclick="tools_popup()"><img src="images/cr16-action-window_new.png" alt="Statement Help" title="Statement Help" border="0"/></a>
+
+		        <a href="#" onclick="tools_popup()">
+                  <img src="images/cr16-action-window_new.png" alt="Statement Help" title="Statement Help" border="0"/>
+                </a>
 	      </div> <!-- #topbox_ctl -->
 	      <label for="query">SPARQL Query</label><br/>
 	      <div style="clear:both;">
@@ -348,27 +409,12 @@ ASK WHERE
         <input type="text" id="maxrows" size="4"/> rows
         <span class="maxrows_expln">Leave empty for server maximum setting.</span>
       </fieldset>
-        <div class="controls" id="queryMetaData">
-        <h3 id="mdtoggler" class="ctl_tgl"><span class="tgl_indicator" id="mdoptstogglerarrow">▸</span>Query Metadata</h3>
-        <div id="mdopts_ctr" class="ctl_ctr" style="display: none">
-          <fieldset class="md_opts" id="mdopts">
-              <label for="mdtitle">Title:</label><input type="text" id="mdtitle"/><br/>
-	      <label for="mddescription">Description:</label><input type="text" id="mddescription"/><br/>
-	      <label for="mdcreator">Creator:</label><input type="text" id="mdcreator"/><br/>
-	      <!--div class="expln">This metadata will be saved together with the query in a .rq file.</div-->
-            </fieldset>
-          </div> <!-- #mdopts_ctr -->
-        </div> <!-- #queryMetaData -->
         <div class="controls" id="controls">
         <h3 id="endpoint_opts_toggler" class="ctl_tgl">
-          <span class="tgl_indicator" id="endpointoptstogglerarrow">▸</span>Endpoint Options <span id="epvirtuosoindicator" style="display: none">(Virtuoso)</span>
+          <span class="tgl_indicator" id="endpointoptstogglerarrow">▸</span>Sponger <span id="epvirtuosoindicator" style="display: none">(Virtuoso)</span>
           </h3>
 	    <div id="endpoint_opts" class="ctl_ctr" style="display:none">
-            <fieldset class="endpoint" id="endpoint"> <!-- endpoint -->
-              <legend>Endpoint</legend>
-	    </fieldset>
-	      <fieldset class="deref_opts" id="derefOpts" style="display:none">
-	      <legend>Data Dereferencing Options</legend>
+	      <fieldset class="deref_opts" id="derefOpts">
               <table>
                 <tr>
 	          <td class="cachingOpts" style="padding-right: 8px;">
@@ -461,17 +507,28 @@ ASK WHERE
 	    <br style="clear:both;"/>
           </div> <!-- endpoint_options -->
 	</div> <!-- #controls -->
+      <div class="controls" id="queryMetaData">
+        <h3 id="mdtoggler" class="ctl_tgl"><span class="tgl_indicator" id="mdoptstogglerarrow">▸</span>Query Metadata</h3>
+        <div id="mdopts_ctr" class="ctl_ctr" style="display: none">
+          <fieldset class="md_opts" id="mdopts">
+            <label for="mdtitle">Title:</label><input type="text" id="mdtitle"/><br/>
+	        <label for="mddescription">Description:</label><input type="text" id="mddescription"/><br/>
+	        <label for="mdcreator">Creator:</label><input type="text" id="mdcreator"/><br/>
+	        <!--div class="expln">This metadata will be saved together with the query in a .rq file.</div-->
+          </fieldset>
+        </div> <!-- #mdopts_ctr -->
+      </div> <!-- #queryMetaData -->
 	<div class="main_col_page" id="page_results"></div>
         <div id="foot">
           <div class="foot_l" id="foot_l">
-            <div class="ubiq_gem">
+          <div class="ubiq_gem" style="display: none">
               <a onclick="javascript:gen_ubiq_meta()">
                 <img src="images/ubiq_icon_16.png" alt="Ubiquity icon"/><span class="text">Ubiquity</span>
               </a>
             </div>
              Bookmarklet - drag this link to your browser's bookmark bar: <a id="isparql_bookmarklet_a" href="javascript:(function(){location='http://www.openlinksw.com/';})();">iSPARQL</a> <a id="sparql_bookmarklet_a" href="" style="display:none">SPARQL</a>
         </div> <!-- #foot_l -->
-        <div class="foot_r" id="foot_r">Copyright © 2010 OpenLink Software, Inc.<br/><span id="ft_loc"></span><br/>
+        <div class="foot_r" id="foot_r">Copyright © 2006-2011 OpenLink Software<br/><span id="ft_loc"></span><br/>
         </div>
 	<div id="stats"></div> <!-- stats -->
       </div> <!-- #foot -->
@@ -508,9 +565,6 @@ ASK WHERE
       <div id="auth_dlg_error"></div>
       <div id="auth_buttons"><button id="auth_login_b">Login</button><button id="auth_cancel_b">Cancel</button></div>
     </div>
-    <div id="prefs_dlg">
-      <div></div>
-    </div>
     <div id="goptions">
       <div id="prefs_auth">
         <label for="username" class="align">Username:</label>
@@ -594,15 +648,35 @@ ASK WHERE
       Built using <a target="_blank" href="http://sourceforge.net/projects/oat">OpenLink Ajax Toolkit (OAT)</a>
       OAT version: <span id="about_oat_version">N/A</span>
       OAT build: <span id="about_oat_build">N/A</span>
-      IRI DB count: <span id="iridb_stats">N/A</span>
+      IRI DB count: <span id="iridb_stats">N/A</span> IRI IDs
       STORE:        <span id="triple_count">N/A</span> triples
                     <span id="item_count">N/A</span> items
                     <span id="label_count">N/A</span> labels chosen
                     <span id="label_proc_count">N/A</span> labels processed
+      LOCATION:     <span id="about_loc"></span>
+
       </pre>
       <div class="btn_row"><button id="about_dlg_b_ok">OK</button></div>
     </div> <!-- #about_dlg -->
 
+	<div id="prefs_dlg">
+	  <!-- ul id="prefs_tabrow">
+        <li id="ptab_services">Services</li>
+        <li id="ptab_deref">Data Dereferencing</li>
+      </ul-->
+	  <!--div id="prefs_tabdeck"> </div--> <!-- Browser DOM bug alert: do not make into a self-terminating tag -->
+      <div id="prefs_tab_services_ct" class="prefs_tab_ctr">
+        <h2>Services</h2>
+		<div id="endpoint"><label for="service">SPARQL Endpoint:</label></div> <!-- endpoint combo box container -->
+        <div id="shortener">
+		  <input type="checkbox" id="shortener_ep_ckb">
+		  <label for="shortener_ep_ckb" class="ckb">Shorten URIs using:<br/><span class="expln">Virtuoso curi endpoint</span></label><input id="shortener_ep"></div>
+      </div> <!-- #prefs_tab_services -->
+      <!-- div id="prefs_tab_deref_ct">
+        <h2>Dereferencing options</h2>
+      </div--> <!-- #prefs_tab_deref_ct -->
+    </div> <!-- #prefs_dlg -->
+
     <div id="qbe_unsupported_div">
       iSPARQL's Query By Example feature relies upon features and open standards not supported by
       Microsoft Internet Explorer.<br/>
diff --git a/binsrc/isparql/io.js b/binsrc/isparql/io.js
index 021c478..588a719 100644
--- a/binsrc/isparql/io.js
+++ b/binsrc/isparql/io.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: io.js,v 1.8.2.7 2009/10/29 20:10:10 source Exp $
+ *  $Id: io.js,v 1.8.2.9 2011/01/03 23:38:13 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -36,7 +36,8 @@ iSPARQL.IO = {
 		var pragma = dataObj.endpointOpts.pragmas[i];
 		var name = pragma[0];
 		var values = pragma[1];
-		for(var j=0;j<values.length;j++) { str += '# {pragma} {'+name+'} = {'+values[j]+'}\n'; }
+		for(var j=0;j<values.length;j++) { 
+		    str += '# {pragma} {'+name+'} = {'+values[j]+'}\n'; }
 	    }
 
 	/* endpoint */
@@ -62,7 +63,7 @@ iSPARQL.IO = {
     },
 
     serializeLdr:function(dataObj) {
-	var xslt = iSPARQL.Preferences.xslt + 'dynamic-page.xsl';
+		var xslt = iSPARQL.Settings.xslt + 'dynamic-page.xsl';
 	var iNS = "urn:schemas-openlink-com:isparql";
 	var xmlTemplate = '<?xml version="1.0" encoding="UTF-8"?>\n'+
 	'<?xml-stylesheet type="text/xsl" href="' + xslt + '"?>\n'+
@@ -81,9 +82,9 @@ iSPARQL.IO = {
 	var xml = OAT.Xml.createXmlDoc(xmlTemplate);
 	var page = xml.getElementsByTagName("ISparqlDynamicPage")[0];
 	var isparql = xml.getElementsByTagName("iSPARQL")[0];
-	var title = xml.getElementsByTagName("dc:title")[0];
-	var creator = xml.getElementsByTagName("dc:creator")[0];
-	var description = xml.getElementsByTagName("dc:description")[0];
+	var title = xml.getElementsByTagName("title")[0];
+	var creator = xml.getElementsByTagName("creator")[0];
+	var description = xml.getElementsByTagName("description")[0];
 
 	var addNode = function(p,ns,name,text,nenc) {
 	    var node = xml.createElementNS(ns,name);
@@ -144,9 +145,9 @@ iSPARQL.IO = {
 	if (dataObj.canvas) { addNode(isparql,iNS,"canvas",dataObj.canvas); }
 
 	if (dataObj.metaDataOpts) {
-	    title.textContent = OAT.Dom.toSafeXML(dataObj.metaDataOpts.metadata.title);
-	    creator.textContent = OAT.Dom.toSafeXML(dataObj.metaDataOpts.metadata.creator);
-	    description.textContent = OAT.Dom.toSafeXML(dataObj.metaDataOpts.metadata.description);
+	    title.textContent = OAT.Dom.toSafeXML(dataObj.metaDataOpts.title);
+	    creator.textContent = OAT.Dom.toSafeXML(dataObj.metaDataOpts.creator);
+	    description.textContent = OAT.Dom.toSafeXML(dataObj.metaDataOpts.description);
 	}
 
 	return OAT.Xml.serializeXmlDoc(xml);
diff --git a/binsrc/isparql/location.js b/binsrc/isparql/location.js
index 7178cd8..daaed32 100644
--- a/binsrc/isparql/location.js
+++ b/binsrc/isparql/location.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: location.js,v 1.1.2.2 2010/03/12 09:01:02 source Exp $
+ *  $Id: location.js,v 1.1.2.7 2011/03/23 11:56:21 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -9,9 +9,19 @@
  *
  */
 
-// XXX this should end up in OAT
+// XXX all this should end up in OAT finally
 //
 
+/*
+   Acquiring a location:
+
+   If empty cache, acquire location according to accuracy mode
+     
+   If last cache entry age < LocOpts.
+
+*/
+
+
 if (typeof iSPARQL == 'undefined') iSPARQL = {};
 
 iSPARQL.Location = function (o) {
@@ -19,8 +29,8 @@ iSPARQL.Location = function (o) {
     this._lat = 0;
     this._lon = 0;
     this._alt = 0;
-    this._altacc = -1;
     this._acc = -1;
+    this._altacc    = -1;
     this._dir = 0;
     this._spd = 0;
     this._cdate = new Date ();
@@ -54,7 +64,9 @@ iSPARQL.Location = function (o) {
     }
 
     this.serialize = function () {
-	return ({lat:    self._lat,
+	OAT.Debug.log (0,'Location.serialize');
+	return (OAT.JSON.serialize(
+	    {lat:    self._lat,
 		 lon:    self._lon,
 		 alt:    self._alt,
 		 acc:    self._acc,
@@ -62,7 +74,10 @@ iSPARQL.Location = function (o) {
 		 dir:    self._dir,
 		 spd:    self._spd,
 		 cate:   self._cdate.toUTCString(),
-		 mdate:  self._mdate.toUTCString()});
+	     mdate:  self._mdate.toUTCString()}));
+    }
+
+    this.initFromSerialized = function () {
     }
 
     this.parse = function (serLoc) {
@@ -103,7 +118,7 @@ iSPARQL.E_LocationException.prototype = iSPARQL.Exception.prototype;
 
 iSPARQL.LocationCache = function (size, initArr, getCurrent) {
     var self = this;
-    this._timeout = 5000; // milliseconds
+    this._timeout = 10000; // milliseconds
     this._currentLocation = [];
     this._locationCache = new iSPARQL.CircularBuffer (size);
     this._locOpts = {timeout: self._timeout, enableHighAccuracy: true};
@@ -111,7 +126,16 @@ iSPARQL.LocationCache = function (size, initArr, getCurrent) {
     this._acquire_denied = false;
     this._timed_out = false;
 
+    this._persistLocationCache = function () {
+	if (typeof localStorage != 'undefined') {
+	    OAT.Debug.log (0,'LocationCache: in _persistLocationCache: DISABLED.');
+//	    localStorage.iSPARQL_locationCache = self._locationCache.serialize();
+//	    iSPARQL.Common.log ('LocationCache: in _persistLocationCache: saved');
+	}
+    }
+
     this._locAcquireHandler = function (pos) {
+	OAT.Debug.log (0,'LocationCache: in _locAcquireHandler');
 	self._acquiring = false;
 	var o = {};
 
@@ -126,35 +150,42 @@ iSPARQL.LocationCache = function (size, initArr, getCurrent) {
 	l = new iSPARQL.Location (o);
 	l.setCdate (new Date (pos.timestamp));
 	self._locationCache.append (l);
-
+	self._persistLocationCache();
 	OAT.MSG.send (self, "LOCATION_ACQUIRED", l);
     }
 
     this._locErrorHandler = function (e) {
+	OAT.Debug.log (0,'LocationCache: in _locErrorHandler');
+        self._acquiring = false;
 	switch (e.code) {
 	case e.TIMEOUT:
 	    self._timed_out = true;
-	    OAT.MSG.send (self, "LOCATION_ERROR", e);
+	    OAT.MSG.send (self, "LOCATION_TIMEOUT", e);
 	    break;
 	case e.PERMISSION_DENIED:
 	    self._acquire_denied = true;
 	    OAT.MSG.send (self, "LOCATION_ERROR", e);
 	    break;
 	}
+	OAT.MSG.send (self, "LOCATION_ERROR", e);
     }
 
     this.acquireCurrent = function () {
 	if (navigator.geolocation) {
 	    if (!self._acquiring) {
-		navigator.geolocation.getCurrentPosition (self._locAcquireHandler, self._locErrorHandler, self._locOpts);
+		navigator.geolocation.getCurrentPosition (self._locAcquireHandler, 
+							  self._locErrorHandler, 
+							  self._locOpts);
 		self._acquiring = true;
 	    }
 	}
     }
 
-    this.startTracking= function (interval) {
+    this.startTracking = function () {
 	if (navigator.geolocation) {
-	    navigator.geoLocation.watchPosition (self._locAcquireHandler, self._locErrorHandler, {maxAge: 10000});
+	    navigator.geoLocation.watchPosition (self._locAcquireHandler, 
+						 self._locErrorHandler, 
+						 {maxAge: 10000});
 	}
     }
 
@@ -168,10 +199,92 @@ iSPARQL.LocationCache = function (size, initArr, getCurrent) {
     if (getCurrent) {
 	self.acquireCurrent ();
     }
+
+    this.addLocation = function (l) {
+	self._locationCache.append (l);
+    }
+
+    this.setManualLocation = function (l) {
+	self._locationCache.append(l);
+	self._acquiring = false;
+	OAT.MSG.send (self, "LOCATION_ACQUIRED", l);
+    }
+
+// XXX
+
+    this.serialize = function () {
+	return false;
+    }
+
+    this.initFromSerialized = function () {
+	return false;
+    }
+
+    this.cancelLocation = function () {
+	return false;
+    }
+}
+
+//
+// Use (GOOG) geoCoder Api - only by address, no bounds atm...
+//
+
+iSPARQL.Geocoder = function (o) {
+    var self = this;
+
+    this._options = {
+	retries: 2,
+	retry_to_ms:2500 // msec between retries upon server error
+    };
+
+    this._retries_left = 0;
+    this._request = {};
+    this._retry_to = false;
+
+    for (var p in o) { this._options[p] = o[p]; }
+
+    this._geocoder = new google.maps.Geocoder();
+
+    this._geocode = function () {
+	self._geocoder.geocode (self._request, self.handleResult); 
+    }
+
+    this._retry_geocode = function () {
+	OAT.MSG.send (self,"GEOCODE_RETRYING",null);
+	self._geocode();
+    }
+
+    this.geocode = function (addr) {
+	self._retries_left = self._options.retries;
+	self._request = {address: addr};
+	self._geocode ();
+    }
+
+    this.handleResult = function (results, stat) {
+	var s = google.maps.GeocodeStatus;
+	switch (stat) {
+	case m.OK:
+	    if (self._retry_to) window.clearTimeout (self._retry_to);
+	    OAT.MSG.send (self,"GEOCODE_RESULT",results);
+	    break;
+	case m.UNKNOWN_ERROR:
+	    if (self._retries_left) {
+		self._retries_left--;
+		OAT.MSG.send (self,"GEOCODE_FAIL_RETRYING",stat);
+		if (!self._retry_to) 
+		    self._retry_to = setTimeout (self._retry_geocode(), self._options.retry_to_ms);
+		break;
+	    }
+	default:
+	    if (self._retry_to) window.clearTimeout (self._retry_to);
+	    OAT.MSG.send (self,"GEOCODE_FAIL",stat);
+	}
+    }
 }
 
-// Requires HTML template. IDs
-// #locAcquireUI - outer ctr
+//
+// Requires HTML template. IDs:
+// #locAcquireUI - outer ctr - shown when loc being acquired
 // #locAcquireMsg
 // #locAcquireBtnCtr
 // #locAcquireLonCtr
@@ -180,29 +293,44 @@ iSPARQL.LocationCache = function (size, initArr, getCurrent) {
 // #locAcquireUseBtn
 // #locAcquireCancelBtn
 //
-
-
-//
 // o.useCB - use button callback
 // o.cancelCB - cancel callback
 // o.cache - cache
 //
 
+iSPARQL.locAcquireUIMode = {
+    AUTO:   0,
+    GEOCODE:1,
+    MANUAL: 2
+}
+
 iSPARQL.locationAcquireUI = function (o) {
     var self = this;
 
-    this.o = o;
+    this.o = {useGeocoder:false,
+	      manualFallback:true,
+	      uiMode: iSPARQL.locAcquireUIMode.AUTO};
+
+    for (p in o)
+	this.o[p] = o[p];
+
     this._lc = o.cache;
 
     this._latC      = $("locAcquireLatCtr");
     this._lonC      = $("locAcquireLonCtr");
     this._accC      = $("locAcquireAccCtr");
+    this._titleT      = $("locAcquireTitleT");
     this._msg       = $("locAcquireMsg");
     this._err       = $("locAcquireErrMsg");
     this._useBtn    = $("locAcquireUseBtn");
     this._cancelBtn = $("locAcquireCancelBtn");
+    this._manualBtn   = $("locAcquireManualBtn");
+    this._geocodeBtn  = $("locAcquireGeocodeBtn");
     this._refBtn    = $("locAcquireRefreshBtn");
     this._thr       = $("locAcquireThrobber");
+    this._geocodeForm = $("locAcquireGeocodeForm");
+    this._latI        = $("locAcquireManualLatInput");
+    this._lonI        = $("locAcquireManualLonInput");
 
     this._ctr = $("locAcquireUI");
 
@@ -211,6 +339,8 @@ iSPARQL.locationAcquireUI = function (o) {
     this._useCB = self.o.useCB;
     this._cancelCB = self.o.cancelCB;
 
+    this._uiMode = self.o.uiMode;
+
     this.hide = function () {
 	OAT.Dom.hide (self._ctr);
     }
@@ -220,56 +350,223 @@ iSPARQL.locationAcquireUI = function (o) {
     }
 
     this.refresh = function () {
+	
 	OAT.Dom.hide (self._err);
 	OAT.Dom.show (self._thr);
 	self._lc.acquireCurrent();
     }
 
+    this.getCtr = function () {
+	return this._ctr;
+    }
+
+// "private" members
+
+    this._refresh_to = 0;    
+
     this._locHandler = function (m,s,l) {
-	self._latC.innerHTML = l.getLat();
-	self._lonC.innerHTML = l.getLon();
+	OAT.Debug.log (0,'LocAcquireUI: in _locHandler');
+	self._latI.value = l.getLat();
+	self._lonI.value = l.getLon();
 	self._accC.innerHTML = l.getAcc();
 	self._currL = l;
 	OAT.Dom.show (self._useBtn);
 	self._refBtn.innerHTML = "Refresh";
 	OAT.Dom.hide(self._thr);
 	OAT.Dom.hide(self._err);
+	if (l.getAcc() > o.minAcc) {
+	    self._refresh_to = setTimeout(self.refresh, 5000);
+	} else {
+	    self.hide();
+	    self.o.useCB(self.o.cbParm, self._currL);
+	}
     }
 
-    this._errHandler = function () {
-	self._err.innerHTML = "Cannot acquire location.";
+    this._errHandler = function (m,s,e) {
+	switch (e.code) {
+	case e.TIMEOUT:
+	    self._titleT.innerHTML = "Timed out";
+	    break;
+        case e.PERMISSION_DENIED:
+	    self._titleT.innerHTML = "Permission denied";
+	    break;
+        case e.POSITION_UNAVAILABLE:
+	    self._titleT.innerHTML = "Location failed";
+	    break;
+	}
+
+	if (e.message) self._err.innerHTML = e.message;
 	self._refBtn.innerHTML = "Retry";
+
 	OAT.Dom.show (self._err);
 	OAT.Dom.hide (self._thr);
 	OAT.Dom.hide (self._useBtn);
     }
 
+    this._refreshHandler = function () {
+	self._reset();
+	self.refresh();
+    }
+
+    this._manualHandler = function () {
+	self._setManualMode();
+    }
+
+    this._geocodeHandler = function () {
+	self._setGeocodeMode();
+    }
+
+    this._reset = function () {
+	clearTimeout (self._refresh_to);
+	OAT.Dom.hide(self._geocodeForm);
+	OAT.Dom.hide(self._manualForm);
+
+	OAT.Dom.hide (self._err);
+	self._titleT.innerHTML = "Locating";
+	self._err.innerHTML = "";
+	self._refBtn.innerHTML = "Refresh";
+	self._useBtn.disabled = false;
+
+	if (!self.currL) OAT.Dom.hide (self._useBtn);
+
+	if (!self.o.manualFallback) 
+	    OAT.Dom.hide (self._manualBtn);
+	else
+	    OAT.Dom.show (self._manualBtn);
+
+	if (!self.o.useGeocoder) 
+	    OAT.Dom.hide (self._geocodeBtn);
+	else
+	    OAT.Dom.show (self._manualBtn);
+
+	self._lonI.disabled = true;
+	self._latI.disabled = true;
+
+	OAT.Event.detach (self._latI, "change", self._latLonIChangeHandler);
+	OAT.Event.detach (self._lonI, "change", self._latLonIChangeHandler);
+
+	OAT.Dom.show (self._thr);
+    }
+
+    this._setGeocodeMode = function () {
+	self._uiMode = iSPARQL.locAcquireUIMode.GEOCODE;
+	self._reset();
+	OAT.Dom.hide(self._useBtn);
+	OAT.Dom.hide(self._thr);
+	OAT.Dom.show(self._geocodeForm);
+    }
+
     this._useHandler = function (e,s) {
 	self.hide();
+        self._reset();
+	switch (self._uiMode) {
+	case iSPARQL.locAcquireUIMode.MANUAL:
+	    var l = new iSPARQL.Location ({lat: self._latI.value, 
+					   lon: self._lonI.value});
+	    self._lc.setManualLocation(l);
+	    self._currL = l;
+	    self._uiMode = self.o.uiMode;
+	    break;
+	case iSPARQL.locAcquireUIMode.AUTO:
+	case iSPARQL.locAcquireUIMode.GEOCODE:
+	    self._uiMode = self.o.uiMode;
 	self.o.useCB(self.o.cbParm, self._currL);
     }
+    }
 
-    this._refreshHandler = function () {
-	self.refresh();
+    this._latLonIChangeHandler = function () {
+	if (isNaN(self._latI.value) || isNaN(self._lonI.value))
+	    self._useBtn.disabled = true;
+        else
+	    self._useBtn.disabled = false;
     }
 
-    this._cancelHandler = function (e,s) {
+    this._setManualMode = function () {
+	self._uiMode = iSPARQL.locAcquireUIMode.MANUAL;
+	self._reset();
+
+	OAT.Dom.hide(self._thr);
 	OAT.Dom.show(self._useBtn);
+	OAT.Dom.hide(self._manualBtn);
+	OAT.Dom.show(self._manualForm);
+
+	self._lonI.disabled = false;
+	self._latI.disabled = false;
+
+	self._refBtn.innerHTML="Auto";
+
+	OAT.Event.attach (self._latI, "change", self._latLonIChangeHandler);
+	OAT.Event.attach (self._lonI, "change", self._latLonIChangeHandler);
+
+	self._latI.focus();
+    }
+
+    this._cancelHandler = function (e,s) {
+	switch (self._uiMode) {
+	case iSPARQL.locAcquireUIMode.AUTO:
+	    if (self.o.useGeocoder)
+		self._setGeocodeMode();
+	    else if (self.o.manualFallback)
+		self._setManualMode();
+	    return;
+	case iSPARQL.locAcquireUIMode.GEOCODE:
+	    if (self.o.manualFallback)
+		self._setManualMode();
+	    return;
+	}
 	self.hide();
+	self._reset();
 	if (self.o.cancelCB) self.o.cancelCB(self.o.cbParm);
     }
 
+    this._geocodeHandler = function (e,s) {
+	return;
+    }
+
+    this._geocodeRetryingH = function (e,s) {
+	return;
+    }
+
+    this._geocodeFailRetryH = function (e,s) {
+	return;
+    }
+
+    this._geocodeFailH = function (e,s) {
+	return;
+    }
+
     this.init = function () {
+	OAT.Event.attach (self._useBtn,    "click", self._useHandler);
+	OAT.Event.attach (self._refBtn,    "click", self._refreshHandler);
+	OAT.Event.attach (self._cancelBtn, "click", self._cancelHandler);
+        OAT.Event.attach (self._manualBtn, "click", self._manualHandler);
+	OAT.Event.attach (self._geocodeBtn,"click", self._geocodeHandler);
+
 	OAT.MSG.attach ("*","LOCATION_ACQUIRED", self._locHandler);
 	OAT.MSG.attach ("*","LOCATION_ERROR", self._errHandler);
-	OAT.Event.attach (self._useBtn, "click", self._useHandler);
-	OAT.Event.attach (self._refBtn, "click", self._refreshHandler);
-	OAT.Event.attach (self._cancelBtn, "click", self._cancelHandler);
-	if (!self.currL) OAT.Dom.hide (self._useBtn);
-	OAT.Dom.hide (self._err);
-	OAT.Dom.show (self._thr);
-	self.show ();
+	OAT.MSG.attach ("*","LOCATION_TIMEOUT", self._errHandler);
+	OAT.MSG.attach ("*","GEOCODE_RESULT", self._geocodeHandler);
+	OAT.MSG.attach ("*","GEOCODE_RETRYING", self._geocodeRetryingH);
+	OAT.MSG.attach ("*","GEOCODE_FAIL", self._geocodeFailH);
+	OAT.MSG.attach ("*","GEOCODE_FAIL_RETRYING",self._geocodeFailRetryH);
+
+	self._reset();
+	
+	switch (self.o.uiMode) {
+	case iSPARQL.locAcquireUIMode.AUTO:
+	    OAT.Debug.log (0,'locAcquireUIMode: AUTO');
 	self.refresh();
+	    break;
+	case iSPARQL.locAcquireUIMode.GEOCODE:
+	    OAT.Debug.log (0,'locAcquireUIMode: GEOCODE');
+	    self._setGeocodeMode();
+	    break;
+	case iSPARQL.locAcquireUIMode.MANUAL:
+	    OAT.Debug.log (0,'locAcquireUIMode: MANUAL');
+	    self._setManualMode();
+	    break;
+	}
+	self.show();
     }
 
     self.init ();
diff --git a/binsrc/isparql/main.js b/binsrc/isparql/main.js
index 15122de..bae8c08 100644
--- a/binsrc/isparql/main.js
+++ b/binsrc/isparql/main.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: main.js,v 1.45.2.19 2010/06/28 09:33:06 source Exp $
+ *  $Id: main.js,v 1.45.2.31 2011/03/29 11:03:35 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -33,6 +33,8 @@ function init() {
 	OAT.Preferences.imagePath = '/isparql/toolkit/images/';
 	OAT.Preferences.stylePath = '/isparql/toolkit/styles/';
 
+
+	iSPARQL.StatusUI.init();
 	iSPARQL.Defaults.init();
 
 	iSPARQL.Common.initData();
@@ -57,6 +59,12 @@ function init() {
 	    if (qbe.svgsparql) { qbe.svgsparql.reposition(); }
 	}
 
+		if (OAT.Browser.isIE || OAT.Browser.isScreenOnly && iSPARQL.Settings.view == 0)
+			tab.go (1); /* is 0-based index... */
+		else
+			tab.go (iSPARQL.Settings.view);
+
+		
     } catch (e) {
 	if (e.prototype == iSPARQL.Exception)
 	    iSPARQL.StatusUI.errMsg = e.toString;
@@ -66,80 +74,10 @@ function init() {
 	OAT.Dom.hide ("splashThrobber");
 	OAT.Dom.show ("splashErrorImg");
 	sessionStorage.clear();
-	if (iSPARQL.Preferences.debug) throw (e);
+		if (iSPARQL.Settings.debug) throw (e);
     }
 
-
     OAT.Dom.show("page_content");
-
-    /*    if (window.__inherited) {
-	if (window.__inherited.username)       goptions.username = window.__inherited.username;
-	if (window.__inherited.password)       goptions.password = window.__inherited.password;
-	if (window.__inherited.login_put_type) goptions.login_put_type = window.__inherited.login_put_type;
-	if (window.__inherited.endpoint)       goptions.service = window.__inherited.endpoint;
-	if (window.__inherited.proxy)          goptions.proxy = window.__inherited.proxy;
-	if (window.__inherited.should_sponge)  goptions.should_sponge = window.__inherited.should_sponge;
-	if (window.__inherited.query)          qbe.loadFromString(window.__inherited.query);
-	if (window.__inherited.graph)          $('qbe_graph').value = window.__inherited.graph;
-
-	if (window.__inherited.callback) {
-    */
-	    /* query returning */
-    /*	    var returnRef = function() {
-		if ($v('default-graph-uri') == '' ||
-		    confirm('WARNING ! ! !\nDefault graph will be lost, construct your query using FROM instead. \nDo you wish to continue?')) {
-		    window.__inherited.callback($v('query'));
-		    window.close();
-		}
-	    }
-	    OAT.Event.attach("return_btn","click",returnRef);
-	} else OAT.Dom.hide("return_btn");
-
-	if (!iSPARQL.Common.checkAuth(goptions.username,goptions.password) == true)
-	    iSPARQL.dialogs.goptions.show();
-	else if (window.__inherited.run) qbe.func_run();
-    } else {
-	OAT.Dom.hide("return_btn");
-
-	var page_params = OAT.Dom.uriParams();
-	for (var p in goptions) {
-	    if (page_params['goptions.' + p] != undefined)
-		goptions[p] = page_params['goptions.'+p];}
-
-	if (fixed_sponge) {
-	    goptions.should_sponge = fixed_sponge;
-	    var inputs = document.getElementsByName('should-sponge');
-	    for(var i = 0; i < inputs.length; i++) inputs[i].disabled = true;
-	    $('qbe_sponge').disabled = true;
-	    $('adv_sponge').disabled = true;
-	}
-
-	var show_initial_screen = true;
-
-	if(get_initial_credentials)	{
-	    OAT.AJAX.GET(get_initial_credentials, '', function(data,headers){
-			     if (data != '') {
-				 var tmp = OAT.Crypto.base64d(data).split(':');
-				 if (tmp.length > 0) {
-				     goptions.username = tmp[0];
-				     goptions.password = tmp[1];
-				 }
-				 show_initial_screen = false;
-			     }
-			 },{async:false,onerror:function(xhr){alert(xhr.getResponseText());}});
-	    if (!iSPARQL.Common.checkAuth(goptions.username,goptions.password) == true)
-		show_initial_screen = true;
-	}
-
-		if (show_initial_screen) iSPARQL.dialogs.goptions.show();
-		else goptions.initial_screen = true;
-
-      } */
-
-
-    if (OAT.Browser.isIE || OAT.Browser.isScreenOnly) {
-	tab.go (1); /* is 0-based index... */
-    }
 }
 
 iSPARQL.SERVER_TYPE = {
@@ -178,6 +116,7 @@ iSPARQL.QueryExec = function(optObj) {
 
     this.go = function(optObj) {
 	var opts = {};
+		
 	for (var p in self.options) { opts[p] = self.options[p]; }
 	for (var p in optObj) { opts[p] = optObj[p]; }
 
@@ -193,9 +132,11 @@ iSPARQL.QueryExec = function(optObj) {
 	if (opts.sponge && self.options.virtuoso) { req["should-sponge"] = opts.sponge; }
 
 	var arr = [];
+		
 	for (var p in req) {
 	    arr.push(p+"="+encodeURIComponent(req[p]));
 	}
+		
 	var query = arr.join("&");
 
 	var callback = function(data) {
@@ -220,6 +161,12 @@ iSPARQL.QueryExec = function(optObj) {
     self.go(optObj);
 }
 
+iSPARQL.LayoutMgr = {
+	resize_h: function () {
+		
+	},
+}
+
 iSPARQL.Advanced = function () {
     var self = this;
 
@@ -257,6 +204,10 @@ iSPARQL.Advanced = function () {
 	self.save();
     }
 
+	this.locationCancelH = function () {
+		return false;
+	}
+    
     this.locUI = false;
 
     this.func_run = function() {
@@ -285,7 +236,8 @@ iSPARQL.Advanced = function () {
 	    pragmas:iSPARQL.endpointOpts.pragmas,
 	    namedGraphs:iSPARQL.dataObj.namedGraphs,
 	    callback:iSPARQL.Common.setData,
-	    maxrows:iSPARQL.dataObj.maxrows
+			maxrows:iSPARQL.dataObj.maxrows,
+			view:1
 	}
 	
 	iSPARQL.recentQueryUI.addQuery (o.query);
@@ -293,16 +245,19 @@ iSPARQL.Advanced = function () {
 	var lc = [];
 
 	if (qe.detectLocationMacros(o.query)) {
+	    iSPARQL.StatusUI.statMsg ("Initializing geolocation service …");
 	    if (!iSPARQL.locationCache) {
 		if (!!localStorage && !!localStorage.iSPARQL_locationCache)
 		    lc = localStorage.iSPARQL_locationCache;
 		iSPARQL.locationCache = new iSPARQL.LocationCache (10, lc, true);
 	    }
+
 	    var locUI = new iSPARQL.locationAcquireUI ({useCB: qe.executeWithLocation, 
-                cancelCB: false,
+														cancelCB: self.locationCancelH,
 		cbParm: o,
-		cache: iSPARQL.locationCache});
-	    locUI.refresh();
+														cache: iSPARQL.locationCache,
+													    minAcc: iSPARQL.Settings.locOpts.minAcc});
+//			locUI.refresh();
 	} else {
 	qe.execute(o);
     }
@@ -353,7 +308,8 @@ iSPARQL.Advanced = function () {
 	dataObj.endpointOpts.pragmas = iSPARQL.endpointOpts.pragmas;
 	dataObj.maxrows = iSPARQL.dataObj.maxrows;
 	dataObj.defaultGraph = $v('default-graph-uri');
-	dataObj.metaDataOpts = iSPARQL.mdOpts; // XXX check IO.Save
+		dataObj.metaDataOpts = iSPARQL.mdOpts.getMetaDataObj();
+		
 	return(dataObj);
     }
 
@@ -381,6 +337,7 @@ OAT.Observer = {
     add:function (observers, _obj, fun) {
 	if (!OAT.Observer.find (observers, _obj, fun)) observers.push ({o:_obj, fun:fun});
     },
+	
     del: function (observers, _obj, fun) {
 	for (var i = 0; i < observers.length; i++)
 	    if (observers[i].o == _obj && observers[i].fun == fun) {
@@ -431,14 +388,14 @@ iSPARQL.RecentQueriesUI = function () {
 
     this.clear = function () {
 	self.buf.clear();
-	localStorage.iSPARQL_recent_queries = OAT.JSON.stringify([]);
+		localStorage.iSPARQL_recent_queries = OAT.JSON.serialize([]);
 	self.redraw();
     }
 
     this.addQuery = function (qry) {
 	if (self.buf.find(qry) == -1) {
 	    self.buf.append (qry);
-	    localStorage.iSPARQL_recent_queries = OAT.JSON.stringify(self.buf.toList());
+			localStorage.iSPARQL_recent_queries = OAT.JSON.serialize(self.buf.toList());
 	    self.redraw();
 	}
     }
@@ -462,7 +419,7 @@ iSPARQL.RecentQueriesUI = function () {
 	if (typeof localStorage != 'undefined' && 
 	    typeof localStorage.iSPARQL_recent_queries != 'undefined') {
 	    try {
-		initList = OAT.JSON.parse(localStorage.iSPARQL_recent_queries);
+				initList = OAT.JSON.deserialize(localStorage.iSPARQL_recent_queries);
 	    }
 	    catch (e) {
 		delete localStorage.iSPARQL_recent_queries;
@@ -480,8 +437,6 @@ iSPARQL.RecentQueriesUI = function () {
 //
 // Observes SpongerOpts
 //
-// To avoid unwanted recursion we pass the calling object to the observed object.
-//
 
 iSPARQL.EndpointOptsUI = function (optsObj, toggler, indicator, container) {
     var self = this;
@@ -549,7 +504,8 @@ iSPARQL.EndpointOptsUI = function (optsObj, toggler, indicator, container) {
 	/* main display toggling */
 	OAT.Event.attach (self.togglerElm, "click", self.toggle);
 
-	if (typeof sessionStorage.iSPARQLEpOptsUIVisible != 'undefined' && sessionStorage.iSPARQLEpOptsUIVisible == 'true')
+		if (typeof sessionStorage.iSPARQLEpOptsUIVisible != 'undefined' && 
+            sessionStorage.iSPARQLEpOptsUIVisible == 'true')
 	    self.show();
 	else
 	    self.hide();
@@ -748,7 +704,7 @@ iSPARQL.EndpointOptsUI = function (optsObj, toggler, indicator, container) {
 	var opts = $(select).options;
 	for (var i=0;i<opts.length;i++) {
 	    var opt = opts[i];
-	    if (opt.value == p[1][0].replace (/"/g,'')) { //"
+			if (opt.value == p[1][0].replace (/\"/g,'')) { // 
 		$(select).options.selectedIndex = i;
 		break;
 	    }
@@ -866,8 +822,18 @@ iSPARQL.EndpointOpts = function (optsObj) {
     // XXX add support for:
     // timeout
 
+	var _o = {
+		endpoint: '/sparql',
+		useProxy: true,
+		pragmas: [],
+	};
+
+	for (p in optsObj) {
+		self._o[p] = optsObj[p];
+	}
+	
     this.unSerialize = function (s) {
-	var o = OAT.JSON.parse (s);
+		var o = OAT.JSON.deserialize(s);
 	this.loadObj (o);
     }
 
@@ -879,7 +845,7 @@ iSPARQL.EndpointOpts = function (optsObj) {
 	    serverType:  self.serverType
 		};
 
-	return OAT.JSON.stringify (o);
+		return OAT.JSON.serialize(o);
     }
 
     this.loadSes = function () {
@@ -898,12 +864,14 @@ iSPARQL.EndpointOpts = function (optsObj) {
     }
 
     this._init = function (o) {
-	if (o.sponge) {
+		if (!!o) {
+			if (!!o.sponge) {
 	    self.setGetOpt (self,o.sponge);
 	}
-	if (o.endpoint) {
+			if (!!o.endpoint) {
 	    self.setEndpoint(self, o.endpoint);
 	}
+		}
 	// retrieve state from persistent session storage if available
 	self.loadSes();
     }
@@ -912,7 +880,7 @@ iSPARQL.EndpointOpts = function (optsObj) {
 	self.endpointPath = '/sparql';
 	self.useProxy = true;
 	self.pragmas = [];
-	OAT.Observer.notify (self.observers, callerObj, 'reset');
+		OAT.Observer.notify (self.observers, caller, 'reset');
 	self.saveSes();
     }
 
@@ -977,7 +945,7 @@ iSPARQL.EndpointOpts = function (optsObj) {
 		}
 	    }
 
-	iSPARQL.Common.log(self.pragmas);
+		OAT.Debug.log(0, "Pragmas: " + self.pragmas);
 	self.saveSes();
     }
 
@@ -993,10 +961,10 @@ iSPARQL.EndpointOpts = function (optsObj) {
 	    a.push(['define get:soft',[(val)? '"'+val+'"' : val]]);
 	else {
 	    a.push(['define get:soft',[false]]);
-/*	    //	    a.push(['define input:grab-limit',[false]]); XXX will have to test which way is best for user (what happens to existing other
+			//	    a.push(['define input:grab-limit',[false]]); XXX will have to test which way is best for user (what happens to existing other 
 	    //	    a.push(['define input:grab-depth',[false]]); Sponger options if sponger is set to be off.
 	    //	    a.push(['define input:grab-all',[false]]);
-	    //	    a.push(['define input:grab-seealso',[false]]); */
+			//	    a.push(['define input:grab-seealso',[false]]);
 	}
 
 	self.setPragmas(a);
@@ -1105,7 +1073,7 @@ iSPARQL.EndpointOpts = function (optsObj) {
 	return false;
     }
 
-    this._init(optsObj);
+    this._init(self._o);
 
 }; // EndpointOpts
 
@@ -1171,13 +1139,18 @@ iSPARQL.MetaDataOpts = function () {
 
     var self = this;
 
-    this.metadata = {};
+    this.metadata = {
+		title: '',
+		creator: '',
+		description: ''
+    };
+
     this.observers = {};
 
     this._init = function () {
 	self.reset();
 	if (typeof sessionStorage.iSPARQLMetaDataOpts != 'undefined' && sessionStorage.iSPARQLMetaDataOpts)
-	    self.metadata = OAT.JSON.parse (sessionStorage.iSPARQLMetaDataOpts);
+			self.metadata = OAT.JSON.deserialize(sessionStorage.iSPARQLMetaDataOpts);
     }
 
     this.reset = function (caller) {
@@ -1190,12 +1163,12 @@ iSPARQL.MetaDataOpts = function () {
 
     this.loadOpts = function (o) {
 	if (o.title) self.metadata.title       = o.title;
-	if (o.title) self.metadata.creator     = o.creator;
-	if (o.title) self.metadata.description = o.description;
+		if (o.creator) self.metadata.creator         = o.creator;
+		if (o.description) self.metadata.description = o.description;
     }
 
     this.changed = function (callerObj, reason) {
-	sessionStorage.iSPARQLMetaDataOpts = OAT.JSON.stringify (self.metadata);
+		sessionStorage.iSPARQLMetaDataOpts = OAT.JSON.serialize(self.metadata);
 	OAT.Observer.notify (self.observers, callerObj, 'setCreator');
     }
 
@@ -1290,13 +1263,13 @@ iSPARQL.AuthUI = function (conn) {
 
     this._init(conn);
 
-} // AuthUI
+} // AuthUI - should probably called session rather than connection...
 
 iSPARQL.ServerConnection = function (uri, authObj) {
     var self = this;
     this.endpointUri = uri;
 
-    this.authObj = OAT.JSON.parse(OAT.JSON.stringify(authObj)); // Deep copy param obj
+    this.authObj = OAT.JSON.deserialize(OAT.JSON.stringify(authObj)); // Deep copy param obj
 
     this.connected = false;
     this.response = false;
@@ -1312,27 +1285,35 @@ iSPARQL.ServerConnection = function (uri, authObj) {
     // Newest IE, FireFox and Safari/WebKit implement HTML 5.0 local storage
 
     this.saveAuth = function() {
-	sessionStorage.iSPARQLAuth = OAT.JSON.stringify (self.authObj);
+		sessionStorage.iSPARQLAuth = OAT.JSON.serialize(self.authObj);
     }
 
     this.loadAuth = function() {
 	if (typeof sessionStorage.iSPARQLAuth != 'undefined' && sessionStorage.iSPARQLAuth)
-	self.authObj = OAT.JSON.parse (sessionStorage.iSPARQLAuth);
+			self.authObj = OAT.JSON.deserialize(sessionStorage.iSPARQLAuth);
     }
 
     this.connect = function (_user, _pass, caller) {
 	self.authObj.user = _user;
-	self.authObj.pass = _pass;
+		self.authObj.password = _pass;
 	self.connected = false;
 
-	OAT.AJAX.GET (self.authObj.endpoint, 'username=' + _user + '&pass=' + _pass,
+		if ((!!self.authObj.user) && self.authObj.user != '') 
+		  {
+			  OAT.AJAX.PROPFIND ('/DAV/home/' + _user,'',
 		      function (data, headers) {
-			  if (data == 'OK') self.connected = true;
-			  else self.error = data;
+									 self.connected = true;
 		      },
 		      		  {async:false,
+								  user: self.authObj.user,
+								  password: self.authObj.password,
 		      		   onstart:function() {return},
-		      		   onerror:function (xhr) { self.error = xhr.response; self.connected = false; }});
+								  onerror:function (xhr) { 
+									  var stat = xhr.getStatus();
+									  if (stat == 401)
+										  self.error = 'Invalid Credentials';
+									  else self.error = 'Unknown error';
+									  self.connected = false; }});
 
 	if (self.connected) {
 	    self.saveAuth ();
@@ -1340,14 +1321,15 @@ iSPARQL.ServerConnection = function (uri, authObj) {
 	    					 imagePath:toolkitImagesPath,
 	    					 silentStart:true,
 	    					 user:self.authObj.user,
-	    					 pass:self.authObj.pass,
+	    						   pass:self.authObj.password, 
 	    					 isDav:true});
-	}
 
 	self.detectServerProperties ();
 
 	OAT.MSG.send (self, "iSPARQL_SERVER_CONNECTED", self);
     }
+		  }
+    }
 
     this.detectServerProperties = function() {
 
@@ -1383,6 +1365,25 @@ iSPARQL.ServerConnection = function (uri, authObj) {
 
 iSPARQL.Common = {
 
+//
+// Replace anchor with c_uri
+//
+	shortenURI_closure:function (a) {
+		return (function (data) {
+			try {
+				var o = OAT.JSON.deserialize(data);
+				if (o.c_uri) a.href = o.c_uri;
+			} catch (e) {}
+		});
+	},
+
+	shortenURI:function (a) {
+		var req = iSPARQL.Settings.c_uri_ep + "create.vsp?uri="+ encodeURIComponent(a.href) + "&res=json";
+		var cb = iSPARQL.Common.shortenURI_closure (a);
+
+		OAT.AJAX.GET (req, false, cb, {});
+	},
+	
     initData:function () {
 	iSPARQL.StatusUI.statMsg ("Initializing data structures and objects…");
 
@@ -1394,18 +1395,19 @@ iSPARQL.Common = {
 	// Set program defaults
 
 	iSPARQL.Common.reset();
-	iSPARQL.Common.setQuery (iSPARQL.dataObj.query);
-	iSPARQL.Common.setDefaultGraph (iSPARQL.dataObj.graph);
+		
+		iSPARQL.Common.setQuery (iSPARQL.Settings.query);
+		
+		iSPARQL.Common.setDefaultGraph (iSPARQL.Settings.graph);
 
 	iSPARQL.mdOpts       = new iSPARQL.MetaDataOpts ();
 
-	iSPARQL.endpointOpts = new iSPARQL.EndpointOpts ({sponge:iSPARQL.Defaults.sponge, 
-							  endpoint:iSPARQL.Defaults.endpoint});
+		iSPARQL.endpointOpts = new iSPARQL.EndpointOpts ();
 
 	iSPARQL.StatusUI.statMsg ("Initializing server connection data…");
 
 	iSPARQL.serverConn   = new iSPARQL.ServerConnection (iSPARQL.endpointOpts.endpointPath,
-							     iSPARQL.Defaults.auth);
+															 iSPARQL.Settings.auth);
 
     },
 
@@ -1438,10 +1440,56 @@ iSPARQL.Common = {
 	iSPARQL.dialogs.help = new OAT.Dialog("iSPARQL Help", "help_dlg", {width:400, modal:0, buttons:0});
 	OAT.Event.attach ("help_dlg_b_ok", "click", iSPARQL.dialogs.help.hide);
 
-	iSPARQL.dialogs.prefs = new OAT.Dialog("iSPARQL Preferences", "prefs_dlg", {width:400, modal:1});
+		iSPARQL.dialogs.prefs = new OAT.Dialog("iSPARQL Preferences", "prefs_dlg", {width:600, 
+																					modal:1, 
+																					def_layout: false, 
+																					className: "prefs_dlg"});
 	iSPARQL.dialogs.prefs.ok = iSPARQL.dialogs.prefs.hide;
-	iSPARQL.dialogs.prefs.cancel = iSPARQL.dialogs.prefs.hide;
 
+//		iSPARQL.pref_tabs = new OAT.Tab ("prefs_tabdeck");
+//		iSPARQL.pref_tabs.add ("ptab_services","prefs_tab_services_ct");
+
+//		iSPARQL.pref_tabs.add ("ptab_deref","prefs_tab_deref_ct");
+
+
+		if (!!!iSPARQL.UserPreferences.c_uri_ep && !!iSPARQL.Defaults.curiInstalled) {
+			var l = document.location;
+			// Use a default c_uri loc
+			iSPARQL.Settings.c_uri_ep = 
+				l.protocol + '//' + l.hostname + ((l.port != 80 && l.port != '')?(':'+l.port):'') +'/c/';
+		}
+
+		if (!!iSPARQL.Settings.shorten_uris) {
+			$('shortener_ep').disabled = false;
+			$('shortener_ep_ckb').checked = true;
+		} else {
+			$('shortener_ep').disabled = true;
+		}
+		
+		$('shortener_ep').value = iSPARQL.Settings.c_uri_ep;
+
+		OAT.Event.attach ("shortener_ep", "change", 
+						  function () {
+							  iSPARQL.Settings.c_uri_ep = iSPARQL.UserPreferences.c_uri_ep = $('shortener_ep').value;
+							  localStorage.iSPARQL_UserPreferences = OAT.JSON.serialize(iSPARQL.UserPreferences);
+						  });
+
+		OAT.Event.attach ("shortener_ep_ckb", "click", 
+						  function () {
+							  if ($('shortener_ep_ckb').checked) {
+								  $('shortener_ep').disabled = false;
+								  iSPARQL.Settings.shorten_uris = iSPARQL.UserPreferences.shorten_uris = true;
+							  } else {
+								  $('shortener_ep').disabled = true;
+								  iSPARQL.Settings.shorten_uris = iSPARQL.UserPreferences.shorten_uris = false;
+							  }
+							  // Persist UserPreferences
+							  //
+							  localStorage.iSPARQL_UserPreferences = OAT.JSON.serialize(iSPARQL.UserPreferences);
+							  OAT.MSG.send (self,"iSPARQL_USER_PREF_CHANGE",false);
+						  });
+
+		if (iSPARQL.serverConn.isConnected) {
 	if (iSPARQL.serverConn.isVirtuoso) {
 	    $('about_version').innerHTML = iSPARQL.serverConn.serverVersion;
 	    $('about_date').innerHTML = iSPARQL.serverConn.serverBuildDate;
@@ -1450,6 +1498,11 @@ iSPARQL.Common = {
 	    $('about_version').innerHTML = 'N/A (Not Virtuoso)';
 	    $('about_date').innerHTML =  'N/A (Not Virtuoso)';
 	}
+		}
+		else {
+			$('about_version').innerHTML = 'unknown';
+			$('about_date').innerHTML = 'unknown';
+		}
 
 	$('about_oat_version').innerHTML = OAT.Preferences.version;
 	$('about_oat_build').innerHTML = OAT.Preferences.build;
@@ -1461,14 +1514,15 @@ iSPARQL.Common = {
 			    var iridbstats = OAT.IRIDB.getStats();
 			    $('iridb_stats').innerHTML = iridbstats.iriCount;
 			    $('triple_count').innerHTML = m.getTripleCount();
-			    $('item_count').innerHTML = m.getItemCount();
+							$('item_count').innerHTML = m.getGraphCount();
 			    $('label_count').innerHTML = m.getLabelCount();
 			    $('label_proc_count').innerHTML = m.getLabelProcCount();
 			});
 
 	OAT.Anchor.zIndex = 1001;
 
-	OAT.MSG.attach ("*", "LOCATION_ACQUIRED", function (m,s,l) { $("ft_loc").innerHTML = "lat:" + l.getLat() + " lon:" + l.getLon();});
+		OAT.MSG.attach ("*", "LOCATION_ACQUIRED", 
+						function (m,s,l) { $("ft_loc").innerHTML = "lat:" + l.getLat() + " lon:" + l.getLon();});
 
 	iSPARQL.StatusUI.statMsg ("Initializing menu…");
 	iSPARQL.Common.initMenu();
@@ -1478,6 +1532,8 @@ iSPARQL.Common = {
 			iSPARQL.dialogs.qbe_unsupp.show();
 			return;
 	    }
+			iSPARQL.Settings.tab = newIndex;
+			iSPARQL.Common.saveSes();
 	    if (newIndex == 0) { // QBE
 			OAT.Dom.show ('qry_type_ctls');
  			OAT.Dom.show('queryopts');
@@ -1516,19 +1572,20 @@ iSPARQL.Common = {
 	}
 
 	tab = new OAT.Tab ("main_col",
-				{dockMode:true,
-					dockElement:"tabs",
+						   {//dockMode:false,
+							//dockElement:"tabs",
 					goCallback:tab_goCallback,
-					onDock:onDock,
-					onUnDock:onUnDock,
-					dockWindowWidth:1000,
-					dockWindowHeight:600});
+							//onDock:onDock,
+							//onUnDock:onUnDock,
+							//dockWindowWidth:1000,
+							//dockWindowHeight:600
+						   });
 
 	tab_qbe =     tab.add ("tab_qbe",    "page_qbe");
 	tab_query =   tab.add ("tab_query",  "page_query");
 	tab_results = tab.add ("tab_results","page_results");
 
-	tab.go (0); /* is 0-based index... */
+		tab.go (iSPARQL.Settings.tab); /* is 0-based index... */
 
 	var tabgraphs = new OAT.Tab ("tabgrph_content");
 	tabgraphs.add ("tabgrph_default","tabgrph_default_content");
@@ -1654,18 +1711,21 @@ iSPARQL.Common = {
 	/* build info */
 	$("foot_r").innerHTML += " OAT Version " + OAT.Preferences.version + " Build " + OAT.Preferences.build;
 
-	page_w = OAT.Dom.getWH('page')[0] - 20;
 
-	$('default-graph-uri').value = iSPARQL.Defaults.graph;
-	$('query').value = iSPARQL.Defaults.query;
+		$('default-graph-uri').value = iSPARQL.Settings.graph;
+		$('query').value = iSPARQL.Settings.query;
 
-	$('maxrows').value = iSPARQL.dataObj.maxrows;
+		$('maxrows').value = iSPARQL.Settings.maxrows;
 	OAT.Event.attach ('maxrows', 'change',
 					function () {
 						var n = parseInt($v('maxrows'));
-						iSPARQL.dataObj.maxrows = isNaN(n) ? 0 : n;
+							  iSPARQL.Settings.maxrows = isNaN(n) ? 0 : n; 
 						});
 
+		enable_if_ubiq ($('ubiq_gem'));
+		
+		page_w = OAT.Dom.getWH('page')[0] - 20;
+		
         iSPARQL.StatusUI.statMsg ("UI Initialization complete.");
     },
 
@@ -1679,9 +1739,23 @@ iSPARQL.Common = {
 
 	init_qbe(); // Customise svgsparql prototype
 
-	window.qbe = new iSPARQL.QBE(iSPARQL.Defaults);
+		var qbe_def = {
+			query: false,
+			graph: false
+		};
+
+		if (iSPARQL.Settings.view != 0) { 
+			if (iSPARQL.serverDefaults.query) 
+				qbe_def.query = iSPARQL.serverDefaults.query;
+			else 
+				qbe_def.query = "SELECT * WHERE {?s ?p ?o}";
+		}
+		else {
+			qbe_def.query = iSPARQL.Settings.query;
+		}
+		qbe_def.graph = iSPARQL.Settings.graph;
 
-	qbe.loadFromString(iSPARQL.Defaults.query);
+		window.qbe = new iSPARQL.QBE(qbe_def);
     },
 
     initQE: function() {
@@ -1702,15 +1776,18 @@ iSPARQL.Common = {
 
 	window.qe = new QueryExec({div:"page_results", executeCallback:execCB});
     },
+	
     showUI: function() {
 	OAT.Dom.show ("page_content");
     },
+	
     toggleVisibility: function (elem_id) {
 	if ($(elem_id).style.display == 'none')
 	    OAT.Dom.show (elem_id);
 	else
 	    OAT.Dom.hide (elem_id);
     },
+	
     enableFileOps: function () {
 	OAT.Event.attach ("menu_b_load",
 			"click",
@@ -1736,6 +1813,7 @@ iSPARQL.Common = {
 			});
 	OAT.Dom.removeClass ("menu_b_saveas", "disabled")
     },
+	
     disableFileOps: function () {
 	OAT.Event.detach ("menu_b_load",
 			"click",
@@ -1811,7 +1889,7 @@ iSPARQL.Common = {
     },
 
     log:function(msg) {
-	if(!!(window.console) && iSPARQL.Preferences.debug) {
+		if(!!(window.console) && iSPARQL.Settings.debug) {
 	    window.console.log(msg);
 	}
     },
@@ -1819,11 +1897,11 @@ iSPARQL.Common = {
     getFilePath:function() {
 	var path = '/DAV';
 
-	if (iSPARQL.dataObj.user)
-	    path += "/home/" + iSPARQL.dataObj.user;
+		if (iSPARQL.Settings.user) 
+			path += "/home/" + iSPARQL.Settings.user;
 
-	if (iSPARQL.dataObj.lastPath)
-	    path = iSPARQL.dataObj.lastPath.substring(0,iSPARQL.dataObj.lastPath.lastIndexOf("/"));
+		if (iSPARQL.Settings.lastPath) 
+			path = iSPARQL.Settings.lastPath.substring(0,iSPARQL.Settings.lastPath.lastIndexOf("/"));
 
 	return path;
     },
@@ -1831,9 +1909,9 @@ iSPARQL.Common = {
     getFile:function() {
 	var file = '';
 
-	if (iSPARQL.dataObj.lastPath)
-	    file = iSPARQL.dataObj.lastPath.substring(iSPARQL.dataObj.lastPath.lastIndexOf("/") + 1,
-						      iSPARQL.dataObj.lastPath.length);
+		if (iSPARQL.Settings.lastPath) 
+			file = iSPARQL.Settings.lastPath.substring(iSPARQL.Settings.lastPath.lastIndexOf("/") + 1,
+													  iSPARQL.Settings.lastPath.length);
 
 	return file;
     },
@@ -1855,11 +1933,11 @@ iSPARQL.Common = {
     getDefaultPath:function() {
 	var path = '/DAV';
 
-	if (iSPARQL.dataObj.user) path += "/home/" + iSPARQL.dataObj.user;
+		if (iSPARQL.Settings.user) path += "/home/" + iSPARQL.Settings.user;
 
 	var pathDefault = path;
 
-	if (iSPARQL.dataObj.user == 'dav') pathDefault = '/DAV';
+		if (iSPARQL.Settings.user == 'dav') pathDefault = '/DAV';
 
 	return pathDefault;
     },
@@ -1875,9 +1953,9 @@ iSPARQL.Common = {
     addNamedGraph:function(graph) {
 	var index = iSPARQL.dataObj.namedGraphs.find(graph);
 	if (index != -1) { return; }
-	iSPARQL.dataObj.namedGraphs.push(graph);
+		iSPARQL.Settings.dataObj.push(graph);
 	this.saveSes();
-	iSPARQL.Common.log(iSPARQL.dataObj.namedGraphs);
+		OAT.Debug.log(0,'addNamedGraph: ' + iSPARQL.dataObj.namedGraphs);
     },
 
     removeNamedGraph:function(graph) {
@@ -1885,7 +1963,7 @@ iSPARQL.Common = {
 	if (index == -1) { return; }
 	iSPARQL.dataObj.namedGraphs.splice(index,1);
 	this.saveSes();
-	iSPARQL.Common.log(iSPARQL.dataObj.namedGraphs);
+		OAT.Debug.log(0,'removeNamedGraph: ' + iSPARQL.dataObj.namedGraphs);
     },
 
     addGraph:function(graph) {
@@ -1893,7 +1971,7 @@ iSPARQL.Common = {
 	if (index != -1) { return; }
 	iSPARQL.dataObj.graphs.push(graph);
 	this.saveSes();
-	iSPARQL.Common.log(iSPARQL.dataObj.graphs);
+		OAT.Debug.log(0,'addGraph: ' + iSPARQL.dataObj.graphs);
     },
 
     addPrefix:function(prefix) {
@@ -1901,7 +1979,7 @@ iSPARQL.Common = {
 	if (index != -1) { return; }
 	iSPARQL.dataObj.prefixes.push(prefix);
 	this.saveSes();
-	iSPARQL.Common.log(iSPARQL.dataObj.prefixes);
+		OAT.Debug.log(0,'addPrefix: ' + iSPARQL.dataObj.prefixes);
     },
 
     removeGraph:function(graph) {
@@ -1909,61 +1987,108 @@ iSPARQL.Common = {
 	if (index == -1) { return; }
 	iSPARQL.dataObj.graphs.splice(index,1);
 	this.saveSes();
-	iSPARQL.Common.log(iSPARQL.dataObj.graphs);
+		OAT.Debug.log(0,'removeGraph:' + iSPARQL.dataObj.graphs);
     },
 
     setQuery:function(query) {
 	iSPARQL.dataObj.query = query;
 	this.saveSes();
-	iSPARQL.Common.log(iSPARQL.dataObj.query);
+		OAT.Debug.log(0,'setQuery: ' + iSPARQL.dataObj.query);
     },
 
     setDefaultGraph:function(graph) {
 	iSPARQL.dataObj.defaultGraph = graph;
 	this.saveSes();
-	iSPARQL.Common.log(iSPARQL.dataObj.defaultGraph);
+		OAT.Debug.log(0,'setDefaultGraph:' + iSPARQL.dataObj.defaultGraph);
     },
 
     setData:function(data) {
 	iSPARQL.dataObj.data = data;
-	iSPARQL.Common.log(iSPARQL.dataObj.data);
+		OAT.Debug.log(0,'setData:' + iSPARQL.dataObj.data);
     },
 
     // sessionStorage handling
     //
-    // XXX should abstract better for better code reuse - have OAT Component for cross-browser(version) compat
+    // XXX should abstract better for better code reuse 
+    //   - have OAT Component for cross-browser(version) compat
     //
 
-    persistList:["query", "defaultGraph", "graphs", "namedGraphs", "prefixes", "pragmas", "maxrows","sponge","tab"],
+    persistList:["query", "defaultGraph", "graphs", "namedGraphs", 
+				 "prefixes", "pragmas", "maxrows","sponge","tab", "endpoint"],
 
     resetSes:function () {
 	sessionStorage.iSPARQLSes = '';
 	iSPARQL.Common.reset();
     },
 
+//
+// Gets called from event handlers
+// 
+
     saveSes:function () {
 	var storeObj = {};
-	for (mName in self.persistList) {
-	    if (typeof iSPARQL.dataObj[mName] != 'object')
-		storeObj[mName] = iSPARQL.dataObj[mName];
+		for (var i=0;i<iSPARQL.Common.persistList.length;i++) {
+			var mName = iSPARQL.Common.persistList[i];
+
+			storeObj.query = iSPARQL.dataObj.query;
+			if (typeof iSPARQL.Settings[mName] != 'undefined') {
+				if (typeof iSPARQL.Settings[mName] != 'object')
+					storeObj[mName] = iSPARQL.Settings[mName];
 	    else
-		storeObj[mName] = OAT.JSON.parse(OAT.JSON.stringify (iSPARQL.dataObj[mName]));
+					storeObj[mName] = OAT.JSON.deserialize(OAT.JSON.stringify (iSPARQL.Settings[mName]));
+			}
 	}
 
-	if (typeof sessionStorage.iSPARQLSes == 'undefined' || !sessionStorage.iSPARQLSes)
-	    sessionStorage.iSPARQLSes = {dataObj: {}};
+//		if (typeof sessionStorage.iSPARQLSes == 'undefined' || !sessionStorage.iSPARQLSes)
+//			sessionStorage.iSPARQLSes = {Settings: {}};
 
-	sessionStorage.iSPARQLSes.dataObj = storeObj;
+		sessionStorage.iSPARQLSes = OAT.JSON.serialize(storeObj);
     },
 
     loadSes: function () {
-	if (typeof sessionStorage.iSPARQLSes != 'undefined') {
-	    var ss = sessionStorage.iSPARQLSes
-	    if (ss && typeof ss.dataObj != 'undefined')
-		iSPARQL.dataObj = OAT.JSON.parse (OAT.JSON.stringify(ss.dataObj));
+		if (typeof sessionStorage.iSPARQLSes != 'undefined' && 
+			sessionStorage.iSPARQLSes != null && 
+			sessionStorage.iSPARQLSes != '') {
+			var s = OAT.JSON.deserialize(sessionStorage.iSPARQLSes);
+			for (i in s) {
+				if (typeof s[i] != 'object')
+					iSPARQL.Settings[i] = s[i];
+				else
+					iSPARQL.Settings[i] = OAT.JSON.deserialize(OAT.JSON.serialize (s[i]));
+			}
 	}
     },
 
+    handlePageParams:function () {
+	
+		var qp = false;
+		var p = OAT.Dom.uriParams();
+		
+		if (p['default-graph-uri']) { iSPARQL.Settings.graph  = p['default-graph-uri']; qp = true; }
+		if (p['defaultGraph'])      { iSPARQL.Settings.graph  = p['defaultGraph']; qp = true; }
+		if (p['query']) { 
+			iSPARQL.Settings.query  = p['query']; 
+			qp = true; 
+		}
+		if (p['sponge'])            { iSPARQL.Settings.sponge = p['sponge']; qp = true; }
+		if (p['should_sponge'])     { iSPARQL.Settings.sponge = p['should_sponge']; qp = true; }
+		if (p['view']) {
+			var tabInx = parseInt(p['view']);
+			if (!isNaN(tabInx) && tabInx >= 0 && tabInx < 3)
+				iSPARQL.Defaults.tab = tabInx;
+			else 
+				iSPARQL.Settings.tab = 1;
+			qp = true;
+		}
+		if (p['endpoint']) { iSPARQL.Settings.endpoint = p['endpoint']; qp = true;}
+		if (p['resultview']) { iSPARQL.Settings.resultView = p['resultview']; qp = true;}
+		if (qp) iSPARQL.Settings.qp_override = qp;
+		if (p['__DEBUG']) iSPARQL.Settings.debug = true;
+		if (p['maxrows']) iSPARQL.Settings.maxrows = parseInt(p['maxrows']);
+    },
+
+
+
     //
     // Set program default options - will be overriden by server defaults if available
     // Also user may reset - should reinit EndpointOpts and metaDataOpts
@@ -1971,26 +2096,48 @@ iSPARQL.Common = {
 
     reset:function() {
 	if (typeof iSPARQL == 'undefined') iSPARQL = {};
+		if (typeof iSPARQL.Settings == 'undefined') iSPARQL.Settings = {};
 	if (typeof iSPARQL.dataObj == 'undefined') iSPARQL.dataObj = {};
 
+
+		for (i in iSPARQL.Defaults) {
+			if (typeof iSPARQL.Defaults[i] != 'object') 
+			iSPARQL.Settings[i] = iSPARQL.Defaults[i];
+			else 
+				iSPARQL.Settings[i] = OAT.JSON.deserialize(OAT.JSON.serialize(iSPARQL.Defaults[i]));
+		}
+		
+		if (!!localStorage.iSPARQL_UserPreferences) 
+			iSPARQL.UserPreferences = OAT.JSON.deserialize(localStorage.iSPARQL_UserPreferences);
+		else 
+			iSPARQL.UserPreferences = {};
+		
+		for (i in iSPARQL.UserPreferences) {
+			if (typeof iSPARQL.UserPreferences[i] != 'object') 
+			iSPARQL.Settings[i] = iSPARQL.UserPreferences[i];
+			else 
+				iSPARQL.Settings[i] = OAT.JSON.deserialize(OAT.JSON.serialize(iSPARQL.UserPreferences[i]));
+		}
+
+		this.loadSes();
+		this.handlePageParams(); // Page params always override session persistence
+
 	iSPARQL.dataObj.data = false;
-	iSPARQL.dataObj.query = iSPARQL.Defaults.query;
+		iSPARQL.dataObj.query = iSPARQL.Settings.query;
 	iSPARQL.dataObj.defaultGraph = "";
 	iSPARQL.dataObj.graphs = [];
 	iSPARQL.dataObj.namedGraphs = [];
-	iSPARQL.dataObj.prefixes = [];			/* FIXME: prefixes? */
-
+		iSPARQL.dataObj.prefixes = []; // XXX
 	iSPARQL.dataObj.pragmas = [];
-	iSPARQL.dataObj.maxrows = iSPARQL.Defaults.maxrows;
+		iSPARQL.dataObj.maxrows = iSPARQL.Settings.maxrows;
 	iSPARQL.dataObj.canvas = false;
-	iSPARQL.dataObj.sponge = iSPARQL.Defaults.sponge;
-	iSPARQL.dataObj.tab = iSPARQL.Defaults.tab;
+		iSPARQL.dataObj.sponge = iSPARQL.Settings.sponge;
+		iSPARQL.dataObj.tab = iSPARQL.Settings.tab;
 
 	if (typeof iSPARQL.endpointOpts != 'undefined') iSPARQL.endpointOpts.reset();
 	if (typeof iSPARQL.metaDataOpts != 'undefined') iSPARQL.metaDataOpts.reset();
 
-	this.loadSes ();
-	this.log(iSPARQL.dataObj);
+		OAT.Debug.log('reset: '+iSPARQL.dataObj);
 
     },
 
@@ -2005,6 +2152,17 @@ iSPARQL.Common = {
 	for (var i=0;i<iSPARQL.dataObj.namedGraphs.length;i++) {
 	    add_named_graph(iSPARQL.dataObj.namedGraphs[i]);
 	}
+    },
+
+	isMobileBrowser: function () {
+		var ua = navigator.userAgent.toLowerCase();
+		
+		if (ua.search ("iphone") || 
+			ua.search ("ipod") ||
+			ua.search ("android") ||
+			ua.search ("symbian") ||
+			ua.search ("S60"))
+			return true;
     }
 }
 
@@ -2021,7 +2179,6 @@ function get_file_type(file_name) {
 
 function set_dav_props(res){
     var ext = res.substring(res.lastIndexOf('.') + 1).toLowerCase();
-    throw('foo');
     if (iSPARQL.serverConn.isVirtuoso && (ext == 'xml' || ext == 'isparql' || ext == 'rq')) {
 	OAT.AJAX.GET('./set_dav_props.vsp?res=' + encodeURIComponent(res),
 		     '',
@@ -2195,19 +2352,26 @@ var toolswin = null;
 function tools_popup(){
     if (toolswin == null) {
 	var topbox_ctl_xy = OAT.Dom.getLT('topbox_ctl');
-	toolswin = new OAT.Window({close:1,min:0,max:0,x:topbox_ctl_xy[0] + 200,y:topbox_ctl_xy[1] + 50,width:200,height:440,title:"Statement Help"});
-	toolswin.div.style.zIndex = 1013;
-	$("page_query").appendChild(toolswin.div);
-	toolswin.onclose = function() { OAT.Dom.hide(toolswin.div); }
+		toolswin = new OAT.Win({buttons:"cs",
+								x:topbox_ctl_xy[0] + 200,
+								y:topbox_ctl_xy[1] + 50,
+								innerWidth:210,
+//								innerHeight:440,
+								title:"Statement Help"});
+
+		//		$("page_query").appendChild(toolswin.div);
 
 	var tools = $('tool').options;
-	toolswin.content.innerHTML = '';
+		
+		var t_ctr = toolswin.getInnerContainer();
+		t_ctr.innerHTML = '';
+		
 	for (i = 0;i<tools.length;i++) {
 	    if (tools[i].value)
-		toolswin.content.innerHTML += '<button class="tools_but" onclick="' + tools[i].value.replace(/\"/g,'"') + '">' + tools[i].text + '</button>';
+				t_ctr.innerHTML += '<button class="tools_but" onclick="' + tools[i].value.replace(/\"/g,'"') + '">' + tools[i].text + '</button>';
 	}
     }
-    OAT.Dom.show(toolswin.div);
+    toolswin.open();
 }
 
 function add_named_graph(graph) {
diff --git a/binsrc/isparql/make_vad.sh b/binsrc/isparql/make_vad.sh
index 2283d4a..46e7188 100755
--- a/binsrc/isparql/make_vad.sh
+++ b/binsrc/isparql/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.17.2.4 2010/02/03 15:42:58 source Exp $
+#  $Id: make_vad.sh,v 1.17.2.5 2011/02/03 10:28:23 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -280,7 +280,7 @@ sticker_init() {
   echo "  <name package=\"iSPARQL\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"iSPARQL\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
diff --git a/binsrc/isparql/qbe.js b/binsrc/isparql/qbe.js
index 0f30935..f7e8267 100644
--- a/binsrc/isparql/qbe.js
+++ b/binsrc/isparql/qbe.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: qbe.js,v 1.36.2.11 2010/07/01 11:53:53 source Exp $
+ *  $Id: qbe.js,v 1.36.2.13 2011/03/29 11:03:35 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -427,7 +427,7 @@ iSPARQL.QBE = function (def_obj) {
 	dataObj.endpointOpts.pragmas = iSPARQL.endpointOpts.pragmas;
 	dataObj.canvas = self.svgsparql.toXML();
 	dataObj.defaultGraph = $v('qbe_graph');
-	dataObj.metaDataOpts = iSPARQL.mdOpts; // XXX check IO.Save
+	dataObj.metaDataOpts = iSPARQL.mdOpts.getMetaDataObj();
 	dataObj.maxrows = iSPARQL.dataObj.maxrows;
 
 	if(qe.cacheIndex == -1) {
@@ -1479,7 +1479,8 @@ iSPARQL.QBE = function (def_obj) {
 	    sponge:$v("qbe_sponge"),
 	    endpoint:iSPARQL.endpointOpts.endpointPath,
 	    pragmas:iSPARQL.endpointOpts.pragmas,
-	    maxrows:iSPARQL.dataObj.maxrows
+	    maxrows:iSPARQL.dataObj.maxrows,
+	    view:0
 	}
 	iSPARQL.recentQueryUI.addQuery (p.query);
 	
diff --git a/binsrc/isparql/statusui.js b/binsrc/isparql/statusui.js
index 1481008..d703b8c 100644
--- a/binsrc/isparql/statusui.js
+++ b/binsrc/isparql/statusui.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: statusui.js,v 1.1.2.3 2010/06/28 09:33:06 source Exp $
+ *  $Id: statusui.js,v 1.1.2.5 2011/02/03 10:28:23 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -24,8 +24,25 @@ iSPARQL.StatusUI = {
 	else
 	    $("statMsgElem").innerHTML = msg;
     },
+    init: function () {
+	OAT.Dom.show ("splashThrobber");
+    },
     errMsg: function (msg) {
 	$("statMsgErr").innerHTML = msg;
+    },
+    addCustomTemplate: function (div) {
+	var c = this.newTplCtr ();
+	OAT.Dom.append ([c, div]);
+    },
+    newTplCtr: function () {
+	var custCtr = OAT.Dom.create ("div",{className:"statusUICustCtr"});
+	OAT.Dom.append(["statMsgMain",custCtr]);
+	return custCtr;
+    },
+    absorb: function (ctr) {
+	var c = OAT.Dom.create ("div", {className: "statusUIAbsorbedCtr"})
+	OAT.Dom.unlink (ctr);
+	OAT.Dom.append ([c, ctr]);
     }
 };
 
diff --git a/binsrc/isparql/styles/dialog.css b/binsrc/isparql/styles/dialog.css
index 086b07a..49cc246 100644
--- a/binsrc/isparql/styles/dialog.css
+++ b/binsrc/isparql/styles/dialog.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: dialog.css,v 1.1.2.3 2010/03/12 09:01:02 source Exp $
+ *  $Id: dialog.css,v 1.1.2.5 2011/01/25 14:08:45 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -18,10 +18,19 @@ div.btn_row {
   float: left;
 }
 
-#auth_dlg label { float: left; width: 100px; }
-#auth_dlg_error { margin: 10px 10px 10px 100px; }
+#auth_dlg label { 
+  float: left; 
+  width: 100px; 
+}
 
-#splash { width: 100%; text-align: center; }
+#auth_dlg_error { 
+  margin: 10px 10px 10px 100px; 
+}
+
+#splash { 
+  width: 100%; 
+  text-align: center; 
+}
 
 #splash_inner {
   margin: 100px auto 0 auto;
@@ -31,12 +40,26 @@ div.btn_row {
   moz-border-radius: 6px 6px 6px 6px;
 }
 
-#statMsgMain { font-size: 10pt; font-weight: bold; margin-top: 10px; }
+#statMsgMain { 
+  font-size: 10pt; 
+  font-weight: bold; 
+  margin-top: 10px; 
+}
+
+#splash_hd { 
+  background-color: #fff; 
+}
 
-#splash_hd { background-color: #fff; }
-#splash_hd img { height: 35px; vertical-align: middle; margin: 10px 0 10px 0;}
+#splash_hd img { 
+  height: 35px; 
+  vertical-align: middle; 
+  margin: 10px 0 10px 0;
+}
 
-#splash_copyr { margin-top: 15px; font-size: 8px; }
+#splash_copyr { 
+  margin-top: 15px; 
+  font-size: 8px; 
+}
 
 #splash_foot {
   padding: 4px 0 4px 0;
@@ -45,7 +68,11 @@ div.btn_row {
   background-color: #3bafd5;
 }
 
-#locAcquireUI { width: 100%; text-align: center; position: absolute;}
+#locAcquireUI { 
+  width: 100%; 
+  text-align: center; 
+  position: absolute;
+}
 
 #locAcquireUI_inner {
   padding: 6px;
@@ -57,8 +84,90 @@ div.btn_row {
   border-radius: 6px 6px 6px 6px;
 }
 
-#locAcquireMsg { margin: 5px; } 
+#locAcquireMsg { 
+  margin: 5px; } 
+
+#locAcquireCurrent { 
+  margin: 5px; }
+
+#locAcquireBtnCtr { 
+  margin-top: 5px;
+}
+
+/* preferences dialog */
+
+#prefs_dlg { margin: 5px } 
+
+#prefs_dlg label {
+  font-weight: bold;
+  display: block;
+  float: left;
+  clear: left;
+  width: 150px;
+}
+
+#prefs_dlg label.ckb { 
+  clear: none;
+  width: auto;
+  margin-right: 5px;
+  margin-left: 5px;
+  vertical-align: middle;
+}
+
+div.prefs_tab_ctr {
+  margin-bottom: 2ex;
+}
+
+#shortener { margin-top: 10px; vertical-align: middle;}
+
+#shortener label span.expln {
+  font-size: smaller;
+  font-weight: normal;
+}
+
+div.dialog_btnbar {
+  width: 100%;
+  margin-top: 1ex;
+  padding-top: 1ex;
+  border-top: 1px solid #666;
+}
+
+#shortener_ep { width: 150px }
+
+#shortener_ep_ckb {
+  float: left;
+  clear: left;
+  margin-left: 150px;
+}
+
+#prefs_tabrow {
+  min-height: 20px;
+  list-style-type: none;
+  padding-bottom: 1px;
+  background: #ddd
+}
+
+#prefs_tabrow li {
+  display: inline;
+  padding: 1px 3px;
+  margin-left: 0.5em;
+  cursor: pointer;
+  border-top: 1px solid #999;
+  border-left: 1px solid #999;
+  border-right: 1px solid #999;
+  background-color: #aaa;
+}
+
+#prefs_tabrow li.tab_selected {
+  background-color: #fff;
+}
 
-#locAcquireCurrent { margin: 5px; }
+#prefs_tabrow li.tab:hover {
+  background-color: #fff;
+}
+
+#prefs_tabrow.tab_signal {
+  background-color: #999;
+}
 
-#locAcquireBtnCtr { margin-top: 5px;}
+/* /tabs */
diff --git a/binsrc/isparql/styles/execute.css b/binsrc/isparql/styles/execute.css
index e773c3e..ff6e9a3 100644
--- a/binsrc/isparql/styles/execute.css
+++ b/binsrc/isparql/styles/execute.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: execute.css,v 1.4.2.4 2009/12/17 14:26:05 source Exp $
+ *  $Id: execute.css,v 1.4.2.9 2011/03/29 21:09:28 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -19,8 +19,11 @@ div.grid table,
 table.grid {
 	border-collapse: collapse;
 	font: menu;
+  width: 100%;
 }
 
+div.grid { width: 100%}
+
 /* ---------------- rows -------------- */
 
 #graphs_grid_div tr,
@@ -91,6 +94,7 @@ ul.tabres {
   text-align: left;
   border-bottom: 1px solid #000;
   margin: 0px;
+  padding: 0;
 /*  margin-right:20px; */
 }
 
@@ -145,11 +149,27 @@ body {
   margin:0px;
 }
 
+.result_plnk_ctr { width: 20em; float: left; }
+.anchor_pref_ctr { width: 20%; float: right;}
+
 p.copyright {
 font-size: 8pt;
 text-align: right;
 margin-right: 10px}
 
 #mini_rdf_ctr { width: 100% }
-/*div.rdf_mini { width: 100%; height: 70%; }
-div.rdf_tab { width: 100%; height: 100%; }*/
+/*div.rdf_mini { width: 100%; height: 70%; }*/
+div.rdf_tab { width: 100%; height: 100%; }
+
+table.grid {
+  clear: both;
+}
+
+div.rdf_data div.pager {
+  background-color: #ddd;
+  border: 1px solid #355;
+}
+
+div.pager div {
+  margin: 3px;
+}
\ No newline at end of file
diff --git a/binsrc/isparql/styles/mobile.css b/binsrc/isparql/styles/mobile.css
index a2ac293..e7d56fa 100644
--- a/binsrc/isparql/styles/mobile.css
+++ b/binsrc/isparql/styles/mobile.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: mobile.css,v 1.1.2.2 2010/03/12 09:01:02 source Exp $
+ *  $Id: mobile.css,v 1.1.2.4 2011/02/18 15:40:13 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -14,6 +14,8 @@ body {
   font-family: Helvetica,sans-serif;
 }
 
-#rdf_tab { height: device-height}
-#splash_inner {width: device-width; height: device-height;}
+#rdf_mini_ctr { height: device-height}
+#splash_inner {width: 320px;}
 #locAcquireUI {margin-top: 10px;}
+
+#result_ctr {width: device-width; height: device-width;}
diff --git a/binsrc/isparql/styles/style.css b/binsrc/isparql/styles/style.css
index 379e7fa..d1fd373 100644
--- a/binsrc/isparql/styles/style.css
+++ b/binsrc/isparql/styles/style.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: style.css,v 1.7.2.9 2010/06/28 09:33:06 source Exp $
+ *  $Id: style.css,v 1.7.2.13 2011/03/23 11:56:22 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -158,7 +158,10 @@ fieldset.deref_opts button span {
   font-weight: normal;
 }
 
-fieldset.deref_opts h4 { font-size: 10pt; margin-bottom: 5px;}
+fieldset.deref_opts h4 { 
+  font-size: 10pt; 
+  margin-bottom: 5px;
+  margin-top: 0px;}
 
 
 /*
@@ -203,6 +206,8 @@ fieldset.deref_opts h4 { font-size: 10pt; margin-bottom: 5px;}
 div.foot_l { text-align: left; float: left; clear: left; width: 45%; margin-left: 5px;}
 div.foot_r { text-align: right; float: right; width: 45%; margin-right: 5px;}
 
+span.dyn_page { vertical-align: top;}
+
 div.ubiq_gem { display: inline; border: 1px solid #577; padding: 2px 0px 3px 0; margin-left: 3px;cursor: pointer}
 div.ubiq_gem a { font-family: sans-serif; font-size: 10px; margin: 0; text-decoration: none; color: #577; height: 16px; }
 div.ubiq_gem span.text { margin: 0 4px 0 4px; }
@@ -283,7 +288,10 @@ ul#nav_bar {
   background-color: #999;
 }
 
-/* /tabs */
+div.rdf_data {
+  float: left;
+  clear: both;
+}
 
 img.corner {
   width: 15px;
@@ -300,9 +308,13 @@ img.corner {
 
 div.pager {
   float: left; clear: both;
-  background-color: #576;
-  width: 99%;
-  text-align: center;
+  background-color: #ddd;
+  width: 100%;
+  border: 1px solid #355;
+}
+
+div.pager div {
+  margin:3px;
 }
 
 div.pager a {
@@ -354,6 +366,12 @@ label.load { font-size: 8pt; font-weight: normal}
   margin-right: 6px;
 }
 
+#page_content {
+  width: 100%;
+  float:left;
+  clear: both;
+}
+
 #page_results{
   padding:10px 0px 0px 0px;
 }
@@ -392,7 +410,7 @@ div#virtuoso_options
 }
 
 #service{
-  width: 390px;
+  width: 320px;
 }
 
 #default-graph-uri {
diff --git a/binsrc/isparql/ubiq.js b/binsrc/isparql/ubiq.js
index 0786ca4..baf74b5 100644
--- a/binsrc/isparql/ubiq.js
+++ b/binsrc/isparql/ubiq.js
@@ -25,3 +25,9 @@ function gen_sparql_bookmarklet () {
   $('sparql_bookmarklet_a').href = 'javascript: (function () { location="'+ l + '" + encodeURIComponent(document.location) + "' + w + '";})()';
 }
 
+function enable_if_ubiq (elm_id) {
+    var ua = navigator.userAgent;
+    if (ua.indexOf ('Firefox') != -1) {
+	OAT.Dom.show(elm_id)
+    }
+}
diff --git a/binsrc/isparql/vad_version b/binsrc/isparql/vad_version
index d6a9423..c2a7180 100644
--- a/binsrc/isparql/vad_version
+++ b/binsrc/isparql/vad_version
@@ -1 +1 @@
-1.25.20
+1.26.72
diff --git a/binsrc/jena/ChangeLog b/binsrc/jena/ChangeLog
deleted file mode 100644
index a36d6e8..0000000
--- a/binsrc/jena/ChangeLog
+++ /dev/null
@@ -1,500 +0,0 @@
-2009-12-07 14:02  source
-
-	* Makefile.am: * Fixed build issue when java has not been
-	  configured
-
-2009-10-23 12:36  source
-
-	* virt_jena.jar: * Rebuild driver
-
-2009-10-23 12:36  source
-
-	* virtuoso_driver/VirtGraph.java: * Reverted previous patch
-
-2009-10-20 12:44  source
-
-	* virtuoso_driver/VirtGraph.java: * FIxed use Node.NULL instead of
-	  null
-
-2009-10-20 12:43  source
-
-	* virt_jena.jar: * Regenerated driver
-
-2009-10-20 12:41  source
-
-	* virtuoso_driver/VirtGraph.java: * Fixed use Node.NULL instead of
-	  null
-
-2009-09-18 18:10  source
-
-	* Makefile.am, virt_jena.jar, testsuite/VirtuosoTestGraph.class,
-	  testsuite/VirtuosoTestGraph.java, testsuite/start.bat,
-	  testsuite/start.sh, virtuoso_driver/VirtBulkUpdateHandler.java,
-	  virtuoso_driver/VirtDataSource.java,
-	  virtuoso_driver/VirtGraph.java, virtuoso_driver/VirtModel.java,
-	  virtuoso_driver/VirtuosoSPARQLExample3.java: * Merged from HEAD
-
-2009-09-18 17:07  source
-
-	* virt_jena.jar: * Regenerated driver and tsuite
-
-2009-09-18 17:07  source
-
-	* Makefile.am, testsuite/start.bat, testsuite/start.sh,
-	  virtuoso_driver/VirtuosoSPARQLExample3.java: * Added reference to
-	  xml-apis.jar which is needed for JDK 1.4.2
-
-2009-09-18 10:58  source
-
-	* virt_jena.jar: * Rebuild driver
-
-2009-09-18 10:57  source
-
-	* Makefile.am, testsuite/VirtuosoTestGraph.class,
-	  testsuite/VirtuosoTestGraph.java,
-	  virtuoso_driver/VirtBulkUpdateHandler.java,
-	  virtuoso_driver/VirtDataSource.java,
-	  virtuoso_driver/VirtGraph.java, virtuoso_driver/VirtModel.java: *
-	  Fixed building Jena Provider with JDK1.4
-
-2009-09-17 16:40  source
-
-	* virt_jena.jar, virtuoso_driver/VirtDataSource.java,
-	  virtuoso_driver/VirtuosoQueryExecutionFactory.java,
-	  virtuoso_driver/VirtuosoSPARQLExample10.java,
-	  virtuoso_driver/VirtuosoSPARQLExample11.java: * Merged from HEAD
-
-2009-09-17 16:38  source
-
-	* virt_jena.jar: * Rebuild drivers
-
-2009-09-17 16:35  source
-
-	* virtuoso_driver/VirtuosoQueryExecutionFactory.java: * Fixed
-	  running query on VirtDataSource
-
-2009-09-15 11:14  source
-
-	* virt_jena.jar: * Regenerated driver
-
-2009-09-15 11:10  source
-
-	* virtuoso_driver/: VirtDataSource.java,
-	  VirtuosoSPARQLExample10.java, VirtuosoSPARQLExample11.java: *
-	  Added support for VirtDataSource constructors * Added new samples
-
-2009-09-15 11:10  source
-
-	* virtuoso_driver/VirtuosoSPARQLExample10.java: file
-	  VirtuosoSPARQLExample10.java was added on branch V6_0_0-DEVEL on
-	  2009-09-17 14:40:06 +0000
-
-2009-09-15 11:10  source
-
-	* virtuoso_driver/VirtuosoSPARQLExample11.java: file
-	  VirtuosoSPARQLExample11.java was added on branch V6_0_0-DEVEL on
-	  2009-09-17 14:40:06 +0000
-
-2009-09-04 12:46  source
-
-	* virt_jena.jar, virtuoso_driver/VirtGraph.java: * Merged from V5
-
-2009-09-03 16:46  source
-
-	* virt_jena.jar: * Rebuild drivers
-
-2009-09-03 16:41  source
-
-	* virt_jena.jar, virtuoso_driver/VirtGraph.java: * Fixed problem
-	  with pooled connections
-
-2009-07-21 21:27  source
-
-	* Makefile.am, README: * Merged from HEAD
-
-2009-07-17 12:34  source
-
-	* Makefile.am, README: * Moved README files to top directory
-
-2009-07-14 22:16  source
-
-	* Makefile.am: * Merged from HEAD
-
-2009-07-14 21:57  source
-
-	* Makefile.am: * Fixed configuring JDK on Mac OS X and other
-	  platforms
-
-2009-06-23 11:51  source
-
-	* virt_jena.jar, virtuoso_driver/VirtuosoQueryExecution.java,
-	  virtuoso_driver/VirtuosoUpdateRequest.java: * Merged from HEAD
-
-2009-06-23 11:32  source
-
-	* virt_jena.jar: * Regenerated driver
-
-2009-06-23 11:16  source
-
-	* virtuoso_driver/: VirtuosoQueryExecution.java,
-	  VirtuosoUpdateRequest.java: * Fixed exception when using
-	  concurrent JDBC connections
-
-2009-06-04 21:33  source
-
-	* virt_jena.jar: * Regenerated drivers
-
-2009-06-04 16:57  source
-
-	* virtuoso_driver/: VirtGraph.java, VirtuosoQueryExecution.java,
-	  VirtuosoUpdateRequest.java: * Merged from HEAD
-
-2009-06-03 14:34  source
-
-	* virtuoso_driver/: VirtGraph.java, VirtuosoQueryExecution.java,
-	  VirtuosoUpdateRequest.java: * Added initial support for
-	  failover/roundrobin connections
-
-2009-04-21 18:43  source
-
-	* virt_jena.jar: * Regenerated driver
-
-2009-02-20 12:47  source
-
-	* virt_jena.jar: * Regenerated driver
-
-2009-02-20 12:47  source
-
-	* virtuoso_driver/VirtDataSource.java: * Fixed problem with
-	  autocommit
-
-2008-11-24 12:13  source
-
-	* virt_jena.jar: * Regenerated driver
-
-2008-11-24 12:13  source
-
-	* virtuoso_driver/VirtGraph.java: * Fixed timestamp
-
-2008-11-14 11:00  source
-
-	* virt_jena.jar: * Regenerated driver
-
-2008-11-14 11:00  source
-
-	* virtuoso_driver/: VirtGraph.java, VirtuosoQueryExecution.java: *
-	  Fixed problem in spasql code generation
-
-2008-11-04 16:33  source
-
-	* virt_jena.jar: * Regenerated file
-
-2008-08-26 21:23  source
-
-	* Makefile.am: * Added missing file to distribution
-
-2008-07-17 11:08  source
-
-	* Makefile.am: [no log message]
-
-2008-07-17 09:36  source
-
-	* virt_jena.jar: * Regenerated provider
-
-2008-07-17 09:36  source
-
-	* virtuoso_driver/: VirtGraph.java, VirtPrefixMapping.java,
-	  VirtResSetIter.java, VirtuosoQueryExecution.java,
-	  VirtuosoUpdateRequest.java: * Added option to change fetch buffer
-	  size (default 200) * Fixed speed of batch mode
-
-2008-07-16 17:14  source
-
-	* virt_jena.jar: * Regenerated driver
-
-2008-07-16 17:13  source
-
-	* virtuoso_driver/VirtGraph.java: * Fixed counting physical triples
-
-2008-07-14 15:43  source
-
-	* virt_jena.jar: * Regenerated provider
-
-2008-07-14 15:43  source
-
-	* virtuoso_driver/VirtGraph.java: * Initial fixes to support
-	  JDK1.6/JDBC 4.x
-
-2008-07-14 12:07  source
-
-	* virt_jena.jar: * Regenerated provider
-
-2008-07-14 12:06  source
-
-	* virtuoso_driver/VirtGraph.java: * Fixed sparql syntax
-
-2008-07-14 10:00  source
-
-	* virt_jena.jar, testsuite/VirtuosoTestGraph.class: * Regenerated
-	  provider
-
-2008-07-14 09:56  source
-
-	* virtuoso_driver/VirtGraph.java: * Fixed delete graph
-
-2008-07-09 17:45  source
-
-	* Makefile.am: * Fixed make clean * Fixed dependency check
-
-2008-07-09 17:43  source
-
-	* .cvsignore: * Added more files to ignore
-
-2008-06-30 16:29  source
-
-	* testsuite/: VirtuosoTestGraph.java, start.bat, start.sh: * Fixed
-	  testsuite
-
-2008-06-30 08:39  source
-
-	* README: * Updated documentation
-
-2008-06-27 17:52  source
-
-	* Makefile.am, README, testsuite/start.sh: * Updated for building
-	  with Jena 2.5.6
-
-2008-06-27 16:06  source
-
-	* Makefile.am, virt_jena.jar, testsuite/.cvsignore,
-	  testsuite/VirtuosoTestGraph.class,
-	  testsuite/VirtuosoTestGraph.java, testsuite/start.bat,
-	  testsuite/start.sh,
-	  testsuite/testing/regression/testModelEquals/1-1.rdf,
-	  testsuite/testing/regression/testModelEquals/1-2.rdf,
-	  testsuite/testing/regression/testModelEquals/2-1.rdf,
-	  testsuite/testing/regression/testModelEquals/2-2.rdf,
-	  testsuite/testing/regression/testModelEquals/3-1.rdf,
-	  testsuite/testing/regression/testModelEquals/3-2.rdf,
-	  testsuite/testing/regression/testModelEquals/4-1.rdf,
-	  testsuite/testing/regression/testModelEquals/4-2.rdf,
-	  testsuite/testing/regression/testModelEquals/5-1.rdf,
-	  testsuite/testing/regression/testModelEquals/5-2.rdf,
-	  testsuite/testing/regression/testModelEquals/6-1.rdf,
-	  testsuite/testing/regression/testModelEquals/6-2.rdf,
-	  testsuite/testing/regression/testModelEquals/7-1.nt,
-	  testsuite/testing/regression/testModelEquals/7-2.nt,
-	  testsuite/testing/regression/testModelEquals/8-1.nt,
-	  testsuite/testing/regression/testModelEquals/8-2.nt,
-	  testsuite/testing/regression/testNTripleReader/1.nt,
-	  testsuite/testing/regression/testReaderInterface/1.rdf,
-	  testsuite/testing/regression/testReaderInterface/2.nt,
-	  testsuite/testing/regression/testWriterAndReader/t1000.rdf,
-	  testsuite/testing/regression/testWriterAndReader/t2000.rdf,
-	  testsuite/testing/regression/testWriterAndReader/t3000.rdf,
-	  testsuite/testing/regression/testWriterAndReader/t4000.rdf,
-	  testsuite/testing/regression/testWriterAndReader/t5000.rdf,
-	  testsuite/testing/regression/testWriterAndReader/t6000.rdf,
-	  testsuite/testing/regression/testWriterAndReader/t7000.rdf,
-	  testsuite/testing/regression/testWriterAndReader/t8000.rdf,
-	  testsuite/testing/regression/testWriterAndReader/t9000.rdf: *
-	  Added Jena JUnit testsuite
-
-2008-06-27 10:04  source
-
-	* virt_jena.jar: * Regenerated driver
-
-2008-06-27 10:04  source
-
-	* .cvsignore, Makefile.am: * Added rule for building provider doc
-
-2008-06-27 10:03  source
-
-	* virtuoso_driver/VirtGraph.java: * Fixed unicode support
-
-2008-06-26 15:36  source
-
-	* virt_jena.jar: * Regenerated provider
-
-2008-06-26 13:15  source
-
-	* virtuoso_driver/: VirtBulkUpdateHandler.java,
-	  VirtDataSource.java, VirtGraph.java, VirtPrefixMapping.java,
-	  VirtuosoQueryExecution.java, VirtuosoUpdateRequest.java: * Added
-	  provider optimizations using array parameter binding
-
-2008-06-20 15:58  source
-
-	* virt_jena.jar: * Regenerated driver
-
-2008-06-20 15:31  source
-
-	* virtuoso_driver/: VirtuosoSPARQLExample1.java,
-	  VirtuosoSPARQLExample2.java, VirtuosoSPARQLExample3.java,
-	  VirtuosoSPARQLExample4.java, VirtuosoSPARQLExample5.java,
-	  VirtuosoSPARQLExample6.java, VirtuosoSPARQLExample7.java,
-	  VirtuosoSPARQLExample8.java, VirtuosoSPARQLExample9.java: * Fixed
-	  connection url to be changed on commandline
-
-2008-06-20 15:20  source
-
-	* virtuoso_driver/: VirtuosoQueryExecution.java,
-	  VirtuosoUpdateRequest.java: * Fixed check for
-	  virtuoso.jdbc3.Driver
-
-2008-06-19 09:39  source
-
-	* virtuoso_driver/VirtuosoSPARQLExample8.java: * Fixed example
-
-2008-06-18 10:22  source
-
-	* virt_jena.jar: * Regenerated driver
-
-2008-06-18 10:21  source
-
-	* virtuoso_driver/: VirtDataSource.java,
-	  VirtuosoQueryExecution.java, VirtuosoSPARQLExample9.java: * Added
-	  optimizations
-
-2008-06-17 14:41  source
-
-	* Makefile.am, virt_jena.jar, virtuoso_driver/VirtDataSource.java,
-	  virtuoso_driver/VirtGraph.java,
-	  virtuoso_driver/VirtPrefixMapping.java,
-	  virtuoso_driver/VirtResSetIter.java,
-	  virtuoso_driver/VirtuosoQueryExecution.java,
-	  virtuoso_driver/VirtuosoQueryExecutionFactory.java,
-	  virtuoso_driver/VirtuosoSPARQLExample8.java,
-	  virtuoso_driver/VirtuosoUpdateFactory.java,
-	  virtuoso_driver/VirtuosoUpdateRequest.java: * Added enhancements
-	  to Jena provider
-
-2008-06-04 16:23  source
-
-	* virt_jena.jar: * Regenerated
-
-2008-06-04 16:17  source
-
-	* virtuoso_driver/VirtResSetIter.java: * Fixed handling of Literals
-	  that are sent without a type
-
-2008-06-04 13:20  source
-
-	* virtuoso_driver/: VirtDataSource.java, VirtGraph.java,
-	  VirtResSetIter.java, VirtuosoQueryExecution.java: * Added sparql
-	  optimizations
-
-2008-05-08 16:52  source
-
-	* virt_jena.jar: * Rebuild jena driver
-
-2008-05-08 16:51  source
-
-	* virtuoso_driver/: VirtBulkUpdateHandler.java,
-	  VirtDataSource.java, VirtGraph.java, VirtResSetIter.java,
-	  VirtTransactionHandler.java, VirtuosoQueryExecution.java: * Fixed
-	  bugs in jena driver
-
-2008-04-22 12:07  source
-
-	* virt_jena.jar: * Regenerated jena driver
-
-2008-04-22 12:06  source
-
-	* Makefile.am, virtuoso_driver/VirtDataSource.java: * Added support
-	  for DataSource API
-
-2008-04-14 11:53  source
-
-	* virt_jena.jar: * Regenerated driver
-
-2008-04-14 11:52  source
-
-	* virtuoso_driver/VirtBulkUpdateHandler.java: * Fixed wrong
-	  function namespace
-
-2008-04-14 09:31  source
-
-	* virtuoso_driver/: VirtuosoSPARQLExample6.java,
-	  VirtuosoSPARQLExample7.java: * Added VirtuosoSPARQLExample6 to
-	  test transactionHandler * Added VirtuosoSPARQLExample7 to test
-	  bulkUpdateHandler
-
-2008-04-14 09:30  source
-
-	* virtuoso_driver/VirtBulkUpdateHandler.java: * Fixed problem with
-	  transaction model
-
-2008-04-14 09:20  source
-
-	* virtuoso_driver/: VirtBulkUpdateHandler.java,
-	  VirtTransactionHandler.java: * Fixed CRLF
-
-2008-04-10 09:30  source
-
-	* virt_jena.jar: * Recompiled jena driver
-
-2008-04-10 09:26  source
-
-	* virtuoso_driver/VirtBulkUpdateHandler.java,
-	  virtuoso_driver/VirtGraph.java, virtuoso_driver/VirtModel.java,
-	  virtuoso_driver/VirtResSetIter.java,
-	  virtuoso_driver/VirtTransactionHandler.java,
-	  virtuoso_driver/VirtuosoQueryExecution.java,
-	  virtuoso_driver/VirtuosoQueryExecutionFactory.java,
-	  virtuoso_driver/VirtuosoSPARQLExample1.java,
-	  virtuoso_driver/VirtuosoSPARQLExample2.java,
-	  virtuoso_driver/VirtuosoSPARQLExample3.java,
-	  virtuoso_driver/VirtuosoSPARQLExample4.java,
-	  virtuoso_driver/VirtuosoSPARQLExample5.java, Makefile.am: * Added
-	  missing interfaces to Jena provider
-
-2008-03-13 14:48  source
-
-	* README: * Fixed docs
-
-2008-01-24 10:59  source
-
-	* Makefile.am: * Fixed make install in DESTDIR
-
-2007-11-28 10:57  source
-
-	* virt_jena.jar: * Rebuild .jar file
-
-2007-11-27 13:20  source
-
-	* virt_jena.jar: * Rebuild driver
-
-2007-11-27 13:20  source
-
-	* virtuoso_driver/VirtuosoSPARQLExample1.java: * Limit resultset
-	  size
-
-2007-11-21 13:56  source
-
-	* Makefile.am, README, virt_jena.jar: * Added proper build rules
-	  for building .jar files
-
-2007-11-21 12:10  source
-
-	* .cvsignore, Makefile.am, README, virt_jena.jar: * Added jena and
-	  sesame code to distribution
-
-2007-11-21 12:07  source
-
-	* virtuoso_driver/: VirtGraph.java, VirtResSetIter.java,
-	  VirtuosoQueryExecution.java, VirtuosoQueryExecutionFactory.java,
-	  VirtuosoSPARQLExample1.java, VirtuosoSPARQLExample2.java,
-	  VirtuosoSPARQLExample3.java, VirtuosoSPARQLExample4.java,
-	  VirtuosoSPARQLExample5.java: * Fixed namespace * Added comments *
-	  Fixed connect string
-
-2007-11-20 13:21  source
-
-	* virtuoso_driver/: .cvsignore, VirtGraph.java,
-	  VirtResSetIter.java, VirtuosoQueryExecution.java,
-	  VirtuosoQueryExecutionFactory.java, VirtuosoSPARQLExample1.java,
-	  VirtuosoSPARQLExample2.java, VirtuosoSPARQLExample3.java,
-	  VirtuosoSPARQLExample4.java, VirtuosoSPARQLExample5.java: * Added
-	  RDF driver source for Jena, Sesame and RedLand
-
diff --git a/binsrc/jena/Makefile.am b/binsrc/jena/Makefile.am
index 1638c96..82190c8 100644
--- a/binsrc/jena/Makefile.am
+++ b/binsrc/jena/Makefile.am
@@ -62,8 +62,8 @@ install-data-local:
 	-cp virt_jena.jar "$(DESTDIR)${libdir}/jena"
 
 lib:
-	@test -d lib || touch virt_jena.jar
 	-mkdir lib
+	-touch -c virt_jena.jar
 	@echo "Please refer to ~/README.jena file for missing .jar files"
 
 virt_jena.jar: $(JENA_SRC) manifest.main
@@ -79,7 +79,7 @@ doc:
 	$(JAVADOC) -d doc \
 		-classpath "$(JENA_CLASSPATH)" \
 		$(JENA_SRC)
-	
+
 #
 #  Run testsuite if WITH_JDK was found
 #
@@ -94,8 +94,15 @@ run-tests:
 	@echo "***WARNING: Disabled Jena test suite"
 endif
 
+
+.PHONY: version
+version:
+	$(JAVA) -jar ./virt_jena.jar
+
+
 clean-local:
 	-rm -rf out.driver doc
+	-rmdir lib
 
 
 # ----------------------------------------------------------------------
diff --git a/binsrc/jena/Makefile.in b/binsrc/jena/Makefile.in
index a2809fc..92135ec 100644
--- a/binsrc/jena/Makefile.in
+++ b/binsrc/jena/Makefile.in
@@ -55,7 +55,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 subdir = binsrc/jena
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/binsrc/config/libtool.m4 \
 	$(top_srcdir)/binsrc/config/libxml.m4 \
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
@@ -510,8 +511,8 @@ install-data-local:
 	-cp virt_jena.jar "$(DESTDIR)${libdir}/jena"
 
 lib:
-	@test -d lib || touch virt_jena.jar
 	-mkdir lib
+	-touch -c virt_jena.jar
 	@echo "Please refer to ~/README.jena file for missing .jar files"
 
 virt_jena.jar: $(JENA_SRC) manifest.main
@@ -539,8 +540,13 @@ doc:
 @WITH_JDK3_FALSE at run-tests:
 @WITH_JDK3_FALSE@	@echo "***WARNING: Disabled Jena test suite"
 
+.PHONY: version
+version:
+	$(JAVA) -jar ./virt_jena.jar
+
 clean-local:
 	-rm -rf out.driver doc
+	-rmdir lib
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/binsrc/jena/virtuoso_driver/Version.java b/binsrc/jena/virtuoso_driver/Version.java
index 935e70a..ee521a5 100644
--- a/binsrc/jena/virtuoso_driver/Version.java
+++ b/binsrc/jena/virtuoso_driver/Version.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: Version.java,v 1.1.4.2 2010/07/05 12:40:15 source Exp $
+ *  $Id: Version.java,v 1.1.4.5 2011/03/23 11:58:08 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -29,7 +29,7 @@ public class Version {
    protected static final String DRV_VER = "2.6.2";
 
    // The major and minor version number
-   protected static final String build_id = "1.1";
+   protected static final String build_id = "1.4";
 
    public static void main(String args[])
    {
diff --git a/binsrc/jena/virtuoso_driver/VirtGraph.java b/binsrc/jena/virtuoso_driver/VirtGraph.java
index 841fdc7..9bffe2b 100644
--- a/binsrc/jena/virtuoso_driver/VirtGraph.java
+++ b/binsrc/jena/virtuoso_driver/VirtGraph.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtGraph.java,v 1.15.2.13 2010/07/05 12:40:15 source Exp $
+ *  $Id: VirtGraph.java,v 1.15.2.15 2011/03/08 13:44:11 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -42,6 +42,9 @@ import virtuoso.jdbc3.VirtuosoDataSource;
 
 public class VirtGraph extends GraphBase
 {
+    static {
+        VirtuosoQueryEngine.register();
+    }
 
     static public final String DEFAULT = "virt:DEFAULT";
     protected String graphName;
@@ -347,7 +350,7 @@ public class VirtGraph extends GraphBase
       else if (n.isBlank()) 
         ps.setString(col, "_:"+n.toString());
       else 
-	ps.setString(col, n.toString());
+        throw new SQLException("Only URI or Blank nodes can be used as subject");
     }
 
 	
@@ -355,7 +358,10 @@ public class VirtGraph extends GraphBase
     {
       if (n == null)
         return;
+      if (n.isURI()) 
       ps.setString(col, n.toString());
+      else
+        throw new SQLException("Only URI nodes can be used as predicate");
     }
 
     void bindObject(PreparedStatement ps, int col, Node n) throws SQLException 
diff --git a/binsrc/jena/virtuoso_driver/VirtTransactionHandler.java b/binsrc/jena/virtuoso_driver/VirtTransactionHandler.java
index aac0a5d..c54390d 100644
--- a/binsrc/jena/virtuoso_driver/VirtTransactionHandler.java
+++ b/binsrc/jena/virtuoso_driver/VirtTransactionHandler.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtTransactionHandler.java,v 1.3.2.1 2010/04/01 10:54:36 source Exp $
+ *  $Id: VirtTransactionHandler.java,v 1.3.2.2 2011/03/23 11:58:08 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -95,14 +95,7 @@ public class VirtTransactionHandler extends TransactionHandlerBase {
 			try {
 				Connection c = graph.getConnection();
 				c.commit();
-				try {
 					c.setAutoCommit(true);
-				} catch (Exception e) {
-					e.printStackTrace();
-				}
-				// not sure why read_uncommitted is set, below. commented
-				// out by kw.
-				// c.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
 			} catch (SQLException e) {
 				throw new JenaException("Transaction commit failed: ", e);
 			}
diff --git a/binsrc/jena/virtuoso_driver/VirtuosoQueryExecution.java b/binsrc/jena/virtuoso_driver/VirtuosoQueryExecution.java
index f73b083..9dc6c65 100644
--- a/binsrc/jena/virtuoso_driver/VirtuosoQueryExecution.java
+++ b/binsrc/jena/virtuoso_driver/VirtuosoQueryExecution.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtuosoQueryExecution.java,v 1.11.2.7 2010/07/05 12:40:15 source Exp $
+ *  $Id: VirtuosoQueryExecution.java,v 1.11.2.8 2011/03/23 11:58:08 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -288,7 +288,19 @@ public class VirtuosoQueryExecution  implements QueryExecution
     
     private String getQuery()
     {
-	StringBuffer sb = new StringBuffer("sparql\n define output:format '_JAVA_'\n");
+//--	StringBuffer sb = new StringBuffer("sparql\n define output:format '_JAVA_'\n");
+	StringBuffer sb = new StringBuffer("sparql\n ");
+	StringTokenizer tok = new StringTokenizer(virt_query);
+	String s = "";
+
+	while(tok.hasMoreTokens()) {
+	    s = tok.nextToken().toLowerCase();
+	    if (s.equals("describe") || s.equals("construct") || s.equals("ask") || s.equals("select")) 
+		break;
+	}
+	if (s.equals("describe") || s.equals("construct") || s.equals("ask")) 
+	    sb.append("define output:format '_JAVA_'\n ");
+	
 	if (graph.getRuleSet()!= null)
           sb.append(" define input:inference '"+graph.getRuleSet()+"'\n");
 
diff --git a/binsrc/maildrop/Makefile.in b/binsrc/maildrop/Makefile.in
index fe6e86a..c1e3d2b 100644
--- a/binsrc/maildrop/Makefile.in
+++ b/binsrc/maildrop/Makefile.in
@@ -204,6 +204,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/maildrop/odbc_mail_vers.c b/binsrc/maildrop/odbc_mail_vers.c
index 09eb304..d6277c3 100644
--- a/binsrc/maildrop/odbc_mail_vers.c
+++ b/binsrc/maildrop/odbc_mail_vers.c
@@ -4,6 +4,6 @@
 
 char version[] = "\
 OpenLink ODBC Mail Interface\n\
-Version 2.01 as of Tue Jun 29 14:24:10 CEST 2010.\n\
-Compiled for Linux 2.6.30.10-105.2.23.fc11.x86_64\n\
+Version 2.01 as of Tue Mar 29 18:20:16 CEST 2011.\n\
+Compiled for Linux 2.6.34.7-56.fc13.x86_64\n\
 Copyright (C) OpenLink Software.\n";
diff --git a/binsrc/maildrop/virt_mail_vers.c b/binsrc/maildrop/virt_mail_vers.c
index 2683435..54ca07e 100644
--- a/binsrc/maildrop/virt_mail_vers.c
+++ b/binsrc/maildrop/virt_mail_vers.c
@@ -4,6 +4,6 @@
 
 char version[] = "\
 OpenLink Virtuoso Mail Interface\n\
-Version 2.01 as of Tue Jun 29 14:24:10 CEST 2010.\n\
-Compiled for Linux 2.6.30.10-105.2.23.fc11.x86_64\n\
+Version 2.01 as of Tue Mar 29 18:20:16 CEST 2011.\n\
+Compiled for Linux 2.6.34.7-56.fc13.x86_64\n\
 Copyright (C) OpenLink Software.\n";
diff --git a/binsrc/mono/Makefile.in b/binsrc/mono/Makefile.in
index cb0c5d2..8ae7d52 100644
--- a/binsrc/mono/Makefile.in
+++ b/binsrc/mono/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/oat/Makefile.in b/binsrc/oat/Makefile.in
index 02c69d6..a8ece80 100644
--- a/binsrc/oat/Makefile.in
+++ b/binsrc/oat/Makefile.in
@@ -159,6 +159,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/oat/images/markers/book.png b/binsrc/oat/images/markers/book.png
new file mode 100644
index 0000000..73267e7
Binary files /dev/null and b/binsrc/oat/images/markers/book.png differ
diff --git a/binsrc/oat/images/markers/camera.png b/binsrc/oat/images/markers/camera.png
new file mode 100644
index 0000000..c865c14
Binary files /dev/null and b/binsrc/oat/images/markers/camera.png differ
diff --git a/binsrc/oat/images/markers/car.png b/binsrc/oat/images/markers/car.png
new file mode 100644
index 0000000..65958f8
Binary files /dev/null and b/binsrc/oat/images/markers/car.png differ
diff --git a/binsrc/oat/images/markers/coffee.png b/binsrc/oat/images/markers/coffee.png
new file mode 100644
index 0000000..71e8977
Binary files /dev/null and b/binsrc/oat/images/markers/coffee.png differ
diff --git a/binsrc/oat/images/markers/creditcards.png b/binsrc/oat/images/markers/creditcards.png
new file mode 100644
index 0000000..241580e
Binary files /dev/null and b/binsrc/oat/images/markers/creditcards.png differ
diff --git a/binsrc/oat/images/markers/dollar.png b/binsrc/oat/images/markers/dollar.png
new file mode 100644
index 0000000..de5ff1d
Binary files /dev/null and b/binsrc/oat/images/markers/dollar.png differ
diff --git a/binsrc/oat/images/markers/drink.png b/binsrc/oat/images/markers/drink.png
new file mode 100644
index 0000000..f5ff29b
Binary files /dev/null and b/binsrc/oat/images/markers/drink.png differ
diff --git a/binsrc/oat/images/markers/football.png b/binsrc/oat/images/markers/football.png
new file mode 100644
index 0000000..2ef49f7
Binary files /dev/null and b/binsrc/oat/images/markers/football.png differ
diff --git a/binsrc/oat/images/markers/house.png b/binsrc/oat/images/markers/house.png
new file mode 100644
index 0000000..159f88a
Binary files /dev/null and b/binsrc/oat/images/markers/house.png differ
diff --git a/binsrc/oat/images/markers/info.png b/binsrc/oat/images/markers/info.png
new file mode 100644
index 0000000..4531c8a
Binary files /dev/null and b/binsrc/oat/images/markers/info.png differ
diff --git a/binsrc/oat/images/markers/mail.png b/binsrc/oat/images/markers/mail.png
new file mode 100644
index 0000000..1ee67cd
Binary files /dev/null and b/binsrc/oat/images/markers/mail.png differ
diff --git a/binsrc/oat/images/markers/shield.png b/binsrc/oat/images/markers/shield.png
new file mode 100644
index 0000000..549b5c7
Binary files /dev/null and b/binsrc/oat/images/markers/shield.png differ
diff --git a/binsrc/oat/images/markers/shoppingcart.png b/binsrc/oat/images/markers/shoppingcart.png
new file mode 100644
index 0000000..4ccaf65
Binary files /dev/null and b/binsrc/oat/images/markers/shoppingcart.png differ
diff --git a/binsrc/oat/images/markers/star.png b/binsrc/oat/images/markers/star.png
new file mode 100644
index 0000000..0fee010
Binary files /dev/null and b/binsrc/oat/images/markers/star.png differ
diff --git a/binsrc/oat/images/throbber_small.gif b/binsrc/oat/images/throbber_small.gif
new file mode 100644
index 0000000..d0bce15
Binary files /dev/null and b/binsrc/oat/images/throbber_small.gif differ
diff --git a/binsrc/oat/styles/rdftabs.css b/binsrc/oat/styles/rdftabs.css
index bc6da41..ba0b40d 100644
--- a/binsrc/oat/styles/rdftabs.css
+++ b/binsrc/oat/styles/rdftabs.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: rdftabs.css,v 1.6.2.2 2010/06/28 09:35:57 source Exp $
+ *  $Id: rdftabs.css,v 1.6.2.5 2011/02/18 15:39:42 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -27,9 +27,6 @@
 
 .rdf_sort {
 	padding-bottom: 10px;
-	background: url("../images/bottom_bkg_grad.png");
-	background-repeat: repeat-x;
-	background-position: bottom
 }
 
 .rdft_browser .rdf_item h3 {	
@@ -121,17 +118,19 @@
 	float: left;
 }
 
-h3.rdf_nav_title {clear: both; font-weight: bold;}
+h3.rdf_nav_title {clear: both; font-weight: bold;margin-bottom: 0;}
 
 #rdf_nav_breadcrumbs a { font-size: bigger; text-decoration: none }
 #rdf_nav_breadcrumbs a:hover { text-decoration: underline; }
 
+.rdf_nav_content { float: left; width: 100%}
+
 /* navigation - spotlight table */
 
 .rdf_nav_spotlight {
 	width: 100%;
 	border-collapse: collapse;
-	margin: 1em 0em;
+	margin: 0;
 }
 
 .rdf_nav_spotlight td {
@@ -139,13 +138,14 @@ h3.rdf_nav_title {clear: both; font-weight: bold;}
 }
 
 .rdf_nav_header {
-	color: #fff;
+	color: #334;
 	font-weight: bold;
-	background: #677;
+	background: #fff;
 	height: 25px;
-	-moz-border-radius: 9px 9px 0px 0px;
+/*	-moz-border-radius: 9px 9px 0px 0px;
 	-webkit-border-radius: 9px 9px 0px 0px; 
-	border-bottom: 1px solid #fff;
+	border-bottom: 1px solid #fff; */
+	border-top: 1px dotted #aaa;
 	cursor: pointer;
 }
 
diff --git a/binsrc/oat/toolkit/ajax.js b/binsrc/oat/toolkit/ajax.js
index f35eb55..23c7589 100644
--- a/binsrc/oat/toolkit/ajax.js
+++ b/binsrc/oat/toolkit/ajax.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: ajax.js,v 1.10.2.4 2010/04/06 16:46:11 source Exp $
+ *  $Id: ajax.js,v 1.10.2.6 2011/02/03 10:32:02 source Exp $
  *
  *  This file is part of the OpenLink Software AJAX Toolkit (OAT) project.
  *
@@ -59,7 +59,7 @@ OAT.AJAX = {
 		while (OAT.AJAX.requests.length) { OAT.AJAX.requests[0].abort(); }
 	},
 
-	GET:function(url,data,callback,optObj) {
+    GET:function(url,dta,callback,optObj) {
 		var options = OAT.AJAX.options(optObj);
 		var xhr = OAT.AJAX.init(url,callback,options);
 		var url_ = url;
@@ -67,67 +67,67 @@ OAT.AJAX = {
 		if (url.match(/\?/)) {
 			url_ += "&";
 		} else {
-			if (data || !options.noSecurityCookie) { url_ += "?"; }
+	    if (dta || !options.noSecurityCookie) { url_ += "?"; }
 		}
 
-		if(data) { url_ += data; }
+	if(dta) { url_ += dta; }
 
 		if (!options.noSecurityCookie) {
 			url_ += "&";
 			var secure = OAT.AJAX.createCookie(); /* array of name & value */
 			url_ += secure[0]+"="+secure[1];
 		}
-		xhr.open("GET",url_,options.async);
+	xhr.open("GET",url_,options.async,options.user,options.password);
 		OAT.AJAX.send(xhr,null);
 		return xhr;
 	},
 
-	POST:function(url,data,callback,optObj) {
+    POST:function(url,dta,callback,optObj) {
 		var options = OAT.AJAX.options(optObj);
 		var xhr = OAT.AJAX.init(url,callback,options);
-		xhr.open("POST",url,options.async);
+	xhr.open("POST",url,options.async,options.user,options.password);
 		xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
-		OAT.AJAX.send(xhr,data);
+	OAT.AJAX.send(xhr,dta);
 		return xhr;
 	},
 
-	PUT:function(url,data,callback,optObj) {
+    PUT:function(url,dta,callback,optObj) {
 		var options = OAT.AJAX.options(optObj);
 		var xhr = OAT.AJAX.init(url,callback,options);
-		xhr.open("PUT",url,options.async);
-		OAT.AJAX.send(xhr,data);
+	xhr.open("PUT",url,options.async,options.user,options.password);
+	OAT.AJAX.send(xhr,dta);
 		return xhr;
 	},
 
-	SOAP:function(url,data,callback,optObj) {
+    SOAP:function(url,dta,callback,optObj) {
 		var options = OAT.AJAX.options(optObj);
 		var xhr = OAT.AJAX.init(url,callback,options);
-		xhr.open("POST",url,options.async);
-		OAT.AJAX.send(xhr,data);
+	xhr.open("POST",url,options.async,options.user,options.password);
+	OAT.AJAX.send(xhr,dta);
 		return xhr;
 	},
 
-	MKCOL:function(url,data,callback,optObj) {
+    MKCOL:function(url,dta,callback,optObj) {
 		var options = OAT.AJAX.options(optObj);
 		var xhr = OAT.AJAX.init(url,callback,options);
-		xhr.open("MKCOL",url,options.async);
-		OAT.AJAX.send(xhr,data);
+	xhr.open("MKCOL",url,options.async,options.user,options.password);
+	OAT.AJAX.send(xhr,dta);
 		return xhr;
 	},
 
-	PROPFIND:function(url,data,callback,optObj) {
+    PROPFIND:function(url,dta,callback,optObj) {
 		var options = OAT.AJAX.options(optObj);
 		var xhr = OAT.AJAX.init(url,callback,options);
-		xhr.open("PROPFIND",url,options.async);
-		OAT.AJAX.send(xhr,data);
+	xhr.open("PROPFIND",url,options.async,options.user,options.password);
+	OAT.AJAX.send(xhr,dta);
 		return xhr;
 	},
 
-	PROPPATCH:function(url,data,callback,optObj) {
+    PROPPATCH:function(url,dta,callback,optObj) {
 		var options = OAT.AJAX.options(optObj);
 		var xhr = OAT.AJAX.init(url,callback,options);
-		xhr.open("PROPPATCH",url,options.async);
-		OAT.AJAX.send(xhr,data);
+	xhr.open("PROPPATCH",url,options.async,options.user,options.password);
+	OAT.AJAX.send(xhr,dta);
 		return xhr;
 	},
 
@@ -135,8 +135,8 @@ OAT.AJAX = {
 		var options = {
 			headers:{},
 			auth:OAT.AJAX.AUTH_NONE,
-			user:"",
-			password:"",
+	    user:null,
+	    password:null,
 			timeout:false,
 			type:OAT.AJAX.TYPE_TEXT,
 			noSecurityCookie:false,
@@ -167,9 +167,9 @@ OAT.AJAX = {
 		return xhr;
 	},
 
-	send:function(xhr,data) {
+    send:function(xhr,body) {
 		function go() {
-			xhr.send(data);
+	    xhr.send(body);
 			try {
 				if (OAT.Browser.isGecko && !xhr.options.async) {
 					OAT.AJAX.response(xhr);
@@ -186,7 +186,8 @@ OAT.AJAX = {
 				go();
 			}
 			OAT.Loader.load("crypto", cb);
-		} /* if auth needed */ else go();
+	} /* if (BASIC) auth needed */ 
+	else go();
 	},
 
 	response:function(xhr) {
@@ -315,9 +316,10 @@ OAT.AJAX = {
 		this.options = options;
 		this.timeout = false;
 		this.aborted = false;
-		this.open = function(method, target, async) {
+	
+	this.open = function(method, target, async, user, password) {
 			try {
-				self.obj.open(method, target, async);
+		self.obj.open(method, target, async, user, password);
 			} catch(e) {
 				self.aborted = true;
 				if (self.options.onend) { self.options.onend(self); }
@@ -326,7 +328,7 @@ OAT.AJAX = {
 				OAT.AJAX.checkEnd();
 			}
 		}
-		this.send = function(data) { if (!self.aborted) { self.obj.send(data); } }
+	this.send = function(body) { if (!self.aborted) { self.obj.send(body); } }
 		this.setResponse = function(callback) { self.obj.onreadystatechange = callback; }
 		this.getResponseText = function() { return self.obj.responseText; }
 		this.getResponseXML = function() { return self.obj.responseXML;	}
diff --git a/binsrc/oat/toolkit/anchor.js b/binsrc/oat/toolkit/anchor.js
index 4fc7759..355e6b6 100644
--- a/binsrc/oat/toolkit/anchor.js
+++ b/binsrc/oat/toolkit/anchor.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: anchor.js,v 1.34.2.4 2010/07/01 11:53:12 source Exp $
+ *  $Id: anchor.js,v 1.34.2.5 2011/03/08 13:08:17 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -122,7 +122,8 @@ OAT.Anchor = {
 				if (OAT.AJAX && OAT.AJAX.requests.length) {
 					OAT.Anchor.fixSize(win);
 				} else {
-					if (win.dom.container.style.height=='auto' || win.dom.container.style.width=='auto') { /* if auto, keep auto */
+		if (win.dom.container.style.height=='auto' || 
+		    win.dom.container.style.width=='auto') { /* if auto, keep auto */
 					    return;
                                         }
 					var height = OAT.Dom.getWH(win.dom.content)[1];
@@ -130,7 +131,8 @@ OAT.Anchor = {
 						if (OAT.Dom.getWH(win.dom.container)[0] < 650)
 							win.dom.container.style.width = (OAT.Dom.getWH(win.dom.container)[0]+100)+'px';
 						if (height == OAT.Dom.getWH(win.dom.content)[1]) {
-						if (OAT.Dom.getWH(win.dom.container)[0] > 100) win.dom.container.style.width = (OAT.Dom.getWH(win.dom.container)[0]-100)+'px';
+			if (OAT.Dom.getWH(win.dom.container)[0] > 100) 
+			    win.dom.container.style.width = (OAT.Dom.getWH(win.dom.container)[0]-100)+'px';
 							/* now adding scrollbar when too large window */
 							if (OAT.Dom.getWH(win.dom.content)[1] > 300) {
 								win.dom.content.style.height = '300px';
@@ -165,7 +167,8 @@ OAT.Anchor = {
 			type:OAT.Win.Rect,
 			buttons:"cr",
 			template:false, /* use with type:false - see win component documentation */
-			preload:false /* include the a++ node in the page DOM right at the assing time - do not use when large number of a++ windows on the page */
+	    preload:false /* include the a++ node in the page DOM right at the assing time - 
+                             do not use when large number of a++ windows on the page */
 		};
 		for (var p in paramsObj) { options[p] = paramsObj[p]; }
 
diff --git a/binsrc/oat/toolkit/dialog.js b/binsrc/oat/toolkit/dialog.js
index a0ffadf..6bc1c0c 100644
--- a/binsrc/oat/toolkit/dialog.js
+++ b/binsrc/oat/toolkit/dialog.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: dialog.js,v 1.13.2.3 2010/04/06 16:46:12 source Exp $
+ *  $Id: dialog.js,v 1.13.2.6 2011/02/16 20:54:22 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -23,11 +23,14 @@ OAT.Dialog = function(title,contentDiv,optObj) {
 	height:0,
 	modal:0,
 	zIndex:1000,
-	buttons:1,
+	buttons:3, // bitmap 0x1=OK 0x2=cancel
 	resize:1,
 	close:1,
 	autoEnter:1,
-	type:false
+	type:false,
+	def_layout:true,
+        cancel_b_txt: "Cancel",
+        ok_b_txt: "OK"
     }
 
     if (optObj) for (var p in optObj) { options[p] = optObj[p]; }
@@ -44,27 +47,29 @@ OAT.Dialog = function(title,contentDiv,optObj) {
 	title:title, type:options.type,
 	stackGroupBase:false});
 
-    $(contentDiv).style.margin = "10px";
+    if (options.buttons) {
+	var btn_bar = OAT.Dom.create("div",
+				     options.def_layout ? 
+				     {marginTop:"1em", textAlign:"center", className: "dialog_btnbar"} : 
+				     {className: "dialog_btnbar"});
 
-    var nav = OAT.Dom.create("table",{marginTop:"1em",width:"90%",textAlign:"center"});
-    var tbody = OAT.Dom.create("tbody");
-    var row = OAT.Dom.create("tr");
-    var td = OAT.Dom.create("td",{border:"none"});
-    var ok = OAT.Dom.create("input");
+	if (options.buttons & 1) {
+	    var ok = OAT.Dom.create("input", {className: "dlg_b_ok"});
     ok.type = "button";
-    ok.value = " OK ";
-    td.appendChild(ok);
+	    ok.value = options.ok_b_txt;
+	    btn_bar.appendChild (ok);
+	}
 
-    var cancel = OAT.Dom.create("input",{marginLeft:"2em"});
+	if (options.buttons & 2) {
+	    var cancel = OAT.Dom.create("input", 
+					options.def_layout?{marginLeft:"2em", className: "dlg_b_cancel"}:{className: "dlg_b_cancel"});
     cancel.type = "button";
-    cancel.value = "Cancel";
-    td.appendChild(cancel);
-    row.appendChild(td);
-
-    tbody.appendChild(row);
-    nav.appendChild(tbody);
+	    cancel.value = options.cancel_b_txt;
+	    btn_bar.appendChild (cancel);
+	}
 
-    if (options.buttons) { $(contentDiv).appendChild(nav); }
+	$(contentDiv).appendChild(btn_bar); 
+    }
 
     win.dom.content.appendChild($(contentDiv));
     win.dom.container.style.zIndex = options.zIndex;
@@ -92,7 +97,7 @@ OAT.Dialog = function(title,contentDiv,optObj) {
     }
 
     var keyPress = function(event) {
-	if (self.okBtn.disabled) { return; }
+	if ((!!self.okBtn) && self.okBtn.disabled) { return; }
 	if (event.keyCode == 13) { onOk(); }
 	if (event.keyCode == 27) { onCancel(); }
     }
diff --git a/binsrc/oat/toolkit/loader.js b/binsrc/oat/toolkit/loader.js
index dec671b..daee277 100644
--- a/binsrc/oat/toolkit/loader.js
+++ b/binsrc/oat/toolkit/loader.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: loader.js,v 1.87.2.11 2010/06/28 09:35:57 source Exp $
+ *  $Id: loader.js,v 1.87.2.18 2011/03/29 11:02:10 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -87,7 +87,7 @@ OAT.Preferences = {
     stylePath: "/DAV/JS/styles/",
     endpointXmla: "/XMLA",
     version: "2.9",
-    build: "$Date: 2010/06/28 09:35:57 $",
+    build: "$Date: 2011/03/29 11:02:10 $",
     httpError: 1, /* show http errors */
     allowDefaultResize: 1,
     allowDefaultDrag: 1
@@ -1268,7 +1268,16 @@ OAT.Browser = {
     hasXmlParser: ((!!document.implementation && 
 		    !!document.implementation.createDocument) ||
 		   (!!document.getImplementation &&
-		    !!document.getImplementation().createDocument))
+		    !!document.getImplementation().createDocument)),
+
+    hasHtml5Storage: function () {
+	try {
+	    return 'localStorage' in window && window['localStorage'] !== null;
+	}
+	catch (e) {
+	    return false;
+	}
+    }
 }
 
 /**
@@ -1279,7 +1288,7 @@ OAT.Event = {
     /**
      * attaches event to a given element, optionally with a callback
      * and/or scope from which the callback will be executed
-     * @param {node} elm atach the event to this element
+     * @param {node} elm attach the event to this element
      * @param {event} event event to be attached
      * @param {function} callback callback to execute when event fires up
      * @param {object} scope scope object
@@ -1612,7 +1621,7 @@ OAT.Loader = {
     },
 
     _depends: {
-	ajax:"xml",
+	ajax:["crypto","xml"],
 	anchor:"win",
 	calendar:["drag","notify"],
 	color:"drag",
diff --git a/binsrc/oat/toolkit/macwin.js b/binsrc/oat/toolkit/macwin.js
index c6fda6e..ef3bec2 100644
--- a/binsrc/oat/toolkit/macwin.js
+++ b/binsrc/oat/toolkit/macwin.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: macwin.js,v 1.9.2.4 2010/04/06 16:46:12 source Exp $
+ *  $Id: macwin.js,v 1.9.2.5 2010/09/07 21:56:37 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -23,7 +23,7 @@ OAT.MacWin = function(optObj) {
 	this.options.statusHeight = 16;
 	this.options.moveHeight = 23;
 
-	OAT.Dom.applyStyle(this.div,{font:"menu",backgroundColor:"#c5c5c5"});
+	OAT.Style.set(this.div,{font:"menu",backgroundColor:"#c5c5c5"});
 
 	var opt = {
 		corners:[1,1,0,0], /* CW from LT */
@@ -32,7 +32,7 @@ OAT.MacWin = function(optObj) {
 		edgeFiles:[self.options.imagePath+"MacWin_top.gif",self.options.imagePath+"MacWin_left.gif","",self.options.imagePath+"MacWin_right.gif"],
 		thickness:[23,8,0,8] /* CW from T */
 	}
-	OAT.Dom.applyStyle(this.content,{position:"relative"});
+	OAT.Style.set(this.content,{position:"relative"});
 
 	OAT.SimpleFX.roundImg(this.div,opt);
 	OAT.SimpleFX.shadow(this.div,{offsetX:8,imagePath:self.options.imagePath});
@@ -98,7 +98,7 @@ OAT.MacWin = function(optObj) {
 	} else { this.maxBtn = false; }
 
 	if (self.options.resize) {
-		OAT.Dom.applyStyle(this.resize,{width:"10px",height:"10px",fontSize:"1px",position:"absolute",right:"-8px",bottom:"0px",cursor:"nw-resize",backgroundImage:"url("+self.options.imagePath+"MsWin_resize.gif)"});
+		OAT.Style.set(this.resize,{width:"10px",height:"10px",fontSize:"1px",position:"absolute",right:"-8px",bottom:"0px",cursor:"nw-resize",backgroundImage:"url("+self.options.imagePath+"MsWin_resize.gif)"});
 	}
 
 }
diff --git a/binsrc/oat/toolkit/mswin.js b/binsrc/oat/toolkit/mswin.js
index 542c01e..1611aca 100644
--- a/binsrc/oat/toolkit/mswin.js
+++ b/binsrc/oat/toolkit/mswin.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: mswin.js,v 1.9.2.3 2010/04/06 16:46:12 source Exp $
+ *  $Id: mswin.js,v 1.9.2.4 2010/09/07 21:56:37 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -20,9 +20,9 @@ OAT.MsWin = function(optObj) {
 	this.options.statusHeight = 16;
 	this.options.moveHeight = 16;
 
-	OAT.Dom.applyStyle(this.div,{border:"1px solid #000",font:"menu",backgroundColor:"#fff"});
-	OAT.Dom.applyStyle(this.content,{backgroundColor:"#fff",position:"relative"});
-	OAT.Dom.applyStyle(this.move,{position:"absolute",height:self.options.moveHeight+"px",backgroundColor:"#0000a0",fontWeight:"bold",color:"#fff",border:"1px solid #000"})
+	OAT.Style.set(this.div,{border:"1px solid #000",font:"menu",backgroundColor:"#fff"});
+	OAT.Style.set(this.content,{backgroundColor:"#fff",position:"relative"});
+	OAT.Style.set(this.move,{position:"absolute",height:self.options.moveHeight+"px",backgroundColor:"#0000a0",fontWeight:"bold",color:"#fff",border:"1px solid #000"})
 	this.move.style.top = (-this.options.moveHeight-2) + "px";
 	this.move.style.left = "-1px";
 
@@ -31,18 +31,18 @@ OAT.MsWin = function(optObj) {
 	}
 
 	if (this.closeBtn) {
-		OAT.Dom.applyStyle(this.closeBtn,{cssFloat:"right",styleFloat:"right",fontSize:"1px",marginTop:"1px",cursor:"pointer",width:"16px",height:"14px",backgroundImage:"url("+self.options.imagePath+"MsWin_close.png)"});
+		OAT.Style.set(this.closeBtn,{cssFloat:"right",styleFloat:"right",fontSize:"1px",marginTop:"1px",cursor:"pointer",width:"16px",height:"14px",backgroundImage:"url("+self.options.imagePath+"MsWin_close.png)"});
 	}
 
 	if (this.maxBtn) {
-		OAT.Dom.applyStyle(this.maxBtn,{cssFloat:"right",styleFloat:"right",fontSize:"1px",marginTop:"1px",cursor:"pointer",width:"16px",height:"14px",backgroundImage:"url("+self.options.imagePath+"MsWin_maximize.png)"});
+		OAT.Style.set(this.maxBtn,{cssFloat:"right",styleFloat:"right",fontSize:"1px",marginTop:"1px",cursor:"pointer",width:"16px",height:"14px",backgroundImage:"url("+self.options.imagePath+"MsWin_maximize.png)"});
 	}
 
 	if (this.minBtn) {
-		OAT.Dom.applyStyle(this.minBtn,{cssFloat:"right",styleFloat:"right",fontSize:"1px",marginTop:"1px",cursor:"pointer",width:"16px",height:"14px",backgroundImage:"url("+self.options.imagePath+"MsWin_minimize.png)"});
+		OAT.Style.set(this.minBtn,{cssFloat:"right",styleFloat:"right",fontSize:"1px",marginTop:"1px",cursor:"pointer",width:"16px",height:"14px",backgroundImage:"url("+self.options.imagePath+"MsWin_minimize.png)"});
 	}
 
 	if (this.resize) {
-		OAT.Dom.applyStyle(this.resize,{width:"10px",height:"10px",fontSize:"1px",position:"absolute",right:"0px",bottom:"0px",cursor:"nw-resize",backgroundImage:"url("+self.options.imagePath+"MsWin_resize.gif)"});
+		OAT.Style.set(this.resize,{width:"10px",height:"10px",fontSize:"1px",position:"absolute",right:"0px",bottom:"0px",cursor:"nw-resize",backgroundImage:"url("+self.options.imagePath+"MsWin_resize.gif)"});
 	}
 }
diff --git a/binsrc/oat/toolkit/rdf.js b/binsrc/oat/toolkit/rdf.js
index 90b0afd..802fc54 100644
--- a/binsrc/oat/toolkit/rdf.js
+++ b/binsrc/oat/toolkit/rdf.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: rdf.js,v 1.13.2.4 2010/06/28 09:35:57 source Exp $
+ *  $Id: rdf.js,v 1.13.2.8 2011/03/29 11:02:10 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -25,7 +25,7 @@ OAT.RDFAtom = function (tag, value, ns) {
     self._tag = tag;
     self._val = value;
     self._dt = '';
-    self._lang = '';
+    self._lang = false;
 
     this.isIRI = function () {
 	if (self._tag == OAT.RDFTag.IRI) return true;
@@ -50,6 +50,10 @@ OAT.RDFAtom = function (tag, value, ns) {
 	return self._val;
     }
 
+    this.getLang = function () {
+	return self._lang;
+    }
+
     this.equals = function (_obj) {
 	if (_obj.constructor != OAT.RDFAtom) return false;
 	if (_obj._tag != self._tag) return false;
@@ -94,9 +98,15 @@ OAT.RDFAtom = function (tag, value, ns) {
     }
 	
     this.toString = function () {
-	var _out = "#ATOM:\{" + self.tagString(self._tag) + " " + self._val + " "; 
-	if (self.getTag() == OAT.RDFTag.IRI) 
-	    _out = _out + "<" + OAT.IRIDB.getIRI (self._val) + ">";
+	var _out = "#ATOM:\{" + self.tagString(self._tag);
+	if (self.getTag() == OAT.RDFTag.IRI) {
+            _out += "IID:" + self._val + " " + "<" + OAT.IRIDB.getIRI (self._val) + ">";
+	}
+	if (self.getTag() == OAT.RDFTag.LIT) {
+	    _out += "\"" + self._val + "\"";
+	    var lang_tag = self.getLang();
+	    if (lang_tag) _out += "@" + lang_tag;
+	}
 	return _out + "\}";
     }
 
@@ -152,6 +162,7 @@ OAT.IRIDB = {
 	    this._iri_a[iid] = [iri, (ns?ns:false)];
 	} else
 	    if (ns) {
+		if (typeof ns == "object") throw "InsertIRI error: Ciri cannot be an object.";
 		this._iri_a[iid][1] = ns;
 	    }
 	return iid;
@@ -160,7 +171,7 @@ OAT.IRIDB = {
     insertIRIArr: function (iri_arr) {
 	var r_a = []; 
 	for (var i=0;i<iri_arr.length;i++) {
-	    if (typeof iri_arr[i] == 'Object') {
+	    if (typeof iri_arr[i] == 'object') {
 		r_a.push (this.insertIRI (iri_arr[i][0], iri_arr[i][1]));
 	    } 
 	    else {
@@ -200,11 +211,6 @@ OAT.IRIDB = {
 	return (iri_id ? iri_id : false);
     },
 
-    getCIRIByID: function (iid) {
-	var i_a = this._iri_a[iid];
-	return ((i_a && i_a[1]) ? i_a[1] : false);
-    },
-
 //
 // Resolve an IRI to a CIRI representation
 //
@@ -216,6 +222,7 @@ OAT.IRIDB = {
     },
 
     splitIRI:function (iri) {
+	if (typeof iri != "string") throw "splitIRI: invalid iri - must be string";
 	var r = iri.match(/([^\/#]+)[\/#]?$/);
 	if (r && r[1] == "this") {
 	    r = iri.match(/([^\/#]+)#[^#]*$/);
@@ -237,6 +244,7 @@ OAT.IRIDB = {
 	if (pfx_iid)
 	    {
 		ciri = this._iri_a[pfx_iid][1] + ":" + i_a[0];
+		if (typeof ciri == "object") throw "resolveCIRI: invalid ciri - cannot have an object here";
 		this._iri_a[iid][1] = ciri; 
 
 		return ciri;
@@ -489,14 +497,14 @@ OAT.RDF = {
 
 		    var obj = a.nodeValue;
 
-		    var objNs = OAT.Xml.getNsURL (a);
+		    var objNs = OAT.Xml.getNsURI (a);
 		    var objNsPrefix = OAT.Xml.getNsPrefix(obj);
 
 		    OAT.IRIDB.insertIRI(objNs, objNsPrefix);
 
 		    triples.push([OAT.IRIDB.insertIRI(subj),
 				  OAT.IRIDB.insertIRI(pred),
-				  new OAT.RDFAtom (OAT.RDFTag.IRI, OAT.IRIDB.insertIRI(obj), ns)]);
+				  new OAT.RDFAtom (OAT.RDFTag.IRI, OAT.IRIDB.insertIRI(obj), objNs)]);
 		}
 	    } /* for all attributes */
 	    
@@ -576,7 +584,21 @@ OAT.RDF = {
 	
 	for (var i=0;i<root.childNodes.length;i++) {
 	    var node = root.childNodes[i];
-	    if (node.nodeType == 1) { processNode(node); }
+	    if (node.nodeType == 1) { 
+		if (OAT.Xml.localName(node) == "parsererror") { // Handle WebKit Parse error
+		    var error_m = node.innerText ? node.innerText : "Unknown Error";
+
+		    // XXX: This is probably not a good idea - should just throw an exception?
+
+		    if (!url.match(/#[a-zA-Z0-9]*$/)) url += '#parseErrorInQueryResult';
+		    
+		    triples.push ([OAT.IRIDB.insertIRI(url),
+				   OAT.IRIDB.insertIRI("http://www.openlinksw.com/schema/oat/hasRdfParserError"),
+				   new OAT.RDFAtom (OAT.RDFTag.LIT, error_m)]);
+		} else {
+		    processNode(node); 
+		}
+	    }
 	}
 	return triples;
 	}
diff --git a/binsrc/oat/toolkit/rdfmini.js b/binsrc/oat/toolkit/rdfmini.js
index 6cfb9b9..04bea91 100644
--- a/binsrc/oat/toolkit/rdfmini.js
+++ b/binsrc/oat/toolkit/rdfmini.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: rdfmini.js,v 1.7.2.6 2010/06/28 09:35:57 source Exp $
+ *  $Id: rdfmini.js,v 1.7.2.9 2011/02/16 20:54:22 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -31,7 +31,8 @@ OAT.RDFMini = function(div,optObj) {
 		querySearchURI:false,
 		showSearch:true,
 		imagePath:OAT.Preferences.imagePath,
-		endpoint:"/sparql?query="
+	endpoint:"/sparql?query=",
+	store: false
 	}
 	for (var p in optObj) { this.options[p] = optObj[p]; }
 
@@ -102,12 +103,32 @@ OAT.RDFMini = function(div,optObj) {
 			}
 			OAT.Event.attach(s,"change",self.redraw);
 			self.select = s;
-			OAT.Dom.append([self.parent,OAT.Dom.text("Visualization: "),s]);
+
+	    var sel_ctr = OAT.Dom.create("div",{className:"rdfmini_view_sel_ctr"});
+	    var sel_lbl = OAT.Dom.create("label");
+
+	    OAT.Dom.append([self.parent,sel_ctr],[sel_ctr,sel_lbl,s]);
+	    sel_lbl.innerHTML = "View:";
 		} else {
 			var t = self.options.tabs[0];
 			var obj = new OAT.RDFTabs[t[0]](self,t[2]);
 			self.tabs.push(obj);
 		}
+
+	var ua = navigator.userAgent;
+
+	if (ua.indexOf('iPhone') != -1 || ua.indexOf('Android') != -1 ) {
+	    vp = OAT.Dom.getViewport();
+
+	    self.content.style.width = vp[1]+'px';
+	    self.content.style.height = vp[0]+'px';
+	    console.info ('viewport: '+vp[1]+'x'+vp[0]);
+	    self.content.scrollIntoView(true);
+	}
+//	else {
+//	    self.content.style.height = '600px';
+//	}
+
 		self.parent.appendChild(self.content);
 	}
 
@@ -138,7 +159,14 @@ OAT.RDFMini = function(div,optObj) {
 	var ajaxStart = function() { OAT.Dom.show(self.throbber); }
 	var ajaxEnd = function() { OAT.Dom.hide(self.throbber); }
 
-	this.store = new OAT.RDFStore(self.reset,{onstart:ajaxStart,onend:ajaxEnd});
+    if (this.options.store) {
+	this.store = this.options.store;
+	this.store.options.onstart = ajaxStart;
+	this.store.options.onend = ajaxEnd;
+	this.store.reset = this.reset;
+    }
+    else this.store = new OAT.RDFStore(this.reset,{onstart:ajaxStart,onend:ajaxEnd});
+
 	this.data = self.store.data;
 
 	this.getContent = function(data_,disabledActions) {
diff --git a/binsrc/oat/toolkit/rdfstore.js b/binsrc/oat/toolkit/rdfstore.js
index 1565fe2..699b70e 100644
--- a/binsrc/oat/toolkit/rdfstore.js
+++ b/binsrc/oat/toolkit/rdfstore.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: rdfstore.js,v 1.32.2.4 2010/06/28 09:35:57 source Exp $
+ *  $Id: rdfstore.js,v 1.32.2.7 2011/03/23 11:55:02 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -58,15 +58,22 @@ OAT.RDFStoreData = {
 OAT.RDFStore = function(tripleChangeCallback, optObj) {
     var self = this;
 
+    this.preferredClasses = {
+	'http://xmlns.com/foaf/0.1/Person': 0,
+	'http://': 1
+    };
+    
     // properties used as labels - in order of preference
 
-    this.labelProps = {"http://xmlns.com/foaf/0.1/name": 0,
-		       "http://xmlns.com/foaf/0.1/nick": 1,
-		       "http://www.w3.org/2000/01/rdf-schema#label": 2,
-		       "http://purl.org/dc/elements/1.1/title": 3,
-		       "http://dbpedia.org/property/name":4,
-		       "http://www.w3.org/2004/02/skos/core#prefLabel": 5,
-		       "http://www.w3.org/2002/12/cal/ical#summary": 6};
+    this.labelProps = {
+	"http://www.w3.org/2000/01/rdf-schema#label": 0,
+	"http://www.w3.org/2004/02/skos/core#prefLabel": 1,
+	"http://xmlns.com/foaf/0.1/name": 2,
+	"http://xmlns.com/foaf/0.1/nick": 3,
+	"http://purl.org/dc/elements/1.1/title": 4,
+	"http://dbpedia.org/property/name":5,
+	"http://www.w3.org/2002/12/cal/ical#summary": 6
+    };
 
     self.labelPropLookup = []; // label predicates by iid
 
@@ -115,14 +122,14 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
     this.filtersURI = [];
     this.filtersProperty = [];
 
-    this.items = [];
+    this.graphs = [];
 
     this.getTripleCount = function () {
 	return self.data.triples.length;
     }
 
-    this.getItemCount = function () {
-	return self.items.length;
+    this.getGraphCount = function () {
+	return self.graphs.length;
     }
 
     this.getLabelCount = function () {
@@ -170,12 +177,9 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
 	    if (item.type.indexOf(t[2]) == -1) item.type.push(t[2]);
     }
 
-    //
-    // FIXME
-//
 
     this.nsPrefixPredHandler = function (item, t, opt) {
-	OAT.IRIDB.addNs (t[1], t[2]);
+	OAT.IRIDB.addNs (t[0], t[2].getValue());
     }
 
     this.dequeueURL = function (url, success)
@@ -218,7 +222,7 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
     //
 
     for (i in self.labelProps)
-	self.addPredHandler (i, self.labelPredHandler, self.labelProps[i])
+	self.addPredHandler (i, self.labelPredHandler, self.labelProps[i]);
 
     //
     // Add predicate handler for type
@@ -313,11 +317,11 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
     }
 
     this.addXmlDoc = function(xmlDoc,href) {
-	OAT.MSG.send(self,"OAT_RDF_STORE_LOADING",{url:xmlDoc.baseURI});
-	var triples = OAT.RDF.parse (xmlDoc);
+	OAT.MSG.send(self,"OAT_RDF_STORE_LOADING",{url:href});
+	var triples = OAT.RDF.parse (xmlDoc, href);
 	var ncount = 0;
 
-	if (!!window.console) window.console.log("addXmlDoc: Got " + triples.length + " triples.");
+	if (!!window.console && !!window.__isparql_debug) window.console.log("addXmlDoc: Got " + triples.length + " triples.");
 
 	/* sanitize triples */
 /*	for (var i=0;i<triples.length;i++) {
@@ -345,7 +349,7 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
 	if (!!window.console) window.console.log("numbers in o: " + ncount);
 */
 	self.addTriples(triples,href);
-	OAT.MSG.send(self,"OAT_RDF_STORE_LOADED",{url:xmlDoc.baseURI});
+	OAT.MSG.send(self,"OAT_RDF_STORE_LOADED",{url:href});
     }
 
     this.addTripleList = function(triples,href,title) {
@@ -361,20 +365,21 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
 	    enabled:true,
 	    title:title
 	}
-	self.items.push(o);
+	
+	self.graphs.push(o);
 	self.rebuild(false);
     }
 
     this.findIndex = function(url) {
-	for (var i=0;i<self.items.length;i++) {
-	    var item = self.items[i];
+	for (var i=0;i<self.graphs.length;i++) {
+	    var item = self.graphs[i];
 	    if (item.href == url) { return i; }
 	}
 	return -1;
     }
 
     this.clear = function() {
-	self.items = [];
+	self.graphs = [];
 	self.rebuild(true);
 	OAT.MSG.send(self, "OAT_RDF_STORE_CLEARED",{});
     }
@@ -382,7 +387,7 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
     this.remove = function(uri) {
 	var index = self.findIndex(uri);
 	if (index == -1) { return; }
-	self.items.splice(index,1);
+	self.graphs.splice(index,1);
 	self.rebuild(true);
 	OAT.MSG.send(self,"OAT_RDF_STORE_URI_REMOVED",{uri:uri});
     }
@@ -390,35 +395,35 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
     this.enable = function(uri) {
 	var index = self.findIndex(uri);
 	if (index == -1) { return; }
-	self.items[index].enabled = true;
+	self.graphs[index].enabled = true;
 	self.rebuild(true);
 	OAT.MSG.send(self,"OAT_RDF_STORE_ENABLED",{uri:uri});
     }
 
     this.enableAll = function() {
-	for (var i=0;i<self.items.length;i++)
-	    self.enable(self.items[i].href);
+	for (var i=0;i<self.graphs.length;i++)
+	    self.enable(self.graphs[i].href);
     }
 
     this.disable = function(url) {
 	var index = self.findIndex(url);
 	if (index == -1) { return; }
-	self.items[index].enabled = false;
+	self.graphs[index].enabled = false;
 	self.rebuild(true);
 	OAT.MSG.send(self,"OAT_RDF_STORE_DISABLED",{uri:uri});
     }
 
     this.disableAll = function() {
-	for (var i=0;i<self.items.length;i++)
-	    self.disable(self.items[i].href);
+	for (var i=0;i<self.graphs.length;i++)
+	    self.disable(self.graphs[i].href);
     }
 
     this.invertSel = function() {
-	for (var i=0;i<self.items.length;i++)
-	    if (self.items[i].enabled) {
-		self.disable(self.items[i].href);
+	for (var i=0;i<self.graphs.length;i++)
+	    if (self.graphs[i].enabled) {
+		self.disable(self.graphs[i].href);
 	    } else {
-		self.enable(self.items[i].href);
+		self.enable(self.graphs[i].href);
 	    }
     }
 
@@ -448,7 +453,7 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
 	    var p = triple[1];
 	    var o = triple[2];
 
-	    if (!!window.console) window.console.log ("<"+OAT.IRIDB.getIRI(s)+">"+"<"+OAT.IRIDB.getIRI(p)+">"+o.toString());
+	    //	    if (!!window.console) window.console.log ("<"+OAT.IRIDB.getIRI(s)+">"+"<"+OAT.IRIDB.getIRI(p)+">"+o.toString());
 
 	    var cnt = self.data.all.length;
 
@@ -504,8 +509,8 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
 
 	if (complete) { /* complete = all */
 	    self.data.all = [];
-	    for (var i=0;i<self.items.length;i++) { // Item is sort-of synonymous to graph
-		var item = self.items[i];
+	    for (var i=0;i<self.graphs.length;i++) { // Item is sort-of synonymous to graph
+		var item = self.graphs[i];
 		if (item.enabled) { todo.push([item.triples,item.href,item.title]); }
 	    }
 	} else { /* not complete - only last item */
@@ -513,7 +518,7 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
 		var item = self.data.all[i];
 		conversionTable[item.uri] = item;
 	    }
-	    var item = self.items[self.items.length-1];
+	    var item = self.graphs[self.graphs.length-1];
 	    todo.push([item.triples,item.href,item.title]);
 	}
 	for (var i=0;i<todo.length;i++) {
@@ -537,7 +542,7 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
 		    }
 		}
 	    } /* predicates */
-	} /* items */
+	} /* graphs */
 
 	/* 3. apply filters: create self.data.structured + 4. convert filtered data back to triples */
 
@@ -619,6 +624,8 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
 
 	self.data.triples = [];
 	
+// XXX
+	
 	for (var i=0;i<self.data.structured.length;i++) {
 	    var item = self.data.structured[i];
 	    for (var p in item.preds) {
@@ -740,10 +747,5 @@ OAT.RDFStore = function(tripleChangeCallback, optObj) {
 
     this.simplify = function(str) {
 	return (self.getCIRIorSplit (OAT.IRIDB.insertIRI(str)));
-//	var r = str.match(/([^\/#]+)[\/#]?$/);
-//	if (r && r[1] == "this") {
-//	    r = str.match(/([^\/#]+)#[^#]*$/);
-//	}
-//	return (r ? r[1] : str);
     }
 }
diff --git a/binsrc/oat/toolkit/rdftabs.js b/binsrc/oat/toolkit/rdftabs.js
index 16f6cb3..a7d5650 100644
--- a/binsrc/oat/toolkit/rdftabs.js
+++ b/binsrc/oat/toolkit/rdftabs.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: rdftabs.js,v 1.63.2.10 2010/06/28 09:35:57 source Exp $
+ *  $Id: rdftabs.js,v 1.63.2.20 2011/03/29 11:02:10 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -129,8 +129,8 @@ OAT.RDFTabs.browser = function(parent,optObj) {
 	var s = OAT.Dom.create("a");
 	var uri = OAT.IRIDB.getIRI(item.uri);
 
-	s.href = OAT.IRIDB.getIRI(uri);
-	s.title = s.href;
+	s.href = uri;
+	s.title = uri;
 	s.innerHTML = self.parent.getTitle(item);
 
 	OAT.Dom.append([s_ctr,h],[h,s]);
@@ -394,9 +394,10 @@ OAT.RDFTabs.navigator = function(parent,optObj) {
     this.waiting = false;
     this.mlCache = [];
     this.topDiv = OAT.Dom.create("div",{className:"rdf_nav"});
-    this.mainDiv = OAT.Dom.create("div");
+    this.mainDiv = OAT.Dom.create("div",{className:"rdf_nav_content"});
     this.description = self.options.description;
     this.desc = self.options.desc;
+
     OAT.Dom.append([self.elm,self.topDiv,self.mainDiv]);
 
     this.gd = new OAT.GhostDrag();
@@ -624,10 +625,10 @@ OAT.RDFTabs.navigator = function(parent,optObj) {
 	    }
 	}
 	else if (typeof(value) == "object") { /* resource */
-	    var items = self.parent.store.items;
+	    var graphs = self.parent.store.graphs;
 	    var dereferenced = false;
-	    for (var j=0;j<items.length;j++) {
-		var item = items[j];
+	    for (var j=0;j<graphs.length;j++) {
+		var item = graphs[j];
 		/* handle anchors to local file */
 		var baseuri = OAT.IRIDB.getIRI(value.iid).match(/^[^#]+/);
 		baseuri = baseuri ? baseuri[0] : "";
@@ -661,8 +662,12 @@ OAT.RDFTabs.navigator = function(parent,optObj) {
 	    obj.push ([p, item.preds[p]]);
 	}
 
-	obj.push ([refByIID, OAT.IRIDB.getIRI(item.back)]);
-	self.drawSpotlight(self.parent.getTitle(item),obj);
+	for (var i=0;i<item.back.length;i++)
+          obj.push ([refByIID, item.back[i]]); // XXX item.back is a list of backreferences
+
+	self.drawSpotlight(self.parent.getTitle(item),
+			   OAT.IRIDB.getIRI(item.uri),
+			   obj);
     }
 
     this.breadCrumbClickFun = function (index) {
@@ -674,9 +679,9 @@ OAT.RDFTabs.navigator = function(parent,optObj) {
     this.drawBreadCrumbs = function () {
 	var bc = self.nav.breadCrumbs;
 	OAT.Dom.clear(bc);
-	var a = OAT.Dom.create("a", {className: "bc_title"});
+	var a = OAT.Dom.create("span", {className: "bc_title"});
 	a.innerHTML = "Result";
-	a.href = "#";
+//	a.href = "#";
 	a.title = "Initial query result";
 
 	OAT.Event.attach(a,"click",function() {
@@ -698,8 +703,7 @@ OAT.RDFTabs.navigator = function(parent,optObj) {
 	    else
 		a.innerHTML = self.parent.store.getCIRIorSplit(iid);
 
-	    a.title = OAT.IRIDB.getIRI(iid);
-	    a.href = "#";
+	    a.title = a.href = OAT.IRIDB.getIRI(iid);
 
 	    OAT.Event.attach (a,"click", self.breadCrumbClickFun (i));
 
@@ -857,13 +861,22 @@ OAT.RDFTabs.navigator = function(parent,optObj) {
 	}
     }
 
-    this.drawSpotlight = function(title,obj) { /* list of resources */
+    this.drawSpotlight = function(title, uri, obj) { /* list of resources */
 	OAT.Dom.clear(self.mainDiv);
-	var h3 = OAT.Dom.create("h3",{className:"rdf_nav_title"});
-	h3.innerHTML = title;
+	var t_elm = OAT.Dom.create("h3",{className:"rdf_nav_title"});
+
+	if (uri) {
+            var a = OAT.Dom.create ("a");
+            a.href = uri;
+            a.innerHTML = title;
+            OAT.Dom.append ([t_elm, a]);
+	}
+	else 
+            t_elm.innerHTML = title;
+
 	var table = OAT.Dom.create("table",{className:"rdf_nav_spotlight"});
 	var tbody = OAT.Dom.create("tbody");
-	OAT.Dom.append([self.mainDiv,h3,table],[table,tbody]);
+	OAT.Dom.append([self.mainDiv,t_elm,table],[table,tbody]);
 	var remain = false;
 
 	for (i=0;i<obj.length;i++)
@@ -876,9 +889,9 @@ OAT.RDFTabs.navigator = function(parent,optObj) {
 	    self.navigate(self.historyIndex);
 	    return;
 	}
-	/* give a list of items for navigation */
+	/* give a list of graphs for navigation */
 	var obj = self.getTypeObject();
-	self.drawSpotlight("Click on a Data Entity to explore its Linked Data Web.",obj);
+	self.drawSpotlight("Click on a Data Entity to explore its Linked Data Web.",false,obj);
 	self.redrawTop();
     }
 
@@ -1095,15 +1108,36 @@ OAT.RDFTabs.svg = function(parent,optObj) {
 
 	for (var i=0;i<cnt;i++) {
 	    var t = self.parent.data.triples[i];
-	    var triple = [OAT.IRIDB.getIRI(t[0]), OAT.IRIDB.getIRI(t[1])]
 
-	    if (t[2].isIRI()) {
-		triple.push (t[2].getIRI());
-		triple.push (1);
-	    } else {
-		triple.push (t[2].getValue());
-		triple.push(0);
+	    //
+	    // XXX: FIXME here and in RDFStore
+	    //
+ 
+	    var new_o;
+
+	    if (t[2].constructor == OAT.RDFAtom) {
+		if (t[2].isIRI())
+		    new_o = t[2].getIRI();
+		else 
+		    new_o = t[2].value;
 	    }
+	    else {
+		if (typeof t[2] == 'object') {
+		    new_o = OAT.IRIDB.getIRI(t[2].iid)
+		}
+		else new_o = t[2];
+	    }
+	    var triple = [OAT.IRIDB.getIRI(t[0]), 
+			  OAT.IRIDB.getIRI(t[1]),
+			  new_o];
+
+//	    if (t[2].isIRI()) {
+//		triple.push (t[2].getIRI());
+//		triple.push (1);
+//	    } else {
+//		triple.push (t[2].getValue());
+//		triple.push(0);
+//	    }
 
 	    triples.push(triple);
 	}
@@ -1113,7 +1147,7 @@ OAT.RDFTabs.svg = function(parent,optObj) {
 
 	for (var i=0;i<self.graphsvg.data.length;i++) {
 	    var node = self.graphsvg.data[i];
-	    if (node.name.match(/^http/i)) {
+	    if (node.name && node.name.match(/^http/i)) {
 		self.parent.processLink(node.svg,node.name);
 	    }
 	}
@@ -1123,7 +1157,7 @@ OAT.RDFTabs.svg = function(parent,optObj) {
 
 //
 // Ordered data structure for points
-// Not a R-Tree but should improve speed for some cases.
+// Not a R-Tree but may improve speed for some cases.
 //
 
 OAT.RDFTabs.PointList = function (opts) {
@@ -1285,7 +1319,8 @@ OAT.RDFTabs.map = function(parent,optObj) {
 	description:"This module plots all geodata found in filtered resources onto a map.",
 	desc:"Plots all geodata onto a map",
 	clickPopup:true,
-	hoverPopup:true
+	hoverPopup:true,
+	height: "600px"
     }
 
     for (var p in optObj) { self.options[p] = optObj[p]; }
@@ -1296,14 +1331,23 @@ OAT.RDFTabs.map = function(parent,optObj) {
     this.description = self.options.description;
     this.desc = self.options.desc;
     this.elm.style.position = "relative";
-    this.elm.style.height = "600px";
 
-    // Various properties used to obtain ICBM address
+    var useragent = navigator.userAgent;
+    
+    if (useragent.indexOf('iPhone') != -1 || useragent.indexOf('Android') != -1 ) {
+	self.elm.style.width = '100%';
+	self.elm.style.height = '100%';
+    } else {
+    this.elm.style.height = self.options.height;
+    }
+
+    // Various properties used to obtain @ICBM.mil address
     //
 
     this.keyProperties    = OAT.IRIDB.insertIRIArr (["http://xmlns.com/foaf/0.1/based_near",
 						    "http://www.w3.org/2003/01/geo/wgs84_pos",
-						    "http://www.w3.org/2003/01/geo/geometry"]); /* containing coords */
+						     "http://www.w3.org/2003/01/geo/geometry",
+						     "http://www.w3.org/2003/01/geo/wgs84_pos#geometry"]); /* containing coords */
 
     this.locProperties    = OAT.IRIDB.insertIRIArr (["http://xmlns.com/foaf/0.1/location", 
 						     "http://www.w3.org/2006/vcard/ns#Locality",
@@ -1313,7 +1357,8 @@ OAT.RDFTabs.map = function(parent,optObj) {
 						     "http://www.w3.org/2003/01/geo/wgs84_pos#lat",
 						     "http://www.w3.org/2003/01/geo/latitude", 
 						     "http://www.w3.org/2006/vcard/ns#latitude",
-						     "http://www.w3.org/2001/vcard-rdf/3.0#latitude"]);
+						     "http://www.w3.org/2001/vcard-rdf/3.0#latitude",
+						     "http://dbpedia.org/property/lat"]);
 
     this.lonProperties    = OAT.IRIDB.insertIRIArr (["http://www.w3.org/2003/01/geo/lng",
 						     "http://www.w3.org/2003/01/geo/wgs84_pos#long",
@@ -1321,14 +1366,40 @@ OAT.RDFTabs.map = function(parent,optObj) {
 						     "http://www.w3.org/2003/01/geo/long",
 						     "http://www.w3.org/2003/01/geo/longitude",
 						     "http://www.w3.org/2006/vcard/ns#longitude",
-						     "http://www.w3.org/2001/vcard-rdf/3.0#longitude"]);
+						     "http://www.w3.org/2001/vcard-rdf/3.0#longitude",
+						     "http://dbpedia.org/property/long"]);
 
     this.lookupProperties = OAT.IRIDB.insertIRIArr (["http://xmlns.com/foaf/0.1/name",
 						     "http://xmlns.com/foaf/0.1/location"]); /* interesting to be put into lookup pin */
 
     this.pointTypes = OAT.IRIDB.insertIRIArr (["http://www.w3.org/2003/01/geo/Point", 
 					       "http://www.w3.org/2003/01/geo/wgs84_pos#Point",
-					       "http://www.georss.org/georss/point"]);
+					       "http://www.georss.org/georss/point",
+					       "http://www.openlinksw.com/schemas/virtrdf#Geometry"]);
+
+    this.markerPredBlacklist = OAT.IRIDB.insertIRIArr (["http://www.openlinksw.com/schemas/oat/rdftabs#useMarker",
+							"http://xmlns.com/foaf/0.1/based_near",
+							"http://www.w3.org/2003/01/geo/wgs84_pos",
+							"http://www.w3.org/2003/01/geo/geometry",
+							"http://www.w3.org/2003/01/geo/wgs84_pos#geometry",
+							"http://www.w3.org/2003/01/geo/lat",
+							"http://www.w3.org/2003/01/geo/wgs84_pos#lat",
+							"http://www.w3.org/2003/01/geo/latitude", 
+							"http://www.w3.org/2006/vcard/ns#latitude",
+							"http://www.w3.org/2001/vcard-rdf/3.0#latitude",
+							"http://dbpedia.org/property/lat",
+							"http://www.w3.org/2003/01/geo/lng",
+							"http://www.w3.org/2003/01/geo/wgs84_pos#long",
+							"http://www.w3.org/2003/01/geo/lon",
+							"http://www.w3.org/2003/01/geo/long",
+							"http://www.w3.org/2003/01/geo/longitude",
+							"http://www.w3.org/2006/vcard/ns#longitude",
+							"http://www.w3.org/2001/vcard-rdf/3.0#longitude",
+							"http://dbpedia.org/property/long",
+							"http://www.w3.org/2003/01/geo/Point", 
+							"http://www.w3.org/2003/01/geo/wgs84_pos#Point",
+							"http://www.georss.org/georss/point",
+							"http://www.openlinksw.com/schemas/virtrdf#Geometry"]);
 
     this.usedBlanknodes = [];
     this.pointList = new OAT.RDFTabs.PointList({uniqueInsert:true});
@@ -1466,13 +1537,34 @@ OAT.RDFTabs.map = function(parent,optObj) {
 	    return markerPath + '01.png';
 	    break;
 	case OAT.RDFTabsData.MARKER_MODE_EXPLICIT:
-	    mpred = item.preds[m_p_iid];
-	    if (typeof (mpred) != 'undefined')
-		markerFile = markerPath + mpred + '.png';
+	    if (typeof (item.preds[m_p_iid]) != 'undefined') {
+	    mpred = item.preds[m_p_iid][0];
+		if (mpred.constructor == OAT.RDFAtom) {
+		    if (mpred.isIRI())
+			markerFile = mpred.getIRI();
+		    else if (mpred.isLit()) {
+			markerFile = mpred.getValue();
+			if (!markerFile.toUpperCase().match(/HTTP(S?):\/\//)) {
+			    markerFile = markerPath + markerFile+'.png';
+			}
+		    }
+		}
+	    }
 	    break;
 	case OAT.RDFTabsData.MARKER_MODE_AUTO:
-	    mpred = item.preds[m_p_iid];
-	    if (typeof (mpred) != 'undefined') { // explicit marker def takes precedence
+	    if (typeof (item.preds[m_p_iid]) != 'undefined') { // explicit marker def takes precedence
+	    mpred = item.preds[m_p_iid][0];
+		if (mpred.constructor == OAT.RDFAtom) {
+		    if (mpred.isIRI())
+			markerFile = mpred.getIRI();
+		    else if (mpred.isLit()) {
+			markerFile = mpred.getValue();
+			if (!markerFile.toUpperCase().match(/HTTP(S?):\/\//)) {
+			    markerFile = markerPath + markerFile+'.png';
+			}
+		    }
+		}
+		else
 		markerFile = markerPath + mpred + '.png';
 		break;
 	    }
@@ -1499,6 +1591,7 @@ OAT.RDFTabs.map = function(parent,optObj) {
 		return item.preds[p][0].getValue();
 	    }
 	}
+	return false;
 	}
 
 //
@@ -1509,6 +1602,7 @@ OAT.RDFTabs.map = function(parent,optObj) {
 	var div = OAT.Dom.create ("div",{className:"all_props_ctr"});
 	var preds = item.preds;
 	for (var p in preds) {
+	    if (self.markerPredBlacklist.find(parseInt(p)) != -1) continue; // Not all predicates are created equal
 	    var pred = preds[p];
 	    var simple = self.parent.store.getCIRIorSplit(p);
 	    if (pred.length == 1 || self.lookupProperties.find(simple) != -1) {
@@ -1524,22 +1618,44 @@ OAT.RDFTabs.map = function(parent,optObj) {
     }
 
     this.drawMarker = function (item) {
-	var titleH = OAT.Dom.create("h2",{className:""});
+	var titleH = OAT.Dom.create("h2",{className:"markerTitle"});
+
 	var title = self.parent.getTitle(item);
+	var titleHref='';
+
 	if (title.match(/^http/i)) {
 	    self.parent.processLink(titleH,title);
 	    titleH.style.cursor = "pointer";
-	}
 	titleH.innerHTML = title;
+	} else {
+	    var titleHref = self.parent.getURI(item);
+	    if (titleHref) {
+		var titleA = OAT.Dom.create("a",{href:titleHref,target:"_blank"});
+		titleA.innerHTML = title;
+		OAT.Dom.append ([titleH, titleA]);
+	    } else {
+		titleH.innerHTML = title;
+	    }
+	}
+
 	var ctr = OAT.Dom.create("div",{overflow:"auto",className:'marker_ctr'});
+	var abstr = self.getAbstract(item);
+
+	if (abstr) {
 	var abstrC = OAT.Dom.create("div",{className:'abstract'});
-	abstrC.innerHTML = self.getAbstract(item);
+	    abstrC.innerHTML = abstr;
+	}	
 	
 	//	if (self.parent.store.itemHasType (item, "")) { }
 	//	if (self.parent.store.itemHasType (item, "")) { }
 
 	var ap = self.drawAllProps (item);
+
+	if (abstr)
 	OAT.Dom.append([ctr,titleH,abstrC,ap]);
+	else 
+	    OAT.Dom.append([ctr,titleH,ap]);
+
 	return ctr;
     }
 
@@ -1608,13 +1724,17 @@ OAT.RDFTabs.map = function(parent,optObj) {
 		var item = self.parent.data.structured[i];
 		self.trySimple(item);
 	    }
+
+	    
 	    self.addMarkers();
+	    
 	}
 
 	if (!self.map_loaded) {
 	    self.map = new OAT.Map(self.elm,
 				   self.options.provider,
-				   {fix:self.options.fix,markerIcon:"toolkit/images/markers/01.png",markerIconSize:[18,41]},
+				   {fix:self.options.fix,markerIcon:"toolkit/images/markers/01.png",
+				    markerIconSize:[18,41]},
 				   self.options.specificOpts);
 	    OAT.Map.loadApi(self.options.provider,{callback: cb});
 	}
@@ -1882,6 +2002,7 @@ OAT.RDFTabs.images = function(parent,optObj) {
 	    OAT.Dom.center(self.dimmer,1,1);
 	});
 	img.src = self.images[index][0];
+	img.title = self.parent.getTitle(item);
 	self.fixNav();
     }
 
@@ -1907,6 +2028,7 @@ OAT.RDFTabs.images = function(parent,optObj) {
 	});
 	img.src = uri;
 	img.title = self.parent.getTitle(item);
+	img.alt = self.parent.getTitle(item);
 	OAT.Event.attach(img,"click",function() { self.showBig(index); });
     }
 
@@ -1940,7 +2062,8 @@ OAT.RDFTabs.images = function(parent,optObj) {
 		} else {
 		    /* look for predicates that are/contain image links */
 		    for (var j=0;j<pred.length;j++) {
-			if (pred[j].getTag() != OAT.RDFTag.IRI) { continue; }
+			if (item.constructor != OAT.RDFAtom ||
+			    pred[j].getTag() != OAT.RDFTag.IRI) { continue; }
 			var value = pred[j].getIRI();
 			if (self.parent.getContentType(value) == 3) {
 			    self.addUriItem(value,item);
@@ -1953,7 +2076,7 @@ OAT.RDFTabs.images = function(parent,optObj) {
 		    } /* for all values */
 		}
 	    } /* for all predicates */
-	} /* for all items */
+	} /* for all graphs */
     }
 
     this.redraw = function() {
@@ -2050,7 +2173,7 @@ OAT.RDFTabs.tagcloud = function(parent,optObj) {
 	    if (item.type == tcP) {
 		self.addCloud(item);
 	    }
-	} /* for all items */
+	} /* for all graphs */
 
 	for (var i=0; i<this.clouds.length;i++) {
 	    var cloud = this.clouds[i];
diff --git a/binsrc/oat/toolkit/rectwin.js b/binsrc/oat/toolkit/rectwin.js
index 944bef2..8b72284 100644
--- a/binsrc/oat/toolkit/rectwin.js
+++ b/binsrc/oat/toolkit/rectwin.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: rectwin.js,v 1.10.2.3 2010/04/06 16:46:12 source Exp $
+ *  $Id: rectwin.js,v 1.10.2.4 2010/09/07 21:56:37 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -21,9 +21,9 @@ OAT.RectWin = function(optObj) {
 	this.options.statusHeight = 30;
 	this.options.moveHeight = 16;
 
-	OAT.Dom.applyStyle(this.div,{border:"1px solid rgb(164,163,163)",font:"menu",backgroundColor:"#fff"});
-	OAT.Dom.applyStyle(this.content,{overflow:"auto",top:"16px",position:"relative"});
-	OAT.Dom.applyStyle(this.move,{position:"absolute",left:"0px",top:"0px",height:this.options.moveHeight+"px"});
+	OAT.Style.set(this.div,{border:"1px solid rgb(164,163,163)",font:"menu",backgroundColor:"#fff"});
+	OAT.Style.set(this.content,{overflow:"auto",top:"16px",position:"relative"});
+	OAT.Style.set(this.move,{position:"absolute",left:"0px",top:"0px",height:this.options.moveHeight+"px"});
 
 	if (self.options.move) {
 		this.move._Drag_movers[0][1].restrictionFunction = function(l,t) {
@@ -31,14 +31,14 @@ OAT.RectWin = function(optObj) {
 		}
 	}
 	if (self.closeBtn) {
-		OAT.Dom.applyStyle(this.closeBtn,{cssFloat:"right",styleFloat:"right",fontSize:"1px",marginTop:"2px",marginRight:"2px",cursor:"pointer",width:"14px",height:"13px",backgroundImage:"url("+self.options.imagePath+"RectWin_close.gif)"});
+		OAT.Style.set(this.closeBtn,{cssFloat:"right",styleFloat:"right",fontSize:"1px",marginTop:"2px",marginRight:"2px",cursor:"pointer",width:"14px",height:"13px",backgroundImage:"url("+self.options.imagePath+"RectWin_close.gif)"});
 	}
 
 	if (self.resize) {
-		OAT.Dom.applyStyle(this.resize,{width:"10px",height:"10px",fontSize:"1px",position:"absolute",right:"2px",bottom:"2px",cursor:"nw-resize",backgroundImage:"url("+self.options.imagePath+"RectWin_resize.gif)"});
+		OAT.Style.set(this.resize,{width:"10px",height:"10px",fontSize:"1px",position:"absolute",right:"2px",bottom:"2px",cursor:"nw-resize",backgroundImage:"url("+self.options.imagePath+"RectWin_resize.gif)"});
 	}
 
-	OAT.Dom.applyStyle(this.caption,{textAlign:"center",fontWeight:"bold"});
+	OAT.Style.set(this.caption,{textAlign:"center",fontWeight:"bold"});
 
 	this.resizeTo = function(w,h) {
 		if (w) {
diff --git a/binsrc/oat/toolkit/roundwin.js b/binsrc/oat/toolkit/roundwin.js
index 85b9e85..9280498 100644
--- a/binsrc/oat/toolkit/roundwin.js
+++ b/binsrc/oat/toolkit/roundwin.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: roundwin.js,v 1.9.2.3 2010/04/06 16:46:12 source Exp $
+ *  $Id: roundwin.js,v 1.9.2.4 2010/09/07 21:56:37 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -21,8 +21,8 @@ OAT.RoundWin = function(optObj) {
 	this.options.statusHeight = 20;
 	this.options.moveHeight = 8;
 
-	OAT.Dom.applyStyle(this.div,{border:"1px solid rgb(160,160,164)",font:"menu",backgroundColor:"#fff"});
-	OAT.Dom.applyStyle(this.content,{top:"8px",position:"relative"});
+	OAT.Style.set(this.div,{border:"1px solid rgb(160,160,164)",font:"menu",backgroundColor:"#fff"});
+	OAT.Style.set(this.content,{top:"8px",position:"relative"});
 
 	document.body.appendChild(this.div);
 	var tmp = OAT.SimpleFX.roundDiv(this.div,{antialias:0,size:15});
@@ -46,7 +46,7 @@ OAT.RoundWin = function(optObj) {
 		}
 	}
 
-	OAT.Dom.applyStyle(this.move,{position:"absolute",left:"0px",top:(-self.options.moveHeight)+"px",height:2*self.options.moveHeight+"px",borderBottom:"1px solid rgb(208,208,210)"});
+	OAT.Style.set(this.move,{position:"absolute",left:"0px",top:(-self.options.moveHeight)+"px",height:2*self.options.moveHeight+"px",borderBottom:"1px solid rgb(208,208,210)"});
 
 	if (self.options.move) {
 		this.move._Drag_movers[0][1].restrictionFunction = function(l,t) {
@@ -55,13 +55,13 @@ OAT.RoundWin = function(optObj) {
 	}
 
 	if (self.closeBtn) {
-		OAT.Dom.applyStyle(this.closeBtn,{cssFloat:"right",styleFloat:"right",fontSize:"1px",marginTop:"2px",marginRight:"5px",cursor:"pointer",width:"14px",height:"13px",backgroundImage:"url("+self.options.imagePath+"RoundWin_close.gif)"});
+		OAT.Style.set(this.closeBtn,{cssFloat:"right",styleFloat:"right",fontSize:"1px",marginTop:"2px",marginRight:"5px",cursor:"pointer",width:"14px",height:"13px",backgroundImage:"url("+self.options.imagePath+"RoundWin_close.gif)"});
 	}
 
 	if (self.resize) {
-		OAT.Dom.applyStyle(this.resize,{width:"10px",height:"10px",fontSize:"1px",position:"absolute",right:"5px",bottom:"-4px",cursor:"nw-resize",backgroundImage:"url("+self.options.imagePath+"RoundWin_resize.gif)"});
+		OAT.Style.set(this.resize,{width:"10px",height:"10px",fontSize:"1px",position:"absolute",right:"5px",bottom:"-4px",cursor:"nw-resize",backgroundImage:"url("+self.options.imagePath+"RoundWin_resize.gif)"});
 		this.resize.parentNode.appendChild(this.resize);
 	}
 
-	OAT.Dom.applyStyle(this.caption,{textAlign:"center",fontWeight:"bold"});
+	OAT.Style.set(this.caption,{textAlign:"center",fontWeight:"bold"});
 }
diff --git a/binsrc/oat/toolkit/win.js b/binsrc/oat/toolkit/win.js
index 5fc1733..351b74d 100644
--- a/binsrc/oat/toolkit/win.js
+++ b/binsrc/oat/toolkit/win.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: win.js,v 1.16.2.4 2010/04/06 16:46:12 source Exp $
+ *  $Id: win.js,v 1.16.2.5 2011/02/16 20:54:22 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -277,8 +277,15 @@ OAT.Win = function(optObj) {
 
 	/* size & title & position */
 	this.moveTo(this.options.x, this.options.y);
-	if (this.options.outerWidth || this.options.outerHeight) { this.outerResizeTo(this.options.outerWidth, this.options.outerHeight); }
-	if (this.options.innerWidth || this.options.innerHeight) { this.innerResizeTo(this.options.innerWidth, this.options.innerHeight); }
+
+	if (this.options.outerWidth || this.options.outerHeight) { 
+	    this.outerResizeTo(this.options.outerWidth, this.options.outerHeight); 
+	}
+
+	if (this.options.innerWidth || this.options.innerHeight) { 
+	    this.innerResizeTo(this.options.innerWidth, this.options.innerHeight); 
+	}
+
 	if (this.dom.caption) { this.dom.caption.innerHTML = this.options.title; }
 
 	/* nearly ready... */
@@ -329,7 +336,9 @@ OAT.Win.Template = function(obj) {
  */
 OAT.Win.MS = function(obj) {
 	OAT.Style.include('winms.css');
-	obj.dom.container = OAT.Dom.create("div",{position:"absolute",className:"oat_winms_container oat_win_container"});
+	obj.dom.container = OAT.Dom.create("div",
+					   {position:"absolute",
+					    className:"oat_winms_container oat_win_container"});
 	obj.dom.content = OAT.Dom.create("div",{className:"oat_winms_content"});
 	obj.dom.title = OAT.Dom.create("div",{className:"oat_winms_title"});
 	obj.dom.caption = OAT.Dom.create("span",{className:"oat_winms_caption"});
@@ -428,7 +437,8 @@ OAT.Win.Rect = function(obj) {
 OAT.Win.Round = function(obj) {
 	OAT.Style.include('winround.css');
 
-	obj.dom.container = OAT.Dom.create("div",{position:"absolute", className:"oat_winround_container oat_win_container"});
+	obj.dom.container = OAT.Dom.create("div",{position:"absolute", 
+						  className:"oat_winround_container oat_win_container"});
 
 	obj.dom.table = OAT.Dom.create("table",{className:"oat_winround_wrapper"});
 	obj.dom.tr_t = OAT.Dom.create("tr",{});
diff --git a/binsrc/oat/toolkit/xml.js b/binsrc/oat/toolkit/xml.js
index 4d0d5f0..b0a31dc 100644
--- a/binsrc/oat/toolkit/xml.js
+++ b/binsrc/oat/toolkit/xml.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: xml.js,v 1.14.2.5 2010/06/28 09:35:57 source Exp $
+ *  $Id: xml.js,v 1.14.2.7 2010/09/07 21:56:37 source Exp $
  *
  *  This file is part of the OpenLink Software Ajax Toolkit (OAT) project.
  *
@@ -41,7 +41,9 @@ OAT.Xml = {
 		*/
 
 		if (!elem) { return; }
-	if (OAT.Xml._getImplementation()) {
+	if (window.ActiveXObject) {
+	    return elem.text;
+	} else if (OAT.Xml._getImplementation()) {
 			var result = elem.textContent;
 			/* safari hack */
 			if (typeof(result) == "undefined") {
@@ -49,8 +51,6 @@ OAT.Xml = {
 				return (result ? result.nodeValue : "");
 			}
 			return result;
-		} else if (window.ActiveXObject) {
-			return elem.text;
 		} else {
 		    alert("OAT.Xml.textValue:\nNo XML parser available");
 		    return false;
@@ -234,15 +234,15 @@ OAT.Xml = {
 			if (b in nsObject) { return nsObject[" "]; } /* default ns */
 			return ""; /* fallback; should not happen */
 		}
-		if (document.evaluate) {
+		if (window.ActiveXObject) {
+		    var tmp = xmlDoc.selectNodes(xpath);
+		    for (var i=0;i<tmp.length;i++) { result.push(tmp[i]); }
+		    return result;
+		} else if (document.evaluate) {
 			var it = xmlDoc.evaluate(xpath,xmlDoc,resolver,XPathResult.ANY_TYPE,null);
 			var node;
 			while ((node = it.iterateNext())) {	result.push(node); }
 			return result;
-		} else if (window.ActiveXObject) {
-			var tmp = xmlDoc.selectNodes(xpath);
-			for (var i=0;i<tmp.length;i++) { result.push(tmp[i]); }
-			return result;
 		} else {
 	    alert("OAT.Xml.xpath:\nNo Xml Parser available");
 			return false;
diff --git a/binsrc/rdf_mappers/Makefile.in b/binsrc/rdf_mappers/Makefile.in
index ab9ed89..3dd6a93 100644
--- a/binsrc/rdf_mappers/Makefile.in
+++ b/binsrc/rdf_mappers/Makefile.in
@@ -186,6 +186,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/rdf_mappers/make_vad.sh b/binsrc/rdf_mappers/make_vad.sh
index 58c95b8..ac3291a 100755
--- a/binsrc/rdf_mappers/make_vad.sh
+++ b/binsrc/rdf_mappers/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.15.2.9 2010/03/30 13:08:59 source Exp $
+#  $Id: make_vad.sh,v 1.15.2.13 2011/03/23 12:13:44 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -196,7 +196,13 @@ directory_init() {
      cp $f vad/vsp/rdf_mappers/$f  
   done
 
-  cp *.sql vad/code/rdf_mappers
+
+  #cp *.sql vad/code/rdf_mappers
+
+  cp rdf_mappers.sql vad/code/rdf_mappers
+  cp rdf_mappers_drop.sql vad/code/rdf_mappers
+  cp virt_rdf_label.sql vad/code/rdf_mappers
+
   cp data/*.sql vad/code/rdf_mappers
   cp data/*.gz vad/code/rdf_mappers
   cp rdfdesc/*.sql vad/code/rdf_mappers
@@ -298,7 +304,7 @@ sticker_init() {
   echo "  <name package=\"$VAD_NAME\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"$VAD_DESC\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
@@ -330,6 +336,7 @@ if [ "$ISDAV" = "1" ] ; then
 else
   echo "	registry_set('_"$VAD_NAME"_path_', 'file://vad/vsp/$VAD_NAME/');" >> $STICKER
 fi
+  echo "    DB.DBA.VAD_LOAD_SQL_FILE('"$BASE_PATH_CODE"$VAD_NAME/virt_rdf_label.sql', 0, 'report', $ISDAV);" >> $STICKER
   echo "    DB.DBA.VAD_LOAD_SQL_FILE('"$BASE_PATH_CODE"$VAD_NAME/description.sql', 0, 'report', $ISDAV);" >> $STICKER
   echo "    DB.DBA.VAD_LOAD_SQL_FILE('"$BASE_PATH_CODE"$VAD_NAME/yelp_categories.sql', 0, 'report', $ISDAV);" >> $STICKER
   echo "	DB.DBA.VAD_LOAD_SQL_FILE('"$BASE_PATH_CODE"$VAD_NAME/rdf_mappers.sql', 0, 'report', $ISDAV);" >> $STICKER
@@ -359,6 +366,7 @@ fi
   echo "  <file type=\"$TYPE\" source=\"code\" target_uri=\"$VAD_NAME/iso_country_codes.sql\" dav_owner=\"dav\" dav_grp=\"administrators\" dav_perm=\"111101101NN\" makepath=\"yes\"/>"  >> $STICKER
   echo "  <file type=\"$TYPE\" source=\"code\" target_uri=\"$VAD_NAME/rdf_mappers_drop.sql\" dav_owner=\"dav\" dav_grp=\"administrators\" dav_perm=\"111101101NN\" makepath=\"yes\"/>"  >> $STICKER
   echo "  <file type=\"$TYPE\" source=\"code\" target_uri=\"$VAD_NAME/description.sql\" dav_owner=\"dav\" dav_grp=\"administrators\" dav_perm=\"111101101NN\" makepath=\"yes\"/>"  >> $STICKER
+  echo "  <file type=\"$TYPE\" source=\"code\" target_uri=\"$VAD_NAME/virt_rdf_label.sql\" dav_owner=\"dav\" dav_grp=\"administrators\" dav_perm=\"111101101NN\" makepath=\"yes\"/>"  >> $STICKER
   echo "  <file type=\"$TYPE\" source=\"code\" target_uri=\"$VAD_NAME/nyt_people.nt.gz\" dav_owner=\"dav\" dav_grp=\"administrators\" dav_perm=\"111101101NN\" makepath=\"yes\"/>"  >> $STICKER
 
   for file in `find xslt/main -type f -print | grep -v CVS | sort`
@@ -371,7 +379,7 @@ fi
       echo "  <file type=\"$TYPE\" source=\"http\" target_uri=\"$VAD_NAME/$file.gz\" dav_owner=\"dav\" dav_grp=\"administrators\" dav_perm=\"111101101NN\" makepath=\"yes\"/>" >> $STICKER
   done
 
-  for file in `find ontologies/owl -type f -print | grep -v CVS | grep -v '.n3' | sort`
+  for file in `find ontologies/owl -type f -print | grep -v CVS | grep -v '.n3' | grep -v '.ttl'| sort`
   do
       echo "  <file type=\"$TYPE\" source=\"http\" target_uri=\"$VAD_NAME/$file.gz\" dav_owner=\"dav\" dav_grp=\"administrators\" dav_perm=\"111101101NN\" makepath=\"yes\"/>" >> $STICKER
   done
@@ -492,7 +500,6 @@ vad_create $STICKER_DAV $VAD_NAME_RELEASE
 virtuoso_shutdown
 chmod 644 $VAD_NAME_DEVEL
 chmod 644 $VAD_NAME_RELEASE
-directory_clean
 
 CHECK_LOG
 RUN egrep  '"\*\*.*FAILED:|\*\*.*ABORTED:"' "$LOGFILE"
@@ -502,5 +509,7 @@ then
 	exit 1
 fi
 
+directory_clean
+
 BANNER "COMPLETED VAD PACKAGING"
 exit 0
diff --git a/binsrc/rdf_mappers/ontologies/owl/attribution.owl b/binsrc/rdf_mappers/ontologies/owl/attribution.owl
new file mode 100644
index 0000000..e15df52
--- /dev/null
+++ b/binsrc/rdf_mappers/ontologies/owl/attribution.owl
@@ -0,0 +1,89 @@
+<?xml version="1.0" ?>
+<!--
+  The OpenLink Sponger ontology for transformation results attribution.
+-->
+
+<!DOCTYPE rdf:RDF [
+<!ENTITY foaf "http://xmlns.com/foaf/0.1/">
+<!ENTITY owl "http://www.w3.org/2002/07/owl#">
+<!ENTITY opl "http://www.openlinksw.com/schema/attribution#">
+<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
+]>
+<rdf:RDF xmlns="http://www.openlinksw.com/schemas/ebay#"
+    xmlns:owl="http://www.w3.org/2002/07/owl#"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
+
+    <owl:Ontology rdf:about="&opl;">
+        <creator xmlns="http://purl.org/dc/elements/1.1/"
+            rdf:datatype="http://www.w3.org/2001/XMLSchema#string">OpenLink Software, http://www.openlinksw.com</creator>
+        <rdfs:label>OpenLink Sponger ontology for transformation attribution</rdfs:label>
+    </owl:Ontology>
+
+    <owl:Property rdf:about="&opl;providedBy">
+        <rdfs:domain rdf:resource="&owl;Thing"/>
+        <rdfs:range rdf:resource="&foaf;Organization"/>
+        <rdfs:label>providedBy</rdfs:label>
+        <rdfs:comment>The supplier of the original DataSource</rdfs:comment>
+        <rdfs:isDefinedBy rdf:resource="&opl;"/>
+    </owl:Property>
+
+    <owl:Class rdf:about="&opl;DataSource">
+        <rdfs:label>DataSource</rdfs:label>
+        <rdfs:comment>The source ontology used for transformation</rdfs:comment>
+        <rdfs:isDefinedBy rdf:resource="&opl;"/>
+    </owl:Class>
+
+    <owl:Class rdf:about="&opl;TransformationErrors">
+        <rdfs:label>TransformationErrors</rdfs:label>
+        <rdfs:comment>Collection of errors generated during transformation if any</rdfs:comment>
+        <rdfs:isDefinedBy rdf:resource="&opl;"/>
+    </owl:Class>
+
+    <owl:Class rdf:about="&opl;TransformationError">
+        <rdfs:label>TransformationError</rdfs:label>
+        <rdfs:comment>A separate error from a given sponger cartridge</rdfs:comment>
+        <rdfs:isDefinedBy rdf:resource="&opl;"/>
+    </owl:Class>
+
+    <owl:Property rdf:about="&opl;isDescribedUsing">
+        <rdfs:comment>The source ontology URI whcih is used for transformation</rdfs:comment>
+        <rdfs:domain rdf:resource="&opl;DataSource"/>
+        <rdfs:isDefinedBy rdf:resource="&opl;"/>
+        <rdfs:label>Is Described Using</rdfs:label>
+        <rdfs:range rdf:resource="&owl;Thing"/>
+    </owl:Property>
+
+    <owl:AnnotationProperty rdf:about="&opl;hasNamespacePrefix">
+        <rdfs:comment>The prefix for given source ontology URI</rdfs:comment>
+        <rdfs:domain rdf:resource="&opl;DataSource"/>
+        <rdfs:isDefinedBy rdf:resource="&opl;"/>
+        <rdfs:label>Has Namespace Prefix</rdfs:label>
+        <rdfs:range rdf:resource="&xsd;string"/>
+    </owl:AnnotationProperty>
+
+    <owl:Property rdf:about="&opl;hasErrors">
+        <rdfs:comment>The errors, if any</rdfs:comment>
+        <rdfs:domain rdf:resource="&owl;Thing"/>
+        <rdfs:isDefinedBy rdf:resource="&opl;"/>
+        <rdfs:label>Has Errors</rdfs:label>
+        <rdfs:range rdf:resource="&opl;TransformationErrors"/>
+    </owl:Property>
+
+    <owl:AnnotationProperty rdf:about="&opl;hasError">
+        <rdfs:comment>A separate error</rdfs:comment>
+        <rdfs:domain rdf:resource="&opl;TransformationErrors"/>
+        <rdfs:isDefinedBy rdf:resource="&opl;"/>
+        <rdfs:label>Has Error</rdfs:label>
+        <rdfs:range rdf:resource="&opl;TransformationError"/>
+    </owl:AnnotationProperty>
+
+    <owl:AnnotationProperty rdf:about="&opl;errorText">
+        <rdfs:comment>The description of error</rdfs:comment>
+        <rdfs:domain rdf:resource="&opl;TransformationError"/>
+        <rdfs:isDefinedBy rdf:resource="&opl;"/>
+        <rdfs:label>Error Text</rdfs:label>
+        <rdfs:range rdf:resource="&xsd;string"/>
+    </owl:AnnotationProperty>
+</rdf:RDF>
diff --git a/binsrc/rdf_mappers/ontologies/owl/oplevri.owl b/binsrc/rdf_mappers/ontologies/owl/oplevri.owl
new file mode 100644
index 0000000..fe9f244
--- /dev/null
+++ b/binsrc/rdf_mappers/ontologies/owl/oplevri.owl
@@ -0,0 +1,590 @@
+<!--
+  Generated from oplbestbuy.n3 by on-line N3-RDF/XML converter at http://www.mindswap.org/2002/rdfconvert/ 
+ 
+  An OpenLink ontology for specializing the ProductOrService class of the GoodRelations ontology
+  to handle item descriptions from the Google Base Web Service.
+ 
+  Not all item types supported by Google Base are mapped to OWL here. Only those which are amenable
+  to mapping to GoodRelations are included. Essentially this subset includes only those item types 
+  which have associated price information.  i.e. housing, local products, products, services, 
+  travel packages, vacation rentals and vehicles.
+
+  A list of available item types and their attributes is available from:
+  http://www.google.com/base/feeds/itemtypes/en_US
+-->
+
+<rdf:RDF xmlns="http://www.openlinksw.com/schemas/evri#"
+    xmlns:gr="http://purl.org/goodrelations/v1#"
+    xmlns:log="http://www.w3.org/2000/10/swap/log#"
+    xmlns:oplevri="http://www.openlinksw.com/schemas/evri#"
+    xmlns:owl="http://www.w3.org/2002/07/owl#"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
+
+  <owl:Ontology xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri">
+    <dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">OpenLink Software, http://www.openlinksw.com</dc:creator>
+  </owl:Ontology>
+
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#occupation">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Occupation</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Occupation</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#political_party">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Political party</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Political party</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#birth_date">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Birth Date</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Birth Date</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#website">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Website</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Website</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#wikipedia_normalized_name">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Name</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Name</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#source_url">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Entity url for a particular source</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Entity url for a particular source</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#preceded_by">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Preceded By</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Preceded By</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#birth_place">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Birthplace</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Birthplace</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#religion">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Religion</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Religion</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#child">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Children</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Children</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#wikipedia_paragraph">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Wikipedia Paragraph</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Wikipedia Paragraph</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#wikipedia_inbound_page_count">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Wikipedia inbound page count</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Wikipedia inbound page count</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#residence">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Residence</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Residence</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#spouse">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Spouse</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Spouse</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#holds_office">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Office</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Office</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#university_attended">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">University Attended</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">University Attended</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#term_start">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Start</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Start</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#citizenship">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Citizenship</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Citizenship</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#name">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Name</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Name</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#nationality">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Nationality</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Nationality</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#gdp_nominal_per_capita">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">GDP (nominal per capita)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">GDP (nominal per capita)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#capital">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Capital</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Capital</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#legislature">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Legislature</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Legislature</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#longitude_degree">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Longitude (Degrees)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Longitude (Degrees)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#calling_code">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Country Calling Code</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Country Calling Code</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#human_development_index_rank">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">HDI Rank</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">HDI Rank</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#anthem">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Anthem</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Anthem</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#demonym">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Demonym</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Demonym</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#area_total_km">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Total Area (km)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Total Area (km)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#currency_code">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Currency (code)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Currency (code)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#area_rank">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Area Rank</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Area Rank</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#population_density_sq_mi">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Population Density (sq mi)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Population Density (sq mi)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#population_density_rank">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Population Density Rank</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Population Density Rank</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#gdp_nominal_total">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">GDP (nominal)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">GDP (nominal)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#sovereignty">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Sovereignty</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Sovereignty</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#population_density_km">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Population Density (sq km)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Population Density (sq km)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#gini_coefficient">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Gini</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Gini</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#population_total">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Total Population</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Total Population</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#latitude_minute">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Latitude (Minutes)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Latitude (Minutes)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#country_code_top_level_domain">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">ccTLD</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">ccTLD</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#language">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Language</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Language</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#motto">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Motto</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Motto</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#name_local">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Local Name</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Local Name</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#human_development_index">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">HDI</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">HDI</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#legislature_lower_house">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Lower House</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Lower House</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#legislature_upper_house">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Upper House</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Upper House</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#gdp_per_capita">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">GDP (per capita PPP)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">GDP (per capita PPP)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#currency">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Currency</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Currency</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#largest_city">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Largest City</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Largest City</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#area">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Area</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Area</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#longitude_minute">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Longitude (Minutes)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Longitude (Minutes)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#area_water_percent">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Water Area (%)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Water Area (%)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#latitude_ns">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Latitude</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Latitude</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#latitude_degee">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Latitude (Degrees)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Latitude (Degrees)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#population_rank">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Population Rank</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Population Rank</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#population_census">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Population (census)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Population (census)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#longitude_ew">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Longitude</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Longitude</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#drives_on_side">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Drives On</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Drives On</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#gdp_per_capita_num">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">GDP (per capita PPP)</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">GDP (per capita PPP)</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#government_type">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Government type</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Government type</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#ethnic_group">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Ethnic groups</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Ethnic groups</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#time_zone">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Time Zone</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Time Zone</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#prime_minister">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Prime Minister</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Prime Minister</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#frequency">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Frequency</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Frequency</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#publisher">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Published By</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Published By</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#editor">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Editor</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Editor</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#circulation">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Circulation</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Circulation</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#first_date">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">First</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">First</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#company_subsidiary">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Subsidiaries</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Subsidiaries</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#location">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Location</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Location</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#key_person">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Key People</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Key People</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#location_region">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Region</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Region</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#organization_type">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Type</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Type</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#founded">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Founded</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Founded</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#number_employee">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">No. of Employees</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">No. of Employees</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#products_produced">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Products</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Products</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#company_industry">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Industry</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Industry</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#founder">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Founder</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Founder</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#owner">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Owned by</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Owned by</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+  <owl:DatatypeProperty xmlns:owl="http://www.w3.org/2002/07/owl#" rdf:about="http://www.openlinksw.com/schemas/evri#headquarter">
+    <rdfs:comment xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Headquarters</rdfs:comment>
+    <rdfs:domain xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri#ItemType" />
+    <rdfs:isDefinedBy xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.openlinksw.com/schemas/evri" />
+    <rdfs:label xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">Headquarters</rdfs:label>
+    <rdfs:range xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" rdf:resource="http://www.w3.org/2001/XMLSchema#string" />
+  </owl:DatatypeProperty>
+
+</rdf:RDF>
diff --git a/binsrc/rdf_mappers/ontologies/owl/opltesco.owl b/binsrc/rdf_mappers/ontologies/owl/opltesco.owl
new file mode 100644
index 0000000..d8d7f65
--- /dev/null
+++ b/binsrc/rdf_mappers/ontologies/owl/opltesco.owl
@@ -0,0 +1,261 @@
+<!--
+  Generated from opltesco.n3 by on-line N3-RDF/XML converter at http://www.mindswap.org/2002/rdfconvert/ 
+
+  An OpenLink ontology for specializing the ProductOrService class of the GoodRelations ontology
+  to handle product descriptions from the Tesco Web Service.
+ 
+  See:
+  Technical Documentation for tesco Product Advertising API
+  http://developer.tesco.com
+--> 
+
+<rdf:RDF xmlns="http://www.openlinksw.com/schemas/tesco#"
+    xmlns:gr="http://purl.org/goodrelations/v1#"
+    xmlns:log="http://www.w3.org/2000/10/swap/log#"
+    xmlns:opltesco="http://www.openlinksw.com/schemas/tesco#"
+    xmlns:owl="http://www.w3.org/2002/07/owl#"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
+
+    <owl:Ontology rdf:about="http://www.openlinksw.com/schemas/tesco">
+        <creator xmlns="http://purl.org/dc/elements/1.1/"
+            rdf:datatype="http://www.w3.org/2001/XMLSchema#string">OpenLink Software, http://www.openlinksw.com</creator>
+        <owl:imports rdf:resource="http://purl.org/goodrelations/v1"/>
+    </owl:Ontology>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#ASIN">
+        <rdfs:comment>Tesco Standard Item Number - an alphanumeric token that uniquely identifies items in the tesco marketplace</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>ASIN</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#BaseProductId">
+        <rdfs:comment>Tesco Base Product Id - an alphanumeric token that uniquely identifies items in the tesco marketplace</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>Base Product Id</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#hasStockKeepingUnit"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#ProductId">
+        <rdfs:comment>Tesco Product Id - an alphanumeric token that uniquely identifies items in the tesco marketplace</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>ProductId</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#hasStockKeepingUnit"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#ProductType">
+        <rdfs:comment>Tesco Product Type</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>Product Type</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#EANBarcode">
+        <rdfs:comment>EANBarcode</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>EAN Barcode</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#hasEAN_UCC-13"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#ImagePath">
+        <rdfs:comment>ImagePath</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>ImagePath</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+        <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/depiction"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#UnitPrice">
+        <rdfs:comment>UnitPrice</rdfs:comment>
+        <rdfs:domain rdf:resource="http://purl.org/goodrelations/v1#Offering"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>Unit Price</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#DetailPageURL">
+        <rdfs:comment>DetailPageURL</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>DetailPageURL</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#anyURI"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:Class rdf:about="http://www.openlinksw.com/schemas/tesco#Product">
+        <rdfs:comment>A specialization of the GoodRelations ProductOrService class for describing tesco products</rdfs:comment>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>Product</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://purl.org/goodrelations/v1#ProductOrService"/>
+    </owl:Class>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#availability">
+        <rdfs:comment>how soon is an item dispatched</rdfs:comment>
+        <rdfs:domain rdf:resource="http://purl.org/goodrelations/v1#Offering"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>availability</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#color">
+        <rdfs:comment>color</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>color</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#condition">
+        <rdfs:comment>condition of the item - new/used/refurbished</rdfs:comment>
+        <rdfs:domain rdf:resource="http://purl.org/goodrelations/v1#Offering"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>condition</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#conditionNote">
+        <rdfs:comment>notes on the condition of the item</rdfs:comment>
+        <rdfs:domain rdf:resource="http://purl.org/goodrelations/v1#Offering"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>condition note</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#feature">
+        <rdfs:comment>a description of a feature of the item</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>feature</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#hasListPrice">
+        <rdfs:comment>manufacturer's list price</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>list price</rdfs:label>
+        <rdfs:range rdf:resource="http://purl.org/goodrelations/v1#UnitPriceSpecification"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#itemHeight">
+        <rdfs:comment>the item's height</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>item height</rdfs:label>
+        <rdfs:range rdf:resource="http://purl.org/goodrelations/v1#QuantitativeValueFloat"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#itemLength">
+        <rdfs:comment>the item's length</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>item length</rdfs:label>
+        <rdfs:range rdf:resource="http://purl.org/goodrelations/v1#QuantitativeValueFloat"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#itemWeight">
+        <rdfs:comment>the item's weight</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>item weight</rdfs:label>
+        <rdfs:range rdf:resource="http://purl.org/goodrelations/v1#QuantitativeValueFloat"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#itemWidth">
+        <rdfs:comment>the item's width</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>item width</rdfs:label>
+        <rdfs:range rdf:resource="http://purl.org/goodrelations/v1#QuantitativeValueFloat"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#merchantId">
+        <rdfs:comment>tesco assigned MerchantID</rdfs:comment>
+        <rdfs:domain rdf:resource="http://purl.org/goodrelations/v1#Offering"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>merchantID</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#offerListingId">
+        <rdfs:comment>tesco assigned offer listing ID</rdfs:comment>
+        <rdfs:domain rdf:resource="http://purl.org/goodrelations/v1#Offering"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>offer listing ID</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#packageHeight">
+        <rdfs:comment>the package's height</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>package height</rdfs:label>
+        <rdfs:range rdf:resource="http://purl.org/goodrelations/v1#QuantitativeValueFloat"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#packageLength">
+        <rdfs:comment>the package's length</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>package length</rdfs:label>
+        <rdfs:range rdf:resource="http://purl.org/goodrelations/v1#QuantitativeValueFloat"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#packageWeight">
+        <rdfs:comment>the package's weight</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>package weight</rdfs:label>
+        <rdfs:range rdf:resource="http://purl.org/goodrelations/v1#QuantitativeValueFloat"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#packageWidth">
+        <rdfs:comment>the package's width</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>package width</rdfs:label>
+        <rdfs:range rdf:resource="http://purl.org/goodrelations/v1#QuantitativeValueFloat"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#datatypeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#productGroup">
+        <rdfs:comment>the product group to which the item belongs</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>product group</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#quantitativeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+
+    <owl:DatatypeProperty rdf:about="http://www.openlinksw.com/schemas/tesco#vendorSynopsisUrl">
+        <rdfs:comment>URL of brief details of tesco merchant or seller</rdfs:comment>
+        <rdfs:domain rdf:resource="http://www.openlinksw.com/schemas/tesco#Product"/>
+        <rdfs:isDefinedBy rdf:resource="http://www.openlinksw.com/schemas/tesco"/>
+        <rdfs:label>vendor synopsis URL</rdfs:label>
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#anyURI"/>
+        <rdfs:subPropertyOf rdf:resource="http://purl.org/goodrelations/v1#quantitativeProductOrServiceProperty"/>
+    </owl:DatatypeProperty>
+</rdf:RDF>
+
diff --git a/binsrc/rdf_mappers/ontologies/owl/powder-s.owl b/binsrc/rdf_mappers/ontologies/owl/powder-s.owl
new file mode 100644
index 0000000..8544a93
--- /dev/null
+++ b/binsrc/rdf_mappers/ontologies/owl/powder-s.owl
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE rdf:RDF [
+  <!ENTITY xsd     "http://www.w3.org/2001/XMLSchema#">
+  <!ENTITY rdf     "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+  <!ENTITY rdfs    "http://www.w3.org/2000/01/rdf-schema#">
+  <!ENTITY owl     "http://www.w3.org/2002/07/owl#">
+  <!ENTITY dcterms "http://purl.org/dc/terms/">
+  <!ENTITY dr      "http://www.w3.org/TR/powder-dr/">
+  <!ENTITY formal  "http://www.w3.org/TR/powder-formal/">
+  <!ENTITY wdrs    "http://www.w3.org/2007/05/powder-s#">
+]>
+
+
+<rdf:RDF xmlns:xsd     = "&xsd;"
+         xmlns:rdf     = "&rdf;"
+         xmlns:rdfs    = "&rdfs;"
+         xmlns:owl     = "&owl;"
+         xmlns:wdrs    = "&wdrs;"
+         xmlns:base    = "&wdrs;"
+         xmlns         = "http://www.w3.org/2007/05/powder-s#">
+
+   <owl:Ontology rdf:about="http://www.w3.org/2007/05/powder-s#">
+    <rdfs:label>POWDER-S Vocabulary</rdfs:label>
+    <rdfs:comment>This file specifies the set of classes and properties used in the RDF/OWL version of POWDER documents.</rdfs:comment>
+    <owl:versionInfo>8 November 2010</owl:versionInfo>
+    <owl:priorVersion rdf:resource=""/>
+  </owl:Ontology>  
+
+<!-- WDRS Classes -->  
+    
+  <rdfs:Class rdf:about="#Document">
+    <rdfs:label xml:lang="en">POWDER document</rdfs:label>
+    <rdfs:comment xml:lang="en">A POWDER document.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#structure" />
+    <rdfs:subClassOf rdf:resource="&owl;Ontology" />
+  </rdfs:Class>
+
+  <rdfs:Class rdf:about="#Processor">
+    <rdfs:label xml:lang="en">POWDER processor</rdfs:label>
+    <rdfs:comment xml:lang="en">A software agent able to process POWDER documents.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#powderprocessor" />
+    <rdfs:subClassOf rdf:resource="&dcterms;Agent" />
+  </rdfs:Class>
+
+<!-- WDRS Properties -->  
+    
+  <rdf:Property rdf:about="#text">
+    <rdf:type rdf:resource="&owl;AnnotationProperty" />
+    <rdfs:label xml:lang="en">text that may be displayed</rdfs:label>
+    <rdfs:comment xml:lang="en">This property provides a summary of the descriptorset that it annotates, suitable for display to end users.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#line13" />
+  </rdf:Property>
+  
+  <rdf:Property rdf:about="#issuedby">
+    <rdf:type rdf:resource="&owl;AnnotationProperty" />
+    <rdfs:label xml:lang="en">issued by</rdfs:label>
+    <rdfs:comment xml:lang="en">This property denotes the author of a POWDER document.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#line3" />
+  </rdf:Property>
+  
+  <rdf:Property rdf:about="#matchesregex">
+    <rdf:type rdf:resource="&owl;DatatypeProperty" />
+    <rdfs:label xml:lang="en">matches regular expression</rdfs:label>
+    <rdfs:comment xml:lang="en">This is the key 'include' property for IRI set definitions in POWDER-S. It is necessary to take account of the POWDER Semantic Extension to process this fully. The value is a regular expression that is matched against an IRI.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&formal;#regexSemantics" />
+    <rdfs:seeAlso rdf:resource="http://www.w3.org/TR/xpath-functions/#regex-syntax" />
+    <rdfs:domain rdf:resource="&rdfs;Resource" />
+    <rdfs:range rdf:resource="&xsd;string" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#notmatchesregex">
+    <rdf:type rdf:resource="&owl;DatatypeProperty" />
+    <rdfs:label xml:lang="en">matches regular expression</rdfs:label>
+    <rdfs:comment xml:lang="en">This is the key 'exclude' property for IRI set definitions in POWDER-S. It is necessary to take account of the POWDER Semantic Extension to process this fully. The value is a regular expression that is matched against an IRI.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&formal;#regexSemantics" />
+    <rdfs:seeAlso rdf:resource="http://www.w3.org/TR/xpath-functions/#regex-syntax" />
+    <rdfs:domain rdf:resource="&rdfs;Resource" />
+    <rdfs:range rdf:resource="&xsd;string" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#hasIRI">
+    <rdf:type rdf:resource="&owl;DatatypeProperty" />
+    <rdfs:label xml:lang="en">has IRI</rdfs:label>
+    <rdfs:comment xml:lang="en">This property is meant to be used in OWL2 instead of wdrs:matchesregex. It denotes the string data range corresponding to a set of IRIs.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&formal;#oxRegexSemantics" />
+    <rdfs:domain rdf:resource="&rdfs;Resource" />
+    <rdfs:range rdf:resource="&xsd;anyURI" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#tag">
+    <rdf:type rdf:resource="&owl;DatatypeProperty" />
+    <rdfs:label xml:lang="en">tag</rdfs:label>
+    <rdfs:comment xml:lang="en">Property linking to a free-text tag which may include spaces.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#tags" />
+    <rdfs:range rdf:resource="&xsd;token" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#notknownto">
+    <rdfs:label xml:lang="en">not known to</rdfs:label>
+    <rdfs:comment xml:lang="en">Property used in results returned from a POWDER Processor that has no data about the candidate resource. The value is the IRI of the processor.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#powderprocessor" />
+    <rdfs:range rdf:resource="#Processor" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#describedby">
+    <rdfs:label xml:lang="en">described by</rdfs:label>
+    <rdfs:comment xml:lang="en">An RDF property to exactly match the describedby relationship type introduced in http://www.w3.org/TR/powder-dr/#assoc-linking and formally defined in appendix D of the same document, i.e. the relationship A 'describedby' B asserts that resource B provides a description of resource A. There are no constraints on the format or representation of either A or B, neither are there any further constraints on either resource.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#semlink" />
+  </rdf:Property> 
+
+  <rdf:Property rdf:about="#authenticate">
+    <rdfs:label xml:lang="en">authenticate</rdfs:label>
+    <rdfs:comment xml:lang="en">A pointer to a document that describes how Description Resources created by a FOAF Agent or a DC Terms Agent may be authenticated</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#discover" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#validfrom">
+    <rdf:type rdf:resource="&owl;AnnotationProperty" />
+    <rdfs:label xml:lang="en">valid from</rdfs:label>
+    <rdfs:comment xml:lang="en">Provides a timestamp that a POWDER Processor may use when assessing trustworthiness of a POWDER document. Informally, a POWDER Processor should normally ignore data in the document before the given date.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#certification" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#validuntil">
+    <rdf:type rdf:resource="&owl;AnnotationProperty" />
+    <rdfs:label xml:lang="en">valid until</rdfs:label>
+    <rdfs:comment xml:lang="en">Provides a timestamp that a POWDER Processor may use when assessing trustworthiness of a POWDER document. Informally, a POWDER Processor should normally ignore data in the document after the given date.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#certification" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#logo">
+    <rdf:type rdf:resource="&owl;AnnotationProperty" />
+    <rdfs:label xml:lang="en">logo</rdfs:label>
+    <rdfs:comment xml:lang="en">Points to a graphic summary for the resources in a given class. Typically, it is a logo denoting conformance of a given (set of) resource(s) to a given set of criteria.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#line13" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#sha1sum">
+    <rdfs:label xml:lang="en">SHA-1 sum</rdfs:label>
+    <rdfs:comment xml:lang="en">Links to a Base64-encoded binary SHA-1 hash of the described resource. May be used by POWDER Processors when assessing trustworthiness of a DR.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#certification" />
+    <rdfs:range rdf:resource="&xsd;base64Binary" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#certified">
+    <rdfs:label xml:lang="en">certified</rdfs:label>
+    <rdfs:comment xml:lang="en">A property that takes a Boolean value to declare whether the author of the data certifies the described resource.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#certification" />
+    <rdfs:range rdf:resource="&xsd;boolean" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#certifiedby">
+    <rdf:type rdf:resource="&owl;AnnotationProperty" />
+    <rdfs:label xml:lang="en">certified by</rdfs:label>
+    <rdfs:comment xml:lang="en">A property that links a resource to a POWDER document that certifies it.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#certification" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#supportedby">
+    <rdf:type rdf:resource="&owl;AnnotationProperty" />
+    <rdfs:label xml:lang="en">supported by</rdfs:label>
+    <rdfs:comment xml:lang="en">A property that links a POWDER document to some other data source that supports the descriptions provided.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#supportedBy" />
+  </rdf:Property>
+
+  <rdf:Property rdf:about="#data_error">
+    <rdfs:label xml:lang="en">data error</rdfs:label>
+    <rdfs:comment xml:lang="en">A property denoting a description of the specific error found in a given POWDER document.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#ppErrorhandling" />
+    <rdfs:domain rdf:resource="#Document" />
+  </rdf:Property>
+  
+  <rdf:Property rdf:about="#proc_error">
+    <rdfs:label xml:lang="en">processing error</rdfs:label>
+    <rdfs:comment xml:lang="en">A property denoting a description of the specific software error.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#ppErrorhandling" />
+    <rdfs:domain rdf:resource="#Processor" />
+  </rdf:Property>
+  
+  <rdf:Property rdf:about="#error_code">
+    <rdfs:label xml:lang="en">error code</rdfs:label>
+    <rdfs:comment xml:lang="en">A property denoting the code of any error encountered by the POWDER processor.</rdfs:comment>
+    <rdfs:isDefinedBy rdf:resource="&dr;#ppErrorhandling" />
+    <rdfs:range rdf:resource="&xsd;nonNegativeInteger" />
+  </rdf:Property>
+  
+</rdf:RDF>
diff --git a/binsrc/rdf_mappers/ontologies/xbrl/leh.owl b/binsrc/rdf_mappers/ontologies/xbrl/leh.owl
old mode 100755
new mode 100644
diff --git a/binsrc/rdf_mappers/ontologies/xbrl/xbrl.owl b/binsrc/rdf_mappers/ontologies/xbrl/xbrl.owl
old mode 100755
new mode 100644
diff --git a/binsrc/rdf_mappers/ontologies/xbrl/xrx.owl b/binsrc/rdf_mappers/ontologies/xbrl/xrx.owl
old mode 100755
new mode 100644
diff --git a/binsrc/rdf_mappers/rdf_mappers.sql b/binsrc/rdf_mappers/rdf_mappers.sql
index cf4b37a..ff996c7 100644
--- a/binsrc/rdf_mappers/rdf_mappers.sql
+++ b/binsrc/rdf_mappers/rdf_mappers.sql
@@ -1,6 +1,6 @@
 --
 --
---  $Id: rdf_mappers.sql,v 1.165.2.85 2010/07/08 13:41:52 source Exp $
+--  $Id: rdf_mappers.sql,v 1.165.2.114 2011/03/29 22:52:22 source Exp $
 --
 --  RDF Mappings
 --
@@ -39,6 +39,10 @@ insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DES
     'URL', 'DB.DBA.RDF_LOAD_OREILLY', null, 'Oreilly');
 
 insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
+    values ('http://books.google.com/.*',
+    'URL', 'DB.DBA.RDF_LOAD_GOOGLE_BOOK', null, 'Google Book');
+
+insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
     values ('http://.*etsy.com/.*',
     'URL', 'DB.DBA.RDF_LOAD_ETSY', null, 'Etsy');
 
@@ -54,6 +58,10 @@ insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DES
     'URL', 'DB.DBA.RDF_LOAD_WINE', null, 'Wine');
 
 insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
+    values ('http://www.evri.com/.*',
+    'URL', 'DB.DBA.RDF_LOAD_EVRI', null, 'Evri');
+
+insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
     values ('http://.*tumblr.com/.*',
     'URL', 'DB.DBA.RDF_LOAD_TUMBLR', null, 'Tumblr');
 
@@ -75,8 +83,9 @@ insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DES
     '(https://docs.google.com/.*)',
     'URL', 'DB.DBA.RDF_LOAD_GOOGLE_DOCUMENT', null, 'Google (Documents)');
 
-insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION, RM_ENABLED)
-	values ('.*', 'HTTP', 'DB.DBA.RDF_LOAD_HTTP_SESSION', null, 'HTTP in RDF', 0);
+--insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION, RM_ENABLED)
+--	values ('.*', 'HTTP', 'DB.DBA.RDF_LOAD_HTTP_SESSION', null, 'HTTP in RDF', 0);
+delete from DB.DBA.SYS_RDF_MAPPERS where RM_HOOK = 'DB.DBA.RDF_LOAD_HTTP_SESSION';
 
 insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
 	values ('.*', 'URL', 'DB.DBA.RDF_LOAD_FACEBOOK_OPENGRAPH_SELECTION', null, 'Facebook Open Graph');
@@ -109,6 +118,10 @@ insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DES
 	'URL', 'DB.DBA.RDF_LOAD_BESTBUY', null, 'BestBuy articles');
 
 insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
+	values ('http://.*productwiki.com/.*',
+	'URL', 'DB.DBA.RDF_LOAD_PRODUCTWIKI', null, 'Product Wiki articles');
+
+insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
 	values ('(http://.*amazon.[^/]+/gp/product/.*)|'||
 	'(http://.*amazon.[^/]+/o/ASIN/.*)|'||
 	'(http://.*amazon.[^/]+/[^/]+/dp/[^/]+(/.*)?)|'||
@@ -128,6 +141,18 @@ insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DES
 	'URL', 'DB.DBA.RDF_LOAD_VIMEO', null, 'Vimeo');
 	
 insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
+	values ('(http://rdfohloh.wikier.org/.*)',
+	'URL', 'DB.DBA.RDF_LOAD_OHLOH', null, 'Ohloh');
+
+insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
+	values ('(http://www.groupon.com/.*)',
+	'URL', 'DB.DBA.RDF_LOAD_GROUPON', null, 'Groupon');
+	
+insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
+	values ('(http://www.eol.org/.*)',
+	'URL', 'DB.DBA.RDF_LOAD_EOL', null, 'Eol');
+
+insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
 	values ('(http://delicious.com/.*)|(http://feeds.delicious.com/.*)',
 	'URL', 'DB.DBA.RDF_LOAD_DELICIOUS', null, 'Delicious');
 
@@ -247,7 +272,7 @@ insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DES
 	values ('.+\\.csv\x24', 'URL', 'DB.DBA.RDF_LOAD_CSV', null, 'CSV');
         
 insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
-	values ('(http://cgi.sandbox.ebay.com/.*&item=[A-Z0-9]*&.*)|(http://cgi.ebay.com/.*QQitemZ[A-Z0-9]*QQ.*)',
+	values ('(http://cgi.sandbox.ebay.com/.*)|(http://cgi.ebay.com/.*)',
 	'URL', 'DB.DBA.RDF_LOAD_EBAY_ARTICLE', null, 'eBay articles');
 
 insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
@@ -316,6 +341,9 @@ update DB.DBA.SYS_RDF_MAPPERS set RM_PATTERN =
     '(http://reviews.cnet.com/.*)'
     where RM_HOOK = 'DB.DBA.RDF_LOAD_CNET';
 
+update DB.DBA.SYS_RDF_MAPPERS set RM_PATTERN = '(http://cgi.sandbox.ebay.com/.*)|(http://cgi.ebay.com/.*)'
+    where RM_HOOK = 'DB.DBA.RDF_LOAD_EBAY_ARTICLE';
+
 update DB.DBA.SYS_RDF_MAPPERS set RM_PATTERN =
 	'(http://.*amazon.[^/]+/gp/product/.*)|'||
 	'(http://.*amazon.[^/]+/o/ASIN/.*)|'||
@@ -328,6 +356,22 @@ update DB.DBA.SYS_RDF_MAPPERS set RM_PATTERN =
 	'(http://.*amazon.[^/]+/exec/obidos/tg/detail/-/[^/]+/.*)'
 	where RM_HOOK = 'DB.DBA.RDF_LOAD_AMAZON_ARTICLE';
 
+update DB.DBA.SYS_RDF_MAPPERS 
+	set RM_PATTERN = 'http://.*delicious.com/.*'
+	where RM_HOOK = 'DB.DBA.RDF_LOAD_DELICIOUS';
+
+insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
+	values ('http://(www\\.)?overstock.com/.*\\.(html|htm)(\\?.*)?',
+	'URL', 'DB.DBA.RDF_LOAD_OVERSTOCK', null, 'Overstock');
+
+insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
+	values ('http://www.csnstores.com/.*|http://www.bifter.co.uk/.*|http://www.hingly.com/.*|http://www.gnoss.com/.*',
+	'URL', 'DB.DBA.RDF_LOAD_RDFA_CARTRIDGE', null, 'RDFa');
+
+insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION, RM_ENABLED)
+	values ('text/html',
+	'MIME', 'DB.DBA.RDF_LOAD_RDFA_NP_CARTRIDGE', null, 'RDFa (no translation)', 0);
+
 -- migration from old servers
 create procedure DB.DBA.RM_MAPPERS_UPGRADE ()
 {
@@ -487,12 +531,12 @@ create procedure DB.DBA.RM_MAPPERS_SET_ORDER ()
 	 }
      }
 
-   http := (select RM_PID from DB.DBA.SYS_RDF_MAPPERS where RM_HOOK = 'DB.DBA.RDF_LOAD_HTTP_SESSION');
+   --http := (select RM_PID from DB.DBA.SYS_RDF_MAPPERS where RM_HOOK = 'DB.DBA.RDF_LOAD_HTTP_SESSION');
    html := (select RM_PID from DB.DBA.SYS_RDF_MAPPERS where RM_HOOK = 'DB.DBA.RDF_LOAD_HTML_RESPONSE');
    feed := (select RM_PID from DB.DBA.SYS_RDF_MAPPERS where RM_HOOK = 'DB.DBA.RDF_LOAD_FEED_RESPONSE');
    fb_og := (select RM_PID from DB.DBA.SYS_RDF_MAPPERS where RM_HOOK = 'DB.DBA.RDF_LOAD_FACEBOOK_OPENGRAPH_SELECTION');
 --   calais := (select RM_PID from DB.DBA.SYS_RDF_MAPPERS where RM_HOOK = 'DB.DBA.RDF_LOAD_CALAIS');
-   top_arr := vector (http, html, feed, fb_og);
+   top_arr := vector (html, feed, fb_og);
 
    arr := (select DB.DBA.VECTOR_AGG (RM_PID) from DB.DBA.SYS_RDF_MAPPERS  where 0 = position (RM_PID, top_arr) order by RM_ID);
    inx := 1;
@@ -607,6 +651,10 @@ insert replacing DB.DBA.SYS_GRDDL_MAPPING (GM_NAME, GM_PROFILE, GM_XSLT)
 ;
 
 insert replacing DB.DBA.SYS_GRDDL_MAPPING (GM_NAME, GM_PROFILE, GM_XSLT)
+    values ('hRecipe ', 'http://microformats.org/wiki/hrecipe', registry_get ('_rdf_mappers_path_') || 'xslt/main/hrecipe2rdf.xsl')
+;
+
+insert replacing DB.DBA.SYS_GRDDL_MAPPING (GM_NAME, GM_PROFILE, GM_XSLT)
     values ('hAudio', 'http://purl.org/weborganics/mo-haudio', registry_get ('_rdf_mappers_path_') || 'xslt/main/haudio2rdf.xsl')
 ;
 
@@ -619,7 +667,15 @@ insert replacing DB.DBA.SYS_GRDDL_MAPPING (GM_NAME, GM_PROFILE, GM_XSLT)
 ;
 
 insert replacing DB.DBA.SYS_GRDDL_MAPPING (GM_NAME, GM_PROFILE, GM_XSLT)
-    values ('hReview', 'http://dannyayers.com/micromodels/profiles/hreview', registry_get ('_rdf_mappers_path_') || 'xslt/main/hreview2rdf.xsl')
+    values ('hReview', 'http://microformats.org/wiki/hreview', registry_get ('_rdf_mappers_path_') || 'xslt/main/hreview2rdf.xsl')
+;
+
+insert replacing DB.DBA.SYS_GRDDL_MAPPING (GM_NAME, GM_PROFILE, GM_XSLT)
+    values ('hReview-aggregate', 'http://microformats.org/wiki/hreview-aggregate', registry_get ('_rdf_mappers_path_') || 'xslt/main/hreview_aggregate2rdf.xsl')
+;
+
+insert replacing DB.DBA.SYS_GRDDL_MAPPING (GM_NAME, GM_PROFILE, GM_XSLT)
+    values ('hNews', 'http://microformats.org/wiki/hnews', registry_get ('_rdf_mappers_path_') || 'xslt/main/hnews2rdf.xsl')
 ;
 
 insert replacing DB.DBA.SYS_GRDDL_MAPPING (GM_NAME, GM_PROFILE, GM_XSLT)
@@ -683,7 +739,6 @@ create procedure DB.DBA.RM_XLAT_CONCAT (in x any, in y any)
   if (registry_get ('__rdf_cartridges_original_doc_uri__') = '1')
     return x;
   return DB.DBA.RDF_PROXY_ENTITY_IRI(x);
-  --return DB.DBA.RDF_SPONGE_PROXY_IRI (x);
 }
 ;
 
@@ -709,9 +764,9 @@ create procedure DB.DBA.RM_RDF_SPONGE_ERROR (in pname varchar, in graph_iri varc
 ;
 
 -- helper procedures
-create procedure DB.DBA.RM_RDF_LOAD_RDFXML (in strg varchar, in base varchar, in graph varchar, in doc_iri_flag int := 1)
+create procedure DB.DBA.RM_RDF_LOAD_RDFXML (in strg varchar, in base varchar, in graph varchar, in doc_iri_flag int := 1, in long_str int := 0)
 {
-  declare nss, ses any;
+  declare nss, ses, dict, triples, ntriples any;
   nss := xmlnss_get (xtree_doc (strg));
   ses := string_output ();
   http ('@prefix opl: <http://www.openlinksw.com/schema/attribution#> .\n', ses);
@@ -723,12 +778,76 @@ create procedure DB.DBA.RM_RDF_LOAD_RDFXML (in strg varchar, in base varchar, in
       http (sprintf ('<%s> opl:isDescribedUsing <%s> .\n', case when doc_iri_flag then RDF_SPONGE_PROXY_IRI (graph) else graph end, nss[i+1]), ses);
       http (sprintf ('<%s> opl:hasNamespacePrefix "%s" .\n', nss[i+1], nss[i]), ses);
     }
+  if (long_str = 0)
+    {
+      dict := DB.DBA.RDF_RDFXML_TO_DICT (strg, base, graph);
+      triples := dict_list_keys (dict, 1);
+      DB.DBA.RDF_INSERT_TRIPLES (graph, triples);
+      ntriples := vector ();
+      foreach (any trip in triples) do
+	{
+	  if (trip[1] = iri_to_id ('http://xmlns.com/foaf/0.1/primaryTopic') or trip[1] = iri_to_id ('http://xmlns.com/foaf/0.1/topic'))
+	    {
+	      ntriples := vector_concat (ntriples, vector (vector (trip[2], iri_to_id ('http://www.w3.org/2007/05/powder-s#describedby'), trip[0])));
+	    }
+	}
+      DB.DBA.RDF_INSERT_TRIPLES (graph, ntriples);
+    }
+  else
+    {
   DB.DBA.RDF_LOAD_RDFXML (strg, base, graph);
+    }
   -- INFO: may be this should be done when primaryTopic is set
   DB.DBA.TTLP (ses, base, graph);
 }
 ;
 
+create procedure DB.DBA.RM_ADD_PRV (in proc varchar, in base varchar, in graph varchar, in service_url varchar)
+{
+  declare ses, iri, h any;
+
+  if (registry_get ('__rdf_cartridges_original_doc_uri__') = '1')
+    return;
+  if (not isstring (service_url))
+    service_url := base;
+  if (length (service_url) > 1500)
+    return;  
+  h := rfc1808_parse_uri (service_url);
+  h [3] := ''; h [4] := ''; h [5] := '';
+  service_url := DB.DBA.vspx_uri_compose (h);
+  proc := cast (proc as varchar);
+  ses := string_output ();
+  iri := lower (name_part (proc, 2));
+  http('<rdf:RDF xmlns:rdfg="http://www.w3.org/2004/03/trix/rdfg-1/" xmlns:spo="http://www.openlinksw.com/schemas/sponger/" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:doap="http://usefulinc.com/ns/doap#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:prv="http://purl.org/net/provenance/ns#" xmlns:prvTypes="http://purl.org/net/provenance/types#">', ses);
+  http('    <prv:DataCreation rdf:ID="DataCreation">', ses);
+  http(sprintf ('	<prv:usedData rdf:resource="#%V"/>', iri), ses);
+  http('    </prv:DataCreation>', ses);
+  http(sprintf ('    <prv:DataItem rdf:ID="%V">', iri), ses);
+  http('	<rdf:type rdf:resource="http://purl.org/net/provenance/types#QueryResult" />', ses);
+  http('	<rdf:type rdf:resource="http://www.w3.org/2004/03/trix/rdfg-1/Graph" />', ses);
+  http('	<prv:retrievedBy>', ses);
+  http('	    <prv:DataAccess>', ses);
+  http('		<prv:performedAt rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">', ses);
+  http(sprintf ('		    %s', date_iso8601 (now())), ses);
+  http('		</prv:performedAt>', ses);
+  http('		<prv:performedBy rdf:resource="#spongerInstance" />', ses);
+  http(sprintf ('		<prv:accessedService rdf:resource="%V" />', service_url), ses);
+  http('	    </prv:DataAccess>', ses);
+  http('	</prv:retrievedBy>', ses);
+  http('    </prv:DataItem>', ses);
+  http('</rdf:RDF>', ses);
+  DB.DBA.RDF_LOAD_RDFXML (ses, DB.DBA.RDF_SPONGE_PROXY_IRI (base), graph);
+}
+;
+
+create procedure RM_CLEAN_DEST (in dest varchar, in graph_iri varchar, in new_origin_uri varchar, inout opts any)
+{
+  if (get_keyword ('disable-clean', opts, '') = 'Y')
+    return;
+  DB.DBA.SPARUL_CLEAR (coalesce (dest, graph_iri), 1, 0);
+}
+;
+
 create procedure DB.DBA.RM_UMBEL_GET (in strg varchar)
 {
   declare data, meta any;
@@ -798,6 +917,30 @@ create procedure DB.DBA.XSLT_STRING2ISO_DATE2 (in val varchar)
 }
 ;
 
+create procedure DB.DBA.XSLT_STRING2ISO_DATE3 (in val varchar)
+{
+  declare ret, tmp any;
+  if (val is null)
+    return null;
+  tmp := sprintf_inverse (val, '%sT%s', 0);
+  if (length(tmp) > 1)
+	{
+	if (length(tmp[0]) = 8 and length(tmp[1]) = 6)	
+		{
+		tmp := left(val, 13);
+		ret := stringdate(tmp);
+		tmp := atoi(right(val, 2));
+		ret := dateadd('second', tmp, ret);
+		}
+		else
+		return val;
+	ret := date_iso8601 (ret);
+    if (ret is not null)
+		return ret;
+	}
+  return val;
+}
+;
 
 create procedure DB.DBA.XSLT_STRING2ISO_DATE (in val varchar)
 {
@@ -945,6 +1088,14 @@ create procedure DB.DBA.RM_SPONGE_DOC_IRI (in url varchar, in frag varchar := 't
 }
 ;
 
+create procedure DB.DBA.RDF_SPONGE_IRI_SCH ()
+{
+  if (is_https_ctx ())
+    return 'https';
+  return 'http';
+}
+;
+
 --
 -- # this is used to make proxy IRI of the document
 --
@@ -972,9 +1123,9 @@ create procedure DB.DBA.RDF_SPONGE_PROXY_IRI (in uri varchar := '', in login var
   uri := ltrim (uri, '/');
 
   if (length (login))
-    ret := sprintf ('http://%s/about/rdf/%s/%U/%s%s', cname, url_sch, login, uri, frag);
+    ret := sprintf ('%s://%s/about/rdf/%s/%U/%s%s', RDF_SPONGE_IRI_SCH (), cname, url_sch, login, uri, frag);
   else
-    ret := sprintf ('http://%s/about/id/%s/%s%s', cname, url_sch, uri, frag);
+    ret := sprintf ('%s://%s/about/id/%s/%s%s', RDF_SPONGE_IRI_SCH (), cname, url_sch, uri, frag);
   return ret;
 }
 ;
@@ -1028,7 +1179,7 @@ create procedure DB.DBA.RDF_PROXY_ENTITY_IRI (in uri varchar := '', in login var
   uri := vspx_uri_compose (ua);
   uri := ltrim (uri, '/');
 
-  ret := sprintf ('http://%s/about/id/entity/%s/%s%s', cname, url_sch, uri, frag);
+  ret := sprintf ('%s://%s/about/id/entity/%s/%s%s', RDF_SPONGE_IRI_SCH (), cname, url_sch, uri, frag);
   return ret;
 }
 ;
@@ -1103,6 +1254,21 @@ create procedure DB.DBA.RDF_SPONGE_GET_COUNTRY_NAME (in code varchar)
 }
 ;
 
+create procedure DB.DBA.RDF_CONVERT_TO_XTREE (in code varchar)
+{
+	declare tmp any;
+	declare pos int;
+	tmp := code;
+	pos := strstr(cast(tmp as varchar), '<ul>');
+	if (pos > 0)
+		tmp := subseq(tmp, pos);
+	else
+		tmp := '<ul/>';
+	tmp:= xtree_doc(tmp);
+	return tmp;
+}
+;
+
 create procedure DB.DBA.RDF_SPONGE_DBP_IRI (in base varchar, in word varchar)
 {
   declare res, xp, xt, url varchar;
@@ -1426,6 +1592,7 @@ grant execute on DB.DBA.XSLT_STR2DATE to public;
 grant execute on DB.DBA.XSLT_HTTP_STRING_DATE to public;
 grant execute on DB.DBA.XSLT_STRING2ISO_DATE to public;
 grant execute on DB.DBA.XSLT_STRING2ISO_DATE2 to public;
+grant execute on DB.DBA.XSLT_STRING2ISO_DATE3 to public;
 grant execute on DB.DBA.RDF_SPONGE_PROXY_IRI to public;
 grant execute on DB.DBA.RDF_PROXY_ENTITY_IRI to public;
 grant execute on DB.DBA.RM_SPONGE_DOC_IRI to public;
@@ -1443,6 +1610,7 @@ grant execute on DB.DBA.GET_XBRL_NAME_BY_CIK to public;
 grant execute on DB.DBA.GET_XBRL_CANONICAL_DATATYPE to public;
 grant execute on DB.DBA.RDF_SPONGE_URI_HASH to public;
 grant execute on DB.DBA.RDF_SPONGE_GET_COUNTRY_NAME to public;
+grant execute on DB.DBA.RDF_CONVERT_TO_XTREE to public;
 
 xpf_extension_remove ('http://www.openlinksw.com/virtuoso/xslt:getNameByCIK');
 xpf_extension ('http://www.openlinksw.com/virtuoso/xslt:xbrl_canonical_datatype', fix_identifier_case ('DB.DBA.GET_XBRL_CANONICAL_DATATYPE'));
@@ -1463,6 +1631,7 @@ xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:str2date', 'DB.DBA.XSLT
 xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:escape', 'DB.DBA.XSLT_ESCAPE');
 xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:string2date', 'DB.DBA.XSLT_STRING2ISO_DATE');
 xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:string2date2', 'DB.DBA.XSLT_STRING2ISO_DATE2');
+xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:string2date3', 'DB.DBA.XSLT_STRING2ISO_DATE3');
 xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:proxyIRI', 'DB.DBA.RDF_PROXY_ENTITY_IRI');
 xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:docproxyIRI', 'DB.DBA.RDF_SPONGE_PROXY_IRI');
 xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:dbpIRI', 'DB.DBA.RDF_SPONGE_DBP_IRI');
@@ -1473,6 +1642,7 @@ xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:sasIRI', 'DB.DBA.RM_SAM
 xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:docIRI', 'DB.DBA.RM_SPONGE_DOC_IRI');
 xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:http_string_date', 'DB.DBA.XSLT_HTTP_STRING_DATE');
 xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:uri_hash', 'DB.DBA.RDF_SPONGE_URI_HASH');
+xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:convert_to_xtree', 'DB.DBA.RDF_CONVERT_TO_XTREE');
 
 create procedure DB.DBA.RDF_MAPPER_XSLT (in xslt varchar, inout xt any, in params any := null)
 {
@@ -1526,6 +1696,7 @@ create procedure DB.DBA.RDF_APERTURE_INIT ()
   xd := replace (xd, \'file:\'||tmp, new_origin_uri);
   xd := replace (xd, \'urn:uuid:\', new_origin_uri||\'/\');
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), \'urn:org.semanticdesktop.aperture\');
   return 1;
 }');
 
@@ -1542,116 +1713,6 @@ RDF_APERTURE_INIT ()
 
 -- cartridges
 
-create procedure DB.DBA.RDF_LOAD_HTTP_SESSION (
-    in graph_iri varchar,
-    in new_origin_uri varchar,
-    in dest varchar,
-    inout ret_body any,
-    inout aq any, inout ps any,
-    inout headers any,
-    inout opts any)
-{
-  declare req, resp any;
-  declare ses, tmp any;
-
-  declare meth, host, url, proto_ver, stat, resp_ver any;
-
-  ses := string_output ();
-  req := headers[0];
-  resp := headers[1];
-
-  host := http_request_header (req, 'Host');
-
-  tmp := split_and_decode (req[0], 0, '\0\0 ');
-  meth := tmp[0];
-  meth := lower (meth);
-  meth[0] := meth[0] - 32;
-
-  url := tmp[1];
-  proto_ver := substring (tmp[2], 6, 8);
-
-  tmp := rtrim (resp[0], '\r\n');
-  tmp := split_and_decode (resp[0], 0, '\0\0 ');
-  stat := tmp[1];
-  resp_ver := substring (tmp[0], 6, 8);
-
-  http ('<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:http="http://www.w3.org/2006/http#">\n', ses);
-
-  http ('<http:Connection rdf:ID="conn">\n', ses);
-  http ('  <http:connectionAuthority>'|| host ||'</http:connectionAuthority>\n', ses);
-  http ('    <http:request>\n', ses);
-  http ('    <http:Request rdf:about="#req0"/>\n', ses);
-  http ('  </http:request>\n', ses);
-  http ('</http:Connection>\n', ses);
-
-  http ('<http:'|| meth ||'Request rdf:ID="req0">\n', ses);
-  http (sprintf ('     <http:requestURI rdf:resource="%V"/>\n', DB.DBA.RM_SPONGE_DOC_IRI (new_origin_uri)), ses);
-  http ('  <http:abs_path>'|| url ||'</http:abs_path>\n', ses);
-  http ('  <http:version>'|| proto_ver ||'</http:version>\n', ses);
-  http ('  <http:header rdf:parseType="Collection">\n', ses);
-  -- loop over req from 1 - len
-  tmp := '';
-  for (declare i int, i := 1; i < length (req); i := i + 1)
-    {
-      tmp := tmp || trim (req[i], '\r\n') || '\r\n' ;
-    }
-  tmp := mime_tree (tmp);
-  tmp := tmp[0];
-  for (declare i int, i := 0; i < length (tmp); i := i + 2)
-    {
-      http ('<http:MessageHeader>\n', ses);
-      http ('  <http:fieldName rdf:resource="http://www.w3.org/2006/http-header#'||lower (tmp[i])||'"/>\n', ses);
-      http ('  <http:fieldValue>\n', ses);
-      http ('    <http:HeaderElement>\n', ses);
-      http ('     <http:elementName>'||tmp[i+1]||'</http:elementName>\n', ses);
-      http ('    </http:HeaderElement>\n', ses);
-      http ('  </http:fieldValue>\n', ses);
-      http ('</http:MessageHeader>\n', ses);
-    }
-
-
-  http ('  </http:header>\n', ses);
-  http ('  <http:response rdf:resource="#resp0"/>\n', ses);
-  http ('</http:'|| meth ||'Request>\n', ses);
-
-  http ('<http:Response rdf:ID="resp0">\n', ses);
-  http ('<http:responseCode rdf:resource="http://www.w3.org/2006/http#'||stat||'"/>\n', ses);
-  http ('  <http:version>'||resp_ver||'</http:version>\n', ses);
-  http ('  <http:header rdf:parseType="Collection">\n', ses);
-  -- loop over resp from 1 - len
-
-  tmp := '';
-  for (declare i int, i := 1; i < length (resp); i := i + 1)
-    {
-      tmp := tmp || trim (resp[i], '\r\n') || '\r\n' ;
-    }
-  tmp := mime_tree (tmp);
-  tmp := tmp[0];
-  for (declare i int, i := 0; i < length (tmp); i := i + 2)
-    {
-      http ('<http:MessageHeader>\n', ses);
-      http ('  <http:fieldName rdf:resource="http://www.w3.org/2006/http-header#'||lower (tmp[i])||'"/>\n', ses);
-      http ('  <http:fieldValue>\n', ses);
-      http ('    <http:HeaderElement>\n', ses);
-      http ('     <http:elementName>'||tmp[i+1]||'</http:elementName>\n', ses);
-      http ('    </http:HeaderElement>\n', ses);
-      http ('  </http:fieldValue>\n', ses);
-      http ('</http:MessageHeader>\n', ses);
-    }
-
-  http ('  </http:header>\n', ses);
-  http ('</http:Response>\n', ses);
-  http ('</rdf:RDF>\n', ses);
-
-  tmp := string_output_string (ses);
-
-  DB.DBA.RM_RDF_LOAD_RDFXML (tmp, new_origin_uri, coalesce (dest, graph_iri));
-
-  -- never stop the rest of handlers
-  return 0;
-}
-;
-
 create procedure FB_SIG (in params any, in secret any)
 {
   declare arr, pars, str any;
@@ -2056,11 +2117,12 @@ create procedure DB.DBA.RDF_LOAD_SALESFORCE(in graph_iri varchar, in new_origin_
 			'ids', id),
 		target_namespace=>'urn:enterprise.soap.sforce.com',
 		style=>21));
-	delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/sf2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (new_origin_uri)));
 	xd := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), 'https://www.salesforce.com/services/Soap/c/14.0');
 	return 1;
 }
 ;
@@ -2080,8 +2142,9 @@ create procedure DB.DBA.RDF_LOAD_TWITTER2(in url varchar, in id varchar, in new_
 		return 0;
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/twitter2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (new_origin_uri), 'id', id, 'what', what_));
 	xd := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -2108,7 +2171,7 @@ create procedure DB.DBA.RDF_LOAD_TWITTER(in graph_iri varchar, in new_origin_uri
 	if (new_origin_uri like 'http://search.twitter.com/search/thread/%')
 	{
 		url := concat(new_origin_uri, '.atom');
-		delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+		RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 		what_ := 'thread2';
 		DB.DBA.RDF_LOAD_TWITTER2(url, id, new_origin_uri, dest, graph_iri, username_, password_, what_, opts);
 		return 1;
@@ -2120,7 +2183,7 @@ create procedure DB.DBA.RDF_LOAD_TWITTER(in graph_iri varchar, in new_origin_uri
 		if (post is null)
 			return 0;
 		url := sprintf('http://search.twitter.com/search.atom?q=%s', post);
-		delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+		RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 		what_ := 'thread1';
 		DB.DBA.RDF_LOAD_TWITTER2(url, id, new_origin_uri, dest, graph_iri, username_, password_, what_, opts);
 		return 1;
@@ -2133,7 +2196,7 @@ create procedure DB.DBA.RDF_LOAD_TWITTER(in graph_iri varchar, in new_origin_uri
 		if (id is null or post is null)
 			return 0;
 
-		delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+		RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 
 		what_ := 'thread2';
 		url := sprintf('http://search.twitter.com/search/thread/%s.atom', post);
@@ -2153,7 +2216,7 @@ create procedure DB.DBA.RDF_LOAD_TWITTER(in graph_iri varchar, in new_origin_uri
 		if (id is null or post is null)
 			return 0;
 
-		delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+		RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 
 		what_ := 'thread2';
 		url := sprintf('http://search.twitter.com/search/thread/%s.atom', post);
@@ -2207,7 +2270,7 @@ create procedure DB.DBA.RDF_LOAD_TWITTER(in graph_iri varchar, in new_origin_uri
 		return 0;
 
 	friends_and_followers: ;
-	delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	page := 1;
 	while (page > 0 and page < res_count)
 	{
@@ -2373,7 +2436,7 @@ create procedure DB.DBA.RDF_LOAD_GETSATISFATION(in graph_iri varchar, in new_ori
 	else
 		return 0;
 	tmp := http_client(url, proxy=>get_keyword_ucase ('get:proxy', opts));
-	delete from DB.DBA.RDF_QUAD where g =  iri_to_id(base_uri);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	if (what_ = 'topics')
 	{
 		xd := xtree_doc (tmp);
@@ -2388,8 +2451,9 @@ create procedure DB.DBA.RDF_LOAD_GETSATISFATION(in graph_iri varchar, in new_ori
 			vector ('baseUri', RDF_SPONGE_DOC_IRI (base_uri), 'what', what_));
 	}
 	xd := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+        RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, base_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -2405,12 +2469,108 @@ create procedure DB.DBA.RDF_LOAD_GOOGLEBASE (in graph_iri varchar, in new_origin
   xd := xtree_doc (_ret_body);
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/googlebase2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
   return 1;
 }
 ;
 
+create procedure DB.DBA.RDF_LOAD_OVERSTOCK (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
+    inout ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
+{
+  declare thisgr, cont varchar;
+
+  thisgr := coalesce (dest, graph_iri);
+  declare exit handler for sqlstate '*'
+    {
+      DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE); 	
+      return 0;
+    };
+  ret_body := replace (ret_body, '= \'<script', '= \'<scr\' + \'ipt');
+  --ret_body := replace (ret_body, '[url]', '{url}');
+  --ret_body := replace (ret_body, '[title]', '{title}');
+  cont := tidy_html (ret_body, 'output-xhtml:1\r\ninput-xml:1');
+  --string_to_file ('over.html', cont, -2);
+  if (dest is null)
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
+  DB.DBA.RDF_LOAD_RDFA (cont, new_origin_uri, thisgr, 2);
+  --DB.DBA.RDF_QUAD_URI (thisgr, new_origin_uri, 'http://xmlns.com/foaf/0.1/primaryTopic', new_origin_uri || '#product');
+  return 1;
+}
+;
+
+create procedure DB.DBA.RDF_LOAD_RDFA_CARTRIDGE (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
+    inout ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
+{
+  declare thisgr, cont varchar;
+
+  thisgr := coalesce (dest, graph_iri);
+  declare exit handler for sqlstate '*'
+    {
+      DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE); 	
+      return 0;
+    };
+  if (get_keyword ('use_tidy', opts) = 'yes') 
+    cont := tidy_html (ret_body, 'output-xhtml:1\r\ninput-xml:1');
+  else  
+    cont := ret_body;
+  if (dest is null)
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
+  {
+    declare exit handler for sqlstate '*';
+    DB.DBA.RDF_LOAD_RDFA_1 (cont, new_origin_uri, thisgr, 0);
+    goto rdfa_end;
+  }
+  {
+    declare exit handler for sqlstate '*';
+    DB.DBA.RDF_LOAD_RDFA_1 (cont, new_origin_uri, thisgr, 1);
+    goto rdfa_end;
+  }
+  {
+    declare exit handler for sqlstate '*';
+    DB.DBA.RDF_LOAD_RDFA_1 (cont, new_origin_uri, thisgr, 2);
+    rdfa_end:;
+  }
+ return 1;
+}
+;
+
+create procedure DB.DBA.RDF_LOAD_RDFA_NP_CARTRIDGE (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
+    inout ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
+{
+  declare thisgr, cont varchar;
+
+  thisgr := coalesce (dest, graph_iri);
+  declare exit handler for sqlstate '*'
+    {
+      DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE); 	
+      return 0;
+    };
+  if (get_keyword ('use_tidy', opts) = 'yes') 
+    cont := tidy_html (ret_body, 'output-xhtml:1\r\ninput-xml:1');
+  else  
+    cont := ret_body;
+  if (dest is null)
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
+  {
+    declare exit handler for sqlstate '*';
+    DB.DBA.RDF_LOAD_RDFA (cont, new_origin_uri, thisgr, 0);
+    goto rdfa_end;
+  }
+  {
+    declare exit handler for sqlstate '*';
+    DB.DBA.RDF_LOAD_RDFA (cont, new_origin_uri, thisgr, 1);
+    goto rdfa_end;
+  }
+  {
+    declare exit handler for sqlstate '*';
+    DB.DBA.RDF_LOAD_RDFA (cont, new_origin_uri, thisgr, 2);
+    rdfa_end:;
+  }
+ return 1;
+}
+;
+
 create procedure DB.DBA.RDF_LOAD_CRUNCHBASE(in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
     inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
 {
@@ -2428,7 +2588,8 @@ create procedure DB.DBA.RDF_LOAD_CRUNCHBASE(in graph_iri varchar, in new_origin_
   is_search := 0;
   if (new_origin_uri like 'http://www.crunchbase.com/search?query=%')
     {
-      cnt := http_client_ext ('http://api.crunchbase.com/v/1/search.js?query=' || subseq (new_origin_uri, 39),
+      url := 'http://api.crunchbase.com/v/1/search.js?query=' || subseq (new_origin_uri, 39);
+      cnt := http_client_ext (url, 
       		headers=>hdr,
       		proxy=>get_keyword_ucase ('get:proxy', opts));
       base := 'http://www.crunchbase.com/';
@@ -2437,7 +2598,8 @@ create procedure DB.DBA.RDF_LOAD_CRUNCHBASE(in graph_iri varchar, in new_origin_
     }
   else if (new_origin_uri like 'http://www.crunchbase.com/%')
     {
-      cnt := http_client_ext ('http://api.crunchbase.com/v/1/' || subseq (new_origin_uri, 26) || '.js',
+      url := 'http://api.crunchbase.com/v/1/' || subseq (new_origin_uri, 26) || '.js';
+      cnt := http_client_ext (url, 
       		headers=>hdr,
       		proxy=>get_keyword_ucase ('get:proxy', opts));
       base := 'http://www.crunchbase.com/';
@@ -2445,7 +2607,8 @@ create procedure DB.DBA.RDF_LOAD_CRUNCHBASE(in graph_iri varchar, in new_origin_
     }
   else if (new_origin_uri like 'http://crunchbase.com/%')
     {
-      cnt := http_client_ext ('http://api.crunchbase.com/v/1/' || subseq (new_origin_uri, 22) || '.js',
+      url := 'http://api.crunchbase.com/v/1/' || subseq (new_origin_uri, 22) || '.js';
+      cnt := http_client_ext (url, 
       		headers=>hdr,
       		proxy=>get_keyword_ucase ('get:proxy', opts));
       base := 'http://www.crunchbase.com/';
@@ -2455,6 +2618,7 @@ create procedure DB.DBA.RDF_LOAD_CRUNCHBASE(in graph_iri varchar, in new_origin_
     {
       cnt := _ret_body;
       base := 'http://api.crunchbase.com/v/1/';
+      url := base;
       suffix := '.js';
     }
   if (hdr is not null and hdr[0] not like 'HTTP/1._ 200 %')
@@ -2467,13 +2631,15 @@ create procedure DB.DBA.RDF_LOAD_CRUNCHBASE(in graph_iri varchar, in new_origin_
   tree := json_parse (cnt);
   if (is_search)
     tree := get_keyword ('results', tree);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   xt := DB.DBA.MQL_TREE_TO_XML (tree);
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/crunchbase2rdf.xsl', xt,
-	  vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'base', base, 'suffix', suffix));
+	  vector ('baseUri', new_origin_uri, 'base', base, 'suffix', suffix));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
   return 1;
 }
 ;
@@ -2584,7 +2750,7 @@ create procedure DB.DBA.RDF_LOAD_MQL (in graph_iri varchar, in new_origin_uri va
   if (mime = 'application/rdf+xml')
     {
       sa := DB.DBA.RDF_MQL_GET_WIKI_URI (k);
-      delete from DB.DBA.RDF_QUAD where g =  iri_to_id (coalesce (dest, graph_iri));
+      RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
       -- cb-- As was
       --DB.DBA.RM_RDF_LOAD_RDFXML (cnt, new_origin_uri, coalesce (dest, graph_iri));
 
@@ -2598,6 +2764,7 @@ create procedure DB.DBA.RDF_LOAD_MQL (in graph_iri varchar, in new_origin_uri va
       -- ++cb
 
       DB.DBA.RM_FREEBASE_DOC_LINK (coalesce (dest, graph_iri), new_origin_uri, sprintf ('http://rdf.freebase.com/ns/%U.%U', lang, k), sa);
+      DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), new_url);
       have_rdf := 1;
       goto done;
     }
@@ -2629,7 +2796,7 @@ create procedure DB.DBA.RDF_LOAD_MQL (in graph_iri varchar, in new_origin_uri va
       types := vector_concat (types, tmp);
     }
   --types := get_keyword ('type', xt);
-  delete from DB.DBA.RDF_QUAD where g = iri_to_id (coalesce (dest, graph_iri));
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   foreach (any tp in types) do
     {
       qr := sprintf ('{"ROOT":{"query":{%s, "type":"%s", "*":[]}}}', k, tp);
@@ -2642,8 +2809,9 @@ create procedure DB.DBA.RDF_LOAD_MQL (in graph_iri varchar, in new_origin_uri va
       	vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'wpUri', sa));
       sa := '';
       xd := serialize_to_UTF8_xml (xt);
-      delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+      RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
       DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+      DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
       have_rdf := 1;
     }
 done:;
@@ -2791,6 +2959,7 @@ try_profile:
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
   goto end_sp;
 end_sp:
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), 'http://api.facebook.com/restserver.php');
   return 1;
 };
 
@@ -2798,8 +2967,8 @@ create procedure DB.DBA.RDF_LOAD_FACEBOOK_OPENGRAPH_SELECTION (in graph_iri varc
 {
     declare qr, path any;
     declare tree, xt, xd, types, hdr any;
-    declare k, cnt, url, tmp varchar;
-    declare pos integer;
+    declare k, cnt, url, tmp, mime varchar;
+    declare pos, ord, ret integer;
     declare exit handler for sqlstate '*'
     {
         DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE); 	
@@ -2823,7 +2992,19 @@ create procedure DB.DBA.RDF_LOAD_FACEBOOK_OPENGRAPH_SELECTION (in graph_iri varc
     xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/fb_ogs2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
     xd := serialize_to_UTF8_xml (xt);
     DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
-    return 0;
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), 'http://graph.facebook.com/');
+    mime := get_keyword ('content-type', opts);
+    ord := (select RM_ID from DB.DBA.SYS_RDF_MAPPERS where RM_HOOK = 'DB.DBA.RDF_LOAD_FACEBOOK_OPENGRAPH_SELECTION');
+    ret := 1;
+    for select RM_PATTERN, RM_TYPE, RM_HOOK from DB.DBA.SYS_RDF_MAPPERS
+      where RM_ID > ord and RM_TYPE in ('URL', 'MIME') and RM_ENABLED = 1 order by RM_ID do
+	{
+	  if (RM_TYPE = 'URL' and regexp_match (RM_PATTERN, new_origin_uri) is not null)
+	    ret := 0;
+          else if (RM_TYPE = 'MIME' and mime is not null and RM_HOOK <> 'DB.DBA.RDF_LOAD_DAV_META' and regexp_match (RM_PATTERN, mime) is not null)
+            ret := 0;
+	}
+    return ret;
 }
 ;
 
@@ -2878,6 +3059,7 @@ create procedure DB.DBA.RDF_LOAD_FACEBOOK_OPENGRAPH (in graph_iri varchar, in ne
     xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/fb_og2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
     xd := serialize_to_UTF8_xml (xt);
     DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
     return 0;
 }
 ;
@@ -3004,10 +3186,11 @@ create procedure DB.DBA.RDF_LOAD_ZILLOW (in graph_iri varchar, in new_origin_uri
 		-- Possible cause could be we're handling an atypical address and didn't decode it correctly
 	  	return 0;
 
-    xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/zillow2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'currentDateTime', cast(date_iso8601(now()) as varchar) ));
+    xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/zillow2rdf.xsl', xd, vector ('baseUri', new_origin_uri, 'currentDateTime', cast(date_iso8601(now()) as varchar) ));
     xd := serialize_to_UTF8_xml (xd);
-    delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
     DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 
 	-- GetUpdatedPropertyDetails often returns error code 501:
 	--     "The updated data for the property you are requesting is not available due to legal restrictions"
@@ -3022,9 +3205,11 @@ create procedure DB.DBA.RDF_LOAD_ZILLOW (in graph_iri varchar, in new_origin_uri
 	if (api_ret is null or api_ret <> '0')
 	  return 1;
 
-    xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/zillow2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'currentDateTime', cast(date_iso8601(now()) as varchar) ));
+    xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/zillow2rdf.xsl', xd, vector ('baseUri', new_origin_uri, 'currentDateTime', cast(date_iso8601(now()) as varchar) ));
     xd := serialize_to_UTF8_xml (xd);
     DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url2);
+
     return 1;
 }
 ;
@@ -3061,11 +3246,12 @@ create procedure DB.DBA.RDF_LOAD_FRIENDFEED (in graph_iri varchar, in new_origin
     tmp := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
     xd := xtree_doc (tmp);
     xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/atom2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
-    delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
     xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/friendfeed2rdf.xsl', xt, vector ('baseUri', graph_iri, 'isDiscussion', 1));
     xd := serialize_to_UTF8_xml (xd);
-    delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
     DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
     return 1;
 }
 ;
@@ -3114,8 +3300,9 @@ create procedure DB.DBA.RDF_LOAD_TWFY (in graph_iri varchar, in new_origin_uri v
   xd := xtree_doc (tmp);
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/twfy2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
   return 1;
 }
 ;
@@ -3154,8 +3341,9 @@ create procedure DB.DBA.RDF_LOAD_SLIDESIX (in graph_iri varchar, in new_origin_u
     xd := xtree_doc (tmp);
     xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/slidesix2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
     xd := serialize_to_UTF8_xml (xt);
-    delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
     DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
     return 1;
 }
 ;
@@ -3237,6 +3425,8 @@ create procedure DB.DBA.RDF_LOAD_SLIDESHARE (in graph_iri varchar, in new_origin
 	{
 		tmp := sprintf_inverse (new_origin_uri, 'http://www.slideshare.net/%s/%s', 0);
 		username := trim(tmp[0], '/');
+		if (username = 'event')
+			return 0;
 		itemname := trim(tmp[1], '/');
 		if (strchr(itemname, '?') is not null)
 			itemname := left(new_origin_uri, strchr(new_origin_uri, '?'));
@@ -3260,8 +3450,9 @@ create procedure DB.DBA.RDF_LOAD_SLIDESHARE (in graph_iri varchar, in new_origin
 	xd := xtree_doc (tmp);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/slideshare2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
 	xd := serialize_to_UTF8_xml (xt);
-	delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -3304,9 +3495,10 @@ create procedure DB.DBA.RDF_LOAD_DISQUS (in graph_iri varchar, in new_origin_uri
 	xd := xtree_doc (tmp);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/rss2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
 	xd := serialize_to_UTF8_xml (xt);
-	delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	--DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
 	DB.DBA.RDF_LOAD_FEED_SIOC (xd, new_origin_uri, coalesce (dest, graph_iri), 1);
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -3382,13 +3574,14 @@ create procedure DB.DBA.RDF_LOAD_RHAPSODY (in graph_iri varchar, in new_origin_u
 	}
 	else
 		return 0;
-	delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	tmp := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
 	xd := xtree_doc (tmp);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/rhapsody2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
 	xd := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+        RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -3446,8 +3639,9 @@ create procedure DB.DBA.RDF_LOAD_TESCO (in graph_iri varchar, in new_origin_uri
     xt := DB.DBA.SOCIAL_TREE_TO_XML (tree);
     xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/tesco2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
     xd := serialize_to_UTF8_xml (xt);
-    delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
     DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
     return 1;
 }
 ;
@@ -3495,7 +3689,7 @@ create procedure DB.DBA.RDF_LOAD_IDIOMAG (in graph_iri varchar, in new_origin_ur
 	else
 	  return 0;
 
-    delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	for (i := 0, l := length (urls); i < l; i := i + 1)
 	{
 		url := urls[i];
@@ -3504,6 +3698,7 @@ create procedure DB.DBA.RDF_LOAD_IDIOMAG (in graph_iri varchar, in new_origin_ur
 		xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/idiomag2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
 		xd := serialize_to_UTF8_xml (xt);
 		DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+		DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	}
 	return 1;
 }
@@ -3557,14 +3752,15 @@ create procedure DB.DBA.RDF_LOAD_RADIOPOP (in graph_iri varchar, in new_origin_u
 	  }
 	else
 	  return 0;
-	delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	tmp := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
 	xd := xtree_doc (tmp);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/radiopop2rdf.xsl', xd,
 		vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'user', id ));
 	xd := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+        RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
       }
     else
@@ -3630,8 +3826,9 @@ create procedure DB.DBA.RDF_LOAD_DISCOGS (in graph_iri varchar, in new_origin_ur
     xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/discogs2rdf.xsl', xd,
     	vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
     xd := serialize_to_UTF8_xml (xt);
-    delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
     DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
     return 1;
 }
 ;
@@ -3676,8 +3873,9 @@ create procedure DB.DBA.RDF_LOAD_LIBRARYTHING (in graph_iri varchar, in new_orig
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/lt2rdf.xsl', xd,
   	vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
   return 1;
 }
 ;
@@ -3789,8 +3987,9 @@ create procedure DB.DBA.RDF_LOAD_ISBN (in graph_iri varchar, in new_origin_uri v
 	}
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/isbn2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
 	xd := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+        RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -3811,6 +4010,7 @@ create procedure DB.DBA.RDF_LOAD_MEETUP2(in url varchar, in new_origin_uri varch
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/meetup2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'base', base, 'what', what_ ));
 	xd := serialize_to_UTF8_xml (xt);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -3853,7 +4053,7 @@ create procedure DB.DBA.RDF_LOAD_MEETUP (in graph_iri varchar, in new_origin_uri
       id0 := tmp[0];
     if (id0 is null or (id0 = 'www' and id1 is null))
       return 0;
-    delete from DB.DBA.RDF_QUAD where g =  iri_to_id (coalesce (dest, graph_iri));
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
     if (id0 = 'www')
       {
 	if (id1 = 'cities')
@@ -4039,25 +4239,27 @@ create procedure DB.DBA.RDF_LOAD_MEETUP (in graph_iri varchar, in new_origin_uri
 }
 ;
 
-create procedure DB.DBA.RDF_LOAD_LASTFM2 (in url varchar, in new_origin_uri varchar,  in dest varchar, in graph_iri varchar, in what_ varchar, inout opts any)
+create procedure DB.DBA.RDF_LOAD_LASTFM2 (in url varchar, in new_origin_uri varchar,  in dest varchar, in graph_iri varchar, inout opts any)
  returns integer
 {
 	declare xt, xd any;
 	declare tmp varchar;
 	tmp := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
 	xd := xtree_doc (tmp);
-	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/lastfm2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'what', what_ ));
+	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/lastfm2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
 	xd := serialize_to_UTF8_xml (xt);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
 
 create procedure DB.DBA.RDF_LOAD_LASTFM (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar, inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
 {
-	declare xd, xt, url, tmp, tmp1, server, api_key, hdr any;
+	declare xd, xt, url, tmp, tmp1, server, api_key, hdr, gr_iri any;
 	declare pos, len int;
-	declare xsl2, what_, origin_uri, id0, id1, id2, id3, id4 varchar;
+	declare xsl2, origin_uri, id0, id1, id2, id3, id4 varchar;
 	id0 := '';
 	id1 := '';
 	id2 := '';
@@ -4098,8 +4300,10 @@ create procedure DB.DBA.RDF_LOAD_LASTFM (in graph_iri varchar, in new_origin_uri
 		id0 := tmp[0];
 	else
 		return 0;
-	delete from DB.DBA.RDF_QUAD where g =  iri_to_id (coalesce (dest, graph_iri));
-        
+	--gr_iri := iri_to_id (coalesce (dest, graph_iri));
+	--##DB.DBA.SPARUL_CLEAR (coalesce (dest, graph_iri), 1, 0);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
+	--RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	if (id0 = 'music')
 	{
 		if (id1 is not null and id1 <> '')
@@ -4109,60 +4313,60 @@ create procedure DB.DBA.RDF_LOAD_LASTFM (in graph_iri varchar, in new_origin_uri
 				if (id3 is not null and id3 <> '')
 				{
 					url := sprintf('http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key=%s&artist=%s&track=%s', api_key, id1, id3);
-					DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+					DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, opts);
 					url := sprintf('http://ws.audioscrobbler.com/2.0/?method=track.getsimilar&artist=%s&track=%s&api_key=%s', id1, id3, api_key);
-					return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+					return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, opts);
 				}
 				else
 				{
 					if (strchr(id2, '+') = 0)  -- todo: perhaps it needs some processing?
 					{
 						url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=%s&api_key=%s', id1, api_key);
-						DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+						DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, opts);
 
 						url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.gettopalbums&artist=%s&api_key=%s', id1, api_key);
-						DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+						DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, opts);
 
 						url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.getevents&artist=%s&api_key=%s', id1, api_key);
-						DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+						DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 						url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=%s&api_key=%s', id1, api_key);
-						return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+						return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 					}
 					else if (id1 = '+noredirect')
 					{
 						url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=%s&api_key=%s', id2, api_key);
-						DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+						DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 						url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.gettopalbums&artist=%s&api_key=%s', id2, api_key);
-						DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+						DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 						url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.getevents&artist=%s&api_key=%s', id2, api_key);
-						DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+						DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 						url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=%s&api_key=%s', id2, api_key);
-						return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+						return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 					}
 					else
 					{
 						url := sprintf('http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=%s&artist=%s&album=%s', api_key, id1, id2);
-						return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+						return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 					}
 				}
 			}
 			else
 			{
 				url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=%s&api_key=%s', id1, api_key);
-				DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+				DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 				url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.gettopalbums&artist=%s&api_key=%s', id1, api_key);
-				DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+				DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 				url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.getevents&artist=%s&api_key=%s', id1, api_key);
-				DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+				DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 				url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=%s&api_key=%s', id1, api_key);
-				return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+				return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 			}
 		}
 		else
@@ -4173,16 +4377,16 @@ create procedure DB.DBA.RDF_LOAD_LASTFM (in graph_iri varchar, in new_origin_uri
 		if (id1 is not null and id1 <> '')
 		{
 			url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=%s&api_key=%s', id1, api_key);
-			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 			url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.gettopalbums&artist=%s&api_key=%s', id1, api_key);
-			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 			url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.getevents&artist=%s&api_key=%s', id1, api_key);
-			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 			url := sprintf('http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=%s&api_key=%s', id1, api_key);
-			return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+			return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 		}
 		else
 			return 0;
@@ -4195,7 +4399,7 @@ create procedure DB.DBA.RDF_LOAD_LASTFM (in graph_iri varchar, in new_origin_uri
 			if (pos > 0)
 				id1 := left(id1, pos);
 			url := sprintf('http://ws.audioscrobbler.com/2.0/?method=event.getinfo&event=%s&api_key=%s', id1, api_key);
-			return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+			return DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 		}
 		else
 			return 0;
@@ -4205,25 +4409,25 @@ create procedure DB.DBA.RDF_LOAD_LASTFM (in graph_iri varchar, in new_origin_uri
 		if (id1 is not null and id1 <> '' and (id2 = '' or id2 is null))
 		{
 			url := sprintf('http://ws.audioscrobbler.com/1.0/user/%s/profile.xml', id1);
-			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 			url := sprintf('http://ws.audioscrobbler.com/2.0/?method=user.getfriends&user=%s&api_key=%s', id1, api_key);
-			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
-
-			url := sprintf('http://ws.audioscrobbler.com/2.0/?method=library.getalbums&user=%s&api_key=%s', id1, api_key);
-			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 			url := sprintf('http://ws.audioscrobbler.com/2.0/?method=user.gettopalbums&user=%s&api_key=%s', id1, api_key);
-			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 			url := sprintf('http://ws.audioscrobbler.com/2.0/?method=user.gettopartists&user=%s&api_key=%s', id1, api_key);
-			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 			url := sprintf('http://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=%s&api_key=%s', id1, api_key);
-			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
+			
+			url := sprintf('http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=%s&api_key=%s', id1, api_key);
+			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 			url := sprintf('http://ws.audioscrobbler.com/2.0/?method=user.getplaylists&user=%s&api_key=%s', id1, api_key);
-			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri, what_, opts);
+			DB.DBA.RDF_LOAD_LASTFM2(url, new_origin_uri,  dest, graph_iri,  opts);
 
 			tmp := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
 			xd := xtree_doc (tmp);
@@ -4240,6 +4444,7 @@ create procedure DB.DBA.RDF_LOAD_LASTFM (in graph_iri varchar, in new_origin_uri
 				xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/lastfm2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (new_origin_uri), 'id', x));
 				xd := serialize_to_UTF8_xml (xt);
 				DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+				DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url2);
 			}
 		}
 		else if (id1 is not null and id1 <> '' and (id2 = 'library' and id3 = 'playlists' and id4 <> '' and id4 is not null))
@@ -4311,8 +4516,9 @@ create procedure DB.DBA.RDF_LOAD_PICASA (in graph_iri varchar, in new_origin_uri
 		xd := xtree_doc (tmp);
 		xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/picasa2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
 		xd := serialize_to_UTF8_xml (xt);
-		delete from DB.DBA.RDF_QUAD where g =  iri_to_id (coalesce (dest, graph_iri));
+		RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 		DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+		DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 		return 1;
 	}
 	else
@@ -4347,8 +4553,9 @@ create procedure DB.DBA.RDF_LOAD_GEONAMES (in graph_iri varchar, in new_origin_u
 	xd := xtree_doc (tmp);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/geonames2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
 	xd := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+        RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -4389,8 +4596,9 @@ create procedure DB.DBA.RDF_LOAD_VIMEO (in graph_iri varchar, in new_origin_uri
 	xd := xtree_doc (tmp);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/vimeo2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
 	xd := serialize_to_UTF8_xml (xt);
-    delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -4414,7 +4622,7 @@ create procedure DB.DBA.RDF_LOAD_YOUTUBE (in graph_iri varchar, in new_origin_ur
     if (host_part <> '' or img_id is null)
         return 0;
     url := concat('http://gdata.youtube.com/feeds/api/videos?vq=', img_id);
-    tmp := DB.DBA.RDF_HTTP_URL_GET (url, url, hdr, proxy=>get_keyword_ucase ('get:proxy', opts));
+    tmp := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
     xsl2 := 'xslt/main/atom2rdf.xsl';
   }
   else if (new_origin_uri like 'http://%.youtube.com/watch?v=%')
@@ -4427,7 +4635,7 @@ create procedure DB.DBA.RDF_LOAD_YOUTUBE (in graph_iri varchar, in new_origin_ur
     if (img_id is null)
         return 0;
     url := concat('http://gdata.youtube.com/feeds/api/videos/', img_id);
-    tmp := DB.DBA.RDF_HTTP_URL_GET (url, url, hdr, proxy=>get_keyword_ucase ('get:proxy', opts));
+    tmp := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
     xsl2 := 'xslt/main/atomentry2rdf.xsl';
   }
    else if (new_origin_uri like 'http://%.youtube.com/%' or new_origin_uri like 'http://%.youtube.com/user/%')
@@ -4459,17 +4667,19 @@ create procedure DB.DBA.RDF_LOAD_YOUTUBE (in graph_iri varchar, in new_origin_ur
     xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/youtube2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
     xd := serialize_to_UTF8_xml (xt);
     DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
     return 1;
   }
   else
     return 0;
-  if (hdr[0] not like 'HTTP/1._ 200 %')
-    signal ('22023', trim(hdr[0], '\r\n'), 'RDFXX');
+  --if (hdr[0] not like 'HTTP/1._ 200 %')
+  --  signal ('22023', trim(hdr[0], '\r\n'), 'RDFXX');
   xd := xtree_doc (tmp);
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || xsl2, xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id (coalesce (dest, graph_iri));
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
   return 1;
 }
 ;
@@ -4497,9 +4707,10 @@ create procedure DB.DBA.RDF_LOAD_DIGG (in graph_iri varchar, in new_origin_uri v
       xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/rss2rdf.xsl', xd,
       	vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'isDiscussion', '1'));
       xd := serialize_to_UTF8_xml (xt);
-      delete from DB.DBA.RDF_QUAD where g =  iri_to_id (coalesce (dest, graph_iri));
+      RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
       --DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
       DB.DBA.RDF_LOAD_FEED_SIOC (xd, new_origin_uri, coalesce (dest, graph_iri), 1);
+      DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
       return 1;
     }
   else if (new_origin_uri like 'http://digg.com/%')
@@ -4517,8 +4728,9 @@ create procedure DB.DBA.RDF_LOAD_DIGG (in graph_iri varchar, in new_origin_uri v
       story_url := cast (xpath_eval ('string (/stories/story/@href)', xd) as varchar);
       xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/digg2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
       xd := serialize_to_UTF8_xml (xt);
-      delete from DB.DBA.RDF_QUAD where g =  iri_to_id (coalesce (dest, graph_iri));
+      RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
       DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+      DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
       url := sprintf ('http://services.digg.com/story/%s/comments?count=%s&appkey=%U', id, comm, appkey);
       tmp := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
       goto diggsvc;
@@ -4539,8 +4751,9 @@ create procedure DB.DBA.RDF_LOAD_DIGG (in graph_iri varchar, in new_origin_uri v
       xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/digg2rdf.xsl', xd,
       		vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'storyUrl', story_url));
       xd := serialize_to_UTF8_xml (xt);
-      delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+      RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
       DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+      DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
       return 1;
     }
 ret:
@@ -4548,6 +4761,127 @@ ret:
 }
 ;
 
+create procedure DB.DBA.RDF_LOAD_GROUPON (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar, inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
+{
+	declare xd, section_name, search, xt, url, tmp any;
+	declare entity varchar;
+	declare pos integer;
+
+	declare exit handler for sqlstate '*'
+	{
+	  DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE); 	
+		return 0;
+	};
+	if (not isstring (_key))
+		return 0;
+	if (new_origin_uri like 'http://www.groupon.com/deals/%')
+	{
+		tmp := sprintf_inverse (new_origin_uri, 'http://www.groupon.com/deals/%s', 0);
+		entity := trim(tmp[0], '/');
+		if (entity is null)
+			return 0;
+		pos := strchr(entity, '/');
+		if (pos is not null and pos <> 0)
+			entity := left(entity, pos);
+		pos := strchr(entity, '?');
+		if (pos is not null and pos <> 0)
+			entity := left(entity, pos);
+		url := sprintf('http://api.groupon.com/v2/deals/%s.xml?client_id=%s', entity, _key);
+	}
+	else
+		return 0;
+	tmp := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
+	xd := xtree_doc (tmp);
+	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/groupon2rdf.xsl', xd, vector ('baseUri', new_origin_uri));
+	xd := serialize_to_UTF8_xml (xt);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
+	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
+	return 1;
+}
+;
+
+create procedure DB.DBA.RDF_LOAD_EOL (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar, inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
+{
+	declare xd, section_name, search, xt, url, tmp any;
+	declare entity varchar;
+	declare pos integer;
+
+	declare exit handler for sqlstate '*'
+	{
+	  DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE); 	
+		return 0;
+	};
+	if (new_origin_uri like 'http://www.eol.org/pages/%')
+	{
+		tmp := sprintf_inverse (new_origin_uri, 'http://www.eol.org/pages/%s', 0);
+		entity := trim(tmp[0], '/');
+		if (entity is null)
+			return 0;
+		pos := strchr(entity, '/');
+		if (pos is not null and pos <> 0)
+			entity := left(entity, pos);
+		pos := strchr(entity, '?');
+		if (pos is not null and pos <> 0)
+			entity := left(entity, pos);
+		url := sprintf('http://www.eol.org/api/pages/1.0/%s?details=1&format=xml', entity);
+	}
+	else
+		return 0;
+	tmp := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
+	xd := xtree_doc (tmp);
+	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/eol2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
+	xd := serialize_to_UTF8_xml (xt);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
+	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
+	return 1;
+}
+;
+
+create procedure DB.DBA.RDF_LOAD_OHLOH (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar, inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
+{
+	declare xd, section_name, search, xt, url, tmp any;
+	declare entity, resource_url, person_iri, docproxy_iri varchar;
+	declare exit handler for sqlstate '*'
+	{
+	  DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE); 	
+		return 0;
+	};
+	if (new_origin_uri like 'http://rdfohloh.wikier.org/%/%')
+	{
+		tmp := sprintf_inverse (new_origin_uri, 'http://rdfohloh.wikier.org/%s/%s', 0);
+		entity := tmp[0];
+		section_name := trim(tmp[1]);
+		section_name := trim(section_name, '/');
+		if (section_name is null)
+			return 0;
+		if (right(section_name, 5) = '/html')
+			section_name := left (section_name, length(section_name) - 5);
+		if (right(section_name, 4) = '/rdf')
+			section_name := left (section_name, length(section_name) - 4);
+		if (right(section_name, 3) = '/n3')
+			section_name := left (section_name, length(section_name) - 3);
+		if (section_name is null)
+			return 0;
+		url := sprintf('http://rdfohloh.wikier.org/%s/%s', entity, section_name);
+	}
+	else
+		return 0;
+	resource_url := DB.DBA.RDF_PROXY_ENTITY_IRI(RDF_SPONGE_DOC_IRI (dest, graph_iri));
+	person_iri := DB.DBA.RDF_PROXY_ENTITY_IRI(RDF_SPONGE_DOC_IRI (dest, graph_iri), '', 'person');
+	docproxy_iri := DB.DBA.RDF_SPONGE_PROXY_IRI(RDF_SPONGE_DOC_IRI (dest, graph_iri));
+	tmp := http_client (concat(url, '/rdf'), proxy=>get_keyword_ucase ('get:proxy', opts));
+	tmp := replace(tmp, concat('\"', url, '/rdf\"'), concat('\"', docproxy_iri, '\"'));
+	tmp := replace(tmp, concat('\"', url, '\"'), concat('\"', resource_url, '\"'));
+	tmp := replace(tmp, concat('\"', url, '#person\"'), concat('\"', person_iri, '\"'));
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
+	DB.DBA.RM_RDF_LOAD_RDFXML (tmp, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
+	return 1;
+}
+;
+
 create procedure DB.DBA.RDF_LOAD_DELICIOUS (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar, inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
 {
 	declare xd, section_name, search, xt, url, tmp any;
@@ -4557,21 +4891,21 @@ create procedure DB.DBA.RDF_LOAD_DELICIOUS (in graph_iri varchar, in new_origin_
 	  DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE);
 		return 0;
 	};
-	if (new_origin_uri like 'http://delicious.com/tags/%' or new_origin_uri like 'http://feeds.delicious.com/v2/rss/tags/%')
+	if (new_origin_uri like 'http://%delicious.com/tags/%' or new_origin_uri like 'http://feeds.delicious.com/v2/rss/tags/%')
 		what := 'tags';
-	else if (new_origin_uri like 'http://delicious.com/url/%' or new_origin_uri like 'http://feeds.delicious.com/v2/rss/url/%')
+	else if (new_origin_uri like 'http://%delicious.com/url/%' or new_origin_uri like 'http://feeds.delicious.com/v2/rss/url/%')
 	{
 		what := 'url';
 		return 1;
 	}
-	else if (new_origin_uri like 'http://delicious.com/%/%' or new_origin_uri like 'http://feeds.delicious.com/v2/rss/%/%')
+	else if (new_origin_uri like 'http://%delicious.com/%/%' or new_origin_uri like 'http://feeds.delicious.com/v2/rss/%/%')
 		what := 'tag';
 	else
 		what := 'user';
-	if (new_origin_uri like 'http://delicious.com/%')
+	if (new_origin_uri like 'http://%delicious.com/%')
 	{
-		tmp := sprintf_inverse (new_origin_uri, 'http://delicious.com/%s', 0);
-		section_name := trim(tmp[0]);
+		tmp := sprintf_inverse (new_origin_uri, 'http://%sdelicious.com/%s', 0);
+		section_name := trim(tmp[1]);
 		section_name := trim(section_name, '/');
 		if (section_name is null)
 			return 0;
@@ -4591,8 +4925,9 @@ create procedure DB.DBA.RDF_LOAD_DELICIOUS (in graph_iri varchar, in new_origin_
 	xd := xtree_doc (tmp);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/delicious2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'what', what));
 	xd := serialize_to_UTF8_xml (xt);
-	delete from DB.DBA.RDF_QUAD where g =  iri_to_id (coalesce (dest, graph_iri));
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	declare result, meta, state, message any;
 	state := '00000';
 	exec (sprintf('sparql select ?l from <%s> where { <%s> <http://scot-project.org/scot/ns#name> ?l }', graph_iri, graph_iri), state, message, vector (), 0, meta, result);
@@ -4689,8 +5024,9 @@ create procedure DB.DBA.RDF_LOAD_GOOGLE_DOCUMENT (in graph_iri varchar, in new_o
 	xd := xtree_doc (tmp);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/google_document2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
 	xd := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+        RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -4745,8 +5081,9 @@ create procedure DB.DBA.RDF_LOAD_GOOGLE_SPREADSHEET (in graph_iri varchar, in ne
 	xd := xtree_doc (tmp);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/google_spreadsheet2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'what', 'doc'));
 	xd2 := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+        RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd2, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 
 	ids := xpath_eval ('/feed/entry/link[@rel="http://schemas.google.com/spreadsheets/2006#cellsfeed"]/@href', xd, 0);
 	foreach (any y in ids) do
@@ -4758,6 +5095,7 @@ create procedure DB.DBA.RDF_LOAD_GOOGLE_SPREADSHEET (in graph_iri varchar, in ne
 		xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/google_spreadsheet2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'what', 'cells'));
 		xd := serialize_to_UTF8_xml (xt);
 		DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+		DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	}
 	return 1;
 }
@@ -4800,8 +5138,44 @@ create procedure DB.DBA.RDF_LOAD_OREILLY (in graph_iri varchar, in new_origin_ur
 	xd := xtree_doc (tmp, 2);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/oreilly2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'currentDateTime', cast(date_iso8601(now()) as varchar)));
 	xd := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+        RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
+	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
+	return 1;
+}
+;
+
+create procedure DB.DBA.RDF_LOAD_GOOGLE_BOOK (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,    inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
+{
+  declare xd, host_part, xt, url, tmp, api_key, hdr, exif any;
+  declare pos int;
+  declare book_id varchar;
+  declare exit handler for sqlstate '*'
+    {
+      DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE); 	
+      return 0;
+    };
+    if (new_origin_uri like 'http://books.google.com/books?id=%')
+	{
+		tmp := sprintf_inverse (new_origin_uri, 'http://books.google.com/books?id=%s', 0);
+		book_id := trim(tmp[0], '/');
+		if (book_id is null)
+			return 0;
+		pos := strchr(book_id, '&');
+		if (pos is not null and pos <> 0)
+			book_id := left(book_id, pos);
+	}
+	else
+		return 0;
+    url := sprintf('http://books.google.com/books/feeds/volumes/%s', book_id);
+	tmp := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
+	xd := xtree_doc (tmp, 2);
+	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/google_book2rdf.xsl',
+        xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
+	xd := serialize_to_UTF8_xml (xt);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -4859,8 +5233,9 @@ create procedure DB.DBA.RDF_LOAD_ETSY (in graph_iri varchar, in new_origin_uri v
 	xt := DB.DBA.SOCIAL_TREE_TO_XML (tree);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/etsy2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'action', action));
 	xd := serialize_to_UTF8_xml (xt);
-    delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -4907,8 +5282,9 @@ create procedure DB.DBA.RDF_LOAD_TUMBLR (in graph_iri varchar, in new_origin_uri
     xd := xtree_doc (tmp);
     xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/tumblr2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
     xd := serialize_to_UTF8_xml (xt);
-    delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
     DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -4946,8 +5322,43 @@ create procedure DB.DBA.RDF_LOAD_WINE (in graph_iri varchar, in new_origin_uri v
     xd := xtree_doc (tmp);
     xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/wine2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
     xd := serialize_to_UTF8_xml (xt);
-    delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
     DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
+	return 1;
+}
+;
+
+create procedure DB.DBA.RDF_LOAD_EVRI (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,    inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
+{
+  declare xd, host_part, xt, url, tmp, hdr, exif any;
+  declare entity_id, _id varchar;
+  declare exit handler for sqlstate '*'
+    {
+      DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE); 	
+      return 0;
+    };
+    if (new_origin_uri like 'http://www.evri.com/%/%')
+	{
+		tmp := sprintf_inverse (new_origin_uri, 'http://www.evri.com/%s/%s', 0);
+		entity_id := tmp[0];
+		_id := tmp[1];
+		if (entity_id = 'person' or entity_id = 'location' or entity_id = 'product' or entity_id = 'organization')
+			url := sprintf('http://api.evri.com/v1/%s/%s?appId=evri.com-restdoc', entity_id, _id);
+		else
+			return 0;
+	}
+	else
+		return 0;
+	tmp := http_client_ext (url, headers=>hdr, proxy=>get_keyword_ucase ('get:proxy', opts));
+    if (hdr[0] not like 'HTTP/1._ 200 %')
+        signal ('22023', trim(hdr[0], '\r\n'), 'RDFXX');
+    xd := xtree_doc (tmp);
+    xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/evri2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'entity', entity_id));
+    xd := serialize_to_UTF8_xml (xt);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
+    DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -5025,8 +5436,9 @@ create procedure DB.DBA.RDF_LOAD_CNET (in graph_iri varchar, in new_origin_uri v
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/cnet2rdf.xsl', xd,
 	    vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'currentDateTime', cast(date_iso8601(now()) as varchar)));
 	xd := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -5057,8 +5469,9 @@ create procedure DB.DBA.RDF_LOAD_YELP (in graph_iri varchar, in new_origin_uri v
 	xd := xtree_doc (tmp);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/yelp2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
 	xd := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+        RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -5090,8 +5503,9 @@ create procedure DB.DBA.RDF_LOAD_REVYU (in graph_iri varchar, in new_origin_uri
 	xd := xtree_doc (tmp);
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/revyu2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
 	xd := serialize_to_UTF8_xml (xt);
-        delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+        RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -5121,8 +5535,9 @@ create procedure DB.DBA.RDF_LOAD_BUGZILLA (in graph_iri varchar, in new_origin_u
   xd := xtree_doc (tmp);
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/bugzilla2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
   return 1;
 }
 ;
@@ -5154,8 +5569,9 @@ create procedure DB.DBA.RDF_LOAD_OPENLIBRARY (in graph_iri varchar, in new_origi
   xt := DB.DBA.SOCIAL_TREE_TO_XML (tree);
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/openlibrary2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
   return 1;
 }
 ;
@@ -5177,8 +5593,9 @@ create procedure DB.DBA.RDF_LOAD_SOCIALGRAPH (in graph_iri varchar, in new_origi
   xt := DB.DBA.SOCIAL_TREE_TO_XML (tree);
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/sg2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
   return 1;
 }
 ;
@@ -5206,7 +5623,6 @@ create procedure csv_detect_opts (in s any, in n int := 10)
 	  http (s, ss);
 	  while (i < n and isvector (r := get_csv_row (ss, delim, quot)))
         {
-	      dbg_obj_print (r);
             if (i = 0)
 		rws := length (r);
 	      else if (length (r) <> rws)
@@ -5293,8 +5709,9 @@ create procedure DB.DBA.RDF_LOAD_CSV (in graph_iri varchar, in new_origin_uri va
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/csvxml2rdf.xsl', xt, 
     vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), null);
     return 1;
 }
 ;
@@ -5310,8 +5727,9 @@ create procedure DB.DBA.RDF_LOAD_SVG (in graph_iri varchar, in new_origin_uri va
   xd := xtree_doc (_ret_body);
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/svg2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), null);
   return 1;
 }
 ;
@@ -5333,9 +5751,8 @@ create procedure DB.DBA.RDF_LOAD_MS_DOCUMENT (in graph_iri varchar, in new_origi
   xt := xtree_doc (meta);
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/ms_doc2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
-
   string_to_file (tmp, _ret_body, -2);
   meta := unzip_file (tmp, 'docProps/core.xml');
   file_delete (tmp, 1);
@@ -5345,6 +5762,7 @@ create procedure DB.DBA.RDF_LOAD_MS_DOCUMENT (in graph_iri varchar, in new_origi
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/ms_doc2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), null);
   return 1;
 }
 ;
@@ -5366,8 +5784,9 @@ create procedure DB.DBA.RDF_LOAD_OO_DOCUMENT (in graph_iri varchar, in new_origi
   xt := xtree_doc (meta);
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/oo2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri);
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), null);
   return 1;
 }
 ;
@@ -5381,6 +5800,7 @@ create procedure DB.DBA.RDF_LOAD_OO_DOCUMENT2 (in graph_iri varchar, in new_orig
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/fod2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), null);
   return 1;
 }
 ;
@@ -5400,6 +5820,7 @@ create procedure DB.DBA.RDF_LOAD_YAHOO_TRAFFIC_DATA (in graph_iri varchar, in ne
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/yahoo_trf2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), null);
   return 1;
 }
 ;
@@ -5420,6 +5841,7 @@ create procedure DB.DBA.RDF_LOAD_ICAL (in graph_iri varchar, in new_origin_uri v
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/ics2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), null);
   return 1;
 }
 ;
@@ -5431,21 +5853,94 @@ create procedure DB.DBA.RDF_LOAD_WEBCAL (in graph_iri varchar, in new_origin_uri
 }
 ;
 
-create procedure DB.DBA.RDF_LOAD_BESTBUY (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
+create procedure DB.DBA.RDF_LOAD_PRODUCTWIKI (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
     inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
 {
   declare xd, xt, url, tmp, api_key, asin, hdr, exif any;
-  declare pos, is_sku integer;
+	declare pos, is_sku, is_store integer;
+	asin := null;
+	api_key := _key;
+	if (not isstring (api_key))
+		return 0;
+	declare exit handler for sqlstate '*'
+	{
+		DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE); 	
+		return 0;
+	};
+	if (new_origin_uri like 'http://%.productwiki.com/%')
+	{
+		declare arr any;
+		arr := sprintf_inverse (new_origin_uri, 'http://%s.productwiki.com/%s', 0);
+		asin := arr[1];
+		pos := strchr(asin, '/');
+		if (pos is not null)
+			asin := left(asin, pos);
+		pos := strchr(asin, '?');
+		if (pos is not null)
+			asin := left(asin, pos);
+	}
+	else
+		return 0;
+	if (asin is null)
+		return 0;
+	url := sprintf ('http://api.productwiki.com/connect/api.aspx?op=search&q=%s&format=xml&key=%s&fields=skus,images,description,reviews', asin, api_key);
+	tmp := http_client_ext (url, headers=>hdr, proxy=>get_keyword_ucase ('get:proxy', opts));
+	if (hdr[0] not like 'HTTP/1._ 200 %')
+		signal ('22023', trim(hdr[0], '\r\n'), 'RDFXX');
+	xd := xtree_doc (tmp);
+	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/productwiki2rdf.xsl', xd, 
+		vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
+	xd := serialize_to_UTF8_xml (xt);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts); 
+	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
+	return 1;
+}
+;
 
+create procedure DB.DBA.RDF_LOAD_BESTBUY (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
+    inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
+{
+	declare xd, xt, url, tmp, api_key, asin, hdr, exif any;
+	declare pos, is_sku, is_store integer;
   asin := null;
   is_sku := 0;
+	is_store := 0;
   declare exit handler for sqlstate '*'
     {
       DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE);
       return 0;
     };
-  if (new_origin_uri like 'http://%.bestbuy.com/site/olspage.jsp?%' or
-      new_origin_uri like 'http://%.bestbuy.com/%/%?%')
+	if (new_origin_uri like 'http://stores.bestbuy.com/%')
+	{
+		declare arr any;
+		arr := sprintf_inverse (new_origin_uri, 'http://stores.bestbuy.com/%s', 0);
+		asin := arr[0];
+		pos := strchr(asin, '/');
+		if (pos is not null)
+			asin := left(asin, pos);
+		pos := strchr(asin, '?');
+		if (pos is not null)
+			asin := left(asin, pos);
+		is_store := 1;
+	}
+	else if (new_origin_uri like 'http://%.bestbuy.com/%?skuId=%' or new_origin_uri like 'http://%.bestbuy.com/%&skuId=%')
+	{
+		declare arr any;
+		arr := sprintf_inverse (new_origin_uri, 'http://%s.bestbuy.com/%sskuId=%s', 0);
+		asin := arr[2];
+		pos := strchr(asin, '/');
+		if (pos is not null)
+			asin := left(asin, pos);
+		pos := strchr(asin, '&');
+		if (pos is not null)
+			asin := left(asin, pos);
+		pos := strchr(asin, '?');
+		if (pos is not null)
+			asin := left(asin, pos);
+		is_sku := 1;
+	}
+	else if (new_origin_uri like 'http://%.bestbuy.com/site/olspage.jsp?%' or new_origin_uri like 'http://%.bestbuy.com/%/%?%')
     {
       declare arr any;
       arr := WS.WS.PARSE_URI (new_origin_uri);
@@ -5458,6 +5953,8 @@ create procedure DB.DBA.RDF_LOAD_BESTBUY (in graph_iri varchar, in new_origin_ur
       if (asin not like '[0-9]+')
 	{
           asin := get_keyword ('skuId', arr);
+			if (asin not like '[0-9]+')
+				return 0;
 	  is_sku := 1;
 	}
     }
@@ -5481,19 +5978,21 @@ create procedure DB.DBA.RDF_LOAD_BESTBUY (in graph_iri varchar, in new_origin_ur
   if (asin is null or not isstring (api_key))
     return 0;
   if (is_sku)
-    -- url := sprintf ('http://api.remix.bestbuy.com/v1/products(sku=%s)?apiKey=%s&format=xml&show=all', asin, api_key);
     url := sprintf ('http://api.remix.bestbuy.com/v1/products/%s.xml?apiKey=%s', asin, api_key);
   else
     url := sprintf ('http://api.remix.bestbuy.com/v1/products(productId=%s)?apiKey=%s&format=xml&show=all', asin, api_key);
+	if (is_store)
+		url := sprintf ('http://api.remix.bestbuy.com/v1/stores(storeId=%s)?apiKey=%s&format=xml&show=all', asin, api_key);
   tmp := http_client_ext (url, headers=>hdr, proxy=>get_keyword_ucase ('get:proxy', opts));
   if (hdr[0] not like 'HTTP/1._ 200 %')
     signal ('22023', trim(hdr[0], '\r\n'), 'RDFXX');
   xd := xtree_doc (tmp);
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/bestbuy2rdf.xsl', xd,
-    vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'currentDateTime', cast(date_iso8601(now()) as varchar)));
+		vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'currentDateTime', cast(date_iso8601(now()) as varchar), 'is_store', cast(is_store as varchar)));
   xd := serialize_to_UTF8_xml (xt);
-  delete from DB.DBA.RDF_QUAD where g =  iri_to_id(new_origin_uri); 
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts); 
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
   return 1;
 }
 ;
@@ -5709,8 +6208,9 @@ create procedure DB.DBA.RDF_LOAD_AMAZON_ARTICLE (in graph_iri varchar, in new_or
    }
 skip_merchantid2name:
 
-  delete from DB.DBA.RDF_QUAD where g = iri_to_id (coalesce (dest, graph_iri));
+  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd_utf8, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
   return 1;
 }
 ;
@@ -5767,6 +6267,7 @@ create procedure DB.DBA.RDF_LOAD_OPENSTREETMAP (in graph_iri varchar, in new_ori
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/openstreet2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'lon', lon1, 'lat', lat1));
 	xd := serialize_to_UTF8_xml (xt);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -5828,6 +6329,7 @@ create procedure DB.DBA.RDF_LOAD_USTREAM (in graph_iri varchar, in new_origin_ur
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/ustream2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'what', what));
 	xd := serialize_to_UTF8_xml (xt);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -5881,6 +6383,7 @@ create procedure DB.DBA.RDF_LOAD_FLICKR_IMG (in graph_iri varchar, in new_origin
 	xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/flickr2rdf.xsl', xd, vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri), 'exif', exif));
 	xd := serialize_to_UTF8_xml (xt);
 	DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+	DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
 	return 1;
 }
 ;
@@ -5905,12 +6408,16 @@ create procedure DB.DBA.RDF_LOAD_EBAY_ARTICLE (in graph_iri varchar, in new_orig
     }
   else if (new_origin_uri like 'http://cgi.ebay.com/%QQitemZ%QQ%')
     tmp := sprintf_inverse (new_origin_uri, 'http://cgi.ebay.com/%sQQitemZ%sQQ%s', 0);
+  else if (new_origin_uri like 'http://cgi.ebay.com/%/eBayISAPI.dll?ViewItem&item=%')
+    tmp := sprintf_inverse (new_origin_uri, 'http://cgi.ebay.com/%s/eBayISAPI.dll?ViewItem&item=%s', 0);
+  else if (new_origin_uri like 'http://cgi.ebay.com/%/%?%')
+    tmp := sprintf_inverse (new_origin_uri, 'http://cgi.ebay.com/%s/%s?%s', 0);
   else
     return 0;
 
   api_key := ser_key;
 
-  if (tmp is null or length (tmp) <> 3 or not isstring (api_key))
+  if (tmp is null or not isstring (api_key))  -- length (tmp) <> 3
     return 0;
 
   item_id := tmp[1];
@@ -5944,6 +6451,7 @@ create procedure DB.DBA.RDF_LOAD_EBAY_ARTICLE (in graph_iri varchar, in new_orig
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
 
 skipReviews:
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
   return 1;
 }
 ;
@@ -6081,6 +6589,7 @@ create procedure DB.DBA.RDF_LOAD_OPENSOCIAL_PERSON (in graph_iri varchar, in new
     vector ('baseUri', RDF_SPONGE_DOC_IRI (dest, graph_iri)));
   xd := serialize_to_UTF8_xml (xt);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), null);
   return 1;
 }
 ;
@@ -6090,7 +6599,7 @@ create procedure DB.DBA.RDF_LOAD_WIKIPEDIA_ARTICLE
          inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
 {
     declare get_uri, body, dbpiri any;
-    declare code, base any;
+    declare code, base, primary_topic, doc_iri any;
     get_uri := split_and_decode (new_origin_uri, 0, '\0\0/');
     get_uri := get_uri[length (get_uri) - 1];
     get_uri := split_and_decode (get_uri)[0];
@@ -6108,9 +6617,12 @@ create procedure DB.DBA.RDF_LOAD_WIKIPEDIA_ARTICLE
 	        <foaf:Document rdf:about=\"%s\">
             <foaf:primaryTopic rdf:resource=\"http://dbpedia.org/resource/%U\"/>
             </foaf:Document>
-            </rdf:RDF>', new_origin_uri, get_uri);
+            </rdf:RDF>', RDF_SPONGE_PROXY_IRI (new_origin_uri), get_uri);
 	--body := http_get ('http://dbpedia.org/data/'|| get_uri, null, 'GET', 'Accept: application/xml, */*');
-	--delete from DB.DBA.RDF_QUAD where G = DB.DBA.RDF_MAKE_IID_OF_QNAME (coalesce (dest, graph_iri));
+	--RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
+	primary_topic := DB.DBA.RDF_PROXY_ENTITY_IRI (graph_iri);
+	doc_iri := DB.DBA.RDF_SPONGE_PROXY_IRI (graph_iri);
+	update DB.DBA.RDF_QUAD set P = iri_to_id ('http://xmlns.com/foaf/0.1/topic') where G = iri_to_id (coalesce (dest, graph_iri)) and P = iri_to_id ('http://xmlns.com/foaf/0.1/primaryTopic') and S = iri_to_id (doc_iri);
 	DB.DBA.RM_RDF_LOAD_RDFXML (body, new_origin_uri, coalesce (dest, graph_iri));
       }
     if (base is not null and isstring (file_stat (base)) and __proc_exists ('php_str', 2) is not null)
@@ -6124,12 +6636,13 @@ create procedure DB.DBA.RDF_LOAD_WIKIPEDIA_ARTICLE
 	  if (length (body) > 2 and body[0] = 239 and body[1] = 187 and body[2] = 191)
 	    body := subseq (body, 3);
 	  dbpiri := sprintf ('http://dbpedia.org/resource/%U', get_uri);
-	  delete from DB.DBA.RDF_QUAD where G = DB.DBA.RDF_MAKE_IID_OF_QNAME (coalesce (dest, dbpiri));
+	  RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	  DB.DBA.TTLP (body, dbpiri, dbpiri);
 	  insert soft DB.DBA.SYS_HTTP_SPONGE (HS_LOCAL_IRI, HS_PARSER, HS_ORIGIN_URI, HS_ORIGIN_LOGIN, HS_LAST_LOAD, HS_EXPIRATION)
 		  values (dbpiri, 'DB.DBA.RDF_LOAD_HTTP_RESPONSE', dbpiri, dbpiri, now(), dateadd ('hour', 1, now ()));
       }
     fallback:
+    DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), null);
     return 1;
 }
 ;
@@ -6436,8 +6949,8 @@ create procedure DB.DBA.RDF_LOAD_HTML_RESPONSE (in graph_iri varchar, in new_ori
   declare xmlnss, i, l, nss, rdf_url_arr, content, hdr, rdf_in_html, old_etag, old_last_modified any;
   declare ret_flag, is_grddl, download_size, load_msec int;
   declare get_feeds, add_html_meta, grddl_loop int;
-  declare base_url, ns_url, reg, doc_base, proxy_iri varchar;
-  declare profile_trf, ns_trf, ext_profs, thisgr, cnt, cset any;
+  declare base_url, ns_url, reg, doc_base, proxy_iri, cset, dtd_sysuri, tgt_page, posh  varchar;
+  declare profile_trf, ns_trf, ext_profs, thisgr, cnt any;
   declare dict any;
 
   get_feeds := add_html_meta := 0;
@@ -6448,6 +6961,7 @@ create procedure DB.DBA.RDF_LOAD_HTML_RESPONSE (in graph_iri varchar, in new_ori
       if (get_keyword ('add-html-meta', opts) = 'yes')
         add_html_meta := 1;
     }
+  tgt_page := get_keyword ('get:uri', opts, new_origin_uri);
   set_user_id ('dba');
   mdta := 0;
   ret_flag := 1;
@@ -6467,7 +6981,7 @@ create procedure DB.DBA.RDF_LOAD_HTML_RESPONSE (in graph_iri varchar, in new_ori
       goto no_microformats;
     };
   cset := coalesce (get_keyword ('charset', opts), current_charset ());
-  cset := coalesce (charset_canonical_name (cset), current_charset ());
+  cset := coalesce (cast(charset_canonical_name (cset) as varchar), current_charset ());
   xt_sav := xt := xtree_doc (ret_body, 2, '', cset);
   {
     declare exit handler for sqlstate '*' {
@@ -6516,6 +7030,7 @@ create procedure DB.DBA.RDF_LOAD_HTML_RESPONSE (in graph_iri varchar, in new_ori
 	  else
 	     DB.DBA.TTLP (content, new_origin_uri, coalesce (dest, graph_iri));
 	  mdta := mdta + 1;
+  
 	  --RDF_MAPPER_CACHE_REGISTER (rdf_url, new_origin_uri, hdr, old_last_modified, download_size, load_msec);
 	  dict_put (dict, rdf_url, 1);
 	  rdf_url_inx := rdf_url_inx + 1;
@@ -6577,8 +7092,30 @@ try_grddl:
   if (registry_get ('__rdf_cartridges_original_doc_uri__') = '1' and mdta) -- It is recognized as GRDDL, data is loaded (testing the grddl only mode)
     goto ret;
   try_rdfa:;
-  -- RDFa
   thisgr := coalesce (dest, graph_iri);
+  if (xt_xml is not null)
+    xt := xt_xml;
+  -- try loading POSH
+  {
+    declare exit handler for sqlstate '*';
+    posh := '<html>' || serialize_to_UTF8_xml (xpath_eval ('//head', xt)) || '</html>';
+    DB.DBA.RDF_LOAD_RDFA (posh, proxy_iri, thisgr, 2);
+  }
+  -- RDFa
+  if (__proc_exists (fix_identifier_case ('xtree_doc_get_dtd'), 2) is null)
+    goto no_dtd_check;
+  dtd_sysuri := xtree_doc_get_dtd (xt, 1);
+  if (dtd_sysuri = 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd') 
+    {
+      declare exit handler for sqlstate '*' { goto try_grddl1; };
+      DB.DBA.RDF_LOAD_RDFA_1 (ret_body, new_origin_uri, thisgr, 0);
+      mdta := mdta + 1;
+      --if (mdta) 
+	goto ret;
+    }
+  else if (registry_get ('__rdf_cartridges_original_doc_uri__') = '1') -- only for tests
+    {
+      no_dtd_check:
   cnt := (sparql define input:storage "" select count(*) { graph `iri(?:thisgr)` { ?s ?p ?o }});
   {
       {
@@ -6603,6 +7140,12 @@ try_grddl:
   cnt := (sparql define input:storage "" select count(*) { graph `iri(?:thisgr)` { ?s ?p ?o }}) - cnt;
   if (cnt > 0)
     mdta := mdta + 1;
+    }
+  else if (mdta)
+    goto ret;
+	
+	
+  try_grddl1:
   -- /* GRDDL - plan A, eRDF going here */
   foreach (any prof in profs) do
     {
@@ -6611,7 +7154,7 @@ try_grddl:
       if (xslt_style is not null)
 	{
 	  declare exit handler for sqlstate '*' { goto next_prof; };
-	  xd := DB.DBA.RDF_MAPPER_XSLT (xslt_style, xt, vector ('baseUri', coalesce (dest, graph_iri)));
+	  xd := DB.DBA.RDF_MAPPER_XSLT (xslt_style, xt, vector ('baseUri', new_origin_uri));
 	  if (xpath_eval ('count(/RDF/*)', xd) > 0)
             {
 	      mdta := mdta + 1;
@@ -6622,10 +7165,7 @@ try_grddl:
 	}
       next_prof:;
     }
-
   -- brute force attack, scan w/o profile
-  if (xt_xml is not null)
-    xt := xt_xml;
   if (mdta < 2)
     {
       -- currently no profile in RDFa and some similar, so we try it to extract directly
@@ -6634,13 +7174,13 @@ try_grddl:
           if (position (GM_PROFILE, profs_done) > 0)
 	    goto try_next1;
           declare exit handler for sqlstate '*' { goto try_next1; };
-          xd := DB.DBA.RDF_MAPPER_XSLT (GM_XSLT, xt, vector ('baseUri', coalesce (dest, graph_iri), 'nss', nss));
+          xd := DB.DBA.RDF_MAPPER_XSLT (GM_XSLT, xt, vector ('baseUri', new_origin_uri, 'nss', nss));
 	  if (xpath_eval ('count(/RDF/*)', xd) > 0)
 	    {
 	      mdta := mdta + 1;
 	      xd := serialize_to_UTF8_xml (xd);
 	      if (GM_FLAG = 2)
-		delete from DB.DBA.RDF_QUAD where G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_iri);
+		RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
 	      DB.DBA.RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
 	      if (GM_FLAG > 0)
 		return mdta;
@@ -6727,7 +7267,7 @@ no_feed:;
   xt := xt_sav;
   if (add_html_meta = 1 and xpath_eval ('/html', xt) is not null)
     {
-      xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/html2rdf.xsl', xt, vector ('baseUri', coalesce (dest, graph_iri)));
+      xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/html2rdf.xsl', xt, vector ('baseUri', new_origin_uri, 'source', tgt_page));
       if (xpath_eval ('count(/RDF/*)', xd) > 0)
         {
 	  mdta := mdta + 1;
@@ -6767,8 +7307,10 @@ ret:
           return vector ('seeAlso', dep);
         }
     }
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), null);
   return mdta;
   no_microformats:;
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), null);
   return 0;
 }
 ;
@@ -6858,6 +7400,7 @@ create procedure DB.DBA.RDF_LOAD_FEED_SIOC (in content any, in iri varchar, in g
   xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/feed2sioc.xsl', xt, vector ('baseUri', graph_iri, 'isDiscussion', is_disc));
   xd := serialize_to_UTF8_xml (xd);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, iri, graph_iri, 0);
+  DB.DBA.RM_ADD_PRV (current_proc_name (), iri, graph_iri, null);
   return 1;
   no_sioc:
   return 0;
@@ -6885,11 +7428,21 @@ create procedure DB.DBA.SYS_URN_SPONGE_UP (in local_iri varchar, in get_uri varc
 
 create procedure DB.DBA.SYS_DOI_SPONGE_UP (in local_iri varchar, in get_uri varchar, in options any)
 {
-  if (lower (local_iri) like 'doi:%' and __proc_exists ('HS_Resolve', 2) is not null)
+  if (lower (local_iri) like 'doi:%')
     {
       declare new_get_uri varchar;
+      if (__proc_exists ('HS_Resolve', 2) is not null)
+	{
       new_get_uri := HS_Resolve (substring (get_uri, 5, length (get_uri)));
-      if (new_get_uri is null)
+	}
+      else
+	{
+	  declare hdr any;
+	  http_get ('http://dx.doi.org/' || substring (get_uri, 5, length (get_uri)), hdr);
+	  new_get_uri := http_request_header (hdr, 'Location');
+	}
+
+      if (not isstring (new_get_uri))
         signal ('RDFZZ', 'Cannot resolve IRI='||get_uri);
       options := vector_concat (vector ('get:uri', new_get_uri), options);
       return DB.DBA.SYS_HTTP_SPONGE_UP (local_iri, get_uri,
@@ -6950,11 +7503,12 @@ create procedure DB.DBA.RDF_LOAD_YAHOO_STOCK_DATA (in graph_iri varchar, in new_
 
 create procedure rdfm_yq_get_quote (in symbol varchar, in new_origin_uri varchar, in  dest varchar, in graph_iri varchar, inout opts any)
 {
-  declare arr, cnt, ses, content any;
+  declare arr, cnt, ses, content, url any;
   declare xt, xd any;
 
   ses := string_output ();
-  cnt := http_client (sprintf ('http://download.finance.yahoo.com/d/quotes.csv?s=%U&f=nsbavophg&e=.csv', symbol), proxy=>get_keyword_ucase ('get:proxy', opts));
+  url := sprintf ('http://download.finance.yahoo.com/d/quotes.csv?s=%U&f=nsbavophg&e=.csv', symbol);
+  cnt := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
   arr := rdfm_yq_parse_csv (cnt);
   http ('<quote stock="NASDAQ">', ses);
   foreach (any q in arr) do
@@ -6976,17 +7530,19 @@ create procedure rdfm_yq_get_quote (in symbol varchar, in new_origin_uri varchar
       vector ('baseUri', 'http://finance.yahoo.com/q?s='||symbol));
   xd := serialize_to_UTF8_xml (xt);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
   return;
 }
 ;
 
 create procedure rdfm_yq_get_history (in symbol varchar, in new_origin_uri varchar, in  dest varchar, in graph_iri varchar, inout opts any)
 {
-  declare arr, cnt, ses, content any;
+  declare arr, cnt, ses, content, url any;
   declare xt, xd any;
 
   ses := string_output ();
-  cnt := http_client (sprintf ('http://ichart.finance.yahoo.com/table.csv?s=%U&d=10&e=13&f=2007&g=d&a=8&b=7&c=2007&ignore=.csv', symbol), proxy=>get_keyword_ucase ('get:proxy', opts));
+  url := sprintf ('http://ichart.finance.yahoo.com/table.csv?s=%U&d=10&e=13&f=2007&g=d&a=8&b=7&c=2007&ignore=.csv', symbol);
+  cnt := http_client (url, proxy=>get_keyword_ucase ('get:proxy', opts));
   arr := rdfm_yq_parse_csv (cnt);
   http (sprintf ('<history stock="NASDAQ" symbol="%V">', symbol), ses);
   foreach (any q in arr) do
@@ -7010,6 +7566,7 @@ create procedure rdfm_yq_get_history (in symbol varchar, in new_origin_uri varch
   xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/yahoo_stock2rdf.xsl', xt, vector ('baseUri', 'http://finance.yahoo.com/q/hp?s='||symbol));
   xd := serialize_to_UTF8_xml (xt);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
   return;
 }
 ;
@@ -7094,6 +7651,7 @@ create procedure rdfm_yq_get_events (in symbol varchar, in new_origin_uri varcha
   http ('</r:RDF>\n', ses);
   content := string_output_string (ses);
   DB.DBA.RM_RDF_LOAD_RDFXML (content, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), iri);
   return;
 }
 ;
@@ -7264,8 +7822,9 @@ create procedure DB.DBA.SYS_OAI_SPONGE_UP (in local_iri varchar, in get_uri varc
       xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/oai2rdf.xsl', xt, vector ('baseUri', get_uri));
       xd := serialize_to_UTF8_xml (xd);
       if (dest is null)
-	delete from DB.DBA.RDF_QUAD where G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_iri);
+	RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, options);
       DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+      DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), url);
     }
   return local_iri;
 }
@@ -7700,6 +8259,7 @@ create procedure DB.DBA.RDF_LOAD_MBZ_1 (in graph_iri varchar, in new_origin_uri
   xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/main/mbz2rdf.xsl', xt, vector ('baseUri', RDF_SPONGE_DOC_IRI (new_origin_uri)));
   xd := serialize_to_UTF8_xml (xd);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  DB.DBA.RM_ADD_PRV (current_proc_name (), new_origin_uri, coalesce (dest, graph_iri), uri);
 };
 
 create procedure DB.DBA.RDF_LOAD_MBZ (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
@@ -7742,7 +8302,7 @@ create procedure DB.DBA.RDF_LOAD_MBZ (in graph_iri varchar, in new_origin_uri va
   else
     return 0;
   if (dest is null)
-    delete from DB.DBA.RDF_QUAD where G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_iri);
+    RM_CLEAN_DEST (dest, graph_iri, new_origin_uri, opts);
   DB.DBA.RDF_LOAD_MBZ_1 (graph_iri, new_origin_uri, dest, kind, id, inc, opts);
   -- DELME: should not be there
   --DB.DBA.TTLP (sprintf ('<%S> <http://xmlns.com/foaf/0.1/primaryTopic> <%S> .\n<%S> a <http://xmlns.com/foaf/0.1/Document> .',
@@ -7773,6 +8333,7 @@ create procedure DB.DBA.RM_LOAD_PREFIXES ()
   XML_REMOVE_NS_BY_PREFIX ('geospecies', 2);
   XML_REMOVE_NS_BY_PREFIX ('oplbb', 2);
   XML_REMOVE_NS_BY_PREFIX ('uClassify', 2);
+  XML_REMOVE_NS_BY_PREFIX ('taxconcept', 2);
   for select RES_CONTENT, RES_NAME from WS.WS.SYS_DAV_RES where
     	RES_FULL_PATH like '/DAV/VAD/rdf_mappers/xslt/%/%.xsl' do
     {
@@ -7800,6 +8361,7 @@ create procedure DB.DBA.RM_LOAD_PREFIXES ()
   XML_SET_NS_DECL ('umbel-owl', 'http://umbel.org/umbel#', 2);
   XML_SET_NS_DECL ('umbel-ac', 'http://umbel.org/umbel/ac/', 2);
   XML_SET_NS_DECL ('oplweb', 'http://www.openlinksw.com/schemas/oplweb#', 2);
+  XML_SET_NS_DECL ('oplevri', 'http://www.openlinksw.com/schemas/oplevri#', 2);
   XML_SET_NS_DECL ('fbase', 'http://rdf.freebase.com/ns/', 2);
   XML_SET_NS_DECL ('ore', 'http://www.openarchives.org/ore/terms/', 2);
   XML_SET_NS_DECL ('dbpedia-owl', 'http://dbpedia.org/ontology/', 2);
@@ -7811,6 +8373,7 @@ create procedure DB.DBA.RM_LOAD_PREFIXES ()
   XML_SET_NS_DECL ('cnet', 'http://api.cnet.com/rest/v1.0/', 2);
   XML_SET_NS_DECL ('geospecies', 'http://rdf.geospecies.org/ont/geospecies#', 2);
   XML_SET_NS_DECL ('uClassify', 'http://api.uclassify.com/1/ResponseSchema#', 2);
+  XML_SET_NS_DECL ('taxconcept', 'http://www.taxonconcept.org/ont/se_v01/seo.owl#', 2);
 };
 
 DB.DBA.RM_LOAD_PREFIXES ();
@@ -7826,11 +8389,80 @@ create procedure DB.DBA.RM_GRAPH_PT_CK (in graph_iri varchar, in dest varchar)
 }
 ;
 
+create procedure RM_CHECK_CLASS_MATCH (in pattern varchar, in graph varchar, in new_origin_uri varchar)
+{
+  declare x, dociri any;
+  dociri := DB.DBA.RDF_SPONGE_PROXY_IRI (new_origin_uri);
+  for select "tp" from (sparql define input:storage "" 
+        prefix foaf: <http://xmlns.com/foaf/0.1/>
+  	select ?tp where { graph `iri(?:graph)` { ?doc foaf:primaryTopic ?s . ?s a ?tp . filter (?s = iri(?:dociri)) }}) x do
+    {
+      x := rdfdesc_uri_curie ("tp");
+      if (regexp_match (pattern, x) is not null)
+	return 1;
+    }
+  return 0;
+}
+;
+
+create procedure DB.DBA.RM_GET_BASEURI (inout opts any, in graph_iri any, in dest any)
+{
+  declare mt, baseiri varchar;
+  mt := get_keyword ('content-type', opts, 'application/octet-stream');
+  if (mt = 'application/rdf+xml' or mt like '%/rdf+%' or mt like '%/turtle' or mt = 'application/x-turtle') 
+    baseiri := RDF_SPONGE_DOC_IRI (dest, graph_iri); -- just coalsce
+  else  
+    baseiri := DB.DBA.RDF_SPONGE_PROXY_IRI (graph_iri); -- doc proxy iri 
+  return baseiri; 
+}
+;
+
+create procedure DB.DBA.RM_GET_LABELS_INIT (in dest varchar, in graph_iri varchar, in new_origin_uri varchar, inout opts any)
+{
+  declare data, meta, state, message any;
+  declare qr, primary_topic, doc_iri, baseiri varchar;
+
+  primary_topic := DB.DBA.RDF_PROXY_ENTITY_IRI (graph_iri);
+  doc_iri := DB.DBA.RDF_SPONGE_PROXY_IRI (graph_iri);
+  baseiri := DB.DBA.RM_GET_BASEURI (opts, graph_iri, dest);
+  graph_iri := coalesce (dest, graph_iri);
+  set isolation='uncommitted';
+  if (exists (sparql define input:storage "" 
+  	#define input:inference "virtrdf-label" 
+	prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+	prefix gr: <http://purl.org/goodrelations/v1#>
+	select (1) 
+    	where { graph `iri(?:graph_iri)` { ?s a gr:ProductOrServicesSomeInstancesPlaceholder ; rdfs:label ?o . } }))
+    {
+      set isolation='committed';
+      return vector ();
+    }
+  set isolation='committed';
+  -- we first see if NEs extraction find something
+  qr := sprintf ('sparql define input:storage "" select ?o from <%s> where '||
+    	' { ?s <http://rdf.alchemyapi.com/rdf/v1/s/aapi-schema#ResolvedName> ?o . filter isliteral (?o) }',
+	graph_iri);
+  state := '00000';
+  exec (qr, state, message, vector (), 0, meta, data);
+  if (state = '00000' and length (data) > 0)
+    return data;
+  state := '00000';
+  qr := sprintf ('sparql define input:storage "" define input:inference "virtrdf-label" '||
+  	' select distinct ?n ?s1 from <%s> where { ?s1 virtrdf:label ?n   . '||
+  	' filter (isLiteral (?n) && ?s1 in (<%s>, <%s>, <%s>)  && (lang (?n) = "en" || lang (?n) = "") && !(?n like "http://%%"))}', 
+  	graph_iri, primary_topic, doc_iri, new_origin_uri);
+  exec (qr, state, message, vector (), 0, meta, data);
+  if (state = '00000' and length (data) > 0)
+    return data;
+  return vector ();
+}
+;
+
 create procedure DB.DBA.RDF_LOAD_POST_PROCESS (in graph_iri varchar, in new_origin_uri varchar, in dest varchar,
     inout ret_body any, in ret_content_type varchar, inout options any)
 {
   declare new_opts any;
-  declare dummy, spmode, triples, graph, tmp any;
+  declare dummy, spmode, triples, graph, tmp, labels any;
   declare rc int;
 
   dummy := null;
@@ -7858,6 +8490,8 @@ create procedure DB.DBA.RDF_LOAD_POST_PROCESS (in graph_iri varchar, in new_orig
 	  spmode := tmp;
         }	  
     }  
+  set isolation='committed';
+  labels := DB.DBA.RM_GET_LABELS_INIT (dest, graph, new_origin_uri, options);
   for select MC_ID, MC_PATTERN, MC_TYPE, MC_HOOK, MC_KEY, MC_OPTIONS, MC_API_TYPE 
     from DB.DBA.RDF_META_CARTRIDGES where MC_ENABLED = 1 order by MC_SEQ do
     {
@@ -7871,6 +8505,10 @@ create procedure DB.DBA.RDF_LOAD_POST_PROCESS (in graph_iri varchar, in new_orig
 	{
 	  val_match := new_origin_uri;
 	}
+      else if (MC_TYPE = 'CLASS' and RM_CHECK_CLASS_MATCH (MC_PATTERN, coalesce (dest, graph_iri), new_origin_uri))
+	{
+	  goto try_cartridge; 
+	}
       else
 	val_match := null;
 
@@ -7883,6 +8521,7 @@ create procedure DB.DBA.RDF_LOAD_POST_PROCESS (in graph_iri varchar, in new_orig
 	dbg_obj_prin1 ('Trying PP ', MC_HOOK);
       if (isstring (val_match) and regexp_match (MC_PATTERN, val_match) is not null)
 	{
+	  try_cartridge:
 	  if (__proc_exists (MC_HOOK) is null)
 	    goto try_next_mapper;
 
@@ -7892,7 +8531,7 @@ create procedure DB.DBA.RDF_LOAD_POST_PROCESS (in graph_iri varchar, in new_orig
 	    };
           if (registry_get ('__sparql_mappers_debug') = '1')
 	    dbg_obj_prin1 ('Match PP ', MC_HOOK);
-	  new_opts := vector_concat (options, MC_OPTIONS, vector ('content-type', ret_content_type));
+	  new_opts := vector_concat (options, MC_OPTIONS, vector ('content-type', ret_content_type), vector ('extracted-labels', labels));
 	  commit work;
 	  st := msec_time ();
 	  rc := call (MC_HOOK) (graph_iri, new_origin_uri, dest, ret_body, dummy, dummy, MC_KEY, new_opts);
@@ -8116,3 +8755,33 @@ create procedure RM_GET_TZ (in tz varchar)
     'ZP6', -06*60+00
  ));
 }
+;
+
+-- scheduler task if needed to keep volume under certain limit
+create procedure CLEAN_SPONGE (in d int := 30, in n int := 2000)
+{
+  declare res, stat, msg varchar;
+  declare inx int;
+
+  declare exit handler for sqlstate '*'
+    {
+      log_enable (1);
+      resignal;
+    }
+  ;
+  log_enable (2);
+  inx := 0;
+  for select HS_LOCAL_IRI as graph from DB.DBA.SYS_HTTP_SPONGE where HS_EXPIRATION < dateadd ('day', -1*d, now ()) do
+    {
+       inx := inx + 1;
+       stat := '00000';
+       exec ('sparql clear graph <'||graph||'>', stat, msg);
+       if (inx > n)
+         goto endp;
+    }
+ endp:
+  log_enable (1);
+}
+;
+
+RDFS_RULE_SET ('http://www.w3.org/2000/01/rdf-schema#', 'http://www.w3.org/2000/01/rdf-schema#');
diff --git a/binsrc/rdf_mappers/rdfdesc/description.sql b/binsrc/rdf_mappers/rdfdesc/description.sql
index 13e1396..f67a934 100644
--- a/binsrc/rdf_mappers/rdfdesc/description.sql
+++ b/binsrc/rdf_mappers/rdfdesc/description.sql
@@ -1,5 +1,5 @@
 --
---  $Id: description.sql,v 1.21.2.41 2010/07/05 13:20:42 source Exp $
+--  $Id: description.sql,v 1.21.2.59 2011/03/29 22:52:14 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -21,57 +21,6 @@
 --
 --
 
-TTLP (
-'@prefix foaf: <http://xmlns.com/foaf/0.1/> .
- at prefix dc: <http://purl.org/dc/elements/1.1/> .
- at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
- at prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#> .
- at prefix fbase: <http://rdf.freebase.com/ns/type.object.> .
- at prefix skos: <http://www.w3.org/2008/05/skos#> .
- at prefix bibo: <http://purl.org/ontology/bibo/> .
- at prefix gr: <http://purl.org/goodrelations/v1#> .
- at prefix cb: <http://www.crunchbase.com/> .
- at prefix dcterms: <http://purl.org/dc/terms/> .
- at prefix owl: <http://www.w3.org/2002/07/owl#> .
- at prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
- at prefix og: <http://opengraphprotocol.org/schema/> .
-
-dc:title rdfs:subPropertyOf virtrdf:label .
-rdfs:label rdfs:subPropertyOf virtrdf:label .
-fbase:name rdfs:subPropertyOf virtrdf:label .
-foaf:name rdfs:subPropertyOf virtrdf:label .
-<http://s.opencalais.com/1/pred/name> rdfs:subPropertyOf virtrdf:label .
-foaf:nick rdfs:subPropertyOf virtrdf:label .
-<http://www.w3.org/2004/02/skos/core#prefLabel> rdfs:subPropertyOf virtrdf:label .
-skos:prefLabel rdfs:subPropertyOf virtrdf:label .
-<http://www.geonames.org/ontology#name> rdfs:subPropertyOf virtrdf:label .
-<http://purl.org/dc/terms/title> rdfs:subPropertyOf virtrdf:label .
-foaf:accountName rdfs:subPropertyOf virtrdf:label .
-bibo:shortTitle rdfs:subPropertyOf virtrdf:label .
-<http://s.opencalais.com/1/pred/name> rdfs:subPropertyOf foaf:name .
-cb:source_description rdfs:subPropertyOf foaf:name .
-<http://s.opencalais.com/1/type/er/Company> rdfs:subClassOf gr:BusinessEntity .
-gr:BusinessEntity rdfs:subClassOf foaf:Organization .
-<http://dbpedia.org/ontology/Company> rdfs:subClassOf gr:BusinessEntity .
-<http://purl.org/ontology/mo/MusicArtist> rdfs:subClassOf foaf:Person .
-foaf:maker rdfs:subClassOf dc:creator .
-<http://dbpedia.org/property/name> rdfs:subPropertyOf foaf:name .
-<http://www.w3.org/2002/12/cal/ical#summary> rdfs:subPropertyOf rdfs:label .
-<http://usefulinc.com/ns/doap#name> rdfs:subPropertyOf rdfs:label .
-foaf:topic rdfs:subPropertyOf dcterms:references .
-<http://opengraphprotocol.org/schema/title> owl:equivalentProperty <http://opengraphprotocol.org/schema/title#this> .
-<http://rdfs.org/ns/void#vocabulary> owl:equivalentProperty <http://www.openlinksw.com/schema/attribution/isDescribedUsing> .
-<http://aims.fao.org/aos/geopolitical.owl#nameListEN> rdfs:subPropertyOf rdfs:label .
-<http://aims.fao.org/aos/geopolitical.owl#hasMinLatitude> rdfs:subPropertyOf geo:lat .
-<http://aims.fao.org/aos/geopolitical.owl#hasMinLongitude> rdfs:subPropertyOf geo:long .
-og:latitude rdfs:subPropertyOf geo:lat .
-og:longitude rdfs:subPropertyOf geo:long .
-<http://uberblic.org/ontology/latitude> rdfs:subPropertyOf geo:lat .
-<http://uberblic.org/ontology/longitude> rdfs:subPropertyOf geo:long .
-', '', 'virtrdf-label');
-
-rdfs_rule_set ('virtrdf-label', 'virtrdf-label');
-
 --
 -- make a vector of languages and their quality
 --
@@ -198,6 +147,42 @@ create procedure rdfdesc_label (in _S any, in _G varchar, in lines any := null)
 }
 ;
 
+create procedure rdfdesc_label_1 (in _S any, in lines any := null)
+{
+  declare best_str, meta, data, stat, msg any;
+  declare best_q, q float;
+  declare lang, langs varchar;
+
+  if (not (registry_get ('fct_desc_value_labels') = '1'))
+    return null;
+
+  langs := 'en';
+  if (lines is not null)
+    {
+      langs := http_request_header_full (lines, 'Accept-Language', 'en');
+    }
+  stat := '00000';
+  exec (sprintf ('sparql define input:inference "virtrdf-label" '||
+  'select ?o (lang(?o)) where { <%S> virtrdf:label ?o }', _S), stat, msg, vector (), 0, meta, data);
+  best_str := '';
+  best_q := 0;
+  if (stat = '00000' and length (data))
+    {
+      for (declare i, l int, i := 0, l := length (data); i < l; i := i + 1)
+	{
+	  q := rdfdesc_get_lang_by_q (langs, data[i][1]);
+	  --dbg_obj_print (data[i][0], langs, data[i][1], q);
+          if (q > best_q)
+	    {
+	      best_str := data[i][0];
+	      best_q := q;
+	    }
+	}
+    }
+  return best_str;
+}
+;
+
 create procedure rdfdesc_buy_link (in _G varchar, in _S varchar)
 {
   declare ret any;
@@ -278,7 +263,8 @@ create procedure rdfdesc_uri_curie (in uri varchar, in label varchar := null)
   delim := -1;
   uriSearch := uri;
   nsPrefix := null;
-  if (not length (label))
+  if (length (label))
+    return label;
     label := null;
   ret := uri;
   while (nsPrefix is null and delim <> 0)
@@ -349,8 +335,8 @@ create procedure rdfdesc_http_url (in url varchar)
     }
   if (host is null)
     host := http_request_header(lines, 'Host', null, null);
-  pref := 'http://'||host||'/about/html/';
-  pref2 := 'http://'||host||'/about/id/';
+  pref := 'http%://'||host||'/about/html/';
+  pref2 := 'http%://'||host||'/about/id/';
   if (url not like pref || '%' and url not like pref2 || '%')
     {
       ua := rfc1808_parse_uri (url);
@@ -360,6 +346,10 @@ create procedure rdfdesc_http_url (in url varchar)
 	ua [2] := '';
       url := vspx_uri_compose (ua);
       url := ltrim (url, '/');
+      pref := replace (pref, 'http%://', 'http://');
+      ua := rfc1808_parse_uri (pref);
+      ua[0] := DB.DBA.RDF_SPONGE_IRI_SCH ();
+      pref := vspx_uri_compose (ua);
       url := pref || url_sch || '/' || url;
     }
   url := replace (url, '#', '%01');
@@ -391,7 +381,7 @@ create procedure rdfdesc_is_external (in url varchar, in prop varchar)
 }
 ;
 
-create procedure rdfdesc_http_print_r (in _object any, in prop any, in label any, in rel int := 1, inout acc any)
+create procedure rdfdesc_http_print_r (in _object any, in prop any, in lines any, in rel int := 1, inout acc any)
 {
    declare lang, rdfs_type, rdfa, prop_l, prop_n  any;
    declare visible int;
@@ -433,11 +423,7 @@ again:
        else
 	 _url := _object;
 
-       -- label for curie local part disabled
-       if (0 and prop = __id2in (rdf_sas_iri ()))
-	 _label := label;
-       else
-	 _label := null;
+	 _label := rdfdesc_label_1 (_url, lines);
 
        rdfa := rdfdesc_rel_print (prop, rel, _url, 0, null);
        if (prop = 'http://bblfish.net/work/atom-owl/2006-06-06/#content' and _object like '%#content%')
@@ -446,24 +432,24 @@ again:
 	   whenever not found goto usual_iri;
 	   select id_to_iri (O) into src from DB.DBA.RDF_QUAD where
 	   	S = iri_to_id (_object, 0) and P = iri_to_id ('http://bblfish.net/work/atom-owl/2006-06-06/#src', 0);
-	   http (sprintf ('<div id="x_content" style="width:100%%; height:300px;margin-top:3px;margin-bottom:3px;"><iframe src="%s" width="100%%" height="100%% frameborder="0"><p>Your browser does not support iframes.</p></iframe></div><br/>', src));
+	   http (sprintf ('<div id="x_content"><iframe src="%s" width="100%%" height="100%% frameborder="0"><p>Your browser does not support iframes.</p></iframe></div><br/>', src));
 	 }
        else if (http_mime_type (_url) like 'image/%' and _url not like 'http://%/about/id/%')
-	 http (sprintf ('<a class="uri" %s href="%s"><img src="%s" height="160" border="0"/></a>', rdfa, rdfdesc_http_url (_url), _url));
+	 http (sprintf ('<a class="uri" %s href="%s"><img src="%s" height="160" style="border-width:0"/></a>', rdfa, rdfdesc_http_url (_url), _url));
        else if (_url like 'mailto:%')
 	 {
-	   http (sprintf ('<a class="uri" %s href="%s">%s <img src="images/mail.png" title="Send Mail" border="0"/></a>', rdfa, _url, rdfdesc_uri_curie(_url, _label)));
+	   http (sprintf ('<a class="uri" %s href="%s">%s <img src="images/mail.png" title="Send Mail" style="border-width:0"/></a>', rdfa, _url, rdfdesc_uri_curie(_url, _label)));
 	 }
        else if (_url like 'tel:%')
 	 {
-	   http (sprintf ('<a class="uri" %s href="%s">%s <img src="images/phone.gif" title="Make Call" border="0"/></a>', rdfa, _url, rdfdesc_uri_curie(_url, _label)));
+	   http (sprintf ('<a class="uri" %s href="%s">%s <img src="images/phone.gif" title="Make Call" style="border-width:0"/></a>', rdfa, _url, rdfdesc_uri_curie(_url, _label)));
 	 }
        else
 	 {
 	   usual_iri:
 	   http (sprintf ('<a class="uri" %s href="%s">%s</a>', rdfa, rdfdesc_http_url (_url), rdfdesc_uri_curie(_url, _label)));
 	   if (rdfdesc_is_external (_url, prop))
-	     http (sprintf (' <a class="uri" href="%s"><img src="images/goout.gif" title="Open Actual (X)HTML page" border="0"/></a>', _url));
+	     http (sprintf (' <a class="uri" href="%s"><img src="images/goout.gif" title="Open Actual (X)HTML page" style="border-width:0"/></a>', _url));
 	 }
 
      }
@@ -603,7 +589,7 @@ create procedure rdfdesc_prop_label (in uri any)
 create procedure rdfdesc_type (in gr varchar, in subj varchar, out url varchar)
 {
   declare meta, data, ll any;
-  ll := 'unknown';
+  ll := 'Thing';
   url := 'javascript:void()';
   if (length (gr))
     {
@@ -662,6 +648,25 @@ DB.DBA.RDF_VIEW_GET_BINARY (in path varchar, in accept varchar) __SOAP_HTTP 'app
 
 grant execute on DB.DBA.RDF_VIEW_GET_BINARY to PROXY;
 
+create procedure DB.DBA.RDF_SPONGE_AUTH (in realm varchar)
+{
+  declare auth_func, agent varchar;
+  if (__proc_exists ('DB.DBA.FOAF_SSL_AUTH_GEN') is null)
+    return 1;
+  if (http_acl_get ('Sponger', '*', '*') = -1)
+    return 1;
+  if (0 = DB.DBA.FOAF_SSL_AUTH_GEN (realm, 1))
+    return 0;
+  agent := DB.DBA.FOAF_SSL_WEBID_GET ();
+  if (agent is null) 
+    return 0;
+  if (http_acl_get ('Sponger', agent, '*') = 1)
+    return 0;
+  connection_set ('SPARQLUserId', 'SPARQL');
+  return 1;
+}
+;
+
 
 -- /* extended http proxy service */
 create procedure virt_proxy_init_about ()
@@ -713,7 +718,7 @@ create procedure virt_proxy_init_about ()
 
   DB.DBA.VHOST_REMOVE (vhost=>'*sslini*', lhost=>'*sslini*', lpath=>'/about');
   DB.DBA.VHOST_DEFINE (vhost=>'*sslini*', lhost=>'*sslini*', lpath=>'/about', ppath=>'/SOAP/Http/ext_http_proxy', soap_user=>'PROXY',
-      opts=>vector('url_rewrite', 'ext_about_http_proxy_rule_list1'));
+      opts=>vector('url_rewrite', 'ext_about_http_proxy_rule_list1'), auth_fn=>'DB.DBA.RDF_SPONGE_AUTH', realm=>'Virtuoso Sponger');
 
   DB.DBA.VHOST_REMOVE (lpath=>'/services/rdf/object.binary');
   DB.DBA.VHOST_DEFINE (lpath=>'/services/rdf/object.binary', ppath=>'/SOAP/Http/RDF_VIEW_GET_BINARY', soap_user=>'PROXY');
@@ -889,6 +894,11 @@ create procedure virt_proxy_init_about ()
 
   --# grants
   EXEC_STMT ('grant execute on  DB.DBA.HTTP_RDF_ACCEPT to PROXY', 0);
+  if (__proc_exists ('WS.WS.host_meta_add') is not null)
+    {
+      WS.WS.host_meta_add ('SPONGER.service', 
+     	'<Link rel="http://openlinksw.com/virtuoso/sponger" template="http://%{WSHost}s/about/{uri}"/>');
+    }
 
   registry_set ('DB.DBA.virt_proxy_init_about_state', rdf_virt_proxy_ver ());
 }
@@ -942,6 +952,38 @@ virt_proxy_init_about ()
 
 drop procedure virt_proxy_init_about;
 
+create procedure rdfdesc_make_curie (in url varchar, in lines any)
+{
+  declare curie, chost, dhost varchar;
+  if (__proc_exists ('WS.CURI.curi_make_curi') is null)
+    return url;
+  curie := WS.CURI.curi_make_curi (url);
+  dhost := registry_get ('URIQADefaultHost');
+  chost := http_request_header(lines, 'Host', null, dhost);
+  return sprintf ('http://%s/c/%s', chost, curie);
+}
+;
+
+create procedure rdfdesc_make_qr_code (in data_to_qrcode any, in src_width int := 120, in src_height int := 120, in qr_scale int := 4)
+{
+  declare qrcode_bytes, mixed_content, content varchar;
+  declare qrcode any;
+
+  if (__proc_exists ('QRcode encodeString8bit', 2) is null)
+    return null;
+
+  declare exit handler for sqlstate '*' { return null; };
+
+  content := "IM CreateImageBlob" (src_width, src_height, 'white', 'jpg');
+  qrcode := "QRcode encodeString8bit" (data_to_qrcode);
+  qrcode_bytes := aref_set_0 (qrcode, 0);
+  mixed_content := "IM PasteQRcode" (qrcode_bytes, qrcode[1], qrcode[2], qr_scale, qr_scale, 0, 0, cast (content as varchar), length (content));
+  mixed_content := encode_base64 (cast (mixed_content as varchar));
+  mixed_content := replace (mixed_content, '\r\n', '');
+  return mixed_content;
+}
+;
+
 create procedure rdfdesc_virt_info ()
 {
   http ('<a href="http://www.openlinksw.com/virtuoso/">OpenLink Virtuoso</a> version '); 
@@ -952,3 +994,157 @@ create procedure rdfdesc_virt_info ()
   http (case when sys_stat ('cl_run_local_only') = 0 then sprintf ('(%d server processes)', sys_stat ('cl_n_hosts')) else '' end); 
 }
 ;
+
+create procedure RDF_CARTRIDGES_SECURE_VD (in vhost varchar, in lhost varchar)
+{
+  declare opts, rdfdesc, rdfdesc_is_dav any;
+  opts := (select top 1 deserialize(HP_AUTH_OPTIONS) from http_path where hp_host = vhost);
+  rdfdesc := (select HP_PPATH from HTTP_PATH where HP_HOST = '*ini*' and HP_LISTEN_HOST = '*ini*' and HP_LPATH = '/rdfdesc');
+  rdfdesc_is_dav := (select HP_STORE_AS_DAV from HTTP_PATH where HP_HOST = '*ini*' and HP_LISTEN_HOST = '*ini*' and HP_LPATH = '/rdfdesc');
+
+  DB.DBA.VHOST_REMOVE ( lhost=>lhost, vhost=>vhost, lpath=>'/about');
+  DB.DBA.VHOST_REMOVE ( lhost=>lhost, vhost=>vhost, lpath=>'/rdfdesc');
+  DB.DBA.VHOST_REMOVE ( lhost=>lhost, vhost=>vhost, lpath=>'/sparql'); 
+  DB.DBA.VHOST_REMOVE ( lhost=>lhost, vhost=>vhost, lpath=>'/about/id');
+  DB.DBA.VHOST_REMOVE ( lhost=>lhost, vhost=>vhost, lpath=>'/about/id/entity'); 
+  DB.DBA.VHOST_REMOVE ( lhost=>lhost, vhost=>vhost, lpath=>'/about/data'); 
+  DB.DBA.VHOST_REMOVE ( lhost=>lhost, vhost=>vhost, lpath=>'/about/data/entity');
+
+  DB.DBA.VHOST_DEFINE (
+      lhost=>lhost,
+      vhost=>vhost,
+      realm=>'Virtuoso Sponger',
+      auth_fn=>'DB.DBA.RDF_SPONGE_AUTH',
+      sec=>'SSL',
+      ses_vars=>0,
+      auth_opts=>opts,
+      lpath=>'/about',
+      ppath=>'/SOAP/Http/ext_http_proxy',
+      is_dav=>0,
+      soap_user=>'PROXY',
+      opts=>vector ('url_rewrite', 'ext_about_http_proxy_rule_list1')
+      );
+
+  DB.DBA.VHOST_DEFINE (
+      lhost=>lhost,
+      vhost=>vhost,
+      sec=>'SSL',
+      ses_vars=>0,
+      auth_opts=>opts,
+      lpath=>'/rdfdesc',
+      ppath=>rdfdesc,
+      is_dav=>rdfdesc_is_dav,
+      vsp_user=>'dba'
+
+      );
+
+  DB.DBA.VHOST_DEFINE (
+      lhost=>lhost,
+      vhost=>vhost,
+      realm=>'Virtuoso Sponger',
+      auth_fn=>'DB.DBA.FOAF_SSL_AUTH',
+      sec=>'SSL',
+      auth_opts=>opts,
+      lpath=>'/sparql',
+      ppath=>'/!sparql/',
+      is_dav=>1,
+      vsp_user=>'dba',
+      opts=>vector ('noinherit', 1)
+
+      );
+
+
+  DB.DBA.VHOST_DEFINE (
+      lhost=>lhost,
+      vhost=>vhost,
+      realm=>'Virtuoso Sponger',
+      auth_fn=>'DB.DBA.RDF_SPONGE_AUTH',
+      sec=>'SSL',
+      auth_opts=>opts,
+      lpath=>'/about/id', ppath=>'/', is_dav=>0, def_page=>'', opts=>vector('url_rewrite', 'ext_ahp_rule_list_new')
+      );
+
+  DB.DBA.VHOST_DEFINE (
+      lhost=>lhost,
+      vhost=>vhost,
+      realm=>'Virtuoso Sponger',
+      auth_fn=>'DB.DBA.RDF_SPONGE_AUTH',
+      sec=>'SSL',
+      auth_opts=>opts,
+      lpath=>'/about/id/entity', ppath=>'/', is_dav=>0, def_page=>'', opts=>vector('url_rewrite', 'sp_entity_rll')
+      );
+
+  DB.DBA.VHOST_DEFINE (
+      lhost=>lhost,
+      vhost=>vhost,
+      realm=>'Virtuoso Sponger',
+      auth_fn=>'DB.DBA.RDF_SPONGE_AUTH',
+      sec=>'SSL',
+      auth_opts=>opts,
+      lpath=>'/about/data', ppath=>'/', is_dav=>0, def_page=>'', opts=>vector('url_rewrite', 'ext_ahp_rule_list_data')
+      );
+
+  DB.DBA.VHOST_DEFINE (
+      lhost=>lhost,
+      vhost=>vhost,
+      realm=>'Virtuoso Sponger',
+      auth_fn=>'DB.DBA.RDF_SPONGE_AUTH',
+      sec=>'SSL',
+      auth_opts=>opts,
+      lpath=>'/about/data/entity', ppath=>'/', is_dav=>0, def_page=>'', opts=>vector('url_rewrite', 'sp_ent_data_rll')
+      );
+}
+;
+
+create procedure rdfdesc_links_hdr (in subj any, in desc_link any)
+{
+  declare links varchar;
+  desc_link := sprintf ('http://%{WSHost}s%s', desc_link);
+  links := 'Link: ';
+  links := links || 
+  sprintf ('<%s&output=application%%2Frdf%%2Bxml>; rel="alternate"; type="application/rdf+xml"; title="Structured Descriptor Document (RDF/XML format)",', desc_link);
+  links := links || 
+  sprintf ('<%s&output=text%%2Fn3>; rel="alternate"; type="text/n3"; title="Structured Descriptor Document (N3/Turtle format)",', desc_link);
+  links := links || 
+  sprintf ('<%s&output=application%%2Frdf%%2Bjson>; rel="alternate"; type="application/rdf+json"; title="Structured Descriptor Document (RDF/JSON format)",', desc_link);
+  links := links || 
+  sprintf ('<%s&output=application%%2Fatom%%2Bxml>; rel="alternate"; type="application/atom+xml"; title="Structured Descriptor Document (OData/Atom format)",', desc_link);
+  links := links || 
+  sprintf ('<%s&output=application%%2Fodata%%2Bjson>; rel="alternate"; type="application/odata+json"; title="Structured Descriptor Document (OData/JSON format)",', desc_link);
+  links := links || 
+  sprintf ('<%s&output=text%%2Fcxml>; rel="alternate"; type="text/cxml"; title="Structured Descriptor Document (CXML format)",', desc_link);
+  links := links || 
+  sprintf ('<%s&output=text%%2Fcsv>; rel="alternate"; type="text/csv"; title="Structured Descriptor Document (CSV format)",', desc_link);
+  links := links || sprintf ('<%s>; rel="http://xmlns.com/foaf/0.1/primaryTopic",', subj);
+  links := links || sprintf ('<%s>; rev="describedby"\r\n', subj);
+  http_header (http_header_get () || links);
+}
+;
+
+
+create procedure rdfdesc_links_mup (in subj any, in desc_link any)
+{
+  declare links varchar;
+  if (desc_link = 0)
+    return;
+  desc_link := sprintf ('http://%{WSHost}s%s', desc_link);
+  links := '';
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=application%%2Frdf%%2Bxml" rel="alternate" type="application/rdf+xml" title="Structured Descriptor Document (RDF/XML format)" />\n', desc_link);
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=text%%2Fn3" rel="alternate" type="text/n3" title="Structured Descriptor Document (N3/Turtle format)" />\n', desc_link);
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=application%%2Frdf%%2Bjson" rel="alternate" type="application/rdf+json" title="Structured Descriptor Document (RDF/JSON format)" />\n', desc_link);
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=application%%2Fatom%%2Bxml" rel="alternate" type="application/atom+xml" title="Structured Descriptor Document (OData/Atom format)" />\n', desc_link);
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=application%%2Fatom%%2Bjson" rel="alternate" type="application/atom+json" title="Structured Descriptor Document (OData/JSON format)" />\n', desc_link);
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=text%%2Fcxml" rel="alternate" type="text/cxml" title="Structured Descriptor Document (CXML format)" />\n', desc_link);
+  links := links || repeat (' ', 5) ||
+  sprintf ('<link href="%V&output=text%%2Fcsv" rel="alternate" type="text/csv" title="Structured Descriptor Document (CSV format)" />\n', desc_link);
+  links := links || repeat (' ', 5) || sprintf ('<link href="%V" rel="http://xmlns.com/foaf/0.1/primaryTopic" />\n', subj);
+  links := links || repeat (' ', 5) || sprintf ('<link href="%V" rev="describedby" />\n', subj);
+  http (links);
+}
+;
diff --git a/binsrc/rdf_mappers/rdfdesc/description.vsp b/binsrc/rdf_mappers/rdfdesc/description.vsp
index 312a686..1057d8d 100644
--- a/binsrc/rdf_mappers/rdfdesc/description.vsp
+++ b/binsrc/rdf_mappers/rdfdesc/description.vsp
@@ -5,10 +5,17 @@
    declare _G, _S, _S_save, odd_position any;
    declare rdf_link, label, true_label, _subject any;
    declare arr, data, meta, h1, h2, inx, gr, host, pars, cookievec any;
-   declare iri_type, iri_uri, links, langs, dspace, sid, error_message, cookiestr varchar;
-   declare do_sponge, do_refresh, local_lookup, sponge_type, proxy_iri_fn int;
+   declare iri_type, iri_uri, links, langs, dspace, sid, error_message, cookiestr, dsn, ua varchar;
+   declare do_sponge, force_clean, do_refresh, local_lookup, sponge_type, proxy_iri_fn, expir int;
 
    set http_charset='utf-8';
+   if (0 = DB.DBA.RDF_SPONGE_AUTH ('Virtuoso Sponger'))
+     {
+       http_rewrite ();
+       http_status_set (403);
+       return;  
+     }
+
    label := '';
    iri_type := 'unknown';
    _subject := '';
@@ -18,6 +25,9 @@
    sponge_type := '';
    connection_set ('ns_ctr', 1); /* for unknown xmlns to print in RDFa */
    host := http_request_header (http_request_header (), 'Host');
+   ua :=   http_request_header (http_request_header (), 'User-Agent');
+   if (not isstring (ua))
+     ua := null;
    langs := rdfdesc_get_lang_acc (lines);
    gr := get_keyword ('g', params, '');
    if (gr like '%?debug=on' or gr like '%&debug=on')
@@ -28,8 +38,9 @@
        tmp := regexp_substr ( '(.*)([\\?&]@Lookup@=.*)', gr, 2);
        tmp := split_and_decode (ltrim (tmp, '?&'));
        sponge_type := get_keyword ('@Lookup@', tmp, '');
-       do_refresh := atoi (get_keyword ('refresh', tmp, '-1'));
-       if (do_refresh < 0)
+       force_clean := get_keyword ('refresh', tmp, '-1');
+       do_refresh := atoi (force_clean);
+       if (do_refresh < 0 or force_clean = 'clean')
          do_refresh := null;
        gr := regexp_substr ( '(.*)([\\?&]@Lookup@=.*)', gr, 1); 
      } 
@@ -86,7 +97,7 @@
    --if (arr[5] <> '')
    --  do_sponge := 0;
    arr[0] := lower (arr[0]);
-   if (arr[0] not in ('http', 'https', 'file', 'feed', 'doi', 'webcal') and arr[0] not like 'urn:lsid:%')
+   if (arr[0] not in ('http', 'https', 'file', 'feed', 'doi', 'webcal', 'oai') and _G not like 'urn:lsid:%')
      {
        do_sponge := 0;
        local_lookup := 1;
@@ -155,6 +166,10 @@
        --DB.DBA.EXEC_AS (sprintf ('sparql define input:storage "" define get:soft "soft" SELECT * from <%S> where { ?x ?y ?z . }', _G), 'SPARQL');
        --DB.DBA.VT_INC_INDEX_DB_DBA_RDF_OBJ ();
        -- temporary work around to stop sponging twice
+       if (force_clean = 'clean')
+         {
+           sparql clear graph ?:_G;
+	 }
        DB.DBA.RM_DO_SPONGE (_G, sponge_type, do_refresh);
        commit work;
      }
@@ -216,11 +231,15 @@
    if (length (data)) _subject := data[0][0];
 
    rdf_link := sprintf ('/sparql?default-graph-uri=%U&query=%U', _G, sprintf ('DESCRIBE <%s>',_S));
+   rdfdesc_links_hdr (_S, rdf_link);
 
-   links := sprintf ('Link: <http://%s%s&output=rdf>;\r\n rel="alternate"; type="application/rdf+xml"; title="Metadata in RDF/XML format",\r\n ', host, rdf_link); 
-   links := links||sprintf ('<http://%s%s&output=n3>;\r\n rel="alternate"; type="text/n3"; title="Metadata in N3/Turtle format",\r\n ', host, rdf_link); 
-   links := links||sprintf ('<http://%s%s&output=application%%2Fjson>;\r\n rel="alternate"; type="application/json"; title="Metadata in RDF/JSON format"\r\n', host, rdf_link); 
-   links := links||sprintf ('<http://%s%s&output=application%%2Fatom%%2Bxml>;\r\n rel="alternate"; type="application/atom+xml"; title="OData (Atom feed) format"\r\n', host, rdf_link); 
+   links := '';
+   for select HS_EXPIRATION from SYS_HTTP_SPONGE where HS_ORIGIN_URI = _G do 
+     {
+       if (HS_EXPIRATION is not null)
+         links := links||sprintf ('Expires: %s\r\n', date_rfc1123 (HS_EXPIRATION));
+     }
+   commit work;  
    http_header (http_header_get () || links);
    errors:
    if (not length (label))
@@ -228,17 +247,26 @@
    if (label like 'http%://%')
      label := rdfdesc_uri_curie (label);
    set isolation = 'uncommitted';
+   dsn := (SPARQL prefix h: <http://www.w3.org/2006/http#> prefix hh: <http://www.w3.org/2006/http-header#> 
+   	     select ?vo { graph `iri(?:_G)` { ?s ?p hh:content-location ; h:fieldValue ?v . ?v h:elementName ?vo } } LIMIT 1);
+   if (dsn is null)
+     {
+       if (strchr (_G, '#') is null)
+	 dsn := _G || '#';
+       else
+	 dsn := _G;
+     }
+   else
+     {
+       dsn := rfc1808_expand_uri (_G, dsn);
+     }
 ?>
 
 <!-- header -->
 <head profile="http://www.w3.org/1999/xhtml/vocab">
-    <base href="http://<?V http_request_header (lines, 'Host') ?><?V http_map_get ('domain') ?>/" />
+    <base href="http<?V case is_https_ctx () when 1 then 's' else '' end ?>://<?V http_request_header (lines, 'Host') ?><?V http_map_get ('domain') ?>/" />
     <title>About: <?vsp http (sprintf ('%s', label)); ?></title>
-    <link rel="alternate" type="application/rdf+xml" href="<?=rdf_link?>&output=rdf" title="Metadata in RDF/XML format" />
-    <link rel="alternate" type="text/n3" href="<?=rdf_link?>&output=n3" title="Metadata in N3/Turtle format" />
-    <link rel="alternate" type="application/json+rdf" href="<?=rdf_link?>&output=application%2Frdf%2Bjson" title="Metadata in RDF/JSON format" />
-    <link rel="alternate" type="application/json" href="<?=rdf_link?>&output=application%2Fjson" title="Metadata in RDF/JSON format" />
-    <link rel="alternate" type="application/atom+xml" href="<?=rdf_link?>&output=application%2Fatom%2Bxml" title="OData (Atom feed) format" />
+    <?vsp rdfdesc_links_mup (_S, rdf_link);  ?>
     <link rel="stylesheet" type="text/css" href="statics/slidebar.css" />
     <link rel="stylesheet" type="text/css" href="statics/style_w.css" />
     <link href="statics/highlighter.css" type="text/css" rel="stylesheet" charset="utf-8" />
@@ -286,17 +314,34 @@
 
     <div id="header">
       <div id="hd_l">
+        <div id="opl_logo">
+          <a href="http://www.openlinksw.com" 
+             title="OpenLink Software">
+            <img src="statics/openlinklogo_wstrap_2008.png" 
+                 alt="[OpenLink Software]" />
+          </a>
+        </div>
+	<div id="entity_info">
 	  <h1 id="title">About: <a href="<?= case when _S like 'nodeID://%' then rdfdesc_http_url (_S) else _S end ?>"><?vsp http (label); ?></a></h1>
         <div id="homelink">
         </div>
         <div class="page-resource-uri">
 	    An Entity of Type : <a href="<?V iri_uri ?>"><?V iri_type ?></a>, 
-	    from Data Source : <a href="<?V _G ?>"><?V _G ?></a>, 
+	    from Data Source : <a href="<?V dsn ?>"><?V dsn ?></a>, 
 	    within Data Space : <a href="http://<?V dspace ?>"><?V host ?></a>
         </div>
+        </div> <!-- #entity_info -->
       </div> <!-- hd_l -->
       <div id="hd_r">
-        <a href="http://www.openlinksw.com" title="OpenLink Software"><img src="statics/openlinklogo_wstrap_2008.png" alt="[OpenLink Software]" height="80" width="191" /></a>
+<?vsp
+  declare qrimg any;
+  qrimg := rdfdesc_make_qr_code (rdfdesc_make_curie (case when _S like 'nodeID://%' then rdfdesc_http_url (_S) else _S end, lines));
+  if (qrimg is not null and strcasestr (ua, 'Mobile') is null) {
+    
+?>
+	<img id="qrcode" alt="QRcode image" src="data:image/jpg;base64,<?V qrimg ?>"/>
+<?vsp } ?>
+
       </div> <!-- hd_r -->
     </div> <!-- header -->
     <div id="content_wrapper">
@@ -339,7 +384,7 @@
 	      {
                 declare OBJECT any;
 		OBJECT := data [0];
-		rdfdesc_http_print_r (OBJECT, PRED, true_label, 1, langs);
+		rdfdesc_http_print_r (OBJECT, PRED, lines, 1, langs);
 	      }
 	   exec_close (h2);
 
@@ -377,7 +422,7 @@
 	      {
                 declare OBJECT any;
 		OBJECT := data [0];
-		rdfdesc_http_print_r (OBJECT, PRED, true_label, 0, langs);
+		rdfdesc_http_print_r (OBJECT, PRED, lines, 0, langs);
 	      }
 	   exec_close (h2);
 
@@ -403,27 +448,40 @@
        Explore alternative Linked Data Views via this <a title="OpenLink Data Explorer" href="/ode/?uri=<?vsp http_url (_S); ?>">OpenLink Data Explorer</a> link
           
            Raw Linked Data formats:
-       <a href="<?=rdf_link || '&output=n3'?>">N3/Turtle</a> |
-       <a href="<?=rdf_link || '&output=application%2Frdf%2Bjson'?>">RDF/JSON</a> |
-       <a href="<?=rdf_link || '&output=application%2Fatom%2Bxml'?>">ODATA/ATOM</a> |
-       <a href="<?=rdf_link || '&output=application%2Fodata%2Bjson'?>">ODATA/JSON</a> |
-       <a href="<?=rdf_link || '&output=rdf'?>">RDF/XML</a>
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'text/cxml')?>">CXML</a> |
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'text/csv')?>">CSV</a> | RDF (
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'text/plain') ?>">N-Triples</a>
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'text/rdf+n3') ?>">N3/Turtle</a>
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'application/rdf+json')?>">JSON</a> 
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'application/rdf+xml') ?>">XML</a> ) | OData (
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'application/atom+xml')?>">Atom</a> 
+        <a href="<?=rdf_link || sprintf ('&output=%U', 'application/odata+json')?>">JSON</a> )
       </div> <!-- #ft_t -->
       <?vsp } ?>
       <div id="ft_b">
         <a href="http://linkeddata.org/"><img alt="This material is Open Knowledge" src="statics/LoDLogo.gif" style="border-width:0"  /></a>  
         <a href="http://dbpedia.org/sparql"><img alt="W3C Semantic Web Technology" src="statics/sw-sparql-blue.png" style="border-width:0" /></a>     
         <a href="http://www.opendefinition.org/"><img alt="This material is Open Knowledge" src="statics/od_80x15_red_green.png" style="border-width:0" /></a>
-	<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="statics/creativecommons.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 Unported License</a>. <br />
+	<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="statics/creativecommons.png" /></a>
+	<span about=""
+	resource="http://www.w3.org/TR/rdfa-syntax"
+	rel="dc:conformsTo" xmlns:dc="http://purl.org/dc/terms/">
+	<a href="http://validator.w3.org/check?uri=referer"><img
+	    src="http://www.w3.org/Icons/valid-xhtml-rdfa"
+	    alt="Valid XHTML + RDFa" height="27" /></a>
+	</span>
+	<br />
+	This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 Unported License</a>. 
+	<br />
 	<?vsp rdfdesc_virt_info (); ?>
       </div> <!-- #ft_b -->
-    </div> <!-- #footer -->
     <div>
 	<?vsp
 	   if (registry_get ('__rdf_sponge_debug') = '1')
 	     http ('Trace ID: ' || sid);
 	?>
     </div>
+    </div> <!-- #footer -->
 
     <?vsp if (isstring (registry_get ('urchinTracker'))) { ?>
     <script type="text/javascript">
diff --git a/binsrc/rdf_mappers/rdfdesc/statics/LoDLogo.gif b/binsrc/rdf_mappers/rdfdesc/statics/LoDLogo.gif
old mode 100755
new mode 100644
diff --git a/binsrc/rdf_mappers/rdfdesc/statics/openlinklogo_wstrap_2008.png b/binsrc/rdf_mappers/rdfdesc/statics/openlinklogo_wstrap_2008.png
index a6d036c..88a4e89 100644
Binary files a/binsrc/rdf_mappers/rdfdesc/statics/openlinklogo_wstrap_2008.png and b/binsrc/rdf_mappers/rdfdesc/statics/openlinklogo_wstrap_2008.png differ
diff --git a/binsrc/rdf_mappers/rdfdesc/statics/slidebar.css b/binsrc/rdf_mappers/rdfdesc/statics/slidebar.css
index d4f6a04..e9d1ae1 100644
--- a/binsrc/rdf_mappers/rdfdesc/statics/slidebar.css
+++ b/binsrc/rdf_mappers/rdfdesc/statics/slidebar.css
@@ -27,12 +27,7 @@
 .slb_handle {
   width: 15px;
   height: 100%;
-  /*
-  background-color: #575;
-  background-image: url(slidebar_h_bkg.png);
-  background-repeat: repeat;
-  */
-  background-color: #ffffff;
+  background-color: #aaa;
   position: absolute;
   border-right: 2px solid #575;
 }
diff --git a/binsrc/rdf_mappers/rdfdesc/statics/style_w.css b/binsrc/rdf_mappers/rdfdesc/statics/style_w.css
index b8b837b..c639759 100644
--- a/binsrc/rdf_mappers/rdfdesc/statics/style_w.css
+++ b/binsrc/rdf_mappers/rdfdesc/statics/style_w.css
@@ -1,9 +1,8 @@
 html { margin: 0; padding: 0; }
 body {
+  font-size: 10pt;
   font-family: gill sans, sans-serif;
-  font-size: 80%;
-  margin: 0;
-  padding: 1.2em 2em}
+  margin: 0}
 
 #rdficon {
   float: right;
@@ -17,20 +16,18 @@ body {
   width: 100%;
   float: left;
   clear: left;
-  border-bottom: 2px solid #696;
-  margin: 0 0 1.2em;
-  padding: 0 0 0.3em; }
+  border-bottom: 2px solid #696}
 
-#hd_l { width: 64%; float: left;}
-#hd_r { width: 33%; float: right; clear: right; text-align: right; }
+#hd_l { width: 85%; float: left; clear: left; margin: 10px 5px 10px 10px}
+#hd_r { width: 12%; float: right; clear: right; text-align: right; margin: 0 10px 0 5px}
 
 #homelink { display: inline; }
 #homelink, #homelink a { color: #666; }
 #homelink a { font-weight: bold; text-decoration: none; }
 #homelink a:hover { color: red; text-decoration: underline; }
 
-h1, h2 { color: #224; }
-h1 { display: inline; font-weight: bold; font-size: 200%; margin: 0; text-align: left; }
+h1, h2 { font-size: 14pt; color: #224; }
+#entity_info h1 { display: inline; font-weight: bold; margin: 0; text-align: left; }
 h2 { font-weight: normal; font-size: 124%; margin: 1.2em 0 0.2em; }
 
 #sidebar h1 {color: #3c9bbc; font-size: 110%; }
@@ -46,7 +43,7 @@ a.sparql-uri:hover { color: red; text-decoration: underline; }
 
 img { border: none; }
 
-table.description { border-collapse: collapse; clear: left; font-size: 100%; margin: 0 0 1em; width: 100%; }
+table.description { border-collapse: collapse; clear: left; font-size: 100%; margin: 0 0 1em; width: 99%; }
 table.description th { text-align: left; }
 table.description td, table.description th { line-height: 1.2em; padding: 0.2em 0.4em; vertical-align: top; }
 table.description ul { margin: 0; padding-left: 0em; }
@@ -69,25 +66,25 @@ a.rdf_source img { vertical-align: middle;margin-right: 5px;}
 #rdficon:hover { background-color: #eef; border: 1px solid #666;}
 
 #content_wrapper {
-width: 100%; float: left; clear: left;
-}
+  width: 100%; float: left; clear: left;}
 
 #content {
-  /* Needed for static help sidebar, but not for help slidebar
-  width: 64%;
-   */
-  width: 95%;
+  width: 100%;
   float:left;
-  margin: 0;
 }
+
+#attributes { margin: 10px } 
+
+#x_content {
+  width: 100%; 
+  height: 300px;
+  margin-top: 3px;
+  margin-bottom: 3px}
+
+
 #err { color: red; font-size: 120%; }
+
 #sidebar {
-  /* Needed for static help sidebar, but not for help slidebar
-  width: 33%;
-  float: right;
-  margin: 0;
-  border-left: 1px solid #696;
-  */
   padding: 5px 10px 5px 10px;
   color: #4e4e4e;
 }
@@ -99,8 +96,8 @@ width: 100%; float: left; clear: left;
   color: #666;
   border-top: 2px solid #696;
   margin: 1.2em 0 0;
-  padding: 0.3em;
-  background-color: #fff;}
+  background-color: #fff;
+  margin-bottom: 30px}
 
 #ft_r { float: right; clear: right;}
 #ft_t { text-align: center; margin-top: 2ex}
@@ -113,6 +110,10 @@ width: 100%; float: left; clear: left;
   font-size: 0.9em;
 }
 
+#opl_logo { float: left; clear: left; height: 55px; margin-right: 15px}
+#opl_logo img { height: 55px; float: left; clear:left}
+#entity_info { float: left; }
+
 /* area controlled by navigation tabs */
 
 #navarea {
@@ -130,48 +131,43 @@ width: 100%; float: left; clear: left;
 
 /* navigation tabs */
 
-#navlist
-{
+#navlist {
 padding: 3px;
 margin-left: 0;
 padding-bottom: 3px;
-border-bottom: 1px solid #778;
-}
+border-bottom: 1px solid #778 }
 
-#navlist li
-{
+#navlist li {
 list-style: none;
 margin: 0;
 display: inline;
-line-height: 120%;
-}
+  line-height: 120% }
 
-#navlist li a
-{
+#navlist li a {
 padding: 3px 0.5em;
 margin-left: 3px;
 border: 1px solid #778;
 border-bottom: none;
 background: #DDE;
 text-decoration: none;
-line-height: 120%;
-}
+  line-height: 120% }
 
 #navlist li a:link { color: #448; }
 #navlist li a:visited { color: #667; }
 
-#navlist li a:hover
-{
+#navlist li a:hover {
 color: #000;
 background: #AAE;
 border-color: #227;
-border-bottom: none;
-}
+  border-bottom: none }
 
-#navlist li a.current
-{
+#navlist li a.current {
 background: white;
-border-bottom: 1px solid #EAEAEE;
+  border-bottom: none;
 line-height: 120%;
-}
+  padding-bottom: 5px; }
 
+#qrcode { 
+  float: right;
+  clear: right;
+  margin-right: 20px} 
diff --git a/binsrc/rdf_mappers/rdfdesc/statics/virt_power_no_border.png b/binsrc/rdf_mappers/rdfdesc/statics/virt_power_no_border.png
old mode 100755
new mode 100644
diff --git a/binsrc/rdf_mappers/rdfdesc/style/style.css b/binsrc/rdf_mappers/rdfdesc/style/style.css
index 867d48b..b70bd36 100644
--- a/binsrc/rdf_mappers/rdfdesc/style/style.css
+++ b/binsrc/rdf_mappers/rdfdesc/style/style.css
@@ -1,7 +1,13 @@
 html { margin: 0; padding: 0; }
 body { font-family: sans-serif; font-size: 80%; margin: 0; padding: 1.2em 2em;  background: #cec; }
 
-#header { width: 100%; float: left; clear: left; border-bottom: 2px solid #696; margin: 0 0 1.2em; padding: 0 0 0.3em; }
+#header { 
+  width: 100%; 
+  float: left; 
+  clear: left; 
+  border-bottom: 2px solid #696; 
+  margin: 0 0 1.2em; padding: 0 0 0.3em; }
+
 #hd_l { width: 80%; float: left;}
 #hd_r {float: right; clear: right;}
 
@@ -25,7 +31,13 @@ img { border: none; }
 
 #content {width: 100%; float: left; clear: left;}
 
-#footer { width: 100%;float: left; clear: left;border-top: 2px solid #696; margin: 1.2em 0 0; padding: 0.3em; background-color: #fff;}
+#footer { 
+  width: 100%; float: left; clear: left;
+  border-top: 2px solid #696; 
+  margin: 1.2em 0 0; 
+  padding: 0.3em; 
+  background-color: #fff;}
+
 #ft_r { float: right; clear: right;}
 #ft_t { text-align: center; }
 #ft_b { text-align: center; margin-top: 0.7ex }
diff --git a/binsrc/rdf_mappers/vad_version b/binsrc/rdf_mappers/vad_version
index 93c128c..4408ed4 100644
--- a/binsrc/rdf_mappers/vad_version
+++ b/binsrc/rdf_mappers/vad_version
@@ -1 +1 @@
-1.20.23
+1.24.35
diff --git a/binsrc/rdf_mappers/virt_rdf_label.sql b/binsrc/rdf_mappers/virt_rdf_label.sql
new file mode 100644
index 0000000..f07dff8
--- /dev/null
+++ b/binsrc/rdf_mappers/virt_rdf_label.sql
@@ -0,0 +1,102 @@
+--
+--
+--  $Id: virt_rdf_label.sql,v 1.1.4.4 2011/03/23 12:13:19 source Exp $
+--
+--
+--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+--  project.
+--
+--  Copyright (C) 1998-2006 OpenLink Software
+--
+--  This project is free software; you can redistribute it and/or modify it
+--  under the terms of the GNU General Public License as published by the
+--  Free Software Foundation; only version 2 of the License, dated June 1991.
+--
+--  This program is distributed in the hope that it will be useful, but
+--  WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+--  General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License along
+--  with this program; if not, write to the Free Software Foundation, Inc.,
+--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+--
+--
+
+TTLP (
+'@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+ at prefix dc: <http://purl.org/dc/elements/1.1/> .
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ at prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#> .
+ at prefix fbase: <http://rdf.freebase.com/ns/type.object.> .
+ at prefix skos: <http://www.w3.org/2008/05/skos#> .
+ at prefix bibo: <http://purl.org/ontology/bibo/> .
+ at prefix gr: <http://purl.org/goodrelations/v1#> .
+ at prefix cb: <http://www.crunchbase.com/> .
+ at prefix dcterms: <http://purl.org/dc/terms/> .
+ at prefix owl: <http://www.w3.org/2002/07/owl#> .
+ at prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
+ at prefix og: <http://opengraphprotocol.org/schema/> .
+ at prefix dv: <http://rdf.data-vocabulary.org/> .
+ at prefix c: <http://www.w3.org/2002/12/cal/icaltzd#> .
+
+dc:title rdfs:subPropertyOf virtrdf:label .
+rdfs:label rdfs:subPropertyOf virtrdf:label .
+fbase:name rdfs:subPropertyOf virtrdf:label .
+foaf:name rdfs:subPropertyOf virtrdf:label .
+<http://s.opencalais.com/1/pred/name> rdfs:subPropertyOf virtrdf:label .
+foaf:nick rdfs:subPropertyOf virtrdf:label .
+<http://www.w3.org/2004/02/skos/core#prefLabel> rdfs:subPropertyOf virtrdf:label .
+skos:prefLabel rdfs:subPropertyOf virtrdf:label .
+<http://www.geonames.org/ontology#name> rdfs:subPropertyOf virtrdf:label .
+<http://purl.org/dc/terms/title> rdfs:subPropertyOf virtrdf:label .
+foaf:accountName rdfs:subPropertyOf virtrdf:label .
+bibo:shortTitle rdfs:subPropertyOf virtrdf:label .
+<http://s.opencalais.com/1/pred/name> rdfs:subPropertyOf foaf:name .
+cb:source_description rdfs:subPropertyOf foaf:name .
+<http://s.opencalais.com/1/type/er/Company> rdfs:subClassOf gr:BusinessEntity .
+gr:BusinessEntity rdfs:subClassOf foaf:Organization .
+<http://dbpedia.org/ontology/Company> rdfs:subClassOf gr:BusinessEntity .
+<http://purl.org/ontology/mo/MusicArtist> rdfs:subClassOf foaf:Person .
+foaf:maker rdfs:subClassOf dc:creator .
+<http://dbpedia.org/property/name> rdfs:subPropertyOf foaf:name .
+<http://www.w3.org/2002/12/cal/ical#summary> rdfs:subPropertyOf rdfs:label .
+<http://usefulinc.com/ns/doap#name> rdfs:subPropertyOf rdfs:label .
+foaf:topic rdfs:subPropertyOf dcterms:references .
+<http://opengraphprotocol.org/schema/title> owl:equivalentProperty <http://opengraphprotocol.org/schema/title#this> .
+<http://rdfs.org/ns/void#vocabulary> owl:equivalentProperty <http://www.openlinksw.com/schema/attribution/isDescribedUsing> .
+<http://aims.fao.org/aos/geopolitical.owl#nameListEN> rdfs:subPropertyOf rdfs:label .
+<http://aims.fao.org/aos/geopolitical.owl#hasMinLatitude> rdfs:subPropertyOf geo:lat .
+<http://aims.fao.org/aos/geopolitical.owl#hasMinLongitude> rdfs:subPropertyOf geo:long .
+og:latitude rdfs:subPropertyOf geo:lat .
+og:longitude rdfs:subPropertyOf geo:long .
+<http://uberblic.org/ontology/latitude> rdfs:subPropertyOf geo:lat .
+<http://uberblic.org/ontology/longitude> rdfs:subPropertyOf geo:long .
+<http://www.ontosearch.com/2008/02/ontosminer-ns/domain/common/english#Person> rdfs:subClassOf foaf:Person .
+<http://rdfs.org/ns/void#vocabulary> owl:equivalentProperty <http://www.openlinksw.com/schema/attribution#isDescribedUsing> .
+<http://www.rdfabout.com/rdf/schema/ussec/tradingSymbol> a owl:inverseFunctionalProperty . 
+<http://www.rdfabout.com/rdf/schema/ussec/cik> a owl:inverseFunctionalProperty .
+foaf:logo owl:subPropertyOf foaf:depiction .
+<http://umbel.org/umbel#isAbout> owl:equivalentProperty foaf:focus .
+gr:name owl:equivalentProperty foaf:name .
+<http://poolparty.punkt.at/demozone/ont#title> rdfs:subPropertyOf virtrdf:label .
+<http://www.w3.org/2007/05/powder-s#describedby> owl:equivalentProperty <http://www.iana.org/assignments/relation/describedby> .
+<http://dbpedia.org/property/secCik> a owl:inverseFunctionalProperty .
+dv:photo owl:equivalentProperty foaf:depiction .
+dv:instructions owl:equivalentProperty dc:description .
+dv:name rdfs:subPropertyOf virtrdf:label .
+c:summary rdfs:subPropertyOf virtrdf:label .
+c:description owl:equivalentProperty dc:description .
+foaf:img rdfs:subPropertyOf virtrdf:image .
+foaf:depiction rdfs:subPropertyOf virtrdf:image .
+dv:photo rdfs:subPropertyOf virtrdf:image .
+<http://www.openlinksw.com/schemas/virtcxml#Custom-Screen%20Name> owl:equivalentProperty foaf:nick.
+<http://www.openlinksw.com/schemas/virtcxml#Custom-Real%20Name> owl:equivalentProperty foaf:name .
+<http://www.openlinksw.com/schemas/virtcxml#FacetDescription> owl:equivalentProperty dcterms:description .
+<http://www.w3.org/1999/02/22-rdf-syntax-ns#value> rdfs:subPropertyOf virtrdf:label .
+<http://rdf.alchemyapi.com/rdf/v1/s/aapi-schema.rdf#Name> rdfs:subPropertyOf virtrdf:label .
+<http://rdf.freebase.com/ns/common.topic.alias> rdfs:subPropertyOf virtrdf:label .
+', '', 'virtrdf-label');
+
+rdfs_rule_set ('virtrdf-label', 'virtrdf-label');
+
diff --git a/binsrc/rdf_mappers/xslt/main/abmeta2rdfxml.xsl b/binsrc/rdf_mappers/xslt/main/abmeta2rdfxml.xsl
index ffc6912..0ffec56 100644
--- a/binsrc/rdf_mappers/xslt/main/abmeta2rdfxml.xsl
+++ b/binsrc/rdf_mappers/xslt/main/abmeta2rdfxml.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: abmeta2rdfxml.xsl,v 1.1.2.2 2009/08/27 15:09:12 source Exp $
+ -  $Id: abmeta2rdfxml.xsl,v 1.1.2.3 2010/12/09 12:36:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -52,6 +52,7 @@
 
 	<xsl:param name="nss" />
 
+        <xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
 	<xsl:variable name="prefix" select="string($nss//namespace/@prefix)" />
 	<xsl:variable name="ns" select="string($nss//namespace)" />
 
@@ -66,11 +67,11 @@
 	</xsl:template>
 
     <xsl:template match="html">
-		<rdf:Description rdf:about="{$baseUri}">
+		<rdf:Description rdf:about="{$docproxyIRI}">
 			<rdf:type rdf:resource="&bibo;Document"/>
 		</rdf:Description>
 		<xsl:if test="head[@typeof != '']">
-			<rdf:Description rdf:about="{$baseUri}">
+			<rdf:Description rdf:about="{$docproxyIRI}">
 				<sioc:container_of rdf:resource="{vi:proxyIRI($baseUri)}"/>
 				<foaf:topic rdf:resource="{vi:proxyIRI($baseUri)}"/>
 				<dcterms:subject rdf:resource="{vi:proxyIRI($baseUri)}"/>
@@ -98,7 +99,7 @@
 			<xsl:variable name="resourceURI">
 				<xsl:value-of select="normalize-space(a/@href)"/>
 			</xsl:variable>
-			<rdf:Description rdf:about="{$baseUri}">
+			<rdf:Description rdf:about="{$docproxyIRI}">
 				<sioc:container_of rdf:resource="{vi:proxyIRI($resourceURI)}"/>
 				<foaf:topic rdf:resource="{vi:proxyIRI($resourceURI)}"/>
 				<dcterms:subject rdf:resource="{vi:proxyIRI($resourceURI)}"/>
diff --git a/binsrc/rdf_mappers/xslt/main/amazon2rdf.xsl b/binsrc/rdf_mappers/xslt/main/amazon2rdf.xsl
index c387e36..452c0d9 100644
--- a/binsrc/rdf_mappers/xslt/main/amazon2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/amazon2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: amazon2rdf.xsl,v 1.1.2.17 2010/07/08 13:41:53 source Exp $
+ -  $Id: amazon2rdf.xsl,v 1.1.2.21 2011/03/29 22:52:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -64,19 +64,10 @@
     <xsl:param name="associate_key"/>
     <xsl:param name="wish_list" />
 
-	<!-- Amazon provides a short URL http://www.amazon.com/o/ASIN/{asin} for each product  -->
     <xsl:variable name="resourceURL"><xsl:value-of select="vi:proxyIRI (concat ('http://www.amazon.com/o/ASIN/', $asin))"/></xsl:variable>
-	<!-- Usual form used by cartridges:
-    <xsl:variable name="resourceURL"><xsl:value-of select="vi:proxyIRI ($base)"/></xsl:variable>
-	-->
     <xsl:variable name="base"><xsl:value-of select="concat ('http://www.amazon.com/o/ASIN/', $asin)"/></xsl:variable>
     <xsl:variable name="docIRI" select="vi:docIRI($baseUri)"/>
     <xsl:variable name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
-	<!-- For testing with Xalan XSLT processor
-  	<xsl:variable name="resourceURL" select="$base"/>
-  	<xsl:variable  name="docIRI" select="$base"/>
-  	<xsl:variable  name="docproxyIRI" select="$base"/>
-  	-->
 
     <xsl:template match="/">
 		<rdf:RDF>
@@ -119,7 +110,6 @@
 							    </xsl:for-each>
                                                  </rdf:Description>      
 				    </xsl:when>
-			
 			<xsl:otherwise>
 			<rdf:Description rdf:about="{$docproxyIRI}">
 				<rdf:type rdf:resource="&bibo;Document"/>
@@ -127,30 +117,20 @@
 				<dcterms:subject rdf:resource="{$resourceURL}"/>
 				<foaf:primaryTopic rdf:resource="{$resourceURL}"/>
 				<xsl:for-each select="//amz:CustomerReviews/amz:Review">
-				  <!-- Xalan
-				  <foaf:topic rdf:resource="{concat ($base, '#', 'Review_', amz:CustomerId)}"/>
-				  -->
 				  <foaf:topic rdf:resource="{vi:proxyIRI ($base, '', concat('Review_', amz:CustomerId))}"/>
 				</xsl:for-each>
 				<!-- See also 'shortcuts' below for foaf:topic links -->
 				<owl:sameAs rdf:resource="{$docIRI}"/>
 			</rdf:Description>
-
-			<!--
-            <rdf:Description rdf:about="{vi:proxyIRI ($base, '', 'Product')}">
-			-->
             <rdf:Description rdf:about="{$resourceURL}">
 			    <rdf:type rdf:resource="&gr;ProductOrServicesSomeInstancesPlaceholder" />
 			    <rdf:type rdf:resource="&oplamz;Product" />
 	    		<sioc:has_container rdf:resource="{$docproxyIRI}"/>
                 <gr:hasMakeAndModel>
-					<!-- Xalan
-					<rdf:Description rdf:about="{concat ($base, '#', 'MakeAndModel')}">
-					-->
 					<rdf:Description rdf:about="{vi:proxyIRI ($base, '', 'MakeAndModel')}">
 						<rdf:type rdf:resource="&gr;ProductOrServiceModel"/>
 						<rdf:type rdf:resource="&oplamz;Product"/>
-
+						<rdfs:label><xsl:value-of select="//amz:ItemAttributes/amz:Brand"/></rdfs:label>
 						<xsl:variable name="brand" select="//amz:ItemAttributes/amz:Brand"/>
 						<xsl:variable name="model" select="//amz:ItemAttributes/amz:Model"/>
 		               	<rdfs:comment><xsl:value-of select="concat($brand, ' ', $model)"/> </rdfs:comment>
@@ -170,7 +150,31 @@
 				<xsl:apply-templates select="//amz:ItemAttributes"/>
 				<xsl:apply-templates select="//amz:CustomerReviews"/>
 			</rdf:Description>
-
+					<xsl:if test="//amz:ItemAttributes/amz:ListPrice">
+						<gr:Offering rdf:about="{vi:proxyIRI($base, '', 'ListOffer')}">
+							<gr:hasBusinessFunction rdf:resource="&gr;Sell"/>
+							<gr:validFrom rdf:datatype="&xsd;dateTime"><xsl:value-of select="$currentDateTime"/></gr:validFrom>
+							<gr:includes rdf:resource="{$resourceURL}"/>
+							<gr:availableDeliveryMethods rdf:resource="&gr;DeliveryModePickup"/>
+							<gr:availableDeliveryMethods rdf:resource="&gr;UPS"/>
+							<gr:availableDeliveryMethods rdf:resource="&gr;DeliveryModeMail"/>
+							<rdfs:label><xsl:value-of select="concat('List offer: ', //amz:ItemAttributes/amz:Title)"/></rdfs:label>
+							<oplamz:hasListPrice>
+								<gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($base, '', 'ListPrice')}">
+									<rdfs:label>
+										<xsl:value-of select="concat( //amz:ItemAttributes/amz:ListPrice/amz:Amount div 100, ' (', //amz:ItemAttributes/amz:ListPrice/amz:CurrencyCode ,')')"/>	
+									</rdfs:label>
+									<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>	
+									<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="//amz:ItemAttributes/amz:ListPrice/amz:Amount div 100"/></gr:hasCurrencyValue>
+									<gr:hasCurrency rdf:datatype="&xsd;string"><xsl:value-of select="//amz:ItemAttributes/amz:ListPrice/amz:CurrencyCode"/></gr:hasCurrency>
+									<gr:priceType rdf:datatype="&xsd;string">List price</gr:priceType>
+								</gr:UnitPriceSpecification>
+							</oplamz:hasListPrice>
+						</gr:Offering>
+						<rdf:Description rdf:about="{$docproxyIRI}">
+							<foaf:topic rdf:resource="{vi:proxyIRI ($base, '', 'ListOffer')}"/>	
+						</rdf:Description>
+					</xsl:if>
 			<xsl:apply-templates select="//amz:Offer" mode="offering"/>
 			</xsl:otherwise>
 			</xsl:choose>
@@ -180,9 +184,6 @@
     <xsl:template match="amz:Offer" mode="offering">
 		<xsl:element namespace="&gr;" name="Offering">
 			<xsl:attribute name="rdf:about">
-				<!-- Xalan
-				<xsl:value-of select="concat ($base, '#', 'Offer_', position())"/>
-				-->
 				<xsl:value-of select="concat (vi:proxyIRI($base, '', 'Offer_'), position())"/>
 			</xsl:attribute>
 			<xsl:if test="$associate_key != ''">
@@ -191,36 +192,31 @@
 	    	<gr:hasBusinessFunction rdf:resource="&gr;Sell"/>
 		    <gr:validFrom rdf:datatype="&xsd;dateTime"><xsl:value-of select="$currentDateTime"/></gr:validFrom>
 	    	<gr:includes rdf:resource="{$resourceURL}"/>
-			<!-- TO DO: Other delivery methods? -->
 		    <gr:availableDeliveryMethods rdf:resource="&gr;DeliveryModePickup"/>
 			<gr:availableDeliveryMethods rdf:resource="&gr;UPS"/>
 			<gr:availableDeliveryMethods rdf:resource="&gr;DeliveryModeMail"/>
-	    	<rdfs:label><xsl:value-of select="//amz:ItemAttributes/amz:Title"/></rdfs:label>
+	    	<rdfs:label><xsl:value-of select="concat('Offer ', position(), ':', //amz:ItemAttributes/amz:Title)"/></rdfs:label>
 			<gr:hasEAN_UCC-13><xsl:value-of select="//amz:ItemAttributes/amz:EAN"/></gr:hasEAN_UCC-13>
 			<oplamz:condition><xsl:value-of select="./amz:OfferAttributes/amz:Condition"/></oplamz:condition>
 			<oplamz:conditionNote><xsl:value-of select="./amz:OfferAttributes/amz:ConditionNote"/></oplamz:conditionNote>
 			<oplamz:availability><xsl:value-of select="./amz:OfferListing/amz:Availability"/></oplamz:availability>
 			<oplamz:offerListingId><xsl:value-of select="./amz:OfferListing/amz:OfferListingId"/></oplamz:offerListingId>
 			<oplamz:merchantId><xsl:value-of select="./amz:Merchant/amz:MerchantId"/></oplamz:merchantId>
-
 			<gr:hasPriceSpecification>
-				<!-- Xalan
-		  		<gr:UnitPriceSpecification rdf:about="{concat ($base, '#', 'OfferPrice_', position())}">
-				-->
 		  		<gr:UnitPriceSpecification rdf:about="{concat(vi:proxyIRI ($base, '', 'OfferPrice_'), position())}">
-					<rdfs:label>Offer price</rdfs:label>
+					<rdfs:label>
+						<xsl:value-of select="concat( ./amz:OfferListing/amz:Price/amz:Amount div 100, ' (', ./amz:OfferListing/amz:Price/amz:CurrencyCode ,')')"/>	
+					</rdfs:label>
 					<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
             		<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="./amz:OfferListing/amz:Price/amz:Amount div 100"/></gr:hasCurrencyValue>
             		<gr:hasCurrency rdf:datatype="&xsd;string"><xsl:value-of select="./amz:OfferListing/amz:Price/amz:CurrencyCode"/></gr:hasCurrency>
+					<gr:priceType rdf:datatype="&xsd;string">offer price</gr:priceType>
           		</gr:UnitPriceSpecification>
 			</gr:hasPriceSpecification>
 		</xsl:element>
 
 		<xsl:element namespace="&gr;" name="BusinessEntity">
 			<xsl:attribute name='rdf:about'>
-				<!-- Xalan
-				<xsl:value-of select="concat ($base, '#', 'Vendor_', position())"/>
-				-->
 				<xsl:value-of select="concat (vi:proxyIRI($base, '', 'Vendor_'), position())"/>
 			</xsl:attribute>
 			<rdfs:comment>The legal agent making the offering</rdfs:comment>
@@ -229,9 +225,6 @@
 		    <gr:legalName><xsl:value-of select="concat('MERCHANTID_', ./amz:Merchant/amz:MerchantId)"/></gr:legalName>
 		    <gr:offers>
 				<xsl:attribute name='rdf:resource'>
-					<!-- Xalan
-					<xsl:value-of select="concat ($base, '#', 'Offer_', position())"/>
-					-->
 					<xsl:value-of select="concat (vi:proxyIRI($base, '', 'Offer_'), position())"/>
 				</xsl:attribute>
 			</gr:offers>
@@ -243,12 +236,7 @@
 		<rdf:Description rdf:about="{$docproxyIRI}">
 			<foaf:topic rdf:resource="{concat (vi:proxyIRI ($base, '', 'Vendor_'), position())}"/>
 			<foaf:topic rdf:resource="{concat (vi:proxyIRI ($base, '', 'Offer_'), position())}"/>
-			<!-- Xalan
-			<foaf:topic rdf:resource="{concat ($base, '#', 'Vendor_', position())}"/>
-			<foaf:topic rdf:resource="{concat ($base, '#', 'Offer_', position())}"/>
-			-->
 		</rdf:Description>
-
     </xsl:template>
 
     <xsl:template match="amz:CustomerReviews/amz:AverageRating">
@@ -257,9 +245,6 @@
 
     <xsl:template match="amz:CustomerReviews/amz:Review">
 		<review:hasReview>
-			<!-- Xalan
-			<review:Review rdf:about="{concat ($base, '#', 'Review_', amz:CustomerId)}">
-			-->
 			<review:Review rdf:about="{vi:proxyIRI ($base, '', concat('Review_', amz:CustomerId))}">
 				<rdfs:label><xsl:value-of select="amz:Summary"/></rdfs:label>
 				<review:title><xsl:value-of select="amz:Summary"/></review:title>
@@ -274,11 +259,8 @@
 
     <xsl:template match="amz:ItemAttributes/amz:Manufacturer" mode="manufacturer">
 		<gr:hasManufacturer>
-			<!-- Xalan
-			<gr:BusinessEntity rdf:about="{concat ($base, '#', 'Manufacturer')}">
-			-->
 			<gr:BusinessEntity rdf:about="{vi:proxyIRI ($base, '', 'Manufacturer')}">
-				<rdfs:label>Manufacturer</rdfs:label>
+				<rdfs:label><xsl:value-of select="."/></rdfs:label>
 				<gr:legalName><xsl:value-of select="."/></gr:legalName>
 			</gr:BusinessEntity>
 		</gr:hasManufacturer>
@@ -306,36 +288,18 @@
     <xsl:template match="amz:ItemAttributes/amz:Title">
 		<rdfs:comment><xsl:value-of select="."/></rdfs:comment>
 		<dc:title><xsl:value-of select="."/></dc:title>
-        <rdfs:label><xsl:value-of select="."/></rdfs:label>
+        <rdfs:label><xsl:value-of select="concat('Product:', .)"/></rdfs:label>
     </xsl:template>
     <xsl:template match="amz:ItemAttributes/amz:ProductGroup">
 		<oplamz:productGroup><xsl:value-of select="."/></oplamz:productGroup>
     </xsl:template>
 
-    <xsl:template match="amz:ItemAttributes/amz:ListPrice">
-	    <!-- gr:hasPriceSpecification domain doesn't include gr:ProductOrService -->
-		<oplamz:hasListPrice>
-			<!-- Xalan
-		  	<gr:UnitPriceSpecification rdf:about="{concat ($base, '#', 'ListPrice')}">
-			-->
-			<gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($base, '', 'ListPrice')}">
-				<rdfs:label>List price</rdfs:label>
-				<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
-           		<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="amz:Amount div 100"/></gr:hasCurrencyValue>
-           		<gr:hasCurrency rdf:datatype="&xsd;string"><xsl:value-of select="amz:CurrencyCode"/></gr:hasCurrency>
-          	</gr:UnitPriceSpecification>
-		</oplamz:hasListPrice>
-    </xsl:template>
-
     <xsl:template match="amz:ItemAttributes/amz:Feature">
 		<oplamz:feature><xsl:value-of select="."/></oplamz:feature>
     </xsl:template>
 
     <xsl:template match="amz:ItemAttributes/amz:PackageDimensions/Height">
 		<oplamz:packageHeight>
-			<!-- Xalan
-			<gr:QuantitativeValueFloat rdf:about="{concat ($base, '#', 'PackageHeight')}">
-			-->
 			<gr:QuantitativeValueFloat rdf:about="{vi:proxyIRI ($base, '', 'PackageHeight')}">
 				<xsl:choose>
 					<xsl:when test="contains(@Units , 'hundredths-inches')">
@@ -343,6 +307,7 @@
 							<xsl:value-of select=". div 100"/>
 						</gr:hasValueFloat>
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. div 100, ' (INH)')"/></rdfs:label>
 					</xsl:when>
 					<xsl:otherwise>
 						<gr:hasValueFloat rdf:datatype="&xsd;float">
@@ -351,6 +316,7 @@
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">
 							<xsl:value-of select="@Units"/>
 						</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. , ' (', @Units, ')')"/></rdfs:label>
 					</xsl:otherwise>
 				</xsl:choose>
 			</gr:QuantitativeValueFloat>
@@ -359,9 +325,6 @@
 
     <xsl:template match="amz:ItemAttributes/amz:PackageDimensions/amz:Weight">
 		<oplamz:packageWeight>
-			<!-- Xalan
-	  		<gr:QuantitativeValueFloat rdf:about="{concat ($base, '#', 'PackageWeight')}">
-			-->
 	  		<gr:QuantitativeValueFloat rdf:about="{vi:proxyIRI ($base, '', 'PackageWeight')}">
 				<xsl:choose>
 					<xsl:when test="contains(@Units , 'hundredths-pounds')">
@@ -369,6 +332,7 @@
 							<xsl:value-of select=". div 100"/>
 						</gr:hasValueFloat>
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">LBR</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. div 100, ' (LBR)')"/></rdfs:label>
 					</xsl:when>
 					<xsl:otherwise>
 						<gr:hasValueFloat rdf:datatype="&xsd;float">
@@ -377,6 +341,7 @@
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">
 							<xsl:value-of select="@Units"/>
 						</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(., ' (', @Units, ')')"/></rdfs:label>
 					</xsl:otherwise>
 				</xsl:choose>
 	  		</gr:QuantitativeValueFloat>
@@ -385,9 +350,6 @@
 
     <xsl:template match="amz:ItemAttributes/amz:PackageDimensions/amz:Length">
 		<oplamz:packageLength>
-			<!-- Xalan
-			<gr:QuantitativeValueFloat rdf:about="{concat ($base, '#', 'PackageLength')}">
-			-->
 			<gr:QuantitativeValueFloat rdf:about="{vi:proxyIRI ($base, '', 'PackageLength')}">
 				<xsl:choose>
 					<xsl:when test="contains(@Units , 'hundredths-inches')">
@@ -395,6 +357,7 @@
 							<xsl:value-of select=". div 100"/>
 						</gr:hasValueFloat>
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. div 100, ' (INH)')"/></rdfs:label>
 					</xsl:when>
 					<xsl:otherwise>
 						<gr:hasValueFloat rdf:datatype="&xsd;float">
@@ -403,6 +366,7 @@
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">
 							<xsl:value-of select="@Units"/>
 						</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. , ' (', @Units, ')')"/></rdfs:label>
 					</xsl:otherwise>
 				</xsl:choose>
 			</gr:QuantitativeValueFloat>
@@ -421,6 +385,7 @@
 							<xsl:value-of select=". div 100"/>
 						</gr:hasValueFloat>
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. div 100, ' (INH)')"/></rdfs:label>
 					</xsl:when>
 					<xsl:otherwise>
 						<gr:hasValueFloat rdf:datatype="&xsd;float">
@@ -429,6 +394,7 @@
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">
 							<xsl:value-of select="@Units"/>
 						</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. , ' (', @Units, ')')"/></rdfs:label>
 					</xsl:otherwise>
 				</xsl:choose>
 			</gr:QuantitativeValueFloat>
@@ -437,9 +403,6 @@
 
     <xsl:template match="amz:ItemAttributes/amz:ItemDimensions/Height">
 		<oplamz:itemHeight>
-			<!-- Xalan
-			<gr:QuantitativeValueFloat rdf:about="{concat ($base, '#', 'ItemHeight')}">
-			-->
 			<gr:QuantitativeValueFloat rdf:about="{vi:proxyIRI ($base, '', 'ItemHeight')}">
 				<xsl:choose>
 					<xsl:when test="contains(@Units , 'hundredths-inches')">
@@ -447,6 +410,7 @@
 							<xsl:value-of select=". div 100"/>
 						</gr:hasValueFloat>
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. div 100, ' (INH)')"/></rdfs:label>
 					</xsl:when>
 					<xsl:otherwise>
 						<gr:hasValueFloat rdf:datatype="&xsd;float">
@@ -455,6 +419,7 @@
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">
 							<xsl:value-of select="@Units"/>
 						</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. , ' (', @Units, ')')"/></rdfs:label>
 					</xsl:otherwise>
 				</xsl:choose>
 			</gr:QuantitativeValueFloat>
@@ -463,9 +428,6 @@
 
     <xsl:template match="amz:ItemAttributes/amz:ItemDimensions/amz:Weight">
 		<oplamz:itemWeight>
-			<!-- Xalan
-	  		<gr:QuantitativeValueFloat rdf:about="{concat ($base, '#', 'ItemWeight')}">
-			-->
 	  		<gr:QuantitativeValueFloat rdf:about="{vi:proxyIRI ($base, '', 'ItemWeight')}">
 				<xsl:choose>
 					<xsl:when test="contains(@Units , 'hundredths-pounds')">
@@ -473,6 +435,7 @@
 							<xsl:value-of select=". div 100"/>
 						</gr:hasValueFloat>
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">LBR</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. div 100, ' (LBR)')"/></rdfs:label>
 					</xsl:when>
 					<xsl:otherwise>
 						<gr:hasValueFloat rdf:datatype="&xsd;float">
@@ -481,6 +444,7 @@
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">
 							<xsl:value-of select="@Units"/>
 						</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. , ' (', @Units, ')')"/></rdfs:label>
 					</xsl:otherwise>
 				</xsl:choose>
 	  		</gr:QuantitativeValueFloat>
@@ -489,9 +453,6 @@
 
     <xsl:template match="amz:ItemAttributes/amz:ItemDimensions/amz:Length">
 		<oplamz:itemLength>
-			<!-- Xalan
-			<gr:QuantitativeValueFloat rdf:about="{concat ($base, '#', 'ItemLength')}">
-			-->
 			<gr:QuantitativeValueFloat rdf:about="{vi:proxyIRI ($base, '', 'ItemLength')}">
 				<xsl:choose>
 					<xsl:when test="contains(@Units , 'hundredths-inches')">
@@ -499,6 +460,7 @@
 							<xsl:value-of select=". div 100"/>
 						</gr:hasValueFloat>
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. div 100, ' (INH)')"/></rdfs:label>
 					</xsl:when>
 					<xsl:otherwise>
 						<gr:hasValueFloat rdf:datatype="&xsd;float">
@@ -507,6 +469,7 @@
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">
 							<xsl:value-of select="@Units"/>
 						</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. , ' (', @Units, ')')"/></rdfs:label>
 					</xsl:otherwise>
 				</xsl:choose>
 			</gr:QuantitativeValueFloat>
@@ -515,9 +478,6 @@
 
 	<xsl:template match="amz:ItemAttributes/amz:ItemDimensions/amz:Width">
 		<oplamz:itemWidth>
-			<!-- Xalan
-			<gr:QuantitativeValueFloat rdf:about="{concat ($base, '#', 'ItemWidth')}">
-			-->
 			<gr:QuantitativeValueFloat rdf:about="{vi:proxyIRI ($base, '', 'ItemWidth')}">
 				<xsl:choose>
 					<xsl:when test="contains(@Units , 'hundredths-inches')">
@@ -525,6 +485,7 @@
 							<xsl:value-of select=". div 100"/>
 						</gr:hasValueFloat>
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. div 100, ' (INH)')"/></rdfs:label>
 					</xsl:when>
 					<xsl:otherwise>
 						<gr:hasValueFloat rdf:datatype="&xsd;float">
@@ -533,6 +494,7 @@
 						<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">
 							<xsl:value-of select="@Units"/>
 						</gr:hasUnitOfMeasurement>
+						<rdfs:label><xsl:value-of select="concat(. , ' (', @Units, ')')"/></rdfs:label>
 					</xsl:otherwise>
 				</xsl:choose>
 			</gr:QuantitativeValueFloat>
diff --git a/binsrc/rdf_mappers/xslt/main/atom2rdf.xsl b/binsrc/rdf_mappers/xslt/main/atom2rdf.xsl
index b69a2fe..c826500 100644
--- a/binsrc/rdf_mappers/xslt/main/atom2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/atom2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: atom2rdf.xsl,v 1.1.2.7 2010/06/25 11:19:15 source Exp $
+ -  $Id: atom2rdf.xsl,v 1.1.2.8 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -119,7 +119,7 @@
 </xsl:template>
 
 <xsl:template match="a:published">
-    <dc:date><xsl:value-of select="."/></dc:date>
+        <dcterms:created><xsl:value-of select="."/></dcterms:created>
 </xsl:template>
 
 <xsl:template match="a:link[@href]">
diff --git a/binsrc/rdf_mappers/xslt/main/atomdoc2rdf.xsl b/binsrc/rdf_mappers/xslt/main/atomdoc2rdf.xsl
index 639a31f..e5b5db4 100644
--- a/binsrc/rdf_mappers/xslt/main/atomdoc2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/atomdoc2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: atomdoc2rdf.xsl,v 1.1.2.4 2009/12/30 12:18:54 source Exp $
+ -  $Id: atomdoc2rdf.xsl,v 1.1.2.5 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -133,7 +133,7 @@
 </xsl:template>
 
 <xsl:template match="a:published">
-    <dc:date><xsl:value-of select="."/></dc:date>
+    <dcterms:created><xsl:value-of select="."/></dcterms:created>
 </xsl:template>
 
 <xsl:template match="a:link[@href]">
diff --git a/binsrc/rdf_mappers/xslt/main/atomentry2rdf.xsl b/binsrc/rdf_mappers/xslt/main/atomentry2rdf.xsl
index a02f10d..477f7e3 100644
--- a/binsrc/rdf_mappers/xslt/main/atomentry2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/atomentry2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: atomentry2rdf.xsl,v 1.1.2.7 2009/12/30 12:18:54 source Exp $
+ -  $Id: atomentry2rdf.xsl,v 1.1.2.10 2011/03/08 13:36:28 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -36,6 +36,7 @@
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   xmlns:r="http://backend.userland.com/rss2"
   xmlns="http://purl.org/rss/1.0/"
+  xmlns:dcterms = "http://purl.org/dc/terms/"
   xmlns:rss="http://purl.org/rss/1.0/"
   xmlns:itunes="http://www.itunes.com/DTDs/Podcast-1.0.dtd"
   xmlns:a="http://www.w3.org/2005/Atom"
@@ -83,19 +84,15 @@
 </xsl:template>
 
 <xsl:template match="a:title">
-  <title><xsl:value-of select="." /></title>
+  <dc:title><xsl:value-of select="." /></dc:title>
 </xsl:template>
 
 <xsl:template match="a:content">
   <dc:description><xsl:call-template name="removeTags" /></dc:description>
-  <description><xsl:value-of select="." /></description>
-  <!--xsl:if test="not(../content:encoded)">
-    <content:encoded><xsl:value-of select="." /></content:encoded>
-  </xsl:if-->
 </xsl:template>
 
 <xsl:template match="a:published">
-    <dc:date><xsl:value-of select="."/></dc:date>
+    <dcterms:created><xsl:value-of select="."/></dcterms:created>
 </xsl:template>
 
 <xsl:template match="a:link[@href]">
@@ -103,25 +100,17 @@
 </xsl:template>
 
 <xsl:template match="a:author">
-    <xsl:choose>
-	<xsl:when test="//yt:*">
-	    <foaf:maker rdf:resource="http://www.youtube.com/user/{a:name}"/>
-	</xsl:when>
-	<xsl:otherwise>
-	    <dc:creator><xsl:value-of select="a:name" /> <<xsl:value-of select="a:email" />></dc:creator>
-<foaf:mbox rdf:resource="mailto:{a:email}"/>
-	</xsl:otherwise>
-    </xsl:choose>
+  <dcterms:creator rdf:resource="{vi:proxyIRI(concat('http://www.youtube.com/user/', a:name)) }"/>
 </xsl:template>
 
 <xsl:template match="a:entry">
     <xsl:apply-templates select="media:*|yt:*" mode="media"/>
-    <item rdf:about="{a:link[@href]/@href}">
+    <rdf:Description rdf:about="{$resourceURL}">
 	<xsl:apply-templates/>
 	<xsl:if test="a:category[@term]">
 	    <xsl:for-each select="a:category[@term]">
 		<sioc:topic>
-		    <skos:Concept rdf:about="{concat (/a:feed/a:link[@rel='self']/@href, '#', @term)}">
+              <skos:Concept rdf:about="{vi:proxyIRI ($baseUri, '', @term)}">
 			<skos:prefLabel>
 			    <xsl:value-of select="@term"/>
 			</skos:prefLabel>
@@ -129,8 +118,7 @@
 		</sioc:topic>
 	    </xsl:for-each>
 	</xsl:if>
-	<xsl:apply-templates select="g:*|gd:*"/>
-    </item>
+    </rdf:Description>
 </xsl:template>
 
 <xsl:template match="yt:statistics" mode="media">
@@ -150,19 +138,11 @@
 		<nfo:duration>
 			<xsl:value-of select="yt:duration/@seconds"/>
 		</nfo:duration>
-	</rdf:Description>
-	<xsl:apply-templates select="media:*" mode="media"/>
-</xsl:template>
-
-<xsl:template match="text()" mode="media"/>
-
-<xsl:template match="media:content[@yt:format='5']" mode="media">
-    <rdf:Description rdf:about="{$resourceURL}">
 	<content:encoded rdf:parseType="Literal">
 	    <object width="425" height="350" xmlns="">
-		<param name="movie" value="{@url}">
+				<param name="movie" value="{media:content[@yt:format='5']/@url}">
 		</param>
-		<embed src="{@url}" type="{@type}" width="425" height="350">
+				<embed src="{media:content[@yt:format='5']/@url}" type="{media:content[@yt:format='5']/@type}" width="425" height="350">
 		</embed>
 	    </object>
 	</content:encoded>
@@ -170,9 +150,7 @@
 </xsl:template>
 
 <xsl:template match="g:*|gd:*">
-    <xsl:element name="{local-name(.)}" namespace="http://www.openlinksw.com/schemas/google-base#">
-	<xsl:value-of select="."/>
-    </xsl:element>
+    <xsl:copy-of select="." />
 </xsl:template>
 
 <xsl:template name="removeTags">
@@ -180,4 +158,7 @@
     <xsl:value-of select="normalize-space(string($post))" />
 </xsl:template>
 
+<xsl:template match="text()" mode="media"/>
+
+
 </xsl:stylesheet>
diff --git a/binsrc/rdf_mappers/xslt/main/bestbuy2rdf.xsl b/binsrc/rdf_mappers/xslt/main/bestbuy2rdf.xsl
index 5e3d586..55f6c6a 100644
--- a/binsrc/rdf_mappers/xslt/main/bestbuy2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/bestbuy2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: bestbuy2rdf.xsl,v 1.1.2.16 2010/06/07 13:25:37 source Exp $
+ -  $Id: bestbuy2rdf.xsl,v 1.1.2.22 2011/03/29 22:52:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -28,6 +28,7 @@
 <!ENTITY bibo "http://purl.org/ontology/bibo/">
 <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
 <!ENTITY dcterms "http://purl.org/dc/terms/">
+<!ENTITY vcard "http://www.w3.org/2001/vcard-rdf/3.0#">
 <!ENTITY sioc "http://rdfs.org/sioc/ns#">
 <!ENTITY owl "http://www.w3.org/2002/07/owl#">
 <!ENTITY gr "http://purl.org/goodrelations/v1#">
@@ -37,6 +38,7 @@
 <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+    xmlns:vcard="&vcard;"	
     xmlns:rdf="&rdf;"
     xmlns:rdfs="&rdfs;"
     xmlns:foaf="&foaf;"
@@ -48,12 +50,14 @@
     xmlns:bestbuy="http://remix.bestbuy.com/"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:cl="&cl;"
+    xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"	
     xmlns:oplbb="&oplbb;">
 
     <xsl:output method="xml" indent="yes" />
 
     <xsl:param name="baseUri"/>
     <xsl:param name="currentDateTime"/>
+    <xsl:param name="is_store"/>
     <xsl:variable name="resourceURL" select="vi:proxyIRI ($baseUri)"/>
     <xsl:variable  name="docIRI" select="vi:docIRI($baseUri)"/>
     <xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
@@ -62,6 +66,54 @@
 
     <xsl:template match="/">
 		<rdf:RDF>
+			<xsl:choose>
+				<xsl:when test="$is_store = '1'">
+					<rdf:Description rdf:about="{$docproxyIRI}">
+						<rdf:type rdf:resource="&bibo;Document"/>
+						<sioc:container_of rdf:resource="{$resourceURL}"/>
+						<foaf:primaryTopic rdf:resource="{$resourceURL}"/>
+						<dcterms:subject rdf:resource="{$resourceURL}"/>
+					</rdf:Description>
+					<gr:LocationOfSalesOrServiceProvisioning rdf:about="{$resourceURL}">
+						<gr:hasOpeningHoursSpecification>
+							<gr:OpeningHoursSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'OpenHoursSpecification')}">
+								<gr:opens><xsl:value-of select="/stores/store/hours"/></gr:opens>
+							</gr:OpeningHoursSpecification>
+						</gr:hasOpeningHoursSpecification>
+						<rdfs:label><xsl:value-of select="/stores/store/longName"/></rdfs:label>
+						<gr:name><xsl:value-of select="/stores/store/name"/></gr:name>
+						<gr:legalName><xsl:value-of select="/stores/store/longName"/></gr:legalName> 
+						<geo:lat rdf:datatype="&xsd;float">
+							<xsl:value-of select="/stores/store/lat"/>
+						</geo:lat>
+						<geo:long rdf:datatype="&xsd;float">
+							<xsl:value-of select="/stores/store/lng"/>
+						</geo:long>
+						<foaf:phone rdf:resource="tel:{/stores/store/phone}"/>
+						<vcard:ADR>
+							<rdf:Description rdf:about="{vi:proxyIRI ($baseUri, '', 'Address')}">
+								<rdf:type rdf:resource="&vcard;ADR"/>
+								<vcard:Locality>
+									<xsl:value-of select="/stores/store/city" />
+								</vcard:Locality>
+								<vcard:Region>
+									<xsl:value-of select="/stores/store/region"/>
+								</vcard:Region>
+								<vcard:Country>
+									<xsl:value-of select="/stores/store/country"/>
+								</vcard:Country>
+								<vcard:Pcode>
+									<xsl:value-of select="/stores/store/postalCode"/>
+								</vcard:Pcode>
+								<vcard:Extadd>
+									<xsl:value-of select="/stores/store/address"/>
+								</vcard:Extadd>
+								<rdfs:label><xsl:value-of select="concat(/stores/store/address, ', ', /stores/store/city, ', ', /stores/store/postalCode, ', ', /stores/store/country)"/></rdfs:label>
+							</rdf:Description>
+						</vcard:ADR>
+					</gr:LocationOfSalesOrServiceProvisioning>
+				</xsl:when>
+				<xsl:otherwise>
 			<rdf:Description rdf:about="{$docproxyIRI}">
 				<rdf:type rdf:resource="&bibo;Document"/>
 				<sioc:container_of rdf:resource="{vi:proxyIRI ($baseUri, '', 'Product')}"/>
@@ -74,7 +126,7 @@
 			<gr:Offering rdf:about="{$resourceURL}">
 			    <sioc:has_container rdf:resource="{$docproxyIRI}"/>
 			    <gr:hasBusinessFunction rdf:resource="&gr;Sell"/>
-			    <rdfs:label><xsl:value-of select="//product/name"/></rdfs:label>
+						<rdfs:label><xsl:value-of select="concat('Offer: ', //product/name)"/></rdfs:label>
 			    <!-- For testing with standalone XSLT processor
 			    <gr:includes rdf:resource="{concat ($baseUri, '#', 'Product')}"/>
 			    -->
@@ -121,7 +173,8 @@
 
 			   <xsl:apply-templates select="//product" />
 			</rdf:Description>
-
+				</xsl:otherwise>
+			</xsl:choose>
 		</rdf:RDF>
     </xsl:template>
 
@@ -137,11 +190,13 @@
 	    <gr:UnitPriceSpecification rdf:about="{concat ($baseUri, '#', 'UnitPriceSpecification')}">
 	    -->
 	    <gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'UnitPriceSpecification')}">
-	        <rdfs:label>sale price</rdfs:label>
+	        <rdfs:label>
+			<xsl:value-of select="concat( ., ' (USD)')"/>	
+		</rdfs:label>
 		<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
 		<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="."/></gr:hasCurrencyValue>
 		<gr:hasCurrency rdf:datatype="&xsd;string">USD</gr:hasCurrency>
-		<!-- Absence of gr:priceType property indicates this is the actual sale price not, say, a suggested retail price (SRP) -->
+	        <gr:priceType rdf:datatype="&xsd;string">regular price</gr:priceType>
 	    </gr:UnitPriceSpecification>
 	</gr:hasPriceSpecification>
     </xsl:template>
@@ -152,7 +207,9 @@
 	    <gr:UnitPriceSpecification rdf:about="{concat ($baseUri, '#', 'UnitPriceSpecification_SRP')}">
 	    -->
 	    <gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'UnitPriceSpecification_SRP')}">
-	        <rdfs:label>suggested retail price</rdfs:label>
+	        <rdfs:label>
+			<xsl:value-of select="concat( ., ' (USD)')"/>	
+		</rdfs:label>
 		<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
 	        <gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="."/></gr:hasCurrencyValue>
 	        <gr:hasCurrency rdf:datatype="&xsd;string">USD</gr:hasCurrency>
@@ -167,11 +224,14 @@
 	    <gr:DeliveryChargeSpecification rdf:about="{concat ($baseUri, '#', 'DeliveryChargeSpecification')}">
 	    -->
 	    <gr:DeliveryChargeSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'DeliveryChargeSpecification')}">
-	        <rdfs:label>shipping charge</rdfs:label>
+	        <rdfs:label>
+			<xsl:value-of select="concat('shipping charge: ', ., ' (USD)')"/>	
+		</rdfs:label>
 		<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
 	        <gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="."/></gr:hasCurrencyValue>
 	        <gr:hasCurrency rdf:datatype="&xsd;string">USD</gr:hasCurrency>
 		<gr:eligibleRegions rdf:datatype="&xsd;string">US</gr:eligibleRegions>
+	        <gr:priceType rdf:datatype="&xsd;string">shipping price</gr:priceType>
 	    </gr:DeliveryChargeSpecification>
 	</gr:hasPriceSpecification>
     </xsl:template>
@@ -184,9 +244,9 @@
 		<rdfs:label>
 			<xsl:value-of select="."/>
 		</rdfs:label>
-		<dc:title>
+		<gr:name>
 			<xsl:value-of select="."/>
-		</dc:title>
+		</gr:name>
     </xsl:template>
 
     <xsl:template match="product/dollarSavings" mode="offering">
@@ -195,6 +255,9 @@
 	    <gr:QuantitativeValueFloat rdf:about="{concat ($baseUri, '#', 'DollarSaving')}">
 	    -->
 	    <gr:QuantitativeValueFloat rdf:about="{vi:proxyIRI ($baseUri, '', 'DollarSaving')}">
+	        <rdfs:label>
+			<xsl:value-of select="concat(., ' (USD)')"/>	
+		</rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">USD</gr:hasUnitOfMeasurement>
 		<gr:hasValueFloat rdf:datatype="&xsd;float"><xsl:value-of select="."/></gr:hasValueFloat>
 	    </gr:QuantitativeValueFloat>
@@ -276,7 +339,9 @@
 	    <gr:BusinessEntity rdf:about="{concat ($baseUri, '#', 'Manufacturer')}">
 	    -->
 	    <gr:BusinessEntity rdf:about="{vi:proxyIRI ($baseUri, '', 'Manufacturer')}">
-		<rdfs:label>Manufacturer</rdfs:label>
+		<rdfs:label>
+			<xsl:value-of select="."/>	
+		</rdfs:label>
 		<gr:legalName><xsl:value-of select="."/></gr:legalName>
 	    </gr:BusinessEntity>
 	</gr:hasManufacturer>
@@ -308,18 +373,21 @@
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="normalize-space(substring-before(., 'lb'))"/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(normalize-space(substring-before(., 'lb')), ' (LBR)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">LBR</gr:hasUnitOfMeasurement>
 	      </xsl:when>
 	      <xsl:when test="contains(. , 'oz')">
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="normalize-space(substring-before(., 'oz'))"/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(normalize-space(substring-before(., 'oz')), ' (ONZ)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">ONZ</gr:hasUnitOfMeasurement>
 	      </xsl:when>
 	      <xsl:otherwise>
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="."/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(., ' (LBR)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">LBR</gr:hasUnitOfMeasurement>
 	      </xsl:otherwise>
 	    </xsl:choose>
@@ -338,18 +406,21 @@
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="normalize-space(substring-before(., 'lb'))"/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(normalize-space(substring-before(., 'lb')), ' (LBR)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">LBR</gr:hasUnitOfMeasurement>
 	      </xsl:when>
 	      <xsl:when test="contains(. , 'oz')">
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="normalize-space(substring-before(., 'oz'))"/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(normalize-space(substring-before(., 'oz')), ' (ONZ)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">ONZ</gr:hasUnitOfMeasurement>
 	      </xsl:when>
 	      <xsl:otherwise>
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="."/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(., ' (LBR)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">LBR</gr:hasUnitOfMeasurement>
 	      </xsl:otherwise>
 	    </xsl:choose>
@@ -368,18 +439,21 @@
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="normalize-space(substring-before(., $quote))"/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(normalize-space(substring-before(., $quote)), ' (INH)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
 	      </xsl:when>
 	      <xsl:when test="contains(. , 'in')">
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="normalize-space(substring-before(., 'in'))"/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(normalize-space(substring-before(., 'in')), ' (INH)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
 	      </xsl:when>
 	      <xsl:otherwise>
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="."/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(., ' (INH)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
 	      </xsl:otherwise>
 	    </xsl:choose>
@@ -398,18 +472,21 @@
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="normalize-space(substring-before(., $quote))"/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(normalize-space(substring-before(., $quote)), ' (INH)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
 	      </xsl:when>
 	      <xsl:when test="contains(. , 'in')">
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="normalize-space(substring-before(., 'in'))"/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(normalize-space(substring-before(., 'in')), ' (INH)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
 	      </xsl:when>
 	      <xsl:otherwise>
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="."/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(., ' (INH)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
 	      </xsl:otherwise>
 	    </xsl:choose>
@@ -428,18 +505,21 @@
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="normalize-space(substring-before(., $quote))"/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(normalize-space(substring-before(., $quote)), ' (INH)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
 	      </xsl:when>
 	      <xsl:when test="contains(. , 'in')">
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="normalize-space(substring-before(., 'in'))"/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(normalize-space(substring-before(., 'in')), ' (INH)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
 	      </xsl:when>
 	      <xsl:otherwise>
 	        <gr:hasValueFloat rdf:datatype="&xsd;float">
 	          <xsl:value-of select="."/>
 		</gr:hasValueFloat>
+		<rdfs:label><xsl:value-of select="concat(., ' (INH)')"/></rdfs:label>
 		<gr:hasUnitOfMeasurement rdf:datatype="&xsd;string">INH</gr:hasUnitOfMeasurement>
 	      </xsl:otherwise>
 	    </xsl:choose>
diff --git a/binsrc/rdf_mappers/xslt/main/bugzilla2rdf.xsl b/binsrc/rdf_mappers/xslt/main/bugzilla2rdf.xsl
index 1664da9..d5a352b 100644
--- a/binsrc/rdf_mappers/xslt/main/bugzilla2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/bugzilla2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: bugzilla2rdf.xsl,v 1.1.2.8 2010/06/09 13:47:57 source Exp $
+ -  $Id: bugzilla2rdf.xsl,v 1.1.2.11 2011/03/23 12:13:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -33,7 +33,6 @@
 <!ENTITY dc "http://purl.org/dc/elements/1.1/">
 <!ENTITY dcterms "http://purl.org/dc/terms/">
 <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
-<!ENTITY atomowl "http://atomowl.org/ontologies/atomrdf#">
 <!ENTITY bibo "http://purl.org/ontology/bibo/">
 <!ENTITY content "http://purl.org/rss/1.0/modules/content/">
 <!ENTITY wf "http://www.w3.org/2005/01/wf/flow#">
@@ -90,9 +89,6 @@
 		<xsl:for-each select="long_desc">
 			<rdf:Description rdf:about="{vi:proxyIRI($baseUri,'', replace(issue_when, ' ', '_'))}">
 				<rdf:type rdf:resource="&sioct;Comment"/>
-				<dc:date rdf:datatype="&xsd;dateTime">
-					<xsl:value-of select="vi:http_string_date (issue_when)"/>
-				</dc:date>
 				<dc:creator rdf:resource="{vi:proxyIRI($baseUri,'', replace(who, ' ', '_'))}"/>
 				<sioc:has_container rdf:resource="{$baseUri}"/>
 				<sioc:has_creator rdf:resource="{vi:proxyIRI($baseUri,'', replace(who, ' ', '_'))}"/>
@@ -100,6 +96,7 @@
 				<dc:description>
 					<xsl:value-of select="thetext"/>
 				</dc:description>
+				<rdfs:label><xsl:value-of select="concat('Created by: ', who/@name, ' on ', issue_when)"/></rdfs:label>
 				<dcterms:created rdf:datatype="&xsd;dateTime">
 					<xsl:value-of select="vi:http_string_date (issue_when)"/>
 				</dcterms:created>
@@ -138,12 +135,10 @@
 		<xsl:for-each select="long_desc">
 			<rdf:Description rdf:about="{vi:proxyIRI($baseUri,'',replace(bug_when, ' ', '_'))}">
 				<rdf:type rdf:resource="&sioct;Comment"/>
-				<dc:date rdf:datatype="&xsd;dateTime">
-					<xsl:value-of select="vi:http_string_date (bug_when)"/>
-				</dc:date>
 				<dc:creator rdf:resource="{vi:proxyIRI($baseUri,'', replace(who, ' ', '_'))}"/>
 				<sioc:has_container rdf:resource="{$baseUri}"/>
 				<sioc:has_creator rdf:resource="{vi:proxyIRI($baseUri,'', replace(who, ' ', '_'))}"/>
+				<rdfs:label><xsl:value-of select="concat('Created by: ', who/@name, ' on ', bug_when)"/></rdfs:label>
 				<sioc:reply_of rdf:resource="{$baseUri}"/>
 				<dc:description>
 					<xsl:value-of select="thetext"/>
diff --git a/binsrc/rdf_mappers/xslt/main/cnet2rdf.xsl b/binsrc/rdf_mappers/xslt/main/cnet2rdf.xsl
index 98964e6..5900f23 100644
--- a/binsrc/rdf_mappers/xslt/main/cnet2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/cnet2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: cnet2rdf.xsl,v 1.1.2.10 2010/01/12 11:08:51 source Exp $
+ -  $Id: cnet2rdf.xsl,v 1.1.2.13 2011/03/28 13:02:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -29,7 +29,7 @@
 <!ENTITY dcterms "http://purl.org/dc/terms/">
 <!ENTITY sioc "http://rdfs.org/sioc/ns#">
 <!ENTITY gr "http://purl.org/goodrelations/v1#">
-<!ENTITY cnet "http://developer.api.cnet.com/rest/v1.0/ns">
+<!ENTITY cnet "http://api.cnet.com/restApi/v1.0/ns">
 <!ENTITY oplcn "http://www.openlinksw.com/schemas/cnet#">
 ]>
 <xsl:stylesheet version="1.0"
@@ -74,6 +74,7 @@
 					<foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'Vendor')}"/>
 					<foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'Offering')}"/>
 					<dcterms:subject rdf:resource="{$resourceURL}"/>
+					<owl:sameAs rdf:resource="{$docIRI}"/>
 				</rdf:Description>
 
 	               		<gr:BusinessEntity rdf:about="{vi:proxyIRI ($baseUri, '', 'Vendor')}">
@@ -100,7 +101,7 @@
 			                <gr:validFrom rdf:datatype="&xsd;dateTime"><xsl:value-of select="$currentDateTime"/></gr:validFrom>
 					<xsl:apply-templates mode="offering" />
 				</gr:Offering>
-				<xsl:apply-templates />
+				<xsl:apply-templates select="cnet:CNETResponse" mode="product" />
 			</xsl:otherwise>
 		</xsl:choose>
 	</rdf:RDF>
@@ -109,7 +110,6 @@
   <xsl:template match="cnet:SoftwareProduct" mode="offering">
  	<gr:includes rdf:resource="{$resourceURL}"/>
 	<gr:availableDeliveryMethods rdf:resource="&gr;DeliveryModeDirectDownload"/>
-	<xsl:apply-templates mode="offering" />
   </xsl:template>
 
   <xsl:template match="cnet:TechProduct" mode="offering">
@@ -117,10 +117,9 @@
 		<gr:availableDeliveryMethods rdf:resource="&gr;DeliveryModePickup"/>
 		<gr:availableDeliveryMethods rdf:resource="&gr;UPS"/>
 		<gr:availableDeliveryMethods rdf:resource="&gr;DeliveryModeMail"/>
-	<xsl:apply-templates mode="offering" />
   </xsl:template>
 
-  <xsl:template match="cnet:SoftwareProduct">
+  <xsl:template match="cnet:SoftwareProduct"  mode="product">    
 	<rdf:Description rdf:about="{$resourceURL}">
 		<rdf:type rdf:resource="&gr;ProductOrServicesSomeInstancesPlaceholder" />
 		<rdf:type rdf:resource="&oplcn;SoftwareProduct" />
@@ -134,11 +133,11 @@
 		               	-->
 	              	</rdf:Description>
 	       	</gr:hasMakeAndModel>
-		<xsl:apply-templates  />
+		<xsl:apply-templates select="*"  />
 	</rdf:Description>
   </xsl:template>
 
-  <xsl:template match="cnet:TechProduct">
+  <xsl:template match="cnet:TechProduct"  mode="product">    
 	<rdf:Description rdf:about="{$resourceURL}">
 		<rdf:type rdf:resource="&gr;ProductOrServicesSomeInstancesPlaceholder" />
 		<rdf:type rdf:resource="&oplcn;TechProduct" />
@@ -152,7 +151,7 @@
 		               	-->
 	              	</rdf:Description>
 	       	</gr:hasMakeAndModel>
-		<xsl:apply-templates  />
+		<xsl:apply-templates select="*" />
 	</rdf:Description>
   </xsl:template>
 
@@ -212,7 +211,7 @@
   	<oplcn:bottomLine><xsl:value-of select="."/></oplcn:bottomLine>
   </xsl:template>
 
-  <xsl:template match="cnet:TechProduct/cnet:UserRatingSummary">
+  <xsl:template match="cnet:UserRatingSummary">
   	<oplcn:userRating><xsl:value-of select="concat(cnet:Rating, ' out of ', cnet:Rating/@outOf, ' from ', cnet:TotalVotes, ' votes' )"/></oplcn:userRating>
   	<oplcn:userStarRating><xsl:value-of select="concat(cnet:StarRating, ' out of ', cnet:StarRating/@outOf, ' from ', cnet:TotalVotes, ' votes' )"/></oplcn:userStarRating>
   </xsl:template>
@@ -220,14 +219,17 @@
   <xsl:template match="cnet:LowPrice" mode="offering">
 	<gr:hasPriceSpecification>
 	    	<gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'UnitPriceSpecification')}">
-			<rdfs:label>sale price</rdfs:label>
 			<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
 			<gr:hasCurrency rdf:datatype="&xsd;string">USD</gr:hasCurrency>
 			<xsl:choose>
 				<xsl:when test="string(.) = string(../cnet:HighPrice)">
+                			<rdfs:label>
+                			<xsl:value-of select="concat( translate (., '$', ''), ' (USD)')"/>	
+                			</rdfs:label>
 					<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="translate (., '$', '')"/></gr:hasCurrencyValue>
 				</xsl:when>
 				<xsl:otherwise>
+                			<rdfs:label>sale price</rdfs:label>
 					<gr:hasMinCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="translate (., '$', '')"/></gr:hasMinCurrencyValue>
 					<gr:hasMaxCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="translate (../cnet:HighPrice, '$', '')"/></gr:hasMaxCurrencyValue>
 				</xsl:otherwise>
@@ -259,7 +261,9 @@
   <xsl:template match="cnet:Price">
 	<gr:hasPriceSpecification>
 	    <gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'price')}">
-		<rdfs:label>sale price</rdfs:label>
+		<rdfs:label>
+      			<xsl:value-of select="concat( translate (., '$', ''), ' (USD)')"/>	
+		</rdfs:label>
 		<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
 		<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="translate (., '$', '')"/></gr:hasCurrencyValue>
 		<gr:hasCurrency rdf:datatype="&xsd;string">USD</gr:hasCurrency>
@@ -334,7 +338,7 @@
     </xsl:template>
 
     <xsl:template match="cnet:Description">
-	<dc:description><xsl:value-of select="string(.)"/></dc:description>
+	<gr:description><xsl:value-of select="string(.)"/></gr:description>
 	<oplcn:description><xsl:value-of select="string(.)"/></oplcn:description>
     </xsl:template>
 
@@ -347,9 +351,9 @@
   <!-- Applies to SoftwareProduct | TechProduct -->
 
   <xsl:template match="cnet:TechProduct/cnet:Name | cnet:SoftwareProduct/cnet:Name" mode="offering">
-	<rdfs:label><xsl:value-of select="."/></rdfs:label>
+	<rdfs:label><xsl:value-of select="concat('Offer: ', .)"/></rdfs:label>
   </xsl:template>
-  <xsl:template match="cnet:TechProduct/cnet:Name | cnet:SoftwareProduct/cnet:Name">
+  <xsl:template match="cnet:Name">
 	<rdfs:label><xsl:value-of select="."/></rdfs:label>
   </xsl:template>
   <xsl:template match="cnet:EditorsRating">
diff --git a/binsrc/rdf_mappers/xslt/main/crunchbase2rdf.xsl b/binsrc/rdf_mappers/xslt/main/crunchbase2rdf.xsl
index 94076cc..ca35ec3 100644
--- a/binsrc/rdf_mappers/xslt/main/crunchbase2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/crunchbase2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: crunchbase2rdf.xsl,v 1.1.2.7 2010/04/15 18:44:51 source Exp $
+ -  $Id: crunchbase2rdf.xsl,v 1.1.2.9 2011/03/23 12:13:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -28,6 +28,7 @@
 <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
 <!ENTITY sioc "http://rdfs.org/sioc/ns#">
 <!ENTITY gr "http://purl.org/goodrelations/v1#">
+<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
 ]>
 <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -38,6 +39,7 @@
     xmlns:dcterms= "http://purl.org/dc/terms/"
     xmlns:skos="http://www.w3.org/2004/02/skos/core#"
     xmlns:sioc="&sioc;"
+    xmlns:rdfs="&rdfs;"
     xmlns:bibo="&bibo;"
     xmlns:gr="&gr;"
     xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
@@ -259,6 +261,20 @@
 	</geo:long>
     </xsl:template>
 
+    <xsl:template match="created_at">
+	<xsl:element namespace="{$ns}" name="{name()}">
+	    <xsl:attribute name="rdf:datatype">&xsd;dateTime</xsl:attribute>
+	    <xsl:value-of select="vi:http_string_date (.)"/>
+	</xsl:element>
+    </xsl:template>
+
+    <xsl:template match="updated_at">
+	<xsl:element namespace="{$ns}" name="{name()}">
+	    <xsl:attribute name="rdf:datatype">&xsd;dateTime</xsl:attribute>
+	    <xsl:value-of select="vi:http_string_date (.)"/>
+	</xsl:element>
+    </xsl:template>
+
     <xsl:template match="image" priority="10">
 	<xsl:for-each select="available_sizes">
 	    <xsl:if test=". like '%.jpg' or . like '%.gif'">
@@ -328,8 +344,49 @@
 		<xsl:element namespace="{$ns}" name="{name()}">
 		    <xsl:element name="{$nspace}" namespace="{$ns}">
 			<xsl:attribute name="rdf:about">
-			    <xsl:value-of select="vi:proxyIRI($baseUri, '', concat (name(), '-', position()))"/>
+			    <xsl:variable name="cur_suffix" select="name()"/>
+			    <xsl:if test="name() like 'funding_round'">
+				<xsl:variable name="cur_suffix" select="concat(name(), '_', company/permalink, '_', funded_year, '_', funded_month, '_', funded_day)"/>
+		            </xsl:if>
+			    <xsl:value-of select="vi:proxyIRI($baseUri, '', concat ($cur_suffix, '-', position()))"/>
 			</xsl:attribute>
+
+		<xsl:if test="name() like 'funding_round'">
+		    <rdfs:label><xsl:value-of select="concat(round_code, ': ', raised_amount, ' ', funded_month, '/', funded_year, ' source: ', source_description)"/></rdfs:label>
+		</xsl:if>
+		<xsl:if test="name() like 'funding_rounds'">
+		    <rdfs:label><xsl:value-of select="concat(round_code, ': ', raised_amount, ' ', funded_month, '/', funded_year, ' source: ', source_description)"/></rdfs:label>
+		</xsl:if>
+		<xsl:if test="name() like 'offices'">
+		    <rdfs:label><xsl:value-of select="concat(address1, ', ', city, ', ', state_code, ', ', zip_code, ', ', country_code, ' - ', description)"/></rdfs:label>
+		</xsl:if>
+		<xsl:if test="name() like 'video_embeds'">
+		    <rdfs:label><xsl:value-of select="description"/></rdfs:label>
+		</xsl:if>
+		<xsl:if test="name() like 'acquisitions'">
+		    <rdfs:label><xsl:value-of select="source_description"/></rdfs:label>
+		</xsl:if>
+		<xsl:if test="name() like 'external_links'">
+		    <rdfs:label><xsl:value-of select="title"/></rdfs:label>
+		</xsl:if>
+		<xsl:if test="name() like 'milestones'">
+		    <rdfs:label><xsl:value-of select="description"/></rdfs:label>
+		</xsl:if>
+		<xsl:if test="name() like 'products'">
+		    <rdfs:label><xsl:value-of select="name"/></rdfs:label>
+		</xsl:if>
+		<xsl:if test="name() like 'providerships'">
+		    <rdfs:label><xsl:value-of select="provider"/></rdfs:label>
+		</xsl:if>
+		<xsl:if test="name() like 'relationships'">
+		    <rdfs:label><xsl:value-of select="title"/></rdfs:label>
+		</xsl:if>
+		<xsl:if test="name() like 'investments'">
+		    <rdfs:label><xsl:value-of select="funding_round/company/name"/></rdfs:label>
+		</xsl:if>
+		<xsl:if test="name() like 'competitions'">
+		    <rdfs:label><xsl:value-of select="competitor"/></rdfs:label>
+		</xsl:if>
 		    <xsl:apply-templates select="@*|node()"/>
 		</xsl:element>
 	    </xsl:element>
@@ -343,6 +400,9 @@
 		<xsl:if test="name() like 'date_%'">
 		    <xsl:attribute name="rdf:datatype">&xsd;dateTime</xsl:attribute>
 		</xsl:if>
+		<xsl:if test="name() like 'number_of_employees'">
+		    <xsl:attribute name="rdf:datatype">&xsd;integer</xsl:attribute>
+		</xsl:if>
 		<xsl:apply-templates select="@*|node()"/>
 	    </xsl:element>
 	</xsl:if>
diff --git a/binsrc/rdf_mappers/xslt/main/delicious2rdf.xsl b/binsrc/rdf_mappers/xslt/main/delicious2rdf.xsl
index feaa9db..a89696a 100644
--- a/binsrc/rdf_mappers/xslt/main/delicious2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/delicious2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: delicious2rdf.xsl,v 1.1.2.6 2010/04/15 18:44:45 source Exp $
+ -  $Id: delicious2rdf.xsl,v 1.1.2.8 2010/09/22 13:57:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -83,12 +83,12 @@
 	    <owl:sameAs rdf:resource="{$docIRI}"/>
 	    <scot:hasScot rdf:resource="{concat($baseUri, '#tagcloud')}"/>
 	    <xsl:for-each select="popular">
-		<sioc:topic rdf:resource="{concat ('http://delicious.com/tag/', .)}"/>
+		<sioc:topic rdf:resource="{concat ('http://www.delicious.com/tag/', .)}"/>
 	    </xsl:for-each>
 	</rdf:Description>
 	<scot:Tagcloud rdf:about="{concat($baseUri, '#tagcloud')}">
 	    <xsl:for-each select="popular">
-		<scot:hasTag rdf:resource="{vi:proxyIRI(concat ('http://delicious.com/tag/', .))}"/>
+		<scot:hasTag rdf:resource="{vi:proxyIRI(concat ('http://www.delicious.com/tag/', .))}"/>
 	    </xsl:for-each>
 	</scot:Tagcloud>
     </xsl:template>
@@ -110,15 +110,15 @@
 	    <rdf:Description rdf:about="{$resourceURL}">
 		<sioc:has_container rdf:resource="{$docproxyIRI}" />
 		<rdf:type rdf:resource="&sioc;BookmarkFolder"/>
-		<xsl:variable name="author" select="substring-after(link, 'http://delicious.com/')" />
-		<scot:hasScot rdf:resource="{concat('http://delicious.com/tags/', $author)}"/>
+		<xsl:variable name="author" select="substring-after(link, 'http://www.delicious.com/')" />
+		<scot:hasScot rdf:resource="{concat('http://www.delicious.com/tags/', $author)}"/>
 		<xsl:for-each select="item">
-		    <xsl:variable name="guid1" select="substring-after(substring-before(guid, '#'), 'http://delicious.com/url/') " />
+		    <xsl:variable name="guid1" select="substring-after(substring-before(guid, '#'), 'http://www.delicious.com/url/') " />
 		    <sioc:container_of rdf:resource="{vi:proxyIRI($baseUri, '', $guid1)}" />
 		</xsl:for-each>
 	    </rdf:Description>
 	    <xsl:for-each select="item">
-		<xsl:variable name="guid" select="substring-after(substring-before(guid, '#'), 'http://delicious.com/url/') " />
+		<xsl:variable name="guid" select="substring-after(substring-before(guid, '#'), 'http://www.delicious.com/url/') " />
 		<rdf:Description rdf:about="{vi:proxyIRI($baseUri, '', $guid)}">
 		    <rdf:type rdf:resource="&bookmark;Bookmark"/>
 		    <sioc:has_container rdf:resource="{vi:proxyIRI($baseUri)}" />
@@ -126,7 +126,7 @@
 			<xsl:value-of select="title"/>
 		    </dc:title>
 		    <xsl:if test="dc:creator">
-			<foaf:maker rdf:resource="http://delicious.com/{dc:creator}"/>
+			<dcterms:creator rdf:resource="http://www.delicious.com/{dc:creator}"/>
 		    </xsl:if>
 		    <bibo:uri rdf:resource="{link}" />
 		    <xsl:for-each select="category">
@@ -165,8 +165,8 @@
 		    <scot:cooccurAFrequency rdf:datatype="&xsd;integer">1</scot:cooccurAFrequency>
 		</rdf:Description>
 	    </xsl:for-each>
-	    <xsl:variable name="author" select="substring-after(link, 'http://delicious.com/')" />
-	    <scot:Tagcloud rdf:about="{concat('http://delicious.com/tags/', $author)}">
+	    <xsl:variable name="author" select="substring-after(link, 'http://www.delicious.com/')" />
+	    <scot:Tagcloud rdf:about="{concat('http://www.delicious.com/tags/', $author)}">
 		<xsl:for-each select="//category">
 		    <scot:hasTag rdf:resource="{vi:proxyIRI(concat (@domain, .))}"/>
 		</xsl:for-each>
@@ -193,7 +193,7 @@
 		    <xsl:value-of select="$tag"/>
 		</skos:prefLabel>
 		<xsl:for-each select="item">
-		    <xsl:variable name="guid" select="substring-after(substring-before(guid, '#'), 'http://delicious.com/url/') " />
+		    <xsl:variable name="guid" select="substring-after(substring-before(guid, '#'), 'http://www.delicious.com/url/') " />
 		    <xsl:variable name="domain" select="substring(category/@domain, 1, string-length(category/@domain) - 1)" />
 		    <skos:isSubjectOf rdf:resource="{vi:proxyIRI($baseUri, '', $guid)}"/>
 		    <foaf:page rdf:resource="{vi:proxyIRI($baseUri, '', $guid)}"/>
@@ -201,7 +201,7 @@
 		</xsl:for-each>
 	    </rdf:Description>
 	    <xsl:for-each select="item">
-		<xsl:variable name="guid" select="substring-after(substring-before(guid, '#'), 'http://delicious.com/url/') " />
+		<xsl:variable name="guid" select="substring-after(substring-before(guid, '#'), 'http://www.delicious.com/url/') " />
 		<xsl:variable name="domain" select="substring(category/@domain, 1, string-length(category/@domain) - 1)" />
 		<rdf:Description rdf:about="{vi:proxyIRI($baseUri, '', concat('coocurrence_', $guid))}">
 		    <rdf:type rdf:resource="&scot;Cooccurrence"/>
@@ -218,7 +218,7 @@
 			<xsl:value-of select="title"/>
 		    </dc:title>
 		    <xsl:if test="dc:creator">
-			<foaf:maker rdf:resource="http://delicious.com/{dc:creator}"/>
+			<dcterms:creator rdf:resource="http://www.delicious.com/{dc:creator}"/>
 		    </xsl:if>
 		    <bibo:uri rdf:resource="{link}" />
 		    <xsl:for-each select="category">
@@ -233,8 +233,8 @@
 		    <sioc:container_of rdf:resource="{vi:proxyIRI($baseUri, '', $guid)}" />
 		</rdf:Description>
 	    </xsl:for-each>
-	    <xsl:variable name="author" select="substring-before(substring-after(link, 'http://delicious.com/'), '/')" />
-	    <scot:Tagcloud rdf:about="{concat('http://delicious.com/tags/', $author)}">
+	    <xsl:variable name="author" select="substring-before(substring-after(link, 'http://www.delicious.com/'), '/')" />
+	    <scot:Tagcloud rdf:about="{concat('http://www.delicious.com/tags/', $author)}">
 		<xsl:for-each select="//category">
 		    <scot:hasTag rdf:resource="{vi:proxyIRI(concat (@domain, .))}"/>
 		</xsl:for-each>
diff --git a/binsrc/rdf_mappers/xslt/main/digg2rdf.xsl b/binsrc/rdf_mappers/xslt/main/digg2rdf.xsl
index 84f8acd..18124be 100644
--- a/binsrc/rdf_mappers/xslt/main/digg2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/digg2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: digg2rdf.xsl,v 1.1.2.2 2009/08/27 15:09:12 source Exp $
+ -  $Id: digg2rdf.xsl,v 1.1.2.3 2010/09/07 21:58:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -33,7 +33,6 @@
 <!ENTITY dc "http://purl.org/dc/elements/1.1/">
 <!ENTITY dcterms "http://purl.org/dc/terms/">
 <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
-<!ENTITY atomowl "http://atomowl.org/ontologies/atomrdf#">
 <!ENTITY content "http://purl.org/rss/1.0/modules/content/">
 ]>
 <xsl:stylesheet
@@ -45,7 +44,6 @@
   xmlns:sioc="&sioc;"
   xmlns:rdfs="&rdfs;"
   xmlns:foaf="&foaf;"
-  xmlns:atom="&atomowl;"
   xmlns:skos="http://www.w3.org/2004/02/skos/core#"
   xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
   xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
diff --git a/binsrc/rdf_mappers/xslt/main/discogs2rdf.xsl b/binsrc/rdf_mappers/xslt/main/discogs2rdf.xsl
index 863159a..177a6c3 100644
--- a/binsrc/rdf_mappers/xslt/main/discogs2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/discogs2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: discogs2rdf.xsl,v 1.1.2.6 2009/10/28 21:30:16 source Exp $
+ -  $Id: discogs2rdf.xsl,v 1.1.2.7 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -112,17 +112,16 @@
 			<rdf:type rdf:resource="&audio;Album"/>
 			<sioc:has_container rdf:resource="{concat($base,'release/', at id)}"/>
 			<xsl:if test="artists/artist/name">
-				<foaf:maker rdf:resource="{vi:proxyIRI (concat($base,'artist/', translate(artists/artist/name, ' ', '+')))}"/>
 				<dcterms:creator rdf:resource="{vi:proxyIRI (concat($base,'artist/', translate(artists/artist/name, ' ', '+')))}"/>
 			</xsl:if>
 			<xsl:if test="title">
-				<dcterms:title><xsl:value-of select="title"/></dcterms:title>
+				<dc:title><xsl:value-of select="title"/></dc:title>
 			</xsl:if>
 			<xsl:if test="format">
 				<dc:format><xsl:value-of select="format"/></dc:format>
 			</xsl:if>
 			<xsl:if test="year">
-				<dcterms:published><xsl:value-of select="year"/></dcterms:published>
+				<dcterms:created><xsl:value-of select="year"/></dcterms:created>
 			</xsl:if>
 			<xsl:for-each select="tracklist/track">
 				<media:contains rdf:resource="{vi:proxyIRI (concat($base,'release/', ../../@id), '', position)}"/>
@@ -143,9 +142,9 @@
 			<mo:track_number>
 				<xsl:value-of select="position"/>
 			</mo:track_number>
-			<dcterms:title>
+			<dc:title>
 				<xsl:value-of select="title"/>
-			</dcterms:title>
+			</dc:title>
 			<media:duration rdf:datatype="&xsd;integer">
 				<xsl:value-of select="duration"/>
 			</media:duration>
diff --git a/binsrc/rdf_mappers/xslt/main/ebay2rdf.xsl b/binsrc/rdf_mappers/xslt/main/ebay2rdf.xsl
index 24d66ae..defbb79 100644
--- a/binsrc/rdf_mappers/xslt/main/ebay2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/ebay2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ebay2rdf.xsl,v 1.1.2.12 2010/07/05 08:26:48 source Exp $
+ -  $Id: ebay2rdf.xsl,v 1.1.2.17 2011/03/28 13:02:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -76,6 +76,7 @@
 			<rdf:Description rdf:about="{$docproxyIRI}">
 				<rdf:type rdf:resource="&bibo;Document"/>
 				<dc:title><xsl:value-of select="$baseUri"/></dc:title>
+                <rdfs:label><xsl:value-of select="$baseUri"/></rdfs:label>
 				<sioc:container_of rdf:resource="{$resourceURL}"/>
 				<foaf:primaryTopic rdf:resource="{$resourceURL}"/>
 			    <foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'Vendor')}"/>
@@ -100,9 +101,10 @@
 			    <gr:includes rdf:resource="{$resourceURL}"/>
 			    <gr:validFrom rdf:datatype="&xsd;dateTime"><xsl:value-of select="$currentDateTime"/></gr:validFrom>
 			    <gr:validThrough rdf:datatype="&xsd;dateTime"><xsl:value-of select="ebay:Item/ebay:EndTime"/></gr:validThrough>
+                <gr:acceptedPaymentMethods rdf:resource="{concat('&gr;', ebay:Item/ebay:PaymentMethods)}"/>
 			    <gr:availableDeliveryMethods rdf:resource="&gr;DeliveryModePickup"/>
 			    <xsl:if test="count(//ebay:ShipToLocations) = 1">
-			    	<gr:availableDeliveryMethods rdf:resource="&gr;UPS"/>
+			    	<!--gr:availableDeliveryMethods rdf:resource="&gr;UPS"/-->
 			    	<gr:availableDeliveryMethods rdf:resource="&gr;DeliveryModeMail"/>
 			    </xsl:if>
 			    <xsl:apply-templates mode="offering" />
@@ -123,10 +125,12 @@
 					<xsl:when test="$seller != ''">
 		        		<rdfs:label><xsl:value-of select="$seller"/></rdfs:label>
 		        		<gr:legalName><xsl:value-of select="$seller"/></gr:legalName>
+                        <foaf:page rdf:resource="{concat('http://myworld.ebay.com/', $seller)}" />
 					</xsl:when>
 					<xsl:when test="$store != ''">
 		        		<rdfs:label><xsl:value-of select="$store"/></rdfs:label>
 		        		<gr:legalName><xsl:value-of select="$store"/></gr:legalName>
+						<foaf:page rdf:resource="{concat('http://myworld.ebay.com/', $store)}" />
 						<oplebay:eBayStoreURL><xsl:value-of select="//ebay:Storefront/ebay:StoreURL"/></oplebay:eBayStoreURL>
 					</xsl:when>
 					<xsl:otherwise>
@@ -148,6 +152,7 @@
 			<rdf:Description rdf:about="{$resourceURL}">
 			    <rdf:type rdf:resource="&gr;ProductOrServicesSomeInstancesPlaceholder" />
 			    <rdf:type rdf:resource="&oplebay;Product" />
+                <foaf:page rdf:resource="{$baseUri}"/>
 			    <sioc:has_container rdf:resource="{$docproxyIRI}"/>
                 <xsl:variable name="brand" 
 						select="//ebay:Item/ebay:ItemSpecifics/ebay:NameValueList[ebay:Name='Brand']/ebay:Value"/>
@@ -222,7 +227,9 @@
 		  <gr:UnitPriceSpecification rdf:about="{concat ($baseUri, '#', 'ConvertedCurrentPrice')}">
 		  -->
 		  <gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'ConvertedCurrentPrice')}">
-			<rdfs:label>Converted Current Price</rdfs:label>
+			<rdfs:label>
+      			<xsl:value-of select="concat( . , ' (', @currencyID, ')')"/>	
+			</rdfs:label>
 			<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
             <gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="."/></gr:hasCurrencyValue>
             <gr:hasCurrency rdf:datatype="&xsd;string"><xsl:value-of select="@currencyID"/></gr:hasCurrency>
@@ -242,11 +249,12 @@
 
     <xsl:template match="ebay:Item/ebay:Title">
 	<rdfs:comment><xsl:value-of select="."/></rdfs:comment>
-	<dc:title><xsl:value-of select="."/></dc:title>
+	<gr:name><xsl:value-of select="."/></gr:name>
+    <rdfs:label><xsl:value-of select="."/></rdfs:label>
     </xsl:template>
     <xsl:template match="ebay:Item/ebay:Description">
 	<!--oplebay:description rdf:datatype="&xsd;string"><xsl:value-of select="."/></oplebay:description-->
-	<oplebay:longDescription rdf:datatype="&xsd;string"><xsl:value-of select="."/></oplebay:longDescription>
+	<gr:description rdf:datatype="&xsd;string"><xsl:value-of select="."/></gr:description>
     </xsl:template>
     <xsl:template match="ebay:Item/ebay:ItemId">
 	<oplebay:productId><xsl:value-of select="."/></oplebay:productId>
@@ -262,7 +270,7 @@
     </xsl:template>
     <xsl:template match="ebay:Item/ebay:GalleryURL">
 	<xsl:if test="string-length(.) > 0">
-	    <xsl:element namespace="&oplebay;" name="image">
+	    <xsl:element namespace="&foaf;" name="depiction">
 		<xsl:attribute name="rdf:resource">
 		    <xsl:value-of select="."/>
 		</xsl:attribute>
@@ -271,7 +279,7 @@
     </xsl:template>
     <xsl:template match="ebay:Item/ebay:PictureURL">
 	<xsl:if test="string-length(.) > 0">
-	    <xsl:element namespace="&oplebay;" name="image">
+	    <xsl:element namespace="&foaf;" name="depiction">
 		<xsl:attribute name="rdf:resource">
 		    <xsl:value-of select="."/>
 		</xsl:attribute>
@@ -304,8 +312,8 @@
 	            <xsl:value-of select="concat($baseUri, '#', 'Detail_', position())"/>
 				-->
 		</xsl:attribute>
-		<oplebay:detail_name rdf:datatype="&xsd;string"><xsl:value-of select="ebay:Name"/></oplebay:detail_name>
-		<oplebay:detail_value rdf:datatype="&xsd;string">
+		<oplebay:detail_name><xsl:value-of select="ebay:Name"/></oplebay:detail_name>
+		<oplebay:detail_value>
 			<xsl:variable name="val"/>
 			<xsl:for-each select="ebay:Value">
 				<xsl:choose>
@@ -328,9 +336,9 @@
     </xsl:template>
 
     <xsl:template match="ebay:Item/ebay:Location">
-		<gr:availableAtOrFrom>
+		<oplebay:location_info>
 			<xsl:value-of select="."/>
-		</gr:availableAtOrFrom>
+		</oplebay:location_info>
     </xsl:template>
 
 	<!-- Reviews -->
@@ -369,7 +377,7 @@
 				-->
 				<review:reviewer><xsl:value-of select="ebay:UserID"/></review:reviewer>
 				<review:rating><xsl:value-of select="ebay:Rating"/></review:rating>
-				<dc:dateTime><xsl:value-of select="ebay:CreationTime"/></dc:dateTime>
+				<dcterms:created><xsl:value-of select="ebay:CreationTime"/></dcterms:created>
 				<review:text><xsl:value-of select="ebay:Text"/></review:text>
 				<rdfs:seeAlso rdf:resource="{ebay:URL}"/>
 			</review:Review>
diff --git a/binsrc/rdf_mappers/xslt/main/eol2rdf.xsl b/binsrc/rdf_mappers/xslt/main/eol2rdf.xsl
new file mode 100644
index 0000000..f360377
--- /dev/null
+++ b/binsrc/rdf_mappers/xslt/main/eol2rdf.xsl
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ -
+ -  $Id: eol2rdf.xsl,v 1.1.4.2 2011/01/03 23:40:02 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2009 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+<!DOCTYPE xsl:stylesheet
+[
+<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
+<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<!ENTITY bibo "http://purl.org/ontology/bibo/">
+<!ENTITY foaf "http://xmlns.com/foaf/0.1/">
+<!ENTITY dcterms "http://purl.org/dc/terms/">
+<!ENTITY sioc "http://rdfs.org/sioc/ns#">
+<!ENTITY gr "http://purl.org/goodrelations/v1#">
+]>
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+xmlns:rdf="&rdf;"
+xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+xmlns:foaf="&foaf;"
+xmlns:bibo="&bibo;"
+xmlns:sioc="&sioc;" 
+xmlns:gr="&gr;"
+xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
+xmlns:dcterms="&dcterms;"
+xmlns:opl="http://www.openlinksw.com/schema/attribution#"
+xmlns:dc="http://purl.org/dc/elements/1.1/"
+xmlns:owl="http://www.w3.org/2002/07/owl#"
+xmlns:dwc="http://rs.tdwg.org/dwc/terms/"
+xmlns:cc="http://web.resource.org/cc/"
+>
+
+  <xsl:output method="xml" indent="yes" />
+
+  <xsl:param name="baseUri" />
+
+  <xsl:variable name="resourceURL" select="vi:proxyIRI ($baseUri)" />
+  <xsl:variable name="docIRI" select="vi:docIRI($baseUri)" />
+  <xsl:variable name="docproxyIRI" select="vi:docproxyIRI($baseUri)" />
+  
+	<xsl:template match="/">
+		<rdf:RDF>
+			  <rdf:Description rdf:about="{$docproxyIRI}">
+				<rdf:type rdf:resource="&bibo;Document" />
+				<sioc:container_of rdf:resource="{$resourceURL}" />
+				<foaf:primaryTopic rdf:resource="{$resourceURL}" />
+				<dcterms:subject rdf:resource="{$resourceURL}" />
+				<dc:title><xsl:value-of select="$baseUri"/></dc:title>
+				<owl:sameAs rdf:resource="{$docIRI}"/>
+				<rdfs:label>
+					<xsl:value-of select="$baseUri"/>
+				</rdfs:label>
+			  </rdf:Description>
+			<xsl:apply-templates/>		  
+		</rdf:RDF>
+	</xsl:template>
+
+	<xsl:template match="response">
+		<rdf:Description rdf:about="{$resourceURL}">
+		  <rdf:type rdf:resource="&bibo;Document"/>
+			  <xsl:apply-templates/>
+		</rdf:Description>
+		<xsl:for-each select="dataObject">
+			<rdf:Description rdf:about="{vi:proxyIRI($baseUri, '', dataObjectID)}">
+			  <rdf:type rdf:resource="{dataType}" />
+				<opl:providedBy>
+					<foaf:Organization rdf:about="{concat(agent/@homepage, '#this')}">
+						<foaf:name><xsl:value-of select="agent"/></foaf:name>
+						<foaf:homepage rdf:resource="{agent/@homepage}"/>
+					</foaf:Organization>
+				</opl:providedBy>
+				<cc:License rdf:resource="{license}"/>
+				<xsl:for-each select="mediaURL" >
+					<foaf:depiction rdf:resource="{.}"/>
+				</xsl:for-each>
+				<xsl:for-each select="subject" >
+					<dcterms:subject rdf:resource="{.}"/>
+				</xsl:for-each>
+			  <xsl:apply-templates />
+			</rdf:Description>
+		</xsl:for-each>
+	</xsl:template>
+	
+  <xsl:template match="taxonConcept">
+		<rdfs:label>
+			<xsl:value-of select="dwc:scientificName"/>
+		</rdfs:label>
+		<foaf:name>
+			<xsl:value-of select="dwc:scientificName"/>
+		</foaf:name>
+		<foaf:page rdf:resource="{concat('http://www.eol.org/pages/', taxonConceptID)}"/>
+  </xsl:template>
+
+  <xsl:template match="dataObject">
+	<sioc:container_of rdf:resource="{vi:proxyIRI($baseUri, '', dataObjectID)}"/>
+  </xsl:template>
+  
+    <xsl:template match="dc:*|dcterms:*">
+        <xsl:copy-of select="." />
+    </xsl:template>
+
+  <xsl:template match="text()|@*" />
+</xsl:stylesheet>
diff --git a/binsrc/rdf_mappers/xslt/main/etsy2rdf.xsl b/binsrc/rdf_mappers/xslt/main/etsy2rdf.xsl
index dfddc5f..a6d94ec 100644
--- a/binsrc/rdf_mappers/xslt/main/etsy2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/etsy2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: etsy2rdf.xsl,v 1.1.4.3 2010/07/06 23:07:29 source Exp $
+ -  $Id: etsy2rdf.xsl,v 1.1.4.7 2011/03/28 13:02:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -121,9 +121,9 @@
 		<rdfs:label>
 			<xsl:value-of select="."/>
 		</rdfs:label>
-		<dc:title>
+		<gr:name>
 			<xsl:value-of select="."/>
-		</dc:title>
+		</gr:name>
     </xsl:template>
     
     <xsl:template match="url">
@@ -162,7 +162,7 @@
 
     <xsl:template match="user_name">
 		<xsl:if test="$action = 'prod'">
-			<foaf:maker rdf:resource="{vi:proxyIRI (concat('http://www.etsy.com/people/', .))}"/>
+			<dcterms:creator rdf:resource="{vi:proxyIRI (concat('http://www.etsy.com/people/', .))}"/>
 		</xsl:if>
 		<xsl:if test="$action = 'user'">
 			<rdfs:label>
@@ -179,9 +179,9 @@
     </xsl:template>
 
     <xsl:template match="description">
-		<dc:description>
+		<gr:description>
 			<xsl:value-of select="."/>
-		</dc:description>
+		</gr:description>
     </xsl:template>
     
     <xsl:template match="bio">
@@ -205,7 +205,7 @@
     <xsl:template match="price">
 		<gr:hasPriceSpecification>
 			<gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'price')}">
-				<rdfs:label><xsl:value-of select="concat('List Price of ', ., ' USD')"/></rdfs:label>
+				<rdfs:label><xsl:value-of select="concat( ., ' (USD)')"/></rdfs:label>
 				<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="."/></gr:hasCurrencyValue>
 				<gr:hasCurrency rdf:datatype="&xsd;string">USD</gr:hasCurrency>
 			</gr:UnitPriceSpecification>
diff --git a/binsrc/rdf_mappers/xslt/main/evri2rdf.xsl b/binsrc/rdf_mappers/xslt/main/evri2rdf.xsl
new file mode 100644
index 0000000..6ee8ac6
--- /dev/null
+++ b/binsrc/rdf_mappers/xslt/main/evri2rdf.xsl
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+-
+-  $Id: evri2rdf.xsl,v 1.1.4.2 2010/08/26 22:46:12 source Exp $
+-
+-  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+-  project.
+-
+-  Copyright (C) 1998-2010 OpenLink Software
+-
+-  This project is free software; you can redistribute it and/or modify it
+-  under the terms of the GNU General Public License as published by the
+-  Free Software Foundation; only version 2 of the License, dated June 1991.
+-
+-  This program is distributed in the hope that it will be useful, but
+-  WITHOUT ANY WARRANTY; without even the implied warranty of
+-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-  General Public License for more details.
+-
+-  You should have received a copy of the GNU General Public License along
+-  with this program; if not, write to the Free Software Foundation, Inc.,
+-  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+<!DOCTYPE xsl:stylesheet [
+  <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
+  <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+  <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
+  <!ENTITY bibo "http://purl.org/ontology/bibo/">
+  <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
+  <!ENTITY dcterms "http://purl.org/dc/terms/">
+  <!ENTITY sioc "http://rdfs.org/sioc/ns#">
+  <!ENTITY owl "http://www.w3.org/2002/07/owl#">
+  <!ENTITY gr "http://purl.org/goodrelations/v1#">
+  <!ENTITY cl "http://www.ebusiness-unibw.org/ontologies/consumerelectronics/v1#">
+  <!ENTITY oplbb "http://www.openlinksw.com/schemas/bestbuy#">
+  <!ENTITY evri "http://www.openlinksw.com/schemas/evri#">
+  <!ENTITY review "http:/www.purl.org/stuff/rev#">
+  <!ENTITY geonames "http://www.geonames.org/ontology#">
+]>
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+xmlns:rdf="&rdf;"
+xmlns:rdfs="&rdfs;"
+xmlns:foaf="&foaf;"
+xmlns:bibo="&bibo;"
+xmlns:sioc="&sioc;"
+xmlns:owl="&owl;"
+xmlns:dcterms="&dcterms;"
+xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
+xmlns:review="&review;"
+xmlns:gr="&gr;"
+xmlns:evri="&evri;"
+xmlns:geonames="&geonames;"
+xmlns:bestbuy="http://remix.bestbuy.com/"
+xmlns:dc="http://purl.org/dc/elements/1.1/"
+xmlns:cl="&cl;"
+xmlns:oplbb="&oplbb;">
+
+  <xsl:output method="xml" indent="yes" />
+
+  <xsl:param name="baseUri"/>
+  <xsl:param name="entity"/>
+  
+  <xsl:variable name="resourceURL" select="vi:proxyIRI ($baseUri)"/>
+  <xsl:variable name="docIRI" select="vi:docIRI($baseUri)"/>
+  <xsl:variable name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
+
+  <xsl:template match="/evriThing">
+    <rdf:RDF>
+      <rdf:Description rdf:about="{$docproxyIRI}">
+        <rdf:type rdf:resource="&bibo;Document"/>
+        <sioc:container_of rdf:resource="{$resourceURL}"/>
+        <foaf:primaryTopic rdf:resource="{$resourceURL}"/>
+        <dcterms:subject rdf:resource="{$resourceURL}"/>
+        <dc:title>
+          <xsl:value-of select="entity/name"/>
+        </dc:title>
+        <owl:sameAs rdf:resource="{$docIRI}"/>
+      </rdf:Description>
+
+      <rdf:Description rdf:about="{$resourceURL}">
+        <xsl:choose>
+          <xsl:when test="$entity = 'person'">
+            <rdf:type rdf:resource="&foaf;Person"/>
+          </xsl:when>
+          <xsl:when test="$entity = 'organization'">
+            <rdf:type rdf:resource="&foaf;Organization"/>
+          </xsl:when>
+          <xsl:when test="$entity = 'location'">
+            <rdf:type rdf:resource="&geonames;Feature"/>
+          </xsl:when>
+          <xsl:when test="$entity = 'product'">
+            <rdf:type rdf:resource="&gr;ProductOrServicesSomeInstancesPlaceholder" />
+          </xsl:when>
+        </xsl:choose>
+        <xsl:for-each select="entity/properties/property">
+          <xsl:element name="{name}" namespace="&evri;">
+              <xsl:value-of select="value" />
+          </xsl:element>
+        </xsl:for-each>
+      </rdf:Description>
+    </rdf:RDF>
+  </xsl:template>
+
+  <xsl:template match="text()|@*"/>
+  <xsl:template match="*"/>
+  
+</xsl:stylesheet>
diff --git a/binsrc/rdf_mappers/xslt/main/feed2sioc.xsl b/binsrc/rdf_mappers/xslt/main/feed2sioc.xsl
index 2598641..d66da77 100644
--- a/binsrc/rdf_mappers/xslt/main/feed2sioc.xsl
+++ b/binsrc/rdf_mappers/xslt/main/feed2sioc.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: feed2sioc.xsl,v 1.1.2.11 2010/04/06 16:31:40 source Exp $
+ -  $Id: feed2sioc.xsl,v 1.1.2.13 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -33,7 +33,6 @@
 <!ENTITY dc "http://purl.org/dc/elements/1.1/">
 <!ENTITY dcterms "http://purl.org/dc/terms/">
 <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
-<!ENTITY atom "http://atomowl.org/ontologies/atomrdf#">
 <!ENTITY content "http://purl.org/rss/1.0/modules/content/">
 <!ENTITY gphoto "http://schemas.google.com/photos/2007">
 <!ENTITY media "http://search.yahoo.com/mrss/">
@@ -54,7 +53,6 @@
 	xmlns:sioc="&sioc;"
 	xmlns:rss="&rss;"
 	xmlns:foaf="&foaf;"
-	xmlns:atom="&atom;"
 	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
 	xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
 	xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
@@ -198,8 +196,9 @@
 			<sioc:links_to rdf:resource="{@href}" />
 		</xsl:for-each>
 	</xsl:template>
+
 	<xsl:template match="dc:creator[normalize-space (.) != '']">
-		<foaf:maker rdf:resource="{vi:proxyIRI ($baseUri, '', .)}" />
+        <dcterms:creator rdf:resource="{vi:proxyIRI ($baseUri, '', .)}" />
 	</xsl:template>
     
 	<xsl:template match="dc:creator[normalize-space (.) != '']" mode="user">
diff --git a/binsrc/rdf_mappers/xslt/main/flickr2rdf.xsl b/binsrc/rdf_mappers/xslt/main/flickr2rdf.xsl
index 97b87de..eab4e7a 100644
--- a/binsrc/rdf_mappers/xslt/main/flickr2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/flickr2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: flickr2rdf.xsl,v 1.1.2.6 2009/12/30 12:18:54 source Exp $
+ -  $Id: flickr2rdf.xsl,v 1.1.2.7 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -125,16 +125,18 @@
 	<dc:description><xsl:value-of select="."/></dc:description>
     </xsl:template>
     <xsl:template match="dates">
-	<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">
+	<dcterms:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">
 	    <xsl:value-of select="v:unixTime2ISO (@posted)"/>
-	</dcterms:created>
+	</dcterms:issued>
 	<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">
 	    <xsl:value-of select="v:unixTime2ISO (@lastupdate)"/>
 	</dcterms:modified>
-	<dc:date rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime"><xsl:value-of select="translate (@taken, ' ', 'T')"/></dc:date>
+	<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">
+	    <xsl:value-of select="translate (@taken, ' ', 'T')"/>
+	</dcterms:created>
     </xsl:template>
     <xsl:template match="tag[@machine_tag='0']">
-	<dc:subject><xsl:value-of select="."/></dc:subject>
+	<dcterms:subject><xsl:value-of select="."/></dcterms:subject>
     </xsl:template>
     <xsl:template match="tag[@machine_tag='1']">
 		<xsl:variable name="raw" select="@raw" />
diff --git a/binsrc/rdf_mappers/xslt/main/fql2rdf.xsl b/binsrc/rdf_mappers/xslt/main/fql2rdf.xsl
index 646a53d..5ea61df 100644
--- a/binsrc/rdf_mappers/xslt/main/fql2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/fql2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: fql2rdf.xsl,v 1.1.2.4 2009/09/23 21:37:41 source Exp $
+ -  $Id: fql2rdf.xsl,v 1.1.2.5 2011/03/25 17:10:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -178,6 +178,7 @@
 		    <xsl:value-of select="fb:country"/>
 		</vcard:Country>
 	    </xsl:if>
+	<rdfs:label><xsl:value-of select="concat(fb:city, ' ', fb:state, ' ', fb:country)"/></rdfs:label>
 	</vcard:ADR>
     </xsl:template>
     <xsl:template match="fb:event">
diff --git a/binsrc/rdf_mappers/xslt/main/friendfeed2rdf.xsl b/binsrc/rdf_mappers/xslt/main/friendfeed2rdf.xsl
index 97af528..eaf4c44 100644
--- a/binsrc/rdf_mappers/xslt/main/friendfeed2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/friendfeed2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: friendfeed2rdf.xsl,v 1.1.2.4 2009/09/23 21:37:41 source Exp $
+ -  $Id: friendfeed2rdf.xsl,v 1.1.2.5 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -182,7 +182,7 @@
 </xsl:template>
 
 <xsl:template match="dc:creator">
-    <foaf:maker rdf:resource="{$baseUri}#{urlify (normalize-space (.))}"/>
+    <dcterms:creator rdf:resource="{$baseUri}#{urlify (normalize-space (.))}"/>
 </xsl:template>
 
 <xsl:template match="ff:comments">
@@ -209,7 +209,7 @@
 </xsl:template>
 
 <xsl:template match="ff:user">
-    <foaf:maker rdf:resource="{concat('http://friendfeed.com/', ff:user/ff:nickname)}"/>
+    <dcterms:creator rdf:resource="{concat('http://friendfeed.com/', ff:user/ff:nickname)}"/>
 </xsl:template>
 
 <xsl:template match="ff:user" mode="user">
@@ -235,7 +235,7 @@
 		<dcterms:created rdf:datatype="&xsd;dateTime">
 			<xsl:value-of select="ff:date"/>
 		</dcterms:created>
-		<foaf:maker rdf:resource="{ff:user/ff:profileUrl}"/>
+		<dcterms:creator rdf:resource="{ff:user/ff:profileUrl}"/>
 		<sioc:has_container rdf:resource="{../../@rdf:about}"/>
 		<sioc:reply_of rdf:resource="{../../@rdf:about}"/>
 		<rdf:type rdf:resource="&sioct;Comment"/>
diff --git a/binsrc/rdf_mappers/xslt/main/geonames2rdf.xsl b/binsrc/rdf_mappers/xslt/main/geonames2rdf.xsl
index 3d528a4..ce8f613 100644
--- a/binsrc/rdf_mappers/xslt/main/geonames2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/geonames2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: geonames2rdf.xsl,v 1.1.2.5 2009/12/15 23:13:03 source Exp $
+ -  $Id: geonames2rdf.xsl,v 1.1.2.6 2010/07/28 12:23:31 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -33,6 +33,7 @@
 <!ENTITY inktomi "http://www.inktomi.com/">
 <!ENTITY aapi "http://rdf.alchemyapi.com/rdf/v1/s/aapi-schema#">
 <!ENTITY geonames "http://www.geonames.org/ontology#">
+<!ENTITY gr "http://purl.org/goodrelations/v1#"> 
 ]>
 <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -44,6 +45,7 @@
     xmlns:foaf="&foaf;"
     xmlns:bibo="&bibo;"
     xmlns:dc="&dc;"
+    xmlns:gr="&gr;"
     xmlns:nyt="&nyt;"
     xmlns:geonames="&geonames;"
     xmlns:sioc="&sioc;"
@@ -76,6 +78,7 @@
 	</rdf:Description>
 	<rdf:Description rdf:about="{vi:proxyIRI($baseUri)}">
 	    <rdf:type rdf:resource="&geonames;Feature"/>
+        <rdf:type rdf:resource="&gr;LocationOfSalesOrServiceProvisioning"/>
 	    <xsl:copy-of select="*"/>
 	</rdf:Description>
     </xsl:template>
diff --git a/binsrc/rdf_mappers/xslt/main/google_book2rdf.xsl b/binsrc/rdf_mappers/xslt/main/google_book2rdf.xsl
new file mode 100644
index 0000000..5429709
--- /dev/null
+++ b/binsrc/rdf_mappers/xslt/main/google_book2rdf.xsl
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: google_book2rdf.xsl,v 1.1.4.2 2010/08/17 18:32:24 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2010 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY nfo "http://www.semanticdesktop.org/ontologies/nfo/#">
+<!ENTITY video "http://purl.org/media/video#">
+<!ENTITY bibo "http://purl.org/ontology/bibo/">
+<!ENTITY foaf "http://xmlns.com/foaf/0.1/">
+<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
+]>
+
+<xsl:stylesheet
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+  xmlns:dc="http://purl.org/dc/elements/1.1/"
+  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
+  xmlns:content="http://purl.org/rss/1.0/modules/content/"
+  xmlns:r="http://backend.userland.com/rss2"
+  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"  
+  xmlns="http://purl.org/rss/1.0/"
+  xmlns:rss="http://purl.org/rss/1.0/"
+  xmlns:itunes="http://www.itunes.com/DTDs/Podcast-1.0.dtd"
+  xmlns:a="http://www.w3.org/2005/Atom"
+  xmlns:enc="http://purl.oclc.org/net/rss_2.0/enc#"
+  xmlns:skos="http://www.w3.org/2004/02/skos/core#"
+  xmlns:sioc="http://rdfs.org/sioc/ns#"
+  xmlns:g="http://base.google.com/ns/1.0"
+  xmlns:gd="http://schemas.google.com/g/2005"
+  xmlns:gb="http://www.openlinksw.com/schemas/google-base#"
+  xmlns:nfo="&nfo;"
+  xmlns:media="http://search.yahoo.com/mrss/"
+  xmlns:yt="http://gdata.youtube.com/schemas/2007"
+  xmlns:gbs='http://schemas.google.com/books/2008'
+  xmlns:foaf="&foaf;"
+  xmlns:video="&video;"
+  xmlns:owl="http://www.w3.org/2002/07/owl#"
+  xmlns:bibo="&bibo;"
+  xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+  xmlns:dcterms="http://purl.org/dc/terms"
+  version="1.0">
+
+<xsl:output indent="yes" />
+<xsl:param name="baseUri" />
+
+<xsl:variable name="resourceURL" select="vi:proxyIRI ($baseUri)"/>
+<xsl:variable name="docIRI" select="vi:docIRI($baseUri)"/>
+<xsl:variable name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
+
+<xsl:template match="/">
+  <rdf:RDF>
+      <rdf:Description rdf:about="{$docproxyIRI}">
+        <rdf:type rdf:resource="&bibo;Document"/>
+        <sioc:container_of rdf:resource="{$resourceURL}"/>
+        <foaf:primaryTopic rdf:resource="{$resourceURL}"/>
+        <dcterms:subject rdf:resource="{$resourceURL}"/>
+        <dc:title><xsl:value-of select="a:entry/a:title" /></dc:title>
+        <rdfs:label><xsl:value-of select="a:entry/a:title" /></rdfs:label>
+        <owl:sameAs rdf:resource="{$docIRI}"/>
+      </rdf:Description>
+      <xsl:apply-templates/>
+  </rdf:RDF>
+</xsl:template>
+
+<xsl:template match="a:updated">
+  <dcterms:modified>
+    <xsl:value-of select="."/>
+  </dcterms:modified>
+</xsl:template>
+
+<xsl:template match="a:title">
+  <rdfs:label>
+    <xsl:value-of select="."/>
+  </rdfs:label>
+</xsl:template>
+
+<xsl:template match="a:link[@href]">
+    <rdfs:seeAlso rdf:resource="{@href}" />
+</xsl:template>
+
+<xsl:template match="gd:*|gbs:*|dcterms:*">
+    <xsl:copy-of select="." />
+</xsl:template>
+
+<xsl:template match="a:entry">
+    <rdf:Description rdf:about="{$resourceURL}">
+      <rdf:type rdf:resource="&bibo;Book"/>
+          <xsl:apply-templates/>
+    </rdf:Description>
+</xsl:template>
+
+
+<xsl:template name="removeTags">
+    <xsl:variable name="post" select="document-literal (., '', 2, 'UTF-8')"/>
+    <xsl:value-of select="normalize-space(string($post))" />
+</xsl:template>
+
+<xsl:template match="@*|*" />
+
+<xsl:template match="text()">
+  <xsl:value-of select="normalize-space(.)" />
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/binsrc/rdf_mappers/xslt/main/google_document2rdf.xsl b/binsrc/rdf_mappers/xslt/main/google_document2rdf.xsl
index 2a8237d..379c888 100644
--- a/binsrc/rdf_mappers/xslt/main/google_document2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/google_document2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: google_document2rdf.xsl,v 1.1.2.5 2009/12/15 23:13:03 source Exp $
+ -  $Id: google_document2rdf.xsl,v 1.1.2.7 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -43,7 +43,6 @@
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:a="http://www.w3.org/2005/Atom"
-    xmlns:xn="http://www.ning.com/atom/1.0"
     xmlns:gs="&gs;"
     xmlns:bibo="&bibo;"
     xmlns:sioc="&sioc;"
@@ -83,9 +82,9 @@
 			<dcterms:modified rdf:datatype="&xsd;dateTime">
 				<xsl:value-of select="a:updated"/>
 			</dcterms:modified>
-			<dcterms:published>
+			<dcterms:created>
 				<xsl:value-of select="a:published"/>
-			</dcterms:published>
+			</dcterms:created>
 			<dc:title>
 				<xsl:value-of select="a:title"/>
 			</dc:title>
diff --git a/binsrc/rdf_mappers/xslt/main/googlebase2rdf.xsl b/binsrc/rdf_mappers/xslt/main/googlebase2rdf.xsl
index 7616ae2..a5c08cf 100644
--- a/binsrc/rdf_mappers/xslt/main/googlebase2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/googlebase2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: googlebase2rdf.xsl,v 1.3.2.4 2010/02/16 13:48:54 source Exp $
+ -  $Id: googlebase2rdf.xsl,v 1.3.2.8 2011/03/28 13:02:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -42,9 +42,6 @@
 <!ENTITY xsl "http://www.w3.org/1999/XSL/Transform">
 <!ENTITY vcard "http://www.w3.org/2006/vcard/ns#">
 <!ENTITY vi "http://www.openlinksw.com/virtuoso/xslt/">
-<!--
-<!ENTITY vi "xalan://openlink.virtuoso.XalanExtensions.Sponger">
--->
 <!ENTITY virtrdf "http://www.openlinksw.com/schemas/virtrdf#">
 <!ENTITY wgs84 "http://www.w3.org/2003/01/geo/wgs84_pos#">
 ]>
@@ -115,7 +112,9 @@
 			<dcterms:subject rdf:resource="{$resourceURL}"/>
 		<xsl:if test="$numEntries = 1">
 			<!-- Only if baseUri identified a single item directly and isn't a query returning many items -->
-			<rdfs:label><xsl:value-of select="concat('Google Base: ', g:item_type, ' Snippet ', $entryID)"/></rdfs:label>
+      <rdfs:label>
+        <xsl:value-of select="concat('Google Base: ', g:item_type, ' Snippet ', $entryID)"/>
+      </rdfs:label>
 		</xsl:if>
     </xsl:template>
 
@@ -131,7 +130,9 @@
 					<rdf:type rdf:resource="&foaf;Organization" />
 					<foaf:member>
 	    				<foaf:Person rdf:about="{vi:proxyIRI($baseUri, '', concat('Contact_', $entryID))}">
-							<foaf:name><xsl:value-of select="a:title"/></foaf:name>
+              <foaf:name>
+                <xsl:value-of select="a:title"/>
+              </foaf:name>
 							<rdfs:seeAlso rdf:resource="{./a:link[@rel='alternate']/@href}"/>
 						</foaf:Person>
 					</foaf:member>
@@ -139,8 +140,12 @@
 				<xsl:otherwise>
 			<rdf:type rdf:resource="&gr;ProductOrServicesSomeInstancesPlaceholder" />
 			<gr:amountOfThisGood>1</gr:amountOfThisGood>
-	    			<dc:title><xsl:value-of select="a:title"/></dc:title>
-					<rdfs:label><xsl:value-of select="a:title"/></rdfs:label>
+          <gr:name>
+            <xsl:value-of select="a:title"/>
+          </gr:name>
+          <rdfs:label>
+            <xsl:value-of select="a:title"/>
+          </rdfs:label>
 				</xsl:otherwise>
 			</xsl:choose>
 			<!-- OpenLink GoogleBase schema declares a class for each supported item type -->
@@ -172,11 +177,17 @@
 
 		<xsl:choose>
 			<xsl:when test="contains($itemType, 'BusinessLocation')">
-		   		<gr:legalName><xsl:value-of select="."/></gr:legalName>
-		   		<rdfs:label><xsl:value-of select="."/></rdfs:label>
+        <gr:legalName>
+          <xsl:value-of select="."/>
+        </gr:legalName>
+        <rdfs:label>
+          <xsl:value-of select="."/>
+        </rdfs:label>
 			</xsl:when>
 			<xsl:otherwise>
-		<dc:description><xsl:value-of select="."/></dc:description>
+        <gr:description>
+          <xsl:value-of select="."/>
+        </gr:description>
 			</xsl:otherwise>
 		</xsl:choose>
     </xsl:template>
@@ -190,11 +201,15 @@
     </xsl:template>
 
     <xsl:template match="a:entry//a:published">
-		<dcterms:created rdf:datatype="&xsd;dateTime"><xsl:value-of select="."/></dcterms:created>
+    <dcterms:created rdf:datatype="&xsd;dateTime">
+      <xsl:value-of select="."/>
+    </dcterms:created>
     </xsl:template>
 
     <xsl:template match="a:entry//a:updated">
-		<dcterms:modified rdf:datatype="&xsd;dateTime"><xsl:value-of select="."/></dcterms:modified>
+    <dcterms:modified rdf:datatype="&xsd;dateTime">
+      <xsl:value-of select="."/>
+    </dcterms:modified>
     </xsl:template>
 
     <xsl:template match="a:category"/>
@@ -217,22 +232,33 @@
 				</xsl:otherwise>
 			</xsl:choose>
 		    <gr:includes rdf:resource="{$resourceURL}"/>
-		    <gr:validThrough rdf:datatype="&xsd;dateTime"><xsl:value-of select="../g:expiration_date"/></gr:validThrough>
+      <gr:validThrough rdf:datatype="&xsd;dateTime">
+        <xsl:value-of select="../g:expiration_date"/>
+      </gr:validThrough>
 
 			<gr:hasPriceSpecification>
 		  		<gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', concat('Price_', $entryID))}">
 					<xsl:choose>
 						<xsl:when test="contains(../g:listing_type, 'for rent')">
-							<rdfs:label>Rent (per month)</rdfs:label>
+              <rdfs:label>
+		<xsl:value-of select="concat('Rent (per month): ', substring-before(., ' ') , ' (', translate (substring-after(., ' '), $lc, $uc), ')')"/>	
+		</rdfs:label>
 							<gr:hasUnitOfMeasurement>MON</gr:hasUnitOfMeasurement> 
 						</xsl:when>
 						<xsl:otherwise>
-							<rdfs:label>Price</rdfs:label>
-							<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement> <!-- C62 implies 'one' -->	
+              <rdfs:label>
+		<xsl:value-of select="concat(substring-before(., ' ') , ' (', translate (substring-after(., ' '), $lc, $uc), ')')"/>	
+		</rdfs:label>
+              <gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
+              <!-- C62 implies 'one' -->
 						</xsl:otherwise>
 					</xsl:choose>
-           			<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="substring-before(., ' ')"/></gr:hasCurrencyValue>
-           			<gr:hasCurrency rdf:datatype="&xsd;string"><xsl:value-of select="translate (substring-after(., ' '), $lc, $uc)"/></gr:hasCurrency>
+          <gr:hasCurrencyValue rdf:datatype="&xsd;float">
+            <xsl:value-of select="substring-before(., ' ')"/>
+          </gr:hasCurrencyValue>
+          <gr:hasCurrency rdf:datatype="&xsd;string">
+            <xsl:value-of select="translate (substring-after(., ' '), $lc, $uc)"/>
+          </gr:hasCurrency>
           		</gr:UnitPriceSpecification>
 			</gr:hasPriceSpecification>
 		</gr:Offering>
@@ -249,15 +275,24 @@
 		<gr:Offering rdf:about="{vi:proxyIRI($baseUri, '', concat('Offer_', $entryID))}">
 		   	<gr:hasBusinessFunction rdf:resource="&gr;Buy"/>
 		    <gr:includes rdf:resource="{$resourceURL}"/>
-		    <gr:validThrough rdf:datatype="&xsd;dateTime"><xsl:value-of select="g:expiration_date"/></gr:validThrough>
+      <gr:validThrough rdf:datatype="&xsd;dateTime">
+        <xsl:value-of select="g:expiration_date"/>
+      </gr:validThrough>
 
 			<xsl:if test="g:price">
 				<gr:hasPriceSpecification>
 		  			<gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', concat('Price_', $entryID))}">
-						<rdfs:label>Price</rdfs:label>
-						<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement> <!-- C62 implies 'one' -->	
-           				<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="substring-before(g:price, ' ')"/></gr:hasCurrencyValue>
-           				<gr:hasCurrency rdf:datatype="&xsd;string"><xsl:value-of select="translate (substring-after(g:price, ' '), $lc, $uc)"/></gr:hasCurrency>
+            <rdfs:label>
+		<xsl:value-of select="concat( substring-before(g:price, ' '), ' (', translate (substring-after(g:price, ' '), $lc, $uc), ')')"/>	
+		</rdfs:label>
+            <gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
+            <!-- C62 implies 'one' -->
+            <gr:hasCurrencyValue rdf:datatype="&xsd;float">
+              <xsl:value-of select="substring-before(g:price, ' ')"/>
+            </gr:hasCurrencyValue>
+            <gr:hasCurrency rdf:datatype="&xsd;string">
+              <xsl:value-of select="translate (substring-after(g:price, ' '), $lc, $uc)"/>
+            </gr:hasCurrency>
           			</gr:UnitPriceSpecification>
 				</gr:hasPriceSpecification>
 			</xsl:if>
@@ -271,11 +306,16 @@
 			<foaf:topic rdf:resource="{vi:proxyIRI($baseUri, '', concat('Vendor_', $entryID))}"/>
 		</rdf:Description>
 
-		<gr:BusinessEntity rdf:about="{vi:proxyIRI($baseUri, '', concat('Vendor_', $entryID))}"> <!-- TO DO : Risks multiple URIs for same vendor -->
+    <gr:BusinessEntity rdf:about="{vi:proxyIRI($baseUri, '', concat('Vendor_', $entryID))}">
+      <!-- TO DO : Risks multiple URIs for same vendor -->
       		<gr:offers rdf:resource="{vi:proxyIRI ($baseUri, '', concat('Offer_', $entryID))}"/>
 			<rdfs:comment>The legal agent making the offering</rdfs:comment>
-		    <rdfs:label><xsl:value-of select="a:name"/></rdfs:label>
-		    <gr:legalName><xsl:value-of select="a:name"/></gr:legalName>
+      <rdfs:label>
+        <xsl:value-of select="a:name"/>
+      </rdfs:label>
+      <gr:legalName>
+        <xsl:value-of select="a:name"/>
+      </gr:legalName>
     	</gr:BusinessEntity>
     </xsl:template>
 
@@ -286,11 +326,16 @@
 			<foaf:topic rdf:resource="{vi:proxyIRI($baseUri, '', concat('Buyer_', $entryID))}"/>
 		</rdf:Description>
 
-		<gr:BusinessEntity rdf:about="{vi:proxyIRI($baseUri, '', concat('Buyer_', $entryID))}"> <!-- TO DO : Risks multiple URIs for same buyer -->
+    <gr:BusinessEntity rdf:about="{vi:proxyIRI($baseUri, '', concat('Buyer_', $entryID))}">
+      <!-- TO DO : Risks multiple URIs for same buyer -->
       		<gr:seeks rdf:resource="{vi:proxyIRI ($baseUri, '', concat('Offer_', $entryID))}"/>
 			<rdfs:comment>The legal agent seeking the offering</rdfs:comment>
-		    <rdfs:label><xsl:value-of select="a:name"/></rdfs:label>
-		    <gr:legalName><xsl:value-of select="a:name"/></gr:legalName>
+      <rdfs:label>
+        <xsl:value-of select="a:name"/>
+      </rdfs:label>
+      <gr:legalName>
+        <xsl:value-of select="a:name"/>
+      </gr:legalName>
     	</gr:BusinessEntity>
     </xsl:template>
 
@@ -336,24 +381,36 @@
 				<vcard:adr>
 					<vcard:Address rdf:about="{vi:proxyIRI($baseUri, '', concat('VCardAddress_', $entryID))}">
 						<xsl:if test="string-length($pt1) > 0">
-						<vcard:street-address><xsl:value-of select="$pt1"/></vcard:street-address>
+            <vcard:street-address>
+              <xsl:value-of select="$pt1"/>
+            </vcard:street-address>
 						</xsl:if>
 						<xsl:if test="string-length($pt2) > 0">
-						<vcard:locality><xsl:value-of select="$pt2"/></vcard:locality>
+            <vcard:locality>
+              <xsl:value-of select="$pt2"/>
+            </vcard:locality>
 						</xsl:if>
 						<xsl:if test="string-length($pt3) > 0">
-						<vcard:region><xsl:value-of select="$pt3"/></vcard:region>
+            <vcard:region>
+              <xsl:value-of select="$pt3"/>
+            </vcard:region>
 						</xsl:if>
 						<xsl:choose>
 							<xsl:when test="string-length($pt4) > 0">
-						<vcard:postal-code><xsl:value-of select="$pt4"/></vcard:postal-code>
+              <vcard:postal-code>
+                <xsl:value-of select="$pt4"/>
+              </vcard:postal-code>
 							</xsl:when>
 							<xsl:otherwise>
-								<vcard:postal-code><xsl:value-of select="$pt3a"/></vcard:postal-code>
+              <vcard:postal-code>
+                <xsl:value-of select="$pt3a"/>
+              </vcard:postal-code>
 							</xsl:otherwise>
 						</xsl:choose>
 						<xsl:if test="string-length($pt5) > 0">
-						<vcard:country-name><xsl:value-of select="$pt5"/></vcard:country-name>
+            <vcard:country-name>
+              <xsl:value-of select="$pt5"/>
+            </vcard:country-name>
 						</xsl:if>
 					</vcard:Address>
 				</vcard:adr>
@@ -367,21 +424,29 @@
     </xsl:template>
 
     <xsl:template match="g:latitude">
-		<wgs84:lat><xsl:value-of select="."/></wgs84:lat>
+    <wgs84:lat>
+      <xsl:value-of select="."/>
+    </wgs84:lat>
     </xsl:template>
 
     <xsl:template match="g:longitude">
-		<wgs84:long><xsl:value-of select="."/></wgs84:long>
+    <wgs84:long>
+      <xsl:value-of select="."/>
+    </wgs84:long>
     </xsl:template>
 
-    <xsl:template match="g:price" /> <!-- Already handled by "offers" mode -->
-    <xsl:template match="a:author" /> <!-- Already handled by "offers" mode -->
+  <xsl:template match="g:price" />
+  <!-- Already handled by "offers" mode -->
+  <xsl:template match="a:author" />
+  <!-- Already handled by "offers" mode -->
 
 	<!-- UPCs should be 12 characters, not all Google Base entries conform -->
     <xsl:template match="g:upc"> 
 		<xsl:choose>
 			<xsl:when test="string-length(.)=12">
-				<gr:hasEAN_UCC-13><xsl:value-of select="concat('0', .)"/></gr:hasEAN_UCC-13>
+        <gr:hasEAN_UCC-13>
+          <xsl:value-of select="concat('0', .)"/>
+        </gr:hasEAN_UCC-13>
 			</xsl:when>
 			<xsl:otherwise>
 				<xsl:element name="{local-name(.)}" namespace="&oplgb;">
@@ -400,7 +465,8 @@
 		<xsl:element name="{local-name(.)}" namespace="&oplgb;">
 			<xsl:choose>
 				<xsl:when test="contains(local-name(.), 'bathrooms')">
-	    			<xsl:value-of select="floor(.)"/><!-- floor used to force e.g 1.0 to 1 -->
+          <xsl:value-of select="floor(.)"/>
+          <!-- floor used to force e.g 1.0 to 1 -->
 				</xsl:when>
 				<xsl:otherwise>
 	    			<xsl:value-of select="."/>
diff --git a/binsrc/rdf_mappers/xslt/main/groupon2rdf.xsl b/binsrc/rdf_mappers/xslt/main/groupon2rdf.xsl
new file mode 100644
index 0000000..2b785bc
--- /dev/null
+++ b/binsrc/rdf_mappers/xslt/main/groupon2rdf.xsl
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ -
+ -  $Id: groupon2rdf.xsl,v 1.1.4.2 2011/01/03 23:40:02 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2009 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+<!DOCTYPE xsl:stylesheet
+[
+<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
+<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<!ENTITY bibo "http://purl.org/ontology/bibo/">
+<!ENTITY foaf "http://xmlns.com/foaf/0.1/">
+<!ENTITY dcterms "http://purl.org/dc/terms/">
+<!ENTITY sioc "http://rdfs.org/sioc/ns#">
+<!ENTITY gr "http://purl.org/goodrelations/v1#">
+]>
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+xmlns:rdf="&rdf;"
+xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+xmlns:foaf="&foaf;"
+xmlns:bibo="&bibo;"
+xmlns:sioc="&sioc;" 
+xmlns:gr="&gr;"
+xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
+xmlns:dcterms="&dcterms;"
+xmlns:opl="http://www.openlinksw.com/schema/attribution#"
+xmlns:dc="http://purl.org/dc/elements/1.1/"
+xmlns:owl="http://www.w3.org/2002/07/owl#" 
+>
+
+  <xsl:output method="xml" indent="yes" />
+
+  <xsl:param name="baseUri" />
+
+  <xsl:variable name="resourceURL" select="vi:proxyIRI ($baseUri)" />
+  <xsl:variable name="docIRI" select="vi:docIRI($baseUri)" />
+  <xsl:variable name="docproxyIRI" select="vi:docproxyIRI($baseUri)" />
+  
+  <xsl:template match="/response">
+    <rdf:RDF>
+          <rdf:Description rdf:about="{$docproxyIRI}">
+            <rdf:type rdf:resource="&bibo;Document" />
+            <sioc:container_of rdf:resource="{$resourceURL}" />
+            <foaf:primaryTopic rdf:resource="{$resourceURL}" />
+            <foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'Vendor')}" />
+            <foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'Offering')}" />
+            <dcterms:subject rdf:resource="{$resourceURL}" />
+          </rdf:Description>
+          
+		  <gr:BusinessEntity rdf:about="{vi:proxyIRI ($baseUri, '', 'Vendor')}">
+            <rdfs:label><xsl:value-of select="deal/merchant/name" /></rdfs:label>
+            <gr:legalName><xsl:value-of select="deal/merchant/name" /></gr:legalName>
+            <foaf:name><xsl:value-of select="deal/merchant/id" /></foaf:name>
+            <gr:offers rdf:resource="{vi:proxyIRI ($baseUri, '', 'Offering')}" />
+            <foaf:homepage rdf:resource="{deal/merchant/websiteUrl}" />
+          </gr:BusinessEntity>
+		  
+          <gr:Offering rdf:about="{vi:proxyIRI ($baseUri, '', 'Offering')}">
+            <sioc:has_container rdf:resource="{$docproxyIRI}" />
+            <gr:hasBusinessFunction rdf:resource="&gr;Sell" />
+            <gr:validFrom rdf:datatype="&xsd;dateTime">
+              <xsl:value-of select="deal/startAt" />
+            </gr:validFrom>
+            <gr:validThrough rdf:datatype="&xsd;dateTime">
+              <xsl:value-of select="deal/endAt" />
+            </gr:validThrough>
+            <xsl:apply-templates mode="offering" />
+          </gr:Offering>
+          <xsl:apply-templates />
+    </rdf:RDF>
+  </xsl:template>
+
+  <xsl:template match="deal" mode="offering">
+    <gr:includes rdf:resource="{$resourceURL}" />
+    <gr:availableDeliveryMethods rdf:resource="&gr;DeliveryModePickup" />
+    <xsl:apply-templates mode="offering" />
+  </xsl:template>
+
+  <xsl:template match="deal">
+    <rdf:Description rdf:about="{$resourceURL}">
+      <rdf:type rdf:resource="&gr;ProductOrServicesSomeInstancesPlaceholder" />
+		<opl:providedBy>
+			<foaf:Organization rdf:about="http://www.groupon.com#this">
+				<foaf:name><xsl:value-of select="concat('Groupon: ', name)"/></foaf:name>
+				<foaf:homepage rdf:resource="http://www.groupon.com"/>
+			</foaf:Organization>
+		</opl:providedBy>
+	  
+      <xsl:apply-templates />
+    </rdf:Description>
+  </xsl:template>
+
+  <xsl:template match="mediumImageUrl">
+		<foaf:img rdf:resource="{.}"/>
+  </xsl:template>
+  <xsl:template match="smallImageUrl">
+		<foaf:img rdf:resource="{.}"/>
+  </xsl:template>
+  <xsl:template match="largeImageUrl">
+		<foaf:img rdf:resource="{.}"/>
+  </xsl:template>
+  <xsl:template match="sidebarImageUrl">
+		<foaf:img rdf:resource="{.}"/>
+  </xsl:template>
+  <xsl:template match="pitchHtml">
+	<gr:description>
+		<xsl:value-of select="."/>
+	</gr:description>
+  </xsl:template>
+    <xsl:template match="dealUrl">
+		<bibo:uri rdf:resource="{.}"/>
+    </xsl:template>
+
+    <xsl:template match="highlightsHtml">
+		<dc:description>
+			<xsl:value-of select="."/>
+		</dc:description>
+    </xsl:template>
+  
+     <xsl:template match="title">
+		<rdfs:label>
+			<xsl:value-of select="."/>
+		</rdfs:label>
+		<gr:name>
+			<xsl:value-of select="."/>
+		</gr:name>
+    </xsl:template>
+
+     <xsl:template match="announcementTitle">
+		<rdfs:label>
+			<xsl:value-of select="."/>
+		</rdfs:label>
+		<gr:name>
+			<xsl:value-of select="."/>
+		</gr:name>
+    </xsl:template>
+	
+    <xsl:template match="options/option/price">
+		<gr:hasPriceSpecification>
+			<gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'price')}">
+				<rdfs:label><xsl:value-of select="formattedAmount"/></rdfs:label>
+				<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="amount div 100"/></gr:hasCurrencyValue>
+				<gr:hasCurrency rdf:datatype="&xsd;string"><xsl:value-of select="currencyCode"/></gr:hasCurrency>
+			</gr:UnitPriceSpecification>
+		</gr:hasPriceSpecification>
+    </xsl:template>
+	
+    <xsl:template match="division/lat">
+		<geo:lat rdf:datatype="&xsd;float">
+			<xsl:value-of select="."/>
+		</geo:lat>
+    </xsl:template>
+
+    <xsl:template match="division/lng">
+		<geo:long rdf:datatype="&xsd;float">
+			<xsl:value-of select="."/>
+		</geo:long>
+    </xsl:template>
+	
+
+  <xsl:template match="text()|@*" />
+  <xsl:template match="text()|@*" mode="offering" />
+  <xsl:template match="text()|@*" mode="manufacturer" />
+</xsl:stylesheet>
diff --git a/binsrc/rdf_mappers/xslt/main/haudio2rdf.xsl b/binsrc/rdf_mappers/xslt/main/haudio2rdf.xsl
index 476f721..d5df407 100644
--- a/binsrc/rdf_mappers/xslt/main/haudio2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/haudio2rdf.xsl
@@ -122,7 +122,7 @@
 <xsl:choose>
      	<xsl:when test="$groupLink">
   		<xsl:for-each select="$groupLink">
-			<xsl:element name='foaf:maker'>
+			<xsl:element name='dcterms:creator'>
 				<xsl:attribute name='rdf:nodeID'>
 					<xsl:value-of select="generate-id()"/>
 				</xsl:attribute>
@@ -131,7 +131,7 @@
 	</xsl:when>
     	<xsl:otherwise>
   		<xsl:for-each select="$groupLinkalt">
-			<xsl:element name='foaf:maker'>
+			<xsl:element name='dcterms:creator'>
 				<xsl:attribute name='rdf:nodeID'>
 					<xsl:value-of select="generate-id()"/>
 				</xsl:attribute>
@@ -210,7 +210,7 @@
 <xsl:template name="published">
 <xsl:param name="pubdate" select="descendant::*[contains(concat(' ',normalize-space(attribute::class),' '),' published ')]"/>
 <xsl:if test="$pubdate">
-	<dc:date><xsl:value-of select="$pubdate" /></dc:date>
+	<dcterms:issued><xsl:value-of select="$pubdate" /></dcterms:issued>
 </xsl:if>
 </xsl:template>
 
@@ -289,7 +289,7 @@
 <xsl:template name="trackLink">
 <xsl:param name="audio" select="/.//*[contains(concat(' ',normalize-space(attribute::class),' '),' contributor ')][1]"/>
 <xsl:for-each select="$audio">
-	<xsl:element name='foaf:maker'>
+	<xsl:element name='dcterms:creator'>
   		<xsl:attribute name='rdf:nodeID'>
 				<xsl:value-of select="generate-id()"/>
 		</xsl:attribute>
diff --git a/binsrc/rdf_mappers/xslt/main/hcal2rdf.xsl b/binsrc/rdf_mappers/xslt/main/hcal2rdf.xsl
index 281a5ea..d29cd04 100644
--- a/binsrc/rdf_mappers/xslt/main/hcal2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/hcal2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hcal2rdf.xsl,v 1.1.2.2 2009/08/27 15:09:12 source Exp $
+ -  $Id: hcal2rdf.xsl,v 1.1.2.4 2011/01/03 23:40:02 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -24,19 +24,37 @@
 <!DOCTYPE xsl:stylesheet [
   <!ENTITY CalNS  "http://www.w3.org/2002/12/cal/icaltzd#">
   <!ENTITY XdtNS  "http://www.w3.org/2001/XMLSchema#">
+<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
+<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<!ENTITY bibo "http://purl.org/ontology/bibo/">
+<!ENTITY foaf "http://xmlns.com/foaf/0.1/">
+<!ENTITY dcterms "http://purl.org/dc/terms/">
+<!ENTITY sioc "http://rdfs.org/sioc/ns#">
+<!ENTITY gr "http://purl.org/goodrelations/v1#">
+<!ENTITY dc "http://purl.org/dc/elements/1.1/">
 ]>
 <xsl:stylesheet
     xmlns:xsl ="http://www.w3.org/1999/XSL/Transform"
-    xmlns:rdf   ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:c   ="http://www.w3.org/2002/12/cal/icaltzd#"
     xmlns:h   ="http://www.w3.org/1999/xhtml"
     xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+    xmlns:rdf="&rdf;"
+    xmlns:foaf="&foaf;"
+    xmlns:bibo="&bibo;"
+    xmlns:dc="&dc;"
+    xmlns:sioc="&sioc;"
+    xmlns:dcterms="&dcterms;"
+    xmlns:gr="&gr;"
     xmlns:xml   ="xml"
     version="1.0"
     >
 
     <xsl:output indent="yes" method="xml" />
     <xsl:param name="baseUri" />
+<xsl:variable name="resourceURL" select="vi:proxyIRI ($baseUri)"/>
+<xsl:variable  name="docIRI" select="vi:docIRI($baseUri)"/>
+<xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
+
     <xsl:param name="Source">
 	<xsl:choose>
 	    <xsl:when test='h:html/h:head/h:link[@rel="base"]'>
@@ -46,7 +64,7 @@
 		<xsl:value-of select='h:html/h:head/h:base/@href'/>
 	    </xsl:when>
 	    <xsl:otherwise>
-		<xsl:value-of select="$baseUri"/>
+		<xsl:value-of select="$resourceURL"/>
 	    </xsl:otherwise>
 	</xsl:choose>
     </xsl:param>
@@ -56,7 +74,11 @@
     <xsl:template match="/">
 	<rdf:RDF>
 	    <xsl:if test="//*[contains(concat(' ',normalize-space(@class),' '),' vevent ')] or //*[contains(concat(' ', normalize-space(@class), ' '),' vtodo ')]">
-		<c:Vcalendar rdf:about="{$baseUri}">
+	<rdf:Description rdf:about="{$docproxyIRI}">
+		<rdf:type rdf:resource="&bibo;Document"/>
+		<foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'hcalendar')}"/>
+	</rdf:Description>
+		<c:Vcalendar rdf:about="{vi:proxyIRI ($baseUri, '', 'hcalendar')}">
 		    <c:prodid>-//connolly.w3.org//palmagent 0.6 (BETA)//EN</c:prodid>
 		    <c:version>2.0</c:version>
 		    <xsl:apply-templates />
@@ -104,12 +126,18 @@
     </xsl:template>
 
     <xsl:template name="cal-props">
-	<xsl:if test="@id and $Source">
+	<xsl:if test="@id">
 	    <xsl:attribute name="rdf:about">
-		<xsl:value-of select='concat($Source, "#", @id)' />
+		<xsl:value-of select='vi:proxyIRI ($baseUri, "", ../@id)' />
 	    </xsl:attribute>
 	</xsl:if>
 
+	<!--xsl:if test="not @id and .//*[contains(concat(' ', @class, ' '), ' dtstart ')]/@title and .//*[contains(concat(' ', @class, ' '), ' summary ')]">
+	    <xsl:attribute name="rdf:about">
+		<xsl:value-of select='vi:proxyIRI ($baseUri, "#", concat(.//*[contains(concat(" ", @class, " "), " summary ")]/., .//*[contains(concat(" ", @class, " "), " dtstart ")]/@title))' />
+	    </xsl:attribute>
+	</xsl:if-->
+
 	<xsl:call-template name="textProp">
 	    <xsl:with-param name="class">uid</xsl:with-param>
 	</xsl:call-template>
@@ -181,7 +209,7 @@
 
 	<xsl:for-each select=".//*[contains(concat(' ', @class, ' '), concat(' ', $class, ' '))]">
 	    <xsl:element name="{$class}" namespace="&CalNS;">
-		<xsl:call-template name="lang" />
+		<!--xsl:call-template name="lang" /-->
 
 		<xsl:choose>
 		    <xsl:when test='local-name(.) = "ol" or local-name(.) = "ul"'>
diff --git a/binsrc/rdf_mappers/xslt/main/hcard2rdf.xsl b/binsrc/rdf_mappers/xslt/main/hcard2rdf.xsl
index 71010fc..aefa52a 100644
--- a/binsrc/rdf_mappers/xslt/main/hcard2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/hcard2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hcard2rdf.xsl,v 1.1.2.4 2009/12/15 23:13:03 source Exp $
+ -  $Id: hcard2rdf.xsl,v 1.1.2.6 2011/03/25 17:10:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -34,6 +34,7 @@
 
 <xsl:preserve-space elements="*"/>
 <xsl:param name="baseUri" />
+<xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
 
 <xsl:template match="/">
   <rdf:RDF>
@@ -49,7 +50,7 @@
   </xsl:variable>
 
   <xsl:if test="$vcard != 0">
-    <rdf:Description rdf:about="{$baseUri}">
+    <rdf:Description rdf:about="{$docproxyIRI}">
       <foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'hcard')}"/>
     </rdf:Description>
     <v:VCard rdf:about="{vi:proxyIRI ($baseUri, '', 'hcard')}">
@@ -559,16 +560,19 @@
     <xsl:when test="$token = 'home' or $token = 'personal'">
       <v:homeAdr rdf:parseType="Resource">
 	<xsl:copy-of select="$fields"/>
+	<rdfs:label><xsl:value-of select="concat($fields/v:extended-address, ' ', $fields/v:street-address, ', ', $fields/v:locality, ', ', $fields/v:postal-code, ', ', $fields/v:country-name)"/></rdfs:label>
       </v:homeAdr>
     </xsl:when>
     <xsl:when test="$token = 'work' or $token = 'office'">
       <v:workAdr rdf:parseType="Resource">
 	<xsl:copy-of select="$fields"/>
+	<rdfs:label><xsl:value-of select="concat($fields/v:extended-address, ' ', $fields/v:street-address, ', ', $fields/v:locality, ', ', $fields/v:postal-code, ', ', $fields/v:country-name)"/></rdfs:label>
       </v:workAdr>
     </xsl:when>
     <xsl:otherwise>
       <v:adr rdf:parseType="Resource">
 	<xsl:copy-of select="$fields"/>
+	<rdfs:label><xsl:value-of select="concat($fields/v:extended-address, ' ', $fields/v:street-address, ', ', $fields/v:locality, ', ', $fields/v:postal-code, ', ', $fields/v:country-name)"/></rdfs:label>
       </v:adr>
     </xsl:otherwise>
   </xsl:choose>
diff --git a/binsrc/rdf_mappers/xslt/main/hlisting2rdf.xsl b/binsrc/rdf_mappers/xslt/main/hlisting2rdf.xsl
index b22710e..bcd16ab 100644
--- a/binsrc/rdf_mappers/xslt/main/hlisting2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/hlisting2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hlisting2rdf.xsl,v 1.1.2.2 2009/08/27 15:09:12 source Exp $
+ -  $Id: hlisting2rdf.xsl,v 1.1.2.4 2011/03/25 17:10:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -21,22 +21,35 @@
  -  with this program; if not, write to the Free Software Foundation, Inc.,
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -->
-<xsl:stylesheet xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rss="http://purl.org/rss/1.0/"
-    xmlns:dcterms="http://purl.org/dc/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:skos="http://www.w3.org/2004/02/skos/core#"
-    xmlns:admin="http://webns.net/mvcb/" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:owl="http://www.w3.org/2002/07/owl#"
-    xmlns:review="http:/www.purl.org/stuff/rev#" xmlns:hlisting="http://www.openlinksw.com/schemas/hlisting/"
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:v="http://www.w3.org/2006/vcard/ns#"
+<xsl:stylesheet
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:rss="http://purl.org/rss/1.0/"
+    xmlns:dcterms="http://purl.org/dc/terms/"
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+	xmlns:foaf="http://xmlns.com/foaf/0.1/"
+	xmlns:skos="http://www.w3.org/2004/02/skos/core#"
+    xmlns:admin="http://webns.net/mvcb/" xmlns:h="http://www.w3.org/1999/xhtml" 
+	xmlns:owl="http://www.w3.org/2002/07/owl#"
+    xmlns:review="http:/www.purl.org/stuff/rev#" 
+	xmlns:hlisting="http://www.openlinksw.com/schemas/hlisting/"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+	xmlns:v="http://www.w3.org/2006/vcard/ns#"
+	xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
     version="1.0">
     <xsl:output indent="yes" omit-xml-declaration="yes" method="xml" />
     <xsl:param name="baseUri" />
+	<xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>	
     <xsl:template match="/h:html/h:body">
         <rdf:RDF>
             <xsl:apply-templates />
         </rdf:RDF>
     </xsl:template>
     <xsl:template match="//*[@class='hlisting']">
-        <hlisting:Listing rdf:about="{$baseUri}">
+      <rdf:Description rdf:about="{$docproxyIRI}">
+        <foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'hlisting')}" />
+      </rdf:Description>	
+        <hlisting:Listing rdf:about="{vi:proxyIRI ($baseUri, '', 'hlisting')}">
             <xsl:apply-templates mode="hlisting" />
         </hlisting:Listing>
     </xsl:template>
@@ -536,16 +549,19 @@
             <xsl:when test="$token = 'home' or $token = 'personal'">
                 <v:homeAdr rdf:parseType="Resource">
                     <xsl:copy-of select="$fields" />
+		    <rdfs:label><xsl:value-of select="concat($fields/v:extended-address, ' ', $fields/v:street-address, ', ', $fields/v:locality, ', ', $fields/v:postal-code, ', ', $fields/v:country-name)"/></rdfs:label>
                 </v:homeAdr>
             </xsl:when>
             <xsl:when test="$token = 'work' or $token = 'office'">
                 <v:workAdr rdf:parseType="Resource">
                     <xsl:copy-of select="$fields" />
+		    <rdfs:label><xsl:value-of select="concat($fields/v:extended-address, ' ', $fields/v:street-address, ', ', $fields/v:locality, ', ', $fields/v:postal-code, ', ', $fields/v:country-name)"/></rdfs:label>
                 </v:workAdr>
             </xsl:when>
             <xsl:otherwise>
                 <v:adr rdf:parseType="Resource">
                     <xsl:copy-of select="$fields" />
+	            <rdfs:label><xsl:value-of select="concat($fields/v:extended-address, ' ', $fields/v:street-address, ', ', $fields/v:locality, ', ', $fields/v:postal-code, ', ', $fields/v:country-name)"/></rdfs:label>
                 </v:adr>
             </xsl:otherwise>
         </xsl:choose>
diff --git a/binsrc/rdf_mappers/xslt/main/hnews2rdf.xsl b/binsrc/rdf_mappers/xslt/main/hnews2rdf.xsl
new file mode 100644
index 0000000..96a088a
--- /dev/null
+++ b/binsrc/rdf_mappers/xslt/main/hnews2rdf.xsl
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<!--
+ -
+ -  $Id: hnews2rdf.xsl,v 1.1.4.6 2011/03/23 12:13:04 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2010 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+<xsl:stylesheet
+xmlns:dc="http://purl.org/dc/elements/1.1/"
+xmlns:rss="http://purl.org/rss/1.0/"
+xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+xmlns:foaf="http://xmlns.com/foaf/0.1/"
+xmlns:skos="http://www.w3.org/2004/02/skos/core#"
+xmlns:dcterms="http://purl.org/dc/terms/"
+xmlns:admin="http://webns.net/mvcb/"
+xmlns:h="http://www.w3.org/1999/xhtml"
+xmlns:owl="http://www.w3.org/2002/07/owl#"
+xmlns:hrev="http:/www.purl.org/stuff/hrev#"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:bibo="http://purl.org/ontology/bibo/"
+xmlns:vcard="http://www.w3.org/2006/vcard/ns#"
+xmlns:geo  ="http://www.w3.org/2003/01/geo/wgs84_pos#"
+xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+xmlns:hnews="http://ontologi.es/hnews#"
+version="1.0">
+
+  <xsl:output indent="yes" omit-xml-declaration="yes" method="xml"/>
+  
+  <xsl:param name="baseUri" />
+  <xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>  
+  <xsl:template match="/">
+    <rdf:RDF>
+      <xsl:apply-templates />
+    </rdf:RDF>
+  </xsl:template>
+
+  <xsl:template match="*[contains(@class, 'hnews hentry')]">
+    <rdf:Description rdf:about="{$docproxyIRI}">
+        <foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'hnews')}" />
+    </rdf:Description>
+    <bibo:Article rdf:about="{vi:proxyIRI ($baseUri, '', 'hnews')}">
+      <xsl:apply-templates mode="hnews"/>
+    </bibo:Article>
+  </xsl:template>
+
+  <xsl:template match="*" mode="hnews">
+    <xsl:variable name="class" select="@class" />
+    
+    <xsl:variable name="field">
+      <xsl:choose>
+        <xsl:when test="substring($class, string-length($class)-1)= 'fn' and substring($class, 1, string-length($class)-3) != ''">
+          <xsl:value-of select="substring($class, 1, string-length($class)-3)" />
+        </xsl:when>
+        <xsl:when test="substring($class, 1, 3)='fn' and substring($class, 3, string-length($class)+1) != ''">
+          <xsl:value-of select="substring($class, 3, string-length($class)+1)" />
+        </xsl:when>
+        <xsl:when test="$class='reviewbody description'">
+          <xsl:value-of select="'description'" />
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$class" />
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:variable name="rel">
+      <xsl:value-of select="@rel" />
+    </xsl:variable>
+    
+    <xsl:choose>
+      
+      <xsl:when test="contains($field, 'entry-title')">
+        <dc:title>
+          <xsl:value-of select="." />
+        </dc:title>
+        <xsl:if test="@rel='bookmark'">
+          <bibo:uri rdf:resource="{@href}" />
+        </xsl:if>
+      </xsl:when>
+
+      <xsl:when test="contains($field, 'updated')">
+        <dcterms:modified>
+          <xsl:value-of select="@title" />
+        </dcterms:modified>
+      </xsl:when>
+
+      <xsl:when test="contains($field, 'dateline')">
+        <hnews:dateline-literal>
+          <xsl:value-of select="."/>
+        </hnews:dateline-literal>
+      </xsl:when>
+
+      <xsl:when test="$field='author vcard'">
+        <dcterms:creator>
+          <foaf:Person>
+            <foaf:name>
+              <xsl:value-of select="./*[@class='fn']"/>
+            </foaf:name>
+          </foaf:Person>
+        </dcterms:creator>
+      </xsl:when>
+      
+      <xsl:when test="contains($field, 'source-org')">
+        <hnews:source-org>
+			<foaf:Organization rdf:about="{vi:proxyIRI ($baseUri, '', 'source_org')}">
+				<foaf:name>
+					<xsl:value-of select="." />
+				</foaf:name>
+			</foaf:Organization>
+        </hnews:source-org>
+      </xsl:when>
+      
+      <xsl:when test="contains($field, 'entry-content')">
+        <bibo:content>
+          <xsl:value-of select="."/>
+        </bibo:content>
+      </xsl:when>
+
+      <xsl:when test="contains($field, 'latitude')">
+		<hnews:geo>	  
+			<geo:Point rdf:about="{vi:proxyIRI ($baseUri, '', 'geo')}">
+        <geo:lat rdf:datatype="http://www.w3.org/2001/XMLSchema#double">
+          <xsl:value-of select="."/>
+        </geo:lat>
+			</geo:Point>
+		</hnews:geo>	  
+      </xsl:when>
+
+      <xsl:when test="contains($field, 'longitude')">
+		<hnews:geo>	  
+			<geo:Point rdf:about="{vi:proxyIRI ($baseUri, '', 'geo')}">
+        <geo:long rdf:datatype="http://www.w3.org/2001/XMLSchema#double">
+          <xsl:value-of select="."/>
+        </geo:long>
+			</geo:Point>
+		</hnews:geo>	  
+      </xsl:when>
+
+      <xsl:when test="contains($rel, 'item-license')">
+        <dc:rights>
+          <xsl:value-of select=".."/>
+        </dc:rights>
+      </xsl:when>
+
+      <xsl:when test="contains($rel, 'principles')">
+        <hnews:principles rdf:resource="{@href}"/>
+      </xsl:when>
+
+      <xsl:when test="contains($rel, 'follows-principles')">
+        <hnews:follows-principles rdf:resource="{@href}"/>
+      </xsl:when>
+      
+    </xsl:choose>
+
+    <xsl:apply-templates mode="hnews" />
+
+  </xsl:template>
+
+  <xsl:template match="text()" mode="hnews" />
+  <xsl:template match="text()" />
+
+</xsl:stylesheet>
diff --git a/binsrc/rdf_mappers/xslt/main/hproduct2rdf.xsl b/binsrc/rdf_mappers/xslt/main/hproduct2rdf.xsl
index 4a6c932..d3b0886 100644
--- a/binsrc/rdf_mappers/xslt/main/hproduct2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/hproduct2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hproduct2rdf.xsl,v 1.1.2.3 2009/12/15 23:13:03 source Exp $
+ -  $Id: hproduct2rdf.xsl,v 1.1.2.5 2011/01/03 23:40:02 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -29,15 +29,18 @@
 <!ENTITY dcterms "http://purl.org/dc/terms/">
 <!ENTITY sioc "http://rdfs.org/sioc/ns#">
 <!ENTITY gr "http://purl.org/goodrelations/v1#">
+<!ENTITY dc "http://purl.org/dc/elements/1.1/">
 ]>
 <xsl:stylesheet version="1.0"
 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
 	xmlns:v="http://www.w3.org/2006/vcard/ns#"
 	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
 	xmlns:h="http://www.w3.org/1999/xhtml"
     xmlns:rdf="&rdf;"
     xmlns:foaf="&foaf;"
     xmlns:bibo="&bibo;"
+    xmlns:dc="&dc;"
     xmlns:sioc="&sioc;"
     xmlns:dcterms="&dcterms;"
     xmlns:gr="&gr;">
@@ -46,6 +49,11 @@
 
 <xsl:preserve-space elements="*"/>
 
+<xsl:param name="baseUri"/>
+<xsl:variable name="resourceURL" select="vi:proxyIRI ($baseUri)"/>
+<xsl:variable  name="docIRI" select="vi:docIRI($baseUri)"/>
+<xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
+
 <xsl:template match="/">
   <rdf:RDF>
     <xsl:apply-templates/>
@@ -60,7 +68,10 @@
   </xsl:variable>
 
   <xsl:if test="$hproduct != 0">
-    <gr:ProductOrService>
+	<rdf:Description rdf:about="{$docproxyIRI}">
+        <foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'hproduct')}" />
+	</rdf:Description>
+    <gr:ProductOrService rdf:about="{vi:proxyIRI ($baseUri, '', 'hproduct')}">
       <xsl:apply-templates mode="extract-hproduct"/>
     </gr:ProductOrService>
   </xsl:if>
@@ -171,9 +182,8 @@
   <xsl:if test="$price != 0">
 	<gr:hasPriceSpecification>
 		<gr:UnitPriceSpecification  rdf:ID="price">
-	    <rdfs:label><xsl:value-of select="concat('List Price of ', ., ' USD')"/></rdfs:label>
+	    <rdfs:label><xsl:value-of select="concat('List Price of ', .)"/></rdfs:label>
         <gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="."/></gr:hasCurrencyValue>
-        <gr:hasCurrency rdf:datatype="&xsd;string">USD</gr:hasCurrency>
         </gr:UnitPriceSpecification>
 	</gr:hasPriceSpecification>
  </xsl:if>
diff --git a/binsrc/rdf_mappers/xslt/main/hrecipe2rdf.xsl b/binsrc/rdf_mappers/xslt/main/hrecipe2rdf.xsl
new file mode 100644
index 0000000..259b0f6
--- /dev/null
+++ b/binsrc/rdf_mappers/xslt/main/hrecipe2rdf.xsl
@@ -0,0 +1,331 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ -
+ -  $Id: hrecipe2rdf.xsl,v 1.1.4.4 2011/03/08 13:36:28 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2009 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+xmlns:h="http://www.w3.org/1999/xhtml"
+xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+xmlns:foaf="http://xmlns.com/foaf/0.1/"
+xmlns:dc="http://purl.org/dc/elements/1.1/"
+xmlns:sioc="http://rdfs.org/sioc/ns#"
+xmlns:wdrs="http://www.w3.org/2007/05/powder-s#"
+xmlns:dv="http://rdf.data-vocabulary.org/" version="1.0">
+  <xsl:output method="xml" encoding="utf-8" indent="yes" />
+  <xsl:preserve-space elements="*" />
+  <xsl:param name="baseUri" />
+
+  <xsl:variable name="resourceURL" select="vi:proxyIRI ($baseUri)"/>
+  <xsl:variable  name="docIRI" select="vi:docIRI($baseUri)"/>
+  <xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
+  
+  <xsl:template match="/">
+    <rdf:RDF>
+      <xsl:apply-templates />
+    </rdf:RDF>
+  </xsl:template>
+  <xsl:template match="*">
+    <xsl:variable name="recipe">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'hrecipe'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="$recipe = 0">	
+		<xsl:variable name="recipe">
+		  <xsl:call-template name="testclass">
+			<xsl:with-param name="val" select="'hRecipe'" />
+		  </xsl:call-template>
+		</xsl:variable>
+    </xsl:if>
+    <xsl:if test="$recipe != 0">
+      <rdf:Description rdf:about="{$docproxyIRI}">
+        <foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'hrecipe')}" />
+      </rdf:Description>
+      <dv:Recipe rdf:about="{vi:proxyIRI ($baseUri, '', 'hrecipe')}">
+	<foaf:page rdf:resource="{$baseUri}"/>
+	<wdrs:describedBy rdf:resource="{$resourceURL}"/>
+        <xsl:apply-templates mode="extract-recipe" />
+      </dv:Recipe>
+    </xsl:if>
+    <xsl:apply-templates />
+  </xsl:template>
+  <xsl:template match="comment()|processing-instruction()|text()" />
+  <!-- ============================================================ -->
+  <xsl:template match="*" mode="extract-recipe">
+    <xsl:variable name="fn">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'fn'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="ingredient">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'ingredient'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="ingredients">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'ingredients'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="yield">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'yield'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="instructions">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'instructions'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="directions">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'directions'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="duration">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'duration'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="prepTime">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'prepTime'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="cooktime">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'cooktime'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="cookTime">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'cookTime'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="totalTime">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'totalTime'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="photo">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'photo'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="food-image">
+      <xsl:call-template name="testid">
+        <xsl:with-param name="val" select="'food-image'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="summary">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'summary'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="author">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'author'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="published">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'published'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="nutrition">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'nutrition'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="nutritional-information">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'nutritional-information'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="tag">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'tag'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <!-- ============================================================ -->
+    <xsl:if test="$fn != 0">
+      <dc:title>
+        <xsl:value-of select="." />
+      </dc:title>
+      <dv:name>
+        <xsl:value-of select="." />
+      </dv:name>
+    </xsl:if>
+	
+    <xsl:if test="$ingredient != 0">
+		<xsl:variable name="ing_name">
+		  <xsl:call-template name="testclass">
+			<xsl:with-param name="val" select="'name'" />
+		  </xsl:call-template>
+		</xsl:variable>
+		<xsl:choose>
+			<xsl:when test="$ing_name">
+			  <dv:ingredient>
+				<dv:Ingredient rdf:about="{vi:proxyIRI ($baseUri, '', concat('hrecipe', .))}">
+					<dv:name>
+						<xsl:value-of select="*[@class = 'name' or starts-with(@class,concat('name', ' ')) or contains(@class,concat(' ','name',' ')) 
+						or substring(@class, string-length(@class)-string-length('name')) = concat(' ','name')]" />
+					</dv:name>
+					<dv:amount>
+						<xsl:choose>
+							<xsl:when test="*[@class = 'amount' or starts-with(@class,concat('amount', ' ')) or contains(@class,concat(' ','amount',' ')) 
+									or substring(@class, string-length(@class)-string-length('amount')) = concat(' ','amount')]">
+								<xsl:variable name="amount" select="*[@class = 'amount' or starts-with(@class,concat('amount', ' ')) or contains(@class,concat(' ','amount',' ')) 
+									or substring(@class, string-length(@class)-string-length('amount')) = concat(' ','amount')]"/>
+							</xsl:when>
+							<xsl:otherwise>
+								<xsl:variable name="amount" select="."/>
+							</xsl:otherwise>
+						</xsl:choose>
+						<xsl:value-of select="$amount" />
+					</dv:amount>
+				</dv:Ingredient>
+			  </dv:ingredient>
+			</xsl:when>
+			<xsl:otherwise>
+				<dv:ingredient>
+					<xsl:value-of select="." />
+				</dv:ingredient>
+			</xsl:otherwise>
+		</xsl:choose>
+    </xsl:if>
+
+	<xsl:if test="$ingredients != 0">
+      <dv:ingredient>
+        <xsl:value-of select="." />
+      </dv:ingredient>
+    </xsl:if>
+	
+    <xsl:if test="$yield != 0">
+      <dv:yield>
+        <xsl:value-of select="." />
+      </dv:yield>
+    </xsl:if>
+    <xsl:if test="$instructions != 0">
+      <dv:instructions>
+        <xsl:value-of select="." />
+      </dv:instructions>
+    </xsl:if>
+    <xsl:if test="$directions != 0">
+      <dv:instructions>
+        <xsl:value-of select="." />
+      </dv:instructions>
+    </xsl:if>
+    <xsl:if test="$duration != 0">
+      <dv:duration>
+        <xsl:value-of select="." />
+      </dv:duration>
+    </xsl:if>
+    <xsl:if test="$prepTime != 0">
+	  <xsl:if test="string-length(.) > 0">
+      <dv:prepTime>
+        <xsl:value-of select="." />
+      </dv:prepTime>
+    </xsl:if>
+    </xsl:if>
+    <xsl:if test="$cooktime != 0">
+	  <dv:cookTime>
+		<xsl:value-of select="." />
+	  </dv:cookTime>
+    </xsl:if>
+    <xsl:if test="$cookTime != 0">
+	  <xsl:if test="string-length(.) > 0">
+   	  <dv:cookTime>
+        <xsl:value-of select="." />
+      </dv:cookTime>
+	  </xsl:if>
+    </xsl:if>
+    <xsl:if test="$totalTime != 0">
+	  <xsl:if test="string-length(.) > 0">
+      <dv:totalTime>
+        <xsl:value-of select="." />
+      </dv:totalTime>
+    </xsl:if>
+    </xsl:if>
+    <xsl:if test="$food-image != 0 and @src">
+      <dv:photo rdf:resource="{@src}" />
+    </xsl:if>
+    <xsl:if test="$photo != 0 and @src">
+      <dv:photo rdf:resource="{@src}" />
+    </xsl:if>
+    <xsl:if test="$summary != 0">
+      <dv:summary>
+        <xsl:value-of select="." />
+      </dv:summary>
+    </xsl:if>
+    <xsl:if test="$author != 0">
+      <dv:author>
+        <xsl:value-of select="." />
+      </dv:author>
+    </xsl:if>
+    <xsl:if test="$published != 0">
+      <dv:published>
+        <xsl:value-of select="." />
+      </dv:published>
+    </xsl:if>
+    <xsl:if test="$nutrition != 0">
+	  <xsl:if test="string-length(.) > 0">
+      <dv:nutrition>
+        <xsl:value-of select="." />
+      </dv:nutrition>
+    </xsl:if>
+    </xsl:if>
+    <xsl:if test="$nutritional-information != 0">
+	  <xsl:if test="string-length(.) > 0">
+  	  <dv:nutrition>
+        <xsl:value-of select="." />
+      </dv:nutrition>
+    </xsl:if>
+    </xsl:if>
+    <xsl:if test="$tag != 0">
+      <dv:tag>
+        <xsl:value-of select="." />
+      </dv:tag>
+    </xsl:if>
+    <xsl:apply-templates mode="extract-recipe" />
+  </xsl:template>
+  <xsl:template match="comment()|processing-instruction()|text()" mode="extract-recipe" />
+  
+  <xsl:template name="testclass">
+    <xsl:param name="class" select="@class" />
+    <xsl:param name="val" select="''" />
+    <xsl:choose>
+      <xsl:when test="$class = $val or starts-with($class,concat($val, ' ')) or contains($class,concat(' ',$val,' ')) or substring($class, string-length($class)-string-length($val)) = concat(' ',$val)">1</xsl:when>
+      <xsl:otherwise>0</xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+  
+  <xsl:template name="testid">
+    <xsl:param name="class" select="@id" />
+    <xsl:param name="val" select="''" />
+    <xsl:choose>
+      <xsl:when test="$class = $val or starts-with($class,concat($val, ' ')) or contains($class,concat(' ',$val,' ')) or substring($class, string-length($class)-string-length($val)) = concat(' ',$val)">1</xsl:when>
+      <xsl:otherwise>0</xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/binsrc/rdf_mappers/xslt/main/hresume2rdf.xsl b/binsrc/rdf_mappers/xslt/main/hresume2rdf.xsl
index da090ba..15de004 100644
--- a/binsrc/rdf_mappers/xslt/main/hresume2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/hresume2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hresume2rdf.xsl,v 1.1.2.3 2010/02/16 13:49:30 source Exp $
+ -  $Id: hresume2rdf.xsl,v 1.1.2.5 2011/03/25 17:10:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -21,22 +21,38 @@
  -  with this program; if not, write to the Free Software Foundation, Inc.,
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -->
-<xsl:stylesheet xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rss="http://purl.org/rss/1.0/"
-    xmlns:dcterms="http://purl.org/dc/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:skos="http://www.w3.org/2004/02/skos/core#"
-    xmlns:admin="http://webns.net/mvcb/" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:owl="http://www.w3.org/2002/07/owl#"
-    xmlns:review="http:/www.purl.org/stuff/rev#" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:v="http://www.w3.org/2006/vcard/ns#" xmlns:cv="http://purl.org/captsolo/resume-rdf/0.2/cv#"
-    xmlns:cvbase="http://purl.org/captsolo/resume-rdf/0.2/base#" version="1.0">
+<xsl:stylesheet 
+	xmlns:dc="http://purl.org/dc/elements/1.1/" 
+	xmlns:rss="http://purl.org/rss/1.0/"
+    xmlns:dcterms="http://purl.org/dc/terms/" 
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
+	xmlns:foaf="http://xmlns.com/foaf/0.1/" 
+	xmlns:skos="http://www.w3.org/2004/02/skos/core#"
+    xmlns:admin="http://webns.net/mvcb/" 
+	xmlns:h="http://www.w3.org/1999/xhtml" 
+	xmlns:owl="http://www.w3.org/2002/07/owl#"
+    xmlns:review="http:/www.purl.org/stuff/rev#" 
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:v="http://www.w3.org/2006/vcard/ns#" 
+	xmlns:cv="http://purl.org/captsolo/resume-rdf/0.2/cv#"
+    xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+	xmlns:cvbase="http://purl.org/captsolo/resume-rdf/0.2/base#" 
+	version="1.0">
     <xsl:output indent="yes" omit-xml-declaration="yes" method="xml" />
     <xsl:param name="baseUri" />
+	<xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
+	
     <xsl:template match="/">
         <rdf:RDF>
             <xsl:apply-templates />
         </rdf:RDF>
     </xsl:template>
     <xsl:template match="//*[@class='hresume']">
-        <cv:CV rdf:about="{$baseUri}">
+		<rdf:Description rdf:about="{$docproxyIRI}">
+			<foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'hresume')}" />
+		</rdf:Description>
+        <cv:CV rdf:about="{vi:proxyIRI ($baseUri, '', 'hresume')}">
             <xsl:apply-templates mode="hresume" />
         </cv:CV>
     </xsl:template>
@@ -556,16 +572,19 @@
             <xsl:when test="$token = 'home' or $token = 'personal'">
                 <v:homeAdr rdf:parseType="Resource">
                     <xsl:copy-of select="$fields" />
+		<rdfs:label><xsl:value-of select="concat($fields/v:extended-address, ' ', $fields/v:street-address, ', ', $fields/v:locality, ', ', $fields/v:postal-code, ', ', $fields/v:country-name)"/></rdfs:label>
                 </v:homeAdr>
             </xsl:when>
             <xsl:when test="$token = 'work' or $token = 'office'">
                 <v:workAdr rdf:parseType="Resource">
                     <xsl:copy-of select="$fields" />
+		<rdfs:label><xsl:value-of select="concat($fields/v:extended-address, ' ', $fields/v:street-address, ', ', $fields/v:locality, ', ', $fields/v:postal-code, ', ', $fields/v:country-name)"/></rdfs:label>
                 </v:workAdr>
             </xsl:when>
             <xsl:otherwise>
                 <v:adr rdf:parseType="Resource">
                     <xsl:copy-of select="$fields" />
+		<rdfs:label><xsl:value-of select="concat($fields/v:extended-address, ' ', $fields/v:street-address, ', ', $fields/v:locality, ', ', $fields/v:postal-code, ', ', $fields/v:country-name)"/></rdfs:label>
                 </v:adr>
             </xsl:otherwise>
         </xsl:choose>
diff --git a/binsrc/rdf_mappers/xslt/main/hreview2rdf.xsl b/binsrc/rdf_mappers/xslt/main/hreview2rdf.xsl
index 372a0aa..336235b 100644
--- a/binsrc/rdf_mappers/xslt/main/hreview2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/hreview2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hreview2rdf.xsl,v 1.1.2.2 2009/08/27 15:09:12 source Exp $
+ -  $Id: hreview2rdf.xsl,v 1.1.2.4 2010/12/14 12:07:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -21,99 +21,176 @@
  -  with this program; if not, write to the Free Software Foundation, Inc.,
  -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -->
-<xsl:stylesheet
-xmlns:dc="http://purl.org/dc/elements/1.1/"
-xmlns:rss="http://purl.org/rss/1.0/"
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:v="http://www.w3.org/2006/vcard/ns#"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
-xmlns:foaf="http://xmlns.com/foaf/0.1/"
-xmlns:skos="http://www.w3.org/2004/02/skos/core#"
-xmlns:admin="http://webns.net/mvcb/"
 xmlns:h="http://www.w3.org/1999/xhtml"
-xmlns:owl="http://www.w3.org/2002/07/owl#"
-xmlns:review="http:/www.purl.org/stuff/rev#"
-xmlns:hrev="http:/www.purl.org/stuff/hrev#"
-xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-version="1.0">
-
-<xsl:output indent="yes" omit-xml-declaration="yes" method="xml"/>
-
-<xsl:template match="/h:html/h:body">
+xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+xmlns:foaf="http://xmlns.com/foaf/0.1/"
+xmlns:dc="http://purl.org/dc/elements/1.1/"
+xmlns:dcterms="http://purl.org/dc/terms/"
+xmlns:review="http://www.purl.org/stuff/rev#"
+xmlns:bibo="http://purl.org/ontology/bibo/"
+xmlns:hrev="http://www.purl.org/stuff/hrev#" version="1.0">
+  <xsl:output method="xml" encoding="utf-8" indent="yes" />
+  <xsl:preserve-space elements="*" />
+  <xsl:param name="baseUri" />
+  <xsl:variable name="docproxyIRI"
+  select="vi:docproxyIRI($baseUri)" />
+  <xsl:template match="/">
   <rdf:RDF>
 	<xsl:apply-templates />
   </rdf:RDF>
 </xsl:template>
+  <xsl:template match="*">
+    <xsl:variable name="hreview">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'hreview'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="$hreview != 0">
+      <rdf:Description rdf:about="{$docproxyIRI}">
+        <foaf:topic rdf:resource="{vi:proxyIRI($baseUri, '', concat('hreview', position()))}" />
+      </rdf:Description>
+      <review:Review rdf:about="{vi:proxyIRI ($baseUri, '', concat('hreview', position()))}">
 
-
-<xsl:template match="//*[@class='hreview']">
-  <review:Review>
-	<xsl:apply-templates mode="hreview"/>
+        <xsl:apply-templates mode="extract-hreview" />
   </review:Review>
+    </xsl:if>
+    <xsl:apply-templates />
 </xsl:template>
-
-<xsl:template match="*" mode="hreview">
-  <xsl:variable name="class" select="@class" />
-  <xsl:variable name="field">
-	<xsl:choose>
-	  <xsl:when test="substring($class, string-length($class)-1)= 'fn' and substring($class, 1, string-length($class)-3) != ''">
-		<xsl:value-of select="substring($class, 1, string-length($class)-3)" />
-	  </xsl:when>
-
-	  <xsl:when test="substring($class, 1, 3)='fn' and substring($class, 3, string-length($class)+1) != ''">
-		<xsl:value-of select="substring($class, 3, string-length($class)+1)" />
-	    </xsl:when>
-
-	  <xsl:when test="$class='reviewbody description'">
-		<xsl:value-of select="'description'" />
-	  </xsl:when>
-
-	  <xsl:otherwise>
-		<xsl:value-of select="$class" />
-	  </xsl:otherwise>
-	</xsl:choose>
+  <xsl:template match="comment()|processing-instruction()|text()" />
+  <!-- ============================================================ -->
+  <xsl:template match="*" mode="extract-hreview">
+    <xsl:variable name="version">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'version'" />
+      </xsl:call-template>
   </xsl:variable>
-
-  <!--
-  Class: "<xsl:value-of select="$class" />"
-  Field: "<xsl:value-of select="$field" />"
-  -->
-<xsl:choose>
-  <xsl:when test="$field='reviewer'">
+    <xsl:variable name="summary">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'summary'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="reviewer">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'reviewer'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="dtreviewed">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'dtreviewed'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="rating">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'rating'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="description">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'description'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="tags">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'tags'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="permalink">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'permalink'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="license">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'license'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="item">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'item'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <!-- ============================================================ -->
+    <xsl:if test="$item != 0">
+    <xsl:apply-templates select="." mode="extract-item"/>
+  </xsl:if>
+    <xsl:if test="$version != 0">
+      <review:version>
+        <xsl:value-of select="." />
+      </review:version>
+    </xsl:if>
+    <xsl:if test="$summary != 0">
+      <dc:description>
+        <xsl:value-of select="." />
+      </dc:description>
+    </xsl:if>
+    <xsl:if test="$reviewer != 0 and a/@href">
 	<review:reviewer>
-	  <foaf:Person>
-		<foaf:name><xsl:value-of select="../*"/></foaf:name>
+		  <foaf:Person rdf:about="{vi:proxyIRI($baseUri, '', concat('reviewer', .))}">
+			<foaf:name><xsl:value-of select="."/></foaf:name>
+			<bibo:uri rdf:resource="{a/@href}"/>
 	  </foaf:Person>
 	</review:reviewer>
-  </xsl:when>
-  <xsl:when test="$field='reviewer vcard'">
-	<review:reviewer>
-	  <foaf:Person>
-		<foaf:name><xsl:value-of select="@title"/></foaf:name>
-	  </foaf:Person>
-	</review:reviewer>
-  </xsl:when>
-  <xsl:when test="$field='description'">
-	<dc:description><xsl:value-of select="." /></dc:description>
-  </xsl:when>
-  <xsl:when test="$field='rating'">
-	<review:rating><xsl:value-of select="../*" /></review:rating>
-  </xsl:when>
-  <xsl:when test="$field='summary'">
-	<dc:title><xsl:value-of select="." /></dc:title>
-  </xsl:when>
-  <xsl:when test="$field='dtreview'">
-	<dc:date><xsl:value-of select="../*" /></dc:date>
-  </xsl:when>
-  <xsl:when test="$field='dtreviewed'">
-	<dc:date><xsl:value-of select="@title" /></dc:date>
-  </xsl:when>
-</xsl:choose>
-
-<xsl:apply-templates mode="hreview" />
-
+    </xsl:if>
+    <xsl:if test="$dtreviewed != 0">
+      <dcterms:modified>
+        <xsl:value-of select="." />
+      </dcterms:modified>
+    </xsl:if>
+    <xsl:if test="$rating != 0">
+      <review:rating>
+        <xsl:value-of select="." />
+      </review:rating>
+    </xsl:if>
+    <xsl:if test="$description != 0">
+      <review:text>
+        <xsl:value-of select="." />
+      </review:text>
+    </xsl:if>
+    <xsl:if test="$tags != 0">
+      <review:tags>
+        <xsl:value-of select="." />
+      </review:tags>
+    </xsl:if>
+    <xsl:if test="$permalink != 0 and @src">
+      <bibo:uri rdf:resource="{@src}" />
+    </xsl:if>
+    <xsl:if test="$license != 0">
+      <review:license>
+        <xsl:value-of select="." />
+      </review:license>
+    </xsl:if>
+    <xsl:apply-templates mode="extract-hreview" />
 </xsl:template>
+  <xsl:template match="comment()|processing-instruction()|text()"
+  mode="extract-hreview" />
+  <!-- ============================================================ -->
+  <xsl:template match="*" mode="extract-item">
+    <xsl:variable name="fn">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'fn'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="$fn != 0">
+      <review:title>
+        <xsl:value-of select="." />
+      </review:title>
+    </xsl:if>
+    <xsl:apply-templates mode="extract-item" />
+  </xsl:template>
+  <xsl:template match="comment()|processing-instruction()|text()"
+  mode="extract-item" />
 
-<xsl:template match="text()" mode="hreview" />
-<xsl:template match="text()" />
-
+  <xsl:template name="testclass">
+    <xsl:param name="class" select="@class" />
+    <xsl:param name="val" select="''" />
+    <xsl:choose>
+      <xsl:when test="$class = $val or starts-with($class,concat($val, ' ')) or contains($class,concat(' ',$val,' ')) or substring($class, string-length($class)-string-length($val)) = concat(' ',$val)">
+      1</xsl:when>
+      <xsl:otherwise>0</xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
 </xsl:stylesheet>
diff --git a/binsrc/rdf_mappers/xslt/main/hreview_aggregate2rdf.xsl b/binsrc/rdf_mappers/xslt/main/hreview_aggregate2rdf.xsl
new file mode 100644
index 0000000..7e5928a
--- /dev/null
+++ b/binsrc/rdf_mappers/xslt/main/hreview_aggregate2rdf.xsl
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ -
+ -  $Id: hreview_aggregate2rdf.xsl,v 1.1.4.2 2010/12/14 12:07:57 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2009 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+xmlns:v="http://www.w3.org/2006/vcard/ns#"
+xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+xmlns:h="http://www.w3.org/1999/xhtml"
+xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+xmlns:foaf="http://xmlns.com/foaf/0.1/"
+xmlns:dc="http://purl.org/dc/elements/1.1/"
+xmlns:dcterms="http://purl.org/dc/terms/"
+xmlns:review="http://www.purl.org/stuff/rev#"
+xmlns:bibo="http://purl.org/ontology/bibo/"
+xmlns:hrev="http://www.purl.org/stuff/hrev#" version="1.0">
+  <xsl:output method="xml" encoding="utf-8" indent="yes" />
+  <xsl:preserve-space elements="*" />
+  <xsl:param name="baseUri" />
+  <xsl:variable name="docproxyIRI"
+  select="vi:docproxyIRI($baseUri)" />
+  <xsl:template match="/">
+    <rdf:RDF>
+      <xsl:apply-templates />
+    </rdf:RDF>
+  </xsl:template>
+  <xsl:template match="*">
+    <xsl:variable name="hreview">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'hreview-aggregate'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="$hreview != 0">
+      <rdf:Description rdf:about="{$docproxyIRI}">
+        <foaf:topic rdf:resource="{vi:proxyIRI($baseUri, '', concat('hreview-aggregate', position()))}" />
+      </rdf:Description>
+      <review:Review rdf:about="{vi:proxyIRI ($baseUri, '', concat('hreview-aggregate', position()))}">
+        <xsl:apply-templates mode="extract-hreview" />
+      </review:Review>
+    </xsl:if>
+    <xsl:apply-templates />
+  </xsl:template>
+  <xsl:template match="comment()|processing-instruction()|text()" />
+  <!-- ============================================================ -->
+  <xsl:template match="*" mode="extract-hreview">
+    <xsl:variable name="version">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'version'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="summary">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'summary'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="count">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'count'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="votes">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'votes'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="reviewer">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'reviewer'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="dtreviewed">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'dtreviewed'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="rating">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'rating'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="description">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'description'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="tags">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'tags'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="permalink">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'permalink'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="license">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'license'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="item">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'item'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <!-- ============================================================ -->
+    <xsl:if test="$item != 0">
+    <xsl:apply-templates select="." mode="extract-item"/>
+  </xsl:if>
+    <xsl:if test="$version != 0">
+      <review:version>
+        <xsl:value-of select="." />
+      </review:version>
+    </xsl:if>
+    <xsl:if test="$count != 0">
+      <review:totalVotes>
+        <xsl:value-of select="." />
+      </review:totalVotes>
+    </xsl:if>
+    <xsl:if test="$votes != 0">
+      <review:positiveVotes>
+        <xsl:value-of select="." />
+      </review:positiveVotes>
+    </xsl:if>
+    <xsl:if test="$summary != 0">
+      <dc:description>
+        <xsl:value-of select="." />
+      </dc:description>
+    </xsl:if>
+    <xsl:if test="$reviewer != 0 and a/@href">
+		<review:reviewer>
+		  <foaf:Person rdf:about="{vi:proxyIRI($baseUri, '', concat('reviewer', .))}">
+			<foaf:name><xsl:value-of select="."/></foaf:name>
+			<bibo:uri rdf:resource="{a/@href}"/>
+		  </foaf:Person>
+		</review:reviewer>
+    </xsl:if>
+    <xsl:if test="$dtreviewed != 0">
+      <dcterms:modified>
+        <xsl:value-of select="." />
+      </dcterms:modified>
+    </xsl:if>
+    <xsl:if test="$rating != 0">
+      <review:rating>
+        <xsl:value-of select="." />
+      </review:rating>
+    </xsl:if>
+    <xsl:if test="$description != 0">
+      <review:text>
+        <xsl:value-of select="." />
+      </review:text>
+    </xsl:if>
+    <xsl:if test="$tags != 0">
+      <review:tags>
+        <xsl:value-of select="." />
+      </review:tags>
+    </xsl:if>
+    <xsl:if test="$permalink != 0 and @src">
+      <bibo:uri rdf:resource="{@src}" />
+    </xsl:if>
+    <xsl:if test="$license != 0">
+      <review:license>
+        <xsl:value-of select="." />
+      </review:license>
+    </xsl:if>
+    <xsl:apply-templates mode="extract-hreview" />
+  </xsl:template>
+  <xsl:template match="comment()|processing-instruction()|text()"
+  mode="extract-hreview" />
+  <!-- ============================================================ -->
+  <xsl:template match="*" mode="extract-item">
+    <xsl:variable name="fn">
+      <xsl:call-template name="testclass">
+        <xsl:with-param name="val" select="'fn'" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="$fn != 0">
+      <review:title>
+        <xsl:value-of select="." />
+      </review:title>
+    </xsl:if>
+    <xsl:apply-templates mode="extract-item" />
+  </xsl:template>
+  <xsl:template match="comment()|processing-instruction()|text()"
+  mode="extract-item" />
+  
+  <xsl:template name="testclass">
+    <xsl:param name="class" select="@class" />
+    <xsl:param name="val" select="''" />
+    <xsl:choose>
+      <xsl:when test="$class = $val or starts-with($class,concat($val, ' ')) or contains($class,concat(' ',$val,' ')) or substring($class, string-length($class)-string-length($val)) = concat(' ',$val)">
+      1</xsl:when>
+      <xsl:otherwise>0</xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/binsrc/rdf_mappers/xslt/main/html2rdf.xsl b/binsrc/rdf_mappers/xslt/main/html2rdf.xsl
index afa2942..f6cc875 100644
--- a/binsrc/rdf_mappers/xslt/main/html2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/html2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: html2rdf.xsl,v 1.1.2.13 2010/07/08 13:41:53 source Exp $
+ -  $Id: html2rdf.xsl,v 1.1.2.17 2010/12/08 16:05:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -28,6 +28,7 @@
 <!ENTITY sioc "http://rdfs.org/sioc/ns#">
 <!ENTITY owl "http://www.w3.org/2002/07/owl#">
 <!ENTITY awol "http://bblfish.net/work/atom-owl/2006-06-06/#">
+<!ENTITY dcterms "http://purl.org/dc/terms/">
 ]>
 <xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -43,9 +44,11 @@
   xmlns:umbel="http://umbel.org/umbel#"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   xmlns:awol="&awol;"
+  xmlns:dcterms="&dcterms;"
   version="1.0">
   <xsl:output method="xml" indent="yes" encoding="utf-8"/>
   <xsl:param name="baseUri" />
+  <xsl:param name="source" />
   <xsl:variable name="resourceURL" select="vi:proxyIRI ($baseUri)"/>
   <xsl:variable  name="docIRI" select="vi:docIRI($baseUri)"/>
   <xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
@@ -83,7 +86,7 @@
       <xsl:if test="not ($baseUri like 'http://%.nytimes.com/%')">
 	  <rdf:Description rdf:about="{$resourceURL}#content">
 	      <rdf:type rdf:resource="&awol;Content"/>
-	      <awol:src rdf:resource="{$baseUri}"/>
+	      <awol:src rdf:resource="{$source}"/>
 	  </rdf:Description>
       </xsl:if>
   </xsl:template>
@@ -121,9 +124,11 @@
   </xsl:template>
 
   <xsl:template match="meta[translate (@name, $uc, $lc)='author']">
+	<xsl:if test="string-length(@content) > 0">      
       <dc:creator>
 		<xsl:value-of select="@content"/>
       </dc:creator>
+	</xsl:if>
   </xsl:template>
 
   <xsl:template match="meta[translate (@name, $uc, $lc)='byl']">
@@ -139,23 +144,13 @@
   </xsl:template>
 
   <xsl:template match="meta[translate (@name, $uc, $lc)='keywords']">
-      <dc:subject>
+      <dcterms:subject>
 		<xsl:value-of select="@content"/>
-	  </dc:subject>
-      <!--xsl:variable name="res" select="vi:umbelGet (@content)"/>
-      <xsl:for-each select="$res//object[@type='umbel:SubjectConcept']">
-	  <umbel:isAbout rdf:resource="{@uri}"/>
-      </xsl:for-each>
-      <xsl:variable name="nes" select="vi:umbelGetNE (@content)"/>
-      <xsl:for-each select="$nes//object[@type='owl:Thing']">
-	  <owl:sameAs rdf:resource="{@uri}"/>
-      </xsl:for-each-->
+	  </dcterms:subject>
   </xsl:template>
 
   <xsl:template match="img[@src like 'http://farm%.static.flickr.com/%/%\\_%.%']">
-      <foaf:depiction>
-	  <foaf:Image rdf:about="{@src}"/>
-      </foaf:depiction>
+      <foaf:depiction rdf:resource="{@src}"/>
   </xsl:template>
 
   <xsl:template match="a[@href]">
diff --git a/binsrc/rdf_mappers/xslt/main/ics2rdf.xsl b/binsrc/rdf_mappers/xslt/main/ics2rdf.xsl
index 8338b2d..d292fb7 100644
--- a/binsrc/rdf_mappers/xslt/main/ics2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/ics2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ics2rdf.xsl,v 1.1.2.7 2010/04/22 12:42:16 source Exp $
+ -  $Id: ics2rdf.xsl,v 1.1.2.8 2011/03/23 12:13:04 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -224,7 +224,7 @@
     </xsl:template>
 
     <xsl:template match="val">
-	<xsl:value-of select="normalize-space(.)"/>
+	<xsl:value-of select="vi:string2date3(normalize-space(.))"/>
     </xsl:template>
 
     <xsl:template match="URL|DIR" priority="1">
diff --git a/binsrc/rdf_mappers/xslt/main/idiomag2rdf.xsl b/binsrc/rdf_mappers/xslt/main/idiomag2rdf.xsl
index a3a8529..3da3cdd 100644
--- a/binsrc/rdf_mappers/xslt/main/idiomag2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/idiomag2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: idiomag2rdf.xsl,v 1.1.4.3 2010/05/26 15:23:14 source Exp $
+ -  $Id: idiomag2rdf.xsl,v 1.1.4.4 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -84,9 +84,6 @@
 			<xsl:for-each select="related/artist">
 				<rdfs:seeAlso rdf:resource="{links/url}"/>
 			</xsl:for-each>
-			<!--xsl:for-each select="tags/tag">
-				<sioc:topic rdf:resource="{.}"/>			
-			</xsl:for-each-->
 		</rdf:Description>
 	</xsl:template>
 
diff --git a/binsrc/rdf_mappers/xslt/main/isbn2rdf.xsl b/binsrc/rdf_mappers/xslt/main/isbn2rdf.xsl
index d99dea6..f5b67fb 100644
--- a/binsrc/rdf_mappers/xslt/main/isbn2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/isbn2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: isbn2rdf.xsl,v 1.1.2.4 2009/09/23 21:37:41 source Exp $
+ -  $Id: isbn2rdf.xsl,v 1.1.2.5 2010/07/28 12:23:31 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -29,6 +29,7 @@
 <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
 <!ENTITY sioc "http://rdfs.org/sioc/ns#">
 <!ENTITY geo "http://www.w3.org/2003/01/geo/wgs84_pos#">
+<!ENTITY gr "http://purl.org/goodrelations/v1#"> 
 ]>
 <xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -43,6 +44,7 @@
   xmlns:foaf="&foaf;"
   xmlns:sioc="&sioc;"
   xmlns:bibo="&bibo;"
+  xmlns:gr="&gr;"
   xmlns:book="&book;"
   xmlns:owl="http://www.w3.org/2002/07/owl#"
   version="1.0">
@@ -76,6 +78,7 @@
     <xsl:template match="ISBNdb/BookList/BookData">
 	<rdf:Description rdf:about="{vi:proxyIRI(concat('http://isbndb.com/d/book/', @book_id, '.html'))}">
 		<rdf:type rdf:resource="&book;Book"/>
+        <rdf:type rdf:resource="&gr;ProductOrServiceModel"/>
 	</rdf:Description>
 
 	<bibo:Book rdf:about="{vi:proxyIRI(concat('http://isbndb.com/d/book/', @book_id, '.html'))}">
@@ -86,6 +89,11 @@
             <book:isbn>
                 <xsl:value-of select="@isbn"/>
             </book:isbn>
+              <xsl:if test="string-length(@isbn) = 13">
+                <gr:hasEAN_UCC-13>
+                    <xsl:value-of select="@isbn"/>
+                </gr:hasEAN_UCC-13>  
+              </xsl:if>
             </xsl:if>
             <bibo:uri>
                 <xsl:value-of select="concat('http://isbndb.com/d/book/', @book_id, '.html')"/>
diff --git a/binsrc/rdf_mappers/xslt/main/lastfm2rdf.xsl b/binsrc/rdf_mappers/xslt/main/lastfm2rdf.xsl
index 6b0f7bd..b5de49c 100644
--- a/binsrc/rdf_mappers/xslt/main/lastfm2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/lastfm2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: lastfm2rdf.xsl,v 1.1.2.6 2009/12/15 23:13:03 source Exp $
+ -  $Id: lastfm2rdf.xsl,v 1.1.2.9 2011/03/25 17:10:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -66,6 +66,7 @@
 
     <xsl:param name="baseUri" />
     <xsl:param name="id" />
+  
     <xsl:variable name="resourceURL" select="vi:proxyIRI ($baseUri)"/>
     <xsl:variable  name="docIRI" select="vi:docIRI($baseUri)"/>
     <xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
@@ -80,19 +81,23 @@
 			<xsl:apply-templates select="lfm[@status='ok']/similarartists"/>
 			<xsl:apply-templates select="lfm[@status='ok']/album"/>
 			<xsl:apply-templates select="lfm[@status='ok']/albums"/>
-			<xsl:apply-templates select="lfm[@status='ok']/topalbums[@artist]"/>
-			<xsl:apply-templates select="lfm[@status='ok']/topalbums[@user]"/>
-			<xsl:apply-templates select="lfm[@status='ok']/topartists[@user]"/>
 			<xsl:apply-templates select="lfm[@status='ok']/track"/>
-			<xsl:apply-templates select="lfm[@status='ok']/toptracks[@artist]"/>
-			<xsl:apply-templates select="lfm[@status='ok']/toptracks[@user]"/>
 			<xsl:apply-templates select="lfm[@status='ok']/similartracks"/>
 			<xsl:apply-templates select="lfm[@status='ok']/event"/>
 			<xsl:apply-templates select="lfm[@status='ok']/events"/>
 			<xsl:apply-templates select="lfm[@status='ok']/user"/>
 			<xsl:apply-templates select="lfm[@status='ok']/friends"/>
-			<xsl:apply-templates select="lfm[@status='ok']/playlists[@user]"/>
 			<xsl:apply-templates select="lfm[@status='ok']/playlist"/>
+
+      <xsl:apply-templates select="lfm[@status='ok']/topalbums[@artist]"/>
+      <xsl:apply-templates select="lfm[@status='ok']/toptracks[@artist]"/>
+
+      <xsl:apply-templates select="lfm[@status='ok']/topalbums[@user]"/>
+      <xsl:apply-templates select="lfm[@status='ok']/topartists[@user]"/>
+      <xsl:apply-templates select="lfm[@status='ok']/toptracks[@user]"/>
+      <xsl:apply-templates select="lfm[@status='ok']/playlists[@user]"/>
+      <xsl:apply-templates select="lfm[@status='ok']/recenttracks[@user]"/>
+
 			<xsl:apply-templates select="profile"/>
 		</rdf:RDF>
     </xsl:template>
@@ -100,9 +105,9 @@
     <xsl:template match="lfm[@status='ok']/playlist">
 		<rdf:Description rdf:about="{vi:proxyIRI($baseUri, '', $id)}">
 			<rdf:type rdf:resource="&sioct;PlayList"/>
-			<dcterms:title>
+			<dc:title>
                 <xsl:value-of select="title"/>
-            </dcterms:title>
+            </dc:title>
 			<xsl:for-each select="trackList/track">
 				<sioc:container_of rdf:resource="{vi:proxyIRI(identifier)}"/>
 			</xsl:for-each>
@@ -238,65 +243,89 @@
    	<xsl:template match="lfm[@status='ok']/toptracks[@user]">
 		<rdf:Description rdf:about="{$docproxyIRI}">
 			<rdf:type rdf:resource="&bibo;Document"/>
-			<sioc:container_of rdf:resource="{vi:proxyIRI(concat($base, 'user/', @user))}"/>
-			<foaf:primaryTopic rdf:resource="{vi:proxyIRI(concat($base, 'user/', @user))}"/>
-			<dcterms:subject rdf:resource="{vi:proxyIRI(concat($base, 'user/', @user))}"/>
+			<sioc:container_of rdf:resource="{$resourceURL}"/>
+			<foaf:primaryTopic rdf:resource="{$resourceURL}"/>
+			<dcterms:subject rdf:resource="{$resourceURL}"/>
 			<dc:title><xsl:value-of select="$baseUri"/></dc:title>
 			<owl:sameAs rdf:resource="{$docIRI}"/>
 		</rdf:Description>
-		<foaf:Person rdf:about="{vi:proxyIRI(concat($base, 'user/', @user))}">
+		<foaf:Person rdf:about="{$resourceURL}">
 			<xsl:for-each select="track">
 				<foaf:interest rdf:resource="{vi:proxyIRI(url)}"/>
 			</xsl:for-each>
 		</foaf:Person>
+	</xsl:template>
+
+   	<xsl:template match="lfm[@status='ok']/toptracks[@user]">
+		<rdf:Description rdf:about="{$docproxyIRI}">
+			<rdf:type rdf:resource="&bibo;Document"/>
+			<sioc:container_of rdf:resource="{$resourceURL}"/>
+			<foaf:primaryTopic rdf:resource="{$resourceURL}"/>
+			<dcterms:subject rdf:resource="{$resourceURL}"/>
+			<dc:title><xsl:value-of select="$baseUri"/></dc:title>
+			<owl:sameAs rdf:resource="{$docIRI}"/>
+		</rdf:Description>
+		<foaf:Person rdf:about="{$resourceURL}">
 	    <xsl:for-each select="track">
-			<xsl:call-template name="track"/>
+				<foaf:interest rdf:resource="{vi:proxyIRI(url)}"/>
 	    </xsl:for-each>
+		</foaf:Person>
+	</xsl:template>
+
+  <xsl:template match="lfm[@status='ok']/recenttracks[@user]">
+    <rdf:Description rdf:about="{$docproxyIRI}">
+      <rdf:type rdf:resource="&bibo;Document"/>
+      <sioc:container_of rdf:resource="{$resourceURL}"/>
+      <foaf:primaryTopic rdf:resource="{$resourceURL}"/>
+      <dcterms:subject rdf:resource="{$resourceURL}"/>
+      <dc:title>
+        <xsl:value-of select="$baseUri"/>
+      </dc:title>
+      <owl:sameAs rdf:resource="{$docIRI}"/>
+    </rdf:Description>
+    <foaf:Person rdf:about="{$resourceURL}">
+      <xsl:for-each select="track">
+        <mo:listened rdf:resource="{vi:proxyIRI(url)}"/>
+      </xsl:for-each>
+    </foaf:Person>
 	</xsl:template>
 
 	<xsl:template match="lfm[@status='ok']/playlists[@user]">
 		<rdf:Description rdf:about="{$docproxyIRI}">
 			<rdf:type rdf:resource="&bibo;Document"/>
-			<sioc:container_of rdf:resource="{vi:proxyIRI(concat($base, 'user/', @user))}"/>
-			<foaf:primaryTopic rdf:resource="{vi:proxyIRI(concat($base, 'user/', @user))}"/>
-			<dcterms:subject rdf:resource="{vi:proxyIRI(concat($base, 'user/', @user))}"/>
+			<sioc:container_of rdf:resource="{$resourceURL}"/>
+			<foaf:primaryTopic rdf:resource="{$resourceURL}"/>
+			<dcterms:subject rdf:resource="{$resourceURL}"/>
 			<dc:title><xsl:value-of select="$baseUri"/></dc:title>
 			<owl:sameAs rdf:resource="{$docIRI}"/>
 		</rdf:Description>
-		<foaf:Person rdf:about="{vi:proxyIRI(concat($base, 'user/', @user))}">
+		<foaf:Person rdf:about="{$resourceURL}">
 			<xsl:for-each select="playlist">
 				<foaf:interest rdf:resource="{vi:proxyIRI($baseUri, '', id)}"/>
 			</xsl:for-each>
 		</foaf:Person>
-	    <xsl:for-each select="playlist">
-			<xsl:call-template name="playlist"/>
-	    </xsl:for-each>
 	</xsl:template>
 
    	<xsl:template match="lfm[@status='ok']/topartists[@user]">
 		<rdf:Description rdf:about="{$docproxyIRI}">
 			<rdf:type rdf:resource="&bibo;Document"/>
-			<sioc:container_of rdf:resource="{vi:proxyIRI(concat($base, 'user/', @user))}"/>
-			<foaf:primaryTopic rdf:resource="{vi:proxyIRI(concat($base, 'user/', @user))}"/>
-			<dcterms:subject rdf:resource="{vi:proxyIRI(concat($base, 'user/', @user))}"/>
+			<sioc:container_of rdf:resource="{$resourceURL}"/>
+			<foaf:primaryTopic rdf:resource="{$resourceURL}"/>
+			<dcterms:subject rdf:resource="{$resourceURL}"/>
 			<dc:title><xsl:value-of select="$baseUri"/></dc:title>
 			<owl:sameAs rdf:resource="{$docIRI}"/>
 		</rdf:Description>
-		<foaf:Person rdf:about="{vi:proxyIRI(concat($base, 'user/', @user))}">
+		<foaf:Person rdf:about="{$resourceURL}">
 			<xsl:for-each select="artist">
 				<foaf:interest rdf:resource="{vi:proxyIRI(url)}"/>
 			</xsl:for-each>
 		</foaf:Person>
-	    <xsl:for-each select="artist">
-			<xsl:call-template name="artist"/>
-	    </xsl:for-each>
 	</xsl:template>
 
    	<xsl:template match="lfm[@status='ok']/topalbums[@artist]">
 		<rdf:Description rdf:about="{$docproxyIRI}">
 			<rdf:type rdf:resource="&bibo;Document"/>
 			<sioc:container_of rdf:resource="{vi:proxyIRI(concat($base, 'music/', translate(@artist, ' ', '+')))}"/>
-			<!--foaf:primaryTopic rdf:resource="{vi:proxyIRI(concat($base, 'music/', translate(@artist, ' ', '+')))}"/-->
 			<dcterms:subject rdf:resource="{vi:proxyIRI(concat($base, 'music/', translate(@artist, ' ', '+')))}"/>
 			<dc:title><xsl:value-of select="$baseUri"/></dc:title>
 			<owl:sameAs rdf:resource="{$docIRI}"/>
@@ -312,20 +341,17 @@
    	<xsl:template match="lfm[@status='ok']/topalbums[@user]">
 		<rdf:Description rdf:about="{$docproxyIRI}">
 			<rdf:type rdf:resource="&bibo;Document"/>
-			<sioc:container_of rdf:resource="{vi:proxyIRI(concat($base, 'user/', @user))}"/>
-			<foaf:primaryTopic rdf:resource="{vi:proxyIRI(concat($base, 'user/', @user))}"/>
-			<dcterms:subject rdf:resource="{vi:proxyIRI(concat($base, 'user/', @user))}"/>
+			<sioc:container_of rdf:resource="{$resourceURL}"/>
+			<foaf:primaryTopic rdf:resource="{$resourceURL}"/>
+			<dcterms:subject rdf:resource="{$resourceURL}"/>
 			<dc:title><xsl:value-of select="$baseUri"/></dc:title>
 			<owl:sameAs rdf:resource="{$docIRI}"/>
 		</rdf:Description>
-		<foaf:Person rdf:about="{vi:proxyIRI(concat($base, 'user/', @user))}">
+		<foaf:Person rdf:about="{$resourceURL}">
 			<xsl:for-each select="album">
 				<foaf:interest rdf:resource="{vi:proxyIRI(url)}"/>
 			</xsl:for-each>
 		</foaf:Person>
-	    <xsl:for-each select="album">
-			<xsl:call-template name="album"/>
-	    </xsl:for-each>
 	</xsl:template>
 
 	<xsl:template match="lfm[@status='ok']/event">
@@ -370,15 +396,17 @@
    	<xsl:template match="lfm[@status='ok']/friends">
 		<rdf:Description rdf:about="{$docproxyIRI}">
 			<rdf:type rdf:resource="&bibo;Document"/>
-			<sioc:container_of rdf:resource="{vi:proxyIRI(concat($base, 'user/', @for))}"/>
-			<foaf:primaryTopic rdf:resource="{vi:proxyIRI(concat($base, 'user/', @for))}"/>
-			<dcterms:subject rdf:resource="{vi:proxyIRI(concat($base, 'user/', @for))}"/>
+			<sioc:container_of rdf:resource="{$resourceURL}"/>
+			<foaf:primaryTopic rdf:resource="{$resourceURL}"/>
+			<dcterms:subject rdf:resource="{$resourceURL}"/>
 			<dc:title><xsl:value-of select="$baseUri"/></dc:title>
 			<owl:sameAs rdf:resource="{$docIRI}"/>
 		</rdf:Description>
+      <rdf:Description rdf:about="{$resourceURL}">
 	    <xsl:for-each select="user">
-			<xsl:call-template name="user"/>
+          <foaf:knows rdf:resource="{vi:proxyIRI(concat('http://www.last.fm/user/', name)) }"/>
 	    </xsl:for-each>
+      </rdf:Description>
 	</xsl:template>
 
     <xsl:template name="artist">
@@ -447,29 +475,26 @@
 		<rdf:Description rdf:about="{vi:proxyIRI(url)}">
 			<rdf:type rdf:resource="&mo;Record"/>
 			<rdf:type rdf:resource="&audio;Album"/>
-			<dcterms:title>
+			<dc:title>
                 <xsl:value-of select="name"/>
-            </dcterms:title>
+            </dc:title>
             <xsl:for-each select="image">
-				<media:depiction rdf:resource="{.}"/>
 				<foaf:depiction rdf:resource="{.}"/>
 			</xsl:for-each>
 			<xsl:choose>
 				<xsl:when test="string(artist/url)">
 					<dcterms:creator rdf:resource="{vi:proxyIRI(translate(artist/url, ' ', '+'))}"/>
-					<foaf:maker rdf:resource="{vi:proxyIRI(translate(artist/url, ' ', '+'))}"/>
 				</xsl:when>
 				<xsl:otherwise>
 					<xsl:if test="string(artist)">
 						<dcterms:creator rdf:resource="{vi:proxyIRI(translate(concat($base, 'music/', artist), ' ', '+'))}"/>
-						<foaf:maker rdf:resource="{vi:proxyIRI(translate(concat($base, 'music/', artist), ' ', '+'))}"/>
 					</xsl:if>
 				</xsl:otherwise>
 			</xsl:choose>
 			<xsl:if test="releasedate">
-				<dcterms:published>
+				<dcterms:created>
 					<xsl:value-of select="releasedate" />
-				</dcterms:published>
+				</dcterms:created>
 			</xsl:if>
 			<xsl:if test="listeners">
 				<lfm:listeners>
@@ -493,9 +518,9 @@
 		<rdf:Description rdf:about="{vi:proxyIRI(url)}">
 			<rdf:type rdf:resource="&mo;Track"/>
 			<rdf:type rdf:resource="&audio;Recording"/>
-			<dcterms:title>
+			<dc:title>
                 <xsl:value-of select="name"/>
-            </dcterms:title>
+            </dc:title>
             <xsl:if test="duration">
 				<media:duration rdf:datatype="&xsd;integer">
 					<xsl:value-of select="duration"/>
@@ -528,7 +553,6 @@
 				</mo:track_number>
 			</xsl:if>
 			<xsl:if test="string(artist/url)">
-				<foaf:maker rdf:resource="{vi:proxyIRI(translate(artist/url, ' ', '+'))}"/>
 				<dcterms:creator rdf:resource="{vi:proxyIRI(translate(artist/url, ' ', '+'))}"/>
 			</xsl:if>
 			<xsl:if test="album/url">
@@ -628,6 +652,7 @@
 			<geo:long rdf:datatype="&xsd;float">
 				<xsl:value-of select="venue/location/geo:point/geo:long"/>
 			</geo:long>
+			<rdfs:label><xsl:value-of select="concat(venue/location/street, ', ', venue/location/city, ', ', venue/location/postalcode, ', ', venue/location/country)"/></rdfs:label>
 		</vcard:ADR>
 
     </xsl:template>
@@ -651,12 +676,12 @@
 			<lfm:country>
 				<xsl:value-of select="country"/>
 			</lfm:country>
-			<lfm:age>
+			<foaf:age>
 				<xsl:value-of select="age"/>
-			</lfm:age>
-			<lfm:gender>
+			</foaf:age>
+			<foaf:gender>
 				<xsl:value-of select="gender"/>
-			</lfm:gender>
+			</foaf:gender>
 			<lfm:playcount>
 				<xsl:value-of select="playcount"/>
 			</lfm:playcount>
@@ -701,9 +726,9 @@
 
 		<rdf:Description rdf:about="{vi:proxyIRI($baseUri, '', id)}">
 			<rdf:type rdf:resource="&sioct;PlayList"/>
-			<dcterms:title>
+			<dc:title>
                 <xsl:value-of select="title"/>
-            </dcterms:title>
+            </dc:title>
             <dc:description>
                 <xsl:value-of select="description"/>
             </dc:description>
@@ -729,13 +754,12 @@
 				</lfm:size>
 			</xsl:if>
 			<xsl:if test="creator">
-				<foaf:maker rdf:resource="{vi:proxyIRI(creator)}"/>
 				<dcterms:creator rdf:resource="{vi:proxyIRI(creator)}"/>
 			</xsl:if>
 			<xsl:if test="date">
-				<dcterms:published>
+				<dcterms:created>
 					<xsl:value-of select="date" />
-				</dcterms:published>
+				</dcterms:created>
 			</xsl:if>
 			<bibo:uri rdf:resource="{url}" />
 			<xsl:for-each select="image">
diff --git a/binsrc/rdf_mappers/xslt/main/lt2rdf.xsl b/binsrc/rdf_mappers/xslt/main/lt2rdf.xsl
index 648ff7a..903f069 100644
--- a/binsrc/rdf_mappers/xslt/main/lt2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/lt2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: lt2rdf.xsl,v 1.1.2.4 2009/09/23 21:37:41 source Exp $
+ -  $Id: lt2rdf.xsl,v 1.1.2.5 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -84,7 +84,7 @@
 				</foaf:name>
 				<bibo:role rdf:resource="&bibo;author"/>
 			</dcterms:contributor>
-			<foaf:maker rdf:resource="{concat('http://www.librarything.com/author/', /response[@stat='ok']/ltml/item/author/@authorcode)}" />
+			<dcterms:creator rdf:resource="{concat('http://www.librarything.com/author/', /response[@stat='ok']/ltml/item/author/@authorcode)}" />
 			<xsl:for-each select="commonknowledge/fieldList/field[@type='1']/versionList/version/factList/fact">
 				<dcterms:publisher rdf:parseType="Resource">
 					<rdf:type rdf:resource="&foaf;Organization"/>
diff --git a/binsrc/rdf_mappers/xslt/main/mbz2rdf.xsl b/binsrc/rdf_mappers/xslt/main/mbz2rdf.xsl
index 4e735c2..9f6c382 100644
--- a/binsrc/rdf_mappers/xslt/main/mbz2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/mbz2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: mbz2rdf.xsl,v 1.1.2.6 2009/12/15 23:13:03 source Exp $
+ -  $Id: mbz2rdf.xsl,v 1.1.2.7 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -155,17 +155,17 @@
 		<rdf:Description rdf:about="{vi:proxyIRI (concat($base,'release/', at id, '.html'))}">
 			<rdf:type rdf:resource="&mo;Record"/>
 			<rdf:type rdf:resource="&audio;Album"/>
-			<dcterms:title>
+			<dc:title>
 				<xsl:value-of select="mmd:title"/>
-			</dcterms:title>
+			</dc:title>
 			<mo:release_type rdf:resource="&mo;{translate (substring-before (@type, ' '), $uc, $lc)}"/>
 			<mo:release_status rdf:resource="&mo;{translate (substring-after (@type, ' '), $uc, $lc)}"/>
 			<dcterms:created rdf:datatype="&xsd;dateTime">
 				<xsl:value-of select="mmd:release-event-list/mmd:event/@date"/>
 			</dcterms:created>
-			<dcterms:published rdf:datatype="&xsd;dateTime">
+			<dcterms:created rdf:datatype="&xsd;dateTime">
 				<xsl:value-of select="mmd:release-event-list/mmd:event/@date"/>
-			</dcterms:published>
+			</dcterms:created>
 			<xsl:if test="mmd:release-event-list/mmd:event/@country">
 			    <vcard:Country>
 				<xsl:value-of select="mmd:release-event-list/mmd:event/@country"/>
@@ -186,7 +186,6 @@
 				<xsl:value-of select="mmd:release-event-list/mmd:event/@catalog-number"/>
 			    </mmd:catalog-number>
 			</xsl:if>
-			<foaf:maker rdf:resource="{vi:proxyIRI (concat($base, 'artist/', mmd:artist/@id, '.html'))}"/>
 			<dcterms:creator rdf:resource="{vi:proxyIRI (concat($base, 'artist/', mmd:artist/@id, '.html'))}"/>
 			<xsl:for-each select="mmd:track-list/mmd:track">
 				<media:contains rdf:resource="{vi:proxyIRI (concat($base,'track/', at id, '.html'))}"/>
@@ -215,9 +214,9 @@
 		<rdf:Description rdf:about="{vi:proxyIRI (concat($base,'track/', at id, '.html'))}">
 			<rdf:type rdf:resource="&mo;Track"/>
 			<rdf:type rdf:resource="&audio;Recording"/>
-			<dcterms:title>
+			<dc:title>
 				<xsl:value-of select="mmd:title"/>
-			</dcterms:title>
+			</dc:title>
 			<media:position>
 				<xsl:value-of select="position()"/>
 			</media:position>
@@ -231,14 +230,12 @@
 				<xsl:value-of select="mmd:duration"/>
 			</mo:duration>
 			<xsl:if test="artist[@id]">
-				<foaf:maker rdf:resource="{vi:proxyIRI (concat ($base, 'artist/', mmd:artist/@id, '.html'))}"/>
 				<dcterms:creator rdf:resource="{vi:proxyIRI (concat ($base, 'artist/', mmd:artist/@id, '.html'))}"/>
 			</xsl:if>
 			<xsl:if test="release-list/release[@id]">
 				<mo:published_as rdf:resource="{vi:proxyIRI (concat($base,'release/', mmd:release-list/mmd:release/@id, '.html'))}" />
 			</xsl:if>
 			<xsl:if test="//release/artist[@id]">
-				<foaf:maker rdf:resource="{vi:proxyIRI (concat ($base, 'artist/', //mmd:release/mmd:artist/@id, '.html'))}"/>
 				<dcterms:creator rdf:resource="{vi:proxyIRI (concat ($base, 'artist/', //mmd:release/mmd:artist/@id, '.html'))}"/>
 			</xsl:if>
 			<xsl:if test="//release[@id]">
diff --git a/binsrc/rdf_mappers/xslt/main/mql2rdf.xsl b/binsrc/rdf_mappers/xslt/main/mql2rdf.xsl
index b600957..d8c4ffc 100644
--- a/binsrc/rdf_mappers/xslt/main/mql2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/mql2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: mql2rdf.xsl,v 1.1.2.2 2009/08/27 15:09:12 source Exp $
+ -  $Id: mql2rdf.xsl,v 1.1.2.3 2010/12/09 12:36:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -43,6 +43,8 @@
     <xsl:output method="xml" indent="yes" />
 
     <xsl:param name="baseUri" />
+    <xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
+
     <xsl:param name="wpUri" />
 
     <xsl:variable name="ns">http://www.freebase.com/</xsl:variable>
@@ -50,7 +52,7 @@
     <xsl:template match="/">
 	<rdf:RDF>
 	    <xsl:if test="/results/ROOT/result/*">
-		<rdf:Description rdf:about="{$baseUri}">
+		<rdf:Description rdf:about="{$docproxyIRI}">
 		    <rdf:type rdf:resource="&bibo;Document"/>
 		    <sioc:container_of rdf:resource="{vi:proxyIRI($baseUri)}"/>
 		    <foaf:primaryTopic rdf:resource="{vi:proxyIRI($baseUri)}"/>
diff --git a/binsrc/rdf_mappers/xslt/main/openlibrary2rdf.xsl b/binsrc/rdf_mappers/xslt/main/openlibrary2rdf.xsl
index f4b6f08..003b92f 100644
--- a/binsrc/rdf_mappers/xslt/main/openlibrary2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/openlibrary2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: openlibrary2rdf.xsl,v 1.1.2.4 2009/09/23 21:37:41 source Exp $
+ -  $Id: openlibrary2rdf.xsl,v 1.1.2.5 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -79,9 +79,9 @@
     <xsl:variable name="authors" select="authors/key" />
 
     <xsl:if test="title">
-	<dcterms:title>
+	<dc:title>
 	    <xsl:value-of select="title"/>
-	</dcterms:title>
+	</dc:title>
     </xsl:if>
     <xsl:if test="isbn_13">
 	<book:isbn>
@@ -151,9 +151,9 @@
 	</bibo:content>
     </xsl:if>
     <xsl:for-each select="subjects">
-	<dc:subject>
+	<dcterms:subject>
 	    <xsl:value-of select="."/>
-	</dc:subject>
+	</dcterms:subject>
     </xsl:for-each>
 
   </xsl:template>
diff --git a/binsrc/rdf_mappers/xslt/main/openstreet2rdf.xsl b/binsrc/rdf_mappers/xslt/main/openstreet2rdf.xsl
index 611f5d1..f53cb72 100644
--- a/binsrc/rdf_mappers/xslt/main/openstreet2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/openstreet2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: openstreet2rdf.xsl,v 1.1.2.4 2009/09/23 21:37:41 source Exp $
+ -  $Id: openstreet2rdf.xsl,v 1.1.2.6 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -91,7 +91,7 @@
 			</xsl:for-each>
 		</geo:Feature>
 
-		<xsl:for-each select="node">
+		<!--xsl:for-each select="node">
 			<geo:Feature rdf:about="{vi:proxyIRI (concat('http://openstreetmap.org/?lat=', @lat, '&lon=', @lon))}">
 				<wgs84_pos:lat>
 					<xsl:value-of select="@lat"/>
@@ -103,7 +103,7 @@
 				<openstreetmap:id>
 					<xsl:value-of select="@id"/>
 				</openstreetmap:id>
-				<foaf:maker rdf:resource="{vi:proxyIRI(concat('http://openstreetmap.org/user/', @user))}"/>
+				<dcterms:creator rdf:resource="{vi:proxyIRI(concat('http://openstreetmap.org/user/', @user))}"/>
 				<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">
 					<xsl:value-of select="@timestamp"/>
 				</dcterms:modified>
@@ -119,7 +119,7 @@
 							</geo:name>
 						</xsl:when>
 						<xsl:when test="@k = 'created_by'">
-							<foaf:maker rdf:resource="{vi:proxyIRI(concat('http://openstreetmap.org/user/', @v))}"/>
+							<dcterms:creator rdf:resource="{vi:proxyIRI(concat('http://openstreetmap.org/user/', @v))}"/>
 						</xsl:when>
 						<xsl:otherwise>
 							<xsl:element namespace="http://openstreetmap.org/elements/" name="{@k}">
@@ -139,7 +139,7 @@
 				</foaf:Person>
 			</xsl:if>
 
-		</xsl:for-each>
+		</xsl:for-each-->
     </xsl:template>
 
     <xsl:template match="text()" />
diff --git a/binsrc/rdf_mappers/xslt/main/oreilly2rdf.xsl b/binsrc/rdf_mappers/xslt/main/oreilly2rdf.xsl
index 2d6455a..4496ff1 100644
--- a/binsrc/rdf_mappers/xslt/main/oreilly2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/oreilly2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: oreilly2rdf.xsl,v 1.1.2.11 2009/12/15 23:13:04 source Exp $
+ -  $Id: oreilly2rdf.xsl,v 1.1.2.13 2011/03/08 13:36:28 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -157,7 +157,7 @@
 			</xsl:when>
 		</xsl:choose>
     	<bibo:shortTitle><xsl:value-of select="$title"/></bibo:shortTitle>
-    	<dc:title><xsl:value-of select="concat($title, ' - ', $subtitle)"/></dc:title>
+    	<gr:name><xsl:value-of select="concat($title, ' - ', $subtitle)"/></gr:name>
 		<rdfs:label><xsl:value-of select="concat($title, ' - ', $subtitle)"/></rdfs:label>
 		<xsl:apply-templates select="meta" />
   		<xsl:apply-templates select="//div[@id='short-description']/div" />
@@ -172,7 +172,9 @@
 	    	<gr:UnitPriceSpecification rdf:about="{concat ($baseUri, '#', 'UnitPriceSpecification')}">
 			-->
 	    	<gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', concat('UnitPriceSpecification_', position()))}">
-	    		<rdfs:label>sale price</rdfs:label>
+	    		<rdfs:label>
+				<xsl:value-of select="concat(span[@property='gr:hasCurrencyValue'], ' (', span[@property='gr:hasCurrency']/@content, ')' )" />
+			</rdfs:label>
 				<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
 				<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="span[@property='gr:hasCurrencyValue']" /></gr:hasCurrencyValue>
 				<gr:hasCurrency rdf:datatype="&xsd;string"><xsl:value-of select="span[@property='gr:hasCurrency']/@content" /></gr:hasCurrency>
@@ -307,9 +309,9 @@
 	</xsl:template>
 
   	<xsl:template match="//div[@id='fulldesc']/div">
-		<dc:description>
+		<gr:description>
 			<xsl:value-of select="." />
-		</dc:description>
+		</gr:description>
 	</xsl:template>
 
   	<xsl:template match="*[@typeof='foaf:Person']">
diff --git a/binsrc/rdf_mappers/xslt/main/picasa2rdf.xsl b/binsrc/rdf_mappers/xslt/main/picasa2rdf.xsl
index 6f7cc9b..83d20b1 100644
--- a/binsrc/rdf_mappers/xslt/main/picasa2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/picasa2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: picasa2rdf.xsl,v 1.1.2.6 2009/12/15 23:13:04 source Exp $
+ -  $Id: picasa2rdf.xsl,v 1.1.2.7 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -151,7 +151,7 @@
 </xsl:template>
 
 <xsl:template match="a:published">
-    <dc:date><xsl:value-of select="."/></dc:date>
+    <dcterms:created><xsl:value-of select="."/></dcterms:created>
 </xsl:template>
 
 <xsl:template match="a:link[@href]">
@@ -159,7 +159,7 @@
 </xsl:template>
 
 <xsl:template match="a:author[parent::a:entry]">
-    <foaf:maker rdf:resource="http://picasaweb.google.com/data/feed/api/user/{a:name}"/>
+    <dcterms:creator rdf:resource="http://picasaweb.google.com/data/feed/api/user/{a:name}"/>
 </xsl:template>
 
 
diff --git a/binsrc/rdf_mappers/xslt/main/pptx2rdf.xsl b/binsrc/rdf_mappers/xslt/main/pptx2rdf.xsl
index bcc1834..e539a62 100644
--- a/binsrc/rdf_mappers/xslt/main/pptx2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/pptx2rdf.xsl
@@ -9,7 +9,7 @@
 <!ENTITY dcmitype "http://purl.org/dc/dcmitype/">
 <!ENTITY bibo "http://purl.org/ontology/bibo/">
 <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
-<!ENTITY sioc "http://rdfs.org/sioc/ns#/">
+<!ENTITY sioc "http://rdfs.org/sioc/ns#">
 <!ENTITY content "http://purl.org/rss/1.0/modules/content/">
 <!ENTITY cp "http://schemas.openxmlformats.org/package/2006/metadata/core-properties">
 <!ENTITY ep "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties">
@@ -52,8 +52,13 @@
   <xsl:param name="sourceDoc" />
   <xsl:param name="slideUri" />
 
+    <xsl:variable name="resourceURL" select="vi:proxyIRI($baseUri)"/>
+    <xsl:variable name="docIRI" select="vi:docIRI($baseUri)"/>
+    <xsl:variable name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
+
+
   <xsl:variable name="documentResourceURL">
-    <xsl:value-of select="$baseUri"/>
+    <xsl:value-of select="$resourceURL"/>
   </xsl:variable>
 
   <xsl:variable name="sourceDoc">
@@ -114,6 +119,16 @@
       </rdf:Description>
       -->
 
+      	<rdf:Description rdf:about="{$docproxyIRI}">
+      		<rdf:type rdf:resource="&bibo;Document"/>
+      		<dc:title><xsl:value-of select="$baseUri"/></dc:title>
+      		<sioc:container_of rdf:resource="{$resourceURL}"/>
+      		<dcterms:subject rdf:resource="{$resourceURL}"/>
+      		<foaf:primaryTopic rdf:resource="{$resourceURL}"/>
+      		<owl:sameAs rdf:resource="{$docIRI}"/>
+      	</rdf:Description>
+      	
+
       <!-- The PPTX representation of the presentation i.e. .pptx file URI *including* file suffix -->
       <rdf:Description rdf:about="{$documentResourceURL}">
 	<rdf:type>bibo:Slideshow</rdf:type>
diff --git a/binsrc/rdf_mappers/xslt/main/productwiki2rdf.xsl b/binsrc/rdf_mappers/xslt/main/productwiki2rdf.xsl
new file mode 100755
index 0000000..11bb9de
--- /dev/null
+++ b/binsrc/rdf_mappers/xslt/main/productwiki2rdf.xsl
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: productwiki2rdf.xsl,v 1.1.4.3 2011/03/29 22:52:06 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2009 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
+<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
+<!ENTITY bibo "http://purl.org/ontology/bibo/">
+<!ENTITY foaf "http://xmlns.com/foaf/0.1/">
+<!ENTITY dcterms "http://purl.org/dc/terms/">
+<!ENTITY vcard "http://www.w3.org/2001/vcard-rdf/3.0#">
+<!ENTITY sioc "http://rdfs.org/sioc/ns#">
+<!ENTITY owl "http://www.w3.org/2002/07/owl#">
+<!ENTITY gr "http://purl.org/goodrelations/v1#">
+<!ENTITY cl "http://www.ebusiness-unibw.org/ontologies/consumerelectronics/v1#">
+<!ENTITY oplbb "http://www.openlinksw.com/schemas/bestbuy#">
+<!ENTITY oplamz "http://www.openlinksw.com/schemas/amazon#">
+]>
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+    xmlns:vcard="&vcard;"	
+    xmlns:rdf="&rdf;"
+    xmlns:rdfs="&rdfs;"
+    xmlns:foaf="&foaf;"
+    xmlns:bibo="&bibo;"
+    xmlns:sioc="&sioc;"
+    xmlns:owl="&owl;"
+    xmlns:dcterms="&dcterms;"
+    xmlns:gr="&gr;"
+    xmlns:oplamz="&oplamz;"	
+    xmlns:bestbuy="http://remix.bestbuy.com/"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    xmlns:cl="&cl;"
+    xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"	
+    xmlns:oplbb="&oplbb;">
+
+    <xsl:output method="xml" indent="yes" />
+
+    <xsl:param name="baseUri"/>
+    <xsl:param name="currentDateTime"/>
+
+	<xsl:variable name="resourceURL" select="vi:proxyIRI ($baseUri)"/>
+    <xsl:variable  name="docIRI" select="vi:docIRI($baseUri)"/>
+    <xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
+
+    <xsl:template match="/pw_api_results">
+		<rdf:RDF>
+				<rdf:Description rdf:about="{$docproxyIRI}">
+					<rdf:type rdf:resource="&bibo;Document"/>
+					<sioc:container_of rdf:resource="{vi:proxyIRI ($baseUri, '', 'Product')}"/>
+					<foaf:primaryTopic rdf:resource="{vi:proxyIRI ($baseUri, '', 'Product')}"/>
+					<foaf:topic rdf:resource="{vi:proxyIRI ($baseUri, '', 'Vendor')}"/>
+					<foaf:topic rdf:resource="{$resourceURL}"/>
+					<dcterms:subject rdf:resource="{vi:proxyIRI ($baseUri, '', 'Product')}"/>
+				<owl:sameAs rdf:resource="{$docIRI}"/>
+				</rdf:Description>
+
+						<gr:BusinessEntity rdf:about="{vi:proxyIRI ($baseUri, '', 'Vendor')}">
+				  <rdfs:comment>ProductWiki</rdfs:comment>
+					  <rdfs:label>ProductWiki</rdfs:label>
+					  <gr:legalName>ProductWiki</gr:legalName>
+					  <gr:offers rdf:resource="{$resourceURL}"/>
+				  <foaf:homepage rdf:resource="http://www.productwiki.com" />
+				  <rdfs:seeAlso rdf:resource="{vi:proxyIRI ('http://www.productwiki.com')}"/>
+						</gr:BusinessEntity>
+
+				<rdf:Description rdf:about="{vi:proxyIRI ($baseUri, '', 'Product')}">
+					<rdf:type rdf:resource="&gr;ProductOrServicesSomeInstancesPlaceholder" />
+					<rdf:type rdf:resource="&oplbb;Product" />
+				   <xsl:apply-templates select="//product[1]" />
+				</rdf:Description>
+		</rdf:RDF>
+    </xsl:template>
+
+    <xsl:template match="product[1]">
+        <xsl:apply-templates select="*"/>
+    </xsl:template>
+
+    <xsl:template match="product/url">
+	<xsl:if test="string-length(.) > 0">
+	    <xsl:element namespace="&rdfs;" name="seeAlso">
+		<xsl:attribute name="rdf:resource">
+		    <xsl:value-of select="."/>
+		</xsl:attribute>
+	    </xsl:element>
+	</xsl:if>
+    </xsl:template>
+
+    <xsl:template match="product/description">
+		<xsl:variable name="local_text" select="vi:convert_to_xtree(string(.))"/>
+		<oplbb:description rdf:datatype="&xsd;string">
+			<xsl:value-of select="."/>
+		</oplbb:description>
+		<xsl:for-each select="$local_text//li">
+			<oplbb:feature rdf:datatype="&xsd;string">
+				<xsl:value-of select="."/>
+			</oplbb:feature>
+		</xsl:for-each>
+    </xsl:template>
+
+    <xsl:template match="product/title">
+		<oplbb:title rdf:datatype="&xsd;string">
+			<xsl:value-of select="."/>
+		</oplbb:title>
+		<dc:title>
+			<xsl:value-of select="." />
+		</dc:title>
+	</xsl:template>
+	
+    <xsl:template match="product/skus/sku/upc">
+		<gr:hasEAN_UCC-13>
+			<xsl:value-of select="."/>
+		</gr:hasEAN_UCC-13>
+    </xsl:template>
+
+    <xsl:template match="product/skus/sku/asin">
+		<oplamz:ASIN>
+			<xsl:value-of select="."/>
+		</oplamz:ASIN>	
+    </xsl:template>
+
+    <xsl:template match="product/skus/sku/mpn">
+		<gr:hasMPN>
+			<xsl:value-of select="."/>
+		</gr:hasMPN>	
+    </xsl:template>
+	
+    <xsl:template match="product/id">
+		<oplbb:productId>
+			<xsl:value-of select="."/>
+		</oplbb:productId>
+    </xsl:template>
+
+    <xsl:template match="product/category">
+		<oplbb:category>
+			<xsl:value-of select="."/>
+		</oplbb:category>
+    </xsl:template>
+
+    <xsl:template match="product/images/image/rawimage">
+	<xsl:if test="string-length(.) > 0">
+	    <xsl:element namespace="&oplbb;" name="image">
+		<xsl:attribute name="rdf:resource">
+		    <xsl:value-of select="."/>
+		</xsl:attribute>
+	    </xsl:element>
+	</xsl:if>
+    </xsl:template>
+
+	    <xsl:template match="product/images/image/largeimage">
+	<xsl:if test="string-length(.) > 0">
+	    <xsl:element namespace="&oplbb;" name="image">
+		<xsl:attribute name="rdf:resource">
+		    <xsl:value-of select="."/>
+		</xsl:attribute>
+	    </xsl:element>
+	</xsl:if>
+    </xsl:template>
+
+	    <xsl:template match="product/images/image/mediumimage">
+	<xsl:if test="string-length(.) > 0">
+	    <xsl:element namespace="&oplbb;" name="image">
+		<xsl:attribute name="rdf:resource">
+		    <xsl:value-of select="."/>
+		</xsl:attribute>
+	    </xsl:element>
+	</xsl:if>
+    </xsl:template>
+	
+	    <xsl:template match="product/images/image/smallimage">
+	<xsl:if test="string-length(.) > 0">
+	    <xsl:element namespace="&oplbb;" name="image">
+		<xsl:attribute name="rdf:resource">
+		    <xsl:value-of select="."/>
+		</xsl:attribute>
+	    </xsl:element>
+	</xsl:if>
+    </xsl:template>
+
+    <xsl:template match="text()|@*"/>
+
+</xsl:stylesheet>
diff --git a/binsrc/rdf_mappers/xslt/main/rhapsody2rdf.xsl b/binsrc/rdf_mappers/xslt/main/rhapsody2rdf.xsl
index e35bda3..9a034e3 100644
--- a/binsrc/rdf_mappers/xslt/main/rhapsody2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/rhapsody2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: rhapsody2rdf.xsl,v 1.1.2.2 2009/08/27 15:09:12 source Exp $
+ -  $Id: rhapsody2rdf.xsl,v 1.1.2.4 2011/03/25 17:10:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -105,6 +105,7 @@
 			<vcard:Country>
 				<xsl:value-of select="hometown/country"/>
 			</vcard:Country>
+			<rdfs:label><xsl:value-of select="concat(hometown/city, ', ', hometown/state, ', ', hometown/country)"/></rdfs:label>
 		</vcard:ADR>
 		<xsl:for-each select="genres/genre">
             <mo:Genre rdf:about="{html-href}">
@@ -120,12 +121,12 @@
 			<rdf:Description rdf:about="{html-href}">
 				<rdf:type rdf:resource="&mo;Record"/>
 				<rdf:type rdf:resource="&audio;Album"/>
-                <dcterms:title>
+                <dc:title>
                     <xsl:value-of select="@name"/>
-                </dcterms:title>
-                <dcterms:published>
+                </dc:title>
+                <dcterms:created>
 					<xsl:value-of select="album-release-date" />
-                </dcterms:published>
+                </dcterms:created>
                 <dcterms:creator rdf:resource="{/artist/html-href}"/>
                 <mo:maker rdf:resource="{/artist/html-href}"/>
                 <rdfs:seeAlso rdf:resource="{play-href}"/>
@@ -141,16 +142,15 @@
 		<rdf:Description rdf:about="{html-href}">
 			<rdf:type rdf:resource="&mo;Record"/>
 			<rdf:type rdf:resource="&audio;Album"/>
-    		<dcterms:title>
+    		<dc:title>
                 <xsl:value-of select="@name"/>
-            </dcterms:title>
+            </dc:title>
             <xsl:for-each select="art/album-art/img">
-				<media:depiction rdf:resource="{@src}"/>
 				<foaf:depiction rdf:resource="{@src}"/>
 			</xsl:for-each>
-            <dcterms:published>
+            <dcterms:created>
 				<xsl:value-of select="album-release-date" />
-            </dcterms:published>
+            </dcterms:created>
             <dcterms:creator rdf:resource="{primary-artist/html-href}"/>
             <mo:maker rdf:resource="{primary-artist/html-href}"/>
             <rdfs:seeAlso rdf:resource="{play-href}"/>
@@ -185,9 +185,9 @@
 			<rdf:Description rdf:about="{concat('http://www.rhapsody.com/goto?rcid=', @rcid)}">
 				<rdf:type rdf:resource="&mo;Track"/>
 				<rdf:type rdf:resource="&audio;Recording"/>
-                <dcterms:title>
+                <dc:title>
                     <xsl:value-of select="@name"/>
-                </dcterms:title>
+                </dc:title>
                 <dcterms:creator rdf:resource="{/album/primary-artist/html-href}"/>
                 <mo:maker rdf:resource="{/album/primary-artist/html-href}"/>
                 <rdfs:seeAlso rdf:resource="{play-href}"/>
@@ -200,9 +200,9 @@
 		<rdf:Description rdf:about="{concat('http://www.rhapsody.com/goto?rcid=', @rcid)}">
 			<rdf:type rdf:resource="&mo;Track"/>
 			<rdf:type rdf:resource="&audio;Recording"/>
-			<dcterms:title>
+			<dc:title>
                 <xsl:value-of select="@name"/>
-            </dcterms:title>
+            </dc:title>
             <mo:available_as rdf:resource="{primary-album/html-href}"/>
             <dcterms:creator rdf:resource="{primary-artist/html-href}"/>
             <mo:maker rdf:resource="{primary-artist/html-href}"/>
diff --git a/binsrc/rdf_mappers/xslt/main/rss2rdf.xsl b/binsrc/rdf_mappers/xslt/main/rss2rdf.xsl
index 0ca5d86..43cce2c 100644
--- a/binsrc/rdf_mappers/xslt/main/rss2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/rss2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: rss2rdf.xsl,v 1.1.2.4 2010/01/06 17:33:30 source Exp $
+ -  $Id: rss2rdf.xsl,v 1.1.2.5 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -139,7 +139,7 @@
 </xsl:template>
 
 <xsl:template match="lastBuildDate|pubdate|r:lastBuildDate|r:pubdate">
-  <dc:date><xsl:value-of select="vifunc:http_string_date(.)" /></dc:date>
+  <dcterms:issued><xsl:value-of select="vifunc:http_string_date(.)" /></dcterms:issued>
 </xsl:template>
 
 <xsl:template match="managingEditor|r:managingEditor">
@@ -196,7 +196,7 @@
 </xsl:template>
 
 <xsl:template match="pubDate|r:pubDate">
-  <dc:date><xsl:value-of select="vifunc:http_string_date(.)" /></dc:date>
+  <dcterms:issued><xsl:value-of select="vifunc:http_string_date(.)" /></dcterms:issued>
 </xsl:template>
 
 <xsl:template match="source|r:source">
diff --git a/binsrc/rdf_mappers/xslt/main/sf2rdf.xsl b/binsrc/rdf_mappers/xslt/main/sf2rdf.xsl
index 0ed2e58..a6d2d2f 100644
--- a/binsrc/rdf_mappers/xslt/main/sf2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/sf2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sf2rdf.xsl,v 1.1.2.5 2009/12/14 14:42:12 source Exp $
+ -  $Id: sf2rdf.xsl,v 1.1.2.6 2010/09/07 21:58:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -33,7 +33,6 @@
 <!ENTITY dc "http://purl.org/dc/elements/1.1/">
 <!ENTITY dcterms "http://purl.org/dc/terms/">
 <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
-<!ENTITY atomowl "http://atomowl.org/ontologies/atomrdf#">
 <!ENTITY content "http://purl.org/rss/1.0/modules/content/">
 <!ENTITY wf "http://www.w3.org/2005/01/wf/flow#">
 <!ENTITY sf "urn:sobject.enterprise.soap.sforce.com">
diff --git a/binsrc/rdf_mappers/xslt/main/sg2rdf.xsl b/binsrc/rdf_mappers/xslt/main/sg2rdf.xsl
index be5b774..2a94739 100644
--- a/binsrc/rdf_mappers/xslt/main/sg2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/sg2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sg2rdf.xsl,v 1.1.2.2 2009/08/27 15:09:12 source Exp $
+ -  $Id: sg2rdf.xsl,v 1.1.2.3 2010/12/09 12:36:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -45,10 +45,11 @@
   version="1.0">
   <xsl:output method="xml" indent="yes"/>
   <xsl:param name="baseUri" />
+  <xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
   <xsl:template match="/">
       <rdf:RDF>
 	  <xsl:variable name="res" select="vi:proxyIRI ($baseUri)"/>
-	  <rdf:Description rdf:about="{$baseUri}">
+	  <rdf:Description rdf:about="{$docproxyIRI}">
 		<rdf:type rdf:resource="&bibo;Document"/>
 		<sioc:container_of rdf:resource="{$res}"/>
 		<foaf:primaryTopic rdf:resource="{$res}"/>
diff --git a/binsrc/rdf_mappers/xslt/main/slideshare2rdf.xsl b/binsrc/rdf_mappers/xslt/main/slideshare2rdf.xsl
index 361f7de..a214828 100644
--- a/binsrc/rdf_mappers/xslt/main/slideshare2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/slideshare2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: slideshare2rdf.xsl,v 1.1.2.6 2010/06/30 10:01:01 source Exp $
+ -  $Id: slideshare2rdf.xsl,v 1.1.2.7 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -65,9 +65,9 @@
 				</bibo:identifier>
 			</xsl:if>
 			<xsl:if test="Meta/Query">
-				<dcterms:title>
+				<dc:title>
 					<xsl:value-of select="Meta/Query" />
-				</dcterms:title>
+				</dc:title>
 			</xsl:if>
 			<xsl:for-each select="Slideshow">
 				<xsl:choose>
@@ -141,11 +141,11 @@
 				</xsl:otherwise>
 			</xsl:choose>
 			<bibo:uri rdf:resource="{vi:proxyIRI($res)}" />
-			<dcterms:title>
+			<dc:title>
 				<xsl:value-of select="Title" />
-			</dcterms:title>
+			</dc:title>
 			<bibo:owner rdf:resource="{$owner}" />
-			<foaf:maker rdf:resource="{$owner}" />
+			<dcterms:creator rdf:resource="{$owner}" />
 			<bibo:identifier>
 				<xsl:choose>
 					<xsl:when test="Id">
diff --git a/binsrc/rdf_mappers/xslt/main/slidesix2rdf.xsl b/binsrc/rdf_mappers/xslt/main/slidesix2rdf.xsl
index b965360..fa5091b 100644
--- a/binsrc/rdf_mappers/xslt/main/slidesix2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/slidesix2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: slidesix2rdf.xsl,v 1.1.2.3 2010/03/18 10:46:57 source Exp $
+ -  $Id: slidesix2rdf.xsl,v 1.1.2.4 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -66,14 +66,14 @@
 	<xsl:template match="SLIDESHOWS/SLIDESHOW">
 		<rdf:Description rdf:about="{$resourceURL}">
 			<rdf:type rdf:resource="&bibo;Slideshow"/>
-			<dcterms:title>
+			<dc:title>
 				<xsl:value-of select="SLIDESHOWTITLE" />
-			</dcterms:title>
+			</dc:title>
 			<foaf:img rdf:resource="{THUMBNAILIMAGEURL}"/>
 			<dcterms:created rdf:datatype="&xsd;dateTime">
 				<xsl:value-of select="vi:string2date2 (LASTPUBLISHEDDATE)" />
 			</dcterms:created>
-			<foaf:maker rdf:resource="{concat('http://slidesix.com/user/', CREATEDBYUSERNAME)}" />
+			<dcterms:creator rdf:resource="{concat('http://slidesix.com/user/', CREATEDBYUSERNAME)}" />
 			<dcterms:modified rdf:datatype="&xsd;dateTime">
 				<xsl:value-of select="vi:string2date2 (LASTPUBLISHEDDATE)" />
 			</dcterms:modified>
diff --git a/binsrc/rdf_mappers/xslt/main/tesco2rdf.xsl b/binsrc/rdf_mappers/xslt/main/tesco2rdf.xsl
index 285b63b..cbf7821 100644
--- a/binsrc/rdf_mappers/xslt/main/tesco2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/tesco2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: tesco2rdf.xsl,v 1.1.2.7 2010/06/07 13:25:37 source Exp $
+ -  $Id: tesco2rdf.xsl,v 1.1.2.11 2011/03/23 12:13:05 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -30,6 +30,7 @@
 <!ENTITY sioc "http://rdfs.org/sioc/ns#">
 <!ENTITY gr "http://purl.org/goodrelations/v1#">
 <!ENTITY oplbb "http://www.openlinksw.com/schemas/bestbuy#">
+<!ENTITY opltesco "http://www.openlinksw.com/schemas/tesco#"> 
 ]>
 <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -44,7 +45,7 @@
     xmlns:oplbb="&oplbb;"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:owl="http://www.w3.org/2002/07/owl#"
-    xmlns:tesco="http://www.tesco.com/">
+    xmlns:opltesco="&opltesco;">
 
     <xsl:output method="xml" indent="yes" />
 
@@ -54,7 +55,7 @@
     <xsl:variable  name="docIRI" select="vi:docIRI($baseUri)"/>
     <xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
 
-    <xsl:variable name="ns">http://www.tesco.com/</xsl:variable>
+    <xsl:variable name="ns">http://www.openlinksw.com/schemas/tesco#</xsl:variable>
 
     <xsl:template match="results|Products" priority="1">
 		<xsl:apply-templates select="*"/>
@@ -77,11 +78,9 @@
 					<gr:hasBusinessFunction rdf:resource="&gr;Sell"/>
 					<rdfs:label><xsl:value-of select="//Name"/></rdfs:label>
 					<gr:includes rdf:resource="{vi:proxyIRI ($baseUri, '', 'Product')}"/>
-					<!--gr:validFrom rdf:datatype="&xsd;dateTime"><xsl:value-of select="$currentDateTime"/></gr:validFrom-->
 					<gr:availableDeliveryMethods rdf:resource="&gr;DeliveryModePickup"/>
-					<gr:availableDeliveryMethods rdf:resource="&gr;UPS"/>
-					<gr:availableDeliveryMethods rdf:resource="&gr;DeliveryModeMail"/>
-					<!--xsl:apply-templates mode="offering" /-->
+                    <gr:eligibleRegions>UK</gr:eligibleRegions>
+					<xsl:apply-templates mode="offering"/>
 				</gr:Offering>
 				<rdf:Description rdf:about="{vi:proxyIRI ($baseUri, '', 'Product')}">
 					<rdf:type rdf:resource="&gr;ProductOrServicesSomeInstancesPlaceholder" />
@@ -90,12 +89,13 @@
 				<xsl:apply-templates/>
 			</rdf:Description>
 				<gr:BusinessEntity rdf:about="{vi:proxyIRI ($baseUri, '', 'Vendor')}">
-					<rdfs:comment>The legal agent making the offering</rdfs:comment>
+					<rdfs:comment>Tesco PLC</rdfs:comment>
 					<rdfs:label>Tesco PLC</rdfs:label>
 					<gr:legalName>Tesco PLC</gr:legalName>
 					<gr:offers rdf:resource="{$resourceURL}"/>
 					<foaf:homepage rdf:resource="http://www.tesco.com" />
 					<rdfs:seeAlso rdf:resource="{vi:proxyIRI ('http://www.tesco.com')}"/>
+                    <foaf:depiction rdf:resource="http://www.tesco.com/shopping/images/logoTesco.gif"/>
 				</gr:BusinessEntity>
 		</rdf:RDF>
 		</xsl:if>
@@ -115,9 +115,9 @@
 		<rdfs:label>
 			<xsl:value-of select="."/>
 		</rdfs:label>
-		<dc:title>
+		<gr:name>
 			<xsl:value-of select="."/>
-		</dc:title>
+		</gr:name>
     </xsl:template>
 
     <xsl:template match="manufacturer">
@@ -129,16 +129,34 @@
 		</gr:hasManufacturer>
     </xsl:template>
 
-    <xsl:template match="Price">
+    <xsl:template match="Price" mode="offering">
 		<gr:hasPriceSpecification>
 		  <gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'price')}">
-	    <rdfs:label><xsl:value-of select="concat('List Price of ', ., ' GBP')"/></rdfs:label>
+            <rdfs:label><xsl:value-of select="concat('Price of ', ., ' GBP')"/></rdfs:label>
             <gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="."/></gr:hasCurrencyValue>
             <gr:hasCurrency rdf:datatype="&xsd;string">GBP</gr:hasCurrency>
           </gr:UnitPriceSpecification>
 		</gr:hasPriceSpecification>
     </xsl:template>
 
+    <!--xsl:template match="Price">
+		<gr:hasPriceSpecification>
+		  <gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'price')}">
+            <rdfs:label><xsl:value-of select="concat('Price of ', ., ' GBP')"/></rdfs:label>
+            <gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="."/></gr:hasCurrencyValue>
+            <gr:hasCurrency rdf:datatype="&xsd;string">GBP</gr:hasCurrency>
+          </gr:UnitPriceSpecification>
+		</gr:hasPriceSpecification>
+    </xsl:template-->
+    
+    <!--xsl:template match="PriceDescription">
+		<gr:hasPriceSpecification>
+		  <gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'price')}">
+            <rdfs:label><xsl:value-of select="."/></rdfs:label>
+          </gr:UnitPriceSpecification>
+		</gr:hasPriceSpecification>
+    </xsl:template-->
+
     <xsl:template match="*[* and ../../*]">
 	<xsl:element namespace="{$ns}" name="{name()}">
 	    <xsl:attribute name="rdf:parseType">Resource</xsl:attribute>
@@ -154,4 +172,6 @@
 	</xsl:if>
     </xsl:template>
 
+    <xsl:template match="text()|@*" mode="offering" />
+    
 </xsl:stylesheet>
diff --git a/binsrc/rdf_mappers/xslt/main/tumblr2rdf.xsl b/binsrc/rdf_mappers/xslt/main/tumblr2rdf.xsl
index fbb13a7..2ccb8ed 100644
--- a/binsrc/rdf_mappers/xslt/main/tumblr2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/tumblr2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: tumblr2rdf.xsl,v 1.1.4.2 2010/07/06 23:07:47 source Exp $
+ -  $Id: tumblr2rdf.xsl,v 1.1.4.3 2010/12/14 12:07:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -62,11 +62,11 @@
 				<rdf:type rdf:resource="&bibo;Document"/>
 				<foaf:primaryTopic rdf:resource="{$resourceURL}"/>
 				<sioc:container_of rdf:resource="{$resourceURL}" />
-				<dc:title><xsl:value-of select="$baseUri"/></dc:title>
-				<owl:sameAs rdf:resource="{$docIRI}"/>
+				<dc:title><xsl:value-of select="$baseUri"/></dc:title>
+				<owl:sameAs rdf:resource="{$docIRI}"/>
 			</rdf:Description>
-			<xsl:choose>
-				<xsl:when test="$baseUri like '%.tumblr.com/post/%'">
+			<xsl:choose>
+				<xsl:when test="$baseUri like '%.tumblr.com/post/%'">
 					<rdf:Description rdf:about="{$resourceURL}">
 						<rdf:type rdf:resource="&sioct;BlogPost"/>
 						<dc:title>
@@ -76,53 +76,53 @@
 							<xsl:value-of select="posts/post/@slug"/>
 						</rdfs:label>
 						<xsl:if test="posts/post/video-caption">
-							<dc:description>
-								<xsl:value-of select="posts/post/video-caption" />
-							</dc:description>
+							<dc:description>
+								<xsl:value-of select="posts/post/video-caption" />
+							</dc:description>
 						</xsl:if>
 						<xsl:if test="posts/post/video-source">
-							<bibo:uri rdf:resource="{posts/post/video-source}" />
+							<bibo:uri rdf:resource="{posts/post/video-source}" />
 						</xsl:if>
 						<xsl:if test="posts/post/video-player">
-							<bibo:content>
-								<xsl:value-of select="posts/post/video-player" />
-							</bibo:content>
+							<bibo:content>
+								<xsl:value-of select="posts/post/video-player" />
+							</bibo:content>
 						</xsl:if>
 						<dcterms:created rdf:datatype="&xsd;dateTime">
-							<xsl:value-of select="posts/post/@date-gmt"/>
-						</dcterms:created>
+							<xsl:value-of select="posts/post/@date-gmt"/>
+						</dcterms:created>
 						<xsl:if test="posts/post/regular-title">
-							<dc:description>
-								<xsl:value-of select="posts/post/regular-title" />
-							</dc:description>
+							<dc:description>
+								<xsl:value-of select="posts/post/regular-title" />
+							</dc:description>
 						</xsl:if>
 						<xsl:if test="posts/post/regular-body">
-							<bibo:content>
-								<xsl:value-of select="posts/post/regular-body" />
-							</bibo:content>
+							<bibo:content>
+								<xsl:value-of select="posts/post/regular-body" />
+							</bibo:content>
 						</xsl:if>
 						<xsl:if test="posts/post/question">
-							<dc:description>
-								<xsl:value-of select="posts/post/question" />
-							</dc:description>
+							<dc:description>
+								<xsl:value-of select="posts/post/question" />
+							</dc:description>
 						</xsl:if>
 						<xsl:if test="posts/post/answer">
-							<dc:description>
-								<xsl:value-of select="posts/post/answer" />
-							</dc:description>
-						</xsl:if>
+							<dc:description>
+								<xsl:value-of select="posts/post/answer" />
+							</dc:description>
+						</xsl:if>
 						<xsl:if test="posts/post/photo-caption">
-							<dc:description>
-								<xsl:value-of select="posts/post/photo-caption" />
-							</dc:description>
-						</xsl:if>
+							<dc:description>
+								<xsl:value-of select="posts/post/photo-caption" />
+							</dc:description>
+						</xsl:if>
 						<xsl:if test="posts/post/photo-link-url">
-							<foaf:img rdf:resource="{posts/post/photo-link-url}" />
-						</xsl:if>
+							<foaf:img rdf:resource="{posts/post/photo-link-url}" />
+						</xsl:if>
 						<xsl:for-each select="posts/post/photo-url">
-							<foaf:img rdf:resource="{.}" />
-						</xsl:for-each>
-						<owl:sameAs rdf:resource="{vi:proxyIRI (posts/post/@url-with-slug)}"/>
+							<foaf:img rdf:resource="{.}" />
+						</xsl:for-each>
+						<owl:sameAs rdf:resource="{vi:proxyIRI (posts/post/@url-with-slug)}"/>
 						<owl:sameAs rdf:resource="{vi:proxyIRI (posts/post/@url)}"/>
 					</rdf:Description>
 				</xsl:when>	
@@ -135,12 +135,12 @@
 						<foaf:name>
 							<xsl:value-of select="tumblelog/@name"/>
 						</foaf:name>
-						<dc:description>
-							<xsl:value-of select="tumblelog" />
-						</dc:description>
-						<xsl:for-each select="posts/post">
-							<sioc:container_of rdf:resource="{vi:proxyIRI(@url)}" />
-						</xsl:for-each>
+						<dc:description>
+							<xsl:value-of select="tumblelog" />
+						</dc:description>
+						<xsl:for-each select="posts/post">
+							<sioc:container_of rdf:resource="{vi:proxyIRI(@url)}" />
+						</xsl:for-each>
 					</rdf:Description>
 				</xsl:otherwise>
 			</xsl:choose>
diff --git a/binsrc/rdf_mappers/xslt/main/twitter2rdf.xsl b/binsrc/rdf_mappers/xslt/main/twitter2rdf.xsl
index aeeed0a..912ea1e 100644
--- a/binsrc/rdf_mappers/xslt/main/twitter2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/twitter2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: twitter2rdf.xsl,v 1.1.2.4 2009/09/23 21:37:41 source Exp $
+ -  $Id: twitter2rdf.xsl,v 1.1.2.8 2011/03/08 13:36:29 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -93,7 +93,7 @@
 									<xsl:with-param name="string" select="a:content"/>
 								</xsl:call-template>
 							</sioc:content>
-							<foaf:maker rdf:resource="{vi:proxyIRI(a:author/a:uri)}"/>
+							<dcterms:creator rdf:resource="{vi:proxyIRI(a:author/a:uri)}"/>
 						</rdf:Description>
 						<foaf:Person rdf:about="{vi:proxyIRI(a:author/a:uri)}">
 							<foaf:made rdf:resource="{vi:proxyIRI(a:link[@rel='alternate']/@href)}"/>
@@ -127,13 +127,13 @@
 									<xsl:with-param name="string" select="a:title"/>
 								</xsl:call-template>
 							</dc:title>
-							<sioc:content>
+							<bibo:content>
 								<xsl:call-template name="add-href">
 									<xsl:with-param name="string" select="a:content"/>
 								</xsl:call-template>
-							</sioc:content>
+							</bibo:content>
 							<rdfs:seeAlso rdf:resource="{substring-before(a:link[@rel='thread']/@href, '.atom')}"/>
-							<foaf:maker rdf:resource="{vi:proxyIRI(a:author/a:uri)}"/>
+							<dcterms:creator rdf:resource="{vi:proxyIRI(a:author/a:uri)}"/>
 						</rdf:Description>
 
 						<foaf:Person rdf:about="{vi:proxyIRI(a:author/a:uri)}">
@@ -150,12 +150,8 @@
 				</xsl:when>
 				<xsl:when test="$what = 'user'">
 					<foaf:Document rdf:about="{$docproxyIRI}">
-						<dc:subject>
-							<foaf:Person rdf:about="{vi:proxyIRI(concat('http://twitter.com/', user/screen_name))}" />
-						</dc:subject>
-						<foaf:primaryTopic>
-							<foaf:Person rdf:about="{vi:proxyIRI(concat('http://twitter.com/', user/screen_name))}" />
-						</foaf:primaryTopic>
+						<dcterms:subject rdf:resource="{vi:proxyIRI(concat('http://twitter.com/', user/screen_name))}" />
+						<foaf:primaryTopic rdf:resource="{vi:proxyIRI(concat('http://twitter.com/', user/screen_name))}" />
 					</foaf:Document>
 					<xsl:apply-templates select="user" />
 				</xsl:when>
@@ -231,19 +227,19 @@
 				<xsl:with-param name="string" select="text"/>
 			</xsl:call-template>
 		</dc:title>
-		<sioc:content>
+		<bibo:content>
 			<xsl:call-template name="add-href">
 				<xsl:with-param name="string" select="text"/>
 			</xsl:call-template>
-		</sioc:content>
+		</bibo:content>
 		<dc:source>
-			<xsl:value-of select="source" />
+			<xsl:value-of select="concat($baseUri, '#this')" />
 		</dc:source>
 		<xsl:if test="in_reply_to_status_id != ''">
 			<sioc:reply_of rdf:resource="{vi:proxyIRI(concat('http://twitter.com/', in_reply_to_screen_name, '/status/', in_reply_to_status_id))}"/>
 		</xsl:if>
 		<rdfs:seeAlso rdf:resource="{concat('http://search.twitter.com/search/thread/', id)}"/>
-		<foaf:maker rdf:resource="{vi:proxyIRI(concat('http://twitter.com/', user/screen_name))}"/>
+		<dcterms:creator rdf:resource="{vi:proxyIRI(concat('http://twitter.com/', user/screen_name))}"/>
 	</xsl:template>
 
 	<xsl:template name="status">
@@ -282,22 +278,22 @@
 				<xsl:value-of select="id" />
 			</twitter:id>
 			<xsl:if test="followers_count != ''">
-				<twitter:followers_count>
+				<twitter:followers_count rdf:datatype="&xsd;integer">
 					<xsl:value-of select="followers_count" />
 				</twitter:followers_count>
 			</xsl:if>
 			<xsl:if test="friends_count != ''">
-				<twitter:friends_count>
+				<twitter:friends_count rdf:datatype="&xsd;integer">
 					<xsl:value-of select="friends_count" />
 				</twitter:friends_count>
 			</xsl:if>
 			<xsl:if test="favourites_count != ''">
-				<twitter:favourites_count>
+				<twitter:favourites_count rdf:datatype="&xsd;integer">
 					<xsl:value-of select="favourites_count" />
 				</twitter:favourites_count>
 			</xsl:if>
 			<xsl:if test="statuses_count != ''">
-				<twitter:statuses_count>
+				<twitter:statuses_count rdf:datatype="&xsd;integer">
 					<xsl:value-of select="statuses_count" />
 				</twitter:statuses_count>
 			</xsl:if>
@@ -316,6 +312,7 @@
 			<xsl:if test="$what = 'followers'">
 				<sioc:follows rdf:resource="{vi:proxyIRI(concat('http://twitter.com/', $id))}"/>
 			</xsl:if>
+			<owl:sameAs rdf:resource="{concat('http://twitter.com/!#/', screen_name)}"/>
 		</foaf:Person>
 	</xsl:template>
 
diff --git a/binsrc/rdf_mappers/xslt/main/ustream2rdf.xsl b/binsrc/rdf_mappers/xslt/main/ustream2rdf.xsl
index fd2b91b..243389c 100644
--- a/binsrc/rdf_mappers/xslt/main/ustream2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/ustream2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ustream2rdf.xsl,v 1.1.2.2 2010/03/12 09:04:54 source Exp $
+ -  $Id: ustream2rdf.xsl,v 1.1.2.3 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -77,7 +77,7 @@
                                                 <sioc:has_container rdf:resource="{$docproxyIRI}"/>
                                                 <rdfs:label><xsl:value-of select="title"/></rdfs:label>
                                                 <oplustream:id><xsl:value-of select="id"/></oplustream:id>
-                                                <foaf:maker rdf:resource="{vi:proxyIRI(user/url)}"/>
+                                                <dcterms:creator rdf:resource="{vi:proxyIRI(user/url)}"/>
                                                 <dc:title><xsl:value-of select="title"/></dc:title>
                                                 <dc:description><xsl:value-of select="description"/></dc:description>
                                                 <bibo:uri rdf:resource="{url}"/>
@@ -109,7 +109,7 @@
                                                 <rdfs:label><xsl:value-of select="title"/></rdfs:label>
                                                 <sioc:has_container rdf:resource="{$docproxyIRI}"/>
                                                 <oplustream:id><xsl:value-of select="id"/></oplustream:id>
-                                                <foaf:maker rdf:resource="{vi:proxyIRI(user/url)}"/>
+                                                <dcterms:creator rdf:resource="{vi:proxyIRI(user/url)}"/>
                                                 <dc:title><xsl:value-of select="title"/></dc:title>
                                                 <dc:description><xsl:value-of select="description"/></dc:description>
                                                 <bibo:uri rdf:resource="{url}"/>
diff --git a/binsrc/rdf_mappers/xslt/main/vimeo2rdf.xsl b/binsrc/rdf_mappers/xslt/main/vimeo2rdf.xsl
index 7893ed0..b305084 100644
--- a/binsrc/rdf_mappers/xslt/main/vimeo2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/vimeo2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vimeo2rdf.xsl,v 1.1.4.2 2010/05/26 15:23:14 source Exp $
+ -  $Id: vimeo2rdf.xsl,v 1.1.4.3 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -78,7 +78,7 @@
 		<rdf:Description rdf:about="{$resourceURL}">
 			<rdf:type rdf:resource="&video;Recording"/>
             <vimeo:id><xsl:value-of select="id"/></vimeo:id>
-			<dcterms:title><xsl:value-of select="title"/></dcterms:title>
+			<dc:title><xsl:value-of select="title"/></dc:title>
 			<dc:description><xsl:value-of select="description"/></dc:description>
             <bibo:uri rdf:resource="{url}"/>
             <dcterms:created rdf:datatype="&xsd;dateTime"><xsl:value-of select="upload_date"/></dcterms:created>
@@ -86,7 +86,7 @@
             <foaf:img rdf:resource="{thumbnail_small}"/>
             <foaf:img rdf:resource="{thumbnail_medium}"/>
             <foaf:img rdf:resource="{thumbnail_large}"/>
-            <foaf:maker rdf:resource="{vi:proxyIRI(user_url)}" />
+            <dcterms:creator rdf:resource="{vi:proxyIRI(user_url)}" />
             <vimeo:stats_number_of_likes><xsl:value-of select="stats_number_of_likes"/></vimeo:stats_number_of_likes>
             <vimeo:stats_number_of_plays><xsl:value-of select="stats_number_of_plays"/></vimeo:stats_number_of_plays>
             <vimeo:stats_number_of_comments><xsl:value-of select="stats_number_of_comments"/></vimeo:stats_number_of_comments>
diff --git a/binsrc/rdf_mappers/xslt/main/wine2rdf.xsl b/binsrc/rdf_mappers/xslt/main/wine2rdf.xsl
index ff96cf2..578e5ab 100644
--- a/binsrc/rdf_mappers/xslt/main/wine2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/wine2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: wine2rdf.xsl,v 1.1.4.3 2010/06/25 11:19:15 source Exp $
+ -  $Id: wine2rdf.xsl,v 1.1.4.6 2011/03/28 13:02:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -112,7 +112,9 @@
     <xsl:template match="Product/PriceMax" mode="offering">
         <gr:hasPriceSpecification>
             <gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'UnitPriceSpecification_Max')}">
-                <rdfs:label>Max price</rdfs:label>
+                <rdfs:label>
+		<xsl:value-of select="concat( ., ' (USD)')"/>	
+		</rdfs:label>
                 <gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
                 <gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="."/></gr:hasCurrencyValue>
                 <gr:hasCurrency rdf:datatype="&xsd;string">USD</gr:hasCurrency>
@@ -123,7 +125,9 @@
     <xsl:template match="Product/PriceMin" mode="offering">
         <gr:hasPriceSpecification>
             <gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'UnitPriceSpecification_Min')}">
-                <rdfs:label>Min price</rdfs:label>
+                <rdfs:label>
+		<xsl:value-of select="concat( ., ' (USD)')"/>	
+		</rdfs:label>
                 <gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
                 <gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="."/></gr:hasCurrencyValue>
                 <gr:hasCurrency rdf:datatype="&xsd;string">USD</gr:hasCurrency>
@@ -134,7 +138,9 @@
     <xsl:template match="Product/PriceRetail" mode="offering">
         <gr:hasPriceSpecification>
             <gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'UnitPriceSpecification_Retail')}">
-                <rdfs:label>suggested retail price</rdfs:label>
+                <rdfs:label>
+		<xsl:value-of select="concat( ., ' (USD)')"/>	
+		</rdfs:label>
                 <gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
                 <gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="."/></gr:hasCurrencyValue>
                 <gr:hasCurrency rdf:datatype="&xsd;string">USD</gr:hasCurrency>
@@ -147,9 +153,9 @@
 		<rdfs:label>
 			<xsl:value-of select="."/>
 		</rdfs:label>
-		<dc:title>
+		<gr:name>
 			<xsl:value-of select="."/>
-		</dc:title>
+		</gr:name>
     </xsl:template>
 
     <xsl:template match="Product/Url">
diff --git a/binsrc/rdf_mappers/xslt/main/xfn2rdf.xsl b/binsrc/rdf_mappers/xslt/main/xfn2rdf.xsl
index 0a61921..e68961e 100644
--- a/binsrc/rdf_mappers/xslt/main/xfn2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/xfn2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xfn2rdf.xsl,v 1.1.2.2 2009/08/27 15:09:13 source Exp $
+ -  $Id: xfn2rdf.xsl,v 1.1.2.3 2010/12/09 12:36:06 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -28,10 +28,11 @@
     xmlns:h    ="http://www.w3.org/1999/xhtml"
     xmlns:rdf  ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:xfnv ="http://vocab.sindice.com/xfn#"
+    xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
     >
     <xsl:output method="xml" indent="yes"/>
     <xsl:param name="baseUri" />
-
+    <xsl:variable  name="docproxyIRI" select="vi:docproxyIRI($baseUri)"/>
     <xsl:variable name="xfn-rel">
 	<xfn>
 	    <rel value="contact"/>
@@ -131,7 +132,7 @@
 		</xsl:for-each>
 	    </xsl:variable>
 	    <xsl:if test="$xfn-doc/*">
-		<rdf:Description rdf:about="{$baseUri}">
+		<rdf:Description rdf:about="{$docproxyIRI}">
 		    <foaf:homepage rdf:resource="{$baseUri}"/>
 		    <xsl:copy-of select="$xfn-doc"/>
 		</rdf:Description>
diff --git a/binsrc/rdf_mappers/xslt/main/xfolk2rdf.xsl b/binsrc/rdf_mappers/xslt/main/xfolk2rdf.xsl
index 2d89855..b5d9c05 100644
--- a/binsrc/rdf_mappers/xslt/main/xfolk2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/xfolk2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xfolk2rdf.xsl,v 1.1.2.2 2009/08/27 15:09:13 source Exp $
+ -  $Id: xfolk2rdf.xsl,v 1.1.2.3 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -51,11 +51,11 @@
     </xsl:template>
 
     <xsl:template match="a[@rel='tag']">
-	<dc:subject>
+	<sioc:topic>
 	    <skos:Concept rdf:about="{resolve-uri ($baseUri, @href)}">
 		<skos:prefLabel><xsl:value-of select="."/></skos:prefLabel>
 	    </skos:Concept>
-	</dc:subject>
+	</sioc:topic>
     </xsl:template>
 
     <xsl:template match="*[@class='meta']">
diff --git a/binsrc/rdf_mappers/xslt/main/yahoo_stock2rdf.xsl b/binsrc/rdf_mappers/xslt/main/yahoo_stock2rdf.xsl
index d99d8b1..9f8d246 100644
--- a/binsrc/rdf_mappers/xslt/main/yahoo_stock2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/yahoo_stock2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: yahoo_stock2rdf.xsl,v 1.1.2.4 2009/09/23 21:37:41 source Exp $
+ -  $Id: yahoo_stock2rdf.xsl,v 1.1.2.5 2010/09/09 16:05:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -95,7 +95,7 @@
 	<xsl:for-each select="hist-price">
 	    <rdf:Description rdf:ID="{date}">
 		<rdfs:label><xsl:value-of select="../@symbol"/> on <xsl:value-of select="date"/></rdfs:label>
-		<dc:date><xsl:value-of select="date"/></dc:date>
+		<dcterms:issued><xsl:value-of select="date"/></dcterms:issued>
 		<rdf:type rdf:resource="&stock;PriceHistory"/>
 		<stock:highPrice><xsl:value-of select="high"/></stock:highPrice>
 		<stock:lowPrice><xsl:value-of select="low"/></stock:lowPrice>
diff --git a/binsrc/rdf_mappers/xslt/main/yelp2rdf.xsl b/binsrc/rdf_mappers/xslt/main/yelp2rdf.xsl
index 581a382..3caf4f8 100644
--- a/binsrc/rdf_mappers/xslt/main/yelp2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/yelp2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: yelp2rdf.xsl,v 1.1.2.10 2010/05/18 10:44:28 source Exp $
+ -  $Id: yelp2rdf.xsl,v 1.1.2.11 2010/07/28 12:23:31 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -64,7 +64,7 @@
 				<owl:sameAs rdf:resource="{$docIRI}" />
 			</rdf:Description>
 			<rdf:Description rdf:about="{$resourceURL}">
-				<rdf:type rdf:resource="&gr;BusinessEntity"/>
+				<rdf:type rdf:resource="&gr;LocationOfSalesOrServiceProvisioning"/>
 				<dc:title>
 					<xsl:value-of select="title" />
 				</dc:title>
@@ -75,6 +75,7 @@
 				<xsl:for-each select="item">
 				    <review:hasReview rdf:resource="{vi:proxyIRI (link)}" />
 				</xsl:for-each>
+                <foaf:page rdf:resource="{$baseUri}" />
 			</rdf:Description>
 			<xsl:for-each select="item">
 				<rdf:Description rdf:about="{vi:proxyIRI (link)}">
diff --git a/binsrc/rdf_mappers/xslt/main/zillow2rdf.xsl b/binsrc/rdf_mappers/xslt/main/zillow2rdf.xsl
index b16901f..a1ed1c4 100644
--- a/binsrc/rdf_mappers/xslt/main/zillow2rdf.xsl
+++ b/binsrc/rdf_mappers/xslt/main/zillow2rdf.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: zillow2rdf.xsl,v 1.1.2.12 2009/12/24 13:53:31 source Exp $
+ -  $Id: zillow2rdf.xsl,v 1.1.2.15 2011/03/28 13:02:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -147,7 +147,9 @@
 		<xsl:variable name="amount" select="." />
 		<gr:hasPriceSpecification>
 			<gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'LastSoldPrice')}">
-				<rdfs:label>Last Sold Price</rdfs:label>
+				<rdfs:label>
+				<xsl:value-of select="concat( $amount, ' (', @currency, ')')"/>	
+				</rdfs:label>
 				<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
 				<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="$amount"/></gr:hasCurrencyValue>
 				<gr:hasCurrency rdf:datatype="&xsd;string"><xsl:value-of select="@currency"/></gr:hasCurrency>
@@ -156,6 +158,23 @@
 		</gr:hasPriceSpecification>
     </xsl:template>
 
+    <xsl:template match="zestimate" mode="offering">
+		<xsl:variable name="amount" select="amount" />
+		<gr:hasPriceSpecification>
+			<gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'ZestimatePrice')}">
+				<rdfs:label>
+				<xsl:value-of select="concat('Zestimate: ', $amount, ' (', amount/@currency, ')')"/>	
+				</rdfs:label>
+				<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
+				<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="$amount"/></gr:hasCurrencyValue>
+				<gr:hasMinCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="valuationRange/low"/></gr:hasMinCurrencyValue>
+				<gr:hasMaxCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="valuationRange/high"/></gr:hasMaxCurrencyValue>
+				<gr:hasCurrency rdf:datatype="&xsd;string"><xsl:value-of select="amount/@currency"/></gr:hasCurrency>
+				<oplzllw:listingLastUpdated><xsl:value-of select="last-updated"/></oplzllw:listingLastUpdated>
+			</gr:UnitPriceSpecification>
+		</gr:hasPriceSpecification>
+    </xsl:template>
+
 	<!-- Process GetUpdatedPropertyDetails response -->
 
 	<!--
@@ -187,7 +206,9 @@
 		</oplzllw:price>
 		<gr:hasPriceSpecification>
 			<gr:UnitPriceSpecification rdf:about="{vi:proxyIRI ($baseUri, '', 'CurrentPrice')}">
-				<rdfs:label>Current Price</rdfs:label>
+				<rdfs:label>
+				<xsl:value-of select="concat( $amount, ' (', @currency, ')')"/>	
+				</rdfs:label>
 				<gr:hasUnitOfMeasurement>C62</gr:hasUnitOfMeasurement>
 				<gr:hasCurrencyValue rdf:datatype="&xsd;float"><xsl:value-of select="$amount"/></gr:hasCurrencyValue>
 				<gr:hasCurrency rdf:datatype="&xsd;string"><xsl:value-of select="@currency"/></gr:hasCurrency>
diff --git a/binsrc/redland/Makefile.in b/binsrc/redland/Makefile.in
index 48412ec..ace86b5 100644
--- a/binsrc/redland/Makefile.in
+++ b/binsrc/redland/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/samples/JDBC/Makefile.in b/binsrc/samples/JDBC/Makefile.in
index b2501de..8cecb83 100644
--- a/binsrc/samples/JDBC/Makefile.in
+++ b/binsrc/samples/JDBC/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/samples/Makefile.in b/binsrc/samples/Makefile.in
index 59914f1..407a1fd 100644
--- a/binsrc/samples/Makefile.in
+++ b/binsrc/samples/Makefile.in
@@ -179,6 +179,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/samples/demo/Makefile.am b/binsrc/samples/demo/Makefile.am
index b66a139..a439ebe 100644
--- a/binsrc/samples/demo/Makefile.am
+++ b/binsrc/samples/demo/Makefile.am
@@ -86,6 +86,7 @@ DEMO_DEPS=\
 	EMP9 \
 	thalia_test/*.rq \
 	thalia_test/*.sql \
+	thalia_test/*.owl \
 	tpc-h/*.sql \
 	vad_version \
 	make_vad.sh
diff --git a/binsrc/samples/demo/Makefile.in b/binsrc/samples/demo/Makefile.in
index f99ba09..69c8723 100644
--- a/binsrc/samples/demo/Makefile.in
+++ b/binsrc/samples/demo/Makefile.in
@@ -165,6 +165,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
@@ -341,6 +342,7 @@ DEMO_DEPS = \
 	EMP9 \
 	thalia_test/*.rq \
 	thalia_test/*.sql \
+	thalia_test/*.owl \
 	tpc-h/*.sql \
 	vad_version \
 	make_vad.sh
diff --git a/binsrc/samples/demo/default-virtuoso.ini b/binsrc/samples/demo/default-virtuoso.ini
index 907a8e9..e74905d 100644
--- a/binsrc/samples/demo/default-virtuoso.ini
+++ b/binsrc/samples/demo/default-virtuoso.ini
@@ -22,11 +22,11 @@
 ;  Database setup
 ;
 [Database]
-DatabaseFile			= @DBNAME at .db
-ErrorLogFile			= @DBNAME at .log
-LockFile			= @DBNAME at .lck
-TransactionFile			= @DBNAME at .trx
-xa_persistent_file		= @DBNAME at .pxa
+DatabaseFile			= @DBDIR@/@DBNAME at .db
+ErrorLogFile			= @DBDIR@/@DBNAME at .log
+LockFile			= @DBDIR@/@DBNAME at .lck
+TransactionFile			= @DBDIR@/@DBNAME at .trx
+xa_persistent_file		= @DBDIR@/@DBNAME at .pxa
 ErrorLogLevel			= 7
 FileExtend			= 200
 MaxCheckpointRemap		= 2000
@@ -35,8 +35,8 @@ TempStorage			= TempDatabase
 
 
 [TempDatabase]
-DatabaseFile			= @DBNAME at -temp.db
-TransactionFile			= @DBNAME at -temp.trx
+DatabaseFile			= @DBDIR@/@DBNAME at -temp.db
+TransactionFile			= @DBDIR@/@DBNAME at -temp.trx
 MaxCheckpointRemap		= 2000
 Striping			= 0
 
@@ -58,8 +58,8 @@ DisableTcpSocket		= 0
 ServerThreads			= 20
 CheckpointInterval		= 60
 O_DIRECT			= 0
-NumberOfBuffers			= 2000
-MaxDirtyBuffers			= 1200
+NumberOfBuffers			= 5000
+MaxDirtyBuffers			= 3200
 CaseMode			= 2
 MaxStaticCursorRows		= 5000
 CheckpointAuditTrail		= 0
diff --git a/binsrc/samples/demo/install_ini.sh.in b/binsrc/samples/demo/install_ini.sh.in
index 6acd541..a456bb0 100644
--- a/binsrc/samples/demo/install_ini.sh.in
+++ b/binsrc/samples/demo/install_ini.sh.in
@@ -65,6 +65,7 @@ echo "Installing default ini file as $INIFILE"
 
 sed	-e "s,[@]VADDIR[@],$VADDIR,g" \
 	-e "s,[@]HOSTINGDIR[@],$HOSTINGDIR,g" \
+	-e "s,[@]DBDIR[@],$DBDIR,g" \
 	-e "s,[@]DBNAME[@],$DBNAME,g" \
 	-e "s,[@]HOST[@],$HOST,g" \
 	-e "s,[@]PORT[@],$PORT,g" \
diff --git a/binsrc/samples/demo/make_vad.sh b/binsrc/samples/demo/make_vad.sh
index d7a4139..dfee25a 100755
--- a/binsrc/samples/demo/make_vad.sh
+++ b/binsrc/samples/demo/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.18.2.3 2010/07/09 13:32:33 source Exp $
+#  $Id: make_vad.sh,v 1.18.2.4 2011/02/03 10:37:51 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -357,7 +357,7 @@ sticker_init() {
   echo "  <name package=\"Demo\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"Demo Database\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso/demo/download\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso/demo/download\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
diff --git a/binsrc/samples/demo/mkdemo.sh b/binsrc/samples/demo/mkdemo.sh
index 1a9e4c6..87de4ab 100755
--- a/binsrc/samples/demo/mkdemo.sh
+++ b/binsrc/samples/demo/mkdemo.sh
@@ -2,7 +2,7 @@
 #
 #  mkdemo.sh
 #
-#  $Id: mkdemo.sh,v 1.33.2.3 2009/11/19 22:20:50 source Exp $
+#  $Id: mkdemo.sh,v 1.33.2.4 2010/09/21 13:12:36 source Exp $
 #
 #  Creates a demo database
 #  
@@ -379,8 +379,8 @@ then
     [ -f ods_wiki_dav.vad ] && DO_COMMAND "vad_install ('ods_wiki_dav.vad')" dba dba
 fi
 
-[ -f demo_dav.vad ] && DO_COMMAND "vad_install ('demo_dav.vad')" dba dba
 [ -f tutorial_dav.vad ] && DO_COMMAND "vad_install ('tutorial_dav.vad')" dba dba
+[ -f demo_dav.vad ] && DO_COMMAND "vad_install ('demo_dav.vad')" dba dba
 
 DO_COMMAND "delete from wa_domains where WD_DOMAIN = 'localhost'" dba dba
 
diff --git a/binsrc/samples/demo/mkdoc.sh b/binsrc/samples/demo/mkdoc.sh
index 09091fd..12393a8 100755
--- a/binsrc/samples/demo/mkdoc.sh
+++ b/binsrc/samples/demo/mkdoc.sh
@@ -2,7 +2,7 @@
 #
 #  mkdoc.sh
 #
-#  $Id: mkdoc.sh,v 1.20.2.1 2010/01/07 16:58:12 source Exp $
+#  $Id: mkdoc.sh,v 1.20.2.2 2011/02/03 10:37:51 source Exp $
 #
 #  Creates Virtuoso Documentation
 #  
@@ -387,7 +387,7 @@ sticker_init() {
   echo "  <name package=\"doc\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"Virtuoso Documentation\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
diff --git a/binsrc/samples/demo/thalia_test/thalia.owl b/binsrc/samples/demo/thalia_test/thalia.owl
new file mode 100644
index 0000000..a05a1bd
--- /dev/null
+++ b/binsrc/samples/demo/thalia_test/thalia.owl
@@ -0,0 +1,246 @@
+<?xml version="1.0"?>
+<rdf:RDF xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+         xmlns:owl ="http://www.w3.org/2002/07/owl#"
+         xmlns:virtrdf="http://www.openlinksw.com/schemas/virtrdf#"
+         xml:base="http://demo.openlinksw.com/schemas/thalia#"
+         xmlns:foaf="http://xmlns.com/foaf/0.1/"
+         xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
+         xmlns:cal="http://www.w3.org/2002/12/cal/ical#"
+         xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"
+         xmlns:product="http://www.swop-project.eu/ontologies/pmo/product.owl#">
+
+<owl:Ontology rdf:about="http://demo.openlinksw.com/schemas/thalia#">
+        <rdfs:label>Thalia</rdfs:label>
+        <rdfs:comment>Thalia classes and properties</rdfs:comment>
+        <virtrdf:catName>Thalia</virtrdf:catName>
+        <virtrdf:version>1.00</virtrdf:version>
+    </owl:Ontology>
+
+    <rdfs:Class rdf:ID="Asu">
+        <rdfs:label>Asu</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Course"/>
+    </rdfs:Class>
+    
+    <rdf:Property rdf:ID="forUniversity">
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+        <rdfs:domain rdf:resource="Asu"/>
+        <rdfs:domain rdf:resource="Brown"/>
+        <rdfs:domain rdf:resource="Cmu"/>
+        <rdfs:domain rdf:resource="Toronto"/>
+        <rdfs:domain rdf:resource="Ucsd"/>
+        <rdfs:domain rdf:resource="Umd"/>
+        <rdfs:cardinality>1</rdfs:cardinality>
+        <rdfs:label>forUniversity</rdfs:label>
+    </rdf:Property>
+    
+    <rdfs:Class rdf:ID="Brown">
+        <rdfs:label>Brown</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Course"/>
+    </rdfs:Class>
+    <rdf:Property rdf:ID="hasInstructor">
+        <rdfs:range rdf:resource="BrownInstructor"/>
+        <rdfs:domain rdf:resource="Brown"/>
+        <rdfs:domain rdf:resource="Cmu"/>
+        <rdfs:domain rdf:resource="Gatech"/>
+        <rdfs:domain rdf:resource="Toronto"/>
+        <rdfs:cardinality>1</rdfs:cardinality>
+        <rdfs:label>hasInstructor</rdfs:label>
+    </rdf:Property>
+    
+    <rdf:Property rdf:ID="hasInstructor1">
+        <rdfs:domain rdf:resource="Ucsd"/>
+        <rdfs:cardinality>1</rdfs:cardinality>
+        <rdfs:label>hasInstructor1</rdfs:label>
+    </rdf:Property>
+
+    <rdf:Property rdf:ID="hasInstructor2">
+        <rdfs:domain rdf:resource="Ucsd"/>
+        <rdfs:cardinality>1</rdfs:cardinality>
+        <rdfs:label>hasInstructor2</rdfs:label>
+    </rdf:Property>
+    
+    <rdf:Property rdf:ID="hasInstructor3">
+        <rdfs:domain rdf:resource="Ucsd"/>
+        <rdfs:cardinality>1</rdfs:cardinality>
+        <rdfs:label>hasInstructor3</rdfs:label>
+    </rdf:Property>
+    
+    <rdf:Property rdf:ID="hasLecture">
+        <rdfs:range rdf:resource="BrownLecture"/>
+        <rdfs:domain rdf:resource="Brwon"/>
+        <rdfs:domain rdf:resource="Cmu"/>
+        <rdfs:domain rdf:resource="Gatech"/>
+        <rdfs:domain rdf:resource="Toronto"/>
+        <rdfs:domain rdf:resource="Umd"/>
+        <rdfs:cardinality>1</rdfs:cardinality>
+        <rdfs:label>hasLecture</rdfs:label>
+    </rdf:Property>
+    
+    <rdf:Property rdf:ID="hasSection">
+        <rdfs:range rdf:resource="SectionTitle"/>
+        <rdfs:domain rdf:resource="Umd"/>
+        <rdfs:cardinality>1</rdfs:cardinality>
+        <rdfs:label>hasSection</rdfs:label>
+    </rdf:Property>
+
+    <rdf:Property rdf:ID="hasPrerequisite">
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+        <rdfs:domain rdf:resource="Toronto"/>
+        <rdfs:cardinality>1</rdfs:cardinality>
+        <rdfs:label>hasPrerequisite</rdfs:label>
+    </rdf:Property>
+    
+    <rdfs:Class rdf:ID="SectionTitle">
+        <rdfs:label>SectionTitle</rdfs:label>
+    </rdfs:Class>
+    
+    <rdf:Property rdf:ID="text">
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+        <rdfs:domain rdf:resource="Toronto"/>
+        <rdfs:cardinality>1</rdfs:cardinality>
+        <rdfs:label>text</rdfs:label>
+    </rdf:Property>
+    
+    <rdfs:Class rdf:ID="BrownInstructor">
+        <rdfs:label>BrownInstructor</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Instructor"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="BrownLecture">
+        <rdfs:label>BrownLecture</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://purl.org/NET/c4dm/event.owl#Event"/>
+    </rdfs:Class>
+        
+    <rdfs:Class rdf:ID="BrownPlace">
+        <rdfs:label>BrownPlace</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://www.w3.org/2003/01/geo/wgs84_pos#Point"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="Cmu">
+        <rdfs:label>Cmu</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Course"/>
+    </rdfs:Class>
+    <rdf:Property rdf:ID="hasUnits">
+        <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+        <rdfs:domain rdf:resource="Cmu"/>
+        <rdfs:cardinality>1</rdfs:cardinality>
+        <rdfs:label>hasUnits</rdfs:label>
+    </rdf:Property>
+    
+    <rdfs:Class rdf:ID="CmuInstructor">
+        <rdfs:label>CmuInstructor</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Instructor"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="CmuLecture">
+        <rdfs:label>CmuLecture</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://purl.org/NET/c4dm/event.owl#Event"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="CmuPlace">
+        <rdfs:label>CmuPlace</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://www.w3.org/2003/01/geo/wgs84_pos#Point"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="CmuEventTime">
+        <rdfs:label>CmuEventTime</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://www.w3.org/2006/time#Interval"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="CmuDatetime">
+        <rdfs:label>CmuDatetime</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://www.w3.org/2006/time#DateTimeDescription"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="Gatech">
+        <rdfs:label>Gatech</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Course"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="GatechInstructor">
+        <rdfs:label>GatechInstructor</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Instructor"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="GatechLecture">
+        <rdfs:label>GatechLecture</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://purl.org/NET/c4dm/event.owl#Event"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="GatechEventTime">
+        <rdfs:label>GatechEventTime</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://www.w3.org/2006/time#Interval"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="GatechDatetime">
+        <rdfs:label>GatechDatetime</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://www.w3.org/2006/time#DateTimeDescription"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="GatechPlace">
+        <rdfs:label>GatechPlace</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://www.w3.org/2003/01/geo/wgs84_pos#Point"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="Toronto">
+        <rdfs:label>Toronto</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Course"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="TorontoInstructor">
+        <rdfs:label>TorontoInstructor</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Instructor"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="TorontoLecture">
+        <rdfs:label>TorontoLecture</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://purl.org/NET/c4dm/event.owl#Event"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="TorontoPlace">
+        <rdfs:label>TorontoPlace</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://www.w3.org/2003/01/geo/wgs84_pos#Point"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="Ucsd">
+        <rdfs:label>Ucsd</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Course"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="UcsdInstructor1">
+        <rdfs:label>UcsdInstructor1</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Instructor"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="UcsdInstructor2">
+        <rdfs:label>UcsdInstructor2</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Instructor"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="UcsdInstructor3">
+        <rdfs:label>UcsdInstructor3</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Instructor"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="Umd">
+        <rdfs:label>Umd</rdfs:label>
+        <rdfs:subClassOf rdf:resource="Course"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="UmdLecture">
+        <rdfs:label>UmdLecture</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://purl.org/NET/c4dm/event.owl#Event"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="UmdEventTime">
+        <rdfs:label>UmdEventTime</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://www.w3.org/2006/time#Interval"/>
+    </rdfs:Class>
+    
+    <rdfs:Class rdf:ID="UmdDatetime">
+        <rdfs:label>UmdDatetime</rdfs:label>
+        <rdfs:subClassOf rdf:resource="http://www.w3.org/2006/time#DateTimeDescription"/>
+    </rdfs:Class>
+    
+</rdf:RDF>
diff --git a/binsrc/samples/hslookup/Makefile.in b/binsrc/samples/hslookup/Makefile.in
index 77666ee..52beeb4 100644
--- a/binsrc/samples/hslookup/Makefile.in
+++ b/binsrc/samples/hslookup/Makefile.in
@@ -208,6 +208,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/samples/image_magick/Makefile.in b/binsrc/samples/image_magick/Makefile.in
index 2b21678..8fa08d3 100644
--- a/binsrc/samples/image_magick/Makefile.in
+++ b/binsrc/samples/image_magick/Makefile.in
@@ -207,6 +207,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/samples/image_magick/im.c b/binsrc/samples/image_magick/im.c
index fbf1344..8efcf86 100644
--- a/binsrc/samples/image_magick/im.c
+++ b/binsrc/samples/image_magick/im.c
@@ -39,1103 +39,712 @@
 
 #include <wand/magick-wand.h>
 
-#define IM_VERSION "0.5"
+#define IM_VERSION "0.6"
 
-static dk_mutex_t *im_mutex = NULL;
-static caddr_t im_IMVERSION = NULL;
-static caddr_t *im_env = NULL;
+/*#define IM_DEBUG*/
 
-#define WandExitMacro(wand) \
-{ \
-  DestroyMagickWand(wand);\
-  mutex_leave (im_mutex); \
-}
+#ifdef IM_DEBUG
+#define im_dbg_printf(s) printf s
+#else
+#define im_dbg_printf(s)
+#endif
 
-#define WandExitMacroExt(wand,draw,pixel) \
-{ \
-  DestroyMagickWand(wand); \
-  if (NULL != draw) \
-    DestroyDrawingWand (draw); \
-  if (NULL != pixel) \
-    DestroyPixelWand(pixel); \
-  mutex_leave (im_mutex); \
-}
+static dk_mutex_t *im_lib_mutex = NULL;
+static caddr_t im_IMVERSION = NULL;
 
-MagickBooleanType status;
-MagickWand *magick_wand;
+typedef struct im_env_s {
+  caddr_t * ime_qst;
+  state_slot_t ** ime_args;
+  int ime_argcount;
+  const char *ime_bifname;	/*!< BIF name used to invoke IM */
+  caddr_t ime_input_filename;	/*!< Name of file to read, owned by caller */
+  caddr_t ime_input_blob;
+  long ime_input_blob_len;
+  const char *ime_input_ext;
+  const char *ime_output_ext;
+  char ime_input_blob_name[64];
+  char ime_output_blob_name[64];
+  caddr_t ime_output_filename;	/*!< Name of file to write, owned by caller */
+  long ime_width, ime_height, ime_x, ime_y;
+  MagickBooleanType ime_status;
+  PixelWand *ime_background;
+  DrawingWand *ime_drawing_wand;
+  MagickWand *ime_magick_wand;
+  MagickWand *ime_target_magick_wand;
+  } im_env_t;
+
+void
+im_enter (im_env_t *env)
+{
+  /* mutex_enter (im_lib_mutex); */
+  env->ime_magick_wand = NewMagickWand ();
+}
+
+void
+im_leave (im_env_t *env)
+{
+  if (NULL != env->ime_target_magick_wand)
+    DestroyMagickWand (env->ime_target_magick_wand);
+  DestroyMagickWand (env->ime_magick_wand);
+  if (NULL != env->ime_drawing_wand)
+    DestroyDrawingWand (env->ime_drawing_wand);
+  if (NULL != env->ime_background)
+    DestroyPixelWand (env->ime_background);
+  im_dbg_printf (("IM %p: about to leave %s()...", env, env->ime_bifname));
+  /* mutex_leave (im_lib_mutex); */
+  im_dbg_printf (("... IM %p: left\n", env));
+}
+
+extern void
+im_leave_with_error (im_env_t *env, const char *code, const char *virt_code, const char *string, ...)
+#ifdef __GNUC__
+ __attribute__ ((format (printf, 4, 5)))
+#endif
+;
 
-caddr_t bif_im_CropImageFile (caddr_t * qst, caddr_t * err, state_slot_t ** args)
-{
-  caddr_t new_file_name;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM CropImageFile");
-  unsigned long width = (unsigned long) bif_long_arg (qst, args, 1, "IM CropImageFile");
-  unsigned long height = (unsigned long) bif_long_arg (qst, args, 2, "IM CropImageFile");
-  long x = bif_long_arg (qst, args, 3, "IM CropImageFile");
-  long y = bif_long_arg (qst, args, 4, "IM CropImageFile");
-  int n_args = BOX_ELEMENTS(args);
-  if (n_args > 5)
-    new_file_name = bif_string_arg (qst, args, 5, "IM CropImageFile");
-  else
-    new_file_name = bif_string_arg (qst, args, 0, "IM CropImageFile");
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_CropImageFile cannot open file");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
+void
+im_leave_with_error (im_env_t *env, const char *code, const char *virt_code, const char *string, ...)
   {
-    MagickCropImage(magick_wand, width, height, x, y);
+  static char temp[2000];
+  va_list lst;
+  caddr_t err;
+  va_start (lst, string);
+  vsnprintf (temp, sizeof (temp), string, lst);
+  va_end (lst);
+  temp[sizeof(temp)-1] = '\0';
+  err = srv_make_new_error (code, virt_code, "Function \"%s\"(): %.2000s", env->ime_bifname, temp);
+  im_dbg_printf (("IM %p: an error will be signalled: Function \"%s\"(): %.2000s\n", env, env->ime_bifname, temp));
+  im_leave (env);
+  sqlr_resignal (err);
   }
-  if (new_file_name)
-    status=MagickWriteImages(magick_wand, new_file_name, MagickTrue);
-  else
-    status=MagickWriteImages(magick_wand, file_name, MagickTrue);
-  if (status == MagickFalse)
+
+void
+im_init (im_env_t *env, caddr_t * qst, state_slot_t ** args, const char *bifname)
   {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_CropImageFile cannot write image into file");
-  }
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
-  return (0);
+  memset (env, 0, sizeof (im_env_t));
+  env->ime_qst = qst;
+  env->ime_args = args;
+  env->ime_argcount = BOX_ELEMENTS (args);
+  env->ime_bifname = bifname;
+  im_dbg_printf (("IM %p: init %s(), %d args...", env, bifname, env->ime_argcount));
+  im_enter (env);
+  im_dbg_printf (("...IM %p: entered\n", env));
 }
 
-caddr_t bif_im_CropImageFileToBlob(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+void
+im_env_set_filenames (im_env_t *env, int in_arg_no, int out_arg_no)
 {
-  size_t length = 0;
-  caddr_t res, image_blob;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM CropImageFileToBlob");
-  unsigned long width = bif_long_arg (qst, args, 1, "IM CropImageFileToBlob");
-  unsigned long height = bif_long_arg (qst, args, 2, "IM CropImageFileToBlob");
-  long x = bif_long_arg (qst, args, 3, "IM CropImageFileToBlob");
-  long y = bif_long_arg (qst, args, 4, "IM CropImageFileToBlob");
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
+  env->ime_input_filename = bif_string_arg (env->ime_qst, env->ime_args, in_arg_no, env->ime_bifname);
+  im_dbg_printf (("IM %p: %s() set input file name to %s\n", env, env->ime_bifname, env->ime_input_filename));
+  if (0 <= out_arg_no)
   {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_CropImageFileToBlob cannot open file");
+      if (out_arg_no < env->ime_argcount)
+        env->ime_output_filename = bif_string_arg (env->ime_qst, env->ime_args, out_arg_no, env->ime_bifname);
+      else
+        env->ime_output_filename = env->ime_input_filename;
+      im_dbg_printf (("IM %p: %s() set output file name to %s\n", env, env->ime_bifname, env->ime_output_filename));
   }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    MagickCropImage(magick_wand, width, height, x, y);
   }
-  image_blob = MagickGetImagesBlob(magick_wand, &length);
-  if (length != 0)
+
+
+void
+im_env_set_input_blob (im_env_t *env, int in_arg_no)
   {
-    res = dk_alloc_box(length, DV_BIN);
-    memcpy (res, image_blob, length);
-    MagickRelinquishMemory(image_blob);
-  }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
-  return res;
+  env->ime_input_blob = bif_string_arg (env->ime_qst, env->ime_args, in_arg_no, env->ime_bifname);
+  env->ime_input_blob_len = bif_long_arg (env->ime_qst, env->ime_args, in_arg_no+1, env->ime_bifname);
+  im_dbg_printf (("IM %p: %s() set input to blob, %ld bytes declared, %ld bytes actual with dtp %u\n", env, env->ime_bifname, (long)(env->ime_input_blob_len), (long)(box_length (env->ime_input_blob)), (unsigned)(DV_TYPE_OF(env->ime_input_blob))));
 }
 
-caddr_t bif_im_GetImageFileAttribute(caddr_t * qst, caddr_t * err, state_slot_t ** args)
-{
-  caddr_t res, key_value = NULL;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM GetImageFileAttribute");
-  caddr_t key = bif_string_arg (qst, args, 1, "IM GetImageFileAttribute");
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
+void
+im_env_set_blob_ext (im_env_t *env, int in_arg_no, int out_arg_no)
   {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_GetImageFileAttribute cannot open file");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
+  if ((0 <= in_arg_no) && (in_arg_no < env->ime_argcount))
   {
-    key_value = MagickGetImageAttribute(magick_wand, key);
+      env->ime_input_ext = bif_string_arg (env->ime_qst, env->ime_args, in_arg_no, env->ime_bifname);
+      im_dbg_printf (("IM %p: %s() set input extension for blob to %s\n", env, env->ime_bifname, env->ime_input_ext));
   }
-  if (key_value)
+  if ((0 <= out_arg_no) && (out_arg_no < env->ime_argcount))
   {
-    res = box_dv_short_string(key_value);
-    MagickRelinquishMemory(key_value);
+      env->ime_output_ext = bif_string_arg (env->ime_qst, env->ime_args, out_arg_no, env->ime_bifname);
+      im_dbg_printf (("IM %p: %s() set output extension for blob to %s\n", env, env->ime_bifname, env->ime_input_ext));
   }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
-  return res;
 }
 
-caddr_t bif_im_GetImageFileFormat(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+void
+im_read (im_env_t *env)
 {
-  caddr_t res, key_value;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM GetImageFileFormat");
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_GetImageFileFormat cannot open file");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    key_value = MagickGetImageFormat(magick_wand);
-  }
-  if (key_value)
-    res = box_dv_short_string(key_value);
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
-  return res;
-}
-
-caddr_t bif_im_GetImageFileIdentify(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+  if (NULL != env->ime_input_filename)
 {
-  caddr_t res, key_value;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM GetImageFileIdentify");
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_GetImageFileIdentify cannot open file");
+      env->ime_status = MagickReadImage (env->ime_magick_wand, env->ime_input_filename);
+      if (env->ime_status == MagickFalse)
+        im_leave_with_error (env, "22023", "IM001", "Cannot open file \"%.1000s\"", env->ime_input_filename);
+      return;
   }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
+  if (env->ime_input_ext != NULL)
   {
-    key_value = MagickIdentifyImage(magick_wand);
+      if (strlen (env->ime_input_ext) > 30)
+        im_leave_with_error (env, "22023", "IM001", "Abnormally long extension \"%.1000s\"", env->ime_input_ext);
+      strcpy(env->ime_input_blob_name, "image.");
+      strcat(env->ime_input_blob_name, env->ime_input_ext);
+      MagickSetFilename (env->ime_magick_wand, env->ime_input_blob_name);
   }
-  if (key_value)
-    res = box_dv_short_string(key_value);
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
-  return res;
+  env->ime_status = MagickReadImageBlob(env->ime_magick_wand, (const void *)(env->ime_input_blob), (const size_t)(env->ime_input_blob_len));
+  if (env->ime_status == MagickFalse)
+    im_leave_with_error (env, "22023", "IM001", "Cannot read from blob");
 }
 
-caddr_t bif_im_GetImageBlobIdentify(caddr_t * qst, caddr_t * err, state_slot_t ** args)
-{
-  caddr_t res, key_value;
-  char in_name[64];
-  caddr_t blob = bif_string_arg (qst, args, 0, "IM GetImageBlobIdentify");
-  long blob_size = bif_long_arg (qst, args, 1, "IM GetImageBlobIdentify");
-        int n_args = BOX_ELEMENTS(args);
-  char* in_format = n_args > 2 ? bif_string_arg (qst, args, 2, "IM GetImageBlobIdentify") : NULL;
-  key_value = 0;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-        if (in_format != NULL)
+void
+im_reset_read (im_env_t *env)
         {
-                if (strlen(in_format) < 30)
+  if (NULL != env->ime_magick_wand)
                 {
-                        strcpy(in_name, "image.");
-                        strcat(in_name, in_format);
-                        MagickSetFilename(magick_wand, in_name);
+      DestroyMagickWand (env->ime_magick_wand);
+      env->ime_magick_wand = NewMagickWand ();
                 }
+  env->ime_input_filename = NULL;
+  env->ime_input_blob = NULL;
+  env->ime_input_blob_len = 0;
+  env->ime_input_ext = NULL;
+  env->ime_input_blob_name[0] = '\0';
         }
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
+
+caddr_t
+im_write (im_env_t *env)
   {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_GetImageBlobIdentify cannot read blob");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
+  if (env->ime_output_filename)
   {
-    key_value = MagickIdentifyImage(magick_wand);
+      env->ime_status = MagickWriteImages (env->ime_magick_wand, env->ime_output_filename, MagickTrue);
+      if (env->ime_status == MagickFalse)
+        im_leave_with_error (env, "22023", "IM001", "Cannot write to file \"%.1000s\"", env->ime_output_filename);
+      return NULL;
   }
-  if (key_value)
-    res = box_dv_short_string(key_value);
   else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
-  return res;
-}
-
-caddr_t bif_im_GetImageFileWidth(caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
+      size_t length = 0;
+      caddr_t image_blob = MagickGetImagesBlob (env->ime_magick_wand, &length);
   caddr_t res;
-  unsigned long key_value;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM GetImageFileWidth");
-  key_value = 0;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_GetImageFileWidth cannot open file");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
+      if (length != 0)
   {
-    key_value = MagickGetImageWidth(magick_wand);
+          res = dk_alloc_box (length, DV_BIN);
+          memcpy (res, image_blob, length);
+          MagickRelinquishMemory (image_blob);
   }
-  if (key_value)
-    res = box_num(key_value);
   else
     res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
   return res;
 }
-
-caddr_t bif_im_GetImageFileDepth(caddr_t * qst, caddr_t * err, state_slot_t ** args)
-{
-  caddr_t res;
-  unsigned long key_value;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM GetImageFileDepth");
-  key_value = 0;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_GetImageFileDepth cannot open file");
   }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
+
+void
+im_set_background (im_env_t *env, const char *color_strg)
   {
-    key_value = MagickGetImageDepth(magick_wand);
-  }
-  if (key_value)
-    res = box_num(key_value);
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
-  return res;
+  env->ime_background = NewPixelWand ();
+  env->ime_status = PixelSetColor (env->ime_background, color_strg);
+  if (env->ime_status == MagickFalse)
+    im_leave_with_error (env, "22023", "IM001", "Cannot set background color to \"%.1000s\"", color_strg);
 }
 
-caddr_t bif_im_GetImageFileHeight(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+caddr_t bif_im_CropImageFile (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  caddr_t res;
-  unsigned long key_value;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM GetImageFileHeight");
-  key_value = 0;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_GetImageFileHeight cannot open file");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
+  im_env_t env;
+  unsigned long width = (unsigned long) bif_long_arg (qst, args, 1, "IM CropImageFile");
+  unsigned long height = (unsigned long) bif_long_arg (qst, args, 2, "IM CropImageFile");
+  long x = bif_long_arg (qst, args, 3, "IM CropImageFile");
+  long y = bif_long_arg (qst, args, 4, "IM CropImageFile");
+  im_init (&env, qst, args, "IM CropImageFile");
+  im_env_set_filenames (&env, 0, 5);
+  im_read (&env);
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    key_value = MagickGetImageHeight(magick_wand);
+      MagickCropImage (env.ime_magick_wand, width, height, x, y);
   }
-  if (key_value)
-    res = box_num(key_value);
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
-  return res;
+  im_write (&env);
+  im_leave (&env);
+  return (0);
 }
 
-caddr_t bif_im_GetImageBlobWidth(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+caddr_t bif_im_CropImageFileToBlob(caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
+  im_env_t env;
   caddr_t res;
-  unsigned long key_value;
-	char in_name[64];
-  caddr_t blob = bif_string_arg (qst, args, 0, "IM GetImageBlobWidth");
-  long blob_size = bif_long_arg (qst, args, 1, "IM GetImageBlobWidth");
-	int n_args = BOX_ELEMENTS(args);
-  char* in_format = n_args > 2 ? bif_string_arg (qst, args, 2, "IM GetImageBlobWidth") : NULL;
-  key_value = 0;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-	if (in_format != NULL)
-	{
-		if (strlen(in_format) < 30)
-		{
-			strcpy(in_name, "image.");
-			strcat(in_name, in_format);
-			MagickSetFilename(magick_wand, in_name);
-		}
-	}
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_GetImageBlobWidth cannot read blob");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
+  unsigned long width = bif_long_arg (qst, args, 1, "IM CropImageFileToBlob");
+  unsigned long height = bif_long_arg (qst, args, 2, "IM CropImageFileToBlob");
+  long x = bif_long_arg (qst, args, 3, "IM CropImageFileToBlob");
+  long y = bif_long_arg (qst, args, 4, "IM CropImageFileToBlob");
+  im_init (&env, qst, args, "IM CropImageFileToBlob");
+  im_env_set_filenames (&env, 0, -1);
+  im_read (&env);
+  MagickResetIterator(env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    key_value = MagickGetImageWidth(magick_wand);
+      MagickCropImage (env.ime_magick_wand, width, height, x, y);
   }
-  if (key_value)
-    res = box_num(key_value);
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 
-caddr_t bif_im_GetImageBlobDepth(caddr_t * qst, caddr_t * err, state_slot_t ** args)
-{
-  caddr_t res;
-  unsigned long key_value;
-	char in_name[64];
-  caddr_t blob = bif_string_arg (qst, args, 0, "IM GetImageBlobDepth");
-  long blob_size = bif_long_arg (qst, args, 1, "IM GetImageBlobDepth");
-	int n_args = BOX_ELEMENTS(args);
-  char* in_format = n_args > 2 ? bif_string_arg (qst, args, 2, "IM GetImageBlobDepth") : NULL;
-  key_value = 0;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-	if (in_format != NULL)
-	{
-		if (strlen(in_format) < 30)
-		{
-			strcpy(in_name, "image.");
-			strcat(in_name, in_format);
-			MagickSetFilename(magick_wand, in_name);
-		}
-	}
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_GetImageBlobDepth cannot read blob");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
+caddr_t
+bif_im_get_impl (caddr_t * qst, caddr_t * err, state_slot_t ** args, int is_file_in, int op, const char *bifname)
   {
-    key_value = MagickGetImageDepth(magick_wand);
-  }
-  if (key_value)
-    res = box_num(key_value);
+  im_env_t env;
+  char *strg_value = NULL;
+  unsigned long ul_value = 0;
+  caddr_t res = NULL;
+  int is_string_res = (('A' == op) || ('F' == op) || ('I' == op));
+  int is_list_res = ('2' == op);
+  int is_key_needed = ('A' == op);
+  caddr_t key = is_key_needed ? bif_string_arg (qst, args, (is_file_in ? 1 : 2), bifname) : NULL;
+  im_init (&env, qst, args, bifname);
+  if (is_file_in)
+    im_env_set_filenames (&env, 0, -1);
   else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
-  return res;
-}
-
-caddr_t bif_im_GetImageBlobHeight(caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  caddr_t res;
-  unsigned long key_value;
-	char in_name[64];
-  caddr_t blob = bif_string_arg (qst, args, 0, "IM GetImageBlobHeight");
-  long blob_size = bif_long_arg (qst, args, 1, "IM GetImageBlobHeight");
-	int n_args = BOX_ELEMENTS(args);
-  char* in_format = n_args > 2 ? bif_string_arg (qst, args, 2, "IM GetImageBlobHeight") : NULL;
-  key_value = 0;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-	if (in_format != NULL)
+      im_env_set_input_blob (&env, 0);
+      im_env_set_blob_ext (&env, (is_key_needed ? 3 : 2), -1);
+    }
+  im_read (&env);
+  MagickResetIterator(env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
 	{
-		if (strlen(in_format) < 30)
+      switch (op)
 		{
-			strcpy(in_name, "image.");
-			strcat(in_name, in_format);
-			MagickSetFilename(magick_wand, in_name);
-		}
-	}
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
+        case 'A': strg_value = MagickGetImageAttribute (env.ime_magick_wand, key); break;
+        case 'F': strg_value = MagickGetImageFormat (env.ime_magick_wand); break;
+        case 'I': strg_value = MagickIdentifyImage (env.ime_magick_wand); break;
+        case 'W': ul_value = MagickGetImageWidth (env.ime_magick_wand); break;
+        case 'H': ul_value = MagickGetImageHeight (env.ime_magick_wand); break;
+        case 'D': ul_value = MagickGetImageDepth (env.ime_magick_wand); break;
+        case '2':
+          ul_value = MagickGetImageWidth (env.ime_magick_wand);
+          if (ul_value)
   {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_GetImageBlobHeight cannot read blob");
+              dk_free_tree (res);
+              res = dk_alloc_box (2 * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
+              ((caddr_t *)res)[0] = box_num (ul_value);
+              ((caddr_t *)res)[1] = box_num (MagickGetImageHeight (env.ime_magick_wand));
   }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    key_value = MagickGetImageHeight(magick_wand);
+          break;
   }
-  if (key_value)
-    res = box_num(key_value);
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
-  return res;
 }
-
-caddr_t bif_im_GetImageBlobFormat(caddr_t * qst, caddr_t * err, state_slot_t ** args)
-{
-  caddr_t res, key_value;
-	char in_name[64];
-  caddr_t blob = bif_string_arg (qst, args, 0, "IM GetImageBlobFormat");
-  long blob_size = bif_long_arg (qst, args, 1, "IM GetImageBlobFormat");
-	int n_args = BOX_ELEMENTS(args);
-  char* in_format = n_args > 2 ? bif_string_arg (qst, args, 2, "IM GetImageBlobFormat") : NULL;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-	if (in_format != NULL)
+  if (is_string_res)
 	{
-		if (strlen(in_format) < 30)
+      if (strg_value)
 		{
-			strcpy(in_name, "image.");
-			strcat(in_name, in_format);
-			MagickSetFilename(magick_wand, in_name);
+          res = box_dv_short_string (strg_value);
+          MagickRelinquishMemory (strg_value);
 		}
 	}
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
+  else if (!is_list_res)
   {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_GetImageBlobFormat cannot read blob");
+      if (ul_value)
+        res = box_num (ul_value);
   }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    key_value = MagickGetImageFormat(magick_wand);
-  }
-  if (key_value)
-    res = box_dv_short_string(key_value);
-  else
+  if (NULL == res)
     res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  im_leave (&env);
   return res;
 }
 
+caddr_t
+bif_im_GetImageFileAttribute(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 1, 'A', "IM GetImageFileAttribute"); }
+caddr_t bif_im_GetImageFileFormat(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 1, 'F', "IM GetImageFileFormat"); }
+caddr_t bif_im_GetImageFileIdentify(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 1, 'I', "IM GetImageFileIdentify"); }
+caddr_t bif_im_GetImageFileWidth(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 1, 'W', "IM GetImageFileWidth"); }
+caddr_t bif_im_GetImageFileDepth(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 1, 'D', "IM GetImageFileDepth"); }
+caddr_t bif_im_GetImageFileHeight(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 1, 'H', "IM GetImageFileHeight"); }
+caddr_t bif_im_GetImageFileWH(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 1, '2', "IM GetImageFileWH"); }
 caddr_t bif_im_GetImageBlobAttribute(caddr_t * qst, caddr_t * err, state_slot_t ** args)
-{
-  caddr_t res, key_value;
-	char in_name[64];
-  caddr_t blob = bif_string_arg (qst, args, 0, "IM GetImageBlobAttribute");
-  long blob_size = bif_long_arg (qst, args, 1, "IM GetImageBlobAttribute");
-  caddr_t key = bif_string_arg (qst, args, 2, "IM GetImageBlobAttribute");
-  int n_args = BOX_ELEMENTS(args);
-  char* in_format = n_args > 3 ? bif_string_arg (qst, args, 3, "IM GetImageBlobAttribute") : NULL;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-	if (in_format != NULL)
-	{
-		if (strlen(in_format) < 30)
-		{
-			strcpy(in_name, "image.");
-			strcat(in_name, in_format);
-			MagickSetFilename(magick_wand, in_name);
-		}
-	}
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_GetImageBlobAttribute cannot read blob");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    key_value = MagickGetImageAttribute(magick_wand, key);
-  }
-  if (key_value)
-  {
-    res = box_dv_short_string(key_value);
-    MagickRelinquishMemory(key_value);
-  }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
-  return res;
-}
+{ return bif_im_get_impl (qst, err, args, 0, 'A', "IM GetImageBlobAttribute"); }
+caddr_t bif_im_GetImageBlobFormat(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 0, 'F', "IM GetImageBlobFormat"); }
+caddr_t bif_im_GetImageBlobIdentify(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 0, 'I', "IM GetImageBlobIdentify"); }
+caddr_t bif_im_GetImageBlobWidth(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 0, 'W', "IM GetImageBlobWidth"); }
+caddr_t bif_im_GetImageBlobDepth(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 0, 'D', "IM GetImageBlobDepth"); }
+caddr_t bif_im_GetImageBlobHeight(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 0, 'H', "IM GetImageBlobHeight"); }
+caddr_t bif_im_GetImageBlobWH(caddr_t * qst, caddr_t * err, state_slot_t ** args)
+{ return bif_im_get_impl (qst, err, args, 0, '2', "IM GetImageBlobWH"); }
 
 caddr_t bif_im_CropImageBlob(caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  size_t length = 0;
-  caddr_t res, image_blob;
-	char in_name[64];
-  caddr_t blob = (caddr_t)bif_arg (qst, args, 0, "IM CropImageBlob");
-  long blob_size = bif_long_arg (qst, args, 1, "IM CropImageBlob");
+  im_env_t env;
+  caddr_t res;
   unsigned long width = bif_long_arg (qst, args, 2, "IM CropImageBlob");
   unsigned long height = bif_long_arg (qst, args, 3, "IM CropImageBlob");
   long x = bif_long_arg (qst, args, 4, "IM CropImageBlob");
   long y = bif_long_arg (qst, args, 5, "IM CropImageBlob");
-	int n_args = BOX_ELEMENTS(args);
-  char* in_format = n_args > 6 ? bif_string_arg (qst, args, 6, "IM CropImageBlob") : NULL;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-	if (in_format != NULL)
+  im_init (&env, qst, args, "IM CropImageBlob");
+  im_env_set_input_blob (&env, 0);
+  im_env_set_blob_ext (&env, 6, -1);
+  im_read (&env);
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
 	{
-		if (strlen(in_format) < 30)
-		{
-			strcpy(in_name, "image.");
-			strcat(in_name, in_format);
-			MagickSetFilename(magick_wand, in_name);
-		}
+      MagickCropImage (env.ime_magick_wand, width, height, x, y);
 	}
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_CropImageBlob cannot read blob");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    MagickCropImage(magick_wand, width, height, x, y);
+  res = im_write (&env);
+  im_leave (&env);
+  return res;
   }
-  image_blob = MagickGetImagesBlob(magick_wand, &length);
-  if (length != 0)
+
+caddr_t bif_im_CropAndResizeImageBlob(caddr_t * qst, caddr_t * err, state_slot_t ** args)
   {
-    res = dk_alloc_box (length, DV_BIN);
-    memcpy (res, image_blob, length);
-    MagickRelinquishMemory(image_blob);
-  }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  im_env_t env;
+  caddr_t res;
+  unsigned long width = bif_long_arg (qst, args, 2, "IM CropAndResizeImageBlob");
+  unsigned long height = bif_long_arg (qst, args, 3, "IM CropAndResizeImageBlob");
+  long x = bif_long_arg (qst, args, 4, "IM CropAndResizeImageBlob");
+  long y = bif_long_arg (qst, args, 5, "IM CropAndResizeImageBlob");
+  long h_size = bif_long_arg (qst, args, 6, "IM ResizeImageBlob");
+  long v_size = bif_long_arg (qst, args, 7, "IM ResizeImageBlob");
+  double blur = bif_double_arg (qst, args, 8, "IM ResizeImageBlob");
+  long filter = bif_long_arg (qst, args, 9, "IM ResizeImageBlob");
+  if (filter < 0 || filter > 15)
+    filter = PointFilter;
+  im_init (&env, qst, args, "IM CropAndResizeImageBlob");
+  im_env_set_input_blob (&env, 0);
+  im_env_set_blob_ext (&env, 10, -1);
+  im_read (&env);
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
+  {
+      MagickCropImage (env.ime_magick_wand, width, height, x, y);
+      MagickResizeImage (env.ime_magick_wand, h_size, v_size, filter, blur);
+  }
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 
 caddr_t bif_im_RotateImageFile (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  caddr_t new_file_name;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM RotateImageFile");
+  im_env_t env;
   double v_size = bif_double_arg (qst, args, 1, "IM RotateImageFile");
-  int n_args = BOX_ELEMENTS(args);
-  PixelWand *background;
-  if (n_args > 2)
-    new_file_name = bif_string_arg (qst, args, 2, "IM RotateImageFile");
-  else
-    new_file_name = bif_string_arg (qst, args, 0, "IM RotateImageFile");
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_RotateImageFile cannot open file");
-  }
-  background=NewPixelWand();
-  (void) PixelSetColor(background,"#000000");
-  if (status == MagickFalse)
-  {
-    DestroyPixelWand(background);
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_RotateImageFile cannot set color");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    MagickRotateImage(magick_wand, background, v_size);
-  }
-  if (new_file_name)
-    status=MagickWriteImages(magick_wand, new_file_name, MagickTrue);
-  else
-    status=MagickWriteImages(magick_wand, file_name, MagickTrue);
-  if (status == MagickFalse)
+  im_init (&env, qst, args, "IM RotateImageFile");
+  im_env_set_filenames (&env, 0, 2);
+  im_read (&env);
+  im_set_background (&env, "#000000");
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    DestroyPixelWand(background);
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_RotateImageFile cannot write image into file");
+    MagickRotateImage (env.ime_magick_wand, env.ime_background, v_size);
   }
-  magick_wand=DestroyMagickWand(magick_wand);
-  background=DestroyPixelWand(background);
-  mutex_leave (im_mutex);
+  im_write (&env);
+  im_leave (&env);
   return (0);
 }
 
 caddr_t bif_im_RotateImageFileToBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  size_t length = 0;
-  caddr_t res, image_blob;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM RotateImageFileToBlob");
+  im_env_t env;
+  caddr_t res;
   double v_size = bif_double_arg (qst, args, 1, "IM RotateImageFileToBlob");
-  int n_args = BOX_ELEMENTS(args);
-  PixelWand *background;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_RotateImageFileToBlob cannot open file");
-  }
-  background=NewPixelWand();
-  (void) PixelSetColor(background,"#000000");
-  if (status == MagickFalse)
-  {
-    DestroyPixelWand(background);
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_RotateImageFileToBlob cannot set color");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    MagickRotateImage(magick_wand, background, v_size);
-  }
-  image_blob = MagickGetImagesBlob(magick_wand, &length);
-  if (length != 0)
+  im_init (&env, qst, args, "IM RotateImageFileToBlob");
+  im_env_set_filenames (&env, 0, -1);
+  im_read (&env);
+  im_set_background (&env, "#000000");
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    res = dk_alloc_box (length, DV_BIN);
-    memcpy (res, image_blob, length);
-    MagickRelinquishMemory(image_blob);
+      MagickRotateImage (env.ime_magick_wand, env.ime_background, v_size);
   }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  background=DestroyPixelWand(background);
-  mutex_leave (im_mutex);
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 
 caddr_t bif_im_RotateImageBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  size_t length = 0;
-  caddr_t res, image_blob;
-	char in_name[64];
-  caddr_t blob = (caddr_t)bif_arg (qst, args, 0, "IM RotateImageBlob");
-  long blob_size = bif_long_arg (qst, args, 1, "IM RotateImageBlob");
+  im_env_t env;
+  caddr_t res;
   double v_size = bif_double_arg (qst, args, 2, "IM RotateImageBlob");
-  int n_args = BOX_ELEMENTS(args);
-  char* in_format = n_args > 3 ? bif_string_arg (qst, args, 3, "IM RotateImageBlob") : NULL;
-  PixelWand *background;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-	if (in_format != NULL)
-	{
-		if (strlen(in_format) < 30)
-		{
-			strcpy(in_name, "image.");
-			strcat(in_name, in_format);
-			MagickSetFilename(magick_wand, in_name);
-		}
-	}
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_RotateImageBlob cannot read blob");
-  }
-  background=NewPixelWand();
-  (void) PixelSetColor(background,"#000000");
-  if (status == MagickFalse)
-  {
-    DestroyPixelWand(background);
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_RotateImageBlob cannot set color");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    MagickRotateImage(magick_wand, background, v_size);
-  }
-  image_blob = MagickGetImagesBlob(magick_wand, &length);
-  if (length != 0)
-  {
-    res = dk_alloc_box (length, DV_BIN);
-    memcpy (res, image_blob, length);
-    MagickRelinquishMemory(image_blob);
-  }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  background=DestroyPixelWand(background);
-  mutex_leave (im_mutex);
+  im_init (&env, qst, args, "IM RotateImageBlob");
+  im_env_set_input_blob (&env, 0);
+  im_env_set_blob_ext (&env, 3, -1);
+  im_read (&env);
+  im_set_background (&env, "#000000");
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
+  {
+    MagickRotateImage (env.ime_magick_wand, env.ime_background, v_size);
+  }
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 
 caddr_t bif_im_ResampleImageFile (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  caddr_t new_file_name;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM ResampleImageFile");
+  im_env_t env;
   double v_size = bif_double_arg (qst, args, 1, "IM ResampleImageFile");
   double h_size = bif_double_arg (qst, args, 2, "IM ResampleImageFile");
   double blur = bif_double_arg (qst, args, 3, "IM ResampleImageFile");
   long filter = bif_long_arg (qst, args, 4, "IM ResampleImageFile");
-  int n_args = BOX_ELEMENTS(args);
   if (filter < 0 || filter > 15)
     filter = PointFilter;
-  if (n_args > 5)
-    new_file_name = bif_string_arg (qst, args, 5, "IM ResampleImageFile");
-  else
-    new_file_name = bif_string_arg (qst, args, 0, "IM ResampleImageFile");
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ResampleImageFile cannot open file");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    MagickResampleImage(magick_wand,v_size, h_size,filter,blur);
-  }
-  if (new_file_name)
-    status=MagickWriteImages(magick_wand, new_file_name, MagickTrue);
-  else
-    status=MagickWriteImages(magick_wand, file_name, MagickTrue);
-  if (status == MagickFalse)
+  im_init (&env, qst, args, "IM ResampleImageFile");
+  im_env_set_filenames (&env, 0, 5);
+  im_read (&env);
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ResampleImageFile cannot write image into file");
+      MagickResampleImage (env.ime_magick_wand,v_size, h_size,filter,blur);
   }
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  im_write (&env);
+  im_leave (&env);
   return(0);
 }
 
 caddr_t bif_im_ResampleImageFileToBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  size_t length = 0;
-  caddr_t res, image_blob;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM ResampleImageFileToBlob");
+  im_env_t env;
+  caddr_t res;
   double v_size = bif_double_arg (qst, args, 1, "IM ResampleImageFileToBlob");
   double h_size = bif_double_arg (qst, args, 2, "IM ResampleImageFileToBlob");
   double blur = bif_double_arg (qst, args, 3, "IM ResampleImageFileToBlob");
   long filter = bif_long_arg (qst, args, 4, "IM ResampleImageFileToBlob");
   if (filter < 0 || filter > 15)
     filter = PointFilter;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
+  im_init (&env, qst, args, "IM ResampleImageFileToBlob");
+  im_env_set_filenames (&env, 0, -1);
+  im_read (&env);
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ResampleImageFileToBlob cannot open file");
+    MagickResampleImage (env.ime_magick_wand,v_size, h_size,filter,blur);
   }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    MagickResampleImage(magick_wand,v_size, h_size,filter,blur);
-  }
-  image_blob = MagickGetImagesBlob(magick_wand, &length);
-  if (length != 0)
-  {
-    res = dk_alloc_box (length, DV_BIN);
-    memcpy (res, image_blob, length);
-    MagickRelinquishMemory(image_blob);
-  }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 
 caddr_t bif_im_ResampleImageBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  size_t length = 0;
-  caddr_t res, image_blob;
-	char in_name[64];
-  caddr_t blob = (caddr_t)bif_arg (qst, args, 0, "IM ResampleImageBlob");
-  long blob_size = bif_long_arg (qst, args, 1, "IM ResampleImageBlob");
+  im_env_t env;
+  caddr_t res;
   double v_size = bif_double_arg (qst, args, 2, "IM ResampleImageBlob");
   double h_size = bif_double_arg (qst, args, 3, "IM ResampleImageBlob");
   double blur = bif_double_arg (qst, args, 4, "IM ResampleImageBlob");
   long filter = bif_long_arg (qst, args, 5, "IM ResampleImageBlob");
-	int n_args = BOX_ELEMENTS(args);
-  char* in_format = n_args > 6 ? bif_string_arg (qst, args, 6, "IM ResampleImageBlob") : NULL;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-	if (in_format != NULL)
-	{
-		if (strlen(in_format) < 30)
-		{
-			strcpy(in_name, "image.");
-			strcat(in_name, in_format);
-			MagickSetFilename(magick_wand, in_name);
-		}
-	}
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ResampleImageBlob cannot read blob");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    MagickResampleImage(magick_wand,v_size, h_size,filter,blur);
-  }
-  image_blob = MagickGetImagesBlob(magick_wand, &length);
-  if (length != 0)
+  if (filter < 0 || filter > 15)
+    filter = PointFilter;
+  im_init (&env, qst, args, "IM ResampleImageBlob");
+  im_env_set_input_blob (&env, 0);
+  im_env_set_blob_ext (&env, 6, -1);
+  im_read (&env);
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    res = dk_alloc_box (length, DV_BIN);
-    memcpy (res, image_blob, length);
-    MagickRelinquishMemory(image_blob);
+    MagickResampleImage (env.ime_magick_wand,v_size, h_size,filter,blur);
   }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 
 
 caddr_t bif_im_ResizeImageFile (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  caddr_t new_file_name;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM ResizeImageFile");
+  im_env_t env;
   long v_size = bif_long_arg (qst, args, 1, "IM ResizeImageFile");
   long h_size = bif_long_arg (qst, args, 2, "IM ResizeImageFile");
   double blur = bif_double_arg (qst, args, 3, "IM ResizeImageFile");
   long filter = bif_long_arg (qst, args, 4, "IM ResizeImageFile");
-  int n_args = BOX_ELEMENTS(args);
-  if (n_args > 5)
-    new_file_name = bif_string_arg (qst, args, 5, "IM ResizeImageFile");
-  else
-    new_file_name = bif_string_arg (qst, args, 0, "IM ResiseImageFile");
   if (filter < 0 || filter > 15)
     filter = PointFilter;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ResizeImageFile cannot open file");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
+  im_init (&env, qst, args, "IM ResiseImageFile");
+  im_env_set_filenames (&env, 0, 5);
+  im_read (&env);
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    MagickResizeImage(magick_wand,v_size, h_size,filter,blur);
+    MagickResizeImage (env.ime_magick_wand,v_size, h_size,filter,blur);
   }
-  if (new_file_name)
-    status=MagickWriteImages(magick_wand, new_file_name, MagickTrue);
-  else
-    status=MagickWriteImages(magick_wand, file_name, MagickTrue);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ResizeImageFile cannot write image into file");
-  }
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  im_write (&env);
+  im_leave (&env);
   return(0);
 }
 
 caddr_t bif_im_ResizeImageFileToBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  size_t length = 0;
-  caddr_t res, image_blob;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM ResizeImageFileToBlob");
+  im_env_t env;
+  caddr_t res;
   long v_size = bif_long_arg (qst, args, 1, "IM ResizeImageFileToBlob");
   long h_size = bif_long_arg (qst, args, 2, "IM ResizeImageFileToBlob");
   double blur = bif_double_arg (qst, args, 3, "IM ResizeImageFileToBlob");
   long filter = bif_long_arg (qst, args, 4, "IM ResizeImageFileToBlob");
   if (filter < 0 || filter > 15)
     filter = PointFilter;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ResizeImageFileToBlob cannot open file");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    MagickResizeImage(magick_wand,v_size, h_size,filter,blur);
-  }
-  image_blob = MagickGetImagesBlob(magick_wand, &length);
-  if (length != 0)
+  im_init (&env, qst, args, "IM ResizeImageFileToBlob");
+  im_env_set_filenames (&env, 0, -1);
+  im_read (&env);
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    res = dk_alloc_box (length, DV_BIN);
-    memcpy (res, image_blob, length);
-    MagickRelinquishMemory(image_blob);
+    MagickResizeImage (env.ime_magick_wand,v_size, h_size,filter,blur);
   }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 
 caddr_t bif_im_ResizeImageBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  size_t length = 0;
-  caddr_t res, image_blob;
-	char in_name[64];
-  caddr_t blob = (caddr_t)bif_arg (qst, args, 0, "IM ResizeImageBlob");
-  long blob_size = bif_long_arg (qst, args, 1, "IM ResizeImageBlob");
+  im_env_t env;
+  caddr_t res;
   long v_size = bif_long_arg (qst, args, 2, "IM ResizeImageBlob");
   long h_size = bif_long_arg (qst, args, 3, "IM ResizeImageBlob");
   double blur = bif_double_arg (qst, args, 4, "IM ResizeImageBlob");
   long filter = bif_long_arg (qst, args, 5, "IM ResizeImageBlob");
-	int n_args = BOX_ELEMENTS(args);
-  char* in_format = n_args > 6 ? bif_string_arg (qst, args, 6, "IM ResizeImageBlob") : NULL;
   if (filter < 0 || filter > 15)
     filter = PointFilter;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-	if (in_format != NULL)
-	{
-		if (strlen(in_format) < 30)
-		{
-			strcpy(in_name, "image.");
-			strcat(in_name, in_format);
-			MagickSetFilename(magick_wand, in_name);
-		}
-	}
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ResizeImageBlob cannot open file");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    MagickResizeImage(magick_wand,v_size, h_size,filter,blur);
-  }
-  image_blob = MagickGetImagesBlob(magick_wand, &length);
-  if (length != 0)
+  im_init (&env, qst, args, "IM ResizeImageBlob");
+  im_env_set_input_blob (&env, 0);
+  im_env_set_blob_ext (&env, 6, -1);
+  im_read (&env);
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    res = dk_alloc_box (length, DV_BIN);
-    memcpy (res, image_blob, length);
-    MagickRelinquishMemory(image_blob);
+    MagickResizeImage (env.ime_magick_wand,v_size, h_size,filter,blur);
   }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 
 caddr_t bif_im_ThumbnailImageFile (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  caddr_t new_file_name;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM ThumbnailImageFile");
+  im_env_t env;
   long v_size = bif_long_arg (qst, args, 1, "IM ThumbnailImageFile");
   long h_size = bif_long_arg (qst, args, 2, "IM ThumbnailImageFile");
   long filter = bif_long_arg (qst, args, 3, "IM ThumbnailImageFile");
-  int n_args = BOX_ELEMENTS(args);
-  if (n_args > 4)
-    new_file_name = bif_string_arg (qst, args, 4, "IM ThumbnailImageFile");
-  else
-    new_file_name = bif_string_arg (qst, args, 0, "IM ThumbnailImageFile");
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ThumbnailImageFile cannot open file");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
+  im_init (&env, qst, args, "IM ThumbnailImageFile");
+  im_env_set_filenames (&env, 0, 4);
+  im_read (&env);
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    MagickResizeImage(magick_wand,v_size, h_size,filter,1.0);
-    MagickProfileImage(magick_wand, "*", NULL, 0);
+    MagickResizeImage (env.ime_magick_wand,v_size, h_size,filter,1.0);
+    MagickProfileImage (env.ime_magick_wand, "*", NULL, 0);
   }
-  if (new_file_name)
-    status=MagickWriteImages(magick_wand, new_file_name, MagickTrue);
-  else
-    status=MagickWriteImages(magick_wand, file_name, MagickTrue);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ThumbnailImageFile cannot write image into file");
-  }
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  im_write (&env);
+  im_leave (&env);
   return(0);
 }
 
 caddr_t bif_im_ThumbnailImageFileToBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  size_t length = 0;
-  caddr_t res, image_blob;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM ThumbnailImageFileToBlob");
+  im_env_t env;
+  caddr_t res;
   long v_size = bif_long_arg (qst, args, 1, "IM ThumbnailImageFileToBlob");
   long h_size = bif_long_arg (qst, args, 2, "IM ThumbnailImageFileToBlob");
   long filter = bif_long_arg (qst, args, 3, "IM ThumbnailImageFileToBlob");
-  int n_args = BOX_ELEMENTS(args);
   if (filter < 0 || filter > 15)
     filter = PointFilter;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
+  im_init (&env, qst, args, "IM ThumbnailImageFileToBlob");
+  im_env_set_filenames (&env, 0, -1);
+  im_read (&env);
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ThumbnailImageFileToBlob cannot open file");
+    MagickResizeImage (env.ime_magick_wand,v_size, h_size,filter,1.0);
+    MagickProfileImage (env.ime_magick_wand, "*", NULL, 0);
   }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    MagickResizeImage(magick_wand,v_size, h_size,filter,1.0);
-    MagickProfileImage(magick_wand, "*", NULL, 0);
-  }
-  image_blob = MagickGetImagesBlob(magick_wand, &length);
-  if (length != 0)
-  {
-    res = dk_alloc_box (length, DV_BIN);
-    memcpy (res, image_blob, length);
-    MagickRelinquishMemory(image_blob);
-  }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 
 caddr_t bif_im_ThumbnailImageBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  size_t length = 0;
-  caddr_t res, image_blob;
-	char in_name[64];
-  caddr_t blob = (caddr_t)bif_arg (qst, args, 0, "IM ThumbnailImageBlob");
-  long blob_size = bif_long_arg (qst, args, 1, "IM ThumbnailImageBlob");
+  im_env_t env;
+  caddr_t res;
   long v_size = bif_long_arg (qst, args, 2, "IM ThumbnailImageBlob");
   long h_size = bif_long_arg (qst, args, 3, "IM ThumbnailImageBlob");
   long filter = bif_long_arg (qst, args, 4, "IM ThumbnailImageBlob");
-	int n_args = BOX_ELEMENTS(args);
-  char* in_format = n_args > 5 ? bif_string_arg (qst, args, 5, "IM ThumbnailImageBlob") : NULL;
   if (filter < 0 || filter > 15)
     filter = PointFilter;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-	if (in_format != NULL)
-	{
-		if (strlen(in_format) < 30)
+  im_init (&env, qst, args, "IM ThumbnailImageBlob");
+  im_env_set_input_blob (&env, 0);
+  im_env_set_blob_ext (&env, 5, -1);
+  im_read (&env);
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
 		{
-			strcpy(in_name, "image.");
-			strcat(in_name, in_format);
-			MagickSetFilename(magick_wand, in_name);
+    MagickResizeImage (env.ime_magick_wand,v_size, h_size,filter,1.0);
+    MagickProfileImage (env.ime_magick_wand, "*", NULL, 0);
 		}
+  res = im_write (&env);
+  im_leave (&env);
+  return res;
 	}
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ThumbnailImageBlob cannot open file");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
-  {
-    MagickResizeImage(magick_wand,v_size, h_size,filter,1.0);
-    MagickProfileImage(magick_wand, "*", NULL, 0);
-  }
-  image_blob = MagickGetImagesBlob(magick_wand, &length);
-  if (length != 0)
+
+caddr_t bif_im_DeepZoom4to1 (caddr_t * qst, caddr_t * err, state_slot_t ** args)
   {
-    res = dk_alloc_box (length, DV_BIN);
-    memcpy (res, image_blob, length);
-    MagickRelinquishMemory(image_blob);
-  }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  im_env_t env;
+  caddr_t res;
+  int fmt_is_set = 0;
+  im_init (&env, qst, args, "IM DeepZoom4to1");
+  im_set_background (&env, "#000000");
+  env.ime_target_magick_wand = NewMagickWand ();
+  if (MagickFalse == MagickNewImage (env.ime_target_magick_wand, 256, 256, env.ime_background))
+    im_leave_with_error (&env, "22023", "IM001", "Can not make new image");
+  if (MagickFalse == MagickSetImageType (env.ime_target_magick_wand, TrueColorType))
+    im_leave_with_error (&env, "22023", "IM001", "Can not set image type");
+  if (MagickFalse == MagickSetImageDepth (env.ime_target_magick_wand, 16))
+    im_leave_with_error (&env, "22023", "IM001", "Can not set image depth");
+  if (MagickFalse == MagickSetImageExtent (env.ime_target_magick_wand, 256, 256))
+    im_leave_with_error (&env, "22023", "IM001", "Can not set image extent");
+  if (MagickFalse == MagickSetImageBackgroundColor (env.ime_target_magick_wand, env.ime_background))
+    im_leave_with_error (&env, "22023", "IM001", "Can not set image background");
+  int image_ctr = BOX_ELEMENTS (args) / 2;
+  if (image_ctr > 4)
+    image_ctr = 4;
+  while (0 < image_ctr--)
+    {
+      if (DV_DB_NULL == DV_TYPE_OF (bif_arg (qst, args, image_ctr*2, "IM DeepZoom4to1")))
+        continue;
+      im_env_set_input_blob (&env, image_ctr * 2);
+      /*im_env_set_blob_ext (&env, 2);*/
+      im_read (&env);
+      MagickResetIterator (env.ime_magick_wand);
+      while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
+        {
+          unsigned long v_size, h_size;
+          if (!fmt_is_set)
+            {
+              if (MagickFalse == MagickSetImageFormat (env.ime_target_magick_wand, MagickGetImageFormat (env.ime_magick_wand)))
+                im_leave_with_error (&env, "22023", "IM001", "Can not set image format");
+              fmt_is_set = 1;
+            }
+          h_size = MagickGetImageWidth (env.ime_magick_wand);
+          v_size = MagickGetImageHeight (env.ime_magick_wand);
+          if ((256 < h_size) || (256 < v_size))
+            continue;
+          MagickResizeImage (env.ime_magick_wand, h_size/2, v_size/2, BoxFilter, 1.0);
+          if (MagickFalse == MagickCompositeImage (env.ime_target_magick_wand, env.ime_magick_wand, OverCompositeOp, (image_ctr & 1) * 128, (image_ctr & 2) * 64))
+            im_leave_with_error (&env, "22023", "IM001", "Can not composite image");
+        }
+      im_reset_read (&env);
+    }
+  MagickProfileImage (env.ime_target_magick_wand, "*", NULL, 0);
+  DestroyMagickWand (env.ime_magick_wand);
+  env.ime_magick_wand = env.ime_target_magick_wand;
+  env.ime_target_magick_wand = NULL;
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 
@@ -1143,10 +752,8 @@ caddr_t bif_im_ThumbnailImageBlob (caddr_t * qst, caddr_t * err, state_slot_t **
 caddr_t 
 bif_im_AnnotateImageBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  size_t length = 0;
   char * szMe = "IM AnnotateImageBlob";
-  caddr_t res, image_blob;
-	char in_name[64];
+  caddr_t res;
   caddr_t blob = (caddr_t)bif_arg (qst, args, 0, szMe);
   long blob_size = box_length (blob) - 1;
   long x_pos = bif_long_arg (qst, args, 1, szMe);
@@ -1156,69 +763,30 @@ bif_im_AnnotateImageBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
   long angle = n_args > 4 ? bif_long_arg (qst, args, 4, szMe) : 0;
   long f_size = n_args > 5 ? bif_long_arg (qst, args, 5, szMe) : 12;
   char *text_color = n_args > 6 ? bif_string_arg (qst, args, 6, szMe) : "black" ;
-  char* in_format = n_args > 7 ? bif_string_arg (qst, args, 7, szMe) : NULL;
-  DrawingWand *drawing_wand;
-  PixelWand *pixel_wand;
   dtp_t dtp = DV_TYPE_OF (blob);
-
+  im_init (&env, qst, args, "IM AnnotateImageBlob");
   if (IS_STRING_DTP (dtp))
     blob_size = box_length (blob) - 1;
   else if (dtp == DV_BIN)
     blob_size = box_length (blob);
   else
+    im_leave_with_error (&env, "22023", "IM001", "AnnotateImageBlob needs string or binary as 1-st argument");
+  im_env_set_blob_ext (&env, 7, -1);
+
+  env.ime_drawing_wand = NewDrawingWand ();
+  im_read (&env);
+  im_set_background (&env, text_color);
+  DrawSetFillColor (env.ime_drawing_wand, env.ime_background);
+  DrawSetFontSize (env.ime_drawing_wand, f_size);
+  MagickResetIterator  (env.ime_magick_wand);
+  while (MagickNextImage  (env.ime_magick_wand) != MagickFalse)
     {
-      sqlr_new_error ("22023", "IM001", "AnnotateImageBlob needs string or binary as 1-st argument");
-    }
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  drawing_wand = NewDrawingWand ();
-  pixel_wand = NewPixelWand();
-	if (in_format != NULL)
-	{
-		if (strlen(in_format) < 30)
-		{
-			strcpy(in_name, "image.");
-			strcat(in_name, in_format);
-			MagickSetFilename(magick_wand, in_name);
-		}
-	}
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
-    {
-      WandExitMacroExt(magick_wand, drawing_wand, pixel_wand);
-      sqlr_new_error ("22023", "IM001", "Cannot open file");
-    }
-  status = PixelSetColor (pixel_wand, text_color);   
-  if (status == MagickFalse)
-    {
-      WandExitMacroExt(magick_wand, drawing_wand, pixel_wand);
-      sqlr_new_error ("22023", "IM001", "Cannot set color");
-    }
-  DrawSetFillColor (drawing_wand , pixel_wand);
-  DrawSetFontSize (drawing_wand, f_size);
-  MagickResetIterator (magick_wand);
-  while (MagickNextImage (magick_wand) != MagickFalse)
-    {
-      status = MagickAnnotateImage (magick_wand, drawing_wand, x_pos, y_pos, angle, text);
-      if (status == MagickFalse)
-	{
-	  WandExitMacroExt(magick_wand, drawing_wand, pixel_wand);
-	  sqlr_new_error ("22023", "IM001", "Cannot annotate image");
-	}
-    }
-  image_blob = MagickGetImagesBlob(magick_wand, &length);
-  if (length != 0)
-    {
-      res = dk_alloc_box (length, DV_BIN);
-      memcpy (res, image_blob, length);
-      MagickRelinquishMemory(image_blob);
+      env.ime_status = MagickAnnotateImage  (env.ime_magick_wand, env.ime_drawing_wand, x_pos, y_pos, angle, text);
+      if (env.ime_status == MagickFalse)
+        im_leave_with_error (&env, "22023", "IM001", "Cannot annotate image");
     }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  drawing_wand = DestroyDrawingWand (drawing_wand);
-  pixel_wand = DestroyPixelWand(pixel_wand);
-  mutex_leave (im_mutex);
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 #endif
@@ -1226,161 +794,96 @@ bif_im_AnnotateImageBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 caddr_t 
 bif_im_CreateImageBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  size_t length = 0;
+  im_env_t env;
   char * szMe = "IM CreateImageBlob";
-  caddr_t res, image_blob;
+  caddr_t res;
   long x_size = bif_long_arg (qst, args, 0, szMe);
   long y_size = bif_long_arg (qst, args, 1, szMe);
   caddr_t bg_color = (caddr_t)bif_string_arg (qst, args, 2, szMe);
   caddr_t fmt = (caddr_t)bif_string_arg (qst, args, 3, szMe);
-
-  PixelWand *pixel_wand;
-
+  im_init (&env, qst, args, "IM CreateImageBlob");
   if (x_size <= 0 || y_size <= 0)
-    {
-      sqlr_new_error ("22023", "IM001", "Negative image size");
-    }
-
+    im_leave_with_error (&env, "22023", "IM001", "Negative image size");
   if (x_size*y_size > 3333279) /* 10M / 3 color - 54byte */
-    sqlr_new_error ("22023", "IM001", "Too large image image size requested");
-
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  pixel_wand = NewPixelWand();
-
-  status = PixelSetColor( pixel_wand, bg_color );   
-  if (status == MagickFalse)
-    {
-      WandExitMacroExt(magick_wand, NULL, pixel_wand);
-      sqlr_new_error ("22023", "IM001", "Cannot set color");
-    }
-  status = MagickNewImage (magick_wand, x_size, y_size, pixel_wand);
-  if (status == MagickFalse)
-    {
-      WandExitMacroExt(magick_wand, NULL, pixel_wand);
-      sqlr_new_error ("22023", "IM001", "Cannot create image");
-    }
-  status = MagickSetImageFormat(magick_wand, fmt);
-  if (status == MagickFalse)
-    {
-      WandExitMacroExt(magick_wand, NULL, pixel_wand);
-      sqlr_new_error ("22023", "IM001", "Cannot set image format");
-    }
-  image_blob = MagickGetImagesBlob (magick_wand, &length);
-  if (length != 0)
-    {
-      res = dk_alloc_box (length, DV_BIN);
-      memcpy (res, image_blob, length);
-      MagickRelinquishMemory(image_blob);
-    }
-  else
-    res = NEW_DB_NULL;
-  magick_wand = DestroyMagickWand (magick_wand);
-  pixel_wand = DestroyPixelWand (pixel_wand);
-  mutex_leave (im_mutex);
+    im_leave_with_error (&env, "22023", "IM001", "Too large image image size requested");
+  im_set_background (&env, bg_color);
+  env.ime_status = MagickNewImage (env.ime_magick_wand, x_size, y_size, env.ime_background);
+  if (env.ime_status == MagickFalse)
+    im_leave_with_error (&env, "22023", "IM001", "Cannot create image");
+  env.ime_status = MagickSetImageFormat (env.ime_magick_wand, fmt);
+  if (env.ime_status == MagickFalse)
+    im_leave_with_error (&env, "22023", "IM001", "Cannot set image format");
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 
 caddr_t bif_im_ConvertImageBlob (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  size_t length = 0;
-  caddr_t res, image_blob;
-	char in_name[64];
+  im_env_t env;
+  caddr_t res;
         char out_name[64];
-  caddr_t blob = (caddr_t)bif_arg (qst, args, 0, "IM ConvertImageBlob");
-  long blob_size = bif_long_arg (qst, args, 1, "IM ConvertImageBlob");
   caddr_t format = bif_string_arg (qst, args, 2, "IM ConvertImageBlob");
-	int n_args = BOX_ELEMENTS(args);
-  char* in_format = n_args > 3 ? bif_string_arg (qst, args, 3, "IM ConvertImageBlob") : NULL;
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-	if (in_format != NULL)
-	{
-		if (strlen(in_format) < 30)
-		{
-			strcpy(in_name, "image.");
-			strcat(in_name, in_format);
-			MagickSetFilename(magick_wand, in_name);
-		}
+  im_init (&env, qst, args, "IM ConvertImageBlob");
+  im_env_set_input_blob (&env, 0);
+  im_env_set_blob_ext (&env, 3, -1);
+  im_read (&env);
+
+        if (env.ime_input_ext != NULL)
+        {
                 if (strlen(format) < 30)
                 {
                         strcpy(out_name, "image.");                                                                                                                                                               
                         strcat(out_name, format);                                                                                                                                                              
                 }
 	}
-  status=MagickReadImageBlob(magick_wand, (const void *)blob, (const size_t)blob_size);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ConvertImageBlob cannot read the blob");
-  }
-  MagickResetIterator(magick_wand);
-  while (MagickNextImage(magick_wand) != MagickFalse)
+  MagickResetIterator (env.ime_magick_wand);
+  while (MagickNextImage (env.ime_magick_wand) != MagickFalse)
   {
-    status = MagickSetImageFormat(magick_wand,format);
-    MagickSetFilename(magick_wand, out_name);
-    if (status == MagickFalse)
-    {
-        WandExitMacro(magick_wand);
-        sqlr_new_error ("22023", "IM001", "bif_im_ConvertImageBlob cannot convert image");
-        return;
+    env.ime_status = MagickSetImageFormat (env.ime_magick_wand, format);
+    MagickSetFilename (env.ime_magick_wand, out_name);
+    if (env.ime_status == MagickFalse)
+      im_leave_with_error (&env, "22023", "IM001", "bif_im_ConvertImageBlob cannot convert image");
     }
-  }
-  /*MagickResetIterator(magick_wand);
-  if (out_name)                                                                                              
-    status=MagickWriteImages(magick_wand, out_name, MagickTrue);
-  */
-  image_blob = MagickGetImageBlob(magick_wand, &length);
-  if (length != 0)
-  {
-    res = dk_alloc_box (length, DV_BIN);
-    memcpy (res, image_blob, length);
-    MagickRelinquishMemory(image_blob);
-  }
-  else
-    res = NEW_DB_NULL;
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
+  res = im_write (&env);
+  im_leave (&env);
   return res;
 }
 
 
 caddr_t bif_im_ConvertImageFile (caddr_t * qst, caddr_t * err, state_slot_t ** args)
 {
-  caddr_t new_file_name;
-  caddr_t file_name = bif_string_arg (qst, args, 0, "IM ConvertImageFile");
-  int n_args = BOX_ELEMENTS(args);
-  if (n_args > 1)
-    new_file_name = bif_string_arg (qst, args, 1, "IM ConvertImageFile");
-  else
-  {
-    sqlr_new_error ("22023", "IM001", "bif_im_ConvertImageFile cannot find the new file name");
-    return 0;
-  }
-  mutex_enter (im_mutex);
-  magick_wand=NewMagickWand();
-  status=MagickReadImage(magick_wand, file_name);
-  if (status == MagickFalse)
-  {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ConvertImageFile cannot open file");
+  im_env_t env;
+  bif_string_arg (qst, args, 1, "IM ConvertImageFile");
+  im_init (&env, qst, args, "IM ConvertImageFile");
+  im_env_set_filenames (&env, 0, 1);
+  im_read (&env);
+  im_write (&env);
+  im_leave (&env);
+  return(0);
   }
-  if (new_file_name)
-    status=MagickWriteImages(magick_wand, new_file_name, MagickTrue);
-  if (status == MagickFalse)
+
+caddr_t
+bif_im_XY_to_Morton (caddr_t * qst, caddr_t * err, state_slot_t ** args)
   {
-    WandExitMacro(magick_wand);
-    sqlr_new_error ("22023", "IM001", "bif_im_ConvertImageFile cannot write image into file");
+  int x = bif_long_range_arg (qst, args, 0, "IM XYtoMorton", 0, 0x7fffffff);
+  int y = bif_long_range_arg (qst, args, 1, "IM XYtoMorton", 0, 0x7fffffff);
+  int i = 0, morton = 0;
+  while (x || y)
+    {
+      morton |= (x & 1) << (i++);
+      morton |= (y & 1) << (i++);
+      x >>= 1;
+      y >>= 1;
   }
-  magick_wand=DestroyMagickWand(magick_wand);
-  mutex_leave (im_mutex);
-  return(0);
+  return box_num (morton);
 }
 
+
 void im_connect (void *appdata)
 {
   im_IMVERSION = box_dv_short_string (IM_VERSION);
-  im_mutex = mutex_allocate ();
+  im_lib_mutex = mutex_allocate ();
 
   bif_define ("IM ResizeImageFile", bif_im_ResizeImageFile);
   bif_define ("IM ThumbnailImageFile", bif_im_ThumbnailImageFile);
@@ -1396,6 +899,7 @@ void im_connect (void *appdata)
   bif_define ("IM GetImageFileWidth", bif_im_GetImageFileWidth);
   bif_define ("IM GetImageFileHeight", bif_im_GetImageFileHeight);
   bif_define ("IM GetImageFileDepth", bif_im_GetImageFileDepth);
+  bif_define ("IM GetImageFileWH", bif_im_GetImageFileWH);
 
   bif_define ("IM ResizeImageFileToBlob", bif_im_ResizeImageFileToBlob);
   bif_define ("IM ThumbnailImageFileToBlob", bif_im_ThumbnailImageFileToBlob);
@@ -1407,18 +911,21 @@ void im_connect (void *appdata)
   bif_define ("IM GetImageBlobWidth", bif_im_GetImageBlobWidth);
   bif_define ("IM GetImageBlobHeight", bif_im_GetImageBlobHeight);
   bif_define ("IM GetImageBlobDepth", bif_im_GetImageBlobDepth);
+  bif_define ("IM GetImageBlobWH", bif_im_GetImageBlobWH);
 
   bif_define ("IM ConvertImageBlob", bif_im_ConvertImageBlob);
   bif_define ("IM ResizeImageBlob", bif_im_ResizeImageBlob);
   bif_define ("IM ThumbnailImageBlob", bif_im_ThumbnailImageBlob);
+  bif_define ("IM DeepZoom4to1", bif_im_DeepZoom4to1);
   bif_define ("IM ResampleImageBlob", bif_im_ResampleImageBlob);
   bif_define ("IM RotateImageBlob", bif_im_RotateImageBlob);
   bif_define ("IM CropImageBlob", bif_im_CropImageBlob);
+  bif_define ("IM CropAndResizeImageBlob", bif_im_CropAndResizeImageBlob);
 #if defined(HasTTF) || defined(HasFREETYPE)
   bif_define ("IM AnnotateImageBlob", bif_im_AnnotateImageBlob);
 #endif
   bif_define ("IM CreateImageBlob", bif_im_CreateImageBlob);
-
+  bif_define ("IM XYtoMorton", bif_im_XY_to_Morton);
   MagickWandGenesis();
 }
 
diff --git a/binsrc/samples/odp/Makefile.in b/binsrc/samples/odp/Makefile.in
index dcd06e3..10d9c25 100644
--- a/binsrc/samples/odp/Makefile.in
+++ b/binsrc/samples/odp/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/samples/sparql_demo/Makefile.in b/binsrc/samples/sparql_demo/Makefile.in
index b08bb56..c28dc65 100644
--- a/binsrc/samples/sparql_demo/Makefile.in
+++ b/binsrc/samples/sparql_demo/Makefile.in
@@ -184,6 +184,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/samples/sparql_demo/make_vad.sh b/binsrc/samples/sparql_demo/make_vad.sh
index a71378f..1fc88a9 100755
--- a/binsrc/samples/sparql_demo/make_vad.sh
+++ b/binsrc/samples/sparql_demo/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.16.2.1 2010/01/07 16:58:12 source Exp $
+#  $Id: make_vad.sh,v 1.16.2.2 2011/02/03 10:37:51 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -269,7 +269,7 @@ sticker_init() {
     echo "  <name package=\"SPARQL Demo\">" >> $STICKER
     echo "    <prop name=\"Title\" value=\"SPARQL Demo\"/>" >> $STICKER
     echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-    echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+    echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
     echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
     echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
     echo "  </name>" >> $STICKER
diff --git a/binsrc/samples/wbxml2/Makefile.in b/binsrc/samples/wbxml2/Makefile.in
index 459cc29..1f86736 100644
--- a/binsrc/samples/wbxml2/Makefile.in
+++ b/binsrc/samples/wbxml2/Makefile.in
@@ -208,6 +208,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/samples/webapp/Makefile.in b/binsrc/samples/webapp/Makefile.in
index da9f3b0..64128f1 100644
--- a/binsrc/samples/webapp/Makefile.in
+++ b/binsrc/samples/webapp/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/samples/xpath/Makefile.in b/binsrc/samples/xpath/Makefile.in
index 056e486..ddd7a62 100644
--- a/binsrc/samples/xpath/Makefile.in
+++ b/binsrc/samples/xpath/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/samples/xquery/Makefile.in b/binsrc/samples/xquery/Makefile.in
index 5188561..d8d7e55 100644
--- a/binsrc/samples/xquery/Makefile.in
+++ b/binsrc/samples/xquery/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/sesame/Makefile.in b/binsrc/sesame/Makefile.in
index c80f7d3..596f264 100644
--- a/binsrc/sesame/Makefile.in
+++ b/binsrc/sesame/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/sesame2/Makefile.am b/binsrc/sesame2/Makefile.am
index 9e0a791..3e20d11 100644
--- a/binsrc/sesame2/Makefile.am
+++ b/binsrc/sesame2/Makefile.am
@@ -61,8 +61,8 @@ install-data-local:
 	-cp $(SESAME_XSL) "$(DESTDIR)${libdir}/sesame"
 
 lib:
-	@test -d lib || touch virt_sesame2.jar
 	-mkdir lib
+	-touch -c virt_sesame2.jar
 	@echo "Please refer to ~/README.sesame2 file for missing .jar files"
 
 
@@ -106,8 +106,14 @@ run-tests:
 endif
 
 
+.PHONY: version
+version: virt_sesame2.jar
+	$(JAVA) -jar virt_sesame2.jar
+
+
 clean-local:
 	-rm -rf out.driver out.examples doc
+	-rmdir lib
 
 # ----------------------------------------------------------------------
 #
diff --git a/binsrc/sesame2/Makefile.in b/binsrc/sesame2/Makefile.in
index c7eeb90..b2229e7 100644
--- a/binsrc/sesame2/Makefile.in
+++ b/binsrc/sesame2/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
@@ -505,8 +506,8 @@ install-data-local:
 	-cp $(SESAME_XSL) "$(DESTDIR)${libdir}/sesame"
 
 lib:
-	@test -d lib || touch virt_sesame2.jar
 	-mkdir lib
+	-touch -c virt_sesame2.jar
 	@echo "Please refer to ~/README.sesame2 file for missing .jar files"
 
 virt_sesame2.jar: $(SESAME_SRC) manifest.main
@@ -543,8 +544,13 @@ doc:
 @WITH_JDK4_FALSE at run-tests:
 @WITH_JDK4_FALSE@	@echo "***WARNING: Disabled Sesame2 test suite"
 
+.PHONY: version
+version: virt_sesame2.jar
+	$(JAVA) -jar virt_sesame2.jar
+
 clean-local:
 	-rm -rf out.driver out.examples doc
+	-rmdir lib
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/binsrc/sesame2/virtuoso_driver/Version.java b/binsrc/sesame2/virtuoso_driver/Version.java
index 2ae42a1..7536e17 100644
--- a/binsrc/sesame2/virtuoso_driver/Version.java
+++ b/binsrc/sesame2/virtuoso_driver/Version.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: Version.java,v 1.1.4.2 2010/07/05 12:41:21 source Exp $
+ *  $Id: Version.java,v 1.1.4.4 2011/03/23 11:59:00 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -29,7 +29,7 @@ public class Version {
    protected static final String DRV_VER = "2.3.1";
 
    // The major and minor version number
-   protected static final String build_id = "1.1";
+   protected static final String build_id = "1.3";
 
    public static void main(String args[])
    {
diff --git a/binsrc/sesame2/virtuoso_driver/VirtuosoRepositoryConnection.java b/binsrc/sesame2/virtuoso_driver/VirtuosoRepositoryConnection.java
index 4cd9ee0..d240ba9 100644
--- a/binsrc/sesame2/virtuoso_driver/VirtuosoRepositoryConnection.java
+++ b/binsrc/sesame2/virtuoso_driver/VirtuosoRepositoryConnection.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtuosoRepositoryConnection.java,v 1.33.2.12 2010/07/05 12:41:21 source Exp $
+ *  $Id: VirtuosoRepositoryConnection.java,v 1.33.2.13 2011/03/23 11:59:00 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -1834,19 +1834,16 @@ public class VirtuosoRepositoryConnection implements RepositoryConnection {
 	{
 		StringTokenizer tok = new StringTokenizer(query);
 		String s = "";
+		StringBuffer ret = new StringBuffer("sparql\n ");
 
-/*****
 		while(tok.hasMoreTokens()) {
 		    s = tok.nextToken().toLowerCase();
 		    if (s.equals("describe") || s.equals("construct") || s.equals("ask") || s.equals("select")) 
 			break;
 		}
 
-		StringBuffer ret = new StringBuffer("sparql\n ");
 		if (s.equals("describe") || s.equals("construct") || s.equals("ask")) 
 			ret.append("define output:format '_JAVA_'\n ");
-*******/
-		StringBuffer ret = new StringBuffer("sparql\n ");
 
 		if (includeInferred && repository.ruleSet!=null && repository.ruleSet.length() > 0)
 		  ret.append("define input:inference '"+repository.ruleSet+"'\n ");
diff --git a/binsrc/sesame3/META-INF/org.openrdf.repository.templates b/binsrc/sesame3/META-INF/org.openrdf.repository.templates
new file mode 100644
index 0000000..99d5c7a
--- /dev/null
+++ b/binsrc/sesame3/META-INF/org.openrdf.repository.templates
@@ -0,0 +1 @@
+META-INF/templates/virtuoso.ttl
\ No newline at end of file
diff --git a/binsrc/sesame3/META-INF/org.openrdf.store.schemas b/binsrc/sesame3/META-INF/org.openrdf.store.schemas
new file mode 100644
index 0000000..2ab54a1
--- /dev/null
+++ b/binsrc/sesame3/META-INF/org.openrdf.store.schemas
@@ -0,0 +1 @@
+META-INF/schemas/virtuoso-schema.ttl
\ No newline at end of file
diff --git a/binsrc/sesame3/META-INF/schemas/virtuoso-schema.ttl b/binsrc/sesame3/META-INF/schemas/virtuoso-schema.ttl
new file mode 100644
index 0000000..a91bc65
--- /dev/null
+++ b/binsrc/sesame3/META-INF/schemas/virtuoso-schema.ttl
@@ -0,0 +1,49 @@
+#
+# Sesame configuration schema for remote RDF Repositories
+#
+ at prefix xsd: <http://www.w3.org/ 2001/XMLSchema#>.
+ at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
+ at prefix rep: <http://www.openrdf.org/config/repository#>.
+ at prefix vr: <http://www.openrdf.org/config/repository/virtuoso#>.
+
+
+vr:hostList a rdf:Property ;
+	rdfs:label "Host List"@en ;
+	rdfs:comment "Location of the Virtuoso server like: localhost:1111"@en ;
+	rdfs:range xsd:string .
+
+vr:username a rdf:Property ;
+	rdfs:label "Username"@en ;
+	rdfs:comment "Authentication username."@en ;
+	rdfs:range xsd:string .
+
+vr:password a rdf:Property ;
+	rdfs:label "Password"@en ;
+	rdfs:comment "Authentication password"@en ;
+	rdfs:range xsd:string .
+
+vr:defGraph a rdf:Property ;
+	rdfs:label "Default graph name"@en ;
+	rdfs:comment "Default graph name"@en ;
+	rdfs:range xsd:string .
+
+vr:useLazyAdd a rdf:Property ;
+	rdfs:label "Enable using batch optimization"@en ;
+	rdfs:comment "Enable using batch optimization"@en ;
+	rdfs:range xsd:boolean .
+
+vr:roundRobin a rdf:Property ;
+	rdfs:label "Use RoundRobin for connection"@en ;
+	rdfs:comment "Use RoundRobin for connection"@en ;
+	rdfs:range xsd:boolean .
+
+vr:fetchSize a rdf:Property ;
+	rdfs:label "Buffer fetch size"@en ;
+	rdfs:comment "Buffer fetch size"@en ;
+	rdfs:range xsd:nonNegativeInteger .
+
+vr:ruleSet a rdf:Property ;
+	rdfs:label "Inference RuleSet name"@en ;
+	rdfs:comment "Inference RuleSet name"@en ;
+	rdfs:range xsd:string .
diff --git a/binsrc/sesame3/META-INF/services/org.openrdf.repository.config.RepositoryFactory b/binsrc/sesame3/META-INF/services/org.openrdf.repository.config.RepositoryFactory
new file mode 100644
index 0000000..473fbff
--- /dev/null
+++ b/binsrc/sesame3/META-INF/services/org.openrdf.repository.config.RepositoryFactory
@@ -0,0 +1 @@
+virtuoso.sesame3.driver.config.VirtuosoRepositoryFactory
diff --git a/binsrc/sesame3/META-INF/templates/virtuoso.ttl b/binsrc/sesame3/META-INF/templates/virtuoso.ttl
new file mode 100644
index 0000000..723ef4b
--- /dev/null
+++ b/binsrc/sesame3/META-INF/templates/virtuoso.ttl
@@ -0,0 +1,22 @@
+#
+# Sesame configuration template for a virtuoso repository
+#
+
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
+ at prefix rep: <http://www.openrdf.org/config/repository#>.
+ at prefix vr: <http://www.openrdf.org/config/repository/virtuoso#>.
+
+[] a rep:Repository ;
+   rep:repositoryID "virtuoso" ;
+   rep:repositoryTitle "Virtuoso repository" ;
+   rep:repositoryImpl [
+      rep:repositoryType "openrdf:VirtuosoRepository" ;
+      vr:hostList "localhost:1111" ;
+      vr:username "dba" ;
+      vr:password "dba" ;
+      vr:defGraph "sesame:nil" ;
+      vr:useLazyAdd false ;
+      vr:roundRobin false ;
+      vr:fetchSize 200 ;
+      vr:ruleSet "null"
+   ].
diff --git a/binsrc/sesame3/Makefile.am b/binsrc/sesame3/Makefile.am
index 506ccbf..a6118b8 100644
--- a/binsrc/sesame3/Makefile.am
+++ b/binsrc/sesame3/Makefile.am
@@ -57,8 +57,8 @@ install-data-local:
 	-cp virt_sesame3.jar "$(DESTDIR)${libdir}/sesame"
 
 lib:
-	@test -d lib || touch virt_sesame3.jar
 	-mkdir lib
+	-touch -c virt_sesame3.jar
 	@echo "Please refer to ~/README.sesame3 file for missing .jar files"
 
 
@@ -103,8 +103,15 @@ run-tests:
 endif
 
 
+.PHONY: version
+version: virt_sesame3.jar
+	$(JAVA) -jar virt_sesame3.jar
+
+
 clean-local:
 	-rm -rf out.driver out.examples doc
+	-rmdir lib
+
 
 # ----------------------------------------------------------------------
 #
@@ -112,7 +119,12 @@ clean-local:
 #
 # ----------------------------------------------------------------------
 EXTRA_DIST = \
-	virtuoso_driver/*.java \
-	virtuoso_driver/data.nt \
 	manifest.main \
-	virt_sesame3.jar
+	META-INF/org.openrdf.repository.templates \
+	META-INF/org.openrdf.store.schemas \
+	META-INF/schemas/virtuoso-schema.ttl \
+	META-INF/services/org.openrdf.repository.config.RepositoryFactory \
+	META-INF/templates/virtuoso.ttl \
+	virt_sesame3.jar \
+	virtuoso_driver/data.nt \
+	virtuoso_driver/*.java
diff --git a/binsrc/sesame3/Makefile.in b/binsrc/sesame3/Makefile.in
index c2df04f..138921a 100644
--- a/binsrc/sesame3/Makefile.in
+++ b/binsrc/sesame3/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
@@ -300,10 +301,15 @@ SESAME_CLASSPATH = lib/slf4j-api-1.5.6.jar:lib/openrdf-sesame-3.0-alpha1-onejar.
 #
 # ----------------------------------------------------------------------
 EXTRA_DIST = \
-	virtuoso_driver/*.java \
-	virtuoso_driver/data.nt \
 	manifest.main \
-	virt_sesame3.jar
+	META-INF/org.openrdf.repository.templates \
+	META-INF/org.openrdf.store.schemas \
+	META-INF/schemas/virtuoso-schema.ttl \
+	META-INF/services/org.openrdf.repository.config.RepositoryFactory \
+	META-INF/templates/virtuoso.ttl \
+	virt_sesame3.jar \
+	virtuoso_driver/data.nt \
+	virtuoso_driver/*.java
 
 all: all-am
 
@@ -498,8 +504,8 @@ install-data-local:
 	-cp virt_sesame3.jar "$(DESTDIR)${libdir}/sesame"
 
 lib:
-	@test -d lib || touch virt_sesame3.jar
 	-mkdir lib
+	-touch -c virt_sesame3.jar
 	@echo "Please refer to ~/README.sesame3 file for missing .jar files"
 
 virt_sesame3.jar: $(SESAME_SRC) manifest.main
@@ -537,8 +543,13 @@ doc:
 @WITH_JDK4_FALSE at run-tests:
 @WITH_JDK4_FALSE@	@echo "***WARNING: Disabled Sesame3 test suite"
 
+.PHONY: version
+version: virt_sesame3.jar
+	$(JAVA) -jar virt_sesame3.jar
+
 clean-local:
 	-rm -rf out.driver out.examples doc
+	-rmdir lib
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/binsrc/sesame3/virtuoso_driver/Version.java b/binsrc/sesame3/virtuoso_driver/Version.java
index e94942d..616e14f 100644
--- a/binsrc/sesame3/virtuoso_driver/Version.java
+++ b/binsrc/sesame3/virtuoso_driver/Version.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: Version.java,v 1.1.4.2 2010/07/05 12:42:23 source Exp $
+ *  $Id: Version.java,v 1.1.4.4 2011/03/23 11:59:31 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -29,7 +29,7 @@ public class Version {
    protected static final String DRV_VER = "3.0-alpha";
 
    // The major and minor version number
-   protected static final String build_id = "1.1";
+   protected static final String build_id = "1.3";
 
    public static void main(String args[])
    {
diff --git a/binsrc/sesame3/virtuoso_driver/VirtuosoRepository.java b/binsrc/sesame3/virtuoso_driver/VirtuosoRepository.java
index 883515a..0411d80 100644
--- a/binsrc/sesame3/virtuoso_driver/VirtuosoRepository.java
+++ b/binsrc/sesame3/virtuoso_driver/VirtuosoRepository.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtuosoRepository.java,v 1.1.2.7 2010/06/28 10:32:02 source Exp $
+ *  $Id: VirtuosoRepository.java,v 1.1.2.8 2010/11/22 14:29:09 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -27,9 +27,11 @@ import java.io.File;
 import java.sql.DriverManager;
 import java.sql.SQLException;
 
+import org.openrdf.model.BNodeFactory;
 import org.openrdf.model.ValueFactory;
 import org.openrdf.model.URIFactory;
 import org.openrdf.model.LiteralFactory;
+import org.openrdf.model.impl.BNodeFactoryImpl;
 import org.openrdf.model.impl.ValueFactoryImpl;
 import org.openrdf.model.impl.LiteralFactoryImpl;
 import org.openrdf.model.impl.URIFactoryImpl;
@@ -57,6 +59,7 @@ public class VirtuosoRepository implements Repository {
 	
 	private URIFactory uf = new URIFactoryImpl();
 	private LiteralFactory lf = new LiteralFactoryImpl();
+	private BNodeFactory bf = new BNodeFactoryImpl();
 
 	File dataDir;
 	
@@ -376,7 +379,7 @@ public class VirtuosoRepository implements Repository {
 	 */
 	@Deprecated
 	public ValueFactory getValueFactory() {
-		return new ValueFactoryImpl(uf, lf);
+		return new ValueFactoryImpl(bf, uf, lf);
 	}
 
 	/**
diff --git a/binsrc/sesame3/virtuoso_driver/VirtuosoRepositoryConnection.java b/binsrc/sesame3/virtuoso_driver/VirtuosoRepositoryConnection.java
index 1d04433..dfbc96c 100644
--- a/binsrc/sesame3/virtuoso_driver/VirtuosoRepositoryConnection.java
+++ b/binsrc/sesame3/virtuoso_driver/VirtuosoRepositoryConnection.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtuosoRepositoryConnection.java,v 1.1.2.9 2010/07/05 12:42:23 source Exp $
+ *  $Id: VirtuosoRepositoryConnection.java,v 1.1.2.10 2011/03/23 11:59:31 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -2391,21 +2391,17 @@ public class VirtuosoRepositoryConnection implements RepositoryConnection {
 	{
 		StringTokenizer tok = new StringTokenizer(query);
 		String s = "";
+		StringBuffer ret = new StringBuffer("sparql\n ");
 
-/*****
 		while(tok.hasMoreTokens()) {
 		    s = tok.nextToken().toLowerCase();
 		    if (s.equals("describe") || s.equals("construct") || s.equals("ask")) 
 			break;
 		}
 
-		StringBuffer ret = new StringBuffer();
 		if (s.equals("describe") || s.equals("construct") || s.equals("ask")) 
-			ret.append("sparql\n define output:format '_JAVA_'\n ");
-		else 
-			ret.append("sparql\n ");
-*******/
-		StringBuffer ret = new StringBuffer("sparql\n ");
+		    ret.append("define output:format '_JAVA_'\n ");
+
 
 		if (includeInferred && repository.ruleSet!=null && repository.ruleSet.length() > 0)
 		  ret.append("define input:inference '"+repository.ruleSet+"'\n ");
diff --git a/binsrc/sqldoc/Makefile.in b/binsrc/sqldoc/Makefile.in
index dffa781..26bda7b 100644
--- a/binsrc/sqldoc/Makefile.in
+++ b/binsrc/sqldoc/Makefile.in
@@ -167,6 +167,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/sqldoc/isql_log_normalize.c b/binsrc/sqldoc/isql_log_normalize.c
index 1943bdf..3471569 100644
--- a/binsrc/sqldoc/isql_log_normalize.c
+++ b/binsrc/sqldoc/isql_log_normalize.c
@@ -217,7 +217,7 @@ void cut_substitute_all (cut_env_t *env, cut_buf_t *tgt, cut_buf_t *src)
       if (
 	(hit1 = strstr (srcline, "Connected to OpenLink Virtuoso VDBMS")) )
 	{
-	  tgtline = malloc (strlen (srcline));
+	  tgtline = malloc (strlen (srcline)+1);
 	  strcpy (tgtline, srcline);
 	  strcpy (tgtline + (hit1 - srcline), hit1 + strlen ("Connected to OpenLink Virtuoso VDBMS"));
 	  srcline = tgtline;
@@ -227,7 +227,7 @@ void cut_substitute_all (cut_env_t *env, cut_buf_t *tgt, cut_buf_t *src)
 	(hit2 = strstr (hit1, " OpenLink Virtuoso ODBC Driver")) &&
 	stralphabet (hit1 + strlen ("Driver: "), hit2, "0123456789.") )
 	{
-	  tgtline = malloc (strlen (srcline));
+	  tgtline = malloc (strlen (srcline)+1);
 	  strcpy (tgtline, srcline);
 	  strcpy (tgtline + (hit1 - srcline), hit2 + strlen (" OpenLink Virtuoso ODBC Driver"));
 	  srcline = tgtline;
diff --git a/binsrc/sync/Makefile.in b/binsrc/sync/Makefile.in
index 14b83e6..3b581f6 100644
--- a/binsrc/sync/Makefile.in
+++ b/binsrc/sync/Makefile.in
@@ -186,6 +186,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/sync/make_vad.sh b/binsrc/sync/make_vad.sh
index e296ca0..0cd89af 100755
--- a/binsrc/sync/make_vad.sh
+++ b/binsrc/sync/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.8.2.1 2010/01/07 16:58:12 source Exp $
+#  $Id: make_vad.sh,v 1.8.2.2 2011/02/03 10:38:32 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -220,7 +220,7 @@ sticker_init() {
   echo "  <name package=\"SyncML\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"SyncML\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
diff --git a/binsrc/tests/Makefile.in b/binsrc/tests/Makefile.in
index 665f0cb..b250ed5 100644
--- a/binsrc/tests/Makefile.in
+++ b/binsrc/tests/Makefile.in
@@ -404,6 +404,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tests/biftest/Makefile.in b/binsrc/tests/biftest/Makefile.in
index ee4bd31..fb85177 100644
--- a/binsrc/tests/biftest/Makefile.in
+++ b/binsrc/tests/biftest/Makefile.in
@@ -234,6 +234,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tests/biftest/java_skel.c b/binsrc/tests/biftest/java_skel.c
index 1917db3..f200b59 100644
--- a/binsrc/tests/biftest/java_skel.c
+++ b/binsrc/tests/biftest/java_skel.c
@@ -127,7 +127,7 @@ bif_do_something_bif (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   jmethodID work_method_obj, cleanup_method_obj;
   jint ret;
   jvalue jargs[1];
-  query_instance_t *qi = (query_instance_t *)qi;
+  query_instance_t *qi = (query_instance_t *)qst;
 
   if (NULL != (*err_ret = java_vm_attach (&env)))
     goto finish;
diff --git a/binsrc/tests/biftest/sql_code_clr.c b/binsrc/tests/biftest/sql_code_clr.c
index 41597a9..edb4545 100644
--- a/binsrc/tests/biftest/sql_code_clr.c
+++ b/binsrc/tests/biftest/sql_code_clr.c
@@ -7,6 +7,7 @@
 /* import_clr.sql */
 
 static const char *proc0 = 
+"#line 37 \"[executable]/import_clr.sql\"\n"
 "create procedure DB.DBA.CACHE_ASSEMBLY_TO_DISK (in _asm_name varchar, in server_exe varchar)\n"
 "{\n"
 "declare _code varchar;\n"
@@ -15,9 +16,10 @@ static const char *proc0 =
 "\n"
 "string_to_file (server_exe || _asm_name || \'.dll\', _code, -2);\n"
 "}\n"
-"--src import_clr.sql:36\n";
+"--src import_clr.sql:35\n";
 
 static const char *proc1 = 
+"#line 47 \"[executable]/import_clr.sql\"\n"
 "create procedure DB.DBA.CLR_CREATE_LIBRARY (in asm_name varchar, in internal_name varchar,\n"
 "in auto_register integer, in perm_mode integer)\n"
 "{\n"
@@ -40,9 +42,10 @@ static const char *proc1 =
 "DB..import_clr (internal_name, NULL, unrestricted => perm_mode - 1);\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:46\n";
+"--src import_clr.sql:45\n";
 
 static const char *proc2 = 
+"#line 71 \"[executable]/import_clr.sql\"\n"
 "create procedure DB.DBA.CLR_CREATE_LIBRARY_UI (in asm_name varchar, in mtd_name varchar, in perm_mode integer)\n"
 "{\n"
 "\n"
@@ -58,17 +61,19 @@ static const char *proc2 =
 "\n"
 "DB..import_clr (short_name, mtd_name, unrestricted => perm_mode);\n"
 "}\n"
-"--src import_clr.sql:70\n";
+"--src import_clr.sql:69\n";
 
 static const char *proc3 = 
+"#line 89 \"[executable]/import_clr.sql\"\n"
 "create procedure DB.DBA.CLR_CREATE_ASSEMBLY (in asm_name varchar, in internal_name varchar,\n"
 "in auto_register integer, in perm_mode integer)\n"
 "{\n"
 "DB.DBA.CLR_CREATE_LIBRARY (asm_name, internal_name, auto_register, perm_mode);\n"
 "}\n"
-"--src import_clr.sql:88\n";
+"--src import_clr.sql:87\n";
 
 static const char *proc4 = 
+"#line 97 \"[executable]/import_clr.sql\"\n"
 "create procedure DB.DBA.CLR_DROP_LIBRARY (in internal_name varchar)\n"
 "{\n"
 "if (exists (select 1 from DB.DBA.CLR_VAC where VAC_INTERNAL_NAME = internal_name))\n"
@@ -78,7 +83,7 @@ static const char *proc4 =
 "commit work;\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:96\n";
+"--src import_clr.sql:95\n";
 
 static const char *udt0 = 
 "create type Assembly language clr external name \'mscorlib/System.Reflection.Assembly\'\n"
@@ -162,6 +167,7 @@ static const char *udt5 =
 "\n";
 
 static const char *proc5 = 
+"#line 190 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_ref_import (in assm_names varchar, in classes varchar, in unrestricted integer := 0,\n"
 "in _is_add_virtual integer := 0)\n"
 "{\n"
@@ -304,9 +310,10 @@ static const char *proc5 =
 "\n"
 "return ses;\n"
 "}\n"
-"--src import_clr.sql:189\n";
+"--src import_clr.sql:188\n";
 
 static const char *proc6 = 
+"#line 334 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_describe_class_type (inout ses any, in class _Type, in _is_add_virtual integer,\n"
 "in _base_type_str varchar, in under_name varchar, inout _base_type _Type)\n"
 "{\n"
@@ -460,9 +467,10 @@ static const char *proc6 =
 "idx := idx + 1;\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:333\n";
+"--src import_clr.sql:332\n";
 
 static const char *proc7 = 
+"#line 490 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_describe_parameters (inout ses any, in parameters any)\n"
 "{\n"
 "declare _name, _type_s, _type_esc_s, _pltype, _soaptype, _reftype varchar;\n"
@@ -513,9 +521,10 @@ static const char *proc7 =
 "\n"
 "ses_print (\'\\n</parameters>\', ses);\n"
 "}\n"
-"--src import_clr.sql:489\n";
+"--src import_clr.sql:488\n";
 
 static const char *proc8 = 
+"#line 542 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_describe_returns (inout ses any, in _type _Type)\n"
 "{\n"
 "declare _type_s, _type_esc_s varchar;\n"
@@ -533,9 +542,10 @@ static const char *proc8 =
 "_type_esc_s, _type_s,\n"
 "cast (clr_type_to_schema_type (_type_s, _is_primitive, _is_array) as varchar), _plescape), ses);\n"
 "}\n"
-"--src import_clr.sql:541\n";
+"--src import_clr.sql:540\n";
 
 static const char *proc9 = 
+"#line 561 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_type_is_primitive (in clr_type varchar)\n"
 "{\n"
 "clr_type := cast (clr_type as varchar);\n"
@@ -552,9 +562,10 @@ static const char *proc9 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src import_clr.sql:560\n";
+"--src import_clr.sql:559\n";
 
 static const char *proc10 = 
+"#line 579 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_type_to_pl_type (in clr_type varchar, in is_primitive int,\n"
 "in is_array int, inout _plescape int)\n"
 "returns varchar\n"
@@ -577,9 +588,10 @@ static const char *proc10 =
 "_plescape := 1;\n"
 "return clr_type;\n"
 "}\n"
-"--src import_clr.sql:578\n";
+"--src import_clr.sql:577\n";
 
 static const char *proc11 = 
+"#line 603 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_type_to_schema_type (in clr_type varchar, in is_primitive int, in is_array int)\n"
 "{\n"
 "clr_type := cast (clr_type as varchar);\n"
@@ -595,24 +607,27 @@ static const char *proc11 =
 "\n"
 "return clr_type;\n"
 "}\n"
-"--src import_clr.sql:602\n";
+"--src import_clr.sql:601\n";
 
 static const char *proc12 = 
+"#line 620 \"[executable]/import_clr.sql\"\n"
 "create procedure if_array (in clr_type varchar)\n"
 "{\n"
 "if (strstr (clr_type, \'[\')) return 1;\n"
 "return 0;\n"
 "}\n"
-"--src import_clr.sql:619\n";
+"--src import_clr.sql:618\n";
 
 static const char *proc13 = 
+"#line 627 \"[executable]/import_clr.sql\"\n"
 "create procedure ses_print (in _in any, inout ses any)\n"
 "{\n"
 "http (_in, ses);\n"
 "}\n"
-"--src import_clr.sql:626\n";
+"--src import_clr.sql:625\n";
 
 static const char *proc14 = 
+"#line 633 \"[executable]/import_clr.sql\"\n"
 "create procedure import_clr (in files any, in classes any, in _is_write_output integer := 0,\n"
 "in unrestricted integer := 0, in _is_return_sql integer := 0)\n"
 "{\n"
@@ -652,9 +667,10 @@ static const char *proc14 =
 "if (_is_return_sql)\n"
 "return  clr_make_human_read (all_pl);\n"
 "}\n"
-"--src import_clr.sql:632\n";
+"--src import_clr.sql:631\n";
 
 static const char *proc15 = 
+"#line 674 \"[executable]/import_clr.sql\"\n"
 "create procedure clr_make_human_read (in _res varchar)\n"
 "{\n"
 "_res := replace (_res, \'    \', \' \');\n"
@@ -710,7 +726,7 @@ static const char *proc15 =
 "\n"
 "return _res;\n"
 "}\n"
-"--src import_clr.sql:673\n";
+"--src import_clr.sql:672\n";
 
 static const char *udt6 = 
 "create type \"Virt_aspx_VirtHost\"\n"
@@ -733,14 +749,16 @@ static const char *udt6 =
 "\n";
 
 static const char *proc16 = 
+"#line 753 \"[executable]/import_clr.sql\"\n"
 "create procedure WS.WS.__http_handler_asmx (in full_name varchar, inout params any,\n"
 "inout lines any, inout hdl_mode any)\n"
 "{\n"
 "return WS.WS.__http_handler_aspx (full_name, params, lines, hdl_mode);\n"
 "}\n"
-"--src import_clr.sql:752\n";
+"--src import_clr.sql:751\n";
 
 static const char *proc17 = 
+"#line 760 \"[executable]/import_clr.sql\"\n"
 "create procedure\n"
 "aspx_get_host (in lines any)\n"
 "{\n"
@@ -756,9 +774,10 @@ static const char *proc17 =
 "}\n"
 "return ret;\n"
 "}\n"
-"--src import_clr.sql:759\n";
+"--src import_clr.sql:758\n";
 
 static const char *proc18 = 
+"#line 778 \"[executable]/import_clr.sql\"\n"
 "create procedure WS.WS.__http_handler_aspx (in full_name varchar, inout params any,\n"
 "inout lines any, inout hdl_mode any)\n"
 "{\n"
@@ -882,9 +901,10 @@ static const char *proc18 =
 "\n"
 "return cast (ret [0] as varchar);\n"
 "}\n"
-"--src import_clr.sql:777\n";
+"--src import_clr.sql:776\n";
 
 static const char *proc19 = 
+"#line 904 \"[executable]/import_clr.sql\"\n"
 "create procedure\n"
 "aspx_sys_mkdir (in path varchar)\n"
 "{\n"
@@ -909,9 +929,10 @@ static const char *proc19 =
 "idx := idx + 1;\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:903\n";
+"--src import_clr.sql:902\n";
 
 static const char *proc20 = 
+"#line 931 \"[executable]/import_clr.sql\"\n"
 "create procedure\n"
 "aspx_copy_dav_dir_to_file_system (in dav_path varchar, in abs_path varchar, out path varchar)\n"
 "{\n"
@@ -949,9 +970,10 @@ static const char *proc20 =
 "}\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:930\n";
+"--src import_clr.sql:929\n";
 
 static const char *proc21 = 
+"#line 971 \"[executable]/import_clr.sql\"\n"
 "create procedure unimport_clr (in files any, in classes any, in _is_write_output integer := 0)\n"
 "{\n"
 "declare _xml, _xmlv any;\n"
@@ -998,9 +1020,10 @@ static const char *proc21 =
 "}\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:970\n";
+"--src import_clr.sql:969\n";
 
 static const char *proc22 = 
+"#line 1020 \"[executable]/import_clr.sql\"\n"
 "create procedure import_get_types_int (in sel_name varchar)\n"
 "{\n"
 "declare asm Assembly;\n"
@@ -1066,9 +1089,10 @@ static const char *proc22 =
 "\n"
 "return vector ();\n"
 "}\n"
-"--src import_clr.sql:1019\n";
+"--src import_clr.sql:1018\n";
 
 static const char *proc23 = 
+"#line 1100 \"[executable]/import_clr.sql\"\n"
 "create procedure import_clr_grant_to_public (in files any, in classes any)\n"
 "{\n"
 "declare _xml, _xmlv any;\n"
@@ -1090,9 +1114,10 @@ static const char *proc23 =
 "}\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:1099\n";
+"--src import_clr.sql:1098\n";
 
 static const char *proc24 = 
+"#line 1123 \"[executable]/import_clr.sql\"\n"
 "create procedure import_get_assem_names\n"
 "(inout assem_name varchar, inout full_name varchar, inout short_name varchar)\n"
 "{\n"
@@ -1120,7 +1145,7 @@ static const char *proc24 =
 "short_name := \"LEFT\" (full_name, strstr (full_name, \',\'));\n"
 "}\n"
 "}\n"
-"--src import_clr.sql:1122\n";
+"--src import_clr.sql:1121\n";
 
 #undef isp_schema
 #define isp_schema(x) isp_schema_1(x)
diff --git a/binsrc/tests/biftest/sql_code_javavm.c b/binsrc/tests/biftest/sql_code_javavm.c
index c6b6ede..9bf96e0 100644
--- a/binsrc/tests/biftest/sql_code_javavm.c
+++ b/binsrc/tests/biftest/sql_code_javavm.c
@@ -7,13 +7,15 @@
 /* javavm_xml.sql */
 
 static const char *proc0 = 
+"#line 24 \"[executable]/javavm_xml.sql\"\n"
 "create procedure jvm_ref_print (in xx any, inout ses any)\n"
 "{\n"
 "http (xx, ses);\n"
 "}\n"
-"--src javavm_xml.sql:23\n";
+"--src javavm_xml.sql:22\n";
 
 static const char *proc1 = 
+"#line 30 \"[executable]/javavm_xml.sql\"\n"
 "create procedure jvm_type_to_pl_type (in java_type varchar, in is_primitive int, in is_array int, inout escape_it integer) returns varchar\n"
 "{\n"
 "escape_it := 0;\n"
@@ -40,9 +42,10 @@ static const char *proc1 =
 "return replace (cast (java_type as varchar), \'.\', \'_\');\n"
 "}\n"
 "}\n"
-"--src javavm_xml.sql:29\n";
+"--src javavm_xml.sql:28\n";
 
 static const char *proc2 = 
+"#line 59 \"[executable]/javavm_xml.sql\"\n"
 "create procedure jvm_type_to_signature (in java_type varchar, in is_primitive int, in is_array int) returns varchar\n"
 "{\n"
 "java_type := cast (java_type as varchar);\n"
@@ -63,9 +66,10 @@ static const char *proc2 =
 "else\n"
 "return concat (\'L\', replace (cast (java_type as varchar), \'.\', \'/\'), \';\');\n"
 "}\n"
-"--src javavm_xml.sql:58\n";
+"--src javavm_xml.sql:57\n";
 
 static const char *proc3 = 
+"#line 81 \"[executable]/javavm_xml.sql\"\n"
 "create procedure jvm_type_to_schema_type (in java_type varchar, in is_primitive int, in is_array int) returns varchar\n"
 "{\n"
 "java_type := cast (java_type as varchar);\n"
@@ -90,9 +94,10 @@ static const char *proc3 =
 "return \'\';\n"
 "}\n"
 "}\n"
-"--src javavm_xml.sql:80\n";
+"--src javavm_xml.sql:79\n";
 
 static const char *proc4 = 
+"#line 108 \"[executable]/javavm_xml.sql\"\n"
 "create procedure jvm_ref_describe_method (inout jvm_method any, inout ses any,\n"
 "in method_type varchar,\n"
 "in entity_name varchar,\n"
@@ -194,9 +199,10 @@ static const char *proc4 =
 "jvm_ref_print (\'\\n</parameters>\', ses);\n"
 "jvm_ref_print (sprintf (\'\\n</%s>\', entity_name), ses);\n"
 "}\n"
-"--src javavm_xml.sql:107\n";
+"--src javavm_xml.sql:106\n";
 
 static const char *proc5 = 
+"#line 212 \"[executable]/javavm_xml.sql\"\n"
 "create procedure jvm_ref_describe_class (in jvm varchar, inout classes any, in unrestricted integer)\n"
 "{\n"
 "declare inx integer;\n"
@@ -347,9 +353,10 @@ static const char *proc5 =
 "\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src javavm_xml.sql:211\n";
+"--src javavm_xml.sql:210\n";
 
 static const char *proc6 = 
+"#line 364 \"[executable]/javavm_xml.sql\"\n"
 "create procedure jvm_ref_archive_handler (in name varchar, in class_name varchar := null)\n"
 "{\n"
 "declare jar any;\n"
@@ -432,9 +439,10 @@ static const char *proc6 =
 "return null;\n"
 "}\n"
 "}\n"
-"--src javavm_xml.sql:363\n";
+"--src javavm_xml.sql:362\n";
 
 static const char *proc7 = 
+"#line 448 \"[executable]/javavm_xml.sql\"\n"
 "create procedure jvm_load_class (in jvm varchar)\n"
 "{\n"
 "declare class_loader any;\n"
@@ -445,9 +453,10 @@ static const char *proc7 =
 "\n"
 "\n"
 "}\n"
-"--src javavm_xml.sql:447\n";
+"--src javavm_xml.sql:446\n";
 
 static const char *proc8 = 
+"#line 461 \"[executable]/javavm_xml.sql\"\n"
 "create procedure jvm_ref_import (in files any, in classes any, in unrestricted integer)\n"
 "{\n"
 "declare ret any;\n"
@@ -545,9 +554,10 @@ static const char *proc8 =
 "}\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src javavm_xml.sql:460\n";
+"--src javavm_xml.sql:459\n";
 
 static const char *proc9 = 
+"#line 560 \"[executable]/javavm_xml.sql\"\n"
 "create procedure import_jar (in files any, in classes any, in unrestricted integer := 0,\n"
 "in _is_return_sql integer := 0)\n"
 "{\n"
@@ -581,9 +591,10 @@ static const char *proc9 =
 "if (_is_return_sql)\n"
 "return all_pl;\n"
 "}\n"
-"--src javavm_xml.sql:559\n";
+"--src javavm_xml.sql:558\n";
 
 static const char *proc10 = 
+"#line 596 \"[executable]/javavm_xml.sql\"\n"
 "create procedure unimport_jar (in files any, in classes any)\n"
 "{\n"
 "declare _xml, _xmlv any;\n"
@@ -625,9 +636,10 @@ static const char *proc10 =
 "}\n"
 "}\n"
 "}\n"
-"--src javavm_xml.sql:595\n";
+"--src javavm_xml.sql:594\n";
 
 static const char *proc11 = 
+"#line 640 \"[executable]/javavm_xml.sql\"\n"
 "create procedure import_get_types_int (in sel_name varchar)\n"
 "{\n"
 "declare types, ret any;\n"
@@ -660,7 +672,7 @@ static const char *proc11 =
 "\n"
 "return vector ();\n"
 "}\n"
-"--src javavm_xml.sql:639\n";
+"--src javavm_xml.sql:638\n";
 
 #undef isp_schema
 #define isp_schema(x) isp_schema_1(x)
diff --git a/binsrc/tests/bsbm/Makefile.in b/binsrc/tests/bsbm/Makefile.in
index c1ca9d3..dce12fe 100644
--- a/binsrc/tests/bsbm/Makefile.in
+++ b/binsrc/tests/bsbm/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tests/dotnet/Makefile.in b/binsrc/tests/dotnet/Makefile.in
index 461ce2f..3826a74 100644
--- a/binsrc/tests/dotnet/Makefile.in
+++ b/binsrc/tests/dotnet/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tests/inifile.vers.c b/binsrc/tests/inifile.vers.c
index 6a8c94c..7799a9a 100644
--- a/binsrc/tests/inifile.vers.c
+++ b/binsrc/tests/inifile.vers.c
@@ -1,11 +1,9 @@
 /*
- *
  *  DO NOT EDIT THIS FILE -- IT WAS GENERATED WITH makever
- *
  */
 
 char version[] = "\
 Ini file configuration utility\n\
-Version 1.4 as of Wed Feb 11 12:16:21 CET 2009.\n\
-Compiled for Linux 2.6.27.9-73.fc9.x86_64\n\
+Version 1.4 as of Thu Nov 11 13:03:39 CET 2010.\n\
+Compiled for Linux 2.6.34.7-56.fc13.x86_64\n\
 Copyright (C) OpenLink Software.\n";
diff --git a/binsrc/tests/isql.c b/binsrc/tests/isql.c
index f76ec80..76341c7 100644
--- a/binsrc/tests/isql.c
+++ b/binsrc/tests/isql.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: isql.c,v 1.3.2.3 2010/05/18 22:29:21 source Exp $
+ *  $Id: isql.c,v 1.3.2.4 2011/03/25 17:47:30 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -3963,8 +3963,13 @@ parse_statement_for_special_parameters (UTCHAR * whole_statement,
 			}
 		    }
 		  else if (newlen < oldlen)
-		    {		/* Use isqlt_tcscpy, squashing out extra characters. */
-		      isqlt_tcscpy (SCP (str + newlen), SCP (cont));
+		    {		/* Do NOT use isqlt_tcscpy in order to squash out extra characters --- ranges overlap! */
+		      for (p1 = cont, p2 = p1 + delta;
+			   (p1 <= (str + whole_len));
+			   p1++, p2++)
+			{
+			  *p2 = *p1;
+			}
 		    }
 /* And then copy the produced string itself, starting from the same
    location where the $dollar_form was (but leave the terminating
diff --git a/binsrc/tests/isql_win32.c b/binsrc/tests/isql_win32.c
index 972971a..5516a00 100644
--- a/binsrc/tests/isql_win32.c
+++ b/binsrc/tests/isql_win32.c
@@ -133,13 +133,16 @@ isqlt_fgetws(wchar_t *s, int size, FILE *stream)
   char *buffer = malloc (size);
   wchar_t *wbuffer;
 
-  if (fgets (buffer, size, stream))
+  if (buffer && fgets (buffer, size, stream))
     {
       wbuffer = malloc_narrow_as_wide (buffer);
       wcsncpy (s, wbuffer, size);
       free (wbuffer);
       return s;
     }
-  else
+
+  if (wbuffer)
+    free (wbuffer);
+
     return NULL;
 }
diff --git a/binsrc/tests/lubm/Makefile.in b/binsrc/tests/lubm/Makefile.in
index 2ee8d19..2b7605a 100644
--- a/binsrc/tests/lubm/Makefile.in
+++ b/binsrc/tests/lubm/Makefile.in
@@ -162,6 +162,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tests/oledb/Makefile.in b/binsrc/tests/oledb/Makefile.in
index c405c2f..431871f 100644
--- a/binsrc/tests/oledb/Makefile.in
+++ b/binsrc/tests/oledb/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tests/rdf/Makefile.in b/binsrc/tests/rdf/Makefile.in
index 520ff41..93c454d 100644
--- a/binsrc/tests/rdf/Makefile.in
+++ b/binsrc/tests/rdf/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tests/suite/Makefile.in b/binsrc/tests/suite/Makefile.in
index 675597a..16bb03f 100644
--- a/binsrc/tests/suite/Makefile.in
+++ b/binsrc/tests/suite/Makefile.in
@@ -202,6 +202,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tests/suite/audit.txt b/binsrc/tests/suite/audit.txt
deleted file mode 100644
index ddab4f0..0000000
--- a/binsrc/tests/suite/audit.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Virtuoso release check passed 
-Tue Jul  6 19:21:00 CEST 2010
-Linux taz.pvk.private 2.6.30.10-105.2.23.fc11.x86_64 #1 SMP Thu Feb 11 07:06:34 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux
diff --git a/binsrc/tests/suite/ident.txt b/binsrc/tests/suite/ident.txt
index 56b1be5..0d153d1 100644
--- a/binsrc/tests/suite/ident.txt
+++ b/binsrc/tests/suite/ident.txt
@@ -3,23 +3,23 @@ VARCHAR
 _______________________________________________________________________________
 
 OpenLink Virtuoso  Server
-Version 06.01.3127-pthreads for Linux as of Jul  6 2010 
-Started on: 2010/07/06 19:20 GMT+120
+Version 06.01.3127-pthreads for Linux as of Mar 29 2011 
+Started on: 2011/03/29 19:18 GMT+120
  
 Database Status:
-  File size 20971520, 2560 pages, 2069 free.
-  2000 buffers, 462 used, 0 dirty 0 wired down, repl age 0 0 w. io 0 w/crsr.
-  Disk Usage: 12 reads avg 0 msec, 0% r 0% w last  0 s, 554 writes,
-    0 read ahead, batch = 0.  Autocompact 85 in 61 out, 27% saved.
+  File size 20971520, 2560 pages, 2048 free.
+  2000 buffers, 482 used, 0 dirty 0 wired down, repl age 0 0 w. io 0 w/crsr.
+  Disk Usage: 8 reads avg 0 msec, 0% r 0% w last  0 s, 562 writes,
+    0 read ahead, batch = 0.  Autocompact 82 in 59 out, 27% saved.
 Gate:  0 2nd in reads, 0 gate write waits, 0 in while read 0 busy scrap. 
 Log = virtuoso.trx, 87 bytes
-462 pages have been changed since last backup (in checkpoint state)
+482 pages have been changed since last backup (in checkpoint state)
 Current backup timestamp: 0x0000-0x00-0x00
 Last backup date: unknown
 Clients: 1 connects, max 1 concurrent
-RPC: 4 calls, 1 pending, 2 max until now, 0 queued, 0 burst reads (0%), 0 second brk=152358912
-Checkpoint Remap 19 pages, 0 mapped back. 0 s atomic time.
-    DB master 2560 total 2069 free 19 remap 0 mapped back
+RPC: 4 calls, 1 pending, 1 max until now, 0 queued, 0 burst reads (0%), 0 second brk=157417472
+Checkpoint Remap 19 pages, 0 mapped back. 1 s atomic time.
+    DB master 2560 total 2048 free 19 remap 0 mapped back
    temp  256 total 251 free
  
 Lock Status: 0 deadlocks of which 0 2r1w, 0 waits,
@@ -27,20 +27,14 @@ Lock Status: 0 deadlocks of which 0 2r1w, 0 waits,
 Pending:
  
 Client 1111:1:  Account: dba, 203 bytes in, 256 bytes out, 1 stmts.
-PID: 16356, OS: unix, Application: unknown, IP#: 127.0.0.1
+PID: 20649, OS: unix, Application: unknown, IP#: 127.0.0.1
 Transaction status: PENDING, 1 threads.
 Locks: 
  
  
 Running Statements:
  Time (msec) Text
-          31 status()
- 
- 
-Replication Status: Server  virt1111.
-   virt1111             virt1111                      0 OFF.
- 
- 
+          24 status()
  
  
 Hash indexes
diff --git a/binsrc/tests/suite/ldmeter.sql b/binsrc/tests/suite/ldmeter.sql
index 5017ce7..efa9fa2 100644
--- a/binsrc/tests/suite/ldmeter.sql
+++ b/binsrc/tests/suite/ldmeter.sql
@@ -6,9 +6,9 @@ create table ld_metric
  lm_dt datetime,
  lm_first_id int,
  lm_secs_since_start int,
- lm_n_rows int,
+ lm_n_rows bigint,
  lm_cpu int,
- lm_n_reads int,
+ lm_n_reads bigint,
  lm_read_time int,
  lm_read_pct float,
  lm_rows_per_s float,
@@ -39,7 +39,7 @@ create procedure ld_sample (in is_first int := 0)
   declare id, n_rows, read_time, last_read_time, elapsed int;
  id := sequence_next ('lm');
  now := curdatetime ();
- n_rows := (select touches from sys_d_stat where index_name = 'RDF_QUAD');
+ n_rows := (select cl_sys_stat (key_table, name_part (key_name, 2), 'touches') from sys_keys where key_name = 'DB.DBA.RDF_QUAD');
  ru := getrusage ();
   if (is_first)
     {
diff --git a/binsrc/tests/suite/rdfldck.sql b/binsrc/tests/suite/rdfldck.sql
index 96c29ce..0dd4c07 100644
--- a/binsrc/tests/suite/rdfldck.sql
+++ b/binsrc/tests/suite/rdfldck.sql
@@ -2,6 +2,21 @@
 
 -- check and stats statements for rdf
 
+
+select count (*) from rdf_quad a table option (index rdf_quad) where not exists (select 1 from rdf_quad b table option (loop, index rdf_quad_pogs) where a.g = b.g and a.p = b.p and a.o = b.o and a.s = b.s);
+select count (*) from rdf_quad a table option (index rdf_quad_pogs) where not exists (select 1 from rdf_quad b table option (loop, index primary key) where a.g = b.g and a.p = b.p and a.o = b.o and a.s = b.s);
+
+select count (*) from rdf_iri a where not  exists (select 1 from rdf_iri b table option (loop) where  a.ri_id = b.ri_id);
+select count (*) from rdf_iri a where not  exists (select 1 from rdf_iri b table option (loop) where  a.ri_name = b.ri_name);
+
+select count (*) from rdf_iri a where not  exists (select 1 from rdf_iri b table option (loop) where  a.ri_id = b.ri_id);
+select count (*) from rdf_prefix a where not  exists (select 1 from rdf_prefix b table option (loop) where  a.rp_name = b.rp_name);
+select count (*) from rdf_prefix a where not  exists (select 1 from rdf_prefix b table option (loop) where  a.rp_id = b.rp_id);
+
+select count (*) from rdf_obj a table option (index rdf_obj) where not exists (select 1 from rdf_obj b table option (index ro_val, loop) where b.ro_id = a.ro_id and b.ro_val = a.ro_val and b.ro_dt_and_lang = a.ro_dt_and_lang);
+select count (*) from rdf_obj a table option (index ro_val) where not exists (select 1 from rdf_obj b table option (index rdf_obj, loop) where b.ro_id = a.ro_id and b.ro_val = a.ro_val and b.ro_dt_and_lang = a.ro_dt_and_lang);
+
+
 select count (*) from rdf_quad a table option (index primary key) where not exists (select 1 from rdf_quad b table option (loop, index rdf_quad_ogps) where a.g = b.g and a.p = b.p and a.o = b.o and a.s = b.s);
 
 select count (*) from rdf_quad a table option (index rdf_quad_ogps) where not exists (select 1 from rdf_quad b table option (loop, index primary key) where a.g = b.g and a.p = b.p and a.o = b.o and a.s = b.s);
@@ -193,3 +208,43 @@ create table berlin (ro_id bigint primary key);
 
 insert into berlin select ro_id from rdf_obj where ro_val like '**berlin' or blob_to_string (ro_long) like '**berlin';
 
+
+
+
+-- test 2+3 inx
+
+select top 10 * from rdf_quad a table option ( index rdf_quad_pogs) where not exists (select 1 from rdf_quad b table option (loop, index rdf_quad_pogs) where b.o = a.o and b.p = a.p and b.s = a.s and b.g = a.g);
+select top 10 * from rdf_quad a table option ( index rdf_quad_pogs) where not exists (select 1 from rdf_quad b table option (loop, index rdf_quad) where b.o = a.o and b.p = a.p and b.s = a.s and b.g = a.g);
+
+select top 10 * from rdf_quad a table option ( index rdf_quad_pogs) where not exists (select 1 from rdf_quad b table option (loop, index rdf_quad_pogs) where b.o = a.o and b.p = a.p and b.s = a.s and b.g = a.g) option (any order);
+select top 10 * from rdf_quad a table option ( index rdf_quad_pogs) where not exists (select 1 from rdf_quad b table option (loop, index rdf_quad) where b.o = a.o and b.p = a.p and b.s = a.s and b.g = a.g) option (any order);
+
+
+select top 10 * from rdf_quad a table option ( index rdf_quad_op, index_only) where not exists (select 1 from rdf_quad b table option (loop, index rdf_quad_pogs) where b.o = a.o and b.p = a.p );
+
+select distinct top 100 o, rdf_box_ro_id (o) from rdf_quad where is_rdf_box (o) and rdf_box_ro_id (o) and not exists (select 1 from rdf_obj table option (loop) where ro_id = rdf_box_ro_id (o)) option (any order);
+
+
+create procedure rdf_order_ck ()
+{
+  declare first int;
+  declare g1, s1, p1, o1 any;
+  first := 1;
+  for select g, s, p, o from rdf_quad table option (index rdf_quad_pogs) do
+    {
+      if (first = 0)
+	{
+	  if (not ( p >= p1)
+	      or (p = p1 and o < o1)
+	      or (p = p1 and o = o1 and g < g1)
+	      or (p = p1 and o = o1 and g = g1 and s <= s1))
+	    {
+		dbg_obj_print ('err', p1, o1, g1, s1);
+	      dbg_obj_print (p, o, g, s);
+		--signal ('42000', 'out of order');
+	    }
+	}
+    first := 0;
+    p1 := p; o1 := o; g1 := g; s1 := s;
+    }
+}
diff --git a/binsrc/tests/suite/sqlo2.sql b/binsrc/tests/suite/sqlo2.sql
index 017ed57..e3d3c82 100644
--- a/binsrc/tests/suite/sqlo2.sql
+++ b/binsrc/tests/suite/sqlo2.sql
@@ -1,7 +1,7 @@
 --
 --  sqlo2.sql
 --
---  $Id: sqlo2.sql,v 1.4.2.4 2009/11/10 15:54:05 source Exp $
+--  $Id: sqlo2.sql,v 1.4.2.5 2010/12/10 12:24:41 source Exp $
 --
 --  Various SQL optimized compiler tests, part 2.
 --
@@ -312,6 +312,106 @@ ECHO BOTH $IF $EQU $STATE OK "PASSED" "***FAILED";
 SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
 ECHO BOTH ":BUG 5176: STATE=" $STATE " MESSAGE=" $MESSAGE "\n";
 
+--- Test for Bug 14167 fix
+
+create table LocutusMetadata.DBA.dcterms_subject_Table
+(
+ SubjectUri VARCHAR(2048),
+ GraphName VARCHAR(32),
+ dcterms_subject VARCHAR(52)
+);
+
+create table LocutusMetadata.DBA.fam_assetUrl_Table
+(
+ SubjectUri VARCHAR(2048),
+ GraphName VARCHAR(32),
+ ParentUri VARCHAR(2048),
+ fam_dateTimeOriginalUtc VARCHAR(30)
+);
+
+delete from locutusmetadata.dba.dcterms_subject_Table;
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj1', 'graph1', 'The Larry Subject 1');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj2', 'graphBAD1', 'The Larry Subject 2');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj3', 'graph1', 'Larry');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj4', 'graphBAD1', 'Larry');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj5', 'graph1', 'The King Subject 5');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj6', 'graphBAD1', 'The King Subject 6');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj7', 'graph1', 'King');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj8', 'graphBAD1', 'King');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj9', 'graph1', 'The Larry Subject 9');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj10', 'graphBAD1', 'The Larry Subject 10');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj11', 'graph1', 'Larry');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj12', 'graphBAD1', 'Larry');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj13', 'User1', 'The Larry Subject 13');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj14', 'User1', 'Larry');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj15', 'User1', 'The King Subject 15');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj16', 'User1', 'King');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj17', 'User1', 'The Larry Subject 17');
+insert into locutusmetadata.dba.dcterms_subject_Table (SubjectUri, GraphName, dcterms_subject) values ('subj18', 'User1', 'Larry');
+
+delete from locutusmetadata.dba.fam_assetUrl_Table;
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj1', 'graph1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj2', 'graph1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj3', 'graph1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj4', 'graph1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj5', 'graph1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj6', 'graph1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj7', 'graph1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj8', 'graph1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj13', 'graph1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj14', 'graph1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj15', 'graph1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj16', 'graph1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj1', 'User1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj2', 'User1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj3', 'User1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj4', 'User1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj5', 'User1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj6', 'User1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj7', 'User1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj8', 'User1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj13', 'User1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj14', 'User1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj15', 'User1');
+insert into locutusmetadata.dba.fam_assetUrl_Table (SubjectUri, GraphName) values ('subj16', 'User1');
+
+SELECT dcterms_subject_Table.SubjectUri,fam_assetUrl_Table.fam_dateTimeOriginalUtc 
+FROM
+  locutusmetadata.dba.dcterms_subject_Table,
+  locutusmetadata.dba.fam_assetUrl_Table
+WHERE ((
+    (dcterms_subject_Table.subjectUri in
+      (select DISTINCT SubjectUri from locutusmetadata.dba.dcterms_subject_Table T 
+        where T.dcterms_subject like '%Larr%' 
+        union select DISTINCT SubjectUri from locutusmetadata.dba.dcterms_subject_Table T 
+        where T.dcterms_subject = 'Larry' )
+    and dcterms_subject_Table.SubjectUri = fam_assetUrl_Table.SubjectUri
+    and dcterms_subject_Table.GraphName = fam_assetUrl_Table.GraphName))
+  and dcterms_subject_Table.GraphName ='User1')
+ORDER BY  fam_dateTimeOriginalUtc ASC;
+
+ECHO BOTH $IF $EQU $ROWCNT 2 "PASSED" "***FAILED";
+SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
+ECHO BOTH ": BUG 14167 : union of DISTINCTs inside IN operator STATE=" $STATE " MESSAGE=" $MESSAGE "\n";
+
+SELECT DS.SubjectUri, FA.fam_dateTimeOriginalUtc 
+FROM
+  locutusmetadata.dba.dcterms_subject_Table DS,
+  locutusmetadata.dba.fam_assetUrl_Table FA
+WHERE
+    (DS.subjectUri in (select * from
+      (select T1.SubjectUri from locutusmetadata.dba.dcterms_subject_Table T1 
+        where T1.dcterms_subject like '%Larr%' 
+        union select T2.SubjectUri from locutusmetadata.dba.dcterms_subject_Table T2 
+        where T2.dcterms_subject = 'Larry' ) T3))
+and DS.SubjectUri = FA.SubjectUri
+and 'User1' /* DS.GraphName */ = FA.GraphName
+and DS.GraphName ='User1'
+ORDER BY  FA.fam_dateTimeOriginalUtc ASC;
+
+ECHO BOTH $IF $EQU $ROWCNT 2 "PASSED" "***FAILED";
+SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
+ECHO BOTH ": BUG 14167 : union inside IN operator STATE=" $STATE " MESSAGE=" $MESSAGE "\n";
 
 select count (*) from SYS_USERS where U_NAME = 'dba' and U_NAME in ('dba', 'admin', 'george');
 ECHO BOTH $IF $EQU $LAST[1] 1 "PASSED" "***FAILED";
diff --git a/binsrc/tests/suite/tacl.sql b/binsrc/tests/suite/tacl.sql
index cd3f95d..87daa03 100644
--- a/binsrc/tests/suite/tacl.sql
+++ b/binsrc/tests/suite/tacl.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: tacl.sql,v 1.2 2006/08/16 07:58:10 source Exp $
+--  $Id: tacl.sql,v 1.2.2.1 2010/09/20 08:27:40 source Exp $
 --  
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -142,7 +142,16 @@ delete from HTTP_ACL where HA_LIST = 'HTTP';
 -- HTTP acl test; deny all
 insert into HTTP_ACL (HA_LIST, HA_ORDER, HA_CLIENT_IP, HA_FLAG) values ('HTTP', 1, '*', 1);
 
-select http_get ('http://localhost:$U{HTTPPORT}/');
+create procedure acl_check ()
+{
+  declare h any;
+  http_get ('http://localhost:$U{HTTPPORT}/', h);
+  if (h[0] not like 'HTTP/1._ 200 %')
+    signal ('.....', h[0]);
+}
+;
+
+acl_check ();
 ECHO BOTH $IF $NEQ $STATE OK "PASSED" "***FAILED";
 SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
 ECHO BOTH ": HTTP ACL denied : STATE=" $STATE " MESSAGE=" $MESSAGE "\n";
diff --git a/binsrc/tests/suite/taq.sql b/binsrc/tests/suite/taq.sql
index e18c267..afabaee 100644
--- a/binsrc/tests/suite/taq.sql
+++ b/binsrc/tests/suite/taq.sql
@@ -98,3 +98,26 @@ create procedure INS1_ERR (in q int, in w int)
 
 taq1err (1);
 
+
+create procedure fi (in i int)
+{
+  if (i < 2) return i;
+  else return fi (i - 1) + fi (i - 2);
+}
+
+
+create procedure FIAQ (in i int)
+{
+  if (i < 20)
+  return fi (i);
+  declare aq, n1, n2 any;
+  aq := async_queue (2, 1);
+  n1 := aq_request (aq, 'DB.DBA.FIAQ', vector (i - 1));
+  n2 := aq_request (aq, 'DB.DBA.FIAQ', vector (i - 2));
+  return aq_wait (aq, n1, 1) + aq_wait (aq, n2, 1);
+}
+
+select fiaq (29);
+echo both $if $equ $last[1] 514229 "PASSED" "***FAILED";
+echo both ": aq fi\n";
+
diff --git a/binsrc/tests/suite/tcldfg.sql b/binsrc/tests/suite/tcldfg.sql
index b870a0b..744c26d 100644
--- a/binsrc/tests/suite/tcldfg.sql
+++ b/binsrc/tests/suite/tcldfg.sql
@@ -78,3 +78,15 @@ create procedure dfgp ()
 		     }
     }
 }
+
+
+
+create procedure df (in n int, in stage int)
+{
+  if (stage = 1 and 1 < sys_stat ('cl_this_host'))
+	delay (0.1);
+  return n + 1;
+}
+
+select count (*) from t1 a, t1 b, t1 c where b.fi2 = df (a.fi2, 1) and c.fi2 = df (b.fi2, 2) option (order, loop);
+
diff --git a/binsrc/tests/suite/tcldt.sql b/binsrc/tests/suite/tcldt.sql
index f2a9e12..290b822 100644
--- a/binsrc/tests/suite/tcldt.sql
+++ b/binsrc/tests/suite/tcldt.sql
@@ -12,6 +12,9 @@ echo both "Cluster multistate derived tables\n";
 
 
 __dbf_set ('cl_req_batch_size', 7);
+__dbf_set ('dc_batch_sz', 7);
+__dbf_set ('dc_max_batch_sz', 7);
+
 
 create procedure DPINC (in q int)
 {
@@ -144,7 +147,12 @@ echo both ": multistate  group by dt\n";
 
 select a.fi6, b.* from (select distinct fi6 from t1) a, (select fi6, count (*) as ct from t1 group by fi6) b where b.fi6 between  a.fi6 - 1 and a.fi6 + 1 order by 1, 2 option (order);
 echo both $if $equ $last[3] 1 "PASSED" "***FAILED";
-echo both ": multistate  group by dt with range\n";
+echo both ": multistate  group by dt with range, gb partitioned\n";
+
+select  a.fi6, b.* from (select distinct fi6 from t1) a, (select fi6, fi6 + 0 as dum, count (*) as ct from t1 group by fi6, fi6 + 0) b where b.fi6 between  a.fi6 - 1 and a.fi6 + 1 order by 1, 2 option (order);
+echo both $if $equ $last[4] 1 "PASSED" "***FAILED";
+echo both ": multistate  group by dt with range, gb not partitioned\n";
+
 
 
 -- existence 
@@ -216,3 +224,18 @@ echo both ": final partitioned gb oby, many batches, one set\n";
 select c.fi2, sum (c.row_no) from t1 a, t1 b table option (hash), t1 d, t1 c where b.fi2 = a.fi2 + 1 and d.fi2 = b.fi2 and c.fi2 = d.fi2 + 1 group by c.fi2 order by 2 desc option (order);
 echo both $if $equ $rowcnt 98 "PASSED" "***FAILED";
 echo both ": final dfg w partitioned gb oby, many batches, one set\n";
+
+
+
+-- vectored special cases of oby/gb 
+
+__dbf_set ('qp_thread_min_usec', 0);
+__dbf_set ('enable_qp', 8);
+
+select top 10 a.row_no from t1 a table option (index t1), t1 b  where b.row_no = a.row_no and 0 + a.row_no between 80 and 90 order by a.row_no + 0 option (order, loop);
+
+select top 10 row_no, (select c.row_no from t1 c table option (loop) where c.row_no = 1 + a.row_no) from t1 a where row_no + 1 = (select b.row_no from t1 b table option (loop) where b.row_no = 1 + a.row_no);
+
+select a.string1, count (*) from t1 a, t1 b where b.row_no = 1000 + a.row_no group by a.string1 order by a.string1 option (order, hash);
+select a.string1, count (*) from t1 b, t1 a where b.row_no = 1000 + a.row_no group by a.string1 order by a.string1 option (order, hash);
+select a.string1, count (*) from t1 a, t1 b where b.row_no = 1000 + a.row_no group by a.string1 having count (*) <> 3330 order by a.string1 option (order, loop);
diff --git a/binsrc/tests/suite/tdav_meta.sh b/binsrc/tests/suite/tdav_meta.sh
index bae57f5..7ee4cf1 100755
--- a/binsrc/tests/suite/tdav_meta.sh
+++ b/binsrc/tests/suite/tdav_meta.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: tdav_meta.sh,v 1.5.2.3 2010/01/28 14:33:20 source Exp $
+#  $Id: tdav_meta.sh,v 1.5.2.4 2011/03/28 23:11:40 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -86,6 +86,12 @@ cd tdav_meta
 for x in `ls ../tdav_meta_*.zip` ; do unzip "$x" ; done
 cd ..
 
+if [ ! -f tdav_meta/bookmarks.xml ]
+then
+    LOG "***ABORTED: tdav_meta directory does not contain demo data"
+    exit 1
+fi
+
 _dsn=$DSN
 DSN=$DS1
 SHUTDOWN_SERVER
diff --git a/binsrc/tests/suite/tjoin.sql b/binsrc/tests/suite/tjoin.sql
index 63f4a94..71db318 100644
--- a/binsrc/tests/suite/tjoin.sql
+++ b/binsrc/tests/suite/tjoin.sql
@@ -1,7 +1,7 @@
 --
 --  tjoin.sql
 --
---  $Id: tjoin.sql,v 1.1.1.1.2.2 2009/07/14 22:24:47 source Exp $
+--  $Id: tjoin.sql,v 1.1.1.1.2.3 2011/03/25 15:10:16 source Exp $
 --
 --  Outer Join tests
 --  
@@ -530,3 +530,166 @@ select case when b.fi2 in (100,110,111) then 1 else 0 end from t1 a, t1 b where
 echo both $if $equ $last[1] 1 "PASSED" "***FAILED";
 echo both ": cond exp shared between filter of hash filler and result set\n";
 
+explain ('sparql define input:storage ""
+PREFIX conversion: <http://purl.org/twc/vocab/conversion/>
+PREFIX void: <http://rdfs.org/ns/void#>
+
+SELECT distinct ?dataset
+WHERE 
+{
+  ?dataset void:subset0 ?version .
+  OPTIONAL 
+    {
+      ?version void:subset1  ?layer .
+      ?layer conversion:num_triples ?triples .
+    }
+OPTIONAL 
+    {
+      ?version void:subset2  ?layer .
+      ?layer void:subset3 ?descriminator .
+  }
+
+}');
+ECHO BOTH $IF $EQU $STATE OK "PASSED" "***FAILED";
+SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
+ECHO BOTH ": bug 14207 remove two needless optionals STATE=" $STATE " MESSAGE=" $MESSAGE "\n";
+
+explain ('sparql define input:storage ""
+PREFIX conversion: <http://purl.org/twc/vocab/conversion/>
+PREFIX void: <http://rdfs.org/ns/void#>
+
+SELECT distinct ?dataset ?layer
+WHERE 
+{
+  ?dataset void:subset0 ?version .
+  OPTIONAL 
+    {
+      ?version void:subset1  ?layer .
+      ?layer conversion:num_triples ?triples .
+    }
+OPTIONAL 
+    {
+      ?version void:subset2  ?layer .
+      ?layer void:subset3 ?descriminator .
+  }
+
+}');
+
+ECHO BOTH $IF $EQU $STATE OK "PASSED" "***FAILED";
+SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
+ECHO BOTH ": bug 14207-2 remove one needless optionals STATE=" $STATE " MESSAGE=" $MESSAGE "\n";
+
+explain ('sparql define input:storage ""
+PREFIX conversion: <http://purl.org/twc/vocab/conversion/>
+PREFIX void: <http://rdfs.org/ns/void#>
+
+SELECT distinct ?dataset ?descriminator
+WHERE 
+{
+  ?dataset void:subset0 ?version .
+  OPTIONAL 
+    {
+      ?version void:subset1  ?layer .
+      ?layer conversion:num_triples ?triples .
+    }
+OPTIONAL 
+    {
+      ?version void:subset2  ?layer .
+      ?layer void:subset3 ?descriminator .
+  }
+
+}');
+ECHO BOTH $IF $EQU $STATE OK "PASSED" "***FAILED";
+SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
+ECHO BOTH ": bug 14207-3 keep all outers STATE=" $STATE " MESSAGE=" $MESSAGE "\n";
+
+
+ttlp (
+'
+ at prefix void: <http://rdfs.org/ns/void#> .
+ at prefix conversion: <http://purl.org/twc/vocab/conversion/> .
+
+<ds> void:subset0 <vers> .
+<vers> void:subset1 <layer1> .
+<layer1> conversion:num_triples 12 .
+<vers> void:subset2 <layer1> .
+<layer1> void:subset3 <descriminator> .
+
+', '', 'test');   
+
+
+sparql define input:storage ""
+PREFIX conversion: <http://purl.org/twc/vocab/conversion/>
+PREFIX void: <http://rdfs.org/ns/void#>
+
+SELECT distinct ?dataset
+WHERE 
+{
+  ?dataset void:subset0 ?version .
+  OPTIONAL 
+    {
+      ?version void:subset1  ?layer .
+      ?layer conversion:num_triples ?triples .
+    }
+OPTIONAL 
+    {
+      ?version void:subset2  ?layer .
+      ?layer void:subset3 ?descriminator .
+  }
+
+};
+ECHO BOTH $IF $EQU $LAST[1] ds "PASSED" "***FAILED";
+SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
+ECHO BOTH ": bug 14207-4 remove two needless optionals LAST=" $LAST[1] "\n";
+
+sparql define input:storage ""
+PREFIX conversion: <http://purl.org/twc/vocab/conversion/>
+PREFIX void: <http://rdfs.org/ns/void#>
+
+SELECT distinct ?dataset ?layer
+WHERE 
+{
+  ?dataset void:subset0 ?version .
+  OPTIONAL 
+    {
+      ?version void:subset1  ?layer .
+      ?layer conversion:num_triples ?triples .
+    }
+OPTIONAL 
+    {
+      ?version void:subset2  ?layer .
+      ?layer void:subset3 ?descriminator .
+  }
+
+};
+ECHO BOTH $IF $EQU $LAST[2] layer1 "PASSED" "***FAILED";
+SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
+ECHO BOTH ": bug 14207-5 remove one needless optionals LAST=" $LAST[2] "\n";
+
+
+sparql define input:storage ""
+PREFIX conversion: <http://purl.org/twc/vocab/conversion/>
+PREFIX void: <http://rdfs.org/ns/void#>
+
+SELECT distinct ?dataset ?descriminator
+WHERE 
+{
+  ?dataset void:subset0 ?version .
+  OPTIONAL 
+    {
+      ?version void:subset1  ?layer .
+      ?layer conversion:num_triples ?triples .
+    }
+OPTIONAL 
+    {
+      ?version void:subset2  ?layer .
+      ?layer void:subset3 ?descriminator .
+  }
+
+};
+
+
+ECHO BOTH $IF $EQU $LAST[2] descriminator "PASSED" "***FAILED";
+SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
+ECHO BOTH ": bug 14207-6 keep all optionals LAST=" $LAST[2] "\n";
+
diff --git a/binsrc/tests/suite/tpc-d/Makefile.in b/binsrc/tests/suite/tpc-d/Makefile.in
index afbd66c..03484e6 100644
--- a/binsrc/tests/suite/tpc-d/Makefile.in
+++ b/binsrc/tests/suite/tpc-d/Makefile.in
@@ -162,6 +162,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tests/suite/tpc-d/tpcd_to_quads.sql b/binsrc/tests/suite/tpc-d/tpcd_to_quads.sql
index 24a8c1b..e16b429 100644
--- a/binsrc/tests/suite/tpc-d/tpcd_to_quads.sql
+++ b/binsrc/tests/suite/tpc-d/tpcd_to_quads.sql
@@ -6,7 +6,7 @@ create procedure tpcd_to_quads ()
   for (sparql define output:valmode "LONG" select ?s ?p ?o from <http://example.com/tpcd> where { ?s ?p ?o}) do
     {
       insert soft DB.DBA.RDF_QUAD (G,S,P,O)
-      values (graph_iid, "s", "p", DB.DBA.RDF_OBJ_OF_LONG ("o"));
+      values (graph_iid, "s", "p", DB.DBA.RDF_OBJ_OF_SQLVAL ("o"));
     }
   log_enable(1, 0);
 }
diff --git a/binsrc/tests/suite/trdfinf.sql b/binsrc/tests/suite/trdfinf.sql
index 053b116..335a191 100644
--- a/binsrc/tests/suite/trdfinf.sql
+++ b/binsrc/tests/suite/trdfinf.sql
@@ -269,8 +269,8 @@ echo both $if $equ $rowcnt 3 "PASSED" "***FAILED";
 echo both ": same-as for property\n";
 
 sparql define input:inference 'sas-p' define input:same-as "yes"
-select * from <sas-p> where { ?s <sas-p1> ?o };
-echo both $if $equ $rowcnt 4 "PASSED" "***FAILED";
+select distinct * from <sas-p> where { ?s <sas-p1> ?o };
+echo both $if $equ $rowcnt 3 "PASSED" "***FAILED";
 echo both ": same-as for sameAs property\n";
 
 
diff --git a/binsrc/tests/suite/trepl.sh b/binsrc/tests/suite/trepl.sh
index 1c88510..9f0f9f9 100755
--- a/binsrc/tests/suite/trepl.sh
+++ b/binsrc/tests/suite/trepl.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: trepl.sh,v 1.4.2.1 2009/04/20 21:17:47 source Exp $
+#  $Id: trepl.sh,v 1.4.2.2 2010/12/10 12:24:41 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -50,7 +50,7 @@ mixed=""
 grep VDB ident.txt
 if test $? -ne 0
 then 
-    LOG "No VDB in trepl,.sh"
+    LOG "No VDB in trepl.sh"
     echo "trepl.sh: The present build is not set up for VDB."
     exit
 fi
diff --git a/binsrc/tests/suite/tsoap.sql b/binsrc/tests/suite/tsoap.sql
index 2109fd4..e96a140 100644
--- a/binsrc/tests/suite/tsoap.sql
+++ b/binsrc/tests/suite/tsoap.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: tsoap.sql,v 1.2 2006/08/16 07:58:12 source Exp $
+--  $Id: tsoap.sql,v 1.2.2.1 2010/12/10 12:24:41 source Exp $
 --  
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -1103,14 +1103,14 @@ ECHO BOTH ": " $LAST[1];
 ECHO BOTH " STATE=" $STATE " MESSAGE=" $MESSAGE "\n";
 
 select soap_dt_define ('', file_to_string ('xsd/m2.xsd'));
-ECHO BOTH $IF $NEQ $STATE OK  "PASSED" "***FAILED";
+ECHO BOTH $IF $EQU $STATE OK  "PASSED" "***FAILED";
 SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
 ECHO BOTH ": STATE=" $STATE " MESSAGE=" $MESSAGE;
 select xpath_eval ('string(/complexType/@name)', xml_tree_doc (file_to_string ('xsd/m2.xsd')), 1);
 ECHO BOTH " (" $LAST[1] ")\n";
 
 select soap_dt_define ('', file_to_string ('xsd/m3.xsd'));
-ECHO BOTH $IF $NEQ $STATE OK  "PASSED" "***FAILED";
+ECHO BOTH $IF $EQU $STATE OK  "PASSED" "***FAILED";
 SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
 ECHO BOTH ": STATE=" $STATE " MESSAGE=" $MESSAGE;
 select xpath_eval ('string(/complexType/@name)', xml_tree_doc (file_to_string ('xsd/m3.xsd')), 1);
@@ -1150,7 +1150,7 @@ ECHO BOTH ": " $LAST[1];
 ECHO BOTH " STATE=" $STATE " MESSAGE=" $MESSAGE "\n";
 
 select soap_dt_define ('', file_to_string ('xsd/o4.xsd'));
-ECHO BOTH $IF $NEQ $STATE OK  "PASSED" "***FAILED";
+ECHO BOTH $IF $EQU $STATE OK  "PASSED" "***FAILED";
 SET ARGV[$LIF] $+ $ARGV[$LIF] 1;
 ECHO BOTH ": STATE=" $STATE " MESSAGE=" $MESSAGE;
 select xpath_eval ('string(/complexType/@name)', xml_tree_doc (file_to_string ('xsd/o4.xsd')), 1);
diff --git a/binsrc/tests/suite/tvad.sh b/binsrc/tests/suite/tvad.sh
index 13a36c4..e73ee61 100755
--- a/binsrc/tests/suite/tvad.sh
+++ b/binsrc/tests/suite/tvad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh 
 #
-#  $Id: tvad.sh,v 1.5.2.2 2010/01/07 16:58:12 source Exp $
+#  $Id: tvad.sh,v 1.5.2.3 2011/03/25 15:10:16 source Exp $
 #
 #  VAD tests
 #  
@@ -96,7 +96,7 @@ GenVAD1 ()
 	  <name package="rdf_lib">
 		<prop name="Title" value="RDF Support Library" />
 		<prop name="Developer" value="OpenLink Software" />
-		<prop name="Copyright" value="(C) 1998-2010 OpenLink Software" />
+		<prop name="Copyright" value="(C) 1998-2011 OpenLink Software" />
 		<prop name="Download" value="http://www.openlinksw.com/virtuoso/rdf_lib/download" />
 		<prop name="Download" value="http://www.openlinksw.co.uk/virtuoso/rdf_lib/download" />
 	  </name>
@@ -135,7 +135,7 @@ GenVAD2 ()
 	  <name package="test1">
 		<prop name="Title" value="test" />
 		<prop name="Developer" value="OpenLink Software" />
-		<prop name="Copyright" value="(C) 1998-2010 OpenLink Software" />
+		<prop name="Copyright" value="(C) 1998-2011 OpenLink Software" />
 		<prop name="Download" value="http://www.openlinksw.com/virtuoso/rdf_lib/download" />
 		<prop name="Download" value="http://www.openlinksw.co.uk/virtuoso/rdf_lib/download" />
 	  </name>
@@ -172,7 +172,7 @@ GenVAD3 ()
 	  <name package="test1">
 		<prop name="Title" value="test" />
 		<prop name="Developer" value="OpenLink Software" />
-		<prop name="Copyright" value="(C) 1998-2010 OpenLink Software" />
+		<prop name="Copyright" value="(C) 1998-2011 OpenLink Software" />
 		<prop name="Download" value="http://www.openlinksw.com/virtuoso/rdf_lib/download" />
 		<prop name="Download" value="http://www.openlinksw.co.uk/virtuoso/rdf_lib/download" />
 	  </name>
@@ -208,7 +208,7 @@ GenVAD4 ()
 	  <name package="test2">
 		<prop name="Title" value="test" />
 		<prop name="Developer" value="OpenLink Software" />
-		<prop name="Copyright" value="(C) 1998-2010 OpenLink Software" />
+		<prop name="Copyright" value="(C) 1998-2011 OpenLink Software" />
 		<prop name="Download" value="http://www.openlinksw.com/virtuoso/rdf_lib/download" />
 		<prop name="Download" value="http://www.openlinksw.co.uk/virtuoso/rdf_lib/download" />
 	  </name>
diff --git a/binsrc/tests/suite/twcopy.sh b/binsrc/tests/suite/twcopy.sh
index 0d105d4..9061201 100755
--- a/binsrc/tests/suite/twcopy.sh
+++ b/binsrc/tests/suite/twcopy.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: twcopy.sh,v 1.5.2.3 2010/01/28 14:33:20 source Exp $
+#  $Id: twcopy.sh,v 1.5.2.4 2011/03/25 15:10:16 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -71,6 +71,7 @@ GenDefPage ()
 <strong>Page $1</strong><br>
 <a href="page1.html">page1</a><br>
 <a href="errpage.html">page with errors</a><br>
+<a href="honeypot.html"></a><br>
 <img src="image.gif">
 </body>
 </html>
@@ -567,7 +568,16 @@ mkdir dir3/sub31
 mkdir dir3/sub32
 
 GenDefPage
+echo "Generating robots.txt"
+    cat > robots.txt <<END_PAGE
+User-agent: *
+Disallow: /honeypot
+END_PAGE
 GenErrPage
+echo "Generating honeypot.html page"
+    cat > honeypot.html<<END_PAGE
+This is a trap!!!    
+END_PAGE
 GenStartPage
 GenPage 2 sub11 ./dir1/
 GenEndPage 4 ./dir1/sub11/
diff --git a/binsrc/tests/suite/vad_test1.xml b/binsrc/tests/suite/vad_test1.xml
index e8dc1a9..b241161 100644
--- a/binsrc/tests/suite/vad_test1.xml
+++ b/binsrc/tests/suite/vad_test1.xml
@@ -5,7 +5,7 @@
     <name package="test1">
       <prop name="Title" value="Test1 Package"/>
       <prop name="Developer" value="OpenLink Software"/>
-      <prop name="Copyright" value="(C) 1998-2010 OpenLink Software"/>
+      <prop name="Copyright" value="(C) 1998-2011 OpenLink Software"/>
       <prop name="Download" value="http://www.openlinksw.com/virtuoso"/>
       <prop name="Download" value="http://www.openlinksw.co.uk/virtuoso"/>
     </name>
diff --git a/binsrc/tests/suite/vad_test2.xml b/binsrc/tests/suite/vad_test2.xml
index 50cf322..ba85f93 100644
--- a/binsrc/tests/suite/vad_test2.xml
+++ b/binsrc/tests/suite/vad_test2.xml
@@ -5,7 +5,7 @@
     <name package="test2">
       <prop name="Title" value="Test2"/>
       <prop name="Developer" value="OpenLink Software"/>
-      <prop name="Copyright" value="(C) 1998-2010 OpenLink Software"/>
+      <prop name="Copyright" value="(C) 1998-2011 OpenLink Software"/>
       <prop name="Download" value="http://www.openlinksw.com/virtuoso"/>
       <prop name="Download" value="http://www.openlinksw.co.uk/virtuoso"/>
     </name>
diff --git a/binsrc/tests/tpcrun/Makefile.in b/binsrc/tests/tpcrun/Makefile.in
index c2c1eb4..2270841 100644
--- a/binsrc/tests/tpcrun/Makefile.in
+++ b/binsrc/tests/tpcrun/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tests/wb/Makefile.in b/binsrc/tests/wb/Makefile.in
index e964918..8f872e9 100644
--- a/binsrc/tests/wb/Makefile.in
+++ b/binsrc/tests/wb/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tutorial/Makefile.in b/binsrc/tutorial/Makefile.in
index aafb592..e110329 100644
--- a/binsrc/tutorial/Makefile.in
+++ b/binsrc/tutorial/Makefile.in
@@ -224,6 +224,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tutorial/apps/Makefile.in b/binsrc/tutorial/apps/Makefile.in
index 68065ed..20558e4 100644
--- a/binsrc/tutorial/apps/Makefile.in
+++ b/binsrc/tutorial/apps/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tutorial/hosting/Makefile.in b/binsrc/tutorial/hosting/Makefile.in
index 81bc46c..fbdc983 100644
--- a/binsrc/tutorial/hosting/Makefile.in
+++ b/binsrc/tutorial/hosting/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tutorial/make_tutorial_dav_vad.xml b/binsrc/tutorial/make_tutorial_dav_vad.xml
index 411e9f8..16b3463 100644
--- a/binsrc/tutorial/make_tutorial_dav_vad.xml
+++ b/binsrc/tutorial/make_tutorial_dav_vad.xml
@@ -5,12 +5,12 @@
   <name package="tutorial">
     <prop name="Title" value="Virtuoso Developer Tutorial"/>
     <prop name="Developer" value="OpenLink Software"/>
-    <prop name="Copyright" value="(C) 1998-2010 OpenLink Software"/>
+    <prop name="Copyright" value="(C) 1998-2011 OpenLink Software"/>
     <prop name="Download" value="http://www.openlinksw.com/virtuoso"/>
     <prop name="Download" value="http://www.openlinksw.co.uk/virtuoso"/>
   </name>
   <version package="1.00.6853">
-    <prop name="Release Date" value="2010-07-09 18:23"/>
+    <prop name="Release Date" value="2011-03-29 18:22"/>
     <prop name="Build" value="Release"/>
   </version>
 </caption>
diff --git a/binsrc/tutorial/make_tutorial_fs_vad.xml b/binsrc/tutorial/make_tutorial_fs_vad.xml
index 3c63949..c9b424c 100644
--- a/binsrc/tutorial/make_tutorial_fs_vad.xml
+++ b/binsrc/tutorial/make_tutorial_fs_vad.xml
@@ -5,12 +5,12 @@
   <name package="tutorial">
     <prop name="Title" value="Virtuoso Developer Tutorial"/>
     <prop name="Developer" value="OpenLink Software"/>
-    <prop name="Copyright" value="(C) 1998-2010 OpenLink Software"/>
+    <prop name="Copyright" value="(C) 1998-2011 OpenLink Software"/>
     <prop name="Download" value="http://www.openlinksw.com/virtuoso"/>
     <prop name="Download" value="http://www.openlinksw.co.uk/virtuoso"/>
   </name>
   <version package="1.00.6853">
-    <prop name="Release Date" value="2010-07-09 18:22"/>
+    <prop name="Release Date" value="2011-03-29 18:21"/>
     <prop name="Build" value="Release"/>
   </version>
 </caption>
diff --git a/binsrc/tutorial/make_vad.sh b/binsrc/tutorial/make_vad.sh
index 0fdc090..e542e95 100755
--- a/binsrc/tutorial/make_vad.sh
+++ b/binsrc/tutorial/make_vad.sh
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: make_vad.sh,v 1.20.2.3 2010/05/31 23:22:09 source Exp $
+# $Id: make_vad.sh,v 1.20.2.4 2011/02/03 10:39:34 source Exp $
 
 # ----------------------------------------------------------------------
 #  Fix issues with LOCALE
@@ -334,7 +334,7 @@ sticker_init() {
   echo "  <name package=\"tutorial\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"Virtuoso Developer Tutorial\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
diff --git a/binsrc/tutorial/services/Makefile.in b/binsrc/tutorial/services/Makefile.in
index ff5744d..b3c7a30 100644
--- a/binsrc/tutorial/services/Makefile.in
+++ b/binsrc/tutorial/services/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tutorial/web/Makefile.in b/binsrc/tutorial/web/Makefile.in
index 43566db..dbe448c 100644
--- a/binsrc/tutorial/web/Makefile.in
+++ b/binsrc/tutorial/web/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/tutorial/xml/Makefile.in b/binsrc/tutorial/xml/Makefile.in
index 35799f3..f07aa05 100644
--- a/binsrc/tutorial/xml/Makefile.in
+++ b/binsrc/tutorial/xml/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/vad/Makefile.in b/binsrc/vad/Makefile.in
index a5cc6e8..7747ec5 100644
--- a/binsrc/vad/Makefile.in
+++ b/binsrc/vad/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/vad/specs/sticker_rdf_lib.xml b/binsrc/vad/specs/sticker_rdf_lib.xml
index 09eda1f..834146a 100644
--- a/binsrc/vad/specs/sticker_rdf_lib.xml
+++ b/binsrc/vad/specs/sticker_rdf_lib.xml
@@ -6,7 +6,7 @@
   <name package="rdf_lib">
    <prop name="Title" value="RDF Support Library" />
    <prop name="Developer" value="OpenLink Software" />
-   <prop name="Copyright" value="(C) 1998-2010 OpenLink Software" />
+   <prop name="Copyright" value="(C) 1998-2011 OpenLink Software" />
    <prop name="Download" value="http://www.openlinksw.com/virtuoso/rdf_lib/download" />
    <prop name="Download" value="http://www.openlinksw.co.uk/virtuoso/rdf_lib/download" />
   </name>
diff --git a/binsrc/vad/vad_make.sql b/binsrc/vad/vad_make.sql
index 354a885..bdcc69b 100644
--- a/binsrc/vad/vad_make.sql
+++ b/binsrc/vad/vad_make.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: vad_make.sql,v 1.23.2.2 2010/04/06 16:47:38 source Exp $
+--  $Id: vad_make.sql,v 1.23.2.3 2010/08/09 19:44:51 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -726,6 +726,7 @@ create procedure "VAD"."DBA"."VAD_TEST_CREATE" (
   {
     s2 := cast (xpath_eval ('@type', aref (items, j)) as varchar);
     s6 := cast (xpath_eval ('@source', aref (items, j)) as varchar);
+    s5 := cast (xpath_eval ('@source_uri', aref (items, j)) as varchar);
     s3 := cast (xpath_eval ('@target_uri', aref (items, j)) as varchar);
     s4 := get_keyword (s6, iniarr);
     if (s4 is null or length(s4)=0)
@@ -733,11 +734,14 @@ create procedure "VAD"."DBA"."VAD_TEST_CREATE" (
       _err_message := sprintf ('Illegal resource type:%s for %s', s2,s3);
       goto error_fin;
     }
-    s4 := sprintf ('%s/%s', s4, s3);
+    if (s5 is null or length(s5)=0)
+    {
+      s5 := sprintf ('%s/%s', s4, s3);
+    }
     if (neq (s6, 'dav'))
-      "VAD"."DBA"."VAD_OUT_ROW_FILE" (fname, pos, s3, s4, ctx);
+      "VAD"."DBA"."VAD_OUT_ROW_FILE" (fname, pos, s3, s5, ctx);
     else
-      "VAD"."DBA"."VAD_OUT_ROW_DAV" (fname, pos, s3, s4, ctx, iniarr);
+      "VAD"."DBA"."VAD_OUT_ROW_DAV" (fname, pos, s3, s5, ctx, iniarr);
     j := j + 1;
   }
   data := md5_final (ctx);
diff --git a/binsrc/vad/vad_misc.sql b/binsrc/vad/vad_misc.sql
index 4585da0..3e60d85 100644
--- a/binsrc/vad/vad_misc.sql
+++ b/binsrc/vad/vad_misc.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: vad_misc.sql,v 1.6.2.1 2010/01/07 16:58:12 source Exp $
+--  $Id: vad_misc.sql,v 1.6.2.2 2011/02/03 10:40:17 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -86,7 +86,7 @@ create procedure "VAD"."DBA"."HTML_FOOTER_OUT" ( in arr any )
   http ('<TR CLASS="CopyrightBorder"><TD COLSPAN="2"><IMG SRC="/admin/images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR>');
   http ('<TR><TD ALIGN="right" COLSPAN="2"><P CLASS="Copyright">Virtuoso Server ');
   http (sys_stat('st_dbms_ver'));
-  http (sprintf (' VAD Interface (%s) - Copyright© 1998-2010 OpenLink Software.</P></TD></TR>',"VAD"."DBA"."VAD_VERSION" ()));
+  http (sprintf (' VAD Interface (%s) - Copyright© 1998-2011 OpenLink Software.</P></TD></TR>',"VAD"."DBA"."VAD_VERSION" ()));
   http ('</TABLE>\n</BODY>');
 }
 ;
diff --git a/binsrc/virtodbc/Makefile.in b/binsrc/virtodbc/Makefile.in
index 59a717c..ac3cae6 100644
--- a/binsrc/virtodbc/Makefile.in
+++ b/binsrc/virtodbc/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/virtoledb/Makefile.in b/binsrc/virtoledb/Makefile.in
index 4fdbfc0..b3cf2ae 100644
--- a/binsrc/virtoledb/Makefile.in
+++ b/binsrc/virtoledb/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/virtoledb/asserts.cpp b/binsrc/virtoledb/asserts.cpp
index 21105ac..b84d012 100644
--- a/binsrc/virtoledb/asserts.cpp
+++ b/binsrc/virtoledb/asserts.cpp
@@ -3,7 +3,7 @@
  *
  *  asserts.cpp
  *
- *  $Id: asserts.cpp,v 1.1.1.1 2006/04/11 17:56:12 source Exp $
+ *  $Id: asserts.cpp,v 1.1.1.1.2.1 2011/01/25 14:36:33 source Exp $
  *
  *  Debugging and Assertion Routines
  *  
@@ -848,7 +848,7 @@ void
 OLEDB_Assert(LPSTR expression, LPSTR filename, long linenum)
 {
   char szbuff[350];
-  volatile int fAbort;
+  volatile int fAbort = 1;
 
   _snprintf(szbuff, sizeof (szbuff),
             "Assertion error!\n  File '%.50s', line '%ld'\n  Expression '%.200s'\n",
diff --git a/binsrc/virtuoso/Makefile.in b/binsrc/virtuoso/Makefile.in
index ee04d7b..e0666b8 100644
--- a/binsrc/virtuoso/Makefile.in
+++ b/binsrc/virtuoso/Makefile.in
@@ -288,6 +288,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/virtuoso/viconfig.c b/binsrc/virtuoso/viconfig.c
index 61c483b..07efd44 100644
--- a/binsrc/virtuoso/viconfig.c
+++ b/binsrc/virtuoso/viconfig.c
@@ -1,7 +1,7 @@
 /*
  *  viconfig.c
  *
- *  $Id: viconfig.c,v 1.38.2.14 2010/06/09 12:31:43 source Exp $
+ *  $Id: viconfig.c,v 1.38.2.19 2011/03/03 17:12:05 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -251,11 +251,6 @@ dk_set_t c_stripes;
 int32 c_log_segments_num;
 log_segment_t *c_log_segments;
 int32 c_log_audit_trail;
-#if REPLICATION_SUPPORT
-int32 c_repl_queue_max = 50000;
-char *c_db_name;
-char *c_repl_server_enable;
-#endif
 int32 c_use_array_params = 0;
 int32 c_num_array_params = 10;
 int32 c_server_thread_sz = 60000;
@@ -324,9 +319,11 @@ int32 c_http_thread_sz = 280000;
 int32 c_http_keep_hosting = 0;
 extern long http_keep_hosting; /* from http.c */
 char *c_ucm_load_path = 0;
+int32 c_lh_xany_normalization_flags = 0;
 int32 c_i18n_wide_file_names = 0;
 char *c_i18n_volume_encoding = NULL;
 char *c_i18n_volume_emergency_encoding = NULL;
+extern int lh_xany_normalization_flags;
 extern int i18n_wide_file_names;
 extern struct encoding_handler_s *i18n_volume_encoding;
 extern struct encoding_handler_s *i18n_volume_emergency_encoding;
@@ -896,6 +893,16 @@ cfg_setup (void)
   if (cfg_getlong (pconfig, section, "SwapGuard", &swap_guard_on) == -1)
     swap_guard_on = 0;
 
+  /*  ExtentReadThreshold, ExtentReadWindow, ExtentReadStartupThreshold, ExtentReadStartupWindow */
+  if (cfg_getlong (pconfig, section, "ExtentReadThreshold", &em_ra_threshold) == -1)
+   em_ra_threshold = 2;
+  if (cfg_getlong (pconfig, section, "ExtentReadWindow", &em_ra_window) == -1)
+    em_ra_window = 1000;
+  if (cfg_getlong (pconfig, section, "ExtentReadStartupThreshold", &em_ra_startup_threshold) == -1)
+    em_ra_startup_threshold = 0;
+  if (cfg_getlong (pconfig, section, "ExtentReadStartupWindow", &em_ra_startup_window) == -1)
+   em_ra_startup_window = 40000;
+
   {
     int nbdirs;
     dk_set_t bd = NULL;
@@ -1321,6 +1328,8 @@ cfg_setup (void)
     c_sparql_result_set_max_rows = 0;
   if (cfg_getlong (pconfig, section, "MaxMemInUse", &c_sparql_max_mem_in_use) == -1)
     c_sparql_max_mem_in_use = 0;
+  if (cfg_getlong (pconfig, section, "TransitivityCacheEnabled", &tn_cache_enable) == -1)
+    tn_cache_enable = 0;
 
   /* Now open the HTTP log */
   if (http_log_file)
@@ -1338,18 +1347,6 @@ cfg_setup (void)
     }
 
   srv_client_defaults_init ();
-#if REPLICATION_SUPPORT
-  if (cfg_getstring (pconfig, "Replication", "ServerName", &c_db_name) == -1)
-    c_db_name = NULL;
-  if (cfg_getstring (pconfig, "Replication", "ServerEnable", &c_repl_server_enable) == -1)
-    c_repl_server_enable = NULL;
-  if (c_repl_server_enable &&
-      strcmp (c_repl_server_enable, "1") && stricmp (c_repl_server_enable, "On"))
-    c_repl_server_enable = NULL;
-
-  if (cfg_getlong (pconfig, "Replication", "QueueMax", &c_repl_queue_max) == -1)
-    c_repl_queue_max = 50000;
-#endif
 
   /*
    *  VDB related parameters
@@ -1423,13 +1420,8 @@ cfg_setup (void)
   else if (c_unremap_quota < 500)
     c_unremap_quota = 500;
 
-#if REPLICATION_SUPPORT
-  if (c_server_threads > MAX_THREADS - 5)
-    c_server_threads = MAX_THREADS - 5;
-#else
   if (c_server_threads > MAX_THREADS - 3)
     c_server_threads = MAX_THREADS - 3;
-#endif
 
   /* Initialization of UCMs */
 
@@ -1474,6 +1466,8 @@ cfg_setup (void)
   /* Initialization of national filesystems */
   
   section = "I18N";
+  if (cfg_getlong (pconfig, section, "XAnyNormalization", &c_lh_xany_normalization_flags) == -1)
+    c_lh_xany_normalization_flags = 0;
   if (cfg_getlong (pconfig, section, "WideFileNames", &c_i18n_wide_file_names) == -1)
     c_i18n_wide_file_names = 0;
   if (cfg_getstring (pconfig, section, "VolumeEncoding", &c_i18n_volume_encoding) == -1)
@@ -1685,11 +1679,6 @@ new_db_read_cfg (dbe_storage_t * ignore, char *mode)
   sqlo_max_layouts = c_sqlo_max_layouts;
   sql_proc_use_recompile = c_sql_proc_use_recompile;
 
-#if REPLICATION_SUPPORT
-  repl_queue_max = c_repl_queue_max;
-  repl_server_enable = c_repl_server_enable;
-  db_name = box_string (c_db_name);
-#endif
 
   callstack_on_exception = c_callstack_on_exception;
   log_file_line = c_log_file_line;
@@ -1736,6 +1725,7 @@ new_db_read_cfg (dbe_storage_t * ignore, char *mode)
   sparql_max_mem_in_use = c_sparql_max_mem_in_use;
   cli_encryption_on_password = c_cli_encryption_on_password;
 
+  lh_xany_normalization_flags = c_lh_xany_normalization_flags;
   i18n_wide_file_names = c_i18n_wide_file_names;
   if (NULL != c_i18n_volume_encoding)
     {
@@ -2144,7 +2134,8 @@ failed:
   log (L_ERR, "If you are absolutely sure that this is not the case, please try");
   log (L_ERR, "to remove the file %s and start again.", c_lock_file);
 
-  close (lck_fd);
+  if (lck_fd >= 0)
+    close (lck_fd);
   lck_fd = -1;
 
   return -1;
diff --git a/binsrc/virtuoso/viunix.c b/binsrc/virtuoso/viunix.c
index 4857699..bc750b6 100644
--- a/binsrc/virtuoso/viunix.c
+++ b/binsrc/virtuoso/viunix.c
@@ -1,7 +1,7 @@
 /*
  *  viunix.c
  *
- *  $Id: viunix.c,v 1.11 2009/04/14 11:53:45 source Exp $
+ *  $Id: viunix.c,v 1.11.2.1 2010/09/17 16:36:13 source Exp $
  *
  *  OpenLink Virtuoso VDBMS Server main
  *  
@@ -695,14 +695,6 @@ main (int argc, char **argv)
   if (!strchr (f_mode, 'b'))
     {
       http_init_part_two ();
-#if REPLICATION_SUPPORT
-      if (f_read_from_rebuilt_database)	/* if booting from crash log, */
-	{				/* go read the account levels from db */
-	  repl_read_db_levels ();
-	}
-
-      /*repl_sync_server (NULL, NULL);*/
-#endif
     }
 #ifdef _RENDEZVOUS
   start_rendezvous ();
diff --git a/binsrc/virtuoso/viwin32.c b/binsrc/virtuoso/viwin32.c
index a067c0a..d88e35d 100644
--- a/binsrc/virtuoso/viwin32.c
+++ b/binsrc/virtuoso/viwin32.c
@@ -1,7 +1,7 @@
 /*
  *  viwin32.c
  *
- *  $Id: viwin32.c,v 1.11 2009/04/14 11:53:45 source Exp $
+ *  $Id: viwin32.c,v 1.11.2.1 2010/09/17 16:36:13 source Exp $
  *
  *  OpenLink Virtuoso DBMS Server
  *  Main code for Win32
@@ -1546,14 +1546,6 @@ ApplicationMain (int argc, char **argv)
   if (!strchr (f_mode, 'b'))
     {
       http_init_part_two ();
-#if REPLICATION_SUPPORT
-      if (f_read_from_rebuilt_database)	/* if booting from crash log, */
-	{				/* go read the account levels from db */
-	  repl_read_db_levels ();
-	}
-
-      /*repl_sync_server (NULL, NULL);*/
-#endif
     }
 #ifdef _RENDEZVOUS
   start_rendezvous ();
diff --git a/binsrc/virtuoso_sink/Makefile.in b/binsrc/virtuoso_sink/Makefile.in
index 8cbbf61..a3d58f8 100644
--- a/binsrc/virtuoso_sink/Makefile.in
+++ b/binsrc/virtuoso_sink/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/vsp/Makefile.in b/binsrc/vsp/Makefile.in
index 2919544..6487732 100644
--- a/binsrc/vsp/Makefile.in
+++ b/binsrc/vsp/Makefile.in
@@ -164,6 +164,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/vsp/admin/admin.sql b/binsrc/vsp/admin/admin.sql
index e3f9d3f..d7eb69e 100644
--- a/binsrc/vsp/admin/admin.sql
+++ b/binsrc/vsp/admin/admin.sql
@@ -2,7 +2,7 @@
 --
 --  admin.sql
 --
---  $Id: admin.sql,v 1.3.2.1 2010/01/07 16:58:12 source Exp $
+--  $Id: admin.sql,v 1.3.2.3 2011/02/03 10:35:33 source Exp $
 --
 --  Virtuoso admin vsp interface
 --  
@@ -4282,7 +4282,7 @@ adm_page_footer()
   http('<TR><TD CLASS="CopyrightBorder" COLSPAN="2"><IMG SRC="/admin/images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR>');
   http('<TR><TD ALIGN="right" COLSPAN="2"><P CLASS="Copyright">Virtuoso Universal Server ');
   http(sys_stat('st_dbms_ver'));
-  http(' - Copyright© 1998-2010 OpenLink Software.</P></TD></TR>');
+  http(' - Copyright© 1998-2011 OpenLink Software.</P></TD></TR>');
   http('</TABLE>\n</BODY>');
 }
 ;
@@ -4343,6 +4343,9 @@ adm_get_file_dsn ()
   declare _err_code, _err_message varchar;
   declare exit handler for sqlstate '*' { _err_code := __SQL_STATE; _err_message := __SQL_MESSAGE; goto error; };
 
+  if (not sys_dir_is_allowed ('.'))
+    goto error;
+
   _all := sys_dirlist ('.', 1);
   s_root := server_root ();
 
diff --git a/binsrc/vsp/admin/admin_dav/admin_footer.vsp b/binsrc/vsp/admin/admin_dav/admin_footer.vsp
index 697cad9..8eaba54 100644
--- a/binsrc/vsp/admin/admin_dav/admin_footer.vsp
+++ b/binsrc/vsp/admin/admin_dav/admin_footer.vsp
@@ -1 +1 @@
-<hr><div class="copyright"><small>Virtuoso management interface. Copyright © 1998-2010 OpenLink Software</small></div>
+<hr><div class="copyright"><small>Virtuoso management interface. Copyright © 1998-2011 OpenLink Software</small></div>
diff --git a/binsrc/vsp/admin/admin_dav/vfs.sql b/binsrc/vsp/admin/admin_dav/vfs.sql
index c459ee0..1a2f92a 100644
--- a/binsrc/vsp/admin/admin_dav/vfs.sql
+++ b/binsrc/vsp/admin/admin_dav/vfs.sql
@@ -1,7 +1,7 @@
 --
 --  vfs.sql
 --
---  $Id: vfs.sql,v 1.10.2.13 2010/07/06 10:43:12 source Exp $
+--  $Id: vfs.sql,v 1.10.2.23 2011/03/23 12:05:12 source Exp $
 --
 --  Site-copy robot.
 --  
@@ -83,12 +83,13 @@ create procedure WS.WS.COPY_PAGE_1 (in _host varchar, in _urls any, in _root var
   declare _header, _etag, _http_resp_code, _start_url varchar;
   declare _del, _desc, _t_urls, _opts, _c_type varchar;
   declare _dav_method, _d_imgs, _opage varchar;
-  declare _dav_enabled, _other varchar;
+  declare _dav_enabled, _other, ua varchar;
   declare dt, redir_flag, store_flag, try_to_get_rdf integer;
   declare _since datetime;
-  declare _udata, ext_hook, store_hook, _header_arr, _resps any;
-  declare n_urls int;
+  declare _udata, ext_hook, store_hook, _header_arr, _resps, xp_exp any;
+  declare n_urls, conv_html, is_sitemap, accept_rdf int;
 
+  conv_html := 1;
   n_urls := position (0, _urls) - 1;
   if (n_urls < 0)
     n_urls := length (_urls);
@@ -96,10 +97,12 @@ create procedure WS.WS.COPY_PAGE_1 (in _host varchar, in _urls any, in _root var
   whenever not found goto nf_opt;
   select VS_NEWER, VS_OPTIONS, coalesce (VS_METHOD, ''), VS_URL, VS_SRC, coalesce (VS_OPAGE, ''),
          coalesce (VS_REDIRECT, 1), coalesce (VS_STORE, 1), coalesce (VS_DLOAD_META, 0), 
-	 deserialize (VS_UDATA), VS_EXTRACT_FN, VS_STORE_FN, coalesce (VS_DEL, ''), coalesce (VS_OTHER, '')
+	 deserialize (VS_UDATA), VS_EXTRACT_FN, VS_STORE_FN, coalesce (VS_DEL, ''), coalesce (VS_OTHER, ''), 
+	 VS_CONVERT_HTML, VS_IS_SITEMAP, VS_XPATH, VS_ACCEPT_RDF
       into _since, _opts, _dav_method, _start_url, _d_imgs, _opage, 
       	 redir_flag, store_flag, try_to_get_rdf, 
-	 _udata, ext_hook, store_hook, _del, _other
+	 _udata, ext_hook, store_hook, _del, _other, 
+	 conv_html, is_sitemap, xp_exp, accept_rdf
       from VFS_SITE where VS_HOST = _host and VS_ROOT = _root;
 nf_opt:
 
@@ -110,8 +113,15 @@ nf_opt:
   if (_upd = 1 and _since is not null)
     _header := concat (_header, 'If-Modified-Since: ', soap_print_box (_since, '', 1), '\r\n');
 
-  if (try_to_get_rdf)
-    _header := _header || 'Accept: application/rdf+xml, text/rdf+n3, */*\r\n';
+  if (accept_rdf)
+    _header := _header || 'Accept: application/rdf+xml, text/n3, text/rdf+n3, */*\r\n'; -- /* rdf formats */
+  -- global setting for crawler UA  
+  ua := registry_get ('vfs_ua');
+  if (isstring (ua) and length (ua))
+    {
+      ua := trim (ua, ' \r\n');
+      _header := _header || 'User-Agent: ' || ua || '\r\n';
+    }
 
   if (_upd = 1)  
     {
@@ -152,7 +162,7 @@ nf_opt:
 	}
       dav_urls := WS.WS.DAV_PROP (WS.WS.MAKE_URL (_host, _url), _d_imgs, _header);
       lev := coalesce ((select VQ_LEVEL from VFS_QUEUE where VQ_HOST = _host and VQ_ROOT = _root and VQ_URL = _url), 0);
-      WS.WS.GET_URLS (_host, _url, _root, dav_urls, lev + 1);
+      WS.WS.GET_URLS (_host, _url, _root, dav_urls, lev + 1, null);
     }
 
 html_mode:
@@ -192,6 +202,14 @@ get_again:
       {
 	declare _resp, _content any;
         _content := http_get (_t_urls[0], _resp, 'GET', case when _upd = 1 then _header_arr[0] else _header_arr end);
+	-- when single request we can check here and re-try if no header is received
+	if (isarray(_resp) and length (_resp) and not isstring (_resp [0]))
+	  {
+	    if (retr <= 0)
+	      signal ('2E000', 'Bad header received');
+	    else
+	      goto get_again;
+	  }
 	_resps := vector (vector (_content, _resp));
       }
   else
@@ -229,24 +247,10 @@ get_again:
 	  new_host := ht[1];
 	  ht[0] := ''; ht[1] := ''; 
 	  new_url := VFS_URI_COMPOSE (ht);
-	  if (_host = new_host)
-	    {
+	  if (_host <> new_host)
+	    new_url := new_loc;
 	      insert soft VFS_QUEUE (VQ_HOST, VQ_ROOT, VQ_URL, VQ_STAT, VQ_TS, VQ_LEVEL) 
 		  values (_host, _root, new_url, 'waiting', now (), lev + 1);
-	    }
-	  else if (_other = 'checked')
-	    {
-	      if (ext_hook is not null and __proc_exists (ext_hook))
-		{
-		  WS.WS.SITEMAP_ENSURE_NEW_SITE (_host, _root, new_host, new_url); 
-	        }
-	      else
-		{
-	          WS.WS.VFS_ENSURE_NEW_SITE (_host, _root, new_host, new_url);
-		}
-	      insert soft VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_OTHER, VQ_LEVEL)
-		  values (new_host, now (), new_url, 'waiting', new_host, 'other', lev + 1);
-    }
 	  goto end_crawl;
   }
 
@@ -257,14 +261,15 @@ get_again:
     {
       if (ext_hook is not null and __proc_exists (ext_hook))
 	    call (ext_hook) (_host, _url, _root, _content, _c_type, lev + 1);
-	  else if ((_url like '%.htm%' or _url like '%/' or _c_type like 'text/html%') and _dav_method <> 'checked' and _opage <> 'checked')
-	    WS.WS.GET_URLS (_host, _url, _root, _content, lev + 1);
+	  else if ((_url like '%.htm%' or _url like '%/' or _c_type like 'text/html%' or _c_type like 'application/%xml' or _c_type = 'text/xml' or _url like '%.xml' or _url like '%.xml.gz') 
+	      and _dav_method <> 'checked' and _opage <> 'checked')
+	    WS.WS.GET_URLS (_host, _url, _root, _content, lev + 1, _c_type);
 
       if (store_hook is not null and __proc_exists (store_hook))
 	    call (store_hook) (_host, _url, _root, _content, _etag, _c_type, store_flag, _udata, lev + 1);
       else 
 	{
-      WS.WS.LOCAL_STORE (_host, _url, _root, _content, _etag, _c_type, store_flag);
+	      WS.WS.LOCAL_STORE (_host, _url, _root, _content, _etag, _c_type, store_flag, conv_html);
       if (try_to_get_rdf)
         WS.WS.VFS_EXTRACT_RDF (_host, _root, _start_url, _udata, _url, _content, _c_type, _header, _resp);
     }
@@ -296,15 +301,43 @@ create procedure WS.WS.DELETE_LOCAL_COPY (in _host varchar, in _url varchar, in
 }
 ;
 
+create procedure WS.WS.VFS_RUN (in url varchar, in threads int := null, in batch_size int := 1, in fn varchar := null, in dta any := null)
+{
+  declare h, host, s_url, root_collection  any;
+  h := rfc1808_parse_uri (url);
+  host := h[1];
+  s_url := h[2];
+  root_collection := (select top 1 VS_ROOT from WS.WS.VFS_SITE where VS_HOST = host and VS_URL = s_url);
+  WS.WS.SERV_QUEUE_TOP (host, root_collection, 0, 0, fn, dta, threads, batch_size);
+}
+;
+
+create procedure WS.WS.VFS_STATUS_GET (in _tgt varchar, in _root varchar)
+{
+  declare rc any;
+  rc := registry_get (sprintf ('__VFS_%s_%s', _tgt, _root));
+  if (not isstring (rc))
+    rc := 'not started';
+  return rc;  
+}
+;
+
+create procedure WS.WS.VFS_STATUS_SET (in _tgt varchar, in _root varchar, in _stat varchar)
+{
+  return registry_set (sprintf ('__VFS_%s_%s', _tgt, _root), _stat);
+}
+;
 
 -- /* top level procedure for processing queues */
 create procedure WS.WS.SERV_QUEUE_TOP (in _tgt varchar, in _root varchar, in _upd integer,
-    in _dbg integer, in _fn varchar, in _clnt_data any, in threads int := 1, in batch_size int := 1)
+    in _dbg integer, in _fn varchar, in _clnt_data any, in threads int := null, in batch_size int := 1)
 {
   declare _msg, _stat, oq varchar;
 do_again:
   _stat := '00000';
   _msg := '';
+  WS.WS.VFS_STATUS_SET (_tgt, _root, 'running');
+  commit work;
   exec ('WS.WS.SERV_QUEUE (?, ?, ?, ?, ?, ?, ?, ?)', _stat, _msg,
       vector (_tgt, _root, _upd, _dbg, _fn, _clnt_data, threads, batch_size));
   if (_stat = '40001')
@@ -312,31 +345,15 @@ do_again:
       rollback work;
       goto do_again;
     }
-  commit work;
-  oq := (select DB.DBA.VECTOR_AGG (vector (HOST, ROOT)) from (select distinct VQ_HOST as HOST, VQ_ROOT as ROOT 
-  	from VFS_QUEUE where VQ_STAT = 'waiting' and VQ_OTHER = 'other') x);
-  commit work;
-do_again1:  
-  foreach (any elm in oq) do
-    {
-      _stat := '00000';
-      _msg := '';
-      exec ('WS.WS.SERV_QUEUE (?, ?, ?, ?, ?, ?, ?, ?)', _stat, _msg,
-	  vector (elm[0], elm[1], _upd, _dbg, _fn, _clnt_data, threads, batch_size));
-      if (_stat = '40001')
-	{
-	  rollback work;
-	  goto do_again1;
-	}
-      commit work;
-    }
-  oq := (select DB.DBA.VECTOR_AGG (vector (HOST, ROOT)) from (select distinct VQ_HOST as HOST, VQ_ROOT as ROOT 
-  	from VFS_QUEUE where VQ_STAT = 'waiting' and VQ_OTHER = 'other') x);
-  if (length (oq) > 0)
+  if (_stat <> '00000')
     {
-      commit work;
-      goto do_again1;
-    }    
+      WS.WS.VFS_STATUS_SET (_tgt, _root, 'error');
+      signal (_stat, _msg);
+    }
+  commit work;
+  if (WS.WS.VFS_STATUS_GET (_tgt, _root) = 'running' and 
+      not exists (select 1 from WS.WS.VFS_QUEUE where VQ_STAT = 'waiting' and VQ_HOST = _tgt and VQ_ROOT = _root))
+    WS.WS.VFS_STATUS_SET (_tgt, _root, 'done');
   --dbg_obj_print ('COMPLETED WITH STATUS: ', _stat, ' ', _msg);
 }
 ;
@@ -346,33 +363,40 @@ do_again1:
 -- /* processing crawler queue */
 -- _upd 0:init, 1:update site; _dbg 0:normal, 1:retrieve only one entry and stop, 2:retrieve options
 --                                  3:send retrieved status to http client
-create procedure WS.WS.SERV_QUEUE (in __tgt varchar, in __root varchar, in _upd integer,
-    in _dbg integer, in _fn varchar, in _clnt_data any, in nthreads int := 1, in batch_size int := 1)
+create procedure WS.WS.SERV_QUEUE (in _tgt varchar, in _root varchar, in _upd integer,
+    in _dbg integer, in _fn varchar, in _clnt_data any, in nthreads int := null, in batch_size int := 1)
 {
   declare _total, active_thread integer;
   declare _rc integer;
   declare _tgt_url varchar;
   declare url_fn varchar;
   declare _last_shut integer;
-  declare _tgt, _root varchar;
   declare _next_url varchar;
   declare _dav_method varchar;
   declare aq_list, aq, url_batch any;
   declare err any;
-  declare pid int;
+  declare pid, thr_conf, care_bot int;
 
   _total := 0;
-  _tgt := __tgt;
-  _root := __root;
   registry_set ('WEB_COPY', 'X __sequence_set (''WEB_COPY_SSHUT'', datediff (''second'', stringdate (''1980-01-01''), now ()), 0)');
-  _last_shut := coalesce (sequence_set ('WEB_COPY_SSHUT', 0, 2), 0);
-
-  update WS.WS.VFS_QUEUE set VQ_STAT = 'waiting'
-      where VQ_STAT = 'pending' and (VQ_TS is null or datediff ('second', stringdate ('1980-01-01'), VQ_TS) < _last_shut);
+  --_last_shut := coalesce (sequence_set ('WEB_COPY_SSHUT', 0, 2), 0);
+  --update WS.WS.VFS_QUEUE set VQ_STAT = 'waiting'
+  --    where VQ_STAT = 'pending' and (VQ_TS is null or datediff ('second', stringdate ('1980-01-01'), VQ_TS) < _last_shut);
+  --commit work;
+  WS.WS.VFS_RECOVER_QUEUE_STAT (_tgt, _root);
   commit work;
 
   whenever not found goto n_site;
-  select VS_URL, VS_METHOD into _tgt_url, _dav_method from VFS_SITE where VS_HOST = _tgt and VS_ROOT = _root;
+  select VS_URL, VS_METHOD, VS_THREADS, VS_BOT 
+      into _tgt_url, _dav_method, thr_conf, care_bot 
+      from VFS_SITE where VS_HOST = _tgt and VS_ROOT = _root with (exclusive);
+  if (thr_conf is not null and thr_conf > 0)
+    nthreads := thr_conf;
+  if (nthreads is null or nthreads < 0)
+    nthreads := 1;
+  if (care_bot)  
+    VFS_ROBOTS_GET (_tgt, _root);
+  commit work;
   -- if it is an update 
   if (_upd = 1)
     {
@@ -418,6 +442,8 @@ create procedure WS.WS.SERV_QUEUE (in __tgt varchar, in __root varchar, in _upd
 	    goto fn_end;
 	  };
 	found_one := 0; ndone := 0;
+	if (WS.WS.VFS_STATUS_GET (_tgt, _root) = 'stopped')
+	  goto fn_end;
 	for (declare i int, i := 0; i < batch_size; i := i + 1)
 	      {
 	     _rc := call (url_fn) (_tgt, _root, _next_url, _clnt_data);
@@ -497,9 +523,9 @@ create procedure ERR_MAIL_SEND (in _tgt varchar, in _urls varchar, in _root varc
 
 create procedure WS.WS.LOCAL_STORE (in _host varchar, in _url varchar, in _root varchar,
                               inout _content varchar, in _s_etag varchar, in _c_type varchar,
-			      in store_flag int := 1)
+			      in store_flag int := 1, in conv_html int := 1)
 {
-  declare _name, _perms, _etag, _idx, _type, _e_etag, _sl, _opage varchar;
+  declare _name, _perms, _etag, _idx, _type, _e_etag, _sl, _opage, _path_str varchar;
   declare _own, _col_id, _grp, _res_id integer;
   declare _path any;
 
@@ -517,10 +543,13 @@ create procedure WS.WS.LOCAL_STORE (in _host varchar, in _url varchar, in _root
     _sl := '';
   else
     _sl := '/';
-  if (aref (_url, length (_url) - 1) = ascii('/'))
-    _path := WS.WS.HREF_TO_ARRAY (concat(_sl, _root, _url,'index.html'),'');
-  else
-    _path := WS.WS.HREF_TO_ARRAY (concat(_sl, _root, _url),'');
+  _path_str := _url;
+  if (_path_str like '%/')
+    _path_str := _path_str || 'index.html';
+  if (_path_str like 'http://%')
+    _path_str := subseq (_path_str, 5);  
+  _path_str := _sl || _root || _path_str;  
+  _path := WS.WS.HREF_TO_ARRAY (_path_str, '');
   _path := WS.WS.FIXPATH (_path);
   if (_own is not null and _own > 0)
     {
@@ -551,22 +580,23 @@ default_s:
 not_res:
       if (_res_id is null or _res_id = 0)
 	{
+	  _res_id := GETID ('R');
 	  if (__tag (_content) = 185) -- string session
 	    {
 	      insert into SYS_DAV_RES (RES_ID, RES_NAME, RES_CONTENT, RES_TYPE,
 		  RES_PERMS, RES_OWNER, RES_GROUP, RES_CR_TIME, RES_MOD_TIME, RES_COL)
-		  values (getid ('R'), _name, _content, _type, _perms, _own, _grp, now (), now (), _col_id);
+		  values (_res_id, _name, _content, _type, _perms, _own, _grp, now (), now (), _col_id);
 	    }
 	  else
 	    {
 	      insert into SYS_DAV_RES (RES_ID, RES_NAME, RES_CONTENT, RES_TYPE,
 		  RES_PERMS, RES_OWNER, RES_GROUP, RES_CR_TIME, RES_MOD_TIME, RES_COL)
-		  values (getid ('R'), _name, WS.WS.REPLACE_HREF (_host, _url, _root, _content, _type),
+		  values (_res_id, _name, WS.WS.REPLACE_HREF (_host, _url, _root, _content, _type, conv_html),
 		      _type, _perms, _own, _grp, now (), now (), _col_id);
 	    }
 
-	  insert replacing VFS_URL (VU_HOST, VU_URL, VU_CHKSUM, VU_CPTIME, VU_ETAG, VU_ROOT)
-	      values (_host, _url, md5 (_content), now (), _s_etag, _root);
+	  insert replacing VFS_URL (VU_HOST, VU_URL, VU_CHKSUM, VU_CPTIME, VU_ETAG, VU_ROOT, VU_RES_ID)
+	      values (_host, _url, md5 (_content), now (), _s_etag, _root, _res_id);
 	}
       else if (_res_id > 0)
 	{
@@ -582,7 +612,7 @@ no_chksum:
 		}
 	      else
 		{
-		  update SYS_DAV_RES set RES_CONTENT = WS.WS.REPLACE_HREF (_host, _url, _root, _content, _type),
+		  update SYS_DAV_RES set RES_CONTENT = WS.WS.REPLACE_HREF (_host, _url, _root, _content, _type, conv_html),
 			 RES_MOD_TIME = now () where RES_ID = _res_id;
 		}
 
@@ -590,8 +620,8 @@ no_chksum:
 		update VFS_URL set VU_CHKSUM = md5 (_content), VU_CPTIME = now (), VU_ETAG = _s_etag
 		    where VU_HOST = _host and VU_URL = _url and VU_ROOT = _root;
 	      else
-		insert replacing VFS_URL (VU_HOST, VU_URL, VU_CHKSUM, VU_CPTIME, VU_ETAG, VU_ROOT)
-		    values (_host, _url, md5 (_content), now (), _s_etag, _root);
+		insert replacing VFS_URL (VU_HOST, VU_URL, VU_CHKSUM, VU_CPTIME, VU_ETAG, VU_ROOT, VU_RES_ID)
+		    values (_host, _url, md5 (_content), now (), _s_etag, _root, _res_id);
 	    }
 	}
    }
@@ -601,94 +631,144 @@ err_end:
 ;
 
 
-create procedure WS.WS.GET_URLS (in _host varchar, in _url varchar, in _root varchar, inout _content varchar, in lev int)
+create procedure WS.WS.GET_URLS (in _host varchar, in _url varchar, in _root varchar, inout _content varchar, in lev int, in ctype varchar)
 {
-  declare _stag, _etag, _len, _inx, _htag, _sltag, _count, _t_tag1, _t_tag2, _uri_len integer;
-  declare _cut_pos integer;
-  declare _tmp, _tmp_host, _tmp_url, _t_len, _d_imgs, _other varchar;
-  declare _uri any;
-  declare _flw, _nflw, _method, _delete varchar;
+  declare _stag, _etag, _len, _inx, _htag, _sltag, _count, _t_tag1, _t_tag2, _urls_arr_len, depth integer;
+  declare _tmp, _tmp_host, _tmp_url, _t_len, _d_imgs, _other, _start_url varchar;
+  declare _flw, _nflw, _method, _delete, xp_exp, base, robots, care_of_bot varchar;
   declare _newer datetime;
   declare _own integer;
-  declare frames any;
+  declare frames, _urls_arr any;
 
-  whenever not found goto nf_img;
-  select VS_SRC, VS_OTHER, VS_OWN, VS_METHOD, VS_FOLLOW, VS_NFOLLOW, VS_DEL, VS_NEWER
-      into _d_imgs, _other, _own, _method, _flw, _nflw, _delete, _newer
+  if (WS.WS.SITEMAP_PROCESS (_host, _url, _root, _content, ctype, lev))
+    return;
+
+  whenever not found goto no_site_rec;
+  select VS_SRC, VS_OTHER, VS_OWN, VS_METHOD, VS_FOLLOW, VS_NFOLLOW, VS_DEL, VS_NEWER, VS_XPATH, VS_DEPTH, VS_URL, VS_ROBOTS, VS_BOT
+      into _d_imgs, _other, _own, _method, _flw, _nflw, _delete, _newer, xp_exp, depth, _start_url, robots, care_of_bot
       from VFS_SITE where VS_HOST = _host and VS_ROOT = _root;
   --dbg_obj_print ('OTHER SITES:', _other);
-nf_img:
+  if (depth is not null and depth >= 0 and lev > depth)
+    return;
   frames := vector ();
-  if (isstring (_content))
-    _uri := WS.WS.FIND_URI (_content, _d_imgs, _host, _url, frames);
-  else if (__tag (_content) = 193)
-    _uri := _content;
-  if (__tag (_uri) = 193 )
-    {
-      _uri_len := length (_uri);
-    }
+  if (__tag (_content) = 193)
+    _urls_arr := _content;
+  else
+    _urls_arr := WS.WS.FIND_URI (_content, _d_imgs, _host, _url, xp_exp, frames, ctype);
+
+  if (__tag (_urls_arr) = 193)
+    _urls_arr_len := length (_urls_arr);
   else
     return;
 
+  if (care_of_bot)
+    _nflw := cast (robots as varchar) || _nflw;
   if ((isstring (_flw) and length (_flw) > 0) or (isstring (_nflw) and length (_nflw) > 0))
     frames := vector ();
 
   _inx := 0;
-  while (_inx < _uri_len)
-    {
-      _tmp := aref (_uri, _inx);
-      if (_tmp is not null)
-	{
-	  _cut_pos := strstr (_tmp, '#');
-	  if (_cut_pos is not null)
+  base := WS.WS.VFS_URI_COMPOSE (vector ('http', _host, _url, '', '', ''));
+  while (_inx < _urls_arr_len)
 	    {
-	      if (0 <> _cut_pos)
-		_tmp := subseq (_tmp, 0, _cut_pos);
-	      else
-		_tmp := './';
-	    }
-	  _cut_pos := strstr (_tmp, '?');
-	  if (_cut_pos is not null)
-	    _tmp := subseq (_tmp, 0, _cut_pos);
-	  if (strcasestr (_tmp, 'ftp://') is null and strcasestr (_tmp, 'mailto:') is null
-	      and strcasestr (_tmp, 'news:') is null and strcasestr (_tmp, 'telnet://') is null
-	      and strcasestr (_tmp, 'https://') is null and _tmp <> 'http://')
+      declare hi, sch any;
+      _tmp := _urls_arr[_inx];
+
+      if (length (_tmp) = 0)
+	goto next_url;
+
+      _tmp := rfc1808_expand_uri (base, _tmp);
+      hi := rfc1808_parse_uri (_tmp);
+      sch := lower (hi[0]); 
+      if (sch = '') sch := 'http';
+      -- hi[4] := ''; if so prevents pages traversal
+      hi[5] := '';
+      _tmp := WS.WS.VFS_URI_COMPOSE (hi);
+
+      if (sch = 'http')
 	    {
-	      WS.WS.SPLIT_URL (_host, _url, _tmp, _tmp_host, _tmp_url);
+	  _tmp_host := hi[1]; -- host part
+	  hi[0] := ''; hi[1] := '';
+	  _tmp_url := WS.WS.VFS_URI_COMPOSE (hi);  -- local part & URL parameters
+	  if (_tmp_host <> _host)
+	    _tmp_url := _tmp;
 	      --dbg_obj_print ('LINK: ',_tmp_host,_tmp_url);
-	      if ((get_keyword (_tmp_url, frames) is not null or WS.WS.FOLLOW (_host, _root, _tmp_url))
-		  and _tmp_host = _host)
-		{
-		  select count (*) into _count from VFS_URL where
-		      VU_HOST = _tmp_host and VU_URL = _tmp_url and VU_ROOT = _root for update;
-		  if (_count is null or _count = 0)
-		    {
-		      select count (*) into _count from VFS_QUEUE where
-			  VQ_HOST = _tmp_host and VQ_URL = _tmp_url and VQ_ROOT = _root for update;
-		      if (_count is null or _count = 0)
+	  if ((get_keyword (_tmp_url, frames) is not null or WS.WS.FOLLOW (_host, _root, _tmp_url, _flw, _nflw, _start_url, _d_imgs)))
 			{
-			  insert into VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_LEVEL)
-			      values (_tmp_host, now (), _tmp_url, 'waiting', _root, lev);
-			}
-		    }
+	      insert soft VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_LEVEL)
+		  values (_host, now (), _tmp_url, 'waiting', _root, lev);
 		}
-	      else if (WS.WS.FOLLOW (_host, _root, _tmp_url) and _tmp_host <> _host and _other = 'checked')
-		{
-		  --dbg_obj_print ('ADD OTHER: ',_tmp_host, _tmp_url);
-		  WS.WS.VFS_ENSURE_NEW_SITE (_host, _root, _tmp_host, _tmp_url);
-		  -- If VS_OTHER is set to checked then will begin master download
-		  insert soft VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_OTHER, VQ_LEVEL)
-			      values (_tmp_host, now (), _tmp_url, 'waiting', _tmp_host, 'other', lev);
-		    }
 		}
-	    }
+      next_url:
       _inx := _inx + 1;
     }
+no_site_rec:  
   return;
 }
 ;
 
 
+create procedure WS.WS.SITEMAP_PROCESS (in _host varchar, in _url varchar, in _root varchar, inout _content varchar, in _c_type varchar, in lev int)
+{
+  declare xt, xp any;
+  xt := null;
+  declare exit handler for sqlstate '*'
+    {
+      rollback work;
+      return 0;
+    };
+  if (_url like '%.xml.gz')
+    {
+      if (length (_content) > 2)
+	{
+	  declare magic varchar;
+	  magic := subseq (_content, 0, 2);
+	  if (magic[0] = 0hex1f and magic[1] = 0hex8b) 
+	    _content := gzip_uncompress (_content);
+	}
+    }
+  if (_url like '%.xml' or _url like '%.xml.gz' or _c_type = 'text/xml' or _c_type = 'application/xml')
+    {
+      xt := xtree_doc (_content);
+      if (xpath_eval ('/urlset/dataset', xt) is not null)
+	{
+	  declare ts any;
+	  xp := xpath_eval ('/urlset/dataset/dataDumpLocation/text()', xt, 0);
+	  ts := xpath_eval ('/urlset/dataset/lastmod/text()', xt);
+	  if (ts is not null)
+	    {
+	      declare ar any;
+	      declare i int;
+	      i := 0;
+	      ts := cast (cast (ts as varchar) as datetime);
+	      ar := make_array (length (xp), 'any');
+	      foreach (any x in xp) do
+		{
+		  ar[i] := vector (cast (x as varchar), ts);
+		  i := i + 1;
+		}
+	      xp := ar;
+	    }
+	  WS.WS.SITEMAP_URLS_REGISTER (_host, _root, xp, lev, 0);
+	  return 1;
+	}
+      else if (xpath_eval ('/sitemapindex/sitemap/loc', xt) is not null)
+	{
+	  --xp := xpath_eval ('/sitemapindex/sitemap/loc/text()', xt, 0);
+	  xp := WS.WS.SITEMAP_GET_LOC (xt, '/sitemapindex/sitemap', './loc/text()', './lastmod/text()');
+	  WS.WS.SITEMAP_URLS_REGISTER (_host, _root, xp, lev, 0);
+	  return 1;
+	}
+      else if (xpath_eval ('/urlset/url/loc', xt) is not null)
+	{
+	  --xp := xpath_eval ('/urlset/url/loc/text()', xt, 0);
+	  xp := WS.WS.SITEMAP_GET_LOC (xt, '/urlset/url', './loc/text()', './lastmod/text()');
+	  WS.WS.SITEMAP_URLS_REGISTER (_host, _root, xp, lev, 1);
+	  return 1;
+	}
+    }
+  return 0;
+}
+;
 
 create procedure WS.WS.MAKE_URL (in _host varchar, in _url varchar)
 {
@@ -703,7 +783,7 @@ create procedure WS.WS.MAKE_URL (in _host varchar, in _url varchar)
 }
 ;
 
-
+-- obsolete function
 create procedure WS.WS.SPLIT_URL (in _host varchar, in _url varchar, in _parent_url varchar,
     out _o_host varchar, out _o_url varchar)
 {
@@ -854,31 +934,27 @@ not_found:
 ;
 
 
-create procedure WS.WS.FOLLOW (in _host varchar, in _root varchar, in _t_url varchar)
+create procedure WS.WS.FOLLOW (in _host varchar, in _root varchar, in _t_url varchar, in _flw_s varchar, in _nflw_s varchar, in _url varchar, in _img varchar)
 {
   declare _flw, _nflw any;
   declare _inx, _rc, _len integer;
-  declare _flw_s, _nflw_s, _cond, _url, _img varchar;
+  declare _cond varchar;
 
-  _img := null;
-  whenever not found goto not_ini;
-  select VS_FOLLOW, VS_NFOLLOW, VS_URL, VS_SRC into _flw_s, _nflw_s, _url, _img
-      from VFS_SITE where VS_HOST = _host and VS_ROOT = _root;
   -- first case
   if (_t_url = _url)
     return 1;
-not_ini:
 
-  if (_img is not null and substring (http_mime_type (_t_url), 1, 6) = 'image/')
+  if (_img is not null and substring (http_mime_type (_t_url), 1, 6) = 'image/' and _t_url not like 'http://%')
     return 1;
   else if (0 = length (_nflw_s) and 0 = length (_img) and substring (http_mime_type (_t_url), 1, 6) = 'image/')
     return 0;
 
-  if (_flw_s is null or _flw_s = '')
+  if (length (_flw_s) = 0)
     _flw_s := '/%';
 
-  if (_nflw_s is null or _nflw_s = '')
+  if (length (_nflw_s) = 0)
     _nflw_s := ('');
+
   _rc := 0;
   _flw := split_and_decode (_flw_s, 0, ';=;');
   if (_flw is null)
@@ -925,12 +1001,12 @@ end_step:
 
 
 create procedure WS.WS.REPLACE_HREF (in _host varchar, in _url varchar, in _root varchar,
-    in _content varchar, in _c_type varchar)
+    in _content varchar, in _c_type varchar, in conv_html int := 1)
 {
   declare _str, _tree, _tree_doc any;
   declare _tmp, _nhost, _nurl, _dav, _url_p varchar;
   declare _lp, _rp, _len, _tp, _break, _inx integer;
-  if (_c_type not like 'text/html%' or not isstring (_content))
+  if (_c_type not like 'text/html%' or not isstring (_content) or conv_html = 0)
     return _content;
 
   _str := string_output ();
@@ -957,27 +1033,46 @@ create procedure WS.WS.REPLACE_HREF (in _host varchar, in _url varchar, in _root
 
 
 create procedure WS.WS.FIND_URI (in _content varchar, in _d_imgs varchar,
-    in _host varchar, in _url varchar, out frames any)
+    in _host varchar, in _url varchar, in xp_exp varchar, out frames any, in ctype varchar)
 {
   declare _len, _inx integer;
   declare xe, arr, arr1, ha, sa, ia, fr, ifr, sty, js any;
-  declare elm, _tmp_host, _tmp_url varchar;
+  declare elm, _tmp_host, _tmp_url, base varchar;
   declare _xml_tree any;
 
   frames := vector ();
 
--- XXX: old behavior
---  return WS.WS.GET_HREF_IN_ARRAY (_content, _d_imgs);
-
-  if (not isstring (_content))
+  if (not isstring (_content) and __tag (_content) <> 185)
     return vector ();
 
+  if (tidy_external () and ctype like 'text/html')
+    _content := tidy_html (_content, 'output-xhtml:yes\r\ntidy-mark:no');
+  if (ctype like 'application/%+xml' or ctype = 'text/xml')
+    _xml_tree := xml_tree (_content, 0);
+  else  
   _xml_tree := xml_tree (_content, 2);
   if (__tag (_xml_tree) <> 193)
     return WS.WS.GET_HREF_IN_ARRAY (_content, _d_imgs);
 
   xe := xml_tree_doc (_xml_tree);
 
+  if (length (xp_exp))
+    {
+      arr := xpath_eval (xp_exp, xe, 0);
+      _inx := 0; _len := length (arr);
+      vectorbld_init (arr1);
+      while (_inx < _len)
+	{
+	  elm := cast (arr[_inx] as varchar);
+	  if (isstring (elm) and strstr (http_mime_type (elm), 'image/') is null or _d_imgs is not null)
+	    vectorbld_acc (arr1, elm);
+	  _inx := _inx + 1;
+	}
+      vectorbld_final (arr1);
+    }
+  else
+    {
+      arr1 := vector ();
   ha := xpath_eval ('//@href', xe, 0);
   sa := xpath_eval ('//@src', xe, 0);
   ia := xpath_eval ('//@background', xe, 0);
@@ -991,8 +1086,6 @@ create procedure WS.WS.FIND_URI (in _content varchar, in _d_imgs varchar,
 
   _inx := 0; _len := length (arr);
 
-  arr1 := vector ();
-
   while (_inx < _len)
     {
       elm := cast (arr[_inx] as varchar);
@@ -1016,14 +1109,22 @@ create procedure WS.WS.FIND_URI (in _content varchar, in _d_imgs varchar,
 
   fr := vector_concat (fr, ifr, sty, js);
   _inx := 0; _len := length (fr);
+      if (_len > 0)
+        base := WS.WS.VFS_URI_COMPOSE (vector ('http', _host, _url, '', '', ''));
   while (_inx < _len)
     {
+	  declare hi any;
       elm := cast (fr[_inx] as varchar);
-      WS.WS.SPLIT_URL (_host, _url, elm, _tmp_host, _tmp_url);
+	  elm := rfc1808_expand_uri (base, elm);
+	  hi := rfc1808_parse_uri (elm);
+	  _tmp_host := hi[1];
+	  hi[0] := ''; hi[1] := '';
+	  _tmp_url := WS.WS.VFS_URI_COMPOSE (hi);
       if (_host = _tmp_host)
         frames := vector_concat (frames, vector (_tmp_url, ''));
       _inx := _inx + 1;
     }
+    }
   return arr1;
 }
 ;
@@ -1152,6 +1253,8 @@ create procedure WS.WS.GET_HREF_IN_ARRAY (in _content varchar, in _d_imgs varcha
   declare _uri, _res any;
   declare _href_c integer;
 
+  if (not isstring (_content))
+    return vector ();
   _len := length (_content);
   _href_c := 0;
   _stag := 0;
@@ -1571,6 +1674,28 @@ done:
 }
 ;
 
+create procedure WS.WS.VFS_RECOVER_QUEUE_STAT (in host varchar, in coll varchar)
+{
+  declare next_url varchar;
+  declare last_ts datetime;
+  declare secs_last int;
+
+  secs_last := coalesce (sequence_set ('WEB_COPY_SSHUT', 0, 2), 0);
+  last_ts := dateadd ('second', secs_last, stringdate ('1980-01-01'));
+
+  whenever not found goto done;
+  declare cr cursor for select VQ_URL from WS.WS.VFS_QUEUE where VQ_HOST = host and VQ_ROOT = coll and VQ_STAT = 'pending' and VQ_TS < last_ts for update;
+  open cr;
+  while (1)
+    {
+      fetch cr into next_url;
+      update WS.WS.VFS_QUEUE set VQ_STAT = 'waiting' where VQ_HOST = host and VQ_ROOT = coll and VQ_URL = next_url;
+    }
+done:
+  close cr;
+}
+;
+
 
 --
 -- simple wrappers for command-line run
@@ -1645,6 +1770,7 @@ WS.WS.VFS_URI_COMPOSE (in res any)
 }
 ;
 
+-- /* run rdf import & sponger */
 create procedure WS.WS.VFS_EXTRACT_RDF (in _host varchar, in _root varchar, in _start_path varchar, in opts any, in url varchar, inout content any, in ctype varchar, inout outhdr any, inout inhdr any)
 {
   declare mime_type, _graph, _base, out_arr, tmp varchar;
@@ -1653,6 +1779,8 @@ create procedure WS.WS.VFS_EXTRACT_RDF (in _host varchar, in _root varchar, in _
 
   html_start := null;
 
+  _graph := get_keyword ('rdf-graph', opts);
+  if (length (_graph) = 0)
   _graph := WS.WS.MAKE_URL (_host, _start_path);
   _base := WS.WS.MAKE_URL (_host, url);
 
@@ -1661,14 +1789,23 @@ create procedure WS.WS.VFS_EXTRACT_RDF (in _host varchar, in _root varchar, in _
     return;
   };
 
+  if (url like '*.gz')
+    {
+      if (length (content) > 2)
+	{
+	  declare magic varchar;
+	  magic := subseq (content, 0, 2);
+	  if (magic[0] = 0hex1f and magic[1] = 0hex8b) 
+	    content := gzip_uncompress (content);
+	}
+    }
   -- RDF/XML or RDF/N3 depends on option
   mime_type := DB.DBA.RDF_SPONGE_GUESS_CONTENT_TYPE (url, ctype, content);
 
-  -- always true
-  if (1 and (get_keyword ('meta_rdf', opts, 0) = 1))
+  -- RDF formats 
     {
       if (strstr (mime_type, 'application/rdf+xml') is not null)
-        DB.DBA.RDF_LOAD_RDFXML (content, url, _graph);
+        DB.DBA.RDF_LOAD_RDFXML (content, _base, _graph);
       else if (
        strstr (mime_type, 'text/rdf+n3') is not null or
        strstr (mime_type, 'text/rdf+ttl') is not null or
@@ -1677,12 +1814,12 @@ create procedure WS.WS.VFS_EXTRACT_RDF (in _host varchar, in _root varchar, in _
        strstr (mime_type, 'application/turtle') is not null or
        strstr (mime_type, 'application/x-turtle') is not null
       )
-        DB.DBA.TTLP (content, url, _graph);
+        DB.DBA.TTLP (content, _base, _graph);
     }
 
   -- The rest is mappers work
   for select RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_OPTIONS from DB.DBA.SYS_RDF_MAPPERS, WS.WS.VFS_SITE_RDF_MAP
-    where RM_ENABLED = 1 and VM_RDF_MAP = RM_PID and VM_HOST = _host and VM_ROOT = _root
+    where VM_RDF_MAP = RM_PID and VM_HOST = _host and VM_ROOT = _root
     order by VM_SEQ
    do
     {
@@ -1693,7 +1830,7 @@ create procedure WS.WS.VFS_EXTRACT_RDF (in _host varchar, in _root varchar, in _
     }
       else if (RM_TYPE = 'URL' or RM_TYPE = 'HTTP')
     {
-	  val_match := url;
+	  val_match := _base;
     }
       else
 	val_match := null;
@@ -1709,18 +1846,16 @@ create procedure WS.WS.VFS_EXTRACT_RDF (in _host varchar, in _root varchar, in _
 	      goto try_next_mapper;
 	    };
 
-	  new_opts := RM_OPTIONS;
+	  new_opts := vector_concat (RM_OPTIONS, vector ('disable-clean', 'Y'));
 	  if (RM_TYPE <> 'HTTP')
         {
-	      rc := call (RM_HOOK) (_graph, url, null, content, aq, aq, RM_KEY, new_opts);
+	      rc := call (RM_HOOK) (_graph, _base, null, content, aq, aq, RM_KEY, new_opts);
 	}
           else
 	    {
 	      declare hf any;
 	      hf := rfc1808_parse_uri (url);
-	      hf[0] := '';
-	      hf[1] := '';
-	      hf[5] := '';
+	      hf[0] := ''; hf[1] := ''; hf[5] := '';
 	      tmp := 'GET '||WS.WS.VFS_URI_COMPOSE (hf)||' HTTP/1.1\r\nHost: ' || _host || '\r\n' || outhdr;
 	      tmp := replace (tmp, '\r', '\n');
 	      tmp := replace (tmp, '\n\n', '\n');
@@ -1755,9 +1890,13 @@ create procedure WS.WS.SITEMAP_ENSURE_NEW_SITE (in _host varchar, in _root varch
 
 create procedure WS.WS.SITEMAP_URLS_REGISTER (in _host varchar, in _root varchar, inout xp any, in lev int := 0, in sm int := 0)
 {
+  declare _flw_s, _nflw_s, _url, _img varchar;
+  whenever not found goto no_ini;
+  select VS_FOLLOW, VS_NFOLLOW, VS_URL, VS_SRC into _flw_s, _nflw_s, _url, _img
+      from VFS_SITE where VS_HOST = _host and VS_ROOT = _root;
   foreach (any u in xp) do
     {
-      declare hf, host, url varchar;
+      declare hf, host, url, abs_url varchar;
       declare ts datetime;
 
       ts := null;
@@ -1769,27 +1908,30 @@ create procedure WS.WS.SITEMAP_URLS_REGISTER (in _host varchar, in _root varchar
 	}
       else
       u := cast (u as varchar);
+      abs_url := u; -- check spec if sitemap can have relative urls
       hf := WS.WS.PARSE_URI (u);
       host := hf[1];
       hf [0] := '';
       hf [1] := '';
       hf [5] := ''; 
       url := WS.WS.VFS_URI_COMPOSE (hf);
-      if (WS.WS.FOLLOW (_host, _root, url))
-	{
-	  WS.WS.SITEMAP_ENSURE_NEW_SITE (_host, _root, host, url);
-	  if (not exists (select 1 from WS.WS.VFS_QUEUE where VQ_HOST = host and VQ_ROOT = _root and VQ_URL = url))
+      if (host <> _host)
+	url := abs_url;
+      if (WS.WS.FOLLOW (_host, _root, url, _flw_s, _nflw_s, _url, _img))
 	    {
-	      insert soft WS.WS.VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_OTHER, VQ_LEVEL, VQ_VIA_SITEMAP) 
-		  values (host, now (), url, 'waiting', _root, 'other', lev, sm); 
-	    }
-	  else
+	  insert soft WS.WS.VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_LEVEL, VQ_VIA_SITEMAP) 
+	      values (_host, now (), url, 'waiting', _root, lev, sm); 
+	  if (row_count () = 0)
 	    {
-	      update WS.WS.VFS_QUEUE set VQ_STAT = 'waiting' where VQ_HOST = host and VQ_ROOT = _root and VQ_URL = url and VQ_TS < ts;
+	      update WS.WS.VFS_QUEUE set VQ_STAT = 'waiting' where VQ_HOST = _host and VQ_ROOT = _root and VQ_URL = url and VQ_TS < ts;
 	    }
 	}
     }
+  if (length (xp))
+    update WS.WS.VFS_SITE set VS_IS_SITEMAP = 1 where VS_HOST = _host and VS_ROOT = _root and VS_IS_SITEMAP = 0;
   commit work;
+  no_ini:
+  return;
 }
 ;
 
@@ -1827,8 +1969,14 @@ create procedure WS.WS.SITEMAP_XML_PARSE (in _host varchar, in _url varchar, in
     };
   if (_url like '%.xml.gz')
     {
+      if (length (_content) > 2)
+	{
+	  declare magic varchar;
+	  magic := subseq (_content, 0, 2);
+	  if (magic[0] = 0hex1f and magic[1] = 0hex8b) 
       _content := gzip_uncompress (_content); 
     }
+    }
   if (_url like '%.xml' or _url like '%.xml.gz' or _c_type = 'text/xml' or _c_type = 'application/xml' or _c_type = 'application/sparql-results+xml')
     {
       xt := xtree_doc (_content);
@@ -1883,7 +2031,7 @@ create procedure WS.WS.SITEMAP_RDF_STORE (in _host varchar, in _url varchar, in
                               inout _content varchar, in _s_etag varchar, in _c_type varchar,
 			      in store_flag int := 1, in udata any := null, in lev int := 0)
 {
-  declare graph, url_ck, base varchar;
+  declare graph, use_tidy, url_ck, base varchar;
   graph := null;
   declare exit handler for sqlstate '*'
     {
@@ -1896,6 +2044,9 @@ create procedure WS.WS.SITEMAP_RDF_STORE (in _host varchar, in _url varchar, in
 
   if (isvector (udata) and isstring (get_keyword ('rdf-graph', udata)))
     graph := get_keyword ('rdf-graph', udata, '');
+  use_tidy := 'N';
+  if (isvector (udata) and isstring (get_keyword ('use-tidy', udata)))
+    use_tidy := get_keyword ('use-tidy', udata, 'N');
   base := WS.WS.VFS_URI_COMPOSE (vector ('http', _host, _url, '', '', ''));
   if (not length (graph))  
     graph := base;
@@ -1921,6 +2072,8 @@ create procedure WS.WS.SITEMAP_RDF_STORE (in _host varchar, in _url varchar, in
     }
   else if (_c_type = 'text/html')
     {
+      if (tidy_external () and use_tidy = 'Y')
+	_content := tidy_html (_content, 'output-xhtml:yes\r\ntidy-mark:no');
       DB.DBA.RDF_LOAD_RDFA (_content, base, graph, 2);
     }
   if (isvector (udata) and isvector (get_keyword ('follow-property', udata)))
@@ -1951,3 +2104,74 @@ create procedure WS.WS.SITEMAP_RDF_STORE (in _host varchar, in _url varchar, in
 }
 ;
 
+create procedure VFS_ROBOTS_PARSE (in txt varchar, in ua varchar)
+{
+  declare s any;
+  declare v1 any;
+  declare match, exact_match, fill int;
+  s := string_output ();
+  http (txt, s);
+  v1 := '';
+  while (1)
+    {
+      declare l, arr any;
+      next:	
+      l := ses_read_line (s, 0, 0, 1);
+      if (l = 0)
+	goto ex;
+      l := trim (l, '\r\n ');
+      arr := split_and_decode (l, 0, '\0\0:');
+      if (arr is null)
+	goto next;
+      if (lower (arr[0]) = 'user-agent')
+	{
+	  declare u any;
+	  u := trim (arr[1]);
+	  fill := 0;
+  	  if (match = 0 and exact_match = 0 and u = '*')
+	    {
+	      match := 1;
+	      fill := 1;
+	    }
+	  if (exact_match = 0 and u <> '*' and ua like u)
+	    {
+	      exact_match := 1;
+	      v1 := '';
+	      fill := 1;
+	    }
+	}
+      else if (fill and lower (arr[0]) = 'disallow')
+	{
+	  v1 := v1 || trim (arr[1]) || '%;';
+	}
+    }
+  ex:
+  v1 := trim (v1);
+  if (length (v1) = 0)
+    v1 := null;
+  return v1;
+}
+;
+
+create procedure VFS_ROBOTS_GET (in _host varchar, in _root varchar)
+{
+  declare url, ret, head, me, robots any;
+  url := vector ('http', _host, '/robots.txt', '', '', '');
+  url := vfs_uri_compose (url);
+  robots := null;
+  declare exit handler for sqlstate '*' 
+    {
+      goto en;
+    };
+  ret := DB.DBA.HTTP_CLIENT_EXT (url=>url, headers=>head, n_redirects=>5);
+  if (not isvector (head) or length (head) = 0 or head[0] not like 'HTTP/1._ 200 %')
+    goto en;
+  me := coalesce (cfg_item_value (virtuoso_ini_path (), 'HTTPServer', 'ClientIdString'), 
+  	'Mozilla/4.0 (compatible; OpenLink Virtuoso)');
+  robots := vfs_robots_parse (ret, me);
+  en:
+  update VFS_SITE set VS_ROBOTS = robots where VS_HOST = _host and VS_ROOT = _root;
+  return robots;
+}
+;
+
diff --git a/binsrc/vsp/admin/admin_dav/vfsddk.sql b/binsrc/vsp/admin/admin_dav/vfsddk.sql
index 1a50182..a8313bc 100644
--- a/binsrc/vsp/admin/admin_dav/vfsddk.sql
+++ b/binsrc/vsp/admin/admin_dav/vfsddk.sql
@@ -1,7 +1,7 @@
 --
 --  vfsddk.sql
 --
---  $Id: vfsddk.sql,v 1.5.2.6 2010/07/06 10:43:12 source Exp $
+--  $Id: vfsddk.sql,v 1.5.2.12 2011/03/08 13:39:52 source Exp $
 --
 --  Site-copy robot DB.
 --  
@@ -37,8 +37,10 @@ create table WS.WS.VFS_URL (
     VU_ETAG	varchar,
     VU_CPTIME	datetime,
     VU_OTHER	varchar,
+    VU_RES_ID   int,
     primary key (VU_HOST, VU_URL, VU_ROOT))
 create index VU_HOST_ROOT on WS.WS.VFS_URL (VU_HOST, VU_ROOT)
+create index VFS_URL_RES_ID on WS.WS.VFS_URL (VU_RES_ID)    
 ;
 
 
@@ -53,6 +55,7 @@ create table WS.WS.VFS_QUEUE (
     VQ_ERROR	long varchar,
     VQ_LEVEL	int default 0,
     VQ_VIA_SITEMAP int default 0,
+    VQ_DT	timestamp,
     primary key (VQ_HOST, VQ_URL, VQ_ROOT))
 create index VQ_HOST_ROOT on WS.WS.VFS_QUEUE (VQ_HOST, VQ_ROOT)
 create index VQ_HOST_TIME on WS.WS.VFS_QUEUE (VQ_HOST, VQ_ROOT, VQ_STAT, VQ_TS, VQ_URL)
@@ -85,6 +88,13 @@ create table WS.WS.VFS_SITE (
     VS_EXTRACT_FN  varchar,
     VS_STORE_FN  varchar,
     VS_DEPTH	int default null,
+    VS_CONVERT_HTML	int default 1,
+    VS_XPATH    long varchar,
+    VS_BOT	int default 1,
+    VS_IS_SITEMAP int default 0,
+    VS_ACCEPT_RDF int default 0,
+    VS_THREADS  int default 1,
+    VS_ROBOTS long varchar default null,
     primary key (VS_HOST, VS_ROOT))
 create index VS_HOST_ROOT on WS.WS.VFS_SITE (VS_HOST, VS_URL, VS_ROOT)
 ;
@@ -155,8 +165,35 @@ alter table WS.WS.VFS_SITE add VS_INST_ID  int
 alter table WS.WS.VFS_SITE add VS_DEPTH int default null
 ;
 
+alter table WS.WS.VFS_SITE add VS_CONVERT_HTML int default 1
+;
+
+alter table WS.WS.VFS_SITE add VS_XPATH long varchar
+;
+
+alter table WS.WS.VFS_SITE add VS_BOT int default 1
+;
+
+alter table WS.WS.VFS_SITE add VS_IS_SITEMAP int default 0
+;
+
+alter table WS.WS.VFS_SITE add VS_ACCEPT_RDF int default 0
+;
+
+alter table WS.WS.VFS_SITE add VS_THREADS int default 1
+;
+
+alter table WS.WS.VFS_SITE add VS_ROBOTS long varchar default null
+;
+
 alter table WS.WS.VFS_QUEUE add VQ_LEVEL int default 0
 ;
 
 alter table WS.WS.VFS_QUEUE add VQ_VIA_SITEMAP int default 0
 ;
+
+alter table WS.WS.VFS_QUEUE add VQ_DT timestamp
+;
+
+alter table WS.WS.VFS_URL add VU_RES_ID int
+;
diff --git a/binsrc/vsp/admin/admin_dsn_add_generic32.vsp b/binsrc/vsp/admin/admin_dsn_add_generic32.vsp
index ead0f98..232beaf 100644
--- a/binsrc/vsp/admin/admin_dsn_add_generic32.vsp
+++ b/binsrc/vsp/admin/admin_dsn_add_generic32.vsp
@@ -1,6 +1,6 @@
 <?vsp 
 --  
---  $Id: admin_dsn_add_generic32.vsp,v 1.3.2.1 2010/01/07 16:58:12 source Exp $
+--  $Id: admin_dsn_add_generic32.vsp,v 1.3.2.2 2011/02/03 10:35:34 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -140,7 +140,7 @@
 ?>
       <FORM method="POST" action="admin_dsn_add_generic32_2.vsp" name="gen32">
       <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="5">
-      <TR><TD COLSPAN="3" ALIGN="middle"><P CLASS="copyright_noalign"><?=_driver_de?><BR /><small>Copyright 1998-2010 OpenLink Software</small><BR /><small>All rights reserved</small></P></TD></TR>
+      <TR><TD COLSPAN="3" ALIGN="middle"><P CLASS="copyright_noalign"><?=_driver_de?><BR /><small>Copyright 1998-2011 OpenLink Software</small><BR /><small>All rights reserved</small></P></TD></TR>
       <TR><TD ROWSPAN="3" VALIGN="top"><IMG SRC="images/opl.jpg" BORDER="1" /></TD>
       <TD VALIGN="top">
 
diff --git a/binsrc/vsp/admin/admin_footer.vsp b/binsrc/vsp/admin/admin_footer.vsp
index 5b05236..52a959d 100644
--- a/binsrc/vsp/admin/admin_footer.vsp
+++ b/binsrc/vsp/admin/admin_footer.vsp
@@ -1,4 +1,4 @@
 <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
 <TR><TD CLASS="CopyrightBorder"><IMG SRC="/admin/images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR>
-<TR><TD><P CLASS="copyright">Virtuoso Universal Server (<?= sys_stat('st_dbms_ver') ?>) - Copyright© 1998-2010 OpenLink Software.  </P></TD></TR>
+<TR><TD><P CLASS="copyright">Virtuoso Universal Server (<?= sys_stat('st_dbms_ver') ?>) - Copyright© 1998-2011 OpenLink Software.  </P></TD></TR>
 </TABLE>
diff --git a/binsrc/vsp/admin/dbpump/comp_html.sql b/binsrc/vsp/admin/dbpump/comp_html.sql
index 1fd171b..419fe93 100644
--- a/binsrc/vsp/admin/dbpump/comp_html.sql
+++ b/binsrc/vsp/admin/dbpump/comp_html.sql
@@ -1,5 +1,5 @@
 --  
---  $Id: comp_html.sql,v 1.4.2.1 2010/01/07 16:58:12 source Exp $
+--  $Id: comp_html.sql,v 1.4.2.2 2011/02/03 10:35:34 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -223,7 +223,7 @@ create procedure "PUMP"."DBA"."HTML_FOOTER_OUT" ( inout arr any )
   http ('<TR><TD CLASS="CopyrightBorder" COLSPAN="2"><IMG SRC="/admin/images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR>');
   http ('<TR><TD ALIGN="right" COLSPAN="2"><P CLASS="Copyright">Virtuoso Server ');
   http (sys_stat('st_dbms_ver'));
-  http (' DBPUMP Interface - Copyright© 1998-2010 OpenLink Software.</P></TD></TR>');
+  http (' DBPUMP Interface - Copyright© 1998-2011 OpenLink Software.</P></TD></TR>');
   http ('</TABLE>\n</BODY>');
 }
 ;
diff --git a/binsrc/vsp/admin/debug/make_vad.sh b/binsrc/vsp/admin/debug/make_vad.sh
index 668e1e4..db4a7e2 100755
--- a/binsrc/vsp/admin/debug/make_vad.sh
+++ b/binsrc/vsp/admin/debug/make_vad.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#  $Id: make_vad.sh,v 1.9.2.1 2010/01/07 16:58:12 source Exp $
+#  $Id: make_vad.sh,v 1.9.2.2 2011/02/03 10:35:34 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -188,7 +188,7 @@ sticker_init() {
   echo "  <name package=\"http_debug\">" >> $STICKER
   echo "    <prop name=\"Title\" value=\"HTTP Level debug tool\"/>" >> $STICKER
   echo "    <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+  echo "    <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso\"/>" >> $STICKER
   echo "    <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso\"/>" >> $STICKER
   echo "  </name>" >> $STICKER
diff --git a/binsrc/vsp/bugsfixed.html b/binsrc/vsp/bugsfixed.html
index 014b098..938374a 100644
--- a/binsrc/vsp/bugsfixed.html
+++ b/binsrc/vsp/bugsfixed.html
@@ -4,7 +4,7 @@
 <LINK REL="stylesheet" TYPE="text/css" HREF="releasenotes.css" />
 	<TITLE>Bugs Fixed</TITLE>
 	<META NAME="AUTHOR" CONTENT="OpenLink Software">
-	<META NAME="COPYRIGHT" CONTENT="OpenLink Software, 1998-2010">
+	<META NAME="COPYRIGHT" CONTENT="OpenLink Software, 1999-2011">
 	<META NAME="KEYWORDS" CONTENT="Virtuoso;OpenLink;Database;UDA;Web Server">
 	<META NAME="GENERATOR" CONTENT="OpenLink designed XSLT sheets and XT">
 </HEAD>
@@ -98,6 +98,6 @@
 </UL>
 
 <BR />
-<DIV CLASS="vtabfoot"> - Copyright (C) 1998-2010 OpenLink Software - </DIV>
+<DIV CLASS="vtabfoot"> - Copyright 1998-2011, OpenLink Software - </DIV>
 </BODY>
 </HTML>
diff --git a/binsrc/vsp/demo-index.vsp b/binsrc/vsp/demo-index.vsp
index 5d90efb..f69210e 100644
--- a/binsrc/vsp/demo-index.vsp
+++ b/binsrc/vsp/demo-index.vsp
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <?vsp 
 --  
---  $Id: demo-index.vsp,v 1.3.2.1 2010/01/07 16:58:12 source Exp $
+--  $Id: demo-index.vsp,v 1.3.2.2 2011/02/03 10:35:33 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -206,7 +206,7 @@ direct access to  Virtuoso Servers.
 </TABLE>
 <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
 <TR CLASS="CopyrightBorder"><TD><IMG SRC="/admin/images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR>
-<TR><TD><P CLASS="copyright">Virtuoso Server <!--(<?= sys_stat('st_dbms_ver') ?>)--> Administration Interface - Copyright© 1998-2010 OpenLink Software.  </P></TD></TR>
+<TR><TD><P CLASS="copyright">Virtuoso Server <!--(<?= sys_stat('st_dbms_ver') ?>)--> Administration Interface - Copyright© 1998-2011 OpenLink Software.  </P></TD></TR>
 </TABLE>
 <!--?include admin/admin_footer.vsp ?-->
 </html>
diff --git a/binsrc/vsp/doc/docs.vsp b/binsrc/vsp/doc/docs.vsp
index 5d71e97..3962802 100644
--- a/binsrc/vsp/doc/docs.vsp
+++ b/binsrc/vsp/doc/docs.vsp
@@ -1,7 +1,7 @@
 <HTML>
 <?vsp 
 --  
---  $Id: docs.vsp,v 1.3.2.1 2010/01/07 16:58:12 source Exp $
+--  $Id: docs.vsp,v 1.3.2.2 2011/02/03 10:35:34 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -137,7 +137,7 @@ else
 <TABLE BORDER="0" WIDTH="100%">
 <TR><TD WIDTH="50"></TD>
 <TD WIDTH="80%">
-<DIV CLASS="copyright">Copyright© 1998-2010 OpenLink Software</DIV>
+<DIV CLASS="copyright">Copyright© 1998-2011 OpenLink Software</DIV>
 </TD>
 <TD WIDTH="50"/>
 </TR>
diff --git a/binsrc/vsp/index.html b/binsrc/vsp/index.html
index f71e4b5..6321c23 100644
--- a/binsrc/vsp/index.html
+++ b/binsrc/vsp/index.html
@@ -114,7 +114,7 @@
      </td>
     </tr>
     <tr><td id="copyright_ctr" colspan="2">
-	  Copyright © 1998-2010 OpenLink Software
+	  Copyright © 1998-2011 OpenLink Software
 	</td>
     </tr>
    </table>
diff --git a/binsrc/vsp/knownissues.html b/binsrc/vsp/knownissues.html
index 9d2f132..80fb323 100644
--- a/binsrc/vsp/knownissues.html
+++ b/binsrc/vsp/knownissues.html
@@ -4,7 +4,7 @@
 <LINK REL="stylesheet" TYPE="text/css" HREF="releasenotes.css" />
 	<TITLE>Release Notes</TITLE>
 	<META NAME="AUTHOR" CONTENT="OpenLink Software">
-	<META NAME="COPYRIGHT" CONTENT="OpenLink Software, 1999-2005">
+	<META NAME="COPYRIGHT" CONTENT="OpenLink Software, 1999-2011">
 	<META NAME="KEYWORDS" CONTENT="Virtuoso;OpenLink;Database;UDA;Web Server">
 	<META NAME="GENERATOR" CONTENT="OpenLink designed XSLT sheets and XT">
 </HEAD>
@@ -25,6 +25,6 @@ Virtuoso installation due to Windows interaction bug.</LI>
 <LI>Issue 2190: Entity references fail on certain XPath search expressions.</LI>
 </UL>
 
-<DIV CLASS="vtabfoot"> - Copyright 1998-2010, OpenLink Software - </DIV>
+<DIV CLASS="vtabfoot"> - Copyright 1998-2011, OpenLink Software - </DIV>
 </BODY>
 </HTML>
diff --git a/binsrc/vsp/newfeatures.html b/binsrc/vsp/newfeatures.html
index 8a36de6..a2f8d3e 100644
--- a/binsrc/vsp/newfeatures.html
+++ b/binsrc/vsp/newfeatures.html
@@ -671,7 +671,7 @@ Virtuoso 4.5 online tutorials</a> </font></td></tr></tbody></table>
 	Home</a><font color="#000000"> |  </font>
 	<img border="0" src="images/whats_17.gif"><a class="footer" accesskey="9" href="mailto:support at openlinksw.com">Technical 
 	Support</a><font color="#000000"> </font></font></div><div class="bottomCorners"> 
-		<p align="center"><font face="Verdana">Copyright 1998-2010 OpenLink Software. All Rights Reserved.</font></div></div></td>
+		<p align="center"><font face="Verdana">Copyright 1998-2011 OpenLink Software. All Rights Reserved.</font></div></div></td>
 	<td valign="top" width="6"><div class="contentWrapper_rightnav"> 
       <div class="content_Virtuoso_rightnav_graphic">
 	  <font face="Verdana"> <br> 
diff --git a/binsrc/vsp/releasenotes.html b/binsrc/vsp/releasenotes.html
index e982c52..723d5a9 100644
--- a/binsrc/vsp/releasenotes.html
+++ b/binsrc/vsp/releasenotes.html
@@ -7,7 +7,7 @@
 
   <meta name="AUTHOR" content="OpenLink Software">
 
-  <meta name="COPYRIGHT" content="OpenLink Software, 1999-2005">
+  <meta name="COPYRIGHT" content="OpenLink Software, 1999-2011">
 
   <meta name="KEYWORDS"
  content="Virtuoso;OpenLink;Database;UDA;Web Server">
diff --git a/binsrc/vsp/soapdemo/SOAP.html b/binsrc/vsp/soapdemo/SOAP.html
index 35ed4ab..61859e4 100644
--- a/binsrc/vsp/soapdemo/SOAP.html
+++ b/binsrc/vsp/soapdemo/SOAP.html
@@ -48,7 +48,7 @@ function clickit()
 </TABLE>
 <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0">
 <TR CLASS="copyrightborder"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR>
-<TR><TD><P CLASS="copyright">Virtuoso SOAP Test Interface - Copyright© 1998-2010 OpenLink Software.  </P></TD></TR>
+<TR><TD><P CLASS="copyright">Virtuoso SOAP Test Interface - Copyright© 1998-2011 OpenLink Software.  </P></TD></TR>
 </TABLE>
 
     <P>  <APPLET code="SOAP.class" name="sc"
diff --git a/binsrc/vsp/soapdemo/interop.html b/binsrc/vsp/soapdemo/interop.html
index e94295a..bebb03c 100644
--- a/binsrc/vsp/soapdemo/interop.html
+++ b/binsrc/vsp/soapdemo/interop.html
@@ -35,7 +35,7 @@
 <TR><TD>
         <P CLASS="copyright">Virtuoso Universal Server
           <!--(<?= sys_stat('st_dbms_ver') ?>)-->
-          Administration Interface - Copyright© 1998-2010 OpenLink Software.
+          Administration Interface - Copyright© 1998-2011 OpenLink Software.
         </P>
       </TD></TR>
 </TABLE>
diff --git a/binsrc/vsp/vsmx/msg.vspx b/binsrc/vsp/vsmx/msg.vspx
index 5ac434b..613dfcf 100644
--- a/binsrc/vsp/vsmx/msg.vspx
+++ b/binsrc/vsp/vsmx/msg.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -  
- -  $Id: msg.vspx,v 1.3.2.1 2010/01/07 16:58:12 source Exp $
+ -  $Id: msg.vspx,v 1.3.2.2 2011/02/03 10:35:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -406,7 +406,7 @@
 	  </tr>
 	</table>
       </v:form>
-      <div class="foot"><span class="foot">Virtuoso Universal Server <?V sys_stat('st_dbms_ver')?> - Copyright&copy; 1998-2010 OpenLink Software.</span></div>
+      <div class="foot"><span class="foot">Virtuoso Universal Server <?V sys_stat('st_dbms_ver')?> - Copyright&copy; 1998-2011 OpenLink Software.</span></div>
     </body>
   </html>
 </v:page>
diff --git a/binsrc/vsp/vsmx/oper.vspx b/binsrc/vsp/vsmx/oper.vspx
index 738c1d1..dd8aaf5 100644
--- a/binsrc/vsp/vsmx/oper.vspx
+++ b/binsrc/vsp/vsmx/oper.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -  
- -  $Id: oper.vspx,v 1.3.2.1 2010/01/07 16:58:12 source Exp $
+ -  $Id: oper.vspx,v 1.3.2.2 2011/02/03 10:35:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -118,7 +118,7 @@
 	</table>
       </v:form>
       <div class="foot">
-	<span class="foot">Virtuoso Universal Server <?V sys_stat('st_dbms_ver')?> - Copyright© 1998-2010 OpenLink Software.</span>
+	<span class="foot">Virtuoso Universal Server <?V sys_stat('st_dbms_ver')?> - Copyright© 1998-2011 OpenLink Software.</span>
       </div>
     </body>
   </html>
diff --git a/binsrc/vsp/vsmx/vsmx.vspx b/binsrc/vsp/vsmx/vsmx.vspx
index ed68824..db3d957 100644
--- a/binsrc/vsp/vsmx/vsmx.vspx
+++ b/binsrc/vsp/vsmx/vsmx.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -  
- -  $Id: vsmx.vspx,v 1.4.2.1 2010/01/07 16:58:12 source Exp $
+ -  $Id: vsmx.vspx,v 1.4.2.2 2011/02/03 10:35:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -73,7 +73,7 @@
 	</table>
       </v:form>
       <div class="foot">
-	<span class="foot">Virtuoso Universal Server <?V sys_stat('st_dbms_ver')?> - Copyright© 1998-2010 OpenLink Software.</span>
+	<span class="foot">Virtuoso Universal Server <?V sys_stat('st_dbms_ver')?> - Copyright© 1998-2011 OpenLink Software.</span>
       </div>
     </body>
   </html>
diff --git a/binsrc/vsp/vsp_auth.sql b/binsrc/vsp/vsp_auth.sql
index 2391aa8..2e63b83 100644
--- a/binsrc/vsp/vsp_auth.sql
+++ b/binsrc/vsp/vsp_auth.sql
@@ -2,7 +2,7 @@
 --
 --  vsp_auth.vsp
 --
---  $Id: vsp_auth.sql,v 1.2 2008/03/24 17:25:12 source Exp $
+--  $Id: vsp_auth.sql,v 1.2.2.2 2011/01/03 23:41:46 source Exp $
 --
 --  Virtuoso vsp stored procedures for digest and basic authentication
 --  
@@ -331,18 +331,6 @@ vsp_ua_match_hdr (inout lines any, in match_str varchar)
 
 
 
-create procedure
-vsp_ua_prop_init ()
-{
---  dbg_printf ('vsp_ua_prop_init');
-  return (vector ('has_basic_auth', 'has_digest_auth',
-		  'is_msie', 'has_frames',
-		  'has_tables', 'has_css1',
-		  'has_css2', 'has_xml',
-		  'browser_level', 'ua_platform',
-		  'is_robot', 'is_dav_client'));
-}
-;
 
 --!AWK PUBLIC
 create procedure
@@ -379,6 +367,19 @@ vsp_calculate_digest (in username varchar, in pass varchar, in auth_vec any)
 ;
 
 create procedure
+vsp_ua_prop_init ()
+{
+--  dbg_printf ('vsp_ua_prop_init');
+  return (vector ('has_basic_auth', 'has_digest_auth',
+		  'is_msie', 'has_frames',
+		  'has_tables', 'has_css1',
+		  'has_css2', 'has_xml',
+		  'browser_level', 'ua_platform',
+		  'is_robot', 'is_dav_client'));
+}
+;
+
+create procedure
 vsp_ua_vec_init ()
 {
   return (vector (
@@ -418,14 +419,14 @@ vsp_ua_vec_init ()
 			  2, 'Win32',
 			  'False', 'False'),
 		  'Mozilla/4.*Windows*',
-		  vector ('True', 'False',
+		  vector ('True', 'True',
 			  'False', 'True',
 			  'True', 'True',
 			  'False', 'False',
 			  4, 'Win32',
 			  'False', 'False'),
 		  'Mozilla/5.*Windows*',
-		  vector ('True', 'False',
+		  vector ('True', 'True',
 			  'False', 'True',
 			  'True', 'True',
 			  'False', 'True',
@@ -438,8 +439,15 @@ vsp_ua_vec_init ()
                           'False', 'False',
                           4, 'Linux',
                           'False', 'False'),
+		  'Mozilla/5.*AppleWebKit/5*',
+		  vector ('True', 'True',
+			  'False', 'True',
+			  'True', 'True',
+			  'True', 'True',
+			  5, 'NA',
+			  'False', 'False'),
                   'Mozilla/5.*Linux*',
-                  vector ('True', 'False',
+                  vector ('True', 'True',
                           'False', 'True',
                           'True', 'True',
                           'False', 'True',
@@ -453,7 +461,7 @@ vsp_ua_vec_init ()
                           4, 'Mac',
                           'False', 'False'),
                   'Mozilla/5.*Macintosh*',
-                  vector ('True', 'False',
+                  vector ('True', 'True',
                           'False', 'True',
                           'True', 'True',
                           'False', 'True',
@@ -494,6 +502,13 @@ vsp_ua_vec_init ()
 			  'False', 'False',
 			  0, 'NA',
 			  'False', 'False'),
+    		  'WebDAVFS/*',
+		  vector ('True', 'True',
+			  'False', 'True',
+			  'True',  'True',
+			  'False', 'False',
+			  0, 'Mac',
+			  'False', 'True'),
 		  '*',
 		  vector ('False', 'False',
 			  'False', 'False',
diff --git a/binsrc/vspx/Makefile.in b/binsrc/vspx/Makefile.in
index 691e295..161074b 100644
--- a/binsrc/vspx/Makefile.in
+++ b/binsrc/vspx/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/vspx/vspx.sql b/binsrc/vspx/vspx.sql
index 723a868..39b4d14 100644
--- a/binsrc/vspx/vspx.sql
+++ b/binsrc/vspx/vspx.sql
@@ -2,7 +2,7 @@
 --
 --  vspx.vsp
 --
---  $Id: vspx.sql,v 1.12.2.3 2010/04/22 14:13:25 source Exp $
+--  $Id: vspx.sql,v 1.12.2.4 2011/03/23 12:05:58 source Exp $
 --
 --  Virtuoso VSPX core componets classes
 --
@@ -2253,6 +2253,7 @@ vspx_result_row_render (in result any, in m_dta any, in inx int := 0, in cset va
 	  http ('<td class="resdata">  ');
 	  res_col := aref (res_row, jnx);
 	  col_type := aref (aref (dt_nfo, jnx), 1);
+	  again:
 	  if (__tag (res_col) = 193)
 	    http_value (concat ('(', vector_print (res_col), ')'));
 	  else if (__tag (res_col) = 230 and res_col is not null)
@@ -2262,6 +2263,13 @@ vspx_result_row_render (in result any, in m_dta any, in inx int := 0, in cset va
 	      http_value (res_col, NULL, ses);
 	      http_value (string_output_string (ses));
 	    }
+	  else if (__tag (res_col) = 246 and res_col is not null)
+	    {
+	      declare dat any;
+	      dat := __rdf_sqlval_of_obj (res_col, 1);
+	      res_col := dat;
+	      goto again;
+	    }
 	  else
 	    {
 	      if (__tag (res_col) = 182 and cset is not null)
diff --git a/binsrc/ws/Makefile.in b/binsrc/ws/Makefile.in
index ba9b23b..1f7cf6d 100644
--- a/binsrc/ws/Makefile.in
+++ b/binsrc/ws/Makefile.in
@@ -200,6 +200,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/ws/wsrm/Makefile.in b/binsrc/ws/wsrm/Makefile.in
index aba81bf..b40d097 100644
--- a/binsrc/ws/wsrm/Makefile.in
+++ b/binsrc/ws/wsrm/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/xddl/Makefile.in b/binsrc/xddl/Makefile.in
index 4244236..a229253 100644
--- a/binsrc/xddl/Makefile.in
+++ b/binsrc/xddl/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/yacutia/INSTALL b/binsrc/yacutia/INSTALL
index bf4c831..2b7993b 100644
--- a/binsrc/yacutia/INSTALL
+++ b/binsrc/yacutia/INSTALL
@@ -1,6 +1,6 @@
 --  install
 --
---  $Id: INSTALL,v 1.2 2006/10/23 22:27:26 source Exp $
+--  $Id: INSTALL,v 1.2.2.1 2010/09/20 10:16:34 source Exp $
 --
 --
 
diff --git a/binsrc/yacutia/Makefile.in b/binsrc/yacutia/Makefile.in
index 66a55ba..065c3a0 100644
--- a/binsrc/yacutia/Makefile.in
+++ b/binsrc/yacutia/Makefile.in
@@ -187,6 +187,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/binsrc/yacutia/account_create.vspx b/binsrc/yacutia/account_create.vspx
index 3513ebe..09e22eb 100644
--- a/binsrc/yacutia/account_create.vspx
+++ b/binsrc/yacutia/account_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: account_create.vspx,v 1.8.2.7 2010/07/05 14:59:29 source Exp $
+ -  $Id: account_create.vspx,v 1.8.2.8 2010/09/20 10:16:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/account_remove.vspx b/binsrc/yacutia/account_remove.vspx
index 6a97e4e..6345b4a 100644
--- a/binsrc/yacutia/account_remove.vspx
+++ b/binsrc/yacutia/account_remove.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: account_remove.vspx,v 1.2.2.1 2009/08/27 22:43:47 source Exp $
+ -  $Id: account_remove.vspx,v 1.2.2.2 2010/09/20 10:16:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/account_remove_inc.vspx b/binsrc/yacutia/account_remove_inc.vspx
index 13f0ab3..38e0759 100644
--- a/binsrc/yacutia/account_remove_inc.vspx
+++ b/binsrc/yacutia/account_remove_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: account_remove_inc.vspx,v 1.3.2.3 2009/08/28 13:05:20 source Exp $
+ -  $Id: account_remove_inc.vspx,v 1.3.2.4 2010/09/20 10:16:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/accounts.vspx b/binsrc/yacutia/accounts.vspx
index 8613fd1..2b80fb2 100644
--- a/binsrc/yacutia/accounts.vspx
+++ b/binsrc/yacutia/accounts.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: accounts.vspx,v 1.2.2.2 2009/08/28 13:05:20 source Exp $
+ -  $Id: accounts.vspx,v 1.2.2.5 2011/01/25 14:21:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -66,7 +66,7 @@
 		if (ds is not null)
 		  ds.vc_data_bind (e);
 	      ]]></v:method>
-    <table align="left">
+    <table class="listing_ctr">
       <tr>
         <td>
           <v:form name="sf" type="simple" action="" method="POST">
@@ -183,7 +183,7 @@
 				      ]]></v:on-post>
 			      </v:button>
 		   </th>
-                   <th>
+                   <th class="new_item">
                      <v:url name="account_create_ref"
                             format="%s"
                             value="--'Create New Account'"
diff --git a/binsrc/yacutia/accounts_page.vspx b/binsrc/yacutia/accounts_page.vspx
index 0e09690..117b6d7 100644
--- a/binsrc/yacutia/accounts_page.vspx
+++ b/binsrc/yacutia/accounts_page.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: accounts_page.vspx,v 1.2.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: accounts_page.vspx,v 1.2.2.3 2010/09/20 10:16:34 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/adm_login.vspx b/binsrc/yacutia/adm_login.vspx
index 6f5b86d..ef5f8fa 100644
--- a/binsrc/yacutia/adm_login.vspx
+++ b/binsrc/yacutia/adm_login.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: adm_login.vspx,v 1.4.2.2 2010/06/09 13:47:12 source Exp $
+ -  $Id: adm_login.vspx,v 1.4.2.3 2010/09/20 10:16:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/adm_navigation_bar.vspx b/binsrc/yacutia/adm_navigation_bar.vspx
index 7299c32..3010a46 100644
--- a/binsrc/yacutia/adm_navigation_bar.vspx
+++ b/binsrc/yacutia/adm_navigation_bar.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso8859-1"?>
 <!--
  -
- -  $Id: adm_navigation_bar.vspx,v 1.2.2.1 2009/08/27 22:43:47 source Exp $
+ -  $Id: adm_navigation_bar.vspx,v 1.2.2.3 2011/01/10 13:26:08 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -151,7 +151,7 @@
 	  </table>
 	  <?vsp
 	  if ((control as vspx_tree).vt_node = control and not length (childs)) { ?>
-	  <table width="100%"  border="0" cellpadding="0" cellspacing="0" id="nav_seperator">
+	  <table width="100%"  border="0" cellpadding="0" cellspacing="0" id="nav_separator">
 	      <tr><td> </td></tr>
 	  </table>
 	  <?vsp } ?>
diff --git a/binsrc/yacutia/back_nav.vspx b/binsrc/yacutia/back_nav.vspx
index 484d855..216c9f7 100644
--- a/binsrc/yacutia/back_nav.vspx
+++ b/binsrc/yacutia/back_nav.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: back_nav.vspx,v 1.2.2.1 2009/08/27 22:43:47 source Exp $
+ -  $Id: back_nav.vspx,v 1.2.2.2 2010/09/20 10:16:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/bpel_service.vspx b/binsrc/yacutia/bpel_service.vspx
index 1e9637d..3ded631 100644
--- a/binsrc/yacutia/bpel_service.vspx
+++ b/binsrc/yacutia/bpel_service.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: bpel_service.vspx,v 1.2.2.1 2009/08/27 22:43:47 source Exp $
+ -  $Id: bpel_service.vspx,v 1.2.2.2 2010/09/20 10:16:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/capabilities.vspx b/binsrc/yacutia/capabilities.vspx
index 6e57538..6aea8fb 100644
--- a/binsrc/yacutia/capabilities.vspx
+++ b/binsrc/yacutia/capabilities.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: capabilities.vspx,v 1.2.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: capabilities.vspx,v 1.2.2.4 2011/01/10 13:26:08 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -46,7 +46,7 @@
 		if (ds is not null)
 		  ds.vc_data_bind (e);
 	      ]]></v:method>
-      <table align="left">
+      <table class="listing_ctr">
         <tr>
           <td>
             <v:form name="cap_form" type="simple" action="accounts_page.vspx?page=3" method="POST">
diff --git a/binsrc/yacutia/caps_browser.vspx b/binsrc/yacutia/caps_browser.vspx
index 2a68d68..1dae158 100644
--- a/binsrc/yacutia/caps_browser.vspx
+++ b/binsrc/yacutia/caps_browser.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: caps_browser.vspx,v 1.4.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: caps_browser.vspx,v 1.4.2.3 2010/09/20 10:16:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/caps_cols_browser.vspx b/binsrc/yacutia/caps_cols_browser.vspx
index 80ffc26..98271c7 100644
--- a/binsrc/yacutia/caps_cols_browser.vspx
+++ b/binsrc/yacutia/caps_cols_browser.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: caps_cols_browser.vspx,v 1.2.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: caps_cols_browser.vspx,v 1.2.2.3 2010/09/20 10:16:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/cond_common.js b/binsrc/yacutia/cond_common.js
index 079d2ae..8ce4fd4 100644
--- a/binsrc/yacutia/cond_common.js
+++ b/binsrc/yacutia/cond_common.js
@@ -1,5 +1,5 @@
 /*
- *  $Id: cond_common.js,v 1.1.1.1.2.2 2009/08/28 13:05:21 source Exp $
+ *  $Id: cond_common.js,v 1.1.1.1.2.3 2010/09/20 10:16:35 source Exp $
  *
  *  Common (Java/ECMA)Script utilities for Yacutia
  *
diff --git a/binsrc/yacutia/cond_help.css b/binsrc/yacutia/cond_help.css
index 50a5403..fd06ef3 100644
--- a/binsrc/yacutia/cond_help.css
+++ b/binsrc/yacutia/cond_help.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: cond_help.css,v 1.2.2.1 2009/08/28 13:05:21 source Exp $
+ *  $Id: cond_help.css,v 1.2.2.2 2010/09/20 10:16:35 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/binsrc/yacutia/cond_help.html b/binsrc/yacutia/cond_help.html
index 0632cd3..1297169 100644
--- a/binsrc/yacutia/cond_help.html
+++ b/binsrc/yacutia/cond_help.html
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
  -
- -  $Id: cond_help.html,v 1.1.1.1.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: cond_help.html,v 1.1.1.1.2.3 2010/09/20 10:16:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/cond_help.xsl b/binsrc/yacutia/cond_help.xsl
index 64270fb..07c12b3 100644
--- a/binsrc/yacutia/cond_help.xsl
+++ b/binsrc/yacutia/cond_help.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1" ?>
 <!--
  -
- -  $Id: cond_help.xsl,v 1.2.2.1 2009/08/27 22:43:47 source Exp $
+ -  $Id: cond_help.xsl,v 1.2.2.2 2010/09/20 10:16:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/conductor.list b/binsrc/yacutia/conductor.list
index 5a2f539..e12a906 100644
--- a/binsrc/yacutia/conductor.list
+++ b/binsrc/yacutia/conductor.list
@@ -289,8 +289,10 @@ conductor/msg_news_groups.vspx
 conductor/msg_news_server_details.vspx
 conductor/msg_news_server_info.vspx
 conductor/page.xsl
+conductor/persistent_xmlns.vspx
 conductor/popup2_browser.vspx
 conductor/popup_browser.vspx
+conductor/rdf_conf.vspx
 conductor/rdf_console.vspx
 conductor/rdf_filters_pp.vspx
 conductor/rdf_filters.vspx
@@ -341,6 +343,7 @@ conductor/sys_queues_edit.vspx
 conductor/sys_queues_error.vspx
 conductor/sys_queues_remove.vspx
 conductor/sys_queues.vspx
+conductor/tbl.js
 conductor/text_triggers.vspx
 conductor/uddi_remove.vspx
 conductor/uddi_serv_browse.vspx
diff --git a/binsrc/yacutia/cont_management.vspx b/binsrc/yacutia/cont_management.vspx
index 67c485b..47d9564 100644
--- a/binsrc/yacutia/cont_management.vspx
+++ b/binsrc/yacutia/cont_management.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: cont_management.vspx,v 1.2.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: cont_management.vspx,v 1.2.2.3 2010/09/20 10:16:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/cont_management_types.vspx b/binsrc/yacutia/cont_management_types.vspx
index de7a158..bda6c3b 100644
--- a/binsrc/yacutia/cont_management_types.vspx
+++ b/binsrc/yacutia/cont_management_types.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: cont_management_types.vspx,v 1.2.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: cont_management_types.vspx,v 1.2.2.3 2010/09/20 10:16:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/cont_page.vspx b/binsrc/yacutia/cont_page.vspx
index 98d3e1a..39d80e5 100644
--- a/binsrc/yacutia/cont_page.vspx
+++ b/binsrc/yacutia/cont_page.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: cont_page.vspx,v 1.2.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: cont_page.vspx,v 1.2.2.3 2010/09/20 10:16:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/cont_type_edit.vspx b/binsrc/yacutia/cont_type_edit.vspx
index 8b3f4b8..48b8f81 100644
--- a/binsrc/yacutia/cont_type_edit.vspx
+++ b/binsrc/yacutia/cont_type_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: cont_type_edit.vspx,v 1.2.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: cont_type_edit.vspx,v 1.2.2.3 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/cont_type_remove.vspx b/binsrc/yacutia/cont_type_remove.vspx
index 545b22b..16cb6fa 100644
--- a/binsrc/yacutia/cont_type_remove.vspx
+++ b/binsrc/yacutia/cont_type_remove.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: cont_type_remove.vspx,v 1.2.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: cont_type_remove.vspx,v 1.2.2.3 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/dashboard.vspx b/binsrc/yacutia/dashboard.vspx
index 7f6aeaa..6ec4eb1 100644
--- a/binsrc/yacutia/dashboard.vspx
+++ b/binsrc/yacutia/dashboard.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: dashboard.vspx,v 1.2.2.1 2009/08/27 22:43:48 source Exp $
+ -  $Id: dashboard.vspx,v 1.2.2.2 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/dashboard_item.vspx b/binsrc/yacutia/dashboard_item.vspx
index 079f8b6..585c661 100644
--- a/binsrc/yacutia/dashboard_item.vspx
+++ b/binsrc/yacutia/dashboard_item.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: dashboard_item.vspx,v 1.2.2.1 2009/08/27 22:43:48 source Exp $
+ -  $Id: dashboard_item.vspx,v 1.2.2.2 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/dashboard_item_show.vspx b/binsrc/yacutia/dashboard_item_show.vspx
index 9932eab..c444fa9 100644
--- a/binsrc/yacutia/dashboard_item_show.vspx
+++ b/binsrc/yacutia/dashboard_item_show.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: dashboard_item_show.vspx,v 1.2.2.1 2009/08/27 22:43:48 source Exp $
+ -  $Id: dashboard_item_show.vspx,v 1.2.2.2 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/dashboard_item_show.xsl b/binsrc/yacutia/dashboard_item_show.xsl
index c6edf89..9879bcf 100644
--- a/binsrc/yacutia/dashboard_item_show.xsl
+++ b/binsrc/yacutia/dashboard_item_show.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1" ?>
 <!--
  -
- -  $Id: dashboard_item_show.xsl,v 1.2.2.1 2009/08/27 22:43:48 source Exp $
+ -  $Id: dashboard_item_show.xsl,v 1.2.2.2 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/databases.vspx b/binsrc/yacutia/databases.vspx
index 14b9d27..ec3f1d0 100644
--- a/binsrc/yacutia/databases.vspx
+++ b/binsrc/yacutia/databases.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: databases.vspx,v 1.7.2.3 2009/08/28 13:05:21 source Exp $
+ -  $Id: databases.vspx,v 1.7.2.4 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/databases_drop.vspx b/binsrc/yacutia/databases_drop.vspx
index 36f9dbe..87e4fba 100644
--- a/binsrc/yacutia/databases_drop.vspx
+++ b/binsrc/yacutia/databases_drop.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: databases_drop.vspx,v 1.4.2.3 2009/08/28 13:05:21 source Exp $
+ -  $Id: databases_drop.vspx,v 1.4.2.4 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/databases_export.vspx b/binsrc/yacutia/databases_export.vspx
index 121f8ad..e1c6cd8 100644
--- a/binsrc/yacutia/databases_export.vspx
+++ b/binsrc/yacutia/databases_export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: databases_export.vspx,v 1.3.2.3 2009/08/28 13:05:21 source Exp $
+ -  $Id: databases_export.vspx,v 1.3.2.4 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/databases_grants.vspx b/binsrc/yacutia/databases_grants.vspx
index ca2c9f9..4c94d11 100644
--- a/binsrc/yacutia/databases_grants.vspx
+++ b/binsrc/yacutia/databases_grants.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: databases_grants.vspx,v 1.2.2.3 2009/11/26 14:38:45 source Exp $
+ -  $Id: databases_grants.vspx,v 1.2.2.4 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/databases_proc_edit.vspx b/binsrc/yacutia/databases_proc_edit.vspx
index 9e87527..6cb41eb 100644
--- a/binsrc/yacutia/databases_proc_edit.vspx
+++ b/binsrc/yacutia/databases_proc_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: databases_proc_edit.vspx,v 1.3.2.5 2010/01/25 15:41:12 source Exp $
+ -  $Id: databases_proc_edit.vspx,v 1.3.2.6 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/databases_table_constraints.vspx b/binsrc/yacutia/databases_table_constraints.vspx
index d5d1966..bf5f41a 100644
--- a/binsrc/yacutia/databases_table_constraints.vspx
+++ b/binsrc/yacutia/databases_table_constraints.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: databases_table_constraints.vspx,v 1.2.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: databases_table_constraints.vspx,v 1.2.2.3 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/databases_table_edit.vspx b/binsrc/yacutia/databases_table_edit.vspx
index 138ff87..b9515e8 100644
--- a/binsrc/yacutia/databases_table_edit.vspx
+++ b/binsrc/yacutia/databases_table_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: databases_table_edit.vspx,v 1.4.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: databases_table_edit.vspx,v 1.4.2.4 2010/09/20 10:16:36 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -425,7 +425,7 @@
                                   http (sprintf ('<tr class="%s">', case when mod (self.row_count, 2) then 'listing_row_odd' else 'listing_row_even' end));
                             ?>
                               <td class="listing_col"><?V name_part((control as vspx_row_template).te_rowset[0],2) ?></td>
-                              <td class="listing_col"><?V left((control as vspx_row_template).te_rowset[1], 255) ?></td>
+                              <td class="listing_col"><?V subseq((control as vspx_row_template).te_rowset[1], 0, 255) ?></td>
                               <td  class="listing_col_action">
                                 <v:button name="trig_edit" value="Edit" style="url" action="simple">
                                   <v:on-post><v:script><![CDATA[
diff --git a/binsrc/yacutia/databases_udt_custom.vspx b/binsrc/yacutia/databases_udt_custom.vspx
index 5bd283f..f97f123 100644
--- a/binsrc/yacutia/databases_udt_custom.vspx
+++ b/binsrc/yacutia/databases_udt_custom.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: databases_udt_custom.vspx,v 1.3.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: databases_udt_custom.vspx,v 1.3.2.3 2010/09/20 10:16:37 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/databases_udt_edit.vspx b/binsrc/yacutia/databases_udt_edit.vspx
index f4b096d..6f5ece4 100644
--- a/binsrc/yacutia/databases_udt_edit.vspx
+++ b/binsrc/yacutia/databases_udt_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: databases_udt_edit.vspx,v 1.2.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: databases_udt_edit.vspx,v 1.2.2.3 2010/09/20 10:16:37 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/databases_view_edit.vspx b/binsrc/yacutia/databases_view_edit.vspx
index b89647a..a5d49e2 100644
--- a/binsrc/yacutia/databases_view_edit.vspx
+++ b/binsrc/yacutia/databases_view_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: databases_view_edit.vspx,v 1.2.2.2 2009/08/28 13:05:21 source Exp $
+ -  $Id: databases_view_edit.vspx,v 1.2.2.3 2010/09/20 10:16:37 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/dav_browser.css b/binsrc/yacutia/dav_browser.css
index 1db8a63..ae0c1da 100644
--- a/binsrc/yacutia/dav_browser.css
+++ b/binsrc/yacutia/dav_browser.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: dav_browser.css,v 1.2.2.1 2009/08/27 22:43:48 source Exp $
+ *  $Id: dav_browser.css,v 1.2.2.2 2010/09/20 10:16:37 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/binsrc/yacutia/dav_browser.xsl b/binsrc/yacutia/dav_browser.xsl
index 824077f..c5ff216 100644
--- a/binsrc/yacutia/dav_browser.xsl
+++ b/binsrc/yacutia/dav_browser.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: dav_browser.xsl,v 1.17.2.10 2010/06/24 15:32:12 source Exp $
+ -  $Id: dav_browser.xsl,v 1.17.2.15 2011/03/23 12:03:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -95,7 +95,7 @@
             else
               btn.value = 'Select All';
             btn.focus();
-          };
+          }
 
           function getFileName()
           {
@@ -177,7 +177,6 @@
           <v:variable name="dav_list_ord" persist="0" type="varchar" default="''" />
           <v:variable name="dav_list_ord_seq" persist="0" type="varchar" default="'asc'" />
           <v:on-init>
-            <v:script>
               <![CDATA[
   self.show_details := atoi (get_keyword ('details_dropdown', self.vc_page.vc_event.ve_params, '0'));
 
@@ -264,10 +263,8 @@
     self.curpath := trim (self.curpath, '/');
 
               ]]>
-            </v:script>
           </v:on-init>
           <v:before-data-bind>
-            <v:script>
               <![CDATA[
   self.show_details := atoi (get_keyword ('details_dropdown', self.vc_page.vc_event.ve_params, '0'));
   if (self.crfolder_mode = 0)
@@ -280,7 +277,6 @@
         self.item_permissions := (select U_DEF_PERMS from WS.WS.SYS_DAV_USER where U_ID = _uid);
     }
               ]]>
-            </v:script>
           </v:before-data-bind>
     <v:method name="set_ord" arglist="in x any, inout e vspx_event, inout ds vspx_control">
       <![CDATA[
@@ -340,21 +336,15 @@
                   <td>
                     <v:select-list name="search_dropdown">
                       <v:after-data-bind>
-                        <v:script>
                           <![CDATA[
                             (control as vspx_select_list).vsl_items := vector();
                             (control as vspx_select_list).vsl_item_values := vector();
                             (control as vspx_select_list).vsl_selected_inx := self.search_type;
-                            (control as vspx_select_list).vsl_items := vector_concat ((control as vspx_select_list).vsl_items,
-                                                                                      vector ('By resource name'));
-                            (control as vspx_select_list).vsl_item_values := vector_concat ((control as vspx_select_list).vsl_item_values,
-                                                                                            vector ('0'));
-                            (control as vspx_select_list).vsl_items := vector_concat ((control as vspx_select_list).vsl_items,
-                                                                                       vector ('By content'));
-                            (control as vspx_select_list).vsl_item_values := vector_concat ((control as vspx_select_list).vsl_item_values,
-                                                                                            vector ('1'));
+                          (control as vspx_select_list).vsl_items := vector_concat ((control as vspx_select_list).vsl_items, vector ('By resource name'));
+                          (control as vspx_select_list).vsl_item_values := vector_concat ((control as vspx_select_list).vsl_item_values, vector ('0'));
+                          (control as vspx_select_list).vsl_items := vector_concat ((control as vspx_select_list).vsl_items, vector ('By content'));
+                          (control as vspx_select_list).vsl_item_values := vector_concat ((control as vspx_select_list).vsl_item_values, vector ('1'));
                           ]]>
-                        </v:script>
                       </v:after-data-bind>
                     </v:select-list>
                   </td>
@@ -663,9 +653,7 @@ self.vc_data_bind (e);
                   <script type="text/javascript" src="toolkit/loader.js"><xsl:text> </xsl:text></script>-->
                   <script type="text/javascript" src="dav_browser_props.js"><xsl:text> </xsl:text></script>
                   <script type="text/javascript">
-                    function init() {
-            		      init_upload();
-                    }
+                    function init() {init_upload();}
             		  </script>
                   <v:template name="dav_template0021" type="simple" enabled="-- case when self.crfolder_mode = 2 then 1 else 0 end">
               		  <!--tr>
@@ -918,6 +906,39 @@ self.vc_data_bind (e);
                     </select>
                   </td>
                 </tr>
+                <tr>
+                  <th>Folder type</th>
+                  <td>
+                    <select name="fdet">
+                      <?vsp
+		                    {
+                          declare _fidx any;
+                          declare _idx varchar;
+                          declare i integer;
+
+                          _idx := get_keyword('fdet', self.vc_page.vc_event.ve_params, '');
+                          _fidx := vector (
+                            '',                 'Normal',                        
+                            'ResFilter',        'Smart Folder',                  
+                            'CatFilter',        'Category Folder',               
+                            'PropFilter',       'Property Filter Folder',        
+                            'HostFs',           'Host FS Folders',               
+                            'oMail',            'WebMail Folders',               
+                            'News3',            'OFM Subscriptions',             
+                            'rdfSink',          'RDF Upload Folder',             
+                            'RDFData',          'RDF Data',                      
+                            'S3',               'Amazon S3',                     
+			    'DynaRes',          'Dynamic Resources'
+			    );
+                          for (i := 0; i < length (_fidx); i := i + 2)
+                          {
+                            http (sprintf ('<option value="%s" %s>%s</option>', _fidx[i], select_if (_idx, _fidx[i]), _fidx[i+1]));
+                          }
+	                      }
+                      ?>
+                    </select>
+                  </td>
+                </tr>
 		            <?vsp } ?>
                 <v:template name="dav_template003" type="simple" enabled="-- equ(isstring (vad_check_version ('SyncML')), 1)">
                   <tr id="fi8">
@@ -977,7 +998,7 @@ self.vc_data_bind (e);
                         <![CDATA[
                           declare usr, grp vspx_select_list;
                           declare i, _uid, ownern, groupn integer;
-                          declare cname, _perms, _p, _idx, mimetype, owner_name, group_name, _inh varchar;
+                          declare cname, _perms, _p, _idx, mimetype, owner_name, group_name, _inh, _fdet varchar;
                   			  declare _file, _graph, is_ttl, is_xml any;
 
                   			  if (self.dst_sel.ufl_value = 'rdf')
@@ -1085,6 +1106,7 @@ self.vc_data_bind (e);
                             _perms := (select U_DEF_PERMS from WS.WS.SYS_DAV_USER where U_ID = _uid);
                           _idx := get_keyword('idx', self.vc_page.vc_event.ve_params, 'N');
                           _inh := get_keyword('inh', self.vc_page.vc_event.ve_params, 'N');
+                          _fdet := get_keyword('fdet', self.vc_page.vc_event.ve_params, '');
                           _perms := concat(_perms, _idx);
                           declare ret int;
                           declare full_path varchar;
@@ -1116,7 +1138,8 @@ self.vc_data_bind (e);
                     				    ret, cname, full_path, sync_ver);
                       				}
                   		        set triggers off;
-                              update WS.WS.SYS_DAV_COL set COL_INHERIT = _inh where COL_ID = ret;
+			      if (_fdet = '') _fdet := null;		
+                              update WS.WS.SYS_DAV_COL set COL_INHERIT = _inh, COL_DET = _fdet where COL_ID = ret;
 			                        set triggers on;
                             }
                           }
@@ -1306,9 +1329,10 @@ self.vc_data_bind (e);
                 nferr:;
               </v:before-data-bind>
               <script type="text/javascript" src="dav_browser_props.js"><xsl:text> </xsl:text></script>
+              <script type="text/javascript" src="tbl.js"><xsl:text> </xsl:text></script>
               <table>
                 <?vsp
-                  declare _name, perms, cur_user, _res_type, _inh varchar;
+                  declare _name, perms, cur_user, _res_type, _inh, _fdet varchar;
             		  declare _res_id, own_id, own_grp, uid, gid, is_dir integer;
 
             		  _inh := null;
@@ -1326,9 +1350,20 @@ self.vc_data_bind (e);
                   {
                     whenever not found goto nf1;
                     if (is_dir = 1)
-                      select COL_NAME, COL_OWNER, COL_GROUP, COL_PERMS, COL_INHERIT into _name, own_id, own_grp, perms, _inh from WS.WS.SYS_DAV_COL where COL_ID = _res_id;
+                    {
+                      select COL_NAME, COL_OWNER, COL_GROUP, COL_PERMS, COL_INHERIT, COL_DET into _name, own_id, own_grp, perms, _inh, _fdet from WS.WS.SYS_DAV_COL where COL_ID = _res_id;
+                      if (isnull (_fdet))
+                      {
+                        if (DB.DBA.Y_DAV_PROP_GET (self.source_dir, 'virt:rdf_graph', '') <> '')
+                          _fdet := 'rdfSink';
+                        if (DB.DBA.Y_DAV_PROP_GET (self.source_dir, 'virt:Versioning-History', '') <> '')
+                          _fdet := 'UnderVersioning';
+                      }
+                    }
                     else
+                    {
                       select RES_NAME, RES_OWNER, RES_GROUP, RES_PERMS, RES_TYPE into _name, own_id, own_grp, perms, _res_type from WS.WS.SYS_DAV_RES where RES_ID = _res_id;
+                    }
                   nf1:;
                 ?>
                 <tr>
@@ -1495,6 +1530,39 @@ self.vc_data_bind (e);
                     </select>
                   </td>
                 </tr>
+                <tr>
+                  <th>Folder type</th>
+                  <td>
+                    <select name="fdet">
+                      <?vsp
+		                    {
+                          declare _fidx any;
+                          declare _idx varchar;
+                          declare i integer;
+
+                          _idx := _fdet;
+                          _fidx := vector (
+                            '',                 'Normal',                        
+                            'ResFilter',        'Smart Folder',                  
+                            'CatFilter',        'Category Folder',               
+                            'PropFilter',       'Property Filter Folder',        
+                            'HostFs',           'Host FS Folders',               
+                            'oMail',            'WebMail Folders',               
+                            'News3',            'OFM Subscriptions',             
+                            'rdfSink',          'RDF Upload Folder',             
+                            'RDFData',          'RDF Data',                      
+                            'S3',               'Amazon S3',                     
+			    'DynaRes',          'Dynamic Resources'
+			    );
+                          for (i := 0; i < length (_fidx); i := i + 2)
+                          {
+                            http (sprintf ('<option value="%s" %s>%s</option>', _fidx[i], select_if (_idx, _fidx[i]), _fidx[i+1]));
+                          }
+	                      }
+                      ?>
+                    </select>
+                  </td>
+                </tr>
 		            <?vsp } ?>
                 <v:template name="dav_template011" type="simple" enabled="-- equ(yac_syncml_detect (self.source_dir), 1)">
                   <tr>
@@ -1540,9 +1608,13 @@ self.vc_data_bind (e);
                 ?>
                 <tr>
                   <td>
-                    <input type="checkbox" name="recurse" id="recurse"/>
                   </td>
-                  <td><label for="recurse">Apply changes to all subfolders and resources</label></td>
+                  <td>
+                    <label>
+                      <input type="checkbox" name="recurse"/>
+                      Apply changes to all subfolders and resources
+                    </label>
+                  </td>
                 </tr>
                 <?vsp
                   }
@@ -1550,253 +1622,93 @@ self.vc_data_bind (e);
                 <tr>
                   <th valign="top" nowrap="nowrap">WebDAV Properties</th>
                   <td>
-                    <table cellspacing="0">
-                      <tr>
-                        <td valign="top">
-                          <table cellspacing="0">
-                            <tr>
-                              <td>
-                                Predefined names
-                              </td>
-                            </tr>
-                            <tr>
-                              <td>
-                                <v:select-list name="xml_name" xhtml_size="3">
-                                  <v:before-data-bind>
-                                    <v:script>
-                                      <![CDATA[
-                                        declare prop_arr any;
-                                        declare _len, _ix integer;
-
-                                        (control as vspx_select_list).vsl_items:= vector ();
-                                        (control as vspx_select_list).vsl_item_values:= vector ();
-                                        (control as vspx_select_list).vsl_selected_inx := 0;
-                                        prop_arr := vector ('xml-sql', 0,
-                                                            'xml-sql-root', 0,
-                                                            'xml-sql-dtd', 0,
-                                                            'xml-sql-schema', 0,
-                                                            'xml-stylesheet', 0,
-                                                            'xper', 0);
-                                        _len := length (prop_arr);
-                                        for (_ix := 0; _ix < _len; _ix := _ix + 2)
-                                        {
-                                          (control as vspx_select_list).vsl_items :=
-                                            vector_concat ((control as vspx_select_list).vsl_items, vector (aref (prop_arr, _ix)));
-                                          (control as vspx_select_list).vsl_item_values :=
-                                            vector_concat ((control as vspx_select_list).vsl_item_values, vector (aref (prop_arr, _ix)));
-                                        }
-                                      ]]>
-                                    </v:script>
-                                  </v:before-data-bind>
-                                </v:select-list>
-                              </td>
-                            </tr>
-                            <tr>
-                              <td>Custom name</td>
-                            </tr>
-                            <tr>
-                              <td>
-                                <input type="text" name="cust_name" value=""/>
-                              </td>
-                            </tr>
-                            <tr>
-                              <td>Value</td>
-                            </tr>
-                            <tr>
-                              <td>
-                                <input type="text" name="xml_value" value=""/>
-                              </td>
-                            </tr>
-                            <tr>
-                              <td align="right">
-                                <v:button action="simple" name="grant" value="Add">
-                                  <v:on-post>
-                                    <![CDATA[
-                            			    if (e.ve_initiator <> control)
-                            			      return;
-
-                                      declare cust_name, pname, pvalue, tp varchar;
-                                      declare _res_id, is_dir integer;
-
-                                      declare exit handler for sqlstate '*'
-                                      {
-                                        rollback work;
-                                        self.vc_is_valid := 0;
-                                        self.vc_error_message := __SQL_MESSAGE;
-                                        return;
-                                      };
-
-                                      if (right(self.source_dir, 1) = '/')
-                                      {
-                                        is_dir := 1;
-                                        _res_id := DAV_SEARCH_ID(self.source_dir, 'C');
-                                      }
-                                      else
-                                      {
-                                        is_dir := 0;
-                                        _res_id := DAV_SEARCH_ID(self.source_dir, 'R');
-                                      }
-                                      pname := get_keyword('xml_name', self.vc_page.vc_event.ve_params, '');
-                                      pvalue := get_keyword('xml_value', self.vc_page.vc_event.ve_params, '');
-                                      cust_name := trim(get_keyword('cust_name', params, ''));
-
-                                      if (cust_name is not null and cust_name <> '')
-                                        pname := cust_name;
-
-                                      declare idx integer;
-
-                                      idx := 0;
-                                      if (is_dir = 1)
-                                        tp := 'C';
-                                      else
-                                        tp := 'R';
-
-                                      if (pname = '')
-                                      {
-                                        self.vc_error_message := 'Property name should be supplied';
-                                        self.vc_is_valid := 0;
-                                        return;
-                                      }
-
-                                      if (exists (select 1 from WS.WS.SYS_DAV_PROP where PROP_NAME = pname and PROP_PARENT_ID = _res_id and PROP_TYPE = tp))
-                                      {
-                                        self.vc_error_message := sprintf('The property "%s" of "%s" already exists.\nYou can remove or update existing', pname, self.source_dir);
-                                        self.vc_is_valid := 0;
-                                        return;
-                                      }
-                                      {
-                                        declare exit handler for sqlstate '*' { goto endser; };
-
-                                        if (isarray (xml_tree (pvalue, 0)))
-                                          pvalue := serialize(xml_tree(pvalue, 0));
-                                         endser:;
-                                      }
-                                      YAC_DAV_PROP_SET (self.source_dir, pname, pvalue, connection_get ('vspx_user'));
-                                    ]]>
-                                  </v:on-post>
-                                </v:button>
-                              </td>
-                            </tr>
-                          </table>
-                        </td>
-                        <td valign="top">
                           <table>
                             <tr>
-                              <td>
-                                Actual properties
-                              </td>
-                            </tr>
-                            <tr>
-                              <td>
-                                <table border="1" cellspacing="0" cellpadding="3">
-                                  <tr>
-                                    <td/>
-                                    <td>Name</td>
-                                    <td>Value</td>
-                                  </tr>
+                        <td width="600px">
                                   <?vsp
-                                    declare inx, len, isf, id, tp integer;
-                                    declare pvalue varchar;
-
-                                    isf := 1;
-                                    id := _res_id;
-                                    if (is_dir = 1)
-                                      tp := 'C';
-                                    else
-                                      tp := 'R';
+                            declare N integer;
+                            declare properties any;
 
-                                    for select PROP_NAME, PROP_ID, blob_to_string (PROP_VALUE) as PROP_VALUE
-                                          from WS.WS.SYS_DAV_PROP
-                                         where PROP_PARENT_ID = id and
-                                               PROP_TYPE = tp do
-                                    {
-                                      isf := 0;
-                                      pvalue := deserialize (PROP_VALUE);
-
-                                      if (isarray (pvalue))
-                                      {
-                                        declare ses any;
-                                        ses := string_output ();
-                                        http_value (xml_tree_doc (pvalue), null, ses);
-                                        pvalue := string_output_string (ses);
-                                      }
-                                      else if (isstring (PROP_VALUE))
-                                        pvalue := PROP_VALUE;
-                                      else
-                                        pvalue := '';
+                            properties := DB.DBA.Y_DAV_PROP_LIST (self.source_dir, '%');
                                   ?>
+                          <table id="c_tbl" class="form-list" cellspacing="0">
                                   <tr>
-                                    <td>
-                                      <input type="checkbox" name="CB_<?V PROP_NAME ?>"/>
-                                    </td>
-                                    <td><?V PROP_NAME ?></td>
-                                    <td><?V pvalue ?></td>
+                              <th width="50%">Property</th>
+                              <th width="50%">Value</th>
+                              <th>Action</th>
                                   </tr>
-                                  <?vsp
-                                    }
-                                    if (isf)
-                                      http ('<tr><td colspan=4>No properties found</td></tr>');
-                                  ?>
-                                </table>
-                              </td>
-                            </tr>
-                            <?vsp
-                              if (isf = 0)
-                              {
-                            ?>
-                            <tr>
-                              <td align="right">
-                                <v:button action="simple" name="revoke" value="Delete">
-                                  <v:on-post>
+                            <tr id="c_tr_no"><td colspan="3"><b>No Properties</b></td></tr>
                                     <![CDATA[
-                            			    if (e.ve_initiator <> control)
-                            			      return;
-
-                                      declare _res_id, is_dir, idx integer;
-                                      declare pname, tp varchar;
-
-                                      declare exit handler for sqlstate '*'
-                                      {
-                                        rollback work;
-                                        self.vc_is_valid := 0;
-                                        self.vc_error_message := __SQL_MESSAGE;
-                                        return;
-                                      };
-                                      if (right(self.source_dir, 1) = '/')
-                                      {
-                                        is_dir := 1;
-                                        _res_id := DAV_SEARCH_ID (self.source_dir, 'C');
-                                        tp := 'C';
-                                      }
-                                      else
-                                      {
-                                        is_dir := 0;
-                                        _res_id := DAV_SEARCH_ID (self.source_dir, 'R');
-                                        tp := 'R';
-                                      }
-                                      idx := 0;
-                                      while (pname := adm_next_checkbox ('CB_', self.vc_page.vc_event.ve_params, idx))
-                                      {
-                                        YAC_DAV_PROP_REMOVE (self.source_dir, pname, connection_get ('vspx_user'));
-                                      }
-                                    ]]>
-                                  </v:on-post>
-                                </v:button>
-                              </td>
-                            </tr>
+                      		    <script type="text/javascript">
                             <?vsp
+                                for (N := 0; N < length (properties); N := N + 1)
+                                {
+                                  http (sprintf ('OAT.Loader.load([], function(){TBL.createRow("c", null, {fld_1: {mode: 40, value: "%s", className: "_validate_", onbBlur: function(){validateField(this);}}, fld_2: {mode: 0, value: "%s"}});});', properties[N][0], replace (properties[N][1], '\n', ' ')));
                               }
                             ?>
+                      		    </script>
+                      		  ]]>
                           </table>
                         </td>
+                        <td valign="top" nowrap="nowrap">
+                          <span class="button pointer">
+                            <xsl:attribute name="onclick">
+                              TBL.createRow('c', null, {fld_1: {mode: 40, className: '_validate_', onblur: function(){validateField(this);}}, fld_2: {mode: 0}});
+                            </xsl:attribute>
+                            <img src="images/icons/add_16.png" border="0" class="button" alt="Add Property" title="Add Property" /> Add
+                          </span>
+                        </td>
                       </tr>
                     </table>
                   </td>
                 </tr>
                 <?vsp
                   }
+                  if (DB.DBA.Y_VAD_CHECK('Framework'))
+                    {
                 ?>
+                <tr>
+                  <th valign="top" nowrap="nowrap">WebID</th>
+                  <td>
+                    <table>
+                      <tr>
+                        <td width="600px">
+                          <table id="f_tbl" class="form-list" style="width: 100%;" cellspacing="0">
+                            <tr>
+                              <th width="1%" nowrap="nowrap">Access Type</th>
+                              <th nowrap="nowrap">WebID</th>
+                              <th width="1%" align="center" nowrap="nowrap">ACL: (R)ead, (W)rite</th>
+                              <th width="1%">Action</th>
+                            </tr>
+                            <tr id="f_tr_no"><td colspan="4"><b>No WebID Security</b></td></tr>
+                      		  <![CDATA[
+                      		    <script type="text/javascript">
+                              <?vsp
+                                declare N integer;
+                                declare aci_values any;
+
+                                aci_values := DB.DBA.Y_ACI_LOAD (self.source_dir);
+                                for (N := 0; N < length (aci_values); N := N + 1)
+                                  http (sprintf ('OAT.Loader.load([], function(){TBL.createRow("f", null, {fld_1: {mode: 50, value: "%s", onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, tdCssText: "white-space: nowrap;", className: "_validate_ _uri_", value: "%s", readOnly: %s, imgCssText: "%s"}, fld_3: {mode: 52, value: [%d, %d, %d], tdCssText: "width: 1%%; text-align: center;"}});});', aci_values[N][2], aci_values[N][1], case when aci_values[N][2] = 'public' then 'true' else 'false' end, case when aci_values[N][2] = 'public' then 'display: none;' else '' end, aci_values[N][3], aci_values[N][4], aci_values[N][5]));
+                              ?>
+                      		    </script>
+                      		  ]]>
+                          </table>
+                        </td>
+                        <td valign="top" nowrap="nowrap">
+                          <span class="button pointer">
+                            <xsl:attribute name="onclick">
+                              TBL.createRow('f', null, {fld_1: {mode: 50, onchange: function(){TBL.changeCell50(this);}}, fld_2: {mode: 51, tdCssText: 'white-space: nowrap;', className: '_validate_ _uri_'}, fld_3: {mode: 52, value: [1, 0, 0], tdCssText: 'width: 1%; text-align: center;'}});
+                            </xsl:attribute>
+                            <img src="images/icons/add_16.png" border="0" class="button" alt="Add Security" title="Add Security" /> Add
+                          </span>
+                        </td>
+                      </tr>
+                    </table>
+                  </td>
+                </tr>
                 <?vsp
+                    }
                   if (is_dir = 0)
                   {
                 ?>
@@ -2167,7 +2079,7 @@ self.vc_data_bind (e);
                 			      return;
 
                           declare i, own_id, own_grp integer;
-                          declare mimetype, _recurse, _res_name varchar;
+                          declare mimetype, _recurse, _res_name, _fdet varchar;
                           declare _fidx, _file any;
                           declare _perms, _p, _idx varchar;
                           declare _res_id, is_dir, _inh integer;
@@ -2227,6 +2139,9 @@ self.vc_data_bind (e);
                           _fidx := vector ('N', 'Off', 'T', 'Direct members', 'R', 'Recursively');
                           _idx := get_keyword ('idx', self.vc_page.vc_event.ve_params, _fidx[0]);
                           _inh := get_keyword ('inh', self.vc_page.vc_event.ve_params, _fidx[0]);
+			  _fdet := get_keyword ('fdet', self.vc_page.vc_event.ve_params, '');
+                  			  if (_fdet = '')
+                  			    _fdet := null;
 
                           for (i := 0; i < 9; i := i + 1)
                           {
@@ -2252,8 +2167,8 @@ self.vc_data_bind (e);
 
                           if (is_dir = 1)
                           {
-                            exec ('update WS.WS.SYS_DAV_COL set COL_NAME = ?, COL_PERMS = ?, COL_OWNER = ?, COL_GROUP = ?, COL_INHERIT = ? where  COL_ID = ?',
-                                  state, msg, vector (_res_name, _perms, own_id, own_grp, _inh, _res_id), m_dta, res);
+                            exec ('update WS.WS.SYS_DAV_COL set COL_NAME = ?, COL_PERMS = ?, COL_OWNER = ?, COL_GROUP = ?, COL_INHERIT = ?, COL_DET = ? where COL_ID = ?',
+                                  state, msg, vector (_res_name, _perms, own_id, own_grp, _inh, _fdet, _res_id), m_dta, res);
 
                             if (_recurse)
                             {
@@ -2288,7 +2203,7 @@ self.vc_data_bind (e);
                             }
                             commit work;
                           }
-                          if (is_dir = 0)
+                          else if (is_dir = 0)
                           {
                             declare _operm, full_path, _res_type varchar;
                             declare _own, _grp integer;
@@ -2303,8 +2218,8 @@ self.vc_data_bind (e);
                             if (exists (select 1 from WS.WS.SYS_DAV_RES where RES_ID = _res_id))
                             {
                               _operm := '000000000N';
-
-                              select RES_PERMS, RES_OWNER, RES_GROUP into _operm, _own, _grp
+                              select RES_PERMS, RES_OWNER, RES_GROUP
+                                into _operm, _own, _grp
                                 from WS.WS.SYS_DAV_RES
                                 where RES_ID = _res_id;
 
@@ -2331,15 +2246,18 @@ self.vc_data_bind (e);
                                   update WS.WS.SYS_DAV_RES set RES_PERMS = _perms where current of res_cur1;
 
                                 if (mimetype <> '' and cur_type1 <> mimetype)
-                                  {
                                     update WS.WS.SYS_DAV_RES set RES_TYPE = _res_type where current of res_cur1;
-                                  }
 
                                 commit work;
                               }
+
                             next_one1:
                               close res_cur1;
+                              if (self.source_dir <> full_path)
+                              {
                               YACUTIA_DAV_MOVE (self.source_dir, full_path, 1);
+                                self.source_dir := full_path;
+                              }
                             }
                             else
                             {
@@ -2348,6 +2266,29 @@ self.vc_data_bind (e);
                               return;
                             }
                           }
+                          -- WebDAV properties
+                          declare N, properties, c_properties, dav_aci any;
+
+                          properties := DB.DBA.Y_DAV_PROP_LIST (self.source_dir, '%');
+                          for (N := 0; N < length (properties); N := N + 1)
+                          {
+                            DB.DBA.Y_DAV_PROP_REMOVE (self.source_dir, properties[N][0]);
+                          }
+                          c_properties := DB.DBA.Y_DAV_PROP_PARAMS (params);
+                          for (N := 0; N < length (c_properties); N := N + 1)
+                          {
+                            DB.DBA.Y_DAV_PROP_SET (self.source_dir, c_properties[N][0], c_properties[N][1]);
+                          }
+
+                          -- acl
+                          if (DB.DBA.Y_VAD_CHECK('Framework'))
+                          {
+                            dav_aci := DB.DBA.Y_ACI_N3 (DB.DBA.Y_ACI_PARAMS (params));
+                            YAC_DAV_PROP_REMOVE (self.source_dir, 'virt:aci_meta_n3', connection_get ('vspx_user'), 1);
+                            if (not isnull (dav_aci))
+                              YAC_DAV_PROP_SET (self.source_dir, 'virt:aci_meta_n3', dav_aci, connection_get ('vspx_user'));
+                          }
+
                           self.command := 0;
                           self.ds_items.vc_data_bind(e);
                           if (self.ds_items1 is not null)
@@ -2681,6 +2622,7 @@ self.vc_data_bind (e);
                 <script type="text/javascript">
                   function init(){
                     init_properties_mod();
+                    OAT.MSG.send(OAT, 'PAGE_LOADED');
                   }
                 </script>
                 <div>
@@ -3338,11 +3280,9 @@ self.vc_data_bind (e);
                 <label for="dav_br_t_path">Path</label>
     <v:text name="t_path" xhtml_id="dav_br_t_path" value="''" format="%s">
                   <v:before-render>
-                        <v:script>
                           <![CDATA[
                             control.ufl_value := self.curpath;
                           ]]>
-                        </v:script>
                       </v:before-render>
                 </v:text>
   <script type="text/javascript"><![CDATA[
@@ -3367,7 +3307,6 @@ self.vc_data_bind (e);
       ]]></script>
                 <v:button style="image" name="b_go_path" value="--'images/dav_browser/go_16.png'" xhtml_alt="Go" xhtml_title="Go" action="simple">
                   <v:on-post>
-                        <v:script>
                           <![CDATA[
                             declare path varchar;
                             path := self.t_path.ufl_value;
@@ -3389,19 +3328,15 @@ self.vc_data_bind (e);
                             self.ds_items.vc_data_bind(e);
                             self.vc_data_bind(e);
                           ]]>
-                        </v:script>
                       </v:on-post>
                 </v:button>
                 <v:button name="b_up" style="image" value="--'images/dav_browser/up_16.png'" xhtml_alt="Up" xhtml_title="Up" action="simple">
                   <v:before-render>
-                        <v:script>
                           <![CDATA[
                             control.ufl_active := case when length(self.curpath) > 0 then 1 else 0 end;
                           ]]>
-                        </v:script>
                       </v:before-render>
                   <v:on-post>
-                        <v:script>
                           <![CDATA[
                             declare pos integer;
                             pos := strrchr(self.curpath, '/');
@@ -3414,7 +3349,6 @@ self.vc_data_bind (e);
                             self.ds_items.vc_data_bind(e);
                             self.vc_data_bind(e);
                           ]]>
-                        </v:script>
                       </v:on-post>
                 </v:button>
                 <v:button name="b_create"
diff --git a/binsrc/yacutia/db_backup.vspx b/binsrc/yacutia/db_backup.vspx
index 11ec5b6..4c805bf 100644
--- a/binsrc/yacutia/db_backup.vspx
+++ b/binsrc/yacutia/db_backup.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: db_backup.vspx,v 1.4.2.3 2009/08/28 13:05:21 source Exp $
+ -  $Id: db_backup.vspx,v 1.4.2.4 2010/09/20 10:16:37 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_backup_clear.vspx b/binsrc/yacutia/db_backup_clear.vspx
index 62e153d..79fd1cf 100644
--- a/binsrc/yacutia/db_backup_clear.vspx
+++ b/binsrc/yacutia/db_backup_clear.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_backup_clear.vspx,v 1.3.2.3 2009/08/28 13:05:21 source Exp $
+ -  $Id: db_backup_clear.vspx,v 1.3.2.4 2010/09/20 10:16:37 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_const_drop_conf.vspx b/binsrc/yacutia/db_const_drop_conf.vspx
index d09bf13..b008f0d 100644
--- a/binsrc/yacutia/db_const_drop_conf.vspx
+++ b/binsrc/yacutia/db_const_drop_conf.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_const_drop_conf.vspx,v 1.3.2.3 2009/08/28 13:05:21 source Exp $
+ -  $Id: db_const_drop_conf.vspx,v 1.3.2.4 2010/09/20 10:16:37 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_const_drop_errs.vspx b/binsrc/yacutia/db_const_drop_errs.vspx
index 756f2f0..ff87747 100644
--- a/binsrc/yacutia/db_const_drop_errs.vspx
+++ b/binsrc/yacutia/db_const_drop_errs.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_const_drop_errs.vspx,v 1.3.2.3 2009/08/28 13:05:21 source Exp $
+ -  $Id: db_const_drop_errs.vspx,v 1.3.2.4 2010/09/20 10:16:37 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_drop_conf.vspx b/binsrc/yacutia/db_drop_conf.vspx
index 26885e9..84ab850 100644
--- a/binsrc/yacutia/db_drop_conf.vspx
+++ b/binsrc/yacutia/db_drop_conf.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_drop_conf.vspx,v 1.3.2.4 2009/11/26 14:38:45 source Exp $
+ -  $Id: db_drop_conf.vspx,v 1.3.2.5 2010/09/20 10:16:37 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_drop_errs.vspx b/binsrc/yacutia/db_drop_errs.vspx
index 6400424..54b8e95 100644
--- a/binsrc/yacutia/db_drop_errs.vspx
+++ b/binsrc/yacutia/db_drop_errs.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_drop_errs.vspx,v 1.3.2.3 2009/08/28 13:05:21 source Exp $
+ -  $Id: db_drop_errs.vspx,v 1.3.2.4 2010/09/20 10:16:37 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_grant_errs.vspx b/binsrc/yacutia/db_grant_errs.vspx
index af2a587..4676f0d 100644
--- a/binsrc/yacutia/db_grant_errs.vspx
+++ b/binsrc/yacutia/db_grant_errs.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_grant_errs.vspx,v 1.2.2.3 2009/08/28 13:05:21 source Exp $
+ -  $Id: db_grant_errs.vspx,v 1.2.2.4 2010/09/20 10:16:37 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_grant_many.vspx b/binsrc/yacutia/db_grant_many.vspx
index 344861d..3fe60d4 100644
--- a/binsrc/yacutia/db_grant_many.vspx
+++ b/binsrc/yacutia/db_grant_many.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_grant_many.vspx,v 1.2.2.3 2009/11/26 14:38:45 source Exp $
+ -  $Id: db_grant_many.vspx,v 1.2.2.4 2010/09/20 10:16:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_rdf_class.vspx b/binsrc/yacutia/db_rdf_class.vspx
index 501084c..65ed1e8 100644
--- a/binsrc/yacutia/db_rdf_class.vspx
+++ b/binsrc/yacutia/db_rdf_class.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_rdf_class.vspx,v 1.7.2.2 2009/08/27 22:43:48 source Exp $
+ -  $Id: db_rdf_class.vspx,v 1.7.2.3 2010/09/20 10:16:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_rdf_objects.vspx b/binsrc/yacutia/db_rdf_objects.vspx
index d2d56d9..1bb8ab2 100644
--- a/binsrc/yacutia/db_rdf_objects.vspx
+++ b/binsrc/yacutia/db_rdf_objects.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_rdf_objects.vspx,v 1.4.2.9 2009/11/20 17:09:41 source Exp $
+ -  $Id: db_rdf_objects.vspx,v 1.4.2.10 2010/09/20 10:16:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_rdf_owl.vspx b/binsrc/yacutia/db_rdf_owl.vspx
index 0198b99..f30d4ff 100644
--- a/binsrc/yacutia/db_rdf_owl.vspx
+++ b/binsrc/yacutia/db_rdf_owl.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_rdf_owl.vspx,v 1.2.2.3 2009/08/27 22:43:48 source Exp $
+ -  $Id: db_rdf_owl.vspx,v 1.2.2.4 2010/09/20 10:16:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_rdf_view_1.vspx b/binsrc/yacutia/db_rdf_view_1.vspx
index 15feec2..7b6daae 100644
--- a/binsrc/yacutia/db_rdf_view_1.vspx
+++ b/binsrc/yacutia/db_rdf_view_1.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_rdf_view_1.vspx,v 1.1.2.7 2009/08/27 22:43:48 source Exp $
+ -  $Id: db_rdf_view_1.vspx,v 1.1.2.8 2010/09/20 10:16:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_rdf_view_2.vspx b/binsrc/yacutia/db_rdf_view_2.vspx
index 0ec5e49..2570854 100644
--- a/binsrc/yacutia/db_rdf_view_2.vspx
+++ b/binsrc/yacutia/db_rdf_view_2.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_rdf_view_2.vspx,v 1.1.2.6 2009/08/27 22:43:48 source Exp $
+ -  $Id: db_rdf_view_2.vspx,v 1.1.2.7 2010/09/20 10:16:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_rdf_view_3.vspx b/binsrc/yacutia/db_rdf_view_3.vspx
index 7fc616e..455278d 100644
--- a/binsrc/yacutia/db_rdf_view_3.vspx
+++ b/binsrc/yacutia/db_rdf_view_3.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_rdf_view_3.vspx,v 1.2.2.12 2010/03/30 15:31:33 source Exp $
+ -  $Id: db_rdf_view_3.vspx,v 1.2.2.16 2010/09/20 10:16:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -39,6 +39,7 @@
       <v:variable persist="0" name="base_url" type="any" default="null" param-name="host"/>
       <v:variable persist="0" name="voidst" type="int" default="0" param-name="st"/>
       <v:variable name="exec_ret" type="any" default="null" persist="temp"/>
+      <v:variable name="sync_ret" type="any" default="null" persist="temp"/>
       <v:variable persist="0" name="body_v" type="any" default="null" param-name="cr_view"/>
       <v:variable persist="0" name="body_o" type="any" default="null" param-name="cr_owl"/>
       <v:variable persist="0" name="text_e" type="integer" default="0"/>
@@ -76,7 +77,7 @@
 <table>
     <v:method name="exec_all" arglist="inout control vspx_control"><![CDATA[
 	      declare stat, msg varchar;
-	      declare res, arr, data, meta, gr, path any;
+	      declare res, arr, data, meta, gr, path, ret any;
 	      declare inx int;
 
 	      path := concat('/DAV/temp/', self.sid, '.sql');
@@ -98,6 +99,12 @@
                     res[inx] := vector (vector (stat, msg));
 		  inx := inx + 1;
 		}
+             if (self.rdb_sync.ufl_selected)
+	       {
+	         self.sync_ret := RDF_VIEW_DO_SYNC (self.base_url, self.fill.ufl_selected);
+                 if (0 = length (self.sync_ret))
+		   self.sync_ret := vector (vector ('00000', 'OK'));
+  	       }	       
              if (self.owl)
                {
 	         path := concat('/DAV/temp/', self.sid, '.n3');
@@ -243,6 +250,24 @@
 	      ?>
 	  </table>
 	  <?vsp
+	  if (length (self.sync_ret))
+	    {
+	  ?>
+	  <br/>
+	  <h2>RDB2RDF Triggers Status</h2>
+	  <table class="listing">
+	      <tr class="listing_header_row"><th>Status</th><th>Message</th></tr>
+	      <?vsp
+	      foreach (any _row in self.sync_ret) do
+                {
+	      ?>
+	      <tr><td><?V _row[0] ?></td><td><?V _row[1] ?></td></tr>
+	      <?vsp
+	        }
+	      ?>
+	  </table>
+	  <?vsp
+	    }  
 	  if (self.view_vd or self.owl_vd)
 	    {
 	  ?>
@@ -251,9 +276,13 @@
 	    }
 	  ?>
 	  <?vsp
-	       declare defhost, stat, msg, data, meta, data2, meta2, qr, gr any;
+	       declare defhost, stat, msg, data, meta, data2, meta2, qr, gr, fct_installed any;
 	       stat := '00000';
 	       defhost := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+	       if (exists (select 1 from VAD.DBA.VAD_REGISTRY where R_KEY like '/VAD/fct/%/resources/dav/%'))
+	         fct_installed := 1;
+               else 
+	         fct_installed := 0;
 	       if (__proc_exists (fix_identifier_case ('shcompo_clear'), 2) is not null)
 	         shcompo_clear ();
 	       if (self.view_vd)
@@ -272,6 +301,9 @@
 			       exec (qr, stat, msg, vector (), 1, meta2, data2);
 			       if (stat = '00000' and length (data2) and length (data2[0]))
 				 {
+                                   if (fct_installed)
+				     http (sprintf ('<a href="%s" target="_blank">%s</a><br/>', data2[0][0], data2[0][0]));
+				   else
 				   http (sprintf ('<a href="%s" target="_blank">%s</a><br/>', replace (data2[0][0], '#', '%01'), data2[0][0]));
 				 }
 			     }
@@ -287,6 +319,9 @@
 		   if (stat = '00000' and length (data) and length (data[0]))
 		   {
 		   http ('<div>Statistics Data (VoiD Graph): <br/>');
+		   if (fct_installed)
+		     http (sprintf ('<a href="%s" target="_blank">%s</a>', data[0][0], data[0][0]));
+                   else  
 	           http (sprintf ('<a href="%s" target="_blank">%s</a>', replace (data[0][0], '#', '%01'), data[0][0]));
 		   http ('</div>');
 	           }
@@ -299,6 +334,9 @@
 		   if (stat = '00000' and length (data) and length (data[0]))
 		   {
 		   http ('<div>Ontology: <br/>');
+		   if (fct_installed)
+	             http (sprintf ('<a href="%s" target="_blank">%s</a>', data[0][0], data[0][0]));
+		   else
 	           http (sprintf ('<a href="%s" target="_blank">%s</a>', replace (data[0][0], '#', '%01'), data[0][0]));
 		   http ('</div>');
 	           }
@@ -319,6 +357,10 @@
 	  <v:textarea name="cr_owl" xhtml_cols="120" xhtml_rows="20" value="--self.body_o"/>
 	  <?vsp } ?>
 	  <?vsp } ?>
+	  <?vsp if (self.text_e = 0 and __proc_exists ('DB.DBA.RDF_VIEW_DO_SYNC')) { ?>
+	  <br /><v:check-box name="rdb_sync" value="1" xhtml_id="rdb_sync" /> <label for="rdb_sync">Generate RDB2RDF triggers</label> <br/>
+	  <v:check-box name="fill" value="1" xhtml_id="fill" /> <label for="fill">Enable Data Syncs with Physical Quad Store</label> <br/>
+	  <?vsp } ?>
 	  <input type="hidden" name="host" value="<?V get_keyword('host', self.vc_event.ve_params) ?>"/><br/>
 	  <v:button action="simple" name="cncl" value="Start Over">
 	  <v:on-post><![CDATA[
diff --git a/binsrc/yacutia/db_rdf_view_cols.vspx b/binsrc/yacutia/db_rdf_view_cols.vspx
index 0c8027c..8a336a2 100644
--- a/binsrc/yacutia/db_rdf_view_cols.vspx
+++ b/binsrc/yacutia/db_rdf_view_cols.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_rdf_view_cols.vspx,v 1.1.2.8 2009/08/27 22:43:48 source Exp $
+ -  $Id: db_rdf_view_cols.vspx,v 1.1.2.9 2010/09/20 10:16:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_rdf_view_pk.vspx b/binsrc/yacutia/db_rdf_view_pk.vspx
index 57eb63f..758d122 100644
--- a/binsrc/yacutia/db_rdf_view_pk.vspx
+++ b/binsrc/yacutia/db_rdf_view_pk.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_rdf_view_pk.vspx,v 1.1.2.5 2010/05/26 15:21:24 source Exp $
+ -  $Id: db_rdf_view_pk.vspx,v 1.1.2.6 2010/09/20 10:16:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_rdf_view_tb.vspx b/binsrc/yacutia/db_rdf_view_tb.vspx
index d14f428..2d3937b 100644
--- a/binsrc/yacutia/db_rdf_view_tb.vspx
+++ b/binsrc/yacutia/db_rdf_view_tb.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_rdf_view_tb.vspx,v 1.1.2.5 2009/08/27 22:43:48 source Exp $
+ -  $Id: db_rdf_view_tb.vspx,v 1.1.2.6 2010/09/20 10:16:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_basic.vspx b/binsrc/yacutia/db_repl_basic.vspx
index 2fbc942..5f55393 100644
--- a/binsrc/yacutia/db_repl_basic.vspx
+++ b/binsrc/yacutia/db_repl_basic.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_basic.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_basic.vspx,v 1.2.2.3 2010/09/20 10:16:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_basic_create.vspx b/binsrc/yacutia/db_repl_basic_create.vspx
index f9731e6..21f8b9a 100644
--- a/binsrc/yacutia/db_repl_basic_create.vspx
+++ b/binsrc/yacutia/db_repl_basic_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_basic_create.vspx,v 1.3.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_basic_create.vspx,v 1.3.2.3 2010/09/20 10:16:38 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_basic_local.vspx b/binsrc/yacutia/db_repl_basic_local.vspx
index 3226a31..aea3e2b 100644
--- a/binsrc/yacutia/db_repl_basic_local.vspx
+++ b/binsrc/yacutia/db_repl_basic_local.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_basic_local.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_basic_local.vspx,v 1.2.2.3 2010/09/20 10:16:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_basic_local_create.vspx b/binsrc/yacutia/db_repl_basic_local_create.vspx
index a5dbbb5..07b8ef0 100644
--- a/binsrc/yacutia/db_repl_basic_local_create.vspx
+++ b/binsrc/yacutia/db_repl_basic_local_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_basic_local_create.vspx,v 1.3.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_basic_local_create.vspx,v 1.3.2.3 2010/09/20 10:16:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_basic_local_start.vspx b/binsrc/yacutia/db_repl_basic_local_start.vspx
index 686d5f5..5a080e7 100644
--- a/binsrc/yacutia/db_repl_basic_local_start.vspx
+++ b/binsrc/yacutia/db_repl_basic_local_start.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_basic_local_start.vspx,v 1.4.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_basic_local_start.vspx,v 1.4.2.3 2010/09/20 10:16:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_basic_start.vspx b/binsrc/yacutia/db_repl_basic_start.vspx
index aef9229..179f668 100644
--- a/binsrc/yacutia/db_repl_basic_start.vspx
+++ b/binsrc/yacutia/db_repl_basic_start.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_basic_start.vspx,v 1.5.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_basic_start.vspx,v 1.5.2.3 2010/09/20 10:16:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_bi.vspx b/binsrc/yacutia/db_repl_bi.vspx
index d3478a0..4f2742c 100644
--- a/binsrc/yacutia/db_repl_bi.vspx
+++ b/binsrc/yacutia/db_repl_bi.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_bi.vspx,v 1.3.2.3 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_bi.vspx,v 1.3.2.5 2011/01/25 14:21:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -59,7 +59,7 @@
       };
     </script>
       <v:form name="event_form3" type="simple" method="POST" action="">
-        <div class="listing_top_ctl_grp">
+        <div class="listing_top_ctl_grp clear">
           <v:button action="simple" value="Add table" name="data_set1_cr">
             <v:on-post>
               <v:script>
diff --git a/binsrc/yacutia/db_repl_bi_add.vspx b/binsrc/yacutia/db_repl_bi_add.vspx
index f751dd6..b8a101f 100644
--- a/binsrc/yacutia/db_repl_bi_add.vspx
+++ b/binsrc/yacutia/db_repl_bi_add.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_bi_add.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_bi_add.vspx,v 1.2.2.3 2010/09/20 10:16:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_bi_cr.vspx b/binsrc/yacutia/db_repl_bi_cr.vspx
index 5a6c3f9..abd1855 100644
--- a/binsrc/yacutia/db_repl_bi_cr.vspx
+++ b/binsrc/yacutia/db_repl_bi_cr.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_bi_cr.vspx,v 1.3.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_bi_cr.vspx,v 1.3.2.3 2010/09/20 10:16:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_bi_cr_edit.vspx b/binsrc/yacutia/db_repl_bi_cr_edit.vspx
index a46f3a3..09c60da 100644
--- a/binsrc/yacutia/db_repl_bi_cr_edit.vspx
+++ b/binsrc/yacutia/db_repl_bi_cr_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_bi_cr_edit.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_bi_cr_edit.vspx,v 1.2.2.3 2010/09/20 10:16:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_bi_create.vspx b/binsrc/yacutia/db_repl_bi_create.vspx
index 791502e..6783d8f 100644
--- a/binsrc/yacutia/db_repl_bi_create.vspx
+++ b/binsrc/yacutia/db_repl_bi_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_bi_create.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_bi_create.vspx,v 1.2.2.3 2010/09/20 10:16:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_bi_edit.vspx b/binsrc/yacutia/db_repl_bi_edit.vspx
index f96514c..ee0a721 100644
--- a/binsrc/yacutia/db_repl_bi_edit.vspx
+++ b/binsrc/yacutia/db_repl_bi_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_bi_edit.vspx,v 1.3.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_bi_edit.vspx,v 1.3.2.3 2010/09/20 10:16:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_bi_remove.vspx b/binsrc/yacutia/db_repl_bi_remove.vspx
index c80147b..79d4fad 100644
--- a/binsrc/yacutia/db_repl_bi_remove.vspx
+++ b/binsrc/yacutia/db_repl_bi_remove.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_bi_remove.vspx,v 1.3.2.3 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_bi_remove.vspx,v 1.3.2.4 2010/09/20 10:16:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_cr_edit.vspx b/binsrc/yacutia/db_repl_cr_edit.vspx
index c3d3e0d..61a28a3 100644
--- a/binsrc/yacutia/db_repl_cr_edit.vspx
+++ b/binsrc/yacutia/db_repl_cr_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_cr_edit.vspx,v 1.3.2.1 2009/08/27 22:43:48 source Exp $
+ -  $Id: db_repl_cr_edit.vspx,v 1.3.2.2 2010/09/20 10:16:39 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_pub.vspx b/binsrc/yacutia/db_repl_pub.vspx
index 84c2428..c05c013 100644
--- a/binsrc/yacutia/db_repl_pub.vspx
+++ b/binsrc/yacutia/db_repl_pub.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_pub.vspx,v 1.2.2.3 2010/06/10 18:48:11 source Exp $
+ -  $Id: db_repl_pub.vspx,v 1.2.2.4 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_pub_cr.vspx b/binsrc/yacutia/db_repl_pub_cr.vspx
index fa6af84..cfecfd1 100644
--- a/binsrc/yacutia/db_repl_pub_cr.vspx
+++ b/binsrc/yacutia/db_repl_pub_cr.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_pub_cr.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_pub_cr.vspx,v 1.2.2.3 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_pub_cr_edit.vspx b/binsrc/yacutia/db_repl_pub_cr_edit.vspx
index 6b863dc..972c26e 100644
--- a/binsrc/yacutia/db_repl_pub_cr_edit.vspx
+++ b/binsrc/yacutia/db_repl_pub_cr_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_pub_cr_edit.vspx,v 1.4.2.1 2009/08/27 22:43:48 source Exp $
+ -  $Id: db_repl_pub_cr_edit.vspx,v 1.4.2.2 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_pub_cr_edit2.vspx b/binsrc/yacutia/db_repl_pub_cr_edit2.vspx
index bb1cde3..56a2cf3 100644
--- a/binsrc/yacutia/db_repl_pub_cr_edit2.vspx
+++ b/binsrc/yacutia/db_repl_pub_cr_edit2.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_pub_cr_edit2.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_pub_cr_edit2.vspx,v 1.2.2.3 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_pub_create.vspx b/binsrc/yacutia/db_repl_pub_create.vspx
index 7af155c..a3d2854 100644
--- a/binsrc/yacutia/db_repl_pub_create.vspx
+++ b/binsrc/yacutia/db_repl_pub_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_pub_create.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_pub_create.vspx,v 1.2.2.3 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_pub_edit.vspx b/binsrc/yacutia/db_repl_pub_edit.vspx
index fdf1ba5..78819ee 100644
--- a/binsrc/yacutia/db_repl_pub_edit.vspx
+++ b/binsrc/yacutia/db_repl_pub_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_pub_edit.vspx,v 1.5.2.3 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_pub_edit.vspx,v 1.5.2.4 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_rdf_pub_edit.vspx b/binsrc/yacutia/db_repl_rdf_pub_edit.vspx
index 9f7a514..57ae71c 100644
--- a/binsrc/yacutia/db_repl_rdf_pub_edit.vspx
+++ b/binsrc/yacutia/db_repl_rdf_pub_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_rdf_pub_edit.vspx,v 1.1.4.2 2010/06/15 20:06:10 source Exp $
+ -  $Id: db_repl_rdf_pub_edit.vspx,v 1.1.4.3 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_snap.vspx b/binsrc/yacutia/db_repl_snap.vspx
index 6d7fe9e..0e06e41 100644
--- a/binsrc/yacutia/db_repl_snap.vspx
+++ b/binsrc/yacutia/db_repl_snap.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_snap.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_snap.vspx,v 1.2.2.3 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_snap_create.vspx b/binsrc/yacutia/db_repl_snap_create.vspx
index 3b64dec..6a696d5 100644
--- a/binsrc/yacutia/db_repl_snap_create.vspx
+++ b/binsrc/yacutia/db_repl_snap_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_snap_create.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_snap_create.vspx,v 1.2.2.3 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_snap_local.vspx b/binsrc/yacutia/db_repl_snap_local.vspx
index 17bea57..37ae9e1 100644
--- a/binsrc/yacutia/db_repl_snap_local.vspx
+++ b/binsrc/yacutia/db_repl_snap_local.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_snap_local.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_snap_local.vspx,v 1.2.2.3 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_snap_local_create.vspx b/binsrc/yacutia/db_repl_snap_local_create.vspx
index 5e586f6..b3e756c 100644
--- a/binsrc/yacutia/db_repl_snap_local_create.vspx
+++ b/binsrc/yacutia/db_repl_snap_local_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_snap_local_create.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_snap_local_create.vspx,v 1.2.2.3 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_snap_local_start.vspx b/binsrc/yacutia/db_repl_snap_local_start.vspx
index 33fdb83..d7f99bb 100644
--- a/binsrc/yacutia/db_repl_snap_local_start.vspx
+++ b/binsrc/yacutia/db_repl_snap_local_start.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_snap_local_start.vspx,v 1.2.2.3 2009/10/01 07:52:29 source Exp $
+ -  $Id: db_repl_snap_local_start.vspx,v 1.2.2.4 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_snap_pull.vspx b/binsrc/yacutia/db_repl_snap_pull.vspx
index 212a8a4..6ee94b7 100644
--- a/binsrc/yacutia/db_repl_snap_pull.vspx
+++ b/binsrc/yacutia/db_repl_snap_pull.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_snap_pull.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_snap_pull.vspx,v 1.2.2.4 2010/09/20 10:16:40 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -113,7 +113,7 @@
               _ex := 0;
               for select SN_SOURCE_TABLE as src, SN_NAME as dst, SN_LAST_TS as ts, RT_DSN from SYS_SNAPSHOT, SYS_REMOTE_TABLE where SN_SOURCE_TABLE = RT_NAME and SN_IS_INCREMENTAL is not null do
               {
-                _sch := coalesce ((select yac_hum_min_to_dur(SE_INTERVAL) from SYS_SCHEDULED_EVENT where SE_NAME = dst), 'none');
+                _sch := coalesce ((select yac_hum_min_to_dur(SE_INTERVAL) from SYS_SCHEDULED_EVENT where SE_NAME = 'UPDATE SNAPSHOT '||dst), 'none');
                 _ex := _ex + 1;
                 _ts := '**source not changed**';
                 if (ts is not null)
diff --git a/binsrc/yacutia/db_repl_snap_pull_create.vspx b/binsrc/yacutia/db_repl_snap_pull_create.vspx
index d6678b2..ec073e9 100644
--- a/binsrc/yacutia/db_repl_snap_pull_create.vspx
+++ b/binsrc/yacutia/db_repl_snap_pull_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_snap_pull_create.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_snap_pull_create.vspx,v 1.2.2.3 2010/09/20 10:16:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_snap_pull_start.vspx b/binsrc/yacutia/db_repl_snap_pull_start.vspx
index 491a41e..20305d8 100644
--- a/binsrc/yacutia/db_repl_snap_pull_start.vspx
+++ b/binsrc/yacutia/db_repl_snap_pull_start.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_snap_pull_start.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_snap_pull_start.vspx,v 1.2.2.3 2010/09/20 10:16:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_snap_start.vspx b/binsrc/yacutia/db_repl_snap_start.vspx
index 3186e0f..4c59d95 100644
--- a/binsrc/yacutia/db_repl_snap_start.vspx
+++ b/binsrc/yacutia/db_repl_snap_start.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_snap_start.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_snap_start.vspx,v 1.2.2.3 2010/09/20 10:16:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_sub.vspx b/binsrc/yacutia/db_repl_sub.vspx
index 19bfa24..b685d60 100644
--- a/binsrc/yacutia/db_repl_sub.vspx
+++ b/binsrc/yacutia/db_repl_sub.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: db_repl_sub.vspx,v 1.3.2.3 2010/06/10 18:48:11 source Exp $
+ -  $Id: db_repl_sub.vspx,v 1.3.2.4 2010/09/20 10:16:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_sub_create.vspx b/binsrc/yacutia/db_repl_sub_create.vspx
index 79f93dd..f3fc4e2 100644
--- a/binsrc/yacutia/db_repl_sub_create.vspx
+++ b/binsrc/yacutia/db_repl_sub_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_sub_create.vspx,v 1.4.2.4 2010/06/10 18:48:11 source Exp $
+ -  $Id: db_repl_sub_create.vspx,v 1.4.2.5 2010/09/20 10:16:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_sub_edit.vspx b/binsrc/yacutia/db_repl_sub_edit.vspx
index d362f47..cf1b071 100644
--- a/binsrc/yacutia/db_repl_sub_edit.vspx
+++ b/binsrc/yacutia/db_repl_sub_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_sub_edit.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_sub_edit.vspx,v 1.2.2.3 2010/09/20 10:16:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_sub_image.vspx b/binsrc/yacutia/db_repl_sub_image.vspx
index 7a85ea7..283ad6e 100644
--- a/binsrc/yacutia/db_repl_sub_image.vspx
+++ b/binsrc/yacutia/db_repl_sub_image.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: db_repl_sub_image.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_sub_image.vspx,v 1.2.2.3 2010/09/20 10:16:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_sub_new_inc.vspx b/binsrc/yacutia/db_repl_sub_new_inc.vspx
index 2fe63e9..49196cd 100644
--- a/binsrc/yacutia/db_repl_sub_new_inc.vspx
+++ b/binsrc/yacutia/db_repl_sub_new_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: db_repl_sub_new_inc.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_sub_new_inc.vspx,v 1.2.2.3 2010/09/20 10:16:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/db_repl_trans.vspx b/binsrc/yacutia/db_repl_trans.vspx
index 6e8fd6c..8d031b5 100644
--- a/binsrc/yacutia/db_repl_trans.vspx
+++ b/binsrc/yacutia/db_repl_trans.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: db_repl_trans.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: db_repl_trans.vspx,v 1.2.2.3 2010/09/20 10:16:41 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/error.vspx b/binsrc/yacutia/error.vspx
index 8273149..35cca06 100644
--- a/binsrc/yacutia/error.vspx
+++ b/binsrc/yacutia/error.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: error.vspx,v 1.4.2.2 2009/08/27 22:43:48 source Exp $
+ -  $Id: error.vspx,v 1.4.2.3 2010/09/20 10:16:42 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/fb_popup.vspx b/binsrc/yacutia/fb_popup.vspx
index 9488824..627a821 100644
--- a/binsrc/yacutia/fb_popup.vspx
+++ b/binsrc/yacutia/fb_popup.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: fb_popup.vspx,v 1.1.2.1 2010/01/29 15:10:09 source Exp $
+ -  $Id: fb_popup.vspx,v 1.1.2.2 2010/09/20 10:16:42 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/file_browser.xsl b/binsrc/yacutia/file_browser.xsl
index fc7b3ec..dfd3e94 100644
--- a/binsrc/yacutia/file_browser.xsl
+++ b/binsrc/yacutia/file_browser.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: file_browser.xsl,v 1.4.2.2 2009/08/27 22:43:48 source Exp $
+ -  $Id: file_browser.xsl,v 1.4.2.3 2010/09/20 10:16:42 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/file_save.vsp b/binsrc/yacutia/file_save.vsp
index 17381f5..4248979 100644
--- a/binsrc/yacutia/file_save.vsp
+++ b/binsrc/yacutia/file_save.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: file_save.vsp,v 1.3.2.2 2009/08/27 22:43:48 source Exp $
+--  $Id: file_save.vsp,v 1.3.2.3 2010/09/20 10:16:42 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/binsrc/yacutia/form.xsl b/binsrc/yacutia/form.xsl
index b482d21..14f1472 100644
--- a/binsrc/yacutia/form.xsl
+++ b/binsrc/yacutia/form.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: form.xsl,v 1.2.2.1 2009/08/27 22:43:48 source Exp $
+ -  $Id: form.xsl,v 1.2.2.2 2010/09/20 10:16:42 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/help.vspx b/binsrc/yacutia/help.vspx
index b1669db..ddf05fc 100644
--- a/binsrc/yacutia/help.vspx
+++ b/binsrc/yacutia/help.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: help.vspx,v 1.3.2.1 2009/08/27 22:43:48 source Exp $
+ -  $Id: help.vspx,v 1.3.2.3 2011/01/25 14:21:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -29,12 +29,12 @@
   </v:on-init>
   <vm:pagetitle>Virtuoso Conductor Help</vm:pagetitle>
   <vm:helppagewrapper>
-      <div style="font-size:15px;">
+      <!--div style="font-size:15px;">
         <form>
 	    <a href="#" style="text-decoration:none;" onclick="window.close (); return false;"><img title="Close" alt="Close" src="images/icons/close_24.png" border="0" />  Close</a>
         </form>
-      </div>
-      <div>
+      </div-->
+      <div class="help_content">
       <?vsp
           declare sPath,sName,sId varchar;
           declare aXml any;
diff --git a/binsrc/yacutia/help.xsl b/binsrc/yacutia/help.xsl
index eaa1f68..4cc1c69 100644
--- a/binsrc/yacutia/help.xsl
+++ b/binsrc/yacutia/help.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1" ?>
 <!--
  -
- -  $Id: help.xsl,v 1.2.2.1 2009/08/27 22:43:48 source Exp $
+ -  $Id: help.xsl,v 1.2.2.2 2010/09/20 10:16:42 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/hosted_grant.vspx b/binsrc/yacutia/hosted_grant.vspx
index 6ae3ff0..a29ad03 100644
--- a/binsrc/yacutia/hosted_grant.vspx
+++ b/binsrc/yacutia/hosted_grant.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hosted_grant.vspx,v 1.3.2.2 2009/08/27 22:43:48 source Exp $
+ -  $Id: hosted_grant.vspx,v 1.3.2.3 2010/09/20 10:16:42 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/hosted_import.vspx b/binsrc/yacutia/hosted_import.vspx
index 312df63..bf36e1a 100644
--- a/binsrc/yacutia/hosted_import.vspx
+++ b/binsrc/yacutia/hosted_import.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hosted_import.vspx,v 1.3.2.2 2009/08/27 22:43:48 source Exp $
+ -  $Id: hosted_import.vspx,v 1.3.2.3 2010/09/20 10:16:42 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/hosted_modules.vspx b/binsrc/yacutia/hosted_modules.vspx
index 4b51004..cebd871 100644
--- a/binsrc/yacutia/hosted_modules.vspx
+++ b/binsrc/yacutia/hosted_modules.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hosted_modules.vspx,v 1.3.2.2 2009/08/27 22:43:48 source Exp $
+ -  $Id: hosted_modules.vspx,v 1.3.2.3 2010/09/20 10:16:42 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/hosted_modules_load_results.vspx b/binsrc/yacutia/hosted_modules_load_results.vspx
index 1a3ab57..06d5fb1 100644
--- a/binsrc/yacutia/hosted_modules_load_results.vspx
+++ b/binsrc/yacutia/hosted_modules_load_results.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hosted_modules_load_results.vspx,v 1.2.2.1 2009/08/27 22:43:48 source Exp $
+ -  $Id: hosted_modules_load_results.vspx,v 1.2.2.2 2010/09/20 10:16:42 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/hosted_modules_select.vspx b/binsrc/yacutia/hosted_modules_select.vspx
index 6b56efb..414d4db 100644
--- a/binsrc/yacutia/hosted_modules_select.vspx
+++ b/binsrc/yacutia/hosted_modules_select.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hosted_modules_select.vspx,v 1.2.2.1 2009/08/27 22:43:48 source Exp $
+ -  $Id: hosted_modules_select.vspx,v 1.2.2.2 2010/09/20 10:16:42 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/hosted_modules_select2.vspx b/binsrc/yacutia/hosted_modules_select2.vspx
index f0c1d72..832eadb 100644
--- a/binsrc/yacutia/hosted_modules_select2.vspx
+++ b/binsrc/yacutia/hosted_modules_select2.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hosted_modules_select2.vspx,v 1.3.2.1 2009/08/27 22:43:48 source Exp $
+ -  $Id: hosted_modules_select2.vspx,v 1.3.2.2 2010/09/20 10:16:42 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/hosted_modules_show_sql.vsp b/binsrc/yacutia/hosted_modules_show_sql.vsp
index a5af85f..023fe96 100644
--- a/binsrc/yacutia/hosted_modules_show_sql.vsp
+++ b/binsrc/yacutia/hosted_modules_show_sql.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: hosted_modules_show_sql.vsp,v 1.2.2.1 2009/08/27 22:43:48 source Exp $
+--  $Id: hosted_modules_show_sql.vsp,v 1.2.2.2 2010/09/20 10:16:43 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/binsrc/yacutia/hosted_page.vspx b/binsrc/yacutia/hosted_page.vspx
index a7ab228..173f2a1 100644
--- a/binsrc/yacutia/hosted_page.vspx
+++ b/binsrc/yacutia/hosted_page.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: hosted_page.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: hosted_page.vspx,v 1.2.2.3 2010/09/20 10:16:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/http_add_path.vspx b/binsrc/yacutia/http_add_path.vspx
index f1e05da..65613fa 100644
--- a/binsrc/yacutia/http_add_path.vspx
+++ b/binsrc/yacutia/http_add_path.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: http_add_path.vspx,v 1.5.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: http_add_path.vspx,v 1.5.2.5 2010/11/19 16:43:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -72,7 +72,7 @@
 
     function defineOpts (val)
     {
-      if ('ssl' == val.options[val.selectedIndex].value) {
+      if ('SSL' == val.options[val.selectedIndex].value) {
         if (document.frm_edit_path.t_auth_opt.value == '') {
           document.frm_edit_path.t_auth_opt.value = 'https_cert=[file_with_certificate].pem;\nhttps_key=[file_with_private_key].pem;';
         }
@@ -122,6 +122,8 @@
       <v:variable name="auth_opt" persist="0" type="varchar" default="''" />
       <v:variable name="global_opts" persist="0" type="varchar" default="''" />
       <v:variable name="is_dav" persist="0" type="integer" default="0" />
+      <v:variable name="cors" persist="0" type="varchar" default="''" />
+      <v:variable name="cors_rej" persist="0" type="integer" default="0" />
     </vm:variables>
     <vm:header caption="HTTP Virtual Directory"/>
     <vm:pagebody>
@@ -171,16 +173,18 @@
               self.dirbrowsing := _dirbrowsing;
               self.is_dav      := _is_dav;
 	      self.defdir      := _defdir;
+
               if( isarray (self.global_opts) and not mod (length (self.global_opts),2))
+	        {
                 self.xmlexec := get_keyword ('xml_templates', self.global_opts, NULL);
-              if( isarray (self.global_opts) and not mod (length (self.global_opts),2))
                 self.ovrexec := get_keyword ('executable', self.global_opts, NULL);
-              if( isarray (self.global_opts) and not mod (length (self.global_opts),2))
                 self.ssbrow := get_keyword ('browse_sheet', self.global_opts, '');
 	      if (not isstring (self.ssbrow))
 	        self.ssbrow := '';
-              if( isarray (self.global_opts) and not mod (length (self.global_opts),2))
 	        self.noinherit := get_keyword ('noinherit', self.global_opts);
+                  self.cors := get_keyword ('cors', self.global_opts, '');  
+                  self.cors_rej := get_keyword ('cors_restricted', self.global_opts, 0);  
+	        }
             }
             else if (self.mode = 'add1')
             {
@@ -236,6 +240,8 @@
               }
               self.t_auth_opt.ufl_value := opts;
             }
+	    self.t_cors.ufl_value := self.cors;
+	    self.c_cors_rej.ufl_selected := self.cors_rej;
           ]]>
         </v:script>
       </v:before-render>
@@ -584,7 +590,7 @@
                           http( '<OPTION VALUE="basic"'); if (isstring (self.security) and lower(self.security) = 'basic') http (' selected="true"'); http('>Basic</OPTION>');
                           http( '<OPTION VALUE="digest"'); if (isstring (self.security) and lower(self.security) = 'digest') http (' selected="true"'); http('>Digest</OPTION>');
                         }
-                        http( '<OPTION VALUE="ssl"'); if (isstring (self.security) and lower(self.security) = 'ssl') http (' selected="true"'); http('>SSL</OPTION>');
+                        http( '<OPTION VALUE="SSL"'); if (isstring (self.security) and lower(self.security) = 'ssl') http (' selected="true"'); http('>SSL</OPTION>');
                   ?>
                 </SELECT>
               </td>
@@ -612,6 +618,19 @@
               </td>
             </tr>
             <tr>
+              <td valign="top"><label for="t_cors">Cross-Origin Resource Sharing</label></td>
+              <td>
+		  <v:text name="t_cors" xhtml_cols="30" xhtml_rows="3" xhtml_size="70" xhtml_id="t_cors"/><br/>
+                <v:check-box name="c_cors_rej" value="on" xhtml_id="c_cors_rej"/>
+                <label for="c_cors_rej">Reject Unintended CORs</label>
+              </td>
+            </tr>
+            <tr>
+              <td/>
+              <td>
+              </td>
+            </tr>
+            <tr>
               <td><label for="t_after_func">Post-processing Function</label></td>
               <td>
                 <v:text name="t_after_func" xhtml_id="t_after_func"/>
@@ -701,18 +720,29 @@
                       if(self.auth_func = '') self.auth_func := NULL;
                       self.after_func := self.t_after_func.ufl_value;
                       if(self.after_func = '') self.after_func := NULL;
-
+		      if (self.c_cors_rej.ufl_selected)
+		        self.cors_rej := 1;
+	              else		
+		        self.cors_rej := 0;
+	              self.cors := get_keyword ('t_cors', params, NULL); 		
                       self.auth_opt := self.t_auth_opt.ufl_value;
                       if (self.auth_opt = '' or self.auth_opt = 0)
                         self.auth_opt := NULL;
                       else if(isstring (self.auth_opt) ) {
+		          declare tmp, inx any;
                           self.auth_opt := replace (self.auth_opt, '\r', '');
                           self.auth_opt := replace (self.auth_opt, '\n', '');
                           self.auth_opt := trim (self.auth_opt);
                           self.auth_opt := replace (self.auth_opt, ';', '&');
                           if ("RIGHT" (self.auth_opt, 1) = '&')
                             self.auth_opt := "LEFT" (self.auth_opt, length (self.auth_opt) - 1);
-                          self.auth_opt := split_and_decode (self.auth_opt);
+                          tmp := split_and_decode (self.auth_opt);
+			  for (inx := 0; inx < length (tmp); inx := inx + 2)
+			     {
+                                if (tmp[inx] in ('https_verify', 'https_cv_depth'))
+				  tmp[inx+1] := atoi (tmp[inx+1]);
+			     }
+			  self.auth_opt := tmp;    
                       }
 
                       if (self.soap_opt = '' or self.soap_opt = 0)
@@ -759,6 +789,11 @@
 			    }
 			  self.global_opts := new_opts;
 		        }
+	              if (length (self.cors))
+		        {
+			  self.global_opts := vector_concat ( coalesce (self.global_opts, vector()), 
+			    vector('cors', self.cors, 'cors_restricted', self.cors_rej));
+			}
 
 		      if (self.lpath <> self.edit_lpath and exists (select 1 from DB.DBA.HTTP_PATH where HP_HOST = self._httphost and HP_LISTEN_HOST = self._host and HP_LPATH = self.lpath))
 		        {
diff --git a/binsrc/yacutia/http_del_path.vspx b/binsrc/yacutia/http_del_path.vspx
index e0ee04c..727007e 100644
--- a/binsrc/yacutia/http_del_path.vspx
+++ b/binsrc/yacutia/http_del_path.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: http_del_path.vspx,v 1.4.2.3 2009/08/28 13:05:22 source Exp $
+ -  $Id: http_del_path.vspx,v 1.4.2.4 2010/09/20 10:16:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/http_edit_paths.vspx b/binsrc/yacutia/http_edit_paths.vspx
index 2dca2e2..a45b1aa 100644
--- a/binsrc/yacutia/http_edit_paths.vspx
+++ b/binsrc/yacutia/http_edit_paths.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: http_edit_paths.vspx,v 1.5.2.3 2009/08/28 13:05:22 source Exp $
+ -  $Id: http_edit_paths.vspx,v 1.5.2.4 2010/09/20 10:16:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/http_host_clone.vspx b/binsrc/yacutia/http_host_clone.vspx
index 16035ba..935d78e 100644
--- a/binsrc/yacutia/http_host_clone.vspx
+++ b/binsrc/yacutia/http_host_clone.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: http_host_clone.vspx,v 1.7.2.3 2009/10/15 18:31:30 source Exp $
+ -  $Id: http_host_clone.vspx,v 1.7.2.4 2010/09/20 10:16:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/http_host_edit.vspx b/binsrc/yacutia/http_host_edit.vspx
index 5b93380..b948266 100644
--- a/binsrc/yacutia/http_host_edit.vspx
+++ b/binsrc/yacutia/http_host_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: http_host_edit.vspx,v 1.7.2.7 2010/07/06 10:42:05 source Exp $
+ -  $Id: http_host_edit.vspx,v 1.7.2.8 2010/09/20 10:16:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/http_listeners.vspx b/binsrc/yacutia/http_listeners.vspx
index 4c3fa36..759666b 100644
--- a/binsrc/yacutia/http_listeners.vspx
+++ b/binsrc/yacutia/http_listeners.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: http_listeners.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: http_listeners.vspx,v 1.2.2.3 2010/09/20 10:16:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/http_serv_mgmt.vspx b/binsrc/yacutia/http_serv_mgmt.vspx
index 388f934..342c8e0 100644
--- a/binsrc/yacutia/http_serv_mgmt.vspx
+++ b/binsrc/yacutia/http_serv_mgmt.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: http_serv_mgmt.vspx,v 1.14.2.5 2009/10/15 18:31:30 source Exp $
+ -  $Id: http_serv_mgmt.vspx,v 1.14.2.7 2010/09/20 10:16:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -383,6 +383,8 @@
 		      declare xt, xp any;
 		      xt := (control.vc_parent as vspx_tree_node).tn_element;
 		      xp := cast (xpath_eval ('@type',xt) as varchar);
+		      if (xp = 'SOAP')
+		        xp := 'Web Service';
 		      control.ufl_value := xp;
 		    </v:after-data-bind>
 		  </v:label>
diff --git a/binsrc/yacutia/http_serv_monitoring.vspx b/binsrc/yacutia/http_serv_monitoring.vspx
index ee498f3..0b0d8c6 100644
--- a/binsrc/yacutia/http_serv_monitoring.vspx
+++ b/binsrc/yacutia/http_serv_monitoring.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!--
  -
- -  $Id: http_serv_monitoring.vspx,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: http_serv_monitoring.vspx,v 1.3.2.2 2010/09/20 10:16:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/http_tcn.vspx b/binsrc/yacutia/http_tcn.vspx
index f6b8dd9..f270e9f 100644
--- a/binsrc/yacutia/http_tcn.vspx
+++ b/binsrc/yacutia/http_tcn.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: http_tcn.vspx,v 1.2.2.1 2009/08/28 13:05:22 source Exp $
+ -  $Id: http_tcn.vspx,v 1.2.2.2 2010/09/20 10:16:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/http_url_rewrite.vspx b/binsrc/yacutia/http_url_rewrite.vspx
index 5715dd8..d42088a 100644
--- a/binsrc/yacutia/http_url_rewrite.vspx
+++ b/binsrc/yacutia/http_url_rewrite.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: http_url_rewrite.vspx,v 1.14.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: http_url_rewrite.vspx,v 1.14.2.3 2010/09/20 10:16:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/ie.vspx b/binsrc/yacutia/ie.vspx
index 08b2762..78f9664 100644
--- a/binsrc/yacutia/ie.vspx
+++ b/binsrc/yacutia/ie.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ie.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: ie.vspx,v 1.2.2.3 2010/09/20 10:16:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/ie_browser.vspx b/binsrc/yacutia/ie_browser.vspx
index e6c9854..01dd0df 100644
--- a/binsrc/yacutia/ie_browser.vspx
+++ b/binsrc/yacutia/ie_browser.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: ie_browser.vspx,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: ie_browser.vspx,v 1.3.2.2 2010/09/20 10:16:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/ie_export.vspx b/binsrc/yacutia/ie_export.vspx
index 35c0473..ea753c7 100644
--- a/binsrc/yacutia/ie_export.vspx
+++ b/binsrc/yacutia/ie_export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: ie_export.vspx,v 1.4.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: ie_export.vspx,v 1.4.2.3 2010/09/20 10:16:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/ie_import.vspx b/binsrc/yacutia/ie_import.vspx
index 8047d8b..c267284 100644
--- a/binsrc/yacutia/ie_import.vspx
+++ b/binsrc/yacutia/ie_import.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: ie_import.vspx,v 1.4.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: ie_import.vspx,v 1.4.2.3 2010/09/20 10:16:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/import_csv_1.vspx b/binsrc/yacutia/import_csv_1.vspx
index 5c4807b..071e324 100644
--- a/binsrc/yacutia/import_csv_1.vspx
+++ b/binsrc/yacutia/import_csv_1.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: import_csv_1.vspx,v 1.1.2.5 2010/04/06 16:29:58 source Exp $
+ -  $Id: import_csv_1.vspx,v 1.1.2.6 2010/09/20 10:16:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/import_csv_2.vspx b/binsrc/yacutia/import_csv_2.vspx
index 695323d..2776e2e 100644
--- a/binsrc/yacutia/import_csv_2.vspx
+++ b/binsrc/yacutia/import_csv_2.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: import_csv_2.vspx,v 1.1.2.5 2010/04/08 14:43:08 source Exp $
+ -  $Id: import_csv_2.vspx,v 1.1.2.6 2010/09/20 10:16:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/import_csv_3.vspx b/binsrc/yacutia/import_csv_3.vspx
index b118822..d5c5ada 100644
--- a/binsrc/yacutia/import_csv_3.vspx
+++ b/binsrc/yacutia/import_csv_3.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: import_csv_3.vspx,v 1.1.2.4 2010/04/08 14:44:01 source Exp $
+ -  $Id: import_csv_3.vspx,v 1.1.2.5 2010/09/20 10:16:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/import_csv_opts.vspx b/binsrc/yacutia/import_csv_opts.vspx
index eaed913..7b1c2ce 100644
--- a/binsrc/yacutia/import_csv_opts.vspx
+++ b/binsrc/yacutia/import_csv_opts.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: import_csv_opts.vspx,v 1.1.2.5 2010/04/08 14:44:01 source Exp $
+ -  $Id: import_csv_opts.vspx,v 1.1.2.7 2011/03/23 12:03:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -65,6 +65,7 @@
 		      <v:item name="Space" value='space'/>
 		      <v:item name=";" value=';'/>
 		      <v:item name=":" value=':'/>
+		      <v:item name="|" value='|'/>
 		  </v:select-list>
              </td>
           </tr>
diff --git a/binsrc/yacutia/inifile.vspx b/binsrc/yacutia/inifile.vspx
index faeef63..e46537c 100644
--- a/binsrc/yacutia/inifile.vspx
+++ b/binsrc/yacutia/inifile.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: inifile.vspx,v 1.3.2.2 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile.vspx,v 1.3.2.4 2011/01/25 14:21:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -39,6 +39,7 @@
       <vm:menuitem value="Initial parameters" />
     </vm:menu>
     <vm:header caption="Virtuoso server startup parameters">
+      <vm:help id="inifile" sect=""/>
     </vm:header>
     <vm:pagebody>
       <script type="text/javascript">
@@ -53,7 +54,12 @@
 	  return 'page_tab_selected';
 	return 'page_tab';
       </v:method>
-      <v:form name="virtini" action="inifile.vspx"  method="POST" type="simple" xmlns:xhtml="http://www.w3.org/1999/xhtml"  fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/">
+      <v:form name="virtini" 
+              action="inifile.vspx"  
+              method="POST" 
+              type="simple" 
+              xmlns:xhtml="http://www.w3.org/1999/xhtml"  
+              fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/">
         <v:before-data-bind>
           <v:script>
             <![CDATA[
@@ -69,8 +75,7 @@
         </v:before-data-bind>
 	<v:template name="editor_template" type="simple" enabled="-- neq(self.to_del, 1)">
 	<input type="hidden" name="dd_sect" value="<?V self.pos ?>" />
-	<h3>Virtuoso configuration file "<?V adm_get_init_name() ?>"</h3>
-        <vm:help id="inifile" sect=""/>
+	<h3 class="clear">Virtuoso configuration file "<?V adm_get_init_name() ?>"</h3>
       <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
         <tr valign='top'>
           <td>
diff --git a/binsrc/yacutia/inifile.xml b/binsrc/yacutia/inifile.xml
index b9edbf3..5908b27 100644
--- a/binsrc/yacutia/inifile.xml
+++ b/binsrc/yacutia/inifile.xml
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: inifile.xml,v 1.1.1.1.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: inifile.xml,v 1.1.1.1.2.3 2010/09/20 10:16:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile.xsl b/binsrc/yacutia/inifile.xsl
index 6ca8453..4ea8848 100644
--- a/binsrc/yacutia/inifile.xsl
+++ b/binsrc/yacutia/inifile.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: inifile.xsl,v 1.4.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile.xsl,v 1.4.2.2 2010/09/20 10:16:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_autorepair.vspx b/binsrc/yacutia/inifile_autorepair.vspx
index 566e930..f31ba57 100644
--- a/binsrc/yacutia/inifile_autorepair.vspx
+++ b/binsrc/yacutia/inifile_autorepair.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: inifile_autorepair.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_autorepair.vspx,v 1.2.2.2 2010/09/20 10:16:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_autorepair_inc.vspx b/binsrc/yacutia/inifile_autorepair_inc.vspx
index ecb4ddb..3b32434 100644
--- a/binsrc/yacutia/inifile_autorepair_inc.vspx
+++ b/binsrc/yacutia/inifile_autorepair_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: inifile_autorepair_inc.vspx,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_autorepair_inc.vspx,v 1.3.2.2 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_client.vspx b/binsrc/yacutia/inifile_client.vspx
index bc47411..0d376db 100644
--- a/binsrc/yacutia/inifile_client.vspx
+++ b/binsrc/yacutia/inifile_client.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: inifile_client.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_client.vspx,v 1.2.2.2 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_client_inc.vspx b/binsrc/yacutia/inifile_client_inc.vspx
index 5f808a5..a7958cb 100644
--- a/binsrc/yacutia/inifile_client_inc.vspx
+++ b/binsrc/yacutia/inifile_client_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: inifile_client_inc.vspx,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_client_inc.vspx,v 1.3.2.2 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_database.vspx b/binsrc/yacutia/inifile_database.vspx
index 0f16ccc..43b15d4 100644
--- a/binsrc/yacutia/inifile_database.vspx
+++ b/binsrc/yacutia/inifile_database.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: inifile_database.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_database.vspx,v 1.2.2.2 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_database_inc.vspx b/binsrc/yacutia/inifile_database_inc.vspx
index 87ce3c2..748309e 100644
--- a/binsrc/yacutia/inifile_database_inc.vspx
+++ b/binsrc/yacutia/inifile_database_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: inifile_database_inc.vspx,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_database_inc.vspx,v 1.3.2.2 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_engine.vspx b/binsrc/yacutia/inifile_engine.vspx
index e3a5097..c69d98d 100644
--- a/binsrc/yacutia/inifile_engine.vspx
+++ b/binsrc/yacutia/inifile_engine.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: inifile_engine.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_engine.vspx,v 1.2.2.2 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_engine_inc.vspx b/binsrc/yacutia/inifile_engine_inc.vspx
index db7fa87..57b2e72 100644
--- a/binsrc/yacutia/inifile_engine_inc.vspx
+++ b/binsrc/yacutia/inifile_engine_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: inifile_engine_inc.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_engine_inc.vspx,v 1.2.2.2 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_http.vspx b/binsrc/yacutia/inifile_http.vspx
index f822e57..d939d3e 100644
--- a/binsrc/yacutia/inifile_http.vspx
+++ b/binsrc/yacutia/inifile_http.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: inifile_http.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_http.vspx,v 1.2.2.2 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_http_inc.vspx b/binsrc/yacutia/inifile_http_inc.vspx
index 878a133..71219b9 100644
--- a/binsrc/yacutia/inifile_http_inc.vspx
+++ b/binsrc/yacutia/inifile_http_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: inifile_http_inc.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_http_inc.vspx,v 1.2.2.2 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_metadata.xml b/binsrc/yacutia/inifile_metadata.xml
index 7f7d410..b03a0ae 100644
--- a/binsrc/yacutia/inifile_metadata.xml
+++ b/binsrc/yacutia/inifile_metadata.xml
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: inifile_metadata.xml,v 1.1.1.1.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: inifile_metadata.xml,v 1.1.1.1.2.3 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_repl.vspx b/binsrc/yacutia/inifile_repl.vspx
index d777052..1ca9069 100644
--- a/binsrc/yacutia/inifile_repl.vspx
+++ b/binsrc/yacutia/inifile_repl.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: inifile_repl.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_repl.vspx,v 1.2.2.2 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_repl_inc.vspx b/binsrc/yacutia/inifile_repl_inc.vspx
index 91435c9..a471002 100644
--- a/binsrc/yacutia/inifile_repl_inc.vspx
+++ b/binsrc/yacutia/inifile_repl_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: inifile_repl_inc.vspx,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_repl_inc.vspx,v 1.3.2.2 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_style.xsl b/binsrc/yacutia/inifile_style.xsl
index a6764e4..22f7c9e 100644
--- a/binsrc/yacutia/inifile_style.xsl
+++ b/binsrc/yacutia/inifile_style.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: inifile_style.xsl,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_style.xsl,v 1.3.2.2 2010/09/20 10:16:45 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_vdb.vspx b/binsrc/yacutia/inifile_vdb.vspx
index cc6e8d1..cf2af57 100644
--- a/binsrc/yacutia/inifile_vdb.vspx
+++ b/binsrc/yacutia/inifile_vdb.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: inifile_vdb.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_vdb.vspx,v 1.2.2.2 2010/09/20 10:16:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifile_vdb_inc.vspx b/binsrc/yacutia/inifile_vdb_inc.vspx
index b6b4d9c..bb95261 100644
--- a/binsrc/yacutia/inifile_vdb_inc.vspx
+++ b/binsrc/yacutia/inifile_vdb_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: inifile_vdb_inc.vspx,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: inifile_vdb_inc.vspx,v 1.3.2.2 2010/09/20 10:16:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/inifiles_load.sql b/binsrc/yacutia/inifiles_load.sql
index 36eb8a4..7f6550b 100644
--- a/binsrc/yacutia/inifiles_load.sql
+++ b/binsrc/yacutia/inifiles_load.sql
@@ -1,5 +1,5 @@
 --
---  $Id: inifiles_load.sql,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+--  $Id: inifiles_load.sql,v 1.2.2.2 2010/09/20 10:16:46 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/binsrc/yacutia/isql.vspx b/binsrc/yacutia/isql.vspx
index 8623573..25d3281 100644
--- a/binsrc/yacutia/isql.vspx
+++ b/binsrc/yacutia/isql.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: isql.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: isql.vspx,v 1.2.2.3 2011/02/16 20:45:16 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -137,7 +137,9 @@
 		   <v:error-summary/>
 		 </div>
 	       </v:template>
+	       <div style="clear:left;">
 	       <v:include url="isql_main_inc.vspx"/>
+	       </div>
 	     </v:template>
 	   </vm:popup_page_wrapper>
     </v:page>
diff --git a/binsrc/yacutia/isql_main.vspx b/binsrc/yacutia/isql_main.vspx
index db642c4..b36b55a 100644
--- a/binsrc/yacutia/isql_main.vspx
+++ b/binsrc/yacutia/isql_main.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: isql_main.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: isql_main.vspx,v 1.2.2.2 2010/09/20 10:16:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/isql_main_inc.vspx b/binsrc/yacutia/isql_main_inc.vspx
index 2f2539a..d3a0a83 100644
--- a/binsrc/yacutia/isql_main_inc.vspx
+++ b/binsrc/yacutia/isql_main_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version='1.0'?>
 <!--
  -
- -  $Id: isql_main_inc.vspx,v 1.4.2.3 2010/04/22 12:40:45 source Exp $
+ -  $Id: isql_main_inc.vspx,v 1.4.2.4 2010/09/20 10:16:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/ldap_import.vspx b/binsrc/yacutia/ldap_import.vspx
index d034e4b..e8f2bcd 100644
--- a/binsrc/yacutia/ldap_import.vspx
+++ b/binsrc/yacutia/ldap_import.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ldap_import.vspx,v 1.2.2.3 2010/07/09 13:10:36 source Exp $
+ -  $Id: ldap_import.vspx,v 1.2.2.4 2010/09/20 10:16:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/ldap_import_1.vspx b/binsrc/yacutia/ldap_import_1.vspx
index e4955ab..c94f590 100644
--- a/binsrc/yacutia/ldap_import_1.vspx
+++ b/binsrc/yacutia/ldap_import_1.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ldap_import_1.vspx,v 1.2.2.3 2010/07/09 13:10:36 source Exp $
+ -  $Id: ldap_import_1.vspx,v 1.2.2.4 2010/09/20 10:16:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/ldap_import_2.vspx b/binsrc/yacutia/ldap_import_2.vspx
index daabf09..28e3a48 100644
--- a/binsrc/yacutia/ldap_import_2.vspx
+++ b/binsrc/yacutia/ldap_import_2.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ldap_import_2.vspx,v 1.2.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: ldap_import_2.vspx,v 1.2.2.3 2010/09/20 10:16:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/ldap_import_3.vspx b/binsrc/yacutia/ldap_import_3.vspx
index 16a6581..7cf63be 100644
--- a/binsrc/yacutia/ldap_import_3.vspx
+++ b/binsrc/yacutia/ldap_import_3.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: ldap_import_3.vspx,v 1.3.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: ldap_import_3.vspx,v 1.3.2.3 2010/09/20 10:16:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/ldap_server.vspx b/binsrc/yacutia/ldap_server.vspx
index 3edd6bd..c50645f 100644
--- a/binsrc/yacutia/ldap_server.vspx
+++ b/binsrc/yacutia/ldap_server.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: ldap_server.vspx,v 1.3.2.3 2010/07/09 13:10:36 source Exp $
+ -  $Id: ldap_server.vspx,v 1.3.2.4 2010/09/20 10:16:46 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging.vspx b/binsrc/yacutia/logging.vspx
index 21d12a2..d0cad3e 100644
--- a/binsrc/yacutia/logging.vspx
+++ b/binsrc/yacutia/logging.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: logging.vspx,v 1.3.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: logging.vspx,v 1.3.2.3 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging_cli.vspx b/binsrc/yacutia/logging_cli.vspx
index 3938323..d583d3d 100644
--- a/binsrc/yacutia/logging_cli.vspx
+++ b/binsrc/yacutia/logging_cli.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: logging_cli.vspx,v 1.1.2.1 2009/08/28 13:05:22 source Exp $
+ -  $Id: logging_cli.vspx,v 1.1.2.2 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging_db.vspx b/binsrc/yacutia/logging_db.vspx
index 15b9cde..fc4db56 100644
--- a/binsrc/yacutia/logging_db.vspx
+++ b/binsrc/yacutia/logging_db.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: logging_db.vspx,v 1.3.2.2 2009/08/28 13:05:22 source Exp $
+ -  $Id: logging_db.vspx,v 1.3.2.3 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging_disk.vspx b/binsrc/yacutia/logging_disk.vspx
index 367d4dc..afed50f 100644
--- a/binsrc/yacutia/logging_disk.vspx
+++ b/binsrc/yacutia/logging_disk.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: logging_disk.vspx,v 1.3.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: logging_disk.vspx,v 1.3.2.3 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging_http.vspx b/binsrc/yacutia/logging_http.vspx
index b66121f..e4b4218 100644
--- a/binsrc/yacutia/logging_http.vspx
+++ b/binsrc/yacutia/logging_http.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: logging_http.vspx,v 1.3.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: logging_http.vspx,v 1.3.2.3 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging_index.vspx b/binsrc/yacutia/logging_index.vspx
index 0d9c8ee..4931caa 100644
--- a/binsrc/yacutia/logging_index.vspx
+++ b/binsrc/yacutia/logging_index.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: logging_index.vspx,v 1.3.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: logging_index.vspx,v 1.3.2.3 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging_lock.vspx b/binsrc/yacutia/logging_lock.vspx
index b0db491..c704ac4 100644
--- a/binsrc/yacutia/logging_lock.vspx
+++ b/binsrc/yacutia/logging_lock.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: logging_lock.vspx,v 1.3.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: logging_lock.vspx,v 1.3.2.3 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging_page.vspx b/binsrc/yacutia/logging_page.vspx
index 2d6c45c..c2fd10b 100644
--- a/binsrc/yacutia/logging_page.vspx
+++ b/binsrc/yacutia/logging_page.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: logging_page.vspx,v 1.4.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: logging_page.vspx,v 1.4.2.3 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging_prof.vspx b/binsrc/yacutia/logging_prof.vspx
index ca17c19..3410bc3 100644
--- a/binsrc/yacutia/logging_prof.vspx
+++ b/binsrc/yacutia/logging_prof.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: logging_prof.vspx,v 1.3.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: logging_prof.vspx,v 1.3.2.3 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging_space.vspx b/binsrc/yacutia/logging_space.vspx
index b84c5e3..580c863 100644
--- a/binsrc/yacutia/logging_space.vspx
+++ b/binsrc/yacutia/logging_space.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: logging_space.vspx,v 1.3.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: logging_space.vspx,v 1.3.2.3 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging_tab.vspx b/binsrc/yacutia/logging_tab.vspx
index 240cf6b..6a6c330 100644
--- a/binsrc/yacutia/logging_tab.vspx
+++ b/binsrc/yacutia/logging_tab.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: logging_tab.vspx,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: logging_tab.vspx,v 1.3.2.2 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging_tab.xsl b/binsrc/yacutia/logging_tab.xsl
index 20a459d..1837641 100644
--- a/binsrc/yacutia/logging_tab.xsl
+++ b/binsrc/yacutia/logging_tab.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="ISO-8859-1" ?>
 <!--
  -
- -  $Id: logging_tab.xsl,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: logging_tab.xsl,v 1.2.2.2 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/logging_view.vspx b/binsrc/yacutia/logging_view.vspx
index 5d487e7..62afb5f 100644
--- a/binsrc/yacutia/logging_view.vspx
+++ b/binsrc/yacutia/logging_view.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: logging_view.vspx,v 1.3.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: logging_view.vspx,v 1.3.2.3 2010/09/20 10:16:47 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/main_tabs.vspx b/binsrc/yacutia/main_tabs.vspx
index 3cfb5e9..c42a847 100644
--- a/binsrc/yacutia/main_tabs.vspx
+++ b/binsrc/yacutia/main_tabs.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: main_tabs.vspx,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: main_tabs.vspx,v 1.3.2.2 2010/09/20 10:16:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/make.xsl b/binsrc/yacutia/make.xsl
index 22ea920..e8e69da 100644
--- a/binsrc/yacutia/make.xsl
+++ b/binsrc/yacutia/make.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: make.xsl,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: make.xsl,v 1.2.2.2 2010/09/20 10:16:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/mapped_schema_xml.vspx b/binsrc/yacutia/mapped_schema_xml.vspx
index b8ec91d..cdfe5b9 100644
--- a/binsrc/yacutia/mapped_schema_xml.vspx
+++ b/binsrc/yacutia/mapped_schema_xml.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: mapped_schema_xml.vspx,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: mapped_schema_xml.vspx,v 1.3.2.2 2010/09/20 10:16:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/merge.xsl b/binsrc/yacutia/merge.xsl
index b646897..a2f3764 100644
--- a/binsrc/yacutia/merge.xsl
+++ b/binsrc/yacutia/merge.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: merge.xsl,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: merge.xsl,v 1.2.2.2 2010/09/20 10:16:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/mkvad.ini b/binsrc/yacutia/mkvad.ini
index db7ac15..ecda69f 100644
--- a/binsrc/yacutia/mkvad.ini
+++ b/binsrc/yacutia/mkvad.ini
@@ -1,7 +1,7 @@
 ;
 ;  mkvad.ini
 ;
-;  $Id: mkvad.ini,v 1.1.1.1 2006/04/11 17:56:10 source Exp $
+;  $Id: mkvad.ini,v 1.1.1.1.2.1 2010/09/20 10:16:48 source Exp $
 ;
 ;  Configuration file for the creation of the demo database
 ;
diff --git a/binsrc/yacutia/mkvad.sh b/binsrc/yacutia/mkvad.sh
index 8aa9826..cbdb956 100755
--- a/binsrc/yacutia/mkvad.sh
+++ b/binsrc/yacutia/mkvad.sh
@@ -2,7 +2,7 @@
 #
 #  mkvad.sh
 #
-#  $Id: mkvad.sh,v 1.20.2.6 2010/01/29 15:10:09 source Exp $
+#  $Id: mkvad.sh,v 1.20.2.8 2011/02/03 10:30:29 source Exp $
 #
 #  Creates a vad package for Virtuoso Conductor
 #
@@ -304,7 +304,7 @@ echo "  <caption>" >> $STICKER
 echo "    <name package=\"conductor\">" >> $STICKER
 echo "      <prop name=\"Title\" value=\"Virtuoso Conductor\"/>" >> $STICKER
 echo "      <prop name=\"Developer\" value=\"OpenLink Software\"/>" >> $STICKER
-echo "      <prop name=\"Copyright\" value=\"(C) 1998-2010 OpenLink Software\"/>" >> $STICKER
+echo "      <prop name=\"Copyright\" value=\"(C) 1998-2011 OpenLink Software\"/>" >> $STICKER
 echo "      <prop name=\"Download\" value=\"http://www.openlinksw.com/virtuoso/conductor/download\"/>" >> $STICKER
 echo "      <prop name=\"Download\" value=\"http://www.openlinksw.co.uk/virtuoso/conductor/download\"/>" >> $STICKER
 echo "    </name>" >> $STICKER
diff --git a/binsrc/yacutia/mkvad.sql b/binsrc/yacutia/mkvad.sql
index b407fbd..4b5e1bb 100644
--- a/binsrc/yacutia/mkvad.sql
+++ b/binsrc/yacutia/mkvad.sql
@@ -1,5 +1,5 @@
 --
---  $Id: mkvad.sql,v 1.1.1.1.2.2 2009/08/28 13:05:23 source Exp $
+--  $Id: mkvad.sql,v 1.1.1.1.2.3 2010/09/20 10:16:48 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/binsrc/yacutia/msg_news_conf.vspx b/binsrc/yacutia/msg_news_conf.vspx
index 516a1d1..96795a8 100644
--- a/binsrc/yacutia/msg_news_conf.vspx
+++ b/binsrc/yacutia/msg_news_conf.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: msg_news_conf.vspx,v 1.4.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: msg_news_conf.vspx,v 1.4.2.3 2010/09/20 10:16:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/msg_news_conf_global.vspx b/binsrc/yacutia/msg_news_conf_global.vspx
index 14466b9..3ba905a 100644
--- a/binsrc/yacutia/msg_news_conf_global.vspx
+++ b/binsrc/yacutia/msg_news_conf_global.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: msg_news_conf_global.vspx,v 1.3.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: msg_news_conf_global.vspx,v 1.3.2.3 2010/09/20 10:16:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/msg_news_group_info.vspx b/binsrc/yacutia/msg_news_group_info.vspx
index c9bae16..0438f59 100644
--- a/binsrc/yacutia/msg_news_group_info.vspx
+++ b/binsrc/yacutia/msg_news_group_info.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: msg_news_group_info.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: msg_news_group_info.vspx,v 1.2.2.2 2010/09/20 10:16:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/msg_news_group_message_body.vspx b/binsrc/yacutia/msg_news_group_message_body.vspx
index b4419e6..11841aa 100644
--- a/binsrc/yacutia/msg_news_group_message_body.vspx
+++ b/binsrc/yacutia/msg_news_group_message_body.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: msg_news_group_message_body.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: msg_news_group_message_body.vspx,v 1.2.2.3 2010/09/20 10:16:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/msg_news_group_messages.vspx b/binsrc/yacutia/msg_news_group_messages.vspx
index 568413e..8c122fb 100644
--- a/binsrc/yacutia/msg_news_group_messages.vspx
+++ b/binsrc/yacutia/msg_news_group_messages.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: msg_news_group_messages.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: msg_news_group_messages.vspx,v 1.2.2.3 2010/09/20 10:16:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/msg_news_group_messages_list.vspx b/binsrc/yacutia/msg_news_group_messages_list.vspx
index 96fc8c8..13fe0de 100644
--- a/binsrc/yacutia/msg_news_group_messages_list.vspx
+++ b/binsrc/yacutia/msg_news_group_messages_list.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: msg_news_group_messages_list.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: msg_news_group_messages_list.vspx,v 1.2.2.2 2010/09/20 10:16:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/msg_news_group_subscribe.vspx b/binsrc/yacutia/msg_news_group_subscribe.vspx
index c5a29d6..726ac6f 100644
--- a/binsrc/yacutia/msg_news_group_subscribe.vspx
+++ b/binsrc/yacutia/msg_news_group_subscribe.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: msg_news_group_subscribe.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: msg_news_group_subscribe.vspx,v 1.2.2.3 2010/09/20 10:16:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/msg_news_groups.vspx b/binsrc/yacutia/msg_news_groups.vspx
index d2235bb..5f2c581 100644
--- a/binsrc/yacutia/msg_news_groups.vspx
+++ b/binsrc/yacutia/msg_news_groups.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: msg_news_groups.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: msg_news_groups.vspx,v 1.2.2.3 2010/09/20 10:16:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/msg_news_server_details.vspx b/binsrc/yacutia/msg_news_server_details.vspx
index 3699388..f7537cd 100644
--- a/binsrc/yacutia/msg_news_server_details.vspx
+++ b/binsrc/yacutia/msg_news_server_details.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: msg_news_server_details.vspx,v 1.4.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: msg_news_server_details.vspx,v 1.4.2.2 2010/09/20 10:16:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/msg_news_server_info.vspx b/binsrc/yacutia/msg_news_server_info.vspx
index f5ec010..6ea0810 100644
--- a/binsrc/yacutia/msg_news_server_info.vspx
+++ b/binsrc/yacutia/msg_news_server_info.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: msg_news_server_info.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: msg_news_server_info.vspx,v 1.2.2.2 2010/09/20 10:16:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/page.xsl b/binsrc/yacutia/page.xsl
index 6d497d7..02fbad6 100644
--- a/binsrc/yacutia/page.xsl
+++ b/binsrc/yacutia/page.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: page.xsl,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: page.xsl,v 1.3.2.2 2010/09/20 10:16:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/persistent_xmlns.vspx b/binsrc/yacutia/persistent_xmlns.vspx
new file mode 100644
index 0000000..799bd4c
--- /dev/null
+++ b/binsrc/yacutia/persistent_xmlns.vspx
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: persistent_xmlns.vspx,v 1.1.4.3 2010/09/20 10:16:49 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2010 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+ -
+-->
+<v:page name="xmlns_decl" decor="yacutia_decor.vspx" style="yacutia_style.xsl" 
+    doctype="-//W3C//DTD XHTML 1.0 Transitional//EN" fast-render="1" 
+    xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro">
+  <vm:pagetitle>Persistent XML namespaces</vm:pagetitle>
+  <vm:pagewrapper>
+ <vm:variables>
+  </vm:variables>
+  <vm:menu>
+    <vm:menuitem value="Persistent XML Namespaces"/>
+  </vm:menu>
+  <vm:header caption="Persistent XML Namespaces">
+  </vm:header>
+  <vm:pagebody>
+      <v:form name="frm1" method="POST" type="simple">
+        <table class="listing">
+	  <tr class="listing_header_row">
+	    <th>Prefix</th>
+	    <th>URI</th>
+	    <th>Action</th>
+	  </tr>
+	  <v:data-set name="ds1" sql="select NS_PREFIX, NS_URL from SYS_XML_PERSISTENT_NS_DECL order by NS_PREFIX" nrows="20" scrollable="1" edit="1">
+	      <v:before-data-bind><![CDATA[
+declare to_del varchar;
+to_del := get_keyword ('del', self.vc_event.ve_params, null);
+if (to_del is not null)
+   DB.DBA.XML_REMOVE_NS_BY_PREFIX (to_del, 2);
+	      ]]></v:before-data-bind>
+	      <v:template type="repeat" name="dst1">
+		  <v:template type="if-not-exists" name="dst2">
+		      <tr>
+			  <td align="center" colspan="3">No rows selected</td>
+		      </tr>
+		  </v:template>
+		  <v:template type="browse" name="dst3">
+		      <tr>
+			  <td><?V control.te_rowset[0] ?></td>
+			  <td><?V control.te_rowset[1] ?></td>
+			  <td>
+			      <v:url name="u1" value='<img src="images/icons/trash_16.png" border="0" alt="Delete" title="Delete" />Delete' 
+				  format="%s" url="--sprintf ('persistent_xmlns.vspx?del=%U', (control.vc_parent as vspx_row_template).te_rowset[0])" render-only="1"/>
+			  </td>
+		      </tr>
+		  </v:template>
+	      </v:template>
+	      <v:template type="simple" name="dst4">
+		  <tr class="browse_button_row">
+		      <td colspan="3" align="center"  class="listing_col_action">
+			  <vm:ds-navigation data-set="ds1"/>
+		      </td>
+		  </tr>
+	      </v:template>
+	  </v:data-set>
+         </table>
+         <br/>
+	 Prefix: <v:text name="pref" value="" xhtml_size="10" />
+         <br/>
+	 URI: <v:text name="uri" value="" xhtml_size="100" />
+	 <br/>
+	 <v:button action="simple" name="add_bt" value="Add New">
+	     <v:on-post><![CDATA[
+declare stat, msg any;
+self.pref.ufl_value := trim (self.pref.ufl_value);
+if 
+(
+  length (self.pref.ufl_value) = 0
+  or
+  length (self.uri.ufl_value) = 0
+)
+{
+   self.vc_is_valid := 0;
+   self.vc_error_message := 'Prefix and Namespace URI must not be empty strings';
+   return;
+}
+DB.DBA.XML_SET_NS_DECL (self.pref.ufl_value, self.uri.ufl_value, 2);
+self.pref.ufl_value := '';
+self.uri.ufl_value := '';
+self.ds1.vc_data_bind (e);
+		 ]]></v:on-post>
+	 </v:button>
+      </v:form>
+  </vm:pagebody>
+  </vm:pagewrapper>
+</v:page>
diff --git a/binsrc/yacutia/popup2_browser.vspx b/binsrc/yacutia/popup2_browser.vspx
index 5deb270..7606c5d 100644
--- a/binsrc/yacutia/popup2_browser.vspx
+++ b/binsrc/yacutia/popup2_browser.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: popup2_browser.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: popup2_browser.vspx,v 1.2.2.2 2010/09/20 10:16:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/popup_browser.vspx b/binsrc/yacutia/popup_browser.vspx
index 51bc4c4..7178d74 100644
--- a/binsrc/yacutia/popup_browser.vspx
+++ b/binsrc/yacutia/popup_browser.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: popup_browser.vspx,v 1.2.2.3 2010/02/12 11:23:34 source Exp $
+ -  $Id: popup_browser.vspx,v 1.2.2.4 2010/09/20 10:16:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/rdf_conf.vspx b/binsrc/yacutia/rdf_conf.vspx
new file mode 100644
index 0000000..82fef0b
--- /dev/null
+++ b/binsrc/yacutia/rdf_conf.vspx
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: rdf_conf.vspx,v 1.1.4.4 2010/11/08 11:45:35 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2010 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+ -
+-->
+<v:page name="sparql_create_page"
+        decor="yacutia_decor.vspx"
+        style="yacutia_style.xsl"
+        vm:owner="yacutia_sparql_page"
+        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
+        fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/"
+        xmlns:vm="http://www.openlinksw.com/vspx/macro">
+ <vm:pagetitle>Configuration</vm:pagetitle>
+ <vm:pagewrapper>
+    <vm:variables>
+      <v:variable name="del" default="null" type="int" persist="temp" param-name="del"/>
+      <v:variable name="vhost" default="null" type="varchar" persist="temp" param-name="vhost"/>
+      <v:variable name="lhost" default="null" type="varchar" persist="temp" param-name="lhost"/>
+    </vm:variables>
+  <vm:menu>
+   <vm:menuitem value="Configuration"/>
+  </vm:menu>
+  <vm:header caption="Configuration"/>
+  <vm:pagebody>
+      <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
+        <tr valign='top'>
+          <td>
+		<!-- tab -->
+            <table cellpadding='10' cellspacing='0' border='0' width='100%'>
+              <tr>
+                <td>
+                  <table cellpadding="0" cellspacing="0" border="0">
+                    <colgroup>
+                      <col/>
+                      <col/>
+                      <col/>
+                      <col/>
+                      <col/>
+                    </colgroup>
+                    <tr>
+                        <td class="page_tab" align="center" nowrap="1">
+                          <v:url name="url1" value="Extractor Cartridges" format="%s" url="rdf_filters.vspx" xhtml_class="uddi"/>
+                        </td>
+                        <td class="page_tab" align="center" nowrap="1">
+                          <v:url name="url2" value="Meta Cartridges" format="%s" url="rdf_filters_pp.vspx" xhtml_class="uddi"/>
+                        </td>
+                      <td class="page_tab" align="center" nowrap="1">
+                        <v:url name="url1" value="Stylesheets" format="%s" url="sparql_filters.vspx" xhtml_class="uddi"/>
+		      </td>
+                      <td class="page_tab" align="center" nowrap="1">
+                        <v:url name="url3" value="Console" format="%s" url="rdf_console.vspx" xhtml_class="uddi"/>
+		      </td>
+                        <td class="page_tab_selected" align="center" nowrap="1">
+                          Configuration
+                        </td>
+                        <td class="page_tab_empty" align="center" width="100%">
+                          <table cellpadding="0" cellspacing="0">
+                            <tr>
+                              <td width="100%" >
+                              </td>
+                            </tr>
+                          </table>
+                        </td>
+                    </tr>
+		</table>
+		<v:on-init><![CDATA[
+		if (self.del)
+                  {
+		    DB.DBA.VHOST_REMOVE ( lhost=>self.lhost, vhost=>self.vhost, lpath=>'/rdfdesc');
+		    DB.DBA.VHOST_REMOVE ( lhost=>self.lhost, vhost=>self.vhost, lpath=>'/about/id');
+		    DB.DBA.VHOST_REMOVE ( lhost=>self.lhost, vhost=>self.vhost, lpath=>'/about/id/entity'); 
+		    DB.DBA.VHOST_REMOVE ( lhost=>self.lhost, vhost=>self.vhost, lpath=>'/about/data'); 
+		    DB.DBA.VHOST_REMOVE ( lhost=>self.lhost, vhost=>self.vhost, lpath=>'/about/data/entity');
+		  }
+		    ]]></v:on-init>
+		  <table class="tab_page">
+		      <tr>
+			  <td valign="top">
+			      <!-- tab -->
+			      <table class="listing">
+				  <thead>
+				      <tr class="listing_header_row">
+					  <th>Endpoint</th>
+					  <th>Action</th>
+				      </tr>
+				  </thead>
+				  <?vsp 
+				   for select distinct hp_host, hp_listen_host from http_path where hp_security = 'SSL' and HP_LPATH = '/about/id/entity' do { ?>
+				  <tr>
+				      <td><?V hp_host ?>(<?V hp_listen_host ?>)</td>
+				      <td>
+					  <v:url name="ur1" url="--sprintf ('rdf_conf.vspx?del=1&vhost=%U&lhost=%U', hp_host, hp_listen_host)" render-only="1" value="Delete Sponger Endpoints"/>
+				      </td>
+				  </tr>
+				  <?vsp } ?>
+			      </table>
+			      <br/>
+			      <v:form name="frm1" type="simple" method="POST">
+              Virtual Host:				  
+              <select name="l_domains" xhtml_id="l_domains">
+                <?vsp
+		for select distinct HP_HOST, HP_LISTEN_HOST from DB.DBA.HTTP_PATH where HP_HOST not like '%ini%' and HP_SECURITY = 'SSL' 
+		do
+                  {
+                    http(sprintf ('<option value=\"%s=%s\">%s (%s)</option>', HP_HOST, HP_LISTEN_HOST, HP_HOST, HP_LISTEN_HOST));
+                  }
+                ?>
+	    </select> 
+	    <v:button action="simple" name="save" value="Create Secure Endpoints">
+		<v:on-post><![CDATA[
+		    declare vhost, lhost, arr, domain any;
+		    domain := get_keyword('l_domains', self.vc_event.ve_params);
+		    domain := trim(domain, '/.\\ ');
+		    arr := split_and_decode(domain);
+		    vhost := arr[0];
+		    lhost := arr[1];
+		    RDF_CARTRIDGES_SECURE_VD (vhost, lhost);
+		    ]]></v:on-post>
+	    </v:button>
+			      </v:form>
+			      <!-- end tab  -->
+			  </td>
+		      </tr>
+		  </table>
+	      </td>
+	  </tr>
+      </table>
+		<!-- end tab -->
+          </td>
+        </tr>
+      </table>
+  </vm:pagebody>
+ </vm:pagewrapper>
+</v:page>
diff --git a/binsrc/yacutia/rdf_console.vspx b/binsrc/yacutia/rdf_console.vspx
index baaec57..817e53c 100644
--- a/binsrc/yacutia/rdf_console.vspx
+++ b/binsrc/yacutia/rdf_console.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: rdf_console.vspx,v 1.1.2.3 2009/12/07 12:41:24 source Exp $
+ -  $Id: rdf_console.vspx,v 1.1.2.6 2010/11/08 11:45:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -65,7 +65,7 @@
                     </colgroup>
                     <tr>
                         <td class="page_tab" align="center" nowrap="1">
-                          <v:url name="url1" value="Cartridges" format="%s" url="rdf_filters.vspx" xhtml_class="uddi"/>
+                          <v:url name="url1" value="Extractor Cartridges" format="%s" url="rdf_filters.vspx" xhtml_class="uddi"/>
                         </td>
                         <td class="page_tab" align="center" nowrap="1">
                           <v:url name="url2" value="Meta Cartridges" format="%s" url="rdf_filters_pp.vspx" xhtml_class="uddi"/>
@@ -76,6 +76,9 @@
                         <td class="page_tab_selected" align="center" nowrap="1">
                           Console
                         </td>
+                      <td class="page_tab" align="center" nowrap="1">
+                        <v:url name="url4" value="Configuration" format="%s" url="rdf_conf.vspx" xhtml_class="uddi"/>
+		      </td>
                         <td class="page_tab_empty" align="center" width="100%">
                           <table cellpadding="0" cellspacing="0">
                             <tr>
diff --git a/binsrc/yacutia/rdf_filters.vspx b/binsrc/yacutia/rdf_filters.vspx
index 4aefb5d..a019661 100644
--- a/binsrc/yacutia/rdf_filters.vspx
+++ b/binsrc/yacutia/rdf_filters.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: rdf_filters.vspx,v 1.9.2.5 2009/11/30 23:44:08 source Exp $
+ -  $Id: rdf_filters.vspx,v 1.9.2.8 2010/11/08 11:45:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -41,7 +41,7 @@
     <vm:menu>
       <vm:menuitem value="Cartridges"/>
     </vm:menu>
-    <vm:header caption="Cartridges"/>
+    <vm:header caption="Extractor Cartridges"/>
     <vm:pagebody>
       <![CDATA[
 	      <script language="JavaScript" src="admin_utils.js"></script>
@@ -63,7 +63,7 @@
                     </colgroup>
                     <tr>
                       <td class="page_tab_selected" align="center" nowrap="1">
-                        Cartridges
+                        Extractor Cartridges
           		        </td>
       			          <?vsp if (check_package('rdf_mappers')) { ?>
                       <td class="page_tab" align="center" nowrap="1">
@@ -75,6 +75,9 @@
                       <td class="page_tab" align="center" nowrap="1">
                         <v:url name="url3" value="Console" format="%s" url="rdf_console.vspx" xhtml_class="uddi"/>
 		      </td>
+                      <td class="page_tab" align="center" nowrap="1">
+                        <v:url name="url4" value="Configuration" format="%s" url="rdf_conf.vspx" xhtml_class="uddi"/>
+		      </td>
                       <?vsp } ?>
                       <td class="page_tab_empty" align="center" width="100%">
                         <table cellpadding="0" cellspacing="0">
diff --git a/binsrc/yacutia/rdf_filters_pp.vspx b/binsrc/yacutia/rdf_filters_pp.vspx
index 62b715f..e288302 100644
--- a/binsrc/yacutia/rdf_filters_pp.vspx
+++ b/binsrc/yacutia/rdf_filters_pp.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: rdf_filters_pp.vspx,v 1.3.2.4 2010/03/01 00:28:51 source Exp $
+ -  $Id: rdf_filters_pp.vspx,v 1.3.2.7 2010/11/08 11:45:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -62,7 +62,7 @@
                     </colgroup>
                     <tr>
                       <td class="page_tab" align="center" nowrap="1">
-                        <v:url name="url1" value="Cartridges" format="%s" url="rdf_filters.vspx" xhtml_class="uddi"/>
+                        <v:url name="url1" value="Extractor Cartridges" format="%s" url="rdf_filters.vspx" xhtml_class="uddi"/>
                       </td>
                       <td class="page_tab_selected" align="center" nowrap="1">
                         Meta Cartridges
@@ -74,6 +74,9 @@
                       <td class="page_tab" align="center" nowrap="1">
                         <v:url name="url3" value="Console" format="%s" url="rdf_console.vspx" xhtml_class="uddi"/>
   		                </td>
+                      <td class="page_tab" align="center" nowrap="1">
+                        <v:url name="url4" value="Configuration" format="%s" url="rdf_conf.vspx" xhtml_class="uddi"/>
+		      </td>
                       <?vsp } ?>
                       <td class="page_tab_empty" align="center" width="100%">
                         <table cellpadding="0" cellspacing="0">
@@ -316,6 +319,7 @@
                                     <v:select-list name="typ1" value="" xhtml_id="typ1" error-glyph="*">
                                       <v:item name="Content Type" value="MIME"/>
                                       <v:item name="URL" value="URL"/>
+                                      <v:item name="Entity Type" value="CLASS"/>
                                       <v:item name="HTTP protocol" value="HTTP"/>
                                     </v:select-list>
                                     <br />
diff --git a/binsrc/yacutia/rdf_import.vspx b/binsrc/yacutia/rdf_import.vspx
index c2af01b..8a6fe7b 100644
--- a/binsrc/yacutia/rdf_import.vspx
+++ b/binsrc/yacutia/rdf_import.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: rdf_import.vspx,v 1.1.4.2 2010/06/24 15:32:12 source Exp $
+ -  $Id: rdf_import.vspx,v 1.1.4.3 2010/09/20 10:16:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/rdf_psh_subs.vspx b/binsrc/yacutia/rdf_psh_subs.vspx
index da07aaa..26b26e4 100644
--- a/binsrc/yacutia/rdf_psh_subs.vspx
+++ b/binsrc/yacutia/rdf_psh_subs.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: rdf_psh_subs.vspx,v 1.1.4.2 2010/06/24 15:32:12 source Exp $
+ -  $Id: rdf_psh_subs.vspx,v 1.1.4.3 2010/09/20 10:16:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/rdf_schemas.vspx b/binsrc/yacutia/rdf_schemas.vspx
index abb82dd..c5a90f7 100644
--- a/binsrc/yacutia/rdf_schemas.vspx
+++ b/binsrc/yacutia/rdf_schemas.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: rdf_schemas.vspx,v 1.1.2.4 2009/08/28 13:05:23 source Exp $
+ -  $Id: rdf_schemas.vspx,v 1.1.2.5 2010/09/20 10:16:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/rdf_void.vspx b/binsrc/yacutia/rdf_void.vspx
index 5d45166..bb9d2f5 100644
--- a/binsrc/yacutia/rdf_void.vspx
+++ b/binsrc/yacutia/rdf_void.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: rdf_void.vspx,v 1.2.2.1 2009/08/28 13:05:23 source Exp $
+ -  $Id: rdf_void.vspx,v 1.2.2.2 2010/09/20 10:16:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/robot_control.vspx b/binsrc/yacutia/robot_control.vspx
index d8e20e5..8ee5d96 100644
--- a/binsrc/yacutia/robot_control.vspx
+++ b/binsrc/yacutia/robot_control.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: robot_control.vspx,v 1.2.2.4 2010/05/26 15:21:53 source Exp $
+ -  $Id: robot_control.vspx,v 1.2.2.7 2010/11/19 16:44:01 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -78,7 +78,7 @@
         </tr>
       </table>
       <div class="scroll_area">
-      <v:data-set name="data_set2" sql="select VS_DESCR, VS_HOST, VS_URL, VS_ROOT from WS.WS.VFS_SITE" nrows="1000" scrollable="1" cursor-type="keyset" edit="1">
+      <v:data-set name="data_set2" sql="select VS_DESCR, VS_HOST, VS_URL, VS_ROOT from WS.WS.VFS_SITE" nrows="1000" scrollable="1" cursor-type="dynamic" edit="1">
         <input type="hidden" name="page" value="2"/>
         <v:column name="VS_DESCR" />
         <v:column name="VS_HOST" />
@@ -144,8 +144,8 @@
 			declare exit handler for sqlstate '*'
 			{
                           log_enable (old_mode, 1);
-			  self.vs_is_valid := 0;
-			  self.vs_error_message := 'The delete failed. You must manually corresponding entries from WS.WS.VFS_QUEUE and WS.WS.VFS_URL table.';
+			  self.vc_is_valid := 0;
+			  self.vc_error_message := sprintf ('The delete failed due to SQL error: %s. You must delete manually corresponding entries from WS.WS.VFS_QUEUE and WS.WS.VFS_URL table.', __SQL_MESSAGE);
 			  return;
 			};
                         old_mode := log_enable (3, 1);
diff --git a/binsrc/yacutia/robot_edit.vspx b/binsrc/yacutia/robot_edit.vspx
index 0dc15d3..f20e7e2 100644
--- a/binsrc/yacutia/robot_edit.vspx
+++ b/binsrc/yacutia/robot_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: robot_edit.vspx,v 1.6.2.7 2010/05/26 15:21:53 source Exp $
+ -  $Id: robot_edit.vspx,v 1.6.2.12 2011/03/08 13:38:13 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -57,6 +57,12 @@
       <v:variable name="_rdf_graph" type="varchar" default="''" persist="0" />
       <v:variable name="_html_meta" type="int" default="0" persist="0" />
       <v:variable name="_other" type="int" default="0" persist="0" />
+      <v:variable name="_convhtml" type="int" default="0" persist="0" />
+      <v:variable name="_xp_exp" type="varchar" default="null" persist="0" />
+      <v:variable name="_depth" type="int" default="null" persist="0" />
+      <v:variable name="_accept_rdf" type="int" default="0" persist="0" />
+      <v:variable name="_bot" type="int" default="1" persist="0" />
+      <v:variable name="_thr" type="int" default="1" persist="0" />
     </vm:variables>
     <vm:menu>
       <vm:menuitem value="WebDAV Content Management"/>
@@ -97,12 +103,15 @@
               select VS_DESCR, VS_HOST, VS_URL, VS_INX, VS_ROOT,
                 VS_NEWER, VS_DEL, VS_FOLLOW, VS_NFOLLOW, VS_OPTIONS,
 		VS_SRC, VS_METHOD, VS_OWN, VS_OTHER, VS_OPAGE, VS_REDIRECT, VS_STORE, 
-		VS_DLOAD_META, deserialize (VS_UDATA), VS_STORE_FN, VS_EXTRACT_FN
+		VS_DLOAD_META, deserialize (VS_UDATA), VS_STORE_FN, VS_EXTRACT_FN, VS_CONVERT_HTML, VS_XPATH, coalesce (VS_DEPTH, 'unlimited'),
+		VS_ACCEPT_RDF, VS_BOT, VS_THREADS
                 into self._descr, self._host, self._url, _idx, self._root,
                 self._newd, self._del, self._flow, self._dflow, self._auth,
 		self._img, self._dav, _n_own, self._other, self._opage, self._redir, self._store, 
-		self._ask_rdf, self._udata, self._store_fn, self._ext_fn
+		self._ask_rdf, self._udata, self._store_fn, self._ext_fn, self._convhtml, self._xp_exp, self._depth,
+		self._accept_rdf, self._bot, self._thr
                 from WS.WS.VFS_SITE where VS_HOST = _host and VS_ROOT = _root;
+
               if (self._other is null) 
 	        self._other := 0;	      
               else if (self._other = 'checked')
@@ -159,6 +168,7 @@
 	      self.target_uid := '';
 	      self.target_pwd := '';
 	      self._udata := vector ();
+              self._depth := 'unlimited';
             }
           ]]>
         </v:script>
@@ -299,12 +309,37 @@
               </td>
             </tr>
             <tr>
+              <td/>
+              <td>
+                <v:check-box name="bot" value="1" initial-checked="--case when self._bot then 1 else 0 end" xhtml_id="bot"/>
+                <label for="bot">Use robots.txt</label>
+              </td>
+            </tr>
+            <tr>
+		<td>XPath expression for links extraction</td>
+              <td>
+                <v:text name="xp_exp" value="--coalesce (self._xp_exp, '')"  xhtml_size="70"/>
+              </td>
+            </tr>
+            <tr>
+              <td>Crawling depth limit</td>
+              <td>
+                <v:text name="depth" value="--coalesce (self._depth, '')"  />
+              </td>
+            </tr>
+            <tr>
               <td>Update Interval (minutes)</td>
               <td>
                 <v:text name="intv" value="--self._intv"  />
               </td>
             </tr>
             <tr>
+              <td>Number of threads</td>
+              <td>
+                <v:text name="thr" value="--self._thr"  />
+              </td>
+            </tr>
+            <tr>
               <td>Store Function</td>
               <td>
                 <v:text name="store_fn" value="--self._store_fn" xhtml_size="50"/>
@@ -336,7 +371,7 @@
               </td>
             </tr>
             <tr>
-		<td>Graph IRI <small>empty to use document URL</small></td>
+		<td><small>If</small> Graph IRI <small>is unassigned use this Data Source URL:</small></td>
               <td>
                 <v:text name="rdf_graph" value="--self._rdf_graph"  xhtml_size="70"/>
               </td>
@@ -399,9 +434,25 @@
             <tr>
               <td/>
               <td>
+		<v:check-box name="convhtml" value="1" initial-checked="--case when self._convhtml then 1 else 0 end" xhtml_id="convhtml"
+		  />
+		<label for="convhtml">Convert Links</label>
+              </td>
+            </tr>
+            <tr>
+              <td/>
+              <td>
 		<v:check-box name="ask_rdf" value="1" initial-checked="--case when self._ask_rdf then 1 else 0 end" xhtml_id="ask_rdf"
 		  />
-		<label for="ask_rdf">Ask for RDF</label>
+		<label for="ask_rdf">Run Sponger</label>
+              </td>
+            </tr>
+            <tr>
+              <td/>
+              <td>
+		<v:check-box name="accept_rdf" value="1" initial-checked="--case when self._accept_rdf then 1 else 0 end" xhtml_id="accept_rdf"
+		  />
+		<label for="accept_rdf">Accept RDF</label>
               </td>
             </tr>
             <tr>
@@ -424,8 +475,15 @@
 			  </tr>
 			  <?vsp
 			  declare ix int;
+			  declare _root_col varchar;
 			  ix := 0;
-			   for select RM_DESCRIPTION, RM_PID, VM_ID from WS.WS.VFS_SITE_RDF_MAP right outer join DB.DBA.SYS_RDF_MAPPERS on (VM_RDF_MAP = RM_PID) where RM_ENABLED = 1 order by RM_ID do {
+                          if (left(self._root, 5) = '/DAV/')
+			    _root_col := right(self._root, length(self._root) - 5);
+                          else
+			    _root_col := self._root;
+			  for select RM_DESCRIPTION, RM_PID, VM_ID from (select * from WS.WS.VFS_SITE_RDF_MAP where VM_HOST = self._host and VM_ROOT = _root_col) x 
+			  	right outer join DB.DBA.SYS_RDF_MAPPERS on (VM_RDF_MAP = RM_PID)  
+			  	order by RM_ID do {
 			   ?>
 			   <tr class="<?V case when mod(ix, 2) then 'listing_row_odd' else 'listing_row_even' end ?>" >
 			       <td>
@@ -531,6 +589,22 @@
 			self._intv := atoi (get_keyword ('intv', params, '0'));
                         self._other := atoi (get_keyword ('other', params, '0'));
 
+			self._xp_exp := get_keyword ('xp_exp', params, '');
+			self._depth := get_keyword ('depth', params, '');
+
+			if (self._depth = '' or self._depth = 'unlimited') self._depth := null;
+			if (self._xp_exp = '') self._xp_exp := null;
+
+			if (self._xp_exp is not null)
+			  {
+			    declare exit handler for sqlstate '*' {
+                               self.vc_is_valid := 0;
+			       self.vc_error_message := 'Invalid XPath expression for URL extraction';
+			       return 0;
+			    };
+			    xpath_eval (self._xp_exp, xtree_doc ('<dummy/>'));
+			  }
+
                         self._del := get_keyword ('del', params);
                         if (self.mode = 'edit')
                           self._opage := self._opage;
@@ -544,12 +618,17 @@
 			self._store := get_keyword ('store', params, '0');
 			self._get_rdf := atoi (get_keyword ('get_rdf', params, '0'));
 			self._ask_rdf := atoi (get_keyword ('ask_rdf', params, '0'));
+			self._accept_rdf := atoi (get_keyword ('accept_rdf', params, '0'));
+			self._convhtml := atoi (get_keyword ('convhtml', params, '0'));
+			self._bot := atoi (get_keyword ('bot', params, '0'));
+			self._thr := atoi (get_keyword ('thr', params, '1'));
 
 			if (get_keyword ('semweb', params) = '1' and 0 = length (self._store_fn) and 0 = length (self._ext_fn))
 			  {
 			    self._store_fn := 'WS.WS.SITEMAP_RDF_STORE'; 
                             self._ext_fn := 'WS.WS.SITEMAP_XML_PARSE';   
 			    self._ask_rdf := 1;
+			    self._accept_rdf := 1;
 			  }
 			if (get_keyword ('semweb', params) <> '1' and self._store_fn = 'WS.WS.SITEMAP_RDF_STORE' and self._ext_fn = 'WS.WS.SITEMAP_XML_PARSE')
                           {
@@ -578,6 +657,8 @@
 			opts := vector_concat (opts, vector ('follow-meta', self._html_meta));	
 			if (length (self._rdf_graph))
 			  opts := vector_concat (opts, vector ('rdf-graph', self._rdf_graph));
+                        if (self._ask_rdf)
+			  opts := vector_concat (opts, vector ('meta_rdf', 1));
 
 			self._udata := opts;
 
@@ -642,7 +723,13 @@
 			      VS_UDATA = serialize (self._udata),
 			      VS_STORE_FN = self._store_fn,
 			      VS_EXTRACT_FN = self._ext_fn,
-			      VS_OTHER = case when self._other = 1 then 'checked' else NULL end
+			      VS_OTHER = case when self._other = 1 then 'checked' else NULL end,
+			      VS_CONVERT_HTML = self._convhtml,
+			      VS_DEPTH = self._depth,
+			      VS_XPATH = self._xp_exp,
+			      VS_ACCEPT_RDF = self._accept_rdf,
+			      VS_THREADS = self._thr,
+			      VS_BOT = self._bot
                             where
                               VS_HOST = self._host and
                               VS_ROOT = self._root;
@@ -661,13 +748,15 @@
                             VS_ROOT, VS_NEWER, VS_DEL, VS_FOLLOW, VS_NFOLLOW,
 			    VS_SRC, VS_METHOD, VS_OTHER, VS_OPTIONS, 
 			    VS_OPAGE, VS_REDIRECT, VS_STORE, VS_DLOAD_META, VS_UDATA,
-			    VS_STORE_FN, VS_EXTRACT_FN)
+			    VS_STORE_FN, VS_EXTRACT_FN, VS_CONVERT_HTML, VS_XPATH, VS_DEPTH, VS_ACCEPT_RDF,
+			    VS_THREADS, VS_BOT)
 			    values
 			    (self._descr, self._host, self._url, _idx, (select U_ID from WS.WS.SYS_DAV_USER where U_NAME = self._own),
 			    self._root, stringdate(self._newd), self._del, self._flow, self._dflow, 
 			    self._img, self._dav, case when self._other then 'checked' else NULL end, self._auth,
 			    self._opage, self._redir, self._store, self._ask_rdf, serialize (self._udata), 
-			    self._store_fn, self._ext_fn);
+			    self._store_fn, self._ext_fn, self._convhtml, self._xp_exp, self._depth, self._accept_rdf,
+			    self._thr, self._bot);
 
 			    insert into WS.WS.VFS_QUEUE (VQ_HOST, VQ_URL, VQ_TS, VQ_STAT, VQ_ROOT) 
 			    values (self._host, self._url, now(), 'waiting', self._root);
diff --git a/binsrc/yacutia/robot_export.vspx b/binsrc/yacutia/robot_export.vspx
index 0ad7ded..98b7aa4 100644
--- a/binsrc/yacutia/robot_export.vspx
+++ b/binsrc/yacutia/robot_export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: robot_export.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: robot_export.vspx,v 1.2.2.3 2010/09/20 10:16:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/robot_process.vspx b/binsrc/yacutia/robot_process.vspx
index a667d33..340b455 100644
--- a/binsrc/yacutia/robot_process.vspx
+++ b/binsrc/yacutia/robot_process.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: robot_process.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: robot_process.vspx,v 1.2.2.3 2010/09/20 10:16:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/robot_queues.vspx b/binsrc/yacutia/robot_queues.vspx
index ee894ad..2770733 100644
--- a/binsrc/yacutia/robot_queues.vspx
+++ b/binsrc/yacutia/robot_queues.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: robot_queues.vspx,v 1.2.2.5 2010/05/26 15:21:53 source Exp $
+ -  $Id: robot_queues.vspx,v 1.2.2.7 2011/02/16 20:45:23 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -164,7 +164,9 @@
 				), 50)" />
                 </td>
                 <td class="listing_col" nowrap="1">
-                  <v:label format="%s" name="data_set2_browse_label_5" value="--((control.vc_parent as vspx_row_template).te_rowset[2])" />
+		    <v:label format="%s" name="data_set2_browse_label_5" value="--
+			WS.WS.VFS_STATUS_GET ((control.vc_parent as vspx_row_template).te_rowset[1],
+						(control.vc_parent as vspx_row_template).te_rowset[3])" />
                 </td>
                 <td class="listing_col_action">
 		  <v:button action="simple" style="image" name="data_set2_update"
@@ -183,7 +185,11 @@
                         _host := (control.vc_parent as vspx_row_template).te_rowset[1];
                         _root := (control.vc_parent as vspx_row_template).te_rowset[3];
                         _url := (control.vc_parent as vspx_row_template).te_rowset[4];
-			update_flag := coalesce ((select top 1 1 from WS.WS.VFS_QUEUE where VQ_HOST = _host and VQ_ROOT = _root and VQ_URL <> _url), 0);
+			if (WS.WS.VFS_STATUS_GET (_host, _root) = 'done')
+			  update_flag := 1;
+			else
+			  update_flag := 0;   
+			--update_flag := coalesce ((select top 1 1 from WS.WS.VFS_QUEUE where VQ_HOST = _host and VQ_ROOT = _root and VQ_URL <> _url), 0);
                           http_rewrite();
 			self.vc_redirect (sprintf ('robot_status.vspx?host=%U&root=%U&url=%U', _host, _root, _url));
                           http_flush();
@@ -217,6 +223,7 @@
 			  return; 
 			};
                         commit work;
+			WS.WS.VFS_STATUS_SET (_host, _root, 'stopped');
 			old_mode := log_enable (3,1);
 			update WS.WS.VFS_QUEUE set VQ_STAT = 'waiting' where VQ_HOST = _host and VQ_ROOT = _root and VQ_STAT <> 'waiting';
                         commit work;
@@ -247,10 +254,11 @@
 			  return; 
 			};
                         commit work;
-			old_mode := log_enable (3,1);
-			update WS.WS.VFS_QUEUE set VQ_STAT = 'stopped' where VQ_HOST = _host and VQ_ROOT = _root and VQ_STAT = 'waiting';
-                        commit work;
-			log_enable (old_mode, 1);
+			WS.WS.VFS_STATUS_SET (_host, _root, 'stopped');
+			--old_mode := log_enable (3,1);
+			--update WS.WS.VFS_QUEUE set VQ_STAT = 'stopped' where VQ_HOST = _host and VQ_ROOT = _root and VQ_STAT = 'waiting';
+                        --commit work;
+			--log_enable (old_mode, 1);
                       ]]>
                     </v:script>
                     </v:on-post>
diff --git a/binsrc/yacutia/robot_sched.vspx b/binsrc/yacutia/robot_sched.vspx
index 55d5344..d906bbb 100644
--- a/binsrc/yacutia/robot_sched.vspx
+++ b/binsrc/yacutia/robot_sched.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: robot_sched.vspx,v 1.3.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: robot_sched.vspx,v 1.3.2.3 2010/09/20 10:16:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/robot_sites.vspx b/binsrc/yacutia/robot_sites.vspx
index a2b9f6a..a4842ed 100644
--- a/binsrc/yacutia/robot_sites.vspx
+++ b/binsrc/yacutia/robot_sites.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: robot_sites.vspx,v 1.2.2.4 2010/05/26 15:21:53 source Exp $
+ -  $Id: robot_sites.vspx,v 1.2.2.6 2011/02/16 20:45:24 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -114,22 +114,24 @@
         <tr class="listing_header_row">
           <th>Description</th>
           <th>URL</th>
-          <th>Total pages</th>
+	  <th>Pages (downloaded/total)</th>
           <th>Action</th>
         </tr>
         <?vsp
-          declare _count, idx integer;
+          declare _count, _all, idx integer;
           _count := idx := 0;
+	  set isolation='uncommitted';
           for select VS_DESCR, VS_HOST, VS_URL, VS_ROOT from WS.WS.VFS_SITE do
           {
             idx := 1;
-            select count (*) into _count from WS.WS.VFS_URL where VU_HOST = VS_HOST and VU_ROOT = VS_ROOT;
+            select count (*) into _count from WS.WS.VFS_QUEUE where VQ_HOST = VS_HOST and VQ_ROOT = VS_ROOT and VQ_STAT = 'retrieved';
+            select count (*) into _all from WS.WS.VFS_QUEUE where VQ_HOST = VS_HOST and VQ_ROOT = VS_ROOT;
           self.r_count := self.r_count + 1;
           http (sprintf ('<tr class="%s">', case when mod (self.r_count, 2) then 'listing_row_odd' else 'listing_row_even' end));
         ?>
               <td class="listing_col"><?V VS_DESCR ?></td>
 	      <td class="listing_col"><?V y_trunc_uri ('http://' || VS_HOST || VS_URL) ?></td>
-              <td class="listing_col_num"><?V cast(_count as varchar) ?></td>
+	      <td class="listing_col_num"><?V cast(_count as varchar) ?>/<?V _all ?></td>
               <td class="listing_col_action">
                 <?vsp
                   http(concat('<a href="robot_urls_list.vspx?host=', VS_HOST, '&sid=', self.sid, '&realm=', self.realm, '&root='));
diff --git a/binsrc/yacutia/robot_status.vspx b/binsrc/yacutia/robot_status.vspx
index f602f50..c9233ca 100644
--- a/binsrc/yacutia/robot_status.vspx
+++ b/binsrc/yacutia/robot_status.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: robot_status.vspx,v 1.2.2.5 2010/03/22 22:21:00 source Exp $
+ -  $Id: robot_status.vspx,v 1.2.2.7 2011/03/08 13:38:13 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -117,7 +117,7 @@
 	  http('<table class="listing"><tr><td>Top pending URLs</td></tr><tr class="listing_header_row"><td>URL</td><td>Registered on</td><td>State</td></tr>');
 	  idx := 0;
 	  for select top 10 VQ_URL, VQ_TS, VQ_STAT from WS.WS.VFS_QUEUE where VQ_HOST = host and VQ_ROOT = root and VQ_STAT
-	  in ('waiting', 'pending', 'error') order by VQ_HOST, VQ_ROOT, VQ_TS do
+	  in ('waiting', 'pending') order by VQ_HOST, VQ_ROOT, VQ_TS do
 	    {
 	      idx := idx + 1;
 	  ?>
diff --git a/binsrc/yacutia/robot_urls_list.vspx b/binsrc/yacutia/robot_urls_list.vspx
index 35d79f7..966350e 100644
--- a/binsrc/yacutia/robot_urls_list.vspx
+++ b/binsrc/yacutia/robot_urls_list.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: robot_urls_list.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: robot_urls_list.vspx,v 1.2.2.3 2010/09/20 10:16:50 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/role_remove.vspx b/binsrc/yacutia/role_remove.vspx
index 829e71f..2d382d8 100644
--- a/binsrc/yacutia/role_remove.vspx
+++ b/binsrc/yacutia/role_remove.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: role_remove.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: role_remove.vspx,v 1.2.2.3 2010/09/20 10:16:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/role_remove_inc.vspx b/binsrc/yacutia/role_remove_inc.vspx
index a380ce4..895874f 100644
--- a/binsrc/yacutia/role_remove_inc.vspx
+++ b/binsrc/yacutia/role_remove_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: role_remove_inc.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: role_remove_inc.vspx,v 1.2.2.3 2010/09/20 10:16:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/roles.vspx b/binsrc/yacutia/roles.vspx
index 60fae10..5d82a5d 100644
--- a/binsrc/yacutia/roles.vspx
+++ b/binsrc/yacutia/roles.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: roles.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: roles.vspx,v 1.2.2.3 2010/09/20 10:16:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/roles_inc.vspx b/binsrc/yacutia/roles_inc.vspx
index 87a53a4..85d3b9f 100644
--- a/binsrc/yacutia/roles_inc.vspx
+++ b/binsrc/yacutia/roles_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: roles_inc.vspx,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: roles_inc.vspx,v 1.3.2.2 2010/09/20 10:16:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sec_acl_edit.vspx b/binsrc/yacutia/sec_acl_edit.vspx
index 078198c..942c952 100644
--- a/binsrc/yacutia/sec_acl_edit.vspx
+++ b/binsrc/yacutia/sec_acl_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sec_acl_edit.vspx,v 1.2.2.3 2009/12/09 10:45:47 source Exp $
+ -  $Id: sec_acl_edit.vspx,v 1.2.2.4 2010/09/20 10:16:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sec_auth_serv.vspx b/binsrc/yacutia/sec_auth_serv.vspx
index bdcc2f4..20fbb17 100644
--- a/binsrc/yacutia/sec_auth_serv.vspx
+++ b/binsrc/yacutia/sec_auth_serv.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sec_auth_serv.vspx,v 1.3.2.5 2010/07/05 13:17:25 source Exp $
+ -  $Id: sec_auth_serv.vspx,v 1.3.2.7 2011/01/25 14:21:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -50,6 +50,7 @@
       <vm:menuitem name="HTTP" value="Access Control Lists"/>
     </vm:menu>
     <vm:header caption="Access Control Lists">
+     <vm:help id="sec_auth_serv" sect=""/>
     </vm:header>
     <vm:pagebody>
   <v:method name="astyle" arglist="in cmp varchar">
@@ -107,7 +108,6 @@
 	self.acl_list_mta := mta;
       }
     </v:on-init>
-    <vm:help id="sec_auth_serv" sect=""/>
     <v:form name="page_form" type="simple" method="POST">
 	<!-- top of security layout -->
       <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
diff --git a/binsrc/yacutia/sec_pki_1.vspx b/binsrc/yacutia/sec_pki_1.vspx
index dd85ca8..82a8ded 100644
--- a/binsrc/yacutia/sec_pki_1.vspx
+++ b/binsrc/yacutia/sec_pki_1.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sec_pki_1.vspx,v 1.1.2.3 2009/10/16 15:05:59 source Exp $
+ -  $Id: sec_pki_1.vspx,v 1.1.2.6 2011/01/11 13:14:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -60,7 +60,7 @@
 	      }
 	      }
 	    ]]></v:on-init>
-    <vm:help id="sec_pki" sect=""/>
+    <!--vm:help id="sec_pki" sect=""/-->
     <v:form name="form1" type="simple" method="POST">
 	<!-- top of security layout -->
       <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
@@ -85,6 +85,7 @@
                     <tr>
 			<td valign="top">
 		   <!-- end of top security layout -->
+		   <div id="pki_form">
 		   <h3>CA Root Certificate Details</h3>
 		   <label>Country:</label> 
 		   	<v:text xhtml_size="100" value="" name="c" default_value="--self.c1"> 
@@ -187,6 +188,7 @@
        ]]></v:on-post>
 		</v:button>
 		   <!-- bottom of security layout -->
+                        </div> <!-- #pki_form -->
                       </td>
                     </tr>
                   </table>
diff --git a/binsrc/yacutia/sec_pki_2.vspx b/binsrc/yacutia/sec_pki_2.vspx
index 8eb40fb..5368332 100644
--- a/binsrc/yacutia/sec_pki_2.vspx
+++ b/binsrc/yacutia/sec_pki_2.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sec_pki_2.vspx,v 1.1.2.8 2010/07/06 10:42:05 source Exp $
+ -  $Id: sec_pki_2.vspx,v 1.1.2.9 2010/09/20 10:16:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sec_pki_2_conf.vspx b/binsrc/yacutia/sec_pki_2_conf.vspx
index 86c977f..eeeba10 100644
--- a/binsrc/yacutia/sec_pki_2_conf.vspx
+++ b/binsrc/yacutia/sec_pki_2_conf.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sec_pki_2_conf.vspx,v 1.1.2.2 2009/10/15 18:31:30 source Exp $
+ -  $Id: sec_pki_2_conf.vspx,v 1.1.2.3 2010/09/20 10:16:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sec_pki_3.vspx b/binsrc/yacutia/sec_pki_3.vspx
index 10ca709..745002a 100644
--- a/binsrc/yacutia/sec_pki_3.vspx
+++ b/binsrc/yacutia/sec_pki_3.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sec_pki_3.vspx,v 1.1.2.4 2009/10/29 20:08:59 source Exp $
+ -  $Id: sec_pki_3.vspx,v 1.1.2.5 2010/09/20 10:16:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sec_pki_4.vspx b/binsrc/yacutia/sec_pki_4.vspx
index 92fa934..5edd6f3 100644
--- a/binsrc/yacutia/sec_pki_4.vspx
+++ b/binsrc/yacutia/sec_pki_4.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sec_pki_4.vspx,v 1.1.2.2 2009/10/15 18:31:30 source Exp $
+ -  $Id: sec_pki_4.vspx,v 1.1.2.3 2010/09/20 10:16:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sec_pki_drop.vspx b/binsrc/yacutia/sec_pki_drop.vspx
index 0e451b5..5317ba2 100644
--- a/binsrc/yacutia/sec_pki_drop.vspx
+++ b/binsrc/yacutia/sec_pki_drop.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sec_pki_drop.vspx,v 1.1.2.2 2009/10/15 18:31:30 source Exp $
+ -  $Id: sec_pki_drop.vspx,v 1.1.2.3 2010/09/20 10:16:51 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/site.vspx b/binsrc/yacutia/site.vspx
index bee23fb..1a8387e 100644
--- a/binsrc/yacutia/site.vspx
+++ b/binsrc/yacutia/site.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: site.vspx,v 1.4.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: site.vspx,v 1.4.2.2 2010/09/20 10:16:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/soap_del_path.vspx b/binsrc/yacutia/soap_del_path.vspx
index b0e9ef4..8ceb3ce 100644
--- a/binsrc/yacutia/soap_del_path.vspx
+++ b/binsrc/yacutia/soap_del_path.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: soap_del_path.vspx,v 1.3.2.3 2009/08/28 13:05:23 source Exp $
+ -  $Id: soap_del_path.vspx,v 1.3.2.4 2010/09/20 10:16:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/soap_options_edit.vspx b/binsrc/yacutia/soap_options_edit.vspx
index c950fd7..9130747 100644
--- a/binsrc/yacutia/soap_options_edit.vspx
+++ b/binsrc/yacutia/soap_options_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: soap_options_edit.vspx,v 1.4.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: soap_options_edit.vspx,v 1.4.2.3 2010/09/20 10:16:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/soap_services.vspx b/binsrc/yacutia/soap_services.vspx
index b02f174..88d9c42 100644
--- a/binsrc/yacutia/soap_services.vspx
+++ b/binsrc/yacutia/soap_services.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: soap_services.vspx,v 1.5.2.4 2009/10/01 07:52:29 source Exp $
+ -  $Id: soap_services.vspx,v 1.5.2.5 2010/09/20 10:16:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/soap_services_edit.vspx b/binsrc/yacutia/soap_services_edit.vspx
index 1636d31..6d60227 100644
--- a/binsrc/yacutia/soap_services_edit.vspx
+++ b/binsrc/yacutia/soap_services_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: soap_services_edit.vspx,v 1.8.2.4 2010/01/25 15:41:12 source Exp $
+ -  $Id: soap_services_edit.vspx,v 1.8.2.5 2010/09/20 10:16:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/soap_services_list.vspx b/binsrc/yacutia/soap_services_list.vspx
index 22c5dab..abc6db5 100644
--- a/binsrc/yacutia/soap_services_list.vspx
+++ b/binsrc/yacutia/soap_services_list.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: soap_services_list.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: soap_services_list.vspx,v 1.2.2.3 2010/09/20 10:16:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sparql_acl.vspx b/binsrc/yacutia/sparql_acl.vspx
index 7d1eb2a..0eb9be1 100644
--- a/binsrc/yacutia/sparql_acl.vspx
+++ b/binsrc/yacutia/sparql_acl.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sparql_acl.vspx,v 1.1.4.2 2010/07/05 13:17:25 source Exp $
+ -  $Id: sparql_acl.vspx,v 1.1.4.3 2010/09/20 10:16:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sparql_filters.vspx b/binsrc/yacutia/sparql_filters.vspx
index bfae46d..b866543 100644
--- a/binsrc/yacutia/sparql_filters.vspx
+++ b/binsrc/yacutia/sparql_filters.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sparql_filters.vspx,v 1.5.2.2 2009/11/30 23:44:08 source Exp $
+ -  $Id: sparql_filters.vspx,v 1.5.2.5 2010/11/08 11:45:35 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -59,7 +59,7 @@
                     </colgroup>
                     <tr>
                         <td class="page_tab" align="center" nowrap="1">
-                          <v:url name="url1" value="Cartridges" format="%s" url="rdf_filters.vspx" xhtml_class="uddi"/>
+                          <v:url name="url1" value="Extractor Cartridges" format="%s" url="rdf_filters.vspx" xhtml_class="uddi"/>
                         </td>
                         <td class="page_tab" align="center" nowrap="1">
                           <v:url name="url2" value="Meta Cartridges" format="%s" url="rdf_filters_pp.vspx" xhtml_class="uddi"/>
@@ -70,6 +70,9 @@
                         <td class="page_tab" align="center" nowrap="1">
                           <v:url name="url3" value="Console" format="%s" url="rdf_console.vspx" xhtml_class="uddi"/>
                         </td>
+                      <td class="page_tab" align="center" nowrap="1">
+                        <v:url name="url4" value="Configuration" format="%s" url="rdf_conf.vspx" xhtml_class="uddi"/>
+		      </td>
                         <td class="page_tab_empty" align="center" width="100%">
                           <table cellpadding="0" cellspacing="0">
                             <tr>
diff --git a/binsrc/yacutia/sparql_graph.vspx b/binsrc/yacutia/sparql_graph.vspx
index 6dc1b83..cad021f 100644
--- a/binsrc/yacutia/sparql_graph.vspx
+++ b/binsrc/yacutia/sparql_graph.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sparql_graph.vspx,v 1.4.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: sparql_graph.vspx,v 1.4.2.3 2010/09/20 10:16:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sparql_input.vspx b/binsrc/yacutia/sparql_input.vspx
index 743880d..f690c9e 100644
--- a/binsrc/yacutia/sparql_input.vspx
+++ b/binsrc/yacutia/sparql_input.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sparql_input.vspx,v 1.5.2.2 2010/04/22 12:40:45 source Exp $
+ -  $Id: sparql_input.vspx,v 1.5.2.3 2010/09/20 10:16:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sparql_load.vspx b/binsrc/yacutia/sparql_load.vspx
index 6da8f3e..42aa001 100644
--- a/binsrc/yacutia/sparql_load.vspx
+++ b/binsrc/yacutia/sparql_load.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sparql_load.vspx,v 1.4.2.3 2009/08/28 13:05:23 source Exp $
+ -  $Id: sparql_load.vspx,v 1.4.2.4 2010/09/20 10:16:52 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sqlbuilder.vsp b/binsrc/yacutia/sqlbuilder.vsp
index 1c39a93..842181c 100644
--- a/binsrc/yacutia/sqlbuilder.vsp
+++ b/binsrc/yacutia/sqlbuilder.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: sqlbuilder.vsp,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+--  $Id: sqlbuilder.vsp,v 1.3.2.2 2010/09/20 10:16:53 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/binsrc/yacutia/syntax/SyntaxHighlighter.css b/binsrc/yacutia/syntax/SyntaxHighlighter.css
index a095c17..bcca788 100644
--- a/binsrc/yacutia/syntax/SyntaxHighlighter.css
+++ b/binsrc/yacutia/syntax/SyntaxHighlighter.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: SyntaxHighlighter.css,v 1.2 2006/08/15 22:15:54 source Exp $
+ *  $Id: SyntaxHighlighter.css,v 1.2.2.1 2010/09/20 10:17:00 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/binsrc/yacutia/sys_info.vspx b/binsrc/yacutia/sys_info.vspx
index 07b3df7..cf4550b 100644
--- a/binsrc/yacutia/sys_info.vspx
+++ b/binsrc/yacutia/sys_info.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sys_info.vspx,v 1.3.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: sys_info.vspx,v 1.3.2.2 2010/09/20 10:16:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sys_queues.vspx b/binsrc/yacutia/sys_queues.vspx
index 49c35b4..e0d515b 100644
--- a/binsrc/yacutia/sys_queues.vspx
+++ b/binsrc/yacutia/sys_queues.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: sys_queues.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: sys_queues.vspx,v 1.2.2.4 2011/01/25 14:21:43 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -114,7 +114,7 @@
 				      ]]></v:on-post>
 			      </v:button>
 	      </th>
-	      <th>
+	      <th class="new_item">
 		<v:url name="cr_new_ev1" value="Create New Event" url="sys_queues_edit.vspx?mode=create"/>
 	      </th>
             </tr>
diff --git a/binsrc/yacutia/sys_queues_edit.vspx b/binsrc/yacutia/sys_queues_edit.vspx
index 60e8028..4e0760f 100644
--- a/binsrc/yacutia/sys_queues_edit.vspx
+++ b/binsrc/yacutia/sys_queues_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: sys_queues_edit.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: sys_queues_edit.vspx,v 1.2.2.3 2010/09/20 10:16:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sys_queues_edit_inc.vspx b/binsrc/yacutia/sys_queues_edit_inc.vspx
index d82effd..e04fa64 100644
--- a/binsrc/yacutia/sys_queues_edit_inc.vspx
+++ b/binsrc/yacutia/sys_queues_edit_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
  -
- -  $Id: sys_queues_edit_inc.vspx,v 1.2.2.1 2009/08/27 22:43:49 source Exp $
+ -  $Id: sys_queues_edit_inc.vspx,v 1.2.2.2 2010/09/20 10:16:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sys_queues_error.vspx b/binsrc/yacutia/sys_queues_error.vspx
index ae8fc1f..88c9a06 100644
--- a/binsrc/yacutia/sys_queues_error.vspx
+++ b/binsrc/yacutia/sys_queues_error.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sys_queues_error.vspx,v 1.4.2.2 2009/08/27 22:43:49 source Exp $
+ -  $Id: sys_queues_error.vspx,v 1.4.2.3 2010/09/20 10:16:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/sys_queues_remove.vspx b/binsrc/yacutia/sys_queues_remove.vspx
index 7a144a5..bb8da8d 100644
--- a/binsrc/yacutia/sys_queues_remove.vspx
+++ b/binsrc/yacutia/sys_queues_remove.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: sys_queues_remove.vspx,v 1.3.2.3 2009/08/28 13:05:23 source Exp $
+ -  $Id: sys_queues_remove.vspx,v 1.3.2.4 2010/09/20 10:16:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/tbl.js b/binsrc/yacutia/tbl.js
new file mode 100644
index 0000000..cc46fa2
--- /dev/null
+++ b/binsrc/yacutia/tbl.js
@@ -0,0 +1,385 @@
+/*
+ *  $Id: tbl.js,v 1.1.4.5 2011/01/25 14:21:44 source Exp $
+ *
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *
+ *  Copyright (C) 1998-2010 OpenLink Software
+ *
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+var TBL = new Object();
+TBL.selectOption = function(fld, fldValue, optionName, optionValue) {
+	var o = OAT.Dom.option(optionName, optionValue, fld);
+	if (fldValue == optionValue)
+		o.selected = true;
+}
+
+TBL.createRow = function (prefix, No, optionObject)
+{
+  if (No != null)
+  {
+    TBL.deleteRow(prefix, No);
+  }
+  else
+  {
+    var tbl = $(prefix+'_tbody');
+    if (!tbl)
+      tbl = $(prefix+'_tbl');
+    if (tbl)
+    {
+      var options = {btn_1: {mode: 0}};
+      for (var p in optionObject) {options[p] = optionObject[p]; }
+
+      No = options.No;
+      if (!$(prefix+'_no')) {
+      	var fld = OAT.Dom.create("input");
+        fld.type = 'hidden';
+        fld.name = prefix+'_no';
+        fld.id = fld.name;
+        fld.value = '0';
+        tbl.appendChild(fld);
+      }
+      if (No) {
+        $(prefix+'_no').value = No;
+      } else {
+        No = $v(prefix+'_no');
+      }
+      No = parseInt(No)
+
+      OAT.Dom.hide (prefix+'_tr_no');
+
+      var tr = OAT.Dom.create('tr');
+      tr.id = prefix+'_tr_' + No;
+      tbl.appendChild(tr);
+
+      // fields
+      for (var fld in options)
+      {
+        if (fld.indexOf('fld') == 0)
+        {
+          var fldOptions = options[fld];
+          var td = OAT.Dom.create('td');
+          td.id = prefix+'_td_'+ No+'_'+fld.replace(/fld_/, '');
+          if (fldOptions.tdCssText)
+            td.style.cssText = fldOptions.tdCssText;
+          tr.appendChild(td);
+          var fldName = prefix + '_' + fld + '_' + No;
+          var fn = TBL["createCell"+((fldOptions.mode)? fldOptions.mode: "0")];
+          if (fn)
+        	  fn(td, prefix, fldName, No, fldOptions);
+        }
+      }
+
+      // actions
+      var td = OAT.Dom.create('td');
+      td.id = prefix+'_td_'+ No+'_btn';
+      td.style.whiteSpace = 'nowrap';
+      tr.appendChild(td);
+      if (options.id) {
+      	var fld = OAT.Dom.create("input");
+        fld.type = 'hidden';
+        fld.name = prefix + '_fld_0_' + No;
+        fld.id = fld.name;
+        fld.value = options.id;
+        td.appendChild(fld);
+      }
+      for (var btn in options)
+      {
+        if (btn.indexOf('btn') == 0)
+        {
+          var fldOptions = options[btn];
+          if (fldOptions.tdCssText)
+            td.style.cssText = fldOptions.tdCssText;
+          var fldName = prefix + '_' + btn + '_' + No;
+          var fn = TBL["createButton"+fldOptions.mode];
+          if (fn)
+          {
+        	  var btn = fn(td, prefix, fldName, No, fldOptions);
+            if (btn) {
+              if (fldOptions.cssText)
+                btn.style.cssText = fldOptions.cssText;
+              if (fldOptions.className)
+                btn.className = fldOptions.className;
+            }
+          }
+        }
+      }
+      $(prefix+'_no').value = No + 1;
+    }
+  }
+}
+
+TBL.createViewRow = function (prefix, options)
+{
+  var tbl = $(prefix+'_tbl');
+  if (tbl)
+  {
+    OAT.Dom.hide (prefix+'_tr_no');
+
+    var tr = OAT.Dom.create('tr');
+    tbl.appendChild(tr);
+
+    // fields
+    for (var fld in options)
+    {
+      if (fld.indexOf('fld') == 0)
+      {
+        var fldOptions = options[fld];
+        var td = OAT.Dom.create('td');
+        if (fldOptions.tdCssText)
+          td.style.cssText = fldOptions.tdCssText;
+        tr.appendChild(td);
+
+        if (fldOptions.mode) {
+          fldName = prefix + '_' + fld + '_0';
+          var fn = TBL["viewCell"+fldOptions.mode];
+          if (fn)
+        	  fn(td, prefix, fldName, 0, fldOptions);
+      	} else {
+          td.innerHTML = fldOptions.value;
+        }
+      }
+    }
+  }
+}
+
+TBL.deleteRow = function (prefix, No, ask) {
+  if (ask && !confirm('Are you sure that you want to delete this row?'))
+    return false;
+
+  OAT.Dom.unlink(prefix+'_tr_'+No);
+  OAT.Dom.unlink(prefix+'_tr_'+No+'_items');
+  OAT.Dom.unlink(prefix+'_tr_'+No+'_properties');
+  var No = parseInt($(prefix+'_no').value);
+  for (var N = 0; N < No; N++)
+  {
+    if ($(prefix+'_tr_'+N))
+      return;
+  }
+  OAT.Dom.show(prefix+'_tr_no');
+  return true;
+}
+
+TBL.createCellSelect = function (fldName) {
+	var fld = OAT.Dom.create("select");
+  fld.name = fldName;
+  fld.id = fldName;
+  return fld;
+}
+
+TBL.createCellCombolist = function (td, fldValue, fldOptions) {
+  var fld = new OAT.Combolist([], fldValue, fldOptions);
+  fld.input.id = fld.input.name;
+  fld.input.style.width = "85%";
+  td.appendChild(fld.div);
+
+  var dims = OAT.Dom.getWH(td);
+  fld.list.style.width = (((dims[0]>250)?dims[0]:250)*0.75)+"px";
+
+  return fld;
+}
+
+TBL.createCell0 = function (td, prefix, fldName, No, fldOptions) {
+  var fld = OAT.Dom.create('input');
+  fld.type = (fldOptions.type)? (fldOptions.type): 'text';
+  fld.id = fldName;
+  fld.name = fld.id;
+  if (fldOptions.value) {
+    fld.value = fldOptions.value;
+    fld.defaultValue = fld.value;
+  }
+  if (fldOptions.className)
+    fld.className = fldOptions.className;
+  if (fldOptions.onblur)
+    fld.onblur = fldOptions.onblur;
+  fld.style.width = '95%';
+  if (fldOptions.cssText)
+    fld.style.cssText = fldOptions.cssText;
+  if (fldOptions.readOnly)
+    fld.readOnly = fldOptions.readOnly;
+
+  td.appendChild(fld);
+  return fld;
+}
+
+TBL.createCell40 = function (td, prefix, fldName, No, fldOptions)
+{
+  var fld = new OAT.Combolist([], fldOptions.value, {name: fldName});
+  fld.input.name = fldName;
+  fld.input.id = fldName;
+  fld.input.style.width = "85%";
+  fld.addOption('xml-sql');
+  fld.addOption('xml-sql-root');
+  fld.addOption('xml-sql-dtd');
+  fld.addOption('xml-sql-schema');
+  fld.addOption('xml-sql-description');
+  fld.addOption('xml-sql-encoding');
+  fld.addOption('xml-stylesheet');
+  fld.addOption('xml-template');
+  fld.addOption('xper');
+
+  td.appendChild(fld.div);
+  return fld;
+}
+
+TBL.createCell41 = function (td, prefix, fldName, No, fldOptions) {
+	var fld = OAT.Dom.create("select");
+	fld.name = fldName;
+	fld.id = fldName;
+	TBL.selectOption(fld, fldOptions.value, "Set", "U");
+	TBL.selectOption(fld, fldOptions.value, "Remove", "R");
+
+  td.appendChild(fld);
+  return fld;
+}
+
+TBL.changeCell50 = function (srcFld) {
+  var srcValue = $v(srcFld.name);
+  var dstName = srcFld.name.replace('fld_1', 'fld_2');
+  var dstFld = $(dstName);
+  var dstImg = $(dstName+'_img');
+  if (srcValue == 'public') {
+    dstFld.value = 'foaf:Agent';
+    dstFld.readOnly = true;
+  } else {
+    if (dstFld.value == 'foaf:Agent')
+      dstFld.value = '';
+    dstFld.readOnly = false;
+  }
+  if (srcValue == 'public') {
+    OAT.Dom.hide(dstImg);
+  } else {
+    OAT.Dom.show(dstImg);
+  }
+}
+
+TBL.viewCell50 = function (td, prefix, fldName, No, fldOptions) {
+	if (fldOptions.value == "public") {
+	  td.innerHTML = "Public";
+	} else if (fldOptions.value == "group") {
+	  td.innerHTML = "Group";
+	} else {
+	  td.innerHTML = "Personal";
+	}
+}
+
+TBL.createCell50 = function (td, prefix, fldName, No, fldOptions) {
+	var fld = OAT.Dom.create("select");
+	fld.name = fldName;
+	fld.id = fldName;
+	TBL.selectOption(fld, fldOptions.value, "Personal", "person");
+	TBL.selectOption(fld, fldOptions.value, "Group", "group");
+	TBL.selectOption(fld, fldOptions.value, "Public", "public");
+  if (fldOptions.onchange)
+    fld.onclick = fldOptions.onchange;
+
+  td.appendChild(fld);
+  return fld;
+}
+
+TBL.createCell51 = function (td, prefix, fldName, No, fldOptions)
+{
+  var fld = TBL.createCell0 (td, prefix, fldName, No, fldOptions)
+  if (document.forms[0].elements['sid']) {
+    td.appendChild(OAT.Dom.text(' '));
+    var img = OAT.Dom.image('/ods/images/select.gif');
+    img.id = fldName+'_img';
+    img.className = "pointer";
+    img.onclick = function (){TBL.webidShow(fld, fldOptions.form)};
+    if (fldOptions.imgCssText)
+      img.style.cssText = fldOptions.imgCssText;
+
+    td.appendChild(img);
+  }
+  return fld;
+}
+
+TBL.createCell52 = function (td, prefix, fldName, No, fldOptions, disabled) {
+  function cb(td, prefix, fldName, No, fldOptions, disabled, ndx) {
+  	var fld = OAT.Dom.create("input");
+    fld.type = 'checkbox';
+    fld.id = fldName;
+    fld.name = fld.id;
+    fld.value = 1;
+    if (fldOptions.value && fldOptions.value[ndx])
+      fld.checked = true;
+    if (fldOptions.onclick)
+      fld.onclick = fldOptions.onclick;
+    if (disabled)
+      fld.disabled = disabled;
+    td.appendChild(fld);
+  }
+  var suffix = '';
+  if (fldOptions.suffix)
+    suffix = fldOptions.suffix;
+  cb(td, prefix, fldName+'_r'+suffix, No, fldOptions, disabled, 0);
+  cb(td, prefix, fldName+'_w'+suffix, No, fldOptions, disabled, 1);
+  // cb(td, prefix, fldName+'_x'+suffix, No, fldOptions, disabled, 2);
+}
+
+TBL.viewCell52 = function (td, prefix, fldName, No, fldOptions) {
+  TBL.createCell52(td, prefix, fldName, No, fldOptions, true);
+}
+
+TBL.clickCell52 = function (fld)
+{
+  var fldName = fld.name;
+  if (fldName.indexOf('_deny') != -1) {
+    fldName = fldName.replace('_deny', '_grant');
+    fldName = fldName.replace('fld_4', 'fld_3');
+  }
+  else if (fldName.indexOf('_grant') != -1) {
+    fldName = fldName.replace('_grant', '_deny');
+    fldName = fldName.replace('fld_3', 'fld_4');
+  }
+  $(fldName).checked = false;
+}
+
+TBL.createCell53 = function (td, prefix, fldName, No, fldOptions)
+{
+  var fld = TBL.createCell0 (td, prefix, fldName, No, fldOptions)
+  td.appendChild(OAT.Dom.text(' '));
+  var img = OAT.Dom.image('/ods/images/select.gif');
+  img.id = fldName+'_img';
+  img.className = "pointer";
+  img.onclick = function (){TBL.webidShow(fld)};
+  if (fldOptions.imgCssText)
+    img.style.cssText = fldOptions.imgCssText;
+
+  td.appendChild(img);
+  return fld;
+}
+
+TBL.createButton0 = function (td, prefix, fldName, No, fldOptions)
+{
+  var fld = OAT.Dom.create('span');
+  fld.id = fldName;
+  fld.onclick = function(){TBL.deleteRow(prefix, No);};
+  OAT.Dom.addClass(fld, 'button pointer');
+
+  var img = OAT.Dom.create('img');
+  img.src = 'images/icons/trash_16.png';
+  img.alt = 'Delete row';
+  img.title = fld.alt;
+  OAT.Dom.addClass(img, 'button');
+
+  fld.appendChild(img);
+  fld.appendChild(OAT.Dom.text(' Delete'));
+
+  td.appendChild(fld);
+  return fld;
+}
diff --git a/binsrc/yacutia/text_queries.vspx b/binsrc/yacutia/text_queries.vspx
index 2191402..9327114 100644
--- a/binsrc/yacutia/text_queries.vspx
+++ b/binsrc/yacutia/text_queries.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: text_queries.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: text_queries.vspx,v 1.2.2.3 2010/09/20 10:16:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/text_queries_edit.vspx b/binsrc/yacutia/text_queries_edit.vspx
index 51b1532..d249667 100644
--- a/binsrc/yacutia/text_queries_edit.vspx
+++ b/binsrc/yacutia/text_queries_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: text_queries_edit.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: text_queries_edit.vspx,v 1.2.2.3 2010/09/20 10:16:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/text_results.vspx b/binsrc/yacutia/text_results.vspx
index 601612c..a78d80b 100644
--- a/binsrc/yacutia/text_results.vspx
+++ b/binsrc/yacutia/text_results.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: text_results.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: text_results.vspx,v 1.2.2.3 2010/09/20 10:16:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/text_search.vspx b/binsrc/yacutia/text_search.vspx
index 162b00c..4a2289a 100644
--- a/binsrc/yacutia/text_search.vspx
+++ b/binsrc/yacutia/text_search.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: text_search.vspx,v 1.2.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: text_search.vspx,v 1.2.2.3 2010/09/20 10:16:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/text_triggers.vspx b/binsrc/yacutia/text_triggers.vspx
index edfbc9c..c263664 100644
--- a/binsrc/yacutia/text_triggers.vspx
+++ b/binsrc/yacutia/text_triggers.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: text_triggers.vspx,v 1.3.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: text_triggers.vspx,v 1.3.2.3 2010/09/20 10:16:53 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/uddi_remove.vspx b/binsrc/yacutia/uddi_remove.vspx
index dd859a9..e5b2149 100644
--- a/binsrc/yacutia/uddi_remove.vspx
+++ b/binsrc/yacutia/uddi_remove.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uddi_remove.vspx,v 1.3.2.3 2009/10/01 07:52:29 source Exp $
+ -  $Id: uddi_remove.vspx,v 1.3.2.4 2010/09/20 10:16:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/uddi_serv.vspx b/binsrc/yacutia/uddi_serv.vspx
index 0bbecec..c0f9188 100644
--- a/binsrc/yacutia/uddi_serv.vspx
+++ b/binsrc/yacutia/uddi_serv.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uddi_serv.vspx,v 1.3.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: uddi_serv.vspx,v 1.3.2.3 2010/09/20 10:16:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/uddi_serv_browse.vspx b/binsrc/yacutia/uddi_serv_browse.vspx
index 26dc605..f83a8a0 100644
--- a/binsrc/yacutia/uddi_serv_browse.vspx
+++ b/binsrc/yacutia/uddi_serv_browse.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uddi_serv_browse.vspx,v 1.3.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: uddi_serv_browse.vspx,v 1.3.2.3 2010/09/20 10:16:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/uddi_serv_create.vspx b/binsrc/yacutia/uddi_serv_create.vspx
index 8d51cc3..0b9825d 100644
--- a/binsrc/yacutia/uddi_serv_create.vspx
+++ b/binsrc/yacutia/uddi_serv_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: uddi_serv_create.vspx,v 1.4.2.2 2009/08/28 13:05:23 source Exp $
+ -  $Id: uddi_serv_create.vspx,v 1.4.2.3 2010/09/20 10:16:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vad.vspx b/binsrc/yacutia/vad.vspx
index 536d766..647c107 100644
--- a/binsrc/yacutia/vad.vspx
+++ b/binsrc/yacutia/vad.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vad.vspx,v 1.7.2.2 2009/08/28 13:05:24 source Exp $
+ -  $Id: vad.vspx,v 1.7.2.4 2011/01/25 14:21:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -94,7 +94,7 @@
 	    rollback work;
 	  }
        ]]></v:after-data-bind>
-      <div>
+      <div class="clear">
        <v:form name="srcf2" method="POST" type="simple">
 	   Package path: <span class="emphasize"><v:label name="spath1" value="--case when self.src_folder_type then 'dav://' else 'file://' end || self.src_folder"
 		   xhtml_size="70" /></span>
diff --git a/binsrc/yacutia/vad_dav.xml b/binsrc/yacutia/vad_dav.xml
index f7d0681..9b817c0 100644
--- a/binsrc/yacutia/vad_dav.xml
+++ b/binsrc/yacutia/vad_dav.xml
@@ -5,12 +5,12 @@
     <name package="conductor">
       <prop name="Title" value="Virtuoso Conductor"/>
       <prop name="Developer" value="OpenLink Software"/>
-      <prop name="Copyright" value="(C) 1998-2010 OpenLink Software"/>
+      <prop name="Copyright" value="(C) 1998-2011 OpenLink Software"/>
       <prop name="Download" value="http://www.openlinksw.com/virtuoso/conductor/download"/>
       <prop name="Download" value="http://www.openlinksw.co.uk/virtuoso/conductor/download"/>
     </name>
-    <version package="1.00.7817">
-      <prop name="Release Date" value="2010-07-09 18:23"/>
+    <version package="1.00.7890">
+      <prop name="Release Date" value="2011-03-29 18:23"/>
       <prop name="Build" value="Release, optimized"/>
     </version>
   </caption>
@@ -327,8 +327,10 @@
     <file type="dav" source="http" target_uri="conductor/msg_news_server_details.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="dav" source="http" target_uri="conductor/msg_news_server_info.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="dav" source="http" target_uri="conductor/page.xsl" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
+    <file type="dav" source="http" target_uri="conductor/persistent_xmlns.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="dav" source="http" target_uri="conductor/popup2_browser.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="dav" source="http" target_uri="conductor/popup_browser.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
+    <file type="dav" source="http" target_uri="conductor/rdf_conf.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="dav" source="http" target_uri="conductor/rdf_console.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="dav" source="http" target_uri="conductor/rdf_filters_pp.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="dav" source="http" target_uri="conductor/rdf_filters.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
@@ -379,6 +381,7 @@
     <file type="dav" source="http" target_uri="conductor/sys_queues_error.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="dav" source="http" target_uri="conductor/sys_queues_remove.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="dav" source="http" target_uri="conductor/sys_queues.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
+    <file type="dav" source="http" target_uri="conductor/tbl.js" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="dav" source="http" target_uri="conductor/text_triggers.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="dav" source="http" target_uri="conductor/uddi_remove.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="dav" source="http" target_uri="conductor/uddi_serv_browse.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
diff --git a/binsrc/yacutia/vad_fs.xml b/binsrc/yacutia/vad_fs.xml
index 7536c9a..d506f1d 100644
--- a/binsrc/yacutia/vad_fs.xml
+++ b/binsrc/yacutia/vad_fs.xml
@@ -5,12 +5,12 @@
     <name package="conductor">
       <prop name="Title" value="Virtuoso Conductor"/>
       <prop name="Developer" value="OpenLink Software"/>
-      <prop name="Copyright" value="(C) 1998-2010 OpenLink Software"/>
+      <prop name="Copyright" value="(C) 1998-2011 OpenLink Software"/>
       <prop name="Download" value="http://www.openlinksw.com/virtuoso/conductor/download"/>
       <prop name="Download" value="http://www.openlinksw.co.uk/virtuoso/conductor/download"/>
     </name>
-    <version package="1.00.7817">
-      <prop name="Release Date" value="2010-07-09 18:23"/>
+    <version package="1.00.7890">
+      <prop name="Release Date" value="2011-03-29 18:23"/>
       <prop name="Build" value="Release, optimized"/>
     </version>
   </caption>
@@ -333,8 +333,10 @@
     <file type="http" source="http" target_uri="conductor/msg_news_server_details.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="http" source="http" target_uri="conductor/msg_news_server_info.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="http" source="http" target_uri="conductor/page.xsl" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
+    <file type="http" source="http" target_uri="conductor/persistent_xmlns.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="http" source="http" target_uri="conductor/popup2_browser.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="http" source="http" target_uri="conductor/popup_browser.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
+    <file type="http" source="http" target_uri="conductor/rdf_conf.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="http" source="http" target_uri="conductor/rdf_console.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="http" source="http" target_uri="conductor/rdf_filters_pp.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="http" source="http" target_uri="conductor/rdf_filters.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
@@ -385,6 +387,7 @@
     <file type="http" source="http" target_uri="conductor/sys_queues_error.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="http" source="http" target_uri="conductor/sys_queues_remove.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="http" source="http" target_uri="conductor/sys_queues.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
+    <file type="http" source="http" target_uri="conductor/tbl.js" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="http" source="http" target_uri="conductor/text_triggers.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="http" source="http" target_uri="conductor/uddi_remove.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
     <file type="http" source="http" target_uri="conductor/uddi_serv_browse.vspx" dav_owner='dav' dav_grp='administrators' dav_perm='111101101NN' makepath="yes"/>
diff --git a/binsrc/yacutia/vad_install.vspx b/binsrc/yacutia/vad_install.vspx
index f876bca..e6474a8 100644
--- a/binsrc/yacutia/vad_install.vspx
+++ b/binsrc/yacutia/vad_install.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vad_install.vspx,v 1.8.2.3 2009/08/28 13:05:24 source Exp $
+ -  $Id: vad_install.vspx,v 1.8.2.5 2011/01/25 14:21:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -70,7 +70,7 @@
         </v:script>
       </v:on-init>
       <v:template type="simple" enabled= "--case when (self.pack_ready = 1) then 1 else 0 end">
-      <div>
+      <div class="clear">
 	<img class="dialog_icon" src="images/icons/about_32.png" alt="Stop" title="Stop"/>
             Installing a VAD package will put the database in atomic mode, halting other client threads<br/>
             for duration of the installation. If the installation encounters a fatal error such as running<br/>
diff --git a/binsrc/yacutia/vad_install_batch.vspx b/binsrc/yacutia/vad_install_batch.vspx
index 12dac6f..f6571db 100644
--- a/binsrc/yacutia/vad_install_batch.vspx
+++ b/binsrc/yacutia/vad_install_batch.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vad_install_batch.vspx,v 1.3.2.2 2009/08/28 13:05:24 source Exp $
+ -  $Id: vad_install_batch.vspx,v 1.3.2.3 2010/09/20 10:16:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vad_remove.vspx b/binsrc/yacutia/vad_remove.vspx
index 30d3c45..a5388cf 100644
--- a/binsrc/yacutia/vad_remove.vspx
+++ b/binsrc/yacutia/vad_remove.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vad_remove.vspx,v 1.2.2.2 2009/08/28 13:05:24 source Exp $
+ -  $Id: vad_remove.vspx,v 1.2.2.3 2010/09/20 10:16:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vad_remove_batch.vspx b/binsrc/yacutia/vad_remove_batch.vspx
index 08d2a94..8ce3c1b 100644
--- a/binsrc/yacutia/vad_remove_batch.vspx
+++ b/binsrc/yacutia/vad_remove_batch.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vad_remove_batch.vspx,v 1.1.2.1 2009/08/28 13:05:24 source Exp $
+ -  $Id: vad_remove_batch.vspx,v 1.1.2.2 2010/09/20 10:16:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vad_src.vspx b/binsrc/yacutia/vad_src.vspx
index 58b973c..050ca6d 100644
--- a/binsrc/yacutia/vad_src.vspx
+++ b/binsrc/yacutia/vad_src.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vad_src.vspx,v 1.1.2.1 2009/08/28 13:05:24 source Exp $
+ -  $Id: vad_src.vspx,v 1.1.2.2 2010/09/20 10:16:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vad_status.vspx b/binsrc/yacutia/vad_status.vspx
index fa9be18..201e371 100644
--- a/binsrc/yacutia/vad_status.vspx
+++ b/binsrc/yacutia/vad_status.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vad_status.vspx,v 1.3.2.2 2009/08/28 13:05:25 source Exp $
+ -  $Id: vad_status.vspx,v 1.3.2.3 2010/09/20 10:16:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vad_version b/binsrc/yacutia/vad_version
index 121129e..71f2f32 100644
--- a/binsrc/yacutia/vad_version
+++ b/binsrc/yacutia/vad_version
@@ -1 +1 @@
-1.00.7817
+1.00.7890
diff --git a/binsrc/yacutia/vad_wa_config.vspx b/binsrc/yacutia/vad_wa_config.vspx
index 9a23f42..ed21095 100644
--- a/binsrc/yacutia/vad_wa_config.vspx
+++ b/binsrc/yacutia/vad_wa_config.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vad_wa_config.vspx,v 1.5.2.2 2009/08/28 13:05:25 source Exp $
+ -  $Id: vad_wa_config.vspx,v 1.5.2.3 2010/09/20 10:16:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vad_wa_create.vspx b/binsrc/yacutia/vad_wa_create.vspx
index 06b5dac..f0cb74f 100644
--- a/binsrc/yacutia/vad_wa_create.vspx
+++ b/binsrc/yacutia/vad_wa_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vad_wa_create.vspx,v 1.7.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: vad_wa_create.vspx,v 1.7.2.3 2010/09/20 10:16:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_conf_dsn_edit.vspx b/binsrc/yacutia/vdb_conf_dsn_edit.vspx
index 353aa9f..99f2f56 100644
--- a/binsrc/yacutia/vdb_conf_dsn_edit.vspx
+++ b/binsrc/yacutia/vdb_conf_dsn_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_conf_dsn_edit.vspx,v 1.5.2.3 2010/01/07 16:58:12 source Exp $
+ -  $Id: vdb_conf_dsn_edit.vspx,v 1.5.2.5 2011/02/03 10:30:29 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -482,7 +482,7 @@
 			    <tr>
 			      <td colspan="3" align="middle">
 				<p class="copyright_noalign"><?V self.driver ?><br />
-				  <small>Copyright 1998-2010 OpenLink Software</small><br />
+				  <small>Copyright 1998-2011 OpenLink Software</small><br />
 				  <small>All rights reserved</small></p></td></tr>
 			    <tr><td rowspan="4" valign="top"><img src="images/opl.jpg" border="1" /></td>
 			      <td valign="top">
diff --git a/binsrc/yacutia/vdb_conf_dsn_new.vspx b/binsrc/yacutia/vdb_conf_dsn_new.vspx
index 04d2784..7339e06 100644
--- a/binsrc/yacutia/vdb_conf_dsn_new.vspx
+++ b/binsrc/yacutia/vdb_conf_dsn_new.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_conf_dsn_new.vspx,v 1.2.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_conf_dsn_new.vspx,v 1.2.2.3 2010/09/20 10:16:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_conf_dsn_remove.vspx b/binsrc/yacutia/vdb_conf_dsn_remove.vspx
index 65a1e87..47ebff8 100644
--- a/binsrc/yacutia/vdb_conf_dsn_remove.vspx
+++ b/binsrc/yacutia/vdb_conf_dsn_remove.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_conf_dsn_remove.vspx,v 1.3.2.3 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_conf_dsn_remove.vspx,v 1.3.2.4 2010/09/20 10:16:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_config_dsn.vspx b/binsrc/yacutia/vdb_config_dsn.vspx
index b4efa2b..4497cbf 100644
--- a/binsrc/yacutia/vdb_config_dsn.vspx
+++ b/binsrc/yacutia/vdb_config_dsn.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_config_dsn.vspx,v 1.2.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_config_dsn.vspx,v 1.2.2.3 2010/09/20 10:16:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_conn_dsn.vspx b/binsrc/yacutia/vdb_conn_dsn.vspx
index 26a194c..8082c32 100644
--- a/binsrc/yacutia/vdb_conn_dsn.vspx
+++ b/binsrc/yacutia/vdb_conn_dsn.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_conn_dsn.vspx,v 1.3.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_conn_dsn.vspx,v 1.3.2.3 2010/09/20 10:16:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_conn_dsn_del.vspx b/binsrc/yacutia/vdb_conn_dsn_del.vspx
index 4e3718d..818d76b 100644
--- a/binsrc/yacutia/vdb_conn_dsn_del.vspx
+++ b/binsrc/yacutia/vdb_conn_dsn_del.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_conn_dsn_del.vspx,v 1.3.2.3 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_conn_dsn_del.vspx,v 1.3.2.4 2010/09/20 10:16:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_conn_dsn_edit.vspx b/binsrc/yacutia/vdb_conn_dsn_edit.vspx
index 21472f1..6006a4b 100644
--- a/binsrc/yacutia/vdb_conn_dsn_edit.vspx
+++ b/binsrc/yacutia/vdb_conn_dsn_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_conn_dsn_edit.vspx,v 1.2.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_conn_dsn_edit.vspx,v 1.2.2.3 2010/09/20 10:16:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_dsn_edit.vspx b/binsrc/yacutia/vdb_dsn_edit.vspx
index efc89de..b86e324 100644
--- a/binsrc/yacutia/vdb_dsn_edit.vspx
+++ b/binsrc/yacutia/vdb_dsn_edit.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: vdb_dsn_edit.vspx,v 1.3.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_dsn_edit.vspx,v 1.3.2.3 2010/09/20 10:16:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_dsns.vspx b/binsrc/yacutia/vdb_dsns.vspx
index 9613405..6a7d08b 100644
--- a/binsrc/yacutia/vdb_dsns.vspx
+++ b/binsrc/yacutia/vdb_dsns.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: vdb_dsns.vspx,v 1.2.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_dsns.vspx,v 1.2.2.3 2010/09/20 10:16:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_error_inc.vspx b/binsrc/yacutia/vdb_error_inc.vspx
index 9f0e64f..3591606 100644
--- a/binsrc/yacutia/vdb_error_inc.vspx
+++ b/binsrc/yacutia/vdb_error_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: vdb_error_inc.vspx,v 1.4.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_error_inc.vspx,v 1.4.2.3 2010/09/20 10:16:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_errs.vspx b/binsrc/yacutia/vdb_errs.vspx
index 095c378..5a8e1d6 100644
--- a/binsrc/yacutia/vdb_errs.vspx
+++ b/binsrc/yacutia/vdb_errs.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_errs.vspx,v 1.3.2.3 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_errs.vspx,v 1.3.2.4 2010/09/20 10:16:55 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_export.vspx b/binsrc/yacutia/vdb_export.vspx
index cc3ce5c..d192a88 100644
--- a/binsrc/yacutia/vdb_export.vspx
+++ b/binsrc/yacutia/vdb_export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: vdb_export.vspx,v 1.1.2.2 2009/12/02 14:48:42 source Exp $
+ -  $Id: vdb_export.vspx,v 1.1.2.3 2010/09/20 10:16:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_link.vspx b/binsrc/yacutia/vdb_link.vspx
index 3e78041..5f467de 100644
--- a/binsrc/yacutia/vdb_link.vspx
+++ b/binsrc/yacutia/vdb_link.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: vdb_link.vspx,v 1.4.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_link.vspx,v 1.4.2.3 2010/09/20 10:16:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_linked_obj.vspx b/binsrc/yacutia/vdb_linked_obj.vspx
index 72c01e6..51d2ea6 100644
--- a/binsrc/yacutia/vdb_linked_obj.vspx
+++ b/binsrc/yacutia/vdb_linked_obj.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_linked_obj.vspx,v 1.3.2.3 2009/12/02 14:48:42 source Exp $
+ -  $Id: vdb_linked_obj.vspx,v 1.3.2.4 2010/09/20 10:16:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_main.vspx b/binsrc/yacutia/vdb_main.vspx
index a0e2faf..b0db9be 100644
--- a/binsrc/yacutia/vdb_main.vspx
+++ b/binsrc/yacutia/vdb_main.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_main.vspx,v 1.5.2.2 2009/08/27 22:43:50 source Exp $
+ -  $Id: vdb_main.vspx,v 1.5.2.3 2010/09/20 10:16:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_obj_link.vspx b/binsrc/yacutia/vdb_obj_link.vspx
index 9526079..5d1fa41 100644
--- a/binsrc/yacutia/vdb_obj_link.vspx
+++ b/binsrc/yacutia/vdb_obj_link.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_obj_link.vspx,v 1.3.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_obj_link.vspx,v 1.3.2.3 2010/09/20 10:16:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_obj_link_opts.vspx b/binsrc/yacutia/vdb_obj_link_opts.vspx
index 4ea3791..d63eb4c 100644
--- a/binsrc/yacutia/vdb_obj_link_opts.vspx
+++ b/binsrc/yacutia/vdb_obj_link_opts.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_obj_link_opts.vspx,v 1.5.2.3 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_obj_link_opts.vspx,v 1.5.2.4 2010/09/20 10:16:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_obj_link_pk.vspx b/binsrc/yacutia/vdb_obj_link_pk.vspx
index 6045be4..1819f5a 100644
--- a/binsrc/yacutia/vdb_obj_link_pk.vspx
+++ b/binsrc/yacutia/vdb_obj_link_pk.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_obj_link_pk.vspx,v 1.4.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_obj_link_pk.vspx,v 1.4.2.3 2010/09/20 10:16:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_resources.vspx b/binsrc/yacutia/vdb_resources.vspx
index ada7542..33c2fa5 100644
--- a/binsrc/yacutia/vdb_resources.vspx
+++ b/binsrc/yacutia/vdb_resources.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: vdb_resources.vspx,v 1.3.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_resources.vspx,v 1.3.2.3 2010/09/20 10:16:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdb_unlink_obj.vspx b/binsrc/yacutia/vdb_unlink_obj.vspx
index 637b420..b1190b6 100644
--- a/binsrc/yacutia/vdb_unlink_obj.vspx
+++ b/binsrc/yacutia/vdb_unlink_obj.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: vdb_unlink_obj.vspx,v 1.4.2.3 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdb_unlink_obj.vspx,v 1.4.2.4 2010/09/20 10:16:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vdir_browser.vspx b/binsrc/yacutia/vdir_browser.vspx
index bae22d3..c6e6e18 100644
--- a/binsrc/yacutia/vdir_browser.vspx
+++ b/binsrc/yacutia/vdir_browser.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: vdir_browser.vspx,v 1.5.2.3 2009/08/28 13:05:26 source Exp $
+ -  $Id: vdir_browser.vspx,v 1.5.2.4 2010/09/20 10:16:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/vfs_export.vspx b/binsrc/yacutia/vfs_export.vspx
index 01375fb..d46ab86 100644
--- a/binsrc/yacutia/vfs_export.vspx
+++ b/binsrc/yacutia/vfs_export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: vfs_export.vspx,v 1.1.4.2 2010/05/26 15:21:53 source Exp $
+ -  $Id: vfs_export.vspx,v 1.1.4.4 2011/03/23 12:03:54 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -27,5 +27,10 @@
   doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
   fast-render="1" xmlns:v="http://www.openlinksw.com/vspx/"
   xmlns:vm="http://www.openlinksw.com/vspx/macro">
-    <pre><?vsp http_value (WS.WS.VFS_EXPORT_DEFS ()); ?></pre>
+  <?vsp 
+    http_rewrite ();
+    http_header ('Content-Type: text/plain\r\n');  
+    http (WS.WS.VFS_EXPORT_DEFS ()); 
+    return;
+  ?>
 </v:page>
diff --git a/binsrc/yacutia/vhost_export.vspx b/binsrc/yacutia/vhost_export.vspx
index 5b917e2..76e4c4e 100644
--- a/binsrc/yacutia/vhost_export.vspx
+++ b/binsrc/yacutia/vhost_export.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: vhost_export.vspx,v 1.1.2.1 2009/08/28 13:05:26 source Exp $
+ -  $Id: vhost_export.vspx,v 1.1.2.2 2010/09/20 10:16:56 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/view.vsp b/binsrc/yacutia/view.vsp
index 084024e..a0dc903 100644
--- a/binsrc/yacutia/view.vsp
+++ b/binsrc/yacutia/view.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: view.vsp,v 1.2.2.1 2009/08/27 22:43:50 source Exp $
+--  $Id: view.vsp,v 1.2.2.2 2010/09/20 10:16:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/binsrc/yacutia/view.vspx b/binsrc/yacutia/view.vspx
index 6e95536..613266c 100644
--- a/binsrc/yacutia/view.vspx
+++ b/binsrc/yacutia/view.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: view.vspx,v 1.2.2.1 2009/08/27 22:43:50 source Exp $
+ -  $Id: view.vspx,v 1.2.2.2 2010/09/20 10:16:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/view_dav_res.vsp b/binsrc/yacutia/view_dav_res.vsp
index ebb94f2..04f0db3 100644
--- a/binsrc/yacutia/view_dav_res.vsp
+++ b/binsrc/yacutia/view_dav_res.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: view_dav_res.vsp,v 1.2.2.1 2009/08/27 22:43:50 source Exp $
+--  $Id: view_dav_res.vsp,v 1.2.2.2 2010/09/20 10:16:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/binsrc/yacutia/view_file.vsp b/binsrc/yacutia/view_file.vsp
index a94b543..2ccd97e 100644
--- a/binsrc/yacutia/view_file.vsp
+++ b/binsrc/yacutia/view_file.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: view_file.vsp,v 1.2.2.1 2009/08/27 22:43:50 source Exp $
+--  $Id: view_file.vsp,v 1.2.2.2 2010/09/20 10:16:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/binsrc/yacutia/virtuoso_splash.vspx b/binsrc/yacutia/virtuoso_splash.vspx
index 6ed8d10..e06eab0 100644
--- a/binsrc/yacutia/virtuoso_splash.vspx
+++ b/binsrc/yacutia/virtuoso_splash.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: virtuoso_splash.vspx,v 1.2.2.1 2009/08/27 22:43:50 source Exp $
+ -  $Id: virtuoso_splash.vspx,v 1.2.2.2 2010/09/20 10:16:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/wsdl_service_create.vspx b/binsrc/yacutia/wsdl_service_create.vspx
index 1cb261d..9f06594 100644
--- a/binsrc/yacutia/wsdl_service_create.vspx
+++ b/binsrc/yacutia/wsdl_service_create.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: wsdl_service_create.vspx,v 1.4.2.3 2009/08/28 13:05:26 source Exp $
+ -  $Id: wsdl_service_create.vspx,v 1.4.2.4 2010/09/20 10:16:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/wsdl_services.vspx b/binsrc/yacutia/wsdl_services.vspx
index c6d91c2..49b4826 100644
--- a/binsrc/yacutia/wsdl_services.vspx
+++ b/binsrc/yacutia/wsdl_services.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: wsdl_services.vspx,v 1.3.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: wsdl_services.vspx,v 1.3.2.3 2010/09/20 10:16:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/wsdltree.vspx b/binsrc/yacutia/wsdltree.vspx
index 1c6df39..7d676c1 100644
--- a/binsrc/yacutia/wsdltree.vspx
+++ b/binsrc/yacutia/wsdltree.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!--
  -
- -  $Id: wsdltree.vspx,v 1.4.2.3 2009/08/28 13:05:26 source Exp $
+ -  $Id: wsdltree.vspx,v 1.4.2.4 2010/09/20 10:16:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xddl-tables.vspx b/binsrc/yacutia/xddl-tables.vspx
index f2a810e..acf76a9 100644
--- a/binsrc/yacutia/xddl-tables.vspx
+++ b/binsrc/yacutia/xddl-tables.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xddl-tables.vspx,v 1.4.2.3 2009/10/01 07:52:29 source Exp $
+ -  $Id: xddl-tables.vspx,v 1.4.2.4 2010/09/20 10:16:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xddl.vspx b/binsrc/yacutia/xddl.vspx
index 3835609..6e1f180 100644
--- a/binsrc/yacutia/xddl.vspx
+++ b/binsrc/yacutia/xddl.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xddl.vspx,v 1.5.2.1 2009/08/27 22:43:50 source Exp $
+ -  $Id: xddl.vspx,v 1.5.2.2 2010/09/20 10:16:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xml_check.vspx b/binsrc/yacutia/xml_check.vspx
index 452bc86..0097120 100644
--- a/binsrc/yacutia/xml_check.vspx
+++ b/binsrc/yacutia/xml_check.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: xml_check.vspx,v 1.2.2.1 2009/08/27 22:43:50 source Exp $
+ -  $Id: xml_check.vspx,v 1.2.2.2 2010/09/20 10:16:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xml_sql.vspx b/binsrc/yacutia/xml_sql.vspx
index cdef3cd..6e275a5 100644
--- a/binsrc/yacutia/xml_sql.vspx
+++ b/binsrc/yacutia/xml_sql.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" ?>
 <!--
  -
- -  $Id: xml_sql.vspx,v 1.4.2.3 2009/08/28 13:05:26 source Exp $
+ -  $Id: xml_sql.vspx,v 1.4.2.4 2010/09/20 10:16:57 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xml_sql2.vspx b/binsrc/yacutia/xml_sql2.vspx
index 0a68e2e..1a6c228 100644
--- a/binsrc/yacutia/xml_sql2.vspx
+++ b/binsrc/yacutia/xml_sql2.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xml_sql2.vspx,v 1.2.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: xml_sql2.vspx,v 1.2.2.3 2010/09/20 10:16:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xml_sql_check.vspx b/binsrc/yacutia/xml_sql_check.vspx
index 8a8b42e..4745b29 100644
--- a/binsrc/yacutia/xml_sql_check.vspx
+++ b/binsrc/yacutia/xml_sql_check.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: xml_sql_check.vspx,v 1.3.2.1 2009/08/27 22:43:50 source Exp $
+ -  $Id: xml_sql_check.vspx,v 1.3.2.2 2010/09/20 10:16:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xml_sql_view_show.vspx b/binsrc/yacutia/xml_sql_view_show.vspx
index e5b9356..17f8259 100644
--- a/binsrc/yacutia/xml_sql_view_show.vspx
+++ b/binsrc/yacutia/xml_sql_view_show.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: xml_sql_view_show.vspx,v 1.2.2.1 2009/08/27 22:43:50 source Exp $
+ -  $Id: xml_sql_view_show.vspx,v 1.2.2.2 2010/09/20 10:16:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xml_xsd.vspx b/binsrc/yacutia/xml_xsd.vspx
index 8666811..b4ef110 100644
--- a/binsrc/yacutia/xml_xsd.vspx
+++ b/binsrc/yacutia/xml_xsd.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xml_xsd.vspx,v 1.4.2.3 2009/10/01 07:52:30 source Exp $
+ -  $Id: xml_xsd.vspx,v 1.4.2.4 2010/09/20 10:16:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xquery.vspx b/binsrc/yacutia/xquery.vspx
index 8050dba..4735f68 100644
--- a/binsrc/yacutia/xquery.vspx
+++ b/binsrc/yacutia/xquery.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xquery.vspx,v 1.2.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: xquery.vspx,v 1.2.2.3 2010/09/20 10:16:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xquery2.vspx b/binsrc/yacutia/xquery2.vspx
index 9e8a915..df1b869 100644
--- a/binsrc/yacutia/xquery2.vspx
+++ b/binsrc/yacutia/xquery2.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xquery2.vspx,v 1.4.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: xquery2.vspx,v 1.4.2.3 2010/09/20 10:16:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xquery3.vspx b/binsrc/yacutia/xquery3.vspx
index 037203d..17f718a 100644
--- a/binsrc/yacutia/xquery3.vspx
+++ b/binsrc/yacutia/xquery3.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xquery3.vspx,v 1.3.2.2 2009/08/28 13:05:26 source Exp $
+ -  $Id: xquery3.vspx,v 1.3.2.3 2010/09/20 10:16:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xquery4.vspx b/binsrc/yacutia/xquery4.vspx
index 4f378e2..ba38c18 100644
--- a/binsrc/yacutia/xquery4.vspx
+++ b/binsrc/yacutia/xquery4.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xquery4.vspx,v 1.3.2.2 2009/08/28 13:05:27 source Exp $
+ -  $Id: xquery4.vspx,v 1.3.2.3 2010/09/20 10:16:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xquery_adv.vspx b/binsrc/yacutia/xquery_adv.vspx
index c3dbbf0..4bcb86d 100644
--- a/binsrc/yacutia/xquery_adv.vspx
+++ b/binsrc/yacutia/xquery_adv.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xquery_adv.vspx,v 1.3.2.2 2009/08/28 13:05:27 source Exp $
+ -  $Id: xquery_adv.vspx,v 1.3.2.3 2010/09/20 10:16:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xquery_check.vspx b/binsrc/yacutia/xquery_check.vspx
index 0b2af4f..42444fc 100644
--- a/binsrc/yacutia/xquery_check.vspx
+++ b/binsrc/yacutia/xquery_check.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: xquery_check.vspx,v 1.3.2.1 2009/08/27 22:43:50 source Exp $
+ -  $Id: xquery_check.vspx,v 1.3.2.2 2010/09/20 10:16:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xquery_src_show.vspx b/binsrc/yacutia/xquery_src_show.vspx
index 63ea7a7..9b54af3 100644
--- a/binsrc/yacutia/xquery_src_show.vspx
+++ b/binsrc/yacutia/xquery_src_show.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: xquery_src_show.vspx,v 1.2.2.1 2009/08/27 22:43:50 source Exp $
+ -  $Id: xquery_src_show.vspx,v 1.2.2.2 2010/09/20 10:16:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xquery_templates.vspx b/binsrc/yacutia/xquery_templates.vspx
index 56411f7..7120c6c 100644
--- a/binsrc/yacutia/xquery_templates.vspx
+++ b/binsrc/yacutia/xquery_templates.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xquery_templates.vspx,v 1.3.2.3 2009/08/28 13:05:27 source Exp $
+ -  $Id: xquery_templates.vspx,v 1.3.2.4 2010/09/20 10:16:58 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xslt.vspx b/binsrc/yacutia/xslt.vspx
index 1399515..bf51af6 100644
--- a/binsrc/yacutia/xslt.vspx
+++ b/binsrc/yacutia/xslt.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xslt.vspx,v 1.2.2.2 2009/08/28 13:05:27 source Exp $
+ -  $Id: xslt.vspx,v 1.2.2.3 2010/09/20 10:16:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xslt_inc.vspx b/binsrc/yacutia/xslt_inc.vspx
index 12b4263..411ed58 100644
--- a/binsrc/yacutia/xslt_inc.vspx
+++ b/binsrc/yacutia/xslt_inc.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: xslt_inc.vspx,v 1.3.2.2 2009/08/28 13:05:27 source Exp $
+ -  $Id: xslt_inc.vspx,v 1.3.2.3 2010/09/20 10:16:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xslt_res.vsp b/binsrc/yacutia/xslt_res.vsp
index 7226cf7..ef67db6 100644
--- a/binsrc/yacutia/xslt_res.vsp
+++ b/binsrc/yacutia/xslt_res.vsp
@@ -1,6 +1,6 @@
 <?vsp
 --
---  $Id: xslt_res.vsp,v 1.2.2.2 2009/08/28 13:05:27 source Exp $
+--  $Id: xslt_res.vsp,v 1.2.2.3 2010/09/20 10:16:59 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/binsrc/yacutia/xslt_res.vspx b/binsrc/yacutia/xslt_res.vspx
index bde39ad..f3855a5 100644
--- a/binsrc/yacutia/xslt_res.vspx
+++ b/binsrc/yacutia/xslt_res.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: xslt_res.vspx,v 1.4.2.1 2009/08/27 22:43:50 source Exp $
+ -  $Id: xslt_res.vspx,v 1.4.2.2 2010/09/20 10:16:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/xslt_result.vspx b/binsrc/yacutia/xslt_result.vspx
index da31a76..1acff0a 100644
--- a/binsrc/yacutia/xslt_result.vspx
+++ b/binsrc/yacutia/xslt_result.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
  -
- -  $Id: xslt_result.vspx,v 1.3.2.2 2009/08/27 22:43:50 source Exp $
+ -  $Id: xslt_result.vspx,v 1.3.2.3 2010/09/20 10:16:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/yac.sql b/binsrc/yacutia/yac.sql
index 6245469..fe12bee 100644
--- a/binsrc/yacutia/yac.sql
+++ b/binsrc/yacutia/yac.sql
@@ -1,5 +1,5 @@
 --
---  $Id: yac.sql,v 1.1.1.1.2.2 2009/08/28 13:05:27 source Exp $
+--  $Id: yac.sql,v 1.1.1.1.2.3 2010/09/20 10:16:59 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
diff --git a/binsrc/yacutia/yacutia.sql b/binsrc/yacutia/yacutia.sql
index 709bee6..c383cf8 100644
--- a/binsrc/yacutia/yacutia.sql
+++ b/binsrc/yacutia/yacutia.sql
@@ -1,5 +1,5 @@
 --
---  $Id: yacutia.sql,v 1.43.2.30 2010/07/05 14:59:29 source Exp $
+--  $Id: yacutia.sql,v 1.43.2.35 2011/03/23 12:03:54 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -456,6 +456,7 @@ case when 0 and check_package('rdf_mappers') then
      <node name="Meta Cartridges" url="rdf_filters_pp.vspx" id="193" place="1" allowed="yacutia_sparql_page" />
      <node name="Stylesheets" url="sparql_filters.vspx" id="182" place="1" allowed="yacutia_sparql_page" />
      <node name="Console" url="rdf_console.vspx" id="182" place="1" allowed="yacutia_sparql_page" />
+     <node name="Configuration" url="rdf_conf.vspx" id="182" place="1" allowed="yacutia_sparql_page" />
    </node>',
    '<node name="Statistics" url="rdf_void.vspx" id="194" tip="RDF Statistics" allowed="yacutia_sparql_page" />',
    '<node name="Graphs"  url="sparql_graph.vspx"  id="183" allowed="yacutia_message">
@@ -464,6 +465,7 @@ case when 0 and check_package('rdf_mappers') then
    '<node name="Schemas"  url="rdf_schemas.vspx"  id="183" allowed="yacutia_message">
      <node name="Schemas" url="rdf_schemas.vspx" id="184" place="1" allowed="yacutia_sparql_page" />
    </node>
+   <node name="Namespaces"  url="persistent_xmlns.vspx"  id="183" allowed="yacutia_message" />
    <node name="RDF Views" url="db_rdf_objects.vspx"  id="271" allowed="yacutia_rdf_schema_objects_page"/>
    <node name="RDF Views" url="db_rdf_class.vspx"  id="272" place="1"/>
    <node name="RDF Views" url="db_rdf_owl.vspx"  id="273" place="1"/>
@@ -2984,6 +2986,37 @@ create procedure DB.DBA.Y_PATH_NAME (
 }
 ;
 
+create procedure DB.DBA.Y_DAV_PROP_PARAMS (
+  inout params any)
+{
+  declare N integer;
+  declare c_properties, c_seq, c_property, c_value, c_action any;
+
+  c_properties := vector ();
+  for (N := 0; N < length (params); N := N + 2)
+  {
+    if (params[N] like 'c_fld_1_%')
+    {
+      c_seq := replace (params[N], 'c_fld_1_', '');
+      c_property := trim (params[N+1]);
+      if (c_property <> '')
+      {
+        c_value := trim (get_keyword ('c_fld_2_' || c_seq, params, ''));
+        {
+          declare exit handler for sqlstate '*' { goto _error; };
+          if (isarray (xml_tree (c_value, 0)))
+            c_value := serialize (xml_tree (c_value));
+        }
+      _error:;
+        c_action := get_keyword ('c_fld_3_' || c_seq, params, '');
+        c_properties := vector_concat (c_properties, vector (vector (c_property, c_value, c_action)));
+      }
+    }
+  }
+  return c_properties;
+}
+;
+
 create procedure DB.DBA.Y_DAV_PROP_SET (
   in path varchar,
   in propName varchar,
@@ -3025,6 +3058,39 @@ create procedure DB.DBA.Y_DAV_PROP_REMOVE (
 }
 ;
 
+create procedure DB.DBA.Y_DAV_PROP_LIST (
+  in path varchar,
+  in propmask varchar := '%',
+  in skips varchar := null,
+  in auth_name varchar := null,
+  in auth_pwd varchar := null)
+{
+  declare uname, gname varchar;
+  declare props any;
+
+  DB.DBA.Y_DAV_PARAMS (auth_name, auth_pwd);
+  props := DB.DBA.DAV_PROP_LIST(path, propmask, auth_name, auth_pwd);
+  if (isinteger(props) and (props < 0))
+    return vector ();
+
+  if (isnull (skips))
+    return props;
+
+  declare remains any;
+
+  remains := vector();
+  foreach(any prop in props) do
+  {
+    foreach(any skip in skips) do
+      if (prop[0] like skip)
+        goto _skip;
+    remains := vector_concat(remains, vector(prop));
+  _skip: ;
+  }
+  return remains;
+}
+;
+
 create procedure DB.DBA.Y_DAV_IS_LOCKED (
   in path varchar,
   in type varchar := 'R')
@@ -3338,6 +3404,158 @@ create procedure DB.DBA.Y_DAV_GET_INFO (
 }
 ;
 
+create procedure DB.DBA.Y_ACI_LOAD (
+  in path varchar)
+{
+  declare retValue, graph any;
+  declare S, st, msg, data, meta any;
+
+  retValue := vector ();
+
+  graph := SIOC..dav_res_iri (path);
+  S := sprintf (' sparql \n' ||
+                ' define input:storage "" \n' ||
+                ' prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n' ||
+                ' prefix foaf: <http://xmlns.com/foaf/0.1/> \n' ||
+                ' prefix acl: <http://www.w3.org/ns/auth/acl#> \n' ||
+                ' select ?rule ?agent ?mode \n' ||
+                '   from <%s> \n' ||
+                '  where { \n' ||
+                '          { \n' ||
+                '            ?rule rdf:type acl:Authorization ; \n' ||
+                '            acl:accessTo <%s> ; \n' ||
+                '            acl:mode ?mode ; \n' ||
+                '            acl:agent ?agent. \n' ||
+                '          } \n' ||
+                '          union \n' ||
+                '          { \n' ||
+                '            ?rule rdf:type acl:Authorization ; \n' ||
+                '            acl:accessTo <%s> ; \n' ||
+                '            acl:mode ?mode ; \n' ||
+                '            acl:agentClass ?agent. \n' ||
+                '          } \n' ||
+                '        }\n' ||
+                '  order by ?rule\n',
+                graph,
+                graph,
+                graph);
+  commit work;
+  st := '00000';
+  exec (S, st, msg, vector (), 0, meta, data);
+  if (st = '00000' and length (data))
+  {
+    declare N, aclNo, aclRule, aclMode, V any;
+
+    V := null;
+    aclNo := 0;
+    aclRule := '';
+    for (N := 0; N < length (data); N := N + 1)
+    {
+      if (aclRule <> data[N][0])
+      {
+        if (not isnull (V))
+          retValue := vector_concat (retValue, vector (V));
+        aclNo := aclNo + 1;
+        aclRule := data[N][0];
+        V := vector (aclNo, ODS.ODS_API."ontology.normalize" (data[N][1]), 'person', 0, 0, 0);
+      }
+      if (ODS.ODS_API."ontology.normalize" (data[N][1]) = 'foaf:Agent')
+        V[2] := 'public';
+      if (data[N][1] like SIOC..waGraph() || '%')
+        V[2] := 'group';
+      aclMode := ODS.ODS_API."ontology.normalize" (data[N][2]);
+      if (aclMode = 'acl:Read')
+        V[3] := 1;
+      if (aclMode = 'acl:Write')
+        V[4] := 1;
+      if (aclMode = 'acl:Control')
+        V[5] := 1;
+    }
+    if (not isnull (V))
+      retValue := vector_concat (retValue, vector (V));
+  }
+  return retValue;
+}
+;
+
+create procedure DB.DBA.Y_ACI_PARAMS (
+  in params any)
+{
+  declare N, M integer;
+  declare aclNo, retValue, V any;
+
+  M := 1;
+  retValue := vector ();
+  for (N := 0; N < length (params); N := N + 2)
+  {
+    if (params[N] like 'f_fld_2_%')
+    {
+      aclNo := replace (params[N], 'f_fld_2_', '');
+      V := vector (M,
+                   trim (params[N+1]),
+                   get_keyword ('f_fld_1_' || aclNo, params, 'person'),
+                   atoi (get_keyword ('f_fld_3_' || aclNo || '_r', params, '0')),
+                   atoi (get_keyword ('f_fld_3_' || aclNo || '_w', params, '0')),
+                   atoi (get_keyword ('f_fld_3_' || aclNo || '_x', params, '0'))
+                  );
+      retValue := vector_concat (retValue, vector (V));
+      M := M + 1;
+    }
+  }
+  return retValue;
+}
+;
+
+create procedure DB.DBA.Y_ACI_N3 (
+  in aciArray any)
+{
+  declare N integer;
+  declare retValue any;
+
+  if (length (aciArray) = 0)
+    return null;
+
+  retValue := ' @prefix acl: <http://www.w3.org/ns/auth/acl#> . \n' ||
+              ' @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . \n' ||
+              ' @prefix foaf: <http://xmlns.com/foaf/0.1/> . \n';
+  for (N := 0; N < length (aciArray); N := N + 1)
+  {
+    if (length (aciArray[N][1]))
+    {
+      retValue := retValue || sprintf ('   <aci_%d> rdf:type acl:Authorization ;\n   acl:accessTo <>', aciArray[N][0]);
+      if (aciArray[N][2] = 'person')
+      {
+        retValue := retValue || sprintf (';\n   acl:agent <%s>', aciArray[N][1]);
+      }
+      else if (aciArray[N][2] = 'group')
+      {
+        retValue := retValue || sprintf (';\n   acl:agentClass <%s>', aciArray[N][1]);
+      }
+      else if (aciArray[N][2] = 'public')
+      {
+        retValue := retValue || ';\n   acl:agentClass foaf:Agent';
+      }
+      if (aciArray[N][3])
+        retValue := retValue || ';\n   acl:mode acl:Read';
+      if (aciArray[N][4])
+        retValue := retValue || ';\n   acl:mode acl:Write';
+      if (aciArray[N][5])
+        retValue := retValue || ';\n   acl:mode acl:Control';
+      retValue := retValue || '.\n';
+    }
+  }
+  return retValue;
+}
+;
+
+create procedure DB.DBA.Y_VAD_CHECK (in vad_name varchar)
+{
+  if (isnull (VAD_CHECK_VERSION (vad_name)))
+    return 0;
+  return 1;
+}
+;
+
 create procedure db.dba.fs_browse_proc_meta() returns any
 {
   declare retval any;
@@ -6512,7 +6730,8 @@ create procedure WS.WS.VFS_EXPORT_DEFS ()
       http (sprintf ('-- Crawling descriptor for %s\n', VS_DESCR), ses);
       http ('INSERT SOFT WS.WS.VFS_SITE (\n\tVS_DESCR,\n\tVS_HOST,\n\tVS_URL,\n\tVS_INX,\n\tVS_OWN,\n\tVS_ROOT,\n\tVS_NEWER,\n' ||
 		'\tVS_DEL,\n\tVS_FOLLOW,\n\tVS_NFOLLOW,\n\tVS_SRC,\n\tVS_OPTIONS,\n\tVS_METHOD,\n\tVS_OTHER,\n\tVS_OPAGE,\n\tVS_REDIRECT,\n'||
-		'\tVS_STORE,\n\tVS_UDATA,\n\tVS_DLOAD_META,\n\tVS_INST_ID,\n\tVS_EXTRACT_FN,\n\tVS_STORE_FN,\n\tVS_DEPTH)\n VALUES (\n',
+		'\tVS_STORE,\n\tVS_UDATA,\n\tVS_DLOAD_META,\n\tVS_INST_ID,\n\tVS_EXTRACT_FN,\n\tVS_STORE_FN,\n\tVS_DEPTH,'||
+		'\n\tVS_CONVERT_HTML,\n\tVS_XPATH,\n\tVS_BOT,\n\tVS_IS_SITEMAP,\n\tVS_ACCEPT_RDF,\n\tVS_THREADS,\n\tVS_ROBOTS)\n VALUES (\n',
             ses			 
 	  );
       http ('\t', ses);	  
@@ -6560,8 +6779,35 @@ create procedure WS.WS.VFS_EXPORT_DEFS ()
       http ('\t', ses);	  
       http (DB.DBA.SYS_SQL_VAL_PRINT (VS_STORE_FN),ses); http (',\n', ses);
       http ('\t', ses);	  
-      http (DB.DBA.SYS_SQL_VAL_PRINT (VS_DEPTH),ses); http ('\n', ses);
-      http (');\n\n\n', ses);
+      http (DB.DBA.SYS_SQL_VAL_PRINT (VS_DEPTH),ses); http (',\n', ses);
+      http ('\t', ses);
+      http (DB.DBA.SYS_SQL_VAL_PRINT (VS_CONVERT_HTML),ses); http (',\n', ses);
+      http ('\t', ses);
+      http (DB.DBA.SYS_SQL_VAL_PRINT (VS_XPATH),ses); http (',\n', ses);
+      http ('\t', ses);
+      http (DB.DBA.SYS_SQL_VAL_PRINT (VS_BOT),ses); http (',\n', ses);
+      http ('\t', ses);
+      http (DB.DBA.SYS_SQL_VAL_PRINT (VS_IS_SITEMAP),ses); http (',\n', ses);
+      http ('\t', ses);
+      http (DB.DBA.SYS_SQL_VAL_PRINT (VS_ACCEPT_RDF),ses); http (',\n', ses);
+      http ('\t', ses);
+      http (DB.DBA.SYS_SQL_VAL_PRINT (VS_THREADS),ses); http (',\n', ses);
+      http ('\t', ses);
+      http (DB.DBA.SYS_SQL_VAL_PRINT (VS_ROBOTS),ses); http ('\n', ses);
+      http (');\n', ses);
+      for select * from WS.WS.VFS_SITE_RDF_MAP where VM_HOST = VS_HOST and VM_ROOT = VS_ROOT order by VM_SEQ do 
+	{
+	  http ('\n', ses);
+	  http ('insert soft WS.WS.VFS_SITE_RDF_MAP (VM_HOST, VM_ROOT, VM_RDF_MAP) values (', ses);
+	  http (DB.DBA.SYS_SQL_VAL_PRINT (VM_HOST),ses); http (',', ses);	
+	  http (DB.DBA.SYS_SQL_VAL_PRINT (VM_ROOT),ses); http (',', ses);
+	  http ('(select RM_PID from SYS_RDF_MAPPERS where RM_HOOK = ', ses);
+	  http (DB.DBA.SYS_SQL_VAL_PRINT ((select RM_HOOK from SYS_RDF_MAPPERS where RM_PID = VM_RDF_MAP)),ses); 
+	  http ('));', ses);
+	}
+      http ('\n', ses);
+      http ('\n', ses);
+      http ('\n', ses);
     }
   http ('WS.WS.VFS_INIT_QUEUE ();\n', ses);
   return ses;
diff --git a/binsrc/yacutia/yacutia_decor.vspx b/binsrc/yacutia/yacutia_decor.vspx
index 9157092..8350288 100644
--- a/binsrc/yacutia/yacutia_decor.vspx
+++ b/binsrc/yacutia/yacutia_decor.vspx
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!--
  -
- -  $Id: yacutia_decor.vspx,v 1.7.2.2 2010/01/29 15:10:09 source Exp $
+ -  $Id: yacutia_decor.vspx,v 1.7.2.4 2010/09/20 10:16:59 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -45,16 +45,12 @@
     <link rel="alternate" type="application/rss+xml" title="Benchmark & Troubleshooting Utilities Screencasts"
 	href="http://support.openlinksw.com/viewlets/utilities_viewlets_rss.vsp" />
     <title></title>
-    <?vsp
 
-    ?>
   <![CDATA[
-  <script type="text/javascript">
-  var featureList = ["combolist", "ajax", "tab"];
-  </script>
   <script type="text/javascript" src="toolkit/loader.js"></script>
   <script type="text/javascript">
     OAT.Preferences.imagePath = "images/";
+    OAT.Loader.load(["combolist", "ajax", "tab"], function(){OAT.MSG.send(OAT, 'PAGE_LOADED');});
   </script>
   ]]>
   </head>
diff --git a/binsrc/yacutia/yacutia_style.css b/binsrc/yacutia/yacutia_style.css
index 3322e90..db0ac9d 100644
--- a/binsrc/yacutia/yacutia_style.css
+++ b/binsrc/yacutia/yacutia_style.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: yacutia_style.css,v 1.7.2.3 2009/10/01 07:52:30 source Exp $
+ *  $Id: yacutia_style.css,v 1.7.2.8 2011/01/25 14:21:44 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -380,6 +380,9 @@ th
   text-align: left
 }
 
+.clear {
+  clear: both;
+}
 
 #copyright_ctr
 {
@@ -411,6 +414,8 @@ h1.page_title
   font-size: 24px;
   font-weight: bold;
   color: #aeaeaa;
+  width: 80%;
+  float: left;
 }
 
 td.page_title img
@@ -425,6 +430,10 @@ div.main_page_area
 
 }
 
+div.main_page_area table {
+  clear: left;
+}
+
 .sub_page
 {
   background-color: white;
@@ -699,7 +708,10 @@ td.dav_br_lst_perms
   font-family: courier, fixed;
 }
 
-
+table.listing_ctr {
+  width: 100%;
+  text-align: left;
+}
 
 table.dav_listing
 {
@@ -845,6 +857,23 @@ td.listing_col_action a
   font-family: courier, fixed;
 }
 
+/* accounts.vspx, sys_queues.vspx, etc. unhide the "Add New Item" */
+
+th.new_item { }
+th.new_item img { display: inline }
+
+th.new_item a {
+  text-decoration: underline;
+  font-weight: normal;
+  vertical-align: middle;
+}
+th.new_item a:before {
+  content: url(images/icons/add_16.png);
+  vertical-align: middle;
+  margin-right: 3px;
+}
+
+/* sys_queues.vsp
 
 /* Various error message containers */
 
@@ -969,9 +998,14 @@ img.dialog_icon
   padding: 0px 10px 0px 10px;
 }
 
+div.dialog_text {
+  clear: both;
+}
+
 div.confirm_dialog
 {
-  border: 4px dashed red;
+  clear:both
+  border: 4px solid red;
   padding: 10px;
 }
 
@@ -1161,6 +1195,18 @@ table.page_cmd_row
    width: 100%;
 }
 
+#pki_form label
+{
+  width: 100px;
+  font-weight: bold;
+  clear:left;
+  float:left;
+  font-weight:bold;
+  padding-top:4px;
+  width:10em;
+}
+
+
 /* XXX: Deprecated tab anchor markup - see above */
 
 a.uddi
@@ -1732,7 +1778,7 @@ div.validator_err_ctr p
 {
   color: red;
 }
-#nav_seperator {
+#nav_separator {
         left: 0px;
         top: 0px;
         width: 100%;
@@ -1834,6 +1880,7 @@ table.home th
   width: auto;
   margin-right:12px;
   overflow: auto;
+  clear: left;
 }
 
 .banner1
@@ -1852,11 +1899,28 @@ table.home th
   margin-left: 20px;
 }
 
-span.help_link a
+div.help_button
 {
+    border: 1px solid #666;
+    background-color: #ddd;
+    margin-right: 8px;
+    padding: 5px;
+    float: right;    
+}
+
+div.help_button:hover {
+  background-color: #aaa;
+  border: 1px solid #ddd;
+}
+
+div.help_button a {
     text-decoration: none;
+    color: #333;
+    vertical-align: middle;
 }
 
+div.help_button img { vertical-align: middle; margin-right: 3px;}
+
 .login_info
 {
     clear: none;
@@ -2064,3 +2128,51 @@ span.help_link a
   background-image: url(images/stl_blu1_grad.gif);
   background-repeat: repeat-x;
 }
+
+.form-list {
+  width: 100%;
+  border: solid #7f94a5;
+  border-width: 1px 1px 1px 1px;
+  background-color: #fff;
+}
+
+.form-list th {
+  text-align: center;
+  white-space: nowrap;
+  font-size: 1em;
+  font-weight: bold;
+  padding: 2px 4px 2px 4px;
+  border: solid #7f94a5;
+  background-color: #b0cde4;
+  border-width: 0px 1px 1px 0px;
+}
+
+.form-list th:last-child {
+  border-width: 0px 0px 1px 0px;
+}
+.form-list td {
+  border: solid #7f94a5;
+  border-width: 0px 0px 0px 0px;
+  padding: 2px 4px 2px 4px;
+}
+
+.pointer
+{
+  cursor: pointer;
+}
+
+span.button {
+  background: none repeat scroll 0 0 #99B3C5;
+  border: 1px solid #7F94A5;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  color: #FFFFFF;
+  font-size: 0.8em;
+  font-weight: bold;
+  padding: 3px 4px 1px;
+  text-decoration:none;
+}
+
+img.button {
+  margin-bottom: -3px;
+}
diff --git a/binsrc/yacutia/yacutia_style.xsl b/binsrc/yacutia/yacutia_style.xsl
index 1db7ea5..47b7adf 100644
--- a/binsrc/yacutia/yacutia_style.xsl
+++ b/binsrc/yacutia/yacutia_style.xsl
@@ -2,7 +2,7 @@
 <!-- <!DOCTYPE html  PUBLIC "" "ent.dtd"> -->
 <!--
  -
- -  $Id: yacutia_style.xsl,v 1.9.2.3 2010/01/07 16:58:12 source Exp $
+ -  $Id: yacutia_style.xsl,v 1.9.2.5 2011/01/25 14:21:44 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -422,11 +422,11 @@
 </xsl:template>
 
 <xsl:template match="vm:help">
-    <span class="help_link">
+  <div class="help_button">
     <v:button action="browse" name="brws_{generate-id()}" selector="help.vspx?id={@id}&name={@sect}"
-	child-window-options="" value="images/icons/help_24.png" style="image" text="Help">
+	child-window-options="" value="images/icons/help_16.png" style="image" text="Help">
     </v:button>
-</span>
+  </div>
 </xsl:template>
 
 <xsl:template match="vm:url">
diff --git a/binsrc/yacutia/yacutia_styles_sample.htm b/binsrc/yacutia/yacutia_styles_sample.htm
index 90127ab..0b6aab1 100644
--- a/binsrc/yacutia/yacutia_styles_sample.htm
+++ b/binsrc/yacutia/yacutia_styles_sample.htm
@@ -1,6 +1,6 @@
 <!--
  -
- -  $Id: yacutia_styles_sample.htm,v 1.1.1.1.2.2 2009/08/28 13:05:27 source Exp $
+ -  $Id: yacutia_styles_sample.htm,v 1.1.1.1.2.3 2010/09/20 10:17:00 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
diff --git a/binsrc/yacutia/yacutia_vdir_style.css b/binsrc/yacutia/yacutia_vdir_style.css
index 853b31b..2ca7adb 100644
--- a/binsrc/yacutia/yacutia_vdir_style.css
+++ b/binsrc/yacutia/yacutia_vdir_style.css
@@ -1,5 +1,5 @@
 /*
- *  $Id: yacutia_vdir_style.css,v 1.2.2.1 2009/08/27 22:43:50 source Exp $
+ *  $Id: yacutia_vdir_style.css,v 1.2.2.2 2010/09/20 10:17:00 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/configure b/configure
index 797e229..5bf846b 100755
--- a/configure
+++ b/configure
@@ -1,21 +1,25 @@
 #! /bin/sh
 # From configure.in Id: configure.in.
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for Virtuoso Open Source Edition 6.1.2.
+# Generated by GNU Autoconf 2.65 for Virtuoso Open Source Edition 6.1.3.
 #
 # Report bugs to <vos.admin at openlinksw.com>.
 #
+#
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+#
+#
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -23,23 +27,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
 as_nl='
 '
 export as_nl
@@ -47,7 +43,13 @@ export as_nl
 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
   as_echo='printf %s\n'
   as_echo_n='printf %s'
 else
@@ -58,7 +60,7 @@ else
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
 	expr "X$arg" : "X\\(.*\\)$as_nl";
 	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -81,13 +83,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
 
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
@@ -97,15 +92,15 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -117,12 +112,16 @@ if test "x$as_myself" = x; then
 fi
 if test ! -f "$as_myself"; then
   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
@@ -134,7 +133,249 @@ export LC_ALL
 LANGUAGE=C
 export LANGUAGE
 
-# Required to use basename.
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     # Try only shells that exist, to save several forks.
+	     as_shell=$as_dir/$as_base
+	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+	   done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  # We cannot yet assume a decent shell, so we have to provide a
+	# neutralization value for shells without unset; and this also
+	# works around shells that cannot unset nonexistent variables.
+	BASH_ENV=/dev/null
+	ENV=/dev/null
+	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+	export CONFIG_SHELL
+	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf at gnu.org and
+$0: vos.admin at openlinksw.com about your system, including
+$0: any error possibly output before this message. Then
+$0: install a modern shell, or manually run the script
+$0: under such a shell if you do have one."
+  fi
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$?; test $as_status -eq 0 && as_status=1
+  if test "$3"; then
+    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+  fi
+  $as_echo "$as_me: error: $1" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -148,8 +389,12 @@ else
   as_basename=false
 fi
 
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
 
-# Name of the executable.
 as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
@@ -169,409 +414,120 @@ $as_echo X/"$0" |
 	  }
 	  s/.*/./; q'`
 
-# CDPATH.
-$as_unset CDPATH
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
 
-if test "x$CONFIG_SHELL" = x; then
-  if (eval ":") 2>/dev/null; then
-  as_have_required=yes
-else
-  as_have_required=no
-fi
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
-  if test $as_have_required = yes &&	 (eval ":
-(as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
 }
 
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
 
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
 fi
-
-if as_func_ret_success; then
-  :
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
 else
-  exitcode=1
-  echo as_func_ret_success failed.
+  as_ln_s='cp -p'
 fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
 
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
 fi
 
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
 else
-  exitcode=1
-  echo positional parameters were not saved.
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+	test -d "$1/.";
+      else
+	case $1 in #(
+	-*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
 fi
+as_executable_p=$as_test_x
 
-test \$exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=\$LINENO
-  as_lineno_2=\$LINENO
-  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
-  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
-  :
-else
-  as_candidate_shells=
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  case $as_dir in
-	 /*)
-	   for as_base in sh bash ksh sh5; do
-	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
-	   done;;
-       esac
-done
-IFS=$as_save_IFS
-
-
-      for as_shell in $as_candidate_shells $SHELL; do
-	 # Try only shells that exist, to save several forks.
-	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-		{ ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-_ASEOF
-}; then
-  CONFIG_SHELL=$as_shell
-	       as_have_required=yes
-	       if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-(as_func_return () {
-  (exit $1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
-  break
-fi
-
-fi
-
-      done
-
-      if test "x$CONFIG_SHELL" != x; then
-  for as_var in BASH_ENV ENV
-	do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-	done
-	export CONFIG_SHELL
-	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
-    if test $as_have_required = no; then
-  echo This script requires a shell more modern than all the
-      echo shells that I found on your system.  Please install a
-      echo modern shell, or manually run the script under such a
-      echo shell if you do have one.
-      { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
-  echo No shell found that supports shell functions.
-  echo Please tell bug-autoconf at gnu.org about your system,
-  echo including any error possibly output before this message.
-  echo This can help us improve future autoconf versions.
-  echo Configuration will now proceed without shell functions.
-}
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
-  case `echo 'x\c'` in
-  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
-  if ln -s conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s='ln -s'
-    # ... but there are two gotchas:
-    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
-    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
-  elif ln conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s=ln
-  else
-    as_ln_s='cp -p'
-  fi
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
 
@@ -723,7 +679,8 @@ fi
 
 
 
-exec 7<&0 </dev/null 6>&1
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
 
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
@@ -741,14 +698,14 @@ cross_compiling=no
 subdirs=
 MFLAGS=
 MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
 
 # Identity of this package.
 PACKAGE_NAME='Virtuoso Open Source Edition'
 PACKAGE_TARNAME='virtuoso-opensource'
-PACKAGE_VERSION='6.1.2'
-PACKAGE_STRING='Virtuoso Open Source Edition 6.1.2'
+PACKAGE_VERSION='6.1.3'
+PACKAGE_STRING='Virtuoso Open Source Edition 6.1.3'
 PACKAGE_BUGREPORT='vos.admin at openlinksw.com'
+PACKAGE_URL=''
 
 ac_unique_file="libsrc/Dk.h"
 ac_default_prefix=/usr/local/virtuoso-opensource
@@ -1036,6 +993,7 @@ bindir
 program_transform_name
 prefix
 exec_prefix
+PACKAGE_URL
 PACKAGE_BUGREPORT
 PACKAGE_STRING
 PACKAGE_VERSION
@@ -1076,6 +1034,7 @@ enable_python
 enable_ruby
 with_internal_zlib
 with_malloc_debug
+with_mtx_debug
 with_pthreads
 with_crosspkgdir
 enable_aio
@@ -1219,8 +1178,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1246,8 +1204,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1451,8 +1408,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1468,8 +1424,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1499,17 +1454,17 @@ do
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
     x_libraries=$ac_optarg ;;
 
-  -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; }
+  -*) as_fn_error "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information."
     ;;
 
   *=*)
     ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
-   { (exit 1); exit 1; }; }
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error "invalid variable name: \`$ac_envvar'" ;;
+    esac
     eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
 
@@ -1526,15 +1481,13 @@ done
 
 if test -n "$ac_prev"; then
   ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  { $as_echo "$as_me: error: missing argument to $ac_option" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "missing argument to $ac_option"
 fi
 
 if test -n "$ac_unrecognized_opts"; then
   case $enable_option_checking in
     no) ;;
-    fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
-   { (exit 1); exit 1; }; } ;;
+    fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
     *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
   esac
 fi
@@ -1557,8 +1510,7 @@ do
     [\\/$]* | ?:[\\/]* )  continue;;
     NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
-  { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -1588,11 +1540,9 @@ test "$silent" = yes && exec 6>/dev/null
 ac_pwd=`pwd` && test -n "$ac_pwd" &&
 ac_ls_di=`ls -di .` &&
 ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  { $as_echo "$as_me: error: working directory cannot be determined" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "working directory cannot be determined"
 test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "pwd does not report name of working directory"
 
 
 # Find the source files, if location was not specified.
@@ -1631,13 +1581,11 @@ else
 fi
 if test ! -r "$srcdir/$ac_unique_file"; then
   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
 fi
 ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
 ac_abs_confdir=`(
-	cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
-   { (exit 1); exit 1; }; }
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
 	pwd)`
 # When building in place, set srcdir=.
 if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1663,7 +1611,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures Virtuoso Open Source Edition 6.1.2 to adapt to many kinds of systems.
+\`configure' configures Virtuoso Open Source Edition 6.1.3 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1734,7 +1682,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of Virtuoso Open Source Edition 6.1.2:";;
+     short | recursive ) echo "Configuration of Virtuoso Open Source Edition 6.1.3:";;
    esac
   cat <<\_ACEOF
 
@@ -1825,6 +1773,7 @@ Optional Packages:
   --with-internal-zlib    use internal zlib library (default)
   --without-internal-zlib use external zlib support
   --with-malloc-debug     extra malloc debugging code
+  --with-mtx-debug        extra mutex debugging code
   --with-pthreads         build pthread implementation if possible
   --with-crosspkgdir=/path/to/pkg-config/dir
   --with-libs='lib1 ...'  link against additional libs
@@ -1844,7 +1793,7 @@ Some influential environment variables:
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
   LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
   YACC        The `Yet Another C Compiler' implementation to use. Defaults to
@@ -1919,815 +1868,1461 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-Virtuoso Open Source Edition configure 6.1.2
-generated by GNU Autoconf 2.63
+Virtuoso Open Source Edition configure 6.1.3
+generated by GNU Autoconf 2.65
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 2009 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
   exit
 fi
-cat >config.log <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by Virtuoso Open Source Edition $as_me 6.1.2, which was
-generated by GNU Autoconf 2.63.  Invocation command line was
 
-  $ $0 $@
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
 
-_ACEOF
-exec 5>>config.log
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
 {
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
 
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+} # ac_fn_c_try_compile
 
-/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
-/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
-/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-_ASUNAME
+    ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
 
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  $as_echo "PATH: $as_dir"
-done
-IFS=$as_save_IFS
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
+} # ac_fn_c_try_cpp
 
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
 _ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
 
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
-  for ac_arg
-  do
-    case $ac_arg in
-    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-    | -silent | --silent | --silen | --sile | --sil)
-      continue ;;
-    *\'*)
-      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    case $ac_pass in
-    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
-    2)
-      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
-      if test $ac_must_keep_next = true; then
-	ac_must_keep_next=false # Got value, back to normal.
-      else
-	case $ac_arg in
-	  *=* | --config-cache | -C | -disable-* | --disable-* \
-	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-	  | -with-* | --with-* | -without-* | --without-* | --x)
-	    case "$ac_configure_args0 " in
-	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-	    esac
-	    ;;
-	  -* ) ac_must_keep_next=true ;;
-	esac
-      fi
-      ac_configure_args="$ac_configure_args '$ac_arg'"
-      ;;
-    esac
-  done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log.  We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
-  # Save into config.log some information that might help in debugging.
-  {
-    echo
-
-    cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
-    echo
-    # The following way of writing the cache mishandles newlines in values,
-(
-  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) $as_unset $ac_var ;;
-      esac ;;
-    esac
-  done
-  (set) 2>&1 |
-    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
-      sed -n \
-	"s/'\''/'\''\\\\'\'''\''/g;
-	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
-      ;; #(
-    *)
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-      ;;
-    esac |
-    sort
-)
-    echo
-
-    cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( cat <<\_ASBOX
+## --------------------------------------- ##
+## Report this to vos.admin at openlinksw.com ##
+## --------------------------------------- ##
 _ASBOX
-    echo
-    for ac_var in $ac_subst_vars
-    do
-      eval ac_val=\$$ac_var
-      case $ac_val in
-      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-      esac
-      $as_echo "$ac_var='\''$ac_val'\''"
-    done | sort
-    echo
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
-    if test -n "$ac_subst_files"; then
-      cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
-_ASBOX
-      echo
-      for ac_var in $ac_subst_files
-      do
-	eval ac_val=\$$ac_var
-	case $ac_val in
-	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-	esac
-	$as_echo "$ac_var='\''$ac_val'\''"
-      done | sort
-      echo
-    fi
+} # ac_fn_c_check_header_mongrel
 
-    if test -s confdefs.h; then
-      cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
-      echo
-      cat confdefs.h
-      echo
-    fi
-    test "$ac_signal" != 0 &&
-      $as_echo "$as_me: caught signal $ac_signal"
-    $as_echo "$as_me: exit $exit_status"
-  } >&5
-  rm -f core *.core core.conftest.* &&
-    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
-    exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
 
-# Predefined preprocessor variables.
+} # ac_fn_c_try_run
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
 _ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
+} # ac_fn_c_check_header_compile
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
+} # ac_fn_c_try_link
 
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if test "$cross_compiling" = yes; then
+    # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+  ;
+  return 0;
+}
 _ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid; break
+else
+  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0
 
-# Let the site file select an alternate cache file if it wants to.
-# Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
-if test -n "$CONFIG_SITE"; then
-  ac_site_file1=$CONFIG_SITE
-elif test "x$prefix" != xNONE; then
-  ac_site_file1=$prefix/share/config.site
-  ac_site_file2=$prefix/etc/config.site
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=$ac_mid; break
 else
-  ac_site_file1=$ac_default_prefix/share/config.site
-  ac_site_file2=$ac_default_prefix/etc/config.site
+  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
 fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
-do
-  test "x$ac_site_file" = xNONE && continue
-  if test -r "$ac_site_file"; then
-    { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-$as_echo "$as_me: loading site script $ac_site_file" >&6;}
-    sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file"
-  fi
-done
-
-if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special
-  # files actually), so we avoid doing that.
-  if test -f "$cache_file"; then
-    { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
-    case $cache_file in
-      [\\/]* | ?:[\\/]* ) . "$cache_file";;
-      *)                      . "./$cache_file";;
-    esac
-  fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
 else
-  { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
-  >$cache_file
+  ac_lo= ac_hi=
 fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
-  eval ac_old_set=\$ac_cv_env_${ac_var}_set
-  eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val=\$ac_cv_env_${ac_var}_value
-  eval ac_new_val=\$ac_env_${ac_var}_value
-  case $ac_old_set,$ac_new_set in
-    set,)
-      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,set)
-      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,);;
-    *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
-	# differences in whitespace do not lead to failure.
-	ac_old_val_w=`echo x $ac_old_val`
-	ac_new_val_w=`echo x $ac_new_val`
-	if test "$ac_old_val_w" != "$ac_new_val_w"; then
-	  { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-	  ac_cache_corrupted=:
-	else
-	  { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
-	  eval $ac_var=\$ac_old_val
-	fi
-	{ $as_echo "$as_me:$LINENO:   former value:  \`$ac_old_val'" >&5
-$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
-	{ $as_echo "$as_me:$LINENO:   current value: \`$ac_new_val'" >&5
-$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
-      fi;;
-  esac
-  # Pass precious variables to config.status.
-  if test "$ac_new_set" = set; then
-    case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-    *) ac_arg=$ac_var=$ac_new_val ;;
-    esac
-    case " $ac_configure_args " in
-      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-    esac
-  fi
-done
-if $ac_cache_corrupted; then
-  { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-  { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
-   { (exit 1); exit 1; }; }
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid
+else
+  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+  else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
 
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (($2) < 0)
+    {
+      long int i = longval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+  ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
 
+  fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
 
+} # ac_fn_c_compute_int
 
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
 
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
 
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
 
+#undef $2
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
 
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
+} # ac_fn_c_check_func
 
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+	 return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+	    return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
 
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
+} # ac_fn_c_check_type
 
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  eval "$4=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$4
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
+} # ac_fn_c_check_member
 
+# ac_fn_c_check_decl LINENO SYMBOL VAR
+# ------------------------------------
+# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
+ac_fn_c_check_decl ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
+$as_echo_n "checking whether $2 is declared... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+#ifndef $2
+  (void) $2;
+#endif
 
-
-
-
-
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-ac_aux_dir=
-for ac_dir in binsrc/config "$srcdir"/binsrc/config; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in binsrc/config \"$srcdir\"/binsrc/config" >&5
-$as_echo "$as_me: error: cannot find install-sh or install.sh in binsrc/config \"$srcdir\"/binsrc/config" >&2;}
-   { (exit 1); exit 1; }; }
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+} # ac_fn_c_check_decl
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by Virtuoso Open Source Edition $as_me 6.1.3, which was
+generated by GNU Autoconf 2.65.  Invocation command line was
 
+  $ $0 $@
 
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
 
-ac_config_headers="$ac_config_headers libsrc/Dk/config.h"
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
 
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
 
-am__api_version='1.11'
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
 
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
-  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
-  /usr/ucb/* ) ;;
-  *)
-    # OSF1 and SCO ODT 3.0 have their own names for install.
-    # Don't use installbsd from OSF since it installs stuff as root
-    # by default.
-    for ac_prog in ginstall scoinst install; do
-      for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
-	  if test $ac_prog = install &&
-	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # AIX install.  It has an incompatible calling convention.
-	    :
-	  elif test $ac_prog = install &&
-	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # program-specific install script used by HP pwplus--don't use.
-	    :
-	  else
-	    rm -rf conftest.one conftest.two conftest.dir
-	    echo one > conftest.one
-	    echo two > conftest.two
-	    mkdir conftest.dir
-	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
-	      test -s conftest.one && test -s conftest.two &&
-	      test -s conftest.dir/conftest.one &&
-	      test -s conftest.dir/conftest.two
-	    then
-	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-	      break 3
-	    fi
-	  fi
-	fi
-      done
-    done
-    ;;
-esac
-
-done
+    $as_echo "PATH: $as_dir"
+  done
 IFS=$as_save_IFS
 
-rm -rf conftest.one conftest.two conftest.dir
-
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL=$ac_cv_path_install
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    INSTALL=$ac_install_sh
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
+} >&5
 
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+cat >&5 <<_ACEOF
 
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+## ----------- ##
+## Core tests. ##
+## ----------- ##
 
-{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5
-$as_echo_n "checking whether build environment is sane... " >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
-# Reject unsafe characters in $srcdir or the absolute working directory
-# name.  Accept space and tab only in the latter.
-am_lf='
-'
-case `pwd` in
-  *[\\\"\#\$\&\'\`$am_lf]*)
-    { { $as_echo "$as_me:$LINENO: error: unsafe absolute working directory name" >&5
-$as_echo "$as_me: error: unsafe absolute working directory name" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-case $srcdir in
-  *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    { { $as_echo "$as_me:$LINENO: error: unsafe srcdir value: \`$srcdir'" >&5
-$as_echo "$as_me: error: unsafe srcdir value: \`$srcdir'" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
+_ACEOF
 
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments.  Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$*" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$*" != "X $srcdir/configure conftest.file" \
-      && test "$*" != "X conftest.file $srcdir/configure"; then
 
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&5
-$as_echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&2;}
-   { (exit 1); exit 1; }; }
-   fi
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
 
-   test "$2" = conftest.file
-   )
-then
-   # Ok.
-   :
-else
-   { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files!
-Check your system clock" >&5
-$as_echo "$as_me: error: newly created file is older than distributed files!
-Check your system clock" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-test "$program_prefix" != NONE &&
-  program_transform_name="s&^&$program_prefix&;$program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
-  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
-# Double any \ or $.
-# By default was `s,x,x', remove it if useless.
-ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
-program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
 
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
 
-if test x"${MISSING+set}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
-  *)
-    MISSING="\${SHELL} $am_aux_dir/missing" ;;
-  esac
-fi
-# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
-else
-  am_missing_run=
-  { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
-fi
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
 
-if test x"${install_sh}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
-  *)
-    install_sh="\${SHELL} $am_aux_dir/install-sh"
-  esac
-fi
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	$as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
 
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-if test "$cross_compiling" != no; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$STRIP"; then
-  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
 done
-IFS=$as_save_IFS
+ac_signal=0
 
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
 
+$as_echo "/* confdefs.h */" > confdefs.h
 
-fi
-if test -z "$ac_cv_prog_STRIP"; then
-  ac_ct_STRIP=$STRIP
-  # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_STRIP"; then
-  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  ac_site_file1=$CONFIG_SITE
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
 else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
 do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_STRIP="strip"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
   fi
 done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    STRIP=$ac_ct_STRIP
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
   fi
 else
-  STRIP="$ac_cv_prog_STRIP"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
 fi
 
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	# differences in whitespace do not lead to failure.
+	ac_old_val_w=`echo x $ac_old_val`
+	ac_new_val_w=`echo x $ac_new_val`
+	if test "$ac_old_val_w" != "$ac_new_val_w"; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	  ac_cache_corrupted=:
+	else
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+	  eval $ac_var=\$ac_old_val
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
 
-{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
-if test -z "$MKDIR_P"; then
-  if test "${ac_cv_path_mkdir+set}" = set; then
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+ac_aux_dir=
+for ac_dir in binsrc/config "$srcdir"/binsrc/config; do
+  for ac_t in install-sh install.sh shtool; do
+    if test -f "$ac_dir/$ac_t"; then
+      ac_aux_dir=$ac_dir
+      ac_install_sh="$ac_aux_dir/$ac_t -c"
+      break 2
+    fi
+  done
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error "cannot find install-sh, install.sh, or shtool in binsrc/config \"$srcdir\"/binsrc/config" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+
+ac_config_headers="$ac_config_headers libsrc/Dk/config.h"
+
+
+am__api_version='1.11'
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in mkdir gmkdir; do
-	 for ac_exec_ext in '' $ac_executable_extensions; do
-	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
-	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
-	     'mkdir (GNU coreutils) '* | \
-	     'mkdir (coreutils) '* | \
-	     'mkdir (fileutils) '4.1*)
-	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
-	       break 3;;
-	   esac
-	 done
-       done
-done
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    rm -rf conftest.one conftest.two conftest.dir
+	    echo one > conftest.one
+	    echo two > conftest.two
+	    mkdir conftest.dir
+	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+	      test -s conftest.one && test -s conftest.two &&
+	      test -s conftest.dir/conftest.one &&
+	      test -s conftest.dir/conftest.two
+	    then
+	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	      break 3
+	    fi
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+
+  done
 IFS=$as_save_IFS
 
-fi
+rm -rf conftest.one conftest.two conftest.dir
 
-  if test "${ac_cv_path_mkdir+set}" = set; then
-    MKDIR_P="$ac_cv_path_mkdir -p"
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
   else
     # As a last resort, use the slow shell script.  Don't cache a
-    # value for MKDIR_P within a source directory, because that will
+    # value for INSTALL within a source directory, because that will
     # break other packages using the cache if that directory is
     # removed, or if the value is a relative name.
-    test -d ./--version && rmdir ./--version
-    MKDIR_P="$ac_install_sh -d"
+    INSTALL=$ac_install_sh
   fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-$as_echo "$MKDIR_P" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
 
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
-  [\\/$]* | ?:[\\/]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[\\\"\#\$\&\'\`$am_lf]*)
+    as_fn_error "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+  *[\\\"\#\$\&\'\`$am_lf\ \	]*)
+    as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
 esac
 
-for ac_prog in gawk mawk nawk awk
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$AWK"; then
-  ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AWK="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
 
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
-  { $as_echo "$as_me:$LINENO: result: $AWK" >&5
-$as_echo "$AWK" >&6; }
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      as_fn_error "ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+   as_fn_error "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
 
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
 
-  test -n "$AWK" && break
-done
-
-{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+  if test "${ac_cv_path_mkdir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in mkdir gmkdir; do
+	 for ac_exec_ext in '' $ac_executable_extensions; do
+	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+	     'mkdir (GNU coreutils) '* | \
+	     'mkdir (coreutils) '* | \
+	     'mkdir (fileutils) '4.1*)
+	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+	       break 3;;
+	   esac
+	 done
+       done
+  done
+IFS=$as_save_IFS
+
+fi
+
+  test -d ./--version && rmdir ./--version
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -2745,11 +3340,11 @@ esac
 rm -f conftest.make
 fi
 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
   SET_MAKE=
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
   SET_MAKE="MAKE=${MAKE-make}"
 fi
@@ -2769,9 +3364,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then
   am__isrc=' -I$(srcdir)'
   # test to see if srcdir already configured
   if test -f $srcdir/config.status; then
-    { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
-$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
   fi
 fi
 
@@ -2787,7 +3380,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='virtuoso-opensource'
- VERSION='6.1.2'
+ VERSION='6.1.3'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2822,7 +3415,7 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 AMTAR=${AMTAR-"${am_missing_run}tar"}
 
 
-{ $as_echo "$as_me:$LINENO: checking how to create a ustar tar archive" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5
 $as_echo_n "checking how to create a ustar tar archive... " >&6; }
 # Loop over all known methods to create a tar archive until one works.
 _am_tools='gnutar plaintar pax cpio none'
@@ -2895,13 +3488,13 @@ do
 done
 rm -rf conftest.dir
 
-if test "${am_cv_prog_tar_ustar+set}" = set; then
+if test "${am_cv_prog_tar_ustar+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   am_cv_prog_tar_ustar=$_am_tool
 fi
 
-{ $as_echo "$as_me:$LINENO: result: $am_cv_prog_tar_ustar" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5
 $as_echo "$am_cv_prog_tar_ustar" >&6; }
 
 
@@ -2910,16 +3503,16 @@ $as_echo "$am_cv_prog_tar_ustar" >&6; }
 
 
 
-{ $as_echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
     # Check whether --enable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then
+if test "${enable_maintainer_mode+set}" = set; then :
   enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
 else
   USE_MAINTAINER_MODE=no
 fi
 
-  { $as_echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
 $as_echo "$USE_MAINTAINER_MODE" >&6; }
    if test $USE_MAINTAINER_MODE = yes; then
   MAINTAINER_MODE_TRUE=
@@ -2942,35 +3535,27 @@ fi
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
-{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then
+if test "${ac_cv_build+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_build_alias=$build_alias
 test "x$ac_build_alias" = x &&
   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
 test "x$ac_build_alias" = x &&
-  { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-$as_echo "$as_me: error: invalid value of canonical build" >&2;}
-   { (exit 1); exit 1; }; };;
+*) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -2986,28 +3571,24 @@ IFS=$ac_save_IFS
 case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 
-{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
 $as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then
+if test "${ac_cv_host+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$host_alias" = x; then
   ac_cv_host=$ac_cv_build
 else
   ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
 fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-$as_echo "$as_me: error: invalid value of canonical host" >&2;}
-   { (exit 1); exit 1; }; };;
+*) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -3073,11 +3654,11 @@ chmod +x config.nice
 ##########################################################################
 
 
-{ $as_echo "$as_me:$LINENO: checking for Virtuoso installation layout" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Virtuoso installation layout" >&5
 $as_echo_n "checking for Virtuoso installation layout... " >&6; }
 
 # Check whether --with-layout was given.
-if test "${with_layout+set}" = set; then
+if test "${with_layout+set}" = set; then :
   withval=$with_layout;  case "${withval}" in
     yes|no)	VIRTUOSO_LAYOUT=unset ;;
     *)		VIRTUOSO_LAYOUT=${withval} ;;
@@ -3214,17 +3795,15 @@ case ${VIRTUOSO_LAYOUT} in
 	;;
 
   *)							# UNKNOWN
-  	{ $as_echo "$as_me:$LINENO: result: unknown" >&5
+  	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
 $as_echo "unknown" >&6; }
 	echo ""
 	echo "  Supported layouts:      Debian FreeBSD GNU OpenLink opt RedHat"
 	echo ""
-	{ { $as_echo "$as_me:$LINENO: error: unable to continue" >&5
-$as_echo "$as_me: error: unable to continue" >&2;}
-   { (exit 1); exit 1; }; }
+	as_fn_error "unable to continue" "$LINENO" 5
 	;;
 esac
-{ $as_echo "$as_me:$LINENO: result: ${virtuoso_layout}" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${virtuoso_layout}" >&5
 $as_echo "${virtuoso_layout}" >&6; }
 
 
@@ -3263,9 +3842,9 @@ INCDIR=$TOP/include
 #actually prefer /lib/cpp : it's to be run on Java
 # Extract the first word of "cpp", so it can be a program name with args.
 set dummy cpp; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CPP+set}" = set; then
+if test "${ac_cv_path_CPP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CPP in
@@ -3279,14 +3858,14 @@ for as_dir in $as_dummy
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CPP="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   test -z "$ac_cv_path_CPP" && ac_cv_path_CPP="/lib/cpp"
@@ -3295,10 +3874,10 @@ esac
 fi
 CPP=$ac_cv_path_CPP
 if test -n "$CPP"; then
-  { $as_echo "$as_me:$LINENO: result: $CPP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
 $as_echo "$CPP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -3312,9 +3891,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3325,24 +3904,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -3352,9 +3931,9 @@ if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -3365,24 +3944,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="gcc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
 $as_echo "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -3391,7 +3970,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -3405,9 +3984,9 @@ if test -z "$CC"; then
           if test -n "$ac_tool_prefix"; then
     # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3418,24 +3997,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -3445,9 +4024,9 @@ fi
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3459,18 +4038,18 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
      fi
     ac_cv_prog_CC="cc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 if test $ac_prog_rejected = yes; then
@@ -3489,10 +4068,10 @@ fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -3504,9 +4083,9 @@ if test -z "$CC"; then
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -3517,24 +4096,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -3548,9 +4127,9 @@ if test -z "$CC"; then
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -3561,24 +4140,24 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
 $as_echo "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -3591,7 +4170,7 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -3602,57 +4181,37 @@ fi
 fi
 
 
-test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error "no acceptable C compiler found in \$PATH
+See \`config.log' for more details." "$LINENO" 5; }
 
 # Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
 set X $ac_compile
 ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
 
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3668,8 +4227,8 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
 ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
 
 # The possible output files:
@@ -3685,17 +4244,17 @@ do
 done
 rm -f $ac_rmfiles
 
-if { (ac_try="$ac_link_default"
+if { { ac_try="$ac_link_default"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_link_default") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
 # So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
 # in a Makefile.  We should not override ac_cv_exeext if it was cached,
@@ -3712,7 +4271,7 @@ do
 	# certainly right.
 	break;;
     *.* )
-        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
 	then :; else
 	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
 	fi
@@ -3731,84 +4290,42 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
 else
   ac_file=''
 fi
-
-{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-if test -z "$ac_file"; then
-  $as_echo "$as_me: failed program was:" >&5
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
+{ as_fn_set_status 77
+as_fn_error "C compiler cannot create executables
+See \`config.log' for more details." "$LINENO" 5; }; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 fi
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
 ac_exeext=$ac_cv_exeext
 
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
-  if { ac_try='./$ac_file'
-  { (case "(($ac_try" in
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-	cross_compiling=yes
-    else
-	{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-    fi
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   # If both `conftest.exe' and `conftest' are `present' (well, observable)
 # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
 # work properly (i.e., refer to `conftest.exe'), while it won't with
@@ -3823,32 +4340,83 @@ for ac_file in conftest.exe conftest conftest.*; do
   esac
 done
 else
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." "$LINENO" 5; }
 fi
-
-rm -f conftest$ac_cv_exeext
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
 $as_echo "$ac_cv_exeext" >&6; }
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." "$LINENO" 5; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then
+if test "${ac_cv_objext+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3860,17 +4428,17 @@ main ()
 }
 _ACEOF
 rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
+if { { ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_compile") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   for ac_file in conftest.o conftest.obj conftest.*; do
   test -f "$ac_file" || continue;
   case $ac_file in
@@ -3883,31 +4451,23 @@ else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." "$LINENO" 5; }
 fi
-
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
 $as_echo "$ac_cv_objext" >&6; }
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3921,37 +4481,16 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_compiler_gnu=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
+  ac_compiler_gnu=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
 $as_echo "$ac_cv_c_compiler_gnu" >&6; }
 if test $ac_compiler_gnu = yes; then
   GCC=yes
@@ -3960,20 +4499,16 @@ else
 fi
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
+if test "${ac_cv_prog_cc_g+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
    ac_c_werror_flag=yes
    ac_cv_prog_cc_g=no
    CFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3984,35 +4519,11 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_prog_cc_g=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	CFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -4023,36 +4534,12 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
 
-	ac_c_werror_flag=$ac_save_c_werror_flag
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
 	 CFLAGS="-g"
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -4063,42 +4550,17 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_prog_cc_g=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    ac_c_werror_flag=$ac_save_c_werror_flag
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
 $as_echo "$ac_cv_prog_cc_g" >&6; }
 if test "$ac_test_CFLAGS" = set; then
   CFLAGS=$ac_save_CFLAGS
@@ -4115,18 +4577,14 @@ else
     CFLAGS=
   fi
 fi
-{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
 ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
@@ -4183,32 +4641,9 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
 	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
 do
   CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_prog_cc_c89=$ac_arg
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext
   test "x$ac_cv_prog_cc_c89" != "xno" && break
 done
@@ -4219,17 +4654,19 @@ fi
 # AC_CACHE_VAL
 case "x$ac_cv_prog_cc_c89" in
   x)
-    { $as_echo "$as_me:$LINENO: result: none needed" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
 $as_echo "none needed" >&6; } ;;
   xno)
-    { $as_echo "$as_me:$LINENO: result: unsupported" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
 $as_echo "unsupported" >&6; } ;;
   *)
     CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
 esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
 
+fi
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -4248,7 +4685,7 @@ am__doit:
 .PHONY: am__doit
 END
 # If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
 $as_echo_n "checking for style of include used by $am_make... " >&6; }
 am__include="#"
 am__quote=
@@ -4276,12 +4713,12 @@ if test "$am__include" = "#"; then
 fi
 
 
-{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
 $as_echo "$_am_result" >&6; }
 rm -f confinc confmf
 
 # Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then
+if test "${enable_dependency_tracking+set}" = set; then :
   enableval=$enable_dependency_tracking;
 fi
 
@@ -4301,9 +4738,9 @@ fi
 
 depcc="$CC"   am_compiler_list=
 
-{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -4411,7 +4848,7 @@ else
 fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
 
@@ -4427,22 +4864,18 @@ fi
 
 
 if test "x$CC" != xcc; then
-  { $as_echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
 else
-  { $as_echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
 $as_echo_n "checking whether cc understands -c and -o together... " >&6; }
 fi
 set dummy $CC; ac_cc=`$as_echo "$2" |
 		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then
+if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -4458,63 +4891,63 @@ _ACEOF
 # existing .o file with -o, though they will create one.
 ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
 rm -f conftest2.*
-if { (case "(($ac_try" in
+if { { case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-   test -f conftest2.$ac_objext && { (case "(($ac_try" in
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } &&
+   test -f conftest2.$ac_objext && { { case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); };
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; };
 then
   eval ac_cv_prog_cc_${ac_cc}_c_o=yes
   if test "x$CC" != xcc; then
     # Test first that cc exists at all.
     if { ac_try='cc -c conftest.$ac_ext >&5'
-  { (case "(($ac_try" in
+  { { case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
       ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
       rm -f conftest2.*
-      if { (case "(($ac_try" in
+      if { { case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 test -f conftest2.$ac_objext && { (case "(($ac_try" in
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } &&
+	 test -f conftest2.$ac_objext && { { case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); };
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; };
       then
 	# cc works too.
 	:
@@ -4531,15 +4964,13 @@ rm -f core conftest*
 
 fi
 if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
-cat >>confdefs.h <<\_ACEOF
-#define NO_MINUS_C_MINUS_O 1
-_ACEOF
+$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
 
 fi
  			ac_ext=c
@@ -4548,9 +4979,9 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then
+if test "${ac_cv_path_SED+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
             ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -4558,7 +4989,7 @@ else
        ac_script="$ac_script$as_nl$ac_script"
      done
      echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
-     $as_unset ac_script || ac_script=
+     { ac_script=; unset ac_script;}
      if test -z "$SED"; then
   ac_path_SED_found=false
   # Loop through the user's path and test for each of PROGNAME-LIST
@@ -4567,7 +4998,7 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in sed gsed; do
+    for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
       { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
@@ -4587,7 +5018,7 @@ case `"$ac_path_SED" --version 2>&1` in
     $as_echo '' >> "conftest.nl"
     "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_SED_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_SED="$ac_path_SED"
@@ -4602,19 +5033,17 @@ esac
       $ac_path_SED_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_SED"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5
-$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5
   fi
 else
   ac_cv_path_SED=$SED
 fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
 $as_echo "$ac_cv_path_SED" >&6; }
  SED="$ac_cv_path_SED"
   rm -f conftest.sed
@@ -4632,9 +5061,9 @@ Xsed="$SED -e 1s/^X//"
 
 
 
-{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
+if test "${ac_cv_path_GREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$GREP"; then
@@ -4645,7 +5074,7 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in grep ggrep; do
+    for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
       { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
@@ -4665,7 +5094,7 @@ case `"$ac_path_GREP" --version 2>&1` in
     $as_echo 'GREP' >> "conftest.nl"
     "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_GREP_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_GREP="$ac_path_GREP"
@@ -4680,26 +5109,24 @@ esac
       $ac_path_GREP_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_GREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_GREP=$GREP
 fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
 $as_echo "$ac_cv_path_GREP" >&6; }
  GREP="$ac_cv_path_GREP"
 
 
-{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
+if test "${ac_cv_path_EGREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -4713,7 +5140,7 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in egrep; do
+    for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
       { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
@@ -4733,7 +5160,7 @@ case `"$ac_path_EGREP" --version 2>&1` in
     $as_echo 'EGREP' >> "conftest.nl"
     "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_EGREP_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_EGREP="$ac_path_EGREP"
@@ -4748,12 +5175,10 @@ esac
       $ac_path_EGREP_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_EGREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_EGREP=$EGREP
@@ -4761,14 +5186,14 @@ fi
 
    fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
 $as_echo "$ac_cv_path_EGREP" >&6; }
  EGREP="$ac_cv_path_EGREP"
 
 
-{ $as_echo "$as_me:$LINENO: checking for fgrep" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
 $as_echo_n "checking for fgrep... " >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then
+if test "${ac_cv_path_FGREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
@@ -4782,7 +5207,7 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in fgrep; do
+    for ac_prog in fgrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
       { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
@@ -4802,7 +5227,7 @@ case `"$ac_path_FGREP" --version 2>&1` in
     $as_echo 'FGREP' >> "conftest.nl"
     "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_FGREP_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_FGREP="$ac_path_FGREP"
@@ -4817,12 +5242,10 @@ esac
       $ac_path_FGREP_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_FGREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_FGREP=$FGREP
@@ -4830,7 +5253,7 @@ fi
 
    fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
 $as_echo "$ac_cv_path_FGREP" >&6; }
  FGREP="$ac_cv_path_FGREP"
 
@@ -4856,7 +5279,7 @@ test -z "$GREP" && GREP=grep
 
 
 # Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then
+if test "${with_gnu_ld+set}" = set; then :
   withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
 else
   with_gnu_ld=no
@@ -4865,7 +5288,7 @@ fi
 ac_prog=ld
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
-  { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
 $as_echo_n "checking for ld used by $CC... " >&6; }
   case $host in
   *-*-mingw*)
@@ -4895,13 +5318,13 @@ $as_echo_n "checking for ld used by $CC... " >&6; }
     ;;
   esac
 elif test "$with_gnu_ld" = yes; then
-  { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
 $as_echo_n "checking for GNU ld... " >&6; }
 else
-  { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
 $as_echo_n "checking for non-GNU ld... " >&6; }
 fi
-if test "${lt_cv_path_LD+set}" = set; then
+if test "${lt_cv_path_LD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
@@ -4932,18 +5355,16 @@ fi
 
 LD="$lt_cv_path_LD"
 if test -n "$LD"; then
-  { $as_echo "$as_me:$LINENO: result: $LD" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
 $as_echo "$LD" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
-$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
-   { (exit 1); exit 1; }; }
-{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU lds only accept -v.
@@ -4956,7 +5377,7 @@ case `$LD -v 2>&1 </dev/null` in
   ;;
 esac
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
 $as_echo "$lt_cv_prog_gnu_ld" >&6; }
 with_gnu_ld=$lt_cv_prog_gnu_ld
 
@@ -4983,14 +5404,14 @@ ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
 $as_echo_n "checking how to run the C preprocessor... " >&6; }
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then
+  if test "${ac_cv_prog_CPP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -5005,11 +5426,7 @@ do
   # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifdef __STDC__
 # include <limits.h>
@@ -5018,78 +5435,34 @@ cat >>conftest.$ac_ext <<_ACEOF
 #endif
 		     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"; then :
 
+else
   # Broken: fails on valid input.
 continue
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+if ac_fn_c_try_cpp "$LINENO"; then :
   # Broken: success on invalid input.
 continue
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
   # Passes both tests.
 ac_preproc_ok=:
 break
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
 rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
+if $ac_preproc_ok; then :
   break
 fi
 
@@ -5101,7 +5474,7 @@ fi
 else
   ac_cv_prog_CPP=$CPP
 fi
-{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
 $as_echo "$CPP" >&6; }
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
@@ -5112,11 +5485,7 @@ do
   # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifdef __STDC__
 # include <limits.h>
@@ -5125,87 +5494,40 @@ cat >>conftest.$ac_ext <<_ACEOF
 #endif
 		     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"; then :
 
+else
   # Broken: fails on valid input.
 continue
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+if ac_fn_c_try_cpp "$LINENO"; then :
   # Broken: success on invalid input.
 continue
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
   # Passes both tests.
 ac_preproc_ok=:
 break
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
 rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
+if $ac_preproc_ok; then :
+
 else
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -5215,16 +5537,12 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
+if test "${ac_cv_header_stdc+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 #include <stdarg.h>
@@ -5239,48 +5557,23 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_header_stdc=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_header_stdc=no
+  ac_cv_header_stdc=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <string.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
@@ -5290,18 +5583,14 @@ fi
 
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
+  $EGREP "free" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
@@ -5311,14 +5600,10 @@ fi
 
 if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   :
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ctype.h>
 #include <stdlib.h>
@@ -5345,261 +5630,46 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_run "$LINENO"; then :
 
-( exit $ac_status )
-ac_cv_header_stdc=no
+else
+  ac_cv_header_stdc=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
 $as_echo "$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
 # On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
 
+fi
 
+done
 
 
 
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-		  inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-  if test "${ac_cv_header_minix_config_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
-$as_echo_n "checking for minix/config.h... " >&6; }
-if test "${ac_cv_header_minix_config_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
-$as_echo "$ac_cv_header_minix_config_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5
-$as_echo_n "checking minix/config.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <minix/config.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5
-$as_echo_n "checking minix/config.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <minix/config.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: minix/config.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
-$as_echo_n "checking for minix/config.h... " >&6; }
-if test "${ac_cv_header_minix_config_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_minix_config_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
-$as_echo "$ac_cv_header_minix_config_h" >&6; }
-
-fi
-if test "x$ac_cv_header_minix_config_h" = x""yes; then
+  ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
+if test "x$ac_cv_header_minix_config_h" = x""yes; then :
   MINIX=yes
 else
   MINIX=
@@ -5608,34 +5678,23 @@ fi
 
   if test "$MINIX" = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_SOURCE 1
-_ACEOF
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_1_SOURCE 2
-_ACEOF
+$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define _MINIX 1
-_ACEOF
+$as_echo "#define _MINIX 1" >>confdefs.h
 
   fi
 
 
-
-  { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
-if test "${ac_cv_safe_to_define___extensions__+set}" = set; then
+if test "${ac_cv_safe_to_define___extensions__+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #	  define __EXTENSIONS__ 1
@@ -5648,69 +5707,35 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_safe_to_define___extensions__=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_safe_to_define___extensions__=no
+  ac_cv_safe_to_define___extensions__=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
   test $ac_cv_safe_to_define___extensions__ = yes &&
-    cat >>confdefs.h <<\_ACEOF
-#define __EXTENSIONS__ 1
-_ACEOF
+    $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
 
-  cat >>confdefs.h <<\_ACEOF
-#define _ALL_SOURCE 1
-_ACEOF
+  $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
 
-  cat >>confdefs.h <<\_ACEOF
-#define _GNU_SOURCE 1
-_ACEOF
+  $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
 
-  cat >>confdefs.h <<\_ACEOF
-#define _POSIX_PTHREAD_SEMANTICS 1
-_ACEOF
+  $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
 
-  cat >>confdefs.h <<\_ACEOF
-#define _TANDEM_SOURCE 1
-_ACEOF
+  $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
 
 
-{ $as_echo "$as_me:$LINENO: checking for library containing strerror" >&5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5
 $as_echo_n "checking for library containing strerror... " >&6; }
-if test "${ac_cv_search_strerror+set}" = set; then
+if test "${ac_cv_search_strerror+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -5735,462 +5760,133 @@ for ac_lib in '' cposix; do
     ac_res=-l$ac_lib
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
-  rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+  if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_search_strerror=$ac_res
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext
-  if test "${ac_cv_search_strerror+set}" = set; then
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_strerror+set}" = set; then :
   break
 fi
 done
-if test "${ac_cv_search_strerror+set}" = set; then
-  :
+if test "${ac_cv_search_strerror+set}" = set; then :
+
 else
   ac_cv_search_strerror=no
 fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5
 $as_echo "$ac_cv_search_strerror" >&6; }
 ac_res=$ac_cv_search_strerror
-if test "$ac_res" != no; then
+if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
 
-  if test "${ac_cv_header_minix_config_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
-$as_echo_n "checking for minix/config.h... " >&6; }
-if test "${ac_cv_header_minix_config_h+set}" = set; then
+
+##########################STAGING area####################################
+##########################STAGING area####################################
+
+
+##########################################################################
+##									##
+##  Check specific C constructions 					##
+##									##
+##########################################################################
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
+if test "${ac_cv_c_bigendian+set}" = set; then :
   $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
-$as_echo "$ac_cv_header_minix_config_h" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5
-$as_echo_n "checking minix/config.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_cv_c_bigendian=unknown
+    # See if we're dealing with a universal compiler.
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <minix/config.h>
+#ifndef __APPLE_CC__
+	       not a universal capable compiler
+	     #endif
+	     typedef int dummy;
+
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
 
-	ac_header_compiler=no
+	# Check for potential -arch flags.  It is not universal unless
+	# there are at least two -arch flags with different values.
+	ac_arch=
+	ac_prev=
+	for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+	 if test -n "$ac_prev"; then
+	   case $ac_word in
+	     i?86 | x86_64 | ppc | ppc64)
+	       if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+		 ac_arch=$ac_word
+	       else
+		 ac_cv_c_bigendian=universal
+		 break
+	       fi
+	       ;;
+	   esac
+	   ac_prev=
+	 elif test "x$ac_word" = "x-arch"; then
+	   ac_prev=arch
+	 fi
+       done
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if sys/param.h defines the BYTE_ORDER macro.
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+	     #include <sys/param.h>
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5
-$as_echo_n "checking minix/config.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+int
+main ()
+{
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+		     && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+		     && LITTLE_ENDIAN)
+	      bogus endian macros
+	     #endif
+
+  ;
+  return 0;
+}
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <minix/config.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
+#include <sys/types.h>
+		#include <sys/param.h>
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+		 not big endian
+		#endif
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: minix/config.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
-$as_echo_n "checking for minix/config.h... " >&6; }
-if test "${ac_cv_header_minix_config_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_bigendian=yes
 else
-  ac_cv_header_minix_config_h=$ac_header_preproc
+  ac_cv_c_bigendian=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
-$as_echo "$ac_cv_header_minix_config_h" >&6; }
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-if test "x$ac_cv_header_minix_config_h" = x""yes; then
-  MINIX=yes
-else
-  MINIX=
-fi
-
-
-  if test "$MINIX" = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_SOURCE 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_1_SOURCE 2
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define _MINIX 1
-_ACEOF
-
-  fi
-
-
-
-  { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5
-$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
-if test "${ac_cv_safe_to_define___extensions__+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#	  define __EXTENSIONS__ 1
-	  $ac_includes_default
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_safe_to_define___extensions__=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_safe_to_define___extensions__=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5
-$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
-  test $ac_cv_safe_to_define___extensions__ = yes &&
-    cat >>confdefs.h <<\_ACEOF
-#define __EXTENSIONS__ 1
-_ACEOF
-
-  cat >>confdefs.h <<\_ACEOF
-#define _ALL_SOURCE 1
-_ACEOF
-
-  cat >>confdefs.h <<\_ACEOF
-#define _GNU_SOURCE 1
-_ACEOF
-
-  cat >>confdefs.h <<\_ACEOF
-#define _POSIX_PTHREAD_SEMANTICS 1
-_ACEOF
-
-  cat >>confdefs.h <<\_ACEOF
-#define _TANDEM_SOURCE 1
-_ACEOF
-
-
-
-##########################STAGING area####################################
-##########################STAGING area####################################
-
-
-##########################################################################
-##									##
-##  Check specific C constructions 					##
-##									##
-##########################################################################
-
-
- { $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
-$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
-if test "${ac_cv_c_bigendian+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_c_bigendian=unknown
-    # See if we're dealing with a universal compiler.
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifndef __APPLE_CC__
-	       not a universal capable compiler
-	     #endif
-	     typedef int dummy;
-
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-
-	# Check for potential -arch flags.  It is not universal unless
-	# there are some -arch flags.  Note that *ppc* also matches
-	# ppc64.  This check is also rather less than ideal.
-	case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in  #(
-	  *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;;
-	esac
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    if test $ac_cv_c_bigendian = unknown; then
-      # See if sys/param.h defines the BYTE_ORDER macro.
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-	     #include <sys/param.h>
-
-int
-main ()
-{
-#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
-		     && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
-		     && LITTLE_ENDIAN)
-	      bogus endian macros
-	     #endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  # It does; now see whether it defined to BIG_ENDIAN or not.
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-		#include <sys/param.h>
-
-int
-main ()
-{
-#if BYTE_ORDER != BIG_ENDIAN
-		 not big endian
-		#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_c_bigendian=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_c_bigendian=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     fi
     if test $ac_cv_c_bigendian = unknown; then
       # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <limits.h>
 
@@ -6205,30 +5901,9 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   # It does; now see whether it defined to _BIG_ENDIAN or not.
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <limits.h>
 
@@ -6243,51 +5918,20 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_c_bigendian=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_c_bigendian=no
+  ac_cv_c_bigendian=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     fi
     if test $ac_cv_c_bigendian = unknown; then
       # Compile a test program.
-      if test "$cross_compiling" = yes; then
+      if test "$cross_compiling" = yes; then :
   # Try to guess by grepping values from an object file.
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 short int ascii_mm[] =
 		  { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
@@ -6313,24 +5957,7 @@ return use_ascii (foo) == use_ebcdic (foo);
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
 	      ac_cv_c_bigendian=yes
 	    fi
@@ -6342,20 +5969,10 @@ $as_echo "$ac_try_echo") >&5
 		ac_cv_c_bigendian=unknown
 	      fi
 	    fi
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 int
@@ -6375,79 +5992,41 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_c_bigendian=no
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_c_bigendian=yes
+  ac_cv_c_bigendian=yes
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
     fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
 $as_echo "$ac_cv_c_bigendian" >&6; }
  case $ac_cv_c_bigendian in #(
    yes)
-     cat >>confdefs.h <<\_ACEOF
-#define WORDS_BIGENDIAN 1
-_ACEOF
+     $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
 ;; #(
    no)
       ;; #(
    universal)
 
-cat >>confdefs.h <<\_ACEOF
-#define AC_APPLE_UNIVERSAL_BUILD 1
-_ACEOF
+$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
 
      ;; #(
    *)
-     { { $as_echo "$as_me:$LINENO: error: unknown endianness
- presetting ac_cv_c_bigendian=no (or yes) will help" >&5
-$as_echo "$as_me: error: unknown endianness
- presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
-   { (exit 1); exit 1; }; } ;;
+     as_fn_error "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
  esac
 
-{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
 $as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then
+if test "${ac_cv_c_const+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -6507,55 +6086,28 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_c_const=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_c_const=no
+  ac_cv_c_const=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
 $as_echo "$ac_cv_c_const" >&6; }
 if test $ac_cv_c_const = no; then
 
-cat >>confdefs.h <<\_ACEOF
-#define const /**/
-_ACEOF
+$as_echo "#define const /**/" >>confdefs.h
 
 fi
- 			{ $as_echo "$as_me:$LINENO: checking for inline" >&5
+ 			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
 $as_echo_n "checking for inline... " >&6; }
-if test "${ac_cv_c_inline+set}" = set; then
+if test "${ac_cv_c_inline+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifndef __cplusplus
 typedef int foo_t;
@@ -6564,41 +6116,17 @@ $ac_kw foo_t foo () {return 0; }
 #endif
 
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_c_inline=$ac_kw
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   test "$ac_cv_c_inline" != no && break
 done
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
 $as_echo "$ac_cv_c_inline" >&6; }
 
-
 case $ac_cv_c_inline in
   inline | yes) ;;
   *)
@@ -6614,17 +6142,12 @@ _ACEOF
     ;;
 esac
 
-
-{ $as_echo "$as_me:$LINENO: checking whether char is unsigned" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5
 $as_echo_n "checking whether char is unsigned... " >&6; }
-if test "${ac_cv_c_char_unsigned+set}" = set; then
+if test "${ac_cv_c_char_unsigned+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 int
@@ -6637,55 +6160,28 @@ test_array [0] = 0
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_c_char_unsigned=no
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_c_char_unsigned=yes
+  ac_cv_c_char_unsigned=yes
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5
 $as_echo "$ac_cv_c_char_unsigned" >&6; }
 if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
-  cat >>confdefs.h <<\_ACEOF
-#define __CHAR_UNSIGNED__ 1
-_ACEOF
+  $as_echo "#define __CHAR_UNSIGNED__ 1" >>confdefs.h
 
 fi
 
 
 
-  { $as_echo "$as_me:$LINENO: checking for long double with more range or precision than double" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double with more range or precision than double" >&5
 $as_echo_n "checking for long double with more range or precision than double... " >&6; }
-if test "${ac_cv_type_long_double_wider+set}" = set; then
+if test "${ac_cv_type_long_double_wider+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <float.h>
 	    long double const a[] =
@@ -6715,50 +6211,25 @@ test_array [0] = 0
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_type_long_double_wider=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_type_long_double_wider=no
+  ac_cv_type_long_double_wider=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_long_double_wider" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_double_wider" >&5
 $as_echo "$ac_cv_type_long_double_wider" >&6; }
   if test $ac_cv_type_long_double_wider = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LONG_DOUBLE_WIDER 1
-_ACEOF
+$as_echo "#define HAVE_LONG_DOUBLE_WIDER 1" >>confdefs.h
 
   fi
 
     ac_cv_c_long_double=$ac_cv_type_long_double_wider
     if test $ac_cv_c_long_double = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LONG_DOUBLE 1
-_ACEOF
+$as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h
 
     fi
 
@@ -6774,358 +6245,169 @@ _ACEOF
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of char" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5
 $as_echo_n "checking size of char... " >&6; }
-if test "${ac_cv_sizeof_char+set}" = set; then
+if test "${ac_cv_sizeof_char+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char))) <= $ac_mid)];
-test_array [0] = 0
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char"        "$ac_includes_default"; then :
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if test "$ac_cv_type_char" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (char)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_char=0
+   fi
+fi
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char" >&5
+$as_echo "$ac_cv_sizeof_char" >&6; }
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char))) < 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_CHAR $ac_cv_sizeof_char
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char))) >= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
+$as_echo_n "checking size of short... " >&6; }
+if test "${ac_cv_sizeof_short+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short"        "$ac_includes_default"; then :
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+else
+  if test "$ac_cv_type_short" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (short)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_short=0
+   fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
+$as_echo "$ac_cv_sizeof_short" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned" >&5
+$as_echo_n "checking size of unsigned... " >&6; }
+if test "${ac_cv_sizeof_unsigned+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned))" "ac_cv_sizeof_unsigned"        "$ac_includes_default"; then :
 
-	ac_lo= ac_hi=
+else
+  if test "$ac_cv_type_unsigned" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (unsigned)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_unsigned=0
+   fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned" >&5
+$as_echo "$ac_cv_sizeof_unsigned" >&6; }
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_UNSIGNED $ac_cv_sizeof_unsigned
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_char=$ac_lo;;
-'') if test "$ac_cv_type_char" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
+if test "${ac_cv_sizeof_int+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_int" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (char)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (char)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (int)
+See \`config.log' for more details." "$LINENO" 5; }; }
    else
-     ac_cv_sizeof_char=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+     ac_cv_sizeof_int=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (char)); }
-static unsigned long int ulongval () { return (long int) (sizeof (char)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (char))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (char))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (char))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_char=`cat conftest.val`
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if test "${ac_cv_sizeof_long+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long"        "$ac_includes_default"; then :
 
-( exit $ac_status )
-if test "$ac_cv_type_char" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+else
+  if test "$ac_cv_type_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (char)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (char)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (long)
+See \`config.log' for more details." "$LINENO" 5; }; }
    else
-     ac_cv_sizeof_char=0
+     ac_cv_sizeof_long=0
    fi
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
+
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5
-$as_echo "$ac_cv_sizeof_char" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
 
 
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_CHAR $ac_cv_sizeof_char
+#define SIZEOF_LONG $ac_cv_sizeof_long
 _ACEOF
 
 
@@ -7133,358 +6415,169 @@ _ACEOF
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of short" >&5
-$as_echo_n "checking size of short... " >&6; }
-if test "${ac_cv_sizeof_short+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if test "${ac_cv_sizeof_long_long+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)];
-test_array [0] = 0
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if test "$ac_cv_type_long_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (long long)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) < 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5
+$as_echo_n "checking size of float... " >&6; }
+if test "${ac_cv_sizeof_float+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float"        "$ac_includes_default"; then :
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+else
+  if test "$ac_cv_type_float" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (float)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_float=0
+   fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_float" >&5
+$as_echo "$ac_cv_sizeof_float" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_FLOAT $ac_cv_sizeof_float
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5
+$as_echo_n "checking size of double... " >&6; }
+if test "${ac_cv_sizeof_double+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double"        "$ac_includes_default"; then :
 
-	ac_lo= ac_hi=
+else
+  if test "$ac_cv_type_double" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (double)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_double=0
+   fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_double" >&5
+$as_echo "$ac_cv_sizeof_double" >&6; }
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_DOUBLE $ac_cv_sizeof_double
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_short=$ac_lo;;
-'') if test "$ac_cv_type_short" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5
+$as_echo_n "checking size of long double... " >&6; }
+if test "${ac_cv_sizeof_long_double+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_long_double" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (long double)
+See \`config.log' for more details." "$LINENO" 5; }; }
    else
-     ac_cv_sizeof_short=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+     ac_cv_sizeof_long_double=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_double" >&5
+$as_echo "$ac_cv_sizeof_long_double" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (short)); }
-static unsigned long int ulongval () { return (long int) (sizeof (short)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (short))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (short))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (short))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_short=`cat conftest.val`
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char *" >&5
+$as_echo_n "checking size of char *... " >&6; }
+if test "${ac_cv_sizeof_char_p+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char *))" "ac_cv_sizeof_char_p"        "$ac_includes_default"; then :
 
-( exit $ac_status )
-if test "$ac_cv_type_short" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+else
+  if test "$ac_cv_type_char_p" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (char *)
+See \`config.log' for more details." "$LINENO" 5; }; }
    else
-     ac_cv_sizeof_short=0
+     ac_cv_sizeof_char_p=0
    fi
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
+
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
-$as_echo "$ac_cv_sizeof_short" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char_p" >&5
+$as_echo "$ac_cv_sizeof_char_p" >&6; }
 
 
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_SHORT $ac_cv_sizeof_short
+#define SIZEOF_CHAR_P $ac_cv_sizeof_char_p
 _ACEOF
 
 
@@ -7492,3956 +6585,1682 @@ _ACEOF
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of unsigned" >&5
-$as_echo_n "checking size of unsigned... " >&6; }
-if test "${ac_cv_sizeof_unsigned+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
+$as_echo_n "checking size of void *... " >&6; }
+if test "${ac_cv_sizeof_void_p+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned))) <= $ac_mid)];
-test_array [0] = 0
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p"        "$ac_includes_default"; then :
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if test "$ac_cv_type_void_p" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ as_fn_set_status 77
+as_fn_error "cannot compute sizeof (void *)
+See \`config.log' for more details." "$LINENO" 5; }; }
+   else
+     ac_cv_sizeof_void_p=0
+   fi
+fi
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
+$as_echo "$ac_cv_sizeof_void_p" >&6; }
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned))) < 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned))) >= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo= ac_hi=
-fi
+##########################################################################
+##									##
+##  Check for various programms						##
+##									##
+##########################################################################
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
+##  Force install-sh to be accessed via an absolute path:
+ac_install_sh="$TOP/$ac_install_sh"
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (unsigned))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo=`expr '(' $ac_mid ')' + 1`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_unsigned=$ac_lo;;
-'') if test "$ac_cv_type_unsigned" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (unsigned)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_unsigned=0
-   fi ;;
-esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (unsigned)); }
-static unsigned long int ulongval () { return (long int) (sizeof (unsigned)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (unsigned))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (unsigned))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (unsigned))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_unsigned=`cat conftest.val`
+## We favor yacc above bizon or byacc, therefor we do not use AC_PROG_YACC
+for ac_prog in 'bison -y' byacc
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_YACC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if test -n "$YACC"; then
+  ac_cv_prog_YACC="$YACC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_YACC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-( exit $ac_status )
-if test "$ac_cv_type_unsigned" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (unsigned)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_unsigned=0
-   fi
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-rm -f conftest.val
+YACC=$ac_cv_prog_YACC
+if test -n "$YACC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5
+$as_echo "$YACC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned" >&5
-$as_echo "$ac_cv_sizeof_unsigned" >&6; }
 
 
+  test -n "$YACC" && break
+done
+test -n "$YACC" || YACC="yacc"
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_UNSIGNED $ac_cv_sizeof_unsigned
-_ACEOF
+## AC_CHECK_PROGS(YACC, yacc byacc 'bison -l', yacc)
 
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of int" >&5
-$as_echo_n "checking size of int... " >&6; }
-if test "${ac_cv_sizeof_int+set}" = set; then
+# Extract the first word of "htmldoc", so it can be a program name with args.
+set dummy htmldoc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_HTMLDOC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)];
-test_array [0] = 0
+  case $HTMLDOC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_HTMLDOC="$HTMLDOC" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_HTMLDOC="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
+fi
+HTMLDOC=$ac_cv_path_HTMLDOC
+if test -n "$HTMLDOC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HTMLDOC" >&5
+$as_echo "$HTMLDOC" >&6; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+
+ if test "x$HTMLDOC" != "x"; then
+  WITH_HTMLDOC_TRUE=
+  WITH_HTMLDOC_FALSE='#'
+else
+  WITH_HTMLDOC_TRUE='#'
+  WITH_HTMLDOC_FALSE=
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+for ac_prog in flex lex
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_LEX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$LEX"; then
+  ac_cv_prog_LEX="$LEX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_LEX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
   done
+IFS=$as_save_IFS
+
+fi
+fi
+LEX=$ac_cv_prog_LEX
+if test -n "$LEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5
+$as_echo "$LEX" >&6; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
+  test -n "$LEX" && break
+done
+test -n "$LEX" || LEX=":"
+
+if test "x$LEX" != "x:"; then
+  cat >conftest.l <<_ACEOF
+%%
+a { ECHO; }
+b { REJECT; }
+c { yymore (); }
+d { yyless (1); }
+e { yyless (input () != 0); }
+f { unput (yytext[0]); }
+. { BEGIN INITIAL; }
+%%
+#ifdef YYTEXT_POINTER
+extern char *yytext;
+#endif
 int
-main ()
+main (void)
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
+  return ! yylex () + ! yywrap ();
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+{ { ac_try="$LEX conftest.l"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$LEX conftest.l") 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5
+$as_echo_n "checking lex output file root... " >&6; }
+if test "${ac_cv_prog_lex_root+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+if test -f lex.yy.c; then
+  ac_cv_prog_lex_root=lex.yy
+elif test -f lexyy.c; then
+  ac_cv_prog_lex_root=lexyy
+else
+  as_fn_error "cannot find output from $LEX; giving up" "$LINENO" 5
+fi
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5
+$as_echo "$ac_cv_prog_lex_root" >&6; }
+LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+if test -z "${LEXLIB+set}"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5
+$as_echo_n "checking lex library... " >&6; }
+if test "${ac_cv_lib_lex+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo= ac_hi=
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+    ac_save_LIBS=$LIBS
+    ac_cv_lib_lex='none needed'
+    for ac_lib in '' -lfl -ll; do
+      LIBS="$ac_lib $ac_save_LIBS"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
+`cat $LEX_OUTPUT_ROOT.c`
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_lex=$ac_lib
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+      test "$ac_cv_lib_lex" != 'none needed' && break
+    done
+    LIBS=$ac_save_LIBS
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5
+$as_echo "$ac_cv_lib_lex" >&6; }
+  test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_int=$ac_lo;;
-'') if test "$ac_cv_type_int" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_int=0
-   fi ;;
-esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5
+$as_echo_n "checking whether yytext is a pointer... " >&6; }
+if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  # POSIX says lex can declare yytext either as a pointer or an array; the
+# default is implementation-dependent.  Figure out which it is, since
+# not all implementations provide the %pointer and %array declarations.
+ac_cv_prog_lex_yytext_pointer=no
+ac_save_LIBS=$LIBS
+LIBS="$LEXLIB $ac_save_LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (int)); }
-static unsigned long int ulongval () { return (long int) (sizeof (int)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+#define YYTEXT_POINTER 1
+`cat $LEX_OUTPUT_ROOT.c`
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_prog_lex_yytext_pointer=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_save_LIBS
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (int))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (int))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (int))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5
+$as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; }
+if test $ac_cv_prog_lex_yytext_pointer = yes; then
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_int=`cat conftest.val`
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+$as_echo "#define YYTEXT_POINTER 1" >>confdefs.h
 
-( exit $ac_status )
-if test "$ac_cv_type_int" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_int=0
-   fi
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.l $LEX_OUTPUT_ROOT.c
+
 fi
-rm -f conftest.val
+if test "$LEX" = :; then
+  LEX=${am_missing_run}flex
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
-$as_echo "$ac_cv_sizeof_int" >&6; }
-
 
+# Extract the first word of "flex", so it can be a program name with args.
+set dummy flex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_FLEX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $FLEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_FLEX="$FLEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_FLEX="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_INT $ac_cv_sizeof_int
-_ACEOF
+  test -z "$ac_cv_path_FLEX" && ac_cv_path_FLEX="flex"
+  ;;
+esac
+fi
+FLEX=$ac_cv_path_FLEX
+if test -n "$FLEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5
+$as_echo "$FLEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of long" >&5
-$as_echo_n "checking size of long... " >&6; }
-if test "${ac_cv_sizeof_long+set}" = set; then
+# Extract the first word of "gawk", so it can be a program name with args.
+set dummy gawk; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_GAWK+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
-test_array [0] = 0
+  case $GAWK in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GAWK="$GAWK" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_GAWK="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  test -z "$ac_cv_path_GAWK" && ac_cv_path_GAWK="gawk"
+  ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
+fi
+GAWK=$ac_cv_path_GAWK
+if test -n "$GAWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GAWK" >&5
+$as_echo "$GAWK" >&6; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
+# Extract the first word of "gperf", so it can be a program name with args.
+set dummy gperf; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_GPERF+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  case $GPERF in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GPERF="$GPERF" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_GPERF="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+  test -z "$ac_cv_path_GPERF" && ac_cv_path_GPERF="gperf"
+  ;;
+esac
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+GPERF=$ac_cv_path_GPERF
+if test -n "$GPERF"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPERF" >&5
+$as_echo "$GPERF" >&6; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo= ac_hi=
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
-test_array [0] = 0
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PERL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PERL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="perl"
+  ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
+fi
+PERL=$ac_cv_path_PERL
+if test -n "$PERL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo=`expr '(' $ac_mid ')' + 1`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+# Extract the first word of "python", so it can be a program name with args.
+set dummy python; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PYTHON+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PYTHON in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
 done
-case $ac_lo in
-?*) ac_cv_sizeof_long=$ac_lo;;
-'') if test "$ac_cv_type_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi ;;
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="python"
+  ;;
 esac
+fi
+PYTHON=$ac_cv_path_PYTHON
+if test -n "$PYTHON"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
+$as_echo "$PYTHON" >&6; }
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (long)); }
-static unsigned long int ulongval () { return (long int) (sizeof (long)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (long))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (long))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (long))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_long=`cat conftest.val`
+# Extract the first word of "ruby", so it can be a program name with args.
+set dummy ruby; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_RUBY+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  case $RUBY in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_RUBY="$RUBY" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_RUBY="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-( exit $ac_status )
-if test "$ac_cv_type_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+  test -z "$ac_cv_path_RUBY" && ac_cv_path_RUBY="ruby"
+  ;;
+esac
 fi
-rm -f conftest.val
+RUBY=$ac_cv_path_RUBY
+if test -n "$RUBY"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY" >&5
+$as_echo "$RUBY" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
-$as_echo "$ac_cv_sizeof_long" >&6; }
 
 
+#AC_DECL_YYTEXT
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-_ACEOF
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of long long" >&5
-$as_echo_n "checking size of long long... " >&6; }
-if test "${ac_cv_sizeof_long_long+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) < 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+##########################################################################
+##									##
+##  Use the new LibTool GNU package					##
+##									##
+##########################################################################
+case `pwd` in
+  *\ * | *\	*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+macro_version='2.2.6b'
+macro_revision='1.3017'
 
-	ac_lo= ac_hi=
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long_long=$ac_lo;;
-'') if test "$ac_cv_type_long_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (long long)); }
-static unsigned long int ulongval () { return (long int) (sizeof (long long)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (long long))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (long long))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (long long))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_long_long=`cat conftest.val`
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-if test "$ac_cv_type_long_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
-$as_echo "$ac_cv_sizeof_long_long" >&6; }
 
 
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-_ACEOF
 
+ltmain="$ac_aux_dir/ltmain.sh"
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of float" >&5
-$as_echo_n "checking size of float... " >&6; }
-if test "${ac_cv_sizeof_float+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if test "${lt_cv_path_NM+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (float))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (float))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DUMPBIN"; then
+  ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+    test -n "$DUMPBIN" && break
   done
+fi
+if test -z "$DUMPBIN"; then
+  ac_ct_DUMPBIN=$DUMPBIN
+  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if test -n "$ac_ct_DUMPBIN"; then
+  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (float))) < 0)];
-test_array [0] = 0
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (float))) >= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  test -n "$ac_ct_DUMPBIN" && break
+done
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+  if test "x$ac_ct_DUMPBIN" = x; then
+    DUMPBIN=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DUMPBIN=$ac_ct_DUMPBIN
+  fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo= ac_hi=
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
 fi
+test -z "$NM" && NM=nm
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (float))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_float=$ac_lo;;
-'') if test "$ac_cv_type_float" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (float)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (float)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_float=0
-   fi ;;
-esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if test "${lt_cv_nm_interface+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (float)); }
-static unsigned long int ulongval () { return (long int) (sizeof (float)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (float))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (float))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (float))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
+  lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:7382: $ac_compile\"" >&5)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:7385: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:7388: output\"" >&5)
+  cat conftest.out >&5
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_float=`cat conftest.val`
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_float" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (float)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (float)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_float=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_float" >&5
-$as_echo "$ac_cv_sizeof_float" >&6; }
+    i=0
+  teststring="ABCD"
 
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
 
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_FLOAT $ac_cv_sizeof_float
-_ACEOF
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
 
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of double" >&5
-$as_echo_n "checking size of double... " >&6; }
-if test "${ac_cv_sizeof_double+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (double))) >= 0)];
-test_array [0] = 0
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (double))) <= $ac_mid)];
-test_array [0] = 0
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[	 ]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+if test -n $lt_cv_sys_max_cmd_len ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (double))) < 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (double))) >= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo= ac_hi=
-fi
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (double))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_double=$ac_lo;;
-'') if test "$ac_cv_type_double" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (double)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (double)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_double=0
-   fi ;;
-esac
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (double)); }
-static unsigned long int ulongval () { return (long int) (sizeof (double)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+  lt_unset=false
+fi
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (double))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (double))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (double))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_double=`cat conftest.val`
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-if test "$ac_cv_type_double" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (double)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (double)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_double=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_double" >&5
-$as_echo "$ac_cv_sizeof_double" >&6; }
 
 
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_DOUBLE $ac_cv_sizeof_double
-_ACEOF
 
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of long double" >&5
-$as_echo_n "checking size of long double... " >&6; }
-if test "${ac_cv_sizeof_long_double+set}" = set; then
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long double))) >= 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long double))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long double))) < 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long double))) >= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-	ac_lo= ac_hi=
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long double))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+  ac_ct_OBJDUMP=$OBJDUMP
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if test -n "$ac_ct_OBJDUMP"; then
+  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OBJDUMP="objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long_double=$ac_lo;;
-'') if test "$ac_cv_type_long_double" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long double)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long double)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long_double=0
-   fi ;;
-esac
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (long double)); }
-static unsigned long int ulongval () { return (long int) (sizeof (long double)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (long double))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (long double))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
+  if test "x$ac_ct_OBJDUMP" = x; then
+    OBJDUMP="false"
   else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (long double))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_long_double=`cat conftest.val`
+    OBJDUMP=$ac_ct_OBJDUMP
+  fi
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_long_double" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long double)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long double)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long_double=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
+  OBJDUMP="$ac_cv_prog_OBJDUMP"
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_double" >&5
-$as_echo "$ac_cv_sizeof_long_double" >&6; }
 
+test -z "$OBJDUMP" && OBJDUMP=objdump
 
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double
-_ACEOF
 
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of char *" >&5
-$as_echo_n "checking size of char *... " >&6; }
-if test "${ac_cv_sizeof_char_p+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char *))) >= 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char *))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char *))) < 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char *))) >= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
-fi
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+case $host_os in
+aix[4-9]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-	ac_lo= ac_hi=
-fi
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char *))) <= $ac_mid)];
-test_array [0] = 0
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
+cegcc)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_char_p=$ac_lo;;
-'') if test "$ac_cv_type_char_p" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (char *)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (char *)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_char_p=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (char *)); }
-static unsigned long int ulongval () { return (long int) (sizeof (char *)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (char *))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (char *))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
   else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (char *))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_char_p=`cat conftest.val`
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
 
-( exit $ac_status )
-if test "$ac_cv_type_char_p" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (char *)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (char *)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_char_p=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_char_p" >&5
-$as_echo "$ac_cv_sizeof_char_p" >&6; }
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
 
+interix[3-9]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_CHAR_P $ac_cv_sizeof_char_p
-_ACEOF
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if test "${ac_cv_sizeof_void_p+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= 0)];
-test_array [0] = 0
+netbsd*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
-test_array [0] = 0
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) < 0)];
-test_array [0] = 0
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= $ac_mid)];
-test_array [0] = 0
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo= ac_hi=
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_void_p=$ac_lo;;
-'') if test "$ac_cv_type_void_p" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (void *)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_void_p=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-static long int longval () { return (long int) (sizeof (void *)); }
-static unsigned long int ulongval () { return (long int) (sizeof (void *)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (void *))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (void *))))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (void *))))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_void_p=`cat conftest.val`
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-if test "$ac_cv_type_void_p" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (void *)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_void_p=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
 
 
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
-_ACEOF
-
-
-
-
-##########################################################################
-##									##
-##  Check for various programms						##
-##									##
-##########################################################################
-
-##  Force install-sh to be accessed via an absolute path:
-ac_install_sh="$TOP/$ac_install_sh"
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
-  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
-  /usr/ucb/* ) ;;
-  *)
-    # OSF1 and SCO ODT 3.0 have their own names for install.
-    # Don't use installbsd from OSF since it installs stuff as root
-    # by default.
-    for ac_prog in ginstall scoinst install; do
-      for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
-	  if test $ac_prog = install &&
-	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # AIX install.  It has an incompatible calling convention.
-	    :
-	  elif test $ac_prog = install &&
-	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # program-specific install script used by HP pwplus--don't use.
-	    :
-	  else
-	    rm -rf conftest.one conftest.two conftest.dir
-	    echo one > conftest.one
-	    echo two > conftest.two
-	    mkdir conftest.dir
-	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
-	      test -s conftest.one && test -s conftest.two &&
-	      test -s conftest.dir/conftest.one &&
-	      test -s conftest.dir/conftest.two
-	    then
-	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-	      break 3
-	    fi
-	  fi
-	fi
-      done
-    done
-    ;;
-esac
-
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
 done
+  done
 IFS=$as_save_IFS
 
-rm -rf conftest.one conftest.two conftest.dir
-
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL=$ac_cv_path_install
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    INSTALL=$ac_install_sh
-  fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
-set x ${MAKE-make}
-ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.make <<\_ACEOF
-SHELL = /bin/sh
-all:
-	@echo '@@@%%%=$(MAKE)=@@@%%%'
-_ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-case `${MAKE-make} -f conftest.make 2>/dev/null` in
-  *@@@%%%=?*=@@@%%%*)
-    eval ac_cv_prog_make_${ac_make}_set=yes;;
-  *)
-    eval ac_cv_prog_make_${ac_make}_set=no;;
-esac
-rm -f conftest.make
 fi
-if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-  SET_MAKE=
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-  SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5
-$as_echo_n "checking whether ln -s works... " >&6; }
-LN_S=$as_ln_s
-if test "$LN_S" = "ln -s"; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-$as_echo "no, using $LN_S" >&6; }
 fi
 
 
-## We favor yacc above bizon or byacc, therefor we do not use AC_PROG_YACC
-for ac_prog in 'bison -y' byacc
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+fi
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_YACC+set}" = set; then
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$YACC"; then
-  ac_cv_prog_YACC="$YACC" # Let the user override the test.
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_YACC="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_ac_ct_AR="ar"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-YACC=$ac_cv_prog_YACC
-if test -n "$YACC"; then
-  { $as_echo "$as_me:$LINENO: result: $YACC" >&5
-$as_echo "$YACC" >&6; }
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_ct_AR
+  fi
+else
+  AR="$ac_cv_prog_AR"
+fi
+
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
 
-  test -n "$YACC" && break
-done
-test -n "$YACC" || YACC="yacc"
 
-## AC_CHECK_PROGS(YACC, yacc byacc 'bison -l', yacc)
 
 
-# Extract the first word of "htmldoc", so it can be a program name with args.
-set dummy htmldoc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_HTMLDOC+set}" = set; then
+if test "${ac_cv_prog_STRIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $HTMLDOC in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_HTMLDOC="$HTMLDOC" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_HTMLDOC="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
-  ;;
-esac
 fi
-HTMLDOC=$ac_cv_path_HTMLDOC
-if test -n "$HTMLDOC"; then
-  { $as_echo "$as_me:$LINENO: result: $HTMLDOC" >&5
-$as_echo "$HTMLDOC" >&6; }
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
- if test "x$HTMLDOC" != "x"; then
-  WITH_HTMLDOC_TRUE=
-  WITH_HTMLDOC_FALSE='#'
-else
-  WITH_HTMLDOC_TRUE='#'
-  WITH_HTMLDOC_FALSE=
 fi
-
-
-for ac_prog in flex lex
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LEX+set}" = set; then
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$LEX"; then
-  ac_cv_prog_LEX="$LEX" # Let the user override the test.
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_LEX="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-LEX=$ac_cv_prog_LEX
-if test -n "$LEX"; then
-  { $as_echo "$as_me:$LINENO: result: $LEX" >&5
-$as_echo "$LEX" >&6; }
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-
-  test -n "$LEX" && break
-done
-test -n "$LEX" || LEX=":"
-
-if test "x$LEX" != "x:"; then
-  cat >conftest.l <<_ACEOF
-%%
-a { ECHO; }
-b { REJECT; }
-c { yymore (); }
-d { yyless (1); }
-e { yyless (input () != 0); }
-f { unput (yytext[0]); }
-. { BEGIN INITIAL; }
-%%
-#ifdef YYTEXT_POINTER
-extern char *yytext;
-#endif
-int
-main (void)
-{
-  return ! yylex () + ! yywrap ();
-}
-_ACEOF
-{ (ac_try="$LEX conftest.l"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$LEX conftest.l") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ $as_echo "$as_me:$LINENO: checking lex output file root" >&5
-$as_echo_n "checking lex output file root... " >&6; }
-if test "${ac_cv_prog_lex_root+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-
-if test -f lex.yy.c; then
-  ac_cv_prog_lex_root=lex.yy
-elif test -f lexyy.c; then
-  ac_cv_prog_lex_root=lexyy
-else
-  { { $as_echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5
-$as_echo "$as_me: error: cannot find output from $LEX; giving up" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5
-$as_echo "$ac_cv_prog_lex_root" >&6; }
-LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
-
-if test -z "${LEXLIB+set}"; then
-  { $as_echo "$as_me:$LINENO: checking lex library" >&5
-$as_echo_n "checking lex library... " >&6; }
-if test "${ac_cv_lib_lex+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-
-    ac_save_LIBS=$LIBS
-    ac_cv_lib_lex='none needed'
-    for ac_lib in '' -lfl -ll; do
-      LIBS="$ac_lib $ac_save_LIBS"
-      cat >conftest.$ac_ext <<_ACEOF
-`cat $LEX_OUTPUT_ROOT.c`
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_lex=$ac_lib
+    STRIP=$ac_ct_STRIP
+  fi
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-      test "$ac_cv_lib_lex" != 'none needed' && break
-    done
-    LIBS=$ac_save_LIBS
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5
-$as_echo "$ac_cv_lib_lex" >&6; }
-  test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
+  STRIP="$ac_cv_prog_STRIP"
 fi
 
+test -z "$STRIP" && STRIP=:
 
-{ $as_echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5
-$as_echo_n "checking whether yytext is a pointer... " >&6; }
-if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  # POSIX says lex can declare yytext either as a pointer or an array; the
-# default is implementation-dependent.  Figure out which it is, since
-# not all implementations provide the %pointer and %array declarations.
-ac_cv_prog_lex_yytext_pointer=no
-ac_save_LIBS=$LIBS
-LIBS="$LEXLIB $ac_save_LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#define YYTEXT_POINTER 1
-`cat $LEX_OUTPUT_ROOT.c`
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_prog_lex_yytext_pointer=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_save_LIBS
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5
-$as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; }
-if test $ac_cv_prog_lex_yytext_pointer = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define YYTEXT_POINTER 1
-_ACEOF
 
-fi
-rm -f conftest.l $LEX_OUTPUT_ROOT.c
 
-fi
-if test "$LEX" = :; then
-  LEX=${am_missing_run}flex
-fi
 
-# Extract the first word of "flex", so it can be a program name with args.
-set dummy flex; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_FLEX+set}" = set; then
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $FLEX in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_FLEX="$FLEX" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_FLEX="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_FLEX" && ac_cv_path_FLEX="flex"
-  ;;
-esac
 fi
-FLEX=$ac_cv_path_FLEX
-if test -n "$FLEX"; then
-  { $as_echo "$as_me:$LINENO: result: $FLEX" >&5
-$as_echo "$FLEX" >&6; }
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-# Extract the first word of "gawk", so it can be a program name with args.
-set dummy gawk; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GAWK+set}" = set; then
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $GAWK in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_GAWK="$GAWK" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_GAWK="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_GAWK" && ac_cv_path_GAWK="gawk"
-  ;;
-esac
 fi
-GAWK=$ac_cv_path_GAWK
-if test -n "$GAWK"; then
-  { $as_echo "$as_me:$LINENO: result: $GAWK" >&5
-$as_echo "$GAWK" >&6; }
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-
-# Extract the first word of "gperf", so it can be a program name with args.
-set dummy gperf; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GPERF+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  case $GPERF in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_GPERF="$GPERF" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_GPERF="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_GPERF" && ac_cv_path_GPERF="gperf"
-  ;;
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
 esac
-fi
-GPERF=$ac_cv_path_GPERF
-if test -n "$GPERF"; then
-  { $as_echo "$as_me:$LINENO: result: $GPERF" >&5
-$as_echo "$GPERF" >&6; }
+    RANLIB=$ac_ct_RANLIB
+  fi
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+  RANLIB="$ac_cv_prog_RANLIB"
 fi
 
+test -z "$RANLIB" && RANLIB=:
 
-# Extract the first word of "perl", so it can be a program name with args.
-set dummy perl; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PERL+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  case $PERL in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="perl"
-  ;;
-esac
-fi
-PERL=$ac_cv_path_PERL
-if test -n "$PERL"; then
-  { $as_echo "$as_me:$LINENO: result: $PERL" >&5
-$as_echo "$PERL" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
 
-# Extract the first word of "python", so it can be a program name with args.
-set dummy python; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PYTHON+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  case $PYTHON in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON="python"
-  ;;
-esac
-fi
-PYTHON=$ac_cv_path_PYTHON
-if test -n "$PYTHON"; then
-  { $as_echo "$as_me:$LINENO: result: $PYTHON" >&5
-$as_echo "$PYTHON" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
 
-# Extract the first word of "ruby", so it can be a program name with args.
-set dummy ruby; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_RUBY+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  case $RUBY in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_RUBY="$RUBY" # Let the user override the test with a path.
-  ;;
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
   *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_RUBY="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_RUBY" && ac_cv_path_RUBY="ruby"
-  ;;
-esac
-fi
-RUBY=$ac_cv_path_RUBY
-if test -n "$RUBY"; then
-  { $as_echo "$as_me:$LINENO: result: $RUBY" >&5
-$as_echo "$RUBY" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
 
 
-#AC_DECL_YYTEXT
 
-##########################################################################
-##									##
-##  Use the new LibTool GNU package					##
-##									##
-##########################################################################
-case `pwd` in
-  *\ * | *\	*)
-    { $as_echo "$as_me:$LINENO: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
-$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
-esac
 
 
 
-macro_version='2.2.6b'
-macro_revision='1.3017'
 
 
 
@@ -11455,517 +8274,263 @@ macro_revision='1.3017'
 
 
 
-ltmain="$ac_aux_dir/ltmain.sh"
 
-{ $as_echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
-$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if test "${lt_cv_path_NM+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$NM"; then
-  # Let the user override the test.
-  lt_cv_path_NM="$NM"
-else
-  lt_nm_to_check="${ac_tool_prefix}nm"
-  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
-    lt_nm_to_check="$lt_nm_to_check nm"
-  fi
-  for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
-      test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
-	# Check to see if the nm accepts a BSD-compat flag.
-	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
-	#   nm: unknown option "B" ignored
-	# Tru64's nm complains that /dev/null is an invalid object file
-	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-	*/dev/null* | *'Invalid file or object type'*)
-	  lt_cv_path_NM="$tmp_nm -B"
-	  break
-	  ;;
-	*)
-	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
-	  */dev/null*)
-	    lt_cv_path_NM="$tmp_nm -p"
-	    break
-	    ;;
-	  *)
-	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
-	    continue # so that we can try to find one that supports BSD flags
-	    ;;
-	  esac
-	  ;;
-	esac
-      fi
-    done
-    IFS="$lt_save_ifs"
-  done
-  : ${lt_cv_path_NM=no}
-fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
-$as_echo "$lt_cv_path_NM" >&6; }
-if test "$lt_cv_path_NM" != "no"; then
-  NM="$lt_cv_path_NM"
-else
-  # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DUMPBIN+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$DUMPBIN"; then
-  ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-fi
-fi
-DUMPBIN=$ac_cv_prog_DUMPBIN
-if test -n "$DUMPBIN"; then
-  { $as_echo "$as_me:$LINENO: result: $DUMPBIN" >&5
-$as_echo "$DUMPBIN" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
 
-    test -n "$DUMPBIN" && break
-  done
-fi
-if test -z "$DUMPBIN"; then
-  ac_ct_DUMPBIN=$DUMPBIN
-  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_DUMPBIN"; then
-  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-fi
-fi
-ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
-if test -n "$ac_ct_DUMPBIN"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
-$as_echo "$ac_ct_DUMPBIN" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
 
-  test -n "$ac_ct_DUMPBIN" && break
-done
 
-  if test "x$ac_ct_DUMPBIN" = x; then
-    DUMPBIN=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    DUMPBIN=$ac_ct_DUMPBIN
-  fi
-fi
 
 
-  if test "$DUMPBIN" != ":"; then
-    NM="$DUMPBIN"
-  fi
-fi
-test -z "$NM" && NM=nm
 
 
 
 
 
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
 
-{ $as_echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
-$as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if test "${lt_cv_nm_interface+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_nm_interface="BSD nm"
-  echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:11634: $ac_compile\"" >&5)
-  (eval "$ac_compile" 2>conftest.err)
-  cat conftest.err >&5
-  (eval echo "\"\$as_me:11637: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
-  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
-  cat conftest.err >&5
-  (eval echo "\"\$as_me:11640: output\"" >&5)
-  cat conftest.out >&5
-  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
-    lt_cv_nm_interface="MS dumpbin"
-  fi
-  rm -f conftest*
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
-$as_echo "$lt_cv_nm_interface" >&6; }
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
 
-# find the maximum length of command line arguments
-{ $as_echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
-$as_echo_n "checking the maximum length of command line arguments... " >&6; }
-if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-    i=0
-  teststring="ABCD"
 
-  case $build_os in
-  msdosdjgpp*)
-    # On DJGPP, this test can blow up pretty badly due to problems in libc
-    # (any single argument exceeding 2000 bytes causes a buffer overrun
-    # during glob expansion).  Even if it were fixed, the result of this
-    # check would be larger than it should be.
-    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
-    ;;
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
 
-  gnu*)
-    # Under GNU Hurd, this test is not required because there is
-    # no limit to the length of command line arguments.
-    # Libtool will interpret -1 as no limit whatsoever
-    lt_cv_sys_max_cmd_len=-1;
-    ;;
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
 
-  cygwin* | mingw* | cegcc*)
-    # On Win9x/ME, this test blows up -- it succeeds, but takes
-    # about 5 minutes as the teststring grows exponentially.
-    # Worse, since 9x/ME are not pre-emptively multitasking,
-    # you end up with a "frozen" computer, even though with patience
-    # the test eventually succeeds (with a max line length of 256k).
-    # Instead, let's just punt: use the minimum linelength reported by
-    # all of the supported platforms: 8192 (on NT/2K/XP).
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
 
-  amigaos*)
-    # On AmigaOS with pdksh, this test takes hours, literally.
-    # So we just punt and use a minimum line length of 8192.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
 
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
-    # This has been around since 386BSD, at least.  Likely further.
-    if test -x /sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
-    elif test -x /usr/sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
-    else
-      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
-    fi
-    # And add a safety zone
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    ;;
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
 
-  interix*)
-    # We know the value 262144 and hardcode it with a safety zone (like BSD)
-    lt_cv_sys_max_cmd_len=196608
-    ;;
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
-  osf*)
-    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
-    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
-    # nice to cause kernel panics so lets avoid the loop below.
-    # First set a reasonable default.
-    lt_cv_sys_max_cmd_len=16384
-    #
-    if test -x /sbin/sysconfig; then
-      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
-        *1*) lt_cv_sys_max_cmd_len=-1 ;;
-      esac
-    fi
-    ;;
-  sco3.2v5*)
-    lt_cv_sys_max_cmd_len=102400
-    ;;
-  sysv5* | sco5v6* | sysv4.2uw2*)
-    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
-    if test -n "$kargmax"; then
-      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[	 ]//'`
-    else
-      lt_cv_sys_max_cmd_len=32768
-    fi
-    ;;
-  *)
-    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len"; then
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    else
-      # Make teststring a little bigger before we do anything with it.
-      # a 1K string should be a reasonable start.
-      for i in 1 2 3 4 5 6 7 8 ; do
-        teststring=$teststring$teststring
-      done
-      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-      # If test is not a shell built-in, we'll probably end up computing a
-      # maximum length that is only half of the actual maximum length, but
-      # we can't tell.
-      while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
-	      test $i != 17 # 1/2 MB should be enough
-      do
-        i=`expr $i + 1`
-        teststring=$teststring$teststring
-      done
-      # Only check the string length outside the loop.
-      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
-      teststring=
-      # Add a significant safety factor because C++ compilers can tack on
-      # massive amounts of additional arguments before passing them to the
-      # linker.  It appears as though 1/2 is a usable value.
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
-    fi
-    ;;
-  esac
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
-fi
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
 
-if test -n $lt_cv_sys_max_cmd_len ; then
-  { $as_echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
-$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: none" >&5
-$as_echo "none" >&6; }
-fi
-max_cmd_len=$lt_cv_sys_max_cmd_len
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
 
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
 
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK '"\
+"     {last_section=section; section=\$ 3};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
 
+  # Check to see that the pipe works correctly.
+  pipe_works=no
 
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
 
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
 
-: ${CP="cp -f"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-
-{ $as_echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
-$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,, \
-    && eval 'test $(( 1 + 1 )) -eq 2 \
-    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
-  && xsi_shell=yes
-{ $as_echo "$as_me:$LINENO: result: $xsi_shell" >&5
-$as_echo "$xsi_shell" >&6; }
-
-
-{ $as_echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5
-$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
-    >/dev/null 2>&1 \
-  && lt_shell_append=yes
-{ $as_echo "$as_me:$LINENO: result: $lt_shell_append" >&5
-$as_echo "$lt_shell_append" >&6; }
-
-
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  lt_unset=unset
-else
-  lt_unset=false
-fi
-
-
-
-
-
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
-    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
-  lt_SP2NL='tr \040 \012'
-  lt_NL2SP='tr \015\012 \040\040'
-  ;;
- *) # EBCDIC based system
-  lt_SP2NL='tr \100 \n'
-  lt_NL2SP='tr \r\n \100\100'
-  ;;
-esac
-
-
-
-
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
 
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
 
+	  cat <<_LT_EOF >> conftest.$ac_ext
 
+/* The mapping between symbol names and symbols.  */
+const struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
 
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
 
-{ $as_echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
-$as_echo_n "checking for $LD option to reload object files... " >&6; }
-if test "${lt_cv_ld_reload_flag+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_ld_reload_flag='-r'
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
-$as_echo "$lt_cv_ld_reload_flag" >&6; }
-reload_flag=$lt_cv_ld_reload_flag
-case $reload_flag in
-"" | " "*) ;;
-*) reload_flag=" $reload_flag" ;;
-esac
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-case $host_os in
-  darwin*)
-    if test "$GCC" = yes; then
-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
     else
-      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
     fi
-    ;;
-esac
-
-
-
-
-
-
-
-
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
 
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
-set dummy ${ac_tool_prefix}objdump; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJDUMP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$OBJDUMP"; then
-  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
   fi
 done
-done
-IFS=$as_save_IFS
 
 fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
 fi
-OBJDUMP=$ac_cv_prog_OBJDUMP
-if test -n "$OBJDUMP"; then
-  { $as_echo "$as_me:$LINENO: result: $OBJDUMP" >&5
-$as_echo "$OBJDUMP" >&6; }
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
 fi
 
 
-fi
-if test -z "$ac_cv_prog_OBJDUMP"; then
-  ac_ct_OBJDUMP=$OBJDUMP
-  # Extract the first word of "objdump", so it can be a program name with args.
-set dummy objdump; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_OBJDUMP"; then
-  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_OBJDUMP="objdump"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-fi
-fi
-ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
-if test -n "$ac_ct_OBJDUMP"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
-$as_echo "$ac_ct_OBJDUMP" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
-  if test "x$ac_ct_OBJDUMP" = x; then
-    OBJDUMP="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    OBJDUMP=$ac_ct_OBJDUMP
-  fi
-else
-  OBJDUMP="$ac_cv_prog_OBJDUMP"
-fi
 
-test -z "$OBJDUMP" && OBJDUMP=objdump
 
 
 
@@ -11975,549 +8540,669 @@ test -z "$OBJDUMP" && OBJDUMP=objdump
 
 
 
-{ $as_echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
-$as_echo_n "checking how to recognize dependent libraries... " >&6; }
-if test "${lt_cv_deplibs_check_method+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
 
-case $host_os in
-aix[4-9]*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
 
-beos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
 
-bsdi[45]*)
-  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
-  lt_cv_file_magic_cmd='/usr/bin/file -L'
-  lt_cv_file_magic_test_file=/shlib/libc.so
-  ;;
 
-cygwin*)
-  # func_win32_libid is a shell function defined in ltmain.sh
-  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-  lt_cv_file_magic_cmd='func_win32_libid'
-  ;;
 
-mingw* | pw32*)
-  # Base MSYS/MinGW do not provide the 'file' command needed by
-  # func_win32_libid shell function, so use a weaker test based on 'objdump',
-  # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
-    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-    lt_cv_file_magic_cmd='func_win32_libid'
-  else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
-    lt_cv_file_magic_cmd='$OBJDUMP -f'
-  fi
-  ;;
 
-cegcc)
-  # use the weaker test based on 'objdump'. See mingw*.
-  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
-  lt_cv_file_magic_cmd='$OBJDUMP -f'
-  ;;
 
-darwin* | rhapsody*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
 
-freebsd* | dragonfly*)
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
-    case $host_cpu in
-    i*86 )
-      # Not sure whether the presence of OpenBSD here was a mistake.
-      # Let's accept both of them until this is cleared up.
-      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
-      lt_cv_file_magic_cmd=/usr/bin/file
-      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
-      ;;
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
     esac
-  else
-    lt_cv_deplibs_check_method=pass_all
   fi
+  rm -rf conftest*
   ;;
-
-gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-hpux10.20* | hpux11*)
-  lt_cv_file_magic_cmd=/usr/bin/file
-  case $host_cpu in
-  ia64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
-    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
-    ;;
-  hppa*64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
-    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
-    ;;
-  *)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
-    lt_cv_file_magic_test_file=/usr/lib/libc.sl
-    ;;
-  esac
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 8582 "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
   ;;
 
-interix[3-9]*)
-  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
-  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
   ;;
 
-irix5* | irix6* | nonstopux*)
-  case $LD in
-  *-32|*"-32 ") libmagic=32-bit;;
-  *-n32|*"-n32 ") libmagic=N32;;
-  *-64|*"-64 ") libmagic=64-bit;;
-  *) libmagic=never-match;;
-  esac
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-netbsd*)
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
-  fi
-  ;;
+int
+main ()
+{
 
-newos6*)
-  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
-  lt_cv_file_magic_cmd=/usr/bin/file
-  lt_cv_file_magic_test_file=/usr/lib/libnls.so
-  ;;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_cc_needs_belf=yes
+else
+  lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-*nto* | *qnx*)
-  lt_cv_deplibs_check_method=pass_all
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
   ;;
-
-openbsd*)
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
   fi
+  rm -rf conftest*
   ;;
+esac
 
-osf3* | osf4* | osf5*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+need_locks="$enable_libtool_lock"
 
-rdos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
 
-solaris*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-sysv4 | sysv4.3*)
-  case $host_vendor in
-  motorola)
-    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
-    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
-    ;;
-  ncr)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  sequent)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
-    ;;
-  sni)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
-    lt_cv_file_magic_test_file=/lib/libc.so
-    ;;
-  siemens)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  pc)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  esac
-  ;;
-
-tpf*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-esac
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
-$as_echo "$lt_cv_deplibs_check_method" >&6; }
-file_magic_cmd=$lt_cv_file_magic_cmd
-deplibs_check_method=$lt_cv_deplibs_check_method
-test -z "$deplibs_check_method" && deplibs_check_method=unknown
-
-
-
-
-
-
-
-
-
-
-
-
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$AR"; then
-  ac_cv_prog_AR="$AR" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AR="${ac_tool_prefix}ar"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+  case $host_os in
+    rhapsody* | darwin*)
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DSYMUTIL"; then
+  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
 fi
 fi
-AR=$ac_cv_prog_AR
-if test -n "$AR"; then
-  { $as_echo "$as_me:$LINENO: result: $AR" >&5
-$as_echo "$AR" >&6; }
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 fi
-if test -z "$ac_cv_prog_AR"; then
-  ac_ct_AR=$AR
-  # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+  ac_ct_DSYMUTIL=$DSYMUTIL
+  # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_AR"; then
-  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+  if test -n "$ac_ct_DSYMUTIL"; then
+  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_AR="ar"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_AR=$ac_cv_prog_ac_ct_AR
-if test -n "$ac_ct_AR"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-$as_echo "$ac_ct_AR" >&6; }
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_AR" = x; then
-    AR="false"
+  if test "x$ac_ct_DSYMUTIL" = x; then
+    DSYMUTIL=":"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    AR=$ac_ct_AR
+    DSYMUTIL=$ac_ct_DSYMUTIL
   fi
 else
-  AR="$ac_cv_prog_AR"
+  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
 fi
 
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
-
-
-
-
-
-
-
-
-
-
-
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
+if test "${ac_cv_prog_NMEDIT+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$STRIP"; then
-  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+  if test -n "$NMEDIT"; then
+  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 fi
-if test -z "$ac_cv_prog_STRIP"; then
-  ac_ct_STRIP=$STRIP
-  # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+if test -z "$ac_cv_prog_NMEDIT"; then
+  ac_ct_NMEDIT=$NMEDIT
+  # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_STRIP"; then
-  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+  if test -n "$ac_ct_NMEDIT"; then
+  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_STRIP="strip"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_ac_ct_NMEDIT="nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
+  if test "x$ac_ct_NMEDIT" = x; then
+    NMEDIT=":"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    STRIP=$ac_ct_STRIP
+    NMEDIT=$ac_ct_NMEDIT
   fi
 else
-  STRIP="$ac_cv_prog_STRIP"
+  NMEDIT="$ac_cv_prog_NMEDIT"
 fi
 
-test -z "$STRIP" && STRIP=:
-
-
-
-
-
-
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then
+if test "${ac_cv_prog_LIPO+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+  if test -n "$LIPO"; then
+  ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
-  { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 fi
-if test -z "$ac_cv_prog_RANLIB"; then
-  ac_ct_RANLIB=$RANLIB
-  # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+if test -z "$ac_cv_prog_LIPO"; then
+  ac_ct_LIPO=$LIPO
+  # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_RANLIB"; then
-  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+  if test -n "$ac_ct_LIPO"; then
+  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_RANLIB="ranlib"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_prog_ac_ct_LIPO="lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_RANLIB" = x; then
-    RANLIB=":"
+  if test "x$ac_ct_LIPO" = x; then
+    LIPO=":"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    RANLIB=$ac_ct_RANLIB
+    LIPO=$ac_ct_LIPO
   fi
 else
-  RANLIB="$ac_cv_prog_RANLIB"
+  LIPO="$ac_cv_prog_LIPO"
 fi
 
-test -z "$RANLIB" && RANLIB=:
-
-
-
-
-
-
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
-
-if test -n "$RANLIB"; then
-  case $host_os in
-  openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
-    ;;
-  *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
-    ;;
-  esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
-fi
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL"; then
+  ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+  ac_ct_OTOOL=$OTOOL
+  # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL"; then
+  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OTOOL="otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
+  if test "x$ac_ct_OTOOL" = x; then
+    OTOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL=$ac_ct_OTOOL
+  fi
+else
+  OTOOL="$ac_cv_prog_OTOOL"
+fi
 
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL64"; then
+  ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+  ac_ct_OTOOL64=$OTOOL64
+  # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL64"; then
+  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OTOOL64="otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
+  if test "x$ac_ct_OTOOL64" = x; then
+    OTOOL64=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL64=$ac_ct_OTOOL64
+  fi
+else
+  OTOOL64="$ac_cv_prog_OTOOL64"
+fi
 
 
 
@@ -12541,242 +9226,183 @@ fi
 
 
 
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
 
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
 
-# Allow CC to be a program name with arguments.
-compiler=$CC
 
 
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-{ $as_echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
-$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
-if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&5
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
+  lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+int
+main ()
+{
 
-# Character class describing NM global symbol codes.
-symcode='[BCDEGRST]'
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_ld_exported_symbols_list=yes
+else
+  lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+	LDFLAGS="$save_LDFLAGS"
 
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+    case $host_os in
+    rhapsody* | darwin1.[012])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[012]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
 
-# Define system-specific variables.
-case $host_os in
-aix*)
-  symcode='[BCDT]'
-  ;;
-cygwin* | mingw* | pw32* | cegcc*)
-  symcode='[ABCDGISTW]'
-  ;;
-hpux*)
-  if test "$host_cpu" = ia64; then
-    symcode='[ABCDEGRST]'
-  fi
-  ;;
-irix* | nonstopux*)
-  symcode='[BCDEGRST]'
-  ;;
-osf*)
-  symcode='[BCDEGQRST]'
-  ;;
-solaris*)
-  symcode='[BDRT]'
-  ;;
-sco3.2v5*)
-  symcode='[DT]'
-  ;;
-sysv4.2uw2*)
-  symcode='[DT]'
-  ;;
-sysv5* | sco5v6* | unixware* | OpenUNIX*)
-  symcode='[ABDT]'
-  ;;
-sysv4)
-  symcode='[DFNSTU]'
-  ;;
-esac
+for ac_header in dlfcn.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
 
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
-  symcode='[ABCDGIRSTW]' ;;
-esac
+fi
 
-# Transform an extracted symbol line into a proper C declaration.
-# Some systems (esp. on ia64) link data and code symbols differently,
-# so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+done
 
-# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
-# Handle CRLF in mingw tool chain
-opt_cr=
-case $build_os in
-mingw*)
-  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
-  ;;
-esac
 
-# Try without a prefix underscore, then with it.
-for ac_symprfx in "" "_"; do
+# Set options
 
-  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
-  symxfrm="\\1 $ac_symprfx\\2 \\2"
 
-  # Write the raw and C identifiers.
-  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-    # Fake it for dumpbin and say T for any non-static function
-    # and D for any global variable.
-    # Also find C++ and __fastcall symbols from MSVC++,
-    # which start with @ or ?.
-    lt_cv_sys_global_symbol_pipe="$AWK '"\
-"     {last_section=section; section=\$ 3};"\
-"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
-"     \$ 0!~/External *\|/{next};"\
-"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
-"     {if(hide[section]) next};"\
-"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
-"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
-"     ' prfx=^$ac_symprfx"
-  else
-    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
-  fi
 
-  # Check to see that the pipe works correctly.
-  pipe_works=no
+        enable_dlopen=no
 
-  rm -f conftest*
-  cat > conftest.$ac_ext <<_LT_EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(void);
-void nm_test_func(void){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-_LT_EOF
 
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    # Now try to grab the symbols.
-    nlist=conftest.nm
-    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
-  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s "$nlist"; then
-      # Try sorting and uniquifying the output.
-      if sort "$nlist" | uniq > "$nlist"T; then
-	mv -f "$nlist"T "$nlist"
-      else
-	rm -f "$nlist"T
-      fi
+  enable_win32_dll=no
 
-      # Make sure that we snagged all the symbols we need.
-      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
-	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
-	  cat <<_LT_EOF > conftest.$ac_ext
-#ifdef __cplusplus
-extern "C" {
-#endif
 
-_LT_EOF
-	  # Now generate the symbol file.
-	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+            # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi
 
-	  cat <<_LT_EOF >> conftest.$ac_ext
 
-/* The mapping between symbol names and symbols.  */
-const struct {
-  const char *name;
-  void       *address;
-}
-lt__PROGRAM__LTX_preloaded_symbols[] =
-{
-  { "@PROGRAM@", (void *) 0 },
-_LT_EOF
-	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
-	  cat <<\_LT_EOF >> conftest.$ac_ext
-  {0, (void *) 0}
-};
 
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
-  return lt__PROGRAM__LTX_preloaded_symbols;
-}
-#endif
 
-#ifdef __cplusplus
-}
-#endif
-_LT_EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
-	  LIBS="conftstm.$ac_objext"
-	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
-	  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext}; then
-	    pipe_works=yes
-	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $nlist" >&5
-	fi
-      else
-	echo "cannot find nm_test_var in $nlist" >&5
-      fi
-    else
-      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
-    fi
-  else
-    echo "$progname: failed program was:" >&5
-    cat conftest.$ac_ext >&5
-  fi
-  rm -rf conftest* conftst*
 
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
-    break
-  else
-    lt_cv_sys_global_symbol_pipe=
-  fi
-done
 
-fi
 
-if test -z "$lt_cv_sys_global_symbol_pipe"; then
-  lt_cv_sys_global_symbol_to_cdecl=
-fi
-if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
-  { $as_echo "$as_me:$LINENO: result: failed" >&5
-$as_echo "failed" >&6; }
+
+
+  # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
 else
-  { $as_echo "$as_me:$LINENO: result: ok" >&5
-$as_echo "ok" >&6; }
+  enable_static=yes
 fi
 
 
@@ -12788,8 +9414,15 @@ fi
 
 
 
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+  withval=$with_pic; pic_mode="$withval"
+else
+  pic_mode=default
+fi
 
 
+test -z "$pic_mode" && pic_mode=default
 
 
 
@@ -12797,701 +9430,354 @@ fi
 
 
 
+  # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
 
 
 
-# Check whether --enable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then
-  enableval=$enable_libtool_lock;
-fi
 
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
 
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-ia64-*-hpux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    case `/usr/bin/file conftest.$ac_objext` in
-      *ELF-32*)
-	HPUX_IA64_MODE="32"
-	;;
-      *ELF-64*)
-	HPUX_IA64_MODE="64"
-	;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-*-*-irix6*)
-  # Find out which ABI we are using.
-  echo '#line 12834 "configure"' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    if test "$lt_cv_prog_gnu_ld" = yes; then
-      case `/usr/bin/file conftest.$ac_objext` in
-	*32-bit*)
-	  LD="${LD-ld} -melf32bsmip"
-	  ;;
-	*N32*)
-	  LD="${LD-ld} -melf32bmipn32"
-	  ;;
-	*64-bit*)
-	  LD="${LD-ld} -melf64bmip"
-	;;
-      esac
-    else
-      case `/usr/bin/file conftest.$ac_objext` in
-	*32-bit*)
-	  LD="${LD-ld} -32"
-	  ;;
-	*N32*)
-	  LD="${LD-ld} -n32"
-	  ;;
-	*64-bit*)
-	  LD="${LD-ld} -64"
-	  ;;
-      esac
-    fi
-  fi
-  rm -rf conftest*
-  ;;
 
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    case `/usr/bin/file conftest.o` in
-      *32-bit*)
-	case $host in
-	  x86_64-*kfreebsd*-gnu)
-	    LD="${LD-ld} -m elf_i386_fbsd"
-	    ;;
-	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_i386"
-	    ;;
-	  ppc64-*linux*|powerpc64-*linux*)
-	    LD="${LD-ld} -m elf32ppclinux"
-	    ;;
-	  s390x-*linux*)
-	    LD="${LD-ld} -m elf_s390"
-	    ;;
-	  sparc64-*linux*)
-	    LD="${LD-ld} -m elf32_sparc"
-	    ;;
-	esac
-	;;
-      *64-bit*)
-	case $host in
-	  x86_64-*kfreebsd*-gnu)
-	    LD="${LD-ld} -m elf_x86_64_fbsd"
-	    ;;
-	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_x86_64"
-	    ;;
-	  ppc*-*linux*|powerpc*-*linux*)
-	    LD="${LD-ld} -m elf64ppc"
-	    ;;
-	  s390*-*linux*|s390*-*tpf*)
-	    LD="${LD-ld} -m elf64_s390"
-	    ;;
-	  sparc*-*linux*)
-	    LD="${LD-ld} -m elf64_sparc"
-	    ;;
-	esac
-	;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
 
-*-*-sco3.2v5*)
-  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -belf"
-  { $as_echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
-$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
-if test "${lt_cv_cc_needs_belf+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-     cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  lt_cv_cc_needs_belf=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	lt_cv_cc_needs_belf=no
-fi
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-     ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
-$as_echo "$lt_cv_cc_needs_belf" >&6; }
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
-    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
-  fi
-  ;;
-sparc*-*solaris*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    case `/usr/bin/file conftest.o` in
-    *64-bit*)
-      case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
-      *)
-	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-	  LD="${LD-ld} -64"
-	fi
-	;;
-      esac
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-esac
 
-need_locks="$enable_libtool_lock"
 
 
-  case $host_os in
-    rhapsody* | darwin*)
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_DSYMUTIL+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$DSYMUTIL"; then
-  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-fi
-fi
-DSYMUTIL=$ac_cv_prog_DSYMUTIL
-if test -n "$DSYMUTIL"; then
-  { $as_echo "$as_me:$LINENO: result: $DSYMUTIL" >&5
-$as_echo "$DSYMUTIL" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
 fi
-if test -z "$ac_cv_prog_DSYMUTIL"; then
-  ac_ct_DSYMUTIL=$DSYMUTIL
-  # Extract the first word of "dsymutil", so it can be a program name with args.
-set dummy dsymutil; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if test "${lt_cv_objdir+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_DSYMUTIL"; then
-  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
 else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
 fi
-ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
-if test -n "$ac_ct_DSYMUTIL"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5
-$as_echo "$ac_ct_DSYMUTIL" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+rmdir .libs 2>/dev/null
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
 
-  if test "x$ac_ct_DSYMUTIL" = x; then
-    DSYMUTIL=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    DSYMUTIL=$ac_ct_DSYMUTIL
-  fi
-else
-  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
-fi
 
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
-set dummy ${ac_tool_prefix}nmedit; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_NMEDIT+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$NMEDIT"; then
-  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-fi
-fi
-NMEDIT=$ac_cv_prog_NMEDIT
-if test -n "$NMEDIT"; then
-  { $as_echo "$as_me:$LINENO: result: $NMEDIT" >&5
-$as_echo "$NMEDIT" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
 
-fi
-if test -z "$ac_cv_prog_NMEDIT"; then
-  ac_ct_NMEDIT=$NMEDIT
-  # Extract the first word of "nmedit", so it can be a program name with args.
-set dummy nmedit; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_NMEDIT"; then
-  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_NMEDIT="nmedit"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
 
-fi
-fi
-ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
-if test -n "$ac_ct_NMEDIT"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5
-$as_echo "$ac_ct_NMEDIT" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
-  if test "x$ac_ct_NMEDIT" = x; then
-    NMEDIT=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    NMEDIT=$ac_ct_NMEDIT
-  fi
-else
-  NMEDIT="$ac_cv_prog_NMEDIT"
-fi
 
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
-set dummy ${ac_tool_prefix}lipo; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LIPO+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$LIPO"; then
-  ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-fi
-fi
-LIPO=$ac_cv_prog_LIPO
-if test -n "$LIPO"; then
-  { $as_echo "$as_me:$LINENO: result: $LIPO" >&5
-$as_echo "$LIPO" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
 
-fi
-if test -z "$ac_cv_prog_LIPO"; then
-  ac_ct_LIPO=$LIPO
-  # Extract the first word of "lipo", so it can be a program name with args.
-set dummy lipo; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_LIPO"; then
-  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_LIPO="lipo"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-fi
-fi
-ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
-if test -n "$ac_ct_LIPO"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_LIPO" >&5
-$as_echo "$ac_ct_LIPO" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
-  if test "x$ac_ct_LIPO" = x; then
-    LIPO=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    LIPO=$ac_ct_LIPO
-  fi
-else
-  LIPO="$ac_cv_prog_LIPO"
-fi
 
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}otool; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$OTOOL"; then
-  ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-fi
-fi
-OTOOL=$ac_cv_prog_OTOOL
-if test -n "$OTOOL"; then
-  { $as_echo "$as_me:$LINENO: result: $OTOOL" >&5
-$as_echo "$OTOOL" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
 
-fi
-if test -z "$ac_cv_prog_OTOOL"; then
-  ac_ct_OTOOL=$OTOOL
-  # Extract the first word of "otool", so it can be a program name with args.
-set dummy otool; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_OTOOL"; then
-  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_OTOOL="otool"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-fi
-fi
-ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
-if test -n "$ac_ct_OTOOL"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL" >&5
-$as_echo "$ac_ct_OTOOL" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
-  if test "x$ac_ct_OTOOL" = x; then
-    OTOOL=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    OTOOL=$ac_ct_OTOOL
-  fi
-else
-  OTOOL="$ac_cv_prog_OTOOL"
-fi
 
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
-set dummy ${ac_tool_prefix}otool64; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OTOOL64+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$OTOOL64"; then
-  ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
   fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
 done
-done
-IFS=$as_save_IFS
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
 fi
-fi
-OTOOL64=$ac_cv_prog_OTOOL64
-if test -n "$OTOOL64"; then
-  { $as_echo "$as_me:$LINENO: result: $OTOOL64" >&5
-$as_echo "$OTOOL64" >&6; }
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-fi
-if test -z "$ac_cv_prog_OTOOL64"; then
-  ac_ct_OTOOL64=$OTOOL64
-  # Extract the first word of "otool64", so it can be a program name with args.
-set dummy otool64; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_OTOOL64"; then
-  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_OTOOL64="otool64"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
 
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
 fi
-fi
-ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
-if test -n "$ac_ct_OTOOL64"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL64" >&5
-$as_echo "$ac_ct_OTOOL64" >&6; }
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_OTOOL64" = x; then
-    OTOOL64=":"
+
   else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    OTOOL64=$ac_ct_OTOOL64
+    MAGIC_CMD=:
   fi
-else
-  OTOOL64="$ac_cv_prog_OTOOL64"
 fi
 
+  fi
+  ;;
+esac
 
+# Use C for the default configuration in the libtool script
 
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+# Source file extension for C test sources.
+ac_ext=c
 
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
 
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
 
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
 
 
 
@@ -13499,321 +9785,478 @@ fi
 
 
 
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
 
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
 
+# Allow CC to be a program name with arguments.
+compiler=$CC
 
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
 
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
 
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
 
 
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
 
+lt_prog_compiler_no_builtin_flag=
 
-
-
-
-    { $as_echo "$as_me:$LINENO: checking for -single_module linker flag" >&5
-$as_echo_n "checking for -single_module linker flag... " >&6; }
-if test "${lt_cv_apple_cc_single_mod+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
-	# By default we will add the -single_module flag. You can override
-	# by either setting the environment variable LT_MULTI_MODULE
-	# non-empty at configure time, or by adding -multi_module to the
-	# link flags.
-	rm -rf libconftest.dylib*
-	echo "int foo(void){return 1;}" > conftest.c
-	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
--dynamiclib -Wl,-single_module conftest.c" >&5
-	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
-        _lt_result=$?
-	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
-	  lt_cv_apple_cc_single_mod=yes
-	else
-	  cat conftest.err >&5
-	fi
-	rm -rf libconftest.dylib*
-	rm -f conftest.*
-      fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
-$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
-    { $as_echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5
-$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
-if test "${lt_cv_ld_exported_symbols_list+set}" = set; then
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  lt_cv_ld_exported_symbols_list=no
-      save_LDFLAGS=$LDFLAGS
-      echo "_main" > conftest.sym
-      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  lt_cv_prog_compiler_rtti_exceptions=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:9844: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:9848: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $RM conftest*
 
-int
-main ()
-{
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  lt_cv_ld_exported_symbols_list=yes
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+    :
+fi
 
-	lt_cv_ld_exported_symbols_list=no
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-	LDFLAGS="$save_LDFLAGS"
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5
-$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
-    case $host_os in
-    rhapsody* | darwin1.[012])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
-    darwin1.*)
-      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-	10.0,*86*-darwin8*|10.0,*-darwin[91]*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-	10.[012]*)
-	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-	10.*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-      esac
-    ;;
-  esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
-      _lt_dar_single_mod='$single_module'
-    fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
-    else
-      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
-    fi
-    if test "$DSYMUTIL" != ":"; then
-      _lt_dsymutil='~$DSYMUTIL $lib || :'
-    else
-      _lt_dsymutil=
-    fi
-    ;;
-  esac
 
 
-for ac_header in dlfcn.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
 
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	eval "$as_ac_Header=no"
-fi
+  lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
-fi
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
 
-done
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
 
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
 
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
 
-# Set options
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
 
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
 
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='-fPIC'
+	;;
+      esac
+      ;;
 
-        enable_dlopen=no
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
 
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
 
-  enable_win32_dll=no
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
 
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
 
-            # Check whether --enable-shared was given.
-if test "${enable_shared+set}" = set; then
-  enableval=$enable_shared; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_shared=yes ;;
-    no) enable_shared=no ;;
     *)
-      enable_shared=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
+      lt_prog_compiler_pic='-fPIC'
       ;;
     esac
-else
-  enable_shared=yes
-fi
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      else
+	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
 
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
 
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
 
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
 
+    linux* | k*bsd*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-KPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='--shared'
+	lt_prog_compiler_static='--static'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fpic'
+	lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      xl*)
+	# IBM XL C 8.0/Fortran 10.1 on PPC
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-qpic'
+	lt_prog_compiler_static='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
 
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
 
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
 
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
 
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
 
-  # Check whether --enable-static was given.
-if test "${enable_static+set}" = set; then
-  enableval=$enable_static; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_static=yes ;;
-    no) enable_static=no ;;
-    *)
-     enable_static=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_static=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic='-Kconform_pic'
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
       ;;
-    esac
-else
-  enable_static=yes
-fi
 
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
 
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
 
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
 
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
 
 
 
 
 
 
-# Check whether --with-pic was given.
-if test "${with_pic+set}" = set; then
-  withval=$with_pic; pic_mode="$withval"
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  pic_mode=default
-fi
+  lt_cv_prog_compiler_pic_works=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:10183: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:10187: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works=yes
+     fi
+   fi
+   $RM conftest*
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
 
-test -z "$pic_mode" && pic_mode=default
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
 
+fi
 
 
 
 
 
 
-  # Check whether --enable-fast-install was given.
-if test "${enable_fast_install+set}" = set; then
-  enableval=$enable_fast_install; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_fast_install=yes ;;
-    no) enable_fast_install=no ;;
-    *)
-      enable_fast_install=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_fast_install=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  enable_fast_install=yes
-fi
-
+  lt_cv_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
 
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
 
 
 
@@ -13821,801 +10264,1250 @@ fi
 
 
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:10288: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:10292: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
 
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
 
 
 
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:10343: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:10347: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
 
 
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
 
 
 
 
 
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
 
+  runpath_var=
+  allow_undefined_flag=
+  always_export_symbols=no
+  archive_cmds=
+  archive_expsym_cmds=
+  compiler_needs_object=no
+  enable_shared_with_static_runtimes=no
+  export_dynamic_flag_spec=
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  hardcode_automatic=no
+  hardcode_direct=no
+  hardcode_direct_absolute=no
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  inherit_rpath=no
+  link_all_deplibs=unknown
+  module_cmds=
+  module_expsym_cmds=
+  old_archive_from_new_cmds=
+  old_archive_from_expsyms_cmds=
+  thread_safe_flag_spec=
+  whole_archive_flag_spec=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
 
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  esac
 
+  ld_shlibs=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
 
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
 
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
 
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
 
-test -z "$LN_S" && LN_S="ln -s"
+_LT_EOF
+      fi
+      ;;
 
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
 
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
 
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
 
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
 
+    gnu* | linux* | tpf* | k*bsd*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  whole_archive_flag_spec=
+	  tmp_sharedflag='--shared' ;;
+	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 
+        if test "x$supports_anon_versioning" = xyes; then
+          archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
 
+	case $cc_basename in
+	xlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+	  hardcode_libdir_flag_spec=
+	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
+	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        ld_shlibs=no
+      fi
+      ;;
 
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
 
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
 
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
 
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
 
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
 
-if test -n "${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
-fi
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
 
-{ $as_echo "$as_me:$LINENO: checking for objdir" >&5
-$as_echo_n "checking for objdir... " >&6; }
-if test "${lt_cv_objdir+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
-  lt_cv_objdir=.libs
-else
-  # MS-DOS does not allow filenames that begin with a dot.
-  lt_cv_objdir=_libs
-fi
-rmdir .libs 2>/dev/null
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
-$as_echo "$lt_cv_objdir" >&6; }
-objdir=$lt_cv_objdir
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    ld_shlibs=no
+	  fi
+	;;
+      esac
+      ;;
 
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
 
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+    esac
 
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct=unsupported
+      fi
+      ;;
 
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
 
-cat >>confdefs.h <<_ACEOF
-#define LT_OBJDIR "$lt_cv_objdir/"
-_ACEOF
-
-
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
 
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
 
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
 
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_direct_absolute=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      file_list_spec='${wl}-f,'
 
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
 
+      export_dynamic_flag_spec='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
 
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag="-z nodefs"
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
 
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
+	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag=' ${wl}-bernotok'
+	  allow_undefined_flag=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec='$convenience'
+	  archive_cmds_need_lc=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
 
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
 
-case $host_os in
-aix3*)
-  # AIX sometimes has problems with the GCC collect2 program.  For some
-  # reason, if we set the COLLECT_NAMES environment variable, the problems
-  # vanish in a puff of smoke.
-  if test "X${COLLECT_NAMES+set}" != Xset; then
-    COLLECT_NAMES=
-    export COLLECT_NAMES
-  fi
-  ;;
-esac
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_from_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
+      ;;
 
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
+    darwin* | rhapsody*)
 
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
 
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+  archive_cmds_need_lc=no
+  hardcode_direct=no
+  hardcode_automatic=yes
+  hardcode_shlibpath_var=unsupported
+  whole_archive_flag_spec=''
+  link_all_deplibs=yes
+  allow_undefined_flag="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=echo
+    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
 
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
+  else
+  ld_shlibs=no
+  fi
 
-# Global variables:
-ofile=libtool
-can_build_shared=yes
+      ;;
 
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
 
-with_gnu_ld="$lt_cv_prog_gnu_ld"
+    freebsd1*)
+      ld_shlibs=no
+      ;;
 
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
 
-# Set sane defaults for various variables
-test -z "$CC" && CC=cc
-test -z "$LTCC" && LTCC=$CC
-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-test -z "$LD" && LD=ld
-test -z "$ac_objext" && ac_objext=o
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
 
-for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
 
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
 
-# Only perform the check for file, if the check method requires it
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
-case $deplibs_check_method in
-file_magic*)
-  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    { $as_echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
-$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  case $MAGIC_CMD in
-[\\/*] |  ?:[\\/]*)
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
-  ;;
-*)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
-  for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/${ac_tool_prefix}file; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
-      if test -n "$file_magic_test_file"; then
-	case $deplibs_check_method in
-	"file_magic "*)
-	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-	    $EGREP "$file_magic_regex" > /dev/null; then
-	    :
-	  else
-	    cat <<_LT_EOF 1>&2
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
 
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool at gnu.org
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_flag_spec_ld='+b $libdir'
+	hardcode_libdir_separator=:
+	hardcode_direct=yes
+	hardcode_direct_absolute=yes
+	export_dynamic_flag_spec='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L=yes
+      fi
+      ;;
 
-_LT_EOF
-	  fi ;;
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
 	esac
       fi
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
-  ;;
-esac
-fi
-
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
-  { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-$as_echo "$MAGIC_CMD" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-
-
-if test -z "$lt_cv_path_MAGIC_CMD"; then
-  if test -n "$ac_tool_prefix"; then
-    { $as_echo "$as_me:$LINENO: checking for file" >&5
-$as_echo_n "checking for file... " >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  case $MAGIC_CMD in
-[\\/*] |  ?:[\\/]*)
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
-  ;;
-*)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
-  for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/file; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/file"
-      if test -n "$file_magic_test_file"; then
-	case $deplibs_check_method in
-	"file_magic "*)
-	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-	    $EGREP "$file_magic_regex" > /dev/null; then
-	    :
-	  else
-	    cat <<_LT_EOF 1>&2
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
 
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool at gnu.org
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_direct=no
+	  hardcode_shlibpath_var=no
+	  ;;
+	*)
+	  hardcode_direct=yes
+	  hardcode_direct_absolute=yes
+	  export_dynamic_flag_spec='${wl}-E'
 
-_LT_EOF
-	  fi ;;
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L=yes
+	  ;;
 	esac
       fi
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
-  ;;
-esac
-fi
-
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
-  { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-$as_echo "$MAGIC_CMD" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
+      ;;
 
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int foo(void) {}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
 
-  else
-    MAGIC_CMD=:
-  fi
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+        LDFLAGS="$save_LDFLAGS"
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      inherit_rpath=yes
+      link_all_deplibs=yes
+      ;;
 
-  fi
-  ;;
-esac
-
-# Use C for the default configuration in the libtool script
+    netbsd*)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
 
-lt_save_CC="$CC"
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
 
+    *nto* | *qnx*)
+      ;;
 
-# Source file extension for C test sources.
-ac_ext=c
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct=yes
+	hardcode_shlibpath_var=no
+	hardcode_direct_absolute=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	ld_shlibs=no
+      fi
+      ;;
 
-# Object file extension for compiled C test sources.
-objext=o
-objext=$objext
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
 
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
 
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_separator=:
+      ;;
 
+    solaris*)
+      no_undefined_flag=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs=yes
+      ;;
 
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
 
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds='$CC -r -o $output$reload_objs'
+	  hardcode_direct=no
+        ;;
+	motorola)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
 
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
 
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs=yes
+      fi
+      ;;
 
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
 
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
 
-# Allow CC to be a program name with arguments.
-compiler=$CC
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-R,$libdir'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
 
-# Save the default compiler, since it gets overwritten when the other
-# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
-compiler_DEFAULT=$CC
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
 
-# save warnings/boilerplate of simple test code
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$RM conftest*
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
 
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$RM -r conftest*
+    *)
+      ld_shlibs=no
+      ;;
+    esac
 
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	export_dynamic_flag_spec='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
 
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
-if test -n "$compiler"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
 
-lt_prog_compiler_no_builtin_flag=
+with_gnu_ld=$with_gnu_ld
 
-if test "$GCC" = yes; then
-  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
 
-  { $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_rtti_exceptions=no
-   ac_outfile=conftest.$ac_objext
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="-fno-rtti -fno-exceptions"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14203: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:14207: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_rtti_exceptions=yes
-     fi
-   fi
-   $RM conftest*
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
 
-if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
-    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
-else
-    :
-fi
 
-fi
 
 
 
 
 
 
-  lt_prog_compiler_wl=
-lt_prog_compiler_pic=
-lt_prog_compiler_static=
 
-{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
-  if test "$GCC" = yes; then
-    lt_prog_compiler_wl='-Wl,'
-    lt_prog_compiler_static='-static'
 
-    case $host_os in
-      aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static='-Bstatic'
-      fi
-      ;;
 
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            lt_prog_compiler_pic='-fPIC'
-        ;;
-      m68k)
-            # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
-            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
-        ;;
-      esac
-      ;;
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
 
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
       ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+      $RM conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      lt_prog_compiler_pic='-DDLL_EXPORT'
+      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+	pic_flag=$lt_prog_compiler_pic
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+        then
+	  archive_cmds_need_lc=no
+        else
+	  archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
+$as_echo "$archive_cmds_need_lc" >&6; }
       ;;
+    esac
+  fi
+  ;;
+esac
 
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      lt_prog_compiler_pic='-fno-common'
-      ;;
 
-    hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
-      case $host_cpu in
-      hppa*64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic='-fPIC'
-	;;
-      esac
-      ;;
 
-    interix[3-9]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
 
-    msdosdjgpp*)
-      # Just because we use GCC doesn't mean we suddenly get shared libraries
-      # on systems that don't support them.
-      lt_prog_compiler_can_build_shared=no
-      enable_shared=no
-      ;;
 
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      lt_prog_compiler_pic='-fPIC -shared'
-      ;;
 
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	lt_prog_compiler_pic=-Kconform_pic
-      fi
-      ;;
 
-    *)
-      lt_prog_compiler_pic='-fPIC'
-      ;;
-    esac
-  else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      lt_prog_compiler_wl='-Wl,'
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static='-Bstatic'
-      else
-	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
 
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      lt_prog_compiler_pic='-DDLL_EXPORT'
-      ;;
 
-    hpux9* | hpux10* | hpux11*)
-      lt_prog_compiler_wl='-Wl,'
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic='+Z'
-	;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      lt_prog_compiler_static='${wl}-a ${wl}archive'
-      ;;
 
-    irix5* | irix6* | nonstopux*)
-      lt_prog_compiler_wl='-Wl,'
-      # PIC (with -KPIC) is the default.
-      lt_prog_compiler_static='-non_shared'
-      ;;
 
-    linux* | k*bsd*-gnu)
-      case $cc_basename in
-      # old Intel for x86_64 which still supported -KPIC.
-      ecc*)
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='-KPIC'
-	lt_prog_compiler_static='-static'
-        ;;
-      # icc used to be incompatible with GCC.
-      # ICC 10 doesn't accept -KPIC any more.
-      icc* | ifort*)
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='-fPIC'
-	lt_prog_compiler_static='-static'
-        ;;
-      # Lahey Fortran 8.1.
-      lf95*)
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='--shared'
-	lt_prog_compiler_static='--static'
-	;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-	# which looks to be a dead project)
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='-fpic'
-	lt_prog_compiler_static='-Bstatic'
-        ;;
-      ccc*)
-        lt_prog_compiler_wl='-Wl,'
-        # All Alpha code is PIC.
-        lt_prog_compiler_static='-non_shared'
-        ;;
-      xl*)
-	# IBM XL C 8.0/Fortran 10.1 on PPC
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='-qpic'
-	lt_prog_compiler_static='-qstaticlink'
-	;;
-      *)
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
-	  lt_prog_compiler_pic='-KPIC'
-	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl='-Wl,'
-	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  lt_prog_compiler_pic='-KPIC'
-	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl=''
-	  ;;
-	esac
-	;;
-      esac
-      ;;
 
-    newsos6)
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
 
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      lt_prog_compiler_pic='-fPIC -shared'
-      ;;
 
-    osf3* | osf4* | osf5*)
-      lt_prog_compiler_wl='-Wl,'
-      # All OSF/1 code is PIC.
-      lt_prog_compiler_static='-non_shared'
-      ;;
 
-    rdos*)
-      lt_prog_compiler_static='-non_shared'
-      ;;
 
-    solaris*)
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95*)
-	lt_prog_compiler_wl='-Qoption ld ';;
-      *)
-	lt_prog_compiler_wl='-Wl,';;
-      esac
-      ;;
 
-    sunos4*)
-      lt_prog_compiler_wl='-Qoption ld '
-      lt_prog_compiler_pic='-PIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
 
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      lt_prog_compiler_wl='-Wl,'
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
 
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	lt_prog_compiler_pic='-Kconform_pic'
-	lt_prog_compiler_static='-Bstatic'
-      fi
-      ;;
 
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      lt_prog_compiler_wl='-Wl,'
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
 
-    unicos*)
-      lt_prog_compiler_wl='-Wl,'
-      lt_prog_compiler_can_build_shared=no
-      ;;
 
-    uts4*)
-      lt_prog_compiler_pic='-pic'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
 
-    *)
-      lt_prog_compiler_can_build_shared=no
-      ;;
-    esac
-  fi
 
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    lt_prog_compiler_pic=
-    ;;
-  *)
-    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
-$as_echo "$lt_prog_compiler_pic" >&6; }
 
 
 
 
 
 
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$lt_prog_compiler_pic"; then
-  { $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
-$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
-if test "${lt_cv_prog_compiler_pic_works+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_pic_works=no
-   ac_outfile=conftest.$ac_objext
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14542: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:14546: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_pic_works=yes
-     fi
-   fi
-   $RM conftest*
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5
-$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
 
-if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
-    case $lt_prog_compiler_pic in
-     "" | " "*) ;;
-     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
-     esac
-else
-    lt_prog_compiler_pic=
-     lt_prog_compiler_can_build_shared=no
-fi
 
-fi
 
 
 
 
 
 
-#
-# Check to make sure the static flag actually works.
-#
-wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
-{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
-if test "${lt_cv_prog_compiler_static_works+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_static_works=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&5
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler_static_works=yes
-       fi
-     else
-       lt_cv_prog_compiler_static_works=yes
-     fi
-   fi
-   $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5
-$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
 
-if test x"$lt_cv_prog_compiler_static_works" = xyes; then
-    :
-else
-    lt_prog_compiler_static=
-fi
 
 
 
@@ -14623,1738 +11515,399 @@ fi
 
 
 
-  { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_c_o=no
-   $RM -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14647: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:14651: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o=yes
-     fi
-   fi
-   chmod u+w . 2>&5
-   $RM conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
-   $RM out/* && rmdir out
-   cd ..
-   $RM -r conftest
-   $RM conftest*
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
 
 
 
 
-  { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_c_o=no
-   $RM -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14702: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:14706: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o=yes
-     fi
-   fi
-   chmod u+w . 2>&5
-   $RM conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
-   $RM out/* && rmdir out
-   cd ..
-   $RM -r conftest
-   $RM conftest*
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
 
 
-hard_links="nottested"
-if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-$as_echo_n "checking if we can lock with hard links... " >&6; }
-  hard_links=yes
-  $RM conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
-$as_echo "$hard_links" >&6; }
-  if test "$hard_links" = no; then
-    { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
-    need_locks=warn
-  fi
-else
-  need_locks=no
-fi
 
 
 
 
 
 
-  { $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
 
-  runpath_var=
-  allow_undefined_flag=
-  always_export_symbols=no
-  archive_cmds=
-  archive_expsym_cmds=
-  compiler_needs_object=no
-  enable_shared_with_static_runtimes=no
-  export_dynamic_flag_spec=
-  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  hardcode_automatic=no
-  hardcode_direct=no
-  hardcode_direct_absolute=no
-  hardcode_libdir_flag_spec=
-  hardcode_libdir_flag_spec_ld=
-  hardcode_libdir_separator=
-  hardcode_minus_L=no
-  hardcode_shlibpath_var=unsupported
-  inherit_rpath=no
-  link_all_deplibs=unknown
-  module_cmds=
-  module_expsym_cmds=
-  old_archive_from_new_cmds=
-  old_archive_from_expsyms_cmds=
-  thread_safe_flag_spec=
-  whole_archive_flag_spec=
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  include_expsyms=
-  # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
-  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-  # platforms (ab)use it in PIC code, but their linkers get confused if
-  # the symbol is explicitly referenced.  Since portable code cannot
-  # rely on this symbol name, it's probably fine to never include it in
-  # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-  extract_expsyms_cmds=
 
-  case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    if test "$GCC" != yes; then
-      with_gnu_ld=no
-    fi
-    ;;
-  interix*)
-    # we just hope/assume this is gcc and not c89 (= MSVC++)
-    with_gnu_ld=yes
-    ;;
-  openbsd*)
-    with_gnu_ld=no
-    ;;
-  esac
 
-  ld_shlibs=yes
-  if test "$with_gnu_ld" = yes; then
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
 
-    # Set some defaults for GNU ld with shared library support. These
-    # are reset later if shared libraries are not supported. Putting them
-    # here allows them to be overridden if necessary.
-    runpath_var=LD_RUN_PATH
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-    export_dynamic_flag_spec='${wl}--export-dynamic'
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-    else
-      whole_archive_flag_spec=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>&1` in
-      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-      *\ 2.11.*) ;; # other 2.11 versions
-      *) supports_anon_versioning=yes ;;
-    esac
 
-    # See if GNU ld supports shared libraries.
-    case $host_os in
-    aix[3-9]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	ld_shlibs=no
-	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
 
-_LT_EOF
-      fi
-      ;;
 
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            archive_expsym_cmds=''
-        ;;
-      m68k)
-            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            hardcode_libdir_flag_spec='-L$libdir'
-            hardcode_minus_L=yes
-        ;;
-      esac
-      ;;
 
-    beos*)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	allow_undefined_flag=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	# support --undefined.  This deserves some investigation.  FIXME
-	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-	ld_shlibs=no
-      fi
-      ;;
 
-    cygwin* | mingw* | pw32* | cegcc*)
-      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
-      # as there is no search path for DLLs.
-      hardcode_libdir_flag_spec='-L$libdir'
-      allow_undefined_flag=unsupported
-      always_export_symbols=no
-      enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 
-      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      else
-	ld_shlibs=no
-      fi
-      ;;
 
-    interix[3-9]*)
-      hardcode_direct=no
-      hardcode_shlibpath_var=no
-      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-      export_dynamic_flag_spec='${wl}-E'
-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-      # Instead, shared libraries are loaded at an image base (0x10000000 by
-      # default) and relocated if they conflict, which is a slow very memory
-      # consuming and fragmenting process.  To avoid this, we pick a random,
-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      ;;
 
-    gnu* | linux* | tpf* | k*bsd*-gnu)
-      tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
-	case $cc_basename in
-	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
-	esac
-      fi
-      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-	 && test "$tmp_diet" = no
-      then
-	tmp_addflag=
-	tmp_sharedflag='-shared'
-	case $cc_basename,$host_cpu in
-        pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
-	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
-	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
-	  tmp_addflag=' -nofor_main' ;;
-	lf95*)				# Lahey Fortran 8.1
-	  whole_archive_flag_spec=
-	  tmp_sharedflag='--shared' ;;
-	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
-	  tmp_sharedflag='-qmkshrobj'
-	  tmp_addflag= ;;
-	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
-	  compiler_needs_object=yes
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	esac
-	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 
-        if test "x$supports_anon_versioning" = xyes; then
-          archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
-	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	    echo "local: *; };" >> $output_objdir/$libname.ver~
-	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-        fi
 
-	case $cc_basename in
-	xlf*)
-	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
-	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec=
-	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
-	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
-	  if test "x$supports_anon_versioning" = xyes; then
-	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
-	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
-	  fi
-	  ;;
-	esac
-      else
-        ld_shlibs=no
-      fi
-      ;;
 
-    netbsd*)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
-      ;;
 
-    solaris*)
-      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
-	ld_shlibs=no
-	cat <<_LT_EOF 1>&2
 
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
 
-_LT_EOF
-      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	ld_shlibs=no
-      fi
-      ;;
 
-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
-      case `$LD -v 2>&1` in
-        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
-	ld_shlibs=no
-	cat <<_LT_EOF 1>&2
 
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
 
-_LT_EOF
-	;;
-	*)
-	  # For security reasons, it is highly recommended that you always
-	  # use absolute paths for naming shared libraries, and exclude the
-	  # DT_RUNPATH tag from executables and libraries.  But doing so
-	  # requires that you compile everything twice, which is a pain.
-	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-	  else
-	    ld_shlibs=no
-	  fi
-	;;
-      esac
-      ;;
 
-    sunos4*)
-      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    *)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	ld_shlibs=no
-      fi
-      ;;
-    esac
 
-    if test "$ld_shlibs" = no; then
-      runpath_var=
-      hardcode_libdir_flag_spec=
-      export_dynamic_flag_spec=
-      whole_archive_flag_spec=
-    fi
-  else
-    # PORTME fill in a description of your system's linker (not GNU ld)
-    case $host_os in
-    aix3*)
-      allow_undefined_flag=unsupported
-      always_export_symbols=yes
-      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-      # Note: this linker hardcodes the directories in LIBPATH if there
-      # are no directories specified by -L.
-      hardcode_minus_L=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
-	# Neither direct hardcoding nor static linking is supported with a
-	# broken collect2.
-	hardcode_direct=unsupported
-      fi
-      ;;
 
-    aix[4-9]*)
-      if test "$host_cpu" = ia64; then
-	# On IA64, the linker does run time linking by default, so we don't
-	# have to do anything special.
-	aix_use_runtimelinking=no
-	exp_sym_flag='-Bexport'
-	no_entry_flag=""
-      else
-	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	else
-	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	fi
-	aix_use_runtimelinking=no
 
-	# Test if we are trying to use run time linking or normal
-	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
-	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
-	  for ld_flag in $LDFLAGS; do
-	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
-	    aix_use_runtimelinking=yes
-	    break
-	  fi
-	  done
-	  ;;
-	esac
 
-	exp_sym_flag='-bexport'
-	no_entry_flag='-bnoentry'
-      fi
 
-      # When large executables or shared objects are built, AIX ld can
-      # have problems creating the table of contents.  If linking a library
-      # or program results in "error TOC overflow" add -mminimal-toc to
-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
 
-      archive_cmds=''
-      hardcode_direct=yes
-      hardcode_direct_absolute=yes
-      hardcode_libdir_separator=':'
-      link_all_deplibs=yes
-      file_list_spec='${wl}-f,'
 
-      if test "$GCC" = yes; then
-	case $host_os in aix4.[012]|aix4.[012].*)
-	# We only want to do this on AIX 4.2 and lower, the check
-	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" &&
-	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
-	  then
-	  # We have reworked collect2
-	  :
-	  else
-	  # We have old collect2
-	  hardcode_direct=unsupported
-	  # It fails to find uninstalled libraries when the uninstalled
-	  # path is not listed in the libpath.  Setting hardcode_minus_L
-	  # to unsupported forces relinking
-	  hardcode_minus_L=yes
-	  hardcode_libdir_flag_spec='-L$libdir'
-	  hardcode_libdir_separator=
-	  fi
-	  ;;
-	esac
-	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
-	fi
-      else
-	# not using gcc
-	if test "$host_cpu" = ia64; then
-	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-	# chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
-	  else
-	    shared_flag='${wl}-bM:SRE'
-	  fi
-	fi
-      fi
 
-      export_dynamic_flag_spec='${wl}-bexpall'
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      always_export_symbols=yes
-      if test "$aix_use_runtimelinking" = yes; then
-	# Warning - without using the other runtime loading flags (-brtl),
-	# -berok will link without error, but may produce a broken library.
-	allow_undefined_flag='-berok'
-        # Determine the default libpath from the value encoded in an
-        # empty executable.
-        cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
-        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-      else
-	if test "$host_cpu" = ia64; then
-	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
-	  allow_undefined_flag="-z nodefs"
-	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-	else
-	 # Determine the default libpath from the value encoded in an
-	 # empty executable.
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
 
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
-	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-	  # Warning - without using the other run time loading flags,
-	  # -berok will link without error, but may produce a broken library.
-	  no_undefined_flag=' ${wl}-bernotok'
-	  allow_undefined_flag=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec='$convenience'
-	  archive_cmds_need_lc=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-	fi
-      fi
-      ;;
 
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            archive_expsym_cmds=''
-        ;;
-      m68k)
-            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            hardcode_libdir_flag_spec='-L$libdir'
-            hardcode_minus_L=yes
-        ;;
-      esac
-      ;;
 
-    bsdi[45]*)
-      export_dynamic_flag_spec=-rdynamic
-      ;;
 
-    cygwin* | mingw* | pw32* | cegcc*)
-      # When not using gcc, we currently assume that we are using
-      # Microsoft Visual C++.
-      # hardcode_libdir_flag_spec is actually meaningless, as there is
-      # no search path for DLLs.
-      hardcode_libdir_flag_spec=' '
-      allow_undefined_flag=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_from_new_cmds='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes=yes
-      ;;
 
-    darwin* | rhapsody*)
 
 
-  archive_cmds_need_lc=no
-  hardcode_direct=no
-  hardcode_automatic=yes
-  hardcode_shlibpath_var=unsupported
-  whole_archive_flag_spec=''
-  link_all_deplibs=yes
-  allow_undefined_flag="$_lt_dar_allow_undefined"
-  case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
-     *) _lt_dar_can_shared=$GCC ;;
-  esac
-  if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=echo
-    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
 
-  else
-  ld_shlibs=no
-  fi
 
-      ;;
 
-    dgux*)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_shlibpath_var=no
-      ;;
 
-    freebsd1*)
-      ld_shlibs=no
-      ;;
 
-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-    # support.  Future versions do this automatically, but an explicit c++rt0.o
-    # does not break anything, and helps significantly (at the cost of a little
-    # extra space).
-    freebsd2.2*)
-      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      hardcode_libdir_flag_spec='-R$libdir'
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
-      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct=yes
-      hardcode_minus_L=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-      hardcode_libdir_flag_spec='-R$libdir'
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    hpux9*)
-      if test "$GCC" = yes; then
-	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      fi
-      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-      hardcode_libdir_separator=:
-      hardcode_direct=yes
 
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      hardcode_minus_L=yes
-      export_dynamic_flag_spec='${wl}-E'
-      ;;
 
-    hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-	hardcode_libdir_flag_spec_ld='+b $libdir'
-	hardcode_libdir_separator=:
-	hardcode_direct=yes
-	hardcode_direct_absolute=yes
-	export_dynamic_flag_spec='${wl}-E'
-	# hardcode_minus_L: Not really in the search PATH,
-	# but as the default location of the library.
-	hardcode_minus_L=yes
-      fi
-      ;;
 
-    hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      else
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-	hardcode_libdir_separator=:
 
-	case $host_cpu in
-	hppa*64*|ia64*)
-	  hardcode_direct=no
-	  hardcode_shlibpath_var=no
-	  ;;
-	*)
-	  hardcode_direct=yes
-	  hardcode_direct_absolute=yes
-	  export_dynamic_flag_spec='${wl}-E'
 
-	  # hardcode_minus_L: Not really in the search PATH,
-	  # but as the default location of the library.
-	  hardcode_minus_L=yes
-	  ;;
-	esac
-      fi
-      ;;
 
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	# Try to use the -exported_symbol ld option, if it does not
-	# work, assume that -exports_file does not work either and
-	# implicitly export all symbols.
-        save_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        cat >conftest.$ac_ext <<_ACEOF
-int foo(void) {}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
 
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-        LDFLAGS="$save_LDFLAGS"
-      else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
-      fi
-      archive_cmds_need_lc='no'
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator=:
-      inherit_rpath=yes
-      link_all_deplibs=yes
-      ;;
 
-    netbsd*)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      hardcode_libdir_flag_spec='-R$libdir'
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    newsos6)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct=yes
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator=:
-      hardcode_shlibpath_var=no
-      ;;
 
-    *nto* | *qnx*)
-      ;;
 
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	hardcode_direct=yes
-	hardcode_shlibpath_var=no
-	hardcode_direct_absolute=yes
-	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-	  export_dynamic_flag_spec='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     hardcode_libdir_flag_spec='-R$libdir'
-	     ;;
-	   *)
-	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-	fi
-      else
-	ld_shlibs=no
-      fi
-      ;;
 
-    os2*)
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_minus_L=yes
-      allow_undefined_flag=unsupported
-      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
 
-    osf3*)
-      if test "$GCC" = yes; then
-	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      archive_cmds_need_lc='no'
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator=:
-      ;;
 
-    osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      else
-	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
-	# Both c and cxx compiler support -rpath directly
-	hardcode_libdir_flag_spec='-rpath $libdir'
-      fi
-      archive_cmds_need_lc='no'
-      hardcode_libdir_separator=:
-      ;;
 
-    solaris*)
-      no_undefined_flag=' -z defs'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-      else
-	case `$CC -V 2>&1` in
-	*"Compilers 5.0"*)
-	  wlarc=''
-	  archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
-	  ;;
-	*)
-	  wlarc='${wl}'
-	  archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-	  ;;
-	esac
-      fi
-      hardcode_libdir_flag_spec='-R$libdir'
-      hardcode_shlibpath_var=no
-      case $host_os in
-      solaris2.[0-5] | solaris2.[0-5].*) ;;
-      *)
-	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
-	# but is careful enough not to reorder.
-	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
-	fi
-	;;
-      esac
-      link_all_deplibs=yes
-      ;;
 
-    sunos4*)
-      if test "x$host_vendor" = xsequent; then
-	# Use $CC to link under sequent, because it throws in some extra .o
-	# files that make .init and .fini sections work.
-	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_direct=yes
-      hardcode_minus_L=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    sysv4)
-      case $host_vendor in
-	sni)
-	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct=yes # is this really true???
-	;;
-	siemens)
-	  ## LD is ld it makes a PLAMLIB
-	  ## CC just makes a GrossModule.
-	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  reload_cmds='$CC -r -o $output$reload_objs'
-	  hardcode_direct=no
-        ;;
-	motorola)
-	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
-	;;
-      esac
-      runpath_var='LD_RUN_PATH'
-      hardcode_shlibpath_var=no
-      ;;
 
-    sysv4.3*)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_shlibpath_var=no
-      export_dynamic_flag_spec='-Bexport'
-      ;;
 
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	hardcode_shlibpath_var=no
-	runpath_var=LD_RUN_PATH
-	hardcode_runpath_var=yes
-	ld_shlibs=yes
-      fi
-      ;;
 
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-      no_undefined_flag='${wl}-z,text'
-      archive_cmds_need_lc=no
-      hardcode_shlibpath_var=no
-      runpath_var='LD_RUN_PATH'
 
-      if test "$GCC" = yes; then
-	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
 
-    sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
-      # link with -lc, and that would cause any symbols used from libc to
-      # always be unresolved, which means just about no library would
-      # ever link correctly.  If we're not using GNU ld we use -z text
-      # though, which does catch some bad symbols but isn't as heavy-handed
-      # as -z defs.
-      no_undefined_flag='${wl}-z,text'
-      allow_undefined_flag='${wl}-z,nodefs'
-      archive_cmds_need_lc=no
-      hardcode_shlibpath_var=no
-      hardcode_libdir_flag_spec='${wl}-R,$libdir'
-      hardcode_libdir_separator=':'
-      link_all_deplibs=yes
-      export_dynamic_flag_spec='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
 
-      if test "$GCC" = yes; then
-	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
 
-    uts4*)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_shlibpath_var=no
-      ;;
 
-    *)
-      ld_shlibs=no
-      ;;
-    esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
 
-    if test x$host_vendor = xsni; then
-      case $host in
-      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-	export_dynamic_flag_spec='${wl}-Blargedynsym'
-	;;
-      esac
-    fi
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
   fi
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[lt_foo]++; }
+  if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
 
-{ $as_echo "$as_me:$LINENO: result: $ld_shlibs" >&5
-$as_echo "$ld_shlibs" >&6; }
-test "$ld_shlibs" = no && can_build_shared=no
-
-with_gnu_ld=$with_gnu_ld
-
-
-
-
-
-
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
 
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
 
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
 
-
-
-
-
-
-
-#
-# Do we need to explicitly link libc?
-#
-case "x$archive_cmds_need_lc" in
-x|xyes)
-  # Assume -lc should be added
-  archive_cmds_need_lc=yes
-
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $archive_cmds in
-    *'~'*)
-      # FIXME: we may have to deal with multi-command sequences.
-      ;;
-    '$CC '*)
-      # Test whether the compiler implicitly links with -lc since on some
-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
-      # to ld, don't add -lc before -lgcc.
-      { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl
-	pic_flag=$lt_prog_compiler_pic
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag
-        allow_undefined_flag=
-        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5
-  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-        then
-	  archive_cmds_need_lc=no
-        else
-	  archive_cmds_need_lc=yes
-        fi
-        allow_undefined_flag=$lt_save_allow_undefined_flag
+aix[4-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
       else
-        cat conftest.err 1>&5
+	can_build_shared=no
       fi
-      $RM conftest*
-      { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
-$as_echo "$archive_cmds_need_lc" >&6; }
       ;;
     esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
   fi
   ;;
-esac
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
 
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
 
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
 
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
 
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
 
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
 
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
 
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
 
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
 
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
 
+freebsd1*)
+  dynamic_linker=no
+  ;;
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-  { $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-$as_echo_n "checking dynamic linker characteristics... " >&6; }
-
-if test "$GCC" = yes; then
-  case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
-    # if the path contains ";" then we assume it to be the separator
-    # otherwise default to the standard path separator (i.e. ":") - it is
-    # assumed that no part of a normal pathname contains ";" but that should
-    # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
-  # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
-  lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
-  for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
-      test -d "$lt_sys_path" && \
-	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
-    fi
-  done
-  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
-  for (lt_i = NF; lt_i > 0; lt_i--) {
-    if ($lt_i != "" && $lt_i != ".") {
-      if ($lt_i == "..") {
-        lt_count++;
-      } else {
-        if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
-        } else {
-          lt_count--;
-        }
-      }
-    }
-  }
-  if (lt_foo != "") { lt_freq[lt_foo]++; }
-  if (lt_freq[lt_foo] == 1) { print lt_foo; }
-}'`
-  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
-else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
-need_lib_prefix=unknown
-hardcode_into_libs=no
-
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
-
-case $host_os in
-aix3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
-  shlibpath_var=LIBPATH
-
-  # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
-  ;;
-
-aix[4-9]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
-    # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
-    shlibpath_var=LD_LIBRARY_PATH
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
   else
-    # With GCC up to 2.95.x, collect2 would create an import file
-    # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
-    # development snapshots of GCC prior to 3.0.
     case $host_os in
-      aix4 | aix4.[01] | aix4.[01].*)
-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
-	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
-	:
-      else
-	can_build_shared=no
-      fi
-      ;;
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
     esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
-    # soname into executable. Probably we can add versioning support to
-    # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
-      # instead of lib<name>.a to let people know that these are not
-      # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
-      # We preserve .a as extension for shared libraries through AIX4.2
-      # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
-    shlibpath_var=LIBPATH
   fi
-  ;;
-
-amigaos*)
-  case $host_cpu in
-  powerpc)
-    # Since July 2007 AmigaOS4 officially supports .so libraries.
-    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
     ;;
-  m68k)
-    library_names_spec='$libname.ixlibrary $libname.a'
-    # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
-    ;;
-  esac
-  ;;
-
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
-
-bsdi[45]*)
-  version_type=linux
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
-  # the default ld.so.conf also contains /usr/contrib/lib and
-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
-  # libtool to hard-code these into programs
-  ;;
-
-cygwin* | mingw* | pw32* | cegcc*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
-
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
-    library_names_spec='$libname.dll.a'
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname~
-      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
-        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
-      fi'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-
-    case $host_os in
-    cygwin*)
-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
-      ;;
-    mingw* | cegcc*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    ;;
-
-  *)
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    ;;
-  esac
-  dynamic_linker='Win32 ld.exe'
-  # FIXME: first we should search . and the directory the executable is in
-  shlibpath_var=PATH
-  ;;
-
-darwin* | rhapsody*)
-  dynamic_linker="$host_os dyld"
-  version_type=darwin
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
-  shlibpath_overrides_runpath=yes
-  shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-
-  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
-  ;;
-
-dgux*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
-freebsd* | dragonfly*)
-  # DragonFly does not have aout.  When/if they implement a new
-  # versioning mechanism, adjust this.
-  if test -x /usr/bin/objformat; then
-    objformat=`/usr/bin/objformat`
-  else
-    case $host_os in
-    freebsd[123]*) objformat=aout ;;
-    *) objformat=elf ;;
-    esac
-  fi
-  version_type=freebsd-$objformat
-  case $version_type in
-    freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-      need_version=no
-      need_lib_prefix=no
-      ;;
-    freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
-      need_version=yes
-      ;;
-  esac
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_os in
-  freebsd2*)
-    shlibpath_overrides_runpath=yes
-    ;;
-  freebsd3.[01]* | freebsdelf3.[01]*)
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
     ;;
   freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
   freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
@@ -16365,2452 +11918,401 @@ freebsd* | dragonfly*)
     shlibpath_overrides_runpath=yes
     hardcode_into_libs=yes
     ;;
-  esac
-  ;;
-
-gnu*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  hardcode_into_libs=yes
-  ;;
-
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  case $host_cpu in
-  ia64*)
-    shrext_cmds='.so'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.so"
-    shlibpath_var=LD_LIBRARY_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
-    else
-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
-    fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  hppa*64*)
-    shrext_cmds='.sl'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
-  postinstall_cmds='chmod 555 $lib'
-  ;;
-
-interix[3-9]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
-	else
-		version_type=irix
-	fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
-  case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
-    ;;
-  *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
-    ;;
-  esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
-
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
-
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
-       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then
-  shlibpath_overrides_runpath=yes
-fi
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
-
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
-
-  # Add ABI-specific directories to the system library path.
-  sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
-
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
-  fi
-
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
-
-netbsd*)
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
-  fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
-
-newsos6)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
-
-*nto* | *qnx*)
-  version_type=qnx
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='ldqnx.so'
-  ;;
-
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
-    *)				need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[89] | openbsd2.[89].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
-  else
-    shlibpath_overrides_runpath=yes
-  fi
-  ;;
-
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
-
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
-
-rdos*)
-  dynamic_linker=no
-  ;;
-
-solaris*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
-  ;;
-
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-  fi
-  need_version=yes
-  ;;
-
-sysv4 | sysv4.3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
-  esac
-  ;;
-
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-	;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
-  ;;
-
-tpf*)
-  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-uts4*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-*)
-  dynamic_linker=no
-  ;;
-esac
-{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-$as_echo "$dynamic_linker" >&6; }
-test "$dynamic_linker" = no && can_build_shared=no
-
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-fi
-
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-  { $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
-hardcode_action=
-if test -n "$hardcode_libdir_flag_spec" ||
-   test -n "$runpath_var" ||
-   test "X$hardcode_automatic" = "Xyes" ; then
-
-  # We can hardcode non-existent directories.
-  if test "$hardcode_direct" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
-     test "$hardcode_minus_L" != no; then
-    # Linking always hardcodes the temporary library directory.
-    hardcode_action=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    hardcode_action=immediate
-  fi
-else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  hardcode_action=unsupported
-fi
-{ $as_echo "$as_me:$LINENO: result: $hardcode_action" >&5
-$as_echo "$hardcode_action" >&6; }
-
-if test "$hardcode_action" = relink ||
-   test "$inherit_rpath" = yes; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
-fi
-
-
-
-
-
-
-  if test "x$enable_dlopen" != xyes; then
-  enable_dlopen=unknown
-  enable_dlopen_self=unknown
-  enable_dlopen_self_static=unknown
-else
-  lt_cv_dlopen=no
-  lt_cv_dlopen_libs=
-
-  case $host_os in
-  beos*)
-    lt_cv_dlopen="load_add_on"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ;;
-
-  mingw* | pw32* | cegcc*)
-    lt_cv_dlopen="LoadLibrary"
-    lt_cv_dlopen_libs=
-    ;;
-
-  cygwin*)
-    lt_cv_dlopen="dlopen"
-    lt_cv_dlopen_libs=
-    ;;
-
-  darwin*)
-  # if libdl is installed we need to link against it
-    { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_dl_dlopen=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dl_dlopen=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
-else
-
-    lt_cv_dlopen="dyld"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-
-fi
-
-    ;;
-
-  *)
-    { $as_echo "$as_me:$LINENO: checking for shl_load" >&5
-$as_echo_n "checking for shl_load... " >&6; }
-if test "${ac_cv_func_shl_load+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define shl_load innocuous_shl_load
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char shl_load (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef shl_load
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char shl_load ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_shl_load || defined __stub___shl_load
-choke me
-#endif
-
-int
-main ()
-{
-return shl_load ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_shl_load=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_func_shl_load=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-$as_echo "$ac_cv_func_shl_load" >&6; }
-if test "x$ac_cv_func_shl_load" = x""yes; then
-  lt_cv_dlopen="shl_load"
-else
-  { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-$as_echo_n "checking for shl_load in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char shl_load ();
-int
-main ()
-{
-return shl_load ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_dld_shl_load=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dld_shl_load=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
-if test "x$ac_cv_lib_dld_shl_load" = x""yes; then
-  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
-else
-  { $as_echo "$as_me:$LINENO: checking for dlopen" >&5
-$as_echo_n "checking for dlopen... " >&6; }
-if test "${ac_cv_func_dlopen+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define dlopen innocuous_dlopen
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char dlopen (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef dlopen
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_dlopen || defined __stub___dlopen
-choke me
-#endif
-
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_dlopen=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_func_dlopen=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-$as_echo "$ac_cv_func_dlopen" >&6; }
-if test "x$ac_cv_func_dlopen" = x""yes; then
-  lt_cv_dlopen="dlopen"
-else
-  { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_dl_dlopen=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dl_dlopen=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
-else
-  { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
-$as_echo_n "checking for dlopen in -lsvld... " >&6; }
-if test "${ac_cv_lib_svld_dlopen+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsvld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_svld_dlopen=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_svld_dlopen=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
-$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
-if test "x$ac_cv_lib_svld_dlopen" = x""yes; then
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
-else
-  { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
-$as_echo_n "checking for dld_link in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_dld_link+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dld_link ();
-int
-main ()
-{
-return dld_link ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_dld_dld_link=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dld_dld_link=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
-$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
-if test "x$ac_cv_lib_dld_dld_link" = x""yes; then
-  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
-fi
-
-
-fi
-
-
-fi
-
-
-fi
-
-
-fi
-
-
-fi
-
-    ;;
-  esac
-
-  if test "x$lt_cv_dlopen" != xno; then
-    enable_dlopen=yes
-  else
-    enable_dlopen=no
-  fi
-
-  case $lt_cv_dlopen in
-  dlopen)
-    save_CPPFLAGS="$CPPFLAGS"
-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
-
-    save_LDFLAGS="$LDFLAGS"
-    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
-
-    save_LIBS="$LIBS"
-    LIBS="$lt_cv_dlopen_libs $LIBS"
-
-    { $as_echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
-$as_echo_n "checking whether a program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  	  if test "$cross_compiling" = yes; then :
-  lt_cv_dlopen_self=cross
-else
-  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-  lt_status=$lt_dlunknown
-  cat > conftest.$ac_ext <<_LT_EOF
-#line 17505 "configure"
-#include "confdefs.h"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#ifdef RTLD_GLOBAL
-#  define LT_DLGLOBAL		RTLD_GLOBAL
-#else
-#  ifdef DL_GLOBAL
-#    define LT_DLGLOBAL		DL_GLOBAL
-#  else
-#    define LT_DLGLOBAL		0
-#  endif
-#endif
-
-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
-   find out it does not work in some platform. */
-#ifndef LT_DLLAZY_OR_NOW
-#  ifdef RTLD_LAZY
-#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
-#  else
-#    ifdef DL_LAZY
-#      define LT_DLLAZY_OR_NOW		DL_LAZY
-#    else
-#      ifdef RTLD_NOW
-#        define LT_DLLAZY_OR_NOW	RTLD_NOW
-#      else
-#        ifdef DL_NOW
-#          define LT_DLLAZY_OR_NOW	DL_NOW
-#        else
-#          define LT_DLLAZY_OR_NOW	0
-#        endif
-#      endif
-#    endif
-#  endif
-#endif
-
-void fnord() { int i=42;}
-int main ()
-{
-  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
-  int status = $lt_dlunknown;
-
-  if (self)
-    {
-      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
-
-  return status;
-}
-_LT_EOF
-  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) >&5 2>/dev/null
-    lt_status=$?
-    case x$lt_status in
-      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
-      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
-      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
-    esac
-  else :
-    # compilation failed
-    lt_cv_dlopen_self=no
-  fi
-fi
-rm -fr conftest*
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
-$as_echo "$lt_cv_dlopen_self" >&6; }
-
-    if test "x$lt_cv_dlopen_self" = xyes; then
-      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
-      { $as_echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
-$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
-if test "${lt_cv_dlopen_self_static+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  	  if test "$cross_compiling" = yes; then :
-  lt_cv_dlopen_self_static=cross
-else
-  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-  lt_status=$lt_dlunknown
-  cat > conftest.$ac_ext <<_LT_EOF
-#line 17601 "configure"
-#include "confdefs.h"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#ifdef RTLD_GLOBAL
-#  define LT_DLGLOBAL		RTLD_GLOBAL
-#else
-#  ifdef DL_GLOBAL
-#    define LT_DLGLOBAL		DL_GLOBAL
-#  else
-#    define LT_DLGLOBAL		0
-#  endif
-#endif
-
-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
-   find out it does not work in some platform. */
-#ifndef LT_DLLAZY_OR_NOW
-#  ifdef RTLD_LAZY
-#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
-#  else
-#    ifdef DL_LAZY
-#      define LT_DLLAZY_OR_NOW		DL_LAZY
-#    else
-#      ifdef RTLD_NOW
-#        define LT_DLLAZY_OR_NOW	RTLD_NOW
-#      else
-#        ifdef DL_NOW
-#          define LT_DLLAZY_OR_NOW	DL_NOW
-#        else
-#          define LT_DLLAZY_OR_NOW	0
-#        endif
-#      endif
-#    endif
-#  endif
-#endif
-
-void fnord() { int i=42;}
-int main ()
-{
-  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
-  int status = $lt_dlunknown;
-
-  if (self)
-    {
-      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
-
-  return status;
-}
-_LT_EOF
-  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) >&5 2>/dev/null
-    lt_status=$?
-    case x$lt_status in
-      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
-      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
-      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
-    esac
-  else :
-    # compilation failed
-    lt_cv_dlopen_self_static=no
-  fi
-fi
-rm -fr conftest*
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
-$as_echo "$lt_cv_dlopen_self_static" >&6; }
-    fi
-
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
-    ;;
-  esac
-
-  case $lt_cv_dlopen_self in
-  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
-  *) enable_dlopen_self=unknown ;;
-  esac
-
-  case $lt_cv_dlopen_self_static in
-  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
-  *) enable_dlopen_self_static=unknown ;;
-  esac
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-striplib=
-old_striplib=
-{ $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
-$as_echo_n "checking whether stripping libraries is possible... " >&6; }
-if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
-  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
-  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-# FIXME - insert some real tests, host_os isn't really good enough
-  case $host_os in
-  darwin*)
-    if test -n "$STRIP" ; then
-      striplib="$STRIP -x"
-      old_striplib="$STRIP -S"
-      { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-    else
-      { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-    fi
-    ;;
-  *)
-    { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-    ;;
-  esac
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-  # Report which library types will actually be built
-  { $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-$as_echo_n "checking if libtool supports shared libraries... " >&6; }
-  { $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5
-$as_echo "$can_build_shared" >&6; }
-
-  { $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-$as_echo_n "checking whether to build shared libraries... " >&6; }
-  test "$can_build_shared" = "no" && enable_shared=no
-
-  # On AIX, shared libraries and static libraries use the same namespace, and
-  # are all built from PIC.
-  case $host_os in
-  aix3*)
-    test "$enable_shared" = yes && enable_static=no
-    if test -n "$RANLIB"; then
-      archive_cmds="$archive_cmds~\$RANLIB \$lib"
-      postinstall_cmds='$RANLIB $lib'
-    fi
-    ;;
-
-  aix[4-9]*)
-    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-      test "$enable_shared" = yes && enable_static=no
-    fi
-    ;;
-  esac
-  { $as_echo "$as_me:$LINENO: result: $enable_shared" >&5
-$as_echo "$enable_shared" >&6; }
-
-  { $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-$as_echo_n "checking whether to build static libraries... " >&6; }
-  # Make sure either enable_shared or enable_static is yes.
-  test "$enable_shared" = yes || enable_static=yes
-  { $as_echo "$as_me:$LINENO: result: $enable_static" >&5
-$as_echo "$enable_static" >&6; }
-
-
-
-
-fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-CC="$lt_save_CC"
-
-
-
-
-
-
-
-
-
-
-
-
-
-        ac_config_commands="$ac_config_commands libtool"
-
-
-
-
-# Only expand once:
-
-
-
-#
-#  Use our own libtool so we can perform Universal builds
-#
-case $host in
-  *-darwin*)
-	LIBTOOL='$(SHELL) $(top_srcdir)/bin/libtool.macosx'
-	;;
-esac
-
-##########################################################################
-##									##
-##  Check various headers						##
-##									##
-##########################################################################
-
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_stdc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_header_stdc=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
-  :
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-		   (('a' <= (c) && (c) <= 'i') \
-		     || ('j' <= (c) && (c) <= 'r') \
-		     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-	|| toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-
-
-
-
-ac_header_dirent=no
-for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
-  as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
-$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$ac_hdr>
-
-int
-main ()
-{
-if ((DIR *) 0)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
-_ACEOF
-
-ac_header_dirent=$ac_hdr; break
-fi
-
-done
-# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
-if test $ac_header_dirent = dirent.h; then
-  { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
-$as_echo_n "checking for library containing opendir... " >&6; }
-if test "${ac_cv_search_opendir+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char opendir ();
-int
-main ()
-{
-return opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' dir; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_search_opendir=$ac_res
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext
-  if test "${ac_cv_search_opendir+set}" = set; then
-  break
-fi
-done
-if test "${ac_cv_search_opendir+set}" = set; then
-  :
-else
-  ac_cv_search_opendir=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
-$as_echo "$ac_cv_search_opendir" >&6; }
-ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-else
-  { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
-$as_echo_n "checking for library containing opendir... " >&6; }
-if test "${ac_cv_search_opendir+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  esac
+  ;;
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char opendir ();
-int
-main ()
-{
-return opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' x; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_search_opendir=$ac_res
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
 
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
 
-fi
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext
-  if test "${ac_cv_search_opendir+set}" = set; then
-  break
-fi
-done
-if test "${ac_cv_search_opendir+set}" = set; then
-  :
-else
-  ac_cv_search_opendir=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
-$as_echo "$ac_cv_search_opendir" >&6; }
-ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
 
-fi
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
 
-fi
-		{ $as_echo "$as_me:$LINENO: checking whether sys/types.h defines makedev" >&5
-$as_echo_n "checking whether sys/types.h defines makedev... " >&6; }
-if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # Some binutils ld are patched to set DT_RUNPATH
+  save_LDFLAGS=$LDFLAGS
+  save_libdir=$libdir
+  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
+
 int
 main ()
 {
-return makedev(0, 0);
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_header_sys_types_h_makedev=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_header_sys_types_h_makedev=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
+if ac_fn_c_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  shlibpath_overrides_runpath=yes
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h_makedev" >&5
-$as_echo "$ac_cv_header_sys_types_h_makedev" >&6; }
-
-if test $ac_cv_header_sys_types_h_makedev = no; then
-if test "${ac_cv_header_sys_mkdev_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5
-$as_echo_n "checking for sys/mkdev.h... " >&6; }
-if test "${ac_cv_header_sys_mkdev_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5
-$as_echo "$ac_cv_header_sys_mkdev_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sys/mkdev.h usability" >&5
-$as_echo_n "checking sys/mkdev.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <sys/mkdev.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$save_LDFLAGS
+  libdir=$save_libdir
 
-	ac_header_compiler=no
-fi
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+  # Add ABI-specific directories to the system library path.
+  sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sys/mkdev.h presence" >&5
-$as_echo_n "checking sys/mkdev.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/mkdev.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
+  fi
 
-  ac_header_preproc=no
-fi
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sys/mkdev.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sys/mkdev.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sys/mkdev.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sys/mkdev.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5
-$as_echo_n "checking for sys/mkdev.h... " >&6; }
-if test "${ac_cv_header_sys_mkdev_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sys_mkdev_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5
-$as_echo "$ac_cv_header_sys_mkdev_h" >&6; }
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
 
-fi
-if test "x$ac_cv_header_sys_mkdev_h" = x""yes; then
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
 
-cat >>confdefs.h <<\_ACEOF
-#define MAJOR_IN_MKDEV 1
-_ACEOF
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
 
-fi
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
 
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
 
+rdos*)
+  dynamic_linker=no
+  ;;
 
-  if test $ac_cv_header_sys_mkdev_h = no; then
-    if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5
-$as_echo_n "checking for sys/sysmacros.h... " >&6; }
-if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5
-$as_echo "$ac_cv_header_sys_sysmacros_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sys/sysmacros.h usability" >&5
-$as_echo_n "checking sys/sysmacros.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <sys/sysmacros.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
 
-	ac_header_compiler=no
-fi
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sys/sysmacros.h presence" >&5
-$as_echo_n "checking sys/sysmacros.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/sysmacros.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
 
-  ac_header_preproc=no
-fi
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sys/sysmacros.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sys/sysmacros.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sys/sysmacros.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
 esac
-{ $as_echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5
-$as_echo_n "checking for sys/sysmacros.h... " >&6; }
-if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sys_sysmacros_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5
-$as_echo "$ac_cv_header_sys_sysmacros_h" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
 
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
-if test "x$ac_cv_header_sys_sysmacros_h" = x""yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define MAJOR_IN_SYSMACROS 1
-_ACEOF
 
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
 fi
-
-
-  fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
 fi
 
-{ $as_echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5
-$as_echo_n "checking whether stat file-mode macros are broken... " >&6; }
-if test "${ac_cv_header_stat_broken+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/stat.h>
 
-#if defined S_ISBLK && defined S_IFDIR
-extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1];
-#endif
 
-#if defined S_ISBLK && defined S_IFCHR
-extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1];
-#endif
 
-#if defined S_ISLNK && defined S_IFREG
-extern char c3[S_ISLNK (S_IFREG) ? -1 : 1];
-#endif
 
-#if defined S_ISSOCK && defined S_IFREG
-extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1];
-#endif
 
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_stat_broken=no
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_header_stat_broken=yes
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5
-$as_echo "$ac_cv_header_stat_broken" >&6; }
-if test $ac_cv_header_stat_broken = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define STAT_MACROS_BROKEN 1
-_ACEOF
 
-fi
- 			{ $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if test "${ac_cv_header_time+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
 
-int
-main ()
-{
-if ((struct tm *) 0)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_time=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_header_time=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-$as_echo "$ac_cv_header_time" >&6; }
-if test $ac_cv_header_time = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define TIME_WITH_SYS_TIME 1
-_ACEOF
 
-fi
- 			{ $as_echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
-$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
-if test "${ac_cv_header_sys_wait_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/wait.h>
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
 
-int
-main ()
-{
-  int s;
-  wait (&s);
-  s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_sys_wait_h=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_header_sys_wait_h=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
-$as_echo "$ac_cv_header_sys_wait_h" >&6; }
-if test $ac_cv_header_sys_wait_h = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYS_WAIT_H 1
-_ACEOF
 
-fi
 
 
 
@@ -18830,2059 +12332,886 @@ fi
 
 
 
-for ac_header in unistd.h limits.h sys/param.h fcntl.h string.h memory.h \
-		sys/timeb.h sys/sockio.h sys/resource.h \
-		malloc.h sys/select.h sys/time.h wchar.h wctype.h \
-		pwd.h grp.h sys/mman.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
-fi
 
-done
 
 
 
-##########################################################################
-##									##
-##  Check various typedefs in include headers				##
-##									##
-##########################################################################
 
-{ $as_echo "$as_me:$LINENO: checking for mode_t" >&5
-$as_echo_n "checking for mode_t... " >&6; }
-if test "${ac_cv_type_mode_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_mode_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (mode_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((mode_t)))
-	  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_mode_t=yes
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
-$as_echo "$ac_cv_type_mode_t" >&6; }
-if test "x$ac_cv_type_mode_t" = x""yes; then
-  :
-else
 
-cat >>confdefs.h <<_ACEOF
-#define mode_t int
-_ACEOF
 
-fi
 
-{ $as_echo "$as_me:$LINENO: checking for off_t" >&5
-$as_echo_n "checking for off_t... " >&6; }
-if test "${ac_cv_type_off_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_off_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (off_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((off_t)))
-	  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_off_t=yes
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
-$as_echo "$ac_cv_type_off_t" >&6; }
-if test "x$ac_cv_type_off_t" = x""yes; then
-  :
-else
 
-cat >>confdefs.h <<_ACEOF
-#define off_t long int
-_ACEOF
 
-fi
 
-{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5
-$as_echo_n "checking for pid_t... " >&6; }
-if test "${ac_cv_type_pid_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_pid_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (pid_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((pid_t)))
-	  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_pid_t=yes
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
-$as_echo "$ac_cv_type_pid_t" >&6; }
-if test "x$ac_cv_type_pid_t" = x""yes; then
-  :
-else
 
-cat >>confdefs.h <<_ACEOF
-#define pid_t int
-_ACEOF
 
-fi
- 		{ $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5
-$as_echo_n "checking return type of signal handlers... " >&6; }
-if test "${ac_cv_type_signal+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <signal.h>
 
-int
-main ()
-{
-return *(signal (0, 0)) (0) == 1;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_signal=int
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_signal=void
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
-$as_echo "$ac_cv_type_signal" >&6; }
 
-cat >>confdefs.h <<_ACEOF
-#define RETSIGTYPE $ac_cv_type_signal
-_ACEOF
 
-		{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
-$as_echo_n "checking for size_t... " >&6; }
-if test "${ac_cv_type_size_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_size_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (size_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((size_t)))
-	  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_size_t=yes
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-$as_echo "$ac_cv_type_size_t" >&6; }
-if test "x$ac_cv_type_size_t" = x""yes; then
-  :
-else
 
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned int
-_ACEOF
 
-fi
- 		{ $as_echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5
-$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
-if test "${ac_cv_type_uid_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+   test -n "$runpath_var" ||
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "uid_t" >/dev/null 2>&1; then
-  ac_cv_type_uid_t=yes
-else
-  ac_cv_type_uid_t=no
+if test "$hardcode_action" = relink ||
+   test "$inherit_rpath" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
 fi
-rm -f conftest*
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
-$as_echo "$ac_cv_type_uid_t" >&6; }
-if test $ac_cv_type_uid_t = no; then
 
-cat >>confdefs.h <<\_ACEOF
-#define uid_t int
-_ACEOF
 
 
-cat >>confdefs.h <<\_ACEOF
-#define gid_t int
-_ACEOF
 
-fi
 
+  if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
 
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
 
-##########################################################################
-##									##
-##  Check various structs in include headers				##
-##									##
-##########################################################################
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
 
-{ $as_echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5
-$as_echo_n "checking for struct stat.st_blksize... " >&6; }
-if test "${ac_cv_member_struct_stat_st_blksize+set}" = set; then
+  darwin*)
+  # if libdl is installed we need to link against it
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-static struct stat ac_aggr;
-if (ac_aggr.st_blksize)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_stat_st_blksize=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
 int
 main ()
 {
-static struct stat ac_aggr;
-if (sizeof ac_aggr.st_blksize)
-return 0;
+return dlopen ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_stat_st_blksize=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_member_struct_stat_st_blksize=no
+  ac_cv_lib_dl_dlopen=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5
-$as_echo "$ac_cv_member_struct_stat_st_blksize" >&6; }
-if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
-_ACEOF
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ST_BLKSIZE 1
-_ACEOF
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
 
 fi
 
+    ;;
 
-{ $as_echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5
-$as_echo_n "checking for struct stat.st_blocks... " >&6; }
-if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then
+  *)
+    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = x""yes; then :
+  lt_cv_dlopen="shl_load"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
 int
 main ()
 {
-static struct stat ac_aggr;
-if (ac_aggr.st_blocks)
-return 0;
+return shl_load ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_stat_st_blocks=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_shl_load=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
 int
 main ()
 {
-static struct stat ac_aggr;
-if (sizeof ac_aggr.st_blocks)
-return 0;
+return dlopen ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_stat_st_blocks=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_member_struct_stat_st_blocks=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_lib_dl_dlopen=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5
-$as_echo "$ac_cv_member_struct_stat_st_blocks" >&6; }
-if test "x$ac_cv_member_struct_stat_st_blocks" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_STAT_ST_BLOCKS 1
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ST_BLOCKS 1
-_ACEOF
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
-  case " $LIBOBJS " in
-  *" fileblocks.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext"
- ;;
-esac
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for struct stat.st_rdev" >&5
-$as_echo_n "checking for struct stat.st_rdev... " >&6; }
-if test "${ac_cv_member_struct_stat_st_rdev+set}" = set; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
 int
 main ()
 {
-static struct stat ac_aggr;
-if (ac_aggr.st_rdev)
-return 0;
+return dlopen ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_stat_st_rdev=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_svld_dlopen=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
 int
 main ()
 {
-static struct stat ac_aggr;
-if (sizeof ac_aggr.st_rdev)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_member_struct_stat_st_rdev=yes
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_dld_link=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
 
-	ac_cv_member_struct_stat_st_rdev=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_rdev" >&5
-$as_echo "$ac_cv_member_struct_stat_st_rdev" >&6; }
-if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_STAT_ST_RDEV 1
-_ACEOF
 
+fi
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ST_RDEV 1
-_ACEOF
 
 fi
 
+    ;;
+  esac
 
-{ $as_echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
-$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
-if test "${ac_cv_struct_tm+set}" = set; then
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <time.h>
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line 12713 "configure"
+#include "confdefs.h"
 
-int
-main ()
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+void fnord() { int i=42;}
+int main ()
 {
-struct tm tm;
-				     int *p = &tm.tm_sec;
-				     return !p;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_struct_tm=time.h
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
 
-	ac_cv_struct_tm=sys/time.h
-fi
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
-$as_echo "$ac_cv_struct_tm" >&6; }
-if test $ac_cv_struct_tm = sys/time.h; then
+rm -fr conftest*
 
-cat >>confdefs.h <<\_ACEOF
-#define TM_IN_SYS_TIME 1
-_ACEOF
 
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
 
-{ $as_echo "$as_me:$LINENO: checking for ptrdiff_t" >&5
-$as_echo_n "checking for ptrdiff_t... " >&6; }
-if test "${ac_cv_type_ptrdiff_t+set}" = set; then
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_type_ptrdiff_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (ptrdiff_t))
-       return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line 12809 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+void fnord() { int i=42;}
+int main ()
 {
-if (sizeof ((ptrdiff_t)))
-	  return 0;
-  ;
-  return 0;
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
 }
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
 
-	ac_cv_type_ptrdiff_t=yes
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+    fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
 
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
 
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5
-$as_echo "$ac_cv_type_ptrdiff_t" >&6; }
-if test "x$ac_cv_type_ptrdiff_t" = x""yes; then
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_PTRDIFF_T 1
-_ACEOF
 
 
-fi
 
 
 
-##########################################################################
-##									##
-##  Check other structs in include headers				##
-##									##
-##########################################################################
 
-#AC_DECL_SYS_SIGLIST
-#AC_EGREP_HEADER(tm_gmtoff, time.h, AC_DEFINE(HAVE_TM_GMTOFF))
-#AC_EGREP_HEADER(tm_tzadj, time.h, AC_DEFINE(HAVE_TM_TZADJ))
 
-{ $as_echo "$as_me:$LINENO: checking for tm_gmtoff in struct tm" >&5
-$as_echo_n "checking for tm_gmtoff in struct tm... " >&6; }
-if test "${ac_cv_struct_tm_gmtoff+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$ac_cv_struct_tm>
-int
-main ()
-{
-struct tm tm; tm.tm_gmtoff;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_struct_tm_gmtoff=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_struct_tm_gmtoff=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm_gmtoff" >&5
-$as_echo "$ac_cv_struct_tm_gmtoff" >&6; }
-if test "$ac_cv_struct_tm_gmtoff" = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TM_GMTOFF 1
-_ACEOF
 
-fi
 
-{ $as_echo "$as_me:$LINENO: checking for tm_tzadj in struct tm" >&5
-$as_echo_n "checking for tm_tzadj in struct tm... " >&6; }
-if test "${ac_cv_struct_tm_tzadj+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$ac_cv_struct_tm>
-int
-main ()
-{
-struct tm tm; tm.tm_tzadj;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_struct_tm_tzadj=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_struct_tm_tzadj=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+    ;;
+  *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    ;;
+  esac
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm_tzadj" >&5
-$as_echo "$ac_cv_struct_tm_tzadj" >&6; }
-if test "$ac_cv_struct_tm_tzadj" = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TM_TZADJ 1
-_ACEOF
 
-fi
 
 
-##########################################################################
-##									##
-##  Check libraries							##
-##									##
-##########################################################################
 
-# The following three (nsl,inet,socket) are needed on Sequent;
-# the order of checking must be this.  Most SVR4 platforms will
-# need -lsocket and -lnsl.  However on SGI IRIX 5, these exist but
-# broken.  I see no elegant solution (probably CHECK_LIB should be
-# fixed to only add the library if the given entry point is not
-# satisfied without it).
-if test "$ac_sys_system" != IRIX
-then
-{ $as_echo "$as_me:$LINENO: checking for t_open in -lnsl" >&5
-$as_echo_n "checking for t_open in -lnsl... " >&6; }
-if test "${ac_cv_lib_nsl_t_open+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnsl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char t_open ();
-int
-main ()
-{
-return t_open ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_nsl_t_open=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_nsl_t_open=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_t_open" >&5
-$as_echo "$ac_cv_lib_nsl_t_open" >&6; }
-if test "x$ac_cv_lib_nsl_t_open" = x""yes; then
-  VLIBS="-lnsl $VLIBS"
-fi
- # SVR4
-{ $as_echo "$as_me:$LINENO: checking for gethostbyname in -linet" >&5
-$as_echo_n "checking for gethostbyname in -linet... " >&6; }
-if test "${ac_cv_lib_inet_gethostbyname+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-linet -lnsl $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gethostbyname ();
-int
-main ()
-{
-return gethostbyname ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_inet_gethostbyname=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_inet_gethostbyname=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_inet_gethostbyname" >&5
-$as_echo "$ac_cv_lib_inet_gethostbyname" >&6; }
-if test "x$ac_cv_lib_inet_gethostbyname" = x""yes; then
-  VLIBS="-linet $VLIBS"
-fi
- # Sequent
-{ $as_echo "$as_me:$LINENO: checking for socket in -lsocket" >&5
-$as_echo_n "checking for socket in -lsocket... " >&6; }
-if test "${ac_cv_lib_socket_socket+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsocket $VLIBS $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char socket ();
-int
-main ()
-{
-return socket ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_socket_socket=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  # Report which library types will actually be built
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[4-9]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
 
-	ac_cv_lib_socket_socket=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5
-$as_echo "$ac_cv_lib_socket_socket" >&6; }
-if test "x$ac_cv_lib_socket_socket" = x""yes; then
-  VLIBS="-lsocket $VLIBS"
-fi
- # SVR4 sockets
 fi
-{ $as_echo "$as_me:$LINENO: checking for cos in -lm" >&5
-$as_echo_n "checking for cos in -lm... " >&6; }
-if test "${ac_cv_lib_m_cos+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char cos ();
-int
-main ()
-{
-return cos ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_m_cos=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+CC="$lt_save_CC"
 
-	ac_cv_lib_m_cos=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_m_cos" >&5
-$as_echo "$ac_cv_lib_m_cos" >&6; }
-if test "x$ac_cv_lib_m_cos" = x""yes; then
-  VLIBS="-lm $VLIBS"
-fi
- # complex math
 
-##########################################################################
-##									##
-##  Check various functions						##
-##									##
-##########################################################################
 
-#AC_FUNC_ALLOCA 			dnl this used to be AC_ALLOCA
-#AC_FUNC_CLOSEDIR_VOID
-#AC_FUNC_GETMNTENT
-#AC_FUNC_GETPGRP
-{ $as_echo "$as_me:$LINENO: checking for working memcmp" >&5
-$as_echo_n "checking for working memcmp... " >&6; }
-if test "${ac_cv_func_memcmp_working+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_memcmp_working=no
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
 
-  /* Some versions of memcmp are not 8-bit clean.  */
-  char c0 = '\100', c1 = '\200', c2 = '\201';
-  if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
-    return 1;
 
-  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
-     or more and with at least one buffer not starting on a 4-byte boundary.
-     William Lewis provided this test program.   */
-  {
-    char foo[21];
-    char bar[21];
-    int i;
-    for (i = 0; i < 4; i++)
-      {
-	char *a = foo + i;
-	char *b = bar + i;
-	strcpy (a, "--------01111111");
-	strcpy (b, "--------10000000");
-	if (memcmp (a, b, 16) >= 0)
-	  return 1;
-      }
-    return 0;
-  }
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_memcmp_working=yes
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-ac_cv_func_memcmp_working=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
 
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
-$as_echo "$ac_cv_func_memcmp_working" >&6; }
-test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
-  *" memcmp.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
- ;;
-esac
 
 
-#AC_FUNC_MMAP
-if test "${ac_cv_func_setvbuf_reversed+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_func_setvbuf_reversed=no
-fi
 
- 	#AC_FUNC_STRCOLL
-#AC_FUNC_STRFTIME
-#AC_FUNC_UTIME_NULL
-#AC_FUNC_VFORK 			dnl this used to be AC_VFORK
-#AC_FUNC_VPRINTF
-#AC_FUNC_WAIT3
+        ac_config_commands="$ac_config_commands libtool"
 
-for ac_header in unistd.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_header_compiler=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+# Only expand once:
+
+
+
+#
+#  Use our own libtool so we can perform Universal builds
+#
+case $host in
+  *-darwin*)
+	LIBTOOL='$(SHELL) $(top_srcdir)/bin/libtool.macosx'
+	;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
+
+##########################################################################
+##									##
+##  Check various headers						##
+##									##
+##########################################################################
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
 
-  ac_header_preproc=no
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  ac_cv_header_stdc=no
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+rm -f conftest*
 
 fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
 _ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
 
+else
+  ac_cv_header_stdc=no
 fi
+rm -f conftest*
 
-done
+fi
 
-{ $as_echo "$as_me:$LINENO: checking for working chown" >&5
-$as_echo_n "checking for working chown... " >&6; }
-if test "${ac_cv_func_chown_works+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_chown_works=no
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
 
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
 int
 main ()
 {
-  char *f = "conftest.chown";
-  struct stat before, after;
-
-  if (creat (f, 0600) < 0)
-    return 1;
-  if (stat (f, &before) < 0)
-    return 1;
-  if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
-    return 1;
-  if (stat (f, &after) < 0)
-    return 1;
-  return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid);
-
-  ;
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_chown_works=yes
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_run "$LINENO"; then :
 
-( exit $ac_status )
-ac_cv_func_chown_works=no
+else
+  ac_cv_header_stdc=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
-rm -f conftest.chown
-
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_chown_works" >&5
-$as_echo "$ac_cv_func_chown_works" >&6; }
-if test $ac_cv_func_chown_works = yes; then
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CHOWN 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
-
-{ $as_echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5
-$as_echo_n "checking whether strerror_r is declared... " >&6; }
-if test "${ac_cv_have_decl_strerror_r+set}" = set; then
+ 			ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+  as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <sys/types.h>
+#include <$ac_hdr>
+
 int
 main ()
 {
-#ifndef strerror_r
-  (void) strerror_r;
-#endif
-
+if ((DIR *) 0)
+return 0;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_strerror_r=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_ac_Header=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_have_decl_strerror_r=no
+  eval "$as_ac_Header=no"
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_r" >&5
-$as_echo "$ac_cv_have_decl_strerror_r" >&6; }
-if test "x$ac_cv_have_decl_strerror_r" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_STRERROR_R 1
-_ACEOF
-
-
-else
+eval ac_res=\$$as_ac_Header
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_STRERROR_R 0
+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
 _ACEOF
 
-
+ac_header_dirent=$ac_hdr; break
 fi
 
-
-
-for ac_func in strerror_r
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
@@ -20890,684 +13219,600 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
+char opendir ();
 int
 main ()
 {
-return $ac_func ();
+return opendir ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
+for ac_lib in '' dir; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then :
+  break
 fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then :
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+else
+  ac_cv_search_opendir=no
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
-done
 
-{ $as_echo "$as_me:$LINENO: checking whether strerror_r returns char *" >&5
-$as_echo_n "checking whether strerror_r returns char *... " >&6; }
-if test "${ac_cv_func_strerror_r_char_p+set}" = set; then
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-
-    ac_cv_func_strerror_r_char_p=no
-    if test $ac_cv_have_decl_strerror_r = yes; then
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
 int
 main ()
 {
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' x; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then :
 
-	  char buf[100];
-	  char x = *strerror_r (0, buf, sizeof buf);
-	  char *p = strerror_r (0, buf, sizeof buf);
-	  return !p || x;
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_func_strerror_r_char_p=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    else
-      # strerror_r is not declared.  Choose between
-      # systems that have relatively inaccessible declarations for the
-      # function.  BeOS and DEC UNIX 4.0 fall in this category, but the
-      # former has a strerror_r that returns char*, while the latter
-      # has a strerror_r that returns `int'.
-      # This test should segfault on the DEC system.
-      if test "$cross_compiling" = yes; then
-  :
+fi
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5
+$as_echo_n "checking whether sys/types.h defines makedev... " >&6; }
+if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-	extern char *strerror_r ();
+#include <sys/types.h>
 int
 main ()
 {
-char buf[100];
-	  char x = *strerror_r (0, buf, sizeof buf);
-	  return ! isalpha (x);
+return makedev(0, 0);
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_strerror_r_char_p=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_header_sys_types_h_makedev=yes
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+  ac_cv_header_sys_types_h_makedev=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_types_h_makedev" >&5
+$as_echo "$ac_cv_header_sys_types_h_makedev" >&6; }
 
+if test $ac_cv_header_sys_types_h_makedev = no; then
+ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_mkdev_h" = x""yes; then :
 
-    fi
+$as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strerror_r_char_p" >&5
-$as_echo "$ac_cv_func_strerror_r_char_p" >&6; }
-if test $ac_cv_func_strerror_r_char_p = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define STRERROR_R_CHAR_P 1
-_ACEOF
 
-fi
 
+  if test $ac_cv_header_sys_mkdev_h = no; then
+    ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_sysmacros_h" = x""yes; then :
 
-##########################################################################
-##									##
-##  Check other functions						##
-##									##
-##########################################################################
+$as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h
 
+fi
 
 
+  fi
+fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5
+$as_echo_n "checking whether stat file-mode macros are broken... " >&6; }
+if test "${ac_cv_header_stat_broken+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/stat.h>
 
+#if defined S_ISBLK && defined S_IFDIR
+extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1];
+#endif
 
+#if defined S_ISBLK && defined S_IFCHR
+extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1];
+#endif
 
+#if defined S_ISLNK && defined S_IFREG
+extern char c3[S_ISLNK (S_IFREG) ? -1 : 1];
+#endif
 
+#if defined S_ISSOCK && defined S_IFREG
+extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1];
+#endif
 
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stat_broken=no
+else
+  ac_cv_header_stat_broken=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5
+$as_echo "$ac_cv_header_stat_broken" >&6; }
+if test $ac_cv_header_stat_broken = yes; then
 
+$as_echo "#define STAT_MACROS_BROKEN 1" >>confdefs.h
 
-for ac_func in getpagesize gettimeofday strtok_r ftruncate fchmod fsync ftime localtime_r gmtime_r syslog
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+fi
+ 			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
+$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
+if test "${ac_cv_header_time+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_time=yes
+else
+  ac_cv_header_time=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
+$as_echo "$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
 
-#undef $ac_func
+$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
+fi
+ 			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
+$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
+if test "${ac_cv_header_sys_wait_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
 #endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
 #endif
 
 int
 main ()
 {
-return $ac_func ();
+  int s;
+  wait (&s);
+  s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_sys_wait_h=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
+  ac_cv_header_sys_wait_h=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5
+$as_echo "$ac_cv_header_sys_wait_h" >&6; }
+if test $ac_cv_header_sys_wait_h = yes; then
+
+$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+
+
+for ac_header in unistd.h limits.h sys/param.h fcntl.h string.h memory.h \
+		sys/timeb.h sys/sockio.h sys/resource.h \
+		malloc.h sys/select.h sys/time.h wchar.h wctype.h \
+		pwd.h grp.h sys/mman.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
-done
-
 
+done
 
-for ac_func in snprintf vsnprintf
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
 
-#undef $ac_func
+##########################################################################
+##									##
+##  Check various typedefs in include headers				##
+##									##
+##########################################################################
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
+if test "x$ac_cv_type_mode_t" = x""yes; then :
 
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	eval "$as_ac_var=no"
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
+if test "x$ac_cv_type_off_t" = x""yes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long int
 _ACEOF
 
 fi
-done
 
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = x""yes; then :
 
+else
 
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
 
-for ac_func in wcsdup wcscasecmp wcsicmp
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+fi
+ 		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
+$as_echo_n "checking return type of signal handlers... " >&6; }
+if test "${ac_cv_type_signal+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+#include <sys/types.h>
+#include <signal.h>
 
 int
 main ()
 {
-return $ac_func ();
+return *(signal (0, 0)) (0) == 1;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_type_signal=int
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
+  ac_cv_type_signal=void
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
+$as_echo "$ac_cv_type_signal" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
+_ACEOF
+
+		ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = x""yes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+ 		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
+$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
+if test "${ac_cv_type_uid_t+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+
 _ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "uid_t" >/dev/null 2>&1; then :
+  ac_cv_type_uid_t=yes
+else
+  ac_cv_type_uid_t=no
+fi
+rm -f conftest*
 
 fi
-done
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
+$as_echo "$ac_cv_type_uid_t" >&6; }
+if test $ac_cv_type_uid_t = no; then
 
+$as_echo "#define uid_t int" >>confdefs.h
 
 
+$as_echo "#define gid_t int" >>confdefs.h
+
+fi
 
 
 
+##########################################################################
+##									##
+##  Check various structs in include headers				##
+##									##
+##########################################################################
 
+ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then :
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+_ACEOF
 
 
+$as_echo "#define HAVE_ST_BLKSIZE 1" >>confdefs.h
 
+fi
 
 
+ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_blocks" = x""yes; then :
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BLOCKS 1
+_ACEOF
 
 
+$as_echo "#define HAVE_ST_BLOCKS 1" >>confdefs.h
 
+else
+  case " $LIBOBJS " in
+  *" fileblocks.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext"
+ ;;
+esac
 
+fi
 
 
+ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then :
 
-for ac_func in wcscmp wcslen wcsncat wcsnicmp wcsncasecmp wcsncmp wcscpy iswspace iswdigit wcsncpy wtol wtoi wcschr wcsrchr wcsstr wcscat iswlower iswupper towlower towupper
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_RDEV 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+$as_echo "#define HAVE_ST_RDEV 1" >>confdefs.h
 
-#undef $ac_func
+fi
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
+$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
+if test "${ac_cv_struct_tm+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <time.h>
 
 int
 main ()
 {
-return $ac_func ();
+struct tm tm;
+				     int *p = &tm.tm_sec;
+				     return !p;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_struct_tm=time.h
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
+  ac_cv_struct_tm=sys/time.h
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-done
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
+$as_echo "$ac_cv_struct_tm" >&6; }
+if test $ac_cv_struct_tm = sys/time.h; then
 
+$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
 
+fi
 
+ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default"
+if test "x$ac_cv_type_ptrdiff_t" = x""yes; then :
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_PTRDIFF_T 1
+_ACEOF
 
 
+fi
 
 
 
+##########################################################################
+##									##
+##  Check other structs in include headers				##
+##									##
+##########################################################################
 
+#AC_DECL_SYS_SIGLIST
+#AC_EGREP_HEADER(tm_gmtoff, time.h, AC_DEFINE(HAVE_TM_GMTOFF))
+#AC_EGREP_HEADER(tm_tzadj, time.h, AC_DEFINE(HAVE_TM_TZADJ))
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tm_gmtoff in struct tm" >&5
+$as_echo_n "checking for tm_gmtoff in struct tm... " >&6; }
+if test "${ac_cv_struct_tm_gmtoff+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <$ac_cv_struct_tm>
+int
+main ()
+{
+struct tm tm; tm.tm_gmtoff;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_struct_tm_gmtoff=yes
+else
+  ac_cv_struct_tm_gmtoff=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm_gmtoff" >&5
+$as_echo "$ac_cv_struct_tm_gmtoff" >&6; }
+if test "$ac_cv_struct_tm_gmtoff" = yes; then
 
+$as_echo "#define HAVE_TM_GMTOFF 1" >>confdefs.h
 
+fi
 
-for ac_func in wprintf fputws putwc swprintf fwprintf swscanf fgetws putwchar putws wfopen cwprintf wperror wexecvp
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tm_tzadj in struct tm" >&5
+$as_echo_n "checking for tm_tzadj in struct tm... " >&6; }
+if test "${ac_cv_struct_tm_tzadj+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+#include <sys/types.h>
+#include <$ac_cv_struct_tm>
+int
+main ()
+{
+struct tm tm; tm.tm_tzadj;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_struct_tm_tzadj=yes
+else
+  ac_cv_struct_tm_tzadj=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm_tzadj" >&5
+$as_echo "$ac_cv_struct_tm_tzadj" >&6; }
+if test "$ac_cv_struct_tm_tzadj" = yes; then
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+$as_echo "#define HAVE_TM_TZADJ 1" >>confdefs.h
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+fi
+
+
+##########################################################################
+##									##
+##  Check libraries							##
+##									##
+##########################################################################
 
-#undef $ac_func
+# The following three (nsl,inet,socket) are needed on Sequent;
+# the order of checking must be this.  Most SVR4 platforms will
+# need -lsocket and -lnsl.  However on SGI IRIX 5, these exist but
+# broken.  I see no elegant solution (probably CHECK_LIB should be
+# fixed to only add the library if the given entry point is not
+# satisfied without it).
+if test "$ac_sys_system" != IRIX
+then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for t_open in -lnsl" >&5
+$as_echo_n "checking for t_open in -lnsl... " >&6; }
+if test "${ac_cv_lib_nsl_t_open+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnsl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
@@ -21575,100 +13820,39 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
+char t_open ();
 int
 main ()
 {
-return $ac_func ();
+return t_open ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_nsl_t_open=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
+  ac_cv_lib_nsl_t_open=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_t_open" >&5
+$as_echo "$ac_cv_lib_nsl_t_open" >&6; }
+if test "x$ac_cv_lib_nsl_t_open" = x""yes; then :
+  VLIBS="-lnsl $VLIBS"
 fi
-done
-
-
-for ac_func in wgetenv
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ # SVR4
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -linet" >&5
+$as_echo_n "checking for gethostbyname in -linet... " >&6; }
+if test "${ac_cv_lib_inet_gethostbyname+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-linet -lnsl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
@@ -21676,101 +13860,39 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
+char gethostbyname ();
 int
 main ()
 {
-return $ac_func ();
+return gethostbyname ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_inet_gethostbyname=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
+  ac_cv_lib_inet_gethostbyname=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_gethostbyname" >&5
+$as_echo "$ac_cv_lib_inet_gethostbyname" >&6; }
+if test "x$ac_cv_lib_inet_gethostbyname" = x""yes; then :
+  VLIBS="-linet $VLIBS"
 fi
-done
-
-
-
-for ac_func in wgetpass wgetpassphrase
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ # Sequent
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5
+$as_echo_n "checking for socket in -lsocket... " >&6; }
+if test "${ac_cv_lib_socket_socket+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket $VLIBS $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
@@ -21778,106 +13900,40 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
+char socket ();
 int
 main ()
 {
-return $ac_func ();
+return socket ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_socket_socket=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
+  ac_cv_lib_socket_socket=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5
+$as_echo "$ac_cv_lib_socket_socket" >&6; }
+if test "x$ac_cv_lib_socket_socket" = x""yes; then :
+  VLIBS="-lsocket $VLIBS"
 fi
-done
-
-
-
-
-
-
-
-
-for ac_func in getpwnam getgrnam chmod getpwuid getgrgid setuid
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ # SVR4 sockets
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
+$as_echo_n "checking for cos in -lm... " >&6; }
+if test "${ac_cv_lib_m_cos+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
 
 /* Override any GCC internal prototype to avoid an error.
    Use char because int might match the return type of a GCC
@@ -21885,366 +13941,312 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+char cos ();
+int
+main ()
+{
+return cos ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_cos=yes
+else
+  ac_cv_lib_m_cos=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
+$as_echo "$ac_cv_lib_m_cos" >&6; }
+if test "x$ac_cv_lib_m_cos" = x""yes; then :
+  VLIBS="-lm $VLIBS"
+fi
+ # complex math
+
+##########################################################################
+##									##
+##  Check various functions						##
+##									##
+##########################################################################
 
+#AC_FUNC_ALLOCA 			dnl this used to be AC_ALLOCA
+#AC_FUNC_CLOSEDIR_VOID
+#AC_FUNC_GETMNTENT
+#AC_FUNC_GETPGRP
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5
+$as_echo_n "checking for working memcmp... " >&6; }
+if test "${ac_cv_func_memcmp_working+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_memcmp_working=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
 int
 main ()
 {
-return $ac_func ();
+
+  /* Some versions of memcmp are not 8-bit clean.  */
+  char c0 = '\100', c1 = '\200', c2 = '\201';
+  if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
+    return 1;
+
+  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+     or more and with at least one buffer not starting on a 4-byte boundary.
+     William Lewis provided this test program.   */
+  {
+    char foo[21];
+    char bar[21];
+    int i;
+    for (i = 0; i < 4; i++)
+      {
+	char *a = foo + i;
+	char *b = bar + i;
+	strcpy (a, "--------01111111");
+	strcpy (b, "--------10000000");
+	if (memcmp (a, b, 16) >= 0)
+	  return 1;
+      }
+    return 0;
+  }
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_memcmp_working=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_func_memcmp_working=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-	eval "$as_ac_var=no"
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5
+$as_echo "$ac_cv_func_memcmp_working" >&6; }
+test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
+  *" memcmp.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
+ ;;
+esac
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+
+#AC_FUNC_MMAP
+if test "${ac_cv_func_setvbuf_reversed+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_func_setvbuf_reversed=no
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+
+ 	#AC_FUNC_STRCOLL
+#AC_FUNC_STRFTIME
+#AC_FUNC_UTIME_NULL
+#AC_FUNC_VFORK 			dnl this used to be AC_VFORK
+#AC_FUNC_VPRINTF
+#AC_FUNC_WAIT3
+for ac_header in unistd.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
+if test "x$ac_cv_header_unistd_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define HAVE_UNISTD_H 1
 _ACEOF
 
 fi
-done
-
 
+done
 
-for ac_func in putenv setenv
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5
+$as_echo_n "checking for working chown... " >&6; }
+if test "${ac_cv_func_chown_works+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_chown_works=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+$ac_includes_default
+#include <fcntl.h>
 
 int
 main ()
 {
-return $ac_func ();
+  char *f = "conftest.chown";
+  struct stat before, after;
+
+  if (creat (f, 0600) < 0)
+    return 1;
+  if (stat (f, &before) < 0)
+    return 1;
+  if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
+    return 1;
+  if (stat (f, &after) < 0)
+    return 1;
+  return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid);
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_chown_works=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_func_chown_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+rm -f conftest.chown
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5
+$as_echo "$ac_cv_func_chown_works" >&6; }
+if test $ac_cv_func_chown_works = yes; then
+
+$as_echo "#define HAVE_CHOWN 1" >>confdefs.h
 
-	eval "$as_ac_var=no"
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strerror_r" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRERROR_R $ac_have_decl
+_ACEOF
+
+for ac_func in strerror_r
+do :
+  ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r"
+if test "x$ac_cv_func_strerror_r" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define HAVE_STRERROR_R 1
 _ACEOF
 
 fi
 done
 
-
-for ac_func in strerror
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5
+$as_echo_n "checking whether strerror_r returns char *... " >&6; }
+if test "${ac_cv_func_strerror_r_char_p+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
 
-#undef $ac_func
+    ac_cv_func_strerror_r_char_p=no
+    if test $ac_cv_have_decl_strerror_r = yes; then
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+	  char buf[100];
+	  char x = *strerror_r (0, buf, sizeof buf);
+	  char *p = strerror_r (0, buf, sizeof buf);
+	  return !p || x;
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_func_strerror_r_char_p=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    else
+      # strerror_r is not declared.  Choose between
+      # systems that have relatively inaccessible declarations for the
+      # function.  BeOS and DEC UNIX 4.0 fall in this category, but the
+      # former has a strerror_r that returns char*, while the latter
+      # has a strerror_r that returns `int'.
+      # This test should segfault on the DEC system.
+      if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+	extern char *strerror_r ();
 int
 main ()
 {
-return $ac_func ();
+char buf[100];
+	  char x = *strerror_r (0, buf, sizeof buf);
+	  return ! isalpha (x);
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_strerror_r_char_p=yes
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+
+    fi
 
 fi
-done
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5
+$as_echo "$ac_cv_func_strerror_r_char_p" >&6; }
+if test $ac_cv_func_strerror_r_char_p = yes; then
 
+$as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h
 
-for ac_func in strdup
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+fi
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+##########################################################################
+##									##
+##  Check other functions						##
+##									##
+##########################################################################
 
-#undef $ac_func
+for ac_func in getpagesize gettimeofday strtok_r ftruncate fchmod fsync ftime localtime_r gmtime_r syslog
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+fi
+done
 
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+for ac_func in snprintf vsnprintf
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
-	eval "$as_ac_var=no"
 fi
+done
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+for ac_func in wcsdup wcscasecmp wcsicmp
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -22252,100 +14254,49 @@ _ACEOF
 fi
 done
 
-
-for ac_func in getrusage
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+for ac_func in wcscmp wcslen wcsncat wcsnicmp wcsncasecmp wcsncmp wcscpy iswspace iswdigit wcsncpy wtol wtoi wcschr wcsrchr wcsstr wcscat iswlower iswupper towlower towupper
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+fi
+done
 
-#undef $ac_func
+for ac_func in wprintf fputws putwc swprintf fwprintf swscanf fgetws putwchar putws wfopen cwprintf wperror wexecvp
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+fi
+done
 
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
+for ac_func in wgetenv
+do :
+  ac_fn_c_check_func "$LINENO" "wgetenv" "ac_cv_func_wgetenv"
+if test "x$ac_cv_func_wgetenv" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_WGETENV 1
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	eval "$as_ac_var=no"
 fi
+done
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+for ac_func in wgetpass wgetpassphrase
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -22354,101 +14305,71 @@ fi
 done
 
 
+for ac_func in getpwnam getgrnam chmod getpwuid getgrgid setuid
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
+fi
+done
 
-for ac_func in memmove memmem memcpy
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+for ac_func in putenv setenv
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+fi
+done
 
-#undef $ac_func
+for ac_func in strerror
+do :
+  ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror"
+if test "x$ac_cv_func_strerror" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_STRERROR 1
+_ACEOF
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
+fi
+done
 
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
+for ac_func in strdup
+do :
+  ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup"
+if test "x$ac_cv_func_strdup" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_STRDUP 1
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	eval "$as_ac_var=no"
 fi
+done
+
+for ac_func in getrusage
+do :
+  ac_fn_c_check_func "$LINENO" "getrusage" "ac_cv_func_getrusage"
+if test "x$ac_cv_func_getrusage" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GETRUSAGE 1
+_ACEOF
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+done
+
+for ac_func in memmove memmem memcpy
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -22457,13 +14378,9 @@ fi
 done
 
 
-{ $as_echo "$as_me:$LINENO: checking for sys_errlist" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys_errlist" >&5
 $as_echo_n "checking for sys_errlist... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <stdio.h>
@@ -22479,61 +14396,30 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYS_ERRLIST 1
-_ACEOF
+$as_echo "#define HAVE_SYS_ERRLIST 1" >>confdefs.h
 
- { $as_echo "$as_me:$LINENO: result: yes" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
 
- { $as_echo "$as_me:$LINENO: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
-{ $as_echo "$as_me:$LINENO: checking whether va_copy exists" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether va_copy exists" >&5
 $as_echo_n "checking whether va_copy exists... " >&6; }
-if test "${ac_cv_have_va_copy+set}" = set; then
+if test "${ac_cv_have_va_copy+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 		 va_list x,y;
@@ -22545,62 +14431,31 @@ va_copy(x,y);
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
    ac_cv_have_va_copy="yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	 ac_cv_have_va_copy="no"
+   ac_cv_have_va_copy="no"
 
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_va_copy" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_va_copy" >&5
 $as_echo "$ac_cv_have_va_copy" >&6; }
 if test "x$ac_cv_have_va_copy" = "xyes" ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_VA_COPY 1
-_ACEOF
+$as_echo "#define HAVE_VA_COPY 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking whether __va_copy exists" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __va_copy exists" >&5
 $as_echo_n "checking whether __va_copy exists... " >&6; }
-if test "${ac_cv_have___va_copy+set}" = set; then
+if test "${ac_cv_have___va_copy+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 		 va_list x,y;
@@ -22612,48 +14467,21 @@ __va_copy(x,y);
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
    ac_cv_have___va_copy="yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	 ac_cv_have___va_copy="no"
+   ac_cv_have___va_copy="no"
 
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have___va_copy" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have___va_copy" >&5
 $as_echo "$ac_cv_have___va_copy" >&6; }
 if test "x$ac_cv_have___va_copy" = "xyes" ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE___VA_COPY 1
-_ACEOF
+$as_echo "#define HAVE___VA_COPY 1" >>confdefs.h
 
 fi
 
@@ -22663,13 +14491,9 @@ fi
 ##									##
 ##########################################################################
 
-{ $as_echo "$as_me:$LINENO: checking for flock in <sys/file.h>" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock in <sys/file.h>" >&5
 $as_echo_n "checking for flock in <sys/file.h>... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <sys/file.h>
@@ -22684,46 +14508,19 @@ return (flock (0, LOCK_EX) || flock (0, LOCK_UN));
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_FLOCK_IN_SYS_FILE 1
-_ACEOF
+$as_echo "#define HAVE_FLOCK_IN_SYS_FILE 1" >>confdefs.h
 
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	{ $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
 
 ##########################################################################
@@ -22732,9 +14529,9 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
 ##									##
 ##########################################################################
 
-{ $as_echo "$as_me:$LINENO: checking whether #! works in shell scripts" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether #! works in shell scripts" >&5
 $as_echo_n "checking whether #! works in shell scripts... " >&6; }
-if test "${ac_cv_sys_interpreter+set}" = set; then
+if test "${ac_cv_sys_interpreter+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   echo '#! /bin/cat
@@ -22749,13 +14546,13 @@ else
 fi
 rm -f conftest
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_interpreter" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_interpreter" >&5
 $as_echo "$ac_cv_sys_interpreter" >&6; }
 interpval=$ac_cv_sys_interpreter
 
-{ $as_echo "$as_me:$LINENO: checking for long file names" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long file names" >&5
 $as_echo_n "checking for long file names... " >&6; }
-if test "${ac_cv_sys_long_file_names+set}" = set; then
+if test "${ac_cv_sys_long_file_names+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_sys_long_file_names=yes
@@ -22785,35 +14582,26 @@ for ac_dir in . "$TMPDIR" /tmp /var/tmp /usr/tmp "$prefix/lib" "$exec_prefix/lib
   test $ac_cv_sys_long_file_names = no && break
 done
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_long_file_names" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_long_file_names" >&5
 $as_echo "$ac_cv_sys_long_file_names" >&6; }
 if test $ac_cv_sys_long_file_names = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LONG_FILE_NAMES 1
-_ACEOF
+$as_echo "#define HAVE_LONG_FILE_NAMES 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for restartable system calls" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for restartable system calls" >&5
 $as_echo_n "checking for restartable system calls... " >&6; }
-if test "${ac_cv_sys_restartable_syscalls+set}" = set; then
+if test "${ac_cv_sys_restartable_syscalls+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 /* Exit 0 (true) if wait returns something other than -1,
    i.e. the pid of the child, which means that wait was restarted
@@ -22855,50 +14643,21 @@ main ()
   return status == -1;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_sys_restartable_syscalls=yes
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_sys_restartable_syscalls=no
+  ac_cv_sys_restartable_syscalls=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_restartable_syscalls" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_restartable_syscalls" >&5
 $as_echo "$ac_cv_sys_restartable_syscalls" >&6; }
 if test $ac_cv_sys_restartable_syscalls = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_RESTARTABLE_SYSCALLS 1
-_ACEOF
+$as_echo "#define HAVE_RESTARTABLE_SYSCALLS 1" >>confdefs.h
 
 fi
 
@@ -22916,30 +14675,39 @@ fi
 ##									##
 ##########################################################################
 
+CCOPT=""
+CCDEFS=""
+CCWARN=""
+CCDEBUG=""
+CCLIBS=""
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking default compiler values..." >&5
+$as_echo "$as_me: checking default compiler values..." >&6;}
+if eval "${CC-cc} $CFLAGS $AM_LDFLAGS -o binsrc/config/ccdefs binsrc/config/ccdefs.c" ; then
+    eval `binsrc/config/ccdefs`
+fi
+
 
 # Check whether --with-debug was given.
-if test "${with_debug+set}" = set; then
+if test "${with_debug+set}" = set; then :
   withval=$with_debug;  with_debug="$withval"
 else
    with_debug="no"
 fi
 
 if test "x$with_debug" = "xyes"; then
+
+    CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
+    CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
+
+
     CCOPT="-g"
     AM_LDFLAGS="-g"
+    CCDEBUG=""
 else
-    CCOPT=""
     AM_LDFLAGS="-s"
 fi
 
-{ $as_echo "$as_me:$LINENO: checking default compiler values..." >&5
-$as_echo "$as_me: checking default compiler values..." >&6;}
-if eval "${CC-cc} $CFLAGS $AM_LDFLAGS -o binsrc/config/ccdefs binsrc/config/ccdefs.c" ; then
-    eval `binsrc/config/ccdefs`
-else
-    CCOPT=-O
-fi
-
 
 #AC_CHECKING(for suspicious C compiler)
 #AC_TRY_COMPILE([ ], [struct { long l; void *d; } *x;
@@ -22951,13 +14719,9 @@ fi
 
 
 
-{ $as_echo "$as_me:$LINENO: checking for uuid_t" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_t" >&5
 $as_echo_n "checking for uuid_t... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #ifdef HAVE_UNISTD_H
@@ -22973,44 +14737,21 @@ main ()
   ;
   return 0;
 }
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
 
 
-cat >>confdefs.h <<\_ACEOF
-#define UUID_T_DEFINED 1
-_ACEOF
+$as_echo "#define UUID_T_DEFINED 1" >>confdefs.h
 
- { $as_echo "$as_me:$LINENO: result: yes" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
- { $as_echo "$as_me:$LINENO: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
@@ -23025,16 +14766,12 @@ srvrlibs=""
 clntlibs=""
 
 # Check whether --enable-xml was given.
-if test "${enable_xml+set}" = set; then
+if test "${enable_xml+set}" = set; then :
   enableval=$enable_xml;
      case "${enableval}" in
        yes)	with_xml="yes";;
-       no)	{ { $as_echo "$as_me:$LINENO: error: Xml extension required for Virtuoso" >&5
-$as_echo "$as_me: error: Xml extension required for Virtuoso" >&2;}
-   { (exit 1); exit 1; }; } ;;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-xml" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-xml" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       no)	as_fn_error "Xml extension required for Virtuoso" "$LINENO" 5 ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-xml" "$LINENO" 5 ;;
      esac
 
 else
@@ -23046,9 +14783,7 @@ fi
 if test "$with_xml" = "yes"; then
     BUILD_OPTS="$BUILD_OPTS xml"
 
-cat >>confdefs.h <<\_ACEOF
-#define BIF_XML 1
-_ACEOF
+$as_echo "#define BIF_XML 1" >>confdefs.h
 
     libxml_file=$LIBDIR/libxml.la
     ccincl="$ccincl -I$TOP/libsrc/Xml.new"
@@ -23064,15 +14799,13 @@ fi
 #                                                                        #
 ##########################################################################
 # Check whether --enable-krb was given.
-if test "${enable_krb+set}" = set; then
+if test "${enable_krb+set}" = set; then :
   enableval=$enable_krb;
      case "${enableval}" in
        yes)	with_krb="yes";;
        no)	with_krb="no";;
        /*)	with_krb="${enableval}";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --disable-krb" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --disable-krb" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --disable-krb" "$LINENO" 5 ;;
      esac
 
 else
@@ -23088,18 +14821,14 @@ if test "$with_krb" != "no"; then
       libkrb="-L$with_krb/lib $libkrb"
       krbinc="-I$with_krb/include"
     fi
-    { $as_echo "$as_me:$LINENO: checking for krb5_init_context in -lkrb5" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb5_init_context in -lkrb5" >&5
 $as_echo_n "checking for krb5_init_context in -lkrb5... " >&6; }
-if test "${ac_cv_lib_krb5_krb5_init_context+set}" = set; then
+if test "${ac_cv_lib_krb5_krb5_init_context+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lkrb5  $libkrb  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -23117,43 +14846,18 @@ return krb5_init_context ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_krb5_krb5_init_context=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_krb5_krb5_init_context=no
+  ac_cv_lib_krb5_krb5_init_context=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_krb5_krb5_init_context" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb5_krb5_init_context" >&5
 $as_echo "$ac_cv_lib_krb5_krb5_init_context" >&6; }
-if test "x$ac_cv_lib_krb5_krb5_init_context" = x""yes; then
+if test "x$ac_cv_lib_krb5_krb5_init_context" = x""yes; then :
 
 		  with_krb="yes"
 
@@ -23168,152 +14872,12 @@ fi
 if test "$with_krb" != "no"; then
     save_CPPFLAGS=$CPPFLAGS
     CPPFLAGS="$krbinc $CPPFLAGS"
-
-
-
-
-for ac_header in krb5.h gssapi/gssapi.h gssapi/gssapi_generic.h gssapi/gssapi_krb5.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+    for ac_header in krb5.h gssapi/gssapi.h gssapi/gssapi_generic.h gssapi/gssapi_krb5.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -23330,14 +14894,10 @@ done
 fi
 if test "$with_krb" != "no"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define _KERBEROS 1
-_ACEOF
+$as_echo "#define _KERBEROS 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define GSSAPI 1
-_ACEOF
+$as_echo "#define GSSAPI 1" >>confdefs.h
 
     BUILD_OPTS="$BUILD_OPTS krb"
     if test "$with_krb" != "yes"; then
@@ -23361,17 +14921,13 @@ fi
 #                                                                        #
 ##########################################################################
 # Check whether --enable-openssl was given.
-if test "${enable_openssl+set}" = set; then
+if test "${enable_openssl+set}" = set; then :
   enableval=$enable_openssl;
      case "${enableval}" in
        yes)	openssl_dir="/usr" ;;
-       no)	{ { $as_echo "$as_me:$LINENO: error: OpenSSL required for Virtuoso" >&5
-$as_echo "$as_me: error: OpenSSL required for Virtuoso" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       no)	as_fn_error "OpenSSL required for Virtuoso" "$LINENO" 5 ;;
        /*)	openssl_dir="${enableval}" ;;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --disable-openssl" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --disable-openssl" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --disable-openssl" "$LINENO" 5 ;;
      esac
 
 else
@@ -23408,13 +14964,9 @@ case $host in
 	LIBS="$LIBS -lsocket"
 	;;
 esac
-{ $as_echo "$as_me:$LINENO: checking validity of the OpenSSL headers in ${openssl_dir}" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking validity of the OpenSSL headers in ${openssl_dir}" >&5
 $as_echo_n "checking validity of the OpenSSL headers in ${openssl_dir}... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <openssl/rsa.h>
@@ -23467,57 +15019,27 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
 
- { $as_echo "$as_me:$LINENO: result: good" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: good" >&5
 $as_echo "good" >&6; }
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
- { { $as_echo "$as_me:$LINENO: error: bad. Check config.log for details" >&5
-$as_echo "$as_me: error: bad. Check config.log for details" >&2;}
-   { (exit 1); exit 1; }; }
+ as_fn_error "bad. Check config.log for details" "$LINENO" 5
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-{ $as_echo "$as_me:$LINENO: checking version and usability of the OpenSSL lib in ${openssl_dir}" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking version and usability of the OpenSSL lib in ${openssl_dir}" >&5
 $as_echo_n "checking version and usability of the OpenSSL lib in ${openssl_dir}... " >&6; }
-if test "$cross_compiling" = yes; then
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <openssl/rsa.h>
@@ -23566,58 +15088,27 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
 
- { $as_echo "$as_me:$LINENO: result: good" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: good" >&5
 $as_echo "good" >&6; }
  BUILD_OPTS="$BUILD_OPTS ssl"
  ccincl="$ccincl $openssl_CFLAGS"
  srvrlibs="$srvrlibs $openssl_LDFLAGS"
  clntlibs="$clntlibs $openssl_LDFLAGS"
 
-cat >>confdefs.h <<\_ACEOF
-#define _SSL 1
-_ACEOF
+$as_echo "#define _SSL 1" >>confdefs.h
 
 
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
 
- { { $as_echo "$as_me:$LINENO: error: bad. Check config.log for details" >&5
-$as_echo "$as_me: error: bad. Check config.log for details" >&2;}
-   { (exit 1); exit 1; }; }
+ as_fn_error "bad. Check config.log for details" "$LINENO" 5
 
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 LIBS="$save_LIBS"
 CPPFLAGS="$save_CPPFLAGS"
 
@@ -23630,15 +15121,13 @@ CPPFLAGS="$save_CPPFLAGS"
 #                                                                        #
 ##########################################################################
 # Check whether --enable-openldap was given.
-if test "${enable_openldap+set}" = set; then
+if test "${enable_openldap+set}" = set; then :
   enableval=$enable_openldap;
      case "${enableval}" in
        yes)	with_ldap="yes" ;;
        no)	with_ldap="no" ;;
        /*)	with_ldap="${enableval}" ;;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --disable-openldap" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --disable-openldap" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --disable-openldap" "$LINENO" 5 ;;
      esac
 
 else
@@ -23649,7 +15138,7 @@ fi
 
 if test "x$with_ldap" != "xno"
 then
-    { $as_echo "$as_me:$LINENO: checking OpenLDAP library usability" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenLDAP library usability" >&5
 $as_echo_n "checking OpenLDAP library usability... " >&6; }
     save_CPPFLAGS="$CPPFLAGS"
     save_LIBS="$LIBS"
@@ -23668,20 +15157,13 @@ $as_echo_n "checking OpenLDAP library usability... " >&6; }
     esac
     CPPFLAGS="$CPPFLAGS $openldap_CFLAGS"
     LIBS="$LIBS $openldap_LDFLAGS"
-    if test "$cross_compiling" = yes; then
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+    if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <ldap.h>
@@ -23699,56 +15181,27 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
 
- { $as_echo "$as_me:$LINENO: result: good" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: good" >&5
 $as_echo "good" >&6; }
  BUILD_OPTS="$BUILD_OPTS ldap"
  srvrlibs="$srvrlibs $openldap_LDFLAGS"
 
-cat >>confdefs.h <<\_ACEOF
-#define _LDAP 1
-_ACEOF
+$as_echo "#define _LDAP 1" >>confdefs.h
 
 
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-
- { $as_echo "$as_me:$LINENO: result: bad. Check config.log for details" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: bad. Check config.log for details" >&5
 $as_echo "bad. Check config.log for details" >&6; }
  with_ldap="no"
 
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
     LIBS="$save_LIBS"
     CPPFLAGS="$save_CPPFLAGS"
     LD_LIBRARY_PATH="$old_LD_LIBRARY_PATH"
@@ -23771,14 +15224,12 @@ fi
 #                                                                        #
 ##########################################################################
 # Check whether --enable-imsg was given.
-if test "${enable_imsg+set}" = set; then
+if test "${enable_imsg+set}" = set; then :
   enableval=$enable_imsg;
      case "${enableval}" in
        yes)	with_imsg="yes";;
        no)	with_imsg="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-imsg" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-imsg" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-imsg" "$LINENO" 5 ;;
      esac
 
 else
@@ -23790,9 +15241,7 @@ fi
 if test "$with_imsg" = "yes"; then
     BUILD_OPTS="$BUILD_OPTS imsg"
 
-cat >>confdefs.h <<\_ACEOF
-#define _IMSG 1
-_ACEOF
+$as_echo "#define _IMSG 1" >>confdefs.h
 
 fi
  if test "x$with_imsg" = "xyes"; then
@@ -23811,14 +15260,12 @@ fi
 #                                                                        #
 ##########################################################################
 # Check whether --enable-pldebug was given.
-if test "${enable_pldebug+set}" = set; then
+if test "${enable_pldebug+set}" = set; then :
   enableval=$enable_pldebug;
      case "${enableval}" in
        yes)	with_pldebug="yes" ;;
        no)	with_pldebug="no" ;;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-pldebug" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-pldebug" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-pldebug" "$LINENO" 5 ;;
      esac
 
 else
@@ -23830,9 +15277,7 @@ fi
 if test "$with_pldebug" = "yes"; then
     BUILD_OPTS="$BUILD_OPTS pldebug"
 
-cat >>confdefs.h <<\_ACEOF
-#define PLDBG 1
-_ACEOF
+$as_echo "#define PLDBG 1" >>confdefs.h
 
     PLSTATS=PLDBG
 
@@ -23854,15 +15299,13 @@ fi
 ##########################################################################
 with_rvous_dir=""
 # Check whether --enable-rendezvous was given.
-if test "${enable_rendezvous+set}" = set; then
+if test "${enable_rendezvous+set}" = set; then :
   enableval=$enable_rendezvous;
      case "${enableval}" in
        yes)	with_rvous="yes" ;;
        no)	with_rvous="no" ;;
        /*)	with_rvous="yes"; with_rvous_dir="${enableval}" ;;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-rendezvous" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-rendezvous" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-rendezvous" "$LINENO" 5 ;;
      esac
 
 else
@@ -23874,9 +15317,7 @@ fi
 if test "$with_rvous" = "yes"; then
     BUILD_OPTS="$BUILD_OPTS rendezvous"
 
-cat >>confdefs.h <<\_ACEOF
-#define _RENDEZVOUS 1
-_ACEOF
+$as_echo "#define _RENDEZVOUS 1" >>confdefs.h
 
     if test -z "$with_rvous_dir"
     then
@@ -23897,15 +15338,13 @@ fi
 
 with_php5="no"
 # Check whether --enable-php5 was given.
-if test "${enable_php5+set}" = set; then
+if test "${enable_php5+set}" = set; then :
   enableval=$enable_php5;
      case "${enableval}" in
        yes)	with_php5="yes" ;;
        no)	with_php5="no" ;;
        /*)	with_php5="${enableval}" ;;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-php5" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-php5" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-php5" "$LINENO" 5 ;;
      esac
 
 else
@@ -23916,7 +15355,7 @@ fi
 
 if test "x$with_php5" != "xno"
 then
-    { $as_echo "$as_me:$LINENO: checking libphp5 library usability" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking libphp5 library usability" >&5
 $as_echo_n "checking libphp5 library usability... " >&6; }
     save_CPPFLAGS="$CPPFLAGS"
     save_LIBS="$LIBS"
@@ -23935,20 +15374,13 @@ $as_echo_n "checking libphp5 library usability... " >&6; }
     esac
     LIBS="$LIBS $php5_LDFLAGS"
     CPPFLAGS="$CPPFLAGS $php5_CFLAGS"
-    if test "$cross_compiling" = yes; then
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+    if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <stdio.h>
@@ -23961,56 +15393,27 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
 
- { $as_echo "$as_me:$LINENO: result: good" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: good" >&5
 $as_echo "good" >&6; }
  BUILD_OPTS="$BUILD_OPTS php5"
 
-cat >>confdefs.h <<\_ACEOF
-#define _PHP 1
-_ACEOF
+$as_echo "#define _PHP 1" >>confdefs.h
 
  with_php5="yes"
 
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-
- { $as_echo "$as_me:$LINENO: result: bad. Check config.log for details" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: bad. Check config.log for details" >&5
 $as_echo "bad. Check config.log for details" >&6; }
  with_php5="no"
 
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
     LIBS="$save_LIBS"
     CPPFLAGS="$save_CPPFLAGS"
     LD_LIBRARY_PATH="$old_LD_LIBRARY_PATH"
@@ -24037,7 +15440,7 @@ fi
 
 
 # Check whether --with-xml-prefix was given.
-if test "${with_xml_prefix+set}" = set; then
+if test "${with_xml_prefix+set}" = set; then :
   withval=$with_xml_prefix; xml_config_prefix="$withval"
 else
   xml_config_prefix=""
@@ -24045,14 +15448,14 @@ fi
 
 
 # Check whether --with-xml-exec-prefix was given.
-if test "${with_xml_exec_prefix+set}" = set; then
+if test "${with_xml_exec_prefix+set}" = set; then :
   withval=$with_xml_exec_prefix; xml_config_exec_prefix="$withval"
 else
   xml_config_exec_prefix=""
 fi
 
 # Check whether --enable-xmltest was given.
-if test "${enable_xmltest+set}" = set; then
+if test "${enable_xmltest+set}" = set; then :
   enableval=$enable_xmltest;
 else
   enable_xmltest=yes
@@ -24074,9 +15477,9 @@ fi
 
   # Extract the first word of "xml2-config", so it can be a program name with args.
 set dummy xml2-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XML2_CONFIG+set}" = set; then
+if test "${ac_cv_path_XML2_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $XML2_CONFIG in
@@ -24089,14 +15492,14 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_XML2_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   test -z "$ac_cv_path_XML2_CONFIG" && ac_cv_path_XML2_CONFIG="no"
@@ -24105,16 +15508,16 @@ esac
 fi
 XML2_CONFIG=$ac_cv_path_XML2_CONFIG
 if test -n "$XML2_CONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $XML2_CONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML2_CONFIG" >&5
 $as_echo "$XML2_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
   min_xml_version=2.4.0
-  { $as_echo "$as_me:$LINENO: checking for libxml - version >= $min_xml_version" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml - version >= $min_xml_version" >&5
 $as_echo_n "checking for libxml - version >= $min_xml_version... " >&6; }
   no_xml=""
   if test "$XML2_CONFIG" = "no" ; then
@@ -24134,14 +15537,10 @@ $as_echo_n "checking for libxml - version >= $min_xml_version... " >&6; }
       CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
       LIBS="$XML_LIBS $LIBS"
       rm -f conf.xmltest
-      if test "$cross_compiling" = yes; then
+      if test "$cross_compiling" = yes; then :
   echo $ac_n "cross compiling; assumed OK... $ac_c"
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <stdlib.h>
@@ -24220,53 +15619,26 @@ main()
 }
 
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_run "$LINENO"; then :
 
-( exit $ac_status )
-no_xml=yes
+else
+  no_xml=yes
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
        CPPFLAGS="$ac_save_CPPFLAGS"
        LIBS="$ac_save_LIBS"
      fi
   fi
 
   if test "x$no_xml" = x ; then
-     { $as_echo "$as_me:$LINENO: result: yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)" >&5
 $as_echo "yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)" >&6; }
      :
   else
-     { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
      if test "$XML2_CONFIG" = "no" ; then
        echo "*** The xml2-config script installed by LIBXML could not be found"
@@ -24280,11 +15652,7 @@ $as_echo "no" >&6; }
           echo "*** Could not run libxml test program, checking why..."
           CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
           LIBS="$LIBS $XML_LIBS"
-          cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <libxml/xmlversion.h>
@@ -24298,27 +15666,7 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
    echo "*** The test program compiled, but did not run. This usually means"
           echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
           echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
@@ -24329,18 +15677,13 @@ $as_echo "$ac_try_echo") >&5
           echo "*** If you have an old version installed, it is best to remove it, although"
           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	 echo "*** The test program failed to compile or link. See the file config.log for the"
+   echo "*** The test program failed to compile or link. See the file config.log for the"
           echo "*** exact error that occured. This usually means LIBXML was incorrectly installed"
           echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
           echo "*** may want to edit the xml2-config script: $XML2_CONFIG"
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
           CPPFLAGS="$ac_save_CPPFLAGS"
           LIBS="$ac_save_LIBS"
        fi
@@ -24362,14 +15705,12 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
 #                                                                        #
 ##########################################################################
 # Check whether --enable-mono was given.
-if test "${enable_mono+set}" = set; then
+if test "${enable_mono+set}" = set; then :
   enableval=$enable_mono;
      case "${enableval}" in
        yes)	have_mono="yes" ;;
        no)	have_mono="no" ;;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --disable-mono" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --disable-mono" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --disable-mono" "$LINENO" 5 ;;
      esac
 
 else
@@ -24383,9 +15724,9 @@ then
     BUILD_OPTS="$BUILD_OPTS mono"
     # Extract the first word of "wget", so it can be a program name with args.
 set dummy wget; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_WGET+set}" = set; then
+if test "${ac_cv_path_WGET+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $WGET in
@@ -24398,14 +15739,14 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_WGET="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -24413,10 +15754,10 @@ esac
 fi
 WGET=$ac_cv_path_WGET
 if test -n "$WGET"; then
-  { $as_echo "$as_me:$LINENO: result: $WGET" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WGET" >&5
 $as_echo "$WGET" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -24439,15 +15780,13 @@ fi
 #                                                                        #
 ##########################################################################
 # Check whether --enable-hslookup was given.
-if test "${enable_hslookup+set}" = set; then
+if test "${enable_hslookup+set}" = set; then :
   enableval=$enable_hslookup;
      case "${enableval}" in
        yes)	with_hsl="yes" ;;
        no)	with_hsl="no" ;;
        /*)	with_hsl="${enableval}" ;;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --disable-hslookup" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --disable-hslookup" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --disable-hslookup" "$LINENO" 5 ;;
      esac
 
 else
@@ -24460,9 +15799,9 @@ if test "x$with_hsl" != "xno"
 then
     # Extract the first word of "hslookup", so it can be a program name with args.
 set dummy hslookup; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_HS_LOOKUP+set}" = set; then
+if test "${ac_cv_path_HS_LOOKUP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $HS_LOOKUP in
@@ -24476,14 +15815,14 @@ for as_dir in $as_dummy
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_HS_LOOKUP="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   test -z "$ac_cv_path_HS_LOOKUP" && ac_cv_path_HS_LOOKUP="notfound"
@@ -24492,10 +15831,10 @@ esac
 fi
 HS_LOOKUP=$ac_cv_path_HS_LOOKUP
 if test -n "$HS_LOOKUP"; then
-  { $as_echo "$as_me:$LINENO: result: $HS_LOOKUP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HS_LOOKUP" >&5
 $as_echo "$HS_LOOKUP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -24503,7 +15842,7 @@ fi
 
     if test "x$HS_LOOKUP" = "xnotfound"
     then
-       { $as_echo "$as_me:$LINENO: WARNING: The hslookup plugin will not be build" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The hslookup plugin will not be build" >&5
 $as_echo "$as_me: WARNING: The hslookup plugin will not be build" >&2;}
        with_hsl=no
     fi
@@ -24511,7 +15850,7 @@ fi
 
 if test "x$with_hsl" != "xno"
 then
-    { $as_echo "$as_me:$LINENO: checking hslookup library usability" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking hslookup library usability" >&5
 $as_echo_n "checking hslookup library usability... " >&6; }
 
     save_CPPFLAGS="$CPPFLAGS"
@@ -24534,20 +15873,13 @@ $as_echo_n "checking hslookup library usability... " >&6; }
     LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$with_hsl/lib"
     export LD_LIBRARY_PATH
 
-    if test "$cross_compiling" = yes; then
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+    if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <stdio.h>
@@ -24564,52 +15896,25 @@ main ()
   exit (1);
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
 
-  { $as_echo "$as_me:$LINENO: result: good" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: good" >&5
 $as_echo "good" >&6; }
 
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-
-  { $as_echo "$as_me:$LINENO: result: bad. Check config.log for details" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: bad. Check config.log for details" >&5
 $as_echo "bad. Check config.log for details" >&6; }
   with_hsl="no"
-  { $as_echo "$as_me:$LINENO: WARNING: The ImageMagick plugin will not be build" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The ImageMagick plugin will not be build" >&5
 $as_echo "$as_me: WARNING: The ImageMagick plugin will not be build" >&2;}
 
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
 
-
     LIBS="$save_LIBS"
     CPPFLAGS="$save_CPPFLAGS"
     LD_LIBRARY_PATH="$save_LD_LIBRARY_PATH"
@@ -24634,15 +15939,13 @@ fi
 #                                                                        #
 ##########################################################################
 # Check whether --enable-imagemagick was given.
-if test "${enable_imagemagick+set}" = set; then
+if test "${enable_imagemagick+set}" = set; then :
   enableval=$enable_imagemagick;
      case "${enableval}" in
        yes)	with_im="yes" ;;
        no)	with_im="no" ;;
        /*)	with_im="${enableval}" ;;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --disable-imagemagick" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --disable-imagemagick" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --disable-imagemagick" "$LINENO" 5 ;;
      esac
 
 else
@@ -24655,9 +15958,9 @@ if test "x$with_im" != "xno"
 then
     # Extract the first word of "Wand-config", so it can be a program name with args.
 set dummy Wand-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_IM_CONFIG+set}" = set; then
+if test "${ac_cv_path_IM_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $IM_CONFIG in
@@ -24671,14 +15974,14 @@ for as_dir in $as_dummy
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_IM_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   test -z "$ac_cv_path_IM_CONFIG" && ac_cv_path_IM_CONFIG="notfound"
@@ -24687,10 +15990,10 @@ esac
 fi
 IM_CONFIG=$ac_cv_path_IM_CONFIG
 if test -n "$IM_CONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $IM_CONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IM_CONFIG" >&5
 $as_echo "$IM_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -24698,7 +16001,7 @@ fi
 
     if test "x$IM_CONFIG" = "xnotfound"
     then
-       { $as_echo "$as_me:$LINENO: WARNING: The ImageMagick plugin will not be build" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The ImageMagick plugin will not be build" >&5
 $as_echo "$as_me: WARNING: The ImageMagick plugin will not be build" >&2;}
        with_im=no
     fi
@@ -24706,7 +16009,7 @@ fi
 
 if test "x$with_im" != "xno"
 then
-    { $as_echo "$as_me:$LINENO: checking ImageMagick library usability" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking ImageMagick library usability" >&5
 $as_echo_n "checking ImageMagick library usability... " >&6; }
 
     save_CPPFLAGS="$CPPFLAGS"
@@ -24723,20 +16026,13 @@ $as_echo_n "checking ImageMagick library usability... " >&6; }
     LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$with_im/lib"
     export LD_LIBRARY_PATH
 
-    if test "$cross_compiling" = yes; then
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+    if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <stdio.h>
@@ -24744,60 +16040,33 @@ cat >>conftest.$ac_ext <<_ACEOF
 #include <string.h>
 #include <time.h>
 #include <wand/magick-wand.h>
-MagickWand *magick_wand;
-int
-main ()
-{
-  MagickWandGenesis();
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+MagickWand *magick_wand;
+int
+main ()
+{
+  MagickWandGenesis();
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
 
-  { $as_echo "$as_me:$LINENO: result: good" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: good" >&5
 $as_echo "good" >&6; }
 
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
 
-  { $as_echo "$as_me:$LINENO: result: bad. Check config.log for details" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: bad. Check config.log for details" >&5
 $as_echo "bad. Check config.log for details" >&6; }
   with_im="no"
-  { $as_echo "$as_me:$LINENO: WARNING: The ImageMagick plugin will not be build" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The ImageMagick plugin will not be build" >&5
 $as_echo "$as_me: WARNING: The ImageMagick plugin will not be build" >&2;}
 
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
 
-
     LIBS="$save_LIBS"
     CPPFLAGS="$save_CPPFLAGS"
     LD_LIBRARY_PATH="$save_LD_LIBRARY_PATH"
@@ -24822,15 +16091,13 @@ fi
 #                                                                        #
 ##########################################################################
 # Check whether --enable-wbxml2 was given.
-if test "${enable_wbxml2+set}" = set; then
+if test "${enable_wbxml2+set}" = set; then :
   enableval=$enable_wbxml2;
      case "${enableval}" in
        yes)	with_wbxml2="yes" ;;
        no)	with_wbxml2="no" ;;
        /*)	with_wbxml2="${enableval}" ;;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --disable-wbxml2" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --disable-wbxml2" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --disable-wbxml2" "$LINENO" 5 ;;
      esac
 
 else
@@ -24841,7 +16108,7 @@ fi
 
 if test "x$with_wbxml2" != "xno"
 then
-    { $as_echo "$as_me:$LINENO: checking WBXML2 library usability" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking WBXML2 library usability" >&5
 $as_echo_n "checking WBXML2 library usability... " >&6; }
     old_CFLAGS="$CFLAGS"
     save_LIBS="$LIBS"
@@ -24862,20 +16129,13 @@ $as_echo_n "checking WBXML2 library usability... " >&6; }
     CFLAGS="$CFLAGS $WBXML2_CFLAGS"
     LIBS="$LIBS $WBXML2_LDFLAGS"
 
-    if test "$cross_compiling" = yes; then
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+    if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <stdio.h>
@@ -24890,49 +16150,22 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
 
- { $as_echo "$as_me:$LINENO: result: good" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: good" >&5
 $as_echo "good" >&6; }
 
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
 
- { $as_echo "$as_me:$LINENO: result: bad. Check config.log for details" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: bad. Check config.log for details" >&5
 $as_echo "bad. Check config.log for details" >&6; }
  with_wbxml2="no"
 
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
     CFLAGS="$old_CFLAGS"
     LIBS="$save_LIBS"
     LD_LIBRARY_PATH="$old_LD_LIBRARY_PATH"
@@ -24957,14 +16190,12 @@ fi
 ##########################################################################
 with_perl="no"
 # Check whether --enable-perl was given.
-if test "${enable_perl+set}" = set; then
+if test "${enable_perl+set}" = set; then :
   enableval=$enable_perl;
      case "${enableval}" in
        yes)	with_perl="yes" ;;
        no)	with_perl="no" ;;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-perl" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-perl" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-perl" "$LINENO" 5 ;;
      esac
 
 else
@@ -24996,14 +16227,12 @@ fi
 ##########################################################################
 with_python="no"
 # Check whether --enable-python was given.
-if test "${enable_python+set}" = set; then
+if test "${enable_python+set}" = set; then :
   enableval=$enable_python;
      case "${enableval}" in
        yes)	with_python="yes";;
        no)	with_python="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-python" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-python" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-python" "$LINENO" 5 ;;
      esac
 
 else
@@ -25044,14 +16273,12 @@ fi
 ##########################################################################
 with_ruby="no"
 # Check whether --enable-ruby was given.
-if test "${enable_ruby+set}" = set; then
+if test "${enable_ruby+set}" = set; then :
   enableval=$enable_ruby;
      case "${enableval}" in
        yes)	with_ruby="yes";;
        no)	with_ruby="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-ruby" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-ruby" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-ruby" "$LINENO" 5 ;;
      esac
 
 else
@@ -25069,22 +16296,15 @@ if test "x$RUBY" != "x"  -a "x$with_ruby" != "xno" ; then
     CPPFLAGS="$CPPFLAGS $RUBY_CFLAGS"
     LIBS="$LIBS $RUBY_LDFLAGS"
 
-    { $as_echo "$as_me:$LINENO: checking Ruby library usability" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking Ruby library usability" >&5
 $as_echo_n "checking Ruby library usability... " >&6; }
-    if test "$cross_compiling" = yes; then
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+    if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <stdio.h>
@@ -25097,50 +16317,23 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
 
- { $as_echo "$as_me:$LINENO: result: good" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: good" >&5
 $as_echo "good" >&6; }
 
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
 
- { $as_echo "$as_me:$LINENO: result: bad. Check config.log for details" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: bad. Check config.log for details" >&5
 $as_echo "bad. Check config.log for details" >&6; }
  with_ruby="no"
 
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
 
-
     LIBS="$save_LIBS"
     CPPFLAGS="$save_CPPFLAGS"
 fi
@@ -25164,14 +16357,12 @@ fi
 with_zlib="no"
 
 # Check whether --with-internal-zlib was given.
-if test "${with_internal_zlib+set}" = set; then
+if test "${with_internal_zlib+set}" = set; then :
   withval=$with_internal_zlib;
      case "${withval}" in
        yes)	with_zlib="internal";;
        no)	with_zlib="external";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${withval} for --enable-zlib" >&5
-$as_echo "$as_me: error: bad value ${withval} for --enable-zlib" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${withval} for --enable-zlib" "$LINENO" 5 ;;
      esac
 
 else
@@ -25182,152 +16373,20 @@ fi
 
 if test "x$with_zlib" != "xinternal"
 then
-    if test "${ac_cv_header_zlib_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for zlib.h" >&5
-$as_echo_n "checking for zlib.h... " >&6; }
-if test "${ac_cv_header_zlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
-$as_echo "$ac_cv_header_zlib_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking zlib.h usability" >&5
-$as_echo_n "checking zlib.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <zlib.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking zlib.h presence" >&5
-$as_echo_n "checking zlib.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <zlib.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: zlib.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for zlib.h" >&5
-$as_echo_n "checking for zlib.h... " >&6; }
-if test "${ac_cv_header_zlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_zlib_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
-$as_echo "$ac_cv_header_zlib_h" >&6; }
+    ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_zlib_h" = x""yes; then :
 
 fi
 
 
-    { $as_echo "$as_me:$LINENO: checking for main in -lz" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lz" >&5
 $as_echo_n "checking for main in -lz... " >&6; }
-if test "${ac_cv_lib_z_main+set}" = set; then
+if test "${ac_cv_lib_z_main+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lz  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 
@@ -25339,43 +16398,18 @@ return main ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_z_main=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_z_main=no
+  ac_cv_lib_z_main=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_z_main" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_main" >&5
 $as_echo "$ac_cv_lib_z_main" >&6; }
-if test "x$ac_cv_lib_z_main" = x""yes; then
+if test "x$ac_cv_lib_z_main" = x""yes; then :
   with_zlib=yes
 else
   with_zlib=internal
@@ -25412,7 +16446,7 @@ fi
 
 
 # Check whether --with-malloc-debug was given.
-if test "${with_malloc_debug+set}" = set; then
+if test "${with_malloc_debug+set}" = set; then :
   withval=$with_malloc_debug;  with_malloc_debug="$withval"
 else
    with_malloc_debug="no"
@@ -25423,8 +16457,26 @@ fi
 if test "x$with_malloc_debug" = "xyes"; then
     BUILD_OPTS="$BUILD_OPTS malloc_debug"
     CCDEBUG="$CCDEBUG -DMALLOC_DEBUG"
-    CCOPT="$CCOPT -g"
-    AM_LDFLAGS="$AM_LDFLAGS -g"
+    CCOPT="-g"
+    AM_LDFLAGS="-g"
+fi
+
+
+
+# Check whether --with-mtx-debug was given.
+if test "${with_mtx_debug+set}" = set; then :
+  withval=$with_mtx_debug;  with_mtx_debug="$withval"
+else
+   with_mtx_debug="no"
+
+fi
+
+
+if test "x$with_mtx_debug" = "xyes"; then
+    BUILD_OPTS="$BUILD_OPTS mtx_debug"
+    CCDEBUG="$CCDEBUG -DMTX_DEBUG"
+    CCOPT="-g"
+    AM_LDFLAGS="-g"
 fi
 
 
@@ -25436,7 +16488,7 @@ fi
 
 
 # Check whether --with-pthreads was given.
-if test "${with_pthreads+set}" = set; then
+if test "${with_pthreads+set}" = set; then :
   withval=$with_pthreads;  with_pthreads="$withval"
 else
    with_pthreads="yes"
@@ -25445,18 +16497,14 @@ fi
 
 
 if test $with_pthreads = "yes"; then
-    { $as_echo "$as_me:$LINENO: checking for pthread_create in -lpthreads" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreads" >&5
 $as_echo_n "checking for pthread_create in -lpthreads... " >&6; }
-if test "${ac_cv_lib_pthreads_pthread_create+set}" = set; then
+if test "${ac_cv_lib_pthreads_pthread_create+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpthreads  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -25474,43 +16522,18 @@ return pthread_create ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_pthreads_pthread_create=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_pthreads_pthread_create=no
+  ac_cv_lib_pthreads_pthread_create=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_create" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_create" >&5
 $as_echo "$ac_cv_lib_pthreads_pthread_create" >&6; }
-if test "x$ac_cv_lib_pthreads_pthread_create" = x""yes; then
+if test "x$ac_cv_lib_pthreads_pthread_create" = x""yes; then :
   BUILD_OPTS="$BUILD_OPTS pthreads"
 	WITH_PTHREADS="yes"
 	if test "$host_os" = "osf3.2"
@@ -25518,37 +16541,27 @@ if test "x$ac_cv_lib_pthreads_pthread_create" = x""yes; then
 	  BUILD_OPTS="$BUILD_OPTS old_pthreads"
 	  LIBTHR="-lpthreads -lmach -lc_r"
 
-cat >>confdefs.h <<\_ACEOF
-#define OLD_PTHREADS 1
-_ACEOF
+$as_echo "#define OLD_PTHREADS 1" >>confdefs.h
 
 	else
 	  LIBTHR="-lpthreads"
 	fi
 
-cat >>confdefs.h <<\_ACEOF
-#define _REENTRANT 1
-_ACEOF
+$as_echo "#define _REENTRANT 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define WITH_PTHREADS 1
-_ACEOF
+$as_echo "#define WITH_PTHREADS 1" >>confdefs.h
 
 
 else
-  { $as_echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
 $as_echo_n "checking for pthread_create in -lpthread... " >&6; }
-if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then
+if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpthread  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -25566,55 +16579,26 @@ return pthread_create ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_pthread_pthread_create=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_pthread_pthread_create=no
+  ac_cv_lib_pthread_pthread_create=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then
+if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then :
   BUILD_OPTS="$BUILD_OPTS pthreads"
 	  WITH_PTHREADS="yes"
 	  LIBTHR="-lpthread"
 
-cat >>confdefs.h <<\_ACEOF
-#define _REENTRANT 1
-_ACEOF
+$as_echo "#define _REENTRANT 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define WITH_PTHREADS 1
-_ACEOF
+$as_echo "#define WITH_PTHREADS 1" >>confdefs.h
 
 fi
 
@@ -25624,9 +16608,9 @@ fi
 if test "x$have_mono" = "xyes" ; then
     # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $PKG_CONFIG in
@@ -25639,14 +16623,14 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
@@ -25655,18 +16639,16 @@ esac
 fi
 PKG_CONFIG=$ac_cv_path_PKG_CONFIG
 if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
 $as_echo "$PKG_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
     if test "x$PKG_CONFIG" = "xno"; then
-	{ { $as_echo "$as_me:$LINENO: error: You need to install pkg-config" >&5
-$as_echo "$as_me: error: You need to install pkg-config" >&2;}
-   { (exit 1); exit 1; }; }
+	as_fn_error "You need to install pkg-config" "$LINENO" 5
     fi
 
     BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
@@ -25677,7 +16659,7 @@ $as_echo "$as_me: error: You need to install pkg-config" >&2;}
     pkg_config_path=
 
 # Check whether --with-crosspkgdir was given.
-if test "${with_crosspkgdir+set}" = set; then
+if test "${with_crosspkgdir+set}" = set; then :
   withval=$with_crosspkgdir; if test x$with_crosspkgdir = "x"; then
 		if test -s $PKG_CONFIG_PATH; then
 			pkg_config_path=$PKG_CONFIG_PATH
@@ -25691,125 +16673,34 @@ if test "${with_crosspkgdir+set}" = set; then
 fi
 
 
-## Versions of dependencies
-    GLIB_REQUIRED_VERSION=1.3.11
-
-    $PKG_CONFIG --atleast-version=$GLIB_REQUIRED_VERSION glib-2.0
-    if test $? -gt 0 ; then
-	{ { $as_echo "$as_me:$LINENO: error: You need to install glib-2.0 version $GLIB_REQUIRED_VERSION or greater" >&5
-$as_echo "$as_me: error: You need to install glib-2.0 version $GLIB_REQUIRED_VERSION or greater" >&2;}
-   { (exit 1); exit 1; }; }
-    fi
-#    PKG_CHECK_MODULES_(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
-
-    GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
-    GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
-    GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
-    GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
-
-
-
-
-
-fi
-
-save_LIBS="$LIBS"
-LIBS="$LIBTHR $LIBS"
-
-
-for ac_func in pthread_attr_setstacksize pthread_attr_getstacksize
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
-fi
+## Versions of dependencies
+    GLIB_REQUIRED_VERSION=1.3.11
+
+    $PKG_CONFIG --atleast-version=$GLIB_REQUIRED_VERSION glib-2.0
+    if test $? -gt 0 ; then
+	as_fn_error "You need to install glib-2.0 version $GLIB_REQUIRED_VERSION or greater" "$LINENO" 5
+    fi
+#    PKG_CHECK_MODULES_(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
+
+    GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
+    GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
+    GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
+    GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
+
+
+
+
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+
+save_LIBS="$LIBS"
+LIBS="$LIBTHR $LIBS"
+for ac_func in pthread_attr_setstacksize pthread_attr_getstacksize pthread_sigmask
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -25835,14 +16726,12 @@ fi
 #                                                                        #
 ##########################################################################
 # Check whether --enable-aio was given.
-if test "${enable_aio+set}" = set; then
+if test "${enable_aio+set}" = set; then :
   enableval=$enable_aio;
      case "${enableval}" in
        yes)	with_aio="yes" ;;
        no)	with_aio="no" ;;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-aio" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-aio" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-aio" "$LINENO" 5 ;;
      esac
 
 else
@@ -25854,150 +16743,12 @@ fi
 if test "$with_aio" != "no"
 then
    AIOLIB=""
-
-
-for ac_header in aio.h sched.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+   for ac_header in aio.h sched.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -26006,18 +16757,14 @@ fi
 
 done
 
-   { $as_echo "$as_me:$LINENO: checking for aio_read in -lrt" >&5
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for aio_read in -lrt" >&5
 $as_echo_n "checking for aio_read in -lrt... " >&6; }
-if test "${ac_cv_lib_rt_aio_read+set}" = set; then
+if test "${ac_cv_lib_rt_aio_read+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lrt  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -26035,49 +16782,22 @@ return aio_read ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_rt_aio_read=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_rt_aio_read=no
+  ac_cv_lib_rt_aio_read=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_rt_aio_read" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_aio_read" >&5
 $as_echo "$ac_cv_lib_rt_aio_read" >&6; }
-if test "x$ac_cv_lib_rt_aio_read" = x""yes; then
+if test "x$ac_cv_lib_rt_aio_read" = x""yes; then :
 
 	AIOLIB="-lrt"
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_AIO 1
-_ACEOF
+$as_echo "#define HAVE_AIO 1" >>confdefs.h
 
 
 fi
@@ -26092,18 +16812,18 @@ fi
 ##									##
 ##########################################################################
 
-{ $as_echo "$as_me:$LINENO: checking for --with-libs" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-libs" >&5
 $as_echo_n "checking for --with-libs... " >&6; }
 
 # Check whether --with-libs was given.
-if test "${with_libs+set}" = set; then
+if test "${with_libs+set}" = set; then :
   withval=$with_libs;
-  { $as_echo "$as_me:$LINENO: result: $withval" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
 $as_echo "$withval" >&6; }
   VLIBS="$withval $VLIBS"
 
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -26118,33 +16838,27 @@ fi
 LIBRDL=""
 _save_LIBS=$LIBS
 
-{ $as_echo "$as_me:$LINENO: checking for --with-editline" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-editline" >&5
 $as_echo_n "checking for --with-editline... " >&6; }
 
 # Check whether --with-editline was given.
-if test "${with_editline+set}" = set; then
+if test "${with_editline+set}" = set; then :
   withval=$with_editline;
-  { $as_echo "$as_me:$LINENO: result: $withval" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
 $as_echo "$withval" >&6; }
 
-cat >>confdefs.h <<\_ACEOF
-#define WITH_EDITLINE 1
-_ACEOF
+$as_echo "#define WITH_EDITLINE 1" >>confdefs.h
 
   if test -d "$withval"
   then
       LDFLAGS="$LDFLAGS -L$withval"
   fi
   # first check if we can compile without lib termcap
-  { $as_echo "$as_me:$LINENO: checking for -ledit without -ltermcap" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ledit without -ltermcap" >&5
 $as_echo_n "checking for -ledit without -ltermcap... " >&6; }
   # check if libedit exists
   LIBS="$LIBS -ledit"
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 extern char *readline();
 int
@@ -26155,55 +16869,28 @@ char *line=readline();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
 	BUILD_OPTS="$BUILD_OPTS editline"
 	LIBRDL="-ledit"
-	{ $as_echo "$as_me:$LINENO: result: yes" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
 
-	{ $as_echo "$as_me:$LINENO: result: no" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-	{ $as_echo "$as_me:$LINENO: checking for -ledit that needs -ltermcap..." >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ledit that needs -ltermcap..." >&5
 $as_echo "$as_me: checking for -ledit that needs -ltermcap..." >&6;}
 	termcap=
-	{ $as_echo "$as_me:$LINENO: checking for tgetent in -ltermcap" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5
 $as_echo_n "checking for tgetent in -ltermcap... " >&6; }
-if test "${ac_cv_lib_termcap_tgetent+set}" = set; then
+if test "${ac_cv_lib_termcap_tgetent+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ltermcap  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -26221,58 +16908,29 @@ return tgetent ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_termcap_tgetent=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_termcap_tgetent=no
+  ac_cv_lib_termcap_tgetent=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_tgetent" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_tgetent" >&5
 $as_echo "$ac_cv_lib_termcap_tgetent" >&6; }
-if test "x$ac_cv_lib_termcap_tgetent" = x""yes; then
+if test "x$ac_cv_lib_termcap_tgetent" = x""yes; then :
   termcap=termcap
 else
 
-	{ $as_echo "$as_me:$LINENO: checking for tgetent in -ltermlib" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermlib" >&5
 $as_echo_n "checking for tgetent in -ltermlib... " >&6; }
-if test "${ac_cv_lib_termlib_tgetent+set}" = set; then
+if test "${ac_cv_lib_termlib_tgetent+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ltermlib  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -26290,58 +16948,29 @@ return tgetent ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_termlib_tgetent=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_termlib_tgetent=no
+  ac_cv_lib_termlib_tgetent=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_termlib_tgetent" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termlib_tgetent" >&5
 $as_echo "$ac_cv_lib_termlib_tgetent" >&6; }
-if test "x$ac_cv_lib_termlib_tgetent" = x""yes; then
+if test "x$ac_cv_lib_termlib_tgetent" = x""yes; then :
   termcap=termlib
 else
 
-	{ $as_echo "$as_me:$LINENO: checking for tgetent in -lcurses" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lcurses" >&5
 $as_echo_n "checking for tgetent in -lcurses... " >&6; }
-if test "${ac_cv_lib_curses_tgetent+set}" = set; then
+if test "${ac_cv_lib_curses_tgetent+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcurses  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -26359,58 +16988,29 @@ return tgetent ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_curses_tgetent=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_curses_tgetent=no
+  ac_cv_lib_curses_tgetent=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_curses_tgetent" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_tgetent" >&5
 $as_echo "$ac_cv_lib_curses_tgetent" >&6; }
-if test "x$ac_cv_lib_curses_tgetent" = x""yes; then
+if test "x$ac_cv_lib_curses_tgetent" = x""yes; then :
   termcap=curses
 else
 
-	{ $as_echo "$as_me:$LINENO: checking for tgetent in -lncurses" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncurses" >&5
 $as_echo_n "checking for tgetent in -lncurses... " >&6; }
-if test "${ac_cv_lib_ncurses_tgetent+set}" = set; then
+if test "${ac_cv_lib_ncurses_tgetent+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lncurses  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -26428,49 +17028,22 @@ return tgetent ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_ncurses_tgetent=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_ncurses_tgetent=no
+  ac_cv_lib_ncurses_tgetent=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_tgetent" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_tgetent" >&5
 $as_echo "$ac_cv_lib_ncurses_tgetent" >&6; }
-if test "x$ac_cv_lib_ncurses_tgetent" = x""yes; then
+if test "x$ac_cv_lib_ncurses_tgetent" = x""yes; then :
   termcap=ncurses
 else
 
-	{ { $as_echo "$as_me:$LINENO: error: no working -ltermcap/termlib found -- do not use --with-editline" >&5
-$as_echo "$as_me: error: no working -ltermcap/termlib found -- do not use --with-editline" >&2;}
-   { (exit 1); exit 1; }; }
+	as_fn_error "no working -ltermcap/termlib found -- do not use --with-editline" "$LINENO" 5
 fi
 
 fi
@@ -26480,13 +17053,9 @@ fi
 fi
 
 	LIBS="$LIBS -l$termcap"
-	{ $as_echo "$as_me:$LINENO: checking for -ledit" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ledit" >&5
 $as_echo_n "checking for -ledit... " >&6; }
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 extern char *readline();
 int
@@ -26497,57 +17066,28 @@ char *line=readline();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
 	   BUILD_OPTS="$BUILD_OPTS editline"
 	   LIBRDL="-ledit -l$termcap"
-	   { $as_echo "$as_me:$LINENO: result: yes" >&5
+	   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
-	   { { $as_echo "$as_me:$LINENO: error: no working editline library found -- do not use --with-editline" >&5
-$as_echo "$as_me: error: no working editline library found -- do not use --with-editline" >&2;}
-   { (exit 1); exit 1; }; }
+	   as_fn_error "no working editline library found -- do not use --with-editline" "$LINENO" 5
 
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
 else
 
-    { $as_echo "$as_me:$LINENO: result: no" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 
@@ -26555,33 +17095,27 @@ fi
 
 
 
-{ $as_echo "$as_me:$LINENO: checking for --with-readline" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-readline" >&5
 $as_echo_n "checking for --with-readline... " >&6; }
 
 # Check whether --with-readline was given.
-if test "${with_readline+set}" = set; then
+if test "${with_readline+set}" = set; then :
   withval=$with_readline;
-  { $as_echo "$as_me:$LINENO: result: $withval" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5
 $as_echo "$withval" >&6; }
 
-cat >>confdefs.h <<\_ACEOF
-#define WITH_READLINE 1
-_ACEOF
+$as_echo "#define WITH_READLINE 1" >>confdefs.h
 
   if test -d "$withval"
   then
       LDFLAGS="$LDFLAGS -L$withval"
   fi
   # first check if we can compile without lib termcap
-  { $as_echo "$as_me:$LINENO: checking for -lreadline without -ltermcap" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lreadline without -ltermcap" >&5
 $as_echo_n "checking for -lreadline without -ltermcap... " >&6; }
   # check if a libreadline exists
   LIBS="$LIBS -lreadline"
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 extern char *readline();
 int
@@ -26592,55 +17126,28 @@ char *line=readline();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
 	BUILD_OPTS="$BUILD_OPTS readline"
 	LIBRDL="-lreadline"
-	{ $as_echo "$as_me:$LINENO: result: yes" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
-	{ $as_echo "$as_me:$LINENO: result: no" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-	{ $as_echo "$as_me:$LINENO: checking for -lreadline that needs -ltermcap..." >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lreadline that needs -ltermcap..." >&5
 $as_echo "$as_me: checking for -lreadline that needs -ltermcap..." >&6;}
 	termcap=
-	{ $as_echo "$as_me:$LINENO: checking for tgetent in -ltermcap" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5
 $as_echo_n "checking for tgetent in -ltermcap... " >&6; }
-if test "${ac_cv_lib_termcap_tgetent+set}" = set; then
+if test "${ac_cv_lib_termcap_tgetent+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ltermcap  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -26658,58 +17165,29 @@ return tgetent ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_termcap_tgetent=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_termcap_tgetent=no
+  ac_cv_lib_termcap_tgetent=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_tgetent" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_tgetent" >&5
 $as_echo "$ac_cv_lib_termcap_tgetent" >&6; }
-if test "x$ac_cv_lib_termcap_tgetent" = x""yes; then
+if test "x$ac_cv_lib_termcap_tgetent" = x""yes; then :
   termcap=termcap
 else
 
-	{ $as_echo "$as_me:$LINENO: checking for tgetent in -ltermlib" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermlib" >&5
 $as_echo_n "checking for tgetent in -ltermlib... " >&6; }
-if test "${ac_cv_lib_termlib_tgetent+set}" = set; then
+if test "${ac_cv_lib_termlib_tgetent+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ltermlib  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -26720,65 +17198,36 @@ extern "C"
 #endif
 char tgetent ();
 int
-main ()
-{
-return tgetent ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+main ()
+{
+return tgetent ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_termlib_tgetent=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_termlib_tgetent=no
+  ac_cv_lib_termlib_tgetent=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_termlib_tgetent" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termlib_tgetent" >&5
 $as_echo "$ac_cv_lib_termlib_tgetent" >&6; }
-if test "x$ac_cv_lib_termlib_tgetent" = x""yes; then
+if test "x$ac_cv_lib_termlib_tgetent" = x""yes; then :
   termcap=termlib
 else
 
-	{ $as_echo "$as_me:$LINENO: checking for tgetent in -lncurses" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncurses" >&5
 $as_echo_n "checking for tgetent in -lncurses... " >&6; }
-if test "${ac_cv_lib_ncurses_tgetent+set}" = set; then
+if test "${ac_cv_lib_ncurses_tgetent+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lncurses  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -26796,58 +17245,29 @@ return tgetent ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_ncurses_tgetent=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_ncurses_tgetent=no
+  ac_cv_lib_ncurses_tgetent=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_tgetent" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_tgetent" >&5
 $as_echo "$ac_cv_lib_ncurses_tgetent" >&6; }
-if test "x$ac_cv_lib_ncurses_tgetent" = x""yes; then
+if test "x$ac_cv_lib_ncurses_tgetent" = x""yes; then :
   termcap=ncurses
 else
 
-	{ $as_echo "$as_me:$LINENO: checking for tgetent in -lcurses" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lcurses" >&5
 $as_echo_n "checking for tgetent in -lcurses... " >&6; }
-if test "${ac_cv_lib_curses_tgetent+set}" = set; then
+if test "${ac_cv_lib_curses_tgetent+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcurses  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -26865,49 +17285,22 @@ return tgetent ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_curses_tgetent=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_curses_tgetent=no
+  ac_cv_lib_curses_tgetent=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_curses_tgetent" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_tgetent" >&5
 $as_echo "$ac_cv_lib_curses_tgetent" >&6; }
-if test "x$ac_cv_lib_curses_tgetent" = x""yes; then
+if test "x$ac_cv_lib_curses_tgetent" = x""yes; then :
   termcap=curses
 else
 
-	{ { $as_echo "$as_me:$LINENO: error: no working -ltermcap/termlib found -- do not use --with-readline" >&5
-$as_echo "$as_me: error: no working -ltermcap/termlib found -- do not use --with-readline" >&2;}
-   { (exit 1); exit 1; }; }
+	as_fn_error "no working -ltermcap/termlib found -- do not use --with-readline" "$LINENO" 5
 fi
 
 fi
@@ -26917,13 +17310,9 @@ fi
 fi
 
 	LIBS="$LIBS -l$termcap"
-	{ $as_echo "$as_me:$LINENO: checking for -lreadline" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lreadline" >&5
 $as_echo_n "checking for -lreadline... " >&6; }
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 extern char *readline();
 int
@@ -26934,55 +17323,26 @@ char *line=readline();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
 	   BUILD_OPTS="$BUILD_OPTS readline"
 	   LIBRDL="-lreadline -lhistory -l$termcap"
-	   { $as_echo "$as_me:$LINENO: result: yes" >&5
+	   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
 
-	   { { $as_echo "$as_me:$LINENO: error: no working GNU readline library found -- do not use --with-readline" >&5
-$as_echo "$as_me: error: no working GNU readline library found -- do not use --with-readline" >&2;}
-   { (exit 1); exit 1; }; }
+	   as_fn_error "no working GNU readline library found -- do not use --with-readline" "$LINENO" 5
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
 else
 
-    { $as_echo "$as_me:$LINENO: result: no" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 
@@ -27000,106 +17360,18 @@ LIBS=$_save_LIBS
 ##########################################################################
 
 LIBDL=""
-{ $as_echo "$as_me:$LINENO: checking for dlopen" >&5
-$as_echo_n "checking for dlopen... " >&6; }
-if test "${ac_cv_func_dlopen+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define dlopen innocuous_dlopen
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char dlopen (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef dlopen
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_dlopen || defined __stub___dlopen
-choke me
-#endif
-
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_dlopen=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_func_dlopen=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-$as_echo "$ac_cv_func_dlopen" >&6; }
-if test "x$ac_cv_func_dlopen" = x""yes; then
+ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = x""yes; then :
   LIBDL=""
 else
-  { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -27117,43 +17389,18 @@ return dlopen ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_dl_dlopen=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dl_dlopen=no
+  ac_cv_lib_dl_dlopen=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
   LIBDL="-ldl"
 fi
 
@@ -27161,18 +17408,14 @@ fi
 fi
 
 
-{ $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -27190,62 +17433,31 @@ return dlopen ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_dl_dlopen=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dl_dlopen=no
+  ac_cv_lib_dl_dlopen=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBDL 1
-_ACEOF
+$as_echo "#define HAVE_LIBDL 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
 $as_echo_n "checking for shl_load in -ldld... " >&6; }
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -27263,47 +17475,20 @@ return shl_load ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_dld_shl_load=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dld_shl_load=no
+  ac_cv_lib_dld_shl_load=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
 $as_echo "$ac_cv_lib_dld_shl_load" >&6; }
-if test "x$ac_cv_lib_dld_shl_load" = x""yes; then
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SHL_LOAD 1
-_ACEOF
+$as_echo "#define HAVE_SHL_LOAD 1" >>confdefs.h
 
 fi
 
@@ -27317,21 +17502,19 @@ srvrlibs="$srvrlibs $LIBDL"
 ##									##
 ##########################################################################
 
-{ $as_echo "$as_me:$LINENO: checking for iODBC location" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for iODBC location" >&5
 $as_echo_n "checking for iODBC location... " >&6; }
 virt_iodbc_dir="libsrc/odbcsdk"
 virt_do_iodbc="no"
 
 # Check whether --with-iodbc was given.
-if test "${with_iodbc+set}" = set; then
+if test "${with_iodbc+set}" = set; then :
   withval=$with_iodbc;
       case "${withval}" in
 	  yes)	virt_do_iodbc="yes" ;;
 	  no)	virt_do_iodbc="no"  ;;
 	  /*)	virt_do_iodbc="yes" virt_iodbc_dir="${withval}" ;;
-	  *)	{ { $as_echo "$as_me:$LINENO: error: \"Invalid value for the --with-iodbc : must be an absolute path\"" >&5
-$as_echo "$as_me: error: \"Invalid value for the --with-iodbc : must be an absolute path\"" >&2;}
-   { (exit 1); exit 1; }; } ;;
+	  *)	as_fn_error "\"Invalid value for the --with-iodbc : must be an absolute path\"" "$LINENO" 5 ;;
       esac
 
 else
@@ -27339,12 +17522,10 @@ else
 fi
 
 
-{ $as_echo "$as_me:$LINENO: result: $virt_iodbc_dir" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $virt_iodbc_dir" >&5
 $as_echo "$virt_iodbc_dir" >&6; }
 
-cat >>confdefs.h <<\_ACEOF
-#define NO_UDBC_SDK 1
-_ACEOF
+$as_echo "#define NO_UDBC_SDK 1" >>confdefs.h
 
 
 
@@ -27358,153 +17539,12 @@ then
 
     saved_CPPFLAGS="$CPPFLAGS"
     CPPFLAGS="$iodbc_CPPFLAGS $CPPFLAGS"
-
-
-
-
-
-for ac_header in sql.h sqlext.h sqlucode.h iodbcext.h odbcinst.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+    for ac_header in sql.h sqlext.h sqlucode.h iodbcext.h odbcinst.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -27518,18 +17558,14 @@ done
     ccincl="$iodbc_CPPFLAGS $ccincl"
 
     iodbc_LDFLAGS="-L$virt_iodbc_dir/lib -liodbc -liodbcinst $LIBDL"
-    { $as_echo "$as_me:$LINENO: checking for SQLTables in -liodbc" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLTables in -liodbc" >&5
 $as_echo_n "checking for SQLTables in -liodbc... " >&6; }
-if test "${ac_cv_lib_iodbc_SQLTables+set}" = set; then
+if test "${ac_cv_lib_iodbc_SQLTables+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-liodbc $iodbc_LDFLAGS $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -27543,47 +17579,22 @@ int
 main ()
 {
 return SQLTables ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_iodbc_SQLTables=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_iodbc_SQLTables=no
+  ac_cv_lib_iodbc_SQLTables=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_iodbc_SQLTables" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iodbc_SQLTables" >&5
 $as_echo "$ac_cv_lib_iodbc_SQLTables" >&6; }
-if test "x$ac_cv_lib_iodbc_SQLTables" = x""yes; then
+if test "x$ac_cv_lib_iodbc_SQLTables" = x""yes; then :
 
 		  virt_do_iodbc="yes"
 
@@ -27599,31 +17610,21 @@ else
   #
   #  we have a copy of these files internally
   #
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_SQL_H 1
-_ACEOF
+  $as_echo "#define HAVE_SQL_H 1" >>confdefs.h
 
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_SQLEXT_H 1
-_ACEOF
+  $as_echo "#define HAVE_SQLEXT_H 1" >>confdefs.h
 
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_SQLUCODE_H 1
-_ACEOF
+  $as_echo "#define HAVE_SQLUCODE_H 1" >>confdefs.h
 
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_ODBCINST_H 1
-_ACEOF
+  $as_echo "#define HAVE_ODBCINST_H 1" >>confdefs.h
 
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_IODBCEXT_H 1
-_ACEOF
+  $as_echo "#define HAVE_IODBCEXT_H 1" >>confdefs.h
 
 fi
 
 if test "x$virt_do_iodbc" = "xyes"; then
   BUILD_OPTS="$BUILD_OPTS odbc"
-  { $as_echo "$as_me:$LINENO: result: Will build the iODBC binaries" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: Will build the iODBC binaries" >&5
 $as_echo "Will build the iODBC binaries" >&6; }
 fi
 
@@ -27643,19 +17644,17 @@ fi
 ##									##
 ##########################################################################
 
-{ $as_echo "$as_me:$LINENO: checking for Java options" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Java options" >&5
 $as_echo_n "checking for Java options... " >&6; }
 
 ac_jdk2_path="none"
 
 # Check whether --with-jdk2 was given.
-if test "${with_jdk2+set}" = set; then
+if test "${with_jdk2+set}" = set; then :
   withval=$with_jdk2;
     case "${withval}" in
       yes)
-          { { $as_echo "$as_me:$LINENO: error: \"You need to specify a directory\"" >&5
-$as_echo "$as_me: error: \"You need to specify a directory\"" >&2;}
-   { (exit 1); exit 1; }; }
+          as_fn_error "\"You need to specify a directory\"" "$LINENO" 5
 	  ;;
 
       no)
@@ -27666,9 +17665,7 @@ $as_echo "$as_me: error: \"You need to specify a directory\"" >&2;}
 	  if test -d "${withval}" ; then
 	      ac_jdk2_path="${withval}"
 	  else
-	      { { $as_echo "$as_me:$LINENO: error: \"Directory specified with --with-jdk2 does not exist\"" >&5
-$as_echo "$as_me: error: \"Directory specified with --with-jdk2 does not exist\"" >&2;}
-   { (exit 1); exit 1; }; }
+	      as_fn_error "\"Directory specified with --with-jdk2 does not exist\"" "$LINENO" 5
 	  fi
 	  ;;
     esac
@@ -27679,13 +17676,11 @@ fi
 ac_jdk3_path="none"
 
 # Check whether --with-jdk3 was given.
-if test "${with_jdk3+set}" = set; then
+if test "${with_jdk3+set}" = set; then :
   withval=$with_jdk3;
     case "${withval}" in
       yes)
-          { { $as_echo "$as_me:$LINENO: error: \"You need to specify a directory\"" >&5
-$as_echo "$as_me: error: \"You need to specify a directory\"" >&2;}
-   { (exit 1); exit 1; }; }
+          as_fn_error "\"You need to specify a directory\"" "$LINENO" 5
 	  ;;
 
       no)
@@ -27696,29 +17691,25 @@ $as_echo "$as_me: error: \"You need to specify a directory\"" >&2;}
 	  if test -d "${withval}" ; then
 	      ac_jdk3_path="${withval}"
 	  else
-	      { { $as_echo "$as_me:$LINENO: error: \"Directory specified with --with-jdk3 does not exist\"" >&5
-$as_echo "$as_me: error: \"Directory specified with --with-jdk3 does not exist\"" >&2;}
-   { (exit 1); exit 1; }; }
+	      as_fn_error "\"Directory specified with --with-jdk3 does not exist\"" "$LINENO" 5
 	  fi
 	  ;;
     esac
 
 fi
 
-{ $as_echo "$as_me:$LINENO: result: done" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
 $as_echo "done" >&6; }
 
 
 ac_jdk4_path="none"
 
 # Check whether --with-jdk4 was given.
-if test "${with_jdk4+set}" = set; then
+if test "${with_jdk4+set}" = set; then :
   withval=$with_jdk4;
     case "${withval}" in
       yes)
-          { { $as_echo "$as_me:$LINENO: error: \"You need to specify a directory\"" >&5
-$as_echo "$as_me: error: \"You need to specify a directory\"" >&2;}
-   { (exit 1); exit 1; }; }
+          as_fn_error "\"You need to specify a directory\"" "$LINENO" 5
 	  ;;
 
       no)
@@ -27729,16 +17720,14 @@ $as_echo "$as_me: error: \"You need to specify a directory\"" >&2;}
 	  if test -d "${withval}" ; then
 	      ac_jdk4_path="${withval}"
 	  else
-	      { { $as_echo "$as_me:$LINENO: error: \"Directory specified with --with-jdk4 does not exist\"" >&5
-$as_echo "$as_me: error: \"Directory specified with --with-jdk4 does not exist\"" >&2;}
-   { (exit 1); exit 1; }; }
+	      as_fn_error "\"Directory specified with --with-jdk4 does not exist\"" "$LINENO" 5
 	  fi
 	  ;;
     esac
 
 fi
 
-{ $as_echo "$as_me:$LINENO: result: done" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
 $as_echo "done" >&6; }
 
 
@@ -27753,7 +17742,7 @@ ac_jw_max_minor="3"
 ac_cv_prog_java_works=no
 #echo macro called with ac_jw_jdk="$ac_jw_jdk" ac_jw_min_minor="$ac_jw_min_minor" ac_jw_max_minor="$ac_jw_max_minor"
 if test "x$ac_jw_jdk" != "xnone" ; then
-  { $as_echo "$as_me:$LINENO: checking for working Java 1.$ac_jw_min_minor.x-1.$ac_jw_max_minor.x in $ac_jw_jdk" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working Java 1.$ac_jw_min_minor.x-1.$ac_jw_max_minor.x in $ac_jw_jdk" >&5
 $as_echo_n "checking for working Java 1.$ac_jw_min_minor.x-1.$ac_jw_max_minor.x in $ac_jw_jdk... " >&6; }
   if test -x "$ac_jw_jdk/Commands/java"; then
     ac_jw_jdk="$ac_jw_jdk/Commands"
@@ -27766,50 +17755,44 @@ $as_echo_n "checking for working Java 1.$ac_jw_min_minor.x-1.$ac_jw_max_minor.x
   ac_java_ver_major=`echo $ac_java_version | cut -f 1 -d .`
   ac_java_ver_minor=`echo $ac_java_version | cut -f 2 -d .`
   if test "x$ac_java_ver_major" != "x1" -o "0$ac_java_ver_minor" -lt "0$ac_jw_min_minor" -o "0$ac_java_ver_minor" -gt "0$ac_jw_max_minor" ; then
-      { { $as_echo "$as_me:$LINENO: error: wrong version ($ac_java_ver_major.$ac_java_ver_minor)" >&5
-$as_echo "$as_me: error: wrong version ($ac_java_ver_major.$ac_java_ver_minor)" >&2;}
-   { (exit 1); exit 1; }; }
+      as_fn_error "wrong version ($ac_java_ver_major.$ac_java_ver_minor)" "$LINENO" 5
   fi
   JAVA_TEST=Test.java
   CLASS_TEST=Test.class
   TEST=Test
     cat << \EOF > $JAVA_TEST
-/* [#]line 27777 "configure" */
+/* [#]line 17764 "configure" */
 public class Test {
 public static void main (String args[]) {
   System.exit (0);
 } }
 EOF
     if { ac_try='$JAVAC $JAVACFLAGS $JAVA_TEST'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } && test -s $CLASS_TEST; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } && test -s $CLASS_TEST; then
     :
   else
     echo "configure: failed program was:" >&5
     cat $JAVA_TEST >&5
-    { { $as_echo "$as_me:$LINENO: error: The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" >&5
-$as_echo "$as_me: error: The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" "$LINENO" 5
   fi
   if { ac_try='$JAVA $JAVAFLAGS $TEST'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } >/dev/null 2>&1; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null 2>&1; then
     ac_cv_prog_java_works=yes
   else
     echo "configure: failed program was:" >&5
     cat $JAVA_TEST >&5
-    { { $as_echo "$as_me:$LINENO: error: The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" >&5
-$as_echo "$as_me: error: The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" "$LINENO" 5
   fi
   rm -fr $JAVA_TEST $CLASS_TEST Test.uue
-  { $as_echo "$as_me:$LINENO: result: found" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
 $as_echo "found" >&6; }
 fi
 
@@ -27832,7 +17815,7 @@ ac_jw_max_minor="5"
 ac_cv_prog_java_works=no
 #echo macro called with ac_jw_jdk="$ac_jw_jdk" ac_jw_min_minor="$ac_jw_min_minor" ac_jw_max_minor="$ac_jw_max_minor"
 if test "x$ac_jw_jdk" != "xnone" ; then
-  { $as_echo "$as_me:$LINENO: checking for working Java 1.$ac_jw_min_minor.x-1.$ac_jw_max_minor.x in $ac_jw_jdk" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working Java 1.$ac_jw_min_minor.x-1.$ac_jw_max_minor.x in $ac_jw_jdk" >&5
 $as_echo_n "checking for working Java 1.$ac_jw_min_minor.x-1.$ac_jw_max_minor.x in $ac_jw_jdk... " >&6; }
   if test -x "$ac_jw_jdk/Commands/java"; then
     ac_jw_jdk="$ac_jw_jdk/Commands"
@@ -27845,50 +17828,44 @@ $as_echo_n "checking for working Java 1.$ac_jw_min_minor.x-1.$ac_jw_max_minor.x
   ac_java_ver_major=`echo $ac_java_version | cut -f 1 -d .`
   ac_java_ver_minor=`echo $ac_java_version | cut -f 2 -d .`
   if test "x$ac_java_ver_major" != "x1" -o "0$ac_java_ver_minor" -lt "0$ac_jw_min_minor" -o "0$ac_java_ver_minor" -gt "0$ac_jw_max_minor" ; then
-      { { $as_echo "$as_me:$LINENO: error: wrong version ($ac_java_ver_major.$ac_java_ver_minor)" >&5
-$as_echo "$as_me: error: wrong version ($ac_java_ver_major.$ac_java_ver_minor)" >&2;}
-   { (exit 1); exit 1; }; }
+      as_fn_error "wrong version ($ac_java_ver_major.$ac_java_ver_minor)" "$LINENO" 5
   fi
   JAVA_TEST=Test.java
   CLASS_TEST=Test.class
   TEST=Test
     cat << \EOF > $JAVA_TEST
-/* [#]line 27856 "configure" */
+/* [#]line 17837 "configure" */
 public class Test {
 public static void main (String args[]) {
   System.exit (0);
 } }
 EOF
     if { ac_try='$JAVAC $JAVACFLAGS $JAVA_TEST'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } && test -s $CLASS_TEST; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } && test -s $CLASS_TEST; then
     :
   else
     echo "configure: failed program was:" >&5
     cat $JAVA_TEST >&5
-    { { $as_echo "$as_me:$LINENO: error: The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" >&5
-$as_echo "$as_me: error: The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" "$LINENO" 5
   fi
   if { ac_try='$JAVA $JAVAFLAGS $TEST'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } >/dev/null 2>&1; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null 2>&1; then
     ac_cv_prog_java_works=yes
   else
     echo "configure: failed program was:" >&5
     cat $JAVA_TEST >&5
-    { { $as_echo "$as_me:$LINENO: error: The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" >&5
-$as_echo "$as_me: error: The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" "$LINENO" 5
   fi
   rm -fr $JAVA_TEST $CLASS_TEST Test.uue
-  { $as_echo "$as_me:$LINENO: result: found" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
 $as_echo "found" >&6; }
 fi
 
@@ -27911,7 +17888,7 @@ ac_jw_max_minor="6"
 ac_cv_prog_java_works=no
 #echo macro called with ac_jw_jdk="$ac_jw_jdk" ac_jw_min_minor="$ac_jw_min_minor" ac_jw_max_minor="$ac_jw_max_minor"
 if test "x$ac_jw_jdk" != "xnone" ; then
-  { $as_echo "$as_me:$LINENO: checking for working Java 1.$ac_jw_min_minor.x-1.$ac_jw_max_minor.x in $ac_jw_jdk" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working Java 1.$ac_jw_min_minor.x-1.$ac_jw_max_minor.x in $ac_jw_jdk" >&5
 $as_echo_n "checking for working Java 1.$ac_jw_min_minor.x-1.$ac_jw_max_minor.x in $ac_jw_jdk... " >&6; }
   if test -x "$ac_jw_jdk/Commands/java"; then
     ac_jw_jdk="$ac_jw_jdk/Commands"
@@ -27924,50 +17901,44 @@ $as_echo_n "checking for working Java 1.$ac_jw_min_minor.x-1.$ac_jw_max_minor.x
   ac_java_ver_major=`echo $ac_java_version | cut -f 1 -d .`
   ac_java_ver_minor=`echo $ac_java_version | cut -f 2 -d .`
   if test "x$ac_java_ver_major" != "x1" -o "0$ac_java_ver_minor" -lt "0$ac_jw_min_minor" -o "0$ac_java_ver_minor" -gt "0$ac_jw_max_minor" ; then
-      { { $as_echo "$as_me:$LINENO: error: wrong version ($ac_java_ver_major.$ac_java_ver_minor)" >&5
-$as_echo "$as_me: error: wrong version ($ac_java_ver_major.$ac_java_ver_minor)" >&2;}
-   { (exit 1); exit 1; }; }
+      as_fn_error "wrong version ($ac_java_ver_major.$ac_java_ver_minor)" "$LINENO" 5
   fi
   JAVA_TEST=Test.java
   CLASS_TEST=Test.class
   TEST=Test
     cat << \EOF > $JAVA_TEST
-/* [#]line 27935 "configure" */
+/* [#]line 17910 "configure" */
 public class Test {
 public static void main (String args[]) {
   System.exit (0);
 } }
 EOF
     if { ac_try='$JAVAC $JAVACFLAGS $JAVA_TEST'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } && test -s $CLASS_TEST; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } && test -s $CLASS_TEST; then
     :
   else
     echo "configure: failed program was:" >&5
     cat $JAVA_TEST >&5
-    { { $as_echo "$as_me:$LINENO: error: The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" >&5
-$as_echo "$as_me: error: The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" "$LINENO" 5
   fi
   if { ac_try='$JAVA $JAVAFLAGS $TEST'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } >/dev/null 2>&1; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null 2>&1; then
     ac_cv_prog_java_works=yes
   else
     echo "configure: failed program was:" >&5
     cat $JAVA_TEST >&5
-    { { $as_echo "$as_me:$LINENO: error: The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" >&5
-$as_echo "$as_me: error: The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" "$LINENO" 5
   fi
   rm -fr $JAVA_TEST $CLASS_TEST Test.uue
-  { $as_echo "$as_me:$LINENO: result: found" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
 $as_echo "found" >&6; }
 fi
 
@@ -27998,153 +17969,14 @@ if test "x$ac_integ_jdk" != "x" ; then
     ac_save_CPPFLAGS="$CPPFLAGS"
     #supported jvm hosting platforms : add more here
     case $host in
-	x64_64-*-linux*)
+	x86_64-*-linux*)
                 CPPFLAGS="$CPPFLAGS -I$ac_integ_jdk/include -I$ac_integ_jdk/include/linux"
-
-for ac_header in jni.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+        	for ac_header in jni.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "jni.h" "ac_cv_header_jni_h" "$ac_includes_default"
+if test "x$ac_cv_header_jni_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_JNI_H 1
 _ACEOF
   java_CPPFLAGS="-I$ac_integ_jdk/include -I$ac_integ_jdk/include/linux"
 else
@@ -28153,18 +17985,14 @@ fi
 
 done
 
-		{ $as_echo "$as_me:$LINENO: checking for JNI_GetDefaultJavaVMInitArgs in -ljvm" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for JNI_GetDefaultJavaVMInitArgs in -ljvm" >&5
 $as_echo_n "checking for JNI_GetDefaultJavaVMInitArgs in -ljvm... " >&6; }
-if test "${ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs+set}" = set; then
+if test "${ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ljvm  "-L$ac_integ_jdk/jre/lib/amd64/server" $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -28182,44 +18010,19 @@ return JNI_GetDefaultJavaVMInitArgs ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=no
+  ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&5
 $as_echo "$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&6; }
-if test "x$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" = x""yes; then
-   java_LDFLAGS="-L$ac_integ_jdk/jre/lib/amd64/server -ljvm"
+if test "x$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" = x""yes; then :
+   java_LDFLAGS="-L$ac_integ_jdk/jre/lib/amd64/server -R$ac_integ_jdk/jre/lib/amd64/server -ljvm"
 else
    ac_integ_jdk=""
 fi
@@ -28227,151 +18030,12 @@ fi
 		;;
 	i?86-*-linux*)
                 CPPFLAGS="$CPPFLAGS -I$ac_integ_jdk/include -I$ac_integ_jdk/include/linux"
-
-for ac_header in jni.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+        	for ac_header in jni.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "jni.h" "ac_cv_header_jni_h" "$ac_includes_default"
+if test "x$ac_cv_header_jni_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_JNI_H 1
 _ACEOF
   java_CPPFLAGS="-I$ac_integ_jdk/include -I$ac_integ_jdk/include/linux"
 else
@@ -28380,18 +18044,14 @@ fi
 
 done
 
-		{ $as_echo "$as_me:$LINENO: checking for JNI_GetDefaultJavaVMInitArgs in -ljvm" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for JNI_GetDefaultJavaVMInitArgs in -ljvm" >&5
 $as_echo_n "checking for JNI_GetDefaultJavaVMInitArgs in -ljvm... " >&6; }
-if test "${ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs+set}" = set; then
+if test "${ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ljvm  "-L$ac_integ_jdk/jre/lib/i386/server" $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -28409,196 +18069,32 @@ return JNI_GetDefaultJavaVMInitArgs ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=no
+  ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&5
 $as_echo "$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&6; }
-if test "x$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" = x""yes; then
+if test "x$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" = x""yes; then :
    java_LDFLAGS="-L$ac_integ_jdk/jre/lib/i386/server -ljvm"
 else
-   ac_integ_jdk=""
-fi
-
-		;;
-	sparc-*-solaris*)
-                CPPFLAGS="$CPPFLAGS -I$ac_integ_jdk/include -I$ac_integ_jdk/include/solaris"
-
-for ac_header in jni.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
+   ac_integ_jdk=""
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+		;;
+	sparc-*-solaris*)
+                CPPFLAGS="$CPPFLAGS -I$ac_integ_jdk/include -I$ac_integ_jdk/include/solaris"
+        	for ac_header in jni.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "jni.h" "ac_cv_header_jni_h" "$ac_includes_default"
+if test "x$ac_cv_header_jni_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_JNI_H 1
 _ACEOF
   java_CPPFLAGS="-I$ac_integ_jdk/include -I$ac_integ_jdk/include/solaris"
 else
@@ -28607,18 +18103,14 @@ fi
 
 done
 
-		{ $as_echo "$as_me:$LINENO: checking for JNI_GetDefaultJavaVMInitArgs in -ljvm" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for JNI_GetDefaultJavaVMInitArgs in -ljvm" >&5
 $as_echo_n "checking for JNI_GetDefaultJavaVMInitArgs in -ljvm... " >&6; }
-if test "${ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs+set}" = set; then
+if test "${ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ljvm  "-L$ac_integ_jdk/jre/lib/sparc/server" $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -28636,43 +18128,18 @@ return JNI_GetDefaultJavaVMInitArgs ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=no
+  ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&5
 $as_echo "$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&6; }
-if test "x$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" = x""yes; then
+if test "x$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" = x""yes; then :
    java_LDFLAGS="-L$ac_integ_jdk/lib/jre/sparc/server -ljvm"
 else
    ac_integ_jdk=""
@@ -28681,151 +18148,12 @@ fi
 		;;
 	hppa-*-hpux*)
                 CPPFLAGS="$CPPFLAGS -I$ac_integ_jdk/include -I$ac_integ_jdk/include/hp-ux"
-
-for ac_header in jni.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+        	for ac_header in jni.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "jni.h" "ac_cv_header_jni_h" "$ac_includes_default"
+if test "x$ac_cv_header_jni_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_JNI_H 1
 _ACEOF
   java_CPPFLAGS="-I$ac_integ_jdk/include -I$ac_integ_jdk/include/hp-ux"
 else
@@ -28834,18 +18162,14 @@ fi
 
 done
 
-		{ $as_echo "$as_me:$LINENO: checking for JNI_GetDefaultJavaVMInitArgs in -ljvm" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for JNI_GetDefaultJavaVMInitArgs in -ljvm" >&5
 $as_echo_n "checking for JNI_GetDefaultJavaVMInitArgs in -ljvm... " >&6; }
-if test "${ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs+set}" = set; then
+if test "${ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ljvm  "-L$ac_integ_jdk/jre/PA_RISC/sparc/server" $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -28863,43 +18187,18 @@ return JNI_GetDefaultJavaVMInitArgs ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=no
+  ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&5
 $as_echo "$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&6; }
-if test "x$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" = x""yes; then
+if test "x$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" = x""yes; then :
    java_LDFLAGS="-L$ac_integ_jdk/jre/lib/PA_RISC/server -ljvm"
 else
    ac_integ_jdk=""
@@ -28908,151 +18207,12 @@ fi
 		;;
 	hppa2.0-*-hpux*)
                 CPPFLAGS="$CPPFLAGS -I$ac_integ_jdk/include -I$ac_integ_jdk/include/hp-ux"
-
-for ac_header in jni.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+        	for ac_header in jni.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "jni.h" "ac_cv_header_jni_h" "$ac_includes_default"
+if test "x$ac_cv_header_jni_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_JNI_H 1
 _ACEOF
   java_CPPFLAGS="-I$ac_integ_jdk/include -I$ac_integ_jdk/include/hp-ux"
 else
@@ -29061,18 +18221,14 @@ fi
 
 done
 
-		{ $as_echo "$as_me:$LINENO: checking for JNI_GetDefaultJavaVMInitArgs in -ljvm" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for JNI_GetDefaultJavaVMInitArgs in -ljvm" >&5
 $as_echo_n "checking for JNI_GetDefaultJavaVMInitArgs in -ljvm... " >&6; }
-if test "${ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs+set}" = set; then
+if test "${ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ljvm  "-L$ac_integ_jdk/jre/PA_RISC2.0/sparc/server" $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -29090,196 +18246,32 @@ return JNI_GetDefaultJavaVMInitArgs ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&5
-$as_echo "$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&6; }
-if test "x$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" = x""yes; then
-   java_LDFLAGS="-L$ac_integ_jdk/jre/lib/PA_RISC2.0/server -ljvm"
-else
-   ac_integ_jdk=""
-fi
-
-		;;
-	*-darwin*)
-                CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/JavaVM.framework/Headers"
-
-for ac_header in jni.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=yes
+else
+  ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs=no
 fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------------- ##
-## Report this to vos.admin at openlinksw.com ##
-## --------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&5
+$as_echo "$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" >&6; }
+if test "x$ac_cv_lib_jvm_JNI_GetDefaultJavaVMInitArgs" = x""yes; then :
+   java_LDFLAGS="-L$ac_integ_jdk/jre/lib/PA_RISC2.0/server -ljvm"
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+   ac_integ_jdk=""
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+		;;
+	*-darwin*)
+                CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/JavaVM.framework/Headers"
+        	for ac_header in jni.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "jni.h" "ac_cv_header_jni_h" "$ac_includes_default"
+if test "x$ac_cv_header_jni_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_JNI_H 1
 _ACEOF
 
 			 java_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers"
@@ -29300,9 +18292,9 @@ done
 fi
 
 if test "x$ac_integ_jdk" != "x" ; then
-  { $as_echo "$as_me:$LINENO: result: Java JNI C flags=\"$java_CPPFLAGS\"" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: Java JNI C flags=\"$java_CPPFLAGS\"" >&5
 $as_echo "Java JNI C flags=\"$java_CPPFLAGS\"" >&6; }
-  { $as_echo "$as_me:$LINENO: result: Java JNI LD flags=\"$java_LDFLAGS\"" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: Java JNI LD flags=\"$java_LDFLAGS\"" >&5
 $as_echo "Java JNI LD flags=\"$java_LDFLAGS\"" >&6; }
 fi
 
@@ -29326,7 +18318,7 @@ fi
 PORT=1111
 
 # Check whether --with-port was given.
-if test "${with_port+set}" = set; then
+if test "${with_port+set}" = set; then :
   withval=$with_port;  PORT=${withval}
 fi
 
@@ -29339,20 +18331,18 @@ fi
 #                                                                        #
 ##########################################################################
 # Check whether --enable- was given.
-if test "${enable_+set}" = set; then
+if test "${enable_+set}" = set; then :
   enableval=$enable_;
 fi
 
 
 # Check whether --enable-bpel-vad was given.
-if test "${enable_bpel_vad+set}" = set; then
+if test "${enable_bpel_vad+set}" = set; then :
   enableval=$enable_bpel_vad;
      case "${enableval}" in
        yes)	with_bpel_vad="yes";;
        no)	with_bpel_vad="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-bpel-vad" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-bpel-vad" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-bpel-vad" "$LINENO" 5 ;;
      esac
 
 else
@@ -29362,14 +18352,12 @@ fi
 
 
 # Check whether --enable-conductor-vad was given.
-if test "${enable_conductor_vad+set}" = set; then
+if test "${enable_conductor_vad+set}" = set; then :
   enableval=$enable_conductor_vad;
      case "${enableval}" in
        yes)	with_conductor_vad="yes";;
        no)	with_conductor_vad="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-conductor-vad" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-conductor-vad" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-conductor-vad" "$LINENO" 5 ;;
      esac
 
 else
@@ -29379,14 +18367,12 @@ fi
 
 
 # Check whether --enable-demo-vad was given.
-if test "${enable_demo_vad+set}" = set; then
+if test "${enable_demo_vad+set}" = set; then :
   enableval=$enable_demo_vad;
      case "${enableval}" in
        yes)	with_demo_vad="yes";;
        no)	with_demo_vad="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-demo-vad" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-demo-vad" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-demo-vad" "$LINENO" 5 ;;
      esac
 
 else
@@ -29396,14 +18382,12 @@ fi
 
 
 # Check whether --enable-fct-vad was given.
-if test "${enable_fct_vad+set}" = set; then
+if test "${enable_fct_vad+set}" = set; then :
   enableval=$enable_fct_vad;
      case "${enableval}" in
        yes)	with_fct_vad="yes";;
        no)	with_fct_vad="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-fct-vad" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-fct-vad" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-fct-vad" "$LINENO" 5 ;;
      esac
 
 else
@@ -29413,14 +18397,12 @@ fi
 
 
 # Check whether --enable-isparql-vad was given.
-if test "${enable_isparql_vad+set}" = set; then
+if test "${enable_isparql_vad+set}" = set; then :
   enableval=$enable_isparql_vad;
      case "${enableval}" in
        yes)	with_isparql_vad="yes";;
        no)	with_isparql_vad="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-isparql-vad" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-isparql-vad" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-isparql-vad" "$LINENO" 5 ;;
      esac
 
 else
@@ -29430,14 +18412,12 @@ fi
 
 
 # Check whether --enable-ods-vad was given.
-if test "${enable_ods_vad+set}" = set; then
+if test "${enable_ods_vad+set}" = set; then :
   enableval=$enable_ods_vad;
      case "${enableval}" in
        yes)	with_ods_vad="yes";;
        no)	with_ods_vad="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-ods-vad" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-ods-vad" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-ods-vad" "$LINENO" 5 ;;
      esac
 
 else
@@ -29447,14 +18427,12 @@ fi
 
 
 # Check whether --enable-rdfmappers-vad was given.
-if test "${enable_rdfmappers_vad+set}" = set; then
+if test "${enable_rdfmappers_vad+set}" = set; then :
   enableval=$enable_rdfmappers_vad;
      case "${enableval}" in
        yes)	with_rdfmappers_vad="yes";;
        no)	with_rdfmappers_vad="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-rdfmappers-vad" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-rdfmappers-vad" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-rdfmappers-vad" "$LINENO" 5 ;;
      esac
 
 else
@@ -29464,14 +18442,12 @@ fi
 
 
 # Check whether --enable-sparqldemo-vad was given.
-if test "${enable_sparqldemo_vad+set}" = set; then
+if test "${enable_sparqldemo_vad+set}" = set; then :
   enableval=$enable_sparqldemo_vad;
      case "${enableval}" in
        yes)	with_sparqldemo_vad="yes";;
        no)	with_sparqldemo_vad="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-sparqldemo-vad" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-sparqldemo-vad" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-sparqldemo-vad" "$LINENO" 5 ;;
      esac
 
 else
@@ -29481,14 +18457,12 @@ fi
 
 
 # Check whether --enable-syncml-vad was given.
-if test "${enable_syncml_vad+set}" = set; then
+if test "${enable_syncml_vad+set}" = set; then :
   enableval=$enable_syncml_vad;
      case "${enableval}" in
        yes)	with_syncml_vad="yes";;
        no)	with_syncml_vad="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-syncml-vad" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-syncml-vad" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-syncml-vad" "$LINENO" 5 ;;
      esac
 
 else
@@ -29498,14 +18472,12 @@ fi
 
 
 # Check whether --enable-tutorial-vad was given.
-if test "${enable_tutorial_vad+set}" = set; then
+if test "${enable_tutorial_vad+set}" = set; then :
   enableval=$enable_tutorial_vad;
      case "${enableval}" in
        yes)	with_tutorial_vad="yes";;
        no)	with_tutorial_vad="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-tutorial-vad" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-tutorial-vad" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-tutorial-vad" "$LINENO" 5 ;;
      esac
 
 else
@@ -29516,14 +18488,12 @@ fi
 
 
 # Check whether --enable-all-vads was given.
-if test "${enable_all_vads+set}" = set; then
+if test "${enable_all_vads+set}" = set; then :
   enableval=$enable_all_vads;
      case "${enableval}" in
        yes)	with_all_vad="yes";;
        no)	with_all_vad="no";;
-       *)	{ { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-all-vads" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-all-vads" >&2;}
-   { (exit 1); exit 1; }; } ;;
+       *)	as_fn_error "bad value ${enableval} for --enable-all-vads" "$LINENO" 5 ;;
      esac
 
 else
@@ -29635,7 +18605,7 @@ fi
 ##									##
 ##########################################################################
 
-{ $as_echo "$as_me:$LINENO: checking for OS specific configuration" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OS specific configuration" >&5
 $as_echo_n "checking for OS specific configuration... " >&6; }
 OPSYS="Unknown"
 
@@ -29741,7 +18711,7 @@ alpha-dec-osf*)
 	;;
 
 esac
-{ $as_echo "$as_me:$LINENO: result: ($OPSYS)" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ($OPSYS)" >&5
 $as_echo "($OPSYS)" >&6; }
 
 
@@ -29785,59 +18755,45 @@ case $host in
 	;;
 
 esac
-{ $as_echo "$as_me:$LINENO: checking for OS specific defines" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OS specific defines" >&5
 $as_echo_n "checking for OS specific defines... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: ($CCPLATFORMDEFS)" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ($CCPLATFORMDEFS)" >&5
 $as_echo "($CCPLATFORMDEFS)" >&6; }
 
 
 LIBS="$VLIBS $LIBS"
-{ $as_echo "$as_me:$LINENO: checking for system libs" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for system libs" >&5
 $as_echo_n "checking for system libs... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: $VLIBS" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $VLIBS" >&5
 $as_echo "$VLIBS" >&6; }
 
 
 
-{ $as_echo "$as_me:$LINENO: result: Configured: $BUILD_OPTS" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Configured: $BUILD_OPTS" >&5
 $as_echo "Configured: $BUILD_OPTS" >&6; }
 
 #AC_CONFIG_SUBDIRS(libsrc/zlib)
 
 
-cat >>confdefs.h <<\_ACEOF
-#define VIRTTP 1
-_ACEOF
+$as_echo "#define VIRTTP 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define INC_BACKUP 1
-_ACEOF
+$as_echo "#define INC_BACKUP 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define INPROCESS_CLIENT 1
-_ACEOF
+$as_echo "#define INPROCESS_CLIENT 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define BIF_TIDY 1
-_ACEOF
+$as_echo "#define BIF_TIDY 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define REPLICATION_SUPPORT 1
-_ACEOF
+$as_echo "#define REPLICATION_SUPPORT 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define REPLICATION_SUPPORT2 1
-_ACEOF
+$as_echo "#define REPLICATION_SUPPORT2 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define VIRTUAL_DIR 1
-_ACEOF
+$as_echo "#define VIRTUAL_DIR 1" >>confdefs.h
 
 
 
@@ -29894,13 +18850,13 @@ _ACEOF
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
       BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) $as_unset $ac_var ;;
+      *) { eval $ac_var=; unset $ac_var;} ;;
       esac ;;
     esac
   done
@@ -29908,8 +18864,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
   (set) 2>&1 |
     case $as_nl`(ac_space=' '; set) 2>&1` in #(
     *${as_nl}ac_space=\ *)
-      # `set' does not quote correctly, so add quotes (double-quote
-      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      # `set' does not quote correctly, so add quotes: double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
       sed -n \
 	"s/'/'\\\\''/g;
 	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -29932,11 +18888,11 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
     test "x$cache_file" != "x/dev/null" &&
-      { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
     cat confcache >$cache_file
   else
-    { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
@@ -29956,8 +18912,8 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
   # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
   #    will be set to the directory where LIBOBJS objects are built.
-  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
 done
 LIBOBJS=$ac_libobjs
 
@@ -29973,245 +18929,147 @@ else
 fi
 
 if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
 if test -z "${WITH_HTMLDOC_TRUE}" && test -z "${WITH_HTMLDOC_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_HTMLDOC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_HTMLDOC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_HTMLDOC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_KERBEROS_TRUE}" && test -z "${WITH_KERBEROS_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_KERBEROS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_KERBEROS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_KERBEROS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_LDAP_TRUE}" && test -z "${WITH_LDAP_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_LDAP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_LDAP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_LDAP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_IMSG_TRUE}" && test -z "${WITH_IMSG_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_IMSG\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_IMSG\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_IMSG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_PLDEBUG_TRUE}" && test -z "${WITH_PLDEBUG_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_PLDEBUG\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_PLDEBUG\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_PLDEBUG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${HAVE_PHP5_TRUE}" && test -z "${HAVE_PHP5_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_PHP5\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"HAVE_PHP5\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"HAVE_PHP5\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${HAVE_MONO_TRUE}" && test -z "${HAVE_MONO_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_MONO\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"HAVE_MONO\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"HAVE_MONO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_HSL_TRUE}" && test -z "${WITH_HSL_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_HSL\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_HSL\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_HSL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_IM_TRUE}" && test -z "${WITH_IM_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_IM\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_IM\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_IM\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_WBXML2_TRUE}" && test -z "${WITH_WBXML2_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_WBXML2\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_WBXML2\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_WBXML2\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_PERL_TRUE}" && test -z "${WITH_PERL_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_PERL\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_PERL\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_PERL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_PYTHON_TRUE}" && test -z "${WITH_PYTHON_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_PYTHON\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_PYTHON\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_PYTHON\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_RUBY_TRUE}" && test -z "${WITH_RUBY_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_RUBY\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_RUBY\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_RUBY\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_ZLIB_TRUE}" && test -z "${WITH_ZLIB_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_ZLIB\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_ZLIB\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_ZLIB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_PTHREADS_TRUE}" && test -z "${WITH_PTHREADS_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_PTHREADS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_PTHREADS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_PTHREADS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_IODBC_TRUE}" && test -z "${WITH_IODBC_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_IODBC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_IODBC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_IODBC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_JDK2_TRUE}" && test -z "${WITH_JDK2_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_JDK2\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_JDK2\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_JDK2\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_JDK3_TRUE}" && test -z "${WITH_JDK3_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_JDK3\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_JDK3\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_JDK3\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_JDK4_TRUE}" && test -z "${WITH_JDK4_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_JDK4\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_JDK4\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_JDK4\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${INTEG_JDK_TRUE}" && test -z "${INTEG_JDK_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"INTEG_JDK\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"INTEG_JDK\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"INTEG_JDK\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_BPEL_VAD_TRUE}" && test -z "${WITH_BPEL_VAD_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_BPEL_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_BPEL_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_BPEL_VAD\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_CONDUCTOR_VAD_TRUE}" && test -z "${WITH_CONDUCTOR_VAD_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_CONDUCTOR_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_CONDUCTOR_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_CONDUCTOR_VAD\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_DEMO_VAD_TRUE}" && test -z "${WITH_DEMO_VAD_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_DEMO_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_DEMO_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_DEMO_VAD\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_FCT_VAD_TRUE}" && test -z "${WITH_FCT_VAD_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_FCT_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_FCT_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_FCT_VAD\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_ISPARQL_VAD_TRUE}" && test -z "${WITH_ISPARQL_VAD_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_ISPARQL_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_ISPARQL_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_ISPARQL_VAD\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_ODS_VAD_TRUE}" && test -z "${WITH_ODS_VAD_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_ODS_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_ODS_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_ODS_VAD\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_RDFMAPPERS_VAD_TRUE}" && test -z "${WITH_RDFMAPPERS_VAD_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_RDFMAPPERS_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_RDFMAPPERS_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_RDFMAPPERS_VAD\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_SPARQLDEMO_VAD_TRUE}" && test -z "${WITH_SPARQLDEMO_VAD_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_SPARQLDEMO_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_SPARQLDEMO_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_SPARQLDEMO_VAD\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_SYNCML_VAD_TRUE}" && test -z "${WITH_SYNCML_VAD_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_SYNCML_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_SYNCML_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_SYNCML_VAD\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WITH_TUTORIAL_VAD_TRUE}" && test -z "${WITH_TUTORIAL_VAD_FALSE}"; then
-  { { $as_echo "$as_me:$LINENO: error: conditional \"WITH_TUTORIAL_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-$as_echo "$as_me: error: conditional \"WITH_TUTORIAL_VAD\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "conditional \"WITH_TUTORIAL_VAD\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
 : ${CONFIG_STATUS=./config.status}
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
 #! $SHELL
 # Generated by $as_me.
 # Run this file to recreate the current configuration.
@@ -30221,17 +19079,18 @@ cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 debug=false
 ac_cs_recheck=false
 ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -30239,23 +19098,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
 as_nl='
 '
 export as_nl
@@ -30263,7 +19114,13 @@ export as_nl
 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
   as_echo='printf %s\n'
   as_echo_n='printf %s'
 else
@@ -30274,7 +19131,7 @@ else
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
 	expr "X$arg" : "X\\(.*\\)$as_nl";
 	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -30297,13 +19154,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
 
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
@@ -30313,15 +19163,15 @@ fi
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -30333,12 +19183,16 @@ if test "x$as_myself" = x; then
 fi
 if test ! -f "$as_myself"; then
   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
@@ -30350,7 +19204,89 @@ export LC_ALL
 LANGUAGE=C
 export LANGUAGE
 
-# Required to use basename.
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$?; test $as_status -eq 0 && as_status=1
+  if test "$3"; then
+    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+  fi
+  $as_echo "$as_me: error: $1" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -30364,8 +19300,12 @@ else
   as_basename=false
 fi
 
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
 
-# Name of the executable.
 as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
@@ -30385,76 +19325,25 @@ $as_echo X/"$0" |
 	  }
 	  s/.*/./; q'`
 
-# CDPATH.
-$as_unset CDPATH
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
 ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
 -n*)
-  case `echo 'x\c'` in
+  case `echo 'xy\c'` in
   *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
   esac;;
 *)
   ECHO_N='-n';;
 esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
 
 rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
@@ -30483,8 +19372,56 @@ fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
 
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
 if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
+  as_mkdir_p='mkdir -p "$as_dir"'
 else
   test -d ./-p && rmdir ./-p
   as_mkdir_p=false
@@ -30503,10 +19440,10 @@ else
       if test -d "$1"; then
 	test -d "$1/.";
       else
-	case $1 in
+	case $1 in #(
 	-*)set "./$1";;
 	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
 	???[sx]*):;;*)false;;esac;fi
     '\'' sh
   '
@@ -30521,13 +19458,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
 exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
 
-# Save the log message, to keep $[0] and so on meaningful, and to
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by Virtuoso Open Source Edition $as_me 6.1.2, which was
-generated by GNU Autoconf 2.63.  Invocation command line was
+This file was extended by Virtuoso Open Source Edition $as_me 6.1.3, which was
+generated by GNU Autoconf 2.65.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -30559,13 +19502,15 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
 
-Usage: $0 [OPTION]... [FILE]...
+Usage: $0 [OPTION]... [TAG]...
 
   -h, --help       print this help, then exit
   -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
   -q, --quiet, --silent
                    do not print progress messages
   -d, --debug      don't remove temporary files
@@ -30584,16 +19529,17 @@ $config_headers
 Configuration commands:
 $config_commands
 
-Report bugs to <bug-autoconf at gnu.org>."
+Report bugs to <vos.admin at openlinksw.com>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-Virtuoso Open Source Edition config.status 6.1.2
-configured by $0, generated by GNU Autoconf 2.63,
-  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+Virtuoso Open Source Edition config.status 6.1.3
+configured by $0, generated by GNU Autoconf 2.65,
+  with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2009 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -30629,6 +19575,8 @@ do
     ac_cs_recheck=: ;;
   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
     $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
   --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
@@ -30636,20 +19584,19 @@ do
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
-    CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
     ac_need_defaults=false;;
   --header | --heade | --head | --hea )
     $ac_shift
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
-    CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'"
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
     ac_need_defaults=false;;
   --he | --h)
     # Conflict between --help and --header
-    { $as_echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; };;
+    as_fn_error "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
   --help | --hel | -h )
     $as_echo "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
@@ -30657,11 +19604,10 @@ Try \`$0 --help' for more information." >&2
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) { $as_echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; } ;;
+  -*) as_fn_error "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
 
-  *) ac_config_targets="$ac_config_targets $1"
+  *) as_fn_append ac_config_targets " $1"
      ac_need_defaults=false ;;
 
   esac
@@ -31081,9 +20027,7 @@ do
     "appsrc/ODS-Wiki/plugin/Makefile") CONFIG_FILES="$CONFIG_FILES appsrc/ODS-Wiki/plugin/Makefile" ;;
     "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
 
-  *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
-   { (exit 1); exit 1; }; };;
+  *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
 done
 
@@ -31110,7 +20054,7 @@ $debug ||
   trap 'exit_status=$?
   { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
 ' 0
-  trap '{ (exit 1); exit 1; }' 1 2 13 15
+  trap 'as_fn_exit 1' 1 2 13 15
 }
 # Create a (secure) tmp directory for tmp files.
 
@@ -31121,11 +20065,7 @@ $debug ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
-} ||
-{
-   $as_echo "$as_me: cannot create a temporary directory in ." >&2
-   { (exit 1); exit 1; }
-}
+} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -31133,10 +20073,16 @@ $debug ||
 if test -n "$CONFIG_FILES"; then
 
 
-ac_cr='
'
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
-  ac_cs_awk_cr='\\r'
+  ac_cs_awk_cr='\r'
 else
   ac_cs_awk_cr=$ac_cr
 fi
@@ -31150,24 +20096,18 @@ _ACEOF
   echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
   echo "_ACEOF"
 } >conf$$subs.sh ||
-  { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
 ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   . ./conf$$subs.sh ||
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
 
   ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
   if test $ac_delim_n = $ac_delim_num; then
     break
   elif $ac_last_try; then
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -31189,7 +20129,7 @@ s/'"$ac_delim"'$//
 t delim
 :nl
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more1
 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
 p
@@ -31203,7 +20143,7 @@ s/.\{148\}//
 t nl
 :delim
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more2
 s/["\\]/\\&/g; s/^/"/; s/$/"/
 p
@@ -31256,9 +20196,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
 else
   cat
 fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
-$as_echo "$as_me: error: could not setup config files machinery" >&2;}
-   { (exit 1); exit 1; }; }
+  || as_fn_error "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
 # VPATH may cause trouble with some makes, so we remove $(srcdir),
@@ -31299,9 +20237,7 @@ for ac_last_try in false false :; do
   if test -z "$ac_t"; then
     break
   elif $ac_last_try; then
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -31386,9 +20322,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5
-$as_echo "$as_me: error: could not setup config headers machinery" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "could not setup config headers machinery" "$LINENO" 5
 fi # test -n "$CONFIG_HEADERS"
 
 
@@ -31401,9 +20335,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
-$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
-   { (exit 1); exit 1; }; };;
+  :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -31431,12 +20363,10 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
-   { (exit 1); exit 1; }; };;
+	   as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
-      ac_file_inputs="$ac_file_inputs '$ac_f'"
+      as_fn_append ac_file_inputs " '$ac_f'"
     done
 
     # Let's still pretend it is `configure' which instantiates (i.e., don't
@@ -31447,7 +20377,7 @@ $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
 	`' by configure.'
     if test x"$ac_file" != x-; then
       configure_input="$ac_file.  $configure_input"
-      { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
 $as_echo "$as_me: creating $ac_file" >&6;}
     fi
     # Neutralize special characters interpreted by sed in replacement strings.
@@ -31460,9 +20390,7 @@ $as_echo "$as_me: creating $ac_file" >&6;}
 
     case $ac_tag in
     *:-:* | *:-) cat >"$tmp/stdin" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; } ;;
+      || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -31490,47 +20418,7 @@ $as_echo X"$ac_file" |
 	    q
 	  }
 	  s/.*/./; q'`
-  { as_dir="$ac_dir"
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
+  as_dir="$ac_dir"; as_fn_mkdir_p
   ac_builddir=.
 
 case "$ac_dir" in
@@ -31587,7 +20475,6 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # If the template does not know about datarootdir, expand it.
 # FIXME: This hack should be removed a few years after 2.60.
 ac_datarootdir_hack=; ac_datarootdir_seen=
-
 ac_sed_dataroot='
 /datarootdir/ {
   p
@@ -31597,12 +20484,11 @@ ac_sed_dataroot='
 /@docdir@/p
 /@infodir@/p
 /@localedir@/p
-/@mandir@/p
-'
+/@mandir@/p'
 case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
 *datarootdir*) ac_datarootdir_seen=yes;;
 *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
@@ -31612,7 +20498,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   s&@infodir@&$infodir&g
   s&@localedir@&$localedir&g
   s&@mandir@&$mandir&g
-    s&\\\${datarootdir}&$datarootdir&g' ;;
+  s&\\\${datarootdir}&$datarootdir&g' ;;
 esac
 _ACEOF
 
@@ -31641,14 +20527,12 @@ s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
 "
 eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+  || as_fn_error "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
   { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
   { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
-  { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined." >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined." >&2;}
@@ -31658,9 +20542,7 @@ which seems to be undefined.  Please make sure it is defined." >&2;}
   -) cat "$tmp/out" && rm -f "$tmp/out";;
   *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
   esac \
-  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+  || as_fn_error "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
@@ -31671,25 +20553,19 @@ $as_echo "$as_me: error: could not create $ac_file" >&2;}
       $as_echo "/* $configure_input  */" \
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
     } >"$tmp/config.h" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+      || as_fn_error "could not create $ac_file" "$LINENO" 5
     if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
-      { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
       mv "$tmp/config.h" "$ac_file" \
-	|| { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+	|| as_fn_error "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5
-$as_echo "$as_me: error: could not create -" >&2;}
-   { (exit 1); exit 1; }; }
+      || as_fn_error "could not create -" "$LINENO" 5
   fi
 # Compute "$ac_file"'s index in $config_headers.
 _am_arg="$ac_file"
@@ -31727,7 +20603,7 @@ $as_echo X"$_am_arg" |
 	  s/.*/./; q'`/stamp-h$_am_stamp_count
  ;;
 
-  :C)  { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
 $as_echo "$as_me: executing $ac_file commands" >&6;}
  ;;
   esac
@@ -31822,47 +20698,7 @@ $as_echo X"$file" |
 	    q
 	  }
 	  s/.*/./; q'`
-      { as_dir=$dirpart/$fdir
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
+      as_dir=$dirpart/$fdir; as_fn_mkdir_p
       # echo "creating $dirpart/$file"
       echo '# dummy' > "$dirpart/$file"
     done
@@ -32512,15 +21348,12 @@ _LT_EOF
 done # for ac_tag
 
 
-{ (exit 0); exit 0; }
+as_fn_exit 0
 _ACEOF
-chmod +x $CONFIG_STATUS
 ac_clean_files=$ac_clean_files_save
 
 test $ac_write_fail = 0 ||
-  { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
 
 
 # configure is writing to config.log, and then calls config.status.
@@ -32541,10 +21374,10 @@ if test "$no_create" != yes; then
   exec 5>>config.log
   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
   # would make configure fail if this is the last instruction.
-  $ac_cs_success || { (exit 1); exit 1; }
+  $ac_cs_success || as_fn_exit $?
 fi
 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
-  { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
diff --git a/configure.in b/configure.in
index c9f57da..1fae6fd 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 AC_PREREQ(2.59)
-AC_REVISION($Id: configure.in,v 1.262.2.33 2010/07/09 15:57:45 source Exp $)
+AC_REVISION($Id: configure.in,v 1.262.2.44 2011/03/29 23:20:19 source Exp $)
 #
 #  configure.in
 #
@@ -30,7 +30,7 @@ AC_REVISION($Id: configure.in,v 1.262.2.33 2010/07/09 15:57:45 source Exp $)
 ##########################################################################
 
 AC_INIT([Virtuoso Open Source Edition],
-	[6.1.2],
+	[6.1.3],
 	[vos.admin at openlinksw.com],
 	[virtuoso-opensource])
 AC_CONFIG_SRCDIR([libsrc/Dk.h])
@@ -608,25 +608,34 @@ AC_SYS_RESTARTABLE_SYSCALLS
 ##									##
 ##########################################################################
 
+CCOPT=""
+CCDEFS=""
+CCWARN=""
+CCDEBUG=""
+CCLIBS=""
+
+AC_CHECKING([default compiler values])
+if eval "${CC-cc} $CFLAGS $AM_LDFLAGS -o binsrc/config/ccdefs binsrc/config/ccdefs.c" ; then
+    eval `binsrc/config/ccdefs`
+fi
+
 AC_ARG_WITH(debug, [dnl
 AC_HELP_STRING([--with-debug], [debugging code])dnl
 ], [ with_debug="$withval" ],
    [ with_debug="no" ])
 if test "x$with_debug" = "xyes"; then
+    changequote({,})
+    CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
+    CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
+    changequote([,])
+
     CCOPT="-g"
     AM_LDFLAGS="-g"
+    CCDEBUG=""
 else
-    CCOPT=""
     AM_LDFLAGS="-s"
 fi
 
-AC_CHECKING([default compiler values])
-if eval "${CC-cc} $CFLAGS $AM_LDFLAGS -o binsrc/config/ccdefs binsrc/config/ccdefs.c" ; then
-    eval `binsrc/config/ccdefs`
-else
-    CCOPT=-O
-fi
-
 
 #AC_CHECKING(for suspicious C compiler)
 #AC_TRY_COMPILE([ ], [struct { long l; void *d; } *x;
@@ -1591,8 +1600,22 @@ AC_HELP_STRING([--with-malloc-debug], [extra malloc debugging code])],
 if test "x$with_malloc_debug" = "xyes"; then
     BUILD_OPTS="$BUILD_OPTS malloc_debug"
     CCDEBUG="$CCDEBUG -DMALLOC_DEBUG"
-    CCOPT="$CCOPT -g"
-    AM_LDFLAGS="$AM_LDFLAGS -g"
+    CCOPT="-g"
+    AM_LDFLAGS="-g"
+fi
+
+
+AC_ARG_WITH(mtx-debug, [dnl
+AC_HELP_STRING([--with-mtx-debug], [extra mutex debugging code])],
+    [ with_mtx_debug="$withval" ],
+    [ with_mtx_debug="no" ]
+)
+
+if test "x$with_mtx_debug" = "xyes"; then
+    BUILD_OPTS="$BUILD_OPTS mtx_debug"
+    CCDEBUG="$CCDEBUG -DMTX_DEBUG"
+    CCOPT="-g"
+    AM_LDFLAGS="-g"
 fi
 
 
@@ -1680,7 +1703,7 @@ fi
 AC_SUBST(LIBTHR)
 save_LIBS="$LIBS"
 LIBS="$LIBTHR $LIBS"
-AC_CHECK_FUNCS(pthread_attr_setstacksize pthread_attr_getstacksize)
+AC_CHECK_FUNCS(pthread_attr_setstacksize pthread_attr_getstacksize pthread_sigmask)
 LIBS="$save_LIBS"
 srvrlibs="$srvrlibs $LIBTHR"
 AM_CONDITIONAL(WITH_PTHREADS, test "x$WITH_PTHREADS" = "xyes" )
@@ -2086,13 +2109,13 @@ if test "x$ac_integ_jdk" != "x" ; then
     ac_save_CPPFLAGS="$CPPFLAGS"
     #supported jvm hosting platforms : add more here
     case $host in
-	x64_64-*-linux*)
+	x86_64-*-linux*)
                 CPPFLAGS="$CPPFLAGS -I$ac_integ_jdk/include -I$ac_integ_jdk/include/linux"
         	AC_CHECK_HEADERS(jni.h,
 			[ java_CPPFLAGS="-I$ac_integ_jdk/include -I$ac_integ_jdk/include/linux" ],
 			[ ac_integ_jdk="" ])
 		AC_CHECK_LIB(jvm, JNI_GetDefaultJavaVMInitArgs,
-			[ java_LDFLAGS="-L$ac_integ_jdk/jre/lib/amd64/server -ljvm" ],
+			[ java_LDFLAGS="-L$ac_integ_jdk/jre/lib/amd64/server -R$ac_integ_jdk/jre/lib/amd64/server -ljvm" ],
 			[ ac_integ_jdk="" ],
 			[ "-L$ac_integ_jdk/jre/lib/amd64/server"])
 		;;
diff --git a/docsrc/Makefile.in b/docsrc/Makefile.in
index 9282acf..5e2e361 100644
--- a/docsrc/Makefile.in
+++ b/docsrc/Makefile.in
@@ -179,6 +179,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/docsrc/chm/Makefile.in b/docsrc/chm/Makefile.in
index 89ba98b..c9d45f5 100644
--- a/docsrc/chm/Makefile.in
+++ b/docsrc/chm/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/docsrc/docwiki/Makefile.in b/docsrc/docwiki/Makefile.in
index 356acd0..61ae7e8 100644
--- a/docsrc/docwiki/Makefile.in
+++ b/docsrc/docwiki/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/docsrc/html_virt/Makefile.in b/docsrc/html_virt/Makefile.in
index 8d2245d..cb29ff8 100644
--- a/docsrc/html_virt/Makefile.in
+++ b/docsrc/html_virt/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/docsrc/images/Makefile.in b/docsrc/images/Makefile.in
index 200d0e1..388df79 100644
--- a/docsrc/images/Makefile.in
+++ b/docsrc/images/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/docsrc/images/rdf.png b/docsrc/images/rdf.png
index 76fc9e8..59510e7 100644
Binary files a/docsrc/images/rdf.png and b/docsrc/images/rdf.png differ
diff --git a/docsrc/images/rdf1.png b/docsrc/images/rdf1.png
new file mode 100644
index 0000000..f455fd9
Binary files /dev/null and b/docsrc/images/rdf1.png differ
diff --git a/docsrc/images/rdf10.png b/docsrc/images/rdf10.png
new file mode 100644
index 0000000..f96b79c
Binary files /dev/null and b/docsrc/images/rdf10.png differ
diff --git a/docsrc/images/rdf11.png b/docsrc/images/rdf11.png
new file mode 100644
index 0000000..21812ee
Binary files /dev/null and b/docsrc/images/rdf11.png differ
diff --git a/docsrc/images/rdf12.png b/docsrc/images/rdf12.png
new file mode 100644
index 0000000..473259e
Binary files /dev/null and b/docsrc/images/rdf12.png differ
diff --git a/docsrc/images/rdf13.png b/docsrc/images/rdf13.png
new file mode 100644
index 0000000..fcbcb79
Binary files /dev/null and b/docsrc/images/rdf13.png differ
diff --git a/docsrc/images/rdf14.png b/docsrc/images/rdf14.png
new file mode 100644
index 0000000..1b9ef40
Binary files /dev/null and b/docsrc/images/rdf14.png differ
diff --git a/docsrc/images/rdf15.png b/docsrc/images/rdf15.png
new file mode 100644
index 0000000..6176f6c
Binary files /dev/null and b/docsrc/images/rdf15.png differ
diff --git a/docsrc/images/rdf16.png b/docsrc/images/rdf16.png
new file mode 100644
index 0000000..3985daf
Binary files /dev/null and b/docsrc/images/rdf16.png differ
diff --git a/docsrc/images/rdf17.png b/docsrc/images/rdf17.png
new file mode 100644
index 0000000..87255a3
Binary files /dev/null and b/docsrc/images/rdf17.png differ
diff --git a/docsrc/images/rdf2.png b/docsrc/images/rdf2.png
new file mode 100644
index 0000000..8b48734
Binary files /dev/null and b/docsrc/images/rdf2.png differ
diff --git a/docsrc/images/rdf3.png b/docsrc/images/rdf3.png
new file mode 100644
index 0000000..075003a
Binary files /dev/null and b/docsrc/images/rdf3.png differ
diff --git a/docsrc/images/rdf4.png b/docsrc/images/rdf4.png
new file mode 100644
index 0000000..cba3c7e
Binary files /dev/null and b/docsrc/images/rdf4.png differ
diff --git a/docsrc/images/rdf5.png b/docsrc/images/rdf5.png
new file mode 100644
index 0000000..78379d0
Binary files /dev/null and b/docsrc/images/rdf5.png differ
diff --git a/docsrc/images/rdf6.png b/docsrc/images/rdf6.png
new file mode 100644
index 0000000..34d2763
Binary files /dev/null and b/docsrc/images/rdf6.png differ
diff --git a/docsrc/images/rdf7.png b/docsrc/images/rdf7.png
new file mode 100644
index 0000000..b494194
Binary files /dev/null and b/docsrc/images/rdf7.png differ
diff --git a/docsrc/images/rdf8.png b/docsrc/images/rdf8.png
new file mode 100644
index 0000000..096386c
Binary files /dev/null and b/docsrc/images/rdf8.png differ
diff --git a/docsrc/images/rdf9.png b/docsrc/images/rdf9.png
new file mode 100644
index 0000000..2454059
Binary files /dev/null and b/docsrc/images/rdf9.png differ
diff --git a/docsrc/images/ui/fsp1.png b/docsrc/images/ui/fsp1.png
new file mode 100644
index 0000000..08e2ac7
Binary files /dev/null and b/docsrc/images/ui/fsp1.png differ
diff --git a/docsrc/images/ui/fsp2.png b/docsrc/images/ui/fsp2.png
new file mode 100644
index 0000000..d8bb95e
Binary files /dev/null and b/docsrc/images/ui/fsp2.png differ
diff --git a/docsrc/images/ui/fsp3.png b/docsrc/images/ui/fsp3.png
new file mode 100644
index 0000000..dddf6e5
Binary files /dev/null and b/docsrc/images/ui/fsp3.png differ
diff --git a/docsrc/images/ui/fsp4.png b/docsrc/images/ui/fsp4.png
new file mode 100644
index 0000000..b3ff29a
Binary files /dev/null and b/docsrc/images/ui/fsp4.png differ
diff --git a/docsrc/images/ui/fsp5.png b/docsrc/images/ui/fsp5.png
new file mode 100644
index 0000000..2d5db43
Binary files /dev/null and b/docsrc/images/ui/fsp5.png differ
diff --git a/docsrc/images/ui/fsp6.png b/docsrc/images/ui/fsp6.png
new file mode 100644
index 0000000..caacf8d
Binary files /dev/null and b/docsrc/images/ui/fsp6.png differ
diff --git a/docsrc/images/ui/s1.png b/docsrc/images/ui/s1.png
new file mode 100644
index 0000000..da4801b
Binary files /dev/null and b/docsrc/images/ui/s1.png differ
diff --git a/docsrc/images/ui/s2.png b/docsrc/images/ui/s2.png
new file mode 100644
index 0000000..b0a74c5
Binary files /dev/null and b/docsrc/images/ui/s2.png differ
diff --git a/docsrc/images/ui/s3.png b/docsrc/images/ui/s3.png
new file mode 100644
index 0000000..841cdd6
Binary files /dev/null and b/docsrc/images/ui/s3.png differ
diff --git a/docsrc/images/ui/s4.png b/docsrc/images/ui/s4.png
new file mode 100644
index 0000000..e160c79
Binary files /dev/null and b/docsrc/images/ui/s4.png differ
diff --git a/docsrc/images/ui/s5.png b/docsrc/images/ui/s5.png
new file mode 100644
index 0000000..4bb27db
Binary files /dev/null and b/docsrc/images/ui/s5.png differ
diff --git a/docsrc/pdf/Makefile.in b/docsrc/pdf/Makefile.in
index a9bca0d..9a86f09 100644
--- a/docsrc/pdf/Makefile.in
+++ b/docsrc/pdf/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/docsrc/releasenotes/Makefile.in b/docsrc/releasenotes/Makefile.in
index 6e9fa87..f37d48b 100644
--- a/docsrc/releasenotes/Makefile.in
+++ b/docsrc/releasenotes/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/docsrc/styleguide/Makefile.in b/docsrc/styleguide/Makefile.in
index f2c0c06..8ccf0fa 100644
--- a/docsrc/styleguide/Makefile.in
+++ b/docsrc/styleguide/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/docsrc/stylesheets/Makefile.in b/docsrc/stylesheets/Makefile.in
index d5fc514..022a9ef 100644
--- a/docsrc/stylesheets/Makefile.in
+++ b/docsrc/stylesheets/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/docsrc/xmlsource/Makefile.in b/docsrc/xmlsource/Makefile.in
index bd3c695..35d7f8f 100644
--- a/docsrc/xmlsource/Makefile.in
+++ b/docsrc/xmlsource/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/docsrc/xmlsource/accessinterfaces.xml b/docsrc/xmlsource/accessinterfaces.xml
index 5a99e7d..be85c8a 100644
--- a/docsrc/xmlsource/accessinterfaces.xml
+++ b/docsrc/xmlsource/accessinterfaces.xml
@@ -1304,6 +1304,162 @@ Total time: 5 seconds
   <listitem>Hibernate logging levels can be varied by changing the settings in the src/hibernate.cfg.xml and src/log4j.properties files.</listitem>
 </orderedlist>
       </sect5>
+      <sect5 id="JDBCDriverhibernatesetupandtestingexmp4"><title>Example 4</title>
+      <para>This example demonstrates how to make Multi Thread Virtuoso connection using JDBC.</para>
+      <para>It starts 3 threads: one thread executes SPARQL select and two threads execute SPARQL inserts:</para>
+<programlisting><![CDATA[
+import java.util.*;
+import java.sql.*;
+import java.math.*;
+
+public class MTtest extends Thread {
+
+  int mode = 0;
+  int startId = 0;
+
+  static  String urlDB = "jdbc:virtuoso://localhost:1111";
+
+ 
+ public MTtest(int _mode, int _init) {
+   mode = _mode;
+   startId = _init;
+ }
+
+
+
+ void prnRs(ResultSet rs)
+ {
+   try {
+     ResultSetMetaData rsmd;
+
+     System.out.println(">>>>>>>>");
+     rsmd = rs.getMetaData();
+     int cnt = rsmd.getColumnCount();
+
+       while(rs.next()) {
+         Object o;
+
+         System.out.print("Thread:"+Thread.currentThread().getId()+"  ");
+         for (int i = 1; i <= cnt; i++) {
+           o = rs.getObject(i);
+           if (rs.wasNull())
+             System.out.print("<NULL> ");
+           else
+             System.out.print("["+ o + "] ");
+         }
+         System.out.println();
+       }
+
+   } catch (Exception e) {
+     System.out.println(e);
+     e.printStackTrace();
+   }
+   System.out.println(">>>>>>>>");
+ }
+
+
+
+
+ public static void main(String argv[])
+ {
+  try {
+
+    Class.forName("virtuoso.jdbc3.Driver");
+
+    Connection conn = DriverManager.getConnection(urlDB,"dba","dba");
+    Statement st = conn.createStatement();
+
+    st.execute("sparql clear graph <mttest>");
+    st.execute("sparql insert into graph <mttest> { <xxx> <P01> \"test1\" }");
+    st.execute("sparql insert into graph <mttest> { <xxx> <P01> \"test2\" }");
+    st.execute("sparql insert into graph <mttest> { <xxx> <P01> \"test3\" }");
+    st.execute("sparql insert into graph <mttest> { <xxx> <P01> \"test4\" }");
+    st.execute("sparql insert into graph <mttest> { <xxx> <P01> \"test5\" }");
+    conn.close();
+
+
+    int init = 0;
+
+    for(int i=0; i < 2; i++) {
+      MTtest thr1 = new MTtest(1, init);
+      init+=10;
+
+      MTtest thr2 = new MTtest(0, init);
+      init+=10;
+
+      MTtest thr3 = new MTtest(0, init);
+      init+=10;
+
+      thr1.start();
+      thr2.start();
+      thr3.start();
+
+      thr1.join();
+      thr2.join();
+      thr3.join();
+    }
+
+    System.out.println("===End===");
+
+  } catch (Exception e) {
+    System.out.print(e);
+    e.printStackTrace();
+  }
+ }
+
+
+ public void run( ) 
+ {
+  try {
+
+    Connection conn = DriverManager.getConnection(urlDB,"dba","dba");
+    Statement st;
+
+    st = conn.createStatement();
+
+    if (mode == 1) 
+    {
+      String query = "sparql SELECT * from <mttest> WHERE {?s ?p ?o}";
+      ResultSet rs = st.executeQuery(query);
+      prnRs(rs);
+    }
+    else
+    {
+      long id = Thread.currentThread().getId();
+      for (int i =0; i < 5; i++)
+        st.execute("sparql insert into graph <mttest> { <xxx"+startId+"> <P"+id+"> \"test"+i+"\" }");
+
+      System.out.println("\nThread:"+Thread.currentThread().getId()+"  ===Rows Inserted===");
+    }
+
+
+    conn.close();
+  
+  } catch (SQLException e) {
+        System.out.println("===========================================================");
+        System.out.println(">>["+e.getMessage()+"]");
+        System.out.println(">>["+e.getErrorCode()+"]");
+        System.out.println(">>["+e.getSQLState()+"]");
+        System.out.println(e);
+        System.out.println("===========================================================");
+        e.printStackTrace();
+        System.exit(-1);
+  } catch (Exception e) {
+        System.out.println("===========================================================");
+        System.out.println(e);
+        System.out.println("===========================================================");
+        e.printStackTrace();
+        System.exit(-1);
+  }
+ } // run( )
+
+
+
+
+
+}	
+]]></programlisting>      
+      </sect5>      
       </sect4>
     </sect3>
   </sect2>
@@ -1441,7 +1597,7 @@ VirtuosoRepository("server1:port1,server2:port2,server3", "uid", "pwd");
     <sect3 id="dataccessclientsconfailandbalancesesms"><title>Sample program</title>
 <programlisting><![CDATA[
 /*
- *  $Id: accessinterfaces.xml,v 1.6.2.5 2010/03/30 17:59:29 source Exp $
+ *  $Id: accessinterfaces.xml,v 1.6.2.6 2011/03/05 00:03:22 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/docsrc/xmlsource/adminui.rdfadm.xml b/docsrc/xmlsource/adminui.rdfadm.xml
new file mode 100644
index 0000000..b59052c
--- /dev/null
+++ b/docsrc/xmlsource/adminui.rdfadm.xml
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+ -
+-->
+
+<sect2 id="rdfadm"><title>Conductor RDF Administration</title>
+  <para>From Conductor the RDF tab allows you to execute/save/load SPARQL queries, 
+	to add/edit RDF Mapping, to perform statistics and manage graphs, 
+	to import schemas and define namespaces, to generated RDF views and to upload to the RDF Store.
+	</para>
+  <sect3 id="rdfadmsparql"><title>SPARQL</title>  
+    <sect4 id="rdfadmsparqlex"><title>Query</title>  
+	    <para>"SPARQL -> Query" offers form form SPARQL query execution:</para>
+	    <figure id="adminuirdf1" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf.png"/>
+	    </figure>
+	    <para>Also you can save the results in a query or load such:</para>
+	    <figure id="adminuirdf2" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf1.png"/>
+	    </figure>
+	  </sect4>
+	  <sect4 id="rdfadmsparqlqr"><title>Saved Queries</title>  
+	    <para>"SPARQL -> Saved Queries" offers list of saved queries, which can be opened in the "Query" tab
+	    	in order to be executed:</para>
+	    <figure id="adminuirdf3" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf2.png"/>
+	    </figure>	 
+	  </sect4>  
+	</sect3>
+	<sect3 id="rdfadmsponger"><title>Sponger</title>
+	  <para></para>
+	  <sect4 id="rdfadmspongerexcatr"><title>Extractor Cartridges</title>  
+	    <para>Shows list of available extractor cartridges. They can be re-ordered by place 
+	    of appearance, edit or deleted:</para>
+	  	<figure id="adminuirdf4" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf3.png"/>
+	    </figure>  
+	    <para>You can also add a new extractor cartridge:</para>
+	  	<figure id="adminuirdf5" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf4.png"/>
+	    </figure>  	    
+	  </sect4>  	  
+	  <sect4 id="rdfadmspongermtcatr"><title>Meta Cartridges</title>  
+      <para>Shows list of available meta cartridges. They can be re-ordered by place 
+	    of appearance, edit or deleted:</para>	 
+	  	<figure id="adminuirdf6" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf5.png"/>
+	    </figure>	
+	    <para>You can also add a new meta cartridge:</para>
+	  	<figure id="adminuirdf7" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf6.png"/>
+	    </figure>  	         
+	  </sect4>  	  
+	  <sect4 id="rdfadmspongerstsh"><title>Stylesheets</title>  
+	    <para>Shows list of available stylesheets for processing cartridges. From here you 
+	    	can manage these stylesheets by adding new, editing existing ones or deleting them:</para>	
+	  	<figure id="adminuirdf8" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf7.png"/>
+	    </figure> 	    	
+	  </sect4>  	  
+	  <sect4 id="rdfadmspongercons"><title>Console</title>  
+	     <para>Offers tracking cartridges exection. By default is off. When enabled, shows list of 
+	     	sessions per cartridge:</para>
+	  	<figure id="adminuirdf9" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf8.png"/>
+	    </figure> 	     	
+	  </sect4>  	  
+	  <sect4 id="rdfadmspongerconf"><title>Configuration</title>  
+	    <para>Offers creation of secure endpoints for pre-defiend vitual host:</para>
+	  	<figure id="adminuirdf10" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf9.png"/>
+	    </figure>	    
+	  </sect4>  	  
+	</sect3>
+	<sect3 id="rdfadmstatst"><title>Statistics</title>
+	  <para>Offers interface for <link linkend="fn_rdf_void_store"><function>DB.DBA.RDF_VOID_STORE(graph, to_graph)</function></link>. In the new graph ( field "Publish to") 
+	  	will be saved the VoID statistics data when generated:</para>
+	  <figure id="adminuirdf11" float="1">
+      <title>RDF</title>
+		  <graphic fileref="rdf14.png"/>
+	  </figure>		  
+	  <figure id="adminuirdf12" float="1">
+      <title>RDF</title>
+		  <graphic fileref="rdf15.png"/>
+	  </figure>	
+	</sect3>
+	<sect3 id="rdfadmgraphs"><title>Graphs</title>
+	  <para>"Graphs" tab shows list of current graphs in the RDF Quad Store. From here 
+	  day can be renamed or deleted:</para>
+	  	<figure id="adminuirdf13" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf10.png"/>
+	    </figure>	  
+	</sect3>
+	<sect3 id="rdfadmschemas"><title>Schemas</title>
+	  <para>Shows list of available schemas IRI-s and offers a new schema IRI to be imported:</para>
+	  	<figure id="adminuirdf14" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf11.png"/>
+	    </figure>	  	  
+	</sect3>
+	<sect3 id="rdfadmnamesp"><title>Namespaces</title>
+	  <para>Shows list of namespace prefixes and offers a new namespace prefix to be imported:</para>
+	  	<figure id="adminuirdf15" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf12.png"/>
+	    </figure>	  	  
+	</sect3>
+	<sect3 id="rdfadmviews"><title>RDF Views</title>
+	  <para>Virtuoso uses a SPARQL-based Meta Schema Language to provide RDBMS-to-RDF mapping 
+	  	functionality (also described as, RDF Views of SQL data). The language is an extension of the SPARQL query language meshed with Virtuoso's SPASQL (SPARQL-inside-SQL) functionality. The language enables you to declaratively map relational database schema tables, columns, rows, and foreign key relationships to Classes, Attributes, Relationships, and Instances (Objects/Entities/Individuals) defined by RDF Schemas or OWL Ontologies. The mapping process uses a special built-in Virtuoso function to generate IRIs / URIs in "Subject" or "Object" position of a SPARQL graph pattern, en route to building a set of SQL compiler rules and optimizations for translating SPARQL queries into SQL on the fly.</para>
+	  	<figure id="adminuirdf16" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf13.png"/>
+	    </figure>		  	
+	    <tip><title>See Also:</title> 
+	      <para><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VOSSQL2RDF#Mapping%20Process">Mapping Process steps.</ulink></para>
+	      <para><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VOSSQL2RDF#Mapping%20Example">Mapping Example.</ulink></para>
+	      <para><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VOSSQL2RDF">Mapping SQL Data to RDF.</ulink></para>	      
+	      <para><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtRdb2RDFViewsGeneration">Automated Generation of RDF Views over Relational Data Sources with Virtuoso.</ulink></para>	      	      
+	    </tip>
+	</sect3>
+	<sect3 id="rdfadm"><title>RDF Store Upoload</title>
+	  <para>Offers upload to RDF Quad Store from file or Resource URL:</para>
+	  	<figure id="adminuirdf17" float="1">
+        <title>RDF</title>
+		    <graphic fileref="rdf16.png"/>
+	    </figure>		 	  
+	</sect3>
+	<sect3 id="rdfadm"><title>RDF Subscriptions</title>
+	  <para>This tab will be only when the 
+	    <ulink url="http://s3.amazonaws.com/opldownload/uda/vad-packages/6.1/virtuoso/pubsubhub_dav.vad">pubsubhub_dav.vad</ulink> 
+	    is installed.</para>	    
+	  <para>Offers Virtuoso's implementation of the <ulink url="http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.3.html">PubSubHubBub Protocol</ulink> to handle Linked Data 
+	  	by subscribing to Linked Data resource URIs.</para>
+	  <para>Note: the Hub endpoint should be defined ACL in System Admin -> Security -> Access Control -> PSH-SLL</para>
+    <tip><title>See Also:</title>	    
+      <para><ulink url="http://ods.openlinksw.com/wiki/ODS/VirtPubSubHub">Example of Linked Data Usage of PubSubHubbub Implementation.</ulink></para>
+      <para><ulink url="http://ods.openlinksw.com/wiki/ODS/VirtFeedPubSubHub">Feed subscription via PubSubHub Protocol.</ulink></para>
+      <para><ulink url="http://ods.openlinksw.com/wiki/ODS/VirtODSPubSubHub">Setting up PubSubHub in ODS.</ulink></para>
+      <para><ulink url="http://ods.openlinksw.com/wiki/ODS/VirtAuthPolicyFOAFSSL">WebID Protocol ACLs Tutorial.</ulink></para>
+    </tip>
+	</sect3>
+</sect2>
diff --git a/docsrc/xmlsource/adminui.webservices.xml b/docsrc/xmlsource/adminui.webservices.xml
index 43ddfa3..e3c711e 100644
--- a/docsrc/xmlsource/adminui.webservices.xml
+++ b/docsrc/xmlsource/adminui.webservices.xml
@@ -23,11 +23,10 @@
 -->
 
 <sect2 id="admui.webservices"><title>Web Services</title>
-  <sect3 id="importtargets">
-			<title>Import Targets</title>
-    <para>Virtuoso can be set up to retrieve content from external web sites and host it in its own
+  <sect3 id="contentcrawler"><title>Content Crawler</title>
+  <itemizedlist mark="bullet">Supported features:
+     <listitem>Import Targets: Virtuoso can be set up to retrieve content from external web sites and host it in its own
 WebDAV repository via this page.
-    </para>
         <figure float="1"><title>Web Robot - Target</title>
       <graphic fileref="ui/dav_rbt_trgt_01.png"/>
     </figure>
@@ -82,35 +81,26 @@ metadata from FOAF, RDF, RSS/RDF and GRDLL data depending on which check-box is
 When all details have been completed press the <emphasis>Add</emphasis> (or
 Update if updating) button to submit the web robot task to the queue.
     </para>
-  </sect3>
-  <sect3 id="importqueues">
-			<title>Import Queues</title>
-    <para>The "Imported Queues" page shows you a list of web copy targets that have been enlisted with the
+</listitem>
+     <listitem>Import Queues: this page shows you a list of web copy targets that have been enlisted with the
 Virtuoso Server, and a list of web robot update schedules. Several options are available for
 each item listed: Start, Update, Schedule, Reset, and Stop. You can configure the scheduled update
 interval by pressing the Schedule link and entering a value in minutes. Once that is done you can
 start the schedule by pressing the Start link. You make a manual update of the content by pressing
 the Update link. You can stop the scheduled updates taking place by pressing the Stop link. To reset
 the details of the web copy item press the Reset link.
-    </para>
         <figure float="1"><title>Web Robot - Queues</title>
       <graphic fileref="ui/dav_rbt_que_01.png"/>
     </figure>
-  </sect3>
-  <sect3 id="retrievedsites">
-			<title>Retrieved Sites</title>
-    <para>You can view a list of the links retrieved from the web copy from this page. You are also
+</listitem>
+     <listitem>Retrieved Sites: You can view a list of the links retrieved from the web copy from this page. You are also
 able to remove some of the content from this page by following the Edit link.
-    </para>
         <figure float="1"><title>Web Robot - Retrieved Links</title>
       <graphic fileref="ui/dav_rbt_rtrd_01.png"/>
     </figure>
-  </sect3>
-  <sect3 id="exportlocalcontent">
-			<title>Export</title>
-    <para>You can export content from the WebDAV repository. Note that you can only export content
+</listitem>
+     <listitem>Export: You can export content from the WebDAV repository. Note that you can only export content
 that has been retrieved using Virtuoso's Web Robot.
-    </para>
     <para>When you click the "Export" link for a retrieved collection, you will be presented
 with a form for selecting the export target location. Choose the export method: either File
 System or DAV by clicking the "External WebDAV Server URL" check-box. This lets you indicate to
@@ -128,6 +118,427 @@ filesystem method, then you are restricted to Virtuoso targets. However WebDAV m
 to any WebDAV server. WebDAV methods assume that the target is publicly available for writing.
       </para>
     </note>
+</listitem>
+     <listitem>Populate the RDF Quad Store: Virtuoso's built-in Content Crawler to can be used to populate its RDF Quad Store, as a one-time run or on a scheduled basis.
+<para>Transforming data sources into RDF "on the fly" is sufficient for many use cases, but there are times when the volume or sheer nature of a data source makes batch-loading necessary.</para>
+<para>For example, Freebase offers RDF representations of its data, but it doesn't publish RDF dumps; even if it did, such dumps would usually be outdated by the time they were loaded.</para>
+<para>One practical solution takes the form of a scheduled crawl of specific resources of interest.</para>
+</listitem>
+  </itemizedlist>
+  <sect4 id="contentcrawlerrdf"><title>Set Up the Content Crawler to Gather RDF</title>
+  <para>The Virtuoso Conductor can be used to set up various Content Crawler Jobs:</para>
+  <sect5 id="contentcrawlerrdfquad"><title>Setting up a Content Crawler Job to Add RDF Data to the Quad Store</title>
+<para>See <link linkend="rdfinsertmethodvirtuosocrawler">details</link> how to use Virtuoso Crawler for including the Sponger options so you crawl non-RDF but get RDF and this to the Quad Store.</para>  
+  </sect5>
+  <sect5 id="contentcrawlerrdfsm"><title>Setting up a Content Crawler Job to Retrieve Sitemaps (when the source includes RDFa)</title>
+  <para>The following section describes how to set up a crawler job for getting content of a basic Sitemap where the source includes RDFa.</para>
+<orderedlist>
+	<listitem>From the Virtuoso Conductor User Interface i.e. http://cname:port/conductor, login as the "dba" user.</listitem>
+  <listitem>Go to the "Web Application Server" tab.
+    <figure id="cr1" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Sitemaps</title>
+      <graphic fileref="ui/cr1.png"/>
+    </figure>
+  </listitem>
+  <listitem>Go to the "Content Imports" tab.
+    <figure id="cr2" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Sitemaps</title>
+      <graphic fileref="ui/cr2.png"/>
+    </figure>
+  </listitem>
+  <listitem>Click on the "New Target" button.
+    <figure id="cr3" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Sitemaps</title>
+      <graphic fileref="ui/cr3.png"/>
+    </figure>
+  </listitem>
+  <listitem>In the form displayed:
+<itemizedlist mark="bullet">
+  <listitem>Enter a name of choice in the "Target description" text box:
+<programlisting><![CDATA[
+Basic Sitemap Crawling Example 	
+]]></programlisting>  	
+</listitem>
+  <listitem>Enter the URL of the site to be crawled in the "Target URL" text box: 
+<programlisting><![CDATA[
+http://psclife.pscdog.com/catalog/seo_sitemap/product/&nbsp	
+]]></programlisting>  	
+</listitem>
+  <listitem>Enter the location in the Virtuoso WebDAV repository the crawled should stored in the "Copy to local DAV collection" text box, for example, if user demo is available, then:
+<programlisting><![CDATA[
+/DAV/home/demo/basic_sitemap/	
+]]></programlisting>  	
+</listitem>
+  <listitem>Choose the  "Local resources owner" for the collection from the list box available, for ex: user demo.</listitem>
+  <listitem>Select the "Ask for RDF" check box.</listitem>      
+  <listitem>Optionally you can select "Convert Link" to make all HREFs in the local stored content relative.</listitem>
+  <listitem>Click the "Create" button to create the import.</listitem>        
+</itemizedlist>
+    <figure id="cr11" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Sitemaps</title>
+      <graphic fileref="ui/cr11.png"/>
+    </figure>
+    <figure id="cr11a" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Sitemaps</title>
+      <graphic fileref="ui/cr11a.png"/>
+    </figure>    
+  </listitem>
+  <listitem>Click the "Import Queues" button.
+    <figure id="cr12" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Sitemaps</title>
+      <graphic fileref="ui/cr12.png"/>
+    </figure>
+  </listitem>
+  <listitem>For the "Robot targets" with label "Basic Sitemap Crawling Example " click the "Run" button.
+  </listitem>
+  <listitem>This will result in the Target site being crawled and the retrieved pages stored locally in DAV and any sponged triples in the RDF Quad store.
+    <figure id="cr13" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Sitemaps</title>
+      <graphic fileref="ui/cr13.png"/>
+    </figure>
+  </listitem>
+  <listitem>Go to the "Web Application Server" -> "Content Management" tab.
+    <figure id="cr14" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Sitemaps</title>
+      <graphic fileref="ui/cr14.png"/>
+    </figure>
+  </listitem>
+  <listitem>Navigate to the location of newly created DAV collection:
+<programlisting><![CDATA[
+/DAV/home/demo/basic_sitemap/	
+]]></programlisting>
+  </listitem>
+  <listitem>The retrieved content will be available in this location.
+    <figure id="cr15" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Sitemaps</title>
+      <graphic fileref="ui/cr15.png"/>
+    </figure>
+  </listitem>
+</orderedlist>  
+  </sect5>  
+  <sect5 id="contentcrawlerrdfssm"><title>Setting up a Content Crawler Job to Retrieve Semantic Sitemaps (a variation of the standard sitemap)</title>
+  <para>The following section describes how to set up crawler job for getting Semantic Sitemap's content -- a variation of standard sitemap:</para>  
+<orderedlist>
+  <listitem>From the Virtuoso Conductor User Interface i.e. http://cname:port/conductor, login as the "dba" user.</listitem>
+  <listitem>Go to "Web Application Server".
+    <figure id="cr1" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Semantic Sitemap content</title>
+      <graphic fileref="ui/cr1.png"/>
+    </figure>
+  </listitem>
+  <listitem>Go to "Content Imports".
+    <figure id="cr2" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Semantic Sitemap content</title>
+      <graphic fileref="ui/cr2.png"/>
+    </figure>
+  </listitem>
+  <listitem>Click "New Target".
+    <figure id="cr3" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Semantic Sitemap content</title>
+      <graphic fileref="ui/cr3.png"/>
+    </figure>
+  </listitem>
+  <listitem>In the shown form:
+<itemizedlist mark="bullet">
+  <listitem>Enter for "Target description":
+<programlisting><![CDATA[
+Semantic Web Sitemap Example 	
+]]></programlisting>  	
+</listitem>
+  <listitem>Enter for "Target URL":
+<programlisting><![CDATA[
+http://www.connexfilter.com/sitemap_en.xml	
+]]></programlisting>  	
+</listitem>
+  <listitem>Enter the location in the Virtuoso WebDAV  repository the crawled should stored in the "Copy to local DAV collection" text box, for example, if user demo is available, then:
+<programlisting><![CDATA[
+/DAV/home/demo/semantic_sitemap/	
+]]></programlisting>  	
+</listitem>
+  <listitem>Choose the "Local resources owner" for the collection from the list box available, for ex: user demo.</listitem> 
+  <listitem>Hatch "Semantic Web Crawling"
+<itemizedlist mark="bullet">
+  <listitem>Note: when you select this option, you can either:
+<orderedlist>
+  <listitem>Leave the Store Function and Extract Function empty - in this case the system Store and Extract functions will be used for the Semantic Web Crawling Process, or:</listitem>
+  <listitem>You can select your own Store and Extract Functions, for ex:
+<programlisting><![CDATA[
+-- Example of Extract Function
+use WS;
+
+create procedure WS.WS.SITEMAP_BB_PARSE (
+  in _host varchar, 
+  in _url varchar, 
+  in _root varchar, 
+  inout _content varchar,  
+  in _c_type varchar := null, 
+  in lev int := 0))
+{
+  --pl_debug+
+  declare xt, xp, graph any;
+  declare inx int;
+
+--  dbg_obj_print ('WS.WS.GET_URLS_SITEMAP', _url);
+
+  declare exit handler for sqlstate '*'
+    {
+--      dbg_obj_print (__SQL_MESSAGE);
+      return;
+    };
+
+  if (_url like '%.xml.gz')
+    {
+      _content := gzip_uncompress (_content); 
+    }
+
+  if (_url like '%.xml' or _url like '%.xml.gz' or _url like '%.rdf')
+    {
+      xt := xtree_doc (_content);
+      if (xpath_eval ('/urlset/dataset', xt) is not null)
+	{
+	  xp := xpath_eval ('/urlset/dataset/dataDumpLocation/text()', xt, 0);
+	  graph := cast (xpath_eval ('/urlset/dataset/datasetURI/text()', xt) as varchar);
+	  if (length (graph))
+	    update VFS_SITE set VS_UDATA = serialize (vector ('graph', graph)) where VS_HOST = _host and VS_ROOT = _root;
+	  inx := 0;
+	  foreach (any u in xp) do
+	    {
+	      declare hf, host, url varchar;
+
+	      u := cast (u as varchar);
+	      hf := WS.WS.PARSE_URI (u);
+	      host := hf[1];
+	      --dbg_obj_print ('WS.WS.GET_URLS_SITEMAP PARSE', u);
+	      url := hf[2];
+	      insert soft VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_OTHER) 
+		  values (host, now (), url, 'waiting', _root, NULL); 
+	      if (row_count () = 0)
+		update VFS_QUEUE set VQ_STAT = 'waiting', VQ_TS = now () where VQ_HOST = host and VQ_ROOT = _root and VQ_URL = url;
+	      inx := inx + 1;
+	    }
+	}
+      if (xpath_eval ('/sitemapindex/sitemap/loc', xt) is not null)
+	{
+	  xp := xpath_eval ('/sitemapindex/sitemap/loc/text()', xt, 0);
+	  inx := 0;
+	  foreach (any u in xp) do
+	    {
+	      declare hf, host, url varchar;
+
+	      u := trim (cast (u as varchar));
+	      hf := WS.WS.PARSE_URI (u);
+	      host := hf[1];
+--	      dbg_obj_print ('WS.WS.GET_URLS_SITEMAP', host, _host);
+	      url := hf[2];
+	      if (url <> '')
+		{
+		  insert soft VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_OTHER) 
+		      values (host, now (), url, 'waiting', _root, NULL); 
+		  if (row_count () = 0)
+		    update VFS_QUEUE set VQ_STAT = 'waiting', VQ_TS = now () where VQ_HOST = host and VQ_ROOT = _root and VQ_URL = url;
+		  inx := inx + 1;
+		}
+	    }
+	}
+    }
+  commit work;
+}
+;
+
+
+-- Example of Store Function
+use WS;
+
+create procedure WS.WS.SITEMAP_BB_STORE (
+  in _host varchar, 
+  in _url varchar, 
+  in _root varchar,
+  inout _content varchar, 
+  in _s_etag varchar, 
+  in _c_type varchar,
+  in store_flag int := 1, 
+  in udata any := null,
+  in lev int := 0)
+{
+  --pl_debug+
+  declare graph varchar;
+
+--  dbg_obj_print ('WS.WS.SITEMAP_BB_STORE', _url, udata);
+  if (isarray (udata))
+    graph := get_keyword ('graph', udata);
+  else  
+    graph := null;
+
+  if (graph is not null and _url like '%.rdf')
+    {
+      DB.DBA.RDF_LOAD_RDFXML (_content, graph, graph);
+      DB.DBA.VT_INC_INDEX_DB_DBA_RDF_OBJ ();
+    }
+  insert soft VFS_URL (VU_HOST, VU_URL, VU_CHKSUM, VU_CPTIME, VU_ETAG, VU_ROOT)
+      values (_host, _url, md5 (_content), now (), _s_etag, _root);
+  if (row_count () = 0)
+    update VFS_URL set VU_CHKSUM = md5 (_content), VU_CPTIME = now (), VU_ETAG = _s_etag where
+	VU_HOST = _host and VU_URL = _url and VU_ROOT = _root;
+  commit work;
+}
+;
+]]></programlisting>
+  </listitem>
+</orderedlist>  	
+  </listitem>
+</itemizedlist>
+  </listitem>    
+</itemizedlist>  	
+  </listitem>
+  <listitem>Hatch "Ask for RDF"
+    <figure id="cr16" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Semantic Sitemap content</title>
+      <graphic fileref="ui/cr16.png"/>
+    </figure>
+    <figure id="cr17" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Semantic Sitemap content</title>
+      <graphic fileref="ui/cr17.png"/>
+    </figure>    
+  </listitem>
+  <listitem>Optionally you can select "Convert Link" to make all HREFs in the local stored content relative.</listitem>
+  <listitem>Click the button "Create". 
+    <figure id="cr18" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Semantic Sitemap content</title>
+      <graphic fileref="ui/cr18.png"/>
+    </figure>
+  </listitem>
+  <listitem>Click "Import Queues".
+    <figure id="cr19" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Semantic Sitemap content</title>
+      <graphic fileref="ui/cr19.png"/>
+    </figure>
+  </listitem>
+  <listitem>For "Robot target" with label "Semantic Web Sitemap Example" click "Run".
+  </listitem>
+  <listitem>As result should be shown the number of the pages retrieved.
+    <figure id="cr20" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Semantic Sitemap content</title>
+      <graphic fileref="ui/cr20.png"/>
+    </figure>
+  </listitem>
+  <listitem>Check the retrieved RDF data from your Virtuoso instance sparql endpoint http://cname:port/sparql with the following query selecting all the retrieved graphs for ex:
+<programlisting><![CDATA[
+SELECT ?g 
+FROM <http://host:port/>
+WHERE 
+  { 
+    graph ?g { ?s ?p ?o } . 
+    FILTER ( ?g LIKE <http://www.connexfilter.com/%> ) 
+  }	
+]]></programlisting>
+    <figure id="cr21" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Semantic Sitemap content</title>
+      <graphic fileref="ui/cr21.png"/>
+    </figure>
+  </listitem>
+</orderedlist>  
+  </sect5> 
+  <sect5 id="contentcrawlerrdfsd"><title>Setting up a Content Crawler Job to Retrieve Content from Specific Directories</title>
+  <para>The following section describes how to set up crawler job for getting directories using Conductor.</para>  
+<orderedlist>
+	  <listitem>From the Virtuoso Conductor User Interface i.e. http://cname:port/conductor, login as the "dba" user.</listitem>
+  <listitem>Go to "Web Application Server".
+    <figure id="cr1" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Content from Specific Directories</title>
+      <graphic fileref="ui/cr1.png"/>
+    </figure>
+  </listitem>
+  <listitem>Go to "Content Imports".
+    <figure id="cr2" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Content from Specific Directories</title>
+      <graphic fileref="ui/cr2.png"/>
+    </figure>
+  </listitem>
+  <listitem>Click "New Target".
+    <figure id="cr3" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Content from Specific Directories</title>
+      <graphic fileref="ui/cr3.png"/>
+    </figure>
+  </listitem>
+  <listitem>In the shown form:
+<itemizedlist mark="bullet">
+  <listitem>Enter for "Target description":
+<programlisting><![CDATA[
+Gov.UK data	
+]]></programlisting>  	
+</listitem>
+  <listitem>Enter for "Target URL":
+<programlisting><![CDATA[
+http://source.data.gov.uk/data/	
+]]></programlisting>  	
+</listitem>
+  <listitem>Enter for "Copy to local DAV collection" for available user, for ex. demo:
+<programlisting><![CDATA[
+/DAV/home/demo/gov.uk/	
+]]></programlisting>  	
+</listitem>
+  <listitem>Choose from the available list "Local resources owner" an user, for ex. demo.	
+    <figure id="d1" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Content from Specific Directories</title>
+      <graphic fileref="ui/d1.png"/>
+    </figure>  	
+</listitem>
+  <listitem>Optionally you can select "Convert Link" to make all HREFs in the local stored content relative.</listitem>
+  <listitem>Click the button "Create".</listitem>
+</itemizedlist>
+  </listitem>
+  <listitem>As result the Robot target will be created:
+    <figure id="d2" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Content from Specific Directories</title>
+      <graphic fileref="ui/d2.png"/>
+    </figure>
+  </listitem>
+  <listitem>Click "Import Queues".
+    <figure id="d3" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Content from Specific Directories</title>
+      <graphic fileref="ui/d3.png"/>
+    </figure>
+  </listitem>
+  <listitem>For "Robot target" with label "Gov.UK data" click "Run".
+  </listitem>
+  <listitem>As result will be shown the status of the pages: retrieved, pending or respectively waiting.
+    <figure id="d4" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Content from Specific Directories</title>
+      <graphic fileref="ui/d4.png"/>
+    </figure>
+  </listitem>
+  <listitem>Click "Retrieved Sites".</listitem>
+  <listitem>As result should be shown the number of the total pages retrieved.
+    <figure id="d5" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Content from Specific Directories</title>
+      <graphic fileref="ui/d5.png"/>
+    </figure>
+  </listitem>
+  <listitem>Go to "Web Application Server" -> "Content Management".
+  </listitem>    
+  <listitem>Enter path:
+<programlisting><![CDATA[
+DAV/home/demo/gov.uk	
+]]></programlisting> 
+    <figure id="d6" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Content from Specific Directories</title>
+      <graphic fileref="ui/d6.png"/>
+    </figure> 	
+  </listitem> 
+  <listitem>Go to path
+<programlisting><![CDATA[
+DAV/home/demo/gov.uk/data	
+]]></programlisting>
+  </listitem> 
+  <listitem>As result the retrieved content will be shown.
+    <figure id="d7" float="1">
+      <title>Setting up a Content Crawler Job to Retrieve Content from Specific Directories</title>
+      <graphic fileref="ui/d7.png"/>
+    </figure>
+  </listitem>       
+</orderedlist>  
+  </sect5>   
+  </sect4>
   </sect3>
   <sect3 id="admiui.accesscontrol"><title>Access Control</title>
     <para>From "System Admin"/"Access Controls" you can manage Rules and ACL respectively for HTTP, News and Proxy.
diff --git a/docsrc/xmlsource/adminui.xml b/docsrc/xmlsource/adminui.xml
index d4ec66d..2b14a62 100644
--- a/docsrc/xmlsource/adminui.xml
+++ b/docsrc/xmlsource/adminui.xml
@@ -87,7 +87,7 @@ perform WSDL Import/Export, manage your BPEL processes.
 		<title>Replication</title>
 		<graphic fileref="replication.png"/>
         </figure>
-<para>From "RDF" you can execute/save/load SPARQL queries, add/edit RDF Mapping.</para>
+      <para>From "RDF" you can execute/save/load SPARQL queries, add/edit RDF Mapping, make statistics, manage graphs, import schemas and define namespaces, generated RDF views, upload to the RDF Store:</para>
 	<figure id="adminuirdf" float="1">
                 <title>RDF</title>
 		<graphic fileref="rdf.png"/>
@@ -110,6 +110,7 @@ perform WSDL Import/Export, manage your BPEL processes.
 &adminui.replicationandsynchronization;
 &adminui.dbadmin;
 <!--&adminui.mailsrvadm;-->
+&adminui.rdfadm;
 &adminui.newssrvadm;
 
 </sect1>
diff --git a/docsrc/xmlsource/appendixa.xml b/docsrc/xmlsource/appendixa.xml
index 0cb82ab..40dc12f 100644
--- a/docsrc/xmlsource/appendixa.xml
+++ b/docsrc/xmlsource/appendixa.xml
@@ -34,10 +34,164 @@
 
  &yacgrammar;
  &errors;
+ 
+<sect1 id="signalsandexitcodes"><title>Signals and Exit codes</title>
+<para>This section presents the most important exit codes and signals for Virtuoso on Unix/Linux.</para>
+  <sect2 id="signalsandexitcodesc"><title>Exit codes</title>
+<table colsep="1" frame="all" rowsep="0" shortentry="0" tocentry="1" tabstyle="decimalstyle" orient="land" pgwide="0">
+    <title>Exit codes</title>
+    <tgroup align="char" charoff="50" char="." cols="3">
+    <colspec align="left" colnum="1" colsep="0" colwidth="20pc"/>
+    <thead>
+      <row>
+        <entry>Exit Code</entry>
+        <entry>Category</entry>
+        <entry>Comment</entry>
+      </row>
+    </thead>
+    <tbody>
+      <row>
+        <entry>-1</entry>
+        <entry>FATAL</entry>
+        <entry>Unrecoverable condition detected like disk or memory full</entry>        
+      </row>
+      <row>
+        <entry>0</entry>
+        <entry>NORMAL</entry>
+        <entry>Normal exit with success</entry>        
+      </row>
+      <row>
+        <entry>1</entry>
+        <entry>WARNING</entry>
+        <entry>Some kind of failure at startup/shutdown, typically shown with a reason for this error</entry>        
+      </row>
+      <row>
+        <entry>>1</entry>
+        <entry>UNKNOWN</entry>
+        <entry>Not used under normal operations</entry>        
+      </row>
+      <row>
+        <entry>>128</entry>
+        <entry>SIGNAL</entry>
+        <entry>Virtuoso was killed by a signal it could not process. (error code = signal + 128)</entry>        
+      </row>      
+    </tbody>
+  </tgroup>
+</table>  
+  </sect2>
+  <sect2 id="signalsandexitcodess"><title>Signals</title>
+<table colsep="1" frame="all" rowsep="0" shortentry="0" tocentry="1" tabstyle="decimalstyle" orient="land" pgwide="0">
+    <title>Signals</title>
+    <tgroup align="char" charoff="50" char="." cols="4">
+    <colspec align="left" colnum="1" colsep="0" colwidth="20pc"/>
+    <thead>
+      <row>
+        <entry>Signal</entry>
+        <entry>Name</entry>
+        <entry>Category</entry>
+        <entry>Comment</entry>        
+      </row>
+    </thead>
+    <tbody>
+      <row>
+        <entry>1</entry>
+        <entry>SIGHUP</entry>
+        <entry>NORMAL</entry>        
+        <entry>Initiate quick shutdown when shell exits while running virtuoso in foreground mode</entry>           
+      </row>
+      <row>
+        <entry>2</entry>
+        <entry>SIGINT</entry>
+        <entry>NORMAL</entry>        
+        <entry>User pressed CTRL-C on Virtuoso running in foreground mode to initiate normal shutdown</entry>           
+      </row>
+      <row>
+        <entry>3</entry>
+        <entry>SIGQUIT</entry>
+        <entry>NORMAL</entry>   
+        <entry>User pressed CTRL-\ on Virtuoso running in foreground mode to initiate quick shutdown</entry>                
+      </row>
+      <row>
+        <entry>4</entry>
+        <entry>SIGILL</entry>
+        <entry>FAULT</entry> 
+        <entry>Illegal instruction resulting in a program crash</entry>                  
+      </row>
+      <row>
+        <entry>7</entry>
+        <entry>SIGBUS</entry>
+        <entry>FAULT</entry>      
+        <entry>Misaligned mem read/write resulting in a program crash</entry>             
+      </row>
+      <row>
+        <entry>8</entry>
+        <entry>SIGFPE</entry>
+        <entry>FAULT</entry>   
+        <entry>Divide by 0 or other arithmetical error</entry>                
+      </row>
+      <row>
+        <entry>9</entry>
+        <entry>SIGKILL</entry>
+        <entry>SPECIAL</entry>   
+        <entry>Terminate Virtuoso without flushing dirty pages etc. This signal should NOT be used under normal operations.</entry>                
+      </row>
+      <row>
+        <entry>11</entry>
+        <entry>SIGSEGV</entry>
+        <entry>FAULT</entry>     
+        <entry>Buffer/stack overrun resulting in a program crash</entry>              
+      </row>
+      <row>
+        <entry>13</entry>
+        <entry>SIGPIPE</entry>
+        <entry>IGNORED</entry>   
+        <entry>Other side of a pipe was killed while this side tried to write data to it</entry>                
+      </row>
+      <row>
+        <entry>15</entry>
+        <entry>SIGTERM</entry>
+        <entry>NORMAL</entry>   
+        <entry>Initiate quick shutdown</entry>                
+      </row>                                                      
+    </tbody>
+  </tgroup>
+</table>  
+<para>Signals that are marked as <emphasis>NORMAL</emphasis> indicate that these signals can be 
+sent by root or the owner of the virtuoso process to shutdown Virtuoso. The <emphasis>SIGINT</emphasis> and 
+<emphasis>SIGQUIT</emphasis> signals also work when Virtuoso is running in background mode and can be used 
+in shell scripts.</para>
+<para>Signals that are marked as <emphasis>FAULT</emphasis> indicate an abnormal condition which should be 
+checked. If enabled (e.g. with ulimit -c unlimited), the operating system can write a core dump allowing 
+post-mortem debugging if the Virtuoso executable was compiled with debugging symbols.</para>
+<para>Signals that are marked as <emphasis>IGNORED</emphasis> are handled inside Virtuoso.</para>
+<para>The <emphasis>SIGTERM</emphasis> signal is mostly used by rc.d type shell scripts on Unix/Linux which 
+are called during shutdown, but can also be used inside shell scripts.</para>
+<para>The <emphasis>SIGKILL</emphasis> signal should only be used as a last resort when all other efforts 
+to stop Virtuoso have failed.</para>
+    <sect3 id="signalsandexitcodessquicksh"><title>Quick shutdown</title>
+    <para>In quick shutdown mode, Virtuoso will only flush dirty disk buffers, close transaction log and 
+    	database files and exit to the operating system. Since Virtuoso does not perform a checkpoint, the 
+    	next startup will take extra time as Virtuoso first needs to perform a rollback and a checkpoint 
+    	before it can resume operation. The <emphasis>SIGTERM</emphasis> signal mostly used by rc.d type 
+    	scripts on Unix/Linux which are called during shutdown as such instances it is better to quickly 
+    	finish operations and delay the checkpoint until the next boot.</para>
+    </sect3>    
+    <sect3 id="signalsandexitcodessquicknsh"><title>Normal shutdown</title>
+    <para>In normal shutdown mode, Virtuoso will do first do a full checkpoint, then flush dirty disk 
+    	buffers, close transaction log and database files before exiting to the operating system. Depending 
+    	on the size of the transaction log this can take some time. The <emphasis>SIGINT</emphasis> signal 
+    	can be used in stop scripts to cleanly shutdown the database by the dba or by root.</para>
+    <para>Note that in all cases signals can only be sent by the kernel, the root user or the uid of 
+    	the person who started Virtuoso. Anyone else that wants to shutdown the Virtuoso instance 
+    	should use the isql program to connect to Virtuoso and run the 'shutdown' command.</para>    
+    </sect3>    
+  </sect2>
+</sect1>
+ 
  &relnotes;
  &support;
  &systemtables;
-&migrate27to30;
+ <!--&migrate27to30;-->
 
 <sect1 id="apndxregexp"><title>Basic Syntax of Regular Expressions</title>
 
diff --git a/docsrc/xmlsource/backup.xml b/docsrc/xmlsource/backup.xml
index 662b752..5e589e8 100644
--- a/docsrc/xmlsource/backup.xml
+++ b/docsrc/xmlsource/backup.xml
@@ -103,13 +103,6 @@
   can be used to backup the database in the state effective at the last checkpoint
   to a series of backup files.</para>
 
-  <para><link linkend="fn_backup_online"><function>backup_online
-  <paramdef><parameter>file_prefix</parameter></paramdef>
-  <paramdef><parameter>pages</parameter></paramdef>
-  <paramdef><optional><parameter>timeout</parameter></optional></paramdef>
-  <paramdef><optional><parameter>dirst</parameter></optional></paramdef>
-  </function></link></para>
-
   <para>
 
 The database storage is divided into a checkpoint space that is a read
diff --git a/docsrc/xmlsource/dbconcepts.xml b/docsrc/xmlsource/dbconcepts.xml
index 95a5d25..db647c2 100644
--- a/docsrc/xmlsource/dbconcepts.xml
+++ b/docsrc/xmlsource/dbconcepts.xml
@@ -1048,9 +1048,8 @@ SET PASSWORD <old password> <new password>
 			<title>User Roles</title>
 		<para>
 
-Virtuoso supports a SQL 2K compatible role based security model.  This
-is the Virtuoso 3.0 replacement for the multiple group membership
-feature in Virtuoso 2.7.  A role is a grantee in the same namespace as
+Virtuoso supports a SQL 2K compatible role based security model. 
+A role is a grantee in the same namespace as
 users but is itself not a user account.  Thus one cannot login as a
 role.  A role is a grantable object.  Any role or user may be granted
 an arbitrary number of roles.  The effective privileges of a role or
diff --git a/docsrc/xmlsource/funcref/ld_dir.xml b/docsrc/xmlsource/funcref/ld_dir.xml
new file mode 100644
index 0000000..6b089f5
--- /dev/null
+++ b/docsrc/xmlsource/funcref/ld_dir.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<refentry id="fn_ld_dir">
+  <refmeta>
+    <refentrytitle>ld_dir</refentrytitle>
+    <refmiscinfo>rdf</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>ld_dir</refname>
+    <refpurpose>Adds files to control list set up in the virtuoso.ini file.</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_ld_dir">
+      <funcprototype id="fproto_ld_dir">
+        <funcdef><function>ld_dir</function></funcdef>
+	      <paramdef>in <parameter>dir_path</parameter> varchar</paramdef>
+	      <paramdef>in <parameter>file_mask</parameter> varchar</paramdef>
+	      <paramdef>in <parameter>target_graph</parameter> varchar</paramdef>
+      </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_ld_dir">
+    <title>Description</title>
+    <para>Adds files to control list set up in the virtuoso.ini file.</para>
+  </refsect1>
+  <refsect1 id="params_ld_dir">
+    <title>Parameters</title>
+    <refsect2><title>dir_path</title>
+      <para>path to the folder where the files will be loaded</para>
+    </refsect2>
+    <refsect2><title>file_mask</title>
+      <para>SQL like pattern to match against the files in the directory</para>
+    </refsect2>
+    <refsect2><title>target_graph</title>
+      <para>target graph IRI, parsed triples will appear in that graph.</para>
+    </refsect2>
+  </refsect1>
+  <refsect1 id="ret_ld_dir"><title>Return Types</title>
+    <para>The return value is not specified and may be changed in future versions.</para>
+  </refsect1>
+<!--  <refsect1 id="errors_ld_dir">
+    <title>Errors</title>
+    <para>This function can generate the following errors:</para>
+    <errorcode></errorcode>
+  </refsect1>
+-->
+  <refsect1 id="examples_ld_dir">
+    <title>Examples</title>
+    <example id="ex_ld_dir"><title></title>
+<programlisting><![CDATA[
+ld_dir ('/data8/2848260', '%.gz', 'http://bsbm.org');
+]]></programlisting>    
+      <para>would load the RDF in all files ending in .gz from the directory given as first parameter. 
+        The RDF would be loaded in the http://bsbm.org graph.</para>
+      <para>If NULL is given for the graph, each file may go to a different graph specified in a 
+        separate file with the name of the RDF source file plus the extension .graph.</para>
+      <para>A .graph file contains the target graph URI without any other content or whitespace.</para>
+    </example>
+  </refsect1>
+  <refsect1 id="seealso_ld_dir">
+    <title>See Also</title>
+    <para><link linkend="fn_rdf_audit_metadata"><function>DB.DBA.RDF_AUDIT_METADATA</function></link></para>
+    <para><link linkend="fn_rdf_backup_metadata"><function>DB.DBA.RDF_BACKUP_METADATA</function></link></para>
+    <para><link linkend="fn_rdf_load_rdfxml"><function>DB.DBA.RDF_LOAD_RDFXML</function></link></para>
+    <para><link linkend="fn_rdf_load_rdfxml_mt"><function>DB.DBA.RDF_LOAD_RDFXML_MT</function></link></para>
+    <para><link linkend="fn_ttlp_mt"><function>DB.DBA.TTLP_MT</function></link></para>
+    <para><link linkend="fn_ttlp"><function>DB.DBA.TTLP</function></link></para>
+    <para><link linkend="fn_ttlp_mt_local_file"><function>DB.DBA.TTLP_MT_LOCAL_FILE</function></link></para>
+    <para><link linkend="rdfperfloadingutility">RDF Bulk Load Utility</link></para>
+  </refsect1>
+</refentry>
diff --git a/docsrc/xmlsource/funcref/rdf_backup_metadata.xml b/docsrc/xmlsource/funcref/rdf_backup_metadata.xml
index dd87d4a..8fb6910 100644
--- a/docsrc/xmlsource/funcref/rdf_backup_metadata.xml
+++ b/docsrc/xmlsource/funcref/rdf_backup_metadata.xml
@@ -33,9 +33,9 @@
   <refsynopsisdiv>
     <funcsynopsis id="fsyn_rdf_backup_metadata">
       <funcprototype id="fproto_rdf_backup_metadata">
-        varchar <funcdef><function>DB.DBA.RDF_BACKUP_METADATA</function></funcdef>
-	<optional><paramdef>in <parameter>save_to_file</parameter> integer := 0</paramdef></optional>
-	<optional><paramdef>in <parameter>backup_name</parameter> varchar := null</paramdef></optional>
+        <funcdef><function>DB.DBA.RDF_BACKUP_METADATA</function></funcdef>
+	      <paramdef><optional>in <parameter>save_to_file</parameter> integer := 0</optional></paramdef>
+	      <paramdef><optional>in <parameter>backup_name</parameter> varchar := null</optional></paramdef>
       </funcprototype>
     </funcsynopsis>
   </refsynopsisdiv>
diff --git a/docsrc/xmlsource/funcref/rdf_graph_collect_fp_list.xml b/docsrc/xmlsource/funcref/rdf_graph_collect_fp_list.xml
new file mode 100644
index 0000000..00acd43
--- /dev/null
+++ b/docsrc/xmlsource/funcref/rdf_graph_collect_fp_list.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<refentry id="fn_rdf_graph_collect_fp_list">
+  <refmeta>
+    <refentrytitle>DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</refentrytitle>
+    <refmiscinfo>rdf</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</refname>
+    <refpurpose>Gets inverse / functional properties for given graphs.</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_rdf_graph_collect_fp_list">
+      <funcprototype id="fproto_rdf_graph_collect_fp_list">
+        <funcdef><function>DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</function></funcdef>
+	        <paramdef>in <parameter>g_iid_list</parameter> any</paramdef>
+	        <paramdef>in <parameter>direct_fp</parameter> integer</paramdef>
+	        <paramdef>inout <parameter>fp_list</parameter> any</paramdef>	        
+      </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_rdf_graph_collect_fp_list">
+    <title>Description</title>
+    <para>Gets inverse / functional properties for given graphs. The procedure will fetch all 
+    	triples of all specified graphs during the run, so it will take some time if graphs are 
+    	big and/or numerous.</para>
+  </refsect1>
+  <refsect1 id="params_rdf_graph_collect_fp_list">
+    <title>Parameters</title>
+    <refsect2><title>g_iid_list</title>
+      <para>Vector of IRI_IDs of sample graphs</para>
+    </refsect2>
+    <refsect2><title>direct_fp</title>
+      <para>When zero gets list of inverse functional properties; non-zero gets functional properties.</para>
+    </refsect2>
+    <refsect2><title>fp_list</title>
+      <para>Variable that will be set to the vector of properties.</para>
+    </refsect2>    
+  </refsect1>
+  <refsect1 id="ret_rdf_graph_collect_fp_list"><title>Return Types</title>
+    <para>any</para>
+  </refsect1>
+
+  <!--refsect1 id="examples_rdf_graph_collect_fp_list">
+    <title>Examples</title>
+    <example id="ex_rdf_graph_collect_fp_list"><title></title>
+      <para></para>
+<programlisting><![CDATA[
+]]></programlisting>
+    </example>
+  </refsect1-->
+  <refsect1 id="seealso_rdf_graph_collect_fp_list">
+    <title>See Also</title>
+    <para><link linkend="fastapproxdiffandpatch">Fast Approximate RDF Graph Diff and Patch</link></para>             
+    <para><link linkend="fn_rdf_graph_diff">DB.DBA.RDF_GRAPH_DIFF</link></para>
+    <para><link linkend="fn_rdf_suo_diff_ttl">DB.DBA.RDF_SUO_DIFF_TTL</link></para>
+    <para><link linkend="fn_rdf_suo_apply_patch">DB.DBA.RDF_SUO_APPLY_PATCH</link></para>
+  </refsect1>
+</refentry>
diff --git a/docsrc/xmlsource/funcref/rdf_graph_diff.xml b/docsrc/xmlsource/funcref/rdf_graph_diff.xml
new file mode 100644
index 0000000..f4bb4ce
--- /dev/null
+++ b/docsrc/xmlsource/funcref/rdf_graph_diff.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<refentry id="fn_rdf_graph_diff">
+  <refmeta>
+    <refentrytitle>DB.DBA.RDF_GRAPH_DIFF</refentrytitle>
+    <refmiscinfo>rdf</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>DB.DBA.RDF_GRAPH_DIFF</refname>
+    <refpurpose>performs the core operation of preparing graph diff.</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_rdf_graph_diff">
+      <funcprototype id="fproto_rdf_graph_diff">
+        <funcdef><function>DB.DBA.RDF_GRAPH_DIFF</function></funcdef>
+	        <paramdef>in <parameter>gfrom</parameter> IRI_ID</paramdef>
+	        <paramdef>in <parameter>gto</parameter> IRI_ID</paramdef>
+	        <paramdef>in <parameter>only_gfrom</parameter> any</paramdef>
+	        <paramdef>in <parameter>only_gto</parameter> any</paramdef>
+	        <paramdef>in <parameter>accuracy </parameter> integer</paramdef>
+	        <paramdef>inout <parameter>fp_list</parameter> any</paramdef>
+	        <paramdef>inout <parameter>invfp_list</parameter> any</paramdef>
+	        <paramdef>inout <parameter>gfrom_rules</parameter> any</paramdef>	        	        	        	        	        
+	        <paramdef>inout <parameter>gto_rules</parameter> any</paramdef>
+          <paramdef><optional>in <parameter>equiv_map</parameter> any := null</optional></paramdef>
+          <paramdef><optional>in <parameter>equiv_rev</parameter> any := null</optional></paramdef>  
+      </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_rdf_graph_diff">
+    <title>Description</title>
+    <para>Performs the core operation of preparing graph diff - matching between nodes of two graphs.</para>
+    <para>Typically is called from wrapper that returns the diff in an extended GUO ontology 
+(http://webr3.org/owl/guo#) as a string output in TURTLE syntax.</para>
+  </refsect1>
+  <refsect1 id="params_rdf_graph_diff">
+    <title>Parameters</title>
+    <refsect2><title>gfrom</title>
+      <para>IRI ID of the from graph</para>
+    </refsect2>
+    <refsect2><title>gto</title>
+      <para>IRI ID of the destination graph</para>
+    </refsect2>
+    <refsect2><title>only_gfrom</title>
+      <para>Dictionaries of triples that present only in gfrom (but have no matches in gto)</para>
+    </refsect2>
+    <refsect2><title>only_gto</title>
+      <para>Dictionaries of triples that present only in gto (but have no matches in gfrom)</para>
+    </refsect2>
+    <refsect2><title>accuracy</title>
+      <para>Tells the procedure what should be done if one or both graphs contain blank nodes. If zero then 
+      	different bnodes are treated as distinct. Bnodes are allocated individually for each data load, so 
+      	even if one and the same resource is loaded in two different graphs then these graphs will contain 
+      	no blank nodes in common, accuracy=0 would result in the diff containing all triples from both 
+      	graphs that have bnode subject o object. If nonzero then the procedure will try to match blank 
+      	nodes, zipper style. In this case rest of arguments comes to play.</para>
+    </refsect2>
+    <refsect2><title>fp_list</title>
+      <para>Vector of IRI_IDs of predicates that are supposed to be functional properties, i.e., any 
+      	given subject has no more than one value of a given predicate.</para>
+    </refsect2>
+    <refsect2><title>invfp_list</title>
+      <para>Vector of IRI_IDs of (supposedly) inverse functional properties, i.e., any given object 
+      	could be the value of a given predicate for no more than one subject. The best source of such 
+      	vectors is a good ontology suitable for both graphs. Types owl:functionalProperty and 
+      	owl:inverseFunctionalProperty will provide truly "meaningful" lists of predicates that 
+      	will provide really "meaningful" patch. Meaningful patches have three important advantages:</para>
+<itemizedlist mark="bullet">
+  <listitem>they're as compact as possible; </listitem>
+  <listitem>human readers undestand them better;</listitem>
+  <listitem>when a diff is applied to a graph that differs from gfrom then either the result is 
+  	accurate and satisfies the ontology or the patch procedure reports meaningful conflicts. If 
+  	the ontology is not specified then <link linkend="fn_rdf_graph_collect_fp_list">DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</link>
+  	can be used to build these list on some representative collection of similar graphs. That's 
+  	"better than nothing", but the quality of the resulting diffs may be worse if some predicates 
+  	only occasionally have one object per subject or one subject per object in sample graps or if 
+  	some functional/inverse functional predicates are not used in sample graphs but appear in 
+  	graphs to diff. Remember, diff on graphs with blank nodes is based on heuristics, it's better 
+  	to run it on sound data, not on results of other heuristics.</listitem>  
+</itemizedlist>      
+    </refsect2>
+    <refsect2><title>fp_list</title>
+      <para>If NULL but accuracy is not zero then the function will call 
+      	<link linkend="fn_rdf_graph_collect_fp_list">DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</link> internally, using graphs gfrom and gto as specimens.</para>
+    </refsect2>
+    <refsect2><title>invfp_list</title>
+      <para>If NULL but accuracy is not zero then the function will call 
+      	<link linkend="fn_rdf_graph_collect_fp_list">DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</link> internally, using graphs gfrom and gto as specimens.</para>
+    </refsect2>
+    <refsect2><title>gfrom_rules</title>
+      <para>Describes how bnodes of graphs were matched, i.e., how sliders were moved along 
+      	chains of predicates.</para>
+    </refsect2>
+    <refsect2><title>gto_rules</title>
+      <para>Describes how bnodes of graphs were matched, i.e., how sliders were moved along chains of predicates.</para>
+      <para>Every event during matching of bnodes produces a rule that should be followed when the patch will scan its input graph for bnodes to edit.</para>      
+    </refsect2>
+    <refsect2><title>equiv_map</title>
+      <para>Dictionary that describe the match between bnodes in gfrom and gto. In equiv_map, bnodes from gfrom are keys and matching bnodes from gto are values.</para>
+    </refsect2>
+    <refsect2><title>equiv_rev</title>
+      <para>Dictionary that describes the match between bnodes in gfrom and gto. In equiv_rev, same 
+      	pairs are in different roles, bnodes from gfrom are values for matching bnodes from gto that 
+      	are now keys. These data can be incomplete or NULL at all, but if provided then 
+      	the function will trust them blindly.</para>
+    </refsect2>
+  </refsect1>
+  <refsect1 id="ret_rdf_graph_diff"><title>Return Types</title>
+    <para>any</para>
+  </refsect1>
+
+  <!--refsect1 id="examples_rdf_graph_diff">
+    <title>Examples</title>
+    <example id="ex_rdf_graph_diff"><title></title>
+      <para></para>
+<programlisting><![CDATA[
+]]></programlisting>
+    </example>
+  </refsect1-->
+  <refsect1 id="seealso_rdf_graph_diff">
+    <title>See Also</title>
+    <para><link linkend="fastapproxdiffandpatch">Fast Approximate RDF Graph Diff and Patch</link></para>             
+    <para><link linkend="fn_rdf_suo_diff_ttl">DB.DBA.RDF_SUO_DIFF_TTL</link></para>
+    <para><link linkend="fn_rdf_suo_apply_patch">DB.DBA.RDF_SUO_APPLY_PATCH</link></para>
+    <para><link linkend="fn_rdf_graph_collect_fp_list">DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</link></para>            
+  </refsect1>
+</refentry>
diff --git a/docsrc/xmlsource/funcref/rdf_load_rdfa.xml b/docsrc/xmlsource/funcref/rdf_load_rdfa.xml
new file mode 100644
index 0000000..7e7a7a8
--- /dev/null
+++ b/docsrc/xmlsource/funcref/rdf_load_rdfa.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+  project.
+
+  Copyright (C) 1998-2006 OpenLink Software
+
+  This project is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by the
+  Free Software Foundation; only version 2 of the License, dated June 1991.
+
+  This program is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License along
+  with this program; if not, write to the Free Software Foundation, Inc.,
+  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+  : template.sh,v 1.5 2006/04/18 21:59:13 ivan Exp $
+-->
+<refentry id="fn_rdf_load_rdfa">
+  <refmeta>
+    <refentrytitle>DB.DBA.RDF_LOAD_RDFA</refentrytitle>
+    <refmiscinfo>rdf</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>DB.DBA.RDF_LOAD_RDFA</refname>
+    <refpurpose>Parses the content of RDF embedded as RDFa text as a sequence of separate RDF triples.</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_rdf_load_rdfa">
+      <funcprototype id="fproto_rdf_load_rdfa">
+        <funcdef><function>DB.DBA.RDF_LOAD_RDFA</function></funcdef>
+	<paramdef>in <parameter>rdfa_text</parameter> varchar</paramdef>
+	<paramdef>in <parameter>omt_top_rdf</parameter> varchar</paramdef>
+	<paramdef>in <parameter>graph_uri</parameter> varchar</paramdef>
+      </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_rdf_load_rdfa">
+    <title>Description</title>
+    <para>Parses the content of RDF embedded as RDFa text as a sequence of separate RDF triples.</para>
+  </refsect1>
+  <refsect1 id="params_rdf_load_rdfa">
+    <title>Parameters</title>
+    <refsect2><title>rdfa_text</title>
+      <para>text of document containing RDFa data</para>
+    </refsect2>
+    <refsect2><title>omt_top_rdf</title>
+      <para>base IRI to resolve relative IRIs</para>
+    </refsect2>
+    <refsect2><title>graph_uri</title>
+      <para>the IRI of destination graph</para>
+    </refsect2>
+  </refsect1>
+  <refsect1 id="ret_rdf_load_rdfa"><title>Return Types</title>
+    <para>The return value is not specified and may be changed in future versions.</para>
+  </refsect1>
+  <refsect1 id="examples_rdf_load_rdfa">
+    <title>Examples</title>
+    <example id="ex_rdf_load_rdfa"><title></title>
+      <para>Load from local file:</para>
+      <screen><![CDATA[
+SQL>sparql drop graph <http://virtuoso.openlinksw.com/example>;
+Done. -- 2 msec.
+SQL>DB.DBA.RDF_LOAD_RDFA (file_to_string ('pricing.html'), 'http://virtuoso.openlinksw.com/pricing/#', 'http://virtuoso.openlinksw.com/example');
+Done. -- 106 msec.
+]]>
+</screen>
+    <para>Load from URI:</para> 
+<screen><![CDATA[
+SQL> DB.DBA.RDF_LOAD_RDFA (http_get('http://virtuoso.openlinksw.com/pricing/'), 'http://virtuoso.openlinksw.com/pricing/#', 'http://virtuoso.openlinksw.com/example');
+Done. -- 109 msec.
+
+-- Check total triples retrieved: 
+SQL>SPARQL 
+SELECT COUNT(*)  
+from <http://virtuoso.openlinksw.com/example>
+WHERE {?s ?p ?o};
+callret-0
+INTEGER
+_______________________________________________________________________________
+
+1181
+
+1 Rows. -- 16 msec.
+]]>
+</screen>          	
+    </example>
+  </refsect1>
+  <refsect1 id="seealso_rdf_load_rdfa">
+    <title>See Also</title>
+    <para><link linkend="fn_rdf_load_rdfxml"><function>DB.DBA.RDF_LOAD_RDFXML</function></link></para>
+    <para><link linkend="fn_rdf_audit_metadata"><function>DB.DBA.RDF_AUDIT_METADATA</function></link></para>
+    <para><link linkend="fn_rdf_backup_metadata"><function>DB.DBA.RDF_BACKUP_METADATA</function></link></para>
+    <para><link linkend="fn_rdf_load_rdfa_mt"><function>DB.DBA.RDF_LOAD_RDFA_MT</function></link></para>
+    <para><link linkend="fn_ttlp"><function>DB.DBA.TTLP</function></link></para>
+    <para><link linkend="fn_ttlp_nt"><function>DB.DBA.TTLP_MT</function></link></para>
+  </refsect1>
+</refentry>
diff --git a/docsrc/xmlsource/funcref/rdf_load_rdfxml.xml b/docsrc/xmlsource/funcref/rdf_load_rdfxml.xml
index 4e1f49e..9226b65 100644
--- a/docsrc/xmlsource/funcref/rdf_load_rdfxml.xml
+++ b/docsrc/xmlsource/funcref/rdf_load_rdfxml.xml
@@ -52,7 +52,7 @@
   <refsect1 id="params_rdf_load_rdfxml">
     <title>Parameters</title>
     <refsect2><title>rdfxml_text</title>
-      <para>text of and XML document</para>
+      <para>text of XML document</para>
     </refsect2>
     <refsect2><title>omt_top_rdf</title>
       <para>base IRI to resolve relative IRIs</para>
@@ -73,12 +73,34 @@
   <refsect1 id="examples_rdf_load_rdfxml">
     <title>Examples</title>
     <example id="ex_rdf_load_rdfxml"><title></title>
-      <para></para>
+      <para>Load from local file:</para>
       <screen><![CDATA[
-sparql drop graph <http://www.biopax.org/prototype#sample-closure>;
-DB.DBA.RDF_LOAD_RDFXML (file_to_string ('MatInf-for-Alan/Reactome_109581.owl'), '', 'http://www.biopax.org/prototype#sample');
+SQL>sparql drop graph <http://www.biopax.org/prototype#sample-closure>;
+Done. -- 2 msec.
+SQL>DB.DBA.RDF_LOAD_RDFXML (file_to_string ('MatInf-for-Alan/Reactome_109581.owl'), '', 'http://www.biopax.org/prototype#sample');
+Done. -- 106 msec.
 ]]>
 </screen>
+    <para>Load from URI:</para> 
+<screen><![CDATA[
+SQL> DB.DBA.RDF_LOAD_RDFXML (http_get('http://lod.taxonconcept.org/ontology/txn.owl'), '', 'http://lod.taxonconcept.org/ontology/txn.owl#');
+Done. -- 109 msec.
+
+-- Check total triples retrieved: 
+SQL>SPARQL 
+SELECT COUNT(*)  
+from <http://lod.taxonconcept.org/ontology/txn.owl#>
+WHERE {?s ?p ?o};
+callret-0
+INTEGER
+_______________________________________________________________________________
+
+495
+
+1 Rows. -- 16 msec.
+]]>
+</screen>          	
+
     </example>
   </refsect1>
   <refsect1 id="seealso_rdf_load_rdfxml">
diff --git a/docsrc/xmlsource/funcref/rdf_repl_graph_del.xml b/docsrc/xmlsource/funcref/rdf_repl_graph_del.xml
new file mode 100644
index 0000000..15111d6
--- /dev/null
+++ b/docsrc/xmlsource/funcref/rdf_repl_graph_del.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+ -
+-->
+<refentry id="fn_rdf_repl_graph_del">
+  <refmeta>
+    <refentrytitle>RDF_REPL_GRAPH_DEL</refentrytitle>
+    <refmiscinfo>repl</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>RDF_REPL_GRAPH_DEL</refname>
+    <refpurpose>Deletes graph from RDF publication.</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_rdf_repl_graph_del">
+      <funcprototype id="fproto_rdf_repl_graph_del">
+        <funcdef><function>RDF_REPL_GRAPH_DEL</function></funcdef>
+        <paramdef>in <parameter>graph</parameter> varchar</paramdef>
+      </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_rdf_repl_graph_del"><title>Description</title>
+			<para>
+This function deletes graph from RDF Replication.</para>
+
+	</refsect1>
+  <refsect1 id="params_rdf_repl_graph_del"><title>Parameters</title>
+    <refsect2><title>graph</title>
+      <para>Graph URI to be deleted.</para>
+    </refsect2>
+  </refsect1>
+  <refsect1 id="examples_rdf_repl_graph_del"><title>Example</title>
+    <example id="ex_rdf_repl_graph_del"><title>Delete graph from RDF replication</title>
+      <screen>
+SQL> DB.DBA.RDF_RDF_REPL_GRAPH_DEL ('http://test.org');
+      </screen>
+    </example>
+  </refsect1>
+  <refsect1 id="seealso_rdf_repl_graph_del"><title>See Also</title>
+     <para><link linkend="fn_rdf_repl_start"><function>RDF_REPL_START()</function></link></para>  
+     <para><link linkend="fn_rdf_repl_graph_ins"><function>RDF_REPL_GRAPH_INS()</function></link></para>  
+     <para><link linkend="fn_sub_schedule"><function>sub_schedule()</function></link></para>
+     <para><link linkend="fn_repl_disconnect"><function>repl_disconnect()</function></link></para>
+     <para><link linkend="fn_repl_grant"><function>repl_grant()</function></link></para>
+     <para><link linkend="fn_repl_new_log"><function>repl_new_log()</function></link></para>
+     <para><link linkend="fn_repl_pub_add"><function>repl_pub_add()</function></link></para>
+     <para><link linkend="fn_repl_pub_init_image"><function>repl_pub_init_image()</function></link></para>
+     <para><link linkend="fn_repl_pub_remove"><function>repl_pub_remove()</function></link></para>
+     <para><link linkend="fn_repl_publish"><function>repl_publish()</function></link></para>
+     <para><link linkend="fn_repl_revoke"><function>repl_revoke()</function></link></para>
+     <para><link linkend="fn_repl_sched_init"><function>repl_sched_init()</function></link></para>
+     <para><link linkend="fn_repl_server"><function>repl_server()</function></link></para>
+     <para><link linkend="fn_repl_server_rename"><function>repl_server_rename()</function></link></para>
+     <para><link linkend="fn_repl_stat"><function>repl_stat()</function></link></para>
+     <para><link linkend="fn_repl_status"><function>repl_status()</function></link></para>
+     <para><link linkend="fn_repl_subscribe"><function>repl_subscribe()</function></link></para>
+     <para><link linkend="fn_repl_sync"><function>repl_sync()</function></link></para>
+     <para><link linkend="fn_repl_sync_all"><function>repl_sync_all()</function></link></para>
+     <para><link linkend="fn_repl_text"><function>repl_text()</function></link></para>
+     <para><link linkend="fn_repl_this_server"><function>repl_this_server()</function></link></para>
+     <para><link linkend="fn_repl_unpublish"><function>repl_unpublish()</function></link></para>
+     <para><link linkend="fn_repl_unsubscribe"><function>repl_unsubscribe()</function></link></para>
+  </refsect1>
+</refentry>
+
+
diff --git a/docsrc/xmlsource/funcref/rdf_repl_graph_ins.xml b/docsrc/xmlsource/funcref/rdf_repl_graph_ins.xml
new file mode 100644
index 0000000..7157ec6
--- /dev/null
+++ b/docsrc/xmlsource/funcref/rdf_repl_graph_ins.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+ -
+-->
+<refentry id="fn_rdf_repl_graph_ins">
+  <refmeta>
+    <refentrytitle>RDF_REPL_GRAPH_INS</refentrytitle>
+    <refmiscinfo>repl</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>RDF_REPL_GRAPH_INS</refname>
+    <refpurpose>Inserts graph to RDF publication.</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_rdf_repl_graph_ins">
+      <funcprototype id="fproto_rdf_repl_graph_ins">
+        <funcdef><function>RDF_REPL_GRAPH_INS</function></funcdef>
+        <paramdef>in <parameter>graph</parameter> varchar</paramdef>
+      </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_rdf_repl_graph_ins"><title>Description</title>
+			<para>
+This function inserts graph to enabled RDF Replication. The graphs in this replication can be 
+more than one.
+</para>
+
+	</refsect1>
+  <refsect1 id="params_rdf_repl_graph_ins"><title>Parameters</title>
+    <refsect2><title>graph</title>
+      <para>Graph URI to be inserted.</para>
+    </refsect2>
+  </refsect1>
+  <refsect1 id="examples_rdf_repl_graph_ins"><title>Example</title>
+    <example id="ex_rdf_repl_graph_ins"><title>Insert graph to RDF replication</title>
+      <screen>
+SQL> DB.DBA.RDF_RDF_REPL_GRAPH_INS ('http://test.org');
+      </screen>
+    </example>
+  </refsect1>
+  <refsect1 id="seealso_rdf_repl_graph_ins"><title>See Also</title>
+     <para><link linkend="fn_rdf_repl_start"><function>RDF_REPL_START()</function></link></para>  
+     <para><link linkend="fn_rdf_repl_graph_del"><function>RDF_RDF_REPL_GRAPH_DEL()</function></link></para>            
+     <para><link linkend="fn_sub_schedule"><function>sub_schedule()</function></link></para>
+     <para><link linkend="fn_repl_disconnect"><function>repl_disconnect()</function></link></para>
+     <para><link linkend="fn_repl_grant"><function>repl_grant()</function></link></para>
+     <para><link linkend="fn_repl_new_log"><function>repl_new_log()</function></link></para>
+     <para><link linkend="fn_repl_pub_add"><function>repl_pub_add()</function></link></para>
+     <para><link linkend="fn_repl_pub_init_image"><function>repl_pub_init_image()</function></link></para>
+     <para><link linkend="fn_repl_pub_remove"><function>repl_pub_remove()</function></link></para>
+     <para><link linkend="fn_repl_publish"><function>repl_publish()</function></link></para>
+     <para><link linkend="fn_repl_revoke"><function>repl_revoke()</function></link></para>
+     <para><link linkend="fn_repl_sched_init"><function>repl_sched_init()</function></link></para>
+     <para><link linkend="fn_repl_server"><function>repl_server()</function></link></para>
+     <para><link linkend="fn_repl_server_rename"><function>repl_server_rename()</function></link></para>
+     <para><link linkend="fn_repl_stat"><function>repl_stat()</function></link></para>
+     <para><link linkend="fn_repl_status"><function>repl_status()</function></link></para>
+     <para><link linkend="fn_repl_subscribe"><function>repl_subscribe()</function></link></para>
+     <para><link linkend="fn_repl_sync"><function>repl_sync()</function></link></para>
+     <para><link linkend="fn_repl_sync_all"><function>repl_sync_all()</function></link></para>
+     <para><link linkend="fn_repl_text"><function>repl_text()</function></link></para>
+     <para><link linkend="fn_repl_this_server"><function>repl_this_server()</function></link></para>
+     <para><link linkend="fn_repl_unpublish"><function>repl_unpublish()</function></link></para>
+     <para><link linkend="fn_repl_unsubscribe"><function>repl_unsubscribe()</function></link></para>
+  </refsect1>
+</refentry>
+
+
diff --git a/docsrc/xmlsource/funcref/rdf_repl_start.xml b/docsrc/xmlsource/funcref/rdf_repl_start.xml
new file mode 100644
index 0000000..a87da15
--- /dev/null
+++ b/docsrc/xmlsource/funcref/rdf_repl_start.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+ -
+-->
+<refentry id="fn_rdf_repl_start">
+  <refmeta>
+    <refentrytitle>RDF_REPL_START</refentrytitle>
+    <refmiscinfo>repl</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>RDF_REPL_START</refname>
+    <refpurpose>Enables RDF Replication.</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_rdf_repl_start">
+      <funcprototype id="fproto_rdf_repl_start">
+        <funcdef><function>RDF_REPL_START</function></funcdef>
+        <paramdef />
+      </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_rdf_repl_start"><title>Description</title>
+			<para>
+This function is called to enable (start) RDF Publication.
+</para>
+
+	</refsect1>
+  <refsect1 id="examples_rdf_repl_start"><title>Example</title>
+    <example id="ex_rdf_repl_start"><title>Enable RDF Publication</title>
+      <screen>
+SQL> DB.DBA.RDF_REPL_START();
+      </screen>
+    </example>
+  </refsect1>
+  <refsect1 id="seealso_rdf_repl_start"><title>See Also</title>
+
+     <para><link linkend="fn_rdf_repl_graph_ins"><function>RDF_REPL_GRAPH_INS()</function></link></para>  
+     <para><link linkend="fn_rdf_repl_graph_del"><function>RDF_RDF_REPL_GRAPH_DEL()</function></link></para>            
+     <para><link linkend="fn_sub_schedule"><function>sub_schedule()</function></link></para>
+     <para><link linkend="fn_repl_disconnect"><function>repl_disconnect()</function></link></para>
+     <para><link linkend="fn_repl_grant"><function>repl_grant()</function></link></para>
+     <para><link linkend="fn_repl_new_log"><function>repl_new_log()</function></link></para>
+     <para><link linkend="fn_repl_pub_add"><function>repl_pub_add()</function></link></para>
+     <para><link linkend="fn_repl_pub_init_image"><function>repl_pub_init_image()</function></link></para>
+     <para><link linkend="fn_repl_pub_remove"><function>repl_pub_remove()</function></link></para>
+     <para><link linkend="fn_repl_publish"><function>repl_publish()</function></link></para>
+     <para><link linkend="fn_repl_revoke"><function>repl_revoke()</function></link></para>
+     <para><link linkend="fn_repl_sched_init"><function>repl_sched_init()</function></link></para>
+     <para><link linkend="fn_repl_server"><function>repl_server()</function></link></para>
+     <para><link linkend="fn_repl_server_rename"><function>repl_server_rename()</function></link></para>
+     <para><link linkend="fn_repl_stat"><function>repl_stat()</function></link></para>
+     <para><link linkend="fn_repl_status"><function>repl_status()</function></link></para>
+     <para><link linkend="fn_repl_subscribe"><function>repl_subscribe()</function></link></para>
+     <para><link linkend="fn_repl_sync"><function>repl_sync()</function></link></para>
+     <para><link linkend="fn_repl_sync_all"><function>repl_sync_all()</function></link></para>
+     <para><link linkend="fn_repl_text"><function>repl_text()</function></link></para>
+     <para><link linkend="fn_repl_this_server"><function>repl_this_server()</function></link></para>
+     <para><link linkend="fn_repl_unpublish"><function>repl_unpublish()</function></link></para>
+     <para><link linkend="fn_repl_unsubscribe"><function>repl_unsubscribe()</function></link></para>
+  </refsect1>
+</refentry>
+
+
diff --git a/docsrc/xmlsource/funcref/rdf_suo_apply_patch.xml b/docsrc/xmlsource/funcref/rdf_suo_apply_patch.xml
new file mode 100644
index 0000000..3d5e60c
--- /dev/null
+++ b/docsrc/xmlsource/funcref/rdf_suo_apply_patch.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<refentry id="fn_rdf_suo_apply_patch">
+  <refmeta>
+    <refentrytitle>DB.DBA.RDF_SUO_APPLY_PATCH</refentrytitle>
+    <refmiscinfo>rdf</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>DB.DBA.RDF_SUO_APPLY_PATCH</refname>
+    <refpurpose>Modifies either the target graph specified in the patch via 
+    	<code>guo:target_graph</code> or the graph specified by default_target_graph argument.</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_rdf_suo_apply_patch">
+      <funcprototype id="fproto_rdf_suo_apply_patch">
+        <funcdef><function>DB.DBA.RDF_SUO_APPLY_PATCH</function></funcdef>
+	        <paramdef>in <parameter>patch_graph</parameter> IRI_ID</paramdef>
+	        <paramdef>in <parameter>default_target_graph</parameter> IRI_ID</paramdef>
+      </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_rdf_suo_apply_patch">
+    <title>Description</title>
+    <para>This function tries to modify either the target graph specified in the patch via 
+    	<code>guo:target_graph</code> (hence, the non-NULL target_graph argument of the diff creator, 
+    	<link linkend="fn_rdf_suo_diff_ttl">DB.DBA.RDF_SUO_DIFF_TTL()</link> ) or the graph specified by 
+    	default_target_graph argument. The function returns zero in case of success, non-zero value 
+    	otherwise. In addition, the function produces a result set that describes the process of 
+    	matching blank node in the target graph to instructions in the patch.</para>
+    <para>The TURTLE made by <link linkend="fn_rdf_graph_diff">DB.DBA.RDF_GRAPH_DIFF</link> can be 
+      loaded later into an empty graph and the IRI_ID of that graph can be passed as the first 
+      argument to this patch function.</para>
+  </refsect1>
+  <refsect1 id="params_rdf_suo_apply_patch">
+    <title>Parameters</title>
+    <refsect2><title>patch_graph</title>
+      <para>IRI ID of the patch graph</para>
+    </refsect2>
+    <refsect2><title>default_target_graph</title>
+      <para>IRI ID of the default target graph</para>
+    </refsect2>
+  </refsect1>
+  <refsect1 id="ret_rdf_suo_apply_patch"><title>Return Types</title>
+    <para>integer</para>
+  </refsect1>
+
+  <!--refsect1 id="examples_rdf_suo_apply_patch">
+    <title>Examples</title>
+    <example id="ex_rdf_suo_apply_patch"><title></title>
+      <para></para>
+<programlisting><![CDATA[
+]]></programlisting>
+    </example>
+  </refsect1-->
+  <refsect1 id="seealso_rdf_suo_apply_patch">
+    <title>See Also</title>
+    <para><link linkend="fastapproxdiffandpatch">Fast Approximate RDF Graph Diff and Patch</link></para>             
+    <para><link linkend="fn_rdf_graph_diff">DB.DBA.RDF_GRAPH_DIFF</link></para>
+    <para><link linkend="fn_rdf_suo_diff_ttl">DB.DBA.RDF_SUO_DIFF_TTL</link></para>
+    <para><link linkend="fn_rdf_graph_collect_fp_list">DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</link></para>            
+  </refsect1>
+</refentry>
diff --git a/docsrc/xmlsource/funcref/rdf_suo_diff_ttl.xml b/docsrc/xmlsource/funcref/rdf_suo_diff_ttl.xml
new file mode 100644
index 0000000..e49298a
--- /dev/null
+++ b/docsrc/xmlsource/funcref/rdf_suo_diff_ttl.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<refentry id="fn_rdf_suo_diff_ttl">
+  <refmeta>
+    <refentrytitle>DB.DBA.RDF_SUO_DIFF_TTL</refentrytitle>
+    <refmiscinfo>rdf</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>DB.DBA.RDF_SUO_DIFF_TTL</refname>
+    <refpurpose>performs the core operation of preparing graph diff.</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_rdf_suo_diff_ttl">
+      <funcprototype id="fproto_rdf_suo_diff_ttl">
+        <funcdef><function>DB.DBA.RDF_SUO_DIFF_TTL</function></funcdef>
+	        <paramdef>in <parameter>gfrom</parameter> any</paramdef>
+	        <paramdef>in <parameter>gto</parameter> any</paramdef>
+	        <paramdef>in <parameter>target_graph</parameter> any</paramdef>
+	        <paramdef>in <parameter>accuracy </parameter> integer</paramdef>
+	        <paramdef>inout <parameter>fp_list</parameter> any</paramdef>
+	        <paramdef>inout <parameter>invfp_list</parameter> any</paramdef>
+          <paramdef><optional>in <parameter>equiv_map</parameter> any := null</optional></paramdef>
+          <paramdef><optional>in <parameter>equiv_rev</parameter> any := null</optional></paramdef>       
+      </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_rdf_suo_diff_ttl">
+    <title>Description</title>
+    <para>Performs the core operation of preparing graph diff - matching between nodes of two graphs.</para>
+    <para>Typically is called from wrapper that returns the diff in an extended GUO ontology 
+(http://webr3.org/owl/guo#) as a string output in TURTLE syntax.</para>
+  </refsect1>
+  <refsect1 id="params_rdf_suo_diff_ttl">
+    <title>Parameters</title>
+    <refsect2><title>gfrom</title>
+      <para>varchar or UNAME or IRI_ID of the from graph</para>
+    </refsect2>
+    <refsect2><title>gto</title>
+      <para>varchar or UNAME or IRI_ID of the destination graph</para>
+    </refsect2>
+    <refsect2><title>accuracy</title>
+      <para>Tells the procedure what should be done if one or both graphs contain blank nodes. If zero then 
+      	different bnodes are treated as distinct. Bnodes are allocated individually for each data load, so 
+      	even if one and the same resource is loaded in two different graphs then these graphs will contain 
+      	no blank nodes in common, accuracy=0 would result in the diff containing all triples from both 
+      	graphs that have bnode subject o object. If nonzero then the procedure will try to match blank 
+      	nodes, zipper style. In this case rest of arguments comes to play.</para>
+    </refsect2>
+    <refsect2><title>target_graph</title>
+      <para>It is used in to the output TURTLE as value of <code>guo:target_graph</code> property of 
+      every <code>guo:UpdateInstruction</code> node, NULL value means no this property at all. 
+      If the patch procedure will not get the IRI of the graph to patch as an argument then the value of 
+      this property will be used.</para>
+    </refsect2>
+    <refsect2><title>fp_list</title>
+      <para>Vector of IRI_IDs of predicates that are supposed to be functional properties, i.e. any 
+      	given subject has no more than one value of a given predicate.</para>
+    </refsect2>
+    <refsect2><title>invfp_list</title>
+      <para>Vector of IRI_IDs of (supposedly) inverse functional properties, i.e., any given object 
+      	could be the value of a given predicate for no more than one subject. The best source of such 
+      	vectors is a good ontology suitable for both graphs. Types owl:functionalProperty and 
+      	owl:inverseFunctionalProperty will provide truly "meaningful" lists of predicates that 
+      	will provide really "meaningful" patch. Meaningful patches have three important advantages:</para>
+<itemizedlist mark="bullet">
+  <listitem>they''re as compact as possible; </listitem>
+  <listitem>human readers undestand them better;</listitem>
+  <listitem>when a diff is applied to a graph that differs from gfrom then either the result is 
+  	accurate and satisfies the ontology or the patch procedure reports meaningful conflicts. If 
+  	the ontology is not specified then 
+  	<link linkend="fn_rdf_graph_collect_fp_list">DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</link>
+  	can be used to build these list on some representative collection of similar graphs. That''s 
+  	"better than nothing", but the quality of the resulting diffs may be worse if some predicates 
+  	only occasionally have one object per subject or one subject per object in sample graphs or if 
+  	some functional/inverse functional predicates are not used in sample graphs but appear in 
+  	graphs to diff. Remember, diff on graphs with blank nodes is based on heuristics, it''s better 
+  	to run it on sound data, not on results of other heuristics.</listitem>  
+</itemizedlist>      
+    </refsect2>
+    <refsect2><title>fp_list</title>
+      <para>If NULL but accuracy is not zero then the function will call 
+      	<link linkend="fn_rdf_graph_collect_fp_list">DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</link> internally, using graphs gfrom and gto as specimens.</para>
+    </refsect2>
+    <refsect2><title>invfp_list</title>
+      <para>If NULL but accuracy is not zero then the function will call 
+      	<link linkend="fn_rdf_graph_collect_fp_list">DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</link> internally, using graphs gfrom and gto as specimens.</para>
+    </refsect2>
+    <refsect2><title>gfrom_rules</title>
+      <para>Describes how bnodes of graphs were matched, i.e., how sliders were moved along 
+      	chains of predicates.</para>
+    </refsect2>
+    <refsect2><title>gto_rules</title>
+      <para>Describes how bnodes of graphs were matched, i.e., how sliders were moved along chains of predicates.</para>
+      <para>Every event during matching of bnodes produces a rule that should be followed when the patch will scan its input graph for bnodes to edit.</para>      
+    </refsect2>
+    <refsect2><title>equiv_map</title>
+      <para>Dictionary that describe the match between bnodes in gfrom and gto. In equiv_map, bnodes from gfrom are keys and matching bnodes from gto are values.</para>
+    </refsect2>
+    <refsect2><title>equiv_rev</title>
+      <para>Dictionary that describes the match between bnodes in gfrom and gto. In equiv_rev, same 
+      	pairs are in different roles, bnodes from gfrom are values for mathing bnodes from gto that 
+      	are now keys. These data can be incomplete or NULL at all, but if provided then 
+      	the function will trust them blindly.</para>
+    </refsect2>
+  </refsect1>
+  <!--refsect1 id="examples_rdf_suo_diff_ttl">
+    <title>Examples</title>
+    <example id="ex_rdf_suo_diff_ttl"><title></title>
+      <para></para>
+<programlisting><![CDATA[
+]]></programlisting>
+    </example>
+  </refsect1-->
+  <refsect1 id="seealso_rdf_suo_diff_ttl">
+    <title>See Also</title>
+    <para><link linkend="fastapproxdiffandpatch">Fast Approximate RDF Graph Diff and Patch</link></para>             
+    <para><link linkend="fn_rdf_graph_diff">DB.DBA.RDF_GRAPH_DIFF</link></para>
+    <para><link linkend="fn_rdf_suo_apply_patch">DB.DBA.RDF_SUO_APPLY_PATCH</link></para>
+    <para><link linkend="fn_rdf_graph_collect_fp_list">DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</link></para>            
+  </refsect1>
+</refentry>
diff --git a/docsrc/xmlsource/funcref/regexp_substr.xml b/docsrc/xmlsource/funcref/regexp_substr.xml
index 604bd1d..5caf503 100644
--- a/docsrc/xmlsource/funcref/regexp_substr.xml
+++ b/docsrc/xmlsource/funcref/regexp_substr.xml
@@ -72,7 +72,7 @@ _______________________________________________________________________________
 
 1 Rows. -- 0 msec.
       </screen>
-<para>This returns the hole matched string from the expression.</para>
+      <para>This returns the whole matched string from the expression.</para>
       <screen>
 SQL> select regexp_substr('(2[34]).*(2[35])','22242226222527', 1);
 callret
diff --git a/docsrc/xmlsource/funcref/repl_init_copy.xml b/docsrc/xmlsource/funcref/repl_init_copy.xml
index 81b3e00..7cf9891 100644
--- a/docsrc/xmlsource/funcref/repl_init_copy.xml
+++ b/docsrc/xmlsource/funcref/repl_init_copy.xml
@@ -36,6 +36,7 @@
         <funcdef><function>REPL_INIT_COPY</function></funcdef>
         <paramdef>in <parameter>server_name</parameter> varchar</paramdef>
         <paramdef>in <parameter>publication</parameter> varchar</paramdef>
+        <paramdef>in <parameter>errors_mode</parameter> integer</paramdef>        
       </funcprototype>
     </funcsynopsis>
   </refsynopsisdiv>
@@ -58,6 +59,11 @@ completed on the publisher.
     <refsect2><title>account</title>
       <para>publication account name.</para>
     </refsect2>
+    <refsect2><title>errors_mode</title>
+      <para>Important: this parameter is valid only for SQL replication data (tables and WebDAV). When set to 1, in case of errors 
+      	as result of the replication copy, these errors are return in vector; When set to 0, in case of error, 
+      this error is return and the replication copying is stopped.</para>
+    </refsect2>    
   </refsect1>
 	<!-- 3019
         This function doesn't return value
@@ -71,7 +77,7 @@ completed on the publisher.
     <example id="ex_repl_pub_copy_1"><title>Loading of the initial data on subscriber</title>
      <para>This shows setting on-line of the initial state of the subscription to 'demo_publication' from server 'demo-srv'. The data for items will be transferred thru the VDB connection. Note that on large publications this can take a lot of time.</para>
       <screen>
-SQL> DB.DBA.REPL_INIT_COPY ('demo-srv', 'demo_publication');
+SQL> DB.DBA.REPL_INIT_COPY ('demo-srv', 'demo_publication', 1);
       </screen>
 
     </example>
diff --git a/docsrc/xmlsource/funcref/smime_decrypt.xml b/docsrc/xmlsource/funcref/smime_decrypt.xml
new file mode 100644
index 0000000..731aca1
--- /dev/null
+++ b/docsrc/xmlsource/funcref/smime_decrypt.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ -  
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -  
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -  
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -  
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -  
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -  
+ -  
+-->
+<refentry id="fn_smime_decrypt">
+  <refmeta>
+    <refentrytitle>smime_decrypt</refentrytitle>
+    <refmiscinfo>mail</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>smime_decrypt</refname>
+    <refpurpose>Decryption of a PKCS7 encrypted smime msg</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_smime_decrypt">
+      <funcprototype id="fproto_smime_decrypt">
+        <funcdef>varchar <function>smime_decrypt</function></funcdef>
+        <paramdef>in <parameter>encrypted_mail_message</parameter> varchar</paramdef>
+        <paramdef>in <parameter>recipient_certificate</parameter> varchar</paramdef>        
+        <paramdef>in <parameter>recipient_key</parameter> varchar</paramdef>                
+        <paramdef>in <parameter>password_for_the_key</parameter> varchar</paramdef>                        
+     </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_smime_decrypt"><title>Description</title>
+	  <para>This function performs decryption of a PKCS7 encrypted smime msg</para>
+	</refsect1>
+  <refsect1 id="params_smime_decrypt"><title>Parameters</title>
+    <refsect2><title>encrypted_mail_message</title>
+      <para>The text of the encrypted smime message</para></refsect2>
+    <refsect2><title>recipient_certificate</title>
+      <para>The certificate of the recipient (pem format)</para></refsect2>
+    <refsect2><title>recipient_key</title>
+      <para>The private key of recipient matching the recipient_certificate (pem format)</para></refsect2>
+    <refsect2><title>password_for_the_key</title>
+      <para>The secret to open the recipient_key (if key is encrypted)</para></refsect2>                 
+  </refsect1>
+  <refsect1 id="ret_smime_decrypt"><title>Return Types</title>
+    <para>varchar</para>
+  </refsect1>
+  <refsect1 id="examples_smime_decrypt"><title>Examples</title>
+    <example id="ex_smime_decrypt"><title>Decryption a PKCS7 encrypted smime msg</title>
+<programlisting><![CDATA[
+select smime_decrypt (file_to_string ('test.p7m'), 
+                      file_to_string ('test.pem'), 
+                      file_to_string ('test.key.pem'), 
+                      'secret');
+_______________________________________________________________________________
+Content-Transfer-Encoding: 7bit
+Content-Type: text/plain;
+ charset=us-ascii
+
+this is a test
+_______________________________________________________________________________
+]]></programlisting>
+    </example>
+  </refsect1>
+  <refsect1 id="seealso_smime_decrypt"><title>See Also</title>
+    <para><link linkend="fn_smime_sign">smime_sign</link></para>
+    <para><link linkend="fn_smime_encrypt">smime_encrypt</link></para>  
+    <para><link linkend="fn_smime_verify">smime_verify</link></para>          
+		<para><link linkend="fn_pem_certificates_to_array">pem_certificates_to_array</link></para>
+ </refsect1>
+</refentry>
+
diff --git a/docsrc/xmlsource/funcref/smime_encrypt.xml b/docsrc/xmlsource/funcref/smime_encrypt.xml
new file mode 100644
index 0000000..62ee699
--- /dev/null
+++ b/docsrc/xmlsource/funcref/smime_encrypt.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ -  
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -  
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -  
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -  
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -  
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -  
+ -  
+-->
+<refentry id="fn_smime_encrypt">
+  <refmeta>
+    <refentrytitle>smime_encrypt</refentrytitle>
+    <refmiscinfo>mail</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>smime_encrypt</refname>
+    <refpurpose>Performs encryption of a (signed) e-mail msg</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_smime_encrypt">
+      <funcprototype id="fproto_smime_encrypt">
+        <funcdef>varchar <function>smime_encrypt</function></funcdef>      	
+      	<paramdef>in <parameter>mail_message</parameter> varchar</paramdef>
+      	<paramdef>in <parameter>array_of_recipient_certificates</parameter> any</paramdef>
+      	<paramdef>in <parameter>cipher_name</parameter> varchar</paramdef>      	
+     </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_smime_encrypt"><title>Description</title>
+	<para>This function performs encryption of a (signed) e-mail message.</para></refsect1>
+  <refsect1 id="params_smime_encrypt"><title>Parameters</title>
+    <refsect2><title>mail_message</title>
+      <para>The text of the e-mail msg.</para>
+     </refsect2>
+     <refsect2>
+     <title>array_of_recipient_certificates</title>
+     <para>An array of strings containing certificates (per format) of the recipient individuals.
+       The certificates must contain RSA keys. See for reference <ulink url="http://www.openssl.org/docs/crypto/PKCS7_encrypt.html">here</ulink>.
+    </para>    
+    </refsect2> 
+    <refsect2><title>cipher_name</title>
+      <para>Encryption algorithm 'des', 'des3', 'aes256', 'aes128' etc.</para>
+    </refsect2>
+  </refsect1>      
+  <refsect1 id="ret_smime_encrypt"><title>Return Types</title>
+    <para>varchar</para>
+  </refsect1>
+  <refsect1 id="examples_smime_encrypt"><title>Examples</title>
+    <example id="ex_smime_encrypt"><title>Encrypting (signed) e-mail msg</title>
+<programlisting><![CDATA[
+SQL> select smime_encrypt (file_to_string ('test.eml'), 
+                           pem_certificates_to_array (file_to_string ('testcerts.pem')), 
+                           'aes256');
+
+
+_______________________________________________________________________________
+MIME-Version: 1.0
+Content-Disposition: attachment; filename="smime.p7m"
+Content-Type: application/x-pkcs7-mime; smime-type=enveloped-data; name="smime.p7m"
+Content-Transfer-Encoding: base64
+
+MIIDwwYJKoZIhvcNAQcDoIIDtDCCA7ACAQAxggGXMIIBkwIBADB7MHYxCzAJBgNV
+BAYTAkJHMRAwDgYDVQQIEwdQbG92ZGl2MRMwEQYDVQQKEwpQcm9nZW0gT09EMQ0w
+CwYDVQQLEwRMYWJzMRAwDgYDVQQDEwdSb290IENBMR8wHQYJKoZIhvcNAQkBFhBp
+bWl0a29AZ21haWwuY29tAgEAMA0GCSqGSIb3DQEBAQUABIIBADWF2bOMROmztQqO
+ytW7JfG3vjpk4TKHKoSnjKP0bBOSypY6/0tOzIg9jQHvl/Kay0do6gzfNbWV9SQP
+UWRa0lyD9rpG9WbxStOTPzDhDhbFJ0EXr1CR0uKMoUUuY3ovWkdZx0+whhCuwwVF
+pSY0vvh9P+Bw0hMUsJPsDtudti220a7A0jJ5Rz2ubcnN5A3M5Odxwr59ix93RYD/
+zfQ5ETqH8zx16F1cs7uS2uD7m2uVp8mQBab4onDYzpLUWvVi/dPX3h2ifAjn25At
+SmWROYd+NbyNxs9uQp4pQZ6ZEJo6dPVrsM7SfR55O3ukq5V9zOUYEVN+VJpPlGBt
+Gru9tlwwggIOBgkqhkiG9w0BBwEwHQYJYIZIAWUDBAEqBBCykjJ22Mk6baYYlP/w
+PTb2gIIB4KyYoU7j4vREgvTO6zBauDnACAZO0oOdzGDuJKtLd8rTJO10ntp+CF6Y
+5hAZnUefW0cCm6Pn9yMb1l5Btthek+CCscKsPTNCMSb/dBuPTbmKQcfYwlHV/Ejz
+Ko5uJYMHLh8RkjHPt6nov6YZrMA82IA4KGCWxhhsQ7flHYtLG9PEWOaQr7Y+BYBs
+a3sQdiGgGBwarTX+y65ERYcE32h+xnP4RW3QD8VEmhlyesG5xoALnGM4CQ9VObh1
+VOTQhPRbu1PSsa4fEjbn3ey7+89mrjpYD/GwdwBEqOM0xGUZI4UBnhDwCIE/A4xX
+jEdf59vpUt+mVzGYXCwSvkdwMCpPoPH9asYXSEWLoDOIagNUbuUQ5Y/A1iKWpM8p
+21IND9tI+UiXMBgrDpeR/0b/E+Waswfb9qdXDSBDFGdB1aJo/f9KsikHNwxYczxh
+YF0Ra3WqJC0n3+IEgoaCy/8Shon6VDsnZtB0aMXBIUEd+tpx0CBggLmHWL7jwcwy
+CRD2bYzuM3yvux/u7U0B5GmfDEmyuNoEyMuUGC1+Sk7TFBtW0I9LpBDY5m5hPl1y
+VeATJx0vPbmcy/smzkVKYTwhFWF/AYT4CrNbrTYkkb39JmWHTH6GU1KEfoonTbA7
+oAUG6cFvFA==
+_______________________________________________________________________________
+]]></programlisting>
+    </example>
+  </refsect1>
+  <refsect1 id="seealso_smime_encrypt"><title>See Also</title>
+    <para><link linkend="fn_smime_decrypt">smime_decrypt</link></para>  
+    <para><link linkend="fn_smime_sign">smime_sign</link></para>
+    <para><link linkend="fn_smime_verify">smime_verify</link></para>    
+		<para><link linkend="fn_pem_certificates_to_array">pem_certificates_to_array</link></para>
+ </refsect1>
+</refentry>
+
diff --git a/docsrc/xmlsource/funcref/smime_sign.xml b/docsrc/xmlsource/funcref/smime_sign.xml
index eff9aa1..eef4f0e 100644
--- a/docsrc/xmlsource/funcref/smime_sign.xml
+++ b/docsrc/xmlsource/funcref/smime_sign.xml
@@ -198,6 +198,8 @@ _______________________________________________________________________________
   </refsect1>
   <refsect1 id="seealso_smime_sign"><title>See Also</title>
     <para><link linkend="fn_smime_verify">smime_verify</link></para>
+    <para><link linkend="fn_smime_encrypt">smime_encrypt</link></para>    
+    <para><link linkend="fn_smime_decrypt">smime_decrypt</link></para>
 		<para><link linkend="fn_pem_certificates_to_array">pem_certificates_to_array</link></para>
   </refsect1>
 </refentry>
diff --git a/docsrc/xmlsource/funcref/smime_verify.xml b/docsrc/xmlsource/funcref/smime_verify.xml
index 4815c74..e38e6bc 100644
--- a/docsrc/xmlsource/funcref/smime_verify.xml
+++ b/docsrc/xmlsource/funcref/smime_verify.xml
@@ -101,7 +101,7 @@
     <para>If the signer_certs is supplied, an array of PEM encoded certificates
     of the signers is returned.</para>
   </refsect1>
-  <refsect1 id="errors_smime_verify"><title>Errors</title>
+  <!--refsect1 id="errors_smime_verify"><title>Errors</title>
     <table><title>Errors signalled by <function>smime_verify</function></title>
       <tgroup cols="4">
         <thead>
@@ -122,7 +122,7 @@
 	</tbody>
       </tgroup>
     </table>
-  </refsect1>
+  </refsect1-->
   <refsect1 id="examples_smime_verify"><title>Examples</title>
     <example id="ex_smime_verify"><title>Verifying a Signed MIME Message</title>
 <para>Example (where signed.eml contains the output from smime_sign.</para>
@@ -138,6 +138,8 @@ _______________________________________________________________________________
   </refsect1>
   <refsect1 id="seealso_smime_verify"><title>See Also</title>
     <para><link linkend="fn_smime_sign">smime_sign</link></para>
+    <para><link linkend="fn_smime_encrypt">smime_encrypt</link></para>  
+    <para><link linkend="fn_smime_decrypt">smime_decrypt</link></para>          
 		<para><link linkend="fn_pem_certificates_to_array">pem_certificates_to_array</link></para>
  </refsect1>
 </refentry>
diff --git a/docsrc/xmlsource/funcref/sparql_rdb2rdf_codegen.xml b/docsrc/xmlsource/funcref/sparql_rdb2rdf_codegen.xml
new file mode 100644
index 0000000..3add37c
--- /dev/null
+++ b/docsrc/xmlsource/funcref/sparql_rdb2rdf_codegen.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<refentry id="fn_sparql_rdb2rdf_codegen">
+  <refmeta>
+    <refentrytitle>DB.DBA.SPARQL_RDB2RDF_CODEGEN</refentrytitle>
+    <refmiscinfo>rdf</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>DB.DBA.SPARQL_RDB2RDF_CODEGEN</refname>
+    <refpurpose>Creates an SQL text for a given table and an operation specified by an opcode</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_sparql_rdb2rdf_codegen">
+      <funcprototype id="fproto_sparql_rdb2rdf_codegen">
+        <funcdef><function>DB.DBA.SPARQL_RDB2RDF_CODEGEN</function></funcdef>
+	        <paramdef>in <parameter>table_name</parameter> varchar</paramdef>
+	        <paramdef>in <parameter>opcode</parameter> integer</paramdef>	        
+      </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_sparql_rdb2rdf_codegen">
+    <title>Description</title>
+    <para>The function creates an SQL text for a given table and an operation specified by an opcode.</para>
+  </refsect1>
+  <refsect1 id="params_sparql_rdb2rdf_codegen">
+    <title>Parameters</title>
+    <refsect2><title>table_name</title>
+      <para>The name of the table.</para>
+    </refsect2>
+    <refsect2><title>opcode</title>
+      <para>Currently supported opcodes are:</para>
+      <itemizedlist mark="bullet">
+        <listitem>0: debugging dump of internal state of code generator, it can be requested by the 
+        	help-desk.</listitem>
+        <listitem>1: text of procedure that makes an initial RDF dump of triples, created from the 
+        	specified table. It is used if the table is not empty when triggers are added, so existing 
+        	data should be dumped as a batch before being continuously edited by triggers.</listitem>
+        <listitem>2: text of AFTER INSERT trigger.</listitem>
+        <listitem>3: text of AFTER UPDATE trigger.</listitem>
+        <listitem>4: text of BEFORE DELETE trigger.</listitem>
+      </itemizedlist>
+    </refsect2>    
+  </refsect1>
+  <refsect1 id="ret_sparql_rdb2rdf_codegen"><title>Return Types</title>
+    <para>string session or vector</para>
+  </refsect1>
+
+  <!--refsect1 id="examples_sparql_rdb2rdf_codegen">
+    <title>Examples</title>
+    <example id="ex_sparql_rdb2rdf_codegen"><title></title>
+      <para></para>
+<programlisting><![CDATA[
+]]></programlisting>
+    </example>
+  </refsect1-->
+  <refsect1 id="seealso_sparql_rdb2rdf_codegen">
+    <title>See Also</title>
+    <para><link linkend="rdb2rdftriggers">RDB2RDF Triggers</link></para>             
+    <para><link linkend="fn_sparql_rdb2rdf_list_tables">DB.DBA.SPARQL_RDB2RDF_LIST_TABLES</link></para>            
+  </refsect1>
+</refentry>
diff --git a/docsrc/xmlsource/funcref/sparql_rdb2rdf_list_tables.xml b/docsrc/xmlsource/funcref/sparql_rdb2rdf_list_tables.xml
new file mode 100644
index 0000000..933e4b5
--- /dev/null
+++ b/docsrc/xmlsource/funcref/sparql_rdb2rdf_list_tables.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<refentry id="fn_sparql_rdb2rdf_list_tables">
+  <refmeta>
+    <refentrytitle>DB.DBA.SPARQL_RDB2RDF_LIST_TABLES</refentrytitle>
+    <refmiscinfo>rdf</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>DB.DBA.SPARQL_RDB2RDF_LIST_TABLES</refname>
+    <refpurpose>Returns a vector of names of tables that are used as sources for RDF Views.</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_sparql_rdb2rdf_list_tables">
+      <funcprototype id="fproto_sparql_rdb2rdf_list_tables">
+        <funcdef><function>DB.DBA.SPARQL_RDB2RDF_LIST_TABLES</function></funcdef>
+	        <paramdef>in <parameter>mode</parameter> integer</paramdef>
+      </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_sparql_rdb2rdf_list_tables">
+    <title>Description</title>
+    <para>Returns a vector of names of tables that are used as sources for RDF Views. Application 
+    	developer should decide what to do with each of them - create triggers or do some 
+    	application-specific workarounds.</para>
+    <para>Note that if some SQL views are used as sources for RDF Views and these views does not 
+    	have INSTEAD triggers then workarounds become mandatory for them, not just a choice, because 
+    	BEFORE or AFTER triggers on views are not allowed if there is no appropriate INSTEAD trigger. 
+    	The mode argument should be zero in current version.</para>	
+  </refsect1>
+  <refsect1 id="params_sparql_rdb2rdf_list_tables">
+    <title>Parameters</title>
+    <refsect2><title>mode</title>
+    </refsect2>
+  </refsect1>
+  <refsect1 id="ret_sparql_rdb2rdf_list_tables"><title>Return Types</title>
+    <para>vector</para>
+  </refsect1>
+
+  <!--refsect1 id="examples_sparql_rdb2rdf_list_tables">
+    <title>Examples</title>
+    <example id="ex_sparql_rdb2rdf_list_tables"><title></title>
+      <para></para>
+<programlisting><![CDATA[
+]]></programlisting>
+    </example>
+  </refsect1-->
+  <refsect1 id="seealso_sparql_rdb2rdf_list_tables">
+    <title>See Also</title>
+    <para><link linkend="rdb2rdftriggers">RDB2RDF Triggers</link></para>             
+    <para><link linkend="fn_sparql_rdb2rdf_codegen">DB.DBA.SPARQL_RDB2RDF_CODEGEN</link></para>                
+  </refsect1>
+</refentry>
diff --git a/docsrc/xmlsource/funcref/sparql_select_known_graphs.xml b/docsrc/xmlsource/funcref/sparql_select_known_graphs.xml
new file mode 100644
index 0000000..9f502ba
--- /dev/null
+++ b/docsrc/xmlsource/funcref/sparql_select_known_graphs.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<refentry id="fn_sparql_select_known_graphs">
+  <refmeta>
+    <refentrytitle>DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS</refentrytitle>
+    <refmiscinfo>rdf</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS</refname>
+    <refpurpose>returns all graphs.</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <funcsynopsis id="fsyn_sparql_select_known_graphs">
+      <funcprototype id="fproto_sparql_select_known_graphs">
+        <funcdef><function>DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS</function></funcdef>
+      </funcprototype>
+    </funcsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="desc_sparql_select_known_graphs">
+    <title>Description</title>
+    <para>This function returns all graphs URIs.</para>
+  </refsect1>
+  <refsect1 id="params_sparql_select_known_graphs">
+    <title>Parameters</title>
+  </refsect1>
+  <refsect1 id="ret_sparql_select_known_graphs"><title>Return Types</title>
+    <para>varchar</para>
+  </refsect1>
+  <refsect1 id="examples_sparql_select_known_graphs">
+    <title>Examples</title>
+    <example id="ex_sparql_select_known_graphs"><title></title>
+      <para></para>
+<programlisting><![CDATA[
+SQL> DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS();
+GRAPH_IRI
+VARCHAR
+_______________________________________________________________________________
+
+http://www.openlinksw.com/schemas/virtrdf#
+http://localhost:8891/DAV
+http://localhost:8891/dataspace
+http://localhost:8891/dataspace/inf
+http://www.w3.org/2002/07/owl#
+http://www.w3.org/2002/07/owl
+http://www.openlinksw.com/schemas/RDF_Mapper_Ontology/1.0/
+http://bblfish.net/work/atom-owl/2006-06-06/
+http://purl.org/dc/elements/1.1/
+http://www.openlinksw.com/schema/attribution#
+http://purl.org/ontology/bibo/
+http://purl.org/dc/terms/
+http://xmlns.com/foaf/0.1/
+http://purl.org/goodrelations/v1
+http://open.vocab.org/terms
+http://www.w3.org/1999/02/22-rdf-syntax-ns#
+http://www.w3.org/2000/01/rdf-schema#
+http://scot-project.org/scot/ns#
+http://rdfs.org/sioc/ns#
+http://www.w3.org/2004/02/skos/core
+
+20 Rows. -- 188 msec.
+]]></programlisting>
+    </example>
+  </refsect1>
+  <refsect1 id="seealso_sparql_select_known_graphs">
+    <title>See Also</title>
+    <para><link linkend="fastapproxdiffandpatch">Fast Approximate RDF Graph Diff and Patch</link></para>             
+    <para><link linkend="fn_rdf_suo_diff_ttl">DB.DBA.RDF_SUO_DIFF_TTL</link></para>
+    <para><link linkend="fn_rdf_suo_apply_patch">DB.DBA.RDF_SUO_APPLY_PATCH</link></para>
+    <para><link linkend="fn_rdf_graph_collect_fp_list">DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</link></para>            
+  </refsect1>
+</refentry>
diff --git a/docsrc/xmlsource/funcref/vad_check.xml b/docsrc/xmlsource/funcref/vad_check.xml
index f7e74fa..e9ab9dd 100644
--- a/docsrc/xmlsource/funcref/vad_check.xml
+++ b/docsrc/xmlsource/funcref/vad_check.xml
@@ -24,7 +24,7 @@
 <refentry id="fn_vad_check">
   <refmeta> 
     <refentrytitle>VAD_CHECK</refentrytitle> 
-    <refmiscinfo>VAD</refmiscinfo>
+    <refmiscinfo>vad</refmiscinfo>
   </refmeta> 
   <refnamediv> 
     <refname>VAD_CHECK</refname> 
diff --git a/docsrc/xmlsource/funcref/vad_check_installability.xml b/docsrc/xmlsource/funcref/vad_check_installability.xml
index b7d94d3..f226a87 100644
--- a/docsrc/xmlsource/funcref/vad_check_installability.xml
+++ b/docsrc/xmlsource/funcref/vad_check_installability.xml
@@ -24,7 +24,7 @@
 <refentry id="fn_vad_check_installability">
   <refmeta> 
     <refentrytitle>VAD_CHECK_INSTALLABILITY</refentrytitle> 
-    <refmiscinfo>VAD</refmiscinfo>
+    <refmiscinfo>vad</refmiscinfo>
   </refmeta> 
   <refnamediv> 
     <refname>VAD_CHECK_INSTALLABILITY</refname> 
diff --git a/docsrc/xmlsource/funcref/vad_check_uninstallability.xml b/docsrc/xmlsource/funcref/vad_check_uninstallability.xml
index c59e68c..628fbef 100644
--- a/docsrc/xmlsource/funcref/vad_check_uninstallability.xml
+++ b/docsrc/xmlsource/funcref/vad_check_uninstallability.xml
@@ -24,7 +24,7 @@
 <refentry id="fn_vad_check_uninstallability">
   <refmeta> 
     <refentrytitle>VAD_CHECK_UNINSTALLABILITY</refentrytitle> 
-    <refmiscinfo>VAD</refmiscinfo>
+    <refmiscinfo>vad</refmiscinfo>
   </refmeta> 
   <refnamediv> 
     <refname>VAD_CHECK_UNINSTALLABILITY</refname> 
diff --git a/docsrc/xmlsource/funcref/vad_fail_check.xml b/docsrc/xmlsource/funcref/vad_fail_check.xml
index 5392951..03513ad 100644
--- a/docsrc/xmlsource/funcref/vad_fail_check.xml
+++ b/docsrc/xmlsource/funcref/vad_fail_check.xml
@@ -24,7 +24,7 @@
 <refentry id="fn_vad_fail_check">
   <refmeta> 
     <refentrytitle>VAD_FAIL_CHECK</refentrytitle> 
-    <refmiscinfo>VAD</refmiscinfo>
+    <refmiscinfo>vad</refmiscinfo>
   </refmeta> 
   <refnamediv> 
     <refname>VAD_FAIL_CHECK</refname> 
diff --git a/docsrc/xmlsource/funcref/vad_install.xml b/docsrc/xmlsource/funcref/vad_install.xml
index 5018c27..cf80645 100644
--- a/docsrc/xmlsource/funcref/vad_install.xml
+++ b/docsrc/xmlsource/funcref/vad_install.xml
@@ -24,7 +24,7 @@
 <refentry id="fn_vad_install">
   <refmeta> 
     <refentrytitle>VAD_INSTALL</refentrytitle> 
-    <refmiscinfo>VAD</refmiscinfo>
+    <refmiscinfo>vad</refmiscinfo>
   </refmeta> 
   <refnamediv> 
     <refname>VAD_INSTALL</refname> 
diff --git a/docsrc/xmlsource/funcref/vad_load_file.xml b/docsrc/xmlsource/funcref/vad_load_file.xml
index 99f1ce7..a00b9a7 100644
--- a/docsrc/xmlsource/funcref/vad_load_file.xml
+++ b/docsrc/xmlsource/funcref/vad_load_file.xml
@@ -24,7 +24,7 @@
 <refentry id="fn_vad_load_file">
   <refmeta> 
     <refentrytitle>VAD_LOAD_FILE</refentrytitle> 
-    <refmiscinfo>VAD</refmiscinfo>
+    <refmiscinfo>vad</refmiscinfo>
   </refmeta> 
   <refnamediv> 
     <refname>VAD_LOAD_FILE</refname> 
diff --git a/docsrc/xmlsource/funcref/vad_pack.xml b/docsrc/xmlsource/funcref/vad_pack.xml
index ed8cbcc..d759305 100644
--- a/docsrc/xmlsource/funcref/vad_pack.xml
+++ b/docsrc/xmlsource/funcref/vad_pack.xml
@@ -24,7 +24,7 @@
 <refentry id="fn_vad_pack">
   <refmeta> 
     <refentrytitle>VAD_PACK</refentrytitle> 
-    <refmiscinfo>VAD</refmiscinfo>
+    <refmiscinfo>vad</refmiscinfo>
   </refmeta> 
   <refnamediv> 
     <refname>VAD_PACK</refname> 
diff --git a/docsrc/xmlsource/funcref/vad_safe_exec.xml b/docsrc/xmlsource/funcref/vad_safe_exec.xml
index 0e84dfb..ca5cd54 100644
--- a/docsrc/xmlsource/funcref/vad_safe_exec.xml
+++ b/docsrc/xmlsource/funcref/vad_safe_exec.xml
@@ -24,7 +24,7 @@
 <refentry id="fn_vad_safe_exec">
   <refmeta> 
     <refentrytitle>VAD_SAFE_EXEC</refentrytitle> 
-    <refmiscinfo>VAD</refmiscinfo>
+    <refmiscinfo>vad</refmiscinfo>
   </refmeta> 
   <refnamediv> 
     <refname>VAD_SAFE_EXEC</refname> 
diff --git a/docsrc/xmlsource/funcref/vad_uninstall.xml b/docsrc/xmlsource/funcref/vad_uninstall.xml
index 5cb922c..f2deb62 100644
--- a/docsrc/xmlsource/funcref/vad_uninstall.xml
+++ b/docsrc/xmlsource/funcref/vad_uninstall.xml
@@ -24,7 +24,7 @@
 <refentry id="fn_vad_uninstall">
   <refmeta> 
     <refentrytitle>VAD_UNINSTALL</refentrytitle> 
-    <refmiscinfo>VAD</refmiscinfo>
+    <refmiscinfo>vad</refmiscinfo>
   </refmeta> 
   <refnamediv> 
     <refname>VAD_UNINSTALL</refname> 
diff --git a/docsrc/xmlsource/functions.xml b/docsrc/xmlsource/functions.xml
index db56bc0..0200138 100644
--- a/docsrc/xmlsource/functions.xml
+++ b/docsrc/xmlsource/functions.xml
@@ -77,6 +77,7 @@ built-in functions of the Virtuoso XPATH Processor.  These can be used in XPATH,
     <keyword id="xml">XML</keyword>
     <keyword id="XPATH">XPATH & XQUERY</keyword>
     <keyword id="misc">Miscellaneous</keyword>
+    <keyword id="vad">VAD</keyword>
   </keywordset>
 </docinfo>
 
@@ -165,9 +166,11 @@ built-in functions of the Virtuoso XPATH Processor.  These can be used in XPATH,
 &randomize; &rclose; &regexp_match; &regexp_parse; &regexp_substr;
 &rdf_audit_metadata; &rdf_backup_metadata; &rdf_void_store;
 <!-- TBD: &rdf_load_turtle; -->
-&rdf_restore_metadata;&rdf_load_rdfxml_mt;&rdf_load_rdfxml;&ttlp;&ttlp_mt;&ttlp_mt_local_file;
+&rdf_restore_metadata; &rdf_load_rdfxml_mt; &rdf_load_rdfxml; &rdf_load_rdfa; &ttlp; &ttlp_mt; &ttlp_mt_local_file;
 &rdf_triples_to_rdf_xml_text;&rdf_triples_to_ttl;&rdf_64bit_upgrade;
 &rdf_convert_rdfxml_to_ttl; &rdf_graph_group_create; &rdf_graph_group_ins; &rdfs_rule_set;
+&rdf_geo_fill; &rdf_geo_add; &rdf_graph_collect_fp_list; &rdf_graph_diff; &rdf_suo_apply_patch;
+&rdf_suo_diff_ttl; &sparql_rdb2rdf_codegen; &sparql_rdb2rdf_list_tables; &sparql_select_known_graphs;
 &rowvector_digit_sort; <!-- &rowvector_subj_sort; -->
 &isref;
 
@@ -196,7 +199,8 @@ built-in functions of the Virtuoso XPATH Processor.  These can be used in XPATH,
 &REPL_CREATE_SNAPSHOT_PUB; &REPL_CREATE_SNAPSHOT_SUB;
 &REPL_DROP_SNAPSHOT_SUB; &REPL_DROP_SNAPSHOT_PUB; &REPL_INIT_SNAPSHOT;
 &REPL_UPDATE_SNAPSHOT; &REPL_SNP_SERVER; &REPL_SERVER_NAME;
-&REPL_ADD_CR; &REPL_ADD_DAV_CR; &REPL_ADD_SNAPSHOT_CR;
+&REPL_ADD_CR; &REPL_ADD_DAV_CR; &REPL_ADD_SNAPSHOT_CR; &rdf_repl_start; 
+&rdf_repl_graph_ins; &rdf_repl_graph_del;
 &result; &result_names; &rexecute; &rstmtexec; &right; &rmoreresults;
 &rnd; &rnext; &row_count; &rtrim;
 
@@ -207,7 +211,7 @@ built-in functions of the Virtuoso XPATH Processor.  These can be used in XPATH,
 &serv_queue_top; &ses_connect; &ses_disconnect;
 &ses_read_line; &ses_write; &set_row_count; &set_user_id; &set_identity_column; &sign; &signal;
 &sinv_create_key_mapping; &sinv_create_inverse; &sinv_drop_inverse;
-&smime_sign; &smime_verify; &smtp_send; &soap_box_xml_entity; &soap_dt_define;
+&smime_sign; &smime_verify; &smime_encrypt; &smime_decrypt; &smtp_send; &soap_box_xml_entity; &soap_dt_define;
 &soap_call; &soap_client; &soap_make_error; &soap_print_box; &soap_sdl;
 &soap_server; &soap_wsdl; &soap_wsdl_import; &soap_box_structure; &soap_current_url;
 &space; &split_decode; &sprintf; &sprintf_inverse; &sprintf_iri; &sprintf_iri_or_null; &sprintf_or_null;
diff --git a/docsrc/xmlsource/installation.xml b/docsrc/xmlsource/installation.xml
index 94a94f8..a57c8b8 100644
--- a/docsrc/xmlsource/installation.xml
+++ b/docsrc/xmlsource/installation.xml
@@ -30,7 +30,6 @@
 This chapter describes how to install OpenLink Virtuoso VDBMS.  It 
 contains both a quick start install guide and full walk through install guides 
 for major platforms.</para>
-</abstract>
 
   <para>Virtuoso has been designed from the ground-up to be easy to implement.</para>
 	<para>The installation generally runs without problems, run the setup program or script and follow
@@ -56,16 +55,12 @@ linkend="configsrvstupfiles">Configuring Server Startup Files</link>
 section.
 </para>
 
+</abstract>
+
+
+
 	<sect1 id="installwin32">
-		<title>Virtuoso for Windows 95/98/NT/2000/XP</title>
-			<sect2 id="doyouwannamigrate">
-				<title>Existing Virtuoso 2.7 Users</title>
-				<para>You can migrate your existing Virtuoso servers to 3.0 using 
-        the migration utility.  The Virtuoso database file structure has been considerably 
-        altered between versions.  Please consult the 
-        <link linkend="migrate27to30">Migration of Virtuoso from Version 2.7 to Version 3.0</link>
-        section for more details.</para>
-			</sect2>
+		<title>Virtuoso for Windows</title>
 		<sect2 id="b4ustart">
 			<title>Before You Start</title>
 			<para>To ensure a smooth installation, please review the
@@ -112,6 +107,92 @@ section.
 				as part of the download process. It is therefore important to supply a valid email
 				address. The installer will prompt for the license file location.</para>
 			</sect3>
+			
+			  <sect3 id="srvadminstallreqt"><title>Installation Requirements</title>
+    <para>A typical installation will require a minimum of 400Mb of hard disk
+    space to install the code, samples, documentation and sample database.
+The database will need additional space for data inserted, backups, logs and reports, web pages, etc.
+</para>
+    <para>The size of the database .db file will not reduce when data is
+    removed. The spare space will however be reclaimed for later use.</para>
+  </sect3>
+    
+  <sect3 id="srvadmopreq"><title>Operational Requirements</title>
+    <para>The Virtuoso database requires a minimum of 64Mb of system memory
+    for each instance to operate in. Each connection will take between 70kb
+    and 130kb of memory.</para>
+    <para>The memory usage is affected by the following parameters in the
+    <link linkend="VIRTINI">Virtuoso configuration file</link>.</para>
+    <simplelist>
+      <member>ServerThreads</member>
+      <member>ServerThreadSize</member>
+      <member>MainThreadSize</member>
+      <member>FutureThreadSize</member>
+      <member>NumberOfBuffers</member>
+    </simplelist>
+    <para>See the following <link linkend="parameters">Parameter section</link>
+    for more details.</para>
+  </sect3>
+
+  <sect3 id="srvadmossupport"><title>Operating System Support</title>
+    <para>Virtuoso runs on the following operating systems:</para>
+    <simplelist>
+      <member>Windows</member>
+      <member>Linux</member>
+      <member>Unix: AIX, HP-UX, Solaris, etc.</member>
+      <member>Mac OS X</member>
+    </simplelist>
+  </sect3>
+
+
+<sect3 id="limitsandparameters">
+<title>Limits</title>
+
+<para>
+The below table lists the most important parameters and limits for a database or a Virtuoso server instance.  For space consumption of individual data types, see <link linkend="SpaceConsump">Space Consumption</link>.
+</para>
+
+
+<table colsep="1" frame="all" rowsep="0" shortentry="0" tocentry="1" tabstyle="decimalstyle" orient="land" pgwide="0">
+  <title>Limits</title>
+  <tgroup align="char" charoff="50" char="." cols="2">
+  <colspec align="left" colnum="1" colsep="0" colwidth="20pc"/>
+    <thead>
+      <row>
+        <entry>Limit Description</entry>
+        <entry>Value</entry>
+      </row>
+    </thead>
+    <tbody>	
+<row><entry>Identifier length</entry><entry>100</entry></row>
+<row><entry>User name and password length</entry><entry>100</entry></row>
+<row><entry>SQLstmt and proc text</entry><entry>100K+</entry></row>
+<row><entry>varchar length</entry><entry>Constrained by max row length when stored into non-LOB column, 10MB inside procedure code.</entry></row>
+<row><entry>Numeric precision</entry><entry>Max 40 digits</entry></row>
+<row><entry>LOB column length</entry><entry>2GB</entry></row>
+<row><entry>row length</entry><entry>4086</entry></row>
+<row><entry>Columns per row</entry><entry>200</entry></row>
+<row><entry>Database size</entry><entry>32TB for data, 32TB for temp data </entry></row>
+<row><entry>Page size</entry><entry>8K</entry></row>
+<row><entry>File size</entry><entry>64 bit file offsets on supporting OS's</entry></row>
+<row><entry>Files per database</entry><entry>unlimited</entry></row>
+<row><entry>Table size</entry><entry>Up to database size </entry></row>
+<row><entry>Tables per database</entry><entry>64K keys, a table takes 1 key for primary key, 1 key per index and 1 key for each obsolete primary key layout  resulting from adding or dropping columns.</entry></row>
+<row><entry>Indexes per table</entry><entry>Unlimited, subject to global cap on keys.</entry></row>
+<row><entry>Row in sorting/distinct temp</entry><entry>4078b, as in tables </entry></row>
+<row><entry>Locks per transaction</entry><entry>Depends on memory, 16b per row lock, 60b per page with at least one row lock.</entry></row>
+<row><entry>Changes per transaction</entry><entry>Depends on memory, ini parameter allows cap on  rollback before image.</entry></row>
+<row><entry>Virtual memory></entry><entry>Depends on OS, 64 bit pointers on 64 bit platforms</entry></row>
+<row><entry>Threads</entry><entry>Depends on OS, ini files specifies cap for pool for SQL client and web server worker thread pools.</entry></row>
+<row><entry>Max connections</entry><entry>Depends on OS fdset size, at least 2048, license can set a limit</entry></row>
+<row><entry>Memory per connection</entry><entry>22K plus up to 100 cached SQL statement compilations</entry></row>
+</tbody>
+ </tgroup>
+</table>
+
+  </sect3>
+
+
 			<sect3 id="reinstvirt">
 				<title>Reinstalling Virtuoso?</title>
 				<para>If you are reinstalling Virtuoso, you must first shutdown any
@@ -242,19 +323,17 @@ netstat -an | more
 						</figure>
 					</listitem>
 					<listitem>
-						<para>You read the full license agreement information and make sure 
-            that you agree with all the terms and conditions before proceeding 
-            with the installation.</para>
+						<para>Review the license agreement and 'agree' to the terms:</para>
 						<figure id="winpersinst003" float="1">
 							<title>License Agreement</title>
 							<graphic fileref="inst/v50pex8603.png" width="504" depth="386"/>
 						</figure>
 					</listitem>
 					<listitem>
-						<para>If a license file already exists the installer can place this in the correct location for use.
-            Browse to the location of your installer file and the installer will use this for the Virtuoso Server. Alternatively
-            the "Try & Buy" feature of the installer can be used to enable a trial or full license file to be
-            obtained online.</para>
+						<para>If a license file already exists the installer can place this in the correct
+location for use. Browse to the location of your installer file and the installer will use this for the
+Virtuoso Server. Alternatively the "Try & Buy" feature of the installer can be used to enable
+a trial or full license file to be obtained online:</para>
 						<figure id="winpersinst004" float="1">
 							<title>The License File Location</title>
 							<graphic fileref="inst/v50pex8604.png" width="504" depth="386"/>
@@ -280,7 +359,7 @@ netstat -an | more
 						</figure>
 					</listitem>
 					<listitem>
-						<para>Choose the installation type that you want to install.</para>
+						<para>Select the Installation Type to be performed from the options presented:</para>
 						<figure id="winpersinst007" float="1">
 							<title>Setup Type</title>
 							<graphic fileref="inst/v50pex8607.png" width="504" depth="386"/>
@@ -329,25 +408,38 @@ netstat -an | more
 							<graphic fileref="inst/v50pex8613.png" width="436" depth="161"/>
 						</figure>
 					</listitem>
-					<listitem>
-						<para>Choose to change the "dba" and "dav" administrative
-         user passwords from their default of "dba" and "dav" respectively to a value of your choice.</para>
-						<figure id="winpersinst014" float="1">
-							<title>Reboot prompt</title>
-							<graphic fileref="inst/v50pex8614.png" width="678" depth="547"/>
+					<listitem>Post installation the Virtuoso Server can be started by running the "Virtuoso
+Service Manager" which gets added to the Windows "Icons Tray" in the status bar.
+                                           <figure id="winpinst14" float="1">
+                                             <title>Post installation</title>
+                                             <graphic fileref="ui/winpinst14.png"/>
 						</figure>
 					</listitem>
-					<listitem>
-						<para>The Virtuoso Server Welcome page will now be displayed indicating the
-         server is online. This Web based page can be used for general configuration and usage of the Virtuoso Server.</para>
-						<figure id="winpersinst015" float="1">
-							<title>Reboot prompt</title>
-							<graphic fileref="inst/v50pex8615.png" width="722" depth="675"/>
+                                        <listitem>Double click on the "Virtuoso Service Manager" icon in the "Icons Tray" to load
+the application, select the "OpenLink Virtuoso Server" instance and press the "Start" button to run
+the Service.
+                                          <figure id="winpinst15" float="1">
+                                            <title>Virtuoso Service Manager</title>
+                                            <graphic fileref="ui/winpinst15.png"/>
+                                          </figure>
+                                        </listitem>
+                                        <listitem>Once the Virtuoso service has successfully started, it is recommended that
+the default "dba" and "dav" passwords be changed to secure values by loading the URL
+"http://localhost:8890/install" in a Web Browser which loads the following page for making these changes:
+                                          <figure id="winpinst16" float="1">
+                                            <title>Default passwords</title>
+                                            <graphic fileref="ui/winpinst16.png"/>
+                                          </figure>
+                                        </listitem>
+                                        <listitem>The Virtuoso Server Welcome page will now be displayed indicating the server is
+online. This Web based page can be used for general configuration and usage of the Virtuoso Server:
+                                            <figure id="winpinst17" float="1">
+                                              <title>Virtuoso Server Welcome page</title>
+                                              <graphic fileref="ui/winpinst17.png"/>
 						</figure>
 					</listitem>
-
-
 				</orderedlist>
+                                        <para>The installation Virtuoso Universal Server is complete.</para>
 			</sect3>
 			<sect3 id="TwoTierConfigInst">
 			<title>2-Tier Client-Server Configuration</title>
@@ -464,13 +556,41 @@ netstat -an | more
 				</sect4>
 			</sect3>
 		</sect2>
+		
+		<sect2 id="wininstpost"><title>Post Installation</title>  
+  <sect3 id="wininstpostsan">
+			<title>Post-Installation Sanity Check</title>
+			<para>A quick way to check that the database is running, is to point a browser to the
+			http port. The following example URLs will show the System Manager for
+			the default, and the demo Virtuoso databases:</para>
+			<programlisting>http://localhost:8889
+http://localhost:8890
+http://a_virtuoso_server.org:8890</programlisting>
+		</sect3>
+		<sect3 id="wininstposttrb"><title>Troubleshooting DB Startup Failures</title>  
+  <para><emphasis>Install failure</emphasis></para> 
+  <para>Check the .log file in your Virtuoso installation db location, for ex:</para>
+<programlisting><![CDATA[
+	C:\Program Files\OpenLink Software\Virtuoso 6.0\db\virtuoso.log  
+]]></programlisting>  
+<para>which is for the database and log files etc. in order to review the installed files 
+binaries and databases (defaults) for issues if install fails.</para>
+   <para><emphasis>.lck existance</emphasis></para>   
+   <para>Check .log in case of .lck issue</para>
+   <para>Delete the .lck file and repeat the steps from above.</para>
+   <para><emphasis>.trx incompatiblity issue</emphasis></para>   
+   <para>Check .log in case of .trx incompatiblity issue</para>
+  </sect3> 
+  </sect2>
+  
 		<sect2 id="startvdbms">
 			<title>Starting Your Virtuoso Server</title>
-			<para>Due to subtle differences between Windows 95/98 and Windows
-    NT it is necessary to address the issue of starting and stopping your Virtuoso server for
-    each one of these Windows variants separately.</para>
+			<para>Due to subtle differences between the Windows 95 family (including Windows 98 and Windows ME) 
+				and the Windows NT family (including Windows 2000, Windows XP, Vista, Windows 7, Windows 2000 
+				Server, Windows Server 2003, and Windows Server 2008), specific instructions for starting and 
+				stopping your Virtuoso server are supplied for each Windows family.</para>
 			<sect3 id="winnt">
-				<title>Windows NT/2000/XP</title>
+				<title>Windows NT family</title>
 				<para>You can start your Virtuoso server in one of two ways,
     automatically or manually, the default mode configured by your installer is Automatic.</para>
 				<sect4 id="winntautostart">
@@ -501,7 +621,7 @@ netstat -an | more
 				</sect4>
 			</sect3>
 			<sect3 id="win9x">
-				<title>Windows 95/98</title>
+				<title>Windows 95 family</title>
 				<para>You can start your Virtuoso server under Windows 95/98 in
     one of two ways, automatically or manually, the default mode configured by your installer
     is Automatic.</para>
@@ -534,16 +654,7 @@ virtuoso-odbc-f +instance demo +service start
 				</sect4>
 			</sect3>
 		</sect2>
-		<sect2 id="postinstsanitywin32">
-			<title>Post-Installation Sanity Check</title>
-			<para>A quick way to check that the database is running, is to point a browser to the
-			http port. The following example URLs will show the System Manager for
-			the default, and the demo Virtuoso databases:</para>
-			<programlisting>http://localhost:8889
-http://localhost:8890
-http://a_virtuoso_server.org:8890</programlisting>
-			<para>See the following Quick Start chapter for further ways to verify the database.</para>
-		</sect2>
+	
 		<sect2 id="CreatingDeletingServices">
 			<title>Creating and Deleting Virtuoso Services </title>
 			<para>At sometime you may need to have multiple Virtuoso server
@@ -693,14 +804,14 @@ isqlo <enter a valid ODBC Data Source Name></programlisting>
 	<!-- ############################################################# -->
 	<sect1 id="linuxinstall">
 		<title>Virtuoso for Linux (Enterprise Edition)</title>
-			<sect2 id="lindoyouwannamigrate">
+			<!--sect2 id="lindoyouwannamigrate">
 				<title>Existing Virtuoso 2.7 Users</title>
 				<para>You can migrate your existing Virtuoso servers to 3.0 using 
         the migration utility.  The Virtuoso database file structure has been considerably 
         altered between versions.  Please consult the 
         <link linkend="migrate27to30">Migration of Virtuoso from Version 2.7 to Version 3.0</link>
         section for more details.</para>
-			</sect2>
+			</sect2-->
 		<sect2 id="b4instlin">
 			<title>Before You Install</title>
 			<para>To ensure a smooth installation, please review the
@@ -1100,7 +1211,9 @@ one via e-mail; in case of difficulties please contact
 </listitem>
 </orderedlist>
 		</sect2>
-		<sect2 id="linpostchck">
+		
+		   <sect2 id="linuxinstpost"><title>Post Installation</title>  
+  <sect3 id="linuxinstpostsan">
 			<title>Post-Installation Sanity Check</title>
 			<para>A quick way to check that the database is running, is to point a browser to the
 			http port. The following example URLs will show the System Manager for
@@ -1108,8 +1221,23 @@ one via e-mail; in case of difficulties please contact
 			<programlisting>http://localhost:8889
 http://localhost:8890
 http://a_virtuoso_server.org:8890</programlisting>
-			<para>See the following Quick Start chapter for further ways to verify the database.</para>
+		</sect3>
+		<sect3 id="linuxinstposttrb"><title>Troubleshooting DB Startup Failures</title>  
+  <para><emphasis>Install failure</emphasis></para> 
+  <para>Check the .log file in:</para>
+<programlisting><![CDATA[
+$<Directory where Virtuoso is installed>/bin/virtuoso.log
+]]></programlisting>  
+ <para>in order to review the installed files binaries and databases (defaults) 
+ for issues if install fails.</para>
+   <para><emphasis>.lck existance</emphasis></para>   
+   <para>Check .log in case of .lck issue</para>
+   <para>Delete the .lck file and repeat the steps from above.</para>
+   <para><emphasis>.trx incompatiblity issue</emphasis></para>   
+   <para>Check .log in case of .trx incompatiblity issue</para>
+  </sect3>
 		</sect2>
+  
     <sect2 id="linautovirt"><title>Starting Virtuoso Automatically on Reboot</title>
 
     <para>Two files, named initd_startup.template and 
@@ -1155,14 +1283,14 @@ bash# cd /etc/rc5.d ; ln -s ../init.d/virtuoso S99virtuoso
 	</sect1>
 	<sect1 id="unxinstvirt">
 		<title>Virtuoso for Unix (Enterprise Edition)</title>
-			<sect2 id="unixdoyouwannamigrate">
+			<!--sect2 id="unixdoyouwannamigrate">
 				<title>Existing Virtuoso 2.7 Users</title>
 				<para>You can migrate your existing Virtuoso servers to 3.0 using 
         the migration utility.  The Virtuoso database file structure has been considerably 
         altered between versions.  Please consult the 
         <link linkend="migrate27to30">Migration of Virtuoso from Version 2.7 to Version 3.0</link>
         section for more details.</para>
-			</sect2>
+			</sect2-->
 		<sect2 id="b4instunx">
 			<title>Before You Install</title>
 			<para>To ensure a smooth installation, please review the
@@ -1544,7 +1672,9 @@ one via e-mail; in case of difficulties please contact
 </listitem>
 </orderedlist>
 		</sect2>
-		<sect2 id="postinstsanityunx">
+		
+   <sect2 id="unxinstvirtinstpost"><title>Post Installation</title>  
+  <sect3 id="unxinstvirtpost">
 			<title>Post-Installation Sanity Check</title>
 			<para>A quick way to check that the database is running, is to point a browser to the
 			http port. The following example URLs will show the System Manager for
@@ -1552,8 +1682,23 @@ one via e-mail; in case of difficulties please contact
 			<programlisting>http://localhost:8889
 http://localhost:8890
 http://a_virtuoso_server.org:8890</programlisting>
-			<para>See the following Quick Start chapter for further ways to verify the database.</para>
+		</sect3>
+		<sect3 id="unxinstvirtinstposttrb"><title>Troubleshooting DB Startup Failures</title>  
+  <para><emphasis>Install failure</emphasis></para> 
+  <para>Check the .log file in:</para>
+<programlisting><![CDATA[
+$<Directory where Virtuoso is installed>/bin/virtuoso.log
+]]></programlisting>  
+ <para>in order to review the installed files binaries and databases (defaults) 
+ for issues if install fails.</para>
+   <para><emphasis>.lck existance</emphasis></para>   
+   <para>Check .log in case of .lck issue</para>
+   <para>Delete the .lck file and repeat the steps from above.</para>
+   <para><emphasis>.trx incompatiblity issue</emphasis></para>   
+   <para>Check .log in case of .trx incompatiblity issue</para>
+  </sect3>
 		</sect2>
+
     <sect2 id="unxautovirt"><title>Starting Virtuoso Automatically on Reboot</title>
 
     <para>Two files, named initd_startup.template and 
@@ -1664,6 +1809,31 @@ $
 ]]></programlisting>
     </itemizedlist>
 </sect2>
+   <sect2 id="unixpersonainstallinstpost"><title>Post Installation</title>  
+  <sect3 id="unixpersonainstallpost">
+			<title>Post-Installation Sanity Check</title>
+			<para>A quick way to check that the database is running, is to point a browser to the
+			http port. The following example URLs will show the System Manager for
+			the default, and the demo Virtuoso databases:</para>
+			<programlisting>http://localhost:8889
+http://localhost:8890
+http://a_virtuoso_server.org:8890</programlisting>
+		</sect3>
+		<sect3 id="unixpersonainstallinstposttrb"><title>Troubleshooting DB Startup Failures</title>  
+  <para><emphasis>Install failure</emphasis></para> 
+  <para>Check the .log file in:</para>
+<programlisting><![CDATA[
+$<Directory where Virtuoso is installed>/bin/virtuoso.log
+]]></programlisting>  
+ <para>in order to review the installed files binaries and databases (defaults) 
+ for issues if install fails.</para>
+   <para><emphasis>.lck existance</emphasis></para>   
+   <para>Check .log in case of .lck issue</para>
+   <para>Delete the .lck file and repeat the steps from above.</para>
+   <para><emphasis>.trx incompatiblity issue</emphasis></para>   
+   <para>Check .log in case of .trx incompatiblity issue</para>
+  </sect3>
+  </sect2>
 <sect2 id="unixpersonainstallconfg">
     <title>Configuration</title>
     <itemizedlist>
@@ -1701,16 +1871,15 @@ page is presented:
 </sect1>
 <sect1 id="installmacosx"><title>Virtuoso for Mac OS X</title>
 
-			<sect2 id="macxdoyouwannamigrate">
+			<!--sect2 id="macxdoyouwannamigrate">
 				<title>Existing Virtuoso 2.7 Users</title>
 				<para>You can migrate your existing Virtuoso servers to 3.0 using 
         the migration utility.  The Virtuoso database file structure has been considerably 
         altered between versions.  Please consult the 
         <link linkend="migrate27to30">Migration of Virtuoso from Version 2.7 to Version 3.0</link>
         section for more details.</para>
-			</sect2>
+			</sect2-->
   <sect2 id="macosxbeforeuinst"><title>Before You Install</title>
-
   <para>Before installing the Virtuoso software for Mac OS X you must ensure
   that you have the correct package from the <ulink url="http://www.openlinksw.com/">OpenLink</ulink>
   Web Site.</para>
@@ -1847,6 +2016,36 @@ page is presented:
 
 	</sect2>
 
+   <sect2 id="macosxinstpost"><title>Post Installation</title>  
+  <sect3 id="macosxinstpostsan">
+		<title>Post-Installation Sanity Check</title>
+		<para>A quick way to check that the database is running, is to point a browser to the
+		http port. The following example URLs will show the System Manager for
+		the default, and the demo Virtuoso databases:</para>
+		<programlisting>http://localhost:8889
+http://localhost:8890
+http://a_virtuoso_server.org:8890</programlisting>
+	</sect3> 
+  <sect3 id="macosxinstposttrb"><title>Troubleshooting DB Startup Failures</title>  
+  <para><emphasis>Install failure</emphasis></para> 
+  <para>Check the .log files for the database etc. in order to review the installed files binaries and databases (defaults) 
+  for issues if install fails.</para>
+      <figure id="instmac" float="1">
+       <title>The .log file</title>
+       <graphic fileref="ui/instmac.png"/>
+     </figure>
+   <para><emphasis>.lck existance</emphasis></para>   
+   <para>Check .log in case of .lck issue</para>
+   <para>Delete the .lck file and repeat the steps from above.</para>
+   <para><emphasis>.trx incompatiblity issue</emphasis></para>   
+   <para>Check .log in case of .trx incompatiblity issue</para>
+      <figure id="instmac2" float="1">
+       <title>The .log file</title>
+       <graphic fileref="ui/instmac2.png"/>
+     </figure>
+  </sect3>
+  </sect2>
+  
 	<sect2 id="macosxodbcdsnconf"><title>Configuring an ODBC Data Source</title>
 
 	  <para>Launch the iODBC Administrator, assuming that you have the iODBC
@@ -1940,16 +2139,6 @@ page is presented:
 
 	</sect2>
 
-	<sect2 id="postinstsanitymac">
-		<title>Post-Installation Sanity Check</title>
-		<para>A quick way to check that the database is running, is to point a browser to the
-		http port. The following example URLs will show the System Manager for
-		the default, and the demo Virtuoso databases:</para>
-		<programlisting>http://localhost:8889
-http://localhost:8890
-http://a_virtuoso_server.org:8890</programlisting>
-		<para>See the following Quick Start chapter for further ways to verify the database.</para>
-	</sect2>
 	<sect2 id="defpasschgmac">
 		<title>Default passwords</title>
 		<para>See the following Quick Start chapter for very important information about
@@ -1962,4 +2151,3655 @@ http://a_virtuoso_server.org:8890</programlisting>
 
 </sect1>
 
+  <sect1 id="installvsgrid"><title>Virtuoso ADO.Net Data Grid Form Application</title>
+  <para>This section details the steps required to create a simple Visual Studio 2008 Windows Form
+application with associated DataGridView control for displaying data in selected tables from a Virtuoso
+database.</para>
+<orderedlist>
+  <listitem>Launch the Visual Studio 2008 SP1 IDE.
+    <figure id="insg1" float="1">
+      <title>Visual Studio</title>
+      <graphic fileref="ui/insg1.png"/>
+    </figure>
+  </listitem>
+  <listitem>Create a Web Application project by going to the File menu in Visual Studio and choosing New Project.
+  </listitem>
+  <listitem>When the New Project window appears, choose either Visual Basic or Visual C# as the programming language.
+  </listitem>
+  <listitem>Within the language category, click on Windows and select Windows Form Application from the right-hand panel.
+  </listitem>
+  <listitem>Choose a name for the project, for example VirtuosoDataGridApp, and click OK.
+    <figure id="insg5" float="1">
+      <title>name for the project</title>
+      <graphic fileref="ui/insg5.png"/>
+    </figure>
+  </listitem>
+  <listitem>From the Data, menu select the Show Data Sources menu item to display a list of available Data sources.
+    <figure id="insg6" float="1">
+      <title>Show Data Sources</title>
+      <graphic fileref="ui/insg6.png"/>
+    </figure>
+  </listitem>
+  <listitem>Click on the Add New Data Source link to add a new data source.
+    <figure id="insg7" float="1">
+      <title>Add New Data Source</title>
+      <graphic fileref="ui/insg7.png"/>
+    </figure>
+  </listitem>
+  <listitem>In the Data Source Configuration Wizard dialog  Choose Data Source Type page, select the Database data source type and click Next.
+    <figure id="insg8" float="1">
+      <title>Data Source Configuration Wizard</title>
+      <graphic fileref="ui/insg8.png"/>
+    </figure>
+  </listitem>
+  <listitem>In the Data Source Configuration Wizard dialog Choose your Data Connection page, select the New Connection button.
+    <figure id="insg9" float="1">
+      <title>Data Connection page</title>
+      <graphic fileref="ui/insg9.png"/>
+    </figure>
+  </listitem>
+  <listitem>In the Choose Data Source dialog, select OpenLink Virtuoso Data Source from the list and click Continue.
+    <figure id="insg10" float="1">
+      <title>OpenLink Virtuoso Data Source</title>
+      <graphic fileref="ui/insg10.png"/>
+    </figure>
+  </listitem>
+  <listitem>In the Add Connection dialog, specify the hostname, portno, username, and password
+for the target Virtuoso Server and check the Save Password check box.
+    <figure id="insg11" float="1">
+      <title>Add Connection dialog</title>
+      <graphic fileref="ui/insg11.png"/>
+    </figure>
+  </listitem>
+  <listitem>Select the Select Database From List radio button and choose School from the drop down list
+of available databases.
+    <figure id="insg12" float="1">
+      <title>Select Database From List</title>
+      <graphic fileref="ui/insg12.png"/>
+    </figure>
+  </listitem>
+  <listitem>Click the Test Connection button to verify the connection is successful and then
+click OK to add the connection.
+    <figure id="insg13" float="1">
+      <title>Test Connection</title>
+      <graphic fileref="ui/insg13.png"/>
+    </figure>
+  </listitem>
+  <listitem>Select the  Yes, include sensitive data in the connect string radio button and click Next to continue.
+    <figure id="insg14" float="1">
+      <title>connect string</title>
+      <graphic fileref="ui/insg14.png"/>
+    </figure>
+  </listitem>
+  <listitem>In the Choose your Database Objects dialog select the table and columns to be queried, the shippers table is used in this example.
+    <figure id="insg15" float="1">
+      <title>Choose your Database Objects</title>
+      <graphic fileref="ui/insg15.png"/>
+    </figure>
+  </listitem>
+  <listitem>A DataSet for the shippers database object is created
+    <figure id="insg16" float="1">
+      <title>shippers database</title>
+      <graphic fileref="ui/insg16.png"/>
+    </figure>
+  </listitem>
+  <listitem>From the drop down list box next to the Shippers table ensure the DataGridView item is selected
+    <figure id="insg17" float="1">
+      <title>DataGridView</title>
+      <graphic fileref="ui/insg17.png"/>
+    </figure>
+  </listitem>
+  <listitem>Drag the Shippers DataSet item onto the Form to create a scrollable and editable association of the Shippers table object with the Data Grid View automatically.
+    <figure id="insg18" float="1">
+      <title>Drag</title>
+      <graphic fileref="ui/insg18.png"/>
+    </figure>
+  </listitem>
+  <listitem>From the Debug Menu select the Start Debugging menu item to run the application.
+    <figure id="insg19" float="1">
+      <title>Debug</title>
+      <graphic fileref="ui/insg19.png"/>
+    </figure>
+  </listitem>
+  <listitem>The data in the Shippers table will be displayed in the DataGrid application created.
+    <figure id="insg20" float="1">
+      <title>DataGrid</title>
+      <graphic fileref="ui/insg20.png"/>
+    </figure>
+  </listitem>
+  <listitem>A new row can be inserted (updated or deleted) as indicated for the new DHL record inserted below and the  save button clicked to save the change to the database.
+    <figure id="insg21" float="1">
+      <title>new row</title>
+      <graphic fileref="ui/insg21.png"/>
+    </figure>
+  </listitem>
+  <listitem>The Virtuoso Interactive SQL tab of the Conductor can be used to run the query select * from Demo..Shippers.
+    <figure id="insg22" float="1">
+      <title>Interactive SQL tab</title>
+      <graphic fileref="ui/insg22.png"/>
+    </figure>
+  </listitem>
+  <listitem>To verify the change has been successfully made in the database.
+    <figure id="insg23" float="1">
+      <title>verify</title>
+      <graphic fileref="ui/insg23.png"/>
+    </figure>
+  </listitem>
+</orderedlist>
+  <para>The task is now complete.</para>
+</sect1>
+  <sect1 id="installvsent"><title>Using Visual Studio 2008 to Build an Entity Frameworks based Windows Form Application</title>
+    <formalpara><title>Virtuoso Entity Framework School DB Windows Form Application</title></formalpara>
+    <para>This section demonstrates how Visual Studio 2008 can be used to generate mapping files
+for an Entity Data Model (EDM), based on a 1:1 mapping to tables in the School database. This will be
+done by creating a Windows Forms application in Visual Studio, create queries that access data in the
+School model, bind the query results to display controls to show the results of the queries, and then
+make updates to objects and persist the changes to the database.</para>
+      <sect2 id="installvsentprereq">
+        <title>Pre-requisites</title>
+        <para>In order to create an Entity Framework Application in your own environment you will need:</para>
+        <orderedlist>
+          <listitem>Microsoft Visual Studio 2008 SP1, the ADO.NET Entity Framework runtime and associated tools are included in Visual Studio 2008 SP1.</listitem>
+          <listitem>A running Virtuoso Universal Server instance.</listitem>
+        </orderedlist>
+      </sect2>
+      <sect2 id="installvsentcreatedb">
+        <title>Create the School database and schema</title>
+        <orderedlist>
+          <listitem>Download the <ulink url="http://download.openlinksw.com/packages/5.0/virtuoso/schools_db_dav.vad">Schools Database</ulink> VAD (schools_db_dav.vad) package.</listitem>
+          <listitem>Navigate to the <emphasis>System Admin -> Packages</emphasis> tab of the Virtuoso Conductor.
+            <figure id="uado1" float="1">
+              <title>Conductor Packages</title>
+              <graphic fileref="ui/uado1.png"/>
+            </figure>
+          </listitem>
+          <listitem>Scroll down to the <emphasis>Install Package</emphasis> section of the tab, use the
+<emphasis>Upload Package</emphasis> option <emphasis>Browse</emphasis> button to locate the
+schools_db_dav.vad package and click <emphasis>proceed</emphasis>.
+             <figure id="uado2" float="1">
+               <title>Install package</title>
+               <graphic fileref="ui/uado2.png"/>
+             </figure>
+           </listitem>
+           <listitem>Click the <emphasis>Proceed</emphasis> button to begin the installation process.
+             <figure id="uado3" float="1">
+               <title>Install package.</title>
+               <graphic fileref="ui/uado3.png"/>
+             </figure>
+           </listitem>
+           <listitem>Once complete return to the <emphasis>Packages</emphasis> tab and scroll down to confirm the *schools_db* package is listed as installed.
+             <figure id="uado4" float="1">
+               <title>Install package</title>
+               <graphic fileref="ui/uado4.png"/>
+             </figure>
+           </listitem>
+        </orderedlist>
+        <para><emphasis>Create the Course Manager application using Visual Studio</emphasis></para>
+        <orderedlist>
+          <listitem>Launch the Visual Studio 2008 SP1 IDE.
+            <figure id="uados1" float="1">
+              <title>Visual Studio 2008 SP1 IDE</title>
+              <graphic fileref="ui/uados1.png"/>
+            </figure>
+          </listitem>
+          <listitem>On the <emphasis>File menu</emphasis> click <emphasis>New Project</emphasis>.
+          </listitem>
+          <listitem>Choose either <emphasis>Visual Basic</emphasis> or <emphasis>Visual C#</emphasis> in the
+<emphasis>Project Types</emphasis> pane.
+          </listitem>
+          <listitem>Select <emphasis>Windows Forms Application</emphasis> in the
+<emphasis>Templates</emphasis> pane.
+          </listitem>
+          <listitem>Enter <emphasis>CourseManager</emphasis> for the project name, and then
+click <emphasis>OK</emphasis>.
+            <figure id="uado5" float="1">
+              <title>Create project</title>
+              <graphic fileref="ui/uado5.png"/>
+            </figure>
+          </listitem>
+        </orderedlist>
+        <para><emphasis>Create the Course Viewer form</emphasis></para>
+        <orderedlist>
+          <listitem>In the <emphasis>CourseManager</emphasis> project, select the default form (Form1).
+          </listitem>
+          <listitem>In the <emphasis>File Properties</emphasis> pane, change the File Name to
+<emphasis>CourseViewer.vb</emphasis> or <emphasis>CourseViewer.cs</emphasis>.
+          </listitem>
+          <listitem>In <emphasis>Solution Explorer</emphasis>, double-click
+<emphasis>CourseViewer.vb</emphasis> or <emphasis>CourseViewer.cs</emphasis> to open the form.
+            <figure id="uado6" float="1">
+              <title>CourseViewer.vb</title>
+              <graphic fileref="ui/uado6.png"/>
+            </figure>
+          </listitem>
+          <listitem>In the <emphasis>Toolbox</emphasis>, expand <emphasis>Common Controls</emphasis>,
+drag the <emphasis>ComboBox</emphasis> control to the form, and change the name of the control to
+<emphasis>departmentList</emphasis>.
+          </listitem>
+          <listitem>In the <emphasis>Toolbox</emphasis>, drag the <emphasis>Button</emphasis>
+control to the form, change the <emphasis>Name</emphasis> of the control to <emphasis>closeForm</emphasis>,
+and change the <emphasis>Text value</emphasis> to <emphasis>Close</emphasis>.
+          </listitem>
+          <listitem>In the <emphasis>Toolbox</emphasis>, expand <emphasis>Data</emphasis>, drag the
+<emphasis>DataGridView</emphasis> control to the form, and change the <emphasis>Name</emphasis> of
+the control to <emphasis>courseGridView</emphasis>.
+            <figure id="uado7" float="1">
+              <title>DataGridView</title>
+              <graphic fileref="ui/uado7.png"/>
+            </figure>
+          </listitem>Double-click the <emphasis>closeForm</emphasis> button control. This opens
+the code page for the form and creates the closeForm_Click event handler method.
+          <listitem>In the <emphasis>closeForm_Click</emphasis> event handler method, type the following code that closes the form:
+<programlisting><![CDATA[
+Visual Basic
+
+' Close the form.
+Me.Close()
+
+C#
+
+// Close the form.
+this.Close();
+]]></programlisting>
+            </listitem>
+          </orderedlist>
+        </sect2>
+        <sect2 id="installvsentgenmodel">
+          <title>Generating the School Entity Data Mode</title>
+          <para><emphasis>Add the ADO.NET Entity Data Model item template</emphasis></para>
+          <orderedlist>
+            <listitem>Select the CourseManager project in Solution Explorer, right-click, point to Add, and then click New Item.</listitem>
+            <listitem>Select ADO.NET Entity Data Model in the Templates pane.</listitem>
+            <listitem>Type School.edmx for the model name and click Add. The opening page of the Entity Data Model Wizard is displayed.
+              <figure id="uado8" float="1">
+                <title>School.edmx</title>
+                <graphic fileref="ui/uado8.png"/>
+              </figure>
+            </listitem>
+          </orderedlist>
+          <para><emphasis>Generate the EDM</emphasis></para>
+          <orderedlist>
+            <listitem>Select <emphasis>Generate from database</emphasis> in the
+<emphasis>Choose Model Contents dialog box</emphasis>. Then click <emphasis>Next</emphasis>.
+              <figure id="uado9" float="1">
+                <title>Model Contents</title>
+                <graphic fileref="ui/uado9.png"/>
+              </figure>
+            </listitem>
+            <listitem>Click the <emphasis>New Connection</emphasis> button.
+              <figure id="uado10" float="1">
+                <title>New Connection</title>
+                <graphic fileref="ui/uado10.png"/>
+              </figure>
+            </listitem>
+            <listitem>Choose the OpenLink <emphasis>Virtuoso Data Source</emphasis> and click
+<emphasis>Continue</emphasis>.
+              <figure id="uado11" float="1">
+                <title>Virtuoso Data Source</title>
+                <graphic fileref="ui/uado11.png"/>
+              </figure>
+            </listitem>
+            <listitem>In the <emphasis>Connection Properties</emphasis> dialog specify the
+<emphasis>hostname, portno, username and password</emphasis> for the target Virtuoso Server and click the
+<emphasis>Advanced</emphasis> button.
+             <figure id="uado12" float="1">
+               <title>Connection Properties</title>
+               <graphic fileref="ui/uado12.png"/>
+             </figure>
+           </listitem>
+           <listitem>In the <emphasis>Advanced Properties</emphasis> dialog set the
+<emphasis>Database parameter</emphasis> to <emphasis>School</emphasis> and click OK.
+             <figure id="uado13" float="1">
+               <title>Advanced Properties</title>
+               <graphic fileref="ui/uado13.png"/>
+             </figure>
+           </listitem>
+           <listitem>Press the <emphasis>Test Connection</emphasis> dialog to verify the database is accessible.
+             <figure id="uado14" float="1">
+               <title>Test Connection</title>
+               <graphic fileref="ui/uado14.png"/>
+             </figure>
+           </listitem>
+           <listitem>Set the <emphasis>entity connect string name</emphasis> to
+<emphasis>SchoolEntities</emphasis> and click <emphasis>Next</emphasis>.
+             <figure id="uado15" float="1">
+               <title>entity connect string name</title>
+               <graphic fileref="ui/uado15.png"/>
+             </figure>
+           </listitem>
+           <listitem>In the <emphasis>Choose your Database Objects</emphasis> page select the
+<emphasis>Tables</emphasis> check box to select all table in the <emphasis>School database</emphasis>
+for addition to the EDM, set the <emphasis>Model Namespace</emphasis> to <emphasis>SchoolModel</emphasis>
+and click <emphasis>Finish</emphasis>.
+            <figure id="uado16" float="1">
+              <title>Database Objects</title>
+              <graphic fileref="ui/uado16.png"/>
+            </figure>
+          </listitem>
+        </orderedlist>
+        <para><emphasis>View the EDM in the ADO.NET Entity Data Model Designer</emphasis></para>
+        <orderedlist>
+          <listitem>In the <emphasis>Solution Explorer</emphasis>, double-click the
+<emphasis>School.edmx</emphasis> file. This displays the School model in the ADO.NET Entity Data Model Designer window.
+            <figure id="uado17" float="1">
+              <title>Solution Explorer</title>
+              <graphic fileref="ui/uado17.png"/>
+            </figure>
+          </listitem>
+          <listitem>From the <emphasis>View</emphasis> menu, select <emphasis>Other Windows</emphasis>,
+and then click <emphasis>Model Browser</emphasis> to display the <emphasis>Entity Model Browser</emphasis> window.
+          </listitem>
+          <listitem>Expand the <emphasis>SchoolModel</emphasis> and <emphasis>SchoolModel.Store</emphasis> nodes to view conceptual and store definitions, respectively.
+            <figure id="uado20" float="1">
+              <title>SchoolModel</title>
+              <graphic fileref="ui/uado20.png"/>
+            </figure>
+          </listitem>
+          <listitem>From the <emphasis>View menu</emphasis>, select <emphasis>Other Windows</emphasis>,
+click <emphasis>Mapping Details</emphasis>, and then click an entity (Person for example) or association in the Entity Designer.
+            </listitem>
+            <listitem>This displays the Entity Mapping Details window with information about the object-relational mapping for the selected object.
+              <figure id="uado21" float="1">
+                <title>View menu</title>
+                <graphic fileref="ui/uado21.png"/>
+              </figure>
+            </listitem>
+          </orderedlist>
+        </sect2>
+        <sect2 id="installvsentqueryentity">
+          <title>Querying Entities and Associations</title>
+          <para>This section creates strongly-typed queries against the CLR objects that represent entities and associations in the School model, and bind display controls to the object collections returned from these queries.</para>
+          <para><emphasis>Query the departments in the School database</emphasis></para>
+          <orderedlist>
+            <listitem>At the beginning of the code file for the <emphasis>CourseViewer</emphasis> form,
+add the following <emphasis>using</emphasis> (C#) or <emphasis>Imports</emphasis> (Visual Basic) statements to reference the model created from the School database and the entity namespace.
+<programlisting><![CDATA[
+Visual Basic
+
+Imports System.Data.Objects
+Imports System.Data.Objects.DataClasses
+
+C#
+
+using System.Data.Objects;
+using System.Data.Objects.DataClasses;
+]]></programlisting>
+            </listitem>
+            <listitem>At the top of the partial class definition for the <emphasis>CourseViewer</emphasis>
+form, add the following code that creates an <emphasis>ObjectContext</emphasis> instance.
+<programlisting><![CDATA[
+Visual Basic
+
+' Create an ObjectContext instance based on SchoolEntity.
+Private schoolContext As SchoolEntities
+
+C#
+
+// Create an ObjectContext instance based on SchoolEntity.
+private SchoolEntities schoolContext;
+]]></programlisting>
+            </listitem>
+            <listitem>In the <emphasis>CourseViewer</emphasis> form designer, double-click
+the <emphasis>CourseViewer</emphasis> form. This opens the code page for the form and creates the
+<emphasis>courseViewer _Load</emphasis> event handler method.</listitem>
+            <listitem>In the <emphasis>courseViewer _Load</emphasis> event handler method, copy
+and paste the following code that defines the <emphasis>DataGridView</emphasis>, executes a query
+that returns a collection of departments (ordered by <emphasis>Name</emphasis>), and binds the
+collection of <emphasis>Department</emphasis> objects to the departmentList control.
+<programlisting><![CDATA[
+Visual Basic
+
+' Initialize the ObjectContext.
+schoolContext = New SchoolEntities()
+
+' Define a query that returns all Department objects and related
+' Course objects, ordered by name.
+Dim departmentQuery As ObjectQuery(Of Department) = _
+    schoolContext.Department.Include("Course").OrderBy("it.Name")
+
+Try
+    ' Bind the ComboBox control to the query, which is
+    ' executed during data binding.
+    Me.departmentList.DisplayMember = "Name"
+    Me.departmentList.DataSource = departmentQuery
+Catch ex As Exception
+    MessageBox.Show(ex.Message)
+End Try
+
+C#
+
+// Initialize the ObjectContext.
+schoolContext = new SchoolEntities();
+
+// Define a query that returns all Department objects and related
+// Course objects, ordered by name.
+ObjectQuery<Department> departmentQuery =
+    schoolContext.Department.Include("Course").OrderBy("it.Name");
+
+try
+{
+    // Bind the ComboBox control to the query, which is
+    // executed during data binding.
+    this.departmentList.DisplayMember = "Name";
+    this.departmentList.DataSource = departmentQuery;
+}
+catch (Exception ex)
+{
+    MessageBox.Show(ex.Message);
+}
+]]></programlisting>
+          </listitem>
+        </orderedlist>
+        <para><emphasis>Display courses for the selected department</emphasis></para>
+        <orderedlist>
+          <listitem>In the <emphasis>CourseViewer</emphasis> form designer, double-click the
+<emphasis>departmentList</emphasis> control. This creates the <emphasis>departmentList_SelectedIndexChanged</emphasis> event handler method.</listitem>
+          <listitem>Paste the following code that loads the courses that are related to the selected department.
+<programlisting><![CDATA[
+Visual Basic
+
+Try
+    ' Get the object for the selected department.
+    Dim department As Department = _
+        CType(Me.departmentList.SelectedItem, Department)
+
+    ' Bind the grid view to the collection of Course objects
+    ' that are related to the selected Department object.
+    courseGridView.DataSource = department.Course
+
+    ' Hide the columns that are bound to the navigation properties on Course.
+    courseGridView.Columns("Department").Visible = False
+    courseGridView.Columns("CourseGrade").Visible = False
+    courseGridView.Columns("OnlineCourse").Visible = False
+    courseGridView.Columns("OnsiteCourse").Visible = False
+    courseGridView.Columns("Person").Visible = False
+
+    courseGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells)
+Catch ex As Exception
+    MessageBox.Show(ex.Message)
+End Try
+
+C#
+
+try
+{
+    // Get the object for the selected department.
+    Department department =
+        (Department)this.departmentList.SelectedItem;
+
+    // Bind the grid view to the collection of Course objects
+    // that are related to the selected Department object.
+    courseGridView.DataSource = department.Course;
+
+    // Hide the columns that are bound to the navigation properties on Course.
+    courseGridView.Columns["Department"].Visible = false;
+    courseGridView.Columns["CourseGrade"].Visible = false;
+    courseGridView.Columns["OnlineCourse"].Visible = false;
+    courseGridView.Columns["OnsiteCourse"].Visible = false;
+    courseGridView.Columns["Person"].Visible = false;
+
+    courseGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
+}
+catch (Exception ex)
+{
+    MessageBox.Show(ex.Message);
+}
+]]></programlisting>
+            </listitem>
+          </orderedlist>
+        </sect2>
+        <sect2 id="installvsentinsertandupdate">
+          <title>Inserting and Updating Data</title>
+          <para>In this section the changes made to Course objects bound are saved to the DataGridView control to the database and also run the completed Course Manager application.</para>
+          <para><emphasis>Save changes made to objects</emphasis></para>
+          <orderedlist>
+            <listitem>In the <emphasis>Toolbox</emphasis>, expand <emphasis>Common Controls</emphasis>,
+drag the <emphasis>Button</emphasis> control to the <emphasis>CourseViewer</emphasis> form designer,
+change the <emphasis>name</emphasis> of the control to <emphasis>saveChanges</emphasis>, and change the
+<emphasis>Text</emphasis> value to <emphasis>Update</emphasis>.</listitem>
+            <listitem>In the <emphasis>CourseViewer</emphasis> form designer, double-click the
+<emphasis>saveChanges</emphasis> control. This creates the <emphasis>saveChanges_Click</emphasis> event handler method.
+            </listitem>
+            <listitem>Paste the following code that saves object changes to the database.
+<programlisting><![CDATA[
+Visual Basic
+
+Try
+    ' Save object changes to the database, display a message,
+    ' and refresh the form.
+    schoolContext.SaveChanges()
+    MessageBox.Show("Changes saved to the database.")
+    Me.Refresh()
+Catch ex As Exception
+    MessageBox.Show(ex.Message)
+End Try
+
+C#
+
+try
+{
+    // Save object changes to the database, display a message,
+    // and refresh the form.
+    schoolContext.SaveChanges();
+    MessageBox.Show("Changes saved to the database.");
+    this.Refresh();
+}
+catch (Exception ex)
+{
+    MessageBox.Show(ex.Message);
+}
+]]></programlisting>
+            </listitem>
+            <listitem>In the <emphasis>closeForm_Click</emphasis> event handler method, type the
+following code. This code disposes of the object context before the form is closed.
+<programlisting><![CDATA[
+Visual Basic
+
+   ' Dispose the object context.
+    schoolContext.Dispose()
+
+C#
+
+    // Dispose the object context.
+    schoolContext.Dispose();
+]]></programlisting>
+          </listitem>
+        </orderedlist>
+        <para><emphasis>Build and run the Class Scheduling application</emphasis></para>
+        <orderedlist>
+          <listitem>From the <emphasis>Debug</emphasis> menu, select
+<emphasis>Start Debugging</emphasis> or <emphasis>Start Without Debugging</emphasis>, to build and
+run the application.</listitem>
+          <listitem>When the form loads, select a department from the <emphasis>ComboBox</emphasis>
+control to display the courses that belong to that department.
+          <figure id="uado18" float="1">
+            <title>ComboBox</title>
+            <graphic fileref="ui/uado18.png"/>
+          </figure>
+        </listitem>
+        <listitem>In the <emphasis>DataGridView</emphasis>, update course information or add a
+new course and then click <emphasis>Update</emphasis> to save changes to the database and displays a
+message box that declares the number of saved changes.
+          <figure id="uado19" float="1">
+            <title>DataGridView</title>
+            <graphic fileref="ui/uado19.png"/>
+          </figure>
+        </listitem>
+      </orderedlist>
+      <para>The process is now complete</para>
+    </sect2>
+  </sect1>
+  <sect1 id="installusado"><title>Using Visual Studio 2008 to Build an ADO.NET Data Services based Application</title>
+    <formalpara><title>Using Microsoft ADO.Net Data Services with Virtuoso</title></formalpara>
+    <sect2 id="installusadointro">
+      <title>Introduction</title>
+      <para>The goal of Microsoft ADO.NET Data Services is to enable applications to expose data as a
+data service that can be consumed by web clients within corporate networks and across the internet. A data
+service is reachable via regular HTTP requests, using standard HTTP verbs such as GET, POST, PUT and DELETE
+to perform CRUD operations against the service. The payload format used by the service is controllable by the
+application, but all options are simple, open formats such as JSON and Atom/APP.
+      </para>
+      <para>The use of web-friendly technologies make ADO.NET Data Services ideal as a data back-end
+for AJAX-style applications, Rich Interactive Applications and other applications that need to operate
+against data that is stored across the web.
+      </para>
+    </sect2>
+    <sect2 id="installusadogetstart">
+      <title>Getting Started: Creating Data Services</title>
+      <para><emphasis>Pre-requisites</emphasis></para>
+      <para>In order to create a data service using ADO.NET Data Services in your own environment you
+will need Microsoft Visual Studio 2008 SP1. The ADO.NET Entity Framework runtime and associated tools are
+included in Visual Studio 2008 SP1.
+      </para>
+      <para><emphasis>Selecting a Data Source</emphasis></para>
+      <para>The ADO.NET Data Service server framework is comprised of two halves. The top-half is the
+runtime itself; this part is "fixed", and it implements URI translation, the Atom/JSON wire formats, the
+interaction protocol, etc. This is what makes an ADO.NET Data Service look like an ADO.NET Data Service.
+The bottom half is the data-access layer and is pluggable. Communication between layers happens in terms
+of the IQueryable interface plus a set of conventions to map CLR graphs into the URI/payload patterns
+of ADO.NET Data Services.
+      </para>
+      <para>The first step in creating an ADO.NET Data Service is to determine the data source that
+is to be exposed as a set of REST-based endpoints (ie. select or create a data access layer). For relational
+data stored in Microsoft SQL Server or other 3rd Party databases, ADO.NET Data Services currently enables
+easily exposing a conceptual model created using the ADO.NET Entity Framework (EF). For all other data
+sources (XML section, web service, application logic layer, etc) or to use additional database access
+technologies (ex. LINQ to SQL), a mechanism is provided which enables any data source, as per the plug-in
+model described above, to be exposed as an ADO.NET Data Service.
+      </para>
+      <para>To create a data service which exposes a relational database through an Entity Framework
+conceptual model see "Creating a Data Service using the ADO.NET Entity Framework". To create a data service
+which exposes another data source see "Creating a Data Service from any Data Source".
+      </para>
+    </sect2>
+    <sect2 id="installusadocreateservice">
+      <title>Creating a Data Service using the ADO.NET Entity Framework</title>
+      <para>ADO.NET Data Services are a specialized form of Windows Communication Foundation services,
+and thus can be hosted in various environments. The below example will create an ADO.NET Data Service which
+is hosted inside an ASP.NET site. In order to create a data service, you must first create a web project;
+you will then need to establish a connection with the database that will be exposed by the service, and
+then create the data service itself within the web application. Below is a step-by-step description of
+this process.
+      </para>
+      <para>The following steps can be used for creating a Data Service using the Virtuoso ADO.Net
+Provider for accessing the sample Northwind Demo database:
+      </para>
+      <orderedlist>
+        <listitem>Launch the Visual Studio 2008 SP1 IDE.
+          <figure id="ados1" float="1">
+            <title>Visual Studio 2008 SP1 IDE.</title>
+            <graphic fileref="ui/dora1.png"/>
+          </figure>
+        </listitem>
+        <listitem>Create a <emphasis>Web Application</emphasis> project by going to the
+<emphasis>File</emphasis> menu in Visual Studio and choosing <emphasis>New Project</emphasis>.
+        </listitem>
+        <listitem>When the New Project window appears, choose either <emphasis>Visual Basic</emphasis>
+or <emphasis>Visual C#</emphasis> as the programming language.
+        </listitem>
+        <listitem>Within the language category click on <emphasis>Web</emphasis>, and select <emphasis>ASP.NET Web Application</emphasis> from the right-hand panel.
+        </listitem>
+        <listitem>Choose a name for the project, for example <emphasis>VirtuosoDataService</emphasis>, and click <emphasis>OK</emphasis>.
+          <figure id="ados2" float="1">
+            <title>Name project</title>
+            <graphic fileref="ui/eora2.png"/>
+          </figure>
+        </listitem>
+        <listitem>This will create a new project called <emphasis>VirtuosoDataService</emphasis>.
+          <figure id="ados3" float="1">
+            <title>Create project</title>
+            <graphic fileref="ui/eora3.png"/>
+          </figure>
+        </listitem>
+        <listitem>Right click on the <emphasis>VirtuosoDataService</emphasis> project name of the
+Solution Explorer pane, then select the <emphasis>Add -> New Item</emphasis> menu options.
+          <figure id="ados4" float="1">
+            <title>New Item</title>
+            <graphic fileref="ui/einf4.png"/>
+          </figure>
+        </listitem>
+        <listitem>The <emphasis>Add</emphasis> New Item dialog will appear, choose the
+<emphasis>ADO.NET Entity Data Model</emphasis> template, give it the name <emphasis>Virtuoso.edmx</emphasis>
+and click <emphasis>Add</emphasis> to start the creation of the ADO.Net Entity Data Model.
+          <figure id="ados5" float="1">
+            <title>Entity Model</title>
+            <graphic fileref="ui/eora5.png"/>
+          </figure>
+        </listitem>
+        <listitem>In the <emphasis>Entity Data Model Wizard</emphasis> dialog
+<emphasis>Choose Model Contents</emphasis> page select the <emphasis>Generate from Database</emphasis> model
+type and click <emphasis>Next</emphasis>.
+          <figure id="ados6" float="1">
+            <title>Model Contents</title>
+            <graphic fileref="ui/eora6.png"/>
+          </figure>
+        </listitem>
+        <listitem>In the <emphasis>Entity Data Model Wizard</emphasis> dialog
+<emphasis>Choose your Data Connection</emphasis> page select the <emphasis>New Connection</emphasis> button
+          <figure id="ados7" float="1">
+            <title>Data Connection</title>
+            <graphic fileref="ui/ados7.png"/>
+          </figure>
+        </listitem>
+        <listitem>In the <emphasis>Choose Data Source</emphasis> dialog, select the
+OpenLink <emphasis>Virtuoso Data Source</emphasis> from the list displayed and click <emphasis>Continue</emphasis>.
+          <figure id="ados8" float="1">
+            <title>Data Source</title>
+            <graphic fileref="ui/dora9.png"/>
+          </figure>
+        </listitem>
+        <listitem>In the <emphasis>Add Connection</emphasis> dialog, specify the
+<emphasis>hostname, portno, username and password</emphasis> for the target Virtuoso Server and check the <b>Save Password</b> check box.
+          <figure id="ados9" float="1">
+            <title>Connection Properties</title>
+            <graphic fileref="ui/dora10.png"/>
+          </figure>
+        </listitem>
+        <listitem>Select the <emphasis>Select Database From List</emphasis> radio button and choose
+<emphasis>Demo</emphasis> from the drop down list, assuming the Virtuoso Demo Database is installed.
+          <figure id="ados10" float="1">
+            <title>Advanced Properties</title>
+            <graphic fileref="ui/ados10.png"/>
+          </figure>
+        </listitem>
+        <listitem>Click the <emphasis>Test Connection</emphasis> button to verify the connection is
+successful and then click OK to add the connection.
+          <figure id="ados11" float="1">
+            <title>Test Connection</title>
+            <graphic fileref="ui/ados11.png"/>
+          </figure>
+        </listitem>
+        <listitem>Set the <emphasis>entity connect string</emphasis> name to
+<emphasis>VirtuosoDemoEntities</emphasis> (note this name as it is required in step 17 below)
+and click <emphasis>Next</emphasis>.
+          <figure id="ados12" float="1">
+            <title>entity connect string</title>
+            <graphic fileref="ui/ados12.png"/>
+          </figure>
+        </listitem>
+        <listitem>In the <emphasis>Choose your Database Objects</emphasis>
+page select the <emphasis>Tables</emphasis> check box to select all tables in the Demo database for
+addition to the Entity Data Model, set the <emphasis>Model Namespace</emphasis> to
+<emphasis>VirtuosoDemoModel</emphasis> and click <emphasis>Finish</emphasis>.
+          <figure id="ados13" float="1">
+            <title>Database Objects</title>
+            <graphic fileref="ui/ados13.png"/>
+          </figure>
+        </listitem>
+        <listitem>The <emphasis>Virtuoso.edmx</emphasis> EDM will be created with the tables and relationships displayed in the Visual Studio IDE
+          <figure id="ados14" float="1">
+            <title>Virtuoso.edmx</title>
+            <graphic fileref="ui/ados14.png"/>
+         </figure>
+        </listitem>
+        <listitem>Right click on the <emphasis>VirtuosoDataService</emphasis> project name of the
+<emphasis>Solution Explorer pane</emphasis>, then select the <emphasis>Add -> New Item</emphasis> menu options.
+          <figure id="ados4" float="1">
+            <title>New Item</title>
+            <graphic fileref="ui/ados4.png"/>
+          </figure>
+        </listitem>
+        <listitem>The <emphasis>Add New Item</emphasis> dialog will appear, choose the
+<emphasis>ADO.NET Data Service</emphasis> template, give it the name <emphasis>Virtuoso.svc</emphasis> and
+click <emphasis>Add</emphasis> to create the ADO.Net Data Service.
+          <figure id="ados15" float="1">
+            <title>ADO.NET Data Service</title>
+            <graphic fileref="ui/ados15.png"/>
+          </figure>
+        </listitem>
+        <listitem>In the <emphasis>Virtuoso.svc.cs</emphasis> Data Service file created add the
+data source class name of <emphasis>VirtuosoDemoEntities</emphasis> (note this is the name set in step 12)
+as the <emphasis>DataService</emphasis> name and enable the access to the Data Service by adding
+the entry <emphasis>config.SetEntitySetAccessRule("*", EntitySetRights.All);</emphasis> in the
+<emphasis>InitializeService</emphasis> method.
+<programlisting><![CDATA[
+// C#
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.ServiceModel.Web;
+using System.Linq;
+using System.Data.Services;
+
+namespace SimpleDataService
+{
+    public class Northwind : DataService<VirtuosoDemoEntities>
+    {
+        public static void InitializeService(IDataServiceConfiguration  config)
+        {
+            config.SetEntitySetAccessRule("*", EntitySetRights.All);
+        }
+    }
+}
+]]></programlisting>
+          <figure id="ados16" float="1">
+            <title>Data Service</title>
+            <graphic fileref="ui/ados16.png"/>
+          </figure>
+        </listitem>
+        <listitem>To test the Data Service, simply hit <emphasis>Ctrl+F5</emphasis> within Visual Studio, which will start the development web server, run the Data Services server inside and load a Web browser page displaying the list of available tables/entities of the Demo database.
+          <figure id="ados17" float="1">
+            <title>test the Data Service</title>
+            <graphic fileref="ui/ados17.png"/>
+          </figure>
+        </listitem>
+        <listitem>To access a specific entity instance like the <emphasis>Customers</emphasis> table
+<emphasis>ALFKI</emphasis> record, this would be specified as http://host/vdir/Virtuoso.svc/Customers('ALFKI') .
+            <figure id="ados18" float="1">
+              <title>Access a specific entity instance</title>
+              <graphic fileref="ui/ados18.png"/>
+            </figure>
+         </listitem>
+        </orderedlist>
+        <para><emphasis>NOTES</emphasis></para>
+        <orderedlist>
+          <listitem><emphasis>Important</emphasis> - To view <emphasis>Atom</emphasis> (the default
+format returned by an ADO.NET Data Service) in Internet Explorer, you must first ensure that
+<emphasis>Feed Reading View</emphasis> is turned <emphasis>off</emphasis>. This can be done on
+the <emphasis>Content tab</emphasis> of <emphasis>Tools in Internet Options</emphasis>.
+          </listitem>
+          <listitem>If a Data Services entity instance URI page fails to load you can turn
+<emphasis>Verbose</emphasis> errors on by adding <emphasis>config.UseVerboseErrors = true;</emphasis>
+in the <emphasis>virtuoso.svc.cs InitializeService</emphasis> method to obtain more detailed
+information from the server as to why the page failed to load:
+<programlisting><![CDATA[
+public static void InitializeService(IDataServiceConfiguration config)
+
+{
+
+config.UseVerboseErrors = true;
+
+config.SetEntitySetAccessRule("*", EntitySetRights.All);
+
+}
+]]></programlisting>
+          </listitem>
+        </orderedlist>
+      </sect2>
+  </sect1>
+
+<sect1 id="installwfas"><title>Windows Form Application for accessing Virtuoso RDF data via SPASQL using the Virtuoso ADO.Net Provider</title>
+    <para>This section will guide you through creating a simple application that allows you to access RDF
+data in a Virtuoso database as an Entity DataSet and explore that RDF data in an intuitive way by clicking
+on dereferenceable <link linkend="rdfiriidtype">IRIs</link>.</para>
+    <sect2 id="installwfasintro">
+      <title>Pre-requisites</title>
+<orderedlist>
+  <listitem>Microsoft Visual Studio 2008</listitem>
+  <listitem>The Virtuoso ADO.Net provider for .Net 3.5 and the Entity Framework.</listitem>
+  <listitem>The example assumes that you have a local Virtuoso server with the Northwind demo database
+installed. If the demo database is not already installed then download the <ulink url="http://download.openlinksw.com/packages/5.0/virtuoso/demo_dav.vad">demo database VAD package</ulink>
+(demo_dav.vad) and install it. The VAD package will create a new database in Virtuoso called demo
+containing the familiar Northwind tables. It will also creates <ulink url="http://docs.openlinksw.com/virtuoso/rdfsparqlintegrationmiddleware.html#rdfviews">RDF views</ulink> of the Northwind tables.
+In the example we assume the database is accessible on a hostname of "demo.openlinksw.com" on the
+default port 80, where an actually live instance of the Virtuoso Demo database is hosted. Users would
+use the appropriate hostname and port number of their Virtuoso installation to create the sample
+application, and would be would be localhost:8890 for a default installation or whatever the <link linkend="ini_URIQA">URIQA DefaultHost</link>
+Virtuoso configuration parameter is set to when the demo database VAD package is installed.
+  </listitem>
+</orderedlist>
+    </sect2>
+    <sect2 id="installwfasgetstart">
+      <title>Creating the Application</title>
+      <para><emphasis>Step 1 - Create a view of the RDF data.</emphasis></para>
+      <para>We want to be able to access the RDF data in Visual Studio and the easiest way to do this is to
+create a view of the data that we are interested in and bind that view to a DataSet. This can be considered
+as using server side <link linkend="rdfsparql">SPARQL</link>. Virtuoso supports an
+<link linkend="rdfsparqlinline">extension to standard SQL that allows</link> execution of SPARQL.
+If a SQL query begins with the keyword SPARQL then the rest of the query is interpreted by as SPARQL.
+If a SPARQL query is used as the definition of a view then that view can be manipulated using SQL like
+any other view. In this way the result set from a SPARQL query can be easily accessed from Visual Studio
+using ADO.Net and the Entity Framework.
+      </para>
+      <para>
+To create a view of the customers in the Northwind first open the Virtuoso Conductor and log in as dba.
+Then open iSQL from the menu on the left and execute the following statement.
+      </para>
+<programlisting><![CDATA[
+
+CREATE VIEW Demo.demo.sparqlview as
+SPARQL
+PREFIX nwind: <http://demo.openlinksw.com/schemas/northwind#>
+SELECT DISTINCT  ?s
+FROM <http://demo.openlinksw.com/Northwind>
+WHERE {?s a nwind:Customer}
+]]></programlisting>
+<para>
+<emphasis>Note:</emphasis> If the view is added to the Visual Studio project as user "demo" (or any other
+than "dba'), then it must be ensured that the "SPARQL_SELECT" and "SPARQL_SPONGE" roles are assigned to
+this user, which can be done via the Virtuoso Conductor in the "System Admin" -> "User Accounts" tab.
+</para>
+    <figure id="sparqlwinf1" float="1">
+      <title>SPARQL_SPONGE</title>
+      <graphic fileref="ui/sparqlwinf1.png"/>
+    </figure>
+      <para><emphasis>Step 2 - Create a simple grid form in Visual Studio</emphasis></para>
+<orderedlist>
+  <listitem>Open <emphasis>Visual Studio</emphasis> and create a new <emphasis>Windows Forms Application</emphasis> called RDFDemo.</listitem>
+  <listitem>In the <emphasis>Form Designer</emphasis> drag a <emphasis>DataGridView</emphasis> on to the form.</listitem>
+  <listitem>Click the <emphasis>Choose Data Source</emphasis> drop down and select <emphasis>Add Project Data Source</emphasis>.
+    <figure id="sparqlwinf2" float="1">
+      <title>Data Source</title>
+      <graphic fileref="ui/sparqlwinf2.png"/>
+    </figure>
+  </listitem>
+  <listitem>In the <emphasis>Data Source Configuration Wizard</emphasis> choose Database and then set up a connection to the demo database on your local Virtuoso server. </listitem>
+  <listitem>On the <emphasis>Choose Your Data Objects</emphasis> page expand the <emphasis>Views</emphasis> and select sparqlview.
+    <figure id="sparqlwinf3" float="1">
+      <title>Data Source Configuration Wizard</title>
+      <graphic fileref="ui/sparqlwinf3.png"/>
+    </figure>
+  </listitem>
+  <listitem>Click <emphasis>Finish</emphasis>.</listitem>
+  <listitem>In the <emphasis>Form Designer</emphasis> select dataGridView1 and change the <emphasis>AutoSizeColumnsMode</emphasis> to AllCellsExceptHeader.</listitem>
+  <listitem>Select the <emphasis>DefaultCellStyle</emphasis> and click on the ellipsis. This will open the
+<emphasis>CellStyleBuilder</emphasis>. Change the <emphasis>ForeColor</emphasis> to Blue.
+    <figure id="sparqlwinf4" float="1">
+      <title>CellStyleBuilder</title>
+      <graphic fileref="ui/sparqlwinf4.png"/>
+    </figure>
+  </listitem>
+  <listitem>Expand <emphasis>Font</emphasis> and change <emphasis>Underline</emphasis> to True.
+Click <emphasis>OK</emphasis>.</listitem>
+</orderedlist>
+      <para><emphasis>Step 3 - Change the mapping of the DataSet.</emphasis></para>
+<para>In the Solution Explorer you will now have a DataSet called DemoDataSet.xsd. If you double click on
+this it opens the DataSet Designer. Select the column called s in the sparqlview table and in the Properties
+pane change the DataType from System.String to System.Object.</para>
+<para>The data returned by a SPARQL query can either be an <link linkend="rdfiriidtype">IRI</link> or a
+literal value. In order to distinguish between the two the Virtuoso ADO.Net provider defines an additional
+data type, SQLExtendedString. By setting the column type to System.Object we can cast the fetched data back
+to SQLExtendedString and find out if an individual value is an IRI or a literal and handle it appropriately.
+</para>
+<para><emphasis>Step 4 - Create the on_click event handler for the cells in the DataGridView.</emphasis></para>
+<para>Return to the <emphasis>Form Designer</emphasis> and double click on the cell of the
+<emphasis>DataGridView</emphasis>. This creates the <emphasis>dataGridView1_CellContentClick</emphasis> method in Form1.cs. This is the method that handles clicking on IRI objects in the grid.
+</para>
+<para>Paste in the following block of code into the body of the <emphasis>dataGridView1_CellContentClick</emphasis> method.
+</para>
+<programlisting><![CDATA[
+int column = e.ColumnIndex;
+ object o = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
+ Type t = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].ValueType;
+
+ if (o is SqlExtendedString)
+ {
+     SqlExtendedString se = (SqlExtendedString) o;
+     ExtendedStringHandler seHandler = new ExtendedStringHandler(se, this.sparqlviewTableAdapter.Connection);
+     seHandler.displayData();
+ }
+ else if (o is SqlRdfBox)
+ {
+     //doesn't do anything at the moment
+ }
+
+]]></programlisting>
+<para>
+As we are using the SQLExtendedString extension from the Virtuoso ADO.Net provider you will also need to add
+</para>
+<programlisting><![CDATA[
+using OpenLink.Data.Virtuoso;
+]]></programlisting>
+<para>
+at the top of the file.
+</para>
+<para><emphasis>Step 5 - Create a class to handle exploring the RDF data.</emphasis></para>
+<itemizedlist mark="bullet">
+  <listitem>Add a new C# class to the project called ExtendedStringHandler, by Right clicking on
+RDFDemo in the <emphasis>Solution Explorer</emphasis> and <emphasis>Add</emphasis> a
+<emphasis>Class</emphasis>.</listitem>
+  <listitem>Add the following using statements to the top of the file
+<programlisting><![CDATA[
+using OpenLink.Data.Virtuoso;
+using System.Data;
+using System.Windows.Forms;
+using System.Drawing;
+using System.Data.Mapping;
+using System.Data.Common;
+]]></programlisting>
+</listitem>
+  <listitem>Paste the following block of code into the class definition.
+<programlisting><![CDATA[
+StringBuilder DescribeCommand;
+VirtuosoConnection ParentConnection;
+List<Label> labelList = new List<Label>();
+List<TextBox> textBoxList = new List<TextBox>();
+DescribeDataSet describeDataSet = new DescribeDataSet();
+Boolean isIRI = false;
+
+public ExtendedStringHandler(SqlExtendedString iri, VirtuosoConnection parentConnection)
+ {
+     ParentConnection = parentConnection;
+     if (iri.IriType == SqlExtendedStringType.IRI)
+     {
+         isIRI = true;
+         DescribeCommand = new StringBuilder("sparql select * from <http://demo.openlinksw.com/Northwind> where {<" + iri.ToString() + "> ?p ?o}");      // Replace demo.openlinksw.com with your  URIQA DefaultHost setting
+     }
+ }
+
+ public string describeCommandText
+ {
+     get
+     {
+         return DescribeCommand.ToString();
+     }
+ }
+
+ public void getDescribeData()
+ {
+      VirtuosoCommand myCommand = new VirtuosoCommand(this.describeCommandText, this.ParentConnection);
+     VirtuosoDataAdapter myAdapter = new VirtuosoDataAdapter();
+     myAdapter.SelectCommand = myCommand;
+     myAdapter.Fill(describeDataSet.DataTable1);
+ }
+
+ public void displayData()
+ {
+     if (isIRI)
+     {
+         getDescribeData();
+         Form describeForm = new Form();
+         describeForm.AutoScroll = true;
+         describeForm.Width = 840;
+
+         Label label1 = new Label();
+         label1.AutoSize = true;
+         label1.Font = new Font(label1.Font.FontFamily, label1.Font.Size + 3.0F, label1.Font.Style | FontStyle.Bold, label1.Font.Unit);
+         describeForm.Controls.Add(label1);
+
+         DataTable table1 = describeDataSet.Tables[0];
+         if (table1.Rows.Count == 0)
+             label1.Text = "No Details Available";
+         else
+         {
+             foreach (DataRow row in table1.Rows)
+                 if (row[0].ToString() == "http://www.w3.org/1999/02/22-rdf-syntax-ns#type")
+                 {
+                     StringBuilder title = new StringBuilder(row[1].ToString() + " details");
+                     label1.Text = title.ToString();
+                     break;
+                 }
+
+             foreach (DataRow row in table1.Rows)
+             {
+                 Label propertyLabel = new Label();
+                 TextBox valueBox = new TextBox();
+                 valueBox.Width = 400;
+
+                 object property = row[0];
+                 object value = row[1];
+
+                 if (value is SqlExtendedString)
+                 {
+                     valueBox.ForeColor = Color.Blue;
+                     valueBox.Font = new Font(valueBox.Font.FontFamily, valueBox.Font.Size, valueBox.Font.Style | FontStyle.Underline, valueBox.Font.Unit);
+                 }
+                 propertyLabel.Text = row[0].ToString();
+                 propertyLabel.AutoEllipsis = true;
+                 propertyLabel.AutoSize = false;
+                 propertyLabel.Width = propertyLabel.PreferredWidth > 380 ? 380 : propertyLabel.PreferredWidth;
+
+                 Binding bind = new Binding("Text", row[1], "");
+                 valueBox.DataBindings.Add(bind);
+
+                 labelList.Add(propertyLabel);
+                 textBoxList.Add(valueBox);
+             }
+
+             for (int i = 0; i < table1.Rows.Count; i++)
+             {
+                 textBoxList[i].Click += new EventHandler(this.iri_Click);
+                 labelList[i].Location = new Point(10, i * 20 + 50);
+                 textBoxList[i].Location = new Point(400, i * 20 + 50);
+                 describeForm.Controls.Add(labelList[i]);
+                 describeForm.Controls.Add(textBoxList[i]);
+             }
+
+             describeForm.Height = labelList.Count * 20 + 100 > 500 ? 500 : labelList.Count * 20 + 100;
+         }
+         describeForm.ShowDialog();
+     }
+     else
+     {
+         Form blankForm = new Form();
+         Label label1 = new Label();
+         label1.Text = "Blank Node";
+         label1.Font = new Font(label1.Font.FontFamily, label1.Font.Size + 3.0F, label1.Font.Style | FontStyle.Bold, label1.Font.Unit);
+         blankForm.ShowDialog();
+     }
+ }
+
+ public void iri_Click(object sender, EventArgs e)
+ {
+     int boxNum = 0;
+
+     for (int i = 0; i < textBoxList.Count; i++)
+     {
+         if (sender == textBoxList[i])
+         {
+             boxNum = i;
+             break;
+         }
+     }
+
+    Object o = describeDataSet.DataTable1.Rows[boxNum][1];
+     if (o is SqlExtendedString)
+     {
+         SqlExtendedString se = (SqlExtendedString)o;
+         ExtendedStringHandler seHandler = new ExtendedStringHandler(se, ParentConnection);
+         seHandler.displayData();
+     }
+     else if (o is SqlRdfBox)
+     {
+        //doesn't do anything at the moment
+    }
+ }
+]]></programlisting>
+</listitem>
+</itemizedlist>
+<para>
+The ExtendedStringHandler class creates a new SPARQL query based on the IRI that was clicked. This
+query is executed against Virtuoso using the ADO.Net connection in the same way that any SQL statement
+would be executed across an ADO.Net connection. This can be considered as Client Side SPARQL. The result
+set from the query describes the selected object and is returned as an ADO.Net DataAdapter. The
+DataAdapter is used to fill a DataTable which is displayed on a new form. We now need to add the
+new DataSet to the project and define the DataTable that will hold the query results.
+</para>
+      <para><emphasis>Step 6 - Add a new DataSet to hold the query results.</emphasis></para>
+<orderedlist>
+  <listitem>Right click RDFDemo in the <emphasis>Solution Explorer</emphasis> and add a new
+<emphasis>DataSet</emphasis>. Call the new <emphasis>DataSet</emphasis> DescribeDataSet.
+    <figure id="sparqlwinf5" float="1">
+      <title>Add a new DataSet</title>
+      <graphic fileref="ui/sparqlwinf5.png"/>
+    </figure>
+</listitem>
+  <listitem>Double click on DescribeDataSet in the <emphasis>Solution Explorer</emphasis> to open the
+<emphasis>DataSet</emphasis> Designer and drag a <emphasis>DataTable</emphasis> from the
+<emphasis>Toolbox</emphasis> into it.</listitem>
+  <listitem>Add two columns, p and o, to the <emphasis>DataTable</emphasis> and set the
+<emphasis>DataType</emphasis> of each column to System.Object.
+    <figure id="sparqlwinf6" float="1">
+      <title>Add two columns</title>
+      <graphic fileref="ui/sparqlwinf6.png"/>
+    </figure></listitem>
+</orderedlist>
+      <para><emphasis>Step 7 - Build and run the application.</emphasis></para>
+<para>You should see a form displaying all the Northwind customers, like this.
+</para>
+    <figure id="sparqlwinf7" float="1">
+      <title>Northwind customers</title>
+      <graphic fileref="ui/sparqlwinf7.png"/>
+    </figure>
+<para>When any customer is clicked it opens a new form showing customer details.
+</para>
+    <figure id="sparqlwinf8" float="1">
+      <title>Customer details</title>
+      <graphic fileref="ui/sparqlwinf8.png"/>
+    </figure>
+<para>Clicking on the links in the new form allows you to drill down further to get
+order, product, location details etc.
+</para>
+    <figure id="sparqlwinf9" float="1">
+      <title>Order, product, location details</title>
+      <graphic fileref="ui/sparqlwinf9.png"/>
+    </figure>
+<para>and</para>
+    <figure id="sparqlwinf10" float="1">
+      <title>Order, product, location details</title>
+      <graphic fileref="ui/sparqlwinf10.png"/>
+    </figure>
+      <para><emphasis>Next Steps</emphasis></para>
+<para>
+You will notice if you keep clicking on the links that this application will only display data that
+is held in the Northwind graph. Clicking on an external link, for example the link to Berlin in
+dbpedia, http://dbpedia.org/resource/Berlin, results in a empty window and an error message. The
+next step is to extend this application so that it can handle dereferencing external IRIs.
+</para>
+    </sect2>
+    <sect2 id="installwfasxtendcomlab">
+      <title>Extending RDFDemo to Allow Dereferencing of External IRIs</title>
+<para>
+This section will guide you through extending the application created in
+<link linkend="installwfasgetstart">Creating a Windows Forms Application To Access RDF Data Using The
+Virtuoso ADO.Net Provider</link> so that it will dereference external IRIs.
+</para>
+      <para><emphasis>Pre-requisites</emphasis></para>
+<orderedlist>
+  <listitem>A working copy of the RDFDemo application created in
+<link linkend="installwfasgetstart">Creating a Windows Forms Application To
+Access RDF Data Using The Virtuoso ADO.Net Provider.</link></listitem>
+</orderedlist>
+    <sect3 id="installwfasxtendcomlabextappl">
+      <title>Extending the Application</title>
+<para>In RDFDemo when the sparql endpoint is queried to get the description of the selected item it executes
+a query that is restricted to the local Northwind dataset. The query is something like
+</para>
+<programlisting><![CDATA[
+SPARQL
+PREFIX nwind: <http://demo.openlinksw.com/schemas/northwind#>
+SELECT DISTINCT  ?s
+FROM <http://demo.openlinksw.com/Northwind>
+WHERE {?s a nwind:Customer}
+]]></programlisting>
+<para>If you examine the ExtendedStringHandler class you will see that the dataset clause, from
+<http://localhost:8890/Northwind>, is hard coded. This means that when when the selected IRI is
+a link to an external data store, such as dbpedia, there is no matching data and an error is displayed.
+If the application is to be able to dereference external IRIs then the hard coded dataset clause needs
+to be removed and then we can use a Virtuoso extension to SPARQL, get:soft, that tells Virtuoso that it
+needs to go and look elsewhere for the graph. However, this will result in a loss of performance when
+exploring the local Northwind dataset. To minimize the impact on performance we will first query the
+local Northwind dataset and if there are no matching triples returned then we will use a more generic
+query that will look elsewhere for matching data.
+</para>
+      <para><emphasis>Step 1 - Add the alternative query to the ExtendedString Class.</emphasis></para>
+<itemizedlist mark="bullet">
+  <listitem>Open the RDFDemo project in Visual Studio </listitem>
+  <listitem>Open the ExtendedStringHandler class.</listitem>
+  <listitem>Remove DescribeCommand by removing the line
+<programlisting><![CDATA[
+StringBuilder DescribeCommand;
+]]></programlisting>
+<para>
+and substitute the following:
+</para>
+<programlisting><![CDATA[
+StringBuilder DescribeCommandSimple, DescribeCommandGeneral;
+]]></programlisting>
+</listitem>
+  <listitem>In the ExtendedStringHandler constructor the sparql query that was DescribeCommand becomes
+DescribeCommandSimple and we define a new query for DescribeCommandGeneral.
+<programlisting><![CDATA[
+DescribeCommandSimple = new StringBuilder("sparql select * from <http://demo.openlinksw.com/Northwind> where {<" + iri.ToString() + "> ?p ?o}");       // Replace demo.openlinksw.com with your  URIQA DefaultHost setting
+DescribeCommandGeneral = new StringBuilder("sparql define get:soft " + '"'.ToString() + "soft" + '"'.ToString() + " select * from <" + iri.ToString() + "> where { <" + iri.ToString() + "> ?p ?o }");
+]]></programlisting>
+</listitem>
+  <listitem>The single describeCommand property needs to be replaced with the two new properties,
+DescribeCommandSimple and DescribeCommandGeneral
+<programlisting><![CDATA[
+public string describeCommandSimpleText
+{
+    get
+    {
+        return DescribeCommandSimple.ToString();
+    }
+}
+public string describeCommandGeneralText
+{
+    get
+    {
+        return DescribeCommandGeneral.ToString();
+    }
+}
+]]></programlisting>
+</listitem>
+  <listitem>Finally, the getDescribeData method needs changing to:
+<programlisting><![CDATA[
+public void getDescribeData()
+{
+    VirtuosoCommand myCommand = new VirtuosoCommand(this.describeCommandSimpleText, this.ParentConnection);
+    VirtuosoDataAdapter myAdapter = new VirtuosoDataAdapter();
+    myAdapter.SelectCommand = myCommand;
+    myAdapter.Fill(describeDataSet.DataTable1);
+    // Tried the simple version if fails to get the data try
+    // to look elsewhere.
+    if (describeDataSet.DataTable1.Rows.Count == 0)
+    {
+        myCommand.CommandText = describeCommandGeneralText;
+        myAdapter.Fill(describeDataSet.DataTable1);
+    }
+}
+]]></programlisting>
+</listitem>
+</itemizedlist>
+      <para><emphasis>Step 2 - Build and Run the Application</emphasis></para>
+<para>
+You will see the same starting form:
+</para>
+    <figure id="sparqlwinf11" float="1">
+      <title>Build and Run the Application</title>
+      <graphic fileref="ui/sparqlwinf11.png"/>
+    </figure>
+<para>
+Select a Customer and then select the link to the City in dbpedia. This will now open up another window
+displaying information about the city from dbpedia. Be patient as it may take a little while to open.
+</para>
+    <figure id="sparqlwinf12" float="1">
+      <title>Customer</title>
+      <graphic fileref="ui/sparqlwinf12.png"/>
+    </figure>
+      <para><emphasis>Step 3 - Changing the Form Title</emphasis></para>
+<para>
+Notice that in displayData method that we look for a
+http://www.w3.org/1999/02/22-rdf-syntax-ns#type and create a title for the form from it.
+</para>
+<programlisting><![CDATA[
+foreach (DataRow row in table1.Rows)
+  if (row[0].ToString() == "http://www.w3.org/1999/02/22-rdf-syntax-ns#type")
+  {
+      StringBuilder title = new StringBuilder(row[1].ToString() + " details");
+      label1.Text = title.ToString();
+      break;
+  }
+]]></programlisting>
+<para>
+This worked well for the Northwind subjects but less well now we are getting data from other graphs.
+To change the title of the forms used to display the data:
+</para>
+<itemizedlist mark="bullet">
+  <listitem>Add an new member variable to hold the IRI that we exploring to the bock of member variables
+<programlisting><![CDATA[
+StringBuilder DescribeCommandSimple, DescribeCommandGeneral;
+VirtuosoConnection ParentConnection;
+List<Label> labelList = new List<Label>();
+List<TextBox> textBoxList = new List<TextBox>();
+DescribeDataSet describeDataSet = new DescribeDataSet();
+Boolean isIRI = false;
+SqlExtendedString ParentIRI;
+]]></programlisting>
+</listitem>
+  <listitem>Assign a value to ParentIRI in the constructor:
+<programlisting><![CDATA[
+public ExtendedStringHandler(SqlExtendedString iri, VirtuosoConnection parentConnection)
+  {
+      ParentConnection = parentConnection;
+      if (iri.IriType == SqlExtendedStringType.IRI)
+      {
+          ParentIRI = iri;
+          isIRI = true;
+          DescribeCommandSimple = new StringBuilder("sparql select * from <http://demo.openlinksw.com/Northwind> where {<" + iri.ToString() + "> ?p ?o}");      // Replace demo.openlinksw.com with your  URIQA DefaultHost setting
+          DescribeCommandGeneral = new StringBuilder("sparql define get:soft " + '"'.ToString() + "soft" + '"'.ToString() + " select * from <" + iri.ToString() + "> where { <" + iri.ToString() + "> ?p ?o }");
+      }
+  }
+]]></programlisting>
+</listitem>
+  <listitem>Remove the existing foreach block that sets the form title and replace with the following lines:
+<programlisting><![CDATA[
+StringBuilder title = new StringBuilder(ParentIRI.ToString() + " details");
+label1.Text = title.ToString();
+]]></programlisting>
+</listitem>
+  <listitem>Build and run the application.
+    <figure id="sparqlwinf13" float="1">
+      <title>Build and run the application</title>
+      <graphic fileref="ui/sparqlwinf13.png"/>
+    </figure>
+</listitem>
+</itemizedlist>
+<para><emphasis>Next Steps</emphasis></para>
+<para>The application now allows you to explore data and follow links from your locally held data into the
+external web of data. Looking at the data displayed in the form it would be nice to make the labels for
+the properties more compact. The label http://dbpedia.org/property/population is a very precise definition
+but for our purposes it would be clearer to label the property just population. In the next step will be
+to modify the application so that it displays more readable labels.
+</para>
+    </sect3>
+    </sect2>
+    <sect2 id="installwfasxtendcomplab">
+      <title>Extending RDFDemo to Display More Compact Labels</title>
+<para>
+This section will guide you through extending the application created in
+<link linkend="installwfasxtendcomlab">Extending RDFDemo to Allow Dereferencing of External IRIs</link> so that the data is displayed in a more readable form.
+</para>
+      <para><emphasis>Pre-requisites</emphasis></para>
+<orderedlist>
+  <listitem>A working copy of the RDFDemo application created in
+<link linkend="installwfasxtendcomlab">Extending RDFDemo to Allow Dereferencing of External IRIs</link></listitem>
+</orderedlist>
+    <sect3 id="installwfasxtendcomplabextapp">
+      <title>Extending the Application</title>
+<para>The RDF demo application presents the user with a list of Customers from the Northwind database in
+the form of dereferenceable IRIs. When a customer is selected from the list the application uses a sparql
+query to describe that customer and the results are displayed in a form as rows of labels and data. The
+labels correspond to RDF predicates and the data corresponds to RDF objects while the subject is the
+customer initially selected. In many cases the objects are dereferencable IRIs which are then used as
+the subject when the 'drilling down' into the data. However, the predicates are also IRIs so it is
+possible to gain more information about these as well.
+</para>
+<para>The RDF Schema defines a property http://www.w3.org/2000/01/rdf-schema#label that may be used to
+provide a human-readable version of a resource's name. We can obtain further details of each of the
+predicates in a resultset and check to see if one of the properties is an
+http://www.w3.org/2000/01/rdf-schema#label. If it is we can use the associated text as the label in
+our form instead of the the predicate IRI. The benefit should be a more human readable form.
+</para>
+      <para><emphasis>Step 1 - Add a New Method to Get the Label Text</emphasis></para>
+<para>This method takes the predicate IRI and issues a sparql query to get its description. It then
+cycles through the returned dataset to find a http://www.w3.org/2000/01/rdf-schema#label. If there is
+one then the associated text is returned by the method. Otherwise the method returns the IRI string.
+</para>
+<itemizedlist mark="bullet">
+  <listitem>Add the following method to the ExtendedStringHandlerClass
+<programlisting><![CDATA[
+private string getLabelText(Object label)
+  {
+      string labelText = label.ToString();
+      if (label is SqlExtendedString)
+      {
+          SqlExtendedString se = (SqlExtendedString)label;
+          StringBuilder getLabelCommandText = new StringBuilder("sparql define get:soft \"soft\" select * from <" + se.ToString() + "> where {<" + se.ToString() + "> ?p ?o}");
+          VirtuosoCommand getLabelCommand = new VirtuosoCommand(getLabelCommandText.ToString(), ParentConnection);
+          VirtuosoDataAdapter getLabelAdapter = new VirtuosoDataAdapter();
+          getLabelAdapter.SelectCommand = getLabelCommand;
+          DataSet getLabelDataSet = new DataSet();
+          try
+          {
+              getLabelAdapter.Fill(getLabelDataSet);
+              foreach (DataRow getLabelRow in getLabelDataSet.Tables[0].Rows)
+              {
+                  if (getLabelRow[0].ToString() == "http://www.w3.org/2000/01/rdf-schema#label")
+                  {
+                      labelText = getLabelRow[1].ToString();
+                      break;
+                  }
+              }
+          }
+          catch
+          {
+          }
+      }
+      return labelText;
+  }
+]]></programlisting>
+</listitem>
+  <listitem>Change the line in displayData from
+<programlisting><![CDATA[
+propertyLabel.Text = row[0].ToString();
+]]></programlisting>
+</listitem>
+  <listitem>to
+<programlisting><![CDATA[
+propertyLabel.Text = getLabelText(row[0]);
+]]></programlisting>
+</listitem>
+</itemizedlist>
+       <para><emphasis>Step 1 - Add a New Method to Get the Label Text</emphasis></para>
+<para>When you run the application you will see that the initial form is the same. In fact, when you
+select the Customer you will also see that the customer details are also the same. It is only when you
+start exploring data outside the Northwind graph that you will see the labels in the form change.
+</para>
+    <figure id="sparqlwinf14" float="1">
+      <title>Northwind graph</title>
+      <graphic fileref="ui/sparqlwinf14.png"/>
+    </figure>
+    <para><emphasis>Next Steps</emphasis></para>
+<para>It is clear from running the application that the Northwind ontology does not define an
+http://www.w3.org/2000/01/rdf-schema#label for its members. In order to benefit from this modified
+version of RDFDemo we need to update our Northwind ontology so that
+http://www.w3.org/2000/01/rdf-schema#label is defined for each resource. The next step will be to modify
+our Northwind ontology.
+</para>
+     </sect3>
+    </sect2>
+    <sect2 id="installwfasmodify">
+      <title>Modifying the Northwind Ontology to Add Labels</title>
+<para>This section will guide you through modifying the Northwind Ontology created when you installed
+the <ulink url="http://download.openlinksw.com/packages/5.0/virtuoso/demo_dav.vad">demo database VAD package</ulink> so that each resources is identified by an
+http://www.w3.org/2000/01/rdf-schema#label. This will improve the readability of the information displayed by
+the application created in <link linkend="installwfasxtendcomplab">Extending RDFDemo to Display More Compact Labels</link>.
+</para>
+<para><emphasis>Pre-requisites</emphasis></para>
+<orderedlist>
+  <listitem>A working copy of the RDFDemo application created in <link linkend="installwfasxtendcomplab">Extending RDFDemo to Display More Compact Labels</link></listitem>
+</orderedlist>
+    <sect3 id="installwfasmodifyeditont">
+      <title>Editing the Ontology</title>
+    <para><emphasis>Get a Working Copy of the Northwind Ontology</emphasis></para>
+<para>The the file describing the Northwind Ontology, nw.owl, is installed in the DAV when the demo vad
+is loaded. To get a working copy open the Virtuoso Conductor and log in as dba. Select WebDAV Browser in
+the navigation panel on the left. This will open a window that allows you to browse the WebDAV Repository.
+The Northwind Ontology file can be found in DAV/VAD/demo/sql. Take a copy of the file.
+</para>
+    <para><emphasis>Editing nw.owl</emphasis></para>
+<para>In the first instance is edited nw.owl so that the property name consistently begin with a lower
+case letter. This matches the results for describing resources held in the Northwind database. Also are
+added missing properties so that there should be a label in all cases.
+</para>
+    <para><emphasis>Registering the Changes in Virtuoso</emphasis></para>
+<para>There are two methods for registering the changes in Virtuoso:
+</para>
+<orderedlist>
+  <listitem>Method I:
+    <itemizedlist mark="bullet">
+      <listitem>Copy the edited version of nw.owl back into the DAV.</listitem>
+      <listitem>In isql, load the script load_ontology_dav.sql and execute it. The new version of
+nw.owl will then be used</listitem>
+    </itemizedlist>
+</listitem>
+  <listitem>
+    <itemizedlist mark="bullet">
+      <listitem>Ensure that your new version of nw.owl is in a folder accessible by Virtuoso. You may
+need to edit your virtuoso.ini file and restart the server.</listitem>
+      <listitem>In isql, load the script load_ontology_file.sql and edit it so that it has the full
+path to the new version of nw.owl</listitem>
+      <listitem>Run the script. The new version of nw.owl will then be used.</listitem>
+    </itemizedlist>
+</listitem>
+</orderedlist>
+    <para>Modify RDFDemo so that it looks for the graph used to describe the Northwind data and
+searches that graph for the predicate details:</para>
+<orderedlist>
+  <listitem>Add a new member variable to the ExtendedStringHandler class to hold the graphs that
+we need to search for the predicate information.
+<programlisting><![CDATA[
+StringBuilder DescribeCommandSimple, DescribeCommandGeneral;
+VirtuosoConnection ParentConnection;
+List<Label> labelList = new List<Label>();
+List<TextBox> textBoxList = new List<TextBox>();
+List<String> graphList = new List<String>();
+DescribeDataSet describeDataSet = new DescribeDataSet();
+Boolean isIRI = false;
+SqlExtendedString ParentIRI;
+]]></programlisting></listitem>
+  <listitem>In displayData, after we have set the title of the form, add the following block of code:
+<programlisting><![CDATA[
+// Later we will want to get property labels and for that
+ // we will need the graph where the resource is defined.
+foreach (DataRow row in table1.Rows)
+     if (row[0].ToString() == "http://www.openarchives.org/ore/terms/isDescribedBy"
+    && row[1].ToString() != ParentIRI.ToString())
+     {
+         String graph = row[1].ToString();
+         graphList.Add(graph);
+     }
+]]></programlisting>
+</listitem>
+  <listitem>Replace the existing getLabelText method with an extended version
+<programlisting><![CDATA[
+ private string getLabelText(Object label)
+  {
+      string labelText = label.ToString();
+      if (label is SqlExtendedString)
+      {
+          Boolean foundLabel = false;
+          SqlExtendedString se = (SqlExtendedString)label;
+          VirtuosoDataAdapter getLabelAdapter = new VirtuosoDataAdapter();
+          DataSet getLabelDataSet = new DataSet();
+
+          //Try finding it in resources graph first
+          foreach (String graph in graphList)
+          {
+              StringBuilder getLabelCommandText = new StringBuilder("sparql select * from <" + graph + "> where {<" + se.ToString() + "> ?p ?o}");
+              VirtuosoCommand getLabelCommand = new VirtuosoCommand(getLabelCommandText.ToString(), ParentConnection);
+              getLabelAdapter.SelectCommand = getLabelCommand;
+
+              try
+              {
+                  getLabelAdapter.Fill(getLabelDataSet);
+                  foreach (DataRow getLabelRow in getLabelDataSet.Tables[0].Rows)
+                  {
+                      if (getLabelRow[0].ToString() == "http://www.w3.org/2000/01/rdf-schema#label")
+                      {
+                          labelText = getLabelRow[1].ToString();
+                          foundLabel = true;
+                          break;
+                      }
+                  }
+              }
+              catch
+              {
+              }
+              if (foundLabel)
+                  break;
+          }
+          // If we still have no label try the predicate itself as the graph
+          if (!foundLabel)
+          {
+              StringBuilder getLabelCommandText = new StringBuilder("sparql define get:soft \"soft\" select * from <" + se.ToString() + "> where {<" + se.ToString() + "> ?p ?o}");
+              VirtuosoCommand getLabelCommand = new VirtuosoCommand(getLabelCommandText.ToString(), ParentConnection);
+              getLabelAdapter.SelectCommand = getLabelCommand;
+              try
+              {
+                  getLabelAdapter.Fill(getLabelDataSet);
+                  foreach (DataRow getLabelRow in getLabelDataSet.Tables[0].Rows)
+                  {
+                      if (getLabelRow[0].ToString() == "http://www.w3.org/2000/01/rdf-schema#label")
+                      {
+                          labelText = getLabelRow[1].ToString();
+                          break;
+                      }
+                  }
+              }
+              catch
+              {
+              }
+          }
+      }
+      return labelText;
+  }
+]]></programlisting>
+<para>This extended method first checks the graphs in the graph list for the predicate information then
+if no label has been found tries the predicate itself as the graph.
+</para>
+</listitem>
+  <listitem>Build and run, the Northwind resources should now be correctly and concisely labeled
+    <figure id="sparqlwinf15" float="1">
+      <title>Northwind resources</title>
+      <graphic fileref="ui/sparqlwinf15.png"/>
+    </figure>
+</listitem>
+</orderedlist>
+<para>
+</para>
+    <para><emphasis>Improving The Appearance of the Form</emphasis></para>
+<para>The following changes are not strictly necessary but improve the appearance of the form:
+</para>
+<itemizedlist mark="bullet">
+  <listitem>Line up the right hand edge of the labels with the text boxes by setting TextAlign to
+MiddleRight and reduce the width of the labels.
+<programlisting><![CDATA[
+propertyLabel.Text = getLabelText(row[0]);
+propertyLabel.AutoEllipsis = true;
+propertyLabel.AutoSize = false;
+propertyLabel.Width = 130;
+propertyLabel.TextAlign = ContentAlignment.MiddleRight;
+]]></programlisting>
+</listitem>
+  <listitem>Make the form narrower:
+<programlisting><![CDATA[
+describeForm.Width = 660;
+]]></programlisting>
+</listitem>
+  <listitem>Alter the positioning of the labels and TextBoxes on the form:
+<programlisting><![CDATA[
+textBoxList[i].Click += new EventHandler(this.iri_Click);
+labelList[i].Location = new Point(10, i * 22 + 50);
+textBoxList[i].Location = new Point(150, i * 22 + 50);
+describeForm.Controls.Add(labelList[i]);
+describeForm.Controls.Add(textBoxList[i]);
+]]></programlisting>
+    <figure id="sparqlwinf16" float="1">
+      <title>Alter the positioning</title>
+      <graphic fileref="ui/sparqlwinf16.png"/>
+    </figure>
+</listitem>
+</itemizedlist>
+    <para><emphasis>Next Steps</emphasis></para>
+<para>The image below shows some of the information about an employee in the Northwind dataset.
+</para>
+    <figure id="sparqlwinf17" float="1">
+      <title>employee</title>
+      <graphic fileref="ui/sparqlwinf17.png"/>
+    </figure>
+<para>In the next step we will extend the application so the images and web pages can be viewed
+and long text fields are displayed in full.
+</para>
+    </sect3>
+    </sect2>
+
+    <sect2 id="installwfasxtendlongtext">
+      <title>Extending RDFDemo to Display Images and Longer Text Fields.</title>
+<para>This section will guide you through extending RDFDemo so that longer text fields can be displayed
+as a block of text and so that links to images and web pages can be viewed in a browser window.
+</para>
+<para><emphasis>Pre-requisites</emphasis></para>
+<orderedlist>
+  <listitem>A working copy of the RDFDemo application created in
+<link linkend="installwfasmodify">Modifying the Northwind Ontology to Add Labels</link></listitem>
+</orderedlist>
+    <sect3 id="installwfasxtendlongtextmodf">
+      <title>Modifying the Application</title>
+    <para><emphasis>Displaying Text</emphasis></para>
+<para>We will modify the form that show the details of the selected item so that when the text in the boxes
+is too long to be seen in full a button will appear beside the box on the form and if you click the button
+the complete text will be displayed in a separate window.
+</para>
+<orderedlist>
+  <listitem>Add a new class, MoreButton that extends System.Windows.Forms.Button.
+<itemizedlist mark="bullet">
+  <listitem>In the <emphasis>Solution Explorer</emphasis> right click on the RDFDemo project and select
+<emphasis>Add</emphasis> then <emphasis>New Item</emphasis>.</listitem>
+  <listitem>Add a new class called MoreButton.cs.
+    <figure id="sparqlwinf18" float="1">
+      <title>Add a new class</title>
+      <graphic fileref="ui/sparqlwinf18.png"/>
+    </figure>
+</listitem>
+  <listitem>The following using statement goes at the top of the file:
+<programlisting><![CDATA[
+using System.Windows.Forms;
+]]></programlisting>
+</listitem>
+  <listitem>The MoreButton class must inherit from System.Windows.Forms.Button
+so the class definition line should look like this:
+<programlisting><![CDATA[
+class MoreButton : Button
+]]></programlisting>
+</listitem>
+  <listitem>Add the following code to the body of the MoreButton class:
+<programlisting><![CDATA[
+ String longText;
+
+ public MoreButton(String text)
+ {
+     longText = text;
+     this.Text = "More";
+ }
+
+ protected override void  OnClick(EventArgs e)
+ {
+     Form moreForm = new Form();
+     TextBox moreBox = new TextBox();
+     moreBox.Text = longText;
+     moreBox.Width = 300;
+     moreBox.Height = 250;
+     moreBox.ScrollBars = ScrollBars.Vertical;
+     moreBox.Multiline = true;
+     moreBox.WordWrap = true;
+     moreBox.Select(0, 0);
+     moreBox.ReadOnly = true;
+     moreForm.Controls.Add(moreBox);
+     moreForm.Width = 320;
+     moreForm.Height = 280;
+     moreForm.ShowDialog();
+ }
+]]></programlisting>
+</listitem>
+</itemizedlist>
+</listitem>
+  <listitem>In displayData in the ExtendedStringHandler class, when the labels and TextBoxes are added to
+the form check if the text is too big for the box. If it is then add a MoreButton that will display all
+the text in a separate window.
+<programlisting><![CDATA[
+if (textBoxList[i].DataBindings[0].DataSource.ToString().Length > 80
+    && !(textBoxList[i].DataBindings[0].DataSource is SqlExtendedString))
+{
+    moreButtonList.Add(new MoreButton(textBoxList[i].DataBindings[0].DataSource.ToString()));
+    moreButtonList[moreButtonList.Count - 1].Location = new Point(550, i * 22 + 50);
+    describeForm.Controls.Add(moreButtonList[moreButtonList.Count -1]);
+}
+]]></programlisting>
+</listitem>
+  <listitem>We will also need a list to hold the buttons as they are created so the following needs to
+be added to the member variables at the top of the ExtendedStringHandler class.
+<programlisting><![CDATA[
+List<MoreButton> moreButtonList = new List<MoreButton>();
+]]></programlisting>
+</listitem>
+  <listitem>Build and run the application. If you click through to an Employee page you will see the
+Notes field now has a button labeled More next to it. If you click on that button the text from the Notes
+field is displayed in a new window.
+    <figure id="sparqlwinf19" float="1">
+      <title>Notes</title>
+      <graphic fileref="ui/sparqlwinf19.png"/>
+    </figure>
+</listitem>
+</orderedlist>
+    <para><emphasis>Displaying Images and Web Pages</emphasis></para>
+<para>Next we will modify the form so that item identified as images or web pages will be opened in a
+browser window. Again we will do this by adding a button beside the box on the form that will open the
+browser window.
+</para>
+<orderedlist>
+  <listitem>Add a new class, OpenButton that extends System.Windows.Forms.Button.
+<itemizedlist mark="bullet">
+  <listitem>In the <emphasis>Solution Explorer</emphasis> right click on the RDFDemo project and select
+<emphasis>Add</emphasis> then <emphasis>New Item</emphasis>
+</listitem>
+   <listitem>Add a new class called OpenButton.cs.
+</listitem>
+   <listitem>The following using statement goes at the top of the file:
+<programlisting><![CDATA[
+using System.Windows.Forms;
+]]></programlisting>
+</listitem>
+   <listitem>The OpenButton class must inherit from System.Windows.Forms.Button so the class
+definition line should look like this:
+<programlisting><![CDATA[
+class OpenButton : Button
+]]></programlisting>
+</listitem>
+   <listitem>Add the following code to the body of the OpenButton class:
+<programlisting><![CDATA[
+String urlText;
+
+public OpenButton(String text)
+{
+    urlText = text;
+    this.Text = "Open";
+}
+
+protected override void  OnClick(EventArgs e)
+{
+    System.Diagnostics.Process.Start(urlText);
+}
+]]></programlisting>
+</listitem>
+</itemizedlist>
+</listitem>
+  <listitem>In displayData in the ExtendedStringHandler class, where we added the code to check for long
+text fields we now need to check for IRIs that identify images and web pages. As a simple first attempt
+we will check for matching labels. So for example, if a property label is 'image' or 'webpage', we will
+assume it can be opened in a browser window and put an OpenButton beside it.
+<programlisting><![CDATA[
+if (labelList[i].Text == "website"
+    || labelList[i].Text == "image"
+    || labelList[i].Text == "depiction"
+    || labelList[i].Text == "page"
+    || labelList[i].Text == "url"
+    || labelList[i].Text == "image skyline")
+{
+    openButtonList.Add(new OpenButton(textBoxList[i].DataBindings[0].DataSource.ToString()));
+    openButtonList[openButtonList.Count - 1].Location = new Point (550, i * 22 + 50);
+    describeForm.Controls.Add(openButtonList[openButtonList.Count - 1]);
+}
+]]></programlisting>
+</listitem>
+  <listitem>We will also need a list to hold the buttons as they are created so the following needs to
+be added to the member variables at the top of the ExtendedStringHandler class.
+<programlisting><![CDATA[
+List<OpenButton> openButtonList = new List<OpenButton>();
+]]></programlisting>
+</listitem>
+  <listitem>Build and run the application. If you click through to an Employee page now you will see that
+the Image field now has a button labeled Open next to it. If you click on that button the image is opened
+in your default browser.
+    <figure id="sparqlwinf20" float="1">
+      <title>Image</title>
+      <graphic fileref="ui/sparqlwinf20.png"/>
+    </figure>
+</listitem>
+</orderedlist>
+    <para><emphasis>Next Steps</emphasis></para>
+<para>It has already been mentioned that the property labels are also dereferenceable IRIs. We used this
+feature to find a short name to display rather that the complete IRI. The next step is to make the labels
+clickable so the ontology itself can also be explored.
+</para>
+    </sect3>
+    </sect2>
+
+
+    <sect2 id="installwfasxtendproplab">
+      <title>Extending RDFDemo To Make The Property Labels Clickable</title>
+<para>This section will guide you through extending RDFDemo to make the property labels clickable. Clicking
+on the property label will take you to a page describing that property.
+</para>
+<para><emphasis>Pre-requisites</emphasis></para>
+<orderedlist>
+  <listitem>A working copy of the RDFDemo application created in
+<link linkend="installwfasxtendlongtext">Extending RDFDemo to Display Images and Longer Text Fields</link></listitem>
+</orderedlist>
+    <sect3 id="installwfasxtendproplabmod">
+      <title>Modifying the Application</title>
+    <para><emphasis>Making the Labels Clickable</emphasis></para>
+<para>Making the property labels clickable is fairly straight forward. We will use basically the same code
+as is used to make the values clickable.
+</para>
+<orderedlist>
+  <listitem>First we need to add a new event handler. In the ExtendedStringHandler class modify displayData
+to add an event handler for each of the property labels.
+<programlisting><![CDATA[
+for (int i = 0; i < table1.Rows.Count; i++)
+{
+    textBoxList[i].Click += new EventHandler(this.iri_Click);
+    labelList[i].Location = new Point(10, i * 22 + 50);
+    textBoxList[i].Location = new Point(150, i * 22 + 50);
+    describeForm.Controls.Add(labelList[i]);
+    describeForm.Controls.Add(textBoxList[i]);
+]]></programlisting>
+<para>becomes
+</para>
+<programlisting><![CDATA[
+for (int i = 0; i < table1.Rows.Count; i++)
+{
+    textBoxList[i].Click += new EventHandler(this.iri_Click);
+    labelList[i].Location = new Point(10, i * 22 + 50);
+    labelList[i].Click += new EventHandler(this.label_Click);
+    textBoxList[i].Location = new Point(150, i * 22 + 50);
+    describeForm.Controls.Add(labelList[i]);
+    describeForm.Controls.Add(textBoxList[i]);
+]]></programlisting>
+</listitem>
+  <listitem>Then we need to add the EventHandler method. Add the following to the ExtendedStringHandler Class:
+<programlisting><![CDATA[
+public void label_Click(object sender, EventArgs e)
+  {
+      int labelNum = 0;
+
+      for (int i = 0; i < labelList.Count; i++)
+      {
+          if (sender == labelList[i])
+          {
+              labelNum = i;
+              break;
+          }
+      }
+
+      Object o = describeDataSet.DataTable1.Rows[labelNum][0];
+      if (o is SqlExtendedString)
+      {
+          SqlExtendedString se = (SqlExtendedString)o;
+          ExtendedStringHandler seHandler = new ExtendedStringHandler(se, ParentConnection);
+          seHandler.displayData();
+      }
+      else if (o is SqlRdfBox)
+      {
+          //doesn't do anything at the moment
+      }
+  }
+]]></programlisting>
+<para>
+If you compare this method to the EventHandler for the values, iri_Click, you will see that it is basically
+the same. The only difference is that it uses the property element from the data table rather than value.
+</para>
+</listitem>
+  <listitem>Finally, to make it clear that the labels are now active links, we will change the label colour
+to blue and underline them.
+<programlisting><![CDATA[
+ propertyLabel.Text = getLabelText(row[0]);
+ propertyLabel.AutoEllipsis = true;
+ propertyLabel.AutoSize = false;
+ propertyLabel.Width = 130;
+ propertyLabel.TextAlign = ContentAlignment.MiddleRight;
+]]></programlisting>
+<para>becomes:
+</para>
+<programlisting><![CDATA[
+propertyLabel.Text = getLabelText(row[0]);
+propertyLabel.ForeColor = Color.Blue;
+propertyLabel.Font = new Font(propertyLabel.Font.FontFamily, propertyLabel.Font.Size, propertyLabel.Font.Style | FontStyle.Underline, propertyLabel.Font.Unit);
+propertyLabel.AutoEllipsis = true;
+propertyLabel.AutoSize = false;
+propertyLabel.Width = 130;
+propertyLabel.TextAlign = ContentAlignment.MiddleRight;
+]]></programlisting>
+</listitem>
+  <listitem>Build and run the application. You will see the familiar starting page. If you then select one
+of the Customers you will notice the property labels now look like hyperlinks.
+    <figure id="sparqlwinf21" float="1">
+      <title>hyperlinks</title>
+      <graphic fileref="ui/sparqlwinf21.png"/>
+    </figure>
+<para>If you click on one of the label hyperlinks you will see a new form showing detailed information about
+the property which can itself be explored further by clicking on labels and values.
+    <figure id="sparqlwinf22" float="1">
+      <title>labels and values</title>
+      <graphic fileref="ui/sparqlwinf22.png"/>
+    </figure>
+</para>
+</listitem>
+</orderedlist>
+<para>These simple changes work up to a point but are not robust. If you explore the properties used by the
+local Northwind graph you quickly find that the property details are not found. The application needs some
+further changes to work consistently. The problem is finding the graph where the property information is
+defined. The general handler for Extended Strings first checks the local Northwind graph,
+http://localhost:8890/Northwind, where the Northwind data is held, and then uses the IRI itself as the graph
+and tries to load that dynamically. This is not working for information about the Northwind properties.
+These properties are defined in the Northwind ontology, http://demo.openlinksw.com/schemas/northwind. We
+have already had to find this graph when getting the short label name. We need to be able to associate the
+property label with the graph where its definition is stored. Then we can search this graph for details
+about the property when the label is clicked.
+</para>
+    <para><emphasis>Using the Graph Where the Property Label was Found to Find the Property Details</emphasis></para>
+<orderedlist>
+  <listitem>Create a new class, IRILabel, that inherits from System.Windows.Forms.Label.
+<itemizedlist mark="bullet">
+  <listitem>In the <emphasis>Solution Explorer</emphasis> right click on the RDFDemo project and select
+<emphasis>Add</emphasis> then <emphasis>New Item</emphasis>.</listitem>
+  <listitem>Add a new class called IRILabel.cs.
+    <figure id="sparqlwinf23" float="1">
+      <title>Add a new class</title>
+      <graphic fileref="ui/sparqlwinf23.png"/>
+    </figure>
+</listitem>
+</itemizedlist>
+</listitem>
+  <listitem>We need to reference System.Windows.Forms, System.Data and OpenLink.Data.Virtuoso so add
+<programlisting><![CDATA[
+using System.Windows.Forms;
+using OpenLink.Data.Virtuoso;
+using System.Data;
+]]></programlisting>
+<para>to the using block at the top of the class file. The class definition should look like this:
+</para>
+<programlisting><![CDATA[
+class IRILabel : Label
+]]></programlisting>
+</listitem>
+  <listitem>Paste the following code into the body of the class:
+<programlisting><![CDATA[
+SqlExtendedString SourceIRI;
+String GraphUsed;
+VirtuosoConnection ParentConnection;
+
+public IRILabel(Object iri, List<String> graphList, VirtuosoConnection parentConnection)
+{
+    ParentConnection = parentConnection;
+    if (iri is SqlExtendedString)
+    {
+        SourceIRI = (SqlExtendedString)iri;
+        Text = this.getLabelText(graphList);
+    }
+    else
+        Text = iri.ToString();
+}
+
+public SqlExtendedString iri
+{
+    get
+    {
+        return SourceIRI;
+    }
+}
+
+public String graph
+{
+    get
+    {
+        return GraphUsed;
+    }
+}
+
+private string getLabelText(List<String> graphList)
+{
+    string labelText = SourceIRI.ToString();
+    Boolean foundLabel = false;
+    VirtuosoDataAdapter getLabelAdapter = new VirtuosoDataAdapter();
+    DataSet getLabelDataSet = new DataSet();
+
+    //Try finding it in resources graph first
+    foreach (String graph in graphList)
+    {
+        StringBuilder getLabelCommandText = new StringBuilder("sparql select * from <" + graph + "> where {<" + SourceIRI.ToString() + "> ?p ?o}");
+        VirtuosoCommand getLabelCommand = new VirtuosoCommand(getLabelCommandText.ToString(), ParentConnection);
+        getLabelAdapter.SelectCommand = getLabelCommand;
+
+        try
+        {
+            getLabelAdapter.Fill(getLabelDataSet);
+            foreach (DataRow getLabelRow in getLabelDataSet.Tables[0].Rows)
+            {
+                if (getLabelRow[0].ToString() == "http://www.w3.org/2000/01/rdf-schema#label")
+                {
+                    labelText = getLabelRow[1].ToString();
+                    foundLabel = true;
+                    break;
+                }
+            }
+        }
+        catch
+        {
+        }
+        if (foundLabel)
+        {
+            GraphUsed = graph;
+            break;
+        }
+    }
+
+    // If we still have no label try the predicate itself as the graph
+    if (!foundLabel)
+    {
+        GraphUsed = SourceIRI.ToString();
+        StringBuilder getLabelCommandText = new StringBuilder("sparql define get:soft \"soft\" select * from <" + GraphUsed + "> where {<" + SourceIRI.ToString() + "> ?p ?o}");
+        VirtuosoCommand getLabelCommand = new VirtuosoCommand(getLabelCommandText.ToString(), ParentConnection);
+        getLabelAdapter.SelectCommand = getLabelCommand;
+        try
+        {
+            getLabelAdapter.Fill(getLabelDataSet);
+            foreach (DataRow getLabelRow in getLabelDataSet.Tables[0].Rows)
+            {
+                if (getLabelRow[0].ToString() == "http://www.w3.org/2000/01/rdf-schema#label")
+                {
+                    labelText = getLabelRow[1].ToString();
+                    break;
+                }
+            }
+        }
+        catch
+        {
+        }
+    }
+    return labelText;
+}
+]]></programlisting>
+<para>Notice that the getLabelText method has been moved into this new class and is now called from the
+constructor. When the IRILabel is constructed the label text is found using the list of graphs provided to
+the constructor. The graph containing the label is noted. We need to alter ExtendedStringHandler so that
+the labels are the new IRILabel type and so that the correct information is supplied to the constructor.
+</para>
+  </listitem>
+  <listitem>Change the labelList member variable declaration so it looks like this:
+<programlisting><![CDATA[
+List<IRILabel> labelList = new List<IRILabel>();
+]]></programlisting>
+  </listitem>
+  <listitem>Each propertyLabel created must be the new IRILabel type so the line:
+<programlisting><![CDATA[
+Label propertyLabel = new Label();
+]]></programlisting>
+<para>becomes:
+</para>
+<programlisting><![CDATA[
+IRILabel propertyLabel = new IRILabel(row[0], graphList, ParentConnection);
+]]></programlisting>
+  </listitem>
+  <listitem>As getLabelText is now called by the IRILabel constructor we can remove the line:
+<programlisting><![CDATA[
+propertyLabel.Text = getLabelText(row[0]);
+]]></programlisting>
+<para>from describeData in ExtendedStringHandler.
+</para>
+  </listitem>
+  <listitem>Now we modify the label_Click EventHandler so that it uses the graph information. Replace the
+existing method with:
+<programlisting><![CDATA[
+public void label_Click(object sender, EventArgs e)
+  {
+      int labelNum = 0;
+
+      for (int i = 0; i < labelList.Count; i++)
+      {
+          if (sender == labelList[i])
+          {
+              labelNum = i;
+              break;
+          }
+      }
+
+      SqlExtendedString se = labelList[labelNum].iri;
+      ExtendedStringHandler seHandler = new ExtendedStringHandler(se, ParentConnection, labelList[labelNum].graph);
+          seHandler.displayData();
+
+  }
+]]></programlisting>
+  </listitem>
+  <listitem>Note that this method uses a new constructor for the ExtendedStringHandler that takes the graph
+as an additional argument. We need to add this new constructor.
+<programlisting><![CDATA[
+public ExtendedStringHandler(SqlExtendedString iri, VirtuosoConnection parentConnection, String graph)
+  {
+      ParentConnection = parentConnection;
+      if (iri.IriType == SqlExtendedStringType.IRI)
+      {
+          ParentIRI = iri;
+          isIRI = true;
+          DescribeCommandSimple = new StringBuilder("sparql select * from <http://localhost:8890/Northwind> where {<" + iri.ToString() + "> ?p ?o}");
+          DescribeCommandGeneral = new StringBuilder("sparql define get:soft " + '"'.ToString() + "soft" + '"'.ToString() + " select * from <" + graph + "> where { <" + iri.ToString() + "> ?p ?o }");
+      }
+  }
+]]></programlisting>
+<para>This new constructor uses the supplied graph to build the alternative sparql select statement that
+looks for the details about the supplied IRI. With these changes in place the application will find the
+description of the Northwind properties.
+</para>
+  </listitem>
+  <listitem>Build and run. As you explore the data you will see that you can find descriptions of the
+properties used to describe the entities in the Northwind dataset:
+    <figure id="sparqlwinf24" float="1">
+      <title>Northwind dataset</title>
+      <graphic fileref="ui/sparqlwinf24.png"/>
+    </figure>
+  </listitem>
+</orderedlist>
+    </sect3>
+    </sect2>
+  </sect1>
+
+<sect1 id="installcrweb">
+  <title>Creating a Web Browser Application to Access RDF Data Using The Virtuoso ADO.Net Provider</title>
+<para>This section will guide you through creating first a Web Service that exposes RDF data from Virtuoso
+and then a simple web browser application that consumes the Web Service and allowing you to access and
+explore the RDF data by clicking on dereferenceable <link linkend="rdfiriidtype">IRIs</link>.
+</para>
+<sect2 id="installcrwebintro">
+      <title>Pre-requisites</title>
+<orderedlist>
+  <listitem>The example assumes that you have a local Virtuoso server with the Northwind demo database
+installed. If the demo database is not already installed then download the <ulink url="http://download.openlinksw.com/packages/5.0/virtuoso/demo_dav.vad">demo database VAD package</ulink>
+(demo_dav.vad) and install it. The VAD package will create a new database in Virtuoso called demo
+containing the familiar Northwind tables. It will also creates <ulink url="http://docs.openlinksw.com/virtuoso/rdfsparqlintegrationmiddleware.html#rdfviews">RDF views</ulink> of the Northwind tables.
+In the example we assume the database is accessible on a hostname of "demo.openlinksw.com" on the
+default port 80, where an actually live instance of the Virtuoso Demo database is hosted. Users would
+use the appropriate hostname and port number of their Virtuoso installation to create the sample
+application, and would be would be localhost:8890 for a default installation or whatever the <link linkend="ini_URIQA">URIQA DefaultHost</link>
+Virtuoso configuration parameter is set to when the demo database VAD package is installed.
+  </listitem>
+  <listitem>The Virtuoso ADO.Net provider for .Net 3.5 and the Entity Framework.</listitem>
+  <listitem>Microsoft Visual Studio 2008</listitem>
+  <listitem>The Virtuoso <link linkend="http://download.openlinksw.com/packages/5.0/virtuoso/rdf_mappers_dav.vad">RDF Mappers VAD package</link>.</listitem>
+</orderedlist>
+    </sect2>
+    <sect2 id="installcrwebcrserv">
+      <title>Creating the Web Service</title>
+    <para><emphasis>Step 1 - Create a view of the RDF data</emphasis></para>
+<para>To create a view of the customers in the Northwind first open the Virtuoso Conductor and log in as
+dba. Then open iSQL from the menu on the left and execute the following statement.
+</para>
+<programlisting><![CDATA[
+create view Demo.demo.sparqlview as
+sparql
+select distinct ?s  from <http://localhost:8890/Northwind>
+where {?s a <http://demo.openlinksw.com/schemas/northwind#Customer>}
+]]></programlisting>
+    <para>Note:</para>
+    <itemizedlist mark="bullet">
+      <listitem>If the view is added to the Visual Studio project as user "demo" (or any other than "dba'),
+then it must be ensured that the "SPARQL_SELECT" and "SPARQL_SPONGE" roles are assigned to this user, which
+can be done via the Virtuoso Conductor in the "System Admin" -> "User Accounts" tab. </listitem>
+      <listitem>Execute permissions will also need to be granted to the following procedure:
+<programlisting><![CDATA[
+grant execute on DB.DBA.RDF_MAKE_LONG_OF_SQLVAL to "demo"
+]]></programlisting>
+      </listitem>
+    </itemizedlist>
+        <figure id="sparqlwinf25" float="1">
+      <title>create a view</title>
+      <graphic fileref="ui/sparqlwinf25.png"/>
+    </figure>
+    <para><emphasis>Step 2 - Create the Visual Studio Project and Add the Model</emphasis></para>
+<orderedlist>
+  <listitem>Open <emphasis>Visual Studio</emphasis> and create a new <emphasis>ASP .NET Web Application
+</emphasis> called RDFWebDemo.
+    <figure id="sparqlwinf26" float="1">
+      <title>create new application</title>
+      <graphic fileref="ui/sparqlwinf26.png"/>
+    </figure>
+</listitem>
+  <listitem>Right click RDFWebDemo in the <emphasis>Solution Explorer</emphasis> and add a new
+<emphasis>ADO.NET Entity Data Model</emphasis> called Model1.edmx.
+This will open the Entity Data Model Wizard.</listitem>
+  <listitem>Choose <emphasis>Generate From Database</emphasis> and click <emphasis>Next</emphasis>.</listitem>
+  <listitem>Set up a connection to the Demo database on your local Virtuoso Server, select
+<emphasis>Yes, include the sensitive data in the connection string</emphasis> and set the name of the
+entities to DemoEntities. Click <emphasis>Next</emphasis>.</listitem>
+  <listitem>On the <emphasis>Choose Your Database Objects</emphasis> page expand <emphasis>Views</emphasis>
+and select sparqlview. Check that the Model Namespace is DemoModel and click Finish.
+    <figure id="sparqlwinf27" float="1">
+      <title>Model Namespace</title>
+      <graphic fileref="ui/sparqlwinf27.png"/>
+    </figure>
+</listitem>
+</orderedlist>
+<para>
+</para>
+    <para><emphasis>Step 3 - Add the Web Service</emphasis></para>
+<orderedlist>
+  <listitem>Right click RDFWebDemo in the <emphasis>Solution Explorer</emphasis> and add a new
+<emphasis>ADO.NET Data Service</emphasis> called WebDataService1.svc. Click <emphasis>Add</emphasis>.</listitem>
+  <listitem>In the class definition of WebDataService1 in the newly created file WebDataService1.svc.cs replace /* TODO: put your data source class name here */ with the name of our model, DemoEntities.
+<programlisting><![CDATA[
+public class WebDataService1 : DataService<DemoEntities>
+]]></programlisting>
+</listitem>
+  <listitem>In the InitializeService method add the line:
+<programlisting><![CDATA[
+config.SetEntitySetAccessRule("*", EntitySetRights.All);
+]]></programlisting>
+<para>The method should look like this:
+</para>
+<programlisting><![CDATA[
+ public static void InitializeService(IDataServiceConfiguration config)
+   {
+       // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
+       // Examples:
+       // config.SetEntitySetAccessRule("MyEntityset", EntitySetRights.AllRead);
+       // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
+
+       config.SetEntitySetAccessRule("*", EntitySetRights.All);
+   }
+]]></programlisting>
+</listitem>
+</orderedlist>
+    <para><emphasis>Step 4 - Compile and Run</emphasis></para>
+<para>Hit <emphasis>F5</emphasis> to compile and run the service. Select <emphasis>OK</emphasis> when
+prompted to enable debugging. The default browser will be launched showing a page like:
+</para>
+<programlisting><![CDATA[
+  <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+- <service xml:base="http://localhost:1241/WebDataService1.svc/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app">
+- <workspace>
+  <atom:title>Default</atom:title>
+- <collection href="sparqlview">
+  <atom:title>sparqlview</atom:title>
+  </collection>
+  </workspace>
+  </service>
+]]></programlisting>
+<para>The service is now running.
+</para>
+<para>Note the address on which the service is made available. You will need to know this when creating
+the app to consume the service. Look in the Address Bar of the browser. It will be something like:
+http://localhost:1492/WebDataService1.svc/
+</para>
+    </sect2>
+    <sect2 id="installcrbrappl">
+      <title>Creating the Browser Application</title>
+<para><emphasis>Step 1 - Create the Visual Studio Project.</emphasis></para>
+<orderedlist>
+  <listitem>Open <emphasis>Visual Studio</emphasis> and create a new
+<emphasis>ASP.NET Web Application</emphasis> called RDFWebApp.
+    <figure id="sparqlwinf28" float="1">
+      <title>New Web Application</title>
+      <graphic fileref="ui/sparqlwinf28.png"/>
+    </figure>
+</listitem>
+  <listitem>Create client side entities with datasvcutil.exe
+<itemizedlist mark="bullet">
+  <listitem>Open a command prompt.</listitem>
+  <listitem>Navigate to *C:\WINDOWS\Microsoft.NET\Framework\v3.5*.</listitem>
+  <listitem>Generate the client classes using the following command:
+<programlisting><![CDATA[
+datasvcutil.exe /uri:http://localhost:1492/WebDataService1.svc /out:DemoEntities.cs
+]]></programlisting>
+<para>Note the address of the service - you may need to change the port number to
+match the one seen in the address at the end of Step 4 in Creating the Web Service.
+</para>
+</listitem>
+</itemizedlist>
+</listitem>
+  <listitem>Add the classes to RDFWebApp.
+<itemizedlist mark="bullet">
+  <listitem>Right click RDFWebApp</listitem>
+  <listitem>Choose to add an existing item and add c:\WINDOWS\Microsoft.NET\Framework\v3.5\DemoEntities.cs.</listitem>
+</itemizedlist>
+</listitem>
+  <listitem>Add a reference to System.Data.Services.Client to the project.</listitem>
+</orderedlist>
+<para>
+</para>
+    <para><emphasis>Step 2 - Display the contents of sparqlview as a table on the page</emphasis></para>
+<para>To display the RDF data on the web page we create a table with a row for each item in sparqlview.
+We then use each IRI from sparqlview to create a hyperlink. The hyperlinks are displayed in the table
+cells. To do this add the following block of code to the page_load method in Default.aspx.cs.
+</para>
+<programlisting><![CDATA[
+ DemoModel.DemoEntities svc = new DemoModel.DemoEntities(new Uri("http://localhost:1492/WebDataService1.svc"));
+
+  var query = svc.sparqlview;
+  Table iriTable = new Table();
+  this.Controls.Add(iriTable);
+
+  foreach (DemoModel.sparqlview sv in query)
+  {
+      TableRow tRow = new TableRow();
+      iriTable.Rows.Add(tRow);
+      TableCell tCell = new TableCell();
+      tRow.Cells.Add(tCell);
+      HyperLink h = new HyperLink();
+      h.Text = sv.s;
+      h.NavigateUrl = sv.s;
+      tCell.Controls.Add(h);
+  }
+]]></programlisting>
+<para>Note the address of the service in the first line - you may need to change the port number to match
+the one seen in the address at the end of Step 4 in Creating the Web Service.
+</para>
+<para>Compile and run RDFWebApp (ensuring that the service created above is still running). This will
+launch a browser and display the IRIs from sparqlview as a list of hyperlinks.
+</para>
+    <figure id="sparqlwinf29" float="1">
+      <title>list of hyperlinks</title>
+      <graphic fileref="ui/sparqlwinf29.png"/>
+    </figure>
+<para>With the <ulink url="http://download.openlinksw.com/packages/5.0/virtuoso/rdf_mappers_dav.vad">RDF Mappers VAD package</ulink> installed in Virtuoso, clicking on these
+links will take you to a description page of the referenced resource. The description page is created
+using <ulink url="http://virtuoso.openlinksw.com/Whitepapers/html/vdld_html/VirtDeployingLinkedDataGuide_Glossary.html#mozTocId13075">description.vsp</ulink>.
+</para>
+    <figure id="sparqlwinf30" float="1">
+      <title>Description page</title>
+      <graphic fileref="ui/sparqlwinf30.png"/>
+    </figure>
+    </sect2>
+    <sect2 id="installcrwebiis"><title>Deploy With IIS</title>
+<para>To create and test this simple Web Service we have used the Visual Studio Development Server. This
+section describes how to deploy the service using IIS.
+</para>
+        <sect3 id="installcrwebiiswebs"><title>Web Service</title>
+<para>To deploy the service using IIS:
+</para><itemizedlist mark="bullet">
+  <listitem>Open the RDFWebDemo project in Visual Studio, go to the <emphasis>Project</emphasis> menu
+and select RDFWebDemo <emphasis>Properties</emphasis>.</listitem>
+  <listitem>Select the <emphasis>Web</emphasis> tab and scroll down to the <emphasis>Servers</emphasis>
+section. Select <emphasis>Use local IIS Server</emphasis>. The project URL defaults to using localhost.</listitem>
+  <listitem>Click the <emphasis>Create Virtual Directory</emphasis> button then check that the Service works on localhost.</listitem>
+  <listitem>Build the project then start without debugging (ctrl F5).</listitem>
+</itemizedlist>
+<para>The start page that you see when you test the service will look the same as before but the address
+in the browser bar will be something like http://localhost/RDFWebDemo1/WebDataService1.svc/. You can now
+access your service remotely using the hostname or IP address of your server.
+</para>
+<para>If at this point you get an Access is denied error, 401.3, then you will need to add the Internet
+Guest Account (IUSR_XXX where XXX is your computer name) to the users allowed to access the folder
+containing the RDFWebDemo project.
+</para>
+        </sect3>
+        <sect3 id="installcrwebiisweba"><title>Web Application</title>
+<para>You will now need to modify RDFWebApp to access the service at the new address. At the same time
+we will also change RDFWebApp so that it too is deployed using IIS
+</para>
+<itemizedlist mark="bullet">
+  <listitem>Open The RDFWebApp project in Visual Studio.</listitem>
+  <listitem>Go to the <emphasis>Project</emphasis> menu and select RDFWebApp <emphasis>Properties</emphasis>.</listitem>
+  <listitem>Select the <emphasis>Web</emphasis> tab and scroll down to the <emphasis>Servers</emphasis>
+section. Select <emphasis>Use local IIS Server</emphasis>. The project URL defaults to using localhost.</listitem>
+  <listitem>Click the <emphasis>Create Virtual Directory</emphasis> button. The web application will then run on the local IIS.
+<programlisting><![CDATA[
+DemoModel.DemoEntities svc = new DemoModel.DemoEntities(new Uri("http://localhost:1492/WebDataService1.svc"));
+]]></programlisting>
+<para>to
+</para>
+<programlisting><![CDATA[
+DemoModel.DemoEntities svc = new DemoModel.DemoEntities(new Uri("http://localhost/RDFWebDemo/WebDataService1.svc/"));
+]]></programlisting>
+</listitem>
+  <listitem>To reference the web service running on IIS you will need to edit Default.aspx.cs. Change </listitem>
+  <listitem>Build the project then start without debugging (ctrl F5).</listitem>
+</itemizedlist>
+<para>
+The web application is accessible on http://localhost/RDFWebApp/Default.aspx and can also be accessed using
+the hostname or IP address of you server e.g. http://192.168.7.129/RDFWebApp/Default.aspx
+</para>
+    <figure id="sparqlwinf31" float="1">
+      <title>Default.aspx</title>
+      <graphic fileref="ui/sparqlwinf31.png"/>
+    </figure>
+    </sect3>
+    <para><emphasis>Next Steps</emphasis></para>
+<para>The next example shows you how to quickly create an ADO.Net Data Service that exposes RDF data in
+Virtuoso and how to create a basic Web application to consume that service. The next step is to
+<link linkend="installsilver">create a Silverlight Application to consume the same service</link>.
+</para>
+    </sect2>
+  </sect1>
+
+
+<sect1 id="installsilver"><title>Creating a Silverlight Application to consume the service</title>
+<para>This section will guide you through creating an application for Silverlight that will consume
+the ADO.Net Data Service created in <link linkend="installcrweb">Creating a Web Browser Application to Access RDF Data Using The
+Virtuoso ADO.Net Provider.</link>
+</para>
+      <sect2 id="installsilverpreq">
+        <title>Pre-requisites</title>
+<orderedlist>
+  <listitem>The <ulink url="http://www.microsoft.com/downloads/details.aspx?FamilyId=c22d6a7b-546f-4407-8ef6-d60c8ee221ed&displaylang=en">Microsoft Silverlight 2 Tools for Visual Studio 2008 SP1</ulink></listitem>
+  <listitem>The ADO.Net Data Service created in <link linkend="installcrweb">Creating a Web Browser Application to Access RDF Data Using The
+Virtuoso ADO.Net Provider.</link></listitem>
+  <listitem>The Visual Studio project used to create the ADO.Net Data Service.</listitem>
+</orderedlist>
+    </sect2>
+    <sect2 id="installsilvercrser">
+        <title>Creating the Application for Silverlight.</title>
+<orderedlist>
+  <listitem>Open the ADO.Net Data Service project in <emphasis>Visual Studio</emphasis></listitem>
+  <listitem>In the <emphasis>Solution Explorer</emphasis> right click on the RDFWebDemo solution and add a new Project. </listitem>
+  <listitem>In the <emphasis>Add New Project</emphasis> dialog select
+<emphasis>Silverlight Application</emphasis> and click <emphasis>OK</emphasis>. This will open
+the <emphasis>Add Silverlight Application</emphasis> dialog.
+      <figure id="sparqlwinf32" float="1">
+      <title>Add Silverlight Application</title>
+      <graphic fileref="ui/sparqlwinf32.png"/>
+    </figure>
+  </listitem>
+  <listitem>Select <emphasis>Link this Silverlight Control into an existing Web Site</emphasis> and make
+sure the Web Site selected is RDFWebDemo. Select
+<emphasis>Add a test page that references the application</emphasis> and <emphasis>Make it the start
+page</emphasis>.
+      <figure id="sparqlwinf33" float="1">
+      <title>Add a test page</title>
+      <graphic fileref="ui/sparqlwinf33.png"/>
+    </figure>
+  </listitem>
+  <listitem>In Solution Explorer, select RDFWebDemo, open the Project menu and select Properties. </listitem>
+  <listitem>Select the <emphasis>Web</emphasis> tab, and select <emphasis>Specific Page</emphasis>
+in the <emphasis>Start Action</emphasis> section. Click on the ellipsis and select
+SilverlightApplication1TestPage.html as the start page. </listitem>
+  <listitem>Add a reference to the data service. In the <emphasis>Solution Explorer</emphasis> right click
+on SilverlightApplication1 and select <emphasis>Add Service Reference</emphasis></listitem>
+  <listitem>In the <emphasis>Add Service Reference</emphasis> dialog click the <emphasis>Discover</emphasis>
+button. Your ADO.Net Data Service should appear in the Address box and the Services box. </listitem>
+  <listitem>Select the service and click <emphasis>OK</emphasis>. ServiceReference1 will now be added to
+the ServiceReferences. </listitem>
+  <listitem>Open page.xaml.cs and add references to the service and to the System.Data.Services.Client
+assembly by adding the following using statements at the top of the file:
+  <programlisting><![CDATA[
+using System.Data.Services.Client;
+using SilverlightApplication1.ServiceReference1;
+]]></programlisting>
+  </listitem>
+  <listitem>We need at create a data service context to reference the data from the service and to load data
+from the view, sparqlview, exposed by the service. Add the following lines to the page constructor after
+InitializeComponent()
+<programlisting><![CDATA[
+DataServiceContext svcCtx = new DataServiceContext(new Uri("WebDataService1.svc", UriKind.Relative));
+svcCtx.BeginExecute<sparqlview>(new Uri("sparqlview", UriKind.Relative), loadSCallback, svcCtx);
+]]></programlisting>
+  </listitem>
+  <listitem>Add the loadSCallback method to the page class. The method loads the data from sparqlview and
+puts it in a List. This List populates a list box on the page.
+<programlisting><![CDATA[
+private void loadSCallback(IAsyncResult asyncResult)
+{   List<Uri> uList = new List<Uri>();
+    DataServiceContext ctx = asyncResult.AsyncState as DataServiceContext;
+    foreach (sparqlview sv in ctx.EndExecute<sparqlview>(asyncResult))
+     uList.Add(new Uri(sv.s));
+    listBox1.DataContext = uList;
+}
+]]></programlisting>
+  </listitem>
+  <listitem>Add the list box to the page. In the <emphasis>Solution Explorer</emphasis> double click on
+page.xaml to open it in the editor. Add the following code between the <grid> and </grid> tags.
+<programlisting><![CDATA[
+<ListBox x:Name="listBox1"
+    HorizontalAlignment="Stretch"
+    Margin="25,8,26,-78" Grid.RowSpan="1"
+    Grid.Row="0" VerticalAlignment="Stretch"
+    ItemsSource="{Binding Mode=OneWay}" >
+    <ListBox.ItemTemplate>
+        <DataTemplate>
+            <StackPanel x:Name="DisplayListData"
+             Orientation="Horizontal"
+             VerticalAlignment="Bottom"
+             Margin="5" >
+                <HyperlinkButton
+                 Content ="{Binding}"
+                 NavigateUri="{Binding}"
+                 Margin="5,0,0,0"
+                 VerticalAlignment="Bottom"
+                 HorizontalAlignment="Left"
+                 FontSize="12">
+                </HyperlinkButton>
+            </StackPanel>
+        </DataTemplate>
+    </ListBox.ItemTemplate>
+</ListBox>
+]]></programlisting>
+  </listitem>
+  <listitem>Build the Silverlight application and launch without debugging using <emphasis>Ctrl F5</emphasis>.
+This will launch the browser and open SilverlightApplication1TestPage.aspx.
+        <figure id="sparqlwinf34" float="1">
+      <title>SilverlightApplication1TestPage.aspx</title>
+      <graphic fileref="ui/sparqlwinf34.png"/>
+    </figure>
+  </listitem>
+</orderedlist>
+<para>
+Clicking on one of the IRIs will open the page using description.vsp.
+</para>
+            <figure id="sparqlwinf35" float="1">
+      <title>using description.vsp</title>
+      <graphic fileref="ui/sparqlwinf35.png"/>
+    </figure>
+    </sect2>
+</sect1>
+
+<sect1 id="installnetriadd"><title>Creating A Simple .NET RIA Services Application To Display Data
+From Virtuoso</title>
+<para>.NET RIA Services is a new framework from Microsoft that simplifies the development of n-tier web
+applications. A typical application will consist of a presentation layer, application logic and a data
+access layer. In these examples a combination of Silverlight 3 and .NET RIA Services will provide the
+presentation layer and application layer while the data will reside in Virtuoso and be accessed using
+the Virtuoso ADO.NET provider. The first example demonstrates how to display data from the Employee
+table in the Demo database in a grid on a web page. The second example shows how to display IRIs from
+the RDF views of the demo data. The IRIs are used to create hyperlinks that are the starting point
+for exploring the linked data.
+</para>
+      <sect2 id="installnetriaddpreq">
+        <title>Pre-requisites</title>
+<orderedlist>
+  <listitem>The example assumes that you have a local Virtuoso server with the Northwind demo database
+installed. If the demo database is not already installed then download the demo database VAD package
+(demo_dav.vad) and install it. The VAD package will create a new database in Virtuoso called demo
+containing the familiar Northwind tables. It will also creates RDF views of the Northwind tables.
+In the example we assume the database is accessible on a hostname of "demo.openlinksw.com" on the
+default port 80, where an actually live instance of the Virtuoso Demo database is hosted. Users
+would use the appropriate hostname and port number of their Virtuoso installation to create the
+sample application, and would be would be localhost:8890 for a default installation or whatever
+the URIQA DefaultHost Virtuoso configuration parameter is set to when the demo database VAD package
+is installed.</listitem>
+  <listitem>The Virtuoso ADO.Net provider for .Net 3.5 and the Entity Framework.</listitem>
+  <listitem>Microsoft Visual Studio 2008</listitem>
+  <listitem>The Virtuoso RDF Mappers VAD package.</listitem>
+  <listitem><ulink url="http://www.microsoft.com/downloads/details.aspx?familyid=9442b0f2-7465-417a-88f3-5e7b5409e9dd&displaylang=en">Silverlight 3 Tools for Visual Studio 2008 SP1</ulink>.</listitem>
+  <listitem><ulink url="http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&displaylang=en">Microsoft .NET RIA Services July 2009 Preview</ulink>.</listitem>
+</orderedlist>
+    </sect2>
+    <sect2 id="installnetriaddcrser">
+        <title>Creating the Application</title>
+<para><emphasis>Step 1 - Create the Visual Studio Projects.</emphasis></para>
+<orderedlist>
+  <listitem>Open <emphasis>Visual Studio</emphasis> and create a new <emphasis>Silverlight Application</emphasis> project. Call the project DemoApplication.</listitem>
+  <listitem>In the New Silverlight Application dialog ensure that <emphasis>Enable .NET RIA Services</emphasis> is checked. Click the <emphasis>OK</emphasis> button.
+      <figure id="ria1" float="1">
+        <title>.NET RIA Services Application</title>
+        <graphic fileref="ui/ria1.png"/>
+      </figure>
+  </listitem>
+</orderedlist>
+  <para>At this point a skeleton solution is created that consists of a client project called DemoApplication
+and a server project called DemoApplication.Web. This application will use data from the Virtuoso database.
+We add the data and its schema to the application by adding an ADO.NET entity data model to the server
+project.</para>
+<para><emphasis>Step 2 -  Add the Data Model</emphasis></para>
+<orderedlist>
+  <listitem>Right click the server project in the <emphasis>Solution Explorer</emphasis> and
+<emphasis>Add New Item</emphasis>. In the dialog box select <emphasis>ADO.NET Entity Data Model</emphasis>
+and call it demo.edmx. Click the <emphasis>Add</emphasis> button. This will open the
+<emphasis>Entity Data Model Wizard</emphasis>.</listitem>
+  <listitem>Choose <emphasis>Generate From Database</emphasis> and click <emphasis>Next</emphasis>.</listitem>
+  <listitem>Set up a connection to the Demo database on your local Virtuoso Server, select
+<emphasis>Yes, include the sensitive data in the connection string</emphasis> and set the name of the
+entities to DemoEntities. Click <emphasis>Next</emphasis>.</listitem>
+  <listitem>On the <emphasis>Choose Your Database Objects</emphasis> page expand <emphasis>Tables</emphasis>
+and select Employees. Check that the Model Namespace is DemoModel and click <emphasis>Finish</emphasis>.</listitem>
+</orderedlist>
+      <figure id="ria2" float="1">
+        <title>.NET RIA Services Application</title>
+        <graphic fileref="ui/ria2.png"/>
+      </figure>
+  <para>We want to make the entities in the model available to both the client and server parts of the
+solution. To do this we need to add a DomainService to the solution. However, to make the entities from
+the data model available to the domain service we must first build the solution.</para>
+<para><emphasis>Step 3 - Add a Domain Service.</emphasis></para>
+<orderedlist>
+  <listitem>First build the solution.</listitem>
+  <listitem>Right click the server project in the <emphasis>Solution Explorer</emphasis> and
+<emphasis>Add New Item</emphasis>. In the dialog box choose <emphasis>Domain Service Class</emphasis>
+from the Templates pane and call it EmployeeService.cs. Click <emphasis>Add</emphasis>. This will open the
+<emphasis>Add New Domain Service Class</emphasis> dialog.</listitem>
+  <listitem>The entities from the model we have just added to the project are listed under
+<emphasis>Entities</emphasis>. Tick the box next to Employees. and click OK.</listitem>
+</orderedlist>
+      <figure id="ria3" float="1">
+        <title>.NET RIA Services Application</title>
+        <graphic fileref="ui/ria3.png"/>
+      </figure>
+<para>This will create the DomainService class and generated code in both the client and server parts of
+the application. The Silverlight client can now interact with the data through the DomainContext class
+in the client project. At this point you need to build the solution again.
+</para>
+<para><emphasis>Step 4 -  Display The Data</emphasis></para>
+<orderedlist>
+  <listitem>From the <emphasis>Silverlight XAML Controls</emphasis> in the <emphasis>Toolbox</emphasis>
+drag a <emphasis>DataGrid</emphasis> between the <Grid> </Grid> tags on MainPage.xaml in the client. Call the grid EmployeeGrid.
+<programlisting><![CDATA[
+<data:DataGrid Name="EmployeeGrid"></data:DataGrid>
+]]></programlisting>
+</listitem>
+  <listitem>Instantiate the DomainContext to get the list of employees and add them to the grid by
+adding code to MainPage.xaml.cs so it looks like this:
+<programlisting><![CDATA[
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using DemoApplication.Web;
+using System.Windows.Ria.Data;
+
+namespace DemoApplication
+{
+    public partial class MainPage : UserControl
+    {
+        private EmployeeContext _employeeContext = new EmployeeContext();
+        public MainPage()
+        {
+            InitializeComponent();
+            LoadOperation<Employees> LoadOp =
+                this._employeeContext.Load(this._employeeContext.GetEmployeesQuery());
+            this.EmployeeGrid.ItemsSource = LoadOp.Entities;
+        }
+    }
+}
+]]></programlisting>
+</listitem>
+  <listitem>Build and run the application. Internet Explorer will be launched and you will see the data
+displayed on the page as a grid.
+</listitem>
+</orderedlist>
+      <figure id="ria4" float="1">
+        <title>.NET RIA Services Application</title>
+        <graphic fileref="ui/ria4.png"/>
+      </figure>
+   </sect2>
+   <sect2 id="installnetriaddcrdf">
+     <title>Displaying RDF Data</title>
+     <para>One advantage of using Virtuoso as the data store is the seamless way in which we can use
+this use this application to display dereferencable IRIs and explore RDF linked data.
+     </para>
+     <para>The Virtuoso SPASQL interface allows RDF data in the Virtuoso Quad store to be queried
+using SPARQL from any SQL interface by simply prefixing the SPARQL query with the keyword SPARQL.
+We will use the SPASQL interface to create a view containing the IRIs of the Employees in the
+the Demo RDF data in Virtuoso.
+     </para>
+<para><emphasis>Step 1 -  Create the View in Virtuoso</emphasis></para>
+<orderedlist>
+  <listitem>Open the Virtuoso Conductor.</listitem>
+  <listitem>In isql execute the following statement. Remember to use the appropriate hostname and port
+number of your Virtuoso installation, typically localhost:8890 for a default installation or whatever
+the <link linkend="ini_URIQA">URIQA DefaultHost</link> Virtuoso configuration parameter was set to when
+the demo database VAD package was installed.
+<programlisting><![CDATA[
+CREATE VIEW Demo.demo.sparqlview as
+SPARQL
+PREFIX nwind: <http://demo.openlinksw.com/schemas/northwind#>
+SELECT DISTINCT  ?s
+FROM <http://demo.openlinksw.com/Northwind>
+WHERE
+  {
+    ?s a nwind:Employee
+  }
+]]></programlisting>
+</listitem>
+</orderedlist>
+<para><emphasis>Step 2 -  Modify the Solution To use the View</emphasis></para>
+<orderedlist>
+  <listitem>Delete the existing Employee model and add a new one that comprises this new view.
+    <figure id="ria5" float="1">
+      <title>.NET RIA Services Application</title>
+      <graphic fileref="ui/ria5.png"/>
+    </figure>
+  </listitem>
+  <listitem>Delete the DomainService. Build the solution and add a new DomainService called
+EmployeeService. Select the sparqlview entity. Build the solution.
+    <figure id="ria6" float="1">
+      <title>.NET RIA Services Application</title>
+      <graphic fileref="ui/ria6.png"/>
+    </figure>
+  </listitem>
+ <listitem>Modify the code in mainpage.xaml.cs so it uses the sparqview entity. It should look like this:
+<programlisting><![CDATA[
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using DemoApplication.Web;
+using System.Windows.Ria.Data;
+
+namespace DemoApplication
+{
+    public partial class MainPage : UserControl
+    {
+        private EmployeeContext _employeeContext = new EmployeeContext();
+        public MainPage()
+        {
+            InitializeComponent();
+            LoadOperation<sparqlview> LoadOp =
+                this._employeeContext.Load(this._employeeContext.GetSparqlviewQuery());
+            this.EmployeeGrid.ItemsSource = LoadOp.Entities;
+        }
+    }
+}
+]]></programlisting>
+</listitem>
+  <listitem>Build and run the application. You will see a list of IRIs that identify the Northwind employees.
+    <figure id="ria7" float="1">
+      <title>.NET RIA Services Application</title>
+      <graphic fileref="ui/ria7.png"/>
+    </figure>
+  </listitem>
+</orderedlist>
+<para>To realize the power of linked data we would now liked to begin exploring this data by clicking on
+these IRIs.</para>
+<para><emphasis>Step 3 - Make Hyperlinks From IRIs</emphasis></para>
+<orderedlist>
+  <listitem>Modify the DataGrid in MainPage.xaml to bind the IRI in each cell of the grid to a
+Hyperlink button. We set the AutoGenerateColumns property of the DataGrid to False then add our
+own Template for the column. MainPage.xaml should look like this:
+<programlisting><![CDATA[
+<UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  x:Class="DemoApplication.MainPage"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
+  <Grid x:Name="LayoutRoot">
+      <data:DataGrid Name="EmployeeGrid" AutoGenerateColumns="False">
+            <data:DataGrid.Columns>
+                <data:DataGridTemplateColumn Header="Employee">
+                    <data:DataGridTemplateColumn.CellTemplate>
+                        <DataTemplate>
+                            <StackPanel x:Name="DisplayEmployeeData"
+                                        Orientation="Horizontal"
+                                        VerticalAlignment="Bottom"
+                                        Margin="5" >
+                                <HyperlinkButton Content ="{Binding s}"
+                                                 NavigateUri="{Binding s}"
+                                                 Margin="5,0,0,0"
+                                                 VerticalAlignment="Bottom"
+                                                 HorizontalAlignment="Left"
+                                                 FontSize="12">
+                                </HyperlinkButton>
+                            </StackPanel>
+                        </DataTemplate>
+                    </data:DataGridTemplateColumn.CellTemplate>
+                </data:DataGridTemplateColumn>
+            </data:DataGrid.Columns>
+        </data:DataGrid>
+    </Grid>
+</UserControl>
+]]></programlisting>
+</listitem>
+  <listitem>If we build and run the project now each IRI in the list appears as a hyperlink.
+    <figure id="ria8" float="1">
+      <title>.NET RIA Services Application</title>
+      <graphic fileref="ui/ria8.png"/>
+    </figure>
+</listitem>
+  <listitem>Clicking on each of the links takes you to a new document that contains further links
+to information about each Employee. The Demo dataset can be explored further by following the
+dereferenceable IRIs in the description pages.
+    <figure id="ria9" float="1">
+      <title>.NET RIA Services Application</title>
+      <graphic fileref="ui/ria9.png"/>
+    </figure>
+    <figure id="ria10" float="1">
+      <title>.NET RIA Services Application</title>
+      <graphic fileref="ui/ria10.png"/>
+    </figure>
+</listitem>
+</orderedlist>
+   </sect2>
+   <sect2 id="installnetriaddcnext">
+     <title>Next Steps</title>
+     <para>The examples in this document show you how to simply display data in a browser using
+Silverlight 3 and .NET RIA Services. See an <link linkend="installnetriavd">example</link> of a
+more complicated application.</para>
+   </sect2>
+</sect1>
+
+<sect1 id="installnetriavd"><title>Creating a .Net RIA Services Application That Will Update Virtuoso Data</title>
+<para>This example demonstrates how data in Virtuoso can be updated from a Microsoft .NET RIA Services
+application. The example is a continuation of the first example in <link linkend="installnetriadd">Creating a Simple .Net RIA Services
+Application to Display Data From Virtuoso</link>.</para>
+      <sect2 id="installnetriavdpreq">
+        <title>Pre-requisites</title>
+<orderedlist>
+  <listitem>A working copy of the application created in <link linkend="installnetriadd">Creating a
+Simple .Net RIA Services Application to Display Data From Virtuoso</link>.</listitem>
+</orderedlist>
+    </sect2>
+    <sect2 id="installnetriavdcrser">
+        <title>Creating the Application</title>
+<para><emphasis>Step 1 - Add A New Domain Service Class</emphasis></para>
+<para>The EmployeeService Domain Service Class was only used to display data so was created
+read only. In this example we need to be able to update the data so we need to remove the read
+only Domain Service Class and create a new on.</para>
+<orderedlist>
+  <listitem>In the <emphasis>Server Explorer</emphasis> right click EmployeeService and select <emphasis>Delete</emphasis></listitem>
+  <listitem>Right click the server project and <emphasis>Add New Item</emphasis>. In the dialog box choose Domain Service Class from the Templates pane and again call it EmployeeService.cs. Click Add.</listitem>
+  <listitem>Select the Employees entity and tick <emphasis>Enable editing</emphasis>. Also tick <emphasis>Generated associated classes for metadata</emphasis>.
+      <figure id="riad1" float="1">
+        <title>.NET RIA Services Application</title>
+        <graphic fileref="ui/riad1.png"/>
+      </figure>
+  </listitem>
+  <listitem>Update MainPage.xaml.cs to use EmployeeService2 the new domain service rather than EmployeeContext.</listitem>
+</orderedlist>
+  <para>We want to create a master detail style page. To do this we will use the DomainDataSourceComponent
+from the Silverlight Components. But first we will add a pager so only 5 records are displayed at a time.</para>
+<para><emphasis>Step 2 - Add a DataPager</emphasis></para>
+<orderedlist>
+  <listitem>Add two new namespaces to MainPage.xaml
+<programlisting><![CDATA[
+xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Ria.Controls"
+xmlns:ds="clr-namespace:DemoApplication.Web"
+]]></programlisting>
+  </listitem>
+  <listitem>Use a DomainDataSource to provide the data to fill the grid. Add the following to
+MainPage.xaml before the DataGrid.
+<programlisting><![CDATA[
+<riaControls:DomainDataSource x:Name="EmployeeDataSource"
+                              QueryName="GetEmployeesQuery"
+                              LoadSize="10"
+                              AutoLoad="True">
+    <riaControls:DomainDataSource.DomainContext>
+        <ds:EmployeeService2/>
+    </riaControls:DomainDataSource.DomainContext>
+</riaControls:DomainDataSource>
+]]></programlisting>
+  </listitem>
+  <listitem>Update the MainPage.xaml.cs code behind file. Using the DomainDataSource means you no
+longer need to instantiate the context and load the grid in MainPage.xaml.cs so it becomes:
+<programlisting><![CDATA[
+public partial class MainPage : UserControl
+{
+    public MainPage()
+    {
+        InitializeComponent();
+    }
+}
+]]></programlisting>
+  </listitem>
+  <listitem>Set the binding source of the DataGrid to the DomainDataSource
+<programlisting><![CDATA[
+<data:DataGrid MinHeight="100"  IsReadOnly="True" ItemsSource="{Binding Data, ElementName=EmployeeDataSource}" x:Name="DataGrid1"></data:DataGrid> />
+]]></programlisting>
+  </listitem>
+  <listitem>Drag a DataPager form the tool box onto MainPage.xaml just after the DataGrid.
+  </listitem>
+  <listitem>Add a page size and binding element to the DataPager.
+<programlisting><![CDATA[
+<data:DataPager PageSize="5" Source="{Binding Data, ElementName=employeeDataSource}"
+                      Margin="0,-1,0,0"></data:DataPager>
+]]></programlisting>
+  </listitem>
+  <listitem>Build and run the application. The data should be displayed 5 rows at a time.
+      <figure id="riad2" float="1">
+        <title>.NET RIA Services Application</title>
+        <graphic fileref="ui/riad2.png"/>
+      </figure>
+  </listitem>
+</orderedlist>
+  <para>We now need to add a DataForm to display the details.</para>
+<para><emphasis>Step 3 - Add a DataForm</emphasis></para>
+<orderedlist>
+  <listitem>Add the following namespace to MainPage.xaml
+<programlisting><![CDATA[
+xmlns:dataForm="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
+]]></programlisting>
+</listitem>
+  <listitem>Add the form to MainPage.xaml
+<programlisting><![CDATA[
+<dataForm:DataForm x:Name="dataForm1" Header="Employee Information"  AutoGenerateFields="False" AutoEdit="False" AutoCommit="False" CurrentItem="{Binding SelectedItem, ElementName=DataGrid1}" Margin="0,12,0,0">
+   <dataForm:DataForm.EditTemplate>
+       <DataTemplate>
+           <StackPanel>
+               <dataForm:DataField Label="Employee ID">
+                   <TextBox Text="{Binding EmployeeID, Mode=TwoWay}" />
+               </dataForm:DataField>
+               <dataForm:DataField Label="First Name">
+                   <TextBox Text="{Binding FirstName, Mode=TwoWay}" />
+               </dataForm:DataField>
+               <dataForm:DataField Label="Last Name">
+                   <TextBox Text="{Binding LastName, Mode=TwoWay}" />
+               </dataForm:DataField>
+               <dataForm:DataField Label="Courtesy Title">
+                   <TextBox Text="{Binding TitleOfCourtesy, Mode=TwoWay}" />
+               </dataForm:DataField>
+               <dataForm:DataField Label="Hire Date">
+                   <TextBox Text="{Binding HireDate, Mode=TwoWay}" />
+               </dataForm:DataField>
+               <dataForm:DataField Label="Title">
+                   <TextBox Text="{Binding Title, Mode=TwoWay}"  />
+               </dataForm:DataField>
+               <dataForm:DataField Label="Reports To">
+                   <TextBox Text="{Binding ReportsTo, Mode=TwoWay}"  />
+               </dataForm:DataField>
+               <dataForm:DataField Label="Region">
+                   <TextBox Text="{Binding Region, Mode=TwoWay}"  />
+               </dataForm:DataField>
+               <dataForm:DataField Label="Address">
+                   <TextBox Text="{Binding Address, Mode=TwoWay}"  />
+               </dataForm:DataField>
+               <dataForm:DataField Label="City">
+                   <TextBox Text="{Binding City, Mode=TwoWay}"  />
+               </dataForm:DataField>
+               <dataForm:DataField Label="Country Code">
+                   <TextBox Text="{Binding CountryCode, Mode=TwoWay}"  />
+               </dataForm:DataField>
+               <dataForm:DataField Label="Postal Code">
+                   <TextBox Text="{Binding PostalCode, Mode=TwoWay}"  />
+               </dataForm:DataField>
+                   </StackPanel>
+       </DataTemplate>
+   </dataForm:DataForm.EditTemplate>
+ </dataForm:DataForm>
+]]></programlisting>
+</listitem>
+  <listitem>Surround the DomainDataSource, DataGrid and DataForm with
+<programlisting><![CDATA[
+        <ScrollViewer BorderThickness="0"  VerticalScrollBarVisibility="Auto" Padding="12,0,12,0" Margin="-2">
+            <StackPanel Margin="0,12,0,12" Orientation="Vertical" >
+.
+.
+.
+            </StackPanel>
+        </ScrollViewer>
+]]></programlisting>
+</listitem>
+  <listitem>Build and run the application. As each employee is selected the data form fill with their details
+      <figure id="riad3" float="1">
+        <title>.NET RIA Services Application</title>
+        <graphic fileref="ui/riad3.png"/>
+      </figure>
+</listitem>
+</orderedlist>
+<para>By clicking on the pencil symbol in the top right hand corner the data in the form can be edited
+but it is not propagated back to the database.</para>
+   </sect2>
+    <sect2 id="installnetriavdcrprup">
+        <title>Propagate Updates to Virtuoso</title>
+<orderedlist>
+  <listitem>Add a 'Submit' button just after the DataForm in MainPage.xaml by adding the following code.
+<programlisting><![CDATA[
+<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,12,0,0">
+  <Button x:Name="submitButton" Width="75" Height="23"  Content="Submit"  Margin="4,0,0,0" Click="submitButton_Click"/>
+</StackPanel>
+]]></programlisting>
+</listitem>
+  <listitem>Handle the button click event in MainPage.xaml.cs by adding the following code:
+<programlisting><![CDATA[
+private void submitButton_Click(object sender, RoutedEventArgs e)
+        {
+            EmployeeDataSource.SubmitChanges();
+        }
+]]></programlisting>
+</listitem>
+  <listitem>Build and run the application. If you now edit data in the form and click the submit button
+the data in Virtuoso will be updated.
+      <figure id="riad4" float="1">
+        <title>.NET RIA Services Application</title>
+        <graphic fileref="ui/riad4.png"/>
+      </figure>
+</listitem>
+</orderedlist>
+   </sect2>
+</sect1>
+
+
+<sect1 id="clusterstcnf"><title>Cluster Installation and Config</title>
+    <sect2 id="clusterstcnfsetup"><title>Creating New Cluster Setup</title>
+      <para>After the installation of V6 is done, in order to setup a Cluster you need to perform the
+following steps (working on Unix and MacOsX):</para>
+<orderedlist>
+  <listitem>Determine how many nodes you want to start the cluster with: 2, 4, 6, 8
+<itemizedlist mark="bullet">
+  <listitem>Note: the number of the nodes should be >= 2 </listitem>
+</itemizedlist>
+</listitem>
+  <listitem>Place the following files respectively to your Virtuoso installation folders:
+<itemizedlist mark="bullet">
+  <listitem>bin folder: the virtuoso-restore.sh file:
+<programlisting><![CDATA[
+#!/bin/sh
+#
+#  $Id: installation.xml,v 1.5.2.3 2010/10/07 12:44:59 source Exp $
+#
+#  (C) 2007 OpenLink Software
+#
+#  The copyright above and this notice must be preserved in all
+#  copies of this source code.  The copyright above does not
+#  evidence any actual or intended publication of this source code.
+#
+#  This is unpublished proprietary trade secret of OpenLink Software.
+#  This source code may not be copied, disclosed, distributed, demonstrated
+#  or licensed except as authorized by OpenLink Software.
+#
+#  To learn more about this product, or any other product in our
+#  portfolio, please check out our web site at:
+#
+#      http://www.openlinksw.com
+#
+#  or contact us at:
+#
+#      general.information at openlinksw.com
+#
+#  If you have any technical questions, please contact our support
+#  staff at:
+#
+#      technical.support at openlinksw.com
+#
+
+
+#
+#  Set up the script
+#
+umask 022
+
+#
+#  Optional argument which database to start/stop
+#
+DBDIR=${1-all}
+BPREF=${2-bkp}
+
+
+#
+#  Check if we need to be silent
+#
+SILENT=${SILENT-"0"}
+if test "$SILENT" = "0"
+then
+    ECHO=echo
+else
+    ECHO=:
+fi
+
+
+#
+#  Script information
+#
+SCRIPT_NAME=`basename $0`
+SCRIPT_VERSION="1.0"
+SCRIPT_DATE="Wed Apr 18 2007"
+
+
+#
+#  Where to look
+#
+if test "x$VIRTUOSO_HOME" = "x"
+then
+    VIRTUOSO_HOME="`dirname $0`/.."
+    VIRTUOSO_HOME=`cd $VIRTUOSO_HOME >/dev/null && pwd`
+fi
+if test "x$VIRTUOSO_HOME" = "x"
+then
+    echo ""
+    echo "***"
+    echo "*** ERROR: Unable to determine value for \$VIRTUOSO_HOME"
+    echo "***"
+
+    exit 1
+fi
+if test \! -f "$VIRTUOSO_HOME/bin/virtuoso-iodbc-t"
+then
+    echo ""
+    echo "***"
+    echo "*** ERROR: \$VIRTUOSO_HOME does not appear to contain standard virtuoso binary"
+    echo "***"
+
+    exit 1
+fi
+export VIRTUOSO_HOME SCRIPT_NAME
+
+#
+#  Read local environment
+#
+if test -f "$VIRTUOSO_HOME/virtuoso-environment.sh"
+then
+    . "$VIRTUOSO_HOME/virtuoso-environment.sh"
+fi
+
+
+#
+#  Try to start the oplmgr if available
+#
+cd "$VIRTUOSO_HOME/bin"
+if test -x oplmgr
+then
+    ./oplmgr +start 2>/dev/null
+fi
+
+
+#
+#  Check which database(s) to start
+#
+cd "$VIRTUOSO_HOME"
+if test "$DBDIR" = "all"
+then
+    DBDIR=""
+    for f in `ls -1 */virtuoso.ini 2>/dev/null`
+    do
+	d=`dirname $f`
+
+        if test -d "$d"
+	then
+  	    DBDIR="$DBDIR $d"
+	fi
+    done
+fi
+
+
+#
+#  Perform the start/stop command
+#
+for d in $DBDIR
+do
+   $ECHO "Starting Virtuoso instance in [$d]"
+   $VIRTUOSO_HOME/install/command-restore.sh $d $BPREF
+done
+
+exit 0
+
+]]></programlisting>
+</listitem>
+  <listitem>folder install: the files command-restore.sh and mk_cluster.sh:
+<para>command-restore.sh</para>
+<programlisting><![CDATA[
+#!/bin/sh
+#
+#  $Id: installation.xml,v 1.5.2.3 2010/10/07 12:44:59 source Exp $
+#
+#  (C) 2007 OpenLink Software
+#
+#  The copyright above and this notice must be preserved in all
+#  copies of this source code.  The copyright above does not
+#  evidence any actual or intended publication of this source code.
+#
+#  This is unpublished proprietary trade secret of OpenLink Software.
+#  This source code may not be copied, disclosed, distributed, demonstrated
+#  or licensed except as authorized by OpenLink Software.
+#
+#  To learn more about this product, or any other product in our
+#  portfolio, please check out our web site at:
+#
+#      http://www.openlinksw.com
+#
+#  or contact us at:
+#
+#      general.information at openlinksw.com
+#
+#  If you have any technical questions, please contact our support
+#  staff at:
+#
+#      technical.support at openlinksw.com
+#
+
+
+#
+#  Set up the script
+#
+umask 022
+
+
+#
+#  Optional argument which database to startup
+#
+DBDIR=${1-database}
+BPREF=${2-bkp}
+
+#
+#  Script information
+#
+SCRIPT_NAME=`basename $0`
+SCRIPT_VERSION="1.0"
+SCRIPT_DATE="Wed Apr 18 2007"
+
+
+#
+#  Where to look
+#
+if test "x$VIRTUOSO_HOME" = "x"
+then
+    VIRTUOSO_HOME="`dirname $0`/.."
+    VIRTUOSO_HOME=`cd $VIRTUOSO_HOME >/dev/null && pwd`
+fi
+if test "x$VIRTUOSO_HOME" = "x"
+then
+    echo ""
+    echo "***"
+    echo "*** ERROR: Unable to determine value for \$VIRTUOSO_HOME"
+    echo "***"
+
+    exit 1
+fi
+if test \! -f "$VIRTUOSO_HOME/bin/virtuoso-iodbc-t"
+then
+    echo ""
+    echo "***"
+    echo "*** ERROR: \$VIRTUOSO_HOME does not appear to contain standard virtuoso binary"
+    echo "***"
+
+    exit 1
+fi
+export VIRTUOSO_HOME SCRIPT_NAME
+
+
+#
+#  Settings
+#
+SLEEP=5
+INIFILE="$VIRTUOSO_HOME/bin/inifile"
+INIFLAGS="+inifile virtuoso.ini"
+
+
+#
+#  Read local environment
+#
+if test -f "$VIRTUOSO_HOME/virtuoso-environment.sh"
+then
+    . "$VIRTUOSO_HOME/virtuoso-environment.sh"
+fi
+
+
+#
+#  Check if database directory exists
+#
+if test \! -d "$VIRTUOSO_HOME/$DBDIR"
+then
+    echo ""
+    echo "***"
+    echo "***  WARNING: \$VIRTUOSO_HOME/$DBDIR does not exist"
+    echo "***"
+
+    exit 1
+fi
+
+
+#
+#  Check if we are allowed to startup the database at all
+#
+
+if test \! -w "$VIRTUOSO_HOME/$DBDIR"
+then
+    echo ""
+    echo "***"
+    echo "*** ERROR: You do not have permission to startup this virtuoso instance"
+    echo "***"
+
+    exit 1
+fi
+
+
+#
+#  Check if there is any lock file in this directory
+#
+cd "$VIRTUOSO_HOME/$DBDIR"
+LCK=virtuoso.lck
+for i in *.lck
+do
+    if test -f "$i"
+    then
+	LCK="$i"
+    fi
+done
+
+
+#
+#  If there is a lock file present, consider the database running
+#
+if test -f "$LCK"
+then
+    echo ""
+    echo "***"
+    echo "***  WARNING: Lock file already exists."
+    echo "***"
+    echo "***  This Virtuoso instance is probably already running."
+    echo "***"
+
+    exit 0
+fi
+
+DBFILE=`$INIFILE $INIFLAGS +section Database +key DatabaseFile`
+TRXFILE=`$INIFILE $INIFLAGS +section Database +key TransactionFile`
+
+if test -f "$DBFILE"
+then
+    echo ""
+    echo "***"
+    echo "***  WARNING: DataBase file already exists."
+    echo "***"
+    echo "***  This Virtuoso instance cannot be restored."
+    echo "***"
+
+    exit 0
+fi
+
+if test -f "$TRXFILE"
+then
+    echo ""
+    echo "***"
+    echo "***  WARNING: TransactionFile file already exists."
+    echo "***"
+    echo "***  This Virtuoso instance cannot be restored."
+    echo "***"
+
+    exit 0
+fi
+
+#
+#  Start the engine
+#
+./virtuoso +restore-backup "$BPREF" +backup-dirs backup
+if test $? -ne 0
+then
+    echo ""
+    echo "***"
+    echo "*** ERROR: Could not start this Virtuoso Instance."
+    echo "***"
+
+    LOG=`$INIFILE $INIFLAGS +section Database +key ErrorLogFile`
+    tail "$LOG"
+
+    echo "***"
+    echo "*** Please fix the above issue(s) before trying again."
+    echo "***"
+
+    exit 1
+fi
+
+
+#  All done
+exit 0
+
+]]></programlisting>
+<para>mk_cluster.sh</para>
+<programlisting><![CDATA[
+#!/bin/bash
+
+export NUM_NODES=${1-8}
+export NUM_DISKS=4
+
+SPACE=256
+echo diskspace per NODE = ${SPACE}M
+
+#
+#  Goto TOP
+#
+
+if test "x$VIRTUOSO_HOME" = "x"
+then
+    VIRTUOSO_HOME="`dirname $0`/.."
+    VIRTUOSO_HOME=`cd $VIRTUOSO_HOME >/dev/null && pwd`
+fi
+if test "x$VIRTUOSO_HOME" = "x"
+then
+    echo ""
+    echo "***"
+    echo "*** ERROR: Unable to determine value for \$VIRTUOSO_HOME"
+    echo "***"
+
+    exit 1
+fi
+
+cd $VIRTUOSO_HOME
+
+#cd /opt/virtuoso
+#mkdir -p /dbs1/lod_database
+#mkdir -p /dbs2/lod_database
+#mkdir -p /dbs3/lod_database
+#mkdir -p /dbs4/lod_database
+
+#
+#  Create various directories
+#
+i=1
+while true
+do
+    PORT=`expr 12200 + $i`
+    CLUSTER=`printf "cluster_%02d" $i`
+    HOST=`printf "Host%d" $i`
+    LOD=`printf "lod-%02d" $i`
+
+    echo "Creating $CLUSTER on Host $HOST port $PORT"
+
+    mkdir -p "$CLUSTER"
+    mkdir -p "$CLUSTER"/logs
+    mkdir -p "$CLUSTER"/backup
+
+    cat > "$CLUSTER"/virtuoso.ini <<-EOF_VIRTUOSO
+	;  virtuoso.ini
+	;
+	;  Configuration file for the OpenLink Virtuoso VDBMS Server
+	;
+	;
+	;  Database setup
+	;
+	[Database]
+	DatabaseFile       = virtuoso.db
+	TransactionFile    = virtuoso.trx
+	ErrorLogFile       = virtuoso.log
+	ErrorLogLevel      = 7
+	Syslog             = 0
+	TempStorage        = TempDatabase
+	FileExtend         = 200
+	MaxCheckpointRemap = 2500000
+	Striping           = 0
+
+	[TempDatabase]
+	DatabaseFile    = virtuoso.tdb
+	TransactionFile = virtuoso.ttr
+	FileExtend      = 200
+
+	;
+	;  Server parameters
+	;
+	[Parameters]
+	ServerPort                 = $PORT
+	ServerThreads              = 100
+	CheckpointInterval         = 600
+	NumberOfBuffers            = 20000
+	MaxDirtyBuffers            = 130000
+	DefaultIsolation           = 2
+	UnremapQuota               = 0
+	AtomicDive                 = 1
+	PrefixResultNames          = 0
+	CaseMode                   = 2
+	DisableMtWrite             = 0
+	;MinAutoCheckpointSize	= 4000000
+	;CheckpointAuditTrail	= 1
+	DirsAllowed                = /
+	PLDebug                    = 0
+	TestCoverage               = cov.xml
+	;Charset=ISO-8859-1
+	ResourcesCleanupInterval   = 1
+	ThreadCleanupInterval      = 1
+	TransactionAfterImageLimit = 1500000000
+	FDsPerFile                 = 4
+	MaxMemPoolSize             = 40000000
+	IndexTreeMaps              = 64
+
+	[VDB]
+	VDBDisconnectTimeout = 1000
+	ArrayOptimization    = 2
+	NumArrayParameters   = 10
+
+	[Client]
+	SQL_QUERY_TIMEOUT  = 0
+	SQL_TXN_TIMEOUT    = 0
+	SQL_ROWSET_SIZE    = 10
+	SQL_PREFETCH_BYTES = 12000
+
+	[AutoRepair]
+	BadParentLinks = 0
+	BadDTP         = 0
+
+	;[Striping]
+	;Segment1 = ${SPACE}M, /dbs1/lod_database/${LOD}-sl1.db = q1, /dbs2/lod_database/${LOD}-sl2.db = q2, /dbs3/lod_database/${LOD}-sl3.db = q3, /dbs4/lod_database/${LOD}-sl4.db = q4
+
+	[Replication]
+	ServerName   = $LOD
+	ServerEnable = 1
+
+	[!URIQA]
+	DefaultHost = localhost:8890
+EOF_VIRTUOSO
+
+if test $i -eq 1
+then
+    cat >> "$CLUSTER"/virtuoso.ini <<-EOF_VIRTUOSO_HTTP
+
+	[HTTPServer]
+	ServerPort                  = 8890
+	ServerRoot                  = $VIRTUOSO_HOME/vsp
+	ServerThreads               = 15
+	MaxKeepAlives               = 10
+	KeepAliveTimeout            = 10
+	MaxCachedProxyConnections   = 10
+	ProxyConnectionCacheTimeout = 10
+	DavRoot                     = DAV
+	HTTPLogFile                 = logs/http.log
+EOF_VIRTUOSO_HTTP
+fi
+    # Create cluster control
+    cat > "$CLUSTER"/cluster.ini <<-EOF_CLUSTER
+	[Cluster]
+	Threads = 50
+	ThisHost = $HOST
+	Master = Host1
+	ReqBatchSize = 10000
+	BatchesPerRPC = 4
+	BatchBufferBytes = 20000
+	LocalOnly = 2
+	MaxKeepAlivesMissed = 1000
+	MaxHosts = 100
+
+EOF_CLUSTER
+    let n=0
+    while true
+    do
+	let n+=1
+	CLPORT="`expr 22200 + $n`"
+	echo "Host$n = $CLPORT" >> "$CLUSTER"/cluster.ini
+	if test $n -ge $NUM_NODES
+	then
+	    break
+	fi
+    done
+
+    # Linking virtuoso executable in place
+    cd "$CLUSTER"
+    ln -sf "$VIRTUOSO_HOME"/bin/virtuoso-iodbc-t virtuoso
+    cd ..
+
+    let i+=1
+    if test $i -gt $NUM_NODES
+    then
+	break
+    fi
+done
+
+exit 0
+
+]]></programlisting>
+</listitem>
+</itemizedlist>
+</listitem>
+  <listitem>If you are using EC2 instance, make sure you set the environment by running:
+<programlisting><![CDATA[
+. ./virtuoso-environment.sh
+]]></programlisting>
+ </listitem>
+  <listitem>Run the mk_cluster.sh file from the .\install folder with option number of the desired nodes:
+<programlisting><![CDATA[
+..# bash
+..# . ./mk_cluster.sh  4
+....
+Creating cluster_01 on Host Host1 port 12201
+Creating cluster_02 on Host Host2 port 12202
+Creating cluster_03 on Host Host3 port 12203
+Creating cluster_04 on Host Host4 port 12204
+
+]]></programlisting>
+</listitem>
+</orderedlist>
+<sect3 id="clusterstcnfbackuprestore">
+<title>Backup and Restore</title>
+    <para><emphasis>Backup</emphasis></para>
+<para>There are 2 ways to backup Virtuoso Cluster DB:</para>
+<orderedlist>
+  <listitem>Backup every node using <link linkend="fn_backup_online"><function>back_online</function></link>
+    <para><emphasis>For example, for every cluster in its backup folder execute:</emphasis></para>
+<programlisting><![CDATA[
+backup_online ('dbp', 10000000, 0, 'backup');
+]]></programlisting>
+</listitem>
+  <listitem>Make backup of all nodes at once using
+<link linkend="clusteroperationadmclexec"><function>cl_exec</function></link>. For example, execute:
+<programlisting><![CDATA[
+cl_exec ('backup_online ('dbp', 10000000, 0, 'backup')', vector ('dbp', 0, 10000000, './backup'));
+]]></programlisting>
+</listitem>
+</orderedlist>
+    <para><emphasis>Restore from Backup</emphasis></para>
+<para>After backup is done for every node in its backup folder, in order to restore,
+execute from the ..\bin folder the virtuoso-restore.sh:</para>
+<programlisting><![CDATA[
+# . ./virtuoso-restore.sh all dbp
+]]></programlisting>
+<para>where the second parameter is the restore prefix.</para>
+</sect3>
+    </sect2>
+    <sect2 id="clusterstcnfconfig"><title>Cluster Config</title>
+<orderedlist>
+  <listitem>Set "FAST_START=1" in the viruoso-start.sh file and then run:
+<programlisting><![CDATA[
+viruoso-start.sh
+]]></programlisting>
+<para>or</para>
+ </listitem>
+  <listitem>Execute the following line:
+<programlisting><![CDATA[
+# /etc/init.d/virtuoso start
+Starting OpenLink Virtuoso:                                [  OK  ]
+]]></programlisting>
+</listitem>
+  <listitem>In order to check the nodes, connect to port 12201 using the ISQL tool:
+<programlisting><![CDATA[
+isql 12201
+]]></programlisting>
+</listitem>
+  <listitem>To check the cluster status, execute the following command:
+<programlisting><![CDATA[
+SQL> status('cluster');
+REPORT
+VARCHAR
+_______________________________________________________________________________
+
+Cluster 4 nodes, 293 s. 0 m/s 0 KB/s  0% cpu 0%  read 0% clw threads 1r 0w 0i buffers 1781 0 d 0 w 0 pfs
+
+1 Rows. -- 4 msec.
+]]></programlisting>
+</listitem>
+</orderedlist>
+    </sect2>
+   <tip><title>See Also:</title>
+        <para><link linkend="clusteroperation">Setting up and operating Virtuoso on a cluster.</link></para>
+        <para><link linkend="clusterprogramming">Virtuoso Cluster Programming</link></para>
+        <para><link linkend="fault">Virtuoso Cluster Fault Tolerance.</link></para>
+   </tip>
+</sect1>
+
 </chapter>
diff --git a/docsrc/xmlsource/migrate27to30.xml b/docsrc/xmlsource/migrate27to30.xml
index 8f561c1..0f3a75d 100644
--- a/docsrc/xmlsource/migrate27to30.xml
+++ b/docsrc/xmlsource/migrate27to30.xml
@@ -23,6 +23,7 @@
 -->
 <sect1 id="migrxx">
 	<title>Database Migration Guides</title>
+	
 <sect2 id="migrate27to30"><title>Migration of Virtuoso from Version 2.7 to Version 3.0</title>
 
   <para>The Virtuoso 3.0 database file format is not compatible with 
diff --git a/docsrc/xmlsource/oledbimplementation.xml b/docsrc/xmlsource/oledbimplementation.xml
index c63e02c..99242e6 100644
--- a/docsrc/xmlsource/oledbimplementation.xml
+++ b/docsrc/xmlsource/oledbimplementation.xml
@@ -74,7 +74,7 @@
 	    Windows 98, ME, NT4.0, 2000, or XP.
 	  </listitem>
 	  <listitem>
-	    Virtuoso Server version 2.7 or higher running on the same or remote computer.
+	    Virtuoso Server running on the same or remote computer.
 	  </listitem>
 	  <listitem>
 	    Redistributable files provided with Microsoft Data Access Components 
diff --git a/docsrc/xmlsource/overview.xml b/docsrc/xmlsource/overview.xml
index 2a1bc88..eb72e05 100644
--- a/docsrc/xmlsource/overview.xml
+++ b/docsrc/xmlsource/overview.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  -  
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
@@ -56,6 +56,7 @@
 		directly without any hint of replacement.
 		</para>
   </sect1>
+  
   <sect1 id="virtwhydoi">
     <title>Why Do I Need Virtuoso?</title>
     <para>You need Virtuoso because Knowledge is power or competitive advantage (depending on how
@@ -706,4 +707,1306 @@ Such models are not currently used by default, but they are achievable with our
 </para>
 	   </sect2>
 	</sect1>
+	
+	<sect1 id="virtuosotipsandtricks">
+          <title>Tips and Tricks</title>
+    <sect2 id="virtuosotipsandtricksspchar">
+          <title>How Can I execute SPARQL queries containing '$' character using ISQL?</title>                
+      <para>Assuming a SPARQL query should filter on the length of labels:</para>
+<programlisting><![CDATA[
+SELECT ?label
+FROM <http://mygraph.com>
+WHERE 
+  { 
+    ?s ?p ?label
+    FILTER(regex(str(?label), "^.{1,256}$") )
+  } 
+]]></programlisting>      
+      <para>ISQL uses '<emphasis>$</emphasis>' character as a prefix for macro names of its preprocessor. 
+      When '<emphasis>$</emphasis>' character is used in SPARQL query to be executed in ISQL, the character 
+      should be replaced with '<emphasis>$$</emphasis>' notation or an escape char + numeric code:</para>
+<programlisting><![CDATA[
+SQL> SPARQL 
+SELECT ?label
+FROM <http://mygraph.com>
+WHERE 
+  { 
+    ?s ?p ?label
+    FILTER(REGEX(str(?label), "^.{1,256}$$") )
+  } 	
+]]></programlisting>      
+      <para>Note also that the FILTER written in this way, finds <emphasis>?label-s</emphasis> with length 
+      less than 256.</para>
+      <para>To achieve fast results, <emphasis>REGEX</emphasis> should be replaced with the 
+      <emphasis>bif:length</emphasis> function:</para>      
+<programlisting><![CDATA[
+SQL> SPARQL 
+SELECT ?label
+FROM <http://mygraph.com>
+WHERE 
+  { 
+    ?s ?p ?label
+    FILTER (bif:length(str(?label))<= 256)
+  } 	
+]]></programlisting>      
+      <para>In this way the SPARQL query execution can work much faster if the interoperability is 
+      	not required and <emphasis>?label-s</emphasis> are numerous.</para>
+    </sect2>          
+    <sect2 id="virtuosotipsandtricksfinddeadlockstables">
+      <title>How can I find on which table deadlocks occur?</title>
+      <para>One possible way to find on which table deadlocks occur is to execute the following statement:</para>    
+<programlisting><![CDATA[
+SELECT TOP 10 * 
+FROM SYS_L_STAT 
+ORDER BY deadlocks DESC	
+]]></programlisting>      
+    </sect2>       
+    <sect2 id="virtuosotipsandtricksoutotmemoryerror">
+      <title>How Can I configure parameters to avoid out of memory error?</title>
+      <para>In order to avoid out of memory error, you should make sure the values for the paramaters 
+      	<emphasis>NumberOfBuffers</emphasis> and <emphasis>MaxCheckpointRemap</emphasis> are not set with the same values.</para>    
+      <para>For example, the following configuration will cause an error out of memory:</para>	
+<programlisting><![CDATA[
+# virtuoso.ini
+
+...
+[Parameters]
+NumberOfBuffers = 246837
+MaxDirtyBuffers = 18517
+MaxCheckpointRemap = 246837
+...
+]]></programlisting>      
+       <para>Changing the value of the parameter <emphasis>MaxCheckpointRemap</emphasis> with let's 
+       say 1/4 of the DB size will resolve the issue.</para>
+    </sect2>                  
+    <sect2 id="virtuosotipsandtricksrdftriggersoptions">
+      <title>What are "Generate RDB2RDF triggers" and "Enable Data Syncs with Physical Quad Store" RDF Views options?</title>
+      <para>These RDF Views options basically persist the triples in the transient View Graph in the Native Quad Store. The Data Sync is how you keep the transient views in sync with the persisted triples.</para>	      
+      <para>Without this capability you cannot exploit faceted browsing without severe performance overhead when using Linked Data based conceptual views over ODBC or JDBC accessible data sources.</para>	
+      <para>Note: Using these options when the RFViews have already been created is not currently possible via the Conductor UI. Instead you should be able to add them manually from isql:</para>	            
+<orderedlist>
+  <listitem>Drop the RDF View graph and Quad Map.</listitem>
+  <listitem>Create it again with the RDB2RDF Triggers options enabled.</listitem>
+</orderedlist>  
+     <tip><title>See Also:</title>
+       <para><link linkend="rdb2rdftriggers">RDB2RDF Triggers</link></para>
+     </tip>    
+    </sect2>  
+    <sect2 id="virtuosotipsandtricksmanagedaterangequery">
+      <title>How to Manage Date Range SPARQL queries?</title>
+      <para>The following examples demonstrate how to manage date range in a SPARQL query:</para>	
+      <para><emphasis>Example with date range</emphasis></para> 
+<programlisting><![CDATA[
+SELECT ?s ?date 
+FROM <http://dbpedia.org> 
+WHERE 
+  { 
+    ?s ?p ?date . FILTER ( ?date >= "19450101"^^xsd:date && ?date <= "19451231"^^xsd:date )  
+  } 
+LIMIT 100
+]]></programlisting>      
+      <para><emphasis>Example with bif:contains</emphasis></para> 
+      <para>Suppose there is the following query using bif:contains for date:</para>
+      <para>If ?date is of type xsd:date or xsd:dateTime and of valid syntax then 
+      	bif:contains(?date, '"1945*"' ) will not found it, because it will be parsed at load/create and 
+      	stored as SQL DATE value.
+      </para>	
+      <para>So if data are all accurate and typed properly then the filter is:</para>
+<programlisting><![CDATA[
+(?date >= xsd:date("1945-01-01") && ?date < xsd:date("1946-01-01"))	
+]]></programlisting>      
+      <para>i.e. the query should be:</para>
+<programlisting><![CDATA[
+SELECT DISTINCT ?s ?date
+FROM <http://dbpedia.org>
+WHERE
+  {
+    ?s ?p ?date . FILTER( ?date >= xsd:date("1945-01-01") && ?date < xsd:date("1946-01-01")  && (str(?p) != str(rdfs:label)) )
+  }
+LIMIT 10	
+]]></programlisting>      
+      <para>If data falls, then the free-text will be OK for tiny examples but not for "big" cases because 
+      	<emphasis>bif:contains(?date, '"1945*"')</emphasis> would require that less than 200 words in the 
+      	table begins with 1945. Still, some data can be of accurate type and syntax so range comparison 
+      	should be used for them and results aggregated via UNION.</para>
+      <para>If dates mention timezones then the application can chose the beginning and the end of the 
+      	year in some timezones other than the default.</para>	
+    </sect2>  
+    <sect2 id="virtuosotipsandtricksquadstorageinternally">
+      <title>How can I see which quad storages exist and in which quad storage a graph resides?</title>
+      <para>Let's take for example a <ulink url="http://virtuoso.openlinksw.com/whitepapers/relational%20rdf%20views%20mapping.html">created RDF view from relational data in Virtuoso</ulink>. The RDF output therefor should have two graphs which reside in a quad storage named for ex.:
+      </para>	
+<programlisting><![CDATA[
+http://localhost:8890/rdfv_demo/quad_storage/default	
+]]></programlisting>      
+      <para>Also the RDF is accessible over the SPARQL endpoint with the following query:
+      </para>	
+<programlisting><![CDATA[
+define input:storage <http://localhost:8890/rdfv_demo/quad_storage/default>
+SELECT * 
+WHERE 
+  { 
+    ?s ?p ?o 
+  }	
+]]></programlisting>      
+      <para>Now one could ask is there a way to define internally (once) that the quad storage should be 
+      	included in queries to the SPARQL endpoint? So that the user does not have to define the 
+      	<emphasis>input:storage</emphasis> explicitly in each query, like this:</para>	
+<programlisting><![CDATA[
+http://localhost:8890/sparql?query=select * where { ?s ?p ?o }&default-graph-uri=NULL&named-graph-uri=NULL	
+]]></programlisting>      
+      <para>All metadata about all RDF storages are kept in "system" graph 
+      	<http://www.openlinksw.com/schemas/virtrdf#> ( namespace prefix <emphasis>virtrdf:</emphasis> ). 
+      	Subjects of type <emphasis>virtrdf:QuadStorage</emphasis> are RDF storages. There are three of them by default:
+      </para>	
+<programlisting><![CDATA[
+SQL> SPARQL SELECT * FROM virtrdf: WHERE { ?s a virtrdf:QuadStorage };
+s
+VARCHAR
+_______________________________________________________________________________
+
+http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage
+http://www.openlinksw.com/schemas/virtrdf#DefaultServiceStorage
+http://www.openlinksw.com/schemas/virtrdf#SyncToQuads
+
+3 Rows. -- 3 msec.	
+]]></programlisting>
+      <itemizedlist mark="bullet">
+        <listitem><emphasis>virtrdf:DefaultQuadStorage</emphasis> is what's in use if no input:storage specified.</listitem>
+        <listitem><emphasis>virtrdf:DefaultServiceStorage</emphasis> will be used for SPARQL federation.</listitem>
+        <listitem><emphasis>virtrdf:SyncToQuads</emphasis> is to keep the list of RDF Views that are translated into RDB2RDF triggers.</listitem>        
+      </itemizedlist>      
+      <para>There are two ways of using the RDF View from above in SPARQL endpoint without 
+      	<emphasis>define input:storage</emphasis>:</para>	
+      <orderedlist>
+        <listitem>Create RDF View right in <emphasis>virtrdf:DefaultQuadStorage</emphasis> or add the 
+        view in other storage and then copy it from there to <emphasis>virtrdf:DefaultQuadStorage</emphasis>.
+          <itemizedlist mark="bullet">
+            <listitem>In any of these two variants, use: 
+<programlisting><![CDATA[
+SPARQL ALTER QUAD STORAGE virtrdf:DefaultQuadStorage . . .	
+]]></programlisting>                  	
+            </listitem>
+          </itemizedlist>        	
+        </listitem>
+        <listitem>Use <emphasis>SYS_SPARQL_HOST</emphasis> table as described 
+        <link linkend="rdfdefaultgraph">here</link> and set <emphasis>SH_DEFINES</emphasis> so it 
+        contains your favorite <emphasis>define input:storage</emphasis>.</listitem>
+      </orderedlist>      	
+    </sect2>      
+    <sect2 id="virtuosotipsandtricksdroprecrdefstrg">
+      <title>Can I drop and re-create the DefaultQuadStorage?</title>                    
+      <para>Currently system metadata consist of three "levels":</para>
+      <orderedlist>
+        <listitem><emphasis>QuadMapFormats</emphasis> are used to describe transformations of individual 
+        SQL values (or types of SQL values),</listitem>
+        <listitem><emphasis>QuadMaps</emphasis> refers to <emphasis>QuadMapFormats</emphasis> (via 
+        <emphasis>QuadMapValues</emphasis>) and describe some "minimal" independent RDB2RDF 
+        transformations,</listitem>
+        <listitem><emphasis>QuadStorages</emphasis> organizes <emphasis>QuadMaps</emphasis>.</listitem>
+      </orderedlist>      
+      <para><emphasis>QuadStorages</emphasis> contains only "symlinks" to maps, if you drop a storage 
+      you don't drop all mappings inside. If you drop the <emphasis>DefaultQuadStorage</emphasis> or 
+      some other built-in thing, it can be safely recovered by 
+      <link linkend="fn_rdf_audit_metadata"><function>DB.DBA.RDF_AUDIT_METADATA</function></link>, 
+      with first parameter set to 1. This will keep your own data intact. However we recommend to write 
+      a script that declares all your formats, RDF Views and storages, to be able to reproduce the 
+      configuration after any failures.</para>
+    </sect2>    
+    <sect2 id="virtuosotipsandtricksgraphsecurity">
+      <title>How to display only some information from RDF graph?</title>                    
+      <para>Virtuoso supports graph-level security, as described <link linkend="rdfgraphsecurity">here</link> 
+      but not subject-level or predicate-level. When exposing data that needs protected access, triples 
+      should be confined to private  name graphs which are protected by ACLs using WebID.</para>
+      <para>Note, how you can use <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtAuthPolicyFOAFSSL">WebID to protect Virtuoso SPARQL endpoints</ulink>.</para>  
+      <tip><title>See Also:</title>
+        <para><link linkend="rdfgraphsecurity">RDF Graphs Security</link></para>
+      </tip>
+    </sect2>   
+    <sect2 id="virtuosotipsandtrickssparqlcondport">
+      <title>Is it possible to have the SPARQL endpoint on a different port than the Conductor?</title>                    
+      <para>Virtuoso Web Server has the capability to create extra listeners using the <link linkend="admui.internetdomains">Conductor interface</link>.</para>
+      <orderedlist>
+        <listitem>At install time you have your HTTP Server port in your virtuoso.ini set to 8890, which 
+        	you want to keep in your local network as this contains ALL the endpoints that you have 
+        	registered in Virtuoso. So as long as you do not open this port in your firewall, you can 
+        	only get at it from the local machine.</listitem>
+        <listitem>Next you should create a new vhost entry using the EXTERNAL name of your machine and 
+        	use port 80 (or a higher port if you do not want to run as root) for ex.:
+<programlisting><![CDATA[
+Interface: 0.0.0.0
+Port: 8080
+Http Host:  my.example.com	
+]]></programlisting>        	
+        </listitem>
+        <listitem>Next you add a "New directory to this line", click on "Type" radio button and choose 
+        	"Sparql access point" from the drop-down list and press Next button. Set "Path" to /sparql 
+        	and press the "Save Changes" button to store.</listitem>
+        <listitem>At this point you have created: http://my.example.com:8080/sparql which functions 
+        	exactly the same as your internal http://localhost:8890/sparql. You can now open your firewall 
+        	and allow outside machines to connect to port 8080 so people can use your SPARQL endpoint 
+        	without access to any other endpoint on your Virtuoso installation.</listitem>
+        <listitem>You should probably also change your virtuoso.ini so:
+<programlisting><![CDATA[
+[URIQA]
+DefaultHost = my.example.com:8080	
+]]></programlisting>        	
+        </listitem>
+        <listitem>If you use port 80, you do not have to add :80 at the end of this setting, although 
+        	it should not make any difference.</listitem>
+        <listitem>You can now add other directories / endpoints to the new <emphasis>my.example.com</emphasis> 
+          interface you just created e.g. a nice / directory that points to a index.html which describes 
+          your site etc.</listitem>
+      </orderedlist>
+      <tip><title>See Also:</title>
+        <para><link linkend="admui.internetdomains">Internet Domains</link></para>
+      </tip>
+    </sect2>  
+    <sect2 id="virtuosotipsandtricksenableadonetvs2010">
+      <title>How to enable the Virtuoso Entity Framework 3.5 ADO.Net Provider in Visual Studio 2010?</title>                    
+      <para>The Virtuoso Entity Framework 3.5 ADO.Net Provider is current only list as a Visible control 
+      	in the Visual Studio 2008 IDE as the current installers only create the necessary registry 
+      	entries for Visual Studio 2008. To make it visible in the Visual Studio 2010's IDE the 
+      	following registry settings need to be manually updated and manual addtions to some of 
+      	the VS 2010 XML configuration files:</para>
+      <orderedlist>
+        <listitem>Export following registry keys to .reg files and using a text editor, such as Wordpad, edit the Visual Studio version numbers from 8.0 or 9.0 to 10.0:
+<programlisting><![CDATA[
+HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\DataProviders\{EE00F82B-C5A4-4073-8FF1-33F815C9801D}
+- and -
+HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\DataSources\{90FBCAF2-8F42-47CD-BF1A-88FF41173060}
+]]></programlisting>        	
+        </listitem>
+        <listitem>Once edited, save and double click them to create the new registry entries under:
+<programlisting><![CDATA[
+HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0....	
+]]></programlisting>        	
+        </listitem>
+        <listitem>In addition, locate the file C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config, 
+        locate the node, then locate the <emphasis><add name="VirtuosoClient3? Data Provider" ...</emphasis> 
+        node within it: 
+<programlisting><![CDATA[
+<add name="VirtuosoClient3 Data Provider" invariant="OpenLink.Data.Virtuoso"
+    description=".NET Framework Data Provider for Virtuoso" type="OpenLink.Data.Virtuoso.VirtuosoClientFactory, virtado3, Version=6.2.3128.2, Culture=neutral, PublicKeyToken=391bf132017ae989" />	
+]]></programlisting>        	
+        </listitem>
+      </orderedlist>
+      <para>and copy is to the equivalent C:\WINDOWS\Microsoft.NET\Frameworks\v4.0.30128\CONFIG\machine.config location.</para>
+      <para>Visual Studio 2010 will then have the necessary information to locate and load the Virtuoso ADO.Net provider in its IDE.</para>
+      <para>The registry should typically contain the following entries for Visual Studio 2010 as a result:</para>
+<programlisting><![CDATA[
+Windows Registry Editor Version 5.00
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}]
+@=".NET Framework Data Provider for Virtuoso"
+"AssociatedSource"="{4D90D7C5-69A6-43EE-83ED-59A0E442D260}"
+"CodeBase"="C:\\Windows\\assembly\\GAC_MSIL\\virtado3\\6.2.3128.1__391bf132017ae989\\virtado3.dll"
+"Description"="Provider_Description, OpenLink.Data.Virtuoso.DDEX.Net3.DDEXResources, virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"
+"DisplayName"="Provider_DisplayName, OpenLink.Data.Virtuoso.DDEX.Net3.DDEXResources, virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"
+"InvariantName"="OpenLink.Data.Virtuoso"
+"PlatformVersion"="2.0"
+"ShortDisplayName"="Provider_ShortDisplayName, OpenLink.Data.Virtuoso.DDEX.Net3.DDEXResources, virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"
+"Technology"="{77AB9A9D-78B9-4ba7-91AC-873F5338F1D2}"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects]
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IDSRefBuilder]
+@="Microsoft.VisualStudio.Data.Framework.DSRefBuilder"
+"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataAsyncCommand]
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataCommand]
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataConnectionProperties]
+@="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoDataConnectionProperties"
+"Assembly"="virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataConnectionSupport]
+@="Microsoft.VisualStudio.Data.Framework.AdoDotNet.AdoDotNetConnectionSupport"
+"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataConnectionUIControl]
+@="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoDataConnectionUIControl"
+"Assembly"="virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataConnectionUIProperties]
+@="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoDataConnectionProperties"
+"Assembly"="virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataMappedObjectConverter]
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataObjectIdentifierResolver]
+@="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoDataObjectIdentifierResolver"
+"Assembly"="virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataObjectSupport]
+@="Microsoft.VisualStudio.Data.Framework.DataObjectSupport"
+"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
+"XmlResource"="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoObjectSupport"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataSourceInformation]
+@="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoDataSourceInformation"
+"Assembly"="virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataTransaction]
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}\SupportedObjects\IVsDataViewSupport]
+@="Microsoft.VisualStudio.Data.Framework.DataViewSupport"
+"Assembly"="Microsoft.VisualStudio.Data.Framework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
+"XmlResource"="OpenLink.Data.Virtuoso.DDEX.Net3.VirtuosoViewSupport"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataSources\{4D90D7C5-69A6-43EE-83ED-59A0E442D260}]
+@="OpenLink Virtuoso Data Source"
+"DefaultProvider"="{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataSources\{4D90D7C5-69A6-43EE-83ED-59A0E442D260}\SupportingProviders]
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\DataSources\{4D90D7C5-69A6-43EE-83ED-59A0E442D260}\SupportingProviders\{0886A2BB-03D0-4E00-8A3D-F235A5DC0F6D}]
+"Description"="DataSource_Description, OpenLink.Data.Virtuoso.DDEX.Net3.DDEXResources, virtado3, Version=6.2.3128.1, Culture=neutral, PublicKeyToken=391bf132017ae989" 	
+]]></programlisting>      
+      <para>The next Virtuoso releases, 6.3+ will support this new Visual Studio 2010 release out of the box.</para>                  
+    </sect2> 
+    <sect2 id="virtuosotipsandtrickscontrolunicode3">
+      <title>How Can I Control the normalization of UNICODE3 accented chars in free-text index?</title>                    
+<para>
+The normalization of UNICODE3 accented chars in free-text index can be controlled by setting up the 
+configuration parameter <emphasis>XAnyNormalization</emphasis> in the
+virtuoso.ini config file, section [I18N]. This parameter controls whether accented
+UNICODE characters should be converted to their non-accented base
+variants at the very beginning of free-text indexing or parsing a
+free-text query string. The parameter's value is an integer that is bitmask with
+only 2 bits in use atm:
+</para>
+<orderedlist>
+  <listitem>0: the default behavior, do not normalize anything, so "Jose" and
+"José" are two distinct words.
+</listitem>
+  <listitem>2: Any combined char is converted to its (smallest known) base. So
+"é" will lose its accent and become plain old ASCII "e".</listitem>
+  <listitem>3: This is equl to 1|2 and when set then performs both conversions. 
+As a result, pair of base char and combinig char loses its second char and chars with accents will lose
+accents.</listitem>
+</orderedlist>
+     <para>If the parameter is required at all, the needed value is probably 3. So
+the fragment of virtuoso.ini is:</para>
+<programlisting><![CDATA[
+[I18N]
+XAnyNormalization=3
+]]></programlisting>
+     <para>In some seldom case the value of 1 can be appropriate. The parameter
+should be set once before creating the database. If changed on the
+existing database, all free-text indexes that may contain non-ASCII data
+should be re-created. On a typical system, the parameter affects all
+text columns, XML columns, RDF literals and queries.</para>
+<para>Strictly speaking, it affects not all of them but only items that use
+default "x-any" language or language derived from x-any such as "en" and
+"en-US" but if you haven't tried writing new C plugins for custom
+languages you should not look so deep.</para>
+     <para>As an example, with <emphasis>XAnyNormalization=3</emphasis> once can get the following:</para>
+<programlisting><![CDATA[
+SQL>SPARQL 
+
+INSERT IN <http://InternationalNSMs/>
+   { <s> <sp> "Índio João Macapá Júnior Tôrres Luís Araújo José" ; 
+     <ru> "Он добавил картошки, посолил и поставил аквариум на огонь" . }
+
+INSERT INTO <http://InternationalNSMs/>, 2 (or less) triples -- done
+
+
+SQL> DB.DBA.RDF_OBJ_FT_RULE_ADD (null, null, 'InternationalNSMs.wb');
+
+Done. -- 0 msec.
+
+SQL>vt_inc_index_db_dba_rdf_obj();
+
+Done. -- 26 msec.
+
+SQL>SPARQL 
+SELECT * 
+FROM <http://InternationalNSMs/> 
+WHERE 
+  {
+    ?s ?p ?o 
+  }
+ORDER BY ASC (str(?o))
+
+s  sp  Índio João Macapá Júnior Tôrres Luís Araújo José
+s  ru  Он добавил картошки, посолил и поставил аквариум на огонь
+
+2 Rows. -- 2 msec.
+
+SQL> SPARQL 
+SELECT * 
+FROM <http://InternationalNSMs/> 
+WHERE 
+  { 
+    ?s ?p ?o . ?o bif:contains "'Índio João Macapá Júnior Tôrres Luís Araújo José'" . 
+  }
+
+s  sp  Índio João Macapá Júnior Tôrres Luís Araújo José
+
+1 Rows. -- 2 msec.
+
+SQL>SPARQL 
+SELECT * 
+FROM <http://InternationalNSMs/> 
+WHERE
+  { 
+    ?s ?p ?o . ?o bif:contains "'Indio Joao Macapa Junior Torres Luis Araujo Jose'" . }
+
+s  sp  Índio João Macapá Júnior Tôrres Luís Araújo José
+
+1 Rows. -- 1 msec.
+
+SQL> SPARQL 
+SELECT * 
+FROM <http://InternationalNSMs/> 
+WHERE 
+  { 
+    ?s ?p ?o . ?o bif:contains "'поставил аквариум на огонь'" . }
+
+s  ru  Он добавил картошки, посолил и поставил аквариум на огонь
+
+]]></programlisting>
+     <para>There was also request for function that normalizes characters in
+strings as free-text engine will do with XAnyNormalization=3 , the function will be provided as a separate patch and depends on this
+specific patch.
+    </para>
+    <tip><title>See Also:</title>
+       <para><link linkend="VIRTINI">Virtuoso Configuration File</link></para>
+    </tip>
+    </sect2>               
+    <sect2 id="virtuosotipsandtricksdefinegraphwithspongeroption">
+      <title>How Can I define graph with virt:rdf_sponger option set to "on"?</title>                    
+      <para>Suppose we have the following scenario:</para>
+      <orderedlist>
+        <listitem>Create Virtuoso user using Conductor.</listitem>
+        <listitem>Create for the user a RDF Sink folder.</listitem>        
+        <listitem>In the properties of the RDF sink folder add the following 
+          <emphasis>virt:rdf_graph</emphasis> option: 
+<programlisting><![CDATA[
+http://localhost:8080/DAV/home/dba/rdf_sink/	
+]]></programlisting>
+        </listitem>
+        <listitem>Set <emphasis>virt:rdf_sponger</emphasis> to "on".</listitem>
+        <listitem>Upload RDF files to the RDF Sink folder.</listitem>        
+        <listitem>As result the RDF data should be stored in graph 
+        	for ex. (depending on your folder name etc.): 
+<programlisting><![CDATA[
+http://local.virt/DAV/home/wa_sink/rdf_sink/wa_address_agents.rdf	
+]]></programlisting>
+        </listitem>
+        <listitem>In order to define any graph you want with the option from above, you should execute:
+<programlisting><![CDATA[
+SQL>DAV_PROP_SET (davLocation,  'virt:rdf_graph', iri, _uid, _pwd);	
+]]></programlisting>
+          <itemizedlist mark="bullet">
+            <listitem>Calling this function uses the given IRI as the graph IRI when sponging stuff 
+            	put in the rdf_sink/ collection davLocation.</listitem>
+          </itemizedlist>            
+        </listitem>
+        <listitem>Finally you should execute the following command to get the RDF data from the new graph:
+<programlisting><![CDATA[
+SQL>SELECT DAV_PPROP_GET ('/DAV/home/dba/rdf_sink/', 'virt:rdf_graph','dba', 'dba');	
+]]></programlisting>
+        </listitem>
+        </orderedlist>
+    </sect2>                     
+    <sect2 id="virtuosotipsandtricksconvprstr">
+      <title>How do I use SPARUL to change a selection of property values from URI References to Literals?</title>                    
+      <para>Assume a given graph where triples are comprised of property values that are mixed across URI References and Typed Literals as exemplified by the results of the query below:</para>
+<programlisting><![CDATA[
+SELECT DISTINCT ?sa ?oa 
+FROM <http://ucb.com/nbeabase>
+WHERE 
+  { 
+    ?sa a <http://ucb.com/nbeabase/resource/Batch> .
+    ?sa <http://ucb.com/nbeabase/resource/chemAbsNo> ?oa . FILTER regex(?oa, '-','i')
+  }
+
+]]></programlisting>
+      <para>You can use the following SPARUL pattern to harmonize the property values across relevant triples in a specific graph, as shown below:</para>
+<programlisting><![CDATA[
+SQL> SPARQL 
+INSERT INTO GRAPH <http://ucb.com/nbeabase> 
+  { 
+    ?sa <http://ucb.com/nbeabase/resource/sampleId> `str (?oa)` 
+  }  
+WHERE 
+  { 
+    ?sa <http://ucb.com/nbeabase/resource/chemAbsNo> ?oa . FILTER regex(?oa, '-','i')   
+  }	
+]]></programlisting>      
+    </sect2>   
+    <sect2 id="virtuosotipsandtricksbulkloadcl">
+      <title>How is a Checkpoint performed against a Virtuoso Clustered Server?</title>                    
+      <para>The cluster <link linkend="clusteroperationadmclexec"><function>cl_exec()</function></link> function is 
+      used to perform a checkpoint across all node of a Virtuoso cluster as follows:</para>
+<programlisting><![CDATA[
+SQL>cl_exec ('checkpoint'); 	
+]]></programlisting>      
+      <para>This typically needs to be run after loading RDF datasets into a Virtuoso cluster to prevent lose of data when the cluster is restarted.</para>
+
+    </sect2>   
+    <sect2 id="virtuosotipsandtrickconstrprst">
+      <title>How can I use CONSTRUCT with PreparedStatements?</title>                           
+      <para>Assume a given query which uses pragma <emphasis>output:format '_JAVA_'</emphasis> with CONSTRUCT:</para>
+<programlisting><![CDATA[
+SPARQL DEFINE output:format '_JAVA_'
+   CONSTRUCT { ?s ?p ?o }
+WHERE
+  { 
+    ?s ?p ?o . 
+    FILTER (?s = iri(?::0)) 
+  }
+LIMIT 1
+]]></programlisting>      
+      <para>In order to work correctly, the query should be modified to:</para>
+<programlisting><![CDATA[
+SPARQL DEFINE output:format '_JAVA_'
+   CONSTRUCT { `iri(?::0)` ?p ?o }
+WHERE
+  { 
+    `iri(?::0)` ?p ?o 
+  }
+LIMIT 1	
+]]></programlisting>      
+      <para>Equivalent variant of the query is also:</para>
+<programlisting><![CDATA[
+SPARQL DEFINE output:format '_JAVA_'
+  CONSTRUCT { ?s ?p ?o }
+WHERE
+  { 
+    ?s ?p ?o . 
+    FILTER (?s = iri(?::0)) 
+  }
+LIMIT 1	
+]]></programlisting>      
+    </sect2>       
+    <sect2 id="virtuosotipsandtrickssparulupdatestrl">
+      <title>How can perform SPARQL Updates without transactional log size getting exceed?</title>             
+      <para>Since SPARUL updates are generally not meant to be transactional, it is best to run these in:</para>
+<programlisting><![CDATA[
+SQL> log_enable (2);	
+]]></programlisting>      
+      <para>mode, which commits every operation as it is done. This prevents one from running out of 
+      	rollback space. Also for bulk updates, transaction logging can be turned off. If so, one 
+      	should do a manual checkpoint after the operation to ensure persistence across server restart 
+      	since there is no roll forward log.</para>
+      <para>Alternatively, the "<emphasis>TransactionAfterImageLimit</emphasis>" parameter can be set 
+      in the virtuoso.ini config file to a higher value than its 50MB default:</para>
+<programlisting><![CDATA[
+#virtuoso.ini
+...
+[Parameters]
+...
+TransactionAfterImageLimit = N bytes default 50000000
+...	
+]]></programlisting>      
+    <tip><title>See Also:</title>
+       <para><link linkend="rdfperfsparul">Using SPARUL</link></para>
+       <para><link linkend="ini_Parameters">Virtuoso INI Parameters</link></para>       
+    </tip>
+    </sect2>         
+    <sect2 id="virtuosotipsandtrickscrawlercustompl">
+      <title>How can I write custom crawler using PL?</title>
+      <para>The following code is an example of loading data via crawler with special function to generate link for downloading:</para>
+<programlisting><![CDATA[
+create procedure EUROPEANA_STORE ( 
+  in _host varchar, 
+  in _url varchar, 
+  in _root varchar, 
+  inout _content varchar, 
+  in _s_etag varchar, 
+  in _c_type varchar, 
+  in store_flag int := 1, 
+  in udata any := null, 
+  in lev int := 0)
+{
+   declare url varchar;
+   declare xt, xp any;
+   declare old_mode int;
+   xt := xtree_doc (_content, 2);
+   xp := xpath_eval ('//table//tr/td/a[@href]/text()', xt, 0);
+   commit work;
+   old_mode := log_enable (3,1);
+   foreach (any u in xp) do
+     {
+       u := cast (u as varchar);
+       url := sprintf ('http://semanticweb.cs.vu.nl/europeana/api/export_graph?graph=%U&mimetype=default&format=turtle', u);
+       dbg_printf ('%s', u);
+	 {
+	   declare continue handler for sqlstate '*' { 
+	     dbg_printf ('ERROR: %s', __SQL_MESSAGE);
+	   };
+	   SPARQL LOAD ?:url into GRAPH ?:u;
+	 }
+     }
+   log_enable (old_mode, 1);
+   return WS.WS.LOCAL_STORE (_host, _url, _root, _content, _s_etag, _c_type, store_flag, 0);
+}	
+]]></programlisting>      
+    <tip><title>See Also:</title>
+       <para><link linkend="contentcrawlerrdf">Set Up the Content Crawler to Gather RDF</link></para>
+    </tip>
+    </sect2>  
+    <sect2 id="virtuosotipsandtrickscrawlercustomde">
+      <title>How Can I Get an exact mapping for a date?</title> 
+      <para>Assume a given attempts to get an exact mapping for the literal "1950" using 
+      	<emphasis>bif:contains</emphasis>:</para>
+<programlisting><![CDATA[
+SPARQL
+SELECT DISTINCT ?s ?o 
+FROM <http://dbpedia.org> 
+WHERE 
+  {
+    ?s ?p ?o . 
+   FILTER( bif:contains (?o, '"1950"') 
+           && isLiteral(?o) 
+           && ( str(?p) ! = rdfs:label  || str(?p) !=  foaf:name 
+           && ( ?o='1950')
+         )
+  }	
+]]></programlisting>      
+      <para>As an integer 1950 or date 1950-01-01 are not texts, they are not in free-text index 
+      	and thus invisible for CONTAINS free-text predicate.</para>
+      <para>A possible way to make them visible that way is to introduce an additional RDF predicate 
+      	that will contain objects of the triples in question, converted to strings via str() function.</para>
+      <para>Thus better results will be approached: if searches about dates are frequent then a new 
+      	predicate can have date/datetime values extracted from texts, eliminating the need for bif:contains.</para>
+      <para>Therefor, the query from above should be changed to:</para>
+<programlisting><![CDATA[
+SPARQL
+SELECT DISTINCT ?s ?o 
+FROM <http://dbpedia.org> 
+WHERE 
+  {
+    ?s ?p ?o . 
+    FILTER (  isLiteral(?o) 
+              && (  str(?p) != str(rdfs:label) || str(?p) !=  foaf:name ) 
+              && str(?o) in ("1950", "1950-01-01"))
+  }
+]]></programlisting>                                       
+    </sect2>        	            	
+    <sect2 id="virtuosotipsandtricksgetcertattr">
+      <title>How Can I Get certificate attributes using SPARQL?</title>     
+      <para>The SPARQL query should use the <emphasis>cert:hex</emphasis> and 
+      <emphasis>cert:decimal</emphasis> in order to get to the values, so for ex:</para>
+<programlisting><![CDATA[
+PREFIX cert: <http://www.w3.org/ns/auth/cert#> 
+PREFIX rsa: <http://www.w3.org/ns/auth/rsa#> 
+
+SELECT ?webid 
+FROM <http://webid.myxwiki.org/xwiki/bin/view/XWiki/homepw4>
+WHERE 
+  {
+    [] cert:identity ?webid ;
+             rsa:modulus ?m ;
+     rsa:public_exponent ?e .
+     ?m cert:hex "b520f38479f5803a7ab33233155eeef8ad4e1f575b603f7780f3f60ceab1\n34618fbe117539109c015c5f959b497e67c1a3b2c96e5f098bb0bf2a6597\n779d26f55fe8d320de7af0562fd2cd067dbc9d775b22fc06e63422717d00\na6801dedafd7b54a93c3f4e59538475673972e524f4ec2a3667d0e1ac856\nd532e32bf30cef8c1adc41718920568fbe9f793daeeaeeaa7e8367b7228a\n895a6cf94545a6f6286693277a1bc7750425ce6c35d570e89453117b88ce\n24206afd216a705ad08b7c59\n"^^xsd:string .
+     ?e cert:decimal "65537"^^xsd:string
+  }	
+]]></programlisting>      
+    </sect2>  
+    <sect2 id="virtuosotipsandtricksmultithreadjdbc">
+      <title>How can I make Multi Thread Virtuoso connection using JDBC??</title>     
+      <para>See details <link linkend="JDBCDriverhibernatesetupandtestingexmp4">here</link>.</para> 
+    </sect2>            
+    <sect2 id="virtuosotipsandtricksgetcertattr">
+      <title>How Do I Perform Bulk Loading of RDF Source Files into one or more Graph IRIs?</title>     
+      <para>See details <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtBulkRDFLoader">here</ulink>.</para>       
+    </sect2>      
+    <sect2 id="virtuosotipsandtricksrdfschowlinfrl">
+      <title>How to exploit RDF Schema and OWL Inference Rules with minimal effort?</title>     
+      <para>When you install Virtuoso, it's reasoner and highly scalable inference capabilities may not 
+      	be obvious. Typical cases involve using <emphasis>rdfs:subClassOf</emphasis> predicates in queries 
+      	and wondering why reasoning hasn't occurred in line with the semantics defined in RDF Schema.</para>
+      <para>The experience applies when using more sophisticated predicates from OWL such as 
+      	<emphasis>owl:equivalentProperty</emphasis>, <emphasis>owl:equivalentClass</emphasis>, 
+      	<emphasis>owl:sameAs</emphasis>, <emphasis>owl:SymmetricalProperty</emphasis>, 
+      	<emphasis>owl:inverseOf</emphasis> etc ...</para>
+      <para>Virtuoso implemented inference rules processing in a loosely coupled manner that allow 
+      	users to conditionally apply inference context (via rules) to SPARQL queries. Typically, you 
+      	have to create these rules following steps outlined <link linkend="rdfsparqlrule">here</link>.</para>
+      <para>This tips and tricks note provides a shortcut for setting up and exploring RDF Schema and 
+      	OWL reasoning once you've installed the <ulink url="http://s3.amazonaws.com/opldownload/uda/vad-packages/6.1/virtuoso/fct_dav.vad">Virtuoso Faceted Browser VAD package</ulink>.</para>
+      <tip><title>See Also:</title>
+       <para><link linkend="rdfsparqlrule">Inference Rules and Reasoning</link></para>
+       <para><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtFacetBrowserInstallConfig">Virtuoso Faceted Browser Installation and configuration</ulink></para>
+       <para><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtuosoFacetsWebService">Virtuoso Facets Web Service</ulink></para>       
+     </tip>          
+    </sect2>   
+    <sect2 id="virtuosotipsandtricksdumparbqntr">
+      <title>How can I dump arbitrary query result as N-Triples?</title>     
+      <para>Assume the following arbitrary query:</para>
+<programlisting><![CDATA[
+SPARQL define output:format "NT" 
+CONSTRUCT { ?s a ?t } 
+FROM virtrdf:
+WHERE { ?s a ?t };	
+]]></programlisting>      
+      <para>For iteration over result-set of an arbitrary query, use 
+      	<link linkend="fn_exec_next"><function>exec_next()</function></link> in a loop that begins with 
+      	<link linkend="fn_exec"><function>exec()</function></link> with cursor output variable as 
+      	an argument and ends with <link linkend="fn_exec_close"><function>exec_close()</function></link> 
+      	after it is out of data.</para>
+    </sect2>               	            	      
+   <sect2 id="virtuosotipsandtrickbindnmgrprst">         	            	      
+     <title>How do I bind named graph parameter in prepared statement?</title>        	
+     <para>Assume the following SPARQL query:</para>
+<programlisting><![CDATA[
+CONSTRUCT 
+  { 
+    ?s ?p ?o
+  } 
+FROM ?context 
+WHERE 
+  { 
+    ?s ?p ?o 
+  }	
+]]></programlisting>     
+     <para>To bind the named graph context of the query from above, the best solution due 
+     	to performance implications, is to change the syntax of the query as:</para>
+<programlisting><![CDATA[
+CONSTRUCT 
+  { 
+    ?s ?p ?o
+  } 
+WHERE 
+  { 
+    graph `iri(??)` { ?s ?p ?o } 
+  }	
+]]></programlisting>     
+     <para>Note: In case of using "FROM clause", it needs a constant in order to check at the 
+     	compile time whether the IRI refers to a graph or a graph group:</para>
+     <itemizedlist mark="bullet">
+       <listitem>Assume "FROM clause" is used as for ex:
+<programlisting><![CDATA[
+CONSTRUCT 
+  { 
+    ?s ?p ?o
+  } 
+FROM `iri(??)` 
+WHERE
+  { 
+    ?s ?p ?o
+  }	
+]]></programlisting>  
+         <itemizedlist mark="bullet">
+           <listitem>In this case can be made security checks at 
+           	the compile time (i.e., once) and not waste time at the run time.</listitem>
+         </itemizedlist>      	
+       </listitem>
+       <listitem>Assume "FROM clause" is used as for ex:
+<programlisting><![CDATA[
+CONSTRUCT 
+  { 
+    ?s ?p ?o
+  }
+FROM iri(??) 
+WHERE 
+  { 
+    ?s ?p ?o 
+  }	
+]]></programlisting>        	
+         <itemizedlist mark="bullet">
+           <listitem>In this case a compile-time check, a run-time check or 50/50 mix of them can 
+           	be performed, depending on the security policies.</listitem>
+         </itemizedlist>      	
+       </listitem>
+       <listitem>FROM without constant would mean that security rules, if they present in the storage, 
+       	are used at the run time, for every triple that matches every triple pattern in the default graph. 
+       	This issue can be reproduced if FROM is not specified at all: if security differs from default 
+       	then the effect is noticeably bad.</listitem>
+     </itemizedlist>
+   </sect2>          	
+    <sect2 id="virtuosotipsandtricksadonetinsb">
+      <title>How can I insert binary data to Virtuoso RDF storage in plain queries and with parameter binding via ADO.NET calls?</title>     
+      <para>The following example shows different methods for insert binary data to Virtuoso RDF storage in plain queries and with parameter binding via ADO.NET calls:</para>
+<programlisting><![CDATA[
+# Test_Bin.cs
+
+
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Data;
+using OpenLink.Data.Virtuoso;
+
+#if ODBC_CLIENT
+namespace OpenLink.Data.VirtuosoOdbcClient
+#elif CLIENT
+namespace OpenLink.Data.VirtuosoClient
+#else
+namespace OpenLink.Data.VirtuosoTest
+#endif
+{
+    class Test_Bin
+    {
+        [STAThread]
+        static void Main(string[] args)
+        {
+            IDataReader myread = null;
+            IDbConnection c;
+
+            c = new VirtuosoConnection("HOST=localhost:1111;UID=dba;PWD=dba;");
+
+            IDbCommand cmd = c.CreateCommand();
+            int ros;
+
+            try
+            {
+                c.Open();
+
+                cmd.CommandText = "sparql clear graph <ado.bin>";
+                cmd.ExecuteNonQuery();
+
+//insert binary as base64Binary
+                cmd.CommandText = "sparql insert into graph <ado.bin> { <res1> <attr> \"GpM7\"^^<http://www.w3.org/2001/XMLSchema#base64Binary> }";
+                cmd.ExecuteNonQuery();
+
+//insert binary as hexBinary
+                cmd.CommandText = "sparql insert into graph <ado.bin> { <res2> <attr> \"0FB7\"^^<http://www.w3.org/2001/XMLSchema#hexBinary> }";
+                cmd.ExecuteNonQuery();
+
+
+//prepare for insert with parameter binding
+                cmd.CommandText = "sparql define output:format '_JAVA_' insert into graph <ado.bin> { `iri($?)` <attr> `bif:__rdf_long_from_batch_params($?,$?,$?)` }";
+
+//bind parameters for insert binary as base64Binary
+                IDbDataParameter param = cmd.CreateParameter();
+                param.ParameterName = "p1";
+                param.DbType = DbType.AnsiString;
+                param.Value = "res3";
+                cmd.Parameters.Add(param);
+
+                param = cmd.CreateParameter();
+                param.ParameterName = "p2";
+                param.DbType = DbType.Int32;
+                param.Value = 4;
+                cmd.Parameters.Add(param);
+
+                param = cmd.CreateParameter();
+                param.ParameterName = "p3";
+                param.DbType = DbType.AnsiString;
+                param.Value = "GpM7";
+                cmd.Parameters.Add(param);
+
+                param = cmd.CreateParameter();
+                param.ParameterName = "p4";
+                param.DbType = DbType.AnsiString;
+                param.Value = "http://www.w3.org/2001/XMLSchema#base64Binary";
+                cmd.Parameters.Add(param);
+
+                cmd.ExecuteNonQuery();
+
+                cmd.Parameters.Clear();
+
+//bind parameters for insert binary as hexBinary
+                param = cmd.CreateParameter();
+                param.ParameterName = "p1";
+                param.DbType = DbType.AnsiString;
+                param.Value = "res4";
+                cmd.Parameters.Add(param);
+
+                param = cmd.CreateParameter();
+                param.ParameterName = "p2";
+                param.DbType = DbType.Int32;
+                param.Value = 4;
+                cmd.Parameters.Add(param);
+
+                param = cmd.CreateParameter();
+                param.ParameterName = "p3";
+                param.DbType = DbType.AnsiString;
+                param.Value = "0FB7";
+                cmd.Parameters.Add(param);
+
+                param = cmd.CreateParameter();
+                param.ParameterName = "p4";
+                param.DbType = DbType.AnsiString;
+                param.Value = "http://www.w3.org/2001/XMLSchema#hexBinary";
+                cmd.Parameters.Add(param);
+
+                cmd.ExecuteNonQuery();
+
+                cmd.Parameters.Clear();
+
+//bind parameters for insert binary as byte[]
+                param = cmd.CreateParameter();
+                param.ParameterName = "p1";
+                param.DbType = DbType.AnsiString;
+                param.Value = "res5";
+                cmd.Parameters.Add(param);
+
+                param = cmd.CreateParameter();
+                param.ParameterName = "p2";
+                param.DbType = DbType.Int32;
+                param.Value = 3;
+                cmd.Parameters.Add(param);
+
+                param = cmd.CreateParameter();
+                param.ParameterName = "p3";
+                param.DbType = DbType.Binary;
+                byte[] bin_val = {0x01, 0x02, 0x03, 0x04, 0x05};
+                param.Value = bin_val;
+                cmd.Parameters.Add(param);
+
+                param = cmd.CreateParameter();
+                param.ParameterName = "p4";
+                param.DbType = DbType.AnsiString;
+                param.Value = System.DBNull.Value; 
+                cmd.Parameters.Add(param);
+
+                cmd.ExecuteNonQuery();
+
+                cmd.Parameters.Clear();
+
+//execute select and check the results
+                cmd.CommandText = "sparql SELECT ?s ?o FROM <ado.bin> WHERE {?s ?p ?o}"; ;
+                myread = cmd.ExecuteReader();
+                int r = 0;
+
+                while (myread.Read())
+                {
+                    Console.WriteLine("=== ROW === "+r);
+                    for (int i = 0; i < myread.FieldCount; i++)
+                    {
+                        string s;
+                        if (myread.IsDBNull(i))
+                            Console.Write("N/A|\n");
+                        else
+                        {
+                            object o = myread.GetValue(i);
+                            Type t = myread.GetFieldType(i);
+
+                            s = myread.GetString(i);
+                            Console.Write(s + "[");
+                            if (o is SqlExtendedString)
+                            {
+                                SqlExtendedString se = (SqlExtendedString)o;
+                                Console.Write("IriType=" + se.IriType + ";StrType=" + se.StrType + ";Value=" + se.ToString());
+                                Console.Write(";ObjectType=" + o.GetType() + "]|\n");
+                            }
+                            else if (o is SqlRdfBox)
+                            {
+                                SqlRdfBox se = (SqlRdfBox)o;
+                                Console.Write("Lang=" + se.StrLang + ";Type=" + se.StrType + ";Value=" + se.Value);
+                                Console.Write(";ObjectType=" + o.GetType() + "]|\n");
+                                object v = se.Value;
+                                if (v is System.Byte[])
+                                {
+                                    byte[] vb = (byte[])v;
+                                    for (int z = 0; z < vb.Length; z++)
+                                    {
+                                        Console.WriteLine(""+z+"="+vb[z]);
+                                    }
+                                }
+                            }
+                            else
+                                Console.Write(o.GetType() + "]|\n");
+                        }
+                    }
+                    r++;
+                }
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine("{0} Exception caught.", e);
+            }
+            finally
+            {
+                //		  if (myread != null)
+                //		    myread.Close();
+
+                if (c.State == ConnectionState.Open)
+                    c.Close();
+
+            }
+
+        }
+    }
+}
+]]></programlisting>      
+      <para>Output log for example is in the log.txt:</para>
+<programlisting><![CDATA[
+# log.txt
+=== ROW === 0
+res1[IriType=IRI;StrType=IRI;Value=res1;ObjectType=OpenLink.Data.Virtuoso.SqlExtendedString]|
+GpM7[Lang=;Type=http://www.w3.org/2001/XMLSchema#base64Binary;Value=GpM7;ObjectType=OpenLink.Data.Virtuoso.SqlRdfBox]|
+=== ROW === 1
+res2[IriType=IRI;StrType=IRI;Value=res2;ObjectType=OpenLink.Data.Virtuoso.SqlExtendedString]|
+0FB7[Lang=;Type=http://www.w3.org/2001/XMLSchema#hexBinary;Value=0FB7;ObjectType=OpenLink.Data.Virtuoso.SqlRdfBox]|
+=== ROW === 2
+res3[IriType=IRI;StrType=IRI;Value=res3;ObjectType=OpenLink.Data.Virtuoso.SqlExtendedString]|
+GpM7[Lang=;Type=http://www.w3.org/2001/XMLSchema#base64Binary;Value=GpM7;ObjectType=OpenLink.Data.Virtuoso.SqlRdfBox]|
+=== ROW === 3
+res4[IriType=IRI;StrType=IRI;Value=res4;ObjectType=OpenLink.Data.Virtuoso.SqlExtendedString]|
+0FB7[Lang=;Type=http://www.w3.org/2001/XMLSchema#hexBinary;Value=0FB7;ObjectType=OpenLink.Data.Virtuoso.SqlRdfBox]|
+=== ROW === 4
+res5[IriType=IRI;StrType=IRI;Value=res5;ObjectType=OpenLink.Data.Virtuoso.SqlExtendedString]|
+0102030405[System.Byte[]]|	
+]]></programlisting>      
+    </sect2>     
+    <sect2 id="instrdfvs">
+      <title>How can I insert RDF data from Visual Studio to Virtuoso?</title>     
+      <para>The following example shows how to insert RDF Data from Visual Studio to Virtuoso:</para>
+<programlisting><![CDATA[    
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Data;
+using OpenLink.Data.Virtuoso;
+
+#if ODBC_CLIENT
+namespace OpenLink.Data.VirtuosoOdbcClient
+#elif CLIENT
+namespace OpenLink.Data.VirtuosoClient
+#else
+namespace OpenLink.Data.VirtuosoTest
+#endif
+{
+    class Test_Insert
+    {
+        [STAThread]
+        static void Main(string[] args)
+        {
+            IDataReader myread = null;
+            IDbConnection c;
+
+            c = new VirtuosoConnection("HOST=localhost:1111;UID=dba;PWD=dba;Charset=UTF-8");
+
+            IDbCommand cmd = c.CreateCommand();
+            int ros;
+
+            try
+            {
+                c.Open();
+
+                cmd.CommandText = "sparql clear graph <ado.net>";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P01> \"131\"^^<http://www.w3.org/2001/XMLSchema#short> }";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P02> \"1234\"^^<http://www.w3.org/2001/XMLSchema#integer> }";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P03> \"12345.12\"^^<http://www.w3.org/2001/XMLSchema#float> }";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P04> \"123456.12\"^^<http://www.w3.org/2001/XMLSchema#double> }";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P05> \"123456.12\"^^<http://www.w3.org/2001/XMLSchema#decimal> }";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P06> \"01020304\"^^<http://www.w3.org/2001/XMLSchema#hexBinary> }";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P07> \"01.20.1980T04:51:13\"^^<http://www.w3.org/2001/XMLSchema#dateTime> }";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P08> \"01.20.1980\"^^<http://www.w3.org/2001/XMLSchema#date> }";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P09> \"01:20:19\"^^<http://www.w3.org/2001/XMLSchema#time> }";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "sparql insert into graph <ado.net> { <a> <P10> \"test\" }";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "sparql define output:format '_JAVA_' insert into graph <ado.net> { <b> `iri($?)` `bif:__rdf_long_from_batch_params($?,$?,$?)` }";
+
+//add Object URI
+                add_triple(cmd, "S01", 1, "test1", null);
+
+//add Object BNode
+                add_triple(cmd, "S02", 1, "_:test2", null);
+
+
+//add Literal
+                add_triple(cmd, "S03", 3, "test3", null);
+
+//add Literal with Datatype
+                add_triple(cmd, "S04", 4, "1234", "http://www.w3.org/2001/XMLSchema#integer");
+
+//add Literal with Lang
+                add_triple(cmd, "S05", 5, "test5", "en");
+
+
+                add_triple(cmd, "S06", 3, (short)123, null);
+                add_triple(cmd, "S07", 3, 1234, null);
+                add_triple(cmd, "S08", 3, (float)12345.12, null);
+                add_triple(cmd, "S09", 3, 123456.12, null);
+                add_triple(cmd, "S10", 3, new DateTime(2001, 02, 23, 13, 44, 51, 234), null);
+                add_triple(cmd, "S11", 3, new DateTime(2001, 02, 24), null);
+                add_triple(cmd, "S12", 3, new TimeSpan(19, 41, 23), null);
+ 
+
+                add_triple(cmd, "S13", 4, "GpM7", "http://www.w3.org/2001/XMLSchema#base64Binary");
+                add_triple(cmd, "S14", 4, "0FB7", "http://www.w3.org/2001/XMLSchema#hexBinary");
+                byte[] bin_val = { 0x01, 0x02, 0x03, 0x04, 0x05 };
+                add_triple(cmd, "S15", 3, bin_val, null);
+
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine("{0} Exception caught.", e);
+            }
+            finally
+            {
+
+                if (c.State == ConnectionState.Open)
+                    c.Close();
+
+            }
+
+        }
+
+
+        static void add_triple(IDbCommand cmd, string sub, int ptype, object val, string val_add)
+        {
+                cmd.Parameters.Clear();
+
+                IDbDataParameter param = cmd.CreateParameter();
+                param.ParameterName = "p1";
+                param.DbType = DbType.AnsiString;
+                param.Value = sub;
+                cmd.Parameters.Add(param);
+
+                param = cmd.CreateParameter();
+                param.ParameterName = "p2";
+                param.DbType = DbType.Int32;
+                param.Value = ptype;
+                cmd.Parameters.Add(param);
+
+                param = cmd.CreateParameter();
+                param.ParameterName = "p3";
+                if (val != null && val.GetType() == typeof (System.String))
+                    param.DbType = DbType.AnsiString;
+                param.Value = val;
+                cmd.Parameters.Add(param);
+
+                param = cmd.CreateParameter();
+                param.ParameterName = "p4";
+                param.DbType = DbType.AnsiString;
+                param.Value = val_add;
+                cmd.Parameters.Add(param);
+
+                cmd.ExecuteNonQuery();
+        }
+
+
+
+    }
+}	
+]]></programlisting>      
+     <tip><title>See Also:</title>
+       <para><link linkend="rdfinsertmethods">RDF Insert Methods in Virtuoso</link></para>
+     </tip> 
+    </sect2>     	
+    <sect2 id="descrmd">
+      <title>How does default describe mode work?</title>     
+      <para>The default describe mode works only if subject has a type/class. To get any anonymous subject described CBD mode should be used:</para>
+<programlisting><![CDATA[ 
+$ curl -i -L -H "Accept: application/rdf+xml" http://lod.openlinksw.com/describe/?url=http%3A%2F%2Fwww.mpii.de%2Fyago%2Fresource%2FEddie%255FMurphy
+HTTP/1.1 303 See Other
+Date: Mon, 21 Mar 2011 14:24:36 GMT
+Server: Virtuoso/06.02.3129 (Linux) x86_64-generic-linux-glibc25-64  VDB
+Content-Type: text/html; charset=UTF-8
+Accept-Ranges: bytes
+TCN: choice
+Vary: negotiate,accept,Accept-Encoding
+Location: http://lod.openlinksw.com/sparql?query=%20DESCRIBE%20%3Chttp%3A%2F%2Fwww.mpii.de%2Fyago%2Fresource%2FEddie%255FMurphy%3E&format=application%
+2Frdf%2Bxml
+Content-Length: 0
+
+HTTP/1.1 200 OK
+Date: Mon, 21 Mar 2011 14:24:37 GMT
+Server: Virtuoso/06.02.3129 (Linux) x86_64-generic-linux-glibc25-64  VDB
+Accept-Ranges: bytes
+Content-Type: application/rdf+xml; charset=UTF-8
+Content-Length: 467967
+
+<?xml version="1.0" encoding="utf-8" ?>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
+<rdf:Description rdf:about="http://www.mpii.de/yago/resource/MTV%5FMovie%5FAward%5Ffor%5FBest%5FComedic%5FPerformance"><n0pred:hasInternalWikipediaLinkTo xmlns:n0pred="http://www.mpii.de/yago/resource/" rdf:resource="http://www.mpii.de/yago/resource/Eddie%5FMurphy"/></rdf:Description>
+<rdf:Description rdf:about="http://www.mpii.de/yago/resource/#fact_23536547421"><rdf:subject rdf:resource="http://www.mpii.de/yago/resource/Eddie%5FMurphy"/></rdf:Description>
+<rdf:Description rdf:about="http://www.mpii.de/yago/resource/#fact_23536896725"><rdf:object rdf:resource="http://www.mpii.de/yago/resource/Eddie%5FMurphy"/></rdf:Description>
+...
+]]></programlisting>            
+    </sect2>    
+    <sect2 id="notresphttp">
+      <title>What should I do if the Virtuoso Server is not responding to HTTP requests?</title>     
+      <para>Assume the Virtuoso server is not responding to HTTP requests although SQL connection is working. In order to determine what activity is being performed that might account for this:</para>
+<orderedlist>
+  <listitem>Check the status: 
+<programlisting><![CDATA[ 
+SQL> status('');
+REPORT
+VARCHAR
+_______________________________________________________________________________
+
+
+OpenLink Virtuoso VDB Server
+Version 06.02.3129-pthreads for Linux as of Mar 16 2011 
+Registered to Uriburner (Personal Edition, unlimited connections)
+Started on: 2011/03/17 10:49 GMT+60
+ 
+Database Status:
+  File size 0, 37598208 pages, 7313125 free.
+  1000000 buffers, 993399 used, 76771 dirty 0 wired down, repl age 25548714 0 w. io 0 w/crsr.
+  Disk Usage: 2642884 reads avg 4 msec, 30% r 0% w last  1389 s, 1557572 writes,
+    15331 read ahead, batch = 79.  Autocompact 308508 in 219226 out, 28% saved.
+Gate:  71130 2nd in reads, 0 gate write waits, 0 in while read 0 busy scrap. 
+Log = virtuoso.trx, 14922248 bytes
+VDB: 0 exec 0 fetch 0 transact 0 error
+1757362 pages have been changed since last backup (in checkpoint state)
+Current backup timestamp: 0x0000-0x00-0x00
+Last backup date: unknown
+Clients: 5 connects, max 2 concurrent
+RPC: 116 calls, -1 pending, 1 max until now, 0 queued, 2 burst reads (1%), 0 second brk=9521074176
+Checkpoint Remap 331113 pages, 0 mapped back. 1180 s atomic time.
+    DB master 37598208 total 7313125 free 331113 remap 40593 mapped back
+   temp  569856 total 569851 free
+ 
+Lock Status: 52 deadlocks of which 0 2r1w, 86078 waits,
+   Currently 1 threads running 0 threads waiting 0 threads in vdb.
+Pending:
+
+
+25 Rows. -- 1274 msec.
+SQL> 
+	
+]]></programlisting>   	
+  </listitem>
+  <listitem>Connect with the PL debugger and see what is running currently using the info threads call: 
+<programlisting><![CDATA[ 
+$ isql 1111 dba <password> -D
+DEBUG> info threads	
+]]></programlisting>   	
+  </listitem>
+  <listitem>This should return the current code being executed by the Sever.</listitem>
+  <listitem>Run <link linkend="fn_txn_killall"><function>txn_killall()</function></link> to kill any pending transactions which may enable the server to start responding to HTTP requests again: 
+<programlisting><![CDATA[ 
+
+SQL> txn_killall();
+
+Done. -- 866 msec.	
+]]></programlisting>   	
+  </listitem>
+</orderedlist>
+    </sect2> 
+    <sect2 id="replallgr">
+      <title>How can I replicate all graphs?</title>     
+      <para>To replicate all graphs ( except the system graph http://www.openlinksw.com/schemas/virtrdf# ), 
+      	one should use http://www.openlinksw.com/schemas/virtrdf#rdf_repl_all as graph IRI:</para>
+<programlisting><![CDATA[ 
+SQL> DB.DBA.RDF_RDF_REPL_GRAPH_INS ('http://www.openlinksw.com/schemas/virtrdf#rdf_repl_all');
+]]></programlisting>   	
+    </sect2>        	
+  </sect1>    
 </chapter>
+
+
diff --git a/docsrc/xmlsource/php.xml b/docsrc/xmlsource/php.xml
index fa16798..fc5011e 100644
--- a/docsrc/xmlsource/php.xml
+++ b/docsrc/xmlsource/php.xml
@@ -26,7 +26,7 @@
 <title>Deploying PHP Applications</title>
 
 <para>The PHP server extension allows Virtuoso to execute PHP (v4) pages
-stored in the file system or in Virtuoso’s WebDAV repository.   PHP pages run inside the Virtuoso process.</para>
+stored in the file system or in Virtuoso's WebDAV repository.   PHP pages run inside the Virtuoso process.</para>
 
 <figure id="http_handler_php" float="1"><title>The HTTP PHP handler</title>
   <graphic fileref="http_handler_php.jpg" format="jpeg"></graphic></figure>
diff --git a/docsrc/xmlsource/ptune.xml b/docsrc/xmlsource/ptune.xml
index 0900ee4..504797b 100644
--- a/docsrc/xmlsource/ptune.xml
+++ b/docsrc/xmlsource/ptune.xml
@@ -521,7 +521,8 @@ will contain more than 1 row of a given key. No page contains rows from more tha
 blobs (when not inlined on the row) will be placed in consecutive DB pages (up
 to their size). In addition to the blob and key pages the Virtuoso DB will hold a number of
 pages containing internal data. So the sum of the pages occupied by the key rows and the blobs is
-leas then the amount of occupied pages (as reported by the <link linkend="fn_status"><function>status()</function></link> BIF).</para>
+less then the amount of occupied pages (as reported by the 
+<link linkend="fn_status"><function>status()</function></link> BIF).</para>
 
 <para>To provide detailed information about the space consumption of each key there's
 a system view:</para>
@@ -617,8 +618,9 @@ traversed 1 time per select, but still on large database files that may take som
     updates, deletes several million rows in a single transaction.
     If this is really needed and concurrency is no issue, use the
     atomic mode, effectively making the server single user for the
-    transaction, thus having no locking or rollback. See
-	<link linkend="fn___atomic"><function>__atomic()</function></link>.
+    transaction, thus having no locking or rollback. See the use of 
+    the <emphasis>__atomic()</emphasis> function in the 
+    <link linkend="faultfaulttoleradmapi">Cluster Administration API</link>.
 	  </listitem>
     </itemizedlist>
 
@@ -758,8 +760,7 @@ select s_quantity from stock where s_i_id = 111 for update;
   <sect4 id="ptunedotnetiso"><title>.Net</title>
 
     <para>In the VirtuosoClient.NET provider the isolation is set by the
-	  <ulink url="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdataidbconnectionclassbegintransactiontopic2.asp">System.Data.IDbConnection.BeginTransaction
-    Method (IsolationLevel)</ulink> function.</para>
+	  <ulink url="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdataidbconnectionclassbegintransactiontopic2.asp">System.Data.IDbConnection.BeginTransaction Method (IsolationLevel)</ulink> function.</para>
 	
 <programlisting>
   System.Data.IDBTransaction trx = conn.BeginTransaction (System.Data.IsolationLevel.ReadCommitted)
diff --git a/docsrc/xmlsource/rdfandsparql.xml b/docsrc/xmlsource/rdfandsparql.xml
index e7c525f..63b7e52 100644
--- a/docsrc/xmlsource/rdfandsparql.xml
+++ b/docsrc/xmlsource/rdfandsparql.xml
@@ -698,7 +698,7 @@ At present this uses additional query parameters.</para>
 </itemizedlist>
 </sect3>
 
-<sect3 id="rdfsupportedprotocolendpointuri"><title>Service Endpoint</title>
+<sect3 id="rdfsupportedprotocolendpoint"><title>Service Endpoint</title>
 <para>Virtuoso uses the pre-assigned endpoints "/sparql" and "/SPARQL" as the
 defaults for exposing its REST based SPARQL Web Services.</para>
 <para>The port number associated with the SPARQL services is determined by the 'ServerPort' key value
@@ -1148,6 +1148,21 @@ public query service, this may also be handy when exploring a large data set wit
 set result_timeout == <expression>;
 ]]></programlisting>
    <para>Find more detailed information in the <link linkend="anytimequeries">Anytime Queries</link> section.</para>
+   <sect5 id="anytimequeriessparqlex"><title>Example Dump arbitrary query result as N-Triples</title>
+   <para>Assume the following arbitrary query:</para>
+<programlisting><![CDATA[
+SPARQL define output:format "NT" 
+CONSTRUCT { ?s a ?t } 
+FROM virtrdf:
+WHERE { ?s a ?t };	
+]]></programlisting>   
+      <para>For iteration over result-set of an arbitrary query, use 
+      	<link linkend="fn_exec_next"><function>exec_next()</function></link> in a loop that begins with 
+      	<link linkend="fn_exec"><function>exec()</function></link> with cursor output variable as 
+      	an argument and ends with <link linkend="fn_exec_close"><function>exec_close()</function></link> 
+      	after it is out of data.
+      </para>
+   </sect5>
    </sect4>
 </sect3>
 
@@ -1245,7 +1260,7 @@ Virtuoso 5.0.11 onwards added three new methods for securing SPARQL endpoints th
 <itemizedlist mark="bullet">
   <listitem>SQL authentication</listitem>
   <listitem>OAuth</listitem>
-  <listitem>FOAF+SSL protocol based authentication</listitem>
+  <listitem>WebID Protocol based authentication</listitem>
 </itemizedlist>
 <para> 
 Each of these authentication methods is associated with a purpose specific default SPARQL endpoint along the following lines:
@@ -1253,7 +1268,7 @@ Each of these authentication methods is associated with a purpose specific defau
 <itemizedlist mark="bullet">
   <listitem>http://<cname>/sparql-auth (SQL authentication)</listitem>
   <listitem>http://<cname>/sparql-oauth (OAuth)</listitem>
-  <listitem>https://<cname>/sparql and https://<cname>/sparql-ssl (FOAF+SSL)</listitem>
+  <listitem>https://<cname>/sparql and https://<cname>/sparql-ssl (WebID Protocol)</listitem>
 </itemizedlist>
 <para>The Virtuoso Authentication Server offers a UI with options for managing:</para>
 <itemizedlist mark="bullet">
@@ -1263,7 +1278,7 @@ level mechanism for your SPARQL endpoint. It enables you to interact securely wi
 from a variety of locations. It also allows you to provide controlled access to private data to selected
 user profiles.
   </listitem>
-  <listitem>FOAF+SSL ACLs: FOAF+SSL is an implementation of a conceptual authentication and authorization
+  <listitem>WebID Protocol ACLs: WebID Protocol is an implementation of a conceptual authentication and authorization
 protocol that links a Web ID to a public key to create a global, decentralized/distributed, and open
 yet secure authentication system that functions with existing browsers.</listitem>
 </itemizedlist>
@@ -1273,7 +1288,7 @@ policy_manager_dav.vad package.</para>
 <para>The menu options are:</para>
 <itemizedlist mark="bullet">
   <listitem><emphasis>Go to Application Keys</emphasis> - in order to create Consumer Key and Secret for the relevant ODS applications.</listitem>
-  <listitem><emphasis>Go to FOAF+SSL ACLs</emphasis> - in order to use URIs for setup DB level controls for SELECT, UPDATE and DELETE.
+  <listitem><emphasis>Go to WebID Protocol ACLs</emphasis> - in order to use URIs for setup DB level controls for SELECT, UPDATE and DELETE.
 (This option requires you be logged in as user dba.)
 </listitem>
   <listitem><emphasis>Go to Protected SPARQL Endpoint</emphasis> - in order to enter your Application Consumer Key and perform secure SPARQL queries.</listitem>
@@ -1398,21 +1413,21 @@ cf92411e17f59960a4189451bfb5bf6b92c856e3
 </listitem>
 </orderedlist>
 </sect4>
-<sect4 id="sparqloauthendpointfoafssl"><title>FOAF+SSL ACLs</title>
-<para>FOAF+SSL is an implementation of a conceptual authentication and authorization protocol that
+<sect4 id="sparqloauthendpointfoafssl"><title>WebID Protocol ACLs</title>
+<para>WebID Protocol is an implementation of a conceptual authentication and authorization protocol that
 links a Web ID to a public key, to create a global decentralized/distributed, and open yet secure
 authentication system that functions with existing browsers.</para>
-<para>To use FOAF+SSL, download and install the policy_manager_dav.vad VAD package. Once installed, to access the FOAF+SSL ACLs UI, use the URL http://cname:port/policy_manager,
-then click the link FOAF+SSL ACLs.</para>
+<para>To use WebID Protocol, download and install the policy_manager_dav.vad VAD package. Once installed, to access the WebID Protocol ACLs UI, use the URL http://cname:port/policy_manager,
+then click the link WebID Protocol ACLs.</para>
   <figure id="sparqloauthendpoint1" float="1">
     <title>FOAFSSL</title>
     <graphic fileref="ui/SparqlOAuth4.png"/>
   </figure>
 <para>Note: You must log in as user dba</para>
 <para>
-Configuring FOAF+SSL ACLs is with a FOAF+SSL certificate and a Web ID allows secure SPARQL queries to be performed against a Virtuoso SPARQL-SSL endpoint and viewing of the query results.
+Configuring WebID Protocol ACLs is with a WebID Protocol certificate and a Web ID allows secure SPARQL queries to be performed against a Virtuoso SPARQL-SSL endpoint and viewing of the query results.
 The SPARQL-SSL endpoint URL is of the form https://cname:port/sparql-ssl</para>
-<para>The steps required to configure a sample  FOAF+SSL ACL are outlined below:</para>
+<para>The steps required to configure a sample  WebID Protocol ACL are outlined below:</para>
 <orderedlist>
 <listitem>Install the ods_framework_dav.vad, conductor_dav.vad and policy_manager_dav.vad packages.</listitem>
 <listitem>Using the ODS UI, register an ODS user, e.g. user <emphasis>demo</emphasis>.</listitem>
@@ -1429,7 +1444,7 @@ The SPARQL-SSL endpoint URL is of the form https://cname:port/sparql-ssl</para>
       <graphic fileref="ui/SparqlFOAFSSL1.png"/>
     </figure>
 </listitem>
-<listitem>The FOAF+SSL ACLs management form will be displayed.
+<listitem>The WebID Protocol ACLs management form will be displayed.
 <figure id="sparqloauthendpoint6" float="1">
       <title>FOAFSSL UI</title>
       <graphic fileref="ui/SparqlFOAFSSL2.png"/>
@@ -1447,7 +1462,7 @@ A Web ID will be generated automatically for the selected user.</para></listitem
       <graphic fileref="ui/SparqlFOAFSSL3.png"/>
     </figure>
 </listitem>
-<listitem>Click the "Register" button to create a new FOAF+SSL ACL.
+<listitem>Click the "Register" button to create a new WebID Protocol ACL.
 <figure id="sparqloauthendpoint7" float="1">
       <title>FOAFSSL UI</title>
       <graphic fileref="ui/SparqlFOAFSSL4.png"/>
@@ -1468,7 +1483,7 @@ A Web ID will be generated automatically for the selected user.</para></listitem
 </listitem>
 </orderedlist>
   <tip><title>See Also:</title>
-    <para><link linkend="secureodbcx509foafsll">FOAF+SSL ODBC Login</link></para>
+    <para><link linkend="secureodbcx509foafsll">WebID Protocol ODBC Login</link></para>
   </tip>
 </sect4>
 <sect4 id="sparqloauthendpointfoafsslsparql"><title>Creating and Using a SPARQL-SSL based Endpoint</title>
@@ -1693,9 +1708,62 @@ _:_ res:solution [
 </orderedlist>
 
 <tip><title>See Also:</title>
-<para><ulink url="http://demo.openlinksw.com/tutorial/rdf/fs_s_1/fs_s_1.vsp">Demo Example</ulink> Using HTTP client to perform FOAF+SSL connection.</para>
+<para><ulink url="http://demo.openlinksw.com/tutorial/rdf/fs_s_1/fs_s_1.vsp">Demo Example</ulink> Using HTTP client to perform WebID Protocol connection.</para>
 </tip>
 </sect4>
+<sect4 id="sparqloauthendpointfoafsslsparqldisable"><title>Disable Default SPARQL Endpoint</title>
+  <sect5 id="sparqloauthendpointfoafsslsparqldisableisql"><title>Using iSQL:</title>
+    <itemizedlist mark="bullet">
+      <listitem>To disable /sparql, execute:
+<programlisting><![CDATA[
+DB.DBA.VHOST_REMOVE (lpath=>'/sparql');	
+]]></programlisting>      	
+      </listitem>
+      <listitem>To add the endpoint again via PL, execute:
+<programlisting><![CDATA[
+DB.DBA.VHOST_DEFINE (lpath=>'/sparql/', ppath => '/!sparql/', is_dav => 1, vsp_user => 'dba', opts => vector('noinherit', 1)); 	
+]]></programlisting>      	
+      </listitem>
+    </itemizedlist>    
+  </sect5>
+  <sect5 id="sparqloauthendpointfoafsslsparqldisablecond"><title>Using Conductor UI:</title>
+    <itemizedlist mark="bullet">
+      <listitem>Go to http://cname:port/conductor .</listitem>
+      <listitem>Enter user dba credentials.</listitem>
+      <listitem>Go to "Web Application Server" -> "Virtual Domains & Directories".
+        <figure id="s1" float="1">
+          <title>Disable SPARQL Endpoint</title>
+          <graphic fileref="ui/s1.png"/>
+        </figure>      	
+      </listitem>
+      <listitem>Find the logical path "/sparql".
+        <figure id="s2" float="1">
+          <title>Disable SPARQL Endpoint</title>
+          <graphic fileref="ui/s2.png"/>
+        </figure>      	
+      </listitem>
+      <listitem>Click "Edit" from the "Action" column.
+        <figure id="s3" float="1">
+          <title>Disable SPARQL Endpoint</title>
+          <graphic fileref="ui/s3.png"/>
+        </figure>      	
+      </listitem>
+      <listitem>Change "VSP User" to "nobody".
+        <figure id="s4" float="1">
+          <title>Disable SPARQL Endpoint</title>
+          <graphic fileref="ui/s4.png"/>
+        </figure>      	
+      </listitem>
+      <listitem>Click "Save Changes".</listitem>
+      <listitem>As result the SPARQL Endpoint should be shown as disabled:
+        <figure id="s5" float="1">
+          <title>Disable SPARQL Endpoint</title>
+          <graphic fileref="ui/s5.png"/>
+        </figure>      	
+      </listitem>
+    </itemizedlist>  
+  </sect5>
+</sect4>
 </sect3>
 
 <sect3 id="rdfsupportedrequestmethodsofprotocol"><title>Request Methods</title>
@@ -2758,7 +2826,7 @@ etc ...
 </sect3>
 <sect3 id="sparqliniservice"><title>SPARQL INI service</title>
     <para>
-	The [SPARQL] section of the virtuoso.ini configuration file sets parameters and limits for the SPARQL query web service. 
+	The <link linkend="ini_SPARQL">[SPARQL] section</link> of the virtuoso.ini configuration file sets parameters and limits for the SPARQL query web service.
 	The values contained in the [SPARQL] section can be exposed in RDF form via the URL pattern http://cname/sparql?ini
     </para>
     <para>Example: http://demo.openlinksw.com/sparql?ini</para>
@@ -3083,3405 +3151,3757 @@ create iri class oplsioc:grantee_iri using
 
 ]]></programlisting>
 </sect2>
-<sect2 id="sparqlextensions"><title>Extensions</title>
-<sect3 id="rdfsparqlrulefulltext"><title>Using Full Text Search in SPARQL</title>
-<para>Virtuoso's triple store supports optional full text indexing of RDF object values since version 5.0.
-It is possible to declare that objects of triples with a given predicate or graph get indexed.
-The graphs and triples may be enumerated or a wildcard may be used.
-</para>
-<para>The triples for which a full text index entry exists can be found using the <emphasis>bif:contains</emphasis>
-or related filters and predicates.
+
+<sect2 id="rdfsparqlinline"><title>SPARQL Inline in SQL</title>
+<para>Virtuoso extends the SQL 92 syntax with SPARQL queries and subqueries. Instead of writing a SQL SELECT query or subquery, one can write the SPARQL keyword and a SPARQL query after the keyword.</para>
+<programlisting>
+SQL>SPARQL SELECT DISTINCT ?p WHERE { graph ?g { ?s ?p ?o } };
+p
+varchar
+----------
+http://example.org/ns#b
+http://example.org/ns#d
+http://xmlns.com/foaf/0.1/name
+http://xmlns.com/foaf/0.1/mbox
+...
+
+
+SQL>SELECT distinct subseq ("p", strchr ("p", '#')) as fragment
+  FROM (SPARQL SELECT DISTINCT ?p WHERE { graph ?g { ?s ?p ?o } } ) as all_predicates
+  WHERE "p" like '%#%';
+fragment
+varchar
+----------
+#query
+#data
+#name
+#comment
+...
+</programlisting>
+<para>Note that names of variables returned from SPARQL are always case-sensitive and no case mode rules apply to them.
+Depending on the CaseMode parameter in the Virtuoso configuration file, double quotes should be used if necessary to refer to them in surrounding SQL code.
 </para>
-<para>For example, the query:
+<para>
+It is possible to pass parameters to a SPARQL query via a Virtuoso-specific syntax extension.
+<emphasis>??</emphasis> or <emphasis>$?</emphasis> indicates a positional parameter similar to <emphasis>?</emphasis> in plain SQL. <emphasis>??</emphasis> can be used in graph patterns or anywhere in place of a SPARQL variable.
+The value of a parameter should be passed in SQL form, i.e. this should be a number or a untyped string.
+An IRI ID can be passed in all cases where an absolute IRI can, except the obvious case of when the variable is an argument of a function that requires string.
+If the parameter is used in the 'graph', 'subject' or 'object' position of the SPARQL pattern, the string parameter is converted into an IRI automatically. In other cases an IRI string is indistinguishable from a string literal, so it is necessary to call the built-in SPARQL function <emphasis>iri()</emphasis> , e.g. <emphasis>iri (??)</emphasis>.
+Using this notation, any dynamic SQL client (whether ODBC, JDBC or some other) can execute parameterized SPARQL queries, binding parameters just as with dynamic SQL.
 </para>
-<programlisting>
-SQL>SELECT *
-FROM <people>
-WHERE
+<programlisting><![CDATA[
+SQL> create function param_passing_demo ()
   {
-    ?s foaf:Name ?name . ?name bif:contains "'rich*'".
+  declare stat, msg varchar;
+  declare mdata, rset any;
+  exec ('SPARQL SELECT ?s WHERE { graph ?g { ?s ?? ?? }}',
+    stat, msg,
+    vector ( /* Vector of two parameters */
+      'http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#int1',
+      4 ),
+    10, /* Max no of rows */
+    mdata, /* Variable to get metadata */
+    rset ); /* Variable to get result-set */
+  if (length (rset) = 0)
+    signal ('23000',
+      'No data found, try demo database with installed Virtuoso tutorials');
+  return rset[0][0];
   }
-</programlisting>
-<para>would match all subjects whose <emphasis>foaf:Name</emphasis> contained a word starting with Rich.
-This would match Richard, Richie etc.
-</para>
-<para>Note that words and phrases should be enclosed in quotes if they contain spaces or
-other non-alphanumeric chars.
+
+SQL> SELECT param_passing_demo ();
+callret
+VARCHAR
+_______________________________________________________________________________
+
+http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#four
+
+1 Rows. -- 00000 msec.
+]]></programlisting>
+<para>Another example:</para>
+<programlisting><![CDATA[
+INSERT INTO GRAPH <http://localhost:8890/Northwind> 
+{ `iri($?)` <http://localhost:8890/schemas/northwind#has_province> "Valencia" };	
+]]></programlisting>
+<para>An inline SPARQL query can refer to SQL variables that are in scope in the SQL query or stored procedure containing it.
+Virtuoso extends the SPARQL syntax with a special notation to this effect. A reference to SQL variable X can be written as <emphasis>?:X</emphasis> or <emphasis>$:X</emphasis>.
+A reference to column <emphasis>C</emphasis> of a table or a sub-select with alias <emphasis>T</emphasis> can be written as <emphasis>?:T.C</emphasis> or <emphasis>$:T.C</emphasis>.
+Both notations can be used in any place where a variable name is allowed, except the 'AS' clause described below.
 </para>
-<para>If the <emphasis>bif:contains</emphasis> or related predicate is applied to an object that is not
-a string or is not the object of an indexed triple, no match will be found.
+<para>A column of a result set of a SPARQL SELECT can be used in SQL code inside a for statement just like any column from a SQL select.
 </para>
-<para>The syntax for text patterns is identical to the syntax for the SQL contains predicate.
+<para>SQL rules about double-quoted names are applicable to variables that are passed to a SPARQL query or selected from one.
+If a variable name contains unusual characters or should not be normalized according to SQL conventions then the
+name should use double quotes for escaping. e.g., the notation <emphasis>?:"OrderLine"</emphasis> will always refer to variable or column
+titled <emphasis>OrderLine</emphasis> whereas <emphasis>?:OrderLine</emphasis> can be converted to <emphasis>ORDERLINE</emphasis> or <emphasis>orderline</emphasis>.
 </para>
-<para>The SPARQL/SQL optimizer determines whether the text pattern will be used to drive the query or whether it
-will filter results after other conditions are applied first. In contrast to <emphasis>bif:contains</emphasis>,
-regexp matching never drives the query or makes use of an index, thus in practice regexps are checked after other conditions.
+<para>It is safer to avoid using variable names that conflict with column names of RDF system tables, esp. <emphasis>G</emphasis>, <emphasis>S</emphasis>, <emphasis>P</emphasis> and <emphasis>O</emphasis>.
+These names are not reserved now but they may cause subtle bugs when an incorrect SPARQL subquery is compiled into SQL code that refers to identically named table columns.
+Some of these names may be rejected as syntax errors by future Virtuoso versions.
 </para>
-<sect4 id="rdfsparqlrulespecifywhatindex"><title>Specifying What to Index</title>
-<para>Whether the object of a given triple is indexed in the text index depends on indexing rules. If at least one
-indexing rule matches the triple, the object gets indexed if the object is a string. An indexing rule specifies
-a graph and a predicate. Either may be an IRI or NULL, in which case it matches all IRI's.
+<programlisting><![CDATA[
+SQL> create procedure sql_vars_demo ()
+{
+#pragma prefix sort0: <http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#>
+  declare RES varchar;
+  declare obj integer;
+  result_names (RES);
+  obj := 4;
+  for (SPARQL SELECT ?subj WHERE { graph ?g { ?subj sort0:int1 ?:obj } } ) do
+    result ("subj");
+}
+
+SQL> sql_vars_demo ();
+RES
+VARCHAR
+_______________________________________________________________________________
+
+http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#four
+
+1 Rows. -- 00000 msec.
+]]></programlisting>
+<para>The example also demonstrates the Virtuoso/PL pragma line for procedure-wide declarations of namespace prefixes.
+This makes the code more readable and eliminates duplicate declarations of namespace prefixes when the procedure
+contains many SPARQL fragments that refer to a common set of namespaces.
 </para>
-<para>Rules also have a 'reason', which can be used to group rules into application-specific sets. A triple will stop
-being indexed only after all rules mandating its indexing are removed. When an application requires indexing a
-certain set of triples, rules are added for that purpose. These rules are tagged with the name of the application
-as their reason. When an application no longer requires indexing, the rules belonging to this application can be
-removed. This will not turn off indexing if another application still needs certain triples to stay indexed.
+<para>A SPARQL ASK query can be used as an argument of the SQL EXISTS predicate.
 </para>
-<para>Indexing is enabled/disabled for specific graph/predicate combinations with:
+<programlisting><![CDATA[
+create function sparql_ask_demo () returns varchar
+{
+  if (exists (sparql ask where { graph ?g { ?s ?p 4}}))
+    return 'YES';
+  else
+    return 'NO';
+}
+
+SQL> SELECT sparql_ask_demo ();
+_______________________________________________________________________________
+
+YES
+]]>
+</programlisting>
+<sect3 id="rdfcontrollingsparqloutputtypes"><title>Controlling SPARQL Output Data Types</title>
+<para>The compilation of a SPARQL query may depend on an environment that is usually provided by the SPARQL protocol and which includes the default graph URI. Environment settings that come from the SPARQL protocol may override settings in the text of a SPARQL query. To let an application configure the environment for a query, SPARQL's syntax has been extended with the 'define' clause:</para>
+<programlisting>
+define parameter-qname parameter-value
+</programlisting>
+<para>Examples of supported parameters are <emphasis>output:valmode</emphasis> and <emphasis>output:format</emphasis></para>
+<para>
+<emphasis>output:valmode</emphasis> specifies which data types (i.e. representation) should be used for values in the result set. The default is "SQLVAL",
+meaning that a query returns result set values in SQL format and behaves as a typical SQL select - IRIs and string literals
+are returned as strings, making the output compatible with ODBC and the standard SQL routines. To compose triple vectors in Virtuoso PL code, an
+application may need data in long format. A valmode of "LONG" means that IRIs are returned as IRI_IDs and string literals may be returned as special "RDF boxes"
+even if they are actually plain strings. This may cause problems if these new datatypes are not known to the data recipient or if IRIs come from RDF
+Views (in which case IRI_IDs are created on the fly and 'pollute' the database), but it can result in fewer data conversions and thus better speed if used
+properly. "AUTO" disables all types of conversion for the result set, so the latter can comprise a mix of values across "SQLVAL" and "LONG" value modes, as well as
+some internal representations. It is better to avoid using this mode in user applications because the output may change from version to version.
 </para>
+<para>If the query contains a</para>
 <programlisting>
-create function DB.DBA.RDF_OBJ_FT_RULE_ADD
-  (in rule_g varchar, in rule_p varchar, in reason varchar) returns integer
+define output:valmode 'LONG'
 </programlisting>
+<para>clause then all returned values are in long format. e.g., the following query returns IRI_ID's instead of IRI strings.</para>
 <programlisting>
-create function DB.DBA.RDF_OBJ_FT_RULE_DEL
-  (in rule_g varchar, in rule_p varchar, in reason varchar) returns integer
+SQL>SPARQL define output:valmode 'LONG' SELECT distinct ?p WHERE { graph ?g { ?s ?p ?o } };
+p
+----------
+#i1000001
+#i1000003
+#i1000005
+#i1000006
+...
 </programlisting>
-<para>The first function adds a rule. The first two arguments are the text representation of the IRI's for the graph
-and predicate. If NULL is given then all graph's or predicates match. Specifying both as NULL means that all
-string valued objects will be added to a text index.
-</para>
-<para>The second function reverses the effect of the first. Only a rule that has actually been added can be deleted.
-Thus one cannot say that all except a certain enumerated set should be indexed.
+<para><emphasis>output:format</emphasis> instructs the SPARQL compiler that the result of the query should be serialized into an RDF document -
+that document will be returned as a single column of a single row result set.
+<emphasis>output:format</emphasis> is especially useful if a SPARQL CONSTRUCT or SPARQL DESCRIBE query is executed directly via an ODBC or JDBC database connection
+and the client cannot receive the resulting dictionary of triples (there's no way to transfer such an object via ODBC).
+Using this option, the client can receive the document that contains the whole result set of a SELECT or the dictionary of triples of a CONSTRUCT/DESCRIBE, and parse it locally.
 </para>
-<para>The reason argument is an arbitrary string identifying the application that needs this rule.
-Two applications can add the same rule.
-Removing one of them will still keep the rule in effect.
-If an object is indexed by more than one rule, the index data remain free from duplicates, neither index size nor speed is affected.
+<para>
+Supported values for <emphasis>output:format</emphasis> are <emphasis>RDF/XML</emphasis> and <emphasis>TURTLE</emphasis> (or <emphasis>TTL</emphasis>).
+If both <emphasis>output:valmode</emphasis> and <emphasis>output:format</emphasis> are specified, <emphasis>output:format</emphasis> has higher priority,
+raising an error if <emphasis>output:valmode</emphasis> is set to a value other than <emphasis>LONG</emphasis>.
 </para>
 <para>
-If <emphasis>DB.DBA.RDF_OBJ_FT_RULE_ADD</emphasis> detects that <emphasis>DB.DBA.RDF_QUAD</emphasis> contains quads whose graphs and/or predicates match to the new rule but which have not been indexed before then these quads are indexed automatically.
-However the function <emphasis>DB.DBA.RDF_OBJ_FT_RULE_DEL</emphasis> does not remove indexing data about related objects.
-Thus the presence of indexing data about an object does not imply that it is necessarily used in some quad that matches to some rule.
+When a SPARQL query is compiled, the compiler checks whether the result set is to be sent to a remote ODBC/JDBC client or used in some other way.
+The compiler will automatically set <emphasis>output:format</emphasis> to <emphasis>TURTLE</emphasis> if compiling for execution by an SQL client.
 </para>
-<para>The above functions return one if the rule is added or deleted and zero if the call was redundant (the rule has been added before or there's no rule to delete).
+<para>
+The example below demonstrates how different values of <emphasis>output:format</emphasis> affect the result of SPARQL SELECT.
+Note 10 rows and 4 columns in the first result, and single LONG VARCHAR in the others.
+When using the ISQL client, use the 'set blobs on;' directive if fetching long texts to avoid receiving a 'data truncated' warning.
 </para>
-<sect5 id="rdfsparqlrulespecifywhatindexexample"><title>Example</title>
 <programlisting><![CDATA[
+SQL> SPARQL SELECT * WHERE {graph ?g { ?s ?p ?o }} limit 10;
+g                                            s                    p                              o
+VARCHAR                                      VARCHAR              VARCHAR                        VARCHAR
+______________________________________________________________________
 
--- We load Tim Berners-Lee's FOAF file into a graph called 'people'.
-
-SQL>DB.DBA.RDF_LOAD_RDFXML (http_get ('http://www.w3.org/People/Berners-Lee/card#i'), 'no', 'http://www.w3.org/people#');
-Done. -- 172 msec.
+http://local.virt/DAV/bound/manifest.rdf     nodeID://1000000000 http://example.com/test#query http://local.virt/DAV/bound/bound1.rq
+. . .
+http://local.virt/DAV/examples/manifest.rdf nodeID://1000000019 http://example.com/test#query http://local.virt/DAV/examples/ex11.2.3.1_1.rq
 
--- We check how many triples we got.
+10 Rows. -- 00000 msec.
 
-SQL>SPARQL SELECT COUNT (*) FROM <http://www.w3.org/people#> WHERE {?s ?p ?o};
+SQL> SPARQL define output:format "TTL" SELECT * WHERE {graph ?g { ?s ?p ?o }} limit 10;
 callret-0
-INTEGER
- 266
-No. of rows in result: 1
-
--- We check the GRAPH: <http://www.w3.org/people#> for objects like "Tim":
-
-SQL>SPARQL
-SELECT *
-FROM <http://www.w3.org/people#>
-WHERE
-  {
-    ?s ?p ?o . FILTER (?o LIKE '%Tim%')
-  };
-s                                               p                                           o
-VARCHAR                                         VARCHAR                                     VARCHAR
+LONG VARCHAR
 _______________________________________________________________________________
 
-http://www.w3.org/People/Berners-Lee/card#i     http://xmlns.com/foaf/0.1/name              Timothy Berners-Lee
-http://www.w3.org/People/Berners-Lee/card#i     http://xmlns.com/foaf/0.1/nick              TimBL
-http://www.w3.org/People/Berners-Lee/card#i     http://www.w3.org/2002/07/owl#sameAs        http://www4.wiwiss.fu-berlin.de/bookmashup/persons/Tim+Berners-Lee
-http://www.w3.org/People/Berners-Lee/card#i     http://xmlns.com/foaf/0.1/knows             http://dbpedia.org/resource/Tim_Bray
-http://www.w3.org/People/Berners-Lee/card#i     http://www.w3.org/2000/01/rdf-schema#label  Tim Berners-Lee
-http://www.w3.org/People/Berners-Lee/card#i     http://xmlns.com/foaf/0.1/givenname         Timothy
-http://dbpedia.org/resource/Tim_Bray            http://xmlns.com/foaf/0.1/name              Tim Bray
-no                                              http://purl.org/dc/elements/1.1/title       Tim Berners-Lee's FOAF file
+ at prefix :rdf <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ at prefix :rs <http://www.w3.org/2005/sparql-results#> .
+ at prefix :xsd <http://www.w3.org/2001/XMLSchema#> .
+[ rdf:type rs:results ;
+  rs:result [
+      rs:binding [ rs:name "g" ; rs:value <http://local.virt/DAV/bound/manifest.rdf> ] ;
+      rs:binding [ rs:name "s" ; rs:value _:nodeID1000000000 ] ;
+      rs:binding [ rs:name "p" ; rs:value <http://example.com/test#query> ] ;
+      rs:binding [ rs:name "o" ; rs:value <http://local.virt/DAV/bound/bound1.rq> ] ;
+      ] ;
 
-8 Rows. -- 230 msec.
+. . .
 
+  rs:result [
+      rs:binding [ rs:name "g" ; rs:value <http://local.virt/DAV/examples/manifest.rdf> ] ;
+      rs:binding [ rs:name "s" ; rs:value _:nodeID1000000019 ] ;
+      rs:binding [ rs:name "p" ; rs:value <http://example.com/test#query> ] ;
+      rs:binding [ rs:name "o" ; rs:value <http://local.virt/DAV/examples/ex11.2.3.1_1.rq> ] ;
+      ] ;
+    ] .
 
--- We specify that all string objects in the graph 'people' should be text indexed.
+1 Rows. -- 00000 msec.
 
-SQL>DB.DBA.RDF_OBJ_FT_RULE_ADD('http://www.w3.org/people#', null, 'people');
-Done. -- 130 msec.
+SQL> SPARQL define output:format "RDF/XML" SELECT * WHERE {graph ?g { ?s ?p ?o }} LIMIT 10;
+callret-0
+LONG VARCHAR
+_______________________________________________________________________________
 
--- We update the text index.
+<rdf:RDF
+  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+  xmlns:rs="http://www.w3.org/2005/sparql-results#"
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema#" >
+   <rs:results rdf:nodeID="rset">
+  <rs:result rdf:nodeID="sol206">
+   <rs:binding rdf:nodeID="sol206-0" rs:name="g"><rs:value rdf:resource="http://local.virt/DAV/bound/manifest.rdf"/></rs:binding>
+   <rs:binding rdf:nodeID="sol206-1" rs:name="s"><rs:value rdf:nodeID="1000000000"/></rs:binding>
+   <rs:binding rdf:nodeID="sol206-2" rs:name="p"><rs:value rdf:resource="http://example.com/test#query"/></rs:binding>
+   <rs:binding rdf:nodeID="sol206-3" rs:name="o"><rs:value rdf:resource="http://local.virt/DAV/bound/bound1.rq"/></rs:binding>
+  </rs:result>
 
-SQL>DB.DBA.VT_INC_INDEX_DB_DBA_RDF_OBJ ();
-Done. -- 140 msec.
+. . .
 
--- See impact of the index  by querying the subjects and predicates
--- of all triples in the GRAPH: <http://www.w3.org/people#>,
--- where the object is a string which contains a word beginning with "TIM".
+  <rs:result rdf:nodeID="sol5737">
+   <rs:binding rdf:nodeID="sol5737-0" rs:name="g"><rs:value rdf:resource="http://local.virt/DAV/examples/manifest.rdf"/></rs:binding>
+   <rs:binding rdf:nodeID="sol5737-1" rs:name="s"><rs:value rdf:nodeID="1000000019"/></rs:binding>
+   <rs:binding rdf:nodeID="sol5737-2" rs:name="p"><rs:value rdf:resource="http://example.com/test#query"/></rs:binding>
+   <rs:binding rdf:nodeID="sol5737-3" rs:name="o"><rs:value rdf:resource="http://local.virt/DAV/examples/ex11.2.3.1_1.rq"/></rs:binding>
+  </rs:result>
+ </rs:results>
+</rdf:RDF>
 
-SQL>SPARQL SELECT * FROM <http://www.w3.org/people#> WHERE { ?s ?p ?o . ?o bif:contains '"Timo*"'};
-s                                             p                                      o
-VARCHAR                                                 VARCHAR    VARCHAR
+1 Rows. -- 00000 msec.
+]]></programlisting>
+<para>SPARQL CONSTRUCT and SPARQL DESCRIBE results are serialized as one would expect:</para>
+<programlisting><![CDATA[
+SQL>SPARQL
+define output:format "TTL"
+CONSTRUCT { ?s ?p "004" }
+WHERE
+  {
+    graph ?g { ?s ?p 4 }
+  };
+callret-0
+LONG VARCHAR
 _______________________________________________________________________________
 
-http://www.w3.org/People/Berners-Lee/card#i  http://xmlns.com/foaf/0.1/name  Timothy Berners-Lee
-http://www.w3.org/People/Berners-Lee/card#i  http://xmlns.com/foaf/0.1/givenname  Timothy
+<http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#four> <http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#int1> "004" .
+_:b1000000913 <http://www.w3.org/2001/sw/DataAccess/tests/result-set#index> "004" .
 
-2 Rows. -- 2 msec.
-]]></programlisting>
-<para>
-The query below is identical with that above but uses a different syntax. 
-The filter syntax is more flexible in that it allows passing extra options to the <emphasis>contains</emphasis> predicate. These may be useful in the future.
-</para>
-<programlisting><![CDATA[
-SQL>SPARQL SELECT * FROM <people> WHERE { ?s ?p ?o . FILTER (bif:contains(?o,  '"Timo*"')) };
+
+1 Rows. -- 00000 msec.
+
+SQL> SPARQL
+define output:format "RDF/XML"
+CONSTRUCT { ?s ?p "004" }
+WHERE
+  {
+    graph ?g { ?s ?p 4 }
+  };
+callret-0
+LONG VARCHAR
+_______________________________________________________________________________
+
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<rdf:Description about="http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#four"><ns0pred:int1 xmlns:ns0pred="http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#">004</ns0pred:int1></rdf:Description>
+<rdf:Description rdf:nodeID="b1000000913"><ns0pred:index xmlns:ns0pred="http://www.w3.org/2001/sw/DataAccess/tests/result-set#">004</ns0pred:index></rdf:Description>
+</rdf:RDF>
+
+1 Rows. -- 00000 msec.
 ]]></programlisting>
-</sect5>
-<note><title>Note:</title><para>It is advisable to upgrade to the latest version of Virtuoso before adding free-text rules for the first time.
-This is especially the case if large amounts of text are to be indexed. The reason is that the free-text index on RDF may be changed in future versions 
-and automatic upgrading of an existing index data into the new format may take much more time than indexing from scratch.</para></note>
-<para>The table <emphasis>DB.DBA.RDF_OBJ_FT_RULES</emphasis> stores list of free-text index configuration rules.
-</para>
+<para>SPARQL ASK returns a non-empty result set if a match is found for the graph pattern, an empty result set otherwise. If <emphasis>output:format</emphasis> is specified then the query makes a 'boolean result' document instead:</para>
 <programlisting><![CDATA[
-create table DB.DBA.RDF_OBJ_FT_RULES (
-  ROFR_G varchar not null,       -- specific graph IRI or NULL for "all graphs"
-  ROFR_P varchar not null,       -- specific predicate IRI or NULL for "all predicates"
-  ROFR_REASON varchar not null,  -- identification string of a creator, preferably human-readable
-  primary key (ROFR_G, ROFR_P, ROFR_REASON) );
+SQL> SPARQL ASK WHERE {graph ?g { ?s ?p 4 }};
+__ask_retval
+INTEGER
+_______________________________________________________________________________
+
+1
+
+1 Rows. -- 00000 msec.
+
+SQL> SPARQL ASK WHERE {graph ?g { ?s ?p "no such" }};
+__ask_retval
+INTEGER
+_______________________________________________________________________________
+
+
+0 Rows. -- 00000 msec.
+
+SQL> SPARQL define output:format "TTL" ASK WHERE {graph ?g { ?s ?p 4 }};
+callret
+VARCHAR
+_______________________________________________________________________________
+
+ at prefix :rdf <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ @prefix :rs <http://www.w3.org/2005/sparql-results#> .
+[ rdf:type rs:results ; rs:boolean TRUE ]
+
+1 Rows. -- 00000 msec.
+
+SQL> SPARQL define output:format "RDF/XML" ASK WHERE {graph ?g { ?s ?p 4 }};
+callret
+VARCHAR
+_______________________________________________________________________________
+
+<rdf:RDF
+  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+  xmlns:rs="http://www.w3.org/2005/sparql-results#"
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema#" >
+   <rs:results rdf:nodeID="rset">
+    <rs:boolean rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">1</rs:boolean></results></rdf:RDF>
+
+1 Rows. -- 00000 msec.
 ]]></programlisting>
+</sect3>
+</sect2>
+<sect2 id="rdfapi">
+<title>API Functions</title>
 <para>
-Applications may read from this table but they should not write to it directly.
-Duplications in the rules do not affect the speed of free-text index operations because the content of the table is cached in memory in a special form.
-Unlike the use of configuration functions, directly writing to the table will not update the in-memory cache.
+SPARQL can be used inline wherever SQL can be used.
+The only API functions that one needs to know are the ones for loading RDF data into the store.
+Dynamic SQL client applications can issue SPARQL queries against Virtuoso through the regular SQL client API, ODBC, JDBC or any other supported API, simply by prefixing the SPARQL query with the SPARQL keyword. Parameters work just as with dynamic SQL.
+Stored procedures can have SPARQL expressions inline and can declare cursors over SPARQL result sets.
 </para>
+
 <para>
-The table is convenient to search for rules added by a given application.
-If a unique identification string is used during installation of an application when rules are added then it's easy to remove those rules 
-as part of any uninstall routine.
+Value conversions between SQL and SPARQL are most often automatic and
+invisible. In some cases one needs to be aware of the different
+SPARQL value representations (valmodes). SPARQL offers declarations
+for specifying whether returned graphs are to be serialized as XML
+or Turtle,  or whether these will be hash tables of
+triples. See <link linkend="fn_dict_new"><function>dict_new()</function></link> and related functions for a description of the hash table SQL data type.
+The use of dict's is convenient for further programmatic processing of graphs.
 </para>
-</sect4>
-<sect4 id="rdfsparqlruletimeindexing"><title>Time of Indexing</title>
-<para>The triple store's text index is in manual batch mode by default. This means that changes in triples are periodically
-reflected in the text index but are not maintained in strict synchrony. This is much more efficient than keeping the
-indices in constant synchrony. This setting may be altered with the <emphasis>db.dba.vt_batch_update</emphasis> stored procedure.
+
+<para>RDF-related procedures use Virtuoso/PL vectors
+and dictionaries to represent RDF triples and sets of triples.</para>
+<para><emphasis>Valmode</emphasis> means the "format of values returned by an
+expression", i.e. 'short', 'long' or 'SQL value'.</para>
+<para><emphasis>Triple vector</emphasis> is a vector (array) of S, P and O, where all values are in
+'long' formats, i.e. IRI_ID's for IRI values, numbers or datetimes for corresponding XMLSchema types, special "RDF box" objects if O is neither string nor IRI.</para>
+<para><emphasis>Dictionary of triples</emphasis> or <emphasis>Hash table of triples</emphasis> is an
+dictionary object made by the SQL function <emphasis>dict_new ()</emphasis> whose keys are
+triple vectors and values are not specified; this is a good storage
+format for an unordered set of distinct triples.</para>
+<para><emphasis>Dictionary of blank node names</emphasis> is a dictionary used for tricky
+processing of a number of TURTLE or RDF /XML descriptions of subgraphs
+that come from a common graph. Imagine a situation where different
+descriptions actually refer to the same blank nodes of the original graph
+and, moreover, the application that generates these descriptions always
+generates the same blank node id string for the same node. A reader of
+descriptions can correctly join described subgraphs into one big
+subgraph by filling in a dictionary that contains blank node id strings
+as keys and IRI_ID's assigned to those strings as dependent data.
+The sharing of the same node dictionary by all readers of an application will ensure that no blank node is duplicated.</para>
+<sect3 id="rdfapidataimport"><title>Data Import</title>
+<sect4 id="rdfapidataimportttlp"><title>Using TTLP</title>
+<para>DB.DBA.TTLP() parses TTL (TURTLE or N3 resource) and places its triples into DB.DBA.RDF_QUAD.</para>
+<programlisting>
+create procedure DB.DBA.TTLP (
+    in strg any,       -- text of the resource
+    in base varchar,   -- base IRI to resolve relative IRIs to absolute
+    in graph varchar, -- target graph IRI, parsed triples will appear in that graph.
+    in flags int)   -- bitmask of flags that permit some sorts of syntax errors in resource, use 0.
+</programlisting>
+<para>For loading a file of any great length, it is more practical to use
+the file_to_string_output function.
 </para>
-<para>To force synchronization of the RDF text index, use:
+<para>It is important the file be accessible to the Virtuoso server. You need to have set properly set the
+<emphasis>DirsAllowed</emphasis> parameter value in the section [Parameters] of the Virtuoso database INI file.
+For example on Windows it could be:
 </para>
 <programlisting>
-DB.DBA.VT_INC_INDEX_DB_DBA_RDF_OBJ ();
+virtuoso.ini file:
+[Parameters]
+...
+DirsAllowed =  .\tmp
+...
 </programlisting>
-<para>To set the text index to follow the triples in real time, use:
+<para>So, in the example, the file you want to import from, should be in the tmp folder or in a subfolder.
+Note that this example folder is a subfolder of the Virtuoso Server working directory.
 </para>
 <programlisting>
-DB.DBA.VT_BATCH_UPDATE ('DB.DBA.RDF_OBJ', 'OFF', null);    
+SQL> DB.DBA.TTLP (file_to_string_output ('.\tmp\data.ttl'), '', 'http://my_graph', 0);
 </programlisting>
-<para>To set the text index to be updated every 10 minutes, use:
+</sect4>
+<sect4 id="rdfapidataimportttlpmt"><title>Using TTLP_MT</title>
+<para>The DB.DBA.TTLP_MT() procedure is like DB.DBA.TTLP() but loads the file on multiple threads,
+using parallel I/O and multiprocessing if available. The function does not leave a transaction log.
+Hence, after a successful load, one should execute the checkpoint statement to make sure that a
+server restart does not wipe out the results.
 </para>
 <programlisting>
-DB.DBA.VT_BATCH_UPDATE ('DB.DBA.RDF_OBJ', 'ON', 10);
+create procedure DB.DBA.TTLP_MT (
+    in strg any,       -- text of the resource
+    in base varchar,   -- base IRI to resolve relative IRIs to absolute
+    in graph varchar,  -- target graph IRI, parsed triples will appear in that graph.
+    in flags int) -- flags, use 0
 </programlisting>
-<para>To make the update always manual, specify NULL as the last argument above.
-</para>
-<para>
-One problem related to free-text indexing of <emphasis>DB.DBA.RDF_QUAD</emphasis> is that some applications (e.g. those that import billions of triples) may set off triggers.
-This will make free-text index data incomplete.
-Calling procedure <emphasis>DB.DBA.RDF_OBJ_FT_RECOVER ()</emphasis> will insert all missing free-text index items by dropping and re-inserting every existing free-text index rule.
-</para>
 </sect4>
-<sect4 id="rdfviewsandfreetext"><title>Free-Text Indexes on RDF Views</title>
-<para>
-If an <emphasis>O</emphasis> field of a quad map pattern gets its value from a database column that has a free text index then this index can be used in SPARQL for efficient text searching. As a variation of this facility, the free-text index of another table may be used.
-</para>
-<para>
-If a statement of a quad map pattern declaration starts with a declaration of table aliases, the table alias declaration may include the name of a table column that should have a text index.
-For example, consider the possibility of using a free-text index on the content of DAV resources stored in the DAV system tables of Virtuoso:
-</para>
-<programlisting><![CDATA[
-prefix mydav: <...>
-create quad storage mydav:metadata
-FROM WS.WS.SYS_DAV_RES as dav_resource text literal RES_CONTENT
-...
-  {
-    ...
-    mydav:resource-iri (dav_resource.RES_FULL_PATH)
-        a mydav:resource ;
-        mydav:resource-content dav_resource.RES_CONTENT ;
-        mydav:resource-mime-type dav_resource.RESTYPE ;
-    ...
-  }
-]]></programlisting>
-<para>
-The clause <emphasis>text literal RES_CONTENT</emphasis> grants the SPARQL compiler permission to use a free-text index for objects that are literals composed from column <emphasis>dav_resource.RES_CONTENT</emphasis>. This clause also allows choosing between <emphasis>text literal</emphasis> (supports only the <emphasis>contains()</emphasis> predicate) and <emphasis>text xml literal</emphasis> (supports both <emphasis>contains()</emphasis> and <emphasis>xcontains()</emphasis>) text indexes.
-It is important to understand that the free-text index will produce results using raw relational data.
-If a literal class transformation changes the text stored in the column then these changes are ignored by free-text search.
-e.g. if a transformation concatenates a word to the value of the column, but the free-text search will not find this word.
-</para>
-<para>
-The free-text index may be used in a more sophisticated way. Consider a built-in table <emphasis>DB.DBA.RDF_QUAD</emphasis> that does not have a free-text index.
-Moreover, the table does not contain the full values of all objects; the <emphasis>O</emphasis> column contains "short enough" values inlined, but long and special values are represented by links to the <emphasis>DB.DBA.RDF_OBJ</emphasis> table.
-The RDF_OBJ table, however, has free-text index that can be used.
-The full declaration of the built-in default mapping for default storage could be written this way:
-</para>
+<sect4 id="rdfapidataimportxmlttlpmt"><title>Using RDF_LOAD_RDFXML_MT</title>
+<para>For loading large resources when transactional integrity is not important (loading of a single resource may take more than one transaction)
+you can use also the <emphasis>DB.DBA.RDF_LOAD_RDFXML_MT()</emphasis> procedure:</para>
+<programlisting>
+create procedure DB.DBA.RDF_LOAD_RDFXML_MT (
+    in strg varchar,  -- text of the resource
+    in base varchar,  -- base IRI to resolve relative IRIs to absolute
+    in graph varchar) -- target graph IRI, parsed triples will appear in that graph.
+</programlisting>
+<para>The following example demonstrates importing data from the RDF resource with URI: http://www.w3.org/People/Berners-Lee/card</para>
 <programlisting><![CDATA[
--- Important! Do not try to execute on live system
--- without first changing the quad storage and quad map pattern names!
+SQL>create procedure MY_LOAD_FILE (in full_uri varchar, in in_resultset integer := 0)
+  {
+  declare REPORT varchar;
+  declare graph_uri, dattext varchar;
+  declare app_env any;
+  app_env := null;
+  whenever sqlstate '*' goto err_rep;
+  if (not in_resultset)
+    result_names (REPORT);
+  dattext := cast (XML_URI_GET_AND_CACHE (full_uri) as varchar);
+  MY_SPARQL_REPORT (sprintf ('Downloading %s: %d bytes',
+      full_uri, length (dattext) ) );
+  graph_uri := full_uri;
+  DELETE FROM RDF_QUAD WHERE G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_uri);
+  DB.DBA.RDF_LOAD_RDFXML_MT (dattext, full_uri, graph_uri);
+  return graph_uri;
+err_rep:
+  result (sprintf ('%s: %s', __SQL_STATE, __SQL_MESSAGE));
+  return graph_uri;
+  }
+;
 
-SPARQL
-create virtrdf:DefaultQuadMap as
-graph rdfdf:default-iid-nonblank (DB.DBA.RDF_QUAD.G)
-subject rdfdf:default-iid (DB.DBA.RDF_QUAD.S)
-predicate rdfdf:default-iid-nonblank (DB.DBA.RDF_QUAD.P)
-object rdfdf:default (DB.DBA.RDF_QUAD.O)
+Done. -- 0 msec.
 
-create quad storage virtrdf:DefaultQuadStorage
-FROM DB.DBA.RDF_QUAD as physical_quad
-FROM DB.DBA.RDF_OBJ as physical_obj text xml literal RO_DIGEST of (physical_quad.O)
-WHERE (^{physical_quad.}^.O = ^{physical_obj.}^.RO_DIGEST)
+SQL>create procedure MY_SPARQL_REPORT(in strg varchar)
   {
-    create virtrdf:DefaultQuadMap as
-      graph rdfdf:default-iid-nonblank (physical_quad.G)
-      subject rdfdf:default-iid (physical_quad.S)
-      predicate rdfdf:default-iid-nonblank (physical_quad.P)
-      object rdfdf:default (physical_quad.O) .
+  if (__tag(strg) <> 182)
+    strg := cast (strg as varchar) || sprintf (' -- not a string, tag=%d', __tag(strg));
+  strg := replace (strg, 'SPARQL_DAV_DATA_URI()', '\044{SPARQL_DAV_DATA_URI()}');
+  strg := replace (strg, 'SPARQL_DAV_DATA_PATH()', '\044{SPARQL_DAV_DATA_PATH()}');
+  strg := replace (strg, 'SPARQL_FILE_DATA_ROOT()', '\044{SPARQL_FILE_DATA_ROOT()}');
+  result (strg);
   }
 ;
-]]></programlisting>
-<para>
-The reference to the free-text index is extended by clause <emphasis> of (physical_quad.O)</emphasis>.
-This means that the free-text on <emphasis>DB.DBA.RDF_OBJ.RO_DIGEST</emphasis> will be used when the object value comes from <emphasis>physical_quad.O</emphasis> as if <emphasis>physical_quad.O</emphasis> were indexed itself.
-If a SPARQL query invokes <emphasis>virtrdf:DefaultQuadMap</emphasis> but contains no free-text criteria then only <emphasis>DB.DBA.RDF_QUAD</emphasis> appears in the final SQL statement and no join with <emphasis>DB.DBA.RDF_OBJ</emphasis> is made.
-Adding a free-text predicate will add <emphasis>DB.DBA.RDF_OBJ</emphasis> to the list of source tables and a join condition for <emphasis>DB.DBA.RDF_QUAD.O</emphasis> and <emphasis>DB.DBA.RDF_OBJ.RO_DIGEST</emphasis>; and it will add <emphasis>contains (RO_DIGEST, ...)</emphasis> predicate, rather than <emphasis>contains (O, ...)</emphasis>.
-As a result, "you pay only for what you use": adding free-text index to the declaration does not add tables to the query unless the index is actually used.
-</para>
-<para>
-Boolean functions <function>bif:contains</function> and <function>bif:xcontains</function> are used for objects that come from RDF Views as well as for regular "physical" triples.
-Every function takes two arguments and returns a boolean value. The first argument is an local variable.
-The argument variable should be used as an object field in the group pattern where the filter condition is placed.
-Moreover, the occurrence of the variable in an object field should be placed <emphasis>before</emphasis> the filter.
-If there are many occurrences of the variable in object fields then the free-text search is associated with the rightmost occurrence that is still to the left of the filter.
-The triple pattern that contains the rightmost occurrence is called the "intake" of the free-text search.
-When the SPARQL compiler chooses the appropriate quad map patterns that may generate data matching the intake triple pattern, it skips quad map patterns that have no declared free-text indexes, because nothing can be found by free-text search in data that have no free-text index.
-Every quad map pattern that has a free-text pattern will ultimately produce an invocation of the SQL <link linkend="containspredicate">contains</link> or <link linkend="xcontainspredicate">xcontains</link> predicate, so the final result of a free-text search may be a union of free-text searches from different quad map patterns.
-</para>
-<para>
-The described logic is important only in very complicated cases, whereas simple queries are self-evident:
-</para>
-<programlisting><![CDATA[
-SELECT * FROM <my-dav-graph>
-WHERE {
-    ?resource a mydav:resource ;
-        mydav:resource-content ?text .
-    FILTER (bif:contains (?text, "hello and world")) }
-]]></programlisting>
-<para>
-or, more succinctly,
-</para>
-<programlisting><![CDATA[
-SELECT * FROM <my-dav-graph>
-WHERE {
-    ?resource a mydav:resource ;
-        mydav:resource-content ?text .
-    ?text bif:contains "hello and world" . }
-]]></programlisting>
-</sect4>
-<sect4 id="rdfsparqlrulescoreexmp"><title>Example Using Score</title>
-<programlisting><![CDATA[
-SQL>
-SPARQL
+
+Done. -- 0 msec.
+
+SQL> MY_LOAD_FILE('http://www.w3.org/People/Berners-Lee/card');
+REPORT
+VARCHAR
+_______________________________________________________________________________
+
+Downloading http://www.w3.org/People/Berners-Lee/card: 17773 bytes
+
+1 Rows. -- 4046 msec.
+
+SQL>SPARQL
 SELECT *
-WHERE
-  {
-    ?s ?p ?o .
-    ?o bif:contains 'NEW AND YORK'
-    OPTION (score ?sc) .
-  }
-ORDER BY DESC (?sc)
-LIMIT 10
+FROM <http://www.w3.org/People/Berners-Lee/card>
+WHERE {?s ?p ?o} ;
 
-s                                                                        p                                               o                                                sc
-ANY                                                                      ANY                                             ANY 	                                          ANY
-______________________________________________________________________________________________________________________________________________________________________________
+s                                             p                                               o
+VARCHAR                                       VARCHAR                                         VARCHAR
+__________________________________________________________________________________________________________
 
-http://dbpedia.org/resource/New_York%2C_New_York_%28disambiguation%29	 http://www.w3.org/2000/01/rdf-schema#comment	 New York, New York, New York kentini........     88
-http://dbpedia.org/resource/New_York%2C_New_York_%28disambiguation%29	 http://dbpedia.org/property/abstract	         New York, New York, New York kentinin re....     88
-http://newyorkjobs.wordpress.com/2006/07/10/new-york-jobs-71006	         http://purl.org/dc/elements/1.1/description	 York Marketing Jobs New York Retail Jobs....     84
-http://dbpedia.org/resource/Global_Communication	                 http://dbpedia.org/property/contenu	         A - New York, New York (Headfuq Mix) B1 ....     84
-http://dbpedia.org/resource/New_York_%28disambiguation%29	         http://www.w3.org/2000/01/rdf-schema#comment	 New York a^?? New York amerikai vA~?ros ....     76
-http://dbpedia.org/resource/New_York_%28disambiguation%29	         http://dbpedia.org/property/abstract	         New York a^?? New York amerikai vA~?ros ....     76
-http://dbpedia.org/resource/New_York_%28disambiguation%29	         http://www.w3.org/2000/01/rdf-schema#comment	 New York ima lahko naslednje pomene: New ...     74
-http://dbpedia.org/resource/New_York_%28disambiguation%29	         http://dbpedia.org/property/abstract	         New York ima lahko naslednje pomene: New ...     74
-http://dbpedia.org/resource/New_York_College	                         http://www.w3.org/2000/01/rdf-schema#comment	 There are several colleges of New York t ...     72
-http://dbpedia.org/resource/New_York_College	                         http://dbpedia.org/property/abstract	         There are several colleges of New York t ...     72
-No. of rows in result: 10
+http://bblfish.net/people/henry/card#me       http://xmlns.com/foaf/0.1/name                  Henry Story
+http://www.w3.org/People/Berners-Lee/card#i   http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://xmlns.com/foaf/0.1/Person
+http://www.w3.org/People/Berners-Lee/card#i   http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2000/10/swap/pim/contact#Male
+http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/nick                  TimBL
+http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/nick                  timbl
+http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/mbox                  mailto:timbl at w3.org
+http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/mbox_sha1sum          965c47c5a70db7407210cef6e4e6f5374a525c5c
+http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://bblfish.net/people/henry/card#me
+http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://hometown.aol.com/chbussler/foaf/chbussler.foaf#me
+http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://danbri.org/foaf#danbri
+http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://norman.walsh.name/knows/who#norman-walsh
+http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://www.aaronsw.com/about.xrdf#aaronsw
+http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://www.ivan-herman.net/foaf.rdf#me
+http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://www.w3.org/People/Berners-Lee/card#amy
+http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://dig.csail.mit.edu/People/RRS
+..........
 
 ]]></programlisting>
 </sect4>
-</sect3>
-<sect3 id="rdfsparul"><title>SPARUL -- an Update Language For RDF Graphs</title>
-     <sect4 id="rdfsparulintro"><title>Introduction</title>
-       <para>Starting with version 5.0, Virtuoso supports the
-<ulink url="http://jena.hpl.hp.com/~afs/SPARQL-Update.html">SPARQL/Update</ulink> extension to SPARQL.
-This is sufficient for most of routine data manipulation operations. If the <emphasis>SPARQL_UPDATE</emphasis>
-role is granted to user <emphasis>SPARQL</emphasis> user then data manipulation statements may be
-executed via the SPARQL web service endpoint as well as by data querying.
+<sect4 id="rdfapidataimportttlphash"><title>Using RDF_TTL2HASH</title>
+<para>The DB.DBA.RDF_TTL2HASH() does not load TTL content, instead it returns a dictionary of triples in 'long valmode'.</para>
+<programlisting>
+create function DB.DBA.RDF_TTL2HASH (
+    in strg any,
+    in base varchar,
+    in graph varchar ) returns any
+</programlisting>
+<para>Parameter <emphasis>flags</emphasis> is useful when the syntax of the resource is TURTLE-like, but not correct TURTLE.
+By default, use zero value.
+Add 1 to let string literals contain end-of-line characters.
+Add 2 to suppress error messages on blank node verbs.
+Add 4 to allow variables instead of blank nodes.
+Add 8 to silently skip triples with literal subjects.
        </para>
      </sect4>
-     <sect4 id="rdfsparulfunc"><title>Manage RDF Storage</title>
-       <para>Two functions allow the user to alter RDF storage by inserting or deleting all
-triples listed in some vector. Both functions receive the IRI of the graph that should be altered and
-a vector of triples that should be added or removed. The graph IRI can be either an IRI ID or a string.
-The third optional argument controls the transactional behavior - the parameter value is
-passed to the <link linkend="fn_log_enable"><function>log_enable</function></link> function.
-The return values of these functions are not defined and should not be used by applications.
-       </para>
+<sect4 id="rdfapidataimportloadrdfxml"><title>Using RDF_LOAD_RDFXML</title>
+<para>The DB.DBA.RDF_LOAD_RDFXML() procedure parses RDF/XML and places its triples into DB.DBA.RDF_QUAD.</para>
        <programlisting>
-create function DB.DBA.RDF_INSERT_TRIPLES (in graph_iri any, in triples any, in log_mode integer := null)
-create function DB.DBA.RDF_DELETE_TRIPLES (in graph_iri any, in triples any, in log_mode integer := null)
+create procedure DB.DBA.RDF_LOAD_RDFXML (
+    in strg any,           -- text of and XML document
+    in base_iri varchar,   -- base IRI to resolve relative IRIs
+    in graph_iri varchar ) -- the IRI of destination graph
        </programlisting>
-       <para>Simple operations may be faster if written as low-level SQL code instead of using SPARUL.
-The use of SPARQL DELETE is unnecessary in cases where the better alternative is for the application to delete from RDF_QUAD
-using simple SQL filters like:
-       </para>
+<para>See <link linkend="rdfsparqlrulespecifywhatindexexample">example</link></para>.
+</sect4>
+<sect4 id="rdfapidataimportloadrdfuri"><title>Using RDF_QUAD_URI, RDF_QUAD_URI_L and RDF_QUAD_URI_L_TYPED</title>
+<para>To insert a single quad into DB.DBA.RDF_QUAD() table, use one of these procedures:</para>
        <programlisting>
-DELETE FROM DB.DBA.RDF_QUAD
-WHERE G = DB.DBA.RDF_MAKE_IID_OF_QNAME (
-    'http://local.virt/DAV/sparql_demo/data/data-xml/source-simple2/source-data-01.rdf' );
+-- Simple insertion of a quad where the object is a node
+create procedure DB.DBA.RDF_QUAD_URI (
+  in g_uri varchar, in s_uri varchar, in p_uri varchar,
+  in o_uri varchar ) -- IRI string or IRI_ID
+
+-- Simple insertion of a quad where the object is a literal value in 'SQL valmode'
+create procedure DB.DBA.RDF_QUAD_URI_L (
+  in g_uri varchar, in s_uri varchar, in p_uri varchar,
+  in o_lit any ) -- string, number or datetime, NULL is not allowed
+
+create procedure DB.DBA.RDF_QUAD_URI_L_TYPED (
+  in g_uri varchar, in s_uri varchar, in p_uri varchar,
+  in o_lit any,     -- string value of the literal
+  in dt any,        -- datatype as IRI string or IRI_ID, can be NULL
+  in lang varchar ) -- language as string or NULL
        </programlisting>
-       <para>On the other hand, simple filters does not work when the search criteria refer to triples
-that are affected by the modification. Consider a function that deletes all triples whose subjects
-are nodes of type 'http://xmlns.com/foaf/0.1/Person'. Type information is stored in triples that
-will be deleted, so the simplest function is something like this:
+</sect4>
+<para>Arguments g_uri, s_uri and p_uri of these three functions should be IRI strings or IRI_IDs.
+All string arguments should be in UTF-8 encoding, otherwise they will be stored but are not queryable via SPARQL.</para>
+</sect3>
+<sect3 id="rdfapidataexport"><title>Data Export</title>
+<para>These two procedures serialize a vector of triples into a session, in TURTLE or RDF/XML syntax.
+In their current versions, every triple is printed in a separate top-level record (say, in an rdf:Description tag), without any pretty-printing or nesting optimization.
        </para>
-<programlisting><![CDATA[
-create procedure DELETE_PERSONAL_DATA (in foaf_graph varchar)
-{
-  declare pdata_dict, pdata_array any;
--- Step 1: select everything that should be deleted
-  pdata_dict := ((
-      sparql construct { ?s ?p ?o }
-      WHERE { graph ?:foaf_graph {
-              ?s ?p ?o . ?s rdf:type <http://xmlns.com/foaf/0.1/Person>
-            } }
-      ));
--- Step 2: delete all found triples
-  pdata_array := dict_list_keys (pdata_dict, 1);
-  RDF_DELETE_TRIPLES (foaf_graph, pdata_array);
-};
+<programlisting>
+create procedure DB.DBA.RDF_TRIPLES_TO_TTL (
+    inout triples any, -- vector of triples in 'long valmode'.
+    inout ses any )    -- an output stream in server default encoding
 
-DELETE_PERSONAL_DATA (
-  'http://local.virt/DAV/sparql_demo/data/data-xml/source-simple2/source-data-01.rdf' );
+create procedure DB.DBA.RDF_TRIPLES_TO_RDF_XML_TEXT (
+    inout triples any,          -- vector of triples in 'long valmode'.
+    in print_top_level integer, -- zero if only rdf:Description tags should be written,
+                                -- non-zero if the rdf:RDF top-level element should also be written
+    inout ses any )             -- an output stream in server default encoding
+</programlisting>
+</sect3>
+<sect3 id="rdfapidataquery"><title>Data query</title>
+<programlisting>
+-- Local execution of SPARQL via SPARQL protocol, produces a result set of SQL values.
+create procedure DB.DBA.SPARQL_EVAL (
+    in query varchar,      -- text of SPARQL query to execute
+    in dflt_graph varchar, -- default graph IRI, if not NULL then this overrides what's specified in query
+    in maxrows integer )   -- limit on numbers of rows that should be returned.
+
+-- Similar to SPARQL_EVAL, but returns a vector of vectors of SQL values.
+create function DB.DBA.SPARQL_EVAL_TO_ARRAY (
+    in query varchar,      -- text of SPARQL query to execute
+    in dflt_graph varchar, -- default graph IRI, if not NULL then this overrides what's specified in query
+    in maxrows integer )   -- limit on numbers of rows that should be returned.
+returns any
+</programlisting>
+<programlisting>
+-- Remote execution of SPARQL via SPARQL protocol, produces a result set of SQL values.
+create procedure DB.DBA.SPARQL_REXEC (
+    in service varchar,    -- service URI to call via HTTP
+    in query varchar,      -- text of SPARQL query to execute
+    in dflt_graph varchar, -- default graph IRI, if not NULL then this overrides what's specified in query
+    in named_graphs any,   -- vector of named graph IRIs, if not NULL then this overrides what's specified in query
+    in req_hdr any,        -- additional HTTP header lines that should be passed to the service; 'Host: ...' is most popular.
+    in maxrows integer,    -- limit on numbers of rows that should be returned.
+    in bnode_dict any )    -- dictionary of bnode ID references.
+
+-- Similar to SPARQL_REXEC (), but returns a vector of vectors of SQL values.
+-- All arguments are the same.
+create function DB.DBA.SPARQL_REXEC_TO_ARRAY (
+    in service varchar, in query varchar, in dflt_graph varchar, in named_graphs any,
+    in req_hdr any, in maxrows integer, in bnode_dict any)
+returns any
+
+-- Similar to SPARQL_REXEC (), but fills in output parameters with metadata (like exec metadata) and a vector of vector
+s of 'long valmode' values.
+-- First seven arguments are the same.
+create procedure DB.DBA.SPARQL_REXEC_WITH_META (
+    in service varchar, in query varchar, in dflt_graph varchar, in named_graphs any,
+    in req_hdr any, in maxrows integer, in bnode_dict any,
+    out metadata any,  -- metadata like exec () returns.
+    out resultset any) -- results as 'long valmode' value.
+</programlisting>
+<para>If the query is a CONSTRUCT or DESCRIBE then the result set consists of a single row and column, the value inside is a dictionary of triples in 'long valmode'.</para>
+</sect3>
+</sect2>
+<sect2 id="rdfinternalfunctions"><title>Useful Internal Functions</title>
+<sect3 id="rdfinternalconversion"><title>Conversion Functions for XMLSchema/RDF Data Serialization Syntax</title>
+<para>These functions emulate constructor functions from XQuery Core Function Library.</para>
+<programlisting>
+create function DB.DBA."http://www.w3.org/2001/XMLSchema#boolean" (in strg any) returns integer
+create function DB.DBA."http://www.w3.org/2001/XMLSchema#dateTime" (in strg any) returns datetime
+create function DB.DBA."http://www.w3.org/2001/XMLSchema#double" (in strg varchar) returns double precision
+create function DB.DBA."http://www.w3.org/2001/XMLSchema#float" (in strg varchar) returns float
+create function DB.DBA."http://www.w3.org/2001/XMLSchema#integer" (in strg varchar) returns integer
+</programlisting>
+</sect3>
+<sect3 id="rdfinternalpredicates"><title>RDF-specific Predicates</title>
+<programlisting>
+-- Returns 1 if string s matches pattern p, 0 otherwise
+create function DB.DBA.RDF_REGEX (
+    in s varchar,            -- source string to check
+    in p varchar,            -- regular expression pattern string
+    in coll varchar := null) -- unused for now (modes are not yet implemented)
+
+-- Returns 1 if language identifier r matches lang pattern t
+create function DB.DBA.RDF_LANGMATCHES (
+  in r varchar, -- language identifies (string or NULL)
+  in t varchar) -- language pattern (exact name, first two letters or '*')
+</programlisting>
+</sect3>
+</sect2>
+<sect2 id="rdfdefaultgraph"><title>Default and Named Graphs</title>
+<para>Sometimes the default graph IRI is not known when the SPARQL query is composed. It can be added at the very last moment by providing the IRI in a 'define' clause as follows:</para>
+<programlisting><![CDATA[
+define input:default-graph-uri <http://example.com&gt
 ]]></programlisting>
-       <para>From Virtuoso 5.0 onwards, applications can use SPARUL to do the same in a more convenient way:
-       </para>
+<para>Such a definition overrides the default graph URI set in query by the 'FROM ...' clause (if any).</para>
+<para>The query may contain more than one <emphasis>define input:default-graph-uri</emphasis>.
+The set of values of <emphasis>input:default-graph-uri</emphasis> has the highest possible priority and cannot be redefined in the rest of the text of the query by FROM clauses.</para>
+<para>FROM NAMED clauses can be used multiple times in one query:</para>
 <programlisting><![CDATA[
-create procedure DELETE_PERSONAL_DATA (in foaf_graph varchar)
-{
-  sparql delete { ?s ?p ?o }
-      WHERE { graph ?:foaf_graph {
-              ?s ?p ?o . ?s rdf:type <http://xmlns.com/foaf/0.1/Person>
-            } }
-};
+SPARQL
+  SELECT ?id
+  FROM NAMED <http://example.com/user1.ttl>
+  OPTION (get:soft "soft", get:method "GET")
+  FROM NAMED <http://example.com/user2.ttl>
+  OPTION (get:soft "soft", get:method "GET")
+  WHERE { GRAPH ?g { ?id a ?o } }
 ]]></programlisting>
-     </sect4>
-     <sect4 id="rdfsparulexamples"><title>Examples</title>
-     <sect5 id="rdfsparulexamples1"><title>Example for changing the graph</title>
-       <para>The graph to be changed may be specified by an option preceding of query, instead
-of being specified in the 'insert into graph' clause.
+<para>Similarly, <emphasis>define input:named-graph-uri <http://example.com></emphasis> is a replacement for a FROM NAMED clause</para>
+<para>
+When Virtuoso receives a SPARQL request via HTTP, the value of the default graph can be set in the protocol using a <emphasis>default-graph-uri</emphasis> HTTP parameter.
+Multiple occurrences of this parameter are allowed. This HTTP parameter is converted into <emphasis>define input:default-graph-uri</emphasis>.
+There's similar support for <emphasis>named-graph-uri</emphasis> HTTP parameter.
+For debugging purposes, graph names set in the protocol are sent back in the reply header as <emphasis>X-SPARQL-default-graph: ...</emphasis> and <emphasis>X-SPARQL-named-graph: ...</emphasis> header lines, one line per graph.
        </para>
-<programlisting><![CDATA[
-SQL>SPARQL DEFINE input:default-graph-uri <http://mygraph.com>
-INSERT INTO <http://mygraph.com> { <http://myopenlink.net/dataspace/Kingsley#this> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User> };
-callret-0
-VARCHAR
-_______________________________________________________________________________
+<para>
+A web service endpoint may provide different default configurations for different host names mentioned in HTTP requests.
+This facility is configured via table <emphasis>DB.DBA.SYS_SPARQL_HOST</emphasis>.
+</para>
+<programlisting>
+create table DB.DBA.SYS_SPARQL_HOST (
+  SH_HOST	varchar not null primary key, -- host mask
+  SH_GRAPH_URI	varchar,      -- 'default default' graph uri
+  SH_USER_URI	varchar,      -- reserved for any use in applications
+  SH_DEFINES	long varchar  -- additional defines for requests
+)
+</programlisting>
+<para>
+When the SPARQL web service endpoint receives a request it checks the <emphasis>Host</emphasis> HTTP header line.
+This line contains zero or more target host names, delimited by commas.
+For every host name in the line, the service scans the <emphasis>DB.DBA.SYS_SPARQL_HOST</emphasis> table in search of a row containing a matching host name in <emphasis>SH_HOST</emphasis>.
+The <emphasis>SH_HOST</emphasis> field acts as 'pattern' argument for the SQL string operator LIKE. If a matching row is found, the text of SPARQL request is extended.
+If a default graph is not explicitly set by the HTTP parameters and <emphasis>SH_GRAPH_URI</emphasis> is not null then the default graph is set to <emphasis>SH_GRAPH_URI</emphasis>.
+If <emphasis>SH_DEFINES</emphasis> is not null then it is added in front of the query; so this field is a good place for the text for any <emphasis>define</emphasis> options.
+</para>
+<para>SH_USER_URI is for arbitrary user data and can be used in any way by the
+application that is "responsible" for the declared host.</para>
+<para>
+The search of <emphasis>DB.DBA.SYS_SPARQL_HOST</emphasis> stops at the first found row, other possible matches are silently ignored.
+</para>
+</sect2>
 
-Insert into <http://mygraph.com>, 1 triples -- done
+<sect2 id="rdfsqlfromsparql"><title>Calling SQL from SPARQL</title>
+<para>A SPARQL expression can contain calls to Virtuoso/PL functions and built-in SQL functions in both the WHERE clause and in the
+result set. Two namespace prefixes, <emphasis>bif</emphasis> and <emphasis>sql</emphasis> are reserved for
+these purposes. When a function name starts with the <emphasis>bif:</emphasis> namespace
+prefix, the rest of the name is treated as the name of a SQL BIF (Built-In
+Function). When a function name starts with the <emphasis>sql:</emphasis> namespace prefix,
+the rest of the name is treated as the name of a Virtuoso/PL function owned by
+DBA with database qualifier DB, e.g. <emphasis>sql:example(...)</emphasis> is
+converted into <emphasis>DB.DBA."example"(...)</emphasis>.</para>
 
-1 Rows. -- 20 msec.
-]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples2"><title>Example for delete graph equivalents</title>
-       <para>The following two statements are equivalent but the latter may work faster, especially
-if there are many RDF views in the system or if the graph in question contains triples from RDF views. 
-Note that neither of these two statements affects data coming from RDF views.
-       </para>
+<para>In both cases,
+the function receives arguments in SQL format ('SQL valmode') and
+also returns the result in SQL format. The SPARQL compiler will
+automatically add code for format conversion into the resulting SQL
+code so SQL functions can be used even if <emphasis>define output:valmode
+'LONG'</emphasis> forces the use of RDF representation in the
+result set.</para>
+<sect3 id="rdfsqlfromsparqlex1"><title>Example with sql: namespace prefix</title>
 <programlisting><![CDATA[
-SQL> SPARQL DELETE FROM GRAPH <http://mygraph.com> { ?s ?p ?o } FROM <http://mygraph> WHERE { ?s ?p ?o };
-callret-0
-VARCHAR
-_______________________________________________________________________________
-
-Delete from <http://mygraph.com>, 1 triples -- done
+SQL>create procedure DB.DBA.ComposeInfo (
+  in pname varchar,
+  in pnick varchar := '',
+  in pbox  varchar := '')
+{
+   declare ss varchar;
+   ss := concat(pname, ' ', pnick, ' ', pbox);
+   ss := rtrim (ss, ' ');
+   return ss;
 
-1 Rows. -- 10 msec.
+};
+Done. -- 0 msec.
 
-SQL> SPARQL CLEAR GRAPH <http://mygraph.com>;
+SQL>SPARQL
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+SELECT (sql:ComposeInfo (?name, ?nick, ?box))
+FROM <http://www.w3.org/People/Berners-Lee/card>
+WHERE
+  {
+    ?s rdf:type foaf:Person .
+    optional{?s foaf:name ?name }.
+    optional{?s foaf:nick ?nick }.
+    optional{?s foaf:box ?box }.
+    filter (?nick like '%TimBL%') .
+  };
 callret-0
 VARCHAR
-__________________________________________________________
+_______________________________________________________________________________
 
-Clear <http://mygraph.com> -- done
+Timothy Berners-Lee TimBL
 
-1 Rows. -- 10 msec.
+1 Rows. -- 30 msec.
 ]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples3"><title>Example for deleting all triples for given subject</title>
-<para>The following statement deletes all records with <http://myopenlink.net/dataspace/Kingsley#this> as the subject:</para>
+    <tip><title>See Also:</title>
+      <itemizedlist mark="bullet">
+        <listitem><link linkend="rdfsparqlgeospatexmp11">Example "Things around highly populated places"</link></listitem>
+        <listitem><link linkend="virtuosospongerfacent">Virtuoso Facets Web Service Examples</link></listitem>
+        <listitem><link linkend="VirtFacetUsage6">Virtuoso Facets Usage Statistics Examples</link></listitem>
+      </itemizedlist>
+    </tip>
+  </sect3>
+  <sect3 id="rdfsqlfromsparqlex1"><title>Example with sql: namespace prefix and bif:contains</title>
 <programlisting><![CDATA[
 SQL>SPARQL
-DELETE FROM GRAPH <http://mygraph.com> { ?s ?p ?o }
-FROM <http://mygraph.com>
-WHERE { ?s ?p ?o . filter ( ?s = <http://myopenlink.net/dataspace/Kingsley#this>) };
-callret-0
-VARCHAR
-_______________________________________________________________________________
+SELECT DISTINCT ?cityUri ?cityName (sql:BEST_LANGMATCH (?cityName, 'en, en-gb;q=0.8, fr;q=0.7, *;q=0.1', '')) as ?bestCityName
+WHERE
+  {
+    ?cityUri ?predicate ?value.
+    ?cityUri a <http://dbpedia.org/ontology/City>.
+    ?value bif:contains "London".
+    OPTIONAL
+      {
+        ?cityUri rdfs:label ?cityName
+      }
+  };
 
-Delete from <http://mygraph.com>, 1 triples -- done
+cityUri                                              cityName                      bestCityName
+ANY                                                  ANY 	                         ANY
+______________________________________________________________________________________________________________
+http://dbpedia.org/resource/Anerley	                 Anerley	                     Anerley
+http://dbpedia.org/resource/Felixstowe	             Felixstowe	                   Felixstowe
+http://dbpedia.org/resource/Chesham	                 Chesham	                     Chesham
+http://dbpedia.org/resource/Stratford%2C_London	     Stratford, London	           Stratford, London
+http://dbpedia.org/resource/Ashford%2C_Surrey	       Ashford (Surrey)	 A           shford (Surrey)
+http://dbpedia.org/resource/Newmarket%2C_Suffolk	   Newmarket (Suffolk)	         Newmarket (Suffolk)
+http://dbpedia.org/resource/North_Rhine-Westphalia	 Renania d'o Norte-Westfalia	 Renania d'o Norte-Westfalia
+http://dbpedia.org/resource/West_Bromwich	           West Bromwich	               West Bromwich
+....
 
-1 Rows. -- 10 msec.
 ]]></programlisting>
-<para>Alternatively, the statement can be written in this way:</para>
+  </sect3>
+  <sect3 id="rdfsqlfromsparqlex2"><title>Example with bif: namespace prefix</title>
 <programlisting><![CDATA[
 SQL>SPARQL
-DELETE FROM GRAPH <http://mygraph.com> { <http://myopenlink.net/dataspace/Kingsley#this> ?p ?o }
-FROM <http://mygraph.com>
-WHERE { <http://myopenlink.net/dataspace/Kingsley#this> ?p ?o };
-callret-0
-VARCHAR
+SELECT *
+FROM <http://www.w3.org/people#>
+WHERE { ?s ?p ?o . ?o bif:contains '"Timo*"'};
+s                                               p                                     o
+VARCHAR                                         VARCHAR                               VARCHAR
 _______________________________________________________________________________
 
-Delete from <http://mygraph.com>, 1 triples -- done
+ http://www.w3.org/People/Berners-Lee/card#i	http://xmlns.com/foaf/0.1/name	      Timothy Berners-Lee
+ http://www.w3.org/People/Berners-Lee/card#i	http://xmlns.com/foaf/0.1/givenname   Timothy
+
+2 Rows. -- 2 msec.
 
-1 Rows. -- 10 msec.
 ]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples4"><title>Example for INSERT statements equivalent</title>
-       <para>Keywords 'insert in' and 'insert into' are interchangeable in Virtuoso for backward
-compatibility, but the SPARUL specification lists only 'insert into'. For example,
-the statements below are equivalent:
+    <tip><title>See Also:</title>
+      <itemizedlist mark="bullet">
+        <listitem><link linkend="rdfpredicatessparqlexamples">Example filtering RDF objects triples by a given predicate</link></listitem>
+        <listitem><link linkend="rdfsparqlendpointexamples6">Example with extraction part of literal as variable</link></listitem>
+        <listitem><link linkend="rdfsparulexamples5">Example for various expressions usage</link></listitem>
+        <listitem><link linkend="rdfsparulexamples8">Example for generating RDF information resource URI</link></listitem>
+      </itemizedlist>
+    </tip>
+  </sect3>
+</sect2>
+<sect2 id="rdfsqlfromsparqldescribe"><title>SPARQL DESCRIBE</title>
+  <para>The SPARQL specification does not define the precise output of DESCRIBE, so different
+applications may need different results for the same subject. Some
+applications need quick generation of short and incomplete results
+whereas others may need detailed reports composed from multiple sources.
+  </para>
+  <para>If define <emphasis>sql:describe-mode "xxx"</emphasis> is specified then the generated SQL
+code will use the procedures named:
        </para>
 <programlisting><![CDATA[
-SQL>SPARQL INSERT INTO GRAPH <http://mygraph.com> {  <http://myopenlink.net/dataspace/Kingsley#this>
-                                            <http://rdfs.org/sioc/ns#id>
-                                            <Kingsley> };
-callret-0
-VARCHAR
-______________________________________________________________________________
-
-Insert into <http://mygraph.com>, 1 triples -- done
+DB.DBA.SPARQL_DESC_DICT_xxx (in subj_dict any, in consts any, in graphs
+any, in storage_name any, in options any)
+]]></programlisting>
+  <para>and
+  </para>
+<programlisting><![CDATA[
+DB.DBA.SPARQL_DESC_DICT_xxx_PHYSICAL (in subj_dict any, in consts any,
+in graphs any, in storage_name any, in options any)
+]]></programlisting>
+  <para>In a new blank database, only two such pairs of procedures are created.
+Procedures <emphasis>DB.DBA.SPARQL_DESC_DICT_SPO</emphasis> and <emphasis>DB.DBA.SPARQL_DESC_DICT_SPO_PHYSICAL</emphasis>
+are for <emphasis>sql:describe-mode "SPO"</emphasis>. This pair of procedures
+searches for all triples where the input IRIs are used as subjects; they are faster than the default
+routine which searches for all triples where the input IRIs are used as subjects or objects.
+Similarly, <emphasis>DB.DBA.SPARQL_DESC_DICT_CBD</emphasis> and <emphasis>DB.DBA.SPARQL_DESC_DICT_CBD_PHYSICAL</emphasis>
+are for <emphasis>sql:describe-mode "CBD"</emphasis>. CBD stands for Concise Bounded Description, Nokia-style.
+  </para>
+  <para><emphasis>Example:</emphasis></para>
+<programlisting><![CDATA[
+SQL>SPARQL
+DEFINE sql:describe-mode "CBD"
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+DESCRIBE ?friend
+WHERE
+  {
+    ?s foaf:knows ?friend  .
+    ?friend foaf:nick ?nick.
+    filter (?s=<http://www.advogato.org/person/rmorgan/foaf.rdf#me>)
+}
+;
 
-1 Rows. -- 0 msec.
-SQL>SPARQL INSERT INTO GRAPH <http://mygraph.com> {  <http://myopenlink.net/dataspace/Caroline#this>
-                                            <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
-                                            <http://rdfs.org/sioc/ns#User> };
-callret-0
-VARCHAR
-_______________________________________________________________________________
+ at prefix rdf:	<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ at prefix ns1:	<http://www.advogato.org/person/chrisd/foaf.rdf#> .
+ at prefix foaf:	<http://xmlns.com/foaf/0.1/> .
+ns1:me	rdf:type	foaf:Person .
+ at prefix rdfs:	<http://www.w3.org/2000/01/rdf-schema#> .
+ns1:me	rdfs:seeAlso	<http://www.advogato.org/person/chrisd/foaf.rdf> ;
+	foaf:name	"Chris DiBona" ;
+	foaf:nick	"chrisd" ;
+	foaf:homepage	<http://www.dibona.com> ;
+	foaf:mbox_sha1sum	"e8231d19ac0d11ccbdc565485054461e5d71f0d3" .
+ at prefix ns4:	<http://www.advogato.org/person/schoen/foaf.rdf#> .
+ns1:me	foaf:knows	ns4:me .
+ at prefix ns5:	<http://www.advogato.org/person/jpick/foaf.rdf#> .
+ns1:me	foaf:knows	ns5:me .
+ at prefix ns6:	<http://www.advogato.org/person/benson/foaf.rdf#> .
+ns1:me	foaf:knows	ns6:me .
+ at prefix ns7:	<http://www.advogato.org/person/conrad/foaf.rdf#> .
+ns1:me	foaf:knows	ns7:me .
+ at prefix ns8:	<http://www.advogato.org/person/starshine/foaf.rdf#> .
+ns1:me	foaf:knows	ns8:me .
+ at prefix ns9:	<http://www.advogato.org/person/chip/foaf.rdf#> .
+ns1:me	foaf:knows	ns9:me .
+ at prefix ns10:	<http://www.advogato.org/person/crackmonkey/foaf.rdf#> .
+.....
 
-Insert into <http://mygraph.com>, 1 triples -- done
 
-1 Rows. -- 0 msec.
 
--- and
 
-SQL>SPARQL INSERT IN GRAPH <http://mygraph.com> {  <http://myopenlink.net/dataspace/Kingsley#this>
-                                            <http://rdfs.org/sioc/ns#id>
-                                            <Kingsley> };
-callret-0
-VARCHAR
-_______________________________________________________________________________
+]]></programlisting>
+  <para>In each pair, both procedures have the same semantics but the second one is used if and
+only if the SPARQL compiler can prove that all subjects to process are
+from physical storage <emphasis>(DB.DBA.RDF_QUAD)</emphasis>. Thus the second procedure
+will not search for subjects in RDF Views.
+  </para>
+  <para>Each procedure should return a dictionary with triples as keys and
+integer 1 as values. So the dictionary is filled by calls like:
+  </para>
+<programlisting><![CDATA[
+dict_put (resulting_dict,
+          vector (subj_iri_id, pred_iri_id, obj_iri_id_or_rdf_box),
+          1);
+]]></programlisting>
+  <para>Procedure arguments are as follows:
+  </para>
+  <itemizedlist mark="bullet">
+     <listitem><emphasis>subj_dict</emphasis> - a dictionary whose keys are IRI IDs and maybe values of
+other types, esp. RDF boxes. Keys are subjects to be described, so
+values other than IRI IDs should usually be ignored. Values should be
+ignored.</listitem>
+     <listitem><emphasis>consts</emphasis> - a vector of IRI IDs and values of other types. The items contained in the vector
+are subjects to be described, as with the keys of subj_dict.</listitem>
+     <listitem><emphasis>graphs</emphasis> - a vector of IRI IDs of graphs that can be used for DESCRIBE. The
+vector may contain garbage, like in the two previous cases. A NULL can be
+passed instead of a vector indicating that the source graphs are not specified
+in the source query.</listitem>
+     <listitem><emphasis>storage_name</emphasis> -  the value of "define input:storage" from the original
+SPARQL query, NULL if missing.</listitem>
+     <listitem><emphasis>options</emphasis> - reserved for future use and can be ignored.</listitem>
+   </itemizedlist>
+  <para>One should grant execute permission on both procedures to SPARQL_SELECT before referring to them in SPARQL.</para>
+  <para><emphasis>Example:</emphasis></para>
+<programlisting><![CDATA[
+SQL>set blobs on;
+SQL>SPARQL
+define sql:describe-mode "SPO"
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX sioct: <http://rdfs.org/sioc/types#>
 
-Insert into <http://mygraph.com>, 1 triples -- done
+DESCRIBE ?forum
+FROM <http://demo.openlinksw.com/dataspace>
+WHERE {
+  ?forum rdf:type sioct:Weblog .
+}
+LIMIT 1;
 
-1 Rows. -- 10 msec.
-SQL>SPARQL INSERT IN GRAPH <http://mygraph.com> {  <http://myopenlink.net/dataspace/Caroline#this>
-                                            <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
-                                            <http://rdfs.org/sioc/ns#User> };
 callret-0
-VARCHAR
-________________________________________________________________________
-
-Insert into <http://mygraph.com>, 1 triples -- done
+LONG VARCHAR
+_______________________________________________________________________________
 
-1 Rows. -- 0 msec.
+<http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/types#Weblog> ,
+                <http://atomowl.org/ontologies/atomrdf#Feed> ;
+        <http://rdfs.org/sioc/ns#description> "XML templates demo's Weblog" ;
+        <http://rdfs.org/sioc/ns#has_space> <http://demo.openlinksw.com/dataspace/bloguser/space#this> ;
+        <http://rdfs.org/sioc/ns#container_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/20> ,
+                <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/21> ;
+        <http://rdfs.org/sioc/ns#id> "bloguser_blog" ;
+        <http://xmlns.com/foaf/0.1/maker> <http://demo.openlinksw.com/dataspace/person/bloguser#this> ;
+        <http://rdfs.org/sioc/ns#link> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> ;
+        <http://atomowl.org/ontologies/atomrdf#entry> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/20> ,
+                <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/21> ;
+        <http://atomowl.org/ontologies/atomrdf#contains> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/21> ,
+                <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/20> ;
+        <http://atomowl.org/ontologies/atomrdf#title> "bloguser_blog" ;
+        <http://www.w3.org/2000/01/rdf-schema#label> "XML templates demo's Weblog" ;
+        <http://rdfs.org/sioc/ns#scope_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog#owner> ;
+        <http://rdfs.org/sioc/ns#has_owner> <http://demo.openlinksw.com/dataspace/bloguser#this> ;
+        <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/sioc.rdf> ;
+        <http://purl.org/dc/elements/1.1/identifier> "62"^^<http://www.w3.org/2001/XMLSchema#integer> ;
+        <http://rdfs.org/sioc/services#has_service> <http://demo.openlinksw.com/RPC2> ,
+                <http://demo.openlinksw.com/mt-tb> ,
+                <http://demo.openlinksw.com/Atom/bloguser-blog-0> ,
+                <http://demo.openlinksw.com/GData/bloguser-blog-0> .
+<http://demo.openlinksw.com/RPC2> <http://rdfs.org/sioc/services#service_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
+<http://demo.openlinksw.com/mt-tb> <http://rdfs.org/sioc/services#service_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
+<http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog#owner> <http://rdfs.org/sioc/ns#has_scope> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
+<http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/20> <http://rdfs.org/sioc/ns#has_container> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> ;
+        <http://atomowl.org/ontologies/atomrdf#source> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
+<http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/21> <http://rdfs.org/sioc/ns#has_container> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> ;
+        <http://atomowl.org/ontologies/atomrdf#source> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
+<http://demo.openlinksw.com/dataspace/bloguser#this> <http://rdfs.org/sioc/ns#owner_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
+<http://demo.openlinksw.com/dataspace/bloguser/space#this> <http://rdfs.org/sioc/ns#space_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
+<http://demo.openlinksw.com/dataspace/person/bloguser#this> <http://xmlns.com/foaf/0.1/made> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
+<http://demo.openlinksw.com/Atom/bloguser-blog-0> <http://rdfs.org/sioc/services#service_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
+<http://demo.openlinksw.com/GData/bloguser-blog-0> <http://rdfs.org/sioc/services#service_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
 
-]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples5"><title>Example for various expressions usage</title>
-       <para>It is possible to use various expressions to calculate fields of new triples. This is
- very convenient, even if not a part of the original specification.
-       </para>
-<programlisting><![CDATA[
-SQL>SPARQL INSERT INTO GRAPH <http://mygraph.com> { ?s <http://rdfs.org/sioc/ns#id> `iri (bif:concat (str (?o), "Idehen"))` }
-WHERE { ?s <http://rdfs.org/sioc/ns#id> ?o };
-callret-0
-VARCHAR
-_______________________________________________________________________________
 
-Insert into <http://mygraph.com>, 4 triples -- done
+1 Rows. -- 240 msec.
 
-1 Rows. -- 0 msec.
-]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples6"><title>Example for operator IN usage</title>
-<para>The example shows how to find which predicate/object pairs the following
-subjects have in common and count the occurances:</para>
-<programlisting><![CDATA[
-http://dbpedia.org/resource/Climate_change
-http://dbpedia.org/resource/Disaster_risk_reduction
-http://dbpedia.org/resource/Tanzania
-http://dbpedia.org/resource/Capacity_building
-http://dbpedia.org/resource/Poverty
-http://dbpedia.org/resource/Construction
-http://dbpedia.org/resource/Vulnerability
-http://dbpedia.org/resource/Mount_Kilimanjaro
-http://dbpedia.org/resource/Social_vulnerability
 ]]></programlisting>
-<para>The following query returns the desired results:</para>
-<programlisting><![CDATA[
+</sect2>
+<sect2 id="rdfsparqlimplementatiotrans"><title>Transitivity in SPARQL</title>
+  <para>Virtuoso SPARQL allows access to Virtuoso's SQL transitivity extension. Read the
+<link linkend="transitivityinsQL">SQL section</link> for a definition of the options.</para>
+  <para>The SPARQL syntax is slightly different from the SQL, although the option names
+and meanings are the same.</para>
+  <para>In SPARQL, the transitive options occur after a subquery enclosed in braces:</para>
+  <para>The below produces all the IRI's that are the same as <alice>.</para>
+  <programlisting><![CDATA[
 SPARQL
-SELECT ?s1 ?s2 COUNT (1)
-WHERE
+SELECT ?syn
+where
   {
-    ?s1 ?p ?o .
-    FILTER (?s1 IN (<http://dbpedia.org/resource/Climate_change>,
-    <http://dbpedia.org/resource/Disaster_risk_reduction>,
-    <http://dbpedia.org/resource/Tanzania>,
-    <http://dbpedia.org/resource/Capacity_building>,
-    <http://dbpedia.org/resource/Poverty>,
-    <http://dbpedia.org/resource/Construction>,
-    <http://dbpedia.org/resource/Vulnerability>,
-    <http://dbpedia.org/resource/Mount_Kilimanjaro>,
-    <http://dbpedia.org/resource/Social_vulnerability> ))
-    ?s2 ?p ?o .
-    FILTER (?s2 IN (<http://dbpedia.org/resource/Climate_change>,
-    <http://dbpedia.org/resource/Disaster_risk_reduction>,
-    <http://dbpedia.org/resource/Tanzania>,
-    <http://dbpedia.org/resource/Capacity_building>,
-    <http://dbpedia.org/resource/Poverty>,
-    <http://dbpedia.org/resource/Construction>,
-    <http://dbpedia.org/resource/Vulnerability>,
-    <http://dbpedia.org/resource/Mount_Kilimanjaro>,
-    <http://dbpedia.org/resource/Social_vulnerability> ))
-    FILTER (?s1 != ?s2)
-    FILTER (str(?s1) < str (?s2))
+    {
+      SELECT ?x ?syn
+      where
+        {
+          { ?x owl:sameAs ?syn } union { ?syn owl:sameAs ?x }
+        }
+    }
+    option ( transitive, t_in (?x), t_out (?syn), t_distinct, t_min (0) )
+    filter (?x = <Alice>) .
   }
-LIMIT 20
-]]></programlisting>
-<para>The result of executing the query:</para>
-<programlisting><![CDATA[
-s1  	                                         s2  	                                              callret-2
-http://dbpedia.org/resource/Climate_change 	 http://dbpedia.org/resource/Tanzania 	              2
-http://dbpedia.org/resource/Social_vulnerability http://dbpedia.org/resource/Vulnerability 	      1
-http://dbpedia.org/resource/Mount_Kilimanjaro 	 http://dbpedia.org/resource/Poverty 	              1
-http://dbpedia.org/resource/Mount_Kilimanjaro 	 http://dbpedia.org/resource/Tanzania 	              3
-http://dbpedia.org/resource/Capacity_building 	 http://dbpedia.org/resource/Disaster_risk_reduction  1
-http://dbpedia.org/resource/Poverty 	         http://dbpedia.org/resource/Tanzania 	              1
-]]></programlisting>
-<para>You can also find live demo query results <ulink url="http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&should-sponge=&query=SELECT+%0D%0A%3Fs1+%3Fs2+count+%281%29+where+{%0D%0A%3Fs1+%3Fp+%3Fo+.%0D%0Afilter+%28%3Fs1+in+%28%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FClimate_change%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FDisaster_risk_reduction%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FTanzania%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FCapacity_building%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FPoverty%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FConstruction%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FVulnerability%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FMount_Kilimanjaro%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FSocial_vulnerability%3E+%29%29%0D%0A%3Fs2+%3Fp+%3Fo+.%0D%0Afilter+%28%3Fs2+in+%28%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FClimate_change%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FDisaster_risk_reduction%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FTanzania%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FCapacity_building%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FPoverty%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FConstruction%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FVulnerability%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FMount_Kilimanjaro%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FSocial_vulnerability%3E+%29%29%0D%0Afilter+%28%3Fs1+!%3D+%3Fs2%29%0D%0Afilter+%28str%28%3Fs1%29+%3C+str+%28%3Fs2%29%29%0D%0A}+limit+20&format=html&debug=on&timeout=">here</ulink></para>
-  <tip><title>See Also:</title>
-    <para><link linkend="rdfsparulexamples18">Example usage of IN operator for retrieving all triples for each entity.</link></para>
-  </tip>
-</sect5>
-<sect5 id="rdfsparulexamples7"><title>Example for Modify used as Update</title>
-       <para>'Modify graph' may be used as a form of 'update' operation.
+  ]]></programlisting>
+  <para>In this case, we provide a binding for ?x in the filter outside of the
+  transitive subquery. The subquery therefore is made to run from in to
+  out. The same effect would be accomplished if we bound ?syn and
+  SELECT ?x, the designations of in and out are arbitrary and for
+  transitive steps that can be evaluated equally well in both directions
+  this makes no difference.
        </para>
+  <para>The transitive subquery in the above is </para>
 <programlisting><![CDATA[
-SQL>SPARQL MODIFY GRAPH <http://mygraph.com> DELETE { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o } INSERT { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type1> ?o } WHERE { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o };
+{SELECT ?syn
+ WHERE
+  {
+    { SELECT ?x ?syn
+      WHERE
+       {{ ?x owl:sameAs ?syn } UNION { ?syn owl:sameAs ?x}}
+    } OPTION (TRANSITIVE, t_in (?x), t_out (?syn), t_distinct, t_min (0) )
+  }
+} .
+  ]]></programlisting>
+  <para>Leaving out the option would just look for one step of owl:sameAs.
+  Making it transitive will apply the subquery to all bindings it
+  produces until all are visited at least once (the t_distinct modifier).
+  </para>
+  <para>If the transitive step consists of a single triple pattern, there is a shorthand:</para>
+  <programlisting><![CDATA[
+  <alice> foaf:knows ?friend option (transitive t_min (1))
+  ]]></programlisting>
+  <para>will bind ?friend to all directly and indirectly found foaf:known
+  individuals. If t_min had been 0, Malice> would have also been in the
+  generated bindings.</para>
+  <para>The syntax is</para>
+  <programlisting><![CDATA[
+  option (transitive transitivity_option[,...])
 
-SQL>SPARQL
-DELETE FROM GRAPH <http://mygraph.com> { <http://myopenlink.net/dataspace/Caroline#this> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type1> <http://rdfs.org/sioc/ns#User> };
+  transitivity_option ::=  t_in (<variable_list>)
+  | t_out (<variable_list>)
+  | t_distinct
+  | t_shortest_only
+  | t_no_cycles
+  | t_cycles_only
+  | t_min (INTNUM)
+  | t_max (INTNUM)
+  | t_end_flag (<variable>)
+  | t_step (<variiable_or_step>)
+  | t_direction INTNUM
+
+  variable_list ::= <variable> [,...]
 
+  variable_or_step ::= <variable> | path_id' | 'step_no'
 ]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples8"><title>Example for generating RDF information resource URI</title>
-       <para>The RDF information resource URI can be generated via a string expression.</para>
-<itemizedlist mark="bullet">
-  <listitem>Suppose there is a sample file kidehen.n3:
+  <para>Unlike SQL, variable names are used instead of column numbers.
+  Otherwise all the options have the same meaning.</para>
+  <para>Some examples of the use of transitivity are:</para>
+  <sect3 id="rdfsparqlimplementatiotransexamples"><title>Collection of Transitivity Option Demo Queries for SPARQL</title>
+<sect4 id="rdfsparqlimplementatiotransexamples1"><title>Example for finding out what graphs contain owl:sameAs for "New York"</title>
+  <para>To find out what graphs contain owl:sameAs for Dan York, we do</para>
 <programlisting><![CDATA[
-<http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User> .
-<http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this> <http://www.w3.org/2000/01/rdf-schema#label> 	"Kingsley" .
-<http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this> <http://rdfs.org/sioc/ns#creator_of> <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300> .
+  SELECT ?g ?x count (*) as ?count
+   WHERE {
+           {SELECT ?x ?alias ?g
+            WHERE {
+                    { GRAPH ?g {?x owl:sameAs ?alias }
+                  }
+            UNION
+           {GRAPH ?g {?alias owl:sameAs ?x}}}}
+   OPTION (TRANSITIVE, t_in (?x), t_out (?alias), t_distinct, t_min (1)) .
+   FILTER (?x = <http://dbpedia.org/resource/New_York> ) .
+         }
 ]]></programlisting>
-</listitem>
-  <listitem>Using Conductor UI go to Web Application Server and create folder, for ex. with name "n3_collection"</listitem>
-  <listitem>Upload the "n3_collection" folder the file kidehen.n3</listitem>
-  <listitem>Click properties for the folder "n3_collection" and set to be public readable in the Permissions section</listitem>
-  <listitem>Check "Apply changes to all subfolders and resources".</listitem>
-  <listitem>Finally Click "Update"</listitem>
-     <figure id="gnr1" float="1">
-       <title>Generating RDF information resource URI</title>
-       <graphic fileref="ui/exmp1.png"/>
-     </figure>
-  <listitem>To clear the graph execute:
-<programlisting><![CDATA[
-SQL>SPARQL CLEAR GRAPH <http://mygraph.com>;
-callret-0
-VARCHAR
-_____________________________________________________________________
-
-Clear <http://mygraph.com> -- done
-
-1 Rows. -- 10 msec.
-]]></programlisting></listitem>
-   <listitem>To load the kidehen.n3 file execute:
+  <para>Here we select all paths that start with the initial URI and pass
+  through one or more sameAs statements. Each step produces a result of
+  the transitive subquery. The graph where the sameAs triple was found
+  is returned and used as the grouping column. In this way we see how
+  many times each graph is used. Note that graphs are counted many
+  times since the graphs containing immediate sameAs statements are
+  counted for paths of length 1, then again as steps on paths that reach
+  to their aliases and so on.</para>
+</sect4>
+<sect4 id="rdfsparqlimplementatiotransexamples2"><title>Example for query that takes all the people known by Tim Berners-Lee, to a depth between 1 and 4 applications of the subquery</title>
+  <para>This query takes all the people known by kidehen, to a depth between 1
+  and 4 applications of the subquery. It then sorts them by the
+  distance and the descending count of connections of each found connection. This is
+  equivalent to the default connections list shown by LinkedIn.</para>
 <programlisting><![CDATA[
-SQL>SPARQL
-load bif:concat ("http://", bif:registry_get("URIQADefaultHost"), "/DAV/n3_collection/kidehen.n3")
-INTO GRAPH <http://mygraph.com>;
-callret-0
-VARCHAR
-_______________________________________________________________________________
-
-Load <http://localhost:8890/DAV/n3_collection/kidehen.n3> into graph <http://mygraph.com> -- done
-
-1 Rows. -- 30 msec.
+SPARQL
+  SELECT ?o ?dist ((SELECT COUNT (*) WHERE {?o foaf:knows ?xx}))
+WHERE
+  {
+      {
+        SELECT ?s ?o
+        WHERE
+          {
+            ?s foaf:knows ?o
+          }
+      } OPTION (TRANSITIVE, t_distinct, t_in(?s), t_out(?o), t_min (1), t_max (4), t_step ('step_no') as ?dist) .
+      FILTER (?s= <http://www.w3.org/People/Berners-Lee/card#i>)
+    }
+  ORDER BY ?dist DESC 3
+  LIMIT 50
+  ]]></programlisting>
+</sect4>
+<sect4 id="rdfsparqlimplementatiotransexamples4"><title>Example for finding how two people know each other and what graphs are involved in the connection</title>
+  <para>To find how two people know each other and what graphs are involved in the connection, we do:</para>
+  <programlisting><![CDATA[
+  SPARQL
+  SELECT ?link ?g ?step ?path
+  WHERE
+    {
+      {
+        SELECT ?s ?o ?g
+        WHERE
+          {
+            graph ?g {?s foaf:knows ?o }
+          }
+      } OPTION (TRANSITIVE, t_distinct, t_in(?s), t_out(?o), t_no_cycles, T_shortest_only,
+      t_step (?s) as ?link, t_step ('path_id') as ?path, t_step ('step_no') as ?step, t_direction 3) .
+      FILTER (?s= <http://www.w3.org/People/Berners-Lee/card#i>
+      && ?o = <http://www.advogato.org/person/mparaz/foaf.rdf#me>)
+  }
+LIMIT 20
 ]]></programlisting>
-  </listitem>
-  <listitem>In order to check the new inserted triples execute:
+  <para>This query binds both the t_in and t_out variables. The ?g is left as
+  a free variable. Also, specifying ?s and the system defined constants
+  step_no and path_id as with t_step, we get for each transitive step a
+  row of results with the intermediate binding of ?s, the count of steps
+  from the initial ?s and a distinct identifier for the individual path,
+  since there can be many distinct paths that link the ?s and ?o
+  specified in the filter.</para>
+  <para>See the SQL transitive option section for details on the meaning of step_no and path_id.</para>
+</sect4>
+<sect4 id="rdfsparqlimplementatiotransexamples5"><title>Example for TBox Subsumption</title>
+<para>Subsumption Demo Using Transitivity Clause</para>
+<para>Yago Class Hierarchy (TBox) Subsumption</para>
+<para>AlphaReceptors</para>
 <programlisting><![CDATA[
-SQL>SPARQL
-SELECT *
-FROM <http://mygraph.com>
+SELECT ?y
+FROM <http://dbpedia.org/resource/classes/yago#>
 WHERE
   {
-    ?s ?p ?o
+    {
+      SELECT *
+      WHERE
+        {
+          ?x rdfs:subClassOf ?y .
+        }
+    }
+    OPTION (TRANSITIVE, t_distinct, t_in (?x), t_out (?y) ) .
+    FILTER (?x = <http://dbpedia.org/class/yago/AlphaReceptor105609111>)
   }
-;
-s                                                                  p                                                   o
-VARCHAR                                                            VARCHAR                                             VARCHAR
-_______________________________________________________________________________
-
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this    http://www.w3.org/1999/02/22-rdf-syntax-ns#type     http://rdfs.org/sioc/ns#User
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this    http://rdfs.org/sioc/ns#creator_of                  http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this    http://www.w3.org/2000/01/rdf-schema#label          Kingsley
-
-3 Rows. -- 10 msec.
 ]]></programlisting>
-  </listitem>
-</itemizedlist>
-</sect5>
-<sect5 id="rdfsparulexamples9"><title>Example for operations over a web service endpoint</title>
-       <para>Several operations can be sent to a web service endpoint as a single statement and
-executed in sequence.
-       </para>
+</sect4>
+<sect4 id="rdfsparqlimplementatiotransexamples6"><title>Example for Receptors</title>
+<programlisting><![CDATA[
+SELECT ?x
+FROM <http://dbpedia.org/resource/classes/yago#>
+WHERE
+  {
+    {
+      SELECT *
+      WHERE
+        {
+          ?x rdfs:subClassOf ?y .
+        }
+    } OPTION (transitive, t_distinct, t_in (?x), t_out (?y) ) .
+  FILTER (?y = <http://dbpedia.org/class/yago/Receptor105608868>)
+}
+]]></programlisting>
+</sect4>
+<sect4 id="rdfsparqlimplementatiotransexamples7"><title>Inference Rule example using transitive properties from SKOS vocabulary</title>
+<p>The following example demostrates the steps how to retrieve the skos ontology, add triples
+for skos:broaderTransitiveinto the graph, define inference rule, and at the and
+execute sparql query with inference rule and transitivity option. The queries were executed against
+the LOD instance (http://lod.openlinksw.com):</p>
+<orderedlist>
+  <listitem>Make the Context graph, assuming you don't want to load entire SKOS vocabulary into our Quad Store:
 <programlisting><![CDATA[
 SQL>SPARQL
-INSERT IN GRAPH <http://mygraph.com> { <http://myopenlink.net/dataspace/Kingsley#this>
-                                    <http://rdfs.org/sioc/ns#id>
-                                    <Kingsley> }
-INSERT INTO GRAPH <http://mygraph.com> { <http://myopenlink.net/dataspace/Caroline#this>
-                                      <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
-                                      <http://rdfs.org/sioc/ns#User> }
-INSERT INTO GRAPH <http://mygraph.com> { ?s <http://rdfs.org/sioc/ns#id> `iri (bif:concat (str (?o), "Idehen"))` }
-              WHERE { ?s <http://rdfs.org/sioc/ns#id> ?o };
-callret-0
-VARCHAR
-_______________________________________________________________________________
-
-Insert into <http://mygraph.com>, 1 triples -- done
-Insert into <http://mygraph.com>, 1 triples -- done
-Insert into <http://mygraph.com>, 8 triples -- done
-Commit -- done
-
-
-1 Rows. -- 10 msec.
-
-SQL>SPARQL
-MODIFY GRAPH <http://mygraph.com>
-DELETE { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o }
-INSERT { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type1> ?o }
-WHERE { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o };
-
-SQL>DELETE FROM GRAPH <http://mygraph.com> { <http://myopenlink.net/dataspace/Caroline#this> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type1> <http://rdfs.org/sioc/ns#User> };
-
-SQL>SPARQL
-load bif:concat ("http://", bif:registry_get("URIQADefaultHost"), "/DAV/n3_collection/kidehen.n3") INTO GRAPH <http://mygraph.com>;
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+INSERT INTO GRAPH <urn:rules.skos> { skos:broader rdfs:subPropertyOf skos:broaderTransitive .
+                                     skos:narrower rdfs:subPropertyOf skos:narrowerTransitive };
 ]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples10"><title>Example for Dropping graph</title>
-<para>When handling very large RDF data collections (e.g. 600 million triples ) loaded into Virtuoso
-server as a single graph, the fastest operation to drop the graph is:</para>
+</listitem>
+  <listitem>OR Load entire SKOS ontology into Quad Store via iSQL interface (commandline or HTML based Conductor):
 <programlisting><![CDATA[
-SQL>SPARQL CLEAR GRAPH <http://mygraph.com>;
-callret-0
-VARCHAR
-______________________________________________________________________________
-
-Clear <http://mygraph.com> -- done
+SQL>DB.DBA.RDF_LOAD_RDFXML (http_get ('http://www.w3.org/2009/08/skos-reference/skos-owl1-dl.rdf'), 'no', 'urn:rules.skos');
+Done.
+]]></programlisting>
+  </listitem>
+  <listitem>Make Context Rule:
+<programlisting><![CDATA[
+SQL>rdfs_rule_set ('skos-trans', 'urn:rules.skos');
+Done.
+]]></programlisting>
+  </listitem>
+  <listitem>Go to SPARQL endpoint, for ex. http://lod.openlinksw.com/sparql</listitem>
+  <listitem>Use inference rule pragma to set context rule for SPARQL query, i.e:
+<programlisting><![CDATA[
+SPARQL
+DEFINE input:inference "skos-trans"
+PREFIX p: <http://dbpedia.org/property/>
+PREFIX dbpedia: <http://dbpedia.org/resource/>
+PREFIX category: <http://dbpedia.org/resource/Category:>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX geo: <http://www.georss.org/georss/>
 
-1 Rows. -- 10 msec.
+SELECT DISTINCT ?m ?n ?p ?d
+WHERE
+  {
+    ?m rdfs:label ?n.
+    ?m skos:subject ?c.
+    ?c skos:broaderTransitive category:Churches_in_Paris OPTION (TRANSITIVE) .
+    ?m p:abstract ?d.
+    ?m geo:point ?p
+    FILTER ( lang(?n) = "fr" )
+    FILTER ( lang(?d) = "fr" )
+  }
 ]]></programlisting>
-<para>The operation can be speeded up by executing log_enable (0) or even log_enable (2) beforehand,
-and log_enable(1) after it completes.
-</para>
-</sect5>
-<sect5 id="rdfsparulexamples11"><title>Example for testing Graph Equality</title>
-<para>The procedure below keeps simple cases of graphs with bnodes:</para>
-<orderedlist>
-  <listitem>First it compares all triples without bnodes</listitem>
-  <listitem>Then it iteratively establishes equivalences between bnodes that
-are directly and unambiguously connected to equivalent vertexes by identical predicates.</listitem>
+</listitem>
+  <listitem>You will get 22 rows returned from the query.
+Note that for comparison, if the option (transitive) is ommitted, then only 2 rows will be returned
+in our example query:
+     <figure id="rdftr" float="1">
+       <title>Transitive option</title>
+       <graphic fileref="ui/trs1.png"/>
+     </figure>
+</listitem>
 </orderedlist>
+</sect4>
+<sect4 id="rdfsparqlimplementatiotransexamples8"><title>Inference Rule example using
+transitive properties from SKOS vocabulary: Variant II</title>
+<p>This example shows how to find entities that are subcategories of Protestant Churches, no deeper
+than 3 levels within the concept scheme hierarchy, filtered by a specific subcategory. It demonstrates
+use of inference rules, sub-queries, and filter to obtain entities associated with category:
+Protestant_churches combined with the use of the transitivitve closure, sets to a maximum of 3 steps down a SKOS based concept scheme hierarchy:</p>
+<orderedlist>
+  <listitem>Make sure the inference rule "skos-trans" is created as described in the previous <link linkend="rdfsparqlimplementatiotransexamples7">example</link></listitem>
+  <listitem>Go to SPARQL endpoint, for ex. http://lod.openlinksw.com/sparql</listitem>
+  <listitem>Use inference rule pragma to set context rule for SPARQL query, i.e:
 <programlisting><![CDATA[
--- Fast Approximate RDF Graph Equivalence Test
--- (C) 2009 OpenLink Software
--- License: GNU General Public License (only version 2 of the license).
--- No warranty, even implied warranty
+DEFINE input:inference "skos-trans"
+PREFIX p: <http://dbpedia.org/property/>
+PREFIX dbpedia: <http://dbpedia.org/resource/>
+PREFIX category: <http://dbpedia.org/resource/Category:>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX geo: <http://www.georss.org/georss/>
 
--- This compares the content of triple dictionaries \c dict1 and \c dict2,
--- returns NULL if no difference found (with bnode equivalence in mind),
--- returns description of a difference otherwise.
--- The function is experimental (note suffix _EXP), so no accurate QA is made.
--- Some version of the function may be inserted later in OpenLink Virtuoso Server under some different name.
-create function DB.DBA.RDF_TRIPLE_DICTS_DIFFER_EXP (
-  in dict1 any, --- Triple dictionary, traditional, (vectors of S, P, O are keys, any non-nulls are values)
-  in dict2 any, --- Second triple dictionary, like to \c dict1
-  in accuracy integer,	--- Accuracy, 0 if no bnodes expected, 1 if "convenient" trees with intermediate bnodes expected, 2 and more are not yet implemented
-  in equiv_map any := null, --- If specified then it contain mapping from IRI_IDs of bnodes of \c dict1 to equivalent IRI_IDs of bnodes of \c dict1.
--- It can be extended during the run so use dict_duplicate() before call if needed.
-  in equiv_rev any := null --- If specified then it is an inverted dictionary of \c equiv_map (this time \c dict2 bnodes are keys and \c dict1 bnodes are values)
-  )
-{
-  declare dict_size1, dict_size2 integer;
-  declare old_dirt_level, dirt_level integer;
-  declare ctr, tailctr, sp_made_new_equiv integer;
-  declare array1, array2, dict2_sp, dict1_op, dict2_op, array1_op any;
-  dict_size1 := dict_size (dict1);
-  dict_size2 := dict_size (dict2);
-  dict2 := dict_duplicate (dict2);
-  if (dict_size1 <> dict_size2)
-    return 'Sizes differ';
-  if (equiv_map is null)
-    {
-      equiv_map := dict_new (dict_size1);
-      equiv_rev := dict_new (dict_size1);
-    }
-  old_dirt_level := dict_size1 - dict_size (equiv_map);
-  array1 := dict_list_keys (dict1, 0);
-next_loop:
--- Step 1: removing triples with all three items matched
-  ctr := dict_size1-1;
-  while (ctr >= 0)
-    {
-      declare s_in_1, o_in_1, s_in_2, o_in_2, triple_in_2 any;
-      s_in_1 := array1[ctr][0];
-      o_in_1 := array1[ctr][2];
-      if (is_bnode_iri_id (s_in_1))
-        {
-          s_in_2 := dict_get (equiv_map, s_in_1, null);
-          if (s_in_2 is null)
-            goto next_full_eq_check;
-        }
-      else
-        s_in_2 := s_in_1;
-      if (is_bnode_iri_id (o_in_1))
-        {
-          o_in_2 := dict_get (equiv_map, o_in_1, null);
-          if (o_in_2 is null)
-            goto next_full_eq_check;
-        }
-      else
-        o_in_2 := o_in_1;
-      triple_in_2 := vector (s_in_2, array1[ctr][1], o_in_2);
-      if (dict_get (dict2, triple_in_2, null) is null)
-        return vector (array1[ctr], ' is in first, ', triple_in_2, ' is missing in second');
-      dict_remove (dict2, triple_in_2);
-      if (ctr < dict_size1-1)
-        array1[ctr] := array1[dict_size1-1];
-      dict_size1 := dict_size1-1;
-next_full_eq_check:
-      ctr := ctr-1;
-    }
--- Step 1 end, garbage truncated:
-  if ((0 = dict_size1) or (0 = accuracy))
-    return null;
-  if (dict_size1 < length (array1))
-    array1 := subseq (array1, 0, dict_size1);
-  if (dict_size (dict2) <> dict_size1)
-    signal ('OBLOM', 'Internal error: sizes of graphs suddenly differ');
--- Step 2: establishing equivs between not-yet-coupled bnodes that are values of functional predicates of coupled subjects
-  sp_made_new_equiv := 0;
-  dict2_sp := dict_new (dict_size1);
-  array2 := dict_list_keys (dict2, 0);
-  for (ctr := dict_size1-1; ctr >= 0; ctr := ctr-1)
+SELECT DISTINCT ?c AS ?skos_broader
+       ?trans AS ?skos_narrower
+       ?dist AS ?skos_level
+       ?m ?n ?p AS ?geo_point
+WHERE
+  {
     {
-      declare sp2, o2, prev_uniq_o2 any;
-      sp2 := vector (array2[ctr][0], array2[ctr][1]);
-      prev_uniq_o2 := dict_get (dict2_sp, sp2, null);
-      if (prev_uniq_o2 is null)
+      SELECT ?c  ?m ?n ?p ?trans ?dist
+      WHERE
         {
-          o2 := array2[ctr][2];
-          if (is_bnode_iri_id (o2))
-            dict_put (dict2_sp, sp2, o2);
-          else
-            dict_put (dict2_sp, sp2, #i0);
+  	  ?m rdfs:label ?n.
+  	  ?m skos:subject ?c.
+  	  ?c skos:broaderTransitive category:Protestant_churches .
+  	  ?c skos:broaderTransitive ?trans
+            OPTION ( TRANSITIVE, t_distinct, t_in (?c), t_out (?trans),
+                     t_max (3),  t_step ( 'step_no' ) as ?dist ) .
+  	  ?m p:abstract ?d.
+  	  ?m geo:point ?p
+  	  FILTER ( lang(?n) = "en" )
+  	  FILTER ( lang(?d) = "en" )
         }
-      else if (prev_uniq_o2 <> #i0)
-        dict_put (dict2_sp, sp2, #i0);
     }
-  rowvector_subj_sort (array1, 0, 1);
-  rowvector_subj_sort (array1, 1, 1);
-  rowvector_subj_sort (array2, 1, 1);
-  ctr := 0;
-  while (ctr < dict_size1)
-    {
-      declare s_in_1, o_in_1, s_in_2, o_in_2, o_in_dict2_sp, o_in_dict2_sp_in_1 any;
-      tailctr := ctr+1;
-      if (array1[ctr][1] <> array2[ctr][1])
-        {
-          if (array1[ctr][1] > array2[ctr][1])
-            return vector ('Cardinality of predicate ', array2[ctr][1], ' is greater in second than in first');
-          else
-            return vector ('Cardinality of predicate ', array1[ctr][1], ' is greater in first than in second');
-        }
-      while ((tailctr < dict_size1) and
-        (array1[tailctr][0] = array1[ctr][0]) and
-        (array1[tailctr][1] = array1[ctr][1]) )
-        tailctr := tailctr+1;
-      if ((tailctr - ctr) > 1)
-        goto next_sp_check;
-      o_in_1 := array1[ctr][2];
-      if (not is_bnode_iri_id (o_in_1))
-        goto next_sp_check;
-      o_in_2 := dict_get (equiv_map, o_in_1, null);
-      if (o_in_2 is not null)
-        goto next_sp_check;
-      s_in_1 := array1[ctr][0];
-      if (is_bnode_iri_id (s_in_1))
-        {
-          s_in_2 := dict_get (equiv_map, s_in_1, null);
-          if (s_in_2 is null)
-            goto next_sp_check;
-        }
-      else
-        s_in_2 := s_in_1;
-      o_in_dict2_sp := dict_get (dict2_sp, vector (s_in_2, array1[ctr][1]), null);
-      if (o_in_dict2_sp is null)
-        return vector (vector (s_in_1, array1[ctr][1], o_in_1), ' is unique SP in first, ', vector (s_in_2, array1[ctr][1]), ' is missing SP in second');
-      if (o_in_dict2_sp = #i0)
-        return vector (vector (s_in_1, array1[ctr][1], o_in_1), ' is unique SP in first, ', vector (s_in_2, array1[ctr][1]), ' is not unique SP-to-bnode in second');
-      o_in_dict2_sp_in_1 := dict_get (equiv_rev, o_in_dict2_sp, null);
-      if (o_in_dict2_sp_in_1 is not null)
-        {
-          if (o_in_dict2_sp_in_1 = o_in_1)
-            goto next_sp_check;
-          return vector (vector (s_in_1, array1[ctr][1], o_in_1), ' is unique SP in first, ', vector (s_in_2, array1[ctr][1], o_in_dict2_sp), ' is unique SP in second but ', o_in_dict2_sp, ' rev-equiv to ', o_in_dict2_sp_in_1);
-        }
-      dict_put (equiv_map, o_in_1, o_in_dict2_sp);
-      dict_put (equiv_rev, o_in_dict2_sp, o_in_1);
-      sp_made_new_equiv := sp_made_new_equiv + 1;
-next_sp_check:
-      ctr := tailctr;
-    }
-  dict_list_keys (dict2_sp, 2);
--- Step 2 end
-  if (sp_made_new_equiv * 10 > dict_size1)
-    goto next_loop; -- If dictionary is noticeably extended then it's worth to remove more triples before continue.
--- Step 3: establishing equivs between not-yet-coupled bnodes that are subjects of inverse functional properties with coupled objects.
-  dict1_op := dict_new (dict_size1);
-  for (ctr := dict_size1-1; ctr >= 0; ctr := ctr-1)
-    {
-      declare op1, s1, prev_uniq_s1 any;
-      op1 := vector (array1[ctr][2], array1[ctr][1]);
-      prev_uniq_s1 := dict_get (dict1_op, op1, null);
-      if (prev_uniq_s1 is null)
-        {
-          s1 := array1[ctr][0];
-          if (is_bnode_iri_id (s1))
-            dict_put (dict1_op, op1, s1);
-          else
-            dict_put (dict1_op, op1, #i0);
-        }
-      else if (prev_uniq_s1 <> #i0)
-        dict_put (dict1_op, op1, #i0);
-    }
-  array1_op := dict_to_vector (dict1_op, 2);
-  dict2_op := dict_new (dict_size1);
-  for (ctr := dict_size1-1; ctr >= 0; ctr := ctr-1)
-    {
-      declare op2, s2, prev_uniq_s2 any;
-      op2 := vector (array2[ctr][2], array2[ctr][1]);
-      prev_uniq_s2 := dict_get (dict2_op, op2, null);
-      if (prev_uniq_s2 is null)
-        {
-          s2 := array2[ctr][0];
-          if (is_bnode_iri_id (s2))
-            dict_put (dict2_op, op2, s2);
-          else
-            dict_put (dict2_op, op2, #i0);
-        }
-      else if (prev_uniq_s2 <> #i0)
-        dict_put (dict2_op, op2, #i0);
-    }
-  ctr := length (array1_op) - 2;
-  while (ctr >= 0)
-    {
-      declare o_in_1, s_in_1, o_in_2, s_in_2, s_in_dict2_op, s_in_dict2_op_in_1 any;
-      s_in_1 := array1_op[ctr+1];
-      if (not is_bnode_iri_id (s_in_1))
-        goto next_op_check;
-      s_in_2 := dict_get (equiv_map, s_in_1, null);
-      if (s_in_2 is not null)
-        goto next_op_check;
-      o_in_1 := array1_op[ctr][0];
-      if (is_bnode_iri_id (o_in_1))
-        {
-          o_in_2 := dict_get (equiv_map, o_in_1, null);
-          if (o_in_2 is null)
-            goto next_op_check;
-        }
-      else
-        o_in_2 := o_in_1;
-      s_in_dict2_op := dict_get (dict2_op, vector (o_in_2, array1_op[ctr][1]), null);
-      if (s_in_dict2_op is null)
-        return vector (vector (s_in_1, array1_op[ctr][1], o_in_1), ' is unique OP in first, ', vector (o_in_2, array1_op[ctr][1]), ' is missing OP in second');
-      if (s_in_dict2_op = #i0)
-        return vector (vector (s_in_1, array1_op[ctr][1], o_in_1), ' is unique OP in first, ', vector (o_in_2, array1_op[ctr][1]), ' is not unique OP-to-bnode in second');
-      s_in_dict2_op_in_1 := dict_get (equiv_rev, s_in_dict2_op, null);
-      if (s_in_dict2_op_in_1 is not null)
-        {
-          if (s_in_dict2_op_in_1 = s_in_1)
-            goto next_op_check;
-          return vector (vector (s_in_1, array1_op[ctr][1], o_in_1), ' is unique OP in first, ', vector (s_in_dict2_op, array1[ctr][1], o_in_2), ' is unique OP in second but ', s_in_dict2_op, ' rev-equiv to ', s_in_dict2_op_in_1);
-        }
-      dict_put (equiv_map, s_in_1, s_in_dict2_op);
-      dict_put (equiv_rev, s_in_dict2_op, s_in_1);
-next_op_check:
-      ctr := ctr - 2;
-    }
-  dict_list_keys (dict2_op, 2);
--- Step 3 end
-  dirt_level := dict_size1 - dict_size (equiv_map);
-  if (dirt_level >= old_dirt_level)
-    return vector (vector (array1[0][0], array1[0][1], array1[0][2]), ' has no matches in second with the requested accuracy');
-  old_dirt_level := dirt_level;
-  goto next_loop;
-}
-;
-
-create function DB.DBA.RDF_GRAPHS_DIFFER_EXP (in g1_uri varchar, in g2_uri varchar, in accuracy integer)
-{
-  return DB.DBA.RDF_TRIPLE_DICTS_DIFFER_EXP (
-    (sparql define output:valmode "LONG" construct { ?s ?p ?o } where { graph `iri(?:g1_uri)` { ?s ?p ?o }}),
-    (sparql define output:valmode "LONG" construct { ?s ?p ?o } where { graph `iri(?:g2_uri)` { ?s ?p ?o }}),
-    accuracy );
-}
-;
-
--- The rest of file contains some minimal tests.
-
-set verbose off;
-set banner off;
-set types off;
-
-create function DB.DBA.DICT_EXTEND_WITH_KEYS (in dict any, in keys any)
-{
-  if (dict is null)
-    dict := dict_new (length (keys));
-  foreach (any k in keys) do
-    dict_put (dict, k, 1);
-  return dict;
-}
-;
-
-create function DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP (in title varchar, in should_differ integer, in v1 any, in v2 any, in accuracy integer)
-{
-  declare d1, d2, eqm, eqr, differ_status any;
-  d1 := DB.DBA.DICT_EXTEND_WITH_KEYS (null, v1);
-  d2 := DB.DBA.DICT_EXTEND_WITH_KEYS (null, v2);
-  eqm := dict_new (10);
-  eqr := dict_new (10);
-  dbg_obj_princ ('===== ' || title);
-  differ_status := DB.DBA.RDF_TRIPLE_DICTS_DIFFER_EXP (d1, d2, accuracy, eqm, eqr);
-  dbg_obj_princ ('Result: ', differ_status);
-  if (0 < dict_size (eqm))
-  dbg_obj_princ ('Equivalence map: ', dict_to_vector (eqm, 0));
-  dbg_obj_princ ('Equivalence rev: ', dict_to_vector (eqr, 0));
-  return sprintf ('%s: %s',
-    case when (case when should_differ then equ (0, isnull (differ_status)) else isnull (differ_status) end) then 'PASSED' else '***FAILED' end,
-    title );
-}
-;
-
-create function DB.DBA.TEST_RDF_GRAPHS_DIFFER_EXP (in title varchar, in should_differ integer, in g1_uri varchar, in g2_uri varchar, in accuracy integer)
-{
-  declare differ_status any;
-  differ_status := DB.DBA.RDF_GRAPHS_DIFFER_EXP (g1_uri, g2_uri, accuracy);
-  dbg_obj_princ ('Result: ', differ_status);
-  return sprintf ('%s: %s',
-    case when (case when should_differ then equ (0, isnull (differ_status)) else isnull (differ_status) end) then 'PASSED' else '***FAILED' end,
-    title );
-}
-;
-
-select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'Identical graphs', 0,
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i200, 1) ),
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i200, 1) ),
-  100
-);
+    FILTER ( ?trans = <http://dbpedia.org/resource/Category:Churches_in_London> )
+  }
+ORDER BY ASC (?dist)
+]]></programlisting>
+</listitem>
+  <listitem>You will get 22 rows returned from the query.
+     <figure id="rdftr" float="1">
+       <title>Transitive option</title>
+       <graphic fileref="ui/trs2.png"/>
+     </figure>
+</listitem>
+</orderedlist>
+</sect4>
+</sect3>
+</sect2>
+<sect2 id="rdfsparqlimplementatioptragmas"><title>Supported SPARQL-BI "define" pragmas</title>
+<para>SPARQL-BI compiler and run-time support are not isolated from environment and some used heuristics 
+	are not perfect and sometimes different use cases require different behavior within same standard. 
+	These reasons are seen frequently in the industry, and the solution is well known: compiler pragmas. 
+	So we allow them at the beginning of any SPARQL query in form:
+</para>
+<programlisting><![CDATA[
+define QName value
+]]></programlisting>
+<sect3 id="rdfsparqlimplementatioptragmascinp"><title>Pragmas to control the input data set for 
+the query</title>
+<programlisting><![CDATA[
+input:default-graph-uri works like "FROM" clause;
+input:named-graph-uri works like "FROM NAMED" clause;
+input:default-graph-exclude works like "NOT FROM" clause;
+input:named-graph-exclude works like "NOT FROM NAMED" clause.
+]]></programlisting>
+<para>The difference is that these pragmas have higher priority and they can be used for security 
+	restrictions in combination with <code>define input:freeze</code> that blocks further changes in 
+	the list of source graphs. The web service endpoint (or similar non-web application) can edit 
+	the incoming query by placing list of pragmas ended with <code>input:freeze</code> in front of 
+	query text. Even if the intruder will try to place some graph names, it will get compilation error, 
+	not an access to the data. input:freeze disables all <code>input:grab-...</code> pragmas as well.
+</para>
+<itemizedlist mark="bullet">
+  <listitem><code>input:ifp</code>: adds IFP keyword in OPTION (QUIETCAST, ...) clause in the generated 
+  SQL. The value of this define is not used ATM, an empty string is safe for future extensions.</listitem>
+  <listitem><code>input:same-as</code>: works like input:ifp but adds SAME_AS keyword.</listitem>
+  <listitem><code>input:storage</code>: selects quad map storage to use. The value is an IRI of storage, 
+  the default value is, of course, virtrdf:DefaultQuadStorage. If the value is an empty string then only 
+  quads from RDF_VIEW are used. This is a good choice for low-level admin procedures, for two reasons: 
+  they will not interfere with any changes in virtrdf:DefaultQuadStorage and they will continue to work 
+  even if all compiler's metadata are corrupted, including the description of virtrdf:DefaultQuadStorage 
+  (define input:storage "" switches the SPARQL compiler to a small set of metadata that are built in 
+  server C code and thus are very hard to corrupt by users).</listitem>
+  <listitem><code>input:inference</code>: specifies the name of inference rule set to use.</listitem>
+  <listitem><code>input:param (and synonyms input:params, sql:param, sql:params)</code>: declares a 
+  variable name as a protocol parameter. The SPARQL query can refer to protocol parameter X via 
+  variable with special syntax of name ?::X . If a query text should be made by query builder that 
+  does not understand SPARQL-BI extensions then the text may contain variable ?X and define 
+  input:param "X" . This does not work for positional parameters, one can not replace a reference 
+  to ?::3 with ?3 and define input:param "3".</listitem>
+  <listitem><code>input:grab-var</code>: sponge values of variable;</listitem>
+  <listitem><code>input:grab-iri</code>: sponge the constant IRI;</listitem>
+  <listitem><code>input:grab-all</code>: sponge all constants and variables of the query;</listitem>
+  <listitem><code>input:grab-seealso (and synonym input:grab-follow-predicate)</code>: sets predicate 
+  that tells where to sponge more data about a subject;</listitem>
+  <listitem><code>input:grab-limit</code>: how many resources can be sponged;</listitem>
+  <listitem><code>input:grab-depth</code>: how many iterations can be done, sponging additional data 
+  on each iteration;</listitem>
+  <listitem><code>input:grab-base</code>: base to resolve relative IRIs before passing to sponge;</listitem>
+  <listitem><code>input:grab-resolver</code>: IRI resolving procedure (i.e., one that turns base and 
+  relative IRI to an absolute IRI);</listitem>
+  <listitem><code>input:grab-destination</code>: single resource that should be filled in with results 
+  of all sponges;</listitem>
+  <listitem><code>input:grab-loader</code>: a name of procedure that retrieve the resource via HTTP, 
+  parse it and store it.</listitem>
+</itemizedlist>
+<para>All these pragmas are described in more details 
+	<link linkend="rdfinputgrab">here</link>, 
+	but in addition there are some experimental:
+</para>
+<itemizedlist mark="bullet">
+  <listitem><code>input:grab-intermediate</code>: extends the set of IRIs to sponge, useful in 
+  combination with input:grab-seealso. If present then for a given subject, sponge will retrieve 
+  not only values of see-also predicates for that subject but the subject itself. The define value 
+  is not used in current implementation.</listitem>
+  <listitem><code>input:grab-group-destination</code>: resembles input:grab-destination but sponges will 
+  create individual graphs for sponge results, and in additional to this common routine, a copy of each 
+  sponge result is added to the resource specified by the value of input:grab-group-destination. 
+  input:grab-destination redirects loadings, input:grab-group-destination duplicates them.</listitem>
+  <listitem><code>get:soft</code>: "soft" or "replacing", depending on mode of loading source graph;
+  </listitem>
+  <listitem><code>get:uri</code>: an URI of web resource where the graph should come from (e.g., a local 
+  mirror);</listitem>
+  <listitem><code>get:method</code>: "GET" or "MGET", depending on loading the resource itself or loading 
+  metadata about the resource;</listitem>
+  <listitem><code>get:refresh</code>: limits the lifetime of a local cached copy of the source, the value 
+  is in seconds;</listitem>
+  <listitem><code>get:proxy</code>: the proxy server to use, as "host:port" string.</listitem>
+</itemizedlist>
+<para>These defines are described also <link linkend="rdfinputgrab">here</link>. Note that all of them can be used in option list of "FROM ... OPTION (get:... )" extended SPARQL-BI syntax for FROM/FROM NAMED clause.
+</para>
+<para>Note that all of them can be used in option list of "FROM ... OPTION (get:... )" extended SPARQL-BI syntax for FROM/FROM NAMED clause.
+</para>
+</sect3>
+<sect3 id="rdfsparqlimplementatioptragmasccg"><title>Pragmas to control code generation</title>
+<itemizedlist mark="bullet">
+  <listitem><code>sql:assert-user</code>: defines the user who is supposed to be the single "proper" use 
+  for the query. If the compiler is launched by other user, an error is signaled. The typical use is 
+  define sql:assist-user "dba". This is too weak to be a security measure, but may help in debugging 
+  of security issues.</listitem>
+  <listitem><code>sql:gs-app-callback</code>: application-specific callback that returns permission 
+  bits of a given graph;</listitem>
+  <listitem><code>sql:gs-app-uid</code>: application-specific user id to use in callback.
+    <tip><title>See Also:</title>
+    <para><link linkend="rdfgraphsecurityappcallb">RDF Graph Security</link></para>
+  </tip>
+  </listitem>
+  <listitem><code>sql:globals-mode</code>: tells how to print names of global variables, supported 
+  values are "XSLT" (print colon before name of global variable and "SQL" (print as usual).</listitem>
+  <listitem><code>sql:log-enable</code>: value that will be passed to SPARUL procedures and there 
+  it will be passed to log_enable() BIF. Thus define sql:log-enable N will result in log_enable(N, 1) 
+  at the beginning of the operation and other log_enable() call will restore previous mode of 
+  transaction log at exit from the procedure or at any error signalled from it.</listitem>
+  <listitem><code>sql:table-option</code>: value will be added as an option to each triple in the 
+  query and later it will be printed in TABLE OPTION (...) clause of source table clause. This 
+  works only for SQL code for plain triples from RDF_QUAD, fragments of queries related to RDF 
+  Views will remain unchanged.</listitem>
+  <listitem><code>sql:select-option</code>: value will be added as an global OPTION () clause of 
+  the generated SQL SELECT. This clause is always printed, it is always at least OPTION (QUIETCAST, ...). 
+  The most popular use case is define sql:table-option "ORDER" to tell the SQL compiler execute joins 
+  in the order of their use in the query (this can make query compilation much faster but the 
+  compilation result can be terrible if you do not know precisely what you're doing and not inspected 
+  execution plan of the generated SQL query).</listitem>
+  <listitem><code>sql:describe-mode</code>: sets procedures that will produce the result of a DESCRIBE 
+  query. The pragma is ignored for other types of SPARQL queries. In the default mode, the result 
+  contains all X ?p ?o and all ?s ?p X triples for each given X. In "SPO" mode, the result contains 
+  X ?p ?o triples only. In "CBD" mode, the result contains concise bound descriptions of given 
+  subjects. Application developers may add more modes.</listitem>
+  <listitem><code>sql:signal-void-variables</code>: the most useful debugging variable if RDF Views 
+  are in use. It tells the SPARQL compiler to signal an error if it can prove that some variable can 
+  never be bound. Usually it means error in query, like typo in IRI or totally wrong triple 
+  pattern.</listitem> 
+</itemizedlist>
+</sect3>
+<sect3 id="rdfsparqlimplementatioptragmasctr"><title>Pragmas to control the type of the result</title>
+<itemizedlist mark="bullet">
+  <listitem><code>output:valmode</code>: tells the compiler which SQL datatypes should be used for 
+  output values. ODBC clients and the like known nothing about RDF and expect plain SQL values, 
+  so the appropriate value for them is "SQLVAL" and that's the default. When a Virtuoso/PL procedure 
+  is RDF-aware and keeps results for further passing to other SPARQL queries or some low-level RDF 
+  routines, the value "LONG" tells the compiler to preserve RDF boxes as is and to return IRI IDs 
+  instead of IRI string value. Third possible value, "AUTO", is for dirty hackers that do not want 
+  any conversion of any sort at the output to read the SQL output of SPARQL front-end, find the 
+  format of each column and add the needed conversions later. You will probably never need it.</listitem>
+  <listitem><code>output:format</code>: tells the compiler that the query should produce a string 
+  output with the serialization of the result, not a result set. There are three of them because 
+  the caller, like SPARQL web service endpoint, may not know the actual type of the query that 
+  should be executed. The value of output:format is used for SELECT and data manipulation queries, 
+  if specified, it can also be used for CONSTRUCT, DESCRIBE or ASK, if it is specified but related 
+  output:dict-format or output:scalar-format is not.</listitem>
+  <listitem><code>output:scalar-format</code>: tells the compiler that the query should produce a 
+  string output with the serialization of the result, not a result set. There are three of them 
+  because the caller, like SPARQL web service endpoint, may not know the actual type of the query 
+  that should be executed. The value of output:scalar-format is used for ASK queries only, if 
+  specified.</listitem>
+  <listitem><code>output:dict-format</code>: tells the compiler that the query should produce 
+  a string output with the serialization of the result, not a result set. There are three of 
+  them because the caller, like SPARQL web service endpoint, may not know the actual type of 
+  the query that should be executed. The value of output:dict-format is used for CONSTRUCT 
+  and DESCRIBE queries only, if specified.</listitem>
+</itemizedlist>
+</sect3>
+<sect3 id="rdfsparqlimplementatioptragmassfs"><title>Supported formats that return a string session</title>
+<itemizedlist mark="bullet">
+  <listitem>"RDF/XML",</listitem>
+  <listitem>"TURTLE" (and "TTL" is a synonym),</listitem>
+  <listitem>"JSON" (canonical JSON for result sets, Talis-style JSON for CONSTRUCT and DESCRIBE),</listitem>
+  <listitem>"JSON;ODATA" (oData-style JSON for CONSTRUCT and DESCRIBE, error otherwise),</listitem>
+  <listitem>"RDFA;XHTML" (only for CONSTRUCT and DESCRIBE, error otherwise),</listitem>
+  <listitem>"ATOM;XML" (only for CONSTRUCT and DESCRIBE as well).</listitem>
+</itemizedlist>
+</sect3>
+<sect3 id="rdfsparqlimplementatioptragmassdfs"><title>Supported formats that do not return a string 
+session to the caller</title>
+<para>Supported formats that do not return a string session to the caller, but form an HTTP response 
+	instead and send it directly to the client HTTP connection with an appropriate HTTP header:
+</para>
+<itemizedlist mark="bullet">
+  <listitem>"HTTP+XML mime/type",</listitem>
+  <listitem>"HTTP+TTL mime/type",</listitem>
+  <listitem>"HTTP+NT mime/type". A MIME type in value will be placed in the returned header, 
+  it should be separated from the starting keyword with one white space.</listitem>
+</itemizedlist>
+</sect3>
+<sect3 id="rdfsparqlimplementatioptragmassspfs"><title>Supported Special formats</title>
+<para>A special format "_JAVA_" is for SPARQL queries sent via JDBC. 
+	It changes only the output of ASK queries.
+</para>
+<para>Note: Pragmas output:valmode and output:format may conflict if used together, and if 
+	they're not in conflict then output:valmode is redundant: the compiler knows for sure which 
+	output:valmode-s are needed by various output:format-s.
+</para>
+<itemizedlist mark="bullet">
+  <listitem><code>output:route</code>: works only for SPARUL operators and tells the SPARQL compiler 
+  to generate procedure names that differ from default. As a result, the effect of operator will 
+  depend on application. That is for tricks. E.g., consider an application that extracts metadata 
+  from DAV resources stored in the Virtuoso and put them to RDF storage to make visible from outside. 
+  When a web application has permissions and credentials to execute a SPARUL query, the changed metadata 
+  can be written to the DAV resource (and after that the trigger will update them in the RDF storage), 
+  transparently for all other parts of application.</listitem>
+  <listitem><code>output:maxrows</code>: limits the number of rows in the returned result set. The 
+  integer value is expected, the positive integer value is obviously recommended.</listitem>
+</itemizedlist>
+</sect3>
+<sect3 id="rdfsparqlimplementatioptragmasmnotes"><title>Minor notes</title>
+<para>Values of most pragmas are strings. Exceptions are:
+</para>
+<itemizedlist mark="bullet">
+  <listitem>input:grab-depth,</listitem>
+  <listitem>input:grab-limit,</listitem>
+  <listitem>output:maxrows,</listitem>
+  <listitem>sql:log-enable,</listitem>
+  <listitem>sql:signal-void-variables</listitem>
+</itemizedlist>
+<para>that have integer values.
+</para>
+<para>Values of some pragmas a passed through the compiler to the run-time so they are seen in the 
+	generated SQL code as arguments of procedures:
+</para>
+<itemizedlist mark="bullet">
+  <listitem>get:method,</listitem>
+  <listitem>get:proxy,</listitem>
+  <listitem>get:query,</listitem>
+  <listitem>get:refresh,</listitem>
+  <listitem>get:soft,</listitem>
+  <listitem>get:uri</listitem>  
+</itemizedlist>
+<para>so sometimes you may meet them in SQL debuggers output and the like.
+</para>
+</sect3>
+</sect2>
+<sect2 id="rdfsparqlbif"><title>Built-in bif functions</title>
+<itemizedlist mark="bullet">
+  <listitem><emphasis>bif:__rdf_long_from_batch_params(i_nt integer, st_value, st2_value)</emphasis>
+    <itemizedlist mark="bullet">
+      <listitem>For value URI, the params values should be: 1, value.stringValue(), NULL</listitem>
+      <listitem>For value BNODE, the params values should be: 1, "_:"+((BNode)value).getID(), NULL</listitem>
+      <listitem>For value Literal with Language!=NULL, the params values should be: 5, lit.stringValue(), lit.getLanguage()</listitem>
+      <listitem>For value Literal with Datatype!=NULL, the params values should be: 4, lit.stringValue(), lit.getDatatype().toString()</listitem>
+      <listitem>For value Literal with Datatype==NULL && Language==NULL, the params values should be: 3, lit.stringValue(), NULL</listitem>
+      <listitem>For value any value exclude above, the params values should be: 3, value.stringValue(), NULL</listitem>
+      <listitem>For string value (without Datatype and Language), the params values should be: 3, value.stringValue(), NULL</listitem>
+    </itemizedlist>  
+    <para><emphasis>Example:</emphasis></para>
+<programlisting><![CDATA[
+SPARQL SELECT * 
+WHERE 
+  { graph ?g { `iri(??)` `iri(??)`
+    `bif:__rdf_long_from_batch_params(3,value.stringValue(),NULL)` }
+  }
+]]></programlisting>
+  </listitem>
+</itemizedlist>
+</sect2>
+</sect1>
 
-select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'Sizes differ', 1,
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i200, 1) ),
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i200, 1),
-    vector (#i101, #i201, #i301) ),
-  100
-);
 
-select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'Cardinality of a pred differ', 1,
-  vector (
-    vector (#i100, #i200, #ib300),
-    vector (#i101, #i200, #ib302),
-    vector (#i103, #i201, #ib304),
-    vector (#ib109, #i200, #ib109) ),
-  vector (
-    vector (#i100, #i200, #ib301),
-    vector (#i101, #i200, #ib303),
-    vector (#i103, #i201, #ib305),
-    vector (#ib109, #i201, #ib109) ),
-  100
-);
+<sect1 id="sparqlextensions"><title>Extensions</title>
+<sect2 id="rdfsparqlrulefulltext"><title>Using Full Text Search in SPARQL</title>
+<para>Virtuoso's triple store supports optional full text indexing of RDF object values since version 5.0.
+It is possible to declare that objects of triples with a given predicate or graph get indexed.
+The graphs and triples may be enumerated or a wildcard may be used.
+</para>
+<para>The triples for which a full text index entry exists can be found using the <emphasis>bif:contains</emphasis>
+or related filters and predicates.
+</para>
+<para>For example, the query:
+</para>
+<programlisting>
+SQL>SELECT *
+FROM <people>
+WHERE
+  {
+    ?s foaf:Name ?name . ?name bif:contains "'rich*'".
+  }
+</programlisting>
+<para>would match all subjects whose <emphasis>foaf:Name</emphasis> contained a word starting with Rich.
+This would match Richard, Richie etc.
+</para>
+<para>Note that words and phrases should be enclosed in quotes if they contain spaces or
+other non-alphanumeric chars.
+</para>
+<para>If the <emphasis>bif:contains</emphasis> or related predicate is applied to an object that is not
+a string or is not the object of an indexed triple, no match will be found.
+</para>
+<para>The syntax for text patterns is identical to the syntax for the SQL contains predicate.
+</para>
+<para>The SPARQL/SQL optimizer determines whether the text pattern will be used to drive the query or whether it
+will filter results after other conditions are applied first. In contrast to <emphasis>bif:contains</emphasis>,
+regexp matching never drives the query or makes use of an index, thus in practice regexps are checked after other conditions.
+</para>
+<sect3 id="rdfsparqlrulespecifywhatindex"><title>Specifying What to Index</title>
+<para>Whether the object of a given triple is indexed in the text index depends on indexing rules. If at least one
+indexing rule matches the triple, the object gets indexed if the object is a string. An indexing rule specifies
+a graph and a predicate. Either may be an IRI or NULL, in which case it matches all IRI's.
+</para>
+<para>Rules also have a 'reason', which can be used to group rules into application-specific sets. A triple will stop
+being indexed only after all rules mandating its indexing are removed. When an application requires indexing a
+certain set of triples, rules are added for that purpose. These rules are tagged with the name of the application
+as their reason. When an application no longer requires indexing, the rules belonging to this application can be
+removed. This will not turn off indexing if another application still needs certain triples to stay indexed.
+</para>
+<para>Indexing is enabled/disabled for specific graph/predicate combinations with:
+</para>
+<programlisting>
+create function DB.DBA.RDF_OBJ_FT_RULE_ADD
+  (in rule_g varchar, in rule_p varchar, in reason varchar) returns integer
+</programlisting>
+<programlisting>
+create function DB.DBA.RDF_OBJ_FT_RULE_DEL
+  (in rule_g varchar, in rule_p varchar, in reason varchar) returns integer
+</programlisting>
+<emphasis>Example:</emphasis>
+<para>The first function adds a rule. The first two arguments are the text representation of the IRI's for the graph
+and predicate. If NULL is given then all graph's or predicates match. Specifying both as NULL means that all
+string valued objects will be added to a text index.
+       </para>
+<emphasis>Example:</emphasis>
+<programlisting><![CDATA[
+DB.DBA.RDF_OBJ_FT_RULE_ADD (null, null, 'All');	
+]]></programlisting>
+<para>The second function reverses the effect of the first. Only a rule that has actually been added can be deleted.
+Thus one cannot say that all except a certain enumerated set should be indexed.
+</para>
+<programlisting><![CDATA[
+DB.DBA.RDF_OBJ_FT_RULE_DEL (null, null, 'All');
+]]></programlisting>
+<para>The reason argument is an arbitrary string identifying the application that needs this rule.
+Two applications can add the same rule.
+Removing one of them will still keep the rule in effect.
+If an object is indexed by more than one rule, the index data remain free from duplicates, neither index size nor speed is affected.
+</para>
+<para>
+If <emphasis>DB.DBA.RDF_OBJ_FT_RULE_ADD</emphasis> detects that <emphasis>DB.DBA.RDF_QUAD</emphasis> contains quads whose graphs and/or predicates match to the new rule but which have not been indexed before then these quads are indexed automatically.
+However the function <emphasis>DB.DBA.RDF_OBJ_FT_RULE_DEL</emphasis> does not remove indexing data about related objects.
+Thus the presence of indexing data about an object does not imply that it is necessarily used in some quad that matches to some rule.
+</para>
+<para>The above functions return one if the rule is added or deleted and zero if the call was redundant (the rule has been added before or there's no rule to delete).
+</para>
+<sect4 id="rdfsparqlrulespecifywhatindexexample"><title>Example</title>
+<programlisting><![CDATA[
 
-select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'Bnodes in O with unique SP (equiv)', 0,
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i201, #ib301),
-    vector (#i101, #i201, #ib301),
-    vector (#i102, #i202, #ib303),
-    vector (#ib303, #i204, #i306),
-    vector (#ib303, #i205, #ib305),
-    vector (#i100, #i200, 1) ),
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i201, #ib302),
-    vector (#i101, #i201, #ib302),
-    vector (#i102, #i202, #ib304),
-    vector (#ib304, #i204, #i306),
-    vector (#ib304, #i205, #ib306),
-    vector (#i100, #i200, 1) ),
-  100
-);
+-- We load Tim Berners-Lee's FOAF file into a graph called 'people'.
 
-select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'Bnodes in O with unique SP (diff 1)', 1,
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i201, #ib301),
-    vector (#i102, #i202, #ib303),
-    vector (#ib303, #i204, #i306),
-    vector (#ib303, #i205, #ib305),
-    vector (#i100, #i200, 1) ),
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i201, #ib302),
-    vector (#i102, #i202, #ib304),
-    vector (#ib304, #i204, #i306),
-    vector (#ib304, #i205, #i306),
-    vector (#i100, #i200, 1) ),
-  100
-);
+SQL>DB.DBA.RDF_LOAD_RDFXML (http_get ('http://www.w3.org/People/Berners-Lee/card#i'), 'no', 'http://www.w3.org/people#');
+Done. -- 172 msec.
 
-select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'Bnodes in O with unique SP (diff 2)', 1,
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i201, #ib301),
-    vector (#i102, #i202, #ib303),
-    vector (#ib303, #i204, #i306),
-    vector (#ib303, #i205, #ib305),
-    vector (#i100, #i200, 1) ),
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i201, #ib302),
-    vector (#i102, #i202, #ib304),
-    vector (#ib304, #i204, #i306),
-    vector (#ib304, #i205, #ib304),
-    vector (#i100, #i200, 1) ),
-  100
-);
+-- We check how many triples we got.
 
-select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'foaf-like-mix (equiv)', 0,
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i201, #ib301),
-    vector (#i100, #i201, #ib303),
-    vector (#i100, #i201, #ib305),
-    vector (#i100, #i201, #ib307),
-    vector (#ib301, #i202, 'Anna'),
-    vector (#ib303, #i202, 'Anna'),
-    vector (#ib305, #i202, 'Brigit'),
-    vector (#ib307, #i202, 'Clara'),
-    vector (#ib301, #i203, 'ann at ex.com'),
-    vector (#ib303, #i203, 'ann at am.com'),
-    vector (#ib305, #i203, 'root at ple.com'),
-    vector (#ib307, #i203, 'root at ple.com') ),
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i201, #ib302),
-    vector (#i100, #i201, #ib304),
-    vector (#i100, #i201, #ib306),
-    vector (#i100, #i201, #ib308),
-    vector (#ib302, #i202, 'Anna'),
-    vector (#ib304, #i202, 'Anna'),
-    vector (#ib306, #i202, 'Brigit'),
-    vector (#ib308, #i202, 'Clara'),
-    vector (#ib302, #i203, 'ann at ex.com'),
-    vector (#ib304, #i203, 'ann at am.com'),
-    vector (#ib306, #i203, 'root at ple.com'),
-    vector (#ib308, #i203, 'root at ple.com') ),
-  100
-);
+SQL>SPARQL SELECT COUNT (*) FROM <http://www.w3.org/people#> WHERE {?s ?p ?o};
+callret-0
+INTEGER
+ 266
+No. of rows in result: 1
 
-select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'foaf-like-mix (swapped names)', 1,
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i201, #ib301),
-    vector (#i100, #i201, #ib303),
-    vector (#i100, #i201, #ib305),
-    vector (#i100, #i201, #ib307),
-    vector (#ib301, #i202, 'Anna'),
-    vector (#ib303, #i202, 'Anna'),
-    vector (#ib305, #i202, 'Brigit'),
-    vector (#ib307, #i202, 'Clara'),
-    vector (#ib301, #i203, 'ann at ex.com'),
-    vector (#ib303, #i203, 'ann at am.com'),
-    vector (#ib305, #i203, 'root at ple.com'),
-    vector (#ib307, #i203, 'root at ple.com') ),
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i201, #ib302),
-    vector (#i100, #i201, #ib304),
-    vector (#i100, #i201, #ib306),
-    vector (#i100, #i201, #ib308),
-    vector (#ib302, #i202, 'Anna'),
-    vector (#ib304, #i202, 'Brigit'),
-    vector (#ib306, #i202, 'Anna'),
-    vector (#ib308, #i202, 'Clara'),
-    vector (#ib302, #i203, 'ann at ex.com'),
-    vector (#ib304, #i203, 'ann at am.com'),
-    vector (#ib306, #i203, 'root at ple.com'),
-    vector (#ib308, #i203, 'root at ple.com') ),
-  100
-);
+-- We check the GRAPH: <http://www.w3.org/people#> for objects like "Tim":
 
-select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'foaf-like-mix (swapped names)', 1,
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i201, #ib301),
-    vector (#i100, #i201, #ib303),
-    vector (#i100, #i201, #ib305),
-    vector (#i100, #i201, #ib307),
-    vector (#ib301, #i202, 'Anna'),
-    vector (#ib303, #i202, 'Anna'),
-    vector (#ib305, #i202, 'Brigit'),
-    vector (#ib307, #i202, 'Clara'),
-    vector (#ib301, #i203, 'ann at ex.com'),
-    vector (#ib303, #i203, 'ann at am.com'),
-    vector (#ib305, #i203, 'root at ple.com'),
-    vector (#ib307, #i203, 'root at ple.com') ),
-  vector (
-    vector (#i100, #i200, #i300),
-    vector (#i100, #i201, #ib302),
-    vector (#i100, #i201, #ib304),
-    vector (#i100, #i201, #ib306),
-    vector (#i100, #i201, #ib308),
-    vector (#ib302, #i202, 'Anna'),
-    vector (#ib304, #i202, 'Brigit'),
-    vector (#ib306, #i202, 'Anna'),
-    vector (#ib308, #i202, 'Clara'),
-    vector (#ib302, #i203, 'ann at ex.com'),
-    vector (#ib304, #i203, 'ann at am.com'),
-    vector (#ib306, #i203, 'root at ple.com'),
-    vector (#ib308, #i203, 'root at ple.com') ),
-  100
-);
+SQL>SPARQL
+SELECT *
+FROM <http://www.w3.org/people#>
+WHERE
+  {
+    ?s ?p ?o . FILTER (?o LIKE '%Tim%')
+  };
+s                                               p                                           o
+VARCHAR                                         VARCHAR                                     VARCHAR
+_______________________________________________________________________________
 
-select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'bnodes only (equiv that can not be proven)', 1,
-  vector (
-    vector (#ib101, #i200, #ib103),
-    vector (#ib103, #i201, #ib101) ),
-  vector (
-    vector (#ib102, #i200, #ib104),
-    vector (#ib104, #i201, #ib102) ),
-  100
-);
+http://www.w3.org/People/Berners-Lee/card#i     http://xmlns.com/foaf/0.1/name              Timothy Berners-Lee
+http://www.w3.org/People/Berners-Lee/card#i     http://xmlns.com/foaf/0.1/nick              TimBL
+http://www.w3.org/People/Berners-Lee/card#i     http://www.w3.org/2002/07/owl#sameAs        http://www4.wiwiss.fu-berlin.de/bookmashup/persons/Tim+Berners-Lee
+http://www.w3.org/People/Berners-Lee/card#i     http://xmlns.com/foaf/0.1/knows             http://dbpedia.org/resource/Tim_Bray
+http://www.w3.org/People/Berners-Lee/card#i     http://www.w3.org/2000/01/rdf-schema#label  Tim Berners-Lee
+http://www.w3.org/People/Berners-Lee/card#i     http://xmlns.com/foaf/0.1/givenname         Timothy
+http://dbpedia.org/resource/Tim_Bray            http://xmlns.com/foaf/0.1/name              Tim Bray
+no                                              http://purl.org/dc/elements/1.1/title       Tim Berners-Lee's FOAF file
 
-sparql clear graph <http://GraphCmp/One>;
+8 Rows. -- 230 msec.
 
-TTLP ('@prefix foaf: <http://i-dont-remember-it> .
-_:me
-	a foaf:Person ;
-	foaf:knows	[ foaf:nick "oerling" ; foaf:title "Mr." ; foaf:sha1 "abra" ] ;
-	foaf:knows	[ foaf:nick "kidehen" ; foaf:title "Mr." ; foaf:sha1 "bra" ] ;
-	foaf:knows	[ foaf:nick "aldo" ; foaf:title "Mr." ; foaf:sha1 "cada" ] .',
-'', 'http://GraphCmp/One' );
 
-sparql clear graph <http://GraphCmp/Two>;
-TTLP ('@prefix foaf: <http://i-dont-remember-it> .
-_:iv
-	foaf:knows	[ foaf:title "Mr." ; foaf:sha1 "cada" ; foaf:nick "aldo" ] ;
-	foaf:knows	[ foaf:sha1 "bra" ; foaf:title "Mr." ; foaf:nick "kidehen" ] ;
-	foaf:knows	[ foaf:nick "oerling" ; foaf:sha1 "abra" ; foaf:title "Mr." ] ;
-	a foaf:Person .',
-'', 'http://GraphCmp/Two' );
+-- We specify that all string objects in the graph 'people' should be text indexed.
 
-select DB.DBA.TEST_RDF_GRAPHS_DIFFER_EXP ( 'nonexisting graphs (equiv, of course)', 0,
-  'http://GraphCmp/NoSuch', 'http://GraphCmp/NoSuch',
-  100 );
+SQL>DB.DBA.RDF_OBJ_FT_RULE_ADD('http://www.w3.org/people#', null, 'people');
+Done. -- 130 msec.
 
-select DB.DBA.TEST_RDF_GRAPHS_DIFFER_EXP ( 'throughout test on foafs (equiv)', 0,
-  'http://GraphCmp/One', 'http://GraphCmp/Two',
-  100 );
+-- We update the text index.
 
-]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples12"><title>Example for Adding triples to graph</title>
-<programlisting><![CDATA[
-SQL>SPARQL
-INSERT INTO GRAPH <http://BookStore.com>
-{ <http://www.dajobe.org/foaf.rdf#i> <http://purl.org/dc/elements/1.1/title>  "SPARQL and RDF" .
-  <http://www.dajobe.org/foaf.rdf#i> <http://purl.org/dc/elements/1.1/date> <1999-01-01T00:00:00>.
-  <http://www.w3.org/People/Berners-Lee/card#i> <http://purl.org/dc/elements/1.1/title> "Design notes" .
-  <http://www.w3.org/People/Berners-Lee/card#i> <http://purl.org/dc/elements/1.1/date> <2001-01-01T00:00:00>.
-  <http://www.w3.org/People/Connolly/#me> <http://purl.org/dc/elements/1.1/title> "Fundamentals of Compiler Design" .
-  <http://www.w3.org/People/Connolly/#me> <http://purl.org/dc/elements/1.1/date> <2002-01-01T00:00:00>. };
-callret-0
-VARCHAR
-_________________________________________________________________
+SQL>DB.DBA.VT_INC_INDEX_DB_DBA_RDF_OBJ ();
+Done. -- 140 msec.
 
-Insert into <http://BookStore.com>, 6 triples -- done
+-- See impact of the index  by querying the subjects and predicates
+-- of all triples in the GRAPH: <http://www.w3.org/people#>,
+-- where the object is a string which contains a word beginning with "TIM".
 
-1 Rows. -- 0 msec.
-]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples13"><title>Example for Updating triples from graph</title>
-<para>A SPARQL/Update request that contains a triple to be deleted and a triple to be added (used here to correct a book title).
-</para>
-<programlisting><![CDATA[
-SQL>SPARQL
-MODIFY GRAPH <http://BookStore.com>
-DELETE
- { <http://www.w3.org/People/Connolly/#me>  <http://purl.org/dc/elements/1.1/title>  "Fundamentals of Compiler Design" }
-INSERT
- { <http://www.w3.org/People/Connolly/#me>  <http://purl.org/dc/elements/1.1/title>  "Fundamentals" };
-callret-0
-VARCHAR
+SQL>SPARQL SELECT * FROM <http://www.w3.org/people#> WHERE { ?s ?p ?o . ?o bif:contains '"Timo*"'};
+s                                               p                                     o
+VARCHAR                                         VARCHAR                               VARCHAR
 _______________________________________________________________________________
 
-Modify <http://BookStore.com>, delete 1 and insert 1 triples -- done
+ http://www.w3.org/People/Berners-Lee/card#i	http://xmlns.com/foaf/0.1/name	      Timothy Berners-Lee
+ http://www.w3.org/People/Berners-Lee/card#i	http://xmlns.com/foaf/0.1/givenname   Timothy
 
-1 Rows. -- 20 msec.
+2 Rows. -- 2 msec.
 ]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples14"><title>Example for Deleting triples from graph</title>
-<para>The example below has a request to delete all records of old books (dated before year 2000)
+<para>
+The query below is identical with that above but uses a different syntax.
+The filter syntax is more flexible in that it allows passing extra options to the <emphasis>contains</emphasis> predicate. These may be useful in the future.
 </para>
 <programlisting><![CDATA[
-SQL>SPARQL
-PREFIX dc:  <http://purl.org/dc/elements/1.1/>
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-DELETE FROM GRAPH <http://BookStore.com> { ?book ?p ?v }
-WHERE
-  { GRAPH  <http://BookStore.com>
-   { ?book dc:date ?date
-     FILTER ( xsd:dateTime(?date) < xsd:dateTime("2000-01-01T00:00:00")).
-    ?book ?p ?v.
-   }
-  };
-_______________________________________________________________________________
-
-Delete from <http://BookStore.com>, 6 triples -- done
-
-1 Rows. -- 10 msec.
+SQL>SPARQL SELECT * FROM <people> WHERE { ?s ?p ?o . FILTER (bif:contains(?o,  '"Timo*"')) };
 ]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples15"><title>Example for Copying triples from one graph to another</title>
-<para>The next snippet copies records from one named graph to another based on a pattern:
+</sect4>
+<note><title>Note:</title><para>It is advisable to upgrade to the latest version of Virtuoso before adding free-text rules for the first time.
+This is especially the case if large amounts of text are to be indexed. The reason is that the free-text index on RDF may be changed in future versions
+and automatic upgrading of an existing index data into the new format may take much more time than indexing from scratch.</para></note>
+<para>The table <emphasis>DB.DBA.RDF_OBJ_FT_RULES</emphasis> stores list of free-text index configuration rules.
 </para>
 <programlisting><![CDATA[
-SQL>SPARQL clear graph <http://BookStore.com>;
-SQL>SPARQL clear graph <http://NewBookStore.com>;
-SQL>SPARQL
-insert in graph <http://BookStore.com>
-  {
-    <http://www.dajobe.org/foaf.rdf#i> <http://purl.org/dc/elements/1.1/date> <1999-04-01T00:00:00> .
-    <http://www.w3.org/People/Berners-Lee/card#i> <http://purl.org/dc/elements/1.1/date> <1998-05-03T00:00:00> .
-    <http://www.w3.org/People/Connolly/#me> <http://purl.org/dc/elements/1.1/date> <2001-02-08T00:00:00>
-  };
-SQL>SPARQL
-PREFIX dc:  <http://purl.org/dc/elements/1.1/>
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-INSERT INTO GRAPH <http://NewBookStore.com> { ?book ?p ?v }
-WHERE
-  { GRAPH  <http://BookStore.com>
-   { ?book dc:date ?date
-     FILTER ( xsd:dateTime(?date) > xsd:dateTime("2000-01-01T00:00:00")).
-     ?book ?p ?v.
-   }
-  };
-callret-0
-VARCHAR
-_______________________________________________________________________________
-
-Insert into <http://NewBookStore.com>, 6 triples -- done
-
-1 Rows. -- 30 msec.
+create table DB.DBA.RDF_OBJ_FT_RULES (
+  ROFR_G varchar not null,       -- specific graph IRI or NULL for "all graphs"
+  ROFR_P varchar not null,       -- specific predicate IRI or NULL for "all predicates"
+  ROFR_REASON varchar not null,  -- identification string of a creator, preferably human-readable
+  primary key (ROFR_G, ROFR_P, ROFR_REASON) );
 ]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples16"><title>Example for Moving triples from one graph to another</title>
-<para>This example moves records from one named graph to another named graph based on a pattern:
+<para>
+Applications may read from this table but they should not write to it directly.
+Duplications in the rules do not affect the speed of free-text index operations because the content of the table is cached in memory in a special form.
+Unlike the use of configuration functions, directly writing to the table will not update the in-memory cache.
+</para>
+<para>
+The table is convenient to search for rules added by a given application.
+If a unique identification string is used during installation of an application when rules are added then it's easy to remove those rules
+as part of any uninstall routine.
+</para>
+   </sect3>
+<sect3 id="rdfsparqlruletimeindexing"><title>Time of Indexing</title>
+<para>The triple store's text index is in manual batch mode by default. This means that changes in triples are periodically
+reflected in the text index but are not maintained in strict synchrony. This is much more efficient than keeping the
+indices in constant synchrony. This setting may be altered with the <emphasis>db.dba.vt_batch_update</emphasis> stored procedure.
+</para>
+<para>To force synchronization of the RDF text index, use:
+</para>
+<programlisting>
+DB.DBA.VT_INC_INDEX_DB_DBA_RDF_OBJ ();
+</programlisting>
+<para>To set the text index to follow the triples in real time, use:
+</para>
+<programlisting>
+DB.DBA.VT_BATCH_UPDATE ('DB.DBA.RDF_OBJ', 'OFF', null);
+</programlisting>
+<para>To set the text index to be updated every 10 minutes, use:
+</para>
+<programlisting>
+DB.DBA.VT_BATCH_UPDATE ('DB.DBA.RDF_OBJ', 'ON', 10);
+</programlisting>
+<para>To make the update always manual, specify NULL as the last argument above.
+</para>
+<para>
+One problem related to free-text indexing of <emphasis>DB.DBA.RDF_QUAD</emphasis> is that some applications (e.g. those that import billions of triples) may set off triggers.
+This will make free-text index data incomplete.
+Calling procedure <emphasis>DB.DBA.RDF_OBJ_FT_RECOVER ()</emphasis> will insert all missing free-text index items by dropping and re-inserting every existing free-text index rule.
+</para>
+</sect3>
+<sect3 id="rdfviewsandfreetext"><title>Free-Text Indexes on RDF Views</title>
+<para>
+If an <emphasis>O</emphasis> field of a quad map pattern gets its value from a database column that has a free text index then this index can be used in SPARQL for efficient text searching. As a variation of this facility, the free-text index of another table may be used.
+</para>
+<para>
+If a statement of a quad map pattern declaration starts with a declaration of table aliases, the table alias declaration may include the name of a table column that should have a text index.
+For example, consider the possibility of using a free-text index on the content of DAV resources stored in the DAV system tables of Virtuoso:
 </para>
 <programlisting><![CDATA[
-SQL>SPARQL
-PREFIX dc:  <http://purl.org/dc/elements/1.1/>
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-
-INSERT INTO GRAPH <http://NewBookStore.com>
- { ?book ?p ?v }
-WHERE
-  { GRAPH  <http://BookStore.com>
-     { ?book dc:date ?date .
-       FILTER ( xsd:dateTime(?date) > xsd:dateTime("2000-01-01T00:00:00")).
-       ?book ?p ?v.
-     }
-  };
-_______________________________________________________________________________
-
-Insert into <http://NewBookStore.com>, 6 triples -- done
-
-1 Rows. -- 10 msec.
-
-SQL>SPARQL
-PREFIX dc:  <http://purl.org/dc/elements/1.1/>
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-DELETE FROM GRAPH <http://BookStore.com>
- { ?book ?p ?v }
-WHERE
-  { GRAPH  <http://BookStore.com>
-      { ?book dc:date ?date .
-        FILTER ( xsd:dateTime(?date) > xsd:dateTime("2000-01-01T00:00:00")).
-        ?book ?p ?v.
-      }
-  };
-_______________________________________________________________________________
-
-Delete from <http://BookStore.com>, 3 triples -- done
-
-1 Rows. -- 10 msec.
-]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples17"><title>Example for BBC SPARQL Collection</title>
-<programlisting><![CDATA[
-## All programmes related to James Bond:
-PREFIX po: <http://purl.org/ontology/po/>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-SELECT ?uri ?label
-WHERE
+prefix mydav: <...>
+create quad storage mydav:metadata
+FROM WS.WS.SYS_DAV_RES as dav_resource text literal RES_CONTENT
+...
   {
-    ?uri po:category
-      <http://www.bbc.co.uk/programmes/people/bmFtZS9ib25kLCBqYW1lcyAobm8gcXVhbGlmaWVyKQ#person> ;
-    rdfs:label ?label.
-   }
+    ...
+    mydav:resource-iri (dav_resource.RES_FULL_PATH)
+        a mydav:resource ;
+        mydav:resource-content dav_resource.RES_CONTENT ;
+        mydav:resource-mime-type dav_resource.RESTYPE ;
+    ...
+  }
 ]]></programlisting>
-
+<para>
+The clause <emphasis>text literal RES_CONTENT</emphasis> grants the SPARQL compiler permission to use a free-text index for objects that are literals composed from column <emphasis>dav_resource.RES_CONTENT</emphasis>. This clause also allows choosing between <emphasis>text literal</emphasis> (supports only the <emphasis>contains()</emphasis> predicate) and <emphasis>text xml literal</emphasis> (supports both <emphasis>contains()</emphasis> and <emphasis>xcontains()</emphasis>) text indexes.
+It is important to understand that the free-text index will produce results using raw relational data.
+If a literal class transformation changes the text stored in the column then these changes are ignored by free-text search.
+e.g. if a transformation concatenates a word to the value of the column, but the free-text search will not find this word.
+</para>
+<para>
+The free-text index may be used in a more sophisticated way. Consider a built-in table <emphasis>DB.DBA.RDF_QUAD</emphasis> that does not have a free-text index.
+Moreover, the table does not contain the full values of all objects; the <emphasis>O</emphasis> column contains "short enough" values inlined, but long and special values are represented by links to the <emphasis>DB.DBA.RDF_OBJ</emphasis> table.
+The RDF_OBJ table, however, has free-text index that can be used.
+The full declaration of the built-in default mapping for default storage could be written this way:
+   </para>
 <programlisting><![CDATA[
-## Find all Eastenders broadcasta after 2009-01-01,
-## along with the broadcast version & type
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>
-PREFIX po: <http://purl.org/ontology/po/>
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-SELECT ?version_type ?broadcast_start
-WHERE
+-- Important! Do not try to execute on live system
+-- without first changing the quad storage and quad map pattern names!
+
+SPARQL
+create virtrdf:DefaultQuadMap as
+graph rdfdf:default-iid-nonblank (DB.DBA.RDF_QUAD.G)
+subject rdfdf:default-iid (DB.DBA.RDF_QUAD.S)
+predicate rdfdf:default-iid-nonblank (DB.DBA.RDF_QUAD.P)
+object rdfdf:default (DB.DBA.RDF_QUAD.O)
+
+create quad storage virtrdf:DefaultQuadStorage
+FROM DB.DBA.RDF_QUAD as physical_quad
+FROM DB.DBA.RDF_OBJ as physical_obj text xml literal RO_DIGEST of (physical_quad.O)
+WHERE (^{physical_quad.}^.O = ^{physical_obj.}^.RO_DIGEST)
   {
-    <http://www.bbc.co.uk/programmes/b006m86d#programme> po:episode ?episode .
-    ?episode po:version ?version .
-    ?version a ?version_type .
-    ?broadcast po:broadcast_of ?version .
-    ?broadcast event:time ?time .
-    ?time tl:start ?broadcast_start .
-    FILTER ( (?version_type != <http://purl.org/ontology/po/Version>)
-    && (?broadcast_start > "2009-01-01T00:00:00Z"^^xsd:dateTime) )
-  }
+    create virtrdf:DefaultQuadMap as
+      graph rdfdf:default-iid-nonblank (physical_quad.G)
+      subject rdfdf:default-iid (physical_quad.S)
+      predicate rdfdf:default-iid-nonblank (physical_quad.P)
+      object rdfdf:default (physical_quad.O) .
+ }
+;
 ]]></programlisting>
-
+<para>
+The reference to the free-text index is extended by clause <emphasis> of (physical_quad.O)</emphasis>.
+This means that the free-text on <emphasis>DB.DBA.RDF_OBJ.RO_DIGEST</emphasis> will be used when the object value comes from <emphasis>physical_quad.O</emphasis> as if <emphasis>physical_quad.O</emphasis> were indexed itself.
+If a SPARQL query invokes <emphasis>virtrdf:DefaultQuadMap</emphasis> but contains no free-text criteria then only <emphasis>DB.DBA.RDF_QUAD</emphasis> appears in the final SQL statement and no join with <emphasis>DB.DBA.RDF_OBJ</emphasis> is made.
+Adding a free-text predicate will add <emphasis>DB.DBA.RDF_OBJ</emphasis> to the list of source tables and a join condition for <emphasis>DB.DBA.RDF_QUAD.O</emphasis> and <emphasis>DB.DBA.RDF_OBJ.RO_DIGEST</emphasis>; and it will add <emphasis>contains (RO_DIGEST, ...)</emphasis> predicate, rather than <emphasis>contains (O, ...)</emphasis>.
+As a result, "you pay only for what you use": adding free-text index to the declaration does not add tables to the query unless the index is actually used.
+</para>
+<para>
+Boolean functions <function>bif:contains</function> and <function>bif:xcontains</function> are used for objects that come from RDF Views as well as for regular "physical" triples.
+Every function takes two arguments and returns a boolean value. The first argument is an local variable.
+The argument variable should be used as an object field in the group pattern where the filter condition is placed.
+Moreover, the occurrence of the variable in an object field should be placed <emphasis>before</emphasis> the filter.
+If there are many occurrences of the variable in object fields then the free-text search is associated with the rightmost occurrence that is still to the left of the filter.
+The triple pattern that contains the rightmost occurrence is called the "intake" of the free-text search.
+When the SPARQL compiler chooses the appropriate quad map patterns that may generate data matching the intake triple pattern, it skips quad map patterns that have no declared free-text indexes, because nothing can be found by free-text search in data that have no free-text index.
+Every quad map pattern that has a free-text pattern will ultimately produce an invocation of the SQL <link linkend="containspredicate">contains</link> or <link linkend="xcontainspredicate">xcontains</link> predicate, so the final result of a free-text search may be a union of free-text searches from different quad map patterns.
+</para>
+<para>
+The described logic is important only in very complicated cases, whereas simple queries are self-evident:
+   </para>
 <programlisting><![CDATA[
-## Find all programmes that featured both the Foo Fighters and Al Green
-PREFIX po: <http://purl.org/ontology/po/>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX mo: <http://purl.org/ontology/mo/>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-SELECT DISTINCT ?programme ?label
-WHERE
-  {
-    ?event1 po:track ?track1 .
-    ?track1 foaf:maker ?maker1 .
-    ?maker1 owl:sameAs
-       <http://www.bbc.co.uk/music/artists/67f66c07-6e61-4026-ade5-7e782fad3a5d#artist> .
-    ?event2 po:track ?track2 .
-    ?track2 foaf:maker ?maker2 .
-    ?maker2 owl:sameAs
-       <http://www.bbc.co.uk/music/artists/fb7272ba-f130-4f0a-934d-6eeea4c18c9a#artist> .
-    ?event1 event:time ?t1 .
-    ?event2 event:time ?t2 .
-    ?t1 tl:timeline ?tl .
-    ?t2 tl:timeline ?tl .
-    ?version po:time ?t .
-    ?t tl:timeline ?tl .
-    ?programme po:version ?version .
-    ?programme rdfs:label ?label .
-  }
+SELECT * FROM <my-dav-graph>
+WHERE {
+    ?resource a mydav:resource ;
+        mydav:resource-content ?text .
+    FILTER (bif:contains (?text, "hello and world")) }
 ]]></programlisting>
-
+<para>
+or, more succinctly,
+   </para>
 <programlisting><![CDATA[
-## Get short synopsis' of EastEnders episodes
-PREFIX po: <http://purl.org/ontology/po/>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-SELECT ?t ?o
-WHERE
-  {
-    <http://www.bbc.co.uk/programmes/b006m86d#programme> po:episode ?e .
-    ?e a po:Episode .
-    ?e po:short_synopsis ?o .
-    ?e dc:title ?t
-  }
+SELECT * FROM <my-dav-graph>
+WHERE {
+    ?resource a mydav:resource ;
+        mydav:resource-content ?text .
+    ?text bif:contains "hello and world" . }
 ]]></programlisting>
-
+</sect3>
+<sect3 id="rdfsparqlrulescoreexmp"><title>Example Using Score</title>
 <programlisting><![CDATA[
-## Get short synopsis' of EastEnders episodes (with graph)
-PREFIX po: <http://purl.org/ontology/po/>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-SELECT ?g ?t ?o
+SQL>
+SPARQL
+SELECT *
 WHERE
   {
-    graph ?g
-      {
-         <http://www.bbc.co.uk/programmes/b006m86d#programme> po:episode ?e .
-         ?e a po:Episode .
-         ?e po:short_synopsis ?o .
-         ?e dc:title ?t
-      }
+    ?s ?p ?o .
+    ?o bif:contains 'NEW AND YORK'
+    OPTION (score ?sc) .
   }
-]]></programlisting>
+ORDER BY DESC (?sc)
+LIMIT 10
+
+s                                                                        p                                               o                                                sc
+ANY                                                                      ANY                                             ANY 	                                          ANY
+______________________________________________________________________________________________________________________________________________________________________________
+
+http://dbpedia.org/resource/New_York%2C_New_York_%28disambiguation%29	 http://www.w3.org/2000/01/rdf-schema#comment	 New York, New York, New York kentini........     88
+http://dbpedia.org/resource/New_York%2C_New_York_%28disambiguation%29	 http://dbpedia.org/property/abstract	         New York, New York, New York kentinin re....     88
+http://newyorkjobs.wordpress.com/2006/07/10/new-york-jobs-71006	         http://purl.org/dc/elements/1.1/description	 York Marketing Jobs New York Retail Jobs....     84
+http://dbpedia.org/resource/Global_Communication	                 http://dbpedia.org/property/contenu	         A - New York, New York (Headfuq Mix) B1 ....     84
+http://dbpedia.org/resource/New_York_%28disambiguation%29	         http://www.w3.org/2000/01/rdf-schema#comment	 New York a^?? New York amerikai vA~?ros ....     76
+http://dbpedia.org/resource/New_York_%28disambiguation%29	         http://dbpedia.org/property/abstract	         New York a^?? New York amerikai vA~?ros ....     76
+http://dbpedia.org/resource/New_York_%28disambiguation%29	         http://www.w3.org/2000/01/rdf-schema#comment	 New York ima lahko naslednje pomene: New ...     74
+http://dbpedia.org/resource/New_York_%28disambiguation%29	         http://dbpedia.org/property/abstract	         New York ima lahko naslednje pomene: New ...     74
+http://dbpedia.org/resource/New_York_College	                         http://www.w3.org/2000/01/rdf-schema#comment	 There are several colleges of New York t ...     72
+http://dbpedia.org/resource/New_York_College	                         http://dbpedia.org/property/abstract	         There are several colleges of New York t ...     72
+No. of rows in result: 10
 
+]]></programlisting>
+</sect3>
+</sect2>
+<sect2 id="rdfsparul"><title>SPARUL -- an Update Language For RDF Graphs</title>
+     <sect3 id="rdfsparulintro"><title>Introduction</title>
+       <para>Starting with version 5.0, Virtuoso supports the
+<ulink url="http://jena.hpl.hp.com/~afs/SPARQL-Update.html">SPARQL/Update</ulink> extension to SPARQL.
+This is sufficient for most of routine data manipulation operations. If the <emphasis>SPARQL_UPDATE</emphasis>
+role is granted to user <emphasis>SPARQL</emphasis> user then data manipulation statements may be
+executed via the SPARQL web service endpoint as well as by data querying.
+       </para>
+     </sect3>
+     <sect3 id="rdfsparulfunc"><title>Manage RDF Storage</title>
+       <para>Two functions allow the user to alter RDF storage by inserting or deleting all
+triples listed in some vector. Both functions receive the IRI of the graph that should be altered and
+a vector of triples that should be added or removed. The graph IRI can be either an IRI ID or a string.
+The third optional argument controls the transactional behavior - the parameter value is
+passed to the <link linkend="fn_log_enable"><function>log_enable</function></link> function.
+The return values of these functions are not defined and should not be used by applications.
+       </para>
+       <programlisting>
+create function DB.DBA.RDF_INSERT_TRIPLES (in graph_iri any, in triples any, in log_mode integer := null)
+create function DB.DBA.RDF_DELETE_TRIPLES (in graph_iri any, in triples any, in log_mode integer := null)
+       </programlisting>
+       <para>Simple operations may be faster if written as low-level SQL code instead of using SPARUL.
+The use of SPARQL DELETE is unnecessary in cases where the better alternative is for the application to delete from RDF_QUAD
+using simple SQL filters like:
+       </para>
+       <programlisting>
+DELETE FROM DB.DBA.RDF_QUAD
+WHERE G = DB.DBA.RDF_MAKE_IID_OF_QNAME (
+    'http://local.virt/DAV/sparql_demo/data/data-xml/source-simple2/source-data-01.rdf' );
+       </programlisting>
+       <para>On the other hand, simple filters does not work when the search criteria refer to triples
+that are affected by the modification. Consider a function that deletes all triples whose subjects
+are nodes of type 'http://xmlns.com/foaf/0.1/Person'. Type information is stored in triples that
+will be deleted, so the simplest function is something like this:
+       </para>
 <programlisting><![CDATA[
-## Get reviews where John Paul Jones' has been involved
+create procedure DELETE_PERSONAL_DATA (in foaf_graph varchar)
+{
+  declare pdata_dict, pdata_array any;
+-- Step 1: select everything that should be deleted
+  pdata_dict := ((
+      sparql construct { ?s ?p ?o }
+      WHERE { graph ?:foaf_graph {
+              ?s ?p ?o . ?s rdf:type <http://xmlns.com/foaf/0.1/Person>
+            } }
+      ));
+-- Step 2: delete all found triples
+  pdata_array := dict_list_keys (pdata_dict, 1);
+  RDF_DELETE_TRIPLES (foaf_graph, pdata_array);
+};
 
-PREFIX mo: <http://purl.org/ontology/mo/>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX rev: <http://purl.org/stuff/rev#>
-PREFIX po: <http://purl.org/ontology/po/>
-SELECT DISTINCT ?r_name, ?rev
-WHERE
-  {
-    {
-      <http://www.bbc.co.uk/music/artists/4490113a-3880-4f5b-a39b-105bfceaed04#artist> foaf:made ?r1 .
-      ?r1 a mo:Record .
-      ?r1 dc:title ?r_name .
-      ?r1 rev:hasReview ?rev
-    }
-    UNION
-    {
-      <http://www.bbc.co.uk/music/artists/4490113a-3880-4f5b-a39b-105bfceaed04#artist> mo:member_of ?b1 .
-      ?b1 foaf:made ?r1 .
-      ?r1 a mo:Record .
-      ?r1 dc:title ?r_name .
-      ?r1 rev:hasReview ?rev
-    }
-  }
+DELETE_PERSONAL_DATA (
+  'http://local.virt/DAV/sparql_demo/data/data-xml/source-simple2/source-data-01.rdf' );
 ]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples18"><title>Example usage of IN operator for retrieving all triples for each entity</title>
-<para>To retrieve all triples for each entity for a given list of entities uris, one might use the following syntax:</para>
+       <para>From Virtuoso 5.0 onwards, applications can use SPARUL to do the same in a more convenient way:
+       </para>
 <programlisting><![CDATA[
-SELECT ?p ?o
-WHERE
+create procedure DELETE_PERSONAL_DATA (in foaf_graph varchar)
   {
-    ?s ?p ?o .
-    FILTER ( ?s IN (<someGraph#entity1>, <someGraph#entity2>, ...<someGraph#entityN> ) )
-  }
+  sparql delete { ?s ?p ?o }
+      WHERE { graph ?:foaf_graph {
+              ?s ?p ?o . ?s rdf:type <http://xmlns.com/foaf/0.1/Person>
+            } }
+};
 ]]></programlisting>
-<para>So to demonstrate this feature, execute the following query:
-</para>
+     </sect3>
+     <sect3 id="rdfsparulexamples"><title>Examples</title>
+     <sect4 id="rdfsparulexamples1"><title>Example for changing the graph</title>
+       <para>The graph to be changed may be specified by an option preceding of query, instead
+of being specified in the 'insert into graph' clause.
+       </para>
 <programlisting><![CDATA[
-SQL>SPARQL
-SELECT DISTINCT ?p ?o
-WHERE
-  {
-    ?s ?p ?o .
-    FILTER ( ?s IN (<http://dbpedia.org/resource/Climate_change>, <http://dbpedia.org/resource/Social_vulnerability> ) )
-  }
-LIMIT 100
-
-p    	                                                o
-ANY                                                     ANY
+SQL>SPARQL DEFINE input:default-graph-uri <http://mygraph.com>
+INSERT INTO <http://mygraph.com> { <http://myopenlink.net/dataspace/Kingsley#this> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User> };
+callret-0
+VARCHAR
 _______________________________________________________________________________
 
-http://www.w3.org/1999/02/22-rdf-syntax-ns#type 	http://s.zemanta.com/ns#Target
-http://s.zemanta.com/ns#title 	                        Climate change
-http://s.zemanta.com/ns#targetType 	                http://s.zemanta.com/targets#rdf
+Insert into <http://mygraph.com>, 1 triples -- done
 
-3 Rows. -- 10 msec.
+1 Rows. -- 20 msec.
 ]]></programlisting>
-  <tip><title>See Also:</title>
-    <para><link linkend="rdfsparulexamples6">Example usage of IN operator.</link></para>
-  </tip>
-</sect5>
-<sect5 id="rdfsparulexamples19"><title>Example for extending SPARQL via SQL for Full Text search: Variant I</title>
-<para>To find all albums looked up by album name, one might use the following syntax:</para>
+</sect4>
+<sect4 id="rdfsparulexamples2"><title>Example for delete graph equivalents</title>
+       <para>The following two statements are equivalent but the latter may work faster, especially
+if there are many RDF views in the system or if the graph in question contains triples from RDF views.
+Note that neither of these two statements affects data coming from RDF views.
+</para>
 <programlisting><![CDATA[
-SQL>SPARQL
-SELECT ?s ?o ?an ( bif:search_excerpt ( bif:vector ( 'In', 'Your' ) , ?o ) ) 
-WHERE 
-  {
-    ?s rdf:type mo:Record .
-    ?s foaf:maker ?a .
-    ?a foaf:name ?an .
-    ?s dc:title ?o .
-    FILTER ( bif:contains ( ?o, '"in your"' ) ) 
-  }
-LIMIT 10;
+SQL> SPARQL DELETE FROM GRAPH <http://mygraph.com> { ?s ?p ?o } FROM <http://mygraph> WHERE { ?s ?p ?o };
+callret-0
+VARCHAR
+_______________________________________________________________________________
 
+Delete from <http://mygraph.com>, 1 triples -- done
 
-http://musicbrainz.org/music/record/30f13688-b9ca-4fa5-9430-f918e2df6fc4  China in Your Hand  	          Fusion  China             <b>in</b> <b>Your</b> Hand.
-http://musicbrainz.org/music/record/421ad738-2582-4512-b41e-0bc541433fbc 	China in Your Hand 	            T'Pau 	China             <b>in</b> <b>Your</b> Hand.
-http://musicbrainz.org/music/record/01acff2a-8316-4d4b-af93-97289e164379 	China in Your Hand 	            T'Pau 	China             <b>in</b> <b>Your</b> Hand.
-http://musicbrainz.org/music/record/4fe99b06-ac73-40dd-8be7-bdaefb014981 	China in Your Hand 	            T'Pau 	China             <b>in</b> <b>Your</b> Hand.
-http://musicbrainz.org/music/record/ac1cb011-6040-4515-baf2-59551a9884ac 	In Your Hands 	                Stella One Eleven 	      <b>In</b> <b>Your</b> Hands.
-http://dbtune.org/magnatune/album/mercy-inbedinst 	                      In Your Bed - instrumental mix 	Mercy Machine 	          <b>In</b> <b>Your</b> Bed mix.
-http://musicbrainz.org/music/record/a09ae12e-3694-4f68-bf25-f6ff4f790962 	A Word in Your Ear 	Alfie 	    A Word <b>in</b>          <b>Your</b> Ear.
-http://dbtune.org/magnatune/album/mercy-inbedremix 	                      In Your Bed - the remixes 	    Mercy Machine 	          <b>In</b> <b>Your</b> Bed the remixes.
-http://musicbrainz.org/music/record/176b6626-2a25-42a7-8f1d-df98bec092b4 	Smoke Gets in Your Eyes 	      The Platters 	Smoke Gets  <b>in</b> <b>Your</b> Eyes.
-http://musicbrainz.org/music/record/e617d90e-4f86-425c-ab97-efdf4a8a452b 	Smoke Gets in Your Eyes 	      The Platters 	Smoke Gets  <b>in</b> <b>Your</b> Eyes.
-	]]></programlisting>
-<para>Note that the query will not show anything when there are triples like:</para>
-<programlisting><![CDATA[
-<x> <y> "In" 
-<z> <q> "Your"		
+1 Rows. -- 10 msec.
+
+SQL> SPARQL CLEAR GRAPH <http://mygraph.com>;
+callret-0
+VARCHAR
+__________________________________________________________
+
+Clear <http://mygraph.com> -- done
+
+1 Rows. -- 10 msec.
 ]]></programlisting>
-	
-</sect5>
-<sect5 id="rdfsparulexamples20"><title>Example for extending SPARQL via SQL for Full Text search: Variant II</title>
-<para>To get movies from DBpedia, where the query can contain terms from the title, 
-one might use the following syntax:</para>
+</sect4>
+<sect4 id="rdfsparulexamples3"><title>Example for deleting all triples for given subject</title>
+<para>The following statement deletes all records with <http://myopenlink.net/dataspace/Kingsley#this> as the subject:</para>
 <programlisting><![CDATA[
 SQL>SPARQL
- SELECT ?s ?an ?dn ?o( bif:search_excerpt ( bif:vector ( 'Broken', 'Flowers' ) , ?o ) ) 
- WHERE
-  {
-    ?s rdf:type dbpedia-owl:Film .
-    ?s dbpprop:name ?o .
-    FILTER ( bif:contains ( ?o, '"broken flowers"' ) )
-    OPTIONAL { ?s dbpprop:starring ?starring .}
-    OPTIONAL { ?s dbpprop:director ?director . }
-    OPTIONAL { ?starring dbpprop:name ?an . }
-    OPTIONAL { ?director dbpprop:name ?dn . }
-  };
+DELETE FROM GRAPH <http://mygraph.com> { ?s ?p ?o }
+ FROM <http://mygraph.com>
+WHERE { ?s ?p ?o . filter ( ?s = <http://myopenlink.net/dataspace/Kingsley#this>) };
+callret-0
+VARCHAR
+_______________________________________________________________________________
 
+Delete from <http://mygraph.com>, 1 triples -- done
 
-http://dbpedia.org/resource/Broken_Flowers  Tilda Swinton  	Jim Jarmusch  	Broken Flowers  	          <b>Broken</b> <b>Flowers</b>.
-http://dbpedia.org/resource/Broken_Flowers 	Swinton, Tilda 	Jim Jarmusch 	  Broken Flowers 	            <b>Broken</b> <b>Flowers</b>.
-....
-http://dbpedia.org/resource/Broken_Flowers  Bill Murray  	  Jim Jarmusch  	Music from Broken Flowers  	Music from <b>Broken</b> <b>Flowers</b>.
-....
-		]]></programlisting>
-<para>Note that the query will not show anything when there are triples like:</para>
+1 Rows. -- 10 msec.
+]]></programlisting>
+<para>Alternatively, the statement can be written in this way:</para>
 <programlisting><![CDATA[
-<x> <y> "Broken" 
-<z> <q> "Flowers"		
+SQL>SPARQL
+DELETE FROM GRAPH <http://mygraph.com> { <http://myopenlink.net/dataspace/Kingsley#this> ?p ?o }
+ FROM <http://mygraph.com>
+WHERE { <http://myopenlink.net/dataspace/Kingsley#this> ?p ?o };
+callret-0
+VARCHAR
+_______________________________________________________________________________
+
+Delete from <http://mygraph.com>, 1 triples -- done
+
+1 Rows. -- 10 msec.
 ]]></programlisting>
-</sect5>
-<sect5 id="rdfsparulexamples21"><title>Example for date manipulation of xsd types within SPARQL</title>
-<para>This example shows usage of dateTime column truncation to date only
-and performs a group by on this column:
+</sect4>
+<sect4 id="rdfsparulexamples4"><title>Example for INSERT statements equivalent</title>
+       <para>Keywords 'insert in' and 'insert into' are interchangeable in Virtuoso for backward
+compatibility, but the SPARUL specification lists only 'insert into'. For example,
+the statements below are equivalent:
 </para>
 <programlisting><![CDATA[
--- prepare the data by inserting triples in a graph:
-SQL>SPARQL 
-INSERT INTO GRAPH <http://BookStore.com>
-  { 
-    <http://www.dajobe.org/foaf.rdf#i> <http://purl.org/dc/elements/1.1/title>  "SPARQL and RDF" .
-    <http://www.dajobe.org/foaf.rdf#i> <http://purl.org/dc/elements/1.1/date> <1999-01-01T00:00:00>.
-    <http://www.w3.org/People/Berners-Lee/card#i> <http://purl.org/dc/elements/1.1/title> "Design notes" .
-    <http://www.w3.org/People/Berners-Lee/card#i> <http://purl.org/dc/elements/1.1/date> <2001-01-01T00:00:00>.
-    <http://www.w3.org/People/Connolly/#me> <http://purl.org/dc/elements/1.1/title> "Fundamentals of Compiler Design" .
-    <http://www.w3.org/People/Connolly/#me> <http://purl.org/dc/elements/1.1/date> <2002-01-01T00:00:00>.
-    <http://www.ivan-herman.net/foaf.rdf#me> <http://purl.org/dc/elements/1.1/title>  "RDF Store" .
-    <http://www.ivan-herman.net/foaf.rdf#me> <http://purl.org/dc/elements/1.1/date> <2001-03-05T00:00:00>.
-    <http://bblfish.net/people/henry/card#me> <http://purl.org/dc/elements/1.1/title> "Design RDF notes" .
-    <http://bblfish.net/people/henry/card#me> <http://purl.org/dc/elements/1.1/date> <2001-01-01T00:00:00>.
-    <http://hometown.aol.com/chbussler/foaf/chbussler.foaf#me> <http://purl.org/dc/elements/1.1/title> "RDF Fundamentals" .
-    <http://hometown.aol.com/chbussler/foaf/chbussler.foaf#me> <http://purl.org/dc/elements/1.1/date> <2002-01-01T00:00:00>. 
-  };
+SQL>SPARQL INSERT INTO GRAPH <http://mygraph.com> {  <http://myopenlink.net/dataspace/Kingsley#this>
+                                                     <http://rdfs.org/sioc/ns#id>
+                                                     <Kingsley> };
+callret-0
+VARCHAR
+______________________________________________________________________________
 
-_______________________________________________________
+Insert into <http://mygraph.com>, 1 triples -- done
 
-Insert into <http://BookStore.com>, 12 triples -- done
+1 Rows. -- 0 msec.
+SQL>SPARQL INSERT INTO GRAPH <http://mygraph.com> {  <http://myopenlink.net/dataspace/Caroline#this>
+                                                     <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
+                                                     <http://rdfs.org/sioc/ns#User> };
+callret-0
+VARCHAR
+_______________________________________________________________________________
 
--- Find Count of Group by Dates
-SQL>SPARQL 
-SELECT (xsd:date(bif:subseq(str(?a_dt), 0, 10))), count(*)
-FROM <http://BookStore.com> 
-WHERE 
-  { 
-    ?s <http://purl.org/dc/elements/1.1/date> ?a_dt 
-  }
-GROUP BY (xsd:date(bif:subseq(str(?a_dt), 0, 10)));
+Insert into <http://mygraph.com>, 1 triples -- done
 
-callret-0                                         callret-1
-VARCHAR                                           VARCHAR
-__________________________________________________
-1999-01-01                                        1
-2001-01-01                                        2
-2002-01-01                                        2
-2001-03-05                                        1
+1 Rows. -- 0 msec.
 
-4 Rows. -- 15 msec.
-SQL>	
-]]></programlisting>
-</sect5>
-   </sect4>
-   </sect3>
-<sect3 id="sparqlbi"><title>Business Intelligence Extensions for SPARQL</title>
-<para>
-Virtuoso extends SPARQL with expressions in results, subqueries, aggregates and grouping.
-These extensions allow a straightforward translation of arbitrary SQL queries to SPARQL.
-This extension is called  "SPARQL BI", because the primary objective is to match needs of Business Intelligence.
-The extended features apply equally to querying physical quads or relational tables mapped through RDF views.
-</para>
-<note><para>In this section, many examples use the TPC-H namespace. You may test them on your local demo database.
-They use data from the TPC-H dataset that is mapped into a graph with an IRI of the form
-http://example.com/tpch. When testing, you should replace the fake host name "example.com" with the host name of your own installation
-verbatim, that is as specified in the "DefaultHost" parameter in the [URIQA] section of the Virtuoso configuration file.</para></note>
-<sect4 id="rdfsparqlaggregate"><title>Aggregates in SPARQL</title>
-<para>Virtuoso extends SPARQL with SQL like aggregate and "group by" functionality. This functionality is
-also available by embedding SPARQL text inside SQL, but the SPARQL extension syntax has the benefit
-of also working over the SPARQL protocol and of looking more SPARQL-like.
-</para>
-<para>The supported aggregates are <emphasis>COUNT</emphasis>, <emphasis>MIN</emphasis>,
-<emphasis>MAX</emphasis>, <emphasis>AVG</emphasis> and <emphasis>SUM</emphasis>. These can take an
-optional <emphasis>DISTINCT</emphasis> keyword. These are permitted only in the selection part of a
-select query. If a selection list consists of a mix of variables and aggregates, the non-aggregate
-selected items are considered to be grouping columns and a <emphasis>GROUP BY</emphasis> over them is implicitly added
-at the end of the generated SQL query. Virtuoso also supports explicit syntax for
-<emphasis>GROUP BY</emphasis>, <emphasis>ORDER BY</emphasis>, <emphasis>LIMIT</emphasis> and <emphasis>OFFSET</emphasis>.
-There is no explicit syntax for <emphasis>HAVING</emphasis> in Virtuoso SPARQL.
-</para>
-<para>If a selection consists of aggregates exclusively, the result set has one row with the values
-of the aggregates. If there are aggregates and variables in the selection, the result set has as many
-rows as there are distinct combinations of the variables; the aggregates are then calculated over each
-such distinct combination, as if there were a SQL GROUP BY over all non-aggregates.
-The implicit grouping pays attention to all subexpressions in the return list; say, if a result column expression is <code>(?x * max (?y))</code> then
-<code>?y</code> is aggregated and <code>?x</code> is not so it is grouped by ?x.
-This also means that if a result column expression is <code>(bif:year (?shipdate))</code> then a group is made for each distinct <code>?shipdate</code>,
-i.e. up to 366 groups for each distinct year.
-If you need one group per year, write explicit <code>GROUP BY (bif:year (?shipdate))</code>.
+-- and
 
-</para>
-<para>With the count aggregate the argument may be either <emphasis>*</emphasis>, meaning counting all rows, or a variable
-name, meaning counting all the rows where this variable is bound. If there is no implicit <emphasis>GROUP BY</emphasis>,
-there can be an optional <emphasis>DISTINCT</emphasis> keyword before the variable that is the argument of an aggregate.
-</para>
-<para>There is a special syntax for counting distinct combinations of selected variables. This is:</para>
-<programlisting><![CDATA[
-SELECT COUNT DISTINCT ?v1 ... ?vn
-  FROM ....
-]]></programlisting>
-<para>User-defined aggregate functions are not supported in current version of the SPARQL compiler.</para>
-<sect5 id="rdfsparqlaggregatepathexpressions"><title>Path Expressions</title>
-<para>Virtuoso has support for paths consisting of dereferencing properties in SPARQL. Virtuoso allows
-simple paths in expressions and has a separate feature for transitivity:</para>
+SQL>SPARQL INSERT IN GRAPH <http://mygraph.com> {  <http://myopenlink.net/dataspace/Kingsley#this>
+                                                   <http://rdfs.org/sioc/ns#id>
+                                                   <Kingsley> };
+callret-0
+VARCHAR
+_______________________________________________________________________________
 
-<itemizedlist mark="bullet">
-  <listitem>S+>P: for "one or many values of P of S"</listitem>
-  <listitem>S*>P: for "zero or many values of P of S", so *> may form a LEFT OUTER JOIN whereas +> forms an INNER JOIN.</listitem>
-  <listitem>S|>P: is reserved for potential "single value of P of S or an error if there are many values"</listitem>
-</itemizedlist>
-<para>If this property is set (for example by an RDF View) then +> should be used.</para>
+Insert into <http://mygraph.com>, 1 triples -- done
+
+1 Rows. -- 10 msec.
+SQL>SPARQL INSERT IN GRAPH <http://mygraph.com> {  <http://myopenlink.net/dataspace/Caroline#this>
+                                                   <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
+                                                   <http://rdfs.org/sioc/ns#User> };
+callret-0
+VARCHAR
+________________________________________________________________________
+
+Insert into <http://mygraph.com>, 1 triples -- done
+
+1 Rows. -- 0 msec.
 
-<para><emphasis>Simple Example</emphasis></para>
-<programlisting><![CDATA[
-SELECT ?f+>foaf:name ?f|>foaf:mbox WHERE { ?x foaf:name "Alice" . ?x foaf:knows ?f . FILTER (?f+>foaf:name = "John") }
 ]]></programlisting>
-<para>means:</para>
+</sect4>
+<sect4 id="rdfsparulexamples5"><title>Example for various expressions usage</title>
+       <para>It is possible to use various expressions to calculate fields of new triples. This is
+very convenient, even if not a part of the original specification.
+       </para>
 <programlisting><![CDATA[
-SELECT ?fname ?mbox
-WHERE
-  {
-    ?x foaf:knows ?f .
-    ?x foaf:knows ?f .
-    OPTIONAL {?f foaf:mbox ?mbox} .
-    ?f foaf:name ?fname .
-    ?x foaf:name "Alice" .
-    ?x foaf:knows ?f2 .
-    ?f2 foaf:name "John" .
-  }
-]]></programlisting>
-<para><emphasis>Other Examples</emphasis></para>
-<programlisting><![CDATA[
-SPARQL
-DEFINE sql:signal-void-variables 1
-PREFIX tpcd: <http://www.openlinksw.com/schemas/tpcd#>
-PREFIX oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-PREFIX sioc: <http://rdfs.org/sioc/ns#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-SELECT
-  ?l+>tpcd:returnflag,
-  ?l+>tpcd:linestatus,
-  sum(?l+>tpcd:linequantity) as ?sum_qty,
-  sum(?l+>tpcd:lineextendedprice) as ?sum_base_price,
-  sum(?l+>tpcd:lineextendedprice*(1 - ?l+>tpcd:linediscount)) as ?sum_disc_price,
-  sum(?l+>tpcd:lineextendedprice*(1 - ?l+>tpcd:linediscount)*(1+?l+>tpcd:linetax)) as ?sum_charge,
-  avg(?l+>tpcd:linequantity) as ?avg_qty,
-  avg(?l+>tpcd:lineextendedprice) as ?avg_price,
-  avg(?l+>tpcd:linediscount) as ?avg_disc,
-  count(1) as ?count_order
-FROM <http://example.com/tpcd>
-WHERE {
-    ?l a tpcd:lineitem .
-    FILTER (?l+>tpcd:shipdate <= bif:dateadd ("day", -90, '1998-12-01'^^xsd:date)) }
-ORDER BY ?l+>tpcd:returnflag ?l+>tpcd:linestatus
-
+SQL>SPARQL INSERT INTO GRAPH <http://mygraph.com> { ?s <http://rdfs.org/sioc/ns#id> `iri (bif:concat (str (?o), "Idehen"))` }
+WHERE { ?s <http://rdfs.org/sioc/ns#id> ?o };
+callret-0
+VARCHAR
+_______________________________________________________________________________
+
+Insert into <http://mygraph.com>, 4 triples -- done
+
+1 Rows. -- 0 msec.
 ]]></programlisting>
+</sect4>
+<sect4 id="rdfsparulexamples6"><title>Example for operator IN usage</title>
+<para>The example shows how to find which predicate/object pairs the following
+subjects have in common and count the occurances:</para>
 <programlisting><![CDATA[
-SPARQL
-DEFINE sql:signal-void-variables 1
-PREFIX tpcd: <http://www.openlinksw.com/schemas/tpcd#>
-SELECT
-  ?supp+>tpcd:acctbal,
-  ?supp+>tpcd:name,
-  ?supp+>tpcd:has_nation+>tpcd:name as ?nation_name,
-  ?part+>tpcd:partkey,
-  ?part+>tpcd:mfgr,
-  ?supp+>tpcd:address,
-  ?supp+>tpcd:phone,
-  ?supp+>tpcd:comment
-FROM <http://example.com/tpcd>
-WHERE {
-  ?ps a tpcd:partsupp; tpcd:has_supplier ?supp; tpcd:has_part ?part .
-  ?supp+>tpcd:has_nation+>tpcd:has_region tpcd:name 'EUROPE' .
-  ?part tpcd:size 15 .
-  ?ps tpcd:supplycost ?minsc .
-  { SELECT ?part min(?ps+>tpcd:supplycost) as ?minsc
-    WHERE {
-        ?ps a tpcd:partsupp; tpcd:has_part ?part; tpcd:has_supplier ?ms .
-        ?ms+>tpcd:has_nation+>tpcd:has_region tpcd:name 'EUROPE' .
-      } }
-    FILTER (?part+>tpcd:type like '%BRASS') }
-ORDER BY
-  desc (?supp+>tpcd:acctbal)
-  ?supp+>tpcd:has_nation+>tpcd:name
-  ?supp+>tpcd:name
-  ?part+>tpcd:partkey
-
+http://dbpedia.org/resource/Climate_change
+http://dbpedia.org/resource/Disaster_risk_reduction
+http://dbpedia.org/resource/Tanzania
+http://dbpedia.org/resource/Capacity_building
+http://dbpedia.org/resource/Poverty
+http://dbpedia.org/resource/Construction
+http://dbpedia.org/resource/Vulnerability
+http://dbpedia.org/resource/Mount_Kilimanjaro
+http://dbpedia.org/resource/Social_vulnerability
 ]]></programlisting>
-</sect5>
-<sect5 id="rdfsparqlaggregateexamples"><title>Examples</title>
-<sect6 id="rdfsparqlaggregateexamples1"><title>Example for count of physical triples in http://mygraph.com</title>
+<para>The following query returns the desired results:</para>
 <programlisting><![CDATA[
 SPARQL
-SELECT COUNT (*)
-  FROM <http://mygraph.com>
- WHERE {?s ?p ?o}
-]]></programlisting>
-<para><emphasis>Example for count of O's for each distinct P</emphasis></para>
-<programlisting><![CDATA[
-SPARQL define input:inference "http://mygraph.com"
-SELECT ?p COUNT (?o)
-  FROM <http://mygraph.com>
- WHERE {?s ?p ?o}
+SELECT ?s1 ?s2 COUNT (1)
+WHERE
+  {
+    ?s1 ?p ?o .
+    FILTER (?s1 IN (<http://dbpedia.org/resource/Climate_change>,
+    <http://dbpedia.org/resource/Disaster_risk_reduction>,
+    <http://dbpedia.org/resource/Tanzania>,
+    <http://dbpedia.org/resource/Capacity_building>,
+    <http://dbpedia.org/resource/Poverty>,
+    <http://dbpedia.org/resource/Construction>,
+    <http://dbpedia.org/resource/Vulnerability>,
+    <http://dbpedia.org/resource/Mount_Kilimanjaro>,
+    <http://dbpedia.org/resource/Social_vulnerability> ))
+    ?s2 ?p ?o .
+    FILTER (?s2 IN (<http://dbpedia.org/resource/Climate_change>,
+    <http://dbpedia.org/resource/Disaster_risk_reduction>,
+    <http://dbpedia.org/resource/Tanzania>,
+    <http://dbpedia.org/resource/Capacity_building>,
+    <http://dbpedia.org/resource/Poverty>,
+    <http://dbpedia.org/resource/Construction>,
+    <http://dbpedia.org/resource/Vulnerability>,
+    <http://dbpedia.org/resource/Mount_Kilimanjaro>,
+    <http://dbpedia.org/resource/Social_vulnerability> ))
+    FILTER (?s1 != ?s2)
+    FILTER (str(?s1) < str (?s2))
+  }
+LIMIT 20
 ]]></programlisting>
-</sect6>
-<sect6 id="rdfsparqlaggregateexamples2"><title>Example for count of triples, including inferred triples and the count of
-distinct O values</title>
+<para>The result of executing the query:</para>
 <programlisting><![CDATA[
-SPARQL define input:inference "http://mygraph.com"
-SELECT COUNT (?p) COUNT (?o) COUNT (DISTINCT ?o)
- FROM <http://mygraph.com>
-WHERE {?s ?p ?o}
+s1  	                                         s2  	                                              callret-2
+http://dbpedia.org/resource/Climate_change 	 http://dbpedia.org/resource/Tanzania 	              2
+http://dbpedia.org/resource/Social_vulnerability http://dbpedia.org/resource/Vulnerability 	      1
+http://dbpedia.org/resource/Mount_Kilimanjaro 	 http://dbpedia.org/resource/Poverty 	              1
+http://dbpedia.org/resource/Mount_Kilimanjaro 	 http://dbpedia.org/resource/Tanzania 	              3
+http://dbpedia.org/resource/Capacity_building 	 http://dbpedia.org/resource/Disaster_risk_reduction  1
+http://dbpedia.org/resource/Poverty 	         http://dbpedia.org/resource/Tanzania 	              1
 ]]></programlisting>
-</sect6>
-<sect6 id="rdfsparqlaggregateexamples3"><title>Example for get number of distinct bindings of ?s ?p ?o</title>
+<para>You can also find live demo query results <ulink url="http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&should-sponge=&query=SELECT+%0D%0A%3Fs1+%3Fs2+count+%281%29+where+{%0D%0A%3Fs1+%3Fp+%3Fo+.%0D%0Afilter+%28%3Fs1+in+%28%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FClimate_change%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FDisaster_risk_reduction%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FTanzania%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FCapacity_building%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FPoverty%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FConstruction%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FVulnerability%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FMount_Kilimanjaro%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FSocial_vulnerability%3E+%29%29%0D%0A%3Fs2+%3Fp+%3Fo+.%0D%0Afilter+%28%3Fs2+in+%28%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FClimate_change%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FDisaster_risk_reduction%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FTanzania%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FCapacity_building%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FPoverty%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FConstruction%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FVulnerability%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FMount_Kilimanjaro%3E%2C%0D%0A%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FSocial_vulnerability%3E+%29%29%0D%0Afilter+%28%3Fs1+!%3D+%3Fs2%29%0D%0Afilter+%28str%28%3Fs1%29+%3C+str+%28%3Fs2%29%29%0D%0A}+limit+20&format=html&debug=on&timeout=">here</ulink></para>
+  <tip><title>See Also:</title>
+    <para><link linkend="rdfsparulexamples18">Example usage of IN operator for retrieving all triples for each entity.</link></para>
+  </tip>
+</sect4>
+<sect4 id="rdfsparulexamples7"><title>Example for Modify used as Update</title>
+       <para>'Modify graph' may be used as a form of 'update' operation.
+       </para>
 <programlisting><![CDATA[
-SPARQL define input:inference "http://mygraph.com"
-SELECT count distinct ?s ?p ?o
-  FROM <http://mygraph.com>
- WHERE {?s ?p ?o}
+SQL>SPARQL MODIFY GRAPH <http://mygraph.com> DELETE { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o } INSERT { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type1> ?o } WHERE { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o };
+
+SQL>SPARQL
+DELETE FROM GRAPH <http://mygraph.com> { <http://myopenlink.net/dataspace/Caroline#this> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type1> <http://rdfs.org/sioc/ns#User> };
+
 ]]></programlisting>
-</sect6>
-<sect6 id="rdfsparqlaggregateexamples4"><title>Example for get counts and total prices of ordered items, grouped by item status</title>
+</sect4>
+<sect4 id="rdfsparulexamples8"><title>Example for generating RDF information resource URI</title>
+       <para>The RDF information resource URI can be generated via a string expression.</para>
+<itemizedlist mark="bullet">
+  <listitem>Suppose there is a sample file kidehen.n3:
 <programlisting><![CDATA[
-SPARQL
-prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
-SELECT ?status count(*) sum(?extendedprice)
-FROM <http://localhost.localdomain:8310/tpch>
-WHERE {
-    ?l a tpch:lineitem ;
-      tpch:lineextendedprice ?extendedprice ;
-      tpch:linestatus ?status .
-  }
+<http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User> .
+<http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this> <http://www.w3.org/2000/01/rdf-schema#label> 	"Kingsley" .
+<http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this> <http://rdfs.org/sioc/ns#creator_of> <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300> .
 ]]></programlisting>
-</sect6>
-<sect6 id="rdfsparqlaggregateexamples5"><title>Example for get counts and total prices of ordered items, grouped by item status</title>
-   <para><emphasis>Example: A dataset of people, some duplicated</emphasis></para>
-   <para>Suppose there is a dataset with many people, some of them sharing the same name. To list them we would, ideally, execute the query:
-   </para>
+</listitem>
+  <listitem>Using Conductor UI go to Web Application Server and create folder, for ex. with name "n3_collection"</listitem>
+  <listitem>Upload the "n3_collection" folder the file kidehen.n3</listitem>
+  <listitem>Click properties for the folder "n3_collection" and set to be public readable in the Permissions section</listitem>
+  <listitem>Check "Apply changes to all subfolders and resources".</listitem>
+  <listitem>Finally Click "Update"</listitem>
+     <figure id="gnr1" float="1">
+       <title>Generating RDF information resource URI</title>
+       <graphic fileref="ui/exmp1.png"/>
+     </figure>
+  <listitem>To clear the graph execute:
 <programlisting><![CDATA[
-SPARQL
-SELECT DISTINCT
- (?name) ?person ?mail
- WHERE {
-   ?person rdf:type foaf:Person .
-   ?person foaf:name ?name .
-   ?person foaf:mbox_sha1sum ?mail
- }
-]]></programlisting>
-   <para>Unfortunately, the facility to apply DISTINCT to a part of the result set row (i.e. to ?name) does not currently exist. 
-   (Although the above form is permitted, it's interpreted as being identical to 'SELECT DISTINCT ?name, ?person, ?mail WHERE ...') 
-   If there's demand for such a feature then we may introduce an aggregate called, say, SPECIMEN, that will return the very first of the aggregated values. e.g.:
-   </para>
+SQL>SPARQL CLEAR GRAPH <http://mygraph.com>;
+callret-0
+VARCHAR
+_____________________________________________________________________
+
+Clear <http://mygraph.com> -- done
+
+1 Rows. -- 10 msec.
+]]></programlisting></listitem>
+   <listitem>To load the kidehen.n3 file execute:
 <programlisting><![CDATA[
-SPARQL
-SELECT ?name (specimen(?person)) (specimen(?mail))
-WHERE
- {
-    ?person rdf:type foaf:Person .
-    ?person foaf:name ?name .
-    ?person foaf:mbox_sha1sum ?mail
-  }
+SQL>SPARQL
+load bif:concat ("http://", bif:registry_get("URIQADefaultHost"), "/DAV/n3_collection/kidehen.n3")
+INTO GRAPH <http://mygraph.com>;
+callret-0
+VARCHAR
+_______________________________________________________________________________
+
+Load <http://localhost:8890/DAV/n3_collection/kidehen.n3> into graph <http://mygraph.com> -- done
+
+1 Rows. -- 30 msec.
 ]]></programlisting>
-   <para>As a workaround to this limitation, the MIN aggregate can be used, provided duplicates are few and there's no requirement 
-   that ?person should correspond to ?mail
-(i.e. the result should contain some person node and some mail node but they don't have to be connected by foaf:mbox_sha1sum):
-   </para>
+  </listitem>
+  <listitem>In order to check the new inserted triples execute:
 <programlisting><![CDATA[
-SPARQL
-SELECT ?name (min(?person)) (min(?mail))
+SQL>SPARQL
+SELECT *
+FROM <http://mygraph.com>
 WHERE
-  {
-    ?person rdf:type foaf:Person .
-    ?person foaf:name ?name .
-    ?person foaf:mbox_sha1sum ?mail
-  }
+{
+    ?s ?p ?o
+}
+;
+s                                                                  p                                                   o
+VARCHAR                                                            VARCHAR                                             VARCHAR
+_______________________________________________________________________________
+
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this    http://www.w3.org/1999/02/22-rdf-syntax-ns#type     http://rdfs.org/sioc/ns#User
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this    http://rdfs.org/sioc/ns#creator_of                  http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this    http://www.w3.org/2000/01/rdf-schema#label          Kingsley
+
+3 Rows. -- 10 msec.
 ]]></programlisting>
-   <para>Otherwise, a complicated query is needed:</para>
+  </listitem>
+</itemizedlist>
+</sect4>
+<sect4 id="rdfsparulexamples9"><title>Example for operations over a web service endpoint</title>
+       <para>Several operations can be sent to a web service endpoint as a single statement and
+executed in sequence.
+</para>
 <programlisting><![CDATA[
-SPARQL
-SELECT
- ?name
- ((SELECT (min (?person3))
-     WHERE {
-         ?person3 rdf:type foaf:Person .
-         ?person3 foaf:name ?name .
-         ?person3 foaf:mbox_sha1sum ?mail } )) as ?person
- ?mail
- WHERE {
-     { SELECT distinct ?name
-       WHERE {
-           ?person1 rdf:type foaf:Person .
-           ?person1 foaf:name ?name .
-           ?person1 foaf:mbox_sha1sum ?mail1 } }
-     { SELECT ?name (min(?mail2)) as ?mail
-       WHERE {
-           ?person2 rdf:type foaf:Person .
-           ?person2 foaf:name ?name .
-           ?person2 foaf:mbox_sha1sum ?mail2 } }
- }
-]]></programlisting>
-</sect6>
-<sect6 id="rdfsparqlaggregateexamples6"><title>Example quering dbpedia</title>
-<para>The following example demonstrate how to query dbpedia. Suppose there is local onotlogy,
-which has a datatype property hasLocation with a string containing city names. The query below finds
-which of those cities are in dbpedia:</para>
-<programlisting><![CDATA[
-SPARQL
-PREFIX dbpprop: <http://dbpedia.org/property/>
-PREFIX dbo: <http://dbpedia.org/ontology/>
-PREFIX vocab:<http://myexample.com/localOntology.rdf>
-PREFIX dbpedia: <http://dbpedia.org/>
-PREFIX dbpres: <http://dbpedia.org/resource/>
-SELECT ?city
-WHERE
-  {
-    ?sub :location ?city .
-    FILTER(bif:exists(( ASK { ?subdb a dbo:City . ?subdb dbpprop:officialName ?city })))
-  }
-]]></programlisting>
-</sect6>
-<sect6 id="rdfsparqlaggregateexamples7"><title>Example for MAX with HACING and GROOP BY</title>
-<programlisting><![CDATA[
-## Example "Find which town or city in
-## the UK has the largest proportion of students.
-
-PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
-PREFIX dbpedia-owl-uni: <http://dbpedia.org/ontology/University/>
-PREFIX dbpedia-owl-inst: <http://dbpedia.org/ontology/EducationalInstitution/>
-
-SELECT ?town COUNT(?uni)
-       ?pgrad ?ugrad
-       MAX(?population)
-       ( ((?pgrad+?ugrad)/ MAX(?population))*100 ) AS ?percentage
-WHERE
-  {
-    ?uni dbpedia-owl-inst:country dbpedia:United_Kingdom ;
-                         dbpedia-owl-uni:postgrad ?pgrad ;
-                        dbpedia-owl-uni:undergrad ?ugrad ;
-                             dbpedia-owl-inst:city ?town .
-    OPTIONAL
-        {
-          ?town dbpedia-owl:populationTotal ?population .
-          FILTER (?population > 0 )
-        }
-  }
-GROUP BY ?town ?pgrad ?ugrad
-HAVING ( ( ( (?pgrad+?ugrad)/ MAX(?population) )*100 ) > 0 )
-ORDER BY DESC 6
-]]></programlisting>
-</sect6>
-</sect5>
-<sect5 id="rdfsparqlaggregatenote"><title>Note on Aggregates and Inference</title>
-<para>Inferencing is added to a SPARQL query only for those variables whose value is actually used. Thus,
-</para>
-<programlisting><![CDATA[
-SELECT COUNT (*)
- FROM <http://mygraph.com>
-WHERE {?s ?p ?o}
-]]></programlisting>
-<para>will not return inferred values since s, p, and o are not actually used. In contrast,
-</para>
-<programlisting><![CDATA[
-SPARQL
-SELECT COUNT (?s) COUNT (?p) COUNT (?o)
- FROM <http://mygraph.com>
-WHERE {?s ?p ?o}
-]]></programlisting>
-<para>will also return all the inferred triples.
-</para>
-<para>
-Note: This difference in behaviour may lead to confusion and will, therefore, likely be altered in the future.
-</para>
-</sect5>
-</sect4>
-<sect4 id="rdfsparqlarrowop"><title>Pointer Operator (<emphasis>+></emphasis> and <emphasis>*></emphasis>)</title>
-<para>
-When expressions occur in result sets, many variables are often introduced only for the purpose of passing a value from a triple pattern to the result expression.
-This is inconvenient because many triple patterns are trivial. The presence of large numbers of variable names masks "interesting" variables that are used in more than once in pattern and which establish logical relationships between different parts of the query.
-As a solution we introduce pointer operators.</para>
-<para>
-The <emphasis>+></emphasis> (pointer) operator allows referring to a property value without naming it as a variable and explicitly writing a triple pattern. We can shorten the example above to:</para>
-<programlisting><![CDATA[SPARQL
-prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
-SELECT ?l+>tpch:linestatus count(*) sum(?l+>tpch:lineextendedprice)
-FROM <http://localhost.localdomain:8310/tpch>
-WHERE { ?l a tpch:lineitem }]]></programlisting>
-<para>
-The <emphasis>?subject+>propertyname</emphasis> notation is equivalent to having a triple pattern <emphasis>?subject propertyname ?aux_var</emphasis> binding an auxiliary variable to the mentioned property of the subject, within the group pattern enclosing the reference.
-For a SELECT, the enclosing group pattern is considered to be the top level pattern of the where clause or, in the event of a union, the top level of each term of the union.
-Each distinct pointer adds exactly one triple pattern to the enclosing group pattern. Multiple uses of <emphasis>+></emphasis> with the same arguments do not each add a triple pattern.
-(Having multiple copies of an identical pattern might lead to changes in cardinality if multiple input graphs were being considered.
-If a lineitem had multiple discounts or extended prices, then we would get the cartesian product of both.)
-</para>
-<para>
-If a property referenced via <emphasis>+></emphasis> is absent, the variable on the left side of the operator is not bound in the enclosing group pattern because it should be bound in all triple patterns where it appears as a field, including implicitly added patterns.
-</para>
-<para>
-The <emphasis>?subject*>propertyname</emphasis> notation is introduced in order to access optional property values. It adds an OPTIONAL group <emphasis>OPTIONAL { ?subject propertyname ?aux_var }</emphasis>, not a plain triple pattern, so the binding of ?subject is not changed even if the object variable is not bound. If the property is set for all subjects in question then the results of <emphasis>*></emphasis> and <emphasis>+></emphasis> are the same. All other things being equal, the <emphasis>+></emphasis> operator produces better SQL code than <emphasis>*></emphasis> so use <emphasis>*></emphasis> only when it is really needed.</para>
-</sect4>
-<sect4 id="rdfsparqlnesting"><title>Subqueries in SPARQL</title>
-<para>
-Pure SPARQL does not allow binding a value that is not retrieved through a triple pattern.
-We lift this restriction by allowing expressions in the result set and providing names for result columns.
-We also allow a SPARQL SELECT statement to appear in another SPARQL statement in any place where a group pattern may appear.
-The names of the result columns form the names of the variables bound, using values from the returned rows.
-This resembles derived tables in SQL.</para>
-<para>
-For instance, the following statement finds the prices of the 1000 order lines with the biggest discounts:</para>
+SQL>SPARQL
+INSERT IN GRAPH <http://mygraph.com> { <http://myopenlink.net/dataspace/Kingsley#this>
+                                       <http://rdfs.org/sioc/ns#id>
+                                       <Kingsley> }
+INSERT INTO GRAPH <http://mygraph.com> { <http://myopenlink.net/dataspace/Caroline#this>
+                                         <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
+                                         <http://rdfs.org/sioc/ns#User> }
+INSERT INTO GRAPH <http://mygraph.com> { ?s <http://rdfs.org/sioc/ns#id> `iri (bif:concat (str (?o), "Idehen"))` }
+WHERE { ?s <http://rdfs.org/sioc/ns#id> ?o };
+callret-0
+VARCHAR
+_______________________________________________________________________________
 
-<programlisting><![CDATA[SPARQL
-define sql:signal-void-variables 1
-prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
-SELECT ?line ?discount (?extendedprice * (1 - ?discount)) as ?finalprice
-FROM <http://localhost.localdomain:8310/tpch>
-WHERE
-  {
-  ?line a tpch:lineitem ;
-    tpch:lineextendedprice ?extendedprice ;
-    tpch:linediscount ?discount .
-  }
-ORDER BY DESC (?extendedprice * ?discount)
-LIMIT 1000]]></programlisting>
+Insert into <http://mygraph.com>, 1 triples -- done
+Insert into <http://mygraph.com>, 1 triples -- done
+Insert into <http://mygraph.com>, 8 triples -- done
+Commit -- done
 
-<para>
-After ensuring that this query works correctly, we can use it to answer more complex questions.
-Imagine that we want to find out how big the customers are who have received the biggest discounts.</para>
 
-<programlisting><![CDATA[SPARQL
-define sql:signal-void-variables 1
-prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
-SELECT ?cust sum(?extendedprice2 * (1 - ?discount2)) max (?bigdiscount)
-FROM <http://localhost.localdomain:8310/tpch>
-WHERE
-  {
-    {
-      SELECT ?line (?extendedprice * ?discount) as ?bigdiscount
-      WHERE {
-        ?line a tpch:lineitem ;
-          tpch:lineextendedprice ?extendedprice ;
-          tpch:linediscount ?discount . }
-      ORDER BY DESC (?extendedprice * ?discount)
-      LIMIT 1000
-    }
-    ?line tpch:has_order ?order .
-    ?order tpch:has_customer ?cust .
-    ?cust tpch:customer_of ?order2 .
-    ?order2 tpch:order_of ?line2 .
-    ?line2 tpch:lineextendedprice ?extendedprice2 ;
-      tpch:linediscount ?discount2 .
-  }
-ORDER BY (SUM(?extendedprice2 * (1 - ?discount2)) / MAX (?bigdiscount))]]></programlisting>
+1 Rows. -- 10 msec.
 
-<para>
-The inner select finds the 1000 biggest (in absolute value) discounts and their order lines. For each line we find orders of it, and the customer. For each customer found, we find all the orders he made and all the lines of each of the orders (variable ?line2).</para>
-<para>
-Note that the inner select does not contain FROM clauses. It is not required because the inner select inherits the access permissions of all the outer queries. It is also important to note that the internal variable bindings of the subquery are not visible in the outer query; only the result set variables are bound. Similarly, variables bound in the outer query are not accessible to the subquery.</para>
-<para>
-Note also the declaration <emphasis>define sql:signal-void-variables 1</emphasis> that forces the SPARQL compiler to signal errors if some variables cannot be bound due to misspelt names or attempts to make joins across disjoint domains. These diagnostics are especially important when the query is long.</para>
-</sect4>
-<sect4 id="rdfsparqlbackq"><title>Expressions in Triple Patterns</title>
-<para>In addition to expressions in filters and result sets, Virtuoso allows the use of expressions in triples of a
-CONSTRUCT pattern or WHERE pattern - an expression can be used instead of a constant or a variable name for a subject, predicate or object. 
-When used in this context, the expression is surrounded by backquotes.</para>
+SQL>SPARQL
+MODIFY GRAPH <http://mygraph.com>
+DELETE { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o }
+INSERT { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type1> ?o }
+WHERE { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o };
 
-<para><emphasis>Example: With a WHERE Clause:</emphasis></para>
-<para>The following example returns all the distinct 'fragment' parts of all subjects in all graphs that have some predicate whose value is equal to 2+2.</para>
-<programlisting><![CDATA[
-SQL>SPARQL SELECT distinct (bif:subseq (?s, bif:strchr (?s, '#')))
-   WHERE {
-     graph ?g {
-       ?s ?p `2+2` .
-       FILTER (! bif:isnull (bif:strchr (?s, '#') ) )
-     } };
+SQL>DELETE FROM GRAPH <http://mygraph.com> { <http://myopenlink.net/dataspace/Caroline#this> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type1> <http://rdfs.org/sioc/ns#User> };
 
-callret
-VARCHAR
-----------
-#four
-]]></programlisting>
-<para>Inside a WHERE part, every expression in a triple pattern is replaced with new variable and a filter expression is added to the enclosing group. The new filter is an equality of the new variable and the expression. Hence the sample above is identical to:</para>
-<programlisting><![CDATA[
-SPARQL
-SELECT distinct (bif:subseq (?s, bif:strchr (?s, '#')))
-   WHERE {
-     graph ?g {
-       ?s ?p ?newvariable .
-       FILTER (! bif:isnull (bif:strchr (?s, '#') ) )
-       FILTER (?newvariable = (2+2)) .
-     } }
-]]></programlisting>
-<para><emphasis>Example: With CONSTRUCT</emphasis></para>
-<programlisting><![CDATA[
-CONSTRUCT {
-  <http://bio2rdf.org/interpro:IPR000181>
-<http://bio2rdf.org/ns/bio2rdf#hasLinkCount>
-`(SELECT (count(?s)) as ?countS
-   WHERE { ?s ?p <http://bio2rdf.org/interpro:IPR000181> })` }
-WHERE { ?s1 ?p1 ?o1 } limit 1
-]]></programlisting>
-<para>The result should be:</para>
-<programlisting><![CDATA[
-<http://bio2rdf.org/interpro:IPR000181> <http://bio2rdf.org/ns/bio2rdf#hasLinkCount> "0"^^<http://www.w3.org/2001/XMLSchema#integer> .
+SQL>SPARQL
+load bif:concat ("http://", bif:registry_get("URIQADefaultHost"), "/DAV/n3_collection/kidehen.n3") INTO GRAPH <http://mygraph.com>;
 ]]></programlisting>
-<para><emphasis>Example: Inserting into a graph using an expression</emphasis></para>
+</sect4>
+<sect4 id="rdfsparulexamples10"><title>Example for Dropping graph</title>
+<para>When handling very large RDF data collections (e.g. 600 million triples ) loaded into Virtuoso
+server as a single graph, the fastest operation to drop the graph is:</para>
 <programlisting><![CDATA[
-SQL>SPARQL insert into graph <http://MyNewGraph.com/> {
-<http://bio2rdf.org/interpro:IPR000181>
-<http://bio2rdf.org/ns/bio2rdf#hasLinkCount>
-  `(SELECT (count(?s)) as ?countS
-    WHERE { ?s ?p <http://bio2rdf.org/interpro:IPR000181> })` }
- WHERE { ?s1 ?p1 ?o1 } limit 1  ;
-
+SQL>SPARQL CLEAR GRAPH <http://mygraph.com>;
 callret-0
 VARCHAR
-_______________________________________________________________________________
+______________________________________________________________________________
 
-Insert into <http://MyNewGraph.com/>, 1 triples -- done
+Clear <http://mygraph.com> -- done
 
-1 Rows. -- 30 msec.
+1 Rows. -- 10 msec.
 ]]></programlisting>
+<para>The operation can be speeded up by executing log_enable (0) or even log_enable (2) beforehand,
+and log_enable(1) after it completes.
+</para>
 </sect4>
-</sect3>
-</sect2>
-<sect2 id="rdfsparqlinline"><title>SPARQL Inline in SQL</title>
-<para>Virtuoso extends the SQL 92 syntax with SPARQL queries and subqueries. Instead of writing a SQL SELECT query or subquery, one can write the SPARQL keyword and a SPARQL query after the keyword.</para>
-<programlisting>
-SQL>SPARQL SELECT DISTINCT ?p WHERE { graph ?g { ?s ?p ?o } };
-p
-varchar
-----------
-http://example.org/ns#b
-http://example.org/ns#d
-http://xmlns.com/foaf/0.1/name
-http://xmlns.com/foaf/0.1/mbox
-...
+<sect4 id="rdfsparulexamples11"><title>Example for testing Graph Equality</title>
+<para>The procedure below keeps simple cases of graphs with bnodes:</para>
+<orderedlist>
+  <listitem>First it compares all triples without bnodes</listitem>
+  <listitem>Then it iteratively establishes equivalences between bnodes that
+are directly and unambiguously connected to equivalent vertexes by identical predicates.</listitem>
+</orderedlist>
+<programlisting><![CDATA[
+-- Fast Approximate RDF Graph Equivalence Test
+-- (C) 2009 OpenLink Software
+-- License: GNU General Public License (only version 2 of the license).
+-- No warranty, even implied warranty
 
+-- This compares the content of triple dictionaries \c dict1 and \c dict2,
+-- returns NULL if no difference found (with bnode equivalence in mind),
+-- returns description of a difference otherwise.
+-- The function is experimental (note suffix _EXP), so no accurate QA is made.
+-- Some version of the function may be inserted later in OpenLink Virtuoso Server under some different name.
+create function DB.DBA.RDF_TRIPLE_DICTS_DIFFER_EXP (
+  in dict1 any, --- Triple dictionary, traditional, (vectors of S, P, O are keys, any non-nulls are values)
+  in dict2 any, --- Second triple dictionary, like to \c dict1
+  in accuracy integer,	--- Accuracy, 0 if no bnodes expected, 1 if "convenient" trees with intermediate bnodes expected, 2 and more are not yet implemented
+  in equiv_map any := null, --- If specified then it contain mapping from IRI_IDs of bnodes of \c dict1 to equivalent IRI_IDs of bnodes of \c dict1.
+-- It can be extended during the run so use dict_duplicate() before call if needed.
+  in equiv_rev any := null --- If specified then it is an inverted dictionary of \c equiv_map (this time \c dict2 bnodes are keys and \c dict1 bnodes are values)
+  )
+{
+  declare dict_size1, dict_size2 integer;
+  declare old_dirt_level, dirt_level integer;
+  declare ctr, tailctr, sp_made_new_equiv integer;
+  declare array1, array2, dict2_sp, dict1_op, dict2_op, array1_op any;
+  dict_size1 := dict_size (dict1);
+  dict_size2 := dict_size (dict2);
+  dict2 := dict_duplicate (dict2);
+  if (dict_size1 <> dict_size2)
+    return 'Sizes differ';
+  if (equiv_map is null)
+    {
+      equiv_map := dict_new (dict_size1);
+      equiv_rev := dict_new (dict_size1);
+    }
+  old_dirt_level := dict_size1 - dict_size (equiv_map);
+  array1 := dict_list_keys (dict1, 0);
+next_loop:
+-- Step 1: removing triples with all three items matched
+  ctr := dict_size1-1;
+  while (ctr >= 0)
+    {
+      declare s_in_1, o_in_1, s_in_2, o_in_2, triple_in_2 any;
+      s_in_1 := array1[ctr][0];
+      o_in_1 := array1[ctr][2];
+      if (is_bnode_iri_id (s_in_1))
+        {
+          s_in_2 := dict_get (equiv_map, s_in_1, null);
+          if (s_in_2 is null)
+            goto next_full_eq_check;
+        }
+      else
+        s_in_2 := s_in_1;
+      if (is_bnode_iri_id (o_in_1))
+        {
+          o_in_2 := dict_get (equiv_map, o_in_1, null);
+          if (o_in_2 is null)
+            goto next_full_eq_check;
+        }
+      else
+        o_in_2 := o_in_1;
+      triple_in_2 := vector (s_in_2, array1[ctr][1], o_in_2);
+      if (dict_get (dict2, triple_in_2, null) is null)
+        return vector (array1[ctr], ' is in first, ', triple_in_2, ' is missing in second');
+      dict_remove (dict2, triple_in_2);
+      if (ctr < dict_size1-1)
+        array1[ctr] := array1[dict_size1-1];
+      dict_size1 := dict_size1-1;
+next_full_eq_check:
+      ctr := ctr-1;
+    }
+-- Step 1 end, garbage truncated:
+  if ((0 = dict_size1) or (0 = accuracy))
+    return null;
+  if (dict_size1 < length (array1))
+    array1 := subseq (array1, 0, dict_size1);
+  if (dict_size (dict2) <> dict_size1)
+    signal ('OBLOM', 'Internal error: sizes of graphs suddenly differ');
+-- Step 2: establishing equivs between not-yet-coupled bnodes that are values of functional predicates of coupled subjects
+  sp_made_new_equiv := 0;
+  dict2_sp := dict_new (dict_size1);
+  array2 := dict_list_keys (dict2, 0);
+  for (ctr := dict_size1-1; ctr >= 0; ctr := ctr-1)
+    {
+      declare sp2, o2, prev_uniq_o2 any;
+      sp2 := vector (array2[ctr][0], array2[ctr][1]);
+      prev_uniq_o2 := dict_get (dict2_sp, sp2, null);
+      if (prev_uniq_o2 is null)
+        {
+          o2 := array2[ctr][2];
+          if (is_bnode_iri_id (o2))
+            dict_put (dict2_sp, sp2, o2);
+          else
+            dict_put (dict2_sp, sp2, #i0);
+        }
+      else if (prev_uniq_o2 <> #i0)
+        dict_put (dict2_sp, sp2, #i0);
+    }
+  rowvector_subj_sort (array1, 0, 1);
+  rowvector_subj_sort (array1, 1, 1);
+  rowvector_subj_sort (array2, 1, 1);
+  ctr := 0;
+  while (ctr < dict_size1)
+    {
+      declare s_in_1, o_in_1, s_in_2, o_in_2, o_in_dict2_sp, o_in_dict2_sp_in_1 any;
+      tailctr := ctr+1;
+      if (array1[ctr][1] <> array2[ctr][1])
+        {
+          if (array1[ctr][1] > array2[ctr][1])
+            return vector ('Cardinality of predicate ', array2[ctr][1], ' is greater in second than in first');
+          else
+            return vector ('Cardinality of predicate ', array1[ctr][1], ' is greater in first than in second');
+        }
+      while ((tailctr < dict_size1) and
+        (array1[tailctr][0] = array1[ctr][0]) and
+        (array1[tailctr][1] = array1[ctr][1]) )
+        tailctr := tailctr+1;
+      if ((tailctr - ctr) > 1)
+        goto next_sp_check;
+      o_in_1 := array1[ctr][2];
+      if (not is_bnode_iri_id (o_in_1))
+        goto next_sp_check;
+      o_in_2 := dict_get (equiv_map, o_in_1, null);
+      if (o_in_2 is not null)
+        goto next_sp_check;
+      s_in_1 := array1[ctr][0];
+      if (is_bnode_iri_id (s_in_1))
+        {
+          s_in_2 := dict_get (equiv_map, s_in_1, null);
+          if (s_in_2 is null)
+            goto next_sp_check;
+        }
+      else
+        s_in_2 := s_in_1;
+      o_in_dict2_sp := dict_get (dict2_sp, vector (s_in_2, array1[ctr][1]), null);
+      if (o_in_dict2_sp is null)
+        return vector (vector (s_in_1, array1[ctr][1], o_in_1), ' is unique SP in first, ', vector (s_in_2, array1[ctr][1]), ' is missing SP in second');
+      if (o_in_dict2_sp = #i0)
+        return vector (vector (s_in_1, array1[ctr][1], o_in_1), ' is unique SP in first, ', vector (s_in_2, array1[ctr][1]), ' is not unique SP-to-bnode in second');
+      o_in_dict2_sp_in_1 := dict_get (equiv_rev, o_in_dict2_sp, null);
+      if (o_in_dict2_sp_in_1 is not null)
+  {
+          if (o_in_dict2_sp_in_1 = o_in_1)
+            goto next_sp_check;
+          return vector (vector (s_in_1, array1[ctr][1], o_in_1), ' is unique SP in first, ', vector (s_in_2, array1[ctr][1], o_in_dict2_sp), ' is unique SP in second but ', o_in_dict2_sp, ' rev-equiv to ', o_in_dict2_sp_in_1);
+        }
+      dict_put (equiv_map, o_in_1, o_in_dict2_sp);
+      dict_put (equiv_rev, o_in_dict2_sp, o_in_1);
+      sp_made_new_equiv := sp_made_new_equiv + 1;
+next_sp_check:
+      ctr := tailctr;
+    }
+  dict_list_keys (dict2_sp, 2);
+-- Step 2 end
+  if (sp_made_new_equiv * 10 > dict_size1)
+    goto next_loop; -- If dictionary is noticeably extended then it's worth to remove more triples before continue.
+-- Step 3: establishing equivs between not-yet-coupled bnodes that are subjects of inverse functional properties with coupled objects.
+  dict1_op := dict_new (dict_size1);
+  for (ctr := dict_size1-1; ctr >= 0; ctr := ctr-1)
+    {
+      declare op1, s1, prev_uniq_s1 any;
+      op1 := vector (array1[ctr][2], array1[ctr][1]);
+      prev_uniq_s1 := dict_get (dict1_op, op1, null);
+      if (prev_uniq_s1 is null)
+        {
+          s1 := array1[ctr][0];
+          if (is_bnode_iri_id (s1))
+            dict_put (dict1_op, op1, s1);
+          else
+            dict_put (dict1_op, op1, #i0);
+        }
+      else if (prev_uniq_s1 <> #i0)
+        dict_put (dict1_op, op1, #i0);
+    }
+  array1_op := dict_to_vector (dict1_op, 2);
+  dict2_op := dict_new (dict_size1);
+  for (ctr := dict_size1-1; ctr >= 0; ctr := ctr-1)
+    {
+      declare op2, s2, prev_uniq_s2 any;
+      op2 := vector (array2[ctr][2], array2[ctr][1]);
+      prev_uniq_s2 := dict_get (dict2_op, op2, null);
+      if (prev_uniq_s2 is null)
+        {
+          s2 := array2[ctr][0];
+          if (is_bnode_iri_id (s2))
+            dict_put (dict2_op, op2, s2);
+          else
+            dict_put (dict2_op, op2, #i0);
+        }
+      else if (prev_uniq_s2 <> #i0)
+        dict_put (dict2_op, op2, #i0);
+    }
+  ctr := length (array1_op) - 2;
+  while (ctr >= 0)
+    {
+      declare o_in_1, s_in_1, o_in_2, s_in_2, s_in_dict2_op, s_in_dict2_op_in_1 any;
+      s_in_1 := array1_op[ctr+1];
+      if (not is_bnode_iri_id (s_in_1))
+        goto next_op_check;
+      s_in_2 := dict_get (equiv_map, s_in_1, null);
+      if (s_in_2 is not null)
+        goto next_op_check;
+      o_in_1 := array1_op[ctr][0];
+      if (is_bnode_iri_id (o_in_1))
+        {
+          o_in_2 := dict_get (equiv_map, o_in_1, null);
+          if (o_in_2 is null)
+            goto next_op_check;
+        }
+      else
+        o_in_2 := o_in_1;
+      s_in_dict2_op := dict_get (dict2_op, vector (o_in_2, array1_op[ctr][1]), null);
+      if (s_in_dict2_op is null)
+        return vector (vector (s_in_1, array1_op[ctr][1], o_in_1), ' is unique OP in first, ', vector (o_in_2, array1_op[ctr][1]), ' is missing OP in second');
+      if (s_in_dict2_op = #i0)
+        return vector (vector (s_in_1, array1_op[ctr][1], o_in_1), ' is unique OP in first, ', vector (o_in_2, array1_op[ctr][1]), ' is not unique OP-to-bnode in second');
+      s_in_dict2_op_in_1 := dict_get (equiv_rev, s_in_dict2_op, null);
+      if (s_in_dict2_op_in_1 is not null)
+        {
+          if (s_in_dict2_op_in_1 = s_in_1)
+            goto next_op_check;
+          return vector (vector (s_in_1, array1_op[ctr][1], o_in_1), ' is unique OP in first, ', vector (s_in_dict2_op, array1[ctr][1], o_in_2), ' is unique OP in second but ', s_in_dict2_op, ' rev-equiv to ', s_in_dict2_op_in_1);
+        }
+      dict_put (equiv_map, s_in_1, s_in_dict2_op);
+      dict_put (equiv_rev, s_in_dict2_op, s_in_1);
+next_op_check:
+      ctr := ctr - 2;
+    }
+  dict_list_keys (dict2_op, 2);
+-- Step 3 end
+  dirt_level := dict_size1 - dict_size (equiv_map);
+  if (dirt_level >= old_dirt_level)
+    return vector (vector (array1[0][0], array1[0][1], array1[0][2]), ' has no matches in second with the requested accuracy');
+  old_dirt_level := dirt_level;
+  goto next_loop;
+}
+;
 
-SQL>SELECT distinct subseq ("p", strchr ("p", '#')) as fragment
-  FROM (SPARQL SELECT DISTINCT ?p WHERE { graph ?g { ?s ?p ?o } } ) as all_predicates
-  WHERE "p" like '%#%';
-fragment
-varchar
-----------
-#query
-#data
-#name
-#comment
-...
-</programlisting>
-<para>Note that names of variables returned from SPARQL are always case-sensitive and no case mode rules apply to them.
-Depending on the CaseMode parameter in the Virtuoso configuration file, double quotes should be used if necessary to refer to them in surrounding SQL code.
-</para>
-<para>
-It is possible to pass parameters to a SPARQL query via a Virtuoso-specific syntax extension.
-<emphasis>??</emphasis> or <emphasis>$?</emphasis> indicates a positional parameter similar to <emphasis>?</emphasis> in plain SQL. <emphasis>??</emphasis> can be used in graph patterns or anywhere in place of a SPARQL variable.
-The value of a parameter should be passed in SQL form, i.e. this should be a number or a untyped string.
-An IRI ID can be passed in all cases where an absolute IRI can, except the obvious case of when the variable is an argument of a function that requires string.
-If the parameter is used in the 'graph', 'subject' or 'object' position of the SPARQL pattern, the string parameter is converted into an IRI automatically. In other cases an IRI string is indistinguishable from a string literal, so it is necessary to call the built-in SPARQL function <emphasis>iri()</emphasis> , e.g. <emphasis>iri (??)</emphasis>.
-Using this notation, any dynamic SQL client (whether ODBC, JDBC or some other) can execute parameterized SPARQL queries, binding parameters just as with dynamic SQL.
-</para>
-<programlisting><![CDATA[
-SQL> create function param_passing_demo ()
+create function DB.DBA.RDF_GRAPHS_DIFFER_EXP (in g1_uri varchar, in g2_uri varchar, in accuracy integer)
 {
-  declare stat, msg varchar;
-  declare mdata, rset any;
-  exec ('SPARQL SELECT ?s WHERE { graph ?g { ?s ?? ?? }}',
-    stat, msg,
-    vector ( /* Vector of two parameters */
-      'http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#int1',
-      4 ),
-    10, /* Max no of rows */
-    mdata, /* Variable to get metadata */
-    rset ); /* Variable to get result-set */
-  if (length (rset) = 0)
-    signal ('23000',
-      'No data found, try demo database with installed Virtuoso tutorials');
-  return rset[0][0];
+  return DB.DBA.RDF_TRIPLE_DICTS_DIFFER_EXP (
+    (sparql define output:valmode "LONG" construct { ?s ?p ?o } where { graph `iri(?:g1_uri)` { ?s ?p ?o }}),
+    (sparql define output:valmode "LONG" construct { ?s ?p ?o } where { graph `iri(?:g2_uri)` { ?s ?p ?o }}),
+    accuracy );
 }
+;
 
-SQL> SELECT param_passing_demo ();
-callret
-VARCHAR
-_______________________________________________________________________________
+-- The rest of file contains some minimal tests.
 
-http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#four
+set verbose off;
+set banner off;
+set types off;
 
-1 Rows. -- 00000 msec.
-]]></programlisting>
-<para>An inline SPARQL query can refer to SQL variables that are in scope in the SQL query or stored procedure containing it.
-Virtuoso extends the SPARQL syntax with a special notation to this effect. A reference to SQL variable X can be written as <emphasis>?:X</emphasis> or <emphasis>$:X</emphasis>.
-A reference to column <emphasis>C</emphasis> of a table or a sub-select with alias <emphasis>T</emphasis> can be written as <emphasis>?:T.C</emphasis> or <emphasis>$:T.C</emphasis>.
-Both notations can be used in any place where a variable name is allowed, except the 'AS' clause described below.
-</para>
-<para>A column of a result set of a SPARQL SELECT can be used in SQL code inside a for statement just like any column from a SQL select.
-</para>
-<para>SQL rules about double-quoted names are applicable to variables that are passed to a SPARQL query or selected from one.
-If a variable name contains unusual characters or should not be normalized according to SQL conventions then the
-name should use double quotes for escaping. e.g., the notation <emphasis>?:"OrderLine"</emphasis> will always refer to variable or column
-titled <emphasis>OrderLine</emphasis> whereas <emphasis>?:OrderLine</emphasis> can be converted to <emphasis>ORDERLINE</emphasis> or <emphasis>orderline</emphasis>.
-</para>
-<para>It is safer to avoid using variable names that conflict with column names of RDF system tables, esp. <emphasis>G</emphasis>, <emphasis>S</emphasis>, <emphasis>P</emphasis> and <emphasis>O</emphasis>.
-These names are not reserved now but they may cause subtle bugs when an incorrect SPARQL subquery is compiled into SQL code that refers to identically named table columns.
-Some of these names may be rejected as syntax errors by future Virtuoso versions.
-</para>
-<programlisting><![CDATA[
-SQL> create procedure sql_vars_demo ()
-{
-#pragma prefix sort0: <http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#>
-  declare RES varchar;
-  declare obj integer;
-  result_names (RES);
-  obj := 4;
-  for (SPARQL SELECT ?subj WHERE { graph ?g { ?subj sort0:int1 ?:obj } } ) do
-    result ("subj");
+create function DB.DBA.DICT_EXTEND_WITH_KEYS (in dict any, in keys any)
+  {
+  if (dict is null)
+    dict := dict_new (length (keys));
+  foreach (any k in keys) do
+    dict_put (dict, k, 1);
+  return dict;
 }
+;
 
-SQL> sql_vars_demo ();
-RES
-VARCHAR
-_______________________________________________________________________________
-
-http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#four
-
-1 Rows. -- 00000 msec.
-]]></programlisting>
-<para>The example also demonstrates the Virtuoso/PL pragma line for procedure-wide declarations of namespace prefixes.
-This makes the code more readable and eliminates duplicate declarations of namespace prefixes when the procedure
-contains many SPARQL fragments that refer to a common set of namespaces.
-</para>
-<para>A SPARQL ASK query can be used as an argument of the SQL EXISTS predicate.
-</para>
-<programlisting><![CDATA[
-create function sparql_ask_demo () returns varchar
+create function DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP (in title varchar, in should_differ integer, in v1 any, in v2 any, in accuracy integer)
 {
-  if (exists (sparql ask where { graph ?g { ?s ?p 4}}))
-    return 'YES';
-  else
-    return 'NO';
+  declare d1, d2, eqm, eqr, differ_status any;
+  d1 := DB.DBA.DICT_EXTEND_WITH_KEYS (null, v1);
+  d2 := DB.DBA.DICT_EXTEND_WITH_KEYS (null, v2);
+  eqm := dict_new (10);
+  eqr := dict_new (10);
+  dbg_obj_princ ('===== ' || title);
+  differ_status := DB.DBA.RDF_TRIPLE_DICTS_DIFFER_EXP (d1, d2, accuracy, eqm, eqr);
+  dbg_obj_princ ('Result: ', differ_status);
+  if (0 < dict_size (eqm))
+  dbg_obj_princ ('Equivalence map: ', dict_to_vector (eqm, 0));
+  dbg_obj_princ ('Equivalence rev: ', dict_to_vector (eqr, 0));
+  return sprintf ('%s: %s',
+    case when (case when should_differ then equ (0, isnull (differ_status)) else isnull (differ_status) end) then 'PASSED' else '***FAILED' end,
+    title );
 }
+;
 
-SQL> SELECT sparql_ask_demo ();
-_______________________________________________________________________________
-
-YES
-]]>
-</programlisting>
-<sect3 id="rdfcontrollingsparqloutputtypes"><title>Controlling SPARQL Output Data Types</title>
-<para>The compilation of a SPARQL query may depend on an environment that is usually provided by the SPARQL protocol and which includes the default graph URI. Environment settings that come from the SPARQL protocol may override settings in the text of a SPARQL query. To let an application configure the environment for a query, SPARQL's syntax has been extended with the 'define' clause:</para>
-<programlisting>
-define parameter-qname parameter-value
-</programlisting>
-<para>Examples of supported parameters are <emphasis>output:valmode</emphasis> and <emphasis>output:format</emphasis></para>
-<para>
-<emphasis>output:valmode</emphasis> specifies which data types (i.e. representation) should be used for values in the result set. The default is "SQLVAL", 
-meaning that a query returns result set values in SQL format and behaves as a typical SQL select - IRIs and string literals
-are returned as strings, making the output compatible with ODBC and the standard SQL routines. To compose triple vectors in Virtuoso PL code, an 
-application may need data in long format. A valmode of "LONG" means that IRIs are returned as IRI_IDs and string literals may be returned as special "RDF boxes" 
-even if they are actually plain strings. This may cause problems if these new datatypes are not known to the data recipient or if IRIs come from RDF
-Views (in which case IRI_IDs are created on the fly and 'pollute' the database), but it can result in fewer data conversions and thus better speed if used
-properly. "AUTO" disables all types of conversion for the result set, so the latter can comprise a mix of values across "SQLVAL" and "LONG" value modes, as well as
-some internal representations. It is better to avoid using this mode in user applications because the output may change from version to version.
-</para>
-<para>If the query contains a</para>
-<programlisting>
-define output:valmode 'LONG'
-</programlisting>
-<para>clause then all returned values are in long format. e.g., the following query returns IRI_ID's instead of IRI strings.</para>
-<programlisting>
-SQL>SPARQL define output:valmode 'LONG' SELECT distinct ?p WHERE { graph ?g { ?s ?p ?o } };
-p
-----------
-#i1000001
-#i1000003
-#i1000005
-#i1000006
-...
-</programlisting>
-<para><emphasis>output:format</emphasis> instructs the SPARQL compiler that the result of the query should be serialized into an RDF document - 
-that document will be returned as a single column of a single row result set.
-<emphasis>output:format</emphasis> is especially useful if a SPARQL CONSTRUCT or SPARQL DESCRIBE query is executed directly via an ODBC or JDBC database connection
-and the client cannot receive the resulting dictionary of triples (there's no way to transfer such an object via ODBC).
-Using this option, the client can receive the document that contains the whole result set of a SELECT or the dictionary of triples of a CONSTRUCT/DESCRIBE, and parse it locally.
-</para>
-<para>
-Supported values for <emphasis>output:format</emphasis> are <emphasis>RDF/XML</emphasis> and <emphasis>TURTLE</emphasis> (or <emphasis>TTL</emphasis>).
-If both <emphasis>output:valmode</emphasis> and <emphasis>output:format</emphasis> are specified, <emphasis>output:format</emphasis> has higher priority,
-raising an error if <emphasis>output:valmode</emphasis> is set to a value other than <emphasis>LONG</emphasis>.
-</para>
-<para>
-When a SPARQL query is compiled, the compiler checks whether the result set is to be sent to a remote ODBC/JDBC client or used in some other way.
-The compiler will automatically set <emphasis>output:format</emphasis> to <emphasis>TURTLE</emphasis> if compiling for execution by an SQL client.
-</para>
-<para>
-The example below demonstrates how different values of <emphasis>output:format</emphasis> affect the result of SPARQL SELECT.
-Note 10 rows and 4 columns in the first result, and single LONG VARCHAR in the others.
-When using the ISQL client, use the 'set blobs on;' directive if fetching long texts to avoid receiving a 'data truncated' warning.
-</para>
-<programlisting><![CDATA[
-SQL> SPARQL SELECT * WHERE {graph ?g { ?s ?p ?o }} limit 10;
-g                                            s                    p                              o
-VARCHAR                                      VARCHAR              VARCHAR                        VARCHAR
-______________________________________________________________________
+create function DB.DBA.TEST_RDF_GRAPHS_DIFFER_EXP (in title varchar, in should_differ integer, in g1_uri varchar, in g2_uri varchar, in accuracy integer)
+{
+  declare differ_status any;
+  differ_status := DB.DBA.RDF_GRAPHS_DIFFER_EXP (g1_uri, g2_uri, accuracy);
+  dbg_obj_princ ('Result: ', differ_status);
+  return sprintf ('%s: %s',
+    case when (case when should_differ then equ (0, isnull (differ_status)) else isnull (differ_status) end) then 'PASSED' else '***FAILED' end,
+    title );
+}
+;
 
-http://local.virt/DAV/bound/manifest.rdf     nodeID://1000000000 http://example.com/test#query http://local.virt/DAV/bound/bound1.rq
-. . .
-http://local.virt/DAV/examples/manifest.rdf nodeID://1000000019 http://example.com/test#query http://local.virt/DAV/examples/ex11.2.3.1_1.rq
+select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'Identical graphs', 0,
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i200, 1) ),
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i200, 1) ),
+  100
+);
 
-10 Rows. -- 00000 msec.
+select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'Sizes differ', 1,
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i200, 1) ),
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i200, 1),
+    vector (#i101, #i201, #i301) ),
+  100
+);
 
-SQL> SPARQL define output:format "TTL" SELECT * WHERE {graph ?g { ?s ?p ?o }} limit 10;
-callret-0
-LONG VARCHAR
-_______________________________________________________________________________
+select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'Cardinality of a pred differ', 1,
+  vector (
+    vector (#i100, #i200, #ib300),
+    vector (#i101, #i200, #ib302),
+    vector (#i103, #i201, #ib304),
+    vector (#ib109, #i200, #ib109) ),
+  vector (
+    vector (#i100, #i200, #ib301),
+    vector (#i101, #i200, #ib303),
+    vector (#i103, #i201, #ib305),
+    vector (#ib109, #i201, #ib109) ),
+  100
+);
 
- at prefix :rdf <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- at prefix :rs <http://www.w3.org/2005/sparql-results#> .
- at prefix :xsd <http://www.w3.org/2001/XMLSchema#> .
-[ rdf:type rs:results ;
-  rs:result [
-      rs:binding [ rs:name "g" ; rs:value <http://local.virt/DAV/bound/manifest.rdf> ] ;
-      rs:binding [ rs:name "s" ; rs:value _:nodeID1000000000 ] ;
-      rs:binding [ rs:name "p" ; rs:value <http://example.com/test#query> ] ;
-      rs:binding [ rs:name "o" ; rs:value <http://local.virt/DAV/bound/bound1.rq> ] ;
-      ] ;
+select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'Bnodes in O with unique SP (equiv)', 0,
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i201, #ib301),
+    vector (#i101, #i201, #ib301),
+    vector (#i102, #i202, #ib303),
+    vector (#ib303, #i204, #i306),
+    vector (#ib303, #i205, #ib305),
+    vector (#i100, #i200, 1) ),
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i201, #ib302),
+    vector (#i101, #i201, #ib302),
+    vector (#i102, #i202, #ib304),
+    vector (#ib304, #i204, #i306),
+    vector (#ib304, #i205, #ib306),
+    vector (#i100, #i200, 1) ),
+  100
+);
 
-. . .
+select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'Bnodes in O with unique SP (diff 1)', 1,
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i201, #ib301),
+    vector (#i102, #i202, #ib303),
+    vector (#ib303, #i204, #i306),
+    vector (#ib303, #i205, #ib305),
+    vector (#i100, #i200, 1) ),
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i201, #ib302),
+    vector (#i102, #i202, #ib304),
+    vector (#ib304, #i204, #i306),
+    vector (#ib304, #i205, #i306),
+    vector (#i100, #i200, 1) ),
+  100
+);
 
-  rs:result [
-      rs:binding [ rs:name "g" ; rs:value <http://local.virt/DAV/examples/manifest.rdf> ] ;
-      rs:binding [ rs:name "s" ; rs:value _:nodeID1000000019 ] ;
-      rs:binding [ rs:name "p" ; rs:value <http://example.com/test#query> ] ;
-      rs:binding [ rs:name "o" ; rs:value <http://local.virt/DAV/examples/ex11.2.3.1_1.rq> ] ;
-      ] ;
-    ] .
+select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'Bnodes in O with unique SP (diff 2)', 1,
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i201, #ib301),
+    vector (#i102, #i202, #ib303),
+    vector (#ib303, #i204, #i306),
+    vector (#ib303, #i205, #ib305),
+    vector (#i100, #i200, 1) ),
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i201, #ib302),
+    vector (#i102, #i202, #ib304),
+    vector (#ib304, #i204, #i306),
+    vector (#ib304, #i205, #ib304),
+    vector (#i100, #i200, 1) ),
+  100
+);
 
-1 Rows. -- 00000 msec.
+select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'foaf-like-mix (equiv)', 0,
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i201, #ib301),
+    vector (#i100, #i201, #ib303),
+    vector (#i100, #i201, #ib305),
+    vector (#i100, #i201, #ib307),
+    vector (#ib301, #i202, 'Anna'),
+    vector (#ib303, #i202, 'Anna'),
+    vector (#ib305, #i202, 'Brigit'),
+    vector (#ib307, #i202, 'Clara'),
+    vector (#ib301, #i203, 'ann at ex.com'),
+    vector (#ib303, #i203, 'ann at am.com'),
+    vector (#ib305, #i203, 'root at ple.com'),
+    vector (#ib307, #i203, 'root at ple.com') ),
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i201, #ib302),
+    vector (#i100, #i201, #ib304),
+    vector (#i100, #i201, #ib306),
+    vector (#i100, #i201, #ib308),
+    vector (#ib302, #i202, 'Anna'),
+    vector (#ib304, #i202, 'Anna'),
+    vector (#ib306, #i202, 'Brigit'),
+    vector (#ib308, #i202, 'Clara'),
+    vector (#ib302, #i203, 'ann at ex.com'),
+    vector (#ib304, #i203, 'ann at am.com'),
+    vector (#ib306, #i203, 'root at ple.com'),
+    vector (#ib308, #i203, 'root at ple.com') ),
+  100
+);
 
-SQL> SPARQL define output:format "RDF/XML" SELECT * WHERE {graph ?g { ?s ?p ?o }} LIMIT 10;
-callret-0
-LONG VARCHAR
-_______________________________________________________________________________
+select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'foaf-like-mix (swapped names)', 1,
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i201, #ib301),
+    vector (#i100, #i201, #ib303),
+    vector (#i100, #i201, #ib305),
+    vector (#i100, #i201, #ib307),
+    vector (#ib301, #i202, 'Anna'),
+    vector (#ib303, #i202, 'Anna'),
+    vector (#ib305, #i202, 'Brigit'),
+    vector (#ib307, #i202, 'Clara'),
+    vector (#ib301, #i203, 'ann at ex.com'),
+    vector (#ib303, #i203, 'ann at am.com'),
+    vector (#ib305, #i203, 'root at ple.com'),
+    vector (#ib307, #i203, 'root at ple.com') ),
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i201, #ib302),
+    vector (#i100, #i201, #ib304),
+    vector (#i100, #i201, #ib306),
+    vector (#i100, #i201, #ib308),
+    vector (#ib302, #i202, 'Anna'),
+    vector (#ib304, #i202, 'Brigit'),
+    vector (#ib306, #i202, 'Anna'),
+    vector (#ib308, #i202, 'Clara'),
+    vector (#ib302, #i203, 'ann at ex.com'),
+    vector (#ib304, #i203, 'ann at am.com'),
+    vector (#ib306, #i203, 'root at ple.com'),
+    vector (#ib308, #i203, 'root at ple.com') ),
+  100
+);
 
-<rdf:RDF
-  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-  xmlns:rs="http://www.w3.org/2005/sparql-results#"
-  xmlns:xsd="http://www.w3.org/2001/XMLSchema#" >
-   <rs:results rdf:nodeID="rset">
-  <rs:result rdf:nodeID="sol206">
-   <rs:binding rdf:nodeID="sol206-0" rs:name="g"><rs:value rdf:resource="http://local.virt/DAV/bound/manifest.rdf"/></rs:binding>
-   <rs:binding rdf:nodeID="sol206-1" rs:name="s"><rs:value rdf:nodeID="1000000000"/></rs:binding>
-   <rs:binding rdf:nodeID="sol206-2" rs:name="p"><rs:value rdf:resource="http://example.com/test#query"/></rs:binding>
-   <rs:binding rdf:nodeID="sol206-3" rs:name="o"><rs:value rdf:resource="http://local.virt/DAV/bound/bound1.rq"/></rs:binding>
-  </rs:result>
+select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'foaf-like-mix (swapped names)', 1,
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i201, #ib301),
+    vector (#i100, #i201, #ib303),
+    vector (#i100, #i201, #ib305),
+    vector (#i100, #i201, #ib307),
+    vector (#ib301, #i202, 'Anna'),
+    vector (#ib303, #i202, 'Anna'),
+    vector (#ib305, #i202, 'Brigit'),
+    vector (#ib307, #i202, 'Clara'),
+    vector (#ib301, #i203, 'ann at ex.com'),
+    vector (#ib303, #i203, 'ann at am.com'),
+    vector (#ib305, #i203, 'root at ple.com'),
+    vector (#ib307, #i203, 'root at ple.com') ),
+  vector (
+    vector (#i100, #i200, #i300),
+    vector (#i100, #i201, #ib302),
+    vector (#i100, #i201, #ib304),
+    vector (#i100, #i201, #ib306),
+    vector (#i100, #i201, #ib308),
+    vector (#ib302, #i202, 'Anna'),
+    vector (#ib304, #i202, 'Brigit'),
+    vector (#ib306, #i202, 'Anna'),
+    vector (#ib308, #i202, 'Clara'),
+    vector (#ib302, #i203, 'ann at ex.com'),
+    vector (#ib304, #i203, 'ann at am.com'),
+    vector (#ib306, #i203, 'root at ple.com'),
+    vector (#ib308, #i203, 'root at ple.com') ),
+  100
+);
 
-. . .
+select DB.DBA.TEST_RDF_TRIPLE_DICTS_DIFFER_EXP ( 'bnodes only (equiv that can not be proven)', 1,
+  vector (
+    vector (#ib101, #i200, #ib103),
+    vector (#ib103, #i201, #ib101) ),
+  vector (
+    vector (#ib102, #i200, #ib104),
+    vector (#ib104, #i201, #ib102) ),
+  100
+);
 
-  <rs:result rdf:nodeID="sol5737">
-   <rs:binding rdf:nodeID="sol5737-0" rs:name="g"><rs:value rdf:resource="http://local.virt/DAV/examples/manifest.rdf"/></rs:binding>
-   <rs:binding rdf:nodeID="sol5737-1" rs:name="s"><rs:value rdf:nodeID="1000000019"/></rs:binding>
-   <rs:binding rdf:nodeID="sol5737-2" rs:name="p"><rs:value rdf:resource="http://example.com/test#query"/></rs:binding>
-   <rs:binding rdf:nodeID="sol5737-3" rs:name="o"><rs:value rdf:resource="http://local.virt/DAV/examples/ex11.2.3.1_1.rq"/></rs:binding>
-  </rs:result>
- </rs:results>
-</rdf:RDF>
+sparql clear graph <http://GraphCmp/One>;
+
+TTLP ('@prefix foaf: <http://i-dont-remember-it> .
+_:me
+	a foaf:Person ;
+	foaf:knows	[ foaf:nick "oerling" ; foaf:title "Mr." ; foaf:sha1 "abra" ] ;
+	foaf:knows	[ foaf:nick "kidehen" ; foaf:title "Mr." ; foaf:sha1 "bra" ] ;
+	foaf:knows	[ foaf:nick "aldo" ; foaf:title "Mr." ; foaf:sha1 "cada" ] .',
+'', 'http://GraphCmp/One' );
+
+sparql clear graph <http://GraphCmp/Two>;
+TTLP ('@prefix foaf: <http://i-dont-remember-it> .
+_:iv
+	foaf:knows	[ foaf:title "Mr." ; foaf:sha1 "cada" ; foaf:nick "aldo" ] ;
+	foaf:knows	[ foaf:sha1 "bra" ; foaf:title "Mr." ; foaf:nick "kidehen" ] ;
+	foaf:knows	[ foaf:nick "oerling" ; foaf:sha1 "abra" ; foaf:title "Mr." ] ;
+	a foaf:Person .',
+'', 'http://GraphCmp/Two' );
+
+select DB.DBA.TEST_RDF_GRAPHS_DIFFER_EXP ( 'nonexisting graphs (equiv, of course)', 0,
+  'http://GraphCmp/NoSuch', 'http://GraphCmp/NoSuch',
+  100 );
+
+select DB.DBA.TEST_RDF_GRAPHS_DIFFER_EXP ( 'throughout test on foafs (equiv)', 0,
+  'http://GraphCmp/One', 'http://GraphCmp/Two',
+  100 );
 
-1 Rows. -- 00000 msec.
 ]]></programlisting>
-<para>SPARQL CONSTRUCT and SPARQL DESCRIBE results are serialized as one would expect:</para>
+</sect4>
+<sect4 id="rdfsparulexamples12"><title>Example for Adding triples to graph</title>
 <programlisting><![CDATA[
-SQL> SPARQL
-define output:format "TTL"
-CONSTRUCT { ?s ?p "004" }
-WHERE
-  {
-    graph ?g { ?s ?p 4 }
-  };
+SQL>SPARQL 
+INSERT INTO GRAPH <http://BookStore.com>
+{ <http://www.dajobe.org/foaf.rdf#i> <http://purl.org/dc/elements/1.1/title>  "SPARQL and RDF" .
+  <http://www.dajobe.org/foaf.rdf#i> <http://purl.org/dc/elements/1.1/date> <1999-01-01T00:00:00>.
+  <http://www.w3.org/People/Berners-Lee/card#i> <http://purl.org/dc/elements/1.1/title> "Design notes" .
+  <http://www.w3.org/People/Berners-Lee/card#i> <http://purl.org/dc/elements/1.1/date> <2001-01-01T00:00:00>.
+  <http://www.w3.org/People/Connolly/#me> <http://purl.org/dc/elements/1.1/title> "Fundamentals of Compiler Design" .
+  <http://www.w3.org/People/Connolly/#me> <http://purl.org/dc/elements/1.1/date> <2002-01-01T00:00:00>. };
 callret-0
-LONG VARCHAR
-_______________________________________________________________________________
-
-<http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#four> <http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#int1> "004" .
-_:b1000000913 <http://www.w3.org/2001/sw/DataAccess/tests/result-set#index> "004" .
-
+VARCHAR
+_________________________________________________________________
 
-1 Rows. -- 00000 msec.
+Insert into <http://BookStore.com>, 6 triples -- done
 
-SQL> SPARQL
-define output:format "RDF/XML"
-CONSTRUCT { ?s ?p "004" }
-WHERE
-  {
-    graph ?g { ?s ?p 4 }
-  };
+1 Rows. -- 0 msec.
+]]></programlisting>
+</sect4>
+<sect4 id="rdfsparulexamples13"><title>Example for Updating triples from graph</title>
+<para>A SPARQL/Update request that contains a triple to be deleted and a triple to be added (used here to correct a book title).
+</para>
+<programlisting><![CDATA[
+SQL>SPARQL
+MODIFY GRAPH <http://BookStore.com>
+DELETE
+ { <http://www.w3.org/People/Connolly/#me>  <http://purl.org/dc/elements/1.1/title>  "Fundamentals of Compiler Design" }
+INSERT
+ { <http://www.w3.org/People/Connolly/#me>  <http://purl.org/dc/elements/1.1/title>  "Fundamentals" };
 callret-0
-LONG VARCHAR
+VARCHAR
 _______________________________________________________________________________
 
-<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
-<rdf:Description about="http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#four"><ns0pred:int1 xmlns:ns0pred="http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#">004</ns0pred:int1></rdf:Description>
-<rdf:Description rdf:nodeID="b1000000913"><ns0pred:index xmlns:ns0pred="http://www.w3.org/2001/sw/DataAccess/tests/result-set#">004</ns0pred:index></rdf:Description>
-</rdf:RDF>
+Modify <http://BookStore.com>, delete 1 and insert 1 triples -- done
 
-1 Rows. -- 00000 msec.
+1 Rows. -- 20 msec.
 ]]></programlisting>
-<para>SPARQL ASK returns a non-empty result set if a match is found for the graph pattern, an empty result set otherwise. If <emphasis>output:format</emphasis> is specified then the query makes a 'boolean result' document instead:</para>
+</sect4>
+<sect4 id="rdfsparulexamples14"><title>Example for Deleting triples from graph</title>
+<para>The example below has a request to delete all records of old books (dated before year 2000)
+</para>
 <programlisting><![CDATA[
-SQL> SPARQL ASK WHERE {graph ?g { ?s ?p 4 }};
-__ask_retval
-INTEGER
+SQL>SPARQL
+PREFIX dc:  <http://purl.org/dc/elements/1.1/>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+DELETE FROM GRAPH <http://BookStore.com> { ?book ?p ?v }
+WHERE
+  { GRAPH  <http://BookStore.com>
+   { ?book dc:date ?date
+     FILTER ( xsd:dateTime(?date) < xsd:dateTime("2000-01-01T00:00:00")).
+    ?book ?p ?v.
+   }
+  };
 _______________________________________________________________________________
 
-1
-
-1 Rows. -- 00000 msec.
+Delete from <http://BookStore.com>, 6 triples -- done
 
-SQL> SPARQL ASK WHERE {graph ?g { ?s ?p "no such" }};
-__ask_retval
-INTEGER
-_______________________________________________________________________________
-
-
-0 Rows. -- 00000 msec.
-
-SQL> SPARQL define output:format "TTL" ASK WHERE {graph ?g { ?s ?p 4 }};
-callret
-VARCHAR
-_______________________________________________________________________________
-
- at prefix :rdf <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- @prefix :rs <http://www.w3.org/2005/sparql-results#> .
-[ rdf:type rs:results ; rs:boolean TRUE ]
-
-1 Rows. -- 00000 msec.
-
-SQL> SPARQL define output:format "RDF/XML" ASK WHERE {graph ?g { ?s ?p 4 }};
-callret
+1 Rows. -- 10 msec.
+]]></programlisting>
+</sect4>
+<sect4 id="rdfsparulexamples15"><title>Example for Copying triples from one graph to another</title>
+<para>The next snippet copies records from one named graph to another based on a pattern:
+</para>
+<programlisting><![CDATA[
+SQL>SPARQL clear graph <http://BookStore.com>;
+SQL>SPARQL clear graph <http://NewBookStore.com>;
+SQL>SPARQL
+insert in graph <http://BookStore.com>
+  {
+    <http://www.dajobe.org/foaf.rdf#i> <http://purl.org/dc/elements/1.1/date> <1999-04-01T00:00:00> .
+    <http://www.w3.org/People/Berners-Lee/card#i> <http://purl.org/dc/elements/1.1/date> <1998-05-03T00:00:00> .
+    <http://www.w3.org/People/Connolly/#me> <http://purl.org/dc/elements/1.1/date> <2001-02-08T00:00:00>
+  };
+SQL>SPARQL
+PREFIX dc:  <http://purl.org/dc/elements/1.1/>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+INSERT INTO GRAPH <http://NewBookStore.com> { ?book ?p ?v }
+WHERE
+  { GRAPH  <http://BookStore.com>
+   { ?book dc:date ?date
+     FILTER ( xsd:dateTime(?date) > xsd:dateTime("2000-01-01T00:00:00")).
+     ?book ?p ?v.
+   }
+  };
+callret-0
 VARCHAR
 _______________________________________________________________________________
 
-<rdf:RDF
-  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-  xmlns:rs="http://www.w3.org/2005/sparql-results#"
-  xmlns:xsd="http://www.w3.org/2001/XMLSchema#" >
-   <rs:results rdf:nodeID="rset">
-    <rs:boolean rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">1</rs:boolean></results></rdf:RDF>
+Insert into <http://NewBookStore.com>, 6 triples -- done
 
-1 Rows. -- 00000 msec.
+1 Rows. -- 30 msec.
 ]]></programlisting>
-</sect3>
-</sect2>
-<sect2 id="rdfapi">
-<title>API Functions</title>
-<para>
-SPARQL can be used inline wherever SQL can be used.
-The only API functions that one needs to know are the ones for loading RDF data into the store.
-Dynamic SQL client applications can issue SPARQL queries against Virtuoso through the regular SQL client API, ODBC, JDBC or any other supported API, simply by prefixing the SPARQL query with the SPARQL keyword. Parameters work just as with dynamic SQL.
-Stored procedures can have SPARQL expressions inline and can declare cursors over SPARQL result sets.
-</para>
-
-<para>
-Value conversions between SQL and SPARQL are most often automatic and
-invisible. In some cases one needs to be aware of the different
-SPARQL value representations (valmodes). SPARQL offers declarations
-for specifying whether returned graphs are to be serialized as XML
-or Turtle,  or whether these will be hash tables of
-triples. See <link linkend="fn_dict_new"><function>dict_new()</function></link> and related functions for a description of the hash table SQL data type.
-The use of dict's is convenient for further programmatic processing of graphs.
-</para>
-
-<para>RDF-related procedures use Virtuoso/PL vectors
-and dictionaries to represent RDF triples and sets of triples.</para>
-<para><emphasis>Valmode</emphasis> means the "format of values returned by an
-expression", i.e. 'short', 'long' or 'SQL value'.</para>
-<para><emphasis>Triple vector</emphasis> is a vector (array) of S, P and O, where all values are in
-'long' formats, i.e. IRI_ID's for IRI values, numbers or datetimes for corresponding XMLSchema types, special "RDF box" objects if O is neither string nor IRI.</para>
-<para><emphasis>Dictionary of triples</emphasis> or <emphasis>Hash table of triples</emphasis> is an
-dictionary object made by the SQL function <emphasis>dict_new ()</emphasis> whose keys are
-triple vectors and values are not specified; this is a good storage
-format for an unordered set of distinct triples.</para>
-<para><emphasis>Dictionary of blank node names</emphasis> is a dictionary used for tricky
-processing of a number of TURTLE or RDF /XML descriptions of subgraphs
-that come from a common graph. Imagine a situation where different
-descriptions actually refer to the same blank nodes of the original graph
-and, moreover, the application that generates these descriptions always
-generates the same blank node id string for the same node. A reader of
-descriptions can correctly join described subgraphs into one big
-subgraph by filling in a dictionary that contains blank node id strings
-as keys and IRI_ID's assigned to those strings as dependent data. 
-The sharing of the same node dictionary by all readers of an application will ensure that no blank node is duplicated.</para>
-<sect3 id="rdfapidataimport"><title>Data Import</title>
-<sect4 id="rdfapidataimportttlp"><title>Using TTLP</title>
-<para>DB.DBA.TTLP() parses TTL (TURTLE or N3 resource) and places its triples into DB.DBA.RDF_QUAD.</para>
-<programlisting>
-create procedure DB.DBA.TTLP (
-    in strg any,       -- text of the resource
-    in base varchar,   -- base IRI to resolve relative IRIs to absolute
-    in graph varchar, -- target graph IRI, parsed triples will appear in that graph.
-    in flags int)   -- bitmask of flags that permit some sorts of syntax errors in resource, use 0.
-</programlisting>
-<para>For loading a file of any great length, it is more practical to use
-the file_to_string_output function.
-</para>
-<para>It is important the file be accessible to the Virtuoso server. You need to have set properly set the
-<emphasis>DirsAllowed</emphasis> parameter value in the section [Parameters] of the Virtuoso database INI file.
-For example on Windows it could be:
-</para>
-<programlisting>
-virtuoso.ini file:
-[Parameters]
-...
-DirsAllowed =  .\tmp
-...
-</programlisting>
-<para>So, in the example, the file you want to import from, should be in the tmp folder or in a subfolder.
-Note that this example folder is a subfolder of the Virtuoso Server working directory.
-</para>
-<programlisting>
-SQL> DB.DBA.TTLP (file_to_string_output ('.\tmp\data.ttl'), '', 'http://my_graph', 0);
-</programlisting>
 </sect4>
-<sect4 id="rdfapidataimportttlpmt"><title>Using TTLP_MT</title>
-<para>The DB.DBA.TTLP_MT() procedure is like DB.DBA.TTLP() but loads the file on multiple threads,
-using parallel I/O and multiprocessing if available. The function does not leave a transaction log.
-Hence, after a successful load, one should execute the checkpoint statement to make sure that a
-server restart does not wipe out the results.
+<sect4 id="rdfsparulexamples16"><title>Example for Moving triples from one graph to another</title>
+<para>This example moves records from one named graph to another named graph based on a pattern:
 </para>
-<programlisting>
-create procedure DB.DBA.TTLP_MT (
-    in strg any,       -- text of the resource
-    in base varchar,   -- base IRI to resolve relative IRIs to absolute
-    in graph varchar,  -- target graph IRI, parsed triples will appear in that graph.
-    in flags int) -- flags, use 0
-</programlisting>
-</sect4>
-<sect4 id="rdfapidataimportttlpmt"><title>Using RDF_LOAD_RDFXML_MT</title>
-<para>For loading large resources when transactional integrity is not important (loading of a single resource may take more than one transaction)
-you can use also the <emphasis>DB.DBA.RDF_LOAD_RDFXML_MT()</emphasis> procedure:</para>
-<programlisting>
-create procedure DB.DBA.RDF_LOAD_RDFXML_MT (
-    in strg varchar,  -- text of the resource
-    in base varchar,  -- base IRI to resolve relative IRIs to absolute
-    in graph varchar) -- target graph IRI, parsed triples will appear in that graph.
-</programlisting>
-<para>The following example demonstrates importing data from the RDF resource with URI: http://www.w3.org/People/Berners-Lee/card</para>
 <programlisting><![CDATA[
-SQL>create procedure MY_LOAD_FILE (in full_uri varchar, in in_resultset integer := 0)
-{
-  declare REPORT varchar;
-  declare graph_uri, dattext varchar;
-  declare app_env any;
-  app_env := null;
-  whenever sqlstate '*' goto err_rep;
-  if (not in_resultset)
-    result_names (REPORT);
-  dattext := cast (XML_URI_GET_AND_CACHE (full_uri) as varchar);
-  MY_SPARQL_REPORT (sprintf ('Downloading %s: %d bytes',
-      full_uri, length (dattext) ) );
-  graph_uri := full_uri;
-  DELETE FROM RDF_QUAD WHERE G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_uri);
-  DB.DBA.RDF_LOAD_RDFXML_MT (dattext, full_uri, graph_uri);
-  return graph_uri;
-err_rep:
-  result (sprintf ('%s: %s', __SQL_STATE, __SQL_MESSAGE));
-  return graph_uri;
-}
-;
-
-Done. -- 0 msec.
-
-SQL>create procedure MY_SPARQL_REPORT(in strg varchar)
-{
-  if (__tag(strg) <> 182)
-    strg := cast (strg as varchar) || sprintf (' -- not a string, tag=%d', __tag(strg));
-  strg := replace (strg, 'SPARQL_DAV_DATA_URI()', '\044{SPARQL_DAV_DATA_URI()}');
-  strg := replace (strg, 'SPARQL_DAV_DATA_PATH()', '\044{SPARQL_DAV_DATA_PATH()}');
-  strg := replace (strg, 'SPARQL_FILE_DATA_ROOT()', '\044{SPARQL_FILE_DATA_ROOT()}');
-  result (strg);
-}
-;
-
-Done. -- 0 msec.
+SQL>SPARQL
+PREFIX dc:  <http://purl.org/dc/elements/1.1/>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
 
-SQL> MY_LOAD_FILE('http://www.w3.org/People/Berners-Lee/card');
-REPORT
-VARCHAR
+INSERT INTO GRAPH <http://NewBookStore.com>
+ { ?book ?p ?v }
+WHERE
+  { GRAPH  <http://BookStore.com>
+     { ?book dc:date ?date .
+       FILTER ( xsd:dateTime(?date) > xsd:dateTime("2000-01-01T00:00:00")).
+       ?book ?p ?v.
+     }
+  };
 _______________________________________________________________________________
 
-Downloading http://www.w3.org/People/Berners-Lee/card: 17773 bytes
+Insert into <http://NewBookStore.com>, 6 triples -- done
 
-1 Rows. -- 4046 msec.
+1 Rows. -- 10 msec.
 
 SQL>SPARQL
-SELECT *
-FROM <http://www.w3.org/People/Berners-Lee/card>
-WHERE {?s ?p ?o} ;
-
-s                                             p                                               o
-VARCHAR                                       VARCHAR                                         VARCHAR
-__________________________________________________________________________________________________________
+PREFIX dc:  <http://purl.org/dc/elements/1.1/>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+DELETE FROM GRAPH <http://BookStore.com>
+ { ?book ?p ?v }
+WHERE
+  { GRAPH  <http://BookStore.com>
+      { ?book dc:date ?date .
+        FILTER ( xsd:dateTime(?date) > xsd:dateTime("2000-01-01T00:00:00")).
+        ?book ?p ?v.
+      }
+  };
+_______________________________________________________________________________
 
-http://bblfish.net/people/henry/card#me       http://xmlns.com/foaf/0.1/name                  Henry Story
-http://www.w3.org/People/Berners-Lee/card#i   http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://xmlns.com/foaf/0.1/Person
-http://www.w3.org/People/Berners-Lee/card#i   http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2000/10/swap/pim/contact#Male
-http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/nick                  TimBL
-http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/nick                  timbl
-http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/mbox                  mailto:timbl at w3.org
-http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/mbox_sha1sum          965c47c5a70db7407210cef6e4e6f5374a525c5c
-http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://bblfish.net/people/henry/card#me
-http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://hometown.aol.com/chbussler/foaf/chbussler.foaf#me
-http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://danbri.org/foaf#danbri
-http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://norman.walsh.name/knows/who#norman-walsh
-http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://www.aaronsw.com/about.xrdf#aaronsw
-http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://www.ivan-herman.net/foaf.rdf#me
-http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://www.w3.org/People/Berners-Lee/card#amy
-http://www.w3.org/People/Berners-Lee/card#i   http://xmlns.com/foaf/0.1/knows                 http://dig.csail.mit.edu/People/RRS
-..........
+Delete from <http://BookStore.com>, 3 triples -- done
 
+1 Rows. -- 10 msec.
 ]]></programlisting>
 </sect4>
-<sect4 id="rdfapidataimportttlphash"><title>Using RDF_TTL2HASH</title>
-<para>The DB.DBA.RDF_TTL2HASH() does not load TTL content, instead it returns a dictionary of triples in 'long valmode'.</para>
-<programlisting>
-create function DB.DBA.RDF_TTL2HASH (
-    in strg any,
-    in base varchar,
-    in graph varchar ) returns any
-</programlisting>
-<para>Parameter <emphasis>flags</emphasis> is useful when the syntax of the resource is TURTLE-like, but not correct TURTLE.
-By default, use zero value.
-Add 1 to let string literals contain end-of-line characters.
-Add 2 to suppress error messages on blank node verbs.
-Add 4 to allow variables instead of blank nodes.
-Add 8 to silently skip triples with literal subjects.
-</para>
-</sect4>
-<sect4 id="rdfapidataimportloadrdfxml"><title>Using RDF_LOAD_RDFXML</title>
-<para>The DB.DBA.RDF_LOAD_RDFXML() procedure parses RDF/XML and places its triples into DB.DBA.RDF_QUAD.</para>
-<programlisting>
-create procedure DB.DBA.RDF_LOAD_RDFXML (
-    in strg any,           -- text of and XML document
-    in base_iri varchar,   -- base IRI to resolve relative IRIs
-    in graph_iri varchar ) -- the IRI of destination graph
-</programlisting>
-<para>See <link linkend="rdfsparqlrulespecifywhatindexexample">example</link></para>.
-</sect4>
-<sect4 id="rdfapidataimportloadrdfuri"><title>Using RDF_QUAD_URI, RDF_QUAD_URI_L and RDF_QUAD_URI_L_TYPED</title>
-<para>To insert a single quad into DB.DBA.RDF_QUAD() table, use one of these procedures:</para>
-<programlisting>
--- Simple insertion of a quad where the object is a node
-create procedure DB.DBA.RDF_QUAD_URI (
-  in g_uri varchar, in s_uri varchar, in p_uri varchar,
-  in o_uri varchar ) -- IRI string or IRI_ID
-
--- Simple insertion of a quad where the object is a literal value in 'SQL valmode'
-create procedure DB.DBA.RDF_QUAD_URI_L (
-  in g_uri varchar, in s_uri varchar, in p_uri varchar,
-  in o_lit any ) -- string, number or datetime, NULL is not allowed
-
-create procedure DB.DBA.RDF_QUAD_URI_L_TYPED (
-  in g_uri varchar, in s_uri varchar, in p_uri varchar,
-  in o_lit any,     -- string value of the literal
-  in dt any,        -- datatype as IRI string or IRI_ID, can be NULL
-  in lang varchar ) -- language as string or NULL
-</programlisting>
-</sect4>
-<para>Arguments g_uri, s_uri and p_uri of these three functions should be IRI strings or IRI_IDs.
-All string arguments should be in UTF-8 encoding, otherwise they will be stored but are not queryable via SPARQL.</para>
-</sect3>
-<sect3 id="rdfapidataexport"><title>Data Export</title>
-<para>These two procedures serialize a vector of triples into a session, in TURTLE or RDF/XML syntax.
-In their current versions, every triple is printed in a separate top-level record (say, in an rdf:Description tag), without any pretty-printing or nesting optimization.
-</para>
-<programlisting>
-create procedure DB.DBA.RDF_TRIPLES_TO_TTL (
-    inout triples any, -- vector of triples in 'long valmode'.
-    inout ses any )    -- an output stream in server default encoding
+<sect4 id="rdfsparulexamples17"><title>Example for BBC SPARQL Collection</title>
+<programlisting><![CDATA[
+## All programmes related to James Bond:
+PREFIX po: <http://purl.org/ontology/po/>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+SELECT ?uri ?label
+WHERE
+  {
+    ?uri po:category
+      <http://www.bbc.co.uk/programmes/people/bmFtZS9ib25kLCBqYW1lcyAobm8gcXVhbGlmaWVyKQ#person> ;
+    rdfs:label ?label.
+   }
+]]></programlisting>
 
-create procedure DB.DBA.RDF_TRIPLES_TO_RDF_XML_TEXT (
-    inout triples any,          -- vector of triples in 'long valmode'.
-    in print_top_level integer, -- zero if only rdf:Description tags should be written,
-      -- non-zero if the rdf:RDF top-level element should also be written
-    inout ses any )             -- an output stream in server default encoding
-</programlisting>
-</sect3>
-<sect3 id="rdfapidataquery"><title>Data query</title>
-<programlisting>
--- Local execution of SPARQL via SPARQL protocol, produces a result set of SQL values.
-create procedure DB.DBA.SPARQL_EVAL (
-    in query varchar,      -- text of SPARQL query to execute
-    in dflt_graph varchar, -- default graph IRI, if not NULL then this overrides what's specified in query
-    in maxrows integer )   -- limit on numbers of rows that should be returned.
+<programlisting><![CDATA[
+## Find all Eastenders broadcasta after 2009-01-01,
+## along with the broadcast version & type
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>
+PREFIX po: <http://purl.org/ontology/po/>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+SELECT ?version_type ?broadcast_start
+WHERE
+  {
+    <http://www.bbc.co.uk/programmes/b006m86d#programme> po:episode ?episode .
+    ?episode po:version ?version .
+    ?version a ?version_type .
+    ?broadcast po:broadcast_of ?version .
+    ?broadcast event:time ?time .
+    ?time tl:start ?broadcast_start .
+    FILTER ( (?version_type != <http://purl.org/ontology/po/Version>)
+    && (?broadcast_start > "2009-01-01T00:00:00Z"^^xsd:dateTime) )
+  }
+]]></programlisting>
 
--- Similar to SPARQL_EVAL, but returns a vector of vectors of SQL values.
-create function DB.DBA.SPARQL_EVAL_TO_ARRAY (
-    in query varchar,      -- text of SPARQL query to execute
-    in dflt_graph varchar, -- default graph IRI, if not NULL then this overrides what's specified in query
-    in maxrows integer )   -- limit on numbers of rows that should be returned.
-returns any
-</programlisting>
-<programlisting>
--- Remote execution of SPARQL via SPARQL protocol, produces a result set of SQL values.
-create procedure DB.DBA.SPARQL_REXEC (
-    in service varchar,    -- service URI to call via HTTP
-    in query varchar,      -- text of SPARQL query to execute
-    in dflt_graph varchar, -- default graph IRI, if not NULL then this overrides what's specified in query
-    in named_graphs any,   -- vector of named graph IRIs, if not NULL then this overrides what's specified in query
-    in req_hdr any,        -- additional HTTP header lines that should be passed to the service; 'Host: ...' is most popular.
-    in maxrows integer,    -- limit on numbers of rows that should be returned.
-    in bnode_dict any )    -- dictionary of bnode ID references.
+<programlisting><![CDATA[
+## Find all programmes that featured both the Foo Fighters and Al Green
+PREFIX po: <http://purl.org/ontology/po/>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX mo: <http://purl.org/ontology/mo/>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX tl: <http://purl.org/NET/c4dm/timeline.owl#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+SELECT DISTINCT ?programme ?label
+WHERE
+  {
+    ?event1 po:track ?track1 .
+    ?track1 foaf:maker ?maker1 .
+    ?maker1 owl:sameAs
+       <http://www.bbc.co.uk/music/artists/67f66c07-6e61-4026-ade5-7e782fad3a5d#artist> .
+    ?event2 po:track ?track2 .
+    ?track2 foaf:maker ?maker2 .
+    ?maker2 owl:sameAs
+       <http://www.bbc.co.uk/music/artists/fb7272ba-f130-4f0a-934d-6eeea4c18c9a#artist> .
+    ?event1 event:time ?t1 .
+    ?event2 event:time ?t2 .
+    ?t1 tl:timeline ?tl .
+    ?t2 tl:timeline ?tl .
+    ?version po:time ?t .
+    ?t tl:timeline ?tl .
+    ?programme po:version ?version .
+    ?programme rdfs:label ?label .
+  }
+]]></programlisting>
 
--- Similar to SPARQL_REXEC (), but returns a vector of vectors of SQL values.
--- All arguments are the same.
-create function DB.DBA.SPARQL_REXEC_TO_ARRAY (
-    in service varchar, in query varchar, in dflt_graph varchar, in named_graphs any,
-    in req_hdr any, in maxrows integer, in bnode_dict any)
-returns any
+<programlisting><![CDATA[
+## Get short synopsis' of EastEnders episodes
+PREFIX po: <http://purl.org/ontology/po/>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+SELECT ?t ?o
+WHERE
+{
+    <http://www.bbc.co.uk/programmes/b006m86d#programme> po:episode ?e .
+    ?e a po:Episode .
+    ?e po:short_synopsis ?o .
+    ?e dc:title ?t
+  }
+]]></programlisting>
 
--- Similar to SPARQL_REXEC (), but fills in output parameters with metadata (like exec metadata) and a vector of vector
-s of 'long valmode' values.
--- First seven arguments are the same.
-create procedure DB.DBA.SPARQL_REXEC_WITH_META (
-    in service varchar, in query varchar, in dflt_graph varchar, in named_graphs any,
-    in req_hdr any, in maxrows integer, in bnode_dict any,
-    out metadata any,  -- metadata like exec () returns.
-    out resultset any) -- results as 'long valmode' value.
-</programlisting>
-<para>If the query is a CONSTRUCT or DESCRIBE then the result set consists of a single row and column, the value inside is a dictionary of triples in 'long valmode'.</para>
-</sect3>
-</sect2>
-<sect2 id="rdfinternalfunctions"><title>Useful Internal Functions</title>
-<sect3 id="rdfinternalconversion"><title>Conversion Functions for XMLSchema/RDF Data Serialization Syntax</title>
-<para>These functions emulate constructor functions from XQuery Core Function Library.</para>
-<programlisting>
-create function DB.DBA."http://www.w3.org/2001/XMLSchema#boolean" (in strg any) returns integer
-create function DB.DBA."http://www.w3.org/2001/XMLSchema#dateTime" (in strg any) returns datetime
-create function DB.DBA."http://www.w3.org/2001/XMLSchema#double" (in strg varchar) returns double precision
-create function DB.DBA."http://www.w3.org/2001/XMLSchema#float" (in strg varchar) returns float
-create function DB.DBA."http://www.w3.org/2001/XMLSchema#integer" (in strg varchar) returns integer
-</programlisting>
-</sect3>
-<sect3 id="rdfinternalpredicates"><title>RDF-specific Predicates</title>
-<programlisting>
--- Returns 1 if string s matches pattern p, 0 otherwise
-create function DB.DBA.RDF_REGEX (
-    in s varchar,            -- source string to check
-    in p varchar,            -- regular expression pattern string
-    in coll varchar := null) -- unused for now (modes are not yet implemented)
+<programlisting><![CDATA[
+## Get short synopsis' of EastEnders episodes (with graph)
+PREFIX po: <http://purl.org/ontology/po/>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+SELECT ?g ?t ?o
+WHERE
+  {
+    graph ?g
+      {
+         <http://www.bbc.co.uk/programmes/b006m86d#programme> po:episode ?e .
+         ?e a po:Episode .
+         ?e po:short_synopsis ?o .
+         ?e dc:title ?t
+      }
+  }
+]]></programlisting>
 
--- Returns 1 if language identifier r matches lang pattern t
-create function DB.DBA.RDF_LANGMATCHES (
-  in r varchar, -- language identifies (string or NULL)
-  in t varchar) -- language pattern (exact name, first two letters or '*')
-</programlisting>
-</sect3>
-</sect2>
-<sect2 id="rdfdefaultgraph"><title>Default and Named Graphs</title>
-<para>Sometimes the default graph IRI is not known when the SPARQL query is composed. It can be added at the very last moment by providing the IRI in a 'define' clause as follows:</para>
 <programlisting><![CDATA[
-define input:default-graph-uri <http://example.com&gt
+## Get reviews where John Paul Jones' has been involved
+
+PREFIX mo: <http://purl.org/ontology/mo/>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX rev: <http://purl.org/stuff/rev#>
+PREFIX po: <http://purl.org/ontology/po/>
+SELECT DISTINCT ?r_name, ?rev
+WHERE
+  {
+    {
+      <http://www.bbc.co.uk/music/artists/4490113a-3880-4f5b-a39b-105bfceaed04#artist> foaf:made ?r1 .
+      ?r1 a mo:Record .
+      ?r1 dc:title ?r_name .
+      ?r1 rev:hasReview ?rev
+    }
+    UNION
+    {
+      <http://www.bbc.co.uk/music/artists/4490113a-3880-4f5b-a39b-105bfceaed04#artist> mo:member_of ?b1 .
+      ?b1 foaf:made ?r1 .
+      ?r1 a mo:Record .
+      ?r1 dc:title ?r_name .
+      ?r1 rev:hasReview ?rev
+    }
+  }
 ]]></programlisting>
-<para>Such a definition overrides the default graph URI set in query by the 'FROM ...' clause (if any).</para>
-<para>The query may contain more than one <emphasis>define input:default-graph-uri</emphasis>.
-The set of values of <emphasis>input:default-graph-uri</emphasis> has the highest possible priority and cannot be redefined in the rest of the text of the query by FROM clauses.</para>
-<para>FROM NAMED clauses can be used multiple times in one query:</para>
+</sect4>
+<sect4 id="rdfsparulexamples18"><title>Example usage of IN operator for retrieving all triples for each entity</title>
+<para>To retrieve all triples for each entity for a given list of entities uris, one might use the following syntax:</para>
 <programlisting><![CDATA[
-SPARQL
-SELECT ?id
-    FROM NAMED <http://example.com/user1.ttl>
-    OPTION (get:soft "soft", get:method "GET")
-    FROM NAMED <http://example.com/user2.ttl>
-    OPTION (get:soft "soft", get:method "GET")
-  WHERE { GRAPH ?g { ?id a ?o } }
+SELECT ?p ?o
+WHERE
+  {
+    ?s ?p ?o .
+    FILTER ( ?s IN (<someGraph#entity1>, <someGraph#entity2>, ...<someGraph#entityN> ) )
+  }
 ]]></programlisting>
-<para>Similarly, <emphasis>define input:named-graph-uri <http://example.com></emphasis> is a replacement for a FROM NAMED clause</para>
-<para>
-When Virtuoso receives a SPARQL request via HTTP, the value of the default graph can be set in the protocol using a <emphasis>default-graph-uri</emphasis> HTTP parameter.
-Multiple occurrences of this parameter are allowed. This HTTP parameter is converted into <emphasis>define input:default-graph-uri</emphasis>.
-There's similar support for <emphasis>named-graph-uri</emphasis> HTTP parameter.
-For debugging purposes, graph names set in the protocol are sent back in the reply header as <emphasis>X-SPARQL-default-graph: ...</emphasis> and <emphasis>X-SPARQL-named-graph: ...</emphasis> header lines, one line per graph.
+<para>So to demonstrate this feature, execute the following query:
 </para>
-<para>
-A web service endpoint may provide different default configurations for different host names mentioned in HTTP requests.
-This facility is configured via table <emphasis>DB.DBA.SYS_SPARQL_HOST</emphasis>.
-</para>
-<programlisting>
-create table DB.DBA.SYS_SPARQL_HOST (
-  SH_HOST	varchar not null primary key, -- host mask
-  SH_GRAPH_URI	varchar,      -- 'default default' graph uri
-  SH_USER_URI	varchar,      -- reserved for any use in applications
-  SH_DEFINES	long varchar  -- additional defines for requests
-)
-</programlisting>
-<para>
-When the SPARQL web service endpoint receives a request it checks the <emphasis>Host</emphasis> HTTP header line.
-This line contains zero or more target host names, delimited by commas.
-For every host name in the line, the service scans the <emphasis>DB.DBA.SYS_SPARQL_HOST</emphasis> table in search of a row containing a matching host name in <emphasis>SH_HOST</emphasis>.
-The <emphasis>SH_HOST</emphasis> field acts as 'pattern' argument for the SQL string operator LIKE. If a matching row is found, the text of SPARQL request is extended.
-If a default graph is not explicitly set by the HTTP parameters and <emphasis>SH_GRAPH_URI</emphasis> is not null then the default graph is set to <emphasis>SH_GRAPH_URI</emphasis>.
-If <emphasis>SH_DEFINES</emphasis> is not null then it is added in front of the query; so this field is a good place for the text for any <emphasis>define</emphasis> options.
-</para>
-<para>
-The search of <emphasis>DB.DBA.SYS_SPARQL_HOST</emphasis> stops at the first found row, other possible matches are silently ignored.
-</para>
-</sect2>
-
-<sect2 id="rdfsqlfromsparql"><title>Calling SQL from SPARQL </title>
-<para>A SPARQL expression can contain calls to Virtuoso/PL functions and built-in SQL functions in both the WHERE clause and in the
-result set. Two namespace prefixes, <emphasis>bif</emphasis> and <emphasis>sql</emphasis> are reserved for
-these purposes. When a function name starts with the <emphasis>bif:</emphasis> namespace
-prefix, the rest of the name is treated as the name of a SQL BIF (Built-In
-Function). When a function name starts with the <emphasis>sql:</emphasis> namespace prefix,
-the rest of the name is treated as the name of a Virtuoso/PL function owned by
-DBA with database qualifier DB, e.g. <emphasis>sql:example(...)</emphasis> is
-converted into <emphasis>DB.DBA."example"(...)</emphasis>.</para>
-
-<para>In both cases,
-the function receives arguments in SQL format ('SQL valmode') and
-also returns the result in SQL format. The SPARQL compiler will
-automatically add code for format conversion into the resulting SQL
-code so SQL functions can be used even if <emphasis>define output:valmode
-'LONG'</emphasis> forces the use of RDF representation in the
-result set.</para>
-<sect3 id="rdfsqlfromsparqlex1"><title>Example with sql: namespace prefix</title>
 <programlisting><![CDATA[
-SQL>create procedure DB.DBA.ComposeInfo (
-  in pname varchar,
-  in pnick varchar := '',
-  in pbox  varchar := '')
-{
-   declare ss varchar;
-   ss := concat(pname, ' ', pnick, ' ', pbox);
-   ss := rtrim (ss, ' ');
-   return ss;
-
-};
-Done. -- 0 msec.
-
 SQL>SPARQL
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-SELECT (sql:ComposeInfo (?name, ?nick, ?box))
-FROM <http://www.w3.org/People/Berners-Lee/card>
+SELECT DISTINCT ?p ?o
 WHERE
   {
-    ?s rdf:type foaf:Person .
-    optional{?s foaf:name ?name }.
-    optional{?s foaf:nick ?nick }.
-    optional{?s foaf:box ?box }.
-    filter (?nick like '%TimBL%') .
-  };
-callret-0
-VARCHAR
+    ?s ?p ?o .
+    FILTER ( ?s IN (<http://dbpedia.org/resource/Climate_change>, <http://dbpedia.org/resource/Social_vulnerability> ) )
+  }
+LIMIT 100
+
+p    	                                                o
+ANY                                                     ANY
 _______________________________________________________________________________
 
-Timothy Berners-Lee TimBL
+http://www.w3.org/1999/02/22-rdf-syntax-ns#type 	http://s.zemanta.com/ns#Target
+http://s.zemanta.com/ns#title 	                        Climate change
+http://s.zemanta.com/ns#targetType 	                http://s.zemanta.com/targets#rdf
 
-1 Rows. -- 30 msec.
+3 Rows. -- 10 msec.
 ]]></programlisting>
     <tip><title>See Also:</title>
-      <itemizedlist mark="bullet">
-        <listitem><link linkend="rdfsparqlgeospatexmp11">Example "Things around highly populated places"</link></listitem>
-        <listitem><link linkend="virtuosospongerfacent">Virtuoso Facets Web Service Examples</link></listitem>
-        <listitem><link linkend="VirtFacetUsage6">Virtuoso Facets Usage Statistics Examples</link></listitem>
-      </itemizedlist>
+    <para><link linkend="rdfsparulexamples6">Example usage of IN operator.</link></para>
     </tip>
-  </sect3>
-  <sect3 id="rdfsqlfromsparqlex1"><title>Example with sql: namespace prefix and bif:contains</title>
+</sect4>
+<sect4 id="rdfsparulexamples19"><title>Example for extending SPARQL via SQL for Full Text search: Variant I</title>
+<para>To find all albums looked up by album name, one might use the following syntax:</para>
 <programlisting><![CDATA[
 SQL>SPARQL
-SELECT DISTINCT ?cityUri ?cityName (sql:BEST_LANGMATCH (?cityName, 'en, en-gb;q=0.8, fr;q=0.7, *;q=0.1', '')) as ?bestCityName
+SELECT ?s ?o ?an ( bif:search_excerpt ( bif:vector ( 'In', 'Your' ) , ?o ) ) 
 WHERE
   {
-    ?cityUri ?predicate ?value.
-    ?cityUri a <http://dbpedia.org/ontology/City>.
-    ?value bif:contains "London".
-    OPTIONAL
-      {
-        ?cityUri rdfs:label ?cityName
+    ?s rdf:type mo:Record .
+    ?s foaf:maker ?a .
+    ?a foaf:name ?an .
+    ?s dc:title ?o .
+    FILTER ( bif:contains ( ?o, '"in your"' ) ) 
       }
-  };
+LIMIT 10;
 
-cityUri                                              cityName                      bestCityName
-ANY                                                  ANY 	                         ANY
-______________________________________________________________________________________________________________
-http://dbpedia.org/resource/Anerley	                 Anerley	                     Anerley
-http://dbpedia.org/resource/Felixstowe	             Felixstowe	                   Felixstowe
-http://dbpedia.org/resource/Chesham	                 Chesham	                     Chesham
-http://dbpedia.org/resource/Stratford%2C_London	     Stratford, London	           Stratford, London
-http://dbpedia.org/resource/Ashford%2C_Surrey	       Ashford (Surrey)	 A           shford (Surrey)
-http://dbpedia.org/resource/Newmarket%2C_Suffolk	   Newmarket (Suffolk)	         Newmarket (Suffolk)
-http://dbpedia.org/resource/North_Rhine-Westphalia	 Renania d'o Norte-Westfalia	 Renania d'o Norte-Westfalia
-http://dbpedia.org/resource/West_Bromwich	           West Bromwich	               West Bromwich
-....
 
+http://musicbrainz.org/music/record/30f13688-b9ca-4fa5-9430-f918e2df6fc4  China in Your Hand  	          Fusion  China             <b>in</b> <b>Your</b> Hand.
+http://musicbrainz.org/music/record/421ad738-2582-4512-b41e-0bc541433fbc 	China in Your Hand 	            T'Pau 	China             <b>in</b> <b>Your</b> Hand.
+http://musicbrainz.org/music/record/01acff2a-8316-4d4b-af93-97289e164379 	China in Your Hand 	            T'Pau 	China             <b>in</b> <b>Your</b> Hand.
+http://musicbrainz.org/music/record/4fe99b06-ac73-40dd-8be7-bdaefb014981 	China in Your Hand 	            T'Pau 	China             <b>in</b> <b>Your</b> Hand.
+http://musicbrainz.org/music/record/ac1cb011-6040-4515-baf2-59551a9884ac 	In Your Hands 	                Stella One Eleven 	      <b>In</b> <b>Your</b> Hands.
+http://dbtune.org/magnatune/album/mercy-inbedinst 	                      In Your Bed - instrumental mix 	Mercy Machine 	          <b>In</b> <b>Your</b> Bed mix.
+http://musicbrainz.org/music/record/a09ae12e-3694-4f68-bf25-f6ff4f790962 	A Word in Your Ear 	Alfie 	    A Word <b>in</b>          <b>Your</b> Ear.
+http://dbtune.org/magnatune/album/mercy-inbedremix 	                      In Your Bed - the remixes 	    Mercy Machine 	          <b>In</b> <b>Your</b> Bed the remixes.
+http://musicbrainz.org/music/record/176b6626-2a25-42a7-8f1d-df98bec092b4 	Smoke Gets in Your Eyes 	      The Platters 	Smoke Gets  <b>in</b> <b>Your</b> Eyes.
+http://musicbrainz.org/music/record/e617d90e-4f86-425c-ab97-efdf4a8a452b 	Smoke Gets in Your Eyes 	      The Platters 	Smoke Gets  <b>in</b> <b>Your</b> Eyes.
 ]]></programlisting>
-  </sect3>
-  <sect3 id="rdfsqlfromsparqlex2"><title>Example with bif: namespace prefix</title>
+<para>Note that the query will not show anything when there are triples like:</para>
 <programlisting><![CDATA[
-SQL>SPARQL
-SELECT *
-FROM <http://www.w3.org/people#>
-WHERE { ?s ?p ?o . ?o bif:contains '"Timo*"'};
-s                                               p                                     o
-VARCHAR                                         VARCHAR                               VARCHAR
-_______________________________________________________________________________
+<x> <y> "In" 
+<z> <q> "Your"		
+]]></programlisting>
 
- http://www.w3.org/People/Berners-Lee/card#i	http://xmlns.com/foaf/0.1/name	      Timothy Berners-Lee
- http://www.w3.org/People/Berners-Lee/card#i	http://xmlns.com/foaf/0.1/givenname   Timothy
+</sect4>
+<sect4 id="rdfsparulexamples20"><title>Example for extending SPARQL via SQL for Full Text search: Variant II</title>
+<para>To get movies from DBpedia, where the query can contain terms from the title, 
+one might use the following syntax:</para>
+<programlisting><![CDATA[
+SQL>SPARQL
+ SELECT ?s ?an ?dn ?o( bif:search_excerpt ( bif:vector ( 'Broken', 'Flowers' ) , ?o ) ) 
+ WHERE
+  {
+    ?s rdf:type dbpedia-owl:Film .
+    ?s dbpprop:name ?o .
+    FILTER ( bif:contains ( ?o, '"broken flowers"' ) )
+    OPTIONAL { ?s dbpprop:starring ?starring .}
+    OPTIONAL { ?s dbpprop:director ?director . }
+    OPTIONAL { ?starring dbpprop:name ?an . }
+    OPTIONAL { ?director dbpprop:name ?dn . }
+  };
 
-2 Rows. -- 2 msec.
 
+http://dbpedia.org/resource/Broken_Flowers  Tilda Swinton  	Jim Jarmusch  	Broken Flowers  	          <b>Broken</b> <b>Flowers</b>.
+http://dbpedia.org/resource/Broken_Flowers 	Swinton, Tilda 	Jim Jarmusch 	  Broken Flowers 	            <b>Broken</b> <b>Flowers</b>.
+....
+http://dbpedia.org/resource/Broken_Flowers  Bill Murray  	  Jim Jarmusch  	Music from Broken Flowers  	Music from <b>Broken</b> <b>Flowers</b>.
+....
 ]]></programlisting>
-    <tip><title>See Also:</title>
-      <itemizedlist mark="bullet">
-        <listitem><link linkend="rdfpredicatessparqlexamples">Example filtering RDF objects triples by a given predicate</link></listitem>
-        <listitem><link linkend="rdfsparqlendpointexamples6">Example with extraction part of literal as variable</link></listitem>
-        <listitem><link linkend="rdfsparulexamples5">Example for various expressions usage</link></listitem>
-        <listitem><link linkend="rdfsparulexamples8">Example for generating RDF information resource URI</link></listitem>
-      </itemizedlist>
-    </tip>
-  </sect3>
-</sect2>
-<sect2 id="rdfsqlfromsparqldescribe"><title>SPARQL DESCRIBE</title>
-  <para>The SPARQL specification does not define the precise output of DESCRIBE, so different
-applications may need different results for the same subject. Some
-applications need quick generation of short and incomplete results
-whereas others may need detailed reports composed from multiple sources.
-  </para>
-  <para>If define <emphasis>sql:describe-mode "xxx"</emphasis> is specified then the generated SQL
-code will use the procedures named:
-  </para>
-<programlisting><![CDATA[
-DB.DBA.SPARQL_DESC_DICT_xxx (in subj_dict any, in consts any, in graphs
-any, in storage_name any, in options any)
-]]></programlisting>
-  <para>and
-  </para>
+<para>Note that the query will not show anything when there are triples like:</para>
 <programlisting><![CDATA[
-DB.DBA.SPARQL_DESC_DICT_xxx_PHYSICAL (in subj_dict any, in consts any,
-in graphs any, in storage_name any, in options any)
+<x> <y> "Broken" 
+<z> <q> "Flowers"		
 ]]></programlisting>
-  <para>In a new blank database, only two such pairs of procedures are created.
-Procedures <emphasis>DB.DBA.SPARQL_DESC_DICT_SPO</emphasis> and <emphasis>DB.DBA.SPARQL_DESC_DICT_SPO_PHYSICAL</emphasis>
-are for <emphasis>sql:describe-mode "SPO"</emphasis>. This pair of procedures
-searches for all triples where the input IRIs are used as subjects; they are faster than the default
-routine which searches for all triples where the input IRIs are used as subjects or objects.
-Similarly, <emphasis>DB.DBA.SPARQL_DESC_DICT_CBD</emphasis> and <emphasis>DB.DBA.SPARQL_DESC_DICT_CBD_PHYSICAL</emphasis>
-are for <emphasis>sql:describe-mode "CBD"</emphasis>. CBD stands for Concise Bounded Description, Nokia-style.
+</sect4>
+<sect4 id="rdfsparulexamples21"><title>Example for date manipulation of xsd types within SPARQL</title>
+<para>This example shows usage of dateTime column truncation to date only
+and performs a group by on this column:
   </para>
-  <para><emphasis>Example:</emphasis></para>
 <programlisting><![CDATA[
+-- prepare the data by inserting triples in a graph:
 SQL>SPARQL
-DEFINE sql:describe-mode "CBD"
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-DESCRIBE ?friend
-WHERE
+INSERT INTO GRAPH <http://BookStore.com>
   {
-    ?s foaf:knows ?friend  .
-    ?friend foaf:nick ?nick.
-    filter (?s=<http://www.advogato.org/person/rmorgan/foaf.rdf#me>)
-}
-;
+    <http://www.dajobe.org/foaf.rdf#i> <http://purl.org/dc/elements/1.1/title>  "SPARQL and RDF" .
+    <http://www.dajobe.org/foaf.rdf#i> <http://purl.org/dc/elements/1.1/date> <1999-01-01T00:00:00>.
+    <http://www.w3.org/People/Berners-Lee/card#i> <http://purl.org/dc/elements/1.1/title> "Design notes" .
+    <http://www.w3.org/People/Berners-Lee/card#i> <http://purl.org/dc/elements/1.1/date> <2001-01-01T00:00:00>.
+    <http://www.w3.org/People/Connolly/#me> <http://purl.org/dc/elements/1.1/title> "Fundamentals of Compiler Design" .
+    <http://www.w3.org/People/Connolly/#me> <http://purl.org/dc/elements/1.1/date> <2002-01-01T00:00:00>.
+    <http://www.ivan-herman.net/foaf.rdf#me> <http://purl.org/dc/elements/1.1/title>  "RDF Store" .
+    <http://www.ivan-herman.net/foaf.rdf#me> <http://purl.org/dc/elements/1.1/date> <2001-03-05T00:00:00>.
+    <http://bblfish.net/people/henry/card#me> <http://purl.org/dc/elements/1.1/title> "Design RDF notes" .
+    <http://bblfish.net/people/henry/card#me> <http://purl.org/dc/elements/1.1/date> <2001-01-01T00:00:00>.
+    <http://hometown.aol.com/chbussler/foaf/chbussler.foaf#me> <http://purl.org/dc/elements/1.1/title> "RDF Fundamentals" .
+    <http://hometown.aol.com/chbussler/foaf/chbussler.foaf#me> <http://purl.org/dc/elements/1.1/date> <2002-01-01T00:00:00>. 
+  };
 
- at prefix rdf:	<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- at prefix ns1:	<http://www.advogato.org/person/chrisd/foaf.rdf#> .
- at prefix foaf:	<http://xmlns.com/foaf/0.1/> .
-ns1:me	rdf:type	foaf:Person .
- at prefix rdfs:	<http://www.w3.org/2000/01/rdf-schema#> .
-ns1:me	rdfs:seeAlso	<http://www.advogato.org/person/chrisd/foaf.rdf> ;
-	foaf:name	"Chris DiBona" ;
-	foaf:nick	"chrisd" ;
-	foaf:homepage	<http://www.dibona.com> ;
-	foaf:mbox_sha1sum	"e8231d19ac0d11ccbdc565485054461e5d71f0d3" .
- at prefix ns4:	<http://www.advogato.org/person/schoen/foaf.rdf#> .
-ns1:me	foaf:knows	ns4:me .
- at prefix ns5:	<http://www.advogato.org/person/jpick/foaf.rdf#> .
-ns1:me	foaf:knows	ns5:me .
- at prefix ns6:	<http://www.advogato.org/person/benson/foaf.rdf#> .
-ns1:me	foaf:knows	ns6:me .
- at prefix ns7:	<http://www.advogato.org/person/conrad/foaf.rdf#> .
-ns1:me	foaf:knows	ns7:me .
- at prefix ns8:	<http://www.advogato.org/person/starshine/foaf.rdf#> .
-ns1:me	foaf:knows	ns8:me .
- at prefix ns9:	<http://www.advogato.org/person/chip/foaf.rdf#> .
-ns1:me	foaf:knows	ns9:me .
- at prefix ns10:	<http://www.advogato.org/person/crackmonkey/foaf.rdf#> .
-.....
+_______________________________________________________
 
+Insert into <http://BookStore.com>, 12 triples -- done
 
+-- Find Count of Group by Dates
+SQL>SPARQL 
+SELECT (xsd:date(bif:subseq(str(?a_dt), 0, 10))), count(*)
+FROM <http://BookStore.com> 
+WHERE 
+  { 
+    ?s <http://purl.org/dc/elements/1.1/date> ?a_dt 
+  }
+GROUP BY (xsd:date(bif:subseq(str(?a_dt), 0, 10)));
 
+callret-0                                         callret-1
+VARCHAR                                           VARCHAR
+__________________________________________________
+1999-01-01                                        1
+2001-01-01                                        2
+2002-01-01                                        2
+2001-03-05                                        1
 
+4 Rows. -- 15 msec.
+SQL>	
 ]]></programlisting>
-  <para>In each pair, both procedures have the same semantics but the second one is used if and
-only if the SPARQL compiler can prove that all subjects to process are
-from physical storage <emphasis>(DB.DBA.RDF_QUAD)</emphasis>. Thus the second procedure 
-will not search for subjects in RDF Views.
+     </sect4>
+   </sect3>
+   </sect2>
+<sect2 id="sparqlbi"><title>Business Intelligence Extensions for SPARQL</title>
+<para>
+Virtuoso extends SPARQL with expressions in results, subqueries, aggregates and grouping.
+These extensions allow a straightforward translation of arbitrary SQL queries to SPARQL.
+This extension is called  "SPARQL BI", because the primary objective is to match needs of Business Intelligence.
+The extended features apply equally to querying physical quads or relational tables mapped through RDF views.
   </para>
-  <para>Each procedure should return a dictionary with triples as keys and
-integer 1 as values. So the dictionary is filled by calls like:
+<note><para>In this section, many examples use the TPC-H namespace. You may test them on your local demo database.
+They use data from the TPC-H dataset that is mapped into a graph with an IRI of the form
+http://example.com/tpch. When testing, you should replace the fake host name "example.com" with the host name of your own installation
+verbatim, that is as specified in the "DefaultHost" parameter in the [URIQA] section of the Virtuoso configuration file.</para></note>
+<sect3 id="rdfsparqlaggregate"><title>Aggregates in SPARQL</title>
+<para>Virtuoso extends SPARQL with SQL like aggregate and "group by" functionality. This functionality is
+also available by embedding SPARQL text inside SQL, but the SPARQL extension syntax has the benefit
+of also working over the SPARQL protocol and of looking more SPARQL-like.
+</para>
+<para>The supported aggregates are <emphasis>COUNT</emphasis>, <emphasis>MIN</emphasis>,
+<emphasis>MAX</emphasis>, <emphasis>AVG</emphasis> and <emphasis>SUM</emphasis>. These can take an
+optional <emphasis>DISTINCT</emphasis> keyword. These are permitted only in the selection part of a
+select query. If a selection list consists of a mix of variables and aggregates, the non-aggregate
+selected items are considered to be grouping columns and a <emphasis>GROUP BY</emphasis> over them is implicitly added
+at the end of the generated SQL query. Virtuoso also supports explicit syntax for
+<emphasis>GROUP BY</emphasis>, <emphasis>ORDER BY</emphasis>, <emphasis>LIMIT</emphasis> and <emphasis>OFFSET</emphasis>.
+There is no explicit syntax for <emphasis>HAVING</emphasis> in Virtuoso SPARQL.
+</para>
+<para>If a selection consists of aggregates exclusively, the result set has one row with the values
+of the aggregates. If there are aggregates and variables in the selection, the result set has as many
+rows as there are distinct combinations of the variables; the aggregates are then calculated over each
+such distinct combination, as if there were a SQL GROUP BY over all non-aggregates.
+The implicit grouping pays attention to all subexpressions in the return list; say, if a result column expression is <code>(?x * max (?y))</code> then
+<code>?y</code> is aggregated and <code>?x</code> is not so it is grouped by ?x.
+This also means that if a result column expression is <code>(bif:year (?shipdate))</code> then a group is made for each distinct <code>?shipdate</code>,
+i.e. up to 366 groups for each distinct year.
+If you need one group per year, write explicit <code>GROUP BY (bif:year (?shipdate))</code>.
+
+</para>
+<para>With the count aggregate the argument may be either <emphasis>*</emphasis>, meaning counting all rows, or a variable
+name, meaning counting all the rows where this variable is bound. If there is no implicit <emphasis>GROUP BY</emphasis>,
+there can be an optional <emphasis>DISTINCT</emphasis> keyword before the variable that is the argument of an aggregate.
   </para>
+<para>There is a special syntax for counting distinct combinations of selected variables. This is:</para>
 <programlisting><![CDATA[
-dict_put (resulting_dict,
-          vector (subj_iri_id, pred_iri_id, obj_iri_id_or_rdf_box),
-          1);
+SELECT COUNT DISTINCT ?v1 ... ?vn
+  FROM ....
 ]]></programlisting>
-  <para>Procedure arguments are as follows:
-  </para>
+<para>User-defined aggregate functions are not supported in current version of the SPARQL compiler.</para>
+<sect4 id="rdfsparqlaggregatepathexpressions"><title>Path Expressions</title>
+<para>Virtuoso has support for paths consisting of dereferencing properties in SPARQL. Virtuoso allows
+simple paths in expressions and has a separate feature for transitivity:</para>
+
   <itemizedlist mark="bullet">
-     <listitem><emphasis>subj_dict</emphasis> - a dictionary whose keys are IRI IDs and maybe values of
-other types, esp. RDF boxes. Keys are subjects to be described, so
-values other than IRI IDs should usually be ignored. Values should be
-ignored.</listitem>
-     <listitem><emphasis>consts</emphasis> - a vector of IRI IDs and values of other types. The items contained in the vector
-are subjects to be described, as with the keys of subj_dict.</listitem>
-     <listitem><emphasis>graphs</emphasis> - a vector of IRI IDs of graphs that can be used for DESCRIBE. The
-vector may contain garbage, like in the two previous cases. A NULL can be
-passed instead of a vector indicating that the source graphs are not specified
-in the source query.</listitem>
-     <listitem><emphasis>storage_name</emphasis> -  the value of "define input:storage" from the original
-SPARQL query, NULL if missing.</listitem>
-     <listitem><emphasis>options</emphasis> - reserved for future use and can be ignored.</listitem>
+  <listitem>S+>P: for "one or many values of P of S"</listitem>
+  <listitem>S*>P: for "zero or many values of P of S", so *> may form a LEFT OUTER JOIN whereas +> forms an INNER JOIN.</listitem>
+  <listitem>S|>P: is reserved for potential "single value of P of S or an error if there are many values"</listitem>
    </itemizedlist>
-  <para>One should grant execute permission on both procedures to SPARQL_SELECT before referring to them in SPARQL.</para>
-  <para><emphasis>Example:</emphasis></para>
-<programlisting><![CDATA[
-SQL>set blobs on;
-SQL>SPARQL
-define sql:describe-mode "SPO"
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX sioct: <http://rdfs.org/sioc/types#>
-
-DESCRIBE ?forum
-FROM <http://demo.openlinksw.com/dataspace>
-WHERE {
-  ?forum rdf:type sioct:Weblog .
-}
-LIMIT 1;
-
-callret-0
-LONG VARCHAR
-_______________________________________________________________________________
-
-<http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/types#Weblog> ,
-                <http://atomowl.org/ontologies/atomrdf#Feed> ;
-        <http://rdfs.org/sioc/ns#description> "XML templates demo's Weblog" ;
-        <http://rdfs.org/sioc/ns#has_space> <http://demo.openlinksw.com/dataspace/bloguser/space#this> ;
-        <http://rdfs.org/sioc/ns#container_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/20> ,
-                <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/21> ;
-        <http://rdfs.org/sioc/ns#id> "bloguser_blog" ;
-        <http://xmlns.com/foaf/0.1/maker> <http://demo.openlinksw.com/dataspace/person/bloguser#this> ;
-        <http://rdfs.org/sioc/ns#link> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> ;
-        <http://atomowl.org/ontologies/atomrdf#entry> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/20> ,
-                <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/21> ;
-        <http://atomowl.org/ontologies/atomrdf#contains> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/21> ,
-                <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/20> ;
-        <http://atomowl.org/ontologies/atomrdf#title> "bloguser_blog" ;
-        <http://www.w3.org/2000/01/rdf-schema#label> "XML templates demo's Weblog" ;
-        <http://rdfs.org/sioc/ns#scope_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog#owner> ;
-        <http://rdfs.org/sioc/ns#has_owner> <http://demo.openlinksw.com/dataspace/bloguser#this> ;
-        <http://www.w3.org/2000/01/rdf-schema#isDefinedBy> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/sioc.rdf> ;
-        <http://purl.org/dc/elements/1.1/identifier> "62"^^<http://www.w3.org/2001/XMLSchema#integer> ;
-        <http://rdfs.org/sioc/services#has_service> <http://demo.openlinksw.com/RPC2> ,
-                <http://demo.openlinksw.com/mt-tb> ,
-                <http://demo.openlinksw.com/Atom/bloguser-blog-0> ,
-                <http://demo.openlinksw.com/GData/bloguser-blog-0> .
-<http://demo.openlinksw.com/RPC2> <http://rdfs.org/sioc/services#service_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
-<http://demo.openlinksw.com/mt-tb> <http://rdfs.org/sioc/services#service_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
-<http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog#owner> <http://rdfs.org/sioc/ns#has_scope> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
-<http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/20> <http://rdfs.org/sioc/ns#has_container> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> ;
-        <http://atomowl.org/ontologies/atomrdf#source> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
-<http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog/21> <http://rdfs.org/sioc/ns#has_container> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> ;
-        <http://atomowl.org/ontologies/atomrdf#source> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
-<http://demo.openlinksw.com/dataspace/bloguser#this> <http://rdfs.org/sioc/ns#owner_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
-<http://demo.openlinksw.com/dataspace/bloguser/space#this> <http://rdfs.org/sioc/ns#space_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
-<http://demo.openlinksw.com/dataspace/person/bloguser#this> <http://xmlns.com/foaf/0.1/made> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
-<http://demo.openlinksw.com/Atom/bloguser-blog-0> <http://rdfs.org/sioc/services#service_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
-<http://demo.openlinksw.com/GData/bloguser-blog-0> <http://rdfs.org/sioc/services#service_of> <http://demo.openlinksw.com/dataspace/bloguser/weblog/bloguser_blog> .
-
-
-1 Rows. -- 240 msec.
+<para>If this property is set (for example by an RDF View) then +> should be used.</para>
 
-]]></programlisting>
-</sect2>
-<sect2 id="rdfsparqlimplementatiotrans"><title>Transitivity in SPARQL</title>
-  <para>Virtuoso SPARQL allows access to Virtuoso's SQL transitivity extension. Read the
-<link linkend="transitivityinsQL">SQL section</link> for a definition of the options.</para>
-  <para>The SPARQL syntax is slightly different from the SQL, although the option names
-and meanings are the same.</para>
-  <para>In SPARQL, the transitive options occur after a subquery enclosed in braces:</para>
-  <para>The below produces all the IRI's that are the same as <alice>.</para>
+<para><emphasis>Simple Example</emphasis></para>
   <programlisting><![CDATA[
-SPARQL
-SELECT ?syn
-where
-  {
-    {
-      SELECT ?x ?syn
-      where
-        {
-          { ?x owl:sameAs ?syn } union { ?syn owl:sameAs ?x }
-        }
-    }
-    option ( transitive, t_in (?x), t_out (?syn), t_distinct, t_min (0) )
-    filter (?x = <Alice>) .
-  }
+SELECT ?f+>foaf:name ?f|>foaf:mbox WHERE { ?x foaf:name "Alice" . ?x foaf:knows ?f . FILTER (?f+>foaf:name = "John") }
   ]]></programlisting>
-  <para>In this case, we provide a binding for ?x in the filter outside of the
-  transitive subquery. The subquery therefore is made to run from in to
-  out. The same effect would be accomplished if we bound ?syn and
-  SELECT ?x, the designations of in and out are arbitrary and for
-  transitive steps that can be evaluated equally well in both directions
-  this makes no difference.
-  </para>
-  <para>The transitive subquery in the above is </para>
+<para>means:</para>
   <programlisting><![CDATA[
-{SELECT ?syn
+SELECT ?fname ?mbox
  WHERE
   {
-    { SELECT ?x ?syn
-      WHERE
-       {{ ?x owl:sameAs ?syn } UNION { ?syn owl:sameAs ?x}}
-    } OPTION (TRANSITIVE, t_in (?x), t_out (?syn), t_distinct, t_min (0) )
+    ?x foaf:knows ?f .
+    ?x foaf:knows ?f .
+    OPTIONAL {?f foaf:mbox ?mbox} .
+    ?f foaf:name ?fname .
+    ?x foaf:name "Alice" .
+    ?x foaf:knows ?f2 .
+    ?f2 foaf:name "John" .
   }
-} .
-  ]]></programlisting>
-  <para>Leaving out the option would just look for one step of owl:sameAs.
-  Making it transitive will apply the subquery to all bindings it
-  produces until all are visited at least once (the t_distinct modifier).
-  </para>
-  <para>If the transitive step consists of a single triple pattern, there is a shorthand:</para>
-  <programlisting><![CDATA[
-  <alice> foaf:knows ?friend option (transitive t_min (1))
   ]]></programlisting>
-  <para>will bind ?friend to all directly and indirectly found foaf:known
-  individuals. If t_min had been 0, Malice> would have also been in the
-  generated bindings.</para>
-  <para>The syntax is</para>
+<para><emphasis>Other Examples</emphasis></para>
   <programlisting><![CDATA[
-  option (transitive transitivity_option[,...])
-
-  transitivity_option ::=  t_in (<variable_list>)
-  | t_out (<variable_list>)
-  | t_distinct
-  | t_shortest_only
-  | t_no_cycles
-  | t_cycles_only
-  | t_min (INTNUM)
-  | t_max (INTNUM)
-  | t_end_flag (<variable>)
-  | t_step (<variiable_or_step>)
-  | t_direction INTNUM
-
-  variable_list ::= <variable> [,...]
+SPARQL
+DEFINE sql:signal-void-variables 1
+PREFIX tpcd: <http://www.openlinksw.com/schemas/tpcd#>
+PREFIX oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+PREFIX sioc: <http://rdfs.org/sioc/ns#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+SELECT
+  ?l+>tpcd:returnflag,
+  ?l+>tpcd:linestatus,
+  sum(?l+>tpcd:linequantity) as ?sum_qty,
+  sum(?l+>tpcd:lineextendedprice) as ?sum_base_price,
+  sum(?l+>tpcd:lineextendedprice*(1 - ?l+>tpcd:linediscount)) as ?sum_disc_price,
+  sum(?l+>tpcd:lineextendedprice*(1 - ?l+>tpcd:linediscount)*(1+?l+>tpcd:linetax)) as ?sum_charge,
+  avg(?l+>tpcd:linequantity) as ?avg_qty,
+  avg(?l+>tpcd:lineextendedprice) as ?avg_price,
+  avg(?l+>tpcd:linediscount) as ?avg_disc,
+  count(1) as ?count_order
+FROM <http://example.com/tpcd>
+WHERE {
+    ?l a tpcd:lineitem .
+    FILTER (?l+>tpcd:shipdate <= bif:dateadd ("day", -90, '1998-12-01'^^xsd:date)) }
+ORDER BY ?l+>tpcd:returnflag ?l+>tpcd:linestatus
 
-  variable_or_step ::= <variable> | path_id' | 'step_no'
   ]]></programlisting>
-  <para>Unlike SQL, variable names are used instead of column numbers.
-  Otherwise all the options have the same meaning.</para>
-  <para>Some examples of the use of transitivity are:</para>
-  <sect3 id="rdfsparqlimplementatiotransexamples"><title>Collection of Transitivity Option Demo Queries for SPARQL</title>
-<sect4 id="rdfsparqlimplementatiotransexamples1"><title>Example for finding out what graphs contain owl:sameAs for "New York"</title>
-  <para>To find out what graphs contain owl:sameAs for Dan York, we do</para>
   <programlisting><![CDATA[
-  SELECT ?g ?x count (*) as ?count
-   WHERE {
-           {SELECT ?x ?alias ?g
+SPARQL
+DEFINE sql:signal-void-variables 1
+PREFIX tpcd: <http://www.openlinksw.com/schemas/tpcd#>
+SELECT
+  ?supp+>tpcd:acctbal,
+  ?supp+>tpcd:name,
+  ?supp+>tpcd:has_nation+>tpcd:name as ?nation_name,
+  ?part+>tpcd:partkey,
+  ?part+>tpcd:mfgr,
+  ?supp+>tpcd:address,
+  ?supp+>tpcd:phone,
+  ?supp+>tpcd:comment
+FROM <http://example.com/tpcd>
+   WHERE {
+  ?ps a tpcd:partsupp; tpcd:has_supplier ?supp; tpcd:has_part ?part .
+  ?supp+>tpcd:has_nation+>tpcd:has_region tpcd:name 'EUROPE' .
+  ?part tpcd:size 15 .
+  ?ps tpcd:supplycost ?minsc .
+  { SELECT ?part min(?ps+>tpcd:supplycost) as ?minsc
             WHERE {
-                    { GRAPH ?g {?x owl:sameAs ?alias }
-                  }
-            UNION
-           {GRAPH ?g {?alias owl:sameAs ?x}}}}
-   OPTION (TRANSITIVE, t_in (?x), t_out (?alias), t_distinct, t_min (1)) .
-   FILTER (?x = <http://dbpedia.org/resource/New_York> ) .
-         }
+        ?ps a tpcd:partsupp; tpcd:has_part ?part; tpcd:has_supplier ?ms .
+        ?ms+>tpcd:has_nation+>tpcd:has_region tpcd:name 'EUROPE' .
+      } }
+    FILTER (?part+>tpcd:type like '%BRASS') }
+ORDER BY
+  desc (?supp+>tpcd:acctbal)
+  ?supp+>tpcd:has_nation+>tpcd:name
+  ?supp+>tpcd:name
+  ?part+>tpcd:partkey
+
   ]]></programlisting>
-  <para>Here we select all paths that start with the initial URI and pass
-  through one or more sameAs statements. Each step produces a result of
-  the transitive subquery. The graph where the sameAs triple was found
-  is returned and used as the grouping column. In this way we see how
-  many times each graph is used. Note that graphs are counted many
-  times since the graphs containing immediate sameAs statements are
-  counted for paths of length 1, then again as steps on paths that reach
-  to their aliases and so on.</para>
 </sect4>
-<sect4 id="rdfsparqlimplementatiotransexamples2"><title>Example for query that takes all the people known by Tim Berners-Lee, to a depth between 1 and 4 applications of the subquery</title>
-  <para>This query takes all the people known by kidehen, to a depth between 1
-  and 4 applications of the subquery. It then sorts them by the
-  distance and the descending count of connections of each found connection. This is
-  equivalent to the default connections list shown by LinkedIn.</para>
+<sect4 id="rdfsparqlaggregateexamples"><title>Examples</title>
+<sect5 id="rdfsparqlaggregateexamples1"><title>Example for count of physical triples in http://mygraph.com</title>
+<programlisting><![CDATA[
+SPARQL
+SELECT COUNT (*)
+  FROM <http://mygraph.com>
+ WHERE {?s ?p ?o}
+]]></programlisting>
+<para><emphasis>Example for count of O's for each distinct P</emphasis></para>
+<programlisting><![CDATA[
+SPARQL define input:inference "http://mygraph.com"
+SELECT ?p COUNT (?o)
+  FROM <http://mygraph.com>
+ WHERE {?s ?p ?o}
+]]></programlisting>
+</sect5>
+<sect5 id="rdfsparqlaggregateexamples2"><title>Example for count of triples, including inferred triples and the count of
+distinct O values</title>
+<programlisting><![CDATA[
+SPARQL define input:inference "http://mygraph.com"
+SELECT COUNT (?p) COUNT (?o) COUNT (DISTINCT ?o)
+ FROM <http://mygraph.com>
+WHERE {?s ?p ?o}
+]]></programlisting>
+</sect5>
+<sect5 id="rdfsparqlaggregateexamples3"><title>Example for get number of distinct bindings of ?s ?p ?o</title>
+<programlisting><![CDATA[
+SPARQL define input:inference "http://mygraph.com"
+SELECT count distinct ?s ?p ?o
+  FROM <http://mygraph.com>
+ WHERE {?s ?p ?o}
+]]></programlisting>
+</sect5>
+<sect5 id="rdfsparqlaggregateexamples4"><title>Example for get counts and total prices of ordered items, grouped by item status</title>
   <programlisting><![CDATA[
   SPARQL
-  SELECT ?o ?dist ((SELECT COUNT (*) WHERE {?o foaf:knows ?xx}))
-  WHERE
-    {
-      {
-        SELECT ?s ?o
-        WHERE
-          {
-            ?s foaf:knows ?o
-          }
-      } OPTION (TRANSITIVE, t_distinct, t_in(?s), t_out(?o), t_min (1), t_max (4), t_step ('step_no') as ?dist) .
-      FILTER (?s= <http://www.w3.org/People/Berners-Lee/card#i>)
+prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
+SELECT ?status count(*) sum(?extendedprice)
+FROM <http://localhost.localdomain:8310/tpch>
+WHERE {
+    ?l a tpch:lineitem ;
+      tpch:lineextendedprice ?extendedprice ;
+      tpch:linestatus ?status .
     }
-  ORDER BY ?dist DESC 3
-  LIMIT 50
   ]]></programlisting>
-</sect4>
-<sect4 id="rdfsparqlimplementatiotransexamples4"><title>Example for finding how two people know each other and what graphs are involved in the connection</title>
-  <para>To find how two people know each other and what graphs are involved in the connection, we do:</para>
+</sect5>
+<sect5 id="rdfsparqlaggregateexamples5"><title>Example for get counts and total prices of ordered items, grouped by item status</title>
+   <para><emphasis>Example: A dataset of people, some duplicated</emphasis></para>
+   <para>Suppose there is a dataset with many people, some of them sharing the same name. To list them we would, ideally, execute the query:
+   </para>
   <programlisting><![CDATA[
   SPARQL
-  SELECT ?link ?g ?step ?path
-  WHERE
-    {
-      {
-        SELECT ?s ?o ?g
-        WHERE
-          {
-            graph ?g {?s foaf:knows ?o }
-          }
-      } OPTION (TRANSITIVE, t_distinct, t_in(?s), t_out(?o), t_no_cycles, T_shortest_only,
-      t_step (?s) as ?link, t_step ('path_id') as ?path, t_step ('step_no') as ?step, t_direction 3) .
-      FILTER (?s= <http://www.w3.org/People/Berners-Lee/card#i>
-      && ?o = <http://www.advogato.org/person/mparaz/foaf.rdf#me>)
+SELECT DISTINCT
+ (?name) ?person ?mail
+ WHERE {
+   ?person rdf:type foaf:Person .
+   ?person foaf:name ?name .
+   ?person foaf:mbox_sha1sum ?mail
     }
-    LIMIT 20
   ]]></programlisting>
-  <para>This query binds both the t_in and t_out variables. The ?g is left as
-  a free variable. Also, specifying ?s and the system defined constants
-  step_no and path_id as with t_step, we get for each transitive step a
-  row of results with the intermediate binding of ?s, the count of steps
-  from the initial ?s and a distinct identifier for the individual path,
-  since there can be many distinct paths that link the ?s and ?o
-  specified in the filter.</para>
-  <para>See the SQL transitive option section for details on the meaning of step_no and path_id.</para>
-</sect4>
-<sect4 id="rdfsparqlimplementatiotransexamples5"><title>Example for TBox Subsumption</title>
-<para>Subsumption Demo Using Transitivity Clause</para>
-<para>Yago Class Hierarchy (TBox) Subsumption</para>
-<para>AlphaReceptors</para>
+   <para>Unfortunately, the facility to apply DISTINCT to a part of the result set row (i.e. to ?name) does not currently exist.
+   (Although the above form is permitted, it's interpreted as being identical to 'SELECT DISTINCT ?name, ?person, ?mail WHERE ...')
+   If there's demand for such a feature then we may introduce an aggregate called, say, SPECIMEN, that will return the very first of the aggregated values. e.g.:
+   </para>
 <programlisting><![CDATA[
-SELECT ?y
-FROM <http://dbpedia.org/resource/classes/yago#>
-WHERE
-  {
-    {
-      SELECT *
+SPARQL
+SELECT ?name (specimen(?person)) (specimen(?mail))
       WHERE
         {
-          ?x rdfs:subClassOf ?y .
-        }
-    }
-    OPTION (TRANSITIVE, t_distinct, t_in (?x), t_out (?y) ) .
-    FILTER (?x = <http://dbpedia.org/class/yago/AlphaReceptor105609111>)
+    ?person rdf:type foaf:Person .
+    ?person foaf:name ?name .
+    ?person foaf:mbox_sha1sum ?mail
   }
 ]]></programlisting>
-</sect4>
-<sect4 id="rdfsparqlimplementatiotransexamples6"><title>Example for Receptors</title>
+   <para>As a workaround to this limitation, the MIN aggregate can be used, provided duplicates are few and there's no requirement
+   that ?person should correspond to ?mail
+(i.e. the result should contain some person node and some mail node but they don't have to be connected by foaf:mbox_sha1sum):
+   </para>
 <programlisting><![CDATA[
-SELECT ?x
-FROM <http://dbpedia.org/resource/classes/yago#>
-WHERE
-  {
-    {
-      SELECT *
+SPARQL
+SELECT ?name (min(?person)) (min(?mail))
       WHERE
         {
-          ?x rdfs:subClassOf ?y .
-        }
-    } OPTION (transitive, t_distinct, t_in (?x), t_out (?y) ) .
-  FILTER (?y = <http://dbpedia.org/class/yago/Receptor105608868>)
+    ?person rdf:type foaf:Person .
+    ?person foaf:name ?name .
+    ?person foaf:mbox_sha1sum ?mail
 }
 ]]></programlisting>
-</sect4>
-<sect4 id="rdfsparqlimplementatiotransexamples7"><title>Inference Rule example using transitive properties from SKOS vocabulary</title>
-<p>The following example demostrates the steps how to retrieve the skos ontology, add triples
-for skos:broaderTransitiveinto the graph, define inference rule, and at the and
-execute sparql query with inference rule and transitivity option. The queries were executed against
-the LOD instance (http://lod.openlinksw.com):</p>
-<orderedlist>
-  <listitem>Make the Context graph, assuming you don't want to load entire SKOS vocabulary into our Quad Store:
-<programlisting><![CDATA[
-SQL>SPARQL
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-INSERT INTO GRAPH <urn:rules.skos> { skos:broader rdfs:subPropertyOf skos:broaderTransitive .
-                                     skos:narrower rdfs:subPropertyOf skos:narrowerTransitive };
-]]></programlisting>
-</listitem>
-  <listitem>OR Load entire SKOS ontology into Quad Store via iSQL interface (commandline or HTML based Conductor):
-<programlisting><![CDATA[
-SQL>DB.DBA.RDF_LOAD_RDFXML (http_get ('http://www.w3.org/2009/08/skos-reference/skos-owl1-dl.rdf'), 'no', 'urn:rules.skos');
-Done.
-]]></programlisting>
-  </listitem>
-  <listitem>Make Context Rule:
+   <para>Otherwise, a complicated query is needed:</para>
 <programlisting><![CDATA[
-SQL>rdfs_rule_set ('skos-trans', 'urn:rules.skos');
-Done.
+SPARQL
+SELECT
+ ?name
+ ((SELECT (min (?person3))
+     WHERE {
+         ?person3 rdf:type foaf:Person .
+         ?person3 foaf:name ?name .
+         ?person3 foaf:mbox_sha1sum ?mail } )) as ?person
+ ?mail
+ WHERE {
+     { SELECT distinct ?name
+       WHERE {
+           ?person1 rdf:type foaf:Person .
+           ?person1 foaf:name ?name .
+           ?person1 foaf:mbox_sha1sum ?mail1 } }
+     { SELECT ?name (min(?mail2)) as ?mail
+       WHERE {
+           ?person2 rdf:type foaf:Person .
+           ?person2 foaf:name ?name .
+           ?person2 foaf:mbox_sha1sum ?mail2 } }
+ }
 ]]></programlisting>
-  </listitem>
-  <listitem>Go to SPARQL endpoint, for ex. http://lod.openlinksw.com/sparql</listitem>
-  <listitem>Use inference rule pragma to set context rule for SPARQL query, i.e:
+</sect5>
+<sect5 id="rdfsparqlaggregateexamples6"><title>Example quering dbpedia</title>
+<para>The following example demonstrate how to query dbpedia. Suppose there is local onotlogy,
+which has a datatype property hasLocation with a string containing city names. The query below finds
+which of those cities are in dbpedia:</para>
 <programlisting><![CDATA[
 SPARQL
-DEFINE input:inference "skos-trans"
-PREFIX p: <http://dbpedia.org/property/>
-PREFIX dbpedia: <http://dbpedia.org/resource/>
-PREFIX category: <http://dbpedia.org/resource/Category:>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX geo: <http://www.georss.org/georss/>
-
-SELECT DISTINCT ?m ?n ?p ?d
+PREFIX dbpprop: <http://dbpedia.org/property/>
+PREFIX dbo: <http://dbpedia.org/ontology/>
+PREFIX vocab:<http://myexample.com/localOntology.rdf>
+PREFIX dbpedia: <http://dbpedia.org/>
+PREFIX dbpres: <http://dbpedia.org/resource/>
+SELECT ?city
 WHERE
   {
-    ?m rdfs:label ?n.
-    ?m skos:subject ?c.
-    ?c skos:broaderTransitive category:Churches_in_Paris OPTION (TRANSITIVE) .
-    ?m p:abstract ?d.
-    ?m geo:point ?p
-    FILTER ( lang(?n) = "fr" )
-    FILTER ( lang(?d) = "fr" )
+    ?sub :location ?city .
+    FILTER(bif:exists(( ASK { ?subdb a dbo:City . ?subdb dbpprop:officialName ?city })))
   }
 ]]></programlisting>
-</listitem>
-  <listitem>You will get 22 rows returned from the query.
-Note that for comparison, if the option (transitive) is ommitted, then only 2 rows will be returned
-in our example query:
-     <figure id="rdftr" float="1">
-       <title>Transitive option</title>
-       <graphic fileref="ui/trs1.png"/>
-     </figure>
-</listitem>
-</orderedlist>
-</sect4>
-<sect4 id="rdfsparqlimplementatiotransexamples8"><title>Inference Rule example using
-transitive properties from SKOS vocabulary: Variant II</title>
-<p>This example shows how to find entities that are subcategories of Protestant Churches, no deeper
-than 3 levels within the concept scheme hierarchy, filtered by a specific subcategory. It demonstrates
-use of inference rules, sub-queries, and filter to obtain entities associated with category:
-Protestant_churches combined with the use of the transitivitve closure, sets to a maximum of 3 steps down a SKOS based concept scheme hierarchy:</p>
-<orderedlist>
-  <listitem>Make sure the inference rule "skos-trans" is created as described in the previous <link linkend="rdfsparqlimplementatiotransexamples7">example</link></listitem>
-  <listitem>Go to SPARQL endpoint, for ex. http://lod.openlinksw.com/sparql</listitem>
-  <listitem>Use inference rule pragma to set context rule for SPARQL query, i.e:
+</sect5>
+<sect5 id="rdfsparqlaggregateexamples7"><title>Example for MAX with HAVING and GROUP BY</title>
 <programlisting><![CDATA[
-DEFINE input:inference "skos-trans"
-PREFIX p: <http://dbpedia.org/property/>
-PREFIX dbpedia: <http://dbpedia.org/resource/>
-PREFIX category: <http://dbpedia.org/resource/Category:>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX geo: <http://www.georss.org/georss/>
+## Example "Find which town or city in
+## the UK has the largest proportion of students.
 
-SELECT DISTINCT ?c AS ?skos_broader
-       ?trans AS ?skos_narrower
-       ?dist AS ?skos_level
-       ?m ?n ?p AS ?geo_point
+PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
+PREFIX dbpedia-owl-uni: <http://dbpedia.org/ontology/University/>
+PREFIX dbpedia-owl-inst: <http://dbpedia.org/ontology/EducationalInstitution/>
+
+SELECT ?town COUNT(?uni)
+       ?pgrad ?ugrad
+       MAX(?population)
+       ( ((?pgrad+?ugrad)/ MAX(?population))*100 ) AS ?percentage
 WHERE
   {
+    ?uni dbpedia-owl-inst:country dbpedia:United_Kingdom ;
+                         dbpedia-owl-uni:postgrad ?pgrad ;
+                        dbpedia-owl-uni:undergrad ?ugrad ;
+                             dbpedia-owl-inst:city ?town .
+    OPTIONAL
     {
-      SELECT ?c  ?m ?n ?p ?trans ?dist
-      WHERE
-        {
-  	  ?m rdfs:label ?n.
-  	  ?m skos:subject ?c.
-  	  ?c skos:broaderTransitive category:Protestant_churches .
-  	  ?c skos:broaderTransitive ?trans
-            OPTION ( TRANSITIVE, t_distinct, t_in (?c), t_out (?trans),
-                     t_max (3),  t_step ( 'step_no' ) as ?dist ) .
-  	  ?m p:abstract ?d.
-  	  ?m geo:point ?p
-  	  FILTER ( lang(?n) = "en" )
-  	  FILTER ( lang(?d) = "en" )
-        }
+          ?town dbpedia-owl:populationTotal ?population .
+          FILTER (?population > 0 )
     }
-    FILTER ( ?trans = <http://dbpedia.org/resource/Category:Churches_in_London> )
   }
-ORDER BY ASC (?dist)
+GROUP BY ?town ?pgrad ?ugrad
+HAVING ( ( ( (?pgrad+?ugrad)/ MAX(?population) )*100 ) > 0 )
+ORDER BY DESC 6
 ]]></programlisting>
-</listitem>
-  <listitem>You will get 22 rows returned from the query.
-     <figure id="rdftr" float="1">
-       <title>Transitive option</title>
-       <graphic fileref="ui/trs2.png"/>
-     </figure>
-</listitem>
-</orderedlist>
+</sect5>
+<sect5 id="rdfsparqlaggregateexamples8"><title>Example Aggregating Distance Values Over Years</title>
+<para>The following example demonstrate how to aggregate Distance Values Over Years:</para>
+<para>First we insert some data in a graph with name for ex. <urn:dates:distances>:</para>
+<programlisting><![CDATA[
+SQL> SPARQL INSERT INTO GRAPH <urn:dates:distances>
+  {
+    <:a1> <http://purl.org/dc/elements/1.1/date> <2010-12-23T00:00:00> .
+    <:a1> <http://linkedgeodata.org/vocabulary#distance> <0.955218675> .    
+    <:a2> <http://purl.org/dc/elements/1.1/date> <2010-12-24T00:00:00> .
+    <:a2> <http://linkedgeodata.org/vocabulary#distance> <0.798155989> .
+    <:a3> <http://purl.org/dc/elements/1.1/date> <2010-12-25T00:00:00> .
+    <:a3> <http://linkedgeodata.org/vocabulary#distance> <0.064686628> .
+    <:a4> <http://purl.org/dc/elements/1.1/date> <2010-12-26T00:00:00> .
+    <:a4> <http://linkedgeodata.org/vocabulary#distance> <0.279800332> .
+    <:a5> <http://purl.org/dc/elements/1.1/date> <2010-12-27T00:00:00> .
+    <:a5> <http://linkedgeodata.org/vocabulary#distance> <0.651255995> .
+    <:a6> <http://purl.org/dc/elements/1.1/date> <2010-12-28T00:00:00> .
+    <:a6> <http://linkedgeodata.org/vocabulary#distance> <0.094410557> .
+    <:a7> <http://purl.org/dc/elements/1.1/date> <2010-12-29T00:00:00> .
+    <:a7> <http://linkedgeodata.org/vocabulary#distance> <0.43461913> .
+    <:a8> <http://purl.org/dc/elements/1.1/date> <2010-12-30T00:00:00> .
+    <:a8> <http://linkedgeodata.org/vocabulary#distance> <0.264862918> .
+    <:a9> <http://purl.org/dc/elements/1.1/date> <2010-12-31T00:00:00> .
+    <:a9> <http://linkedgeodata.org/vocabulary#distance> <0.770588658> .
+    <:a10> <http://purl.org/dc/elements/1.1/date> <2011-01-01T00:00:00> .
+    <:a10> <http://linkedgeodata.org/vocabulary#distance> <0.900997627> .
+    <:a11> <http://purl.org/dc/elements/1.1/date> <2011-01-02T00:00:00> .
+    <:a11> <http://linkedgeodata.org/vocabulary#distance> <0.324972375> .
+    <:a12> <http://purl.org/dc/elements/1.1/date> <2011-01-03T00:00:00> .
+    <:a12> <http://linkedgeodata.org/vocabulary#distance> <0.937221226> .
+    <:a13> <http://purl.org/dc/elements/1.1/date> <2011-01-04T00:00:00> .
+    <:a13> <http://linkedgeodata.org/vocabulary#distance> <0.269511925> .
+    <:a14> <http://purl.org/dc/elements/1.1/date> <2011-01-05T00:00:00> .
+    <:a14> <http://linkedgeodata.org/vocabulary#distance> <0.726014538> .
+    <:a15> <http://purl.org/dc/elements/1.1/date> <2011-01-06T00:00:00> .
+    <:a15> <http://linkedgeodata.org/vocabulary#distance> <0.843581439> .
+    <:a16> <http://purl.org/dc/elements/1.1/date> <2011-01-07T00:00:00> .
+    <:a16> <http://linkedgeodata.org/vocabulary#distance> <0.835685559> .
+    <:a17> <http://purl.org/dc/elements/1.1/date> <2011-01-08T00:00:00> .
+    <:a17> <http://linkedgeodata.org/vocabulary#distance> <0.673213742> .
+    <:a18> <http://purl.org/dc/elements/1.1/date> <2011-01-09T00:00:00> .
+    <:a18> <http://linkedgeodata.org/vocabulary#distance> <0.055026879> .
+    <:a19> <http://purl.org/dc/elements/1.1/date> <2011-01-10T00:00:00> .
+    <:a19> <http://linkedgeodata.org/vocabulary#distance> <0.987475424> .
+    <:a20> <http://purl.org/dc/elements/1.1/date> <2011-01-11T00:00:00> .
+    <:a20> <http://linkedgeodata.org/vocabulary#distance> <0.167315598> .
+    <:a21> <http://purl.org/dc/elements/1.1/date> <2011-01-12T00:00:00> .
+    <:a21> <http://linkedgeodata.org/vocabulary#distance> <0.545317103> .
+    <:a22> <http://purl.org/dc/elements/1.1/date> <2011-01-13T00:00:00> .
+    <:a22> <http://linkedgeodata.org/vocabulary#distance> <0.75137005> .
+    <:a23> <http://purl.org/dc/elements/1.1/date> <2011-01-14T00:00:00> .
+    <:a23> <http://linkedgeodata.org/vocabulary#distance> <0.123649985> .
+    <:a24> <http://purl.org/dc/elements/1.1/date> <2011-01-15T00:00:00> .
+    <:a24> <http://linkedgeodata.org/vocabulary#distance> <0.750214251> .
+  };	
+callret-0
+VARCHAR
+_______________________________________________________________________________
+
+Insert into <urn:dates:distances>, 48 (or less) triples -- done
+
+1 Rows. -- 94 msec.
+]]></programlisting>
+<para>Then we execute the following query:</para>
+<programlisting><![CDATA[
+SQL> SPARQL 
+PREFIX dst: <http://linkedgeodata.org/vocabulary#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+SELECT (bif:year( bif:stringdate(?sdate)) AS ?syear) (bif:sum( bif:number(?dist)) AS ?distance)
+FROM <urn:dates:distances>
+WHERE
+  {
+    ?row dc:date ?sdate .
+    ?row dst:distance ?dist
+  }
+GROUP BY (bif:year(bif:stringdate(?sdate)))
+ORDER BY ASC(bif:year(bif:stringdate(?sdate)));
+
+syear                                distance
+VARCHAR                              VARCHAR
+________________________________________________
+
+2010                                 4.313598882
+2011                                 8.891567721
+
+2 Rows. -- 31 msec.
+]]></programlisting>
+</sect5>	
+</sect4>
+<sect4 id="rdfsparqlaggregatenote"><title>Note on Aggregates and Inference</title>
+<para>Inferencing is added to a SPARQL query only for those variables whose value is actually used. Thus,
+</para>
+<programlisting><![CDATA[
+SELECT COUNT (*)
+ FROM <http://mygraph.com>
+WHERE {?s ?p ?o}
+]]></programlisting>
+<para>will not return inferred values since s, p, and o are not actually used. In contrast,
+</para>
+<programlisting><![CDATA[
+SPARQL
+SELECT COUNT (?s) COUNT (?p) COUNT (?o)
+ FROM <http://mygraph.com>
+WHERE {?s ?p ?o}
+]]></programlisting>
+<para>will also return all the inferred triples.
+</para>
+<para>
+Note: This difference in behaviour may lead to confusion and will, therefore, likely be altered in the future.
+</para>
 </sect4>
 </sect3>
+<sect3 id="rdfsparqlarrowop"><title>Pointer Operator (<emphasis>+></emphasis> and <emphasis>*></emphasis>)</title>
+<para>
+When expressions occur in result sets, many variables are often introduced only for the purpose of passing a value from a triple pattern to the result expression.
+This is inconvenient because many triple patterns are trivial. The presence of large numbers of variable names masks "interesting" variables that are used in more than once in pattern and which establish logical relationships between different parts of the query.
+As a solution we introduce pointer operators.</para>
+<para>
+The <emphasis>+></emphasis> (pointer) operator allows referring to a property value without naming it as a variable and explicitly writing a triple pattern. We can shorten the example above to:</para>
+<programlisting><![CDATA[SPARQL
+prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
+SELECT ?l+>tpch:linestatus count(*) sum(?l+>tpch:lineextendedprice)
+FROM <http://localhost.localdomain:8310/tpch>
+WHERE { ?l a tpch:lineitem }]]></programlisting>
+<para>
+The <emphasis>?subject+>propertyname</emphasis> notation is equivalent to having a triple pattern <emphasis>?subject propertyname ?aux_var</emphasis> binding an auxiliary variable to the mentioned property of the subject, within the group pattern enclosing the reference.
+For a SELECT, the enclosing group pattern is considered to be the top level pattern of the where clause or, in the event of a union, the top level of each term of the union.
+Each distinct pointer adds exactly one triple pattern to the enclosing group pattern. Multiple uses of <emphasis>+></emphasis> with the same arguments do not each add a triple pattern.
+(Having multiple copies of an identical pattern might lead to changes in cardinality if multiple input graphs were being considered.
+If a lineitem had multiple discounts or extended prices, then we would get the cartesian product of both.)
+</para>
+<para>
+If a property referenced via <emphasis>+></emphasis> is absent, the variable on the left side of the operator is not bound in the enclosing group pattern because it should be bound in all triple patterns where it appears as a field, including implicitly added patterns.
+</para>
+<para>
+The <emphasis>?subject*>propertyname</emphasis> notation is introduced in order to access optional property values. It adds an OPTIONAL group <emphasis>OPTIONAL { ?subject propertyname ?aux_var }</emphasis>, not a plain triple pattern, so the binding of ?subject is not changed even if the object variable is not bound. If the property is set for all subjects in question then the results of <emphasis>*></emphasis> and <emphasis>+></emphasis> are the same. All other things being equal, the <emphasis>+></emphasis> operator produces better SQL code than <emphasis>*></emphasis> so use <emphasis>*></emphasis> only when it is really needed.</para>
+</sect3>
+<sect3 id="rdfsparqlnesting"><title>Subqueries in SPARQL</title>
+<para>
+Pure SPARQL does not allow binding a value that is not retrieved through a triple pattern.
+We lift this restriction by allowing expressions in the result set and providing names for result columns.
+We also allow a SPARQL SELECT statement to appear in another SPARQL statement in any place where a group pattern may appear.
+The names of the result columns form the names of the variables bound, using values from the returned rows.
+This resembles derived tables in SQL.</para>
+<para>
+For instance, the following statement finds the prices of the 1000 order lines with the biggest discounts:</para>
+
+<programlisting><![CDATA[SPARQL
+define sql:signal-void-variables 1
+prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
+SELECT ?line ?discount (?extendedprice * (1 - ?discount)) as ?finalprice
+FROM <http://localhost.localdomain:8310/tpch>
+WHERE
+  {
+    ?line a tpch:lineitem ;
+    tpch:lineextendedprice ?extendedprice ;
+    tpch:linediscount ?discount .
+  }
+ORDER BY DESC (?extendedprice * ?discount)
+LIMIT 1000]]></programlisting>
+
+<para>
+After ensuring that this query works correctly, we can use it to answer more complex questions.
+Imagine that we want to find out how big the customers are who have received the biggest discounts.</para>
+
+<programlisting><![CDATA[SPARQL
+define sql:signal-void-variables 1
+prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
+SELECT ?cust sum(?extendedprice2 * (1 - ?discount2)) max (?bigdiscount)
+FROM <http://localhost.localdomain:8310/tpch>
+WHERE
+  {
+    {
+      SELECT ?line (?extendedprice * ?discount) as ?bigdiscount
+      WHERE {
+        ?line a tpch:lineitem ;
+          tpch:lineextendedprice ?extendedprice ;
+          tpch:linediscount ?discount . }
+      ORDER BY DESC (?extendedprice * ?discount)
+      LIMIT 1000
+    }
+    ?line tpch:has_order ?order .
+    ?order tpch:has_customer ?cust .
+    ?cust tpch:customer_of ?order2 .
+    ?order2 tpch:order_of ?line2 .
+    ?line2 tpch:lineextendedprice ?extendedprice2 ;
+      tpch:linediscount ?discount2 .
+  }
+ORDER BY (SUM(?extendedprice2 * (1 - ?discount2)) / MAX (?bigdiscount))]]></programlisting>
+
+<para>
+The inner select finds the 1000 biggest (in absolute value) discounts and their order lines. For each line we find orders of it, and the customer. For each customer found, we find all the orders he made and all the lines of each of the orders (variable ?line2).</para>
+<para>
+Note that the inner select does not contain FROM clauses. It is not required because the inner select inherits the access permissions of all the outer queries. It is also important to note that the internal variable bindings of the subquery are not visible in the outer query; only the result set variables are bound. Similarly, variables bound in the outer query are not accessible to the subquery.</para>
+<para>
+Note also the declaration <emphasis>define sql:signal-void-variables 1</emphasis> that forces the SPARQL compiler to signal errors if some variables cannot be bound due to misspelt names or attempts to make joins across disjoint domains. These diagnostics are especially important when the query is long.</para>
+</sect3>
+<sect3 id="rdfsparqlbackq"><title>Expressions in Triple Patterns</title>
+<para>In addition to expressions in filters and result sets, Virtuoso allows the use of expressions in triples of a
+CONSTRUCT pattern or WHERE pattern - an expression can be used instead of a constant or a variable name for a subject, predicate or object.
+When used in this context, the expression is surrounded by backquotes.</para>
+
+<para><emphasis>Example: With a WHERE Clause:</emphasis></para>
+<para>The following example returns all the distinct 'fragment' parts of all subjects in all graphs that have some predicate whose value is equal to 2+2.</para>
+<programlisting><![CDATA[
+SQL>SPARQL SELECT distinct (bif:subseq (?s, bif:strchr (?s, '#')))
+   WHERE {
+     graph ?g {
+       ?s ?p `2+2` .
+       FILTER (! bif:isnull (bif:strchr (?s, '#') ) )
+     } };
+
+callret
+VARCHAR
+----------
+#four
+]]></programlisting>
+<para>Inside a WHERE part, every expression in a triple pattern is replaced with new variable and a filter expression is added to the enclosing group. The new filter is an equality of the new variable and the expression. Hence the sample above is identical to:</para>
+<programlisting><![CDATA[
+SPARQL
+SELECT distinct (bif:subseq (?s, bif:strchr (?s, '#')))
+   WHERE {
+     graph ?g {
+       ?s ?p ?newvariable .
+       FILTER (! bif:isnull (bif:strchr (?s, '#') ) )
+       FILTER (?newvariable = (2+2)) .
+     } }
+]]></programlisting>
+<para><emphasis>Example: With CONSTRUCT</emphasis></para>
+<programlisting><![CDATA[
+CONSTRUCT {
+  <http://bio2rdf.org/interpro:IPR000181>
+<http://bio2rdf.org/ns/bio2rdf#hasLinkCount>
+`(SELECT (count(?s)) as ?countS
+   WHERE { ?s ?p <http://bio2rdf.org/interpro:IPR000181> })` }
+WHERE { ?s1 ?p1 ?o1 } limit 1
+]]></programlisting>
+<para>The result should be:</para>
+<programlisting><![CDATA[
+<http://bio2rdf.org/interpro:IPR000181> <http://bio2rdf.org/ns/bio2rdf#hasLinkCount> "0"^^<http://www.w3.org/2001/XMLSchema#integer> .
+]]></programlisting>
+<para><emphasis>Example: Inserting into a graph using an expression</emphasis></para>
+<programlisting><![CDATA[
+SQL>SPARQL insert into graph <http://MyNewGraph.com/> {
+<http://bio2rdf.org/interpro:IPR000181>
+<http://bio2rdf.org/ns/bio2rdf#hasLinkCount>
+  `(SELECT (count(?s)) as ?countS
+    WHERE { ?s ?p <http://bio2rdf.org/interpro:IPR000181> })` }
+ WHERE { ?s1 ?p1 ?o1 } limit 1  ;
+
+callret-0
+VARCHAR
+_______________________________________________________________________________
+
+Insert into <http://MyNewGraph.com/>, 1 triples -- done
+
+1 Rows. -- 30 msec.
+]]></programlisting>
+</sect3>
 </sect2>
 </sect1>
 
@@ -6690,7 +7110,7 @@ permissions on all graphs.</listitem>
 set automatically.</para>
 <sect3 id="rdfgraphsecurityintconfsecuser"><title>Configuring New User</title>
 <itemizedlist mark="bullet">
-  <listitem>Step 1: Grant SPARQL_SELECT, SPARQL_SPONGE or SPAR_UPDATE to the user.</listitem>
+  <listitem>Step 1: Grant SPARQL_SELECT, SPARQL_SPONGE or SPARQL_UPDATE to the user.</listitem>
   <listitem>Step 2: Set user's permissions on all graphs.</listitem>
   <listitem>Step 3: Grant rights on some specific graphs.</listitem>
 </itemizedlist>
@@ -6809,23599 +7229,6928 @@ SELECT ?g ?s WHERE { ?s <p> ?o }
 </sect2>
 </sect1>
 
-<sect1 id="rdfrdfviewgnr"><title>Automated Generation of RDF Views over Relational Data Sources</title>
-<sect2 id="rdfrdfviewgnrintro"><title>Introduction</title>
-<para>Virtuoso offers from Conductor UI an HTML based Wizard interface for dynamically generating &
-publishing RDF based Linked Data from ODBC or JDBC accessible relational data sources. Basically,
-a mechanism for building RDF based Linked Data views over relational data sources.
+<sect1 id="rdfviews"><title>RDF Views over RDBMS Data Source</title>
+<para>
+RDF Views map relational data into RDF and allow customizing RDF representation of locally stored RDF data.
+To let SPARQL clients access relational data as well as physical RDF graphs in a single query, we introduce a declarative Meta Schema Language for mapping SQL Data to RDF Ontologies.
+As a result, all types of clients can efficiently access all data stored on the server.
+The mapping functionality dynamically generates RDF Data Sets for popular ontologies such as SIOC, SKOS, FOAF, and ATOM/OWL without disruption to the existing database infrastructure of Web 1.0 or Web 2.0 solutions.
+RDF views are also suitable for declaring custom representation for RDF triples, e.g. property tables, where one row holds many single-valued properties.
 </para>
-<para>The proliferation of relational databases across enterprises and behind Web sites, makes them a
-vital data source for the burgeoning Linked Data Web. Thus, the process of publishing Linked Data from
-these sources needs to be as unobtrusive as possible. Naturally, a balance has to be struck between
-unobtrusive generation of Linked Data and traditional relational database management system (RDBMS)
-virtues such as:
+<sect2 id="rdfviewsintro"><title>Introduction</title>
+<para>
+The Virtuoso RDF Views meta schema is a built-in feature of Virtuoso's SPARQL to SQL translator.
+It recognizes triple patterns that refer to graphs for which an alternate representation is declared and translates these into SQL accordingly.
+The main purpose of this is evaluating SPARQL queries against existing relational databases.
+There exists previous work from many parties for rendering relational data as RDF and opening it to SPARQL access.
+We can mention D2RQ, SPASQL, Squirrel RDF, DBLP and others.
+The Virtuoso effort differs from these mainly in the following:
 </para>
-<itemizedlist mark="bullet">
-  <listitem>Scalability</listitem>
-  <listitem>Security</listitem>
-  <listitem>Analytical Expressivity of SQL</listitem>
-  <listitem>Separation of Data Access and Data Storage via ODBC, JDBC, ADO.NET CLIs.</listitem>
+<itemizedlist mark="bullet" spacing="compact">
+<listitem>Integration with a triple store.
+Virtuoso can process a query for which some triple patterns will go to local or remote relational data and some to local physical RDF triples.
+</listitem><listitem>SPARQL query can be used in any place where SQL can.
+Database connectivity protocols are neutral to the syntax of queries they transmit, thus any SQL client, e.g. JDBC, ODBC or XMLA application, can send SPARQL queries and fetch result sets.
+Moreover, a SQL query may contain SPARQL subqueries and SPARQL expressions may use SQL built-in functions and stored procedures.
+</listitem><listitem>Integration with SQL.
+Since SPARQL and SQL share the same run time and query optimizer, the query compilation decisions are always made with the best knowledge of the data and its location.
+This is especially important when mixing triples and relational data or when dealing with relational data distributed across many outside databases.
+</listitem><listitem>No limits on SPARQL.
+It remains possible to make queries with unspecified graph or predicate against mapped relational data, even though these may sometimes be inefficient.
+</listitem><listitem>Coverage of the whole relational model.
+Multi-part keys etc. are supported in all places.
+</listitem>
 </itemizedlist>
-<para>The following steps must be taken to publish RDF-based Linked Data:
-</para>
-<orderedlist>
-  <listitem>Identifying ODBC or JDBC data sources that host the data you seek to publish
-(assuming the data isn't Virtuoso RDBMS hosted -- in which case, skip ahead to step #3).</listitem>
-  <listitem>Attach/Link TABLEs or VIEWs from the external data sources into Virtuoso via their Data Source Names (DSNs).</listitem>
-  <listitem>Identify the internal or external TABLEs or VIEWs that hold the data you wish to publish.</listitem>
-  <listitem>Configure Endpoints and Re-write Rules to disambiguate data object (resource) identity and description through HTTP-based content negotiation.</listitem>
-  <listitem>Expose the Data Source Ontology and associated Instance Data in Linked Data form through those Endpoints and Re-write Rules.</listitem>
-</orderedlist>
+</sect2>
+<sect2 id="rdfviewrationale"><title>Rationale</title>
 <para>
-These steps may be largely automated (the "One-Click" Deployment below), or performed manually ("Using the Conductor's HTML-based Wizard" further down).
+Since most of the data that is of likely use for the emerging semantic web is stored in relational databases, the argument for exposing this to SPARQL access is clear.
+We note that historically, SQL access to relational data has essentially never been given to the public outside of the organization.
+If programmatic access to corporate IS has been available to partners or the public, it has been through dynamic web pages or more recently web services.
+There are reasons of performance, security, maintainability and so forth for this.
+</para><para>
+The culture of the emerging semantic web is however taking a different turn.
+Since RDF and OWL offer a mergeable and queryable model for heterogeneous data, it is more meaningful and maintainable to expose selected data for outside query than it would be with SQL.
+Advances in hardware make this also less of a performance issue than it would have been in the client-server database era.
+</para><para>
+In the context of Virtuoso, since Virtuoso is originally a virtual/federated database, incorporating SPARQL to relational mapping is an evident extension of the product's mission as a multi-protocol, multi-platform connector between information systems.
 </para>
 </sect2>
-<sect2 id="rdfrdfviewgnroneclick"><title>One Click Linked Data Generation & Deployment</title>
-<para>The following steps provide a one-click guide for publishing ODBC- or JDBC-accessible RDBMS data in RDF Linked Data form, using the "Generate & Publish" Conductor feature.
+<sect2 id="rdfviewquadmapatternsvalueandiriclasses"><title>Quad Map Patterns, Values and IRI Classes</title>
+<para>
+In the simplest sense, any relational schema can be rendered into RDF by converting all primary keys and foreign keys into IRI's, assigning a predicate IRI to each column, and an rdf:type predicate for each row linking it to a RDF class IRI corresponding to the table.
+Then a triple with the primary key IRI as subject, the column IRI as predicate and the column's value as object is considered to exist for each column that is neither part of a primary or foreign key.
+</para><para>
+Strictly equating a subject value to a row and each column to a predicate is often good but is too restrictive for the general case.
 </para>
-<orderedlist>
-  <listitem>Go to http://<cname>:port/conductor</listitem>
-  <listitem>Log in as user dba (or another user with DBA privileges)</listitem>
-  <listitem>Follow menu path Database -> RDF Views
-    <figure id="rd1" float="1">
-      <title>RDF Views</title>
-      <graphic fileref="ui/rd1.png"/>
-    </figure>
-</listitem>
-  <listitem>In the form presented, perform the following steps:
-<orderedlist>
-  <listitem>Select the Database Name Qualifier (e.g., "Demo")
-that exposes the Tables / Views for this exercise </listitem>
-  <listitem>Enter the Base URL to which your URL rewrite rules will be bound
-(e.g. http://<cname>:8890/Demo)</listitem>
-  <listitem>Select specific Tables containing the data to be published (e.g. Demo.demo.Shippers and Demo.demo.Suppliers)</listitem>
-  <listitem>Click the "Generate & Publish" button</listitem>
-</orderedlist>
-    <figure id="rd2" float="1">
-      <title>RDF Views Generate and Publish</title>
-      <graphic fileref="ui/rd2.png"/>
-    </figure>
-  </listitem>
-  <listitem>Virtuoso will perform the entire process of ontology generation, instance data generation, and
-linked data deployment (re-write rules generation and application).</listitem>
-  <listitem>Error messages will be presented if the Wizard encounters problems. If there are no error
-messages, your RDF view declarations and Linked Data publishing activities will have completed successfully.
-    <figure id="rd13" float="1">
-      <title>RDF View declarations and Linked Data publishing activities</title>
-      <graphic fileref="ui/rd13.png"/>
-    </figure>
-</listitem>
-  <listitem>Optionally, you could also perform one of the following tasks:
-<orderedlist>
-  <listitem>Save Data Mappings: when clicked, offers to save the generated Definitions to local file system</listitem>
-  <listitem>Save Ontology Mappings: when clicked, offers to save the generated Ontology to local file system</listitem>
-  <listitem>Click on the "Cancel" should you want to return to the initial RDF View Generation form.</listitem>
-</orderedlist>
-</listitem>
-</orderedlist>
-</sect2>
-<sect2 id="rdfrdfviewgnrwizzard"><title>Manual Linked Data Generation & Deployment using the Conductor's HTML-based wizard</title>
-<para>The following step-by guide will lead you through manually publishing ODBC- or JDBC-accessible RDBMS
-data in RDF Linked Data form, using the Conductor's HTML-based wizard:
+<itemizedlist mark="bullet" spacing="compact">
+<listitem>Multiple triples with the same subject and predicate can exist.
+</listitem><listitem>A single subject can get single-valued properties from multiple tables or in some cases stored procedures.
+</listitem><listitem>An IRI value of a subject or other field of a triple can be composed from more than one SQL value, these values may reside in different columns, maybe in different joined tables.
+</listitem><listitem>Some table rows should be excluded from mapping.
+</listitem></itemizedlist>
+<para>
+Thus in the most common case the RDF meta schema should consist of independent transformations; the domain of each transformation is a result-set of some SQL <emphasis>SELECT</emphasis> statement and range is a set of triples.
+The <emphasis>SELECT</emphasis> that produce the domain is quite simple: it does not use aggregate functions, joins and sorting, only inner joins and <emphasis>WHERE</emphasis> conditions.
+There is no need to support outer joins in the RDF meta schema because NULLs are usually bad inputs for functions that produce IRIs.
+In the rare cases when NULLs are OK for functions, outer joins can be encapsulated in SQL views.
+The range of mapping can be described by a SPARQL triple pattern: a pattern field is a variable if it depends on table columns, otherwise it is a constant.
+Values of variables in the pattern may have additional restrictions on datatypes, when datatypes of columns are known.
+</para><para>
+This common case of an RDF meta schema is implemented in Virtuoso, with one adjustment.
+Virtuoso stores quads, not triples, using the graph field (G) to indicate that a triple belongs to some particular application or resource.
+A SPARQL query may use quads from different graphs without large difference between G and the other three fields of a quad.
+E.g., variable <emphasis>?g</emphasis> in expression <emphasis>GRAPH ?g {...}</emphasis> can be unbound.
+SPARQL has special syntax for "graph group patterns" that is convenient for sets of triple patterns with a common graph, but it also has shorthands for common subject and predicate, so the difference is no more than in syntax.
+There is only one feature that is specific for graphs but not for other fields: the SPARQL compiler can create restrictions on graphs according to <emphasis>FROM</emphasis> and <emphasis>FROM NAMED</emphasis> clauses.
+</para><para>
+Virtuoso RDF Views should offer the same flexibility with the graphs as SPARQL addressing physical triples.
+A transformation cannot always be identified by the graph used for ranges because graph may be composed from SQL data. The key element of the meta schema is a "<emphasis>quad map pattern</emphasis>".
+A simple quad map pattern fully defines one particular transformation from one set of relational columns into triples that match one SPARQL graph pattern.
+The main part of quad map pattern is four declarations of "<emphasis>quad map values</emphasis>", each declaration specifies how to calculate the value of the corresponding triple field from the SQL data.
+The pattern also lists boolean SQL expressions that should be used to filter out unwanted rows of source data (and to join multiple tables if source columns belong to different tables).
+There are also quad map patterns that group together similar quad patterns but do not specify any real transformation or even prevent unwanted transformations from being used, they are described in "Grouping Map Patterns" below.
+</para><para>
+Quad map values refer to schema elements of two further types: "IRI classes" and "literal classes".
+</para>
+<note><para>In SQL, adding a new view can not break anything. This is because SQL lacks the ability of querying "everything" so data sources are always specified. This is not true for SPARQL, so please treat <emphasis>any</emphasis> metadata manipulation as potentially destructive operation. If an RDF storage is supposed to be used by more than one application then these applications should be tested together, not one after other, and they should be installed/upgraded on live database in the very same order as they were installed/upgraded on instrumental machine during testing. Always remember that these applications share RDF tables so they may interfere.</para></note>
+<sect3 id="rdfviewiriclasses"><title>IRI Classes</title>
+<para>
+An IRI class declares that a column or set of columns gets converted into a IRI in a certain way.
+The conversion of this sort can be declared revertible (bijection) so an IRI can be parsed into original SQL values; this is useful when some equality of an IRI constant and a calculated IRI can be replaced with an equality of a parse result of a constant and an SQL column that is index criteria or simply faster.
+In addition, the SPARQL optimizer will eliminate redundant conversions if one IRI class is explicitly declared as a subclass of another.
+The most flexible declaration for conversion consists of specifying functions that assemble and disassemble from IRI into its constituent parts.
+This is overkill for typical conversions so it is possible to specify only one sprintf-style format string such that <emphasis>sprintf()</emphasis> SQL function will print an IRI using this format and <emphasis>sprintf_inverse()</emphasis> will be able to parse it back.
+</para><para>The use of <emphasis>sprintf_inverse()</emphasis> assumes that the format does not contain fragments like <emphasis>'%s%s'</emphasis> that make it impossible to separate parts of IRI from each other.
+</para><para>
+In the following, we shall map the Virtuoso users and user roles system tables into the SIOC ontology.
 </para>
-<orderedlist>
-  <listitem>Go to http://<cname>:port/conductor</listitem>
-  <listitem>Log in as user dba (or another user with DBA privileges)</listitem>
-  <listitem>Follow menu path Database -> RDF Views
-    <figure id="rd1" float="1">
-      <title>RDF Views</title>
-      <graphic fileref="ui/rd1.png"/>
-    </figure>
-  </listitem>
-  <listitem>In the form presented, perform the following steps:
-    <orderedlist>
-  <listitem>Select the Database Name Qualifier (e.g., "Demo")  that exposes the Tables / Views for this
-exercise</listitem>
-      <listitem>Enter the Base URL to which your URL rewrite rules will be bound (e.g. http://<cname>:8890/Demo)</listitem>
-      <listitem>Select specific Tables containing the data to be published (e.g., Demo.demo.Shippers and Demo.demo.Suppliers)</listitem>
-  <listitem>Click the "Generate via Wizard" button
-    <figure id="rd2" float="1">
-      <title>Generate via Wizard</title>
-      <graphic fileref="ui/rd2.png"/>
-    </figure>
-      </listitem>
-    </orderedlist>
-  </listitem>
-  <listitem>At this point, you are presented with the option to edit your column selection. Select the
-"Edit" link, for example, for table Demo.demo.Shippers.
-    <figure id="rd3" float="1">
-      <title>Column Selection</title>
-      <graphic fileref="ui/rd3.png"/>
-    </figure>
-  </listitem>
-  <listitem>For images or other binary data in MIME formats to be revealed as anything other than generic "binary objects", you must map large
-varbinary types to the appropriate MIME types like image/gif. To do so, select the Edit link for Binding/MIME Type of the relevant table columns.
-You can:
-    <itemizedlist mark="bullet">
-      <listitem>Leave the Binding/MIME Type literal; or</listitem>
-      <listitem>Set to skip, such that the column will not be used in RDF generation; or </listitem>
-      <listitem>Select the binary object value in order for the column to be referenced as binary.</listitem>
-    </itemizedlist>
-    <figure id="rd14" float="1">
-      <title>Binding/MIME Types</title>
-      <graphic fileref="ui/rd14.png"/>
-    </figure>
-  </listitem>
-  <listitem>After finishing with your changes click the Save button, or cancel the changes and go back by
-clicking the Cancel button.</listitem>
-  <listitem>Make sure you click the "Next" button.</listitem>
-  <listitem>At this point, the RDF View Definition form will let you Select Generation Targets options:
-    <orderedlist>
-  <listitem>Data Source Ontology Mappings</listitem>
-  <listitem>Instance Data View Mappings</listitem>
-  <listitem>VoID statistic</listitem>
-    </orderedlist>
-    <figure id="rd15" float="1">
-      <title>Generation Targets options</title>
-      <graphic fileref="ui/rd15.png"/>
-    </figure>
-  </listitem>
-  <listitem>Make sure you click the "Next" button.</listitem>
-  <listitem>Based on your selections in the prior form, the RDF View Definition Deployment Options form will be offered:
-    <orderedlist>
-  <listitem>Data Source Ontology Rules</listitem>
-  <listitem>Instance Data Rules
-      </listitem>
-    </orderedlist>
-    <figure id="rd4" float="1">
-      <title>Generation Targets options</title>
-      <graphic fileref="ui/rd4.png"/>
-    </figure>
-  </listitem>
-  <listitem>Select the desired option(s) and click the "Prepare to Execute" button which unveils a generated
-Instance Data and/or Ontology form.
-    <figure id="rd5" float="1">
-      <title>Instance Data and/or Ontology</title>
-      <graphic fileref="ui/rd5.png"/>
-    </figure>
-  </listitem>
-  <listitem>Click the Execute button and Virtuoso will:
-    <orderedlist>
-      <listitem>Apply the generated declarations (instance data and ontology) to your Virtuoso instance</listitem>
-      <listitem>Publish / Deploy declarations that expose the Wizard-generated Rewrite Rules and associated endpoints.
-    <figure id="rd6" float="1">
-      <title>Publishing / Deployment declarations</title>
-      <graphic fileref="ui/rd6.png"/>
-    </figure>
-      </listitem>
-    </orderedlist>
-  </listitem>
-  <listitem>Optionally, you can also perform one of the following tasks:
-    <orderedlist>
-      <listitem>Save Data Mappings: when clicked, offers to save the generated Definitions to local file
-system</listitem>
-      <listitem>Save Ontology Mappings: when clicked, offers to save the generated Ontology to local file
-system</listitem>
-      <listitem>Export as WebDAV resource: exports the selected objects/items as a WebDAV resource:
-        <itemizedlist mark="bullet">
-  <listitem>Click "Browse"</listitem>
-  <listitem>Enter a WebDAV resource and click the "Select" button.</listitem>
-        </itemizedlist>
-    <figure id="rd7" float="1">
-      <title>WebDAV resource</title>
-      <graphic fileref="ui/rd7.png"/>
-    </figure>
-     </listitem>
-    </orderedlist>
-    <para>Note, the WebDAV resource path value will be shown in the WebDAV location field.</para>
-  </listitem>
-  <listitem>Then click the "Save Data Mappings" or "Save Ontology Mappings" button, to complete the option task of saving your generated (or edited) view declarations.
-    <figure id="rd8" float="1">
-      <title>WebDAV resource</title>
-      <graphic fileref="ui/rd8.png"/>
-    </figure>
-  </listitem>
-  <listitem>Error messages will be presented if the Wizard encounters problems. If there are no error messages, your RDF view declarations and Linked Data publishing activities will have completed successfully.
-    <figure id="rd9" float="1">
-      <title>RDF view declarations and Linked Data publishing activities Finish</title>
-      <graphic fileref="ui/rd9.png"/>
-    </figure>
-</listitem>
-  <listitem>Click on Cancel to return to the initial RDF View Generation form.</listitem>
-</orderedlist>
-</sect2>
-</sect1>
-<sect1 id="rdfinsertmethods"><title>RDF Insert Methods in Virtuoso</title>
-    <sect2 id="rdfinsertmethodsapifunct"><title>Using API functions</title>
-      <itemizedlist mark="bullet">
-        <listitem><link linkend="rdfapidataimportttlp">Using the DB.DBA.TTLP() function</link>
-          <itemizedlist mark="bullet">
-            <listitem>Note: use this function for loading Turtle</listitem>
-           </itemizedlist>
-        </listitem>
-        <listitem><link linkend="rdfapidataimportttlpmt">Using the DB.DBA.TTLP_MT() function</link>
-          <itemizedlist mark="bullet">
-            <listitem>Note: use this function for loading triples from file on multiple threads</listitem>
-           </itemizedlist>
-        </listitem>
-        <listitem><link linkend="rdfapidataimportttlpmt">Using the DB.DBA.RDF_LOAD_RDFXML_MT() function</link>
-          <itemizedlist mark="bullet">
-            <listitem>Note: Use this function for loading large resources when transactional integrity is not important (loading of a single resource may take more than one transaction)</listitem>
-           </itemizedlist>
-        </listitem>
-        <listitem><link linkend="rdfapidataimportttlphash">Using the DB.DBA.RDF_TTL2HASH() function</link>
-          <itemizedlist mark="bullet">
-            <listitem>Note: use this function to get dictionary of triples in 'long valmode'.</listitem>
-           </itemizedlist>
-        </listitem>
-        <listitem><link linkend="rdfapidataimportloadrdfxml">Using the DB.DBA.RDF_LOAD_RDFXML() function</link>
-          <itemizedlist mark="bullet">
-            <listitem>For loading RDF/XML, the best way is to split the data to be loaded into
-multiple streams and load these in parallel using this function.</listitem>
-           </itemizedlist>
-        </listitem>
-      </itemizedlist>
-      <para>See <link linkend="rdfperfloading">more details</link> for loading Performance Tuning specifics.</para>
-    </sect2>
-    <sect2 id="rdfinsertmethodshttppost"><title>HTTP Post using Content-Type: application/sparql-query</title>
-	<para>With POST can be accomplished SPARQL Insert/Update etc.</para>
-	<para>The result is in the rdf_quad.</para>
-	<para>With GET Methods you can get the triples which are saved.</para>
-        <para><emphasis>Examples:</emphasis></para>
-        <para><emphasis>Example 1:</emphasis></para>
-        <para>Create a DAV collection xx for user demo with password demo.</para>
-        <para>Execute the following command:</para>
-<programlisting><![CDATA[
-curl -i -d "INSERT {<http://demo.openlinksw.com/DAV/home/demo_about.rdf>
-<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User>}" -u "demo:demo"
--H "Content-Type: application/sparql-query" http://localhost:8890/DAV/xx/yy
-]]></programlisting>
-        <para>The response should be:</para>
 <programlisting><![CDATA[
-HTTP/1.1 201 Created
-Server: Virtuoso/05.00.3023 (Win32) i686-generic-win-32  VDB
-Connection: Keep-Alive
-Content-Type: text/html; charset=ISO-8859-1
-Date: Fri, 28 Dec 2007 12:50:12 GMT
-Accept-Ranges: bytes
-MS-Author-Via: SPARQL
-Content-Length: 0
+create iri class oplsioc:user_iri "http://myhost/sys/user?id=%d"
+  (in uid integer not null) .
+create iri class oplsioc:group_iri "http://myhost/sys/group?id=%d"
+  (in gid integer not null) .
+create iri class oplsioc:membership_iri
+  "http://myhost/sys/membership?super=%d&sub=%d"
+  (in super integer not null, in sub integer not null) .
+create iri class oplsioc:dav_iri "http://myhost%s"
+  (in path varchar) .
 ]]></programlisting>
-        <para>The result in the DAV/xx location will be a new WebDAV resource with name "yy" containing the inserted RDF:</para>
+<para>
+These IRI classes are used for mapping data from the <emphasis>DB.DBA.SYS_USERS</emphasis> and <emphasis>DB.DBA.SYS_ROLE_GRANTS</emphasis> system tables that are defined in Virtuoso as follows:
+</para>
 <programlisting><![CDATA[
-<?xml version="1.0" encoding="utf-8" ?>
-<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
-<rdf:Description
-rdf:about="http://demo.openlinksw.com/DAV/home/demo_about.rdf">
-<ns0pred:type xmlns:ns0pred="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-rdf:resource="http://rdfs.org/sioc/ns#User"/>
-</rdf:Description>
-</rdf:RDF>
+create table DB.DBA.SYS_USERS (
+  U_ID                integer not null unique,
+  U_NAME              char (128) not null primary key,
+  U_IS_ROLE           integer default 0,
+  U_FULL_NAME         char (128),
+  U_E_MAIL            char (128) default ",
+  U_ACCOUNT_DISABLED  integer default 1,
+  U_DAV_ENABLE        integer default 0,
+  U_SQL_ENABLE        integer default 1,
+  U_HOME              varchar (128),
+. . .
+ );
 ]]></programlisting>
-        <para><emphasis>Example 2:</emphasis></para>
-        <para>Create a DAV collection, for ex. with name "test" for user ( for ex. demo).</para>
-        <para>Execute the following command:</para>
+<para>
+Single record in <emphasis>DB.DBA.SYS_USERS</emphasis> corresponds to a plain user or a group (role).
+Users and roles are collectively named "grantees". Thus a role may be granted to another role or to a user account.
+A role grant may be direct (explicit) or assigned by recursion.
+</para>
 <programlisting><![CDATA[
-curl -i -d "INSERT IN GRAPH <http://mygraph.com>
-{ <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this>
-  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
-  <http://rdfs.org/sioc/ns#User> .
-  <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this>
-  <http://www.w3.org/2000/01/rdf-schema#label>
-  <Kingsley Uyi Idehen> .
-  <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this>
-  <http://rdfs.org/sioc/ns#creator_of>
-
-<http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300>
-  } " -u "demo:demo" -H "Content-Type: application/sparql-query" http://localhost:8890/DAV/home/demo/test/myrq
+create table SYS_ROLE_GRANTS (
+  GI_SUPER   integer,
+  GI_SUB     integer,
+  GI_DIRECT  integer default 1,
+. . .
+  primary key (GI_SUPER, GI_SUB, GI_DIRECT));
 ]]></programlisting>
-        <para>As result the response will be:</para>
+<para>One IRI class usually corresponds to one ontology class, because similar things are usually called similarly.
+One may wish to use identifiers of ontology classes as identifiers of related IRI classes, to not remember double number of names, e.g. <emphasis>create IRI class mybank:XpressXfer</emphasis> for subjects that will have <emphasis>rdf:type</emphasis> property <emphasis>mybank:XpressXfer</emphasis> made by mapping. That is technically possible but proven to become inconvenient and misleading as application evolves. While RDF types tend to persist, IRI classes may change over time or same subject may get more than one name via more than one IRI class, say, for exports to different systems. It is found to be more convenient to compose names of IRI classes by adding some common prefixes or suffixes to RDF classes (or to table names), say, write <emphasis>create IRI class mybank:XpressXfer_iri</emphasis>.</para>
+</sect3>
+<sect3 id="rdfviewliteralclasses"><title>Literal Classes</title>
+<para>
+A "literal class" declares that a column or set of columns gets converted into a literal instead of an IRI.
+More precisely, the result of conversion can be <emphasis>IRI_ID</emphasis> so it represents an IRI, but in current version of Virtuoso this is supported only for some internal built-in literal classes, not for classes declared by the user.
+So for user-defined literal class the result of the conversion is an RDF literal even if it is a string representation of a valid IRI.
+</para><para>
+In any case, a literal class can be used only in quad map values of O fields, because Virtuoso does not support literal values as subjects.
+</para><para>
+A special case of literal class is the identity class that converts a value from <emphasis>varchar</emphasis> column into an untyped literal and value from column of any other SQL datatype into a typed literal with type from XMLSchema set, i.e. <emphasis>xsd:integer</emphasis>, <emphasis>xsd:dateTime</emphasis> and so on.
+Columns of types <emphasis>ANY</emphasis> and <emphasis>IRI_ID</emphasis> are not supported.
+</para><para>
+The SPARQL optimizer knows that RDF literal types are pairwise disjoint so literal classes that produce literals of different types are known to be pairwise disjoint.
+The optimizer will replace a join on two disjoint literal classes with an empty statement, to simplify the resulting query.
+</para>
+</sect3>
+<sect3 id="rdfviewsimplequadmappatterns"><title>Simple Quad Map Patterns</title>
+<para>
+The following declaration of quad map pattern is self-explanatory. The line for <emphasis>object</emphasis> uses identity literal class so there's no need to specify its name.
+</para>
 <programlisting><![CDATA[
-HTTP/1.1 201 Created
-Server: Virtuoso/05.00.3023 (Win32) i686-generic-win-32  VDB
-Connection: Keep-Alive
-Content-Type: text/html; charset=ISO-8859-1
-Date: Thu, 20 Dec 2007 16:25:25 GMT
-Accept-Ranges: bytes
-MS-Author-Via: SPARQL
-Content-Length: 0
+graph      <http://myhost/sys>
+subject    oplsioc:user_iri (DB.DBA.SYS_USERS.U_ID)
+predicate  foaf:email
+object     DB.DBA.SYS_USERS.U_E_MAIL
 ]]></programlisting>
-        <para>Now let's check the inserted triples. Go to the sparql endpoint, i.e. http://localhost:8890/sparql and:</para>
-<itemizedlist>
-<listitem>Enter for Default Graph URI:
+<para>
+The description language also supports SPARQL-style notation that contains less keywords and eliminates duplicate graphs, subjects and predicates.
+The following add two patterns with constant graph IRI <emphasis><http://myhost/sys></emphasis> and subjects are made from column <emphasis>DB.DBA.SYS_USERS.U_ID</emphasis> by <emphasis>oplsioc:user_iri</emphasis>.
+</para>
 <programlisting><![CDATA[
-http://mygraph.com
+graph <http://myhost/sys>
+  {
+    oplsioc:user_iri (DB.DBA.SYS_USERS.U_ID)
+      a sioc:user ;
+      oplsioc:name DB.DBA.SYS_USERS.U_FULL_NAME .
+  }
 ]]></programlisting>
-</listitem>
-<listitem>Enter in the Query area:
+</sect3>
+<sect3 id="rdfviewassigningnamestoquadmappatterns"><title>Assigning Names To Quad Map Patterns</title>
+<para>
+In real applications, quad map patterns should be named, for schema manipulation and keeping debug info readable.
+Thus it is much better to rewrite the previous example as
+</para>
 <programlisting><![CDATA[
-SELECT * WHERE {?s ?p ?o}
+create virtrdf:SysUsers as graph <http://myhost/sys>
+  {
+    oplsioc:user_iri (DB.DBA.SYS_USERS.U_ID)
+      a sioc:user
+          as virtrdf:SysUserType-User;
+      oplsioc:name DB.DBA.SYS_USERS.U_FULL_NAME
+          as virtrdf:SysUsersFullName .
+  }
 ]]></programlisting>
-</listitem>
-<listitem>Click the button "Run Query"</listitem>
-<listitem>As result will be shown the inserted triples:
+<para>
+Using these names, one may later write, say, <emphasis>drop quad map virtrdf:SysUserType-User</emphasis>.
+</para><para>
+One name, <emphasis>virtrdf:DefaultQuadMap</emphasis> is reserved.
+It is an internal quad map pattern used to access "native-form" quads from <emphasis>DB.DBA.RDF_QUAD</emphasis>:
+</para>
 <programlisting><![CDATA[
-s  	                                                          p                                                 o
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this   http://www.w3.org/1999/02/22-rdf-syntax-ns#type   http://rdfs.org/sioc/ns#User
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this   http://www.w3.org/2000/01/rdf-schema#label 	    Kingsley
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this   http://rdfs.org/sioc/ns#creator_of                http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300
+create virtrdf:DefaultQuadMap as
+graph rdfdf:default-iid-nonblank (DB.DBA.RDF_QUAD.G)
+subject rdfdf:default-iid (DB.DBA.RDF_QUAD.S)
+predicate rdfdf:default-iid-nonblank (DB.DBA.RDF_QUAD.P)
+object rdfdf:default (DB.DBA.RDF_QUAD.O)
 ]]></programlisting>
-</listitem>
-</itemizedlist>
+<para>
+IRI classes from <emphasis>rdfdf:...</emphasis> namespace are also reserved.
+</para>
+</sect3>
+<sect3 id="rdfviewgroupingmappatterns"><title>Grouping Map Patterns</title>
+<para>
+The previous example actually contains three map patterns, not two.
+The name <emphasis>virtrdf:SysUsers</emphasis> refers to a "<emphasis>group map pattern</emphasis>" that does not define any real transformation of relational data into RDF but helps organize quad map patterns into a tree.
+Group may contain both quad map patterns and other groups.
+A group can be manipulated as a whole, e.g. <emphasis>drop quad map virtrdf:SysUsers</emphasis> will remove all three map patterns.
+</para>
+</sect3>
 </sect2>
-     <sect2 id="rdfinsertmethodshttpput"><title>HTTP PUT using Content-Type: application/rdf+xml</title>
-	<para>The URI in a PUT request identifies the entity enclosed with the request. Therefore using HTTP PUT is a more useful and meaningful command than using POST (which is more about submitting data to a script).</para>
-        <para><emphasis>Example:</emphasis></para>
-        <para>Suppose there is myfoaf.rdf file with the following content:</para>
-<programlisting><![CDATA[
-<rdf:RDF xmlns="http://www.example/jose/foaf.rdf#"
-    xmlns:foaf="http://xmlns.com/foaf/0.1/"
-    xmlns:log="http://www.w3.org/2000/10/swap/log#"
-    xmlns:myfoaf="http://www.example/jose/foaf.rdf#"
-    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
-
-    <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#jose">
-        <foaf:homepage rdf:resource="http://www.example/jose/"/>
-        <foaf:knows rdf:resource="http://www.example/jose/foaf.rdf#juan"/>
-        <foaf:name>Jose Jimen~ez</foaf:name>
-        <foaf:nick>Jo</foaf:nick>
-        <foaf:workplaceHomepage rdf:resource="http://www.corp.example/"/>
-    </foaf:Person>
-
-    <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#juan">
-        <foaf:mbox rdf:resource="mailto:juan at mail.example"/>
-    </foaf:Person>
-
-    <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#julia">
-        <foaf:mbox rdf:resource="mailto:julia at mail.example"/>
-    </foaf:Person>
 
-    <rdf:Description rdf:about="http://www.example/jose/foaf.rdf#kendall">
-        <foaf:knows rdf:resource="http://www.example/jose/foaf.rdf#edd"/>
-    </rdf:Description>
-</rdf:RDF>
-]]></programlisting>
-        <para>Now let's upload the myfoaf.rdf file to destination server demo.openlinksw.com for user demo:</para>
-<programlisting><![CDATA[
-curl -T myfoaf.rdf http://demo.openlinksw.com/DAV/home/demo/rdf_sink/myfoaf.rdf -u demo:demo
-]]></programlisting>
-        <para>As result the response should be:</para>
-<programlisting><![CDATA[
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
-<HTML>
-<HEAD>
-  <TITLE>201 Created</TITLE>
-</HEAD>
-<BODY>
-  <H1>Created</H1>
-  Resource /DAV/home/demo/rdf_sink/ myfoaf.rdf has been created.
-</BODY>
-</HTML>
-]]></programlisting>
-    <para>Then you can execute:</para>
-<programlisting><![CDATA[
-curl -F "query=SELECT DISTINCT ?p FROM <http://demo.openlinksw.com/DAV/home/demo/rdf_sink/> WHERE {?s ?p ?o}" http://demo.openlinksw.com/sparql
-]]></programlisting>
-    <para>The result should be:</para>
-<programlisting><![CDATA[
-<?xml version="1.0" ?>
-<sparql xmlns="http://www.w3.org/2005/sparql-results#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/sw/DataAccess/rf1/result2.xsd">
- <head>
-  <variable name="p"/>
- </head>
- <results distinct="false" ordered="true">
-  <result>
-   <binding name="p"><uri>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</uri></binding>
-  </result>
-  <result>
-   <binding name="p"><uri>http://xmlns.com/foaf/0.1/nick</uri></binding>
-  </result>
-  <result>
-   <binding name="p"><uri>http://xmlns.com/foaf/0.1/name</uri></binding>
-  </result>
-  <result>
-   <binding name="p"><uri>http://xmlns.com/foaf/0.1/homepage</uri></binding>
-  </result>
-  <result>
-   <binding name="p"><uri>http://xmlns.com/foaf/0.1/knows</uri></binding>
-  </result>
-  <result>
-   <binding name="p"><uri>http://xmlns.com/foaf/0.1/workplaceHomepage</uri></binding>
-  </result>
-  <result>
-   <binding name="p"><uri>http://xmlns.com/foaf/0.1/mbox</uri></binding>
-  </result>
- </results>
-</sparql>
-]]></programlisting>
-<para>Other examples with curl:</para>
-<programlisting><![CDATA[
-curl -F "query=SELECT distinct ?Concept FROM <http://dbpedia.org> WHERE {?s a ?Concept} limit 10" http://dbpedia.org/sparql
-]]></programlisting>
+<sect2 id="rdfviewconfiguringrdfstorages"><title>Configuring RDF Storages</title>
+<para>
+"<emphasis>Quad Storage</emphasis>" is a named set of quad map patterns.
+The declaration <emphasis>define input:storage storage-name</emphasis> states that a SPARQL query will be executed using only quad patterns of the given quad storage.
+Declarations of IRI classes, literal classes and quad patterns are shared between all quad storages of an RDF meta schema but every quad storage contains only a subset of all available quad patterns.
+Two quad storages are always defined:
+</para>
+<itemizedlist mark="bullet" spacing="compact">
+<listitem>A <emphasis>virtrdf:default</emphasis> one usually consists of everything (all user-relational mappings plus <emphasis>virtrdf:DefaultQuadMap</emphasis> for "native-form" quads from <emphasis>DB.DBA.RDF_QUAD</emphasis>)
+</listitem><listitem>A <emphasis>virtrdf:empty</emphasis> storage refers solely to <emphasis>DB.DBA.RDF_QUAD</emphasis> and can not be altered.
+</listitem></itemizedlist>
+<para>
+Three statements for manipulating storages are
+</para>
+<itemizedlist mark="number" spacing="compact">
+<listitem><emphasis>create quad storage storage-name { quad-map-decls } .</emphasis>
+</listitem><listitem><emphasis>alter quad storage storage-name { quad-map-decls-or-drops } .</emphasis>
+</listitem><listitem><emphasis>drop quad storage storage-name . </emphasis>
+</listitem></itemizedlist>
+<para>
+A map pattern can be created only as a part of <emphasis>create quad storage</emphasis> or <emphasis>alter quad storage</emphasis> statement, so initially it is used by exactly one storage.
+It can be imported to some other storage using directive <emphasis>create map-id using storage source-storage</emphasis>. E.g., declarations of many storages create <emphasis>virtrdf:DefaultQuadMap</emphasis> using storage <emphasis>virtrdf:DefaultQuadStorage</emphasis>.
+</para><para>
+Only a "top-level" quad map pattern (standalone or a whole group with descendants) can be imported, member of a group can not.
+The import directive also can not be a part of some group declaration.
+</para><para>
+The directive <emphasis>drop quad map map-name</emphasis> removes a map from one storage when it appears inside <emphasis>alter quad storage</emphasis> statement.
+Otherwise it removes the map from all storages.
+There exists garbage collection for quad map patterns, so any unused map is immediately deleted.
+A group is deleted with all its descendants.
+</para>
+</sect2>
+<sect2 id="rdfviewtranslationofpatterns"><title>Translation Of SPARQL Triple Patterns To Quad Map Patterns</title>
+<para>
+When a SPARQL query is compiled into SQL using a quad storage, every triple pattern should become a subquery that retrieves data from relational tables.
+This subquery is an <emphasis>UNION ALL</emphasis> of joins generated from appropriate quad map patterns.
+The complete SQL query is composed from these basic subqueries.
+Thus the first operation of the SQL generation for a triple pattern is searching for quad map patterns that may in principle produce triples that match the triple pattern.
+</para><para>
+The more restrictions contained in the triple pattern the fewer quad map patterns will be used.
+A triple pattern <emphasis>graph ?g { ?s ?p ?o }</emphasis> is common enough to invoke all data transformations of the storage.
+A triple pattern <emphasis>graph <g> { ?s <p> <o> }</emphasis> will usually intersect with the range of only one quad map.
+Sometimes it is possible to prove that the storage can not contain any data that matches the given triple pattern, hence zero number of members of <emphasis>UNION ALL</emphasis> will result in constantly empty result-set.
+</para>
+<para>The search for quad maps for a given pair of triple pattern and quad map storage is quite simple.
+The storage is treated as a tree of map patterns where quad map patterns are leafs, grouping patterns are inner nodes and the whole storage is also treated as a grouping pattern that specify no fields and contains all top-level map patterns of the storage.
+</para>
+<para>
+The tree is traversed from the root, left to right, non-leaf vertex are checked before their children.
+The check of a vertex consists of up to four field checks, for G, S, P and O.
+Every field check compares the field definition in the vertex and the corresponding field in the triple pattern, G and G, S and S and so on.
+Note that a non-leaf vertex defines less than four of its fields, e.g., the root vertex does not define any of its fields and top-level <emphasis>graph map { ... }</emphasis> defines only graph.
+Checks are performed only for defined fields and return one of three values: "failed", "passed", "full match", according to the following rules:
+</para>
+<table><title>Matching Triple Field and Vertex Field</title>
+<tgroup cols="3">
+<thead><row>
+<entry>Field of vertex</entry><entry>Field in triple pattern</entry><entry>Result</entry>
+</row></thead>
+<tbody>
+<row><entry>constant</entry><entry>same constant</entry><entry>full match</entry></row>
+<row><entry>constant</entry><entry>different constant</entry><entry>failed</entry></row>
+<row><entry>constant</entry><entry>variable of same type</entry><entry>passed</entry></row>
+<row><entry>constant</entry><entry>variable of different type</entry><entry>failed</entry></row>
+<row><entry>quad map value</entry><entry>constant of same type</entry><entry>full match</entry></row>
+<row><entry>quad map value</entry><entry>constant of different type</entry><entry>failed</entry></row>
+<row><entry>quad map value of type X</entry><entry>variable, X or subtype of X</entry><entry>full match</entry></row>
+<row><entry>quad map value of type X</entry><entry>variable, supertype of X</entry><entry>passed</entry></row>
+<row><entry>quad map value of type X</entry><entry>variable, type does not intersect with X</entry><entry>failed</entry></row>
+</tbody>
+</tgroup>
+</table>
+<para>
+If any of the checks fails, the vertex and all its children are excluded from the rest of processing.
+Otherwise, if all four fields are defined for the quad map pattern, the map is added to the list of matching map patterns.
+The difference between "passed" and "full match" is significant only if the map is declared with <emphasis>option (exclusive)</emphasis>
+If all performed checks return "full match" and <emphasis>option (exclusive)</emphasis> is set then the traverse of the tree is stopped as soon as all children of the vertex are traversed.
+The most typical use of this option is when the application developer is sure that all triples of a graph belong to his application and they come from his own quad map patterns, not from <emphasis>DB.DBA.RDF_QUAD</emphasis>.
+This is to prevent the SPARQL compiler from generating redundant subqueries accessing <emphasis>DB.DBA.RDF_QUAD</emphasis>.
+The declaration may look like
+</para>
 <programlisting><![CDATA[
-curl -F "query=SELECT distinct ?Concept FROM <http://myopenlink.net/dataspace/person/kidehen> WHERE {?s a ?Concept} limit 10" http://demo.openlinksw.com/sparql
+create quad storage <mystorage>
+  {
+    graph <mygraph> option (exclusive) { . . . }
+    create virtrdf:DefaultQuadMap
+      using storage virtrdf:DefaultQuadStorage .
+  }
 ]]></programlisting>
+<para>
+Exclusive patterns make the order of declarations important, because an exclusive declaration may "throw a shadow" on declarations after it.
+Consider a database that have a special table RDF_TYPE that caches all RDF types of all subjects in all graphs.
+Consider two declarations: all triples from graph <emphasis><http://myhost/sys></emphasis> and all triples with <emphasis>rdf:type</emphasis> predicate, both exclusive:
+</para>
 <programlisting><![CDATA[
-curl -F "query=SELECT distinct ?Concept FROM <http://data.openlinksw.com/oplweb/product_family/virtuoso> WHERE {?s a ?Concept} limit 10" http://demo.openlinksw.com/sparql
+graph <http://myhost/sys> option (exclusive)
+  {
+    . . . # mapping of DB.DBA.SYS_USERS as in previous examples.
+  }
+graph rdfdf:default-iid-nonblank (DB.DBA.RDF_TYPE.G)
+subject rdfdf:default-iid (DB.DBA.RDF_TYPE.S)
+predicate rdf:type
+object rdfdf:default (DB.DBA.RDF_TYPE.O)
+option (exclusive)
 ]]></programlisting>
+<para>
+The order of these declarations dictates that triple pattern
+</para>
 <programlisting><![CDATA[
-curl -F "query=SELECT distinct ?Concept FROM <http://openlinksw.com/dataspace/organization/openlink> WHERE {?s a ?Concept} limit 10" http://demo.openlinksw.com/sparql
+graph <http://myhost/sys> {?s rdf:type ?o}
 ]]></programlisting>
-    </sect2>
-     <sect2 id="rdfinsertmethodsload"><title>SPARQL Insert using LOAD</title>
-        <para>SPARQL INSERT operation can be done using the LOAD feature.</para>
-        <para><emphasis>Example:</emphasis></para>
-        <para>Execute from ISQL:</para>
-<programlisting><![CDATA[
-SPARQL insert in graph <http://mygraph.com>
-{
-  <http://myopenlink.net/dataspace/Kingsley#this>
-  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
-  <http://rdfs.org/sioc/ns#User> .
-
-  <http://myopenlink.net/dataspace/Kingsley#this>
-  <http://rdfs.org/sioc/ns#id>
-  <Kingsley> .
-
-  <http://myopenlink.net/dataspace/Caroline#this>
-  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
-  <http://rdfs.org/sioc/ns#User> .
+<para>
+is compiled using only quad map patterns of the graph declaration, ignoring second declaration (and of course ignoring default mapping rule, if any).
+An explicit <emphasis>option (order N)</emphasis> at the end of quad map pattern will tweak the priority.
+By default, order will grow from 1000 for the first declaration in the statement to 1999 for the last, explicit configuration is especially useful to make order persistent to <emphasis>alter storage</emphasis> statements.
+</para>
+<para>
+The <emphasis>option (exclusive)</emphasis> trick is ugly, low-level and prone to cause compilation errors after altering storage declarations.
+When misused, it is as bad as "red cut" in PROLOG, but one must use this trick to build scalable storages.
+</para>
+<para>The <emphasis>option (exclusive)</emphasis> helps the SPARQL compiler to prepare better SQL queries, but sometimes it is "too exclusive". For instance, if a grouping quad map pattern specify only quad map value for graph and no other fields then making it exclusive prohibits the use of all declarations of the storage after that one. Sometimes it is better to notify compiler that quads made by the given quad map pattern are supposed to be different from all quads made by declarations listed after the given one.</para>
 
- <http://myopenlink.net/dataspace/Caroline#this>
-  <http://rdfs.org/sioc/ns#id>
-  <Caroline> .
+<para>Consider an application that exports users' personal data
+as graphs whose IRIs looks like
+<emphasis>http://www.example.com/DAV/home/</emphasis>username<emphasis>/RDF/personal/</emphasis>;
+the application makes a query and a triple pattern is proven to be
+restrictive enough to filter out all quads that are not similar to
+quads generated by the given quad map pattern (say, the graph is
+constant
+<emphasis>http://www.example.com/DAV/home/JohnSmith/RDF/personal/</emphasis>). The
+application do not hope to find any quads that match the pattern but
+made by other applications, because graphs named like in the pattern
+are supposed to be solely for this single purpose; if, say,
+DB.DBA.RDF_QUAD occasionally contains some quads with graph equal to
+<emphasis>http://www.example.com/DAV/home/JohnSmith/RDF/personal/</emphasis>
+then they can be ignored.</para>
 
-   <http://myopenlink.net/dataspace/Matt#this>
-  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
-  <http://rdfs.org/sioc/ns#User> .
+<para>Under this circumstances, the quad map pattern may have <emphasis>option (soft exclusive)</emphasis>. That grants a permission to the compiler to ignore rest of storage as soon as it is proven that the triple pattern can not access quads that does not match the pattern. So if that is proven then the pattern is exclusive and it makes the query faster; when unsure, the compiler work like there is no option at all.</para>
 
-  <http://myopenlink.net/dataspace/Matt#this>
-  <http://rdfs.org/sioc/ns#id>
-  <Matt> .
 
-   <http://myopenlink.net/dataspace/demo#this>
-  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
-  <http://rdfs.org/sioc/ns#User> .
+<note><para>The <emphasis>option (exclusive)</emphasis> can be used as
+a security measure, <emphasis>option (soft exclusive)</emphasis> can
+not. Say, if an financial application exports its data as a single
+graph <emphasis>http://www.example.com/front-office/cash/</emphasis>
+using <emphasis>exclusive</emphasis> then the query that explicitly
+refers to that graph will never access any quads written by the
+attacker into DB.DBA.RDF_QUAD using same graph IRI. The use of
+<emphasis>soft exclusive</emphasis> gives no such protection. From the
+compiler's perspective, the <emphasis>option (soft
+exclusive)</emphasis> is a hint that may be ignored, not an
+unambiguous order.</para></note>
 
-  <http://myopenlink.net/dataspace/demo#this>
-  <http://rdfs.org/sioc/ns#id>
-  <demo> .};
-]]></programlisting>
-        <para>Create DAV collection which is visible to public, for ex: http://localhost:8890/DAV/tmp</para>
-        <para>Upload to the DAV collection the following file for ex. with name listall.rq and with the following content:</para>
+<para>
+There is one exception from the rules described above.
+This exception is for <emphasis>virtrdf:DefaultQuadStorage</emphasis> only.
+If a graph variable of a quad map pattern is not bound and no source graph specified by <emphasis>FROM</emphasis> clauses then quad maps for specific constant graphs are ignored.
+In other words, if a default quad storage contains quad maps for specific graphs then the query in that storage should explicitly specify the graph in order to use a map for graph.
+This rule will not work if the default quad map is removed from the <emphasis>virtrdf:DefaultQuadStorage</emphasis>.
+This rule relates to the default storage itself, not to the containing patterns; copying some or all patterns into other storage will not reproduce there this special effect.
+</para>
+<para>So for example the query from below returns results when graph is specified i.e. 
+when no graph is referenced, then run over physical store only is performed:</para>
 <programlisting><![CDATA[
-SPARQL
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX sioc: <http://rdfs.org/sioc/ns#>
-SELECT ?x ?p ?o
-FROM <http://mygraph.com>
+SQL>SPARQL 
+SELECT * 
 WHERE
     {
-    ?x rdf:type sioc:User .
-    ?x ?p ?o.
-    ?x sioc:id ?id .
-    FILTER REGEX(str(?id), "^King")
-    }
-ORDER BY ?x
-]]></programlisting>
-        <para>Now from ISQL execute the following command:</para>
-<programlisting><![CDATA[
-SQL>SPARQL
-load bif:concat ("http://", bif:registry_get("URIQADefaultHost"), "/DAV/tmp/listall.rq") into graph <http://myNewGraph.com>;
-]]></programlisting>
-        <para>As result should be shown:</para>
-<programlisting><![CDATA[
-callret-0
-VARCHAR
+    <http://localhost:8990/Demo/categories/CategoryID/1#this>  ?p ?o 
+  };
+p        o
+VARCHAR  VARCHAR
 _______________________________________________________________________________
 
-Load <http://localhost:8890/DAV/tmp/listall.rq> into graph <http://myNewGraph.com> -- done
+0 Rows. -- 0 msec.
+
+SQL>SPARQL 
+SELECT * 
+WHERE 
+  { 
+    GRAPH ?g 
+      {
+        <http://localhost:8990/Demo/categories/CategoryID/1#this>  ?p ?o 
+      }
+  };
+g                              p                                                     o
+VARCHAR                        VARCHAR                                               VARCHAR
+___________________________________________________________________________________________________________________________________
+
+http://localhost:8990/Demo#    http://www.w3.org/1999/02/22-rdf-syntax-ns#type       http://localhost:8990/schemas/Demo/Categories
+http://localhost:8990/Demo#    http://localhost:8990/schemas/Demo/categoryid         1
+http://localhost:8990/Demo#    http://localhost:8990/schemas/Demo/categoryname       ...
+...
 
-1 Rows. -- 321 msec.
 ]]></programlisting>
     </sect2>
-     <sect2 id="rdfindertmethodsparqlendpoint"><title>SPARQL Insert via /sparql endpoint</title>
-        <para>SPARQL INSERT operation can be sent to a web service endpoint as a single statement and executed in sequence.</para>
-        <para><emphasis>Example:</emphasis></para>
-        <para>Using the Virtuoso ISQL tool or using the /sparql UI at http://host:port/sparql, execute the following:</para>
-<itemizedlist>
-<listitem>Insert into graph http://BookStore.com 3 triples:
-<programlisting><![CDATA[
-SQL>SPARQL insert in graph <http://BookStore.com>
-{ <http://www.dajobe.org/foaf.rdf#i> <http://purl.org/dc/elements/1.1/date> <1999-04-01T00:00:00> .
-  <http://www.w3.org/People/Berners-Lee/card#i> <http://purl.org/dc/elements/1.1/date> <1998-05-03T00:00:00> .
-  <http://www.w3.org/People/Connolly/#me> <http://purl.org/dc/elements/1.1/date> <2001-02-08T00:00:00> };
-]]></programlisting>
-</listitem>
-<listitem>As result will be shown the message:
+<sect2 id="rdfviewdescribingsourcerelationaltables"><title>Describing Source Relational Tables</title>
+<para>Quad map patterns of an application usually share a common set of source tables and quad map values of one pattern usually share either a single table or very small number of joined tables.
+Join and filtering conditions are also usually repeated in different patterns.
+It is not necessary to type table descriptions multiple times, they are declare once in the beginning of storage declaration statement and shared between all quad map declarations inside the statement.
+Names of aliases can be used instead of table names in quad map values.
+</para>
 <programlisting><![CDATA[
-SQL>Insert into <http://BookStore.com>
-3 triples -- done
+FROM DB.DBA.SYS_USERS as user WHERE (^{user.}^.U_IS_ROLE = 0)
+FROM DB.DBA.SYS_USERS as group WHERE (^{group.}^.U_IS_ROLE = 1)
+FROM DB.DBA.SYS_USERS as account
+FROM user as active_user
+  WHERE (^{active_user.}^.U_ACCOUNT_DISABLED = 0)
+FROM DB.DBA.SYS_ROLE_GRANTS as grant
+  WHERE (^{grant.}^.GI_SUPER = ^{account.}^.U_ID)
+  WHERE (^{grant.}^.GI_SUB = ^{group.}^.U_ID)
+  WHERE (^{grant.}^.GI_SUPER = ^{user.}^.U_ID)
 ]]></programlisting>
-</listitem>
-<listitem>Next we will select all triples from the graph http://BookStore.com:
+<para>
+This declares five distinct aliases for two distinct tables, and six filtering conditions.
+Every condition is an SQL expression with placeholders where a reference to the table should be printed.
+The SPARQL compiler will not try to parse texts of these expressions (except dummy search for placeholders), so any logical expressions are acceptable.
+When a quad map pattern declaration refers to some aliases, the <emphasis>WHERE</emphasis> clause of the generated SQL code will contain a conjunction of all distinct texts of "relevant" conditions.
+A condition is relevant if every alias inside the condition is used in some quad map value of the map pattern, either directly or via clause like <emphasis>from user as active_user</emphasis>.
+(<emphasis>user</emphasis> is a "<emphasis>base alias</emphasis>" for <emphasis>active_user</emphasis>).
+</para><para>
+Consider a group of four declarations.
+</para>
 <programlisting><![CDATA[
-SQL>SPARQL SELECT * FROM <http://BookStore.com> WHERE {?s ?p ?o};
+graph <http://myhost/sys>
+  {
+    oplsioc:user_iri (active_user.U_ID)
+        a oplsioc:active-user .
+    oplsioc:membership_iri (grant.GI_SUPER, grant.GI_SUB).
+        oplsioc:is_direct
+            grant.GI_DIRECT ;
+        oplsioc:member-e-mail
+            active_user.U_E_MAIL
+               where (^{active_user.}^.U_E_MAIL like 'mailto:%').
+    ldap:account-ref (account.U_NAME)
+        ldap:belongs-to
+            ldap:account-ref (group.U_NAME) option (using grant).
+  }
 ]]></programlisting>
-</listitem>
-<listitem>As result will be shown:
+<para>
+The first declaration will extend <emphasis><http://myhost/sys></emphasis> graph with one imaginary triples <emphasis>{ user a oplsioc:active-user }</emphasis> for every account record that is not a role and not disabled.
+The second declaration deals with membership records.
+A membership is a pair of a grantee ("super") and a granted role ("sub") stored as a row in <emphasis>DB.DBA.SYS_ROLE_GRANTS</emphasis>).
+</para><para>
+The second declaration states that every membership has <emphasis>oplsioc:is_direct</emphasis> property with value from <emphasis>GI_DIRECT</emphasis> column of that table (roles may be granted to other roles and users, so permissions are "direct" or "recursive").
+</para><para>
+The third declaration declares <emphasis>oplsioc:member-e-mail</emphasis> property of memberships.
+The value is a literal string from <emphasis>DB.DBA.SYS_USERS.U_E_MAIL</emphasis>, if the grantee is active (not disabled) and is not a role and its e-mail address starts with <emphasis>'mailto:'</emphasis>.
+The join between <emphasis>DB.DBA.SYS_ROLE_GRANTS</emphasis> and <emphasis>DB.DBA.SYS_USERS</emphasis> is made by equality <emphasis>(GI_SUPER = U_ID)</emphasis> because the alias <emphasis>active_user</emphasis> in the declaration "inherits" all conditions specified for <emphasis>user</emphasis>.
+In addition, the SPARQL compiler will add one more condition to check if the <emphasis>U_E_MAIL</emphasis> is not null because the NULL value is not a valid object and it knows that <emphasis>U_E_MAIL</emphasis> is not declared as <emphasis>NOT NULL</emphasis>.
+</para><para>
+The last declaration contains an <emphasis>option</emphasis> clause.
+As usual, this indicates that the basic functionality is good for many tasks but not for all.
+In this declaration, the <emphasis>ldap:belongs-to</emphasis> property establishes a relation between grantee (subject) and a granted role (object).
+Both subject and object IRIs are based on account name, <emphasis>DB.DBA.SYS_USERS.U_NAME</emphasis>, so the quad map pattern contains two references to different aliases of <emphasis>DB.DBA.SYS_USERS</emphasis> but no alias for <emphasis>DB.DBA.SYS_ROLE_GRANTS</emphasis>.
+Hence the declaration could produce a triple for every row of the Cartesian product of the <emphasis>DB.DBA.SYS_USERS</emphasis>.
+To fix the problem, <emphasis>option (using alias-name)</emphasis> tells the compiler to process the alias-name as if it's used in some quad map value of the pattern.
+</para><para>
+It is an error to use an alias only in <emphasis>where</emphasis> clause of the quad map pattern but neither in values or in <emphasis>option (using alias-name)</emphasis>.
+To detect more typos, an alias used in quad map values can not appear in <emphasis>option (using alias-name)</emphasis> clause.
+</para>
+</sect2>
+<sect2 id="rdfviewiriusingfunction"><title>Function-Based IRI Classes</title>
+<para>Most of IRI classes can be declared by a sprintf format string, but sophisticated cases may require calculations, not only printing the string. <emphasis>create IRI class using function</emphasis> allows the application transform relational values to IRIs by any custom routines.</para>
+<para>
+Let us extend the previous example about users and groups by a new class for grantees. Both users and groups are grantees and we have defined two IRI classes for them. Classes <emphasis>oplsioc:user_iri</emphasis> and <emphasis>oplsioc:group_iri</emphasis> work fine for quad maps of <emphasis>U_ID</emphasis> if and only if the value of <emphasis>U_IS_ROLE</emphasis> is accordingly restricted to FALSE or TRUE, otherwise one may occasionally generate, say, user IRI for a group.
+To create and parse IRIs that correspond to any U_IDs, two functions should be created:
+</para>
 <programlisting><![CDATA[
-s                                              p                                       o
-VARCHAR                                        VARCHAR                                 VARCHAR
-_______________________________________________________________________________
-
-http://www.w3.org/People/Berners-Lee/card#i    http://purl.org/dc/elements/1.1/date    1998-05-03T00:00:00
-http://www.w3.org/People/Connolly/#me          http://purl.org/dc/elements/1.1/date    2001-02-08T00:00:00
-http://www.dajobe.org/foaf.rdf#i               http://purl.org/dc/elements/1.1/date    1999-04-01T00:00:00
-
-3 Rows. -- 0 msec.
-
+create function DB.DBA.GRANTEE_URI (in id integer)
+returns varchar
+{
+  declare isrole integer;
+  isrole := coalesce ((SELECT top 1 U_IS_ROLE
+      FROM DB.DBA.SYS_USERS WHERE U_ID = id ) );
+  if (isrole is null)
+    return NULL;
+  else if (isrole)
+    return sprintf ('http://%s/sys/group?id=%d', id);
+  else
+    return sprintf ('http://%s/sys/user?id=%d', id);
+};
 ]]></programlisting>
-</listitem>
-<listitem>Now let's insert into graph another http://NewBookStore.com graph's values:
 <programlisting><![CDATA[
-SQL>SPARQL
-PREFIX dc:  <http://purl.org/dc/elements/1.1/>
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-INSERT INTO GRAPH <http://NewBookStore.com> { ?book ?p ?v }
-WHERE
-  { GRAPH  <http://BookStore.com>
-   { ?book dc:date ?date
-     FILTER ( xsd:dateTime(?date) < xsd:dateTime("2000-01-01T00:00:00")).
-     ?book ?p ?v.
+create function DB.DBA.GRANTEE_URI_INVERSE (in id_iri varchar)
+returns integer
+{
+  declare parts any;
+  parts := sprintf_inverse (id_iri,
+      'http://myhost/sys/user?id=%d', 1 );
+  if (parts is not null)
+    {
+      if (exists (SELECT top 1 1 FROM DB.DBA.SYS_USERS
+          WHERE U_ID = parts[0] and not U_IS_ROLE ) )
+        return parts[0];
+    }
+  parts := sprintf_inverse (id_iri,
+      'http://myhost/sys/group?id=%d', 1 );
+  if (parts is not null)
+    {
+      if (exists (SELECT top 1 1 FROM DB.DBA.SYS_USERS
+          WHERE U_ID = parts[0] and U_IS_ROLE ) )
+        return parts[0];
    }
+  return NULL;
   };
 ]]></programlisting>
-</listitem>
-<listitem>As result will be shown:
-<programlisting><![CDATA[
-callret-0
-VARCHAR
-_______________________________________________________________________________
-
-Insert into <http://NewBookStore.com>, 2 triples -- done
-]]></programlisting>
-</listitem>
-<listitem>Finally we will check the triples from the graph NewBookStore.com:
+<para>These functions may be more useful if the SPARQL web service endpoint is allowed to use them:</para>
 <programlisting><![CDATA[
-SQL> SPARQL
-SELECT *
-FROM <http://NewBookStore.com>
-WHERE {?s ?p ?o};
+grant execute on DB.DBA.GRANTEE_URI to "SPARQL";
+grant execute on DB.DBA.GRANTEE_URI_INVERSE to "SPARQL";
 ]]></programlisting>
-</listitem>
-<listitem>As result will be shown:
+<para>
+The next declaration creates an IRI class based on these two functions:
+</para>
 <programlisting><![CDATA[
-s                                             p                                      o
-VARCHAR                                       VARCHAR                                VARCHAR
-_______________________________________________________________________________
-
-http://www.w3.org/People/Berners-Lee/card#i   http://purl.org/dc/elements/1.1/date   1998-05-03T00:00:00
-http://www.dajobe.org/foaf.rdf#i              http://purl.org/dc/elements/1.1/date   1999-04-01T00:00:00
-
-2 Rows. -- 10 msec.
+create iri class oplsioc:grantee_iri using
+  function DB.DBA.GRANTEE_URI (in id integer)
+    returns varchar,
+  function DB.DBA.GRANTEE_URI_INVERSE (in id_iri varchar)
+    returns integer .
 ]]></programlisting>
-</listitem>
-</itemizedlist>
+<para>
+In common case, IRI class declaration contains an N-array function that composes IRIs and N inverse functions that gets an IRI as an argument and extracts the Nth SQL value.
+IRI composing function should silently return NULL on incorrect arguments instead of error signal.
+Inverse functions should return NULL if the argument has an incorrect type or value.
+</para>
+<para>
+It is possible to specify only composing function without any of inverse functions. However <emphasis>option (bijection)</emphasis> can not be used in that case, obviously.
+</para>
 </sect2>
-     <sect2 id="rdfinsertmethodsparqlqueryandodswiki"><title>SPARQL Insert via HTTP Post using Content-Type: application/sparql-query and ODS wiki</title>
-        <para>With HTTP Post and ODS wiki can be written an rdf document and respectively to be performed over it INSERT/UPDATE action.</para>
-        <para>You can write to a file using SIOC terms for ODS-Wiki</para>
-        <para>You can check with sparql the inserted / updated triples in the Quad Store.</para>
-        <para><emphasis>Example:</emphasis></para>
-        <para>Suppose there is ODS user test3 with ODS password 1, which has testWiki wiki instance.</para>
-        <para>Execute the following:</para>
-<programlisting><![CDATA[
-curl -i -d "INSERT {<http://localhost:8890/dataspace/test3/wiki/testWiki> <http://atomowl.org/ontologies/atomrdf#contains> <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://rdfs.org/sioc/ns#has_container> <http://localhost:8890/dataspace/test3/wiki/testWiki> . <http://localhost:8890/dataspace/test3/wiki/testWiki> <http://atomowl.org/ontologies/atomrdf#entry> <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> . <http://localhost:8890/dataspace/test3/wiki/testWiki> <http://rdfs.org/sioc/ns#container_of> <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://rdfs.org/sioc/ns#topic>  <http://localhost:8890/dataspace/test3/wiki/testWiki> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://atomowl.org/ontologies/atomrdf#source> <http://localhost:8890/dataspace/test3/wiki/testWiki> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/types#Comment> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://atomowl.org/ontologies/atomrdf#Entry> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://www.w3.org/2000/01/rdf-schema#label> 'MyTest' . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://atomowl.org/ontologies/atomrdf#Link> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://rdfs.org/sioc/ns#content> <test>}" -u "test3:1" -H "Content-Type: application/sparql-query" http://localhost:8890/DAV/home/test3/wiki/testWiki/MyTest
-]]></programlisting>
-        <para>As result we should have 2 files created:</para>
-<itemizedlist>
-<listitem>In the user DAV folder "DAV/home/test3/wiki/testWiki/" will be created a file "MyTest" with type "application/sparql-query". You can view the content of this file from the Conductor UI or from the user's Briefcase UI, path "DAV/home/test3/wiki/testWiki". Its content will be:
-<programlisting><![CDATA[
-<?xml version="1.0" encoding="utf-8" ?>
-<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
-<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki"><ns0pred:entry xmlns:ns0pred="http://atomowl.org/ontologies/atomrdf#" rdf:resource="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"/></rdf:Description>
-<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:label xmlns:ns0pred="http://www.w3.org/2000/01/rdf-schema#">MyTest</ns0pred:label></rdf:Description>
-<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:type xmlns:ns0pred="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:resource="http://atomowl.org/ontologies/atomrdf#Link"/></rdf:Description>
-<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:type xmlns:ns0pred="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:resource="http://rdfs.org/sioc/types#Comment"/></rdf:Description>
-<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:type xmlns:ns0pred="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:resource="http://atomowl.org/ontologies/atomrdf#Entry"/></rdf:Description>
-<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:has_container xmlns:ns0pred="http://rdfs.org/sioc/ns#" rdf:resource="http://localhost:8890/dataspace/test3/wiki/testWiki"/></rdf:Description>
-<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki"><ns0pred:container_of xmlns:ns0pred="http://rdfs.org/sioc/ns#" rdf:resource="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"/></rdf:Description>
-<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki"><ns0pred:contains xmlns:ns0pred="http://atomowl.org/ontologies/atomrdf#" rdf:resource="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"/></rdf:Description>
-<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:content xmlns:ns0pred="http://rdfs.org/sioc/ns#">test</ns0pred:content></rdf:Description>
-<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:topic xmlns:ns0pred="http://rdfs.org/sioc/ns#" rdf:resource="http://localhost:8890/dataspace/test3/wiki/testWiki"/></rdf:Description>
-<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:source xmlns:ns0pred="http://atomowl.org/ontologies/atomrdf#" rdf:resource="http://localhost:8890/dataspace/test3/wiki/testWiki"/></rdf:Description>
-</rdf:RDF>
-]]></programlisting>
-</listitem>
-<listitem>To the user's wiki instance will be added a new WikiWord "MyTest" with content the value of the SIOC term attribute "content":
-<programlisting><![CDATA[
-<http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://rdfs.org/sioc/ns#content> <test>
-i.e. the content will be "test".
-]]></programlisting>
-</listitem>
+<sect2 id="rdfconnvarsiniriclasses"><title>Connection Variables in IRI Classes</title>
+<para>Writing function-based IRI class is overkill when the IRI can in principle be made by a <link linkend="fn_sprintf_iri"><function>sprintf_iri</function></link> but the format should contain some context-specific data, such as host name used for the <link linked="rdfdynamiclocal">dynamic renaming of local IRIs</link>.
+Format strings offer a special syntax for that cases.
+<emphasis>%{varname}U</emphasis> acts as <emphasis>%U</emphasis> but the function <link linkend="fn_sprintf"><function>sprintf</function></link> will take the value from client connection variable <emphasis>varname</emphasis>, not from list of arguments.
+Similarly, <link linkend="fn_sprintf_inverse"><function>sprintf_inverse</function></link> will not return fragment that match to <emphasis>%{varname}U</emphasis> in the vector of other fragments; instead it will get the value from connection environment and ensure that it matches the fragment of input; mismatch between printed and actual value of variable will means that the whole string do not match the format.</para>
+<para>SPARQL optimizer knows about this formatting feature and sometimes it makes more deductions from occurrence of <emphasis>%{varname}U</emphasis> than from occurrence of plain <emphasis>%U</emphasis>, so this notation may be used in <emphasis>option ( returns ...)</emphasis> when appropriate.
+Of course, the optimizer has no access to the actual value of connection variable because it may vary from run to run or may change between the compilation and the run, but the value is supposed to be persistent during any single query run so <emphasis>%{myvariable}U</emphasis> in one place is equal to <emphasis>%{myvariable}U</emphasis> in other.</para>
+<para>Connection variables are set by <link linkend="fn_connection_set"><function>connection_set</function></link> and some of them have default values that are used if not overridden by application:</para>
+<itemizedlist mark="bullet" spacing="compact">
+<listitem><emphasis>URIQADefaultHost</emphasis> is for default host as it is specified in Virtuoso configuration file.
+Note, however, that it will be escaped when printed so if it contains colon and port number then the colon is escaped.
+In addition, there are special variables that match dynamic renaming of local IRIs more accurately.</listitem>
+<listitem><emphasis>WSHost</emphasis> is for host and port as it is used by current client connection for dynamic renaming.
+The colon before port will be escaped.</listitem>
+<listitem><emphasis>WSHostName</emphasis> is for host name only, without port, as it is used by current client connection for dynamic renaming.</listitem>
+<listitem><emphasis>WSHostPort</emphasis> is for port part of host IRI. That is string, not integer. The only real use of the variable is in formats like <emphasis>http://%{WSHostName}U:%{WSHostPort}U/...</emphasis>.</listitem>
 </itemizedlist>
-        <para>Now let's check what data was inserted in the Quad Store:</para>
-<itemizedlist>
-<listitem>Go to the sparql endpoint, i.e. for ex. to http://localhost:8890/sparql</listitem>
-<listitem>Enter for Default Graph URI:
-<programlisting><![CDATA[
-http://localhost:8890/DAV/home/test3/wiki/testWiki/MyTest
-]]></programlisting>
-</listitem>
-<listitem>Enter for Query text:
+<para>It is inconvenient to write different format strings for
+different cases. Two most common policies are different host names
+for default HTTP port of a publicly available service and different
+non-default ports for one or more host names of an intranet
+installation; these two approaches are almost never used in a mix. So
+declaration of IRI classes may use shorthand
+<emphasis>^{DynamicLocalFormat}^</emphasis> in format strings that is
+expanded either to <emphasis>http://%{WSHost}U</emphasis> or to
+<emphasis>http://%{WSHostName}U:%{WSHostPort}U/...</emphasis>,
+depending on absence or presence of port number in the value of
+<emphasis>DefaultHost</emphasis> parameter of
+<emphasis>URIQA</emphasis> section of configuration file.</para>
+<note><para><emphasis>^{DynamicLocalFormat}^</emphasis> is for IRI class declarations only and is not expanded in any other place, so it is useful sometimes to create an IRI class with empty argument list in order to get "almost constant" IRIs calculated without writing special procedures.</para></note>
+</sect2>
+<sect2 id="rdfviewbijandreturns"><title>Lookup Optimization -- BIJECTION and RETURNS Options</title>
+<para>
+There is one subtle problem with IRI class declarations.
+To get benefit from a relational index, SPARQL optimizer should compose equality between table column and some known SQL value, not between return value of IRI class and a known composed IRI.
+In addition, redundant calculations of IRIs takes time.
+To enable this optimization, an IRI class declaration should end with <emphasis>option (bijection)</emphasis> clause. For some simple format strings the compiler may recognize the bijection automatically but an explicit declaration is always a good idea.
+</para>
+<note><title>Note:</title>
+<para>
+See also: <ulink url="http://en.wikipedia.org/wiki/One-to-one_correspondence">Wikipedia - Bijection</ulink>.
+In mathematics, a bijection, or a bijective function is a function f from a set X to a set Y such that,
+for every y in Y, there is exactly one x in X such that f(x) = y.
+</para>
+<para>
+Alternatively, f is bijective if it is a one-to-one correspondence between those sets; i.e.,
+both one-to-one (injective) and onto (surjective).
+</para>
+</note>
+<para>
+The SPARQL compiler may produce big amounts of SQL code when the query contains equality of two calculated IRIs and these IRIs may come from many different IRI classes.
+It is possible to provide hints that will let the compiler check if two IRI classes form disjoint sets of possible IRI values. The more disjoint sets are found the less possible combinations remain so the resulting SQL query will contain fewer unions of joins.
+The SPARQL compiler can prove some properties of sprintf format strings. E.g., it can prove that set of all strings printed by "http://example.com/item%d" and the set of strings printed by "http://example.com/item%d/" are disjoint.
+It can prove some more complicated statements about unions and intersections of sets of strings.
+The IRI or literal class declaration may contain <emphasis>option (returns ...)</emphasis> clause that will specify one or more sprintf patterns that cover the set of generated values.
+Consider a better version of IRI class declaration listed above:
+</para>
 <programlisting><![CDATA[
-SELECT * WHERE {?s ?p ?o}
+create iri class oplsioc:grantee_iri using
+  function DB.DBA.GRANTEE_URI (in id integer)
+    returns varchar,
+  function DB.DBA.GRANTEE_URI_INVERSE (in id_iri varchar)
+    returns integer
+  option ( bijection,
+    returns "http://myhost/sys/group?id=%d"
+    union   "http://myhost/sys/user?id=%d" ) .
 ]]></programlisting>
-</listitem>
-<listitem>Click the "Run Query" button.</listitem>
-<listitem>As result will be shown the inserted triples:
+<para>
+It is very important to keep IRI classes easily distinguishable by the text of IRI string and easy to parse.
+</para>
+<itemizedlist mark="bullet" spacing="compact">
+<listitem>Format <emphasis>%U</emphasis> is better than <emphasis>%s</emphasis>, especially in the middle of IRI, because the <emphasis>%U</emphasis> fragment can not contain characters like "/" or "="; one may prove that <emphasis>/%U/</emphasis> and <emphasis>/abra%d/cadabra/</emphasis> are disjoint but <emphasis>/%s/</emphasis> and <emphasis>/abra%d/cadabra/</emphasis> are not disjoint.
+</listitem><listitem>It is better when the variable part like <emphasis>%U</emphasis> or <emphasis>%d</emphasis> is placed between characters that may not occur in the <emphasis>%U</emphasis> or <emphasis>%d</emphasis> output, i.e. <emphasis>%U</emphasis> is placed between "/", "&" or "=" and <emphasis>%d</emphasis> is placed between non-digits; <emphasis>order_line_%d</emphasis> is better than <emphasis>order-line-%d</emphasis> because minus may be part of <emphasis>%d</emphasis> output.
+</listitem><listitem>End-of-line is treated as a special character, so placing <emphasis>%U</emphasis> or <emphasis>%d</emphasis> between "/" and end of line is as good as placing it between two "/".
+</listitem></itemizedlist>
+<para>
+In some cases <emphasis>option (returns ...)</emphasis> can be used for IRI classes that are declared using sprintf format, but actual data have more specific format.
+Consider a literal class declaration that is used to output strings and the application knows that all these strings are ISBN numbers:
+</para>
 <programlisting><![CDATA[
-s  	                                                    p  	                                             o
-http://localhost:8890/dataspace/test3/wiki/testWiki 	    http://rdfs.org/sioc/ns#container_of 	     http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest
-http://localhost:8890/dataspace/test3/wiki/testWiki 	    http://atomowl.org/ontologies/atomrdf#entry      http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest
-http://localhost:8890/dataspace/test3/wiki/testWiki 	    http://atomowl.org/ontologies/atomrdf#contains   http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest
-http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://www.w3.org/1999/02/22-rdf-syntax-ns#type  http://rdfs.org/sioc/types#Comment
-http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://www.w3.org/1999/02/22-rdf-syntax-ns#type  http://atomowl.org/ontologies/atomrdf#Entry
-http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://www.w3.org/1999/02/22-rdf-syntax-ns#type  http://atomowl.org/ontologies/atomrdf#Link
-http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://www.w3.org/2000/01/rdf-schema#label 	     MyTest
-http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://rdfs.org/sioc/ns#has_container 	     http://localhost:8890/dataspace/test3/wiki/testWiki
-http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://rdfs.org/sioc/ns#content 	             test
-http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://rdfs.org/sioc/ns#topic 	             http://localhost:8890/dataspace/test3/wiki/testWiki
-http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://atomowl.org/ontologies/atomrdf#source     http://localhost:8890/dataspace/test3/wiki/testWiki
+create literal class example:isbn_ref "%s" (in isbn varchar not null)
+  option ( bijection, returns "%u-%u-%u-%u" union "%u-%u-%u-X" )
 ]]></programlisting>
-</listitem>
-</itemizedlist>
+<para>
+Sometimes interoperability restrictions will force you to violate these rules but please try to follow them as often as possible.
+</para>
+</sect2>
+<sect2 id="rdfviewsubclasses"><title>Join Optimization -- Declaring IRI Subclasses</title>
+<para>
+Additional problem appears when the equality is between two IRIs of two different IRI classes.
+Even if both of them are bijections, the compiler does not know if these IRI classes behave identically on the intersection of their domains.
+To let the optimizer know this fact, one IRI class can be explicitly declared as a subclass of another:
+</para>
+<programlisting><![CDATA[
+make oplsioc:user_iri subclass of oplsioc:grantee_iri .
+make oplsioc:group_iri subclass of oplsioc:grantee_iri .
+]]></programlisting>
+<para>
+The SPARQL compiler can not check the validity of a subclass declaration.
+The developer should carefully test functions to ensure that transformations are really subclasses, as well as to ensure that functions of an IRI class declarations are really inverse to each other.
+</para><para>
+When declaring that a table's primary key is converted into a IRI according to one IRI class, one usually declares that all foreign keys referring to this class also get converted into an IRI as per this same class, or subclass of same class.
+</para><para>
+Subclasses can be declared for literal classes as well as for IRI classes, but this case is rare. The reason is that most of literals are made by identity literal classes that are disjoint to each other even if values may be equal in SQL sense, such as <emphasis>"2"</emphasis> of type <emphasis>xsd:integer</emphasis> and <emphasis>"2.0"</emphasis> of type <emphasis>xsd:double</emphasis>.
+</para>
     </sect2>
-    <sect2 id="rdfinsertmethodwebdav">
-      <title>Using WebDAV</title>
-      <para> Example using WebDAV (mount folder to DAV and dump; if this is the rdf_sink
-the Quad Store is updated automatically, or you can load from DAV manually to quad store)</para>
-      <para><emphasis>Example:</emphasis></para>
-      <para><emphasis>Example 1: Using ODS Briefcase</emphasis></para>
-      <itemizedlist>
-        <listitem>Go to your ods location, for ex. http://localhost:8890/ods</listitem>
-        <listitem>Register user, for ex. user test1</listitem>
-        <listitem>Login if not already in ods</listitem>
-        <listitem>Go to ODS -> Briefcase</listitem>
-        <listitem>Go to ODS -> Briefcase</listitem>
-        <listitem>Click the "New folder" icon from the Main Briefcase horizontal navigation</listitem>
-        <listitem>Enter for name for ex. "mytest" and click the "Create" button.
-          <figure id="uc6" float="1">
-	    <title>Using Briefcase UI</title>
-	    <graphic fileref="ui/uc6.png"/>
-          </figure>
-        </listitem>
-        <listitem>Go to folder "mytest" and click the click the "Upload" icon from the Main Briefcase horizontal navigation</listitem>
-        <listitem>Enter for name for ex. "mytest" and click the "Create" button.
-          <figure id="uc7" float="1">
-	    <title>Using Briefcase UI</title>
-	    <graphic fileref="ui/uc7.png"/>
-          </figure>
-        </listitem>
-        <listitem>In the shown form set:
-          <itemizedlist>
-            <listitem>Destination: RDF Store</listitem>
-            <listitem>RDF graph name for ex. with the value: http://localhost:8890/DAV/home/test2/mytest/</listitem>
-            <listitem>Select URL or File. For ex. you can select the following file with name jose.rdf:
+<sect2 id="rdfmetadatarecovery"><title>RDF Metadata Maintenance and Recovery</title>
+   <para>
+This section refers to checking and backing up RDF view and storage declarations only. The checks and backup/restore do not affect physical quads, relational schema or tables or data therein. For general backup and restore, see server administration.
+     To detect and fix automatically most popular sorts of RDF metadata corruption use <link linkend="fn_rdf_audit_metadata"><function>DB.DBA.RDF_AUDIT_METADATA</function></link>.
+It is also possible to backup RDF data by
+    <link linkend="fn_rdf_backup_metadata"><function>DB.DBA.RDF_BACKUP_METADATA</function></link>
+and restore the saved state later by using
+    <link linkend="fn_rdf_restore_metadata"><function>DB.DBA.RDF_RESTORE_METADATA</function></link>.
+It is convenient to make a backup before any modification of quad storages, quad map patterns or IRI classes, especially during debugging new RDF Views.
+   </para>
+<note><para>In SQL, adding a new view can not break anything. This is because SQL lacks the ability of querying "everything" so data sources are always specified. This is not true for SPARQL, so please treat <emphasis>any</emphasis> metadata manipulation as potentially destructive operation. If an RDF storage is supposed to be used by more than one application then these applications should be tested together, not one after other, and they should be installed/upgraded on live database in the very same order as they were installed/upgraded on instrumental machine during testing. Always remember that these applications share RDF tables so they may interfere.</para></note>
+</sect2>
+<sect2 id="splitrdfview"><title>Split RDF View</title>
+<para>RDF View can be created by two or more "sparql alter storage" statements. In each statement
+can be created one quad map that contains mappings for half or a third of all tables. Quad maps
+created should have distinct names but may mention same graph. The important fact is that if the
+RDF View in question is exclusive for a graph then only the last quad map should be exclusive but
+all previous should not have this option. This is because if a map is exclusive on a graph the rest
+of maps on that graph will be silently ignored.</para>
+<para>The example below shows a sample part of the Virtuoso eCRM Views code,
+where the RDF view is split in two parts: with quad map virtrdf:ecrmDemo1 and with
+quad map virtrdf:ecrmDemo2:</para>
 <programlisting><![CDATA[
-<rdf:RDF xmlns="http://www.example/jose/foaf.rdf#"
-    xmlns:foaf="http://xmlns.com/foaf/0.1/"
-    xmlns:log="http://www.w3.org/2000/10/swap/log#"
-    xmlns:myfoaf="http://www.example/jose/foaf.rdf#"
-    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
-
-    <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#jose">
-        <foaf:homepage rdf:resource="http://www.example/jose/"/>
-        <foaf:knows rdf:resource="http://www.example/jose/foaf.rdf#juan"/>
-        <foaf:name>Jose Jimen~ez</foaf:name>
-        <foaf:nick>Jo</foaf:nick>
-        <foaf:workplaceHomepage rdf:resource="http://www.corp.example/"/>
-    </foaf:Person>
-
-    <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#juan">
-        <foaf:mbox rdf:resource="mailto:juan at mail.example"/>
-    </foaf:Person>
+SPARQL
+prefix ecrm: <http://demo.openlinksw.com/schemas/ecrm#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix cal: <http://www.w3.org/2002/12/cal/ical#>
+prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+prefix product: <http://www.swop-project.eu/ontologies/pmo/product.owl#>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+drop quad map virtrdf:ecrmDemo1 .
+;
 
-    <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#julia">
-        <foaf:mbox rdf:resource="mailto:julia at mail.example"/>
-    </foaf:Person>
+SPARQL
+prefix ecrm: <http://demo.openlinksw.com/schemas/ecrm#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix cal: <http://www.w3.org/2002/12/cal/ical#>
+prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+prefix product: <http://www.swop-project.eu/ontologies/pmo/product.owl#>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+drop quad map virtrdf:ecrmDemo2 .
+;
 
-    <rdf:Description rdf:about="http://www.example/jose/foaf.rdf#kendall">
+...
 
-        <foaf:knows rdf:resource="http://www.example/jose/foaf.rdf#edd"/>
-    </rdf:Description>
-</rdf:RDF>
-]]></programlisting>
-            </listitem>
-          </itemizedlist>
-        </listitem>
-        <listitem>You can also perform the steps from above by uploading the file in the rdf_sink
-folder i.e. in Briefcase it will be with this path: DAV/home/test2/rdf_sink and respectively the "RDF graph name"
-will have this value: http://host:port/DAV/home/username/rdf_sink/</listitem>
-      </itemizedlist>
-      <para>Execute from ISQL or from the SPARQL endpoint the following query:</para>
-<programlisting><![CDATA[
-SELECT * FROM <http://localhost:8890/DAV/home/test2/mytest/>
-WHERE {?s ?p ?o}
-]]></programlisting>
-      <para>As result should be shown:</para>
-<programlisting><![CDATA[
-s  	                                  p  	                                            o
-http://www.example/jose/foaf.rdf#jose 	  http://www.w3.org/1999/02/22-rdf-syntax-ns#type   http://xmlns.com/foaf/0.1/Person
-http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/nick 	            Jo
-http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/name 	            Jose Jimen~ez
-http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/knows 	            http://www.example/jose/foaf.rdf#juan
-http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/homepage 	            http://www.example/jose/
-http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/workplaceHomepage 	    http://www.corp.example/
-http://www.example/jose/foaf.rdf#kendall  http://xmlns.com/foaf/0.1/knows 	            http://www.example/jose/foaf.rdf#edd
-http://www.example/jose/foaf.rdf#julia 	  http://www.w3.org/1999/02/22-rdf-syntax-ns#type   http://xmlns.com/foaf/0.1/Person
-http://www.example/jose/foaf.rdf#julia 	  http://xmlns.com/foaf/0.1/mbox 	            mailto:julia at mail.example
-http://www.example/jose/foaf.rdf#juan 	  http://www.w3.org/1999/02/22-rdf-syntax-ns#type   http://xmlns.com/foaf/0.1/Person
-http://www.example/jose/foaf.rdf#juan 	  http://xmlns.com/foaf/0.1/mbox 	            mailto:juan at mail.example
-]]></programlisting>
-      <para><emphasis>Example 2: Using Conductor UI</emphasis></para>
-      <itemizedlist>
-        <listitem>Go to Conductor UI, for ex. at http://localhost:8890/conductor</listitem>
-        <listitem>Login as dba user</listitem>
-        <listitem>Go to Web Application Server
-          <figure id="uc1" float="1">
-	    <title>Using Conductor UI</title>
-	    <graphic fileref="ui/uc1.png"/>
-          </figure>
-        </listitem>
-        <listitem>Click the "New Folder" button.</listitem>
-        <listitem>Enter for name for ex. test and click the "Create" button.
-          <figure id="uc2" float="1">
-	    <title>Using Conductor UI</title>
-	    <graphic fileref="ui/uc2.png"/>
-          </figure>
-        </listitem>
-        <listitem>Click the new folder "test" name link.
-          <figure id="uc3" float="1">
-	    <title>Using Conductor UI</title>
-	    <graphic fileref="ui/uc3.png"/>
-          </figure>
-        </listitem>
-        <listitem>Click the "Upload" button and in the shown form select Destination: RDF Store.
-        <figure id="uc4" float="1">
-	    <title>Using Conductor UI</title>
-	    <graphic fileref="ui/uc4.png"/>
-          </figure>
-        </listitem>
-        <listitem>In the shown form click the "Browse" button in order to select a file, for ex. the file jose.rdf
-and set the "RDF IRI*"
-          <figure id="uc5" float="1">
-	    <title>Using Conductor UI</title>
-	    <graphic fileref="ui/uc5.png"/>
-          </figure>
-         </listitem>
-         <listitem>Click the "Upload" button.</listitem>
-      </itemizedlist>
-    </sect2>
-    <sect2 id="rdfinsertmethodvirtuosocrawler">
-      <title>Using Virtuoso Crawler</title>
-      <para>Using Virtuoso Crawler (which includes the Sponger options so you crawl
-non-RDF but get RDF and this can go to the Quad Store)</para>
-      <para><emphasis>Example:</emphasis></para>
-      <para>Go to Conductor UI. For ex. at http://localhost:8890/conductor</para>
-      <para>Login as dba user</para>
-      <para>Go to tab Web Application Server</para>
-      <para>Go to tab Content Imports</para>
-      <para>Click the "New Target" button</para>
-      <para>In the shown form:</para>
-      <itemizedlist>
-        <listitem>Enter for "Target description": Tim Berners-Lee's electronic Business Card</listitem>
-        <listitem>Enter for "Target URL": http://www.w3.org/People/Berners-Lee</listitem>
-        <listitem>Enter for "Copy to local DAV collection" for ex.: /DAV/home/demo/rdf_sink/</listitem>
-        <listitem>Choose from the list "Local resources owner": demo</listitem>
-        <listitem>Check the check.box with label "Store metadata".</listitem>
-        <listitem>Check all the check-boxes shown below the check-box "Store metadata".</listitem>
-        <listitem>Click the button "Create".
-          <figure id="rdfinsertwebdav1" float="1">
-	    <title>Using Virtuoso Crawler</title>
-	    <graphic fileref="ui/rdfinsert1.png"/>
-          </figure>
-        </listitem>
-      </itemizedlist>
-      <para>Click the button "Import Queues".</para>
-      <para>For "Robot target" with label "Tim Berners-Lee's electronic Business Card"
-click the start link.</para>
-      <para>As result should be shown the number of the pages retrieved.</para>
-      <figure id="rdfinsertwebdav2" float="1">
-        <title>Using Virtuoso Crawler</title>
-	<graphic fileref="ui/rdfinsert2.png"/>
-      </figure>
-      <para>Now using the sparql endpoint with sponger option "Use only local data"
-enter for Default Graph URI: http://www.w3.org/People/Berners-Lee and execute the following query: </para>
-<programlisting><![CDATA[
-SELECT *
-WHERE {?s ?p ?o}
-]]></programlisting>
-      <para>As result should be shown the following triples:</para>
-<programlisting><![CDATA[
-s                                       p  	                                            o
-http://www.w3.org/People/Berners-Lee 	http://www.w3.org/1999/02/22-rdf-syntax-ns#type     http://xmlns.com/foaf/0.1/Document
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Answers for young people - Tim Berners-Lee
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Berners-Lee: Weaving the Web
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Declaration by Tim BL 28 Feb 1996 w.r.t. CDA challenge
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Errata - Berners-Lee: Weaving the Web
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Frequently asked questions by the Press - Tim BL
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Glossary - Weaving the Web - Berners-Lee
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Longer Bio for Tim Berners-Lee
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Michael Dertouzos has left us
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            The Future of the Web and Europe
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            The World Wide Web: Past, Present and Future
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            The World Wide Web: A very short personal history
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee - 3Com Founders chair
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee: Disclosures
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee: WWW and UU and I
-http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee: WorldWideWeb, the first Web client
-]]></programlisting>
-    <para><emphasis>Example: Use of schedular to interface Virtuoso Quad Store with PTSW using the following program:</emphasis></para>
-<programlisting><![CDATA[
-
-
-create procedure PTSW_CRAWL ()
-{
-  declare xt, xp any;
-  declare content, headers any;
-
-  content := http_get ('http://pingthesemanticweb.com/export/', headers);
-  xt := xtree_doc (content);
-  xp := xpath_eval ('//rdfdocument/@url', xt, 0);
-  foreach (any x in xp) do
+SPARQL
+prefix ecrm: <http://demo.openlinksw.com/schemas/ecrm#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix cal: <http://www.w3.org/2002/12/cal/ical#>
+prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+prefix product: <http://www.swop-project.eu/ontologies/pmo/product.owl#>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+alter quad storage virtrdf:DefaultQuadStorage
+FROM eCRM.DBA.SFA_SALES_QUOTA_VIEW2 as sales_quotas
+FROM eCRM.DBA.SFA_COMPANIES_VIEW2 as companies
+FROM eCRM.DBA.SFA_COMPANIES as companies_table text literal companies_table.DESCRIPTION of (companies.DESCRIPTION)
+FROM eCRM.DBA.SFA_CONTACTS_VIEW2 as contacts
+FROM eCRM.DBA.SFA_CONTACTS as contacts_table text literal contacts_table.NAME_FIRST of (contacts.NAME_FIRST)
+FROM eCRM.DBA.SFA_EMPLOYMENTS_VIEW2 as employments
+FROM eCRM.DBA.SFA_LEADS_VIEW2 as leads
+FROM eCRM.DBA.SFA_LEADS as leads_table text literal leads_table.SUBJECT of (leads.SUBJECT)
+FROM eCRM.DBA.SFA_OPPORTUNITIES_VIEW2 as opportunities
+FROM eCRM.DBA.SFA_OPPORTUNITIES as opportunities_table text literal opportunities_table.OPPORTUNITY_NAME of (opportunities.OPPORTUNITY_NAME)
+FROM eCRM.DBA.SFA_ACTIVITIES as activities
+FROM eCRM.DBA.SFA_MAIL_MESSAGES as messages
+FROM eCRM.DBA.SFA_DOCUMENTS_VIEW2 as documents
+FROM eCRM.DBA.SFA_INFLUENCERS_VIEW2 as influencers
+FROM eCRM.DBA.SFA_TEAMS_VIEW2 as teams
+FROM eCRM.DBA.SFA_NOTES_VIEW2 as notes
+FROM eCRM.DBA.SFA_NOTES as notes_table text literal notes_table.DESCRIPTION of (notes.DESCRIPTION)
+FROM eCRM.DBA.SFA_COMPETITORS_VIEW2 as competitors
+FROM eCRM.DBA.SFA_ISSUES_VIEW2 as issues
+FROM eCRM.DBA.SFA_CUSTOM_FIELD_DEFS_VIEW2 as custom_field_defs
+FROM eCRM.DBA.SFA_CUSTOM_FIELDS_VIEW2 as custom_fields
+FROM eCRM.DBA.SFA_CASES_VIEW2 as cases
+FROM eCRM.DBA.SFA_CASES as cases_table text literal cases_table.SUMMARY of (cases.SUMMARY)
+FROM eCRM.DBA.SFA_ORDERS_VIEW2 as orders
+FROM eCRM.DBA.SFA_ORDERS as orders_table text literal orders_table.EMAIL of (orders.EMAIL)
+FROM eCRM.DBA.SFA_ORDER_ITEMS_VIEW2 as order_items
+FROM eCRM.DBA.PM_CATEGORIES_VIEW2 as categories
+FROM eCRM.DBA.PM_PRODUCT_ATTRIBUTE_DEFS_VIEW2 as product_attribute_defs
+FROM eCRM.DBA.PM_PRODUCTS_VIEW2 as products
+FROM eCRM.DBA.PM_PRODUCTS as products_table text literal products_table.DESCRIPTION of (products.DESCRIPTION)
+FROM eCRM.DBA.PM_PRODUCT_ATTRIBUTES_VIEW2 as product_attributes
+FROM eCRM.DBA.PM_CATALOGS_VIEW2 as catalogs
+FROM eCRM.DBA.PM_CATALOG_PRODUCTS_VIEW2 as catalog_products
+FROM eCRM.DBA.XSYS_MODULES as modules
+FROM eCRM.DBA.XSYS_REGISTRY as registries
+FROM eCRM.DBA.XSYS_ORGANIZATIONS_DATA as organizations_data
+FROM eCRM.DBA.XSYS_MESSAGES as xsysmessages
+FROM eCRM.DBA.XSYS_COUNTRIES_VIEW2 as countries
+FROM eCRM.DBA.XSYS_PROVINCES_VIEW2 as provinces
+FROM eCRM.DBA.XSYS_TIMEZONES as timezones
+FROM eCRM.DBA.XSYS_MIME_TYPES as mimetypes
+FROM eCRM.DBA.XSYS_MIME_EXTENSIONS as mimeexts
+FROM eCRM.DBA.XSYS_CNAMES as cnames
+FROM eCRM.DBA.XSYS_QUOTAS as quotas
+FROM eCRM.DBA.XSYS_ROLES as roles
+FROM eCRM.DBA.XSYS_ACCOUNTS as accounts
+FROM eCRM.DBA.XSYS_USERDATA as userdatas
+FROM eCRM.DBA.XSYS_GROUPDATA as groupdatas
+FROM eCRM.DBA.XSYS_MEMBERS as members
+FROM eCRM.DBA.XSYS_SESSIONS_DATA as sessionsdatas
+FROM eCRM.DBA.XSYS_SESSION_DATA as sessiondatas
+FROM eCRM.DBA.XSYS_LIST_MEMBERS_DEFS as list_members_defs
+FROM eCRM.DBA.XSYS_CLASSES as classes
+FROM eCRM.DBA.XSYS_ORG_CLASSES as org_classes
+FROM eCRM.DBA.XSYS_CLASS_METHODS as class_methods
+FROM eCRM.DBA.XSYS_CLASS_VIEWS as class_views
+FROM eCRM.DBA.XSYS_ROLE_PRIVILEGES as role_priveleges
+FROM eCRM.DBA.XSYS_USER_PRIVILEGES as user_priveleges
+FROM eCRM.DBA.XSYS_HISTORY as history
+FROM eCRM.DBA.XSYS_USERS as xsys_users
+FROM eCRM.DBA.AP_PROCESSES_VIEW2 as ap_processes
+FROM eCRM.DBA.AP_RULES_VIEW2 as ap_rules
+FROM eCRM.DBA.AP_QUEUE as ap_queues
+WHERE (^{companies.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
+WHERE (^{contacts.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
+WHERE (^{leads.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
+WHERE (^{products.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
+WHERE (^{orders.}^.SHIP_COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
+WHERE (^{leads_table.}^.FREETEXT_ID = ^{leads.}^.FREETEXT_ID)
+WHERE (^{contacts_table.}^.FREETEXT_ID = ^{contacts.}^.FREETEXT_ID)
+WHERE (^{companies_table.}^.FREETEXT_ID = ^{companies.}^.FREETEXT_ID)
+WHERE (^{opportunities_table.}^.FREETEXT_ID = ^{opportunities.}^.FREETEXT_ID)
+WHERE (^{cases_table.}^.FREETEXT_ID = ^{cases.}^.FREETEXT_ID)
+WHERE (^{notes_table.}^.FREETEXT_ID = ^{notes.}^.FREETEXT_ID)
+WHERE (^{orders_table.}^.FREETEXT_ID = ^{orders.}^.FREETEXT_ID)
+WHERE (^{products_table.}^.FREETEXT_ID = ^{products.}^.FREETEXT_ID)
     {
-      x := cast (x as varchar);
-      dbg_obj_print (x);
+        create virtrdf:ecrmDemo1 as graph iri ("http://^{URIQADefaultHost}^/ecrm") option (order 1501)
       {
-	declare exit handler for sqlstate '*' {
-	  log_message (sprintf ('PTSW crawler can not load : %s', x));
-	};
-        sparql load ?:x into graph ?:x;
-	update DB.DBA.SYS_HTTP_SPONGE set HS_LOCAL_IRI = x, HS_EXPIRATION = null WHERE HS_LOCAL_IRI = 'destMD5=' || md5 (x) || '&graphMD5=' || md5 (x);
-	commit work;
-      }
-    }
-}
-;
-
-insert soft SYS_SCHEDULED_EVENT (SE_SQL, SE_START, SE_INTERVAL, SE_NAME)
-	values ('DB.DBA.PTSW_CRAWL ()', cast (stringtime ('0:0') as DATETIME), 60, 'PTSW Crawling');
-]]></programlisting>
-    </sect2>
-    <sect2 id="rdfinsertmethodsparqlqueryandsponger">
-      <title>Using SPARQL Query and Sponger (i.e. we Sponge the Resources in the FROM Clause or values for the graph-uri parameter in SPARQL protocol URLs)</title>
-      <para><emphasis>Example:</emphasis></para>
-      <para>Execute the following query: </para>
-<programlisting><![CDATA[
-SQL>SPARQL
-SELECT ?id
-FROM NAMED <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/sioc.ttl>
- OPTION (get:soft "soft", get:method "GET")
-WHERE { GRAPH ?g { ?id a ?o } }
-limit 10;
-]]></programlisting>
-      <para>As result will be shown the retrieved triples:</para>
-<programlisting><![CDATA[
-id
-VARCHAR
-_______________________________________________________________________________
-
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D
-http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/612
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/612
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/610
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/610
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/856
-http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/856
+            ecrm:Country (countries.COUNTRY_NAME)
+                a ecrm:Country
+                    as virtrdf:Country-Countrys2 ;
+                a geo:SpatialThing
+                    as virtrdf:Country-Countrys ;
+                owl:sameAs ecrm:dbpedia_iri (countries.COUNTRY_NAME) ;
+                ecrm:countryID countries.COUNTRY_ID
+                        as virtrdf:Country-COUNTRY_ID ;
+                ecrm:countryID3 countries.COUNTRY_ID3
+                        as virtrdf:Country-COUNTRY_ID3 ;
+                ecrm:isoCode countries.ISO_CODE
+                        as virtrdf:Country-ISO_CODE ;
+                ecrm:countryName countries.COUNTRY_NAME
+                        as virtrdf:Country-COUNTRY_NAME .
 
-10 Rows. -- 20 msec.
-]]></programlisting>
-    </sect2>
-    <sect2 id="rdfinsertmethodplapis">
-      <title>Using Virtuoso PL APIs</title>
-      <para><emphasis>Example:</emphasis></para>
-      <para>In the example script we implement a basic mapper which maps a text/plain mime type
-to an imaginary ontology, which extends the class Document from FOAF with properties 'txt:UniqueWords'
-and 'txt:Chars', where the prefix 'txt:' we specify as 'urn:txt:v0.0:'.</para>
-<programlisting><![CDATA[
-use DB;
+            ecrm:Country (countries.COUNTRY_NAME)
+                        ecrm:has_province
+            ecrm:Province (provinces.COUNTRY_ID, provinces.PROVINCE_NAME) where
+                        (^{provinces.}^.COUNTRY_ID = ^{countries.}^.COUNTRY_ID) as virtrdf:ecrmCountry-has_province .
 
-create procedure DB.DBA.RDF_LOAD_TXT_META
-	(
-	 in graph_iri varchar,
-	 in new_origin_uri varchar,
-	 in dest varchar,
-         inout ret_body any,
-	 inout aq any,
-	 inout ps any,
-	 inout ser_key any
-	 )
-{
-  declare words, chars int;
-  declare vtb, arr, subj, ses, str any;
-  declare ses any;
-  -- if any error we just say nothing can be done
-  declare exit handler for sqlstate '*'
-  {
-    return 0;
-  };
-  subj := coalesce (dest, new_origin_uri);
-  vtb := vt_batch ();
-  chars := length (ret_body);
-  -- using the text index procedures we get a list of words
-  vt_batch_feed (vtb, ret_body, 1);
-  arr := vt_batch_strings_array (vtb);
-  -- the list has 'word' and positions array , so we must divide by 2
-  words := length (arr) / 2;
-  ses := string_output ();
-  -- we compose a N3 literal
-  http (sprintf ('<%s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Document> .\n', subj), ses);
-  http (sprintf ('<%s> <urn:txt:v0.0:UniqueWords> "%d" .\n', subj, words), ses);
-  http (sprintf ('<%s> <urn:txt:v0.0:Chars> "%d" .\n', subj, chars), ses);
-  str := string_output_string (ses);
-  -- we push the N3 text into the local store
-  DB.DBA.TTLP (str, new_origin_uri, subj);
-  return 1;
-}
+...
+  } .
+} .
 ;
+SPARQL
+prefix ecrm: <http://demo.openlinksw.com/schemas/ecrm#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+prefix cal: <http://www.w3.org/2002/12/cal/ical#>
+prefix product: <http://www.swop-project.eu/ontologies/pmo/product.owl#>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+alter quad storage virtrdf:DefaultQuadStorage
+FROM eCRM.DBA.SFA_SALES_QUOTA_VIEW2 as sales_quotas
+FROM eCRM.DBA.SFA_COMPANIES_VIEW2 as companies
+FROM eCRM.DBA.SFA_COMPANIES as companies_table text literal companies_table.DESCRIPTION of (companies.DESCRIPTION)
+FROM eCRM.DBA.SFA_CONTACTS_VIEW2 as contacts
+FROM eCRM.DBA.SFA_CONTACTS as contacts_table text literal contacts_table.NAME_FIRST of (contacts.NAME_FIRST)
+FROM eCRM.DBA.SFA_EMPLOYMENTS_VIEW2 as employments
+FROM eCRM.DBA.SFA_LEADS_VIEW2 as leads
+FROM eCRM.DBA.SFA_LEADS as leads_table text literal leads_table.SUBJECT of (leads.SUBJECT)
+FROM eCRM.DBA.SFA_OPPORTUNITIES_VIEW2 as opportunities
+FROM eCRM.DBA.SFA_OPPORTUNITIES as opportunities_table text literal opportunities_table.OPPORTUNITY_NAME of (opportunities.OPPORTUNITY_NAME)
+FROM eCRM.DBA.SFA_ACTIVITIES as activities
+FROM eCRM.DBA.SFA_MAIL_MESSAGES as messages
+FROM eCRM.DBA.SFA_DOCUMENTS_VIEW2 as documents
+FROM eCRM.DBA.SFA_INFLUENCERS_VIEW2 as influencers
+FROM eCRM.DBA.SFA_TEAMS_VIEW2 as teams
+FROM eCRM.DBA.SFA_NOTES_VIEW2 as notes
+FROM eCRM.DBA.SFA_NOTES as notes_table text literal notes_table.DESCRIPTION of (notes.DESCRIPTION)
+FROM eCRM.DBA.SFA_COMPETITORS_VIEW2 as competitors
+FROM eCRM.DBA.SFA_ISSUES_VIEW2 as issues
+FROM eCRM.DBA.SFA_CUSTOM_FIELD_DEFS_VIEW2 as custom_field_defs
+FROM eCRM.DBA.SFA_CUSTOM_FIELDS_VIEW2 as custom_fields
+FROM eCRM.DBA.SFA_CASES_VIEW2 as cases
+FROM eCRM.DBA.SFA_CASES as cases_table text literal cases_table.SUMMARY of (cases.SUMMARY)
+FROM eCRM.DBA.SFA_ORDERS_VIEW2 as orders
+FROM eCRM.DBA.SFA_ORDERS as orders_table text literal orders_table.EMAIL of (orders.EMAIL)
+FROM eCRM.DBA.SFA_ORDER_ITEMS_VIEW2 as order_items
+FROM eCRM.DBA.PM_CATEGORIES_VIEW2 as categories
+FROM eCRM.DBA.PM_PRODUCT_ATTRIBUTE_DEFS_VIEW2 as product_attribute_defs
+FROM eCRM.DBA.PM_PRODUCTS_VIEW2 as products
+FROM eCRM.DBA.PM_PRODUCTS as products_table text literal products_table.DESCRIPTION of (products.DESCRIPTION)
+FROM eCRM.DBA.PM_PRODUCT_ATTRIBUTES_VIEW2 as product_attributes
+FROM eCRM.DBA.PM_CATALOGS_VIEW2 as catalogs
+FROM eCRM.DBA.PM_CATALOG_PRODUCTS_VIEW2 as catalog_products
+FROM eCRM.DBA.XSYS_MODULES as modules
+FROM eCRM.DBA.XSYS_REGISTRY as registries
+FROM eCRM.DBA.XSYS_ORGANIZATIONS_DATA as organizations_data
+FROM eCRM.DBA.XSYS_MESSAGES as xsysmessages
+FROM eCRM.DBA.XSYS_COUNTRIES_VIEW2 as countries
+FROM eCRM.DBA.XSYS_PROVINCES_VIEW2 as provinces
+FROM eCRM.DBA.XSYS_TIMEZONES as timezones
+FROM eCRM.DBA.XSYS_MIME_TYPES as mimetypes
+FROM eCRM.DBA.XSYS_MIME_EXTENSIONS as mimeexts
+FROM eCRM.DBA.XSYS_CNAMES as cnames
+FROM eCRM.DBA.XSYS_QUOTAS as quotas
+FROM eCRM.DBA.XSYS_ROLES as roles
+FROM eCRM.DBA.XSYS_ACCOUNTS as accounts
+FROM eCRM.DBA.XSYS_USERDATA as userdatas
+FROM eCRM.DBA.XSYS_GROUPDATA as groupdatas
+FROM eCRM.DBA.XSYS_MEMBERS as members
+FROM eCRM.DBA.XSYS_SESSIONS_DATA as sessionsdatas
+FROM eCRM.DBA.XSYS_SESSION_DATA as sessiondatas
+FROM eCRM.DBA.XSYS_LIST_MEMBERS_DEFS as list_members_defs
+FROM eCRM.DBA.XSYS_CLASSES as classes
+FROM eCRM.DBA.XSYS_ORG_CLASSES as org_classes
+FROM eCRM.DBA.XSYS_CLASS_METHODS as class_methods
+FROM eCRM.DBA.XSYS_CLASS_VIEWS as class_views
+FROM eCRM.DBA.XSYS_ROLE_PRIVILEGES as role_priveleges
+FROM eCRM.DBA.XSYS_USER_PRIVILEGES as user_priveleges
+FROM eCRM.DBA.XSYS_HISTORY as history
+FROM eCRM.DBA.XSYS_USERS as xsys_users
+FROM eCRM.DBA.AP_PROCESSES_VIEW2 as ap_processes
+FROM eCRM.DBA.AP_RULES_VIEW2 as ap_rules
+FROM eCRM.DBA.AP_QUEUE as ap_queues
+WHERE (^{companies.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
+WHERE (^{contacts.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
+WHERE (^{leads.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
+WHERE (^{products.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
+WHERE (^{orders.}^.SHIP_COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
+WHERE (^{leads_table.}^.FREETEXT_ID = ^{leads.}^.FREETEXT_ID)
+WHERE (^{contacts_table.}^.FREETEXT_ID = ^{contacts.}^.FREETEXT_ID)
+WHERE (^{companies_table.}^.FREETEXT_ID = ^{companies.}^.FREETEXT_ID)
+WHERE (^{opportunities_table.}^.FREETEXT_ID = ^{opportunities.}^.FREETEXT_ID)
+WHERE (^{cases_table.}^.FREETEXT_ID = ^{cases.}^.FREETEXT_ID)
+WHERE (^{notes_table.}^.FREETEXT_ID = ^{notes.}^.FREETEXT_ID)
+WHERE (^{orders_table.}^.FREETEXT_ID = ^{orders.}^.FREETEXT_ID)
+WHERE (^{products_table.}^.FREETEXT_ID = ^{products.}^.FREETEXT_ID)
+{
+        create virtrdf:ecrmDemo2 as graph iri ("http://^{URIQADefaultHost}^/ecrm") option (exclusive, order 1502)
+  {
+            ecrm:Order (orders.ORG_ID, orders.ORDER_ID)
+                a ecrm:Order
+                    as virtrdf:Order-Orders ;
+                ecrm:has_ecrm_organization ecrm:OrganizationsData(orders.ORG_ID, organizations_data.DNS_ZONE) where (^{orders.}^.ORG_ID = ^{organizations_data.}^.ORG_ID)
+                        as virtrdf:Order-ORG_ID ;
+                ecrm:owner ecrm:XSys_User(orders.ORG_ID, xsys_users.ACCOUNT_NAME, orders.OWNER_ID)
+                        where (^{orders.}^.OWNER_ID = ^{xsys_users.}^.ACCOUNT_ID and ^{orders.}^.ORG_ID = ^{xsys_users.}^.ORG_ID)
+                        as virtrdf:Order-OWNER_ID ;
+                ecrm:FREETEXT_ID orders.FREETEXT_ID
+                        as virtrdf:Order-FREETEXT_ID ;
+                ecrm:has_company ecrm:Company(orders.COMPANY_NAME, orders.COMPANY_ID, orders.ORG_ID)
+                        as virtrdf:Order-COMPANY_ID ;
+                ecrm:companyName orders.COMPANY_NAME
+                        as virtrdf:Order-COMPANY_NAME ;
+                ecrm:has_contact ecrm:Contact(contacts.NAME_FIRST, contacts.NAME_MIDDLE, contacts.NAME_LAST, orders.CONTACT_ID, orders.ORG_ID)
+                        where (^{orders.}^.CONTACT_ID = ^{contacts.}^.CONTACT_ID and ^{orders.}^.ORG_ID = ^{contacts.}^.ORG_ID)
+                        as virtrdf:Order-CONTACT_ID ;
+                ecrm:contactName orders.CONTACT_NAME
+                        as virtrdf:Order-CONTACT_NAME ;
+                ecrm:orderNo orders.ORDER_NO
+                        as virtrdf:Order-ORDER_NO ;
+                ecrm:shipFirstName orders.SHIP_FNAME
+                        as virtrdf:Order-SHIP_FNAME ;
+                ecrm:shipSecondName orders.SHIP_SNAME
+                        as virtrdf:Order-SHIP_SNAME ;
+                ecrm:phoneNumber orders.PHONE_NUMBER
+                        as virtrdf:Order-PHONE_NUMBER ;
+                ecrm:phoneExtension orders.PHONE_EXTENSION
+                        as virtrdf:Order-PHONE_EXTENSION ;
+                ecrm:email orders.EMAIL
+                        as virtrdf:Order-EMAIL ;
+                ecrm:shipCountry ecrm:Country(orders.SHIP_COUNTRY_NAME)
+                        as virtrdf:Order-SHIP_COUNTRY_NAME ;
+                ecrm:shipCountryCode ecrm:Country (countries.COUNTRY_NAME) where  (^{countries.}^.COUNTRY_NAME = ^{orders.}^.SHIP_COUNTRY_NAME)
+                        as virtrdf:Order-SHIP_COUNTRY_CODE ;
+                ecrm:shipProvince orders.SHIP_PROVINCE
+                        as virtrdf:Order-SHIP_PROVINCE ;
+                ecrm:shipCity orders.SHIP_CITY
+                        as virtrdf:Order-SHIP_CITY ;
+                ecrm:dbpedia_shipCity ecrm:dbpedia_iri (orders.SHIP_CITY)
+                        as virtrdf:Order-SHIP_dbpedia_CITY ;
+                ecrm:shipPostalCode orders.SHIP_POSTAL_CODE
+                        as virtrdf:Order-SHIP_POSTAL_CODE ;
+                ecrm:shipAddress1 orders.SHIP_ADDRESS1
+                        as virtrdf:Order-SHIP_ADDRESS1 ;
+                ecrm:shipAddress2 orders.SHIP_ADDRESS2
+                        as virtrdf:Order-SHIP_ADDRESS2 ;
+                ecrm:salesRep orders.SALESREP
+                        as virtrdf:Order-SALESREP ;
+                ecrm:orderDate orders.ORDER_DATE
+                        as virtrdf:Order-ORDER_DATE ;
+                ecrm:orderValue orders.ORDER_VALUE
+                        as virtrdf:Order-ORDER_VALUE ;
+                ecrm:refund orders.REFUND
+                        as virtrdf:Order-REFUND ;
+                ecrm:year orders.YEAR
+                        as virtrdf:Order-YEAR ;
+                ecrm:month orders.MONTH
+                        as virtrdf:Order-MONTH ;
+                ecrm:quarter orders.QUARTER
+                        as virtrdf:Order-QUARTER ;
+                ecrm:financialYear orders.FINANCIAL_YEAR
+                        as virtrdf:Order-FINANCIAL_YEAR ;
+                ecrm:CONTACT_REL_ID orders.CONTACT_REL_ID
+                        as virtrdf:Order-CONTACT_REL_ID ;
+                ecrm:COMPANY_REL_ID orders.COMPANY_REL_ID
+                        as virtrdf:Order-COMPANY_REL_ID .
 
---
-DELETE FROM DB.DBA.SYS_RDF_MAPPERS WHERE RM_HOOK = 'DB.DBA.RDF_LOAD_TXT_META';
-
-INSERT SOFT DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
-    VALUES ('(text/plain)', 'MIME', 'DB.DBA.RDF_LOAD_TXT_META', null, 'Text Files (demo)');
+...
+        } .
+} .
+;
 
--- here we set order to some large number so don't break existing mappers
-update DB.DBA.SYS_RDF_MAPPERS set RM_ID = 2000 WHERE RM_HOOK = 'DB.DBA.RDF_LOAD_TXT_META';
-]]></programlisting>
-      <para>To test the mapper we just use /sparql endpoint with option 'Retrieve remote
-RDF data for all missing source graphs' to execute:</para>
-<programlisting><![CDATA[
-SELECT * FROM <http://demo.openlinksw.com:8890/tutorial/hosting/ho_s_30/WebCalendar/tools/summary.txt>
-WHERE { ?s ?p ?o }
-]]></programlisting>
-      <para>To check the results:</para>
-      <itemizedlist>
-        <listitem>Make sure the initial state of tutorial <ulink url="http://demo.openlinksw.com/tutorial/rdf/rd_s_1/rd_s_1.vsp">RD_S_1</ulink> is set.</listitem>
-        <listitem>Go to http://demo.openlinksw.com/sparql</listitem>
-        <listitem>Enter for Default Graph URI this value:</listitem>
-<programlisting><![CDATA[
-http://localhost:80/tutorial/hosting/ho_s_30/WebCalendar/tools/summary.txt
-]]></programlisting>
-        <listitem>Enter for Query text:</listitem>
-<programlisting><![CDATA[
-SELECT *
-WHERE {?s ?p ?o}
 ]]></programlisting>
-        <listitem>Click the "Run Query" button.</listitem>
-        <listitem>As result should be shown the following triples:</listitem>
+</sect2>
+<sect2 id="rdfviewsrcur"><title>RDF views and recursive FK relationships</title>
+  <para>Here is sample example of a script to include an additional table alias for a table:</para>
 <programlisting><![CDATA[
-s  	                                                                    p  	                                            o
-http://localhost:80/tutorial/hosting/ho_s_30/WebCalendar/tools/summary.txt  http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://xmlns.com/foaf/0.1/Document
-http://localhost:80/tutorial/hosting/ho_s_30/WebCalendar/tools/summary.txt  urn:txt:v0.0:UniqueWords 	                    47
-http://localhost:80/tutorial/hosting/ho_s_30/WebCalendar/tools/summary.txt  urn:txt:v0.0:Chars 	                            625
+alter quad storage virtrdf:DefaultQuadStorage
+  :
+  FROM isports_rdf.prs10_isports_rdf.VRef_Call      as Ref_Call_tbl
+  FROM isports_rdf.prs10_isports_rdf.VRef_Call      as Ref_Call_tbl_1
+  :
+{
+  :
+  refcall:ref-call_iri (Ref_Call_tbl.Call_Num) a refcall:Ref-Call as
+virtrdf:ref-call_pk ;
+  :
+  refcall:has_parent  refcall:ref-call_iri (Ref_Call_tbl_1.Call_Num)
+where  ( ^{Ref_Call_tbl.}^.Parent    = ^{Ref_Call_tbl_1.}^.Call_Num )   as
+virtrdf:Ref-Call_has_parent .
 ]]></programlisting>
-    </itemizedlist>
-      <para><emphasis>Important: Setting Sponger Permissions</emphasis></para>
-      <para>In order to allow the Sponger to update the local RDF quad store with triples
-constituting the sponged structured data, the role "SPARQL_SPONGE" must be granted to the
-account "SPARQL", i.e., to the owner account of /sparql web service endpoint.
-This should normally be the case. If not, you must manually grant this
-permission. As with most Virtuoso DBA tasks, the Conductor provides the simplest means of
-doing this.</para>
-  <tip><title>See Also:</title>
-    <itemizedlist mark="bullet">
-      <listitem>The <link linkend="fn_rdf_load_rdfxml">DB.DBA.RDF_LOAD_RDFXML</link> function to
-parse the content of RDF/XML text.</listitem>
-      <listitem>The <link linkend="fn_ttlp_mt">DB.DBA.TTLP_MT</link> function to
-parse TTL (TURTLE or N3 resource).</listitem>
-      <listitem>The <link linkend="fn_gz_file_open">gz_file_open</link> function to
-retrieve content of a gzipped file and example for loading gzipped N3 and Turtle files.</listitem>
-    </itemizedlist>
-  </tip>
-    </sect2>
-    <sect2 id="rdfinsertmethodsimilerdfbankapi">
-      <title>Using SIMILE RDF Bank API</title>
-      <para>Virtuoso implements the HTTP-based Semantic Bank API that enables client
-applications to post to its RDF Triple Store. This method offers an alternative to
-using Virtuoso/PL functions or WebDAV uploads as the triples-insertion mechanism.</para>
-      <para><emphasis>Example:</emphasis></para>
-      <para>From your machine go to Firefox->Tools->PiggyBank->My Semantic Bank Accounts</para>
-      <para>Add in the shown form:</para>
-      <itemizedlist>
-        <listitem>For bank: address: http://demo.openlinksw.com/bank</listitem>
-        <listitem>For account id: demo</listitem>
-        <listitem>For password: demo</listitem>
-      </itemizedlist>
-      <para>Go to http://demo.openlinksw.com/ods</para>
-      <para>Log in as user demo, password: demo</para>
-      <para>Go to the Weblog tab from the main ODS Navigation</para>
-      <para>Click on weblog instance name, for ex. "demo's Weblog".</para>
-      <para>When the weblog home page is loaded, click Alt + P.</para>
-      <para>As result is shown the "My PiggyBank" page with all the collected information
-presented in items.</para>
-      <para>For several of the items add Tags from the form "Tag" shown for each of them.</para>
-      <para>As result should be shown the message "Last updated: [here goes the date value].</para>
-      <para>You can also click "Save" and "Publish" for these items.</para>
-      <para>Go to http://demo.openlinksw.com/sparql</para>
-      <para>Enter for the "Default Graph URI" field: http://simile.org/piggybank/demo</para>
-      <para>Enter for the "Query text" text-area:</para>
-<programlisting><![CDATA[
-prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-SELECT *
-FROM <http://simile.org/piggybank/demo>
-WHERE {?s ?p  ?o}
-]]></programlisting>
-      <para>Click "Run Query".</para>
-      <para>As results are shown the found results.</para>
-    </sect2>
-    <sect2 id="rdfinsertmethodrdfnet">
-      <title>Using RDF NET</title>
-      <para><emphasis>Example:</emphasis></para>
-      <para>Execute the following query:</para>
-<programlisting><![CDATA[
-SQL> SELECT DB.DBA.HTTP_RDF_NET ('sparql load
-"http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com"
-into graph <http://www.openlinksw.com/>');
-]]></programlisting>
-      <para>As result should be shown:</para>
-<programlisting><![CDATA[
-callret
-VARCHAR
-_______________________________________________________
-
-<?xml version="1.0" ?>
-<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"
-xmlns="http://example.org/book/" xmlns:dc="http://purl.org/dc/elements/1.1/"
-xmlns:ns="http://example.org/ns#">
-<rdf:Description>
-<callret-0>Load <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com>
-into graph <http://www.openlinksw.com/> -- done</callret-0>
-</rdf:Description>
-</rdf:RDF>
-
-1 Rows. -- 1982 msec.
-]]></programlisting>
-    </sect2>
-    <sect2 id="rdfinsertmethodproxy">
-      <title>Using the RDF Proxy (Sponger) Service</title>
-    <para>Triples can be inserted also using the Sponger Proxy URI Service. For more information and examples see <link linkend="rdfproxyservice">here</link>.</para>
+  <para>This demonstrates the way to self-join the table VRef_Call with itself. Like in SQL,
+are needed two different aliases for one table if you want to join it with itself.
+  </para>
     </sect2>
 </sect1>
-
-
-<sect1 id="rdfsparqlintegrationmiddleware"><title>Integration Middleware</title>
-  <sect2 id="virtuososponger"><title>RDFizer Middleware (Sponger)</title>
-    <sect3 id="virtuosospongerintro"><title>Introduction</title>
-<para>The Virtuoso Sponger is a middleware component of Virtuoso that generates RDF Linked Data 
-from a variety of data sources. The sponger is transparently integrated into Virtuoso's SPARQL Query 
-Processor, where it delivers URI de-referencing functionality and data caching services. Optionally, 
-it can be used by the <link linkend="importtargets">Virtuoso Content Crawler</link> to periodically 
-build and replenish local RDF graphs.
-</para>
-<para>The sponger is a fully fledged HTTP proxy service that is also directly accessible via SOAP or 
-REST interfaces.</para>
-<figure id="virtuosospongerdiagram" float="1">
-		<title>Virtuoso Sponger</title>
-		<graphic fileref="linked_data_gen_opts3.png"/>
-        </figure>
-<para>
-A majority of the worlds data naturally resides in non RDF form at the current time. The Sponger
-delivers middleware that accelerates the bootstrap of the Semantic Data Web by generating RDF
-from non RDF data sources, unobtrusively.
+<sect1 id="rdfrdfviewgnr"><title>Automated Generation of RDF Views over Relational Data Sources</title>
+<sect2 id="rdfrdfviewgnrintro"><title>Introduction</title>
+<para>Virtuoso offers from Conductor UI an HTML based Wizard interface for dynamically generating &
+publishing RDF based Linked Data from ODBC or JDBC accessible relational data sources. Basically,
+a mechanism for building RDF based Linked Data views over relational data sources.
 </para>
-<para>
-When an RDF aware client requests data from a network accessible resource via the Sponger
-the following events occur:
+<para>The proliferation of relational databases across enterprises and behind Web sites, makes them a
+vital data source for the burgeoning Linked Data Web. Thus, the process of publishing Linked Data from
+these sources needs to be as unobtrusive as possible. Naturally, a balance has to be struck between
+unobtrusive generation of Linked Data and traditional relational database management system (RDBMS)
+virtues such as:
 </para>
-<itemizedlist>
-<listitem>A requests in made for data in RDF form, and if RDF is returned nothing further happens</listitem>
-<listitem>If RDF isn't returned, then the Sponger passes the data through a Metadata Extraction
-Pipeline process (using Metadata Extractors)</listitem>
-<listitem>The extracted data is transformed to RDF via a Mapping Pipeline process (RDF is extracted by way
-of Ontology matching and mapping) that results in RDF Entities (instance data) generation</listitem>
-<listitem>RDF Entities are returned to the client</listitem>
+<itemizedlist mark="bullet">
+  <listitem>Scalability</listitem>
+  <listitem>Security</listitem>
+  <listitem>Analytical Expressivity of SQL</listitem>
+  <listitem>Separation of Data Access and Data Storage via ODBC, JDBC, ADO.NET CLIs.</listitem>
 </itemizedlist>
-<para>The imported data forms a local cache and its invalidation rules conform to those of traditional
-HTTP clients (Web Browsers). Thus, expiration time is determined based on subsequent data fetches of
-the same resource (note: the first data load will record the 'expires' header) with current time
-compared to expiration time stored in the local cache. If HTTP 'expires' header data isn't returned
-by the source data server, then the "Sponger" will derive it's own invalidation time frame by
-evaluating the 'date' header and 'last-modified' HTTP headers. Irrespective of path taken,
-local cache invalidation is driven by an assessment of current time relative to recorded expiration time.
-</para>
-<para>Designed with a pluggable architecture, the Sponger's core functionality is provided by Cartridges.
-Each cartridge includes Data Extractors which extract data from one or more data sources, and Ontology
-Mappers which map the extracted data to one or more ontologies/schemas, and route to producing RDF
-Linked Data.
-</para>
-<para>The Schema Mappers are typically XSLT (e.g. GRDDL and other OpenLink Mapping Schemes) or
-Virtuoso PL based. The Metadata Extractors may be developed in Virtuoso PL, C/C++, Java, or any
-other language that can be integrated into the Virtuoso via it's server extensions APIs.
+<para>The following steps must be taken to publish RDF-based Linked Data:
 </para>
+<orderedlist>
+  <listitem>Identifying ODBC or JDBC data sources that host the data you seek to publish
+(assuming the data isn't Virtuoso RDBMS hosted -- in which case, skip ahead to step #3).</listitem>
+  <listitem>Attach/Link TABLEs or VIEWs from the external data sources into Virtuoso via their Data Source Names (DSNs).</listitem>
+  <listitem>Identify the internal or external TABLEs or VIEWs that hold the data you wish to publish.</listitem>
+  <listitem>Configure Endpoints and Re-write Rules to disambiguate data object (resource) identity and description through HTTP-based content negotiation.</listitem>
+  <listitem>Expose the Data Source Ontology and associated Instance Data in Linked Data form through those Endpoints and Re-write Rules.</listitem>
+</orderedlist>
 <para>
-The Sponger also includes a pluggable name resolution mechanism that enables the development of
-Custom Resolvers for naming schemes (e.g. URNs) associated with protocols beyond HTTP.
-Examples of custom resolvers include:
+These steps may be largely automated (the "One-Click" Deployment below), or performed manually ("Using the Conductor's HTML-based Wizard" further down).
+</para>
+</sect2>
+<sect2 id="rdfrdfviewgnroneclick"><title>One Click Linked Data Generation & Deployment</title>
+<para>The following steps provide a one-click guide for publishing ODBC- or JDBC-accessible RDBMS data in RDF Linked Data form, using the "Generate & Publish" Conductor feature.
 </para>
-<itemizedlist>
-<listitem>LSID</listitem>
-<listitem>DOI</listitem>
-</itemizedlist>
-
-    <para><emphasis>How is it used?</emphasis></para>
-    <para>The Sponger can be invoked via the following mechanisms:</para>
     <orderedlist>
-      <listitem>Virtuoso SPARQL query processor</listitem>
-      <listitem>OpenLink RDF client applications via the Virtuoso RDF Proxy Service</listitem>
-      <listitem>From Virtuoso PL, by calling the cartridge hook function directly</listitem>
-      <listitem>ODS-Briefcase (Virtuoso WebDAV) - a component of the OpenLink Data Spaces distributed collaborative application platform</listitem>
+  <listitem>Go to http://<cname>:port/conductor</listitem>
+  <listitem>Log in as user dba (or another user with DBA privileges)</listitem>
+  <listitem>Follow menu path Database -> RDF Views
+    <figure id="rd1" float="1">
+      <title>RDF Views</title>
+      <graphic fileref="ui/rd1.png"/>
+    </figure>
+</listitem>
+  <listitem>In the form presented, perform the following steps:
+<orderedlist>
+  <listitem>Select the Database Name Qualifier (e.g., "Demo")
+that exposes the Tables / Views for this exercise </listitem>
+  <listitem>Enter the Base URL to which your URL rewrite rules will be bound
+(e.g. http://<cname>:8890/Demo)</listitem>
+  <listitem>Select specific Tables containing the data to be published (e.g. Demo.demo.Shippers and Demo.demo.Suppliers)</listitem>
+  <listitem>Click the "Generate & Publish" button</listitem>
     </orderedlist>
-    <para>File metadata extraction by ODS-Briefcase details you can find at the <ulink url="http://virtuoso.openlinksw.com/Whitepapers/pdf/sponger_whitepaper_10102007.pdf">Virtuoso Sponger whitepaper</ulink>.</para>
-    <para><emphasis>SPARQL Query Processor IRI Dereferencing</emphasis></para>
-    <para>The Sponger is transparently integrated into the Virtuoso SPARQL query processor, where it supports
-IRI dereferencing.</para>
-    <para>Given the distributed nature of RDF data, it is quite possible when executing a SPARQL query that
-some of the referenced data resides outside the local quad store. To cope with this scenario, the Virtuoso
-SPARQL query processor can be instructed to retrieve the external data and cache it in local quad storage.
-This feature is exposed through a set of Virtuoso SPARQL extensions known as "IRI dereferencing".
-Essentially these enable downloading and local storage of selected triples either from one or more
-named graphs or based on a proximity search from a starting URI for entities matching the select
-criteria and also related by the specified predicates, up to a given depth. Because the SPARQL
-processor understands only RDF data (serialized as RDF/XML, Turtle, N3), it utilizes the Sponger
-RDF mapper functionality when dereferencing web or file resources which don't naturally contain RDF data.</para>
-    <para><emphasis>RDF Proxy Service</emphasis></para>
-    <para>The Sponger's functionality is also exposed via an in-built REST style Web service. This web
-service takes a target URL and either returns the content "as is" or tries to transform (by sponging)
-to RDF. Thus, the proxy service can be used as a 'pipe' for RDF browsers to browse non-RDF sources.</para>
-    <para>When the rdf_mappers package is installed, Virtuoso reserves the path '/about/[id|data|rdf|html]/http/' for
-Sponger Proxy URI Service. For example, if a Virtuoso installation on host example.com listens for HTTP
-requests on port 8080 then client applications should use a 'service endpoint' string equal to
-'http://example.com:8080/about/[id|data|rdf|html]/http/'. If the rdf_mappers package is not installed, then
-the service uses the path '/proxy/rdf/'.</para>
-    <para>Note: The old Sponger Proxy URI Service pattern '/proxy/' is now deprecated.</para>
-    <para><emphasis>Example:</emphasis></para>
-    <para>The following URLs return information about musician John Cale, gleaned from the MusicBrainz
-music metadatabase, rendered as RDF or HTML respectively. (The sponged data is available in the HTML
-rendering through the foaf:primaryTopic property.)</para>
-    <itemizedlist mark="bullet">
-      <listitem>http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/artist/72c090b6-a68e-4cb9-b330-85278681a714.html</listitem>
-      <listitem>http://demo.openlinksw.com/about/html/http/musicbrainz.org/artist/72c090b6-a68e-4cb9-b330-85278681a714.html</listitem>
-    </itemizedlist>
-
-<sect4 id="virtuosospongercartridwh"><title>What is a Cartridge?</title>
-<para>The Sponger is comprised of cartridges which are themselves comprised of an entity extractor
-and an ontology mapper. Entities extracted from non-RDF resources are used as the basis for generating
-structured data by mapping them to a suitable ontology. A cartridge is invoked through its cartridge
-hook, a Virtuoso/PL procedure entry point and binding to the cartridge's entity extractor and
-ontology mapper.</para>
-</sect4>
-<sect4 id="virtuosospongercartridges"><title>Supported Non RDF Data Sources</title>
-  <itemizedlist>
-    <listitem>Standard Formats
-<para>These Cartridges handle open formats: <emphasis>typically community-developed,
-openly-documented, and freely-licensed data structures.</emphasis></para>
-<table>
-<tgroup cols="4">
-<thead>
-  <row>
-    <entry>Cartridge</entry><entry>Sample URI</entry><entry>Resource Description</entry><entry>Linked Data Graph</entry>
-  </row>
-</thead>
-<tbody>
-<row><entry>AB Meta  	</entry><entry>   <ulink url="http://abmeta.org/album2.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/abmeta.org/album2.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://abmeta.org/album2.html">Data Explorer View</ulink> </entry></row>
-<row><entry>APML  	</entry><entry>   <ulink url="https://apml.engagd.com/apml/danielabarbosa.myopenid.com.apml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/https://apml.engagd.com/apml/danielabarbosa.myopenid.com.apml">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=https://apml.engagd.com/apml/danielabarbosa.myopenid.com.apml">Data Explorer View</ulink> </entry></row>
-<row><entry>ATOM 	</entry><entry>   <ulink url="http://www.openlinksw.com/blog/~kidehen/gems/atom.xml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.openlinksw.com/blog/~kidehen/gems/atom.xml">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.openlinksw.com/blog/~kidehen/gems/atom.xml">Data Explorer View</ulink> </entry></row>
-<row><entry>DC       	</entry><entry>   <ulink url="http://dublincore.org/2008/01/14/dcterms.rdf">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/dublincore.org/2008/01/14/dcterms.rdf">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://dublincore.org/2008/01/14/dcterms.rdf">Data Explorer View</ulink> </entry></row>
-<row><entry>eRDF 	</entry><entry>   <ulink url="http://www.w3.org/2001/sw/grddl-wg/doc29/hotel-data.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.w3.org/2001/sw/grddl-wg/doc29/hotel-data.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.w3.org/2001/sw/grddl-wg/doc29/hotel-data.html">Data Explorer View</ulink> </entry></row>
-<row><entry>GRDDL 	</entry><entry>   <ulink url="http://www.w3.org/2001/sw/grddl-wg/doc29/hotel-data.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.w3.org/2001/sw/grddl-wg/doc29/hotel-data.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.w3.org/2001/sw/grddl-wg/doc29/hotel-data.html">Data Explorer View</ulink> </entry></row>
-<row><entry>hAudio 	</entry><entry>   <ulink url="http://openmediaweb.org/index.php/2008/01/13/publishing-my-workout-music-in-haudio/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/openmediaweb.org/index.php/2008/01/13/publishing-my-workout-music-in-haudio/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://openmediaweb.org/index.php/2008/01/13/publishing-my-workout-music-in-haudio/">Data Explorer View</ulink> </entry></row>
-<row><entry>hCalendar   </entry><entry>   <ulink url="http://www.maine.gov/portal/government/calendar.shtml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.maine.gov/portal/government/calendar.shtml">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.maine.gov/portal/government/calendar.shtml">Data Explorer View</ulink> </entry></row>
-<row><entry>hCard 	</entry><entry>   <ulink url="http://www.lawyer-directory.net/lawyer/Grand-Rapids-Bar-Association-Grand-Rapids-law434032.htm">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.lawyer-directory.net/lawyer/Grand-Rapids-Bar-Association-Grand-Rapids-law434032.htm">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.lawyer-directory.net/lawyer/Grand-Rapids-Bar-Association-Grand-Rapids-law434032.htm">Data Explorer View</ulink> </entry></row>
-<row><entry>hListing 	</entry><entry>   <ulink url="http://sfbay.craigslist.org/nby/apa/1280124800.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/sfbay.craigslist.org/nby/apa/1280124800.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://sfbay.craigslist.org/nby/apa/1280124800.html">Data Explorer View</ulink> </entry></row>
-<row><entry>hProduct 	</entry><entry>   <ulink url="http://www.bestbuy.com/shop/cartman">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.bestbuy.com/shop/cartman">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.bestbuy.com/shop/cartman">Data Explorer View</ulink> </entry></row>
-<row><entry>HR-XML 	</entry><entry>   <ulink url="http://ns.hr-xml.org/2_5/HR-XML-2_5/SEP/ResumeExample.xml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/ns.hr-xml.org/2_5/HR-XML-2_5/SEP/ResumeExample.xml">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://ns.hr-xml.org/2_5/HR-XML-2_5/SEP/ResumeExample.xml">Data Explorer View</ulink> </entry></row>
-<row><entry>hResume 	</entry><entry>   <ulink url="http://brad.hawidu.com/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/brad.hawidu.com/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://brad.hawidu.com/">Data Explorer View</ulink> </entry></row>
-<row><entry>hReview     </entry><entry>   <ulink url="http://www.concertbuzz.net/genres/classic-rock/jethro-tull.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.concertbuzz.net/genres/classic-rock/jethro-tull.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.concertbuzz.net/genres/classic-rock/jethro-tull.html">Data Explorer View</ulink> </entry></row>
-<row><entry>iCalendar   </entry><entry>   <ulink url="http://kidehen.idehen.net/DAV/home/kidehen/Public/LDP-Spring2008.ics">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/kidehen.idehen.net/DAV/home/kidehen/Public/LDP-Spring2008.ics">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://kidehen.idehen.net/DAV/home/kidehen/Public/LDP-Spring2008.ics">Data Explorer View</ulink> </entry></row>
-<row><entry>Images 	</entry><entry>   <ulink url="http://farm4.static.flickr.com/3067/2590298570_304a594899_t.jpg">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/farm4.static.flickr.com/3067/2590298570_304a594899_t.jpg">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://farm4.static.flickr.com/3067/2590298570_304a594899_t.jpg">Data Explorer View</ulink> </entry></row>
-<row><entry>OO document </entry><entry>   <ulink url="http://www.pitonyak.org/AndrewMacro.odt">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.pitonyak.org/AndrewMacro.odt">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.pitonyak.org/AndrewMacro.odt">Data Explorer View</ulink> </entry></row>
-<row><entry>OPML 	</entry><entry>   <ulink url="http://news.bbc.co.uk/rss/feeds.opml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/news.bbc.co.uk/rss/feeds.opml">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://news.bbc.co.uk/rss/feeds.opml">Data Explorer View</ulink> </entry></row>
-<row><entry>PPTX 	</entry><entry>   <ulink url="http://download.microsoft.com/download/4/D/E/4DE0D83D-7845-4FD1-9A8E-12F532EC81BC/Keynote.pptx">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/download.microsoft.com/download/4/D/E/4DE0D83D-7845-4FD1-9A8E-12F532EC81BC/Keynote.pptx">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://download.microsoft.com/download/4/D/E/4DE0D83D-7845-4FD1-9A8E-12F532EC81BC/Keynote.pptx">Data Explorer View</ulink> </entry></row>
-<row><entry>RDFa 	</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/presentations/Creating_Deploying_Exploiting_Linked_Data2/Creating_Deploying_Exploiting_Linked_Data2_TimBL_v3.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/virtuoso.openlinksw.com/presentations/Creating_Deploying_Exploiting_Linked_Data2/Creating_Deploying_Exploiting_Linked_Data2_TimBL_v3.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://virtuoso.openlinksw.com/presentations/Creating_Deploying_Exploiting_Linked_Data2/Creating_Deploying_Exploiting_Linked_Data2_TimBL_v3.html">Data Explorer View</ulink> </entry></row>
-<row><entry>RSS 	</entry><entry>   <ulink url="http://microformats.org/feed/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/microformats.org/feed/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://microformats.org/feed/">Data Explorer View</ulink> </entry></row>
-<row><entry>Slidy 	</entry><entry>   <ulink url="http://slideshow.rubyforge.org/microformats.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/slideshow.rubyforge.org/microformats.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://slideshow.rubyforge.org/microformats.html">Data Explorer View</ulink> </entry></row>
-<row><entry>vCalendar   </entry><entry>   <ulink url="http://upcoming.org/event/130719/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/upcoming.org/event/130719/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://upcoming.org/event/130719/">Data Explorer View</ulink> </entry></row>
-<row><entry>vCard 	</entry><entry>   <ulink url="http://tech.yahoo.com/pr/apple-ipod-video-30gb-black-mp3-player/1992981873">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/tech.yahoo.com/pr/apple-ipod-video-30gb-black-mp3-player/1992981873">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://tech.yahoo.com/pr/apple-ipod-video-30gb-black-mp3-player/1992981873">Data Explorer View</ulink> </entry></row>
-<row><entry>XBEL 	</entry><entry>   <ulink url="http://xbel.sourceforge.net/bookmarks/xbel.xbel">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/xbel.sourceforge.net/bookmarks/xbel.xbel">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://xbel.sourceforge.net/bookmarks/xbel.xbel">Data Explorer View</ulink> </entry></row>
-<row><entry>XBRL 	</entry><entry>   <ulink url="http://www.sec.gov/Archives/edgar/data/51143/000110465908059468/ibm-20080429.xml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.sec.gov/Archives/edgar/data/51143/000110465908059468/ibm-20080429.xml">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.sec.gov/Archives/edgar/data/51143/000110465908059468/ibm-20080429.xml">Data Explorer View</ulink> </entry></row>
-<row><entry>XFN 	</entry><entry>   <ulink url="http://www.molly.com/people.php">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.molly.com/people.php">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.molly.com/people.php">Data Explorer View</ulink> </entry></row>
-<row><entry>XHTML 	</entry><entry>   <ulink url="http://www.lespetitescases.net/semantique-et-xhtml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.lespetitescases.net/semantique-et-xhtml">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.lespetitescases.net/semantique-et-xhtml">Data Explorer View</ulink> </entry></row>
-<row><entry>XSLT 	</entry><entry>   <ulink url="http://www.w3.org/2003/12/rdf-in-xhtml-xslts/complete-example.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.w3.org/2003/12/rdf-in-xhtml-xslts/complete-example.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.w3.org/2003/12/rdf-in-xhtml-xslts/complete-example.html">Data Explorer View</ulink> </entry></row>
-</tbody>
-</tgroup>
-</table>
-    </listitem>
-    <listitem>Vendor-specific Web Services
-<para>These Cartridges handle closed formats: typically proprietary, sometimes undocumented, possibly
-licensed to no-one except the format originator. Sometimes data may not be parsed as desired or expected,
-as many of these Cartridges have required reverse-engineering of the data format in question.</para>
-<table>
-<tgroup cols="4">
-<thead>
-  <row>
-    <entry>Cartridge</entry><entry>Sample URI</entry><entry>Resource Description</entry><entry>Linked Data Graph</entry>
-  </row>
-</thead>
-<tbody>
-<row><entry>Amazon  	            </entry><entry>   <ulink url="http://www.amazon.com/gp/product/0553383043">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.amazon.com/gp/product/0553383043">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.amazon.com/gp/product/0553383043">Data Explorer View</ulink> </entry></row>
-<row><entry>Apple 	            </entry><entry>   <ulink url="http://www.apple.com/iphone/iphone-3gs/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.apple.com/iphone/iphone-3gs/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.apple.com/iphone/iphone-3gs/">Data Explorer View</ulink> </entry></row>
-<row><entry>Bing     	            </entry><entry>   <ulink url="http://www.bing.com/community/members/livesearch/default.aspx">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.bing.com/community/members/livesearch/default.aspx">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.bing.com/community/members/livesearch/default.aspx">Data Explorer View</ulink> </entry></row>
-<row><entry>Bugzillas 	            </entry><entry>   <ulink url="https://bugzilla.mozilla.org/show_bug.cgi?id=251714">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/https://bugzilla.mozilla.org/show_bug.cgi?id=251714">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=https://bugzilla.mozilla.org/show_bug.cgi?id=251714">Data Explorer View</ulink> </entry></row>
-<row><entry>CrunchBase 	            </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/rdf/http://www.crunchbase.com/company/google%23video_embeds-370">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/linkeddata.uriburner.com/about/rdf/http://www.crunchbase.com/company/google%23video_embeds-370">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/rdf/http://www.crunchbase.com/company/google%23video_embeds-370">Data Explorer View</ulink> </entry></row>
-<row><entry>Delicious   	    </entry><entry>   <ulink url="http://delicious.com/popular/blog">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/delicious.com/popular/blog">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://delicious.com/popular/blog">Data Explorer View</ulink> </entry></row>
-<row><entry>Digg 	            </entry><entry>   <ulink url="http://digg.com/general_sciences/at_last-stem_cells_without_side_effects_">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/digg.com/general_sciences/at_last-stem_cells_without_side_effects_">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://digg.com/general_sciences/at_last-stem_cells_without_side_effects_">Data Explorer View</ulink> </entry></row>
-<row><entry>Discogs 	            </entry><entry>   <ulink url="http://www.discogs.com/release/634302">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.discogs.com/release/634302">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.discogs.com/release/634302">Data Explorer View</ulink> </entry></row>
-<row><entry>Disqus 	            </entry><entry>   <ulink url="http://blog.disqus.net/2008/08/25/reblog-comments-can-be-blog-posts/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/blog.disqus.net/2008/08/25/reblog-comments-can-be-blog-posts/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://blog.disqus.net/2008/08/25/reblog-comments-can-be-blog-posts/">Data Explorer View</ulink> </entry></row>
-<row><entry>DOI   	            </entry><entry>   <ulink url="http://doi.ieeecomputersociety.org/10.1109/MIC.2008.16">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/doi.ieeecomputersociety.org/10.1109/MIC.2008.16">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://doi.ieeecomputersociety.org/10.1109/MIC.2008.16">Data Explorer View</ulink> </entry></row>
-<row><entry>FaceBook 	            </entry><entry>   <ulink url="http://www.facebook.com/profile.php?id=841100003">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.facebook.com/profile.php?id=841100003">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.facebook.com/profile.php?id=841100003">Data Explorer View</ulink> </entry></row>
-<row><entry>Flickr 	            </entry><entry>   <ulink url="http://farm1.static.flickr.com/212/496684670_7122c831ed.jpg">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/farm1.static.flickr.com/212/496684670_7122c831ed.jpg">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://farm1.static.flickr.com/212/496684670_7122c831ed.jpg">Data Explorer View</ulink> </entry></row>
-<row><entry>Freebase 	            </entry><entry>   <ulink url="http://www.freebase.com/view/en/abraham_lincoln">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.freebase.com/view/en/abraham_lincoln">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.freebase.com/view/en/abraham_lincoln">Data Explorer View</ulink> </entry></row>
-<row><entry>Geonames 	            </entry><entry>   <ulink url="http://ws.geonames.org/search?q=london&maxRows=10&type=rdf">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/ws.geonames.org/search?q=london&maxRows=10&type=rdf">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://ws.geonames.org/search?q=london&maxRows=10&type=rdf">Data Explorer View</ulink> </entry></row>
-<row><entry>geoURL 	            </entry><entry>   <ulink url="http://geourl.org/near?p=wiki.worldflicks.org/saanen.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/geourl.org/near?p=wiki.worldflicks.org/saanen.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://geourl.org/near?p=wiki.worldflicks.org/saanen.html">Data Explorer View</ulink> </entry></row>
-<row><entry>Get Satisfaction        </entry><entry>   <ulink url="http://getsatisfaction.com/mozilla/topics/ubiquity_mostly_fails_on_mac_ppc">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/getsatisfaction.com/mozilla/topics/ubiquity_mostly_fails_on_mac_ppc">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://getsatisfaction.com/mozilla/topics/ubiquity_mostly_fails_on_mac_ppc">Data Explorer View</ulink> </entry></row>
-<row><entry>Google Social Graph     </entry><entry>   <ulink url="http://socialgraph.apis.google.com/lookup?q=http://example.com/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/socialgraph.apis.google.com/lookup?q=http://example.com/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://socialgraph.apis.google.com/lookup?q=http://example.com/">Data Explorer View</ulink> </entry></row>
-<row><entry>GoogleBase 	            </entry><entry>   <ulink url="http://www.google.com/base/feeds/snippets?bq=%20%5bemployer:%20Hewlett-Packard%5d%20%20%5bjob%20type:full-time%5d">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.google.com/base/feeds/snippets?bq=%20%5bemployer:%20Hewlett-Packard%5d%20%20%5bjob%20type:full-time%5d">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.google.com/base/feeds/snippets?bq=%20%5bemployer:%20Hewlett-Packard%5d%20%20%5bjob%20type:full-time%5d">Data Explorer View</ulink> </entry></row>
-<row><entry>Hoovers 	            </entry><entry>   <ulink url="http://www.hoovers.com/openlink/--ID__104304--/free-co-factsheet.xhtml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.hoovers.com/openlink/--ID__104304--/free-co-factsheet.xhtml">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.hoovers.com/openlink/--ID__104304--/free-co-factsheet.xhtml">Data Explorer View</ulink> </entry></row>
-<row><entry>ISBN  	            </entry><entry>   <ulink url="http://isbndb.com/d/person/berners_lee_tim.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/isbndb.com/d/person/berners_lee_tim.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://isbndb.com/d/person/berners_lee_tim.html">Data Explorer View</ulink> </entry></row>
-<row><entry>LastFM   	            </entry><entry>   <ulink url="http://www.last.fm/music/+noredirect/Teddy+Pendegrass">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.last.fm/music/+noredirect/Teddy+Pendegrass">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.last.fm/music/+noredirect/Teddy+Pendegrass">Data Explorer View</ulink> </entry></row>
-<row><entry>LibraryThing 	    </entry><entry>   <ulink url="http://www.librarything.com/work/1060">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.librarything.com/work/1060">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.librarything.com/work/1060">Data Explorer View</ulink> </entry></row>
-<row><entry>LSID 	            </entry><entry>   <ulink url="http://lsid.tdwg.org/urn:lsid:ubio.org:namebank:11815">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/lsid.tdwg.org/urn:lsid:ubio.org:namebank:11815">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://lsid.tdwg.org/urn:lsid:ubio.org:namebank:11815">Data Explorer View</ulink> </entry></row>
-<row><entry>Magnolia 	            </entry><entry>   <ulink url="http://www.magnoliaav.com/Products/Category/tabid/238/categoryId/117/Default.aspx">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.magnoliaav.com/Products/Category/tabid/238/categoryId/117/Default.aspx">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.magnoliaav.com/Products/Category/tabid/238/categoryId/117/Default.aspx">Data Explorer View</ulink> </entry></row>
-<row><entry>Meetup 	            </entry><entry>   <ulink url="http://www.meetup.com/The-Cambridge-Semantic-Web-Meetup-Group/%23this">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.meetup.com/The-Cambridge-Semantic-Web-Meetup-Group/%23this">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.meetup.com/The-Cambridge-Semantic-Web-Meetup-Group/%23this">Data Explorer View</ulink> </entry></row>
-<row><entry>MusicBrainz 	    </entry><entry>   <ulink url="http://musicbrainz.org/release/37e955d4-a53c-45aa-a812-1b23b88dbc13.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/musicbrainz.org/release/37e955d4-a53c-45aa-a812-1b23b88dbc13.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://musicbrainz.org/release/37e955d4-a53c-45aa-a812-1b23b88dbc13.html">Data Explorer View</ulink> </entry></row>
-<row><entry>Ning 	            </entry><entry>   <ulink url="http://www.ning.com/main/popular?trend=professional">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.ning.com/main/popular?trend=professional">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.ning.com/main/popular?trend=professional">Data Explorer View</ulink> </entry></row>
-<row><entry>OAI 	            </entry><entry>   <ulink url="http://news.cnet.com/IBM%2C-screensaver-to-tackle-smallpox/2100-1008_3-983374.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/news.cnet.com/IBM%2C-screensaver-to-tackle-smallpox/2100-1008_3-983374.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://news.cnet.com/IBM%2C-screensaver-to-tackle-smallpox/2100-1008_3-983374.html">Data Explorer View</ulink> </entry></row>
-<row><entry>Open Social 	    </entry><entry>   <ulink url="http://socialgraph.apis.google.com/otherme?pretty=1&q=www.openlinksw.com/blog/~kidehen/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/socialgraph.apis.google.com/otherme?pretty=1&q=www.openlinksw.com/blog/~kidehen/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://socialgraph.apis.google.com/otherme?pretty=1&q=www.openlinksw.com/blog/~kidehen/">Data Explorer View</ulink> </entry></row>
-<row><entry>OpenLibrary 	    </entry><entry>   <ulink url="http://openlibrary.org/b/OL7983950M">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/openlibrary.org/b/OL7983950M">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://openlibrary.org/b/OL7983950M">Data Explorer View</ulink> </entry></row>
-<row><entry>OpenStreetMap 	    </entry><entry>   <ulink url="http://openstreetmap.org/?lat=57.6569&lon=11.8886&zoom=14&layers=B000FTF">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/openstreetmap.org/?lat=57.6569&lon=11.8886&zoom=14&layers=B000FTF">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://openstreetmap.org/?lat=57.6569&lon=11.8886&zoom=14&layers=B000FTF">Data Explorer View</ulink> </entry></row>
-<row><entry>oReilly 	            </entry><entry>   <ulink url="http://oreilly.com/catalog/9780596523206/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/oreilly.com/catalog/9780596523206/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://oreilly.com/catalog/9780596523206/">Data Explorer View</ulink> </entry></row>
-<row><entry>Picasa 	            </entry><entry>   <ulink url="http://picasaweb.google.com/quitetall/ZurichAtDawn#5339484766701840338">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/picasaweb.google.com/quitetall/ZurichAtDawn#5339484766701840338">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://picasaweb.google.com/quitetall/ZurichAtDawn#5339484766701840338">Data Explorer View</ulink> </entry></row>
-<row><entry>PowerPoint 	            </entry><entry>   <ulink url="http://virtuoso.openlinksw.com/presentations/Solving_Real_Problems_Using_Linked_Data/Solving_Real_Problems_Using_Linked_Data.ppt">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/virtuoso.openlinksw.com/presentations/Solving_Real_Problems_Using_Linked_Data/Solving_Real_Problems_Using_Linked_Data.ppt">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://virtuoso.openlinksw.com/presentations/Solving_Real_Problems_Using_Linked_Data/Solving_Real_Problems_Using_Linked_Data.ppt">Data Explorer View</ulink> </entry></row>
-<row><entry>Radio Pop 	            </entry><entry>   <ulink url="http://www.radiopop.co.uk/users/tristanf/friends.xml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.radiopop.co.uk/users/tristanf/friends.xml">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.radiopop.co.uk/users/tristanf/friends.xml">Data Explorer View</ulink> </entry></row>
-<row><entry>Rhapsody 	            </entry><entry>   <ulink url="http://mp3.rhapsody.com/playlistdetail?playlistId=ply.25288413">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/mp3.rhapsody.com/playlistdetail?playlistId=ply.25288413">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://mp3.rhapsody.com/playlistdetail?playlistId=ply.25288413">Data Explorer View</ulink> </entry></row>
-<row><entry>SalesForce.com 	    </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/rdf/https://na6.salesforce.com/0038000000ViF6k#this">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/linkeddata.uriburner.com/about/rdf/https://na6.salesforce.com/0038000000ViF6k#this">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/rdf/https://na6.salesforce.com/0038000000ViF6k#this">Data Explorer View</ulink> </entry></row>
-<row><entry>SlideShare 	            </entry><entry>   <ulink url="http://www.slideshare.net/rumito/rdf-views-of-sql-data-power-point-presentation-1-173180/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.slideshare.net/rumito/rdf-views-of-sql-data-power-point-presentation-1-173180/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.slideshare.net/rumito/rdf-views-of-sql-data-power-point-presentation-1-173180/">Data Explorer View</ulink> </entry></row>
-<row><entry>SVG 	            </entry><entry>   <ulink url="http://www.schepers.cc/semweb/rdf-diagram.svg">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.schepers.cc/semweb/rdf-diagram.svg">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.schepers.cc/semweb/rdf-diagram.svg">Data Explorer View</ulink> </entry></row>
-<row><entry>TWFY They Work For You  </entry><entry>   <ulink url="http://www.theyworkforyou.com/mp/diane_abbott/hackney_north_and_stoke_newington">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.theyworkforyou.com/mp/diane_abbott/hackney_north_and_stoke_newington">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.theyworkforyou.com/mp/diane_abbott/hackney_north_and_stoke_newington">Data Explorer View</ulink> </entry></row>
-<row><entry>Web Resource CC (Licenses) 	</entry><entry>   <ulink url="http://creativecommons.org/licenses/by-nc-nd/2.5/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/creativecommons.org/licenses/by-nc-nd/2.5/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://creativecommons.org/licenses/by-nc-nd/2.5/">Data Explorer View</ulink> </entry></row>
-<row><entry>XBRL based SEC Filings  </entry><entry>   <ulink url="http://www.sec.gov/Archives/edgar/data/789019/000119312507259490/msft-20070930.xml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.sec.gov/Archives/edgar/data/789019/000119312507259490/msft-20070930.xml">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.sec.gov/Archives/edgar/data/789019/000119312507259490/msft-20070930.xml">Data Explorer View</ulink> </entry></row>
-<row><entry>xFolk 	            </entry><entry>   <ulink url="http://blogmarks.net/blog/?2005/06/07/33-blogsync-reloaded">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/blogmarks.net/blog/?2005/06/07/33-blogsync-reloaded">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://blogmarks.net/blog/?2005/06/07/33-blogsync-reloaded">Data Explorer View</ulink> </entry></row>
-<row><entry>Yahoo! Finance 	    </entry><entry>   <ulink url="http://finance.yahoo.com/q?s=AAPL">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/finance.yahoo.com/q?s=AAPL">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://finance.yahoo.com/q?s=AAPL">Data Explorer View</ulink> </entry></row>
-<row><entry>Yahoo! SearchMonkey     </entry><entry>   <ulink url="http://tech.groups.yahoo.com/group/ysearchboss/message/1983">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/tech.groups.yahoo.com/group/ysearchboss/message/1983">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://tech.groups.yahoo.com/group/ysearchboss/message/1983">Data Explorer View</ulink> </entry></row>
-<row><entry>Yahoo! Traffic Data     </entry><entry>   <ulink url="http://local.yahooapis.com/MapsService/V1/trafficData?appid=Jz0wAU7V34Ff7gCzblxD.86qjGTEn._H3KA3PEajNE3xBMIbQtEZqIqHRh0G&street=701+First+Street&city=Sunnyvale&state=CA">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/local.yahooapis.com/MapsService/V1/trafficData?appid=Jz0wAU7V34Ff7gCzblxD.86qjGTEn._H3KA3PEajNE3xBMIbQtEZqIqHRh0G&street=701+First+Street&city=Sunnyvale&state=CA">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://local.yahooapis.com/MapsService/V1/trafficData?appid=Jz0wAU7V34Ff7gCzblxD.86qjGTEn._H3KA3PEajNE3xBMIbQtEZqIqHRh0G&street=701+First+Street&city=Sunnyvale&state=CA">Data Explorer View</ulink> </entry></row>
-<row><entry>Yahoo! Weather 	    </entry><entry>   <ulink url="http://weather.yahooapis.com/forecastrss?p=94089">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/weather.yahooapis.com/forecastrss?p=94089">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://weather.yahooapis.com/forecastrss?p=94089">Data Explorer View</ulink> </entry></row>
-<row><entry>Yelp 	            </entry><entry>   <ulink url="http://api.yelp.com/business_review_search?term=cream%20puffs&location=650%20Mission%20St%2ASan%20Francisco%2A%20CA&ywsid=XXXXXXXXXXXXXXXX">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/api.yelp.com/business_review_search?term=cream%20puffs&location=650%20Mission%20St%2ASan%20Francisco%2A%20CA&ywsid=XXXXXXXXXXXXXXXX">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://api.yelp.com/business_review_search?term=cream%20puffs&location=650%20Mission%20St%2ASan%20Francisco%2A%20CA&ywsid=XXXXXXXXXXXXXXXX">Data Explorer View</ulink> </entry></row>
-<row><entry>Youtube                 </entry><entry>   <ulink url="http://www.youtube.com/watch?v=6eGcsGPgUTw">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.youtube.com/watch?v=6eGcsGPgUTw">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.youtube.com/watch?v=6eGcsGPgUTw">Data Explorer View</ulink> </entry></row>
-
-</tbody>
-</tgroup>
-</table>
-    </listitem>
-    <listitem>Meta Cartridges (delivering Lookups & Joins against other Linked Data Spaces)
-<para>These Cartridges submit the Resource identified by the URI to third-party Web Services for processing.
-Returned RDF supplements the RDF generated by other Cartridges, such as those in the preceding tables.
-Locally generated RDF may also be submitted to the third-party services, instead of or in addition to
-the original Resource itself.</para>
-<table>
-<tgroup cols="4">
-<thead>
-  <row>
-    <entry>Cartridge</entry><entry>Sample URI</entry><entry>Resource Description</entry><entry>Linked Data Graph</entry>
-  </row>
-</thead>
-<tbody>
-
-<row><entry>BBC  	</entry><entry> <ulink url="http://news.bbc.co.uk/1/hi/uk/7615539.stm">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.hinducurrents.com/publisher/249/BBC+NEWS/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.hinducurrents.com/publisher/249/BBC+NEWS/">Data Explorer View</ulink> </entry></row>
-<row><entry>CNET 	</entry><entry>   <ulink url="http://shopper.cnet.com/multifunction-devices/canon-pixma-mp240/4014-3181_9-33200106.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.xomreviews.com/shopper.cnet.com">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.xomreviews.com/shopper.cnet.com">Data Explorer View</ulink> </entry></row>
-<row><entry>DBpedia 	</entry><entry>   <ulink url="http://dbpedia.org/page/TweetDeck">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.programmableweb.com/api/dbpedia">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.programmableweb.com/api/dbpedia">Data Explorer View</ulink> </entry></row>
-<row><entry>eBay 	</entry><entry>   <ulink url="http://shop.ebay.com/stores/__W0QQLHQ5fSellerWithStoreZ1QQ_nkwZtoys?_rdc=1">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/wordpress.xdroop.com/space/HotWheels/Buying+Hotwheels+On+eBay">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://wordpress.xdroop.com/space/HotWheels/Buying+Hotwheels+On+eBay">Data Explorer View</ulink> </entry></row>
-<row><entry>FriendFeed 	</entry><entry>   <ulink url="http://friendfeed.com/informationweek/0f212311/web-link-shrinkage-powers-spam-surge">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.informationweek.com/news/security/vulnerabilities/showArticle.jhtml?articleID=218401098">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.informationweek.com/news/security/vulnerabilities/showArticle.jhtml?articleID=218401098">Data Explorer View</ulink> </entry></row>
-<row><entry>Get Glue 	</entry><entry>   <ulink url="http://getglue.com/smartlinks">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.readwriteweb.com/archives/get_glue_on_your_iphone.php">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.readwriteweb.com/archives/get_glue_on_your_iphone.php">Data Explorer View</ulink> </entry></row>
-<row><entry>LOD 	</entry><entry>   <ulink url="http://lod.openlinksw.com/b3s/search.vsp?q=1">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/lod.openlinksw.com/b3s/search.vsp?q=1">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://lod.openlinksw.com/b3s/search.vsp?q=1">Data Explorer View</ulink> </entry></row>
-<row><entry>New York Times  	 	</entry><entry>   <ulink url="http://www.nytimes.com/2005/03/17/technology/circuits/17stat.html?ex=1268715600&en=6840507aca561cf8&ei=5090&partner=rssuserland">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/download.cnet.com/New-York-Times-Crosswords-Monthly-Subscription/3000-2111_4-10918973.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://download.cnet.com/New-York-Times-Crosswords-Monthly-Subscription/3000-2111_4-10918973.html">Data Explorer View</ulink> </entry></row>
-<row><entry>OpenCalais  </entry><entry>   <ulink url="http://d.opencalais.com/er/company/ralg-tr1r/7cf71bb9-2969-35d3-8fa1-3723bdb5958c">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/news.cnet.com/8301-13505_3-9805771-16.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://news.cnet.com/8301-13505_3-9805771-16.html">Data Explorer View</ulink> </entry></row>
-<row><entry>Technorati  </entry><entry>   <ulink url="http://support.technorati.com/support/siteguide/tags">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/download.cnet.com/Technorati-Tag/3000-12565_4-10658084.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://download.cnet.com/Technorati-Tag/3000-12565_4-10658084.html">Data Explorer View</ulink> </entry></row>
-<row><entry>Twine 	</entry><entry>   <ulink url="http://www.twine.com/item/11yg1gn9s-1cj/sweoig-taskforces-communityprojects-linkingopendata-esw-wiki">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/esw.w3.org/topic/SweoIG/TaskForces/CommunityProjects/LinkingOpenData/">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://esw.w3.org/topic/SweoIG/TaskForces/CommunityProjects/LinkingOpenData/">Data Explorer View</ulink> </entry></row>
-<row><entry>Twitter 	</entry><entry>   <ulink url="http://twitter.com/Techmeme/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.techmeme.com/081001/p43">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.techmeme.com/081001/p43">Data Explorer View</ulink> </entry></row>
-<row><entry>World Bank 	</entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/web.worldbank.org/WBSITE/EXTERNAL/TOPICS/EXTEDUCATION/0,,contentMDK:20263110~menuPK:531742~pagePK:210058~piPK:210062~theSitePK:282386,00.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.lib.berkeley.edu/doemoff/govinfo/intl/gov_ibrd.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.lib.berkeley.edu/doemoff/govinfo/intl/gov_ibrd.html">Data Explorer View</ulink> </entry></row>
-<row><entry>Zemanta 	</entry><entry>   <ulink url="http://developer.zemanta.com/wiki/helloworld/ruby">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/kobesearch.cpan.org/htdocs/Net-Zemanta/Net/Zemanta/Suggest.pm.html">HTML Representation</ulink> </entry><entry>	<ulink url="http://linkeddata.uriburner.com/ode/?uri=http://kobesearch.cpan.org/htdocs/Net-Zemanta/Net/Zemanta/Suggest.pm.html">Data Explorer View</ulink> </entry></row>
-</tbody>
-</tgroup>
-</table>
-
+    <figure id="rd2" float="1">
+      <title>RDF Views Generate and Publish</title>
+      <graphic fileref="ui/rd2.png"/>
+    </figure>
 </listitem>
-  </itemizedlist>
-</sect4>
-<sect4 id="virtuosospongercartridgetypes"><title>Types of Cartridges</title>
-<para><emphasis>Basic</emphasis></para>
-<para>Sponger cartridges are invoked as follows:</para>
-<para>When the SPARQL processor dereferences a URI, it plays the role of an HTTP user agent (client)
-that makes a content type specific request to an HTTP server via the HTTP request's Accept headers.
-The following then occurs:</para>
-
-<itemizedlist>
-  <listitem>If the content type returned is RDF then no further transformation is needed and the process
-stops. For instance, when consuming an (X)HTML document with a GRDDL profile, the profile URI points to a
-data provider that simply returns RDF instance data. </listitem>
-  <listitem>If the content type is not RDF (i.e. application/rdf+xml or text/rdf+n3 ), for instance
-'text/plain', the Sponger looks in the Cartridge Registry iterating over every record for which the
-RM_ENABLED flag is true, with the look-up sequence ordered on the RM_ID column values. For each record,
-the processor tries matching the content type or URL against the RM_PATTERN value and, if there is
-match, the function specified in RM_HOOK column is called. If the function doesn't exist, or signals
-an error, the SPARQL processor looks at next record.
-    <itemizedlist>
-      <listitem>If the hook returns zero, the next cartridge is tried. (A cartridge function can return
-zero if it believes a subsequent cartridge in the chain is capable of extracting more RDF data.)</listitem>
-      <listitem>If the result returned by the hook is negative, the Sponger is instructed that no
-RDF was generated and the process stops.
-        <itemizedlist>
-          <listitem>If the hook result is positive, the Sponger is informed that structured data was
-retrieved and the process stops. </listitem>
-        </itemizedlist>
+  <listitem>Virtuoso will perform the entire process of ontology generation, instance data generation, and
+linked data deployment (re-write rules generation and application).</listitem>
+  <listitem>Error messages will be presented if the Wizard encounters problems. If there are no error
+messages, your RDF view declarations and Linked Data publishing activities will have completed successfully.
+    <figure id="rd13" float="1">
+      <title>RDF View declarations and Linked Data publishing activities</title>
+      <graphic fileref="ui/rd13.png"/>
+    </figure>
       </listitem>
-    </itemizedlist>
+  <listitem>Optionally, you could also perform one of the following tasks:
+<orderedlist>
+  <listitem>Save Data Mappings: when clicked, offers to save the generated Definitions to local file system</listitem>
+  <listitem>Save Ontology Mappings: when clicked, offers to save the generated Ontology to local file system</listitem>
+  <listitem>Click on the "Cancel" should you want to return to the initial RDF View Generation form.</listitem>
+</orderedlist>
   </listitem>
-  <listitem>If none of the cartridges match the source data signature (content type or URL), the
- ODS-Briefcase WebDAV metadata extractor and RDF generator is called.</listitem>
-</itemizedlist>
-<para><emphasis>Meta</emphasis></para>
-<para>Virtuoso also supports another cartridge type - a 'meta-cartridge'. Meta-cartridges act as
-post-processors in the cartridge pipeline, augmenting entity descriptions in an RDF graph with
-additional information gleaned from 'lookup' data sources and web services.</para>
-</sect4>
-</sect3>
-   <sect3 id="virtuosospongercartridgesextractorusecases"><title>RDF Cartridges Use Cases</title>
-<para>This section contains examples of Web resources which can be transformed by RDF Cartridges.
-It also states where additional setup for given cartridges is needed i.e. keys account names etc.
+</orderedlist>
+</sect2>
+<sect2 id="rdfrdfviewgnrwizzard"><title>Manual Linked Data Generation & Deployment using the Conductor's HTML-based wizard</title>
+<para>The following step-by guide will lead you through manually publishing ODBC- or JDBC-accessible RDBMS
+data in RDF Linked Data form, using the Conductor's HTML-based wizard:
 </para>
-<para><emphasis>Service based:</emphasis></para>
-<itemizedlist>
-<listitem>amazon
-<programlisting><![CDATA[
-needs: api key
-example: http://www.amazon.com/gp/product/0553383043
-]]></programlisting>
+<orderedlist>
+  <listitem>Go to http://<cname>:port/conductor</listitem>
+  <listitem>Log in as user dba (or another user with DBA privileges)</listitem>
+  <listitem>Follow menu path Database -> RDF Views
+    <figure id="rd1" float="1">
+      <title>RDF Views</title>
+      <graphic fileref="ui/rd1.png"/>
+    </figure>
 </listitem>
-<listitem>ebay
-<programlisting><![CDATA[
-needs: account, api-key
-example: http://cgi.ebay.com/RARE-DAY-IN-FAIRY-LAND-ELEPHANT-FOLIO-20-FULL-COLOR_W0QQitemZ140209597189QQihZ004QQcategoryZ29223QQssPageNameZWDVWQQrdZ1QQcmdZViewItem
-]]></programlisting>
+  <listitem>In the form presented, perform the following steps:
+    <orderedlist>
+      <listitem>Select the Database Name Qualifier (e.g., "Demo") that exposes the Tables / Views for this
+exercise</listitem>
+      <listitem>Enter the Base URL to which your URL rewrite rules will be bound (e.g. http://<cname>:8890/Demo)</listitem>
+      <listitem>Select specific Tables containing the data to be published (e.g., Demo.demo.Shippers and Demo.demo.Suppliers)</listitem>
+      <listitem>Click the "Generate via Wizard" button
+        <figure id="rd2" float="1">
+          <title>Generate via Wizard</title>
+          <graphic fileref="ui/rd2.png"/>
+        </figure>
         </listitem>
-<listitem>flickr
-needs: api-key
-example: http://farm1.static.flickr.com/212/496684670_7122c831ed.jpg
-<programlisting><![CDATA[
-]]></programlisting>
+    </orderedlist>
 </listitem>
-<listitem>mbz
-<programlisting><![CDATA[
-example: http://musicbrainz.org/release/37e955d4-a53c-45aa-a812-1b23b88dbc13.html
-]]></programlisting>
+  <listitem>At this point, you are presented with the option to edit your column selection. Select the
+"Edit" link, for example, for table Demo.demo.Shippers.
+    <figure id="rd3" float="1">
+      <title>Column Selection</title>
+      <graphic fileref="ui/rd3.png"/>
+    </figure>
 </listitem>
-<listitem>mql (freebase)
-<programlisting><![CDATA[
-example: http://www.freebase.com/view/en/beta_ursae_majoris
-]]></programlisting>
+  <listitem>For images or other binary data in MIME formats to be revealed as anything other than generic "binary objects", you must map large
+varbinary types to the appropriate MIME types like image/gif. To do so, select the Edit link for Binding/MIME Type of the relevant table columns.
+You can:
+    <itemizedlist mark="bullet">
+      <listitem>Leave the Binding/MIME Type literal; or</listitem>
+      <listitem>Set to skip, such that the column will not be used in RDF generation; or </listitem>
+      <listitem>Select the binary object value in order for the column to be referenced as binary.</listitem>
+    </itemizedlist>
+    <figure id="rd14" float="1">
+      <title>Binding/MIME Types</title>
+      <graphic fileref="ui/rd14.png"/>
+    </figure>
 </listitem>
-<listitem>facebook
-<programlisting><![CDATA[
-needs: api-key, secret, persistent-session-id
-example: http://www.facebook.com/profile.php?id=841100003
-]]></programlisting>
+  <listitem>After finishing with your changes click the Save button, or cancel the changes and go back by
+clicking the Cancel button.</listitem>
+  <listitem>Make sure you click the "Next" button.</listitem>
+  <listitem>At this point, the RDF View Definition form will let you Select Generation Targets options:
+    <orderedlist>
+      <listitem>Data Source Ontology Mappings</listitem>
+      <listitem>Instance Data View Mappings</listitem>
+      <listitem>VoID statistic</listitem>
+    </orderedlist>
+    <figure id="rd15" float="1">
+      <title>Generation Targets options</title>
+      <graphic fileref="ui/rd15.png"/>
+    </figure>
 </listitem>
-<listitem>yahoo-stock
-<programlisting><![CDATA[
-example: http://finance.yahoo.com/q?s=AAPL
-]]></programlisting>
+  <listitem>Make sure you click the "Next" button.</listitem>
+  <listitem>Based on your selections in the prior form, the RDF View Definition Deployment Options form will be offered:
+    <orderedlist>
+      <listitem>Data Source Ontology Rules</listitem>
+      <listitem>Instance Data Rules
 </listitem>
-<listitem>yahoo-traffic
+    </orderedlist>
+    <figure id="rd4" float="1">
+      <title>Generation Targets options</title>
+      <graphic fileref="ui/rd4.png"/>
+    </figure>
+</listitem>
+  <listitem>Select the desired option(s) and click the "Prepare to Execute" button which unveils a generated
+Instance Data and/or Ontology form.
+    <figure id="rd5" float="1">
+      <title>Instance Data and/or Ontology</title>
+      <graphic fileref="ui/rd5.png"/>
+    </figure>
+</listitem>
+  <listitem>Click the Execute button and Virtuoso will:
+    <orderedlist>
+      <listitem>Apply the generated declarations (instance data and ontology) to your Virtuoso instance</listitem>
+      <listitem>Publish / Deploy declarations that expose the Wizard-generated Rewrite Rules and associated endpoints.
+        <figure id="rd6" float="1">
+          <title>Publishing / Deployment declarations</title>
+          <graphic fileref="ui/rd6.png"/>
+        </figure>
+</listitem>
+    </orderedlist>
+</listitem>
+  <listitem>Optionally, you can also perform one of the following tasks:
+    <orderedlist>
+      <listitem>Save Data Mappings: when clicked, offers to save the generated Definitions to local file
+system</listitem>
+      <listitem>Save Ontology Mappings: when clicked, offers to save the generated Ontology to local file
+system</listitem>
+      <listitem>Export as WebDAV resource: exports the selected objects/items as a WebDAV resource:
+       <itemizedlist mark="bullet">
+          <listitem>Click "Browse"</listitem>
+          <listitem>Enter a WebDAV resource and click the "Select" button.</listitem>
+</itemizedlist>
+        <figure id="rd7" float="1">
+          <title>WebDAV resource</title>
+          <graphic fileref="ui/rd7.png"/>
+        </figure>
+</listitem>
+    </orderedlist>
+    <para>Note, the WebDAV resource path value will be shown in the WebDAV location field.</para>
+</listitem>
+  <listitem>Then click the "Save Data Mappings" or "Save Ontology Mappings" button, to complete the option task of saving your generated (or edited) view declarations.
+    <figure id="rd8" float="1">
+      <title>WebDAV resource</title>
+      <graphic fileref="ui/rd8.png"/>
+    </figure>
+</listitem>
+  <listitem>Error messages will be presented if the Wizard encounters problems. If there are no error messages, your RDF view declarations and Linked Data publishing activities will have completed successfully.
+    <figure id="rd9" float="1">
+      <title>RDF view declarations and Linked Data publishing activities Finish</title>
+      <graphic fileref="ui/rd9.png"/>
+    </figure>
+</listitem>
+  <listitem>Click on Cancel to return to the initial RDF View Generation form.</listitem>
+</orderedlist>
+</sect2>
+</sect1>
+
+&rdfviewssamples;
+
+<sect1 id="rdfinsertmethods"><title>RDF Insert Methods in Virtuoso</title>
+    <sect2 id="rdfinsertmethodsapifunct"><title>Using API functions</title>
+      <itemizedlist mark="bullet">
+        <listitem><link linkend="rdfapidataimportttlp">Using the DB.DBA.TTLP() function</link>
+          <itemizedlist mark="bullet">
+            <listitem>Note: use this function for loading Turtle</listitem>
+           </itemizedlist>
+</listitem>
+        <listitem><link linkend="rdfapidataimportttlpmt">Using the DB.DBA.TTLP_MT() function</link>
+          <itemizedlist mark="bullet">
+            <listitem>Note: use this function for loading triples from file on multiple threads</listitem>
+           </itemizedlist>
+</listitem>
+        <listitem><link linkend="rdfapidataimportxmlttlpmt">Using the DB.DBA.RDF_LOAD_RDFXML_MT() function</link>
+          <itemizedlist mark="bullet">
+            <listitem>Note: Use this function for loading large resources when transactional integrity is not important (loading of a single resource may take more than one transaction)</listitem>
+           </itemizedlist>
+</listitem>
+        <listitem><link linkend="rdfapidataimportttlphash">Using the DB.DBA.RDF_TTL2HASH() function</link>
+    <itemizedlist mark="bullet">
+            <listitem>Note: use this function to get dictionary of triples in 'long valmode'.</listitem>
+    </itemizedlist>
+</listitem>
+        <listitem><link linkend="rdfapidataimportloadrdfxml">Using the DB.DBA.RDF_LOAD_RDFXML() function</link>
+          <itemizedlist mark="bullet">
+            <listitem>For loading RDF/XML, the best way is to split the data to be loaded into
+multiple streams and load these in parallel using this function.</listitem>
+           </itemizedlist>
+</listitem>
+      </itemizedlist>
+      <para>See <link linkend="rdfperfloading">more details</link> for loading Performance Tuning specifics.</para>
+    </sect2>
+    <sect2 id="rdfinsertmethodshttppost"><title>HTTP Post using Content-Type: application/sparql-query</title>
+	<para>With POST can be accomplished SPARQL Insert/Update etc.</para>
+	<para>The result is in the rdf_quad.</para>
+	<para>With GET Methods you can get the triples which are saved.</para>
+        <para><emphasis>Examples:</emphasis></para>
+        <para><emphasis>Example 1:</emphasis></para>
+        <para>Create a DAV collection xx for user demo with password demo.</para>
+        <para>Execute the following command:</para>
 <programlisting><![CDATA[
-example: http://local.yahooapis.com/MapsService/V1/trafficData?appid=YahooDemo&street=701+First+Street&city=Sunnyvale&state=CA
+curl -i -d "INSERT {<http://demo.openlinksw.com/DAV/home/demo_about.rdf>
+<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#User>}" -u "demo:demo"
+-H "Content-Type: application/sparql-query" http://localhost:8890/DAV/xx/yy
 ]]></programlisting>
-</listitem>
-<listitem>Bugzilla
+        <para>The response should be:</para>
 <programlisting><![CDATA[
-example: https://bugzilla.mozilla.org/show_bug.cgi?id=251714
+HTTP/1.1 201 Created
+Server: Virtuoso/05.00.3023 (Win32) i686-generic-win-32  VDB
+Connection: Keep-Alive
+Content-Type: text/html; charset=ISO-8859-1
+Date: Fri, 28 Dec 2007 12:50:12 GMT
+Accept-Ranges: bytes
+MS-Author-Via: SPARQL
+Content-Length: 0
 ]]></programlisting>
-</listitem>
-<listitem>SVG</listitem>
-<listitem>OO document
+        <para>The result in the DAV/xx location will be a new WebDAV resource with name "yy" containing the inserted RDF:</para>
 <programlisting><![CDATA[
-needs: unzip plugin
+<?xml version="1.0" encoding="utf-8" ?>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
+<rdf:Description
+rdf:about="http://demo.openlinksw.com/DAV/home/demo_about.rdf">
+<ns0pred:type xmlns:ns0pred="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+rdf:resource="http://rdfs.org/sioc/ns#User"/>
+</rdf:Description>
+</rdf:RDF>
 ]]></programlisting>
-</listitem>
-<listitem>Wikipedia
+        <para><emphasis>Example 2:</emphasis></para>
+        <para>Create a DAV collection, for ex. with name "test" for user ( for ex. demo).</para>
+        <para>Execute the following command:</para>
 <programlisting><![CDATA[
-needs: php plugin & dbpedia extractor
-example: http://wikipedia.org/wiki/London
+curl -i -d "INSERT IN GRAPH <http://mygraph.com>
+{ <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this>
+  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
+  <http://rdfs.org/sioc/ns#User> .
+  <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this>
+  <http://www.w3.org/2000/01/rdf-schema#label>
+  <Kingsley Uyi Idehen> .
+  <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this>
+  <http://rdfs.org/sioc/ns#creator_of>
+
+<http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300>
+  } " -u "demo:demo" -H "Content-Type: application/sparql-query" http://localhost:8890/DAV/home/demo/test/myrq
 ]]></programlisting>
-</listitem>
-<listitem>Opencalais</listitem>
-<listitem>iCalendar</listitem>
-</itemizedlist>
-<para><emphasis>GRDDL</emphasis></para>
-<itemizedlist>
-<listitem>Google Base (google)
+        <para>As result the response will be:</para>
 <programlisting><![CDATA[
-example: http://www.google.com/base/feeds/snippets/17891817243016304554
+HTTP/1.1 201 Created
+Server: Virtuoso/05.00.3023 (Win32) i686-generic-win-32  VDB
+Connection: Keep-Alive
+Content-Type: text/html; charset=ISO-8859-1
+Date: Thu, 20 Dec 2007 16:25:25 GMT
+Accept-Ranges: bytes
+MS-Author-Via: SPARQL
+Content-Length: 0
 ]]></programlisting>
-</listitem>
-<listitem>eRDF</listitem>
-<listitem>RDFa</listitem>
-<listitem>hCard</listitem>
-<listitem>hCalendar</listitem>
-<listitem>hReview</listitem>
-<listitem>relLicense</listitem>
-<listitem>XBRL</listitem>
-<listitem>HR-XML</listitem>
-<listitem>DC</listitem>
-<listitem>geoURL</listitem>
-<listitem>Ning</listitem>
-<listitem>XFN</listitem>
-<listitem>xFolk</listitem>
-</itemizedlist>
-<para><emphasis>URN handlers</emphasis></para>
+        <para>Now let's check the inserted triples. Go to the sparql endpoint, i.e. http://localhost:8890/sparql and:</para>
 <itemizedlist>
-<listitem>LSID
+<listitem>Enter for Default Graph URI:
 <programlisting><![CDATA[
-example: urn:lsid:ubio.org:namebank:12292
+http://mygraph.com
 ]]></programlisting>
-</listitem>
-<listitem>DOI
+   </listitem>
+<listitem>Enter in the Query area:
 <programlisting><![CDATA[
-needs: hslookup plugin, relevant html, pdf, xml etc. mappers enabled
-example: doi:10.1038/35057062
+SELECT * WHERE {?s ?p ?o}
 ]]></programlisting>
-</listitem>
-<listitem>OAI
+   </listitem>
+<listitem>Click the button "Run Query"</listitem>
+<listitem>As result will be shown the inserted triples:
 <programlisting><![CDATA[
-example: oai:dcmi.ischool.washington.edu:article/8
+s  	                                                          p                                                 o
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this   http://www.w3.org/1999/02/22-rdf-syntax-ns#type   http://rdfs.org/sioc/ns#User
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this   http://www.w3.org/2000/01/rdf-schema#label 	    Kingsley
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this   http://rdfs.org/sioc/ns#creator_of                http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300
 ]]></programlisting>
-</listitem>
+   </listitem>
 </itemizedlist>
-<sect4 id="virtuosospongerrdfmappers"><title>SPARQL IRI Dereferencing</title>
-<para>The Virtuoso SPARQL engine (called for brevity just SPARQL bellow) supports IRI Dereferencing,
-however it understands only RDF data, that is it can retrieve only files containing RDF/XML, turtle
-or N3 serialized RDF data, if format is unknown it will try mapping with built-in WebDAV metadata
-extractor. In order to extend this feature with dereferencing web or file resources which naturally
-don't have RDF data (like PDF, JPEG files for example) is provided a special mechanism in SPARQL
-engine. This mechanism is called RDF mappers for translation of non-RDF data files to RDF.</para>
-<para>In order to instruct the SPARQL to call a RDF mapper it needs to be registered and it will
-be called for a given URL or MIME type pattern. In other words, when unknown for SPARQL format is
-received during URL dereferencing process, it will look into a special registry (a table) to match
-either the MIME type or IRI using a regular expression, if match is found the mapper function will
-be called.</para>
-<sect5 id="virtuosospongerproxy"><title>Sponger Proxy service</title>
-<para>Sponger functionality is also exposed via Virtuoso's "/proxy/rdf/" endpoint, as an in-built
-REST style Web service available in any Virtuoso standard installation. This web service takes
-a target URL and either returns the content "as is" or tries to transform (by sponging) to RDF.
-Thus, the proxy service can be used as a 'pipe' for RDF browsers to browse non-RDF sources.
-</para>
-<para>For more information see <link linkend="rdfproxyservice">RDF Sponger Proxy service</link></para>
-      </sect5>
-<sect5 id="virtuosospongercache"><title>Cache Invalidation</title>
-<para>To clear cache on all values of HS_LOCAL_IRI of the SYS_HTTP_SPONGE table use:</para>
-<programlisting><![CDATA[
-SPARQL clear graph <A-Named-Graph>;
-]]></programlisting>
-</sect5>
-</sect4>
-</sect3>
-<sect3 id="virtuosospongerfacetinstall">
-<title>Virtuoso Facet Browser Installation and configuration</title>
-<sect4 id="virtuosospongerfacetinstallprereq">
-<title>Prerequisites</title>
-<para>Requires Virtuoso 6.0 TP1 or higher for use.
-</para>
-</sect4>
-<sect4 id="virtuosospongerfacetinstallpreinst">
-<title>Pre Installation</title>
-<para>If you have an existing Virtuoso 6.x installation, and your Quad Store has greater than
-10K worth of triples, please perform the following steps:
-</para>
-<orderedlist>
-  <listitem>Run the following commands using the Virtuoso isql program before installing the Facet
-Browser VAD:
+</sect2>
+     <sect2 id="rdfinsertmethodshttpput"><title>HTTP PUT using Content-Type: application/rdf+xml</title>
+	<para>The URI in a PUT request identifies the entity enclosed with the request. Therefore using HTTP PUT is a more useful and meaningful command than using POST (which is more about submitting data to a script).</para>
+        <para><emphasis>Example:</emphasis></para>
+        <para>Suppose there is myfoaf.rdf file with the following content:</para>
 <programlisting><![CDATA[
-  drop index RDF_QUAD_OPGS;
-  drop index RDF_QUAD_POGS;
-  drop index RDF_QUAD_GPOS;
-  drop index RDF_QUAD_OGPS;
-
-  checkpoint;
-
-  create table R2 (G iri_id_8, S iri_id_8, P iri_id_8, O any, primary key (S, P, O, G));
-  alter index R2 on R2 partition (S int (0hexffff00));
-
-  log_enable (2);
-
-  INSERT INTO R2 (G, S, P, O) select G, S, P, O FROM rdf_quad;
+<rdf:RDF xmlns="http://www.example/jose/foaf.rdf#"
+    xmlns:foaf="http://xmlns.com/foaf/0.1/"
+    xmlns:log="http://www.w3.org/2000/10/swap/log#"
+    xmlns:myfoaf="http://www.example/jose/foaf.rdf#"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
 
-  DROP TABLE RDF_QUAD;
-  ALTER TABLE r2 rename RDF_QUAD;
+    <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#jose">
+        <foaf:homepage rdf:resource="http://www.example/jose/"/>
+        <foaf:knows rdf:resource="http://www.example/jose/foaf.rdf#juan"/>
+        <foaf:name>Jose Jimen~ez</foaf:name>
+        <foaf:nick>Jo</foaf:nick>
+        <foaf:workplaceHomepage rdf:resource="http://www.corp.example/"/>
+    </foaf:Person>
 
-  checkpoint;
+    <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#juan">
+        <foaf:mbox rdf:resource="mailto:juan at mail.example"/>
+    </foaf:Person>
 
-  create bitmap index RDF_QUAD_OPGS on RDF_QUAD (O, P, G, S) partition (O varchar (-1, 0hexffff));
-  create bitmap index RDF_QUAD_POGS on RDF_QUAD (P, O, G, S) partition (O varchar (-1, 0hexffff));
-  create bitmap index RDF_QUAD_GPOS on RDF_QUAD (G, P, O, S) partition (O varchar (-1, 0hexffff));
+    <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#julia">
+        <foaf:mbox rdf:resource="mailto:julia at mail.example"/>
+    </foaf:Person>
 
-  checkpoint;
+    <rdf:Description rdf:about="http://www.example/jose/foaf.rdf#kendall">
+        <foaf:knows rdf:resource="http://www.example/jose/foaf.rdf#edd"/>
+    </rdf:Description>
+</rdf:RDF>
 ]]></programlisting>
-</listitem>
-</orderedlist>
-<para>Note this step may take sometime depending on how many triples are already in your Quad Store.
-</para>
-</sect4>
-<sect4 id="virtuosospongerfacetinstallvadinst">
-<title>VAD Package Installation</title>
-<orderedlist>
-  <listitem>Download and install the <ulink url="http://download.openlinksw.com/packages/5.0/virtuoso/fct_dav.vad">Virtuoso Facet Browser VAD</ulink>
-package using the Conductor System Admin - > Packages tab.
-    <figure id="fctinst1" float="1">
-      <title>Install the FCT package</title>
-      <graphic fileref="ui/fctinst1.png"/>
-    </figure>
-</listitem>
-  <listitem>Grant <emphasis>select</emphasis> privileges on the <emphasis>RDF_QUAD</emphasis> table to the
-<emphasis>SPARQL</emphasis> user:
+        <para>Now let's upload the myfoaf.rdf file to destination server demo.openlinksw.com for user demo:</para>
 <programlisting><![CDATA[
-grant SELECT  on DB.DBA.RDF_QUAD to "SPARQL";
+curl -T myfoaf.rdf http://demo.openlinksw.com/DAV/home/demo/rdf_sink/myfoaf.rdf -u demo:demo
 ]]></programlisting>
-</listitem>
-  <listitem>An updated Virtuoso RDF Mappers VAD is required. Download and install the
-<ulink url="http://download.openlinksw.com/packages/5.0/virtuoso/rdf_mappers_dav.vad">RDF Mappers VAD</ulink>
-package using the Conductor System Admin - > Packages tab.
-    <figure id="fctinst2" float="1">
-      <title>Install the RDF Mappers package</title>
-      <graphic fileref="ui/fctinst2.png"/>
-        </figure>
-</listitem>
-  <listitem>The HTML interface of the Faceted Browser Engine is exposed at: <emphasis>http://<cname>/fct</emphasis>,
-where "cname" is the hostname:portno your Virtuoso instance is running on.
-    <figure id="fctinst3" float="1">
-      <title>FCT HTML interface</title>
-      <graphic fileref="ui/fctinst3.png"/>
-        </figure>
-</listitem>
-  <listitem>The Facet Browser Engine exposes a REST API at the endpoint:
-<emphasis>http://<cname>/fct/service</emphasis>.
-  <tip><title>See Also:</title>
-    <itemizedlist mark="bullet">
-      <listitem><link linkend="virtuosospongerfacentuirestapi">Virtuoso APIs for Facet REST services</link></listitem>
-      <listitem><link linkend="rdfiridereferencingfacetws">Facets Web Service and Linked Data</link></listitem>
-    </itemizedlist>
-  </tip>
-</listitem>
-</orderedlist>
-</sect4>
-<sect4 id="virtuosospongerfacetinstallposinst">
-<title>Post Installation</title>
-<orderedlist>
-  <listitem>Build Full Text Indexes by running the following commands using the Virtuoso
-<emphasis>isql</emphasis> program:
+        <para>As result the response should be:</para>
 <programlisting><![CDATA[
-RDF_OBJ_FT_RULE_ADD (null, null, 'All');
-VT_INC_INDEX_DB_DBA_RDF_OBJ ();
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
+<HTML>
+<HEAD>
+  <TITLE>201 Created</TITLE>
+</HEAD>
+<BODY>
+  <H1>Created</H1>
+  Resource /DAV/home/demo/rdf_sink/ myfoaf.rdf has been created.
+</BODY>
+</HTML>
 ]]></programlisting>
-</listitem>
-  <listitem>Run the following procedure using the Virtuoso <emphasis>isql</emphasis> program to
-populate label lookup tables periodically and activate the <emphasis>Label</emphasis> text box of the
-<emphasis>URI Lookup(by Label)</emphasis> tab:
+    <para>Then you can execute:</para>
 <programlisting><![CDATA[
-urilbl_ac_init_db()
+curl -F "query=SELECT DISTINCT ?p FROM <http://demo.openlinksw.com/DAV/home/demo/rdf_sink/> WHERE {?s ?p ?o}" http://demo.openlinksw.com/sparql
 ]]></programlisting>
-</listitem>
-  <listitem>Run the following procedure using the Virtuoso <emphasis>isql</emphasis> program to calculate the IRI ranks.
-Note this should be run periodically as the data grows to re-rank the IRIs.
+    <para>The result should be:</para>
 <programlisting><![CDATA[
-s_rank()
+<?xml version="1.0" ?>
+<sparql xmlns="http://www.w3.org/2005/sparql-results#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/sw/DataAccess/rf1/result2.xsd">
+ <head>
+  <variable name="p"/>
+ </head>
+ <results distinct="false" ordered="true">
+  <result>
+   <binding name="p"><uri>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</uri></binding>
+  </result>
+  <result>
+   <binding name="p"><uri>http://xmlns.com/foaf/0.1/nick</uri></binding>
+  </result>
+  <result>
+   <binding name="p"><uri>http://xmlns.com/foaf/0.1/name</uri></binding>
+  </result>
+  <result>
+   <binding name="p"><uri>http://xmlns.com/foaf/0.1/homepage</uri></binding>
+  </result>
+  <result>
+   <binding name="p"><uri>http://xmlns.com/foaf/0.1/knows</uri></binding>
+  </result>
+  <result>
+   <binding name="p"><uri>http://xmlns.com/foaf/0.1/workplaceHomepage</uri></binding>
+  </result>
+  <result>
+   <binding name="p"><uri>http://xmlns.com/foaf/0.1/mbox</uri></binding>
+  </result>
+ </results>
+</sparql>
 ]]></programlisting>
-</listitem>
-  <listitem>Sponge some data to load some RDF triples in the quad store. This can easily be done using
-the Virtuoso <emphasis>description.vsp</emphasis> page which provides a hypertext description of RDF Linked Data, by describing
-the following page for example (or one of your choice):
+<para>Other examples with curl:</para>
 <programlisting><![CDATA[
-http://cname/about/html/http/news.cnet.com
+curl -F "query=SELECT distinct ?Concept FROM <http://dbpedia.org> WHERE {?s a ?Concept} limit 10" http://dbpedia.org/sparql
 ]]></programlisting>
-    <figure id="fctinst4" float="1">
-      <title>Sponge data</title>
-      <graphic fileref="ui/fctinst4.png"/>
-    </figure>
-</listitem>
-  <listitem>Use the Facet Browser Search and Find User Interface to search for information on "CNET"
-    <figure id="fctinst5" float="1">
-      <title>Facet Browser Search</title>
-      <graphic fileref="ui/fctinst5.png"/>
-    </figure>
-</listitem>
-  <listitem>Results of the following form should be returned for the data sponged.
-    <figure id="fctinst6" float="1">
-      <title>Facet Browser Search Results</title>
-      <graphic fileref="ui/fctinst6.png"/>
-    </figure>
-</listitem>
-  <listitem>Click "Types" link shown at the right vertical Navigation</listitem>
-  <listitem>Results of the classes/properties should be returned:
-    <figure id="fctinst7" float="1">
-      <title>Results of the classes/properties</title>
-      <graphic fileref="ui/fctinst7.png"/>
-    </figure>
-</listitem>
-  <listitem>To exclude a type unhatch the checkbox associated with the type:
-    <figure id="fctinst8" float="1">
-      <title>Exclude Type(s)</title>
-      <graphic fileref="ui/fctinst8.png"/>
-    </figure>
-</listitem>
-  <listitem>Click the Type URI link</listitem>
-  <listitem>Results of excluding the Type(s) should be shown:
-    <figure id="fctinst9" float="1">
-      <title>Results of Excluded Type(s)</title>
-      <graphic fileref="ui/fctinst9.png"/>
-    </figure>
-</listitem>
-  <listitem>The Facet Browser Web service endpoint can also be queried to obtain the same results:
 <programlisting><![CDATA[
-$ more cnet.xml
-<?xml version="1.0"?>
-<query xmlns="http://openlinksw.com/services/facets/1.0" inference="" same-as="">
-  <text>CNET</text>
-  <view type="text" limit="20" offset=""/>
-</query>
+curl -F "query=SELECT distinct ?Concept FROM <http://myopenlink.net/dataspace/person/kidehen> WHERE {?s a ?Concept} limit 10" http://demo.openlinksw.com/sparql
+]]></programlisting>
+<programlisting><![CDATA[
+curl -F "query=SELECT distinct ?Concept FROM <http://data.openlinksw.com/oplweb/product_family/virtuoso> WHERE {?s a ?Concept} limit 10" http://demo.openlinksw.com/sparql
+]]></programlisting>
+<programlisting><![CDATA[
+curl -F "query=SELECT distinct ?Concept FROM <http://openlinksw.com/dataspace/organization/openlink> WHERE {?s a ?Concept} limit 10" http://demo.openlinksw.com/sparql
+]]></programlisting>
+    </sect2>
+     <sect2 id="rdfinsertmethodsload"><title>SPARQL Insert using LOAD</title>
+        <para>SPARQL INSERT operation can be done using the LOAD feature.</para>
+        <para><emphasis>Example:</emphasis></para>
+        <para>Execute from ISQL:</para>
+<programlisting><![CDATA[
+SPARQL insert in graph <http://mygraph.com>
+    {
+  <http://myopenlink.net/dataspace/Kingsley#this>
+  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
+  <http://rdfs.org/sioc/ns#User> .
 
-$ curl -H "Content-Type: text/xml" -d @cnet.xml  http://cname/fct/service
-<fct:facets xmlns:fct="http://openlinksw.com/services/facets/1.0/">
-<fct:sparql>    SELECT ?s1 as ?c1, (bif:search_excerpt (bif:vector ('CNET'), ?o1)) as ?c2, ?sc, ?rank WHERE {{{ SELECT ?s1, (?sc * 3e-1) as ?sc, ?o1, (sql:rnk_scale (<LONG::IRI_RANK> (?s1))) as ?rank  WHERE { ?s1 ?s1textp ?o1 . ?o1 bif:contains  '"CNET"'  option (score ?sc)  . } ORDER BY DESC (?sc * 3e-1 + sql:rnk_scale (<LONG::IRI_RANK> (?s1)))  LIMIT 20  OFFSET 0 }}}</fct:sparql>
-<fct:time>16</fct:time>
-<fct:complete>yes</fct:complete>
-<fct:timeout>0</fct:timeout>
-<fct:db-activity>   131R rnd     36R seq      0P disk      0B /      0 messages</fct:db-activity>
- <fct:result type="text">
-  <fct:row>
-    <fct:column datatype="trank">4.5</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.com">http://news.com</fct:column>
-    <fct:column>Technology News - CNET News</fct:column>
-    <fct:column><span class="srch_xerpt"><b>CNET</b> News.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">4.5</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.cnet.com/2547-1_3-0-20.xml">http://news.cnet.com/2547-1_3-0-20.xml</fct:column>
-    <fct:column>CNET News.com</fct:column>
-    <fct:column><span class="srch_xerpt"><b>CNET</b> News.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">4.5</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.cnet.com">http://news.cnet.com</fct:column>
-    <fct:column>Technology News - CNET News</fct:column>
-    <fct:column><span class="srch_xerpt"><b>CNET</b> News.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">3.9</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.com">http://news.com</fct:column>
-    <fct:column>Technology News - CNET News</fct:column>
-    <fct:column><span class="srch_xerpt">Technology News <b>CNET</b> News.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">3.9</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.cnet.com">http://news.cnet.com</fct:column>
-    <fct:column>Technology News - CNET News</fct:column>
-    <fct:column><span class="srch_xerpt">Technology News <b>CNET</b> News.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">3</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.com">http://news.com</fct:column>
-    <fct:column>Technology News - CNET News</fct:column>
-    <fct:column><span class="srch_xerpt">Tech news and business reports by <b>CNET</b> News.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">3</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.cnet.com/2547-1_3-0-20.xml">http://news.cnet.com/2547-1_3-0-20.xml</fct:column>
-    <fct:column>CNET News.com</fct:column>
-    <fct:column><span class="srch_xerpt">Tech news and business reports by <b>CNET</b> News.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">3</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.cnet.com">http://news.cnet.com</fct:column>
-    <fct:column>Technology News - CNET News</fct:column>
-    <fct:column><span class="srch_xerpt">Tech news and business reports by <b>CNET</b> News.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">3</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.com#6">http://news.com#6</fct:column>
-    <fct:column>There's an electric car in your future</fct:column>
-    <fct:column><span class="srch_xerpt">... <b>CNET</b> Car Tech posts photos of electric cars expected to come out by 2011.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">3</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.cnet.com/2547-1_3-0-20.xml#9">http://news.cnet.com/2547-1_3-0-20.xml#9</fct:column>
-    <fct:column>There's an electric car in your future</fct:column>
-    <fct:column><span class="srch_xerpt">... <b>CNET</b> Car Tech posts photos of electric cars expected to come out by 2011.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">3</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.cnet.com#9">http://news.cnet.com#9</fct:column>
-    <fct:column>There's an electric car in your future</fct:column>
-    <fct:column><span class="srch_xerpt">... <b>CNET</b> Car Tech posts photos of electric cars expected to come out by 2011.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">3</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.com#6">http://news.com#6</fct:column>
-    <fct:column>There's an electric car in your future</fct:column>
-    <fct:column><span class="srch_xerpt">... <b>CNET</b> Car Tech posts photos of electric cars expected to come out by 2011.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">3</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.cnet.com/2547-1_3-0-20.xml#9">http://news.cnet.com/2547-1_3-0-20.xml#9</fct:column>
-    <fct:column>There's an electric car in your future</fct:column>
-    <fct:column><span class="srch_xerpt">... <b>CNET</b> Car Tech posts photos of electric cars expected to come out by 2011.</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="trank">3</fct:column>
-    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
-    <fct:column datatype="url" shortform="http://news.cnet.com#9">http://news.cnet.com#9</fct:column>
-    <fct:column>There's an electric car in your future</fct:column>
-    <fct:column><span class="srch_xerpt">... <b>CNET</b> Car Tech posts photos of electric cars expected to come out by 2011.</span></fct:column>
-  </fct:row>
- </fct:result>
-</fct:facets>
+  <http://myopenlink.net/dataspace/Kingsley#this>
+  <http://rdfs.org/sioc/ns#id>
+  <Kingsley> .
+
+  <http://myopenlink.net/dataspace/Caroline#this>
+  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
+  <http://rdfs.org/sioc/ns#User> .
+
+ <http://myopenlink.net/dataspace/Caroline#this>
+  <http://rdfs.org/sioc/ns#id>
+  <Caroline> .
+
+   <http://myopenlink.net/dataspace/Matt#this>
+  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
+  <http://rdfs.org/sioc/ns#User> .
+
+  <http://myopenlink.net/dataspace/Matt#this>
+  <http://rdfs.org/sioc/ns#id>
+  <Matt> .
+
+   <http://myopenlink.net/dataspace/demo#this>
+  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
+  <http://rdfs.org/sioc/ns#User> .
+
+  <http://myopenlink.net/dataspace/demo#this>
+  <http://rdfs.org/sioc/ns#id>
+  <demo> .};
 ]]></programlisting>
-</listitem>
-  <listitem>In the <emphasis>Label</emphasis> text box of the <emphasis>URI Lookup (by Label)</emphasis>
-tab enter the name of a rdfs label to be <emphasis>Describe</emphasis>'d:
-    <figure id="fctinst10" float="1">
-      <title>Query Facet Browser Web service endpoint</title>
-      <graphic fileref="ui/fctinst10.png"/>
-    </figure>
-</listitem>
-  <listitem>Select a URI from the list of available Labels to obtain a description of the URI:
-    <figure id="fctinst11" float="1">
-      <title>Select a URI from the list of available Labels</title>
-      <graphic fileref="ui/fctinst11.png"/>
-    </figure>
-</listitem>
-  <listitem>In the <emphasis>URI</emphasis> text box of the <emphasis>URI Lookup</emphasis> tab enter
-the name URI to be <emphasis>Describe</emphasis>'d:
-    <figure id="fctinst12" float="1">
-      <title>Enter URI</title>
-      <graphic fileref="ui/fctinst12.png"/>
-    </figure>
-</listitem>
-  <listitem>Select a URI from the list of available Labels to obtain a description of the URI:
-    <figure id="fctinst13" float="1">
-      <title>Obtain a description of the URI</title>
-      <graphic fileref="ui/fctinst13.png"/>
-    </figure>
-</listitem>
-  <listitem>If data is loaded into the quad store via DML functions (TTLP, RDF_LOAD_RDFXML etc.) the
-following procedure needs to run from <emphasis>isql</emphasis> to build the free text indexes required each time:
+        <para>Create DAV collection which is visible to public, for ex: http://localhost:8890/DAV/tmp</para>
+        <para>Upload to the DAV collection the following file for ex. with name listall.rq and with the following content:</para>
 <programlisting><![CDATA[
-VT_INC_INDEX_DB_DBA_RDF_OBJ ()
+SPARQL
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX sioc: <http://rdfs.org/sioc/ns#>
+SELECT ?x ?p ?o
+FROM <http://mygraph.com>
+WHERE
+       {
+    ?x rdf:type sioc:User .
+    ?x ?p ?o.
+    ?x sioc:id ?id .
+    FILTER REGEX(str(?id), "^King")
+  }
+ORDER BY ?x
 ]]></programlisting>
-</listitem>
-</orderedlist>
-</sect4>
-<sect4 id="virtuosospongerfaceusagest">
-<title>Usage Statistics</title>
-<orderedlist>
-   <listitem>Use the Faceted Browser Search and Find User Interface to search for information on "Michael Jackson":
-     <figure id="VirtFacetUsage1" float="1">
-       <title>Usage Statistics</title>
-       <graphic fileref="ui/VirtFacetUsage1.png"/>
-     </figure>
-   </listitem>
-   <listitem>Results of the following form should be returned for the data sponged:
-     <figure id="VirtFacetUsage2" float="1">
-       <title>Usage Statistics</title>
-       <graphic fileref="ui/VirtFacetUsage2.png"/>
-     </figure>
-   </listitem>
-   <listitem>Click the "Types" link under "Navigation"
-   </listitem>
-   <listitem>Results about "Michael Jackson" as Type/Label/Count list should be returned.
-   </listitem>
-   <listitem>Click a type link, for ex.:
+        <para>Now from ISQL execute the following command:</para>
 <programlisting><![CDATA[
-dbpedia-owl:Artist
+SQL>SPARQL
+load bif:concat ("http://", bif:registry_get("URIQADefaultHost"), "/DAV/tmp/listall.rq") into graph <http://myNewGraph.com>;
 ]]></programlisting>
-     <figure id="VirtFacetUsage8" float="1">
-       <title>Usage Statistics</title>
-       <graphic fileref="ui/VirtFacetUsage8.png"/>
-     </figure>
-   </listitem>
-   <listitem>Should be shown type results and:
+        <para>As result should be shown:</para>
 <programlisting><![CDATA[
-Displaying types of e1 where:
-e1 has any property whose value contains "Michael Jackson".
+callret-0
+VARCHAR
+_______________________________________________________________________________
 
-e1 is a dbpedia-owl:Artist . Drop
+Load <http://localhost:8890/DAV/tmp/listall.rq> into graph <http://myNewGraph.com> -- done
+
+1 Rows. -- 321 msec.
 ]]></programlisting>
-     <figure id="VirtFacetUsage9" float="1">
-       <title>Usage Statistics</title>
-       <graphic fileref="ui/VirtFacetUsage9.png"/>
-     </figure>
-   </listitem>
-   <listitem>Click the "Show values" link under "Navigation"
-   </listitem>
-   <listitem>Results should be shown for "Michael Jackson" as values and text summaries associated with pattern:
+    </sect2>
+     <sect2 id="rdfindertmethodsparqlendpoint"><title>SPARQL Insert via /sparql endpoint</title>
+        <para>SPARQL INSERT operation can be sent to a web service endpoint as a single statement and executed in sequence.</para>
+        <para><emphasis>Example:</emphasis></para>
+        <para>Using the Virtuoso ISQL tool or using the /sparql UI at http://host:port/sparql, execute the following:</para>
+<itemizedlist>
+<listitem>Insert into graph http://BookStore.com 3 triples:
 <programlisting><![CDATA[
-Displaying values and text summaries associated with pattern e1 where:
-e1 has any property whose value contains "Michael Jackson".
-e1 is a dbpedia-owl:Artist . Drop
+SQL>SPARQL insert in graph <http://BookStore.com>
+{ <http://www.dajobe.org/foaf.rdf#i> <http://purl.org/dc/elements/1.1/date> <1999-04-01T00:00:00> .
+  <http://www.w3.org/People/Berners-Lee/card#i> <http://purl.org/dc/elements/1.1/date> <1998-05-03T00:00:00> .
+  <http://www.w3.org/People/Connolly/#me> <http://purl.org/dc/elements/1.1/date> <2001-02-08T00:00:00> };
 ]]></programlisting>
    </listitem>
-   <listitem>Click the link:
+<listitem>As result will be shown the message:
 <programlisting><![CDATA[
-dbpedia:Michael_Jackson
+SQL>Insert into <http://BookStore.com>
+3 triples -- done
 ]]></programlisting>
-     <figure id="VirtFacetUsage10" float="1">
-       <title>Usage Statistics</title>
-       <graphic fileref="ui/VirtFacetUsage10.png"/>
-     </figure>
-   </listitem>
-   <listitem>Results about "Michael Jackson" as property/value list should be returned:
-     <figure id="VirtFacetUsage3" float="1">
-       <title>Usage Statistics</title>
-       <graphic fileref="ui/VirtFacetUsage3.png"/>
-     </figure>
-   </listitem>
-   <listitem>Click the "Usage Statistics" link under "Actions" shown right of the list.
    </listitem>
-   <listitem>Results of usage statistics for "Michael Jackson" grouped in 4 tabs should be shown:
-<orderedlist>
-   <listitem>Referenced by Graphs: shows how many times the URI is found as subject in the relevant graph(s):
+<listitem>Next we will select all triples from the graph http://BookStore.com:
 <programlisting><![CDATA[
-SPARQL
-SELECT ?g count (*)
-where
-    {
-    graph ?g { <URI> ?p ?o }
-    }
-group by ?g
-order by desc 2
-limit 20
+SQL>SPARQL SELECT * FROM <http://BookStore.com> WHERE {?s ?p ?o};
 ]]></programlisting>
-     <figure id="VirtFacetUsage4" float="1">
-       <title>Usage Statistics</title>
-       <graphic fileref="ui/VirtFacetUsage4.png"/>
-     </figure>
    </listitem>
-   <listitem>Source Graphs:  shows how many times the URI is found as object in the relevant graph(s):
+<listitem>As result will be shown:
 <programlisting><![CDATA[
-SPARQL
-SELECT ?g count (*)
-where
-    {
-    graph ?g { ?s ?p <URI>  }
-    }
-group by ?g
-order by desc 2
-limit 20
+s                                              p                                       o
+VARCHAR                                        VARCHAR                                 VARCHAR
+_______________________________________________________________________________
+
+http://www.w3.org/People/Berners-Lee/card#i    http://purl.org/dc/elements/1.1/date    1998-05-03T00:00:00
+http://www.w3.org/People/Connolly/#me          http://purl.org/dc/elements/1.1/date    2001-02-08T00:00:00
+http://www.dajobe.org/foaf.rdf#i               http://purl.org/dc/elements/1.1/date    1999-04-01T00:00:00
+
+3 Rows. -- 0 msec.
+
 ]]></programlisting>
-     <figure id="VirtFacetUsage5" float="1">
-       <title>Usage Statistics</title>
-       <graphic fileref="ui/VirtFacetUsage5.png"/>
-     </figure>
    </listitem>
-   <listitem>Direct co-references: shows results as subject and calculated rank, based on running transitive closure over owl:sameAs of the URI in subject or object:
+<listitem>Now let's insert into graph another http://NewBookStore.com graph's values:
 <programlisting><![CDATA[
-SPARQL
-SELECT ?syn ( sql:rnk_scale (<LONG::IRI_RANK> (?syn)))
-where
-{
-    { SELECT ?s ?syn
-      where
-       {
-         {?syn owl:sameAs ?s } union {?s owl:sameAs ?syn}
-       }
-    }
-    option (transitive, t_distinct, t_min (0), T_in (?s), t_out (?syn)) . filter (!isliteral (?syn) && ?s = <URI> )
-  }
-order by desc 2
-limit 20
+SQL>SPARQL
+PREFIX dc:  <http://purl.org/dc/elements/1.1/>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+INSERT INTO GRAPH <http://NewBookStore.com> { ?book ?p ?v }
+WHERE
+  { GRAPH  <http://BookStore.com>
+   { ?book dc:date ?date
+     FILTER ( xsd:dateTime(?date) < xsd:dateTime("2000-01-01T00:00:00")).
+     ?book ?p ?v.
+   }
+  };
 ]]></programlisting>
-     <figure id="VirtFacetUsage6" float="1">
-       <title>Usage Statistics</title>
-       <graphic fileref="ui/VirtFacetUsage6.png"/>
-     </figure>
    </listitem>
-   <listitem>Indirect co-references: shows expanded results for objects concur with the URI by IFP:
+<listitem>As result will be shown:
 <programlisting><![CDATA[
-SPARQL
-SELECT distinct ?syn ?p ?o (sql:rnk_scale (<LONG::IRI_RANK> (?syn)))
-where
-  { <URI> ?p ?o .  filter (0 != (<LONG::bif:rdf_is_sub> ("b3sifp", ?p, lod:ifp_like, 3))) .
-    ?syn ?p ?o .
-}
-order by desc 4
-limit 20
+callret-0
+VARCHAR
+_______________________________________________________________________________
+
+Insert into <http://NewBookStore.com>, 2 triples -- done
 ]]></programlisting>
-     <figure id="VirtFacetUsage7" float="1">
-       <title>Usage Statistics</title>
-       <graphic fileref="ui/VirtFacetUsage7.png"/>
-     </figure>
-   </listitem>
-</orderedlist>
    </listitem>
-</orderedlist>
-</sect4>
-<sect4 id="virtuosospongerfacetexample"><title>Examples</title>
-<para><emphasis>Example for Use Faceted Navigation to Explore Virtuoso hosted Linked Data</emphasis></para>
-<para>The following example demonstrates a simple scenario of tracking Kingsley Idehen's conversations $
-across the Web, using the Virtuoso Faceted Browser hosted on URIBurner.</para>
-<orderedlist>
-   <listitem>Go to http://uriburner.com/fct/
-     <figure id="fct1" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct1.png"/>
-     </figure>
-   </listitem>
-   <listitem>Enter a free text search pattern (for example, "Kingsley Idehen"), and click Search
-     <figure id="fct2" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct2.png"/>
-     </figure>
+<listitem>Finally we will check the triples from the graph NewBookStore.com:
+<programlisting><![CDATA[
+SQL> SPARQL
+SELECT *
+FROM <http://NewBookStore.com>
+WHERE {?s ?p ?o};
+]]></programlisting>
    </listitem>
-   <listitem>Your initial query results page will display a list of literal value snippets from property
-values associated with the query text pattern
-     <figure id="fct3" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct3.png"/>
-     </figure>
+<listitem>As result will be shown:
+<programlisting><![CDATA[
+s                                             p                                      o
+VARCHAR                                       VARCHAR                                VARCHAR
+_______________________________________________________________________________
+
+http://www.w3.org/People/Berners-Lee/card#i   http://purl.org/dc/elements/1.1/date   1998-05-03T00:00:00
+http://www.dajobe.org/foaf.rdf#i              http://purl.org/dc/elements/1.1/date   1999-04-01T00:00:00
+
+2 Rows. -- 10 msec.
+]]></programlisting>
    </listitem>
-   <listitem>Using the Navigation section on the right, click on "Types", which alters the contents
-of the query results area by presenting CURIE based hyperlinks for each of the Entity Types associated
-with Property values that contains the query text pattern
-     <figure id="fct4" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct4.png"/>
-     </figure>
+</itemizedlist>
+</sect2>
+     <sect2 id="rdfinsertmethodsparqlqueryandodswiki"><title>SPARQL Insert via HTTP Post using Content-Type: application/sparql-query and ODS wiki</title>
+        <para>With HTTP Post and ODS wiki can be written an rdf document and respectively to be performed over it INSERT/UPDATE action.</para>
+        <para>You can write to a file using SIOC terms for ODS-Wiki</para>
+        <para>You can check with sparql the inserted / updated triples in the Quad Store.</para>
+        <para><emphasis>Example:</emphasis></para>
+        <para>Suppose there is ODS user test3 with ODS password 1, which has testWiki wiki instance.</para>
+        <para>Execute the following:</para>
+<programlisting><![CDATA[
+curl -i -d "INSERT {<http://localhost:8890/dataspace/test3/wiki/testWiki> <http://atomowl.org/ontologies/atomrdf#contains> <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://rdfs.org/sioc/ns#has_container> <http://localhost:8890/dataspace/test3/wiki/testWiki> . <http://localhost:8890/dataspace/test3/wiki/testWiki> <http://atomowl.org/ontologies/atomrdf#entry> <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> . <http://localhost:8890/dataspace/test3/wiki/testWiki> <http://rdfs.org/sioc/ns#container_of> <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://rdfs.org/sioc/ns#topic>  <http://localhost:8890/dataspace/test3/wiki/testWiki> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://atomowl.org/ontologies/atomrdf#source> <http://localhost:8890/dataspace/test3/wiki/testWiki> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/types#Comment> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://atomowl.org/ontologies/atomrdf#Entry> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://www.w3.org/2000/01/rdf-schema#label> 'MyTest' . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://atomowl.org/ontologies/atomrdf#Link> . <http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://rdfs.org/sioc/ns#content> <test>}" -u "test3:1" -H "Content-Type: application/sparql-query" http://localhost:8890/DAV/home/test3/wiki/testWiki/MyTest
+]]></programlisting>
+        <para>As result we should have 2 files created:</para>
+<itemizedlist>
+<listitem>In the user DAV folder "DAV/home/test3/wiki/testWiki/" will be created a file "MyTest" with type "application/sparql-query". You can view the content of this file from the Conductor UI or from the user's Briefcase UI, path "DAV/home/test3/wiki/testWiki". Its content will be:
+<programlisting><![CDATA[
+<?xml version="1.0" encoding="utf-8" ?>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
+<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki"><ns0pred:entry xmlns:ns0pred="http://atomowl.org/ontologies/atomrdf#" rdf:resource="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"/></rdf:Description>
+<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:label xmlns:ns0pred="http://www.w3.org/2000/01/rdf-schema#">MyTest</ns0pred:label></rdf:Description>
+<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:type xmlns:ns0pred="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:resource="http://atomowl.org/ontologies/atomrdf#Link"/></rdf:Description>
+<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:type xmlns:ns0pred="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:resource="http://rdfs.org/sioc/types#Comment"/></rdf:Description>
+<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:type xmlns:ns0pred="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:resource="http://atomowl.org/ontologies/atomrdf#Entry"/></rdf:Description>
+<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:has_container xmlns:ns0pred="http://rdfs.org/sioc/ns#" rdf:resource="http://localhost:8890/dataspace/test3/wiki/testWiki"/></rdf:Description>
+<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki"><ns0pred:container_of xmlns:ns0pred="http://rdfs.org/sioc/ns#" rdf:resource="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"/></rdf:Description>
+<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki"><ns0pred:contains xmlns:ns0pred="http://atomowl.org/ontologies/atomrdf#" rdf:resource="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"/></rdf:Description>
+<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:content xmlns:ns0pred="http://rdfs.org/sioc/ns#">test</ns0pred:content></rdf:Description>
+<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:topic xmlns:ns0pred="http://rdfs.org/sioc/ns#" rdf:resource="http://localhost:8890/dataspace/test3/wiki/testWiki"/></rdf:Description>
+<rdf:Description rdf:about="http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest"><ns0pred:source xmlns:ns0pred="http://atomowl.org/ontologies/atomrdf#" rdf:resource="http://localhost:8890/dataspace/test3/wiki/testWiki"/></rdf:Description>
+</rdf:RDF>
+]]></programlisting>
    </listitem>
-   <listitem>Click on the "foaf:Person" link to narrow the result set down to Entities of this Type,
-un-hatch the checkbox beside this link for Negation (filtering out) based on this Entity Type
-     <figure id="fct5" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct5.png"/>
-     </figure>
+<listitem>To the user's wiki instance will be added a new WikiWord "MyTest" with content the value of the SIOC term attribute "content":
+<programlisting><![CDATA[
+<http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest> <http://rdfs.org/sioc/ns#content> <test>
+i.e. the content will be "test".
+]]></programlisting>
    </listitem>
-   <listitem>You can filter further, by switching (pivoting) to the a Property based view, by returning
-to the Navigation section and then clicking on "Properties" or "Referencing Properties" links; in either
-case, you have further filtering of based on the combination of Properties and Entities where Entities
-in the result-set contain values matching the query text pattern
-     <figure id="fct6" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct6.png"/>
-     </figure>
+</itemizedlist>
+        <para>Now let's check what data was inserted in the Quad Store:</para>
+<itemizedlist>
+<listitem>Go to the sparql endpoint, i.e. for ex. to http://localhost:8890/sparql</listitem>
+<listitem>Enter for Default Graph URI:
+<programlisting><![CDATA[
+http://localhost:8890/DAV/home/test3/wiki/testWiki/MyTest
+]]></programlisting>
    </listitem>
-   <listitem>From the list of Property Types, click on the "foaf:interest" link to filter further,
-based on the values of this property
-     <figure id="fct7" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct7.png"/>
-     </figure>
+<listitem>Enter for Query text:
+<programlisting><![CDATA[
+SELECT * WHERE {?s ?p ?o}
+]]></programlisting>
    </listitem>
-   <listitem>From the list of "foaf:interest" Values, click on "dbpedia:Linked_Data", which filters
-the result-set further to display reveal Entity Identifier Links (Generic HTTP URIs) and Labels for
-each "foaf:Person" associated with the property "foaf:interest", in the URIBurner data space. At
-the time of writing guide, there is only one Entity of Type: foaf:person, and the Generic HTTP URI
-for this Entity is: http:///www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this.
-     <figure id="fct8" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct8.png"/>
-     </figure>
+<listitem>Click the "Run Query" button.</listitem>
+<listitem>As result will be shown the inserted triples:
+<programlisting><![CDATA[
+s  	                                                    p  	                                             o
+http://localhost:8890/dataspace/test3/wiki/testWiki 	    http://rdfs.org/sioc/ns#container_of 	     http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest
+http://localhost:8890/dataspace/test3/wiki/testWiki 	    http://atomowl.org/ontologies/atomrdf#entry      http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest
+http://localhost:8890/dataspace/test3/wiki/testWiki 	    http://atomowl.org/ontologies/atomrdf#contains   http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest
+http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://www.w3.org/1999/02/22-rdf-syntax-ns#type  http://rdfs.org/sioc/types#Comment
+http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://www.w3.org/1999/02/22-rdf-syntax-ns#type  http://atomowl.org/ontologies/atomrdf#Entry
+http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://www.w3.org/1999/02/22-rdf-syntax-ns#type  http://atomowl.org/ontologies/atomrdf#Link
+http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://www.w3.org/2000/01/rdf-schema#label 	     MyTest
+http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://rdfs.org/sioc/ns#has_container 	     http://localhost:8890/dataspace/test3/wiki/testWiki
+http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://rdfs.org/sioc/ns#content 	             test
+http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://rdfs.org/sioc/ns#topic 	             http://localhost:8890/dataspace/test3/wiki/testWiki
+http://localhost:8890/dataspace/test3/wiki/testWiki/MyTest  http://atomowl.org/ontologies/atomrdf#source     http://localhost:8890/dataspace/test3/wiki/testWiki
+]]></programlisting>
    </listitem>
-   <listitem>Click on one of the HTTP URIs in the filtered results-set to obtain a detailed structured
-description of a given Entity. Each listed Property is a Link; thus, each Property is a link to other
-structured Entity descriptions
-     <figure id="fct9" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct9.png"/>
+</itemizedlist>
+    </sect2>
+    <sect2 id="rdfinsertmethodwebdav">
+      <title>Using WebDAV</title>
+      <para> Example using WebDAV (mount folder to DAV and dump; if this is the rdf_sink
+the Quad Store is updated automatically, or you can load from DAV manually to quad store)</para>
+      <para><emphasis>Example:</emphasis></para>
+      <para><emphasis>Example 1: Using ODS Briefcase</emphasis></para>
+      <itemizedlist>
+        <listitem>Go to your ods location, for ex. http://localhost:8890/ods</listitem>
+        <listitem>Register user, for ex. user test1</listitem>
+        <listitem>Login if not already in ods</listitem>
+        <listitem>Go to ODS -> Briefcase</listitem>
+        <listitem>Go to ODS -> Briefcase</listitem>
+        <listitem>Click the "New folder" icon from the Main Briefcase horizontal navigation</listitem>
+        <listitem>Enter for name for ex. "mytest" and click the "Create" button.
+          <figure id="uc6" float="1">
+	    <title>Using Briefcase UI</title>
+	    <graphic fileref="ui/uc6.png"/>
      </figure>
    </listitem>
-   <listitem>Click on "Usage Statistics" link to get a summary view of this Linked Data Space,
-"Reference" and "Source" graphs are akin to saying "Table X" and "Table Y" where each table
-is the container of Records re. RDBMS or Worksheet re. Spreadsheet.:
-     <figure id="fct10" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct10.png"/>
-     </figure>
-     <figure id="fct11" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct11.png"/>
-     </figure>
-   </listitem>
-   <listitem>"Direct" and "In-Direct" co-references show other references (Identifiers) that relate
-associated with Kingsley Idehen (like saying: here are his other names or his know by this name in
-this other place)
-     <figure id="fct12" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct12.png"/>
-     </figure>
-     <figure id="fct13" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct13.png"/>
-     </figure>
-   </listitem>
-   <listitem>Click on "Settings" check "owl:sameAs" and it sets a context mode for the session
-(meaning: a set of rules to take place)
-     <figure id="fct14" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct14.png"/>
-     </figure>
-   </listitem>
-   <listitem>Go back to the "Direct Co-reference" tab
-     <figure id="fct15" float="1">
-       <title>Faceted Navigation Example</title>
-       <graphic fileref="ui/fct15.png"/>
+        <listitem>Go to folder "mytest" and click the click the "Upload" icon from the Main Briefcase horizontal navigation</listitem>
+        <listitem>Enter for name for ex. "mytest" and click the "Create" button.
+          <figure id="uc7" float="1">
+	    <title>Using Briefcase UI</title>
+	    <graphic fileref="ui/uc7.png"/>
      </figure>
 </listitem>
-   <listitem>As result each link will unveil a union (combination) of all the the data associated
-with all Kingsley Idehen's other Identifiers (other Names in other places), i.e., they all show the
-same data.</listitem>
-</orderedlist>
-</sect4>
-</sect3>
-<sect3 id="virtuosospongerfacent">
-<title>Virtuoso Facets Web Service</title>
-<para>The Virtuoso Facets web service is a general purpose RDF query facility for facet based browsing.
-It takes an XML description of the view desired and generates the reply as an XML tree containing the
-requested data. The user agent or a local web page can use XSLT for rendering this for the end user.
-The selection of facets and values is represented as an XML tree. The rationale for this is the fact
-that such a representation is easier to process in an application than the SPARQL source text or a
-parse tree of SPARQL and more compactly captures the specific subset of SPARQL needed for faceted
-browsing. The web service returns the SPARQL source text also, thus this can serve as a basis for
-and-crafted queries.</para>
-<para>The top element of the tree is <query>, it must be in namespace
-"http://openlinksw.com/services/facets/1.0/".</para>
-<para>This has the following attributes:</para>
-<itemizedlist mark="bullet">
-  <listitem>graph="graph_iri" - default is search in all graphs but system defaults may override this</listitem>
-  <listitem>timeout="no_of_msec" - default is no timeout, but system defaults may override this</listitem>
-  <listitem>inference="name" where name is a name of an inference context declared with rdfs_rule_set.</listitem>
-  <listitem>same-as="boolean" - If "boolean" is "yes", then owl:sameAs links will be considered in the query evaluation.</listitem>
-</itemizedlist>
-<para>The result is a tree of the form:</para>
+        <listitem>In the shown form set:
+          <itemizedlist>
+            <listitem>Destination: RDF Store</listitem>
+            <listitem>RDF graph name for ex. with the value: http://localhost:8890/DAV/home/test2/mytest/</listitem>
+            <listitem>Select URL or File. For ex. you can select the following file with name jose.rdf:
 <programlisting><![CDATA[
-<facets xmlns="http://openlinksw.com/services/facets/1.0/">
-<result><row><column datatype="..." shortform="..." xml:lang="..">...</column></row></result>
-<time>msecs</time>
-<complete>yes or no</complete>
-<db-activity>resource use string</db-activity>
-<sparql>sparql statement text</sparql>
-</facets>
+<rdf:RDF xmlns="http://www.example/jose/foaf.rdf#"
+    xmlns:foaf="http://xmlns.com/foaf/0.1/"
+    xmlns:log="http://www.w3.org/2000/10/swap/log#"
+    xmlns:myfoaf="http://www.example/jose/foaf.rdf#"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+
+    <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#jose">
+        <foaf:homepage rdf:resource="http://www.example/jose/"/>
+        <foaf:knows rdf:resource="http://www.example/jose/foaf.rdf#juan"/>
+        <foaf:name>Jose Jimen~ez</foaf:name>
+        <foaf:nick>Jo</foaf:nick>
+        <foaf:workplaceHomepage rdf:resource="http://www.corp.example/"/>
+    </foaf:Person>
+
+    <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#juan">
+        <foaf:mbox rdf:resource="mailto:juan at mail.example"/>
+    </foaf:Person>
+
+    <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#julia">
+        <foaf:mbox rdf:resource="mailto:julia at mail.example"/>
+    </foaf:Person>
+
+    <rdf:Description rdf:about="http://www.example/jose/foaf.rdf#kendall">
+
+        <foaf:knows rdf:resource="http://www.example/jose/foaf.rdf#edd"/>
+    </rdf:Description>
+</rdf:RDF>
 ]]></programlisting>
-<para>By convention, the first column is the subject selected by the view element, typically a URI, the second a label of the URI
-and the third, if present, is either a count or a search summary.</para>
-<para>The first column's text child is the text form of the value. The column element has the following attributes
-qualifying this further:</para>
-<itemizedlist mark="bullet">
-  <listitem>datatype - The xsd type of the value. If this is a URI, the datatype is "uri" </listitem>
-  <listitem>shortform - If the value is a URI, this is an abbreviated form where known namespaces are replaced with
-their prefixes and very long URI's are truncated preserving start and end. </listitem>
-  <listitem>xml:lang - if the value is a language tagged string, this is the language</listitem>
+            </listitem>
 </itemizedlist>
-<para>The query has the top level element <query>. The child elements of this represent conditions
-pertaining to a single subject. A join is expressed with the property or property-of element. This has
-in turn children which state conditions on a property of the first subject. property and property-of
-elements can be nested to an arbitrary depth and many can occur inside one containing element. In this way,
-tree-shaped structures of joins can be expressed.</para>
-<para>Expressing more complex relationships, such as intermediate grouping, subqueries, arithmetic or
-such requires writing the query in SPARQL. The XML format is a shorthand for easy automatic composition
-of queries needed for showing facets, not a replacement for SPARQL.</para>
-<para>A facet query contains a single view element. This specifies which subject of the joined
-subjects is shown. Its attributes specify the manner of viewing, e.g. list of distinct values, distinct
-values with occurrence counts, properties or classes of the selected subjects etc.</para>
-<para>The top query element or any property or property-of element can have the following types of children:</para>
-<programlisting><![CDATA[
-<text property="iri">text pattern</text>
-]]></programlisting>
-<para>The subject has an O that matches the text pattern. If property is given, the text pattern must
-occur in a value of this property. If not specified, any property will do. The value "none" for property
-is the same as not specifying a property. This is restricted to occurring directly under the top level
-query element.</para>
-<programlisting><![CDATA[
-<class iri="iri" inference="ctx_name" />
-]]></programlisting>
-<para>The S must be an instance of this class. If inference is specified then option (input:inference
-"ctx_name" is added and applies to this pattern alone.</para>
-<programlisting><![CDATA[
-<property iri="iri" same_as="yes" inference="ctx_name">]]></programlisting>
-<para>The child elements of this are conditions that apply to the value of this property of the S that
-is in scope in the enclosing <query> or <property> element. If same_as is present, then
-option (input:same-as "yes") is added to the triple pattern which specifies this property. If inference
-is present, then option (input:inference "ctx_name") is added to the triple pattern for the property.</para>
-<programlisting><![CDATA[
-<property-of iri="iri" same_as="yes" inference="ctx_name" >
-]]></programlisting>
-<para>The child elements of this are conditions that apply to an S which has property "iri" whose object
-is the S in scope in the enclosing <query> or <property> element. The options are otherwise
-the same as with property.</para>
-<programlisting><![CDATA[
-<value datatype="type" xml:lang="lng" op="= | < | > | >= | <=">value </value>
-]]></programlisting>
-<para>When this occurs inside <property> or <property-of> this means that the property in
-scope has the specified relation to the value. type and language can be used for XML typed or language
-tagged literals. The "uri" type means that the value is a qualified name of a URI. If this occurs
-directly under the <query> element, this means that the query starts with a fixed subject.
-If this is so, then there must be property or propertyof elements or the view element must specify
-properties or classes, list is not allowed as a view type. This is so because the query must have
-at least one triple pattern.</para>
-<programlisting><![CDATA[
-<view type="view" limit="n" offset="n" >
-]]></programlisting>
-<para>This may occur once inside a <query> element but may occur either at top level or inside
-property or property-of elements. This specifies what which subject is presented in the result set.</para>
-<para>The type can be:</para>
-<itemizedlist mark="bullet">
-  <listitem>"properties"
-<programlisting><![CDATA[
-SPARQL
-SELECT ?p count (*) { ?this_s ?p ?any_o ...}
-GROUP BY ?p
-ORDER BY DESC 2
-LIMIT l OFFSET 0
-]]></programlisting>
 </listitem>
-  <listitem>"properties-in"
+        <listitem>You can also perform the steps from above by uploading the file in the rdf_sink
+folder i.e. in Briefcase it will be with this path: DAV/home/test2/rdf_sink and respectively the "RDF graph name"
+will have this value: http://host:port/DAV/home/username/rdf_sink/</listitem>
+      </itemizedlist>
+      <para>Execute from ISQL or from the SPARQL endpoint the following query:</para>
 <programlisting><![CDATA[
-SPARQL
-SELECT ?p count (*) { ?any_s ?p ?this_s ... }
-GROUP BY ?p
-ORDER BY DESC 2
-LIMIT L OFFSET 0
+SELECT * FROM <http://localhost:8890/DAV/home/test2/mytest/>
+WHERE {?s ?p ?o}
 ]]></programlisting>
-</listitem>
-  <listitem>"classes"
+      <para>As result should be shown:</para>
 <programlisting><![CDATA[
-SPARQL
-SELECT ?c count (*)
-WHERE { ?xx a ?c ... }
-GROUP BY ?c
-ORDER BY DESC 2
-LIMIT l OFFSET 0
+s  	                                  p  	                                            o
+http://www.example/jose/foaf.rdf#jose 	  http://www.w3.org/1999/02/22-rdf-syntax-ns#type   http://xmlns.com/foaf/0.1/Person
+http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/nick 	            Jo
+http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/name 	            Jose Jimen~ez
+http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/knows 	            http://www.example/jose/foaf.rdf#juan
+http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/homepage 	            http://www.example/jose/
+http://www.example/jose/foaf.rdf#jose 	  http://xmlns.com/foaf/0.1/workplaceHomepage 	    http://www.corp.example/
+http://www.example/jose/foaf.rdf#kendall  http://xmlns.com/foaf/0.1/knows 	            http://www.example/jose/foaf.rdf#edd
+http://www.example/jose/foaf.rdf#julia 	  http://www.w3.org/1999/02/22-rdf-syntax-ns#type   http://xmlns.com/foaf/0.1/Person
+http://www.example/jose/foaf.rdf#julia 	  http://xmlns.com/foaf/0.1/mbox 	            mailto:julia at mail.example
+http://www.example/jose/foaf.rdf#juan 	  http://www.w3.org/1999/02/22-rdf-syntax-ns#type   http://xmlns.com/foaf/0.1/Person
+http://www.example/jose/foaf.rdf#juan 	  http://xmlns.com/foaf/0.1/mbox 	            mailto:juan at mail.example
 ]]></programlisting>
+      <para><emphasis>Example 2: Using Conductor UI</emphasis></para>
+      <itemizedlist>
+        <listitem>Go to Conductor UI, for ex. at http://localhost:8890/conductor</listitem>
+        <listitem>Login as dba user</listitem>
+        <listitem>Go to RDF -> RDF Store Upload
+          <figure id="uc1" float="1">
+	    <title>RDF Store Upload</title>
+	    <graphic fileref="ui/uc1.png"/>
+          </figure>
   </listitem>
-  <listitem>"text"
-<programlisting><![CDATA[
-SPARQL
-SELECT DISTINCT ?s (bif:search_excerpt (sql:search_terms (""pattern"), ?o)) ...
-LIMIT l OFFSET 0
-]]></programlisting>
+        <listitem>In the shown form click the "Browse" button in order to select a file, for ex. the file jose.rdf
+and set the "RDF IRI*"
+          <figure id="uc2" float="1">
+	    <title>RDF Store Upload</title>
+	    <graphic fileref="ui/uc2.png"/>
+          </figure>
   </listitem>
-  <listitem>"list"
+         <listitem>Click the "Upload" button.</listitem>
+      </itemizedlist>
+    </sect2>
+    <sect2 id="rdfinsertmethodvirtuosocrawler">
+      <title>Using Virtuoso Crawler</title>
+      <para>Using Virtuoso Crawler (which includes the Sponger options so you crawl
+non-RDF but get RDF and this can go to the Quad Store)</para>
+      <para><emphasis>Example:</emphasis></para>
+      <para>Go to Conductor UI. For ex. at http://localhost:8890/conductor</para>
+      <para>Login as dba user</para>
+      <para>Go to tab Web Application Server</para>
+      <para>Go to tab Content Imports</para>
+      <para>Click the "New Target" button</para>
+      <para>In the shown form:</para>
+      <itemizedlist>
+        <listitem>Enter for "Target description": Tim Berners-Lee's electronic Business Card</listitem>
+        <listitem>Enter for "Target URL": http://www.w3.org/People/Berners-Lee</listitem>
+        <listitem>Enter for "Copy to local DAV collection" for ex.: /DAV/home/demo/rdf_sink/</listitem>
+        <listitem>Choose from the list "Local resources owner": demo</listitem>
+        <listitem>Check the check.box with label "Store metadata".</listitem>
+        <listitem>Check all the check-boxes shown below the check-box "Store metadata".</listitem>
+        <listitem>Note: when selected "Convert Link", then all HREFs in the local stored content will be relative.</listitem>
+        <listitem>Click the button "Create".
+          <figure id="rdfinsertwebdav1" float="1">
+	    <title>Using Virtuoso Crawler</title>
+	    <graphic fileref="ui/rdfinsert1.png"/>
+          </figure>
+        </listitem>
+      </itemizedlist>
+      <para>Click the button "Import Queues".</para>
+      <para>For "Robot target" with label "Tim Berners-Lee's electronic Business Card"
+click the start link.</para>
+      <para>As result should be shown the number of the pages retrieved.</para>
+      <figure id="rdfinsertwebdav2" float="1">
+        <title>Using Virtuoso Crawler</title>
+	<graphic fileref="ui/rdfinsert2.png"/>
+      </figure>
+      <para>Now using the sparql endpoint with sponger option "Use only local data"
+enter for Default Graph URI: http://www.w3.org/People/Berners-Lee and execute the following query: </para>
 <programlisting><![CDATA[
-SPARQL
-SELECT DISTINCT ?s long::sql:fct_label (?s) ...
-LIMIT l OFFSET 0
+SELECT *
+FROM <http://www.w3.org/People/Berners-Lee>
+WHERE {?s ?p ?o}
 ]]></programlisting>
-</listitem>
-  <listitem></listitem>
-  <listitem>"list-count"
+      <para>As result should be shown the following triples:</para>
 <programlisting><![CDATA[
-SPARQL
-SELECT ?s COUNT (*) ....
-GROUP BY ?s
-ORDER BY DESC 2
+s                                       p  	                                            o
+http://www.w3.org/People/Berners-Lee 	http://www.w3.org/1999/02/22-rdf-syntax-ns#type     http://xmlns.com/foaf/0.1/Document
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Answers for young people - Tim Berners-Lee
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Berners-Lee: Weaving the Web
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Declaration by Tim BL 28 Feb 1996 w.r.t. CDA challenge
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Errata - Berners-Lee: Weaving the Web
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Frequently asked questions by the Press - Tim BL
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Glossary - Weaving the Web - Berners-Lee
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Longer Bio for Tim Berners-Lee
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Michael Dertouzos has left us
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            The Future of the Web and Europe
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            The World Wide Web: Past, Present and Future
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            The World Wide Web: A very short personal history
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee - 3Com Founders chair
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee: Disclosures
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee: WWW and UU and I
+http://www.w3.org/People/Berners-Lee 	http://purl.org/dc/elements/1.1/title 	            Tim Berners-Lee: WorldWideWeb, the first Web client
 ]]></programlisting>
-</listitem>
-  <listitem>"alphabet"
+    <para><emphasis>Example: Use of schedular to interface Virtuoso Quad Store with PTSW using the following program:</emphasis></para>
 <programlisting><![CDATA[
-SPARQL
-SELECT (sql:subseq (?s, 0, 1)) count (*) ...
-GROUP BY (sql:subseq (?s, 0, 1))
-ORDER BY 1
+
+
+create procedure PTSW_CRAWL ()
+{
+  declare xt, xp any;
+  declare content, headers any;
+
+  content := http_get ('http://pingthesemanticweb.com/export/', headers);
+  xt := xtree_doc (content);
+  xp := xpath_eval ('//rdfdocument/@url', xt, 0);
+  foreach (any x in xp) do
+    {
+      x := cast (x as varchar);
+      dbg_obj_print (x);
+      {
+	declare exit handler for sqlstate '*' {
+	  log_message (sprintf ('PTSW crawler can not load : %s', x));
+	};
+        sparql load ?:x into graph ?:x;
+	update DB.DBA.SYS_HTTP_SPONGE set HS_LOCAL_IRI = x, HS_EXPIRATION = null WHERE HS_LOCAL_IRI = 'destMD5=' || md5 (x) || '&graphMD5=' || md5 (x);
+	commit work;
+      }
+    }
+}
+;
+
+insert soft SYS_SCHEDULED_EVENT (SE_SQL, SE_START, SE_INTERVAL, SE_NAME)
+	values ('DB.DBA.PTSW_CRAWL ()', cast (stringtime ('0:0') as DATETIME), 60, 'PTSW Crawling');
 ]]></programlisting>
-  </listitem>
-  <listitem>"geo"
+      <tip><title>See Also:</title>
+        <para><link linkend="contentcrawlerrdf">Other Methods to Set Up the Content Crawler for RDF gathering.</link></para>
+      </tip>
+    </sect2>
+    <sect2 id="rdfinsertmethodsparqlqueryandsponger">
+      <title>Using SPARQL Query and Sponger (i.e. we Sponge the Resources in the FROM Clause or values for the graph-uri parameter in SPARQL protocol URLs)</title>
+      <para><emphasis>Example:</emphasis></para>
+      <para>Execute the following query: </para>
 <programlisting><![CDATA[
-SPARQL
-SELECT DISTINCT ?lat ?long ?s
-WHERE ?s geo:lat ?lat . ?s geo:long ?long . ... }
+SQL>SPARQL
+SELECT ?id
+FROM NAMED <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/sioc.ttl>
+ OPTION (get:soft "soft", get:method "GET")
+WHERE { GRAPH ?g { ?id a ?o } }
+limit 10;
 ]]></programlisting>
-  </listitem>
-  <listitem>"years"
+      <para>As result will be shown the retrieved triples:</para>
 <programlisting><![CDATA[
-SPARQL
-SELECT sql::year (?s) count (*) ...
-GROUP BY (bif:year (?s))
-ORDER BY 1
-OFFSET 0 LIMIT l
+id
+VARCHAR
+_______________________________________________________________________________
+
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com#this
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D
+http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/612
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/612
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/610
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/610
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/856
+http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/856
+
+10 Rows. -- 20 msec.
 ]]></programlisting>
-  </listitem>
-  <listitem>"months"
+    </sect2>
+    <sect2 id="rdfinsertmethodplapis">
+      <title>Using Virtuoso PL APIs</title>
+      <sect3 id="rdfinsertmethodplapissimpleexample"><title>Basic Sponger Cartridge Example</title>
+      <para>In the example script we implement a basic mapper which maps a text/plain mime type
+to an imaginary ontology, which extends the class Document from FOAF with properties 'txt:UniqueWords'
+and 'txt:Chars', where the prefix 'txt:' we specify as 'urn:txt:v0.0:'.</para>
 <programlisting><![CDATA[
-SPARQL
-SELECT sql::round_month (?s) count (*) ...
-GROUP BY (sql:round_month (?s))
-ORDER BY 1 OFFSET 0 LIMIT l
+use DB;
+
+create procedure DB.DBA.RDF_LOAD_TXT_META
+	(
+	 in graph_iri varchar,
+	 in new_origin_uri varchar,
+	 in dest varchar,
+         inout ret_body any,
+	 inout aq any,
+	 inout ps any,
+	 inout ser_key any
+	 )
+{
+  declare words, chars int;
+  declare vtb, arr, subj, ses, str any;
+  declare ses any;
+  -- if any error we just say nothing can be done
+  declare exit handler for sqlstate '*'
+    {
+      return 0;
+    };
+  subj := coalesce (dest, new_origin_uri);
+  vtb := vt_batch ();
+  chars := length (ret_body);
+  -- using the text index procedures we get a list of words
+  vt_batch_feed (vtb, ret_body, 1);
+  arr := vt_batch_strings_array (vtb);
+  -- the list has 'word' and positions array , so we must divide by 2
+  words := length (arr) / 2;
+  ses := string_output ();
+  -- we compose a N3 literal
+  http (sprintf ('<%s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Document> .\n', subj), ses);
+  http (sprintf ('<%s> <urn:txt:v0.0:UniqueWords> "%d" .\n', subj, words), ses);
+  http (sprintf ('<%s> <urn:txt:v0.0:Chars> "%d" .\n', subj, chars), ses);
+  str := string_output_string (ses);
+  -- we push the N3 text into the local store
+  DB.DBA.TTLP (str, new_origin_uri, subj);
+  return 1;
+}
+;
+
+--
+DELETE FROM DB.DBA.SYS_RDF_MAPPERS WHERE RM_HOOK = 'DB.DBA.RDF_LOAD_TXT_META';
+
+INSERT SOFT DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
+    VALUES ('(text/plain)', 'MIME', 'DB.DBA.RDF_LOAD_TXT_META', null, 'Text Files (demo)');
+
+-- here we set order to some large number so don't break existing mappers
+update DB.DBA.SYS_RDF_MAPPERS set RM_ID = 2000 WHERE RM_HOOK = 'DB.DBA.RDF_LOAD_TXT_META';
 ]]></programlisting>
+
+<orderedlist>
+  <listitem>Paste the whole of this code into Conductor's iSQL interface and execute it to 
+  	define and register the cartridge.</listitem>
+  <listitem>Create a simple text document with a .txt extension. For ex. with name: summary.txt</listitem>
+  <listitem>The .txt file must now be made Web accessible. A simple way to do this is to expose it as a WebDAV 
+  	resource using Virtuoso's built-in WebDAV support:
+    <orderedlist>
+      <listitem>Log in to Virtuoso's ODS Briefcase application;</listitem>
+      <listitem>Navigate to your Public folder;</listitem>
+      <listitem>Upload your text document, ensuring that the file extension is .txt, the MIME type is set to text/plain and the file permissions are rw-r--r--.</listitem>
+      <listitem>As result the file would be Web accessible via the URL http://cname/DAV/home/username/Public/summary.txt .</listitem>
+      <listitem>Note: you can also check our <ulink url="http://demo.openlinksw.com:8890/tutorial/hosting/ho_s_30/WebCalendar/tools/summary.txt">live demo</ulink>.</listitem>
+    </orderedlist>
   </listitem>
-  <listitem>"weeks"
+  <listitem>To test the mapper we just use /sparql endpoint with option 'Retrieve remote
+RDF data for all missing source graphs' to execute (for ex.):
 <programlisting><![CDATA[
-SPARQL
-SELECT sql::round_week (?s) COUNT (*) ...
-GROUP BY (sql:round_week (?s))
-ORDER BY 1 OFFSET 0 LIMIT l
+SELECT *
+FROM <http://cname/DAV/home/username/Public/summary.txt>
+WHERE {?s ?p ?o}
 ]]></programlisting>
   </listitem>
-  <listitem>"describe"
-<programlisting><![CDATA[
-SPARQL describe ?s ... OFFSET 0 LIMIT l
-]]></programlisting>
-</listitem>
-</itemizedlist>
-<sect4 id="virtuosospongerfacentcust">
-  <title>Customizing</title>
-  <para>The following types of customization will be generally useful:</para>
-  <itemizedlist mark="bullet">
-    <listitem>Resource accounting and limitations, managing access and login</listitem>
-    <listitem>Localization, choice of labels shown with class/property/instance URI's</listitem>
-    <listitem>Adding types of views, for example timelines, map or business graphics </listitem>
-    <listitem>Controlling navigation, for example choosing what type of view is initially presented when opening a given property.</listitem>
-    <listitem>Page layout, captions, help texts, etc.</listitem>
-  </itemizedlist>
-  <para>The source code is divided in two SQL files and a number of XSLT sheets. The file facet.sql has the code for the web service. The
-facet_view.sql file contains the procedures for the sample HTML interface.</para>
-</sect4>
-<sect4 id="virtuosospongerfacentexamples">
-  <title>Examples</title>
-<para>Note: in all examples the default namespace xmlns="http://openlinksw.com/services/facets/1.0/" is omitted for brevity.</para>
-<para>For people called Mike:</para>
+        <listitem>Click the "Run Query" button.</listitem>
+  <listitem>As result should be shown the found triples, for ex.:
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <view type="text"/>
-</query>
+s  	                                                                    p  	                                            o
+http://cname/DAV/home/username/Public/summary.txt  http://www.w3.org/1999/02/22-rdf-syntax-ns#type  http://xmlns.com/foaf/0.1/Document
+http://cname/DAV/home/username/Public/summary.txt  urn:txt:v0.0:UniqueWords 	                      47
+http://cname/DAV/home/username/Public/summary.txt  urn:txt:v0.0:Chars 	                            625
 ]]></programlisting>
-<para>To open the list of people who Mike knows:</para>
+  </listitem>
+</orderedlist>
+      <para><emphasis>Important: Setting Sponger Permissions</emphasis></para>
+      <para>In order to allow the Sponger to update the local RDF quad store with triples
+constituting the sponged structured data, the role "SPARQL_SPONGE" must be granted to the
+account "SPARQL", i.e., to the owner account of /sparql web service endpoint.
+This should normally be the case. If not, you must manually grant this
+permission. As with most Virtuoso DBA tasks, the Conductor provides the simplest means of
+doing this.</para>
+  <tip><title>See Also:</title>
+    <itemizedlist mark="bullet">
+      <listitem>The <link linkend="fn_rdf_load_rdfxml">DB.DBA.RDF_LOAD_RDFXML</link> function to
+parse the content of RDF/XML text.</listitem>
+      <listitem>The <link linkend="fn_ttlp_mt">DB.DBA.TTLP_MT</link> function to
+parse TTL (TURTLE or N3 resource).</listitem>
+      <listitem>The <link linkend="fn_gz_file_open">gz_file_open</link> function to
+retrieve content of a gzipped file and example for loading gzipped N3 and Turtle files.</listitem>
+    </itemizedlist>
+  </tip>
+      </sect3>
+    </sect2>
+    <sect2 id="rdfinsertmethodsimilerdfbankapi">
+      <title>Using SIMILE RDF Bank API</title>
+      <para>Virtuoso implements the HTTP-based Semantic Bank API that enables client
+applications to post to its RDF Triple Store. This method offers an alternative to
+using Virtuoso/PL functions or WebDAV uploads as the triples-insertion mechanism.</para>
+      <para><emphasis>Example:</emphasis></para>
+      <para>From your machine go to Firefox->Tools->PiggyBank->My Semantic Bank Accounts</para>
+      <para>Add in the shown form:</para>
+      <itemizedlist>
+        <listitem>For bank: address: http://demo.openlinksw.com/bank</listitem>
+        <listitem>For account id: demo</listitem>
+        <listitem>For password: demo</listitem>
+      </itemizedlist>
+      <para>Go to http://demo.openlinksw.com/ods</para>
+      <para>Log in as user demo, password: demo</para>
+      <para>Go to the Weblog tab from the main ODS Navigation</para>
+      <para>Click on weblog instance name, for ex. "demo's Weblog".</para>
+      <para>When the weblog home page is loaded, click Alt + P.</para>
+      <para>As result is shown the "My PiggyBank" page with all the collected information
+presented in items.</para>
+      <para>For several of the items add Tags from the form "Tag" shown for each of them.</para>
+      <para>As result should be shown the message "Last updated: [here goes the date value].</para>
+      <para>You can also click "Save" and "Publish" for these items.</para>
+      <para>Go to http://demo.openlinksw.com/sparql</para>
+      <para>Enter for the "Default Graph URI" field: http://simile.org/piggybank/demo</para>
+      <para>Enter for the "Query text" text-area:</para>
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <view type="properties"/>
-</query>
+prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+SELECT *
+FROM <http://simile.org/piggybank/demo>
+WHERE {?s ?p  ?o}
 ]]></programlisting>
-<para>To show the list of subjects Mike knows:</para>
+      <para>Click "Run Query".</para>
+      <para>As results are shown the found results.</para>
+    </sect2>
+    <sect2 id="rdfinsertmethodrdfnet">
+      <title>Using RDF NET</title>
+      <para><emphasis>Example:</emphasis></para>
+      <para>Execute the following query:</para>
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-    <view type="list" />
-  </property>
-</query>
+SQL> SELECT DB.DBA.HTTP_RDF_NET ('sparql load
+"http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com"
+into graph <http://www.openlinksw.com/>');
 ]]></programlisting>
-<para>To show the properties of people Mike knows:</para>
+      <para>As result should be shown:</para>
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-    <view type="properties" />
-  </property>
-</query>
+callret
+VARCHAR
+_______________________________________________________
+
+<?xml version="1.0" ?>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"
+xmlns="http://example.org/book/" xmlns:dc="http://purl.org/dc/elements/1.1/"
+xmlns:ns="http://example.org/ns#">
+<rdf:Description>
+<callret-0>Load <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com>
+into graph <http://www.openlinksw.com/> -- done</callret-0>
+</rdf:Description>
+</rdf:RDF>
+
+1 Rows. -- 1982 msec.
 ]]></programlisting>
-<para>To show the names:</para>
+    </sect2>
+    <sect2 id="rdfinsertmethodproxy">
+      <title>Using the RDF Proxy (Sponger) Service</title>
+    <para>Triples can be inserted also using the Sponger Proxy URI Service. For more information 
+    	and examples see <link linkend="rdfproxyservice">here</link>.</para>
+    </sect2>
+</sect1>
+
+
+<sect1 id="virtuososponger"><title>RDFizer Middleware (Sponger)</title>
+    <sect2 id="virtuosospongerintro"><title>What Is The Sponger?</title>
+<para>The Virtuoso Sponger is the Linked Data middleware component of Virtuoso that generates 
+	Linked Data from a variety of data sources, supporting a wide variety of data representation 
+	and serialization formats. The sponger is transparently integrated into Virtuoso's SPARQL Query 
+	Processor where it delivers URI de-referencing within SPARQL query patterns, across disparate 
+	data spaces. It also delivers configurable smart HTTP caching services. Optionally, it can be 
+	used by the <link linkend="contentcrawlerrdf">Virtuoso Content Crawler</link> to periodically 
+	populate and replenish data within the native RDF Quad Store. 
+</para>
+<para>The sponger is a fully fledged HTTP proxy service that is also directly accessible via 
+	SOAP or REST interfaces.
+</para>
+<para>As depicted below, OpenLink's broad portfolio of Linked-Data-aware products supports a number 
+	of routes for creating or consuming Linked Data. The Sponger provides a key platform for developers 
+	to generate quality data meshes from unstructured or semi-structured data sources.
+</para>
+<figure id="virtuosospongerdiagram" float="1">
+		<title>OpenLink Linked Data generation options</title>
+		<graphic fileref="linked_data_gen_opts3.png"/>
+        </figure>
+<para>
+Architecturally, the Sponger is comprised of a number of Cartridges two types of cartridges: Extractor 
+and Meta Cartridges. Extractor Cartridges focus on data extraction and transformation services while 
+the Meta Cartridges provide lookups and joins across other linked data spaces and Web 2.0 APIs. Both 
+cartridge types are themselves comprised of a data extractors and RDF Schema/Ontology Mapper 
+components.</para>
+<para>Cartridges are is highly customizable. Custom cartridges can be developed using any language 
+	supported by the Virtuoso Server Extensions API enabling structured linked data generation from 
+	resource types not available in the default Sponger Cartridge collection bundled -- as part of 
+	the Virtuoso Sponger VAD package (rdf_mappers_dav.vad).
+</para>
+    <figure id="virtuosospongerdiagram" float="1">
+  	  <title>Virtuoso metadata extraction & RDF structured data generation</title>
+		  <graphic fileref="linked_data_gen_opts4.png"/>
+		<title>Virtuoso metadata extraction & RDF structured data generation</title>
+		<graphic fileref="linked_data_gen_opts4.png"/>
+    </figure>
+  </sect2>  
+  
+	<sect2 id="virtuosospongerimp"><title>Why is it Important?</title>
+<para>	
+A majority of the worlds data naturally resides in non RDF form at the current time. The Sponger
+delivers middleware that accelerates the bootstrap of the Semantic Data Web by generating RDF
+from non RDF data sources, unobtrusively. This "Swiss army knife" for on-the-fly Linked Data generation 
+provides a bridge between the traditional Document Web and the Linked Data Web ("Data Web").
+</para>
+<para>Sponging data from non-RDF Web sources and converting it to RDF exposes the data in a 
+canonical form for querying and inference, and enables fast and easy construction of linked 
+data driven mesh-ups as opposed to code driven Web 2.0 mash-ups.
+</para>
+<para>The RDF extraction and instance data generation products that offer functionality 
+demonstrated by the Sponger are also commonly referred to as RDFizers.
+</para>
+</sect2>
+
+<sect2 id="virtuosospongerworkpr"><title>How Does It Work?</title>
+<para>
+When an RDF aware client requests data from a network accessible resource via the Sponger
+the following events occur:
+</para>
+<itemizedlist>
+<listitem>A requests in made for data in RDF form, and if RDF is returned nothing further happens</listitem>
+<listitem>If RDF isn't returned, then the Sponger passes the data through a Metadata Extraction
+Pipeline process (using Metadata Extractors)</listitem>
+<listitem>The extracted data is transformed to RDF via a Mapping Pipeline process (RDF is extracted by way
+of Ontology matching and mapping) that results in RDF Entities (instance data) generation</listitem>
+<listitem>RDF Entities are returned to the client</listitem>
+</itemizedlist>
+<para>The imported data forms a local cache and its invalidation rules conform to those of traditional
+HTTP clients (Web Browsers). Thus, expiration time is determined based on subsequent data fetches of
+the same resource (note: the first data load will record the 'expires' header) with current time
+compared to expiration time stored in the local cache. If HTTP 'expires' header data isn't returned
+by the source data server, then the "Sponger" will derive it's own invalidation time frame by
+evaluating the 'date' header and 'last-modified' HTTP headers. Irrespective of path taken,
+local cache invalidation is driven by an assessment of current time relative to recorded expiration time.
+</para>
+<para>To manage the cache expiration, set the <emphasis>MinExpiration</emphasis> parameter in 
+your Virtuoso.ini file.</para>
+<para>Read full description of the parameter in the <link linkend="ini_SPARQL">[SPARQL] ini seciton</link>.</para>
+<para>Designed with a pluggable architecture, the Sponger's core functionality is provided by Cartridges.
+Each cartridge includes Data Extractors which extract data from one or more data sources, and Ontology
+Mappers which map the extracted data to one or more ontologies/schemas, and route to producing RDF
+Linked Data.
+</para>
+<para>The Schema Mappers are typically XSLT (e.g. GRDDL and other OpenLink Mapping Schemas) or
+Virtuoso PL based. The Metadata Extractors may be developed in Virtuoso PL, C/C++, Java, or any
+other language that can be integrated into the Virtuoso via it's server extensions APIs.
+</para>
+<para>
+The Sponger also includes a pluggable name resolution mechanism that enables the development of
+Custom Resolvers for naming schemes (e.g. URNs) associated with protocols beyond HTTP.
+Examples of custom resolvers include:
+</para>
+<itemizedlist>
+<listitem><ulink url="http://dbpedia.org/resource/LSID">LSID</ulink></listitem>
+<listitem><ulink url="http://dbpedia.org/resource/DOI">DOI</ulink></listitem>
+</itemizedlist>
+</sect2>
+
+<sect2 id="virtuosospongerinstall"><title>Installation Steps</title>
+<orderedlist>
+  <listitem>Download the <ulink url="http://s3.amazonaws.com/opldownload/uda/vad-packages/6.1/virtuoso/rdf_mappers_dav.vad">rdf_mappers_dav.vad</ulink> package.</listitem>
+  <listitem>Install the rdf_mappers_dav.vad package by using the Conductor UI or by using iSQL:
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-    <property iri="foaf:name>
-      <view type="list" />
-    </property>
-  </property>
-</query>
+SQL> DB.DBA.VAD_INSTALL('tmp/rdf_mappers_dav.vad',0);
+SQL_STATE  SQL_MESSAGE
+VARCHAR  VARCHAR
+_______________________________________________________________________________
+
+00000    No errors detected
+00000    Installation of "RDF Mappers" is complete.
+00000    Now making a final checkpoint.
+00000    Final checkpoint is made.
+00000    SUCCESS
+
+
+6 Rows. -- 1078 msec.
+]]></programlisting>  	
+  </listitem>
+  <listitem><link linkend="virtuosospongercreatecustcartrrgst">Cartridge Configuration</link>
+    <itemizedlist mark="bullet">
+      <listitem><link linkend="virtuosospongercartridgesextr">Extractor Cartridges</link></listitem>
+      <listitem><link linkend="virtuosospongercartridgesmeta">Meta Cartridges</link></listitem>
+</itemizedlist>
+  </listitem>
+</orderedlist>
+<para>
+	<tip>
+		<title>See Also: <link linkend="virtuosospongerrdfmapperspackage">RDF Mapper Package content description.</link></title>
+  </tip>
+</para>  
+</sect2>
+
+
+<sect2 id="virtuosospongerusage"><title>Using The Sponger</title>
+    <para>The Sponger can be invoked via the following mechanisms:</para>
+    <orderedlist>
+      <listitem><link linkend="virtuosospongerusageprocessor">Virtuoso SPARQL query processor</link></listitem>
+      <listitem><link linkend="virtuosospongerusageproxy">RDF Proxy Service</link></listitem>
+      <listitem><link linkend="virtuosospongerusageclapp">OpenLink RDF client applications</link></listitem>
+      <listitem><link linkend="virtuosospongerusagebrief">ODS-Briefcase (Virtuoso WebDAV)</link> - a component of the OpenLink Data Spaces distributed collaborative application platform</listitem>
+      <listitem><link linkend="virtuosospongerusagedirect">Directly via Virtuoso PL</link></listitem>
+    </orderedlist>
+    
+    <sect3 id="virtuosospongerusageprocessor"><title>SPARQL Query Processor IRI Dereferencing</title>
+    <para>The Sponger is transparently integrated into the Virtuoso SPARQL query processor, where it supports
+IRI dereferencing.
+      </para>
+      <para>Virtuoso extends the SPARQL Query Language such that it is possible to download RDF resources 
+      	from a given IRI, parse, and then store the resulting triples in a graph, with all three operations 
+      	performed during the SPARQL query-execution process. The IRI/URI of the graph used to store the 
+      	triples is usually equal to the URL where the resources are downloaded from, consequently the 
+      	feature is known as "IRI/URI dereferencing". If a SPARQL query instructs the SPARQL processor 
+      	to retrieve the target graph into local storage, then the SPARQL sponger will be invoked.
+      </para>
+      <para>The SPARQL extensions for IRI dereferencing are described below. Essentially these enable 
+      	downloading and local storage of selected triples either from one or more named graphs, or 
+      	based on a proximity search from a starting URI for entities matching the select criteria and 
+      	also related by the specified predicates, up to a given depth. For full details see 
+      	section <link linkend="rdfiridereferencing">Linked Data - IRI Dereferencing</link>.
+      </para>
+      <para>Note: For brevity, any reference to URI/IRIs above or in subsequent sections implies 
+      an HTTP URI/IRI, where IRI is an internationalized URI. Similarly, in the context of the 
+      Sponger, the term IRI in the Virtuoso reference documentation should be taken to mean an HTTP IRI.	
+      </para> 
+      <sect4 id="virtuosospongerusageprocessor"><title>SPARQL Extensions for IRI Dereferencing of FROM Clauses</title>
+        <para>In addition to the "define get:..." SPARQL extensions for IRI dereferencing in FROM 
+        	clauses, Virtuoso supports dereferencing SPARQL IRIs used in the WHERE clause (graph patterns) 
+        	of a SPARQL query via a set of "define input:grab-..." pragmas.
+        </para>	
+        <para>Consider an RDF resource which describes a member of a contact list, user1, and also 
+        	contains statements about other users, user2 anduser3 , known to him. Resource user3 in turn 
+        	contains statements about user4 and so on. If all the data relating to these users were 
+        	loaded into Virtuoso's RDF database, the query to retrieve the details of all the users 
+        	could be quite simple. e.g.:         	
+        </para>	
+<programlisting><![CDATA[
+sparql
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+select ?id ?firstname ?nick
+where
+  {
+    graph ?g
+      {
+        ?id rdf:type foaf:Person .
+        ?id foaf:firstName ?firstname .
+        ?id foaf:knows ?fn .
+        ?fn foaf:nick ?nick .
+      }
+   }
+limit 10;	
+]]></programlisting>        
+        <para>But what if some or all of these resources were not present in Virtuoso's quad store? 
+        	The highly distributed nature of the Linked Data Web makes it highly likely that these 
+        	interlinked resources would be spread across several data spaces. Virtuoso's 'input:grab-...' 
+        	extensions to SPARQL enable IRI dereferencing in such a way that all appropriate resources 
+        	are loaded, i.e. "sponged", during query execution, even if some of the resources are not 
+        	known beforehand. For any particular resource matched, and if necessary downloaded, by the 
+        	query, it is possible to download related resources via a designated predicate path(s) to 
+        	a specifiable depth i.e. number of 'hops', distance, or degrees of separation (i.e compute 
+        	Transitive Closures in SPARQL).
+        </para>
+        <para>Using Virtuoso's 'input:grab-' pragmas to enable sponging, the above query might be 
+        	recast to: 
+        </para>	
+<programlisting><![CDATA[
+sparql
+define input:grab-var "?more"
+define input:grab-depth 10
+define input:grab-limit 100
+define input:grab-base "http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300"
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+
+select ?id ?firstname ?nick
+where {
+    graph ?g {
+               ?id rdf:type foaf:Person .
+               ?id foaf:firstName ?firstname .
+               ?id foaf:knows ?fn .
+               ?fn foaf:nick ?nick .
+               optional { ?id rdfs:SeeAlso ?more }
+            }
+}
+limit 10;	
+]]></programlisting>        
+        <para>Another example showing a designated predicate traversal path via the input:grab-seealso 
+        	extension is: 
+        </para>	
+<programlisting><![CDATA[
+sparql
+define input:grab-iri <http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/sioc.ttl>
+define input:grab-var "id"
+define input:grab-depth 10
+define input:grab-limit 100
+define input:grab-base "http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/1300"
+define input:grab-seealso <foaf:maker>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+
+select ?id
+where
+  {
+    graph ?g
+      {
+        ?id a foaf:Person .
+      }
+  }
+limit 10;	
+]]></programlisting>        
+        <para>A list of the input:grab pragmas is given below:</para>
+          <itemizedlist mark="bullet">        
+            <listitem>input:grab-var specifies the name of the SPARQL variable whose values should be used as IRIs of resources that should be downloaded.</listitem>
+            <listitem>input:grab-iri specifies an IRI that should be retrieved before executing the rest of the query, if it is not in the quad store already. (This pragma can be included multiple times).</listitem>
+            <listitem>input:grab-seealso (or its synonym input:grab-follow-predicate) specifies a predicate IRI to be used when traversing a graph. (This pragma can be included multiple times).</listitem>
+            <listitem>input:grab-limit sets the maximum number of resources (graph subject or object nodes) to be retrieved from a target graph.</listitem>
+            <listitem>input:grab-depth sets the maximum 'degrees of separation' or links (predicates) between nodes in the target graph.</listitem>
+            <listitem>input:grab-all "yes" instructs the SPARQL processor to dereference everything related to the query. All variables and literal IRIs in the query become values for input:grab-var and input:grab-iri. The resulting performance may be very bad.</listitem>
+            <listitem>input:grab-base specifies the base IRI to use when converting relative IRIs to absolute. (Default: empty string).</listitem>
+            <listitem>input:grab-destination overrides the default IRI dereferencing and forces all retrieved triples to be stored in the specified graph.</listitem>
+            <listitem>input:grab-loader identifies the procedure used to retrieve each resource via HTTP, parse and store it. (Default: DB.DBA.RDF_SPONGE_UP)</listitem>
+            <listitem>input:grab-resolver identifies the procedure that resolves IRIs and determines the HTTP method of retrieval. (Default: DB.DBA.RDF_GRAB_RESOLVER_DEFAULT)</listitem>
+          </itemizedlist>
+      </sect4>
+      <sect4 id="virtuosospongerusageprocessorex"><title>SPARQL Processor Usage Example</title>
+        <para>Sponge can be performed directly from within the SPARQL processor.</para>
+        <para>After logging into Virtuoso's Conductor interface, the following query can be 
+        issued from the Interactive SQL (iSQL) panel: 
+        </para> 	
+<programlisting><![CDATA[
+sparql
+define get:uri "http://www.ivan-herman.net/foaf.html"
+define get:soft "soft"
+select * from <http://mygraph> where {?s ?p ?o}
+]]></programlisting>        
+        <para>Here the sparql keyword invokes the SPARQL processor from the SQL interface and the 
+        	RDF data sponged from page http://www.ivan-herman.net/foaf.html is loaded into the local 
+        	RDF quad store as graph http://mygraph .
+        </para>	
+        <para>The new graph can then be queried using the basic SPARQL client normally available 
+        	in a default Virtuoso installation at http://localhost:8890/sparql/. e.g.: 
+        </para>		
+<programlisting><![CDATA[
+select * from <http://mygraph> where {?s ?p ?o}	
+]]></programlisting>        
+      </sect4>      
+    </sect3>   
+    <sect3 id="virtuosospongerusageproxy"><title>RDF Proxy Service</title>
+    <para>The Sponger's functionality is also exposed via an in-built REST style Web service. This web
+service takes a target URL and either returns the content "as is" or tries to transform (by sponging)
+to RDF. Thus, the proxy service can be used as a 'pipe' for RDF browsers to browse non-RDF sources.</para>
+    <para>When the rdf_mappers package is installed, Virtuoso reserves the path '/about/[id|data|rdf|html]/http/' for
+Sponger Proxy URI Service. For example, if a Virtuoso installation on host example.com listens for HTTP
+requests on port 8080 then client applications should use a 'service endpoint' string equal to
+'http://example.com:8080/about/[id|data|rdf|html]/http/'. If the rdf_mappers package is not installed, then
+the service uses the path '/proxy/rdf/'.</para>
+    <para>Note: The old Sponger Proxy URI Service pattern '/proxy/' is now deprecated.</para>
+      <sect4 id="virtuosospongerusageproxyex1"><title>Example 1</title>
+    <para>The following URLs return information about musician John Cale, gleaned from the MusicBrainz
+music metadatabase, rendered as RDF or HTML respectively. (The sponged data is available in the HTML
+rendering through the foaf:primaryTopic property.)</para>
+    <itemizedlist mark="bullet">
+      <listitem>http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/artist/72c090b6-a68e-4cb9-b330-85278681a714.html</listitem>
+      <listitem>http://demo.openlinksw.com/about/html/http/musicbrainz.org/artist/72c090b6-a68e-4cb9-b330-85278681a714.html</listitem>
+    </itemizedlist>
+      </sect4>
+      <sect4 id="virtuosospongerusageproxyex2"><title>Example 2</title>
+        <para>The file http://www.ivan-herman.net/foaf.html contains a short profile of the W3C Semantic 
+        	Web Activity Lead Ivan Herman. This XHTML file contains RDF embedded as RDFa. Running the file 
+        	through the Sponger via Virtuoso's RDF proxy service extracts the embedded FOAF data as pure 
+        	RDF, as can be seen by executing:
+        </para>
+<programlisting><![CDATA[
+curl -H "Accept: application/rdf+xml" http://linkeddata.uriburner.com/about/rdf/http://www.ivan-herman.net/foaf.html	
 ]]></programlisting>
-<para>To specify one named Joe:</para>
+        <para>(linkeddata.uriburner.com hosts a public Virtuoso instance.) Though this example 
+        	demonstrates the action of the /about/rdf/ service quite transparently, it is a basic and 
+        	unwieldy way to view RDF. As described earlier, the OpenLink Data Explorer uses the same 
+        	proxy service to provide a more polished means to extract and view sponged RDF data.
+        </para>	
+      </sect4>
+    </sect3>
+    <sect3 id="virtuosospongerusageclapp"><title>OpenLink RDF Client Applications</title>
+      <para>OpenLink currently provides two main RDF client applications:</para>
+      <itemizedlist mark="bullet">
+        <listitem><ulink url="http://ode.openlinksw.com/">OpenLink Data Explorer</ulink> (ODE)</listitem>
+        <listitem><ulink url="http://demo.openlinksw.com/isparql">iSPARQL</ulink></listitem>
+      </itemizedlist>
+      <para>ODE is a Linked Data explorer packaged as a Firefox plugin (support for other browsers 
+      	is planned). iSPARQL is an interactive AJAX-based SPARQL query builder with support for 
+      	SPARQL QBE, bundled as part of the 
+      	<ulink url="http://oat.openlinksw.com/">OpenLink Ajax Toolkit</ulink> (OAT). Both RIA 
+      	clients utilise sponging extensively.</para>
+      <para>The ODE plugin is dual faceted - RDF data can be viewed and explored natively, through its 
+      	integral RDF browser, or, as described above, rendered as HTML through ODE's 'View Page Metadata' 
+      	option. The screenshots below show ODE's RDF browser being launched through the 'View Linked 
+      	Data Sources' popup menu.
+      </para>
+      <figure id="ODEBrowser" float="1">
+        <title>Launching ODE's RDF browser</title>
+        <graphic fileref="twitter_home.png"/>
+      </figure>
+      <para>The RDF browser then displays RDF data sponged via the Crunchbase cartridge.</para>
+      <figure id="ODEBrowserRDF" float="1">
+        <title>ODE RDF browser displaying sponged Crunchbase data</title>
+        <graphic fileref="twitter_ode_rdf.png"/>
+      </figure>      
+      <para>iSPARQL directs queries to the configured SPARQL endpoint. When targetting a Virtuoso 
+      	/sparql service, Virtuoso specific sponging options can be enabled through the 'Preferences' 
+      	dialog box.
+      </para>	
+      <para>The iSPARQL sponger settings are appended to SPARQL queries through the 'should-sponge' 
+      	query parameter. These are translated to IRI dereferencing pragmas on the server as follows: 
+      </para>	
+      <table>
+<tgroup cols="3">
+<thead>
+  <row>
+    <entry>iSPARQL sponging setting</entry><entry>/sparql endpoint: "should-sponge" query parameter value</entry><entry>SPARQL processor directives</entry>
+  </row>
+</thead>
+<tbody>
+<row><entry>Use only local data</entry><entry>N/A</entry><entry>N/A</entry></row>
+<row><entry>Retrieve remote RDF data for all missing source graphs</entry><entry>soft</entry><entry>define get:soft "soft"</entry></row>
+<row><entry>Retrieve all missing remote RDF data that might be useful</entry><entry>grab-all</entry><entry>	define input:grab-all "yes" define input:grab-depth 5 <br/>define input:grab-limit 100</entry></row>
+<row><entry>Retrieve all missing remote RDF data that might be useful including seeAlso references</entry><entry>grab-seealso</entry><entry>define input:grab-all "yes" define input:grab-depth 5 define input:grab-limit 200<br/>define input:grab-seealso <http://www.w3.org.2000/01/rdf-schema#seeAlso><br/>define input:grab-seealso <http://xmlns.com/foaf/0.1/seeAlso></entry></row>
+<row><entry>Try to download all referenced resources</entry><entry>grab-everything</entry><entry>
+define input:grab-all "yes"<br/>define input:grab-intermediate "yes"<br/>define input:grab-depth 5<br/>define input:grab-limit 500<br/>define input:grab-seealso <http://www.w3.org.2000/01/rdf-schema#seeAlso><br/>define input:grab-seealso <http://xmlns.com/foaf/0.1/seeAlso><br/></entry></row>
+</tbody>
+</tgroup>
+</table>
+
+</sect3>
+    <sect3 id="virtuosospongerusagebrief"><title>ODS-Briefcase (Virtuoso WebDAV)</title>
+      <para>ODS-Briefcase is a component of 
+      	<ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/OdsIndex">OpenLink Data Spaces</ulink> 
+      	(ODS), a new generation distributed collaborative application platform for creating Semantic 
+      	Web presence via Data Spaces derived from weblogs, wikis, feed aggregators, photo galleries, 
+      	shared bookmarks, discussion forums and more. It is also a high level interface to the Virtuoso 
+      	WebDAV repository.
+      </para>
+      <para>ODS-Briefcase offers file-sharing functionality that includes the following features:</para>
+      <itemizedlist mark="bullet">
+        <listitem>Web brower-based interactions</listitem>
+        <listitem>Web Services (direct use of the HTTP based WebDAV protocol)</listitem>
+        <listitem>SPARQL query language support - all WebDAV resources are exposed as SIOC ontology 
+        	instance data (RDF data sets)</listitem>        
+      </itemizedlist>      
+      <para>When resources or documents are put into the ODS Briefcase and are made publicly readable 
+      	(via a Unix-style +r permission or ACL setting) and the resource in question is of a supported 
+      	content type, metadata is automatically extracted at file upload time.
+      </para>
+      <para>Note: ODS-Briefcase extracts metadata from a wide array of file formats, automatically.</para>
+      <para>The extracted metadata is available in two forms, pure WebDAV and RDF (with RDF/XML or 
+      	N3/Turtle serialization options), that is optionally synchronized with the underlying Virtuoso 
+      	Quad Store.
+      </para>                  
+      <para>All public readable resources in WebDAV have their owner, creation time, update time, size 
+      	and tags published, plus associated content type dependent metadata. This WebDAV metadata is 
+      	also available in RDF form as a SPARQL queriable graph accessible via the SPARQL protocol 
+      	endpoint using the WebDAV location as the RDF data set URI (graph or data source URI).
+      </para>                  
+      <para>You can also use a special RDF_Sink folder to automate the process of uploading RDF 
+      	resources files into the Virtuoso Quad Store via WebDAV or raw HTTP. The properties of the special 
+      	folder control whether sponging (RDFization) occurs. Of course, by default, this feature is enabled 
+      	across all Virtuoso and ODS installations (with an ODS-Briefcase Data Space instance enabled).
+      </para>
+      <sect4 id="virtuosospongerusagebriefex"><title>Raw HTTP Example for Extracting Metadata using CURL</title>                  
+<programlisting><![CDATA[
+Username: demo
+Password: demo
+Source File: wine.rdf
+Destination Folder:
+http://demo.openlinksw.com/DAV/home/demo/rdf_sink/
+Content Type: application/rdf+xml
+
+$ curl -v -T wine.rdf -H content-type:application/rdf+xml http://demo.openlinksw.com/DAV/home/demo/rdf_sink/ -u demo:demo	
+]]></programlisting>      
+      <para>Finally, you can also get RDF data into Virtuoso's Quad Store via WebDAV using the Virtuoso 
+      	Web Crawler utility (configurable via the Virtuoso Conductor UI). This feature also provides the 
+      	ability to enable or disable Sponging as depicted below.
+      </para>
+      </sect4>   
+      <sect4 id="virtuosospongerusagebriefint"><title>Sponger and ODS-Briefcase Structured Data Extractor Interrelationship</title>                                                         
+        <para>As the Sponger and ODS-Briefcase both extract structured data, what is the relationship 
+        	between these two facilities?
+        </para>	
+        <para>The principal difference between the two is that the Sponger is anRDF data crawler & 
+        	generator, whereas Briefcase's structured data extractor is a WebDAV resourcefilter. The 
+        	Briefcase structured data extractor is aimed at providing RDF data from WebDAV resources. 
+        	Thus, if none of the available Sponger cartridges are able to extract metadata and produce 
+        	RDF structured data, the Sponger calls upon the Briefcase extractor as the last resort in 
+        	the RDF structured data generation pipeline.
+        </para>
+        <figure id="cninp1" float="1">
+          <title>Conductor's content import configuration panel</title>
+          <graphic fileref="fig2_top.jpg"/>
+        </figure>
+        <figure id="cninp2" float="1">
+          <title>Conductor's content import configuration panel</title>
+          <graphic fileref="fig2_bottom.jpg"/>
+        </figure>
+       </sect4> 
+    </sect3>
+    <sect3 id="virtuosospongerusagedirect"><title>Directly via Virtuoso PL</title>
+    <para>Sponger cartridges are invoked through a cartridge hook which provides a Virtuoso PL entry point 
+    	to the packaged functionality. Should you wish to utilize the Sponger from your own Virtuoso PL 
+    	procedures, you can do so by calling these hook routines directly. Full details of the hook 
+    	function prototype and how to define your own cartridges are presented <link linkend="virtuosospongercreatecustcartran">here</link>.</para>
+    </sect3>
+</sect2>
+
+<sect2 id="virtuosospongerconsm"><title>Consuming the Generated RDF Structured Data</title>
+  <para>The generated RDF-based structured data (RDF) can be consumed in a number of ways, depending on 
+  	whether or not the data is persisted in Virtuoso's RDF Quad Store.
+  </para>
+  <para>If the data is persisted, it can be queried through the Virtuoso SPARQL endpoint associated with 
+  	any Virtuoso instance: /sparql. The RDF is exposed in a graph typically identified using a URL matching 
+  	the source resource URL from which the RDF data was generated. Naturally, any SQL query can also access 
+  	this, since SPARQL can be freely intermixed with SQL via Virtuoso's SPASQL (SPARQL inside SQL) 
+  	functionality. RDF data is also accessible through Virtuoso's implementation of the URIQA protocol.
+  </para>
+  <para>If not persisted, as is the case with the RDF Proxy Service, the data can be consumed by an RDF 
+  	aware Web client, e.g. an RDF browser such as the OpenLink Data Explorer (ODE).
+  </para>
+ </sect2>
+
+
+   <sect2 id="virtuosospongercartridgesextractorusecases"><title>RDF Cartridges Use Cases</title>
+<para>This section contains examples of Web resources which can be transformed by RDF Cartridges.
+It also states where additional setup for given cartridges is needed i.e. keys account names etc.
+</para>
+<para><emphasis>Service based:</emphasis></para>
+<itemizedlist>
+<listitem>amazon
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-     <property iri="foaf:name>
-        <value>Joe</value>
-     </property>
-    <view type="properties" />
-  </property>
-</query>
+needs: api key
+example: http://www.amazon.com/gp/product/0553383043
 ]]></programlisting>
-<para>This lists the properties of the friends of Mike that are called Joe.</para>
-<para>To show the Mikes that know a Joe, one would change the shown variable in the navigation and get:</para>
+</listitem>
+<listitem>ebay
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-    <property iri="foaf:name>
-      <value>Joe</value>
-    </property>
-   </property>
-   <view type="text" />
-</query>
+needs: account, api-key
+example: http://cgi.ebay.com/RARE-DAY-IN-FAIRY-LAND-ELEPHANT-FOLIO-20-FULL-COLOR_W0QQitemZ140209597189QQihZ004QQcategoryZ29223QQssPageNameZWDVWQQrdZ1QQcmdZViewItem
 ]]></programlisting>
-<para>This would be the search summaries of subjects with Mike in some field that know a subject with name Joe.</para>
-<para>Now to specify that Mike must be a member of a discussion board:</para>
+</listitem>
+<listitem>flickr
+needs: api-key
+example: http://farm1.static.flickr.com/212/496684670_7122c831ed.jpg
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-    <property iri="foaf:name>
-     <value>Joe</value>
-   </property>
-  </property>
-  <view type="property-in" />
-</query>
-]]></programlisting>
-<para>This lists the properties of triples whom object is Mike. Pick sioc:member_of</para>
-<programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-    <property iri="foaf:name>
-      <value>Joe</value>
-    </property>
-  </property>
-  <property-of iri="sioc:member_of>
-    <view type="list" />
-  </property-of>
-</query>
 ]]></programlisting>
-<para>This would show things where Mike is a member. To specify that the thing must be a forum:</para>
+</listitem>
+<listitem>mbz
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-    <property iri="foaf:name>
-      <value>Joe</value>
-    </property>
-  </property>
-  <property-of iri="sioc:member_of>
-    <view type="classes" />
-  </property-of>
-</query>
+example: http://musicbrainz.org/release/37e955d4-a53c-45aa-a812-1b23b88dbc13.html
 ]]></programlisting>
-<para>This shows classes of things where Mike is a member Clicking on sioc:Forum gives:</para>
+</listitem>
+<listitem>mql (freebase)
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-    <property iri="foaf:name>
-      <value>Joe</value>
-    </property>
-  </property>
-  <property-of iri="sioc:member_of>
-    <class iri="sioc:Forum" />
-    <view type="classes"/>
-  </property-of>
-</query>
+example: http://www.freebase.com/view/en/beta_ursae_majoris
 ]]></programlisting>
-<para>The view stays with classes, but now scoped
-to the classes of things where Mike is a member that are instances of sioc:Forum.</para>
-<para>To go look at the list of Mikes with the added
-restriction, click the shown variable in the navigation and set it to s1.</para>
+</listitem>
+<listitem>facebook
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-    <property iri="foaf:name>
-      <value>Joe</value>
-    </property>
-  </property>
-  <property-of iri="sioc:member_of>
-   <class iri="sioc:Forum" />
-  </property-of>
-  <view type="list"/>
-</query>
+needs: api-key, secret, persistent-session-id
+example: http://www.facebook.com/profile.php?id=841100003
 ]]></programlisting>
-<para>To say that Joe must also have a geekCode, One clicks the shown variable and sets it to s2 and the view to properties.</para>
+</listitem>
+<listitem>yahoo-stock
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-    <property iri="foaf:name>
-      <value>Joe</value>
-    </property>
-    <view type="properties"/>
-  </property>
-  <property-of iri="sioc:member_of>
-    <class iri="sioc:Forum" />
-   </property-of>
-</query>
+example: http://finance.yahoo.com/q?s=AAPL
 ]]></programlisting>
-<para>Pick geekCode</para>
+</listitem>
+<listitem>yahoo-traffic
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-    <property iri="foaf:name>
-      <value>Joe</value>
-    </property>
-    <property iri="geekCode">
-      <view type="list"/>
-    </property>
-  </property>
-  <property-of iri="sioc:member_of>
-    <class iri="sioc:Forum" />
-  </property-of>
-</query>
+example: http://local.yahooapis.com/MapsService/V1/trafficData?appid=YahooDemo&street=701+First+Street&city=Sunnyvale&state=CA
 ]]></programlisting>
-<para>We specify no restriction on the geekCode. Click the shown variable to take the focus back to Mike.</para>
+</listitem>
+<listitem>Bugzilla
 <programlisting><![CDATA[
-<query>
-  <text>Mike</text>
-  <property iri="foaf:knows>
-    <property iri="foaf:name>
-      <value>Joe</value>
-    </property>
-    <property iri="geekCode"></property>
-  </property>
-  <property-of iri="sioc:member_of>
-    <class iri="sioc:Forum" />
-  </property-of>
-  <view type="text"/>
-</query>
+example: https://bugzilla.mozilla.org/show_bug.cgi?id=251714
 ]]></programlisting>
-</sect4>
-<sect4 id="virtuosospongerfacentui">
-  <title>WebService Interface</title>
-<sect5 id="virtuosospongerfacentuirest">
-  <title>REST interface</title>
-  <para>The Virtuoso Facets web service provide following REST interface:</para>
-  <para>Service description:</para>
-    <itemizedlist mark="bullet">
-  <listitem>Endpoint: http://<cname>/fct/service for ex. http://lod.openlinksw.com/fct/service </listitem>
-  <listitem>HTTP method: POST</listitem>
-  <listitem>Content-Type: MUST be 'text/xml'</listitem>
-  <listitem>The entity body must be XML document with top element 'query' as described above.</listitem>
-  <listitem>The request response namespace MUST be "http://openlinksw.com/services/facets/1.0"</listitem>
-    </itemizedlist>
-  <para>Error conditions:</para>
-  <para>The all error conditions are reported via 'Error explanation'</para>
-  <para>Files:</para>
-  <para>The facet_svc.sql contains web service code and virtual directory mapping, and it uses
-fct_req.xsl & fct_resp.xsl as request & response filters.</para>
-  <para>Example:</para>
-  <para>Using CURL program</para>
+</listitem>
+<listitem>SVG</listitem>
+<listitem>OO document
 <programlisting><![CDATA[
-curl -H "Content-Type: text/xml" -d @post.xml  http://lod.openlinksw.com/fct/service
+needs: unzip plugin
 ]]></programlisting>
-  <para>Where 'post.xml' document contains query document:</para>
+</listitem>
+<listitem>Wikipedia
 <programlisting><![CDATA[
-<?xml version="1.0"?>
-<query xmlns="http://openlinksw.com/services/facets/1.0" inference="" same-as="">
-  <text> Seattle Mariners traveled all the way to Japan to watch</text>
-  <view type="text" limit="20" offset=""/>
-</query>
+needs: php plugin & dbpedia extractor
+example: http://wikipedia.org/wiki/London
 ]]></programlisting>
-  <para>Produces following response:</para>
+</listitem>
+<listitem>Opencalais</listitem>
+<listitem>iCalendar</listitem>
+</itemizedlist>
+<para><emphasis>GRDDL</emphasis></para>
+  <itemizedlist>
+<listitem>Google Base (google)
 <programlisting><![CDATA[
-<fct:facets xmlns:fct="http://openlinksw.com/services/facets/1.0/">
-<fct:sparql>   SELECT distinct ?s1 as ?c1, (bif:search_excerpt (bif:vector ('THE', 'MARINERS', 'WAY', 'SEATTLE', 'WATCH', 'ALL', 'TO', 'JAPAN', 'TRAVELED'), ?o1)) as ?c2  WHERE { ?s1 ?s1textp ?o1 . FILTER (bif:contains (?o1, '(THE AND MARINERS AND WAY AND SEATTLE AND WATCH AND ALL AND TO AND JAPAN AND TRAVELED)')) . } LIMIT 20  OFFSET 0 </fct:sparql>
-<fct:time>116</fct:time>
-<fct:complete>yes</fct:complete>
-<fct:db-activity>   134R rnd  9.488KR seq      0P disk  8.966MB /    602 messages</fct:db-activity>
- <fct:result>
-  <fct:row>
-    <fct:column datatype="url" shortform="http://bobdupuy.mlbl...ld_baseball__6.html">http://bobdupuy.mlblogs.com/bobdupuy/2006/03/world_baseball__6.html></fct:column>
-    <fct:column />
-    <fct:column><span class="srch_xerpt">... While Chuck Armstrong president of <b>the</b> <b>Seattle</b> <b>Mariners</b> <b>traveled</b> <b>all</b> <b>the</b> <b>way</b> <b>to</b> <b>Japan</b> <b>to</b> <b>watch</b> Ichiro... for <b>the</b> advancing <b>Japan</b> team last week <b>the</b> star from <b>the</b> <b>Seattle</b> roster so far in Round 1 has without a doubt... leading <b>the</b> Dominican <b>to</b> its...</span></fct:column>
-  </fct:row>
-  <fct:row>
-    <fct:column datatype="url" shortform="http://bobdupuy.mlbl...ld_baseball__6.html">http://bobdupuy.mlblogs.com/bobdupuy/2006/03/world_baseball__6.html></fct:column>
-    <fct:column />
-    <fct:column><span class="srch_xerpt">Orlando While Chuck Armstrong president of <b>the</b> <b>Seattle</b> <b>Mariners</b> <b>traveled</b> <b>all</b> <b>the</b> <b>way</b> <b>to</b> <b>Japan</b> <b>to</b> <b>watch</b>... perform for <b>the</b> advancing <b>Japan</b> team last week <b>the</b> star from <b>the</b> <b>Seattle</b> roster so far in Round 1 has without...</span></fct:column>
-  </fct:row>
- </fct:result>
-</fct:facets>
+example: http://www.google.com/base/feeds/snippets/17891817243016304554
 ]]></programlisting>
-      </sect5>
-<sect5 id="virtuosospongerfacentuirestapi">
-  <title>Virtuoso APIs for Facet REST services</title>
-<para>The Virtuoso APIs for FCT REST services are Virtuoso Stored Procedures that enable faceted browsing
-over Linked Data hosted in the RDF Quad Store. This also includes Linked Data that is progressively
-added to the Quad Store via URI de-referencing.
-</para>
-<para>They enable the use Virtuoso's VSP/VSPX technology to produce (X)HTML-based Linked Data explorer
-pages that are endowed with high-performance (in-process) faceted browsing capability.
-</para>
-<para>You can use this API with Virtuoso SQL calls that provide data to your VSP/VSPX, ASP.NET, PHP,
-etc., -based interfaces using ODBC, JDBC, ADO.NET, or XMLA connectivity (SPASQL) to Virtuoso.
+</listitem>
+<listitem>eRDF</listitem>
+<listitem>RDFa</listitem>
+<listitem>hCard</listitem>
+<listitem>hCalendar</listitem>
+<listitem>hReview</listitem>
+<listitem>relLicense</listitem>
+<listitem>XBRL</listitem>
+<listitem>HR-XML</listitem>
+<listitem>DC</listitem>
+<listitem>geoURL</listitem>
+<listitem>Ning</listitem>
+<listitem>XFN</listitem>
+<listitem>xFolk</listitem>
+</itemizedlist>
+<para><emphasis>URN handlers</emphasis></para>
+<table colsep="1" frame="all" rowsep="0" shortentry="0" tocentry="1" tabstyle="decimalstyle" orient="land" pgwide="0">
+    <title>URN handlers List</title>
+    <tgroup align="char" charoff="50" char="." cols="6">
+    <colspec align="left" colnum="1" colsep="0" colwidth="20pc"/>
+    <thead>
+      <row>
+        <entry>URN handler</entry>
+        <entry>Sample URI</entry>
+        <entry>Resource Description</entry>
+        <entry>Linked Data View</entry>        
+        <entry>Linked Data Graph</entry>        
+        <entry>Needs</entry>                
+      </row>
+    </thead>
+    <tbody>
+      <row>
+        <entry>LSID</entry>
+        <entry>urn:lsid:ubio.org:namebank:12292</entry>
+        <entry><ulink url="http://demo.openlinksw.com/about/html/urn:lsid:ubio.org:namebank:12292">HTML Representation</ulink></entry>
+        <entry><ulink url="http://demo.openlinksw.com/describe/?url=urn:lsid:ubio.org:namebank:12292">Linked Data View</ulink></entry>
+        <entry><ulink url="http://demo.openlinksw.com/ode/?uri=urn:lsid:ubio.org:namebank:12292">Data Explorer View</ulink></entry>                                
+        <entry>none</entry>        
+      </row>
+      <row>
+        <entry>DOI</entry>
+        <entry>doi:10.1038/35057062</entry>
+        <entry><ulink url="http://demo.openlinksw.com/about/html/doi:10.1038/35057062">HTML Representation</ulink></entry>
+        <entry><ulink url="http://demo.openlinksw.com/describe/?url=doi:10.1038/35057062">Linked Data View</ulink></entry>
+        <entry><ulink url="http://demo.openlinksw.com/ode/?uri=doi:10.1038/35057062">Data Explorer View</ulink></entry>                                
+        <entry>Needs hslookup plugin, relevant html, pdf, xml etc. mappers enabled.</entry>        
+      </row>
+      <row>
+        <entry>OAI</entry>
+        <entry>oai:dcmi.ischool.washington.edu:article/8</entry>
+        <entry><ulink url="http://demo.openlinksw.com/about/html/oai:dcmi.ischool.washington.edu:article/8">HTML Representation</ulink></entry>
+        <entry><ulink url="http://demo.openlinksw.com/describe/?url=oai:dcmi.ischool.washington.edu:article/8">Linked Data View</ulink></entry>
+        <entry><ulink url="http://demo.openlinksw.com/ode/?uri=oai:dcmi.ischool.washington.edu:article/8">Data Explorer View</ulink></entry>                                
+        <entry>none</entry>        
+      </row>
+      
+    </tbody>
+  </tgroup>
+</table>
+<sect3 id="virtuosospongerrdfmappers"><title>SPARQL IRI Dereferencing</title>
+<para>The Virtuoso SPARQL engine (called for brevity just SPARQL bellow) supports IRI Dereferencing,
+however it understands only RDF data, that is it can retrieve only files containing RDF/XML, turtle
+or N3 serialized RDF data, if format is unknown it will try mapping with built-in WebDAV metadata
+extractor. In order to extend this feature with dereferencing web or file resources which naturally
+don't have RDF data (like PDF, JPEG files for example) is provided a special mechanism in SPARQL
+engine. This mechanism is called RDF mappers for translation of non-RDF data files to RDF.</para>
+<para>In order to instruct the SPARQL to call a RDF mapper it needs to be registered and it will
+be called for a given URL or MIME type pattern. In other words, when unknown for SPARQL format is
+received during URL dereferencing process, it will look into a special registry (a table) to match
+either the MIME type or IRI using a regular expression, if match is found the mapper function will
+be called.</para>
+<sect4 id="virtuosospongerproxy"><title>Sponger Proxy service</title>
+<para>Sponger functionality is also exposed via Virtuoso's "/proxy/rdf/" endpoint, as an in-built
+REST style Web service available in any Virtuoso standard installation. This web service takes
+a target URL and either returns the content "as is" or tries to transform (by sponging) to RDF.
+Thus, the proxy service can be used as a 'pipe' for RDF browsers to browse non-RDF sources.
 </para>
-  <sect6 id="virtuosospongerfacentuirestapidef">
-    <title>API Definition</title>
+<para>For more information see <link linkend="rdfproxyservice">RDF Sponger Proxy service</link></para>
+</sect4>
+<sect4 id="virtuosospongercache"><title>Cache Invalidation</title>
+<para>To clear cache on all values of HS_LOCAL_IRI of the SYS_HTTP_SPONGE table use:</para>
 <programlisting><![CDATA[
-CREATE PROCEDURE
-fct_exec
-  (
-    IN  tree     ANY ,
-    IN  timeout  INT
-  )
-    {
-  DECLARE  start_time,
-           view3,
-           inx,
-           n_rows      INT     ;
-  DECLARE  sqls,
-           msg,
-           qr,
-           qr2,
-           act,
-           query       VARCHAR ;
-  DECLARE  md,
-           res,
-           results,
-           more        ANY     ;
-  DECLARE  tmp         ANY     ;
-  DECLARE  offs,
-           lim         INT     ;
+SPARQL clear graph <A-Named-Graph>;
+]]></programlisting>
+</sect4>
+</sect3>
+</sect2>
 
-  SET result_timeout = _min
-                         (
-                           timeout,
-                           ATOI
-                             (
-                               registry_get ('fct_timeout_max')
-                             )
-                         )
-  ;
+<sect2 id="virtuosospongerarch"><title>Cartridge Architecture</title>
+  <sect3 id="virtuosospongerarchcr"><title>What is a Cartridge?</title>
+    <para>See full description <link linkend="virtuosospongeroverviewcartarch">here</link></para>
+  </sect3>
+  <sect3 id="virtuosospongercartridgesextr"><title>Extractor Cartridges</title>
+    <para>An Extractor Cartridge processes a Resource of a given format, extracting RDF according to 
+    	rules appropriate to that format. External data does not come into play; only the content of 
+    	the Resource fed to the Sponger.
+    </para>	
+    <sect4 id="virtuosospongercartridgesstand"><title>Supported Standard Non-RDF Data Formats</title>
+      <para>These Cartridges handle open formats - typically community-developed, openly-documented, 
+      	and freely-licensed data structures.</para>
+<table>
+<tgroup cols="4">
+<thead>
+  <row>
+    <entry>Cartridge</entry><entry>Sample URI</entry><entry>Resource Description</entry><entry>Linked Data Graph</entry>
+  </row>
+</thead>
+<tbody>
+<row><entry>AB Meta</entry><entry><ulink url="http://abmeta.org/album2.html">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/abmeta.org/album2.html">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://abmeta.org/album2.html">Data Explorer View</ulink> </entry></row>
+<row><entry>Atom</entry><entry><ulink url="http://www.openlinksw.com/blog/~kidehen/gems/atom.xml">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/www.openlinksw.com/blog/~kidehen/gems/atom.xml">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.openlinksw.com/blog/~kidehen/gems/atom.xml">Data Explorer View</ulink> </entry></row>
+<row><entry>CSV</entry><entry><ulink url="http://data.london.gov.uk/datafiles/business-economy/employment-projections-sector-2009.csv">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/data.london.gov.uk/datafiles/business-economy/employment-projections-sector-2009.csv">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://data.london.gov.uk/datafiles/business-economy/employment-projections-sector-2009.csv">Data Explorer View</ulink> </entry></row>
+<row><entry>DC</entry><entry><ulink url="http://dublincore.org/2008/01/14/dcterms.rdf">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/dublincore.org/2008/01/14/dcterms.rdf">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://dublincore.org/2008/01/14/dcterms.rdf">Data Explorer View</ulink> </entry></row>
+<row><entry>eRDF</entry><entry><ulink url="http://www.w3.org/2001/sw/grddl-wg/doc29/hotel-data.html">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/www.w3.org/2001/sw/grddl-wg/doc29/hotel-data.html">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.w3.org/2001/sw/grddl-wg/doc29/hotel-data.html">Data Explorer View</ulink> </entry></row>
+<row><entry>hAudio</entry><entry><ulink url="http://alpha.libre.fm/user/weborganics">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/alpha.libre.fm/user/weborganics">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://alpha.libre.fm/user/weborganics">Data Explorer View</ulink> </entry></row>
+<row><entry>hCalendar</entry><entry><ulink url="http://www.maine.gov/portal/government/calendar.shtml">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/www.maine.gov/portal/government/calendar.shtml">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.maine.gov/portal/government/calendar.shtml">Data Explorer View</ulink></entry></row>
+<row><entry>hCard</entry><entry><ulink url="http://dbaron.org/">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/dbaron.org/">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://dbaron.org/">Data Explorer View</ulink></entry></row>
+<row><entry>hListing</entry><entry><ulink url="http://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback2&userid=manganos&ftab=AllFeedback&frm=284&iid=5863912155">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback2&userid=manganos&ftab=AllFeedback&frm=284&iid=5863912155">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback2&userid=manganos&ftab=AllFeedback&frm=284&iid=5863912155">Data Explorer View</ulink></entry></row>
+<row><entry>hNews</entry><entry><ulink url="http://www.semissourian.com/story/1620555.html">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http://www.semissourian.com/story/1620555.html">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.semissourian.com/story/1620555.html">Data Explorer View</ulink></entry></row>
+<row><entry>hProduct</entry><entry><ulink url="http://www.roger-junca.com/Roti-de-magret-du-Sud-ouest-produit-89.html">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/www.roger-junca.com/Roti-de-magret-du-Sud-ouest-produit-89.html">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.roger-junca.com/Roti-de-magret-du-Sud-ouest-produit-89.html">Data Explorer View</ulink></entry></row>
+<row><entry>HR-XML</entry><entry><ulink url="http://ns.hr-xml.org/2_5/HR-XML-2_5/SEP/ResumeExample.xml">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/ns.hr-xml.org/2_5/HR-XML-2_5/SEP/ResumeExample.xml">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://ns.hr-xml.org/2_5/HR-XML-2_5/SEP/ResumeExample.xml">Data Explorer View</ulink></entry></row>
+<row><entry>hRecipe</entry><entry><ulink url="http://www.bbc.co.uk/food/recipes/beef_tacos_with_salsa_67130%01hrecipe">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/www.bbc.co.uk/food/recipes/beef_tacos_with_salsa_67130%01hrecipe">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.bbc.co.uk/food/recipes/beef_tacos_with_salsa_67130">Data Explorer View</ulink></entry></row>
+<row><entry>hResume</entry><entry><ulink url="http://brev.name/resume/brev-resume.html">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/brev.name/resume/brev-resume.html">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://brev.name/resume/brev-resume.html">Data Explorer View</ulink></entry></row>
+<row><entry>hReview</entry><entry><ulink url="http://www.concertbuzz.net/genres/classic-rock/jethro-tull.html">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/www.concertbuzz.net/genres/classic-rock/jethro-tull.html">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.concertbuzz.net/genres/classic-rock/jethro-tull.html">Data Explorer View</ulink></entry></row>
+<row><entry>HTTP in RDF</entry><entry><ulink url="http://linkeddata.uriburner.com/about/rdf/http://data.london.gov.uk/datafiles/business-economy/employment-projections-sector-2009.csv">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/linkeddata.uriburner.com/about/rdf/http://data.london.gov.uk/datafiles/business-economy/employment-projections-sector-2009.csv">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/rdf/http://data.london.gov.uk/datafiles/business-economy/employment-projections-sector-2009.csv">Data Explorer View</ulink></entry></row>
+<row><entry>iCalendar</entry><entry><ulink url="http://www.mozilla.org/projects/calendar/caldata/AustrianHolidays.ics">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/www.mozilla.org/projects/calendar/caldata/AustrianHolidays.ics">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.mozilla.org/projects/calendar/caldata/AustrianHolidays.ics">Data Explorer View</ulink></entry></row>
+<row><entry>Microsoft Word 2003 XML Document</entry><entry><ulink url="http://ec2-174-129-156-25.compute-1.amazonaws.com/DAV/office_tests/word2003xml.xml">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/ec2-174-129-156-25.compute-1.amazonaws.com/DAV/office_tests/word2003xml.xml">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://ec2-174-129-156-25.compute-1.amazonaws.com/DAV/office_tests/word2003xml.xml">Data Explorer View</ulink></entry></row>
+<row><entry>Microsoft XML Spreadsheet 2003</entry><entry><ulink url="http://mathewpeet.org/thesis/programs/spreadsheet/XRDCALC-LATTICEPARAM.xls">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/mathewpeet.org/thesis/programs/spreadsheet/XRDCALC-LATTICEPARAM.xls">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://mathewpeet.org/thesis/programs/spreadsheet/XRDCALC-LATTICEPARAM.xls">Data Explorer View</ulink></entry></row>
+<row><entry>Microsoft Documents</entry><entry><ulink url="http://data.london.gov.uk/datafiles/business-economy/employment-projections-sector-2009.csv">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/linkeddata.uriburner.com/about/rdf/http://data.london.gov.uk/datafiles/business-economy/employment-projections-sector-2009.csv">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/rdf/http://data.london.gov.uk/datafiles/business-economy/employment-projections-sector-2009.csv">Data Explorer View</ulink></entry></row>
+<row><entry>OData</entry><entry><ulink url="http://services.odata.org/Northwind/Northwind.svc/">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http://services.odata.org/Northwind/Northwind.svc/">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://services.odata.org/Northwind/Northwind.svc/">Data Explorer View</ulink></entry></row>
+<row><entry>OO document</entry><entry><ulink url="http://www.pitonyak.org/AndrewMacro.odt">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/www.pitonyak.org/AndrewMacro.odt">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.pitonyak.org/AndrewMacro.odt">Data Explorer View</ulink></entry></row>
+<row><entry>OPML</entry><entry><ulink url="http://news.bbc.co.uk/rss/feeds.opml">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/news.bbc.co.uk/rss/feeds.opml">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://news.bbc.co.uk/rss/feeds.opml">Data Explorer View</ulink></entry></row>
+<row><entry>PPTX</entry><entry><ulink url="http://download.microsoft.com/download/4/D/E/4DE0D83D-7845-4FD1-9A8E-12F532EC81BC/Keynote.pptx">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/download.microsoft.com/download/4/D/E/4DE0D83D-7845-4FD1-9A8E-12F532EC81BC/Keynote.pptx">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://download.microsoft.com/download/4/D/E/4DE0D83D-7845-4FD1-9A8E-12F532EC81BC/Keynote.pptx">Data Explorer View</ulink></entry></row>
+<row><entry>RDFa</entry><entry><ulink url="http://virtuoso.openlinksw.com/presentations/Creating_Deploying_Exploiting_Linked_Data2/Creating_Deploying_Exploiting_Linked_Data2_TimBL_v3.html">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/virtuoso.openlinksw.com/presentations/Creating_Deploying_Exploiting_Linked_Data2/Creating_Deploying_Exploiting_Linked_Data2_TimBL_v3.html">HTML Representation</ulink> </entry><entry>  <ulink url="http://virtuoso.openlinksw.com/presentations/Creating_Deploying_Exploiting_Linked_Data2/Creating_Deploying_Exploiting_Linked_Data2_TimBL_v3.html">Data Explorer View</ulink></entry></row>
+<row><entry>RSS</entry><entry><ulink url="http://microformats.org/feed/">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/microformats.org/feed/">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://microformats.org/feed/">Data Explorer View</ulink></entry></row>
+<row><entry>Slidy</entry><entry><ulink url="http://slideshow.rubyforge.org/microformats.html">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/slideshow.rubyforge.org/microformats.html">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://slideshow.rubyforge.org/microformats.html">Data Explorer View</ulink></entry></row>
+<row><entry>vCalendar</entry><entry><ulink url="http://upcoming.org/event/130719/">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/upcoming.org/event/130719/">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://upcoming.org/event/130719/">Data Explorer View</ulink></entry></row>
+<row><entry>vCard</entry><entry><ulink url="http://tech.yahoo.com/pr/apple-ipod-video-30gb-black-mp3-player/1992981873">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/tech.yahoo.com/pr/apple-ipod-video-30gb-black-mp3-player/1992981873">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://tech.yahoo.com/pr/apple-ipod-video-30gb-black-mp3-player/1992981873">Data Explorer View</ulink></entry></row>
+<row><entry>WebDAV Metadata</entry><entry><ulink url="http://data.london.gov.uk/datafiles/business-economy/employment-projections-sector-2009.csv">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/linkeddata.uriburner.com/about/rdf/http://data.london.gov.uk/datafiles/business-economy/employment-projections-sector-2009.csv">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/rdf/http://data.london.gov.uk/datafiles/business-economy/employment-projections-sector-2009.csv">Data Explorer View</ulink></entry></row>
+<row><entry>XBRL</entry><entry><ulink url="http://www.sec.gov/Archives/edgar/data/51143/000110465908059468/ibm-20080429.xml">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http://www.sec.gov/Archives/edgar/data/51143/000110465908059468/ibm-20080429.xml">HTML Representation</ulink> </entry><entry>  <ulink url="http://www.sec.gov/Archives/edgar/data/51143/000110465908059468/ibm-20080429.xml">Data Explorer View</ulink></entry></row>
+<row><entry>XFN Profile</entry><entry><ulink url="http://www.molly.com/people.php">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/www.molly.com/people.php">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.molly.com/people.php">Data Explorer View</ulink></entry></row>
+<row><entry>XFN Profile2</entry><entry><ulink url="http://www.molly.com/people.php">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/www.molly.com/people.php">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.molly.com/people.php">Data Explorer View</ulink></entry></row>
+<row><entry>xHTML</entry><entry><ulink url="http://virtuoso.openlinksw.com/Whitepapers/html/AIW_Virtuoso_SOA.htm">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/virtuoso.openlinksw.com/Whitepapers/html/AIW_Virtuoso_SOA.htm">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://virtuoso.openlinksw.com/Whitepapers/html/AIW_Virtuoso_SOA.htm">Data Explorer View</ulink></entry></row>
+<row><entry>XHTML</entry><entry><ulink url="http://www.lespetitescases.net/semantique-et-xhtml">example</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/about/html/http/www.lespetitescases.net/semantique-et-xhtml">HTML Representation</ulink> </entry><entry>  <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.lespetitescases.net/semantique-et-xhtml">Data Explorer View</ulink></entry></row>
+</tbody>
+</tgroup>
+</table>
+    </sect4>
+    <sect4 id="virtuosospongercartridgesnonstand"><title>Supported Standard Non-RDF Data Formats</title>
+<para>These Cartridges handle closed formats - typically proprietary; sometimes undocumented; possibly 
+	licensed to no-one except the format originator. Sometimes data may not be parsed as desired or 
+	expected, as many of these Cartridges have required reverse-engineering of the data format 
+	in question.</para>
+<table>
+<tgroup cols="4">
+<thead>
+  <row>
+    <entry>Cartridge</entry><entry>Sample URI</entry><entry>Resource Description</entry><entry>Linked Data Graph</entry>
+  </row>
+</thead>
+<tbody>
+<row><entry>Amazon</entry><entry>   <ulink url="http://www.amazon.com/gp/product/0553383043">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.amazon.com/gp/product/0553383043">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.amazon.com/gp/product/0553383043">Data Explorer View</ulink> </entry></row>
+<row><entry>BestBuy</entry><entry>   <ulink url="http://www.bestbuy.com/site/KOSS+-+Pro+DJ100+Professional+Over-the-Ear+Headphones+-+Black/9745789.p?skuId=9745789&id=1218165774336">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.bestbuy.com/site/KOSS+-+Pro+DJ100+Professional+Over-the-Ear+Headphones+-+Black/9745789.p?skuId=9745789&id=1218165774336">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.bestbuy.com/site/KOSS+-+Pro+DJ100+Professional+Over-the-Ear+Headphones+-+Black/9745789.p?skuId=9745789&id=1218165774336">Data Explorer View</ulink> </entry></row>
+<row><entry>Bing</entry><entry>   <ulink url="http://www.bing.com/community/members/livesearch/default.aspx">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.bing.com/community/members/livesearch/default.aspx">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.bing.com/community/members/livesearch/default.aspx">Data Explorer View</ulink> </entry></row>
+<row><entry>Bugzillas</entry><entry>   <ulink url="https://bugzilla.mozilla.org/show_bug.cgi?id=251714">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/https://bugzilla.mozilla.org/show_bug.cgi?id=251714">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=https://bugzilla.mozilla.org/show_bug.cgi?id=251714">Data Explorer View</ulink> </entry></row>
+<row><entry>CNET</entry><entry>   <ulink url="http://shopper.cnet.com/samsung-moment-sprint/4014-6452_9-33775546.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/linkeddata.uriburner.com/about/rdf/http://shopper.cnet.com/samsung-moment-sprint/4014-6452_9-33775546.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/rdf/http://shopper.cnet.com/samsung-moment-sprint/4014-6452_9-33775546.html">Data Explorer View</ulink> </entry></row>
+<row><entry>CrunchBase</entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/rdf/http://www.crunchbase.com/company/radar-music-videos">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/linkeddata.uriburner.com/about/rdf/http://www.crunchbase.com/company/radar-music-videos">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/rdf/http://www.crunchbase.com/company/radar-music-videos">Data Explorer View</ulink> </entry></row>
+<row><entry>Delicious</entry><entry>   <ulink url="http://delicious.com/popular/blog">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/delicious.com/popular/blog">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://delicious.com/popular/blogI">Data Explorer View</ulink> </entry></row>
+<row><entry>Digg</entry><entry>   <ulink url="http://digg.com/general_sciences/At_Last-Stem_Cells_without_Side_Effects_">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/digg.com/general_sciences/At_Last-Stem_Cells_without_Side_Effects_">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://digg.com/general_sciences/At_Last-Stem_Cells_without_Side_Effects_">Data Explorer View</ulink> </entry></row>
+<row><entry>Discogs</entry><entry>   <ulink url="http://www.discogs.com/Todd-Barton-and...ic-Poetry-Of-The-Kesh/release/2053074">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.amazon.com/o/ASIN/0553383043">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.amazon.com/o/ASIN/0553383043">Data Explorer View</ulink> </entry></row>
+<row><entry>Disqus</entry><entry>   <ulink url="http://www.scripting.com/stories/2009/02/01/wheresYourData.html#disqus_thread">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.scripting.com/stories/2009/02/01/wheresYourData.html#disqus_thread">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.scripting.com/stories/2009/02/01/wheresYourData.html#disqus_thread">Data Explorer View</ulink> </entry></row>
+<row><entry>DOI</entry><entry>   <ulink url="http://doi.ieeecomputersociety.org/10.1109/MIC.2008.16">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/doi.ieeecomputersociety.org/10.1109/MIC.2008.16">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://doi.ieeecomputersociety.org/10.1109/MIC.2008.16">Data Explorer View</ulink> </entry></row>
+<row><entry>Dublin Core</entry><entry>   <ulink url="http://dublincore.org/documents/2002/07/31/dcmes-xml/dcmes-xml-dtd.shtml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/dublincore.org/documents/2002/07/31/dcmes-xml/dcmes-xml-dtd.shtml">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://dublincore.org/documents/2002/07/31/dcmes-xml/dcmes-xml-dtd.shtml">Data Explorer View</ulink> </entry></row>
+<row><entry>eBay</entry><entry>   <ulink url="http://cell-phones.shop.ebay.com/Cell-Phones-Smartphones-/3312/i.html?LH_TopRatedSellers=1&LH_ItemCondition=1&Brand=Apple%2520iPhone&LH_Price=100..%40c&_nkw=%22iphone+4%22&_trkparms=65%253A15%257C66%253A2%257C39%253A1&_dmd=1&_dmpt=Cell_Phones&_mPrRngCbx=1&_sc=1&_sticky=1&_trksid=p3907.m551&_sop=12&_sc=1%26clkid%3D6198561558861688578&_qi=RTM733776">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/cell-phones.shop.ebay.com/Cell-Phones-Smartphones-/3312/i.html?LH_TopRatedSellers=1&LH_ItemCondition=1&Brand=Apple%2520iPhone&LH_Price=100..%40c&_nkw=%22iphone+4%22&_trkparms=65%253A15%257C66%253A2%257C39%253A1&_dmd=1&_dmpt=Cell_Phones&_mPrRngCbx=1&_sc=1&_sticky=1&_trksid=p3907.m551&_sop=12&_sc=1%26clkid%3D6198561558861688578&_qi=RTM733776">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://cell-phones.shop.ebay.com/Cell-Phones-Smartphones-/3312/i.html?LH_TopRatedSellers=1&LH_ItemCondition=1&Brand=Apple%2520iPhone&LH_Price=100..%40c&_nkw=%22iphone+4%22&_trkparms=65%253A15%257C66%253A2%257C39%253A1&_dmd=1&_dmpt=Cell_Phones&_mPrRngCbx=1&_sc=1&_sticky=1&_trksid=p3907.m551&_sop=12&_sc=1%26clkid%3D6198561558861688578&_qi=RTM733776">Data Explorer View</ulink> </entry></row>
+<row><entry>Evri</entry><entry>   <ulink url="http://www.evri.com/organization/general-motors-0x4938f">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.evri.com/organization/general-motors-0x4938f">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.evri.com/organization/general-motors-0x4938f">Data Explorer View</ulink> </entry></row>
+<row><entry>FaceBook</entry><entry>   <ulink url="http://www.facebook.com/people/Richard-Max-Koster/1319314117">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.facebook.com/people/Richard-Max-Koster/1319314117">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.facebook.com/people/Richard-Max-Koster/1319314117">Data Explorer View</ulink> </entry></row>
+<row><entry>Flickr</entry><entry>   <ulink url="http://farm1.static.flickr.com/212/496684670_7122c831ed.jpg">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/www.google.com/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.amazon.com/o/ASIN/0553383043">Data Explorer View</ulink> </entry></row>
+<row><entry>Freebase</entry><entry>   <ulink url="http://www.freebase.com/view/location">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.freebase.com/view/location">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.freebase.com/view/location">Data Explorer View</ulink> </entry></row>
+<row><entry>Geonames</entry><entry>   <ulink url="http://ws.geonames.org/search?q=london&amp;maxRows=10&amp;type=rdf">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/ws.geonames.org/search?q=london&amp;maxRows=10&amp;type=rdf">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://ws.geonames.org/search?q=london&amp;maxRows=10&amp;type=rdf">Data Explorer View</ulink> </entry></row>
+<row><entry>geoURL</entry><entry>   <ulink url="http://geourl.org/near?p=wiki.worldflicks.org/saanen.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/geourl.org/near?p=wiki.worldflicks.org/saanen.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://geourl.org/near?p=wiki.worldflicks.org/saanen.html">Data Explorer View</ulink> </entry></row>
+<row><entry>Get Satisfaction</entry><entry>   <ulink url="http://getsatisfaction.com/mozilla/topics/ubiquity_mostly_fails_on_mac_ppc">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/getsatisfaction.com/mozilla/topics/ubiquity_mostly_fails_on_mac_ppc">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://getsatisfaction.com/mozilla/topics/ubiquity_mostly_fails_on_mac_ppc">Data Explorer View</ulink> </entry></row>
+<row><entry>Google Base</entry><entry>   <ulink url="http://www.google.com/base/feeds/snippets">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.google.com/base/feeds/snippets/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.google.com/base/feeds/snippets">Data Explorer View</ulink> </entry></row>
+<row><entry>Google Book</entry><entry>   <ulink url="http://books.google.com/books?id=SRadJIuhVjAC&dq=GOOGLE&ie=ISO-8859-1&source=gbs_gdata">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://books.google.com/books?id=SRadJIuhVjAC&dq=GOOGLE&ie=ISO-8859-1&source=gbs_gdata">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://books.google.com/books?id=SRadJIuhVjAC&dq=GOOGLE&ie=ISO-8859-1&source=gbs_gdata">Data Explorer View</ulink> </entry></row>
+<row><entry>Google Document</entry><entry>   <ulink url="http://docs.google.com/Present?docid=dc7jvc6m_1056g8fs54hp">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/docs.google.com/Present?docid=dc7jvc6m_1056g8fs54hp">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://docs.google.com/Present?docid=dc7jvc6m_1056g8fs54hp">Data Explorer View</ulink> </entry></row>
+<row><entry>Google Social Graph</entry><entry>   <ulink url="http://socialgraph.apis.google.com/lookup?q=http://example.com/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/socialgraph.apis.google.com/lookup?q=http://example.com/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://socialgraph.apis.google.com/lookup?q=http://example.com/">Data Explorer View</ulink> </entry></row>
+<row><entry>Google Spreadsheet</entry><entry>   <ulink url="http://spreadsheets.google.com/pub?key=p9pdwsai2hDMsLkXsoM05KQ&gid=1">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/spreadsheets.google.com/pub?key=p9pdwsai2hDMsLkXsoM05KQ&gid=1">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://spreadsheets.google.com/pub?key=p9pdwsai2hDMsLkXsoM05KQ&gid=1">Data Explorer View</ulink> </entry></row>
+<row><entry>Hoovers</entry><entry>   <ulink url="http://www.hoovers.com/openlink/--ID__104304--/free-co-factsheet.xhtml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.hoovers.com/openlink/--ID__104304--/free-co-factsheet.xhtml">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.hoovers.com/openlink/--ID__104304--/free-co-factsheet.xhtml">Data Explorer View</ulink> </entry></row>
+<row><entry>ISBN</entry><entry>   <ulink url="http://isbndb.com/search-all.html?kw=King+Stephen">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/isbndb.com/search-all.html?kw=King+Stephen">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://isbndb.com/search-all.html?kw=King+Stephen">Data Explorer View</ulink> </entry></row>
+<row><entry>LastFM</entry><entry>   <ulink url="http://www.last.fm/music/+noredirect/Teddy+Pendegrass">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.last.fm/music/+noredirect/Teddy+Pendegrass">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.last.fm/music/+noredirect/Teddy+Pendegrass">Data Explorer View</ulink> </entry></row>
+<row><entry>LibraryThing</entry><entry>   <ulink url="http://www.librarything.com/work/1060">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.librarything.com/work/1060">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.librarything.com/work/1060">Data Explorer View</ulink> </entry></row>
+<row><entry>LSID</entry><entry>   <ulink url="http://lsid.tdwg.org/urn:lsid:ubio.org:namebank:11815">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/lsid.tdwg.org/urn:lsid:ubio.org:namebank:11815">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://lsid.tdwg.org/urn:lsid:ubio.org:namebank:11815">Data Explorer View</ulink> </entry></row>
+<row><entry>Meetup</entry><entry>   <ulink url="http://www.meetup.com/Nonpracticing-Lawyers-Social-Support-Group/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.meetup.com/Nonpracticing-Lawyers-Social-Support-Group/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.meetup.com/Nonpracticing-Lawyers-Social-Support-Group/">Data Explorer View</ulink> </entry></row>
+<row><entry>MusicBrainz</entry><entry>   <ulink url="http://musicbrainz.org/release/37e955d4-a53c-45aa-a812-1b23b88dbc13.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/musicbrainz.org/release/37e955d4-a53c-45aa-a812-1b23b88dbc13.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://musicbrainz.org/release/37e955d4-a53c-45aa-a812-1b23b88dbc13.html">Data Explorer View</ulink> </entry></row>
+<row><entry>Ning Metadata</entry><entry>   <ulink url="http://www.ning.com/search?q=new+york+city&sf=rs&rs=1">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.ning.com/search?q=new+york+city&sf=rs&rs=1">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.ning.com/search?q=new+york+city&sf=rs&rs=1">Data Explorer View</ulink> </entry></row>
+<row><entry>OAI</entry><entry>   <ulink url="http://news.cnet.com/IBM%2C-screensaver-to-tackle-smallpox/2100-1008_3-983374.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/news.cnet.com/IBM%2C-screensaver-to-tackle-smallpox/2100-1008_3-983374.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://news.cnet.com/IBM%2C-screensaver-to-tackle-smallpox/2100-1008_3-983374.html">Data Explorer View</ulink> </entry></row>
+<row><entry>Open Social</entry><entry>   <ulink url="http://socialgraph.apis.google.com/otherme?pretty=1&amp;q=www.openlinksw.com/blog/~kidehen/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/socialgraph.apis.google.com/otherme?pretty=1&amp;q=www.openlinksw.com/blog/~kidehen/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://socialgraph.apis.google.com/otherme?pretty=1&amp;q=www.openlinksw.com/blog/~kidehen/">Data Explorer View</ulink> </entry></row>
+<row><entry>OpenLibrary</entry><entry>   <ulink url="http://openlibrary.org/b/OL1230137M">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/openlibrary.org/b/OL1230137M">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://openlibrary.org/b/OL1230137M">Data Explorer View</ulink> </entry></row>
+<row><entry>OpenStreetMap</entry><entry>   <ulink url="http://openstreetmap.org/?lat=57.6569&amp;lon=11.8886&amp;zoom=14&amp;layers=B000FTF">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/openstreetmap.org/?lat=57.6569&amp;lon=11.8886&amp;zoom=14&amp;layers=B000FTF">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://openstreetmap.org/?lat=57.6569&amp;lon=11.8886&amp;zoom=14&amp;layers=B000FTF">Data Explorer View</ulink> </entry></row>
+<row><entry>oReilly</entry><entry>   <ulink url="http://oreilly.com/catalog/9780596523206/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/oreilly.com/catalog/9780596523206/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://oreilly.com/catalog/9780596523206/">Data Explorer View</ulink> </entry></row>
+<row><entry>Picasa</entry><entry>   <ulink url="http://picasaweb.google.com/lh/explore#utm_medium=embed&utm_source=pwalogin">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://picasaweb.google.com/lh/explore#utm_medium=embed&utm_source=pwalogin">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://picasaweb.google.com/lh/explore#utm_medium=embed&utm_source=pwalogin">Data Explorer View</ulink> </entry></row>
+<row><entry>PowerPoint</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/presentations/Creating_Deploying_Exploiting_Linked_Data2/Linked_Data_2008_keynote.ppt">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/virtuoso.openlinksw.com/presentations/Creating_Deploying_Exploiting_Linked_Data2/Linked_Data_2008_keynote.ppt">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://virtuoso.openlinksw.com/presentations/Creating_Deploying_Exploiting_Linked_Data2/Linked_Data_2008_keynote.ppt">Data Explorer View</ulink> </entry></row>
+<row><entry>Radio Pop</entry><entry>   <ulink url="http://www.radiopop.co.uk/users/tristanf/friends.xml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.radiopop.co.uk/users/tristanf/friends.xml">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.radiopop.co.uk/users/tristanf/friends.xml">Data Explorer View</ulink> </entry></row>
+<row><entry>relLicense</entry><entry>   <ulink url="http://creativecommons.org/licenses/by-nc/3.0/us/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/creativecommons.org/licenses/by-nc/3.0/us/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://creativecommons.org/licenses/by-nc/3.0/us/">Data Explorer View</ulink> </entry></row>
+<row><entry>Revyu</entry><entry>   <ulink url="http://revyu.com/people/smonroe/about/html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/revyu.com/people/smonroe/about/html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://revyu.com/people/smonroe/about/html">Data Explorer View</ulink> </entry></row>
+<row><entry>Rhapsody</entry><entry>   <ulink url="http://mp3.rhapsody.com/playlistdetail?playlistId=ply.25288413">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/mp3.rhapsody.com/playlistdetail?playlistId=ply.25288413">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://mp3.rhapsody.com/playlistdetail?playlistId=ply.25288413">Data Explorer View</ulink> </entry></row>
+<row><entry>SalesForce.com</entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/rdf/https://na6.salesforce.com/0038000000ViF6k#this">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/linkeddata.uriburner.com/about/rdf/https://na6.salesforce.com/0038000000ViF6k#this">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/rdf/https://na6.salesforce.com/0038000000ViF6k#this">Data Explorer View</ulink> </entry></row>
+<row><entry>SlideShare</entry><entry>   <ulink url="http://www.slideshare.net/rumito/rdf-views-of-sql-data-power-point-presentation-1-173180/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.slideshare.net/rumito/rdf-views-of-sql-data-power-point-presentation-1-173180/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.slideshare.net/rumito/rdf-views-of-sql-data-power-point-presentation-1-173180/">Data Explorer View</ulink> </entry></row>
+<row><entry>SlideSix</entry><entry>   <ulink url="http://slidesix.com/view/ESWC2008SPARQLBIOpenLink">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/slidesix.com/view/ESWC2008SPARQLBIOpenLink">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://slidesix.com/view/ESWC2008SPARQLBIOpenLink">Data Explorer View</ulink> </entry></row>
+<row><entry>SVG</entry><entry>   <ulink url="http://www.schepers.cc/semweb/rdf-diagram.svg">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.schepers.cc/semweb/rdf-diagram.svg">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.schepers.cc/semweb/rdf-diagram.svg">Data Explorer View</ulink> </entry></row>
+<row><entry>Tesco</entry><entry>   <ulink url="http://www.tesco.com/superstore/xpi/6/xpi54427686.htm">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.tesco.com/superstore/xpi/6/xpi54427686.htm">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.tesco.com/superstore/xpi/6/xpi54427686.htm">Data Explorer View</ulink> </entry></row>
+<row><entry>Tumblr</entry><entry>   <ulink url="http://cupcakesoftheday.tumblr.com/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://cupcakesoftheday.tumblr.com/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://cupcakesoftheday.tumblr.com/">Data Explorer View</ulink> </entry></row>
+<row><entry>TWFY (theyworkforyou)</entry><entry>   <ulink url="http://www.theyworkforyou.com/mp/diane_abbott/hackney_north_and_stoke_newington">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.theyworkforyou.com/mp/diane_abbott/hackney_north_and_stoke_newington">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.theyworkforyou.com/mp/diane_abbott/hackney_north_and_stoke_newington">Data Explorer View</ulink> </entry></row>
+<row><entry>Twitter</entry><entry>   <ulink url="http://twitter.com/kidehen">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://twitter.com/kidehen">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://twitter.com/kidehen">Data Explorer View</ulink> </entry></row>
+<row><entry>Ustream</entry><entry>   <ulink url="http://www.ustream.tv/recorded/4848859/highlight/55618">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.ustream.tv/recorded/4848859/highlight/55618">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.ustream.tv/recorded/4848859/highlight/55618">Data Explorer View</ulink> </entry></row>
+<row><entry>Web Resource CC (Licenses) </entry><entry>   <ulink url="http://creativecommons.org/licenses/by-nc-nd/2.5/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/creativecommons.org/licenses/by-nc-nd/2.5/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://creativecommons.org/licenses/by-nc-nd/2.5/">Data Explorer View</ulink> </entry></row>
+<row><entry>Wikipedia</entry><entry>   <ulink url="http://en.wikipedia.org/wiki/House_MD">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://en.wikipedia.org/wiki/House_MD">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://en.wikipedia.org/wiki/House_MD">Data Explorer View</ulink> </entry></row>
+<row><entry>xFolk</entry><entry>   <ulink url="http://blogmarks.net/marks/tag/hdd">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/blogmarks.net/marks/tag/hdd">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://blogmarks.net/marks/tag/hdd">Data Explorer View</ulink> </entry></row>
+<row><entry>Yahoo! Finance</entry><entry>   <ulink url="http://finance.yahoo.com/q?s=AAPL">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/finance.yahoo.com/q?s=AAPL">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://finance.yahoo.com/q?s=AAPL">Data Explorer View</ulink> </entry></row>
+<row><entry>Yahoo! SearchMonkey</entry><entry>   <ulink url="http://tech.groups.yahoo.com/group/ysearchboss/message/1983">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/tech.groups.yahoo.com/group/ysearchboss/message/1983">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://tech.groups.yahoo.com/group/ysearchboss/message/1983">Data Explorer View</ulink> </entry></row>
+<row><entry>Yahoo! Traffic Data</entry><entry>   <ulink url="http://local.yahooapis.com/MapsService/rss/trafficData.xml?appid=YdnDemo&street=701+First+Avenue&city=Sunnyvale&state=CA">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/local.yahooapis.com/MapsService/rss/trafficData.xml?appid=YdnDemo&street=701+First+Avenue&city=Sunnyvale&state=CA">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://local.yahooapis.com/MapsService/rss/trafficData.xml?appid=YdnDemo&street=701+First+Avenue&city=Sunnyvale&state=CA">Data Explorer View</ulink> </entry></row>
+<row><entry>Yahoo! Weather</entry><entry>   <ulink url="http://weather.yahooapis.com/forecastrss?p=94089">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/weather.yahooapis.com/forecastrss?p=94089">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://weather.yahooapis.com/forecastrss?p=94089">Data Explorer View</ulink> </entry></row>
+<row><entry>Yelp</entry><entry>   <ulink url="http://api.yelp.com/business_review_search?term=yelp&tl_lat=37.9&tl_long=-122.5&br_lat=37.788022&br_long=-122.399797&limit=3&ywsid=XXXXXXXXXXXXXXXXXX">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/api.yelp.com/business_review_search?term=yelp&tl_lat=37.9&tl_long=-122.5&br_lat=37.788022&br_long=-122.399797&limit=3&ywsid=XXXXXXXXXXXXXXXXXX">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://api.yelp.com/business_review_search?term=yelp&tl_lat=37.9&tl_long=-122.5&br_lat=37.788022&br_long=-122.399797&limit=3&ywsid=XXXXXXXXXXXXXXXXXX">Data Explorer View</ulink> </entry></row>
+<row><entry>Youtube</entry><entry>   <ulink url="http://www.youtube.com/watch?v=rOsPKjbMvxY">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.youtube.com/watch?v=rOsPKjbMvxY">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.youtube.com/watch?v=rOsPKjbMvxY">Data Explorer View</ulink> </entry></row>
+<row><entry>Zillow</entry><entry>   <ulink url="http://www.zillow.com/homedetails/26-George-Rd-Maynard-MA-01754/57086765_zpid">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.zillow.com/homedetails/26-George-Rd-Maynard-MA-01754/57086765_zpid">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.zillow.com/homedetails/26-George-Rd-Maynard-MA-01754/57086765_zpid">Data Explorer View</ulink> </entry></row>
+</tbody>
+</tgroup>
+</table>
+</sect4>
+  </sect3>
+  <sect3 id="virtuosospongercartridgesmeta"><title>Meta Cartridges</title>
+    <para>A Meta Cartridge submits a Resource to a third-party Web Service for processing. Returned RDF 
+    	supplements the RDF generated by Extractor and other Meta Cartridges. Locally generated RDF may 
+    	also be submitted to the third-party services, instead-of or in-addition-to the original 
+    	Resource itself.
+    </para>	
+    <para>Default Sponger behavior is for all installed Meta Cartridges to be brought to bear on all 
+    	submitted Resources:
+    </para>	
+<table>
+<tgroup cols="5">
+<thead>
+  <row>
+    <entry>Cartridge</entry><entry>Sample URI</entry><entry>Resource Description</entry><entry>Linked Data Graph</entry><entry>Notes</entry>
+  </row>
+</thead>
+<tbody>
+<row><entry>Alchemy</entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/id/entity/http/jira.codehaus.org/browse/CONTINUUM-884%01alchemy_entity_1">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/jira.codehaus.org/browse/CONTINUUM-884">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://jira.codehaus.org/browse/CONTINUUM-884">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Amazon Search for products</entry><entry>   <ulink url="http://www.amazon.com/o/ASIN/0553383043#this">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.amazon.com/o/ASIN/0553383043">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.amazon.com/o/ASIN/0553383043">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>BBC</entry><entry>   <ulink url="http://news.bbc.co.uk">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://twitter.com/bbcnews">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://twitter.com/bbcnews">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>BestBuy Search for products</entry><entry>   <ulink url="http://www.bestbuy.com/site/KOSS+-+Pro+DJ100+Professional+Over-the-Ear+Headphones+-+Black/9745789.p?skuId=9745789&id=1218165774336">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.bestbuy.com/site/KOSS+-+Pro+DJ100+Professional+Over-the-Ear+Headphones+-+Black/9745789.p?skuId=9745789&id=1218165774336">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.bestbuy.com/site/KOSS+-+Pro+DJ100+Professional+Over-the-Ear+Headphones+-+Black/9745789.p?skuId=9745789&id=1218165774336">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Bing</entry><entry>   <ulink url="http://www.bing.com/videos/watch/video/cap-reattached-to-leaking-bp-well/6kn9out">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/twitter.com/bing">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://twitter.com/bing">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Bit.ly</entry><entry>   <ulink url="http://bit.ly/cGwRgc">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.springerlink.com/content/528h15634q332p02/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.springerlink.com/content/528h15634q332p02/">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>CNET</entry><entry>   <ulink url="http://www.xomreviews.com/shopper.cnet.com">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.xomreviews.com/shopper.cnet.com">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.xomreviews.com/shopper.cnet.com">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Collecta</entry><entry>   <ulink url="http://www.crunchbase.com/company/microsoft">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.crunchbase.com/company/microsoft">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.crunchbase.com/company/microsoft">Data Explorer View</ulink> </entry><entry>seeAlso links found for microsoft: http://localhost:9301/about/html/http/social.msdn.microsoft.com/Forums/en-US/wpf/thread/108fbffc-c849-4d60-ab3e-00c425342aaf and etc. </entry></row>
+<row><entry>Crunchbase</entry><entry>   <ulink url="http://www.crunchbase.com/company/radar-music-videos">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://techcrunch.com/2010/05/02/rapportive/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://techcrunch.com/2010/05/02/rapportive/">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Dapper</entry><entry>   <ulink url="http://www.dapper.net/dapplications/Blotter/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.alexa.com/siteinfo/dapper.net">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.alexa.com/siteinfo/dapper.net">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>DBpedia</entry><entry>   <ulink url="http://dbpedia.org/page/TweetDeck">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.programmableweb.com/api/dbpedia">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.programmableweb.com/api/dbpedia">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Delicious Meta</entry><entry>   <ulink url="http://delicious.com/tag/crunchbase">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/www.crunchbase.com/company/google">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/id/entity/http/www.crunchbase.com/company/google">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Digg.com</entry><entry>   <ulink url="http://google.com/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/google.com/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://google.com/">Data Explorer View</ulink> </entry><entry>check the rdfs:seeAlso: http://mashable.com/2010/07/12/google-app-inventor/ and etc. from Digg.com</entry></row>
+<row><entry>Discogs</entry><entry>   <ulink url="http://www.discogs.com/Todd-Barton-and...ic-Poetry-Of-The-Kesh/release/2053074">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.amazon.com/o/ASIN/0553383043">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.amazon.com/o/ASIN/0553383043">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Document Links</entry><entry>example</entry><entry>HTML Representation</entry><entry>Data Explorer View</entry><entry></entry></row>
+<row><entry>eBay</entry><entry>   <ulink url="http://shop.ebay.com/stores/__W0QQLHQ5fSellerWithStoreZ1QQ_nkwZtoys?_rdc=1">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/wordpress.xdroop.com/space/HotWheels/Buying+Hotwheels+On+eBay">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://wordpress.xdroop.com/space/HotWheels/Buying+Hotwheels+On+eBay">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Evri Meta</entry><entry>   <ulink url="http://www.evri.com/organization/apple-store-0x60ee5">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.evri.com/organization/apple-store-0x60ee5">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.evri.com/organization/apple-store-0x60ee5">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Flickr Search for photos</entry><entry>   <ulink url="http://farm5.static.flickr.com/4034/4406875198_7e562051cc.jpg">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/www.google.com/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/id/entity/http/www.google.com/">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>FOAF-Search</entry><entry>   <ulink url="http://www.slideshare.net/kidehen">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/www.slideshare.net/kidehen/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.slideshare.net/kidehen">Data Explorer View</ulink> </entry><entry>Check seeAlso links: http://identi.ca/user/14092, http://myopenlink.net/dataspace/person/kidehen@openlinksw.com#this, http://semantictweet.com/kidehen#me, http://foaf.qdos.com/flickr/people/80409833@N00#me, http://myopenlink.net:8890/dataspace/person/kidehen#this           </entry></row>
+<row><entry>Freebase NYTC</entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/rdf.freebase.com/ns/en.john_kerry">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/html/http://www.freebase.com/view/en/john_kerry">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/html/http://www.freebase.com/view/en/john_kerry">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Freebase NYTCF</entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/rdf.freebase.com/ns/en.john_kerry">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/html/http://www.freebase.com/view/en/john_kerry">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/html/http://www.freebase.com/view/en/john_kerry">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>FriendFeed</entry><entry>   <ulink url="http://friendfeed.com/informationweek/0f212311/web-link-shrinkage-powers-spam-surge">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.informationweek.com/news/security/vulnerabilities/showArticle.jhtml?articleID=218401098">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.informationweek.com/news/security/vulnerabilities/showArticle.jhtml?articleID=218401098">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Geonames Meta</entry><entry>   <ulink url="http://sws.geonames.org/6630397/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.lastfm.ru/music/Phoenix">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.lastfm.ru/music/Phoenix">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Geopoints</entry><entry>   <ulink url="http://www.geopoint.nl/en/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.mit.edu/~6.170/api/ps2/GeoPoint.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.mit.edu/~6.170/api/ps2/GeoPoint.html">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Get Glue Meta</entry><entry>   <ulink url="http://getglue.com">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://blog.adaptiveblue.com/?p=4746">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://blog.adaptiveblue.com/?p=4746">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Get Glue</entry><entry>   <ulink url="http://getglue.com/smartlinks">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.readwriteweb.com/archives/get_glue_on_your_iphone.php">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.readwriteweb.com/archives/get_glue_on_your_iphone.php">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Google Book</entry><entry>   <ulink url="http://www.google.com/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.google.com/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.google.com/">Data Explorer View</ulink> </entry><entry> Please check seeAlso links like http://books.google.com/* </entry></row>
+<row><entry>Google Buzz </entry><entry>   <ulink url="http://google.com/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/google.com/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://google.com/">Data Explorer View</ulink> </entry><entry>there should added seeAlso Buzz links based on Buzz search by title</entry></row>
+<row><entry>Google Search</entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/id/entity/http/www.google.com/finance?q=NYSE:MON%01Recognition1">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.google.com/finance?q=NYSE:MON">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.google.com/finance?q=NYSE:MON">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Google Social Graph</entry><entry>   <ulink url="http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com/about.rdf">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/www.openlinksw.com/blog/~kidehen/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/www.openlinksw.com/blog/~kidehen/">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Guardian</entry><entry>   <ulink url="http://www.guardian.co.uk/politics/2010/mar/15/gordon-brown-continue-as-labour-leader">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.alexa.com/siteinfo/guardian.co.uk">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.alexa.com/siteinfo/guardian.co.uk">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Hoovers</entry><entry>   <ulink url="http://www.hoovers.com/openlink/--ID__104304--/free-co-factsheet.xhtml">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.hoovers.com/company/OpenLink_Software_Inc/rfcyfci-1.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.hoovers.com/company/OpenLink_Software_Inc/rfcyfci-1.html">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Jigsaw (company)</entry><entry>   <ulink url="http://google.com/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/google.com/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://google.com/">Data Explorer View</ulink> </entry><entry>check the c:location proxy:entity/http/www.google.com/#address</entry></row>
+<row><entry>Jigsaw (person)</entry><entry>   <ulink url="http://www.crunchbase.com/person/todd-sharp">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/www.crunchbase.com/person/todd-sharp">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.crunchbase.com/person/todd-sharp">Data Explorer View</ulink> </entry><entry>check several Jigsaw search seeAlso links: http://www.jigsaw.com/scid5307274/todd_sharp.xhtml and etc.</entry></row>
+<row><entry>Journalisted</entry><entry>   <ulink url="http://journalisted.com/walter-gammie">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/whois.domaintools.com/journalisted.com">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://whois.domaintools.com/journalisted.com">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Last.FM</entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/id/entity/http/www.last.fm/music/Rod+Stewart/Greatest+Hits">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/id/entity/http/www.last.fm/music/Rod+Stewart/Greatest+Hits">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.last.fm/music/Rod+Stewart/Greatest+Hits">Data Explorer View</ulink> </entry><entry> There should be a set of last.fm seeAlso links</entry></row>
+<row><entry>Local Search</entry><entry>example</entry><entry>HTML Representation</entry><entry>Data Explorer View</entry><entry> </entry></row>
+<row><entry>LOD</entry><entry>   <ulink url="http://lod.openlinksw.com/b3s/search.vsp?q=1">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/lod.openlinksw.com/b3s/search.vsp?q=1">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://lod.openlinksw.com/b3s/search.vsp?q=1">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>MIME Type</entry><entry>example</entry><entry>HTML Representation</entry><entry>Data Explorer View</entry><entry> </entry></row>
+<row><entry>New York Times</entry><entry>   <ulink url="http://www.nytimes.com/2005/03/17/technology/circuits/17stat.html?ex=1268715600&amp;en=6840507aca561cf8&amp;ei=5090&amp;partner=rssuserland">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/download.cnet.com/New-York-Times-Crosswords-Monthly-Subscription/3000-2111_4-10918973.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://download.cnet.com/New-York-Times-Crosswords-Monthly-Subscription/3000-2111_4-10918973.html">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>NPR</entry><entry>   <ulink url="http://www.crunchbase.com/company/google">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.crunchbase.com/company/google">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.crunchbase.com/company/google">Data Explorer View</ulink> </entry><entry> There should be a set of npr stations rdfs:seeAlso links like: http://www.npr.org/templates/rss/podcast.php?id=510236; http://www.npr.org/templates/rss/podcast.php?id=510235; http://www.npr.org/templates/rss/podcast.php?id=510213 and etc. </entry></row>
+<row><entry>NYT: The Article Search</entry><entry>   <ulink url="http://twitter.com/bbcnews">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/twitter.com/bbcnews">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://twitter.com/bbcnews">Data Explorer View</ulink> </entry><entry> check the rdfs:seeAlso: proxy:entity/http/twitter.com/bbcnews#nytimes_1 and etc. </entry></row>
+<row><entry>NYT: The TimesTags</entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/rdf.freebase.com/ns/en.john_kerry">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/html/http://www.freebase.com/view/en/john_kerry">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/html/http://www.freebase.com/view/en/john_kerry">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>OpenCalais</entry><entry>   <ulink url="http://d.opencalais.com/er/company/ralg-tr1r/7cf71bb9-2969-35d3-8fa1-3723bdb5958c">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/news.cnet.com/8301-13505_3-9805771-16.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://news.cnet.com/8301-13505_3-9805771-16.html">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Oreilly Search for products</entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/oreilly.com/catalog/9780596007973">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/oreilly.com/catalog/9780596007973/?@Lookup@=17&refresh=0">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/id/entity/http/oreilly.com/catalog/9780596007973/?@Lookup@=17&refresh=0">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Primal</entry><entry>   <ulink url="http://www.google.com">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.google.com">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.google.com">Data Explorer View</ulink> </entry><entry>check the set of sioc:topic and scot:hasScot</entry></row>
+<row><entry>RapLeaf</entry><entry>   <ulink url="http://www.facebook.com/people/Roman-Korolenko/1465877213">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.crunchbase.com/service-provider/ivan-pr">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.crunchbase.com/service-provider/ivan-pr">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>SameAs.org</entry><entry>   <ulink url="http://sameas.org/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.ckan.net/package/sameas">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.ckan.net/package/sameas">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Sindice</entry><entry>   <ulink url="http://sindice.com/developers/inspector?doReasoning=true&amp;q=tim+berners+lee&amp;qt=term&amp;url=http%3A%2F%2Fwww.nylon.gr%2Ftag%2Ftim-berners-lee%2F">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.killerstartups.com/Web20/sindice-com-the-semantic-web-index">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.killerstartups.com/Web20/sindice-com-the-semantic-web-index">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Technorati</entry><entry>   <ulink url="http://support.technorati.com/support/siteguide/tags">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/download.cnet.com/Technorati-Tag/3000-12565_4-10658084.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://download.cnet.com/Technorati-Tag/3000-12565_4-10658084.html">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Tesco</entry><entry>   <ulink url="http://www.tesco.com/groceries/Product/Details/?id=252330678">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.tesco.com/groceries/Product/Details/?id=252330678">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.tesco.com/groceries/Product/Details/?id=252330678">Data Explorer View</ulink> </entry><entry> There should be a set of tesco rdfs:seeAlso links like: tesco:groceries/Product/Details/?id=252990345 </entry></row>
+<row><entry>Topsy.com</entry><entry>   <ulink url="http://google.com/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/google.com/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://google.com/">Data Explorer View</ulink> </entry><entry>check the rdfs:seeAlso: http://www1.folha.uol.com.br/folha/informatica/ult124u675304.shtml and etc. from topsy.com</entry></row>
+<row><entry>TrueKnowledge</entry><entry>   <ulink url="http://www.microsoft.com">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.microsoft.com">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.microsoft.com">Data Explorer View</ulink> </entry><entry> There should be a set of trueknowledge rdfs:seeAlso links like: http://www.microsoft.com/; http://www.microsoft.com/worldwide; http://en.wikipedia.org/wiki/Microsoft. Question is "What's Microsoft Corporation?" </entry></row>
+<row><entry>Tweetme</entry><entry>   <ulink url="http://google.com/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/google.com/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://google.com/">Data Explorer View</ulink> </entry><entry>check the rdfs:seeAlso: http://tweetmeme.com/story/12017895</entry></row>
+<row><entry>Twitter</entry><entry>   <ulink url="http://twitter.com/Techmeme/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.techmeme.com/081001/p43">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.techmeme.com/081001/p43">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>uClassify</entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/id/entity/http/www.openlinksw.com/blog/~kidehen/%01Russian">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/html/http://www.openlinksw.com/blog/~kidehen/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/html/http://www.openlinksw.com/blog/~kidehen/">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Uclassify</entry><entry>   <ulink url="http://www.crunchbase.com/company/google">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.crunchbase.com/company/google">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.crunchbase.com/company/google">Data Explorer View</ulink> </entry><entry> There should be a set of uclass values for diff langs uc:class: proxy:entity/http/www.crunchbase.com/company/google#Arabic;  proxy:entity/http/www.crunchbase.com/company/google#Bulgarian and etc. </entry></row>
+<row><entry>UMBEL</entry><entry>   <ulink url="http://fgiasson.com/blog/index.php/2008/08/29/umbel-as-a-coherent-framework-to-support-ontology-development/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/umbel.zitgist.com/api_philosophy.php">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http/umbel.zitgist.com/api_philosophy.php">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Ustream</entry><entry>   <ulink url="http://www.ustream.tv/recorded/4848859/highlight/55618">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.ustream.tv/recorded/4848859/highlight/55618">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.ustream.tv/recorded/4848859/highlight/55618">Data Explorer View</ulink> </entry><entry> There are several rdfs:seeAlso links like: http://www.ustream.tv/recorded/7039249/highlight/75027 </entry></row>
+<row><entry>Virtuoso Facets Web Service</entry><entry>example</entry><entry>HTML Representation</entry><entry>Data Explorer View</entry><entry> </entry></row>
+<row><entry>voID Statistics</entry><entry>example</entry><entry>HTML Representation</entry><entry>Data Explorer View</entry><entry> </entry></row>
+<row><entry>whoisi?</entry><entry>   <ulink url="http://whoisi.com/api/getPersonForURL?app=example&url=http://boatcovers.bestdealsoffer.com/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>World Bank</entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/web.worldbank.org/WBSITE/EXTERNAL/TOPICS/EXTEDUCATION/0,,contentMDK:20263110~menuPK:531742~pagePK:210058~piPK:210062~theSitePK:282386,00.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.lib.berkeley.edu/doemoff/govinfo/intl/gov_ibrd.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.lib.berkeley.edu/doemoff/govinfo/intl/gov_ibrd.html">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>WorldCat Basic</entry><entry>   <ulink url="http://www.crunchbase.com/company/yahoo">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.crunchbase.com/company/yahoo">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.crunchbase.com/company/yahoo">Data Explorer View</ulink> </entry><entry>check seeAlso links: http://worldcat.org/oclc/613205142 and etc. </entry></row>
+<row><entry>xISBN</entry><entry>   <ulink url="http://isbndb.com/d/book/a_concise_history_of_italy_a02.html">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://isbndb.com/d/book/a_concise_history_of_italy_a02.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://isbndb.com/d/book/a_concise_history_of_italy_a02.html">Data Explorer View</ulink> </entry><entry>check the set of owl:sameAs links: http://purl.org/NET/book/isbn/0670236489#book;  http://purl.org/NET/book/isbn/0500450102#book </entry></row>
+<row><entry>XRD</entry><entry>   <ulink url="http://s2.googleusercontent.com/webfinger/?q=john@gmail.com">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/hueniverse.com/xrd/">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://hueniverse.com/xrd/">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Yahoo BOSS</entry><entry>   <ulink url="http://boss.yahooapis.com/ysearch/web/v1/UNITED+STATES?appid=cxgCRk3V34ElK7Amd8ieyy9eELzD7QrpAHTzOv6MeEBz56JUUgGi1x2vf_.pE.c-&format=xml&view=searchmonkey_rdf">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/twitter.com/kidehen?@Lookup@=10&refresh=0">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://linkeddata.uriburner.com/about/html/http://linkeddata.uriburner.com/about/id/entity/http/twitter.com/kidehen?@Lookup@=10&refresh=0">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Yahoo Geocode</entry><entry>   <ulink url="http://local.yahooapis.com">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http://www.programmableweb.com/api/yahoo-local-search">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.programmableweb.com/api/yahoo-local-search">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Yelp Search for business</entry><entry>   <ulink url="http://www.smallbusinesssem.com/inc-magazine-goes-deep-on-yelp/2669/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.readwriteweb.com/archives/yelp_assembles_small_business_advisory_board.php">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://www.readwriteweb.com/archives/yelp_assembles_small_business_advisory_board.php">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Zemanta</entry><entry>   <ulink url="http://developer.zemanta.com/wiki/helloworld/ruby">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/kobesearch.cpan.org/htdocs/Net-Zemanta/Net/Zemanta/Suggest.pm.html">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http://kobesearch.cpan.org/htdocs/Net-Zemanta/Net/Zemanta/Suggest.pm.html">Data Explorer View</ulink> </entry><entry> </entry></row>
+<row><entry>Zillow</entry><entry>   <ulink url="http://www.zillow.com/homedetails/26-George-Rd-Maynard-MA-01754/57086765_zpid/">example</ulink> </entry><entry>   <ulink url="http://linkeddata.uriburner.com/about/html/http/www.crunchbase.com/company/zillow">HTML Representation</ulink> </entry><entry> <ulink url="http://linkeddata.uriburner.com/ode/?uri=http/www.crunchbase.com/company/zillow">Data Explorer View</ulink> </entry><entry> </entry></row>
+</tbody>
+</tgroup>
+</table>
+    <sect4 id="virtuosospongercartridgetypesmetarest"><title>Meta Cartridge Usage via REST Request</title>
+<para>Description.vsp underlies the /about/html/ page, and accepts the parameters described below.</para> 
+<table>
+<tgroup cols="4">
+<thead>
+  <row>
+    <entry>Parameter</entry><entry>Value</entry><entry>Description</entry><entry>Example</entry>
+  </row>
+</thead>
+<tbody>
+<row>
+  <entry><emphasis>@Lookup@</emphasis></entry>
+  <entry> </entry>
+  <entry>The type of lookup</entry>
+  <entry> </entry>
+</row>
+<row>
+  <entry></entry>
+  <entry>No Value</entry>
+  <entry>When value is not given (i.e., <emphasis>@Lookup@=</emphasis>), all will work as if the parameter were not present. %BR% The "Lookup" name is chosen to distinguish between parameters belonging to the URL being processed, and parameters for the Sponger.</entry>
+  <entry><ulink url="http://linkeddata.uriburner.com/about/html/http://www.apple.com/?@Lookup@=&refresh=0">Refresh the graph with all current cartridges, either type</ulink></entry>
+</row>  
+<row>
+  <entry></entry>
+  <entry><emphasis>0</emphasis></entry>
+  <entry>NLP meta only</entry>
+  <entry><ulink url="http://linkeddata.uriburner.com/about/html/http://www.apple.com/?@Lookup@=0&refresh=0">Execute only NLP meta extraction</ulink></entry>
+</row>  
+<row>
+  <entry></entry>
+  <entry><emphasis>-2</emphasis></entry>
+  <entry>Keywords-based only</entry>
+  <entry><ulink url="http://linkeddata.uriburner.com/about/html/http://www.apple.com/?@Lookup@=-2&refresh=0">Execute only keywords-based meta extraction</ulink></entry>
+</row>  
+<row>
+  <entry></entry>
+  <entry><emphasis>x,y...</emphasis></entry>
+  <entry>A list of meta cartridges to be executed, by their unique IDs. The ID column can be found in <emphasis>Conductor -&gt; RDF -&gt; Sponger -&gt; Meta Cartridges</emphasis></entry>
+  <entry><ulink url="http://linkeddata.uriburner.com/about/html/http://www.apple.com/?@Lookup@=19,22&refresh=0">Execute only CNET (ID=19) and NYT: The TimesTags (ID=22) meta cartridges</ulink></entry>
+</row>  
+<row>
+  <entry><emphasis>refresh</emphasis></entry>
+  <entry></entry>
+  <entry>An explicit refresh interval in seconds. A refresh of zero ("0") seconds will make a new graph on the next lookup, with the new '@Lookup@' parameter value.</entry>
+  <entry><ulink url="http://linkeddata.uriburner.com/about/html/http://www.apple.com/?@Lookup@=&refresh=0">Refresh the graph with all current cartridges</ulink></entry>
+</row>  
+<row>
+  <entry><emphasis>@Lookup@=&refresh=clean</emphasis></entry>
+  <entry></entry>
+  <entry>The keyword 'clean' will cause sponger to drop cache even it is marked to be in the fly. This must be used with caution as other thread may be doing sponge at same time.</entry>
+  <entry></entry>
+</row>  
+</tbody>
+</tgroup>
+</table>
+    </sect4>  
+    <sect4 id="virtuosospongercartridgetypesmetarestexamples"><title>Meta Cartridges Parametrized Examples</title>
+<para>All examples in the table below start from the same Resource, 
+	http://www.news.com, and submit it to the Sponger for processing with the single listed Meta Cartridge.</para>
 
-  offs := xpath_eval ('//query/view/@offset', tree);
-  lim := xpath_eval ('//query/view/@limit', tree);
+<para>It can be informative to start by seeing what the results would be 
+	<ulink url="http://linkeddata.uriburner.com/about/html/http/www.news.com/?@Lookup@=99999&refresh=0">with no Meta Cartridges at all</ulink>.</para>  
 
-  -- db_activity ();
+<para>If you have a lot of time to spare, you may want to see what the results would be 
+	<ulink url="http://linkeddata.uriburner.com/about/html/http/www.news.com/?@Lookup@=&refresh=0">with all Meta Cartridges combined</ulink>. 
+	As may be obvious, this must wait for each of the above services to respond, so it may take quite 
+	some time to return.</para>
 
-  results := vector (null, null, null);
-  more := vector ();
+<table>
+<tgroup cols="3">
+<thead>
+  <row>
+    <entry>Cartridge</entry><entry>URL Pattern</entry><entry>Example</entry>
+  </row>
+</thead>
+<tbody>
+<row><entry>Alchemy</entry><entry>@Lookup@=8&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL1">cURL example</ulink></entry></row> 
+<row><entry>Amazon Search for products</entry><entry>@Lookup@=13&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL2">cURL example</ulink></entry></row> 
+<row><entry>BBC</entry><entry>@Lookup@=1665&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL3">cURL example</ulink></entry></row> 
+<row><entry>BestBuy Search for products</entry><entry>@Lookup@=14&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL4">cURL example</ulink></entry></row> 
+<row><entry>Bing</entry><entry>@Lookup@=11&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL5">cURL example</ulink></entry></row> 
+<row><entry>Bit.ly</entry><entry>@Lookup@=915&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL6">cURL example</ulink></entry></row> 
+<row><entry>CNET</entry><entry>@Lookup@=19&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL7">cURL example</ulink></entry></row> 
+<row><entry>Crunchbase</entry><entry>@Lookup@=839&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL8">cURL example</ulink></entry></row> 
+<row><entry>Dapper</entry><entry>@Lookup@=243&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL9">cURL example</ulink></entry></row> 
+<row><entry>DBpedia</entry><entry>@Lookup@=26&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL10">cURL example</ulink></entry></row> 
+<row><entry>Delicious Meta</entry><entry>@Lookup@=23&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL11">cURL example</ulink></entry></row> 
+<row><entry>Discogs</entry><entry>@Lookup@=840&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL12">cURL example</ulink></entry></row> 
+<row><entry>Document Links</entry><entry>@Lookup@=34&refresh=0</entry><entry>   <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL13">cURL example</ulink></entry></row> 
+<row><entry>eBay</entry><entry>@Lookup@=18&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL14">cURL example</ulink></entry></row>  
+<row><entry>Evri Meta</entry><entry>@Lookup@=3966&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL15">cURL example</ulink></entry></row>  
+<row><entry>Flickr Search for photos</entry><entry>@Lookup@=16&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL16">cURL example</ulink></entry></row>  
+<row><entry>Freebase NYTC</entry><entry>@Lookup@=5&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL17">cURL example</ulink></entry></row>  
+<row><entry>Freebase NYTCF</entry><entry>@Lookup@=4&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL18">cURL example</ulink></entry></row>  
+<row><entry>Geonames Meta</entry><entry>@Lookup@=24&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL19">cURL example</ulink></entry></row>  
+<row><entry>Geopoints</entry><entry>@Lookup@=3731&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL20">cURL example</ulink></entry></row>  
+<row><entry>Get Glue Meta</entry><entry>@Lookup@=25&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL21">cURL example</ulink></entry></row>  
+<row><entry>Google Search</entry><entry>@Lookup@=1382&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL22">cURL example</ulink></entry></row>  
+<row><entry>Google Social Graph</entry><entry>@Lookup@=30&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL23">cURL example</ulink></entry></row>  
+<row><entry>Guardian</entry><entry>@Lookup@=28&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL24">cURL example</ulink></entry></row>  
+<row><entry>Hoovers</entry><entry>@Lookup@=2&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL25">cURL example</ulink></entry></row>  
+<row><entry>Journalisted</entry><entry>@Lookup@=3174&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL26">cURL example</ulink></entry></row>  
+<row><entry>Local Search</entry><entry>@Lookup@=15&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL27">cURL example</ulink></entry></row>  
+<row><entry>LOD</entry><entry>@Lookup@=21&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL28">cURL example</ulink></entry></row>  
+<row><entry>MIME Type</entry><entry>@Lookup@=1029&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL29">cURL example</ulink></entry></row>  
+<row><entry>New York Times</entry><entry>@Lookup@=22&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL30">cURL example</ulink></entry></row>  
+<row><entry>NPR Meta</entry><entry>@Lookup@=29&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL31">cURL example</ulink></entry></row>  
+<row><entry>NYT: The Article Search</entry><entry>@Lookup@=9&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL32">cURL example</ulink></entry></row>  
+<row><entry>NYT: The TimesTags</entry><entry>@Lookup@=22&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL33">cURL example</ulink></entry></row>  
+<row><entry>OpenCalais</entry><entry>@Lookup@=1&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL34">cURL example</ulink></entry></row>  
+<row><entry>Oreilly Search for products</entry><entry>@Lookup@=17&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL35">cURL example</ulink></entry></row>  
+<row><entry>RapLeaf</entry><entry>@Lookup@=2745&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL36">cURL example</ulink></entry></row>  
+<row><entry>SameAs.org</entry><entry>@Lookup@=3257&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL37">cURL example</ulink></entry></row>  
+<row><entry>Sindice</entry><entry>@Lookup@=12&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL38">cURL example</ulink></entry></row>  
+<row><entry>Technorati</entry><entry>@Lookup@=27&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL39">cURL example</ulink></entry></row>  
+<row><entry>Tesco</entry><entry>@Lookup@=31&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL40">cURL example</ulink></entry></row>  
+<row><entry>TrueKnowledge</entry><entry>@Lookup@=3967&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL41">cURL example</ulink></entry></row>  
+<row><entry>Twitter</entry><entry>@Lookup@=4020&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL42">cURL example</ulink></entry></row>  
+<row><entry>uClassify</entry><entry>@Lookup@=3086&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL43">cURL example</ulink></entry></row>  
+<row><entry>UMBEL</entry><entry>@Lookup@=6&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL44">cURL example</ulink></entry></row>  
+<row><entry>Ustream</entry><entry>@Lookup@=3902&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL45">cURL example</ulink></entry></row>  
+<row><entry>Virtuoso Facets Web Service</entry><entry>@Lookup@=21&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL46">cURL example</ulink></entry></row>  
+<row><entry>voID Statistics</entry><entry>@Lookup@=35&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL47">cURL example</ulink></entry></row>  
+<row><entry>whoisi?</entry><entry>@Lookup@=3052&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL48">cURL example</ulink></entry></row>  
+<row><entry>World Bank</entry><entry>@Lookup@=3&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL49">cURL example</ulink></entry></row>  
+<row><entry>XRD</entry><entry>@Lookup@=3650&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL50">cURL example</ulink></entry></row>  
+<row><entry>Yahoo BOSS</entry><entry>@Lookup@=10&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL51">cURL example</ulink></entry></row>  
+<row><entry>Yahoo Geocode</entry><entry>@Lookup@=2855&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL52">cURL example</ulink></entry></row>  
+<row><entry>Yelp Search for business</entry><entry>@Lookup@=20&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL53">cURL example</ulink></entry></row>  
+<row><entry>Zemanta</entry><entry>@Lookup@=7&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL54">cURL example</ulink></entry></row>  
+<row><entry>Zillow</entry><entry>@Lookup@=32&refresh=0</entry><entry><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSpongerCartridgeSupportedDataSourcesMetaRESTExamplescURL55">cURL example</ulink></entry></row>  
+</tbody>
+</tgroup>
+</table>
+</sect4>
+</sect3>
+ </sect2>
+<sect2 id="rdfspongerprogrammerguide"><title>Sponger Programmers Guide</title>
+  <para>The Sponger forms part of the extensible RDF framework built into Virtuoso Universal Server. A
+key component of the Sponger's pluggable architecture is its support for Sponger Cartridges, which
+themselves are comprised of an Entity Extractor and an Ontology Mapper. Virtuoso bundles numerous
+pre-written cartridges for RDF data extraction from a wide range of data sources. However, developers
+are free to develop their own custom cartridges. This programmer's guide describes how.</para>
+  <para>The guide is a companion to the <ulink url="http://virtuoso.openlinksw.com/Whitepapers/pdf/sponger_whitepaper_10102007.pdf">Virtuoso Sponger</ulink> whitepaper. The latter describes the Sponger in depth, its architecture, configuration, use and integration with other Virtuoso facilities such as the Open Data Services (ODS) application framework. This guide focuses solely on custom cartridge development.</para>
+      <sect3 id="virtuosospongeroverviewxmlset">
+      <title>Configuration of CURIEs used by the sponger</title>
+      <para>For configuring CURIEs used by the Sponger which is exposed via sponger
+clients such as "description.vsp" - the VSP based information resource description utility,
+you can use the <link linkend="fn_xml_set_ns_decl"><function>xml_set_ns_decl</function></link> function.</para>
+      <para>Here is sample example to add curie pattern:</para>
+<programlisting><![CDATA[
+-- Example link: http://linkeddata.uriburner.com/about/rdf/http://twitter.com/guykawasaki/status/1144945513#this
+XML_SET_NS_DECL ('uriburner',
+                 'http://linkeddata.uriburner.com/about/rdf/http://',
+                 2);
+]]></programlisting>
+    </sect3>
+    <sect3 id="virtuosospongeroverviewcartarch">
+      <title>Cartridge Architecture</title>
+      <para>The Sponger is comprised of cartridges which are themselves comprised of an entity extractor
+and an ontology mapper. Entities extracted from non-RDF resources are used as the basis for generating
+structured data by mapping them to a suitable ontology. A cartridge is invoked through its cartridge hook,
+a Virtuoso/PL procedure entry point and binding to the cartridge's entity extractor and ontology mapper.</para>
+      <para><emphasis>Entity Extractor</emphasis></para>
+      <para>When an RDF aware client requests data from a network accessible resource via the Sponger the
+following events occur:</para>
+      <itemizedlist mark="bullet">
+        <listitem>A request is made for data in RDF form (explicitly via HTTP Accept Headers), and if
+RDF is returned nothing further happens. </listitem>
+        <listitem>If RDF isn't returned, the Sponger passes the data through a <emphasis>Entity Extraction Pipeline</emphasis>
+(using Entity Extractors). </listitem>
+        <listitem>The extracted data is transformed into RDF via a <emphasis>Mapping Pipeline</emphasis>. RDF instance data is generated by way of ontology matching and mapping. </listitem>
+        <listitem>RDF instance data (aka. RDF Structured Linked Data) are returned to the client.</listitem>
+      </itemizedlist>
+      <para><emphasis>Extraction Pipeline</emphasis></para>
+      <para>Depending on the file or format type detected at ingest, the Sponger applies the appropriate
+entity extractor. Detection occurs at the time of content negotiation instigated by the retrieval user
+agent. The normal extraction pipeline processing is as follows:</para>
+      <itemizedlist mark="bullet">
+        <listitem>The Sponger tries to get RDF data (including N3 or Turtle) directly from the dereferenced
+URL. If it finds some, it returns it, otherwise, it continues.</listitem>
+        <listitem>If the URL refers to a HTML file, the Sponger tries to find "link" elements referring to
+RDF documents. If it finds one or more of them, it adds their triples into a temporary RDF graph and
+continues its processing.</listitem>
+        <listitem>The Sponger then scans for microformats or GRDDL. If either is found, RDF triples are
+generated and added to a temporary RDF graph before continuing.</listitem>
+        <listitem>If the Sponger finds eRDF or RDFa data in the HTML file, it extracts it from the HTML
+file and inserts it into the RDF graph before continuing.</listitem>
+        <listitem>If the Sponger finds it is talking with a web service such as Google Base, it maps
+the API of the web service with an ontology, creates triples from that mapping and includes the triples
+into the temporary RDF graph.</listitem>
+        <listitem>The next fallback is scanning of the HTML header for different Web 2.0 types or RSS
+1.1, RSS 2.0, Atom, etc. </listitem>
+        <listitem>Failing those tests, the scan then uses standard Web 1.0 rules to search in the
+header tags for metadata (typically Dublin Core) and transform them to RDF and again add them to the
+temporary graph. Other HTTP response header data may also be transformed to RDF.</listitem>
+        <listitem>If nothing has been retrieved at this point, the ODS-Briefcase metadata
+extractor is tried.</listitem>
+        <listitem>Finally, if nothing is found, the Sponger will return an empty graph.</listitem>
+</itemizedlist>
+      <para><emphasis>Ontology Mapper</emphasis></para>
+      <para>Sponger ontology mappers peform the the task of generating RDF instance data from
+extracted entities (non-RDF) using ontologies associated with a given data source type. They are
+typically XSLT (using GRDDL or an in-built Virtuoso mapping scheme) or Virtuoso/PL based. Virtuoso
+comes preconfigured with a large range of ontology mappers contained in one or more Sponger
+cartridges.</para>
+      <para><emphasis>Cartridge Registry</emphasis></para>
+      <para>To be recognized by the SPARQL engine, a Sponger cartridge must be registered in
+the Cartridge Registry by adding a record to the table DB.DBA.SYS_RDF_MAPPERS, either manually
+via DML, or more easily through Conductor, Virtuoso's browser-based administration console,
+which provides a UI for adding your own cartridges. (Sponger configuration using Conductor is
+described in detail later.) The SYS_RDF_MAPPERS table definition is as follows:</para>
+<programlisting><![CDATA[
+create table "DB"."DBA"."SYS_RDF_MAPPERS"
+(
+"RM_ID" INTEGER IDENTITY,  -- cartridge ID. Determines the order of the cartridge's invocation in the Sponger processing chain
+"RM_PATTERN" VARCHAR,  -- a REGEX pattern to match the resource URL or MIME type
+"RM_TYPE" VARCHAR,  -- which property of the current resource to match: "MIME" or "URL"
+"RM_HOOK" VARCHAR,  -- fully qualified Virtuoso/PL function name
+"RM_KEY" LONG VARCHAR,  -- API specific key to use
+"RM_DESCRIPTION" LONG VARCHAR,  -- cartridge description (free text)
+"RM_ENABLED" INTEGER,  -- a 0 or 1 integer flag to exclude or include the cartridge from the Sponger processing chain
+"RM_OPTIONS" ANY,  -- cartridge specific options
+"RM_PID" INTEGER IDENTITY,
+PRIMARY KEY ("RM_PATTERN", "RM_TYPE")
+);
+]]></programlisting>
+</sect3>
+    <sect3 id="virtuosospongeroverviewcartinvo">
+      <title>Cartridge Invocation</title>
+      <para>The Virtuoso SPARQL processor supports IRI dereferencing via the Sponger. If a SPARQL query
+references non-default graph URIs, the Sponger goes out (via HTTP) to sponge the data source URIs and
+inserts the extracted RDF data into the local RDF quad store. The Sponger invokes the appropriate
+cartridge for the data source type to produce RDF instance data. If none of the registered cartridges
+are capable of handling the received content type, the Sponger will attempt to obtain RDF instance
+data via the in-built WebDAV metadata extractor.</para>
+      <para>Sponger cartridges are invoked as follows:</para>
+      <para>When the SPARQL processor dereferences a URI, it plays the role of an HTTP user agent
+(client) that makes a content type specific request to an HTTP server via the HTTP request's Accept
+headers. The following then occurs:</para>
+      <itemizedlist mark="bullet">
+        <listitem>If the content type returned is RDF then no further transformation is needed and
+the process stops. For instance, when consuming an (X)HTML document with a GRDDL profile, the profile
+URI points to a data provider that simply returns RDF instance data.</listitem>
+        <listitem>If the content type is not RDF (i.e. application/rdf+xml or text/rdf+n3 ), for
+instance 'text/plain', the Sponger looks in the Cartridge Registry iterating over every record for
+which the RM_ENABLED flag is true, with the look-up sequence ordered on the RM_ID column values.
+For each record, the processor tries matching the content type or URL against the RM_PATTERN value
+and, if there is match, the function specified in RM_HOOK column is called. If the function doesn't
+exist, or signals an error, the SPARQL processor looks at next record.
+          <itemizedlist mark="bullet">
+            <listitem>If the hook returns zero, the next cartridge is tried. (A cartridge function
+can return zero if it believes a subsequent cartridge in the chain is capable of extracting more
+RDF data.)</listitem>
+            <listitem>If the result returned by the hook is negative, the Sponger is instructed
+that no RDF was generated and the process stops. </listitem>
+            <listitem>If the hook result is positive, the Sponger is informed that structured
+data was retrieved and the process stops.</listitem>
+          </itemizedlist>
+        </listitem>
+        <listitem>If none of the cartridges match the source data signature (content type or URL),
+the ODS-Briefcase WebDAV metadata extractor and RDF generator is called.</listitem>
+      </itemizedlist>
+      <para><emphasis>Meta-Cartridges</emphasis></para>
+      <para>The above describes the RDF generation process for 'primary' Sponger cartridges. Virtuoso
+also supports another cartridge type - a 'meta-cartridge'. Meta-cartridges act as post-processors in
+the cartridge pipeline, augmenting entity descriptions in an RDF graph with additional information
+gleaned from 'lookup' data sources and web services. Meta-cartridges are described in more detail in
+a later section.</para>
+      <figure id="spong1" float="1">
+        <title>Meta-Cartridges</title>
+        <graphic fileref="ui/spong1.png"/>
+      </figure>
+</sect3>
 
-  IF
-    (
-      xpath_eval
-        (
-          '//query[@view3="yes"]//view[@type="text"]',
-          tree
-        )
-      IS NOT NULL
-    )
-  {
-      more := VECTOR ('classes', 'properties');
+    <sect3 id="virtuosospongercatrbundled">
+      <title>Cartridges Bundled with Virtuoso</title>
+      <sect4 id="virtuosospongercatrbundledrdfvad">
+        <title>RDF Mappers VAD</title>
+        <para>Virtuoso supplies a number of prewritten cartridges for extracting RDF data from a
+variety of popular Web resources and file types. The cartridges are bundled as part of the rdf_mappers
+VAD (Virtuoso Application Distribution).</para>
+        <para>To see which cartridges are available, look at the 'RDF Cartridges' screen in
+Conductor. This can be reached through the 'RDF' > 'RDF Cartridges' tabbed menu items.</para>
+        <figure id="spong2" float="1">
+          <title>RDF Cartridges</title>
+          <graphic fileref="ui/spong2.png"/>
+        </figure>
+        <para>To check which version of the rdf_mappers VAD is installed, or to upgrade it,
+refer to Conductor's 'VAD Packages' screen, reachable through the 'System Admin' > 'Packages'
+menu items.</para>
+        <para>The latest VADs for the closed source releases of Virtuoso can be
+<ulink url="http://download.openlinksw.com/download/">downloaded</ulink> from the downloads area on the OpenLink website. Select either the 'DBMS (WebDAV) Hosted' or
+'File System Hosted' product format from the 'Distributed Collaborative Applications' section,
+depending on whether you want the Virtuoso application to use WebDAV or native filesystem storage.
+VADs for Virtuoso Open Source edition (VOS) are available for
+<ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VOSDownload">download</ulink> from
+the VOS Wiki.</para>
+</sect4>
+      <sect4 id="virtuosospongercatrbundledexample">
+        <title>Example Source Code</title>
+        <para>For developers wanting example cartridge code, the most authoritative reference is
+the rdf_mappers VAD source code itself. This is included as part of the VOS distribution. After
+downloading and unpacking the sources, the script used to create the cartridges, and the associated
+stylesheets can be found in:</para>
+        <itemizedlist mark="bullet">
+          <listitem><vos root>/binsrc/rdf_mappers/rdf_mappers.sql</listitem>
+          <listitem><vos root>/binsrc/rdf_mappers/xslt/*.xsl</listitem>
+        </itemizedlist>
+        <para>Alternatively, you can look at the actual cartridge implementations installed in your
+Virtuoso instance by inspecting the cartridge hook function used by a particular cartridge. This is
+easily identified from the 'Cartridge name' field of Conductor's 'RDF Cartridges' screen, after
+selecting the cartridge of interest. The hook function code can be viewed from the 'Schema Objects'
+screen under the 'Database' menu, by locating the function in the 'DB' > 'Procedures' folder.
+Stylesheets used by the cartridges are installed in the WebDAV folder DAV/VAD/rdf_mappers/xslt.
+This can be explored using Conductor's WebDAV interface. The actual rdf_mappers.sql file installed
+with your system can also be found in the DAV/VAD/rdf_mappers folder.</para>
+</sect4>
+    </sect3>
+    <sect3 id="virtuosospongercatrbundledcusgtomcart">
+      <title>Custom Cartridge</title>
+      <para>Virtuoso comes well supplied with a variety of Sponger cartridges and GRDDL filters.
+When then is it necessary to write your own cartridge?</para>
+      <para>In the main, writing a new cartridge should only be necessary to generate RDF from
+a REST-style Web service not supported by an existing cartridge, or to customize the output from
+an existing cartridge to your own requirements. Apart from these circumstances, the existing
+Sponger infrastructure should meet most of your needs. This is particularly the case for
+document resources.</para>
+     <sect4 id="virtuosospongerdocres">
+       <title>Document Resources</title>
+       <para>We use the term document resource to identify content which is not being returned
+from a Web service. Normally it can broadly be conceived as some form of document, be it a text
+based entity or some form of file, for instance an image file.</para>
+       <para>In these cases, the document either contains RDF, which can be extracted directly,
+or it holds metadata in a supported format which can be transformed to RDF using an existing
+filter.</para>
+       <para>The following cases should all be covered by the existing Sponger cartridges:</para>
+         <itemizedlist mark="bullet">
+           <listitem>embedded or linked RDF</listitem>
+           <listitem>RDFa, eRDF and other popular microformats extractable directly or via GRDDL</listitem>
+           <listitem>popular syndication formats (RSS 2.0 , Atom, OPML , OCS , XBEL)</listitem>
+         </itemizedlist>
+</sect4>
+     <sect4 id="virtuosospongergrddl">
+       <title>GRDDL</title>
+       <para>GRDDL (Gleaning Resource Descriptions from Dialects of Languages) is mechanism for deriving
+RDF data from XML documents and in particular XHTML pages. Document authors may associate transformation
+algorithms, typically expressed in XSLT, with their documents to transform embedded metadata into RDF.</para>
+       <para>The rdf_mappers VAD installs a number of GRDDL filters for transforming popular microformats
+(such as RDFa, eRDF or hCalendar) into RDF. The available filters can be viewed, or configured, in
+Conductor's 'GRDDL Filters for XHTML' screen. Navigate to the 'RDF Cartridges' screen using the
+'RDF' > 'RDF Cartridges' menu items, then SELECT the 'GRDDL Mappings' tab to display the 'GRDDL Filters
+for XHTML' screen. GRDDL filters are held in the WebDAV folder /DAV/VAD/rdf_cartridges/xslt/ alongside
+other XSLT templates. The Conductor interface allows you to add new GRDDL filters should you so wish.</para>
+       <para>For an introduction to GRDDL, try the <ulink url="http://www.w3.org/TR/grddl-primer/">GRDDL Primer</ulink>. To underline GRDDL's utility, the primer
+includes an example of transforming Excel spreadsheet data, saved as XML, into RDF.</para>
+       <para>A comprehensive <ulink url="http://esw.w3.org/topic/CustomRdfDialects">list of stylesheets</ulink>
+for transforming HTML and non-HTML XML dialects is maintained
+on the ESW Wiki. The list covers a range of microformats, syndication formats and feedlists.</para>
+     </sect4>
+     <para>To see which Web Services are already catered for, view the list of cartridges in Conductor's 'RDF Cartridges' screen.</para>
+    </sect3>
+    <sect3 id="virtuosospongercreatecustcartr">
+      <title>Creating Custom Cartridges</title>
+      <para>The Sponger is fully extensible by virtue of its pluggable cartridge architecture. New data formats can
+be sponged by creating new cartridges. While OpenLink is active in adding cartridges for new data sources,
+you are free to develop your own custom cartridges. Entity extractors can be built using Virtuoso PL,
+C/C++, Java or any other external language supported by Virtuoso's Server Extension API. Of course,
+Virtuoso's own entity extractors are written in Virtuoso PL.</para>
+      <sect4 id="virtuosospongercreatecustcartran">
+        <title>The Anatomy of a Cartridge</title>
+        <para><emphasis>Cartridge Hook Prototype</emphasis></para>
+        <para>Every Virtuoso PL hook function used to plug a custom Sponger cartridge into the Virtuoso
+SPARQL engine must have a parameter list with the following parameters (the names of the parameters are
+not important, but their order and presence are):</para>
+        <itemizedlist mark="bullet">
+          <listitem><emphasis>in graph_iri varchar</emphasis>: the IRI of the graph being retrieved/crawled</listitem>
+          <listitem><emphasis>in new_origin_uri varchar</emphasis>: the URL of the document being retrieved</listitem>
+          <listitem><emphasis>in dest varchar</emphasis>: the destination/target graph IRI</listitem>
+          <listitem><emphasis>inout content any</emphasis>: the content of the retrieved document</listitem>
+          <listitem><emphasis>inout async_queue any</emphasis>: if the PingService initialization parameter
+has been configured in the [SPARQL] section of the virtuoso.ini file, this is a pre-allocated asynchronous
+queue to be used to call the ping service</listitem>
+          <listitem><emphasis>inout ping_service any</emphasis>: the URL of a ping service, as assigned
+to the PingService parameter in the [SPARQL] section of the virtuoso.ini configuration file.
+PingTheSemanticWeb is an <link linkend="virtuosospongerefping">example</link> of a such a service.</listitem>
+          <listitem><emphasis>inout api_key any</emphasis>: a string value specific to a given cartridge,
+contained in the RC_KEY column of the DB.DBA.SYS_RDF_CARTRIDGES table. The value can be a single
+string or a serialized array of strings providing cartridge specific data.</listitem>
+          <listitem><emphasis>inout opts any</emphasis>: cartridge specific options held in a Virtuoso/PL
+vector which acts as an array of key-value pairs.</listitem>
+        </itemizedlist>
+        <para><emphasis>Return Value</emphasis></para>
+        <para>If the hook procedure returns zero the next cartridge will be tried. If the result is negative
+the sponging process stops, instructing the SPARQL engine that nothing was retrieved. If the result is
+positive the process stops, this time instructing the SPARQL engine
+that RDF data was successfully retrieved.</para>
+        <para>If your cartridge should need to test whether other cartridges are configured to handle a
+particular data source, the following extract taken from the RDF_LOAD_CALAIS hook procedure illustrates
+how you might do this:</para>
+<programlisting><![CDATA[
+if (xd is not null)
+       {
+  -- Sponging successful. Load sponged data in Virtuoso quad store
+  DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+  flag := 1;
   }
 
-  sqls := '00000';
-  qr := fct_query
-          (
-            xpath_eval ('//query', tree, 1)
-          )
-  ;
-  query := qr;
---  dbg_obj_print (qr);
-  qr2 := fct_xml_wrap (tree, qr);
-  start_time := msec_time ();
-
-  dbg_printf('query: %s', qr2);
-
-  EXEC
-    (
-      qr2,
-      sqls,
-      msg,
-      vector (),
-      0,
-      md,
-      res
-    )
-  ;
-  n_rows := row_count ();
-  act := db_activity ();
-  SET result_timeout = 0;
-  IF (
-       sqls <> '00000'
-       AND
-       sqls <> 'S1TAT'
-     )
-    SIGNAL (sqls, msg);
-  IF (
-       NOT ISARRAY (res)
-       OR
-       0 = length (res)
-       OR
-       NOT ISARRAY (res[0])
-       OR
-       0 = length (res[0])
-     )
-    results[0] := xtree_doc ('<result/>');
-  ELSE
-    results[0] := res[0][0];
-
-  inx := 1;
-
-  FOREACH (VARCHAR tp IN more) DO
+declare ord any;
+ord := (SELECT RM_ID FROM DB.DBA.SYS_RDF_MAPPERS WHERE
+	  RM_HOOK = 'DB.DBA.RDF_LOAD_CALAIS');
+for SELECT RM_PATTERN FROM DB.DBA.SYS_RDF_MAPPERS WHERE
+  RM_ID > ord and RM_TYPE = 'URL' and RM_ENABLED = 1 ORDER BY RM_ID do
   {
-      tree := XMLUpdate (
-                          tree,
-                          '/query/view/@type',
-                          tp,
-                          '/query/view/@limit',
-                          '40',
-                          '/query/view/@offset',
-                          '0'
-                        )
-      ;
-      qr := fct_query (xpath_eval ('//query', tree, 1));
-      qr2 := fct_xml_wrap (tree, qr);
-      sqls := '00000';
-      SET result_timeout = _min (
-                                  timeout,
-                                  ATOI
-                                    (
-                                      registry_get ('fct_timeout_max')
-                                    )
-                                )
-      ;
-      EXEC (
-             qr2,
-             sqls,
-             msg,
-             vector (),
-             0,
-             md,
-             res
-           );
-      n_rows := row_count ();
-      act := db_activity ();
-      SET result_timeout = 0;
-      IF ( sqls <> '00000'
-           AND
-           sqls <> 'S1TAT'
-         )
-    SIGNAL (sqls, msg);
-      IF (
-           ISARRAY (res)
-           AND
-           LENGTH (res)
-           AND
-           ISARRAY (res[0])
-           AND
-           LENGTH (res[0])
-         )
-    {
-      tmp := res[0][0];
-      tmp := XMLUpdate (tmp, '/result/@type', tp);
-      results[inx] := tmp;
+  if (regexp_match (RM_PATTERN, new_origin_uri) is not null)
+    -- try next candidate cartridge
+    flag := 0;
   }
-      inx := inx + 1;
-    }
-
-
-
-  res := XMLELEMENT
-           (
-             "facets",
-             XMLELEMENT
-               ( "sparql", query ),
-             XMLELEMENT
-               ( "time", msec_time () - start_time ),
-             XMLELEMENT
-               (
-                 "complete",
-                 CASE WHEN sqls = 'S1TAT'
-                      THEN 'no'
-                      ELSE 'yes'
-                  END
-                ),
-             XMLELEMENT
-               (
-                 "timeout",
-                 _min
-                   (
-                     timeout * 2,
-                     ATOI
-                       (
-                         registry_get
-                           ( 'fct_timeout_max' )
-                       )
-                   )
-               ),
-             XMLELEMENT
-               ("db-activity", act),
-             XMLELEMENT
-               ("processed", n_rows),
-             XMLELEMENT
-               (
-                 "view",
-                 XMLATTRIBUTES
-                   (
-                     offs AS "offset",
-                     lim AS "limit"
-                   )
-               ),
-             results[0],
-             results[1],
-             results[2]
-           );
-
----- for debugging:
---string_to_file ('ret.xml', serialize_to_UTF8_xml (res), -2);
---  dbg_obj_print (res);
-
-  RETURN res;
-}
-;
-]]></programlisting>
-   </sect6>
-   <sect6 id="virtuosospongerfacentuirestapiexmp">
-     <title>Example</title>
-<para>
-The following example shows how to use the fct_exec APi in vsp page to perform a "text" search for the
-word "Mike" assuming this exists in your Virtuoso RDF store (if not amend the query in the fct_example.vsp
-code sample below to search for text known to exist).
-</para>
-<orderedlist>
-  <listitem>The service can be used in the following sample fct_example.vsp:
-<programlisting><![CDATA[
-<?vsp
-
-declare txt, reply, tree any;
-declare timeout int;
-
-tree := xtree_doc ('
-  <query>
-    <text>Mike</text>
-    <view type="text"/>
-  </query>
-');
-
-timeout := 3000;
-reply := fct_exec (tree, timeout);
-
-txt := string_output ();
-
-http_value (xslt ('virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:/DAV/fct_example.xsl',
-                 reply,
-   	         vector ()),
-	         null, txt);
-
-http (txt);
-?>
+return flag;
 ]]></programlisting>
-</listitem>
-  <listitem>The xsl:
+        <para><emphasis>Specifying the Target Graph</emphasis></para>
+        <para>Two cartridge hook function parameters contain graph IRIs, graph_iri and dest. graph_iri
+identifies an input graph being crawled. dest holds the IRI specified in any input:grab-destination
+pragma defined to control the SPARQL processor's IRI dereferencing. The pragma overrides the default
+behaviour and forces all retrieved triples to be stored in a single graph, irrespective of their graph
+of origin.</para>
+        <para>So, under some circumstances depending on how the Sponger has been invoked and whether
+it is being used to crawl an existing RDF graph, or derive RDF data from a non-RDF data source,
+dest may be null.</para>
+        <para>Consequently, when loading sponged RDF data into the quad store, cartridges typically
+specify the graph to receive the data using the coalesce function which returns the first non-null
+parameter. e.g.</para>
 <programlisting><![CDATA[
-<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-  <xsl:output method="html" encoding="ISO-8859-1"/>
-  <xsl:variable name="rowcnt" select="count(/facets/result/row)"/>
-  <xsl:template match="facets">
-    <div id="res">
-      <xsl:if test="/facets/complete = 'yes' and /facets/processed = 0 and $rowcnt = 0">
-        <div class="empty_result">
-          Nothing found.
-        </div>
-	</xsl:if>
-      <xsl:for-each select="/facets/result">
-        <xsl:call-template name="render-result"/>
-      </xsl:for-each>
-    </div>
-    <!-- #res -->
-    </xsl:template>
-  <xsl:template name="render-result">
-    <table class="result" border="1">
-      <thead>
-        <tr>
-          <th>Entity</th>
-          <th>Title</th>
-          <th>Text excerpt</th>
-        </tr>
-      </thead>
-      <tbody>
-        <xsl:for-each select="row">
-          <tr>
-            <td class="rnk">
-              <xsl:for-each select="column[@datatype='trank' or @datatype='erank']">
-		<xsl:choose>
-                  <xsl:when test="./@datatype='trank'">Text Rank:</xsl:when>
-                  <xsl:when test="./@datatype='erank'">Entity Rank:</xsl:when>
-                </xsl:choose>
-                <xsl:value-of select="."/>
-                <br/>
-              </xsl:for-each>
-            </td>
-            <xsl:for-each select="column">
-              <xsl:choose>
-                <xsl:when test="'url' = ./@datatype">
-                  <td>
-                    <a>
-                      <xsl:attribute name="href">http://lod.openlinksw.com/describe/?url=<xsl:value-of select="urlify (.)"/></xsl:attribute>
-                      <xsl:attribute name="title"><xsl:value-of select="."/></xsl:attribute>
-                      <xsl:choose>
-                        <xsl:when test="'' != ./@shortform">
-                          <xsl:value-of select="./@shortform"/>
-		    </xsl:when>
-                        <xsl:when test="'erank' = ./@datatype or 'trank' = ./@datatype">rank</xsl:when>
-		    <xsl:otherwise>
-                          <xsl:value-of select="."/>
-		    </xsl:otherwise>
-		</xsl:choose>
-                    </a>
-                  </td>
-                </xsl:when>
-                <xsl:when test="'erank' = ./@datatype or 'trank' = ./@datatype"/>
-                <xsl:when test="'srch_xerpt' = ./span/@class">
-                  <td>
-                    <xsl:value-of select="."/>
-                  </td>
-                </xsl:when>
-                <xsl:otherwise/>
-              </xsl:choose>
-            </xsl:for-each>
-          </tr>
-        </xsl:for-each>
-      </tbody>
-    </table>
-  </xsl:template>
-  <xsl:template match="@* | node()">
-    <xsl:copy>
-      <xsl:apply-templates select="@* | node()"/>
-    </xsl:copy>
-    </xsl:template>
-</xsl:stylesheet>
+DB.DBA.RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
 ]]></programlisting>
-</listitem>
-  <listitem>The result of executing the fct_example.vsp should be:
-     <figure id="fcapiex1" float="1">
-       <title>Facet API Example</title>
-       <graphic fileref="ui/fcapiex1.png"/>
-     </figure>
-</listitem>
-</orderedlist>
-   </sect6>
-      </sect5>
-<sect5 id="virtuosospongerfacentuirest">
-  <title>SOAP interface</title>
-<para>The facet web service is also available via SOAP protocol.</para>
-<para>The request message contains single element 'query' with syntax explained earlier. Also the
-SOAPAction HTTP header should be '#query' . After successful evaluation of the query, the service
-will return a SOAP envelope containing in the Body element single 'facets' element described above.</para>
-<para>Example:</para>
-<para>This example shows execution of same command as in example for REST interface here it using SOAP:</para>
-<para>Request message:</para>
+        <para>Here xd is an RDF/XML string holding the sponged RDF.</para>
+        <para><emphasis>Specifying & Retrieving Cartridge Specific Options</emphasis></para>
+        <para>The hook function prototype allows cartridge specific data to be passed to a cartridge
+through the RM_OPTIONS parameter, a Virtuoso/PL vector which acts as a heterogeneous array.</para>
+        <para>In the following example, two options are passed, 'add-html-meta' and 'get-feeds'
+with both values set to 'no'.</para>
 <programlisting><![CDATA[
-<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
-  <SOAP:Body>
-    <query xmlns="http://openlinksw.com/services/facets/1.0/" inference="" same-as="">
-      <text>Seattle Mariners traveled all the way to Japan to watch</text>
-      <view type="text" limit="20" offset="0"/>
-    </query>
-  </SOAP:Body>
-</SOAP:Envelope>
+insert soft DB.DBA.SYS_RDF_MAPPERS (
+  RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION, RM_OPTIONS
+)
+values (
+  '(text/html)|(text/xml)|(application/xml)|(application/rdf.xml)',
+  'MIME', 'DB.DBA.RDF_LOAD_HTML_RESPONSE', null, 'xHTML',
+  vector ('add-html-meta', 'no', 'get-feeds', 'no')
+);
 ]]></programlisting>
-<para>Response message:</para>
+        <para>The RM_OPTIONS vector can be handled as an array of key-value pairs using the
+get_keyword function. get_keyword performs a case sensitive search for the given keyword at
+every even index of the given array. It returns the element following the keyword, i.e.
+the keyword value.</para>
+        <para>Using get_keyword, any options passed to the cartridge can be retrieved
+using an approach similar to that below:</para>
 <programlisting><![CDATA[
-<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
-  <SOAP:Body>
-    <fct:facets xmlns:fct="http://openlinksw.com/services/facets/1.0/">
-      <fct:sparql>SELECT distinct ?s1 as ?c1, (bif:search_excerpt (bif:vector ('THE', 'MARINERS', 'WAY', 'SEATTLE', 'WATCH', 'ALL', 'TO', 'JAPAN', 'TRAVELED'), ?o1)) as ?c2  where { ?s1 ?s1textp ?o1 . filter (bif:contains (?o1, '(THE AND MARINERS AND WAY AND SEATTLE AND WATCH AND ALL AND TO AND JAPAN AND TRAVELED)')) . } LIMIT 20  OFFSET 0</fct:sparql>
-      <fct:time>114</fct:time>
-      <fct:complete>yes</fct:complete>
-      <fct:db-activity>   134R rnd  9.488KR seq      0P disk  8.966MB /    602 messages</fct:db-activity>
-      <fct:result>
-        <fct:row>
-          <fct:column datatype="url" shortform="http://bobdupuy.mlbl...ld_baseball__6.html">http://bobdupuy.mlblogs.com/bobdupuy/2006/03/world_baseball__6.html</fct:column>
-          <fct:column/>
-          <fct:column><span class="srch_xerpt">... While Chuck Armstrong president of <b>the</b> <b>Seattle</b> <b>Mariners</b> <b>traveled</b> <b>all</b> <b>the</b> <b>way</b> <b>to</b> <b>Japan</b> <b>to</b> <b>watch</b> Ichiro... for <b>the</b> advancing <b>Japan</b> team last week <b>the</b> star from <b>the</b> <b>Seattle</b> roster so far in Round 1 has without a doubt... leading <b>the</b> Dominican <b>to</b> its...</span></fct:column>
-        </fct:row>
-        <fct:row>
-          <fct:column datatype="url" shortform="http://bobdupuy.mlbl...ld_baseball__6.html">http://bobdupuy.mlblogs.com/bobdupuy/2006/03/world_baseball__6.html</fct:column>
-          <fct:column/>
-          <fct:column><span class="srch_xerpt">Orlando While Chuck Armstrong president of <b>the</b> <b>Seattle</b> <b>Mariners</b> <b>traveled</b> <b>all</b> <b>the</b> <b>way</b> <b>to</b> <b>Japan</b> <b>to</b> <b>watch</b>... perform for <b>the</b> advancing <b>Japan</b> team last week <b>the</b> star from <b>the</b> <b>Seattle</b> roster so far in Round 1 has without...</span></fct:column>
-        </fct:row>
-      </fct:result>
-    </fct:facets>
-  </SOAP:Body>
-</SOAP:Envelope>
+create procedure DB.DBA.RDF_LOAD_HTML_RESPONSE (
+  in graph_iri varchar, in new_origin_uri varchar, in dest varchar,
+  inout ret_body any, inout aq any, inout ps any, inout _key any,
+  inout opts any )
+  {
+  declare get_feeds, add_html_meta;
+  ...
+  get_feeds := add_html_meta := 0;
+  if (isarray (opts) and 0 = mod (length(opts), 2))
+  {
+    if (get_keyword ('get-feeds', opts) = 'yes')
+      get_feeds := 1;
+    if (get_keyword ('add-html-meta', opts) = 'yes')
+      add_html_meta := 1;
+  }
+  ...
 ]]></programlisting>
-</sect5>
-</sect4>
-</sect3>
- </sect2>
- <sect2 id="rdfenterpriseandintegration">
-   <title>Enterprise Data Access & Integration</title>
-   <sect3 id="rdfviewsenterprbsm">
-      <title>BSBM to RDF</title>
-<programlisting><![CDATA[
-use DB;
-
-CREATE TABLE DB.DBA.ProductFeature (
-  nr integer primary key,
-  label varchar(100) not null,
-  comment varchar(1500) not null,
-  publisher integer not null,
-  publishDate date not null
-)
-;
-
-grant SELECT on DB.DBA.ProductFeature to public
-;
-
-CREATE TABLE DB.DBA.ProductType (
-  nr integer primary key,
-  label varchar(100) not null,
-  comment varchar(1500) not null,
-  parent integer,
-  publisher integer not null,
-  publishDate date not null
-)
-;
-
-grant SELECT on DB.DBA.ProductType to public
-;
-
-CREATE TABLE DB.DBA.Producer (
-  nr integer primary key,
-  label varchar(100) not null,
-  comment varchar(1500) not null,
-  homepage varchar(100) not null,
-  country char(2) not null,
-  publisher integer not null,
-  publishDate date not null
-)
-;
-
-grant SELECT on DB.DBA.Producer to public
-;
-create index producer_homepage on DB.DBA.Producer (homepage)
-;
-
-CREATE TABLE DB.DBA.Product (
-  nr integer primary key,
-  label varchar(100) not null,
-  comment varchar not null,
-  producer integer not null,
-  propertyNum1 integer,
-  propertyNum2 integer,
-  propertyNum3 integer,
-  propertyNum4 integer,
-  propertyNum5 integer,
-  propertyNum6 integer,
-  propertyTex1 varchar(200),
-  propertyTex2 varchar(200),
-  propertyTex3 varchar(200),
-  propertyTex4 varchar(200),
-  propertyTex5 varchar(200),
-  propertyTex6 varchar(200),
-  publisher integer not null,
-  publishDate date not null
-)
-;
-
-grant SELECT on DB.DBA.Product to public
-;
-
-create index product_lbl on DB.DBA.Product (label)
-;
-create unique index product_producer_nr on DB.DBA.Product (producer, nr)
-;
-create index product_pn1 on DB.DBA.Product (propertyNum1)
-;
-create index product_pn2 on DB.DBA.Product (propertyNum2)
-;
-create index product_pn3 on DB.DBA.Product (propertyNum3)
-;
-
-create text index on DB.DBA.Product (label) with key nr
-;
-
-CREATE TABLE DB.DBA.ProductTypeProduct (
-  product integer not null,
-  productType integer not null,
-  PRIMARY KEY (product, productType)
-)
-;
-
-grant SELECT on DB.DBA.ProductTypeProduct to public
-;
-
-create index ptype_inv on DB.DBA.ProductTypeProduct (productType, product)
-;
-
-CREATE TABLE DB.DBA.ProductFeatureProduct (
-  product integer not null,
-  productFeature integer not null,
-  PRIMARY KEY (product, productFeature)
-)
-;
-
-grant SELECT on DB.DBA.ProductFeatureProduct to public
-;
-
-create index pfeature_inv on DB.DBA.ProductFeatureProduct (productFeature, product)
-;
-
-CREATE TABLE DB.DBA.Vendor (
-  nr integer primary key,
-  label varchar(100) not null,
-  comment varchar not null,
-  homepage varchar(100) not null,
-  country char(2) not null,
-  publisher integer not null,
-  publishDate date not null
-)
-;
-
-grant SELECT on DB.DBA.Vendor to public
-;
-
-create index vendor_country on DB.DBA.Vendor (country)
-;
-create index vendor_homepage on DB.DBA.Vendor (homepage)
-;
-
-CREATE TABLE DB.DBA.Offer (
-  nr integer primary key,
-  product integer not null,
-  producer integer,
-  vendor integer not null,
-  price double precision not null,
-  validFrom date not null,
-  validTo date not null,
-  deliveryDays integer not null,
-  offerWebpage varchar(100) not null,
-  publisher integer not null,
-  publishDate date not null
-)
-;
-
-grant SELECT on DB.DBA.Offer to public
-;
-
-create index offer_product on DB.DBA.Offer (product, deliveryDays)
-;
-create unique index offer_producer_product on DB.DBA.Offer (producer, product, nr)
-;
-create index offer_validto on DB.DBA.Offer (validTo)
-;
-create index offer_vendor_product on DB.DBA.Offer (vendor, product)
-;
-create index offer_webpage on DB.DBA.Offer (offerWebpage)
-;
-
-CREATE TABLE DB.DBA.Person (
-  nr integer primary key,
-  name varchar(30) not null,
-  mbox_sha1sum char(40) not null,
-  country char(2) not null,
-  publisher integer not null,
-  publishDate date not null
-)
-;
-
-grant SELECT on DB.DBA.Person to public
-;
-
-CREATE TABLE DB.DBA.Review (
-  nr integer primary key,
-  product integer not null,
-  producer integer,
-  person integer not null,
-  reviewDate date not null,
-  title varchar(200) not null,
-  text long varchar not null,
-  textlang char(2) not null,
-  rating1 integer,
-  rating2 integer,
-  rating3 integer,
-  rating4 integer,
-  publisher integer not null,
-  publishDate date not null
-)
-;
-
-grant SELECT on DB.DBA.Review to public
-;
-
-create unique index review_product on DB.DBA.Review (product, producer, nr)
-;
-
-create unique index review_producer_product on DB.DBA.Review (producer, product, nr)
-;
-
-create bitmap index review_textlang on DB.DBA.Review (textlang)
-;
-
-DB.DBA.XML_SET_NS_DECL ('foaf', 'http://xmlns.com/foaf/0.1/', 2)
-;
-DB.DBA.XML_SET_NS_DECL ('dc', 'http://purl.org/dc/elements/1.1/', 2)
-;
-DB.DBA.XML_SET_NS_DECL ('xsd', 'http://www.w3.org/2001/XMLSchema-datatypes/', 2)
-;
-DB.DBA.XML_SET_NS_DECL ('rev', 'http://purl.org/stuff/rev#', 2)
-;
-DB.DBA.XML_SET_NS_DECL ('bsbm', 'http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/', 2)
-;
-DB.DBA.XML_SET_NS_DECL ('bsbm-inst', 'http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/', 2)
-;
-
-SPARQL drop quad map bsbm:SingleGraphView
-;
-
-SPARQL create iri class bsbm:ProductFeature-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature%d" (in nr integer not null)
-;
-
-SPARQL create iri class bsbm:ProductType-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductType%d" (in nr integer not null)
-;
-
-SPARQL create iri class bsbm:Producer-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer%d/Producer%d" (in nr_ integer not null, in nr integer not null)
-;
-
-SPARQL create iri class bsbm:Product-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer%d/Product%d" (in producer integer not null, in nr integer not null)
-;
-
-SPARQL create iri class bsbm:Vendor-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromVendor%d/Vendor%d" (in nr_ integer not null, in nr integer not null)
-;
-
-SPARQL create iri class bsbm:Offer-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromVendor%d/Offer%d" (in vendor integer not null, in nr integer not null)
-;
-
-SPARQL create iri class bsbm:StdInst-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/StandardizationInstitution%d" (in publisher integer not null)
-;
-
-SPARQL create iri class bsbm:Person-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromRatingSite%d/Person%d" (in publisher integer not null, in nr integer not null)
-;
-
-SPARQL create iri class bsbm:Review-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromRatingSite%d/Review%d" (in site integer, in nr integer not null)
-;
-
-SPARQL create iri class bsbm:ISO3166-country-iri "http://downlode.org/rdf/iso-3166/countries#%s" (in code varchar not null)
-;
-
-SPARQL create iri class bsbm:homepage-iri "%s" (in homepage varchar not null) option (returns "http://%s")
-;
-
-SPARQL create iri class bsbm:RatingSite-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromRatingSite%d/RatingSite%d" (in nr_ integer not null, in nr integer not null)
-;
-
-SPARQL
-alter quad storage virtrdf:DefaultQuadStorage
-FROM DB.DBA.ProductFeature as pfeature
-FROM DB.DBA.ProductType as ptype
-FROM DB.DBA.Producer as producer
-FROM DB.DBA.Product as product text literal product.label
-FROM DB.DBA.ProductTypeProduct as ptypeproduct
-FROM DB.DBA.ProductFeatureProduct as pfeatureproduct
-FROM DB.DBA.Vendor as vendor
-FROM DB.DBA.Offer as offer
-FROM DB.DBA.Person as person
-FROM DB.DBA.Review as review
-where (^{product.}^.nr = ^{ptypeproduct.}^.product)
-where (^{product.}^.nr = ^{pfeatureproduct.}^.product)
+        <para><emphasis>XSLT - The Fulchrum</emphasis></para>
+        <para>XSLT is the fulchrum of all OpenLink supplied cartridges. It provides the most convenient
+means of converting structured data extracted from web content by a cartridge's Entity Extractor into RDF.</para>
+        <para><emphasis>Virtuoso's XML Infrastructure & Tools</emphasis></para>
+        <para>Virtuoso's XML support and XSLT support are covered in detail in the on-line documentation.
+Virtuoso includes a highly capable XML parser and supports XPath, XQuery, XSLT and XML Schema validation.</para>
+        <para>Virtuoso supports extraction of XML documents from SQL datasets. A SQL long varchar, long xml
+or xmltype column in a database table can contain XML data as text or in a binary serialized format.
+ A string representing a well-formed XML entity can be converted into an entity object representing
+the root node.</para>
+        <para>While Sponger cartridges will not normally concern themselves with handling XML extracted
+from SQL data, the ability to convert a string into an in-memory XML document is used extensively.
+The function xtree_doc(string) converts a string into such a document and returns a reference to the
+document's root. This document together with an appropriate stylesheet forms the input for
+the transformation of the extracted entities to RDF using XSLT. The input string to xtree_doc
+generally contains structured content derived from a web service.</para>
+        <para><emphasis>Virtuoso XSLT Support</emphasis></para>
+        <para>Virtuoso implements XSLT 1.0 transformations as SQL callable functions. The xslt() Virtuoso/PL function
+applies a given stylesheet to a given source XML document and returns the transformed document. Virtuoso
+provides a way to extend the abilities of the XSLT processor by creating user defined XPath functions.
+The functions xpf_extension() and xpf_extension_remove() allow addition and removal of XPath extension
+functions.</para>
+        <para><emphasis>General Cartridge Pipeline</emphasis></para>
+        <para>The broad pipeline outlined here reflects the steps common to most cartridges:</para>
+          <itemizedlist mark="bullet">
+            <listitem>Redirect from the requested URL to a Web service which returns XML</listitem>
+            <listitem>Stream the content into an in-memory XML document</listitem>
+            <listitem>Convert it to the required RDF/XML, expressed in the chosen ontology, using XSLT</listitem>
+            <listitem>Encode the RDF/XML as UTF-8</listitem>
+            <listitem>Load the RDF/XML into the quad store</listitem>
+          </itemizedlist>
+        <para>The <ulink url="http://musicbrainz.org/">MusicBrainz</ulink> cartridge typifies this approach. MusicBrainz is a community music
+metadatabase which captures information about artists, their recorded works, and the relationships
+between them. Artists always have a unique ID, so the URL
+http://musicbrainz.org/artist/4d5447d7-c61c-4120-ba1b-d7f471d385b9.html takes you directly to entries
+for John Lennon.</para>
+        <para>If you were to look at this page in your browser, you would see that the information about
+the artist contains no RDF data. However, the cartridge is configured to intercept requests to URLs of
+the form http://musicbrainz.org/([^/]*)/([^.]*) and redirect to the cartridge to sponge all the
+available information on the given artist, release, track or label.</para>
+        <para>The cartridge extracts entities by redirecting to the MusicBrainz XML Web Service using
+as the basis for the initial query the item ID, e.g. an artist or label ID, extracted from the original
+URL. Stripped to its essentials, the core of the cartridge is:</para>
+<programlisting><![CDATA[
+webservice_uri := sprintf ('http://musicbrainz.org/ws/1/%s/%s?type=xml&inc=%U',
+					kind, id, inc);
+content := RDF_HTTP_URL_GET (webservice_uri, '', hdr, 'GET', 'Accept: */*');
+xt := xtree_doc (content);
+...
+xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/mbz2rdf.xsl', xt);
+...
+xd := serialize_to_UTF8_xml (xd);
+DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+]]></programlisting>
+        <para>In the above outline, RDF_HTTP_URL_GET sends a query to the MusicBrainz web service,
+using query parameters appropriate for the original request, and retrieves the response using
+HTTP GET.</para>
+        <para>The returned XML is parsed into an in-memory parse tree by xtree_doc. Virtuoso/PL
+function RDF_MAPPER_XSLT is a simple wrapper around the function xslt which sets the current user
+to dba before returning an XML document transformed by an XSLT stylesheet, in this case mbz2rdf.xsl.
+Function serialize_to_UTF8_xml changes the character set of the in-memory XML document to UTF8.
+Finally, RM_RDF_LOAD_RDFXML is a wrapper around RDF_LOAD_RDFXML which parses the content of an
+RDF/XML string into a sequence of RDF triples and loads them into the quad store. XSLT stylesheets
+are usually held in the DAV/VAD/rdf_mappers/xslt folder of Virtuoso's WebDAV store.
+registry_get('rdf_mappers_path') returns the RDF Mappers VAD path, 'DAV/VAD/rdf_mappers', from the
+Virtuoso registry.</para>
+        <para><emphasis>Error Handling with Exit Handlers</emphasis></para>
+        <para>Virtuoso condition handlers determine the behaviour of a Virtuoso/PL procedure when a
+condition occurs. You can declare one or more condition handlers in a Virtuoso/PL procedure for
+general SQL conditions or specific SQLSTATE values. If a statement in your procedure raises an
+SQLEXCEPTION condition and you declared a handler for the specific SQLSTATE or SQLEXCEPTION
+condition the server passes control to that handler. If a statement in your Virtuoso/PL procedure
+raises an SQLEXCEPTION condition, and you have not declared a handler for the specific SQLSTATE
+or the SQLEXCEPTION condition, the server passes the exception to the calling procedure (if any).
+If the procedure call is at the top-level, then the exception is signaled to the calling client.</para>
+        <para>A number of different condition handler types can be declared (see the <ulink url="http://docs.openlinksw.com/virtuoso/handlingplcondit.html">Virtuoso reference documentation</ulink>
+for more details.) Of these, exit handlers are probably all you will need. An example is shown below
+which handles any SQLSTATE. Commented out is a debug statement which outputs the message describing
+the SQLSTATE.</para>
+<programlisting><![CDATA[
+create procedure DB.DBA.RDF_LOAD_SOCIALGRAPH (in graph_iri varchar, ...)
   {
-    create bsbm:SingleGraphView as graph <BSBM> option (exclusive)
-      {
-	bsbm:Product-iri (product.producer, product.nr)
-          a bsbm:Product ;
-	  rdfs:label product.label ;
-          rdfs:comment product.comment ;
-          bsbm:producer bsbm:Producer-iri (product.producer, product.producer) ;
-          bsbm:productPropertyTextual1 product.propertyTex1 ;
-          bsbm:productPropertyTextual2 product.propertyTex2 ;
-          bsbm:productPropertyTextual3 product.propertyTex3 ;
-          bsbm:productPropertyTextual4 product.propertyTex4 ;
-          bsbm:productPropertyTextual5 product.propertyTex5 ;
-          bsbm:productPropertyTextual6 product.propertyTex6 ;
-          bsbm:productPropertyNumeric1 product.propertyNum1 ;
-          bsbm:productPropertyNumeric2 product.propertyNum2 ;
-          bsbm:productPropertyNumeric3 product.propertyNum3 ;
-          bsbm:productPropertyNumeric4 product.propertyNum4 ;
-          bsbm:productPropertyNumeric5 product.propertyNum5 ;
-          bsbm:productPropertyNumeric6 product.propertyNum6 ;
-          rdf:type bsbm:ProductType-iri (ptypeproduct.productType) ;
-          bsbm:productFeature bsbm:ProductFeature-iri (pfeatureproduct.productFeature) ;
-          dc:publisher bsbm:Producer-iri (product.publisher, product.publisher) ;
-          dc:date product.publishDate .
-
-        bsbm:ProductType-iri (ptype.nr)
-          a bsbm:ProductType ;
-          rdfs:label ptype.label ;
-          rdfs:comment ptype.comment ;
-          rdfs:subClassOf bsbm:ProductType-iri (ptype.parent) ;
-          dc:publisher bsbm:StdInst-iri (ptype.publisher) ;
-          dc:date ptype.publishDate .
-
-        bsbm:ProductFeature-iri (pfeature.nr)
-          a bsbm:ProductFeature ;
-          rdfs:label pfeature.label ;
-          rdfs:comment pfeature.comment ;
-          dc:publisher bsbm:StdInst-iri (pfeature.publisher) ;
-          dc:date pfeature.publishDate .
-
-        bsbm:Producer-iri (producer.nr, producer.nr)
-          a bsbm:Producer ;
-          rdfs:label producer.label ;
-          rdfs:comment producer.comment ;
-          foaf:homepage bsbm:homepage-iri (producer.homepage) ;
-          bsbm:country bsbm:ISO3166-country-iri (producer.country) ;
-          dc:publisher bsbm:Producer-iri (producer.nr, producer.nr) ;
-          dc:date producer.publishDate .
-
-        bsbm:Vendor-iri (vendor.nr, vendor.nr)
-          a bsbm:Vendor ;
-          rdfs:label vendor.label ;
-          rdfs:comment vendor.comment ;
-          foaf:homepage bsbm:homepage-iri (vendor.homepage) ;
-          bsbm:country bsbm:ISO3166-country-iri (vendor.country) ;
-          dc:publisher bsbm:Vendor-iri (vendor.publisher, vendor.publisher) ;
-          dc:date vendor.publishDate .
-
-        bsbm:Offer-iri (offer.vendor, offer.nr)
-          a bsbm:Offer ;
-          bsbm:product bsbm:Product-iri (offer.producer, offer.product) ;
-          bsbm:vendor bsbm:Vendor-iri (offer.vendor, offer.vendor) ;
-          bsbm:vendor bsbm:Vendor-iri (offer.vendor, offer.vendor) ;
-          bsbm:price offer.price ;
-          bsbm:validFrom offer.validFrom ;
-          bsbm:validTo offer.validTo ;
-          bsbm:deliveryDays offer.deliveryDays ;
-          bsbm:offerWebpage bsbm:homepage-iri (offer.offerWebpage) ;
-          dc:publisher bsbm:Vendor-iri (offer.publisher, offer.publisher) ;
-          dc:date offer.publishDate .
-
-        bsbm:Person-iri (person.publisher, person.nr)
-          a foaf:Person ;
-          foaf:name person.name ;
-          foaf:mbox_sha1sum person.mbox_sha1sum ;
-          bsbm:country bsbm:ISO3166-country-iri (person.country) ;
-          dc:publisher bsbm:RatingSite-iri (person.publisher, person.publisher) ;
-          dc:date person.publishDate .
-
-        bsbm:Review-iri (review.publisher, review.nr)
-          a rev:Review ;
-          bsbm:reviewFor bsbm:Product-iri (review.producer, review.product) ;
-          bsbm:producer bsbm:Producer-iri (review.producer, review.producer) ;
-          rev:reviewer bsbm:Person-iri (review.publisher, review.person) ;
-          bsbm:reviewDate review.reviewDate ;
-          dc:title review.title ;
-          rev:text review.text lang review.textlang ;
-          bsbm:rating1 review.rating1 ;
-          bsbm:rating2 review.rating2 ;
-          bsbm:rating3 review.rating3 ;
-          bsbm:rating4 review.rating4 ;
-          dc:publisher bsbm:RatingSite-iri (review.publisher, review.publisher) ;
-          dc:date review.publishDate .
-      }
-  }
-;
+  declare qr, path, hdr any;
+  ...
+  declare exit handler for sqlstate '*'
+{
+    -- dbg_printf ('%s', __SQL_MESSAGE);
+    return 0;
+};
+  ...
+  -- data extraction and mapping successful
+  return 1;
+}
 ]]></programlisting>
-    </sect3>
- </sect2>
-<sect2 id="rdfviews"><title>RDF Views over RDBMS Data Source</title>
-<para>
-RDF Views map relational data into RDF and allow customizing RDF representation of locally stored RDF data.
-To let SPARQL clients access relational data as well as physical RDF graphs in a single query, we introduce a declarative Meta Schema Language for mapping SQL Data to RDF Ontologies.
-As a result, all types of clients can efficiently access all data stored on the server.
-The mapping functionality dynamically generates RDF Data Sets for popular ontologies such as SIOC, SKOS, FOAF, and ATOM/OWL without disruption to the existing database infrastructure of Web 1.0 or Web 2.0 solutions.
-RDF views are also suitable for declaring custom representation for RDF triples, e.g. property tables, where one row holds many single-valued properties.
-</para>
-<sect3 id="rdfviewsintro"><title>Introduction</title>
-<para>
-The Virtuoso RDF Views meta schema is a built-in feature of Virtuoso's SPARQL to SQL translator.
-It recognizes triple patterns that refer to graphs for which an alternate representation is declared and translates these into SQL accordingly.
-The main purpose of this is evaluating SPARQL queries against existing relational databases.
-There exists previous work from many parties for rendering relational data as RDF and opening it to SPARQL access.
-We can mention D2RQ, SPASQL, Squirrel RDF, DBLP and others.
-The Virtuoso effort differs from these mainly in the following:
-</para>
-<itemizedlist mark="bullet" spacing="compact">
-<listitem>Integration with a triple store.
-Virtuoso can process a query for which some triple patterns will go to local or remote relational data and some to local physical RDF triples.
-</listitem><listitem>SPARQL query can be used in any place where SQL can.
-Database connectivity protocols are neutral to the syntax of queries they transmit, thus any SQL client, e.g. JDBC, ODBC or XMLA application, can send SPARQL queries and fetch result sets.
-Moreover, a SQL query may contain SPARQL subqueries and SPARQL expressions may use SQL built-in functions and stored procedures.
-</listitem><listitem>Integration with SQL.
-Since SPARQL and SQL share the same run time and query optimizer, the query compilation decisions are always made with the best knowledge of the data and its location.
-This is especially important when mixing triples and relational data or when dealing with relational data distributed across many outside databases.
-</listitem><listitem>No limits on SPARQL.
-It remains possible to make queries with unspecified graph or predicate against mapped relational data, even though these may sometimes be inefficient.
-</listitem><listitem>Coverage of the whole relational model.
-Multi-part keys etc. are supported in all places.
-   </listitem>
-</itemizedlist>
-</sect3>
-<sect3 id="rdfviewrationale"><title>Rationale</title>
-<para>
-Since most of the data that is of likely use for the emerging semantic web is stored in relational databases, the argument for exposing this to SPARQL access is clear.
-We note that historically, SQL access to relational data has essentially never been given to the public outside of the organization.
-If programmatic access to corporate IS has been available to partners or the public, it has been through dynamic web pages or more recently web services.
-There are reasons of performance, security, maintainability and so forth for this.
-</para><para>
-The culture of the emerging semantic web is however taking a different turn.
-Since RDF and OWL offer a mergeable and queryable model for heterogeneous data, it is more meaningful and maintainable to expose selected data for outside query than it would be with SQL.
-Advances in hardware make this also less of a performance issue than it would have been in the client-server database era.
-</para><para>
-In the context of Virtuoso, since Virtuoso is originally a virtual/federated database, incorporating SPARQL to relational mapping is an evident extension of the product's mission as a multi-protocol, multi-platform connector between information systems.
-</para>
-</sect3>
-<sect3 id="rdfviewquadmapatternsvalueandiriclasses"><title>Quad Map Patterns, Value and IRI Classes</title>
-<para>
-In the simplest sense, any relational schema can be rendered into RDF by converting all primary keys and foreign keys into IRI's, assigning a predicate IRI to each column, and an rdf:type predicate for each row linking it to a RDF class IRI corresponding to the table.
-Then a triple with the primary key IRI as subject, the column IRI as predicate and the column's value as object is considered to exist for each column that is neither part of a primary or foreign key.
-</para><para>
-Strictly equating a subject value to a row and each column to a predicate is often good but is too restrictive for the general case.
-</para>
-<itemizedlist mark="bullet" spacing="compact">
-<listitem>Multiple triples with the same subject and predicate can exist.
-</listitem><listitem>A single subject can get single-valued properties from multiple tables or in some cases stored procedures.
-</listitem><listitem>An IRI value of a subject or other field of a triple can be composed from more than one SQL value, these values may reside in different columns, maybe in different joined tables.
-</listitem><listitem>Some table rows should be excluded from mapping.
-</listitem></itemizedlist>
-<para>
-Thus in the most common case the RDF meta schema should consist of independent transformations; the domain of each transformation is a result-set of some SQL <emphasis>SELECT</emphasis> statement and range is a set of triples.
-The <emphasis>SELECT</emphasis> that produce the domain is quite simple: it does not use aggregate functions, joins and sorting, only inner joins and <emphasis>WHERE</emphasis> conditions.
-There is no need to support outer joins in the RDF meta schema because NULLs are usually bad inputs for functions that produce IRIs.
-In the rare cases when NULLs are OK for functions, outer joins can be encapsulated in SQL views.
-The range of mapping can be described by a SPARQL triple pattern: a pattern field is a variable if it depends on table columns, otherwise it is a constant.
-Values of variables in the pattern may have additional restrictions on datatypes, when datatypes of columns are known.
-</para><para>
-This common case of an RDF meta schema is implemented in Virtuoso, with one adjustment.
-Virtuoso stores quads, not triples, using the graph field (G) to indicate that a triple belongs to some particular application or resource.
-A SPARQL query may use quads from different graphs without large difference between G and the other three fields of a quad.
-E.g., variable <emphasis>?g</emphasis> in expression <emphasis>GRAPH ?g {...}</emphasis> can be unbound.
-SPARQL has special syntax for "graph group patterns" that is convenient for sets of triple patterns with a common graph, but it also has shorthands for common subject and predicate, so the difference is no more than in syntax.
-There is only one feature that is specific for graphs but not for other fields: the SPARQL compiler can create restrictions on graphs according to <emphasis>FROM</emphasis> and <emphasis>FROM NAMED</emphasis> clauses.
-</para><para>
-Virtuoso RDF Views should offer the same flexibility with the graphs as SPARQL addressing physical triples.
-A transformation cannot always be identified by the graph used for ranges because graph may be composed from SQL data. The key element of the meta schema is a "<emphasis>quad map pattern</emphasis>".
-A simple quad map pattern fully defines one particular transformation from one set of relational columns into triples that match one SPARQL graph pattern.
-The main part of quad map pattern is four declarations of "<emphasis>quad map values</emphasis>", each declaration specifies how to calculate the value of the corresponding triple field from the SQL data.
-The pattern also lists boolean SQL expressions that should be used to filter out unwanted rows of source data (and to join multiple tables if source columns belong to different tables).
-There are also quad map patterns that group together similar quad patterns but do not specify any real transformation or even prevent unwanted transformations from being used, they are described in "Grouping Map Patterns" below.
-</para><para>
-Quad map values refer to schema elements of two further types: "IRI classes" and "literal classes".
-</para>
-<sect4 id="rdfviewiriclasses"><title>IRI Classes</title>
-<para>
-An IRI class declares that a column or set of columns gets converted into a IRI in a certain way.
-The conversion of this sort can be declared revertible (bijection) so an IRI can be parsed into original SQL values; this is useful when some equality of an IRI constant and a calculated IRI can be replaced with an equality of a parse result of a constant and an SQL column that is index criteria or simply faster.
-In addition, the SPARQL optimizer will eliminate redundant conversions if one IRI class is explicitly declared as a subclass of another.
-The most flexible declaration for conversion consists of specifying functions that assemble and disassemble from IRI into its constituent parts.
-This is overkill for typical conversions so it is possible to specify only one sprintf-style format string such that <emphasis>sprintf()</emphasis> SQL function will print an IRI using this format and <emphasis>sprintf_inverse()</emphasis> will be able to parse it back.
-</para><para>The use of <emphasis>sprintf_inverse()</emphasis> assumes that the format does not contain fragments like <emphasis>'%s%s'</emphasis> that make it impossible to separate parts of IRI from each other.
-</para><para>
-In the following, we shall map the Virtuoso users and user roles system tables into the SIOC ontology.
-</para>
+        <para>Exit handlers are used extensively in the Virtuoso supplied cartridges. They are useful
+for ensuring graceful failure when trying to convert content which may not conform to your expectations.
+The RDF_LOAD_FEED_SIOC procedure (which is used internally by several cartridges) shown below uses this
+approach:</para>
 <programlisting><![CDATA[
-create iri class oplsioc:user_iri "http://myhost/sys/user?id=%d"
-  (in uid integer not null) .
-create iri class oplsioc:group_iri "http://myhost/sys/group?id=%d"
-  (in gid integer not null) .
-create iri class oplsioc:membership_iri
-  "http://myhost/sys/membership?super=%d&sub=%d"
-  (in super integer not null, in sub integer not null) .
-create iri class oplsioc:dav_iri "http://myhost%s"
-  (in path varchar) .
+-- /* convert the feed in rss 1.0 format to sioc */
+create procedure DB.DBA.RDF_LOAD_FEED_SIOC (in content any, in iri varchar, in graph_iri varchar, in is_disc int := '')
+    {
+  declare xt, xd any;
+  declare exit handler for sqlstate '*'
+    {
+      goto no_sioc;
+};
+  xt := xtree_doc (content);
+  xd := DB.DBA.RDF_MAPPER_XSLT (
+      registry_get ('_rdf_mappers_path_') || 'xslt/feed2sioc.xsl', xt,
+      vector ('base', graph_iri, 'isDiscussion', is_disc));
+  xd := serialize_to_UTF8_xml (xd);
+  DB.DBA.RM_RDF_LOAD_RDFXML (xd, iri, graph_iri);
+  return 1;
+no_sioc:
+  return 0;
+}
 ]]></programlisting>
-<para>
-These IRI classes are used for mapping data from the <emphasis>DB.DBA.SYS_USERS</emphasis> and <emphasis>DB.DBA.SYS_ROLE_GRANTS</emphasis> system tables that are defined in Virtuoso as follows:
-</para>
+        <para><emphasis>Loading RDF into the Quad Store</emphasis></para>
+        <para><emphasis>RDF_LOAD_RDFXML & TTLP</emphasis></para>
+        <para>The two main Virtuoso/PL functions used by the cartridges for loading RDF data into the
+Virtuoso quad store are DB.DBA.TTLP and DB.DBA.RDF_LOAD_RDFXML. Multithreaded versions of these functions,
+DB.DBA.TTLP_MT and DB.DBA.RDF_LOAD_RDFXML_MT, are also available.</para>
+        <para>RDF_LOAD_RDFXML parses the content of an RDF/XML string as a sequence of RDF triples and
+loads then into the quad store. TTLP parses TTL (Turtle or N3) and places its triples into quad
+storage. Ordinarily, cartridges use RDF_LOAD_RDFXML. However there may be occasions where you want
+to insert statements written as TTL, rather than RDF/XML, in which case you should use TTLP.</para>
+  <tip><title>See Also:</title>
+    <itemizedlist mark="bullet">
+      <listitem><link linkend="rdfinsertmethodsapifunct">Loading RDF using API functions</link></listitem>
+    </itemizedlist>
+  </tip>
+        <para><emphasis>Attribution</emphasis></para>
+        <para>Many of the OpenLink supplied cartridges actually use RM_RDF_LOAD_RDFXML to load data
+into the quad store. This is a thin wrapper around RDF_LOAD_RDFXML which includes in the generated
+graph an indication of the external ontologies being used. The attribution takes the form:</para>
 <programlisting><![CDATA[
-create table DB.DBA.SYS_USERS (
-  U_ID                integer not null unique,
-  U_NAME              char (128) not null primary key,
-  U_IS_ROLE           integer default 0,
-  U_FULL_NAME         char (128),
-  U_E_MAIL            char (128) default ",
-  U_ACCOUNT_DISABLED  integer default 1,
-  U_DAV_ENABLE        integer default 0,
-  U_SQL_ENABLE        integer default 1,
-  U_HOME              varchar (128),
-. . .
- );
+<ontologyURI> a opl:DataSource .
+<spongedResourceURI> rdfs:isDefinedBy <ontologyURI> .
+<ontologyURI> opl:hasNamespacePrefix "<ontologyPrefix>" .
 ]]></programlisting>
-<para>
-Single record in <emphasis>DB.DBA.SYS_USERS</emphasis> corresponds to a plain user or a group (role).
-Users and roles are collectively named "grantees". Thus a role may be granted to another role or to a user account.
-A role grant may be direct (explicit) or assigned by recursion.
-</para>
+        <para>where prefix opl: denotes the ontology http://www.openlinksw.com/schema/attribution#.</para>
+        <para><emphasis>Deleting Existing Graphs</emphasis></para>
+        <para>Before loading sponged RDF data into a graph, you may want to delete any existing graph
+with the same URI. To do so, select the 'RDF' > 'List of Graphs' menu commands in Conductor, then use
+the 'Delete' command for the appropriate graph. Alternatively, you can use one of the following SQL
+commands:</para>
 <programlisting><![CDATA[
-create table SYS_ROLE_GRANTS (
-  GI_SUPER   integer,
-  GI_SUB     integer,
-  GI_DIRECT  integer default 1,
-. . .
-  primary key (GI_SUPER, GI_SUB, GI_DIRECT));
+SPARQL CLEAR GRAPH
+-- or
+DELETE FROM DB.DBA.RDF_QUAD WHERE G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_iri)
 ]]></programlisting>
-<para>One IRI class usually corresponds to one ontology class, because similar things are usually called similarly.
-One may wish to use identifiers of ontology classes as identifiers of related IRI classes, to not remember double number of names, e.g. <emphasis>create IRI class mybank:XpressXfer</emphasis> for subjects that will have <emphasis>rdf:type</emphasis> property <emphasis>mybank:XpressXfer</emphasis> made by mapping. That is technically possible but proven to become inconvenient and misleading as application evolves. While RDF types tend to persist, IRI classes may change over time or same subject may get more than one name via more than one IRI class, say, for exports to different systems. It is found to be more convenient to compose names of IRI classes by adding some common prefixes or suffixes to RDF classes (or to table names), say, write <emphasis>create IRI class mybank:XpressXfer_iri</emphasis>.</para>
-</sect4>
-<sect4 id="rdfviewliteralclasses"><title>Literal Classes</title>
-<para>
-A "literal class" declares that a column or set of columns gets converted into a literal instead of an IRI.
-More precisely, the result of conversion can be <emphasis>IRI_ID</emphasis> so it represents an IRI, but in current version of Virtuoso this is supported only for some internal built-in literal classes, not for classes declared by the user.
-So for user-defined literal class the result of the conversion is an RDF literal even if it is a string representation of a valid IRI.
-</para><para>
-In any case, a literal class can be used only in quad map values of O fields, because Virtuoso does not support literal values as subjects.
-</para><para>
-A special case of literal class is the identity class that converts a value from <emphasis>varchar</emphasis> column into an untyped literal and value from column of any other SQL datatype into a typed literal with type from XMLSchema set, i.e. <emphasis>xsd:integer</emphasis>, <emphasis>xsd:dateTime</emphasis> and so on.
-Columns of types <emphasis>ANY</emphasis> and <emphasis>IRI_ID</emphasis> are not supported.
-</para><para>
-The SPARQL optimizer knows that RDF literal types are pairwise disjoint so literal classes that produce literals of different types are known to be pairwise disjoint.
-The optimizer will replace a join on two disjoint literal classes with an empty statement, to simplify the resulting query.
-</para>
-</sect4>
-<sect4 id="rdfviewsimplequadmappatterns"><title>Simple Quad Map Patterns</title>
-<para>
-The following declaration of quad map pattern is self-explanatory. The line for <emphasis>object</emphasis> uses identity literal class so there's no need to specify its name.
-</para>
+        <para><emphasis>Proxy Service Data Expiration</emphasis></para>
+        <para>When the Proxy Service is invoked by a user agent, the Sponger records the expiry date
+of the imported data in the table DB.DBA.SYS_HTTP_SPONGE. The data invalidation rules conform to those
+of traditional HTTP clients (Web browsers). The data expiration time is determined based on subsequent
+data fetches of the same resource. The first data retrieval records the 'expires' header. On subsequent
+fetches, the current time is compared to the expiration time stored in the local cache. If HTTP 'expires'
+header data isn't returned by the source data server, the Sponger will derive its own expiration time by
+evaluating the 'date' header and 'last-modified' HTTP headers.</para>
+      </sect4>
+      <sect4 id="virtuosospongercreatecustcartrontolg">
+        <title>Ontology Mapping</title>
+        <para>After extracting entities from a web resource and converting them to an in-memory XML
+document, the entities must be transformed to the target ontology using XSLT and an appropriate stylesheet.
+A typical call sequence would be:</para>
 <programlisting><![CDATA[
-graph      <http://myhost/sys>
-subject    oplsioc:user_iri (DB.DBA.SYS_USERS.U_ID)
-predicate  foaf:email
-object     DB.DBA.SYS_USERS.U_E_MAIL
+xt := xtree_doc (content);
+...
+xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/mbz2rdf.xsl', xt);
 ]]></programlisting>
-<para>
-The description language also supports SPARQL-style notation that contains less keywords and eliminates duplicate graphs, subjects and predicates.
-The following add two patterns with constant graph IRI <emphasis><http://myhost/sys></emphasis> and subjects are made from column <emphasis>DB.DBA.SYS_USERS.U_ID</emphasis> by <emphasis>oplsioc:user_iri</emphasis>.
-</para>
+        <para>Because of the wide variation in the data mapped by cartridges, it is not possible to present
+a typical XSL stylesheet outline. The Examples section presented later includes detailed extracts from the
+MusicBrainz? cartridge's stylesheet which provide a good example of how to map to an ontology. Rather than
+attempting to be an XSLT tutorial, the material which follows offers some general guidelines.</para>
+        <para><emphasis>Passing Parameters to the XSLT Processor</emphasis></para>
+        <para>Virtuoso's XSLT processor will accept default values for global parameters from the optional
+third argument of the xslt() function. This argument, if specified, must be a vector of parameter names
+and values of the form vector(name1, value1,... nameN, valueN), where name1 ... nameN must be of type
+varchar, and value1 ... valueN may be of any Virtuoso datatype, but may not be null.</para>
+        <para>This extract from the Crunchbase cartridge shows how parameters may be passed to the XSLT
+processor. The function RDF_MAPPER_XSLT (in xslt varchar, inout xt any, in params any := null) passes
+the parameters vector directly to xslt().</para>
 <programlisting><![CDATA[
-graph <http://myhost/sys>
-  {
-    oplsioc:user_iri (DB.DBA.SYS_USERS.U_ID)
-      a sioc:user ;
-      oplsioc:name DB.DBA.SYS_USERS.U_FULL_NAME .
-  }
+xt := DB.DBA.RDF_MAPPER_XSLT (
+registry_get ('_rdf_mappers_path_') || 'xslt/crunchbase2rdf.xsl', xt,
+vector ('baseUri', coalesce (dest, graph_iri), 'base', base, 'suffix', suffix)
+);
 ]]></programlisting>
-</sect4>
-<sect4 id="rdfviewassigningnamestoquadmappatterns"><title>Assigning Names To Quad Map Patterns</title>
-<para>
-In real applications, quad map patterns should be named, for schema manipulation and keeping debug info readable.
-Thus it is much better to rewrite the previous example as
-</para>
+        <para>The corresponding stylesheet crunchbase2rdf.xsl retrieves the parameters baseUri, base and suffix as follows:</para>
 <programlisting><![CDATA[
-create virtrdf:SysUsers as graph <http://myhost/sys>
-       {
-    oplsioc:user_iri (DB.DBA.SYS_USERS.U_ID)
-      a sioc:user
-          as virtrdf:SysUserType-User;
-      oplsioc:name DB.DBA.SYS_USERS.U_FULL_NAME
-          as virtrdf:SysUsersFullName .
-  }
+...
+<xsl:output method="xml" indent="yes" />
+  <xsl:variable name="ns">http://www.crunchbase.com/</xsl:variable>
+  <xsl:param name="baseUri" />
+  <xsl:param name="base"/>
+  <xsl:param name="suffix"/>
+  <xsl:template name="space-name">
+...
 ]]></programlisting>
-<para>
-Using these names, one may later write, say, <emphasis>drop quad map virtrdf:SysUserType-User</emphasis>.
-</para><para>
-One name, <emphasis>virtrdf:DefaultQuadMap</emphasis> is reserved.
-It is an internal quad map pattern used to access "native-form" quads from <emphasis>DB.DBA.RDF_QUAD</emphasis>:
-</para>
+        <para><emphasis>An RDF Description Template</emphasis></para>
+        <para><emphasis>Defining A Generic Resource Description Wrapper</emphasis></para>
+        <para>Many of the OpenLink cartridges create a resource description formed to a common "wrapper"
+template which describes the relationship between the (usually) non-RDF source resource being sponged
+and the RDF description generated by the Sponger. The wrapper is appropriate for resources which can
+broadly be conceived as documents. It provides a generic minimal description of the source document,
+but also links to the much more detailed description provided by the Sponger. So, instead of just
+emitting a resource description, the Sponger factors the container into the generated graph constituting
+the RDF description.</para>
+        <para>The template is depicted below:</para>
+        <figure id="spong3" float="1">
+          <title>Template</title>
+          <graphic fileref="ui/spong3.png"/>
+        </figure>
+        <para>To generate an RDF description corresponding to the wrapper template, a stylesheet containing
+the following block of instructions is used. This extract is taken from the eBay cartridge's stylesheet,
+ebay2rdf.xsl. Many of the OpenLink cartridges follow a similar pattern.</para>
 <programlisting><![CDATA[
-create virtrdf:DefaultQuadMap as
-graph rdfdf:default-iid-nonblank (DB.DBA.RDF_QUAD.G)
-subject rdfdf:default-iid (DB.DBA.RDF_QUAD.S)
-predicate rdfdf:default-iid-nonblank (DB.DBA.RDF_QUAD.P)
-object rdfdf:default (DB.DBA.RDF_QUAD.O)
-]]></programlisting>
-<para>
-IRI classes from <emphasis>rdfdf:...</emphasis> namespace are also reserved.
-</para>
-</sect4>
-<sect4 id="rdfviewgroupingmappatterns"><title>Grouping Map Patterns</title>
-<para>
-The previous example actually contains three map patterns, not two.
-The name <emphasis>virtrdf:SysUsers</emphasis> refers to a "<emphasis>group map pattern</emphasis>" that does not define any real transformation of relational data into RDF but helps organize quad map patterns into a tree.
-Group may contain both quad map patterns and other groups.
-A group can be manipulated as a whole, e.g. <emphasis>drop quad map virtrdf:SysUsers</emphasis> will remove all three map patterns.
-</para>
-</sect4>
-</sect3>
-
-<sect3 id="rdfviewconfiguringrdfstorages"><title>Configuring RDF Storages</title>
-<para>
-"<emphasis>Quad Storage</emphasis>" is a named set of quad map patterns.
-The declaration <emphasis>define input:storage storage-name</emphasis> states that a SPARQL query will be executed using only quad patterns of the given quad storage.
-Declarations of IRI classes, literal classes and quad patterns are shared between all quad storages of an RDF meta schema but every quad storage contains only a subset of all available quad patterns.
-Two quad storages are always defined:
-</para>
-<itemizedlist mark="bullet" spacing="compact">
-<listitem>A <emphasis>virtrdf:default</emphasis> one usually consists of everything (all user-relational mappings plus <emphasis>virtrdf:DefaultQuadMap</emphasis> for "native-form" quads from <emphasis>DB.DBA.RDF_QUAD</emphasis>)
-</listitem><listitem>A <emphasis>virtrdf:empty</emphasis> storage refers solely to <emphasis>DB.DBA.RDF_QUAD</emphasis> and can not be altered.
-</listitem></itemizedlist>
-<para>
-Three statements for manipulating storages are
-</para>
-<itemizedlist mark="number" spacing="compact">
-<listitem><emphasis>create quad storage storage-name { quad-map-decls } .</emphasis>
-</listitem><listitem><emphasis>alter quad storage storage-name { quad-map-decls-or-drops } .</emphasis>
-</listitem><listitem><emphasis>drop quad storage storage-name . </emphasis>
-</listitem></itemizedlist>
-<para>
-A map pattern can be created only as a part of <emphasis>create quad storage</emphasis> or <emphasis>alter quad storage</emphasis> statement, so initially it is used by exactly one storage.
-It can be imported to some other storage using directive <emphasis>create map-id using storage source-storage</emphasis>. E.g., declarations of many storages create <emphasis>virtrdf:DefaultQuadMap</emphasis> using storage <emphasis>virtrdf:DefaultQuadStorage</emphasis>.
-</para><para>
-Only a "top-level" quad map pattern (standalone or a whole group with descendants) can be imported, member of a group can not.
-The import directive also can not be a part of some group declaration.
-</para><para>
-The directive <emphasis>drop quad map map-name</emphasis> removes a map from one storage when it appears inside <emphasis>alter quad storage</emphasis> statement.
-Otherwise it removes the map from all storages.
-There exists garbage collection for quad map patterns, so any unused map is immediately deleted.
-A group is deleted with all its descendants.
-</para>
-</sect3>
-<sect3 id="rdfviewtranslationofpatterns"><title>Translation Of SPARQL Triple Patterns To Quad Map Patterns</title>
-<para>
-When a SPARQL query is compiled into SQL using a quad storage, every triple pattern should become a subquery that retrieves data from relational tables.
-This subquery is an <emphasis>UNION ALL</emphasis> of joins generated from appropriate quad map patterns.
-The complete SQL query is composed from these basic subqueries.
-Thus the first operation of the SQL generation for a triple pattern is searching for quad map patterns that may in principle produce triples that match the triple pattern.
-</para><para>
-The more restrictions contained in the triple pattern the fewer quad map patterns will be used.
-A triple pattern <emphasis>graph ?g { ?s ?p ?o }</emphasis> is common enough to invoke all data transformations of the storage.
-A triple pattern <emphasis>graph <g> { ?s <p> <o> }</emphasis> will usually intersect with the range of only one quad map.
-Sometimes it is possible to prove that the storage can not contain any data that matches the given triple pattern, hence zero number of members of <emphasis>UNION ALL</emphasis> will result in constantly empty result-set.
-</para>
-<para>The search for quad maps for a given pair of triple pattern and quad map storage is quite simple.
-The storage is treated as a tree of map patterns where quad map patterns are leafs, grouping patterns are inner nodes and the whole storage is also treated as a grouping pattern that specify no fields and contains all top-level map patterns of the storage.
-</para>
-<para>
-The tree is traversed from the root, left to right, non-leaf vertex are checked before their children.
-The check of a vertex consists of up to four field checks, for G, S, P and O.
-Every field check compares the field definition in the vertex and the corresponding field in the triple pattern, G and G, S and S and so on.
-Note that a non-leaf vertex defines less than four of its fields, e.g., the root vertex does not define any of its fields and top-level <emphasis>graph map { ... }</emphasis> defines only graph.
-Checks are performed only for defined fields and return one of three values: "failed", "passed", "full match", according to the following rules:
-</para>
-<table><title>Matching Triple Field and Vertex Field</title>
-<tgroup cols="3">
-<thead><row>
-<entry>Field of vertex</entry><entry>Field in triple pattern</entry><entry>Result</entry>
-</row></thead>
-<tbody>
-<row><entry>constant</entry><entry>same constant</entry><entry>full match</entry></row>
-<row><entry>constant</entry><entry>different constant</entry><entry>failed</entry></row>
-<row><entry>constant</entry><entry>variable of same type</entry><entry>passed</entry></row>
-<row><entry>constant</entry><entry>variable of different type</entry><entry>failed</entry></row>
-<row><entry>quad map value</entry><entry>constant of same type</entry><entry>full match</entry></row>
-<row><entry>quad map value</entry><entry>constant of different type</entry><entry>failed</entry></row>
-<row><entry>quad map value of type X</entry><entry>variable, X or subtype of X</entry><entry>full match</entry></row>
-<row><entry>quad map value of type X</entry><entry>variable, supertype of X</entry><entry>passed</entry></row>
-<row><entry>quad map value of type X</entry><entry>variable, type does not intersect with X</entry><entry>failed</entry></row>
-</tbody>
-</tgroup>
-</table>
-<para>
-If any of the checks fails, the vertex and all its children are excluded from the rest of processing.
-Otherwise, if all four fields are defined for the quad map pattern, the map is added to the list of matching map patterns.
-The difference between "passed" and "full match" is significant only if the map is declared with <emphasis>option (exclusive)</emphasis>
-If all performed checks return "full match" and <emphasis>option (exclusive)</emphasis> is set then the traverse of the tree is stopped as soon as all children of the vertex are traversed.
-The most typical use of this option is when the application developer is sure that all triples of a graph belong to his application and they come from his own quad map patterns, not from <emphasis>DB.DBA.RDF_QUAD</emphasis>.
-This is to prevent the SPARQL compiler from generating redundant subqueries accessing <emphasis>DB.DBA.RDF_QUAD</emphasis>.
-The declaration may look like
-</para>
-<programlisting><![CDATA[
-create quad storage <mystorage>
-  {
-    graph <mygraph> option (exclusive) { . . . }
-    create virtrdf:DefaultQuadMap
-      using storage virtrdf:DefaultQuadStorage .
-  }
-]]></programlisting>
-<para>
-Exclusive patterns make the order of declarations important, because an exclusive declaration may "throw a shadow" on declarations after it.
-Consider a database that have a special table RDF_TYPE that caches all RDF types of all subjects in all graphs.
-Consider two declarations: all triples from graph <emphasis><http://myhost/sys></emphasis> and all triples with <emphasis>rdf:type</emphasis> predicate, both exclusive:
-</para>
-<programlisting><![CDATA[
-graph <http://myhost/sys> option (exclusive)
-  {
-    . . . # mapping of DB.DBA.SYS_USERS as in previous examples.
-  }
-graph rdfdf:default-iid-nonblank (DB.DBA.RDF_TYPE.G)
-subject rdfdf:default-iid (DB.DBA.RDF_TYPE.S)
-predicate rdf:type
-object rdfdf:default (DB.DBA.RDF_TYPE.O)
-option (exclusive)
-]]></programlisting>
-<para>
-The order of these declarations dictates that triple pattern
-</para>
-<programlisting><![CDATA[
-graph <http://myhost/sys> {?s rdf:type ?o}
-]]></programlisting>
-<para>
-is compiled using only quad map patterns of the graph declaration, ignoring second declaration (and of course ignoring default mapping rule, if any).
-An explicit <emphasis>option (order N)</emphasis> at the end of quad map pattern will tweak the priority.
-By default, order will grow from 1000 for the first declaration in the statement to 1999 for the last, explicit configuration is especially useful to make order persistent to <emphasis>alter storage</emphasis> statements.
-</para>
-<para>
-The <emphasis>option (exclusive)</emphasis> trick is ugly, low-level and prone to cause compilation errors after altering storage declarations.
-When misused, it is as bad as "red cut" in PROLOG, but one must use this trick to build scalable storages.
-</para>
-<para>The <emphasis>option (exclusive)</emphasis> helps the SPARQL compiler to prepare better SQL queries, but sometimes it is "too exclusive". For instance, if a grouping quad map pattern specify only quad map value for graph and no other fields then making it exclusive prohibits the use of all declarations of the storage after that one. Sometimes it is better to notify compiler that quads made by the given quad map pattern are supposed to be different from all quads made by declarations listed after the given one.</para>
-
-<para>Consider an application that exports users' personal data
-as graphs whose IRIs looks like
-<emphasis>http://www.example.com/DAV/home/</emphasis>username<emphasis>/RDF/personal/</emphasis>;
-the application makes a query and a triple pattern is proven to be
-restrictive enough to filter out all quads that are not similar to
-quads generated by the given quad map pattern (say, the graph is
-constant
-<emphasis>http://www.example.com/DAV/home/JohnSmith/RDF/personal/</emphasis>). The
-application do not hope to find any quads that match the pattern but
-made by other applications, because graphs named like in the pattern
-are supposed to be solely for this single purpose; if, say,
-DB.DBA.RDF_QUAD occasionally contains some quads with graph equal to
-<emphasis>http://www.example.com/DAV/home/JohnSmith/RDF/personal/</emphasis>
-then they can be ignored.</para>
-
-<para>Under this circumstances, the quad map pattern may have <emphasis>option (soft exclusive)</emphasis>. That grants a permission to the compiler to ignore rest of storage as soon as it is proven that the triple pattern can not access quads that does not match the pattern. So if that is proven then the pattern is exclusive and it makes the query faster; when unsure, the compiler work like there is no option at all.</para>
-
-
-<note><para>The <emphasis>option (exclusive)</emphasis> can be used as
-a security measure, <emphasis>option (soft exclusive)</emphasis> can
-not. Say, if an financial application exports its data as a single
-graph <emphasis>http://www.example.com/front-office/cash/</emphasis>
-using <emphasis>exclusive</emphasis> then the query that explicitly
-refers to that graph will never access any quads written by the
-attacker into DB.DBA.RDF_QUAD using same graph IRI. The use of
-<emphasis>soft exclusive</emphasis> gives no such protection. From the
-compiler's perspective, the <emphasis>option (soft
-exclusive)</emphasis> is a hint that may be ignored, not an
-unambiguous order.</para></note>
-
-<para>
-There is one exception from the rules described above.
-This exception is for <emphasis>virtrdf:DefaultQuadStorage</emphasis> only.
-If a graph variable of a quad map pattern is not bound and no source graph specified by <emphasis>FROM</emphasis> clauses then quad maps for specific constant graphs are ignored.
-In other words, if a default quad storage contains quad maps for specific graphs then the query in that storage should explicitly specify the graph in order to use a map for graph.
-This rule will not work if the default quad map is removed from the <emphasis>virtrdf:DefaultQuadStorage</emphasis>.
-This rule relates to the default storage itself, not to the containing patterns; copying some or all patterns into other storage will not reproduce there this special effect.
-</para>
-</sect3>
-<sect3 id="rdfviewdescribingsourcerelationaltables"><title>Describing Source Relational Tables</title>
-<para>Quad map patterns of an application usually share a common set of source tables and quad map values of one pattern usually share either a single table or very small number of joined tables.
-Join and filtering conditions are also usually repeated in different patterns.
-It is not necessary to type table descriptions multiple times, they are declare once in the beginning of storage declaration statement and shared between all quad map declarations inside the statement.
-Names of aliases can be used instead of table names in quad map values.
-</para>
-<programlisting><![CDATA[
-FROM DB.DBA.SYS_USERS as user WHERE (^{user.}^.U_IS_ROLE = 0)
-FROM DB.DBA.SYS_USERS as group WHERE (^{group.}^.U_IS_ROLE = 1)
-FROM DB.DBA.SYS_USERS as account
-FROM user as active_user
-  WHERE (^{active_user.}^.U_ACCOUNT_DISABLED = 0)
-FROM DB.DBA.SYS_ROLE_GRANTS as grant
-  WHERE (^{grant.}^.GI_SUPER = ^{account.}^.U_ID)
-  WHERE (^{grant.}^.GI_SUB = ^{group.}^.U_ID)
-  WHERE (^{grant.}^.GI_SUPER = ^{user.}^.U_ID)
-]]></programlisting>
-<para>
-This declares five distinct aliases for two distinct tables, and six filtering conditions.
-Every condition is an SQL expression with placeholders where a reference to the table should be printed.
-The SPARQL compiler will not try to parse texts of these expressions (except dummy search for placeholders), so any logical expressions are acceptable.
-When a quad map pattern declaration refers to some aliases, the <emphasis>WHERE</emphasis> clause of the generated SQL code will contain a conjunction of all distinct texts of "relevant" conditions.
-A condition is relevant if every alias inside the condition is used in some quad map value of the map pattern, either directly or via clause like <emphasis>from user as active_user</emphasis>.
-(<emphasis>user</emphasis> is a "<emphasis>base alias</emphasis>" for <emphasis>active_user</emphasis>).
-</para><para>
-Consider a group of four declarations.
-</para>
-<programlisting><![CDATA[
-graph <http://myhost/sys>
-  {
-    oplsioc:user_iri (active_user.U_ID)
-        a oplsioc:active-user .
-    oplsioc:membership_iri (grant.GI_SUPER, grant.GI_SUB).
-        oplsioc:is_direct
-            grant.GI_DIRECT ;
-        oplsioc:member-e-mail
-            active_user.U_E_MAIL
-               where (^{active_user.}^.U_E_MAIL like 'mailto:%').
-    ldap:account-ref (account.U_NAME)
-        ldap:belongs-to
-            ldap:account-ref (group.U_NAME) option (using grant).
-  }
-]]></programlisting>
-<para>
-The first declaration will extend <emphasis><http://myhost/sys></emphasis> graph with one imaginary triples <emphasis>{ user a oplsioc:active-user }</emphasis> for every account record that is not a role and not disabled.
-The second declaration deals with membership records.
-A membership is a pair of a grantee ("super") and a granted role ("sub") stored as a row in <emphasis>DB.DBA.SYS_ROLE_GRANTS</emphasis>).
-</para><para>
-The second declaration states that every membership has <emphasis>oplsioc:is_direct</emphasis> property with value from <emphasis>GI_DIRECT</emphasis> column of that table (roles may be granted to other roles and users, so permissions are "direct" or "recursive").
-</para><para>
-The third declaration declares <emphasis>oplsioc:member-e-mail</emphasis> property of memberships.
-The value is a literal string from <emphasis>DB.DBA.SYS_USERS.U_E_MAIL</emphasis>, if the grantee is active (not disabled) and is not a role and its e-mail address starts with <emphasis>'mailto:'</emphasis>.
-The join between <emphasis>DB.DBA.SYS_ROLE_GRANTS</emphasis> and <emphasis>DB.DBA.SYS_USERS</emphasis> is made by equality <emphasis>(GI_SUPER = U_ID)</emphasis> because the alias <emphasis>active_user</emphasis> in the declaration "inherits" all conditions specified for <emphasis>user</emphasis>.
-In addition, the SPARQL compiler will add one more condition to check if the <emphasis>U_E_MAIL</emphasis> is not null because the NULL value is not a valid object and it knows that <emphasis>U_E_MAIL</emphasis> is not declared as <emphasis>NOT NULL</emphasis>.
-</para><para>
-The last declaration contains an <emphasis>option</emphasis> clause.
-As usual, this indicates that the basic functionality is good for many tasks but not for all.
-In this declaration, the <emphasis>ldap:belongs-to</emphasis> property establishes a relation between grantee (subject) and a granted role (object).
-Both subject and object IRIs are based on account name, <emphasis>DB.DBA.SYS_USERS.U_NAME</emphasis>, so the quad map pattern contains two references to different aliases of <emphasis>DB.DBA.SYS_USERS</emphasis> but no alias for <emphasis>DB.DBA.SYS_ROLE_GRANTS</emphasis>.
-Hence the declaration could produce a triple for every row of the Cartesian product of the <emphasis>DB.DBA.SYS_USERS</emphasis>.
-To fix the problem, <emphasis>option (using alias-name)</emphasis> tells the compiler to process the alias-name as if it's used in some quad map value of the pattern.
-</para><para>
-It is an error to use an alias only in <emphasis>where</emphasis> clause of the quad map pattern but neither in values or in <emphasis>option (using alias-name)</emphasis>.
-To detect more typos, an alias used in quad map values can not appear in <emphasis>option (using alias-name)</emphasis> clause.
-</para>
-</sect3>
-<sect3 id="rdfviewiriusingfunction"><title>Function-Based IRI Classes</title>
-<para>Most of IRI classes can be declared by a sprintf format string, but sophisticated cases may require calculations, not only printing the string. <emphasis>create IRI class using function</emphasis> allows the application transform relational values to IRIs by any custom routines.</para>
-<para>
-Let us extend the previous example about users and groups by a new class for grantees. Both users and groups are grantees and we have defined two IRI classes for them. Classes <emphasis>oplsioc:user_iri</emphasis> and <emphasis>oplsioc:group_iri</emphasis> work fine for quad maps of <emphasis>U_ID</emphasis> if and only if the value of <emphasis>U_IS_ROLE</emphasis> is accordingly restricted to FALSE or TRUE, otherwise one may occasionally generate, say, user IRI for a group.
-To create and parse IRIs that correspond to any U_IDs, two functions should be created:
-</para>
-<programlisting><![CDATA[
-create function DB.DBA.GRANTEE_URI (in id integer)
-returns varchar
-{
-  declare isrole integer;
-  isrole := coalesce ((SELECT top 1 U_IS_ROLE
-      FROM DB.DBA.SYS_USERS WHERE U_ID = id ) );
-  if (isrole is null)
-    return NULL;
-  else if (isrole)
-    return sprintf ('http://%s/sys/group?id=%d', id);
-  else
-    return sprintf ('http://%s/sys/user?id=%d', id);
-};
-]]></programlisting>
-<programlisting><![CDATA[
-create function DB.DBA.GRANTEE_URI_INVERSE (in id_iri varchar)
-returns integer
-{
-  declare parts any;
-  parts := sprintf_inverse (id_iri,
-      'http://myhost/sys/user?id=%d', 1 );
-  if (parts is not null)
-    {
-      if (exists (SELECT top 1 1 FROM DB.DBA.SYS_USERS
-          WHERE U_ID = parts[0] and not U_IS_ROLE ) )
-        return parts[0];
-    }
-  parts := sprintf_inverse (id_iri,
-      'http://myhost/sys/group?id=%d', 1 );
-  if (parts is not null)
-    {
-      if (exists (SELECT top 1 1 FROM DB.DBA.SYS_USERS
-          WHERE U_ID = parts[0] and U_IS_ROLE ) )
-        return parts[0];
-    }
-  return NULL;
-};
-]]></programlisting>
-<para>These functions may be more useful if the SPARQL web service endpoint is allowed to use them:</para>
-<programlisting><![CDATA[
-grant execute on DB.DBA.GRANTEE_URI to "SPARQL";
-grant execute on DB.DBA.GRANTEE_URI_INVERSE to "SPARQL";
-]]></programlisting>
-<para>
-The next declaration creates an IRI class based on these two functions:
-</para>
-<programlisting><![CDATA[
-create iri class oplsioc:grantee_iri using
-  function DB.DBA.GRANTEE_URI (in id integer)
-    returns varchar,
-  function DB.DBA.GRANTEE_URI_INVERSE (in id_iri varchar)
-    returns integer .
-]]></programlisting>
-<para>
-In common case, IRI class declaration contains an N-array function that composes IRIs and N inverse functions that gets an IRI as an argument and extracts the Nth SQL value.
-IRI composing function should silently return NULL on incorrect arguments instead of error signal.
-Inverse functions should return NULL if the argument has an incorrect type or value.
-</para>
-<para>
-It is possible to specify only composing function without any of inverse functions. However <emphasis>option (bijection)</emphasis> can not be used in that case, obviously.
-</para>
-</sect3>
-<sect3 id="rdfconnvarsiniriclasses"><title>Connection Variables in IRI Classes</title>
-<para>Writing function-based IRI class is overkill when the IRI can in principle be made by a <link linkend="fn_sprintf_iri"><function>sprintf_iri</function></link> but the format should contain some context-specific data, such as host name used for the <link linked="rdfdynamiclocal">dynamic renaming of local IRIs</link>.
-Format strings offer a special syntax for that cases.
-<emphasis>%{varname}U</emphasis> acts as <emphasis>%U</emphasis> but the function <link linkend="fn_sprintf"><function>sprintf</function></link> will take the value from client connection variable <emphasis>varname</emphasis>, not from list of arguments.
-Similarly, <link linkend="fn_sprintf_inverse"><function>sprintf_inverse</function></link> will not return fragment that match to <emphasis>%{varname}U</emphasis> in the vector of other fragments; instead it will get the value from connection environment and ensure that it matches the fragment of input; mismatch between printed and actual value of variable will means that the whole string do not match the format.</para>
-<para>SPARQL optimizer knows about this formatting feature and sometimes it makes more deductions from occurrence of <emphasis>%{varname}U</emphasis> than from occurrence of plain <emphasis>%U</emphasis>, so this notation may be used in <emphasis>option ( returns ...)</emphasis> when appropriate.
-Of course, the optimizer has no access to the actual value of connection variable because it may vary from run to run or may change between the compilation and the run, but the value is supposed to be persistent during any single query run so <emphasis>%{myvariable}U</emphasis> in one place is equal to <emphasis>%{myvariable}U</emphasis> in other.</para>
-<para>Connection variables are set by <link linkend="fn_connection_set"><function>connection_set</function></link> and some of them have default values that are used if not overridden by application:</para>
-<itemizedlist mark="bullet" spacing="compact">
-<listitem><emphasis>URIQADefaultHost</emphasis> is for default host as it is specified in Virtuoso configuration file.
-Note, however, that it will be escaped when printed so if it contains colon and port number then the colon is escaped.
-In addition, there are special variables that match dynamic renaming of local IRIs more accurately.</listitem>
-<listitem><emphasis>WSHost</emphasis> is for host and port as it is used by current client connection for dynamic renaming.
-The colon before port will be escaped.</listitem>
-<listitem><emphasis>WSHostName</emphasis> is for host name only, without port, as it is used by current client connection for dynamic renaming.</listitem>
-<listitem><emphasis>WSHostPort</emphasis> is for port part of host IRI. That is string, not integer. The only real use of the variable is in formats like <emphasis>http://%{WSHostName}U:%{WSHostPort}U/...</emphasis>.</listitem>
-</itemizedlist>
-<para>It is inconvenient to write different format strings for
-different cases. Two most common policies are different host names
-for default HTTP port of a publicly available service and different
-non-default ports for one or more host names of an intranet
-installation; these two approaches are almost never used in a mix. So
-declaration of IRI classes may use shorthand
-<emphasis>^{DynamicLocalFormat}^</emphasis> in format strings that is
-expanded either to <emphasis>http://%{WSHost}U</emphasis> or to
-<emphasis>http://%{WSHostName}U:%{WSHostPort}U/...</emphasis>,
-depending on absence or presence of port number in the value of
-<emphasis>DefaultHost</emphasis> parameter of
-<emphasis>URIQA</emphasis> section of configuration file.</para>
-<note><para><emphasis>^{DynamicLocalFormat}^</emphasis> is for IRI class declarations only and is not expanded in any other place, so it is useful sometimes to create an IRI class with empty argument list in order to get "almost constant" IRIs calculated without writing special procedures.</para></note>
-</sect3>
-<sect3 id="rdfviewbijandreturns"><title>Lookup Optimization -- BIJECTION and RETURNS Options</title>
-<para>
-There is one subtle problem with IRI class declarations.
-To get benefit from a relational index, SPARQL optimizer should compose equality between table column and some known SQL value, not between return value of IRI class and a known composed IRI.
-In addition, redundant calculations of IRIs takes time.
-To enable this optimization, an IRI class declaration should end with <emphasis>option (bijection)</emphasis> clause. For some simple format strings the compiler may recognize the bijection automatically but an explicit declaration is always a good idea.
-</para>
-<note><title>Note:</title>
-<para>
-See also: <ulink url="http://en.wikipedia.org/wiki/One-to-one_correspondence">Wikipedia - Bijection</ulink>.
-In mathematics, a bijection, or a bijective function is a function f from a set X to a set Y such that,
-for every y in Y, there is exactly one x in X such that f(x) = y.
-</para>
-<para>
-Alternatively, f is bijective if it is a one-to-one correspondence between those sets; i.e.,
-both one-to-one (injective) and onto (surjective).
-</para>
-</note>
-<para>
-The SPARQL compiler may produce big amounts of SQL code when the query contains equality of two calculated IRIs and these IRIs may come from many different IRI classes.
-It is possible to provide hints that will let the compiler check if two IRI classes form disjoint sets of possible IRI values. The more disjoint sets are found the less possible combinations remain so the resulting SQL query will contain fewer unions of joins.
-The SPARQL compiler can prove some properties of sprintf format strings. E.g., it can prove that set of all strings printed by "http://example.com/item%d" and the set of strings printed by "http://example.com/item%d/" are disjoint.
-It can prove some more complicated statements about unions and intersections of sets of strings.
-The IRI or literal class declaration may contain <emphasis>option (returns ...)</emphasis> clause that will specify one or more sprintf patterns that cover the set of generated values.
-Consider a better version of IRI class declaration listed above:
-</para>
-<programlisting><![CDATA[
-create iri class oplsioc:grantee_iri using
-  function DB.DBA.GRANTEE_URI (in id integer)
-    returns varchar,
-  function DB.DBA.GRANTEE_URI_INVERSE (in id_iri varchar)
-    returns integer
-  option ( bijection,
-    returns "http://myhost/sys/group?id=%d"
-    union   "http://myhost/sys/user?id=%d" ) .
-]]></programlisting>
-<para>
-It is very important to keep IRI classes easily distinguishable by the text of IRI string and easy to parse.
-</para>
-<itemizedlist mark="bullet" spacing="compact">
-<listitem>Format <emphasis>%U</emphasis> is better than <emphasis>%s</emphasis>, especially in the middle of IRI, because the <emphasis>%U</emphasis> fragment can not contain characters like "/" or "="; one may prove that <emphasis>/%U/</emphasis> and <emphasis>/abra%d/cadabra/</emphasis> are disjoint but <emphasis>/%s/</emphasis> and <emphasis>/abra%d/cadabra/</emphasis> are not disjoint.
-</listitem><listitem>It is better when the variable part like <emphasis>%U</emphasis> or <emphasis>%d</emphasis> is placed between characters that may not occur in the <emphasis>%U</emphasis> or <emphasis>%d</emphasis> output, i.e. <emphasis>%U</emphasis> is placed between "/", "&" or "=" and <emphasis>%d</emphasis> is placed between non-digits; <emphasis>order_line_%d</emphasis> is better than <emphasis>order-line-%d</emphasis> because minus may be part of <emphasis>%d</emphasis> output.
-</listitem><listitem>End-of-line is treated as a special character, so placing <emphasis>%U</emphasis> or <emphasis>%d</emphasis> between "/" and end of line is as good as placing it between two "/".
-</listitem></itemizedlist>
-<para>
-In some cases <emphasis>option (returns ...)</emphasis> can be used for IRI classes that are declared using sprintf format, but actual data have more specific format.
-Consider a literal class declaration that is used to output strings and the application knows that all these strings are ISBN numbers:
-</para>
-<programlisting><![CDATA[
-create literal class example:isbn_ref "%s" (in isbn varchar not null)
-  option ( bijection, returns "%u-%u-%u-%u" union "%u-%u-%u-X" )
-]]></programlisting>
-<para>
-Sometimes interoperability restrictions will force you to violate these rules but please try to follow them as often as possible.
-</para>
-</sect3>
-<sect3 id="rdfviewsubclasses"><title>Join Optimization -- Declaring IRI Subclasses</title>
-<para>
-Additional problem appears when the equality is between two IRIs of two different IRI classes.
-Even if both of them are bijections, the compiler does not know if these IRI classes behave identically on the intersection of their domains.
-To let the optimizer know this fact, one IRI class can be explicitly declared as a subclass of another:
-</para>
-<programlisting><![CDATA[
-make oplsioc:user_iri subclass of oplsioc:grantee_iri .
-make oplsioc:group_iri subclass of oplsioc:grantee_iri .
-]]></programlisting>
-<para>
-The SPARQL compiler can not check the validity of a subclass declaration.
-The developer should carefully test functions to ensure that transformations are really subclasses, as well as to ensure that functions of an IRI class declarations are really inverse to each other.
-</para><para>
-When declaring that a table's primary key is converted into a IRI according to one IRI class, one usually declares that all foreign keys referring to this class also get converted into an IRI as per this same class, or subclass of same class.
-</para><para>
-Subclasses can be declared for literal classes as well as for IRI classes, but this case is rare. The reason is that most of literals are made by identity literal classes that are disjoint to each other even if values may be equal in SQL sense, such as <emphasis>"2"</emphasis> of type <emphasis>xsd:integer</emphasis> and <emphasis>"2.0"</emphasis> of type <emphasis>xsd:double</emphasis>.
-</para>
-</sect3>
-<sect3 id="rdfmetadatarecovery"><title>RDF Metadata Maintenance and Recovery</title>
-   <para>
-This section refers to checking and backing up RDF view and storage declarations only. The checks and backup/restore do not affect physical quads, relational schema or tables or data therein. For general backup and restore, see server administration.
-     To detect and fix automatically most popular sorts of RDF metadata corruption use <link linkend="fn_rdf_audit_metadata"><function>DB.DBA.RDF_AUDIT_METADATA</function></link>.
-It is also possible to backup RDF data by
-    <link linkend="fn_rdf_backup_metadata"><function>DB.DBA.RDF_BACKUP_METADATA</function></link>
-and restore the saved state later by using
-    <link linkend="fn_rdf_restore_metadata"><function>DB.DBA.RDF_RESTORE_METADATA</function></link>.
-It is convenient to make a backup before any modification of quad storages, quad map patterns or IRI classes, especially during debugging new RDF Views.
-   </para>
-<note><para>In SQL, adding a new view can not break anything. This is because SQL lacks the ability of querying "everything" so data sources are always specified. This is not true for SPARQL, so please treat <emphasis>any</emphasis> metadata manipulation as potentially destructive operation. If an RDF storage is supposed to be used by more than one application then these applications should be tested together, not one after other, and they should be installed/upgraded on live database in the very same order as they were installed/upgraded on instrumental machine during testing. Always remember that these applications share RDF tables so they may interfere.</para></note>
-</sect3>
-<sect3 id="splitrdfview"><title>Split RDF View</title>
-<para>RDF View can be created by two or more "sparql alter storage" statements. In each statement
-can be created one quad map that contains mappings for half or a third of all tables. Quad maps
-created should have distinct names but may mention same graph. The important fact is that if the
-RDF View in question is exclusive for a graph then only the last quad map should be exclusive but
-all previous should not have this option. This is because if a map is exclusive on a graph the rest
-of maps on that graph will be silently ignored.</para>
-<para>The example below shows a sample part of the Virtuoso eCRM Views code,
-where the RDF view is split in two parts: with quad map virtrdf:ecrmDemo1 and with
-quad map virtrdf:ecrmDemo2:</para>
-<programlisting><![CDATA[
-SPARQL
-prefix ecrm: <http://demo.openlinksw.com/schemas/ecrm#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix cal: <http://www.w3.org/2002/12/cal/ical#>
-prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-prefix product: <http://www.swop-project.eu/ontologies/pmo/product.owl#>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-drop quad map virtrdf:ecrmDemo1 .
-;
-
-SPARQL
-prefix ecrm: <http://demo.openlinksw.com/schemas/ecrm#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix cal: <http://www.w3.org/2002/12/cal/ical#>
-prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-prefix product: <http://www.swop-project.eu/ontologies/pmo/product.owl#>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-drop quad map virtrdf:ecrmDemo2 .
-;
-
-...
-
-SPARQL
-prefix ecrm: <http://demo.openlinksw.com/schemas/ecrm#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix cal: <http://www.w3.org/2002/12/cal/ical#>
-prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-prefix product: <http://www.swop-project.eu/ontologies/pmo/product.owl#>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-alter quad storage virtrdf:DefaultQuadStorage
-FROM eCRM.DBA.SFA_SALES_QUOTA_VIEW2 as sales_quotas
-FROM eCRM.DBA.SFA_COMPANIES_VIEW2 as companies
-FROM eCRM.DBA.SFA_COMPANIES as companies_table text literal companies_table.DESCRIPTION of (companies.DESCRIPTION)
-FROM eCRM.DBA.SFA_CONTACTS_VIEW2 as contacts
-FROM eCRM.DBA.SFA_CONTACTS as contacts_table text literal contacts_table.NAME_FIRST of (contacts.NAME_FIRST)
-FROM eCRM.DBA.SFA_EMPLOYMENTS_VIEW2 as employments
-FROM eCRM.DBA.SFA_LEADS_VIEW2 as leads
-FROM eCRM.DBA.SFA_LEADS as leads_table text literal leads_table.SUBJECT of (leads.SUBJECT)
-FROM eCRM.DBA.SFA_OPPORTUNITIES_VIEW2 as opportunities
-FROM eCRM.DBA.SFA_OPPORTUNITIES as opportunities_table text literal opportunities_table.OPPORTUNITY_NAME of (opportunities.OPPORTUNITY_NAME)
-FROM eCRM.DBA.SFA_ACTIVITIES as activities
-FROM eCRM.DBA.SFA_MAIL_MESSAGES as messages
-FROM eCRM.DBA.SFA_DOCUMENTS_VIEW2 as documents
-FROM eCRM.DBA.SFA_INFLUENCERS_VIEW2 as influencers
-FROM eCRM.DBA.SFA_TEAMS_VIEW2 as teams
-FROM eCRM.DBA.SFA_NOTES_VIEW2 as notes
-FROM eCRM.DBA.SFA_NOTES as notes_table text literal notes_table.DESCRIPTION of (notes.DESCRIPTION)
-FROM eCRM.DBA.SFA_COMPETITORS_VIEW2 as competitors
-FROM eCRM.DBA.SFA_ISSUES_VIEW2 as issues
-FROM eCRM.DBA.SFA_CUSTOM_FIELD_DEFS_VIEW2 as custom_field_defs
-FROM eCRM.DBA.SFA_CUSTOM_FIELDS_VIEW2 as custom_fields
-FROM eCRM.DBA.SFA_CASES_VIEW2 as cases
-FROM eCRM.DBA.SFA_CASES as cases_table text literal cases_table.SUMMARY of (cases.SUMMARY)
-FROM eCRM.DBA.SFA_ORDERS_VIEW2 as orders
-FROM eCRM.DBA.SFA_ORDERS as orders_table text literal orders_table.EMAIL of (orders.EMAIL)
-FROM eCRM.DBA.SFA_ORDER_ITEMS_VIEW2 as order_items
-FROM eCRM.DBA.PM_CATEGORIES_VIEW2 as categories
-FROM eCRM.DBA.PM_PRODUCT_ATTRIBUTE_DEFS_VIEW2 as product_attribute_defs
-FROM eCRM.DBA.PM_PRODUCTS_VIEW2 as products
-FROM eCRM.DBA.PM_PRODUCTS as products_table text literal products_table.DESCRIPTION of (products.DESCRIPTION)
-FROM eCRM.DBA.PM_PRODUCT_ATTRIBUTES_VIEW2 as product_attributes
-FROM eCRM.DBA.PM_CATALOGS_VIEW2 as catalogs
-FROM eCRM.DBA.PM_CATALOG_PRODUCTS_VIEW2 as catalog_products
-FROM eCRM.DBA.XSYS_MODULES as modules
-FROM eCRM.DBA.XSYS_REGISTRY as registries
-FROM eCRM.DBA.XSYS_ORGANIZATIONS_DATA as organizations_data
-FROM eCRM.DBA.XSYS_MESSAGES as xsysmessages
-FROM eCRM.DBA.XSYS_COUNTRIES_VIEW2 as countries
-FROM eCRM.DBA.XSYS_PROVINCES_VIEW2 as provinces
-FROM eCRM.DBA.XSYS_TIMEZONES as timezones
-FROM eCRM.DBA.XSYS_MIME_TYPES as mimetypes
-FROM eCRM.DBA.XSYS_MIME_EXTENSIONS as mimeexts
-FROM eCRM.DBA.XSYS_CNAMES as cnames
-FROM eCRM.DBA.XSYS_QUOTAS as quotas
-FROM eCRM.DBA.XSYS_ROLES as roles
-FROM eCRM.DBA.XSYS_ACCOUNTS as accounts
-FROM eCRM.DBA.XSYS_USERDATA as userdatas
-FROM eCRM.DBA.XSYS_GROUPDATA as groupdatas
-FROM eCRM.DBA.XSYS_MEMBERS as members
-FROM eCRM.DBA.XSYS_SESSIONS_DATA as sessionsdatas
-FROM eCRM.DBA.XSYS_SESSION_DATA as sessiondatas
-FROM eCRM.DBA.XSYS_LIST_MEMBERS_DEFS as list_members_defs
-FROM eCRM.DBA.XSYS_CLASSES as classes
-FROM eCRM.DBA.XSYS_ORG_CLASSES as org_classes
-FROM eCRM.DBA.XSYS_CLASS_METHODS as class_methods
-FROM eCRM.DBA.XSYS_CLASS_VIEWS as class_views
-FROM eCRM.DBA.XSYS_ROLE_PRIVILEGES as role_priveleges
-FROM eCRM.DBA.XSYS_USER_PRIVILEGES as user_priveleges
-FROM eCRM.DBA.XSYS_HISTORY as history
-FROM eCRM.DBA.XSYS_USERS as xsys_users
-FROM eCRM.DBA.AP_PROCESSES_VIEW2 as ap_processes
-FROM eCRM.DBA.AP_RULES_VIEW2 as ap_rules
-FROM eCRM.DBA.AP_QUEUE as ap_queues
-WHERE (^{companies.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
-WHERE (^{contacts.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
-WHERE (^{leads.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
-WHERE (^{products.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
-WHERE (^{orders.}^.SHIP_COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
-WHERE (^{leads_table.}^.FREETEXT_ID = ^{leads.}^.FREETEXT_ID)
-WHERE (^{contacts_table.}^.FREETEXT_ID = ^{contacts.}^.FREETEXT_ID)
-WHERE (^{companies_table.}^.FREETEXT_ID = ^{companies.}^.FREETEXT_ID)
-WHERE (^{opportunities_table.}^.FREETEXT_ID = ^{opportunities.}^.FREETEXT_ID)
-WHERE (^{cases_table.}^.FREETEXT_ID = ^{cases.}^.FREETEXT_ID)
-WHERE (^{notes_table.}^.FREETEXT_ID = ^{notes.}^.FREETEXT_ID)
-WHERE (^{orders_table.}^.FREETEXT_ID = ^{orders.}^.FREETEXT_ID)
-WHERE (^{products_table.}^.FREETEXT_ID = ^{products.}^.FREETEXT_ID)
-{
-        create virtrdf:ecrmDemo1 as graph iri ("http://^{URIQADefaultHost}^/ecrm") option (order 1501)
-        {
-            ecrm:Country (countries.COUNTRY_NAME)
-                a ecrm:Country
-                    as virtrdf:Country-Countrys2 ;
-                a geo:SpatialThing
-                    as virtrdf:Country-Countrys ;
-                owl:sameAs ecrm:dbpedia_iri (countries.COUNTRY_NAME) ;
-                ecrm:countryID countries.COUNTRY_ID
-                        as virtrdf:Country-COUNTRY_ID ;
-                ecrm:countryID3 countries.COUNTRY_ID3
-                        as virtrdf:Country-COUNTRY_ID3 ;
-                ecrm:isoCode countries.ISO_CODE
-                        as virtrdf:Country-ISO_CODE ;
-                ecrm:countryName countries.COUNTRY_NAME
-                        as virtrdf:Country-COUNTRY_NAME .
-
-            ecrm:Country (countries.COUNTRY_NAME)
-                        ecrm:has_province
-            ecrm:Province (provinces.COUNTRY_ID, provinces.PROVINCE_NAME) where
-                        (^{provinces.}^.COUNTRY_ID = ^{countries.}^.COUNTRY_ID) as virtrdf:ecrmCountry-has_province .
-
-...
-  } .
-} .
-;
-SPARQL
-prefix ecrm: <http://demo.openlinksw.com/schemas/ecrm#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-prefix cal: <http://www.w3.org/2002/12/cal/ical#>
-prefix product: <http://www.swop-project.eu/ontologies/pmo/product.owl#>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-alter quad storage virtrdf:DefaultQuadStorage
-FROM eCRM.DBA.SFA_SALES_QUOTA_VIEW2 as sales_quotas
-FROM eCRM.DBA.SFA_COMPANIES_VIEW2 as companies
-FROM eCRM.DBA.SFA_COMPANIES as companies_table text literal companies_table.DESCRIPTION of (companies.DESCRIPTION)
-FROM eCRM.DBA.SFA_CONTACTS_VIEW2 as contacts
-FROM eCRM.DBA.SFA_CONTACTS as contacts_table text literal contacts_table.NAME_FIRST of (contacts.NAME_FIRST)
-FROM eCRM.DBA.SFA_EMPLOYMENTS_VIEW2 as employments
-FROM eCRM.DBA.SFA_LEADS_VIEW2 as leads
-FROM eCRM.DBA.SFA_LEADS as leads_table text literal leads_table.SUBJECT of (leads.SUBJECT)
-FROM eCRM.DBA.SFA_OPPORTUNITIES_VIEW2 as opportunities
-FROM eCRM.DBA.SFA_OPPORTUNITIES as opportunities_table text literal opportunities_table.OPPORTUNITY_NAME of (opportunities.OPPORTUNITY_NAME)
-FROM eCRM.DBA.SFA_ACTIVITIES as activities
-FROM eCRM.DBA.SFA_MAIL_MESSAGES as messages
-FROM eCRM.DBA.SFA_DOCUMENTS_VIEW2 as documents
-FROM eCRM.DBA.SFA_INFLUENCERS_VIEW2 as influencers
-FROM eCRM.DBA.SFA_TEAMS_VIEW2 as teams
-FROM eCRM.DBA.SFA_NOTES_VIEW2 as notes
-FROM eCRM.DBA.SFA_NOTES as notes_table text literal notes_table.DESCRIPTION of (notes.DESCRIPTION)
-FROM eCRM.DBA.SFA_COMPETITORS_VIEW2 as competitors
-FROM eCRM.DBA.SFA_ISSUES_VIEW2 as issues
-FROM eCRM.DBA.SFA_CUSTOM_FIELD_DEFS_VIEW2 as custom_field_defs
-FROM eCRM.DBA.SFA_CUSTOM_FIELDS_VIEW2 as custom_fields
-FROM eCRM.DBA.SFA_CASES_VIEW2 as cases
-FROM eCRM.DBA.SFA_CASES as cases_table text literal cases_table.SUMMARY of (cases.SUMMARY)
-FROM eCRM.DBA.SFA_ORDERS_VIEW2 as orders
-FROM eCRM.DBA.SFA_ORDERS as orders_table text literal orders_table.EMAIL of (orders.EMAIL)
-FROM eCRM.DBA.SFA_ORDER_ITEMS_VIEW2 as order_items
-FROM eCRM.DBA.PM_CATEGORIES_VIEW2 as categories
-FROM eCRM.DBA.PM_PRODUCT_ATTRIBUTE_DEFS_VIEW2 as product_attribute_defs
-FROM eCRM.DBA.PM_PRODUCTS_VIEW2 as products
-FROM eCRM.DBA.PM_PRODUCTS as products_table text literal products_table.DESCRIPTION of (products.DESCRIPTION)
-FROM eCRM.DBA.PM_PRODUCT_ATTRIBUTES_VIEW2 as product_attributes
-FROM eCRM.DBA.PM_CATALOGS_VIEW2 as catalogs
-FROM eCRM.DBA.PM_CATALOG_PRODUCTS_VIEW2 as catalog_products
-FROM eCRM.DBA.XSYS_MODULES as modules
-FROM eCRM.DBA.XSYS_REGISTRY as registries
-FROM eCRM.DBA.XSYS_ORGANIZATIONS_DATA as organizations_data
-FROM eCRM.DBA.XSYS_MESSAGES as xsysmessages
-FROM eCRM.DBA.XSYS_COUNTRIES_VIEW2 as countries
-FROM eCRM.DBA.XSYS_PROVINCES_VIEW2 as provinces
-FROM eCRM.DBA.XSYS_TIMEZONES as timezones
-FROM eCRM.DBA.XSYS_MIME_TYPES as mimetypes
-FROM eCRM.DBA.XSYS_MIME_EXTENSIONS as mimeexts
-FROM eCRM.DBA.XSYS_CNAMES as cnames
-FROM eCRM.DBA.XSYS_QUOTAS as quotas
-FROM eCRM.DBA.XSYS_ROLES as roles
-FROM eCRM.DBA.XSYS_ACCOUNTS as accounts
-FROM eCRM.DBA.XSYS_USERDATA as userdatas
-FROM eCRM.DBA.XSYS_GROUPDATA as groupdatas
-FROM eCRM.DBA.XSYS_MEMBERS as members
-FROM eCRM.DBA.XSYS_SESSIONS_DATA as sessionsdatas
-FROM eCRM.DBA.XSYS_SESSION_DATA as sessiondatas
-FROM eCRM.DBA.XSYS_LIST_MEMBERS_DEFS as list_members_defs
-FROM eCRM.DBA.XSYS_CLASSES as classes
-FROM eCRM.DBA.XSYS_ORG_CLASSES as org_classes
-FROM eCRM.DBA.XSYS_CLASS_METHODS as class_methods
-FROM eCRM.DBA.XSYS_CLASS_VIEWS as class_views
-FROM eCRM.DBA.XSYS_ROLE_PRIVILEGES as role_priveleges
-FROM eCRM.DBA.XSYS_USER_PRIVILEGES as user_priveleges
-FROM eCRM.DBA.XSYS_HISTORY as history
-FROM eCRM.DBA.XSYS_USERS as xsys_users
-FROM eCRM.DBA.AP_PROCESSES_VIEW2 as ap_processes
-FROM eCRM.DBA.AP_RULES_VIEW2 as ap_rules
-FROM eCRM.DBA.AP_QUEUE as ap_queues
-WHERE (^{companies.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
-WHERE (^{contacts.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
-WHERE (^{leads.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
-WHERE (^{products.}^.COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
-WHERE (^{orders.}^.SHIP_COUNTRY_NAME = ^{countries.}^.COUNTRY_NAME)
-WHERE (^{leads_table.}^.FREETEXT_ID = ^{leads.}^.FREETEXT_ID)
-WHERE (^{contacts_table.}^.FREETEXT_ID = ^{contacts.}^.FREETEXT_ID)
-WHERE (^{companies_table.}^.FREETEXT_ID = ^{companies.}^.FREETEXT_ID)
-WHERE (^{opportunities_table.}^.FREETEXT_ID = ^{opportunities.}^.FREETEXT_ID)
-WHERE (^{cases_table.}^.FREETEXT_ID = ^{cases.}^.FREETEXT_ID)
-WHERE (^{notes_table.}^.FREETEXT_ID = ^{notes.}^.FREETEXT_ID)
-WHERE (^{orders_table.}^.FREETEXT_ID = ^{orders.}^.FREETEXT_ID)
-WHERE (^{products_table.}^.FREETEXT_ID = ^{products.}^.FREETEXT_ID)
-{
-        create virtrdf:ecrmDemo2 as graph iri ("http://^{URIQADefaultHost}^/ecrm") option (exclusive, order 1502)
-        {
-            ecrm:Order (orders.ORG_ID, orders.ORDER_ID)
-                a ecrm:Order
-                    as virtrdf:Order-Orders ;
-                ecrm:has_ecrm_organization ecrm:OrganizationsData(orders.ORG_ID, organizations_data.DNS_ZONE) where (^{orders.}^.ORG_ID = ^{organizations_data.}^.ORG_ID)
-                        as virtrdf:Order-ORG_ID ;
-                ecrm:owner ecrm:XSys_User(orders.ORG_ID, xsys_users.ACCOUNT_NAME, orders.OWNER_ID)
-                        where (^{orders.}^.OWNER_ID = ^{xsys_users.}^.ACCOUNT_ID and ^{orders.}^.ORG_ID = ^{xsys_users.}^.ORG_ID)
-                        as virtrdf:Order-OWNER_ID ;
-                ecrm:FREETEXT_ID orders.FREETEXT_ID
-                        as virtrdf:Order-FREETEXT_ID ;
-                ecrm:has_company ecrm:Company(orders.COMPANY_NAME, orders.COMPANY_ID, orders.ORG_ID)
-                        as virtrdf:Order-COMPANY_ID ;
-                ecrm:companyName orders.COMPANY_NAME
-                        as virtrdf:Order-COMPANY_NAME ;
-                ecrm:has_contact ecrm:Contact(contacts.NAME_FIRST, contacts.NAME_MIDDLE, contacts.NAME_LAST, orders.CONTACT_ID, orders.ORG_ID)
-                        where (^{orders.}^.CONTACT_ID = ^{contacts.}^.CONTACT_ID and ^{orders.}^.ORG_ID = ^{contacts.}^.ORG_ID)
-                        as virtrdf:Order-CONTACT_ID ;
-                ecrm:contactName orders.CONTACT_NAME
-                        as virtrdf:Order-CONTACT_NAME ;
-                ecrm:orderNo orders.ORDER_NO
-                        as virtrdf:Order-ORDER_NO ;
-                ecrm:shipFirstName orders.SHIP_FNAME
-                        as virtrdf:Order-SHIP_FNAME ;
-                ecrm:shipSecondName orders.SHIP_SNAME
-                        as virtrdf:Order-SHIP_SNAME ;
-                ecrm:phoneNumber orders.PHONE_NUMBER
-                        as virtrdf:Order-PHONE_NUMBER ;
-                ecrm:phoneExtension orders.PHONE_EXTENSION
-                        as virtrdf:Order-PHONE_EXTENSION ;
-                ecrm:email orders.EMAIL
-                        as virtrdf:Order-EMAIL ;
-                ecrm:shipCountry ecrm:Country(orders.SHIP_COUNTRY_NAME)
-                        as virtrdf:Order-SHIP_COUNTRY_NAME ;
-                ecrm:shipCountryCode ecrm:Country (countries.COUNTRY_NAME) where  (^{countries.}^.COUNTRY_NAME = ^{orders.}^.SHIP_COUNTRY_NAME)
-                        as virtrdf:Order-SHIP_COUNTRY_CODE ;
-                ecrm:shipProvince orders.SHIP_PROVINCE
-                        as virtrdf:Order-SHIP_PROVINCE ;
-                ecrm:shipCity orders.SHIP_CITY
-                        as virtrdf:Order-SHIP_CITY ;
-                ecrm:dbpedia_shipCity ecrm:dbpedia_iri (orders.SHIP_CITY)
-                        as virtrdf:Order-SHIP_dbpedia_CITY ;
-                ecrm:shipPostalCode orders.SHIP_POSTAL_CODE
-                        as virtrdf:Order-SHIP_POSTAL_CODE ;
-                ecrm:shipAddress1 orders.SHIP_ADDRESS1
-                        as virtrdf:Order-SHIP_ADDRESS1 ;
-                ecrm:shipAddress2 orders.SHIP_ADDRESS2
-                        as virtrdf:Order-SHIP_ADDRESS2 ;
-                ecrm:salesRep orders.SALESREP
-                        as virtrdf:Order-SALESREP ;
-                ecrm:orderDate orders.ORDER_DATE
-                        as virtrdf:Order-ORDER_DATE ;
-                ecrm:orderValue orders.ORDER_VALUE
-                        as virtrdf:Order-ORDER_VALUE ;
-                ecrm:refund orders.REFUND
-                        as virtrdf:Order-REFUND ;
-                ecrm:year orders.YEAR
-                        as virtrdf:Order-YEAR ;
-                ecrm:month orders.MONTH
-                        as virtrdf:Order-MONTH ;
-                ecrm:quarter orders.QUARTER
-                        as virtrdf:Order-QUARTER ;
-                ecrm:financialYear orders.FINANCIAL_YEAR
-                        as virtrdf:Order-FINANCIAL_YEAR ;
-                ecrm:CONTACT_REL_ID orders.CONTACT_REL_ID
-                        as virtrdf:Order-CONTACT_REL_ID ;
-                ecrm:COMPANY_REL_ID orders.COMPANY_REL_ID
-                        as virtrdf:Order-COMPANY_REL_ID .
-
-...
-        } .
-} .
-;
-
-]]></programlisting>
-</sect3>
-<sect3 id="rdfviewsrcur"><title>RDF views and recursive FK relationships</title>
-  <para>Here is sample example of a script to include an additional table alias for a table:</para>
-<programlisting><![CDATA[
-alter quad storage virtrdf:DefaultQuadStorage
-  :
-  FROM isports_rdf.prs10_isports_rdf.VRef_Call      as Ref_Call_tbl
-  FROM isports_rdf.prs10_isports_rdf.VRef_Call      as Ref_Call_tbl_1
-  :
-{
-  :
-  refcall:ref-call_iri (Ref_Call_tbl.Call_Num) a refcall:Ref-Call as
-virtrdf:ref-call_pk ;
-  :
-  refcall:has_parent  refcall:ref-call_iri (Ref_Call_tbl_1.Call_Num)
-where  ( ^{Ref_Call_tbl.}^.Parent    = ^{Ref_Call_tbl_1.}^.Call_Num )   as
-virtrdf:Ref-Call_has_parent .
-]]></programlisting>
-  <para>This demonstrates the way to self-join the table VRef_Call with itself. Like in SQL,
-are needed two different aliases for one table if you want to join it with itself.
-</para>
-</sect3>
-
-<sect3 id="rdfviewsbusint"><title>Business Intelligence</title>
-    <sect4 id="rdfviewsbusinttpc">
-      <title>TPCH to RDF</title>
-<programlisting><![CDATA[
-use DB;
-
-GRANT SELECT ON TPCH.DBA.PARTSUPP  TO "SPARQL";
-GRANT SELECT ON TPCH.DBA.SUPPLIER  TO "SPARQL";
-GRANT SELECT ON TPCH.DBA.CUSTOMER  TO "SPARQL";
-GRANT SELECT ON TPCH.DBA.HISTORY   TO "SPARQL";
-GRANT SELECT ON TPCH.DBA.PART      TO "SPARQL";
-GRANT SELECT ON TPCH.DBA.LINEITEM  TO "SPARQL";
-GRANT SELECT ON TPCH.DBA.ORDERS    TO "SPARQL";
-GRANT SELECT ON TPCH.DBA.NATION    TO "SPARQL";
-GRANT SELECT ON TPCH.DBA.REGION    TO "SPARQL";
-
-SPARQL
-drop quad map virtrdf:TPCH
-;
-
-SPARQL
-prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-create iri class tpch:customer "http://^{URIQADefaultHost}^/tpch/customer/%U%d#this" (in custname varchar, in c_custkey integer not null) option (bijection, deref) .
-create iri class tpch:lineitem "http://^{URIQADefaultHost}^/tpch/lineitem/%d/%d#this" (in l_orderkey integer not null, in l_linenumber integer not null) option (bijection, deref) .
-create iri class tpch:nation "http://^{URIQADefaultHost}^/tpch/nation/%U%d#this" (in name varchar, in l_nationkey integer not null) option (bijection, deref) .
-create iri class tpch:order "http://^{URIQADefaultHost}^/tpch/order/%d#this" (in o_orderkey integer not null) option (bijection, deref) .
-create iri class tpch:part "http://^{URIQADefaultHost}^/tpch/part/%U%d#this" (in p_partname varchar, in p_partkey integer not null) option (bijection, deref) .
-create iri class tpch:partsupp "http://^{URIQADefaultHost}^/tpch/partsupp/%d/%d#this" (in ps_partkey integer not null, in ps_suppkey integer not null) option (bijection, deref) .
-create iri class tpch:region "http://^{URIQADefaultHost}^/tpch/region/%U%d#this" (in name varchar, in r_regionkey integer not null) option (bijection, deref) .
-create iri class tpch:supplier "http://^{URIQADefaultHost}^/tpch/supplier/%U%d#this" (in name varchar, in s_supplierkey integer not null) option (bijection, deref) .
-;
-
-SPARQL
-prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-alter quad storage virtrdf:DefaultQuadStorage
-FROM TPCH.DBA.LINEITEM as lineitems
-FROM TPCH.DBA.CUSTOMER as customers
-FROM TPCH.DBA.NATION as nations
-FROM TPCH.DBA.ORDERS as orders
-FROM TPCH.DBA.PART as parts
-FROM TPCH.DBA.PARTSUPP as partsupps
-FROM TPCH.DBA.REGION as regions
-FROM TPCH.DBA.SUPPLIER as suppliers
-where (^{suppliers.}^.S_NATIONKEY = ^{nations.}^.N_NATIONKEY)
-where (^{customers.}^.C_NATIONKEY = ^{nations.}^.N_NATIONKEY)
-    {
-    create virtrdf:TPCH as graph iri ("http://^{URIQADefaultHost}^/tpch") option (exclusive)
-    {
-# Customers
-        tpch:customer (customers.C_NAME, customers.C_CUSTKEY)
-            a  tpch:customer
-                as virtrdf:customer-tpch-type ;
-            a  foaf:Organization
-                as virtrdf:customer-foaf-type ;
-            tpch:custkey customers.C_CUSTKEY
-                as virtrdf:customer-c_custkey ;
-            foaf:name customers.C_NAME
-                as virtrdf:customer-foaf_name ;
-            tpch:companyName customers.C_NAME
-                as virtrdf:customer-c_name ;
-            tpch:has_nation tpch:nation (nations.N_NAME, customers.C_NATIONKEY)
-                as virtrdf:customer-c_nationkey ;
-            tpch:address customers.C_ADDRESS
-                as virtrdf:customer-c_address ;
-            foaf:phone customers.C_PHONE
-                as virtrdf:customer-foaf_phone ;
-            tpch:phone customers.C_PHONE
-                as virtrdf:customer-phone ;
-            tpch:acctbal customers.C_ACCTBAL
-                as virtrdf:customer-acctbal ;
-            tpch:mktsegment customers.C_MKTSEGMENT
-                as virtrdf:customer-c_mktsegment ;
-            tpch:comment customers.C_COMMENT
-                as virtrdf:customer-c_comment .
-
-# Nations
-        tpch:nation (nations.N_NAME, customers.C_NATIONKEY)
-            tpch:nation_of tpch:customer (customers.C_NAME, customers.C_CUSTKEY)
-            as virtrdf:customer-nation_of .
-
-        tpch:lineitem (lineitems.L_ORDERKEY, lineitems.L_LINENUMBER)
-            a tpch:lineitem
-                as virtrdf:lineitem-lineitems ;
-            tpch:has_order tpch:order (lineitems.L_ORDERKEY)
-                as virtrdf:lineitem-l_orderkey ;
-            tpch:has_part tpch:part (parts.P_NAME, lineitems.L_PARTKEY)
-                where (^{parts.}^.P_PARTKEY = ^{lineitems.}^.L_PARTKEY)
-                as virtrdf:lineitem-l_partkey ;
-            tpch:has_supplier tpch:supplier (suppliers.S_NAME, lineitems.L_SUPPKEY)
-                where (^{suppliers.}^.S_SUPPKEY = ^{lineitems.}^.L_SUPPKEY)
-                as virtrdf:lineitem-l_suppkey ;
-            tpch:linenumber lineitems.L_LINENUMBER
-                as virtrdf:lineitem-l_linenumber ;
-            tpch:linequantity lineitems.L_QUANTITY
-                as virtrdf:lineitem-l_linequantity ;
-            tpch:lineextendedprice lineitems.L_EXTENDEDPRICE
-                as virtrdf:lineitem-l_lineextendedprice ;
-            tpch:linediscount lineitems.L_DISCOUNT
-                as virtrdf:lineitem-l_linediscount ;
-            tpch:linetax lineitems.L_TAX
-                as virtrdf:lineitem-l_linetax ;
-            tpch:returnflag lineitems.L_RETURNFLAG
-                as virtrdf:lineitem-l_returnflag ;
-            tpch:linestatus lineitems.L_LINESTATUS
-                as virtrdf:lineitem-l_linestatus ;
-            tpch:shipdate lineitems.L_SHIPDATE
-                as virtrdf:lineitem-l_shipdate ;
-            tpch:commitdate lineitems.L_COMMITDATE
-                as virtrdf:lineitem-l_commitdate ;
-            tpch:receiptdate lineitems.L_RECEIPTDATE
-                as virtrdf:lineitem-l_receiptdate ;
-            tpch:shipinstruct lineitems.L_SHIPINSTRUCT
-                as virtrdf:lineitem-l_shipinstruct ;
-            tpch:shipmode lineitems.L_SHIPMODE
-                as virtrdf:lineitem-l_shipmode ;
-            tpch:comment lineitems.L_COMMENT
-                as virtrdf:lineitem-l_comment .
-
-        tpch:part (parts.P_NAME, lineitems.L_PARTKEY)
-            tpch:part_of tpch:lineitem (lineitems.L_ORDERKEY, lineitems.L_LINENUMBER)
-            where (^{parts.}^.P_PARTKEY = ^{lineitems.}^.L_PARTKEY)
-            as virtrdf:lineitem-part_of .
-
-        tpch:order (lineitems.L_ORDERKEY)
-            tpch:order_of tpch:lineitem (lineitems.L_ORDERKEY, lineitems.L_LINENUMBER) as virtrdf:lineitem-order_of .
-
-        tpch:supplier (suppliers.S_NAME, lineitems.L_SUPPKEY)
-            tpch:supplier_of tpch:lineitem (lineitems.L_ORDERKEY, lineitems.L_LINENUMBER)
-            where (^{suppliers.}^.S_SUPPKEY = ^{lineitems.}^.L_SUPPKEY)
-            as virtrdf:lineitem-supplier_of .
-
-# Nation
-        tpch:nation (nations.N_NAME, nations.N_NATIONKEY)
-            a tpch:nation
-                as virtrdf:nation-nations ;
-            tpch:name nations.N_NAME
-                as virtrdf:nation-n_name ;
-            tpch:has_region tpch:region (regions.R_NAME, nations.N_REGIONKEY)
-                where (^{regions.}^.R_REGIONKEY = ^{nations.}^.N_REGIONKEY)
-                as virtrdf:nation-n_regionkey ;
-            tpch:comment nations.N_COMMENT
-                as virtrdf:nation-n_comment .
-
-        tpch:region (regions.R_NAME, nations.N_REGIONKEY)
-            tpch:region_of tpch:nation (nations.N_NAME, nations.N_NATIONKEY)
-            where (^{regions.}^.R_REGIONKEY = ^{nations.}^.N_REGIONKEY)
-            as virtrdf:nation-region_of .
-
-# Order
-        tpch:order (orders.O_ORDERKEY)
-            a tpch:order
-                as virtrdf:order-orders ;
-            tpch:orderkey orders.O_ORDERKEY
-                as virtrdf:order-o_orderkey ;
-            tpch:has_customer tpch:customer (customers.C_NAME, orders.O_CUSTKEY)
-                where (^{orders.}^.O_CUSTKEY = ^{customers.}^.C_CUSTKEY)
-                as virtrdf:order-o_custkey ;
-            tpch:orderstatus orders.O_ORDERSTATUS
-                as virtrdf:order-o_orderstatus ;
-            tpch:ordertotalprice orders.O_TOTALPRICE
-                as virtrdf:order-o_totalprice ;
-            tpch:orderdate orders.O_ORDERDATE
-                as virtrdf:order-o_orderdate ;
-            tpch:orderpriority orders.O_ORDERPRIORITY
-                as virtrdf:order-o_orderpriority ;
-            tpch:clerk orders.O_CLERK
-                as virtrdf:order-o_clerk ;
-            tpch:shippriority orders.O_SHIPPRIORITY
-                as virtrdf:order-o_shippriority ;
-            tpch:comment orders.O_COMMENT
-                as virtrdf:order-o_comment .
-
-        tpch:customer (customers.C_CUSTKEY, orders.O_CUSTKEY)
-            tpch:customer_of tpch:order (orders.O_ORDERKEY)
-            where (^{orders.}^.O_CUSTKEY = ^{customers.}^.C_CUSTKEY)
-            as virtrdf:order-customer_of .
-
-# Part
-        tpch:part (parts.P_NAME, parts.P_PARTKEY)
-            a tpch:part
-                as virtrdf:part-parts ;
-            tpch:partkey parts.P_PARTKEY
-                as virtrdf:part-p_partkey ;
-            tpch:name parts.P_NAME
-                as virtrdf:part-p_name ;
-            tpch:mfgr parts.P_MFGR
-                as virtrdf:part-p_mfgr ;
-            tpch:brand parts.P_BRAND
-                as virtrdf:part-p_brand ;
-            tpch:type parts.P_TYPE
-                as virtrdf:part-p_type ;
-            tpch:size parts.P_SIZE
-                as virtrdf:part-p_size ;
-            tpch:container parts.P_CONTAINER
-                as virtrdf:part-p_container ;
-            tpch:comment parts.P_COMMENT
-                as virtrdf:part-p_comment .
-
-# Partsupp
-        tpch:partsupp (partsupps.PS_PARTKEY, partsupps.PS_SUPPKEY)
-            a tpch:partsupp
-                as virtrdf:partsupp-partsupps ;
-            tpch:has_part tpch:part (parts.P_NAME, partsupps.PS_PARTKEY)
-                where (^{parts.}^.P_PARTKEY = ^{partsupps.}^.PS_PARTKEY)
-                as virtrdf:partsupp-ps_partkey ;
-            tpch:has_supplier tpch:supplier (suppliers.S_NAME, partsupps.PS_SUPPKEY)
-                where (^{suppliers.}^.S_SUPPKEY = ^{partsupps.}^.PS_SUPPKEY)
-                as virtrdf:partsupp-ps_suppkey ;
-            tpch:availqty partsupps.PS_AVAILQTY
-                as virtrdf:partsupp-ps_availqty ;
-            tpch:supplycost partsupps.PS_SUPPLYCOST
-                as virtrdf:partsupp-ps_supplycost ;
-            tpch:comment partsupps.PS_COMMENT
-                as virtrdf:partsupp-ps_comment .
-
-        tpch:part (parts.P_NAME, partsupps.PS_PARTKEY)
-            tpch:part_of tpch:partsupp (partsupps.PS_PARTKEY, partsupps.PS_SUPPKEY)
-            where (^{parts.}^.P_PARTKEY = ^{partsupps.}^.PS_PARTKEY)
-            as virtrdf:partsupp-part_of .
-
-        tpch:supplier (suppliers.S_NAME, partsupps.PS_SUPPKEY)
-            tpch:supplier_of tpch:partsupp (partsupps.PS_PARTKEY, partsupps.PS_SUPPKEY)
-            where (^{suppliers.}^.S_SUPPKEY = ^{partsupps.}^.PS_SUPPKEY)
-            as virtrdf:partsupp-supplier_of .
-
-# Region
-        tpch:region (regions.R_NAME, regions.R_REGIONKEY)
-            a tpch:region
-                as virtrdf:region-regions ;
-            tpch:name regions.R_NAME
-                as virtrdf:region-r_name ;
-            tpch:comment regions.R_COMMENT
-                as virtrdf:region-r_comment .
-
-# Supplier
-        tpch:supplier (suppliers.S_NAME, suppliers.S_SUPPKEY)
-            a tpch:supplier
-                as virtrdf:supplier-suppliers ;
-            tpch:name suppliers.S_NAME
-                as virtrdf:supplier-s_name ;
-            tpch:address suppliers.S_ADDRESS
-                as virtrdf:supplier-s_address ;
-            tpch:has_nation tpch:nation (nations.N_NAME, suppliers.S_NATIONKEY)
-                where (^{nations.}^.N_NATIONKEY = ^{suppliers.}^.S_NATIONKEY)
-                as virtrdf:supplier-s_nationkey ;
-            foaf:phone suppliers.S_PHONE
-                as virtrdf:supplier-foaf_phone ;
-            tpch:phone suppliers.S_PHONE
-                as virtrdf:supplier-s_phone ;
-            tpch:acctbal suppliers.S_ACCTBAL
-                as virtrdf:supplier-s_acctbal ;
-            tpch:comment suppliers.S_COMMENT
-                as virtrdf:supplier-s_comment .
-
-        tpch:nation (nations.N_NAME, suppliers.S_NATIONKEY)
-            tpch:nation_of tpch:supplier (suppliers.S_NAME, suppliers.S_SUPPKEY)
-            where (^{nations.}^.N_NATIONKEY = ^{suppliers.}^.S_NATIONKEY)
-            as virtrdf:supplier-nation_of .
-    } .
-} .
-      ;
-
-DELETE FROM db.dba.url_rewrite_rule_list WHERE urrl_list like 'tpch_rule%';
-DELETE FROM db.dba.url_rewrite_rule WHERE urr_rule like 'tpch_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'tpch_rule2',
-    1,
-    '([^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/tpch%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-             0,
-    null
-           );
-
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'tpch_rule1',
-    1,
-    '([^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s%%23this',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'tpch_rule3',
-    1,
-    '(/[^#]*)/\x24',
-    vector('path'),
-    1,
-    '%s',
-    vector('path'),
-    null,
-    null,
-    0,
-    null
-    );
-
-create procedure DB.DBA.REMOVE_TPCH_RDF_DET()
-    {
-  declare colid int;
-  colid := DAV_SEARCH_ID('/DAV/home/demo/tpch', 'C');
-  if (colid < 0)
-    return;
-  update WS.WS.SYS_DAV_COL set COL_DET=null where COL_ID = colid;
-    }
-;
-
-DB.DBA.REMOVE_TPCH_RDF_DET();
-
-drop procedure DB.DBA.REMOVE_TPCH_RDF_DET;
-
-create procedure DB.DBA.TPCH_MAKE_RDF_DET()
-{
-    declare uriqa_str varchar;
-    uriqa_str := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
-    uriqa_str := 'http://' || uriqa_str || '/tpch';
-    DB.DBA."RDFData_MAKE_DET_COL" ('/DAV/home/demo/tpch/RDFData/', uriqa_str, NULL);
-    VHOST_REMOVE (lpath=>'/tpch/data/rdf');
-    DB.DBA.VHOST_DEFINE (lpath=>'/tpch/data/rdf', ppath=>'/DAV/home/demo/tpch/RDFData/All/', is_dav=>1, vsp_user=>'dba');
-}
-;
-
-DB.DBA.TPCH_MAKE_RDF_DET();
-
-drop procedure DB.DBA.TPCH_MAKE_RDF_DET;
-
-create procedure DB.DBA.TPCH_DET_REF (in par varchar, in fmt varchar, in val varchar)
-{
-  declare res, iri any;
-  declare uriqa_str varchar;
-  uriqa_str := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
-  uriqa_str := 'http://' || uriqa_str || '/tpch';
-  iri := uriqa_str || val;
-  res := sprintf ('iid (%d).rdf', iri_id_num (iri_to_id (iri)));
-  return sprintf (fmt, res);
-}
-;
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('tpch_rdf', 1,
-    '/tpch/(.*)', vector('path'), 1,
-    '/tpch/data/rdf/%U', vector('path'),
-    'DB.DBA.TPCH_DET_REF',
-    'application/rdf.xml',
-    2,
-    303);
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'tpch_rule_list1',
-    1,
-    vector (
-                'tpch_rule1',
-                'tpch_rule2',
-                'tpch_rule3',
-                'tpch_rdf'
-          ));
-
-DB.DBA.VHOST_REMOVE (lpath=>'/tpch');
-DB.DBA.VHOST_DEFINE (lpath=>'/tpch', ppath=>'/DAV/home/demo/tpch/', vsp_user=>'dba', is_dav=>1,
-          is_brws=>0, opts=>vector ('url_rewrite', 'tpch_rule_list1'));
-
-
-DB.DBA.VHOST_REMOVE (lpath=>'/tpch/linkeddata');
-DB.DBA.VHOST_DEFINE (lpath=>'/tpch/linkeddata', ppath=>'/DAV/home/demo/tpch/', vsp_user=>'dba', is_dav=>1,
-          is_brws=>1);
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfviewsbusinttpcd">
-      <title>TPCD to RDF</title>
-<para>Please load ~\binsrc\dav\DET_RDFData.sql before loadding this script (tpc-d has no vad to do this automatic)</para>
-<programlisting><![CDATA[
-use DB;
-
-create procedure DB.DBA.exec_no_error (in expr varchar) {
-  declare state, message, meta, result any;
-  exec(expr, state, message, vector(), 0, meta, result);
-}
-;
-
-DB.DBA.exec_no_error('GRANT \"SPARQL_UPDATE\" TO \"SPARQL\"')
-;
-GRANT SELECT ON tpcd.DBA.partsupp  TO "SPARQL";
-GRANT SELECT ON tpcd.DBA.supplier  TO "SPARQL";
-GRANT SELECT ON tpcd.DBA.customer  TO "SPARQL";
-GRANT SELECT ON tpcd.DBA.history   TO "SPARQL";
-GRANT SELECT ON tpcd.DBA.part      TO "SPARQL";
-GRANT SELECT ON tpcd.DBA.lineitem  TO "SPARQL";
-GRANT SELECT ON tpcd.DBA.orders    TO "SPARQL";
-GRANT SELECT ON tpcd.DBA.nation    TO "SPARQL";
-GRANT SELECT ON tpcd.DBA.region    TO "SPARQL";
-
---SPARQL
---prefix tpcd: <http://demo.openlinksw.com/schemas/tpcd#>
---prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
---prefix sioc: <http://rdfs.org/sioc/ns#>
---prefix foaf: <http://xmlns.com/foaf/0.1/>
---prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
---drop quad map graph iri("http://^{URIQADefaultHost}^/tpcd") .
---;
-
-SPARQL
-prefix tpcd: <http://demo.openlinksw.com/schemas/tpcd#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-drop silent quad map virtrdf:TpcdDemo .
-;
-
-SPARQL
-prefix tpcd: <http://demo.openlinksw.com/schemas/tpcd#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-create iri class tpcd:customer "http://^{URIQADefaultHost}^/tpcd/customer/%d#this" (in c_custkey integer not null) .
-create iri class tpcd:lineitem "http://^{URIQADefaultHost}^/tpcd/lineitem/%d/%d#this" (in l_orderkey integer not null, in l_linenumber integer not null) .
-create iri class tpcd:nation "http://^{URIQADefaultHost}^/tpcd/nation/%d#this" (in l_nationkey integer not null) .
-create iri class tpcd:order "http://^{URIQADefaultHost}^/tpcd/order/%d#this" (in o_orderkey integer not null) .
-create iri class tpcd:part "http://^{URIQADefaultHost}^/tpcd/part/%d#this" (in p_partkey integer not null) .
-create iri class tpcd:partsupp "http://^{URIQADefaultHost}^/tpcd/partsupp/%d/%d#this" (in ps_partkey integer not null, in ps_suppkey integer not null) .
-create iri class tpcd:region "http://^{URIQADefaultHost}^/tpcd/region/%d#this" (in r_regionkey integer not null) .
-create iri class tpcd:supplier "http://^{URIQADefaultHost}^/tpcd/supplier/%d#this" (in s_supplierkey integer not null) .
-;
-
-SPARQL
-prefix tpcd: <http://demo.openlinksw.com/schemas/tpcd#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-alter quad storage virtrdf:DefaultQuadStorage
-from tpcd.DBA.lineitem as lineitems
-from tpcd.DBA.customer as customers
-from tpcd.DBA.nation as nations
-from tpcd.DBA.orders as orders
-from tpcd.DBA.part as parts
-from tpcd.DBA.partsupp as partsupps
-from tpcd.DBA.region as regions
-from tpcd.DBA.supplier as suppliers
-where (^{suppliers.}^.s_nationkey = ^{nations.}^.n_nationkey)
-where (^{customers.}^.c_nationkey = ^{nations.}^.n_nationkey)
-{
-    create virtrdf:TpcdDemo as graph iri ("http://^{URIQADefaultHost}^/tpcd") option (exclusive)
-    {
-# Customers
-        tpcd:customer (customers.c_custkey)
-            a  tpcd:customer
-                as virtrdf:tpcdcustomer-type ;
-            a  foaf:Organization
-                as virtrdf:tpcdcustomer-foaf-type ;
-            tpcd:custkey customers.c_custkey
-                as virtrdf:tpcdcustomer-c_custkey ;
-            foaf:name customers.c_name
-                as virtrdf:tpcdcustomer-foaf_name ;
-            tpcd:companyName customers.c_name
-                as virtrdf:tpcdcustomer-c_name ;
-            tpcd:has_nation tpcd:nation (customers.c_nationkey)
-                as virtrdf:tpcdcustomer-c_nationkey ;
-            tpcd:address customers.c_address
-                as virtrdf:tpcdcustomer-c_address ;
-            foaf:phone customers.c_phone
-                as virtrdf:tpcdcustomer-foaf_phone ;
-            tpcd:phone customers.c_phone
-                as virtrdf:tpcdcustomer-phone ;
-            tpcd:acctbal customers.c_acctbal
-                as virtrdf:tpcdcustomer-acctbal ;
-            tpcd:mktsegment customers.c_mktsegment
-                as virtrdf:tpcdcustomer-c_mktsegment ;
-            tpcd:comment customers.c_comment
-                as virtrdf:tpcdcustomer-c_comment .
-
-# Nations
-        tpcd:nation (customers.c_nationkey)
-            tpcd:nation_of tpcd:customer (customers.c_custkey) as virtrdf:tpcdcustomer-nation_of .
-
-# Lineitems
-        tpcd:lineitem (lineitems.l_orderkey, lineitems.l_linenumber)
-            a tpcd:lineitem
-                as virtrdf:tpcdlineitem-lineitems ;
-            tpcd:has_order tpcd:order (lineitems.l_orderkey)
-                as virtrdf:tpcdlineitem-l_orderkey ;
-            tpcd:has_part tpcd:part (lineitems.l_partkey)
-                as virtrdf:tpcdlineitem-l_partkey ;
-            tpcd:has_supplier tpcd:supplier (lineitems.l_suppkey)
-                as virtrdf:tpcdlineitem-l_suppkey ;
-            tpcd:linenumber lineitems.l_linenumber
-                as virtrdf:tpcdlineitem-l_linenumber ;
-            tpcd:linequantity lineitems.l_quantity
-                as virtrdf:tpcdlineitem-l_linequantity ;
-            tpcd:lineextendedprice lineitems.l_extendedprice
-                as virtrdf:tpcdlineitem-l_lineextendedprice ;
-            tpcd:linediscount lineitems.l_discount
-                as virtrdf:tpcdlineitem-l_linediscount ;
-            tpcd:linetax lineitems.l_tax
-                as virtrdf:tpcdlineitem-l_linetax ;
-            tpcd:returnflag lineitems.l_returnflag
-                as virtrdf:tpcdlineitem-l_returnflag ;
-            tpcd:linestatus lineitems.l_linestatus
-                as virtrdf:tpcdlineitem-l_linestatus ;
-            tpcd:shipdate lineitems.l_shipdate
-                as virtrdf:tpcdlineitem-l_shipdate ;
-            tpcd:commitdate lineitems.l_commitdate
-                as virtrdf:tpcdlineitem-l_commitdate ;
-            tpcd:receiptdate lineitems.l_receiptdate
-                as virtrdf:tpcdlineitem-l_receiptdate ;
-            tpcd:shipinstruct lineitems.l_shipinstruct
-                as virtrdf:tpcdlineitem-l_shipinstruct ;
-            tpcd:shipmode lineitems.l_shipmode
-                as virtrdf:tpcdlineitem-l_shipmode ;
-            tpcd:comment lineitems.l_comment
-                as virtrdf:tpcdlineitem-l_comment .
-
-        tpcd:part (lineitems.l_partkey)
-            tpcd:part_of tpcd:lineitem (lineitems.l_orderkey, lineitems.l_linenumber) as virtrdf:tpcdlineitem-part_of .
-
-        tpcd:order (lineitems.l_orderkey)
-            tpcd:order_of tpcd:lineitem (lineitems.l_orderkey, lineitems.l_linenumber) as virtrdf:tpcdlineitem-order_of .
-
-        tpcd:supplier (lineitems.l_suppkey)
-            tpcd:supplier_of tpcd:lineitem (lineitems.l_orderkey, lineitems.l_linenumber) as virtrdf:tpcdlineitem-supplier_of .
-
-# Nation
-        tpcd:nation (nations.n_nationkey)
-            a tpcd:nation
-                as virtrdf:tpcdnation-nations ;
-            tpcd:name nations.n_name
-                as virtrdf:tpcdnation-n_name ;
-            tpcd:has_region tpcd:region (nations.n_regionkey)
-                as virtrdf:tpcdnation-n_regionkey ;
-            tpcd:comment nations.n_comment
-                as virtrdf:tpcdnation-n_comment .
-
-        tpcd:region (nations.n_regionkey)
-            tpcd:region_of tpcd:nation (nations.n_nationkey) as virtrdf:tpcdnation-region_of .
-
-# Order
-        tpcd:order (orders.o_orderkey)
-            a tpcd:order
-                as virtrdf:tpcdorder-orders ;
-            tpcd:orderkey orders.o_orderkey
-                as virtrdf:tpcdorder-o_orderkey ;
-            tpcd:has_customer tpcd:customer (orders.o_custkey)
-                as virtrdf:tpcdorder-o_custkey ;
-            tpcd:orderstatus orders.o_orderstatus
-                as virtrdf:tpcdorder-o_orderstatus ;
-            tpcd:ordertotalprice orders.o_totalprice
-                as virtrdf:tpcdorder-o_totalprice ;
-            tpcd:orderdate orders.o_orderdate
-                as virtrdf:tpcdorder-o_orderdate ;
-            tpcd:orderpriority orders.o_orderpriority
-                as virtrdf:tpcdorder-o_orderpriority ;
-            tpcd:clerk orders.o_clerk
-                as virtrdf:tpcdorder-o_clerk ;
-            tpcd:shippriority orders.o_shippriority
-                as virtrdf:tpcdorder-o_shippriority ;
-            tpcd:comment orders.o_comment
-                as virtrdf:tpcdorder-o_comment .
-
-        tpcd:customer (orders.o_custkey)
-            tpcd:customer_of tpcd:order (orders.o_orderkey) as virtrdf:tpcdorder-customer_of .
-
-# Part
-        tpcd:part (parts.p_partkey)
-            a tpcd:part
-                as virtrdf:tpcdpart-parts ;
-            tpcd:partkey parts.p_partkey
-                as virtrdf:tpcdpart-p_partkey ;
-            tpcd:name parts.p_name
-                as virtrdf:tpcdpart-p_name ;
-            tpcd:mfgr parts.p_mfgr
-                as virtrdf:tpcdpart-p_mfgr ;
-            tpcd:brand parts.p_brand
-                as virtrdf:tpcdpart-p_brand ;
-            tpcd:type parts.p_type
-                as virtrdf:tpcdpart-p_type ;
-            tpcd:size parts.p_size
-                as virtrdf:tpcdpart-p_size ;
-            tpcd:container parts.p_container
-                as virtrdf:tpcdpart-p_container ;
-            tpcd:comment parts.p_comment
-                as virtrdf:tpcdpart-p_comment .
-
-# Partsupp
-        tpcd:partsupp (partsupps.ps_partkey, partsupps.ps_suppkey)
-            a tpcd:partsupp
-                as virtrdf:tpcdpartsupp-partsupps ;
-            tpcd:has_part tpcd:part (partsupps.ps_partkey)
-                as virtrdf:tpcdpartsupp-ps_partkey ;
-            tpcd:has_supplier tpcd:supplier (partsupps.ps_suppkey)
-                as virtrdf:tpcdpartsupp-ps_suppkey ;
-            tpcd:availqty partsupps.ps_availqty
-                as virtrdf:tpcdpartsupp-ps_availqty ;
-            tpcd:supplycost partsupps.ps_supplycost
-                as virtrdf:tpcdpartsupp-ps_supplycost ;
-            tpcd:comment partsupps.ps_comment
-                as virtrdf:tpcdpartsupp-ps_comment .
-
-        tpcd:part (partsupps.ps_partkey)
-            tpcd:part_of tpcd:partsupp (partsupps.ps_partkey, partsupps.ps_suppkey) as virtrdf:tpcdpartsupp-part_of .
-
-        tpcd:supplier (partsupps.ps_suppkey)
-            tpcd:supplier_of tpcd:partsupp (partsupps.ps_partkey, partsupps.ps_suppkey) as virtrdf:tpcdpartsupp-supplier_of .
-
-# Region
-        tpcd:region (regions.r_regionkey)
-            a tpcd:region
-                as virtrdf:tpcdregion-regions ;
-            tpcd:name regions.r_name
-                as virtrdf:tpcdregion-r_name ;
-            tpcd:comment regions.r_comment
-                as virtrdf:tpcdregion-r_comment .
-
-# Supplier
-        tpcd:supplier (suppliers.s_suppkey)
-            a tpcd:supplier
-                as virtrdf:tpcdsupplier-suppliers ;
-            tpcd:name suppliers.s_name
-                as virtrdf:tpcdsupplier-s_name ;
-            tpcd:address suppliers.s_address
-                as virtrdf:tpcdsupplier-s_address ;
-            tpcd:has_nation tpcd:nation (suppliers.s_nationkey)
-                as virtrdf:tpcdsupplier-s_nationkey ;
-            foaf:phone suppliers.s_phone
-                as virtrdf:tpcdsupplier-foaf_phone ;
-            tpcd:phone suppliers.s_phone
-                as virtrdf:tpcdsupplier-s_phone ;
-            tpcd:acctbal suppliers.s_acctbal
-                as virtrdf:tpcdsupplier-s_acctbal ;
-            tpcd:comment suppliers.s_comment
-                as virtrdf:tpcdsupplier-s_comment .
-
-        tpcd:nation (suppliers.s_nationkey)
-            tpcd:nation_of tpcd:supplier (suppliers.s_suppkey) as virtrdf:tpcdsupplier-nation_of .
-    }
-}
-;
-
-create procedure tcpd_rdf_doc (in path varchar)
-{
-  declare r any;
-  r := regexp_match ('[^/]*\x24', path);
-  return r||'#this';
-};
-
-create procedure tcpd_html_doc (in path varchar)
-{
-  declare r any;
-  r := regexp_match ('[^/]*#', path);
-  return subseq (r, 0, length (r)-1);
-};
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'tcpd_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/tpcd%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'tcpd_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/rdfbrowser/index.html?uri=http%%3A//^{URIQADefaultHost}^%U%%23this',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'tcpd_rule3',
-    1,
-    '(/[^#]*)/\x24',
-    vector('path'),
-    1,
-    '%s',
-    vector('path'),
-    null,
-    null,
-    0,
-    null
-    );
-
-DB.DBA."RDFData_MAKE_DET_COL" ('/DAV/home/tpcd/RDFData/', 'http://^{URIQADefaultHost}^/tpcd', NULL);
-VHOST_REMOVE (lpath=>'/tpcd/data/rdf');
-DB.DBA.VHOST_DEFINE (lpath=>'/tpcd/data/rdf', ppath=>'/DAV/home/tpcd/RDFData/All/', is_dav=>1, vsp_user=>'dba');
-
--- procedure to convert path to DET resource name
-create procedure DB.DBA.TPCD_DET_REF (in par varchar, in fmt varchar, in val varchar)
-{
-  declare res, iri any;
-  iri := 'http://^{URIQADefaultHost}^/tpcd' || val;
-  res := sprintf ('iid (%d).rdf', iri_id_num (iri_to_id (iri)));
-  return sprintf (fmt, res);
-}
-;
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('tpcd_rdf', 1,
-    '/tpcd/(.*)', vector('path'), 1,
-    '/tpcd/data/rdf/%U', vector('path'),
-    'DB.DBA.TPCD_DET_REF',
-    'application/rdf.xml',
-    2,
-    303);
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'tpcd_rule_list1',
-    1,
-    vector (
-                'tcpd_rule1',
-                'tcpd_rule2',
-                'tcpd_rule3',
-                'tpcd_rdf'
-          ));
-
-
-VHOST_REMOVE (lpath=>'/tpcd');
-DB.DBA.VHOST_DEFINE (lpath=>'/tpcd', ppath=>'/DAV/home/', vsp_user=>'dba', is_dav=>1, def_page=>'sfront.vspx',
-    is_brws=>0, opts=>vector ('url_rewrite', 'tpcd_rule_list1'));
-
-create procedure DB.DBA.LOAD_TPCD_ONTOLOGY_FROM_DAV()
-{
-	declare content, urihost varchar;
-	select cast (RES_CONTENT as varchar) into content from WS.WS.SYS_DAV_RES where RES_FULL_PATH = '/DAV/VAD/tpcd/tpcd.owl';
-	DB.DBA.RDF_LOAD_RDFXML (content, 'http://demo.openlinksw.com/schemas/tpcd#', 'http://demo.openlinksw.com/schemas/TPCDOntology/1.0/');
-	urihost := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
-	if (urihost = 'demo.openlinksw.com')
-	{
-		DB.DBA.VHOST_REMOVE (lpath=>'/schemas/tpcd');
-		DB.DBA.VHOST_DEFINE (lpath=>'/schemas/tpcd', ppath=>'/DAV/VAD/tpcd/tpcd.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
-	}
-}
-;
-DB.DBA.LOAD_TPCD_ONTOLOGY_FROM_DAV()
-;
-drop procedure DB.DBA.LOAD_TPCD_ONTOLOGY_FROM_DAV
-;
-
-XML_SET_NS_DECL ('virt-tpcd', 'http://demo.openlinksw.com/schemas/tpcd#', 2)
-;
-
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfviewsbusintthalia">
-      <title>Thalia to RDF</title>
-<programlisting><![CDATA[
-
-use DB
-;
-
-SPARQL drop quad map virtrdf:ThaliaDemo
-;
-
-create procedure DB.DBA.SPARQL_THALIA_RUN (in txt varchar)
-{
-  declare REPORT, stat, msg, sqltext varchar;
-  declare metas, rowset any;
-  result_names (REPORT);
-  sqltext := string_output_string (sparql_to_sql_text (txt));
-  stat := '00000';
-  msg := '';
-  rowset := null;
-  exec (sqltext, stat, msg, vector (), 1000, metas, rowset);
-}
-;
-
-create procedure DB.DBA.exec_no_error(in expr varchar)
-{
-	declare state, message, meta, result any;
-	exec(expr, state, message, vector(), 0, meta, result);
-}
-;
-
-DB.DBA.exec_no_error('drop View thalia.Demo.asu_v');
-DB.DBA.exec_no_error('create View thalia.Demo.asu_v as select left(Title,3) code,* from thalia.Demo.asu');
-DB.DBA.exec_no_error('drop View thalia.Demo.gatech_v');
-DB.DBA.exec_no_error('create View thalia.Demo.gatech_v as select *, Room||\' \'||Building Place from thalia.Demo.gatech');
-DB.DBA.SPARQL_THALIA_RUN('drop quad map graph iri("http://^{URIQADefaultHost}^/Thalia") .
-')
-;
-
-GRANT SELECT ON thalia.Demo.asu TO "SPARQL"
-;
-GRANT SELECT ON thalia.Demo.asu_v TO "SPARQL"
-;
-GRANT SELECT ON thalia.Demo.brown TO "SPARQL"
-;
-GRANT SELECT ON thalia.Demo.cmu TO "SPARQL"
-;
-GRANT SELECT ON thalia.Demo.gatech TO "SPARQL"
-;
-GRANT SELECT ON thalia.Demo.gatech_v TO "SPARQL"
-;
-GRANT SELECT ON thalia.Demo.toronto TO "SPARQL"
-;
-GRANT SELECT ON thalia.Demo.ucsd TO "SPARQL"
-;
-GRANT SELECT ON thalia.Demo.umd TO "SPARQL"
-;
-
-DB.DBA.SPARQL_THALIA_RUN('drop quad map graph iri("http://^{URIQADefaultHost}^/thalia") .
-');
-
-DB.DBA.SPARQL_THALIA_RUN('drop quad map virtrdf:ThaliaDemo .
-');
-
-
-DB.DBA.SPARQL_THALIA_RUN('
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix xsd: <http://www.w3.org/2001/XMLSchema#>
-prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-prefix dc: <http://purl.org/dc/elements/1.1/>
-prefix time: <http://www.w3.org/2006/time#>
-prefix event: <http://purl.org/NET/c4dm/event.owl#>
-prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix skos: <http://www.w3.org/2004/02/skos/core#>
-prefix th: <http://demo.openlinksw.com/schemas/thalia#>
-
-create iri class th:Asu "http://^{URIQADefaultHost}^/thalia/asu/course/%U#this" (in code varchar not null) .
-create iri class th:Brown "http://^{URIQADefaultHost}^/thalia/brown/course/%U#this" (in Code varchar not null) .
-create iri class th:BrownInstructor "http://^{URIQADefaultHost}^/thalia/brown/instructor/%U#this" (in Code varchar not null) .
-create iri class th:BrownLecture "http://^{URIQADefaultHost}^/thalia/brown/lecture/%U#this" (in Code varchar not null) .
-create iri class th:BrownPlace "http://^{URIQADefaultHost}^/thalia/brown/place/%U#this" (in Code varchar not null) .
-
-create iri class th:Cmu "http://^{URIQADefaultHost}^/thalia/cmu/course/%U/%U#this" (in Code varchar not null, in Sec varchar) .
-create iri class th:CmuInstructor "http://^{URIQADefaultHost}^/thalia/cmu/instructor/%U/%U#this" (in Code varchar not null, in Sec varchar) .
-create iri class th:CmuLecture "http://^{URIQADefaultHost}^/thalia/cmu/lecture/%U/%U#this" (in Code varchar not null, in Sec varchar) .
-create iri class th:CmuPlace "http://^{URIQADefaultHost}^/thalia/cmu/place/%U/%U#this" (in Code varchar not null, in Sec varchar) .
-create iri class th:CmuEventTime "http://^{URIQADefaultHost}^/thalia/cmu/eventtime/%U/%U#this" (in Code varchar not null, in Sec varchar) .
-create iri class th:CmuDatetime "http://^{URIQADefaultHost}^/thalia/cmu/datetime/%U/%U#this" (in Code varchar not null, in Sec varchar) .
-
-create iri class th:Gatech "http://^{URIQADefaultHost}^/thalia/gatech/course/%U/%d/%U#this" (in Department varchar, in Code integer, in Section varchar) .
-create iri class th:GatechInstructor "http://^{URIQADefaultHost}^/thalia/gatech/instructor/%U/%d/%U#this" (in Department varchar, in Code integer, in Section varchar) .
-create iri class th:GatechLecture "http://^{URIQADefaultHost}^/thalia/gatech/lecture/%U/%d/%U#this" (in Department varchar, in Code integer, in Section varchar) .
-create iri class th:GatechEventTime "http://^{URIQADefaultHost}^/thalia/gatech/eventtime/%U/%d/%U#this" (in Department varchar, in Code integer, in Section varchar) .
-create iri class th:GatechDatetime "http://^{URIQADefaultHost}^/thalia/gatech/datetime/%U/%d/%U#this" (in Department varchar, in Code integer, in Section varchar) .
-create iri class th:GatechPlace "http://^{URIQADefaultHost}^/thalia/gatech/place/%U/%d/%U#this" (in Department varchar, in Code integer, in Section varchar) .
-
-create iri class th:Toronto "http://^{URIQADefaultHost}^/thalia/toronto/course/%U#this" (in No_ varchar) .
-create iri class th:TorontoInstructor "http://^{URIQADefaultHost}^/thalia/toronto/instructor/%U#this" (in No_ varchar) .
-create iri class th:TorontoLecture "http://^{URIQADefaultHost}^/thalia/toronto/lecture/%U#this" (in No_ varchar) .
-create iri class th:TorontoPlace "http://^{URIQADefaultHost}^/thalia/toronto/place/%U#this" (in No_ varchar) .
-
-create iri class th:Ucsd "http://^{URIQADefaultHost}^/thalia/ucsd/course/%U#this" (in Number varchar) .
-create iri class th:UcsdInstructor1 "http://^{URIQADefaultHost}^/thalia/ucsd/instructor1/%U#this" (in Number varchar) .
-create iri class th:UcsdInstructor2 "http://^{URIQADefaultHost}^/thalia/ucsd/instructor2/%U#this" (in Number varchar) .
-create iri class th:UcsdInstructor3 "http://^{URIQADefaultHost}^/thalia/ucsd/instructor3/%U#this" (in Number varchar) .
-
-create iri class th:Umd "http://^{URIQADefaultHost}^/thalia/umd/course/%U#this" (in Code varchar) .
-create iri class th:UmdLecture "http://^{URIQADefaultHost}^/thalia/umd/lecture/%U#this" (in Code varchar) .
-create iri class th:UmdEventTime "http://^{URIQADefaultHost}^/thalia/umd/eventtime/%U#this" (in Code varchar) .
-create iri class th:UmdDatetime "http://^{URIQADefaultHost}^/thalia/umd/datetime/%U#this" (in Code varchar) .
-')
-;
-
-DB.DBA.SPARQL_THALIA_RUN('prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix xsd: <http://www.w3.org/2001/XMLSchema#>
-prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-prefix dc: <http://purl.org/dc/elements/1.1/>
-prefix time: <http://www.w3.org/2006/time#>
-prefix event: <http://purl.org/NET/c4dm/event.owl#>
-prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix skos: <http://www.w3.org/2004/02/skos/core#>
-prefix th: <http://demo.openlinksw.com/schemas/thalia#>
-alter quad storage virtrdf:DefaultQuadStorage
-from thalia.demo.asu_v as asus
-from thalia.demo.brown as browns
-from thalia.demo.cmu as cmus
-from thalia.demo.gatech_v as gatechs
-from thalia.demo.toronto as torontos
-from thalia.demo.ucsd as ucsds
-from thalia.demo.umd as umds
-  {
-        create virtrdf:ThaliaDemo as graph iri ("http://^{URIQADefaultHost}^/thalia") option (exclusive)
-      {
-                th:Asu (asus.code)
-                    a th:Course
-                        as virtrdf:Asu-Course ;
-                    dc:title asus.Title
-                        as virtrdf:Asu-Title ;
-                    dc:description asus.Description
-                        as virtrdf:Asu-Description ;
-                    rdfs:seeAlso asus.MoreInfoURL
-                        as virtrdf:Asu-MoreInfoURL ;
-                        th:forUniversity "http://purl.org/thalia/university/asu/university/asu"
-                            as virtrdf:Asu-University ;
-                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
-                            as virtrdf:Asu-Subject
-                            .
-
-                th:Brown (browns.Code)
-                        a th:Course
-                                as virtrdf:Brown-Course ;
-                        dc:title browns.Title
-                            as virtrdf:Brown-Title ;
-                        th:hasInstructor th:BrownInstructor (browns.Code)
-                            as virtrdf:Brown-hasInstructor ;
-                        th:hasLecture th:BrownLecture(browns.Code)
-                            as virtrdf:Brown-hasLecture ;
-                        th:forUniversity "http://purl.org/thalia/university/brown"
-                            as virtrdf:Brown-University ;
-                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
-                            as virtrdf:Brown-Subject
-                            .
-                th:BrownInstructor (browns.Code)
-                        a th:Instructor
-                                as virtrdf:Brown-Instructor ;
-                        dc:homepage browns.Instructor
-                            as virtrdf:Brown-Instructor-Homepage
-                            .
-                th:BrownLecture (browns.Code)
-                        a event:Event
-                                as virtrdf:Brown-Lecture ;
-                        event:place th:BrownPlace(browns.Code)
-                            as virtrdf:Brown-hasPlace
-                            .
-                th:BrownPlace (browns.Code)
-                        a geo:Point
-                                as virtrdf:Brown-Place;
-                        dc:title browns.Room
-                            as virtrdf:Brown-Room
-                            .
-
-                th:Cmu (cmus.Code, cmus.Sec)
-                    a th:Course
-                        as virtrdf:Cmu-Course ;
-                    dc:title cmus.CourseTitle
-                        as virtrdf:Cmu-CourseTitle ;
-                        th:hasInstructor th:CmuInstructor (cmus.Code, cmus.Sec)
-                            as virtrdf:Cmu-hasInstructor ;
-                        th:hasLecture th:CmuLecture(cmus.Code, cmus.Sec)
-                            as virtrdf:Cmu-hasLecture ;
-                        th:hasUnits cmus.Units
-                            as virtrdf:Cmu-hasUnits ;
-                        th:forUniversity "http://purl.org/thalia/university/cmu"
-                            as virtrdf:Cmu-University ;
-                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
-                            as virtrdf:Cmu-Subject
-                        .
-        th:CmuInstructor (cmus.Code, cmus.Sec)
-                        a th:Instructor
-                                as virtrdf:Cmu-Instructor ;
-                    foaf:name cmus.Lecturer
-                        as virtrdf:Cmu-Lecturer
-                            .
-        th:CmuLecture (cmus.Code, cmus.Sec)
-                        a event:Event
-                                as virtrdf:Cmu-Lecture ;
-                        event:time th:CmuEventTime(cmus.Code, cmus.Sec)
-                            as virtrdf:Cmu-hasEventTime ;
-                        event:place th:CmuPlace(cmus.Code, cmus.Sec)
-                            as virtrdf:Cmu-hasPlace
-                            .
-        th:CmuPlace (cmus.Code, cmus.Sec)
-                        a geo:Point
-                                as virtrdf:Cmu-Place;
-                        dc:title cmus.Room
-                            as virtrdf:Cmu-Room
-                            .
-        th:CmuEventTime (cmus.Code, cmus.Sec)
-                        a time:Interval
-                                as virtrdf:Cmu-EventTime;
-                        time:inDateTime th:CmuDatetime(cmus.Code, cmus.Sec)
-                            as virtrdf:Cmu-inDateTime
-                            .
-        th:CmuDatetime (cmus.Code, cmus.Sec)
-                        a time:DateTimeDescription
-                                as virtrdf:Cmu-Datetime;
-                    time:dayOfWeek cmus.Day_
-                        as virtrdf:Cmu-Day ;
-                    time:hour cmus.Time_
-                        as virtrdf:Cmu-Time
-                            .
-
-                th:Gatech (gatechs.Department, gatechs.Code, gatechs.Section)
-                    a th:Course
-                        as virtrdf:Gatech-Course ;
-                    dc:title gatechs.Title
-                        as virtrdf:Gatech-Title ;
-                        th:hasInstructor th:GatechInstructor(gatechs.Department, gatechs.Code, gatechs.Section)
-                            as virtrdf:Gatech-hasInstructor ;
-                    dc:description gatechs.Description
-                        as virtrdf:Gatech-Description ;
-                        th:hasLecture th:GatechLecture(gatechs.Department, gatechs.Code, gatechs.Section)
-                            as virtrdf:Gatech-hasLecture ;
-                        th:forUniversity "http://purl.org/thalia/university/gatech"
-                            as virtrdf:Gatech-University ;
-                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
-                            as virtrdf:Gatech-Subject
-                            .
-        th:GatechInstructor (gatechs.Department, gatechs.Code, gatechs.Section)
-                        a th:Instructor
-                                as virtrdf:Gatech-Instructor ;
-                    foaf:name gatechs.Instructor
-                        as virtrdf:Gatech-InstructorName
-                .
-        th:GatechLecture (gatechs.Department, gatechs.Code, gatechs.Section)
-                        a event:Event
-                                as virtrdf:Gatech-Lecture ;
-                        event:time th:GatechEventTime(gatechs.Department, gatechs.Code, gatechs.Section)
-                            as virtrdf:Gatech-hasEventTime ;
-                        event:place th:GatechPlace(gatechs.Department, gatechs.Code, gatechs.Section)
-                            as virtrdf:Gatech-hasPlace
-                .
-        th:GatechEventTime (gatechs.Department, gatechs.Code, gatechs.Section)
-                        a time:Interval
-                                as virtrdf:Gatech-EventTime ;
-                        time:inDateTime th:GatechDatetime(gatechs.Department, gatechs.Code, gatechs.Section)
-                            as virtrdf:Gatech-inDateTime
-                .
-        th:GatechDatetime (gatechs.Department, gatechs.Code, gatechs.Section)
-                        a time:DateTimeDescription
-                                as virtrdf:Gatech-Datetime ;
-                    time:dayOfWeek gatechs.Days
-                        as virtrdf:Gatech-Days ;
-                    time:hour gatechs.Time_
-                        as virtrdf:Gatech-Time_
-                .
-        th:GatechPlace (gatechs.Department, gatechs.Code, gatechs.Section)
-                        a geo:Point
-                                as virtrdf:Gatech-Place ;
-                        dc:title gatechs.Place
-                            as virtrdf:Gatech-RoomBuilding
-                .
-
-                th:Toronto (torontos.No_)
-                        a th:Course
-                                as virtrdf:Toronto-Course ;
-                        dc:title torontos.title
-                            as virtrdf:Toronto-Title ;
-                        dc:description torontos.text_
-                            as virtrdf:Toronto-Description ;
-                        th:hasInstructor th:TorontoInstructor(torontos.No_)
-                            as virtrdf:Toronto-hasInstructor ;
-                        th:hasLecture th:TorontoLecture(torontos.No_)
-                            as virtrdf:Toronto-hasLecture ;
-                        rdfs:seeAlso torontos.coursewebsite
-                            as virtrdf:Toronto-CourseWebSite ;
-                        th:hasPrerequisite torontos.prereq
-                            as virtrdf:Toronto-prereq ;
-                        th:text torontos.text_
-                            as virtrdf:Toronto-text;
-                        th:forUniversity "http://purl.org/thalia/university/toronto"
-                            as virtrdf:Toronto-University ;
-                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
-                            as virtrdf:Toronto-Subject
-                            .
-        th:TorontoInstructor (torontos.No_)
-                        a th:Instructor
-                                as virtrdf:Toronto-Instructor ;
-                        foaf:name torontos.instructorName
-                            as virtrdf:Toronto-InstructorName ;
-                        foaf:mbox torontos.instructorEmail
-                            as virtrdf:Toronto-InstructorEmail
-                .
-        th:TorontoLecture (torontos.No_)
-                        a event:Event
-                                as virtrdf:Toronto-Lecture ;
-                        event:place th:TorontoPlace(torontos.No_)
-                            as virtrdf:Toronto-hasPlace
-                .
-        th:TorontoPlace (torontos.No_)
-                        a geo:Point
-                                as virtrdf:Toronto-Place ;
-                        dc:title torontos.location
-                            as virtrdf:Toronto-Location
-                .
-
-                th:Ucsd (ucsds.Number)
-                        a th:Course
-                                as virtrdf:Ucsd-Course ;
-                        dc:title ucsds.Title
-                            as virtrdf:Ucsd-Title ;
-                        th:hasInstructor1 th:UcsdInstructor1 (ucsds.Number)
-                            as virtrdf:Ucsd-hasInstructor1 ;
-                        th:hasInstructor2 th:UcsdInstructor2 (ucsds.Number)
-                            as virtrdf:Ucsd-hasInstructor2 ;
-                        th:hasInstructor3 th:UcsdInstructor3 (ucsds.Number)
-                            as virtrdf:Ucsd-hasInstructor3 ;
-                        th:forUniversity "http://purl.org/thalia/university/ucsd"
-                            as virtrdf:Ucsd-University ;
-                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
-                            as virtrdf:Ucsd-Subject
-                            .
-                th:UcsdInstructor1 (ucsds.Number)
-                        a th:Instructor
-                                as virtrdf:Ucsd-Instructor1 ;
-                        foaf:name ucsds.Fall2003
-                            as virtrdf:Ucsd-Instructor-Fall2003
-                            .
-                th:UcsdInstructor2 (ucsds.Number)
-                        a th:Instructor
-                                as virtrdf:Ucsd-Instructor2 ;
-                        foaf:name ucsds.Winter2004
-                            as virtrdf:Ucsd-Instructor-Winter2004
-                            .
-                th:UcsdInstructor3 (ucsds.Number)
-                        a th:Instructor
-                                as virtrdf:Ucsd-Instructor3 ;
-                        foaf:name ucsds.Spring2004
-                            as virtrdf:Ucsd-Instructor-Spring2004
-                            .
-
-                th:Umd (umds.Code)
-                    a th:Course
-                        as virtrdf:Umd-Course ;
-                    dc:title umds.CourseName
-                        as virtrdf:Umd-Title ;
-                        th:hasSection th:SectionTitle
-                            as virtrdf:Umd-hasSection ;
-                        th:hasLecture th:UmdLecture(umds.Code)
-                            as virtrdf:Umd-hasLecture ;
-                        th:forUniversity "http://purl.org/thalia/university/umd"
-                            as virtrdf:Umd-University ;
-                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
-                            as virtrdf:Umd-Subject
-                            .
-        th:UmdLecture (umds.Code)
-                        a event:Event
-                                as virtrdf:Umd-Lecture ;
-                        event:time th:UmdEventTime(umds.Code)
-                            as virtrdf:Umd-hasEventTime
-                .
-        th:UmdEventTime (umds.Code)
-                        a time:Interval
-                                as virtrdf:Umd-EventTime ;
-                        time:inDateTime th:UmdDatetime(umds.Code)
-                            as virtrdf:Umd-inDateTime
-                .
-        th:UmdDatetime (umds.Code)
-                        a time:DateTimeDescription
-                                as virtrdf:Umd-Datetime ;
-                    time:hour umds.SectionTime
-                        as virtrdf:Umd-SectionTime
-                .
-        }
-}
-')
-;
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'tut_th_%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'tut_th_%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'tut_th_rule1',
-    1,
-    '([^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s%%01this',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
- );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'tut_th_rule2',
-    1,
-    '([^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/thalia%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'tut_th_rule3',
-    1,
-    '(/[^#]*)/\x24',
-    vector('path'),
-    1,
-    '%U',
-    vector('path'),
-    null,
-    null,
-    0,
-    null
-    );
-
-create procedure DB.DBA.REMOVE_THALIA_RDF_DET()
-  {
-  declare colid int;
-  colid := DAV_SEARCH_ID('/DAV/Thalia', 'C');
-  if (colid < 0)
-    return;
-  update WS.WS.SYS_DAV_COL set COL_DET=null where COL_ID = colid;
-  }
-;
-
-DB.DBA.REMOVE_THALIA_RDF_DET();
-
-drop procedure DB.DBA.REMOVE_THALIA_RDF_DET;
-
-create procedure DB.DBA.THALIA_MAKE_RDF_DET()
-  {
-    declare uriqa_str varchar;
-    uriqa_str := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
-    uriqa_str := 'http://' || uriqa_str || '/thalia';
-    DB.DBA."RDFData_MAKE_DET_COL" ('/DAV/Thalia/RDFData/', uriqa_str, NULL);
-    VHOST_REMOVE (lpath=>'/thalia/data/rdf');
-    DB.DBA.VHOST_DEFINE (lpath=>'/thalia/data/rdf', ppath=>'/DAV/Thalia/RDFData/All/', is_dav=>1, vsp_user=>'dba');
-  }
-;
-
-DB.DBA.THALIA_MAKE_RDF_DET();
-
-drop procedure DB.DBA.THALIA_MAKE_RDF_DET;
-
--- procedure to convert path to DET resource name
-create procedure DB.DBA.THALIA_DET_REF (in par varchar, in fmt varchar, in val varchar)
-  {
-  declare res, iri any;
-  declare uriqa_str varchar;
-  uriqa_str := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
-  uriqa_str := 'http://' || uriqa_str || '/thalia';
-  iri := uriqa_str || replace(val, '/', '_');
-  res := sprintf ('iid (%d).rdf', iri_id_num (iri_to_id (iri)));
-  return sprintf (fmt, res);
-  }
-;
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('tut_th_rdf', 1,
-    '/thalia/(.*)', vector('path'), 1,
-    '/thalia/data/rdf/%U', vector('path'),
-    'DB.DBA.THALIA_DET_REF',
-    'application/rdf.xml',
-    2,
-    303);
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'tut_th_rule_list1',
-    1,
-    vector (
-                'tut_th_rule1',
-                'tut_th_rule2',
-                'tut_th_rule3',
-                'tut_th_rdf'
-          ));
-
-DB.DBA.VHOST_REMOVE (lpath=>'/thalia');
-DB.DBA.VHOST_DEFINE (lpath=>'/thalia', ppath=>'/DAV/Thalia/', vsp_user=>'dba', is_dav=>1,
-           is_brws=>0, opts=>vector ('url_rewrite', 'tut_th_rule_list1'));
-
-create procedure DB.DBA.LOAD_THALIA_ONTOLOGY_FROM_DAV()
-  {
-	declare content, urihost varchar;
-	select cast (RES_CONTENT as varchar) into content from WS.WS.SYS_DAV_RES where RES_FULL_PATH = '/DAV/Thalia/thalia.owl';
-	DB.DBA.RDF_LOAD_RDFXML (content, 'http://demo.openlinksw.com/schemas/thalia#', 'http://demo.openlinksw.com/schemas/ThaliaOntology/1.0/');
-	urihost := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
-	if (urihost = 'demo.openlinksw.com')
-	{
-		DB.DBA.VHOST_REMOVE (lpath=>'/schemas/thalia');
-		DB.DBA.VHOST_DEFINE (lpath=>'/schemas/thalia', ppath=>'/DAV/Thalia/thalia.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
-  }
-}
-;
-DB.DBA.LOAD_THALIA_ONTOLOGY_FROM_DAV()
-;
-drop procedure DB.DBA.LOAD_THALIA_ONTOLOGY_FROM_DAV
-;
-
-DB.DBA.XML_SET_NS_DECL ('thalia', 'http://demo.openlinksw.com/schemas/thalia#', 2)
-;
-
-
-    * Demo : Thalia test queries
-
-
-#service:/sparql
-#should-sponge:soft
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX time: <http://www.w3.org/2006/time#>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX th: <http://purl.org/ontology/thalia/1.0/>
-
-SELECT distinct ?room
-FROM <http://demo.openlinksw.com/thalia>
-WHERE
-  {
-    ?course a th:Course;
-              dc:title ?title;
-	      th:hasLecture ?lecture.
-    ?lecture event:place [dc:title ?room].
-    FILTER regex(?title, "Software Engineering")
-  }
-
-
-#service:/sparql
-#should-sponge:soft
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX time: <http://www.w3.org/2006/time#>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX th: <http://purl.org/ontology/thalia/1.0/>
-
-SELECT ?day, ?hour ?course
-FROM <http://demo.openlinksw.com/thalia>
-WHERE
-    {
-    ?course a th:Course;
-    th:hasLecture [event:time ?time];
-    dc:title ?title.
-    ?time time:inDateTime [time:dayOfWeek ?day];
-    time:inDateTime [time:hour ?hour].
-    FILTER regex(?title, "Computer Networks")
-    }
-
-
-
-#service:/sparql
-#should-sponge:soft
-
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX time: <http://www.w3.org/2006/time#>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX th: <http://purl.org/ontology/thalia/1.0/>
-
-SELECT distinct ?course
-FROM <http://demo.openlinksw.com/thalia>
-WHERE
-    {
-    ?course a th:Course;
-              dc:title ?Title;
-              th:hasLecture ?lecture.
-    ?lecture event:time [time:inDateTime ?dateTime].
-    ?dateTime time:hour ?hour.
-    FILTER regex(?Title, "Database System")
-    FILTER regex(?hour, "1:30 - 2:50")
-    }
-
-
-#service:/sparql
-#should-sponge:soft
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX time: <http://www.w3.org/2006/time#>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX th: <http://purl.org/ontology/thalia/1.0/>
-
-SELECT distinct ?course ?instructor ?name
-FROM <http://demo.openlinksw.com/thalia>
-WHERE
-{
-    ?course a th:Course;
-              th:hasInstructor ?instructor.
-    ?instructor foaf:name ?name.
-
-  }
-
-
-#service:/sparql
-#should-sponge:soft
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX time: <http://www.w3.org/2006/time#>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX th: <http://purl.org/ontology/thalia/1.0/>
-
-SELECT distinct ?instructor
-FROM <http://demo.openlinksw.com/thalia>
-WHERE
-        {
-    ?course a th:Course;
-	      th:hasInstructor ?instructor;
-	      dc:title  ?title.
-    FILTER regex(?title, "Database")
-  }
-
-
-#service:/sparql
-#should-sponge:soft
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX time: <http://www.w3.org/2006/time#>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX th: <http://purl.org/ontology/thalia/1.0/>
-
-SELECT distinct ?instructor
-FROM <http://demo.openlinksw.com/thalia>
-WHERE
-{
-    ?course a th:Course;
-              dc:title ?title;
-              th:hasInstructor ?instructor.
-    FILTER regex(?title, "Software")
-  }
-
-
-#service:/sparql
-#should-sponge:soft
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX time: <http://www.w3.org/2006/time#>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX th: <http://purl.org/ontology/thalia/1.0/>
-
-SELECT DISTINCT ?course
-FROM <http://demo.openlinksw.com/thalia>
-WHERE
-  {
-    ?course a th:Course;
-              dc:title ?title;
-              th:forUniversity 'http://purl.org/thalia/university/umd'.
-    FILTER regex(?title, "Data Structures")
-  }
-
-
-#service:/sparql
-#should-sponge:soft
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX time: <http://www.w3.org/2006/time#>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX th: <http://purl.org/ontology/thalia/1.0/>
-
-SELECT distinct ?course
-FROM <http://demo.openlinksw.com/thalia>
-WHERE
-  {
-    ?course a th:Course;
-              dc:title ?Title;
-              th:hasUnits ?credits.
-    FILTER (xsd:integer(?credits) > 10)
-    FILTER regex(?Title, "Database")
-  }
-
-
-#service:/sparql
-#should-sponge:soft
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX time: <http://www.w3.org/2006/time#>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX th: <http://purl.org/ontology/thalia/1.0/>
-
-SELECT distinct ?course
-FORM <http://demo.openlinksw.com/thalia>
-WHERE
-  {
-    ?course a th:Course;
-              dc:title ?title;
-              th:forUniversity 'http://purl.org/thalia/university/umd'.
-    FILTER regex(?title, "Database")
-  }
-
-
-#service:/sparql
-#should-sponge:soft
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX time: <http://www.w3.org/2006/time#>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX th: <http://purl.org/ontology/thalia/1.0/>
-
-SELECT distinct ?course
-FROM <http://demo.openlinksw.com/thalia>
-WHERE
-  {
-    ?course a th:Course;
-              dc:title ?Title;
-              th:hasUnits ?credits.
-    FILTER (xsd:integer(?credits) > 10)
-    FILTER regex(?Title, "Database")
-  }
-
-
-#service:/sparql
-#should-sponge:soft
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX time: <http://www.w3.org/2006/time#>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX th: <http://purl.org/ontology/thalia/1.0/>
-
-SELECT distinct ?text_
-FROM <http://demo.openlinksw.com/thalia>
-WHERE
-  {
-    ?course a th:Course;
-             dc:title ?title;
-             th:text ?text_.
-    FILTER regex(?title, "Verification")
-  }
-
-
-#service:/sparql
-#should-sponge:soft
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX owl: <http://www.w3.org/2002/07/owl#>
-PREFIX dc: <http://purl.org/dc/elements/1.1/>
-PREFIX time: <http://www.w3.org/2006/time#>
-PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-PREFIX : <http://purl.org/ontology/thalia/1.0/>
-
-SELECT distinct ?course
-FROM <http://demo.openlinksw.com/thalia>
-WHERE
-  {
-    ?course a th:Course;
-              dc:description ?description;
-              th:forUniversity 'http://purl.org/thalia/university/gatech'.
-    FILTER regex(?description, "JR")
-  }
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfviewsbusintmbr">
-      <title>Musicbrainz to RDF</title>
-<para>The following code creates the Musicbrainz RDF Views Deployment and Demo Scripts:</para>
-<programlisting><![CDATA[
-create text index on ZITGIST.MO.artist ("name") with key id;
-create text index on ZITGIST.MO.artistalias ("name") with key id;
-create text index on ZITGIST.MO.album ("name") with key id;
-create text index on ZITGIST.MO.track ("name") with key id;
-vt_batch_update (fix_identifier_case ('ZITGIST.MO.artist'), 'ON', NULL);
-vt_batch_update (fix_identifier_case ('ZITGIST.MO.artistalias'), 'ON', NULL);
-vt_batch_update (fix_identifier_case ('ZITGIST.MO.album'), 'ON', NULL);
-vt_batch_update (fix_identifier_case ('ZITGIST.MO.track'), 'ON', NULL);
-VT_INC_INDEX_DB_MO_artist ();
-VT_INC_INDEX_DB_MO_artistalias ();
-VT_INC_INDEX_DB_MO_album ();
-VT_INC_INDEX_DB_MO_track ();
-]]></programlisting>
-<para>Note: Making sure that the graphs and views are deleting to clean Virtuoso from the old definitions</para>
-<programlisting><![CDATA[
-SPARQL
-drop quad storage virtrdf:MBZROOT.
-;
-
-SPARQL
-prefix mbz: <http://musibrainz.org/schemas/mbz#>
-drop literal class mbz:duration
-;
-
-SPARQL
-prefix mbz: <http://musibrainz.org/schemas/mbz#>
-drop literal class mbz:created.
-drop literal class mbz:official_iri.
-drop literal class mbz:bootleg_iri.
-drop literal class mbz:promotion_iri.
-drop literal class mbz:album_iri.
-drop literal class mbz:single_iri.
-drop literal class mbz:ep_iri.
-drop literal class mbz:compilation_iri.
-drop literal class mbz:soundtrack_iri.
-drop literal class mbz:spokenword_iri.
-drop literal class mbz:interview_iri.
-drop literal class mbz:audiobook_iri.
-drop literal class mbz:live_iri.
-drop literal class mbz:remix_iri.
-;
-]]></programlisting>
-<para>The following SPARQL query will fix an issue Virtuoso has with its JSO system. Perform this query for now, the issue should be fixed in a future release</para>
-<programlisting><![CDATA[
-SPARQL define input:storage ""
-DELETE FROM GRAPH (iri(bif:JSO_SYS_GRAPH NIL)) { ?s virtrdf:version ?o }
-WHERE { graph `iri(bif:JSO_SYS_GRAPH NIL)` {?s virtrdf:version ?o}};
-SPARQL_RELOAD_QM_GRAPH();
-]]></programlisting>
-<para>Creation of IRIs classes.</para>
-<programlisting><![CDATA[
-SPARQL
-
-prefix mbz: <http://musibrainz.org/schemas/mbz#>
-prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-prefix dc: <http://purl.org/dc/elements/1.1/>
-prefix bio: <http://vocab.org/bio/0.1/#>
-prefix rel: <http://vocab.org/relationship/#>
-prefix mo: <http://purl.org/ontology/mo/>
-prefix timeline: <http://purl.org/NET/c4dm/timeline.owl#>
-prefix event: <http://purl.org/NET/c4dm/event.owl#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix sim: <http://purl.org/ontology/sim/>
-
-create iri class mbz:artist_iri  "http://zitgist.com/music/artist/%U" (in gid varchar not null) option (bijection) .
-create iri class mbz:artist_birth_event_iri  "http://zitgist.com/music/artist/birth/%U" (in gid varchar not null) option (bijection) .
-create iri class mbz:artist_death_event_iri  "http://zitgist.com/music/artist/death/%U" (in gid varchar not null) option (bijection) .
-create iri class mbz:sim_link_iri  "http://zitgist.com/music/artist/simlink/%U" (in gid varchar not null) option (bijection) .
-
-#create iri class mbz:band_iri  "http://zitgist.com/music/band/%U" (in gid varchar not null) option (bijection) .
-#create iri class mbz:band_birth_event_iri  "http://zitgist.com/music/band/birth/%U" (in gid varchar not null) option (bijection) .
-#create iri class mbz:band_death_event_iri  "http://zitgist.com/music/band/death/%U" (in gid varchar not null) option (bijection) .
-
-create iri class mbz:record_iri  "http://zitgist.com/music/record/%U" (in gid varchar not null) option (bijection) .
-create iri class mbz:performance_iri  "http://zitgist.com/music/performance/%U" (in gid varchar not null) option (bijection) .
-create iri class mbz:composition_iri  "http://zitgist.com/music/composition/%U" (in gid varchar not null) option (bijection) .
-create iri class mbz:musicalwork_iri  "http://zitgist.com/music/musicalwork/%U" (in gid varchar not null) option (bijection) .
-create iri class mbz:sound_iri  "http://zitgist.com/music/sound/%U" (in gid varchar not null) option (bijection) .
-create iri class mbz:recording_iri  "http://zitgist.com/music/recording/%U" (in gid varchar not null) option (bijection) .
-create iri class mbz:signal_iri  "http://zitgist.com/music/signal/%U" (in gid varchar not null) option (bijection) .
-
-create iri class mbz:track_iri  "http://zitgist.com/music/track/%U" (in gid varchar not null) option (bijection) .
-
-create iri class mbz:image_iri  "http://ec1.images-amazon.com/images/P/%U.01.MZZZZZZZ.jpg" (in image varchar not null) option (bijection) .
-
-create iri class mbz:amazon_asin_iri  "http://amazon.com/exec/obidos/ASIN/%U/searchcom07-20" (in gid varchar not null) option (bijection) .
-
-
-create literal class mbz:created using
-    function ZITGIST.MO.RECORD_CREATION_DATE (in datestring varchar) returns varchar,
-    function ZITGIST.MO.RECORD_CREATION_DATE_INVERSE (in datestring varchar) returns varchar .
-
-create iri class mbz:official_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_OFFICIAL (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/official') .
-
-create iri class mbz:promotion_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_PROMOTION (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/promotion') .
-
-create iri class mbz:bootleg_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_BOOTLEG (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/bootleg') .
-
-create iri class mbz:album_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_ALBUM (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/album') .
-
-create iri class mbz:single_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_SINGLE (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/single') .
-
-create iri class mbz:ep_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_EP (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/ep') .
-
-create iri class mbz:compilation_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_COMPILATION (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/compilation') .
-
-create iri class mbz:soundtrack_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_SOUNDTRACK (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/soundtrack') .
-
-create iri class mbz:spokenword_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_SPOKENWORD (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/spokenword') .
-
-create iri class mbz:interview_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_INTERVIEW (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/interview') .
-
-create iri class mbz:audiobook_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_AUDIOBOOK (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/audiobook') .
-
-create iri class mbz:live_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_LIVE (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/live') .
-
-create iri class mbz:remix_iri using
-    function ZITGIST.MO.RECORD_ATTRIBUTE_REMIX (in attributes varchar) returns varchar
-    option (returns 'http://purl.org/ontology/mo/remix') .
-
-create iri class mbz:duration_iri  "http://zitgist.com/music/track/duration/%U" (in gid varchar not null) .
-
-create literal class mbz:duration using
-    function ZITGIST.MO.TRACK_DURATION (in duration integer) returns varchar ,
-    function ZITGIST.MO.TRACK_DURATION_INVERSE (in durationXSD varchar) returns integer .
-
-create iri class mbz:geoname_country_iri  "http://www.geonames.org/countries/#%U" (in country varchar not null) .
-
-create iri class mbz:url_iri  "%s" (in url varchar not null) .
-create iri class mbz:mbz_release_url_iri  "http://musicbrainz.org/release/%s.html" (in mbz_gid varchar not null) .
-create iri class mbz:mbz_track_url_iri  "http://musicbrainz.org/track/%s.html" (in mbz_gid varchar not null) .
-create iri class mbz:mbz_artist_url_iri  "http://musicbrainz.org/artist/%s.html" (in mbz_gid varchar not null) .
-;
-]]></programlisting>
-<para><emphasis>List of functions used to compute some IRI classes:</emphasis></para>
-<para>Note:These functions have been developed to handle some weird user cases of the Musicbrainz data model (like the Attribute column of the album table, etc).</para>
-<programlisting><![CDATA[
-create function ZITGIST.MO.TRACK_DURATION_INVERSE(in durationXSD varchar)
-{
-    return null;
-};
-
-create function ZITGIST.MO.TRACK_DURATION(in duration integer)
-{
-    declare minutes, seconds, milliseconds integer;
-
-    minutes := ((duration / 1000) / 60);
-
-    if(minutes >= 1)
-    {
-        minutes := cast(minutes as integer);
-    }
-    else
-    {
-        minutes := 0;
-    }
-
-    seconds := (duration / 1000) - (minutes * 60);
-
-    if(seconds >= 1)
-    {
-        seconds := cast(seconds as integer);
-    }
-
-    milliseconds := duration - (seconds * 1000) - (minutes * 60000);
-
-    return sprintf('PT%dM%dS', minutes, seconds);
-}
-;
-
-
-create function ZITGIST.MO.RECORD_CREATION_DATE(in datestring varchar)
-{
-    return sprintf('%sT00:00:00Z', datestring);
-};
-
-create function ZITGIST.MO.RECORD_CREATION_DATE_INVERSE(in datestring varchar)
-{
-    declare pos integer;
-    pos := locate('T00:00:00Z', datestring) - 1;
-    return substring(datestring, 1, pos);
-};
-
-
-create function ZITGIST.MO.RECORD_ATTRIBUTE(in attribute integer, in attributes varchar)
-{
-    declare attributes_array any;
-
-    attributes_array := split_and_decode(ltrim(rtrim(attributes, '}'), '{'), 0, '\0\0,');
-
-    foreach(int attr in attributes_array) do
-    {
-        attr := cast(attr as integer);
-        if(attr = attribute)
-        {
-            if(attr = 100) return 'http://purl.org/ontology/mo/official';
-            if(attr = 101) return 'http://purl.org/ontology/mo/promotion';
-            if(attr = 102) return 'http://purl.org/ontology/mo/bootleg';
-            if(attr = 1)   return 'http://purl.org/ontology/mo/album';
-            if(attr = 2)   return 'http://purl.org/ontology/mo/single';
-            if(attr = 3)   return 'http://purl.org/ontology/mo/ep';
-            if(attr = 4)   return 'http://purl.org/ontology/mo/compilation';
-            if(attr = 5)   return 'http://purl.org/ontology/mo/soundtrack';
-            if(attr = 6)   return 'http://purl.org/ontology/mo/spokenword';
-            if(attr = 7)   return 'http://purl.org/ontology/mo/interview';
-            if(attr = 8)   return 'http://purl.org/ontology/mo/audiobook';
-            if(attr = 9)   return 'http://purl.org/ontology/mo/live';
-            if(attr = 10)  return 'http://purl.org/ontology/mo/remix';
-        }
-    }
-    return null;
-}
-;
-
-create function ZITGIST.MO.RECORD_ATTRIBUTE_OFFICIAL(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(100, attributes); }
-;
-create function ZITGIST.MO.RECORD_ATTRIBUTE_PROMOTION(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(101, attributes);}
-;
-create function ZITGIST.MO.RECORD_ATTRIBUTE_BOOTLEG(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(102, attributes);}
-;
-create function ZITGIST.MO.RECORD_ATTRIBUTE_ALBUM(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(1, attributes);}
-;
-create function ZITGIST.MO.RECORD_ATTRIBUTE_SINGLE(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(2, attributes);}
-;
-create function ZITGIST.MO.RECORD_ATTRIBUTE_EP(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(3, attributes);}
-;
-create function ZITGIST.MO.RECORD_ATTRIBUTE_COMPILATION(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(4, attributes);}
-;
-create function ZITGIST.MO.RECORD_ATTRIBUTE_SOUNDTRACK(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(5, attributes);}
-;
-create function ZITGIST.MO.RECORD_ATTRIBUTE_SPOKENWORD(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(6, attributes);}
-;
-create function ZITGIST.MO.RECORD_ATTRIBUTE_INTERVIEW(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(7, attributes);}
-;
-create function ZITGIST.MO.RECORD_ATTRIBUTE_AUDIOBOOK(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(8, attributes);}
-;
-create function ZITGIST.MO.RECORD_ATTRIBUTE_LIVE(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(9, attributes);}
-;
-create function ZITGIST.MO.RECORD_ATTRIBUTE_REMIX(in attributes varchar)
-{    return ZITGIST.MO.RECORD_ATTRIBUTE(10, attributes);}
-;
-]]></programlisting>
-<para><emphasis>Definition of the quad map patterns</emphasis></para>
-<para>This what creates the RDF triples from the musicbrainz relational database schema.</para>
-<programlisting><![CDATA[
-SPARQL
-prefix mbz: <http://musibrainz.org/schemas/mbz#>
-prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-prefix dc: <http://purl.org/dc/elements/1.1/>
-prefix dcterms: <http://purl.org/dc/terms/>
-prefix bio: <http://vocab.org/bio/0.1/#>
-prefix rel: <http://vocab.org/relationship/#>
-prefix mo: <http://purl.org/ontology/mo/>
-prefix timeline: <http://purl.org/NET/c4dm/timeline.owl#>
-prefix event: <http://purl.org/NET/c4dm/event.owl#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix sim: <http://purl.org/ontology/sim/>
-
-create quad storage virtrdf:MBZROOT
-
-
-#
-# Definition of the source tables from the mbz relational database and their joints.
-#########
-
-FROM ZITGIST.MO.track as track text literal name
-FROM ZITGIST.MO.artist as track_artist
-FROM ZITGIST.MO.puid as track_puid
-FROM ZITGIST.MO.track as track_track
-FROM ZITGIST.MO.url as track_url
-
-FROM ZITGIST.MO.artist as track_artist_creator where (^{track.}^.artist = ^{track_artist_creator.}^.id)
-
-FROM ZITGIST.MO.albumjoin as track_albumjoin where (^{track.}^.id = ^{track_albumjoin.}^.track)
-
-FROM ZITGIST.MO.l_artist_track as l_artist_track2 where (^{track.}^.id = ^{l_artist_track2.}^.link1)
-                                                      where (^{track_artist.}^.id = ^{l_artist_track2.}^.link0)
-
-
-FROM ZITGIST.MO.puidjoin as puidjoin where (^{track.}^.id = ^{puidjoin.}^.track)
-                                         where (^{puidjoin.}^.puid = ^{track_puid.}^.id)
-
-
-FROM ZITGIST.MO.l_track_track as l_track_track where (^{track.}^.id = ^{l_track_track.}^.link0)
-                                                   where (^{track_track.}^.id = ^{l_track_track.}^.link1)
-
-
-FROM ZITGIST.MO.l_track_url as l_track_url where (^{track.}^.id = ^{l_track_url.}^.link0)
-                                               where (^{track_url.}^.id = ^{l_track_url.}^.link1)
-
-
-
-FROM ZITGIST.MO.album as album text literal name
-FROM ZITGIST.MO.artist as album_artist
-FROM ZITGIST.MO.album as album_album
-FROM ZITGIST.MO.url as album_url
-FROM ZITGIST.MO.country as album_release_country
-FROM ZITGIST.MO.track as album_albumjoin_track
-
-FROM ZITGIST.MO.artist as album_artist_creator where (^{album.}^.artist = ^{album_artist_creator.}^.id)
-
-FROM ZITGIST.MO.album_amazon_asin as album_amazon_asin where (^{album.}^.id = ^{album_amazon_asin.}^.album)
-
-
-FROM ZITGIST.MO.albumjoin as album_albumjoin where (^{album.}^.id = ^{album_albumjoin.}^.album)
-                                                 where (^{album_albumjoin.}^.track = ^{album_albumjoin_track.}^.id)
-
-
-FROM ZITGIST.MO.l_album_artist as l_album_artist2 where (^{album.}^.id = ^{l_album_artist2.}^.link0)
-                                                      where (^{album_artist.}^.id = ^{l_album_artist2.}^.link1)
-
-
-FROM ZITGIST.MO.l_album_album as l_album_album where (^{album.}^.id = ^{l_album_album.}^.link0)
-                                                   where (^{album_album.}^.id = ^{l_album_album.}^.link1)
-
-
-FROM ZITGIST.MO.l_album_url as l_album_url where (^{album.}^.id = ^{l_album_url.}^.link0)
-                                               where (^{album_url.}^.id = ^{l_album_url.}^.link1)
-
-
-FROM ZITGIST.MO.release as album_release where (^{album.}^.id = ^{album_release.}^.album)
-                                             where (^{album_release.}^.country = ^{album_release_country.}^.id)
-
-
-
-
-
-FROM ZITGIST.MO.artist as sim_band
-FROM ZITGIST.MO.artist as sim_artist
-FROM ZITGIST.MO.url as band_url
-FROM ZITGIST.MO.artist as band_member
-FROM ZITGIST.MO.album as band_album
-FROM ZITGIST.MO.track as band_track
-FROM ZITGIST.MO.artist as band text literal name where (^{band.}^.type = 2)
-#FROM ZITGIST.MO.artist as artist text literal name where (^{artist.}^.type <> 2)
-FROM ZITGIST.MO.artist as artist text literal name where (__or (neq(^{artist.}^.type, 2), isnull (^{artist.}^.type)))
-FROM ZITGIST.MO.artist as artist_untyped text literal name where (^{artist_untyped.}^.type <> 2)
-                                                      where (^{artist.}^.gid = ^{artist_untyped.}^.gid)
-
-
-
-FROM ZITGIST.MO.album as band_album_creatorOf where (^{band_album_creatorOf.}^.artist = ^{band.}^.id)
-FROM ZITGIST.MO.track as band_track_creatorOf where (^{band_track_creatorOf.}^.artist = ^{band.}^.id)
-
-FROM ZITGIST.MO.artistalias as bandalias text literal name where (^{band.}^.id = ^{bandalias.}^."ref")
-
-FROM ZITGIST.MO.l_artist_artist as band_l_artist_artist where (^{band_member.}^.id = ^{band_l_artist_artist.}^.link0)
-                                                            where (^{band.}^.id = ^{band_l_artist_artist.}^.link1)
-                                                            where (^{band_l_artist_artist.}^.link_type = 2)
-
-
-FROM ZITGIST.MO.artist_relation as band_relation
-where (^{artist.}^.id = ^{band_relation.}^.artist)
-where (^{band.}^.id = ^{band_relation.}^.artist)
-where (^{sim_band.}^.id = ^{band_relation.}^."ref")
-
-FROM ZITGIST.MO.artist_relation as artist_relation
-where (^{artist.}^.id = ^{artist_relation.}^.artist)
-where (^{band.}^.id = ^{artist_relation.}^.artist)
-where (^{sim_artist.}^.id = ^{artist_relation.}^."ref")
-
-
-
-FROM ZITGIST.MO.l_artist_url as l_artist_url3 where (^{band.}^.id = ^{l_artist_url3.}^.link0)
-                                                  where (^{band_url.}^.id = ^{l_artist_url3.}^.link1)
-
-
-FROM ZITGIST.MO.l_album_artist as l_album_artist3 where (^{band.}^.id = ^{l_album_artist3.}^.link1)
-                                                      where (^{band_album.}^.id = ^{l_album_artist3.}^.link0)
-
-
-FROM ZITGIST.MO.l_artist_track as l_artist_track3 where (^{band.}^.id = ^{l_artist_track3.}^.link0)
-                                                      where (^{band_track.}^.id = ^{l_artist_track3.}^.link1)
-
-FROM ZITGIST.MO.url as artist_url
-FROM ZITGIST.MO.artist as artist_artist
-FROM ZITGIST.MO.track as artist_track
-FROM ZITGIST.MO.album as artist_album
-
-FROM ZITGIST.MO.album as artist_album_creatorOf where (^{artist_album_creatorOf.}^.artist = ^{artist.}^.id)
-FROM ZITGIST.MO.track as artist_track_creatorOf where (^{artist_track_creatorOf.}^.artist = ^{artist.}^.id)
-
-FROM ZITGIST.MO.artistalias as artistalias text literal name where (^{artist.}^.id = ^{artistalias.}^."ref")
-FROM ZITGIST.MO.l_artist_url as l_artist_url where (^{artist.}^.id = ^{l_artist_url.}^.link0)
-                                                 where (^{artist_url.}^.id = ^{l_artist_url.}^.link1)
-
-FROM ZITGIST.MO.l_artist_artist as l_artist_artist where (^{artist.}^.id = ^{l_artist_artist.}^.link0)
-                                                       where (^{artist_artist.}^.id = ^{l_artist_artist.}^.link1)
-
-FROM ZITGIST.MO.l_artist_track as l_artist_track where (^{artist.}^.id = ^{l_artist_track.}^.link0)
-                                                     where (^{artist_track.}^.id = ^{l_artist_track.}^.link1)
-FROM ZITGIST.MO.l_album_artist as l_album_artist where (^{artist.}^.id = ^{l_album_artist.}^.link1)
-                                                     where (^{artist_album.}^.id = ^{l_album_artist.}^.link0)
-
-{
-  create virtrdf:MBZ as graph iri ("http://musicbrainz.org/") option (exclusive)
-        {
-
-        # Track Composition Event
-        mbz:composition_iri (track.gid)
-            a mo:Composition as mbz:track_is_composition;
-            dc:title track.name as mbz:title_of_track;
-            mo:composer mbz:artist_iri (track_artist_creator.gid) as mbz:creator_composer_of_track;
-            mo:composer mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 14) option (using l_artist_track2) as mbz:composer14_of_track;
-            mo:producesWork mbz:musicalwork_iri (track.gid) as mbz:track_producesWork.
-
-        # Track Musical Work
-        mbz:musicalwork_iri (track.gid)
-            a mo:MusicalWork as mbz:track_is_mw;
-            dc:title track.name as mbz:name_of_mw;
-
-            mo:productOfComposition mbz:composition_iri(track.gid) as mbz:mw_is_productOfComposition_of;
-            mo:usedInPerformance mbz:performance_iri(track.gid) as mbz:mw_usedInPerformance.
-
-        # Track Performance Event
-        mbz:performance_iri (track.gid)
-            a mo:Performance;
-            dc:title track.name;
-            mo:performer mbz:artist_iri (track_artist_creator.gid);
-            mo:performer mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 2) option (using l_artist_track2);
-            mo:conductor mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 9) option (using l_artist_track2);
-
-            mo:usesWork mbz:musicalwork_iri (track.gid);
-            mo:producesSound mbz:sound_iri (track.gid);
-
-            mo:recordedAs mbz:signal_iri(track.gid).
-
-        # Track Sound
-        mbz:sound_iri (track.gid)
-            a mo:Sound;
-            dc:title track.name;
-
-            mo:productOfPerformance mbz:performance_iri (track.gid);
-            mo:usedInRecording mbz:recording_iri (track.gid).
-
-        # Track Recording Event
-        mbz:recording_iri (track.gid)
-            a mo:Recording;
-            dc:title track.name;
-
-            mo:recordsSound mbz:sound_iri (track.gid);
-            mo:producesSignal mbz:signal_iri (track.gid).
-
-        # Track Signal (Musical Expression)
-        mbz:signal_iri (track.gid)
-            a mo:Signal;
-            dc:title track.name;
-
-            mo:remixer mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 11) option (using l_artist_track2);
-            mo:sampler mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 12) option (using l_artist_track2);
-            mo:djmixed mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 40) option (using l_artist_track2);
-
-            mo:djmix_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 13) option (using l_track_track);
-            mo:remix_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 6) option (using l_track_track);
-            mo:remix_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 11) option (using l_track_track);
-            mo:mashup_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 8) option (using l_track_track);
-            mo:mashup_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 4) option (using l_track_track);
-            mo:remaster_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 3) option (using l_track_track);
-            mo:compilation_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 10) option (using l_track_track);
-            mo:compilation_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 12) option (using l_track_track);
-            mo:medley_of mbz:record_iri (track_track.gid) where (^{l_track_track.}^.link_type = 14) option (using l_track_track);
-
-            mo:published_as mbz:track_iri (track.gid);
-            mo:signalTime mbz:duration_iri(track.gid);
-            mo:puid track_puid.puid option (using puidjoin).
-
-        # Track duration
-        mbz:duration_iri(track.gid)
-            a timeline:Interval;
-            timeline:durationXSD mbz:duration(track.length).
-
-
-        mbz:track_iri(track.gid)
-            a mo:Track;
-            dc:title track.name;
-
-            mo:trackNum track_albumjoin.sequence;
-
-
-            dc:creator mbz:artist_iri (track_artist_creator.gid);
-            dc:creator mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 14) option (using l_artist_track2);
-			mo:compiler mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 39) option (using l_artist_track2);
-            mo:producer mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 18) option (using l_artist_track2);
-            mo:publisher mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 35) option (using l_artist_track2);
-            mo:engineer mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 19) option (using l_artist_track2);
-
-
-            mo:licence mbz:url_iri(track_url.url) where (^{l_track_url.}^.link_type = 21) option (using l_track_url);
-            mo:paiddownload mbz:url_iri(track_url.url) where (^{l_track_url.}^.link_type = 16) option (using l_track_url);
-            mo:freedownload mbz:url_iri(track_url.url) where (^{l_track_url.}^.link_type = 17) option (using l_track_url);
-            mo:olga mbz:url_iri(track_url.url) where (^{l_track_url.}^.link_type = 19) option (using l_track_url);
-
-            mo:musicbrainz mbz:mbz_track_url_iri(track.gid);
-
-            mo:duration track.length.
-
-        # Record Composition Event
-        mbz:composition_iri (album.gid)
-            a mo:Composition;
-            dc:title album.name;
-
-            mo:composer mbz:artist_iri (album_artist_creator.gid);
-            mo:composer mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 14) option (using l_album_artist2);
-
-            mo:producesWork mbz:musicalwork_iri (album.gid).
-
-        # Record Musical Work
-        mbz:musicalwork_iri (album.gid)
-            a mo:MusicalWork;
-            dc:title album.name;
-
-            mo:productOfComposition mbz:composition_iri(album.gid);
-            mo:usedInPerformance mbz:performance_iri(album.gid).
-
-
-        # Record Performance Event
-        mbz:performance_iri (album.gid)
-            a mo:Performance;
-            dc:title album.name;
-            mo:performer mbz:artist_iri (album_artist_creator.gid);
-            mo:performer mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 2) option (using l_album_artist2);
-            mo:conductor mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 9) option (using l_album_artist2);
-
-            mo:usesWork mbz:musicalwork_iri (album.gid);
-            mo:producesSound mbz:sound_iri (album.gid);
-
-            mo:recordedAs mbz:record_iri(album.gid).
-
-
-        # Record Sound
-        mbz:sound_iri (album.gid)
-            a mo:Sound;
-            dc:title album.name;
-
-            mo:productOfPerformance mbz:performance_iri (album.gid);
-            mo:usedInRecording mbz:recording_iri (album.gid).
-
-        # Record Recording Event
-        mbz:recording_iri (album.gid)
-            a mo:Recording;
-            dc:title album.name;
-
-            mo:recordsSound mbz:sound_iri (album.gid);
-            mo:producesSignal mbz:signal_iri (album.gid).
-
-        # Record Signal (Musical Expression)
-        mbz:signal_iri (album.gid)
-            a mo:Signal;
-            dc:title album.name;
-
-            mo:djmix_of mbz:record_iri (album_album.gid) where (^{l_album_album.}^.link_type = 9) option (using l_album_album);
-            mo:remix_of mbz:record_iri (album_album.gid) where (^{l_album_album.}^.link_type = 7) option (using l_album_album);
-            mo:remix_of mbz:record_iri (album_album.gid) where (^{l_album_album.}^.link_type = 4) option (using l_album_album);
-            mo:mashup_of mbz:record_iri (album_album.gid) where (^{l_album_album.}^.link_type = 5) option (using l_album_album);
-            mo:remaster_of mbz:record_iri (album_album.gid) where (^{l_album_album.}^.link_type = 3) option (using l_album_album);
-            mo:tribute_to mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 44) option (using l_album_artist2);
-
-            mo:remixer mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 11) option (using l_album_artist2);
-            mo:djmixed mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 38) option (using l_album_artist2);
-            mo:sampler mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 12) option (using l_album_artist2);
-
-            mo:published_as mbz:record_iri (album.gid).
-
-
-        # Record (Musical Manifestation)
-        mbz:record_iri (album.gid)
-            a mo:Record;
-            dc:title album.name;
-
-            dc:date mbz:created(album_release.releasedate);
-            mo:image mbz:image_iri(album_amazon_asin.asin);
-
-            #Empty for now.
-            mo:compilation_of mbz:record_iri (album_album.gid) where (^{l_album_album.}^.link_type = 8) option (using l_album_album);
-            mo:releaseStatus mbz:official_iri(album.attributes);
-            mo:releaseStatus mbz:promotion_iri(album.attributes);
-            mo:releaseStatus mbz:bootleg_iri(album.attributes);
-
-            mo:releaseType mbz:album_iri(album.attributes);
-            mo:releaseType mbz:single_iri(album.attributes);
-            mo:releaseType mbz:ep_iri(album.attributes);
-            mo:releaseType mbz:compilation_iri(album.attributes);
-            mo:releaseType mbz:soundtrack_iri(album.attributes);
-            mo:releaseType mbz:spokenword_iri(album.attributes);
-            mo:releaseType mbz:interview_iri(album.attributes);
-            mo:releaseType mbz:audiobook_iri(album.attributes);
-            mo:releaseType mbz:live_iri(album.attributes);
-            mo:releaseType mbz:remix_iri(album.attributes);
-
-
-            dc:creator mbz:artist_iri (album_artist_creator.gid);
-            dc:creator mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 14) option (using l_album_artist2);
-
-            mo:compiler mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 41) option (using l_album_artist2);
-            mo:producer mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 18) option (using l_album_artist2);
-            mo:publisher mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 35) option (using l_album_artist2);
-            mo:engineer mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 19) option (using l_album_artist2);
-
-
-            mo:musicbrainz mbz:mbz_release_url_iri(album.gid);
-
-            mo:musicmoz mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 25) option (using l_album_url);
-            mo:discogs mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 24) option (using l_album_url);
-            mo:wikipedia mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 23) option (using l_album_url);
-            mo:discography mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 1) option (using l_album_url);
-            mo:freedownload mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 21) option (using l_album_url);
-            mo:discography mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 16) option (using l_album_url);
-            mo:mailorder mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 19) option (using l_album_url);
-            mo:imdb mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 27) option (using l_album_url);
-            mo:paiddownload mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 20) option (using l_album_url);
-            mo:licence mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 32) option (using l_album_url);
-            mo:review mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 17) option (using l_album_url);
-
-
-            mo:amazon_asin mbz:amazon_asin_iri(album_amazon_asin.asin);
-
-            mo:has_track mbz:track_iri (album_albumjoin_track.gid) option (using album_albumjoin).
-
-       # Music Group (Band)
-#       mbz:band_iri(band.gid)
-        mbz:artist_iri(band.gid)
-            a mo:MusicArtist;
-            a mo:MusicGroup;
-            a foaf:Group;
-            foaf:name band.name;
-            foaf:nick bandalias.name;
-
-#           bio:event mbz:band_birth_event_iri(band.gid);
-#           bio:event mbz:band_death_event_iri(band.gid);
-            bio:event mbz:artist_birth_event_iri(band.gid);
-            bio:event mbz:artist_death_event_iri(band.gid);
-
-#           mo:similar_to mbz:band_iri(sim_band.gid) option (using band_relation);
-            mo:similar_to mbz:artist_iri(sim_band.gid) option (using band_relation);
-            mo:similar_to mbz:artist_iri(sim_artist.gid) option (using artist_relation);
-#            sim:link mbz:sim_link_iri(sim_band.gid)  option (using band_relation);
-#            sim:link mbz:sim_link_iri(sim_artist.gid)  option (using artist_relation);
-
-            foaf:member mbz:artist_iri(band_member.gid) option (using band_l_artist_artist);
-
-            # l_artist_url
-            mo:myspace mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 19) option (using l_artist_url3);
-            mo:musicmoz mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 12) option (using l_artist_url3);
-            mo:discogs mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 11) option (using l_artist_url3);
-            mo:wikipedia mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 10) option (using l_artist_url3);
-            mo:discography mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 1) option (using l_artist_url3);
-            mo:freedownload mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 8) option (using l_artist_url3);
-            mo:fanpage mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 3) option (using l_artist_url3);
-            mo:biography mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 4) option (using l_artist_url3);
-            mo:discography mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 5) option (using l_artist_url3);
-            mo:mailorder mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 15) option (using l_artist_url3);
-            mo:imdb mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 17) option (using l_artist_url3);
-            mo:paiddownload mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 7) option (using l_artist_url3);
-            foaf:depiction mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 14) option (using l_artist_url3);
-            foaf:homepage mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 2) option (using l_artist_url3);
-
-            mo:musicbrainz mbz:mbz_artist_url_iri(band.gid);
-
-
-            # l_album_artist
-            mo:composed mbz:composition_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 14) option (using l_album_artist3);
-            mo:performed mbz:performance_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 14) option (using l_album_artist3);
-            mo:performed mbz:performance_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 2) option (using l_album_artist3);
-            mo:conducted mbz:performance_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 9) option (using l_album_artist3);
-            mo:compiled mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 41) option (using l_album_artist3);
-            mo:djmixed mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 38) option (using l_album_artist3);
-            mo:remixed mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 11) option (using l_album_artist3);
-            mo:sampled mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 12) option (using l_album_artist3);
-            mo:produced mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 18) option (using l_album_artist3);
-            mo:published mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 35) option (using l_album_artist3);
-            mo:engineered mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 19) option (using l_album_artist3);
-
-#    #      mo:creatorOfRecord mbz:record_iri(band_album_creatorOf.gid);
-            foaf:made mbz:record_iri(band_album_creatorOf.gid);
-
-            # l_artist_track
-            mo:composed mbz:composition_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 14) option (using l_artist_track3);
-            mo:performed mbz:performance_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 14) option (using l_artist_track3);
-            mo:performed mbz:performance_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 2) option (using l_artist_track3);
-            mo:conducted mbz:performance_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 9) option (using l_artist_track3);
-            mo:compiled mbz:record_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 39) option (using l_artist_track3);
-            mo:djmixed mbz:track_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 40) option (using l_artist_track3);
-            mo:remixed mbz:track_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 11) option (using l_artist_track3);
-            mo:sampled mbz:track_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 12) option (using l_artist_track3);
-            mo:produced mbz:track_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 18) option (using l_artist_track3);
-            mo:published mbz:track_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 35) option (using l_artist_track3);
-            mo:engineered mbz:track_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 19) option (using l_artist_track3).
-
-#    #      mo:creatorOfTrack mbz:track_iri(band_track_creatorOf.gid).
-
-
-
-
-        # Music Group (Band)'s Birth Event
-#       mbz:band_birth_event_iri(band.gid)
-        mbz:artist_birth_event_iri(band.gid)
-            a bio:Birth;
-            bio:date band.begindate.
-
-        # Music Group (Band)'s Death Event
-#       mbz:band_death_event_iri(band.gid)
-        mbz:artist_death_event_iri(band.gid)
-            a bio:Death;
-            bio:date band.enddate.
-
-        # Similarity link
-        #mbz:sim_link_iri(sim_band.gid)
-        #    sim:relation mo:similar_to;
-        #    sim:level band_relation.weight;
-        #    sim:to sim_band.gid.
-
-
-        # Music Artist
-        mbz:artist_iri (artist.gid)
-
-            # artist
-            a mo:MusicArtist;
-            a mo:SoloMusicArtist where (^{artist_untyped.}^.gid is not null) option (using artist_untyped);
-            a foaf:Person where (^{artist_untyped.}^.gid is not null) option (using artist_untyped);
-            foaf:name artist.name;
-            foaf:nick artistalias.name;
-            bio:event mbz:artist_birth_event_iri(artist.gid);
-            bio:event mbz:artist_death_event_iri(artist.gid);
-
-            mo:member_of mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 2) option (using l_artist_artist);
-
-            # l_artist_artist
-            rel:siblingOf mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 7) option (using l_artist_artist);
-            rel:friendOf mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 5) option (using l_artist_artist);
-            rel:parentOf mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 6) option (using l_artist_artist);
-            rel:collaborated_with mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 11) option (using l_artist_artist);
-            rel:engagedTo mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 9) option (using l_artist_artist);
-            rel:spouseOf mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 8) option (using l_artist_artist);
-            mo:supporting_musician mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 13) option (using l_artist_artist);
-            mo:supporting_musician mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 14) option (using l_artist_artist);
-            mo:supporting_musician mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 15) option (using l_artist_artist);
-
-            mo:similar_to mbz:artist_iri(sim_artist.gid) option (using artist_relation);
-#           mo:similar_to mbz:band_iri(sim_band.gid) option (using band_relation);
-            mo:similar_to mbz:artist_iri(sim_band.gid) option (using band_relation);
-
-#            sim:link mbz:sim_link_iri(sim_band.gid)  option (using band_relation);
-#            sim:link mbz:sim_link_iri(sim_artist.gid)  option (using artist_relation);
-
-
-            # l_artist_url
-            mo:myspace mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 19) option (using l_artist_url);
-            mo:musicmoz mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 12) option (using l_artist_url);
-            mo:discogs mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 11) option (using l_artist_url);
-            mo:wikipedia mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 10) option (using l_artist_url);
-            mo:discography mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 1) option (using l_artist_url);
-            mo:freedownload mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 8) option (using l_artist_url);
-            mo:fanpage mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 3) option (using l_artist_url);
-            mo:biography mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 4) option (using l_artist_url);
-            mo:discography mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 5) option (using l_artist_url);
-            mo:mailorder mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 15) option (using l_artist_url);
-            mo:imdb mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 17) option (using l_artist_url);
-            mo:paiddownload mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 7) option (using l_artist_url);
-            foaf:depiction mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 14) option (using l_artist_url);
-            foaf:homepage mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 2) option (using l_artist_url);
-
-            mo:musicbrainz mbz:mbz_artist_url_iri(artist.gid);
-
-
-            # l_album_artist
-            mo:composed mbz:composition_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 14) option (using l_album_artist);
-            mo:performed mbz:performance_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 14) option (using l_album_artist);
-            mo:performed mbz:performance_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 2) option (using l_album_artist);
-            mo:conducted mbz:performance_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 9) option (using l_album_artist);
-            mo:compiled mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 41) option (using l_album_artist);
-            mo:djmixed mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 38) option (using l_album_artist);
-            mo:remixed mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 11) option (using l_album_artist);
-            mo:sampled mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 12) option (using l_album_artist);
-            mo:produced mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 18) option (using l_album_artist);
-            mo:published mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 35) option (using l_album_artist);
-            mo:engineered mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 19) option (using l_album_artist);
-
-     #      mo:creatorOfRecord mbz:record_iri(artist_album_creatorOf.gid);
-            foaf:made mbz:record_iri(artist_album_creatorOf.gid);
-
-
-            # l_artist_track
-            mo:composed mbz:composition_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 14) option (using l_artist_track);
-            mo:performed mbz:performance_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 14) option (using l_artist_track);
-            mo:performed mbz:performance_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 2) option (using l_artist_track);
-            mo:conducted mbz:performance_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 9) option (using l_artist_track);
-            mo:compiled mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 39) option (using l_artist_track);
-            mo:djmixed mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 40) option (using l_artist_track);
-            mo:remixed mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 11) option (using l_artist_track);
-            mo:sampled mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 12) option (using l_artist_track);
-            mo:produced mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 18) option (using l_artist_track);
-            mo:published mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 35) option (using l_artist_track);
-            mo:engineered mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 19) option (using l_artist_track).
-
-     #       mo:creatorOfTrack mbz:track_iri(artist_track_creatorOf.gid).
-
-
-        # Music Artist''s Birth Event
-        mbz:artist_birth_event_iri(artist.gid)
-            a bio:Birth;
-            bio:date artist.begindate.
-
-        # Music Artist''s Death Event
-        mbz:artist_death_event_iri(artist.gid)
-            a bio:Death;
-            bio:date artist.enddate.
-
-        # Similarity link
-        #mbz:sim_link_iri(sim_artist.gid)
-        #    sim:relation mo:similar_to;
-        #    sim:level artist_relation.weight;
-        #    sim:to sim_artist.gid.
-
-        }
-}
-;
-
-
-grant execute on ZITGIST.MO.RECORD_CREATION_DATE to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_CREATION_DATE_INVERSE to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_OFFICIAL to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_PROMOTION to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_BOOTLEG to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_ALBUM to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_SINGLE to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_EP to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_COMPILATION to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_SOUNDTRACK to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_SPOKENWORD to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_INTERVIEW to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_AUDIOBOOK to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_LIVE to "SPARQL";
-grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_REMIX to "SPARQL";
-grant execute on ZITGIST.MO.TRACK_DURATION to "SPARQL";
-grant execute on ZITGIST.MO.TRACK_DURATION_INVERSE to "SPARQL";
-grant execute on ZITGIST.MO.album_amazon_asin to "SPARQL";
-grant execute on ZITGIST.MO.album_name_WORDS to "SPARQL";
-grant execute on ZITGIST.MO.albumjoin to "SPARQL";
-grant execute on ZITGIST.MO.albummeta to "SPARQL";
-grant execute on ZITGIST.MO.artist to "SPARQL";
-grant execute on ZITGIST.MO.artist_name_WORDS to "SPARQL";
-grant execute on ZITGIST.MO.artist_relation to "SPARQL";
-grant execute on ZITGIST.MO.artistalias to "SPARQL";
-grant execute on ZITGIST.MO.artistalias_name_WORDS to "SPARQL";
-grant execute on ZITGIST.MO.country to "SPARQL";
-grant execute on ZITGIST.MO.l_album_album to "SPARQL";
-grant execute on ZITGIST.MO.l_album_artist to "SPARQL";
-grant execute on ZITGIST.MO.l_album_url to "SPARQL";
-grant execute on ZITGIST.MO.l_artist_artist to "SPARQL";
-grant execute on ZITGIST.MO.l_artist_track to "SPARQL";
-grant execute on ZITGIST.MO.l_artist_url to "SPARQL";
-grant execute on ZITGIST.MO.l_track_track to "SPARQL";
-grant execute on ZITGIST.MO.l_track_url to "SPARQL";
-grant execute on ZITGIST.MO."language" to "SPARQL";
-grant execute on ZITGIST.MO.puid to "SPARQL";
-grant execute on ZITGIST.MO.puidjoin to "SPARQL";
-grant execute on ZITGIST.MO.release to "SPARQL";
-grant execute on ZITGIST.MO.track to "SPARQL";
-grant execute on ZITGIST.MO.track_name_WORDS to "SPARQL";
-grant execute on ZITGIST.MO.url to "SPARQL";
-
-DB.DBA.XML_SET_NS_DECL ('mbz', 'http://musibrainz.org/schemas/mbz#', 2);
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfviewsbusintods">
-      <title>Virtuoso ODS to RDF</title>
-<para><emphasis>RDF View for ODS (the consolidated Graph)</emphasis></para>
-<programlisting><![CDATA[
-SPARQL drop quad map virtrdf:ODS_DS . ;
-
-SPARQL prefix ods: <http://www.openlinksw.com/virtuoso/ods/>
-       create iri class ods:graph "http://^{URIQADefaultHost}^/dataspace/%U" (in uname varchar not null)
-			    option (returns "http://^{URIQADefaultHost}^/dataspace/%U") .
-       create iri class ods:user "http://^{URIQADefaultHost}^/dataspace/%U#user" (in uname varchar not null)
-			    option (returns "http://^{URIQADefaultHost}^/dataspace/%U#user") .
-       create iri class ods:user_group "http://^{URIQADefaultHost}^/dataspace/%U#group" (in uname varchar not null)
-			    option (returns "http://^{URIQADefaultHost}^/dataspace/%U#group") .
-       create iri class ods:person "http://^{URIQADefaultHost}^/dataspace/%U#this" (in uname varchar not null)
-			    option (returns "http://^{URIQADefaultHost}^/dataspace/%U#this") .
-       create iri class ods:mbox "mailto:%s" (in email varchar not null)
-			    option (returns "mailto:%s") .
-       create iri class ods:phone "tel:%s" (in tel varchar not null)
-       			    option (returns "tel:%s") .
-       create iri class ods:geo_point "http://^{URIQADefaultHost}^/dataspace/%U#geo" (in uname varchar not null)
-       			    option (returns "http://^{URIQADefaultHost}^/dataspace/%U#geo") .
-       create iri class ods:forum "http://^{URIQADefaultHost}^/dataspace/%U/%U/%U"
-	    ( in uname varchar not null, in forum_type varchar not null, in forum_name varchar not null)
-	    		    option (returns "http://^{URIQADefaultHost}^/dataspace/%U/%U/%U") .
-       create iri class ods:proxy "http://^{URIQADefaultHost}^/proxy/%U" (in url varchar not null)
-       			    option (returns  "http://^{URIQADefaultHost}^/proxy/%U") .
-       create iri class ods:site "http://^{URIQADefaultHost}^/dataspace/%U#site" (in uname varchar not null)
-       			    option (returns "http://^{URIQADefaultHost}^/dataspace/%U#site") .
-       create iri class ods:role "http://^{URIQADefaultHost}^/dataspace/%U/%U/%U#%U"
-	    (in uname varchar not null, in tp varchar not null, in inst varchar not null, in role_name varchar not null)
-			    option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/%U/%U#%U" ) .
-	# Blog
-	create iri class ods:blog_forum "http://^{URIQADefaultHost}^/dataspace/%U/weblog/%U"
-		(in uname varchar not null, in forum_name varchar not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/weblog/%U") .
-	create iri class ods:blog_post "http://^{URIQADefaultHost}^/dataspace/%U/weblog/%U/%U"
-		(in uname varchar not null, in forum_name varchar not null, in postid varchar not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/weblog/%U/%U" ) .
-	create iri class ods:blog_comment "http://^{URIQADefaultHost}^/dataspace/%U/weblog/%U/%U/%d"
-		(in uname varchar not null, in forum_name varchar not null, in postid varchar not null, in comment_id int not null)
- 	        option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/weblog/%U/%U/%d" ) .
-	create iri class ods:tag "http://^{URIQADefaultHost}^/dataspace/%U/concept#%U"
-		(in uname varchar not null, in tag varchar not null)
-                option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/concept#%U") .
-	create iri class ods:blog_post_text "http://^{URIQADefaultHost}^/dataspace/%U/weblog-text/%U/%U"
-		(in uname varchar not null, in forum_name varchar not null, in postid varchar not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/weblog-text/%U/%U" ) .
-	#Feeds
-	create iri class ods:feed "http://^{URIQADefaultHost}^/dataspace/feed/%d" (in feed_id integer not null)
-          	option (returns "http://^{URIQADefaultHost}^/dataspace/feed/%d" ) .
-	create iri class ods:feed_item "http://^{URIQADefaultHost}^/dataspace/feed/%d/%d" (in feed_id integer not null, in item_id integer not null)
-	 	option (returns  "http://^{URIQADefaultHost}^/dataspace/feed/%d/%d" ) .
-	create iri class ods:feed_item_text "http://^{URIQADefaultHost}^/dataspace/feed/%d/%d/text" (in feed_id integer not null, in item_id integer not null)
-		option (returns  "http://^{URIQADefaultHost}^/dataspace/feed/%d/%d/text" ) .
-	create iri class ods:feed_mgr "http://^{URIQADefaultHost}^/dataspace/%U/feeds/%U" (in uname varchar not null, in inst_name varchar not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/feeds/%U" ) .
-	create iri class ods:feed_comment "http://^{URIQADefaultHost}^/dataspace/%U/feeds/%U/%d/%d"
-		(in uname varchar not null, in inst_name varchar not null, in item_id integer not null, in comment_id integer not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/feeds/%U/%d/%d" ) .
-	#Bookmark
-	create iri class ods:bmk_post "http://^{URIQADefaultHost}^/dataspace/%U/bookmark/%U/%d"
-		(in uname varchar not null, in inst_name varchar not null, in bmk_id integer not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/bookmark/%U/%d") .
-	create iri class ods:bmk_post_text "http://^{URIQADefaultHost}^/dataspace/%U/bookmark/%U/%d/text"
-		(in uname varchar not null, in inst_name varchar not null, in bmk_id integer not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/bookmark/%U/%d/text" ) .
-	create iri class ods:bmk_forum "http://^{URIQADefaultHost}^/dataspace/%U/bookmark/%U"
-		( in uname varchar not null, in forum_name varchar not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/bookmark/%U") .
-	#Photo
-	create iri class ods:photo_forum "http://^{URIQADefaultHost}^/dataspace/%U/photos/%U"
-		(in uname varchar not null, in inst_name varchar not null)
-		option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/photos/%U") .
-	create iri class ods:photo_post "http://^{URIQADefaultHost}^%s"
-		(in path varchar not null) option (returns "http://^{URIQADefaultHost}^/DAV/%s") .
-	create iri class ods:photo_post_text "http://^{URIQADefaultHost}^%s/text"
-		(in path varchar not null) option (returns "http://^{URIQADefaultHost}^/DAV/%s/text") .
-	create iri class ods:photo_comment "http://^{URIQADefaultHost}^%s:comment_%d"
-		(in path varchar not null, in comment_id int not null)
-		option (returns "http://^{URIQADefaultHost}^/DAV/%s:comment_%d") .
-	# Community
-	create iri class ods:community_forum "http://^{URIQADefaultHost}^/dataspace/%U/community/%U"
-		(in uname varchar not null, in forum_name varchar not null)
-		option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/community/%U") .
-	# Briefcase
-	create iri class ods:odrive_forum "http://^{URIQADefaultHost}^/dataspace/%U/briefcase/%U"
-		(in uname varchar not null, in inst_name varchar not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/briefcase/%U" ) .
-	create iri class ods:odrive_post "http://^{URIQADefaultHost}^%s"
-		(in path varchar not null) option (returns "http://^{URIQADefaultHost}^/DAV/%s") .
-	create iri class ods:odrive_post_text "http://^{URIQADefaultHost}^%s/text"
-		(in path varchar not null) option (returns "http://^{URIQADefaultHost}^/DAV/%s/text") .
-	# Wiki
-	create iri class ods:wiki_post "http://^{URIQADefaultHost}^/dataspace/%U/wiki/%U/%U"
-		(in uname varchar not null, in inst_name varchar not null, in topic_id varchar not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/wiki/%U/%U") .
-	create iri class ods:wiki_post_text "http://^{URIQADefaultHost}^/dataspace/%U/wiki/%U/%U/text"
-		(in uname varchar not null, in inst_name varchar not null, in topic_id varchar not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/wiki/%U/%U/text" ) .
-	create iri class ods:wiki_forum "http://^{URIQADefaultHost}^/dataspace/%U/wiki/%U"
-		( in uname varchar not null, in forum_name varchar not null)
-		option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/wiki/%U" ) .
-	#Calendar
-	create iri class ods:calendar_event "http://^{URIQADefaultHost}^/dataspace/%U/calendar/%U/%d"
-		(in uname varchar not null, in inst_name varchar not null, in calendar_id integer not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/calendar/%U/%d" ) .
-	create iri class ods:calendar_event_text "http://^{URIQADefaultHost}^/dataspace/%U/calendar/%U/%d/text"
-		(in uname varchar not null, in inst_name varchar not null, in calendar_id integer not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/calendar/%U/%d/text" ) .
-	create iri class ods:calendar_forum "http://^{URIQADefaultHost}^/dataspace/%U/calendar/%U"
-		( in uname varchar not null, in forum_name varchar not null)
-		option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/calendar/%U") .
-	# NNTPF
-	create iri class ods:nntp_forum "http://^{URIQADefaultHost}^/dataspace/discussion/%U"
-		( in forum_name varchar not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/discussion/%U").
-	create iri class ods:nntp_post "http://^{URIQADefaultHost}^/dataspace/discussion/%U/%U"
-		( in group_name varchar not null, in message_id varchar not null)
-		option (returns  "http://^{URIQADefaultHost}^/dataspace/discussion/%U/%U" ) .
-	create iri class ods:nntp_post_text "http://^{URIQADefaultHost}^/dataspace/discussion/%U/%U/text"
-		( in group_name varchar not null, in message_id varchar not null)
-		option (returns  "http://^{URIQADefaultHost}^/dataspace/discussion/%U/%U/text") .
-	create iri class ods:nntp_role "http://^{URIQADefaultHost}^/dataspace/discussion/%U#reader"
-		(in forum_name varchar not null)
-		option (returns "http://^{URIQADefaultHost}^/dataspace/discussion/%U#reader") .
-;
-
-
-SPARQL
-    prefix sioc: <http://rdfs.org/sioc/ns#>
-    prefix sioct: <http://rdfs.org/sioc/types#>
-    prefix atom: <http://atomowl.org/ontologies/atomrdf#>
-    prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-    prefix dc: <http://purl.org/dc/elements/1.1/>
-    prefix dct: <http://purl.org/dc/terms/>
-    prefix skos: <http://www.w3.org/2004/02/skos/core#>
-    prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-    prefix bm: <http://www.w3.org/2002/01/bookmark#>
-    prefix exif: <http://www.w3.org/2003/12/exif/ns/>
-    prefix ann: <http://www.w3.org/2000/10/annotation-ns#>
-    prefix wikiont: <http://sw.deri.org/2005/04/wikipedia/wikiont.owl#>
-    prefix calendar: <http://www.w3.org/2002/12/cal#>
-    prefix ods: <http://www.openlinksw.com/virtuoso/ods/>
-
-    alter quad storage virtrdf:DefaultQuadStorage
-      FROM DB.DBA.SIOC_USERS as users
-      FROM DB.DBA.SIOC_ODS_FORUMS as forums
-      FROM DB.DBA.SIOC_ROLES as roles
-      FROM DB.DBA.SIOC_ROLE_GRANTS as grants
-      FROM DB.DBA.SIOC_KNOWS as knows
-      FROM DB.DBA.ODS_FOAF_PERSON as person
-      where (^{person.}^.U_NAME = ^{users.}^.U_NAME)
-      where (^{forums.}^.U_NAME = ^{users.}^.U_NAME)
-      where (^{knows.}^.TO_NAME = ^{users.}^.U_NAME)
-      where (^{knows.}^.FROM_NAME = ^{users.}^.U_NAME)
-      where (^{grants.}^.U_NAME = ^{users.}^.U_NAME)
-      where (^{roles.}^.U_NAME = ^{users.}^.U_NAME)
-
-      FROM DB.DBA.ODS_BLOG_POSTS as blog_posts
-      where (^{blog_posts.}^.B_OWNER = ^{users.}^.U_NAME)
-      FROM DB.DBA.ODS_BLOG_POST_LINKS as blog_links
-      where (^{blog_links.}^.B_OWNER = ^{users.}^.U_NAME)
-      FROM DB.DBA.ODS_BLOG_POST_ATTS as blog_atts
-      where (^{blog_atts.}^.B_OWNER = ^{users.}^.U_NAME)
-      FROM DB.DBA.ODS_BLOG_POST_TAGS as blog_tags
-      where (^{blog_tags.}^.U_NAME = ^{users.}^.U_NAME)
-      FROM DB.DBA.ODS_BLOG_COMMENTS as blog_comms
-      where (^{blog_comms.}^.U_NAME = ^{users.}^.U_NAME)
-
-      FROM DB.DBA.ODS_BMK_POSTS as bmk_posts
-      where (^{bmk_posts.}^.U_NAME = ^{users.}^.U_NAME)
-      FROM DB.DBA.ODS_BMK_TAGS as bmk_tags
-      where (^{bmk_tags.}^.U_NAME = ^{users.}^.U_NAME)
-
-      FROM DB.DBA.ODS_ODRIVE_POSTS as odrv_posts
-      where (^{odrv_posts.}^.U_MEMBER = ^{users.}^.U_NAME)
-      FROM DB.DBA.ODS_ODRIVE_TAGS as odrv_tags
-      where (^{odrv_tags.}^.U_OWNER = ^{users.}^.U_NAME)
-
-      FROM DB.DBA.ODS_FEED_FEED_DOMAIN as feed_domain
-      where (^{feed_domain.}^.U_NAME = ^{users.}^.U_NAME)
-      FROM DB.DBA.ODS_FEED_POSTS as feed_posts
-      where (^{feed_posts.}^.EFI_FEED_ID = ^{feed_domain.}^.EF_ID)
-      FROM DB.DBA.ODS_FEED_COMMENTS as feed_comments
-      where (^{feed_comments.}^.U_NAME = ^{users.}^.U_NAME)
-      FROM DB.DBA.ODS_FEED_TAGS as feed_tags
-      where (^{feed_tags.}^.U_NAME = ^{users.}^.U_NAME)
-      FROM DB.DBA.ODS_FEED_LINKS as feed_links
-      where (^{feed_links.}^.EFI_FEED_ID = ^{feed_domain.}^.EF_ID)
-      FROM DB.DBA.ODS_FEED_ATTS as feed_atts
-      where (^{feed_atts.}^.EFI_FEED_ID = ^{feed_domain.}^.EF_ID)
-
-      FROM DB.DBA.ODS_PHOTO_POSTS as photo_posts
-      where (^{photo_posts.}^.U_MEMBER = ^{users.}^.U_NAME)
-      FROM DB.DBA.ODS_PHOTO_COMMENTS as photo_comments
-      where (^{photo_comments.}^.U_MEMBER = ^{users.}^.U_NAME)
-      FROM DB.DBA.ODS_PHOTO_TAGS as photo_tags
-      where (^{photo_tags.}^.U_MEMBER = ^{users.}^.U_NAME)
-
-      FROM DB.DBA.ODS_WIKI_POSTS as wiki_posts
-      where (^{wiki_posts.}^.U_NAME = ^{users.}^.U_NAME)
-
-      FROM DB.DBA.ODS_COMMUNITIES as community
-      where (^{community.}^.C_OWNER = ^{users.}^.U_NAME)
-
-      FROM DB.DBA.ODS_NNTP_GROUPS as nntp_groups
-      FROM DB.DBA.ODS_NNTP_POSTS as nntp_posts
-      FROM DB.DBA.ODS_NNTP_USERS as nntp_users
-      where (^{nntp_users.}^.U_NAME = ^{users.}^.U_NAME)
-      FROM DB.DBA.ODS_NNTP_LINKS as nntp_links
-
-
-    {
-	create virtrdf:ODS_DS as graph ods:graph (users.U_NAME) option (exclusive)
-	  {
-	    ods:user (users.U_NAME) a sioc:User ;
-            sioc:id users.U_NAME ;
-            sioc:name users.U_FULL_NAME ;
-            sioc:email ods:mbox (users.E_MAIL) ;
-            sioc:email_sha1 users.E_MAIL_SHA1 ;
-            sioc:account_of ods:person (users.U_NAME) .
-
-	    ods:person (person.U_NAME) a foaf:Person ;
-            foaf:nick person.U_NAME ;
-	    foaf:name person.U_FULL_NAME ;
-	    foaf:mbox ods:mbox (person.E_MAIL) ;
-            foaf:mbox_sha1sum person.E_MAIL_SHA1 ;
-            foaf:holdsAccount ods:user (person.U_NAME) ;
-            foaf:firstName person.FIRST_NAME ;
-            foaf:family_name person.LAST_NAME ;
-            foaf:gender person.GENDER ;
-            foaf:icqChatID person.ICQ ;
-            foaf:msnChatID person.MSN ;
-            foaf:aimChatID person.AIM ;
-            foaf:yahooChatID person.YAHOO ;
-            foaf:birthday person.BIRTHDAY ;
-            foaf:organization person.ORG ;
-            foaf:phone ods:phone (person.PHONE) ;
-	    foaf:based_near ods:geo_point (person.U_NAME)
-	    .
-
-	    ods:geo_point (person.U_NAME) a geo:Point ;
-		 geo:lat person.LAT ;
-		 geo:lng person.LNG .
-
-	    ods:person (knows.FROM_NAME) foaf:knows ods:person (knows.TO_NAME) .
-	    ods:person (knows.TO_NAME) foaf:knows ods:person (knows.FROM_NAME) .
-
-	    ods:user_group (grants.G_NAME) a sioc:Usergroup ;
-	    	sioc:id grants.G_NAME ;
-		sioc:has_member ods:user (grants.U_NAME) .
-	    ods:user (grants.U_NAME)  sioc:member_of ods:user_group (grants.G_NAME) .
-
-	    ods:role (roles.U_NAME, roles.APP_TYPE, roles.WAM_INST, roles.WMT_NAME)
-	      sioc:has_scope ods:forum (roles.U_NAME, roles.APP_TYPE, roles.WAM_INST) ;
-	      sioc:function_of ods:user (roles.U_NAME) .
-
-            ods:forum (roles.U_NAME, roles.APP_TYPE, roles.WAM_INST)
-	    	sioc:scope_of ods:role (roles.U_NAME, roles.APP_TYPE, roles.WAM_INST, roles.WMT_NAME) .
-            ods:user (roles.U_NAME)
-	    	sioc:has_function ods:role (roles.U_NAME, roles.APP_TYPE, roles.WAM_INST, roles.WMT_NAME) .
-
-	    ods:forum (forums.U_NAME, forums.APP_TYPE, forums.WAM_INST) a sioc:Container ;
-            sioc:id forums.WAM_INST ;
-	    sioc:type forums.APP_TYPE ;
-            sioc:description forums.WAI_DESCRIPTION ;
-            sioc:link ods:proxy (forums.LINK) ;
-            sioc:has_space ods:site (forums.U_NAME) .
-
-            # Weblog
-	    ods:blog_post (blog_posts.B_OWNER, blog_posts.B_INST, blog_posts.B_POST_ID) a sioct:BlogPost ;
-	    sioc:link ods:proxy (blog_posts.B_LINK) ;
-	    sioc:has_creator ods:user (blog_posts.B_CREATOR) ;
-	    foaf:maker ods:person (blog_posts.B_CREATOR) ;
-	    sioc:has_container ods:blog_forum (blog_posts.B_OWNER, blog_posts.B_INST) ;
-	    dc:title blog_posts.B_TITLE ;
-	    dct:created blog_posts.B_CREATED ;
-	    dct:modified blog_posts.B_MODIFIED ;
-	    sioc:content blog_posts.B_CONTENT .
-
-	    ods:blog_forum (blog_posts.B_OWNER, blog_posts.B_INST)
-	    sioc:container_of
-	    ods:blog_post (blog_posts.B_OWNER, blog_posts.B_INST, blog_posts.B_POST_ID) .
-
-	    ods:user (blog_posts.B_CREATOR)
-	    sioc:creator_of
-	    ods:blog_post (blog_posts.B_OWNER, blog_posts.B_INST, blog_posts.B_POST_ID) .
-
-	    ods:blog_post (blog_links.B_OWNER, blog_links.B_INST, blog_links.B_POST_ID)
-	    sioc:links_to
-	    ods:proxy (blog_links.PL_LINK) .
-	    # end Weblog
-
-            # Bookmark
-	    ods:bmk_post (bmk_posts.U_NAME, bmk_posts.WAI_NAME, bmk_posts.BD_BOOKMARK_ID)
-            a bm:Bookmark ;
-	    dc:title bmk_posts.BD_NAME;
-	    dct:created bmk_posts.BD_CREATED ;
-	    dct:modified bmk_posts.BD_LAST_UPDATE ;
-	    dc:date bmk_posts.BD_LAST_UPDATE ;
-	    ann:created bmk_posts.BD_CREATED ;
-	    dc:creator bmk_posts.U_NAME ;
-	    bm:recalls ods:proxy (bmk_posts.B_URI) ;
-	    sioc:link ods:proxy (bmk_posts.B_URI) ;
-	    sioc:content bmk_posts.BD_DESCRIPTION ;
-	    sioc:has_creator ods:user (bmk_posts.U_NAME) ;
-	    foaf:maker ods:person (bmk_posts.U_NAME) ;
-	    sioc:has_container ods:bmk_forum (bmk_posts.U_NAME, bmk_posts.WAI_NAME) .
-
-            ods:bmk_forum (bmk_posts.U_NAME, bmk_posts.WAI_NAME)
-	    sioc:container_of
-	    ods:bmk_post (bmk_posts.U_NAME, bmk_posts.WAI_NAME, bmk_posts.BD_BOOKMARK_ID) .
-
-	    ods:user (bmk_posts.U_NAME)
-	    sioc:creator_of
-	    ods:bmk_post (bmk_posts.U_NAME, bmk_posts.WAI_NAME, bmk_posts.BD_BOOKMARK_ID) .
-
-	    ods:bmk_post (bmk_tags.U_NAME, bmk_tags.WAM_INST, bmk_tags.ITEM_ID)
-	    sioc:topic
-	    ods:tag (bmk_tags.U_NAME, bmk_tags.BD_TAG) .
-
-	    ods:tag (bmk_tags.U_NAME, bmk_tags.BD_TAG) a skos:Concept ;
-	    skos:prefLabel bmk_tags.BD_TAG ;
-	    skos:isSubjectOf ods:bmk_post (bmk_tags.U_NAME, bmk_tags.WAM_INST, bmk_tags.ITEM_ID) .
-	    # end Bookmark
-
-            # Briefcase
-	    ods:odrive_post (odrv_posts.RES_FULL_PATH) a foaf:Document ;
-	    dc:title odrv_posts.RES_NAME ;
-	    dct:created odrv_posts.RES_CREATED ;
-	    dct:modified odrv_posts.RES_MODIFIED ;
-	    sioc:content odrv_posts.RES_DESCRIPTION ;
-	    sioc:has_creator ods:user (odrv_posts.U_OWNER) ;
-	    foaf:maker ods:person (odrv_posts.U_OWNER) ;
-	    sioc:has_container ods:odrive_forum (odrv_posts.U_MEMBER, odrv_posts.WAI_NAME) .
-
-	    ods:odrive_forum (odrv_posts.U_MEMBER, odrv_posts.WAI_NAME)
-	    sioc:container_of
-	    ods:odrive_post (odrv_posts.RES_FULL_PATH) .
-
-	    ods:user (odrv_posts.U_OWNER)
-	    sioc:creator_of
-	    ods:odrive_post (odrv_posts.RES_FULL_PATH) .
-
-	    ods:odrive_post (odrv_tags.RES_FULL_PATH)
-	    sioc:topic
-	    ods:tag (odrv_tags.U_OWNER, odrv_tags.TAG) .
-
-	    ods:tag (odrv_tags.U_OWNER, odrv_tags.TAG) a skos:Concept ;
-	    skos:prefLabel odrv_tags.TAG ;
-	    skos:isSubjectOf ods:odrive_post (odrv_tags.RES_FULL_PATH) .
-            # end Briefcase
-
-            # Feeds
-	    ods:feed (feed_domain.EF_ID) a atom:Feed ;
-	    sioc:link ods:proxy (feed_domain.EF_URI) ;
-	    atom:link ods:proxy (feed_domain.EF_URI) ;
-	    atom:title feed_domain.EF_TITLE ;
-	    sioc:has_parent ods:feed_mgr (feed_domain.U_NAME, feed_domain.WAI_NAME) .
-
-	    ods:feed_mgr (feed_domain.U_NAME, feed_domain.WAI_NAME)
-	    sioc:parent_of ods:feed (feed_domain.EF_ID) .
-
-
-	    ods:feed_item (feed_tags.EFI_FEED_ID, feed_tags.EFID_ITEM_ID)
-	    sioc:topic
-	    ods:tag (feed_tags.U_NAME, feed_tags.EFID_TAG) .
-
-	    ods:tag (feed_tags.U_NAME, feed_tags.EFID_TAG) a skos:Concept ;
-	    skos:prefLabel feed_tags.EFID_TAG ;
-	    skos:isSubjectOf ods:feed_item (feed_tags.EFI_FEED_ID, feed_tags.EFID_ITEM_ID) .
-
-	    ods:feed_comment (feed_comments.U_NAME, feed_comments.WAI_NAME, feed_comments.EFIC_ITEM_ID, feed_comments.EFIC_ID)
-	    a sioct:Comment ;
-	    dc:title feed_comments.EFIC_TITLE ;
-	    sioc:content feed_comments.EFIC_COMMENT ;
-	    dct:modified feed_comments.LAST_UPDATE ;
-	    dct:created feed_comments.LAST_UPDATE ;
-	    sioc:link ods:proxy (feed_comments.LINK) ;
-	    sioc:has_container ods:feed (feed_comments.EFI_FEED_ID) ;
-	    sioc:reply_of ods:feed_item (feed_comments.EFI_FEED_ID, feed_comments.EFIC_ITEM_ID) ;
-	    foaf:maker ods:proxy (feed_comments.EFIC_U_URL) .
-
-	    ods:proxy (feed_comments.EFIC_U_URL) a foaf:Person ;
-	    foaf:name feed_comments.EFIC_U_NAME;
-	    foaf:mbox ods:mbox (feed_comments.EFIC_U_MAIL) .
-
-            ods:feed (feed_comments.EFI_FEED_ID)
-	    sioc:container_of
-            ods:feed_comment (feed_comments.U_NAME, feed_comments.WAI_NAME, feed_comments.EFIC_ITEM_ID, feed_comments.EFIC_ID) .
-
-            ods:feed_item (feed_comments.EFI_FEED_ID, feed_comments.EFIC_ITEM_ID)
-	    sioc:has_reply
-	    ods:feed_comment (feed_comments.U_NAME, feed_comments.WAI_NAME, feed_comments.EFIC_ITEM_ID, feed_comments.EFIC_ID) .
-
-            ods:feed_item (feed_links.EFI_FEED_ID, feed_links.EFI_ID)
-	    sioc:links_to
-	    ods:proxy (feed_links.EFIL_LINK) .
-
-	    ods:feed_item (feed_atts.EFI_FEED_ID, feed_atts.EFI_ID)
-	    sioc:attachment
-	    ods:proxy (feed_atts.EFIE_URL) .
-
-	    ods:feed_item (feed_posts.EFI_FEED_ID, feed_posts.EFI_ID) a atom:Entry ;
-	    sioc:has_container ods:feed (feed_posts.EFI_FEED_ID) ;
-	    dc:title feed_posts.EFI_TITLE ;
-	    dct:created feed_posts.PUBLISH_DATE ;
-	    dct:modified feed_posts.PUBLISH_DATE ;
-	    sioc:link ods:proxy (feed_posts.EFI_LINK) ;
-	    sioc:content feed_posts.EFI_DESCRIPTION ;
-	    atom:title feed_posts.EFI_TITLE ;
-	    atom:source ods:feed (feed_posts.EFI_FEED_ID) ;
-	    atom:published feed_posts.PUBLISH_DATE ;
-	    atom:updated feed_posts.PUBLISH_DATE ;
-	    atom:content ods:feed_item_text (feed_posts.EFI_FEED_ID, feed_posts.EFI_ID) .
-
-	    ods:feed (feed_posts.EFI_FEED_ID) sioc:container_of ods:feed_item (feed_posts.EFI_FEED_ID, feed_posts.EFI_ID) .
-
-	    ods:feed_item_text (feed_posts.EFI_FEED_ID, feed_posts.EFI_ID) a atom:Content ;
-	    atom:type "text/xhtml" ;
-	    atom:lang "en-US" ;
-	    atom:body feed_posts.EFI_DESCRIPTION .
-
-	    ods:feed (feed_posts.EFI_FEED_ID)
-	    atom:contains
-	    ods:feed_item (feed_posts.EFI_FEED_ID, feed_posts.EFI_ID) .
-            # end Feeds
-
-	    # Photo
-	    ods:photo_post (photo_posts.RES_FULL_PATH) a exif:IFD ;
-	    dc:title photo_posts.RES_NAME ;
-	    dct:created photo_posts.RES_CREATED ;
-	    dct:modified photo_posts.RES_MODIFIED ;
-	    sioc:content photo_posts.RES_DESCRIPTION ;
-	    sioc:has_creator ods:user (photo_posts.U_OWNER) ;
-	    foaf:maker ods:person (photo_posts.U_OWNER) ;
-	    sioc:link ods:proxy (photo_posts.RES_LINK) ;
-	    sioc:has_container ods:photo_forum (photo_posts.U_MEMBER, photo_posts.WAI_NAME) .
-
-	    ods:photo_forum (photo_posts.U_MEMBER, photo_posts.WAI_NAME)
-	    sioc:container_of
-	    ods:photo_post (photo_posts.RES_FULL_PATH) .
-
-	    ods:user (photo_posts.U_OWNER)
-	    sioc:creator_of
-	    ods:photo_post (photo_posts.RES_FULL_PATH) .
-
-	    ods:photo_post (photo_tags.RES_FULL_PATH)
-	    sioc:topic
-	    ods:tag (photo_tags.U_MEMBER, photo_tags.RES_TAG) .
-
-	    ods:tag (photo_tags.U_MEMBER, photo_tags.RES_TAG) a skos:Concept ;
-	    skos:prefLabel photo_tags.RES_TAG ;
-	    skos:isSubjectOf ods:photo_post (photo_tags.RES_FULL_PATH) .
-
-	    ods:photo_comment (photo_comments.RES_FULL_PATH, photo_comments.COMMENT_ID) a sioct:Comment ;
-	    sioc:reply_of ods:photo_post (photo_comments.RES_FULL_PATH) ;
-	    sioc:has_container ods:photo_forum (photo_comments.U_MEMBER, photo_comments.WAI_NAME) ;
-	    dc:title photo_comments.RES_NAME ;
-	    dct:created photo_comments.CREATE_DATE ;
-	    dct:modified photo_comments.MODIFY_DATE ;
-	    sioc:content photo_comments.TEXT ;
-	    foaf:maker ods:person (photo_comments.U_MAKER) .
-
-	    ods:photo_post (photo_comments.RES_FULL_PATH)
-	    sioc:has_reply
-	    ods:photo_comment (photo_comments.RES_FULL_PATH, photo_comments.COMMENT_ID) .
-	    # end Photo
-
-	    # Polls
-	    # end Polls
-
-	    # Mail
-	    # end Mail
-
-	    # Wiki
-            ods:wiki_post (wiki_posts.U_NAME, wiki_posts.CLUSTERNAME, wiki_posts.LOCALNAME) a wikiont:Article ;
-	    dc:title wiki_posts.LOCALNAME ;
-	    dct:created wiki_posts.RES_CREATED ;
-	    dct:modified wiki_posts.RES_MODIFIED ;
-	    sioc:content wiki_posts.RES_CONTENT ;
-	    sioc:has_creator ods:user (wiki_posts.U_NAME) ;
-	    foaf:maker ods:person (wiki_posts.U_NAME) ;
-	    sioc:has_container ods:wiki_forum (wiki_posts.U_NAME, wiki_posts.CLUSTERNAME) .
-
-	    ods:wiki_forum (wiki_posts.U_NAME, wiki_posts.CLUSTERNAME)
-	    sioc:container_of
-	    ods:wiki_post (wiki_posts.U_NAME, wiki_posts.CLUSTERNAME, wiki_posts.LOCALNAME) .
-
-	    ods:user (wiki_posts.U_NAME)
-	    sioc:creator_of
-	    ods:wiki_post (wiki_posts.U_NAME, wiki_posts.CLUSTERNAME, wiki_posts.LOCALNAME) .
-
-	    # end Wiki
-
-            # Community
-	    ods:community_forum (community.C_OWNER, community.CM_COMMUNITY_ID) a sioc:Community ;
-	    sioc:has_part ods:forum (community.A_OWNER, community.A_TYPE, community.CM_MEMBER_APP) .
-
-	    ods:forum (community.A_OWNER, community.A_TYPE, community.CM_MEMBER_APP)
-	    sioc:part_of
-	    ods:community_forum (community.C_OWNER, community.CM_COMMUNITY_ID) .
-            # end Community
-
-	    # NNTP
-	    ods:nntp_forum (nntp_groups.NG_NAME) a sioct:MessageBoard ;
-	    sioc:id nntp_groups.NG_NAME ;
-	    sioc:description nntp_groups.NG_DESC .
-
-	    ods:nntp_post (nntp_posts.NG_NAME, nntp_posts.NM_ID) a sioct:BoardPost ;
-	    sioc:content nntp_posts.NM_BODY ;
-	    dc:title nntp_posts.FTHR_SUBJ ;
-	    dct:created  nntp_posts.REC_DATE ;
-	    dct:modified nntp_posts.REC_DATE ;
-	    foaf:maker ods:proxy (nntp_posts.MAKER) ;
-	    sioc:reply_of ods:nntp_post (nntp_posts.NG_NAME, nntp_posts.FTHR_REFER) ;
-	    sioc:has_container ods:nntp_forum (nntp_posts.NG_NAME) .
-
-	    ods:nntp_post (nntp_posts.NG_NAME, nntp_posts.FTHR_REFER)
-	    sioc:has_reply
-	    ods:nntp_post (nntp_posts.NG_NAME, nntp_posts.NM_ID) .
-
-	    ods:nntp_forum (nntp_posts.NG_NAME)
-	    sioc:container_of
-	    ods:nntp_post (nntp_posts.NG_NAME, nntp_posts.NM_ID) .
-
-
-	    ods:nntp_role (nntp_groups.NG_NAME)
-	    sioc:has_scope
-	    ods:nntp_forum (nntp_groups.NG_NAME) .
-
-	    ods:nntp_forum (nntp_groups.NG_NAME)
-	    sioc:scope_of
-	    ods:nntp_role (nntp_groups.NG_NAME) .
-
-	    ods:user (nntp_users.U_NAME)
-	    sioc:has_function
-	    ods:nntp_role (nntp_users.NG_NAME) .
-
-	    ods:nntp_role (nntp_users.NG_NAME)
-	    sioc:function_of
-	    ods:user (nntp_users.U_NAME) .
-
-	    ods:nntp_post (nntp_links.NG_NAME, nntp_links.NML_MSG_ID)
-	    sioc:links_to
-	    ods:proxy (nntp_links.NML_URL) .
-	    # end NNTP
-
-	  } .
-    } .
-;
-]]></programlisting>
-<para><emphasis>URL Rewrite Rules for ODS</emphasis></para>
-<programlisting><![CDATA[
-create procedure DB.DBA.URL_REW_ODS_ACCEPT ()
-{
-  declare accept, ret any;
-  accept := http_request_header (http_request_header (), 'Accept');
-  if (not isstring (accept))
-    return null;
-  ret := null;
-  if (regexp_match ('(application|text)/rdf.(xml|n3|turtle|ttl)', accept) is not null)
-    {
-      if (regexp_match ('application/rdf.xml', accept) is not null)
-	{
-	  ret := 'rdf';
-	}
-      else if (regexp_match ('text/rdf.n3', accept) is not null)
-	{
-	  ret := 'n3';
-	}
-      else if (regexp_match ('application/rdf.turtle', accept) is not null or
-	    regexp_match ('application/rdf.ttl', accept) is not null)
-	{
-	  ret := 'n3';
-	}
-    }
-  return ret;
-};
-
-create procedure  DB.DBA.URL_REW_ODS_SPQ (in graph varchar, in iri varchar, in acc varchar)
-{
-  declare q, ret any;
-  iri := replace (iri, '''', '%27');
-  iri := replace (iri, '<', '%3C');
-  iri := replace (iri, '>', '%3E');
-  q := sprintf ('define input:inference <%s> DESCRIBE <%s> FROM <%s>', graph, iri, graph);
-  ret := sprintf ('/sparql?query=%U&format=%U', q, acc);
-  return ret;
-};
-
-create procedure DB.DBA.URL_REW_ODS_USER (in par varchar, in fmt varchar, in val varchar)
-{
---  dbg_obj_print (current_proc_name ());
-  declare acc, ret any;
-  declare q, iri, graph any;
-
-  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
-  if (acc is not null)
-    {
-      graph := sioc..get_graph ();
-      iri := sprintf ('%s/%U', graph, val);
-      if (val like 'person/%')
-	{
-	  val := substring (val, 8, length (val));
-	  ret := sprintf ('/ods/foaf.vsp?uname=%U&fmt=%U', val, acc);
-	}
-      else
-        ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-    }
-  else
-    {
-      http_header (http_header_get ()||sprintf ('X-XRDS-Location: %s\r\n',
-	    DB.DBA.wa_link (1, '/dataspace/'||val||'/yadis.xrds')));
-
-      if (val like 'person/%')
-	val := substring (val, 8, length (val));
-      ret := sprintf ('/ods/uhome.vspx?page=1&ufname=%s', val);
-    }
-  return ret;
-};
-
-create procedure DB.DBA.URL_REW_ODS_USER_GEM (in par varchar, in fmt varchar, in val varchar)
-{
---  dbg_obj_print (current_proc_name ());
-  declare acc, ret any;
-  declare q, iri, graph, path, is_person any;
-
-  path := http_path ();
-  if (path like '%.rdf')
-    acc := 'rdf';
-  else if (path like '%.n3')
-    acc := 'n3';
-  else if (path like '%.ttl')
-    acc := 'n3';
-  else if (path like '%/yadis.xrds')
-    acc := 'yadis';
-  else
-    acc := 'rdf';
-
-  if (acc <> 'yadis')
-    {
-      is_person := matches_like (path, '%/about.%');
-      graph := sioc..get_graph ();
-      if (is_person)
-	{
-          --iri := sprintf ('%s/person/%U', graph, val);
-	  ret := sprintf ('/ods/foaf.vsp?uname=%U&fmt=%U', val, acc);
-	}
-      else
-	{
-          iri := sprintf ('%s/%U', graph, val);
-          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-	}
-    }
-  else
-    {
-      ret := sprintf ('/ods/yadis.vsp?uname=%U', val);
-    }
-  return ret;
-};
-
-create procedure DB.DBA.URL_REW_ODS_GEM (in par varchar, in fmt varchar, in val varchar)
-{
---  dbg_obj_print (current_proc_name ());
-  declare acc, ret any;
-  declare q, iri, graph, path, pos any;
-
-  path := http_path ();
-  if (path like '%.rdf')
-    acc := 'rdf';
-  else if (path like '%.n3')
-    acc := 'n3';
-  else if (path like '%.ttl')
-    acc := 'n3';
-  else
-    acc := 'rdf';
-  graph := sioc..get_graph ();
-  pos := strrchr (path, '/');
-  path := subseq (path, 0, pos);
-
-  if (val = 'person')
-    {
-      pos := strrchr (path, '/');
-      val := subseq (path, pos+1, length (path));
-      ret := sprintf ('/ods/foaf.vsp?uname=%U&fmt=%U', val, acc);
-    }
-  else
-    {
-      iri := sprintf ('http://%s%s', sioc..get_cname (), path);
-      ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-    }
-  return ret;
-};
-
-
-create procedure DB.DBA.URL_REW_ODS_APP (in par varchar, in fmt varchar, in val varchar)
-{
---  dbg_obj_print (current_proc_name (), val);
-  if (par = 'app')
-    return sprintf (fmt, wa_app_to_type (val));
-  return sprintf (fmt, val);
-};
-
-create procedure DB.DBA.URL_REW_ODS_BLOG (in par varchar, in fmt varchar, in val varchar)
-{
---  dbg_obj_print (par, fmt, val);
---  dbg_obj_print (current_proc_name (), val);
-  declare acc, ret any;
-
-  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
-  if (acc is not null)
-    {
-      if (par = 'inst')
-	{
-          declare q, iri, graph any;
-          graph := sioc..get_graph ();
-          iri := 'http://' || sioc..get_cname () || http_path ();
-          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-          return ret;
-	}
-      else
-	return '';
-    }
-  else if (par = 'inst')
-    {
-      declare url any;
-      val := split_and_decode (val)[0];
-      url := (SELECT WAM_HOME_PAGE FROM WA_MEMBER WHERE WAM_INST = val AND WAM_MEMBER_TYPE = 1);
-      if (url is not null)
-        val := url;
-      return sprintf (fmt, val);
-    }
-  else if (par = 'id' and val <> '')
-    {
-      if (atoi (val) = 0 and val <> '0')
-	fmt := '%s';
-      else
-        fmt := '?id=%s';
-      return sprintf (fmt, val);
-    }
-};
-
-create procedure DB.DBA.URL_REW_ODS_NNTP (in par varchar, in fmt varchar, in val varchar)
-{
---  dbg_obj_print (par, fmt, val);
---  dbg_obj_print (current_proc_name (), val);
-  declare acc, ret any;
-
-  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
-  if (acc is not null)
-    {
-       declare q, iri, graph any;
-       graph := sioc..get_graph ();
-       iri := 'http://' || sioc..get_cname () || http_path ();
---       dbg_obj_print (iri);
-       ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-       return ret;
-    }
-  else if (par = 'grp')
-    {
-      declare gid int;
-      val := split_and_decode (val)[0];
-      gid := (SELECT NG_GROUP FROM DB.DBA.NEWS_GROUPS WHERE NG_NAME = val);
-      ret := sprintf ('/nntpf/nntpf_nthread_view.vspx?group=%d', gid);
-      return ret;
-    }
-  else if (par = 'post')
-    {
-      ret := sprintf ('/nntpf/nntpf_disp_article.vspx?id=%U', encode_base64 (val));
-      return ret;
-    }
-}
-;
-
-create procedure DB.DBA.URL_REW_ODS_XD (in par varchar, in fmt varchar, in val varchar)
-{
---  dbg_obj_print (par, fmt, val);
---  dbg_obj_print (current_proc_name (), val);
-  declare acc, ret any;
-
-  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
-  if (acc is not null)
-    {
-       declare q, iri, graph any;
-       graph := sioc..get_graph ();
-       iri := 'http://' || sioc..get_cname () || http_path ();
---       dbg_obj_print (iri);
-       ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-       return ret;
-    }
-  else if (par = 'inst')
-    {
-      val := split_and_decode (val)[0];
-      ret := (SELECT WAM_HOME_PAGE FROM WA_MEMBER WHERE WAM_INST = val and WAM_MEMBER_TYPE = 1);
-      return ret;
-    }
-}
-;
-
-create procedure DB.DBA.URL_REW_ODS_WIKI (in par varchar, in fmt varchar, in val varchar)
-{
---  dbg_obj_print (par, fmt, val);
---  dbg_obj_print (current_proc_name (), val);
-  declare acc, ret any;
-
-  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
-  if (acc is not null)
-    {
-       declare q, iri, graph any;
-       graph := sioc..get_graph ();
-       iri := 'http://' || sioc..get_cname () || http_path ();
---       dbg_obj_print (iri);
-       ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-       return ret;
-    }
-  else if (par = 'inst')
-    {
-      declare _inst DB.DBA.web_app;
-      _inst := (SELECT WAI_INST FROM WA_INSTANCE WHERE WAI_NAME = val);
-      ret := _inst.wa_post_url (null, null, val, val);
---      dbg_obj_print ('ret', ret);
-      return ret;
-    }
-  else if (par = 'post')
-    {
-      return '/'||val;
-    }
-}
-;
-
-create procedure DB.DBA.URL_REW_ODS_PHOTO (in par varchar, in fmt varchar, in val varchar)
-{
---  dbg_obj_print (par, fmt, val);
---  dbg_obj_print (current_proc_name (), val);
-  declare acc, ret any;
-
-  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
-  if (acc is not null)
-    {
-       declare q, iri, graph any;
-       graph := sioc..get_graph ();
-       iri := 'http://' || sioc..get_cname () || http_path ();
---       dbg_obj_print (iri);
-       ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-       return ret;
-    }
-  else if (par = 'inst')
-    {
-      val := split_and_decode (val)[0];
-      ret := (SELECT WAM_HOME_PAGE FROM WA_MEMBER WHERE WAM_INST = val AND WAM_MEMBER_TYPE = 1);
-      return ret;
-    }
-  else if (par = 'post')
-    {
-      declare id int;
-      declare col, nam varchar;
-      declare exit handler for not found
-	{
-	  signal ('22023', sprintf ('The resource %d doesn''t exists', id));
-	};
-      id := atoi(ltrim(val, '/'));
-      SELECT RES_FULL_PATH INTO nam FROM WS.WS.SYS_DAV_RES WHERE RES_ID = id;
-      return nam;
-    }
-}
-;
-
-create procedure DB.DBA.URL_REW_ODS_ADDRESSBOOK (in par varchar, in fmt varchar, in val varchar)
-{
-  declare acc, ret any;
-
-  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
-  if (acc is not null)
-    {
-      if (par = 'instance')
-      	{
-          declare q, iri, graph any;
-          graph := sioc..get_graph ();
-          iri := 'http://' || sioc..get_cname () || http_path ();
-          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-          return ret;
-	      }
-      else
-	      return '';
-    }
-  else if (par = 'instance')
-    {
-      declare id, url any;
-      val := split_and_decode (val)[0];
-      id := AB.WA.domain_id (val);
-      if (id is not null) {
-        url := AB.WA.ab_url (id);
-        if (url is not null)
-          val := url;
-      }
-      return sprintf (fmt, val);
-    }
-  else if (par = 'params')
-    {
-      if (atoi (val) = 0 and val <> '0')
-       	fmt := '%s';
-      else
-        fmt := '?id=%s';
-      return sprintf (fmt, val);
-    }
-}
-;
-
-create procedure DB.DBA.URL_REW_ODS_BOOKMARK (in par varchar, in fmt varchar, in val varchar)
-{
-  declare acc, ret any;
-
-  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
-  if (acc is not null)
-    {
-      if (par = 'instance')
-      	{
-          declare q, iri, graph any;
-          graph := sioc..get_graph ();
-          iri := 'http://' || sioc..get_cname () || http_path ();
-          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-          return ret;
-	      }
-      else
-	      return '';
-    }
-  else if (par = 'instance')
-    {
-      declare id, url any;
-      val := split_and_decode (val)[0];
-      id := BMK.WA.domain_id (val);
-      if (id is not null) {
-        url := BMK.WA.bookmark_url (id);
-        if (url is not null)
-          val := url;
-      }
-      return sprintf (fmt, val);
-    }
-  else if (par = 'params')
-    {
-      if (atoi (val) = 0 and val <> '0')
-       	fmt := '%s';
-      else
-        fmt := '?id=%s';
-      return sprintf (fmt, val);
-    }
-}
-;
-
-create procedure DB.DBA.URL_REW_ODS_BRIEFCASE (in par varchar, in fmt varchar, in val varchar)
-{
-  declare acc, ret any;
-
-  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
-  if (acc is not null)
-    {
-      if (par = 'instance')
-      	{
-          declare q, iri, graph any;
-          graph := sioc..get_graph ();
-          iri := 'http://' || sioc..get_cname () || http_path ();
-          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-          return ret;
-	      }
-      else
-	      return '';
-    }
-  else if (par = 'instance')
-    {
-      declare id, url any;
-      val := split_and_decode (val)[0];
-      id := ODRIVE.WA.domain_id (val);
-      if (id is not null) {
-        url := ODRIVE.WA.odrive_url (id);
-        if (url is not null)
-          val := url;
-      }
-      return sprintf (fmt, val);
-    }
-  else if (par = 'params')
-    {
-      if (atoi (val) = 0 and val <> '0')
-       	fmt := '%s';
-      else
-        fmt := '?id=%s';
-      return sprintf (fmt, val);
-    }
-}
-;
-
-create procedure DB.DBA.URL_REW_ODS_CALENDAR (in par varchar, in fmt varchar, in val varchar)
-{
-  declare acc, ret any;
-
-  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
-  if (acc is not null)
-    {
-      if (par = 'instance')
-      	{
-          declare q, iri, graph any;
-          graph := sioc..get_graph ();
-          iri := 'http://' || sioc..get_cname () || http_path ();
-          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-          return ret;
-	      }
-      else
-	      return '';
-    }
-  else if (par = 'instance')
-    {
-      declare id, url any;
-      val := split_and_decode (val)[0];
-      id := CAL.WA.domain_id (val);
-      if (id is not null) {
-        url := CAL.WA.calendar_url (id);
-        if (url is not null)
-          val := url;
-      }
-      return sprintf (fmt, val);
-    }
-  else if (par = 'params')
-    {
-      if (atoi (val) = 0 and val <> '0')
-       	fmt := '%s';
-      else
-        fmt := '?id=%s';
-      return sprintf (fmt, val);
-    }
-}
-;
-
-create procedure DB.DBA.URL_REW_ODS_FEEDS (in par varchar, in fmt varchar, in val varchar)
-{
-  declare acc, ret any;
-
-  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
-  if (acc is not null)
-    {
-      if (par = 'instance')
-      	{
-          declare q, iri, graph any;
-          graph := sioc..get_graph ();
-          iri := 'http://' || sioc..get_cname () || http_path ();
-          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-          return ret;
-	      }
-      else
-	      return '';
-    }
-  else if (par = 'instance')
-    {
-      declare id, url any;
-      val := split_and_decode (val)[0];
-      id := ENEWS.WA.domain_id (val);
-      if (id is not null) {
-        url := ENEWS.WA.enews_url (id) || 'news.vspx';
-        if (url is not null)
-          val := url;
-      }
-      return sprintf (fmt, val);
-    }
-  else if (par = 'params')
-    {
-      if (atoi (val) = 0 and val <> '0')
-       	fmt := '%s';
-      else
-        fmt := '?id=%s';
-      return sprintf (fmt, val);
-    }
-}
-;
-
-create procedure DB.DBA.URL_REW_ODS_POLLS (in par varchar, in fmt varchar, in val varchar)
-{
-  declare acc, ret any;
-
-  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
-  if (acc is not null)
-    {
-      if (par = 'instance')
-      	{
-          declare q, iri, graph any;
-          graph := sioc..get_graph ();
-          iri := 'http://' || sioc..get_cname () || http_path ();
-          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
-          return ret;
-	      }
-      else
-	      return '';
-    }
-  else if (par = 'instance')
-    {
-      declare id, url any;
-      val := split_and_decode (val)[0];
-      id := POLLS.WA.domain_id (val);
-      if (id is not null) {
-        url := POLLS.WA.polls_url (id);
-        if (url is not null)
-          val := url;
-      }
-      return sprintf (fmt, val);
-    }
-  else if (par = 'params')
-    {
-      if (atoi (val) = 0 and val <> '0')
-       	fmt := '%s';
-      else
-        fmt := '?id=%s';
-      return sprintf (fmt, val);
-    }
-}
-;
-
-create procedure DB.DBA.URL_REW_ODS_FOAF_EXT (in par varchar, in fmt varchar, in val varchar)
-{
-  if (par = '*accept*')
-    {
-      declare ext any;
-      ext := 'rdf';
-      if (val = 'text/rdf+n3')
-	ext := 'n3';
-      return sprintf (fmt, ext);
-    }
-  else
-    return sprintf (fmt, val);
-}
-;
-
-create procedure ur_ods_rdf_doc (in path varchar)
-{
-  declare r any;
-  r := regexp_match ('[^/]*\x24', path);
-  return r||'#this';
-};
-
-create procedure ur_ods_html_doc (in path varchar)
-{
-  declare pos, r any;
-  if (path like '%/foaf.%')
-    {
-      pos := strrchr (path, '/');
-    }
-  else if (path like '%#%')
-    {
-      pos := strrchr (path, '#');
-    }
-  if (pos > 0)
-    r := subseq (path, 0, pos);
-  else
-    r := '/';
-  return r;
-};
--- ODS Rules
-
--- http://cname/dataspace/uname
--- http://cname/dataspace/person/uname
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule1', 1,
-    '/dataspace/((person/)?[^/#]*)', vector('ufname'), 1,
-    '%s', vector('ufname'),
-    'DB.DBA.URL_REW_ODS_USER');
-
--- http://cname/dataspace/uname with Accept will do 303 to the /sparql
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule2', 1,
-    '/dataspace/([^/]*)', vector('ufname'), 1,
-    '/sparql?query=define+input%%3Ainference+%%3Chttp%%3A//^{URIQADefaultHost}^/dataspace%%3E+DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^/dataspace/%U%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/dataspace%%3E&format=%U', vector('ufname', '*accept*'),
-    null,
-    '(application|text)/rdf.(xml|n3|turtle|ttl)',
-    0,
-    303);
-
--- http://cname/dataspace/uname/app_type
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule3', 1,
-    '/dataspace/((?!person)[^/]*)/([^\\./]*)', vector('ufname', 'app'), 2,
-    '/ods/app_inst.vspx?app=%s&ufname=%s&l=1', vector('app', 'ufname'),
-    'DB.DBA.URL_REW_ODS_APP');
-
--- http://cname/dataspace/uname/file.ext
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule4', 1,
-    '/dataspace/([^/]*)/(sioc|about|yadis)\\.(rdf|n3|ttl|xrds)', vector('ufname', 'file', 'fmt'), 3,
-    '%s', vector('ufname'),
-    'DB.DBA.URL_REW_ODS_USER_GEM');
-
--- Rules for FOAF profile
-
--- http://cname/dataspace/person/uname with Accept, do 303 to http://cname/dataspace/person/uname/foaf.ext
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule5', 1,
-    '/dataspace/person/([^/#]*)/?', vector('ufname'), 1,
-    '/dataspace/person/%U/foaf.%s', vector('ufname', '*accept*'),
-    'DB.DBA.URL_REW_ODS_FOAF_EXT',
-    '(application|text)/rdf.(xml|n3|turtle|ttl)',
-    2,
-    303);
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule6', 1,
-    '/dataspace/person/([^/]*)/page/([^/]*)/?', vector('ufname', 'page'), 1,
-    '/dataspace/person/%U/foaf.%s?page=%s', vector('ufname', '*accept*', 'page'),
-    'DB.DBA.URL_REW_ODS_FOAF_EXT',
-    '(application|text)/rdf.(xml|n3|turtle|ttl)',
-    2,
-    303);
-
--- http://cname/dataspace/person/uname/foaf.ext
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule7', 1,
-    '/dataspace/person/([^/]*)/foaf.(rdf|n3|ttl)', vector('ufname', 'fmt'), 1,
-    '/ods/foaf.vsp?uname=%U&fmt=%U', vector('ufname', 'fmt'),
-    null,
-    null,
-    2,
-    null);
-
--- App Instance Gem
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_post_gem_rule', 1,
-    '/dataspace/([^/]*)/([^/]*)/([^/]*/)?([^/]*/)?(sioc|about)\\.(rdf|n3|ttl)', vector('ufname', 'app', 'inst'), 4,
-    '%s', vector('ufname'),
-    'DB.DBA.URL_REW_ODS_GEM');
-
-
--- Weblog Rules
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_blog_rule1', 1,
-    '/dataspace/([^/]*)/weblog/([^/]*)', vector('ufname', 'inst'), 2,
-    '%s', vector('inst'),
-    'DB.DBA.URL_REW_ODS_BLOG');
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_blog_rule2', 1,
-    '/dataspace/([^/]*)/weblog/([^/]*)/([^/]*)', vector('ufname', 'inst', 'id'), 3,
-    '%s%s', vector('inst', 'id'),
-    'DB.DBA.URL_REW_ODS_BLOG');
-
--- Discussion rules
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_nntp_rule1', 1,
-    '/dataspace/discussion/([^/]*)', vector('grp'), 1,
-    '%s', vector('grp'),
-    'DB.DBA.URL_REW_ODS_NNTP');
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_nntp_rule2', 1,
-    '/dataspace/discussion/([^/]*)/((?!sioc)(?!about)[^/]*)', vector('grp', 'post'), 2,
-    '%s', vector('post'),
-    'DB.DBA.URL_REW_ODS_NNTP');
-
--- Community
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_xd_rule1', 1,
-    '/dataspace/([^/]*)/community/([^/]*)', vector('ufname', 'inst'), 2,
-    '%s', vector('inst'),
-    'DB.DBA.URL_REW_ODS_XD');
-
--- Wiki
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_wiki_rule1', 1,
-    '/dataspace/([^/]*)/wiki/([^/]*)', vector('ufname', 'inst'), 2,
-    '%s', vector('inst'),
-    'DB.DBA.URL_REW_ODS_WIKI');
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_wiki_rule2', 1,
-    '/dataspace/([^/]*)/wiki/([^/]*)/([^/]*)', vector('ufname', 'inst', 'post'), 2,
-    '%s%s', vector('inst', 'post'),
-    'DB.DBA.URL_REW_ODS_WIKI');
-
--- Gallery
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_photo_rule1', 1,
-    '/dataspace/([^/]*)/photos/([^/]*)', vector('ufname', 'inst'), 2,
-    '%s', vector('inst'),
-    'DB.DBA.URL_REW_ODS_PHOTO');
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_photo_rule2', 1,
-    '/dataspace/([^/]*)/photos/([^/]*)/([^/]*)', vector('ufname', 'inst', 'post'), 2,
-    '%s', vector('post'),
-    'DB.DBA.URL_REW_ODS_PHOTO');
-
-
--- AddressBook
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ods_addressbook_rule1',
-    1,
-    '/dataspace/([^/]*)/addressbook/([^/]*)',
-    vector('uname', 'instance'),
-    2,
-    '%s', vector('instance'),
-    'DB.DBA.URL_REW_ODS_ADDRESSBOOK');
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ods_addressbook_rule2',
-    1,
-    '/dataspace/([^/]*)/addressbook/([^/]*)/(.*)',
-    vector('uname', 'instance', 'params'),
-    3,
-    '%s%s',
-    vector('instance', 'params'),
-    'DB.DBA.URL_REW_ODS_ADDRESSBOOK');
-
--- Bookmark
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ods_bookmark_rule1',
-    1,
-    '/dataspace/([^/]*)/bookmark/([^/]*)',
-    vector('uname', 'instance'),
-    2,
-    '%s', vector('instance'),
-    'DB.DBA.URL_REW_ODS_BOOKMARK');
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ods_bookmark_rule2',
-    1,
-    '/dataspace/([^/]*)/bookmark/([^/]*)/(.*)',
-    vector('uname', 'instance', 'params'),
-    3,
-    '%s%s',
-    vector('instance', 'params'),
-    'DB.DBA.URL_REW_ODS_BOOKMARK');
-
--- Briefcase
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ods_briefcase_rule1',
-    1,
-    '/dataspace/([^/]*)/briefcase/([^/]*)',
-    vector('uname', 'instance'),
-    2,
-    '%s', vector('instance'),
-    'DB.DBA.URL_REW_ODS_BRIEFCASE');
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ods_briefcase_rule2',
-    1,
-    '/dataspace/([^/]*)/briefcase/([^/]*)/(.*)',
-    vector('uname', 'instance', 'params'),
-    3,
-    '%s%s',
-    vector('instance', 'params'),
-    'DB.DBA.URL_REW_ODS_BRIEFCASE');
-
--- Calendar
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ods_calendar_rule1',
-    1,
-    '/dataspace/([^/]*)/calendar/([^/]*)',
-    vector('uname', 'instance'),
-    2,
-    '%s', vector('instance'),
-    'DB.DBA.URL_REW_ODS_CALENDAR');
-
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ods_calendar_rule2',
-    1,
-    '/dataspace/([^/]*)/calendar/([^/]*)/(.*)',
-    vector('uname', 'instance', 'params'),
-    3,
-    '%s%s',
-    vector('instance', 'params'),
-    'DB.DBA.URL_REW_ODS_CALENDAR');
-
--- Feeds
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ods_feeds_rule1',
-    1,
-    '/dataspace/([^/]*)/feeds/([^/]*)',
-    vector('uname', 'instance'),
-    2,
-    '%s', vector('instance'),
-    'DB.DBA.URL_REW_ODS_FEEDS');
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ods_feeds_rule2',
-    1,
-    '/dataspace/([^/]*)/feeds/([^/]*)/(.*)',
-    vector('uname', 'instance', 'params'),
-    3,
-    '%s%s',
-    vector('instance', 'params'),
-    'DB.DBA.URL_REW_ODS_FEEDS');
-
--- Polls
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ods_polls_rule1',
-    1,
-    '/dataspace/([^/]*)/polls/([^/]*)',
-    vector('uname', 'instance'),
-    2,
-    '%s', vector('instance'),
-    'DB.DBA.URL_REW_ODS_POLLS');
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ods_polls_rule2',
-    1,
-    '/dataspace/([^/]*)/polls/([^/]*)/(.*)',
-    vector('uname', 'instance', 'params'),
-    3,
-    '%s%s',
-    vector('instance', 'params'),
-    'DB.DBA.URL_REW_ODS_POLLS');
-
--- ODS Base rules
-DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_base_rule_list1', 1,
-    	vector(
-	        'ods_rule1', 'ods_rule2', 'ods_rule3', 'ods_rule4'
-	      ));
-
-DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_foaf_rule_list1', 1,
-    	vector(
-	        'ods_rule5', 'ods_rule6', 'ods_rule7'
-	      ));
-
-DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_gems_rule_list1', 1,
-    	vector(
-	        'ods_post_gem_rule'
-	      ));
-
--- ODS Blog rules
-DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_blog_rule_list1', 1,
-    	vector(
-	   	'ods_blog_rule1', 'ods_blog_rule2'
-	      ));
-
--- ODS Discussion rules
-DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_nntp_rule_list1', 1,
-    	vector(
-	   	'ods_nntp_rule1', 'ods_nntp_rule2'
-	      ));
-
--- ODS Community rules
-DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_xd_rule_list1', 1,
-    	vector(
-	   	'ods_xd_rule1'
-	      ));
-
--- ODS Wiki rules
-DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_wiki_rule_list1', 1,
-    	vector(
-	   	'ods_wiki_rule1', 'ods_wiki_rule2'
-	      ));
-
--- ODS Gallery rules
-DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_photo_rule_list1', 1,
-    	vector(
-	   	'ods_photo_rule1', 'ods_photo_rule2'
-	      ));
-
--- ODS AddressBook rules
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'ods_addressbook_rule_list1',
-    1,
-    vector (
-  	 	'ods_addressbook_rule1',
-	    'ods_addressbook_rule2'
-	  ));
-
--- ODS Bookmark rules
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'ods_bookmark_rule_list1',
-    1,
-    vector (
-  	 	'ods_bookmark_rule1',
-	    'ods_bookmark_rule2'
-	  ));
-
--- ODS Briefcase rules
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'ods_briefcase_rule_list1',
-    1,
-    vector (
-  	 	'ods_briefcase_rule1',
-	    'ods_briefcase_rule2'
-	  ));
-
--- ODS Calendar rules
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'ods_calendar_rule_list1',
-    1,
-    vector (
-  	 	'ods_calendar_rule1',
-	    'ods_calendar_rule2'
-	  ));
-
--- ODS Feeds rules
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'ods_feeds_rule_list1',
-    1,
-    vector (
-  	 	'ods_feeds_rule1',
-	    'ods_feeds_rule2'
-	  ));
-
--- ODS Polls rules
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'ods_polls_rule_list1',
-    1,
-    vector (
-  	 	'ods_polls_rule1',
-	    'ods_polls_rule2'
-	  ));
-
--- All ODS Rules
-DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_rule_list1', 1,
-    	vector(
-	  'ods_base_rule_list1',
-	  'ods_foaf_rule_list1',
-	  'ods_blog_rule_list1',
-	  'ods_nntp_rule_list1',
-	  'ods_xd_rule_list1',
-	  'ods_wiki_rule_list1',
-	  'ods_photo_rule_list1',
-	  'ods_addressbook_rule_list1',
-	  'ods_bookmark_rule_list1',
-	  'ods_briefcase_rule_list1',
-	  'ods_calendar_rule_list1',
-	  'ods_feeds_rule_list1',
-	  'ods_polls_rule_list1',
-	  'ods_gems_rule_list1'
-	      ));
-
-DB.DBA.XML_SET_NS_DECL ('ods', 'http://www.openlinksw.com/virtuoso/ods/', 2);
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfviewsbusintoplweb">
-      <title>Oplweb to RDF</title>
-<programlisting><![CDATA[
--- Setup script for RDF view of OpenLink Product Portfolio version 2
---
-
-/*
- * This view is currently designed to SPECIFICALLY load on data.openlinksw.com. We recommend you
- * search for `openlinksw.com'  (as `http://' is sometimes encoded) and replace with either the default
- * URIQA macro or your own hostname as appropriate.
- */
-
--- views to get the codes out instead of the id's
----- in hindsight these should ALL have been handled with
----- proper IRI functions like the rest, oh well, no harm AFAIK
----- will know for next time or might even replace this later.
-DROP VIEW oplweb2.oplweb.product_formats_categories;
-
-CREATE VIEW oplweb2.oplweb.product_formats_categories (
-    product_cat_code, product_cat_id, product_format_code, product_format_id, product_family_id
-  ) as
-SELECT distinct
-  pc.product_cat_code,
-  pc.product_cat_id,
-  pf.product_format_code,
-  pf.product_format_id,
-  pc.product_family_id
-FROM
-  oplweb2.oplweb.product_category pc,
-  oplweb2.oplweb.product_format pf,
-  oplweb2.oplweb.product p
-WHERE
-  p.product_cat_id = pc.product_cat_id and
-  p.product_format_id = pf.product_format_id
-  AND EXISTS (
-	SELECT 1 FROM oplweb2.oplweb.component_archive ca
-	WHERE ca.product_id = p.product_id
-	)
-;
-
-
-DROP VIEW oplweb2.oplweb.product_with_code;
-
-CREATE VIEW oplweb2.oplweb.product_with_code as
-  SELECT p.*, pc.product_cat_code, pf.product_format_code
-  FROM
-  oplweb2.oplweb.product_category pc,
-  oplweb2.oplweb.product_format pf,
-  oplweb2.oplweb.product p
-WHERE
-  p.product_cat_id = pc.product_cat_id and
-  p.product_format_id = pf.product_format_id ;
-
-
-DROP VIEW oplweb2.oplweb.product_category_with_code;
-
-CREATE VIEW oplweb2.oplweb.product_category_with_code as
-  SELECT pc.*, pf.product_family_code
-  from
-  oplweb2.oplweb.product_category pc,
-  oplweb2.oplweb.product_family pf
-where
-  pc.product_family_id = pf.product_family_id ;
-
-
-DROP VIEW oplweb2.oplweb.product_family_features_with_code;
-
-CREATE VIEW oplweb2.oplweb.product_family_features_with_code as
-  SELECT a.*, b.product_family_code
-  from
-  oplweb2.oplweb.product_family_features a,
-  oplweb2.oplweb.product_family b
-where
-  a.product_family_id = b.product_family_id
-;
-
-DROP VIEW oplweb2.oplweb.product_format_features_with_code;
-
-CREATE VIEW oplweb2.oplweb.product_format_features_with_code as
-  SELECT a.*, b.product_format_code
-  from
-  oplweb2.oplweb.product_format_features a,
-  oplweb2.oplweb.product_format b
-where
-  a.product_format_id = b.product_format_id
-;
-
-DROP VIEW oplweb2.oplweb.product_category_features_with_code;
-
-CREATE VIEW oplweb2.oplweb.product_category_features_with_code as
-  SELECT a.*, b.product_cat_code
-  from
-  oplweb2.oplweb.product_category_features a,
-  oplweb2.oplweb.product_category b
-where
-  a.product_cat_id = b.product_cat_id
-;
-
-DROP VIEW oplweb2.oplweb.components_for_rdfs;
-
-CREATE VIEW oplweb2.oplweb.components_for_rdfs as
-  SELECT *, cast(filesize as varchar) as str_filesize
-  from
-  oplweb2.oplweb.components
-;
-
-
-DROP VIEW oplweb2.oplweb.product_release_with_family;
-
-CREATE VIEW oplweb2.oplweb.product_release_with_family as
-  SELECT a.*, b.opsys_family_id, c.dbms_family_id
-  from
-  oplweb2.oplweb.product_release a,
-  oplweb2.oplweb.opsys b,
-  oplweb2.oplweb.dbms_engine c
-where
-  a.opsys_name = b.opsys_name and
-  a.dbms_name = c.dbms_name
-;
-
-drop view oplweb2.oplweb.archive_coverage_osdb;
-
-create view oplweb2.oplweb.archive_coverage_osdb as
-	SELECT distinct
-	  pfam.product_family_id, pfam.product_family_code,
-	  p.product_format_id, pf.product_format_code,
-	  p.product_cat_id, pc.product_cat_code,
-	  p.product_id,
-	  ca.opsys_name,
-	  os.opsys_family_id,
-	  ca.dbms_name,
-	  db.dbms_family_id,
-	  pr.processor_name,
-	  pr.processor_mode_id,
-	  pr.processor_family_id
-	from
-	   oplweb2.oplweb.product p
-  join oplweb2.oplweb.product_category pc on (p.product_cat_id = pc.product_cat_id)
-  join oplweb2.oplweb.product_format pf on (p.product_format_id = pf.product_format_id)
-  join oplweb2.oplweb.product_family pfam on (pc.product_family_id = pfam.product_family_id)
-  join oplweb2.oplweb.component_archive ca on (ca.product_id = p.product_id)
-  join oplweb2.oplweb.opsys os on (os.opsys_name = ca.opsys_name)
-  join oplweb2.oplweb.dbms_engine db on (db.dbms_name = ca.dbms_name)
-  join oplweb2.oplweb.processors pr on (pr.processor_name = os.processor_name and pr.processor_mode_id = os.processor_mode_id)
-;
-
-GRANT SELECT ON oplweb2.oplweb.component_archive TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.component_archive_type TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.component_category TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.component_mode TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.component_type TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.components TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.components_for_rdfs TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.dbms_engine TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.dbms_family TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.download_location TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.download_protocol TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.download_partner TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.opsys TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.opsys_family TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.opsys_type TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.processor_family TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.processor_mode TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.processors TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_benefits TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_benefits_category TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_category TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_category_with_code TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_category_features TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_family TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_family_features TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_features TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_format TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_format_features TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_feature_category TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_release TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_release_features TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.vendor_category TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.vendor_category_family TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.vendors TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_formats_categories TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_with_code TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_family_features_with_code TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_format_features_with_code TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_category_features_with_code TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.product_release_with_family TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON oplweb2.oplweb.archive_coverage_osdb TO "SPARQL", "SPARQL_UPDATE";
-
-
-drop index oplweb2_product_price_format_cat;
-
-create index oplweb2_product_price_format_cat on oplweb2.oplweb.product_price(product_cat_id, product_format_id, product_price_type_id);
-
-drop index oplweb2_product_discount_format_cat;
-
-create index oplweb2_product_discount_format_cat on oplweb2.oplweb.product_general_discount(product_cat_id, product_format_id, product_price_type_id);
-
-
-drop view oplweb2.DBA.license_model_type;
-
-create view oplweb2.DBA.license_model_type (
-	product_release_id, product_cat_id, product_format_id, product_id, product_price_type_id
-	)
-	as
-	SELECT distinct
-	product_release_id,
-	pp.product_cat_id, pp.product_format_id, product_id,
-	product_price_type_id
-	FROM
-	  oplweb2.oplweb.product_price pp,
-	  oplweb2.oplweb.product p
-	WHERE p.product_cat_id = pp.product_cat_id AND
-	p.product_format_id = pp.product_format_id
-	;
-
-grant SELECT on oplweb2.DBA.license_model_type to "SPARQL", "SPARQL_UPDATE";--, rdf;
-
-
-
-drop view oplweb2.DBA.license_model;
-
-create view oplweb2.DBA.license_model as
-  SELECT  distinct
-      product_release_id,
-      pc.product_cat_id,
-      pc.product_format_id,
-      pc.product_cat_code,
-      pc.product_format_code,
-      pc.product_id,
-      pp.opsys_family_id, pp.dbms_family_id,
-      replace(oo.opsys_family_name, ' ', '') as opsys_family_name,
-      replace(dd.dbms_family_name,  ' ', '') as dbms_family_name,
-      pp.opsys_type_id,
-      pp.product_price_type_id,
-	  pp.product_price_unit_type_id
-    from
-      oplweb2.oplweb.product_price pp,
-      oplweb2.oplweb.product_with_code pc, --category pc,
-      --oplweb2.oplweb.product_format pf,
-      oplweb2.oplweb.opsys os,
-      oplweb2.oplweb.dbms_engine dbe,
-      oplweb2.oplweb.dbms_family dd,
-      oplweb2.oplweb.opsys_family oo
-      --oplweb2.oplweb.product p
-    where
-      pp.product_format_id = pc.product_format_id and
-      pp.product_cat_id = pc.product_cat_id and
-      pp.opsys_family_id = oo.opsys_family_id and
-      pp.dbms_family_id = dd.dbms_family_id
-      --p.product_cat_id = pc.product_cat_id and
-      --p.product_format_id = pf.product_format_id and
-  ;
-
-grant SELECT on oplweb2.DBA.license_model to "SPARQL", "SPARQL_UPDATE";--, rdf;
-
-
-drop view oplweb2.DBA.license_model_units;
-
-create view oplweb2.DBA.license_model_units as
-  SELECT distinct
-      lm1.product_release_id,
-	  lm1.product_id,
-	  lm1.opsys_family_
-      pp.opsys_family_id, pp.dbms_family_id,
-      replace(oo.opsys_family_name, ' ', '') as opsys_family_name,
-      replace(dd.dbms_family_name,  ' ', '') as dbms_family_name,
-      pp.opsys_type_id, ot.short_description as opsys_type_code
-    from
-      oplweb2.oplweb.product_price pp,
-      oplweb2.oplweb.opsys_type ot,
-      oplweb2.oplweb.dbms_family dd,
-      oplweb2.oplweb.opsys_family oo
-    where
-      pp.opsys_type_id = ot.opsys_type_id and
-      pp.opsys_family_id = oo.opsys_family_id and
-      pp.dbms_family_id = dd.dbms_family_id
-      and
-      pp.product_release_id = '6.1'
-  ;
-
-grant SELECT on oplweb2.DBA.license_model_units to "SPARQL", "SPARQL_UPDATE";--, rdf;
-
-
-
-drop view oplweb2.DBA.product_general_discount_vc;
-
-create view oplweb2.DBA.product_general_discount_vc as
-  SELECT  distinct
-      product_release_id,
-      pgd.product_cat_id, pc.product_cat_code,
-      pgd.product_format_id, pc.product_format_code,
-	  pc.product_id,
-      pgd.opsys_family_id, pgd.dbms_family_id,
-      pgd.opsys_type_id,
-      product_discount_description,
-      product_price_type_id,
-      cast(unit_discount as varchar) as unit_discount,
-      discount_start,
-      discount_end,
-      discount_token
-    from
-      oplweb2.oplweb.product_general_discount pgd,
-      oplweb2.oplweb.product_with_code pc
-    where
-      pgd.product_format_id = pc.product_format_id and
-      pgd.product_cat_id = pc.product_cat_id
-  ;
-
-drop view oplweb2.DBA.product_price_varchar;
-
-create view oplweb2.DBA.product_price_varchar as
-  select
-      pp.product_price_id,
-      pp.product_release_id,
-      pp.product_cat_id, pc.product_cat_code,
-      pp.product_format_id, pf.product_format_code,
-      pp.opsys_family_id, pp.dbms_family_id,
-      replace(oo.opsys_family_name, ' ', '') as opsys_family_name,
-      replace(dd.dbms_family_name,  ' ', '') as dbms_family_name,
-      pp.opsys_type_id, ot.short_description as opsys_type_code,
-			pp.product_price_type_id,
-      pp.product_price_unit_type_id, cast(pp.unit_price as varchar) as unit_price,
-      pp.component_archive_available
-    from
-      oplweb2.oplweb.product_price pp,
-      oplweb2.oplweb.product_category pc,
-      oplweb2.oplweb.product_format pf,
-      oplweb2.oplweb.opsys_type ot,
-      oplweb2.oplweb.dbms_family dd,
-      oplweb2.oplweb.opsys_family oo
-    where
-      pp.product_format_id = pf.product_format_id and
-      pp.product_cat_id = pc.product_cat_id and
-      pp.opsys_type_id = ot.opsys_type_id and
-      pp.opsys_family_id = oo.opsys_family_id and
-      pp.dbms_family_id = dd.dbms_family_id
-      --and
-      --pp.product_release_id = '6.1'
-  ;
-
-grant SELECT on oplweb2.oplweb.product_price to "SPARQL", "SPARQL_UPDATE";--, rdf;
-grant SELECT on oplweb2.oplweb.product_price_type to "SPARQL", "SPARQL_UPDATE";--, rdf;
-grant SELECT on oplweb2.oplweb.product_price_unit_type to "SPARQL", "SPARQL_UPDATE";--, rdf;
-grant SELECT on oplweb2.DBA.product_general_discount_vc to "SPARQL", "SPARQL_UPDATE";--, rdf;
-grant SELECT on oplweb2.DBA.product_price_varchar to "SPARQL", "SPARQL_UPDATE";--, rdf;
-grant SELECT on oplweb2.DBA.license_model_type to "SPARQL", "SPARQL_UPDATE";--, rdf;
-
-
-
-DB.DBA.RDF_AUDIT_METADATA (1, '*');
---DB.DBA.RDF_AUDIT_METADATA (2, '*');
-
---sparql drop graph <http://www.openlinksw.com/dataspace/organization/openlink/ProductPortfolioOntology/1.0/>;
-
---possible previous graph now merging with this oplweb graph
-sparql drop graph <http://data.openlinksw.com/shop_pricing/>;
-
---others that have a dependency on this graph that may need kicking first
---sparql drop graph <http://data.openlinksw.com/customer/>;
---sparql drop graph <http://data.openlinksw.com/support/>;
---sparql drop graph <http://data.openlinksw.com/shop_pricing/>;
-
-SPARQL drop graph <http://www.openlinksw.com/schemas/oplweb#> ;
-
-SPARQL drop graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb#> ;
-SPARQL drop graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/> ;
-
-
--- should now use <http://www.openlinksw.com/dataspace/organization/openlink#this>
-
-SPARQL drop quad map virtrdf:product_portfolio ;
-
---only use this if you really really mean it, it will totally nuke your RDF data, useful on
---test boxes in a bit of jam (hasn't happened to me for a while now)
---rdf_global_reset();
-
---utility for stripping url killing stuff from friendly strings used as ids
-create function oplweb2.oplweb.FIXUP4URI (in _string varchar)
-	returns varchar
-	{
-	  declare _s varchar;
-      _s := replace (_string, ' ', '');
-      _s := replace (_s, '&', '_');
-      _s := replace (_s, '/', '');
-      return _s;
-	}
-	;
-
---URI-IRI mapping functions
-create function oplweb2.oplweb.DOWNLOAD_LOCATION_URI (in uri varchar)
-returns varchar
-	{
-  return sprintf('http://data.openlinksw.com/oplweb/download_location/%s#this',
-  	replace(uri, 'http://', ''));
-};
-
-create function oplweb2.oplweb.DOWNLOAD_LOCATION_URI_INVERSE (in dl_iri varchar)
-returns varchar
-	{
-  declare parts any;
-
-  parts := sprintf_inverse(dl_iri,
-  	'http://data.openlinksw.com/oplweb/download_location/%s#this', 1);
-  if (parts is not null)
-    {
-      return sprintf('http://%s', parts[0]);
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.DOWNLOAD_LOCATION_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.DOWNLOAD_LOCATION_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.DBMS_FAMILY_URI (in _family_id integer)
-returns varchar
-{
-  declare _family_string varchar;
-  SELECT dbms_family_name into _family_string
-    FROM oplweb2.oplweb.dbms_family
-    WHERE dbms_family_id = _family_id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/dbms_family/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_family_string));
-};
-
-create function oplweb2.oplweb.DBMS_FAMILY_URI_INVERSE (in _iri varchar)
-returns integer
-{
-  declare parts any;
-  declare _family_id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/dbms_family/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 dbms_family_id into _family_id FROM oplweb2.oplweb.dbms_family
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(dbms_family_name)) = lower(parts[0]);
-      return _family_id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.DBMS_FAMILY_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.DBMS_FAMILY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.COMPONENT_CATEGORY_URI (in _id integer)
-returns varchar
-	{
-  declare _string varchar;
-  SELECT short_description into _string
-    FROM oplweb2.oplweb.component_category
-    WHERE component_category_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/component_category/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.COMPONENT_CATEGORY_URI_INVERSE (in _iri varchar)
-returns integer
-	{
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/component_category/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 component_category_id into _id FROM oplweb2.oplweb.component_category
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
-      return _id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_CATEGORY_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_CATEGORY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.COMPONENT_MODE_URI (in _id integer)
-returns varchar
-{
-  declare _string varchar;
-  SELECT short_description into _string
-    FROM oplweb2.oplweb.component_mode
-    WHERE component_mode_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/component_mode/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.COMPONENT_MODE_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/component_mode/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 component_mode_id into _id FROM oplweb2.oplweb.component_mode
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
-      return _id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_MODE_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_MODE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.COMPONENT_TYPE_URI (in _id integer)
-returns varchar
-{
-  declare _string varchar;
-  SELECT short_description into _string
-    FROM oplweb2.oplweb.component_type
-    WHERE component_type_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/component_type/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.COMPONENT_TYPE_URI_INVERSE (in _iri varchar)
-returns integer
-{
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/component_type/%s#this', 1);
-  if (parts is not null)
-	{
-      declare exit handler for not found return null;
-      SELECT top 1 component_type_id into _id FROM oplweb2.oplweb.component_type
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
-      return _id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_TYPE_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_TYPE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-
-create function oplweb2.oplweb.COMPONENT_ARCHIVE_TYPE_URI (in _id integer)
-returns varchar
-    {
-  declare _string varchar;
-  SELECT component_archive_short_name into _string
-    FROM oplweb2.oplweb.component_archive_type
-    WHERE component_archive_type_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/component_archive_type/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.COMPONENT_ARCHIVE_TYPE_URI_INVERSE (in _iri varchar)
-returns integer
-{
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/component_archive_type/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 component_archive_type_id into _id FROM oplweb2.oplweb.component_archive_type
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(component_archive_short_name)) = lower(parts[0]);
-      return _id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_ARCHIVE_TYPE_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_ARCHIVE_TYPE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-
-create function oplweb2.oplweb.FEATURE_BENEFIT_URI (in _id integer)
-returns varchar
-    {
-  declare _string varchar;
-  SELECT product_benefit_desc into _string
-    FROM oplweb2.oplweb.product_benefits
-    WHERE product_benefit_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/feature_benefit/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.FEATURE_BENEFIT_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/feature_benefit/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 product_benefit_id into _id FROM oplweb2.oplweb.product_benefits
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(product_benefit_desc)) = lower(parts[0]);
-      return _id;
-}
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.FEATURE_BENEFIT_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.FEATURE_BENEFIT_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-
-create function oplweb2.oplweb.OPSYS_FAMILY_URI (in _id integer)
-returns varchar
-{
-  declare _string varchar;
-  SELECT opsys_family_name into _string
-    FROM oplweb2.oplweb.opsys_family
-    WHERE opsys_family_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/opsys_family/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.OPSYS_FAMILY_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/opsys_family/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 opsys_family_id into _id FROM oplweb2.oplweb.opsys_family
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(opsys_family_name)) = lower(parts[0]);
-      return _id;
-}
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.OPSYS_FAMILY_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.OPSYS_FAMILY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-
-create function oplweb2.oplweb.OPSYS_TYPE_URI (in _id integer)
-returns varchar
-{
-  declare _string varchar;
-  SELECT short_description into _string
-    FROM oplweb2.oplweb.opsys_type
-    WHERE opsys_type_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/opsys_type/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.OPSYS_TYPE_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/opsys_type/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT TOP 1 opsys_type_id into _id FROM oplweb2.oplweb.opsys_type
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
-      return _id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.OPSYS_TYPE_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.OPSYS_TYPE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.PROCESSOR_FAMILY_URI (in _id integer)
-returns varchar
-    {
-  declare _string varchar;
-  SELECT processor_family_name into _string
-    FROM oplweb2.oplweb.processor_family
-    WHERE processor_family_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/processor_family/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.PROCESSOR_FAMILY_URI_INVERSE (in _iri varchar)
-returns integer
-{
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/processor_family/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 processor_family_id into _id FROM oplweb2.oplweb.processor_family
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(processor_family_name)) = lower(parts[0]);
-      return _id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.PROCESSOR_FAMILY_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.PROCESSOR_FAMILY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
---FIXME might have to do something with possible & symbols
-create function oplweb2.oplweb.PROCESSOR_MODE_URI (in _id integer)
-returns varchar
-    {
-  declare _string varchar;
-  SELECT processor_mode_name into _string
-    FROM oplweb2.oplweb.processor_mode
-    where processor_mode_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/processor_mode/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.PROCESSOR_MODE_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/processor_mode/%s#this', 1);
-  if (parts is not null)
-	{
-      declare exit handler for not found return null;
-      SELECT top 1 processor_mode_id into _id FROM oplweb2.oplweb.processor_mode
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(processor_mode_name)) = lower(parts[0]);
-      return _id;
-}
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.PROCESSOR_MODE_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.PROCESSOR_MODE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI (in _id integer)
-returns varchar
-{
-  declare _string varchar;
-  SELECT short_description into _string
-    FROM oplweb2.oplweb.product_category_features
-    WHERE product_category_feature_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/product_category_feature/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/product_category_feature/%s#this', 1);
-  if (parts is not null)
-      	{
-      declare exit handler for not found return null;
-      SELECT top 1 product_category_feature_id into _id FROM oplweb2.oplweb.product_category_features
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
-      return _id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI (in _id integer)
-returns varchar
-    {
-  declare _string varchar;
-  SELECT short_description into _string
-    FROM oplweb2.oplweb.product_family_features
-    WHERE product_family_feature_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/product_family_feature/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/product_family_feature/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 product_family_feature_id into _id FROM oplweb2.oplweb.product_family_features
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
-      return _id;
-}
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI (in _id integer)
-returns varchar
-{
-  declare _string varchar;
-  SELECT short_desc into _string
-    FROM oplweb2.oplweb.product_feature_category
-    WHERE product_feature_category_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/product_feature_category/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/product_feature_category/%s#this', 1);
-  if (parts is not null)
-      	{
-      declare exit handler for not found return null;
-      SELECT top 1 product_feature_category_id into _id FROM oplweb2.oplweb.product_feature_category
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_desc)) = lower(parts[0]);
-      return _id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.PRODUCT_FEATURE_URI (in _id integer)
-returns varchar
-    {
-  declare _string varchar;
-  SELECT short_description into _string
-    FROM oplweb2.oplweb.product_features
-    WHERE product_feature_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/product_feature/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.PRODUCT_FEATURE_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/product_feature/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 product_feature_id into _id FROM oplweb2.oplweb.product_features
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
-      return _id;
-}
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI (in _id integer)
-returns varchar
-{
-  declare _string varchar;
-  SELECT short_description into _string
-    FROM oplweb2.oplweb.product_format_features
-    WHERE product_format_feature_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/product_format_feature/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/product_format_feature/%s#this', 1);
-  if (parts is not null)
-      	{
-      declare exit handler for not found return null;
-      SELECT top 1 product_format_feature_id into _id FROM oplweb2.oplweb.product_format_features
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
-      return _id;
-}
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI (in _id integer)
-returns varchar
-      	{
-  declare _string varchar;
-  SELECT short_description into _string
-    FROM oplweb2.oplweb.product_release_features
-    WHERE product_release_feature_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/product_release_feature/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/product_release_feature/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 product_release_feature_id into _id FROM oplweb2.oplweb.product_release_features
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
-      return _id;
-}
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.PRODUCT_BENEFIT_URI (in _id integer)
-returns varchar
-{
-  declare _string varchar;
-  SELECT product_benefit_desc into _string
-    FROM oplweb2.oplweb.product_benefits
-    WHERE product_benefit_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/product_benefit/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.PRODUCT_BENEFIT_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/product_benefit/%s#this', 1);
-  if (parts is not null)
-      	{
-      declare exit handler for not found return null;
-      SELECT top 1 product_benefit_id into _id FROM oplweb2.oplweb.product_benefits
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(product_benefit_desc)) = lower(parts[0]);
-      return _id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_BENEFIT_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_BENEFIT_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI (in _id integer)
-returns varchar
-    {
-  declare _string varchar;
-  SELECT description into _string
-    FROM oplweb2.oplweb.product_benefits_category
-    WHERE product_benefit_category_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/product_benefit_category/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/product_benefit_category/%s#this', 1);
-  if (parts is not null)
-{
-      declare exit handler for not found return null;
-      SELECT top 1 product_benefit_category_id into _id FROM oplweb2.oplweb.product_benefits_category
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(description)) = lower(parts[0]);
-      return _id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.VENDOR_URI (in _id integer)
-returns varchar
-    {
-  declare _string varchar;
-  SELECT vendor_name into _string
-    FROM oplweb2.oplweb.vendors
-    where vendor_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/vendor/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.VENDOR_URI_INVERSE (in _iri varchar)
-returns integer
-      	{
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/vendor/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 vendor_id into _id FROM oplweb2.oplweb.vendors
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(vendor_name)) = lower(parts[0]);
-      return _id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.VENDOR_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.VENDOR_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.VENDOR_CATEGORY_URI (in _id integer)
-returns varchar
-    {
-  declare _string varchar;
-  SELECT vendor_category_description into _string
-    FROM oplweb2.oplweb.vendor_category
-    where vendor_category_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/vendor_category/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.VENDOR_CATEGORY_URI_INVERSE (in _iri varchar)
-returns integer
-{
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/vendor_category/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 vendor_category_id into _id FROM oplweb2.oplweb.vendor_category
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(vendor_category_description)) = lower(parts[0]);
-      return _id;
-}
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.VENDOR_CATEGORY_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.VENDOR_CATEGORY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI (in _id integer)
-returns varchar
-{
-  declare _string varchar;
-  SELECT vendor_category_family_desc into _string
-    FROM oplweb2.oplweb.vendor_category_family
-    where vendor_category_family_id = _id ;
-
-  return sprintf('http://data.openlinksw.com/oplweb/vendor_category_family/%s#this',
-  	oplweb2.oplweb.FIXUP4URI(_string));
-};
-
-create function oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI_INVERSE (in _iri varchar)
-returns integer
-    {
-  declare parts any;
-  declare _id integer;
-
-  parts := sprintf_inverse(_iri,
-  	'http://data.openlinksw.com/oplweb/vendor_category_family/%s#this', 1);
-  if (parts is not null)
-    {
-      declare exit handler for not found return null;
-      SELECT top 1 vendor_category_family_id into _id FROM oplweb2.oplweb.vendor_category_family
-        WHERE lower(oplweb2.oplweb.FIXUP4URI(vendor_category_family_desc)) = lower(parts[0]);
-      return _id;
-    }
-  return NULL;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
-
-
-
-
-
-create function oplweb2.oplweb.LIT_PRODUCT_RELEASE_LABEL (
-	in _product_id varchar, in _id integer, in _opsys_name varchar, in _dbms_name varchar
-	)
-returns varchar
-{
-  declare _string varchar;
-  SELECT 'OpenLink ' || poduct_description || ' (Release ' || product_release_id || ') on ' || commercial_name into _string
-    FROM oplweb2.oplweb.product_release pr,
-      oplweb2.oplweb.product p,
-      oplweb2.oplweb.opsys o
-    where
-      p.product_id = pr.product_id and
-      o.opsys_name = pr.opsys_name and
-      pr.product_release_id = _id and
-      pr.product_id = _product_id and
-      pr.opsys_name = _opsys_name and
-      pr.dbms_name = _dbms_name ;
-
-  return _string;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.LIT_PRODUCT_RELEASE_LABEL TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.LIT_FORMAT_CAT_LABEL (
-	in _format integer, in _cat integer
-	)
-returns varchar
-{
-  declare _string varchar;
-  SELECT top 1 'OpenLink ' || cast(product_format_description as varchar) || ' ' || cast(product_category_description as varchar) into _string
-    from
-      oplweb2.oplweb.product_formats_categories fc,
-      oplweb2.oplweb.product_format f,
-      oplweb2.oplweb.product_category c
-    where
-fc.product_format_id = f.product_format_id and
-fc.product_cat_id = c.product_cat_id and
-    fc.product_format_id = _format and
-    fc.product_cat_id = _cat;
-
-  return _string;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.LIT_FORMAT_CAT_LABEL TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.LITRDF_openlink_logo (in _code varchar)
-returns varchar
-{
-  declare _string varchar;
-  SELECT top 1 product_family_logo_url into _string
-    FROM oplweb2.oplweb.product_family
-    WHERE product_family_code = _code;
-
-  return _string;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.LITRDF_openlink_logo TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.LITRDF_homepage (in _code varchar)
-returns varchar
-{
-  declare _string varchar;
-  SELECT top 1 product_family_homepage into _string
-    FROM oplweb2.oplweb.product_family
-    WHERE product_family_code = _code;
-
-  return _string;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.LITRDF_homepage TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.LITRDF_opsys_icon (in _id integer)
-returns varchar
-{
-  declare _string varchar; _string := '';
-  SELECT top 1 opsys_icon_name into _string
-    FROM oplweb2.oplweb.opsys_family
-    where opsys_family_id = _id;
-
-  _string := 'http://download.openlinksw.com/download/images/'||_string;
-
-  return _string;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.LITRDF_opsys_icon TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.LITRDF_to_shop (
-	in release_id varchar,
-	in product_id varchar,
-	in opsys varchar,
-	in dbms varchar
-	)
-returns varchar
-{
-  declare _string varchar; _string := '';
-  declare _cat, _format, _prod varchar;
-
-  _prod := product_id;
-
-  SELECT top 1 cast(product_cat_id as varchar), cast(product_format_id as varchar)
-      into _cat, _format
-    FROM oplweb2.oplweb.product p
-    WHERE p.product_id = _prod;
-
-  _string := sprintf(
-	'https://shop.openlinksw.com/?product_release_id=%s&product=%s&product_cat=%V&product_format=%V&os=%s&db=%s&buyme=yes',
-	release_id, product_id, _cat, _format, opsys, dbms
-	);
-
-  return _string;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.LITRDF_to_shop TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.LITRDF_license_model_type (
-		in _product_price_type_id integer
-	)
-returns varchar
-{
-  declare _string varchar; _string := '';
-
-  SELECT top 1 product_price_type_description into _string FROM oplweb2.oplweb.product_price_type
-    WHERE product_price_type_id = _product_price_type_id;
-
-  return _string || ' License';
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.LITRDF_license_model_type TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.LITRDF_license_model_explain (
-		in _product_price_type_id integer
-	)
-returns varchar
-{
-  declare _string varchar; _string := '';
-
-  SELECT top 1 product_price_type_long_description into _string FROM oplweb2.oplweb.product_price_type
-    WHERE product_price_type_id = _product_price_type_id;
-
-  return _string;
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.LITRDF_license_model_explain TO "SPARQL", "SPARQL_UPDATE";
-
-
-create function oplweb2.oplweb.LITRDF_shop_sample (
-	in release_id varchar,
-	in product_id varchar,
-	in opsys varchar,
-	in dbms varchar
-	)
-returns varchar
-{
-  declare _string varchar; _string := '';
-  declare _cat, _format, _prod, _pricetype varchar;
-
-  _prod := product_id;
-
-  SELECT top 1 cast(product_cat_id as varchar), cast(product_format_id as varchar), cast(product_price_type_id as varchar)
-      into _cat, _format, _pricetype
-    FROM oplweb2.DBA.license_model p, oplweb2.oplweb.opsys o, oplweb2.oplweb.dbms_engine e
-    WHERE p.product_id = _prod and product_release_id = release_id and o.opsys_name = opsys and e.dbms_name = dbms
-      and p.dbms_family_id = e.dbms_family_id and o.opsys_family_id = p.opsys_family_id;
-
-  _string := sprintf(
-	'https://shop.openlinksw.com/price_calc.vsp?release=%s&cat=%V&format=%V&os=%s&db=%s&lictype=%V',
-	release_id, _cat, _format, opsys, dbms, _pricetype
-	);
-
-  return http_client(_string);
-};
-
-GRANT EXECUTE ON oplweb2.oplweb.LITRDF_shop_sample TO "SPARQL", "SPARQL_UPDATE";
-
-
--- $Id: rdfandsparql.xml,v 1.95.2.36 2010/07/08 15:18:23 source Exp $
--- Setup script for RDF view of OpenLink Product Portfolio version 2
---
-
---
--- This view is currently designed to SPECIFICALLY load on data.openlinksw.com. The default URI macro has NOT
--- been used here because it makes no sense on the target box which is actually my.usnet.private:8891 or
--- something similar. If you want to use this view on another box, a simple search-replace should do the trick,
--- but search-replace just`data.openlinksw.com' because http:// is sometimes encoded and you would miss it.
---
---
-
-
-
-SPARQL drop quad map virtrdf:product_portfolio2 ;
-SPARQL drop quad map virtrdf:product_portfolio ;
-
-SPARQL
-
-prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
-
-drop iri class opl:DownloadLocation .
-drop iri class opl:ComponentCategory .
-drop iri class opl:Component .
-drop iri class opl:ComponentArchive .
-drop iri class opl:ComponentArchiveType .
-drop iri class opl:ComponentCategory .
-drop iri class opl:ComponentMode .
-drop iri class opl:ComponentType .
-drop iri class opl:DbmsEngine .
-drop iri class opl:DbmsFamily .
-drop iri class opl:DownloadProtocol .
-drop iri class opl:DownloadPartner .
-drop iri class opl:FeatureBenefit .
-drop iri class opl:Opsys .
-drop iri class opl:OpsysFamily .
-drop iri class opl:OpsysType .
-drop iri class opl:Processor .
-drop iri class opl:ProcessorFamily .
-drop iri class opl:ProcessorMode .
-drop iri class opl:ProductRelease .
-drop iri class opl:Product .
-drop iri class opl:ProductCategory .
-drop iri class opl:ProductCategoryFeature .
-drop iri class opl:ProductPortfolio .
-drop iri class opl:ProductFamily .
-drop iri class opl:ProductFamilyFeature .
-drop iri class opl:ProductFeatureCategory .
-drop iri class opl:ProductFeature .
-drop iri class opl:ProductFormat .
-drop iri class opl:ProductFormatCategory .
-drop iri class opl:ProductFormatFeature .
-drop iri class opl:ProductReleaseFeature .
-drop iri class opl:ProductBenefit .
-drop iri class opl:ProductBenefitCategory .
-drop iri class opl:Vendor .
-drop iri class opl:VendorCategory .
-drop iri class opl:VendorCategoryFamily .
-drop iri class opl:PriceType .
-drop iri class opl:PriceUnitType .
-drop iri class opl:PriceUnitIncrementalDiscount .
-drop iri class opl:ProductPrice .
-drop iri class opl:LicenseType .
-drop iri class opl:LicenseModel .
-drop iri class opl:LicenseClass .
-drop iri class opl:Discount .
-drop literal class opl:lit_product_release_label .
-drop literal class opl:lit_format_cat_label .
-drop literal class opl:lit_openlink_logo .
-drop iri class opl:lit_openlink_logo .
-drop literal class opl:lit_homepage .
-drop iri class opl:lit_homepage .
-drop literal class opl:lit_opsys_icon .
-drop iri class opl:lit_opsys_icon .
-drop literal class opl:lit_to_shop .
-drop iri class opl:lit_to_shop .
-drop literal class opl:lit_license_model_type .
-drop literal class opl:lit_license_model_explain .
-drop literal class opl:lit_shop_sample .
-drop literal class opl:lit_wikipedia_to_dbpedia .
-drop iri class opl:lit_wikipedia_to_dbpedia .
-drop literal class opl:lit_to_string .
-drop iri class opl:wwwsitefamily .
-drop iri class opl:wwwsiteformat .
-drop iri class opl:wwwsitecategory .
-drop iri class opl:wwwsiteproduct .
-;
-
-DB.DBA.RDF_AUDIT_METADATA (1, '*');
-
-
-SPARQL
-
-prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
-
-create iri class opl:Component "http://data.openlinksw.com/oplweb/component/%s#this"
-	(in component_name varchar not null) .
-
-create iri class opl:ComponentArchive "http://data.openlinksw.com/oplweb/component_archive/%s#this"
-	(in component_archive_name varchar not null) .
-
-create iri class opl:ComponentArchiveType using
-	function oplweb2.oplweb.COMPONENT_CATEGORY_URI (in _id integer not null)
-		returns varchar,
-	function oplweb2.oplweb.COMPONENT_CATEGORY_URI_INVERSE (in _iri varchar)
-		returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/component_archive_type/%s#this' ).
-
-
-create iri class opl:ComponentCategory using
-	function oplweb2.oplweb.COMPONENT_CATEGORY_URI (in _id integer not null)
-		returns varchar,
-	function oplweb2.oplweb.COMPONENT_CATEGORY_URI_INVERSE (in _iri varchar)
-		returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/component_category/%s#this' ).
-
-create iri class opl:ComponentMode using
-	function oplweb2.oplweb.COMPONENT_MODE_URI (in _id integer not null)
-		returns varchar,
-	function oplweb2.oplweb.COMPONENT_MODE_URI_INVERSE (in _iri varchar)
-		returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/component_mode/%s#this' ).
-
-create iri class opl:ComponentType using
-	function oplweb2.oplweb.COMPONENT_TYPE_URI (in _id integer not null)
-		returns varchar,
-	function oplweb2.oplweb.COMPONENT_TYPE_URI_INVERSE (in _iri varchar)
-		returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/component_type/%s#this' ).
-
-create iri class opl:DbmsFamily using
-	function oplweb2.oplweb.DBMS_FAMILY_URI (in _family_id integer not null)
-		returns varchar,
-	function oplweb2.oplweb.DBMS_FAMILY_URI_INVERSE (in _iri varchar)
-		returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/dbms_family/%s#this' ).
-
-create iri class opl:DbmsEngine "http://data.openlinksw.com/oplweb/dbms_engine/%s#this"
-	(in dbms_name varchar not null) .
-
-create iri class opl:DownloadLocation using
-	function oplweb2.oplweb.DOWNLOAD_LOCATION_URI (in uri varchar not null)
-		returns varchar,
-	function oplweb2.oplweb.DOWNLOAD_LOCATION_URI_INVERSE (in dl_iri varchar)
-		returns varchar
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/download_location/%s#this' ).
-
-create iri class opl:DownloadProtocol "http://data.openlinksw.com/oplweb/download_protocol/%s#this"
-	(in protocol_name varchar not null) .
-
-create iri class opl:DownloadPartner "http://data.openlinksw.com/oplweb/download_partner/%s/%s#this"
-	(
-	  in host_name varchar not null,
-	  in domain_name varchar not null
-	) .
-
-create iri class opl:FeatureBenefit using
-  function oplweb2.oplweb.FEATURE_BENEFIT_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.FEATURE_BENEFIT_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/feature_benefit/%s#this' ).
-
-create iri class opl:Opsys "http://data.openlinksw.com/oplweb/opsys/%s#this"
-	(in opsys_name varchar not null) .
-
-create iri class opl:OpsysFamily 	using
-  function oplweb2.oplweb.OPSYS_FAMILY_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.OPSYS_FAMILY_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/opsys_family/%s#this' ).
-
-create iri class opl:OpsysType 			using
-  function oplweb2.oplweb.OPSYS_TYPE_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.OPSYS_TYPE_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/opsys_type/%s#this' ).
-
-create iri class opl:Processor "http://data.openlinksw.com/oplweb/processor/%s/%d#this"
-	(in processor_name varchar not null, in processor_mode_id integer not null) .
-
-create iri class opl:ProcessorFamily 	using
-  function oplweb2.oplweb.PROCESSOR_FAMILY_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.PROCESSOR_FAMILY_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/processor_family/%s#this' ).
-
-create iri class opl:ProcessorMode 			using
-  function oplweb2.oplweb.PROCESSOR_MODE_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.PROCESSOR_MODE_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/processor_mode/%s#this' ).
-
-create iri class opl:Product "http://data.openlinksw.com/oplweb/product/%s#this"
-	(in product_id varchar not null) .
-
-create iri class opl:ProductCategory "http://data.openlinksw.com/oplweb/product_category/%s#this"
-	(in product_cat_code varchar not null) .
-
-create iri class opl:ProductCategoryFeature 	using
-  function oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI (in _id integer not null) returns varchar,
-		function oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_category_feature/%s#this' ).
-
-create iri class opl:ProductPortfolio "http://data.openlinksw.com/oplweb/portfolio/%s#this"
-	(in x varchar not null) .
-
-create iri class opl:ProductFamily "http://data.openlinksw.com/oplweb/product_family/%s#this"
-	(in product_family_code varchar not null) .
-
-create iri class opl:ProductFamilyFeature 	using
-  function oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_family_feature/%s#this' ).
-
-create iri class opl:ProductFeatureCategory 			using
-  function oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_feature_category/%s#this' ).
-
-create iri class opl:ProductFeature 					using
-  function oplweb2.oplweb.PRODUCT_FEATURE_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.PRODUCT_FEATURE_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_feature/%s#this' ).
-
-create iri class opl:ProductFormat "http://data.openlinksw.com/oplweb/product_format/%s#this"
-	(in product_format_code varchar not null) .
-
-create iri class opl:ProductFormatCategory "http://data.openlinksw.com/oplweb/product_format_category/%s/%s#this"
-	(in product_format_code varchar not null, in product_cat_code varchar not null) .
-
-create iri class opl:ProductFormatFeature 	using
-  function oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_format_feature/%s#this' ).
-
-create iri class opl:ProductReleaseFeature 			using
-  function oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_release_feature/%s#this' ).
-
-create iri class opl:ProductBenefit 					using
-  function oplweb2.oplweb.PRODUCT_BENEFIT_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.PRODUCT_BENEFIT_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_benefit/%s#this' ).
-
-create iri class opl:ProductBenefitCategory 							using
-  function oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_benefit_category/%s#this' ).
-
-create iri class opl:ProductRelease "http://data.openlinksw.com/oplweb/product_release/%s/%s/%s/%s#this"
-	(
-	 in product_id varchar not null,
-	 in product_release_id varchar not null,
-	 in opsys_name varchar not null,
-	 in dbms_name varchar not null
-	) .
-
-create iri class opl:Vendor 	using
-  function oplweb2.oplweb.VENDOR_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.VENDOR_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/vendor/%s#this' ).
-
-create iri class opl:VendorCategory 			using
-  function oplweb2.oplweb.VENDOR_CATEGORY_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.VENDOR_CATEGORY_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/vendor_category/%s#this' ).
-
-create iri class opl:VendorCategoryFamily 					using
-  function oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/vendor_category_family/%s#this' ).
-
-create iri class opl:PriceType "http://data.openlinksw.com/oplweb/price_type/%d#this"
-    (in product_price_type_id integer not null) .
-
-create iri class opl:LicenseType using
-  function oplweb2.oplweb.LICENSE_MODEL_TYPE_URI (in _id integer not null) returns varchar,
-  function oplweb2.oplweb.LICENSE_MODEL_TYPE_URI_INVERSE (in _iri varchar) returns integer
-	option (bijection, returns 'http://data.openlinksw.com/oplweb/license_type/%s#this' ).
-
-create iri class opl:PriceUnitType "http://data.openlinksw.com/oplweb/price_unit_type/%s_%s_%d_%d_%d_%s#this"
-    (
-    in product_release_id varchar not null,
-    in product_id varchar not null,
-    in opsys_family_id integer not null,
-    in dbms_family_id integer not null,
-    in product_price_type_id integer not null,
-	in product_price_unit_type_id varchar not null) .
-
-create iri class opl:PriceUnitIncrementalDiscount "http://data.openlinksw.com/oplweb/price_unit_discount/%s_%s_%d_%d_%d_%s#this"
-    (
-    in product_release_id varchar not null,
-    in product_id varchar not null,
-    in opsys_family_id integer not null,
-    in dbms_family_id integer not null,
-    in product_price_type_id integer not null,
-	in product_price_unit_type_id varchar not null) .
-
-create iri class opl:ProductPrice "http://data.openlinksw.com/oplweb/product_price/%d#this"
-    (in product_price_id integer not null) .
-
-
-create iri class opl:LicenseModel "http://data.openlinksw.com/oplweb/license_model/%s_%s_%d_%d_%d#this"
-    (
-      in product_release_id varchar not null,
-      in product_id varchar not null,
-      in opsys_family_id integer not null,
-      in dbms_family_id integer not null,
-	  in product_price_type_id integer not null
-    ) .
-
-create iri class opl:Discount "http://data.openlinksw.com/oplweb/discount/%s/%d/%s/%d/%d/%d#this"
-    (
-      in product_release_id varchar not null,
-      in opsys_type_id integer not null,
-      in product_id varchar not null,
-      in opsys_family_id integer not null,
-      in dbms_family_id integer not null,
-      in product_price_type_id integer not null
-    ) .
-
-create iri class opl:wwwsitefamily "http://%s.openlinksw.com/"
-    (
-      in product_family_code varchar not null
-    ) .
-
-create iri class opl:wwwsitecategory "http://%s.openlinksw.com/%s/"
-    (
-      in product_family_code varchar not null,
-      in product_category_code varchar not null
-    ) .
-
-create iri class opl:wwwsiteformat "http://%s.openlinksw.com/%s/%s/"
-    (
-      in product_family_code varchar not null,
-      in product_category_code varchar not null,
-      in product_format_code varchar not null
-    ) .
-
-create iri class opl:Uri "%s"
-    ( in uri varchar not null
-		) .
-
-create literal class opl:lit_product_release_label using
-	function oplweb2.oplweb.LIT_PRODUCT_RELEASE_LABEL(
-		in _product_id varchar, in _id integer, in _opsys_name varchar, in _dbms_name varchar
-		)
-	returns varchar .
-
-create literal class opl:lit_format_cat_label using
-	function oplweb2.oplweb.LIT_FORMAT_CAT_LABEL(
-		in _format integer, in _cat integer
-		)
-	returns varchar .
-
-create iri class opl:lit_openlink_logo using
-  function oplweb2.oplweb.LITRDF_openlink_logo(
-    in _code varchar
-  )
-	returns varchar .
-
-create iri class opl:lit_homepage using
-  function oplweb2.oplweb.LITRDF_homepage(
-    in _code varchar
-  )
-	returns varchar .
-
-create iri class opl:lit_opsys_icon using
-  function oplweb2.oplweb.LITRDF_opsys_icon(
-    in _id integer
-  )
-	returns varchar .
-
-create iri class opl:lit_to_shop using
-  function oplweb2.oplweb.LITRDF_to_shop(
-	in release_id varchar,
-	in product_id varchar,
-	in opsys varchar,
-	in dbms varchar
-  )
-  returns varchar .
-
-create literal class opl:lit_license_model_type using
-	function oplweb2.oplweb.LITRDF_license_model_type (
-		in _product_price_type_id integer
-	)
-	returns varchar .
-
-create literal class opl:lit_license_model_explain using
-	function oplweb2.oplweb.LITRDF_license_model_explain (
-		in _product_price_type_id integer
-	)
-	returns varchar .
-
-create literal class opl:lit_shop_sample using
-	function oplweb2.oplweb.LITRDF_shop_sample (
-	  in release_id varchar,
-	  in product_id varchar,
-	  in opsys varchar,
-  	  in dbms varchar
-	)
-	returns varchar .
-
-create iri class opl:lit_wikipedia_to_dbpedia using
-	function oplweb2.oplweb.LITRDF_wikipedia_to_dbpedia (
-	  in wikipedia_url varchar
-	)
-	returns varchar .
-
-create literal class opl:lit_to_string using
-	function oplweb2.oplweb.LITRDF_to_string (
-	  in _s varchar
-	)
-	returns varchar .
-
-create iri class opl:wwwsiteproduct using
-  function oplweb2.oplweb.wwwsiteproduct_URI (in _id varchar not null) returns varchar,
-  function oplweb2.oplweb.wwwsiteproduct_URI_INVERSE (in _iri varchar) returns varchar
-  .
-
-
-make opl:ProductCategory 	subclass of opl:ProductFamily .
-make opl:Product 			subclass of opl:ProductCategory .
-make opl:Product 			subclass of opl:ProductFormat .
-make opl:ProductRelease		subclass of opl:Product .
-make opl:Opsys		 		subclass of opl:OpsysFamily .
-make opl:DbmsEngine		 	subclass of opl:DbmsFamily .
-
-;
-
-
-
-DB.DBA.RDF_AUDIT_METADATA (1, '*');
-
-
-SPARQL
-prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
-prefix dc: <http://purl.org/dc/terms#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-prefix oplds: <http://www.openlinksw.com/dataspace/organization/openlink#>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-prefix umbel: <http://umbel.org/umbel/sc/>
-prefix gr: <http://purl.org/goodrelations/v1#>
-
-alter quad storage virtrdf:DefaultQuadStorage
-FROM oplweb2.oplweb.component_archive as component_archive_tbl
-FROM oplweb2.oplweb.component_archive_type as component_archive_type_tbl
-FROM oplweb2.oplweb.component_category as component_category_tbl text literal component_category_long_description
-FROM oplweb2.oplweb.component_mode as component_mode_tbl
-FROM oplweb2.oplweb.component_type as component_type_tbl
-FROM oplweb2.oplweb.components_for_rdfs as components_tbl
-FROM oplweb2.oplweb.dbms_engine as dbms_engine_tbl
-FROM oplweb2.oplweb.dbms_family as dbms_family_tbl
-FROM oplweb2.oplweb.download_location as download_location_tbl
-FROM oplweb2.oplweb.download_protocol as download_protocol_tbl
-FROM oplweb2.oplweb.download_partner as download_partner_tbl
-FROM oplweb2.oplweb.opsys as opsys_tbl
-FROM oplweb2.oplweb.opsys_family as opsys_family_tbl
-FROM oplweb2.oplweb.opsys_type as opsys_type_tbl
-FROM oplweb2.oplweb.processor_family as processor_family_tbl
-FROM oplweb2.oplweb.processor_mode as processor_mode_tbl
-FROM oplweb2.oplweb.processors as processors_tbl
-FROM oplweb2.oplweb.product as product_tbl text literal long_description
-FROM oplweb2.oplweb.product_benefits as product_benefits_tbl text literal product_benefit_explanation
-FROM oplweb2.oplweb.product_benefits_category as product_benefits_category_tbl
-FROM oplweb2.oplweb.product_category as product_category_tbl
-FROM oplweb2.oplweb.product_category_features_with_code as product_category_features_tbl text literal long_description
-FROM oplweb2.oplweb.product_family as product_family_tbl
-FROM oplweb2.oplweb.product_family as product_family_tbl_2
-FROM oplweb2.oplweb.product_family_features_with_code as product_family_features_tbl text literal long_description
-FROM oplweb2.oplweb.product_features as product_features_tbl text literal long_description
-FROM oplweb2.oplweb.product_feature_category as product_feature_category_tbl text literal description
-FROM oplweb2.oplweb.product_format_features_with_code as product_format_features_tbl text literal long_description
-FROM oplweb2.oplweb.product_release_features as product_release_features_tbl text literal long_description
-FROM oplweb2.oplweb.product_release_with_family as product_release_tbl
-FROM oplweb2.oplweb.vendor_category as vendor_category_tbl
-FROM oplweb2.oplweb.vendor_category_family as vendor_category_family_tbl
-FROM oplweb2.oplweb.vendors as vendors_tbl
-FROM oplweb2.oplweb.product_formats_categories as product_formats_categories
-FROM oplweb2.oplweb.product_with_code as product_with_code
-FROM oplweb2.oplweb.product_category_with_code as product_category_with_code
-FROM oplweb2.oplweb.product_format as product_format_with_code
-FROM oplweb2.oplweb.product_price as pp
-FROM oplweb2.oplweb.product_price_type as pt
-FROM oplweb2.DBA.license_model_unit_type as put
-FROM oplweb2.DBA.license_model_unit_type as put2
-FROM oplweb2.DBA.license_model as lm
-FROM oplweb2.DBA.license_model as lm2
-FROM oplweb2.DBA.license_model_type as license_model_type_tbl
-FROM oplweb2.DBA.product_price_varchar as ppv
-FROM oplweb2.DBA.product_general_discount_vc as gd
-FROM oplweb2.oplweb.archive_coverage_osdb as ac1
-    {
-	create virtrdf:product_portfolio as
-		graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
-{
-  opl:ProductPortfolio(product_family_tbl.product_family_code)
-    a opl:ProductPortfolio
-    as virtrdf:OplProductPortfolio .
-
-  opl:ProductPortfolio(product_family_tbl.product_family_code) opl:hasProductFamilies
-    opl:ProductFamily(product_family_tbl.product_family_code)
-	as virtrdf:OplProductPortfolioProductFamily .
-
-	  opl:ProductFamily(product_family_tbl.product_family_code)
-	    a opl:ProductFamily
-	    as virtrdf:OplProductFamily ;
-	  rdfs:label product_family_tbl.product_family_description
-	    as virtrdf:rdfsOplProductFamilyDescription ;
-	  foaf:name 	product_family_tbl.product_family_description
-		    as virtrdf:nameOplProductFamilyDescription ;
-	  foaf:logo  opl:lit_openlink_logo(product_family_tbl.product_family_code)
-	        as virtrdf:logoOpenLinkSoftware ;
-	  foaf:homepage opl:lit_homepage(product_family_tbl.product_family_code)
-	        as virtrdf:homepageProductFamily ;
-	  foaf:homepage opl:wwwsitefamily(product_family_tbl.product_family_code)
-#	    where (
-#			^{product_family_tbl.}^.product_family_code = 'uda'
-#		)
-	        as virtrdf:homepageProductFamilyUda ;
-	  foaf:maker oplds:this
-	        as virtrdf:OplDataspaceOpenLinkUri ;
-  	  owl:sameAs product_family_tbl.dbpedia_uri
-        as virtrdf:OplFamilyOwlSameAsDBPediaUri ;
-	  opl:ProductFamilyCode product_family_tbl.product_family_code
-	    as virtrdf:OplProductFamilyCode ;
-	  opl:ProductFamilyDescription product_family_tbl.product_family_description
-	    as virtrdf:OplProductFamilyDescription ;
-	  dc:description opl:lit_to_string(product_family_tbl.long_description)
-	    as virtrdf:OplProductFamilyLongDescription 		;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy foaf: ;
-      rdfs:isDefinedBy dc: ;
-      rdfs:isDefinedBy owl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-	  opl:ProductCategory(product_category_with_code.product_cat_code)
-	    a opl:ProductCategory
-	    as virtrdf:OplProductCategory ;
-	    a opl:ProductFamily
-	    as virtrdf:OplProductCategorySubClassOfProductFamily ;
-	  rdfs:label product_category_with_code.product_category_description
-	    as virtrdf:rdfsOplProductCategoryDescription ;
-	  foaf:homepage opl:wwwsitecategory(product_category_with_code.product_family_code, product_category_with_code.product_cat_code)
-#	    where (
-#			^{product_category_with_code.}^.product_family_code = 'uda'
-#		)
-	        as virtrdf:homepageProductFamilyCategoryUda ;
-	  opl:ProductCategoryCode product_category_with_code.product_cat_code
-	    as virtrdf:OplProductCategoryCode ;
-  	  owl:sameAs product_category_with_code.dbpedia_uri
-        as virtrdf:OplCategoryOwlSameAsDBPediaUri ;
-	  opl:hasFamily opl:ProductFamily(product_category_with_code.product_family_code)
-	    as virtrdf:OplProductCategoryIsOfFamily ;
-	  opl:ProductCategoryDescription product_category_with_code.product_category_description
-	    as virtrdf:OplProductCategoryDescription ;
-	  dc:description opl:lit_to_string(product_category_with_code.long_description)
-	    as virtrdf:OplProductCategoryLongDescription ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs: ;
-      rdfs:isDefinedBy foaf: ;
-      rdfs:isDefinedBy dc: ;
-      rdfs:isDefinedBy owl:
-		.
-
-	  opl:ProductFormat(product_format_with_code.product_format_code)
-	    a opl:ProductFormat
-	    as virtrdf:OplProductFormat ;
-	  opl:ProductFormatCode product_format_with_code.product_format_code
-	    as virtrdf:OplProductFormatCode ;
-	  rdfs:label product_format_with_code.product_format_description
-	    as virtrdf:rdfsOplProductFormatDescription ;
-	  dc:description product_format_with_code.product_format_description
-	    as virtrdf:OplProductFormatDescription ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs: ;
-      rdfs:isDefinedBy dc:
-		.
-
-	  opl:ProductFormatCategory(product_formats_categories.product_format_code, product_formats_categories.product_cat_code)
-	    a opl:ProductFormatCategory
-	    as virtrdf:OplProductFormatCategory ;
-	    a opl:ProductFormat
-	    as virtrdf:OplProductFormatCategoryProductFormat ;
-	    a opl:ProductCategory
-	    as virtrdf:OplProductFormatCategoryProductCategory ;
-	  foaf:homepage opl:wwwsiteformat(product_category_with_code.product_family_code, product_formats_categories.product_cat_code, product_formats_categories.product_format_code)
-	    where (
-			^{product_category_with_code.}^.product_cat_code = ^{product_formats_categories.}^.product_cat_code
-#			and
-#			^{product_category_with_code.}^.product_family_code = 'uda'
-		)
-	        as virtrdf:homepageProductFamilyCategoryFormatUda ;
-	  opl:ProductFormatCode product_formats_categories.product_format_code
-	    as virtrdf:OplProductFormatCategoryFormatCode ;
-	  opl:ProductCategoryCode product_formats_categories.product_cat_code
-	    as virtrdf:OplProductFormatCategoryCategoryCode ;
-      opl:isProductCategory opl:ProductCategory(product_formats_categories.product_cat_code)
-        as virtrdf:OplProductFormatCategoryisCategory ;
-      opl:isProductFormat opl:ProductFormat(product_formats_categories.product_format_code)
-        as virtrdf:OplProductFormatCategoryisFormat ;
-	  rdfs:label opl:lit_format_cat_label(product_formats_categories.product_format_id, product_formats_categories.product_cat_id)
-	    as virtrdf:rdfsOplProductFormatCategoryDescription ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy foaf: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-
-	  opl:ProductCategory(product_category_with_code.product_cat_code) opl:hasProduct
-	    opl:Product(product_with_code.product_id)
-	      where (^{product_with_code.}^.product_cat_id = ^{product_category_with_code.}^.product_cat_id)
-	    as virtrdf:OplProductCategoryIsCategoryOfProduct .
-
-	  opl:ProductFormat(product_format_with_code.product_format_code) opl:hasProduct
-	    opl:Product(product_with_code.product_id)
-	      where (^{product_with_code.}^.product_format_id = ^{product_format_with_code.}^.product_format_id)
-	    as virtrdf:OplProductFormatIsFormatOfProduct .
-
-	  opl:ProductFamily(product_family_tbl.product_family_code) opl:hasCategory
-	    opl:ProductCategory(product_category_with_code.product_cat_code)
-	      where (^{product_family_tbl.}^.product_family_id = ^{product_category_with_code.}^.product_family_id)
-	    as virtrdf:OplProductFamilyIsFamilyOfProductCategory .
-
-	  opl:ProductFamily(product_family_tbl.product_family_code) opl:hasFormat
-	    opl:ProductFormat(product_formats_categories.product_format_code)
-	      where (
-		    ^{product_family_tbl.}^.product_family_id = ^{product_formats_categories.}^.product_family_id
-		  )
-	    as virtrdf:OplProductFamilyIsFamilyOfProductFormats .
-
-	  opl:ProductFamily(product_family_tbl.product_family_code) opl:otherProductFamilies
-	    opl:ProductFamily(product_family_tbl_2.product_family_code)
-	      where (
-		    ^{product_family_tbl.}^.product_family_id <> ^{product_family_tbl_2.}^.product_family_id
-		  )
-	    as virtrdf:OplProductFamilyHasOtherProductFamilies .
-
-	  opl:ProductFormat(product_format_with_code.product_format_code) opl:hasCategory
-	    opl:ProductFormatCategory(product_formats_categories.product_format_code, product_formats_categories.product_cat_code)
-	      where (^{product_formats_categories.}^.product_format_id = ^{product_format_with_code.}^.product_format_id)
-	    as virtrdf:OplProductFormatIsFormatOfProductFormatCategories .
-
-	  opl:ProductFormatCategory(product_formats_categories.product_format_code, product_formats_categories.product_cat_code)
-	    opl:hasProduct
-	    opl:Product(product_with_code.product_id)
-	      where (
-		    ^{product_with_code.}^.product_cat_id = ^{product_formats_categories.}^.product_cat_id
-		    and
-		    ^{product_with_code.}^.product_format_id = ^{product_formats_categories.}^.product_format_id
-		  )
-	    as virtrdf:OplProductFormatCategoryIsFormatCategoryOfProduct .
-
-
-
-	  opl:VendorCategoryFamily(vendor_category_family_tbl.vendor_category_family_id)
-	    a opl:VendorCategoryFamily
-	    as virtrdf:OplVendorCategoryFamily ;
-	  opl:VendorCategoryFamilyDescription vendor_category_family_tbl.vendor_category_family_desc
-	    as virtrdf:OplVendorCategoryFamilyDesc .
-
-
-	  opl:VendorCategory(vendor_category_tbl.vendor_category_id)
-	    a opl:VendorCategory
-	    as virtrdf:OplVendorCategory ;
-	    a opl:VendorCategoryFamily
-	    as virtrdf:OplVendorCategorySubClassOfVendorCategoryFamily ;
-	  rdfs:label vendor_category_tbl.vendor_category_description
-	    as virtrdf:rdfsOplVendorCategoryDescription ;
-	  opl:VendorCategoryDescription vendor_category_tbl.vendor_category_description
-	    as virtrdf:OplVendorCategoryDescription ;
-	  opl:isVendorCategoryOf opl:VendorCategoryFamily(vendor_category_tbl.vendor_category_family_id)
-	    as virtrdf:OplVendorCategoryIsOfCategoryFamily ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-	  opl:Vendor(vendors_tbl.vendor_id)
-	    a opl:Vendor
-	    as virtrdf:OplVendor ;
-	    a opl:VendorCategory
-	    as virtrdf:OplVendorSubClassOfVendorCategory ;
-	  rdfs:label vendors_tbl.vendor_name
-	    as virtrdf:rdfsOplVendorsName ;
-	  opl:VendorName vendors_tbl.vendor_name
-	    as virtrdf:OplVendorsName ;
-	  opl:WikipediaPage opl:Uri(vendors_tbl.wikipedia_url)
-	    as virtrdf:OplVendorsWikipediaUrl ;
-	  owl:sameAs opl:lit_wikipedia_to_dbpedia(vendors_tbl.wikipedia_url)
-	    as virtrdf:OplVendorsWikipediaUrlOwlSameAs ;
-	  foaf:homepage opl:Uri(vendors_tbl.vendor_homepage)
-	    as virtrdf:OplFoafVendorHomepage ;
-	  opl:isOfVendorCategory opl:VendorCategory(vendors_tbl.vendor_category_id)
-	    as virtrdf:OplVendorIsOfVendorCategory ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs: ;
-      rdfs:isDefinedBy foaf: ;
-      rdfs:isDefinedBy owl:
-		.
-
-	  opl:VendorCategoryFamily(vendor_category_family_tbl.vendor_category_family_id)
-	    opl:hasVendorCategory
-	    opl:VendorCategory(vendor_category_tbl.vendor_category_id)
-	      where (
-		    ^{vendor_category_family_tbl.}^.vendor_category_family_id = ^{vendor_category_tbl.}^.vendor_category_family_id
-		  )
-	    as virtrdf:OplVendorCategoryFamilyHasVendorCategory .
-
-      opl:VendorCategory(vendor_category_tbl.vendor_category_id)
-	    opl:hasVendorCategory
-  	    opl:Vendor(vendors_tbl.vendor_id)
-	      where (
-		    ^{vendor_category_tbl.}^.vendor_category_id = ^{vendors_tbl.}^.vendor_category_id
-		  )
-	    as virtrdf:OplVendorCategoryHasVendors .
-
-  	opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
-	    a opl:OpsysFamily
-	    as virtrdf:OplOpsysFamily ;
-	  rdfs:label opsys_family_tbl.opsys_family_name
-  	  as virtrdf:rdfsOplOpsysFamilyName ;
-	  opl:OpsysFamilyName opsys_family_tbl.opsys_family_name
-  	  as virtrdf:OplOpsysFamilyName ;
-  	opl:OpsysFamilyLicenseCode opsys_family_tbl.opsys_license_code
-	    as virtrdf:OplOpsysFamilyLicenseCode ;
-	  opl:OpsysFamilyVendor opl:Vendor(opsys_family_tbl.vendor_id)
-  	  as virtrdf:OplOpsysFamilyVendor ;
-  	opl:OpsysFamilyRating opsys_family_tbl.rating
-	    as virtrdf:OplOpsysFamilyRating ;
-	foaf:logo opl:lit_opsys_icon(opsys_family_tbl.opsys_family_id)
-	  as virtrdf:OplLogoOpsysFamily ;
-	foaf:homepage opl:Uri(opsys_family_tbl.wikipedia_url)
-	  as virtrdf:FoafHomepageOpsysFamilyWikipediaUrl ;
-	owl:sameAs opl:lit_wikipedia_to_dbpedia(opsys_family_tbl.wikipedia_url)
-	  as virtrdf:FoafHomepageOpsysFamilyPediaUrlOwlSameAs ;
-	opl:WikipediaPage opl:Uri(opsys_family_tbl.wikipedia_url)
-	  as virtrdf:OplOpsysFamilyWikipediaUrl ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs: ;
-      rdfs:isDefinedBy foaf: ;
-      rdfs:isDefinedBy owl:
-		.
-
-	  opl:OpsysFamily(opsys_family_tbl.opsys_family_id) opl:hasOpsys
-	    opl:Opsys(opsys_tbl.opsys_name)
-	    where (^{opsys_tbl.}^.opsys_family_id = ^{opsys_family_tbl.}^.opsys_family_id)
-	    as virtrdf:OplOpsysFamilyIsOpsysFamilyOfOpsys .
-
-
-	  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
-  	  a opl:DbmsFamily
-	    as virtrdf:OplDbmsFamily ;
-	  rdfs:label dbms_family_tbl.dbms_family_name
-  	  as virtrdf:rdfsOplDbmsFamilyName ;
-	  opl:DbmsFamilyName dbms_family_tbl.dbms_family_name
-  	  as virtrdf:OplDbmsFamilyName ;
-  	opl:DbmsFamilyVendor opl:Vendor(dbms_family_tbl.vendor_id)
-      as virtrdf:OplDbmsFamilyVendor ;
-	foaf:homepage opl:Uri(dbms_family_tbl.wikipedia_url)
- 	  as virtrdf:FoafHomepageDbmsFamilyWikipediaUrl ;
-	owl:sameAs opl:lit_wikipedia_to_dbpedia(dbms_family_tbl.wikipedia_url)
- 	  as virtrdf:OwnSameAsDbmsFamilyPediaUrl ;
-	opl:WikipediaPage opl:Uri(dbms_family_tbl.wikipedia_url)
-	  as virtrdf:OplDbmsFamilyWikipediaUrl ;
-	  opl:DbmsFamilyRating dbms_family_tbl.rating
-  	  as virtrdf:OplDbmsFamilyRating ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs: ;
-      rdfs:isDefinedBy foaf: ;
-      rdfs:isDefinedBy owl:
-		.
-
-	  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
-  	  a opl:DbmsEngine
-	    as virtrdf:OplDbmsEngine ;
-  	  a opl:DbmsFamily
-	    as virtrdf:DbmsEngineSubClassOfDbmsFamily ;
-	    a umbel:RelationalDatabaseServerProgram
-	    as virtrdf:DbmEngineSubClassOfUmbel ;
-	  opl:isOfDbmsFamily opl:DbmsFamily(dbms_engine_tbl.dbms_family_id)
-  	  as virtrdf:OplDbmsEngineisOfDbmsFamily ;
-	  rdfs:label dbms_engine_tbl.dbms_name
-  	  as virtrdf:rdfsOplLabelDbmsName ;
-  	opl:DbmsEngineVersion dbms_engine_tbl.dbms_version
-	    as virtrdf:OplDbmsEngineVersion ;
-	  opl:DbmsEngineUpwardCompatible dbms_engine_tbl.upward_compatible
-  	  as virtrdf:OplDbmsEngineUpwardCompatible ;
-  	opl:DbmsEngineDownwardCompatible dbms_engine_tbl.downward_compatible
-	    as virtrdf:OplDbmsEngineDownwardCompatible ;
-	  opl:DbmsEngineRating dbms_engine_tbl.rating
-  	  as virtrdf:OplDbmsEngineRating ;
-  	opl:DbmsEngineOldArchiveCode dbms_engine_tbl.old_archive_code
-	    as virtrdf:OplDbmsEngineOldArchiveCode ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-
-  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
-    opl:hasDatabaseVersions
-    opl:DbmsEngine(dbms_engine_tbl.dbms_name)
-    where (
-        ^{dbms_family_tbl.}^.dbms_family_id = ^{dbms_engine_tbl.}^.dbms_family_id
-    )
-    as virtrdf:OplDbmsFamilyToDbms .
-
-
-	  opl:OpsysType(opsys_type_tbl.opsys_type_id)
-   	  a opl:OpsysType
-	    as virtrdf:OplOpsysType ;
-	  rdfs:label opsys_type_tbl.opsys_type_description
-  	  as virtrdf:rdfsOplOpsysTypeDescription ;
-	  opl:OpsysTypeDescription opsys_type_tbl.opsys_type_description
-  	  as virtrdf:OplOpsysTypeDescription ;
-  	opl:OpsysTypeShortDescription opsys_type_tbl.short_description
-	    as virtrdf:OplOpsysTypeShortDescription ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-
-	  opl:OpsysType(opsys_type_tbl.opsys_type_id) opl:hasOpsys
-	    opl:Opsys(opsys_tbl.opsys_name)
-	    where (^{opsys_tbl.}^.opsys_type_id = ^{opsys_type_tbl.}^.opsys_type_id)
-	    as virtrdf:OplOpsysTypeIsOpsysTypeOfOpsys .
-
-
-	  opl:ProcessorMode(processor_mode_tbl.processor_mode_id)
-  	  a opl:ProcessorMode
-	    as virtrdf:OplProcessorMode ;
-	  opl:ProcessorModeName processor_mode_tbl.processor_mode_name
-  	  as virtrdf:OplProcessorModeName .
-
-  	opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
-	    a opl:Processor
-	    as virtrdf:OplProcessor ;
-	  opl:ProcessorName processors_tbl.processor_name
-  	  as virtrdf:OplProcessorName ;
-  	opl:ProcessorVersion processors_tbl.processor_version
-	    as virtrdf:OplProcessorVersion ;
-	  rdfs:label processors_tbl.processor_description
-  	  as virtrdf:rdfsOplProcessorDescription ;
-	  opl:ProcessorDescription processors_tbl.processor_description
-  	  as virtrdf:OplProcessorDescription ;
-  	opl:ProcessorMode opl:ProcessorMode(processors_tbl.processor_mode_id)
-	    as virtrdf:OplProcessorProcessorMode ;
-	  opl:isOfProcessorFamily opl:ProcessorFamily(processors_tbl.processor_family_id)
-  	  as virtrdf:OplProcessorIsOfProcessorFamily ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-	opl:ProcessorFamily(processor_family_tbl.processor_family_id)
-  	  a opl:ProcessorFamily
-	    as virtrdf:OplProcessorFamily ;
-    opl:ProcessorFamilyName processor_family_tbl.processor_family_name
-  	  as virtrdf:OplProcessorFamilyName ;
-    opl:ProcessorFamilyVendor opl:Vendor(processor_family_tbl.vendor_id)
-	  as virtrdf:OplProcessorFamilyVendor ;
-	foaf:homepage opl:Uri(processor_family_tbl.wikipedia_url)
-	  as virtrdf:FoafHomepageProcessorFamilyWikipediaUrl ;
-	owl:sameAs opl:lit_wikipedia_to_dbpedia(processor_family_tbl.wikipedia_url)
-	  as virtrdf:OwlSameAsProcessorFamilyPediaUrl ;
-    opl:WikipediaPage opl:Uri(processor_family_tbl.wikipedia_url)
-	  as virtrdf:OplProcessorFamilyWikipediaUrl ;
-	rdfs:label processor_family_tbl.processor_family_description
-  	  as virtrdf:rdfsOplProcessorFamilyDescription ;
-	opl:ProcessorFamilyDescription processor_family_tbl.processor_family_description
-  	  as virtrdf:OplProcessorFamilyDescription ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy foaf: ;
-      rdfs:isDefinedBy owl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-	  opl:Opsys(opsys_tbl.opsys_name)
-  	  a opl:Opsys
-	    as virtrdf:OplOpsys ;
-  	  a opl:OpsysFamily
-	    as virtrdf:OpsysSubClassOfOplOpsysFamily ;
-  	  a umbel:OperatingSystem
-	    as virtrdf:OpsysSubClassOfUmbelOpsys ;
-	  opl:OpsysVersion opsys_tbl.opsys_version
-  	  as virtrdf:OplOpsysVersion ;
-  	opl:OpsysUpwardCompatible opsys_tbl.upward_compatible
-	    as virtrdf:OplOpsysUpwardCompatible ;
-	  opl:OpsysDownwardCompatible opsys_tbl.downward_compatible
-  	  as virtrdf:OplOpsysDownwardCompatible ;
-  	opl:OpsysSupported opsys_tbl.supported
-	    as virtrdf:OplOpsysSupported ;
-	  opl:OpsysLicenseCode opsys_tbl.opsys_license_code
-  	  as virtrdf:OplOpsysLicenseCode ;
-  	rdfs:label opsys_tbl.commercial_name
-	    as virtrdf:rdfsOplOpsysCommercialName ;
-  	opl:OpsysCommercialName opsys_tbl.commercial_name
-	    as virtrdf:OplOpsysCommercialName ;
-	  opl:OpsysEmulationMode opl:ProcessorMode(opsys_tbl.emulation_mode_id)
-  	  as virtrdf:OplOpsysEmulationMode ;
-  	opl:OpsysProcessor opl:Processor(opsys_tbl.processor_name, opsys_tbl.processor_mode_id)
-	    as virtrdf:OplOpsysProcessor ;
-	  opl:isOfOpsysFamily opl:OpsysFamily(opsys_tbl.opsys_family_id)
-  	  as virtrdf:OplOpsysIsOfOpsysFamily ;
-  	opl:isOfOpsysType opl:OpsysType(opsys_tbl.opsys_type_id)
-	    as virtrdf:OplOpsysIsOfOpsysType ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-
-	  opl:Product(product_with_code.product_id)
-	    a opl:Product
-	    as virtrdf:OplProduct ;
-	    a opl:ProductFormat
-	    as virtrdf:ProductSubClassOfProductFormat ;
-	    a opl:ProductCategory
-	    as virtrdf:ProductSubClassOfProductCategory ;
-	    a opl:ProductFormatCategory
-	    as virtrdf:OplProductProductFormatCategory ;
-	  rdfs:label product_with_code.poduct_description
-	    as virtrdf:rdfsOplProductDescription ;
-	  foaf:homepage opl:wwwsiteproduct(product_with_code.product_id)
-        as virtrdf:homepageProductFamilyCategoryFormatProductUda ;
-	  opl:ProductDescription product_with_code.poduct_description
-	    as virtrdf:OplProductDescription ;
-	  dc:description opl:lit_to_string(product_with_code.long_description)
-	    as virtrdf:OplProductLongDescription ;
-	  opl:isOfCategory opl:ProductCategory(product_with_code.product_cat_code)
-	    as virtrdf:OplProductIsOfCategory ;
-	  opl:isOfFormat opl:ProductFormat(product_with_code.product_format_code)
-	    as virtrdf:OplProductIsOfFormat ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy foaf: ;
-      rdfs:isDefinedBy dc: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-
-	  opl:Product(product_with_code.product_id) opl:hasProductRelease
-	    opl:ProductRelease(
-	      product_release_tbl.product_id,
-	      product_release_tbl.product_release_id,
-	      product_release_tbl.opsys_name,
-	      product_release_tbl.dbms_name
-	      )
-	      where (^{product_with_code.}^.product_id = ^{product_release_tbl.}^.product_id)
-	    as virtrdf:OplProductIsProductOfProductRelease .
-
-
-
-	  opl:ProductRelease(
-	      product_release_tbl.product_id,
-	      product_release_tbl.product_release_id,
-	      product_release_tbl.opsys_name,
-	      product_release_tbl.dbms_name
-	      )
-	    a opl:ProductRelease
-	    as virtrdf:OplProductRelease ;
-	    a opl:Product
-	    as virtrdf:OplProductReleaseSubClassProduct ;
-		a gr:ProductOrService
-		as virtrdf:OplProductReleaseAgrProductOrService ;
-	  rdfs:label opl:lit_product_release_label(
-	      product_release_tbl.product_id,
-	      product_release_tbl.product_release_id,
-	      product_release_tbl.opsys_name,
-	      product_release_tbl.dbms_name
-	  )
-	    as virtrdf:rdfsOplProductReleaseProductReleaseId ;
-	  opl:ProductReleaseProductReleaseId product_release_tbl.product_release_id
-	    as virtrdf:OplProductReleaseProductReleaseId ;
-	  opl:isOfProduct opl:Product(product_release_tbl.product_id)
-	    as virtrdf:OplProductReleaseIsOfProduct ;
-	  opl:isForOpsys opl:Opsys(product_release_tbl.opsys_name)
-	    as virtrdf:OplProductReleaseIsForOpsys ;
-	  opl:isForDbmsEngine opl:DbmsEngine(product_release_tbl.dbms_name)
-	    as virtrdf:OplProductReleaseIsForDbmsEngine ;
-  	  opl:UpwardCompatible product_release_tbl.upward_compatible
-	    as virtrdf:OplProductReleaseUpwardCompatible ;
-	  opl:DownwardCompatible product_release_tbl.downward_compatible
-  	    as virtrdf:OplProductReleaseDownwardCompatible ;
-      opl:PurchaseInShop opl:lit_to_shop (
-	      product_release_tbl.product_release_id,
-	      product_release_tbl.product_id,
-	      product_release_tbl.opsys_name,
-	      product_release_tbl.dbms_name
-	 	)
-   		as virtrdf:OplProductReleaseToShop ;
-	  gr:hasBusinessFunction gr:Sell as virtrdf:grbusinessfunctionsell;
-  	  opl:Supported product_release_tbl.supported
-	    as virtrdf:OplProductReleaseSupported ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy gr:
-		.
-
-	  opl:ProductRelease(
-	      product_release_tbl.product_id,
-	      product_release_tbl.product_release_id,
-	      product_release_tbl.opsys_name,
-	      product_release_tbl.dbms_name
-	      ) opl:hasComponentArchive
-	  opl:ComponentArchive(component_archive_tbl.component_archive_name)
-			where (
-					^{product_release_tbl.}^.product_id = ^{component_archive_tbl.}^.product_id and
-					^{product_release_tbl.}^.product_release_id = ^{component_archive_tbl.}^.product_release_id and
-					^{product_release_tbl.}^.opsys_name = ^{component_archive_tbl.}^.opsys_name and
-					^{product_release_tbl.}^.dbms_name = ^{component_archive_tbl.}^.dbms_name
-			)
-	    as virtrdf:OplProductReleaseIsProductReleaseOfComponentArchive .
-
-
-	  opl:Component(components_tbl.component_name)
-	    a opl:Component
-	    as virtrdf:OplComponent ;
-	  opl:isOfComponentCategory opl:ComponentCategory(components_tbl.component_category_id)
-	    as virtrdf:OplComponentIsOfComponentCategory ;
-	  opl:isOfComponentType opl:ComponentType(components_tbl.component_type_id)
-	    as virtrdf:OplComponentIsOfComponentType ;
-	  opl:isOfComponentMode opl:ComponentMode(components_tbl.component_mode_id)
-	    as virtrdf:OplComponentIsOfComponentMode ;
-	  opl:isForOpsys opl:Opsys(components_tbl.opsys_name)
-	    as virtrdf:OplComponentIsForOpsys ;
-	  opl:isForDbmsEngine opl:DbmsEngine(components_tbl.dbms_name)
-	    as virtrdf:OplComponentIsForDbmsEngine ;
-	  opl:ComponentCvsid components_tbl.component_cvsid
-	    as virtrdf:OplComponentComponentCvsId ;
-	  opl:ComponentBuildDate components_tbl.component_build_date
-	    as virtrdf:OplComponentComponentBuildDate ;
-	  opl:Notes components_tbl.notes
-	    as virtrdf:OplComponentNotes ;
-	  opl:BuildComments components_tbl.build_comments
-	    as virtrdf:OplComponentBuildComments ;
-	  opl:Filesize components_tbl.str_filesize
-	    as virtrdf:OplComponentFilesize ;
-      rdfs:isDefinedBy opl:
-		.
-
-    opl:DbmsEngine (dbms_engine_tbl.dbms_name) opl:hasComponents
-      opl:Component(components_tbl.component_name)
-      where (^{components_tbl.}^.dbms_name = ^{dbms_engine_tbl.}^.dbms_name)
-      as virtrdf:OplDbmsEngineForComponents .
-
-    opl:Opsys (opsys_tbl.opsys_name) opl:hasComponents
-      opl:Component(components_tbl.component_name)
-      where (^{components_tbl.}^.opsys_name = ^{opsys_tbl.}^.opsys_name)
-      as virtrdf:OplOpsysForComponents .
-
-
-	  opl:ComponentMode(component_mode_tbl.component_mode_id)
-	    a opl:ComponentMode
-	    as virtrdf:OplComponentMode ;
-	  rdfs:label component_mode_tbl.component_mode_description
-	    as virtrdf:rdfsOplComponentModeDescription ;
-	  opl:ComponentModeDescription component_mode_tbl.component_mode_description
-	    as virtrdf:OplComponentModeDescription ;
-	  opl:ComponentModeShortDescription component_mode_tbl.short_description
-	    as virtrdf:OplComponentModeShortDescription ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-	  opl:ComponentType(component_type_tbl.component_type_id)
-	    a opl:ComponentType
-	    as virtrdf:OplComponentType ;
-	  rdfs:label component_type_tbl.component_type_description
-	    as virtrdf:rdfsOplComponentTypeDescription ;
-	  opl:ComponentTypeDescription component_type_tbl.component_type_description
-	    as virtrdf:OplComponentTypeDescription ;
-	  opl:ComponentTypeShortDescription component_type_tbl.short_description
-	    as virtrdf:OplComponentTypeShortDescription ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-	  opl:ComponentCategory(component_category_tbl.component_category_id)
-	    a opl:ComponentCategory
-	    as virtrdf:OplComponentCategory ;
-	  rdfs:label component_category_tbl.component_category_description
-	    as virtrdf:rdfsOplComponentCategoryDescription ;
-	  opl:ComponentCategoryDescription component_category_tbl.component_category_description
-	    as virtrdf:OplComponentCategoryDescription ;
-	  opl:ComponentCategoryShortDescription component_category_tbl.short_description
-	    as virtrdf:OplComponentCategoryShortDescription ;
-	  dc:description opl:lit_to_string(component_category_tbl.component_category_long_description)
-	    as virtrdf:OplComponentCategoryLongDescription ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-	  opl:ComponentArchive(component_archive_tbl.component_archive_name)
-	    a opl:ComponentArchive
-	    as virtrdf:OplComponentArchive ;
-	    a opl:Component
-	    as virtrdf:ComponentArchiveSubClassOfComponent ;
-	  opl:ComponentArchiveName component_archive_tbl.component_archive_name
-	    as virtrdf:OplComponentArchiveComponentArchiveName ;
-	  rdfs:label component_archive_tbl.component_archive_name
-	    as virtrdf:rdfsComponentArchiveComponentArchiveName ;
-  	opl:ComponentArchiveType opl:ComponentArchiveType(component_archive_tbl.component_archive_type_id)
-	  	as virtrdf:ComponentArchiveComponentArchiveType ;
-	  opl:isOfComponent opl:Component(component_archive_tbl.component_name)
-	    as virtrdf:OplComponentArchiveIsOfComponent ;
-	  opl:isOfProductRelease opl:ProductRelease(
-	      component_archive_tbl.product_id,
-	      component_archive_tbl.product_release_id,
-	      component_archive_tbl.opsys_name,
-	      component_archive_tbl.dbms_name
-	      )
-	    as virtrdf:OplComponentArchiveIsOfProductRelease ;
-  	opl:AssemblyDate component_archive_tbl.assembly_date
-	  	as virtrdf:OplComponentArchiveAssemblyDate ;
-	  opl:FileUri component_archive_tbl.file_uri
-  		as virtrdf:OplComponentArchiveFileUri ;
-  	opl:LicenseCode component_archive_tbl.license_code
-		  as virtrdf:OplComponentArchiveLicenseCode ;
-	  opl:ResFullPath component_archive_tbl.res_full_path
-  		as virtrdf:OplComponentArchiveResFullPath ;
-  	opl:ResName component_archive_tbl.res_name
-		  as virtrdf:OplComponentArchiveResName ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-
-	opl:ComponentArchiveType(component_archive_type_tbl.component_archive_type_id)
-	  a opl:ComponentArchiveType
-		as virtrdf:OplComponentArchiveType ;
-	opl:ComponentArchiveShortName component_archive_type_tbl.component_archive_short_name
-		as virtrdf:OplComponentArchiveTypeComponentArchiveShortName ;
-	rdfs:label component_archive_type_tbl.component_archive_type_name
-		as virtrdf:rdfsOplComponentArchiveTypeComponentArchiveTypeName ;
-	opl:ComponentArchiveTypeName component_archive_type_tbl.component_archive_type_name
-		as virtrdf:OplComponentArchiveTypeComponentArchiveTypeName ;
-	opl:Extension component_archive_type_tbl.extension
-		as virtrdf:OplComponentArchiveTypeExtension ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-
-	opl:DownloadLocation(download_location_tbl.uri)
-	  a opl:DownloadLocation
-		as virtrdf:OplDownloadLocation ;
-	opl:isOfComponentArchive opl:ComponentArchive(download_location_tbl.component_archive_name)
-		as virtrdf:OplDownloadLocationIsOfComponentArchive ;
-	opl:hasDownloadProtocol opl:DownloadProtocol(download_location_tbl.protocol_name)
-		as virtrdf:DownloadLocationHasProtocolName ;
-	rdfs:label download_location_tbl.uri_old
-		as virtrdf:rdfsOplDownloadLocationLabel ;
-	opl:isOfProductRelease opl:ProductRelease(
-		download_location_tbl.product_id,
-		download_location_tbl.product_release_id,
-		download_location_tbl.opsys_name,
-		download_location_tbl.dbms_name
-		)
-		as virtrdf:OplDownloadLocationIsOfProductRelease ;
-	opl:Uri download_location_tbl.uri
-		as virtrdf:OplDownloadLocationUri ;
-	opl:UriOld download_location_tbl.uri_old
-		as virtrdf:OplDownloadLocationUriOld ;
-    opl:hasDownloadPartner opl:DownloadPartner(
-        download_location_tbl.host_name,
-        download_location_tbl.domain_name
-      )
-        as virtrdf:OplDownloadLocationHasDownloadPartner ;
-	opl:DomainName download_location_tbl.domain_name
-		as virtrdf:OplDownloadLocationDomainName ;
-	opl:HostName download_location_tbl.host_name
-		as virtrdf:OplDownloadLocationHostName ;
-	opl:ResName download_location_tbl.res_name
-		as virtrdf:OplDownloadLocationResName ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-	opl:DownloadProtocol(download_protocol_tbl.protocol_name)
-	  a opl:DownloadProtocol
-		as virtrdf:OplDownloadProtocolProtocolName ;
-	opl:ProtocolDescription download_protocol_tbl.protocol_description
-		as virtrdf:OplDownloadProtocolProtocolDescription .
-
-	opl:DownloadPartner(
-	  download_partner_tbl.host_name,
-	  download_partner_tbl.domain_name
-	  )
-	  a opl:DownloadPartner
-	  as virtrdf:OplDownloadPartner;
-	rdfs:label download_partner_tbl.partner_name
-	  as virtrdf:rdfsOplDownloadPartnerPartnerNamelabel ;
-	opl:DownloadPartner download_partner_tbl.partner_name
-	  as virtrdf:OplDownloadPartnerPartnerName ;
-	opl:PortNumber download_partner_tbl.port_number
-	  as virtrdf:OplDownloadPartnerPortNumber ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-    opl:ComponentArchive(component_archive_tbl.component_archive_name)
-      opl:hasDownloadLocation
-      opl:DownloadLocation(download_location_tbl.uri)
-		where (
-				^{component_archive_tbl.}^.component_archive_name = ^{download_location_tbl.}^.component_archive_name
-		)
-      as virtrdf:OplComponentArchiveIsComponentArchiveOfDownloadLocation .
-
-    opl:DownloadLocation(download_location_tbl.uri)
-      opl:isDownloadLocationOf
-      opl:ComponentArchive(component_archive_tbl.component_archive_name)
-		where (
-				 ^{download_location_tbl.}^.component_archive_name = ^{component_archive_tbl.}^.component_archive_name
-		)
-      as virtrdf:OplDownloadLocationIsDownloadLocationOfComponentArchive .
-
-
-#
-# Extra Peripheral family/cat/format/etc... to/from... dbfamily/opsysfamily/....
-# ==================================================================================
-
-
-# ---------------------> product_family
-
-#  opl:ProductFamily(product_family_tbl.product_family_code)
-#    opl:OperatingSystems
-#    opl:Opsys(ac1.opsys_name)
-#    where (
-#        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
-#    )
-#    as virtrdf:OplProductFamilyToOpsys .
-
-  opl:ProductFamily(product_family_tbl.product_family_code)
-    opl:OperatingSystemsFamilies
-    opl:OpsysFamily(ac1.opsys_family_id)
-    where (
-        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
-    )
-    as virtrdf:OplProductFamilyToOpsysFamily .
-
-#  opl:ProductFamily(product_family_tbl.product_family_code)
-#    opl:Databases
-#    opl:DbmsEngine(ac1.dbms_name)
-#    where (
-#        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
-#    )
-#    as virtrdf:OplProductFamilyToDbms .
-
-  opl:ProductFamily(product_family_tbl.product_family_code)
-    opl:DatabaseFamilies
-    opl:DbmsFamily(ac1.dbms_family_id)
-    where (
-        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
-    )
-    as virtrdf:OplProductFamilyToDbmsFamily .
-
-#  opl:ProductFamily(product_family_tbl.product_family_code)
-#    opl:Processors
-#  	opl:Processor(ac1.processor_name, ac1.processor_mode_id)
-#    where (
-#        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
-#    )
-#    as virtrdf:OplProductFamilyToProcessor .
-
-  opl:ProductFamily(product_family_tbl.product_family_code)
-    opl:ProcessorFamilies
-	opl:ProcessorFamily(ac1.processor_family_id)
-    where (
-        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
-    )
-    as virtrdf:OplProductFamilyToProcessorFamily .
-
-
-
-# ---------------------> product_format
-
-#  opl:ProductFormat(product_format_with_code.product_format_code)
-#    opl:OperatingSystems
-#    opl:Opsys(ac1.opsys_name)
-#    where (
-#        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
-#    )
-#    as virtrdf:OplProductFormatToOpsys .
-
-  opl:ProductFormat(product_format_with_code.product_format_code)
-    opl:OperatingSystemsFamilies
-    opl:OpsysFamily(ac1.opsys_family_id)
-    where (
-        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
-    )
-    as virtrdf:OplProductFormatToOpsysFamily .
-
-#  opl:ProductFormat(product_format_with_code.product_format_code)
-#    opl:Databases
-#    opl:DbmsEngine(ac1.dbms_name)
-#    where (
-#        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
-#    )
-#    as virtrdf:OplProductFormatToDbms .
-
-  opl:ProductFormat(product_format_with_code.product_format_code)
-    opl:DatabaseFamilies
-    opl:DbmsFamily(ac1.dbms_family_id)
-    where (
-        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
-    )
-    as virtrdf:OplProductFormatToDbmsFamily .
-
-  opl:ProductFormat(product_format_with_code.product_format_code)
-    opl:Processors
-  	opl:Processor(ac1.processor_name, ac1.processor_mode_id)
-    where (
-        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
-    )
-    as virtrdf:OplProductFormatToProcessor .
-
-  opl:ProductFormat(product_format_with_code.product_format_code)
-    opl:ProcessorFamilies
-	opl:ProcessorFamily(ac1.processor_family_id)
-    where (
-        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
-    )
-    as virtrdf:OplProductFormatToProcessorFamily .
-
-
-
-# ---------------------> product_category
-
-#  opl:ProductCategory(product_category_with_code.product_cat_code)
-#    opl:OperatingSystems
-#    opl:Opsys(ac1.opsys_name)
-#    where (
-#        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
-#    )
-#    as virtrdf:OplProductCatToOpsys .
-
-  opl:ProductCategory(product_category_with_code.product_cat_code)
-    opl:OperatingSystemsFamilies
-    opl:OpsysFamily(ac1.opsys_family_id)
-    where (
-        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
-    )
-    as virtrdf:OplProductCatToOpsysFamily .
-
-#  opl:ProductCategory(product_category_with_code.product_cat_code)
-#    opl:Databases
-#    opl:DbmsEngine(ac1.dbms_name)
-#    where (
-#        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
-#    )
-#    as virtrdf:OplProductCatToDbms .
-
-  opl:ProductCategory(product_category_with_code.product_cat_code)
-    opl:DatabaseFamilies
-    opl:DbmsFamily(ac1.dbms_family_id)
-    where (
-        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
-    )
-    as virtrdf:OplProductCatToDbmsFamily .
-
-#  opl:ProductCategory(product_category_with_code.product_cat_code)
-#    opl:Processors
-#  	opl:Processor(ac1.processor_name, ac1.processor_mode_id)
-#    where (
-#        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
-#    )
-#    as virtrdf:OplProductCatToProcessor .
-
-  opl:ProductCategory(product_category_with_code.product_cat_code)
-    opl:ProcessorFamilies
-	opl:ProcessorFamily(ac1.processor_family_id)
-    where (
-        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
-    )
-    as virtrdf:OplProductCatToProcessorFamily .
-
-
-
-
-# ---------------------> product
-
-  opl:Product(product_with_code.product_id)
-    opl:OperatingSystems
-    opl:Opsys(ac1.opsys_name)
-    where (
-        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
-    )
-    as virtrdf:OplProductToOpsys .
-
-  opl:Product(product_with_code.product_id)
-    opl:OperatingSystemsFamilies
-    opl:OpsysFamily(ac1.opsys_family_id)
-    where (
-        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
-    )
-    as virtrdf:OplProductToOpsysFamily .
-
-  opl:Product(product_with_code.product_id)
-    opl:Databases
-    opl:DbmsEngine(ac1.dbms_name)
-    where (
-        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
-    )
-    as virtrdf:OplProductToDbms .
-
-  opl:Product(product_with_code.product_id)
-    opl:DatabaseFamilies
-    opl:DbmsFamily(ac1.dbms_family_id)
-    where (
-        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
-    )
-    as virtrdf:OplProductToDbmsFamily .
-
-  opl:Product(product_with_code.product_id)
-    opl:Processors
-  	opl:Processor(ac1.processor_name, ac1.processor_mode_id)
-    where (
-        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
-    )
-    as virtrdf:OplProductToProcessor .
-
-  opl:Product(product_with_code.product_id)
-    opl:ProcessorFamilies
-	opl:ProcessorFamily(ac1.processor_family_id)
-    where (
-        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
-    )
-    as virtrdf:OplProductToProcessorFamily .
-
-
-
-
-# ---------------------> to product
-
-  opl:Opsys(opsys_tbl.opsys_name)
-    opl:hasProducts
-    opl:Product(ac1.product_id)
-    where (
-        ^{opsys_tbl.}^.opsys_name = ^{ac1.}^.opsys_name
-    )
-    as virtrdf:OplOpsysToProduct .
-
-  opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
-    opl:hasProducts
-    opl:Product(ac1.product_id)
-    where (
-        ^{opsys_family_tbl.}^.opsys_family_id = ^{ac1.}^.opsys_family_id
-    )
-    as virtrdf:OplOpsysFamilyToProduct .
-
-  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
-    opl:hasProducts
-    opl:Product(ac1.product_id)
-    where (
-        ^{dbms_engine_tbl.}^.dbms_name = ^{ac1.}^.dbms_name
-    )
-    as virtrdf:OplDbmsToProduct .
-
-  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
-    opl:hasProducts
-    opl:Product(ac1.product_id)
-    where (
-        ^{dbms_family_tbl.}^.dbms_family_id = ^{ac1.}^.dbms_family_id
-    )
-    as virtrdf:OplDbmsFamilyToProduct .
-
-  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
-    opl:hasProducts
-    opl:Product(ac1.product_id)
-    where (
-        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
-        and
-        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
-    )
-    as virtrdf:OplProcessorToProduct .
-
-  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
-    opl:hasProducts
-    opl:Product(ac1.product_id)
-    where (
-        ^{processor_family_tbl.}^.processor_family_id = ^{ac1.}^.processor_family_id
-    )
-    as virtrdf:OplProcessorFamilyProduct .
-
-
-
-
-# ---------------------> to product_cat
-
-#  opl:Opsys(opsys_tbl.opsys_name)
-#    opl:hasProductCategory
-#    opl:ProductCategory(ac1.product_cat_code)
-#    where (
-#        ^{opsys_tbl.}^.opsys_name = ^{ac1.}^.opsys_name
-#    )
-#    as virtrdf:OplOpsysToProductCategory .
-
-  opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
-    opl:hasProductCategory
-    opl:ProductCategory(ac1.product_cat_code)
-    where (
-        ^{opsys_family_tbl.}^.opsys_family_id = ^{ac1.}^.opsys_family_id
-    )
-    as virtrdf:OplOpsysFamilyToProductCategory .
-
-#  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
-#    opl:hasProductCategory
-#    opl:ProductCategory(ac1.product_cat_code)
-#    where (
-#        ^{dbms_engine_tbl.}^.dbms_name = ^{ac1.}^.dbms_name
-#    )
-#    as virtrdf:OplDbmsToProductCategory .
-
-  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
-    opl:hasProductCategory
-    opl:ProductCategory(ac1.product_cat_code)
-    where (
-        ^{dbms_family_tbl.}^.dbms_family_id = ^{ac1.}^.dbms_family_id
-    )
-    as virtrdf:OplDbmsFamilyToProductCategory .
-
-#  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
-#    opl:hasProductCategory
-#    opl:ProductCategory(ac1.product_cat_code)
-#    where (
-#        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
-#        and
-#        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
-#    )
-#    as virtrdf:OplProcessorToProductCategory .
-
-  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
-    opl:hasProductCategory
-    opl:ProductCategory(ac1.product_cat_code)
-    where (
-        ^{processor_family_tbl.}^.processor_family_id = ^{ac1.}^.processor_family_id
-	)
-    as virtrdf:OplProcessorFamilyProductCategory .
-
-
-
-
-# ---------------------> to product_format
-
-#  opl:Opsys(opsys_tbl.opsys_name)
-#    opl:hasProductFormat
-#    opl:ProductFormat(ac1.product_format_code)
-#    where (
-#        ^{opsys_tbl.}^.opsys_name = ^{ac1.}^.opsys_name
-#    )
-#    as virtrdf:OplOpsysToProductFormat .
-
-  opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
-    opl:hasProductFormat
-    opl:ProductFormat(ac1.product_format_code)
-    where (
-        ^{opsys_family_tbl.}^.opsys_family_id = ^{ac1.}^.opsys_family_id
-    )
-    as virtrdf:OplOpsysFamilyToProductFormat .
-
-#  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
-#    opl:hasProductFormat
-#    opl:ProductFormat(ac1.product_format_code)
-#    where (
-#        ^{dbms_engine_tbl.}^.dbms_name = ^{ac1.}^.dbms_name
-#    )
-#    as virtrdf:OplDbmsToProductFormat .
-
-  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
-    opl:hasProductFormat
-    opl:ProductFormat(ac1.product_format_code)
-    where (
-        ^{dbms_family_tbl.}^.dbms_family_id = ^{ac1.}^.dbms_family_id
-    )
-    as virtrdf:OplDbmsFamilyToProductFormat .
-
-#  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
-#    opl:hasProductFormat
-#    opl:ProductFormat(ac1.product_format_code)
-#    where (
-#        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
-#        and
-#        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
-#    )
-#    as virtrdf:OplProcessorToProductFormat .
-
-  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
-    opl:hasProductFormat
-    opl:ProductFormat(ac1.product_format_code)
-    where (
-        ^{processor_family_tbl.}^.processor_family_id = ^{ac1.}^.processor_family_id
-    )
-    as virtrdf:OplProcessorFamilyProductFormat .
-
-
-
-
-# ---------------------> to product_family
-
-#  opl:Opsys(opsys_tbl.opsys_name)
-#    opl:hasProductFamily
-#    opl:ProductFamily(ac1.product_family_code)
-#    where (
-#        ^{opsys_tbl.}^.opsys_name = ^{ac1.}^.opsys_name
-#    )
-#    as virtrdf:OplOpsysToProductFamily .
-
-  opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
-    opl:hasProductFamily
-    opl:ProductFamily(ac1.product_family_code)
-    where (
-        ^{opsys_family_tbl.}^.opsys_family_id = ^{ac1.}^.opsys_family_id
-    )
-    as virtrdf:OplOpsysFamilyToProductFamily .
-
-#  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
-#    opl:hasProductFamily
-#    opl:ProductFamily(ac1.product_family_code)
-#    where (
-#        ^{dbms_engine_tbl.}^.dbms_name = ^{ac1.}^.dbms_name
-#    )
-#    as virtrdf:OplDbmsToProductFamily .
-
-  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
-    opl:hasProductFamily
-    opl:ProductFamily(ac1.product_family_code)
-    where (
-        ^{dbms_family_tbl.}^.dbms_family_id = ^{ac1.}^.dbms_family_id
-    )
-    as virtrdf:OplDbmsFamilyToProductFamily .
-
-#  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
-#    opl:hasProductFamily
-#    opl:ProductFamily(ac1.product_family_code)
-#    where (
-#        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
-#        and
-#        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
-#    )
-#    as virtrdf:OplProcessorToProductFamily .
-
-  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
-    opl:hasProductFamily
-    opl:ProductFamily(ac1.product_family_code)
-    where (
-        ^{processor_family_tbl.}^.processor_family_id = ^{ac1.}^.processor_family_id
-	)
-    as virtrdf:OplProcessorFamilyProductFamily .
-
-
-#
-# Product Benefits and things
-# =========================================
-
-	opl:ProductBenefit(product_benefits_tbl.product_benefit_id)
-	  a opl:ProductBenefit
-	  as virtrdf:OplProductBenefit ;
-	rdfs:label product_benefits_tbl.product_benefit_desc
-	  as virtrdf:rdfsLabelProductBenefitDescription ;
-	opl:isOfProductBenefitCategory opl:ProductBenefitCategory(product_benefits_tbl.product_benefit_category_id)
-	  as virtrdf:OplProductBenefitIsOfProductBenefitCategory ;
-	opl:Description product_benefits_tbl.product_benefit_desc
-	  as virtrdf:OplProductBenefitDescription ;
-	opl:Acronym product_benefits_tbl.product_benefit_acronym
-	  as virtrdf:OplProductBenefitAcronym ;
-  opl:Explanation product_benefits_tbl.product_benefit_explanation
-    as virtrdf:OplProductBenefitExplanation ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-	opl:ProductBenefitCategory(product_benefits_category_tbl.product_benefit_category_id)
-	  a opl:ProductBenefitCategory
-	  as virtrdf:OplProductBenefitCategory ;
-	rdfs:label product_benefits_category_tbl.description
-	  as virtrdf:rdfsLabelProductBenefitCategoryDescription ;
-	opl:Description product_benefits_category_tbl.description
-	  as virtrdf:OplProductBenefitCategoryDescription ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-	opl:ProductFeatureCategory(product_feature_category_tbl.product_feature_category_id)
-	  a opl:ProductFeatureCategory
-	  as virtrdf:OplProductFeatureCategory ;
-	rdfs:label product_feature_category_tbl.short_desc
-	  as virtrdf:rdfsLabelProductFeatureCategoryShortDescription ;
-	opl:ShortDescription product_feature_category_tbl.short_desc
-	  as virtrdf:OplProductFeatureCategoryShortDescription ;
-	opl:Description product_feature_category_tbl.description
-	  as virtrdf:OplProductFeatureCategoryDescription ;
-	opl:StandardsId product_feature_category_tbl.standards_id
-	  as virtrdf:OplProductFeatureCategoryStandardsId ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-	opl:ProductFeature(product_features_tbl.product_feature_id)
-	  a opl:ProductFeature
-	  as virtrdf:OplProductFeature ;
-	rdfs:label product_features_tbl.short_description
-		as virtrdf:rdfsLabelProductFeaturesShortDescription ;
-	opl:Description product_features_tbl.short_description
-		as virtrdf:OplProductFeaturesShortDescription ;
-	dc:description opl:lit_to_string(product_features_tbl.long_description)
-		as virtrdf:OplProductFeaturesLongDescription ;
-	opl:isOfProductBenefit opl:ProductBenefit(product_features_tbl.product_feature_benefit_id)
-		as virtrdf:ProductFeaturesIsOfProductBenefit ;
-	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_features_tbl.product_feature_category_id)
-		as virtrdf:ProductFeaturesIsOfProductFeatureCategory ;
-	opl:isOfProduct opl:Product(product_features_tbl.product_id)
-		as virtrdf:ProductFeaturesIsOfProduct ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy dc: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-    opl:Product(product_with_code.product_id)
-      opl:hasFeature
-      opl:ProductFeature(product_features_tbl.product_feature_id)
-      where (
-	    ^{product_with_code.}^.product_id = ^{product_features_tbl.}^.product_id
-	)
-	as virtrdf:OplProductHasProductFeaturesProductFeatures .
-
-    opl:ProductFeature(product_features_tbl.product_feature_id)
-      opl:isFeatureOf
-      opl:Product(product_with_code.product_id)
-      where (
-        ^{product_with_code.}^.product_id = ^{product_features_tbl.}^.product_id
-    )
-    as virtrdf:OplProductFeaturesAreProductFeaturesProduct .
-
-
-	opl:ProductFamilyFeature(product_family_features_tbl.product_family_feature_id)
-	  a opl:ProductFamilyFeature
-		as virtrdf:OplProductFamilyFeature ;
-	rdfs:label product_family_features_tbl.short_description
-		as virtrdf:rdfsLabelProductFamilyFeaturesShortDescription ;
-	opl:Description product_family_features_tbl.short_description
-		as virtrdf:OplProductFamilyFeaturesShortDescription ;
-	dc:description opl:lit_to_string(product_family_features_tbl.long_description)
-		as virtrdf:OplProductFamilyFeaturesLongDescription ;
-	opl:isOfProductBenefit opl:ProductBenefit(product_family_features_tbl.product_family_feature_benefit_id)
-		as virtrdf:ProductFamilyFeaturesIsOfProductBenefit ;
-	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_family_features_tbl.product_family_feature_cat_id)
-		as virtrdf:ProductFamilyFeaturesIsOfProductFeatureCategory ;
-	opl:isOfProductFamily opl:ProductFamily(product_family_features_tbl.product_family_code)
-		as virtrdf:ProductFamilyFeaturesIsOfProductFamily ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy dc: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-    opl:ProductFamily(product_family_tbl.product_family_code)
-      opl:hasFeature
-      opl:ProductFamilyFeature(product_family_features_tbl.product_family_feature_id)
-      where (
-	    ^{product_family_tbl.}^.product_family_id = ^{product_family_features_tbl.}^.product_family_id
-	)
-	as virtrdf:OplProductFamilyHasProductFamilyFeaturesProductFamilyFeatures .
-
-    opl:ProductFamilyFeature(product_family_features_tbl.product_family_feature_id)
-      opl:isFeatureOf
-      opl:Product(product_family_tbl.product_family_code)
-      where (
-        ^{product_family_tbl.}^.product_family_id = ^{product_family_features_tbl.}^.product_family_id
-    )
-    as virtrdf:OplProductFamilyFeaturesAreProductFamilyFeaturesProductFamily .
-
-
-	opl:ProductFormatFeature(product_format_features_tbl.product_format_feature_id)
-	  a opl:ProductFormatFeature
-	  as virtrdf:OplProductFormatFeature ;
-	rdfs:label product_format_features_tbl.short_description
-		as virtrdf:rdfsLabelProductFormatFeaturesShortDescription ;
-	opl:Description product_format_features_tbl.short_description
-		as virtrdf:OplProductFormatFeaturesShortDescription ;
-	dc:description opl:lit_to_string(product_format_features_tbl.long_description)
-		as virtrdf:OplProductFormatFeaturesLongDescription ;
-	opl:isOfProductBenefit opl:ProductBenefit(product_format_features_tbl.product_format_feature_benefit_id)
-		as virtrdf:ProductFormatFeaturesIsOfProductBenefit ;
-	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_format_features_tbl.product_format_feature_cat_id)
-		as virtrdf:ProductFormatFeaturesIsOfProductFeatureCategory ;
-	opl:isOfProductFormat opl:ProductFormat(product_format_features_tbl.product_format_code)
-		as virtrdf:ProductFormatFeaturesIsOfProductFormat ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy dc: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-    opl:ProductFormat(product_format_with_code.product_format_code)
-      opl:hasFeature
-      opl:ProductFormatFeature(product_format_features_tbl.product_format_feature_id)
-      where (
-	    ^{product_format_with_code.}^.product_format_id = ^{product_format_features_tbl.}^.product_format_id
-	)
-	as virtrdf:OplProductFormatHasProductFormatFeaturesProductFormatFeatures .
-
-    opl:ProductFormatFeature(product_format_features_tbl.product_format_feature_id)
-      opl:isFeatureOf
-      opl:ProductFormat(product_format_with_code.product_format_code)
-      where (
-        ^{product_format_with_code.}^.product_format_id = ^{product_format_features_tbl.}^.product_format_id
-    )
-    as virtrdf:OplProductFormatFeaturesAreProductFormatFeaturesProductFormat .
-
-
-
-	opl:ProductCategoryFeature(product_category_features_tbl.product_category_feature_id)
-	  a opl:ProductCategoryFeature
-	  as virtrdf:OplProductCategoryFeature ;
-	rdfs:label product_category_features_tbl.short_description
-		as virtrdf:rdfsLabelProductCategoryFeaturesShortDescription ;
-	opl:Description product_category_features_tbl.short_description
-		as virtrdf:OplProductCategoryFeaturesShortDescription ;
-	dc:description opl:lit_to_string(product_category_features_tbl.long_description)
-		as virtrdf:OplProductCategoryFeaturesLongDescription ;
-	opl:isOfProductBenefit opl:ProductBenefit(product_category_features_tbl.product_category_feature_benefit_id)
-		as virtrdf:ProductCategoryFeaturesIsOfProductBenefit ;
-	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_category_features_tbl.product_category_feature_category_id)
-		as virtrdf:ProductCategoryFeaturesIsOfProductFeatureCategory ;
-	opl:isOfProductCategory opl:ProductCategory(product_category_features_tbl.product_cat_code)
-		as virtrdf:ProductCategoryFeaturesIsOfProductCategory ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy dc: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-    opl:ProductCategory(product_category_with_code.product_cat_code)
-      opl:hasFeature
-      opl:ProductCategoryFeature(product_category_features_tbl.product_category_feature_id)
-      where (
-	    ^{product_category_with_code.}^.product_cat_id = ^{product_category_features_tbl.}^.product_cat_id
-	)
-	as virtrdf:OplProductCategoryHasProductCategoryFeaturesProductCategoryFeatures .
-
-    opl:ProductCategoryFeature(product_category_features_tbl.product_category_feature_id)
-      opl:isFeatureOf
-      opl:ProductCategory(product_category_with_code.product_cat_code)
-      where (
-        ^{product_category_with_code.}^.product_cat_id = ^{product_category_features_tbl.}^.product_cat_id
-    )
-    as virtrdf:OplProductCategoryFeaturesAreProductCategoryFeaturesProductCategory .
-
-
-	opl:ProductReleaseFeature(product_release_features_tbl.product_release_feature_id)
-	  a opl:ProductReleaseFeature
-	  as virtrdf:OplProductReleaseFeature ;
-	rdfs:label product_release_features_tbl.short_description
-		as virtrdf:rdfsLabelProductReleaseFeaturesShortDescription ;
-	opl:Description product_release_features_tbl.short_description
-		as virtrdf:OplProductReleaseFeaturesShortDescription ;
-	dc:description opl:lit_to_string(product_release_features_tbl.long_description)
-		as virtrdf:OplProductReleaseFeaturesLongDescription ;
-	opl:isOfProductBenefit opl:ProductBenefit(product_release_features_tbl.product_release_feature_benefit_id)
-		as virtrdf:ProductReleaseFeaturesIsOfProductBenefit ;
-	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_release_features_tbl.product_release_feature_cat_id)
-		as virtrdf:ProductReleaseFeaturesIsOfProductFeatureCategory ;
-	opl:isOfProduct opl:Product(product_release_features_tbl.product_id)
-		as virtrdf:ProductReleaseFeaturesIsOfProduct ;
-	opl:ProductReleaseId product_release_features_tbl.product_release_id
-		as virtrdf:ProductReleaseFeaturesProductRelease ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy dc: ;
-      rdfs:isDefinedBy rdfs:
-	.
-
-
-	} .
-} .
-;
-
-
-
-
-DB.DBA.RDF_AUDIT_METADATA (1, '*');
-
-
-SPARQL
-prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
-prefix dc: <http://purl.org/dc/terms#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-prefix oplds: <http://www.openlinksw.com/dataspace/organization/openlink#>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-prefix umbel: <http://umbel.org/umbel/sc/>
-prefix gr: <http://purl.org/goodrelations/v1#>
-
-alter quad storage virtrdf:DefaultQuadStorage
-FROM oplweb2.oplweb.component_archive as component_archive_tbl
-FROM oplweb2.oplweb.component_archive_type as component_archive_type_tbl
-FROM oplweb2.oplweb.component_category as component_category_tbl text literal component_category_long_description
-FROM oplweb2.oplweb.component_mode as component_mode_tbl
-FROM oplweb2.oplweb.component_type as component_type_tbl
-FROM oplweb2.oplweb.components_for_rdfs as components_tbl
-FROM oplweb2.oplweb.dbms_engine as dbms_engine_tbl
-FROM oplweb2.oplweb.dbms_family as dbms_family_tbl
-FROM oplweb2.oplweb.download_location as download_location_tbl
-FROM oplweb2.oplweb.download_protocol as download_protocol_tbl
-FROM oplweb2.oplweb.download_partner as download_partner_tbl
-FROM oplweb2.oplweb.opsys as opsys_tbl
-FROM oplweb2.oplweb.opsys_family as opsys_family_tbl
-FROM oplweb2.oplweb.opsys_type as opsys_type_tbl
-FROM oplweb2.oplweb.processor_family as processor_family_tbl
-FROM oplweb2.oplweb.processor_mode as processor_mode_tbl
-FROM oplweb2.oplweb.processors as processors_tbl
-FROM oplweb2.oplweb.product as product_tbl text literal long_description
-FROM oplweb2.oplweb.product_benefits as product_benefits_tbl text literal product_benefit_explanation
-FROM oplweb2.oplweb.product_benefits_category as product_benefits_category_tbl
-FROM oplweb2.oplweb.product_category as product_category_tbl
-FROM oplweb2.oplweb.product_category_features_with_code as product_category_features_tbl text literal long_description
-FROM oplweb2.oplweb.product_family as product_family_tbl
-FROM oplweb2.oplweb.product_family as product_family_tbl_2
-FROM oplweb2.oplweb.product_family_features_with_code as product_family_features_tbl text literal long_description
-FROM oplweb2.oplweb.product_features as product_features_tbl text literal long_description
-FROM oplweb2.oplweb.product_feature_category as product_feature_category_tbl text literal description
-FROM oplweb2.oplweb.product_format_features_with_code as product_format_features_tbl text literal long_description
-FROM oplweb2.oplweb.product_release_features as product_release_features_tbl text literal long_description
-FROM oplweb2.oplweb.product_release_with_family as product_release_tbl
-FROM oplweb2.oplweb.vendor_category as vendor_category_tbl
-FROM oplweb2.oplweb.vendor_category_family as vendor_category_family_tbl
-FROM oplweb2.oplweb.vendors as vendors_tbl
-FROM oplweb2.oplweb.product_formats_categories as product_formats_categories
-FROM oplweb2.oplweb.product_with_code as product_with_code
-FROM oplweb2.oplweb.product_category_with_code as product_category_with_code
-FROM oplweb2.oplweb.product_format as product_format_with_code
-FROM oplweb2.oplweb.product_price as pp
-FROM oplweb2.oplweb.product_price_type as pt
-FROM oplweb2.DBA.license_model_unit_type as put
-FROM oplweb2.DBA.license_model_unit_type as put2
-FROM oplweb2.DBA.license_model as lm
-FROM oplweb2.DBA.license_model as lm2
-FROM oplweb2.DBA.license_model_type as license_model_type_tbl
-FROM oplweb2.DBA.product_price_varchar as ppv
-FROM oplweb2.DBA.product_general_discount_vc as gd
-FROM oplweb2.oplweb.archive_coverage_osdb as ac1
-{
-	create virtrdf:product_portfolio2 as
-		graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
-	  option (exclusive)
-	{
-
-  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
-    opl:hasProcessors
-    opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
-    where (
-        ^{processor_family_tbl.}^.processor_family_id = ^{processors_tbl.}^.processor_family_id
-    )
-    as virtrdf:OplProcessorFamilyHasProcessors .
-
-
-  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
-    opl:hasProductFamily
-    opl:ProductFamily(ac1.product_family_code)
-	    where (
-        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
-        and
-        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
-		)
-    as virtrdf:OplProcessorToProductFamily .
-
-
-
-#
-# Product Licensing and Shop stuff
-# =========================================
-
-
-	  opl:ProductRelease(
-	      product_release_tbl.product_id,
-	      product_release_tbl.product_release_id,
-	      product_release_tbl.opsys_name,
-	      product_release_tbl.dbms_name
-		  )
-      opl:hasLicenseModel
-      opl:LicenseModel(
-        lm.product_release_id,
-        lm.product_id,
-        lm.opsys_family_id,
-        lm.dbms_family_id,
-        lm.product_price_type_id
-		  )
-	      where (
-        ^{lm.}^.product_id = ^{product_release_tbl.}^.product_id and
-        ^{lm.}^.product_release_id = ^{product_release_tbl.}^.product_release_id and
-        ^{lm.}^.opsys_family_id = ^{product_release_tbl.}^.opsys_family_id and
-        ^{lm.}^.dbms_family_id = ^{product_release_tbl.}^.dbms_family_id
-		  )
-    as virtrdf:OplProductReleaseHasLicenseModel .
-
-	  opl:ProductRelease(
-	      product_release_tbl.product_id,
-	      product_release_tbl.product_release_id,
-	      product_release_tbl.opsys_name,
-	      product_release_tbl.dbms_name
-	      )
-      opl:hasPriceSample
-	  opl:lit_shop_sample (
-	      product_release_tbl.product_release_id,
-	      product_release_tbl.product_id,
-	      product_release_tbl.opsys_name,
-	      product_release_tbl.dbms_name
-      	)
-      as virtrdf:OplPriceSamples .
-
-
-	opl:LicenseModel(
-	    lm.product_release_id,
-        lm.product_id,
-        lm.opsys_family_id,
-        lm.dbms_family_id,
-		lm.product_price_type_id)
-	a opl:LicenseModel
-	as virtrdf:OplLicenseModel;
-	a gr:Sell
-	as virtrdf:OplLicenseModelAgrSell ;
-	a gr:ActualProductOrServiceInstance
-	as virtrdf:OplLicenseModelAgrProductOrServiceInstance ;
-	rdfs:label opl:lit_license_model_type(
-		lm.product_price_type_id
-	) as virtrdf:OplLabelLicenseModel ;
-	rdfs:description opl:lit_license_model_explain (
-		lm.product_price_type_id
-	) as virtrdf:OplLicenseModelExplain ;
-	opl:ProductReleaseId
-	  lm.product_release_id
-	  as virtrdf:lm_shop_price_product_release;
-	opl:isOfFormat
-	  opl:ProductFormat(lm.product_format_code)
-	  as virtrdf:lm_shop_price_product_format;
-	opl:isOfCategory
-	  opl:ProductCategory(lm.product_cat_code)
-	  as virtrdf:lm_shop_price_product_cat;
-	opl:OpsysFamily
-	  opl:OpsysFamily(lm.opsys_family_id)
-	  as virtrdf:lm_shop_price_opsys_family_oplweb;
-	opl:OpsysType
-	  opl:OpsysType(lm.opsys_type_id)
-	  as virtrdf:lm_shop_price_opsys_type;
-	opl:DbmsFamily
-	  opl:DbmsFamily(lm.dbms_family_id)
-	  as virtrdf:lm_shop_price_dbms_family	;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs: ;
-      rdfs:isDefinedBy gr:
-		.
-
-
-	opl:LicenseModel(
-	    lm.product_release_id,
-        lm.product_id,
-        lm.opsys_family_id,
-        lm.dbms_family_id,
-		lm.product_price_type_id)
-	opl:hasPriceUnitType
-	opl:PriceUnitType(
-	    lm2.product_release_id,
-        lm2.product_id,
-        lm2.opsys_family_id,
-        lm2.dbms_family_id,
-		lm2.product_price_type_id,
-		lm2.product_price_unit_type_id)
-	      where (
-        ^{lm.}^.product_release_id = ^{lm2.}^.product_release_id AND
-        ^{lm.}^.product_id = ^{lm2.}^.product_id AND
-        ^{lm.}^.opsys_family_id = ^{lm2.}^.opsys_family_id AND
-        ^{lm.}^.opsys_type_id = ^{lm2.}^.opsys_type_id AND
-        ^{lm.}^.product_price_type_id = ^{lm2.}^.product_price_type_id AND
-		^{lm2.}^.product_price_unit_type_id <> 'db_sessions'
-        and
-        (
-          ^{lm.}^.dbms_family_id = ^{lm2.}^.dbms_family_id
-    	  OR
-          ^{lm2.}^.dbms_family_id = 15
-		  )
-    )
-    as virtrdf:OplLicenseModelPriceUnitTypes .
-
-
-
-	opl:LicenseModel(
-	    lm.product_release_id,
-        lm.product_id,
-        lm.opsys_family_id,
-        lm.dbms_family_id,
-		lm.product_price_type_id)
-	gr:hasPriceSpecification
-	opl:PriceUnitType(
-	    lm2.product_release_id,
-        lm2.product_id,
-        lm2.opsys_family_id,
-        lm2.dbms_family_id,
-		lm2.product_price_type_id,
-		lm2.product_price_unit_type_id)
-	      where (
-        ^{lm.}^.product_release_id = ^{lm2.}^.product_release_id AND
-        ^{lm.}^.product_id = ^{lm2.}^.product_id AND
-        ^{lm.}^.opsys_family_id = ^{lm2.}^.opsys_family_id AND
-        ^{lm.}^.opsys_type_id = ^{lm2.}^.opsys_type_id AND
-        ^{lm.}^.product_price_type_id = ^{lm2.}^.product_price_type_id AND
-		^{lm2.}^.product_price_unit_type_id = 'db_sessions'
-        and
-        (
-          ^{lm.}^.dbms_family_id = ^{lm2.}^.dbms_family_id
-    	  OR
-          ^{lm2.}^.dbms_family_id = 15
-		  )
-    )
-    as virtrdf:OplLicenseModelBasePriceUnitTypes .
-
-
-	opl:Discount(
-	    gd.product_release_id,
-	    gd.opsys_type_id,
-	    gd.product_id,
-	    gd.opsys_family_id,
-	    gd.dbms_family_id,
-	    gd.product_price_type_id)
-	a opl:Discount
-	as virtrdf:product_discount;
-	rdfs:label gd.product_discount_description as virtrdf:OplLabelDiscount ;
-	rdfs:description gd.product_discount_description as virtrdf:OplDiscountExplain ;
-	opl:discount_description
-	  gd.product_discount_description
-	  as virtrdf:gd_discount_description;
-	opl:discount_start
-	  gd.discount_start
-	  as virtrdf:gd_discount_start;
-	opl:discount_end
-	  gd.discount_end
-	  as virtrdf:gd_discount_end;
-	opl:ProductPriceType
-	  opl:PriceType(gd.product_price_type_id)
-	  as virtrdf:gd_shop_price_type;
-	gr:hasUnitOfMeasurement
-	  opl:PriceType(gd.product_price_type_id)
-	  as virtrdf:gd_shop_price_type_grUnitOfMeasurement;
-	opl:ProductReleaseId
-	  gd.product_release_id
-	  as virtrdf:gd_shop_price_product_release;
-	opl:ProductFormat
-	  opl:ProductFormat(gd.product_format_code)
-	  as virtrdf:gd_shop_price_product_format;
-	opl:ProductCategory
-	  opl:ProductCategory(gd.product_cat_code)
-	  as virtrdf:gd_shop_price_product_cat;
-	opl:OpsysFamily
-	  opl:OpsysFamily(gd.opsys_family_id)
-	  as virtrdf:gd_shop_price_opsys_family_oplweb;
-	opl:OpsysType
-	  opl:OpsysType(gd.opsys_type_id)
-	  as virtrdf:gd_shop_price_opsys_type;
-	opl:DbmsFamily
-	  opl:DbmsFamily(gd.dbms_family_id)
-	  as virtrdf:gd_shop_price_dbms_family;
-	opl:discount_token
-	  gd.discount_token
-	  as virtrdf:gd_discount_token ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-
-
-
-	opl:PriceType(pt.product_price_type_id)
-	  a opl:PriceType
-	  as virtrdf:shop_product_price_type;
-	rdfs:label pt.product_price_type_description as virtrdf:OplLabelPriceType ;
-	rdfs:description pt.product_price_type_description as virtrdf:OplPriceTypeExplain ;
-	opl:PriceTypeDescription
-	  pt.product_price_type_description
-	  as virtrdf:shop_product_price_type_description;
-	dc:description
-	  pt.product_price_type_long_description
-	  as virtrdf:shop_product_price_type_long_description ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy dc: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-	opl:PriceUnitType(
-		put.product_release_id,
-        put.product_id,
-        put.opsys_family_id,
-        put.dbms_family_id,
-		put.product_price_type_id,
-		put.product_price_unit_type_id)
-	  a opl:PriceUnitType
-	  as virtrdf:shop_product_price_unit_type;
-	rdfs:label put.product_price_unit_description as virtrdf:OplLabelproductpriceunitdescription ;
-	rdfs:description put.product_price_unit_description as virtrdf:OplproductpriceunitdescriptionExplain ;
-	gr:hasUnitOfMeasurement
-	  opl:PriceType(put.product_price_type_id)
-	  as virtrdf:put_shop_price_type_grUnitOfMeasurement;
-	opl:unitValue
-	  put.unit_price
-	  as virtrdf:unit_type_unit_price;
-	gr:hasValue
-	  put.unit_price
-	  as virtrdf:unit_type_unit_price_grHasValue;
-	opl:graceUnits
-	  put.unit_grace
-	  as virtrdf:unit_type_unit_grace;
-	opl:minUnits
-	  put.unit_low
-	  as virtrdf:unit_type_unit_low;
-	opl:maxUnits
-	  put.unit_cap
-	  as virtrdf:unit_type_unit_cap;
-	opl:unit_type_description
-	  put.product_price_unit_description
-	  as virtrdf:unit_type_description ;
-      rdfs:isDefinedBy opl: ;
-      rdfs:isDefinedBy rdfs:
-		.
-
-
-    opl:PriceUnitType(
-		put.product_release_id,
-        put.product_id,
-        put.opsys_family_id,
-        put.dbms_family_id,
-		put.product_price_type_id,
-		put.product_price_unit_type_id
-	  )
-      opl:hasIncrementalDiscount
-      opl:PriceUnitIncrementalDiscount(
-		put2.product_release_id,
-        put2.product_id,
-        put2.opsys_family_id,
-        put2.dbms_family_id,
-		put2.product_price_type_id,
-		put2.product_price_unit_type_id
-	  )
-    where (
-		^{put.}^.product_release_id = ^{put2.}^.product_release_id and
-        ^{put.}^.product_id = ^{put2.}^.product_id and
-        ^{put.}^.opsys_family_id = ^{put2.}^.opsys_family_id and
-        ^{put.}^.dbms_family_id = ^{put2.}^.dbms_family_id and
-		^{put.}^.product_price_type_id = ^{put2.}^.product_price_type_id and
-		^{put.}^.product_price_unit_type_id = ^{put2.}^.product_price_unit_type_id
-    )
-    as virtrdf:OplLicenseModelUnitsIncrementalDiscounts .
-
-
-	opl:PriceUnitIncrementalDiscount(
-		put.product_release_id,
-        put.product_id,
-        put.opsys_family_id,
-        put.dbms_family_id,
-		put.product_price_type_id,
-		put.product_price_unit_type_id)
-	  a opl:PriceUnitIncrementalDiscount
-	  as virtrdf:shop_product_price_unit_type_incremental_discount;
-	rdfs:label put.product_price_unit_description as virtrdf:OplLabelproductpriceunitIncDisdescription ;
-	rdfs:description put.product_price_unit_description as virtrdf:OplproductpriceunitIncDisdescriptionExplain ;
-	opl:percentageOfBase
-	  put.unit_discount
-	  as virtrdf:unit_type_unit_discount;
-	opl:triggerPoint
-	  put.quantity
-	  as virtrdf:unit_type_unit_discount_quantity
-		.
-
-
-      opl:LicenseModel(
-        lm.product_release_id,
-        lm.product_id,
-        lm.opsys_family_id,
-        lm.dbms_family_id,
-        lm.product_price_type_id
-	  )
-      opl:hasGeneralDiscounts
-      opl:Discount(
-	    gd.product_release_id,
-	    gd.opsys_type_id,
-	    gd.product_id,
-	    gd.opsys_family_id,
-	    gd.dbms_family_id,
-	    gd.product_price_type_id
-	  )
-      where (
-        ^{lm.}^.product_release_id = ^{gd.}^.product_release_id AND
-        ^{lm.}^.product_id = ^{gd.}^.product_id AND
-        ^{lm.}^.opsys_family_id = ^{gd.}^.opsys_family_id AND
-        ^{lm.}^.dbms_family_id = ^{gd.}^.dbms_family_id AND
-        ^{lm.}^.opsys_type_id = ^{gd.}^.opsys_type_id AND
-        ^{lm.}^.product_price_type_id = ^{gd.}^.product_price_type_id
-    )
-    as virtrdf:OplLicenseModelGeneralDiscounts .
-
-
-
-	} .
-} .
-;
-
-
-DB.DBA.XML_SET_NS_DECL ('OpenLink', 'http://www.openlinksw.com/schemas/oplweb#', 2);
-DB.DBA.XML_SET_NS_DECL ('OplProductCategory', 'http://data.openlinksw.com/oplweb/product_category/', 2);
-DB.DBA.XML_SET_NS_DECL ('OplProductFamily', 'http://data.openlinksw.com/oplweb/product_family/', 2);
-DB.DBA.XML_SET_NS_DECL ('OplProductFormat', 'http://data.openlinksw.com/oplweb/product_format/', 2);
-DB.DBA.XML_SET_NS_DECL ('OplProduct', 'http://data.openlinksw.com/oplweb/product/', 2);
-DB.DBA.XML_SET_NS_DECL ('OplProductRelease', 'http://data.openlinksw.com/oplweb/product_release/', 2);
-
-
-DB.DBA.RDF_AUDIT_METADATA (1, '*');
-
-
-commit work;
--- Clear the 'cache' for immediate effects
-SELECT hs_local_iri, exec ('SPARQL clear graph <'||hs_local_iri||'>')
-  FROM sys_http_sponge
-  WHERE hs_local_iri like '%oplweb%';
-
-SELECT id_to_iri(G), exec ('SPARQL clear graph <'||id_to_iri(G)||'>')
-  FROM rdf_quad
-  WHERE id_to_iri(G) like '%oplweb%';
-
-SPARQL CLEAR GRAPH <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>;
-commit work;
-
-
-SPARQL CONSTRUCT { <http://data.openlinksw.com/oplweb/product_family/uda#this> ?p ?o }
-  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
-  WHERE { <http://data.openlinksw.com/oplweb/product_family/uda#this> ?p ?o }
-;
-
-SPARQL SELECT *
-  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
-  WHERE { <http://data.openlinksw.com/oplweb/product_category/odbc#this> ?p ?o }
-  limit 100
-;
-
-SPARQL define get:soft "soft" SELECT *
-  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
-  WHERE { <http://data.openlinksw.com/oplweb/product_category/odbc#this> ?p ?o }
-  limit 100
-;
-
-SPARQL CONSTRUCT { <http://data.openlinksw.com/oplweb/product_category/jdbc#this> ?p ?o }
-  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
-  WHERE { <http://data.openlinksw.com/oplweb/product_category/jdbc#this> ?p ?o }
-  limit 100
-;
-
-SPARQL CONSTRUCT { <http://data.openlinksw.com/oplweb/product_format/mt#this> ?p ?o }
-  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
-  WHERE { <http://data.openlinksw.com/oplweb/product_format/mt#this> ?p ?o }
-  limit 1
-;
-
-
-SPARQL SELECT  ?p ?o
-  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
-  WHERE { <http://data.openlinksw.com/oplweb/product_family/uda#this> ?p ?o }
-  limit 1
-;
-
-SPARQL
-prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
-SELECT  ?s ?o
-  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
-  WHERE { ?s opl:hasProcessors ?o }
-  limit 1
-;
-
-SPARQL
-prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
-SELECT distinct ?o
-  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
-  WHERE { <http://data.openlinksw.com/oplweb/processor/i686_1#this> opl:hasProductFamily ?o }
-  limit 10
-;
-
--- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/price_unit_type/6.1_odbc-sqlserver-st_1_2_1_db_sessions#this"
--- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/price_unit_type/6.1_odbc-sqlserver-st_1_2_1_cpu#this"
-
---SELECT top 10 * FROM oplweb2.DBA.license_model_unit_type WHERE product_release_id = '6.1' and product_id = 'odbc-sqlserver-st'
---  and opsys_family_id = 1 and dbms_family_id = 15 and product_price_type_id = 1 and product_price_unit_type_id = 'cpu';
-
--- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/rdfbrowser/index.html?uri=http%3A//data.openlinksw.com/oplweb/component_archive/6.1-odbc-oracle-st-i686-generic-win-32-ora10-odbclt-clnt-only_mv.msi"
--- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_family/uda"
--- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_category/odbc"
--- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/dbms_family/MySQL"
--- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_release/odbc-oracle-mt_6.1_i686-generic-win-32_ora9"
--- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/license_model/6.1_odbc-sqlserver-st_1_2_1"
-
-
-
-
-curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/rdfbrowser/index.html?uri=http%3A//data.openlinksw.com/oplweb/component_archive/6.1-odbc-oracle-st-i686-generic-win-32-ora10-odbclt-clnt-only_mv.msi"
-curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_family/uda"
-curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_release/odbc-oracle-mt_6.1_i686-generic-win-32_ora9"
-curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/license_model/6.1_odbc-sqlserver-st_1_2_1"
-
---
--- XXX: note , the below would work only if www.openlinksw.com has the GRAPH <http://data.openlinksw.com/oplweb/>
--- if experimenting on other box, then www.openlinksw.com should be replaced with [URIQA] DefaultHost INI value
---
-
-
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'oplweb2_rule2',
-    1,
-    '/oplweb(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//data.openlinksw.com/oplweb%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//www.openlinksw.com/dataspace/organization/openlink/oplweb/%%3E+WHERE+{+%%3Chttp%%3A//data.openlinksw.com/oplweb%U%%23this%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'oplweb2_rule1',
-    1,
-    '(/oplweb/[^#]*)',
-    vector('path'),
-    1,
-    '/rdfbrowser/index.html?uri=http%%3A//data.openlinksw.com%U%',
---    '/DAV/RDF/rdfqry.vsp?uri=http%%3A//data.openlinksw.com%U%%23this',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'oplweb2_rule3',
-    1,
-    '(/[^#]*)/\x24',
-    vector('path'),
-    1,
-    '%s',
-    vector('path'),
-    null,
-    null,
-    0,
-    null
-    );
-
-
-
-create procedure DB.DBA.REDO_OPLWEB2_RDF_DET()
-{
-  declare colid int;
-  colid := DAV_SEARCH_ID('/DAV/RDF/oplweb2/', 'C');
-  if (colid < 0)
-    return;
-  update WS.WS.SYS_DAV_COL set COL_DET=null where COL_ID = colid;
-}
-;
-
-DB.DBA.REDO_OPLWEB2_RDF_DET();
-
-drop procedure DB.DBA.REDO_OPLWEB2_RDF_DET;
-
-DB.DBA."RDFData_MAKE_DET_COL" ('/DAV/RDF/oplweb2/', 'http://data.openlinksw.com/oplweb', NULL);
-VHOST_REMOVE (lpath=>'/oplweb/data/rdf');
-DB.DBA.VHOST_DEFINE (lpath=>'/oplweb/data/rdf', ppath=>'/DAV/RDF/oplweb2/All/', is_dav=>1, vsp_user=>'dba');
-
--- procedure to convert path to DET resource name
-create procedure DB.DBA.OPLWEB2_DET_REF (in par varchar, in fmt varchar, in val varchar)
-{
-  declare res, iri any;
-  iri := 'http://data.openlinksw.com/oplweb' || val;
-  res := sprintf ('iid (%d).rdf', iri_id_num (iri_to_id (iri)));
-  return sprintf (fmt, res);
-}
-;
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('oplweb2_rdf', 1,
-    '/oplweb/(.*)', vector('path'), 1,
-    '/oplweb/data/rdf/%U', vector('path'),
-    'DB.DBA.OPLWEB2_DET_REF',
-    'application/rdf.xml',
-    2,
-    303);
-
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'oplweb2_rule_list1',
-    1,
-    vector (
-                'oplweb2_rule1',
-                'oplweb2_rule2',
-                'oplweb2_rule3',
-                'oplweb2_rdf'
-          ));
-
-
-VHOST_REMOVE (vhost=>'data.openlinksw.com:80', lpath=>'/oplweb');
-DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lpath=>'/oplweb', ppath=>'/DAV/RDF/oplweb2/',
-  vsp_user=>'dba', is_dav=>1, def_page=>'sfront.vspx', is_brws=>0, opts=>vector ('url_rewrite', 'oplweb2_rule_list1'));
-
-
-/*
-
-DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lhost=>':80', lpath=>'/rdf_net', ppath=>'/rdf_net');
-DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lhost=>':80', lpath=>'/sparql/',
-  ppath => '/!sparql/', is_dav => 1, vsp_user => 'dba', opts => vector('noinherit', 1));
-
-VHOST_REMOVE (vhost=>'data.openlinksw.com', lpath=>'/proxy');
-DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com', lhost=>':80', lpath=>'/proxy',
-  ppath=>'/SOAP/Http/ext_http_proxy', soap_user=>'PROXY');
-
-DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lhost=>':80', lpath=>'/xml_a',
-  ppath=>'/SOAP/',soap_user=>'XML_A');
-DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lhost=>':80', lpath=>'/XMLA',
-  ppath=>'/SOAP/', soap_user=>'XMLA', soap_opts => vector ('ServiceName', 'XMLAnalysis', 'elementFormDefault', 'qualified'))
-
-GRANT EXECUTE ON DB.DBA.RDF_SPONGE_UP TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON DB.DBA.TTLP_EV_NEW_GRAPH TO "SPARQL", "SPARQL_UPDATE";
-grant SPARQL_UPDATE to "SPARQL";
-
-curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_family/uda#this"
-
-SELECT hs_local_iri, exec ('sparql clear graph <'||hs_local_iri||'>') from sys_http_sponge;
-
-*/
-
-
-
-OWL based Ontology
-
---sparql construct { ?x ?y ?z } from --<http://www.openlinksw.com/dataspace/organization/openlink#this>
---	where { ?x ?y ?z }
-
-DB.DBA.RDF_LOAD_RDFXML_MT (
-'<?xml version="1.0"?>
-<rdf:RDF
-    xmlns="http://www.openlinksw.com/dataspace/organization/openlink/oplweb#"
-    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
-    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
-    xmlns:owl="http://www.w3.org/2002/07/owl#"
-    xmlns:foaf="http://xmlns.com/foaf/0.1/"
-    xmlns:virtrdf="http://www.openlinksw.com/schemas/virtrdf#"
-    xml:base="http://www.openlinksw.com/schemas/oplweb#">
-  <owl:Ontology rdf:about="http://www.openlinksw.com/schemas/oplweb#">
-        <rdfs:label>ProductPortfolio</rdfs:label>
-        <rdfs:comment>OpenLink Product Portfolio</rdfs:comment>
-        <virtrdf:catName>oplweb</virtrdf:catName>
-        <virtrdf:version>1.00</virtrdf:version>
-  </owl:Ontology>
-
-	<!-- Family / Category / Format -->
-
-	<rdfs:Class rdf:ID="ProductFamily">
-		<rdfs:label>Product Family</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Family
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProductCategory">
-		<rdfs:label>Product Category</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Category
-		</rdfs:comment>
-    <rdfs:subPropertyOf rdf:resource="#ProductFamily"/>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProductFormat">
-		<rdfs:label>Product Format</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Format
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProductFormatCategory">
-		<rdfs:label>Product Format Category</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Format Category
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdf:Property rdf:ID="ProductFamilyDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductFamily"/>
-    <rdfs:label>Product Family Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductFamilyLongDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductFamily"/>
-    <rdfs:label>Product Family Long Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductFamilyCode">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductFamily"/>
-    <rdfs:label>Product Family Long Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductFormatDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductFormat"/>
-    <rdfs:label>Product Format Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductFormatLongDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductFormat"/>
-    <rdfs:label>Product Format Long Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductFormatCode">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductFormat"/>
-    <rdfs:domain rdf:resource="#ProductFormatCategory"/>
-    <rdfs:label>Product Format Long Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductCategoryDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductCategory"/>
-    <rdfs:label>Product Category Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductCategoryLongDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductCategory"/>
-    <rdfs:label>Product Category Long Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductCategoryCode">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductCategory"/>
-    <rdfs:domain rdf:resource="#ProductFormatCategory"/>
-    <rdfs:label>Product Category Long Description</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="hasProduct">
-    <rdfs:range rdf:resource="#Product"/>
-    <rdfs:domain rdf:resource="#ProductCategory"/>
-    <rdfs:domain rdf:resource="#ProductFormat"/>
-    <rdfs:domain rdf:resource="#ProductFormatCategory"/>
-    <rdfs:label>Product</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="hasCategory">
-    <rdfs:range rdf:resource="#ProductCategory"/>
-    <rdfs:domain rdf:resource="#ProductFamily"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:label>Product</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="hasFormat">
-    <rdfs:range rdf:resource="#ProductFormat"/>
-    <rdfs:domain rdf:resource="#ProductFamily"/>
-    <rdfs:domain rdf:resource="#ProductFormat"/>
-    <rdfs:label>Product</rdfs:label>
-  </rdf:Property>
-
-
-	<!-- Vendor -->
-
-	<rdfs:Class rdf:ID="VendorCategoryFamily">
-		<rdfs:label>vendor_category_family</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			vendor_category_family
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="VendorCategory">
-		<rdfs:label>vendor_category</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			vendor_category
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="VendorCategoryFamily"/>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="Vendors">
-		<rdfs:label>vendors</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			vendors
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="VendorCategory"/>
-	</rdfs:Class>
-
-	<rdf:Property rdf:ID="VendorName">
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Vendors"/>
-    <rdfs:label>vendor name</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="VendorCategoryFamilyDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#VendorCategoryFamily"/>
-    <rdfs:label>vendor_category_family_description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="VendorCategoryDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#VendorCategory"/>
-    <rdfs:label>vendor_category_description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="isOfVendorCategory">
-    <rdfs:range rdf:resource="#VendorCategory"/>
-    <rdfs:domain rdf:resource="#Vendors"/>
-    <rdfs:label>vendor_category_description</rdfs:label>
-  </rdf:Property>
-
-	<!-- Opsys / DBMS -->
-
-	<rdfs:Class rdf:ID="OpsysFamily">
-		<rdfs:label>Opsys Family</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Opsys Family
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="DbmsFamily">
-		<rdfs:label>Dbms Family</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Dbms Family
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="DbmsEngine">
-		<rdfs:label>Dbms Engine</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Dbms Engine
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="DbmsFamily"/>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="OpsysType">
-		<rdfs:label>Opsys Type</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Opsys Type
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProcessorMode">
-		<rdfs:label>Processor Mode</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Processor Mode
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="Processor">
-		<rdfs:label>Processor</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Processor
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="ProcessorFamily"/>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProcessorFamily">
-		<rdfs:label>Processor Family</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Processor Family
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="Opsys">
-		<rdfs:label>Dbms Engine</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			opsys
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="OpsysFamily"/>
-    <rdfs:subClassOf rdf:resource="OpsysType"/>
-	</rdfs:Class>
-
-	<rdf:Property rdf:ID="OpsysFamilyName">
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#OpsysFamily"/>
-    <rdfs:label>Opsys Family Name</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysFamilyRating">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#OpsysFamily"/>
-    <rdfs:label>Opsys Family Rating</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysFamilyLicenseCode">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#OpsysFamily"/>
-    <rdfs:label>Opsys Family License Code</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysFamilyVendor">
-    <rdfs:range rdf:resource="#Vendors"/>
-    <rdfs:domain rdf:resource="#OpsysFamily"/>
-    <rdfs:label>Opsys Family Vendor</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="DbmsFamilyName">
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DbmsFamily"/>
-    <rdfs:label>DBMS Family Name</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="DbmsFamilyVendor">
-    <rdfs:range rdf:resource="#Vendors"/>
-    <rdfs:domain rdf:resource="#DbmsFamily"/>
-    <rdfs:label>DBMS Family Vendor</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="DbmsName">
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DbmsEngine"/>
-    <rdfs:label>DBMS Name</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="DbmsVersion">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DbmsEngine"/>
-    <rdfs:label>DBMS Version</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="DbmsEngineRating">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DbmsEngine"/>
-    <rdfs:label>DBMS Engine Rating</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="DbmsEngineOldArchiveCode">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DbmsEngine"/>
-    <rdfs:label>DBMS Engine old Archive Code</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="DbmsUpwardCompatible">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DbmsEngine"/>
-    <rdfs:label>DBMS Upward Compatible</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="DbmsDownwardCompatible">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DbmsEngine"/>
-    <rdfs:label>DBMS Downward Compatible</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysTypeDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#OpsysType"/>
-    <rdfs:label>Opsys Type Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysTypeShortDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#OpsysType"/>
-    <rdfs:label>Opsys Type Short Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysName">
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Opsys"/>
-    <rdfs:label>Opsys Name</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysVersion">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Opsys"/>
-    <rdfs:label>Opsys Version</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysUpwardCompatible">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Opsys"/>
-    <rdfs:label>Opsys Compatible</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysDownwardCompatible">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Opsys"/>
-    <rdfs:label>Opsys Downward Compatible</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysLicenseCode">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Opsys"/>
-    <rdfs:label>Opsys License Code</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysCommercialName">
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Opsys"/>
-    <rdfs:label>Opsys Commercial Name</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysProcessor">
-    <rdfs:range rdf:resource="#Processor"/>
-    <rdfs:domain rdf:resource="#Opsys"/>
-    <rdfs:label>Opsys Processor</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="OpsysEmulation">
-    <rdfs:range rdf:resource="#ProcessorMode"/>
-    <rdfs:domain rdf:resource="#Opsys"/>
-    <rdfs:label>Opsys Emulation Mode</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProcessorModeName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProcessorMode"/>
-    <rdfs:label>Processor Mode Name</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProcessorName">
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Processor"/>
-    <rdfs:label>Processor Name</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProcessorProcessorMode">
-    <rdfs:range rdf:resource="#ProcessorMode"/>
-    <rdfs:domain rdf:resource="#Processor"/>
-    <rdfs:label>Processor Mode</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProcessorDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Processor"/>
-    <rdfs:label>Processor Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProcessorFamilyName">
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProcessorFamily"/>
-    <rdfs:label>Processor Family Name</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProcessorFamilyDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProcessorFamily"/>
-    <rdfs:label>Processor Family Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProcessorFamilyVendor">
-    <rdfs:range rdf:resource="#Vendors"/>
-    <rdfs:domain rdf:resource="#ProcessorFamily"/>
-    <rdfs:label>Processor Family Vendor</rdfs:label>
-  </rdf:Property>
-
-
-	<!-- Product / Product Release -->
-
-	<rdfs:Class rdf:ID="Product">
-		<rdfs:label>Product</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product
-		</rdfs:comment>
-    <rdfs:subPropertyOf rdf:resource="#ProductFormat"/>
-    <rdfs:subPropertyOf rdf:resource="#ProductCategory"/>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProductRelease">
-		<rdfs:label>Product Release</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Release
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="#Product"/>
-	</rdfs:Class>
-
-	<rdf:Property rdf:ID="ProductId">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:label>Product ID</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="isOfCategory">
-    <rdfs:range rdf:resource="#ProductCategory"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:label>Product Category</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="isOfFormat">
-    <rdfs:range rdf:resource="#ProductFormat"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:label>Product Category</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductDescription">
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:label>Product Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductLongDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:label>Product Long Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductReleaseId">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductRelease"/>
-    <rdfs:label>Product Release ID</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductReleaseOpsys">
-    <rdfs:range rdf:resource="#Opsys"/>
-    <rdfs:domain rdf:resource="#ProductRelease"/>
-    <rdfs:label>Product Release Opsys</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductReleaseDbms">
-    <rdfs:range rdf:resource="#DbmsEngine"/>
-    <rdfs:domain rdf:resource="#ProductRelease"/>
-    <rdfs:label>Product Release DBMS</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductReleaseUpwardCompatible">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductRelease"/>
-    <rdfs:label>Product Release upward compatible</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductReleaseDownwardCompatible">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductRelease"/>
-    <rdfs:label>Product Release downward compatible</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ProductReleaseSupported">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductRelease"/>
-    <rdfs:label>Product Release Supported</rdfs:label>
-  </rdf:Property>
-
-	<!-- Components -->
-
-	<rdfs:Class rdf:ID="Component">
-		<rdfs:label>Components</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Components
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ComponentMode">
-		<rdfs:label>Component Mode</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Component
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ComponentType">
-		<rdfs:label>Component</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Component Type
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ComponentCategory">
-		<rdfs:label>Component Category</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Component
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdf:Property rdf:ID="ComponentModeDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentMode"/>
-    <rdfs:label>Component Mode Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ComponentModeShortDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentMode"/>
-    <rdfs:label>Component Mode Short Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ComponentTypeDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentType"/>
-    <rdfs:label>Component Type Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ComponentTypeShortDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentType"/>
-    <rdfs:label>Component Type Short Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ComponentCategoryDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentCategory"/>
-    <rdfs:label>Component Category Description</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ComponentCategoryLongDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentCategory"/>
-    <rdfs:label>Component Category Long Description</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentCategoryShortDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentCategory"/>
-    <rdfs:label>Component Category Short Description</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentName">
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Component"/>
-    <rdfs:label>Components Name</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentCvsid">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Component"/>
-    <rdfs:label>Components CVSID</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentBuildDate">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Component"/>
-    <rdfs:label>Components Build Date</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="Notes">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Component"/>
-    <rdfs:label>Components Notes</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="BuildComments">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Component"/>
-    <rdfs:label>Components Build Comments</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="Filesize">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Component"/>
-    <rdfs:label>Components Name</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ComponentComponentCategory">
-    <rdfs:range rdf:resource="#ComponentCategory"/>
-    <rdfs:domain rdf:resource="#Component"/>
-    <rdfs:label>Components Component Category</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentComponentType">
-    <rdfs:range rdf:resource="#ComponentType"/>
-    <rdfs:domain rdf:resource="#Component"/>
-    <rdfs:label>Components Component Type</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentComponentMode">
-    <rdfs:range rdf:resource="#ComponentMode"/>
-    <rdfs:domain rdf:resource="#Component"/>
-    <rdfs:label>Components Component Mode</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentOpsys">
-    <rdfs:range rdf:resource="#Opsys"/>
-    <rdfs:domain rdf:resource="#Component"/>
-    <rdfs:label>Components Opsys</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentDbmsEngine">
-    <rdfs:range rdf:resource="#DbmsEngine"/>
-    <rdfs:domain rdf:resource="#Component"/>
-    <rdfs:label>Components DBMS</rdfs:label>
-  </rdf:Property>
-
-	<!-- Component Archives -->
-
-	<rdfs:Class rdf:ID="ComponentArchive">
-		<rdfs:label>Component Archive</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Component Archives
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="#ProductRelease"/>
-    <rdfs:subClassOf rdf:resource="#Component"/>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ComponentArchiveType">
-		<rdfs:label>Component Archive Type</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Component Archives Type
-		</rdfs:comment>
-	</rdfs:Class>
-
-  <rdf:Property rdf:ID="ComponentArchiveTypeName">
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentArchiveType"/>
-    <rdfs:label>Component Archive Type Name</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentArchiveTypeShortName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentArchiveType"/>
-    <rdfs:label>Component Archive Type Name</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentArchiveTypeExtension">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentArchiveType"/>
-    <rdfs:label>Component Archive Type Extension</rdfs:label>
-  </rdf:Property>
-
-	<rdf:Property rdf:ID="ComponentArchiveComponentArchiveType">
-    <rdfs:range rdf:resource="#ComponentArchiveType"/>
-    <rdfs:domain rdf:resource="#ComponentArchive"/>
-    <rdfs:label>Component Archive Component Archive Type</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentArchiveName">
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentArchive"/>
-    <rdfs:label>Component Archive Name</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentArchiveAssemblyDate">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentArchive"/>
-    <rdfs:label>Component Archive Assembly Date</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentArchiveFileUri">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentArchive"/>
-    <rdfs:label>Component Archive File URI</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentArchiveLicenseCode">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentArchive"/>
-    <rdfs:label>Component Archive License Code</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentArchiveResName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentArchive"/>
-    <rdfs:label>Component Archive DAV Resource Name</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentArchiveResFullPath">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentArchive"/>
-    <rdfs:label>Component Archive DAV Full Path</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ComponentArchiveResFileSize">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ComponentArchive"/>
-    <rdfs:label>Component Archive File Size in DAV</rdfs:label>
-  </rdf:Property>
-
-	<!-- Download locations -->
-
-	<rdfs:Class rdf:ID="DownloadLocation">
-		<rdfs:label>Download Location</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Download Location
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="#ComponentArchive"/>
-    <rdfs:subClassOf rdf:resource="#DownloadPartner"/>
-    <rdfs:subClassOf rdf:resource="#DownloadProtocol"/>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="DownloadProtocol">
-		<rdfs:label>Download Protocol</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Download Protocol
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="DownloadPartner">
-		<rdfs:label>Download Partner</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Download Partner
-		</rdfs:comment>
-	</rdfs:Class>
-
-  <rdf:Property rdf:ID="ProtocolName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DownloadProtocol"/>
-    <rdfs:label>Protocol Name</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ProtocolDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DownloadProtocol"/>
-    <rdfs:label>Protocol Description</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ProtocolActive">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DownloadProtocol"/>
-    <rdfs:label>Protocol Active</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="PartnerName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DownloadPartner"/>
-    <rdfs:label>Download Partner Partner Name</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="HostName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DownloadPartner"/>
-    <rdfs:label>Download Partner Hostname</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="DomainName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DownloadPartner"/>
-    <rdfs:label>Download Partner Domain Name</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="PortNumber">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DownloadPartner"/>
-    <rdfs:label>Download Partner Port Number</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="Uri">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DownloadLocation"/>
-    <rdfs:label>Download Location URI</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="UriOld">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#DownloadLocation"/>
-    <rdfs:label>Download Location URI Old</rdfs:label>
-  </rdf:Property>
-
-	<!-- Features and Benefits -->
-
-	<rdfs:Class rdf:ID="ProductBenefit">
-		<rdfs:label>Product Benefit</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Benefit
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="#ProductBenefitCategory"/>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProductBenefitCategory">
-		<rdfs:label>Product Benefit</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Benefit
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProductFeatureCategory">
-		<rdfs:label>Product Feature Category</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Feature Category
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProductFeature">
-		<rdfs:label>Product Features</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Features
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
-    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
-    <rdfs:subClassOf rdf:resource="#Product"/>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProductFamilyFeature">
-		<rdfs:label>Product Family Features</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Family Features
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
-    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
-    <rdfs:subClassOf rdf:resource="#ProductFamily"/>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProductFormatFeature">
-		<rdfs:label>Product Format Features</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Format Features
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
-    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
-    <rdfs:subClassOf rdf:resource="#ProductFormat"/>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProductCategoryFeature">
-		<rdfs:label>Product Category Features</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Category Features
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
-    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
-    <rdfs:subClassOf rdf:resource="#ProductCategory"/>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="ProductReleaseFeature">
-		<rdfs:label>Product Benefit</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Product Benefit
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
-    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
-    <rdfs:subClassOf rdf:resource="#ProductRelease"/>
-	</rdfs:Class>
-
-  <rdf:Property rdf:ID="ProductBenefitsCategoryDescription">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductBenefitsCategory"/>
-    <rdfs:label>product Benefits Category</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="Description">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductBenefit"/>
-    <rdfs:domain rdf:resource="#ProductBenefitCategory"/>
-    <rdfs:domain rdf:resource="#ProductFeatureCategory"/>
-    <rdfs:domain rdf:resource="#ProductFeature"/>
-    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
-    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
-    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
-    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
-    <rdfs:label>Product Benefits Description</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="Details">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductFeature"/>
-    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
-    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
-    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
-    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
-    <rdfs:label>Product Benefits Description Details</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ProductBenefitsAcronym">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductBenefit"/>
-    <rdfs:label>Product Benefits Acronym</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="ProductBenefitsExplanation">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductBenefit"/>
-    <rdfs:label>Product Benefits Explanation</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="DemoUrl">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
-    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
-    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
-    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
-    <rdfs:label>The Features Demo URL</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="HypesPerSecond">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
-    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
-    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
-    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
-    <rdfs:domain rdf:resource="#ProductreleaseFeature"/>
-    <rdfs:label>The Features Number of Hypes per second</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="Implemented">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
-    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
-    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
-    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
-    <rdfs:label>The Features Short Description</rdfs:label>
-  </rdf:Property>
-
-<!-- shop / pricing stuff -->
-
-	<rdfs:Class rdf:ID="LicenseType">
-		<rdfs:label>License Type</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			License Type
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="UnitType">
-		<rdfs:label>Unit Type</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Unit Type
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="GeneralDiscount">
-		<rdfs:label>General Discount</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			General Discount
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="IncrementalDiscount">
-		<rdfs:label>Incremental Discount</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			Incremental Discount
-		</rdfs:comment>
-	</rdfs:Class>
-
-	<rdfs:Class rdf:ID="License">
-		<rdfs:label>License</rdfs:label>
-    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
-			License
-		</rdfs:comment>
-    <rdfs:subClassOf rdf:resource="#LicenseType"/>
-    <rdfs:subClassOf rdf:resource="#ProductRelease"/>
-	</rdfs:Class>
-
-  <rdf:Property rdf:ID="BaseCostUnit">
-    <rdfs:range rdf:resource="#UnitType"/>
-    <rdfs:domain rdf:resource="#License"/>
-    <rdfs:label>Base Unit Cost</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="PriceUnit">
-    <rdfs:range rdf:resource="#UnitType"/>
-    <rdfs:domain rdf:resource="#License"/>
-    <rdfs:label>Price Unit Cost</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="hasDiscount">
-    <rdfs:range rdf:resource="#IncrementalDiscount"/>
-    <rdfs:domain rdf:resource="#UnitType"/>
-    <rdfs:label>Base Unit Cost</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="hasGeneralDiscount">
-    <rdfs:range rdf:resource="#GeneralDiscount"/>
-    <rdfs:domain rdf:resource="#License"/>
-    <rdfs:label>General Discount</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="unitValue">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#UnitType"/>
-    <rdfs:label>Unit Value</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="graceUnit">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#UnitType"/>
-    <rdfs:label>Grace Unit</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="minUnits">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#UnitType"/>
-    <rdfs:label>Minimum Units</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="maxUnits">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#UnitType"/>
-    <rdfs:label>Maximum Units</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="codeWord">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#GeneralDiscount"/>
-    <rdfs:label>Code Word needed to activate this discount</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="startDate">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#GeneralDiscount"/>
-    <rdfs:label>Discount Start Date</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="endDate">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#GeneralDiscount"/>
-    <rdfs:label>Discount End Date</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="percentageOfCost">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#GeneralDiscount"/>
-    <rdfs:label>Percentage of cost attributing as discount</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="triggerPoint">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#IncrementalDiscount"/>
-    <rdfs:label>Discount Trigger Point</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="percentageOfBase">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#IncrementalDiscount"/>
-    <rdfs:label>Percentage of base cost attributing as discount</rdfs:label>
-  </rdf:Property>
-
-<!-- common properties -->
-
-  <rdf:Property rdf:ID="label">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2001/XMLSchema#label"/>
-    <rdfs:domain rdf:resource="#ProductCategory"/>
-    <rdfs:domain rdf:resource="#ProductFormat"/>
-    <rdfs:domain rdf:resource="#ProductFamily"/>
-    <rdfs:domain rdf:resource="#ProductRelease"/>
-    <rdfs:domain rdf:resource="#VendorCategory"/>
-    <rdfs:domain rdf:resource="#Vendor"/>
-    <rdfs:domain rdf:resource="#OpsysFamily"/>
-    <rdfs:domain rdf:resource="#DbmsFamily"/>
-    <rdfs:domain rdf:resource="#DbmsEngine"/>
-    <rdfs:domain rdf:resource="#OpsysType"/>
-    <rdfs:domain rdf:resource="#Processor"/>
-    <rdfs:domain rdf:resource="#ProcessorFamily"/>
-    <rdfs:domain rdf:resource="#Opsys"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:domain rdf:resource="#ComponentMode"/>
-    <rdfs:domain rdf:resource="#ComponentType"/>
-    <rdfs:domain rdf:resource="#ComponentCategory"/>
-    <rdfs:domain rdf:resource="#ComponentArchive"/>
-    <rdfs:domain rdf:resource="#ComponentArchiveType"/>
-    <rdfs:domain rdf:resource="#DownloadLocation"/>
-    <rdfs:domain rdf:resource="#ProductBenefit"/>
-    <rdfs:domain rdf:resource="#ProductBenefitCategory"/>
-    <rdfs:domain rdf:resource="#ProductFeatureCategory"/>
-    <rdfs:domain rdf:resource="#ProductFeature"/>
-    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
-    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
-    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
-    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
-    <rdfs:domain rdf:resource="#LicenseModel"/>
-    <rdfs:domain rdf:resource="#Discount"/>
-    <rdfs:domain rdf:resource="#PriceType"/>
-    <rdfs:domain rdf:resource="#PriceUnitType"/>
-    <rdfs:label>Label</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="name">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:domain rdf:resource="#ProductCategory"/>
-    <rdfs:domain rdf:resource="#ProductFormat"/>
-    <rdfs:domain rdf:resource="#ProductFamily"/>
-    <rdfs:domain rdf:resource="#ProductRelease"/>
-    <rdfs:label>Name</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="logo">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/logo"/>
-    <rdfs:domain rdf:resource="#ProductFamily"/>
-    <rdfs:label>logo</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="homepage">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/homepage"/>
-    <rdfs:domain rdf:resource="#ProductFamily"/>
-    <rdfs:domain rdf:resource="#ProcessorFamily"/>
-    <rdfs:domain rdf:resource="#OpsysFamily"/>
-    <rdfs:domain rdf:resource="#DbmsFamily"/>
-    <rdfs:label>homepage</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="maker">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/maker"/>
-    <rdfs:domain rdf:resource="#ProductCategory"/>
-    <rdfs:domain rdf:resource="#ProductFormat"/>
-    <rdfs:domain rdf:resource="#ProductFamily"/>
-    <rdfs:domain rdf:resource="#ProductRelease"/>
-    <rdfs:label>Maker</rdfs:label>
-  </rdf:Property>
-
-  <rdf:Property rdf:ID="sameAs">
-    <rdfs:range rdf:resource="owl#sameAs"/>
-    <rdfs:domain rdf:resource="#ProductCategory"/>
-    <rdfs:domain rdf:resource="#ProductFormat"/>
-    <rdfs:domain rdf:resource="#ProductFamily"/>
-    <rdfs:domain rdf:resource="#ProductRelease"/>
-    <rdfs:domain rdf:resource="#ProductFormatCategory"/>
-    <rdfs:label>Name</rdfs:label>
-  </rdf:Property>
-
-</rdf:RDF>
-
-',
-'http://www.openlinksw.com/schemas/oplweb#',
-'http://www.openlinksw.com/schemas/oplweb#')
---'http://www.openlinksw.com/dataspace/organization/openlink/ProductPortfolioOntology/1.0/')
-;
-
-rdfs_rule_set ('oplweb2_owlset', 'http://www.openlinksw.com/schemas/oplweb#', 1);
-
-DB.DBA.XML_SET_NS_DECL ('opl', 'http://www.openlinksw.com/schemas/oplweb#', 2);
-]]></programlisting>
-    </sect4>
-  </sect3>
-  <sect3 id="rdfviewsenterprsyb">
-      <title>Sybase using demonstration 'pubs2' database</title>
-<programlisting><![CDATA[
--- Setup script for RDF views of Sybase 15 PUBS2 Sample Database --
-
-DB..vd_remote_data_source ('syb15ma-pubs2', '', '<uid>','<pwd>');
-
-ATTACH TABLE  "pubs2.dbo.au_pix"  PRIMARY KEY ("au_id")                  AS "pubs2"."syb"."au_pix"  FROM 'syb15ma-pubs2';
-ATTACH TABLE  "pubs2.dbo.authors"  PRIMARY KEY ("au_id")                  AS "pubs2"."syb"."authors"  FROM 'syb15ma-pubs2';
-ATTACH TABLE  "pubs2.dbo.discounts"  PRIMARY KEY ("stor_id")                  AS "pubs2"."syb"."discounts"  FROM 'syb15ma-pubs2';
-ATTACH TABLE  "pubs2.dbo.publishers"  PRIMARY KEY ("pub_id")                  AS "pubs2"."syb"."publishers"  FROM 'syb15ma-pubs2';
-ATTACH TABLE  "pubs2.dbo.roysched"  PRIMARY KEY ("title_id")                  AS "pubs2"."syb"."roysched"  FROM 'syb15ma-pubs2';
-ATTACH TABLE  "pubs2.dbo.sales"  PRIMARY KEY ("stor_id", "ord_num")                  AS "pubs2"."syb"."sales"  FROM 'syb15ma-pubs2';
-ATTACH TABLE  "pubs2.dbo.salesdetail"  PRIMARY KEY ("stor_id", "ord_num", "title_id")                   AS "pubs2"."syb"."salesdetail"  FROM 'syb15ma-pubs2';
-ATTACH TABLE  "pubs2.dbo.stores"  PRIMARY KEY ("stor_id")                  AS "pubs2"."syb"."stores"  FROM 'syb15ma-pubs2';
-ATTACH TABLE  "pubs2.dbo.titleauthor"  PRIMARY KEY ("au_id", "title_id")                  AS "pubs2"."syb"."titleauthor"  FROM 'syb15ma-pubs2';
-ATTACH TABLE  "pubs2.dbo.titles"  PRIMARY KEY ("title_id", "pub_id")                  AS "pubs2"."syb"."titles"  FROM 'syb15ma-pubs2';
-
-COMMIT WORK;
-
-GRANT SELECT ON pubs2.syb.au_pix TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON pubs2.syb.authors TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON pubs2.syb.discounts TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON pubs2.syb.publishers TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON pubs2.syb.roysched TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON pubs2.syb.sales TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON pubs2.syb.salesdetail TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON pubs2.syb.stores TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON pubs2.syb.titleauthor TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON pubs2.syb.titles TO "SPARQL", "SPARQL_UPDATE";
-
--------------------------------------------------------------------
-
--------- Create rdfs:Class definitions ----------------------------
-
-ttlp (
-'
- at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
- at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
-
- at prefix syb: <http://localhost:8890/schemas/sybasepubs2/> .
-
-syb:titles a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
-	rdfs:label "titles" ;
-	rdfs:comment "Sybase Pubs2 titles table" .
-
-syb:title_id a rdf:Property ;
-	rdfs:domain syb:titles ;
-	rdfs:range xsd:string ;
-	rdfs:label "title id" .
-
-syb:title a rdf:Property ;
-	rdfs:domain syb:titles ;
-	rdfs:range xsd:string ;
-	rdfs:label "title" .
-
-syb:type a rdf:Property ;
-	rdfs:domain syb:titles ;
-	rdfs:range xsd:string ;
-	rdfs:label "type" .
-
-syb:pub_id a rdf:Property ;
-	rdfs:domain syb:titles ;
-	rdfs:range syb:publishers ;
-	rdfs:label "pub_id" .
-
-syb:advance a rdf:Property ;
-	rdfs:domain syb:titles ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "advance" .
-
-syb:price a rdf:Property ;
-	rdfs:domain syb:titles ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "price" .
-
-syb:total_sales a rdf:Property ;
-	rdfs:domain syb:titles ;
-	rdfs:range xsd:integer ;
-	rdfs:label "total_sales" .
-
-syb:notes a rdf:Property ;
-	rdfs:domain syb:titles ;
-	rdfs:range xsd:string ;
-	rdfs:label "notes" .
-
-syb:contract a rdf:Property ;
-	rdfs:domain syb:titles ;
-	rdfs:range xsd:integer ;
-	rdfs:label "contract" .
-
-syb:pubdate a rdf:Property ;
-	rdfs:domain syb:titles ;
-	rdfs:range xsd:dateTime ;
-	rdfs:label "publish date" .
-
-syb:authors a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
-	rdfs:label "authors" ;
-	rdfs:comment "Sybase Pubs2 authors table" .
-
-syb:au_id a rdf:Property ;
-	rdfs:domain syb:authors ;
-	rdfs:range xsd:string ;
-	rdfs:label "author id" .
-
-syb:au_lname a rdf:Property ;
-	rdfs:domain syb:authors ;
-	rdfs:range xsd:string ;
-	rdfs:label "author last name" .
-
-syb:au_fname a rdf:Property ;
-	rdfs:domain syb:authors ;
-	rdfs:range xsd:string ;
-	rdfs:label "author first name" .
-
-syb:phone a rdf:Property ;
-	rdfs:domain syb:authors ;
-	rdfs:range xsd:string ;
-	rdfs:label "phone number" .
-
-syb:address a rdf:Property ;
-	rdfs:domain syb:authors ;
-	rdfs:range xsd:string ;
-	rdfs:label "address" .
-
-syb:city a rdf:Property ;
-	rdfs:domain syb:authors ;
-	rdfs:range xsd:string ;
-	rdfs:label "city" .
-
-syb:state a rdf:Property ;
-	rdfs:domain syb:authors ;
-	rdfs:range xsd:string ;
-	rdfs:label "state" .
-
-syb:country a rdf:Property ;
-	rdfs:domain syb:authors ;
-	rdfs:range xsd:string ;
-	rdfs:label "country" .
-
-syb:postalcode a rdf:Property ;
-	rdfs:domain syb:authors ;
-	rdfs:range xsd:string ;
-	rdfs:label "postalcode" .
-
-syb:stores a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
-	rdfs:label "stores" ;
-	rdfs:comment "Sybase Pubs2 stores table" .
-
-syb:stor_id a rdf:Property ;
-	rdfs:domain syb:stores ;
-	rdfs:range xsd:string ;
-	rdfs:label "store id" .
-
-syb:stor_name a rdf:Property ;
-	rdfs:domain syb:stores ;
-	rdfs:range xsd:string ;
-	rdfs:label "store name" .
-
-syb:stor_address a rdf:Property ;
-	rdfs:domain syb:stores ;
-	rdfs:range xsd:string ;
-	rdfs:label "store address" .
-
-syb:city a rdf:Property ;
-	rdfs:domain syb:stores ;
-	rdfs:range xsd:string ;
-	rdfs:label "city" .
-
-syb:state a rdf:Property ;
-	rdfs:domain syb:stores ;
-	rdfs:range xsd:string ;
-	rdfs:label "state" .
-
-syb:country a rdf:Property ;
-	rdfs:domain syb:stores ;
-	rdfs:range xsd:string ;
-	rdfs:label "country" .
-
-syb:postalcode a rdf:Property ;
-	rdfs:domain syb:stores ;
-	rdfs:range xsd:string ;
-	rdfs:label "postal code" .
-
-syb:payterms a rdf:Property ;
-	rdfs:domain syb:stores ;
-	rdfs:range xsd:string ;
-	rdfs:label "payment terms" .
-
-syb:au_pix a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
-	rdfs:label "authors pictures" ;
-	rdfs:comment "Sybase Pubs2 au_pix table" .
-
-syb:au_id a rdf:Property ;
-	rdfs:domain syb:au_pix ;
-	rdfs:range syb:authors ;
-	rdfs:label "author id" .
-
-syb:format_type a rdf:Property ;
-	rdfs:domain syb:au_pix ;
-	rdfs:range xsd:string ;
-	rdfs:label "format type" .
-
-syb:bytesize a rdf:Property ;
-	rdfs:domain syb:au_pix ;
-	rdfs:range xsd:integer ;
-	rdfs:label "byte size" .
-
-syb:pixwidth_hor a rdf:Property ;
-	rdfs:domain syb:au_pix ;
-	rdfs:range xsd:string ;
-	rdfs:label "picture horizontal width" .
-
-syb:pixwidth_vert a rdf:Property ;
-	rdfs:domain syb:au_pix ;
-	rdfs:range xsd:string ;
-	rdfs:label "picture vertical width" .
-
-syb:discounts a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
-	rdfs:label "discounts" ;
-	rdfs:comment "Sybase Pubs2 discount table" .
-
-syb:discounttype a rdf:Property ;
-	rdfs:domain syb:discounts ;
-	rdfs:range xsd:string ;
-	rdfs:label "discounttype" .
-
-syb:stor_id a rdf:Property ;
-	rdfs:domain syb:discounts ;
-	rdfs:range syb:stores ;
-	rdfs:label "store id" .
-
-syb:lowqty a rdf:Property ;
-	rdfs:domain syb:discounts ;
-	rdfs:range xsd:integer ;
-	rdfs:label "min quantity" .
-
-syb:highqty a rdf:Property ;
-	rdfs:domain syb:discounts ;
-	rdfs:range xsd:integer ;
-	rdfs:label "max quantity" .
-
-syb:discount a rdf:Property ;
-	rdfs:domain syb:discounts ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "min quantity" .
-
-syb:salesdetail a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
-	rdfs:label "sales details" ;
-	rdfs:comment "Sybase Pubs2 sales detail table" .
-
-syb:store_id a rdf:Property ;
-	rdfs:domain syb:salesdetail ;
-	rdfs:range syb:stores ;
-	rdfs:label "store id" .
-
-syb:ord_num a rdf:Property ;
-	rdfs:domain syb:salesdetail ;
-	rdfs:range syb:sales ;
-	rdfs:label "order number" .
-
-syb:title_id a rdf:Property ;
-	rdfs:domain syb:salesdetail ;
-	rdfs:range syb:titles ;
-	rdfs:label "title id" .
-
-syb:qty a rdf:Property ;
-	rdfs:domain syb:salesdetail ;
-	rdfs:range xsd:integer ;
-	rdfs:label "quantity" .
-
-syb:discount a rdf:Property ;
-	rdfs:domain syb:salesdetail ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "discount" .
-
-syb:publishers a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
-	rdfs:label "Publishers" ;
-	rdfs:comment "Sybase Pubs2 publishers table" .
-
-syb:pub_id a rdf:Property ;
-	rdfs:domain syb:publishers ;
-	rdfs:range xsd:string ;
-	rdfs:label "publisher id" .
-
-syb:pub_name a rdf:Property ;
-	rdfs:domain syb:publishers ;
-	rdfs:range xsd:string ;
-	rdfs:label "publisher name" .
-
-syb:city a rdf:Property ;
-	rdfs:domain syb:publishers ;
-	rdfs:range xsd:string ;
-	rdfs:label "city" .
-
-syb:state a rdf:Property ;
-	rdfs:domain syb:publishers ;
-	rdfs:range xsd:string ;
-	rdfs:label "state" .
-
-syb:titleauthor a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
-	rdfs:label "title author" ;
-	rdfs:comment "Sybase Pubs2 titleauthor table" .
-
-syb:au_id a rdf:Property ;
-	rdfs:domain syb:titleauthor ;
-	rdfs:range syb:authors ;
-	rdfs:label "author id" .
-
-syb:title_id a rdf:Property ;
-	rdfs:domain syb:titleauthor ;
-	rdfs:range syb:titles ;
-	rdfs:label "title id" .
-
-syb:au_ord a rdf:Property ;
-	rdfs:domain syb:titleauthor ;
-	rdfs:range xsd:integer ;
-	rdfs:label "author order" .
-
-syb:royaltyper a rdf:Property ;
-	rdfs:domain syb:titleauthor ;
-	rdfs:range xsd:integer ;
-	rdfs:label "royalty per book" .
-
-syb:roysched a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
-	rdfs:label "Royalty Schedule" ;
-	rdfs:comment "Sybase Pubs2 roysched table" .
-
-syb:title_id a rdf:Property ;
-	rdfs:domain syb:roysched ;
-	rdfs:range syb:titles ;
-	rdfs:label "title id" .
-
-syb:lorange a rdf:Property ;
-	rdfs:domain syb:roysched ;
-	rdfs:range xsd:integer ;
-	rdfs:label "low range" .
-
-syb:hirange a rdf:Property ;
-	rdfs:domain syb:roysched ;
-	rdfs:range xsd:integer ;
-	rdfs:label "high range" .
-
-syb:royalty a rdf:Property ;
-	rdfs:domain syb:roysched ;
-	rdfs:range xsd:integer ;
-	rdfs:label "royalty" .
-
-syb:sales a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
-	rdfs:label "Sales" ;
-	rdfs:comment "Sybase Pubs2 sales table" .
-
-syb:stor_id a rdf:Property ;
-	rdfs:domain syb:sales ;
-	rdfs:range xsd:string ;
-	rdfs:label "store id" .
-
-syb:ord_num a rdf:Property ;
-	rdfs:domain syb:sales ;
-	rdfs:range xsd:string ;
-	rdfs:label "order number" .
-
-syb:date a rdf:Property ;
-	rdfs:domain syb:sales ;
-	rdfs:range xsd:dateTime ;
-	rdfs:label "date" .
-', '', 'http://localhost:8890/schemas/sybasepubs2', 0);
-
----------------------------------------------------------------
-
------------ Create IRI Classes -------------
-
-SPARQL
-
-	create iri class <http://localhost:8890/schemas/sybasepubs2/titles_iri>
-	"http://^{URIQADefaultHost}^/sybasepubs2/titles/%s_%s#this"
-    	(in title_id varchar not null, in title varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/sybasepubs2/authors_iri>
-	"http://^{URIQADefaultHost}^/sybasepubs2/authors/%s#this"
-    	(in au_id varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/sybasepubs2/stores_iri>
-	"http://^{URIQADefaultHost}^/sybasepubs2/stores/%s#this"
-    	(in stor_id varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/sybasepubs2/au_pix_iri>
-	"http://^{URIQADefaultHost}^/sybasepubs2/au_pix/%s#this"
-    	(in au_id varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/sybasepubs2/discounts_iri>
-	"http://^{URIQADefaultHost}^/sybasepubs2/discounts/%s#this"
-    	(in discounttype varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/sybasepubs2/salesdetail_iri>
-	"http://^{URIQADefaultHost}^/sybasepubs2/salesdetail/%s_%s_%s#this"
-    	(in stor_id varchar not null, in ord_num varchar not null, in title_id varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/sybasepubs2/publishers_iri>
-	"http://^{URIQADefaultHost}^/sybasepubs2/publishers/%s#this"
-    	(in pub_id varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/sybasepubs2/titleauthor_iri>
-	"http://^{URIQADefaultHost}^/sybasepubs2/titleauthor/%s_%s#this"
-    	(in au_id varchar not null, in title_id varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/sybasepubs2/roysched_iri>
-	"http://^{URIQADefaultHost}^/sybasepubs2/roysched/%s#this"
-    	(in title_id varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/sybasepubs2/sales_iri>
-	"http://^{URIQADefaultHost}^/sybasepubs2/sales/%s_%s#this"
-    	(in stor_id varchar not null, in ord_num varchar not null) .
-
-;
-
---------------------------------------------------------------------
-
-------------- Create Quad Store ------------------------------------
-
-SPARQL
-
-prefix syb: <http://localhost:8890/schemas/sybasepubs2/>
-
-alter quad storage virtrdf:DefaultQuadStorage
-  from pubs2.syb.au_pix as au_pix_tbl
-  from pubs2.syb.authors as authors_tbl
-  from pubs2.syb.discounts as discounts_tbl
-  from pubs2.syb.publishers as publishers_tbl
-  from pubs2.syb.roysched as roysched_tbl
-  from pubs2.syb.sales as sales_tbl
-  from pubs2.syb.salesdetail as salesdetail_tbl
-  from pubs2.syb.stores as stores_tbl
-  from pubs2.syb.titleauthor as titleauthor_tbl
-  from pubs2.syb.titles as titles_tbl
-{
-  create virtrdf:sybasepubs2 as
-      graph <http://localhost:8890/sybasepubs2>
-  {
-	syb:au_pix_iri (au_pix_tbl.au_id) a syb:au_pix as virtrdf:au_pix_id;
-	syb:au_id au_pix_tbl.au_id as virtrdf:au_pix_au_id;
-	syb:format_type au_pix_tbl.format_type as virtrdf:au_pix_format_type;
-	syb:bytesize au_pix_tbl.bytesize as virtrdf:au_pix_bytesize;
-	syb:pixwidth_hor au_pix_tbl.pixwidth_hor as virtrdf:au_pix_pixwidth_hor;
-	syb:pixwidth_vert au_pix_tbl.pixwidth_vert as virtrdf:au_pix_pixwidth_vert ;
-       	syb:has_author syb:authors_iri(authors_tbl.au_id) where (^{authors_tbl.}^.au_id = ^{au_pix_tbl.}^.au_id) as virtrdf:au_pix_has_author .
-
-        syb:authors_iri (authors_tbl.au_id) a syb:authors as virtrdf:authors_pk ;
-	syb:au_id authors_tbl.au_id as virtrdf:authors_au_id;
-       	syb:au_lname authors_tbl.au_lname as virtrdf:authors_au_lname;
-       	syb:au_fname authors_tbl.au_fname as virtrdf:authors_au_fname;
-       	syb:phone authors_tbl.phone  as virtrdf:authors_phone;
-       	syb:address authors_tbl.address  as virtrdf:authors_address;
-       	syb:city authors_tbl.city as virtrdf:authors_city;
-       	syb:state authors_tbl.state  as virtrdf:authors_state;
-       	syb:country authors_tbl.country as virtrdf:authors_country;
-       	syb:postalcode authors_tbl.postalcode as virtrdf:authors_postalcode;
-      	syb:has_title syb:titleauthor_iri(titleauthor_tbl.au_id, titleauthor_tbl.title_id) where (^{titleauthor_tbl.}^.au_id = ^{authors_tbl.}^.au_id) as virtrdf:authors_has_title;
-      	syb:has_pix syb:au_pix_iri(au_pix_tbl.au_id) where (^{au_pix_tbl.}^.au_id = ^{authors_tbl.}^.au_id) as virtrdf:authors_has_pix .
-
-	syb:discounts_iri (discounts_tbl.stor_id) a syb:discounts as virtrdf:discounts_pk;
-	syb:discounttype discounts_tbl.discounttype as virtrdf:discounts_discounttype;
-	syb:stor_id syb:stores_iri(stores_tbl.stor_id) where (^{stores_tbl.}^.stor_id = ^{stores_tbl.}^.stor_id) as virtrdf:discounts_stor_id;
-	syb:lowqty discounts_tbl.lowqty as virtrdf:discounts_lowqty;
-	syb:highqty discounts_tbl.highqty as virtrdf:discounts_highqty;
-	syb:discount discounts_tbl.discount as virtrdf:discounts_discount .
-
-	syb:publishers_iri (publishers_tbl.pub_id) a syb:publishers as virtrdf:publishers_pk;
-	syb:pub_id syb:titles_iri(titles_tbl.title_id, titles_tbl.pub_id) where (^{titles_tbl.}^.pub_id = ^{titles_tbl.}^.pub_id) as virtrdf:publisherss_pub_id;
-	syb:pub_name publishers_tbl.pub_name as virtrdf:publisherss_pub_name;
-	syb:city publishers_tbl.city as virtrdf:publisherss_city;
-	syb:state publishers_tbl.state as virtrdf:publisherss_state .
-
-	syb:roysched_iri (roysched_tbl.title_id) a syb:roysched as virtrdf:roysched_pk;
-       	syb:title_id syb:titleauthor_iri(titleauthor_tbl.au_id, titleauthor_tbl.title_id) where (^{titleauthor_tbl.}^.title_id = ^{roysched_tbl.}^.title_id) as virtrdf:roysched_title_id;
-	syb:lorange roysched_tbl.lorange as virtrdf:roysched_lorange;
-	syb:hirange roysched_tbl.hirange as virtrdf:roysched_hirange;
-	syb:royalty roysched_tbl.royalty as virtrdf:roysched_royalty .
-
-	syb:sales_iri (sales_tbl.stor_id, sales_tbl.ord_num) a syb:sales as virtrdf:sales_pk;
-	syb:stor_id sales_tbl.stor_id as virtrdf:sales_stor_id;
-	syb:ord_num sales_tbl.ord_num as virtrdf:sales_ord_num;
-	syb:date sales_tbl.date as virtrdf:sales_date;
-       	syb:has_salesdetail syb:salesdetail_iri(salesdetail_tbl.stor_id, salesdetail_tbl.ord_num, salesdetail_tbl.title_id) where (^{salesdetail_tbl.}^.stor_id = ^{sales_tbl.}^.stor_id and ^{salesdetail_tbl.}^.ord_num = ^{sales_tbl.}^.ord_num)  as virtrdf:sales_has_salesdetail;
-       	syb:has_stores syb:stores_iri(stores_tbl.stor_id) where (^{stores_tbl.}^.stor_id = ^{sales_tbl.}^.stor_id)  as virtrdf:sales_has_stores .
-
-	syb:salesdetail_iri (salesdetail_tbl.stor_id, salesdetail_tbl.ord_num, salesdetail_tbl.title_id) a syb:salesdetail as virtrdf:salesdetail_pk;
-	syb:stor_id salesdetail_tbl.stor_id as virtrdf:salesdetail_stor_id;
-	syb:ord_num salesdetail_tbl.ord_num as virtrdf:salesdetail_ord_num;
-	syb:title_id salesdetail_tbl.title_id as virtrdf:salesdetail_title_id;
-	syb:qty salesdetail_tbl.qty as virtrdf:salesdeail_qty;
-	syb:discount salesdetail_tbl.discount as virtrdf:salesdetail_discount;
-	syb:has_title  syb:titles_iri (titles_tbl.title_id, titles_tbl.pub_id) where (^{titles_tbl.}^.title_id = ^{salesdetail_tbl.}^.title_id) as virtrdf:salesdetail_has_title;
-       	syb:has_sales syb:sales_iri(sales_tbl.stor_id, sales_tbl.ord_num) where (^{salesdetail_tbl.}^.stor_id = ^{sales_tbl.}^.stor_id and ^{salesdetail_tbl.}^.ord_num = ^{sales_tbl.}^.ord_num ) as virtrdf:salesdetail_has_sales .
-
-	syb:stores_iri (stores_tbl.stor_id) a syb:stores as virtrdf:stores_pk;
-       	syb:stor_id stores_tbl.stor_id as virtrdf:stores_stor_id;
-	syb:stor_name stores_tbl.stor_name as virtrdf:stores_stor_name;
-	syb:stor_address stores_tbl.stor_address as virtrdf:stores_stor_address;
-	syb:city stores_tbl.city as virtrdf:stores_city;
-	syb:state stores_tbl.state as virtrdf:stores_state;
-	syb:country stores_tbl.country as virtrdf:stores_country;
-	syb:postalcode stores_tbl.postalcode as virtrdf:stores_postalcode;
-	syb:payterms stores_tbl.payterms as virtrdf:stores_payterms;
-       	syb:has_sales syb:sales_iri(sales_tbl.stor_id, sales_tbl.ord_num) where (^{sales_tbl.}^.stor_id = ^{stores_tbl.}^.stor_id) as virtrdf:stores_has_sales .
-
-	syb:titleauthor_iri (titleauthor_tbl.au_id, titleauthor_tbl.title_id) a syb:titleauthor as virtrdf:titleauthor_pk;
-	syb:au_id titleauthor_tbl.au_id as virtrdf:titleauthor_au_id;
-	syb:title_id titleauthor_tbl.title_id as virtrdf:titleauthor_title_id;
-	syb:au_ord titleauthor_tbl.au_ord as virtrdf:titleauthor_au_ord;
-	syb:royaltyper titleauthor_tbl.royaltyper as virtrdf:titleauthor_royaltyper;
-	syb:has_author syb:authors_iri(authors_tbl.au_id) where (^{authors_tbl.}^.au_id = ^{titleauthor_tbl.}^.au_id) as virtrdf:titleauthor_has_author;
-	syb:has_titles syb:titles_iri(titles_tbl.title_id, titles_tbl.pub_id) where (^{titles_tbl.}^.title_id = ^{titleauthor_tbl.}^.title_id) as virtrdf:titleauthor_has_titles .
-
-	syb:titles_iri (titles_tbl.title_id, titles_tbl.pub_id) a syb:titles as virtrdf:titles_pk;
-	syb:title_id titles_tbl.title_id as virtrdf:titles_title_idd;
-	syb:title titles_tbl.title as virtrdf:titles_title;
-	syb:type titles_tbl.type as virtrdf:titles_type;
-	syb:pub_id titles_tbl.pub_id as virtrdf:titles_pub_id;
-	syb:price titles_tbl.price as virtrdf:titles_price;
-	syb:advance titles_tbl.advance as virtrdf:titles_advance;
-	syb:total_sales titles_tbl.total_sales as virtrdf:titles_total_sales;
-	syb:notes titles_tbl.notes as virtrdf:titles_notes;
-	syb:pubdate titles_tbl.pubdate as virtrdf:titles_pubdate;
-	syb:contract titles_tbl.contract as virtrdf:titles_contract;
-       	syb:has_titleauthor syb:titleauthor_iri(titleauthor_tbl.au_id, titleauthor_tbl.title_id) where (^{titleauthor_tbl.}^.title_id = ^{titles_tbl.}^.title_id) as virtrdf:titles_has_titleauthor;
-       	syb:has_salesdetail syb:salesdetail_iri (salesdetail_tbl.stor_id, salesdetail_tbl.ord_num, salesdetail_tbl.title_id) where (^{salesdetail_tbl.}^.title_id = ^{titles_tbl.}^.title_id) as virtrdf:titles_has_salesdetail .
-
-  } .
-} .
-;
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'sybasepubs2_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'sybasepubs2_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'sybasepubs2_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'sybasepubs2_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/sybasepubs2%%3E&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'sybasepubs2_rule_list1',
-    1,
-    vector (
-  	 	'sybasepubs2_rule1',
-  	 	'sybasepubs2_rule2'
-	  ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/sybasepubs2');
-
-VHOST_DEFINE (
-	lpath=>'/sybasepubs2',
-	ppath=>'/DAV/sybasepubs2/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'sybasepubs2_rule_list1')
-	);
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'sybase_schemas_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'sybase_schemas_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'sybase_schemas_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'sybase_schemas_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/sybasepubs2%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path','path','*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'sybase_schemas_rule_list1',
-    1,
-    vector (
-  	 	'sybase_schemas_rule1',
-  	 	'sybase_schemas_rule2'
-	  ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/schema/sybasepubs2');
-
-VHOST_DEFINE (
-	lpath=>'/schemas/sybasepubs2',
-	ppath=>'/DAV/schemas/sybasepubs2/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'sybase_schemas_rule_list1')
-	);
-
-DB.DBA.XML_SET_NS_DECL ('hr', 'http://^{URIQADefaultHost}^/schemas/sybasepubs2', 2);
-]]></programlisting>
-  </sect3>
-  <sect3 id="rdfviewsenterpr"><title>Examples</title>
-    <sect4 id="rdfviewsenterprtn">
-      <title>Virtuoso's Northwind based Demo Database (Tutorials variant) to RDF </title>
-<programlisting><![CDATA[
-use DB;
-
-DB.DBA.exec_no_error('UPDATE WS.WS.SYS_DAV_RES set RES_TYPE=\'image/jpeg\' where RES_FULL_PATH like \'/DAV/VAD/demo/sql/CAT%\'')
-;
-
-DB.DBA.exec_no_error('UPDATE WS.WS.SYS_DAV_RES set RES_TYPE=\'image/jpeg\' where RES_FULL_PATH like \'/DAV/VAD/demo/sql/EMP%\'')
-;
-
-GRANT SELECT ON "Demo"."demo"."Products" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Suppliers" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Shippers" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Categories" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Customers" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Employees" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Orders" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Order_Details" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Countries" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Provinces" TO "SPARQL";
-
-SPARQL
-prefix tut_northwind: <http://demo.openlinksw.com/schemas/tutorial/northwind#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-drop quad map graph iri("http://^{URIQADefaultHost}^/tutorial/Northwind") .
-;
-
-SPARQL
-prefix tut_northwind: <http://demo.openlinksw.com/schemas/tutorial/northwind#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-drop quad map virtrdf:TutorialNorthwindDemo .
-;
-
-create function DB.DBA.TUT_NORTHWIND_ID_TO_IRI(in _prefix varchar,in _id varchar)
-{
-  declare iri, uriqa_host any;
-  uriqa_host := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
-  iri := 'http://' || uriqa_host || '/tutorial/Northwind/' || _prefix || '/' || _id || '#this';
-  return sprintf ('http://%s/DAV/VAD/tutorial/rdfview/rd_v_1/RDFData/All/iid%%20(%d).rdf', uriqa_host, iri_id_num (iri_to_id (iri)));
-}
-;
-
-create function DB.DBA.TUT_NORTHWIND_IRI_TO_ID(in _iri varchar)
-{
-    declare parts any;
-    parts := sprintf_inverse (_iri, 'http://%s/DAV/VAD/tutorial/rdfview/rd_v_1/RDFData/All/iid (%d).rdf', 1 );
-    if (parts is not null)
-    {
-        declare uriqa_host, iri any;
-        uriqa_host := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
-        if (parts[0] = uriqa_host)
-        {
-            iri := id_to_iri(iri_id_from_num(parts[1]));
-            parts := sprintf_inverse (iri, 'http://%s/tutorial/Northwind/%s/%s#this', 1 );
-            if (parts[0] = uriqa_host)
-            {
-                return parts[2];
-            }
-        }
-    }
-    return NULL;
-}
-;
-
-create function DB.DBA.TUT_CATEGORY_IRI (in _id integer) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('Category', cast(_id as varchar));
-}
-;
-
-create function DB.DBA.TUT_CATEGORY_IRI_INVERSE (in _iri varchar) returns integer
-{
-    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
-};
-
-create function DB.DBA.TUT_SHIPPER_IRI (in _id integer) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('Shipper', cast(_id as varchar));
-}
-;
-
-create function DB.DBA.TUT_SHIPPER_IRI_INVERSE (in _iri varchar) returns integer
-{
-    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
-};
-
-create function DB.DBA.TUT_SUPPLIER_IRI (in _id integer) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('Supplier', cast(_id as varchar));
-}
-;
-
-create function DB.DBA.TUT_SUPPLIER_IRI_INVERSE (in _iri varchar) returns integer
-{
-    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
-};
-
-create function DB.DBA.TUT_PRODUCT_IRI (in _id integer) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('Product', cast(_id as varchar));
-}
-;
-
-create function DB.DBA.TUT_PRODUCT_IRI_INVERSE (in _iri varchar) returns integer
-{
-    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
-};
-
-create function DB.DBA.TUT_CUSTOMER_IRI (in _id varchar) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('Customer', _id);
-}
-;
-
-create function DB.DBA.TUT_CUSTOMER_IRI_INVERSE (in _iri varchar) returns varchar
-{
-    return DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri);
-};
-
-create function DB.DBA.TUT_EMPLOYEE_IRI (in _id integer) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('Employee', cast(_id as varchar));
-}
-;
-
-create function DB.DBA.TUT_EMPLOYEE_IRI_INVERSE (in _iri varchar) returns integer
-{
-    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
-};
-
-create function DB.DBA.TUT_ORDER_IRI (in _id integer) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('Order', cast(_id as varchar));
-}
-;
-
-create function DB.DBA.TUT_ORDER_IRI_INVERSE (in _iri varchar) returns integer
-{
-    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
-};
-
-create function DB.DBA.TUT_CUSTOMERCONTACT_IRI (in _id integer) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('CustomerContact', cast(_id as varchar));
-}
-;
-
-create function DB.DBA.TUT_CUSTOMERCONTACT_IRI_INVERSE (in _iri varchar) returns integer
-{
-    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
-};
-
-create function DB.DBA.TUT_ORDERLINE_IRI (in _id1 integer, in _id2 integer) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('OrderLine', sprintf('%d/%d', _id1, _id2));
-}
-;
-
-create function DB.DBA.TUT_ORDERLINE_IRI_INV_1 (in _iri varchar) returns integer
-{
-    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
-};
-
-create function DB.DBA.TUT_ORDERLINE_IRI_INV_2 (in _iri varchar) returns integer
-{
-    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
-};
-
-
-create function DB.DBA.TUT_PROVINCE_IRI (in _id1 varchar, in _id2 varchar) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('Province', sprintf('%s/%s', _id1, _id2));
-}
-;
-
-create function DB.DBA.TUT_PROVINCE_IRI_INV_1 (in _iri varchar) returns varchar
-{
-    return DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri);
-};
-
-create function DB.DBA.TUT_PROVINCE_IRI_INV_2 (in _iri varchar) returns varchar
-{
-    return DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri);
-};
-
-create function DB.DBA.TUT_COUNTRY_IRI (in _id varchar) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('Country', _id);
-}
-;
-
-create function DB.DBA.TUT_COUNTRY_IRI_INVERSE (in _iri varchar) returns varchar
-{
-    return DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri);
-};
-
-create function DB.DBA.TUT_FLAG_IRI (in _id varchar) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('Flag', _id);
-}
-;
-
-create function DB.DBA.TUT_FLAG_IRI_INVERSE (in _iri varchar) returns varchar
-{
-    return DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri);
-};
-
-create function DB.DBA.TUT_EMPLOYEEPHOTO_IRI (in _id integer) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('EmployeePhoto', cast(_id as varchar));
-}
-;
-
-create function DB.DBA.TUT_EMPLOYEEPHOTO_IRI_INVERSE (in _iri varchar) returns integer
-{
-    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
-};
-
-create function DB.DBA.TUT_CATEGORYPHOTO_IRI (in _id integer) returns varchar
-{
-    return TUT_NORTHWIND_ID_TO_IRI('CategoryPhoto', cast(_id as varchar));
-}
-;
-
-create function DB.DBA.TUT_CATEGORYPHOTO_IRI_INVERSE (in _iri varchar) returns integer
-{
-    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
-};
-
-grant execute on DB.DBA.TUT_CATEGORY_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_CATEGORY_IRI_INVERSE to "SPARQL";
-grant execute on DB.DBA.TUT_SHIPPER_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_SHIPPER_IRI_INVERSE to "SPARQL";
-grant execute on DB.DBA.TUT_SUPPLIER_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_SUPPLIER_IRI_INVERSE to "SPARQL";
-grant execute on DB.DBA.TUT_PRODUCT_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_PRODUCT_IRI_INVERSE to "SPARQL";
-grant execute on DB.DBA.TUT_CUSTOMER_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_CUSTOMER_IRI_INVERSE to "SPARQL";
-grant execute on DB.DBA.TUT_EMPLOYEE_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_EMPLOYEE_IRI_INVERSE to "SPARQL";
-grant execute on DB.DBA.TUT_ORDER_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_ORDER_IRI_INVERSE to "SPARQL";
-grant execute on DB.DBA.TUT_CUSTOMERCONTACT_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_CUSTOMERCONTACT_IRI_INVERSE to "SPARQL";
-grant execute on DB.DBA.TUT_ORDERLINE_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_ORDERLINE_IRI_INV_1 to "SPARQL";
-grant execute on DB.DBA.TUT_ORDERLINE_IRI_INV_2 to "SPARQL";
-grant execute on DB.DBA.TUT_PROVINCE_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_PROVINCE_IRI_INV_1 to "SPARQL";
-grant execute on DB.DBA.TUT_PROVINCE_IRI_INV_2 to "SPARQL";
-grant execute on DB.DBA.TUT_COUNTRY_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_COUNTRY_IRI_INVERSE to "SPARQL";
-grant execute on DB.DBA.TUT_FLAG_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_FLAG_IRI_INVERSE to "SPARQL";
-grant execute on DB.DBA.TUT_EMPLOYEEPHOTO_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_EMPLOYEEPHOTO_IRI_INVERSE to "SPARQL";
-grant execute on DB.DBA.TUT_CATEGORYPHOTO_IRI to "SPARQL";
-grant execute on DB.DBA.TUT_CATEGORYPHOTO_IRI_INVERSE to "SPARQL";
-
-SPARQL
-prefix tut_northwind: <http://demo.openlinksw.com/schemas/tutorial/northwind#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-create iri class tut_northwind:Category "http://^{URIQADefaultHost}^/tutorial/Northwind/Category/%d#this" (in category_id integer not null) .
-create iri class tut_northwind:Shipper "http://^{URIQADefaultHost}^/tutorial/Northwind/Shipper/%d#this" (in shipper_id integer not null) .
-create iri class tut_northwind:Supplier "http://^{URIQADefaultHost}^/tutorial/Northwind/Supplier/%d#this" (in supplier_id integer not null) .
-create iri class tut_northwind:Product   "http://^{URIQADefaultHost}^/tutorial/Northwind/Product/%d#this" (in product_id integer not null) .
-create iri class tut_northwind:Customer "http://^{URIQADefaultHost}^/tutorial/Northwind/Customer/%U#this" (in customer_id varchar not null) .
-create iri class tut_northwind:Employee "http://^{URIQADefaultHost}^/tutorial/Northwind/Employee/%U%U%d#this" (in employee_firstname varchar not null, in employee_lastname varchar not null, in employee_id integer not null) .
-create iri class tut_northwind:Order "http://^{URIQADefaultHost}^/tutorial/Northwind/Order/%d#this" (in order_id integer not null) .
-create iri class tut_northwind:CustomerContact "http://^{URIQADefaultHost}^/tutorial/Northwind/CustomerContact/%U#this" (in customer_id varchar not null) .
-create iri class tut_northwind:OrderLine "http://^{URIQADefaultHost}^/tutorial/Northwind/OrderLine/%d/%d#this" (in order_id integer not null, in product_id integer not null) .
-create iri class tut_northwind:Province "http://^{URIQADefaultHost}^/tutorial/Northwind/Province/%U/%U#this" (in country_name varchar not null, in province_name varchar not null) .
-create iri class tut_northwind:Country "http://^{URIQADefaultHost}^/tutorial/Northwind/Country/%U#this" (in country_name varchar not null) .
-create iri class tut_northwind:Flag "http://^{URIQADefaultHost}^%U#this" (in flag_path varchar not null) .
-create iri class tut_northwind:dbpedia_iri "http://dbpedia.org/resource/%U" (in uname varchar not null) .
-create iri class tut_northwind:EmployeePhoto "http://^{URIQADefaultHost}^/DAV/VAD/demo/sql/EMP%d#this" (in emp_id varchar not null) .
-create iri class tut_northwind:CategoryPhoto "http://^{URIQADefaultHost}^/DAV/VAD/demo/sql/CAT%d#this" (in category_id varchar not null) .
-;
-
-SPARQL
-prefix tut_northwind: <http://demo.openlinksw.com/schemas/tutorial/northwind#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-create iri class tut_northwind:customercontact_iri using
-    function DB.DBA.TUT_CUSTOMERCONTACT_IRI (in customer_id varchar) returns varchar,
-    function DB.DBA.TUT_CUSTOMERCONTACT_IRI_INVERSE (in customer_iri varchar) returns varchar.
-create iri class tut_northwind:category_iri using
-    function DB.DBA.TUT_CATEGORY_IRI (in customer_id integer) returns varchar,
-    function DB.DBA.TUT_CATEGORY_IRI_INVERSE (in customer_iri varchar) returns integer.
-create iri class tut_northwind:shipper_iri using
-    function DB.DBA.TUT_SHIPPER_IRI (in customer_id integer) returns varchar,
-    function DB.DBA.TUT_SHIPPER_IRI_INVERSE (in customer_iri varchar) returns integer.
-create iri class tut_northwind:supplier_iri using
-    function DB.DBA.TUT_SUPPLIER_IRI (in customer_id varchar) returns varchar,
-    function DB.DBA.TUT_SUPPLIER_IRI_INVERSE (in customer_iri varchar) returns varchar.
-create iri class tut_northwind:product_iri using
-    function DB.DBA.TUT_PRODUCT_IRI (in customer_id integer) returns varchar,
-    function DB.DBA.TUT_PRODUCT_IRI_INVERSE (in customer_iri varchar) returns integer.
-create iri class tut_northwind:customer_iri using
-    function DB.DBA.TUT_CUSTOMER_IRI (in customer_id varchar) returns varchar,
-    function DB.DBA.TUT_CUSTOMER_IRI_INVERSE (in customer_iri varchar) returns varchar.
-create iri class tut_northwind:employee_iri using
-    function DB.DBA.TUT_EMPLOYEE_IRI (in customer_id integer) returns varchar,
-    function DB.DBA.TUT_EMPLOYEE_IRI_INVERSE (in customer_iri varchar) returns integer.
-create iri class tut_northwind:order_iri using
-    function DB.DBA.TUT_ORDER_IRI (in customer_id integer) returns varchar,
-    function DB.DBA.TUT_ORDER_IRI_INVERSE (in customer_iri varchar) returns integer.
-create iri class tut_northwind:orderline_iri using
-    function DB.DBA.TUT_ORDERLINE_IRI (in customer_id integer, in customer_id2 integer) returns varchar,
-    function DB.DBA.TUT_ORDERLINE_IRI_INV_1 (in customer_iri varchar) returns integer,
-    function DB.DBA.TUT_ORDERLINE_IRI_INV_2 (in customer_iri varchar) returns integer.
-create iri class tut_northwind:province_iri using
-    function DB.DBA.TUT_PROVINCE_IRI (in customer_id varchar, in customer_id2 varchar) returns varchar,
-    function DB.DBA.TUT_PROVINCE_IRI_INV_1 (in customer_iri varchar) returns varchar,
-    function DB.DBA.TUT_PROVINCE_IRI_INV_2 (in customer_iri varchar) returns varchar.
-create iri class tut_northwind:country_iri using
-    function DB.DBA.TUT_COUNTRY_IRI (in customer_id varchar) returns varchar,
-    function DB.DBA.TUT_COUNTRY_IRI_INVERSE (in customer_iri varchar) returns varchar.
-create iri class tut_northwind:employeephoto_iri using
-    function DB.DBA.TUT_EMPLOYEEPHOTO_IRI (in customer_id integer) returns varchar,
-    function DB.DBA.TUT_EMPLOYEEPHOTO_IRI_INVERSE (in customer_iri varchar) returns integer.
-create iri class tut_northwind:categoryphoto_iri using
-    function DB.DBA.TUT_CATEGORYPHOTO_IRI (in customer_id integer) returns varchar,
-    function DB.DBA.TUT_CATEGORYPHOTO_IRI_INVERSE (in customer_iri varchar) returns integer.
-create iri class tut_northwind:flag_iri using
-    function DB.DBA.TUT_FLAG_IRI (in customer_id varchar) returns varchar,
-    function DB.DBA.TUT_FLAG_IRI_INVERSE (in customer_iri varchar) returns varchar.
-;
-
-SPARQL
-prefix tut_northwind: <http://demo.openlinksw.com/schemas/tutorial/northwind#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-alter quad storage virtrdf:DefaultQuadStorage
-from Demo.demo.Products as products
-from Demo.demo.Suppliers as suppliers
-from Demo.demo.Shippers as shippers
-from Demo.demo.Categories as categories
-from Demo.demo.Customers as customers
-from Demo.demo.Employees as employees
-from Demo.demo.Orders as orders
-from Demo.demo.Order_Details as order_lines
-from Demo.demo.Countries as countries
-from Demo.demo.Provinces as provinces
-where (^{suppliers.}^.Country = ^{countries.}^.Name)
-where (^{customers.}^.Country = ^{countries.}^.Name)
-where (^{employees.}^.Country = ^{countries.}^.Name)
-where (^{orders.}^.ShipCountry = ^{countries.}^.Name)
-{
-        create virtrdf:TutorialNorthwindDemo as graph iri ("http://^{URIQADefaultHost}^/tutorial/Northwind") option (exclusive)
-        {
-                tut_northwind:CustomerContact (customers.CustomerID)
-                        a foaf:Person
-                                as virtrdf:tutCustomerContact-foaf_Person .
-
-                tut_northwind:CustomerContact (customers.CustomerID)
-                        a tut_northwind:CustomerContact
-                                as virtrdf:tutCustomerContact-CustomerContact;
-                        foaf:name customers.ContactName
-                                as virtrdf:tutCustomerContact-contact_name ;
-                        foaf:phone customers.Phone
-                                as virtrdf:tutCustomerContact-foaf_phone ;
-                        tut_northwind:is_contact_at tut_northwind:Customer (customers.CustomerID)
-                                as virtrdf:tutCustomerContact-is_contact_at ;
-                        tut_northwind:country tut_northwind:Country (customers.Country)
-                                as virtrdf:tutCustomerContact-country ;
-                        rdfs:isDefinedBy tut_northwind:customercontact_iri (customers.CustomerID) ;
-                        rdfs:isDefinedBy tut_northwind:CustomerContact (customers.CustomerID) .
-
-                tut_northwind:Country (customers.Country)
-                        tut_northwind:is_country_of
-                tut_northwind:CustomerContact (customers.CustomerID) as virtrdf:tutCustomerContact-is_country_of .
-
-                tut_northwind:Product (products.ProductID)
-                        a tut_northwind:Product
-                                as virtrdf:tutProduct-ProductID ;
-                        tut_northwind:has_category tut_northwind:Category (products.CategoryID)
-                                as virtrdf:tutProduct-product_has_category ;
-                        tut_northwind:has_supplier tut_northwind:Supplier (products.SupplierID)
-                                as virtrdf:tutProduct-product_has_supplier ;
-                        tut_northwind:productName products.ProductName
-                                as virtrdf:tutProduct-name_of_product ;
-                        tut_northwind:quantityPerUnit products.QuantityPerUnit
-                                as virtrdf:tutProduct-quantity_per_unit ;
-                        tut_northwind:unitPrice products.UnitPrice
-                                as virtrdf:tutProduct-unit_price ;
-                        tut_northwind:unitsInStock products.UnitsInStock
-                                as virtrdf:tutProduct-units_in_stock ;
-                        tut_northwind:unitsOnOrder products.UnitsOnOrder
-                                as virtrdf:tutProduct-units_on_order ;
-                        tut_northwind:reorderLevel products.ReorderLevel
-                                as virtrdf:tutProduct-reorder_level ;
-                        tut_northwind:discontinued products.Discontinued
-                                as virtrdf:tutProduct-discontinued ;
-                        rdfs:isDefinedBy tut_northwind:product_iri (products.ProductID) ;
-                        rdfs:isDefinedBy tut_northwind:Product (products.ProductID).
-
-                tut_northwind:Category (products.CategoryID)
-                        tut_northwind:category_of tut_northwind:Product (products.ProductID) as virtrdf:tutProduct-category_of .
-
-                tut_northwind:Supplier (products.SupplierID)
-                        tut_northwind:supplier_of tut_northwind:Product (products.ProductID) as virtrdf:tutProduct-supplier_of .
-
-                tut_northwind:Supplier (suppliers.SupplierID)
-                        a tut_northwind:Supplier
-                                as virtrdf:tutSupplier-SupplierID ;
-                        tut_northwind:companyName suppliers.CompanyName
-                                as virtrdf:tutSupplier-company_name ;
-                        tut_northwind:contactName suppliers.ContactName
-                                as virtrdf:tutSupplier-contact_name ;
-                        tut_northwind:contactTitle suppliers.ContactTitle
-                                as virtrdf:tutSupplier-contact_title ;
-                        tut_northwind:address suppliers.Address
-                                as virtrdf:tutSupplier-address ;
-                        tut_northwind:city suppliers.City
-                                as virtrdf:tutSupplier-city ;
-                        tut_northwind:dbpedia_city tut_northwind:dbpedia_iri(suppliers.City)
-                                as virtrdf:tutSupplier-dbpedia_city ;
-                        tut_northwind:region suppliers.Region
-                                as virtrdf:tutSupplier-region ;
-                        tut_northwind:postalCode suppliers.PostalCode
-                                as virtrdf:tutSupplier-postal_code ;
-                        tut_northwind:country tut_northwind:Country(suppliers.Country)
-                                as virtrdf:tutSupplier-country ;
-                        tut_northwind:phone suppliers.Phone
-                                as virtrdf:tutSupplier-phone ;
-                        tut_northwind:fax suppliers.Fax
-                                as virtrdf:tutSupplier-fax ;
-                        tut_northwind:homePage suppliers.HomePage
-                                as virtrdf:tutSupplier-home_page ;
-                        rdfs:isDefinedBy tut_northwind:supplier_iri (suppliers.SupplierID) ;
-                        rdfs:isDefinedBy tut_northwind:Supplier (suppliers.SupplierID).
-
-                tut_northwind:Country (suppliers.Country)
-                        tut_northwind:is_country_of
-                tut_northwind:Supplier (suppliers.SupplierID) as virtrdf:tutSupplier-is_country_of .
-
-                tut_northwind:Category (categories.CategoryID)
-                        a tut_northwind:Category
-                                as virtrdf:tutCategory-CategoryID ;
-                        tut_northwind:categoryName categories.CategoryName
-                                as virtrdf:tutCategory-home_page ;
-                        tut_northwind:description categories.Description
-                                as virtrdf:tutCategory-description ;
-                        foaf:img tut_northwind:CategoryPhoto(categories.CategoryID)
-                                as virtrdf:tutCategory-categories.CategoryPhoto ;
-                        rdfs:isDefinedBy tut_northwind:category_iri (categories.CategoryID) ;
-                        rdfs:isDefinedBy tut_northwind:Category (categories.CategoryID).
-
-                tut_northwind:CategoryPhoto(categories.CategoryID)
-                        a tut_northwind:CategoryPhoto
-                                as virtrdf:tutCategory-categories.CategoryPhotoID ;
-                        rdfs:isDefinedBy tut_northwind:categoryphoto_iri (categories.CategoryID) ;
-                        rdfs:isDefinedBy tut_northwind:CategoryPhoto(categories.CategoryID).
-
-                tut_northwind:Shipper (shippers.ShipperID)
-                        a tut_northwind:Shipper
-                                as virtrdf:tutShipper-ShipperID ;
-                        tut_northwind:companyName shippers.CompanyName
-                                as virtrdf:tutShipper-company_name ;
-                        tut_northwind:phone shippers.Phone
-                                as virtrdf:tutShipper-phone ;
-                        rdfs:isDefinedBy tut_northwind:shipper_iri (shippers.ShipperID) ;
-                        rdfs:isDefinedBy tut_northwind:Shipper (shippers.ShipperID).
-
-                tut_northwind:Customer (customers.CustomerID)
-                        a  tut_northwind:Customer
-                                as virtrdf:tutCustomer-CustomerID2 ;
-                        a  foaf:Organization
-                                as virtrdf:tutCustomer-CustomerID ;
-                        foaf:name customers.CompanyName
-                                as virtrdf:tutCustomer-foaf_name ;
-                        tut_northwind:companyName customers.CompanyName
-                                as virtrdf:tutCustomer-company_name ;
-                        tut_northwind:has_contact tut_northwind:CustomerContact (customers.CustomerID)
-                                as virtrdf:tutCustomer-contact ;
-                        tut_northwind:country tut_northwind:Country (customers.Country)
-                                as virtrdf:tutCustomer-country ;
-                        tut_northwind:contactName customers.ContactName
-                                as virtrdf:tutCustomer-contact_name ;
-                        tut_northwind:contactTitle customers.ContactTitle
-                                as virtrdf:tutCustomer-contact_title ;
-                        tut_northwind:address customers.Address
-                                as virtrdf:tutCustomer-address ;
-                        tut_northwind:city customers.City
-                                as virtrdf:tutCustomer-city ;
-                        tut_northwind:dbpedia_city tut_northwind:dbpedia_iri(customers.City)
-                                as virtrdf:tutCustomer-dbpedia_city ;
-                        tut_northwind:region customers.Region
-                                as virtrdf:tutCustomer-region ;
-                        tut_northwind:PostalCode customers.PostalCode
-                                as virtrdf:tutCustomer-postal_code ;
-                        foaf:phone customers.Phone
-                                as virtrdf:tutCustomer-foaf_phone ;
-                        tut_northwind:phone customers.Phone
-                                as virtrdf:tutCustomer-phone ;
-                        tut_northwind:fax customers.Fax
-                                as virtrdf:tutCustomer-fax ;
-                        rdfs:isDefinedBy tut_northwind:customer_iri (customers.CustomerID) ;
-                        rdfs:isDefinedBy tut_northwind:Customer (customers.CustomerID).
-
-                tut_northwind:Country (customers.Country)
-                        tut_northwind:is_country_of
-                tut_northwind:Customer (customers.CustomerID) as virtrdf:tutCustomer-is_country_of .
-
-                tut_northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID)
-                        a tut_northwind:Employee
-                                as virtrdf:tutEmployee-EmployeeID2 ;
-                        a foaf:Person
-                                as virtrdf:tutEmployee-EmployeeID ;
-                        foaf:surname employees.LastName
-                                as virtrdf:tutEmployee-foaf_last_name ;
-                        tut_northwind:lastName employees.LastName
-                                as virtrdf:tutEmployee-last_name ;
-                        foaf:firstName employees.FirstName
-                                as virtrdf:tutEmployee-foaf_first_name ;
-                        tut_northwind:firstName employees.FirstName
-                                as virtrdf:tutEmployee-first_name ;
-                        foaf:title employees.Title
-                                as virtrdf:tutEmployee-title ;
-                        tut_northwind:titleOfCourtesy employees.TitleOfCourtesy
-                                as virtrdf:tutEmployee-title_of_courtesy ;
-                        foaf:birthday employees.BirthDate
-                                as virtrdf:tutEmployee-foaf_birth_date ;
-                        tut_northwind:birthday employees.BirthDate
-                                as virtrdf:tutEmployee-birth_date ;
-                        tut_northwind:hireDate employees.HireDate
-                                as virtrdf:tutEmployee-hire_date ;
-                        tut_northwind:address employees.Address
-                                as virtrdf:tutEmployee-address ;
-                        tut_northwind:city employees.City
-                                as virtrdf:tutEmployee-city ;
-                        tut_northwind:dbpedia_city tut_northwind:dbpedia_iri(employees.City)
-                                as virtrdf:tutEmployee-dbpedia_city ;
-                        tut_northwind:region employees.Region
-                                as virtrdf:tutEmployee-region ;
-                        tut_northwind:postalCode employees.PostalCode
-                                as virtrdf:tutEmployee-postal_code ;
-                        tut_northwind:country tut_northwind:Country (employees.Country)
-                                as virtrdf:tutEmployee-country ;
-                        foaf:phone employees.HomePhone
-                                as virtrdf:tutEmployee-home_phone ;
-                        tut_northwind:extension employees.Extension
-                                as virtrdf:tutEmployee-extension ;
-                        tut_northwind:notes employees.Notes
-                                as virtrdf:tutEmployee-notes ;
-                        tut_northwind:reportsTo tut_northwind:Employee(employees.FirstName, employees.LastName, employees.ReportsTo) where (^{employees.}^.ReportsTo = ^{employees.}^.EmployeeID)
-                                as virtrdf:tutEmployee-reports_to ;
-                        foaf:img tut_northwind:EmployeePhoto(employees.EmployeeID)
-                                as virtrdf:tutEmployee-employees.EmployeePhoto ;
-                        rdfs:isDefinedBy tut_northwind:employee_iri (employees.EmployeeID) ;
-                        rdfs:isDefinedBy tut_northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID).
-
-                tut_northwind:EmployeePhoto(employees.EmployeeID)
-                        a tut_northwind:EmployeePhoto
-                                as virtrdf:tut_Employee-employees.EmployeePhotoId ;
-                        rdfs:isDefinedBy tut_northwind:employeephoto_iri (employees.EmployeeID) ;
-                        rdfs:isDefinedBy tut_northwind:EmployeePhoto (employees.EmployeeID).
-
-                tut_northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID)
-                        tut_northwind:is_salesrep_of
-                tut_northwind:Order (orders.OrderID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID) as virtrdf:tutOrder-is_salesrep_of .
-
-                tut_northwind:Country (employees.Country)
-                        tut_northwind:is_country_of
-                tut_northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID) as virtrdf:tutEmployee-is_country_of .
-
-                tut_northwind:Order (orders.OrderID)
-                        a tut_northwind:Order
-                                as virtrdf:tutOrder-Order ;
-                        tut_northwind:has_customer tut_northwind:Customer (orders.CustomerID)
-                                as virtrdf:tutOrder-order_has_customer ;
-                        tut_northwind:has_salesrep tut_northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID)
-                                as virtrdf:tutCustomer-has_salesrep ;
-                        tut_northwind:has_employee tut_northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID)
-                                as virtrdf:tutOrder-order_has_employee ;
-                        tut_northwind:orderDate orders.OrderDate
-                                as virtrdf:tutOrder-order_date ;
-                        tut_northwind:requiredDate orders.RequiredDate
-                                as virtrdf:tutOrder-required_date ;
-                        tut_northwind:shippedDate orders.ShippedDate
-                                as virtrdf:tutOrder-shipped_date ;
-                        tut_northwind:order_ship_via tut_northwind:Shipper (orders.ShipVia)
-                                as virtrdf:tutOrder-order_ship_via ;
-                        tut_northwind:freight orders.Freight
-                                as virtrdf:tutOrder-freight ;
-                        tut_northwind:shipName orders.ShipName
-                                as virtrdf:tutOrder-ship_name ;
-                        tut_northwind:shipAddress orders.ShipAddress
-                                as virtrdf:tutOrder-ship_address ;
-                        tut_northwind:shipCity orders.ShipCity
-                                as virtrdf:tutOrder-ship_city ;
-                        tut_northwind:dbpedia_shipCity tut_northwind:dbpedia_iri(orders.ShipCity)
-                                as virtrdf:tutOrder-ship_dbpedia_city ;
-                        tut_northwind:shipRegion orders.ShipRegion
-                                as virtrdf:tutOrder-ship_region ;
-                        tut_northwind:shipPostal_code orders.ShipPostalCode
-                                as virtrdf:tutOrder-ship_postal_code ;
-                        tut_northwind:shipCountry tut_northwind:Country(orders.ShipCountry)
-                                as virtrdf:tutship_country ;
-                        rdfs:isDefinedBy tut_northwind:order_iri (orders.OrderID) ;
-                        rdfs:isDefinedBy tut_northwind:Order (orders.OrderID).
-
-                tut_northwind:Country (orders.ShipCountry)
-                        tut_northwind:is_ship_country_of
-                tut_northwind:Order (orders.OrderID) as virtrdf:tutOrder-is_country_of .
-
-                tut_northwind:Customer (orders.CustomerID)
-                        tut_northwind:has_order tut_northwind:Order (orders.OrderID) as virtrdf:tutOrder-has_order .
-
-                tut_northwind:Shipper (orders.ShipVia)
-                        tut_northwind:ship_order tut_northwind:Order (orders.OrderID) as virtrdf:tutOrder-ship_order .
-
-                tut_northwind:OrderLine (order_lines.OrderID, order_lines.ProductID)
-                        a tut_northwind:OrderLine
-                                as virtrdf:tutOrderLine-OrderLines ;
-                        tut_northwind:has_order_id tut_northwind:Order (order_lines.OrderID)
-                                as virtrdf:tutorder_lines_has_order_id ;
-                        tut_northwind:has_product_id tut_northwind:Product (order_lines.ProductID)
-                                as virtrdf:tutorder_lines_has_product_id ;
-                        tut_northwind:unitPrice order_lines.UnitPrice
-                                as virtrdf:tutOrderLine-unit_price ;
-                        tut_northwind:quantity order_lines.Quantity
-                                as virtrdf:tutOrderLine-quantity ;
-                        tut_northwind:discount order_lines.Discount
-                                as virtrdf:tutOrderLine-discount ;
-                        rdfs:isDefinedBy tut_northwind:orderline_iri (order_lines.OrderID, order_lines.ProductID) ;
-                        rdfs:isDefinedBy tut_northwind:OrderLine (order_lines.OrderID, order_lines.ProductID).
-
-                tut_northwind:Order (orders.OrderID)
-                        tut_northwind:is_order_of
-                tut_northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) where (^{orders.}^.OrderID = ^{order_lines.}^.OrderID) as virtrdf:tutOrder-is_order_of .
-
-                tut_northwind:Product (products.ProductID)
-                        tut_northwind:is_product_of
-                tut_northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) where (^{products.}^.ProductID = ^{order_lines.}^.ProductID) as virtrdf:tutProduct-is_product_of .
-
-                tut_northwind:Country (countries.Name)
-                        a tut_northwind:Country
-                                as virtrdf:tutCountry-Type2 ;
-                        a wgs:SpatialThing
-                                as virtrdf:tutCountry-Type ;
-                        owl:sameAs tut_northwind:dbpedia_iri (countries.Name) ;
-                        tut_northwind:name countries.Name
-                                as virtrdf:tutCountry-Name ;
-                        tut_northwind:code countries.Code
-                                as virtrdf:tutCountry-Code ;
-                        tut_northwind:smallFlagDAVResourceName countries.SmallFlagDAVResourceName
-                                as virtrdf:tutCountry-SmallFlagDAVResourceName ;
-                        tut_northwind:largeFlagDAVResourceName countries.LargeFlagDAVResourceName
-                                as virtrdf:tutCountry-LargeFlagDAVResourceName ;
-                        tut_northwind:smallFlagDAVResourceURI tut_northwind:Flag(countries.SmallFlagDAVResourceURI)
-                                as virtrdf:tutCountry-SmallFlagDAVResourceURI ;
-                        tut_northwind:largeFlagDAVResourceURI tut_northwind:Flag(countries.LargeFlagDAVResourceURI)
-                                as virtrdf:tutCountry-LargeFlagDAVResourceURI ;
-                        wgs:lat countries.Lat
-                                as virtrdf:tutCountry-Lat ;
-                        wgs:long countries.Lng
-                                as virtrdf:tutCountry-Lng ;
-                        rdfs:isDefinedBy tut_northwind:country_iri (countries.Name) ;
-                        rdfs:isDefinedBy tut_northwind:Country (countries.Name).
-
-                tut_northwind:Country (countries.Name)
-                        tut_northwind:has_province
-                tut_northwind:Province (provinces.CountryCode, provinces.Province) where (^{provinces.}^.CountryCode = ^{countries.}^.Code) as virtrdf:tutCountry-has_province .
-
-                tut_northwind:Province (provinces.CountryCode, provinces.Province)
-                        a tut_northwind:Province
-                                as virtrdf:tutProvince-Provinces ;
-                        tut_northwind:has_country_code provinces.CountryCode
-                                as virtrdf:tuthas_country_code ;
-                        tut_northwind:provinceName provinces.Province
-                                as virtrdf:tutProvince-ProvinceName ;
-                        rdfs:isDefinedBy tut_northwind:province_iri (provinces.CountryCode, provinces.Province) ;
-                        rdfs:isDefinedBy tut_northwind:Province (provinces.CountryCode, provinces.Province).
-
-                tut_northwind:Province (provinces.CountryCode, provinces.Province)
-                        tut_northwind:is_province_of
-                tut_northwind:Country (countries.Name) where  (^{countries.}^.Code = ^{provinces.}^.CountryCode) as virtrdf:tutProvince-country_of .
-        } .
-} .
-;
-
-DELETE FROM db.dba.url_rewrite_rule_list where urrl_list like 'tut_nw%';
-DELETE FROM db.dba.url_rewrite_rule where urr_rule like 'tut_nw%';
-
-create procedure DB.DBA.install_run ()
-{
-        declare file_text, uriqa varchar;
-        uriqa := registry_get('URIQADefaultHost');
-        file_text := (SELECT blob_to_string (RES_CONTENT) FROM WS.WS.SYS_DAV_RES where RES_FULL_PATH='/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.isparql');
-        file_text := replace(file_text, 'URIQA_MACRO', concat('http://', uriqa, '/tutorial/Northwind'));
-        update WS.WS.SYS_DAV_RES set RES_CONTENT=file_text where RES_FULL_PATH='/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.isparql';
-}
-;
-
-DB.DBA.install_run()
-;
-
-drop procedure DB.DBA.install_run
-;
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'tut_nw_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/tutorial/Northwind%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'tut_nw_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/rdfbrowser/index.html?uri=http%%3A//^{URIQADefaultHost}^%U%%23this',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'tut_nw_rule3',
-    1,
-    '(/[^#]*)/\x24',
-    vector('path'),
-    1,
-    '%s',
-    vector('path'),
-    null,
-    null,
-    0,
-    null
-    );
-
-create procedure DB.DBA.REMOVE_TUT_DEMO_RDF_DET()
-{
-  declare colid int;
-  colid := DAV_SEARCH_ID('/DAV/VAD/tutorial/rdfview/rd_v_1/', 'C');
-  if (colid < 0)
-    return;
-  update WS.WS.SYS_DAV_COL set COL_DET=null where COL_ID = colid;
-}
-;
-
-DB.DBA.REMOVE_TUT_DEMO_RDF_DET();
-
-drop procedure DB.DBA.REMOVE_TUT_DEMO_RDF_DET;
-
-create procedure DB.DBA.TUT_NORTHWIND_MAKE_RDF_DET()
-{
-    declare uriqa_str varchar;
-    uriqa_str := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
-    uriqa_str := 'http://' || uriqa_str || '/tutorial/Northwind';
-    DB.DBA."RDFData_MAKE_DET_COL" ('/DAV/VAD/tutorial/rdfview/rd_v_1/RDFData/', uriqa_str, NULL);
-    VHOST_REMOVE (lpath=>'/tutorial/Northwind/data/rdf');
-    DB.DBA.VHOST_DEFINE (lpath=>'/tutorial/Northwind/data/rdf', ppath=>'/DAV/VAD/tutorial/rdfview/rd_v_1/RDFData/All/', is_dav=>1, vsp_user=>'dba');
-}
-;
-
-DB.DBA.TUT_NORTHWIND_MAKE_RDF_DET();
-
-drop procedure DB.DBA.TUT_NORTHWIND_MAKE_RDF_DET;
-
--- procedure to convert path to DET resource name
-create procedure DB.DBA.TUT_NORTHWIND_DET_REF (in par varchar, in fmt varchar, in val varchar)
-{
-  declare res, iri any;
-  declare uriqa_str varchar;
-  uriqa_str := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
-  uriqa_str := 'http://' || uriqa_str || '/tutorial/Northwind';
-  iri := uriqa_str || val;
-  res := sprintf ('iid (%d).rdf', iri_id_num (iri_to_id (iri)));
-  return sprintf (fmt, res);
-}
-;
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('tut_nw_rdf', 1,
-    '/tutorial/Northwind/(.*)', vector('path'), 1,
-    '/tutorial/Northwind/data/rdf/%U', vector('path'),
-    'DB.DBA.TUT_NORTHWIND_DET_REF',
-    'application/rdf.xml',
-    2,
-    303);
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'tut_nw_rule_list1',
-    1,
-    vector (
-                'tut_nw_rule1',
-                'tut_nw_rule2',
-                'tut_nw_rule3',
-                'tut_nw_rdf'
-          ));
-
-
-VHOST_REMOVE (lpath=>'/tutorial/Northwind');
-DB.DBA.VHOST_DEFINE (lpath=>'/tutorial/Northwind', ppath=>'/DAV/VAD/tutorial/rdfview/rd_v_1/', vsp_user=>'dba', is_dav=>1, def_page=>'sfront.vspx',
-          is_brws=>0, opts=>vector ('url_rewrite', 'tut_nw_rule_list1'));
-
-create procedure DB.DBA.LOAD_TUTNW_ONTOLOGY_FROM_DAV()
-{
-  declare content, urihost varchar;
-  whenever not found goto endpoint;
-  SELECT cast (RES_CONTENT as varchar) into content FROM WS.WS.SYS_DAV_RES where RES_FULL_PATH = '/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.owl';
-  if (content is null or content = '')
-    goto endpoint;
-  DB.DBA.RDF_LOAD_RDFXML (content, 'http://demo.openlinksw.com/schemas/tutorial/northwind#', 'http://demo.openlinksw.com/schemas/TutorialNorthwindOntology/1.0/');
-  if (urihost = 'demo.openlinksw.com')
-  {
-    DB.DBA.VHOST_REMOVE (lpath=>'/schemas/tutorial/northwind#');
-    DB.DBA.VHOST_DEFINE (lpath=>'/schemas/tutorial/northwind#', ppath=>'/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
-    DB.DBA.VHOST_REMOVE (lpath=>'/schemas/tutorial/northwind');
-    DB.DBA.VHOST_DEFINE (lpath=>'/schemas/tutorial/northwind', ppath=>'/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
-  }
-  endpoint:
-  ;
-}
-;
-
-DB.DBA.LOAD_TUTNW_ONTOLOGY_FROM_DAV()
-;
-
-drop procedure DB.DBA.LOAD_TUTNW_ONTOLOGY_FROM_DAV
-;
-
-create procedure DB.DBA.LOAD_TUTNW_ONTOLOGY_FROM_DAV2()
-{
-  declare urihost varchar;
-  sparql base <http://demo.openlinksw.com/schemas/tutorial/northwind#> load bif:concat ("http://", bif:registry_get("URIQADefaultHost"), "/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.owl")
-   into graph <http://demo.openlinksw.com/schemas/TutorialNorthwindOntology/1.0/>;
-  urihost := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
-  if (urihost = 'demo.openlinksw.com')
-  {
-    DB.DBA.VHOST_REMOVE (lpath=>'/tutorial/northwind#');
-    DB.DBA.VHOST_DEFINE (lpath=>'/tutorial/northwind#', ppath=>'/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
-  }
-}
-;
-
---DB.DBA.LOAD_TUTNW_ONTOLOGY_FROM_DAV2();
-
-drop procedure DB.DBA.LOAD_TUTNW_ONTOLOGY_FROM_DAV2
-;
-
-DB.DBA.XML_SET_NS_DECL ('tut_northwind', 'http://demo.openlinksw.com/schemas/tutorial/northwind#', 2);
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfviewsenterprsn">
-      <title>SQL Server's Northwind Demo Database</title>
-<programlisting><![CDATA[
-use DB;
-
-DB.DBA.exec_stmt ('UPDATE WS.WS.SYS_DAV_RES set RES_TYPE=\'image/jpeg\' where RES_FULL_PATH like \'/DAV/VAD/demo/sql/CAT%\'', 0)
-;
-
-DB.DBA.exec_stmt ('UPDATE WS.WS.SYS_DAV_RES set RES_TYPE=\'image/jpeg\' where RES_FULL_PATH like \'/DAV/VAD/demo/sql/EMP%\'', 0)
-;
-
-GRANT SELECT ON "Demo"."demo"."Products" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Suppliers" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Shippers" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Categories" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Customers" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Employees" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Orders" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Order_Details" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Countries" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Provinces" TO "SPARQL";
-
-
-SPARQL drop quad map graph iri("http://^{URIQADefaultHost}^/Northwind") .
-;
-
-SPARQL drop quad map virtrdf:NorthwindDemo .
-;
-
-SPARQL
-prefix northwind: <http://demo.openlinksw.com/schemas/northwind#>
-drop iri class northwind:Category .
-drop iri class northwind:CategoryDoc .
-drop iri class northwind:Shipper .
-drop iri class northwind:ShipperDoc .
-drop iri class northwind:Supplier .
-drop iri class northwind:SupplierDoc .
-drop iri class northwind:Product .
-drop iri class northwind:ProductDoc .
-drop iri class northwind:Customer .
-drop iri class northwind:CustomerDoc .
-drop iri class northwind:Employee .
-drop iri class northwind:EmployeeDoc .
-drop iri class northwind:Order .
-drop iri class northwind:OrderDoc .
-drop iri class northwind:CustomerContact .
-drop iri class northwind:CustomerContactDoc .
-drop iri class northwind:OrderLine .
-drop iri class northwind:OrderLineDoc .
-drop iri class northwind:Province .
-drop iri class northwind:ProvinceDoc .
-drop iri class northwind:Country .
-drop iri class northwind:CountryDoc .
-drop iri class northwind:Flag .
-drop iri class northwind:FlagDoc .
-drop iri class northwind:dbpedia_iri2 .
-drop iri class northwind:EmployeePhoto .
-drop iri class northwind:CategoryPhoto .
-
-drop iri class northwind:category_iri .
-drop iri class northwind:categorydoc_iri .
-drop iri class northwind:shipper_iri .
-drop iri class northwind:shipperdoc_iri .
-drop iri class northwind:supplier_iri .
-drop iri class northwind:supplierdoc_iri .
-drop iri class northwind:product_iri .
-drop iri class northwind:productdoc_iri .
-drop iri class northwind:customer_iri .
-drop iri class northwind:customerdoc_iri .
-drop iri class northwind:employee_iri .
-drop iri class northwind:employeedoc_iri .
-drop iri class northwind:order_iri .
-drop iri class northwind:orderdoc_iri .
-drop iri class northwind:customercontact_iri .
-drop iri class northwind:customercontactdoc_iri .
-drop iri class northwind:orderline_iri .
-drop iri class northwind:orderlinedoc_iri .
-drop iri class northwind:province_iri .
-drop iri class northwind:provincedoc_iri .
-drop iri class northwind:country_iri .
-drop iri class northwind:countrydoc_iri .
-drop iri class northwind:employeephoto_iri .
-drop iri class northwind:categoryphoto_iri .
-drop iri class northwind:flag_iri .
-drop iri class northwind:flagdoc_iri .
-;
-
-SPARQL
-prefix northwind: <http://demo.openlinksw.com/schemas/northwind#>
-
-create iri class northwind:Category "http://^{URIQADefaultHost}^/Northwind/Category/%d#this" (in category_id integer not null) .
-create iri class northwind:CategoryDoc "http://^{URIQADefaultHost}^/Northwind/Category/%d" (in category_id integer not null) .
-create iri class northwind:Shipper "http://^{URIQADefaultHost}^/Northwind/Shipper/%d#this" (in shipper_id integer not null) .
-create iri class northwind:ShipperDoc "http://^{URIQADefaultHost}^/Northwind/Shipper/%d" (in shipper_id integer not null) .
-create iri class northwind:Supplier "http://^{URIQADefaultHost}^/Northwind/Supplier/%d#this" (in supplier_id integer not null) .
-create iri class northwind:SupplierDoc "http://^{URIQADefaultHost}^/Northwind/Supplier/%d" (in supplier_id integer not null) .
-create iri class northwind:Product   "http://^{URIQADefaultHost}^/Northwind/Product/%d#this" (in product_id integer not null) .
-create iri class northwind:ProductDoc   "http://^{URIQADefaultHost}^/Northwind/Product/%d" (in product_id integer not null) .
-create iri class northwind:Customer "http://^{URIQADefaultHost}^/Northwind/Customer/%U#this" (in customer_id varchar not null) .
-create iri class northwind:CustomerDoc "http://^{URIQADefaultHost}^/Northwind/Customer/%U" (in customer_id varchar not null) .
-create iri class northwind:Employee "http://^{URIQADefaultHost}^/Northwind/Employee/%U_%U_%d#this" (in employee_firstname varchar not null, in employee_lastname varchar not null, in employee_id integer not null) .
-create iri class northwind:EmployeeDoc "http://^{URIQADefaultHost}^/Northwind/Employee/%U_%U_%d" (in employee_firstname varchar not null, in employee_lastname varchar not null, in employee_id integer not null) .
-create iri class northwind:Order "http://^{URIQADefaultHost}^/Northwind/Order/%d#this" (in order_id integer not null) .
-create iri class northwind:OrderDoc "http://^{URIQADefaultHost}^/Northwind/Order/%d" (in order_id integer not null) .
-create iri class northwind:CustomerContact "http://^{URIQADefaultHost}^/Northwind/CustomerContact/%U#this" (in customer_id varchar not null) .
-create iri class northwind:CustomerContactDoc "http://^{URIQADefaultHost}^/Northwind/CustomerContact/%U" (in customer_id varchar not null) .
-create iri class northwind:OrderLine "http://^{URIQADefaultHost}^/Northwind/OrderLine/%d/%d#this" (in order_id integer not null, in product_id integer not null) .
-create iri class northwind:OrderLineDoc "http://^{URIQADefaultHost}^/Northwind/OrderLine/%d/%d" (in order_id integer not null, in product_id integer not null) .
-create iri class northwind:Province "http://^{URIQADefaultHost}^/Northwind/Province/%U/%U#this" (in country_name varchar not null, in province_name varchar not null) .
-create iri class northwind:ProvinceDoc "http://^{URIQADefaultHost}^/Northwind/Province/%U/%U" (in country_name varchar not null, in province_name varchar not null) .
-create iri class northwind:Country "http://^{URIQADefaultHost}^/Northwind/Country/%U#this" (in country_name varchar not null) .
-create iri class northwind:CountryDoc "http://^{URIQADefaultHost}^/Northwind/Country/%U" (in country_name varchar not null) .
-create iri class northwind:Flag "http://^{URIQADefaultHost}^%U#this" (in flag_path varchar not null) .
-create iri class northwind:FlagDoc "http://^{URIQADefaultHost}^%U" (in flag_path varchar not null) .
-create iri class northwind:dbpedia_iri2 "http://dbpedia.org/resource/%U" (in uname varchar not null) .
-create iri class northwind:EmployeePhoto "http://^{URIQADefaultHost}^/DAV/VAD/demo/sql/EMP%d#this" (in emp_id varchar not null) .
-create iri class northwind:CategoryPhoto "http://^{URIQADefaultHost}^/DAV/VAD/demo/sql/CAT%d#this" (in category_id varchar not null) .
-create iri class northwind:Phone "tel:%s" (in phone_number varchar) .
-create iri class northwind:Fax "fax:%s" (in fax_number varchar) .
-;
-
-SPARQL
-prefix northwind: <http://demo.openlinksw.com/schemas/northwind#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-
-alter quad storage virtrdf:DefaultQuadStorage
-FROM Demo.demo.Products as products
-FROM Demo.demo.Suppliers as suppliers
-FROM Demo.demo.Shippers as shippers
-FROM Demo.demo.Categories as categories
-FROM Demo.demo.Customers as customers
-FROM Demo.demo.Employees as employees
-FROM Demo.demo.Orders as orders
-FROM Demo.demo.Order_Details as order_lines
-FROM Demo.demo.Countries as countries
-FROM Demo.demo.Provinces as provinces
-where (^{suppliers.}^.Country = ^{countries.}^.Name)
-where (^{customers.}^.Country = ^{countries.}^.Name)
-where (^{employees.}^.Country = ^{countries.}^.Name)
-where (^{orders.}^.ShipCountry = ^{countries.}^.Name)
-{
-        create virtrdf:NorthwindDemo as graph iri ("http://^{URIQADefaultHost}^/Northwind") option (exclusive)
-{
-                northwind:CustomerContact (customers.CustomerID)
-                        a foaf:Person
-                                as virtrdf:CustomerContact-foaf_Person .
-
-                northwind:CustomerContact (customers.CustomerID)
-                        a northwind:CustomerContact
-                                as virtrdf:CustomerContact-CustomerContact;
-                        foaf:name customers.ContactName
-                                as virtrdf:CustomerContact-contact_name ;
-                        foaf:phone northwind:Phone (customers.Phone)
-                                as virtrdf:CustomerContact-foaf_phone ;
-                        northwind:is_contact_at northwind:Customer (customers.CustomerID)
-                                as virtrdf:CustomerContact-is_contact_at ;
-                        northwind:country northwind:Country (customers.Country)
-                                as virtrdf:CustomerContact-country ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:CustomerContactDoc (customers.CustomerID)
-                        a northwind:CustomerContactDoc
-                                as virtrdf:CustomerContactDoc-CustomerID ;
-                        a foaf:Document
-                                as virtrdf:CustomerContactDoc-foaf_DocCustomerID ;
-                        foaf:primaryTopic northwind:CustomerContact (customers.CustomerID)
-                                as virtrdf:CustomerContactDoc-foaf_primarytopic ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:Country (customers.Country)
-                        northwind:is_country_of
-                northwind:CustomerContact (customers.CustomerID) as virtrdf:CustomerContact-is_country_of .
-
-                northwind:Product (products.ProductID)
-                        a northwind:Product
-                                as virtrdf:Product-ProductID ;
-                        northwind:has_category northwind:Category (products.CategoryID)
-                                as virtrdf:Product-product_has_category ;
-                        northwind:has_supplier northwind:Supplier (products.SupplierID)
-                                as virtrdf:Product-product_has_supplier ;
-                        northwind:productName products.ProductName
-                                as virtrdf:Product-name_of_product ;
-                        northwind:quantityPerUnit products.QuantityPerUnit
-                                as virtrdf:Product-quantity_per_unit ;
-                        northwind:unitPrice products.UnitPrice
-                                as virtrdf:Product-unit_price ;
-                        northwind:unitsInStock products.UnitsInStock
-                                as virtrdf:Product-units_in_stock ;
-                        northwind:unitsOnOrder products.UnitsOnOrder
-                                as virtrdf:Product-units_on_order ;
-                        northwind:reorderLevel products.ReorderLevel
-                                as virtrdf:Product-reorder_level ;
-                        northwind:discontinued products.Discontinued
-                                as virtrdf:Product-discontinued ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:ProductDoc (products.ProductID)
-                        a northwind:ProductDoc
-                                as virtrdf:ProductDoc-ProductID ;
-                        a foaf:Document
-                                as virtrdf:ProductDoc-foaf_DocProductID ;
-                        foaf:primaryTopic northwind:Product (products.ProductID)
-                                as virtrdf:ProductDoc-foaf_primarytopic ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:Category (products.CategoryID)
-                        northwind:category_of northwind:Product (products.ProductID) as virtrdf:Product-category_of .
-
-                northwind:Supplier (products.SupplierID)
-                        northwind:supplier_of northwind:Product (products.ProductID) as virtrdf:Product-supplier_of .
-
-                northwind:Supplier (suppliers.SupplierID)
-                        a northwind:Supplier
-                                as virtrdf:Supplier-SupplierID ;
-                        northwind:companyName suppliers.CompanyName
-                                as virtrdf:Supplier-company_name ;
-                        northwind:contactName suppliers.ContactName
-                                as virtrdf:Supplier-contact_name ;
-                        northwind:contactTitle suppliers.ContactTitle
-                                as virtrdf:Supplier-contact_title ;
-                        northwind:address suppliers.Address
-                                as virtrdf:Supplier-address ;
-                        northwind:city northwind:dbpedia_iri2(suppliers.City)
-                                as virtrdf:Supplier-dbpediacity ;
-                        northwind:region suppliers.Region
-                                as virtrdf:Supplier-region ;
-                        northwind:postalCode suppliers.PostalCode
-                                as virtrdf:Supplier-postal_code ;
-                        northwind:country northwind:Country(suppliers.Country)
-                                as virtrdf:Supplier-country ;
-                        northwind:phone northwind:Phone (suppliers.Phone)
-                                as virtrdf:Supplier-phone ;
-                        northwind:fax northwind:Fax (suppliers.Fax)
-                                as virtrdf:Supplier-fax ;
-                        northwind:homePage suppliers.HomePage
-                                as virtrdf:Supplier-home_page ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:SupplierDoc (suppliers.SupplierID)
-                        a northwind:SupplierDoc
-                                as virtrdf:SupplierDoc-SupplierID ;
-                        a foaf:Document
-                                as virtrdf:SupplierDoc-foaf_DocSupplierID ;
-                        foaf:primaryTopic northwind:Supplier (suppliers.SupplierID)
-                                as virtrdf:SupplierDoc-foaf_primarytopic ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:Country (suppliers.Country)
-                        northwind:is_country_of
-                northwind:Supplier (suppliers.SupplierID) as virtrdf:Supplier-is_country_of .
-
-                northwind:Category (categories.CategoryID)
-                        a northwind:Category
-                                as virtrdf:Category-CategoryID ;
-                        northwind:categoryName categories.CategoryName
-                                as virtrdf:Category-home_page ;
-                        northwind:description categories.Description
-                                as virtrdf:Category-description ;
-                        foaf:img northwind:CategoryPhoto(categories.CategoryID)
-                                as virtrdf:Category-categories.CategoryPhoto ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:CategoryDoc (categories.CategoryID)
-                        a northwind:CategoryDoc
-                                as virtrdf:CategoryDoc-CategoryID ;
-                        a foaf:Document
-                                as virtrdf:CategoryDoc-foaf_DocCategoryID ;
-                        foaf:primaryTopic northwind:Category (categories.CategoryID)
-                                as virtrdf:CategoryDoc-foaf_primarytopic ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:CategoryPhoto(categories.CategoryID)
-                        a northwind:CategoryPhoto
-                                as virtrdf:Category-categories.CategoryPhotoID ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:Shipper (shippers.ShipperID)
-                        a northwind:Shipper
-                                as virtrdf:Shipper-ShipperID ;
-                        northwind:companyName shippers.CompanyName
-                                as virtrdf:Shipper-company_name ;
-                        northwind:phone northwind:Phone (shippers.Phone)
-                                as virtrdf:Shipper-phone ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:ShipperDoc (shippers.ShipperID)
-                        a northwind:ShipperDoc
-                                as virtrdf:ShipperDoc-ShipperID ;
-                        a foaf:Document
-                                as virtrdf:ShipperDoc-foaf_DocShipperID ;
-                        foaf:primaryTopic northwind:Shipper (shippers.ShipperID)
-                                as virtrdf:ShipperDoc-foaf_primarytopic ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:Customer (customers.CustomerID)
-                        a  northwind:Customer
-                                as virtrdf:Customer-CustomerID2 ;
-                        a  foaf:Organization
-                                as virtrdf:Customer-CustomerID ;
-                        foaf:name customers.CompanyName
-                                as virtrdf:Customer-foaf_name ;
-                        northwind:companyName customers.CompanyName
-                                as virtrdf:Customer-company_name ;
-                        northwind:has_contact northwind:CustomerContact (customers.CustomerID)
-                                as virtrdf:Customer-contact ;
-                        northwind:country northwind:Country (customers.Country)
-                                as virtrdf:Customer-country ;
-                        northwind:contactName customers.ContactName
-                                as virtrdf:Customer-contact_name ;
-                        northwind:contactTitle customers.ContactTitle
-                                as virtrdf:Customer-contact_title ;
-                        northwind:address customers.Address
-                                as virtrdf:Customer-address ;
-                        northwind:city northwind:dbpedia_iri2(customers.City)
-                                as virtrdf:Customer-dbpediacity ;
-                        northwind:region customers.Region
-                                as virtrdf:Customer-region ;
-                        northwind:PostalCode customers.PostalCode
-                                as virtrdf:Customer-postal_code ;
-                        foaf:phone northwind:Phone (customers.Phone)
-                                as virtrdf:Customer-foaf_phone ;
-                        northwind:phone northwind:Phone (customers.Phone)
-                                as virtrdf:Customer-phone ;
-                        northwind:fax northwind:Fax (customers.Fax)
-                                as virtrdf:Customer-fax ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:CustomerDoc (customers.CustomerID)
-                        a  northwind:CustomerDoc
-                                as virtrdf:CustomerDoc-CustomerID2 ;
-                        a  foaf:Document
-                                as virtrdf:CustomerDoc-CustomerID3 ;
-                        foaf:primaryTopic northwind:Customer (customers.CustomerID)
-                                as virtrdf:CustomerDoc-foaf_primarytopic ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:Country (customers.Country)
-                        northwind:is_country_of
-                northwind:Customer (customers.CustomerID) as virtrdf:Customer-is_country_of .
-
-                northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID)
-                        a northwind:Employee
-                                as virtrdf:Employee-EmployeeID2 ;
-                        a foaf:Person
-                                as virtrdf:Employee-EmployeeID ;
-                        foaf:surname employees.LastName
-                                as virtrdf:Employee-foaf_last_name ;
-                        northwind:lastName employees.LastName
-                                as virtrdf:Employee-last_name ;
-                        foaf:firstName employees.FirstName
-                                as virtrdf:Employee-foaf_first_name ;
-                        northwind:firstName employees.FirstName
-                                as virtrdf:Employee-first_name ;
-                        foaf:title employees.Title
-                                as virtrdf:Employee-title ;
-                        northwind:titleOfCourtesy employees.TitleOfCourtesy
-                                as virtrdf:Employee-title_of_courtesy ;
-                        foaf:birthday employees.BirthDate
-                                as virtrdf:Employee-foaf_birth_date ;
-                        northwind:birthday employees.BirthDate
-                                as virtrdf:Employee-birth_date ;
-                        northwind:hireDate employees.HireDate
-                                as virtrdf:Employee-hire_date ;
-                        northwind:address employees.Address
-                                as virtrdf:Employee-address ;
-                        northwind:city northwind:dbpedia_iri2(employees.City)
-                                as virtrdf:Employee-dbpediacity ;
-                        northwind:region employees.Region
-                                as virtrdf:Employee-region ;
-                        northwind:postalCode employees.PostalCode
-                                as virtrdf:Employee-postal_code ;
-                        northwind:country northwind:Country(employees.Country)
-                                as virtrdf:Employee-country ;
-                        foaf:phone employees.HomePhone
-                                as virtrdf:Employee-home_phone ;
-                        northwind:extension employees.Extension
-                                as virtrdf:Employee-extension ;
-                        northwind:notes employees.Notes
-                                as virtrdf:Employee-notes ;
-                        northwind:reportsTo northwind:Employee(employees.FirstName, employees.LastName, employees.ReportsTo) where (^{employees.}^.ReportsTo = ^{employees.}^.EmployeeID)
-                                as virtrdf:Employee-reports_to ;
-                        foaf:img northwind:EmployeePhoto(employees.EmployeeID)
-                                as virtrdf:Employee-employees.EmployeePhoto ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:EmployeeDoc (employees.FirstName, employees.LastName, employees.EmployeeID)
-                        a  northwind:EmployeeDoc
-                                as virtrdf:EmployeeDoc-EmployeeID2 ;
-                        a  foaf:Document
-                                as virtrdf:EmployeeDoc-EmployeeID3 ;
-                        foaf:primaryTopic northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID)
-                                as virtrdf:EmployeeDoc-foaf_primarytopic ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:EmployeePhoto(employees.EmployeeID)
-                        a northwind:EmployeePhoto
-                                as virtrdf:Employee-employees.EmployeePhotoId ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID)
-                        northwind:is_salesrep_of
-                northwind:Order (orders.OrderID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID) as virtrdf:Order-is_salesrep_of .
-
-                northwind:Country (employees.Country)
-                        northwind:is_country_of
-                northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID) as virtrdf:Employee-is_country_of .
-
-                northwind:Order (orders.OrderID)
-                        a northwind:Order
-                                as virtrdf:Order-Order ;
-                        northwind:has_customer northwind:Customer (orders.CustomerID)
-                                as virtrdf:Order-order_has_customer ;
-                        northwind:has_salesrep northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID)
-                                as virtrdf:Customer-has_salesrep ;
-                        northwind:has_employee northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID)
-                                as virtrdf:Order-order_has_employee ;
-                        northwind:orderDate orders.OrderDate
-                                as virtrdf:Order-order_date ;
-                        northwind:requiredDate orders.RequiredDate
-                                as virtrdf:Order-required_date ;
-                        northwind:shippedDate orders.ShippedDate
-                                as virtrdf:Order-shipped_date ;
-                        northwind:order_ship_via northwind:Shipper (orders.ShipVia)
-                                as virtrdf:Order-order_ship_via ;
-                        northwind:freight orders.Freight
-                                as virtrdf:Order-freight ;
-                        northwind:shipName orders.ShipName
-                                as virtrdf:Order-ship_name ;
-                        northwind:shipAddress orders.ShipAddress
-                                as virtrdf:Order-ship_address ;
-                        northwind:shipCity northwind:dbpedia_iri2(orders.ShipCity)
-                                as virtrdf:Order-dbpediaship_city ;
-                        northwind:shipRegion orders.ShipRegion
-                                as virtrdf:Order-ship_region ;
-                        northwind:shipPostal_code orders.ShipPostalCode
-                                as virtrdf:Order-ship_postal_code ;
-                        northwind:shipCountry northwind:Country(orders.ShipCountry)
-                                as virtrdf:ship_country ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:OrderDoc (orders.OrderID)
-                        a  northwind:OrderDoc
-                                as virtrdf:OrderDoc-OrderID2 ;
-                        a  foaf:Document
-                                as virtrdf:OrderDoc-OrderID3 ;
-                        foaf:primaryTopic northwind:Order (orders.OrderID)
-                                as virtrdf:OrderDoc-foaf_primarytopic ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:Country (orders.ShipCountry)
-                        northwind:is_ship_country_of
-                northwind:Order (orders.OrderID) as virtrdf:Order-is_country_of .
-
-                northwind:Customer (orders.CustomerID)
-                        northwind:has_order northwind:Order (orders.OrderID) as virtrdf:Order-has_order .
-
-                northwind:Shipper (orders.ShipVia)
-                        northwind:ship_order northwind:Order (orders.OrderID) as virtrdf:Order-ship_order .
-
-                northwind:OrderLine (order_lines.OrderID, order_lines.ProductID)
-                        a northwind:OrderLine
-                                as virtrdf:OrderLine-OrderLines ;
-                        northwind:has_order_id northwind:Order (order_lines.OrderID)
-                                as virtrdf:order_lines_has_order_id ;
-                        northwind:has_product_id northwind:Product (order_lines.ProductID)
-                                as virtrdf:order_lines_has_product_id ;
-                        northwind:unitPrice order_lines.UnitPrice
-                                as virtrdf:OrderLine-unit_price ;
-                        northwind:quantity order_lines.Quantity
-                                as virtrdf:OrderLine-quantity ;
-                        northwind:discount order_lines.Discount
-                                as virtrdf:OrderLine-discount ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:OrderLineDoc (order_lines.OrderID, order_lines.ProductID)
-                        a  northwind:OrderLineDoc
-                                as virtrdf:OrderLineDoc-OrderLineID2 ;
-                        a  foaf:Document
-                                as virtrdf:OrderLineDoc-OrderLineID3 ;
-                        foaf:primaryTopic northwind:OrderLine (order_lines.OrderID, order_lines.ProductID)
-                                as virtrdf:OrderLineDoc-foaf_primarytopic ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:Order (orders.OrderID)
-                        northwind:is_order_of
-                northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) where (^{orders.}^.OrderID = ^{order_lines.}^.OrderID) as virtrdf:Order-is_order_of .
-
-                northwind:Product (products.ProductID)
-                        northwind:is_product_of
-                northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) where (^{products.}^.ProductID = ^{order_lines.}^.ProductID) as virtrdf:Product-is_product_of .
-
-                northwind:Country (countries.Name)
-                        a northwind:Country
-                                as virtrdf:Country-Type2 ;
-                        a wgs:SpatialThing
-                                as virtrdf:Country-Type ;
-                        owl:sameAs northwind:dbpedia_iri2 (countries.Name) ;
-                        northwind:name countries.Name
-                                as virtrdf:Country-Name ;
-                        northwind:code countries.Code
-                                as virtrdf:Country-Code ;
-                        northwind:smallFlagDAVResourceName countries.SmallFlagDAVResourceName
-                                as virtrdf:Country-SmallFlagDAVResourceName ;
-                        northwind:largeFlagDAVResourceName countries.LargeFlagDAVResourceName
-                                as virtrdf:Country-LargeFlagDAVResourceName ;
-                        northwind:smallFlagDAVResourceURI northwind:Flag(countries.SmallFlagDAVResourceURI)
-                                as virtrdf:Country-SmallFlagDAVResourceURI ;
-                        northwind:largeFlagDAVResourceURI northwind:Flag(countries.LargeFlagDAVResourceURI)
-                                as virtrdf:Country-LargeFlagDAVResourceURI ;
-                        wgs:lat countries.Lat
-                                as virtrdf:Country-Lat ;
-                        wgs:long countries.Lng
-                                as virtrdf:Country-Lng ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:CountryDoc (countries.Name)
-                        a  northwind:CountryDoc
-                                as virtrdf:CountryDoc-CountryID2 ;
-                        a  foaf:Document
-                                as virtrdf:CountryDoc-CountryID3 ;
-                        foaf:primaryTopic northwind:Country (countries.Name)
-                                as virtrdf:CountryDoc-foaf_primarytopic ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:Country (countries.Name)
-                        northwind:has_province
-                northwind:Province (provinces.CountryCode, provinces.Province) where (^{provinces.}^.CountryCode = ^{countries.}^.Code) as virtrdf:Country-has_province .
-
-                northwind:Province (provinces.CountryCode, provinces.Province)
-                        a northwind:Province
-                                as virtrdf:Province-Provinces ;
-                        owl:sameAs northwind:dbpedia_iri2 (provinces.Province) ;
-                        northwind:has_country_code provinces.CountryCode
-                                as virtrdf:has_country_code ;
-                        northwind:provinceName provinces.Province
-                                as virtrdf:Province-ProvinceName ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:ProvinceDoc (provinces.CountryCode, provinces.Province)
-                        a  northwind:ProvinceDoc
-                                as virtrdf:ProvinceDoc-ProvinceID2 ;
-                        a  foaf:Document
-                                as virtrdf:ProvinceDoc-ProvinceID3 ;
-                        foaf:primaryTopic northwind:Province (provinces.CountryCode, provinces.Province)
-                                as virtrdf:ProvinceDoc-foaf_primarytopic ;
-                        rdfs:isDefinedBy northwind: .
-
-                northwind:Province (provinces.CountryCode, provinces.Province)
-                        northwind:is_province_of
-                northwind:Country (countries.Name) where  (^{countries.}^.Code = ^{provinces.}^.CountryCode) as virtrdf:Province-country_of .
-        }.
-}.
-;
-
-delete FROM DB.DBA.URL_REWRITE_RULE_LIST where urrl_list like 'demo_nw%';
-delete FROM DB.DBA.URL_REWRITE_RULE where urr_rule like 'demo_nw%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'demo_nw_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/Northwind%%3E&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'demo_nw_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'demo_nw_rule_list1',
-    1,
-    vector (
-                'demo_nw_rule1',
-                'demo_nw_rule2'
-          ));
-
-
-VHOST_REMOVE (lpath=>'/Northwind');
-DB.DBA.VHOST_DEFINE (lpath=>'/Northwind', ppath=>'/DAV/home/demo/', vsp_user=>'dba', is_dav=>1,
-          is_brws=>0, opts=>vector ('url_rewrite', 'demo_nw_rule_list1'));
-
-create procedure DB.DBA.LOAD_NW_ONTOLOGY_FROM_DAV()
-{
-  declare content1, urihost varchar;
-  SELECT cast (RES_CONTENT as varchar) into content1 FROM WS.WS.SYS_DAV_RES where RES_FULL_PATH = '/DAV/VAD/demo/sql/nw.owl';
-  DB.DBA.RDF_LOAD_RDFXML (content1, 'http://demo.openlinksw.com/schemas/northwind#', 'http://demo.openlinksw.com/schemas/NorthwindOntology/1.0/');
-  urihost := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
-  if (urihost = 'demo.openlinksw.com')
-  {
-    DB.DBA.VHOST_REMOVE (lpath=>'/schemas/northwind');
-    DB.DBA.VHOST_DEFINE (lpath=>'/schemas/northwind', ppath=>'/DAV/VAD/demo/sql/nw.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
-    DB.DBA.VHOST_REMOVE (lpath=>'/schemas/northwind#');
-    DB.DBA.VHOST_DEFINE (lpath=>'/schemas/northwind#', ppath=>'/DAV/VAD/demo/sql/nw.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
-}
-};
-
-DB.DBA.LOAD_NW_ONTOLOGY_FROM_DAV();
-drop procedure DB.DBA.LOAD_NW_ONTOLOGY_FROM_DAV;
-
-DB.DBA.XML_SET_NS_DECL ('northwind', 'http://demo.openlinksw.com/schemas/northwind#', 2);
-]]></programlisting>
-    <para><emphasis>Basic Northwind Ontology</emphasis></para>
-<programlisting><![CDATA[
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- -
- -
- -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- -  project.
- -
- -  Copyright (C) 1998-2007 OpenLink Software
- -
- -  This project is free software; you can redistribute it and/or modify it
- -  under the terms of the GNU General Public License as published by the
- -  Free Software Foundation; only version 2 of the License, dated June 1991.
- -
- -  This program is distributed in the hope that it will be useful, but
- -  WITHOUT ANY WARRANTY; without even the implied warranty of
- -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- -  General Public License for more details.
- -
- -  You should have received a copy of the GNU General Public License along
- -  with this program; if not, write to the Free Software Foundation, Inc.,
- -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- -
--->
-<rdf:RDF xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
-         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:owl ="http://www.w3.org/2002/07/owl#"
-         xmlns:virtrdf="http://www.openlinksw.com/schemas/virtrdf#"
-         xml:base="http://demo.openlinksw.com/schemas/northwind#">
-  <owl:Ontology rdf:about="http://demo.openlinksw.com/schemas/northwind#">
-        <rdfs:label>Northwind</rdfs:label>
-        <rdfs:comment>Northwind database classes and properties</rdfs:comment>
-        <virtrdf:catName>Northwind</virtrdf:catName>
-        <virtrdf:version>1.00</virtrdf:version>
-  </owl:Ontology>
-
-  <rdfs:Class rdf:ID="Product">
-    <rdfs:label>Product</rdfs:label>
-  </rdfs:Class>
-  <rdf:Property rdf:ID="has_category">
-    <rdfs:range rdf:resource="#Category"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Category</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="has_supplier">
-    <rdfs:range rdf:resource="#Supplier"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Supplier</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ProductName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ProductName</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="QuantityPerUnit">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>QuantityPerUnit</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="UnitPrice">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#double"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:domain rdf:resource="#OrderLine"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>UnitPrice</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="UnitsInStock">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>UnitsInStock</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="UnitsOnOrder">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>UnitsOnOrder</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ReorderLevel">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ReorderLevel</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Discontinued">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
-    <rdfs:domain rdf:resource="#Product"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Discontinued</rdfs:label>
-  </rdf:Property>
-
-  <rdfs:Class rdf:ID="Supplier">
-    <rdfs:label>Supplier</rdfs:label>
-  </rdfs:Class>
-  <rdf:Property rdf:ID="CompanyName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:domain rdf:resource="#Supplier"/>
-    <rdfs:domain rdf:resource="#Shipper"/>
-    <rdfs:domain rdf:resource="#Customer"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>CompanyName</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ContactName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
-    <rdfs:domain rdf:resource="#Supplier"/>
-    <rdfs:domain rdf:resource="#Customer"/>
-    <rdfs:domain rdf:resource="#CustomerContact"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ContactName</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ContactTitle">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/title"/>
-    <rdfs:domain rdf:resource="#Supplier"/>
-    <rdfs:domain rdf:resource="#Customer"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ContactTitle</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Address">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Supplier"/>
-    <rdfs:domain rdf:resource="#Customer"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Address</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="City">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Supplier"/>
-    <rdfs:domain rdf:resource="#Customer"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>City</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Region">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Supplier"/>
-    <rdfs:domain rdf:resource="#Customer"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Region</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="PostalCode">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Supplier"/>
-    <rdfs:domain rdf:resource="#Customer"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>PostalCode</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="CountryName">
-    <rdfs:range rdf:resource="#Country"/>
-    <rdfs:domain rdf:resource="#Supplier"/>
-    <rdfs:domain rdf:resource="#Customer"/>
-    <rdfs:domain rdf:resource="#CustomerContact"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Country</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Phone">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/phone"/>
-    <rdfs:domain rdf:resource="#Supplier"/>
-    <rdfs:domain rdf:resource="#Shipper"/>
-    <rdfs:domain rdf:resource="#Customer"/>
-    <rdfs:domain rdf:resource="#CustomerContact"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Phone</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Fax">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Supplier"/>
-    <rdfs:domain rdf:resource="#Customer"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Fax</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="HomePage">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Supplier"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>HomePage</rdfs:label>
-  </rdf:Property>
-
-  <rdfs:Class rdf:ID="Category">
-    <rdfs:label>Category</rdfs:label>
-  </rdfs:Class>
-  <rdf:Property rdf:ID="CategoryName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Category"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>CategoryName</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Description">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Category"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Description</rdfs:label>
-  </rdf:Property>
-
-  <rdfs:Class rdf:ID="Shipper">
-    <rdfs:label>Shipper</rdfs:label>
-  </rdfs:Class>
-
-  <rdfs:Class rdf:ID="CustomerContact">
-    <rdfs:label>CustomerContact</rdfs:label>
-    <rdfs:subClassOf rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
-  </rdfs:Class>
-
-  <rdfs:Class rdf:ID="Customer">
-    <rdfs:label>Customer</rdfs:label>
-    <rdfs:subClassOf rdf:resource="http://xmlns.com/foaf/0.1/Organization"/>
-  </rdfs:Class>
-
-  <rdfs:Class rdf:ID="Employee">
-    <rdfs:label>Employee</rdfs:label>
-    <rdfs:subClassOf rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
-  </rdfs:Class>
-  <rdf:Property rdf:ID="LastName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/surname"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>LastName</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="FirstName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/firstName"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>FirstName</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Title">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/title"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Title</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="TitleOfCourtesy">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>TitleOfCourtesy</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="BirthDate">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/birthday"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>BirthDate</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="HireDate">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>HireDate</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Extension">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Extension</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Notes">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Notes</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ReportsTo">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
-    <rdfs:domain rdf:resource="#Employee"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ReportsTo</rdfs:label>
-  </rdf:Property>
-
-  <rdfs:Class rdf:ID="Order">
-    <rdfs:label>Order</rdfs:label>
-  </rdfs:Class>
-  <rdf:Property rdf:ID="has_customer">
-    <rdfs:range rdf:resource="#Customer"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Customer</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="has_employee">
-    <rdfs:range rdf:resource="#Employee"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Employee</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="OrderDate">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>OrderDate</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="RequiredDate">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>RequiredDate</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ShippedDate">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ShippedDate</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="order_ship_via">
-    <rdfs:range rdf:resource="#Shipper"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Shipper</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Freight">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#double"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Freight</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ShipName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ShipName</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ShipAddress">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ShipAddress</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ShipCity">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ShipCity</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ShipRegion">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ShipRegion</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ShipPostalCode">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ShipPostalCode</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ShipCountry">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Order"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ShipCountry</rdfs:label>
-  </rdf:Property>
-
-  <rdfs:Class rdf:ID="OrderLine">
-    <rdfs:label>OrderLine</rdfs:label>
-  </rdfs:Class>
-  <rdf:Property rdf:ID="has_order_id">
-    <rdfs:range rdf:resource="#Order"/>
-    <rdfs:domain rdf:resource="#OrderLine"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Order</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="has_product_id">
-    <rdfs:range rdf:resource="#Product"/>
-    <rdfs:domain rdf:resource="#OrderLine"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Product</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Quantity">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
-    <rdfs:domain rdf:resource="#OrderLine"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Quantity</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Discount">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#double"/>
-    <rdfs:domain rdf:resource="#OrderLine"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Discount</rdfs:label>
-  </rdf:Property>
-
-  <rdfs:Class rdf:ID="Country">
-    <rdfs:label>Country</rdfs:label>
-    <rdfs:subClassOf rdf:resource="http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing"/>
-  </rdfs:Class>
-  <rdf:Property rdf:ID="Name">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Country"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Name</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Code">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Country"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Code</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="SmallFlagDAVResourceName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Country"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>SmallFlagDAVResourceName</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="LargeFlagDAVResourceName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Country"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>LargeFlagDAVResourceName</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="SmallFlagDAVResourceURI">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Country"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>SmallFlagDAVResourceURI</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="LargeFlagDAVResourceURI">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Country"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>LargeFlagDAVResourceURI</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Lat">
-    <rdfs:range rdf:resource="ttp://www.w3.org/2003/01/geo/wgs84_pos#lat"/>
-    <rdfs:domain rdf:resource="#Country"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Lat</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="Lng">
-    <rdfs:range rdf:resource="ttp://www.w3.org/2003/01/geo/wgs84_pos#lng"/>
-    <rdfs:domain rdf:resource="#Country"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Lng</rdfs:label>
-  </rdf:Property>
-
-  <rdfs:Class rdf:ID="Province">
-    <rdfs:label>Province</rdfs:label>
-  </rdfs:Class>
-  <rdf:Property rdf:ID="has_country_code">
-    <rdfs:range rdf:resource="#Country"/>
-    <rdfs:domain rdf:resource="#Provinces"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>Country Code</rdfs:label>
-  </rdf:Property>
-  <rdf:Property rdf:ID="ProvinceName">
-    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
-    <rdfs:domain rdf:resource="#Province"/>
-    <rdfs:cardinality>1</rdfs:cardinality>
-    <rdfs:label>ProvinceName</rdfs:label>
-  </rdf:Property>
-
-</rdf:RDF>
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfviewsenterohr">
-      <title>Oracle Demonstration 'HR' Database </title>
-<para><emphasis>Live links to a sample instance</emphasis></para>
-<itemizedlist mark="bullet">
-<listitem><ulink url="http://demo.openlinksw.com/sparql?default-graph-uri=&should-sponge=&query=%20prefix%20hr%3A%20%3Chttp%3A%2F%2Fdemo.openlinksw.com%2Fschemas%2Foraclehr%2F%3E%20select%20*%20from%20%3Chttp%3A%2F%2Fdemo.openlinksw.com%2Foraclehr%3E%20WHERE%20%7B%3Fs%20a%20hr%3Aemployees%7D&format=text%2Fhtml&debug=on">list all employee URIs</ulink></listitem>
-<listitem><ulink url="http://demo.openlinksw.com/about/html/http/demo.openlinksw.com/oraclehr/employees/105">description of employee 105</ulink></listitem>
-</itemizedlist>
-<para><emphasis>Script to set up your own instance</emphasis></para>
-<programlisting><![CDATA[
--- Setup script for RDF views of Oracle 10 Human Resources Sample Database --
-
-GRANT SELECT ON HR.orama.COUNTRIES TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON HR.orama.REGIONS TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON HR.orama.DEPARTMENTS TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON HR.orama.LOCATIONS TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON HR.orama.EMPLOYEES TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON HR.orama.JOBS TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON HR.orama.JOB_HISTORY TO "SPARQL", "SPARQL_UPDATE";
-
--------------------------------------------------------------------
-
--------- Create rdfs:Class definitions ----------------------------
-
-ttlp (
-'
- at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
- at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
-
- at prefix hr: <http://localhost:8890/schemas/oraclehr/> .
-
-hr:countries a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "COUNTRIES" ;
-	rdfs:comment "Oracle HR COUNTRIES table" .
-
-hr:country_id a rdf:Property ;
-	rdfs:domain hr:countries ;
-	rdfs:range xsd:string ;
-	rdfs:label "COUNTRY ID" .
-
-hr:country_name a rdf:Property ;
-	rdfs:domain hr:countries ;
-	rdfs:range xsd:string ;
-	rdfs:label "COUNTRY NAME" .
-
-hr:region_id a rdf:Property ;
-	rdfs:domain hr:countries ;
-	rdfs:range hr:regions ;
-	rdfs:label "REGION ID" .
-
-hr:regions a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "REGIONS" ;
-	rdfs:comment "Oracle HR REGIONS table" .
-
-hr:region_id a rdf:Property ;
-	rdfs:domain hr:regions ;
-	rdfs:range xsd:integer ;
-        rdfs:label "REGION ID" .
-
-hr:region_name a rdf:Property ;
-	rdfs:domain hr:regions ;
-	rdfs:range xsd:string ;
-	rdfs:label "REGION NAME" .
-
-hr:departments a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "DEPARTMENTS" ;
-	rdfs:comment "Oracle HR DEPARTMENT table" .
-
-hr:department_id a rdf:Property ;
-	rdfs:domain hr:departments ;
-	rdfs:range xsd:integer ;
-	rdfs:label "DEPARTMENT ID" .
-
-hr:department_name a rdf:Property ;
-   	rdfs:domain hr:departments ;
-	rdfs:range xsd:string ;
-	rdfs:comment "DEPARTMENT NAME" .
-
-hr:manager_id a rdf:Property ;
- 	rdfs:domain hr:departments ;
-	rdfs:range hr:employees ;
-	rdfs:comment "MANAGER ID" .
-
-hr:location_id a rdf:Property ;
-	rdfs:domain hr:departments ;
-	rdfs:range hr:locations ;
-	rdfs:comment "LOCATION ID" .
-
-hr:employees a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "employees" ;
-	rdfs:comment "Oracle HR EMPLOYEES table" .
-
-hr:employee_id a rdf:Property ;
-	rdfs:domain hr:employees;
-	rdfs:range xsd:integer ;
-	rdfs:label "EMPLOYEE ID" .
-
-hr:first_name a rdf:Property ;
-	rdfs:domain hr:employees;
-	rdfs:range xsd:string ;
-	rdfs:label "FIRST NAME" .
-
-hr:last_name a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range xsd:string ;
-	rdfs:label "LAST NAME" .
-
-hr:email a rdf:Property ;
-	rdfs:domain hr:employees;
-	rdfs:range xsd:string ;
-	rdfs:label "EMAIL" .
-
-hr:phone_number a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range xsd:string ;
-	rdfs:label "PHONE NUMBER" .
-
-hr:hire_date a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range xsd:date ;
-	rdfs:label "HIRE DATE" .
-
-hr:job_id a rdf:Property ;
-	rdfs:domain hr:employees;
-	rdfs:range hr:jobs ;
-	rdfs:label "JOB ID" .
-
-hr:salary a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range xsd:integer ;
-	rdfs:label "SALARY" .
-
-hr:commission_pct a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range xsd:integer ;
-	rdfs:label "COMMISSION PCT" .
-
-hr:manager_id a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range xsd:string ;
-	rdfs:label "MANAGER ID" .
-
-hr:department_id a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range hr:departments ;
-	rdfs:label "DEPARTMENT ID" .
-
-hr:jobs a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "JOBS" ;
-	rdfs:comment "Oracle HR JOBS table" .
-
-hr:job_id a rdf:Property ;
-
-	rdfs:domain hr:jobs ;
-	rdfs:range xsd:string ;
-	rdfs:label "JOB ID" .
-
-hr:job_title a rdf:Property ;
-	rdfs:domain hr:jobs ;
-	rdfs:range xsd:string ;
-	rdfs:label "JOB TITLE" .
-
-hr:min_salary a rdf:Property ;
-	rdfs:domain hr:jobs ;
-	rdfs:range xsd:number;
-	rdfs:label "MIN SALARY" .
-
-hr:max_salary a rdf:Property ;
-	rdfs:domain hr:jobs ;
-	rdfs:range xsd:number;
-	rdfs:label "MAXSALARY" .
-
-hr:job_history a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "JOB HISTORY" ;
-	rdfs:comment "Oracle HR JOB HISTORY table" .
-
-hr:employee_id a rdf:Property ;
-	rdfs:domain hr:job_history ;
-	rdfs:range hr:employees ;
-	rdfs:label "EMPLOYEE ID" .
-
-hr:start_date a rdf:Property ;
-	rdfs:domain hr:job_history ;
-	rdfs:range xsd:date ;
-	rdfs:label "START DATE" .
-
-hr:end_date a rdf:Property ;
-	rdfs:domain hr:job_history ;
-	rdfs:range xsd:date ;
-	rdfs:label "END DATE" .
-
-hr:job_id a rdf:Property ;
-	rdfs:domain hr:job_history ;
-	rdfs:range hr:jobs ;
-	rdfs:label "JOB ID" .
-
-hr:department_id a rdf:Property ;
-	rdfs:domain hr:job_history ;
-	rdfs:range hr:departments ;
-	rdfs:label "DEPARTMENT ID" .
-
-hr:locations a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "LOCATIONS" ;
-	rdfs:comment "Oracle HR JOB LOCATIONS table" .
-
-hr:location_id a rdf:Property ;
-	rdfs:domain hr:locations ;
-	rdfs:range xsd:number ;
-	rdfs:label "LOCATION ID" .
-
-hr:street_address a rdf:Property ;
-	rdfs:domain hr:locations ;
-	rdfs:range xsd:string ;
-	rdfs:label "STREET ADDRESS" .
-
-hr:postal_code a rdf:Property ;
-	rdfs:domain hr:locations ;
-	rdfs:range xsd:string ;
-	rdfs:label "POSTAL CODE" .
-
-hr:city a rdf:Property ;
-	rdfs:domain hr:locations ;
-	rdfs:range xsd:string ;
-	rdfs:label "CITY" .
-
-hr:state_province a rdf:Property ;
-	rdfs:domain hr:locations ;
-	rdfs:range xsd:string ;
-	rdfs:label "STATE PROVINCE" .
-
-hr:country_id a rdf:Property ;
-	rdfs:domain hr:locations ;
-	rdfs:range hr:countries ;
-	rdfs:label "COUNTRY" .
-', '', 'http://localhost:8890/schemas/oraclehr', 0);
-
----------------------------------------------------------------
-
------------ Create IRI Classes -------------
-
-create function DB.DBA.JOB_HISTORY (in EMPLOYEE_ID integer, in
-START_DATE date) returns varchar
-{
-  return sprintf_or_null
-('http://localhost:8890/oraclehr/job_history/%d_%s#this',
-  EMPLOYEE_ID, cast (START_DATE as varchar) );
-}
-;
-
-create function DB.DBA.JOB_HISTORY_INV_1 (in id varchar) returns integer
-{
-  return sprintf_inverse (id,
-'http://localhost:8890/oraclehr/job_history/%d_%s#this',
-2)[0];
-}
-;
-
-create function DB.DBA.JOB_HISTORY_INV_2 (in id varchar) returns date
-{
-  declare exit handler for sqlstate '*' { return NULL; };
-  return cast (sprintf_inverse (id,
-'http://localhost:8890/oraclehr/job_history/%d_%s#this',
-2)[1] as date);
-}
-;
-
-
-GRANT EXECUTE ON DB.DBA.JOB_HISTORY TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON DB.DBA.JOB_HISTORY_URI_INV_1 TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON DB.DBA.JOB_HISTORY_URI_INV_2 TO "SPARQL", "SPARQL_UPDATE";
-
-SPARQL
-
-
-	create iri class <http://localhost:8890/schemas/oraclehr/countries_iri>
-	"http://^{URIQADefaultHost}^/oraclehr/countries/%s#this"
-    	(in COUNTRY_ID varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/oraclehr/regions_iri>
-	"http://^{URIQADefaultHost}^/oraclehr/regions/%d#this"
-	    (in REGION_ID integer not null) .
-
-	create iri class <http://localhost:8890/schemas/oraclehr/departments_iri>
-	"http://^{URIQADefaultHost}^/oraclehr/departments/%d#this"
-	    (in DEPARTMENT_ID integer not null) .
-
-	create iri class <http://localhost:8890/schemas/oraclehr/employees_iri>
-	"http://^{URIQADefaultHost}^/oraclehr/employees/%d#this"
-		(in EMPLOYEE_ID integer not null) .
-
-	create iri class <http://localhost:8890/schemas/oraclehr/jobs_iri>
-	"http://^{URIQADefaultHost}^/oraclehr/jobs/%s#this"
-	    (in JOB_ID varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/oraclehr/job_history_iri>
-		using function DB.DBA.JOB_HISTORY (in EMPLOYEE_ID integer not null, in
-		START_DATE date not null) returns varchar not null,
-		function DB.DBA.JOB_HISTORY_INV_1 (in id varchar) returns integer,
-		function DB.DBA.JOB_HISTORY_INV_2 (in id varchar) returns date
-		option (bijection, returns
-		"http://localhost:8890/oraclehr/job_history/%d_%s#this") .
-
-	create iri class <http://localhost:8890/schemas/oraclehr/locations_iri>
-	"http://^{URIQADefaultHost}^/oraclehr/locations/%d#this"
-	    (in LOCATION_ID integer not null) .
-;
-
---------------------------------------------------------------------
-
-------------- Create Quad Store ------------------------------------
-
-SPARQL
-
-prefix hr: <http://localhost:8890/schemas/oraclehr/>
-
-alter quad storage virtrdf:DefaultQuadStorage
-  FROM HR.orama.COUNTRIES as countries_tbl
-  FROM HR.orama.REGIONS as regions_tbl
-  FROM HR.orama.DEPARTMENTS as departments_tbl
-  FROM HR.orama.EMPLOYEES as employees_tbl
-  FROM HR.orama.EMPLOYEES as employees_tbl_1		### alias required to represent recursive FK relationship (hr: has_manager ) below.
-  FROM HR.orama.JOBS as jobs_tbl
-  FROM HR.orama.JOB_HISTORY as job_history_tbl
-  FROM HR.orama.LOCATIONS as locations_tbl
-{
-  create virtrdf:oraclehr as
-      graph <http://localhost:8890/oraclehr>
-  {
-        hr:countries_iri(countries_tbl.COUNTRY_ID) a hr:countries  as virtrdf:countires_country_id ;
-        hr:country_name countries_tbl.COUNTRY_NAME  as virtrdf:countries_country_name ;
-        hr:region_id hr:regions_iri(regions_tbl.REGION_ID) where (^{countries_tbl.}^.REGION_ID = ^{regions_tbl.}^.REGION_ID)  as virtrdf:countries_region_id .
-
-	hr:regions_iri(regions_tbl.REGION_ID) a hr:regions as virtrdf:regions_region_id ;
-	hr:region_name regions_tbl.REGION_NAME  as virtrdf:regions_region_name .
-
-	hr:departments_iri(departments_tbl.DEPARTMENT_ID) a hr:departments as virtrdf:departments_department_id ;
-	hr:department_name departments_tbl.DEPARTMENT_NAME as virtrdf:departments_department_name ;
-	hr:location_id hr:locations_iri(locations_tbl.LOCATION_ID) where (^{departments_tbl.}^.LOCATION_ID = ^{locations_tbl.}^.LOCATION_ID) as virtrdf:departments_location_id ;
-	hr:manager_id hr:employees_iri(employees_tbl.EMPLOYEE_ID) where (^{departments_tbl.}^.MANAGER_ID = ^{employees_tbl.}^.EMPLOYEE_ID) as virtrdf:departments_manager_id .
-
-	hr:employees_iri(employees_tbl.EMPLOYEE_ID) a hr:employees as virtrdf:employees_employee_id ;
-	hr:department_id hr:departments_iri(departments_tbl.DEPARTMENT_ID) where (^{employees_tbl.}^.DEPARTMENT_ID = ^{departments_tbl.}^.DEPARTMENT_ID) as virtrdf:employees_department_id ;
-	hr:job_id hr:jobs_iri(jobs_tbl.JOB_ID) where (^{employees_tbl.}^.JOB_ID = ^{jobs_tbl.}^.JOB_ID) as virtrdf:employees_job_id ;
-	hr:manager_id employees_tbl.MANAGER_ID as virtrdf:employees_manager_id ;
-	hr:commissin_pct employees_tbl.COMMISSION_PCT as virtrdf:employees_commission_pct ;
-	hr:email employees_tbl.EMAIL as virtrdf:employees_email ;
-	hr:first_name employees_tbl.FIRST_NAME as virtrdf:employees_first_name ;
-	hr:hire_date employees_tbl.HIRE_DATE as virtrdf:employees_hire_date ;
-	hr:last_name employees_tbl.LAST_NAME as virtrdf:employees_last_name ;
-	hr:phone_number employees_tbl.PHONE_NUMBER as virtrdf:employees_phone_number ;
-	hr:salary employees_tbl.SALARY as virtrdf:employees_salary ;
-	hr:has_job_history hr:job_history_iri(job_history_tbl.EMPLOYEE_ID, job_history_tbl.START_DATE) where (^{employees_tbl.}^.EMPLOYEE_ID = ^{job_history_tbl.}^.EMPLOYEE_ID) as virtrdf:employees_has_job_history;
-	hr:has_manager hr:employees_iri(employees_tbl_1.EMPLOYEE_ID) where (^{employees_tbl.}^.MANAGER_ID = ^{employees_tbl_1.}^.EMPLOYEE_ID) as virtrdf:employees_has_manager.
-
-	hr:locations_iri(locations_tbl.LOCATION_ID) a hr:locations as virtrdf:locations_location_id ;
-	hr:country_id hr:countries_iri(countries_tbl.COUNTRY_ID) where (^{locations_tbl.}^.COUNTRY_ID = ^{countries_tbl.}^.COUNTRY_ID) as virtrdf:locations_country_id ;
-	hr:city locations_tbl.CITY as virtrdf:locations_city ;
-	hr:postal_code locations_tbl.POSTAL_CODE as virtrdf:locations_postal_code ;
-	hr:state_province locations_tbl.STATE_PROVINCE as virtrdf:locations_state_province ;
-	hr:street_address locations_tbl.STREET_ADDRESS as virtrdf:locations_street_address .
-
-	hr:jobs_iri(jobs_tbl.JOB_ID) a hr:jobs as virtrdf:jobs_job_id ;
-	hr:job_title jobs_tbl.JOB_TITLE as virtrdf:jobs_job_title ;
-	hr:max_salary jobs_tbl.MAX_SALARY as virtrdf:jobs_max_salary ;
-	hr:min_salary jobs_tbl.MIN_SALARY as virtrdf:jobs_min_salary .
-
-	hr:job_history_iri(job_history_tbl.EMPLOYEE_ID, job_history_tbl.START_DATE) a hr:job_history as virtrdf:job_history_pk ;
-	hr:employee_id hr:employees_iri(employees_tbl.EMPLOYEE_ID) where (^{job_history_tbl.}^.EMPLOYEE_ID = ^{employees_tbl.}^.EMPLOYEE_ID) as virtrdf:job_history_employee_id ;
-	hr:department_id hr:departments_iri(departments_tbl.DEPARTMENT_ID) where (^{job_history_tbl.}^.DEPARTMENT_ID = ^{departments_tbl.}^.DEPARTMENT_ID) as virtrdf:job_history_department_id ;
-	hr:job_id hr:jobs_iri(jobs_tbl.JOB_ID) where (^{job_history_tbl.}^.JOB_ID = ^{jobs_tbl.}^.JOB_ID) as virtrdf:job_history_job_id ;
-	hr:start_date job_history_tbl.START_DATE as virtrdf:job_history_start_date ;
-	hr:end_date job_history_tbl.END_DATE as virtrdf:job_history_end_date .
-
-        }.
-}.
-;
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'oraclehr_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'oraclehr_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'oraclehr_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'oraclehr_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/oraclehr%%3E&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'oraclehr_rule_list1',
-    1,
-    vector (
-  	 	'oraclehr_rule1',
-  	 	'oraclehr_rule2'
-	  ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/oraclehr');
-
-VHOST_DEFINE (
-	lpath=>'/oraclehr',
-	ppath=>'/DAV/oraclehr/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'oraclehr_rule_list1')
-	);
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'oracle_schemas_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'oracle_schemas_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'oracle_schemas_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'oracle_schemas_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/oraclehr%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path','path','*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'oracle_schemas_rule_list1',
-    1,
-    vector (
-  	 	'oracle_schemas_rule1',
-  	 	'oracle_schemas_rule2'
-          ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/schema/oraclehr');
-
-VHOST_DEFINE (
-	lpath=>'/schemas/oraclehr',
-	ppath=>'/DAV/schemas/oraclehr/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'oracle_schemas_rule_list1')
-	);
-
-DB.DBA.XML_SET_NS_DECL ('hr', 'http://^{URIQADefaultHost}^/schemas/oraclehr/', 2);
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfviewsenterprohd">
-      <title>Oracle using the demonstration 'Human Resources' database</title>
-<para><emphasis>Live links to a sample instance</emphasis></para>
-<itemizedlist mark="bullet">
-<listitem><ulink url="http://demo.openlinksw.com/sparql?default-graph-uri=&should-sponge=&query=%20prefix%20hr%3A%20%3Chttp%3A%2F%2Fdemo.openlinksw.com%2Fschemas%2Foraclehr%2F%3E%20select%20*%20from%20%3Chttp%3A%2F%2Fdemo.openlinksw.com%2Foraclehr%3E%20WHERE%20%7B%3Fs%20a%20hr%3Aemployees%7D&format=text%2Fhtml&debug=on">list all employee URIs</ulink></listitem>
-<listitem><ulink url="http://demo.openlinksw.com/about/html/http/demo.openlinksw.com/oraclehr/employees/105">description of employee 105</ulink></listitem>
-</itemizedlist>
-<para><emphasis>Script to set up your own instance</emphasis></para>
-<programlisting><![CDATA[
--- Setup script for RDF views of Oracle 10 Human Resources Sample Database --
-
-GRANT SELECT ON HR.orama.COUNTRIES TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON HR.orama.REGIONS TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON HR.orama.DEPARTMENTS TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON HR.orama.LOCATIONS TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON HR.orama.EMPLOYEES TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON HR.orama.JOBS TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON HR.orama.JOB_HISTORY TO "SPARQL", "SPARQL_UPDATE";
-
--------------------------------------------------------------------
-
--------- Create rdfs:Class definitions ----------------------------
-
-ttlp (
-'
- at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
- at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
-
- at prefix hr: <http://localhost:8890/schemas/oraclehr/> .
-
-hr:countries a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "COUNTRIES" ;
-	rdfs:comment "Oracle HR COUNTRIES table" .
-
-hr:country_id a rdf:Property ;
-	rdfs:domain hr:countries ;
-	rdfs:range xsd:string ;
-	rdfs:label "COUNTRY ID" .
-
-hr:country_name a rdf:Property ;
-	rdfs:domain hr:countries ;
-	rdfs:range xsd:string ;
-	rdfs:label "COUNTRY NAME" .
-
-hr:region_id a rdf:Property ;
-	rdfs:domain hr:countries ;
-	rdfs:range hr:regions ;
-	rdfs:label "REGION ID" .
-
-hr:regions a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "REGIONS" ;
-	rdfs:comment "Oracle HR REGIONS table" .
-
-hr:region_id a rdf:Property ;
-	rdfs:domain hr:regions ;
-	rdfs:range xsd:integer ;
-        rdfs:label "REGION ID" .
-
-hr:region_name a rdf:Property ;
-	rdfs:domain hr:regions ;
-	rdfs:range xsd:string ;
-	rdfs:label "REGION NAME" .
-
-hr:departments a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "DEPARTMENTS" ;
-	rdfs:comment "Oracle HR DEPARTMENT table" .
-
-hr:department_id a rdf:Property ;
-	rdfs:domain hr:departments ;
-	rdfs:range xsd:integer ;
-	rdfs:label "DEPARTMENT ID" .
-
-hr:department_name a rdf:Property ;
-   	rdfs:domain hr:departments ;
-	rdfs:range xsd:string ;
-	rdfs:comment "DEPARTMENT NAME" .
-
-hr:manager_id a rdf:Property ;
- 	rdfs:domain hr:departments ;
-	rdfs:range hr:employees ;
-	rdfs:comment "MANAGER ID" .
-
-hr:location_id a rdf:Property ;
-	rdfs:domain hr:departments ;
-	rdfs:range hr:locations ;
-	rdfs:comment "LOCATION ID" .
-
-hr:employees a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "employees" ;
-	rdfs:comment "Oracle HR EMPLOYEES table" .
-
-hr:employee_id a rdf:Property ;
-	rdfs:domain hr:employees;
-	rdfs:range xsd:integer ;
-	rdfs:label "EMPLOYEE ID" .
-
-hr:first_name a rdf:Property ;
-	rdfs:domain hr:employees;
-	rdfs:range xsd:string ;
-	rdfs:label "FIRST NAME" .
-
-hr:last_name a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range xsd:string ;
-	rdfs:label "LAST NAME" .
-
-hr:email a rdf:Property ;
-	rdfs:domain hr:employees;
-	rdfs:range xsd:string ;
-	rdfs:label "EMAIL" .
-
-hr:phone_number a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range xsd:string ;
-	rdfs:label "PHONE NUMBER" .
-
-hr:hire_date a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range xsd:date ;
-	rdfs:label "HIRE DATE" .
-
-hr:job_id a rdf:Property ;
-	rdfs:domain hr:employees;
-	rdfs:range hr:jobs ;
-	rdfs:label "JOB ID" .
-
-hr:salary a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range xsd:integer ;
-	rdfs:label "SALARY" .
-
-hr:commission_pct a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range xsd:integer ;
-	rdfs:label "COMMISSION PCT" .
-
-hr:manager_id a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range xsd:string ;
-	rdfs:label "MANAGER ID" .
-
-hr:department_id a rdf:Property ;
-	rdfs:domain hr:employees ;
-	rdfs:range hr:departments ;
-	rdfs:label "DEPARTMENT ID" .
-
-hr:jobs a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "JOBS" ;
-	rdfs:comment "Oracle HR JOBS table" .
-
-hr:job_id a rdf:Property ;
-
-	rdfs:domain hr:jobs ;
-	rdfs:range xsd:string ;
-	rdfs:label "JOB ID" .
-
-hr:job_title a rdf:Property ;
-	rdfs:domain hr:jobs ;
-	rdfs:range xsd:string ;
-	rdfs:label "JOB TITLE" .
-
-hr:min_salary a rdf:Property ;
-	rdfs:domain hr:jobs ;
-	rdfs:range xsd:number;
-	rdfs:label "MIN SALARY" .
-
-hr:max_salary a rdf:Property ;
-	rdfs:domain hr:jobs ;
-	rdfs:range xsd:number;
-	rdfs:label "MAXSALARY" .
-
-hr:job_history a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "JOB HISTORY" ;
-	rdfs:comment "Oracle HR JOB HISTORY table" .
-
-hr:employee_id a rdf:Property ;
-	rdfs:domain hr:job_history ;
-	rdfs:range hr:employees ;
-	rdfs:label "EMPLOYEE ID" .
-
-hr:start_date a rdf:Property ;
-	rdfs:domain hr:job_history ;
-	rdfs:range xsd:date ;
-	rdfs:label "START DATE" .
-
-hr:end_date a rdf:Property ;
-	rdfs:domain hr:job_history ;
-	rdfs:range xsd:date ;
-	rdfs:label "END DATE" .
-
-hr:job_id a rdf:Property ;
-	rdfs:domain hr:job_history ;
-	rdfs:range hr:jobs ;
-	rdfs:label "JOB ID" .
-
-hr:department_id a rdf:Property ;
-	rdfs:domain hr:job_history ;
-	rdfs:range hr:departments ;
-	rdfs:label "DEPARTMENT ID" .
-
-hr:locations a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
-	rdfs:label "LOCATIONS" ;
-	rdfs:comment "Oracle HR JOB LOCATIONS table" .
-
-hr:location_id a rdf:Property ;
-	rdfs:domain hr:locations ;
-	rdfs:range xsd:number ;
-	rdfs:label "LOCATION ID" .
-
-hr:street_address a rdf:Property ;
-	rdfs:domain hr:locations ;
-	rdfs:range xsd:string ;
-	rdfs:label "STREET ADDRESS" .
-
-hr:postal_code a rdf:Property ;
-	rdfs:domain hr:locations ;
-	rdfs:range xsd:string ;
-	rdfs:label "POSTAL CODE" .
-
-hr:city a rdf:Property ;
-	rdfs:domain hr:locations ;
-	rdfs:range xsd:string ;
-	rdfs:label "CITY" .
-
-hr:state_province a rdf:Property ;
-	rdfs:domain hr:locations ;
-	rdfs:range xsd:string ;
-	rdfs:label "STATE PROVINCE" .
-
-hr:country_id a rdf:Property ;
-	rdfs:domain hr:locations ;
-	rdfs:range hr:countries ;
-	rdfs:label "COUNTRY" .
-', '', 'http://localhost:8890/schemas/oraclehr', 0);
-
----------------------------------------------------------------
-
------------ Create IRI Classes -------------
-
-create function DB.DBA.JOB_HISTORY (in EMPLOYEE_ID integer, in
-START_DATE date) returns varchar
-{
-  return sprintf_or_null
-('http://localhost:8890/oraclehr/job_history/%d_%s#this',
-  EMPLOYEE_ID, cast (START_DATE as varchar) );
-}
-;
-
-create function DB.DBA.JOB_HISTORY_INV_1 (in id varchar) returns integer
-{
-  return sprintf_inverse (id,
-'http://localhost:8890/oraclehr/job_history/%d_%s#this',
-2)[0];
-}
-;
-
-create function DB.DBA.JOB_HISTORY_INV_2 (in id varchar) returns date
-{
-  declare exit handler for sqlstate '*' { return NULL; };
-  return cast (sprintf_inverse (id,
-'http://localhost:8890/oraclehr/job_history/%d_%s#this',
-2)[1] as date);
-}
-;
-
-
-GRANT EXECUTE ON DB.DBA.JOB_HISTORY TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON DB.DBA.JOB_HISTORY_URI_INV_1 TO "SPARQL", "SPARQL_UPDATE";
-GRANT EXECUTE ON DB.DBA.JOB_HISTORY_URI_INV_2 TO "SPARQL", "SPARQL_UPDATE";
-
-SPARQL
-
-
-	create iri class <http://localhost:8890/schemas/oraclehr/countries_iri>
-	"http://^{URIQADefaultHost}^/oraclehr/countries/%s#this"
-    	(in COUNTRY_ID varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/oraclehr/regions_iri>
-	"http://^{URIQADefaultHost}^/oraclehr/regions/%d#this"
-	    (in REGION_ID integer not null) .
-
-	create iri class <http://localhost:8890/schemas/oraclehr/departments_iri>
-	"http://^{URIQADefaultHost}^/oraclehr/departments/%d#this"
-	    (in DEPARTMENT_ID integer not null) .
-
-	create iri class <http://localhost:8890/schemas/oraclehr/employees_iri>
-	"http://^{URIQADefaultHost}^/oraclehr/employees/%d#this"
-		(in EMPLOYEE_ID integer not null) .
-
-	create iri class <http://localhost:8890/schemas/oraclehr/jobs_iri>
-	"http://^{URIQADefaultHost}^/oraclehr/jobs/%s#this"
-	    (in JOB_ID varchar not null) .
-
-	create iri class <http://localhost:8890/schemas/oraclehr/job_history_iri>
-		using function DB.DBA.JOB_HISTORY (in EMPLOYEE_ID integer not null, in
-		START_DATE date not null) returns varchar not null,
-		function DB.DBA.JOB_HISTORY_INV_1 (in id varchar) returns integer,
-		function DB.DBA.JOB_HISTORY_INV_2 (in id varchar) returns date
-		option (bijection, returns
-		"http://localhost:8890/oraclehr/job_history/%d_%s#this") .
-
-	create iri class <http://localhost:8890/schemas/oraclehr/locations_iri>
-	"http://^{URIQADefaultHost}^/oraclehr/locations/%d#this"
-	    (in LOCATION_ID integer not null) .
-;
-
---------------------------------------------------------------------
-
-------------- Create Quad Store ------------------------------------
-
-SPARQL
-
-prefix hr: <http://localhost:8890/schemas/oraclehr/>
-
-alter quad storage virtrdf:DefaultQuadStorage
-  from HR.orama.COUNTRIES as countries_tbl
-  from HR.orama.REGIONS as regions_tbl
-  from HR.orama.DEPARTMENTS as departments_tbl
-  from HR.orama.EMPLOYEES as employees_tbl
-  from HR.orama.EMPLOYEES as employees_tbl_1		### alias required to represent recursive FK relationship (hr: has_manager ) below.
-  from HR.orama.JOBS as jobs_tbl
-  from HR.orama.JOB_HISTORY as job_history_tbl
-  from HR.orama.LOCATIONS as locations_tbl
-{
-  create virtrdf:oraclehr as
-      graph <http://localhost:8890/oraclehr>
-  {
-        hr:countries_iri(countries_tbl.COUNTRY_ID) a hr:countries  as virtrdf:countires_country_id ;
-        hr:country_name countries_tbl.COUNTRY_NAME  as virtrdf:countries_country_name ;
-        hr:region_id hr:regions_iri(regions_tbl.REGION_ID) where (^{countries_tbl.}^.REGION_ID = ^{regions_tbl.}^.REGION_ID)  as virtrdf:countries_region_id .
-
-	hr:regions_iri(regions_tbl.REGION_ID) a hr:regions as virtrdf:regions_region_id ;
-	hr:region_name regions_tbl.REGION_NAME  as virtrdf:regions_region_name .
-
-	hr:departments_iri(departments_tbl.DEPARTMENT_ID) a hr:departments as virtrdf:departments_department_id ;
-	hr:department_name departments_tbl.DEPARTMENT_NAME as virtrdf:departments_department_name ;
-	hr:location_id hr:locations_iri(locations_tbl.LOCATION_ID) where (^{departments_tbl.}^.LOCATION_ID = ^{locations_tbl.}^.LOCATION_ID) as virtrdf:departments_location_id ;
-	hr:manager_id hr:employees_iri(employees_tbl.EMPLOYEE_ID) where (^{departments_tbl.}^.MANAGER_ID = ^{employees_tbl.}^.EMPLOYEE_ID) as virtrdf:departments_manager_id .
-
-	hr:employees_iri(employees_tbl.EMPLOYEE_ID) a hr:employees as virtrdf:employees_employee_id ;
-	hr:department_id hr:departments_iri(departments_tbl.DEPARTMENT_ID) where (^{employees_tbl.}^.DEPARTMENT_ID = ^{departments_tbl.}^.DEPARTMENT_ID) as virtrdf:employees_department_id ;
-	hr:job_id hr:jobs_iri(jobs_tbl.JOB_ID) where (^{employees_tbl.}^.JOB_ID = ^{jobs_tbl.}^.JOB_ID) as virtrdf:employees_job_id ;
-	hr:manager_id employees_tbl.MANAGER_ID as virtrdf:employees_manager_id ;
-	hr:commissin_pct employees_tbl.COMMISSION_PCT as virtrdf:employees_commission_pct ;
-	hr:email employees_tbl.EMAIL as virtrdf:employees_email ;
-	hr:first_name employees_tbl.FIRST_NAME as virtrdf:employees_first_name ;
-	hr:hire_date employees_tbl.HIRE_DATE as virtrdf:employees_hire_date ;
-	hr:last_name employees_tbl.LAST_NAME as virtrdf:employees_last_name ;
-	hr:phone_number employees_tbl.PHONE_NUMBER as virtrdf:employees_phone_number ;
-	hr:salary employees_tbl.SALARY as virtrdf:employees_salary ;
-	hr:has_job_history hr:job_history_iri(job_history_tbl.EMPLOYEE_ID, job_history_tbl.START_DATE) where (^{employees_tbl.}^.EMPLOYEE_ID = ^{job_history_tbl.}^.EMPLOYEE_ID) as virtrdf:employees_has_job_history;
-	hr:has_manager hr:employees_iri(employees_tbl_1.EMPLOYEE_ID) where (^{employees_tbl.}^.MANAGER_ID = ^{employees_tbl_1.}^.EMPLOYEE_ID) as virtrdf:employees_has_manager.
-
-	hr:locations_iri(locations_tbl.LOCATION_ID) a hr:locations as virtrdf:locations_location_id ;
-	hr:country_id hr:countries_iri(countries_tbl.COUNTRY_ID) where (^{locations_tbl.}^.COUNTRY_ID = ^{countries_tbl.}^.COUNTRY_ID) as virtrdf:locations_country_id ;
-	hr:city locations_tbl.CITY as virtrdf:locations_city ;
-	hr:postal_code locations_tbl.POSTAL_CODE as virtrdf:locations_postal_code ;
-	hr:state_province locations_tbl.STATE_PROVINCE as virtrdf:locations_state_province ;
-	hr:street_address locations_tbl.STREET_ADDRESS as virtrdf:locations_street_address .
-
-	hr:jobs_iri(jobs_tbl.JOB_ID) a hr:jobs as virtrdf:jobs_job_id ;
-	hr:job_title jobs_tbl.JOB_TITLE as virtrdf:jobs_job_title ;
-	hr:max_salary jobs_tbl.MAX_SALARY as virtrdf:jobs_max_salary ;
-	hr:min_salary jobs_tbl.MIN_SALARY as virtrdf:jobs_min_salary .
-
-	hr:job_history_iri(job_history_tbl.EMPLOYEE_ID, job_history_tbl.START_DATE) a hr:job_history as virtrdf:job_history_pk ;
-	hr:employee_id hr:employees_iri(employees_tbl.EMPLOYEE_ID) where (^{job_history_tbl.}^.EMPLOYEE_ID = ^{employees_tbl.}^.EMPLOYEE_ID) as virtrdf:job_history_employee_id ;
-	hr:department_id hr:departments_iri(departments_tbl.DEPARTMENT_ID) where (^{job_history_tbl.}^.DEPARTMENT_ID = ^{departments_tbl.}^.DEPARTMENT_ID) as virtrdf:job_history_department_id ;
-	hr:job_id hr:jobs_iri(jobs_tbl.JOB_ID) where (^{job_history_tbl.}^.JOB_ID = ^{jobs_tbl.}^.JOB_ID) as virtrdf:job_history_job_id ;
-	hr:start_date job_history_tbl.START_DATE as virtrdf:job_history_start_date ;
-	hr:end_date job_history_tbl.END_DATE as virtrdf:job_history_end_date .
-
-  } .
-} .
-;
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'oraclehr_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'oraclehr_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'oraclehr_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'oraclehr_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/oraclehr%%3E&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'oraclehr_rule_list1',
-    1,
-    vector (
-  	 	'oraclehr_rule1',
-  	 	'oraclehr_rule2'
-	  ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/oraclehr');
-
-VHOST_DEFINE (
-	lpath=>'/oraclehr',
-	ppath=>'/DAV/oraclehr/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'oraclehr_rule_list1')
-	);
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'oracle_schemas_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'oracle_schemas_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'oracle_schemas_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'oracle_schemas_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/oraclehr%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path','path','*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'oracle_schemas_rule_list1',
-    1,
-    vector (
-  	 	'oracle_schemas_rule1',
-  	 	'oracle_schemas_rule2'
-	  ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/schema/oraclehr');
-
-VHOST_DEFINE (
-	lpath=>'/schemas/oraclehr',
-	ppath=>'/DAV/schemas/oraclehr/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'oracle_schemas_rule_list1')
-	);
-
-DB.DBA.XML_SET_NS_DECL ('hr', 'http://^{URIQADefaultHost}^/schemas/oraclehr/', 2);
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfviewsenterprdb">
-      <title>DB2 using the demonstration 'Sample' database</title>
-<para><emphasis>Version defined using explicit host - localhost:8890</emphasis></para>
-<programlisting><![CDATA[
--- $Id: rdfandsparql.xml,v 1.95.2.36 2010/07/08 15:18:23 source Exp $
--- Setup script for RDF view of portions of DB2 SAMPLE database included
--- in DB2 Express Edition v9.5
---
--- The script assumes external DB2 tables are linked into Virtuoso using
--- local schema name db2sample.
-
-DB..vd_remote_data_source ('db2ma-smpl', '', '<uid>','<pwd>);
-
-ATTACH TABLE  "DB2ADMIN"."ACT"      PRIMARY KEY ("ACTNO")              AS "DB"."db2sample"."ACT"      FROM 'db2ma-smpl';
-ATTACH TABLE  "DB2ADMIN"."DEPARTMENT"      PRIMARY KEY ("DEPTNO")              AS "DB"."db2sample"."DEPARTMENT"      FROM 'db2ma-smpl';
-ATTACH TABLE  "DB2ADMIN"."EMPLOYEE"      PRIMARY KEY ("EMPNO")              AS "DB"."db2sample"."EMPLOYEE"      FROM 'db2ma-smpl';
-ATTACH TABLE  "DB2ADMIN"."EMPPROJACT"      PRIMARY KEY ("EMPNO", "PROJNO", "ACTNO", "EMSTDATE")              AS "DB"."db2sample"."EMPPROJACT"      FROM 'db2ma-smpl';
-ATTACH TABLE  "DB2ADMIN"."EMP_RESUME"      PRIMARY KEY ("EMPNO", "RESUME_FORMAT)              AS "DB"."db2sample"."EMP_RESUME"      FROM 'db2ma-smpl';
-ATTACH TABLE  "DB2ADMIN"."PROJACT"      PRIMARY KEY ("PROJNO", "ACTNO", "ACSTDATE")              AS "DB"."db2sample"."PROJACT"      FROM 'db2ma-smpl';
-ATTACH TABLE  "DB2ADMIN"."PROJECT"      PRIMARY KEY ("PROJNO")              AS "DB"."db2sample"."PROJECT"      FROM 'db2ma-smpl';
-
-COMMIT WORK;
-
-GRANT SELECT ON DB.db2sample.ACT TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON DB.db2sample.DEPARTMENT TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON DB.db2sample.EMPLOYEE TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON DB.db2sample.EMPPROJACT TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON DB.db2sample.EMP_RESUME TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON DB.db2sample.PROJACT TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON DB.db2sample.PROJECT TO "SPARQL", "SPARQL_UPDATE";
-
-create function DB.DBA.PROJ_ACT_IRI (
-  in proj_no varchar,
-  in act_no integer,
-  in ac_st_date date
-  ) returns varchar
-{
-  declare _act_no, _datetime, _date any;
-  _act_no := cast(act_no as varchar);
-  _datetime := cast(ac_st_date as varchar);
-  _date := left(_datetime, 10);
-  return sprintf('http://localhost:8890/db2sample/proj_act/%s_%s_%s#this',
-    proj_no, _act_no, _date);
-};
-
-create function
-DB.DBA.PROJ_ACT_IRI_INV_1 (in proj_act_iri varchar) returns varchar
-{
-  declare exit handler for sqlstate '*' { return NULL; };
-  declare parts any;
-  parts := sprintf_inverse (proj_act_iri,
-   'http://localhost:8890/db2sample/proj_act/%s_%s_%s#this', 1);
-  if (parts is not null)
-  {
-    return parts[0];
-  }
-  return NULL;
-};
-
-create function
-DB.DBA.PROJ_ACT_IRI_INV_2 (in proj_act_iri varchar) returns integer
-{
-  declare exit handler for sqlstate '*' { return NULL; };
-  declare parts any;
-  parts := sprintf_inverse (proj_act_iri,
-   'http://localhost:8890/db2sample/proj_act/%s_%s_%s#this', 1);
-  if (parts is not null)
-  {
-    return cast(parts[1] as integer);
-  }
-  return NULL;
-};
-
-create function
-DB.DBA.PROJ_ACT_IRI_INV_3 (in proj_act_iri varchar) returns date
-{
-  declare exit handler for sqlstate '*' { return NULL; };
-  declare parts any;
-  parts := sprintf_inverse (proj_act_iri,
-   'http://localhost:8890/db2sample/proj_act/%s_%s_%s#this', 1);
-  if (parts is not null)
-  {
-    return cast(parts[2] as date);
-  }
-  return NULL;
-};
-
-create function DB.DBA.EMP_PROJ_ACT_IRI (
-  in emp_no varchar,
-  in proj_no varchar,
-  in act_no integer,
-  in emp_start_date date
-  ) returns varchar
-{
-  declare _act_no, _datetime, _date any;
-  _act_no := cast(act_no as varchar);
-  _datetime := cast(emp_start_date as varchar);
-  _date := left(_datetime, 10);
-  return sprintf(
-      'http://localhost:8890/db2sample/emp_proj_act/%s_%s_%s_%s#this',
-    emp_no, proj_no, _act_no, _date);
-};
-
-create function
-DB.DBA.EMP_PROJ_ACT_IRI_INV_1 (in emp_proj_act_iri varchar) returns varchar
-{
-  declare exit handler for sqlstate '*' { return NULL; };
-  declare parts any;
-  parts := sprintf_inverse (emp_proj_act_iri,
-   'http://localhost:8890/db2sample/emp_proj_act/%s_%s_%s_%s#this', 1);
-  if (parts is not null)
-  {
-    return parts[0];
-  }
-  return NULL;
-};
-
-create function
-DB.DBA.EMP_PROJ_ACT_IRI_INV_2 (in emp_proj_act_iri varchar) returns varchar
-{
-  declare exit handler for sqlstate '*' { return NULL; };
-  declare parts any;
-  parts := sprintf_inverse (emp_proj_act_iri,
-   'http://localhost:8890/db2sample/emp_proj_act/%s_%s_%s_%s#this', 1);
-  if (parts is not null)
-  {
-    return parts[1];
-  }
-  return NULL;
-};
-
-create function
-DB.DBA.EMP_PROJ_ACT_IRI_INV_3 (in emp_proj_act_iri varchar) returns integer
-{
-  declare exit handler for sqlstate '*' { return NULL; };
-  declare parts any;
-  parts := sprintf_inverse (emp_proj_act_iri,
-   'http://localhost:8890/db2sample/emp_proj_act/%s_%s_%s_%s#this', 1);
-  if (parts is not null)
-  {
-    return cast(parts[2] as integer);
-  }
-  return NULL;
-};
-
-create function
-DB.DBA.EMP_PROJ_ACT_IRI_INV_4 (in emp_proj_act_iri varchar) returns date
-{
-  declare exit handler for sqlstate '*' { return NULL; };
-  declare parts any;
-  parts := sprintf_inverse (emp_proj_act_iri,
-   'http://localhost:8890/db2sample/emp_proj_act/%s_%s_%s_%s#this', 1);
-  if (parts is not null)
-  {
-    return cast(parts[3] as date);
-  }
-  return NULL;
-};
-
-grant execute on DB.DBA.PROJ_ACT_IRI to "SPARQL", "SPARQL_UPDATE";
-grant execute on DB.DBA.PROJ_ACT_IRI_INV_1 to "SPARQL", "SPARQL_UPDATE";
-grant execute on DB.DBA.PROJ_ACT_IRI_INV_2 to "SPARQL", "SPARQL_UPDATE";
-grant execute on DB.DBA.PROJ_ACT_IRI_INV_3 to "SPARQL", "SPARQL_UPDATE";
-
-grant execute on DB.DBA.EMP_PROJ_ACT_IRI to "SPARQL", "SPARQL_UPDATE";
-grant execute on DB.DBA.EMP_PROJ_ACT_IRI_INV_1 to "SPARQL", "SPARQL_UPDATE";
-grant execute on DB.DBA.EMP_PROJ_ACT_IRI_INV_2 to "SPARQL", "SPARQL_UPDATE";
-grant execute on DB.DBA.EMP_PROJ_ACT_IRI_INV_3 to "SPARQL", "SPARQL_UPDATE";
-grant execute on DB.DBA.EMP_PROJ_ACT_IRI_INV_4 to "SPARQL", "SPARQL_UPDATE";
-
-SPARQL drop graph <http://localhost:8890/schemas/db2sample> ;
-SPARQL drop graph <http://localhost:8890/db2sample> ;
-
-SPARQL drop quad map virtrdf:db2sample ;
-
---------------------------
--- RDFS class definitions
-ttlp (
-'
- at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
- at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
-
- at prefix opl: <http://localhost:8890/schemas/db2sample/> .
-
-opl:Act a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
-	rdfs:label "Act" ;
-	rdfs:comment "Activity" .
-
-# ACTNO SMALLINT PRIMARY KEY
-opl:act_no a rdf:Property ;
-	rdfs:domain opl:Act ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Activity number" .
-
-# ACTKWD VARCHAR(6)
-opl:act_kwd a rdf:Property ;
-	rdfs:domain opl:Act ;
-	rdfs:range xsd:string ;
-	rdfs:label "Activity keyword" .
-
-# ACTDESC VARCHAR(20)
-opl:act_desc a rdf:Property ;
-	rdfs:domain opl:Act ;
-	rdfs:range xsd:string ;
-	rdfs:label "Activity description" .
-
-#####
-opl:Department a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
-	rdfs:label "Department" ;
-	rdfs:comment "Department" .
-
-# DEPTNO VARCHAR(3) PRIMARY KEY
-opl:dept_no a rdf:Property ;
-	rdfs:domain opl:Department ;
-	rdfs:range xsd:string ;
-	rdfs:label "Department number" .
-
-# DEPTNAME VARCHAR(36)
-opl:dept_name a rdf:Property ;
-	rdfs:domain opl:Department ;
-	rdfs:range xsd:string ;
-	rdfs:label "Department name" .
-
-# MGRNO CHAR(6)
-opl:dept_manager a rdf:Property ;
-	rdfs:domain opl:Department ;
-	rdfs:range xsd:Employee ;
-	rdfs:label "Department manager" .
-
-# ADMRDEPT CHAR(3)
-opl:supervising_dept a rdf:Property ;
-	rdfs:domain opl:Department ;
-	rdfs:range opl:Department ;
-	rdfs:label "Department reported to" .
-
-# LOCATION CHAR(6)
-opl:location a rdf:Property ;
-	rdfs:domain opl:Department ;
-	rdfs:range xsd:string ;
-	rdfs:label "Location" .
-
-opl:employee_collection a rdf:Property ;
-	rdfs:domain opl:Department ;
-	rdfs:range opl:Employee ;
-	rdfs:label "Department employees" .
-
-opl:dept_project_collection a rdf:Property ;
-	rdfs:domain opl:Department ;
-	rdfs:range opl:Project ;
-	rdfs:label "Department projects" .
-
-#####
-opl:Employee a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
-	rdfs:label "Employee" ;
-	rdfs:comment "Employee" .
-
-# EMPNO VARCHAR(6) PRIMARY KEY
-opl:emp_no a rdf:Property ;
-	rdfs:domain opl:Employee;
-	rdfs:range xsd:string ;
-	rdfs:label "Employee number" .
-
-# FIRSTNME VARCHAR(12)
-opl:first_name a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range xsd:string ;
-	rdfs:label "First name" .
-
-# MIDINIT VARCHAR(1)
-opl:middle_initial a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range xsd:string ;
-	rdfs:label "Middle initial" .
-
-# LASTNAME VARCHAR(15)
-opl:last_name a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range xsd:string ;
-	rdfs:label "Last name" .
-
-# WORKDEPT VARCHAR(3)
-opl:work_dept a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range opl:Department ;
-	rdfs:label "Work department" .
-
-# PHONENO VARCHAR(4)
-opl:phone_no a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range xsd:string ;
-	rdfs:label "Phone number" .
-
-# HIREDATE DATE
-opl:hire_date a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range xsd:date ;
-	rdfs:label "Hire date" .
-
-# JOB VARCHAR(8)
-opl:job a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range xsd:string ;
-	rdfs:label "Job" .
-
-# EDLEVEL SMALLINT
-opl:education_level a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Education level" .
-
-# SEX VARCHAR(1)
-opl:gender a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range xsd:string ;
-	rdfs:label "Gender" .
-
-# BIRTHDATE DATE
-opl:date_of_birth a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range xsd:date ;
-	rdfs:label "Date of birth" .
-
-# SALARY DECIMAL(9,2)
-opl:salary a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Salary" .
-
-# BONUS DECIMAL(9,2)
-opl:bonus a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Bonus" .
-
-# COMM DECIMAL(9,2)
-opl:commission a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Commission" .
-
-opl:resume_collection a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range opl:EmployeeResume ;
-	rdfs:label "Employee resumes" .
-
-opl:projects_responsible_for_collection a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range opl:Project ;
-	rdfs:label "responsible for project" .
-
-opl:activity_collection a rdf:Property ;
-	rdfs:domain opl:Employee ;
-	rdfs:range opl:EmpProjAct ;
-	rdfs:label "project activities" .
-
-#####
-opl:EmpProjAct a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
-	rdfs:label "EmpProjAct" ;
-	rdfs:comment "Employee project activity" .
-
-# EMPNO VARCHAR(6) PRIMARY KEY
-opl:epa_emp_no a rdf:Property ;
-	rdfs:domain opl:EmpProjAct ;
-	rdfs:range xsd:string ;
-	rdfs:label "Employee number" .
-
-# PROJNO VARCHAR(6) PRIMARY KEY
-opl:epa_proj_no a rdf:Property ;
-	rdfs:domain opl:EmpProjAct ;
-	rdfs:range xsd:string ;
-	rdfs:label "Project number" .
-
-# ACTNO SMALLINT PRIMARY KEY
-opl:epa_act_no a rdf:Property ;
-	rdfs:domain opl:EmpProjAct ;
-	rdfs:range xsd:string ;
-	rdfs:label "Activity number" .
-
-# EMSTDATE DATE PRIMARY KEY
-opl:emp_start_date a rdf:Property ;
-	rdfs:domain opl:EmpProjAct ;
-	rdfs:range xsd:date ;
-	rdfs:label "Employee activity start date" .
-
-# EMPTIME DECIMAL(5,2)
-opl:emp_time a rdf:Property ;
-	rdfs:domain opl:EmpProjAct ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Employee time" .
-
-# EMENDATE DATE PRIMARY KEY
-opl:emp_end_date a rdf:Property ;
-	rdfs:domain opl:EmpProjAct ;
-	rdfs:range xsd:date ;
-	rdfs:label "Employee activity end date" .
-
-opl:assigned_to a rdf:Property ;
-	rdfs:domain opl:EmpProjAct ;
-	rdfs:range opl:Employee ;
-	rdfs:label "Assigned to" .
-
-opl:project_activity a rdf:Property ;
-	rdfs:domain opl:EmpProjAct ;
-	rdfs:range opl:ProjAct ;
-	rdfs:label "Project activity" .
-
-#####
-opl:EmployeeResume a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
-	rdfs:label "EmployeeResume" ;
-	rdfs:comment "Employee resume" .
-
-# EMPNO VARCHAR(6) PRIMARY KEY
-opl:er_emp_no a rdf:Property ;
-	rdfs:domain opl:EmployeeResume ;
-	rdfs:range xsd:string ;
-	rdfs:label "Employee number" .
-
-# RESUME_FORMAT VARCHAR(10) PRIMARY KEY
-opl:resume_format a rdf:Property ;
-	rdfs:domain opl:EmployeeResume ;
-	rdfs:range xsd:string ;
-	rdfs:label "Resume format" .
-
-# RESUME VARCHAR(5120)
-opl:resume a rdf:Property ;
-	rdfs:domain opl:EmployeeResume ;
-	rdfs:range xsd:string ;
-	rdfs:label "Resume" .
-
-opl:resume_of a rdf:Property ;
-	rdfs:domain opl:EmployeeResume ;
-	rdfs:range opl:Employee ;
-	rdfs:label "Resume subject" .
-
-#####
-opl:ProjAct a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
-	rdfs:label "ProjAct" ;
-	rdfs:comment "Project activity" .
-
-# PROJNO VARCHAR(6) PRIMARY KEY
-opl:pa_proj_no a rdf:Property ;
-	rdfs:domain opl:ProjAct ;
-	rdfs:range xsd:string ;
-	rdfs:label "Project number" .
-
-# ACTNO SMALLINT PRIMARY KEY
-opl:pa_act_no a rdf:Property ;
-	rdfs:domain opl:ProjAct ;
-	rdfs:range xsd:string ;
-	rdfs:label "Activity number" .
-
-# ACSTDATE DATE PRIMARY KEY
-opl:ac_st_date a rdf:Property ;
-	rdfs:domain opl:ProjAct ;
-	rdfs:range xsd:date ;
-	rdfs:label "Activity start date" .
-
-# ACSTAFF DECIMAL(5,2)
-opl:ac_staff a rdf:Property ;
-	rdfs:domain opl:ProjAct ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Acstaff" .
-
-# ACENDATE DATE
-opl:ac_en_date a rdf:Property ;
-	rdfs:domain opl:ProjAct ;
-	rdfs:range xsd:date ;
-	rdfs:label "Activity end date" .
-
-opl:project a rdf:Property ;
-	rdfs:domain opl:ProjAct ;
-	rdfs:range opl:Project ;
-	rdfs:label "Project" .
-
-opl:activity a rdf:Property ;
-	rdfs:domain opl:ProjAct ;
-	rdfs:range opl:Act ;
-	rdfs:label "Activity" .
-
-opl:employee_activity_collection a rdf:Property ;
-	rdfs:domain opl:ProjAct ;
-	rdfs:range opl:EmpProjAct ;
-	rdfs:label "Employee activity collection" .
-
-#####
-opl:Project a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
-	rdfs:label "Project" ;
-	rdfs:comment "Project" .
-
-# PROJNO VARCHAR(6) PRIMARY KEY
-opl:proj_no a rdf:Property ;
-	rdfs:domain opl:Project ;
-	rdfs:range xsd:string ;
-	rdfs:label "Project number" .
-
-# PROJNAME VARCHAR(24)
-opl:proj_name a rdf:Property ;
-	rdfs:domain opl:Project ;
-	rdfs:range xsd:string ;
-	rdfs:label "Project name" .
-
-# DEPTNO CHAR(3)
-opl:is_project_of_department a rdf:Property ;
-	rdfs:domain opl:Project ;
-	rdfs:range opl:Department ;
-	rdfs:label "is project of department" .
-
-# RESPEMP VARCHAR(6)
-opl:resp_emp a rdf:Property ;
-	rdfs:domain opl:Project ;
-	rdfs:range opl:Employee ;
-	rdfs:label "Employee responsible" .
-
-# PRSTAFF DECIMAL(5,2)
-opl:pr_staff a rdf:Property ;
-	rdfs:domain opl:Project ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "PrStaff" .
-
-# PRSTDATE DATE
-opl:pr_st_date a rdf:Property ;
-	rdfs:domain opl:Project ;
-	rdfs:range xsd:date ;
-	rdfs:label "Project start date" .
-
-# PRENDATE DATE
-opl:pr_en_date a rdf:Property ;
-	rdfs:domain opl:Project ;
-	rdfs:range xsd:date ;
-	rdfs:label "Project end date" .
-
-# MAJPROJ VARCHAR(6)
-opl:maj_proj a rdf:Property ;
-	rdfs:domain opl:Project ;
-	rdfs:range xsd:string ;
-	rdfs:label "MajProj" .
-
-opl:proj_activity_collection a rdf:Property ;
-	rdfs:domain opl:Project ;
-	rdfs:range opl:ProjAct ;
-	rdfs:label "Project activities" .
-
-', '', 'http://localhost:8890/schemas/db2sample', 0);
-
---------------------------
-
-SPARQL
-prefix opl: <http://localhost:8890/schemas/db2sample/>
-
-create iri class
-<http://localhost:8890/schemas/db2sample/act_iri>
-	"http://localhost:8890/db2sample/act/%d#this"
-	(
-	 in act_no integer not null
-	) .
-
-create iri class
-<http://localhost:8890/schemas/db2sample/department_iri>
-	"http://localhost:8890/db2sample/department/%s#this"
-	(
-	 in dept_no varchar not null
-	) .
-
-create iri class
-<http://localhost:8890/schemas/db2sample/employee_iri>
-	"http://localhost:8890/db2sample/employee/%s#this"
-	(
-	 in emp_no varchar not null
-	) .
-
-create iri class opl:emp_proj_act_iri using
-	function DB.DBA.EMP_PROJ_ACT_IRI (
-	 	in emp_no varchar,
-	 	in proj_no varchar,
-	 	in act_no integer,
-	 	in emp_start_date date
-		) returns varchar,
-	function DB.DBA.EMP_PROJ_ACT_IRI_INV_1 (in emp_proj_act_iri varchar)
-		returns varchar ,
-	function DB.DBA.EMP_PROJ_ACT_IRI_INV_2 (in emp_proj_act_iri varchar)
-		returns varchar ,
-	function DB.DBA.EMP_PROJ_ACT_IRI_INV_3 (in emp_proj_act_iri varchar)
-		returns integer ,
-	function DB.DBA.EMP_PROJ_ACT_IRI_INV_4 (in emp_proj_act_iri varchar)
-		returns date
-	option (bijection, returns
-	  "http://localhost:8890/db2sample/emp_proj_act/%s_%s_%s_%s#this")
-	.
-
-
-create iri class
-<http://localhost:8890/schemas/db2sample/employee_resume_iri>
-	"http://localhost:8890/db2sample/employee_resume/%s_%s#this"
-	(
-	 in emp_no varchar not null,
-	 in resume_format varchar not null
-	) .
-
-create iri class opl:proj_act_iri using
-	function DB.DBA.PROJ_ACT_IRI (
-		in proj_no varchar,
-		in act_no integer,
-		in ac_st_date date
-		) returns varchar,
-	function DB.DBA.PROJ_ACT_IRI_INV_1 (in proj_act_iri varchar)
-		returns varchar ,
-	function DB.DBA.PROJ_ACT_IRI_INV_2 (in proj_act_iri varchar)
-		returns integer ,
-	function DB.DBA.PROJ_ACT_IRI_INV_3 (in proj_act_iri varchar)
-		returns date
-	option (bijection, returns
-		"http://localhost:8890/db2sample/proj_act/%s_%s_%s#this")
-	.
-
-create iri class
-<http://localhost:8890/schemas/db2sample/project_iri>
-	"http://localhost:8890/db2sample/project/%s#this"
-	(
-	 in proj_no varchar not null
-	) .
-;
-
-SPARQL
-prefix opl: <http://localhost:8890/schemas/db2sample/>
-
-alter quad storage virtrdf:DefaultQuadStorage
-from DB.db2sample.ACT as act_tbl
-from DB.db2sample.DEPARTMENT as dept_tbl
-from DB.db2sample.EMPLOYEE as emp_tbl
-from DB.db2sample.EMPPROJACT as emp_proj_act_tbl
-from DB.db2sample.EMP_RESUME as emp_resume_tbl
-from DB.db2sample.PROJACT as proj_act_tbl
-from DB.db2sample.PROJECT as project_tbl
-{
-	create virtrdf:db2sample as
-		graph <http://localhost:8890/db2sample>
-    {
-	opl:act_iri(act_tbl.ACTNO) a opl:Act
-		as virtrdf:act_id ;
-	opl:act_no act_tbl.ACTNO
-		as virtrdf:act_act_no ;
-	opl:act_kwd act_tbl.ACTKWD
-		as virtrdf:act_act_kwd ;
-	opl:act_desc act_tbl.ACTDESC
-		as virtrdf:act_act_desc .
-
-	opl:department_iri(dept_tbl.DEPTNO) a opl:Department
-		as virtrdf:dept_id ;
-	opl:dept_no dept_tbl.DEPTNO
-		as virtrdf:dept_dept_no ;
-	opl:dept_name dept_tbl.DEPTNAME
-		as virtrdf:dept_dept_name ;
-	opl:dept_manager opl:employee_iri(dept_tbl.MGRNO)
-		as virtrdf:dept_mgr_no ;
-	opl:supervising_dept opl:department_iri(dept_tbl.ADMRDEPT)
-		as virtrdf:dept_supervising_dept ;
-	opl:location dept_tbl.LOCATION
-		as virtrdf:dept_location ;
-	opl:employee_collection opl:employee_iri(emp_tbl.EMPNO)
-		where (^{emp_tbl.}^.WORKDEPT = ^{dept_tbl.}^.DEPTNO)
-		as virtrdf:dept_employee_collection ;
-	opl:dept_project_collection opl:project_iri(project_tbl.PROJNO)
-		where (^{project_tbl.}^.DEPTNO = ^{dept_tbl.}^.DEPTNO)
-		as virtrdf:dept_project_collection .
-
-	opl:employee_iri(emp_tbl.EMPNO) a opl:Employee
-		as virtrdf:employee_id ;
-	opl:emp_no emp_tbl.EMPNO
-		as virtrdf:employee_emp_no ;
-	opl:first_name emp_tbl.FIRSTNME
-		as virtrdf:employee_first_name ;
-	opl:middle_initial emp_tbl.MIDINIT
-		as virtrdf:employee_middle_initial ;
-	opl:last_name emp_tbl.LASTNAME
-		as virtrdf:employee_last_name ;
-	opl:work_dept opl:department_iri(emp_tbl.WORKDEPT)
-		as virtrdf:employee_work_dept ;
-	opl:phone_no emp_tbl.PHONENO
-		as virtrdf:employee_phone_no ;
-	opl:hire_date emp_tbl.HIREDATE
-		as virtrdf:employee_hire_date ;
-	opl:job emp_tbl.JOB
-		as virtrdf:employee_job ;
-	opl:education_level emp_tbl.EDLEVEL
-		as virtrdf:employee_education_level ;
-	opl:gender emp_tbl.SEX
-		as virtrdf:employee_gender ;
-	opl:date_of_birth emp_tbl.BIRTHDATE
-		as virtrdf:employee_date_of_birth ;
-	opl:salary emp_tbl.SALARY
-		as virtrdf:employee_salary ;
-	opl:bonus emp_tbl.BONUS
-		as virtrdf:employee_bonus ;
-	opl:commission emp_tbl.COMM
-		as virtrdf:employee_commission ;
-	opl:resume_collection opl:employee_resume_iri(
-		emp_resume_tbl.EMPNO,
-		emp_resume_tbl.RESUME_FORMAT
-		)
-		where (^{emp_tbl.}^.EMPNO = ^{emp_resume_tbl.}^.EMPNO)
-		as virtrdf:employee_resume_collection ;
-	opl:projects_responsible_for_collection
- 		opl:project_iri(project_tbl.PROJNO)
-		where (^{project_tbl.}^.RESPEMP = ^{emp_tbl.}^.EMPNO)
-		as virtrdf:employee_projects_responsible_for_collection ;
-	opl:activity_collection opl:emp_proj_act_iri(
-		emp_proj_act_tbl.EMPNO,
-		emp_proj_act_tbl.PROJNO,
-		emp_proj_act_tbl.ACTNO,
-		emp_proj_act_tbl.EMSTDATE
-		)
-		where (^{emp_tbl.}^.EMPNO = ^{emp_proj_act_tbl.}^.EMPNO)
-		as virtrdf:employee_activity_collection .
-
-	opl:emp_proj_act_iri(
-		emp_proj_act_tbl.EMPNO,
-		emp_proj_act_tbl.PROJNO,
-		emp_proj_act_tbl.ACTNO,
-		emp_proj_act_tbl.EMSTDATE
-		) a opl:EmpProjAct
-		as virtrdf:empprojact_id ;
-	opl:epa_emp_no emp_proj_act_tbl.EMPNO
-		as virtrdf:empprojact_emp_no ;
-	opl:epa_proj_no emp_proj_act_tbl.PROJNO
-		as virtrdf:empprojact_proj_no ;
-	opl:epa_act_no emp_proj_act_tbl.ACTNO
-		as virtrdf:empprojact_act_no ;
-	opl:emp_start_date emp_proj_act_tbl.EMSTDATE
-		as virtrdf:empprojact_emp_start_date ;
-	opl:emp_time emp_proj_act_tbl.EMPTIME
-		as virtrdf:empprojact_emp_time ;
-	opl:emp_end_date emp_proj_act_tbl.EMENDATE
-		as virtrdf:empprojact_emp_end_date ;
-	opl:assigned_to opl:employee_iri(emp_proj_act_tbl.EMPNO)
-		as virtrdf:empprojact_assigned_to ;
-	opl:project_activity opl:proj_act_iri(
-		emp_proj_act_tbl.PROJNO,
-		emp_proj_act_tbl.ACTNO,
-		emp_proj_act_tbl.EMSTDATE
-		)
-		as virtrdf:empprojact_project_activity .
-
-	opl:employee_resume_iri(
-		emp_resume_tbl.EMPNO,
-		emp_resume_tbl.RESUME_FORMAT
-		) a opl:EmployeeResume
-		as virtrdf:employee_resume_id ;
-	opl:er_emp_no emp_resume_tbl.EMPNO
-		as virtrdf:employee_resume_emp_no ;
-	opl:resume_format emp_resume_tbl.RESUME_FORMAT
-		as virtrdf:employee_resume_resume_format ;
-	opl:resume emp_resume_tbl.RESUME
-		as virtrdf:employee_resume_resume ;
-	opl:resume_of opl:employee_iri(emp_resume_tbl.EMPNO)
-		as virtrdf:employee_resume_resume_of .
-
-	opl:proj_act_iri(
-		proj_act_tbl.PROJNO,
-		proj_act_tbl.ACTNO,
-		proj_act_tbl.ACSTDATE
-		) a opl:ProjAct
-		as virtrdf:projact_id;
-	opl:pa_proj_no proj_act_tbl.PROJNO
-		as virtrdf:projact_proj_no ;
-	opl:pa_act_no proj_act_tbl.ACTNO
-		as virtrdf:projact_act_no ;
-	opl:ac_st_date proj_act_tbl.ACSTDATE
-		as virtrdf:projact_ac_st_date ;
-	opl:ac_staff proj_act_tbl.ACSTAFF
-		as virtrdf:projact_ac_staff ;
-	opl:ac_en_date proj_act_tbl.ACENDATE
-		as virtrdf:projact_ac_en_date ;
-	opl:project opl:project_iri(proj_act_tbl.PROJNO)
-		as virtrdf:projact_project ;
-	opl:activity opl:act_iri(proj_act_tbl.ACTNO)
-		as virtrdf:projact_activity ;
-	opl:employee_activity_collection opl:emp_proj_act_iri(
-		emp_proj_act_tbl.EMPNO,
-		emp_proj_act_tbl.PROJNO,
-		emp_proj_act_tbl.ACTNO,
-		emp_proj_act_tbl.EMSTDATE
-		)
-		where (
-		^{proj_act_tbl.}^.PROJNO = ^{emp_proj_act_tbl.}^.PROJNO AND
-	        ^{proj_act_tbl.}^.ACTNO = ^{emp_proj_act_tbl.}^.ACTNO AND
-	        ^{proj_act_tbl.}^.ACSTDATE = ^{emp_proj_act_tbl.}^.EMSTDATE
-	        )
-		as virtrdf:project_employee_activity_collection .
-
-	opl:project_iri(project_tbl.PROJNO) a opl:Project
-		as virtrdf:project_id ;
-	opl:proj_no project_tbl.PROJNO
-		as virtrdf:project_proj_no ;
-	opl:proj_name project_tbl.PROJNAME
-		as virtrdf:project_proj_name ;
-	opl:is_project_of_department opl:department_iri(project_tbl.DEPTNO)
-		as virtrdf:project_is_project_of_department ;
-	opl:resp_emp opl:employee_iri(project_tbl.RESPEMP)
-		as virtrdf:project_resp_emp ;
-	opl:pr_staff project_tbl.PRSTAFF
-		as virtrdf:project_pr_staff ;
-	opl:pr_st_date project_tbl.PRSTDATE
-		as virtrdf:project_pr_st_date ;
-	opl:pr_en_date project_tbl.PRENDATE
-		as virtrdf:project_pr_en_date ;
-	opl:maj_proj project_tbl.MAJPROJ
-		as virtrdf:project_maj_proj ;
-	opl:proj_activity_collection opl:proj_act_iri(
-		proj_act_tbl.PROJNO,
-		proj_act_tbl.ACTNO,
-		proj_act_tbl.ACSTDATE
-		)
-		where (^{project_tbl.}^.PROJNO = ^{proj_act_tbl.}^.PROJNO)
-		as virtrdf:project_activity_collection .
-  } .
-} .
-;
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'db2sample_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'db2sample_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'db2sample_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/localhost:8890%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'db2sample_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/db2sample%%3E&format=%U',
-
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'db2sample_rule_list1',
-    1,
-    vector (
-  	 	'db2sample_rule1',
-  	 	'db2sample_rule2'
-	  ));
-
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/db2sample');
-
-VHOST_DEFINE (
-	lpath=>'/db2sample',
-	ppath=>'/DAV/db2sample/',
-	vsp_user=>'dba',
-    	is_dav=>1,
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'db2sample_rule_list1')
-	);
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'db2sample_schema_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'db2sample_schema_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'db2sample_schema_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/localhost:8890%U',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'db2sample_schema_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/db2sample%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path','path','*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'db2sample_schema_rule_list1',
-    1,
-    vector (
-  	 	'db2sample_schema_rule1',
-  	 	'db2sample_schema_rule2'
-	  ));
-
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/schemas/db2sample');
-
-VHOST_DEFINE (
-	lpath=>'/schemas/db2sample',
-	ppath=>'/DAV/schemas_db2sample/',
-	vsp_user=>'dba',
-    	is_dav=>1,
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'db2sample_schema_rule_list1')
-	);
+    <xsl:param name="baseUri"/>
+...
+    <xsl:variable name="resourceURL">
+	<xsl:value-of select="$baseUri"/>
+    </xsl:variable>
+...
+    <xsl:template match="/">
+	<rdf:RDF>
+	    <rdf:Description rdf:about="{$resourceURL}">
+		<rdf:type rdf:resource="Document"/>
+		<rdf:type rdf:resource="Document"/>
+		<rdf:type rdf:resource="Container"/>
+		<sioc:container_of rdf:resource="{vi:proxyIRI ($resourceURL)}"/>
+		<foaf:primaryTopic rdf:resource="{vi:proxyIRI ($resourceURL)}"/>
+		<dcterms:subject rdf:resource="{vi:proxyIRI ($resourceURL)}"/>
+	    </rdf:Description>
+	    <rdf:Description rdf:about="{vi:proxyIRI ($resourceURL)}">
+		<rdf:type rdf:resource="Item"/>
+		<sioc:has_container rdf:resource="{$resourceURL}"/>
+		<xsl:apply-templates/>
+	    </rdf:Description>
+	</rdf:RDF>
+    </xsl:template>
+...
 ]]></programlisting>
-    </sect4>
-    <sect4 id="rdfviewsenterprinf">
-      <title>Informix using demonstration 'Stores' database</title>
-<programlisting><![CDATA[
-DB..vd_remote_data_source ('inf10_stores_demo_rdf', '', '<uid>','<pwd>');
-
-ATTACH TABLE  "informix"."call_type"  PRIMARY KEY ("call_code")                  AS "stores_demo_rdf"."inf10_stores_demo_rdf"."call_type"  FROM 'inf10_stores_demo_rdf';
-ATTACH TABLE  "informix"."catalog"    PRIMARY KEY ("catalog_num")                AS "stores_demo_rdf"."inf10_stores_demo_rdf"."catalog"    FROM 'inf10_stores_demo_rdf';
-ATTACH TABLE  "informix"."cust_calls" PRIMARY KEY ("customer_num", "call_dtime") AS "stores_demo_rdf"."inf10_stores_demo_rdf"."cust_calls" FROM 'inf10_stores_demo_rdf';
-ATTACH TABLE  "informix"."customer"   PRIMARY KEY ("customer_num")               AS "stores_demo_rdf"."inf10_stores_demo_rdf"."customer"   FROM 'inf10_stores_demo_rdf';
-ATTACH TABLE  "informix"."items"      PRIMARY KEY ("item_num", "order_num")      AS "stores_demo_rdf"."inf10_stores_demo_rdf"."items"      FROM 'inf10_stores_demo_rdf';
-ATTACH TABLE  "informix"."manufact"   PRIMARY KEY ("manu_code")                  AS "stores_demo_rdf"."inf10_stores_demo_rdf"."manufact"   FROM 'inf10_stores_demo_rdf';
-ATTACH TABLE  "informix"."msgs"       PRIMARY KEY ("lang", "number", "message")  AS "stores_demo_rdf"."inf10_stores_demo_rdf"."msgs"       FROM 'inf10_stores_demo_rdf';
-ATTACH TABLE  "informix"."orders"     PRIMARY KEY ("order_num")                  AS "stores_demo_rdf"."inf10_stores_demo_rdf"."orders"     FROM 'inf10_stores_demo_rdf';
-ATTACH TABLE  "informix"."state"      PRIMARY KEY ("code", "sname")              AS "stores_demo_rdf"."inf10_stores_demo_rdf"."state"      FROM 'inf10_stores_demo_rdf';
-ATTACH TABLE  "informix"."stock"      PRIMARY KEY ("stock_num", "manu_code")     AS "stores_demo_rdf"."inf10_stores_demo_rdf"."stock"      FROM 'inf10_stores_demo_rdf';
-
-COMMIT WORK;
-
-GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.items      TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.catalog    TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.msgs       TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.state      TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.orders     TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.stock      TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.customer   TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.call_type  TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.manufact   TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.cust_calls TO "SPARQL", "SPARQL_UPDATE";
-GRANT SPARQL_UPDATE to "SPARQL";
-
-
-create function DB.DBA.CUST_CALLS_IRI (in customer_num integer, in call_dtime datetime) returns varchar
-{
-	declare _call_dtime any;
-	_call_dtime := cast(call_dtime as varchar);
-	return sprintf('http://localhost:8890/informix/stores_demo/cust_calls/%d_%U#this', customer_num, _call_dtime);
-};
-
-create function DB.DBA.CUST_CALLS_IRI_INV_1 (in cust_calls_iri varchar) returns integer
-{
-  declare parts any;
-	parts := sprintf_inverse(cust_calls_iri, 'http://localhost:8890/informix/stores_demo/cust_calls/%d_%U#this', 1);
-  if (parts is not null)
-    {
-    return parts[0];
-    }
-  return NULL;
-};
-
-create function DB.DBA.CUST_CALLS_IRI_INV_2 (in cust_calls_iri varchar) returns datetime
-{
-  declare parts any;
-	parts := sprintf_inverse(cust_calls_iri, 'http://localhost:8890/informix/stores_demo/cust_calls/%d_%U#this', 1);
-  if (parts is not null)
-    {
-		return parts[1];
-    }
-  return NULL;
-};
-
-
-grant execute on DB.DBA.CUST_CALLS_IRI to "SPARQL", "SPARQL_UPDATE";
-grant execute on DB.DBA.CUST_CALLS_IRI_INV_1 to "SPARQL", "SPARQL_UPDATE";
-grant execute on DB.DBA.CUST_CALLS_IRI_INV_2 to "SPARQL", "SPARQL_UPDATE";
-
-
--------- Create rdfs:Class definitions ----------------------------
-
-ttlp (
-'
- at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
- at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
-
- at prefix items:   <http://localhost:8890/schemas/informix/stores_demo/items/> .
- at prefix catalog: <http://localhost:8890/schemas/informix/stores_demo/catalog/> .
- at prefix stock:   <http://localhost:8890/schemas/informix/stores_demo/stock/> .
- at prefix msgs:    <http://localhost:8890/schemas/informix/stores_demo/msgs/> .
- at prefix state:   <http://localhost:8890/schemas/informix/stores_demo/state/> .
- at prefix orders:  <http://localhost:8890/schemas/informix/stores_demo/orders/> .
- at prefix manuf:   <http://localhost:8890/schemas/informix/stores_demo/manufact/> .
- at prefix cust:    <http://localhost:8890/schemas/informix/stores_demo/customer/> .
- at prefix callt:   <http://localhost:8890/schemas/informix/stores_demo/call_type/> .
- at prefix custc:   <http://localhost:8890/schemas/informix/stores_demo/cust_calls/> .
-
-
-
-items:Items a rdfs:Class ;
-	rdfs:label "Items" ;
-	rdfs:comment "Informix SD items table" .
-
-items:item_num a rdf:Property ;
-	rdfs:domain items:Items ;
-	rdfs:range xsd:integer ;
-	rdfs:label "ITEM NUMBER" .
-
-items:quantity a rdf:Property ;
-	rdfs:domain items:Items ;
-	rdfs:range xsd:integer ;
-	rdfs:label "QUANTITY" .
-
-items:total_price a rdf:Property ;
-	rdfs:domain items:Items ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "TOTAL PRICE" .
-
-items:order_num_fk a rdf:Property ;
-	rdfs:domain items:Items ;
-	rdfs:range orders:Orders ;
-	rdfs:label "ORDER NUMBER" .
-
-items:stock_num_fk a rdf:Property ;
-	rdfs:domain items:Items ;
-	rdfs:range stock:Stock ;
-	rdfs:label "STOCK NUMBER" .
-
-items:manu_code_fk a rdf:Property ;
-	rdfs:domain items:Items ;
-	rdfs:range stock:Stock ;
-	rdfs:label "MANUAL CODE" .
-
-
-
-catalog:Catalog a rdfs:Class ;
-	rdfs:label "Catalog" ;
-	rdfs:comment "Informix SD catalog table" .
-
-catalog:manu_code a rdf:Property ;
-	rdfs:domain catalog:Catalog ;
-	rdfs:range xsd:integer ;
-	rdfs:label "MANUAL CODE" .
-
-catalog:cat_descr a rdf:Property ;
-	rdfs:domain catalog:Catalog ;
-	rdfs:range xsd:string ;
-	rdfs:label "CATALOG DESCRIPTION" .
-
-catalog:cat_picture a rdf:Property ;
-	rdfs:domain catalog:Catalog ;
-	rdfs:range xsd:byte ;
-	rdfs:label "CATALOG PICTURE" .
-
-catalog:cat_advert a rdf:Property ;
-	rdfs:domain catalog:Catalog ;
-	rdfs:range xsd:string ;
-	rdfs:label "CATALOG ADVERT" .
-
-catalog:catalog_num_fk a rdf:Property ;
-	rdfs:domain catalog:Catalog ;
-	rdfs:range stock:Stock ;
-	rdfs:label "CATALOG NUMBER" .
-
-catalog:stock_num_fk a rdf:Property ;
-	rdfs:domain catalog:Catalog ;
-	rdfs:range stock:Stock ;
-	rdfs:label "STOCK NUMBER" .
-
-
-
-msgs:Msgs a rdfs:Class ;
-	rdfs:label "Msgs" ;
-	rdfs:comment "Informix SD msgs table" .
-
-msgs:lang a rdf:Property ;
-	rdfs:domain msgs:Msgs ;
-	rdfs:range xsd:string ;
-	rdfs:label "LANGUAGE" .
-
-msgs:number a rdf:Property ;
-	rdfs:domain msgs:Msgs ;
-	rdfs:range xsd:integer ;
-	rdfs:label "NUMBER" .
-
-msgs:message a rdf:Property ;
-	rdfs:domain msgs:Msgs ;
-	rdfs:range xsd:string ;
-	rdfs:label "MESSAGE" .
-
-
-
-state:State a rdfs:Class ;
-	rdfs:label "State" ;
-	rdfs:comment "Informix SD state table" .
-
-state:code a rdf:Property ;
-	rdfs:domain state:State ;
-	rdfs:range xsd:string ;
-	rdfs:label "STATE CODE" .
-
-state:sname a rdf:Property ;
-	rdfs:domain state:State ;
-	rdfs:range xsd:string ;
-	rdfs:label "STATE NAME" .
-
-
-
-orders:Orders a rdfs:Class ;
-	rdfs:label "Orders" ;
-	rdfs:comment "Informix SD orders table" .
-
-orders:order_num a rdf:Property ;
-	rdfs:domain orders:Orders ;
-	rdfs:range xsd:integer ;
-	rdfs:label "ORDER NUMBER" .
-
-orders:order_date a rdf:Property ;
-	rdfs:domain orders:Orders ;
-	rdfs:range xsd:date;
-	rdfs:label "ORDER DATE" .
-
-orders:ship_instruct a rdf:Property ;
-	rdfs:domain orders:Orders ;
-	rdfs:range xsd:string ;
-	rdfs:label "SHIPPING INSTRUCTION" .
-
-orders:backlog a rdf:Property ;
-	rdfs:domain orders:Orders ;
-	rdfs:range xsd:string ;
-	rdfs:label "BACKLOG" .
-
-orders:po_num a rdf:Property ;
-	rdfs:domain orders:Orders ;
-	rdfs:range xsd:string ;
-	rdfs:label "PURCHASE ORDER NUMBER" .
-
-orders:ship_date a rdf:Property ;
-	rdfs:domain orders:Orders ;
-	rdfs:range xsd:date ;
-	rdfs:label "SHIPPING DATE" .
-
-orders:ship_weight a rdf:Property ;
-	rdfs:domain orders:Orders ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "SHIPPING WEIGHT" .
-
-orders:ship_charge a rdf:Property ;
-	rdfs:domain orders:Orders ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "SHIPPING CHARGE" .
-
-orders:paid_date a rdf:Property ;
-	rdfs:domain orders:Orders ;
-	rdfs:range xsd:date ;
-	rdfs:label "PAID DATE" .
-
-orders:customer_num_fk a rdf:Property ;
-	rdfs:domain orders:Orders ;
-	rdfs:range cust:Customer ;
-	rdfs:label "CUSTOMER NUMBER" .
-
-
-
-stock:Stock a rdfs:Class ;
-	rdfs:label "Stock" ;
-	rdfs:comment "Informix SD stock table" .
-
-stock:stock_num a rdf:Property ;
-	rdfs:domain stock:Stock ;
-	rdfs:range xsd:integer ;
-	rdfs:label "STOCK NUMBER" .
-
-stock:description a rdf:Property ;
-	rdfs:domain stock:Stock ;
-	rdfs:range xsd:string ;
-	rdfs:label "DESCRIPTION" .
-
-stock:unit_price a rdf:Property ;
-	rdfs:domain stock:Stock ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "UNIT PRICE" .
-
-stock:unit a rdf:Property ;
-	rdfs:domain stock:Stock ;
-	rdfs:range xsd:string ;
-	rdfs:label "UNIT" .
-
-stock:unit_descr a rdf:Property ;
-	rdfs:domain stock:Stock ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "UNIT DESCRIPTION" .
-
-stock:manu_code_fk a rdf:Property ;
-	rdfs:domain stock:Stock ;
-	rdfs:range manuf:Manufact ;
-	rdfs:label "MANUAL CODE" .
-
-
-
-cust:Customer a rdfs:Class ;
-	rdfs:label "Customer" ;
-	rdfs:comment "Informix SD customer table" .
-
-cust:customer_num a rdf:Property ;
-	rdfs:domain cust:Customer ;
-	rdfs:range xsd:integer ;
-	rdfs:label "CUSTOMER NUMBER" .
-
-cust:fname a rdf:Property ;
-	rdfs:domain cust:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "FIRST NAME" .
-
-cust:lname a rdf:Property ;
-	rdfs:domain cust:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "LAST NAME" .
-
-cust:company a rdf:Property ;
-	rdfs:domain cust:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "COMPANY" .
-
-cust:address1 a rdf:Property ;
-	rdfs:domain cust:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "ADDRESS1" .
-
-cust:address2 a rdf:Property ;
-	rdfs:domain cust:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "ADDRESS2" .
-
-cust:city a rdf:Property ;
-	rdfs:domain cust:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "CITY" .
-
-cust:state a rdf:Property ;
-	rdfs:domain cust:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "STATE" .
-
-cust:zipcode a rdf:Property ;
-	rdfs:domain cust:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "ZIP CODE" .
-
-cust:phone a rdf:Property ;
-	rdfs:domain cust:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "PHONE NUMBER" .
-
-
-
-callt:Call_type a rdfs:Class ;
-	rdfs:label "Call_type" ;
-	rdfs:comment "Informix SD call_type table" .
-
-callt:call_code a rdf:Property ;
-	rdfs:domain callt:Call_type ;
-	rdfs:range xsd:string ;
-	rdfs:label "CALL CODE" .
-
-callt:code_descr a rdf:Property ;
-	rdfs:domain callt:Call_type ;
-	rdfs:range xsd:string ;
-	rdfs:label "CODE DESCRIPTION" .
-
-
-
-manuf:Manufact a rdfs:Class ;
-	rdfs:label "Manufact" ;
-	rdfs:comment "Informix SD manufact table" .
-
-manuf:manu_code a rdf:Property ;
-	rdfs:domain manuf:Manufact ;
-	rdfs:range xsd:string ;
-	rdfs:label "MANUFACTURE CODE" .
-
-manuf:manu_name a rdf:Property ;
-	rdfs:domain manuf:Manufact ;
-	rdfs:range xsd:string ;
-	rdfs:label "MANUFACTURE NAME" .
-
-manuf:lead_time a rdf:Property ;
-	rdfs:domain manuf:Manufact ;
-	rdfs:range xsd:integer ;
-	rdfs:label "LEAD TIME" .
-
-
-
-custc:Cust_calls a rdfs:Class ;
-	rdfs:label "Cust_calls" ;
-	rdfs:comment "Informix SD cust_calls table" .
-
-custc:call_dtime a rdf:Property ;
-	rdfs:domain manuf:Cust_calls ;
-	rdfs:range xsd:datetime ;
-	rdfs:label "CALL TIME" .
-
-custc:user_id a rdf:Property ;
-	rdfs:domain manuf:Cust_calls ;
-	rdfs:range xsd:string ;
-	rdfs:label "USER ID" .
-
-custc:call_descr a rdf:Property ;
-	rdfs:domain manuf:Cust_calls ;
-	rdfs:range xsd:string ;
-	rdfs:label "CALL DESCRIPTION" .
-
-custc:res_dtime a rdf:Property ;
-	rdfs:domain manuf:Cust_calls ;
-	rdfs:range xsd:datetime ;
-	rdfs:label "RES TIME" .
-
-custc:res_descr a rdf:Property ;
-	rdfs:domain manuf:Cust_calls ;
-	rdfs:range xsd:string ;
-	rdfs:label "RES DESCRIPTION" .
-
-custc:customer_num_fk a rdf:Property ;
-	rdfs:domain manuf:Cust_calls ;
-	rdfs:range cust:Customer ;
-	rdfs:label "CUSTOMER NUM" .
-
-custc:call_code_fk a rdf:Property ;
-	rdfs:domain manuf:Cust_calls ;
-	rdfs:range callt:Call_type ;
-	rdfs:label "CALL CODE" .
-
-
-', '', 'http://localhost:8890/schemas/informix/stores_demo', 0);
-
-
-
------------ Create IRI Classes -------------
-
-
-
-
-SPARQL
-
-prefix items:   <http://localhost:8890/schemas/informix/stores_demo/items/>
-prefix catalog: <http://localhost:8890/schemas/informix/stores_demo/catalog/>
-prefix stock:   <http://localhost:8890/schemas/informix/stores_demo/stock/>
-prefix msgs:    <http://localhost:8890/schemas/informix/stores_demo/msgs/>
-prefix state:   <http://localhost:8890/schemas/informix/stores_demo/state/>
-prefix orders:  <http://localhost:8890/schemas/informix/stores_demo/orders/>
-prefix manuf:   <http://localhost:8890/schemas/informix/stores_demo/manufact/>
-prefix cust:    <http://localhost:8890/schemas/informix/stores_demo/customer/>
-prefix callt:   <http://localhost:8890/schemas/informix/stores_demo/call_type/>
-prefix custc:   <http://localhost:8890/schemas/informix/stores_demo/cust_calls/>
-
-create iri class items:items_iri
-	"http://localhost:8890/informix/stores_demo/items/%d_%d#this"
-	(in item_num integer not null, in order_num integer not null) .
-
-create iri class catalog:catalog_iri
-	"http://localhost:8890/informix/stores_demo/catalog/%d#this"
-    	(in catalog_num integer not null) .
-
-create iri class msgs:msgs_iri
-	"http://localhost:8890/informix/stores_demo/msgs/%U_%d_%U#this"
-    	(in _lang varchar not null, in number integer not null, in message varchar not null) .
-
-create iri class state:state_iri
-	"http://localhost:8890/informix/stores_demo/state/%U#this"
-    	(in code varchar not null) .
-
-create iri class orders:orders_iri
-	"http://localhost:8890/informix/stores_demo/orders/%d#this"
-    	(in order_num integer not null) .
-
-create iri class stock:stock_iri
-	"http://localhost:8890/informix/stores_demo/stock/%d_%U#this"
-    	(in stock_num integer not null, in manu_code varchar not null) .
-
-create iri class cust:customer_iri
-	"http://localhost:8890/informix/stores_demo/customer/%d#this"
-    	(in customer_num integer not null) .
-
-create iri class callt:call_type_iri
-	"http://localhost:8890/informix/stores_demo/call_type/%U#this"
-    	(in call_code varchar not null) .
-
-create iri class manuf:manufact_iri
-	"http://localhost:8890/informix/stores_demo/manufact/%U#this"
-    	(in manu_code varchar not null) .
-
-create iri class custc:cust_calls_iri using
-	function DB.DBA.CUST_CALLS_IRI (in customer_num integer, in call_dtime datetime) returns varchar,
-	function DB.DBA.CUST_CALLS_IRI_INV_1 (in cust_calls_iri varchar) returns integer,
-        function DB.DBA.CUST_CALLS_IRI_INV_2 (in cust_calls_iri varchar) returns datetime .
-;
-
-
-
-
-
-
-
-------------- Create Quad Store ------------------------------------
-
-SPARQL
-
-prefix items:   <http://localhost:8890/schemas/informix/stores_demo/items/>
-prefix catalog: <http://localhost:8890/schemas/informix/stores_demo/catalog/>
-prefix stock:   <http://localhost:8890/schemas/informix/stores_demo/stock/>
-prefix msgs:    <http://localhost:8890/schemas/informix/stores_demo/msgs/>
-prefix state:   <http://localhost:8890/schemas/informix/stores_demo/state/>
-prefix orders:  <http://localhost:8890/schemas/informix/stores_demo/orders/>
-prefix manuf:   <http://localhost:8890/schemas/informix/stores_demo/manufact/>
-prefix cust:    <http://localhost:8890/schemas/informix/stores_demo/customer/>
-prefix callt:   <http://localhost:8890/schemas/informix/stores_demo/call_type/>
-prefix custc:   <http://localhost:8890/schemas/informix/stores_demo/cust_calls/>
-
-alter quad storage virtrdf:DefaultQuadStorage
-  from stores_demo_rdf.inf10_stores_demo_rdf.items      as items_tbl
-  from stores_demo_rdf.inf10_stores_demo_rdf.catalog    as catalog_tbl
-  from stores_demo_rdf.inf10_stores_demo_rdf.msgs       as msgs_tbl
-  from stores_demo_rdf.inf10_stores_demo_rdf.state      as state_tbl
-  from stores_demo_rdf.inf10_stores_demo_rdf.orders     as orders_tbl
-  from stores_demo_rdf.inf10_stores_demo_rdf.stock      as stock_tbl
-  from stores_demo_rdf.inf10_stores_demo_rdf.customer   as customer_tbl
-  from stores_demo_rdf.inf10_stores_demo_rdf.call_type  as call_type_tbl
-  from stores_demo_rdf.inf10_stores_demo_rdf.manufact   as manufact_tbl
-  from stores_demo_rdf.inf10_stores_demo_rdf.cust_calls as cust_calls_tbl
-{
-  create virtrdf:informix_stores_demo as graph <http://localhost:8890/informix/stores_demo>
-  {
-    items:items_iri (items_tbl.item_num, items_tbl.order_num) a items:Items as virtrdf:items_pk ;
-    items:item_num    items_tbl.item_num       as virtrdf:items_item_num ;
-    items:order_num   items_tbl.order_num      as virtrdf:items_order_num ;
-    items:stock_num   items_tbl.stock_num      as virtrdf:items_stock_num ;
-    items:manu_code   items_tbl.manu_code      as virtrdf:items_manu_code ;
-    items:quantity    items_tbl.quantity       as virtrdf:items_quantity ;
-    items:total_price items_tbl.total_price    as virtrdf:items_total_price ;
-    items:from_order  orders:orders_iri (orders_tbl.order_num) where (^{items_tbl.}^.order_num = ^{orders_tbl.}^.order_num) as virtrdf:Items-from_order ;
-    items:has_stock   stock:stock_iri (stock_tbl.stock_num, stock_tbl.manu_code) where (^{items_tbl.}^.stock_num = ^{stock_tbl.}^.stock_num and ^{items_tbl.}^.manu_code = ^{stock_tbl.}^.manu_code)  as virtrdf:Item-has_stock .
-
-    catalog:catalog_iri (catalog_tbl.catalog_num) a catalog:Catalog as virtrdf:catalog_num;
-    catalog:stock_num   catalog_tbl.stock_num    as virtrdf:catalog_stock_num ;
-    catalog:manu_code   catalog_tbl.manu_code    as virtrdf:catalog_manu_code ;
-    catalog:cat_descr   catalog_tbl.cat_descr    as virtrdf:catalog_cat_descr ;
-    catalog:cat_picture catalog_tbl.cat_picture  as virtrdf:catalog_cat_picture ;
-    catalog:cat_advert  catalog_tbl.cat_advert   as virtrdf:catalog_cat_advert ;
-    catalog:has_stock   stock:stock_iri (stock_tbl.stock_num, stock_tbl.manu_code) where (^{catalog_tbl.}^.stock_num = ^{stock_tbl.}^.stock_num and ^{catalog_tbl.}^.manu_code = ^{stock_tbl.}^.manu_code)  as virtrdf:Catalog-has_stock .
-
-    msgs:msgs_iri (msgs_tbl.lang, msgs_tbl.number, msgs_tbl.message) a msgs:Msgs as virtrdf:msgs_pk ;
-    msgs:lang     msgs_tbl.lang    as virtrdf:msgs_lang ;
-    msgs:number   msgs_tbl.number  as virtrdf:msgs_number ;
-    msgs:message  msgs_tbl.message as virtrdf:msgs_message .
-
-    state:state_iri (state_tbl.code) a state:State as virtrdf:code ;
-    state:code   state_tbl.code   as virtrdf:state_code ;
-    state:sname  state_tbl.sname  as virtrdf:state_sname .
-
-    orders:orders_iri (orders_tbl.order_num) a orders:Orders as virtrdf:order_num ;
-    orders:order_num     orders_tbl.order_num     as virtrdf:orders_order_num ;
-    orders:order_date    orders_tbl.order_date    as virtrdf:orders_order_date ;
-    orders:customer_num  orders_tbl.customer_num  as virtrdf:orders_customer_num ;
-    orders:ship_instruct orders_tbl.ship_instruct as virtrdf:orders_ship_instruct ;
-    orders:backlog       orders_tbl.backlog       as virtrdf:orders_backlog ;
-    orders:po_num        orders_tbl.po_num        as virtrdf:orders_po_num ;
-    orders:ship_date     orders_tbl.ship_date     as virtrdf:orders_ship_date ;
-    orders:ship_weight   orders_tbl.ship_weight   as virtrdf:orders_ship_weight ;
-    orders:ship_charge   orders_tbl.ship_charge   as virtrdf:orders_ship_charge ;
-    orders:paid_date     orders_tbl.paid_date     as virtrdf:orders_paid_date ;
-    orders:has_customer cust:customer_iri (customer_tbl.customer_num) where (^{orders_tbl.}^.customer_num = ^{customer_tbl.}^.customer_num) as virtrdf:Orders-has_customer ;
-    orders:has_item     items:items_iri (items_tbl.item_num, items_tbl.order_num) where (^{orders_tbl.}^.order_num = ^{items_tbl.}^.order_num) as virtrdf:Orders-has_item .
-
-    stock:stock_iri (stock_tbl.stock_num, stock_tbl.manu_code) a stock:Stock as virtrdf:stock_pk ;
-    stock:stock_num    stock_tbl.stock_num    as virtrdf:stock_stock_num ;
-    stock:manu_code    stock_tbl.manu_code    as virtrdf:stock_manu_code ;
-    stock:description  stock_tbl.description  as virtrdf:stock_description ;
-    stock:unit_price   stock_tbl.unit_price   as virtrdf:stock_unit_price ;
-    stock:unit         stock_tbl.unit         as virtrdf:stock_unit ;
-    stock:unit_descr   stock_tbl.unit_descr   as virtrdf:stock_unit_descr ;
-    stock:manufactured_by manuf:manufact_iri (manufact_tbl.manu_code) where (^{stock_tbl.}^.manu_code = ^{manufact_tbl.}^.manu_code) as virtrdf:Stock-manufactured_by ;
-    stock:in_catalog  catalog:catalog_iri (catalog_tbl.catalog_num) where (^{stock_tbl.}^.stock_num = ^{catalog_tbl.}^.stock_num and ^{stock_tbl.}^.manu_code = ^{catalog_tbl.}^.manu_code) as virtrdf:Stock-in_catalog ;
-    stock:in_item     items:items_iri (items_tbl.item_num, items_tbl.order_num) where (^{stock_tbl.}^.stock_num = ^{items_tbl.}^.stock_num and ^{stock_tbl.}^.manu_code = ^{items_tbl.}^.manu_code) as virtrdf:Stock-in_items .
-
-
-    cust:customer_iri (customer_tbl.customer_num) a cust:Customer as virtrdf:customer_num ;
-    cust:customer_num  customer_tbl.customer_num  as virtrdf:customer_customer_num ;
-    cust:fname         customer_tbl.fname         as virtrdf:customer_fname ;
-    cust:lname         customer_tbl.lname         as virtrdf:customer_lname ;
-    cust:company       customer_tbl.company       as virtrdf:customer_company ;
-    cust:address1      customer_tbl.address1      as virtrdf:customer_address1 ;
-    cust:address2      customer_tbl.address2      as virtrdf:customer_address2 ;
-    cust:city          customer_tbl.city          as virtrdf:customer_city ;
-    cust:state         customer_tbl.state         as virtrdf:customer_state ;
-    cust:zipcode       customer_tbl.zipcode       as virtrdf:customer_zipcode ;
-    cust:phone         customer_tbl.phone         as virtrdf:customer_phone ;
-    cust:placed_order orders:orders_iri (orders_tbl.order_num) where (^{customer_tbl.}^.customer_num = ^{orders_tbl.}^.customer_num) as virtrdf:Customer-placed_order ;
-    cust:made_call    custc:cust_calls_iri (cust_calls_tbl.customer_num, cust_calls_tbl.call_dtime ) where (^{customer_tbl.}^.customer_num = ^{cust_calls_tbl.}^.customer_num) as virtrdf:Cust_calls-made_call .
-
-    callt:call_type_iri (call_type_tbl.call_code) a callt:Call_type as virtrdf:call_code ;
-    callt:call_code   call_type_tbl.call_code as virtrdf:call_type_call_code ;
-    callt:code_descr  call_type_tbl.code_descr as virtrdf:call_type_code_descr ;
-    callt:call_is_type  custc:cust_calls_iri (cust_calls_tbl.customer_num, cust_calls_tbl.call_dtime) where (^{call_type_tbl.}^.call_code = ^{cust_calls_tbl.}^.call_code) as virtrdf:Call_type-call_is_type .
-
-    manuf:manufact_iri (manufact_tbl.manu_code) a manuf:Manufact as virtrdf:manu_code ;
-    manuf:manu_code     manufact_tbl.manu_code   as virtrdf:manufact_tbl_manu_code ;
-    manuf:manu_name     manufact_tbl.manu_name   as virtrdf:manufact_tbl_manu_name ;
-    manuf:lead_time     manufact_tbl.lead_time   as virtrdf:manufact_tbl_lead_time ;
-    manuf:manufactures stock:stock_iri (stock_tbl.stock_num, stock_tbl.manu_code) where (^{manufact_tbl.}^.manu_code = ^{stock_tbl.}^.manu_code) as virtrdf:Manufact-manufactures .
-
-    custc:cust_calls_iri  (cust_calls_tbl.customer_num, cust_calls_tbl.call_dtime) a custc:Cust_calls as virtrdf:cust_calls_pk ;
-    custc:user_id    cust_calls_tbl.user_id      as virtrdf:cust_calls_user_id ;
-    custc:call_code  cust_calls_tbl.call_code    as virtrdf:cust_calls_call_code ;
-    custc:call_descr cust_calls_tbl.call_descr   as virtrdf:cust_calls_call_descr ;
-    custc:res_dtime  cust_calls_tbl.res_dtime    as virtrdf:cust_calls_res_dtime ;
-    custc:res_descr  cust_calls_tbl.res_descr    as virtrdf:cust_calls_res_descr ;
-    custc:made_by_customer cust:customer_iri   (customer_tbl.customer_num) where (^{cust_calls_tbl.}^.customer_num = ^{customer_tbl.}^.customer_num) as virtrdf:Cust_calls-made_by_customer ;
-    custc:is_call_type     callt:call_type_iri (call_type_tbl.call_code)   where (^{cust_calls_tbl.}^.call_code    = ^{call_type_tbl.}^.call_code)   as virtrdf:Cust_calls-is_call_type .
-
-  } .
-} .
-;
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'informix_sd_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'informix_sd_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'informix_sd_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'informix_sd_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/informix/stores_demo%%3E&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'informix_sd_rule_list1',
-    1,
-    vector (
-  	 	'informix_sd_rule1',
-  	 	'informix_sd_rule2'
-	  ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/informix/stores_demo');
-
-VHOST_DEFINE (
-	lpath=>'/informix/stores_demo',
-	ppath=>'/DAV/informix/stores_demo/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'informix_sd_rule_list1')
-	);
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'informix_sd_schemas_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'informix_sd_schemas_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'informix_sd_schemas_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'informix_sd_schemas_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/informix/stores_demo%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path','path','*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'informix_sd_schemas_rule_list1',
-    1,
-    vector (
-  	 	'informix_sd_schemas_rule1',
-  	 	'informix_sd_schemas_rule2'
-	  ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/schemas/informix/stores_demo');
-
-VHOST_DEFINE (
-	lpath=>'/schemas/informix/stores_demo',
-	ppath=>'/DAV/schemas/informix/stores_demo/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'informix_sd_schemas_rule_list1')
-	);
-
-DB.DBA.XML_SET_NS_DECL ('items',   'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/items/', 2);
-DB.DBA.XML_SET_NS_DECL ('catalog', 'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/catalog/', 2);
-DB.DBA.XML_SET_NS_DECL ('stock',   'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/stock/', 2);
-DB.DBA.XML_SET_NS_DECL ('msgs',    'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/msgs/', 2);
-DB.DBA.XML_SET_NS_DECL ('state',   'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/state/', 2);
-DB.DBA.XML_SET_NS_DECL ('orders',  'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/orders/', 2);
-DB.DBA.XML_SET_NS_DECL ('manuf',   'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/manufact/', 2);
-DB.DBA.XML_SET_NS_DECL ('cust',    'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/customer/', 2);
-DB.DBA.XML_SET_NS_DECL ('callt',   'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/call_type/', 2);
-DB.DBA.XML_SET_NS_DECL ('custc',   'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/cust_calls/', 2);
+        <para><emphasis>Using SIOC as a Generic Container Model</emphasis></para>
+        <para>The generic resource description wrapper just described uses SIOC to establish the
+container/contained relationship between the source resource and the generated graph. Although the most
+important classes for the generic wrapper are obviously Container and Item, SIOC provides a generic data
+model of containers, items, item types, and associations between items which can be combined with other
+ vocabularies such as FOAF and Dublin Core.</para>
+        <para>SIOC defines a number of other classes, such as User, UserGroup, Role, Site, Forum and
+Post. A separate SIOC types module (T-SIOC) extends the SIOC Core ontology by defining subclasses and
+subproperties of SIOC terms. Subclasses include: AddressBook, BookmarkFolder, Briefcase, EventCalendar,
+ImageGallery, Wiki, Weblog, BlogPost, Wiki plus many others.</para>
+        <para>OpenLink Data Spaces (ODS) uses SIOC extensively as a data space "glue" ontology to
+describe the base data and containment hierarchy of all the items managed by ODS applications
+(Data Spaces). For example, ODS-Weblog is an application of type sioc:Forum. Each ODS-Weblog
+application instance contains blogs of type sioct:Weblog. Each blog is a sioc:container_of posts
+of type sioc:Post.</para>
+        <para>Generally, when deciding how to describe resources handled by your own custom cartridge,
+SIOC provides a useful framework for the description which complements the SIOC-based container model
+adopted throughout the ODS framework.</para>
+        <para><emphasis>Naming Conventions for Sponger Generated Descriptions</emphasis></para>
+        <para>As can be seen from the stylesheet extract just shown, the URI of the resource
+description generated by the Sponger to describe the sponged resource is given by the
+function {vi:proxyIRI ($resourceURL)} where resourceURL is the URL of the original resource
+being sponged. proxyIRI is an XPath extension function defined in rdf_mappers.sql as</para>
+<programlisting><![CDATA[
+xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:proxyIRI', 'DB.DBA.RDF_SPONGE_PROXY_IRI');
 ]]></programlisting>
+        <para>which maps to the Virtuoso/PL procedure DB.DBA.RDF_SPONGE_PROXY_IRI. This procedure in
+turn generates a resource description URI which typically takes the form:
+http://<hostName:port>/about/html/http/<resourceURL>#this</para>
     </sect4>
-    <sect4 id="rdfviewsenterpringr">
-      <title>Ingres using demonstration 'Tutorial' database</title>
+      <sect4 id="virtuosospongercreatecustcartrrgst">
+        <title>Registering & Configuring Cartridges</title>
+        <para>Once you have developed a cartridge, you must register it in the Cartridge Registry
+to have the SPARQL processor recognize and use it. You should have compiled your cartridge hook
+function first by issuing a "create procedure DB.DBA.RDF_LOAD_xxx ..." command through one of
+Virtuoso's SQL interfaces. You can create the required Cartridge Registry entry either by adding
+a row to the SYS_REF_MAPPERS table directly using SQL, or by using the Conductor UI.</para>
+        <sect5 id="virtuosospongercreatecustcartrrgstis">
+        <title>Using SQLs</title>
+        <para>If you choose register your cartridge using SQL, possibly as part of a Virtuoso/PL
+script, the required SQL will typically mirror one of the following INSERT commands.</para>
+        <para>Below, a cartridge for OpenCalais is being installed which will be tried when
+the MIME type of the data being sponged is one of text/plain, text/xml or text/html.
+(The definition of the SYS_RDF_MAPPERS table was introduced earlier in section
+'Cartridge Registry'.)</para>
 <programlisting><![CDATA[
--- Setup script for RDF views of Ingres R3 Tutorial Sample Database --
-
-DB..vd_remote_data_source ('ingiima-tut', '', '<uid>','<pwd>');
-
-ATTACH TABLE  "ingres"."book_list"      PRIMARY KEY ("book_no")              AS "TUT"."ingiima"."book_list"      FROM 'ingiima-tut';
-ATTACH TABLE  "ingres"."book_orders"      PRIMARY KEY ("order_no")              AS "TUT"."ingiima"."book_orders"      FROM 'ingiima-tut';
-ATTACH TABLE  "ingres"."cust_info"      PRIMARY KEY ("cust_no")              AS "TUT"."ingiima"."cust_info"      FROM 'ingiima-tut';
-ATTACH TABLE  "ingres"."cust_orders"      PRIMARY KEY ("order_no")              AS "TUT"."ingiima"."cust_orders"      FROM 'ingiima-tut';
-
-COMMIT WORK;
-
-GRANT SELECT ON TUT.ingiima.book_list TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON TUT.ingiima.book_orders TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON TUT.ingiima.cust_info TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON TUT.ingiima.cust_orders TO "SPARQL", "SPARQL_UPDATE";
-
--------------------------------------------------------------------
-
--------- Create rdfs:Class definitions ----------------------------
-
-ttlp (
-'
- at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
- at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
-
- at prefix tut: <http://localhost:8890/schemas/ingrestut/> .
-
-tut:book_list a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/ingrestut> ;
-	rdfs:label "book_list" ;
-	rdfs:comment "Ingres Tutorial Database book_list table" .
-
-tut:book_no a rdf:Property ;
-	rdfs:domain tut:book_list ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Book No" .
-
-tut:title a rdf:Property ;
-	rdfs:domain tut:book_list ;
-	rdfs:range xsd:string ;
-	rdfs:label "Title" .
-
-tut:author a rdf:Property ;
-	rdfs:domain tut:book_list ;
-	rdfs:range xsd:string ;
-	rdfs:label "Author" .
-
-tut:price a rdf:Property ;
-	rdfs:domain tut:book_list ;
-	rdfs:range xsd:money;
-	rdfs:label "Price" .
-
-tut:category a rdf:Property ;
-	rdfs:domain tut:book_list ;
-	rdfs:range xsd:string ;
-	rdfs:label "Category" .
-
-tut:stock a rdf:Property ;
-	rdfs:domain tut:book_list ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Stock" .
-
-tut:dist_no a rdf:Property ;
-	rdfs:domain tut:book_list ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Dist No" .
-
-tut:book_orders a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/ingrestut> ;
-	rdfs:label "Book Orders" ;
-	rdfs:comment "Ingres Tutorial Database book_orders table" .
-
-tut:order_no a rdf:Property ;
-	rdfs:domain tut:book_orders ;
-	rdfs:range xsd:integer ;
-         rdfs:label "Order No" .
-
-tut:book_no_no a rdf:Property ;
-	rdfs:domain tut:book_orders ;
-	rdfs:range tut:book_list ;
-         rdfs:label "Book No" .
-
-tut:sale_price a rdf:Property ;
-	rdfs:domain tut:book_orders ;
-	rdfs:range xsd:money ;
-         rdfs:label "Sale Price" .
-
-tut:quantity a rdf:Property ;
-	rdfs:domain tut:book_orders ;
-	rdfs:range xsd:integer ;
-         rdfs:label "Quantity" .
-
-tut:extension a rdf:Property ;
-	rdfs:domain tut:book_orders ;
-	rdfs:range xsd:money ;
-         rdfs:label "Extension" .
-
-tut:cust_info a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/ingrestut> ;
-	rdfs:label "Customer Information" ;
-	rdfs:comment "Ingres Tutorial Database cust_info table" .
-
-tut:cust_no a rdf:Property ;
-	rdfs:domain tut:cust_info ;
-	rdfs:range xsd:integer ;
-         rdfs:label "Customer No" .
-
-tut:name a rdf:Property ;
-	rdfs:domain tut:cust_info ;
-	rdfs:range xsd:string ;
-         rdfs:label "Name" .
-
-tut:company a rdf:Property ;
-	rdfs:domain tut:cust_info ;
-	rdfs:range xsd:string ;
-         rdfs:label "Company" .
-
-tut:street a rdf:Property ;
-	rdfs:domain tut:cust_info ;
-	rdfs:range xsd:string;
-         rdfs:label "Street" .
-
-tut:city a rdf:Property ;
-	rdfs:domain tut:cust_info ;
-	rdfs:range xsd:string;
-         rdfs:label "City" .
-
-tut:state a rdf:Property ;
-	rdfs:domain tut:cust_info ;
-	rdfs:range xsd:string;
-         rdfs:label "State" .
-
-tut:city a rdf:Property ;
-	rdfs:domain tut:cust_info ;
-	rdfs:range xsd:string;
-         rdfs:label "City" .
-
-tut:state a rdf:Property ;
-	rdfs:domain tut:cust_info ;
-	rdfs:range xsd:string;
-         rdfs:label "State" .
-
-tut:zip a rdf:Property ;
-	rdfs:domain tut:cust_info ;
-	rdfs:range xsd:string;
-         rdfs:label "Zip Code" .
-
-tut:card_no a rdf:Property ;
-	rdfs:domain tut:cust_info ;
-	rdfs:range xsd:string;
-         rdfs:label "Card No" .
-
-tut:exp_date a rdf:Property ;
-	rdfs:domain tut:cust_info ;
-	rdfs:range xsd:date;
-         rdfs:label "Expire Date" .
-
-tut:ship_to a rdf:Property ;
-	rdfs:domain tut:cust_info ;
-	rdfs:range xsd:string;
-         rdfs:label "Ship To" .
-
-tut:cust_orders a rdfs:Class ;
-	rdfs:isDefinedBy <http://localhost:8890/schemas/ingrestut> ;
-	rdfs:label "Customer Orders" ;
-	rdfs:comment "Ingres Tutorial Database cust_orders table" .
-
-tut:order_no a rdf:Property ;
-	rdfs:domain tut:cust_orders ;
-	rdfs:range tut:book_orders ;
-         rdfs:label "Order No" .
-
-tut:book_no a rdf:Property ;
-	rdfs:domain tut:cust_orders ;
-	rdfs:range tut:cust_info ;
-         rdfs:label "Book No" .
-
-tut:order_date a rdf:Property ;
-	rdfs:domain tut:cust_orders ;
-	rdfs:range xsd:date ;
-         rdfs:label "Order Date" .
-
-tut:status a rdf:Property ;
-	rdfs:domain tut:cust_orders ;
-	rdfs:range xsd:string ;
-         rdfs:label "Status" .
-
-tut:order_total a rdf:Property ;
-	rdfs:domain tut:cust_orders ;
-	rdfs:range xsd:money ;
-         rdfs:label "Order Total" .
-', '', 'http://localhost:8890/schemas/ingrestut', 0);
-
----------------------------------------------------------------
-
------------ Create IRI Classes -------------
-
-SPARQL
-
-	create iri class <http://localhost:8890/schemas/ingrestut/book_list_iri>
-	"http://^{URIQADefaultHost}^/ingrestut/book_list/%d#this"
-    	(in book_no integer not null) .
-
-	create iri class <http://localhost:8890/schemas/ingrestut/book_orders_iri>
-	"http://^{URIQADefaultHost}^/ingrestut/book_orders/%d_%d#this"
-	 (in order_no integer not null, in book_no integer not null ) .
-
-	create iri class <http://localhost:8890/schemas/ingrestut/cust_info_iri>
-	"http://^{URIQADefaultHost}^/ingrestut/cust_info/%d#this"
-    	(in cust_no integer not null) .
-
-	create iri class <http://localhost:8890/schemas/ingrestut/cust_orders_iri>
-	"http://^{URIQADefaultHost}^/ingrestut/cust_orders/%d#this"
-    	(in order_no integer not null) .
-
-	;
-
---------------------------------------------------------------------
-
-------------- Create Quad Store ------------------------------------
-
-SPARQL
-
-prefix tut:	<http://localhost:8890/schemas/ingrestut/>
-
-alter quad storage virtrdf:DefaultQuadStorage
-  from TUT.ingiima.book_list as book_list_tbl
-  from TUT.ingiima.book_orders as book_orders_tbl
-  from TUT.ingiima.cust_info as cust_info_tbl
-  from TUT.ingiima.cust_orders as cust_orders_tbl
-{
-  create virtrdf:ingrestut as
-      graph <http://localhost:8890/ingrestut>
-  {
-        tut:book_list_iri(book_list_tbl.book_no) a tut:book_list
-               as virtrdf:book_list_book_no ;
-        tut:title book_list_tbl.title
-	     as virtrdf:book_list_title;
-        tut:author book_list_tbl.author
-              as virtrdf:book_list_author;
-        tut:price book_list_tbl.price
-              as virtrdf:book_list_price;
-        tut:category book_list_tbl.category
-              as virtrdf:book_list_category;
-        tut:stock book_list_tbl.stock
-              as virtrdf:book_list_stock;
-        tut:dist_no book_list_tbl.dist_no
-              as virtrdf:book_list_dist_no .
-
-	tut:book_orders_iri(book_orders_tbl.order_no, book_orders_tbl.book_no) a tut:book_orders
-		as virtrdf:book_orders_pk;
-	tut:order_no book_orders_tbl.order_no
-		as virtrdf:book_orders_order_no;
-	tut:book_no tut:book_list_iri(book_list_tbl.book_no)
-		where(^{book_orders_tbl.}^.book_no = ^{book_list_tbl.}^.book_no)
-		as virtrdf:book_orders_book_no;
-	tut:sale_price book_orders_tbl.sale_price
-		as virtrdf:book_orders_sale_price;
-	tut:quantity book_orders_tbl.quantity
-		as virtrdf:book_orders_quantity;
-	tut:extension book_orders_tbl.extension
-		as virtrdf:book_orders_extension .
-
- 	tut:cust_info_iri(cust_info_tbl.cust_no) a tut:cust_info
-		as virtrdf:cust_info_cust_no;
-	tut:name cust_info_tbl.name
-		as virtrdf:cust_info_name;
-	tut:company cust_info_tbl.company
-		as virtrdf:cust_info_company;
-	tut:street cust_info_tbl.street
-		as virtrdf:cust_info_street;
-	tut:city cust_info_tbl.city
-		as virtrdf:cust_info_city;
-	tut:state cust_info_tbl.state
-		as virtrdf:cust_info_state;
-	tut:zip cust_info_tbl.zip
-		as virtrdf:cust_info_zip;
-	tut:card_no cust_info_tbl.card_no
-		as virtrdf:cust_info_card_no;
-	tut:exp_date cust_info_tbl.exp_date
-		as virtrdf:cust_info_exp_date;
-	tut:ship_to cust_info_tbl.ship_to
-		as virtrdf:cust_info_ship_to .
-
- 	tut:cust_orders_iri(cust_orders_tbl.order_no) a tut:cust_orders
-		as virtrdf:cust_orders_order_no;
-
-	tut:cust_no tut:cust_info_iri(cust_info_tbl.cust_no)
-		where (^{cust_orders_tbl.}^.cust_no = ^{cust_info_tbl.}^.cust_no)
-		as virtrdf:cust_orders_cust_no;
-	tut:order_date cust_orders_tbl.order_date
-		as virtrdf:cust_orders_order_date;
-	tut:status cust_orders_tbl.status
-		as virtrdf:cust_orders_status;
-	tut:order_total cust_orders_tbl.order_total
-		as virtrdf:cust_orders_order_total   .
-  } .
-} .
-;
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'ingrestut_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'ingrestut_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ingrestut_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ingrestut_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/ingrestut%%3E&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'ingrestut_rule_list1',
-    1,
-    vector (
-  	 	'ingrestut_rule1',
-  	 	'ingrestut_rule2'
-	  ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/ingrestut');
-
-VHOST_DEFINE (
-	lpath=>'/ingrestut',
-	ppath=>'/DAV/ingrestut/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'ingrestut_rule_list1')
-	);
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'ingres_schemas_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'ingres_schemas_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ingres_schemas_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'ingres_schemas_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/ingrestut%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path','path','*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'ingres_schemas_rule_list1',
-    1,
-    vector (
-  	 	'ingres_schemas_rule1',
-  	 	'ingres_schemas_rule2'
-	  ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/schema/ingrestut');
-
-VHOST_DEFINE (
-	lpath=>'/schemas/ingrestut',
-	ppath=>'/DAV/schemas/ingrestut/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'ingres_schemas_rule_list1')
-	);
-
-DB.DBA.XML_SET_NS_DECL ('tut', 'http://^{URIQADefaultHost}^/schemas/ingrestut/', 2);
+insert soft DB.DBA.SYS_RDF_MAPPERS (
+  RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION, RM_ENABLED)
+values (
+  '(text/plain)|(text/xml)|(text/html)', 'MIME', 'DB.DBA.RDF_LOAD_CALAIS',
+  null, 'Opencalais', 1);
 ]]></programlisting>
-    </sect4>
-    <sect4 id="rdfviewsenterprs89">
-      <title>Progress (SQL-89) using demonstration 'iSports' database</title>
-<programlisting><![CDATA[
-ATTACH TABLE  "ISPORTS_RDF"."Customer" PRIMARY KEY ("Cust-Num")
-AS "isports_rdf"."pro91_isports_rdf"."Customer"
-FROM 'pro91_isports_rdf';
-
-ATTACH TABLE  "ISPORTS_RDF"."Invoice" PRIMARY KEY ("Invoice-Num")
-AS "isports_rdf"."pro91_isports_rdf"."Invoice"
-FROM 'pro91_isports_rdf';
-
-ATTACH TABLE  "ISPORTS_RDF"."Item" PRIMARY KEY ("Item-num")
-AS "isports_rdf"."pro91_isports_rdf"."Item"
-FROM 'pro91_isports_rdf';
-
-ATTACH TABLE  "ISPORTS_RDF"."Local-Default" PRIMARY KEY ("Country")
-AS "isports_rdf"."pro91_isports_rdf"."Local-Default"
-FROM 'pro91_isports_rdf';
-
-ATTACH TABLE  "ISPORTS_RDF"."Order" PRIMARY KEY ("Order-num")
-AS "isports_rdf"."pro91_isports_rdf"."Order"
-FROM 'pro91_isports_rdf';
-
-ATTACH TABLE  "ISPORTS_RDF"."Order-Line"  PRIMARY KEY ("Order-num", "Line-num")
-AS "isports_rdf"."pro91_isports_rdf"."Order-Line"
-FROM 'pro91_isports_rdf';
-
-ATTACH TABLE  "ISPORTS_RDF"."Ref-Call" PRIMARY KEY ("Call-Num")
-AS "isports_rdf"."pro91_isports_rdf"."Ref-Call"
-FROM 'pro91_isports_rdf';
-
-ATTACH TABLE  "ISPORTS_RDF"."Salesrep" PRIMARY KEY ("Sales-Rep")
-AS "isports_rdf"."pro91_isports_rdf"."Salesrep"
-FROM 'pro91_isports_rdf';
-
-ATTACH TABLE  "ISPORTS_RDF"."State" PRIMARY KEY ("State")
-AS "isports_rdf"."pro91_isports_rdf"."State"
-FROM 'pro91_isports_rdf';
-
-COMMIT WORK;
-
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.Customer        TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf."Order"         TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.Item            TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf."Order-Line"    TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.Invoice         TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf."Local-Default" TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf."Ref-Call"      TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.Salesrep        TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.State           TO "SPARQL", "SPARQL_UPDATE";
-
-GRANT SPARQL_UPDATE to "SPARQL";
-
-CREATE VIEW isports_rdf.pro91_isports_rdf.VCustomer      AS SELECT "Cust-Num" AS Cust_Num, Name, Address, Address2, City, State, Country, Phone, Contact, "Sales-Rep" AS Sales_Rep, Comments, "Credit-Limit" AS Credit_Limit, Balance, Terms, Discount, "Postal-Code" AS Postal_Code FROM "isports_rdf"."pro91_isports_rdf"."Customer";
-CREATE VIEW isports_rdf.pro91_isports_rdf.VOrder         AS SELECT "Order-num" AS Order_num, "Cust-Num" AS Cust_Num, "Order-Date" AS Order_Date, "Ship-Date" AS Ship_Date, "Promise-Date" AS Promise_Date, Carrier, Instructions, PO, Terms, "Sales-Rep" AS Sales_Rep FROM isports_rdf.pro91_isports_rdf."Order";
-CREATE VIEW isports_rdf.pro91_isports_rdf.VItem          AS SELECT "Item-num" AS Item_num, "Item-Name" AS Item_Name, "Cat-Page" AS Cat_Page, Price, "Cat-Description" AS Cat_Description, "On-hand" AS On_hand, Allocated, "Re-Order" AS Re_Order, "On-Order" AS On_Order FROM isports_rdf.pro91_isports_rdf.Item;
-CREATE VIEW isports_rdf.pro91_isports_rdf.VOrder_Line    AS SELECT "Order-num" AS Order_num, "Line-num" AS Line_num, "Item-num" AS Item_num, Price, Qty, Discount, "Extended-Price" AS Extended_Price, Backorder FROM isports_rdf.pro91_isports_rdf."Order-Line";
-CREATE VIEW isports_rdf.pro91_isports_rdf.VInvoice       AS SELECT "Invoice-Num" AS Invoice_Num, "Cust-Num" AS Cust_Num, "Invoice-Date" AS Invoice_Date, Amount, "Total-Paid" AS Total_Paid, Adjustment, "Order-Num" AS Order_Num, "Ship-Charge" AS Ship_Charge FROM isports_rdf.pro91_isports_rdf.Invoice;
-CREATE VIEW isports_rdf.pro91_isports_rdf.VLocal_Default AS SELECT Country, "Region1-Label" AS Region1_Label, "Region2-Label" AS Region2_Label, "Postal-Label" AS Postal_Label, "Postal-Format" AS Postal_Format, "Tel-Format" AS Tel_Format, "Date-Format" AS Date_Format, "Currency-Symbol" AS Currency_Symbol FROM isports_rdf.pro91_isports_rdf."Local-Default";
-CREATE VIEW isports_rdf.pro91_isports_rdf.VRef_Call      AS SELECT "Call-Num" AS Call_Num, "Cust-Num" AS Cust_Num, "Call-Date" AS Call_Date, "Sales-Rep" AS Sales_Rep, Parent, Txt FROM isports_rdf.pro91_isports_rdf."Ref-Call";
-CREATE VIEW isports_rdf.pro91_isports_rdf.VSalesrep      AS SELECT "Rep-Name" AS Rep_Name, Region, "Sales-Rep" AS Sales_Rep, "Month-Quota at 1" AS Month_Quota_1, "Month-Quota at 2" AS Month_Quota_2, "Month-Quota at 3" AS Month_Quota_3, "Month-Quota at 4" AS Month_Quota_4, "Month-Quota at 5" AS Month_Quota_5, "Month-Quota at 6" AS Month_Quota_6, "Month-Quota at 7" AS Month_Quota_7, "Month-Quota at 8" AS Month_Quota_8, "Month-Quota at 9" AS Month_Quota_9, "Month-Quota at 10" AS Month_Quota_10, "Month-Quota at 11" AS Month_Quota_11, "Month-Quota at 12" AS Month_Quota_12 FROM isports_rdf.pro91_isports_rdf.Salesrep;
-CREATE VIEW isports_rdf.pro91_isports_rdf.VState         AS SELECT State, "State-Name" AS State_Name, Region FROM isports_rdf.pro91_isports_rdf.State;
-
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.VCustomer      TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.VOrder         TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.VItem          TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.VOrder_Line    TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.VInvoice       TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.VLocal_Default TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.VRef_Call      TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.VSalesrep      TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.pro91_isports_rdf.VState         TO "SPARQL", "SPARQL_UPDATE";
-
-
--------- Create rdfs:Class definitions ----------------------------
-
-ttlp (
-'
- at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
- at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
-
- at prefix customer:     <http://localhost:8890/schemas/progress/isports/customer/> .
- at prefix order:        <http://localhost:8890/schemas/progress/isports/order/> .
- at prefix item:         <http://localhost:8890/schemas/progress/isports/item/> .
- at prefix orderline:    <http://localhost:8890/schemas/progress/isports/order_line/> .
- at prefix invoice:      <http://localhost:8890/schemas/progress/isports/invoice/> .
- at prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/> .
- at prefix refcall:      <http://localhost:8890/schemas/progress/isports/ref_call/> .
- at prefix salesrep:     <http://localhost:8890/schemas/progress/isports/salesrep/> .
- at prefix state:        <http://localhost:8890/schemas/progress/isports/state/> .
-
-
-
-customer:Customer a rdfs:Class ;
-	rdfs:label "Customer" ;
-	rdfs:comment "Progress isports Customer table" .
-
-customer:Cust-Num a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Cust-Num" .
-
-customer:Name a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Name" .
-
-customer:Address a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Address" .
-
-customer:Address2 a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Address2" .
-
-customer:City a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "City" .
-
-customer:State a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "State" .
-
-customer:Country a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Country" .
-
-customer:Phone a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Phone" .
-
-customer:Contact a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Contact" .
-
-customer:Sales-Rep a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Sales-Rep" .
-
-customer:Comments a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Comments" .
-
-customer:Credit-Limit a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Credit-Limit" .
-
-customer:Balance a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Balance" .
-
-customer:Terms a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Terms" .
-
-customer:Discount a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Discount" .
-
-customer:Postal-Code a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Postal-Code" .
-
-
-
-order:Order a rdfs:Class ;
-	rdfs:label "Order" ;
-	rdfs:comment "Progress isports Order table" .
-
-order:Order-num a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Order-num" .
-
-order:Cust-Num a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Cust-Num" .
-
-order:Order-Date a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:date ;
-	rdfs:label "Order-Date" .
-
-order:Ship-Date a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:date ;
-	rdfs:label "Ship-Date" .
-
-order:Promise-Date a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:date ;
-	rdfs:label "Promise-Date" .
-
-order:Carrier a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:string ;
-	rdfs:label "Carrier" .
-
-order:Instructions a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:string ;
-	rdfs:label "Instructions" .
-
-order:PO a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:string ;
-	rdfs:label "PO" .
-
-order:Terms a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:string ;
-	rdfs:label "Terms" .
-
-order:Sales-Rep a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:string ;
-	rdfs:label "Sales-Rep" .
-
-
-
-item:Item a rdfs:Class ;
-	rdfs:label "Item" ;
-	rdfs:comment "Progress isports Item table" .
-
-item:Item-num a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Item-num" .
-
-item:Item-Name a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:string ;
-	rdfs:label "Item-Name" .
-
-item:Cat-Page a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Cat-Page" .
-
-item:Price a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Price" .
-
-item:Cat-Description a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:string ;
-	rdfs:label "Cat-Description" .
-
-item:On-hand a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:integer ;
-	rdfs:label "On-hand" .
-
-item:Allocated a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Allocated" .
-
-item:Re-Order a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Re-Order" .
-
-item:On-Order a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:integer ;
-	rdfs:label "On-Order" .
-
-
-
-orderline:Order-Line a rdfs:Class ;
-	rdfs:label "Order-Line" ;
-	rdfs:comment "Progress isports Order-Line table" .
-
-orderline:Order-num a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Order-num" .
-
-orderline:Line-num a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Line-num" .
-
-orderline:Item-num a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Item-num" .
-
-orderline:Price a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Price" .
-
-orderline:Qty a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Qty" .
-
-orderline:Discount a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Discount" .
-
-orderline:Extended-Price a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Extended-Price" .
-
-orderline:Backorder a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:byte ;
-	rdfs:label "Backorder" .
-
-
-
-invoice:Invoice a rdfs:Class ;
-	rdfs:label "Invoice" ;
-	rdfs:comment "Progress isports Invoice table" .
-
-invoice:Invoice-Num a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Invoice-Num" .
-
-invoice:Cust-Num a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Cust-Num" .
-
-invoice:Invoice-Date a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:date ;
-	rdfs:label "Invoice-Date" .
-
-invoice:Amount a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Amount" .
-
-invoice:Total-Paid a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Total-Paid" .
-
-invoice:Adjustment a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Adjustment" .
-
-invoice:Order-Num a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Order-Num" .
-
-invoice:Ship-Charge a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Ship-Charge" .
-
-
-
-localdefault:Local-Default a rdfs:Class ;
-	rdfs:label "Local-Default" ;
-	rdfs:comment "Progress isports Local-Default table" .
-
-localdefault:Country a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Country" .
-
-localdefault:Region1-Label a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Region1-Label" .
-
-localdefault:Region2-Label a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Region2-Label" .
-
-localdefault:Postal-Label a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Postal-Label" .
-
-localdefault:Postal-Format a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Postal-Format" .
-
-localdefault:Tel-Format a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Tel-Format" .
-
-localdefault:Date-Format a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Date-Format" .
-
-localdefault:Currency-Symbol a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Currency-Symbol" .
-
-
-
-refcall:Ref-Call a rdfs:Class ;
-	rdfs:label "Ref-Call" ;
-	rdfs:comment "Progress isports Ref-Call table" .
-
-refcall:Call-Num a rdf:Property ;
-	rdfs:domain refcall:Ref-Call ;
-	rdfs:range xsd:string ;
-	rdfs:label "Call-Num" .
-
-refcall:Cust-Num a rdf:Property ;
-	rdfs:domain refcall:Ref-Call ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Cust-Num" .
-
-refcall:Call-Date a rdf:Property ;
-	rdfs:domain refcall:Ref-Call ;
-	rdfs:range xsd:date ;
-	rdfs:label "Call-Date" .
-
-refcall:Sales-Rep a rdf:Property ;
-	rdfs:domain refcall:Ref-Call ;
-	rdfs:range xsd:string ;
-	rdfs:label "Sales-Rep" .
-
-refcall:Parent a rdf:Property ;
-	rdfs:domain refcall:Ref-Call ;
-	rdfs:range xsd:string ;
-	rdfs:label "Parent" .
-
-refcall:Txt a rdf:Property ;
-	rdfs:domain refcall:Ref-Call ;
-	rdfs:range xsd:string ;
-	rdfs:label "Txt" .
-
-
-
-salesrep:Salesrep a rdfs:Class ;
-	rdfs:label "Salesrep" ;
-	rdfs:comment "Progress isports Salesrep table" .
-
-salesrep:Sales-Rep a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Sales-Rep" .
-
-salesrep:Rep-Name a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Rep-Name" .
-
-salesrep:Region a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Region" .
-
-salesrep:Month-Quota-1 a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota at 1" .
-
-salesrep:Month-Quota-2 a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota at 2" .
-
-salesrep:Month-Quota-3 a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota at 3" .
-
-salesrep:Month-Quota-4 a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota at 4" .
-
-salesrep:Month-Quota-5 a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota at 5" .
-
-salesrep:Month-Quota-6 a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota at 6" .
-
-salesrep:Month-Quota-7 a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota at 7" .
-
-salesrep:Month-Quota-8 a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota at 8" .
-
-salesrep:Month-Quota-9 a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota at 9" .
-
-salesrep:Month-Quota-10 a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota at 10" .
-
-salesrep:Month-Quota-11 a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota at 11" .
-
-salesrep:Month-Quota-12 a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota at 12" .
-
-
-
-state:State a rdfs:Class ;
-	rdfs:label "State" ;
-	rdfs:comment "Progress isports State table" .
-
-state:State_ a rdf:Property ;
-	rdfs:domain state:State ;
-	rdfs:range xsd:string ;
-	rdfs:label "State" .
-
-state:State-Name a rdf:Property ;
-	rdfs:domain state:State ;
-	rdfs:range xsd:string ;
-	rdfs:label "State-Name" .
-
-state:Region a rdf:Property ;
-	rdfs:domain state:State ;
-	rdfs:range xsd:string ;
-	rdfs:label "Region" .
-
-', '', 'http://localhost:8890/schemas/progress/isports', 0);
-
-
-
------------ Create IRI Classes -------------
-
-
-
-
-SPARQL
-
-prefix customer:     <http://localhost:8890/schemas/progress/isports/customer/>
-prefix order:        <http://localhost:8890/schemas/progress/isports/order/>
-prefix item:         <http://localhost:8890/schemas/progress/isports/item/>
-prefix orderline:    <http://localhost:8890/schemas/progress/isports/order_line/>
-prefix invoice:      <http://localhost:8890/schemas/progress/isports/invoice/>
-prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/>
-prefix refcall:      <http://localhost:8890/schemas/progress/isports/ref_call/>
-prefix salesrep:     <http://localhost:8890/schemas/progress/isports/salesrep/>
-prefix state:        <http://localhost:8890/schemas/progress/isports/state/>
-
-create iri class customer:customer_iri
-	"http://localhost:8890/progress/isports/customer/%d#this"
-	(in Cust_Num integer not null) .
-
-create iri class order:order_iri
-	"http://localhost:8890/progress/isports/order/%d#this"
-	(in Order_Num integer not null) .
-
-create iri class item:item_iri
-	"http://localhost:8890/progress/isports/item/%d#this"
-	(in Item_num integer not null) .
-
-create iri class orderline:order-line_iri
-	"http://localhost:8890/progress/isports/order-line/%d_%d#this"
-	(in Order_num integer not null, in Line_num integer not null) .
-
-create iri class invoice:invoice_iri
-	"http://localhost:8890/progress/isports/invoice/%d#this"
-	(in Invoice_Num integer not null) .
-
-create iri class localdefault:local-default_iri
-	"http://localhost:8890/progress/isports/local-default/%U#this"
-	(in Country varchar not null) .
-
-create iri class refcall:ref-call_iri
-	"http://localhost:8890/progress/isports/ref-call/%U#this"
-	(in Call_Num varchar not null) .
-
-create iri class salesrep:salesrep_iri
-	"http://localhost:8890/progress/isports/salesrep/%U#this"
-	(in Sales_Rep varchar not null) .
-
-create iri class state:state_iri
-	"http://localhost:8890/progress/isports/state/%U#this"
-	(in State varchar not null) .
-
-;
-
-
-
-
-
-
-
-------------- Create Quad Store ------------------------------------
-
-SPARQL
-
-prefix customer:     <http://localhost:8890/schemas/progress/isports/customer/>
-prefix order:        <http://localhost:8890/schemas/progress/isports/order/>
-prefix item:         <http://localhost:8890/schemas/progress/isports/item/>
-prefix orderline:    <http://localhost:8890/schemas/progress/isports/order_line/>
-prefix invoice:      <http://localhost:8890/schemas/progress/isports/invoice/>
-prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/>
-prefix refcall:      <http://localhost:8890/schemas/progress/isports/ref_call/>
-prefix salesrep:     <http://localhost:8890/schemas/progress/isports/salesrep/>
-prefix state:        <http://localhost:8890/schemas/progress/isports/state/>
-
-alter quad storage virtrdf:DefaultQuadStorage
-  from isports_rdf.pro91_isports_rdf.VCustomer      as Customer_tbl
-  from isports_rdf.pro91_isports_rdf.VOrder         as Order_tbl
-  from isports_rdf.pro91_isports_rdf.VItem          as Item_tbl
-  from isports_rdf.pro91_isports_rdf.VOrder_Line    as Order_Line_tbl
-  from isports_rdf.pro91_isports_rdf.VInvoice       as Invoice_tbl
-  from isports_rdf.pro91_isports_rdf.VRef_Call      as Ref_Call_tbl
-  from isports_rdf.pro91_isports_rdf.VRef_Call      as Ref_Call_tbl_1
-  from isports_rdf.pro91_isports_rdf.VLocal_Default as Local_Default_tbl
-  from isports_rdf.pro91_isports_rdf.VSalesrep      as Salesrep_tbl
-  from isports_rdf.pro91_isports_rdf.VState         as State_tbl
-{
-  create virtrdf:progress_isports as graph <http://localhost:8890/progress/isports>
-  {
-    customer:customer_iri (Customer_tbl.Cust_Num) a customer:Customer as virtrdf:customer_pk ;
-    customer:Cust-Num     Customer_tbl.Cust_Num     as virtrdf:Customer_cust-num ;
-    customer:Name         Customer_tbl.Name         as virtrdf:Customer_name ;
-    customer:Address      Customer_tbl.Address      as virtrdf:Customer_address ;
-    customer:Address2     Customer_tbl.Address2     as virtrdf:Customer_address2 ;
-    customer:City         Customer_tbl.City         as virtrdf:Customer_city ;
-    customer:State        Customer_tbl.State        as virtrdf:Customer_state ;
-    customer:Country      Customer_tbl.Country      as virtrdf:Customer_country ;
-    customer:Phone        Customer_tbl.Phone        as virtrdf:Customer_phone ;
-    customer:Contact      Customer_tbl.Contact      as virtrdf:Customer_contact ;
-    customer:Sales-Rep    Customer_tbl.Sales_Rep    as virtrdf:Customer_sales_rep ;
-    customer:Comments     Customer_tbl.Comments     as virtrdf:Customer_comments ;
-    customer:Credit-Limit Customer_tbl.Credit_Limit as virtrdf:Customer_credit-limit ;
-    customer:Balance      Customer_tbl.Balance      as virtrdf:Customer_balance ;
-    customer:Terms        Customer_tbl.Terms        as virtrdf:Customer_terms ;
-    customer:Discount     Customer_tbl.Discount     as virtrdf:Customer_discount ;
-    customer:Postal-Code  Customer_tbl.Postal_Code  as virtrdf:Customer_postal-code ;
-    customer:from_state        state:state_iri (State_tbl.State)                           where ( ^{Customer_tbl.}^.State     = ^{State_tbl.}^.State )           as virtrdf:Customer_from_state ;
-    customer:has_sales_rep     salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)              where ( ^{Customer_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep )    as virtrdf:Customer_has_sales_rep ;
-    customer:has_local_default localdefault:local-default_iri (Local_Default_tbl.Country)  where ( ^{Customer_tbl.}^.Country   = ^{Local_Default_tbl.}^.Country ) as virtrdf:Customer_has_local_default ;
-    customer:placed_order      order:order_iri (Order_tbl.Order_num)                       where ( ^{Customer_tbl.}^.Cust_Num  = ^{Order_tbl.}^.Cust_Num )        as virtrdf:Customer_placed_order ;
-    customer:has_invoice       invoice:invoice_iri (Invoice_tbl.Invoice_Num)               where ( ^{Customer_tbl.}^.Cust_Num  = ^{Invoice_tbl.}^.Cust_Num )      as virtrdf:Customer_has_invoice ;
-    customer:ref_call          refcall:ref-call_iri (Ref_Call_tbl.Call_Num)                where ( ^{Customer_tbl.}^.Cust_Num  = ^{Ref_Call_tbl.}^.Cust_Num )     as virtrdf:Customer_ref-call .
-
-    order:order_iri (Order_tbl.Order_num) a order:Order as virtrdf:order_pk ;
-    order:Order-num    Order_tbl.Order_num    as virtrdf:Order_order-num ;
-    order:Cust-Num     Order_tbl.Cust_Num     as virtrdf:Order_cust_num ;
-    order:Order-Date   Order_tbl.Order_Date   as virtrdf:Order_order-date ;
-    order:Ship-Date    Order_tbl.Ship_Date    as virtrdf:Order_ship-date ;
-    order:Promise-Date Order_tbl.Promise_Date as virtrdf:Order_promise-date ;
-    order:Carrier      Order_tbl.Carrier      as virtrdf:Order_carrier ;
-    order:Instructions Order_tbl.Instructions as virtrdf:Order_instructions ;
-    order:PO           Order_tbl.PO           as virtrdf:Order_po ;
-    order:Terms        Order_tbl.Terms        as virtrdf:Order_terms ;
-    order:placed_by    customer:customer_iri (Customer_tbl.Cust_Num)                                 where ( ^{Order_tbl.}^.Cust_Num  = ^{Customer_tbl.}^.Cust_Num )    as virtrdf:Order_placed_by ;
-    order:Sales-Rep    salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)                                where ( ^{Order_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep )   as virtrdf:Order_sales_rep ;
-    order:invoiced_on  invoice:invoice_iri (Invoice_tbl.Invoice_Num)                                 where ( ^{Order_tbl.}^.Order_num = ^{Invoice_tbl.}^.Order_Num )    as virtrdf:Order_invoiced_on ;
-    order:has_lines    orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num)  where ( ^{Order_tbl.}^.Order_num = ^{Order_Line_tbl.}^.Order_num ) as virtrdf:Order_has_lines .
-
-    item:item_iri (Item_tbl.Item_num) a item:Item as virtrdf:item_pk ;
-    item:Item-num        Item_tbl.Item_num        as virtrdf:item_item-num ;
-    item:Item-Name       Item_tbl.Item_Name       as virtrdf:Item_item-Name ;
-    item:Cat-Page        Item_tbl.Cat_Page        as virtrdf:Item_cat-page ;
-    item:Price           Item_tbl.Price           as virtrdf:Item_price ;
-    item:Cat-Description Item_tbl.Cat_Description as virtrdf:Item_cat-description ;
-    item:On-hand         Item_tbl.On_hand         as virtrdf:Item_on-hand ;
-    item:Allocated       Item_tbl.Allocated       as virtrdf:Item_allocated ;
-    item:Re-Order        Item_tbl.Re_Order        as virtrdf:Item_re-order ;
-    item:On-Order        Item_tbl.On_Order        as virtrdf:Item_on-order ;
-    item:order_line  orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num)  where ( ^{Item_tbl.}^.Item_num  = ^{Order_Line_tbl.}^.Item_num )   as virtrdf:Item_order_line .
-
-    orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num) a orderline:Order-Line as virtrdf:order-line_pk ;
-    orderline:Line-num       Order_Line_tbl.Line_num       as virtrdf:Order-Line_line-num ;
-    orderline:Price          Order_Line_tbl.Price          as virtrdf:Order-Line_price ;
-    orderline:Qty            Order_Line_tbl.Qty            as virtrdf:Order-Line_qty ;
-    orderline:Discount       Order_Line_tbl.Discount       as virtrdf:Order-Line_discount ;
-    orderline:Extended-Price Order_Line_tbl.Extended_Price as virtrdf:Order-Line_extended-price ;
-    orderline:Backorder      Order_Line_tbl.Backorder      as virtrdf:Order-Line_backorder ;
-    orderline:Order-num  order:order_iri (Order_tbl.Order_num)  where ( ^{Order_Line_tbl.}^.Order_num = ^{Order_tbl.}^.Order_num ) as virtrdf:Order_Line_order_num ;
-    orderline:Item-num   item:item_iri (Item_tbl.Item_num)      where ( ^{Order_Line_tbl.}^.Item_num  = ^{Item_tbl.}^.Item_num )   as virtrdf:Order_Line_item_num .
-
-    invoice:invoice_iri (Invoice_tbl.Invoice_Num) a invoice:Invoice as virtrdf:invoice_pk ;
-    invoice:Invoice-Num  Invoice_tbl.Invoice_Num  as virtrdf:Invoice_invoice-num ;
-    invoice:Cust-Num     Invoice_tbl.Cust_Num    as virtrdf:Invoice_cust_num ;
-    invoice:Invoice-Date Invoice_tbl.Invoice_Date as virtrdf:Invoice_invoice-date ;
-    invoice:Amount       Invoice_tbl.Amount       as virtrdf:Invoice_amount ;
-    invoice:Total-Paid   Invoice_tbl.Total_Paid   as virtrdf:Invoice_total-paid ;
-    invoice:Adjustment   Invoice_tbl.Adjustment   as virtrdf:Invoice_adjustment ;
-    invoice:Order-Num    Invoice_tbl.Order_Num    as virtrdf:Invoice_order-num ;
-    invoice:Ship-Charge  Invoice_tbl.Ship_Charge  as virtrdf:Invoice_ship-charge ;
-    invoice:invoiced_to  customer:customer_iri (Customer_tbl.Cust_Num)  where ( ^{Invoice_tbl.}^.Cust_Num  = ^{Customer_tbl.}^.Cust_Num ) as virtrdf:Invoice_invoiced_to ;
-    invoice:Order-Num    order:order_iri (Order_tbl.Order_num)          where ( ^{Invoice_tbl.}^.Order_Num = ^{Order_tbl.}^.Order_num )   as virtrdf:Invoice_order_num .
-
-    localdefault:local-default_iri (Local_Default_tbl.Country) a localdefault:Local-Default as virtrdf:local-default_pk ;
-    localdefault:Country         Local_Default_tbl.Country as virtrdf:local-default_country ;
-    localdefault:Region1-Label   Local_Default_tbl.Region1_Label   as virtrdf:Local-Default_region1-label ;
-    localdefault:Region2-Label   Local_Default_tbl.Region2_Label   as virtrdf:Local-Default_region2-label ;
-    localdefault:Postal-Label    Local_Default_tbl.Postal_Label    as virtrdf:Local-Default_postal-label ;
-    localdefault:Postal-Format   Local_Default_tbl.Postal_Format   as virtrdf:Local-Default_postal-format ;
-    localdefault:Tel-Format      Local_Default_tbl.Tel_Format      as virtrdf:Local-Default_tel-format ;
-    localdefault:Date-Format     Local_Default_tbl.Date_Format     as virtrdf:Local-Default_date-format ;
-    localdefault:Currency-Symbol Local_Default_tbl.Currency_Symbol as virtrdf:Local-Default_currency-symbol ;
-    localdefault:has_customer customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Local_Default_tbl.}^.Country = ^{Customer_tbl.}^.Country ) as virtrdf:Local-Default_has_customer .
-
-
-    refcall:ref-call_iri (Ref_Call_tbl.Call_Num) a refcall:Ref-Call as virtrdf:ref-call_pk ;
-    refcall:Call-Num   Ref_Call_tbl.Call_Num   as virtrdf:Ref-Call_call-num ;
-    refcall:Cust-Num   Ref_Call_tbl.Cust_Num   as virtrdf:Ref-Call_cust-num ;
-    refcall:Call-Date  Ref_Call_tbl.Call_Date  as virtrdf:Ref-Call_call-date ;
-    refcall:Sales-Rep  Ref_Call_tbl.Sales_Rep  as virtrdf:Ref-sales-rep ;
-    refcall:Parent     Ref_Call_tbl.Parent     as virtrdf:Ref-Call_parent ;
-    refcall:Txt        Ref_Call_tbl.Txt        as virtrdf:Ref-Call_txt ;
-    refcall:made_to     customer:customer_iri (Customer_tbl.Cust_Num)   where  ( ^{Ref_Call_tbl.}^.Cust_Num  = ^{Customer_tbl.}^.Cust_Num )   as virtrdf:Ref-Call_made_to ;
-    refcall:made_by     salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)  where  ( ^{Ref_Call_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep )  as virtrdf:Ref-Call_made-by ;
-    refcall:has_parent  refcall:ref-call_iri (Ref_Call_tbl_1.Call_Num)    where  ( ^{Ref_Call_tbl.}^.Parent    = ^{Ref_Call_tbl_1.}^.Call_Num )   as virtrdf:Ref-Call_has_parent .
-
-    salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep) a salesrep:Salesrep as virtrdf:salesrep_pk ;
-    salesrep:Sales-Rep      Salesrep_tbl.Sales_Rep       as virtrdf:Salesrep_sales-rep ;
-    salesrep:Region         Salesrep_tbl.Region          as virtrdf:Salesrep_region ;
-    salesrep:Rep-Name       Salesrep_tbl.Rep_Name        as virtrdf:Salesrep_rep-name ;
-    salesrep:Month-Quota-1  Salesrep_tbl.Month_Quota_1   as virtrdf:Salesrep_month-quota-1 ;
-    salesrep:Month-Quota-2  Salesrep_tbl.Month_Quota_2   as virtrdf:Salesrep_month-quota-2 ;
-    salesrep:Month-Quota-3  Salesrep_tbl.Month_Quota_3   as virtrdf:Salesrep_month-quota-3 ;
-    salesrep:Month-Quota-4  Salesrep_tbl.Month_Quota_4   as virtrdf:Salesrep_month-quota-4 ;
-    salesrep:Month-Quota-5  Salesrep_tbl.Month_Quota_5   as virtrdf:Salesrep_month-quota-5 ;
-    salesrep:Month-Quota-6  Salesrep_tbl.Month_Quota_6   as virtrdf:Salesrep_month-quota-6 ;
-    salesrep:Month-Quota-7  Salesrep_tbl.Month_Quota_7   as virtrdf:Salesrep_month-quota-7 ;
-    salesrep:Month-Quota-8  Salesrep_tbl.Month_Quota_8   as virtrdf:Salesrep_month-quota-8 ;
-    salesrep:Month-Quota-9  Salesrep_tbl.Month_Quota_9   as virtrdf:Salesrep_month-quota-9 ;
-    salesrep:Month-Quota-10 Salesrep_tbl.Month_Quota_10  as virtrdf:Salesrep_month-quota-10 ;
-    salesrep:Month-Quota-11 Salesrep_tbl.Month_Quota_11  as virtrdf:Salesrep_month-quota-11 ;
-    salesrep:Month-Quota-12 Salesrep_tbl.Month_Quota_12  as virtrdf:Salesrep_month-quota-12 ;
-    salesrep:is_sales_rep_for customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Customer_tbl.}^.Sales_Rep ) as virtrdf:Salesrep_is_sales_rep_for ;
-    salesrep:has_order        order:order_iri (Order_tbl.Order_num)         where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Order_tbl.}^.Sales_Rep )    as virtrdf:Salesrep_has_order ;
-    salesrep:manages_region   state:state_iri (State_tbl.State)             where ( ^{Salesrep_tbl.}^.Region    = ^{State_tbl.}^.Region )       as virtrdf:Salesrep_manages_region ;
-    salesrep:made_call        refcall:ref-call_iri (Ref_Call_tbl.Call_Num)  where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Ref_Call_tbl.}^.Sales_Rep ) as virtrdf:Ref-Call_made_call .
-
-    state:state_iri (State_tbl.State) a state:State as virtrdf:state_pk ;
-    state:State_     State_tbl.State        as virtrdf:State_state ;
-    state:State-Name State_tbl.State_Name   as virtrdf:State_state-name ;
-    state:Region     State_tbl.Region       as virtrdf:State_region ;
-    state:has_customer   customer:customer_iri (Customer_tbl.Cust_Num)   where ( ^{State_tbl.}^.State  = ^{Customer_tbl.}^.State )  as virtrdf:State_has_customer ;
-    state:has_sales_rep  salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)  where ( ^{State_tbl.}^.Region = ^{Salesrep_tbl.}^.Region ) as virtrdf:State_has_sales_rep .
-
-
-  } .
-} .
-;
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'progress_isports_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'progress_isports_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'progress_isports_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'progress_isports_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/progress/isports%%3E&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'progress_isports_rule_list1',
-    1,
-    vector (
-  	 	'progress_isports_rule1',
-  	 	'progress_isports_rule2'
-	  ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/progress/isports');
-
-VHOST_DEFINE (
-	lpath=>'/progress/isports',
-	ppath=>'/DAV/progress/isports/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'progress_isports_rule_list1')
-	);
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'progress_isports_schemas_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'progress_isports_schemas_rule%';
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'progress_isports_schemas_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
-
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'progress_isports_schemas_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/progress/isports%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path','path','*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
-
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'progress_isports_schemas_rule_list1',
-    1,
-    vector (
-  	 	'progress_isports_schemas_rule1',
-  	 	'progress_isports_schemas_rule2'
-	  ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/schemas/progress/isports');
-
-VHOST_DEFINE (
-	lpath=>'/schemas/progress/isports',
-	ppath=>'/DAV/schemas/progress/isports/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'progress_isports_schemas_rule_list1')
-	);
-
-DB.DBA.XML_SET_NS_DECL ('customer',     'http://^{URIQADefaultHost}^/schemas/progress/isports/customer/', 2);
-DB.DBA.XML_SET_NS_DECL ('order',        'http://^{URIQADefaultHost}^/schemas/progress/isports/order/', 2);
-DB.DBA.XML_SET_NS_DECL ('item',         'http://^{URIQADefaultHost}^/schemas/progress/isports/item/', 2);
-DB.DBA.XML_SET_NS_DECL ('orderline',    'http://^{URIQADefaultHost}^/schemas/progress/isports/order_line/', 2);
-DB.DBA.XML_SET_NS_DECL ('invoice',      'http://^{URIQADefaultHost}^/schemas/progress/isports/invoice/', 2);
-DB.DBA.XML_SET_NS_DECL ('localdefault', 'http://^{URIQADefaultHost}^/schemas/progress/isports/local_default/', 2);
-DB.DBA.XML_SET_NS_DECL ('refcall',      'http://^{URIQADefaultHost}^/schemas/progress/isports/ref_call/', 2);
-DB.DBA.XML_SET_NS_DECL ('salesrep',     'http://^{URIQADefaultHost}^/schemas/progress/isports/salesrep/', 2);
-DB.DBA.XML_SET_NS_DECL ('state',        'http://^{URIQADefaultHost}^/schemas/progress/isports/state/', 2);
+        <para>As an alternative to matching on the content's MIME type,
+candidate cartridges to be tried in the conversion pipeline can be identified by matching the
+data source URL against a URL pattern stored in the cartridge's entry in the Cartridge Registry.</para>
+<programlisting><![CDATA[
+insert soft DB.DBA.SYS_RDF_MAPPERS (
+  RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION, RM_OPTIONS)
+values (
+  '(http://api.crunchbase.com/v/1/.*)|(http://www.crunchbase.com/.*)', 'URL',
+  'DB.DBA.RDF_LOAD_CRUNCHBASE', null, 'CrunchBase', null);
+]]></programlisting>
+        <para>The value of RM_ID to set depends on where in the cartridge invocation order you want
+to position a particular cartridge. RM_ID should be set lower than 10028 to ensure the cartridge
+is tried before the ODS-Briefcase (WebDAV) metadata extractor, which is always the last mapper to
+be tried if no preceding cartridge has been successful.</para>
+<programlisting><![CDATA[
+UPDATE DB.DBA.SYS_RDF_MAPPERS
+SET RM_ID = 1000
+WHERE RM_HOOK = 'DB.DBA.RDF_LOAD_BIN_DOCUMENT';
+]]></programlisting>
+        </sect5>
+        <sect5 id="virtuosospongercreatecustcartrrgstcn">
+        <title>Using Conductor</title>
+        <para>Cartridges can be added manually using the 'Add' panel of the 'RDF Cartridges' screen.</para>
+        <figure id="spong4" float="1">
+          <title>RDF Cartridges</title>
+          <graphic fileref="ui/spong4.png"/>
+        </figure>
+        <figure id="spong5" float="1">
+          <title>RDF Cartridges</title>
+          <graphic fileref="ui/spong5.png"/>
+        </figure>
+        </sect5>
+        <sect5 id="virtuosospongercreatecustcartrrgstit">
+        <title>Installing Stylesheets</title>
+        <para>Although you could place your cartridge stylesheet in any folder configured to be accessible
+by Virtuoso, the simplest option is to upload them to the DAV/VAD/rdf_mappers/xslt folder using the
+WebDAV browser accessible from the Conductor UI.</para>
+        <figure id="spong6" float="1">
+          <title>WebDAV browser</title>
+          <graphic fileref="ui/spong6.png"/>
+        </figure>
+        <para>Should you wish to locate your stylesheets elsewhere, ensure
+that the DirsAllowed setting in the virtuoso.ini file is configured appropriately.</para>
+        </sect5>
+        <sect5 id="virtuosospongercreatecustcartrrgstap">
+        <title>Setting API Key</title>        
+         <para>Some Cartridges require and API account and/or API Key to be 
+provided for accessing the required service. This can be done from the RDF -> Sponger tab of the 
+Conductor by selecting the cartridge from the list provided, entering the API Account and API Key 
+in the dialog at the bottom of the page and click update to save, as indicated in the screenshot 
+below:</para>
+     <figure id="catr1" float="1">
+       <title>Registering API Key</title>
+       <graphic fileref="ui/cartrapikey.png"/>
+     </figure>
+     <para>For example, for the service Flickr developers must register
+to obtain a key. See http://developer.yahoo.com/flickr/. In order
+to cater for services which require an application key, the Cartridge Registry
+SYS_RDF_MAPPERS table includes an RM_KEY column to store any key required for a
+particular service. This value is passed to the service's cartridge through the
+_key parameter of the cartridge hook function.</para>
+         <para>Alternatively a cartridge can store a key value in the virtuoso.ini
+configuration file and retrieve it in the hook function.</para>       
+         </sect5>
+         <sect5 id="virtuosospongercreatecustcartrrgstflickr">
+           <title>Flickr Cartridge</title> 
+           <para>This example shows an extract from the Flickr cartridge hook function
+DB.DBA.RDF_LOAD_FLICKR_IMG and the use of an API key. Also, commented out, is a call to
+cfg_item_value() which illustrates how the API key could instead be stored and retrieved
+from the SPARQL section of the virtuoso.ini file.
+         </para>
+<programlisting><![CDATA[
+create procedure DB.DBA.RDF_LOAD_FLICKR_IMG (
+in graph_iri varchar, in new_origin_uri varchar, in dest varchar,
+inout _ret_body any, inout aq any, inout ps any, inout _key any,
+inout opts any )
+{
+declare xd, xt, url, tmp, api_key, img_id, hdr, exif any;
+declare exit handler for sqlstate '*'
+{
+ return 0;
+};
+tmp := sprintf_inverse (new_origin_uri,
+  'http://farm%s.static.flickr.com/%s/%s_%s.%s', 0);
+img_id := tmp[2];
+api_key := _key;
+--cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'FlickrAPIkey');
+if (tmp is null or length (tmp) <> 5 or not isstring (api_key))
+  return 0;
+url :=  sprintf('http://api.flickr.com/services/rest/?method=flickr.photos.getInfo&photo_id=%s&api_key=%s',img_id, api_key);
+tmp := http_get (url, hdr);
 ]]></programlisting>
+        </sect5>
     </sect4>
-    <sect4 id="rdfviewsenterprs92">
-      <title>Progress (SQL-92) using demonstration 'iSports' database</title>
-<programlisting><![CDATA[
-ATTACH TABLE  "PUB"."Customer"      PRIMARY KEY ("Cust-Num")              AS "isports_rdf"."prs10_isports_rdf"."Customer"      FROM 'prs10_isports_rdf';
-ATTACH TABLE  "PUB"."Invoice"       PRIMARY KEY ("Invoice-Num")           AS "isports_rdf"."prs10_isports_rdf"."Invoice"       FROM 'prs10_isports_rdf';
-ATTACH TABLE  "PUB"."Item"          PRIMARY KEY ("Item-num")              AS "isports_rdf"."prs10_isports_rdf"."Item"          FROM 'prs10_isports_rdf';
-ATTACH TABLE  "PUB"."Local-Default" PRIMARY KEY ("Country")               AS "isports_rdf"."prs10_isports_rdf"."Local-Default" FROM 'prs10_isports_rdf';
-ATTACH TABLE  "PUB"."Order"         PRIMARY KEY ("Order-num")             AS "isports_rdf"."prs10_isports_rdf"."Order"         FROM 'prs10_isports_rdf';
-ATTACH TABLE  "PUB"."Order-Line"    PRIMARY KEY ("Order-num", "Line-num") AS "isports_rdf"."prs10_isports_rdf"."Order-Line"    FROM 'prs10_isports_rdf';
-ATTACH TABLE  "PUB"."Ref-Call"      PRIMARY KEY ("Call-Num")              AS "isports_rdf"."prs10_isports_rdf"."Ref-Call"      FROM 'prs10_isports_rdf';
-ATTACH TABLE  "PUB"."Salesrep"      PRIMARY KEY ("Sales-Rep")             AS "isports_rdf"."prs10_isports_rdf"."Salesrep"      FROM 'prs10_isports_rdf';
-ATTACH TABLE  "PUB"."State"         PRIMARY KEY ("State")                 AS "isports_rdf"."prs10_isports_rdf"."State"         FROM 'prs10_isports_rdf';
-
-COMMIT WORK;
-
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.Customer        TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf."Order"         TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.Item            TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf."Order-Line"    TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.Invoice         TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf."Local-Default" TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf."Ref-Call"      TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.Salesrep        TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.State           TO "SPARQL", "SPARQL_UPDATE";
-
-GRANT SPARQL_UPDATE to "SPARQL";
-
-
-CREATE VIEW isports_rdf.prs10_isports_rdf.VCustomer      AS SELECT "Cust-Num" AS Cust_Num, Name, Address, Address2, City, State, Country, Phone, Contact, "Sales-Rep" AS Sales_Rep, Comments, "Credit-Limit" AS Credit_Limit, Balance, Terms, Discount, "Postal-Code" AS Postal_Code FROM isports_rdf.prs10_isports_rdf.Customer;
-CREATE VIEW isports_rdf.prs10_isports_rdf.VOrder         AS SELECT "Order-num" AS Order_num, "Cust-Num" AS Cust_Num, "Order-Date" AS Order_Date, "Ship-Date" AS Ship_Date, "Promise-Date" AS Promise_Date, Carrier, Instructions, PO, Terms, "Sales-Rep" AS Sales_Rep FROM isports_rdf.prs10_isports_rdf."Order";
-CREATE VIEW isports_rdf.prs10_isports_rdf.VItem          AS SELECT "Item-num" AS Item_num, "Item-Name" AS Item_Name, "Cat-Page" AS Cat_Page, Price, "Cat-Description" AS Cat_Description, "On-hand" AS On_hand, Allocated, "Re-Order" AS Re_Order, "On-Order" AS On_Order FROM isports_rdf.prs10_isports_rdf.Item;
-CREATE VIEW isports_rdf.prs10_isports_rdf.VOrder_Line    AS SELECT "Order-num" AS Order_num, "Line-num" AS Line_num, "Item-num" AS Item_num, Price, Qty, Discount, "Extended-Price" AS Extended_Price, Backorder FROM isports_rdf.prs10_isports_rdf."Order-Line";
-CREATE VIEW isports_rdf.prs10_isports_rdf.VInvoice       AS SELECT "Invoice-Num" AS Invoice_Num, "Cust-Num" AS Cust_Num, "Invoice-Date" AS Invoice_Date, Amount, "Total-Paid" AS Total_Paid, Adjustment, "Order-Num" AS Order_Num, "Ship-Charge" AS Ship_Charge FROM isports_rdf.prs10_isports_rdf.Invoice;
-CREATE VIEW isports_rdf.prs10_isports_rdf.VLocal_Default AS SELECT Country, "Region1-Label" AS Region1_Label, "Region2-Label" AS Region2_Label, "Postal-Label" AS Postal_Label, "Postal-Format" AS Postal_Format, "Tel-Format" AS Tel_Format, "Date-Format" AS Date_Format, "Currency-Symbol" AS Currency_Symbol FROM isports_rdf.prs10_isports_rdf."Local-Default";
-CREATE VIEW isports_rdf.prs10_isports_rdf.VRef_Call      AS SELECT "Call-Num" AS Call_Num, "Cust-Num" AS Cust_Num, "Call-Date" AS Call_Date, "Sales-Rep" AS Sales_Rep, Parent, Txt FROM isports_rdf.prs10_isports_rdf."Ref-Call";
-CREATE VIEW isports_rdf.prs10_isports_rdf.VSalesrep      AS SELECT "Rep-Name" AS Rep_Name, Region, "Sales-Rep" AS Sales_Rep, "Month-Quota" AS Month_Quota FROM isports_rdf.prs10_isports_rdf.Salesrep;
-CREATE VIEW isports_rdf.prs10_isports_rdf.VState         AS SELECT State, "State-Name" AS State_Name, Region FROM isports_rdf.prs10_isports_rdf.State;
-
-
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.VCustomer      TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.VOrder         TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.VItem          TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.VOrder_Line    TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.VInvoice       TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.VLocal_Default TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.VRef_Call      TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.VSalesrep      TO "SPARQL", "SPARQL_UPDATE";
-GRANT SELECT ON isports_rdf.prs10_isports_rdf.VState         TO "SPARQL", "SPARQL_UPDATE";
-
-
--------- Create rdfs:Class definitions ----------------------------
-
-ttlp (
-'
- at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
- at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
-
- at prefix customer:     <http://localhost:8890/schemas/progress/isports/customer/> .
- at prefix order:        <http://localhost:8890/schemas/progress/isports/order/> .
- at prefix item:         <http://localhost:8890/schemas/progress/isports/item/> .
- at prefix orderline:    <http://localhost:8890/schemas/progress/isports/order_line/> .
- at prefix invoice:      <http://localhost:8890/schemas/progress/isports/invoice/> .
- at prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/> .
- at prefix refcall:      <http://localhost:8890/schemas/progress/isports/ref_call/> .
- at prefix salesrep:     <http://localhost:8890/schemas/progress/isports/salesrep/> .
- at prefix state:        <http://localhost:8890/schemas/progress/isports/state/> .
-
-
-
-customer:Customer a rdfs:Class ;
-	rdfs:label "Customer" ;
-	rdfs:comment "Progress isports Customer table" .
-
-customer:Cust-Num a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Cust-Num" .
-
-customer:Name a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Name" .
-
-customer:Address a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Address" .
-
-customer:Address2 a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Address2" .
-
-customer:City a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "City" .
-
-customer:State a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "State" .
-
-customer:Country a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Country" .
-
-customer:Phone a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Phone" .
-
-customer:Contact a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Contact" .
-
-customer:Sales-Rep a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Sales-Rep" .
-
-customer:Comments a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Comments" .
-
-customer:Credit-Limit a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Credit-Limit" .
-
-customer:Balance a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Balance" .
-
-customer:Terms a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Terms" .
-
-customer:Discount a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Discount" .
-
-customer:Postal-Code a rdf:Property ;
-	rdfs:domain customer:Customer ;
-	rdfs:range xsd:string ;
-	rdfs:label "Postal-Code" .
-
-
-
-order:Order a rdfs:Class ;
-	rdfs:label "Order" ;
-	rdfs:comment "Progress isports Order table" .
-
-order:Order-num a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Order-num" .
-
-order:Cust-Num a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Cust-Num" .
-
-order:Order-Date a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:date ;
-	rdfs:label "Order-Date" .
-
-order:Ship-Date a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:date ;
-	rdfs:label "Ship-Date" .
-
-order:Promise-Date a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:date ;
-	rdfs:label "Promise-Date" .
-
-order:Carrier a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:string ;
-	rdfs:label "Carrier" .
-
-order:Instructions a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:string ;
-	rdfs:label "Instructions" .
-
-order:PO a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:string ;
-	rdfs:label "PO" .
-
-order:Terms a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:string ;
-	rdfs:label "Terms" .
-
-order:Sales-Rep a rdf:Property ;
-	rdfs:domain order:Order ;
-	rdfs:range xsd:string ;
-	rdfs:label "Sales-Rep" .
-
-
-
-item:Item a rdfs:Class ;
-	rdfs:label "Item" ;
-	rdfs:comment "Progress isports Item table" .
-
-item:Item-num a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Item-num" .
-
-item:Item-Name a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:string ;
-	rdfs:label "Item-Name" .
-
-item:Cat-Page a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Cat-Page" .
-
-item:Price a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Price" .
-
-item:Cat-Description a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:string ;
-	rdfs:label "Cat-Description" .
-
-item:On-hand a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:integer ;
-	rdfs:label "On-hand" .
-
-item:Allocated a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Allocated" .
-
-item:Re-Order a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Re-Order" .
-
-item:On-Order a rdf:Property ;
-	rdfs:domain item:Item ;
-	rdfs:range xsd:integer ;
-	rdfs:label "On-Order" .
-
-
-
-orderline:Order-Line a rdfs:Class ;
-	rdfs:label "Order-Line" ;
-	rdfs:comment "Progress isports Order-Line table" .
-
-orderline:Order-num a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Order-num" .
-
-orderline:Line-num a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Line-num" .
-
-orderline:Item-num a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Item-num" .
-
-orderline:Price a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Price" .
-
-orderline:Qty a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Qty" .
-
-orderline:Discount a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Discount" .
-
-orderline:Extended-Price a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Extended-Price" .
-
-orderline:Backorder a rdf:Property ;
-	rdfs:domain orderline:Order-Line ;
-	rdfs:range xsd:byte ;
-	rdfs:label "Backorder" .
-
-
-
-invoice:Invoice a rdfs:Class ;
-	rdfs:label "Invoice" ;
-	rdfs:comment "Progress isports Invoice table" .
-
-invoice:Invoice-Num a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Invoice-Num" .
-
-invoice:Cust-Num a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Cust-Num" .
-
-invoice:Invoice-Date a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:date ;
-	rdfs:label "Invoice-Date" .
-
-invoice:Amount a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Amount" .
-
-invoice:Total-Paid a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Total-Paid" .
-
-invoice:Adjustment a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Adjustment" .
-
-invoice:Order-Num a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Order-Num" .
-
-invoice:Ship-Charge a rdf:Property ;
-	rdfs:domain invoice:Invoice ;
-	rdfs:range xsd:decimal ;
-	rdfs:label "Ship-Charge" .
-
-
-
-localdefault:Local-Default a rdfs:Class ;
-	rdfs:label "Local-Default" ;
-	rdfs:comment "Progress isports Local-Default table" .
-
-localdefault:Country a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Country" .
-
-localdefault:Region1-Label a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Region1-Label" .
-
-localdefault:Region2-Label a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Region2-Label" .
-
-localdefault:Postal-Label a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Postal-Label" .
-
-localdefault:Postal-Format a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Postal-Format" .
-
-localdefault:Tel-Format a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Tel-Format" .
-
-localdefault:Date-Format a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Date-Format" .
-
-localdefault:Currency-Symbol a rdf:Property ;
-	rdfs:domain localdefault:Local-Default ;
-	rdfs:range xsd:string ;
-	rdfs:label "Currency-Symbol" .
-
-
-
-refcall:Ref-Call a rdfs:Class ;
-	rdfs:label "Ref-Call" ;
-	rdfs:comment "Progress isports Ref-Call table" .
-
-refcall:Call-Num a rdf:Property ;
-	rdfs:domain refcall:Ref-Call ;
-	rdfs:range xsd:string ;
-	rdfs:label "Call-Num" .
-
-refcall:Cust-Num a rdf:Property ;
-	rdfs:domain refcall:Ref-Call ;
-	rdfs:range xsd:integer ;
-	rdfs:label "Cust-Num" .
-
-refcall:Call-Date a rdf:Property ;
-	rdfs:domain refcall:Ref-Call ;
-	rdfs:range xsd:date ;
-	rdfs:label "Call-Date" .
-
-refcall:Sales-Rep a rdf:Property ;
-	rdfs:domain refcall:Ref-Call ;
-	rdfs:range xsd:string ;
-	rdfs:label "Sales-Rep" .
-
-refcall:Parent a rdf:Property ;
-	rdfs:domain refcall:Ref-Call ;
-	rdfs:range xsd:string ;
-	rdfs:label "Parent" .
-
-refcall:Txt a rdf:Property ;
-	rdfs:domain refcall:Ref-Call ;
-	rdfs:range xsd:string ;
-	rdfs:label "Txt" .
-
-
-
-salesrep:Salesrep a rdfs:Class ;
-	rdfs:label "Salesrep" ;
-	rdfs:comment "Progress isports Salesrep table" .
-
-salesrep:Sales-Rep a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Sales-Rep" .
-
-salesrep:Rep-Name a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Rep-Name" .
-
-salesrep:Region a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Region" .
-
-salesrep:Month-Quota a rdf:Property ;
-	rdfs:domain salesrep:Salesrep ;
-	rdfs:range xsd:string ;
-	rdfs:label "Month-Quota" .
-
-
-
-state:State a rdfs:Class ;
-	rdfs:label "State" ;
-	rdfs:comment "Progress isports State table" .
-
-state:State_ a rdf:Property ;
-	rdfs:domain state:State ;
-	rdfs:range xsd:string ;
-	rdfs:label "State" .
-
-state:State-Name a rdf:Property ;
-	rdfs:domain state:State ;
-	rdfs:range xsd:string ;
-	rdfs:label "State-Name" .
-
-state:Region a rdf:Property ;
-	rdfs:domain state:State ;
-	rdfs:range xsd:string ;
-	rdfs:label "Region" .
-
-', '', 'http://localhost:8890/schemas/progress/isports', 0);
-
-
-
------------ Create IRI Classes -------------
-
-
-
-
-SPARQL
-
-prefix customer:     <http://localhost:8890/schemas/progress/isports/customer/>
-prefix order:        <http://localhost:8890/schemas/progress/isports/order/>
-prefix item:         <http://localhost:8890/schemas/progress/isports/item/>
-prefix orderline:    <http://localhost:8890/schemas/progress/isports/order_line/>
-prefix invoice:      <http://localhost:8890/schemas/progress/isports/invoice/>
-prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/>
-prefix refcall:      <http://localhost:8890/schemas/progress/isports/ref_call/>
-prefix salesrep:     <http://localhost:8890/schemas/progress/isports/salesrep/>
-prefix state:        <http://localhost:8890/schemas/progress/isports/state/>
-
-create iri class customer:customer_iri
-	"http://localhost:8890/progress/isports/customer/%d#this"
-	(in Cust_Num integer not null) .
-
-create iri class order:order_iri
-	"http://localhost:8890/progress/isports/order/%d#this"
-	(in Order_Num integer not null) .
-
-create iri class item:item_iri
-	"http://localhost:8890/progress/isports/item/%d#this"
-	(in Item_num integer not null) .
-
-create iri class orderline:order-line_iri
-	"http://localhost:8890/progress/isports/order-line/%d_%d#this"
-	(in Order_num integer not null, in Line_num integer not null) .
-
-create iri class invoice:invoice_iri
-	"http://localhost:8890/progress/isports/invoice/%d#this"
-	(in Invoice_Num integer not null) .
-
-create iri class localdefault:local-default_iri
-	"http://localhost:8890/progress/isports/local-default/%U#this"
-	(in Country varchar not null) .
-
-create iri class refcall:ref-call_iri
-	"http://localhost:8890/progress/isports/ref-call/%U#this"
-	(in Call_Num varchar not null) .
-
-create iri class salesrep:salesrep_iri
-	"http://localhost:8890/progress/isports/salesrep/%U#this"
-	(in Sales_Rep varchar not null) .
-
-create iri class state:state_iri
-	"http://localhost:8890/progress/isports/state/%U#this"
-	(in State varchar not null) .
-
-;
+      <sect4 id="virtuosospongercreatecustcartrexmp">
+        <title>MusicBrainz Example: A Music Metadatabase</title>
+        <para>To illustrate some of the material presented so far, we'll delve
+deeper into the <ulink url="http://musicbrainz.org/">MusicBrainz</ulink> cartridge mentioned earlier.</para>
+        <para><emphasis>MusicBrainz XML Web Service</emphasis></para>
+        <para>The cartridge extracts data through the <ulink url="http://musicbrainz.org/doc/XMLWebService">MusicBrainz XML Web Service</ulink> using, as the basis
+for the initial query, an item type and MBID (MusicBrainz ID) extracted from the original URI submitted
+to the RDF proxy. A range of item types are supported including artist, release and track.</para>
+        <para>Using the album "Imagine" by John Lennon as an example, a standard HTML description of
+the album (which has an MBID of f237e6a0-4b0e-4722-8172-66f4930198bc) can be retrieved direct from
+MusicBrainz using the URL:</para>
+<programlisting><![CDATA[
+http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html
+]]></programlisting>
+        <para>Alternatively, information can be extracted in XML form through the web service.
+A description of the tracks on the album can be obtained with the query:</para>
+<programlisting><![CDATA[
+http://musicbrainz.org/ws/1/release/f237e6a0-4b0e-4722-8172-66f4930198bc?type=xml&inc=tracks
+]]></programlisting>
+        <para>The XML returned by the web service is shown below (only the first two tracks
+are shown for brevity):</para>
+<programlisting><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+  <metadata xmlns="http://musicbrainz.org/ns/mmd-1.0#"
+   xmlns:ext="http://musicbrainz.org/ns/ext-1.0#">
+    <release id="f237e6a0-4b0e-4722-8172-66f4930198bc" type="Album Official" >
+      <title>Imagine</title>
+        <text-representation language="ENG" script="Latn"/>
+        <asin>B0000457L2</asin>
+        <track-list>
+          <track id="b88bdafd-e675-4c6a-9681-5ea85ab99446">
+            <title>Imagine</title>
+            <duration>182933</duration>
+          </track>
+          <track id="b38ce90d-3c47-4ccd-bea2-4718c4d34b0d">
+            <title>Crippled Inside</title>
+            <duration>227906</duration>
+          </track>
+	  . . .
+        </track-list>
+      </release>
+  </metadata>
+]]></programlisting>
+        <para>Although, as shown above, MusicBrainz defines its own <ulink url="http://musicbrainz.org/doc/MusicBrainzXMLMetaData">XML Metadata Format</ulink> to represent
+music metadata, the MusicBrainz sponger converts the raw data to a subset of the <ulink url="http://musicontology.com/">Music Ontology</ulink>,
+an RDF vocabulary which aims to provide a set of core classes and properties for describing music
+on the Semantic Web. Part of the subset used is depicted in the following RDF graph (representing
+in this case a John Cale album).</para>
+        <figure id="spong7" float="1">
+          <title>RDF graph</title>
+          <graphic fileref="ui/spong7.png"/>
+        </figure>
+        <para>With the prefix mo: denoting the Music Ontology at http://purl.org/ontology/mo/, it can be
+seen that artists are represented by instances of class mo:Artist, their albums, records etc. by instances
+of class mo:Release and tracks on these releases by class mo:Track. The property foaf:made links an
+artist and his/her releases. Property mo:track links a release with the tracks it contains</para>
+        <para><emphasis>RDF Output</emphasis></para>
+        <para>An RDF description of the album can be obtained by sponging the same URL, i.e. by submitting it to the Sponger's proxy interface using the URL:</para>
+<programlisting><![CDATA[
+http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html
+]]></programlisting>
+        <para>The extract below shows part of the (reorganized) RDF output returned by the Sponger
+for "Imagine". Only the album's title track is included.</para>
+<programlisting><![CDATA[
+<?xml version="1.0" encoding="utf-8" ?>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
 
+<rdf:Description
+ rdf:about="http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html">
+  <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Document"/>
+</rdf:Description>
 
+<rdf:Description
+ rdf:about="http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html">
+  <foaf:primaryTopic xmlns:foaf="http://xmlns.com/foaf/0.1/"
+   rdf:resource="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html#this"/>
+</rdf:Description>
 
+<rdf:Description rdf:about="http://purl.org/ontology/mo/">
+  <rdf:type rdf:resource="http://www.openlinksw.com/schema/attribution#DataSource"/>
+</rdf:Description>
+...
+<rdf:Description
+ rdf:about="http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html">
+  <rdfs:isDefinedBy rdf:resource="http://purl.org/ontology/mo/"/>
 
+</rdf:Description>
+...
+<!-- Record description -->
+<rdf:Description
+ rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html#this">
+  <rdf:type rdf:resource="http://purl.org/ontology/mo/Record"/>
+</rdf:Description>
 
+<rdf:Description
+ rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html#this">
+  <dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">Imagine</dc:title>
+</rdf:Description>
 
+<rdf:Description
+ rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html#this">
+  <mo:release_status xmlns:mo="http://purl.org/ontology/mo/" rdf:resource="http://purl.org/ontology/mo/official"/>
+</rdf:Description>
 
-------------- Create Quad Store ------------------------------------
+<rdf:Description
+ rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html#this">
+  <mo:release_type xmlns:mo="http://purl.org/ontology/mo/"
+   rdf:resource="http://purl.org/ontology/mo/album"/>
+</rdf:Description>
+<!-- Title track description -->
+<rdf:Description
+ rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html#this">
+  <mo:track xmlns:mo="http://purl.org/ontology/mo/"
+   rdf:resource="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/track/b88bdafd-e675-4c6a-9681-5ea85ab99446.html#this"/>
+</rdf:Description>
+<rdf:Description
+ rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/track/b88bdafd-e675-4c6a-9681-5ea85ab99446.html#this">
+  <rdf:type rdf:resource="http://purl.org/ontology/mo/Track"/>
+</rdf:Description>
 
-SPARQL
+<rdf:Description
+ rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/track/b88bdafd-e675-4c6a-9681-5ea85ab99446.html#this">
+  <dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">Imagine</dc:title>
+</rdf:Description>
 
-prefix customer:     <http://localhost:8890/schemas/progress/isports/customer/>
-prefix order:        <http://localhost:8890/schemas/progress/isports/order/>
-prefix item:         <http://localhost:8890/schemas/progress/isports/item/>
-prefix orderline:    <http://localhost:8890/schemas/progress/isports/order_line/>
-prefix invoice:      <http://localhost:8890/schemas/progress/isports/invoice/>
-prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/>
-prefix refcall:      <http://localhost:8890/schemas/progress/isports/ref_call/>
-prefix salesrep:     <http://localhost:8890/schemas/progress/isports/salesrep/>
-prefix state:        <http://localhost:8890/schemas/progress/isports/state/>
+<rdf:Description
+ rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/track/b88bdafd-e675-4c6a-9681-5ea85ab99446.html#this">
+  <mo:track_number xmlns:mo="http://purl.org/ontology/mo/">1</mo:track_number>
+</rdf:Description>
 
-alter quad storage virtrdf:DefaultQuadStorage
-  from isports_rdf.prs10_isports_rdf.VCustomer      as Customer_tbl
-  from isports_rdf.prs10_isports_rdf.VOrder         as Order_tbl
-  from isports_rdf.prs10_isports_rdf.VItem          as Item_tbl
-  from isports_rdf.prs10_isports_rdf.VOrder_Line    as Order_Line_tbl
-  from isports_rdf.prs10_isports_rdf.VInvoice       as Invoice_tbl
-  from isports_rdf.prs10_isports_rdf.VRef_Call      as Ref_Call_tbl
-  from isports_rdf.prs10_isports_rdf.VRef_Call      as Ref_Call_tbl_1  -- Additional Ref_Call_tbl_1 alias required to represent recursive FK relationship (refcall:has_parent) below.
-  from isports_rdf.prs10_isports_rdf.VLocal_Default as Local_Default_tbl
-  from isports_rdf.prs10_isports_rdf.VSalesrep      as Salesrep_tbl
-  from isports_rdf.prs10_isports_rdf.VState         as State_tbl
+<rdf:Description
+ rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/track/b88bdafd-e675-4c6a-9681-5ea85ab99446.html#this">
+  <mo:duration xmlns:mo="http://purl.org/ontology/mo/" rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">182933</mo:duration>
+</rdf:Description>
+</rdf:RDF>
+]]></programlisting>
+        <para><emphasis>Cartridge Hook Function</emphasis></para>
+        <para>The cartridge's hook function is listed below. It is important to note that MusicBrainz
+ supports a variety of query types, each of which returns a different set of information, depending
+on the item type being queried. Full details can be found on the MusicBrainz? site. The sponger
+cartridge is capable of handling all the query types supported by MusicBrainz? and is intended to
+be used in a drill-down scenario, as would be the case when using an RDF browser such as the
+<ulink url="http://ode.openlinksw.com/">OpenLink Data Explorer (ODE)</ulink>. This example focuses primarily on the types release and track.</para>
+<programlisting><![CDATA[
+create procedure DB.DBA.RDF_LOAD_MBZ (
+  in graph_iri varchar, in new_origin_uri varchar, in dest varchar,
+  inout _ret_body any, inout aq any, inout ps any, inout _key any,
+  inout opts any)
 {
-  create virtrdf:progress_isports as graph <http://localhost:8890/progress/isports>
-  {
-    customer:customer_iri (Customer_tbl.Cust_Num) a customer:Customer as virtrdf:customer_pk ;
-    customer:Cust-Num     Customer_tbl.Cust_Num     as virtrdf:Customer_cust-num ;
-    customer:Name         Customer_tbl.Name         as virtrdf:Customer_name ;
-    customer:Address      Customer_tbl.Address      as virtrdf:Customer_address ;
-    customer:Address2     Customer_tbl.Address2     as virtrdf:Customer_address2 ;
-    customer:City         Customer_tbl.City         as virtrdf:Customer_city ;
-    customer:State        Customer_tbl.State        as virtrdf:Customer_state ;
-    customer:Country      Customer_tbl.Country      as virtrdf:Customer_country ;
-    customer:Phone        Customer_tbl.Phone        as virtrdf:Customer_phone ;
-    customer:Contact      Customer_tbl.Contact      as virtrdf:Customer_contact ;
-    customer:Sales-Rep    Customer_tbl.Sales_Rep    as virtrdf:Customer_sales_rep ;
-    customer:Comments     Customer_tbl.Comments     as virtrdf:Customer_comments ;
-    customer:Credit-Limit Customer_tbl.Credit_Limit as virtrdf:Customer_credit-limit ;
-    customer:Balance      Customer_tbl.Balance      as virtrdf:Customer_balance ;
-    customer:Terms        Customer_tbl.Terms        as virtrdf:Customer_terms ;
-    customer:Discount     Customer_tbl.Discount     as virtrdf:Customer_discount ;
-    customer:Postal-Code  Customer_tbl.Postal_Code  as virtrdf:Customer_postal-code ;
-    customer:from_state        state:state_iri (State_tbl.State)                           where ( ^{Customer_tbl.}^.State     = ^{State_tbl.}^.State )           as virtrdf:Customer_from_state ;
-    customer:has_sales_rep     salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)              where ( ^{Customer_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep )    as virtrdf:Customer_has_sales_rep ;
-    customer:has_local_default localdefault:local-default_iri (Local_Default_tbl.Country)  where ( ^{Customer_tbl.}^.Country   = ^{Local_Default_tbl.}^.Country ) as virtrdf:Customer_has_local_default ;
-    customer:placed_order      order:order_iri (Order_tbl.Order_num)                       where ( ^{Customer_tbl.}^.Cust_Num  = ^{Order_tbl.}^.Cust_Num )        as virtrdf:Customer_placed_order ;
-    customer:has_invoice       invoice:invoice_iri (Invoice_tbl.Invoice_Num)               where ( ^{Customer_tbl.}^.Cust_Num  = ^{Invoice_tbl.}^.Cust_Num )      as virtrdf:Customer_has_invoice ;
-    customer:ref_call          refcall:ref-call_iri (Ref_Call_tbl.Call_Num)                where ( ^{Customer_tbl.}^.Cust_Num  = ^{Ref_Call_tbl.}^.Cust_Num )     as virtrdf:Customer_ref-call .
-
-    order:order_iri (Order_tbl.Order_num) a order:Order as virtrdf:order_pk ;
-    order:Order-num    Order_tbl.Order_num    as virtrdf:Order_order-num ;
-    order:Cust-Num     Order_tbl.Cust_Num     as virtrdf:Order_cust_num ;
-    order:Order-Date   Order_tbl.Order_Date   as virtrdf:Order_order-date ;
-    order:Ship-Date    Order_tbl.Ship_Date    as virtrdf:Order_ship-date ;
-    order:Promise-Date Order_tbl.Promise_Date as virtrdf:Order_promise-date ;
-    order:Carrier      Order_tbl.Carrier      as virtrdf:Order_carrier ;
-    order:Instructions Order_tbl.Instructions as virtrdf:Order_instructions ;
-    order:PO           Order_tbl.PO           as virtrdf:Order_po ;
-    order:Terms        Order_tbl.Terms        as virtrdf:Order_terms ;
-    order:placed_by    customer:customer_iri (Customer_tbl.Cust_Num)                                 where ( ^{Order_tbl.}^.Cust_Num  = ^{Customer_tbl.}^.Cust_Num )    as virtrdf:Order_placed_by ;
-    order:Sales-Rep    salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)                                where ( ^{Order_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep )   as virtrdf:Order_sales_rep ;
-    order:invoiced_on  invoice:invoice_iri (Invoice_tbl.Invoice_Num)                                 where ( ^{Order_tbl.}^.Order_num = ^{Invoice_tbl.}^.Order_Num )    as virtrdf:Order_invoiced_on ;
-    order:has_lines    orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num)  where ( ^{Order_tbl.}^.Order_num = ^{Order_Line_tbl.}^.Order_num ) as virtrdf:Order_has_lines .
-
-    item:item_iri (Item_tbl.Item_num) a item:Item as virtrdf:item_pk ;
-    item:Item-num        Item_tbl.Item_num        as virtrdf:item_item-num ;
-    item:Item-Name       Item_tbl.Item_Name       as virtrdf:Item_item-Name ;
-    item:Cat-Page        Item_tbl.Cat_Page        as virtrdf:Item_cat-page ;
-    item:Price           Item_tbl.Price           as virtrdf:Item_price ;
-    item:Cat-Description Item_tbl.Cat_Description as virtrdf:Item_cat-description ;
-    item:On-hand         Item_tbl.On_hand         as virtrdf:Item_on-hand ;
-    item:Allocated       Item_tbl.Allocated       as virtrdf:Item_allocated ;
-    item:Re-Order        Item_tbl.Re_Order        as virtrdf:Item_re-order ;
-    item:On-Order        Item_tbl.On_Order        as virtrdf:Item_on-order ;
-    item:order_line  orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num)  where ( ^{Item_tbl.}^.Item_num  = ^{Order_Line_tbl.}^.Item_num )   as virtrdf:Item_order_line .
-
-    orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num) a orderline:Order-Line as virtrdf:order-line_pk ;
-    orderline:Line-num       Order_Line_tbl.Line_num       as virtrdf:Order-Line_line-num ;
-    orderline:Price          Order_Line_tbl.Price          as virtrdf:Order-Line_price ;
-    orderline:Qty            Order_Line_tbl.Qty            as virtrdf:Order-Line_qty ;
-    orderline:Discount       Order_Line_tbl.Discount       as virtrdf:Order-Line_discount ;
-    orderline:Extended-Price Order_Line_tbl.Extended_Price as virtrdf:Order-Line_extended-price ;
-    orderline:Backorder      Order_Line_tbl.Backorder      as virtrdf:Order-Line_backorder ;
-    orderline:Order-num  order:order_iri (Order_tbl.Order_num)  where ( ^{Order_Line_tbl.}^.Order_num = ^{Order_tbl.}^.Order_num ) as virtrdf:Order_Line_order_num ;
-    orderline:Item-num   item:item_iri (Item_tbl.Item_num)      where ( ^{Order_Line_tbl.}^.Item_num  = ^{Item_tbl.}^.Item_num )   as virtrdf:Order_Line_item_num .
-
-    invoice:invoice_iri (Invoice_tbl.Invoice_Num) a invoice:Invoice as virtrdf:invoice_pk ;
-    invoice:Invoice-Num  Invoice_tbl.Invoice_Num  as virtrdf:Invoice_invoice-num ;
-    invoice:Cust-Num     Invoice_tbl.Cust_Num    as virtrdf:Invoice_cust_num ;
-    invoice:Invoice-Date Invoice_tbl.Invoice_Date as virtrdf:Invoice_invoice-date ;
-    invoice:Amount       Invoice_tbl.Amount       as virtrdf:Invoice_amount ;
-    invoice:Total-Paid   Invoice_tbl.Total_Paid   as virtrdf:Invoice_total-paid ;
-    invoice:Adjustment   Invoice_tbl.Adjustment   as virtrdf:Invoice_adjustment ;
-    invoice:Order-Num    Invoice_tbl.Order_Num    as virtrdf:Invoice_order-num ;
-    invoice:Ship-Charge  Invoice_tbl.Ship_Charge  as virtrdf:Invoice_ship-charge ;
-    invoice:invoiced_to  customer:customer_iri (Customer_tbl.Cust_Num)  where ( ^{Invoice_tbl.}^.Cust_Num  = ^{Customer_tbl.}^.Cust_Num ) as virtrdf:Invoice_invoiced_to ;
-    invoice:Order-Num    order:order_iri (Order_tbl.Order_num)          where ( ^{Invoice_tbl.}^.Order_Num = ^{Order_tbl.}^.Order_num )   as virtrdf:Invoice_order_num .
-
-    localdefault:local-default_iri (Local_Default_tbl.Country) a localdefault:Local-Default as virtrdf:local-default_pk ;
-    localdefault:Country         Local_Default_tbl.Country as virtrdf:local-default_country ;
-    localdefault:Region1-Label   Local_Default_tbl.Region1_Label   as virtrdf:Local-Default_region1-label ;
-    localdefault:Region2-Label   Local_Default_tbl.Region2_Label   as virtrdf:Local-Default_region2-label ;
-    localdefault:Postal-Label    Local_Default_tbl.Postal_Label    as virtrdf:Local-Default_postal-label ;
-    localdefault:Postal-Format   Local_Default_tbl.Postal_Format   as virtrdf:Local-Default_postal-format ;
-    localdefault:Tel-Format      Local_Default_tbl.Tel_Format      as virtrdf:Local-Default_tel-format ;
-    localdefault:Date-Format     Local_Default_tbl.Date_Format     as virtrdf:Local-Default_date-format ;
-    localdefault:Currency-Symbol Local_Default_tbl.Currency_Symbol as virtrdf:Local-Default_currency-symbol ;
-    localdefault:has_customer customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Local_Default_tbl.}^.Country = ^{Customer_tbl.}^.Country ) as virtrdf:Local-Default_has_customer .
-
-    refcall:ref-call_iri (Ref_Call_tbl.Call_Num) a refcall:Ref-Call as virtrdf:ref-call_pk ;
-    refcall:Call-Num   Ref_Call_tbl.Call_Num   as virtrdf:Ref-Call_call-num ;
-    refcall:Cust-Num   Ref_Call_tbl.Cust_Num   as virtrdf:Ref-Call_cust-num ;
-    refcall:Call-Date  Ref_Call_tbl.Call_Date  as virtrdf:Ref-Call_call-date ;
-    refcall:Sales-Rep  Ref_Call_tbl.Sales_Rep  as virtrdf:Ref-sales-rep ;
-    refcall:Parent     Ref_Call_tbl.Parent     as virtrdf:Ref-Call_parent ;
-    refcall:Txt        Ref_Call_tbl.Txt        as virtrdf:Ref-Call_txt ;
-    refcall:made_to     customer:customer_iri (Customer_tbl.Cust_Num)   where  ( ^{Ref_Call_tbl.}^.Cust_Num  = ^{Customer_tbl.}^.Cust_Num )    as virtrdf:Ref-Call_made_to ;
-    refcall:made_by     salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)  where  ( ^{Ref_Call_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep )   as virtrdf:Ref-Call_made-by ;
-    refcall:has_parent  refcall:ref-call_iri (Ref_Call_tbl_1.Call_Num)  where  ( ^{Ref_Call_tbl.}^.Parent    = ^{Ref_Call_tbl_1.}^.Call_Num )  as virtrdf:Ref-Call_has_parent .
-
-    salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep) a salesrep:Salesrep as virtrdf:salesrep_pk ;
-    salesrep:Sales-Rep   Salesrep_tbl.Sales_Rep   as virtrdf:Salesrep_sales-rep ;
-    salesrep:Region      Salesrep_tbl.Region      as virtrdf:Salesrep_region ;
-    salesrep:Rep-Name    Salesrep_tbl.Rep_Name    as virtrdf:Salesrep_rep-name ;
-    salesrep:Month-Quota Salesrep_tbl.Month_Quota as virtrdf:Salesrep_month-quota ;
-    salesrep:is_sales_rep_for customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Customer_tbl.}^.Sales_Rep ) as virtrdf:Salesrep_is_sales_rep_for ;
-    salesrep:has_order        order:order_iri (Order_tbl.Order_num)         where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Order_tbl.}^.Sales_Rep )    as virtrdf:Salesrep_has_order ;
-    salesrep:manages_region   state:state_iri (State_tbl.State)             where ( ^{Salesrep_tbl.}^.Region    = ^{State_tbl.}^.Region )       as virtrdf:Salesrep_manages_region ;
-    salesrep:made_call        refcall:ref-call_iri (Ref_Call_tbl.Call_Num)  where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Ref_Call_tbl.}^.Sales_Rep ) as virtrdf:Ref-Call_made_call .
-
-    state:state_iri (State_tbl.State) a state:State as virtrdf:state_pk ;
-    state:State_     State_tbl.State        as virtrdf:State_state ;
-    state:State-Name State_tbl.State_Name   as virtrdf:State_state-name ;
-    state:Region     State_tbl.Region       as virtrdf:State_region ;
-    state:has_customer   customer:customer_iri (Customer_tbl.Cust_Num)   where ( ^{State_tbl.}^.State  = ^{Customer_tbl.}^.State )  as virtrdf:State_has_customer ;
-    state:has_sales_rep  salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)  where ( ^{State_tbl.}^.Region = ^{Salesrep_tbl.}^.Region ) as virtrdf:State_has_sales_rep .
-
-
-  } .
-} .
-;
-
-
--- Setup re-write rules that enable de-referencing of RDF based descriptions of
--- iSports Entities
-
--- Cleanup old rules
-
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'progress_isports_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'progress_isports_rule%';
+  declare kind, id varchar;
+  declare tmp, incs any;
+  declare uri, cnt, hdr, inc, xd, xt varchar;
+  tmp := regexp_parse ('http://musicbrainz.org/([^/]*)/([^\.]+)', new_origin_uri, 0);
+  declare exit handler for sqlstate '*'
+  {
+    -- dbg_printf ('%s', __SQL_MESSAGE);
+    return 0;
+  };
+  if (length (tmp) < 6)
+    return 0;
 
--- Create rules for handling HTML representation of Entity (resource) description requests
+  kind := subseq (new_origin_uri, tmp[2], tmp[3]);
+  id :=   subseq (new_origin_uri, tmp[4], tmp[5]);
+  incs := vector ();
+  if (kind = 'artist')
+    {
+      inc := 'aliases artist-rels label-rels release-rels track-rels url-rels';
+      incs :=
+    vector (
+	'sa-Album', 'sa-Single', 'sa-EP', 'sa-Compilation', 'sa-Soundtrack',
+	'sa-Spokenword', 'sa-Interview', 'sa-Audiobook', 'sa-Live', 'sa-Remix', 'sa-Other'
+	, 'va-Album', 'va-Single', 'va-EP', 'va-Compilation', 'va-Soundtrack',
 
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'progress_isports_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
+	'va-Spokenword', 'va-Interview', 'va-Audiobook', 'va-Live', 'va-Remix', 'va-Other'
+	);
+    }
+  else if (kind = 'release')
+    inc := 'artist counts release-events discs tracks artist-rels label-rels release-rels track-rels url-rels track-level-rels labels';
+  else if (kind = 'track')
+    inc := 'artist releases puids artist-rels label-rels release-rels track-rels url-rels';
+  else if (kind = 'label')
+    inc := 'aliases artist-rels label-rels release-rels track-rels url-rels';
+  else
+    return 0;
+  if (dest is null)
+    DELETE FROM DB.DBA.RDF_QUAD WHERE G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_iri);
+  DB.DBA.RDF_LOAD_MBZ_1 (graph_iri, new_origin_uri, dest, kind, id, inc);
+  DB.DBA.TTLP (sprintf ('<%S> <http://xmlns.com/foaf/0.1/primaryTopic> <%S> .\n<%S> a <http://xmlns.com/foaf/0.1/Document> .',
+  	new_origin_uri, DB.DBA.RDF_SPONGE_PROXY_IRI (new_origin_uri), new_origin_uri),
+  	'', graph_iri);
+  foreach (any inc1 in incs) do
+    {
+      DB.DBA.RDF_LOAD_MBZ_1 (graph_iri, new_origin_uri, dest, kind, id, inc1);
+    }
+  return 1;
+};
+]]></programlisting>
+        <para>The hook function uses a subordinate procedure RDF_LOAD_MBZ_1:</para>
+<programlisting><![CDATA[
+create procedure DB.DBA.RDF_LOAD_MBZ_1 (in graph_iri varchar, in new_origin_uri varchar,
+   in dest varchar, in kind varchar, in id varchar, in inc varchar)
+{
+  declare uri, cnt, xt, xd, hdr any;
+  uri := sprintf ('http://musicbrainz.org/ws/1/%s/%s?type=xml&inc=%U', kind, id, inc);
+  cnt := RDF_HTTP_URL_GET (uri, '', hdr, 'GET', 'Accept: */*');
+  xt := xtree_doc (cnt);
+  xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/mbz2rdf.xsl', xt,
+        vector ('baseUri', new_origin_uri));
+  xd := serialize_to_UTF8_xml (xd);
+  DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+};
+]]></programlisting>
+        <para><emphasis>XSLT Stylesheet</emphasis></para>
+        <para>The key sections of the MusicBrainz XSLT template relevant to this example are
+listed below. Only the sections relating to an artist, his releases, or the tracks on those
+releases, are shown.</para>
+<programlisting><![CDATA[
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
+<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
+<!ENTITY mo "http://purl.org/ontology/mo/">
+<!ENTITY foaf "http://xmlns.com/foaf/0.1/">
+<!ENTITY mmd "http://musicbrainz.org/ns/mmd-1.0#">
+<!ENTITY dc "http://purl.org/dc/elements/1.1/">
+]>
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+    xmlns:rdf=""
+    xmlns:rdfs=""
+    xmlns:foaf=""
+    xmlns:mo=""
+    xmlns:mmd=""
+    xmlns:dc=""
+    >
 
--- Create rules for handling RDF based representations (N3 or RDF/XML) of Entity (resource) descriptions
+    <xsl:output method="xml" indent="yes" />
+    <xsl:variable name="base" select="'http://musicbrainz.org/'"/>
+    <xsl:variable name="uc">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
+    <xsl:variable name="lc">abcdefghijklmnopqrstuvwxyz</xsl:variable>
+    <xsl:template match="/mmd:metadata">
+	<rdf:RDF>
+	    <xsl:apply-templates />
+	</rdf:RDF>
+    </xsl:template>
 
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'progress_isports_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/progress/isports%%3E&format=%U',
-    vector('path', 'path', '*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
+    ...
 
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'progress_isports_rule_list1',
-    1,
-    vector (
-  	 	'progress_isports_rule1',
-  	 	'progress_isports_rule2'
-	  ));
+    <xsl:template match="mmd:artist[@type='Person']">
+	<mo:MusicArtist rdf:about="{vi:proxyIRI (concat($base,'artist/', at id,'.html'))}">
+	    <foaf:name><xsl:value-of select="mmd:name"/></foaf:name>
+	    <xsl:for-each select="mmd:release-list/mmd:release|mmd:relation-list[@target-type='Release']/mmd:relation/mmd:release">
+		<foaf:made rdf:resource="{vi:proxyIRI (concat($base,'release/', at id,'.html'))}"/>
+	    </xsl:for-each>
+	</mo:MusicArtist>
+	<xsl:apply-templates />
+    </xsl:template>
 
--- Setup OWL ontology data space that describes iSports entities
+    <xsl:template match="mmd:release">
+	<mo:Record rdf:about="{vi:proxyIRI (concat($base,'release/', at id,'.html'))}">
+	    <dc:title><xsl:value-of select="mmd:title"/></dc:title>
+	    <mo:release_type rdf:resource="{translate (substring-before (@type, ' '),
+                                                          $uc, $lc)}"/>
+	    <mo:release_status rdf:resource="{translate (substring-after (@type, ' '), $uc,
+                                                  $lc)}"/>
+	    <xsl:for-each select="mmd:track-list/mmd:track">
+		<mo:track rdf:resource="{vi:proxyIRI (concat($base,'track/', at id,'.html'))}"/>
 
--- Create Virtual Directory access point
+	    </xsl:for-each>
+	</mo:Record>
+	<xsl:apply-templates select="mmd:track-list/mmd:track"/>
+    </xsl:template>
 
-VHOST_REMOVE (lpath=>'/progress/isports');
+    <xsl:template match="mmd:track">
+	<mo:Track rdf:about="{vi:proxyIRI (concat($base,'track/', at id,'.html'))}">
+	    <dc:title><xsl:value-of select="mmd:title"/></dc:title>
+	    <mo:track_number><xsl:value-of select="position()"/></mo:track_number>
+	    <mo:duration rdf:datatype="integer">
+             <xsl:value-of select="mmd:duration"/>
+           </mo:duration>
+	    <xsl:if test="artist[@id]">
+		<foaf:maker rdf:resource="{vi:proxyIRI (concat ($base, 'artist/',
+                                          artist/@id, '.html'))}"/>
+	    </xsl:if>
+	    <mo:musicbrainz rdf:resource="{vi:proxyIRI (concat ($base, 'track/', @id, '.html'))}"/>
+	</mo:Track>
+    </xsl:template>
 
-VHOST_DEFINE (
-	lpath=>'/progress/isports',
-	ppath=>'/DAV/progress/isports/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'progress_isports_rule_list1')
-	);
+    ...
 
-delete from db.dba.url_rewrite_rule_list where urrl_list like 'progress_isports_schemas_rule%';
-delete from db.dba.url_rewrite_rule where urr_rule like 'progress_isports_schemas_rule%';
+    <xsl:template match="text()"/>
+</xsl:stylesheet>
+]]></programlisting>
+      </sect4>
+      <sect4 id="virtuosospongercreatecartentextmapcont">
+        <title>Entity Extractor & Mapper Component</title>
 
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'progress_isports_schemas_rule1',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/about/html/http/^{URIQADefaultHost}^%s',
-    vector('path'),
-    null,
-    '(text/html)|(\\*/\\*)',
-    0,
-    303
-    );
+<para>
+Used to extract RDF from a Web Data Source the Virtuoso Sponger Cartridge RDF Extractor consumes services from: Virtuoso PL, C/C++, Java
+based RDF Extractors</para>
+<para>The RDF mappers provide a way to extract metadata from non-RDF documents such as HTML pages,
+images Office documents etc. and pass to SPARQL sponger (crawler which retrieve missing
+source graphs). For brevity further in this article the "RDF mapper" we simply will call "mapper".
+</para>
+<para>The mappers consist of PL procedure (hook) and extractor, where extractor itself can be built
+using PL, C or any external language supported by Virtuoso server.</para>
+<para>Once the mapper is developed it must be plugged into the SPARQL engine by adding a record
+in the table DB.DBA.SYS_RDF_MAPPERS.</para>
+<para>If a SPARQL query instructs the SPARQL processor to retrieve target graph into local storage,
+then the SPARQL sponger will be invoked. If the target graph IRI represents a dereferenceable URL
+then content will be retrieved using content negotiation. The next step is the content type
+to be detected:</para>
+<itemizedlist>
+<listitem>If RDF and no further transformation such as GRDDL is needed, then the process would stop.</listitem>
+<listitem>If such as 'text/plain' and is not known to have metadata, then the SPARQL sponger will
+look in the DB.DBA.SYS_RDF_MAPPERS table by order of RM_ID and for every matching URL or MIME
+type pattern (depends on column RM_TYPE) will call the mapper hook.
+  <itemizedlist>
+    <listitem>If hook returns zero the next mapper will be tried;</listitem>
+    <listitem>If result is negative the process would stop instructing the SPARQL nothing was retrieved;</listitem>
+    <listitem>If result is positive the process would stop instructing the SPARQL that metadata was retrieved.</listitem>
+  </itemizedlist>
+</listitem>
+</itemizedlist>
+<sect5 id="virtuosospongercartridgesextractorpl">
+  <title>Virtuoso/PL based Extractors</title>
+<para><emphasis>PL hook requirements:</emphasis></para>
+<para>Every PL function used to plug a mapper into SPARQL engine must have following parameters in
+the same order:</para>
+<itemizedlist>
+<listitem>in graph_iri varchar: the graph IRI which is currently retrieved</listitem>
+<listitem>in new_origin_uri varchar: the URL of the document retrieved</listitem>
+<listitem>in destination varchar: the destination graph IRI</listitem>
+<listitem>inout content any: the content of the document retrieved by SPARQL sponger </listitem>
+<listitem>inout async_queue any: an asynchronous queue, can be used to push something to execute
+on background if needed.</listitem>
+<listitem>inout ping_service any: the value of [SPARQL] - PingService INI parameter, could be used
+to configure a service notification such as pingthesemanticweb.com</listitem>
+<listitem>inout api_key any: a plain text id single key value or serialized vector of key structure,
+basically the value of RM_KEY column of the DB.DBA.SYS_RDF_MAPPERS table.</listitem>
+</itemizedlist>
+<para>Note: the names of the parameters are not important, but their order and presence are!</para>
+<para><emphasis>Example Implementation:</emphasis></para>
+<para>In the example script bellow we implement a basic mapper, which maps a text/plain mime type to an
+imaginary ontology, which extends the class Document from FOAF with properties 'txt:UniqueWords'
+and 'txt:Chars', where the prefix 'txt:' we specify as 'urn:txt:v0.0:'.</para>
+<programlisting><![CDATA[
+use DB;
 
-DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
-    'progress_isports_schemas_rule2',
-    1,
-    '(/[^#]*)',
-    vector('path'),
-    1,
-    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/progress/isports%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
-    vector('path','path','*accept*'),
-    null,
-    '(text/rdf.n3)|(application/rdf.xml)',
-    0,
-    null
-    );
+create procedure DB.DBA.RDF_LOAD_TXT_META
+ (
+  in graph_iri varchar,
+  in new_origin_uri varchar,
+  in dest varchar,
+  inout ret_body any,
+  inout aq any,
+  inout ps any,
+  inout ser_key any
+  )
+{
+  declare words, chars int;
+  declare vtb, arr, subj, ses, str any;
+  declare ses any;
+  -- if any error we just say nothing can be done
+  declare exit handler for sqlstate '*'
+    {
+      return 0;
+    };
+  subj := coalesce (dest, new_origin_uri);
+  vtb := vt_batch ();
+  chars := length (ret_body);
 
-DB.DBA.URLREWRITE_CREATE_RULELIST (
-    'progress_isports_schemas_rule_list1',
-    1,
-    vector (
-  	 	'progress_isports_schemas_rule1',
-  	 	'progress_isports_schemas_rule2'
-	  ));
-
--- ensure a VD for the IRIs which begins with /
-VHOST_REMOVE (lpath=>'/schemas/progress/isports');
-
-VHOST_DEFINE (
-	lpath=>'/schemas/progress/isports',
-	ppath=>'/DAV/schemas/progress/isports/',
-    	is_dav=>1,
-	vsp_user=>'dba',
-	is_brws=>0,
-	opts=>vector ('url_rewrite', 'progress_isports_schemas_rule_list1')
-	);
+  -- using the text index procedures we get a list of words
+  vt_batch_feed (vtb, ret_body, 1);
+  arr := vt_batch_strings_array (vtb);
 
-DB.DBA.XML_SET_NS_DECL ('customer',     'http://^{URIQADefaultHost}^/schemas/progress/isports/customer/', 2);
-DB.DBA.XML_SET_NS_DECL ('order',        'http://^{URIQADefaultHost}^/schemas/progress/isports/order/', 2);
-DB.DBA.XML_SET_NS_DECL ('item',         'http://^{URIQADefaultHost}^/schemas/progress/isports/item/', 2);
-DB.DBA.XML_SET_NS_DECL ('orderline',    'http://^{URIQADefaultHost}^/schemas/progress/isports/order_line/', 2);
-DB.DBA.XML_SET_NS_DECL ('invoice',      'http://^{URIQADefaultHost}^/schemas/progress/isports/invoice/', 2);
-DB.DBA.XML_SET_NS_DECL ('localdefault', 'http://^{URIQADefaultHost}^/schemas/progress/isports/local_default/', 2);
-DB.DBA.XML_SET_NS_DECL ('refcall',      'http://^{URIQADefaultHost}^/schemas/progress/isports/ref_call/', 2);
-DB.DBA.XML_SET_NS_DECL ('salesrep',     'http://^{URIQADefaultHost}^/schemas/progress/isports/salesrep/', 2);
-DB.DBA.XML_SET_NS_DECL ('state',        'http://^{URIQADefaultHost}^/schemas/progress/isports/state/', 2);
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfviewnorthwindexample1"><title>Simple Mapping Example -- Northwind RDF View</title>
-<para>Here is example of the basic Northwind RDF Views deployment. The sequence of operations is very common for adding SPARQL access to existing application.</para>
-<para>There exist few important questions to answer. Who should have access to data behind RDF View? Should someone have access to other sorts of RDF data but not to the new View? What are applications that should be interoperable with the new RDF data source? Are there any applications that produce similar data but that data sould be kept apart from data made by view? How to ensure that deployment the view will not cause problems for other applications?</para>
-<para>First of all, we decide whether the default web service endpoint should have access to the data in question. If it should then we have to grant SELECT privileges to the account "SPARQL" that is used for the default endpoint; if it should not but some custom edpoint should then grant to the owner account of that account. Granting access is less trivial that it is usual. On one hand, those who can make SQL SELECT statements on application's tables can also make SPARQL queries on RDF View over that tables, because it makes SQL inside. On the other hand, those who do not intend to query that data at all may get unexpected "permission denied" errors on queries that worked fine before adding an RDF View. If SPARQL compiler can not prove that the query can not access data from the view then it will generate SQL code that will access tables behind the view. In some cases permission problems should be resolved by creating RDF View in a separate <link linkend="rdfviewconfiguringrdfstorages">RDF storage</link>. In this example, data are public:</para>
-<programlisting><![CDATA[
-use DB;
+  -- the list has 'word' and positions array, so we must divide by 2
+  words := length (arr) / 2;
+  ses := string_output ();
 
-GRANT SELECT ON "Demo"."demo"."Products" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Suppliers" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Shippers" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Categories" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Customers" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Employees" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Orders" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Order_Details" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Countries" TO "SPARQL";
-GRANT SELECT ON "Demo"."demo"."Provinces" TO "SPARQL";
-]]></programlisting>
-
-<para>Interoperability is the next question. The example is not
-interoperable with anything so in can provide data of any form, a real
-application will probably use some ontology from external
-source. Sometimes data should be converted from internal application's
-representation to something different (such as metric to imperial or
-ATT country code to two-character country id); sometimes composed IRIs
-should follow special rules; <link
-linkend="rdfviewiriusingfunction">function-based IRI classes</link>
-may help in that cases. As this is the first example, only plain
-format-string-based IRI classes are used.</para>
-
-<para>We should also ensure that data generated by the new view will
-not be accidentally mixed with other data of the database. For that
-purpose the example will use a unique graph name that includes both
-application name and host name. In addition, the script will drop
-declarations that might remain  from a previous run of the same script. The
-script is executed many times during the development so erasing
-previous version is worth writing. It will report an error if there's
-nothing to erase but it's better than unpredictable errors due to
-writing new declarations over existing ones.</para>
-
-
-<note><para>Making graph name unique for every host is not needed if
-the application is supposed to be "local" and nobody will
-access more than one installation of the application. If this is
-the case, use some fixed graph IRI, not necessarily starting with
-hostname at all; this is much more convenient for querying because you
-don't have to calculate the graph name in each query. With fixed graph
-in use, it is still possible to clone the RDF View to map to a unique
-graph as soon as the application become "public" and requires
-merging data from many installations.</para></note>
-
-<programlisting><![CDATA[
-SPARQL drop quad map graph iri("http://^{URIQADefaultHost}^/Northwind")
-;
-SPARQL drop quad map virtrdf:NorthwindDemo
-;
-]]></programlisting>
-<note><para>The <emphasis>^{URIQADefaultHost}^</emphasis> macro is replaced with the value of <emphasis>DefaultHost</emphasis> parameter of <link linkend="ini_URIQA">[URIQA]</link> section of configuration file. The IRI is written as <emphasis>iri("http://^{URIQADefaultHost}^/Northwind")</emphasis>, not as <emphasis><http://^{URIQADefaultHost}^/Northwind></emphasis> because macro of this sort works only inside SPARQL string values.</para></note>
+  -- we compose a N3 literal
+  http (sprintf ('<%s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Document> .\n', subj), ses);
+  http (sprintf ('<%s> <urn:txt:v0.0:UniqueWords> "%d" .\n', subj, words), ses);
+  http (sprintf ('<%s> <urn:txt:v0.0:Chars> "%d" .\n', subj, chars), ses);
+  str := string_output_string (ses);
+
+  -- we push the N3 text into the local store
+  DB.DBA.TTLP (str, new_origin_uri, subj);
+  return 1;
+};
 
-<para>Now it's safe to create IRI classes needed for the view. If
-these classes are used only in the view we define then it is safe to
-create all of them in a single statement. If some of them are used
-across multiple declarations then errors may occur. it is impossible
-to redefine an IRI class that is in use; the compiler will try to
-avoid reporting errors by checking whether the new declaration is
-identical to the existing one and by trying garbage collection in hope
-that the IRI class is used only in garbage, but errors may occur
-anyway. Thus it is better to declare "shared" IRI classes by
-individual statements and group together only "private" IRI
-classes of a view. If a "class redefinition" error occurs in
-the middle of a group then "undefined class" errors may
-occur after because the processing of the group was interrupted before
-rest of group was not executed. When in trouble, try <link
-linkend="fn_rdf_audit_metadata"><function>DB.DBA.RDF_AUDIT_METADATA</function></link>
-procedure.</para>
+DELETE FROM DB.DBA.SYS_RDF_MAPPERS WHERE RM_HOOK = 'DB.DBA.RDF_LOAD_TXT_META';
 
+INSERT SOFT DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
+VALUES ('(text/plain)', 'MIME', 'DB.DBA.RDF_LOAD_TXT_META', null, 'Text Files (demo)');
 
+-- here we set order to some large number so don't break existing mappers
+update DB.DBA.SYS_RDF_MAPPERS
+SET RM_ID = 2000
+WHERE RM_HOOK = 'DB.DBA.RDF_LOAD_TXT_META';
+]]></programlisting>
+<para>To test the mapper we just use /sparql endpoint with option 'Retrieve remote RDF data
+for all missing source graphs' to execute:</para>
 <programlisting><![CDATA[
-SPARQL
-create iri class northwind:Category "http://^{URIQADefaultHost}^/Northwind/Category/%d#this" (in category_id integer not null) .
-create iri class northwind:Shipper "http://^{URIQADefaultHost}^/Northwind/Shipper/%d#this" (in shipper_id integer not null) .
-create iri class northwind:Supplier "http://^{URIQADefaultHost}^/Northwind/Supplier/%d#this" (in supplier_id integer not null) .
-create iri class northwind:Product   "http://^{URIQADefaultHost}^/Northwind/Product/%d#this" (in product_id integer not null) .
-create iri class northwind:Customer "http://^{URIQADefaultHost}^/Northwind/Customer/%U#this" (in customer_id varchar not null) .
-create iri class northwind:Employee "http://^{URIQADefaultHost}^/Northwind/Employee/%U%U%d#this" (in employee_firstname varchar not null, in employee_lastname varchar not null, in employee_id integer not null) .
-create iri class northwind:Order "http://^{URIQADefaultHost}^/Northwind/Order/%d#this" (in order_id integer not null) .
-create iri class northwind:CustomerContact "http://^{URIQADefaultHost}^/Northwind/CustomerContact/%U#this" (in customer_id varchar not null) .
-create iri class northwind:OrderLine "http://^{URIQADefaultHost}^/Northwind/OrderLine/%d/%d#this" (in order_id integer not null, in product_id integer not null) .
-create iri class northwind:Province "http://^{URIQADefaultHost}^/Northwind/Province/%U/%U#this" (in country_name varchar not null, in province_name varchar not null) .
-create iri class northwind:Country "http://^{URIQADefaultHost}^/Northwind/Country/%U#this" (in country_name varchar not null) .
-create iri class northwind:Flag "http://^{URIQADefaultHost}^%U#this" (in flag_path varchar not null) .
-create iri class northwind:dbpedia_iri "http://dbpedia.org/resource/%U" (in uname varchar not null) .
-create iri class northwind:EmployeePhoto "http://^{URIQADefaultHost}^/DAV/VAD/demo/sql/EMP%d#this" (in emp_id varchar not null) .
-create iri class northwind:CategoryPhoto "http://^{URIQADefaultHost}^/DAV/VAD/demo/sql/CAT%d#this" (in category_id varchar not null) .
+SELECT *
+FROM <URL-of-a-txt-file>
+WHERE { ?s ?p ?o }
+]]></programlisting>
+<para>It is important that the SPARQL_UPDATE role to be granted to "SPARQL" account in order
+to allow local repository update via sponge feature.</para>
+<para><emphasis>Authentication in Sponger</emphasis></para>
+<para>To enable usage of user defined authentication, there are added more parameters to the
+/proxy/rdf and /sparql endpoints. So to use it, the RDF browser and iSPARQL should send following
+url parameters:</para>
+<itemizedlist>
+<listitem>for /proxy/rdf endpoint:
+<programlisting><![CDATA[
+'login=<account name>'
+]]></programlisting>
+</listitem>
+<listitem>for /sparql endpoint:
+<programlisting><![CDATA[
+get-login=<account name>
+]]></programlisting>
+</listitem>
+</itemizedlist>
+</sect5>
+<sect5 id="virtuosospongerrdfmappersregistry"><title>Registry</title>
+<para>The table DB.DBA.SYS_RDF_MAPPERS is used as registry for registering RDF mappers.</para>
+<programlisting><![CDATA[
+create table DB.DBA.SYS_RDF_MAPPERS (
+    RM_ID integer identity,         -- mapper ID, designate order of execution
+    RM_PATTERN varchar,             -- a REGEX pattern to match URL or MIME type
+    RM_TYPE varchar default 'MIME', -- what property of the current resource to match: MIME or URL are supported at present
+    RM_HOOK varchar,                -- fully qualified PL function name e.q. DB.DBA.MY_MAPPER_FUNCTION
+    RM_KEY  long varchar,           -- API specific key to use
+    RM_DESCRIPTION long varchar,    -- Mapper description, free text
+    RM_ENABLED integer default 1,   -- a flag 0 or 1 integer to include or exclude the given mapper from processing chain
+    primary key (RM_TYPE, RM_PATTERN))
 ;
 ]]></programlisting>
-<para>One IRI class per subject type; format strings begin with same host but different directory names so this will let the compiler to guess the type of subject by the text of IRI. Most of declarations are <link linkend="rdfviewbijandreturns">bijections</link> and may get  <emphasis>option (bijection)</emphasis> hint but these format strings are so simple that the compiler may understand it by itself.
-(<emphasis>northwind:Employee</emphasis> is not a bijection because <link linkend="fn_sprintf_inverse"><function>sprintf_inverse</function></link> will be unable to split the tail of IRI string and find the boundary between first and last name.)</para>
-<para>The final operation is extending the default quad storage with new tree of quad map patterns.</para>
+<para>The current way to register/update/unregister a mapper is just a DML statement e.g.
+NSERT/UPDATE/DELETE.</para>
+</sect5>
+<sect5 id="virtuosospongerrdfmappersexec"><title>Execution order and processing</title>
+<para>When SPARQL retrieves a resource with unknown content it will look in the mappers registry
+and will loop over every record having RM_ENABLED flag true. The sequence of look-up is based on
+ordering by RM_ID column. For every record it will either try matching the MIME type or URL against
+RM_PATTERN value and if there is match the function specified in RM_HOOK column will be called.
+If the function doesn't exists or signal an error the SPARQL will look at next record.</para>
+<para>When it stops looking? It will stop if value returned by mapper function is positive or
+negative number, if the return is negative processing stops with meaning no RDF was supplied,
+if return is positive the meaning is that RDF data was extracted, if zero integer is returned
+then SPARQL will look for next mapper. The mapper function also can return zero if it is expected
+next mapper in the chain to get more RDF data.</para>
+<para>If none of the mappers matches the signature (MIME type nor URL) the built-in WebDAV
+metadata extractor will be called.</para>
+</sect5>
+<sect5 id="virtuosospongerrdfmappersextfunc"><title>Extension function</title>
+<para>The mapper function is a PL stored procedure with following signature:</para>
 <programlisting><![CDATA[
-SPARQL
-prefix northwind: <http://demo.openlinksw.com/schemas/northwind#>
-prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
-prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-
-alter quad storage virtrdf:DefaultQuadStorage
-from Demo.demo.Products as products
-from Demo.demo.Suppliers as suppliers
-from Demo.demo.Shippers as shippers
-from Demo.demo.Categories as categories
-from Demo.demo.Customers as customers
-from Demo.demo.Employees as employees
-from Demo.demo.Orders as orders
-from Demo.demo.Order_Details as order_lines
-from Demo.demo.Countries as countries
-from Demo.demo.Provinces as provinces
-where (^{suppliers.}^.Country = ^{countries.}^.Name)
-where (^{customers.}^.Country = ^{countries.}^.Name)
-where (^{employees.}^.Country = ^{countries.}^.Name)
-where (^{orders.}^.ShipCountry = ^{countries.}^.Name)
+THE_MAPPER_FUNCTION_NAME (
+        in graph_iri varchar,
+        in origin_uri varchar,
+        in destination_uri varchar,
+        inout content varchar,
+        inout async_notification_queue any,
+        inout ping_service any,
+        inout keys any
+        )
 {
-        create virtrdf:NorthwindDemo as graph iri ("http://^{URIQADefaultHost}^/Northwind") option (exclusive)
-        {
-                northwind:CustomerContact (customers.CustomerID)
-                        a foaf:Person
-                                as virtrdf:CustomerContact-foaf_Person .
-
-                northwind:CustomerContact (customers.CustomerID)
-                        a northwind:CustomerContact
-                                as virtrdf:CustomerContact-CustomerContact;
-                        foaf:name customers.ContactName
-                                as virtrdf:CustomerContact-contact_name ;
-                        foaf:phone customers.Phone
-                                as virtrdf:CustomerContact-foaf_phone ;
-                        northwind:is_contact_at northwind:Customer (customers.CustomerID)
-                                as virtrdf:CustomerContact-is_contact_at ;
-                        northwind:country northwind:Country (customers.Country)
-                                as virtrdf:CustomerContact-country ;
-                        rdfs:isDefinedBy northwind:customercontact_iri (customers.CustomerID) ;
-                        rdfs:isDefinedBy northwind:CustomerContact (customers.CustomerID) .
-
-                northwind:Country (customers.Country)
-                        northwind:is_country_of
-                northwind:CustomerContact (customers.CustomerID) as virtrdf:CustomerContact-is_country_of .
-
-                northwind:Product (products.ProductID)
-                        a northwind:Product
-                                as virtrdf:Product-ProductID ;
-                        northwind:has_category northwind:Category (products.CategoryID)
-                                as virtrdf:Product-product_has_category ;
-                        northwind:has_supplier northwind:Supplier (products.SupplierID)
-                                as virtrdf:Product-product_has_supplier ;
-                        northwind:productName products.ProductName
-                                as virtrdf:Product-name_of_product ;
-                        northwind:quantityPerUnit products.QuantityPerUnit
-                                as virtrdf:Product-quantity_per_unit ;
-                        northwind:unitPrice products.UnitPrice
-                                as virtrdf:Product-unit_price ;
-                        northwind:unitsInStock products.UnitsInStock
-                                as virtrdf:Product-units_in_stock ;
-                        northwind:unitsOnOrder products.UnitsOnOrder
-                                as virtrdf:Product-units_on_order ;
-                        northwind:reorderLevel products.ReorderLevel
-                                as virtrdf:Product-reorder_level ;
-                        northwind:discontinued products.Discontinued
-                                as virtrdf:Product-discontinued ;
-                        rdfs:isDefinedBy northwind:product_iri (products.ProductID) ;
-                        rdfs:isDefinedBy northwind:Product (products.ProductID) .
-
-                northwind:Category (products.CategoryID)
-                        northwind:category_of northwind:Product (products.ProductID) as virtrdf:Product-category_of .
-
-                northwind:Supplier (products.SupplierID)
-                        northwind:supplier_of northwind:Product (products.ProductID) as virtrdf:Product-supplier_of .
-
-                northwind:Supplier (suppliers.SupplierID)
-                        a northwind:Supplier
-                                as virtrdf:Supplier-SupplierID ;
-                        northwind:companyName suppliers.CompanyName
-                                as virtrdf:Supplier-company_name ;
-                        northwind:contactName suppliers.ContactName
-                                as virtrdf:Supplier-contact_name ;
-                        northwind:contactTitle suppliers.ContactTitle
-                                as virtrdf:Supplier-contact_title ;
-                        northwind:address suppliers.Address
-                                as virtrdf:Supplier-address ;
-                        northwind:city suppliers.City
-                                as virtrdf:Supplier-city ;
-                        northwind:dbpedia_city northwind:dbpedia_iri(suppliers.City)
-                                as virtrdf:Supplier-dbpediacity ;
-                        northwind:region suppliers.Region
-                                as virtrdf:Supplier-region ;
-                        northwind:postalCode suppliers.PostalCode
-                                as virtrdf:Supplier-postal_code ;
-                        northwind:country northwind:Country(suppliers.Country)
-                                as virtrdf:Supplier-country ;
-                        northwind:phone suppliers.Phone
-                                as virtrdf:Supplier-phone ;
-                        northwind:fax suppliers.Fax
-                                as virtrdf:Supplier-fax ;
-                        northwind:homePage suppliers.HomePage
-                                as virtrdf:Supplier-home_page ;
-                        rdfs:isDefinedBy northwind:supplier_iri (suppliers.SupplierID) ;
-                        rdfs:isDefinedBy northwind:Supplier (suppliers.SupplierID) .
-
-                northwind:Country (suppliers.Country)
-                        northwind:is_country_of
-                northwind:Supplier (suppliers.SupplierID) as virtrdf:Supplier-is_country_of .
-
-                northwind:Category (categories.CategoryID)
-                        a northwind:Category
-                                as virtrdf:Category-CategoryID ;
-                        northwind:categoryName categories.CategoryName
-                                as virtrdf:Category-home_page ;
-                        northwind:description categories.Description
-                                as virtrdf:Category-description ;
-                        foaf:img northwind:CategoryPhoto(categories.CategoryID)
-                                as virtrdf:Category-categories.CategoryPhoto ;
-                        rdfs:isDefinedBy northwind:category_iri (categories.CategoryID) ;
-                        rdfs:isDefinedBy northwind:Category (categories.CategoryID) .
-
-                northwind:CategoryPhoto(categories.CategoryID)
-                        a northwind:CategoryPhoto
-                                as virtrdf:Category-categories.CategoryPhotoID ;
-                        rdfs:isDefinedBy northwind:categoryphoto_iri (categories.CategoryID) ;
-                        rdfs:isDefinedBy northwind:CategoryPhoto(categories.CategoryID) .
-
-                northwind:Shipper (shippers.ShipperID)
-                        a northwind:Shipper
-                                as virtrdf:Shipper-ShipperID ;
-                        northwind:companyName shippers.CompanyName
-                                as virtrdf:Shipper-company_name ;
-                        northwind:phone shippers.Phone
-                                as virtrdf:Shipper-phone ;
-                        rdfs:isDefinedBy northwind:shipper_iri (shippers.ShipperID) ;
-                        rdfs:isDefinedBy northwind:Shipper (shippers.ShipperID) .
-
-                northwind:Customer (customers.CustomerID)
-                        a  northwind:Customer
-                                as virtrdf:Customer-CustomerID2 ;
-                        a  foaf:Organization
-                                as virtrdf:Customer-CustomerID ;
-                        foaf:name customers.CompanyName
-                                as virtrdf:Customer-foaf_name ;
-                        northwind:companyName customers.CompanyName
-                                as virtrdf:Customer-company_name ;
-                        northwind:has_contact northwind:CustomerContact (customers.CustomerID)
-                                as virtrdf:Customer-contact ;
-                        northwind:country northwind:Country (customers.Country)
-                                as virtrdf:Customer-country ;
-                        northwind:contactName customers.ContactName
-                                as virtrdf:Customer-contact_name ;
-                        northwind:contactTitle customers.ContactTitle
-                                as virtrdf:Customer-contact_title ;
-                        northwind:address customers.Address
-                                as virtrdf:Customer-address ;
-                        northwind:city customers.City
-                                as virtrdf:Customer-city ;
-                        northwind:dbpedia_city northwind:dbpedia_iri(customers.City)
-                                as virtrdf:Customer-dbpediacity ;
-                        northwind:region customers.Region
-                                as virtrdf:Customer-region ;
-                        northwind:PostalCode customers.PostalCode
-                                as virtrdf:Customer-postal_code ;
-                        foaf:phone customers.Phone
-                                as virtrdf:Customer-foaf_phone ;
-                        northwind:phone customers.Phone
-                                as virtrdf:Customer-phone ;
-                        northwind:fax customers.Fax
-                                as virtrdf:Customer-fax ;
-                        rdfs:isDefinedBy northwind:customer_iri (customers.CustomerID) ;
-                        rdfs:isDefinedBy northwind:Customer (customers.CustomerID) .
-
-                northwind:Country (customers.Country)
-                        northwind:is_country_of
-                northwind:Customer (customers.CustomerID) as virtrdf:Customer-is_country_of .
-
-                northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID)
-                        a northwind:Employee
-                                as virtrdf:Employee-EmployeeID2 ;
-                        a foaf:Person
-                                as virtrdf:Employee-EmployeeID ;
-                        foaf:surname employees.LastName
-                                as virtrdf:Employee-foaf_last_name ;
-                        northwind:lastName employees.LastName
-                                as virtrdf:Employee-last_name ;
-                        foaf:firstName employees.FirstName
-                                as virtrdf:Employee-foaf_first_name ;
-                        northwind:firstName employees.FirstName
-                                as virtrdf:Employee-first_name ;
-                        foaf:title employees.Title
-                                as virtrdf:Employee-title ;
-                        northwind:titleOfCourtesy employees.TitleOfCourtesy
-                                as virtrdf:Employee-title_of_courtesy ;
-                        foaf:birthday employees.BirthDate
-                                as virtrdf:Employee-foaf_birth_date ;
-                        northwind:birthday employees.BirthDate
-                                as virtrdf:Employee-birth_date ;
-                        northwind:hireDate employees.HireDate
-                                as virtrdf:Employee-hire_date ;
-                        northwind:address employees.Address
-                                as virtrdf:Employee-address ;
-                        northwind:city employees.City
-                                as virtrdf:Employee-city ;
-                        northwind:dbpedia_city northwind:dbpedia_iri(employees.City)
-                                as virtrdf:Employee-dbpediacity ;
-                        northwind:region employees.Region
-                                as virtrdf:Employee-region ;
-                        northwind:postalCode employees.PostalCode
-                                as virtrdf:Employee-postal_code ;
-                        northwind:country northwind:Country(employees.Country)
-                                as virtrdf:Employee-country ;
-                        foaf:phone employees.HomePhone
-                                as virtrdf:Employee-home_phone ;
-                        northwind:extension employees.Extension
-                                as virtrdf:Employee-extension ;
-                        northwind:notes employees.Notes
-                                as virtrdf:Employee-notes ;
-                        northwind:reportsTo northwind:Employee(employees.FirstName, employees.LastName, employees.ReportsTo) where (^{employees.}^.ReportsTo = ^{employees.}^.EmployeeID)
-                                as virtrdf:Employee-reports_to ;
-                        foaf:img northwind:EmployeePhoto(employees.EmployeeID)
-                                as virtrdf:Employee-employees.EmployeePhoto ;
-                        rdfs:isDefinedBy northwind:employee_iri (employees.EmployeeID) ;
-                        rdfs:isDefinedBy northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID) .
-
-                northwind:EmployeePhoto(employees.EmployeeID)
-                        a northwind:EmployeePhoto
-                                as virtrdf:Employee-employees.EmployeePhotoId ;
-                        rdfs:isDefinedBy northwind:employeephoto_iri (employees.EmployeeID) ;
-                        rdfs:isDefinedBy northwind:EmployeePhoto (employees.EmployeeID) .
-
-                northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID)
-                        northwind:is_salesrep_of
-                northwind:Order (orders.OrderID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID) as virtrdf:Order-is_salesrep_of .
-
-                northwind:Country (employees.Country)
-                        northwind:is_country_of
-                northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID) as virtrdf:Employee-is_country_of .
-
-                northwind:Order (orders.OrderID)
-                        a northwind:Order
-                                as virtrdf:Order-Order ;
-                        northwind:has_customer northwind:Customer (orders.CustomerID)
-                                as virtrdf:Order-order_has_customer ;
-                        northwind:has_salesrep northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID)
-                                as virtrdf:Customer-has_salesrep ;
-                        northwind:has_employee northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID)
-                                as virtrdf:Order-order_has_employee ;
-                        northwind:orderDate orders.OrderDate
-                                as virtrdf:Order-order_date ;
-                        northwind:requiredDate orders.RequiredDate
-                                as virtrdf:Order-required_date ;
-                        northwind:shippedDate orders.ShippedDate
-                                as virtrdf:Order-shipped_date ;
-                        northwind:order_ship_via northwind:Shipper (orders.ShipVia)
-                                as virtrdf:Order-order_ship_via ;
-                        northwind:freight orders.Freight
-                                as virtrdf:Order-freight ;
-                        northwind:shipName orders.ShipName
-                                as virtrdf:Order-ship_name ;
-                        northwind:shipAddress orders.ShipAddress
-                                as virtrdf:Order-ship_address ;
-                        northwind:shipCity orders.ShipCity
-                                as virtrdf:Order-ship_city ;
-                        northwind:dbpedia_shipCity northwind:dbpedia_iri(orders.ShipCity)
-                                as virtrdf:Order-dbpediaship_city ;
-                        northwind:shipRegion orders.ShipRegion
-                                as virtrdf:Order-ship_region ;
-                        northwind:shipPostal_code orders.ShipPostalCode
-                                as virtrdf:Order-ship_postal_code ;
-                        northwind:shipCountry northwind:Country(orders.ShipCountry)
-                                as virtrdf:ship_country ;
-                        rdfs:isDefinedBy northwind:order_iri (orders.OrderID) ;
-                        rdfs:isDefinedBy northwind:Order (orders.OrderID) .
-
-                northwind:Country (orders.ShipCountry)
-                        northwind:is_ship_country_of
-                northwind:Order (orders.OrderID) as virtrdf:Order-is_country_of .
-
-                northwind:Customer (orders.CustomerID)
-                        northwind:has_order northwind:Order (orders.OrderID) as virtrdf:Order-has_order .
-
-                northwind:Shipper (orders.ShipVia)
-                        northwind:ship_order northwind:Order (orders.OrderID) as virtrdf:Order-ship_order .
-
-                northwind:OrderLine (order_lines.OrderID, order_lines.ProductID)
-                        a northwind:OrderLine
-                                as virtrdf:OrderLine-OrderLines ;
-                        northwind:has_order_id northwind:Order (order_lines.OrderID)
-                                as virtrdf:order_lines_has_order_id ;
-                        northwind:has_product_id northwind:Product (order_lines.ProductID)
-                                as virtrdf:order_lines_has_product_id ;
-                        northwind:unitPrice order_lines.UnitPrice
-                                as virtrdf:OrderLine-unit_price ;
-                        northwind:quantity order_lines.Quantity
-                                as virtrdf:OrderLine-quantity ;
-                        northwind:discount order_lines.Discount
-                                as virtrdf:OrderLine-discount ;
-                        rdfs:isDefinedBy northwind:orderline_iri (order_lines.OrderID, order_lines.ProductID) ;
-                        rdfs:isDefinedBy northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) .
-
-                northwind:Order (orders.OrderID)
-                        northwind:is_order_of
-                northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) where (^{orders.}^.OrderID = ^{order_lines.}^.OrderID) as virtrdf:Order-is_order_of .
-
-                northwind:Product (products.ProductID)
-                        northwind:is_product_of
-                northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) where (^{products.}^.ProductID = ^{order_lines.}^.ProductID) as virtrdf:Product-is_product_of .
-
-                northwind:Country (countries.Name)
-                        a northwind:Country
-                                as virtrdf:Country-Type2 ;
-                        a wgs:SpatialThing
-                                as virtrdf:Country-Type ;
-                        owl:sameAs northwind:dbpedia_iri (countries.Name) ;
-                        northwind:name countries.Name
-                                as virtrdf:Country-Name ;
-                        northwind:code countries.Code
-                                as virtrdf:Country-Code ;
-                        northwind:smallFlagDAVResourceName countries.SmallFlagDAVResourceName
-                                as virtrdf:Country-SmallFlagDAVResourceName ;
-                        northwind:largeFlagDAVResourceName countries.LargeFlagDAVResourceName
-                                as virtrdf:Country-LargeFlagDAVResourceName ;
-                        northwind:smallFlagDAVResourceURI northwind:Flag(countries.SmallFlagDAVResourceURI)
-                                as virtrdf:Country-SmallFlagDAVResourceURI ;
-                        northwind:largeFlagDAVResourceURI northwind:Flag(countries.LargeFlagDAVResourceURI)
-                                as virtrdf:Country-LargeFlagDAVResourceURI ;
-                        wgs:lat countries.Lat
-                                as virtrdf:Country-Lat ;
-                        wgs:long countries.Lng
-                                as virtrdf:Country-Lng ;
-                        rdfs:isDefinedBy northwind:country_iri (countries.Name) ;
-                        rdfs:isDefinedBy northwind:Country (countries.Name) .
-
-                northwind:Country (countries.Name)
-                        northwind:has_province
-                northwind:Province (provinces.CountryCode, provinces.Province) where (^{provinces.}^.CountryCode = ^{countries.}^.Code) as virtrdf:Country-has_province .
-
-                northwind:Province (provinces.CountryCode, provinces.Province)
-                        a northwind:Province
-                                as virtrdf:Province-Provinces ;
-                        northwind:has_country_code provinces.CountryCode
-                                as virtrdf:has_country_code ;
-                        northwind:provinceName provinces.Province
-                                as virtrdf:Province-ProvinceName ;
-                        rdfs:isDefinedBy northwind:province_iri (provinces.CountryCode, provinces.Province) ;
-                        rdfs:isDefinedBy northwind:Province (provinces.CountryCode, provinces.Province) .
-
-                northwind:Province (provinces.CountryCode, provinces.Province)
-                        northwind:is_province_of
-                northwind:Country (countries.Name) where  (^{countries.}^.Code = ^{provinces.}^.CountryCode) as virtrdf:Province-country_of .
-        }.
-}.
+   -- do processing here
+   -- return -1, 0 or 1 (as explained above in Execution order and processing section)
+}
 ;
 ]]></programlisting>
-<para>The created RDF View is sufficient for querying relational data via SPARQL but not for accessing data by dereferencing IRIs of subjects. Making IRIs dereferenceable requires configuring HTTP server; that is explained in <link linkend="rdfsparqlexnpointnorthwindexample">second part of the example</link>.</para>
-</sect4>
-  </sect3>
-</sect2>
-<sect2 id="rdfspongerprogrammerguide"><title>Sponger Programmers Guide</title>
-  <para>The Sponger forms part of the extensible RDF framework built into Virtuoso Universal Server. A
-key component of the Sponger's pluggable architecture is its support for Sponger Cartridges, which
-themselves are comprised of an Entity Extractor and an Ontology Mapper. Virtuoso bundles numerous
-pre-written cartridges for RDF data extraction from a wide range of data sources. However, developers
-are free to develop their own custom cartridges. This programmer's guide describes how.</para>
-  <para>The guide is a companion to the <ulink url="http://virtuoso.openlinksw.com/Whitepapers/pdf/sponger_whitepaper_10102007.pdf">Virtuoso Sponger</ulink> whitepaper. The latter describes the Sponger in depth, its architecture, configuration, use and integration with other Virtuoso facilities such as the Open Data Services (ODS) application framework. This guide focuses solely on custom cartridge development.</para>
-      <sect3 id="virtuosospongeroverviewxmlset">
-      <title>Configuration of CURIEs used by the sponger</title>
-      <para>For configuring CURIEs used by the Sponger which is exposed via sponger
-clients such as "description.vsp" - the VSP based information resource description utility,
-you can use the <link linkend="fn_xml_set_ns_decl"><function>xml_set_ns_decl</function></link> function.</para>
-      <para>Here is sample example to add curie pattern:</para>
+<para><emphasis>Parameters</emphasis></para>
+<itemizedlist>
+<listitem>graph_iri - the target graph IRI</listitem>
+<listitem>origin_uri - the current URI of processing</listitem>
+<listitem>destination_uri - get:destination value</listitem>
+<listitem>content - the resource content</listitem>
+<listitem>async_notification_queue - if INI parameter PingService is specified in SPARQL
+section in the INI file, this is a pre-allocated asynchronous queue to be used to call
+ping service</listitem>
+<listitem>ping_service - the URL of the ping service configured in SPARQL section in the
+INI in PingService parameter</listitem>
+<listitem>keys - a string value contained in the RM_KEY column for given mapper, can be
+single string or serialized array, generally can be used as mapper specific data.</listitem>
+</itemizedlist>
+<para><emphasis>Return value</emphasis></para>
+<itemizedlist>
+<listitem>0 - no data was retrieved or some next matching mapper must extract more data</listitem>
+<listitem>1 - data is retrieved, stop looking for other mappers</listitem>
+<listitem>-1 - no data is retrieved, stop looking for more data</listitem>
+</itemizedlist>
+</sect5>
+<sect5 id="virtuosospongerrdfmapperspackage"><title>RDF Mappers package content</title>
+<para>The Virtuoso supply as a rdf_mappers_dav VAD package a cartridge for extracting RDF data
+from certain popular Web resources and file types. It can be installed (if not already) using
+VAD_INSTALL function, see the VAD chapter in documentation on how to do that.</para>
+<para><emphasis>HTTP-in-RDF</emphasis></para>
+<para>Maps the HTTP request response to HTTP Vocabulary in RDF, see http://www.w3.org/2006/http#.</para>
+<para>This mapper is disabled by default. If it's enabled , it must be first in order of execution.</para>
+<para>Also it always will return 0, which means any other mapper should push more data.</para>
+<para><emphasis>HTML</emphasis></para>
+<para>This mapper is composite, it looking for metadata which can specified in a HTML pages as
+follows:</para>
+<itemizedlist>
+<listitem>Embedded/linked RDF
+  <itemizedlist>
+    <listitem>scan for meta in RDF
 <programlisting><![CDATA[
--- Example link: http://linkeddata.uriburner.com/about/rdf/http://twitter.com/guykawasaki/status/1144945513#this
-XML_SET_NS_DECL ('uriburner',
-                 'http://linkeddata.uriburner.com/about/rdf/http://',
-                 2);
-]]></programlisting>
-    </sect3>
-    <sect3 id="virtuosospongeroverviewcartarch">
-      <title>Cartridge Architecture</title>
-      <para>The Sponger is comprised of cartridges which are themselves comprised of an entity extractor
-and an ontology mapper. Entities extracted from non-RDF resources are used as the basis for generating
-structured data by mapping them to a suitable ontology. A cartridge is invoked through its cartridge hook,
-a Virtuoso/PL procedure entry point and binding to the cartridge's entity extractor and ontology mapper.</para>
-      <para><emphasis>Entity Extractor</emphasis></para>
-      <para>When an RDF aware client requests data from a network accessible resource via the Sponger the
-following events occur:</para>
-      <itemizedlist mark="bullet">
-        <listitem>A request is made for data in RDF form (explicitly via HTTP Accept Headers), and if
-RDF is returned nothing further happens. </listitem>
-        <listitem>If RDF isn't returned, the Sponger passes the data through a <emphasis>Entity Extraction Pipeline</emphasis>
-(using Entity Extractors). </listitem>
-        <listitem>The extracted data is transformed into RDF via a <emphasis>Mapping Pipeline</emphasis>. RDF instance data is generated by way of ontology matching and mapping. </listitem>
-        <listitem>RDF instance data (aka. RDF Structured Linked Data) are returned to the client.</listitem>
+<link rel="meta" type="application/rdf+xml"
+]]></programlisting></listitem>
+    <listitem>RDF embedded in xHTML (as markup or inside XML comments)</listitem>
       </itemizedlist>
-      <para><emphasis>Extraction Pipeline</emphasis></para>
-      <para>Depending on the file or format type detected at ingest, the Sponger applies the appropriate
-entity extractor. Detection occurs at the time of content negotiation instigated by the retrieval user
-agent. The normal extraction pipeline processing is as follows:</para>
-      <itemizedlist mark="bullet">
-        <listitem>The Sponger tries to get RDF data (including N3 or Turtle) directly from the dereferenced
-URL. If it finds some, it returns it, otherwise, it continues.</listitem>
-        <listitem>If the URL refers to a HTML file, the Sponger tries to find "link" elements referring to
-RDF documents. If it finds one or more of them, it adds their triples into a temporary RDF graph and
-continues its processing.</listitem>
-        <listitem>The Sponger then scans for microformats or GRDDL. If either is found, RDF triples are
-generated and added to a temporary RDF graph before continuing.</listitem>
-        <listitem>If the Sponger finds eRDF or RDFa data in the HTML file, it extracts it from the HTML
-file and inserts it into the RDF graph before continuing.</listitem>
-        <listitem>If the Sponger finds it is talking with a web service such as Google Base, it maps
-the API of the web service with an ontology, creates triples from that mapping and includes the triples
-into the temporary RDF graph.</listitem>
-        <listitem>The next fallback is scanning of the HTML header for different Web 2.0 types or RSS
-1.1, RSS 2.0, Atom, etc. </listitem>
-        <listitem>Failing those tests, the scan then uses standard Web 1.0 rules to search in the
-header tags for metadata (typically Dublin Core) and transform them to RDF and again add them to the
-temporary graph. Other HTTP response header data may also be transformed to RDF.</listitem>
-        <listitem>If nothing has been retrieved at this point, the ODS-Briefcase metadata
-extractor is tried.</listitem>
-        <listitem>Finally, if nothing is found, the Sponger will return an empty graph.</listitem>
+</listitem>
+<listitem>Micro-formats
+  <itemizedlist>
+    <listitem>GRDDL - GRDDL Data Views: RDF expressed in XHTML and XML: http://www.w3.org/2003/g/data-view#</listitem>
+    <listitem>eRDF - http://purl.org/NET/erdf/profile</listitem>
+    <listitem>RDFa</listitem>
+    <listitem>hCard - http://www.w3.org/2006/03/hcard</listitem>
+    <listitem>hCalendar - http://dannyayers.com/microformats/hcalendar-profile</listitem>
+    <listitem>hReview - http://dannyayers.com/micromodels/profiles/hreview</listitem>
+    <listitem>relLicense - CC license: http://web.resource.org/cc/schema.rdf</listitem>
+    <listitem>Dublin Core (DCMI) - http://purl.org/dc/elements/1.1/</listitem>
+    <listitem>geoURL - http://www.w3.org/2003/01/geo/wgs84_pos#</listitem>
+    <listitem>Google Base - OpenLink Virtuoso specific mapping</listitem>
+    <listitem>Ning Metadata </listitem>
       </itemizedlist>
-      <para><emphasis>Ontology Mapper</emphasis></para>
-      <para>Sponger ontology mappers peform the the task of generating RDF instance data from
-extracted entities (non-RDF) using ontologies associated with a given data source type. They are
-typically XSLT (using GRDDL or an in-built Virtuoso mapping scheme) or Virtuoso/PL based. Virtuoso
-comes preconfigured with a large range of ontology mappers contained in one or more Sponger
-cartridges.</para>
-      <para><emphasis>Cartridge Registry</emphasis></para>
-      <para>To be recognized by the SPARQL engine, a Sponger cartridge must be registered in
-the Cartridge Registry by adding a record to the table DB.DBA.SYS_RDF_MAPPERS, either manually
-via DML, or more easily through Conductor, Virtuoso's browser-based administration console,
-which provides a UI for adding your own cartridges. (Sponger configuration using Conductor is
-described in detail later.) The SYS_RDF_MAPPERS table definition is as follows:</para>
+</listitem>
+<listitem>Feeds extraction
+  <itemizedlist>
+    <listitem>RSS/RDF - SIOC & AtomOWL</listitem>
+    <listitem>RSS 1.0 - RSS/RDF, SIOC & AtomOWL</listitem>
+    <listitem>Atom 1.0 - RSS/RDF, SIOC & AtomOWL</listitem>
+  </itemizedlist>
+</listitem>
+<listitem>xHTML metadata transformation using FOAF (foaf:Document) and Dublin Core
+properties (dc:title, dc:subject etc.)</listitem>
+</itemizedlist>
+<para>The HTML page mapper will look for RDF data in order as listed above, it will try to extract
+metadata on each step and will return positive flag if any of the above step give a RDF data. In
+case where page URL matches some of other RDF mappers listed in registry it will return 0 so
+next mapper to extract more data. In order to function properly, this mapper must be executed
+before any other specific mappers.</para>
+<para><emphasis>Flickr URLs</emphasis></para>
+<para>This mapper extracts metadata of the Flickr images, using Flickr REST API. To function
+properly it must have configured key. The Flickr mapper extracts metadata using: CC license,
+Dublin Core, Dublin Core Metadata Terms, GeoURL, FOAF, EXIF: http://www.w3.org/2003/12/exif/ns/ ontology.
+</para>
+<para><emphasis>Amazon URLs</emphasis></para>
+<para>This mapper extracts metadata for Amazon articles, using Amazon REST API. It needs a Amazon
+API key in order to be functional.</para>
+<para><emphasis>eBay URLs</emphasis></para>
+<para>Implements eBay REST API for extracting metadata of eBay articles, it needs a key and user
+name to be configured in order to work.</para>
+<para><emphasis>Open Office (OO) documents</emphasis></para>
+<para>The OO documents contains metadata which can be extracted using UNZIP, so this extractor
+needs Virtuoso unzip plugin to be configured on the server.</para>
+<para><emphasis>Yahoo traffic data URLs</emphasis></para>
+<para>Implements transformation of the result of Yahoo traffic data to RDF.
+</para>
+<para><emphasis>iCal files</emphasis></para>
+<para>Transform iCal files to RDF as per http://www.w3.org/2002/12/cal/ical# .</para>
+<para><emphasis>Binary content, PDF, PowerPoint</emphasis></para>
+<para>The unknown binary content, PDF and MS PowerPoint files can be transformed to RDF using
+Aperture framework (http://aperture.sourceforge.net/). This mapper needs Virtuoso with Java hosting
+support, Aperture framework and MetaExtractor.class installed on the host system in order to work.</para>
+<para>The Aperture framework & MetaExtractor.class must be installed on the system before to
+install the RDF mappers package. If the package is already installed, then to activate this mapper
+you can just re-install the VAD.</para>
+<para><emphasis>Setting-up Virtuoso with Java hosting to run Aperture framework</emphasis></para>
+<itemizedlist>
+<listitem>Install a Virtuoso binary which includes built-in Java hosting support (The executable name will
+indicate whether the required hosting support is built in - a suitably enabled executable will include
+javavm in the name, for example virtuoso-javavm-t, rather than virtuoso-t).</listitem>
+<listitem>Download the Aperture framework from http://aperture.sourceforge.net.</listitem>
+<listitem>Unpack the contents of the framework's lib directory into an 'aperture' subdirectory of the
+Virtuoso working directory, i.e. of the directory containing the database and virtuoso.ini files.</listitem>
+<listitem>Ensure the Virtuoso working directory includes a 'lib' subdirectory containing the file
+MetaExtractor.class. (At the current time MetaExtractor.class in not included in the rdf_mappers VAD.
+Please contact OpenLink Technical Support to obtain a copy.)</listitem>
+<listitem>In the [Parameters] section of the virtuoso.ini configuration file:
+<itemizedlist>
+  <listitem>Add the line (linebreaks have been inserted for clarity):
 <programlisting><![CDATA[
-create table "DB"."DBA"."SYS_RDF_MAPPERS"
-(
-"RM_ID" INTEGER IDENTITY,  -- cartridge ID. Determines the order of the cartridge's invocation in the Sponger processing chain
-"RM_PATTERN" VARCHAR,  -- a REGEX pattern to match the resource URL or MIME type
-"RM_TYPE" VARCHAR,  -- which property of the current resource to match: "MIME" or "URL"
-"RM_HOOK" VARCHAR,  -- fully qualified Virtuoso/PL function name
-"RM_KEY" LONG VARCHAR,  -- API specific key to use
-"RM_DESCRIPTION" LONG VARCHAR,  -- cartridge description (free text)
-"RM_ENABLED" INTEGER,  -- a 0 or 1 integer flag to exclude or include the cartridge from the Sponger processing chain
-"RM_OPTIONS" ANY,  -- cartridge specific options
-"RM_PID" INTEGER IDENTITY,
-PRIMARY KEY ("RM_PATTERN", "RM_TYPE")
-);
+JavaClasspath = lib:aperture/DFKIUtils2.jar:aperture/JempBox-0.2.0.jar:aperture/activation-1.0.2-upd2.jar:aperture/aduna-commons-xml-2.0.jar:
+aperture/ant-compression-utils-1.7.1.jar:aperture/aperture-1.2.0.jar:aperture/aperture-examples-1.2.0.jar:aperture/aperture-test-1.2.0.jar:
+aperture/applewrapper-0.2.jar:aperture/bcmail-jdk14-132.jar:aperture/bcprov-jdk14-132.jar:aperture/commons-codec-1.3.jar:aperture/commons-httpclient-3.1.jar:
+aperture/commons-lang-2.3.jar:aperture/demork-2.1.jar:aperture/flickrapi-1.0.jar:aperture/fontbox-0.2.0-dev.jar:aperture/htmlparser-1.6.jar:
+aperture/ical4j-1.0-beta4.jar:aperture/infsail-0.1.jar:aperture/jacob-1.10.jar:aperture/jai_codec-1.1.3.jar:aperture/jai_core-1.1.3.jar:aperture/jaudiotagger-1.0.8.jar:
+aperture/jcl104-over-slf4j-1.5.0.jar:aperture/jpim-0.1-aperture-1.jar:aperture/junit-3.8.1.jar:aperture/jutf7-0.9.0.jar:aperture/mail-1.4.jar:
+aperture/metadata-extractor-2.4.0-beta-1.jar:aperture/mstor-0.9.11.jar:aperture/nrlvalidator-0.1.jar:aperture/openrdf-sesame-2.2.1-onejar-osgi.jar:
+aperture/osgi.core-4.0.jar:aperture/pdfbox-0.7.4-dev-20071030.jar:aperture/poi-3.0.2-FINAL-20080204.jar:aperture/poi-scratchpad-3.0.2-FINAL-20080204.jar:
+aperture/rdf2go.api-4.6.2.jar:aperture/rdf2go.impl.base-4.6.2.jar:aperture/rdf2go.impl.sesame20-4.6.2.jar:aperture/rdf2go.impl.util-4.6.2.jar:
+aperture/slf4j-api-1.5.0.jar:aperture/slf4j-jdk14-1.5.0.jar:aperture/unionsail-0.1.jar:aperture/winlaf-0.5.1.jar
 ]]></programlisting>
-    </sect3>
-    <sect3 id="virtuosospongeroverviewcartinvo">
-      <title>Cartridge Invocation</title>
-      <para>The Virtuoso SPARQL processor supports IRI dereferencing via the Sponger. If a SPARQL query
-references non-default graph URIs, the Sponger goes out (via HTTP) to sponge the data source URIs and
-inserts the extracted RDF data into the local RDF quad store. The Sponger invokes the appropriate
-cartridge for the data source type to produce RDF instance data. If none of the registered cartridges
-are capable of handling the received content type, the Sponger will attempt to obtain RDF instance
-data via the in-built WebDAV metadata extractor.</para>
-      <para>Sponger cartridges are invoked as follows:</para>
-      <para>When the SPARQL processor dereferences a URI, it plays the role of an HTTP user agent
-(client) that makes a content type specific request to an HTTP server via the HTTP request's Accept
-headers. The following then occurs:</para>
-      <itemizedlist mark="bullet">
-        <listitem>If the content type returned is RDF then no further transformation is needed and
-the process stops. For instance, when consuming an (X)HTML document with a GRDDL profile, the profile
-URI points to a data provider that simply returns RDF instance data.</listitem>
-        <listitem>If the content type is not RDF (i.e. application/rdf+xml or text/rdf+n3 ), for
-instance 'text/plain', the Sponger looks in the Cartridge Registry iterating over every record for
-which the RM_ENABLED flag is true, with the look-up sequence ordered on the RM_ID column values.
-For each record, the processor tries matching the content type or URL against the RM_PATTERN value
-and, if there is match, the function specified in RM_HOOK column is called. If the function doesn't
-exist, or signals an error, the SPARQL processor looks at next record.
-          <itemizedlist mark="bullet">
-            <listitem>If the hook returns zero, the next cartridge is tried. (A cartridge function
-can return zero if it believes a subsequent cartridge in the chain is capable of extracting more
-RDF data.)</listitem>
-            <listitem>If the result returned by the hook is negative, the Sponger is instructed
-that no RDF was generated and the process stops. </listitem>
-            <listitem>If the hook result is positive, the Sponger is informed that structured
-data was retrieved and the process stops.</listitem>
+</listitem>
+  <listitem>Ensure DirsAllowed includes directories /tmp, (or the temporary directory for the host
+operating system), lib and aperture.</listitem>
           </itemizedlist>
         </listitem>
-        <listitem>If none of the cartridges match the source data signature (content type or URL),
-the ODS-Briefcase WebDAV metadata extractor and RDF generator is called.</listitem>
+<listitem>Start the Virtuoso server with java hosting support</listitem>
+<listitem>Configure the cartridge either by installing the rdf_mappers VAD or, if the VAD is already
+installed, by executing procedure DB.DBA.RDF_APERTURE_INIT.</listitem>
+<listitem>During the VAD installation process, RDF_APERTURE_INIT() configures the Aperture cartridge. If
+you look in the list of available cartridges under the RDF > Sponger tab in Conductor, you should see
+an entry for 'Binary Files'.</listitem>
       </itemizedlist>
-      <para><emphasis>Meta-Cartridges</emphasis></para>
-      <para>The above describes the RDF generation process for 'primary' Sponger cartridges. Virtuoso
-also supports another cartridge type - a 'meta-cartridge'. Meta-cartridges act as post-processors in
-the cartridge pipeline, augmenting entity descriptions in an RDF graph with additional information
-gleaned from 'lookup' data sources and web services. Meta-cartridges are described in more detail in
-a later section.</para>
-      <figure id="spong1" float="1">
-        <title>Meta-Cartridges</title>
-        <graphic fileref="ui/spong1.png"/>
-      </figure>
-    </sect3>
+<para>To check the cartridge has been configured, connect with Virtuoso's ISQL tool:</para>
+<itemizedlist>
+<listitem>Issue the command:
+<programlisting><![CDATA[
+SQL> SELECT udt_is_available('APERTURE.DBA.MetaExtractor');
+]]></programlisting>
+</listitem>
+<listitem>Copy a test PDF document to the Virtuoso working directory, then execute:
+<programlisting><![CDATA[
+SQL> SELECT APERTURE.DBA."MetaExtractor"().getMetaFromFile ('some_pdf_in_server_working_dir.pdf', 0);
 
-    <sect3 id="virtuosospongercatrbundled">
-      <title>Cartridges Bundled with Virtuoso</title>
-      <sect4 id="virtuosospongercatrbundledrdfvad">
-        <title>RDF Mappers VAD</title>
-        <para>Virtuoso supplies a number of prewritten cartridges for extracting RDF data from a
-variety of popular Web resources and file types. The cartridges are bundled as part of the rdf_mappers
-VAD (Virtuoso Application Distribution). Appendix B of the Virtuoso Sponger whitepaper briefly
-outlines the cartridges contained in the VAD.</para>
-        <para>To see which cartridges are available, look at the 'RDF Cartridges' screen in
-Conductor. This can be reached through the 'RDF' > 'RDF Cartridges' tabbed menu items.</para>
-        <figure id="spong2" float="1">
-          <title>RDF Cartridges</title>
-          <graphic fileref="ui/spong2.png"/>
-        </figure>
-        <para>To check which version of the rdf_mappers VAD is installed, or to upgrade it,
-refer to Conductor's 'VAD Packages' screen, reachable through the 'System Admin' > 'Packages'
-menu items.</para>
-        <para>The latest VADs for the closed source releases of Virtuoso can be
-<ulink url="http://download.openlinksw.com/download/">downloaded</ulink> from the downloads area on the OpenLink website. Select either the 'DBMS (WebDAV) Hosted' or
-'File System Hosted' product format from the 'Distributed Collaborative Applications' section,
-depending on whether you want the Virtuoso application to use WebDAV or native filesystem storage.
-VADs for Virtuoso Open Source edition (VOS) are available for
-<ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VOSDownload">download</ulink> from
-the VOS Wiki.</para>
-      </sect4>
-      <sect4 id="virtuosospongercatrbundledexample">
-        <title>Example Source Code</title>
-        <para>For developers wanting example cartridge code, the most authoritative reference is
-the rdf_mappers VAD source code itself. This is included as part of the VOS distribution. After
-downloading and unpacking the sources, the script used to create the cartridges, and the associated
-stylesheets can be found in:</para>
-        <itemizedlist mark="bullet">
-          <listitem><vos root>/binsrc/rdf_mappers/rdf_mappers.sql</listitem>
-          <listitem><vos root>/binsrc/rdf_mappers/xslt/*.xsl</listitem>
-        </itemizedlist>
-        <para>Alternatively, you can look at the actual cartridge implementations installed in your
-Virtuoso instance by inspecting the cartridge hook function used by a particular cartridge. This is
-easily identified from the 'Cartridge name' field of Conductor's 'RDF Cartridges' screen, after
-selecting the cartridge of interest. The hook function code can be viewed from the 'Schema Objects'
-screen under the 'Database' menu, by locating the function in the 'DB' > 'Procedures' folder.
-Stylesheets used by the cartridges are installed in the WebDAV folder DAV/VAD/rdf_mappers/xslt.
-This can be explored using Conductor's WebDAV interface. The actual rdf_mappers.sql file installed
-with your system can also be found in the DAV/VAD/rdf_mappers folder.</para>
-      </sect4>
-    </sect3>
-    <sect3 id="virtuosospongercatrbundledcusgtomcart">
-      <title>Custom Cartridge</title>
-      <para>Virtuoso comes well supplied with a variety of Sponger cartridges and GRDDL filters.
-When then is it necessary to write your own cartridge?</para>
-      <para>In the main, writing a new cartridge should only be necessary to generate RDF from
-a REST-style Web service not supported by an existing cartridge, or to customize the output from
-an existing cartridge to your own requirements. Apart from these circumstances, the existing
-Sponger infrastructure should meet most of your needs. This is particularly the case for
-document resources.</para>
-     <sect4 id="virtuosospongerdocres">
-       <title>Document Resources</title>
-       <para>We use the term document resource to identify content which is not being returned
-from a Web service. Normally it can broadly be conceived as some form of document, be it a text
-based entity or some form of file, for instance an image file.</para>
-       <para>In these cases, the document either contains RDF, which can be extracted directly,
-or it holds metadata in a supported format which can be transformed to RDF using an existing
-filter.</para>
-       <para>The following cases should all be covered by the existing Sponger cartridges:</para>
-         <itemizedlist mark="bullet">
-           <listitem>embedded or linked RDF</listitem>
-           <listitem>RDFa, eRDF and other popular microformats extractable directly or via GRDDL</listitem>
-           <listitem>popular syndication formats (RSS 2.0 , Atom, OPML , OCS , XBEL)</listitem>
+... some RDF data should be returned ...
+]]></programlisting>
+</listitem>
          </itemizedlist>
-     </sect4>
-     <sect4 id="virtuosospongergrddl">
-       <title>GRDDL</title>
-       <para>GRDDL (Gleaning Resource Descriptions from Dialects of Languages) is mechanism for deriving
-RDF data from XML documents and in particular XHTML pages. Document authors may associate transformation
-algorithms, typically expressed in XSLT, with their documents to transform embedded metadata into RDF.</para>
-       <para>The rdf_mappers VAD installs a number of GRDDL filters for transforming popular microformats
-(such as RDFa, eRDF or hCalendar) into RDF. The available filters can be viewed, or configured, in
-Conductor's 'GRDDL Filters for XHTML' screen. Navigate to the 'RDF Cartridges' screen using the
-'RDF' > 'RDF Cartridges' menu items, then SELECT the 'GRDDL Mappings' tab to display the 'GRDDL Filters
-for XHTML' screen. GRDDL filters are held in the WebDAV folder /DAV/VAD/rdf_cartridges/xslt/ alongside
-other XSLT templates. The Conductor interface allows you to add new GRDDL filters should you so wish.</para>
-       <para>For an introduction to GRDDL, try the <ulink url="http://www.w3.org/TR/grddl-primer/">GRDDL Primer</ulink>. To underline GRDDL's utility, the primer
-includes an example of transforming Excel spreadsheet data, saved as XML, into RDF.</para>
-       <para>A comprehensive <ulink url="http://esw.w3.org/topic/CustomRdfDialects">list of stylesheets</ulink>
-for transforming HTML and non-HTML XML dialects is maintained
-on the ESW Wiki. The list covers a range of microformats, syndication formats and feedlists.</para>
-     </sect4>
-     <para>To see which Web Services are already catered for, view the list of cartridges in Conductor's 'RDF Cartridges' screen.</para>
-    </sect3>
-    <sect3 id="virtuosospongercreatecustcartr">
-      <title>Creating Custom Cartridges</title>
-      <para>The Sponger is fully extensible by virtue of its pluggable cartridge architecture. New data formats can
-be sponged by creating new cartridges. While OpenLink is active in adding cartridges for new data sources,
-you are free to develop your own custom cartridges. Entity extractors can be built using Virtuoso PL,
-C/C++, Java or any other external language supported by Virtuoso's Server Extension API. Of course,
-Virtuoso's own entity extractors are written in Virtuoso PL.</para>
-      <sect4 id="virtuosospongercreatecustcartran">
-        <title>The Anatomy of a Cartridge</title>
-        <para><emphasis>Cartridge Hook Function</emphasis></para>
-        <para>Every Virtuoso PL hook function used to plug a custom Sponger cartridge into the Virtuoso
-SPARQL engine must have a parameter list with the following parameters (the names of the parameters are
-not important, but their order and presence are):</para>
-        <itemizedlist mark="bullet">
-          <listitem><emphasis>in graph_iri varchar</emphasis>: the IRI of the graph being retrieved/crawled</listitem>
-          <listitem><emphasis>in new_origin_uri varchar</emphasis>: the URL of the document being retrieved</listitem>
-          <listitem><emphasis>in dest varchar</emphasis>: the destination/target graph IRI</listitem>
-          <listitem><emphasis>inout content any</emphasis>: the content of the retrieved document</listitem>
-          <listitem><emphasis>inout async_queue any</emphasis>: if the PingService initialization parameter
-has been configured in the [SPARQL] section of the virtuoso.ini file, this is a pre-allocated asynchronous
-queue to be used to call the ping service</listitem>
-          <listitem><emphasis>inout ping_service any</emphasis>: the URL of a ping service, as assigned
-to the PingService parameter in the [SPARQL] section of the virtuoso.ini configuration file.
-PingTheSemanticWeb is an example of a such a service. See Appendix A for more details.</listitem>
-          <listitem><emphasis>inout api_key any</emphasis>: a string value specific to a given cartridge,
-contained in the RC_KEY column of the DB.DBA.SYS_RDF_CARTRIDGES table. The value can be a single
-string or a serialized array of strings providing cartridge specific data.</listitem>
-          <listitem><emphasis>inout opts any</emphasis>: cartridge specific options held in a Virtuoso/PL
-vector which acts as an array of key-value pairs.</listitem>
-        </itemizedlist>
-        <para><emphasis>Return Value</emphasis></para>
-        <para>If the hook procedure returns zero the next cartridge will be tried. If the result is negative
-the sponging process stops, instructing the SPARQL engine that nothing was retrieved. If the result is
-positive the process stops, this time instructing the SPARQL engine
-that RDF data was successfully retrieved.</para>
-        <para>If your cartridge should need to test whether other cartridges are configured to handle a
-particular data source, the following extract taken from the RDF_LOAD_CALAIS hook procedure illustrates
-how you might do this:</para>
+<para>You should now be able to sponge all document types supported by the Aperture framework, (using
+one of the standard Sponger invocation mechanisms, for instance with a URL of the form
+http://localhost:8890/about/rdf/http://targethost/targetfile.pdf), subject to the MIME type pattern
+filters configured for the cartridge in the Conductor UI. By default the Aperture cartridge is
+registered to match MIME types (application/octet-stream)|(application/pdf)|(application/mspowerpoint).
+To sponge all the MIME types Aperture is capable of handling, changed the MIME type pattern to
+'application/.*'.</para>
+<para>Important: The installation guidelines presented above have been verified on Mac OS X with
+Aperture 1.2.0. Some adjustment may be needed for different operating systems or versions of Aperture.</para>
+<para><emphasis>Examples & tutorials</emphasis></para>
+<para>How to write own RDF mapper? Look at Virtuoso tutorial on this subject
+http://demo.openlinksw.com/tutorial/rdf/rd_s_1/rd_s_1.vsp .
+</para>
+</sect5>
+     </sect4>
+    </sect3>
+      <sect3 id="virtuosospongercreatecustcartrxslt">
+      <title>Meta-Cartridges</title>
+        <para>So far the discussion has centered on 'primary' cartridges. However,
+Virtuoso supports an alternative type of cartridge, a 'meta-cartridge'. The way a
+meta-cartridge operates is essentially the same as a primary cartridge, that is it
+has a cartridge hook function with the same signature and its inserts data into the
+quad store through entity extraction and ontology mapping as before. Where meta-cartridges
+differ from primary cartridges is in their intent and their position in the cartridge
+invocation pipeline.</para>
+        <para>The purpose of meta-cartridges is to enrich graphs produced by other (primary)
+cartridges. They serve as general post-processors to add additional information about selected
+entities in an RDF graph. For instance, a particular meta-cartridge might be designed to search
+for entities of type 'umbel:Country' in a given graph, and then add additional statements about
+each country it finds, where the information contained in these statements is retrieved from the
+web service targeted by the meta-cartridge. One such example might be a 'World Bank' meta-cartridge
+which adds information relating to a country's GDP, its exports of goods and services as a percentage
+of GDP etc; retrieved using the <ulink url="http://developer.worldbank.org/docs/">World Bank web service API</ulink>.
+In order to benefit from the World Bank meta-cartridge, any primary cartridge which might generate instance data relating to countries should
+ensure that each country instance it handles is also described as being of rdf:type 'umbel:Country'.
+Here, the <ulink url="http://wiki.umbel.org/index.php/Welcome">UMBEL</ulink> (Upper Mapping and Binding Exchange Layer) ontology is used as a data-source-agnostic
+classification system. It provides a core set of 20,000+ subject concepts which act as "a fixed set of
+reference points in a global knowledge space". The use of UMBEL in this way serves to decouple
+meta-cartridges from primary cartridges and data source specific ontologies.</para>
+        <para>Virtuoso includes two default meta-cartridges which use
+UMBEL and <ulink url="http://www.opencalais.com/">OpenCalais</ulink> to augment source graphs.</para>
+        <para><emphasis>Registration</emphasis></para>
+        <para>Meta-cartridges must be registered in the RDF_META_CARTRIDGES table, which fulfills a role
+similar to the SYS_RDF_MAPPERS table used by primary cartridges. The structure of the table, and the
+meaning and use of its columns, are similar to SYS_RDF_MAPPERS. The meta-cartridge hook function
+signature is identical to that for primary cartridges.</para>
+        <para>The RDF_META_CARTRIDGES table definition is as follows:</para>
 <programlisting><![CDATA[
-if (xd is not null)
-{
-  -- Sponging successful. Load sponged data in Virtuoso quad store
-  DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
-  flag := 1;
-}
-
-declare ord any;
-ord := (SELECT RM_ID FROM DB.DBA.SYS_RDF_MAPPERS WHERE
-	  RM_HOOK = 'DB.DBA.RDF_LOAD_CALAIS');
-for SELECT RM_PATTERN FROM DB.DBA.SYS_RDF_MAPPERS WHERE
-  RM_ID > ord and RM_TYPE = 'URL' and RM_ENABLED = 1 ORDER BY RM_ID do
-{
-  if (regexp_match (RM_PATTERN, new_origin_uri) is not null)
-    -- try next candidate cartridge
-    flag := 0;
-}
-return flag;
+create table DB.DBA.RDF_META_CARTRIDGES (
+MC_ID INTEGER IDENTITY,		-- meta-cartridge ID. Determines the order of the
+                           	   meta-cartridge's invocation in the Sponger
+                                 processing chain
+MC_SEQ INTEGER IDENTITY,
+MC_HOOK VARCHAR,			-- fully qualified Virtuoso/PL function name
+MC_TYPE VARCHAR,
+MC_PATTERN VARCHAR, 		-- a REGEX pattern to match resource URL or
+					   MIME type
+MC_KEY VARCHAR,			-- API specific key to use
+MC_OPTIONS ANY,			-- meta-cartridge specific options
+MC_DESC LONG VARCHAR, 		-- meta-cartridge description (free text)
+MC_ENABLED INTEGER		-- a 0 or 1 integer flag to exclude or include
+					   meta-cartridge from Sponger processing chain
+);
 ]]></programlisting>
-        <para><emphasis>Specifying the Target Graph</emphasis></para>
-        <para>Two cartridge hook function parameters contain graph IRIs, graph_iri and dest. graph_iri
-identifies an input graph being crawled. dest holds the IRI specified in any input:grab-destination
-pragma defined to control the SPARQL processor's IRI dereferencing. The pragma overrides the default
-behaviour and forces all retrieved triples to be stored in a single graph, irrespective of their graph
-of origin.</para>
-        <para>So, under some circumstances depending on how the Sponger has been invoked and whether
-it is being used to crawl an existing RDF graph, or derive RDF data from a non-RDF data source,
-dest may be null.</para>
-        <para>Consequently, when loading sponged RDF data into the quad store, cartridges typically
-specify the graph to receive the data using the coalesce function which returns the first non-null
-parameter. e.g.</para>
+        <para>(At the time of writing there is no Conductor UI for registering meta-cartridges, they must be
+registered using SQL. A Conductor interface for this task will be added in due course.)</para>
+       <para><emphasis>Invocation</emphasis></para>
+        <para>Meta-cartridges are invoked through the post-processing hook procedure RDF_LOAD_POST_PROCESS
+which is called, for every document retrieved, after RDF_LOAD_RDFXML loads sponged data into the quad
+store.</para>
+        <para>Cartridges in the meta-cartridge registry (RDF_META_CARTRIDGES) are configured to match a given
+MIME type or URI pattern. Matching meta-cartridges are invoked in order of their MC_SEQ value. Ordinarily
+a meta-cartridge should return 0, in which case the next meta-cartridge in the post-processing chain will
+be invoked. If it returns 1 or -1, the post-processing stops and no further meta-cartridges are invoked.</para>
+        <para>The order of processing by the Sponger cartridge pipeline is thus:</para>
+        <orderedlist>
+          <listitem>Try to get RDF in the form of TTL or RDF/XML. If RDF is retrieved if go to step 3</listitem>
+          <listitem>Try generating RDF through the Sponger primary cartridges as before</listitem>
+          <listitem>Post-process the RDF using meta-cartridges in order of their MC_SEQ value. If a meta-cartridge returns 1 or -1, stop the post-processing chain.</listitem>
+        </orderedlist>
+        <para>Notice that meta-cartridges may be invoked even if primary cartridges are not.</para>
+      <sect4 id="virtuosospongercreatecustcartrexfm">
+        <title>Example - A Campaign Finance Meta-Cartridge for Freebase</title>
+        <para><emphasis>Note</emphasis></para>
+        <para>The example which follows builds on a Freebase Sponger cartridge developed prior to the announcement of Freebase's
+support for generating Linked Data through the endpoint http://rdf.freebase.com/ . The OpenLink cartridge
+has since evolved to reflect these changes. A snapshot of the Freebase cartridge and stylesheet compatible
+with this example can be found <link linkend="virtuosospongerfreeb">here</link>.</para>
+        <para><ulink url="http://www.freebase.com/">Freebase</ulink> is an open community database of the world's information which serves facts
+and statistics rather than articles. Its designers see this difference in emphasis from article-oriented
+databases as beneficial for developers wanting to use Freebase facts in other websites and applications.</para>
+        <para>Virtuoso includes a Freebase cartridge in the rdf_mappers VAD. The aim of the example cartridge presented here is to provide a lightweight
+meta-cartridge that is used to conditionally add triples to graphs generated by the Freebase cartridge,
+if Freebase is describing a U.S. senator.</para>
+        <para><emphasis>New York Times Campaign Finance (NYTCF) API</emphasis></para>
+        <para>The <ulink url="http://developer.nytimes.com/docs/campaign_finance_api?authChecked=1">New York Times Campaign Finance (NYTCF) API</ulink> allows you to retrieve contribution and
+expenditure data based on United States Federal Election Commission filings. You can retrieve totals
+for a particular presidential candidate, see aggregates by ZIP code or state, or get details on a
+particular donor.</para>
+        <para>The API supports a number of query types. To keep this example from being overly long,
+the meta-cartridge supports just one of these - a query for the candidate details. An example query
+and the resulting output follow:</para>
+        <para><emphasis>Query:</emphasis></para>
 <programlisting><![CDATA[
-DB.DBA.RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+http://api.nytimes.com/svc/elections/us/v2/president/2008/finances/candidates/obama,barack.xml?api-key=xxxx
 ]]></programlisting>
-        <para>Here xd is an RDF/XML string holding the sponged RDF.</para>
-        <para><emphasis>Specifying & Retrieving Cartridge Specific Options</emphasis></para>
-        <para>The hook function prototype allows cartridge specific data to be passed to a cartridge
-through the RM_OPTIONS parameter, a Virtuoso/PL vector which acts as a heterogeneous array.</para>
-        <para>In the following example, two options are passed, 'add-html-meta' and 'get-feeds'
-with both values set to 'no'.</para>
+        <para>Result:</para>
 <programlisting><![CDATA[
-insert soft DB.DBA.SYS_RDF_MAPPERS (
-  RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION, RM_OPTIONS
+<result_set>
+ <status>OK</status>
+ <copyright>
+  Copyright (c) 2008 The New York Times Company. All Rights Reserved.
+ </copyright>
+ <results>
+  <candidate>
+    <candidate_name>Obama, Barack</candidate_name>
+    <committee_id>C00431445</committee_id>
+    <party>D</party>
+    <total_receipts>468841844</total_receipts>
+    <total_disbursements>391437723.5</total_disbursements>
+    <cash_on_hand>77404120</cash_on_hand>
+    <net_individual_contributions>426902994</net_individual_contributions>
+    <net_party_contributions>150</net_party_contributions>
+    <net_pac_contributions>450</net_pac_contributions>
+    <net_candidate_contributions>0</net_candidate_contributions>
+    <federal_funds>0</federal_funds>
+    <total_contributions_less_than_200>222694981.5</total_contributions_less_than_200>
+    <total_contributions_2300>76623262</total_contributions_2300>
+    <net_primary_contributions>46444638.81</net_primary_contributions>
+    <net_general_contributions>30959481.19</net_general_contributions>
+    <total_refunds>2058240.92</total_refunds>
+    <date_coverage_from>2007-01-01</date_coverage_from>
+    <date_coverage_to>2008-08-31</date_coverage_to>
+  </candidate>
+ </results>
+</result_set>
+]]></programlisting>
+        <para><emphasis>Sponging Freebase</emphasis></para>
+        <para><emphasis>Using OpenLink Data Explorer</emphasis></para>
+        <para>The following instructions assume you have the <ulink url="http://ode.openlinksw.com/">OpenLink Data Explorer (ODE)</ulink> browser extension installed in your browser.</para>
+        <para>An HTML description of Barack Obama can be obtained directly from Freebase by pasting the
+ following URL into your browser: http://www.freebase.com/view/en/barack_obama</para>
+        <para>To view RDF data sponged from this page, select 'Linked Data Sources' from the browser's
+'View' menu. An OpenLink Data Explorer interface will load in a new tab.</para>
+        <para>Clicking on the 'Barack Obama' link under the 'Person' category displayed by ODE sponges
+RDF data using the Freebase cartridge. Click the 'down arrow' adjacent to the 'Barack Obama' link to
+explore the retrieved data.</para>
+        <para>Assuming your Virtuoso instance is running on port 8890 on localhost, the list of data caches displayed
+by ODE should include: http://localhost:8890/about/html/http/www.freebase.com/view/en/barack_obama#this</para>
+        <para>The information displayed in the rest of the page relates to the entity instance identified by this URI. The prefix http://localhost:8890/about/html/http/ prepended to the
+original URI indicates that the Sponger Proxy Service has been invoked. The Sponger creates an associated
+entity instance (identified by the above URI with the #this suffix) which holds sponged information
+about the original entity.</para>
+        <para><emphasis>Using the Command Line</emphasis></para>
+        <para>As an alternative to ODE, you can sponge from the command line with the command:</para>
+<programlisting><![CDATA[
+curl -H "Accept: text/xml" "http://localhost:8890/about/html/http/www.freebase.com/view/en/barack_obama"
+]]></programlisting>
+        <para>To view the results, you can use Conductor's browser-based SPARQL interface (e.g.
+http://localhost:8890/sparql) to query the resulting graph generated by the Sponger,
+http://www.freebase.com/view/en/barack_obama.</para>
+        <para><emphasis>Installing the Meta-Cartridge</emphasis></para>
+        <para>To register the meta-cartridge, a procedure similar to the following can be used:</para>
+<programlisting><![CDATA[
+create procedure INSTALL_RDF_LOAD_NYTCF ()
+{
+  -- delete any previous NYTCF cartridge installed as a primary cartridge
+  DELETE FROM SYS_RDF_MAPPERS WHERE RM_HOOK = 'DB.DBA.RDF_LOAD_NYTCF';
+  -- register in the meta-cartridge post-processing chain
+  INSERT SOFT DB.DBA.RDF_META_CARTRIDGES (MC_PATTERN, MC_TYPE, MC_HOOK,
+    MC_KEY, MC_DESC, MC_OPTIONS)
+    VALUES (
+    'http://www.freebase.com/view/.*',
+    'URL', 'DB.DBA.RDF_LOAD_NYTCF', '2c1d95a62e5fxxxxx', 'Freebase NYTCF',
+    vector ());
+};
+]]></programlisting>
+        <para>Looking at the list of cartridges in Conductor's 'RDF Cartridges' screen, you will
+see that the Freebase cartridge is configured by default to sponge URIs which match the pattern
+"http://www.freebase.com/view/.*" The meta-cartridge is configured to match on the same URI pattern.</para>
+        <para>To use the Campaign Finance API, you must register and request an API key. The script
+above shows an invalid key. Replace it with your own key before executing the procedure.</para>
+        <para><emphasis>NYTCF Meta-Cartridge Functions</emphasis></para>
+        <para>The meta-cartridge function definitions are listed below. They can be executed by
+pasting them into Conductor's iSQL interface.</para>
+<programlisting><![CDATA[
+-- New York Times: Campaign Finance Web Service
+-- See http://developer.nytimes.com/docs/campaign_finance_api
+
+-- DB.DBA.RDF_NYTCF_LOOKUP is in effect a lightweight lookup cartridge that is used
+-- to conditionally add triples to graphs generated by the Wikipedia and
+-- Freebase cartridges. These cartridges call on RDF_NYTCF_LOOKUP when
+-- handling an entity of rdf:type yago:Congressman109955781. The NYTCF lookup
+-- cartridge (aka a metacartridge) is used to return campaign finance data
+-- for the candidate in question retrieved from the New York Times Campaign
+-- Finance web service.
+create procedure DB.DBA.RDF_NYTCF_LOOKUP(
+  in candidate_id any, 		-- id of candidate
+  in graph_iri varchar,		-- graph into which the additional campaign finance triples should be loaded
+  in api_key varchar		-- NYT finance API key
+)
+{
+  declare version, campaign_type, year any;
+  declare nyt_url, hdr, tmp any;
+  declare xt, xd any;
+
+  -- Common parameters - The NYT API only supports the following values at present:
+  version := 'v2';
+  campaign_type := 'president';
+  year := '2008';
+
+  -- Candidate summaries
+  -- nyt_url := sprintf('http://api.nytimes.com/svc/elections/us/%s/%s/%s/finances/totals.xml?api-key=%s',
+  --	version, campaign_type, year, api_key);
+
+  -- Candidate details
+  nyt_url := sprintf('http://api.nytimes.com/svc/elections/us/%s/%s/%s/finances/candidates/%s.xml?api-key=%s',
+  	version, campaign_type, year, candidate_id, api_key);
+
+  tmp := http_client_ext (nyt_url, headers=>hdr, proxy=>connection_get ('sparql-get:proxy'));
+  if (hdr[0] not like 'HTTP/1._ 200 %')
+    signal ('22023', trim(hdr[0], '\r\n'), 'DB.DBA.RDF_LOAD_NYTCF_LOOKUP');
+  xd := xtree_doc (tmp);
+
+  -- baseUri specifies what the generated RDF description is about
+  -- <rdf:Description rdf:about="{baseUri}">
+  -- Example baseUri's:
+  -- http://localhost:8890/about/rdf/http://www.freebase.com/view/en/barack_obama#this
+  -- http://localhost:8890/about/rdf/http://www.freebase.com/view/en/hillary_rodham_clinton#this
+  declare path any;
+  declare lang, k, base_uri varchar;
+
+  if (graph_iri like 'http://rdf.freebase.com/ns/%.%')
+    base_uri := graph_iri;
+  else
+    {
+      path := split_and_decode (graph_iri, 0, '%\0/');
+      k := path [length(path) - 1];
+      lang := path [length(path) - 2];
+
+      base_uri := sprintf ('http://rdf.freebase.com/ns/%U.%U', lang, k);
+    }
+
+  xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/nytcf2rdf.xsl', xd,
+      	vector ('baseUri', base_uri));
+  xd := serialize_to_UTF8_xml (xt);
+  DB.DBA.RDF_LOAD_RDFXML (xd, '', graph_iri);
+}
+;
+
+create procedure DB.DBA.RDF_MQL_RESOURCE_IS_SENATOR (
+  in fb_graph_uri varchar	-- URI of graph containing Freebase resource
 )
-values (
-  '(text/html)|(text/xml)|(application/xml)|(application/rdf.xml)',
-  'MIME', 'DB.DBA.RDF_LOAD_HTML_RESPONSE', null, 'xHTML',
-  vector ('add-html-meta', 'no', 'get-feeds', 'no')
-);
-]]></programlisting>
-        <para>The RM_OPTIONS vector can be handled as an array of key-value pairs using the
-get_keyword function. get_keyword performs a case sensitive search for the given keyword at
-every even index of the given array. It returns the element following the keyword, i.e.
-the keyword value.</para>
-        <para>Using get_keyword, any options passed to the cartridge can be retrieved
-using an approach similar to that below:</para>
-<programlisting><![CDATA[
-create procedure DB.DBA.RDF_LOAD_HTML_RESPONSE (
-  in graph_iri varchar, in new_origin_uri varchar, in dest varchar,
-  inout ret_body any, inout aq any, inout ps any, inout _key any,
-  inout opts any )
 {
-  declare get_feeds, add_html_meta;
-  ...
-  get_feeds := add_html_meta := 0;
-  if (isarray (opts) and 0 = mod (length(opts), 2))
+  -- Check if the resource described by Freebase is a U.S. senator. Only then does it make sense to query for campaign finance
+  -- data from the NYT data space.
+  --
+  -- To test for senators, we start by looking for two statements in the Freebase cartridge output, similar to:
+  --
+  -- <rdf:Description rdf:about="http://localhost:8890/about/rdf/http://www.freebase.com/view/en/hillary_rodham_clinton#this">
+  --   <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
+  --   <rdfs:seeAlso rdf:resource="http://en.wikipedia.org/wiki/Hillary_Rodham_Clinton"/>
+  --   ...
+  -- where the graph generated by the Sponger will be <http://www.freebase.com/view/en/hillary_rodham_clinton>
+  --
+  -- To test whether a resource is a senator:
+  -- 1) Check whether the Freebase resource is of rdf:type foaf:Person
+  -- 2) Extract the person_name from the Wikipedia URI referenced by rdfs:seeAlso
+  -- 3) Use the extracted person_name to build a URI to DBpedia's description of the person.
+  -- 4) Query the DBpedia description to see if the person is of rdf:type yago:Senator110578471
+  declare xp, xt, tmp any;
+  declare qry varchar;			-- SPARQL query
+  declare qry_uri varchar;		-- query URI
+  declare qry_res varchar;		-- query result
+  declare dbp_resource_name varchar;	-- Equivalent resource name in DBpedia
+  declare fb_resource_uri varchar; 	-- Freebase resource URI
+  declare path any;
+  declare lang, k varchar;
+
+  declare exit handler for sqlstate '*' {
+    return 0;
+  };
+
+  if (fb_graph_uri like 'http://rdf.freebase.com/ns/%.%')
+    fb_resource_uri := fb_graph_uri;
+  else
+{
+      path := split_and_decode (fb_graph_uri, 0, '%\0/');
+      if (length (path) < 2)
+	return 0;
+
+      k := path [length(path) - 1];
+      lang := path [length(path) - 2];
+
+      fb_resource_uri := sprintf ('http://rdf.freebase.com/ns/%U.%U', lang, k);
+    }
+
+  -- 1) Check whether the Freebase resource is a politician from united_states
   {
-    if (get_keyword ('get-feeds', opts) = 'yes')
-      get_feeds := 1;
-    if (get_keyword ('add-html-meta', opts) = 'yes')
-      add_html_meta := 1;
+    declare stat, msg varchar;
+    declare mdata, rset any;
+
+    qry := sprintf ('sparql ask from <%s> where { <%s> <http://rdf.freebase.com/ns/people.person.profession> <http://rdf.freebase.com/ns/en.politician> ; <http://rdf.freebase.com/ns/people.person.nationality> <http://rdf.freebase.com/ns/en.united_states> . }', fb_graph_uri, fb_resource_uri);
+    exec (qry, stat, msg, vector(), 1, mdata, rset);
+    if (length(rset) = 0 or rset[0][0] <> 1)
+      return 0;
   }
-  ...
-]]></programlisting>
-         <para><emphasis>API Keys</emphasis></para>
-         <para>Some Cartridges require and API account and/or API Key to be 
-provided for accessing the required service. This can be done from the RDF -> Sponger tab of the 
-Conductor by selecting the cartridge from the list provided, entering the API Account and API Key 
-in the dialog at the bottom of the page and click update to save, as indicated in the screenshot 
-below:</para>
-     <figure id="catr1" float="1">
-       <title>Registering API Key</title>
-       <graphic fileref="ui/cartrapikey.png"/>
-     </figure>
-     <para>For example, for the service Flickr developers must register
-to obtain a key. See http://developer.yahoo.com/flickr/. In order
-to cater for services which require an application key, the Cartridge Registry
-SYS_RDF_MAPPERS table includes an RM_KEY column to store any key required for a
-particular service. This value is passed to the service's cartridge through the
-_key parameter of the cartridge hook function.</para>
-         <para>Alternatively a cartridge can store a key value in the virtuoso.ini
-configuration file and retrieve it in the hook function.</para>       
-         <para>The next example shows an extract from the Flickr cartridge hook function
-DB.DBA.RDF_LOAD_FLICKR_IMG and the use of an API key. Also, commented out, is a call to
-cfg_item_value() which illustrates how the API key could instead be stored and retrieved
-from the SPARQL section of the virtuoso.ini file.
-         </para>
-<programlisting><![CDATA[
-create procedure DB.DBA.RDF_LOAD_FLICKR_IMG (
-in graph_iri varchar, in new_origin_uri varchar, in dest varchar,
-inout _ret_body any, inout aq any, inout ps any, inout _key any,
-inout opts any )
+
+  return 1;
+}
+;
+
+create procedure DB.DBA.RDF_LOAD_NYTCF_META (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
+    inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
 {
-declare xd, xt, url, tmp, api_key, img_id, hdr, exif any;
+  declare candidate_id, candidate_name any;
+  declare api_key any;
+  declare indx, tmp any;
+  declare ord int;
+
 declare exit handler for sqlstate '*'
 {
  return 0;
 };
-tmp := sprintf_inverse (new_origin_uri,
-  'http://farm%s.static.flickr.com/%s/%s_%s.%s', 0);
-img_id := tmp[2];
+
+  if (not DB.DBA.RDF_MQL_RESOURCE_IS_SENATOR (new_origin_uri))
+    return 0;
+
+  -- TO DO: hardcoded for now
+  -- Need a mechanism to specify API key for meta-cartridges
+  -- Could retrieve from virtuoso.ini?
 api_key := _key;
---cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'FlickrAPIkey');
-if (tmp is null or length (tmp) <> 5 or not isstring (api_key))
+
+  -- NYT API supports a candidate_id in one of two forms:
+  -- candidate_id ::= {candidate_ID} | {last_name [,first_name]}
+  -- first_name is optional. If included, there should be no space after the comma.
+  --
+  -- However, because this meta cartridge supplies additional triples for the
+  -- Wikipedia or Freebase cartridges, only the second form of candidate_id is
+  -- supported. i.e. We extract the candidate name, rather than a numeric
+  -- candidate_ID (FEC committee ID) from the Wikipedia or Freebase URL.
+  --
+  -- It's assumed that the source URI includes the candidate's first name.
+  -- If it is omitted, the NYT API will return information about *all* candidates
+  -- with that last name - something we don't want.
+
+  indx := strstr(graph_iri, 'www.freebase.com/view/en/');
+  if (indx is not null)
+  {
+    -- extract candidate_id from Freebase URI
+    tmp := sprintf_inverse(subseq(graph_iri, indx), 'www.freebase.com/view/en/%s', 0);
+    if (length(tmp) <> 1)
   return 0;
-url :=  sprintf('http://api.flickr.com/services/rest/?method=flickr.photos.getInfo&photo_id=%s&api_key=%s',img_id, api_key);
-tmp := http_get (url, hdr);
+    candidate_name := tmp[0];
+  }
+  else
+  {
+    indx := strstr(graph_iri, 'wikipedia.org/wiki/');
+    if (indx is not null)
+    {
+      -- extract candidate_id from Wikipedia URI
+      tmp := sprintf_inverse(subseq(graph_iri, indx), 'wikipedia.org/%s', 0);
+      if (length(tmp) <> 1)
+        return 0;
+      candidate_name := tmp[0];
+    }
+    else
+      {
+	tmp := sprintf_inverse(graph_iri, 'http://%s.freebase.com/ns/%s/%s', 0);
+	if (length (tmp) <> 3)
+	  tmp := sprintf_inverse(graph_iri, 'http://%s.freebase.com/ns/%s.%s', 0);
+	if (length (tmp) <> 3)
+	  return 0;
+	candidate_name := tmp[2];
+      }
+  }
+
+
+  -- split candidate_name into its component parts
+  --   candidate_name is assumed to be firstname_[middlename_]*lastname
+  --   e.g. hillary_rodham_clinton (Freebase), Hillary_clinton (Wikipedia)
+  {
+    declare i, _end, len int;
+    declare names, tmp_name varchar;
+
+    names := vector ();
+    tmp_name := candidate_name;
+    len := length (tmp_name);
+    while (1)
+    {
+      _end := strchr(tmp_name, '_');
+      if (_end is not null)
+      {
+        names := vector_concat (names, vector(subseq(tmp_name, 0, _end)));
+        tmp_name := subseq(tmp_name, _end + 1);
+      }
+      else
+      {
+        names := vector_concat(names, vector(tmp_name));
+        goto done;
+      }
+    }
+done:
+    if (length(names) < 2)
+      return 0;
+    -- candidate_id ::= lastname,firstname
+    candidate_id := sprintf('%s,%s', names[length(names)-1], names[0]);
+  }
+
+  DB.DBA.RDF_NYTCF_LOOKUP(candidate_id, coalesce (dest, graph_iri), api_key);
+  return 0;
+}
+;
+]]></programlisting>
+        <para><emphasis>NYTCF Meta-Cartridge Stylesheet</emphasis></para>
+        <para>The XSLT stylesheet, nyctf2rdf.xsl, used by the meta-cartridge to transform the base
+Campaign Finance web service output to RDF is shown below. RDF_NYCTF_LOOKUP() assumes the stylesheet
+is located alongside the other stylesheets provided by the rdf_mappers VAD in the Virtuoso WebDAV
+folder DAV/VAD/rdf_mappers/xslt. You should create nyctf2rdf.xsl here from the following listing.
+The WebDAV Browser interface in Conductor provides the easiest means to upload the stylesheet.</para>
+<programlisting><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<!ENTITY nyt "http://www.nytimes.com/">
+]>
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
+    xmlns:rdf=""
+    xmlns:nyt=""
+    >
+    <xsl:output method="xml" indent="yes" />
+    <xsl:template match="/result_set/status">
+      <xsl:if test="text() = 'OK'">
+        <xsl:apply-templates mode="ok" select="/result_set/results/candidate"/>
+      </xsl:if>
+    </xsl:template>
+
+    <xsl:template match="candidate" mode="ok">
+      <rdf:Description rdf:about="{vi:proxyIRI($baseUri)}">
+	  <nyt:candidate_name><xsl:value-of select="candidate_name"/></nyt:candidate_name>
+	  <nyt:committee_id><xsl:value-of select="committee_id"/></nyt:committee_id>
+	  <nyt:party><xsl:value-of select="party"/></nyt:party>
+	  <nyt:total_receipts><xsl:value-of select="total_receipts"/></nyt:total_receipts>
+	  <nyt:total_disbursements>
+	    <xsl:value-of select="total_disbursements"/>
+	  </nyt:total_disbursements>
+	  <nyt:cash_on_hand><xsl:value-of select="cash_on_hand"/></nyt:cash_on_hand>
+	  <nyt:net_individual_contributions>
+	    <xsl:value-of select="net_individual_contributions"/>
+         </nyt:net_individual_contributions>
+	  <nyt:net_party_contributions>
+	    <xsl:value-of select="net_party_contributions"/>
+	  </nyt:net_party_contributions>
+	  <nyt:net_pac_contributions>
+	    <xsl:value-of select="net_pac_contributions"/>
+	  </nyt:net_pac_contributions>
+	  <nyt:net_candidate_contributions>
+	    <xsl:value-of select="net_candidate_contributions"/>
+	  </nyt:net_candidate_contributions>
+	  <nyt:federal_funds><xsl:value-of select="federal_funds"/></nyt:federal_funds>
+	  <nyt:total_contributions_less_than_200>
+	    <xsl:value-of select="total_contributions_less_than_200"/>
+	  </nyt:total_contributions_less_than_200>
+	  <nyt:total_contributions_2300>
+	    <xsl:value-of select="total_contributions_2300"/>
+	  </nyt:total_contributions_2300>
+	  <nyt:net_primary_contributions>
+	    <xsl:value-of select="net_primary_contributions"/>
+	  </nyt:net_primary_contributions>
+	  <nyt:net_general_contributions>
+	    <xsl:value-of select="net_general_contributions"/>
+	  </nyt:net_general_contributions>
+	  <nyt:total_refunds><xsl:value-of select="total_refunds"/></nyt:total_refunds>
+	  <nyt:date_coverage_from rdf:datatype="date">
+	    <xsl:value-of select="date_coverage_from"/>
+	  </nyt:date_coverage_from>
+	  <nyt:date_coverage_to rdf:datatype="date">
+           <xsl:value-of select="date_coverage_to"/>
+          </nyt:date_coverage_to>
+      </rdf:Description>
+    </xsl:template>
+    <xsl:template match="text()|@*"/>
+</xsl:stylesheet>
 ]]></programlisting>
-        <para><emphasis>XSLT - The Fulchrum</emphasis></para>
-        <para>XSLT is the fulchrum of all OpenLink supplied cartridges. It provides the most convenient
-means of converting structured data extracted from web content by a cartridge's Entity Extractor into RDF.</para>
-        <para><emphasis>Virtuoso's XML Infrastructure & Tools</emphasis></para>
-        <para>Virtuoso's XML support and XSLT support are covered in detail in the on-line documentation.
-Virtuoso includes a highly capable XML parser and supports XPath, XQuery, XSLT and XML Schema validation.</para>
-        <para>Virtuoso supports extraction of XML documents from SQL datasets. A SQL long varchar, long xml
-or xmltype column in a database table can contain XML data as text or in a binary serialized format.
- A string representing a well-formed XML entity can be converted into an entity object representing
-the root node.</para>
-        <para>While Sponger cartridges will not normally concern themselves with handling XML extracted
-from SQL data, the ability to convert a string into an in-memory XML document is used extensively.
-The function xtree_doc(string) converts a string into such a document and returns a reference to the
-document's root. This document together with an appropriate stylesheet forms the input for
-the transformation of the extracted entities to RDF using XSLT. The input string to xtree_doc
-generally contains structured content derived from a web service.</para>
-        <para><emphasis>Virtuoso XSLT Support</emphasis></para>
-        <para>Virtuoso implements XSLT 1.0 transformations as SQL callable functions. The xslt() Virtuoso/PL function
-applies a given stylesheet to a given source XML document and returns the transformed document. Virtuoso
-provides a way to extend the abilities of the XSLT processor by creating user defined XPath functions.
-The functions xpf_extension() and xpf_extension_remove() allow addition and removal of XPath extension
-functions.</para>
-        <para><emphasis>General Cartridge Pipeline</emphasis></para>
-        <para>The broad pipeline outlined here reflects the steps common to most cartridges:</para>
+        <para>The stylesheet uses the prefix nyt: (http://www.nytimes.com) for the predicates of
+the augmenting triples. This has been used purely for illustration - you may prefer to define your
+own ontology for RDF data derived from New York Times APIs.</para>
+        <para><emphasis>Testing the Meta-Cartridge</emphasis></para>
+        <para>After creating the required Virtuoso/PL functions and installing the stylesheet, you
+should be able to test the meta-cartridge by sponging a Freebase page as described earlier using
+ODE or the command line. For instance:</para>
           <itemizedlist mark="bullet">
-            <listitem>Redirect from the requested URL to a Web service which returns XML</listitem>
-            <listitem>Stream the content into an in-memory XML document</listitem>
-            <listitem>Convert it to the required RDF/XML, expressed in the chosen ontology, using XSLT</listitem>
-            <listitem>Encode the RDF/XML as UTF-8</listitem>
-            <listitem>Load the RDF/XML into the quad store</listitem>
+          <listitem>http://www.freebase.com/view/en/barack_obama , or </listitem>
+          <listitem>http://www.freebase.com/view/en/hillary_rodham_clinton</listitem>
           </itemizedlist>
-        <para>The <ulink url="http://musicbrainz.org/">MusicBrainz</ulink> cartridge typifies this approach. MusicBrainz is a community music
-metadatabase which captures information about artists, their recorded works, and the relationships
-between them. Artists always have a unique ID, so the URL
-http://musicbrainz.org/artist/4d5447d7-c61c-4120-ba1b-d7f471d385b9.html takes you directly to entries
-for John Lennon.</para>
-        <para>If you were to look at this page in your browser, you would see that the information about
-the artist contains no RDF data. However, the cartridge is configured to intercept requests to URLs of
-the form http://musicbrainz.org/([^/]*)/([^.]*) and redirect to the cartridge to sponge all the
-available information on the given artist, release, track or label.</para>
-        <para>The cartridge extracts entities by redirecting to the MusicBrainz XML Web Service using
-as the basis for the initial query the item ID, e.g. an artist or label ID, extracted from the original
-URL. Stripped to its essentials, the core of the cartridge is:</para>
-<programlisting><![CDATA[
-webservice_uri := sprintf ('http://musicbrainz.org/ws/1/%s/%s?type=xml&inc=%U',
-					kind, id, inc);
-content := RDF_HTTP_URL_GET (webservice_uri, '', hdr, 'GET', 'Accept: */*');
-xt := xtree_doc (content);
-...
-xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/mbz2rdf.xsl', xt);
-...
-xd := serialize_to_UTF8_xml (xd);
-DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
-]]></programlisting>
-        <para>In the above outline, RDF_HTTP_URL_GET sends a query to the MusicBrainz web service,
-using query parameters appropriate for the original request, and retrieves the response using
-HTTP GET.</para>
-        <para>The returned XML is parsed into an in-memory parse tree by xtree_doc. Virtuoso/PL
-function RDF_MAPPER_XSLT is a simple wrapper around the function xslt which sets the current user
-to dba before returning an XML document transformed by an XSLT stylesheet, in this case mbz2rdf.xsl.
-Function serialize_to_UTF8_xml changes the character set of the in-memory XML document to UTF8.
-Finally, RM_RDF_LOAD_RDFXML is a wrapper around RDF_LOAD_RDFXML which parses the content of an
-RDF/XML string into a sequence of RDF triples and loads them into the quad store. XSLT stylesheets
-are usually held in the DAV/VAD/rdf_mappers/xslt folder of Virtuoso's WebDAV store.
-registry_get('rdf_mappers_path') returns the RDF Mappers VAD path, 'DAV/VAD/rdf_mappers', from the
-Virtuoso registry.</para>
-        <para><emphasis>Error Handling with Exit Handlers</emphasis></para>
-        <para>Virtuoso condition handlers determine the behaviour of a Virtuoso/PL procedure when a
-condition occurs. You can declare one or more condition handlers in a Virtuoso/PL procedure for
-general SQL conditions or specific SQLSTATE values. If a statement in your procedure raises an
-SQLEXCEPTION condition and you declared a handler for the specific SQLSTATE or SQLEXCEPTION
-condition the server passes control to that handler. If a statement in your Virtuoso/PL procedure
-raises an SQLEXCEPTION condition, and you have not declared a handler for the specific SQLSTATE
-or the SQLEXCEPTION condition, the server passes the exception to the calling procedure (if any).
-If the procedure call is at the top-level, then the exception is signaled to the calling client.</para>
-        <para>A number of different condition handler types can be declared (see the <ulink url="http://docs.openlinksw.com/virtuoso/handlingplcondit.html">Virtuoso reference documentation</ulink>
-for more details.) Of these, exit handlers are probably all you will need. An example is shown below
-which handles any SQLSTATE. Commented out is a debug statement which outputs the message describing
-the SQLSTATE.</para>
+        <para>You should see campaign finance data added to the graph created by the Sponger in the form of triples with predicates starting http://www.nytimes.com/xxx, e.g. http://www.nytimes.com/net_primary_contribution.</para>
+        <para><emphasis>How The Meta-Cartridge Works</emphasis></para>
+        <para>The comments in the meta-cartridge code detail how the cartridge works. In brief:</para>
+        <para>Given the URI of the graph being created by the Freebase cartridge,
+RDF_MQL_RESOURCE_IS_SENATOR checks if the resource described by Freebase is a U.S. senator.
+Only then does it make sense to query for campaign finance data from the NYTCF data space.</para>
+        <para>To test for senators, the procedure starts by looking for two statements in the Freebase cartridge output similar to:</para>
 <programlisting><![CDATA[
-create procedure DB.DBA.RDF_LOAD_SOCIALGRAPH (in graph_iri varchar, ...)
-{
-  declare qr, path, hdr any;
-  ...
-  declare exit handler for sqlstate '*'
-  {
-    -- dbg_printf ('%s', __SQL_MESSAGE);
-    return 0;
-  };
+<rdf:Description rdf:about="http://localhost:8890/about/rdf/http://www.freebase.com/view/en/barack_obama#this">
+  <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
+  <rdfs:seeAlso rdf:resource="http://en.wikipedia.org/wiki/Barack_Obama"/>
   ...
-  -- data extraction and mapping successful
-  return 1;
-}
 ]]></programlisting>
-        <para>Exit handlers are used extensively in the Virtuoso supplied cartridges. They are useful
-for ensuring graceful failure when trying to convert content which may not conform to your expectations.
-The RDF_LOAD_FEED_SIOC procedure (which is used internally by several cartridges) shown below uses this
-approach:</para>
+        <para>where the graph generated by the Sponger will be</para>
 <programlisting><![CDATA[
--- /* convert the feed in rss 1.0 format to sioc */
-create procedure DB.DBA.RDF_LOAD_FEED_SIOC (in content any, in iri varchar, in graph_iri varchar, in is_disc int := '')
-{
-  declare xt, xd any;
-  declare exit handler for sqlstate '*'
-    {
-      goto no_sioc;
-    };
-  xt := xtree_doc (content);
-  xd := DB.DBA.RDF_MAPPER_XSLT (
-      registry_get ('_rdf_mappers_path_') || 'xslt/feed2sioc.xsl', xt,
-      vector ('base', graph_iri, 'isDiscussion', is_disc));
-  xd := serialize_to_UTF8_xml (xd);
-  DB.DBA.RM_RDF_LOAD_RDFXML (xd, iri, graph_iri);
-  return 1;
-no_sioc:
-  return 0;
-}
+<http://www.freebase.com/view/en/barack_obama>
 ]]></programlisting>
-        <para><emphasis>Loading RDF into the Quad Store</emphasis></para>
-        <para><emphasis>RDF_LOAD_RDFXML & TTLP</emphasis></para>
-        <para>The two main Virtuoso/PL functions used by the cartridges for loading RDF data into the
-Virtuoso quad store are DB.DBA.TTLP and DB.DBA.RDF_LOAD_RDFXML. Multithreaded versions of these functions,
-DB.DBA.TTLP_MT and DB.DBA.RDF_LOAD_RDFXML_MT, are also available.</para>
-        <para>RDF_LOAD_RDFXML parses the content of an RDF/XML string as a sequence of RDF triples and
-loads then into the quad store. TTLP parses TTL (Turtle or N3) and places its triples into quad
-storage. Ordinarily, cartridges use RDF_LOAD_RDFXML. However there may be occasions where you want
-to insert statements written as TTL, rather than RDF/XML, in which case you should use TTLP.</para>
-  <tip><title>See Also:</title>
+        <para>To test whether a resource is a senator, RDF_MQL_RESOURCE_IS_SENATOR</para>
     <itemizedlist mark="bullet">
-      <listitem><link linkend="rdfinsertmethodsapifunct">Loading RDF using API functions</link></listitem>
+      <listitem>Checks whether the Freebase resource is of rdf:type foaf:Person</listitem>
+      <listitem>Extracts the person's name from the Wikipedia URI referenced by rdfs:seeAlso</listitem>
+      <listitem>Uses the extracted name to build a URI to DBpedia's description of the person. </listitem>
+      <listitem>Queries the DBpedia description to see if the person is of rdf:type yago:Senator110578471 (
+<ulink url="http://www.mpi-inf.mpg.de/~suchanek/downloads/yago/">YAGO</ulink> is a semantic knowledge base which provides a core set of concepts which in turn are used by DBpedia.)</listitem>
     </itemizedlist>
-  </tip>
-        <para><emphasis>Attribution</emphasis></para>
-        <para>Many of the OpenLink supplied cartridges actually use RM_RDF_LOAD_RDFXML to load data
-into the quad store. This is a thin wrapper around RDF_LOAD_RDFXML which includes in the generated
-graph an indication of the external ontologies being used. The attribution takes the form:</para>
+        <para>Only if this is the case is the RDF_NYTCF_LOOKUP routine called to query for and return campaign finance data for the candidate. The form of the query and the resulting XML output from the Campaign Finance service were presented earlier.</para>
+      </sect4>
+    </sect3>
+    <sect3 id="virtuosospongerelatedfunc">
+    <title>Virtuoso functions usage examples</title>
+    <sect4 id="virtuosospongerelatedfuncstring">
+      <title>String Functions</title>
+        <para><emphasis><link linkend="fn_sprintf_inverse">sprintf_inverse</link></emphasis></para>
 <programlisting><![CDATA[
-<ontologyURI> a opl:DataSource .
-<spongedResourceURI> rdfs:isDefinedBy <ontologyURI> .
-<ontologyURI> opl:hasNamespacePrefix "<ontologyPrefix>" .
+tmp := sprintf_inverse (new_origin_uri, 'http://farm%s.static.flickr.com/%s/%s_%s.%s', 0);
+img_id := tmp[2];
 ]]></programlisting>
-        <para>where prefix opl: denotes the ontology http://www.openlinksw.com/schema/attribution#.</para>
-        <para><emphasis>Deleting Existing Graphs</emphasis></para>
-        <para>Before loading sponged RDF data into a graph, you may want to delete any existing graph
-with the same URI. To do so, select the 'RDF' > 'List of Graphs' menu commands in Conductor, then use
-the 'Delete' command for the appropriate graph. Alternatively, you can use one of the following SQL
-commands:</para>
+        <para><emphasis><link linkend="fn_split_and_decode">split_and_decode</link></emphasis></para>
 <programlisting><![CDATA[
-SPARQL CLEAR GRAPH
--- or
-DELETE FROM DB.DBA.RDF_QUAD WHERE G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_iri)
+request_hdr := headers[0];
+response_hdr := headers[1];
+host := http_request_header (request, 'Host');
+tmp := split_and_decode (request_hdr[0], 0, '\0\0 ');
+
+http_method := tmp[0];
+url := tmp[1];
+protocol_version := substring (tmp[2], 6, 8);
+tmp := rtrim (response_hdr[0], '\r\n');
+tmp := split_and_decode (response_hdr[0], 0, '\0\0 ');
 ]]></programlisting>
-        <para><emphasis>Proxy Service Data Expiration</emphasis></para>
-        <para>When the Proxy Service is invoked by a user agent, the Sponger records the expiry date
-of the imported data in the table DB.DBA.SYS_HTTP_SPONGE. The data invalidation rules conform to those
-of traditional HTTP clients (Web browsers). The data expiration time is determined based on subsequent
-data fetches of the same resource. The first data retrieval records the 'expires' header. On subsequent
-fetches, the current time is compared to the expiration time stored in the local cache. If HTTP 'expires'
-header data isn't returned by the source data server, the Sponger will derive its own expiration time by
-evaluating the 'date' header and 'last-modified' HTTP headers.</para>
       </sect4>
-      <sect4 id="virtuosospongercreatecustcartrontolg">
-        <title>Ontology Mapping</title>
-        <para>After extracting entities from a web resource and converting them to an in-memory XML
-document, the entities must be transformed to the target ontology using XSLT and an appropriate stylesheet.
-A typical call sequence would be:</para>
+      <sect4 id="virtuosospongerelatedfuncrurl">
+      <title>Retrieving URLs</title>
+        <para><emphasis><link linkend="fn_http_get">http_get</link></emphasis></para>
+<programlisting><![CDATA[
+url := sprintf('http://api.flickr.com/services/rest/?i"??
+	method=flickr.photos.getInfo&photo_id=%s&api_key=%s', img_id, api_key);
+tmp := http_get (url, hdr);
+if (hdr[0] not like 'HTTP/1._ 200 %')
+  signal ('22023', trim(hdr[0], '\r\n'), 'RDFXX');
+xd := xtree_doc (tmp);
+]]></programlisting>
+        <para><emphasis>DB.DBA.RDF_HTTP_URL_GET</emphasis></para>
+        <para>A wrapper around http_get. Retrieves a URL using the specified HTTP method
+(defaults to GET). The function can handle proxies, redirects (up to fifteen) and HTTPS.</para>
 <programlisting><![CDATA[
-xt := xtree_doc (content);
-...
-xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/mbz2rdf.xsl', xt);
+uri := sprintf ('http://musicbrainz.org/ws/1/%s/%s?type=xml&inc=%U',
+	kind, id, inc);
+cnt := RDF_HTTP_URL_GET (uri, '', hdr, 'GET', 'Accept: */*');
+xt := xtree_doc (cnt);
+xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/mbz2rdf.xsl', xt, vector ('baseUri', new_origin_uri));
 ]]></programlisting>
-        <para>Because of the wide variation in the data mapped by cartridges, it is not possible to present
-a typical XSL stylesheet outline. The Examples section presented later includes detailed extracts from the
-MusicBrainz? cartridge's stylesheet which provide a good example of how to map to an ontology. Rather than
-attempting to be an XSLT tutorial, the material which follows offers some general guidelines.</para>
-        <para><emphasis>Passing Parameters to the XSLT Processor</emphasis></para>
-        <para>Virtuoso's XSLT processor will accept default values for global parameters from the optional
-third argument of the xslt() function. This argument, if specified, must be a vector of parameter names
-and values of the form vector(name1, value1,... nameN, valueN), where name1 ... nameN must be of type
-varchar, and value1 ... valueN may be of any Virtuoso datatype, but may not be null.</para>
-        <para>This extract from the Crunchbase cartridge shows how parameters may be passed to the XSLT
-processor. The function RDF_MAPPER_XSLT (in xslt varchar, inout xt any, in params any := null) passes
-the parameters vector directly to xslt().</para>
+        <para><emphasis><link linkend="fn_http_request_header">http_request_header</link></emphasis></para>
 <programlisting><![CDATA[
-xt := DB.DBA.RDF_MAPPER_XSLT (
-registry_get ('_rdf_mappers_path_') || 'xslt/crunchbase2rdf.xsl', xt,
-vector ('baseUri', coalesce (dest, graph_iri), 'base', base, 'suffix', suffix)
-);
+content := RDF_HTTP_URL_GET (rdf_url, new_origin_uri, hdr, 'GET',
+		'Accept: application/rdf+xml, text/rdf+n3, */*');
+ret_content_type := http_request_header (hdr, 'Content-Type', null, null);
 ]]></programlisting>
-        <para>The corresponding stylesheet crunchbase2rdf.xsl retrieves the parameters baseUri, base and suffix as follows:</para>
+      </sect4>
+      <sect4 id="virtuosospongerelatedfunchnxml">
+      <title>Handling Non-XML Response Content</title>
+        <para><emphasis>json_parse</emphasis>: Parses JSON content into a tree.</para>
 <programlisting><![CDATA[
-...
-<xsl:output method="xml" indent="yes" />
-  <xsl:variable name="ns">http://www.crunchbase.com/</xsl:variable>
-  <xsl:param name="baseUri" />
-  <xsl:param name="base"/>
-  <xsl:param name="suffix"/>
-  <xsl:template name="space-name">
-...
+url := sprintf ('http://www.freebase.com/api/service/mqlread?queries=%U', qr);
+  content := http_get (url, hdr);
+  tree := json_parse (content);
+  tree := get_keyword ('ROOT', tree);
+  tree := get_keyword ('result', tree);
 ]]></programlisting>
-        <para><emphasis>An RDF Description Template</emphasis></para>
-        <para><emphasis>Defining A Generic Resource Description Wrapper</emphasis></para>
-        <para>Many of the OpenLink cartridges create a resource description formed to a common "wrapper"
-template which describes the relationship between the (usually) non-RDF source resource being sponged
-and the RDF description generated by the Sponger. The wrapper is appropriate for resources which can
-broadly be conceived as documents. It provides a generic minimal description of the source document,
-but also links to the much more detailed description provided by the Sponger. So, instead of just
-emitting a resource description, the Sponger factors the container into the generated graph constituting
-the RDF description.</para>
-        <para>The template is depicted below:</para>
-        <figure id="spong3" float="1">
-          <title>Template</title>
-          <graphic fileref="ui/spong3.png"/>
-        </figure>
-        <para>To generate an RDF description corresponding to the wrapper template, a stylesheet containing
-the following block of instructions is used. This extract is taken from the eBay cartridge's stylesheet,
-ebay2rdf.xsl. Many of the OpenLink cartridges follow a similar pattern.</para>
+      </sect4>
+      <sect4 id="virtuosospongerelatedfuncwrarb">
+      <title>Writing Arbitrarily Long Text</title>
+        <para><emphasis><link linkend="fn_http">http</link></emphasis></para>
 <programlisting><![CDATA[
-    <xsl:param name="baseUri"/>
-    ...
-    <xsl:variable name="resourceURL">
-	<xsl:value-of select="$baseUri"/>
-    </xsl:variable>
-    ...
-    <xsl:template match="/">
-	<rdf:RDF>
-	    <rdf:Description rdf:about="{$resourceURL}">
-		<rdf:type rdf:resource="Document"/>
-		<rdf:type rdf:resource="Document"/>
-		<rdf:type rdf:resource="Container"/>
-		<sioc:container_of rdf:resource="{vi:proxyIRI ($resourceURL)}"/>
-		<foaf:primaryTopic rdf:resource="{vi:proxyIRI ($resourceURL)}"/>
-		<dcterms:subject rdf:resource="{vi:proxyIRI ($resourceURL)}"/>
-	    </rdf:Description>
-	    <rdf:Description rdf:about="{vi:proxyIRI ($resourceURL)}">
-		<rdf:type rdf:resource="Item"/>
-		<sioc:has_container rdf:resource="{$resourceURL}"/>
-		<xsl:apply-templates/>
-	    </rdf:Description>
-	</rdf:RDF>
-    </xsl:template>
+-- Writing N3 to a string output stream using function http(), parsing the N3 into a graph, then loading the graph into the quad store.
+ses := string_output ();
+http ('@prefix opl: <http://www.openlinksw.com/schema/attribution#> .\n', ses);
+http ('@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n', ses);
     ...
+DB.DBA.TTLP (ses, base, graph);
+DB.DBA.RDF_LOAD_RDFXML (strg, base, graph);
 ]]></programlisting>
-        <para><emphasis>Using SIOC as a Generic Container Model</emphasis></para>
-        <para>The generic resource description wrapper just described uses SIOC to establish the
-container/contained relationship between the source resource and the generated graph. Although the most
-important classes for the generic wrapper are obviously Container and Item, SIOC provides a generic data
-model of containers, items, item types, and associations between items which can be combined with other
- vocabularies such as FOAF and Dublin Core.</para>
-        <para>SIOC defines a number of other classes, such as User, UserGroup, Role, Site, Forum and
-Post. A separate SIOC types module (T-SIOC) extends the SIOC Core ontology by defining subclasses and
-subproperties of SIOC terms. Subclasses include: AddressBook, BookmarkFolder, Briefcase, EventCalendar,
-ImageGallery, Wiki, Weblog, BlogPost, Wiki plus many others.</para>
-        <para>OpenLink Data Spaces (ODS) uses SIOC extensively as a data space "glue" ontology to
-describe the base data and containment hierarchy of all the items managed by ODS applications
-(Data Spaces). For example, ODS-Weblog is an application of type sioc:Forum. Each ODS-Weblog
-application instance contains blogs of type sioct:Weblog. Each blog is a sioc:container_of posts
-of type sioc:Post.</para>
-        <para>Generally, when deciding how to describe resources handled by your own custom cartridge,
-SIOC provides a useful framework for the description which complements the SIOC-based container model
-adopted throughout the ODS framework.</para>
-        <para><emphasis>Naming Conventions for Sponger Generated Descriptions</emphasis></para>
-        <para>As can be seen from the stylesheet extract just shown, the URI of the resource
-description generated by the Sponger to describe the sponged resource is given by the
-function {vi:proxyIRI ($resourceURL)} where resourceURL is the URL of the original resource
-being sponged. proxyIRI is an XPath extension function defined in rdf_mappers.sql as</para>
+        <para><emphasis><link linkend="fn_string_output">string_output</link></emphasis></para>
 <programlisting><![CDATA[
-xpf_extension ('http://www.openlinksw.com/virtuoso/xslt/:proxyIRI', 'DB.DBA.RDF_SPONGE_PROXY_IRI');
+ses := string_output ();
+cnt := http_get (sprintf ('http://download.finance.yahoo.com/d/quotes.csv?s=%U&f=nsbavophg&e=.csv',
+    symbol));
+arr := rdfm_yq_parse_csv (cnt);
+http ('<quote stock="NASDAQ">', ses);
+foreach (any q in arr) do
+  {
+    http_value (q[0], 'company', ses);
+    http_value (q[1], 'symbol', ses);
+    ...
+  }
+  http ('</quote>', ses);
+  content := string_output_string (ses);
+  xt := xtree_doc (content);
 ]]></programlisting>
-        <para>which maps to the Virtuoso/PL procedure DB.DBA.RDF_SPONGE_PROXY_IRI. This procedure in
-turn generates a resource description URI which typically takes the form:
-http://<hostName:port>/about/html/http/<resourceURL>#this</para>
+        <para><emphasis><link linkend="fn_string_output_string">string_output_string</link></emphasis></para>
       </sect4>
-      <sect4 id="virtuosospongercreatecustcartrrgst">
-        <title>Registering & Configuring Cartridges</title>
-        <para>Once you have developed a cartridge, you must register it in the Cartridge Registry
-to have the SPARQL processor recognize and use it. You should have compiled your cartridge hook
-function first by issuing a "create procedure DB.DBA.RDF_LOAD_xxx ..." command through one of
-Virtuoso's SQL interfaces. You can create the required Cartridge Registry entry either by adding
-a row to the SYS_REF_MAPPERS table directly using SQL, or by using the Conductor UI.</para>
-        <para><emphasis>Using SQL</emphasis></para>
-        <para>If you choose register your cartridge using SQL, possibly as part of a Virtuoso/PL
-script, the required SQL will typically mirror one of the following INSERT commands.</para>
-        <para>Below, a cartridge for OpenCalais is being installed which will be tried when
-the MIME type of the data being sponged is one of text/plain, text/xml or text/html.
-(The definition of the SYS_RDF_MAPPERS table was introduced earlier in section
-'Cartridge Registry'.)</para>
+      <sect4 id="virtuosospongerelatedfuncxmlxslt">
+      <title>XML & XSLT</title>
+        <para><emphasis><link linkend="fn_xtree_doc">xtree_doc</link></emphasis></para>
 <programlisting><![CDATA[
-insert soft DB.DBA.SYS_RDF_MAPPERS (
-  RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION, RM_ENABLED)
-values (
-  '(text/plain)|(text/xml)|(text/html)', 'MIME', 'DB.DBA.RDF_LOAD_CALAIS',
-  null, 'Opencalais', 1);
+content := RDF_HTTP_URL_GET (uri, '', hdr, 'GET', 'Accept: */*');
+xt := xtree_doc (content);
 ]]></programlisting>
-        <para>As an alternative to matching on the content's MIME type,
-candidate cartridges to be tried in the conversion pipeline can be identified by matching the
-data source URL against a URL pattern stored in the cartridge's entry in the Cartridge Registry.</para>
+       <para><emphasis><link linkend="fn_xpath_eval">xpath_eval</link></emphasis></para>
 <programlisting><![CDATA[
-insert soft DB.DBA.SYS_RDF_MAPPERS (
-  RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION, RM_OPTIONS)
-values (
-  '(http://api.crunchbase.com/v/1/.*)|(http://www.crunchbase.com/.*)', 'URL',
-  'DB.DBA.RDF_LOAD_CRUNCHBASE', null, 'CrunchBase', null);
+profile := cast (xpath_eval ('/html/head/@profile', xt) as varchar);
 ]]></programlisting>
-        <para>The value of RM_ID to set depends on where in the cartridge invocation order you want
-to position a particular cartridge. RM_ID should be set lower than 10028 to ensure the cartridge
-is tried before the ODS-Briefcase (WebDAV) metadata extractor, which is always the last mapper to
-be tried if no preceding cartridge has been successful.</para>
+        <para><emphasis><link linkend="fn_xslt">DB.DBA.RDF_MAPPER_XSLT</link></emphasis></para>
 <programlisting><![CDATA[
-UPDATE DB.DBA.SYS_RDF_MAPPERS
-SET RM_ID = 1000
-WHERE RM_HOOK = 'DB.DBA.RDF_LOAD_BIN_DOCUMENT';
+tmp := http_get (url);
+xd := xtree_doc (tmp);
+xt := DB.DBA.RDF_MAPPER_XSLT (
+	registry_get ('_rdf_mappers_path_') || 'xslt/atom2rdf.xsl',
+	xd, vector ('baseUri', coalesce (dest, graph_iri)));
 ]]></programlisting>
-        <para><emphasis>Using Conductor</emphasis></para>
-        <para>Cartridges can be added manually using the 'Add' panel of the 'RDF Cartridges' screen.</para>
-        <figure id="spong4" float="1">
-          <title>RDF Cartridges</title>
-          <graphic fileref="ui/spong4.png"/>
-        </figure>
-        <figure id="spong5" float="1">
-          <title>RDF Cartridges</title>
-          <graphic fileref="ui/spong5.png"/>
-        </figure>
-        <para><emphasis>Installing Stylesheets</emphasis></para>
-        <para>Although you could place your cartridge stylesheet in any folder configured to be accessible
-by Virtuoso, the simplest option is to upload them to the DAV/VAD/rdf_mappers/xslt folder using the
-WebDAV browser accessible from the Conductor UI.</para>
-        <figure id="spong6" float="1">
-          <title>WebDAV browser</title>
-          <graphic fileref="ui/spong6.png"/>
-        </figure>
-        <para>Should you wish to locate your stylesheets elsewhere, ensure
-that the DirsAllowed setting in the virtuoso.ini file is configured appropriately.</para>
       </sect4>
-      <sect4 id="virtuosospongercreatecustcartrexmp">
-        <title>Example - MusicBrainz: A Music Metadatabase</title>
-        <para>To illustrate some of the material presented so far, we'll delve
-deeper into the <ulink url="http://musicbrainz.org/">MusicBrainz</ulink> cartridge mentioned earlier.</para>
-        <para><emphasis>MusicBrainz XML Web Service</emphasis></para>
-        <para>The cartridge extracts data through the <ulink url="http://musicbrainz.org/doc/XMLWebService">MusicBrainz XML Web Service</ulink> using, as the basis
-for the initial query, an item type and MBID (MusicBrainz ID) extracted from the original URI submitted
-to the RDF proxy. A range of item types are supported including artist, release and track.</para>
-        <para>Using the album "Imagine" by John Lennon as an example, a standard HTML description of
-the album (which has an MBID of f237e6a0-4b0e-4722-8172-66f4930198bc) can be retrieved direct from
-MusicBrainz using the URL:</para>
-<programlisting><![CDATA[
-http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html
-]]></programlisting>
-        <para>Alternatively, information can be extracted in XML form through the web service.
-A description of the tracks on the album can be obtained with the query:</para>
+      <sect4 id="virtuosospongerelatedfunccharserconv">
+      <title>Character Set Conversion</title>
+        <para><emphasis><link linkend="fn_serialize_to_UTF8_xml">serialize_to_UTF8_xml</link></emphasis></para>
 <programlisting><![CDATA[
-http://musicbrainz.org/ws/1/release/f237e6a0-4b0e-4722-8172-66f4930198bc?type=xml&inc=tracks
+xt := DB.DBA.RDF_MAPPER_XSLT (
+	registry_get ('_rdf_mappers_path_') || 'xslt/crunchbase2rdf.xsl',
+	xt, vector ('baseUri', coalesce (dest, graph_iri), 'base', base,
+	'suffix', suffix));
+xd := serialize_to_UTF8_xml (xt);
+DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
 ]]></programlisting>
-        <para>The XML returned by the web service is shown below (only the first two tracks
-are shown for brevity):</para>
-<programlisting><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
-  <metadata xmlns="http://musicbrainz.org/ns/mmd-1.0#"
-   xmlns:ext="http://musicbrainz.org/ns/ext-1.0#">
-    <release id="f237e6a0-4b0e-4722-8172-66f4930198bc" type="Album Official" >
-      <title>Imagine</title>
-        <text-representation language="ENG" script="Latn"/>
-        <asin>B0000457L2</asin>
-        <track-list>
-          <track id="b88bdafd-e675-4c6a-9681-5ea85ab99446">
-            <title>Imagine</title>
-            <duration>182933</duration>
-          </track>
-          <track id="b38ce90d-3c47-4ccd-bea2-4718c4d34b0d">
-            <title>Crippled Inside</title>
-            <duration>227906</duration>
-          </track>
+      </sect4>
+      <sect4 id="virtuosospongerelatedfuncloaddata">
+      <title>Loading Data Into the Quad Store</title>
+        <para><emphasis><link linkend="fn_rdf_load_rdfxml">DB.DBA.RDF_LOAD_RDFXML</link></emphasis></para>
+<programlisting><![CDATA[
+content := RDF_HTTP_URL_GET (uri, '', hdr, 'GET', 'Accept: */*');
+xt := xtree_doc (content);
+xd := DB.DBA.RDF_MAPPER_XSLT (
+	registry_get ('_rdf_mappers_path_') || 'xslt/mbz2rdf.xsl',
+	xt, vector ('baseUri', new_origin_uri));
+xd := serialize_to_UTF8_xml (xd);
+DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+]]></programlisting>
+        <para><emphasis><link linkend="fn_ttlp">DB.DBA.TTLP</link></emphasis></para>
+<programlisting><![CDATA[
+sess := string_output ();
 	  . . .
-        </track-list>
-      </release>
-  </metadata>
+http (sprintf ('<http://dbpedia.org/resource/%s>
+	<http://xbrlontology.com/ontology/finance/stock_market#hasCompetitor>
+	<http://dbpedia.org/resource/%s> .\n',
+	symbol, x), sess);
+http (sprintf ('<http://dbpedia.org/resource/%s>
+	<http://www.w3.org/2000/01/rdf-schema#isDefinedBy>
+	<http://finance.yahoo.com/q?s=%s> .\n',
+	 x, x), sess);
+content := string_output_string (sess);
+DB.DBA.TTLP (content, new_origin_uri, coalesce (dest, graph_iri));
 ]]></programlisting>
-        <para>Although, as shown above, MusicBrainz defines its own <ulink url="http://musicbrainz.org/doc/MusicBrainzXMLMetaData">XML Metadata Format</ulink> to represent
-music metadata, the MusicBrainz sponger converts the raw data to a subset of the <ulink url="http://musicontology.com/">Music Ontology</ulink>,
-an RDF vocabulary which aims to provide a set of core classes and properties for describing music
-on the Semantic Web. Part of the subset used is depicted in the following RDF graph (representing
-in this case a John Cale album).</para>
-        <figure id="spong7" float="1">
-          <title>RDF graph</title>
-          <graphic fileref="ui/spong7.png"/>
-        </figure>
-        <para>With the prefix mo: denoting the Music Ontology at http://purl.org/ontology/mo/, it can be
-seen that artists are represented by instances of class mo:Artist, their albums, records etc. by instances
-of class mo:Release and tracks on these releases by class mo:Track. The property foaf:made links an
-artist and his/her releases. Property mo:track links a release with the tracks it contains</para>
-        <para><emphasis>RDF Output</emphasis></para>
-        <para>An RDF description of the album can be obtained by sponging the same URL, i.e. by submitting it to the Sponger's proxy interface using the URL:</para>
+  <tip><title>See Also:</title>
+    <itemizedlist mark="bullet">
+      <listitem><link linkend="rdfinsertmethodsapifunct">Loading RDF using API functions</link></listitem>
+    </itemizedlist>
+  </tip>
+      </sect4>
+      <sect4 id="virtuosospongerelatedfuncdebugpoutput">
+        <title>Debug Output</title>
+        <para><emphasis><link linkend="fn_dbg_obj_print">dbg_obj_print</link></emphasis></para>
 <programlisting><![CDATA[
-http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html
+dbg_obj_print ('try all grddl mappings here');
 ]]></programlisting>
-        <para>The extract below shows part of the (reorganized) RDF output returned by the Sponger
-for "Imagine". Only the album's title track is included.</para>
+      </sect4>
+    </sect3>
+    <sect3 id="virtuosospongeref">
+      <title>References</title>
+      <itemizedlist mark="bullet">
+        <listitem>RDF Primer: http://www.w3.org/TR/2004/REC-rdf-primer-20040210/</listitem>
+        <listitem>RDF/XML Syntax Specification: http://www.w3.org/TR/rdf-syntax-grammar/</listitem>
+        <listitem>GRDDL Primer: http://www.w3.org/TR/grddl-primer/</listitem>
+      </itemizedlist>
+      <sect4 id="virtuosospongerefping">
+        <title>PingTheSemanticWeb RDF Notification Service</title>
+        <para><ulink url="http://www.pingthesemanticweb.com/">PingtheSemanticWeb</ulink> (PTSW) is a repository for RDF documents. The PTSW web service
+archives the location of recently created or updated RDF documents on the Web. It is intended
+for use by crawlers or other types of software agents which need to know when and where the
+latest updated RDF documents can be found. They can request a list of recently updated documents
+as a starting location to crawl the Semantic Web.</para>
+        <para>You may find this service useful for publicizing your own RDF content. Content authors can
+notify PTSW that an RDF document has been created or updated by pinging the service with the URL of
+the document. The Sponger supports this facility through the async_queue and ping_service parameters
+of the cartridge hook function, where the ping_service parameter contains the ping service URL as
+configured in the SPARQL section of the virtuoso.ini file:</para>
 <programlisting><![CDATA[
-<?xml version="1.0" encoding="utf-8" ?>
-<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
-
-<rdf:Description
- rdf:about="http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html">
-  <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Document"/>
-</rdf:Description>
-
-<rdf:Description
- rdf:about="http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html">
-  <foaf:primaryTopic xmlns:foaf="http://xmlns.com/foaf/0.1/"
-   rdf:resource="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html#this"/>
-</rdf:Description>
-
-<rdf:Description rdf:about="http://purl.org/ontology/mo/">
-  <rdf:type rdf:resource="http://www.openlinksw.com/schema/attribution#DataSource"/>
-</rdf:Description>
+[SPARQL]
 ...
-<rdf:Description
- rdf:about="http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html">
-  <rdfs:isDefinedBy rdf:resource="http://purl.org/ontology/mo/"/>
-
-</rdf:Description>
+PingService = http://rpc.pingthesemanticweb.com/
 ...
-<!-- Record description -->
-<rdf:Description
- rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html#this">
-  <rdf:type rdf:resource="http://purl.org/ontology/mo/Record"/>
-</rdf:Description>
-
-<rdf:Description
- rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html#this">
-  <dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">Imagine</dc:title>
-</rdf:Description>
-
-<rdf:Description
- rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html#this">
-  <mo:release_status xmlns:mo="http://purl.org/ontology/mo/" rdf:resource="http://purl.org/ontology/mo/official"/>
-</rdf:Description>
-
-<rdf:Description
- rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html#this">
-  <mo:release_type xmlns:mo="http://purl.org/ontology/mo/"
-   rdf:resource="http://purl.org/ontology/mo/album"/>
-</rdf:Description>
-<!-- Title track description -->
-<rdf:Description
- rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/release/f237e6a0-4b0e-4722-8172-66f4930198bc.html#this">
-  <mo:track xmlns:mo="http://purl.org/ontology/mo/"
-   rdf:resource="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/track/b88bdafd-e675-4c6a-9681-5ea85ab99446.html#this"/>
-</rdf:Description>
-<rdf:Description
- rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/track/b88bdafd-e675-4c6a-9681-5ea85ab99446.html#this">
-  <rdf:type rdf:resource="http://purl.org/ontology/mo/Track"/>
-</rdf:Description>
-
-<rdf:Description
- rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/track/b88bdafd-e675-4c6a-9681-5ea85ab99446.html#this">
-  <dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">Imagine</dc:title>
-</rdf:Description>
-
-<rdf:Description
- rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/track/b88bdafd-e675-4c6a-9681-5ea85ab99446.html#this">
-  <mo:track_number xmlns:mo="http://purl.org/ontology/mo/">1</mo:track_number>
-</rdf:Description>
-
-<rdf:Description
- rdf:about="http://demo.openlinksw.com/about/rdf/http://musicbrainz.org/track/b88bdafd-e675-4c6a-9681-5ea85ab99446.html#this">
-  <mo:duration xmlns:mo="http://purl.org/ontology/mo/" rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">182933</mo:duration>
-</rdf:Description>
-</rdf:RDF>
 ]]></programlisting>
-        <para><emphasis>Cartridge Hook Function</emphasis></para>
-        <para>The cartridge's hook function is listed below. It is important to note that MusicBrainz
- supports a variety of query types, each of which returns a different set of information, depending
-on the item type being queried. Full details can be found on the MusicBrainz? site. The sponger
-cartridge is capable of handling all the query types supported by MusicBrainz? and is intended to
-be used in a drill-down scenario, as would be the case when using an RDF browser such as the
-<ulink url="http://ode.openlinksw.com/">OpenLink Data Explorer (ODE)</ulink>. This example focuses primarily on the types release and track.</para>
+        <para>The configured ping service can be called using an asynchronous request and
+the RDF_SW_PING procedure as illustrated below. </para>
 <programlisting><![CDATA[
-create procedure DB.DBA.RDF_LOAD_MBZ (
+create procedure DB.DBA.RDF_LOAD_HTML_RESPONSE (
   in graph_iri varchar, in new_origin_uri varchar, in dest varchar,
-  inout _ret_body any, inout aq any, inout ps any, inout _key any,
-  inout opts any)
+  inout ret_body any, inout async_queue any, inout ping_service any,
+  inout _key any, inout opts any )
 {
-  declare kind, id varchar;
-  declare tmp, incs any;
-  declare uri, cnt, hdr, inc, xd, xt varchar;
-  tmp := regexp_parse ('http://musicbrainz.org/([^/]*)/([^\.]+)', new_origin_uri, 0);
+  ...
+  if ( ... and async_queue is not null)
+    aq_request (async_queue, 'DB.DBA.RDF_SW_PING',
+                vector (ping_service, new_origin_uri));
+]]></programlisting>
+        <para>For more details refer to section <link linkend="ASYNCEXECMULTITHREAD">Asynchronous Execution and Multithreading in Virtuoso/PL</link></para>
+      </sect4>
+      <sect4 id="virtuosospongeremname">
+        <title>Main Namespaces used by OpenLink Cartridges</title>
+        <para>A list of the main namespaces / ontologies used by OpenLink-provided Sponger cartridges
+is given below. Some of these ontologies may prove useful when creating your own cartridges.</para>
+        <itemizedlist mark="bullet">
+          <listitem>- http://www.openlinksw.com/virtuoso/xslt/</listitem>
+          <listitem>- http://www.openlinksw.com/schemas/XHTML# </listitem>
+          <listitem>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# </listitem>
+          <listitem>rdfs: http://www.w3.org/2000/01/rdf-schema# </listitem>
+          <listitem>dc: http://purl.org/dc/elements/1.1/</listitem>
+          <listitem>dcterms: http://purl.org/dc/terms/</listitem>
+          <listitem>foaf: http://xmlns.com/foaf/0.1/</listitem>
+          <listitem>sioc: http://rdfs.org/sioc/ns# </listitem>
+          <listitem>sioct: http://rdfs.org/sioc/types# </listitem>
+          <listitem>skos: http://www.w3.org/2004/02/skos/core# </listitem>
+          <listitem>bibo: http://purl.org/ontology/bibo/</listitem>
+        </itemizedlist>
+      </sect4>
+      <sect4 id="virtuosospongerfreeb">
+        <title>Freebase Cartridge & Stylesheet</title>
+        <para>Snapshots of the Freebase cartridge and stylesheet compatible with the meta-cartridge
+example presented earlier in this document can be found below.</para>
+        <para><emphasis>DB.DBA.RDF_LOAD_MQL:</emphasis></para>
+<programlisting><![CDATA[
+--no_c_escapes-
+create procedure DB.DBA.RDF_LOAD_MQL (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
+    inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
+{
+  declare qr, path, hdr any;
+  declare tree, xt, xd, types any;
+  declare k, cnt, url, sa varchar;
+
+  hdr := null;
+  sa := '';
   declare exit handler for sqlstate '*'
   {
     -- dbg_printf ('%s', __SQL_MESSAGE);
     return 0;
   };
-  if (length (tmp) < 6)
-    return 0;
 
-  kind := subseq (new_origin_uri, tmp[2], tmp[3]);
-  id :=   subseq (new_origin_uri, tmp[4], tmp[5]);
-  incs := vector ();
-  if (kind = 'artist')
+  path := split_and_decode (new_origin_uri, 0, '%\0/');
+  if (length (path) < 1)
+    return 0;
+  k := path [length(path) - 1];
+  if (path [length(path) - 2] = 'guid')
+    k := sprintf ('"id":"/guid/%s"', k);
+  else
     {
-      inc := 'aliases artist-rels label-rels release-rels track-rels url-rels';
-      incs :=
-      	vector (
-	'sa-Album', 'sa-Single', 'sa-EP', 'sa-Compilation', 'sa-Soundtrack',
-	'sa-Spokenword', 'sa-Interview', 'sa-Audiobook', 'sa-Live', 'sa-Remix', 'sa-Other'
-	, 'va-Album', 'va-Single', 'va-EP', 'va-Compilation', 'va-Soundtrack',
-
-	'va-Spokenword', 'va-Interview', 'va-Audiobook', 'va-Live', 'va-Remix', 'va-Other'
-	);
-    }
-  else if (kind = 'release')
-    inc := 'artist counts release-events discs tracks artist-rels label-rels release-rels track-rels url-rels track-level-rels labels';
-  else if (kind = 'track')
-    inc := 'artist releases puids artist-rels label-rels release-rels track-rels url-rels';
-  else if (kind = 'label')
-    inc := 'aliases artist-rels label-rels release-rels track-rels url-rels';
+    if (k like '#%')
+        k := sprintf ('"id":"%s"', k);
   else
-    return 0;
-  if (dest is null)
-    DELETE FROM DB.DBA.RDF_QUAD WHERE G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_iri);
-  DB.DBA.RDF_LOAD_MBZ_1 (graph_iri, new_origin_uri, dest, kind, id, inc);
-  DB.DBA.TTLP (sprintf ('<%S> <http://xmlns.com/foaf/0.1/primaryTopic> <%S> .\n<%S> a <http://xmlns.com/foaf/0.1/Document> .',
-  	new_origin_uri, DB.DBA.RDF_SPONGE_PROXY_IRI (new_origin_uri), new_origin_uri),
-  	'', graph_iri);
-  foreach (any inc1 in incs) do
+      {
+	sa := DB.DBA.RDF_MQL_GET_WIKI_URI (k);
+    k := sprintf ('"key":"%s"', k);
+  }
+  }
+  qr := sprintf ('{"ROOT":{"query":[{%s, "type":[]}]}}', k);
+  url := sprintf ('http://www.freebase.com/api/service/mqlread?queries=%U', qr);
+  cnt := http_get (url, hdr);
+  tree := json_parse (cnt);
+  xt := get_keyword ('ROOT', tree);
+  if (not isarray (xt))
+    return 0;
+  xt := get_keyword ('result', xt);
+  types := vector ();
+  foreach (any tp in xt) do
     {
-      DB.DBA.RDF_LOAD_MBZ_1 (graph_iri, new_origin_uri, dest, kind, id, inc1);
+      declare tmp any;
+      tmp := get_keyword ('type', tp);
+      types := vector_concat (types, tmp);
     }
-  return 1;
-};
-]]></programlisting>
-        <para>The hook function uses a subordinate procedure RDF_LOAD_MBZ_1:</para>
-<programlisting><![CDATA[
-create procedure DB.DBA.RDF_LOAD_MBZ_1 (in graph_iri varchar, in new_origin_uri varchar,
-   in dest varchar, in kind varchar, in id varchar, in inc varchar)
+  --types := get_keyword ('type', xt);
+  DELETE FROM DB.DBA.RDF_QUAD WHERE g =  iri_to_id(new_origin_uri);
+  foreach (any tp in types) do
 {
-  declare uri, cnt, xt, xd, hdr any;
-  uri := sprintf ('http://musicbrainz.org/ws/1/%s/%s?type=xml&inc=%U', kind, id, inc);
-  cnt := RDF_HTTP_URL_GET (uri, '', hdr, 'GET', 'Accept: */*');
-  xt := xtree_doc (cnt);
-  xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/mbz2rdf.xsl', xt,
-        vector ('baseUri', new_origin_uri));
-  xd := serialize_to_UTF8_xml (xd);
+      qr := sprintf ('{"ROOT":{"query":{%s, "type":"%s", "*":[]}}}', k, tp);
+      url := sprintf ('http://www.freebase.com/api/service/mqlread?queries=%U', qr);
+      cnt := http_get (url, hdr);
+      --dbg_printf ('%s', cnt);
+      tree := json_parse (cnt);
+      xt := get_keyword ('ROOT', tree);
+      xt := DB.DBA.MQL_TREE_TO_XML (tree);
+      --dbg_obj_print (xt);
+      xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/mql2rdf.xsl', xt,
+      	vector ('baseUri', coalesce (dest, graph_iri), 'wpUri', sa));
+      sa := '';
+      xd := serialize_to_UTF8_xml (xt);
+--      dbg_printf ('%s', xd);
   DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
-};
+    }
+  return 1;
+}
 ]]></programlisting>
-        <para><emphasis>XSLT Stylesheet</emphasis></para>
-        <para>The key sections of the MusicBrainz XSLT template relevant to this example are
-listed below. Only the sections relating to an artist, his releases, or the tracks on those
-releases, are shown.</para>
+        <para><emphasis>mql2rdf.xsl:</emphasis></para>
 <programlisting><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ -
+ -  $Id: rdfandsparql.xml,v 1.95.2.44 2011/03/24 16:04:34 source Exp $
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2008 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+-->
 <!DOCTYPE xsl:stylesheet [
-<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
 <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
-<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
-<!ENTITY mo "http://purl.org/ontology/mo/">
+<!ENTITY bibo "http://purl.org/ontology/bibo/">
+<!ENTITY xsd  "http://www.w3.org/2001/XMLSchema#">
 <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
-<!ENTITY mmd "http://musicbrainz.org/ns/mmd-1.0#">
-<!ENTITY dc "http://purl.org/dc/elements/1.1/">
+<!ENTITY sioc "http://rdfs.org/sioc/ns#">
 ]>
 <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
-    xmlns:rdf=""
-    xmlns:rdfs=""
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+    xmlns:sioc=""
+    xmlns:bibo=""
     xmlns:foaf=""
-    xmlns:mo=""
-    xmlns:mmd=""
-    xmlns:dc=""
-    >
+    xmlns:skos="http://www.w3.org/2004/02/skos/core#"
+    xmlns:dcterms= "http://purl.org/dc/terms/"
+    xmlns:mql="http://www.freebase.com/">
 
     <xsl:output method="xml" indent="yes" />
-    <xsl:variable name="base" select="'http://musicbrainz.org/'"/>
-    <xsl:variable name="uc">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
-    <xsl:variable name="lc">abcdefghijklmnopqrstuvwxyz</xsl:variable>
-    <xsl:template match="/mmd:metadata">
+
+    <xsl:param name="baseUri" />
+    <xsl:param name="wpUri" />
+
+    <xsl:variable name="ns">http://www.freebase.com/</xsl:variable>
+
+    <xsl:template match="/">
 	<rdf:RDF>
-	    <xsl:apply-templates />
+	    <xsl:if test="/results/ROOT/result/*">
+		<rdf:Description rdf:about="{$baseUri}">
+		    <rdf:type rdf:resource="Document"/>
+		    <rdf:type rdf:resource="Document"/>
+		    <rdf:type rdf:resource="Container"/>
+		    <sioc:container_of rdf:resource="{vi:proxyIRI($baseUri)}"/>
+		    <foaf:primaryTopic rdf:resource="{vi:proxyIRI($baseUri)}"/>
+		    <dcterms:subject rdf:resource="{vi:proxyIRI($baseUri)}"/>
+		</rdf:Description>
+		<rdf:Description rdf:about="{vi:proxyIRI($baseUri)}">
+		    <rdf:type rdf:resource="Item"/>
+		    <sioc:has_container rdf:resource="{$baseUri}"/>
+		    <xsl:apply-templates select="/results/ROOT/result/*"/>
+		    <xsl:if test="$wpUri != ''">
+			<rdfs:seeAlso rdf:resource="{$wpUri}"/>
+		    </xsl:if>
+		</rdf:Description>
+	    </xsl:if>
 	</rdf:RDF>
     </xsl:template>
 
-    ...
-
-    <xsl:template match="mmd:artist[@type='Person']">
-	<mo:MusicArtist rdf:about="{vi:proxyIRI (concat($base,'artist/', at id,'.html'))}">
-	    <foaf:name><xsl:value-of select="mmd:name"/></foaf:name>
-	    <xsl:for-each select="mmd:release-list/mmd:release|mmd:relation-list[@target-type='Release']/mmd:relation/mmd:release">
-		<foaf:made rdf:resource="{vi:proxyIRI (concat($base,'release/', at id,'.html'))}"/>
-	    </xsl:for-each>
-	</mo:MusicArtist>
-	<xsl:apply-templates />
+    <xsl:template match="*[starts-with(.,'http://') or starts-with(.,'urn:')]">
+	<xsl:element namespace="{$ns}" name="{name()}">
+	    <xsl:attribute name="rdf:resource">
+		<xsl:value-of select="vi:proxyIRI (.)"/>
+	    </xsl:attribute>
+	</xsl:element>
     </xsl:template>
 
-    <xsl:template match="mmd:release">
-	<mo:Record rdf:about="{vi:proxyIRI (concat($base,'release/', at id,'.html'))}">
-	    <dc:title><xsl:value-of select="mmd:title"/></dc:title>
-	    <mo:release_type rdf:resource="{translate (substring-before (@type, ' '),
-                                                          $uc, $lc)}"/>
-	    <mo:release_status rdf:resource="{translate (substring-after (@type, ' '), $uc,
-                                                  $lc)}"/>
-	    <xsl:for-each select="mmd:track-list/mmd:track">
-		<mo:track rdf:resource="{vi:proxyIRI (concat($base,'track/', at id,'.html'))}"/>
+    <xsl:template match="*[starts-with(.,'/')]">
+	<xsl:if test="local-name () = 'type' and . like '%/person'">
+	    <rdf:type rdf:resource="Person"/>
+	</xsl:if>
+	<xsl:if test="local-name () = 'type'">
+	    <sioc:topic>
+		<skos:Concept rdf:about="{vi:proxyIRI (concat ($ns, 'view', .))}"/>
+	    </sioc:topic>
+	</xsl:if>
 
-	    </xsl:for-each>
-	</mo:Record>
-	<xsl:apply-templates select="mmd:track-list/mmd:track"/>
+	<xsl:element namespace="{$ns}" name="{name()}">
+	    <xsl:attribute name="rdf:resource">
+		<xsl:value-of select="vi:proxyIRI(concat ($ns, 'view', .))"/>
+	    </xsl:attribute>
+	</xsl:element>
     </xsl:template>
 
-    <xsl:template match="mmd:track">
-	<mo:Track rdf:about="{vi:proxyIRI (concat($base,'track/', at id,'.html'))}">
-	    <dc:title><xsl:value-of select="mmd:title"/></dc:title>
-	    <mo:track_number><xsl:value-of select="position()"/></mo:track_number>
-	    <mo:duration rdf:datatype="integer">
-             <xsl:value-of select="mmd:duration"/>
-           </mo:duration>
-	    <xsl:if test="artist[@id]">
-		<foaf:maker rdf:resource="{vi:proxyIRI (concat ($base, 'artist/',
-                                          artist/@id, '.html'))}"/>
-	    </xsl:if>
-	    <mo:musicbrainz rdf:resource="{vi:proxyIRI (concat ($base, 'track/', @id, '.html'))}"/>
-	</mo:Track>
+    <xsl:template match="*[* and ../../*]">
+	<xsl:element namespace="{$ns}" name="{name()}">
+	    <xsl:attribute name="rdf:parseType">Resource</xsl:attribute>
+	    <xsl:apply-templates select="@*|node()"/>
+	</xsl:element>
     </xsl:template>
 
-    ...
-
-    <xsl:template match="text()"/>
+    <xsl:template match="*">
+	<xsl:if test="* or . != ''">
+		<xsl:choose>
+		    <xsl:when test="name()='image'">
+			<foaf:depiction rdf:resource="{vi:mql-image-by-name (.)}"/>
+		    </xsl:when>
+		    <xsl:otherwise>
+			<xsl:element namespace="{$ns}" name="{name()}">
+			    <xsl:if test="name() like 'date_%'">
+				<xsl:attribute name="rdf:datatype">dateTime</xsl:attribute>
+			    </xsl:if>
+			    <xsl:apply-templates select="@*|node()"/>
+			</xsl:element>
+		    </xsl:otherwise>
+		</xsl:choose>
+	</xsl:if>
+    </xsl:template>
 </xsl:stylesheet>
 ]]></programlisting>
-      </sect4>
-      <sect4 id="virtuosospongercreatecartentextmapcont">
-        <title>Entity Extractor & Mapper Component</title>
-
-<para>
-Used to extract RDF from a Web Data Source the Virtuoso Sponger Cartridge RDF Extractor consumes services from: Virtuoso PL, C/C++, Java
-based RDF Extractors</para>
-<para>The RDF mappers provide a way to extract metadata from non-RDF documents such as HTML pages,
-images Office documents etc. and pass to SPARQL sponger (crawler which retrieve missing
-source graphs). For brevity further in this article the "RDF mapper" we simply will call "mapper".
-</para>
-<para>The mappers consist of PL procedure (hook) and extractor, where extractor itself can be built
-using PL, C or any external language supported by Virtuoso server.</para>
-<para>Once the mapper is developed it must be plugged into the SPARQL engine by adding a record
-in the table DB.DBA.SYS_RDF_MAPPERS.</para>
-<para>If a SPARQL query instructs the SPARQL processor to retrieve target graph into local storage,
-then the SPARQL sponger will be invoked. If the target graph IRI represents a dereferenceable URL
-then content will be retrieved using content negotiation. The next step is the content type
-to be detected:</para>
-<itemizedlist>
-<listitem>If RDF and no further transformation such as GRDDL is needed, then the process would stop.</listitem>
-<listitem>If such as 'text/plain' and is not known to have metadata, then the SPARQL sponger will
-look in the DB.DBA.SYS_RDF_MAPPERS table by order of RM_ID and for every matching URL or MIME
-type pattern (depends on column RM_TYPE) will call the mapper hook.
-  <itemizedlist>
-    <listitem>If hook returns zero the next mapper will be tried;</listitem>
-    <listitem>If result is negative the process would stop instructing the SPARQL nothing was retrieved;</listitem>
-    <listitem>If result is positive the process would stop instructing the SPARQL that metadata was retrieved.</listitem>
-  </itemizedlist>
+      </sect4>
+    </sect3>
+  <sect3 id="rdfspongerprogrammerguidepython"><title>Using Python to perform Virtuoso Sponging</title>
+  <para>This section contains the generic steps to use Python language to extend the Virtuoso Sponger.</para>
+    <orderedlist>
+      <listitem>Build the latest Python hosting module. It will introduce a new function <code>python_exec ()</code>
+<para>The parameters of python_exec are :</para>
+<itemizedlist mark="bullet">
+  <listitem>string containing a python code, it should define one or more functions, see remarks bellow</listitem>
+  <listitem>string containing name of function to be called</listitem>
+  <listitem>list of parameters for the function </listitem>
+  </itemizedlist>
+<para>For Example:</para>
+<programlisting><![CDATA[
+python_exec (file_to_string ('spoonge.py'), 'rdf4uri', 'http://url..', 'http://base...');
+]]></programlisting>
+<para>The above means call the rdf4uri ('http://url..', 'http://base...') function from spoonge.py file. 
+It is importnat to know that python_exec is restricted to DBA only group and that the python source 
+should not have __main__ or this to be restricted in python code to not be called . 
+Any print etc. for stdout/stderr will go on server console if server is on foreground. 
+Can be used for debug for example but not for real work. </para>
+<para>The function is supposed to return just single string, don't try to return multiple results, 
+this will not work in this revision. 
+</para>
+</listitem>
+      <listitem>Setup the Virtuoso server INI to include python module:
+<programlisting><![CDATA[
+...
+[Plugins]
+LoadPath = ../lib
+Load1    = Hosting, hosting_python.so
+...
+]]></programlisting>      	
+      </listitem>
+      <listitem>Download and install the rdflib package from http://www.rdflib.net/
+Note before to build, disable Zope interface in rdflib as this not work with C-API correctly. 
+Or make sure Python has no Zope interfaces installed. 
+To disable the zope in rdflib, just comment out following in <rdflibhome>/rdflib/__init__.py:
+<programlisting><![CDATA[
+ 36 #from rdflib.interfaces import IIdentifier, classImplements
+ 37 #classImplements(URIRef, IIdentifier)
+ 38 #classImplements(BNode, IIdentifier)
+ 39 #classImplements(Literal, IIdentifier)	
+]]></programlisting>
+<para>Then do:</para>
+<programlisting><![CDATA[
+perl setup.py build
+perl setup.py --user install	
+]]></programlisting>
+      </listitem>
+      <listitem>Get an example of python code for sponger like: http://www.ebusiness-unibw.org/wiki/Python4Spongers 
+and make sure you disable the last lines which not suitable for calling inside Sponger:
+<programlisting><![CDATA[
+...
+#if __name__ == '__main__':
+#	rdf_xml = rdf4uri(uri='http://www.amazon.com/Apple-touch-Generation-NEWEST-MODEL/dp/B002M3SOBU/')
+#	print rdf_xml
+]]></programlisting>
+<para>Store the python code in sponge.py in server working directory. 
+Make sure this directory is allowed to read in DirsAllowed INI setting.</para>
 </listitem>
-</itemizedlist>
-<sect5 id="virtuosospongercartridgesextractorpl">
-  <title>Virtuoso/PL based Extractors</title>
-<para><emphasis>PL hook requirements:</emphasis></para>
-<para>Every PL function used to plug a mapper into SPARQL engine must have following parameters in
-the same order:</para>
-<itemizedlist>
-<listitem>in graph_iri varchar: the graph IRI which is currently retrieved</listitem>
-<listitem>in new_origin_uri varchar: the URL of the document retrieved</listitem>
-<listitem>in destination varchar: the destination graph IRI</listitem>
-<listitem>inout content any: the content of the document retrieved by SPARQL sponger </listitem>
-<listitem>inout async_queue any: an asynchronous queue, can be used to push something to execute
-on background if needed.</listitem>
-<listitem>inout ping_service any: the value of [SPARQL] - PingService INI parameter, could be used
-to configure a service notification such as pingthesemanticweb.com</listitem>
-<listitem>inout api_key any: a plain text id single key value or serialized vector of key structure,
-basically the value of RM_KEY column of the DB.DBA.SYS_RDF_MAPPERS table.</listitem>
-</itemizedlist>
-<para>Note: the names of the parameters are not important, but their order and presence are!</para>
-<para><emphasis>Example Implementation:</emphasis></para>
-<para>In the example script bellow we implement a basic mapper, which maps a text/plain mime type to an
-imaginary ontology, which extends the class Document from FOAF with properties 'txt:UniqueWords'
-and 'txt:Chars', where the prefix 'txt:' we specify as 'urn:txt:v0.0:'.</para>
+      <listitem>Create a procedure and register with Sponger: 
 <programlisting><![CDATA[
-use DB;
+-- THIS IS FOR DEMO PURPOSE ONLY 
 
-create procedure DB.DBA.RDF_LOAD_TXT_META
- (
-  in graph_iri varchar,
-  in new_origin_uri varchar,
-  in dest varchar,
-  inout ret_body any,
-  inout aq any,
-  inout ps any,
-  inout ser_key any
-  )
+-- for demo purposes we delete all other cartridges registrations to see effect from only this cartridge
+delete from DB.DBA.SYS_RDF_MAPPERS;
+delete from DB.DBA.RDF_META_CARTRIDGES;
+
+-- register cartridge 
+insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
+	values ('(http://.*amazon.[^/]+/[^/]+/dp/[^/]+(/.*)?)', 'URL', 'DB.DBA.RDF_LOAD_PYTHON_AMAZON_ARTICLE', null, 'Amazon articles');
+
+-- the cartridge stored procedure itself 
+create procedure DB.DBA.RDF_LOAD_PYTHON_AMAZON_ARTICLE (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
+    inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
 {
-  declare words, chars int;
-  declare vtb, arr, subj, ses, str any;
-  declare ses any;
-  -- if any error we just say nothing can be done
+  declare result any;
+  -- we check first python hosting is capable to run code
+  if (__proc_exists ('python_exec', 2) is null)
+    return 0;
+  -- handle any error
   declare exit handler for sqlstate '*'
     {
+      -- log the error 
+      DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE); 	
       return 0;
     };
-  subj := coalesce (dest, new_origin_uri);
-  vtb := vt_batch ();
-  chars := length (ret_body);
+  -- call the python code
+  result := python_exec (file_to_string ('sponge.py'), 'rdf4uri', new_origin_uri);
+  -- in case of python error we will get integer zero, so we check 
+  if (not isstring (result))
+    return 0;
+  -- for demo purpose we delete all from this graph
+  delete from DB.DBA.RDF_QUAD where G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_iri);
+  -- load the results
+  DB.DBA.RDF_LOAD_RDFXML (result, new_origin_uri, coalesce (dest, graph_iri), 0);
+  return 1;
+}
+;	
+]]></programlisting>      	
+</listitem>
+      <listitem>Test the Sponger code like this:
+<programlisting><![CDATA[
+sparql define get:soft "soft" select * from <http://www.amazon.com/Apple-touch-Generation-NEWEST-MODEL/dp/B002M3SOBU/> { ?s ?p ?o };	
+]]></programlisting>      	
+</listitem>                  
+    </orderedlist>
+  </sect3>
+</sect2>
+<sect2 id="virtuosospongersampleuses"><title>Sponger Usage Examples</title>
+<itemizedlist mark="bullet">
+	<listitem><link linkend="virtuosospongerusageprocessorex">SPARQL Processor Usage Example</link></listitem>
+	<listitem><link linkend="virtuosospongerusageproxyex2">RDF Proxy Service Example</link></listitem>
+	<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtDeployingLinkedDataGuide_BrowsingNorthwindRdfView#AncMozToc2">Browsing & Exploring RDF View Example Using ODE</ulink></listitem>
+	<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtDeployingLinkedDataGuide_BrowsingNorthwindRdfView#AncMozToc3">Browsing & Exploring RDF View Example Using iSPARQL</ulink></listitem>
+	<listitem><link linkend="rdfinsertmethodplapissimpleexample">Basic Sponger Cartridge Example</link></listitem>
+  <listitem><link linkend="virtuosospongerusagebriefex">HTTP Example for Extracting Metadata using CURL</link></listitem>
+  <listitem><link linkend="virtuosospongercartridgetypesmetarestexamples">RESTFul Interaction Examples</link></listitem>
+  <listitem><link linkend="virtuosospongercreatecustcartrrgstflickr">Flickr Cartridge Example</link></listitem>
+  <listitem><link linkend="virtuosospongercreatecustcartrexmp">MusicBrainz Metadatabase Example</link></listitem>
+</itemizedlist>
+</sect2>	
+</sect1>
 
-  -- using the text index procedures we get a list of words
-  vt_batch_feed (vtb, ret_body, 1);
-  arr := vt_batch_strings_array (vtb);
+<sect1 id="virtuosospongerfacetinstall">
+<title>Virtuoso Facet Browser Installation and configuration</title>
+<sect2 id="virtuosospongerfacetinstallprereq">
+<title>Prerequisites</title>
+<para>Requires Virtuoso 6.0 TP1 or higher for use.
+</para>
+</sect2>
+<sect2 id="virtuosospongerfacetinstallpreinst">
+<title>Pre Installation</title>
+<para><emphasis>Note</emphasis>: This step is not required for Virtuoso Release 6.1 and above builds</para>
+<para>If you have an existing Virtuoso 6.x installation, and your Quad Store has greater than
+10K worth of triples, please perform the following steps:
+</para>
+<orderedlist>
+  <listitem>Run the following commands using the Virtuoso isql program before installing the Facet
+Browser VAD:
+<programlisting><![CDATA[
+  drop index RDF_QUAD_OPGS;
+  drop index RDF_QUAD_POGS;
+  drop index RDF_QUAD_GPOS;
+  drop index RDF_QUAD_OGPS;
 
-  -- the list has 'word' and positions array, so we must divide by 2
-  words := length (arr) / 2;
-  ses := string_output ();
+  checkpoint;
 
-  -- we compose a N3 literal
-  http (sprintf ('<%s> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Document> .\n', subj), ses);
-  http (sprintf ('<%s> <urn:txt:v0.0:UniqueWords> "%d" .\n', subj, words), ses);
-  http (sprintf ('<%s> <urn:txt:v0.0:Chars> "%d" .\n', subj, chars), ses);
-  str := string_output_string (ses);
+  create table R2 (G iri_id_8, S iri_id_8, P iri_id_8, O any, primary key (S, P, O, G));
+  alter index R2 on R2 partition (S int (0hexffff00));
 
-  -- we push the N3 text into the local store
-  DB.DBA.TTLP (str, new_origin_uri, subj);
-  return 1;
-};
+  log_enable (2);
 
-DELETE FROM DB.DBA.SYS_RDF_MAPPERS WHERE RM_HOOK = 'DB.DBA.RDF_LOAD_TXT_META';
+  INSERT INTO R2 (G, S, P, O) select G, S, P, O FROM rdf_quad;
 
-INSERT SOFT DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
-VALUES ('(text/plain)', 'MIME', 'DB.DBA.RDF_LOAD_TXT_META', null, 'Text Files (demo)');
+  DROP TABLE RDF_QUAD;
+  ALTER TABLE r2 rename RDF_QUAD;
 
--- here we set order to some large number so don't break existing mappers
-update DB.DBA.SYS_RDF_MAPPERS
-SET RM_ID = 2000
-WHERE RM_HOOK = 'DB.DBA.RDF_LOAD_TXT_META';
-]]></programlisting>
-<para>To test the mapper we just use /sparql endpoint with option 'Retrieve remote RDF data
-for all missing source graphs' to execute:</para>
-<programlisting><![CDATA[
-SELECT *
-FROM <URL-of-a-txt-file>
-WHERE { ?s ?p ?o }
+  checkpoint;
+
+  create bitmap index RDF_QUAD_OPGS on RDF_QUAD (O, P, G, S) partition (O varchar (-1, 0hexffff));
+  create bitmap index RDF_QUAD_POGS on RDF_QUAD (P, O, G, S) partition (O varchar (-1, 0hexffff));
+  create bitmap index RDF_QUAD_GPOS on RDF_QUAD (G, P, O, S) partition (O varchar (-1, 0hexffff));
+
+  checkpoint;
 ]]></programlisting>
-<para>It is important that the SPARQL_UPDATE role to be granted to "SPARQL" account in order
-to allow local repository update via sponge feature.</para>
-<para><emphasis>Authentication in Sponger</emphasis></para>
-<para>To enable usage of user defined authentication, there are added more parameters to the
-/proxy/rdf and /sparql endpoints. So to use it, the RDF browser and iSPARQL should send following
-url parameters:</para>
-<itemizedlist>
-<listitem>for /proxy/rdf endpoint:
+</listitem>
+</orderedlist>
+<para>Note this step may take sometime depending on how many triples are already in your Quad Store.
+</para>
+</sect2>
+<sect2 id="virtuosospongerfacetinstallvadinst">
+<title>VAD Package Installation</title>
+<orderedlist>
+  <listitem>Download and install the <ulink url="http://download.openlinksw.com/packages/5.0/virtuoso/fct_dav.vad">Virtuoso Facet Browser VAD</ulink>
+package using the Conductor System Admin - > Packages tab.
+    <figure id="fctinst1" float="1">
+      <title>Install the FCT package</title>
+      <graphic fileref="ui/fctinst1.png"/>
+    </figure>
+</listitem>
+  <!--listitem>Grant <emphasis>select</emphasis> privileges on the <emphasis>RDF_QUAD</emphasis> table to the
+<emphasis>SPARQL</emphasis> user:
 <programlisting><![CDATA[
-'login=<account name>'
+grant SELECT  on DB.DBA.RDF_QUAD to "SPARQL";
 ]]></programlisting>
+</listitem-->
+  <!--listitem>An updated Virtuoso RDF Mappers VAD is required. Download and install the
+<ulink url="http://download.openlinksw.com/packages/5.0/virtuoso/rdf_mappers_dav.vad">RDF Mappers VAD</ulink>
+package using the Conductor System Admin - > Packages tab.
+    <figure id="fctinst2" float="1">
+      <title>Install the RDF Mappers package</title>
+      <graphic fileref="ui/fctinst2.png"/>
+    </figure>
+</listitem-->
+  <listitem>The HTML interface of the Faceted Browser Engine is exposed at: <emphasis>http://<cname>/fct</emphasis>,
+where "cname" is the hostname:portno your Virtuoso instance is running on.
+    <figure id="fctinst3" float="1">
+      <title>FCT HTML interface</title>
+      <graphic fileref="ui/fctinst3.png"/>
+    </figure>
 </listitem>
-<listitem>for /sparql endpoint:
+  <listitem>The Facet Browser Engine exposes a REST API at the endpoint:
+<emphasis>http://<cname>/fct/service</emphasis>.
+  <tip><title>See Also:</title>
+    <itemizedlist mark="bullet">
+      <listitem><link linkend="virtuosospongerfacentuirestapi">Virtuoso APIs for Facet REST services</link></listitem>
+      <listitem><link linkend="rdfiridereferencingfacetws">Facets Web Service and Linked Data</link></listitem>
+</itemizedlist>
+  </tip>
+</listitem>
+</orderedlist>
+</sect2>
+<sect2 id="virtuosospongerfacetinstallposinst">
+<title>Post Installation</title>
+<orderedlist>
+  <listitem>Build Full Text Indexes by running the following commands using the Virtuoso
+<emphasis>isql</emphasis> program:
 <programlisting><![CDATA[
-get-login=<account name>
+RDF_OBJ_FT_RULE_ADD (null, null, 'All');
+VT_INC_INDEX_DB_DBA_RDF_OBJ ();
 ]]></programlisting>
 </listitem>
-</itemizedlist>
-</sect5>
-<sect5 id="virtuosospongerrdfmappersregistry"><title>Registry</title>
-<para>The table DB.DBA.SYS_RDF_MAPPERS is used as registry for registering RDF mappers.</para>
+  <listitem>Run the following procedure using the Virtuoso <emphasis>isql</emphasis> program to
+populate label lookup tables periodically and activate the <emphasis>Label</emphasis> text box of the
+<emphasis>URI Lookup(by Label)</emphasis> tab:
 <programlisting><![CDATA[
-create table DB.DBA.SYS_RDF_MAPPERS (
-    RM_ID integer identity,         -- mapper ID, designate order of execution
-    RM_PATTERN varchar,             -- a REGEX pattern to match URL or MIME type
-    RM_TYPE varchar default 'MIME', -- what property of the current resource to match: MIME or URL are supported at present
-    RM_HOOK varchar,                -- fully qualified PL function name e.q. DB.DBA.MY_MAPPER_FUNCTION
-    RM_KEY  long varchar,           -- API specific key to use
-    RM_DESCRIPTION long varchar,    -- Mapper description, free text
-    RM_ENABLED integer default 1,   -- a flag 0 or 1 integer to include or exclude the given mapper from processing chain
-    primary key (RM_TYPE, RM_PATTERN))
-;
+urilbl_ac_init_db()
 ]]></programlisting>
-<para>The current way to register/update/unregister a mapper is just a DML statement e.g.
-NSERT/UPDATE/DELETE.</para>
-</sect5>
-<sect5 id="virtuosospongerrdfmappersexec"><title>Execution order and processing</title>
-<para>When SPARQL retrieves a resource with unknown content it will look in the mappers registry
-and will loop over every record having RM_ENABLED flag true. The sequence of look-up is based on
-ordering by RM_ID column. For every record it will either try matching the MIME type or URL against
-RM_PATTERN value and if there is match the function specified in RM_HOOK column will be called.
-If the function doesn't exists or signal an error the SPARQL will look at next record.</para>
-<para>When it stops looking? It will stop if value returned by mapper function is positive or
-negative number, if the return is negative processing stops with meaning no RDF was supplied,
-if return is positive the meaning is that RDF data was extracted, if zero integer is returned
-then SPARQL will look for next mapper. The mapper function also can return zero if it is expected
-next mapper in the chain to get more RDF data.</para>
-<para>If none of the mappers matches the signature (MIME type nor URL) the built-in WebDAV
-metadata extractor will be called.</para>
-</sect5>
-<sect5 id="virtuosospongerrdfmappersextfunc"><title>Extension function</title>
-<para>The mapper function is a PL stored procedure with following signature:</para>
+</listitem>
+  <listitem>Run the following procedure using the Virtuoso <emphasis>isql</emphasis> program to calculate the IRI ranks.
+Note this should be run periodically as the data grows to re-rank the IRIs.
 <programlisting><![CDATA[
-THE_MAPPER_FUNCTION_NAME (
-        in graph_iri varchar,
-        in origin_uri varchar,
-        in destination_uri varchar,
-        inout content varchar,
-        inout async_notification_queue any,
-        inout ping_service any,
-        inout keys any
-        )
-{
-   -- do processing here
-   -- return -1, 0 or 1 (as explained above in Execution order and processing section)
-}
-;
+s_rank()
 ]]></programlisting>
-<para><emphasis>Parameters</emphasis></para>
-<itemizedlist>
-<listitem>graph_iri - the target graph IRI</listitem>
-<listitem>origin_uri - the current URI of processing</listitem>
-<listitem>destination_uri - get:destination value</listitem>
-<listitem>content - the resource content</listitem>
-<listitem>async_notification_queue - if INI parameter PingService is specified in SPARQL
-section in the INI file, this is a pre-allocated asynchronous queue to be used to call
-ping service</listitem>
-<listitem>ping_service - the URL of the ping service configured in SPARQL section in the
-INI in PingService parameter</listitem>
-<listitem>keys - a string value contained in the RM_KEY column for given mapper, can be
-single string or serialized array, generally can be used as mapper specific data.</listitem>
-</itemizedlist>
-<para><emphasis>Return value</emphasis></para>
-<itemizedlist>
-<listitem>0 - no data was retrieved or some next matching mapper must extract more data</listitem>
-<listitem>1 - data is retrieved, stop looking for other mappers</listitem>
-<listitem>-1 - no data is retrieved, stop looking for more data</listitem>
-</itemizedlist>
-</sect5>
-<sect5 id="virtuosospongerrdfmapperspackage"><title>RDF Mappers package content</title>
-<para>The Virtuoso supply as a rdf_mappers_dav VAD package a cartridge for extracting RDF data
-from certain popular Web resources and file types. It can be installed (if not already) using
-VAD_INSTALL function, see the VAD chapter in documentation on how to do that.</para>
-<para><emphasis>HTTP-in-RDF</emphasis></para>
-<para>Maps the HTTP request response to HTTP Vocabulary in RDF, see http://www.w3.org/2006/http#.</para>
-<para>This mapper is disabled by default. If it's enabled , it must be first in order of execution.</para>
-<para>Also it always will return 0, which means any other mapper should push more data.</para>
-<para><emphasis>HTML</emphasis></para>
-<para>This mapper is composite, it looking for metadata which can specified in a HTML pages as
-follows:</para>
-<itemizedlist>
-<listitem>Embedded/linked RDF
-  <itemizedlist>
-    <listitem>scan for meta in RDF
+</listitem>
+  <listitem>Sponge some data to load some RDF triples in the quad store. This can easily be done using
+the Virtuoso <emphasis>description.vsp</emphasis> page which provides a hypertext description of RDF Linked Data, by describing
+the following page for example (or one of your choice):
 <programlisting><![CDATA[
-<link rel="meta" type="application/rdf+xml"
-]]></programlisting></listitem>
-    <listitem>RDF embedded in xHTML (as markup or inside XML comments)</listitem>
-  </itemizedlist>
+http://cname/about/html/http/news.cnet.com
+]]></programlisting>
+    <figure id="fctinst4" float="1">
+      <title>Sponge data</title>
+      <graphic fileref="ui/fctinst4.png"/>
+    </figure>
 </listitem>
-<listitem>Micro-formats
-  <itemizedlist>
-    <listitem>GRDDL - GRDDL Data Views: RDF expressed in XHTML and XML: http://www.w3.org/2003/g/data-view#</listitem>
-    <listitem>eRDF - http://purl.org/NET/erdf/profile</listitem>
-    <listitem>RDFa</listitem>
-    <listitem>hCard - http://www.w3.org/2006/03/hcard</listitem>
-    <listitem>hCalendar - http://dannyayers.com/microformats/hcalendar-profile</listitem>
-    <listitem>hReview - http://dannyayers.com/micromodels/profiles/hreview</listitem>
-    <listitem>relLicense - CC license: http://web.resource.org/cc/schema.rdf</listitem>
-    <listitem>Dublin Core (DCMI) - http://purl.org/dc/elements/1.1/</listitem>
-    <listitem>geoURL - http://www.w3.org/2003/01/geo/wgs84_pos#</listitem>
-    <listitem>Google Base - OpenLink Virtuoso specific mapping</listitem>
-    <listitem>Ning Metadata </listitem>
-  </itemizedlist>
+  <listitem>Use the Facet Browser Search and Find User Interface to search for information on "CNET"
+    <figure id="fctinst5" float="1">
+      <title>Facet Browser Search</title>
+      <graphic fileref="ui/fctinst5.png"/>
+    </figure>
 </listitem>
-<listitem>Feeds extraction
-  <itemizedlist>
-    <listitem>RSS/RDF - SIOC & AtomOWL</listitem>
-    <listitem>RSS 1.0 - RSS/RDF, SIOC & AtomOWL</listitem>
-    <listitem>Atom 1.0 - RSS/RDF, SIOC & AtomOWL</listitem>
-  </itemizedlist>
+  <listitem>Results of the following form should be returned for the data sponged.
+    <figure id="fctinst6" float="1">
+      <title>Facet Browser Search Results</title>
+      <graphic fileref="ui/fctinst6.png"/>
+    </figure>
 </listitem>
-<listitem>xHTML metadata transformation using FOAF (foaf:Document) and Dublin Core
-properties (dc:title, dc:subject etc.)</listitem>
-</itemizedlist>
-<para>The HTML page mapper will look for RDF data in order as listed above, it will try to extract
-metadata on each step and will return positive flag if any of the above step give a RDF data. In
-case where page URL matches some of other RDF mappers listed in registry it will return 0 so
-next mapper to extract more data. In order to function properly, this mapper must be executed
-before any other specific mappers.</para>
-<para><emphasis>Flickr URLs</emphasis></para>
-<para>This mapper extracts metadata of the Flickr images, using Flickr REST API. To function
-properly it must have configured key. The Flickr mapper extracts metadata using: CC license,
-Dublin Core, Dublin Core Metadata Terms, GeoURL, FOAF, EXIF: http://www.w3.org/2003/12/exif/ns/ ontology.
-</para>
-<para><emphasis>Amazon URLs</emphasis></para>
-<para>This mapper extracts metadata for Amazon articles, using Amazon REST API. It needs a Amazon
-API key in order to be functional.</para>
-<para><emphasis>eBay URLs</emphasis></para>
-<para>Implements eBay REST API for extracting metadata of eBay articles, it needs a key and user
-name to be configured in order to work.</para>
-<para><emphasis>Open Office (OO) documents</emphasis></para>
-<para>The OO documents contains metadata which can be extracted using UNZIP, so this extractor
-needs Virtuoso unzip plugin to be configured on the server.</para>
-<para><emphasis>Yahoo traffic data URLs</emphasis></para>
-<para>Implements transformation of the result of Yahoo traffic data to RDF.
-</para>
-<para><emphasis>iCal files</emphasis></para>
-<para>Transform iCal files to RDF as per http://www.w3.org/2002/12/cal/ical# .</para>
-<para><emphasis>Binary content, PDF, PowerPoint</emphasis></para>
-<para>The unknown binary content, PDF and MS PowerPoint files can be transformed to RDF using
-Aperture framework (http://aperture.sourceforge.net/). This mapper needs Virtuoso with Java hosting
-support, Aperture framework and MetaExtractor.class installed on the host system in order to work.</para>
-<para>The Aperture framework & MetaExtractor.class must be installed on the system before to
-install the RDF mappers package. If the package is already installed, then to activate this mapper
-you can just re-install the VAD.</para>
-<para><emphasis>Setting-up Virtuoso with Java hosting to run Aperture framework</emphasis></para>
-<itemizedlist>
-<listitem>Install a Virtuoso binary which includes built-in Java hosting support (The executable name will
-indicate whether the required hosting support is built in - a suitably enabled executable will include
-javavm in the name, for example virtuoso-javavm-t, rather than virtuoso-t).</listitem>
-<listitem>Download the Aperture framework from http://aperture.sourceforge.net.</listitem>
-<listitem>Unpack the contents of the framework's lib directory into an 'aperture' subdirectory of the
-Virtuoso working directory, i.e. of the directory containing the database and virtuoso.ini files.</listitem>
-<listitem>Ensure the Virtuoso working directory includes a 'lib' subdirectory containing the file
-MetaExtractor.class. (At the current time MetaExtractor.class in not included in the rdf_mappers VAD.
-Please contact OpenLink Technical Support to obtain a copy.)</listitem>
-<listitem>In the [Parameters] section of the virtuoso.ini configuration file:
-<itemizedlist>
-  <listitem>Add the line (linebreaks have been inserted for clarity):
+  <listitem>Click "Types" link shown at the right vertical Navigation</listitem>
+  <listitem>Results of the classes/properties should be returned:
+    <figure id="fctinst7" float="1">
+      <title>Results of the classes/properties</title>
+      <graphic fileref="ui/fctinst7.png"/>
+    </figure>
+</listitem>
+  <listitem>To exclude a type unhatch the checkbox associated with the type:
+    <figure id="fctinst8" float="1">
+      <title>Exclude Type(s)</title>
+      <graphic fileref="ui/fctinst8.png"/>
+    </figure>
+</listitem>
+  <listitem>Click the Type URI link</listitem>
+  <listitem>Results of excluding the Type(s) should be shown:
+    <figure id="fctinst9" float="1">
+      <title>Results of Excluded Type(s)</title>
+      <graphic fileref="ui/fctinst9.png"/>
+    </figure>
+</listitem>
+  <listitem>The Facet Browser Web service endpoint can also be queried to obtain the same results:
 <programlisting><![CDATA[
-JavaClasspath = lib:aperture/DFKIUtils2.jar:aperture/JempBox-0.2.0.jar:aperture/activation-1.0.2-upd2.jar:aperture/aduna-commons-xml-2.0.jar:
-aperture/ant-compression-utils-1.7.1.jar:aperture/aperture-1.2.0.jar:aperture/aperture-examples-1.2.0.jar:aperture/aperture-test-1.2.0.jar:
-aperture/applewrapper-0.2.jar:aperture/bcmail-jdk14-132.jar:aperture/bcprov-jdk14-132.jar:aperture/commons-codec-1.3.jar:aperture/commons-httpclient-3.1.jar:
-aperture/commons-lang-2.3.jar:aperture/demork-2.1.jar:aperture/flickrapi-1.0.jar:aperture/fontbox-0.2.0-dev.jar:aperture/htmlparser-1.6.jar:
-aperture/ical4j-1.0-beta4.jar:aperture/infsail-0.1.jar:aperture/jacob-1.10.jar:aperture/jai_codec-1.1.3.jar:aperture/jai_core-1.1.3.jar:aperture/jaudiotagger-1.0.8.jar:
-aperture/jcl104-over-slf4j-1.5.0.jar:aperture/jpim-0.1-aperture-1.jar:aperture/junit-3.8.1.jar:aperture/jutf7-0.9.0.jar:aperture/mail-1.4.jar:
-aperture/metadata-extractor-2.4.0-beta-1.jar:aperture/mstor-0.9.11.jar:aperture/nrlvalidator-0.1.jar:aperture/openrdf-sesame-2.2.1-onejar-osgi.jar:
-aperture/osgi.core-4.0.jar:aperture/pdfbox-0.7.4-dev-20071030.jar:aperture/poi-3.0.2-FINAL-20080204.jar:aperture/poi-scratchpad-3.0.2-FINAL-20080204.jar:
-aperture/rdf2go.api-4.6.2.jar:aperture/rdf2go.impl.base-4.6.2.jar:aperture/rdf2go.impl.sesame20-4.6.2.jar:aperture/rdf2go.impl.util-4.6.2.jar:
-aperture/slf4j-api-1.5.0.jar:aperture/slf4j-jdk14-1.5.0.jar:aperture/unionsail-0.1.jar:aperture/winlaf-0.5.1.jar
+$ more cnet.xml
+<?xml version="1.0"?>
+<query xmlns="http://openlinksw.com/services/facets/1.0" inference="" same-as="">
+  <text>CNET</text>
+  <view type="text" limit="20" offset=""/>
+</query>
+
+$ curl -H "Content-Type: text/xml" -d @cnet.xml  http://cname/fct/service
+<fct:facets xmlns:fct="http://openlinksw.com/services/facets/1.0/">
+<fct:sparql>    SELECT ?s1 as ?c1, (bif:search_excerpt (bif:vector ('CNET'), ?o1)) as ?c2, ?sc, ?rank WHERE {{{ SELECT ?s1, (?sc * 3e-1) as ?sc, ?o1, (sql:rnk_scale (<LONG::IRI_RANK> (?s1))) as ?rank  WHERE { ?s1 ?s1textp ?o1 . ?o1 bif:contains  '"CNET"'  option (score ?sc)  . } ORDER BY DESC (?sc * 3e-1 + sql:rnk_scale (<LONG::IRI_RANK> (?s1)))  LIMIT 20  OFFSET 0 }}}</fct:sparql>
+<fct:time>16</fct:time>
+<fct:complete>yes</fct:complete>
+<fct:timeout>0</fct:timeout>
+<fct:db-activity>   131R rnd     36R seq      0P disk      0B /      0 messages</fct:db-activity>
+ <fct:result type="text">
+  <fct:row>
+    <fct:column datatype="trank">4.5</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.com">http://news.com</fct:column>
+    <fct:column>Technology News - CNET News</fct:column>
+    <fct:column><span class="srch_xerpt"><b>CNET</b> News.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">4.5</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.cnet.com/2547-1_3-0-20.xml">http://news.cnet.com/2547-1_3-0-20.xml</fct:column>
+    <fct:column>CNET News.com</fct:column>
+    <fct:column><span class="srch_xerpt"><b>CNET</b> News.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">4.5</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.cnet.com">http://news.cnet.com</fct:column>
+    <fct:column>Technology News - CNET News</fct:column>
+    <fct:column><span class="srch_xerpt"><b>CNET</b> News.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">3.9</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.com">http://news.com</fct:column>
+    <fct:column>Technology News - CNET News</fct:column>
+    <fct:column><span class="srch_xerpt">Technology News <b>CNET</b> News.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">3.9</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.cnet.com">http://news.cnet.com</fct:column>
+    <fct:column>Technology News - CNET News</fct:column>
+    <fct:column><span class="srch_xerpt">Technology News <b>CNET</b> News.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">3</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.com">http://news.com</fct:column>
+    <fct:column>Technology News - CNET News</fct:column>
+    <fct:column><span class="srch_xerpt">Tech news and business reports by <b>CNET</b> News.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">3</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.cnet.com/2547-1_3-0-20.xml">http://news.cnet.com/2547-1_3-0-20.xml</fct:column>
+    <fct:column>CNET News.com</fct:column>
+    <fct:column><span class="srch_xerpt">Tech news and business reports by <b>CNET</b> News.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">3</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.cnet.com">http://news.cnet.com</fct:column>
+    <fct:column>Technology News - CNET News</fct:column>
+    <fct:column><span class="srch_xerpt">Tech news and business reports by <b>CNET</b> News.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">3</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.com#6">http://news.com#6</fct:column>
+    <fct:column>There's an electric car in your future</fct:column>
+    <fct:column><span class="srch_xerpt">... <b>CNET</b> Car Tech posts photos of electric cars expected to come out by 2011.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">3</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.cnet.com/2547-1_3-0-20.xml#9">http://news.cnet.com/2547-1_3-0-20.xml#9</fct:column>
+    <fct:column>There's an electric car in your future</fct:column>
+    <fct:column><span class="srch_xerpt">... <b>CNET</b> Car Tech posts photos of electric cars expected to come out by 2011.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">3</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.cnet.com#9">http://news.cnet.com#9</fct:column>
+    <fct:column>There's an electric car in your future</fct:column>
+    <fct:column><span class="srch_xerpt">... <b>CNET</b> Car Tech posts photos of electric cars expected to come out by 2011.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">3</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.com#6">http://news.com#6</fct:column>
+    <fct:column>There's an electric car in your future</fct:column>
+    <fct:column><span class="srch_xerpt">... <b>CNET</b> Car Tech posts photos of electric cars expected to come out by 2011.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">3</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.cnet.com/2547-1_3-0-20.xml#9">http://news.cnet.com/2547-1_3-0-20.xml#9</fct:column>
+    <fct:column>There's an electric car in your future</fct:column>
+    <fct:column><span class="srch_xerpt">... <b>CNET</b> Car Tech posts photos of electric cars expected to come out by 2011.</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="trank">3</fct:column>
+    <fct:column datatype="erank">5.881291583872905e-014</fct:column>
+    <fct:column datatype="url" shortform="http://news.cnet.com#9">http://news.cnet.com#9</fct:column>
+    <fct:column>There's an electric car in your future</fct:column>
+    <fct:column><span class="srch_xerpt">... <b>CNET</b> Car Tech posts photos of electric cars expected to come out by 2011.</span></fct:column>
+  </fct:row>
+ </fct:result>
+</fct:facets>
 ]]></programlisting>
 </listitem>
-  <listitem>Ensure DirsAllowed includes directories /tmp, (or the temporary directory for the host
-operating system), lib and aperture.</listitem>
-</itemizedlist>
+  <listitem>In the <emphasis>Label</emphasis> text box of the <emphasis>URI Lookup (by Label)</emphasis>
+tab enter the name of a rdfs label to be <emphasis>Describe</emphasis>'d:
+    <figure id="fctinst10" float="1">
+      <title>Query Facet Browser Web service endpoint</title>
+      <graphic fileref="ui/fctinst10.png"/>
+    </figure>
 </listitem>
-<listitem>Start the Virtuoso server with java hosting support</listitem>
-<listitem>Configure the cartridge either by installing the rdf_mappers VAD or, if the VAD is already
-installed, by executing procedure DB.DBA.RDF_APERTURE_INIT.</listitem>
-<listitem>During the VAD installation process, RDF_APERTURE_INIT() configures the Aperture cartridge. If
-you look in the list of available cartridges under the RDF > Sponger tab in Conductor, you should see
-an entry for 'Binary Files'.</listitem>
-</itemizedlist>
-<para>To check the cartridge has been configured, connect with Virtuoso's ISQL tool:</para>
-<itemizedlist>
-<listitem>Issue the command:
-<programlisting><![CDATA[
-SQL> SELECT udt_is_available('APERTURE.DBA.MetaExtractor');
-]]></programlisting>
+  <listitem>Select a URI from the list of available Labels to obtain a description of the URI:
+    <figure id="fctinst11" float="1">
+      <title>Select a URI from the list of available Labels</title>
+      <graphic fileref="ui/fctinst11.png"/>
+    </figure>
 </listitem>
-<listitem>Copy a test PDF document to the Virtuoso working directory, then execute:
-<programlisting><![CDATA[
-SQL> SELECT APERTURE.DBA."MetaExtractor"().getMetaFromFile ('some_pdf_in_server_working_dir.pdf', 0);
-
-... some RDF data should be returned ...
-]]></programlisting>
+  <listitem>In the <emphasis>URI</emphasis> text box of the <emphasis>URI Lookup</emphasis> tab enter
+the name URI to be <emphasis>Describe</emphasis>'d:
+    <figure id="fctinst12" float="1">
+      <title>Enter URI</title>
+      <graphic fileref="ui/fctinst12.png"/>
+    </figure>
 </listitem>
-</itemizedlist>
-<para>You should now be able to sponge all document types supported by the Aperture framework, (using
-one of the standard Sponger invocation mechanisms, for instance with a URL of the form
-http://localhost:8890/about/rdf/http://targethost/targetfile.pdf), subject to the MIME type pattern
-filters configured for the cartridge in the Conductor UI. By default the Aperture cartridge is
-registered to match MIME types (application/octet-stream)|(application/pdf)|(application/mspowerpoint).
-To sponge all the MIME types Aperture is capable of handling, changed the MIME type pattern to
-'application/.*'.</para>
-<para>Important: The installation guidelines presented above have been verified on Mac OS X with
-Aperture 1.2.0. Some adjustment may be needed for different operating systems or versions of Aperture.</para>
-<para><emphasis>Examples & tutorials</emphasis></para>
-<para>How to write own RDF mapper? Look at Virtuoso tutorial on this subject
-http://demo.openlinksw.com/tutorial/rdf/rd_s_1/rd_s_1.vsp .
-</para>
-</sect5>
-      </sect4>
-      </sect3>
-      <sect3 id="virtuosospongercreatecustcartrxslt">
-      <title>Meta-Cartridges</title>
-        <para>So far the discussion has centered on 'primary' cartridges. However,
-Virtuoso supports an alternative type of cartridge, a 'meta-cartridge'. The way a
-meta-cartridge operates is essentially the same as a primary cartridge, that is it
-has a cartridge hook function with the same signature and its inserts data into the
-quad store through entity extraction and ontology mapping as before. Where meta-cartridges
-differ from primary cartridges is in their intent and their position in the cartridge
-invocation pipeline.</para>
-        <para>The purpose of meta-cartridges is to enrich graphs produced by other (primary)
-cartridges. They serve as general post-processors to add additional information about selected
-entities in an RDF graph. For instance, a particular meta-cartridge might be designed to search
-for entities of type 'umbel:Country' in a given graph, and then add additional statements about
-each country it finds, where the information contained in these statements is retrieved from the
-web service targeted by the meta-cartridge. One such example might be a 'World Bank' meta-cartridge
-which adds information relating to a country's GDP, its exports of goods and services as a percentage
-of GDP etc; retrieved using the <ulink url="http://developer.worldbank.org/docs/">World Bank web service API</ulink>.
-In order to benefit from the World Bank meta-cartridge, any primary cartridge which might generate instance data relating to countries should
-ensure that each country instance it handles is also described as being of rdf:type 'umbel:Country'.
-Here, the <ulink url="http://wiki.umbel.org/index.php/Welcome">UMBEL</ulink> (Upper Mapping and Binding Exchange Layer) ontology is used as a data-source-agnostic
-classification system. It provides a core set of 20,000+ subject concepts which act as "a fixed set of
-reference points in a global knowledge space". The use of UMBEL in this way serves to decouple
-meta-cartridges from primary cartridges and data source specific ontologies.</para>
-        <para>Virtuoso includes two default meta-cartridges which use
-UMBEL and <ulink url="http://www.opencalais.com/">OpenCalais</ulink> to augment source graphs.</para>
-        <para><emphasis>Registration</emphasis></para>
-        <para>Meta-cartridges must be registered in the RDF_META_CARTRIDGES table, which fulfills a role
-similar to the SYS_RDF_MAPPERS table used by primary cartridges. The structure of the table, and the
-meaning and use of its columns, are similar to SYS_RDF_MAPPERS. The meta-cartridge hook function
-signature is identical to that for primary cartridges.</para>
-        <para>The RDF_META_CARTRIDGES table definition is as follows:</para>
-<programlisting><![CDATA[
-create table DB.DBA.RDF_META_CARTRIDGES (
-MC_ID INTEGER IDENTITY,		-- meta-cartridge ID. Determines the order of the
-                           	   meta-cartridge's invocation in the Sponger
-                                 processing chain
-MC_SEQ INTEGER IDENTITY,
-MC_HOOK VARCHAR,			-- fully qualified Virtuoso/PL function name
-MC_TYPE VARCHAR,
-MC_PATTERN VARCHAR, 		-- a REGEX pattern to match resource URL or
-					   MIME type
-MC_KEY VARCHAR,			-- API specific key to use
-MC_OPTIONS ANY,			-- meta-cartridge specific options
-MC_DESC LONG VARCHAR, 		-- meta-cartridge description (free text)
-MC_ENABLED INTEGER		-- a 0 or 1 integer flag to exclude or include
-					   meta-cartridge from Sponger processing chain
-    );
-]]></programlisting>
-        <para>(At the time of writing there is no Conductor UI for registering meta-cartridges, they must be
-registered using SQL. A Conductor interface for this task will be added in due course.)</para>
-       <para><emphasis>Invocation</emphasis></para>
-        <para>Meta-cartridges are invoked through the post-processing hook procedure RDF_LOAD_POST_PROCESS
-which is called, for every document retrieved, after RDF_LOAD_RDFXML loads sponged data into the quad
-store.</para>
-        <para>Cartridges in the meta-cartridge registry (RDF_META_CARTRIDGES) are configured to match a given
-MIME type or URI pattern. Matching meta-cartridges are invoked in order of their MC_SEQ value. Ordinarily
-a meta-cartridge should return 0, in which case the next meta-cartridge in the post-processing chain will
-be invoked. If it returns 1 or -1, the post-processing stops and no further meta-cartridges are invoked.</para>
-        <para>The order of processing by the Sponger cartridge pipeline is thus:</para>
-        <orderedlist>
-          <listitem>Try to get RDF in the form of TTL or RDF/XML. If RDF is retrieved if go to step 3</listitem>
-          <listitem>Try generating RDF through the Sponger primary cartridges as before</listitem>
-          <listitem>Post-process the RDF using meta-cartridges in order of their MC_SEQ value. If a meta-cartridge returns 1 or -1, stop the post-processing chain.</listitem>
-        </orderedlist>
-        <para>Notice that meta-cartridges may be invoked even if primary cartridges are not.</para>
-      <sect4 id="virtuosospongercreatecustcartrexfm">
-        <title>Example - A Campaign Finance Meta-Cartridge for Freebase</title>
-        <para><emphasis>Note</emphasis></para>
-        <para>The example which follows builds on a Freebase Sponger cartridge developed prior to the announcement of Freebase's
-support for generating Linked Data through the endpoint http://rdf.freebase.com/ . The OpenLink cartridge
-has since evolved to reflect these changes. A snapshot of the Freebase cartridge and stylesheet compatible
-with this example can be found in Appendix C.</para>
-        <para><ulink url="http://www.freebase.com/">Freebase</ulink> is an open community database of the world's information which serves facts
-and statistics rather than articles. Its designers see this difference in emphasis from article-oriented
-databases as beneficial for developers wanting to use Freebase facts in other websites and applications.</para>
-        <para>Virtuoso includes a Freebase cartridge in the rdf_mappers VAD. The aim of the example cartridge presented here is to provide a lightweight
-meta-cartridge that is used to conditionally add triples to graphs generated by the Freebase cartridge,
-if Freebase is describing a U.S. senator.</para>
-        <para><emphasis>New York Times Campaign Finance (NYTCF) API</emphasis></para>
-        <para>The <ulink url="http://developer.nytimes.com/docs/campaign_finance_api?authChecked=1">New York Times Campaign Finance (NYTCF) API</ulink> allows you to retrieve contribution and
-expenditure data based on United States Federal Election Commission filings. You can retrieve totals
-for a particular presidential candidate, see aggregates by ZIP code or state, or get details on a
-particular donor.</para>
-        <para>The API supports a number of query types. To keep this example from being overly long,
-the meta-cartridge supports just one of these - a query for the candidate details. An example query
-and the resulting output follow:</para>
-        <para><emphasis>Query:</emphasis></para>
-<programlisting><![CDATA[
-http://api.nytimes.com/svc/elections/us/v2/president/2008/finances/candidates/obama,barack.xml?api-key=xxxx
-]]></programlisting>
-        <para>Result:</para>
-<programlisting><![CDATA[
-<result_set>
- <status>OK</status>
- <copyright>
-  Copyright (c) 2008 The New York Times Company. All Rights Reserved.
- </copyright>
- <results>
-  <candidate>
-    <candidate_name>Obama, Barack</candidate_name>
-    <committee_id>C00431445</committee_id>
-    <party>D</party>
-    <total_receipts>468841844</total_receipts>
-    <total_disbursements>391437723.5</total_disbursements>
-    <cash_on_hand>77404120</cash_on_hand>
-    <net_individual_contributions>426902994</net_individual_contributions>
-    <net_party_contributions>150</net_party_contributions>
-    <net_pac_contributions>450</net_pac_contributions>
-    <net_candidate_contributions>0</net_candidate_contributions>
-    <federal_funds>0</federal_funds>
-    <total_contributions_less_than_200>222694981.5</total_contributions_less_than_200>
-    <total_contributions_2300>76623262</total_contributions_2300>
-    <net_primary_contributions>46444638.81</net_primary_contributions>
-    <net_general_contributions>30959481.19</net_general_contributions>
-    <total_refunds>2058240.92</total_refunds>
-    <date_coverage_from>2007-01-01</date_coverage_from>
-    <date_coverage_to>2008-08-31</date_coverage_to>
-  </candidate>
- </results>
-</result_set>
-]]></programlisting>
-        <para><emphasis>Sponging Freebase</emphasis></para>
-        <para><emphasis>Using OpenLink Data Explorer</emphasis></para>
-        <para>The following instructions assume you have the <ulink url="http://ode.openlinksw.com/">OpenLink Data Explorer (ODE)</ulink> browser extension installed in your browser.</para>
-        <para>An HTML description of Barack Obama can be obtained directly from Freebase by pasting the
- following URL into your browser: http://www.freebase.com/view/en/barack_obama</para>
-        <para>To view RDF data sponged from this page, select 'Linked Data Sources' from the browser's
-'View' menu. An OpenLink Data Explorer interface will load in a new tab.</para>
-        <para>Clicking on the 'Barack Obama' link under the 'Person' category displayed by ODE sponges
-RDF data using the Freebase cartridge. Click the 'down arrow' adjacent to the 'Barack Obama' link to
-explore the retrieved data.</para>
-        <para>Assuming your Virtuoso instance is running on port 8890 on localhost, the list of data caches displayed
-by ODE should include: http://localhost:8890/about/html/http/www.freebase.com/view/en/barack_obama#this</para>
-        <para>The information displayed in the rest of the page relates to the entity instance identified by this URI. The prefix http://localhost:8890/about/html/http/ prepended to the
-original URI indicates that the Sponger Proxy Service has been invoked. The Sponger creates an associated
-entity instance (identified by the above URI with the #this suffix) which holds sponged information
-about the original entity.</para>
-        <para><emphasis>Using the Command Line</emphasis></para>
-        <para>As an alternative to ODE, you can sponge from the command line with the command:</para>
+  <listitem>Select a URI from the list of available Labels to obtain a description of the URI:
+    <figure id="fctinst13" float="1">
+      <title>Obtain a description of the URI</title>
+      <graphic fileref="ui/fctinst13.png"/>
+    </figure>
+</listitem>
+  <listitem>If data is loaded into the quad store via DML functions (TTLP, RDF_LOAD_RDFXML etc.) the
+following procedure needs to run from <emphasis>isql</emphasis> to build the free text indexes required each time:
 <programlisting><![CDATA[
-curl -H "Accept: text/xml" "http://localhost:8890/about/html/http/www.freebase.com/view/en/barack_obama"
+VT_INC_INDEX_DB_DBA_RDF_OBJ ()
 ]]></programlisting>
-        <para>To view the results, you can use Conductor's browser-based SPARQL interface (e.g.
-http://localhost:8890/sparql) to query the resulting graph generated by the Sponger,
-http://www.freebase.com/view/en/barack_obama.</para>
-        <para><emphasis>Installing the Meta-Cartridge</emphasis></para>
-        <para>To register the meta-cartridge, a procedure similar to the following can be used:</para>
+</listitem>
+        </orderedlist>
+</sect2>
+<sect2 id="virtuosospongerfaceusagest">
+<title>Usage Statistics</title>
+<orderedlist>
+   <listitem>Use the Faceted Browser Search and Find User Interface to search for information on "Michael Jackson":
+     <figure id="VirtFacetUsage1" float="1">
+       <title>Usage Statistics</title>
+       <graphic fileref="ui/VirtFacetUsage1.png"/>
+     </figure>
+   </listitem>
+   <listitem>Results of the following form should be returned for the data sponged:
+     <figure id="VirtFacetUsage2" float="1">
+       <title>Usage Statistics</title>
+       <graphic fileref="ui/VirtFacetUsage2.png"/>
+     </figure>
+   </listitem>
+   <listitem>Click the "Types" link under "Navigation"
+   </listitem>
+   <listitem>Results about "Michael Jackson" as Type/Label/Count list should be returned.
+   </listitem>
+   <listitem>Click a type link, for ex.:
 <programlisting><![CDATA[
-create procedure INSTALL_RDF_LOAD_NYTCF ()
-{
-  -- delete any previous NYTCF cartridge installed as a primary cartridge
-  DELETE FROM SYS_RDF_MAPPERS WHERE RM_HOOK = 'DB.DBA.RDF_LOAD_NYTCF';
-  -- register in the meta-cartridge post-processing chain
-  INSERT SOFT DB.DBA.RDF_META_CARTRIDGES (MC_PATTERN, MC_TYPE, MC_HOOK,
-    MC_KEY, MC_DESC, MC_OPTIONS)
-    VALUES (
-    'http://www.freebase.com/view/.*',
-    'URL', 'DB.DBA.RDF_LOAD_NYTCF', '2c1d95a62e5fxxxxx', 'Freebase NYTCF',
-    vector ());
-};
+dbpedia-owl:Artist
 ]]></programlisting>
-        <para>Looking at the list of cartridges in Conductor's 'RDF Cartridges' screen, you will
-see that the Freebase cartridge is configured by default to sponge URIs which match the pattern
-"http://www.freebase.com/view/.*" The meta-cartridge is configured to match on the same URI pattern.</para>
-        <para>To use the Campaign Finance API, you must register and request an API key. The script
-above shows an invalid key. Replace it with your own key before executing the procedure.</para>
-        <para><emphasis>NYTCF Meta-Cartridge Functions</emphasis></para>
-        <para>The meta-cartridge function definitions are listed below. They can be executed by
-pasting them into Conductor's iSQL interface.</para>
+     <figure id="VirtFacetUsage8" float="1">
+       <title>Usage Statistics</title>
+       <graphic fileref="ui/VirtFacetUsage8.png"/>
+     </figure>
+   </listitem>
+   <listitem>Should be shown type results and:
 <programlisting><![CDATA[
--- New York Times: Campaign Finance Web Service
--- See http://developer.nytimes.com/docs/campaign_finance_api
-
--- DB.DBA.RDF_NYTCF_LOOKUP is in effect a lightweight lookup cartridge that is used
--- to conditionally add triples to graphs generated by the Wikipedia and
--- Freebase cartridges. These cartridges call on RDF_NYTCF_LOOKUP when
--- handling an entity of rdf:type yago:Congressman109955781. The NYTCF lookup
--- cartridge (aka a metacartridge) is used to return campaign finance data
--- for the candidate in question retrieved from the New York Times Campaign
--- Finance web service.
-create procedure DB.DBA.RDF_NYTCF_LOOKUP(
-  in candidate_id any, 		-- id of candidate
-  in graph_iri varchar,		-- graph into which the additional campaign finance triples should be loaded
-  in api_key varchar		-- NYT finance API key
-)
-{
-  declare version, campaign_type, year any;
-  declare nyt_url, hdr, tmp any;
-  declare xt, xd any;
-
-  -- Common parameters - The NYT API only supports the following values at present:
-  version := 'v2';
-  campaign_type := 'president';
-  year := '2008';
-
-  -- Candidate summaries
-  -- nyt_url := sprintf('http://api.nytimes.com/svc/elections/us/%s/%s/%s/finances/totals.xml?api-key=%s',
-  --	version, campaign_type, year, api_key);
-
-  -- Candidate details
-  nyt_url := sprintf('http://api.nytimes.com/svc/elections/us/%s/%s/%s/finances/candidates/%s.xml?api-key=%s',
-  	version, campaign_type, year, candidate_id, api_key);
-
-  tmp := http_client_ext (nyt_url, headers=>hdr, proxy=>connection_get ('sparql-get:proxy'));
-  if (hdr[0] not like 'HTTP/1._ 200 %')
-    signal ('22023', trim(hdr[0], '\r\n'), 'DB.DBA.RDF_LOAD_NYTCF_LOOKUP');
-  xd := xtree_doc (tmp);
-
-  -- baseUri specifies what the generated RDF description is about
-  -- <rdf:Description rdf:about="{baseUri}">
-  -- Example baseUri's:
-  -- http://localhost:8890/about/rdf/http://www.freebase.com/view/en/barack_obama#this
-  -- http://localhost:8890/about/rdf/http://www.freebase.com/view/en/hillary_rodham_clinton#this
-  declare path any;
-  declare lang, k, base_uri varchar;
-
-  if (graph_iri like 'http://rdf.freebase.com/ns/%.%')
-    base_uri := graph_iri;
-  else
-    {
-      path := split_and_decode (graph_iri, 0, '%\0/');
-      k := path [length(path) - 1];
-      lang := path [length(path) - 2];
-
-      base_uri := sprintf ('http://rdf.freebase.com/ns/%U.%U', lang, k);
-    }
-
-  xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/nytcf2rdf.xsl', xd,
-      	vector ('baseUri', base_uri));
-  xd := serialize_to_UTF8_xml (xt);
-  DB.DBA.RDF_LOAD_RDFXML (xd, '', graph_iri);
-}
-;
-
-create procedure DB.DBA.RDF_MQL_RESOURCE_IS_SENATOR (
-  in fb_graph_uri varchar	-- URI of graph containing Freebase resource
-)
-{
-  -- Check if the resource described by Freebase is a U.S. senator. Only then does it make sense to query for campaign finance
-  -- data from the NYT data space.
-  --
-  -- To test for senators, we start by looking for two statements in the Freebase cartridge output, similar to:
-  --
-  -- <rdf:Description rdf:about="http://localhost:8890/about/rdf/http://www.freebase.com/view/en/hillary_rodham_clinton#this">
-  --   <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
-  --   <rdfs:seeAlso rdf:resource="http://en.wikipedia.org/wiki/Hillary_Rodham_Clinton"/>
-  --   ...
-  -- where the graph generated by the Sponger will be <http://www.freebase.com/view/en/hillary_rodham_clinton>
-  --
-  -- To test whether a resource is a senator:
-  -- 1) Check whether the Freebase resource is of rdf:type foaf:Person
-  -- 2) Extract the person_name from the Wikipedia URI referenced by rdfs:seeAlso
-  -- 3) Use the extracted person_name to build a URI to DBpedia's description of the person.
-  -- 4) Query the DBpedia description to see if the person is of rdf:type yago:Senator110578471
-  declare xp, xt, tmp any;
-  declare qry varchar;			-- SPARQL query
-  declare qry_uri varchar;		-- query URI
-  declare qry_res varchar;		-- query result
-  declare dbp_resource_name varchar;	-- Equivalent resource name in DBpedia
-  declare fb_resource_uri varchar; 	-- Freebase resource URI
-  declare path any;
-  declare lang, k varchar;
-
-  declare exit handler for sqlstate '*' {
-    return 0;
-  };
-
-  if (fb_graph_uri like 'http://rdf.freebase.com/ns/%.%')
-    fb_resource_uri := fb_graph_uri;
-  else
-    {
-      path := split_and_decode (fb_graph_uri, 0, '%\0/');
-      if (length (path) < 2)
-	return 0;
-
-      k := path [length(path) - 1];
-      lang := path [length(path) - 2];
-
-      fb_resource_uri := sprintf ('http://rdf.freebase.com/ns/%U.%U', lang, k);
-    }
-
-  -- 1) Check whether the Freebase resource is a politician from united_states
-        {
-    declare stat, msg varchar;
-    declare mdata, rset any;
-
-    qry := sprintf ('sparql ask from <%s> where { <%s> <http://rdf.freebase.com/ns/people.person.profession> <http://rdf.freebase.com/ns/en.politician> ; <http://rdf.freebase.com/ns/people.person.nationality> <http://rdf.freebase.com/ns/en.united_states> . }', fb_graph_uri, fb_resource_uri);
-    exec (qry, stat, msg, vector(), 1, mdata, rset);
-    if (length(rset) = 0 or rset[0][0] <> 1)
-      return 0;
-  }
-
-  return 1;
-}
-;
-
-create procedure DB.DBA.RDF_LOAD_NYTCF_META (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
-    inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
-{
-  declare candidate_id, candidate_name any;
-  declare api_key any;
-  declare indx, tmp any;
-  declare ord int;
-
-  declare exit handler for sqlstate '*'
-  {
-    return 0;
-  };
-
-  if (not DB.DBA.RDF_MQL_RESOURCE_IS_SENATOR (new_origin_uri))
-    return 0;
-
-  -- TO DO: hardcoded for now
-  -- Need a mechanism to specify API key for meta-cartridges
-  -- Could retrieve from virtuoso.ini?
-  api_key := _key;
-
-  -- NYT API supports a candidate_id in one of two forms:
-  -- candidate_id ::= {candidate_ID} | {last_name [,first_name]}
-  -- first_name is optional. If included, there should be no space after the comma.
-  --
-  -- However, because this meta cartridge supplies additional triples for the
-  -- Wikipedia or Freebase cartridges, only the second form of candidate_id is
-  -- supported. i.e. We extract the candidate name, rather than a numeric
-  -- candidate_ID (FEC committee ID) from the Wikipedia or Freebase URL.
-  --
-  -- It's assumed that the source URI includes the candidate's first name.
-  -- If it is omitted, the NYT API will return information about *all* candidates
-  -- with that last name - something we don't want.
+Displaying types of e1 where:
+e1 has any property whose value contains "Michael Jackson".
 
-  indx := strstr(graph_iri, 'www.freebase.com/view/en/');
-  if (indx is not null)
-  {
-    -- extract candidate_id from Freebase URI
-    tmp := sprintf_inverse(subseq(graph_iri, indx), 'www.freebase.com/view/en/%s', 0);
-    if (length(tmp) <> 1)
-      return 0;
-    candidate_name := tmp[0];
-  }
-  else
-  {
-    indx := strstr(graph_iri, 'wikipedia.org/wiki/');
-    if (indx is not null)
-    {
-      -- extract candidate_id from Wikipedia URI
-      tmp := sprintf_inverse(subseq(graph_iri, indx), 'wikipedia.org/%s', 0);
-      if (length(tmp) <> 1)
-        return 0;
-      candidate_name := tmp[0];
-    }
-    else
+e1 is a dbpedia-owl:Artist . Drop
+]]></programlisting>
+     <figure id="VirtFacetUsage9" float="1">
+       <title>Usage Statistics</title>
+       <graphic fileref="ui/VirtFacetUsage9.png"/>
+     </figure>
+   </listitem>
+   <listitem>Click the "Show values" link under "Navigation"
+   </listitem>
+   <listitem>Results should be shown for "Michael Jackson" as values and text summaries associated with pattern:
+<programlisting><![CDATA[
+Displaying values and text summaries associated with pattern e1 where:
+e1 has any property whose value contains "Michael Jackson".
+e1 is a dbpedia-owl:Artist . Drop
+]]></programlisting>
+   </listitem>
+   <listitem>Click the link:
+<programlisting><![CDATA[
+dbpedia:Michael_Jackson
+]]></programlisting>
+     <figure id="VirtFacetUsage10" float="1">
+       <title>Usage Statistics</title>
+       <graphic fileref="ui/VirtFacetUsage10.png"/>
+     </figure>
+   </listitem>
+   <listitem>Results about "Michael Jackson" as property/value list should be returned:
+     <figure id="VirtFacetUsage3" float="1">
+       <title>Usage Statistics</title>
+       <graphic fileref="ui/VirtFacetUsage3.png"/>
+     </figure>
+   </listitem>
+   <listitem>Click the "Usage Statistics" link under "Actions" shown right of the list.
+   </listitem>
+   <listitem>Results of usage statistics for "Michael Jackson" grouped in 4 tabs should be shown:
+<orderedlist>
+   <listitem>Referenced by Graphs: shows how many times the URI is found as subject in the relevant graph(s):
+<programlisting><![CDATA[
+SPARQL
+SELECT ?g count (*)
+where
       {
-	tmp := sprintf_inverse(graph_iri, 'http://%s.freebase.com/ns/%s/%s', 0);
-	if (length (tmp) <> 3)
-	  tmp := sprintf_inverse(graph_iri, 'http://%s.freebase.com/ns/%s.%s', 0);
-	if (length (tmp) <> 3)
-	  return 0;
-	candidate_name := tmp[2];
-      }
+    graph ?g { <URI> ?p ?o }
   }
-
-
-  -- split candidate_name into its component parts
-  --   candidate_name is assumed to be firstname_[middlename_]*lastname
-  --   e.g. hillary_rodham_clinton (Freebase), Hillary_clinton (Wikipedia)
-  {
-    declare i, _end, len int;
-    declare names, tmp_name varchar;
-
-    names := vector ();
-    tmp_name := candidate_name;
-    len := length (tmp_name);
-    while (1)
-    {
-      _end := strchr(tmp_name, '_');
-      if (_end is not null)
+group by ?g
+order by desc 2
+limit 20
+]]></programlisting>
+     <figure id="VirtFacetUsage4" float="1">
+       <title>Usage Statistics</title>
+       <graphic fileref="ui/VirtFacetUsage4.png"/>
+     </figure>
+   </listitem>
+   <listitem>Source Graphs:  shows how many times the URI is found as object in the relevant graph(s):
+<programlisting><![CDATA[
+SPARQL
+SELECT ?g count (*)
+where
       {
-        names := vector_concat (names, vector(subseq(tmp_name, 0, _end)));
-        tmp_name := subseq(tmp_name, _end + 1);
+    graph ?g { ?s ?p <URI>  }
       }
-      else
+group by ?g
+order by desc 2
+limit 20
+]]></programlisting>
+     <figure id="VirtFacetUsage5" float="1">
+       <title>Usage Statistics</title>
+       <graphic fileref="ui/VirtFacetUsage5.png"/>
+     </figure>
+   </listitem>
+   <listitem>Direct co-references: shows results as subject and calculated rank, based on running transitive closure over owl:sameAs of the URI in subject or object:
+<programlisting><![CDATA[
+SPARQL
+SELECT ?syn ( sql:rnk_scale (<LONG::IRI_RANK> (?syn)))
+where
       {
-        names := vector_concat(names, vector(tmp_name));
-        goto done;
-      }
+    { SELECT ?s ?syn
+      where
+       {
+         {?syn owl:sameAs ?s } union {?s owl:sameAs ?syn}
     }
-done:
-    if (length(names) < 2)
-      return 0;
-    -- candidate_id ::= lastname,firstname
-    candidate_id := sprintf('%s,%s', names[length(names)-1], names[0]);
   }
-
-  DB.DBA.RDF_NYTCF_LOOKUP(candidate_id, coalesce (dest, graph_iri), api_key);
-  return 0;
+    option (transitive, t_distinct, t_min (0), T_in (?s), t_out (?syn)) . filter (!isliteral (?syn) && ?s = <URI> )
 }
-;
+order by desc 2
+limit 20
 ]]></programlisting>
-        <para><emphasis>NYTCF Meta-Cartridge Stylesheet</emphasis></para>
-        <para>The XSLT stylesheet, nyctf2rdf.xsl, used by the meta-cartridge to transform the base
-Campaign Finance web service output to RDF is shown below. RDF_NYCTF_LOOKUP() assumes the stylesheet
-is located alongside the other stylesheets provided by the rdf_mappers VAD in the Virtuoso WebDAV
-folder DAV/VAD/rdf_mappers/xslt. You should create nyctf2rdf.xsl here from the following listing.
-The WebDAV Browser interface in Conductor provides the easiest means to upload the stylesheet.</para>
+     <figure id="VirtFacetUsage6" float="1">
+       <title>Usage Statistics</title>
+       <graphic fileref="ui/VirtFacetUsage6.png"/>
+     </figure>
+   </listitem>
+   <listitem>Indirect co-references: shows expanded results for objects concur with the URI by IFP:
+<programlisting><![CDATA[
+SPARQL
+SELECT distinct ?syn ?p ?o (sql:rnk_scale (<LONG::IRI_RANK> (?syn)))
+where
+  { <URI> ?p ?o .  filter (0 != (<LONG::bif:rdf_is_sub> ("b3sifp", ?p, lod:ifp_like, 3))) .
+    ?syn ?p ?o .
+}
+order by desc 4
+limit 20
+]]></programlisting>
+     <figure id="VirtFacetUsage7" float="1">
+       <title>Usage Statistics</title>
+       <graphic fileref="ui/VirtFacetUsage7.png"/>
+     </figure>
+   </listitem>
+</orderedlist>
+   </listitem>
+</orderedlist>
+</sect2>
+<sect2 id="virtuosospongerfacetexample"><title>Examples</title>
+<para><emphasis>Example for Use Faceted Navigation to Explore Virtuoso hosted Linked Data</emphasis></para>
+<para>The following example demonstrates a simple scenario of tracking Kingsley Idehen's conversations 
+across the Web, using the Virtuoso Faceted Browser hosted on LOD.</para>
+<orderedlist>
+   <listitem>Go to http://lod.openlinksw.com/fct/
+     <figure id="fct1" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct1.png"/>
+     </figure>
+   </listitem>
+   <listitem>Enter a free text search pattern (for example, "Kingsley Idehen"), and click Search
+     <figure id="fct2" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct2.png"/>
+     </figure>
+   </listitem>
+   <listitem>Your initial query results page will display a list of literal value snippets from property
+values associated with the query text pattern
+     <figure id="fct3" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct3.png"/>
+     </figure>
+   </listitem>
+   <listitem>Using the Navigation section on the right, click on "Types", which alters the contents
+of the query results area by presenting CURIE based hyperlinks for each of the Entity Types associated
+with Property values that contains the query text pattern
+     <figure id="fct4" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct4.png"/>
+     </figure>
+   </listitem>
+   <listitem>Click on the "foaf:Person" link to narrow the result set down to Entities of this Type,
+un-hatch the checkbox beside this link for Negation (filtering out) based on this Entity Type
+     <figure id="fct5" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct5.png"/>
+     </figure>
+   </listitem>
+   <listitem>You can filter further, by switching (pivoting) to the a Property based view, by returning
+to the Navigation section and then clicking on "Properties" or "Referencing Properties" links; in either
+case, you have further filtering of based on the combination of Properties and Entities where Entities
+in the result-set contain values matching the query text pattern
+     <figure id="fct6" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct6.png"/>
+     </figure>
+   </listitem>
+   <listitem>From the list of Property Types, click on the "foaf:interest" link to filter further,
+based on the values of this property
+     <figure id="fct7" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct7.png"/>
+     </figure>
+   </listitem>
+   <listitem>From the list of "foaf:interest" Values, click on "dbpedia:Linked_Data", which filters
+the result-set further to display reveal Entity Identifier Links (Generic HTTP URIs) and Labels for
+each "foaf:Person" associated with the property "foaf:interest", in the URIBurner data space. 
+     <figure id="fct8" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct8.png"/>
+     </figure>
+   </listitem>
+   <listitem>Click on one of the HTTP URIs in the filtered results-set to obtain a detailed structured
+description of a given Entity. Each listed Property is a Link; thus, each Property is a link to other
+structured Entity descriptions
+     <figure id="fct9" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct9.png"/>
+     </figure>
+   </listitem>
+   <listitem>Click on "Usage Statistics" link to get a summary view of this Linked Data Space,
+"Reference" and "Source" graphs are akin to saying "Table X" and "Table Y" where each table
+is the container of Records re. RDBMS or Worksheet re. Spreadsheet.:
+     <figure id="fct10" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct10.png"/>
+     </figure>
+     <figure id="fct11" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct11.png"/>
+     </figure>
+   </listitem>
+   <listitem>"Direct" and "In-Direct" co-references show other references (Identifiers) that relate
+associated with Kingsley Idehen (like saying: here are his other names or his know by this name in
+this other place)
+     <figure id="fct12" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct12.png"/>
+     </figure>
+     <figure id="fct13" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct13.png"/>
+     </figure>
+   </listitem>
+   <listitem>Click on "Settings" check "owl:sameAs" and it sets a context mode for the session
+(meaning: a set of rules to take place)
+     <figure id="fct14" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct14.png"/>
+     </figure>
+   </listitem>
+   <listitem>Go back to the "Direct Co-reference" tab
+     <figure id="fct15" float="1">
+       <title>Faceted Navigation Example</title>
+       <graphic fileref="ui/fct15.png"/>
+     </figure>
+   </listitem>
+   <listitem>As result each link will unveil a union (combination) of all the the data associated
+with all Kingsley Idehen's other Identifiers (other Names in other places), i.e., they all show the
+same data.</listitem>
+</orderedlist>
+</sect2>
+</sect1>
+<sect1 id="virtuosospongerfacent">
+<title>Virtuoso Facets Web Service</title>
+<para>The Virtuoso Facets web service is a general purpose RDF query facility for facet based browsing.
+It takes an XML description of the view desired and generates the reply as an XML tree containing the
+requested data. The user agent or a local web page can use XSLT for rendering this for the end user.
+The selection of facets and values is represented as an XML tree. The rationale for this is the fact
+that such a representation is easier to process in an application than the SPARQL source text or a
+parse tree of SPARQL and more compactly captures the specific subset of SPARQL needed for faceted
+browsing. The web service returns the SPARQL source text also, thus this can serve as a basis for
+and-crafted queries.</para>
+<para>The top element of the tree is <query>, it must be in namespace
+"http://openlinksw.com/services/facets/1.0/".</para>
+<para>This has the following attributes:</para>
+<itemizedlist mark="bullet">
+  <listitem>graph="graph_iri" - default is search in all graphs but system defaults may override this</listitem>
+  <listitem>timeout="no_of_msec" - default is no timeout, but system defaults may override this</listitem>
+  <listitem>inference="name" where name is a name of an inference context declared with rdfs_rule_set.</listitem>
+  <listitem>same-as="boolean" - If "boolean" is "yes", then owl:sameAs links will be considered in the query evaluation.</listitem>
+</itemizedlist>
+<para>The result is a tree of the form:</para>
 <programlisting><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE xsl:stylesheet [
-<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
-<!ENTITY nyt "http://www.nytimes.com/">
-]>
-<xsl:stylesheet version="1.0"
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
-    xmlns:rdf=""
-    xmlns:nyt=""
-    >
-    <xsl:output method="xml" indent="yes" />
-    <xsl:template match="/result_set/status">
-      <xsl:if test="text() = 'OK'">
-        <xsl:apply-templates mode="ok" select="/result_set/results/candidate"/>
-      </xsl:if>
-    </xsl:template>
-
-    <xsl:template match="candidate" mode="ok">
-      <rdf:Description rdf:about="{vi:proxyIRI($baseUri)}">
-	  <nyt:candidate_name><xsl:value-of select="candidate_name"/></nyt:candidate_name>
-	  <nyt:committee_id><xsl:value-of select="committee_id"/></nyt:committee_id>
-	  <nyt:party><xsl:value-of select="party"/></nyt:party>
-	  <nyt:total_receipts><xsl:value-of select="total_receipts"/></nyt:total_receipts>
-	  <nyt:total_disbursements>
-	    <xsl:value-of select="total_disbursements"/>
-	  </nyt:total_disbursements>
-	  <nyt:cash_on_hand><xsl:value-of select="cash_on_hand"/></nyt:cash_on_hand>
-	  <nyt:net_individual_contributions>
-	    <xsl:value-of select="net_individual_contributions"/>
-         </nyt:net_individual_contributions>
-	  <nyt:net_party_contributions>
-	    <xsl:value-of select="net_party_contributions"/>
-	  </nyt:net_party_contributions>
-	  <nyt:net_pac_contributions>
-	    <xsl:value-of select="net_pac_contributions"/>
-	  </nyt:net_pac_contributions>
-	  <nyt:net_candidate_contributions>
-	    <xsl:value-of select="net_candidate_contributions"/>
-	  </nyt:net_candidate_contributions>
-	  <nyt:federal_funds><xsl:value-of select="federal_funds"/></nyt:federal_funds>
-	  <nyt:total_contributions_less_than_200>
-	    <xsl:value-of select="total_contributions_less_than_200"/>
-	  </nyt:total_contributions_less_than_200>
-	  <nyt:total_contributions_2300>
-	    <xsl:value-of select="total_contributions_2300"/>
-	  </nyt:total_contributions_2300>
-	  <nyt:net_primary_contributions>
-	    <xsl:value-of select="net_primary_contributions"/>
-	  </nyt:net_primary_contributions>
-	  <nyt:net_general_contributions>
-	    <xsl:value-of select="net_general_contributions"/>
-	  </nyt:net_general_contributions>
-	  <nyt:total_refunds><xsl:value-of select="total_refunds"/></nyt:total_refunds>
-	  <nyt:date_coverage_from rdf:datatype="date">
-	    <xsl:value-of select="date_coverage_from"/>
-	  </nyt:date_coverage_from>
-	  <nyt:date_coverage_to rdf:datatype="date">
-           <xsl:value-of select="date_coverage_to"/>
-          </nyt:date_coverage_to>
-      </rdf:Description>
-    </xsl:template>
-    <xsl:template match="text()|@*"/>
-</xsl:stylesheet>
+<facets xmlns="http://openlinksw.com/services/facets/1.0/">
+<result><row><column datatype="..." shortform="..." xml:lang="..">...</column></row></result>
+<time>msecs</time>
+<complete>yes or no</complete>
+<db-activity>resource use string</db-activity>
+<sparql>sparql statement text</sparql>
+</facets>
 ]]></programlisting>
-        <para>The stylesheet uses the prefix nyt: (http://www.nytimes.com) for the predicates of
-the augmenting triples. This has been used purely for illustration - you may prefer to define your
-own ontology for RDF data derived from New York Times APIs.</para>
-        <para><emphasis>Testing the Meta-Cartridge</emphasis></para>
-        <para>After creating the required Virtuoso/PL functions and installing the stylesheet, you
-should be able to test the meta-cartridge by sponging a Freebase page as described earlier using
-ODE or the command line. For instance:</para>
+<para>By convention, the first column is the subject selected by the view element, typically a URI, the second a label of the URI
+and the third, if present, is either a count or a search summary.</para>
+<para>The first column's text child is the text form of the value. The column element has the following attributes
+qualifying this further:</para>
         <itemizedlist mark="bullet">
-          <listitem>http://www.freebase.com/view/en/barack_obama , or </listitem>
-          <listitem>http://www.freebase.com/view/en/hillary_rodham_clinton</listitem>
+  <listitem>datatype - The xsd type of the value. If this is a URI, the datatype is "uri" </listitem>
+  <listitem>shortform - If the value is a URI, this is an abbreviated form where known namespaces are replaced with
+their prefixes and very long URI's are truncated preserving start and end. </listitem>
+  <listitem>xml:lang - if the value is a language tagged string, this is the language</listitem>
         </itemizedlist>
-        <para>You should see campaign finance data added to the graph created by the Sponger in the form of triples with predicates starting http://www.nytimes.com/xxx, e.g. http://www.nytimes.com/net_primary_contribution.</para>
-        <para><emphasis>How The Meta-Cartridge Works</emphasis></para>
-        <para>The comments in the meta-cartridge code detail how the cartridge works. In brief:</para>
-        <para>Given the URI of the graph being created by the Freebase cartridge,
-RDF_MQL_RESOURCE_IS_SENATOR checks if the resource described by Freebase is a U.S. senator.
-Only then does it make sense to query for campaign finance data from the NYTCF data space.</para>
-        <para>To test for senators, the procedure starts by looking for two statements in the Freebase cartridge output similar to:</para>
+<para>The query has the top level element <query>. The child elements of this represent conditions
+pertaining to a single subject. A join is expressed with the property or property-of element. This has
+in turn children which state conditions on a property of the first subject. property and property-of
+elements can be nested to an arbitrary depth and many can occur inside one containing element. In this way,
+tree-shaped structures of joins can be expressed.</para>
+<para>Expressing more complex relationships, such as intermediate grouping, subqueries, arithmetic or
+such requires writing the query in SPARQL. The XML format is a shorthand for easy automatic composition
+of queries needed for showing facets, not a replacement for SPARQL.</para>
+<para>A facet query contains a single view element. This specifies which subject of the joined
+subjects is shown. Its attributes specify the manner of viewing, e.g. list of distinct values, distinct
+values with occurrence counts, properties or classes of the selected subjects etc.</para>
+<para>The top query element or any property or property-of element can have the following types of children:</para>
 <programlisting><![CDATA[
-<rdf:Description rdf:about="http://localhost:8890/about/rdf/http://www.freebase.com/view/en/barack_obama#this">
-  <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
-  <rdfs:seeAlso rdf:resource="http://en.wikipedia.org/wiki/Barack_Obama"/>
-   ...
+<text property="iri">text pattern</text>
 ]]></programlisting>
-        <para>where the graph generated by the Sponger will be</para>
+<para>The subject has an O that matches the text pattern. If property is given, the text pattern must
+occur in a value of this property. If not specified, any property will do. The value "none" for property
+is the same as not specifying a property. This is restricted to occurring directly under the top level
+query element.</para>
 <programlisting><![CDATA[
-<http://www.freebase.com/view/en/barack_obama>
+<class iri="iri" inference="ctx_name" />
 ]]></programlisting>
-        <para>To test whether a resource is a senator, RDF_MQL_RESOURCE_IS_SENATOR</para>
+<para>The S must be an instance of this class. If inference is specified then option (input:inference
+"ctx_name" is added and applies to this pattern alone.</para>
+<programlisting><![CDATA[
+<property iri="iri" same_as="yes" inference="ctx_name">]]></programlisting>
+<para>The child elements of this are conditions that apply to the value of this property of the S that
+is in scope in the enclosing <query> or <property> element. If same_as is present, then
+option (input:same-as "yes") is added to the triple pattern which specifies this property. If inference
+is present, then option (input:inference "ctx_name") is added to the triple pattern for the property.</para>
+<programlisting><![CDATA[
+<property-of iri="iri" same_as="yes" inference="ctx_name" >
+]]></programlisting>
+<para>The child elements of this are conditions that apply to an S which has property "iri" whose object
+is the S in scope in the enclosing <query> or <property> element. The options are otherwise
+the same as with property.</para>
+<programlisting><![CDATA[
+<value datatype="type" xml:lang="lng" op="= | < | > | >= | <=">value </value>
+]]></programlisting>
+<para>When this occurs inside <property> or <property-of> this means that the property in
+scope has the specified relation to the value. type and language can be used for XML typed or language
+tagged literals. The "uri" type means that the value is a qualified name of a URI. If this occurs
+directly under the <query> element, this means that the query starts with a fixed subject.
+If this is so, then there must be property or propertyof elements or the view element must specify
+properties or classes, list is not allowed as a view type. This is so because the query must have
+at least one triple pattern.</para>
+<programlisting><![CDATA[
+<view type="view" limit="n" offset="n" >
+]]></programlisting>
+<para>This may occur once inside a <query> element but may occur either at top level or inside
+property or property-of elements. This specifies what which subject is presented in the result set.</para>
+<para>The type can be:</para>
     <itemizedlist mark="bullet">
-      <listitem>Checks whether the Freebase resource is of rdf:type foaf:Person</listitem>
-      <listitem>Extracts the person's name from the Wikipedia URI referenced by rdfs:seeAlso</listitem>
-      <listitem>Uses the extracted name to build a URI to DBpedia's description of the person. </listitem>
-      <listitem>Queries the DBpedia description to see if the person is of rdf:type yago:Senator110578471 (
-<ulink url="http://www.mpi-inf.mpg.de/~suchanek/downloads/yago/">YAGO</ulink> is a semantic knowledge base which provides a core set of concepts which in turn are used by DBpedia.)</listitem>
-    </itemizedlist>
-        <para>Only if this is the case is the RDF_NYTCF_LOOKUP routine called to query for and return campaign finance data for the candidate. The form of the query and the resulting XML output from the Campaign Finance service were presented earlier.</para>
-      </sect4>
-    </sect3>
-    <sect3 id="virtuosospongerelatedfunc">
-    <title>Virtuoso functions usage examples</title>
-    <sect4 id="virtuosospongerelatedfuncstring">
-      <title>String Functions</title>
-        <para><emphasis><link linkend="fn_sprintf_inverse">sprintf_inverse</link></emphasis></para>
+  <listitem>"properties"
+<programlisting><![CDATA[
+SPARQL
+SELECT ?p count (*) { ?this_s ?p ?any_o ...}
+GROUP BY ?p
+ORDER BY DESC 2
+LIMIT l OFFSET 0
+]]></programlisting>
+  </listitem>
+  <listitem>"properties-in"
+<programlisting><![CDATA[
+SPARQL
+SELECT ?p count (*) { ?any_s ?p ?this_s ... }
+GROUP BY ?p
+ORDER BY DESC 2
+LIMIT L OFFSET 0
+]]></programlisting>
+  </listitem>
+  <listitem>"classes"
+<programlisting><![CDATA[
+SPARQL
+SELECT ?c count (*)
+WHERE { ?xx a ?c ... }
+GROUP BY ?c
+ORDER BY DESC 2
+LIMIT l OFFSET 0
+]]></programlisting>
+  </listitem>
+  <listitem>"text"
+<programlisting><![CDATA[
+SPARQL
+SELECT DISTINCT ?s (bif:search_excerpt (sql:search_terms (""pattern"), ?o)) ...
+LIMIT l OFFSET 0
+]]></programlisting>
+  </listitem>
+  <listitem>"list"
+<programlisting><![CDATA[
+SPARQL
+SELECT DISTINCT ?s long::sql:fct_label (?s) ...
+LIMIT l OFFSET 0
+]]></programlisting>
+  </listitem>
+  <listitem></listitem>
+  <listitem>"list-count"
+<programlisting><![CDATA[
+SPARQL
+SELECT ?s COUNT (*) ....
+GROUP BY ?s
+ORDER BY DESC 2
+]]></programlisting>
+  </listitem>
+  <listitem>"alphabet"
+<programlisting><![CDATA[
+SPARQL
+SELECT (sql:subseq (?s, 0, 1)) count (*) ...
+GROUP BY (sql:subseq (?s, 0, 1))
+ORDER BY 1
+]]></programlisting>
+  </listitem>
+  <listitem>"geo"
+<programlisting><![CDATA[
+SPARQL
+SELECT DISTINCT ?lat ?long ?s
+WHERE ?s geo:lat ?lat . ?s geo:long ?long . ... }
+]]></programlisting>
+  </listitem>
+  <listitem>"years"
+<programlisting><![CDATA[
+SPARQL
+SELECT sql::year (?s) count (*) ...
+GROUP BY (bif:year (?s))
+ORDER BY 1
+OFFSET 0 LIMIT l
+]]></programlisting>
+  </listitem>
+  <listitem>"months"
+<programlisting><![CDATA[
+SPARQL
+SELECT sql::round_month (?s) count (*) ...
+GROUP BY (sql:round_month (?s))
+ORDER BY 1 OFFSET 0 LIMIT l
+]]></programlisting>
+  </listitem>
+  <listitem>"weeks"
+<programlisting><![CDATA[
+SPARQL
+SELECT sql::round_week (?s) COUNT (*) ...
+GROUP BY (sql:round_week (?s))
+ORDER BY 1 OFFSET 0 LIMIT l
+]]></programlisting>
+  </listitem>
+  <listitem>"describe"
+<programlisting><![CDATA[
+SPARQL describe ?s ... OFFSET 0 LIMIT l
+]]></programlisting>
+  </listitem>
+    </itemizedlist>
+<sect2 id="virtuosospongerfacentcust">
+  <title>Customizing</title>
+  <para>The following types of customization will be generally useful:</para>
+  <itemizedlist mark="bullet">
+    <listitem>Resource accounting and limitations, managing access and login</listitem>
+    <listitem>Localization, choice of labels shown with class/property/instance URI's</listitem>
+    <listitem>Adding types of views, for example timelines, map or business graphics </listitem>
+    <listitem>Controlling navigation, for example choosing what type of view is initially presented when opening a given property.</listitem>
+    <listitem>Page layout, captions, help texts, etc.</listitem>
+  </itemizedlist>
+  <para>The source code is divided in two SQL files and a number of XSLT sheets. The file facet.sql has the code for the web service. The
+facet_view.sql file contains the procedures for the sample HTML interface.</para>
+</sect2>
+<sect2 id="virtuosospongerfacentexamples">
+  <title>Examples</title>
+<para>Note: in all examples the default namespace xmlns="http://openlinksw.com/services/facets/1.0/" is omitted for brevity.</para>
+<para>For people called Mike:</para>
 <programlisting><![CDATA[
-tmp := sprintf_inverse (new_origin_uri, 'http://farm%s.static.flickr.com/%s/%s_%s.%s', 0);
-img_id := tmp[2];
+<query>
+  <text>Mike</text>
+  <view type="text"/>
+</query>
 ]]></programlisting>
-        <para><emphasis><link linkend="fn_split_and_decode">split_and_decode</link></emphasis></para>
+<para>To open the list of people who Mike knows:</para>
 <programlisting><![CDATA[
-request_hdr := headers[0];
-response_hdr := headers[1];
-host := http_request_header (request, 'Host');
-tmp := split_and_decode (request_hdr[0], 0, '\0\0 ');
-
-http_method := tmp[0];
-url := tmp[1];
-protocol_version := substring (tmp[2], 6, 8);
-tmp := rtrim (response_hdr[0], '\r\n');
-tmp := split_and_decode (response_hdr[0], 0, '\0\0 ');
+<query>
+  <text>Mike</text>
+  <view type="properties"/>
+</query>
 ]]></programlisting>
-      </sect4>
-      <sect4 id="virtuosospongerelatedfuncrurl">
-      <title>Retrieving URLs</title>
-        <para><emphasis><link linkend="fn_http_get">http_get</link></emphasis></para>
+<para>To show the list of subjects Mike knows:</para>
 <programlisting><![CDATA[
-url := sprintf('http://api.flickr.com/services/rest/?i"??
-	method=flickr.photos.getInfo&photo_id=%s&api_key=%s', img_id, api_key);
-tmp := http_get (url, hdr);
-if (hdr[0] not like 'HTTP/1._ 200 %')
-  signal ('22023', trim(hdr[0], '\r\n'), 'RDFXX');
-xd := xtree_doc (tmp);
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+    <view type="list" />
+  </property>
+</query>
 ]]></programlisting>
-        <para><emphasis>DB.DBA.RDF_HTTP_URL_GET</emphasis></para>
-        <para>A wrapper around http_get. Retrieves a URL using the specified HTTP method
-(defaults to GET). The function can handle proxies, redirects (up to fifteen) and HTTPS.</para>
+<para>To show the properties of people Mike knows:</para>
 <programlisting><![CDATA[
-uri := sprintf ('http://musicbrainz.org/ws/1/%s/%s?type=xml&inc=%U',
-	kind, id, inc);
-cnt := RDF_HTTP_URL_GET (uri, '', hdr, 'GET', 'Accept: */*');
-xt := xtree_doc (cnt);
-xd := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/mbz2rdf.xsl', xt, vector ('baseUri', new_origin_uri));
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+    <view type="properties" />
+  </property>
+</query>
 ]]></programlisting>
-        <para><emphasis><link linkend="fn_http_request_header">http_request_header</link></emphasis></para>
+<para>To show the names:</para>
 <programlisting><![CDATA[
-content := RDF_HTTP_URL_GET (rdf_url, new_origin_uri, hdr, 'GET',
-		'Accept: application/rdf+xml, text/rdf+n3, */*');
-ret_content_type := http_request_header (hdr, 'Content-Type', null, null);
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+    <property iri="foaf:name>
+      <view type="list" />
+    </property>
+  </property>
+</query>
 ]]></programlisting>
-      </sect4>
-      <sect4 id="virtuosospongerelatedfunchnxml">
-      <title>Handling Non-XML Response Content</title>
-        <para><emphasis>json_parse</emphasis>: Parses JSON content into a tree.</para>
+<para>To specify one named Joe:</para>
 <programlisting><![CDATA[
-url := sprintf ('http://www.freebase.com/api/service/mqlread?queries=%U', qr);
-  content := http_get (url, hdr);
-  tree := json_parse (content);
-  tree := get_keyword ('ROOT', tree);
-  tree := get_keyword ('result', tree);
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+     <property iri="foaf:name>
+        <value>Joe</value>
+     </property>
+    <view type="properties" />
+  </property>
+</query>
 ]]></programlisting>
-      </sect4>
-      <sect4 id="virtuosospongerelatedfuncwrarb">
-      <title>Writing Arbitrarily Long Text</title>
-        <para><emphasis><link linkend="fn_http">http</link></emphasis></para>
+<para>This lists the properties of the friends of Mike that are called Joe.</para>
+<para>To show the Mikes that know a Joe, one would change the shown variable in the navigation and get:</para>
 <programlisting><![CDATA[
--- Writing N3 to a string output stream using function http(), parsing the N3 into a graph, then loading the graph into the quad store.
-ses := string_output ();
-http ('@prefix opl: <http://www.openlinksw.com/schema/attribution#> .\n', ses);
-http ('@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n', ses);
-...
-DB.DBA.TTLP (ses, base, graph);
-DB.DBA.RDF_LOAD_RDFXML (strg, base, graph);
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+    <property iri="foaf:name>
+      <value>Joe</value>
+    </property>
+   </property>
+   <view type="text" />
+</query>
 ]]></programlisting>
-        <para><emphasis><link linkend="fn_string_output">string_output</link></emphasis></para>
+<para>This would be the search summaries of subjects with Mike in some field that know a subject with name Joe.</para>
+<para>Now to specify that Mike must be a member of a discussion board:</para>
 <programlisting><![CDATA[
-ses := string_output ();
-cnt := http_get (sprintf ('http://download.finance.yahoo.com/d/quotes.csv?s=%U&f=nsbavophg&e=.csv',
-    symbol));
-arr := rdfm_yq_parse_csv (cnt);
-http ('<quote stock="NASDAQ">', ses);
-foreach (any q in arr) do
-  {
-    http_value (q[0], 'company', ses);
-    http_value (q[1], 'symbol', ses);
-    ...
-  }
-  http ('</quote>', ses);
-  content := string_output_string (ses);
-  xt := xtree_doc (content);
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+    <property iri="foaf:name>
+     <value>Joe</value>
+   </property>
+  </property>
+  <view type="property-in" />
+</query>
 ]]></programlisting>
-        <para><emphasis><link linkend="fn_string_output_string">string_output_string</link></emphasis></para>
-      </sect4>
-      <sect4 id="virtuosospongerelatedfuncxmlxslt">
-      <title>XML & XSLT</title>
-        <para><emphasis><link linkend="fn_xtree_doc">xtree_doc</link></emphasis></para>
+<para>This lists the properties of triples whom object is Mike. Pick sioc:member_of</para>
 <programlisting><![CDATA[
-content := RDF_HTTP_URL_GET (uri, '', hdr, 'GET', 'Accept: */*');
-xt := xtree_doc (content);
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+    <property iri="foaf:name>
+      <value>Joe</value>
+    </property>
+  </property>
+  <property-of iri="sioc:member_of>
+    <view type="list" />
+  </property-of>
+</query>
 ]]></programlisting>
-       <para><emphasis><link linkend="fn_xpath_eval">xpath_eval</link></emphasis></para>
+<para>This would show things where Mike is a member. To specify that the thing must be a forum:</para>
 <programlisting><![CDATA[
-profile := cast (xpath_eval ('/html/head/@profile', xt) as varchar);
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+    <property iri="foaf:name>
+      <value>Joe</value>
+    </property>
+  </property>
+  <property-of iri="sioc:member_of>
+    <view type="classes" />
+  </property-of>
+</query>
 ]]></programlisting>
-        <para><emphasis><link linkend="fn_xslt">DB.DBA.RDF_MAPPER_XSLT</link></emphasis></para>
+<para>This shows classes of things where Mike is a member Clicking on sioc:Forum gives:</para>
 <programlisting><![CDATA[
-tmp := http_get (url);
-xd := xtree_doc (tmp);
-xt := DB.DBA.RDF_MAPPER_XSLT (
-	registry_get ('_rdf_mappers_path_') || 'xslt/atom2rdf.xsl',
-	xd, vector ('baseUri', coalesce (dest, graph_iri)));
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+    <property iri="foaf:name>
+      <value>Joe</value>
+    </property>
+  </property>
+  <property-of iri="sioc:member_of>
+    <class iri="sioc:Forum" />
+    <view type="classes"/>
+  </property-of>
+</query>
 ]]></programlisting>
-      </sect4>
-      <sect4 id="virtuosospongerelatedfunccharserconv">
-      <title>Character Set Conversion</title>
-        <para><emphasis><link linkend="fn_serialize_to_UTF8_xml">serialize_to_UTF8_xml</link></emphasis></para>
+<para>The view stays with classes, but now scoped
+to the classes of things where Mike is a member that are instances of sioc:Forum.</para>
+<para>To go look at the list of Mikes with the added
+restriction, click the shown variable in the navigation and set it to s1.</para>
 <programlisting><![CDATA[
-xt := DB.DBA.RDF_MAPPER_XSLT (
-	registry_get ('_rdf_mappers_path_') || 'xslt/crunchbase2rdf.xsl',
-	xt, vector ('baseUri', coalesce (dest, graph_iri), 'base', base,
-	'suffix', suffix));
-xd := serialize_to_UTF8_xml (xt);
-DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+    <property iri="foaf:name>
+      <value>Joe</value>
+    </property>
+  </property>
+  <property-of iri="sioc:member_of>
+   <class iri="sioc:Forum" />
+  </property-of>
+  <view type="list"/>
+</query>
 ]]></programlisting>
-      </sect4>
-      <sect4 id="virtuosospongerelatedfuncloaddata">
-      <title>Loading Data Into the Quad Store</title>
-        <para><emphasis><link linkend="fn_rdf_load_rdfxml">DB.DBA.RDF_LOAD_RDFXML</link></emphasis></para>
+<para>To say that Joe must also have a geekCode, One clicks the shown variable and sets it to s2 and the view to properties.</para>
 <programlisting><![CDATA[
-content := RDF_HTTP_URL_GET (uri, '', hdr, 'GET', 'Accept: */*');
-xt := xtree_doc (content);
-xd := DB.DBA.RDF_MAPPER_XSLT (
-	registry_get ('_rdf_mappers_path_') || 'xslt/mbz2rdf.xsl',
-	xt, vector ('baseUri', new_origin_uri));
-xd := serialize_to_UTF8_xml (xd);
-DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+    <property iri="foaf:name>
+      <value>Joe</value>
+    </property>
+    <view type="properties"/>
+  </property>
+  <property-of iri="sioc:member_of>
+    <class iri="sioc:Forum" />
+   </property-of>
+</query>
 ]]></programlisting>
-        <para><emphasis><link linkend="fn_ttlp">DB.DBA.TTLP</link></emphasis></para>
+<para>Pick geekCode</para>
 <programlisting><![CDATA[
-sess := string_output ();
-...
-http (sprintf ('<http://dbpedia.org/resource/%s>
-	<http://xbrlontology.com/ontology/finance/stock_market#hasCompetitor>
-	<http://dbpedia.org/resource/%s> .\n',
-	symbol, x), sess);
-http (sprintf ('<http://dbpedia.org/resource/%s>
-	<http://www.w3.org/2000/01/rdf-schema#isDefinedBy>
-	<http://finance.yahoo.com/q?s=%s> .\n',
-	 x, x), sess);
-content := string_output_string (sess);
-DB.DBA.TTLP (content, new_origin_uri, coalesce (dest, graph_iri));
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+    <property iri="foaf:name>
+      <value>Joe</value>
+    </property>
+    <property iri="geekCode">
+      <view type="list"/>
+    </property>
+  </property>
+  <property-of iri="sioc:member_of>
+    <class iri="sioc:Forum" />
+  </property-of>
+</query>
 ]]></programlisting>
-  <tip><title>See Also:</title>
-    <itemizedlist mark="bullet">
-      <listitem><link linkend="rdfinsertmethodsapifunct">Loading RDF using API functions</link></listitem>
-    </itemizedlist>
-  </tip>
-      </sect4>
-      <sect4 id="virtuosospongerelatedfuncdebugpoutput">
-        <title>Debug Output</title>
-        <para><emphasis><link linkend="fn_dbg_obj_print">dbg_obj_print</link></emphasis></para>
+<para>We specify no restriction on the geekCode. Click the shown variable to take the focus back to Mike.</para>
 <programlisting><![CDATA[
-dbg_obj_print ('try all grddl mappings here');
+<query>
+  <text>Mike</text>
+  <property iri="foaf:knows>
+    <property iri="foaf:name>
+      <value>Joe</value>
+    </property>
+    <property iri="geekCode"></property>
+  </property>
+  <property-of iri="sioc:member_of>
+    <class iri="sioc:Forum" />
+  </property-of>
+  <view type="text"/>
+</query>
 ]]></programlisting>
-      </sect4>
-    </sect3>
-    <sect3 id="virtuosospongeref">
-      <title>References</title>
+</sect2>
+<sect2 id="virtuosospongerfacentui">
+  <title>WebService Interface</title>
+<sect3 id="virtuosospongerfacentuirest">
+  <title>REST interface</title>
+  <para>The Virtuoso Facets web service provide following REST interface:</para>
+  <para>Service description:</para>
       <itemizedlist mark="bullet">
-        <listitem>RDF Primer: http://www.w3.org/TR/2004/REC-rdf-primer-20040210/</listitem>
-        <listitem>RDF/XML Syntax Specification: http://www.w3.org/TR/rdf-syntax-grammar/</listitem>
-        <listitem>GRDDL Primer: http://www.w3.org/TR/grddl-primer/</listitem>
+  <listitem>Endpoint: http://<cname>/fct/service for ex. http://lod.openlinksw.com/fct/service </listitem>
+  <listitem>HTTP method: POST</listitem>
+  <listitem>Content-Type: MUST be 'text/xml'</listitem>
+  <listitem>The entity body must be XML document with top element 'query' as described above.</listitem>
+  <listitem>The request response namespace MUST be "http://openlinksw.com/services/facets/1.0"</listitem>
       </itemizedlist>
-      <sect4 id="virtuosospongerefping">
-        <title>PingTheSemanticWeb RDF Notification Service</title>
-        <para><ulink url="http://www.pingthesemanticweb.com/">PingtheSemanticWeb</ulink> (PTSW) is a repository for RDF documents. The PTSW web service
-archives the location of recently created or updated RDF documents on the Web. It is intended
-for use by crawlers or other types of software agents which need to know when and where the
-latest updated RDF documents can be found. They can request a list of recently updated documents
-as a starting location to crawl the Semantic Web.</para>
-        <para>You may find this service useful for publicizing your own RDF content. Content authors can
-notify PTSW that an RDF document has been created or updated by pinging the service with the URL of
-the document. The Sponger supports this facility through the async_queue and ping_service parameters
-of the cartridge hook function, where the ping_service parameter contains the ping service URL as
-configured in the SPARQL section of the virtuoso.ini file:</para>
+  <para>Error conditions:</para>
+  <para>The all error conditions are reported via 'Error explanation'</para>
+  <para>Files:</para>
+  <para>The facet_svc.sql contains web service code and virtual directory mapping, and it uses
+fct_req.xsl & fct_resp.xsl as request & response filters.</para>
+  <para>Example:</para>
+  <para>Using CURL program</para>
 <programlisting><![CDATA[
-[SPARQL]
-...
-PingService = http://rpc.pingthesemanticweb.com/
-...
+curl -H "Content-Type: text/xml" -d @post.xml  http://lod.openlinksw.com/fct/service
 ]]></programlisting>
-        <para>The configured ping service can be called using an asynchronous request and
-the RDF_SW_PING procedure as illustrated below. </para>
+  <para>Where 'post.xml' document contains query document:</para>
 <programlisting><![CDATA[
-create procedure DB.DBA.RDF_LOAD_HTML_RESPONSE (
-  in graph_iri varchar, in new_origin_uri varchar, in dest varchar,
-  inout ret_body any, inout async_queue any, inout ping_service any,
-  inout _key any, inout opts any )
-{
-  ...
-  if ( ... and async_queue is not null)
-    aq_request (async_queue, 'DB.DBA.RDF_SW_PING',
-                vector (ping_service, new_origin_uri));
+<?xml version="1.0"?>
+<query xmlns="http://openlinksw.com/services/facets/1.0" inference="" same-as="">
+  <text> Seattle Mariners traveled all the way to Japan to watch</text>
+  <view type="text" limit="20" offset=""/>
+</query>
 ]]></programlisting>
-        <para>For more details refer to section <link linkend="ASYNCEXECMULTITHREAD">Asynchronous Execution and Multithreading in Virtuoso/PL</link></para>
-      </sect4>
-      <sect4 id="virtuosospongeremname">
-        <title>Main Namespaces used by OpenLink Cartridges</title>
-        <para>A list of the main namespaces / ontologies used by OpenLink-provided Sponger cartridges
-is given below. Some of these ontologies may prove useful when creating your own cartridges.</para>
-        <itemizedlist mark="bullet">
-          <listitem>- http://www.openlinksw.com/virtuoso/xslt/</listitem>
-          <listitem>- http://www.openlinksw.com/schemas/XHTML# </listitem>
-          <listitem>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# </listitem>
-          <listitem>rdfs: http://www.w3.org/2000/01/rdf-schema# </listitem>
-          <listitem>dc: http://purl.org/dc/elements/1.1/</listitem>
-          <listitem>dcterms: http://purl.org/dc/terms/</listitem>
-          <listitem>foaf: http://xmlns.com/foaf/0.1/</listitem>
-          <listitem>sioc: http://rdfs.org/sioc/ns# </listitem>
-          <listitem>sioct: http://rdfs.org/sioc/types# </listitem>
-          <listitem>skos: http://www.w3.org/2004/02/skos/core# </listitem>
-          <listitem>bibo: http://purl.org/ontology/bibo/</listitem>
-        </itemizedlist>
-      </sect4>
-      <sect4 id="virtuosospongerfreeb">
-        <title>Freebase Cartridge & Stylesheet</title>
-        <para>Snapshots of the Freebase cartridge and stylesheet compatible with the meta-cartridge
-example presented earlier in this document can be found below.</para>
-        <para><emphasis>DB.DBA.RDF_LOAD_MQL:</emphasis></para>
+  <para>Produces following response:</para>
 <programlisting><![CDATA[
---no_c_escapes-
-create procedure DB.DBA.RDF_LOAD_MQL (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
-    inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
+<fct:facets xmlns:fct="http://openlinksw.com/services/facets/1.0/">
+<fct:sparql>   SELECT distinct ?s1 as ?c1, (bif:search_excerpt (bif:vector ('THE', 'MARINERS', 'WAY', 'SEATTLE', 'WATCH', 'ALL', 'TO', 'JAPAN', 'TRAVELED'), ?o1)) as ?c2  WHERE { ?s1 ?s1textp ?o1 . FILTER (bif:contains (?o1, '(THE AND MARINERS AND WAY AND SEATTLE AND WATCH AND ALL AND TO AND JAPAN AND TRAVELED)')) . } LIMIT 20  OFFSET 0 </fct:sparql>
+<fct:time>116</fct:time>
+<fct:complete>yes</fct:complete>
+<fct:db-activity>   134R rnd  9.488KR seq      0P disk  8.966MB /    602 messages</fct:db-activity>
+ <fct:result>
+  <fct:row>
+    <fct:column datatype="url" shortform="http://bobdupuy.mlbl...ld_baseball__6.html">http://bobdupuy.mlblogs.com/bobdupuy/2006/03/world_baseball__6.html></fct:column>
+    <fct:column />
+    <fct:column><span class="srch_xerpt">... While Chuck Armstrong president of <b>the</b> <b>Seattle</b> <b>Mariners</b> <b>traveled</b> <b>all</b> <b>the</b> <b>way</b> <b>to</b> <b>Japan</b> <b>to</b> <b>watch</b> Ichiro... for <b>the</b> advancing <b>Japan</b> team last week <b>the</b> star from <b>the</b> <b>Seattle</b> roster so far in Round 1 has without a doubt... leading <b>the</b> Dominican <b>to</b> its...</span></fct:column>
+  </fct:row>
+  <fct:row>
+    <fct:column datatype="url" shortform="http://bobdupuy.mlbl...ld_baseball__6.html">http://bobdupuy.mlblogs.com/bobdupuy/2006/03/world_baseball__6.html></fct:column>
+    <fct:column />
+    <fct:column><span class="srch_xerpt">Orlando While Chuck Armstrong president of <b>the</b> <b>Seattle</b> <b>Mariners</b> <b>traveled</b> <b>all</b> <b>the</b> <b>way</b> <b>to</b> <b>Japan</b> <b>to</b> <b>watch</b>... perform for <b>the</b> advancing <b>Japan</b> team last week <b>the</b> star from <b>the</b> <b>Seattle</b> roster so far in Round 1 has without...</span></fct:column>
+  </fct:row>
+ </fct:result>
+</fct:facets>
+]]></programlisting>
+</sect3>
+<sect3 id="virtuosospongerfacentuirestapi">
+  <title>Virtuoso APIs for Facet REST services</title>
+<para>The Virtuoso APIs for FCT REST services are Virtuoso Stored Procedures that enable faceted browsing
+over Linked Data hosted in the RDF Quad Store. This also includes Linked Data that is progressively
+added to the Quad Store via URI de-referencing.
+</para>
+<para>They enable the use Virtuoso's VSP/VSPX technology to produce (X)HTML-based Linked Data explorer
+pages that are endowed with high-performance (in-process) faceted browsing capability.
+</para>
+<para>You can use this API with Virtuoso SQL calls that provide data to your VSP/VSPX, ASP.NET, PHP,
+etc., -based interfaces using ODBC, JDBC, ADO.NET, or XMLA connectivity (SPASQL) to Virtuoso.
+</para>
+  <sect4 id="virtuosospongerfacentuirestapidef">
+    <title>API Definition</title>
+<programlisting><![CDATA[
+CREATE PROCEDURE
+fct_exec
+  (
+    IN  tree     ANY ,
+    IN  timeout  INT
+  )
 {
-  declare qr, path, hdr any;
-  declare tree, xt, xd, types any;
-  declare k, cnt, url, sa varchar;
+  DECLARE  start_time,
+           view3,
+           inx,
+           n_rows      INT     ;
+  DECLARE  sqls,
+           msg,
+           qr,
+           qr2,
+           act,
+           query       VARCHAR ;
+  DECLARE  md,
+           res,
+           results,
+           more        ANY     ;
+  DECLARE  tmp         ANY     ;
+  DECLARE  offs,
+           lim         INT     ;
+
+  SET result_timeout = _min
+                         (
+                           timeout,
+                           ATOI
+                             (
+                               registry_get ('fct_timeout_max')
+                             )
+                         )
+  ;
+
+  offs := xpath_eval ('//query/view/@offset', tree);
+  lim := xpath_eval ('//query/view/@limit', tree);
+
+  -- db_activity ();
+
+  results := vector (null, null, null);
+  more := vector ();
+
+  IF
+    (
+      xpath_eval
+        (
+          '//query[@view3="yes"]//view[@type="text"]',
+          tree
+        )
+      IS NOT NULL
+    )
+      {
+      more := VECTOR ('classes', 'properties');
+  }
+
+  sqls := '00000';
+  qr := fct_query
+          (
+            xpath_eval ('//query', tree, 1)
+          )
+  ;
+  query := qr;
+--  dbg_obj_print (qr);
+  qr2 := fct_xml_wrap (tree, qr);
+  start_time := msec_time ();
+
+  dbg_printf('query: %s', qr2);
+
+  EXEC
+    (
+      qr2,
+      sqls,
+      msg,
+      vector (),
+      0,
+      md,
+      res
+    )
+  ;
+  n_rows := row_count ();
+  act := db_activity ();
+  SET result_timeout = 0;
+  IF (
+       sqls <> '00000'
+       AND
+       sqls <> 'S1TAT'
+     )
+    SIGNAL (sqls, msg);
+  IF (
+       NOT ISARRAY (res)
+       OR
+       0 = length (res)
+       OR
+       NOT ISARRAY (res[0])
+       OR
+       0 = length (res[0])
+     )
+    results[0] := xtree_doc ('<result/>');
+  ELSE
+    results[0] := res[0][0];
 
-  hdr := null;
-  sa := '';
-  declare exit handler for sqlstate '*'
-    {
-      --dbg_printf ('%s', __SQL_MESSAGE);
-      return 0;
-    };
+  inx := 1;
 
-  path := split_and_decode (new_origin_uri, 0, '%\0/');
-  if (length (path) < 1)
-    return 0;
-  k := path [length(path) - 1];
-  if (path [length(path) - 2] = 'guid')
-    k := sprintf ('"id":"/guid/%s"', k);
-  else
-  {
-    if (k like '#%')
-        k := sprintf ('"id":"%s"', k);
-    else
-      {
-	sa := DB.DBA.RDF_MQL_GET_WIKI_URI (k);
-    k := sprintf ('"key":"%s"', k);
-  }
-  }
-  qr := sprintf ('{"ROOT":{"query":[{%s, "type":[]}]}}', k);
-  url := sprintf ('http://www.freebase.com/api/service/mqlread?queries=%U', qr);
-  cnt := http_get (url, hdr);
-  tree := json_parse (cnt);
-  xt := get_keyword ('ROOT', tree);
-  if (not isarray (xt))
-    return 0;
-  xt := get_keyword ('result', xt);
-  types := vector ();
-  foreach (any tp in xt) do
+  FOREACH (VARCHAR tp IN more) DO
     {
-      declare tmp any;
-      tmp := get_keyword ('type', tp);
-      types := vector_concat (types, tmp);
-    }
-  --types := get_keyword ('type', xt);
-  DELETE FROM DB.DBA.RDF_QUAD WHERE g =  iri_to_id(new_origin_uri);
-  foreach (any tp in types) do
+      tree := XMLUpdate (
+                          tree,
+                          '/query/view/@type',
+                          tp,
+                          '/query/view/@limit',
+                          '40',
+                          '/query/view/@offset',
+                          '0'
+                        )
+      ;
+      qr := fct_query (xpath_eval ('//query', tree, 1));
+      qr2 := fct_xml_wrap (tree, qr);
+      sqls := '00000';
+      SET result_timeout = _min (
+                                  timeout,
+                                  ATOI
+                                    (
+                                      registry_get ('fct_timeout_max')
+                                    )
+                                )
+      ;
+      EXEC (
+             qr2,
+             sqls,
+             msg,
+             vector (),
+             0,
+             md,
+             res
+           );
+      n_rows := row_count ();
+      act := db_activity ();
+      SET result_timeout = 0;
+      IF ( sqls <> '00000'
+           AND
+           sqls <> 'S1TAT'
+         )
+    SIGNAL (sqls, msg);
+      IF (
+           ISARRAY (res)
+           AND
+           LENGTH (res)
+           AND
+           ISARRAY (res[0])
+           AND
+           LENGTH (res[0])
+         )
     {
-      qr := sprintf ('{"ROOT":{"query":{%s, "type":"%s", "*":[]}}}', k, tp);
-      url := sprintf ('http://www.freebase.com/api/service/mqlread?queries=%U', qr);
-      cnt := http_get (url, hdr);
-      --dbg_printf ('%s', cnt);
-      tree := json_parse (cnt);
-      xt := get_keyword ('ROOT', tree);
-      xt := DB.DBA.MQL_TREE_TO_XML (tree);
-      --dbg_obj_print (xt);
-      xt := DB.DBA.RDF_MAPPER_XSLT (registry_get ('_rdf_mappers_path_') || 'xslt/mql2rdf.xsl', xt,
-      	vector ('baseUri', coalesce (dest, graph_iri), 'wpUri', sa));
-      sa := '';
-      xd := serialize_to_UTF8_xml (xt);
---      dbg_printf ('%s', xd);
-      DB.DBA.RM_RDF_LOAD_RDFXML (xd, new_origin_uri, coalesce (dest, graph_iri));
+      tmp := res[0][0];
+      tmp := XMLUpdate (tmp, '/result/@type', tp);
+      results[inx] := tmp;
+    }
+      inx := inx + 1;
     }
-  return 1;
-}
-]]></programlisting>
-        <para><emphasis>mql2rdf.xsl:</emphasis></para>
-<programlisting><![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- -
- -  $Id: rdfandsparql.xml,v 1.95.2.36 2010/07/08 15:18:23 source Exp $
- -
- -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- -  project.
- -
- -  Copyright (C) 1998-2008 OpenLink Software
- -
- -  This project is free software; you can redistribute it and/or modify it
- -  under the terms of the GNU General Public License as published by the
- -  Free Software Foundation; only version 2 of the License, dated June 1991.
- -
- -  This program is distributed in the hope that it will be useful, but
- -  WITHOUT ANY WARRANTY; without even the implied warranty of
- -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- -  General Public License for more details.
- -
- -  You should have received a copy of the GNU General Public License along
- -  with this program; if not, write to the Free Software Foundation, Inc.,
- -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--->
-<!DOCTYPE xsl:stylesheet [
-<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
-<!ENTITY bibo "http://purl.org/ontology/bibo/">
-<!ENTITY xsd  "http://www.w3.org/2001/XMLSchema#">
-<!ENTITY foaf "http://xmlns.com/foaf/0.1/">
-<!ENTITY sioc "http://rdfs.org/sioc/ns#">
-]>
-<xsl:stylesheet version="1.0"
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:vi="http://www.openlinksw.com/virtuoso/xslt/"
-    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
-    xmlns:sioc=""
-    xmlns:bibo=""
-    xmlns:foaf=""
-    xmlns:skos="http://www.w3.org/2004/02/skos/core#"
-    xmlns:dcterms= "http://purl.org/dc/terms/"
-    xmlns:mql="http://www.freebase.com/">
 
-    <xsl:output method="xml" indent="yes" />
 
-    <xsl:param name="baseUri" />
-    <xsl:param name="wpUri" />
 
-    <xsl:variable name="ns">http://www.freebase.com/</xsl:variable>
+  res := XMLELEMENT
+           (
+             "facets",
+             XMLELEMENT
+               ( "sparql", query ),
+             XMLELEMENT
+               ( "time", msec_time () - start_time ),
+             XMLELEMENT
+               (
+                 "complete",
+                 CASE WHEN sqls = 'S1TAT'
+                      THEN 'no'
+                      ELSE 'yes'
+                  END
+                ),
+             XMLELEMENT
+               (
+                 "timeout",
+                 _min
+                   (
+                     timeout * 2,
+                     ATOI
+                       (
+                         registry_get
+                           ( 'fct_timeout_max' )
+                       )
+                   )
+               ),
+             XMLELEMENT
+               ("db-activity", act),
+             XMLELEMENT
+               ("processed", n_rows),
+             XMLELEMENT
+               (
+                 "view",
+                 XMLATTRIBUTES
+                   (
+                     offs AS "offset",
+                     lim AS "limit"
+                   )
+               ),
+             results[0],
+             results[1],
+             results[2]
+           );
 
-    <xsl:template match="/">
-	<rdf:RDF>
-	    <xsl:if test="/results/ROOT/result/*">
-		<rdf:Description rdf:about="{$baseUri}">
-		    <rdf:type rdf:resource="Document"/>
-		    <rdf:type rdf:resource="Document"/>
-		    <rdf:type rdf:resource="Container"/>
-		    <sioc:container_of rdf:resource="{vi:proxyIRI($baseUri)}"/>
-		    <foaf:primaryTopic rdf:resource="{vi:proxyIRI($baseUri)}"/>
-		    <dcterms:subject rdf:resource="{vi:proxyIRI($baseUri)}"/>
-		</rdf:Description>
-		<rdf:Description rdf:about="{vi:proxyIRI($baseUri)}">
-		    <rdf:type rdf:resource="Item"/>
-		    <sioc:has_container rdf:resource="{$baseUri}"/>
-		    <xsl:apply-templates select="/results/ROOT/result/*"/>
-		    <xsl:if test="$wpUri != ''">
-			<rdfs:seeAlso rdf:resource="{$wpUri}"/>
-		    </xsl:if>
-		</rdf:Description>
-	    </xsl:if>
-	</rdf:RDF>
-    </xsl:template>
+---- for debugging:
+--string_to_file ('ret.xml', serialize_to_UTF8_xml (res), -2);
+--  dbg_obj_print (res);
+
+  RETURN res;
+}
+;
+]]></programlisting>
+   </sect4>
+   <sect4 id="virtuosospongerfacentuirestapiexmp">
+     <title>Example</title>
+<para>
+The following example shows how to use the fct_exec APi in vsp page to perform a "text" search for the
+word "Mike" assuming this exists in your Virtuoso RDF store (if not amend the query in the fct_example.vsp
+code sample below to search for text known to exist).
+</para>
+<orderedlist>
+  <listitem>The service can be used in the following sample fct_example.vsp:
+<programlisting><![CDATA[
+<?vsp
 
-    <xsl:template match="*[starts-with(.,'http://') or starts-with(.,'urn:')]">
-	<xsl:element namespace="{$ns}" name="{name()}">
-	    <xsl:attribute name="rdf:resource">
-		<xsl:value-of select="vi:proxyIRI (.)"/>
-	    </xsl:attribute>
-	</xsl:element>
-    </xsl:template>
+declare txt, reply, tree any;
+declare timeout int;
 
-    <xsl:template match="*[starts-with(.,'/')]">
-	<xsl:if test="local-name () = 'type' and . like '%/person'">
-	    <rdf:type rdf:resource="Person"/>
-	</xsl:if>
-	<xsl:if test="local-name () = 'type'">
-	    <sioc:topic>
-		<skos:Concept rdf:about="{vi:proxyIRI (concat ($ns, 'view', .))}"/>
-	    </sioc:topic>
-	</xsl:if>
+tree := xtree_doc ('
+  <query>
+    <text>Mike</text>
+    <view type="text"/>
+  </query>
+');
 
-	<xsl:element namespace="{$ns}" name="{name()}">
-	    <xsl:attribute name="rdf:resource">
-		<xsl:value-of select="vi:proxyIRI(concat ($ns, 'view', .))"/>
-	    </xsl:attribute>
-	</xsl:element>
-    </xsl:template>
+timeout := 3000;
+reply := fct_exec (tree, timeout);
 
-    <xsl:template match="*[* and ../../*]">
-	<xsl:element namespace="{$ns}" name="{name()}">
-	    <xsl:attribute name="rdf:parseType">Resource</xsl:attribute>
-	    <xsl:apply-templates select="@*|node()"/>
-	</xsl:element>
-    </xsl:template>
+txt := string_output ();
 
-    <xsl:template match="*">
-	<xsl:if test="* or . != ''">
+http_value (xslt ('virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:/DAV/fct_example.xsl',
+                 reply,
+   	         vector ()),
+	         null, txt);
+
+http (txt);
+?>
+]]></programlisting>
+</listitem>
+  <listitem>The xsl:
+<programlisting><![CDATA[
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:output method="html" encoding="ISO-8859-1"/>
+  <xsl:variable name="rowcnt" select="count(/facets/result/row)"/>
+  <xsl:template match="facets">
+    <div id="res">
+      <xsl:if test="/facets/complete = 'yes' and /facets/processed = 0 and $rowcnt = 0">
+        <div class="empty_result">
+          Nothing found.
+        </div>
+      </xsl:if>
+      <xsl:for-each select="/facets/result">
+        <xsl:call-template name="render-result"/>
+      </xsl:for-each>
+    </div>
+    <!-- #res -->
+    </xsl:template>
+  <xsl:template name="render-result">
+    <table class="result" border="1">
+      <thead>
+        <tr>
+          <th>Entity</th>
+          <th>Title</th>
+          <th>Text excerpt</th>
+        </tr>
+      </thead>
+      <tbody>
+        <xsl:for-each select="row">
+          <tr>
+            <td class="rnk">
+              <xsl:for-each select="column[@datatype='trank' or @datatype='erank']">
 		<xsl:choose>
-		    <xsl:when test="name()='image'">
-			<foaf:depiction rdf:resource="{vi:mql-image-by-name (.)}"/>
+                  <xsl:when test="./@datatype='trank'">Text Rank:</xsl:when>
+                  <xsl:when test="./@datatype='erank'">Entity Rank:</xsl:when>
+                </xsl:choose>
+                <xsl:value-of select="."/>
+                <br/>
+              </xsl:for-each>
+            </td>
+            <xsl:for-each select="column">
+              <xsl:choose>
+                <xsl:when test="'url' = ./@datatype">
+                  <td>
+                    <a>
+                      <xsl:attribute name="href">http://lod.openlinksw.com/describe/?url=<xsl:value-of select="urlify (.)"/></xsl:attribute>
+                      <xsl:attribute name="title"><xsl:value-of select="."/></xsl:attribute>
+                      <xsl:choose>
+                        <xsl:when test="'' != ./@shortform">
+                          <xsl:value-of select="./@shortform"/>
 		    </xsl:when>
+                        <xsl:when test="'erank' = ./@datatype or 'trank' = ./@datatype">rank</xsl:when>
 		    <xsl:otherwise>
-			<xsl:element namespace="{$ns}" name="{name()}">
-			    <xsl:if test="name() like 'date_%'">
-				<xsl:attribute name="rdf:datatype">dateTime</xsl:attribute>
-			    </xsl:if>
-			    <xsl:apply-templates select="@*|node()"/>
-			</xsl:element>
+                          <xsl:value-of select="."/>
 		    </xsl:otherwise>
 		</xsl:choose>
-	</xsl:if>
+                    </a>
+                  </td>
+                </xsl:when>
+                <xsl:when test="'erank' = ./@datatype or 'trank' = ./@datatype"/>
+                <xsl:when test="'srch_xerpt' = ./span/@class">
+                  <td>
+                    <xsl:value-of select="."/>
+                  </td>
+                </xsl:when>
+                <xsl:otherwise/>
+              </xsl:choose>
+            </xsl:for-each>
+          </tr>
+        </xsl:for-each>
+      </tbody>
+    </table>
+  </xsl:template>
+  <xsl:template match="@* | node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@* | node()"/>
+    </xsl:copy>
     </xsl:template>
 </xsl:stylesheet>
 ]]></programlisting>
-      </sect4>
-    </sect3>
-  <sect3 id="rdfspongerprogrammerguidepython"><title>Using Python to perform Virtuoso Sponging</title>
-  <para>This section contains the generic steps to use Python language to extend the Virtuoso Sponger.</para>
-    <orderedlist>
-      <listitem>Build the latest Python hosting module. It will introduce a new function <code>python_exec ()</code>
-<para>The parameters of python_exec are :</para>
-<itemizedlist mark="bullet">
-  <listitem>string containing a python code, it should define one or more functions, see remarks bellow</listitem>
-  <listitem>string containing name of function to be called</listitem>
-  <listitem>list of parameters for the function </listitem>
-</itemizedlist>
-<para>For Example:</para>
-<programlisting><![CDATA[
-python_exec (file_to_string ('spoonge.py'), 'rdf4uri', 'http://url..', 'http://base...');
-]]></programlisting>
-<para>The above means call the rdf4uri ('http://url..', 'http://base...') function from spoonge.py file. 
-It is importnat to know that python_exec is restricted to DBA only group and that the python source 
-should not have __main__ or this to be restricted in python code to not be called . 
-Any print etc. for stdout/stderr will go on server console if server is on foreground. 
-Can be used for debug for example but not for real work. </para>
-<para>The function is supposed to return just single string, don't try to return multiple results, 
-this will not work in this revision. 
-</para>
-      </listitem>
-      <listitem>Setup the Virtuoso server INI to include python module:
-<programlisting><![CDATA[
-...
-[Plugins]
-LoadPath = ../lib
-Load1    = Hosting, hosting_python.so
-...
-]]></programlisting>      	
-      </listitem>
-      <listitem>Download and install the rdflib package from http://www.rdflib.net/
-Note before to build, disable Zope interface in rdflib as this not work with C-API correctly. 
-Or make sure Python has no Zope interfaces installed. 
-To disable the zope in rdflib, just comment out following in <rdflibhome>/rdflib/__init__.py:
-<programlisting><![CDATA[
- 36 #from rdflib.interfaces import IIdentifier, classImplements
- 37 #classImplements(URIRef, IIdentifier)
- 38 #classImplements(BNode, IIdentifier)
- 39 #classImplements(Literal, IIdentifier)	
-]]></programlisting>
-<para>Then do:</para>
-<programlisting><![CDATA[
-perl setup.py build
-perl setup.py --user install	
-]]></programlisting>
       </listitem>
-      <listitem>Get an example of python code for sponger like: http://www.ebusiness-unibw.org/wiki/Python4Spongers 
-and make sure you disable the last lines which not suitable for calling inside Sponger:
-<programlisting><![CDATA[
-...
-#if __name__ == '__main__':
-#	rdf_xml = rdf4uri(uri='http://www.amazon.com/Apple-touch-Generation-NEWEST-MODEL/dp/B002M3SOBU/')
-#	print rdf_xml
-]]></programlisting>
-<para>Store the python code in sponge.py in server working directory. 
-Make sure this directory is allowed to read in DirsAllowed INI setting.</para>
+  <listitem>The result of executing the fct_example.vsp should be:
+     <figure id="fcapiex1" float="1">
+       <title>Facet API Example</title>
+       <graphic fileref="ui/fcapiex1.png"/>
+     </figure>
 </listitem>
-      <listitem>Create a procedure and register with Sponger: 
+</orderedlist>
+   </sect4>
+</sect3>
+<sect3 id="virtuosospongerfacentuirest">
+  <title>SOAP interface</title>
+<para>The facet web service is also available via SOAP protocol.</para>
+<para>The request message contains single element 'query' with syntax explained earlier. Also the
+SOAPAction HTTP header should be '#query' . After successful evaluation of the query, the service
+will return a SOAP envelope containing in the Body element single 'facets' element described above.</para>
+<para>Example:</para>
+<para>This example shows execution of same command as in example for REST interface here it using SOAP:</para>
+<para>Request message:</para>
 <programlisting><![CDATA[
--- THIS IS FOR DEMO PURPOSE ONLY 
-
--- for demo purposes we delete all other cartridges registrations to see effect from only this cartridge
-delete from DB.DBA.SYS_RDF_MAPPERS;
-delete from DB.DBA.RDF_META_CARTRIDGES;
-
--- register cartridge 
-insert soft DB.DBA.SYS_RDF_MAPPERS (RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_DESCRIPTION)
-	values ('(http://.*amazon.[^/]+/[^/]+/dp/[^/]+(/.*)?)', 'URL', 'DB.DBA.RDF_LOAD_PYTHON_AMAZON_ARTICLE', null, 'Amazon articles');
-
--- the cartridge stored procedure itself 
-create procedure DB.DBA.RDF_LOAD_PYTHON_AMAZON_ARTICLE (in graph_iri varchar, in new_origin_uri varchar,  in dest varchar,
-    inout _ret_body any, inout aq any, inout ps any, inout _key any, inout opts any)
-{
-  declare result any;
-  -- we check first python hosting is capable to run code
-  if (__proc_exists ('python_exec', 2) is null)
-    return 0;
-  -- handle any error
-  declare exit handler for sqlstate '*'
-    {
-      -- log the error 
-      DB.DBA.RM_RDF_SPONGE_ERROR (current_proc_name (), graph_iri, dest, __SQL_MESSAGE); 	
-      return 0;
-    };
-  -- call the python code
-  result := python_exec (file_to_string ('sponge.py'), 'rdf4uri', new_origin_uri);
-  -- in case of python error we will get integer zero, so we check 
-  if (not isstring (result))
-    return 0;
-  -- for demo purpose we delete all from this graph
-  delete from DB.DBA.RDF_QUAD where G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_iri);
-  -- load the results
-  DB.DBA.RDF_LOAD_RDFXML (result, new_origin_uri, coalesce (dest, graph_iri), 0);
-  return 1;
-}
-;
+<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
+  <SOAP:Body>
+    <query xmlns="http://openlinksw.com/services/facets/1.0/" inference="" same-as="">
+      <text>Seattle Mariners traveled all the way to Japan to watch</text>
+      <view type="text" limit="20" offset="0"/>
+    </query>
+  </SOAP:Body>
+</SOAP:Envelope>
 ]]></programlisting>
-</listitem>
-      <listitem>Test the Sponger code like this:
+<para>Response message:</para>
 <programlisting><![CDATA[
-sparql define get:soft "soft" select * from <http://www.amazon.com/Apple-touch-Generation-NEWEST-MODEL/dp/B002M3SOBU/> { ?s ?p ?o };	
+<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
+  <SOAP:Body>
+    <fct:facets xmlns:fct="http://openlinksw.com/services/facets/1.0/">
+      <fct:sparql>SELECT distinct ?s1 as ?c1, (bif:search_excerpt (bif:vector ('THE', 'MARINERS', 'WAY', 'SEATTLE', 'WATCH', 'ALL', 'TO', 'JAPAN', 'TRAVELED'), ?o1)) as ?c2  where { ?s1 ?s1textp ?o1 . filter (bif:contains (?o1, '(THE AND MARINERS AND WAY AND SEATTLE AND WATCH AND ALL AND TO AND JAPAN AND TRAVELED)')) . } LIMIT 20  OFFSET 0</fct:sparql>
+      <fct:time>114</fct:time>
+      <fct:complete>yes</fct:complete>
+      <fct:db-activity>   134R rnd  9.488KR seq      0P disk  8.966MB /    602 messages</fct:db-activity>
+      <fct:result>
+        <fct:row>
+          <fct:column datatype="url" shortform="http://bobdupuy.mlbl...ld_baseball__6.html">http://bobdupuy.mlblogs.com/bobdupuy/2006/03/world_baseball__6.html</fct:column>
+          <fct:column/>
+          <fct:column><span class="srch_xerpt">... While Chuck Armstrong president of <b>the</b> <b>Seattle</b> <b>Mariners</b> <b>traveled</b> <b>all</b> <b>the</b> <b>way</b> <b>to</b> <b>Japan</b> <b>to</b> <b>watch</b> Ichiro... for <b>the</b> advancing <b>Japan</b> team last week <b>the</b> star from <b>the</b> <b>Seattle</b> roster so far in Round 1 has without a doubt... leading <b>the</b> Dominican <b>to</b> its...</span></fct:column>
+        </fct:row>
+        <fct:row>
+          <fct:column datatype="url" shortform="http://bobdupuy.mlbl...ld_baseball__6.html">http://bobdupuy.mlblogs.com/bobdupuy/2006/03/world_baseball__6.html</fct:column>
+          <fct:column/>
+          <fct:column><span class="srch_xerpt">Orlando While Chuck Armstrong president of <b>the</b> <b>Seattle</b> <b>Mariners</b> <b>traveled</b> <b>all</b> <b>the</b> <b>way</b> <b>to</b> <b>Japan</b> <b>to</b> <b>watch</b>... perform for <b>the</b> advancing <b>Japan</b> team last week <b>the</b> star from <b>the</b> <b>Seattle</b> roster so far in Round 1 has without...</span></fct:column>
+        </fct:row>
+      </fct:result>
+    </fct:facets>
+  </SOAP:Body>
+</SOAP:Envelope>
 ]]></programlisting>      	
-</listitem>                  
-    </orderedlist>
   </sect3>
 </sect2>
 </sect1>
@@ -32047,4294 +15796,5323 @@ RDF subject where the text occurs. The entity rank of the subject is defined by
 to it, weighed by the rank of the referrers and the outbound link count of referrers. Such techniques
 are used in text based information retrieval.
 </para>
-<para><emphasis>Example with Entity Ranking and Score</emphasis></para>
+<para><emphasis>Example with Entity Ranking and Score</emphasis></para>
+<programlisting><![CDATA[
+## Searching over labels, with text match
+## scores and additional ranks for each
+## iri / resource:
+
+SELECT ?s ?page ?label
+  ?textScore AS ?Text_Score_Rank
+  ( <LONG::IRI_RANK> (?s) ) AS ?Entity_Rank
+WHERE
+  {
+    ?s foaf:page ?page ;
+     rdfs:label ?label .
+    FILTER( lang( ?label ) = "en" ) .
+    ?label bif:contains 'adobe and flash'
+    OPTION (score ?textScore ) .
+  }
+]]></programlisting>
+<para>One interesting application of entity rank and inference on IFPs and <emphasis>owl:sameAs</emphasis> is in locating
+URIs for reuse. We can easily list synonym URIs in order of popularity as well as locate URIs based
+on associated text. This can serve in application such as the Entity Name Server
+</para>
+<para>Entity ranking is one of the few operations where we take a precomputing approach. Since a rank is
+calculated based on a possibly long chain of references, there is little choice but to precompute. The
+precomputation itself is straightforward enough: First all outbound references are counted for all
+subjects. Next all ranks of subjects are incremented by 1 over the referrer's outbound link count.
+On successive iterations, the increment is based on the rank increment the referrer received in
+the previous round.
+</para>
+<para>The operation is easily partitioned, since each partition increments the ranks of subjects it
+holds. The referrers are spread throughout the cluster, though. When rank is calculated, each partition
+accesses every other partition. This is done with relatively long messages, referee ranks are accessed
+in batches of several thousand at a time, thus absorbing network latency.
+</para>
+<para>On the test system, this operation performs a single pass over the corpus of 2.2 billion triples
+and 356 million distinct subjects in about 30 minutes. The operation has 100% utilization of all 16
+cores. Adding hardware would speed it up, as would implementing it in C instead of the SQL procedures
+it is written in at present.
+</para>
+<para>The main query in rank calculation is:
+</para>
+<programlisting><![CDATA[
+SPARQL
+SELECT O            ,
+       P            ,
+       iri_rank (S)
+FROM rdf_quad TABLE
+OPTION (NO CLUSTER)
+WHERE isiri_id(O)
+ORDER BY O
+]]></programlisting>
+<para>This is the SQL cursor iterated over by each partition. The no cluster option means that only rows
+in this process's partition are retrieved. The RDF_QUAD table holds the RDF quads in the store, i.e.,
+triple plus graph. The S, P, O columns are the subject, predicate, and object respectively. The graph
+column is not used here. The textttiri rank is a partitioned SQL function. This works by using the S
+argument to determine which cluster node should run the function. The specifics of the partitioning
+are declared elsewhere. The calls are then batched for each intended recipient and sent when the
+batches are full. The SQL compiler automatically generates the relevant control structures. This
+is like an implicit map operation in the map-reduce terminology.
+</para>
+<para>An SQL procedure loops over this cursor, adds up the rank and when seeing a new O, the added
+rank is persisted into a table. Since links in RDF are typed, we can use the semantics of the link
+to determine how much rank is transferred by a reference. With extraction of named entities from
+text content, we can further place a given entity into a referential context and use this as a
+weighting factor. This is to be explored in future work. The experience thus far shows that we
+greatly benefit from Virtuoso being a general purpose DBMS, as we can create application specific
+data structures and control flows where these are efficient. For example, it would make little
+sense to store entity ranks as triples due to space consumption and locality considerations. With
+these tools, the whole ranking functionality took under a week to develop.
+</para>
+<para><emphasis>Note:</emphasis> In order to use the IRI_RANK feature you need to have the
+Facet (fct) vad package installed as the procedure is part of this vad.
+</para>
+  </sect3>
+  <sect3 id="rdfiridereferencingfacetqel"><title>Query Evaluation Time Limits</title>
+<para>When scaling the Linked Data model, we have to take it as a given that the workload will be
+unexpected and that the query writers will often be unskilled in databases. Insofar possible, we
+wish to promote the forming of a culture of creative reuse of data. To this effect, even poorly
+formulated questions deserve an answer that is better than just timeout.
+</para>
+<para>If a query produces a steady stream of results, interrupting it after a certain quota is simple.
+However, most interesting queries do not work in this way. They contain aggregation, sorting, maybe
+transitivity.
+</para>
+<para>When evaluating a query with a time limit in a cluster setup, all nodes monitor the time left
+for the query. When dealing with a potentially partial query to begin with, there is little point in
+transactionality. Therefore the facet service uses read committed isolation. A read committed query
+will never block since it will see the before-image of any transactionally updated row. There will
+be no waiting for locks and timeouts can be managed locally by all servers in the cluster.
+</para>
+<para>Thus, when having a partitioned count, for example, we expect all the partitions to time out
+around the same time and send a ready message with the timeout information to the cluster node
+coordinating the query. The condition raised by hitting a partial evaluation time limit differs
+from a run time error in that it leaves the query state intact on all participating nodes. This
+allows the timeout handling to come fetch any accumulated aggregates.
+</para>
+<para>Let us consider the query for the top 10 classes of things with "Shakespeare" in some literal.
+This is typical of the workload generated by the faceted browsing web service:
+</para>
+<programlisting><![CDATA[
+SPARQL
+DEFINE  input:inference  "yago"
+SELECT ?c
+       COUNT (*)
+WHERE
+  {
+    ?s  a             ?c             ;
+        ?p            ?o             .
+    ?o  bif:contains  "Shakespeare"
+  }
+GROUP BY ?c
+ORDER BY DESC 2
+LIMIT 10
+]]></programlisting>
+<para>On the first execution with an entirely cold cache, this times out after 2 seconds and returns:
+</para>
+<programlisting><![CDATA[
+?c                                       COUNT (*)
+yago:class/yago/Entity100001740          566
+yago:class/yago/PhysicalEntity100001930  452
+yago:class/yago/Object100002684          452
+yago:class/yago/Whole100003553           449
+yago:class/yago/Organism100004475        375
+yago:class/yago/LivingThing100004258     375
+yago:class/yago/CausalAgent100007347     373
+yago:class/yago/Person100007846          373
+yago:class/yago/Abstraction100002137     150
+yago:class/yago/Communicator109610660    125
+]]></programlisting>
+<para>
+The next repeat gets about double the counts, starting with 1291 entities.
+</para>
+<para>With a warm cache, the query finishes in about 300 ms (4 core Xeon, Virtuoso 6 Cluster) and returns:
+</para>
+<programlisting><![CDATA[
+?c                                       COUNT (*)
+yago:class/yago/Entity100001740          13329
+yago:class/yago/PhysicalEntity100001930  10423
+yago:class/yago/Object100002684          10408
+yago:class/yago/Whole100003553           10210
+yago:class/yago/LivingThing100004258      8868
+yago:class/yago/Organism100004475         8868
+yago:class/yago/CausalAgent100007347      8853
+yago:class/yago/Person100007846           8853
+yago:class/yago/Abstraction100002137      3284
+yago:class/yago/Entertainer109616922      2356
+]]></programlisting>
+<para>It is a well known fact that running from memory is thousands of times faster than from disk.
+</para>
+<para>The query plan begins with the text search. The subjects with "Shakespeare" in some property get
+dispatched to the partition that holds their class. Since all partitions know the class hierarchy,
+the superclass inference runs in parallel, as does the aggregation of the group by. When all
+partitions have finished, the process coordinating the query fetches the partial aggregates,
+adds them up and sorts them by count.
+</para>
+<para>If a timeout occurs, it will most likely occur where the classes of the text matches are being
+retrieved. When this happens, this part of the query is reset, but the aggregate states are left
+in place. The process coordinating the query then goes on as if the aggregates had completed. If
+there are many levels of nested aggregates, each timeout terminates the innermost aggregation that
+is still accumulating results, thus a query is guaranteed to return in no more than n timeouts,
+where n is the number of nested aggregations or subqueries.
+</para>
+  </sect3>
+  <sect3 id="rdfiridereferencingfacetws"><title>Facets Web Service and Linked Data</title>
+<para>The Virtuoso Facets web service is a general purpose RDF query facility for facet based browsing.
+It takes an XML description of the view desired and generates the reply as an XML tree containing the
+requested data. The user agent or a local web page can use XSLT for rendering this for the end user.
+The selection of facets and values is represented as an XML tree. The rationale for this is the fact
+that such a representation is easier to process in an application than the SPARQL source text or a
+parse tree of SPARQL and more compactly captures the specific subset of SPARQL needed for faceted
+browsing. All such queries internally generate SPARQL and the SPARQL generated is returned with
+the results. One can therefore use this is a starting point for hand crafted queries.
+</para>
+<para>The query has the top level element. The child elements of this represents conditions pertaining
+to a single subject. A join is expressed with the property or propertyof element. This has in turn
+children which state conditions on a property of the first subject. Property and propertyof elements
+can be nested to an arbitrary depth and many can occur inside one containing element. In this way,
+tree-shaped structures of joins can be expressed.
+</para>
+<para>Expressing more complex relationships, such as intermediate grouping, subqueries, arithmetic or
+such requires writing the query in SPARQL. The XML format is for easy automatic composition of queries
+needed for showing facets, not a replacement for SPARQL.
+</para>
+<para>Consider composing a map of locations involved with Napoleon. Below we list user actions and
+the resulting XML query descriptions.
+</para>
+<itemizedlist mark="bullet">
+  <listitem>Enter in the search form "Napoleon":
+<programlisting><![CDATA[
+<query inference="" same-as="" view3="" s-term="e" c-term="type">
+  <text>napoleon</text>
+  <view type="text" limit="20" offset="" />
+</query>
+]]></programlisting>
+</listitem>
+  <listitem>Select the "types" view:
+<programlisting><![CDATA[
+<query inference="" same-as="" view3="" s-term="e" c-term="type">
+  <text>napoleon</text>
+  <view type="classes" limit="20" offset="0" location-prop="0" />
+</query>
+]]></programlisting>
+</listitem>
+  <listitem>Choose "MilitaryConflict" type:
+<programlisting><![CDATA[
+<query inference="" same-as="" view3="" s-term="e" c-term="type">
+  <text>napoleon</text>
+  <view type="classes" limit="20" offset="0" location-prop="0" />
+  <class iri="yago:ontology/MilitaryConflict" />
+</query>
+]]></programlisting>
+</listitem>
+  <listitem>Choose "NapoleonicWars":
+<programlisting><![CDATA[
+<query inference="" same-as="" view3="" s-term="e" c-term="type">
+  <text>napoleon</text>
+  <view type="classes" limit="20" offset="0" location-prop="0" />
+  <class iri="yago:ontology/MilitaryConflict" />
+  <class iri="yago:class/yago/NapoleonicWars" />
+</query>
+]]></programlisting>
+</listitem>
+  <listitem>Select "any location" in the select list beside the "map" link; then hit "map" link:
+<programlisting><![CDATA[
+<query inference="" same-as="" view3="" s-term="e" c-term="type">
+  <text>napoleon</text>
+  <class iri="yago:ontology/MilitaryConflict" />
+  <class iri="yago:class/yago/NapoleonicWars" />
+  <view type="geo" limit="20" offset="0" location-prop="any" />
+</query>
+]]></programlisting>
+</listitem>
+</itemizedlist>
+<para>This last XML fragment corresponds to the below text of SPARQL query:
+</para>
 <programlisting><![CDATA[
-## Searching over labels, with text match
-## scores and additional ranks for each
-## iri / resource:
-
-SELECT ?s ?page ?label
-  ?textScore AS ?Text_Score_Rank
-  ( <LONG::IRI_RANK> (?s) ) AS ?Entity_Rank
+SPARQL
+SELECT ?location AS ?c1
+       ?lat1     AS ?c2
+       ?lng1     AS ?c3
 WHERE
   {
-    ?s foaf:page ?page ;
-     rdfs:label ?label .
-    FILTER( lang( ?label ) = "en" ) .
-    ?label bif:contains 'adobe and flash'
-    OPTION (score ?textScore ) .
+    ?s1        ?s1textp  ?o1                              .
+    FILTER
+      ( bif:contains (?o1, '"Napoleon"') )  .
+    ?s1        a         <yago:ontology/MilitaryConflict>  .
+    ?s1        a         <yago:class/yago/NapoleonicWars>  .
+    ?s1        ?anyloc   ?location                         .
+    ?location  geo:lat   ?lat1                             ;
+               geo:long  ?lng1
   }
+LIMIT 200
+OFFSET 0
 ]]></programlisting>
-<para>One interesting application of entity rank and inference on IFPs and <emphasis>owl:sameAs</emphasis> is in locating
-URIs for reuse. We can easily list synonym URIs in order of popularity as well as locate URIs based
-on associated text. This can serve in application such as the Entity Name Server
+<para>
+The query takes all subjects with some literal property with "Napoleon" in it, then filters for
+military conflicts and Napoleonic wars, then takes all objects related to these where the related
+object has a location. The map has the objects and their locations.
 </para>
-<para>Entity ranking is one of the few operations where we take a precomputing approach. Since a rank is
-calculated based on a possibly long chain of references, there is little choice but to precompute. The
-precomputation itself is straightforward enough: First all outbound references are counted for all
-subjects. Next all ranks of subjects are incremented by 1 over the referrer's outbound link count.
-On successive iterations, the increment is based on the rank increment the referrer received in
-the previous round.
+  <tip><title>See Also:</title>
+    <itemizedlist mark="bullet">
+      <listitem><link linkend="virtuosospongerfacent">Virtuoso Facets Web Service</link></listitem>
+      <listitem><link linkend="virtuosospongerfacentuirestapi">Virtuoso APIs for Facet REST services</link></listitem>
+    </itemizedlist>
+  </tip>
+  </sect3>
+  <sect3 id="rdfiridereferencingfacetvd"><title>voiD Discoverability</title>
+<para>A long awaited addition to the LOD cloud is the Vocabulary of Interlinked Data (voiD).
+Virtuoso automatically generates voiD descriptions of data sets it hosts. Virtuoso incorporates an
+SQL function <emphasis>rdf_void_gen</emphasis> which returns a Turtle representation of a given
+graph's voiD statistics.
 </para>
-<para>The operation is easily partitioned, since each partition increments the ranks of subjects it
-holds. The referrers are spread throughout the cluster, though. When rank is calculated, each partition
-accesses every other partition. This is done with relatively long messages, referee ranks are accessed
-in batches of several thousand at a time, thus absorbing network latency.
+  </sect3>
+  <sect3 id="rdfiridereferencingfacet"><title>Test System and Data</title>
+<para>The test system consists of two 2x4 core Xeon 5345, 2.33 GHz servers with 16G RAM and 4 disks
+each. The machines are connected by two 1Gbit Ethernet connections. The software is Virtuoso 6
+Cluster. The Virtuoso server is split into 16 partitions, 8 for each machine. Each partition is
+managed by a separate server process.
 </para>
-<para>On the test system, this operation performs a single pass over the corpus of 2.2 billion triples
-and 356 million distinct subjects in about 30 minutes. The operation has 100% utilization of all 16
-cores. Adding hardware would speed it up, as would implementing it in C instead of the SQL procedures
-it is written in at present.
+<para>The test database has the following data sets:
 </para>
-<para>The main query in rank calculation is:
+<itemizedlist mark="bullet">
+  <listitem>DBpedia 3.2</listitem>
+  <listitem>MusicBrainz</listitem>
+  <listitem>Bio2RDF</listitem>
+  <listitem>NeuroCommons</listitem>
+  <listitem>UniProt</listitem>
+  <listitem>Freebase (95M triples)</listitem>
+  <listitem>PingTheSemanticWeb (1.6M miscellaneous files from http://www.pingthesemanticweb.com/).</listitem>
+</itemizedlist>
+<para>Ontologies:
 </para>
-<programlisting><![CDATA[
-SPARQL
-SELECT O            ,
-       P            ,
-       iri_rank (S)
-FROM rdf_quad TABLE
-OPTION (NO CLUSTER)
-WHERE isiri_id(O)
-ORDER BY O
-]]></programlisting>
-<para>This is the SQL cursor iterated over by each partition. The no cluster option means that only rows
-in this process's partition are retrieved. The RDF_QUAD table holds the RDF quads in the store, i.e.,
-triple plus graph. The S, P, O columns are the subject, predicate, and object respectively. The graph
-column is not used here. The textttiri rank is a partitioned SQL function. This works by using the S
-argument to determine which cluster node should run the function. The specifics of the partitioning
-are declared elsewhere. The calls are then batched for each intended recipient and sent when the
-batches are full. The SQL compiler automatically generates the relevant control structures. This
-is like an implicit map operation in the map-reduce terminology.
+<itemizedlist mark="bullet">
+  <listitem>Yago</listitem>
+  <listitem>OpenCyc</listitem>
+  <listitem>Umbel</listitem>
+  <listitem>DBpedia</listitem>
+</itemizedlist>
+<para>The database is 2.2 billion triples with 356 million distinct URIs.
 </para>
-<para>An SQL procedure loops over this cursor, adds up the rank and when seeing a new O, the added
-rank is persisted into a table. Since links in RDF are typed, we can use the semantics of the link
-to determine how much rank is transferred by a reference. With extraction of named entities from
-text content, we can further place a given entity into a referential context and use this as a
-weighting factor. This is to be explored in future work. The experience thus far shows that we
-greatly benefit from Virtuoso being a general purpose DBMS, as we can create application specific
-data structures and control flows where these are efficient. For example, it would make little
-sense to store entity ranks as triples due to space consumption and locality considerations. With
-these tools, the whole ranking functionality took under a week to develop.
+  </sect3>
+</sect2>
+  <tip><title>See Also:</title>
+    <itemizedlist mark="bullet">
+      <listitem><link linkend="virtuosospongerfacetinstall">Virtuoso Facet Browser Installation and configuration</link></listitem>
+    </itemizedlist>
+  </tip>
+</sect1>
+
+
+<sect1 id="rdfsparqlrule"><title>Inference Rules & Reasoning</title>
+<sect2 id="rdfsparqlruleintro"><title>Introduction</title>
+<para>Virtuoso SPARQL can use an inference context for inferring triples that are not physically stored.
+This functionality applies to physically stored quads and not to virtual triples generated from relational data with RDF views.
+Such an inference context can be built from one or more graphs containing RDF Schema triples. The supported
+RDF Schema or OWL constraints are imported from these graphs and are grouped together into rule bases.
+A rule base is a persistent entity that can be referenced by a SPARQL query or end point. Queries running
+with a given rule base work as if the triples asserted by this rule base were included in the graph or graphs accessed by the query.
 </para>
-<para><emphasis>Note:</emphasis> In order to use the IRI_RANK feature you need to have the
-Facet (fct) vad package installed as the procedure is part of this vad.
+<para>As of version 5.0, Virtuoso recognizes <emphasis>rdfs:subClassOf</emphasis> and <emphasis>rdfs:subPropertyOf</emphasis>.
+owl:sameAs is considered for arbitrary subjects and objects if specially enabled by a pragma in the query.
+As of 5.00.3031, owl:sameAs, owl:equivalentClass and owl:equivalentProperty are also considered when determining subclass or subproperty relations.  If two  classes are equivalent, they share all instances, subclasses and superclasses directly or indirectly stated in the data for either class.
+Other RDF Schema or OWL information is not taken into account.
 </para>
-  </sect3>
-  <sect3 id="rdfiridereferencingfacetqel"><title>Query Evaluation Time Limits</title>
-<para>When scaling the Linked Data model, we have to take it as a given that the workload will be
-unexpected and that the query writers will often be unskilled in databases. Insofar possible, we
-wish to promote the forming of a culture of creative reuse of data. To this effect, even poorly
-formulated questions deserve an answer that is better than just timeout.
+</sect2>
+<sect2 id="rdfsparqlrulemake"><title>Making Rule Sets</title>
+<para>Since RDF Schema and OWL schemas are RDF graphs, these can be loaded into the triple store. Thus, in order to use
+such a schema as query context, one first loads the corresponding document into the triple store using <emphasis>ttlp</emphasis> or
+<emphasis>rdf_load_rdfxml</emphasis> or related functions. After the schema document is loaded, one can add the assertions therein
+into an inference context with the <emphasis>rdfs_rule_set</emphasis> function. This function specifies a logical name for the rule
+set plus a graph URI. It is possible to combine multiple schema graphs into a single rule set. A single schema
+graph may also independently participate in multiple rule sets.
 </para>
-<para>If a query produces a steady stream of results, interrupting it after a certain quota is simple.
-However, most interesting queries do not work in this way. They contain aggregation, sorting, maybe
-transitivity.
+<programlisting>
+rdfs_rule_set (in name varchar, in uri varchar, in remove int := 0)
+</programlisting>
+<para>This function adds the applicable facts of the graph into a rule set. The graph URI must correspond
+to the graph IRI of a graph stored in the triple store of the Virtuoso instance. If the remove argument
+is true, the specified graph is removed from the rule set instead.
 </para>
-<para>When evaluating a query with a time limit in a cluster setup, all nodes monitor the time left
-for the query. When dealing with a potentially partial query to begin with, there is little point in
-transactionality. Therefore the facet service uses read committed isolation. A read committed query
-will never block since it will see the before-image of any transactionally updated row. There will
-be no waiting for locks and timeouts can be managed locally by all servers in the cluster.
+</sect2>
+<sect2 id="rdfsparqlrulechange"><title>Changing Rule Sets</title>
+<para>Changing a rule set affects queries made after the change. Some queries may have been previously
+compiled and will not be changed as a result of modifying the rule set. When a rule set is changed, i.e.
+when <emphasis>rdfs_rule_set</emphasis> is called with the first argument set to a pre-existing rule set's name, all the graphs
+associated with this name are read and the relevant facts are added to a new empty rule set. Thus, if
+triples are deleted from or added to the graphs comprising the rule set, calling <emphasis>rdfs_rule_set</emphasis> will refresh
+the rule set to correspond to the state of the stored graphs.
 </para>
-<para>Thus, when having a partitioned count, for example, we expect all the partitions to time out
-around the same time and send a ready message with the timeout information to the cluster node
-coordinating the query. The condition raised by hitting a partial evaluation time limit differs
-from a run time error in that it leaves the query state intact on all participating nodes. This
-allows the timeout handling to come fetch any accumulated aggregates.
+</sect2>
+<sect2 id="rdfsparqlrulesubclassandsubprop"><title>Subclasses and Subproperties</title>
+<para>Virtuoso SPARQL supports RDF Schema subclasses and subproperties.
 </para>
-<para>Let us consider the query for the top 10 classes of things with "Shakespeare" in some literal.
-This is typical of the workload generated by the faceted browsing web service:
+<para>The predicates <emphasis>rdfs:subClassOf</emphasis> and <emphasis>rdfs:subPropertyOf</emphasis> are
+recognized when they appear in graphs included in a rule set. When such a rule set is specified as a context
+for a SPARQL query, the following extra triples are generated as needed.
 </para>
+<para>For every <emphasis>?s rdf:type ?class</emphasis>, a triple <emphasis>?s rdf:type ?superclass</emphasis> is considered to exist,
+such that <emphasis>?superclass</emphasis> is a direct or indirect superclass of <emphasis>?class</emphasis>. Direct superclasses are
+declared with the <emphasis>rdfs:subClassOf</emphasis> predicate in the rule set graph. Transitivity of superclasses
+is automatically taken into account, meaning that if a is a superclass of b and b a superclass of c,
+then a is a superclass of c also. Cyclic superclass relations are not allowed. If such occur in the rule set data,
+the behavior is undefined but will not involve unterminating recursion.
+</para>
+<para>For every <emphasis>?s ?subpredicate ?o</emphasis>, a triple <emphasis>?s ?superpredicate ?o</emphasis>
+is considered to exist if the rule context declares <emphasis>?superpredicate</emphasis> to be a superpredicate
+of <emphasis>?predicate</emphasis>. This is done by having the triple <emphasis>?subpredicate rdfs:subPropertyOf ?superpredicate</emphasis>
+as part of the graphs making up the rule context. Transitivity is observed, thus if a is a subpredicate of b and b
+a subpredicate of c, then a is also a subpredicate of c.
+</para>
+</sect2>
+<sect2 id="rdfsameas"><title>OWL sameAs Support</title>
+<para>
+Virtuoso has limited support for the OWL sameAs predicate.
+</para>
+<para>
+If sameAs traversal is enabled and a triple pattern with a given
+subject or object is being matched, all the synonyms of the S and O
+will be tried and results generated for all the tried bindings of S
+and O. The set of synonyms is generated at run time by following all
+owl:sameAs triples where the IRI in question is either the subject or
+the object. These are followed recursively from object to subject and
+subject to object until the complete transitive closure is generated.
+All sameAs triples from all the graphs applicable to instantiating
+the triple pattern at hand are considered.
+</para>
+<para>
+Thus for example:
+</para>
+<para>The inital SPARQL query:</para>
 <programlisting><![CDATA[
-SPARQL
-DEFINE  input:inference  "yago"
-SELECT ?c
-       COUNT (*)
-WHERE
-  {
-    ?s  a             ?c             ;
-        ?p            ?o             .
-    ?o  bif:contains  "Shakespeare"
+SQL>SPARQL
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+SELECT *
+from <http://myopenlink.net/dataspace>
+where
+ {
+    ?person a foaf:Person FILTER REGEX(?person ,"http://myopenlink.net/dataspace/person/kidehen#this").
+    ?person foaf:name ?name .
+    ?person owl:sameAs ?sameas .
   }
-GROUP BY ?c
-ORDER BY DESC 2
-LIMIT 10
+limit 10;
+person                                               name             sameas
+VARCHAR                                              VARCHAR          VARCHAR
+_______________________________________________________________________________
+
+http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this
+http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://my.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this
+http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://kidehen.idehen.net/dataspace/person/kidehen#this
+http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://qdos.com/user/e922b748a2eb667bf37b188018002dec
+http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://knowee.net/kidehen/ids/id3684976382
+http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://dbpedia.org/resource/Kingsley_Idehen
+http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://dbtune.org/last-fm/kidehen
+http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://revyu.com/people/kidehen
+http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://identi.ca/user/14092
+http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://myopenlink.net/proxy?url=http%3A%2F%2Fwww.facebook.com%2Fpeople%2FKingsley_Idehen%2F605980750&force=rdf&login=kidehen
+
+10 Rows. -- 181 msec.
 ]]></programlisting>
-<para>On the first execution with an entirely cold cache, this times out after 2 seconds and returns:
-</para>
+<para>So if we have:</para>
 <programlisting><![CDATA[
-?c                                       COUNT (*)
-yago:class/yago/Entity100001740          566
-yago:class/yago/PhysicalEntity100001930  452
-yago:class/yago/Object100002684          452
-yago:class/yago/Whole100003553           449
-yago:class/yago/Organism100004475        375
-yago:class/yago/LivingThing100004258     375
-yago:class/yago/CausalAgent100007347     373
-yago:class/yago/Person100007846          373
-yago:class/yago/Abstraction100002137     150
-yago:class/yago/Communicator109610660    125
+<http://myopenlink.net/dataspace/person/kidehen#this>  	<http://www.w3.org/2002/07/owl#sameAs> <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this> .
+<http://myopenlink.net/dataspace/person/kidehen#this>  	<http://xmlns.com/foaf/0.1/name>  	Kingsley Idehen
 ]]></programlisting>
 <para>
-The next repeat gets about double the counts, starting with 1291 entities.
+and we instantiate <emphasis>?s <http://xmlns.com/foaf/0.1/name> "Kingsley Idehen"</emphasis>
+we get <emphasis>?s</emphasis> bound to <emphasis><http://myopenlink.net/dataspace/person/kidehen#this></emphasis>.
 </para>
-<para>With a warm cache, the query finishes in about 300 ms (4 core Xeon, Virtuoso 6 Cluster) and returns:
+<para>
+If we instantiate <emphasis><http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this>
+<http://xmlns.com/foaf/0.1/name> ?l</emphasis>
+we get <emphasis>?l</emphasis> bound to <emphasis>"Kingsley Idehen"</emphasis> because the subject was given and it was expanded to its synonyms.
+</para>
+
+
+
+
+<para>
+If binding a variable in a pattern where the variable was free, we do not expand the value to the complete set of its synonyms.
+</para>
+<para>
+Same-as expansion is enabled in a query by <emphasis>define input:same-as "yes"</emphasis> in the beginning of the SPARQL query.
+This has a significant run time cost but is in some cases useful when joining data between sets which are mapped to each other with same-as.
+</para>
+<para>
+We note that the number of same-as expansions will depend on the join order used for the SPARQL query.
+The compiler does not know the number of synonyms and cannot set the join order accordingly.
+Regardless of the join order we will however get at least one IRI of the each synonym set as answer.
+Also when interactively navigating a graph with a browser, the same-as expansion will take all synonyms into account.
+</para>
+<para>
+For getting the complete entailment of same-as, a forward
+chaining approach should be used, effectively asserting all the
+implied triples.
 </para>
+<sect3 id="rdfsameasexmp"><title>OWL sameAs Example</title>
 <programlisting><![CDATA[
-?c                                       COUNT (*)
-yago:class/yago/Entity100001740          13329
-yago:class/yago/PhysicalEntity100001930  10423
-yago:class/yago/Object100002684          10408
-yago:class/yago/Whole100003553           10210
-yago:class/yago/LivingThing100004258      8868
-yago:class/yago/Organism100004475         8868
-yago:class/yago/CausalAgent100007347      8853
-yago:class/yago/Person100007846           8853
-yago:class/yago/Abstraction100002137      3284
-yago:class/yago/Entertainer109616922      2356
+SQL>SPARQL
+DEFINE input:same-as "yes"
+SELECT *
+WHERE
+ {
+   ?s <http://xmlns.com/foaf/0.1/name> "Kingsley Idehen" .
+ }
+LIMIT 10;
+
+s
+VARCHAR
+___________________________________________________
+http://myopenlink.net/dataspace/person/kidehen#this
+http://myopenlink.net/dataspace/person/kidehen#this
+http://myopenlink.net/dataspace/person/kidehen#this
+http://myopenlink.net/dataspace/person/kidehen#this
+http://myopenlink.net/dataspace/person/kidehen#this
+http://myopenlink.net/dataspace/person/kidehen#this
+http://demo.openlinksw.com/dataspace/kingsley#person
+http://myopenlink.net/dataspace/person/kidehen#this
+http://myopenlink.net/dataspace/person/kidehen#this
+http://myopenlink.net/dataspace/person/kidehen#this
+No. of rows in result: 10
 ]]></programlisting>
-<para>It is a well known fact that running from memory is thousands of times faster than from disk.
+</sect3>
+</sect2>
+<sect2 id="rdfsparqlruleintro"><title>Implementation</title>
+<para>Triples entailed by subclass or subproperty statements in an inference context are not physically stored.
+Such triples are added to the result set by the query run time as needed. Also queries involving subclass or subproperty
+rules are not rewritten into unions of all the possible triple patterns that might imply the pattern that is requested.
+Instead, the SQL compiler adds special nodes that iterate over subclasses or subproperties at run time. The cost model
+also takes subclasses and subproperties into account when determining the approximate cardinality of triple patterns.
 </para>
-<para>The query plan begins with the text search. The subjects with "Shakespeare" in some property get
-dispatched to the partition that holds their class. Since all partitions know the class hierarchy,
-the superclass inference runs in parallel, as does the aggregation of the group by. When all
-partitions have finished, the process coordinating the query fetches the partial aggregates,
-adds them up and sorts them by count.
+<para>In essence, Virtuoso's support for subclasses and subproperties is backward chaining, i.e. it does not materialize
+all implied triples but rather looks for the basic facts implying these triples at query evaluation time.
 </para>
-<para>If a timeout occurs, it will most likely occur where the classes of the text matches are being
-retrieved. When this happens, this part of the query is reset, but the aggregate states are left
-in place. The process coordinating the query then goes on as if the aggregates had completed. If
-there are many levels of nested aggregates, each timeout terminates the innermost aggregation that
-is still accumulating results, thus a query is guaranteed to return in no more than n timeouts,
-where n is the number of nested aggregations or subqueries.
+</sect2>
+<sect2 id="rdfsparqlruleintro"><title>Enabling Inferencing</title>
+<para>In a SPARQL query, the define input:inference clause is used to instruct the compiler to use the rules in the named rule set. For example:
 </para>
-  </sect3>
-  <sect3 id="rdfiridereferencingfacetws"><title>Facets Web Service and Linked Data</title>
-<para>The Virtuoso Facets web service is a general purpose RDF query facility for facet based browsing.
-It takes an XML description of the view desired and generates the reply as an XML tree containing the
-requested data. The user agent or a local web page can use XSLT for rendering this for the end user.
-The selection of facets and values is represented as an XML tree. The rationale for this is the fact
-that such a representation is easier to process in an application than the SPARQL source text or a
-parse tree of SPARQL and more compactly captures the specific subset of SPARQL needed for faceted
-browsing. All such queries internally generate SPARQL and the SPARQL generated is returned with
-the results. One can therefore use this is a starting point for hand crafted queries.
+<programlisting>
+SQL> rdfs_rule_set ('sample', 'rule_graph');
+
+SQL> SPARQL
+define input:inference "sample"
+SELECT *
+FROM <g>
+WHERE {?s ?p ?o};
+</programlisting>
+<para>will include all the implied triples in the result set, using the rules in the sample rule set.
 </para>
-<para>The query has the top level element. The child elements of this represents conditions pertaining
-to a single subject. A join is expressed with the property or propertyof element. This has in turn
-children which state conditions on a property of the first subject. Property and propertyof elements
-can be nested to an arbitrary depth and many can occur inside one containing element. In this way,
-tree-shaped structures of joins can be expressed.
+<para>Inference can be enabled triple pattern by triple pattern. This is done with the option
+(inference 'rule_set') clause after the triple pattern concerned. Specifying option (inference none)
+will disable inference for the pattern concerned while the default inference context applies to the
+rest of the patterns. Note that the keyword is input:inference in the query header and simply inference
+in the option clause. See the examples section below for examples.
 </para>
-<para>Expressing more complex relationships, such as intermediate grouping, subqueries, arithmetic or
-such requires writing the query in SPARQL. The XML format is for easy automatic composition of queries
-needed for showing facets, not a replacement for SPARQL.
+<para>In SQL, if RDF_QUAD occurs in a select from clause, inference can be added with the table option <emphasis>WITH</emphasis>, as follows:
 </para>
-<para>Consider composing a map of locations involved with Napoleon. Below we list user actions and
-the resulting XML query descriptions.
+<programlisting>
+SPARQL
+SELECT *
+FROM rdf_quad table OPTION (with 'sample')
+WHERE g = iri_to_id ('xx', 0);
+</programlisting>
+<para>This is about the same as:
 </para>
-<itemizedlist mark="bullet">
-  <listitem>Enter in the search form "Napoleon":
+<programlisting>
+SPARQL
+define input:inference "sample"
+SELECT *
+FROM <xx>
+WHERE {?s ?p ?o}
+</programlisting>
+</sect2>
+<sect2 id="rdfsparqlruleexamples"><title>Examples</title>
+<sect3 id="rdfsparqlruleexamples1"><title>Example for loading data space instance data Triples
+into a Named Graph for schema/ontology data</title>
+<para>The following example shows how to load data space instance data Triples
+into a Named Graph: <http://localhost:8890/test>, for schema/ontology data called:
+<http://localhost:8890/schema/test> that expresses assertions about subclasses and
+subproperties.</para>
 <programlisting><![CDATA[
-<query inference="" same-as="" view3="" s-term="e" c-term="type">
-  <text>napoleon</text>
-  <view type="text" limit="20" offset="" />
-</query>
+ttlp ('
+   <http://localhost:8890/dataspace>  	                        <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>  <http://rdfs.org/sioc/ns#Space>.
+   <http://localhost:8890/dataspace/test2/weblog/test2tWeblog>  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>  <http://rdfs.org/sioc/types#Weblog> .
+   <http://localhost:8890/dataspace/discussion/oWiki-test1Wiki> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>  <http://rdfs.org/sioc/types#MessageBoard>.
+   <http://localhost:8890/dataspace>                            <http://rdfs.org/sioc/ns#link>                     <http://localhost:8890/ods> .
+   <http://localhost:8890/dataspace/test2/weblog/test2tWeblog>  <http://rdfs.org/sioc/ns#link>                     <http://localhost:8890/dataspace/test2/weblog/test2tWeblog>.
+   <http://localhost:8890/dataspace/discussion/oWiki-test1Wiki> <http://rdfs.org/sioc/ns#link>                     <http://localhost:8890/dataspace/discussion/oWiki-test1Wiki> .
+   ', '', 'http://localhost:8890/test');
 ]]></programlisting>
-</listitem>
-  <listitem>Select the "types" view:
 <programlisting><![CDATA[
-<query inference="" same-as="" view3="" s-term="e" c-term="type">
-  <text>napoleon</text>
-  <view type="classes" limit="20" offset="0" location-prop="0" />
-</query>
+ttlp (' @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+  <http://rdfs.org/sioc/ns#Space> rdfs:subClassOf <http://www.w3.org/2000/01/rdf-schema#Resource> .
+  <http://rdfs.org/sioc/ns#Container> rdfs:subClassOf <http://rdfs.org/sioc/ns#Space> .
+  <http://rdfs.org/sioc/ns#Forum> rdfs:subClassOf <http://rdfs.org/sioc/ns#Container> .
+  <http://rdfs.org/sioc/types#Weblog> rdfs:subClassOf <http://rdfs.org/sioc/ns#Forum> .
+  <http://rdfs.org/sioc/types#MessageBoard> rdfs:subClassOf <http://rdfs.org/sioc/ns#Forum> .
+  <http://rdfs.org/sioc/ns#link> rdfs:subPropertyOf <http://rdfs.org/sioc/ns> .
+  ', '', 'http://localhost:8890/schema/test');
 ]]></programlisting>
-</listitem>
-  <listitem>Choose "MilitaryConflict" type:
+<programlisting>
+rdfs_rule_set ('http://localhost:8890/schema/property_rules1', 'http://localhost:8890/schema/test');
+</programlisting>
+<para>This defines the rule context http://localhost:8890/schema/property_rules1 that is initialized
+from the contents of graph http://localhost:8890/schema/test.
+</para>
+<programlisting><![CDATA[
+SQL>SPARQL
+define input:inference "http://localhost:8890/schema/property_rules1"
+SELECT ?s
+FROM <http://localhost:8890/test>
+WHERE {?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>  <http://rdfs.org/sioc/ns#Space> };
+s
+VARCHAR
+_______________________________________________________________________________
+
+http://localhost:8890/dataspace/test2/weblog/test2tWeblog
+http://localhost:8890/dataspace/discussion/oWiki-test1Wiki
+http://localhost:8890/dataspace
+
+3 Rows. -- 0 msec.
+]]></programlisting>
+<para>This returns the instances of http://rdfs.org/sioc/ns#Space. Since http://rdfs.org/sioc/types#Weblog
+and http://rdfs.org/sioc/types#MessageBoard are subclasses of http://rdfs.org/sioc/ns#Space,
+instances of http://rdfs.org/sioc/ns#Space, http://rdfs.org/sioc/types#Weblog and
+http://rdfs.org/sioc/types#MessageBoard are all returned. This results in the subjects
+http://localhost:8890/dataspace, http://localhost:8890/dataspace/test2/weblog/test2tWeblog and
+http://localhost:8890/dataspace/discussion/oWiki-test1Wiki.
+</para>
+<programlisting><![CDATA[
+SQL>SELECT id_to_iri (s)
+FROM rdf_quad table option (with 'http://localhost:8890/schema/property_rules1')
+WHERE g = iri_to_id ('http://localhost:8890/test',0)
+  AND p = iri_to_id ('http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 0)
+  AND o = iri_to_id ('http://rdfs.org/sioc/ns#Space', 0);
+callret
+VARCHAR
+_______________________________________________________________________________
+
+http://localhost:8890/dataspace/test2/weblog/test2tWeblog
+http://localhost:8890/dataspace/discussion/oWiki-test1Wiki
+http://localhost:8890/dataspace
+
+3 Rows. -- 10 msec.
+]]></programlisting>
+<para>This is the corresponding SQL query, internally generated by the SPARQL query.</para>
+<para>Below we first look for all instances of http://rdfs.org/sioc/ns#Space with some
+property set to http://localhost:8890/dataspace/test2/weblog/test2tWeblog.
+We get the subject http://localhost:8890/dataspace/test2/weblog/test2tWeblog and the
+properties http://rdfs.org/sioc/ns#link and http://rdfs.org/sioc/ns.
+The join involves both subclass and subproperty inference. Then we turn off the inference
+for the second pattern and only get the property http://rdfs.org/sioc/ns#link. Then we do
+the same but now specify that inference should apply only to the first triple pattern.
+</para>
 <programlisting><![CDATA[
-<query inference="" same-as="" view3="" s-term="e" c-term="type">
-  <text>napoleon</text>
-  <view type="classes" limit="20" offset="0" location-prop="0" />
-  <class iri="yago:ontology/MilitaryConflict" />
-</query>
+
+SQL>SPARQL
+define input:inference  "http://localhost:8890/schema/property_rules1"
+SELECT *
+FROM <http://localhost:8890/test>
+WHERE
+  {
+    ?s ?p <http://rdfs.org/sioc/ns#Space> .
+    ?s ?p1 <http://localhost:8890/dataspace/test2/weblog/test2tWeblog> .
+  };
+
+s             p              p1
+VARCHAR       VARCHAR       VARCHAR
+_______________________________________________________________________________
+
+http://localhost:8890/dataspace/test2/weblog/test2tWeblog  http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://rdfs.org/sioc/ns#link
+http://localhost:8890/dataspace/test2/weblog/test2tWeblog  http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://rdfs.org/sioc/ns
+
+2 Rows. -- 0 msec.
+
+
+SQL>SPARQL
+SELECT *
+FROM <http://localhost:8890/test>
+WHERE
+  {
+    ?s ?p <http://rdfs.org/sioc/ns#Space> OPTION (inference 'http://localhost:8890/schema/property_rules1') .
+    ?s ?p1 <http://localhost:8890/dataspace/test2/weblog/test2tWeblog> .
+  };
+
+s             p              p1
+VARCHAR       VARCHAR        VARCHAR
+_______________________________________________________________________________
+
+http://localhost:8890/dataspace/test2/weblog/test2tWeblog  http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://rdfs.org/sioc/ns#link
+
+1 Rows. -- 10 msec.
+
 ]]></programlisting>
-</listitem>
-  <listitem>Choose "NapoleonicWars":
+</sect3>
+<sect3 id="rdfsparqlruleexamples2"><title>DBpedia example</title>
 <programlisting><![CDATA[
-<query inference="" same-as="" view3="" s-term="e" c-term="type">
-  <text>napoleon</text>
-  <view type="classes" limit="20" offset="0" location-prop="0" />
-  <class iri="yago:ontology/MilitaryConflict" />
-  <class iri="yago:class/yago/NapoleonicWars" />
-</query>
+ttlp ('
+ prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ <http://dbpedia.org/property/birthcity> rdfs:subPropertyOf <http://dbpedia.org/property/birthPlace> .
+ <http://dbpedia.org/property/birthcountry> rdfs:subPropertyOf  <http://dbpedia.org/property/birthPlace> .
+ <http://dbpedia.org/property/cityofbirth> rdfs:subPropertyOf <http://dbpedia.org/property/birthPlace> .
+ <http://dbpedia.org/property/countryofbirth> rdfs:subPropertyOf <http://dbpedia.org/property/birthPlace> .
+ <http://dbpedia.org/property/countyofbirth> rdfs:subPropertyOf <http://dbpedia.org/property/birthPlace> .
+ <http://dbpedia.org/property/cityofdeath> rdfs:subPropertyOf <http://dbpedia.org/property/deathPlace> .
+ <http://dbpedia.org/property/countryofdeath> rdfs:subPropertyOf <http://dbpedia.org/property/deathPlace> . ', '',
+ 'http://dbpedia.org/inference/rules#') ;
+
+rdfs_rule_set ('http://dbpedia.org/schema/property_rules1', 'http://dbpedia.org/inference/rules#');
 ]]></programlisting>
-</listitem>
-  <listitem>Select "any location" in the select list beside the "map" link; then hit "map" link:
 <programlisting><![CDATA[
-<query inference="" same-as="" view3="" s-term="e" c-term="type">
-  <text>napoleon</text>
-  <class iri="yago:ontology/MilitaryConflict" />
-  <class iri="yago:class/yago/NapoleonicWars" />
-  <view type="geo" limit="20" offset="0" location-prop="any" />
-</query>
+SQL>SPARQL
+define input:inference "http://dbpedia.org/schema/property_rules1"
+prefix p: <http://dbpedia.org/property/>
+SELECT ?s
+FROM <http://dbpedia.org>
+WHERE {?s p:birthcity ?o }
+LIMIT 50
+s
+VARCHAR
+_______________________________________________________________________________
+
+http://dbpedia.org/resource/Britt_Janyk
+http://dbpedia.org/resource/Chiara_Costazza
+http://dbpedia.org/resource/Christoph_Gruber
+http://dbpedia.org/resource/Daron_Rahlves
+http://dbpedia.org/resource/Finlay_Mickel
+http://dbpedia.org/resource/Genevi%C3%A8ve_Simard
+http://dbpedia.org/resource/Johann_Grugger
+http://dbpedia.org/resource/Kalle_Palander
+http://dbpedia.org/resource/Marc_Gini
+http://dbpedia.org/resource/Mario_Scheiber
+http://dbpedia.org/resource/Prince_Hubertus_of_Hohenlohe-Langenburg
+http://dbpedia.org/resource/Resi_Stiegler
+http://dbpedia.org/resource/Steven_Nyman
+http://dbpedia.org/resource/Hannes_Reichelt
+http://dbpedia.org/resource/Jeremy_Transue
+
+15 Rows. -- 167 msec.
+
+SQL>SPARQL
+define input:inference "http://dbpedia.org/schema/property_rules1"
+prefix p: <http://dbpedia.org/property/>
+SELECT ?s
+FROM <http://dbpedia.org>
+WHERE {?s p:countryofbirth ?o }
+LIMIT 50
+s
+VARCHAR
+_______________________________________________________________________________
+
+http://dbpedia.org/resource/A._J._Wood
+http://dbpedia.org/resource/A._J._Godbolt
+http://dbpedia.org/resource/Ac%C3%A1cio_Casimiro
+http://dbpedia.org/resource/Adam_Fry
+http://dbpedia.org/resource/Adam_Gilchrist
+http://dbpedia.org/resource/Adam_Griffin
+http://dbpedia.org/resource/Adam_Gross
+...
+
+50 Rows. -- 324 msec.
+
+SQL>SPARQL
+define input:inference "http://dbpedia.org/schema/property_rules1"
+prefix p: <http://dbpedia.org/property/>
+SELECT ?s
+FROM <http://dbpedia.org>
+WHERE {?s p:countyofbirth ?o }
+LIMIT 50
+
+s
+VARCHAR
+_______________________________________________________________________________
+
+http://dbpedia.org/resource/Eddie_Colman
+
+1 Rows. -- 163 msec.
+
+SQL>SPARQL
+define input:inference "http://dbpedia.org/schema/property_rules1"
+prefix p: <http://dbpedia.org/property/>
+SELECT ?s
+FROM <http://dbpedia.org>
+WHERE {?s p:birthPlace ?o }
+
+s
+VARCHAR
+_______________________________________________________________________________
+
+http://dbpedia.org/resource/Eddie_Colman
+http://dbpedia.org/resource/Jeremy_Transue
+http://dbpedia.org/resource/Finlay_Mickel
+http://dbpedia.org/resource/Prince_Hubertus_of_Hohenlohe-Langenburg
+http://dbpedia.org/resource/Hannes_Reichelt
+http://dbpedia.org/resource/Johann_Grugger
+http://dbpedia.org/resource/Chiara_Costazza
+...
+155287 Rows. -- 342179 msec.
+
 ]]></programlisting>
-</listitem>
-</itemizedlist>
-<para>This last XML fragment corresponds to the below text of SPARQL query:
-</para>
+</sect3>
+<sect3 id="rdfsparqlruleexamples3"><title>Example for loading script of the Yago Class hierarchy as inference rules</title>
 <programlisting><![CDATA[
-SPARQL
-SELECT ?location AS ?c1
-       ?lat1     AS ?c2
-       ?lng1     AS ?c3
+--- Load Class Hierarchy into a Named Graph
+SELECT ttlp_mt (file_to_string_output ('yago-class-hierarchy_en.nt'),
+'', 'http://dbpedia.org/resource/classes/yago#');
+
+-- Create an  Inference Rule that references the Yago Class Hierarchy
+Named Graph
+
+SQL>rdfs_rule_set ('http://dbpedia.org/resource/inference/rules/yago#',
+'http://dbpedia.org/resource/classes/yago#');
+
+-- Query for the "The Lord of the Rings" which is a "Fantasy Novel" as explicitly
+-- claimed in the DBpedia data set (instance data)
+
+SQL>SPARQL
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX dbpedia: <http://dbpedia.org/property/>
+PREFIX yago: <http://dbpedia.org/class/yago/>
+SELECT ?s
+FROM <http://dbpedia.org>
+WHERE
+{
+  ?s a <http://dbpedia.org/class/yago/FantasyNovels> .
+  ?s dbpedia:name "The Lord of the Rings"@en .
+};
+
+s
+VARCHAR
+_______________________________________________________________________________
+
+http://dbpedia.org/resource/The_Lord_of_the_Rings
+
+1 Rows. -- 241 msec.
+
+-- Query aimed at Novel via query scoped to the "Fiction" class of
+-- which it is a subclass in the Yago Hierarchy
+SQL>SPARQL
+define input:inference "http://dbpedia.org/resource/inference/rules/yago#"
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX dbpedia: <http://dbpedia.org/property/>
+PREFIX yago: <http://dbpedia.org/class/yago/>
+
+SELECT ?s
+FROM <http://dbpedia.org>
+WHERE {
+?s a <http://dbpedia.org/class/yago/Fiction106367107> .
+?s dbpedia:name "The Lord of the Rings"@en .
+};
+
+s
+VARCHAR
+_______________________________________________________________________________
+
+
+http://dbpedia.org/resource/The_Lord_of_the_Rings
+http://dbpedia.org/resource/The_Lord_of_the_Rings
+http://dbpedia.org/resource/The_Lord_of_the_Rings
+http://dbpedia.org/resource/The_Lord_of_the_Rings
+
+4 Rows. -- 4767 msec.
+
+
+-- # Variant of query with Virtuoso's Full Text Index extension: bif:contains
+SQL>SPARQL
+define input:inference "http://dbpedia.org/resource/inference/rules/yago#"
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX dbpedia: <http://dbpedia.org/property/>
+PREFIX yago: <http://dbpedia.org/class/yago/>
+
+SELECT ?s ?n
+FROM <http://dbpedia.org>
+WHERE {
+?s a <http://dbpedia.org/class/yago/Fiction106367107> .
+?s dbpedia:name ?n .
+?n bif:contains 'Lord and Rings'
+};
+
+s                                                                                 n
+VARCHAR                                                                           VARCHAR
+_______________________________________________________________________________
+
+http://dbpedia.org/resource/The_Lord_of_the_Rings                                 The Lord of the Rings
+http://dbpedia.org/resource/The_Lord_of_the_Rings    The Lord of the Rings
+http://dbpedia.org/resource/The_Lord_of_the_Rings    The Lord of the Rings
+http://dbpedia.org/resource/The_Lord_of_the_Rings    The Lord of the Rings
+
+4 Rows. -- 5538 msec.
+
+-- Retrieve all individuals instances of the FantasyNovels Class
+SQL>SPARQL
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX dbpedia: <http://dbpedia.org/property/>
+PREFIX yago: <http://dbpedia.org/class/yago/>
+
+SELECT ?s ?n
+FROM <http://dbpedia.org>
 WHERE
-  {
-    ?s1        ?s1textp  ?o1                              .
-    FILTER
-      ( bif:contains (?o1, '"Napoleon"') )  .
-    ?s1        a         <yago:ontology/MilitaryConflict>  .
-    ?s1        a         <yago:class/yago/NapoleonicWars>  .
-    ?s1        ?anyloc   ?location                         .
-    ?location  geo:lat   ?lat1                             ;
-               geo:long  ?lng1
-  }
-LIMIT 200
-OFFSET 0
-]]></programlisting>
-<para>
-The query takes all subjects with some literal property with "Napoleon" in it, then filters for
-military conflicts and Napoleonic wars, then takes all objects related to these where the related
-object has a location. The map has the objects and their locations.
-</para>
-  <tip><title>See Also:</title>
-    <itemizedlist mark="bullet">
-      <listitem><link linkend="virtuosospongerfacent">Virtuoso Facets Web Service</link></listitem>
-      <listitem><link linkend="virtuosospongerfacentuirestapi">Virtuoso APIs for Facet REST services</link></listitem>
-    </itemizedlist>
-  </tip>
-  </sect3>
-  <sect3 id="rdfiridereferencingfacetvd"><title>voiD Discoverability</title>
-<para>A long awaited addition to the LOD cloud is the Vocabulary of Interlinked Data (voiD).
-Virtuoso automatically generates voiD descriptions of data sets it hosts. Virtuoso incorporates an
-SQL function <emphasis>rdf_void_gen</emphasis> which returns a Turtle representation of a given
-graph's voiD statistics.
-</para>
-  </sect3>
-  <sect3 id="rdfiridereferencingfacet"><title>Test System and Data</title>
-<para>The test system consists of two 2x4 core Xeon 5345, 2.33 GHz servers with 16G RAM and 4 disks
-each. The machines are connected by two 1Gbit Ethernet connections. The software is Virtuoso 6
-Cluster. The Virtuoso server is split into 16 partitions, 8 for each machine. Each partition is
-managed by a separate server process.
-</para>
-<para>The test database has the following data sets:
-</para>
-<itemizedlist mark="bullet">
-  <listitem>DBpedia 3.2</listitem>
-  <listitem>MusicBrainz</listitem>
-  <listitem>Bio2RDF</listitem>
-  <listitem>NeuroCommons</listitem>
-  <listitem>UniProt</listitem>
-  <listitem>Freebase (95M triples)</listitem>
-  <listitem>PingTheSemanticWeb (1.6M miscellaneous files from http://www.pingthesemanticweb.com/).</listitem>
-</itemizedlist>
-<para>Ontologies:
-</para>
-<itemizedlist mark="bullet">
-  <listitem>Yago</listitem>
-  <listitem>OpenCyc</listitem>
-  <listitem>Umbel</listitem>
-  <listitem>DBpedia</listitem>
-</itemizedlist>
-<para>The database is 2.2 billion triples with 356 million distinct URIs.
-</para>
-  </sect3>
-</sect2>
-  <tip><title>See Also:</title>
-    <itemizedlist mark="bullet">
-      <listitem><link linkend="virtuosospongerfacetinstall">Virtuoso Facet Browser Installation and configuration</link></listitem>
-    </itemizedlist>
-  </tip>
-</sect1>
+{
+  ?s a <http://dbpedia.org/class/yago/FantasyNovels> .
+  ?s dbpedia:name ?n .
+}
+limit 10;
+s                                                                                 n
+VARCHAR                                                                           VARCHAR
+_______________________________________________________________________________
 
+http://dbpedia.org/resource/ATLA_-_A_Story_of_the_Lost_Island                     Atla
+http://dbpedia.org/resource/A_Crown_of_Swords                                     A Crown of Swords
+http://dbpedia.org/resource/A_Game_of_Thrones                                     A Game of Thrones
+http://dbpedia.org/resource/A_Secret_Atlas                                        A Secret Atlas
+http://dbpedia.org/resource/A_Storm_of_Swords                                     A Storm of Swords
+http://dbpedia.org/resource/A_Voyage_to_Arcturus                                  A Voyage to Arcturus
+http://dbpedia.org/resource/A_Wizard_Alone                                        A Wizard Alone
+http://dbpedia.org/resource/Above_the_Veil                                        Above the Veil
+http://dbpedia.org/resource/Black_Easter                                          Black Easter
+http://dbpedia.org/resource/Lord_of_Chaos                                         Lord of Chaos
 
-<sect1 id="rdfsparqlrule"><title>Inference Rules & Reasoning</title>
-<sect2 id="rdfsparqlruleintro"><title>Introduction</title>
-<para>Virtuoso SPARQL can use an inference context for inferring triples that are not physically stored.
-This functionality applies to physically stored quads and not to virtual triples generated from relational data with RDF views.
-Such an inference context can be built from one or more graphs containing RDF Schema triples. The supported
-RDF Schema or OWL constraints are imported from these graphs and are grouped together into rule bases.
-A rule base is a persistent entity that can be referenced by a SPARQL query or end point. Queries running
-with a given rule base work as if the triples asserted by this rule base were included in the graph or graphs accessed by the query.
-</para>
-<para>As of version 5.0, Virtuoso recognizes <emphasis>rdfs:subClassOf</emphasis> and <emphasis>rdfs:subPropertyOf</emphasis>.
-owl:sameAs is considered for arbitrary subjects and objects if specially enabled by a pragma in the query.
-As of 5.00.3031, owl:sameAs, owl:equivalentClass and owl:equivalentProperty are also considered when determining subclass or subproperty relations.  If two  classes are equivalent, they share all instances, subclasses and superclasses directly or indirectly stated in the data for either class.
-Other RDF Schema or OWL information is not taken into account.
-</para>
-</sect2>
-<sect2 id="rdfsparqlrulemake"><title>Making Rule Sets</title>
-<para>Since RDF Schema and OWL schemas are RDF graphs, these can be loaded into the triple store. Thus, in order to use
-such a schema as query context, one first loads the corresponding document into the triple store using <emphasis>ttlp</emphasis> or
-<emphasis>rdf_load_rdfxml</emphasis> or related functions. After the schema document is loaded, one can add the assertions therein
-into an inference context with the <emphasis>rdfs_rule_set</emphasis> function. This function specifies a logical name for the rule
-set plus a graph URI. It is possible to combine multiple schema graphs into a single rule set. A single schema
-graph may also independently participate in multiple rule sets.
-</para>
-<programlisting>
-rdfs_rule_set (in name varchar, in uri varchar, in remove int := 0)
-</programlisting>
-<para>This function adds the applicable facts of the graph into a rule set. The graph URI must correspond
-to the graph IRI of a graph stored in the triple store of the Virtuoso instance. If the remove argument
-is true, the specified graph is removed from the rule set instead.
-</para>
-</sect2>
-<sect2 id="rdfsparqlrulechange"><title>Changing Rule Sets</title>
-<para>Changing a rule set affects queries made after the change. Some queries may have been previously
-compiled and will not be changed as a result of modifying the rule set. When a rule set is changed, i.e.
-when <emphasis>rdfs_rule_set</emphasis> is called with the first argument set to a pre-existing rule set's name, all the graphs
-associated with this name are read and the relevant facts are added to a new empty rule set. Thus, if
-triples are deleted from or added to the graphs comprising the rule set, calling <emphasis>rdfs_rule_set</emphasis> will refresh
-the rule set to correspond to the state of the stored graphs.
-</para>
-</sect2>
-<sect2 id="rdfsparqlrulesubclassandsubprop"><title>Subclasses and Subproperties</title>
-<para>Virtuoso SPARQL supports RDF Schema subclasses and subproperties.
-</para>
-<para>The predicates <emphasis>rdfs:subClassOf</emphasis> and <emphasis>rdfs:subPropertyOf</emphasis> are
-recognized when they appear in graphs included in a rule set. When such a rule set is specified as a context
-for a SPARQL query, the following extra triples are generated as needed.
-</para>
-<para>For every <emphasis>?s rdf:type ?class</emphasis>, a triple <emphasis>?s rdf:type ?superclass</emphasis> is considered to exist,
-such that <emphasis>?superclass</emphasis> is a direct or indirect superclass of <emphasis>?class</emphasis>. Direct superclasses are
-declared with the <emphasis>rdfs:subClassOf</emphasis> predicate in the rule set graph. Transitivity of superclasses
-is automatically taken into account, meaning that if a is a superclass of b and b a superclass of c,
-then a is a superclass of c also. Cyclic superclass relations are not allowed. If such occur in the rule set data,
-the behavior is undefined but will not involve unterminating recursion.
-</para>
-<para>For every <emphasis>?s ?subpredicate ?o</emphasis>, a triple <emphasis>?s ?superpredicate ?o</emphasis>
-is considered to exist if the rule context declares <emphasis>?superpredicate</emphasis> to be a superpredicate
-of <emphasis>?predicate</emphasis>. This is done by having the triple <emphasis>?subpredicate rdfs:subPropertyOf ?superpredicate</emphasis>
-as part of the graphs making up the rule context. Transitivity is observed, thus if a is a subpredicate of b and b
-a subpredicate of c, then a is also a subpredicate of c.
-</para>
-</sect2>
-<sect2 id="rdfsameas"><title>OWL sameAs Support</title>
-<para>
-Virtuoso has limited support for the OWL sameAs predicate.
-</para>
-<para>
-If sameAs traversal is enabled and a triple pattern with a given
-subject or object is being matched, all the synonyms of the S and O
-will be tried and results generated for all the tried bindings of S
-and O. The set of synonyms is generated at run time by following all
-owl:sameAs triples where the IRI in question is either the subject or
-the object. These are followed recursively from object to subject and
-subject to object until the complete transitive closure is generated.
-All sameAs triples from all the graphs applicable to instantiating
-the triple pattern at hand are considered.
-</para>
-<para>
-Thus for example:
-</para>
-<para>The inital SPARQL query:</para>
+10 Rows. -- 781 msec.
+
+-- Retrieve all individuals instances of Fiction Class which should
+-- include all Novels.
+SQL>SPARQL
+define input:inference "http://dbpedia.org/resource/inference/rules/yago#"
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX dbpedia: <http://dbpedia.org/property/>
+PREFIX yago: <http://dbpedia.org/class/yago/>
+
+SELECT ?s ?n
+FROM <http://dbpedia.org>
+WHERE {
+?s a <http://dbpedia.org/class/yago/Fiction106367107> .
+?s dbpedia:name ?n .
+};
+s                                                                                 n
+VARCHAR                                                                           VARCHAR
+_______________________________________________________________________________
+
+http://dbpedia.org/resource/Last_Son_of_Krypton                                   Last Son of Krypton
+http://dbpedia.org/resource/Tuvaluan_language                                     Tuvaluan
+http://dbpedia.org/resource/Card_Walker                                           E. Cardon Walker
+http://dbpedia.org/resource/Les_Clark                                             Les Clark
+http://dbpedia.org/resource/Marc_Davis                                            Marc Davis
+http://dbpedia.org/resource/Eric_Larson                                           Eric Larson
+http://dbpedia.org/resource/Marty_Sklar                                           Marty Sklar
+http://dbpedia.org/resource/Peter_Ellenshaw                                       Peter Ellenshaw
+http://dbpedia.org/resource/Adriana_Caselotti                                     Adriana Caselotti
+http://dbpedia.org/resource/Jimmie_Dodd                                           Jimmie Dodd
+...
+15296 Rows.
+]]></programlisting>
+</sect3>
+<sect3 id="rdfsparqlruleexamples4"><title>Pure SPARQL Example</title>
 <programlisting><![CDATA[
+-- Query aimed at Fantasy Novel via query scoped to the "Fiction" class of
+-- which it is a subclass in the Yago Hierarchy
+
 SQL>SPARQL
-prefix foaf: <http://xmlns.com/foaf/0.1/>
-prefix owl: <http://www.w3.org/2002/07/owl#>
-prefix sioc: <http://rdfs.org/sioc/ns#>
-SELECT *
-from <http://myopenlink.net/dataspace>
-where
- {
-    ?person a foaf:Person FILTER REGEX(?person ,"http://myopenlink.net/dataspace/person/kidehen#this").
-    ?person foaf:name ?name .
-    ?person owl:sameAs ?sameas .
-  }
-limit 10;
-person                                               name             sameas
-VARCHAR                                              VARCHAR          VARCHAR
+define input:inference "http://dbpedia.org/resource/inference/rules/yago#"
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX dbpedia: <http://dbpedia.org/property/>
+PREFIX yago: <http://dbpedia.org/class/yago/>
+SELECT ?s
+FROM <http://dbpedia.org>
+WHERE {
+?s a <http://dbpedia.org/class/yago/Fiction106367107> .
+?s dbpedia:name "The Lord of the Rings"@en .
+};
+s
+VARCHAR
 _______________________________________________________________________________
 
-http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this
-http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://my.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this
-http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://kidehen.idehen.net/dataspace/person/kidehen#this
-http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://qdos.com/user/e922b748a2eb667bf37b188018002dec
-http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://knowee.net/kidehen/ids/id3684976382
-http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://dbpedia.org/resource/Kingsley_Idehen
-http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://dbtune.org/last-fm/kidehen
-http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://revyu.com/people/kidehen
-http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://identi.ca/user/14092
-http://myopenlink.net/dataspace/person/kidehen#this  Kingsley Idehen  http://myopenlink.net/proxy?url=http%3A%2F%2Fwww.facebook.com%2Fpeople%2FKingsley_Idehen%2F605980750&force=rdf&login=kidehen
+http://dbpedia.org/resource/The_Lord_of_the_Rings
+http://dbpedia.org/resource/The_Lord_of_the_Rings
+http://dbpedia.org/resource/The_Lord_of_the_Rings
+http://dbpedia.org/resource/The_Lord_of_the_Rings
 
-10 Rows. -- 181 msec.
+4 Rows. -- 150 msec.
 ]]></programlisting>
-<para>So if we have:</para>
+</sect3>
+<sect3 id="rdfsparqlruleexamples5"><title>Example for equivalence between classes</title>
+<para>This example is based on <ulink url="http://umbel.org/documentation.html">UMBEL</ulink> and
+DBpedia integration:</para>
 <programlisting><![CDATA[
-<http://myopenlink.net/dataspace/person/kidehen#this>  	<http://www.w3.org/2002/07/owl#sameAs> <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this> .
-<http://myopenlink.net/dataspace/person/kidehen#this>  	<http://xmlns.com/foaf/0.1/name>  	Kingsley Idehen
-]]></programlisting>
-<para>
-and we instantiate <emphasis>?s <http://xmlns.com/foaf/0.1/name> "Kingsley Idehen"</emphasis>
-we get <emphasis>?s</emphasis> bound to <emphasis><http://myopenlink.net/dataspace/person/kidehen#this></emphasis>.
-</para>
-<para>
-If we instantiate <emphasis><http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this>
-<http://xmlns.com/foaf/0.1/name> ?l</emphasis>
-we get <emphasis>?l</emphasis> bound to <emphasis>"Kingsley Idehen"</emphasis> because the subject was given and it was expanded to its synonyms.
-</para>
+-- Load UMBEL & DBpedia Instance Level Cross-Links (owl:sameAs) Triples
+SELECT ttlp_mt (file_to_string_output ('umbel_dbpedia_linkage_v071.n3'), '', 'http://dbpedia.org');
 
+-- Load UMBEL and DBpedia Type (rdf:type) association Triples
+SELECT ttlp_mt (file_to_string_output ('umbel_dbpedia_types_v071.n3'), '', 'http://dbpedia.org');
 
+--- Load UMBEL Subject Concept Class Hierarchy into a Named Graph
+SELECT ttlp_mt (file_to_string_output ('umbel_class_hierarchy_v071.n3'), '', 'http://dbpedia.org/resource/classes/umbel#');
 
+--- load UMBEL Subject Concepts Instance Data
+SELECT ttlp_mt (file_to_string_output ('umbel_subject_concepts.n3'), '', 'http://dbpedia.org/resource/classes/umbel#');
 
-<para>
-If binding a variable in a pattern where the variable was free, we do not expand the value to the complete set of its synonyms.
-</para>
-<para>
-Same-as expansion is enabled in a query by <emphasis>define input:same-as "yes"</emphasis> in the beginning of the SPARQL query.
-This has a significant run time cost but is in some cases useful when joining data between sets which are mapped to each other with same-as.
-</para>
-<para>
-We note that the number of same-as expansions will depend on the join order used for the SPARQL query.
-The compiler does not know the number of synonyms and cannot set the join order accordingly.
-Regardless of the join order we will however get at least one IRI of the each synonym set as answer.
-Also when interactively navigating a graph with a browser, the same-as expansion will take all synonyms into account.
-</para>
-<para>
-For getting the complete entailment of same-as, a forward
-chaining approach should be used, effectively asserting all the
-implied triples.
-</para>
-<sect3 id="rdfsameasexmp"><title>OWL sameAs Example</title>
-<programlisting><![CDATA[
-SQL>SPARQL
-DEFINE input:same-as "yes"
-SELECT *
-WHERE
- {
-   ?s <http://xmlns.com/foaf/0.1/name> "Kingsley Idehen" .
- }
-LIMIT 10;
+--- Load UMBEL Abstract Concepts Instance Data
+SELECT ttlp_mt (file_to_string_output ('umbel_abstract_concepts.n3'), '', 'http://dbpedia.org/resource/classes/umbel#');
 
-s
-VARCHAR
-___________________________________________________
-http://myopenlink.net/dataspace/person/kidehen#this
-http://myopenlink.net/dataspace/person/kidehen#this
-http://myopenlink.net/dataspace/person/kidehen#this
-http://myopenlink.net/dataspace/person/kidehen#this
-http://myopenlink.net/dataspace/person/kidehen#this
-http://myopenlink.net/dataspace/person/kidehen#this
-http://demo.openlinksw.com/dataspace/kingsley#person
-http://myopenlink.net/dataspace/person/kidehen#this
-http://myopenlink.net/dataspace/person/kidehen#this
-http://myopenlink.net/dataspace/person/kidehen#this
-No. of rows in result: 10
-]]></programlisting>
-</sect3>
-</sect2>
-<sect2 id="rdfsparqlruleintro"><title>Implementation</title>
-<para>Triples entailed by subclass or subproperty statements in an inference context are not physically stored.
-Such triples are added to the result set by the query run time as needed. Also queries involving subclass or subproperty
-rules are not rewritten into unions of all the possible triple patterns that might imply the pattern that is requested.
-Instead, the SQL compiler adds special nodes that iterate over subclasses or subproperties at run time. The cost model
-also takes subclasses and subproperties into account when determining the approximate cardinality of triple patterns.
-</para>
-<para>In essence, Virtuoso's support for subclasses and subproperties is backward chaining, i.e. it does not materialize
-all implied triples but rather looks for the basic facts implying these triples at query evaluation time.
-</para>
-</sect2>
-<sect2 id="rdfsparqlruleintro"><title>Enabling Inferencing</title>
-<para>In a SPARQL query, the define input:inference clause is used to instruct the compiler to use the rules in the named rule set. For example:
-</para>
-<programlisting>
-SQL> rdfs_rule_set ('sample', 'rule_graph');
 
-SQL> SPARQL
-define input:inference "sample"
-SELECT *
-FROM <g>
-WHERE {?s ?p ?o};
-</programlisting>
-<para>will include all the implied triples in the result set, using the rules in the sample rule set.
-</para>
-<para>Inference can be enabled triple pattern by triple pattern. This is done with the option
-(inference 'rule_set') clause after the triple pattern concerned. Specifying option (inference none)
-will disable inference for the pattern concerned while the default inference context applies to the
-rest of the patterns. Note that the keyword is input:inference in the query header and simply inference
-in the option clause. See the examples section below for examples.
-</para>
-<para>In SQL, if RDF_QUAD occurs in a select from clause, inference can be added with the table option <emphasis>WITH</emphasis>, as follows:
-</para>
-<programlisting>
-SPARQL
-SELECT *
-FROM rdf_quad table OPTION (with 'sample')
-WHERE g = iri_to_id ('xx', 0);
-</programlisting>
-<para>This is about the same as:
-</para>
-<programlisting>
-SPARQL
-define input:inference "sample"
-SELECT *
-FROM <xx>
-WHERE {?s ?p ?o}
-</programlisting>
-</sect2>
-<sect2 id="rdfsparqlruleexamples"><title>Examples</title>
-<sect3 id="rdfsparqlruleexamples1"><title>Example for loading data space instance data Triples
-into a Named Graph for schema/ontology data</title>
-<para>The following example shows how to load data space instance data Triples
-into a Named Graph: <http://localhost:8890/test>, for schema/ontology data called:
-<http://localhost:8890/schema/test> that expresses assertions about subclasses and
-subproperties.</para>
-<programlisting><![CDATA[
-ttlp ('
-   <http://localhost:8890/dataspace>  	                        <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>  <http://rdfs.org/sioc/ns#Space>.
-   <http://localhost:8890/dataspace/test2/weblog/test2tWeblog>  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>  <http://rdfs.org/sioc/types#Weblog> .
-   <http://localhost:8890/dataspace/discussion/oWiki-test1Wiki> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>  <http://rdfs.org/sioc/types#MessageBoard>.
-   <http://localhost:8890/dataspace>                            <http://rdfs.org/sioc/ns#link>                     <http://localhost:8890/ods> .
-   <http://localhost:8890/dataspace/test2/weblog/test2tWeblog>  <http://rdfs.org/sioc/ns#link>                     <http://localhost:8890/dataspace/test2/weblog/test2tWeblog>.
-   <http://localhost:8890/dataspace/discussion/oWiki-test1Wiki> <http://rdfs.org/sioc/ns#link>                     <http://localhost:8890/dataspace/discussion/oWiki-test1Wiki> .
-   ', '', 'http://localhost:8890/test');
+-- Load UMBEL External Ontology Mapping into a Named Graph
+SELECT ttlp_mt (file_to_string_output ('umbel_external_ontologies_linkage.n3'), '', 'http://dbpedia.org/resource/classes/umbel#');
+
+-- Create UMBEL Inference Rules
+
+rdfs_rule_set ('http://dbpedia.org/resource/inference/rules/umbel#', 'http://dbpedia.org/resource/classes/umbel#');
 ]]></programlisting>
+<para>Now let's execute the following queries:</para>
 <programlisting><![CDATA[
-ttlp (' @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-  <http://rdfs.org/sioc/ns#Space> rdfs:subClassOf <http://www.w3.org/2000/01/rdf-schema#Resource> .
-  <http://rdfs.org/sioc/ns#Container> rdfs:subClassOf <http://rdfs.org/sioc/ns#Space> .
-  <http://rdfs.org/sioc/ns#Forum> rdfs:subClassOf <http://rdfs.org/sioc/ns#Container> .
-  <http://rdfs.org/sioc/types#Weblog> rdfs:subClassOf <http://rdfs.org/sioc/ns#Forum> .
-  <http://rdfs.org/sioc/types#MessageBoard> rdfs:subClassOf <http://rdfs.org/sioc/ns#Forum> .
-  <http://rdfs.org/sioc/ns#link> rdfs:subPropertyOf <http://rdfs.org/sioc/ns> .
-  ', '', 'http://localhost:8890/schema/test');
+SQL>SPARQL define input:inference "http://dbpedia.org/resource/inference/rules/umbel#"
+prefix umbel: <http://umbel.org/umbel/sc/>
+PREFIX dbpedia: <http://dbpedia.org/property/>
+prefix opencyc: <http://sw.opencyc.org/2008/06/10/concept/en/>
+SELECT ?s
+where
+{
+ ?s a opencyc:Motorcycle.
+ ?s dbpedia:name ?n.
+ ?n bif:contains "BMW".
+};
+
+s
+____________________________________________
+http://dbpedia.org/resource/BMW_K1200GT
+http://dbpedia.org/resource/BMW_F650CS
+http://dbpedia.org/resource/BMW_C1
+http://dbpedia.org/resource/BMW_R75
+4 Rows. -- 26 msec.
 ]]></programlisting>
-<programlisting>
-rdfs_rule_set ('http://localhost:8890/schema/property_rules1', 'http://localhost:8890/schema/test');
-</programlisting>
-<para>This defines the rule context http://localhost:8890/schema/property_rules1 that is initialized
-from the contents of graph http://localhost:8890/schema/test.
-</para>
 <programlisting><![CDATA[
-SQL>SPARQL
-define input:inference "http://localhost:8890/schema/property_rules1"
+SQL>SPARQL define input:inference "http://dbpedia.org/resource/inference/rules/umbel#"
+prefix umbel: <http://umbel.org/umbel/sc/>
+PREFIX dbpedia: <http://dbpedia.org/property/>
+prefix opencyc: <http://sw.opencyc.org/2008/06/10/concept/en/>
 SELECT ?s
-FROM <http://localhost:8890/test>
-WHERE {?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>  <http://rdfs.org/sioc/ns#Space> };
+where
+{
+ ?s a umbel:Motorcycle.
+ ?s dbpedia:name ?n.
+ ?n bif:contains "BMW".
+};
+
 s
+____________________________________________
+http://dbpedia.org/resource/BMW_K1200GT
+http://dbpedia.org/resource/BMW_F650CS
+http://dbpedia.org/resource/BMW_C1
+http://dbpedia.org/resource/BMW_R75
+4 Rows. -- 26 msec.
+]]></programlisting>
+</sect3>
+<sect3 id="rdfsparqlruleexamples6"><title>Example for finding celebrities which are not fans of their own fans</title>
+<programlisting><![CDATA[
+SQL>SPARQL
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX sioc: <http://rdfs.org/sioc/ns#>
+INSERT INTO GRAPH <urn:rules.skos> { foaf:knows rdfs:subPropertyOf sioc:follows . };
+
+callret-0
 VARCHAR
-_______________________________________________________________________________
+Insert into <urn:rules.skos>, 1 triples -- done
+No. of rows in result: 1
+
+SQL>rdfs_rule_set ('foaf-trans', 'urn:rules.skos');
+
+Done.
+
+SPARQL>SPARQL
+DEFINE input:inference "foaf-trans"
+PREFIX sioc: <http://rdfs.org/sioc/ns#>
+SELECT ?celeb COUNT (*)
+WHERE
+  {
+    ?claimant sioc:follows ?celeb .
+    FILTER
+      (
+        !bif:exists
+         (
+           ( SELECT (1)
+             WHERE
+               {
+                 ?celeb sioc:follows ?claimant
+               }
+           )
+         )
+      )
+  }
+GROUP BY ?celeb
+ORDER BY DESC 2
+LIMIT 10
+
+celeb                                                                            callret-1
+ANY 	                                                                         ANY
+__________________________________________________________________________________________
+http://localhost.localdomain/about/id/entity/http/twitter.com/kidehen	         100
+http://localhost.localdomain/about/id/entity/http/twitter.com/shawnafennell	 77
+http://localhost.localdomain/about/id/entity/http/twitter.com/thines01	         71
+http://localhost.localdomain/about/id/entity/http/twitter.com/mhausenblas	 50
+http://localhost.localdomain/about/id/entity/http/twitter.com/DirDigEng	         2
+http://localhost.localdomain/about/id/entity/http/twitter.com/SarahPalinUSA	 1
+http://localhost.localdomain/about/id/entity/http/twitter.com/zbrox	         1
+http://localhost.localdomain/about/id/entity/http/twitter.com/LamarLee	         1
+http://localhost.localdomain/about/id/entity/http/twitter.com/HackerChick	 1
+http://localhost.localdomain/about/id/entity/http/twitter.com/programmingfeed	 1
+No. of rows in result: 10
+]]></programlisting>
+</sect3>
+</sect2>
+<!-- Uncommented for Virtuoso 6 Release-->
+  <sect2 id="rdfsparqlruleinversefunc"><title>Identity With Inverse Functional Properties </title>
+  <para>A graph used used with rdfs_rule_set may declare certain properties to
+  be inversely functional. If one or more inverse functional properties (IFP's)
+  are declared in the inference context used with the query, enabled
+  with define input:inference = "context_name", then the following
+  semantics apply:</para>
+  <orderedlist>
+  <listitem>If a literal is compared with an IRI, then the literal is substituted by all the subject IRI's where this literal occurs as a value of an IFP.</listitem>
+  <listitem>If two IRI's are compared for equality, they will be considered the same if there is an IFP P such that the same P has the same value on both subjects.</listitem>
+  <listitem>If an IRI is processed for distinctness in either distinct or group by, the IRI is first translated to be the IRI with the lowest ID among all IRI's that share an IFP value with this IRI.</listitem>
+  </orderedlist>
+  <para>Thus, if two IRI's are compared for distinctness, they will count as one if there is an IFP P with the same value with both IRI's. Literal data types are not translated into IRI's even if these literals occurred as IFP values of some subject.</para>
+  <para>It is possible to declare that specific values, even if they occur as values of an IFP in more than onme subject do not constitute identity between the subjects.
+  For example, if two subjects were inferred to be the same because they had the same foaf:mbox_sha1sum, the SHA1 hash of mailto:// would be excluded. Two individuals have an email address that has a common default value are not the same.
+  </para>
+  <para>In an ontology graph, a property IRI is declared to be inversely
+  functional by making it an instance of the
+  owl:InverseFunctionalProperty class. A value of an IFP can be
+  declared null, i.e. sharing the value does not imply identity by by
+  giving the IFP IRI a
+  <http://www.openlinksw.com/schemas/virtrdf#nullIFPValue> property with
+  the value to be ignored as the object.
+  </para>
+  <emphasis>Example</emphasis>
+  <programlisting><![CDATA[
+  SQL>ttlp ('
+  <john1> a <person> .
+  <john2> a <person> .
+  <mary> a <person> .
+  <mike> a <person> .
+  <john1> <name> "John" .
+  <john2> <name> "John" .
+  <john1> <address> "101 A street" .
+  <john2> <address> "102 B street" .
+  <john2> <knows> <mike> .
+  <john1> <http://www.w3.org/2002/07/owl#sameAs> <john2> .
+  <mary> <knows> "John" .
+  <mike> <knows> <john1> .
+  <mike> <knows> <john2> .
+  <john1> <name> "Tarzan" .
+  <mike> <nam> "Tarzan" .
+  ', '', 'ifps');
 
-http://localhost:8890/dataspace/test2/weblog/test2tWeblog
-http://localhost:8890/dataspace/discussion/oWiki-test1Wiki
-http://localhost:8890/dataspace
 
-3 Rows. -- 0 msec.
-]]></programlisting>
-<para>This returns the instances of http://rdfs.org/sioc/ns#Space. Since http://rdfs.org/sioc/types#Weblog
-and http://rdfs.org/sioc/types#MessageBoard are subclasses of http://rdfs.org/sioc/ns#Space,
-instances of http://rdfs.org/sioc/ns#Space, http://rdfs.org/sioc/types#Weblog and
-http://rdfs.org/sioc/types#MessageBoard are all returned. This results in the subjects
-http://localhost:8890/dataspace, http://localhost:8890/dataspace/test2/weblog/test2tWeblog and
-http://localhost:8890/dataspace/discussion/oWiki-test1Wiki.
-</para>
-<programlisting><![CDATA[
-SQL>SELECT id_to_iri (s)
-FROM rdf_quad table option (with 'http://localhost:8890/schema/property_rules1')
-WHERE g = iri_to_id ('http://localhost:8890/test',0)
-  AND p = iri_to_id ('http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 0)
-  AND o = iri_to_id ('http://rdfs.org/sioc/ns#Space', 0);
-callret
-VARCHAR
-_______________________________________________________________________________
+  SQL>ttlp ('
+  <name> a <http://www.w3.org/2002/07/owl#InverseFunctionalProperty> .
+  <name> <http://www.openlinksw.com/schemas/virtrdf#nullIFPValue> "Tarzan" .
+  ', '', 'ifp_list');
 
-http://localhost:8890/dataspace/test2/weblog/test2tWeblog
-http://localhost:8890/dataspace/discussion/oWiki-test1Wiki
-http://localhost:8890/dataspace
+  SQL>rdfs_rule_set ('ifps', 'ifp_list');
 
-3 Rows. -- 10 msec.
-]]></programlisting>
-<para>This is the corresponding SQL query, internally generated by the SPARQL query.</para>
-<para>Below we first look for all instances of http://rdfs.org/sioc/ns#Space with some
-property set to http://localhost:8890/dataspace/test2/weblog/test2tWeblog.
-We get the subject http://localhost:8890/dataspace/test2/weblog/test2tWeblog and the
-properties http://rdfs.org/sioc/ns#link and http://rdfs.org/sioc/ns.
-The join involves both subclass and subproperty inference. Then we turn off the inference
-for the second pattern and only get the property http://rdfs.org/sioc/ns#link. Then we do
-the same but now specify that inference should apply only to the first triple pattern.
-</para>
+  SQL>SPARQL define input:inference "ifps"  SELECT * FROM <ifps> WHERE {<john1> ?p ?o};
+
+  p                                                                                 o
+  VARCHAR                                                                           VARCHAR
+  _______________________________________________________________________________
+
+  address                                                                           101 A street
+  name                                                                              John
+  http://www.w3.org/2002/07/owl#sameAs                                              john2
+  http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   person
+  name                                                                              Tarzan
+  name                                                                              John
+  knows                                                                             mike
+  http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   person
+  address                                                                           102 B street
+  ]]></programlisting>
+  <para>We see that we get the properties of <john2> also.</para>
+  <programlisting><![CDATA[
+  SQL>SPARQL define input:inference "ifps" SELECT distinct ?p FROM <ifps> WHERE { ?p a <person>};
+
+  john2
+  mike
+  mary
+  ]]></programlisting>
+  <para>We see that we get only one John. But John is not the same as Mike
+  because they share the name Tarzan which is not considered as implying
+  identity. Which John we get is a matter of which gets the lowest
+  internal ID. This is variable and arbitrary at load time but once
+  loaded this is permanent as long as the set of subjects with the name
+  John does not change.</para>
+  </sect2>
+  <sect2 id="rdfsparqlruletransoption"><title>Inference Rules and SPARQL with Transitivity Option</title>
+<itemizedlist mark="bullet">
+  <listitem>See <link linkend="rdfsparqlimplementatiotransexamples7">example</link> with an
+inference rule to cater data being skos:broader based, which is no longer transitive.</listitem>
+  <listitem>See <link linkend="rdfsparqlimplementatiotransexamples8">example</link> with an
+inference rule to find entities that are subcategories of Protestant Churches, no deeper
+than 3 levels within the concept scheme hierarchy, filtered by a specific subcategory.</listitem>
+</itemizedlist>
+  </sect2>
+  <sect2 id="rdfsparqlruleowlrelation"><title>Inference Rules, OWL Support and Relationship Ontology</title>
+    <para>This section provides queries usage for inference rules, owl support and Relationship Vocabulary.</para>
+    <sect3 id="rdfsparqlruleowlrelationexample1"><title>Example 1</title>
+<para>Example based on Relationship Vocab:</para>
 <programlisting><![CDATA[
+## Verify Ontology Data is in Quad Store
+## Ontology: <http://vocab.org/relationship/> (Relationship Ontology)
+## Use pragma to put latest in Quad store.
 
-SQL>SPARQL
-define input:inference  "http://localhost:8890/schema/property_rules1"
+DEFINE get:soft "replace"
 SELECT *
-FROM <http://localhost:8890/test>
-WHERE
-  {
-    ?s ?p <http://rdfs.org/sioc/ns#Space> .
-    ?s ?p1 <http://localhost:8890/dataspace/test2/weblog/test2tWeblog> .
-  };
+FROM <http://vocab.org/relationship/>
+WHERE {?s ?p ?o}
 
-s             p              p1
-VARCHAR       VARCHAR       VARCHAR
-_______________________________________________________________________________
+## Clean up
 
-http://localhost:8890/dataspace/test2/weblog/test2tWeblog  http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://rdfs.org/sioc/ns#link
-http://localhost:8890/dataspace/test2/weblog/test2tWeblog  http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://rdfs.org/sioc/ns
+CLEAR GRAPH <urn:owl.tests>
 
-2 Rows. -- 0 msec.
+## Create Instance Data for Relationship Ontology
+PREFIX rel: <http://purl.org/vocab/relationship/>
 
+INSERT into GRAPH <urn:owl.tests>
+  {
+    <http://dbpedia.org/resource/Prince_William_of_Wales> rel:siblingOf <http://dbpedia.org/resource/Prince_Harry_of_Wales>.
+    <http://dbpedia.org/resource/Elizabeth_Bowes-Lyon> rel:ancestorOf <http://dbpedia.org/resource/Elizabeth_II_of_the_United_Kingdom>.
+    <http://dbpedia.org/resource/Elizabeth_II_of_the_United_Kingdom> rel:ancestorOf
+    <http://dbpedia.org/resource/Charles%2C_Prince_of_Wales>.
+    <http://dbpedia.org/resource/Charles%2C_Prince_of_Wales> rel:ancestorOf <http://dbpedia.org/resource/Prince_William_of_Wales>.
+  };
+
+## Verify
 
-SQL>SPARQL
 SELECT *
-FROM <http://localhost:8890/test>
+FROM  <urn:owl.tests>
 WHERE
   {
-    ?s ?p <http://rdfs.org/sioc/ns#Space> OPTION (inference 'http://localhost:8890/schema/property_rules1') .
-    ?s ?p1 <http://localhost:8890/dataspace/test2/weblog/test2tWeblog> .
-  };
-
-s             p              p1
-VARCHAR       VARCHAR        VARCHAR
-_______________________________________________________________________________
+    ?s ?p ?o
+  }
 
-http://localhost:8890/dataspace/test2/weblog/test2tWeblog  http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://rdfs.org/sioc/ns#link
+## Create an  Inference Rule that references the Relationship Ontology Named Graph
 
-1 Rows. -- 10 msec.
+rdfs_rule_set ('urn:owl.tests', 'http://vocab.org/relationship') ;
 
-]]></programlisting>
-</sect3>
-<sect3 id="rdfsparqlruleexamples2"><title>DBpedia example</title>
-<programlisting><![CDATA[
-ttlp ('
- prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
- <http://dbpedia.org/property/birthcity> rdfs:subPropertyOf <http://dbpedia.org/property/birthPlace> .
- <http://dbpedia.org/property/birthcountry> rdfs:subPropertyOf  <http://dbpedia.org/property/birthPlace> .
- <http://dbpedia.org/property/cityofbirth> rdfs:subPropertyOf <http://dbpedia.org/property/birthPlace> .
- <http://dbpedia.org/property/countryofbirth> rdfs:subPropertyOf <http://dbpedia.org/property/birthPlace> .
- <http://dbpedia.org/property/countyofbirth> rdfs:subPropertyOf <http://dbpedia.org/property/birthPlace> .
- <http://dbpedia.org/property/cityofdeath> rdfs:subPropertyOf <http://dbpedia.org/property/deathPlace> .
- <http://dbpedia.org/property/countryofdeath> rdfs:subPropertyOf <http://dbpedia.org/property/deathPlace> . ', '',
- 'http://dbpedia.org/inference/rules#') ;
+## Verify Rule's existence
 
-rdfs_rule_set ('http://dbpedia.org/schema/property_rules1', 'http://dbpedia.org/inference/rules#');
+SELECT * FROM sys_rdf_schema ;
 ]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlruleowlrelationexample2"><title>Example 2</title>
 <programlisting><![CDATA[
-SQL>SPARQL
-define input:inference "http://dbpedia.org/schema/property_rules1"
-prefix p: <http://dbpedia.org/property/>
-SELECT ?s
-FROM <http://dbpedia.org>
-WHERE {?s p:birthcity ?o }
-LIMIT 50
-s
-VARCHAR
-_______________________________________________________________________________
-
-http://dbpedia.org/resource/Britt_Janyk
-http://dbpedia.org/resource/Chiara_Costazza
-http://dbpedia.org/resource/Christoph_Gruber
-http://dbpedia.org/resource/Daron_Rahlves
-http://dbpedia.org/resource/Finlay_Mickel
-http://dbpedia.org/resource/Genevi%C3%A8ve_Simard
-http://dbpedia.org/resource/Johann_Grugger
-http://dbpedia.org/resource/Kalle_Palander
-http://dbpedia.org/resource/Marc_Gini
-http://dbpedia.org/resource/Mario_Scheiber
-http://dbpedia.org/resource/Prince_Hubertus_of_Hohenlohe-Langenburg
-http://dbpedia.org/resource/Resi_Stiegler
-http://dbpedia.org/resource/Steven_Nyman
-http://dbpedia.org/resource/Hannes_Reichelt
-http://dbpedia.org/resource/Jeremy_Transue
-
-15 Rows. -- 167 msec.
+## Test owl:TransitiveProperty Reasoning
+## Start with a specific URI
+## Goal: See inferred Triples
+## In this case, relationship between: <http://dbpedia.org/resource/Elizabeth_Bowes-Lyon>
+## and her descendants: Queen Elizabeth, Prince Charles, Prince William, and Prince Harry)
 
-SQL>SPARQL
-define input:inference "http://dbpedia.org/schema/property_rules1"
-prefix p: <http://dbpedia.org/property/>
-SELECT ?s
-FROM <http://dbpedia.org>
-WHERE {?s p:countryofbirth ?o }
-LIMIT 50
-s
-VARCHAR
-_______________________________________________________________________________
 
-http://dbpedia.org/resource/A._J._Wood
-http://dbpedia.org/resource/A._J._Godbolt
-http://dbpedia.org/resource/Ac%C3%A1cio_Casimiro
-http://dbpedia.org/resource/Adam_Fry
-http://dbpedia.org/resource/Adam_Gilchrist
-http://dbpedia.org/resource/Adam_Griffin
-http://dbpedia.org/resource/Adam_Gross
-...
+DEFINE input:inference 'urn:owl.tests'
+PREFIX rel: <http://purl.org/vocab/relationship/>
+SELECT *
+FROM <urn:owl.tests>
+WHERE
+  {
+    <http://dbpedia.org/resource/Elizabeth_Bowes-Lyon> rel:ancestorOf ?o
+  }
+]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlruleowlrelationexample3"><title>Example 3</title>
+<programlisting><![CDATA[
+## Test owl:SymmetricalProperty Reasoning
+## Should show same result irrespective of rel:siblingOf URI in Subject or Object slots of Triple
 
-50 Rows. -- 324 msec.
+DEFINE input:inference 'urn:owl.tests'
+PREFIX rel: <http://purl.org/vocab/relationship/>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
 
-SQL>SPARQL
-define input:inference "http://dbpedia.org/schema/property_rules1"
-prefix p: <http://dbpedia.org/property/>
-SELECT ?s
-FROM <http://dbpedia.org>
-WHERE {?s p:countyofbirth ?o }
-LIMIT 50
+SELECT *
+FROM <urn:owl.tests>
+WHERE
+  {
+    <http://dbpedia.org/resource/Prince_William_of_Wales> rel:siblingOf ?o
+  }
 
-s
-VARCHAR
-_______________________________________________________________________________
+## OR
 
-http://dbpedia.org/resource/Eddie_Colman
+DEFINE input:inference 'urn:owl.tests'
+PREFIX rel: <http://purl.org/vocab/relationship/>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
 
-1 Rows. -- 163 msec.
+SELECT *
+FROM <urn:owl.tests>
+WHERE
+  {
+    ?s rel:siblingOf <http://dbpedia.org/resource/Prince_William_of_Wales>
+  }
+]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlruleowlrelationexample4"><title>Example 4</title>
+<programlisting><![CDATA[
+## Test owl:inverseOf Reasoning
+## Should show triples exposing the inverseOf relation.
+## In this case rel:ancestorOf instance data triples exist,so the system must infer rel:descendant Of triples
 
-SQL>SPARQL
-define input:inference "http://dbpedia.org/schema/property_rules1"
-prefix p: <http://dbpedia.org/property/>
-SELECT ?s
-FROM <http://dbpedia.org>
-WHERE {?s p:birthPlace ?o }
+DEFINE input:inference 'urn:owl.tests'
+PREFIX rel: <http://purl.org/vocab/relationship/>
 
-s
-VARCHAR
-_______________________________________________________________________________
+SELECT *
+FROM <urn:owl.tests>
+WHERE
+  {
+    <http://dbpedia.org/resource/Elizabeth_II_of_the_United_Kingdom> rel:descendantOf ?o
+  }
 
-http://dbpedia.org/resource/Eddie_Colman
-http://dbpedia.org/resource/Jeremy_Transue
-http://dbpedia.org/resource/Finlay_Mickel
-http://dbpedia.org/resource/Prince_Hubertus_of_Hohenlohe-Langenburg
-http://dbpedia.org/resource/Hannes_Reichelt
-http://dbpedia.org/resource/Johann_Grugger
-http://dbpedia.org/resource/Chiara_Costazza
-...
-155287 Rows. -- 342179 msec.
+## OR with Transitivity Option applied
+
+DEFINE input:inference 'urn:owl.tests'
+PREFIX rel: <http://purl.org/vocab/relationship/>
 
+SELECT *
+FROM <urn:owl.tests>
+WHERE
+  {
+    <http://dbpedia.org/resource/Prince_William_of_Wales> rel:descendantOf ?o
+    OPTION (T_DISTINCT)
+  }
 ]]></programlisting>
-</sect3>
-<sect3 id="rdfsparqlruleexamples3"><title>Example for loading script of the Yago Class hierarchy as inference rules</title>
+    </sect3>
+    <sect3 id="rdfsparqlruleowlrelationexample5"><title>Example 5</title>
 <programlisting><![CDATA[
---- Load Class Hierarchy into a Named Graph
-SELECT ttlp_mt (file_to_string_output ('yago-class-hierarchy_en.nt'),
-'', 'http://dbpedia.org/resource/classes/yago#');
-
--- Create an  Inference Rule that references the Yago Class Hierarchy
-Named Graph
-
-SQL>rdfs_rule_set ('http://dbpedia.org/resource/inference/rules/yago#',
-'http://dbpedia.org/resource/classes/yago#');
+## Test owl:inverseOf Reasoning
+## Should show triples exposing the inverseOf relation.
+## In this case rel:employedBy instance data triples exist,
+## the system must infer rel:employerOf triples.
 
--- Query for the "The Lord of the Rings" which is a "Fantasy Novel" as explicitly
--- claimed in the DBpedia data set (instance data)
+DEFINE input:inference 'urn:owl.tests'
+PREFIX rel: <http://purl.org/vocab/relationship/>
 
-SQL>SPARQL
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX dbpedia: <http://dbpedia.org/property/>
-PREFIX yago: <http://dbpedia.org/class/yago/>
-SELECT ?s
-FROM <http://dbpedia.org>
+SELECT *
+FROM <urn:owl.tests>
 WHERE
-{
-  ?s a <http://dbpedia.org/class/yago/FantasyNovels> .
-  ?s dbpedia:name "The Lord of the Rings"@en .
-};
+  {
+    ?s rel:employerOf ?o
+  }
+]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlruleowlrelationexample6"><title>Example 6</title>
+<para>Example based on Relationship Vocab and SKOS</para>
+<programlisting><![CDATA[
+## Graph Cleanup
+CLEAR GRAPH <urn:owl.test2.tbox>
+CLEAR GRAPH <http://turnguard.com/virtuoso/test10.rdf>
 
-s
-VARCHAR
-_______________________________________________________________________________
+## Load Instance Data into Quad Store
+## PL Procedure
 
-http://dbpedia.org/resource/The_Lord_of_the_Rings
+## SQL realm
+DB.DBA.RDF_LOAD_RDFXML
+  (
+    http_get('http://www.w3.org/2009/08/skos-reference/skos-owl1-dl.rdf'),
+    'no',
+    'urn:owl.test2.tbox'
+  );
+DB.DBA.RDF_LOAD_RDFXML
+  (
+    http_get ('http://www.w3.org/2002/07/owl.rdf'),
+    'no',
+    'urn:owl.test2.tbox'
+  );
+DB.DBA.RDF_LOAD_RDFXML
+  (
+    http_get ('http://turnguard.com/virtuoso/test10.rdf'),
+    'no',
+    'http://turnguard.com/virtuoso/test10.rdf'
+  );
 
-1 Rows. -- 241 msec.
 
--- Query aimed at Novel via query scoped to the "Fiction" class of
--- which it is a subclass in the Yago Hierarchy
-SQL>SPARQL
-define input:inference "http://dbpedia.org/resource/inference/rules/yago#"
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX dbpedia: <http://dbpedia.org/property/>
-PREFIX yago: <http://dbpedia.org/class/yago/>
 
-SELECT ?s
-FROM <http://dbpedia.org>
-WHERE {
-?s a <http://dbpedia.org/class/yago/Fiction106367107> .
-?s dbpedia:name "The Lord of the Rings"@en .
-};
+SELECT *
+FROM <http://www.w3.org/2004/02/skos/core>
+WHERE
+  {
+    {
+      <http://www.w3.org/2004/02/skos/core#related> ?p ?o
+    }
+    UNION
+    {
+      ?s ?p <http://www.w3.org/2004/02/skos/core#related>
+    }
+  }
 
-s
-VARCHAR
-_______________________________________________________________________________
 
+## Create Rules
+## SQL Realm
 
-http://dbpedia.org/resource/The_Lord_of_the_Rings
-http://dbpedia.org/resource/The_Lord_of_the_Rings
-http://dbpedia.org/resource/The_Lord_of_the_Rings
-http://dbpedia.org/resource/The_Lord_of_the_Rings
+rdfs_rule_set ('urn:owl.test2.rules', 'urn:owl.test2.tbox');
 
-4 Rows. -- 4767 msec.
 
+## Transitivity Query re. SKOS concept hierarchy
 
--- # Variant of query with Virtuoso's Full Text Index extension: bif:contains
-SQL>SPARQL
-define input:inference "http://dbpedia.org/resource/inference/rules/yago#"
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX dbpedia: <http://dbpedia.org/property/>
-PREFIX yago: <http://dbpedia.org/class/yago/>
+DEFINE input:inference "urn:owl.test2.rules"
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
 
-SELECT ?s ?n
-FROM <http://dbpedia.org>
-WHERE {
-?s a <http://dbpedia.org/class/yago/Fiction106367107> .
-?s dbpedia:name ?n .
-?n bif:contains 'Lord and Rings'
-};
+SELECT *
+FROM <http://turnguard.com/virtuoso/test10.rdf>
+WHERE
+  {
+    <http://www.turnguard.com/ElectroPop> skos:broaderTransitive ?o
+    OPTION  (T_DISTINCT).
+  }
+]]></programlisting>
+    </sect3>
+  </sect2>
+</sect1>
+
+<sect1 id="rdfsparqlgeospat"><title>RDF and Geometry</title>
+<para>A geometry may occur as an object of an RDF quad. The SQL MM functions can then be used for
+querying for geometries.
+</para>
+<para>
+For geometry functions, see the <link linkend="sqlrefgeospatial">SQL Geometry support section</link>.
+</para>
+<para>A geometry may occur as an object value in an RDF quad. In such a
+case, the bare geometry object is not used but instead a special RDF
+typed literal is made with the type virtrdf:Geometry. Such a literal
+is automatically indexed in an R tree index containing all distinct
+geometries occurring in any quad of any graph under any predicate.
+Normally, WGS84, SRID 4326 is the SRID of any such geometry.
+</para>
+<para>In this section, the geo namespace prefix is used to mean <http://www.w3.org/2003/01/geo/wgs84_pos#>.
+</para>
+<para>The preferred way of adding geometries to RDF graphs is with the ttlp and related functions
+which parse a text string in the Turtle syntax and insert the result in a graph.
+</para>
+<para>For example:</para>
+<programlisting><![CDATA[
+ttlp ('@prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#>
+<point> geo:geometry "point(1.2 22.4"^^virtrdf:Geometry .',
+'xxx', 'graph');
+]]></programlisting>
+<para>A typed literal whose text is a WKT representation of a geometry and whose type is virtrdf:geometry
+creates a geometry object and adds it to the R tree index of all RDF geometries.
+</para>
+<para>
+Geometries can be queried with geometry predicates, st_intersects, st_contains and st_within, as follows.
+As usual, the bif: namespace is used since these are SQL built-in functions.
+</para>
+<programlisting><![CDATA[
+SQL>
+SPARQL
+SELECT ?c COUNT (*)
+WHERE
+  {
+    ?m geo:geometry ?geo .
+    ?m a ?c .
+    FILTER (bif:st_intersects (?geo, bif:st_point (0, 52), 100))
+  }
+GROUP BY ?c
+ORDER BY DESC 2;
 
-s                                                                                 n
+c  	                                            callret-1
+VARCHAR                                             VARCHAR
+____________________________________________________________
+http://linkedgeodata.org/vocabulary#node 	    2317684
+http://linkedgeodata.org/vocabulary#way 	    85315
+http://linkedgeodata.org/vocabulary#building 	    14257
+http://dbpedia.org/class/yago/Landmark108624891     9093
+http://linkedgeodata.org/vocabulary#wood 	    7155
+http://linkedgeodata.org/vocabulary#gate 	    7079
+http://www.w3.org/2002/07/owl#Thing 	            6788
+http://linkedgeodata.org/vocabulary#post_box 	    6144
+http://linkedgeodata.org/vocabulary#pub 	    5697
+http://dbpedia.org/ontology/Place 	            5670
+http://linkedgeodata.org/vocabulary#hedge 	    5391
+...
+]]></programlisting>
+<para>
+This would return the classes of things within 100 km of 0, 52, which is near London.
+</para>
+<programlisting><![CDATA[
+SQL>
+SPARQL
+SELECT ?m (bif:st_distance (?geo, bif:st_point (0, 52)))
+WHERE
+  {
+    ?m geo:geometry ?geo .
+    ?m a <http://dbpedia.org/ontology/City> .
+    FILTER (bif:st_intersects (?geo, bif:st_point (0, 52), 30))
+  }
+ORDER BY DESC 2
+LIMIT 20;
+
+m                                                                                 callret-1
 VARCHAR                                                                           VARCHAR
 _______________________________________________________________________________
 
-http://dbpedia.org/resource/The_Lord_of_the_Rings                                 The Lord of the Rings
-http://dbpedia.org/resource/The_Lord_of_the_Rings    The Lord of the Rings
-http://dbpedia.org/resource/The_Lord_of_the_Rings    The Lord of the Rings
-http://dbpedia.org/resource/The_Lord_of_the_Rings    The Lord of the Rings
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            39.13180985471543
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            39.13180985471543
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            39.13180985471543
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            39.13180985471543
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            37.36907252285992
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            34.49432513061792
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            33.7676326404143
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            33.24238654570499
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            32.60139660515003
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            32.60139660515003
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            32.17414911350438
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            31.45681319171456
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            31.17750625349044
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            31.115377038
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            31.115377038
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            30.56388658524301
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            29.89662974046085
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            29.85090625132639
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            29.82605254366244
+http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            29.60102064794003
 
-4 Rows. -- 5538 msec.
+20 Rows. -- 13600 msec.
 
--- Retrieve all individuals instances of the FantasyNovels Class
+]]></programlisting>
+<para>This would be the cities within 20 km of 0, 52, ordered by increasing distance from this point.
+</para>
+<para>When SPARQL is called from SQL, the geometries can be bound to SQL
+variables as anything else returned from SPARQL. The <emphasis>st_</emphasis> functions
+can then be used for retrieving properties of these objects.
+</para>
+  <tip><title>See Also</title>
+    <para><link linkend="fn_st_point"><function>st_point</function></link></para>
+    <para><link linkend="fn_st_x"><function>st_x</function></link></para>
+    <para><link linkend="fn_st_y"><function>st_y</function></link></para>
+    <para><link linkend="fn_st_distance"><function>st_distance</function></link></para>
+    <para><link linkend="fn_st_srid"><function>st_srid</function></link></para>
+    <para><link linkend="fn_st_setsrid"><function>st_setsrid</function></link></para>
+    <para><link linkend="fn_st_astext"><function>st_astext</function></link></para>
+    <para><link linkend="fn_st_geomfromtext"><function>st_geomfromtext</function></link></para>
+    <para><link linkend="fn_st_contains"><function>st_contains</function></link></para>
+    <para><link linkend="fn_st_intersects"><function>st_intersects</function></link></para>
+    <para><link linkend="fn_st_within"><function>st_within</function></link></para>
+    <para><link linkend="fn_isgeometry"><function>isgeometry</function></link></para>
+    <para><link linkend="fn_geo_insert"><function>geo_insert</function></link></para>
+    <para><link linkend="fn_geo_delete"><function>geo_delete</function></link></para>
+  </tip>
+  <sect2 id="rdfsparqlgeospatprog"><title>Programmatic Manipulation of Geometries in RDF</title>
+<para>The <link linkend="fn_ttlp"><function>ttlp</function></link> function is the preferred
+way of inserting geometries. The more are inserted at one time, the more efficient the operation is.
+This loader function will also deal with cluster message optimization.
+</para>
+<para>For deleting quads with geometries, normal
+<link linkend="rdfsparqlimplementationextent">SPARUL operations</link> apply.
+</para>
+<para>A geometry occurring in an RDF quad object is a member of the RDF box data type. This data type
+stands for a typed RDF literal. The type of all geometries is 256. This is mapped to a URI in
+the RDF_DATATYPE system table.
+</para>
+<para>A geometry does not occur directly in the object position of a quad. It is referenced by an id
+that is stored in the RDF typed literal box and references RO_ID of the RDF_OBJ system table.
+To translate a geometry into a RDF box that can be stored, do as in the example below:
+</para>
+<programlisting><![CDATA[
+INSERT INTO RDF_QUAD (g, s, p, o)
+VALUES (
+         "g",
+         "s",
+         iri_to_id ('http://www.w3.org/2003/01/geo/wgs84_pos#geometry'),
+         DB.DBA.rdf_geo_add (rdf_box (st_point (lng, lat), 256, 257, 0, 1)));
+]]></programlisting>
+<para>The DB.DBA.RDF_GEO_ADD function looks if an identical geometry already exists and if so assigns the
+existing id to it. If the geometry is new, it gets a new ID and is stored in the RDF literals
+table RDF_OBJ. At this time it is also automatically inserted into the RDF geometry index.
+</para>
+<para>In a cluster situation one should use the dpipe mechanism for inserting into RDF quad so as to
+get large numbers of inserts into a single message. This is essential for performance.
+</para>
+  </sect2>
+  <sect2 id="rdfsparqlgeospatcrg"><title>Creating Geometries From RDF Data</title>
+<para>Many data sets use the geo:lat and geo:long properties for describing a position.
+Virtuoso comes with a function for converting these properties into geometries. This operation
+reads through all graphs and for each subject with at least one geo:lat and geo:long, a point
+geometry is made for each distinct lat/long pair where lat and long are in the same graph. It
+should not happen in practice that a single subject has multiple lats or long within one graph.
+If this still happens, a geometry is made for each combination.
+The geometry is added to the subject with the lat and long as the value of the geo:geometry property.
+This is added to the same graph where the lat and long were.
+</para>
+<para>The SQL procedure DB.DBA.RDF_GEO_FILL () performs this operation. This is performed in parallel on
+multiple threads and is optimized for cluster execution. This is done without transaction logging
+and is not transactional. To make the result persistent, the operator should do an explicit checkpoint.
+This is done by executing:</para>
+<programlisting><![CDATA[
+SQL>cl_exec ('checkpoint');
+]]></programlisting>
+<para>on any process of a cluster or single server.
+Otherwise the result may be lost if the server terminates abnormally before an automatic checkpoint is made.
+</para>
+<para>The DB.DBA.RDF_GEO_FILL procedure may in principle be called several times but it will read
+every lat and long in the database. This is inefficient if there are large numbers of geometries.
+</para>
+<para>Application logic must generally be used for constructing geometries and adding these to RDF subjects.
+It is easiest for the application to construct a text representation of the geometries in TTL and to
+use the <link linkend="fn_ttlp"><function>ttlp</function></link> function for loading this.
+</para>
+  </sect2>
+  <sect2 id="rdfsparqlgeospatusg"><title>Using Geometries With Existing Databases</title>
+<para>
+The geometry feature is compatible with any Virtuoso 6 databases.
+Once geometries are used, the database should not be opened with a
+server older than the one used for first inserting geometries, older
+servers will consider the storage format a physical corruption.
+</para>
+  </sect2>
+  <sect2 id="rdfsparqlgeospatexmp"><title>GEO Spatial Examples</title>
+    <sect3 id="rdfsparqlgeospatexmp1"><title>Example 1</title>
+<programlisting><![CDATA[
+## Get All Stuff For Given Coordinates
 SQL>SPARQL
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX dbpedia: <http://dbpedia.org/property/>
-PREFIX yago: <http://dbpedia.org/class/yago/>
-
-SELECT ?s ?n
-FROM <http://dbpedia.org>
+SELECT ?c COUNT (*)
 WHERE
-{
-  ?s a <http://dbpedia.org/class/yago/FantasyNovels> .
-  ?s dbpedia:name ?n .
-}
-limit 10;
-s                                                                                 n
+   {
+     ?m geo:geometry ?geo .
+     ?m a ?c .
+     FILTER (bif:st_intersects (?geo, bif:st_point (0, 52), 100))
+   }
+GROUP BY ?c
+ORDER BY desc 2;
+
+c                                                                                 callret-1
 VARCHAR                                                                           VARCHAR
 _______________________________________________________________________________
 
-http://dbpedia.org/resource/ATLA_-_A_Story_of_the_Lost_Island                     Atla
-http://dbpedia.org/resource/A_Crown_of_Swords                                     A Crown of Swords
-http://dbpedia.org/resource/A_Game_of_Thrones                                     A Game of Thrones
-http://dbpedia.org/resource/A_Secret_Atlas                                        A Secret Atlas
-http://dbpedia.org/resource/A_Storm_of_Swords                                     A Storm of Swords
-http://dbpedia.org/resource/A_Voyage_to_Arcturus                                  A Voyage to Arcturus
-http://dbpedia.org/resource/A_Wizard_Alone                                        A Wizard Alone
-http://dbpedia.org/resource/Above_the_Veil                                        Above the Veil
-http://dbpedia.org/resource/Black_Easter                                          Black Easter
-http://dbpedia.org/resource/Lord_of_Chaos                                         Lord of Chaos
-
-10 Rows. -- 781 msec.
-
--- Retrieve all individuals instances of Fiction Class which should
--- include all Novels.
-SQL>SPARQL
-define input:inference "http://dbpedia.org/resource/inference/rules/yago#"
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX dbpedia: <http://dbpedia.org/property/>
-PREFIX yago: <http://dbpedia.org/class/yago/>
-
-SELECT ?s ?n
-FROM <http://dbpedia.org>
-WHERE {
-?s a <http://dbpedia.org/class/yago/Fiction106367107> .
-?s dbpedia:name ?n .
-};
-s                                                                                 n
+http://linkedgeodata.org/vocabulary#node                                          2317684
+http://linkedgeodata.org/vocabulary#way                                           85315
+http://linkedgeodata.org/vocabulary#building                                      14257
+http://dbpedia.org/class/yago/Landmark108624891                                   9093
+http://linkedgeodata.org/vocabulary#wood                                          7155
+....
+]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp2"><title>Example 2</title>
+<programlisting><![CDATA[
+## Get City Stuff Around Catholic Churches In Paris
+SQL>
+SPARQL
+SELECT ?m (bif:st_distance (?geo, bif:st_point (0, 52)))
+WHERE
+  {
+    ?m geo:geometry ?geo .
+    ?m a <http://dbpedia.org/ontology/City> .
+    FILTER (bif:st_intersects (?geo, bif:st_point (0, 52), 30))
+  }
+ORDER BY DESC 2
+LIMIT 20;
+m                                                                                 callret-1
 VARCHAR                                                                           VARCHAR
 _______________________________________________________________________________
 
-http://dbpedia.org/resource/Last_Son_of_Krypton                                   Last Son of Krypton
-http://dbpedia.org/resource/Tuvaluan_language                                     Tuvaluan
-http://dbpedia.org/resource/Card_Walker                                           E. Cardon Walker
-http://dbpedia.org/resource/Les_Clark                                             Les Clark
-http://dbpedia.org/resource/Marc_Davis                                            Marc Davis
-http://dbpedia.org/resource/Eric_Larson                                           Eric Larson
-http://dbpedia.org/resource/Marty_Sklar                                           Marty Sklar
-http://dbpedia.org/resource/Peter_Ellenshaw                                       Peter Ellenshaw
-http://dbpedia.org/resource/Adriana_Caselotti                                     Adriana Caselotti
-http://dbpedia.org/resource/Jimmie_Dodd                                           Jimmie Dodd
-...
-15296 Rows.
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 39.13180985471543
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 39.13180985471543
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 39.13180985471543
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 39.13180985471543
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 37.36907252285992
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 34.49432513061792
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 33.7676326404143
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 33.24238654570499
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 32.60139660515003
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 32.60139660515003
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 31.45681319171456
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 31.115377038
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 31.115377038
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 30.56388658524301
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 29.89662974046085
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 29.85090625132639
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 29.82605254366244
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 29.60102064794003
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 29.44147385851453
+http://dbpedia.org/resource/Stansted_Mountfitchet                                 29.421242437379
 ]]></programlisting>
-</sect3>
-<sect3 id="rdfsparqlruleexamples4"><title>Pure SPARQL Example</title>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp3"><title>Example 3</title>
 <programlisting><![CDATA[
--- Query aimed at Fantasy Novel via query scoped to the "Fiction" class of
--- which it is a subclass in the Yago Hierarchy
-
-SQL>SPARQL
-define input:inference "http://dbpedia.org/resource/inference/rules/yago#"
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX dbpedia: <http://dbpedia.org/property/>
-PREFIX yago: <http://dbpedia.org/class/yago/>
-SELECT ?s
-FROM <http://dbpedia.org>
-WHERE {
-?s a <http://dbpedia.org/class/yago/Fiction106367107> .
-?s dbpedia:name "The Lord of the Rings"@en .
-};
-s
-VARCHAR
+## Get City Stuff Around Catholic Churches In Paris Extended
+SQL>
+SPARQL
+SELECT ?m (bif:st_distance (?geo, bif:st_point (0, 52)))
+WHERE
+  {
+    ?m geo:geometry ?geo .
+    ?m a <http://dbpedia.org/ontology/City> .
+    FILTER (bif:st_intersects (?geo, bif:st_point (0, 52), 100))
+  }
+ORDER BY DESC 2
+LIMIT 20;
+m                                                                                 callret-1
+VARCHAR                                                                           VARCHAR
 _______________________________________________________________________________
 
-http://dbpedia.org/resource/The_Lord_of_the_Rings
-http://dbpedia.org/resource/The_Lord_of_the_Rings
-http://dbpedia.org/resource/The_Lord_of_the_Rings
-http://dbpedia.org/resource/The_Lord_of_the_Rings
+http://dbpedia.org/resource/Weston-on-Trent                                       138.7082197019335
+http://dbpedia.org/resource/Weston-on-Trent                                       137.7213767969613
+http://dbpedia.org/resource/Weston-on-Trent                                       136.4597167847218
+http://dbpedia.org/resource/Weston-on-Trent                                       134.1807668663677
+http://dbpedia.org/resource/Weston-on-Trent                                       133.104337839536
+http://dbpedia.org/resource/Weston-on-Trent                                       133.104337839536
+http://dbpedia.org/resource/Nonington                                             132.7368236183588
+http://dbpedia.org/resource/Nonington                                             132.1339163200362
+http://dbpedia.org/resource/Nonington                                             132.1339163200362
+http://dbpedia.org/resource/Nonington                                             130.5478483560461
+http://dbpedia.org/resource/Nonington                                             130.1620410981843
+http://dbpedia.org/resource/Nonington                                             129.8549842943355
+http://dbpedia.org/resource/Nonington                                             129.6459280567849
+http://dbpedia.org/resource/Nonington                                             129.4504858595742
+http://dbpedia.org/resource/Nonington                                             129.2790713235814
+http://dbpedia.org/resource/Nonington                                             128.9081040147881
+http://dbpedia.org/resource/Nonington                                             128.8845164618929
+http://dbpedia.org/resource/Nonington                                             128.6676189617872
+http://dbpedia.org/resource/Nonington                                             128.2565253458452
+http://dbpedia.org/resource/Nonington                                             128.2551696344652
 
-4 Rows. -- 150 msec.
+20 Rows. -- 120 msec.
 ]]></programlisting>
-</sect3>
-<sect3 id="rdfsparqlruleexamples5"><title>Example for equivalence between classes</title>
-<para>This example is based on <ulink url="http://umbel.org/documentation.html">UMBEL</ulink> and
-DBpedia integration:</para>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp4"><title>Example 4</title>
 <programlisting><![CDATA[
--- Load UMBEL & DBpedia Instance Level Cross-Links (owl:sameAs) Triples
-SELECT ttlp_mt (file_to_string_output ('umbel_dbpedia_linkage_v071.n3'), '', 'http://dbpedia.org');
-
--- Load UMBEL and DBpedia Type (rdf:type) association Triples
-SELECT ttlp_mt (file_to_string_output ('umbel_dbpedia_types_v071.n3'), '', 'http://dbpedia.org');
+## Text Or Geo
+SQL>
+SPARQL
+SELECT ?c COUNT (*)
+WHERE
+  {
+    ?m geo:geometry ?geo .
+    ?m a ?c .
+    FILTER (bif:st_intersects (?geo, bif:st_point (0, 52), 100)  &&  REGEX (str (?c), "London") )
+  }
+GROUP BY ?c
+ORDER BY DESC 2
+LIMIT 10;
 
---- Load UMBEL Subject Concept Class Hierarchy into a Named Graph
-SELECT ttlp_mt (file_to_string_output ('umbel_class_hierarchy_v071.n3'), '', 'http://dbpedia.org/resource/classes/umbel#');
+c  	                                                        callret-1
+____________________________________________________________________________
 
---- load UMBEL Subject Concepts Instance Data
-SELECT ttlp_mt (file_to_string_output ('umbel_subject_concepts.n3'), '', 'http://dbpedia.org/resource/classes/umbel#');
+http://dbpedia.org/class/yago/DistrictsOfLondon 	            861
+http://dbpedia.org/class/yago/GradeIListedBuildingsInLondon 	    199
+http://dbpedia.org/class/yago/MuseumsInLondon 	                    107
+http://dbpedia.org/class/yago/ArtMuseumsAndGalleriesInLondon 	    92
+http://dbpedia.org/class/yago/GradeIIListedBuildingsInLondon 	    89
+http://dbpedia.org/class/yago/SportsVenuesInLondon 	            80
+http://dbpedia.org/class/yago/RoyalBuildingsInLondon 	            72
+http://dbpedia.org/class/yago/LondonOvergroundStations 	            69
+http://dbpedia.org/class/yago/NationalGovernmentBuildingsInLondon   69
+http://dbpedia.org/class/yago/SkyscrapersInLondon 	            60
+]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp5"><title>Example 5</title>
+<programlisting><![CDATA[
+## Example "Places Of Worship, Within 5 km Of Paris":
 
---- Load UMBEL Abstract Concepts Instance Data
-SELECT ttlp_mt (file_to_string_output ('umbel_abstract_concepts.n3'), '', 'http://dbpedia.org/resource/classes/umbel#');
+## Describes places of worship, within 5 km of Paris,
+## that have cafes in close proximity(0.2 km).
+## The query requires V6 or higher.
+SQL>
+PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
+DESCRIBE ?cafe ?church
+WHERE
+  {
+    ?church a lgv:place_of_worship .
+    ?church geo:geometry ?churchgeo .
+    ?church lgv:name ?churchname .
+    ?cafe a lgv:cafe .
+    ?cafe lgv:name ?cafename .
+    ?cafe geo:geometry ?cafegeo .
+    ?cafe geo:lat ?lat .
+    ?cafe geo:long ?long .
+    FILTER ( bif:st_intersects ( ?churchgeo, bif:st_point ( 2.3498, 48.853 ), 5 ) &&
+             bif:st_intersects ( ?cafegeo, ?churchgeo, 0.2 ) )
+  }
+LIMIT 10;
 
+ at prefix rdf:	<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ at prefix ns1:	<http://linkedgeodata.org/triplify/node/243360870#> .
+ at prefix ns2:	<http://linkedgeodata.org/vocabulary#> .
+ns1:id	rdf:type	ns2:place_of_worship ,
+		ns2:node .
+ at prefix geo:	<http://www.w3.org/2003/01/geo/wgs84_pos#> .
+ns1:id	geo:lat	48.8794 ;
+	geo:long	2.3748 ;
+	ns2:created_by	"Potlatch 0.6c" ;
+	ns2:name	"Saint-Georges de la Villette" ;
+	ns2:religion	"christian" ,
+		ns2:christian .
+ at prefix virtrdf:	<http://www.openlinksw.com/schemas/virtrdf#> .
+ns1:id	geo:geometry	"POINT(2.3748 48.8794)"^^virtrdf:Geometry .
+ at prefix ns5:	<http://linkedgeodata.org/triplify/node/266632049#> .
+ns5:id	rdf:type	ns2:node ,
+		ns2:cafe ;
+	geo:lat	48.8518 ;
+	geo:long	2.325 ;
+	ns2:created_by	"Potlatch 0.9a" ;
+	ns2:name	"Le Babylone" ;
+	geo:geometry	"POINT(2.325 48.8518)"^^virtrdf:Geometry .
+....
+]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp6"><title>Example 6</title>
+<programlisting><![CDATA[
+## Count Geo
+SQL>
+SPARQL
+SELECT ?c COUNT (*)
+WHERE
+   {
+     ?s geo:geometry ?geo .
+     FILTER (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 5)) .
+     ?s a ?c
+   }
+GROUP BY ?c
+ORDER BY desc 2
+LIMIT 10;
 
--- Load UMBEL External Ontology Mapping into a Named Graph
-SELECT ttlp_mt (file_to_string_output ('umbel_external_ontologies_linkage.n3'), '', 'http://dbpedia.org/resource/classes/umbel#');
+c                                                                                 callret-1
+VARCHAR                                                                           VARCHAR
+_______________________________________________________________________________
 
--- Create UMBEL Inference Rules
+http://linkedgeodata.org/vocabulary#node                                          37792
+http://dbpedia.org/class/yago/Landmark108624891                                   4003
+http://linkedgeodata.org/vocabulary#way                                           1688
+http://linkedgeodata.org/vocabulary#building                                      719
+http://linkedgeodata.org/vocabulary#station                                       257
+http://linkedgeodata.org/vocabulary#post_box                                      247
+http://www.w3.org/2002/07/owl#Thing                                               227
+http://linkedgeodata.org/vocabulary#park                                          208
+http://linkedgeodata.org/vocabulary#restaurant                                    198
+http://dbpedia.org/ontology/Place                                                 192
 
-rdfs_rule_set ('http://dbpedia.org/resource/inference/rules/umbel#', 'http://dbpedia.org/resource/classes/umbel#');
+10 Rows. -- 932 msec.
 ]]></programlisting>
-<para>Now let's execute the following queries:</para>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp7"><title>Example 7</title>
 <programlisting><![CDATA[
-SQL>SPARQL define input:inference "http://dbpedia.org/resource/inference/rules/umbel#"
-prefix umbel: <http://umbel.org/umbel/sc/>
-PREFIX dbpedia: <http://dbpedia.org/property/>
-prefix opencyc: <http://sw.opencyc.org/2008/06/10/concept/en/>
-SELECT ?s
-where
-{
- ?s a opencyc:Motorcycle.
- ?s dbpedia:name ?n.
- ?n bif:contains "BMW".
-};
+## Get Stuff Around Notre Dame De Paris
+SQL>
+SPARQL
+SELECT ?c COUNT (*)
+WHERE
+  {
+    ?s a ?c .
+    ?s geo:geometry ?geo .
+    FILTER (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 0.3))
+  }
+GROUP BY ?c
+ORDER BY desc 2
+LIMIT 10;
 
-s
-____________________________________________
-http://dbpedia.org/resource/BMW_K1200GT
-http://dbpedia.org/resource/BMW_F650CS
-http://dbpedia.org/resource/BMW_C1
-http://dbpedia.org/resource/BMW_R75
-4 Rows. -- 26 msec.
-]]></programlisting>
-<programlisting><![CDATA[
-SQL>SPARQL define input:inference "http://dbpedia.org/resource/inference/rules/umbel#"
-prefix umbel: <http://umbel.org/umbel/sc/>
-PREFIX dbpedia: <http://dbpedia.org/property/>
-prefix opencyc: <http://sw.opencyc.org/2008/06/10/concept/en/>
-SELECT ?s
-where
-{
- ?s a umbel:Motorcycle.
- ?s dbpedia:name ?n.
- ?n bif:contains "BMW".
-};
+c                                                                                 callret-1
+VARCHAR                                                                           VARCHAR
+_______________________________________________________________________________
 
-s
-____________________________________________
-http://dbpedia.org/resource/BMW_K1200GT
-http://dbpedia.org/resource/BMW_F650CS
-http://dbpedia.org/resource/BMW_C1
-http://dbpedia.org/resource/BMW_R75
-4 Rows. -- 26 msec.
+http://linkedgeodata.org/vocabulary#node                                          408
+http://dbpedia.org/class/yago/Landmark108624891                                   134
+http://linkedgeodata.org/vocabulary#way                                           17
+http://dbpedia.org/class/yago/RomanCatholicChurchesInParis                        17
+http://dbpedia.org/class/yago/TallBuildingsAndStructuresInParis                   13
+http://dbpedia.org/class/yago/CathedralsInFrance                                  13
+http://sw.opencyc.org/2008/06/10/concept/Mx4rvVigPpwpEbGdrcN5Y29ycA               13
+http://sw.opencyc.org/2008/06/10/concept/Mx4rjm5QanS6EdaAAACgyZzFrg               13
+http://sw.opencyc.org/2008/06/10/concept/Mx4rwQwtGpwpEbGdrcN5Y29ycA               13
+http://www.w3.org/2002/07/owl#Thing                                               10
+
+10 Rows. -- 241 msec.
 ]]></programlisting>
-</sect3>
-<sect3 id="rdfsparqlruleexamples6"><title>Example for finding celebrities which are not fans of their own fans</title>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp8"><title>Example 8</title>
 <programlisting><![CDATA[
-SQL>SPARQL
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX sioc: <http://rdfs.org/sioc/ns#>
-INSERT INTO GRAPH <urn:rules.skos> { foaf:knows rdfs:subPropertyOf sioc:follows . };
-
-callret-0
-VARCHAR
-Insert into <urn:rules.skos>, 1 triples -- done
-No. of rows in result: 1
+## Things within 10 km proximity of place of worship
+SQL>
+SPARQL
+PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
+SELECT ?c COUNT (*)
+WHERE
+  {
+    ?s a ?c .
+    ?s a lgv:place_of_worship .
+    ?s geo:geometry ?geo .
+    FILTER (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 10))
+  }
+GROUP BY ?c
+ORDER BY desc 2
+LIMIT 10;
 
-SQL>rdfs_rule_set ('foaf-trans', 'urn:rules.skos');
+c                                                                                 callret-1
+VARCHAR                                                                           VARCHAR
+_______________________________________________________________________________
 
-Done.
+http://linkedgeodata.org/vocabulary#place_of_worship                              147
+http://linkedgeodata.org/vocabulary#node                                          146
+http://linkedgeodata.org/vocabulary#way                                           46
+http://linkedgeodata.org/vocabulary#building                                      36
+http://linkedgeodata.org/vocabulary#attraction                                    3
+http://linkedgeodata.org/vocabulary#church                                        1
 
-SPARQL>SPARQL
-DEFINE input:inference "foaf-trans"
-PREFIX sioc: <http://rdfs.org/sioc/ns#>
-SELECT ?celeb COUNT (*)
+6 Rows. -- 120 msec.
+]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp9"><title>Example 9</title>
+<programlisting><![CDATA[
+## Get Stuff Around Notre Dame De Paris with Names
+SQL>
+SPARQL
+PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
+SELECT ?cn
 WHERE
   {
-    ?claimant sioc:follows ?celeb .
-    FILTER
-      (
-        !bif:exists
-         (
-           ( SELECT (1)
-             WHERE
-               {
-                 ?celeb sioc:follows ?claimant
-               }
-           )
-         )
-      )
+    ?s lgv:name ?cn  .
+    ?s geo:geometry ?geo .
+    FILTER (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 0.3))
   }
-GROUP BY ?celeb
-ORDER BY DESC 2
-LIMIT 10
+LIMIT 20;
+cn
+VARCHAR
+_______________________________________________________________________________
 
-celeb                                                                            callret-1
-ANY 	                                                                         ANY
-__________________________________________________________________________________________
-http://localhost.localdomain/about/id/entity/http/twitter.com/kidehen	         100
-http://localhost.localdomain/about/id/entity/http/twitter.com/shawnafennell	 77
-http://localhost.localdomain/about/id/entity/http/twitter.com/thines01	         71
-http://localhost.localdomain/about/id/entity/http/twitter.com/mhausenblas	 50
-http://localhost.localdomain/about/id/entity/http/twitter.com/DirDigEng	         2
-http://localhost.localdomain/about/id/entity/http/twitter.com/SarahPalinUSA	 1
-http://localhost.localdomain/about/id/entity/http/twitter.com/zbrox	         1
-http://localhost.localdomain/about/id/entity/http/twitter.com/LamarLee	         1
-http://localhost.localdomain/about/id/entity/http/twitter.com/HackerChick	 1
-http://localhost.localdomain/about/id/entity/http/twitter.com/programmingfeed	 1
-No. of rows in result: 10
+Parking Lagrange
+Maitre Albert B&B
+Le Grenier de Notre Dame
+Eglise Saint-Julien-le-Pauvre
+Eglise Saint Julien le Pauvre
+Polly Magoo
+Point 0 des Routes de France
+Square Jean XXIII
+....
+20 Rows. -- 140 msec.
 ]]></programlisting>
-</sect3>
-</sect2>
-<!-- Uncommented for Virtuoso 6 Release-->
-  <sect2 id="rdfsparqlruleinversefunc"><title>Identity With Inverse Functional Properties </title>
-  <para>A graph used used with rdfs_rule_set may declare certain properties to
-  be inversely functional. If one or more inverse functional properties (IFP's)
-  are declared in the inference context used with the query, enabled
-  with define input:inference = "context_name", then the following
-  semantics apply:</para>
-  <orderedlist>
-  <listitem>If a literal is compared with an IRI, then the literal is substituted by all the subject IRI's where this literal occurs as a value of an IFP.</listitem>
-  <listitem>If two IRI's are compared for equality, they will be considered the same if there is an IFP P such that the same P has the same value on both subjects.</listitem>
-  <listitem>If an IRI is processed for distinctness in either distinct or group by, the IRI is first translated to be the IRI with the lowest ID among all IRI's that share an IFP value with this IRI.</listitem>
-  </orderedlist>
-  <para>Thus, if two IRI's are compared for distinctness, they will count as one if there is an IFP P with the same value with both IRI's. Literal data types are not translated into IRI's even if these literals occurred as IFP values of some subject.</para>
-  <para>It is possible to declare that specific values, even if they occur as values of an IFP in more than onme subject do not constitute identity between the subjects.
-  For example, if two subjects were inferred to be the same because they had the same foaf:mbox_sha1sum, the SHA1 hash of mailto:// would be excluded. Two individuals have an email address that has a common default value are not the same.
-  </para>
-  <para>In an ontology graph, a property IRI is declared to be inversely
-  functional by making it an instance of the
-  owl:InverseFunctionalProperty class. A value of an IFP can be
-  declared null, i.e. sharing the value does not imply identity by by
-  giving the IFP IRI a
-  <http://www.openlinksw.com/schemas/virtrdf#nullIFPValue> property with
-  the value to be ignored as the object.
-  </para>
-  <emphasis>Example</emphasis>
-  <programlisting><![CDATA[
-  SQL>ttlp ('
-  <john1> a <person> .
-  <john2> a <person> .
-  <mary> a <person> .
-  <mike> a <person> .
-  <john1> <name> "John" .
-  <john2> <name> "John" .
-  <john1> <address> "101 A street" .
-  <john2> <address> "102 B street" .
-  <john2> <knows> <mike> .
-  <john1> <http://www.w3.org/2002/07/owl#sameAs> <john2> .
-  <mary> <knows> "John" .
-  <mike> <knows> <john1> .
-  <mike> <knows> <john2> .
-  <john1> <name> "Tarzan" .
-  <mike> <nam> "Tarzan" .
-  ', '', 'ifps');
-
-
-  SQL>ttlp ('
-  <name> a <http://www.w3.org/2002/07/owl#InverseFunctionalProperty> .
-  <name> <http://www.openlinksw.com/schemas/virtrdf#nullIFPValue> "Tarzan" .
-  ', '', 'ifp_list');
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp10"><title>Example 10</title>
+<programlisting><![CDATA[
+## Get Churches With The Most Bars
+SQL>
+SPARQL
+PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
+SELECT ?churchname ?cafename (bif:st_distance (?churchgeo, ?cafegeo))
+WHERE
+  {
+    ?church a lgv:place_of_worship .
+    ?church geo:geometry ?churchgeo .
+    ?church lgv:name ?churchname .
+    ?cafe a lgv:cafe .
+    ?cafe lgv:name ?cafename .
+    ?cafe geo:geometry ?cafegeo .
+    FILTER (bif:st_intersects (?churchgeo, bif:st_point (2.3498, 48.853), 5)
+      && bif:st_intersects (?cafegeo, ?churchgeo, 0.2))
+  }
+LIMIT 10;
 
-  SQL>rdfs_rule_set ('ifps', 'ifp_list');
+churchname                            cafename                            callret-2
+VARCHAR                               VARCHAR                             VARCHAR
+_______________________________________________________________________________
 
-  SQL>SPARQL define input:inference "ifps"  SELECT * FROM <ifps> WHERE {<john1> ?p ?o};
+Eglise Saint-Julien-le-Pauvre         Le Saint R+?-?gis                   0.09759308692691648
+Eglise Saint-Germain des Pr+?-?s      Caf+?-? de Flore                    0.08774468391412803
+Eglise Saint-Germain des Pr+?-?s      Les Deux Magots                     0.05235923473923059
+Eglise Saint-Germain des Pr+?-?s      Caf+?-? Mabillon                    0.1712042770289815
+Eglise Saint-Germain-des-Pr+?-?s      Caf+?-? de Flore                    0.1466502865197912
+Eglise Saint-Germain-des-Pr+?-?s      Les Deux Magots                     0.1096767137079839
+Eglise Saint-Germain-des-Pr+?-?s      Bar du march+?-?                    0.1831441251868126
+Eglise Saint-Germain-des-Pr+?-?s      Caf+?-? Mabillon                    0.1174051745495528
+Synagogue                             La Chaise au Plafond                0.1038387283609551
+Synagogue                             Le Loir dans la Th+?-?i+?-?re       0.1632848322062273
 
-  p                                                                                 o
-  VARCHAR                                                                           VARCHAR
-  _______________________________________________________________________________
+10 Rows. -- 511225 msec.
+]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp11"><title>Example 11</title>
+<programlisting><![CDATA[
+## Things around highly populated places
+SQL>
+SPARQL
+SELECT ?s ( sql:num_or_null (?o) ) COUNT (*)
+WHERE
+  {
+    ?s <http://dbpedia.org/ontology/populationTotal> ?o .
+        FILTER ( sql:num_or_null (?o) > 6000000 ) .
+    ?s geo:geometry ?geo .
+        FILTER ( bif:st_intersects (?pt, ?geo,2) ) .
+    ?xx geo:geometry ?pt
+  }
+GROUP BY ?s ( sql:num_or_null (?o) )
+ORDER BY desc 3
+LIMIT 20;
 
-  address                                                                           101 A street
-  name                                                                              John
-  http://www.w3.org/2002/07/owl#sameAs                                              john2
-  http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   person
-  name                                                                              Tarzan
-  name                                                                              John
-  knows                                                                             mike
-  http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   person
-  address                                                                           102 B street
-  ]]></programlisting>
-  <para>We see that we get the properties of <john2> also.</para>
-  <programlisting><![CDATA[
-  SQL>SPARQL define input:inference "ifps" SELECT distinct ?p FROM <ifps> WHERE { ?p a <person>};
+s                                                         callret-1        callret-2
+VARCHAR                                                   VARCHAR          VARCHAR
+_______________________________________________________________________________
 
-  john2
-  mike
-  mary
-  ]]></programlisting>
-  <para>We see that we get only one John. But John is not the same as Mike
-  because they share the name Tarzan which is not considered as implying
-  identity. Which John we get is a matter of which gets the lowest
-  internal ID. This is variable and arbitrary at load time but once
-  loaded this is permanent as long as the set of subjects with the name
-  John does not change.</para>
-  </sect2>
-  <sect2 id="rdfsparqlruletransoption"><title>Inference Rules and SPARQL with Transitivity Option</title>
-<itemizedlist mark="bullet">
-  <listitem>See <link linkend="rdfsparqlimplementatiotransexamples7">example</link> with an
-inference rule to cater data being skos:broader based, which is no long transitive.</listitem>
-  <listitem>See <link linkend="rdfsparqlimplementatiotransexamples8">example</link> with an
-inference rule to find entities that are subcategories of Protestant Churches, no deeper
-than 3 levels within the concept scheme hierarchy, filtered by a specific subcategory.</listitem>
-</itemizedlist>
-  </sect2>
-  <sect2 id="rdfsparqlruleowlrelation"><title>Inference Rules, OWL Support and Relationship Ontology</title>
-    <para>This section provides queries usage for inference rules, owl support and Relationship Vocabulary.</para>
-    <sect3 id="rdfsparqlruleowlrelationexample1"><title>Example 1</title>
-<para>Example based on Relationship Vocab:</para>
+http://dbpedia.org/resource/London                        7556900          312307
+http://dbpedia.org/resource/Toronto                       8102163          115859
+http://dbpedia.org/resource/New_York_City                 8363710          95629
+http://dbpedia.org/resource/The_Hague                     6659300          84410
+http://dbpedia.org/resource/Tokyo                         12790000         78618
+http://dbpedia.org/resource/Philadelphia                  6385461          67115
+http://dbpedia.org/resource/Los_Angeles                   17755322         64394
+http://dbpedia.org/resource/Bangkok                       8160522          62519
+http://dbpedia.org/resource/Barcelona                     2147483648       57635
+http://dbpedia.org/resource/Cairo                         6758581          52738
+http://dbpedia.org/resource/Istanbul                      12697164         50745
+http://dbpedia.org/resource/Seoul                         10421782         43962
+http://dbpedia.org/resource/Beijing                       17430000         35979
+http://dbpedia.org/resource/Purmerend                     6659300          33508
+http://dbpedia.org/resource/Baghdad                       6554126          33426
+http://dbpedia.org/resource/Bogot%C3%A1                   6776009          30429
+http://dbpedia.org/resource/Mexico_City                   8836045          30127
+http://dbpedia.org/resource/Jakarta                       8500000          28944
+http://dbpedia.org/resource/Boston                        7514759          27705
+http://dbpedia.org/resource/Baden-W%C3%BCrttemberg        10755000         25112
+
+20 Rows. -- 4296 msec.
+]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp12"><title>Example 12</title>
 <programlisting><![CDATA[
-## Verify Ontology Data is in Quad Store
-## Ontology: <http://vocab.org/relationship/> (Relationship Ontology)
-## Use pragma to put latest in Quad store.
+## Example "Places Of Worship, Within 5 km Of Paris":
 
-DEFINE get:soft "replace"
-SELECT *
-FROM <http://vocab.org/relationship/>
-WHERE {?s ?p ?o}
+## Constructs a custom Linked Data Mesh (graph) about
+## places of worship, within 5 km of Paris, that have
+## cafes in close proximity(0.2 km).
 
-## Clean up
+## Note: we have distinct pin colors that identify
+## for places of worship distinct from cafes.
 
-CLEAR GRAPH <urn:owl.tests>
+## The query requires V6 or higher.
+SQL>
+SPARQL
+PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
+PREFIX rtb: <http://www.openlinksw.com/schemas/oat/rdftabs#>
+CONSTRUCT
+  {
+    ?cafe geo:geometry ?cafegeo        ;
+                   rtb:useMarker '01'  ;
+                  lgv:name ?cafename   .
+    ?church geo:geometry ?churchgeo    ;
+                   rtb:useMarker '02'  ;
+                lgv:name ?churchname   .
+  }
+WHERE
+  {
+    ?church a lgv:place_of_worship .
+    ?church geo:geometry ?churchgeo .
+    ?church lgv:name ?churchname .
+    ?cafe a lgv:cafe .
+    ?cafe lgv:name ?cafename .
+    ?cafe geo:geometry ?cafegeo .
+    ?cafe geo:lat ?lat .
+    ?cafe geo:long ?long .
+    FILTER ( bif:st_intersects ( ?churchgeo, bif:st_point ( 2.3498, 48.853 ), 5 ) &&
+             bif:st_intersects ( ?cafegeo, ?churchgeo, 0.2 ) )
+  }
+LIMIT 10;
 
-## Create Instance Data for Relationship Ontology
-PREFIX rel: <http://purl.org/vocab/relationship/>
+ at prefix ns0:	<http://linkedgeodata.org/vocabulary#> .
+ at prefix ns1:	<http://linkedgeodata.org/triplify/node/237435716#> .
+ns1:id	ns0:name	"Chapelle du Val de Gr\u00C3\u00A2ce" .
+ at prefix ns2:	<http://www.openlinksw.com/schemas/oat/rdftabs#> .
+ns1:id	ns2:useMarker	"02" .
+ at prefix virtrdf:	<http://www.openlinksw.com/schemas/virtrdf#> .
+ at prefix geo:	<http://www.w3.org/2003/01/geo/wgs84_pos#> .
+ns1:id	geo:geometry	"POINT(2.3418 48.8406)"^^virtrdf:Geometry .
+ at prefix ns5:	<http://linkedgeodata.org/triplify/node/218147750#> .
+ns5:id	ns0:name	"Synagogue" ;
+	ns2:useMarker	"02" ;
+	geo:geometry	"POINT(2.3593 48.857)"^^virtrdf:Geometry .
+ at prefix ns6:	<http://linkedgeodata.org/triplify/node/218145208#> .
+ns6:id	ns0:name	"Synagogue" ;
+	ns2:useMarker	"02" ;
+	geo:geometry	"POINT(2.3589 48.8567)"^^virtrdf:Geometry .
+...
+]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp13"><title>Example 13</title>
+<programlisting><![CDATA[
+## Example "Places Of Worship, Within 5 km Of Paris":
 
-INSERT into GRAPH <urn:owl.tests>
+## Asks for places of worship, within 5 km of Paris,
+## that have cafes in close proximity(0.2 km).
+## The query requires V6 or higher.
+
+SQL>
+SPARQL
+PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
+ASK
+WHERE
   {
-    <http://dbpedia.org/resource/Prince_William_of_Wales> rel:siblingOf <http://dbpedia.org/resource/Prince_Harry_of_Wales>.
-    <http://dbpedia.org/resource/Elizabeth_Bowes-Lyon> rel:ancestorOf <http://dbpedia.org/resource/Elizabeth_II_of_the_United_Kingdom>.
-    <http://dbpedia.org/resource/Elizabeth_II_of_the_United_Kingdom> rel:ancestorOf
-    <http://dbpedia.org/resource/Charles%2C_Prince_of_Wales>.
-    <http://dbpedia.org/resource/Charles%2C_Prince_of_Wales> rel:ancestorOf <http://dbpedia.org/resource/Prince_William_of_Wales>.
+    ?church a lgv:place_of_worship .
+    ?church geo:geometry ?churchgeo .
+    ?church lgv:name ?churchname .
+    ?cafe a lgv:cafe .
+    ?cafe lgv:name ?cafename .
+    ?cafe geo:geometry ?cafegeo .
+    ?cafe geo:lat ?lat .
+    ?cafe geo:long ?long .
+    FILTER ( bif:st_intersects ( ?churchgeo, bif:st_point ( 2.3498, 48.853 ), 5 ) &&
+             bif:st_intersects ( ?cafegeo, ?churchgeo, 0.2 ) )
   };
 
-## Verify
+Done.
 
-SELECT *
-FROM  <urn:owl.tests>
+true
+]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp14"><title>Example 14</title>
+<programlisting><![CDATA[
+## Places of worship, within 5 km of Paris,
+## that have cafes in close proximity(0.2 km)
+SQL>
+SPARQL
+PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
+SELECT DISTINCT ?cafe ?lat ?long ?cafename ?churchname
+(bif:round(bif:st_distance (?churchgeo, ?cafegeo)))
 WHERE
   {
-    ?s ?p ?o
+    ?church a lgv:place_of_worship .
+    ?church geo:geometry ?churchgeo .
+    ?church lgv:name ?churchname .
+    ?cafe a lgv:cafe .
+    ?cafe lgv:name ?cafename .
+    ?cafe geo:geometry ?cafegeo .
+    ?cafe geo:lat ?lat.
+    ?cafe geo:long ?long.
+    FILTER ( bif:st_intersects (?churchgeo, bif:st_point (2.3498, 48.853), 5) &&
+                   bif:st_intersects (?cafegeo, ?churchgeo, 0.2) )
   }
+LIMIT 10;
 
-## Create an  Inference Rule that references the Relationship Ontology Named Graph
-
-rdfs_rule_set ('urn:owl.tests', 'http://vocab.org/relationship') ;
+cafe                                                 lat       long     cafename                           churchname                             callret-5
+VARCHAR                                              VARCHAR   VARCHAR  VARCHAR                            VARCHAR                                VARCHAR
+_______________________________________________________________________________________________________________________________________________________________
 
-## Verify Rule's existence
+http://linkedgeodata.org/triplify/node/321932192#id  48.8522   2.3484   Le Saint R+?-?gis                  Eglise Saint-Julien-le-Pauvre          0
+http://linkedgeodata.org/triplify/node/251699776#id  48.8541   2.3326   Caf+?-? de Flore                   Eglise Saint-Germain des Pr+?-?s       0
+http://linkedgeodata.org/triplify/node/251699775#id  48.854    2.3331   Les Deux Magots                    Eglise Saint-Germain des Pr+?-?s       0
+http://linkedgeodata.org/triplify/node/315769036#id  48.8533   2.3358   Caf+?-? Mabillon                   Eglise Saint-Germain des Pr+?-?s       0
+http://linkedgeodata.org/triplify/node/251699776#id  48.8541   2.3326   Caf+?-? de Flore                   Eglise Saint-Germain-des-Pr+?-?s       0
+http://linkedgeodata.org/triplify/node/251699775#id  48.854    2.3331   Les Deux Magots                    Eglise Saint-Germain-des-Pr+?-?s       0
+http://linkedgeodata.org/triplify/node/315769035#id  48.8539   2.3371   Bar du march+?-?                   Eglise Saint-Germain-des-Pr+?-?s       0
+http://linkedgeodata.org/triplify/node/315769036#id  48.8533   2.3358   Caf+?-? Mabillon                   Eglise Saint-Germain-des-Pr+?-?s       0
+http://linkedgeodata.org/triplify/node/251126326#id  48.8572   2.3577   La Chaise au Plafond               Synagogue                              0
+http://linkedgeodata.org/triplify/node/251043135#id  48.8562   2.361    Le Loir dans la Th+?-?i+?-?re      Synagogue                              0
 
-SELECT * FROM sys_rdf_schema ;
+10 Rows. -- 120 msec.
 ]]></programlisting>
     </sect3>
-    <sect3 id="rdfsparqlruleowlrelationexample2"><title>Example 2</title>
+    <sect3 id="rdfsparqlgeospatexmp15"><title>Example 15</title>
 <programlisting><![CDATA[
-## Test owl:TransitiveProperty Reasoning
-## Start with a specific URI
-## Goal: See inferred Triples
-## In this case, relationship between: <http://dbpedia.org/resource/Elizabeth_Bowes-Lyon>
-## and her descendants: Queen Elizabeth, Prince Charles, Prince William, and Prince Harry)
-
-
-DEFINE input:inference 'urn:owl.tests'
-PREFIX rel: <http://purl.org/vocab/relationship/>
-SELECT *
-FROM <urn:owl.tests>
+## Stuff around Notre Dame de Paris
+SQL>
+SPARQL
+PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
+SELECT ?s ?cn ?lat ?long
 WHERE
   {
-    <http://dbpedia.org/resource/Elizabeth_Bowes-Lyon> rel:ancestorOf ?o
+    ?s lgv:name ?cn  .
+    ?s geo:geometry ?geo .
+    ?s geo:lat ?lat.
+    ?s geo:long ?long.
+    FILTER ( bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 0.3) )
   }
+LIMIT 20;
+
+s                                                      cn                                                        lat        long
+VARCHAR                                                VARCHAR                                                   VARCHAR    VARCHAR
+______________________________________________________________________________________________________________
+
+http://linkedgeodata.org/triplify/node/237004656#id    Parking Lagrange                                          48.8506    2.3487
+http://linkedgeodata.org/triplify/node/237003117#id    Mus+?-?e de l'Assistance Publique H+?-¦pitaux de Paris    48.8507    2.3519
+http://linkedgeodata.org/triplify/way/23071565#id      Jardin de la Rue de Bi+?-?vre                             48.8504    2.3502
+http://linkedgeodata.org/triplify/node/251652818#id    Maitre Albert B&B                                         48.8507    2.3496
+http://linkedgeodata.org/triplify/node/251373384#id    Le Grenier de Notre Dame                                  48.8513    2.35
+http://linkedgeodata.org/triplify/node/205266764#id    Eglise Saint-Julien-le-Pauvre                             48.852     2.3471
+http://linkedgeodata.org/triplify/way/19741083#id      Eglise Saint Julien le Pauvre                             48.8521    2.3469
+http://linkedgeodata.org/triplify/node/251474112#id    Polly Magoo                                               48.8526    2.3467
+http://linkedgeodata.org/triplify/node/251531803#id    H+?-¦tel Esmerelda                                        48.8523    2.3468
+http://linkedgeodata.org/triplify/node/191031796#id    Point 0 des Routes de France                              48.8533    2.3489
+http://linkedgeodata.org/triplify/way/20444455#id      Square Jean XXIII                                         48.8529    2.3511
+http://linkedgeodata.org/triplify/way/19740745#id      Square Ren+?-? Viviani                                    48.8525    2.3476
+http://linkedgeodata.org/triplify/node/321932192#id    Le Saint R+?-?gis                                         48.8522    2.3484
+http://linkedgeodata.org/triplify/node/27440965#id     Notre-Dame de Paris                                       48.853     2.3499
+http://linkedgeodata.org/triplify/node/243461762#id    Parking Notre-Dame                                        48.8537    2.3475
+http://linkedgeodata.org/triplify/way/21816758#id      Notre-Dame de Paris                                       48.8531    2.349
+http://linkedgeodata.org/triplify/way/22972062#id      La Seine                                                  48.8538    2.3531
+http://linkedgeodata.org/triplify/way/25463927#id      La Seine                                                  48.8548    2.3518
+http://linkedgeodata.org/triplify/node/251128395#id    H+?-¦tel Hospitel                                         48.854     2.3484
+http://linkedgeodata.org/triplify/way/14155323#id      H+?-¦tel Dieu                                             48.8555    2.3485
+
+20 Rows. -- 167 msec.
 ]]></programlisting>
     </sect3>
-    <sect3 id="rdfsparqlruleowlrelationexample3"><title>Example 3</title>
+    <sect3 id="rdfsparqlgeospatexmp16"><title>Example 16</title>
 <programlisting><![CDATA[
-## Test owl:SymmetricalProperty Reasoning
-## Should show same result irrespective of rel:siblingOf URI in Subject or Object slots of Triple
-
-DEFINE input:inference 'urn:owl.tests'
-PREFIX rel: <http://purl.org/vocab/relationship/>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-
-SELECT *
-FROM <urn:owl.tests>
+## Stuff around Notre Dame de Paris
+SQL>
+SPARQL
+PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
+DESCRIBE ?s
 WHERE
   {
-    <http://dbpedia.org/resource/Prince_William_of_Wales> rel:siblingOf ?o
+    ?s lgv:name ?cn  .
+    ?s geo:geometry ?geo .
+    ?s geo:lat ?lat.
+    ?s geo:long ?long.
+    FILTER (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 0.3))
   }
+LIMIT 20;
 
-## OR
-
-DEFINE input:inference 'urn:owl.tests'
-PREFIX rel: <http://purl.org/vocab/relationship/>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+ at prefix rdf:	<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ at prefix ns1:	<http://linkedgeodata.org/triplify/node/27440966#> .
+ at prefix ns2:	<http://linkedgeodata.org/vocabulary#> .
+ns1:id	rdf:type	ns2:node ,
+		ns2:police .
+ at prefix geo:	<http://www.w3.org/2003/01/geo/wgs84_pos#> .
+ns1:id	geo:lat	48.8542 ;
+	geo:long	2.3473 ;
+	ns2:created_by	"Potlatch 0.6a" ;
+	ns2:name	"Pr\u00C3\u00A9fecture de Police de Paris" ,
+		"Pr\u00E9fecture de Police de Paris" .
+ at prefix virtrdf:	<http://www.openlinksw.com/schemas/virtrdf#> .
+ns1:id	geo:geometry	"POINT(2.3473 48.8542)"^^virtrdf:Geometry .
+ at prefix ns5:	<http://linkedgeodata.org/triplify/node/27440965#> .
+ns5:id	rdf:type	ns2:node ,
+		ns2:place_of_worship ;
+	geo:lat	48.853 ;
+	geo:long	2.3499 ;
+	ns2:denomination	"catholic" ;
+	ns2:name	"Notre-Dame de Paris" ;
+	ns2:religion	"christian" ,
+		ns2:christian ;
+	geo:geometry	"POINT(2.3499 48.853)"^^virtrdf:Geometry .
 
-SELECT *
-FROM <urn:owl.tests>
-WHERE
-  {
-    ?s rel:siblingOf <http://dbpedia.org/resource/Prince_William_of_Wales>
-  }
+......
 ]]></programlisting>
     </sect3>
-    <sect3 id="rdfsparqlruleowlrelationexample4"><title>Example 4</title>
+    <sect3 id="rdfsparqlgeospatexmp17"><title>Example 17</title>
 <programlisting><![CDATA[
-## Test owl:inverseOf Reasoning
-## Should show triples exposing the inverseOf relation.
-## In this case rel:ancestorOf instance data triples exist,so the system must infer rel:descendant Of triples
-
-DEFINE input:inference 'urn:owl.tests'
-PREFIX rel: <http://purl.org/vocab/relationship/>
-
-SELECT *
-FROM <urn:owl.tests>
+## Cities within 30 km proximity of London
+SQL>
+SPARQL
+SELECT ?m (bif:round(bif:st_distance (?geo, ?gm)))
 WHERE
   {
-    <http://dbpedia.org/resource/Elizabeth_II_of_the_United_Kingdom> rel:descendantOf ?o
+    <http://dbpedia.org/resource/London> geo:geometry ?gm .
+    ?m geo:geometry ?geo .
+    ?m a <http://dbpedia.org/ontology/City> .
+    FILTER (bif:st_intersects (?geo, ?gm, 30))
   }
+ORDER BY DESC 2
+LIMIT 20;
 
-## OR with Transitivity Option applied
-
-DEFINE input:inference 'urn:owl.tests'
-PREFIX rel: <http://purl.org/vocab/relationship/>
+m                                                   callret-1
+VARCHAR                                             VARCHAR
+____________________________________________________________
 
-SELECT *
-FROM <urn:owl.tests>
-WHERE
-  {
-    <http://dbpedia.org/resource/Prince_William_of_Wales> rel:descendantOf ?o
-    OPTION (T_DISTINCT)
-  }
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlruleowlrelationexample5"><title>Example 5</title>
-<programlisting><![CDATA[
-## Test owl:inverseOf Reasoning
-## Should show triples exposing the inverseOf relation.
-## In this case rel:employedBy instance data triples exist,
-## the system must infer rel:employerOf triples.
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Ebbsfleet_Valley        30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
+http://dbpedia.org/resource/Bletchingley            30
 
-DEFINE input:inference 'urn:owl.tests'
-PREFIX rel: <http://purl.org/vocab/relationship/>
+20 Rows. -- 727666 msec.
 
-SELECT *
-FROM <urn:owl.tests>
-WHERE
-  {
-    ?s rel:employerOf ?o
-  }
 ]]></programlisting>
     </sect3>
-    <sect3 id="rdfsparqlruleowlrelationexample6"><title>Example 6</title>
-<para>Example based on Relationship Vocab and SKOS</para>
+    <sect3 id="rdfsparqlgeospatexmp18"><title>Example 18</title>
 <programlisting><![CDATA[
-## Graph Cleanup
-CLEAR GRAPH <urn:owl.test2.tbox>
-CLEAR GRAPH <http://turnguard.com/virtuoso/test10.rdf>
-
-## Load Instance Data into Quad Store
-## PL Procedure
-
-## SQL realm
-DB.DBA.RDF_LOAD_RDFXML
-  (
-    http_get('http://www.w3.org/2009/08/skos-reference/skos-owl1-dl.rdf'),
-    'no',
-    'urn:owl.test2.tbox'
-  );
-DB.DBA.RDF_LOAD_RDFXML
-  (
-    http_get ('http://www.w3.org/2002/07/owl.rdf'),
-    'no',
-    'urn:owl.test2.tbox'
-  );
-DB.DBA.RDF_LOAD_RDFXML
-  (
-    http_get ('http://turnguard.com/virtuoso/test10.rdf'),
-    'no',
-    'http://turnguard.com/virtuoso/test10.rdf'
-  );
-
-
-
-SELECT *
-FROM <http://www.w3.org/2004/02/skos/core>
+## Motorways across England & Scotland from DBpedia
+SQL>
+SPARQL
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX dbpprop: <http://dbpedia.org/property/>
+PREFIX yago: <http://dbpedia.org/class/yago/>
+SELECT ?road ?services ?lat ?long
 WHERE
   {
     {
-      <http://www.w3.org/2004/02/skos/core#related> ?p ?o
-    }
+      ?services dbpprop:road ?road .
+      ?road a yago:MotorwaysInEngland .
+      ?services dbpprop:lat ?lat .
+      ?services dbpprop:long ?long .
+     }
     UNION
     {
-      ?s ?p <http://www.w3.org/2004/02/skos/core#related>
-    }
+      ?services dbpprop:road ?road .
+      ?road a yago:MotorwaysInScotland .
+      ?services dbpprop:lat ?lat .
+      ?services dbpprop:long ?long .
+     }
   }
+LIMIT 20;
 
+road                                          services                                                        lat             long
+VARCHAR                                       VARCHAR                                                         VARCHAR         VARCHAR
+______________________________________________________________________________________________________________________________________
 
-## Create Rules
-## SQL Realm
-
-rdfs_rule_set ('urn:owl.test2.rules', 'urn:owl.test2.tbox');
-
-
-## Transitivity Query re. SKOS concept hierarchy
+http://dbpedia.org/resource/M90_motorway      http://dbpedia.org/resource/Kinross_services                    56.209628       -3.439257
+http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Leicester_Forest_East_services      52.6192         -1.206
+http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Woodall_services                    53.3152         -1.2813
+http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Tibshelf_services                   53.13708        -1.33179
+http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/London_Gateway_services             51.631          -0.264
+http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Donington_Park_services             52.823651       -1.305887
+http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Watford_Gap_services                52.3069         -1.1226
+http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Newport_Pagnell_services            52.083066       -0.748508
+http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Trowell_services                    52.963198       -1.265988
+http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Woolley_Edge_services               53.62259        -1.549422
+http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Toddington_services                 51.9478         -0.502075
+http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Northampton_services                52.209201       -0.944799
+http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Chieveley_services                  51.449          -1.3112
+http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Magor_services                      51.58786        -2.83713
+http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Pont_Abraham_services               51.74712        -4.0655
+http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Swansea_services                    51.678197       -3.994646
+http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Leigh_Delamere_services             51.511528       -2.159468
+http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Reading_services                    51.424527       -1.035633
+http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Cardiff_West_services               51.50626        -3.30535
+http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Heston_services                     51.48807        -0.39106
 
-DEFINE input:inference "urn:owl.test2.rules"
-PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+20 Rows. -- 531 msec.
 
-SELECT *
-FROM <http://turnguard.com/virtuoso/test10.rdf>
+]]></programlisting>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp18"><title>Example 19</title>
+<programlisting><![CDATA[
+SELECT DISTINCT ?s (bif:round(?lat)) as ?lat (bif:round(?long)) as ?long
 WHERE
   {
-    <http://www.turnguard.com/ElectroPop> skos:broaderTransitive ?o
-    OPTION  (T_DISTINCT).
+    {
+      SELECT ?g ?s WHERE
+        {
+          graph ?g {
+            ?s geo:geometry ?geo }
+        }
+      LIMIT 100
+    }
+    graph ?g {
+      ?s geo:lat ?lat .
+      ?s geo:long ?long . }
+    FILTER (datatype (?lat) in (xsd:integer, xsd:float, xsd:double)) .
+    FILTER (datatype (?long) in (xsd:integer, xsd:float, xsd:double))
   }
-]]></programlisting>
-    </sect3>
-  </sect2>
-</sect1>
 
-<sect1 id="rdfsparqlgeospat"><title>RDF and Geometry</title>
-<para>A geometry may occur as an object of an RDF quad. The SQL MM functions can then be used for
-querying for geometries.
-</para>
-<para>
-For geometry functions, see the <link linkend="sqlrefgeospatial">SQL Geometry support section</link>.
-</para>
-<para>A geometry may occur as an object value in an RDF quad. In such a
-case, the bare geometry object is not used but instead a special RDF
-typed literal is made with the type virtrdf:Geometry. Such a literal
-is automatically indexed in an R tree index containing all distinct
-geometries occurring in any quad of any graph under any predicate.
-Normally, WGS84, SRID 4326 is the SRID of any such geometry.
-</para>
-<para>In this section, the geo namespace prefix is used to mean <http://www.w3.org/2003/01/geo/wgs84_pos#>.
-</para>
-<para>The preferred way of adding geometries to RDF graphs is with the ttlp and related functions
-which parse a text string in the Turtle syntax and insert the result in a graph.
-</para>
-<para>For example:</para>
-<programlisting><![CDATA[
-ttlp ('@prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#>
-<point> geo:geometry "point(1.2 22.4"^^virtrdf:Geometry .',
-'xxx', 'graph');
+s                                                                             lat        long
+ANY 	                                                                      ANY 	 ANY
+________________________________________________________________________________________________
+http://dbpedia.org/resource/QUaD	                                      -90	 -139
+http://dbpedia.org/resource/Amundsen-Scott_South_Pole_Station	              -90	 -139
+http://dbpedia.org/resource/Amundsen-Scott_South_Pole_Station	              -90	 0
+http://dbpedia.org/resource/Degree_Angular_Scale_Interferometer	              -90	 -139
+http://dbpedia.org/resource/South_Pole_Telescope	                      -90	 -139
+http://dbpedia.org/resource/Arcminute_Cosmology_Bolometer_Array_Receiver      -90	 -139
+http://dbpedia.org/resource/Viper_telescope	                              -90	 -139
+http://dbpedia.org/resource/Mount_Weaver	                              -87	 -154
+http://dbpedia.org/resource/Axel_Heiberg_Glacier	                      -85	 -163
+http://dbpedia.org/resource/Mount_Ray	                                      -85	 -171
+http://linkedgeodata.org/triplify/node/275487234#id	                      -85	 -142
+http://linkedgeodata.org/triplify/node/303732928#id	                      -85	 -142
+http://linkedgeodata.org/triplify/node/332036611#id	                      -85	 -85
+http://linkedgeodata.org/triplify/node/303732935#id	                      -85	 -143
+http://linkedgeodata.org/triplify/node/303732951#id	                      -85	 -144
+http://linkedgeodata.org/triplify/node/303732953#id	                      -85	 -144
+http://linkedgeodata.org/triplify/node/276208684#id	                      -85	 -166
 ]]></programlisting>
-<para>A typed literal whose text is a WKT representation of a geometry and whose type is virtrdf:geometry
-creates a geometry object and adds it to the R tree index of all RDF geometries.
-</para>
-<para>
-Geometries can be queried with geometry predicates, st_intersects, st_contains and st_within, as follows.
-As usual, the bif: namespace is used since these are SQL built-in functions.
-</para>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp19"><title>Example 19</title>
 <programlisting><![CDATA[
-SQL>
-SPARQL
-SELECT ?c COUNT (*)
+## "Find things within 20km of New York City":
+
+SELECT DISTINCT ?resource ?label ?location
 WHERE
   {
-    ?m geo:geometry ?geo .
-    ?m a ?c .
-    FILTER (bif:st_intersects (?geo, bif:st_point (0, 52), 100))
+    <http://dbpedia.org/resource/New_York_City>
+        geo:geometry ?sourcegeo                   .
+    ?resource geo:geometry ?location              ;
+                rdfs:label ?label .
+    FILTER( bif:st_intersects( ?location, ?sourcegeo, 20 ) ) .
+    FILTER( lang(?label) = "en" )
   }
-GROUP BY ?c
-ORDER BY DESC 2;
-
-c  	                                            callret-1
-VARCHAR                                             VARCHAR
-____________________________________________________________
-http://linkedgeodata.org/vocabulary#node 	    2317684
-http://linkedgeodata.org/vocabulary#way 	    85315
-http://linkedgeodata.org/vocabulary#building 	    14257
-http://dbpedia.org/class/yago/Landmark108624891     9093
-http://linkedgeodata.org/vocabulary#wood 	    7155
-http://linkedgeodata.org/vocabulary#gate 	    7079
-http://www.w3.org/2002/07/owl#Thing 	            6788
-http://linkedgeodata.org/vocabulary#post_box 	    6144
-http://linkedgeodata.org/vocabulary#pub 	    5697
-http://dbpedia.org/ontology/Place 	            5670
-http://linkedgeodata.org/vocabulary#hedge 	    5391
-...
 ]]></programlisting>
-<para>
-This would return the classes of things within 100 km of 0, 52, which is near London.
-</para>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp20"><title>Example 20</title>
 <programlisting><![CDATA[
-SQL>
-SPARQL
-SELECT ?m (bif:st_distance (?geo, bif:st_point (0, 52)))
+## "Find Distance between New York City
+## and London, England":
+
+SELECT ( bif:st_distance( ?nyl,?ln ) )
+      AS ?distanceBetweenNewYorkCityAndLondon
 WHERE
   {
-    ?m geo:geometry ?geo .
-    ?m a <http://dbpedia.org/ontology/City> .
-    FILTER (bif:st_intersects (?geo, bif:st_point (0, 52), 30))
+    <http://dbpedia.org/resource/New_York_City>
+        geo:geometry ?nyl .
+    <http://dbpedia.org/resource/London>
+        geo:geometry ?ln  .
   }
-ORDER BY DESC 2
-LIMIT 20;
-
-m                                                                                 callret-1
-VARCHAR                                                                           VARCHAR
-_______________________________________________________________________________
-
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            39.13180985471543
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            39.13180985471543
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            39.13180985471543
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            39.13180985471543
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            37.36907252285992
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            34.49432513061792
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            33.7676326404143
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            33.24238654570499
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            32.60139660515003
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            32.60139660515003
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            32.17414911350438
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            31.45681319171456
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            31.17750625349044
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            31.115377038
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            31.115377038
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            30.56388658524301
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            29.89662974046085
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            29.85090625132639
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            29.82605254366244
-http://dbpedia.org/resource/Kingston%2C_Cambridgeshire                            29.60102064794003
-
-20 Rows. -- 13600 msec.
-
 ]]></programlisting>
-<para>This would be the cities within 20 km of 0, 52, ordered by increasing distance from this point.
-</para>
-<para>When SPARQL is called from SQL, the geometries can be bound to SQL
-variables as anything else returned from SPARQL. The <emphasis>st_</emphasis> functions
-can then be used for retrieving properties of these objects.
-</para>
-  <tip><title>See Also</title>
-    <para><link linkend="fn_st_point"><function>st_point</function></link></para>
-    <para><link linkend="fn_st_x"><function>st_x</function></link></para>
-    <para><link linkend="fn_st_y"><function>st_y</function></link></para>
-    <para><link linkend="fn_st_distance"><function>st_distance</function></link></para>
-    <para><link linkend="fn_st_srid"><function>st_srid</function></link></para>
-    <para><link linkend="fn_st_setsrid"><function>st_setsrid</function></link></para>
-    <para><link linkend="fn_st_astext"><function>st_astext</function></link></para>
-    <para><link linkend="fn_st_geomfromtext"><function>st_geomfromtext</function></link></para>
-    <para><link linkend="fn_st_contains"><function>st_contains</function></link></para>
-    <para><link linkend="fn_st_intersects"><function>st_intersects</function></link></para>
-    <para><link linkend="fn_st_within"><function>st_within</function></link></para>
-    <para><link linkend="fn_isgeometry"><function>isgeometry</function></link></para>
-    <para><link linkend="fn_geo_insert"><function>geo_insert</function></link></para>
-    <para><link linkend="fn_geo_delete"><function>geo_delete</function></link></para>
-  </tip>
-  <sect2 id="rdfsparqlgeospatprog"><title>Programmatic Manipulation of Geometries in RDF</title>
-<para>The <link linkend="fn_ttlp"><function>ttlp</function></link> function is the preferred
-way of inserting geometries. The more are inserted at one time, the more efficient the operation is.
-This loader function will also deal with cluster message optimization.
-</para>
-<para>For deleting quads with geometries, normal
-<link linkend="rdfsparqlimplementationextent">SPARUL operations</link> apply.
-</para>
-<para>A geometry occurring in an RDF quad object is a member of the RDF box data type. This data type
-stands for a typed RDF literal. The type of all geometries is 256. This is mapped to a URI in
-the RDF_DATATYPE system table.
-</para>
-<para>A geometry does not occur directly in the object position of a quad. It is referenced by an id
-that is stored in the RDF typed literal box and references RO_ID of the RDF_OBJ system table.
-To translate a geometry into a RDF box that can be stored, do as in the example below:
-</para>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp21"><title>Example 21</title>
 <programlisting><![CDATA[
-INSERT INTO RDF_QUAD (g, s, p, o)
-VALUES (
-         "g",
-         "s",
-         iri_to_id ('http://www.w3.org/2003/01/geo/wgs84_pos#geometry'),
-         DB.DBA.rdf_geo_add (rdf_box (st_point (lng, lat), 256, 257, 0, 1)));
+## "Find "All Educational Institutions
+## within 10km of Oxford, UK; ordered by
+## date of establishment":
+
+SELECT DISTINCT ?thing AS ?uri
+      ?thingLabel AS ?name
+      ?date AS ?established
+      ?matchgeo AS ?location
+WHERE
+  {
+    <http://dbpedia.org/resource/Oxford>
+             geo:geometry ?sourcegeo .
+    ?resource geo:geometry ?matchgeo .
+    FILTER( bif:st_intersects( ?matchgeo, ?sourcegeo, 5 ) ) .
+       ?thing ?somelink ?resource                           ;
+       <http://dbpedia.org/ontology/established> ?date      ;
+       rdfs:label ?thingLabel                               .
+    FILTER( lang(?thingLabel) = "en" )
+  }
+ORDER BY ASC( ?date )
 ]]></programlisting>
-<para>The DB.DBA.RDF_GEO_ADD function looks if an identical geometry already exists and if so assigns the
-existing id to it. If the geometry is new, it gets a new ID and is stored in the RDF literals
-table RDF_OBJ. At this time it is also automatically inserted into the RDF geometry index.
-</para>
-<para>In a cluster situation one should use the dpipe mechanism for inserting into RDF quad so as to
-get large numbers of inserts into a single message. This is essential for performance.
-</para>
-  </sect2>
-  <sect2 id="rdfsparqlgeospatcrg"><title>Creating Geometries From RDF Data</title>
-<para>Many data sets use the geo:lat and geo:long properties for describing a position.
-Virtuoso comes with a function for converting these properties into geometries. This operation
-reads through all graphs and for each subject with at least one geo:lat and geo:long, a point
-geometry is made for each distinct lat/long pair where lat and long are in the same graph. It
-should not happen in practice that a single subject has multiple lats or long within one graph.
-If this still happens, a geometry is made for each combination.
-The geometry is added to the subject with the lat and long as the value of the geo:geometry property.
-This is added to the same graph where the lat and long were.
-</para>
-<para>The SQL procedure DB.DBA.RDF_GEO_FILL () performs this operation. This is performed in parallel on
-multiple threads and is optimized for cluster execution. This is done without transaction logging
-and is not transactional. To make the result persistent, the operator should do an explicit checkpoint.
-This is done by executing:</para>
+    </sect3>
+    <sect3 id="rdfsparqlgeospatexmp22"><title>Example 22</title>
 <programlisting><![CDATA[
-SQL>cl_exec ('checkpoint');
+## "Find Historical cross section of events related
+## to Edinburgh and the surrounding area (within 30km)
+## during the 19th century":
+
+SELECT DISTINCT ?thing ?thingLabel
+      ?dateMeaningLabel ?date ?matchgeo
+WHERE
+  {
+    {
+      SELECT DISTINCT ?thing ?matchgeo
+      WHERE
+        {
+          <http://dbpedia.org/resource/Edinburgh>
+              geo:geometry ?sourcegeo .
+            ?resource geo:geometry ?matchgeo .
+            FILTER( bif:st_intersects (
+                ?matchgeo, ?sourcegeo, 30 ) ) .
+            ?thing ?somelink ?resource
+        }
+    }
+    {
+      ?property rdf:type owl:DatatypeProperty ;
+                          rdfs:range xsd:date
+    } .
+    ?thing ?dateMeaning ?date .
+    FILTER( ?dateMeaning IN ( ?property ) ) .
+    FILTER( ?date >= xsd:gYear("1800")
+         && ?date <= xsd:gYear("1900") )
+    ?dateMeaning rdfs:label ?dateMeaningLabel .
+  FILTER( lang(?dateMeaningLabel) = "en" ) .
+  ?thing rdfs:label ?thingLabel .
+  FILTER( lang(?thingLabel) = "en" )
+  }
+ORDER BY ASC ( ?date )
 ]]></programlisting>
-<para>on any process of a cluster or single server.
-Otherwise the result may be lost if the server terminates abnormally before an automatic checkpoint is made.
+    </sect3>
+  </sect2>
+</sect1>
+
+<!--
+<sect1 id="rdfreplication"><title>RDF Replication</title>
+<para>
+Tables of RDF storage, such as DB.DBA.RDF_QUAD and DB.DBA.RDF_OBJ, can not be replicated in a usual way,
+because it's content is cached in memory in special ways and synchronized with values outside these tables,
+such as current values of special sequence objects.
+Moreover, same IRI may have different internal IRI_IDs on different boxes, because the assigned IDs vary if new IRIs appear in data in different order.
+Similarly, there will be different IDs of RDF literal, datatypes and languages, blocking any attempt of one-to-one replication between RDF storages.</para>
+<para>
+However, a special asynchronous RDF replication makes it possible to configure a "publisher" Virtuoso instance to keep the log of changes in some RDF graphs
+and subscribe some Virtuoso instances to replay all these changes.</para>
+<para>
+Configuration functions are quite straightforward.</para>
+<para>
+RDF graphs to replicate are all members of <http://www.openlinksw.com/schemas/virtrdf#rdf_repl_graph_group> graph group.
+That group can be filled in with graphs like any other graph group, but it is better to get the advantage of proper security check made by
 </para>
-<para>The DB.DBA.RDF_GEO_FILL procedure may in principle be called several times but it will read
-every lat and long in the database. This is inefficient if there are large numbers of geometries.
+<funcprototype id="fproto_DB.DBA.RDF_REPL_GRAPH_INS">
+  <funcdef>procedure <function>DB.DBA.RDF_REPL_GRAPH_INS</function></funcdef>
+  <paramdef>in <parameter>memb_iri</parameter> varchar</paramdef>
+</funcprototype>
+<para>
+that inserts a graph to the group and</para>
+<funcprototype id="fproto_DB.DBA.RDF_REPL_GRAPH_DEL">
+  <funcdef>procedure <function>DB.DBA.RDF_REPL_GRAPH_DEL</function></funcdef>
+  <paramdef>in <parameter>memb_iri</parameter> varchar</paramdef>
+</funcprototype>
+<para>
+that removes a graph from the group.
+Only publicly readable graphs can be replicated, an error is signalled otherwise, and it is better to know about a security issue as early as possible.</para>
+<funcprototype id="fproto_DB.DBA.RDF_REPL_START">
+  <funcdef>procedure <function>DB.DBA.RDF_REPL_START</function></funcdef>
+  <paramdef>in <parameter>quiet</parameter> integer := 0</paramdef>
+</funcprototype>
+<para>
+starts the RDF replication at the publishing side.
+It creates replication "publication" named '__rdf_repl' and makes a log file '__rdf_repl.log' to record changes in replicated graphs.
+If the replication has been started before then an error is signalled; passing value 1 for parameter "quiet" elimintaes the error so the incorrect call has no effect at all.
+If the replication is enabled then the value of registry variable 'DB.DBA.RDF_REPL' indicates the moment of replication start.</para>
+<para>
+<function>DB.DBA.RDF_REPL_START</function>() performs a security check before starting the replication to check.</para>
+<funcprototype id="fproto_DB.DBA.RDF_REPL_STOP">
+  <funcdef>procedure <function>DB.DBA.RDF_REPL_STOP</function></funcdef>
+  <paramdef> in <parameter>quiet</parameter> integer := 0</paramdef>
+</funcprototype>
+<para>
+stops the RDF replication at the publishing side.
+It calls <function><link linkend="fn_repl_unpublish">repl_unpublish</link></function> but does not make empty reates replication "publication" named '__rdf_repl' and makes a log file '__rdf_repl.log' to record changes in replicated graphs.</para>
+<para>
+Replication is asynchronous and the order of insertion and removal operations at the subscriber's side may not match the order at the publisher.
+As a result, it is not recommended to make few subscriptions that writes changes of few publishers into one common graph.
+A client-side application can force the synchronuzation by calling</para>
+<funcprototype id="fproto_DB.DBA.RDF_REPL_SYNC">
+  <funcdef>procedure <function>DB.DBA.RDF_REPL_SYNC</function></funcdef>
+  <paramdef>in <parameter>publisher</parameter> varchar</paramdef>
+  <paramdef>in <parameter>user</parameter> varchar</paramdef>
+  <paramdef>in <parameter>pwd</parameter> varchar</paramdef>
+</funcprototype>
+<para>
+that acts like <function><link linkend="fn_repl_sync">repl_sync</link></function> but for an RDF subscription.
+<function>DB.DBA.RDF_REPL_SYNC</function> will not only initial synchronisation but also wait for the end of subscription to guarantee that the total effect of INSERT and DELETE operations is correct even if these operations were made in an order that differs from the original one.</para>
+</sect1>
+-->
+<sect1 id="rdfperformancetuning"><title>Performance Tuning</title>
+<para>For RDF query performance, we have the following possible questions:</para>
+<itemizedlist mark="bullet" spacing="compact">
+<listitem>Is the Virtuoso process properly configured to handle big data sets?</listitem>
+<listitem>Is the graph always specified?</listitem>
+<listitem>Are public web service endpoints protected against bad queries?</listitem>
+<listitem>Are there patterns where only a predicate is given?</listitem>
+<listitem>Is there a bad query plan because of cost model error?</listitem>
+</itemizedlist>
+<sect2 id="rdfperfgeneral"><title>General</title>
+	<para>For running with large data sets, one should configure the Virtuoso process to use between 2/3 to  3/5 of system RAM and to stripe storage on all available disks.  See <link linkend="VIRTINI">NumberOfBuffers</link> and <link linkend="VIRTINI">Striping</link> ini parameters.</para>
+<para> Also, if running with a large database, setting <link linkend="VIRTINI">MaxCheckpointRemap</link> to 1/4th of
+ the database size is recommended.  This is in pages, 8K per page.</para>
+    </sect2>
+    <sect2 id="rdfperfrdfscheme"><title>RDF Index Scheme</title>
+<para>
+Starting with version 6.00.3126 the default RDF index scheme consists
+of 2 full indices over RDF quads plus 3 partial indices. This index
+scheme is generally adapted to all kinds of workloads, regardless of
+whether queries generally specify a graph.
 </para>
-<para>Application logic must generally be used for constructing geometries and adding these to RDF subjects.
-It is easiest for the application to construct a text representation of the geometries in TTL and to
-use the <link linkend="fn_ttlp"><function>ttlp</function></link> function for loading this.
+
+<para>
+Alternate indexing schemes are possible but will not be generally needed.
+For upgrading old databases with a different index scheme see the corresponding documentation.
 </para>
-  </sect2>
-  <sect2 id="rdfsparqlgeospatusg"><title>Using Geometries With Existing Databases</title>
+
 <para>
-The geometry feature is compatible with any Virtuoso 6 databases.
-Once geometries are used, the database should not be opened with a
-server older than the one used for first inserting geometries, older
-servers will consider the storage format a physical corruption.
+The index scheme consists of the following indices:
 </para>
-  </sect2>
-  <sect2 id="rdfsparqlgeospatexmp"><title>GEO Spatial Examples</title>
-    <sect3 id="rdfsparqlgeospatexmp1"><title>Example 1</title>
-<programlisting><![CDATA[
-## Get All Stuff For Given Coordinates
-SQL>SPARQL
-SELECT ?c COUNT (*)
-WHERE
-   {
-     ?m geo:geometry ?geo .
-     ?m a ?c .
-     FILTER (bif:st_intersects (?geo, bif:st_point (0, 52), 100))
-   }
-GROUP BY ?c
-ORDER BY desc 2;
 
-c                                                                                 callret-1
-VARCHAR                                                                           VARCHAR
-_______________________________________________________________________________
+<itemizedlist mark="bullet">
+  <listitem><emphasis>PSOG</emphasis> - primary key</listitem>
+  <listitem><emphasis>POGS</emphasis> - bitmap index for lookups on object value.</listitem>
+  <listitem><emphasis>SP</emphasis> - partial index for cases where only S is specified.</listitem>
+  <listitem><emphasis>OP</emphasis> - partial index for cases where only O is specified.</listitem>
+  <listitem><emphasis>GS</emphasis> - partial index for cases where only G is specified.</listitem>
+</itemizedlist>
+
+<para>
+This index scheme is created by the following statements:
+</para>
 
-http://linkedgeodata.org/vocabulary#node                                          2317684
-http://linkedgeodata.org/vocabulary#way                                           85315
-http://linkedgeodata.org/vocabulary#building                                      14257
-http://dbpedia.org/class/yago/Landmark108624891                                   9093
-http://linkedgeodata.org/vocabulary#wood                                          7155
-....
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp2"><title>Example 2</title>
 <programlisting><![CDATA[
-## Get City Stuff Around Catholic Churches In Paris
-SQL>
-SPARQL
-SELECT ?m (bif:st_distance (?geo, bif:st_point (0, 52)))
-WHERE
-  {
-    ?m geo:geometry ?geo .
-    ?m a <http://dbpedia.org/ontology/City> .
-    FILTER (bif:st_intersects (?geo, bif:st_point (0, 52), 30))
-  }
-ORDER BY DESC 2
-LIMIT 20;
-m                                                                                 callret-1
-VARCHAR                                                                           VARCHAR
-_______________________________________________________________________________
+create table DB.DBA.RDF_QUAD (
+  G IRI_ID_8,
+  S IRI_ID_8,
+  P IRI_ID_8,
+  O any,
+  primary key (P, S, O, G)
+  )
+alter index RDF_QUAD on DB.DBA.RDF_QUAD partition (S int (0hexffff00));
 
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 39.13180985471543
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 39.13180985471543
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 39.13180985471543
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 39.13180985471543
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 37.36907252285992
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 34.49432513061792
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 33.7676326404143
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 33.24238654570499
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 32.60139660515003
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 32.60139660515003
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 31.45681319171456
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 31.115377038
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 31.115377038
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 30.56388658524301
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 29.89662974046085
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 29.85090625132639
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 29.82605254366244
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 29.60102064794003
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 29.44147385851453
-http://dbpedia.org/resource/Stansted_Mountfitchet                                 29.421242437379
+create distinct no primary key ref bitmap index RDF_QUAD_SP on RDF_QUAD (S, P) partition (S int (0hexffff00));
+create bitmap index RDF_QUAD_POGS on RDF_QUAD (P, O, G, S) partition (O varchar (-1, 0hexffff));
+create distinct no primary key ref bitmap index RDF_QUAD_GS on RDF_QUAD (G, S) partition (S int (0hexffff00));
+create distinct no primary key ref index RDF_QUAD_OP on RDF_QUAD (O, P) partition (O varchar (-1, 0hexffff));
+;
 ]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp3"><title>Example 3</title>
-<programlisting><![CDATA[
-## Get City Stuff Around Catholic Churches In Paris Extended
-SQL>
-SPARQL
-SELECT ?m (bif:st_distance (?geo, bif:st_point (0, 52)))
-WHERE
-  {
-    ?m geo:geometry ?geo .
-    ?m a <http://dbpedia.org/ontology/City> .
-    FILTER (bif:st_intersects (?geo, bif:st_point (0, 52), 100))
-  }
-ORDER BY DESC 2
-LIMIT 20;
-m                                                                                 callret-1
-VARCHAR                                                                           VARCHAR
-_______________________________________________________________________________
 
-http://dbpedia.org/resource/Weston-on-Trent                                       138.7082197019335
-http://dbpedia.org/resource/Weston-on-Trent                                       137.7213767969613
-http://dbpedia.org/resource/Weston-on-Trent                                       136.4597167847218
-http://dbpedia.org/resource/Weston-on-Trent                                       134.1807668663677
-http://dbpedia.org/resource/Weston-on-Trent                                       133.104337839536
-http://dbpedia.org/resource/Weston-on-Trent                                       133.104337839536
-http://dbpedia.org/resource/Nonington                                             132.7368236183588
-http://dbpedia.org/resource/Nonington                                             132.1339163200362
-http://dbpedia.org/resource/Nonington                                             132.1339163200362
-http://dbpedia.org/resource/Nonington                                             130.5478483560461
-http://dbpedia.org/resource/Nonington                                             130.1620410981843
-http://dbpedia.org/resource/Nonington                                             129.8549842943355
-http://dbpedia.org/resource/Nonington                                             129.6459280567849
-http://dbpedia.org/resource/Nonington                                             129.4504858595742
-http://dbpedia.org/resource/Nonington                                             129.2790713235814
-http://dbpedia.org/resource/Nonington                                             128.9081040147881
-http://dbpedia.org/resource/Nonington                                             128.8845164618929
-http://dbpedia.org/resource/Nonington                                             128.6676189617872
-http://dbpedia.org/resource/Nonington                                             128.2565253458452
-http://dbpedia.org/resource/Nonington                                             128.2551696344652
 
-20 Rows. -- 120 msec.
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp4"><title>Example 4</title>
-<programlisting><![CDATA[
-## Text Or Geo
-SQL>
-SPARQL
-SELECT ?c COUNT (*)
-WHERE
-  {
-    ?m geo:geometry ?geo .
-    ?m a ?c .
-    FILTER (bif:st_intersects (?geo, bif:st_point (0, 52), 100)  &&  REGEX (str (?c), "London") )
-  }
-GROUP BY ?c
-ORDER BY DESC 2
-LIMIT 10;
+<para>
+The idea is to favor queries where the predicate is specified in
+triple patterns. The entire quad can be efficiently accessed when P
+and either or both S and O are known. This has the advantage of
+clustering data by the predicate which improves working set: A page
+read from disk will only have entries pertaining to the same
+predicate, chances of accessing other entries of the page are thus
+higher than if the page held values for arbitrary predicates. For
+less frequent cases where only S is known, as in describe, the
+distinct P's of the S are found in the SP index. These SP pairs are
+then used for accessing the PSOG index to get the O and G. For cases
+where only the G is known, as in dropping a graph, the distinct S's of
+the G are found in the GS index. The P's of the S are then found in
+the SP index. After this the whole quad is found in the PSOG index.
+</para>
 
-c  	                                                        callret-1
-____________________________________________________________________________
+<para>
+The SP, OP and GS indices do not store duplicates. If a S has many
+values of the P, there is only one entry. Extries are not deleted
+from SP, OP or GS. This does not lead to erroneous results since a
+full index, that is either POSG or PSOG is always consulted in order
+to know if a quad actually exists. For cases of updating data, most
+often a graph is entirely dropped and a substantially similar graph is
+inserted in its place. The SP, OP and GS indices get to stay relatively unaffected.
+</para>
+
+<para>
+Still over time specially if there are frequent updates and values do not repeat between
+consecutive states the SP, OP and GS indices will get polluted which may affect performance.
+Dropping and recreating the index will then remedy the situation.
+</para>
+
+<para>
+For cases where this is not practical the index scheme should only have full indices, i.e.
+each key holds all columns of the primary key of the quad. This will be the case if the
+distinct no primary key ref options are not specified in the create index statement. In
+such cases all indices remain in strict sync across deletes.
+</para>
+
+<para>
+Many RDF workloads have bulk load and read intensive access patterns with few deletes.
+The default index scheme is optimized for these. With these situations this scheme offers
+significant space savings resulting in better working set. Typically this layout takes
+60-70% of the space of a layout with 4 full indices.
+</para>
+    </sect2>
+    <sect2 id="rdfperfindexes"><title>Index Scheme Selection</title>
+<para>If the graph is always given, as one or more <emphasis>FROM</emphasis> or <emphasis>FROM NAMED</emphasis>, and there are no patterns where only graph and predicate are given, then the default indices should be appropriate.
+If the predicate and graph are given but subject is not, then it is sometimes useful to add</para>
 
-http://dbpedia.org/class/yago/DistrictsOfLondon 	            861
-http://dbpedia.org/class/yago/GradeIListedBuildingsInLondon 	    199
-http://dbpedia.org/class/yago/MuseumsInLondon 	                    107
-http://dbpedia.org/class/yago/ArtMuseumsAndGalleriesInLondon 	    92
-http://dbpedia.org/class/yago/GradeIIListedBuildingsInLondon 	    89
-http://dbpedia.org/class/yago/SportsVenuesInLondon 	            80
-http://dbpedia.org/class/yago/RoyalBuildingsInLondon 	            72
-http://dbpedia.org/class/yago/LondonOvergroundStations 	            69
-http://dbpedia.org/class/yago/NationalGovernmentBuildingsInLondon   69
-http://dbpedia.org/class/yago/SkyscrapersInLondon 	            60
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp5"><title>Example 5</title>
 <programlisting><![CDATA[
-## Example "Places Of Worship, Within 5 km Of Paris":
+create bitmap index RDF_QUAD_PGOS on DB.DBA.RDF_QUAD (G, P, O, S) partition (O varchar (-1, 0hexffff));
+]]></programlisting>
 
-## Describes places of worship, within 5 km of Paris,
-## that have cafes in close proximity(0.2 km).
-## The query requires V6 or higher.
-SQL>
-PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
-DESCRIBE ?cafe ?church
-WHERE
-  {
-    ?church a lgv:place_of_worship .
-    ?church geo:geometry ?churchgeo .
-    ?church lgv:name ?churchname .
-    ?cafe a lgv:cafe .
-    ?cafe lgv:name ?cafename .
-    ?cafe geo:geometry ?cafegeo .
-    ?cafe geo:lat ?lat .
-    ?cafe geo:long ?long .
-    FILTER ( bif:st_intersects ( ?churchgeo, bif:st_point ( 2.3498, 48.853 ), 5 ) &&
-             bif:st_intersects ( ?cafegeo, ?churchgeo, 0.2 ) )
-  }
-LIMIT 10;
+<note><para>If the server is pre 5.0.7, leave out the partitioning clause.</para></note>
+
+<para>Making the PGOS index can help in some cases even if it is not readily apparent from the queries that one is needed.  This is so for example if the predicate by itself is selective, i.e. there is a predicate that occurs in only a few triples.</para>
+<para>If the graph itself is not given in the queries, then the default index scheme will be unworkable.
+For this, the appropriate scheme is:</para>
 
- at prefix rdf:	<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- at prefix ns1:	<http://linkedgeodata.org/triplify/node/243360870#> .
- at prefix ns2:	<http://linkedgeodata.org/vocabulary#> .
-ns1:id	rdf:type	ns2:place_of_worship ,
-		ns2:node .
- at prefix geo:	<http://www.w3.org/2003/01/geo/wgs84_pos#> .
-ns1:id	geo:lat	48.8794 ;
-	geo:long	2.3748 ;
-	ns2:created_by	"Potlatch 0.6c" ;
-	ns2:name	"Saint-Georges de la Villette" ;
-	ns2:religion	"christian" ,
-		ns2:christian .
- at prefix virtrdf:	<http://www.openlinksw.com/schemas/virtrdf#> .
-ns1:id	geo:geometry	"POINT(2.3748 48.8794)"^^virtrdf:Geometry .
- at prefix ns5:	<http://linkedgeodata.org/triplify/node/266632049#> .
-ns5:id	rdf:type	ns2:node ,
-		ns2:cafe ;
-	geo:lat	48.8518 ;
-	geo:long	2.325 ;
-	ns2:created_by	"Potlatch 0.9a" ;
-	ns2:name	"Le Babylone" ;
-	geo:geometry	"POINT(2.325 48.8518)"^^virtrdf:Geometry .
-....
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp6"><title>Example 6</title>
 <programlisting><![CDATA[
-## Count Geo
-SQL>
-SPARQL
-SELECT ?c COUNT (*)
-WHERE
-   {
-     ?s geo:geometry ?geo .
-     FILTER (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 5)) .
-     ?s a ?c
-   }
-GROUP BY ?c
-ORDER BY desc 2
-LIMIT 10;
+create table RDF_QUAD (G iri_id_8, S iri_id_8, P iri_id_8, O any, primary key (S, P, O, G))
+alter index RDF_QUAD on RDF_QUAD partition (S int (0hexffff00));
+create bitmap index RDF_QUAD_OPGS on DB.DBA.RDF_QUAD (O, P, G, S) partition (O varchar (-1, 0hexffff));
+create bitmap index RDF_QUAD_POGS on DB.DBA.RDF_QUAD (P, O, G, S) partition (O varchar (-1, 0hexffff));
+create bitmap index RDF_QUAD_GPOS on DB.DBA.RDF_QUAD (G, P, O, S) partition (O varchar (-1, 0hexffff));
+]]></programlisting>
 
-c                                                                                 callret-1
-VARCHAR                                                                           VARCHAR
-_______________________________________________________________________________
+<note><para>For a pre 5.0.7 server, leave the partition clauses and the alter index statement out.</para></note>
 
-http://linkedgeodata.org/vocabulary#node                                          37792
-http://dbpedia.org/class/yago/Landmark108624891                                   4003
-http://linkedgeodata.org/vocabulary#way                                           1688
-http://linkedgeodata.org/vocabulary#building                                      719
-http://linkedgeodata.org/vocabulary#station                                       257
-http://linkedgeodata.org/vocabulary#post_box                                      247
-http://www.w3.org/2002/07/owl#Thing                                               227
-http://linkedgeodata.org/vocabulary#park                                          208
-http://linkedgeodata.org/vocabulary#restaurant                                    198
-http://dbpedia.org/ontology/Place                                                 192
+<para>If there are existing triples and one does not wish to reload them, then the following sequence will convert the data:</para>
 
-10 Rows. -- 932 msec.
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp7"><title>Example 7</title>
 <programlisting><![CDATA[
-## Get Stuff Around Notre Dame De Paris
-SQL>
-SPARQL
-SELECT ?c COUNT (*)
-WHERE
-  {
-    ?s a ?c .
-    ?s geo:geometry ?geo .
-    FILTER (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 0.3))
-  }
-GROUP BY ?c
-ORDER BY desc 2
-LIMIT 10;
+log_enable (2);
+drop index RDF_QUAD_OGPS;
+checkpoint;
+create table R2 (G iri_id_8, S iri_id_8, P iri_id_8, O any, primary key (S, P, O, G))
+alter index R2 on R2 partition (S int (0hexffff00));
 
-c                                                                                 callret-1
-VARCHAR                                                                           VARCHAR
-_______________________________________________________________________________
+insert into r2 (g, s, p, o) SELECT g, s, p, o from rdf_quad;
 
-http://linkedgeodata.org/vocabulary#node                                          408
-http://dbpedia.org/class/yago/Landmark108624891                                   134
-http://linkedgeodata.org/vocabulary#way                                           17
-http://dbpedia.org/class/yago/RomanCatholicChurchesInParis                        17
-http://dbpedia.org/class/yago/TallBuildingsAndStructuresInParis                   13
-http://dbpedia.org/class/yago/CathedralsInFrance                                  13
-http://sw.opencyc.org/2008/06/10/concept/Mx4rvVigPpwpEbGdrcN5Y29ycA               13
-http://sw.opencyc.org/2008/06/10/concept/Mx4rjm5QanS6EdaAAACgyZzFrg               13
-http://sw.opencyc.org/2008/06/10/concept/Mx4rwQwtGpwpEbGdrcN5Y29ycA               13
-http://www.w3.org/2002/07/owl#Thing                                               10
+drop table RDF_QUAD;
+checkpoint;
+alter table r2 rename RDF_QUAD;
+create bitmap index RDF_QUAD_OPGS on DB.DBA.RDF_QUAD (O, P, G, S) partition (O varchar (-1, 0hexffff));
+create bitmap index RDF_QUAD_POGS on RDF_QUAD (P, O, G, S) partition (O varchar (-1, 0hexffff));
+create bitmap index RDF_QUAD_GPOS on RDF_QUAD (G, P, O, S) partition (O varchar (-1, 0hexffff));
+checkpoint;
+log_enable (1);
+]]></programlisting>
+
+<para>First drop the OGPS index to make space.  Then, in row autocommit mode
+and without logging, copy the quads into a new primary key layout.
+Drop the old and rename the new over the old.  Make the additional
+indices.  Do a checkpoint after the drops so as to actually free the
+space also in the checkpointed state.  Finish with a checkpoint so as
+to finalize the changes, since logging was turned off.  Even if
+logging had been on, one would not wish to have to replay the
+reindexing if the server terminated abnormally.
+Finally turn logging back on for the session.</para>
+
+<note><para>This is all meant to be done with a SQL client like isql and not through a web interface.
+The web interface has no real session and the log_enables do nothing there.</para></note>
+
+<para>Other indexing schemes may be tried.  We note however that in all
+cases, one or other of the indices should begin with G.  This is
+because for schema operations it is necessary to read through a
+graph. If no index begins with G, this becomes a full table scan and
+is unworkable, leading to an extremely slow server start and making
+operations like drop graph as good as unusable.</para>
+
+<para>Public web service endpoints are proven to be sources of especially bad queries. While local
+application develpers can obtain instructions from database administrator and use ISQL access to
+the database in order to tune execution plans, "external" clients do not know details of
+configuration and/or lacks appropriate skills. The most common problem is that public endpoints usually
+get requests that does not mention the required graph, because that queries were initially written for
+use with triple stores. If the web service provides access to a single graph (or to a short list of graphs)
+then it is strongly recommended to configure it by adding a row into
+<emphasis>DB.DBA.SYS_SPARQL_HOST</emphasis>:</para>
+<programlisting><![CDATA[
+CREATE TABLE "DB"."DBA"."SYS_SPARQL_HOST"
+(
+  "SH_HOST" VARCHAR,         -- host pattern
+  "SH_GRAPH_URI" VARCHAR,    -- default graph
+  "SH_USER_URI" VARCHAR,     -- reserved for any use in applications
+  "SH_DEFINES" LONG VARCHAR, -- list of 'define xx:yy "zz" ' defines as a string 
+  PRIMARY KEY ("SH_HOST")
+);
 
-10 Rows. -- 241 msec.
 ]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp8"><title>Example 8</title>
+<para>You can find detailed descriptions of the table columns <link linkend="rdfdefaultgraph">here</link>.</para>
+<para>The idea is that if the client specifies default graph in
+the request or uses named graphs and group graph patterns then he is probably smarter than average and
+will provide meaningful queries. If no graph names are specified then the query will benefit from
+preset graph because this will give the compiler some more indexes to choose from -- indexes that begin
+with G.</para>
+<para>Sometimes web service endpoint is used to access data of only one application, not all data in the
+system. In that case one may wish to declare a separate storage that consists of only RDF Views made
+by that application and define <emphasis>input:storage</emphasis> in appropriate row of
+<emphasis>DB.DBA.SYS_SPARQL_HOST</emphasis>.</para>
+</sect2>
+<sect2 id="rdfperfgetallgraphs"><title>Get All Graphs</title>
+<para>In order to get all graphs URIs, one might use the Virtuoso 
+<link linkend="fn_sparql_select_known_graphs"><function>DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS()</function></link> 
+built-in function.</para>
+</sect2>
+<sect2 id="rdfperfdumpandreloadgraphs"><title>Dump and Reload Graphs</title>
+In order to dump all graphs with extension exclude those graphs of a certain type by using a
+sparql ask query, you may use the following script sequence:
 <programlisting><![CDATA[
-## Things within 10 km proximity of place of worship
-SQL>
-SPARQL
-PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
-SELECT ?c COUNT (*)
-WHERE
-  {
-    ?s a ?c .
-    ?s a lgv:place_of_worship .
-    ?s geo:geometry ?geo .
-    FILTER (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 10))
-  }
-GROUP BY ?c
-ORDER BY desc 2
-LIMIT 10;
+create procedure dump_graphs (in dir varchar := 'dumps', in file_length_limit integer := 1000000000)
+{
+  declare inx int;
+  inx := 1;
+  set isolation = 'uncommitted';
+  for (select * from (sparql define input:storage "" select distinct ?g { graph ?g { ?s ?p ?o } . filter ( ?g != virtrdf: ) } ) as sub option (loop)) do
+    {
 
-c                                                                                 callret-1
-VARCHAR                                                                           VARCHAR
-_______________________________________________________________________________
+      if (exists (sparql define input:storage "" ask where { ?:g <http://www.strigi.org/fields#indexGraphFor> ?r . }))
+	{
+      dump_one_graph ("g", sprintf ('%s/graph%06d_', dir, inx), file_length_limit);
+        }
+      else
+	{
+	  dump_one_graph ("g", sprintf ('%s/graph%06d_', dir, inx), file_length_limit);
+	}
+      inx := inx + 1;
+    }
+}
+;
+
+create procedure dump_one_graph (in srcgraph varchar, in out_file_prefix varchar, in file_length_limit integer := 1000000000)
+{
+  declare file_name varchar;
+  declare env, ses any;
+  declare ses_len, max_ses_len, file_len, file_idx integer;
+  set isolation = 'uncommitted';
+  max_ses_len := 10000000;
+  file_len := 0;
+  file_idx := 1;
+  file_name := sprintf ('%s%06d.ttl', out_file_prefix, file_idx);
+  string_to_file (file_name || '.graph', srcgraph, -2);
+  string_to_file (file_name, sprintf ('# Dump of graph <%s>, as of %s\n', srcgraph, cast (now() as varchar)), -2);
+  --env := vector (dict_new (16000), 0, '', '', '', 0, 0);
+  env := vector (dict_new (16000), 0, '', '', '', 0, 0, 0, 0);
+  ses := string_output ();
+  for (select * from (sparql define input:storage "" select ?s ?p ?o { graph `iri(?:srcgraph)` { ?s ?p ?o } } ) as sub option (loop)) do
+    {
+      http_ttl_triple (env, "s", "p", "o", ses);
+      ses_len := length (ses);
+      if (ses_len > max_ses_len)
+        {
+          file_len := file_len + ses_len;
+          if (file_len > file_length_limit)
+            {
+              http (' .\n', ses);
+              string_to_file (file_name, ses, -1);
+              file_len := 0;
+              file_idx := file_idx + 1;
+              file_name := sprintf ('%s%06d.ttl', out_file_prefix, file_idx);
+              string_to_file (file_name, sprintf ('# Dump of graph <%s>, as of %s (part %d)\n', srcgraph, cast (now() as varchar), file_idx), -2);
+	      env := vector (dict_new (16000), 0, '', '', '', 0, 0, 0, 0);
+            }
+          else
+            string_to_file (file_name, ses, -1);
+          ses := string_output ();
+        }
+    }
+  if (length (ses))
+    {
+      http (' .\n', ses);
+      string_to_file (file_name, ses, -1);
+    }
+}
+;
 
-http://linkedgeodata.org/vocabulary#place_of_worship                              147
-http://linkedgeodata.org/vocabulary#node                                          146
-http://linkedgeodata.org/vocabulary#way                                           46
-http://linkedgeodata.org/vocabulary#building                                      36
-http://linkedgeodata.org/vocabulary#attraction                                    3
-http://linkedgeodata.org/vocabulary#church                                        1
+create procedure load_graphs (in dir varchar := 'dumps/')
+{
+  declare arr any;
+  declare g varchar;
 
-6 Rows. -- 120 msec.
+  arr := sys_dirlist (dir, 1);
+  log_enable (2, 1);
+  foreach (varchar f in arr) do
+    {
+      if (f like '*.ttl')
+	{
+	  declare continue handler for sqlstate '*'
+	    {
+	      log_message (sprintf ('Error in %s', f));
+	    };
+  	  g := file_to_string (dir || '/' || f || '.graph');
+	  DB.DBA.TTLP_MT (file_open (dir || '/' || f), g, g, 255);
+	}
+    }
+  exec ('checkpoint');
+}
+;
 ]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp9"><title>Example 9</title>
-<programlisting><![CDATA[
-## Get Stuff Around Notre Dame De Paris with Names
-SQL>
-SPARQL
-PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
-SELECT ?cn
-WHERE
-  {
-    ?s lgv:name ?cn  .
-    ?s geo:geometry ?geo .
-    FILTER (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 0.3))
-  }
-LIMIT 20;
-cn
-VARCHAR
-_______________________________________________________________________________
+   <sect3 id="rdfperfdumpandreloadgraphsexamples"><title>Examples for Dump and Reload Graphs</title>
+SQL>dump_one_graph ('http://daas.openlinksw.com/data#', './bbc_data_', 1000000000);
+SQL>dump_one_graph ('http://daas.openlinksw.com/data#', './bbc_data_');
+   </sect3>
+</sect2>
+<sect2 id="rdfperfdumpandreloadgraphsn3"><title>Dump RDF View Graph to n3</title>
+<para>The RDF_QM_TREE_DUMP procedure and its associated procedures below are used 
+for dumping one or more RDFView Graphs in a Virtuoso server to a set of 
+turtle ttl dataset files in the specified dump directory. The dump generation 
+is made as fast as possible by grouping mappings by underlying tables so many 
+properties from neighbor database columns can be extracted in one table scan. 
+The size of the generated files is limited to 5MB. The dump process creates 
+internal stored procedures; their texts are saved in file .dump_procedures.sql in 
+the directory of dump files for debugging purposes.
+</para>
 
-Parking Lagrange
-Maitre Albert B&B
-Le Grenier de Notre Dame
-Eglise Saint-Julien-le-Pauvre
-Eglise Saint Julien le Pauvre
-Polly Magoo
-Point 0 des Routes de France
-Square Jean XXIII
-....
-20 Rows. -- 140 msec.
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp10"><title>Example 10</title>
+<para>Note that the dump directory must be included in the <code>DirsAllowed</code> 
+parameter of the Virtuoso configuration file (e.g., <code>virtuoso.ini</code>), or the 
+server will not be allowed to create nor access the dataset file(s).
+</para>
+
+<para>
+The <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtBulkRDFLoader">Virtuoso RDF bulk loader</ulink> 
+scripts can then be used to load the dumped datasets for the RDFView graphs directly into 
+a Virtuoso RDF QUAD store.
+</para>
+
+<sect3 id="rdfperfdumpandreloadgraphsn3params"><title>Parameters</title>
+<itemizedlist mark="bullet">
+  <listitem><code>in</code> <emphasis>dest_dir</emphasis> <code>VARCHAR</code> - dump directory </listitem>
+  <listitem><code>in</code> <emphasis>graph_iri</emphasis> <code>VARCHAR</code> - IRI of the graph to be dumped; triples from other graphs will be excluded. If NULL, then there's no restriction by graph.</listitem>
+  <listitem><code>in</code> <emphasis>storage</emphasis> <code>VARCHAR</code> - IRI of the quad map storage to use. NULL means use default storage.</listitem>
+  <listitem><code>in</code> <emphasis>root</emphasis> <code>VARCHAR</code> - IRI of the quad map to use, e.g., an IRI of an RDF View (or its part). NULL means use all RDF Views of the storage (and the default mapping as well).</listitem>    
+</itemizedlist>
+</sect3>
+<sect3 id="rdfperfdumpandreloadgraphsn3code"><title>Procedure Code</title>
 <programlisting><![CDATA[
-## Get Churches With The Most Bars
-SQL>
-SPARQL
-PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
-SELECT ?churchname ?cafename (bif:st_distance (?churchgeo, ?cafegeo))
-WHERE
-  {
-    ?church a lgv:place_of_worship .
-    ?church geo:geometry ?churchgeo .
-    ?church lgv:name ?churchname .
-    ?cafe a lgv:cafe .
-    ?cafe lgv:name ?cafename .
-    ?cafe geo:geometry ?cafegeo .
-    FILTER (bif:st_intersects (?churchgeo, bif:st_point (2.3498, 48.853), 5)
-      && bif:st_intersects (?cafegeo, ?churchgeo, 0.2))
-  }
-LIMIT 10;
+CREATE PROCEDURE DB.DBA.RDF_QM_TREE_DUMP 
+  ( in  dest_dir  VARCHAR, 
+    in  graph_iri VARCHAR := NULL, 
+    in  storage   VARCHAR := NULL, 
+    in  root      VARCHAR := NULL
+  )
+{
+ DECLARE all_qms, 
+         grouped_qmvs, 
+         launcher_text  ANY;
+ DECLARE grp_ctr, 
+         qm_ctr, 
+         qm_count       INTEGER;
+ DECLARE sql_file, 
+         launcher_name  VARCHAR;
+ IF (NOT (dest_dir LIKE '%/'))
+   dest_dir := dest_dir || '/';
+ sql_file := dest_dir || '.dump_procedures.sql';
+ IF (storage IS NULL)
+   storage := 'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage';
+ string_to_file (
+   sql_file, 
+   '-- This file contains procedure created by DB.DBA.RDF_QM_TREE_DUMP() for storage ' 
+      || COALESCE (storage, 'NULL') 
+      || ' and root quad map ' 
+      || COALESCE (root, 'NULL') 
+      || '\n\n', 
+   -2);
+ all_qms := dict_list_keys (DB.DBA.RDF_QM_CONTENT_OF_QM_TREE (graph_iri, storage, root), 2);
+ grouped_qmvs := DB.DBA.RDF_QM_GROUP_BY_SOURCE_TABLES (all_qms);
+ launcher_name := 'RDF_QM_TREE_DUMP_BATCH_' || md5 (serialize (graph_iri) || storage || serialize (root));
+ launcher_text := string_output ();
+ http ('CREATE PROCEDURE DB.DBA."' || launcher_name || '" (in dest_dir VARCHAR)\n{\n', launcher_text);
+ FOR (grp_ctr := length (grouped_qmvs); grp_ctr > 0; grp_ctr := grp_ctr-2)
+   {
+     DECLARE tables, qms, proc_text ANY;
+     DECLARE group_key, proc_name, dump_prefix, cmt VARCHAR;
+     tables := grouped_qmvs [grp_ctr-2];
+     qms := grouped_qmvs [grp_ctr-1];
+     qm_count := length (qms);
+     group_key := md5 (serialize (graph_iri) || storage || serialize (root) || serialize (tables));
+     proc_name := 'RDF_QM_TREE_DUMP_GRP_' || group_key;
+     proc_text := string_output ();
+     cmt := sprintf ('%d quad maps on join of', qm_count);
+     FOREACH (VARCHAR t IN tables) DO cmt := cmt || ' ' || t;
+     http ('  --  ' || cmt || '\n', launcher_text);
+     http ('  DB.DBA."' || proc_name || '" (dest_dir);\n', launcher_text);
+     http ('CREATE PROCEDURE DB.DBA."' || proc_name || '" (in dest_dir VARCHAR)\n', proc_text);
+     http ('{\n', proc_text);
+     http ('  -- ' || cmt || '\n', proc_text);
+     http ('  DECLARE ses, env ANY;\n', proc_text);
+     http ('  DECLARE file_ctr, cmt_len INTEGER;\n', proc_text);
+     http ('  file_ctr := 0;\n', proc_text);
+     http ('  dbg_obj_princ (' || WS.WS.STR_SQL_APOS (cmt) || ', '', file '', file_ctr);\n', proc_text);
+     http ('  ses := string_output ();\n', proc_text);
+     http ('  http (' || WS.WS.STR_SQL_APOS ('#' || cmt || '\n') || ', ses);\n', proc_text);
+     http ('  env := VECTOR (dict_new (16000), 0, '''', '''', '''', 0, 0, 0, 0);\n', proc_text);
+     http ('  cmt_len := LENGTH (ses);\n', proc_text);
+     http ('  FOR (SPARQL DEFINE input:storage <' || storage || '>\n', proc_text);
+     http ('    SELECT ?s1, ?p1, ?o1\n', proc_text);
+     IF (graph_iri IS NOT NULL)
+       {
+         http ('    WHERE { GRAPH <', proc_text); http_escape (graph_iri, 12, proc_text, 1, 1); http ('> {\n', proc_text);
+       }
+     ELSE
+       http ('    WHERE { GRAPH ?g1 {\n', proc_text);
+     FOR (qm_ctr := 0; qm_ctr < qm_count; qm_ctr := qm_ctr + 1)
+       {
+         IF (qm_ctr > 0) http ('            UNION\n', proc_text);
+         http ('            { quad map <' || qms[qm_ctr] || '> { ?s1 ?p1 ?o1 } }\n', proc_text);
+       }
+     http ('          } } ) DO {\n', proc_text);
+     http ('      http_ttl_triple (env, "s1", "p1", "o1", ses);\n', proc_text);
+     http ('      IF (LENGTH (ses) > 5000000)\n', proc_text);
+     http ('        {\n', proc_text);
+     http ('          http ('' .\\n'', ses);\n', proc_text);
+     http ('          string_to_file (sprintf (''%s' || group_key || '_%05d.ttl'', dest_dir, file_ctr), ses, -2);\n', proc_text);
+     http ('          file_ctr := file_ctr + 1;\n', proc_text);
+     http ('          dbg_obj_princ (' || WS.WS.STR_SQL_APOS (cmt) || ', '', file '', file_ctr);\n', proc_text);
+     http ('          ses := string_output ();\n', proc_text);
+     http ('          http (' || WS.WS.STR_SQL_APOS ('#' || cmt || '\n') || ', ses);\n', proc_text);
+     http ('          env := VECTOR (dict_new (16000), 0, '''', '''', '''', 0, 0, 0, 0);\n', proc_text);
+     http ('        }\n', proc_text);
+     http ('    }\n', proc_text);
+     http ('  IF (LENGTH (ses) > cmt_len)\n', proc_text);
+     http ('    {\n', proc_text);
+     http ('      http ('' .\\n'', ses);\n', proc_text);
+     http ('      string_to_file (sprintf (''%s' || group_key || '_%05d.ttl'', dest_dir, file_ctr), ses, -2);\n', proc_text);
+     http ('    }\n', proc_text);
+     http ('}\n', proc_text);
+     proc_text := string_output_string (proc_text);
+     string_to_file (sql_file, proc_text || ';\n\n' , -1);
+     EXEC (proc_text);
+   }
+ http ('}\n', launcher_text);
+ launcher_text := string_output_string (launcher_text);
+ string_to_file (sql_file, launcher_text || ';\n\n' , -1);
+ EXEC (launcher_text);
+ CALL ('DB.DBA.' || launcher_name)(dest_dir);
+}
+;
 
-churchname                            cafename                            callret-2
-VARCHAR                               VARCHAR                             VARCHAR
-_______________________________________________________________________________
+CREATE FUNCTION DB.DBA.RDF_QM_CONTENT_OF_QM_TREE 
+  ( in  graph_iri  VARCHAR := NULL,
+    in  storage    VARCHAR := NULL, 
+    in  root       VARCHAR := NULL, 
+    in  dict       ANY := NULL
+  ) returns ANY
+{
+ DECLARE res, subqms any;
+ DECLARE graphiri varchar;
+ graphiri := DB.DBA.JSO_SYS_GRAPH();
+ IF (storage IS NULL)
+   storage := 'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage';
+ DB.DBA.RDF_QM_ASSERT_STORAGE_FLAG (storage, 0);
+ IF (dict IS NULL)
+   dict := dict_new ();
+ IF (root IS NULL)
+   {
+     subqms := ((SELECT DB.DBA.VECTOR_AGG (sub."qmiri")
+         FROM (
+           SPARQL DEFINE input:storage ""
+           SELECT DISTINCT (str(?qm)) AS ?qmiri
+           WHERE { GRAPH `iri(?:graphiri)` {
+                     { `iri(?:storage)` virtrdf:qsUserMaps ?lst .
+                       ?lst ?p ?qm .
+                       FILTER (0 = bif:strstr (str(?p), str(rdf:_)))
+                     } UNION {
+                       `iri(?:storage)` virtrdf:qsDefaultMap ?qm .
+                     } } } ) AS sub ) );
+     FOREACH (varchar qmid IN subqms) DO
+       DB.DBA.RDF_QM_CONTENT_OF_QM_TREE (graph_iri, storage, qmid, dict);
+     RETURN dict;
+   }
+ DB.DBA.RDF_QM_ASSERT_JSO_TYPE (root, 'http://www.openlinksw.com/schemas/virtrdf#QuadMap');
+ IF (graph_iri IS NOT NULL AND
+   EXISTS ((SPARQL DEFINE input:storage ""
+       SELECT (1) WHERE {
+           GRAPH `iri(?:graphiri)` {
+               `iri(?:root)` virtrdf:qmGraphRange-rvrFixedValue ?g .
+               FILTER (str (?g) != str(?:graph_iri))
+             } } ) ) )
+   RETURN dict;
+ IF (NOT EXISTS ((SPARQL DEFINE input:storage ""
+       SELECT (1) WHERE {
+           GRAPH `iri(?:graphiri)` {
+               `iri(?:root)` virtrdf:qmMatchingFlags virtrdf:SPART_QM_EMPTY .
+             } } ) ) )
+   dict_put (dict, root, 1);
+ subqms := ((SELECT DB.DBA.VECTOR_AGG (sub."qmiri")
+     FROM (
+       SPARQL DEFINE input:storage ""
+       SELECT DISTINCT (str(?qm)) as ?qmiri
+       WHERE { GRAPH `iri(?:graphiri)` {
+   		`iri(?:root)` virtrdf:qmUserSubMaps ?lst .
+               ?lst ?p ?qm .
+               FILTER (0 = bif:strstr (str(?p), str(rdf:_)))
+             } } ) AS sub ) );
+ FOREACH (VARCHAR qmid IN subqms) DO
+   DB.DBA.RDF_QM_CONTENT_OF_QM_TREE (graph_iri, storage, qmid, dict);
+ RETURN dict;
+}
+;
 
-Eglise Saint-Julien-le-Pauvre         Le Saint R+?-?gis                   0.09759308692691648
-Eglise Saint-Germain des Pr+?-?s      Caf+?-? de Flore                    0.08774468391412803
-Eglise Saint-Germain des Pr+?-?s      Les Deux Magots                     0.05235923473923059
-Eglise Saint-Germain des Pr+?-?s      Caf+?-? Mabillon                    0.1712042770289815
-Eglise Saint-Germain-des-Pr+?-?s      Caf+?-? de Flore                    0.1466502865197912
-Eglise Saint-Germain-des-Pr+?-?s      Les Deux Magots                     0.1096767137079839
-Eglise Saint-Germain-des-Pr+?-?s      Bar du march+?-?                    0.1831441251868126
-Eglise Saint-Germain-des-Pr+?-?s      Caf+?-? Mabillon                    0.1174051745495528
-Synagogue                             La Chaise au Plafond                0.1038387283609551
-Synagogue                             Le Loir dans la Th+?-?i+?-?re       0.1632848322062273
+CREATE FUNCTION DB.DBA.RDF_QM_GROUP_BY_SOURCE_TABLES (in qms ANY) returns ANY
+{
+ DECLARE res ANY;
+ DECLARE ctr INTEGER;
+ DECLARE graphiri VARCHAR;
+ graphiri := DB.DBA.JSO_SYS_GRAPH();
+ res := dict_new (LENGTH (qms) / 20);
+ FOREACH (VARCHAR qmiri IN qms) DO
+   {
+     DECLARE tbls, acc ANY;
+     tbls := ((SELECT DB.DBA.VECTOR_AGG (sub."tbl")
+         FROM (SELECT subsub."tbl"
+           FROM (
+             SPARQL DEFINE input:storage ""
+             SELECT DISTINCT ?tbl
+             WHERE { GRAPH `iri(?:graphiri)` {
+                       { `iri(?:qmiri)` virtrdf:qmTableName ?tbl .
+                       } UNION {
+                         `iri(?:qmiri)` virtrdf:qmATables ?atbls .
+                         ?atbls ?p ?atbl .
+                         ?atbl virtrdf:qmvaTableName ?tbl
+                       } UNION {
+                         `iri(?:qmiri)` ?fldmap ?qmv .
+                         ?qmv virtrdf:qmvATables ?atbls .
+                         ?atbls ?p ?atbl .
+                         ?atbl virtrdf:qmvaTableName ?tbl .
+                       } } } ) subsub
+           ORDER BY 1 ) AS sub ) );
+     acc := dict_get (res, tbls);
+     IF (acc IS NULL)
+       vectorbld_init (acc);
+     vectorbld_acc (acc, qmiri);
+     dict_put (res, tbls, acc);
+   }
+ res := dict_to_vector (res, 2);
+ FOR (ctr := LENGTH (res); ctr > 0; ctr := ctr-2)
+   {
+     DECLARE acc ANY;
+     acc := aref_set_0 (res, ctr-1);
+     vectorbld_final (acc);
+     aset_zap_arg (res, ctr-1, acc);
+   }
+ RETURN res;
+}
+;
 
-10 Rows. -- 511225 msec.
+--test dbg_obj_princ (DB.DBA.RDF_QM_GROUP_BY_SOURCE_TABLES (dict_list_keys (DB.DBA.RDF_QM_CONTENT_OF_QM_TREE (null), 2)));
+--test dbg_obj_princ (dict_list_keys (DB.DBA.RDF_QM_CONTENT_OF_QM_TREE (null), 2));
+--test DB.DBA.RDF_QM_TREE_DUMP ('dump/demo', null, null, null);
+--test DB.DBA.RDF_QM_TREE_DUMP ('dump/tpch', 'http://localhost:8600/tpch', null, null);	
 ]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp11"><title>Example 11</title>
-<programlisting><![CDATA[
-## Things around highly populated places
-SQL>
-SPARQL
-SELECT ?s ( sql:num_or_null (?o) ) COUNT (*)
-WHERE
-  {
-    ?s <http://dbpedia.org/ontology/populationTotal> ?o .
-        FILTER ( sql:num_or_null (?o) > 6000000 ) .
-    ?s geo:geometry ?geo .
-        FILTER ( bif:st_intersects (?pt, ?geo,2) ) .
-    ?xx geo:geometry ?pt
-  }
-GROUP BY ?s ( sql:num_or_null (?o) )
-ORDER BY desc 3
-LIMIT 20;
-
-s                                                         callret-1        callret-2
-VARCHAR                                                   VARCHAR          VARCHAR
-_______________________________________________________________________________
+</sect3>	
+</sect2>	
+<sect2 id="rdfperfcost"><title>Erroneous Cost Estimates and Explicit Join Order</title>
 
-http://dbpedia.org/resource/London                        7556900          312307
-http://dbpedia.org/resource/Toronto                       8102163          115859
-http://dbpedia.org/resource/New_York_City                 8363710          95629
-http://dbpedia.org/resource/The_Hague                     6659300          84410
-http://dbpedia.org/resource/Tokyo                         12790000         78618
-http://dbpedia.org/resource/Philadelphia                  6385461          67115
-http://dbpedia.org/resource/Los_Angeles                   17755322         64394
-http://dbpedia.org/resource/Bangkok                       8160522          62519
-http://dbpedia.org/resource/Barcelona                     2147483648       57635
-http://dbpedia.org/resource/Cairo                         6758581          52738
-http://dbpedia.org/resource/Istanbul                      12697164         50745
-http://dbpedia.org/resource/Seoul                         10421782         43962
-http://dbpedia.org/resource/Beijing                       17430000         35979
-http://dbpedia.org/resource/Purmerend                     6659300          33508
-http://dbpedia.org/resource/Baghdad                       6554126          33426
-http://dbpedia.org/resource/Bogot%C3%A1                   6776009          30429
-http://dbpedia.org/resource/Mexico_City                   8836045          30127
-http://dbpedia.org/resource/Jakarta                       8500000          28944
-http://dbpedia.org/resource/Boston                        7514759          27705
-http://dbpedia.org/resource/Baden-W%C3%BCrttemberg        10755000         25112
+	<para>The selectivity of triple patterns is determined at query compile time from sampling the data.
+It is possible that misleading data is produced.
+To see if the cardinality guesses are generally valid, look at the query plan with <link linkend="fn_explain"><function>explain</function> ()</link>.</para>
+<para>Below is a sample from the LUBM qualification data set in the Virtuoso distribution.
+After running <emphasis>make test</emphasis> in <emphasis>binsrc/test/lubm</emphasis>, there is a loaded database with the data.
+Start a server in the same directory to see the data.</para>
 
-20 Rows. -- 4296 msec.
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp12"><title>Example 12</title>
 <programlisting><![CDATA[
-## Example "Places Of Worship, Within 5 km Of Paris":
-
-## Constructs a custom Linked Data Mesh (graph) about
-## places of worship, within 5 km of Paris, that have
-## cafes in close proximity(0.2 km).
+SQL> explain ('SPARQL prefix ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>
+SELECT *
+FROM <lubm>
+WHERE { ?x rdf:type ub:GraduateStudent }');
 
-## Note: we have distinct pin colors that identify
-## for places of worship distinct from cafes.
+REPORT
+VARCHAR
+_______________________________________________________________________________
 
-## The query requires V6 or higher.
-SQL>
-SPARQL
-PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
-PREFIX rtb: <http://www.openlinksw.com/schemas/oat/rdftabs#>
-CONSTRUCT
-  {
-    ?cafe geo:geometry ?cafegeo        ;
-                   rtb:useMarker '01'  ;
-                  lgv:name ?cafename   .
-    ?church geo:geometry ?churchgeo    ;
-                   rtb:useMarker '02'  ;
-                lgv:name ?churchname   .
-  }
-WHERE
-  {
-    ?church a lgv:place_of_worship .
-    ?church geo:geometry ?churchgeo .
-    ?church lgv:name ?churchname .
-    ?cafe a lgv:cafe .
-    ?cafe lgv:name ?cafename .
-    ?cafe geo:geometry ?cafegeo .
-    ?cafe geo:lat ?lat .
-    ?cafe geo:long ?long .
-    FILTER ( bif:st_intersects ( ?churchgeo, bif:st_point ( 2.3498, 48.853 ), 5 ) &&
-             bif:st_intersects ( ?cafegeo, ?churchgeo, 0.2 ) )
-  }
-LIMIT 10;
+{ 
+ 
+Precode:
+      0: $25 "callret" := Call __BOX_FLAGS_TWEAK (<constant (lubm)>, <constant (1)>)
+      5: $26 "lubm" := Call DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE ($25 "callret")
+      12: $27 "callret" := Call __BOX_FLAGS_TWEAK (<constant (http://www.w3.org/1999/02/22-rdf-syntax-ns#type)>, <constant (1)>)
+      17: $28 "-ns#type" := Call DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE ($27 "callret")
+      24: $29 "callret" := Call __BOX_FLAGS_TWEAK (<constant (http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#GraduateStudent)>, <constant (1)>)
+      29: $30 "owl#GraduateStudent" := Call DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE ($29 "callret")
+      36: BReturn 0
+from DB.DBA.RDF_QUAD by RDF_QUAD_OGPS    1.9e+03 rows
+Key RDF_QUAD_OGPS  ASC ($32 "s-3-1-t0.S")
+<col=415 O = $30 "owl#GraduateStudent"> , <col=412 G = $26 "lubm"> , <col=414 P = $28 "-ns#type">
+row specs: <col=415 O LIKE <constant (T)>>
+ 
+Current of: <$34 "<DB.DBA.RDF_QUAD s-3-1-t0>" spec 5>
+ 
+After code:
+      0: $35 "x" := Call ID_TO_IRI ($32 "s-3-1-t0.S")
+      5: BReturn 0
+Select ($35 "x", <$34 "<DB.DBA.RDF_QUAD s-3-1-t0>" spec 5>)
+}
 
- at prefix ns0:	<http://linkedgeodata.org/vocabulary#> .
- at prefix ns1:	<http://linkedgeodata.org/triplify/node/237435716#> .
-ns1:id	ns0:name	"Chapelle du Val de Gr\u00C3\u00A2ce" .
- at prefix ns2:	<http://www.openlinksw.com/schemas/oat/rdftabs#> .
-ns1:id	ns2:useMarker	"02" .
- at prefix virtrdf:	<http://www.openlinksw.com/schemas/virtrdf#> .
- at prefix geo:	<http://www.w3.org/2003/01/geo/wgs84_pos#> .
-ns1:id	geo:geometry	"POINT(2.3418 48.8406)"^^virtrdf:Geometry .
- at prefix ns5:	<http://linkedgeodata.org/triplify/node/218147750#> .
-ns5:id	ns0:name	"Synagogue" ;
-	ns2:useMarker	"02" ;
-	geo:geometry	"POINT(2.3593 48.857)"^^virtrdf:Geometry .
- at prefix ns6:	<http://linkedgeodata.org/triplify/node/218145208#> .
-ns6:id	ns0:name	"Synagogue" ;
-	ns2:useMarker	"02" ;
-	geo:geometry	"POINT(2.3589 48.8567)"^^virtrdf:Geometry .
-...
+22 Rows. -- 1 msec.
 ]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp13"><title>Example 13</title>
-<programlisting><![CDATA[
-## Example "Places Of Worship, Within 5 km Of Paris":
-
-## Asks for places of worship, within 5 km of Paris,
-## that have cafes in close proximity(0.2 km).
-## The query requires V6 or higher.
-
-SQL>
-SPARQL
-PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
-ASK
-WHERE
-  {
-    ?church a lgv:place_of_worship .
-    ?church geo:geometry ?churchgeo .
-    ?church lgv:name ?churchname .
-    ?cafe a lgv:cafe .
-    ?cafe lgv:name ?cafename .
-    ?cafe geo:geometry ?cafegeo .
-    ?cafe geo:lat ?lat .
-    ?cafe geo:long ?long .
-    FILTER ( bif:st_intersects ( ?churchgeo, bif:st_point ( 2.3498, 48.853 ), 5 ) &&
-             bif:st_intersects ( ?cafegeo, ?churchgeo, 0.2 ) )
-  };
-
-Done.
+<para>
+This finds the graduate student instances in the lubm graph.  First
+the query converts the IRI literals to id's.  Then, using a match of
+OG on OGPS it finds the IRI's of the graduate students.  Then it
+converts the IRI id to return to the string form.</para>
+<para>The cardinality estimate of 1.9e+03 rows is on the FROM line.</para>
+<para>Doing an explain on the queries will show the cardinality estimates.  To drill down further, one can split the query into smaller chunks and see the estimates for these, up to doing it at the triple pattern level.  
+To indicate a variable that is bound but whose value is not a literal known at compile time, one can use the parameter marker <emphasis>??</emphasis>.</para>
 
-true
+<programlisting><![CDATA[
+SQL>explain ('SPARQL define sql:table-option "order"  prefix ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>
+SELECT *
+FROM <lubm>
+WHERE { ?x rdf:type ?? }');
 ]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp14"><title>Example 14</title>
+
+<para>This will not know the type but will know that a type will be
+provided.  So instead of guessing 1900 matches, this will guess a
+smaller number, which is obviously less precise.  Thus literals are generally better.</para>
+<para>In some cases, generally to work around an optimization error, one can specify an explicit join order. 
+This is done with the sql:select-option "order"  clause in the SPARQL query prefix.</para>
+
 <programlisting><![CDATA[
-## Places of worship, within 5 km of Paris,
-## that have cafes in close proximity(0.2 km)
-SQL>
-SPARQL
-PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
-SELECT DISTINCT ?cafe ?lat ?long ?cafename ?churchname
-(bif:round(bif:st_distance (?churchgeo, ?cafegeo)))
+SQL>SELECT SPARQL_to_sql_text (' define sql:select-option "order" prefix ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>
+SELECT *
+FROM <lubm>
 WHERE
   {
-    ?church a lgv:place_of_worship .
-    ?church geo:geometry ?churchgeo .
-    ?church lgv:name ?churchname .
-    ?cafe a lgv:cafe .
-    ?cafe lgv:name ?cafename .
-    ?cafe geo:geometry ?cafegeo .
-    ?cafe geo:lat ?lat.
-    ?cafe geo:long ?long.
-    FILTER ( bif:st_intersects (?churchgeo, bif:st_point (2.3498, 48.853), 5) &&
-                   bif:st_intersects (?cafegeo, ?churchgeo, 0.2) )
-  }
-LIMIT 10;
-
-cafe                                                 lat       long     cafename                           churchname                             callret-5
-VARCHAR                                              VARCHAR   VARCHAR  VARCHAR                            VARCHAR                                VARCHAR
-_______________________________________________________________________________________________________________________________________________________________
-
-http://linkedgeodata.org/triplify/node/321932192#id  48.8522   2.3484   Le Saint R+?-?gis                  Eglise Saint-Julien-le-Pauvre          0
-http://linkedgeodata.org/triplify/node/251699776#id  48.8541   2.3326   Caf+?-? de Flore                   Eglise Saint-Germain des Pr+?-?s       0
-http://linkedgeodata.org/triplify/node/251699775#id  48.854    2.3331   Les Deux Magots                    Eglise Saint-Germain des Pr+?-?s       0
-http://linkedgeodata.org/triplify/node/315769036#id  48.8533   2.3358   Caf+?-? Mabillon                   Eglise Saint-Germain des Pr+?-?s       0
-http://linkedgeodata.org/triplify/node/251699776#id  48.8541   2.3326   Caf+?-? de Flore                   Eglise Saint-Germain-des-Pr+?-?s       0
-http://linkedgeodata.org/triplify/node/251699775#id  48.854    2.3331   Les Deux Magots                    Eglise Saint-Germain-des-Pr+?-?s       0
-http://linkedgeodata.org/triplify/node/315769035#id  48.8539   2.3371   Bar du march+?-?                   Eglise Saint-Germain-des-Pr+?-?s       0
-http://linkedgeodata.org/triplify/node/315769036#id  48.8533   2.3358   Caf+?-? Mabillon                   Eglise Saint-Germain-des-Pr+?-?s       0
-http://linkedgeodata.org/triplify/node/251126326#id  48.8572   2.3577   La Chaise au Plafond               Synagogue                              0
-http://linkedgeodata.org/triplify/node/251043135#id  48.8562   2.361    Le Loir dans la Th+?-?i+?-?re      Synagogue                              0
+    ?x rdf:type ub:GraduateStudent .
+    ?x ub:takesCourse <http://www.Department0.University0.edu/GraduateCourse0>
+  }');
+]]></programlisting>
 
-10 Rows. -- 120 msec.
+<para>shows the SQL text with the order option at the end.</para>
+<para>If an estimate is radically wrong then this should be reported as a bug.</para>
+<para>If there is a FROM with a KEY on the next line and no column specs then this is a full table scan. The more columns are specified the less rows will be passed to the next operation in the chain. In the example above, there are three columns whose values are known before  reading the table and these columns are leading columns of the index in use so column specs are</para>
+<programlisting><![CDATA[
+<col=415 O = $30 "owl#GraduateStudent"> , <col=412 G = $26 "lubm"> , <col=414 P = $28 "-ns#type">
 ]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp15"><title>Example 15</title>
+<note><para>A KEY with only a row spec is a full table scan with the row spec applied as a filter.
+This is usually not good unless this is specifically intended.</para></note>
+<para>If queries are compiled to make full table scans when this is not specifically intended, this should be reported as a bug.
+The explain output and the query text should be included in the report.</para>
+<para>An explicit join order is specified by the <emphasis>define sql:select-option "order"</emphasis> clause in the SPARQL query prefix:
+Consider:</para>
+
 <programlisting><![CDATA[
-## Stuff around Notre Dame de Paris
-SQL>
-SPARQL
-PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
-SELECT ?s ?cn ?lat ?long
+SQL>explain ('SPARQL define sql:select-option "order, loop" prefix ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>
+SELECT *
+FROM <lubm>
 WHERE
   {
-    ?s lgv:name ?cn  .
-    ?s geo:geometry ?geo .
-    ?s geo:lat ?lat.
-    ?s geo:long ?long.
-    FILTER ( bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 0.3) )
-  }
-LIMIT 20;
-
-s                                                      cn                                                        lat        long
-VARCHAR                                                VARCHAR                                                   VARCHAR    VARCHAR
-______________________________________________________________________________________________________________
+    ?x ub:takesCourse ?c .
+    ?x rdf:type ub:GraduateStudent
+  }');
+]]></programlisting>
 
-http://linkedgeodata.org/triplify/node/237004656#id    Parking Lagrange                                          48.8506    2.3487
-http://linkedgeodata.org/triplify/node/237003117#id    Mus+?-?e de l'Assistance Publique H+?-¦pitaux de Paris    48.8507    2.3519
-http://linkedgeodata.org/triplify/way/23071565#id      Jardin de la Rue de Bi+?-?vre                             48.8504    2.3502
-http://linkedgeodata.org/triplify/node/251652818#id    Maitre Albert B&B                                         48.8507    2.3496
-http://linkedgeodata.org/triplify/node/251373384#id    Le Grenier de Notre Dame                                  48.8513    2.35
-http://linkedgeodata.org/triplify/node/205266764#id    Eglise Saint-Julien-le-Pauvre                             48.852     2.3471
-http://linkedgeodata.org/triplify/way/19741083#id      Eglise Saint Julien le Pauvre                             48.8521    2.3469
-http://linkedgeodata.org/triplify/node/251474112#id    Polly Magoo                                               48.8526    2.3467
-http://linkedgeodata.org/triplify/node/251531803#id    H+?-¦tel Esmerelda                                        48.8523    2.3468
-http://linkedgeodata.org/triplify/node/191031796#id    Point 0 des Routes de France                              48.8533    2.3489
-http://linkedgeodata.org/triplify/way/20444455#id      Square Jean XXIII                                         48.8529    2.3511
-http://linkedgeodata.org/triplify/way/19740745#id      Square Ren+?-? Viviani                                    48.8525    2.3476
-http://linkedgeodata.org/triplify/node/321932192#id    Le Saint R+?-?gis                                         48.8522    2.3484
-http://linkedgeodata.org/triplify/node/27440965#id     Notre-Dame de Paris                                       48.853     2.3499
-http://linkedgeodata.org/triplify/node/243461762#id    Parking Notre-Dame                                        48.8537    2.3475
-http://linkedgeodata.org/triplify/way/21816758#id      Notre-Dame de Paris                                       48.8531    2.349
-http://linkedgeodata.org/triplify/way/22972062#id      La Seine                                                  48.8538    2.3531
-http://linkedgeodata.org/triplify/way/25463927#id      La Seine                                                  48.8548    2.3518
-http://linkedgeodata.org/triplify/node/251128395#id    H+?-¦tel Hospitel                                         48.854     2.3484
-http://linkedgeodata.org/triplify/way/14155323#id      H+?-¦tel Dieu                                             48.8555    2.3485
+<para>One will see in the output that the first table access is to retrieve
+all in the lubm graph which take some course and then later to check
+if this is a graduate student.  This is obviously not the preferred
+order but the <emphasis>sql:select-option "order"</emphasis> forces the optimizer to join
+from left to right.</para>
+<para>It is very easy to end up with completely unworkable query plans in
+this manner but if the optimizer really is in error, then this is the
+only way of overriding its preferences. The effect of <emphasis>sql:select-option</emphasis> is pervasive, extending inside unions, optionals, subqueries etc within the statement.</para>
+<para>We note that if, in the above query, both the course taken by the
+student and the type of the student are given, the query compilation
+will be, at least for all non-cluster cases, an index intersection.
+This is not overridden by the sql:select-option clause since an index
+intersection is always a safe guess, regardless of the correctness of
+the cardinality guesses of the patterns involved.</para>
+</sect2>
+    <sect2 id="rdfperfloading"><title>Loading RDF</title>
+	<para>There are many functions for loading RDF text, in RDF/XML and Turtle.</para>
+	<para>For loading RDF/XML, the best way is to split the data to be loaded into
+multiple streams and load these in parallel using <link linkend="fn_rdf_load_rdfxml"><function>RDF_LOAD_RDFXML ()</function></link>.
+To avoid running out of rollback space for large files and in order to have multiple concurrent loads not
+interfere with each other, the row autocommit mode should be enabled.</para>
+	<para>For example, </para>
+<programlisting><![CDATA[
+log_enable (2);
+-- switch row-by-row autocommit on and logging off for this session
+DB.DBA.RDF_LOAD_RDFXML (file_to_string_output ('file.xml'), 'base_uri', 'target_graph');
+-- more files here ...
+checkpoint;
+]]></programlisting>
+<para>Loading a file with text like the above with isql will load the data. Since the transaction
+logging is off, make a manual checkpoint at the end to ensure that data is persisted upon server
+restart since there is no roll forward log.</para>
+<para>If large amounts of data are to be loaded, run multiple such streams in parallel. One may have
+for example 6 streams for 4 cores. This means that if up to two threads wait for disk, there is still work
+for all cores.</para>
+<para>Having substantially more threads than processors or disks is not particularly useful.</para>
+<para>There exist multithreaded load functions which will load one file on multiple threads: 
+<link linkend="rdfapidataimportttlpmt">the DB.DBA.TTLP_MT() function</link> and 
+<link linkend="rdfapidataimportxmlttlpmt">the DB.DBA.RDF_LOAD_RDFXML_MT() function</link>. Experience
+shows that loading multiple files on one thread per file is better.</para>
+<para>For loading Turtle, some platforms may have a non-reentrant Turtle parser. This means that only
+one load may run at a time. One can try this by calling
+<link linkend="rdfapidataimport"><function>ttlp ()</function></link> from two sessions at the same time.
+If these do not execute concurrently, then the best way may be to try
+<link linkend="rdfapidataimport"><function>ttlp_mt</function></link> and see if this runs faster than
+a single threaded ttlp call.</para>
+       <sect3 id="rdfperfloadingutility"><title>RDF Bulk Load Utility</title>
+         <para>The RDF loader utility facilitates parallel bulk loading of multiple RDF files. The utility 
+         	maintains a database table containing a list of files to load and the status of each file, 
+         	whether not loaded, loaded or loaded with error. The table also records load start and 
+         	end times.</para>
+         <para>One must have a dba group login for using this and the virtuoso.ini file access 
+         	control list must be set up so that the Virtuoso server can open  the files to load.</para>
+         <para>Files are added to the load list with the function <link linkend="fn_ld_dir"><function>ld_dir</function></link>:</para>
+<programlisting><![CDATA[
+ld_dir (in dir_path varchar, in file_mask varchar, in target_graph varchar);
+]]></programlisting>
+         <para>The file mask is a SQL like pattern to match against the files in the directory. 
+         	For example:</para>
+<programlisting><![CDATA[
+ld_dir ('/data8/2848260', '%.gz', 'http://bsbm.org');
+]]></programlisting>
+         <para>would load the RDF in all files ending in .gz from the directory given as first parameter. 
+         	The RDF would be loaded in the http://bsbm.org graph.</para>
+         <para>If NULL is given for the graph, each file may go to a different graph specified in a 
+         	separate file with the name of the RDF source file plus the extension .graph.</para>
+         <para>A .graph file contains the target graph URI without any other content or whitespace.</para>  
+         <para>The layout of the load_list table is as follows:</para>
+<programlisting><![CDATA[
+create table DB.DBA.LOAD_LIST (
+  ll_file varchar,
+  ll_graph varchar,
+  ll_state int default 0, -- 0 not started, 1 going, 2 done
+  ll_started datetime,
+  ll_done datetime,
+  ll_host int,
+  ll_work_time integer,
+  ll_error varchar,
+  primary key (ll_file))
+alter index LOAD_LIST on DB.DBA.LOAD_LIST partition (ll_file varchar)
+create index LL_STATE on DB.DBA.LOAD_LIST (ll_state, ll_file, ll_graph) partition (ll_state int)
+;
+]]></programlisting>
+         <para>This table may be checked at any time during bulk load for the progress of the load. 
+         	ll_state is 1 for files being loaded and 2 for files whose loading has finished. 
+         	ll_error is NULL if the load finished without error, else it is the error message.</para>
+         <para>In order to load data from the files in load_list, run as dba:</para>
+<programlisting><![CDATA[
+DB.DBA.rdf_loader_run (); 	
+]]></programlisting>   
+         <para>One may run several of these commands on parallel sessions for better throughput.</para>
+         <para>On a cluster one can do:</para>
+<programlisting><![CDATA[
+cl_exec ('rdf_ld_srv ()'); 
+]]></programlisting>
+         <para>This will start one rdf_loader_run on each node of the cluster. Note that in such a 
+         	setting all the server processes must see the same files at the same path.</para>
+         <para>On an isql session one may execute rdf_loader_run () & several times, forking a new 
+         	isql for each such command, similarly to what a Unix shell does.</para> 
+         <para>Because this load is non-transactional and non-logged, one must do an explicit checkpoint 
+         	after the load to guarantee a persistent state.</para>
+         <para>On a single server do:</para>
+<programlisting><![CDATA[
+checkpoint; 
+]]></programlisting>  
+  <para>On a cluster do:</para>
+<programlisting><![CDATA[  
+cl_exec ('checkpoint');
+]]></programlisting>
+         <para>The server(s) are online and can process queries and transactions while a bulk load 
+         	is in progress. Periodic checkpoints may occur during the load but the state is guaranteed 
+         	to be consistent only after running a checkpoint after all the bulk load threads 
+         	have finished.</para>
+         <para>A bulk load should not be forcibly stopped. To make a controlled stop, run:</para>
+<programlisting><![CDATA[
+rdf_load_stop ();
+]]></programlisting>   
+         <para>This will cause the files being loaded at the time to finish load but no new loads 
+         	will start until explicitly started with <function>rdf_loader_run ()</function>.</para>
+         <para>Specially note that on a cluster the database will be inconsistent if one server 
+         	process does a checkpoint and another does not. Thus guaranteeing a checkpoint on all 
+         	is necessary. This is easily done with an isql script with the following content:</para>
+<programlisting><![CDATA[
+ld_dir ('/data8/2848260', '%.gz', 'http://bsbm.org');
+
+-- Record CPU time 
+select getrusage ()[0] + getrusage ()[1];
+
+rdf_loader_run () &
+rdf_loader_run () &
+rdf_loader_run () &
+rdf_loader_run () &
+rdf_loader_run () &
+rdf_loader_run () &
+rdf_loader_run () &
+rdf_loader_run () &
+
+wait_for_children;
+checkpoint;
 
-20 Rows. -- 167 msec.
+-- Record CPU time
+select getrusage ()[0] + getrusage ()[1];
 ]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp16"><title>Example 16</title>
+         <para>For a cluster, the equivalent is:</para>
 <programlisting><![CDATA[
-## Stuff around Notre Dame de Paris
-SQL>
-SPARQL
-PREFIX lgv: <http://linkedgeodata.org/vocabulary#>
-DESCRIBE ?s
-WHERE
-  {
-    ?s lgv:name ?cn  .
-    ?s geo:geometry ?geo .
-    ?s geo:lat ?lat.
-    ?s geo:long ?long.
-    FILTER (bif:st_intersects (?geo, bif:st_point (2.3498, 48.853), 0.3))
-  }
-LIMIT 20;
+ld_dir ('/data8/2848260', '%.gz', 'http://bsbm.org');
 
- at prefix rdf:	<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
- at prefix ns1:	<http://linkedgeodata.org/triplify/node/27440966#> .
- at prefix ns2:	<http://linkedgeodata.org/vocabulary#> .
-ns1:id	rdf:type	ns2:node ,
-		ns2:police .
- at prefix geo:	<http://www.w3.org/2003/01/geo/wgs84_pos#> .
-ns1:id	geo:lat	48.8542 ;
-	geo:long	2.3473 ;
-	ns2:created_by	"Potlatch 0.6a" ;
-	ns2:name	"Pr\u00C3\u00A9fecture de Police de Paris" ,
-		"Pr\u00E9fecture de Police de Paris" .
- at prefix virtrdf:	<http://www.openlinksw.com/schemas/virtrdf#> .
-ns1:id	geo:geometry	"POINT(2.3473 48.8542)"^^virtrdf:Geometry .
- at prefix ns5:	<http://linkedgeodata.org/triplify/node/27440965#> .
-ns5:id	rdf:type	ns2:node ,
-		ns2:place_of_worship ;
-	geo:lat	48.853 ;
-	geo:long	2.3499 ;
-	ns2:denomination	"catholic" ;
-	ns2:name	"Notre-Dame de Paris" ;
-	ns2:religion	"christian" ,
-		ns2:christian ;
-	geo:geometry	"POINT(2.3499 48.853)"^^virtrdf:Geometry .
+cl_exec ('DB.DBA.RDF_LD_SRV (2)');
 
-......
+cl_exec ('checkpoint');
 ]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp17"><title>Example 17</title>
+         <para><function>rdf_loader_run ()</function> recognizes several file types, including .ttl, .nt, .xml, .rdf, 
+         	.owl, .nq, .n4, and others. Internally the function uses 
+         	<link linkend="fn_ttlp"><function>DB.DBA.ttlp()</function></link> or 
+         	<link linkend="fn_rdf_load_rdfxml"><function>DB.DBA.rdf_load_rdfxml</function></link>, 
+         	as appropriate.</para>
+         	<para>See <link linkend="rdfperfloadinglod">the next section</link> for detailed description 
+         	of the <function>rdf_loader_run ()</function> function.</para>
+       </sect3>
+       <sect3 id="rdfperfloadinglod"><title>Loading LOD RDF data</title>
+<para>To load the rdf data to LOD instance, perform the following steps:
+</para>
+<itemizedlist mark="bullet">
+  <listitem>Configure & start cluster</listitem>
+  <listitem>Execute the file:
 <programlisting><![CDATA[
-## Cities within 30 km proximity of London
-SQL>
-SPARQL
-SELECT ?m (bif:round(bif:st_distance (?geo, ?gm)))
-WHERE
-  {
-    <http://dbpedia.org/resource/London> geo:geometry ?gm .
-    ?m geo:geometry ?geo .
-    ?m a <http://dbpedia.org/ontology/City> .
-    FILTER (bif:st_intersects (?geo, ?gm, 30))
-  }
-ORDER BY DESC 2
-LIMIT 20;
+--
+--  $Id: rdfandsparql.xml,v 1.95.2.44 2011/03/24 16:04:34 source Exp $
+--
+--  Alternate RDF index scheme for cases where G unspecified
+--
+--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+--  project.
+--
+--  Copyright (C) 1998-2009 OpenLink Software
+--
+--  This project is free software; you can redistribute it and/or modify it
+--  under the terms of the GNU General Public License as published by the
+--  Free Software Foundation; only version 2 of the License, dated June 1991.
+--
+--  This program is distributed in the hope that it will be useful, but
+--  WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+--  General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License along
+--  with this program; if not, write to the Free Software Foundation, Inc.,
+--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+--
+--
 
-m                                                   callret-1
-VARCHAR                                             VARCHAR
-____________________________________________________________
+drop index RDF_QUAD_OGPS;
+checkpoint;
+create table R2 (G iri_id_8, S iri_id_8, P iri_id_8, O any, primary key (S, P, O, G))
+alter index R2 on R2 partition (S int (0hexffff00));
 
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Ebbsfleet_Valley        30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
-http://dbpedia.org/resource/Bletchingley            30
+log_enable (2);
+insert into R2 (G, S, P, O) SELECT G, S, P, O from rdf_quad;
 
-20 Rows. -- 727666 msec.
+drop table RDF_QUAD;
+alter table r2 rename RDF_QUAD;
+checkpoint;
+create bitmap index RDF_QUAD_OPGS on RDF_QUAD (O, P, G, S) partition (O varchar (-1, 0hexffff));
+create bitmap index RDF_QUAD_POGS on RDF_QUAD (P, O, G, S) partition (O varchar (-1, 0hexffff));
+create bitmap index RDF_QUAD_GPOS on RDF_QUAD (G, P, O, S) partition (O varchar (-1, 0hexffff));
 
+checkpoint;
 ]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp18"><title>Example 18</title>
+</listitem>
+  <listitem>Execute the file:
 <programlisting><![CDATA[
-## Motorways across England & Scotland from DBpedia
-SQL>
-SPARQL
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX dbpprop: <http://dbpedia.org/property/>
-PREFIX yago: <http://dbpedia.org/class/yago/>
-SELECT ?road ?services ?lat ?long
-WHERE
-  {
-    {
-      ?services dbpprop:road ?road .
-      ?road a yago:MotorwaysInEngland .
-      ?services dbpprop:lat ?lat .
-      ?services dbpprop:long ?long .
-     }
-    UNION
+
+
+create table load_list (
+  ll_file varchar,
+  ll_graph varchar,
+  ll_state int default 0, -- 0 not started, 1 going, 2 done
+  ll_started datetime,
+  ll_done datetime,
+  ll_host int,
+  ll_work_time integer,
+  ll_error varchar,
+  primary key (ll_file))
+alter index load_list on load_list partition (ll_file varchar)
+;
+
+create index ll_state on load_list (ll_state, ll_file, ll_graph) partition (ll_state int)
+;
+
+
+create table ldlock (id int primary key)
+  alter index ldlock on ldlock partition (id int)
+;
+
+insert into ldlock values (0);
+
+
+create procedure
+ld_dir (in path varchar, in mask varchar, in graph varchar)
+{
+  declare ls any;
+  declare inx int;
+  ls := sys_dirlist (path, 1);
+  for (inx := 0; inx < length (ls); inx := inx + 1)
     {
-      ?services dbpprop:road ?road .
-      ?road a yago:MotorwaysInScotland .
-      ?services dbpprop:lat ?lat .
-      ?services dbpprop:long ?long .
-     }
-  }
-LIMIT 20;
+      if (ls[inx] like mask)
+	{
+	  set isolation = 'serializable';
 
-road                                          services                                                        lat             long
-VARCHAR                                       VARCHAR                                                         VARCHAR         VARCHAR
-______________________________________________________________________________________________________________________________________
+	  if (not (exists (SELECT 1 FROM DB.DBA.LOAD_LIST WHERE LL_FILE = path || '/' || ls[inx] for update)))
+	    {
+	      declare gfile, cgfile, ngraph varchar;
+	      gfile := path || '/' || replace (ls[inx], '.gz', '') || '.graph';
+	      cgfile := path || '/' || regexp_replace (replace (ls[inx], '.gz', ''), '\\-[0-9]+\\.n', '.n') || '.graph';
+	      if (file_stat (gfile) <> 0)
+		ngraph := trim (file_to_string (gfile), ' \r\n');
+              else if (file_stat (cgfile) <> 0)
+		ngraph := trim (file_to_string (cgfile), ' \r\n');
+	      else if (file_stat (path || '/' || 'global.graph') <> 0)
+		ngraph := trim (file_to_string (path || '/' || 'global.graph'), ' \r\n');
+	      else
+	        ngraph := graph;
+              if (ngraph is not null)
+                {
+		  insert into DB.DBA.LOAD_LIST (ll_file, ll_graph) values (path || '/' || ls[inx], ngraph);
+		}
+	    }
 
-http://dbpedia.org/resource/M90_motorway      http://dbpedia.org/resource/Kinross_services                    56.209628       -3.439257
-http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Leicester_Forest_East_services      52.6192         -1.206
-http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Woodall_services                    53.3152         -1.2813
-http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Tibshelf_services                   53.13708        -1.33179
-http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/London_Gateway_services             51.631          -0.264
-http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Donington_Park_services             52.823651       -1.305887
-http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Watford_Gap_services                52.3069         -1.1226
-http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Newport_Pagnell_services            52.083066       -0.748508
-http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Trowell_services                    52.963198       -1.265988
-http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Woolley_Edge_services               53.62259        -1.549422
-http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Toddington_services                 51.9478         -0.502075
-http://dbpedia.org/resource/M1_motorway       http://dbpedia.org/resource/Northampton_services                52.209201       -0.944799
-http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Chieveley_services                  51.449          -1.3112
-http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Magor_services                      51.58786        -2.83713
-http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Pont_Abraham_services               51.74712        -4.0655
-http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Swansea_services                    51.678197       -3.994646
-http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Leigh_Delamere_services             51.511528       -2.159468
-http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Reading_services                    51.424527       -1.035633
-http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Cardiff_West_services               51.50626        -3.30535
-http://dbpedia.org/resource/M4_motorway       http://dbpedia.org/resource/Heston_services                     51.48807        -0.39106
+	  commit work;
+	}
+    }
+}
+;
 
-20 Rows. -- 531 msec.
+create procedure
+ld_dir_all (in path varchar, in mask varchar, in graph varchar)
+{
+  declare ls any;
+  declare inx int;
+  ls := sys_dirlist (path, 0);
+  ld_dir (path, mask, graph);
+  for (inx := 0; inx < length (ls); inx := inx + 1)
+    {
+      if (ls[inx] <> '.' and ls[inx] <> '..')
+	{
+	  ld_dir_all (path||'/'||ls[inx], mask, graph);
+	}
+    }
+}
+;
 
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp18"><title>Example 19</title>
-<programlisting><![CDATA[
-SELECT DISTINCT ?s (bif:round(?lat)) as ?lat (bif:round(?long)) as ?long
-WHERE
-  {
+create procedure
+ld_add (in _fname varchar, in _graph varchar)
+{
+  --log_message (sprintf ('ld_add: %s, %s', _fname, _graph));
+
+  set isolation = 'serializable';
+
+  if (not (exists (SELECT 1 FROM DB.DBA.LOAD_LIST WHERE LL_FILE = _fname for update)))
     {
-      SELECT ?g ?s WHERE
-        {
-          graph ?g {
-            ?s geo:geometry ?geo }
-        }
-      LIMIT 100
+      insert into DB.DBA.LOAD_LIST (LL_FILE, LL_GRAPH) values (_fname, _graph);
     }
-    graph ?g {
-      ?s geo:lat ?lat .
-      ?s geo:long ?long . }
-    FILTER (datatype (?lat) in (xsd:integer, xsd:float, xsd:double)) .
-    FILTER (datatype (?long) in (xsd:integer, xsd:float, xsd:double))
-  }
+  commit work;
+}
+;
 
-s                                                                             lat        long
-ANY 	                                                                      ANY 	 ANY
-________________________________________________________________________________________________
-http://dbpedia.org/resource/QUaD	                                      -90	 -139
-http://dbpedia.org/resource/Amundsen-Scott_South_Pole_Station	              -90	 -139
-http://dbpedia.org/resource/Amundsen-Scott_South_Pole_Station	              -90	 0
-http://dbpedia.org/resource/Degree_Angular_Scale_Interferometer	              -90	 -139
-http://dbpedia.org/resource/South_Pole_Telescope	                      -90	 -139
-http://dbpedia.org/resource/Arcminute_Cosmology_Bolometer_Array_Receiver      -90	 -139
-http://dbpedia.org/resource/Viper_telescope	                              -90	 -139
-http://dbpedia.org/resource/Mount_Weaver	                              -87	 -154
-http://dbpedia.org/resource/Axel_Heiberg_Glacier	                      -85	 -163
-http://dbpedia.org/resource/Mount_Ray	                                      -85	 -171
-http://linkedgeodata.org/triplify/node/275487234#id	                      -85	 -142
-http://linkedgeodata.org/triplify/node/303732928#id	                      -85	 -142
-http://linkedgeodata.org/triplify/node/332036611#id	                      -85	 -85
-http://linkedgeodata.org/triplify/node/303732935#id	                      -85	 -143
-http://linkedgeodata.org/triplify/node/303732951#id	                      -85	 -144
-http://linkedgeodata.org/triplify/node/303732953#id	                      -85	 -144
-http://linkedgeodata.org/triplify/node/276208684#id	                      -85	 -166
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp19"><title>Example 19</title>
-<programlisting><![CDATA[
-## "Find things within 20km of New York City":
+create procedure ld_ttlp_flags (in fname varchar)
+{
+  if (fname like '%/btc-2009%' or fname like '%.nq%')
+    return 255 + 512;
+  return 255;
+}
+
+create procedure
+ld_file (in f varchar, in graph varchar)
+{
+  declare gzip_name varchar;
+  declare exit handler for sqlstate '*' {
+    rollback work;
+    UPDATE DB.DBA.LOAD_LIST
+      SET LL_STATE = 2,
+          LL_DONE = curdatetime (),
+          LL_ERROR = __sql_state || ' ' || __sql_message
+      WHERE LL_FILE = f;
+    commit work;
+
+    log_message (sprintf (' File %s error %s %s', f, __sql_state, __sql_message));
+    return;
+  };
+
+  if (f like '%.grdf' or f like '%.grdf.gz')
+    {
+      load_grdf (f);
+    }
+  else if (f like '%.gz')
+    {
+      gzip_name := regexp_replace (f, '\.gz\x24', '');
+      if (gzip_name like '%.xml' or gzip_name like '%.owl' or gzip_name like '%.rdf')
+	DB.DBA.RDF_LOAD_RDFXML (gz_file_open (f), graph, graph);
+      else if  (gzip_name like '%.n4')
+	TTLP (gz_file_open (f), graph, graph, 512 + 255);
+      else
+	TTLP (gz_file_open (f), graph, graph, ld_ttlp_flags (f));
+    }
+  else
+    {
+      if (f like '%.xml' or f like '%.owl' or f like '%.rdf')
+	DB.DBA.RDF_LOAD_RDFXML (file_open (f), graph, graph);
+      else if  (f like '%.n4')
+	TTLP (file_open (f), graph, graph, 512 + 255);
+      else
+	TTLP (file_open (f), graph, graph, ld_ttlp_flags (f));
+    }
 
-SELECT DISTINCT ?resource ?label ?location
-WHERE
-  {
-    <http://dbpedia.org/resource/New_York_City>
-        geo:geometry ?sourcegeo                   .
-    ?resource geo:geometry ?location              ;
-                rdfs:label ?label .
-    FILTER( bif:st_intersects( ?location, ?sourcegeo, 20 ) ) .
-    FILTER( lang(?label) = "en" )
-  }
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp20"><title>Example 20</title>
-<programlisting><![CDATA[
-## "Find Distance between New York City
-## and London, England":
+  --log_message (sprintf ('loaded %s', f));
+}
+;
 
-SELECT ( bif:st_distance( ?nyl,?ln ) )
-      AS ?distanceBetweenNewYorkCityAndLondon
-WHERE
-  {
-    <http://dbpedia.org/resource/New_York_City>
-        geo:geometry ?nyl .
-    <http://dbpedia.org/resource/London>
-        geo:geometry ?ln  .
-  }
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp21"><title>Example 21</title>
-<programlisting><![CDATA[
-## "Find "All Educational Institutions
-## within 10km of Oxford, UK; ordered by
-## date of establishment":
+create procedure
+rdf_load_dir (in path varchar,
+              in mask varchar := '%.nt',
+              in graph varchar := 'http://dbpedia.org')
+{
 
-SELECT DISTINCT ?thing AS ?uri
-      ?thingLabel AS ?name
-      ?date AS ?established
-      ?matchgeo AS ?location
-WHERE
-  {
-    <http://dbpedia.org/resource/Oxford>
-             geo:geometry ?sourcegeo .
-    ?resource geo:geometry ?matchgeo .
-    FILTER( bif:st_intersects( ?matchgeo, ?sourcegeo, 5 ) ) .
-       ?thing ?somelink ?resource                           ;
-       <http://dbpedia.org/ontology/established> ?date      ;
-       rdfs:label ?thingLabel                               .
-    FILTER( lang(?thingLabel) = "en" )
-  }
-ORDER BY ASC( ?date )
-]]></programlisting>
-    </sect3>
-    <sect3 id="rdfsparqlgeospatexmp22"><title>Example 22</title>
-<programlisting><![CDATA[
-## "Find Historical cross section of events related
-## to Edinburgh and the surrounding area (within 30km)
-## during the 19th century":
+  DELETE FROM DB.DBA.LOAD_LIST WHERE LL_FILE = '##stop';
+  commit work;
 
-SELECT DISTINCT ?thing ?thingLabel
-      ?dateMeaningLabel ?date ?matchgeo
-WHERE
-  {
+  ld_dir (path, mask, graph);
+
+  rdf_loader_run ();
+}
+;
+
+
+create procedure ld_array ()
+{
+  declare first, last, arr, len, local any;
+  declare cr cursor for
+      SELECT top 100 LL_FILE, LL_GRAPH
+        FROM DB.DBA.LOAD_LIST table option (index ll_state)
+        WHERE LL_STATE = 0
+	for update;
+  declare fill int;
+  declare f, g varchar;
+  declare r any;
+  whenever not found goto done;
+  first := 0;
+  last := 0;
+ arr := make_array (100, 'any');
+  fill := 0;
+  open cr;
+  len := 0;
+  for (;;)
     {
-      SELECT DISTINCT ?thing ?matchgeo
-      WHERE
-        {
-          <http://dbpedia.org/resource/Edinburgh>
-              geo:geometry ?sourcegeo .
-            ?resource geo:geometry ?matchgeo .
-            FILTER( bif:st_intersects (
-                ?matchgeo, ?sourcegeo, 30 ) ) .
-            ?thing ?somelink ?resource
-        }
+      fetch cr into f, g;
+      if (0 = first) first := f;
+      last := f;
+      arr[fill] := vector (f, g);
+    len := len + cast (file_stat (f, 1) as int);
+      fill := fill + 1;
+      if (len > 2000000)
+	goto done;
     }
+ done:
+  if (0 = first)
+    return 0;
+  if (1 <> sys_stat ('cl_run_local_only'))
+    local := sys_stat ('cl_this_host');
+  UPDATE load_list set ll_state = 1, ll_started = curdatetime (), LL_HOST = local
+    WHERE ll_file >= first and ll_file <= last;
+  return arr;
+}
+;
+
+create procedure
+rdf_loader_run (in max_files integer := null, in log_enable int := 2)
+{
+  declare sec_delay float;
+  declare _f, _graph varchar;
+  declare arr any;
+  declare xx, inx, tx_mode, ld_mode int;
+  ld_mode := log_enable;
+  if (0 = sys_stat ('cl_run_local_only'))
     {
-      ?property rdf:type owl:DatatypeProperty ;
-                          rdfs:range xsd:date
-    } .
-    ?thing ?dateMeaning ?date .
-    FILTER( ?dateMeaning IN ( ?property ) ) .
-    FILTER( ?date >= xsd:gYear("1800")
-         && ?date <= xsd:gYear("1900") )
-    ?dateMeaning rdfs:label ?dateMeaningLabel .
-  FILTER( lang(?dateMeaningLabel) = "en" ) .
-  ?thing rdfs:label ?thingLabel .
-  FILTER( lang(?thingLabel) = "en" )
-  }
-ORDER BY ASC ( ?date )
-]]></programlisting>
-    </sect3>
-  </sect2>
-</sect1>
+      if (log_enable = 2 and cl_this_host () = 1)
+	{
+	  cl_exec ('checkpoint_interval (0)');
+	  cl_exec ('__dbf_set (''cl_non_logged_write_mode'', 1)');
+	}
+      if (cl_this_host () = 1)
+	cl_exec('__dbf_set(''cl_max_keep_alives_missed'',3000)');
+    }
+  tx_mode := bit_and (1, log_enable);
+  log_message ('Loader started');
 
-<!--
-<sect1 id="rdfreplication"><title>RDF Replication</title>
-<para>
-Tables of RDF storage, such as DB.DBA.RDF_QUAD and DB.DBA.RDF_OBJ, can not be replicated in a usual way,
-because it's content is cached in memory in special ways and synchronized with values outside these tables,
-such as current values of special sequence objects.
-Moreover, same IRI may have different internal IRI_IDs on different boxes, because the assigned IDs vary if new IRIs appear in data in different order.
-Similarly, there will be different IDs of RDF literal, datatypes and languages, blocking any attempt of one-to-one replication between RDF storages.</para>
-<para>
-However, a special asynchronous RDF replication makes it possible to configure a "publisher" Virtuoso instance to keep the log of changes in some RDF graphs
-and subscribe some Virtuoso instances to replay all these changes.</para>
-<para>
-Configuration functions are quite straightforward.</para>
-<para>
-RDF graphs to replicate are all members of <http://www.openlinksw.com/schemas/virtrdf#rdf_repl_graph_group> graph group.
-That group can be filled in with graphs like any other graph group, but it is better to get the advantage of proper security check made by
-</para>
-<funcprototype id="fproto_DB.DBA.RDF_REPL_GRAPH_INS">
-  <funcdef>procedure <function>DB.DBA.RDF_REPL_GRAPH_INS</function></funcdef>
-  <paramdef>in <parameter>memb_iri</parameter> varchar</paramdef>
-</funcprototype>
-<para>
-that inserts a graph to the group and</para>
-<funcprototype id="fproto_DB.DBA.RDF_REPL_GRAPH_DEL">
-  <funcdef>procedure <function>DB.DBA.RDF_REPL_GRAPH_DEL</function></funcdef>
-  <paramdef>in <parameter>memb_iri</parameter> varchar</paramdef>
-</funcprototype>
-<para>
-that removes a graph from the group.
-Only publicly readable graphs can be replicated, an error is signalled otherwise, and it is better to know about a security issue as early as possible.</para>
-<funcprototype id="fproto_DB.DBA.RDF_REPL_START">
-  <funcdef>procedure <function>DB.DBA.RDF_REPL_START</function></funcdef>
-  <paramdef>in <parameter>quiet</parameter> integer := 0</paramdef>
-</funcprototype>
-<para>
-starts the RDF replication at the publishing side.
-It creates replication "publication" named '__rdf_repl' and makes a log file '__rdf_repl.log' to record changes in replicated graphs.
-If the replication has been started before then an error is signalled; passing value 1 for parameter "quiet" elimintaes the error so the incorrect call has no effect at all.
-If the replication is enabled then the value of registry variable 'DB.DBA.RDF_REPL' indicates the moment of replication start.</para>
-<para>
-<function>DB.DBA.RDF_REPL_START</function>() performs a security check before starting the replication to check.</para>
-<funcprototype id="fproto_DB.DBA.RDF_REPL_STOP">
-  <funcdef>procedure <function>DB.DBA.RDF_REPL_STOP</function></funcdef>
-  <paramdef> in <parameter>quiet</parameter> integer := 0</paramdef>
-</funcprototype>
-<para>
-stops the RDF replication at the publishing side.
-It calls <function><link linkend="fn_repl_unpublish">repl_unpublish</link></function> but does not make empty reates replication "publication" named '__rdf_repl' and makes a log file '__rdf_repl.log' to record changes in replicated graphs.</para>
-<para>
-Replication is asynchronous and the order of insertion and removal operations at the subscriber's side may not match the order at the publisher.
-As a result, it is not recommended to make few subscriptions that writes changes of few publishers into one common graph.
-A client-side application can force the synchronuzation by calling</para>
-<funcprototype id="fproto_DB.DBA.RDF_REPL_SYNC">
-  <funcdef>procedure <function>DB.DBA.RDF_REPL_SYNC</function></funcdef>
-  <paramdef>in <parameter>publisher</parameter> varchar</paramdef>
-  <paramdef>in <parameter>user</parameter> varchar</paramdef>
-  <paramdef>in <parameter>pwd</parameter> varchar</paramdef>
-</funcprototype>
-<para>
-that acts like <function><link linkend="fn_repl_sync">repl_sync</link></function> but for an RDF subscription.
-<function>DB.DBA.RDF_REPL_SYNC</function> will not only initial synchronisation but also wait for the end of subscription to guarantee that the total effect of INSERT and DELETE operations is correct even if these operations were made in an order that differs from the original one.</para>
-</sect1>
--->
-<sect1 id="rdfperformancetuning"><title>Performance Tuning</title>
-<para>For RDF query performance, we have the following possible questions:</para>
-<itemizedlist mark="bullet" spacing="compact">
-<listitem>Is the Virtuoso process properly configured to handle big data sets?</listitem>
-<listitem>Is the graph always specified?</listitem>
-<listitem>Are public web service endpoints protected against bad queries?</listitem>
-<listitem>Are there patterns where only a predicate is given?</listitem>
-<listitem>Is there a bad query plan because of cost model error?</listitem>
-</itemizedlist>
-<sect2 id="rdfperfgeneral"><title>General</title>
-	<para>For running with large data sets, one should configure the Virtuoso process to use between 2/3 to  3/5 of system RAM and to stripe storage on all available disks.  See <link linkend="VIRTINI">NumberOfBuffers</link> and <link linkend="VIRTINI">Striping</link> ini parameters.</para>
-<para> Also, if running with a large database, setting <link linkend="VIRTINI">MaxCheckpointRemap</link> to 1/4th of
- the database size is recommended.  This is in pages, 8K per page.</para>
-    </sect2>
-    <sect2 id="rdfperfrdfscheme"><title>RDF Index Scheme</title>
-<para>
-Starting with version 6.00.3126 the default RDF index scheme consists
-of 2 full indices over RDF quads plus 3 partial indices. This index
-scheme is generally adapted to all kinds of workloads, regardless of
-whether queries generally specify a graph.
-</para>
+  DELETE FROM DB.DBA.LOAD_LIST WHERE LL_FILE = '##stop';
+  commit work;
+
+  while (1)
+    {
+      set isolation = 'repeatable';
+      declare exit handler for sqlstate '40001' {
+	rollback work;
+        sec_delay := rnd(1000)*0.001;
+	log_message(sprintf('deadlock in loader, waiting %d milliseconds', cast (sec_delay * 1000 as integer)));
+	delay(sec_delay);
+	goto again;
+      };
 
-<para>
-Alternate indexing schemes are possible but will not be generally needed.
-For upgrading old databases with a different index scheme see the corresponding documentation.
-</para>
+     again:;
 
-<para>
-The index scheme consists of the following indices:
-</para>
+      if (exists (SELECT 1 FROM DB.DBA.LOAD_LIST WHERE LL_FILE = '##stop'))
+	{
+	  log_message ('File load stopped by rdf_load_stop.');
+	  return;
+	}
 
-<itemizedlist mark="bullet">
-  <listitem><emphasis>PSOG</emphasis> - primary key</listitem>
-  <listitem><emphasis>POGS</emphasis> - bitmap index for lookups on object value.</listitem>
-  <listitem><emphasis>SP</emphasis> - partial index for cases where only S is specified.</listitem>
-  <listitem><emphasis>OP</emphasis> - partial index for cases where only O is specified.</listitem>
-  <listitem><emphasis>GS</emphasis> - partial index for cases where only G is specified.</listitem>
-</itemizedlist>
+      log_enable (tx_mode, 1);
 
-<para>
-This index scheme is created by the following statements:
-</para>
+      if (max_files is not null and max_files <= 0)
+        {
+	  commit work;
+	  log_message ('Max_files reached. Finishing.');
+          return;
+	}
 
-<programlisting><![CDATA[
-create table DB.DBA.RDF_QUAD (
-  G IRI_ID_8,
-  S IRI_ID_8,
-  P IRI_ID_8,
-  O any,
-  primary key (P, S, O, G)
-  )
-alter index RDF_QUAD on DB.DBA.RDF_QUAD partition (S int (0hexffff00));
+      whenever not found goto looks_empty;
 
-create distinct no primary key ref bitmap index RDF_QUAD_SP on RDF_QUAD (S, P) partition (S int (0hexffff00));
-create bitmap index RDF_QUAD_POGS on RDF_QUAD (P, O, G, S) partition (O varchar (-1, 0hexffff));
-create distinct no primary key ref bitmap index RDF_QUAD_GS on RDF_QUAD (G, S) partition (S int (0hexffff00));
-create distinct no primary key ref index RDF_QUAD_OP on RDF_QUAD (O, P) partition (O varchar (-1, 0hexffff));
+      --      log_message ('Getting next file.');
+      set isolation = 'serializable';
+      SELECT id into xx FROM ldlock WHERE id = 0 for update;
+      arr := ld_array ();
+      commit work;
+      if (0 = arr)
+	goto looks_empty;
+      log_enable (ld_mode, 1);
+
+      for (inx := 0; inx < 100; inx := inx + 1)
+	{
+	  if (0 = arr[inx])
+	    goto arr_done;
+	  ld_file (arr[inx][0], arr[inx][1]);
+	  UPDATE DB.DBA.LOAD_LIST set LL_STATE = 2, LL_DONE = curdatetime () WHERE LL_FILE = arr[inx][0];
+	}
+    arr_done:
+      log_enable (tx_mode, 1);
+
+
+      if (max_files is not null) max_files := max_files - 100;
+
+      commit work;
+    }
+
+ looks_empty:
+  commit work;
+  log_message ('No more files to load. Loader has finished,');
+  return;
+
+}
 ;
-]]></programlisting>
 
+create procedure rdf_load_stop (in force int := 0)
+{
+  insert into DB.DBA.LOAD_LIST (LL_FILE) values ('##stop');
+  commit work;
+  if (force)
+    cl_exec ('txn_killall (1)');
+}
+;
 
-<para>
-The idea is to favor queries where the predicate is specified in
-triple patterns. The entire quad can be efficiently accessed when P
-and either or both S and O are known. This has the advantage of
-clustering data by the predicate which improves working set: A page
-read from disk will only have entries pertaining to the same
-predicate, chances of accessing other entries of the page are thus
-higher than if the page held values for arbitrary predicates. For
-less frequent cases where only S is known, as in describe, the
-distinct P's of the S are found in the SP index. These SP pairs are
-then used for accessing the PSOG index to get the O and G. For cases
-where only the G is known, as in dropping a graph, the distinct S's of
-the G are found in the GS index. The P's of the S are then found in
-the SP index. After this the whole quad is found in the PSOG index.
-</para>
 
-<para>
-The SP, OP and GS indices do not store duplicates. If a S has many
-values of the P, there is only one entry. Extries are not deleted
-from SP, OP or GS. This does not lead to erroneous results since a
-full index, that is either POSG or PSOG is always consulted in order
-to know if a quad actually exists. For cases of updating data, most
-often a graph is entirely dropped and a substantially similar graph is
-inserted in its place. The SP, OP and GS indices get to stay relatively unaffected.
-</para>
+create procedure RDF_LOADER_RUN_1 (in x int, in y int)
+{
+  rdf_loader_run (x, y);
+}
+;
 
-<para>
-Still over time specially if there are frequent updates and values do not repeat between
-consecutive states the SP, OP and GS indices will get polluted which may affect performance.
-Dropping and recreating the index will then remedy the situation.
-</para>
+create procedure rdf_ld_srv (in log_enable int)
+{
+  declare aq any;
+  aq := async_queue (1);
+  aq_request (aq, 'DB.DBA.RDF_LOADER_RUN_1', vector (null, log_enable));
+  aq_wait_all (aq);
+}
+;
+
+
+create procedure load_grdf (in f varchar)
+{
+  declare line any;
+  declare inx int;
+  declare ses any;
+  declare gr varchar;
+
+  if (f like '%.gz')
+    ses := gz_file_open (f);
+  else
+    ses := file_open (f);
+  inx := 0;
+  line := '';
+  while (line <> 0)
+    {
+      gr := ses_read_line (ses, 0, 0, 1);
+      if (gr = 0) return;
+      line := ses_read_line (ses, 0, 0, 1);
+      if (line = 0) return;
+      DB.DBA.RDF_LOAD_RDFXML (line, gr, gr);
+      inx := inx + 1;
+    }
+}
+;
+
+
+
+-- cl_exec ('set lock_escalation_pct = 110');
+-- cl_exec ('DB.DBA.RDF_LD_SRV (1)') &
+-- cl_exec ('DB.DBA.RDF_LD_SRV (2)') &
+]]></programlisting>
+</listitem>
+  <listitem>Execute:
+<programlisting><![CDATA[
+SQL>cl_exec ('checkpoint);
+]]></programlisting>
+</listitem>
+  <listitem>Execute ld_dir ('directory' , 'mask' , 'graph'), for ex:
+<programlisting><![CDATA[
+SQL>ld_dir ('/dbs/data', '*.gz', 'http://dbpedia.org');
+]]></programlisting>
+</listitem>
+  <listitem>Execute on every node with separate client:
+<programlisting><![CDATA[
+SQL>rdf_loader_run();
+]]></programlisting>
+</listitem>
+</itemizedlist>
+</sect3>
+
+
+       <sect3 id="rdfperfloadingunitpro"><title>Loading UniProt RDF data</title>
+<para>To load the uniprot data, create a function for example such as:</para>
+<programlisting><![CDATA[
+create function DB.DBA.UNIPROT_LOAD (in log_mode integer := 1)
+{
+  DB.DBA.RDF_LOAD_RDFXML_MT (file_to_string_output('filename1'),'http://base_uri_1', 'destination_graph_1', log_mode, 3);
+  DB.DBA.RDF_LOAD_RDFXML_MT (file_to_string_output('filename2'),'http://base_uri_2', 'destination_graph_2', log_mode, 3);
+  ...
+  DB.DBA.RDF_LOAD_RDFXML_MT (file_to_string_output('filename9'),'http://base_uri_9', 'destination_graph_9', log_mode, 3);
+}
+]]></programlisting>
+<para>If you are starting from blank database and you can drop it and re-create in case of error signaled, use it this way:</para>
+<programlisting><![CDATA[
+checkpoint;
+checkpoint_interval(6000);
+DB.DBA.UNIPROT_LOAD (0),
+checkpoint;
+checkpoint_interval(60);
+]]></programlisting>
+<para>If the database contains important data already and there's no way to stop it and backup before the load then use:</para>
+<programlisting><![CDATA[
+checkpoint;
+checkpoint_interval(6000);
+DB.DBA.UNIPROT_LOAD (),
+checkpoint;
+checkpoint_interval(60);
+]]></programlisting>
+<para>Note that the 'number of threads' parameter of DB.DBA.RDF_LOAD_RDFXML() mentions threads
+used to process data from file, an extra thread will read the text and parse it,
+so for 4 CPU cores there's no need in parameter value greater than 3. Three processing
+threads per one parsing tread is usually good ratio because parsing is usually three
+times faster than the rest of loading so CPU loading is well balanced.
+If for example you are using 2 x Quad Xeon, then you can choose between 8
+single-threaded parsers or 2 parsers with 3 processing threads each. With 4 cores you may simply load
+file after file with 3 processing threads. The most important performance tuning is to set the
+[Parameters] section of virtuoso configuration file:</para>
+<programlisting><![CDATA[
+NumberOfBuffers = 1000000
+MaxDirtyBuffers = 800000
+MaxCheckpointRemap = 1000000
+DefaultIsolation = 2
+]]></programlisting>
+<para>Note: these numbers are reasonable for 16 GB RAM Linux box. Usually when there are no such massive operations as loading huge database, you can set up the values as:</para>
+<programlisting><![CDATA[
+NumberOfBuffers = 1500000
+MaxDirtyBuffers = 1200000
+MaxCheckpointRemap = 1500000
+DefaultIsolation = 2
+]]></programlisting>
+<tip>
+	<title>See Also:</title>
+    <para><link linkend=""></link></para>
+    <para><ulink url="http://www.openlinksw.com/dataspace/dav/wiki/Main/VirtConfigScale#Configuration%20Options">Virtuoso Configuration Options</ulink></para>    	
+</tip>
+<tip>
+	<title>Tip:</title>
+<para>Thus after loading all data you may wish to shutdown, tweak and start server again.
+If you have ext2fs or ext3fs filesystem, then it's better to have enough free space on disk not to
+make it more than 80% full.  When it's almost full it may allocate database file badly, resulting
+in measurable loss of disk access speed. That is not Virtuoso-specific fact, but a common hint
+for all database-like applications with random access to big files.</para>
+</tip>
+<para>Here is an example of using awk file for splitting big file smaller ones:</para>
+<programlisting><![CDATA[
+BEGIN {
+	file_part=1000
+	e_line = "</rdf:RDF>"
+        cur=0
+        cur_o=0
+	file=0
+	part=file_part
+      }
+	{
+	    res_file_i="res/"FILENAME
+	    line=$0
+	    s=$1
+	    res_file=res_file_i"_"file".rdf"
 
-<para>
-For cases where this is not practical the index scheme should only have full indices, i.e.
-each key holds all columns of the primary key of the quad. This will be the case if the
-distinct no primary key ref options are not specified in the create index statement. In
-such cases all indices remain in strict sync across deletes.
-</para>
+	    if (index (s, "</rdf:Description>") == 1)
+	    {
+		cur=cur+1
+		part=part-1
+	    }
 
-<para>
-Many RDF workloads have bulk load and read intensive access patterns with few deletes.
-The default index scheme is optimized for these. With these situations this scheme offers
-significant space savings resulting in better working set. Typically this layout takes
-60-70% of the space of a layout with 4 full indices.
-</para>
-    </sect2>
-    <sect2 id="rdfperfindexes"><title>Index Scheme Selection</title>
-<para>If the graph is always given, as one or more <emphasis>FROM</emphasis> or <emphasis>FROM NAMED</emphasis>, and there are no patterns where only graph and predicate are given, then the default indices should be appropriate.
-If the predicate and graph are given but subject is not, then it is sometimes useful to add</para>
+	    if (part > 0)
+	    {
+	    	print line >> res_file
+	    }
 
-<programlisting><![CDATA[
-create bitmap index RDF_QUAD_PGOS on DB.DBA.RDF_QUAD (G, P, O, S) partition (O varchar (-1, 0hexffff));
+	    if (part == 0)
+	    {
+#		print "===================== " cur
+	    	print line >> res_file
+		print e_line >> res_file
+		close (res_file)
+		file=file+1
+		part=file_part
+	    	res_file=res_file_i"_"file".rdf"
+		system ("cp beg.txt " res_file)
+	    }
+        }
+END { }
 ]]></programlisting>
+       </sect3>
+       <sect3 id="rdfperfloadingdbpedia"><title>Loading DBPedia RDF data</title>
+<para>You can use the following script as an example for loading DBPedia RDF data in Virtuoso:</para>
+<programlisting><![CDATA[
+#!/bin/sh
 
-<note><para>If the server is pre 5.0.7, leave out the partitioning clause.</para></note>
+PORT=$1
+USER=$2
+PASS=$3
+file=$4
+g=$5
+LOGF=`basename $0`.log
 
-<para>Making the PGOS index can help in some cases even if it is not readily apparent from the queries that one is needed.  This is so for example if the predicate by itself is selective, i.e. there is a predicate that occurs in only a few triples.</para>
-<para>If the graph itself is not given in the queries, then the default index scheme will be unworkable.
-For this, the appropriate scheme is:</para>
+if [ -z "$PORT" -o -z "$USER" -o -z "$PASS" -o -z "$file" -o -z "$g" ]
+then
+  echo "Usage: `basename $0` [DSN] [user] [password] [ttl-file] [graph-iri]"
+  exit
+fi
 
-<programlisting><![CDATA[
-create table RDF_QUAD (G iri_id_8, S iri_id_8, P iri_id_8, O any, primary key (S, P, O, G))
-alter index RDF_QUAD on RDF_QUAD partition (S int (0hexffff00));
-create bitmap index RDF_QUAD_OPGS on DB.DBA.RDF_QUAD (O, P, G, S) partition (O varchar (-1, 0hexffff));
-create bitmap index RDF_QUAD_POGS on DB.DBA.RDF_QUAD (P, O, G, S) partition (O varchar (-1, 0hexffff));
-create bitmap index RDF_QUAD_GPOS on DB.DBA.RDF_QUAD (G, P, O, S) partition (O varchar (-1, 0hexffff));
-]]></programlisting>
+if [ ! -f "$file" -a ! -d "$file" ]
+then
+    echo "$file does not exists"
+    exit 1
+fi
 
-<note><para>For a pre 5.0.7 server, leave the partition clauses and the alter index statement out.</para></note>
+mkdir READY 2>/dev/null
+rm -f $LOGF $LOGF.*
 
-<para>If there are existing triples and one does not wish to reload them, then the following sequence will convert the data:</para>
+echo "Starting..."
+echo "Logging into: $LOGF"
 
-<programlisting><![CDATA[
-log_enable (2);
-drop index RDF_QUAD_OGPS;
-checkpoint;
-create table R2 (G iri_id_8, S iri_id_8, P iri_id_8, O any, primary key (S, P, O, G))
-alter index R2 on R2 partition (S int (0hexffff00));
+DOSQL ()
+{
+    isql $PORT $USER $PASS verbose=on banner=off prompt=off echo=ON errors=stdout exec="$1" > $LOGF
+}
 
-insert into r2 (g, s, p, o) SELECT g, s, p, o from rdf_quad;
+LOAD_FILE ()
+{
+    f=$1
+    g=$2
+    echo "Loading $f (`cat $f | wc -l` lines) `date \"+%H:%M:%S\"`" | tee -a $LOG
 
-drop table RDF_QUAD;
-checkpoint;
-alter table r2 rename RDF_QUAD;
-create bitmap index RDF_QUAD_OPGS on DB.DBA.RDF_QUAD (O, P, G, S) partition (O varchar (-1, 0hexffff));
-create bitmap index RDF_QUAD_POGS on RDF_QUAD (P, O, G, S) partition (O varchar (-1, 0hexffff));
-create bitmap index RDF_QUAD_GPOS on RDF_QUAD (G, P, O, S) partition (O varchar (-1, 0hexffff));
-checkpoint;
-log_enable (1);
-]]></programlisting>
+    DOSQL "ttlp_mt (file_to_string_output ('$f'), '', '$g', 17); checkpoint;" > $LOGF
 
-<para>First drop the OGPS index to make space.  Then, in row autocommit mode
-and without logging, copy the quads into a new primary key layout.
-Drop the old and rename the new over the old.  Make the additional
-indices.  Do a checkpoint after the drops so as to actually free the
-space also in the checkpointed state.  Finish with a checkpoint so as
-to finalize the changes, since logging was turned off.  Even if
-logging had been on, one would not wish to have to replay the
-reindexing if the server terminated abnormally.
-Finally turn logging back on for the session.</para>
+    if [ $? != 0 ]
+    then
+	echo "An error occurred, please check $LOGF"
+	exit 1
+    fi
 
-<note><para>This is all meant to be done with a SQL client like isql and not through a web interface.
-The web interface has no real session and the log_enables do nothing there.</para></note>
+    line_no=`grep Error $LOGF | awk '{ match ($0, /line [0-9]+/, x) ; match (x[0], /[0-9]+/, y); print y[0] }'`
+    newf=$f.part
+    inx=1
+    while [ ! -z "$line_no" ]
+    do
+	cat $f |  awk "BEGIN { i = 1 } { if (i==$line_no) { print \$0; exit; } i = i + 1 }"  >> bad.nt
+	line_no=`expr $line_no + 1`
+	echo "Retrying from line $line_no"
+	echo "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> ." > tmp.nt
+	cat $f |  awk "BEGIN { i = 1 } { if (i>=$line_no) print \$0; i = i + 1 }"  >> tmp.nt
+	mv tmp.nt $newf
+	f=$newf
+	mv $LOGF $LOGF.$inx
+	DOSQL "ttlp_mt (file_to_string_output ('$f'), '', '$g', 17); checkpoint;" > $LOGF
 
-<para>Other indexing schemes may be tried.  We note however that in all
-cases, one or other of the indices should begin with G.  This is
-because for schema operations it is necessary to read through a
-graph. If no index begins with G, this becomes a full table scan and
-is unworkable, leading to an extremely slow server start and making
-operations like drop graph as good as unusable.</para>
+	if [ $? != 0 ]
+    then
+	    echo "An error occurred, please check $LOGF"
+	    exit 1
+    fi
+	line_no=`grep Error $LOGF | awk '{ match ($0, /line [0-9]+/, x) ; match (x[0], /[0-9]+/, y); print y[0] }'`
+	inx=`expr $inx + 1`
+    done
+    rm -f $newf 2>/dev/null
+    echo "Loaded.  "
+}
 
-<para>Public web service endpoints are proven to be sources of especially bad queries. While local
-application develpers can obtain instructions from database administrator and use ISQL access to
-the database in order to tune execution plans, "external" clients do not know details of
-configuration and/or lacks appropriate skills. The most common problem is that public endpoints usually
-get requests that does not mention the required graph, because that queries were initially written for
-use with triple stores. If the web service provides access to a single graph (or to a short list of graphs)
-then it is strongly recommended to configure it by adding a row into
-<emphasis>DB.DBA.SYS_SPARQL_HOST</emphasis>. The idea is that if the client specifies default graph in
-the request or uses named graphs and group graph patterns then he is probably smarter than average and
-will provide meaningful queries. If no graph names are specified then the query will benefit from
-preset graph because this will give the compiler some more indexes to choose from -- indexes taht begin
-with G.</para>
-<para>Sometimes web service endpoint is used to access data of only one application, not all data in the
-system. In that case one may wish to declare a separate storage that consists of only RDF Views made
-by that application and define <emphasis>input:storage</emphasis> in appropriate row of
-<emphasis>DB.DBA.SYS_SPARQL_HOST</emphasis>.</para>
-</sect2>
-<sect2 id="rdfperfdumpandreloadgraphs"><title>Dump and Reload Graphs</title>
-In order to dump all graphs with extension exclude those graphs of a certain type by using a
-sparql ask query, you may use the following script sequence:
+echo "======================================="
+echo "Loading started."
+echo "======================================="
+
+if [ -f "$file" ]
+then
+    LOAD_FILE $file $g
+    mv $file READY 2>> /dev/null
+elif [ -d "$file" ]
+then
+    for ff in `find $file -name '*.nt'`
+    do
+	LOAD_FILE $ff $g
+	mv $ff READY 2>> /dev/null
+    done
+else
+   echo "The input is not file or directory"
+fi
+echo "======================================="
+echo "Final checkpoint."
+DOSQL "checkpoint;" > temp.res
+echo "======================================="
+echo "Check bad.nt file for skipped triples."
+echo "======================================="
+
+exit 0
+
+]]></programlisting>
+       </sect3>
+       <sect3 id="rdfperfloadingbio2rdf"><title>Loading Bio2RDF data</title>
+<para>The shell script below was used to import files in n3 notation into OpenLink Virtuoso RDF storage.</para>
+<para>When an syntax error it will cut content from next line and will retry. This was used on ubuntu linux to import bio2rdf and freebase dumps.</para>
+<para>Note it uses gawk, so it must be available on system where is tried. Also for recovery additional disk space is needed at max the size of original file.</para>
 <programlisting><![CDATA[
-create procedure dump_graphs (in dir varchar := 'dumps', in file_length_limit integer := 1000000000)
-{
-  declare inx int;
-  inx := 1;
-  set isolation = 'uncommitted';
-  for (select * from (sparql define input:storage "" select distinct ?g { graph ?g { ?s ?p ?o } . filter ( ?g != virtrdf: ) } ) as sub option (loop)) do
-    {
-      dump_one_graph ("g", sprintf ('%s/graph%06d_', dir, inx), file_length_limit);
-      inx := inx + 1;
-    }
-}
-;
+#!/bin/bash
 
-create procedure dump_one_graph (in srcgraph varchar, in out_file varchar, in file_length_limit integer := 1000000000)
-{
-  declare file_name varchar;
-  declare env, ses any;
-  declare ses_len, max_ses_len, file_len, file_idx integer;
-  set isolation = 'uncommitted';
-  max_ses_len := 10000000;
-  file_len := 0;
-  file_idx := 1;
-  file_name := sprintf ('%s%06d.ttl', out_file, file_idx);
-  string_to_file (file_name || '.graph', srcgraph, -2);
-  string_to_file (file_name, sprintf ('# Dump of graph <%s>, as of %s\n', srcgraph, cast (now() as varchar)), -2);
-  --env := vector (dict_new (16000), 0, '', '', '', 0, 0);
-  env := vector (dict_new (16000), 0, '', '', '', 0, 0, 0, 0);
-  ses := string_output ();
-  for (select * from (sparql define input:storage "" select ?s ?p ?o { graph `iri(?:srcgraph)` { ?s ?p ?o } } ) as sub option (loop)) do
-    {
-      http_ttl_triple (env, "s", "p", "o", ses);
-      ses_len := length (ses);
-      if (ses_len > max_ses_len)
-        {
-          file_len := file_len + ses_len;
-          if (file_len > file_length_limit)
-            {
-              http (' .\n', ses);
-              string_to_file (file_name, ses, -1);
-              file_len := 0;
-              file_idx := file_idx + 1;
-              file_name := sprintf ('%s%06d.ttl', out_file, file_idx);
-              string_to_file (file_name, sprintf ('# Dump of graph <%s>, as of %s (part %d)\n', srcgraph, cast (now() as varchar), file_idx), -2);
-              env := vector (dict_new (16000), 0, '', '', '', 0, 0);
-            }
-          else
-            string_to_file (file_name, ses, -1);
-          ses := string_output ();
-        }
-    }
-  if (length (ses))
-    {
-      http (' .\n', ses);
-      string_to_file (file_name, ses, -1);
-    }
-}
-;
+PASS=$1
+f=$2
+g=$3
 
-create procedure load_graphs (in dir varchar := 'dumps/')
-{
-  declare arr any;
-  declare g varchar;
+# Usage
+if [ -z "$PASS" -o -z "$f" -o -z "$g" ]
+then
+  echo "Usage: $0 [password] [ttl-file] [graph-iri]"
+  exit
+fi
 
-  arr := sys_dirlist (dir, 1);
-  log_enable (2, 1);
-  foreach (varchar f in arr) do
-    {
-      if (f like '*.ttl')
-	{
-	  declare continue handler for sqlstate '*'
-	    {
-	      log_message (sprintf ('Error in %s', f));
-	    };
-  	  g := file_to_string (dir || '/' || f || '.graph');
-	  DB.DBA.TTLP_MT (file_open (dir || '/' || f), g, g, 255);
-	}
-    }
-  exec ('checkpoint');
-}
-;
-]]></programlisting>
-</sect2>
-<sect2 id="rdfperfdumpandreloadgraphsn3"><title>Dump RDF View Graph to n3</title>
-<para>The RDF_QM_TREE_DUMP procedure and its associated procedures below are used 
-for dumping one or more RDFView Graphs in a Virtuoso server to a set of 
-turtle ttl dataset files in the specified dump directory. The dump generation 
-is made as fast as possible by grouping mappings by underlying tables so many 
-properties from neighbor database columns can be extracted in one table scan. 
-The size of the generated files is limited to 5MB. The dump process creates 
-internal stored procedures; their texts are saved in file .dump_procedures.sql in 
-the directory of dump files for debugging purposes.
-</para>
+if [ ! -f "$f" ]
+then
+    echo "$f does not exists"
+    exit
+fi
 
-<para>Note that the dump directory must be included in the <code>DirsAllowed</code> 
-parameter of the Virtuoso configuration file (e.g., <code>virtuoso.ini</code>), or the 
-server will not be allowed to create nor access the dataset file(s).
-</para>
+# Your port here
+PORT=1111  #`inifile -f dbpedia.ini -s Parameters -k ServerPort`
+if test -z "$PORT"
+then
+    echo "Cannot find INI and inifile command"
+    exit
+fi
 
-<para>
-The <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtBulkRDFLoader">Virtuoso RDF bulk loader</ulink> 
-scripts can then be used to load the dumped datasets for the RDFView graphs directly into 
-a Virtuoso RDF QUAD store.
-</para>
+# Initial run
+isql $PORT dba $PASS verbose=on banner=off prompt=off echo=ON errors=stdout exec="ttlp_mt (file_to_string_output ('$f'), '', '$g'); checkpoint;" > $0.log
 
-<sect3 id="rdfperfdumpandreloadgraphsn3params"><title>Parameters</title>
-<itemizedlist mark="bullet">
-  <listitem><code>in</code> <emphasis>dest_dir</emphasis> <code>VARCHAR</code> - dump directory </listitem>
-  <listitem><code>in</code> <emphasis>graph_iri</emphasis> <code>VARCHAR</code> - IRI of the graph to be dumped; triples from other graphs will be excluded. If NULL, then there's no restriction by graph.</listitem>
-  <listitem><code>in</code> <emphasis>storage</emphasis> <code>VARCHAR</code> - IRI of the quad map storage to use. NULL means use default storage.</listitem>
-  <listitem><code>in</code> <emphasis>root</emphasis> <code>VARCHAR</code> - IRI of the quad map to use, e.g., an IRI of an RDF View (or its part). NULL means use all RDF Views of the storage (and the default mapping as well).</listitem>    
-</itemizedlist>
-</sect3>
-<sect3 id="rdfperfdumpandreloadgraphsn3code"><title>Procedure Code</title>
-<programlisting><![CDATA[
-CREATE PROCEDURE DB.DBA.RDF_QM_TREE_DUMP 
-  ( in  dest_dir  VARCHAR, 
-    in  graph_iri VARCHAR := NULL, 
-    in  storage   VARCHAR := NULL, 
-    in  root      VARCHAR := NULL
-  )
-{
- DECLARE all_qms, 
-         grouped_qmvs, 
-         launcher_text  ANY;
- DECLARE grp_ctr, 
-         qm_ctr, 
-         qm_count       INTEGER;
- DECLARE sql_file, 
-         launcher_name  VARCHAR;
- IF (NOT (dest_dir LIKE '%/'))
-   dest_dir := dest_dir || '/';
- sql_file := dest_dir || '.dump_procedures.sql';
- IF (storage IS NULL)
-   storage := 'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage';
- string_to_file (
-   sql_file, 
-   '-- This file contains procedure created by DB.DBA.RDF_QM_TREE_DUMP() for storage ' 
-      || COALESCE (storage, 'NULL') 
-      || ' and root quad map ' 
-      || COALESCE (root, 'NULL') 
-      || '\n\n', 
-   -2);
- all_qms := dict_list_keys (DB.DBA.RDF_QM_CONTENT_OF_QM_TREE (graph_iri, storage, root), 2);
- grouped_qmvs := DB.DBA.RDF_QM_GROUP_BY_SOURCE_TABLES (all_qms);
- launcher_name := 'RDF_QM_TREE_DUMP_BATCH_' || md5 (serialize (graph_iri) || storage || serialize (root));
- launcher_text := string_output ();
- http ('CREATE PROCEDURE DB.DBA."' || launcher_name || '" (in dest_dir VARCHAR)\n{\n', launcher_text);
- FOR (grp_ctr := length (grouped_qmvs); grp_ctr > 0; grp_ctr := grp_ctr-2)
-   {
-     DECLARE tables, qms, proc_text ANY;
-     DECLARE group_key, proc_name, dump_prefix, cmt VARCHAR;
-     tables := grouped_qmvs [grp_ctr-2];
-     qms := grouped_qmvs [grp_ctr-1];
-     qm_count := length (qms);
-     group_key := md5 (serialize (graph_iri) || storage || serialize (root) || serialize (tables));
-     proc_name := 'RDF_QM_TREE_DUMP_GRP_' || group_key;
-     proc_text := string_output ();
-     cmt := sprintf ('%d quad maps on join of', qm_count);
-     FOREACH (VARCHAR t IN tables) DO cmt := cmt || ' ' || t;
-     http ('  --  ' || cmt || '\n', launcher_text);
-     http ('  DB.DBA."' || proc_name || '" (dest_dir);\n', launcher_text);
-     http ('CREATE PROCEDURE DB.DBA."' || proc_name || '" (in dest_dir VARCHAR)\n', proc_text);
-     http ('{\n', proc_text);
-     http ('  -- ' || cmt || '\n', proc_text);
-     http ('  DECLARE ses, env ANY;\n', proc_text);
-     http ('  DECLARE file_ctr, cmt_len INTEGER;\n', proc_text);
-     http ('  file_ctr := 0;\n', proc_text);
-     http ('  dbg_obj_princ (' || WS.WS.STR_SQL_APOS (cmt) || ', '', file '', file_ctr);\n', proc_text);
-     http ('  ses := string_output ();\n', proc_text);
-     http ('  http (' || WS.WS.STR_SQL_APOS ('#' || cmt || '\n') || ', ses);\n', proc_text);
-     http ('  env := VECTOR (dict_new (16000), 0, '''', '''', '''', 0, 0, 0, 0);\n', proc_text);
-     http ('  cmt_len := LENGTH (ses);\n', proc_text);
-     http ('  FOR (SPARQL DEFINE input:storage <' || storage || '>\n', proc_text);
-     http ('    SELECT ?s1, ?p1, ?o1\n', proc_text);
-     IF (graph_iri IS NOT NULL)
-       {
-         http ('    WHERE { GRAPH <', proc_text); http_escape (graph_iri, 12, proc_text, 1, 1); http ('> {\n', proc_text);
-       }
-     ELSE
-       http ('    WHERE { GRAPH ?g1 {\n', proc_text);
-     FOR (qm_ctr := 0; qm_ctr < qm_count; qm_ctr := qm_ctr + 1)
-       {
-         IF (qm_ctr > 0) http ('            UNION\n', proc_text);
-         http ('            { quad map <' || qms[qm_ctr] || '> { ?s1 ?p1 ?o1 } }\n', proc_text);
-       }
-     http ('          } } ) DO {\n', proc_text);
-     http ('      http_ttl_triple (env, "s1", "p1", "o1", ses);\n', proc_text);
-     http ('      IF (LENGTH (ses) > 5000000)\n', proc_text);
-     http ('        {\n', proc_text);
-     http ('          http ('' .\\n'', ses);\n', proc_text);
-     http ('          string_to_file (sprintf (''%s' || group_key || '_%05d.ttl'', dest_dir, file_ctr), ses, -2);\n', proc_text);
-     http ('          file_ctr := file_ctr + 1;\n', proc_text);
-     http ('          dbg_obj_princ (' || WS.WS.STR_SQL_APOS (cmt) || ', '', file '', file_ctr);\n', proc_text);
-     http ('          ses := string_output ();\n', proc_text);
-     http ('          http (' || WS.WS.STR_SQL_APOS ('#' || cmt || '\n') || ', ses);\n', proc_text);
-     http ('          env := VECTOR (dict_new (16000), 0, '''', '''', '''', 0, 0, 0, 0);\n', proc_text);
-     http ('        }\n', proc_text);
-     http ('    }\n', proc_text);
-     http ('  IF (LENGTH (ses) > cmt_len)\n', proc_text);
-     http ('    {\n', proc_text);
-     http ('      http ('' .\\n'', ses);\n', proc_text);
-     http ('      string_to_file (sprintf (''%s' || group_key || '_%05d.ttl'', dest_dir, file_ctr), ses, -2);\n', proc_text);
-     http ('    }\n', proc_text);
-     http ('}\n', proc_text);
-     proc_text := string_output_string (proc_text);
-     string_to_file (sql_file, proc_text || ';\n\n' , -1);
-     EXEC (proc_text);
-   }
- http ('}\n', launcher_text);
- launcher_text := string_output_string (launcher_text);
- string_to_file (sql_file, launcher_text || ';\n\n' , -1);
- EXEC (launcher_text);
- CALL ('DB.DBA.' || launcher_name)(dest_dir);
-}
-;
+# If disconnect etc.
+if [ $? != 0 ]
+then
+    echo "An error occurred, please check $0.log"
+    exit
+fi
 
-CREATE FUNCTION DB.DBA.RDF_QM_CONTENT_OF_QM_TREE 
-  ( in  graph_iri  VARCHAR := NULL,
-    in  storage    VARCHAR := NULL, 
-    in  root       VARCHAR := NULL, 
-    in  dict       ANY := NULL
-  ) returns ANY
-{
- DECLARE res, subqms any;
- DECLARE graphiri varchar;
- graphiri := DB.DBA.JSO_SYS_GRAPH();
- IF (storage IS NULL)
-   storage := 'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage';
- DB.DBA.RDF_QM_ASSERT_STORAGE_FLAG (storage, 0);
- IF (dict IS NULL)
-   dict := dict_new ();
- IF (root IS NULL)
-   {
-     subqms := ((SELECT DB.DBA.VECTOR_AGG (sub."qmiri")
-         FROM (
-           SPARQL DEFINE input:storage ""
-           SELECT DISTINCT (str(?qm)) AS ?qmiri
-           WHERE { GRAPH `iri(?:graphiri)` {
-                     { `iri(?:storage)` virtrdf:qsUserMaps ?lst .
-                       ?lst ?p ?qm .
-                       FILTER (0 = bif:strstr (str(?p), str(rdf:_)))
-                     } UNION {
-                       `iri(?:storage)` virtrdf:qsDefaultMap ?qm .
-                     } } } ) AS sub ) );
-     FOREACH (varchar qmid IN subqms) DO
-       DB.DBA.RDF_QM_CONTENT_OF_QM_TREE (graph_iri, storage, qmid, dict);
-     RETURN dict;
-   }
- DB.DBA.RDF_QM_ASSERT_JSO_TYPE (root, 'http://www.openlinksw.com/schemas/virtrdf#QuadMap');
- IF (graph_iri IS NOT NULL AND
-   EXISTS ((SPARQL DEFINE input:storage ""
-       SELECT (1) WHERE {
-           GRAPH `iri(?:graphiri)` {
-               `iri(?:root)` virtrdf:qmGraphRange-rvrFixedValue ?g .
-               FILTER (str (?g) != str(?:graph_iri))
-             } } ) ) )
-   RETURN dict;
- IF (NOT EXISTS ((SPARQL DEFINE input:storage ""
-       SELECT (1) WHERE {
-           GRAPH `iri(?:graphiri)` {
-               `iri(?:root)` virtrdf:qmMatchingFlags virtrdf:SPART_QM_EMPTY .
-             } } ) ) )
-   dict_put (dict, root, 1);
- subqms := ((SELECT DB.DBA.VECTOR_AGG (sub."qmiri")
-     FROM (
-       SPARQL DEFINE input:storage ""
-       SELECT DISTINCT (str(?qm)) as ?qmiri
-       WHERE { GRAPH `iri(?:graphiri)` {
-   		`iri(?:root)` virtrdf:qmUserSubMaps ?lst .
-               ?lst ?p ?qm .
-               FILTER (0 = bif:strstr (str(?p), str(rdf:_)))
-             } } ) AS sub ) );
- FOREACH (VARCHAR qmid IN subqms) DO
-   DB.DBA.RDF_QM_CONTENT_OF_QM_TREE (graph_iri, storage, qmid, dict);
- RETURN dict;
-}
-;
+# Check for error
+line_no=`grep Error $0.log | awk '{ match ($0, /line [0-9]+/, x) ; match (x[0], /[0-9]+/, y); print y[0] }'`
+newf=$f.part
+inx=1
+
+# Error recovery
+while [ ! -z "$line_no" ]
+do
+    cat $f |  awk "BEGIN { i = 0 } { if (i==$line_no) { print \$0; exit; } i = i + 1 }"  >> bad.nt
+    line_no=`expr $line_no + 1`
+    echo "Retrying from line $line_no"
+    cat $f |  awk "BEGIN { i = 0 } { if (i>=$line_no) print \$0; i = i + 1 }"  > tmp.nt
+    mv tmp.nt $newf
+    f=$newf
+    mv $0.log $0.log.$inx
+    # Run the recovered part
+    isql $PORT dba $PASS verbose=on banner=off prompt=off echo=ON errors=stdout exec="ttlp_mt (file_to_string_output ('$f'), '', '$g'); checkpoint;" > $0.log
 
-CREATE FUNCTION DB.DBA.RDF_QM_GROUP_BY_SOURCE_TABLES (in qms ANY) returns ANY
-{
- DECLARE res ANY;
- DECLARE ctr INTEGER;
- DECLARE graphiri VARCHAR;
- graphiri := DB.DBA.JSO_SYS_GRAPH();
- res := dict_new (LENGTH (qms) / 20);
- FOREACH (VARCHAR qmiri IN qms) DO
-   {
-     DECLARE tbls, acc ANY;
-     tbls := ((SELECT DB.DBA.VECTOR_AGG (sub."tbl")
-         FROM (SELECT subsub."tbl"
-           FROM (
-             SPARQL DEFINE input:storage ""
-             SELECT DISTINCT ?tbl
-             WHERE { GRAPH `iri(?:graphiri)` {
-                       { `iri(?:qmiri)` virtrdf:qmTableName ?tbl .
-                       } UNION {
-                         `iri(?:qmiri)` virtrdf:qmATables ?atbls .
-                         ?atbls ?p ?atbl .
-                         ?atbl virtrdf:qmvaTableName ?tbl
-                       } UNION {
-                         `iri(?:qmiri)` ?fldmap ?qmv .
-                         ?qmv virtrdf:qmvATables ?atbls .
-                         ?atbls ?p ?atbl .
-                         ?atbl virtrdf:qmvaTableName ?tbl .
-                       } } } ) subsub
-           ORDER BY 1 ) AS sub ) );
-     acc := dict_get (res, tbls);
-     IF (acc IS NULL)
-       vectorbld_init (acc);
-     vectorbld_acc (acc, qmiri);
-     dict_put (res, tbls, acc);
-   }
- res := dict_to_vector (res, 2);
- FOR (ctr := LENGTH (res); ctr > 0; ctr := ctr-2)
-   {
-     DECLARE acc ANY;
-     acc := aref_set_0 (res, ctr-1);
-     vectorbld_final (acc);
-     aset_zap_arg (res, ctr-1, acc);
-   }
- RETURN res;
-}
-;
+    if [ $? != 0 ]
+    then
+	echo "An error occurred, please check $0.log"
+	exit
+    fi
+   line_no=`grep Error $0.log | awk '{ match ($0, /line [0-9]+/, x) ; match (x[0], /[0-9]+/, y); print y[0] }'`
+   inx=`expr $inx + 1`
+done
+]]></programlisting>
 
---test dbg_obj_princ (DB.DBA.RDF_QM_GROUP_BY_SOURCE_TABLES (dict_list_keys (DB.DBA.RDF_QM_CONTENT_OF_QM_TREE (null), 2)));
---test dbg_obj_princ (dict_list_keys (DB.DBA.RDF_QM_CONTENT_OF_QM_TREE (null), 2));
---test DB.DBA.RDF_QM_TREE_DUMP ('dump/demo', null, null, null);
---test DB.DBA.RDF_QM_TREE_DUMP ('dump/tpch', 'http://localhost:8600/tpch', null, null);	
+       </sect3>
+    </sect2>
+    <sect2 id="rdfperfsparul"><title>Using SPARUL</title>
+	<para>Since SPARUL updates are generally not meant to be transactional, it is
+	    best to run these in <link linkend="fn_log_enable"><function>log_enable (2)</function></link> mode,
+	    which commits every operation as it is done. This prevents one from running out of rollback space. Also for bulk updates, transaction logging can be turned off. If so, one should do a manual checkpoint after the operation to ensure persistence across server restart since there is no roll forward log.</para>
+<para>To have a roll forward log and row by row autocommit, one may use <link linkend="fn_log_enable"><function>log_enable (3)</function></link>. This will write constantly into the log which takes extra time. Having no logging and doing a checkpoint when the whole work is finished is faster.</para>
+<para>Many SPARUL operations can be run in parallel in this way. If they are independent with respect to their input and output, they can run in parallel and row by row autocommit will ensure they do not end up waiting for each others' locks.</para>
+    </sect2>
+    <sect2 id="rdfperfgeneraldbpedia"><title>DBpedia Benchmark</title>
+<para>We ran the DBpedia benchmark queries again with different configurations of Virtuoso.
+Comparing numbers given by different parties is a constant problem. In the case reported here,
+we loaded the full DBpedia 3, all languages, with about 198M triples, onto Virtuoso v5 and Virtuoso Cluster
+v6, all on the same 4 core 2GHz Xeon with 8G RAM. All databases were striped on 6 disks. The Cluster
+configuration was with 4 processes in the same box.
+We ran the queries in two variants:
+</para>
+<itemizedlist>
+  <listitem>With graph specified in the SPARQL FROM clause, using the default indices.</listitem>
+  <listitem>With no graph specified anywhere, using an alternate indexing scheme.</listitem>
+</itemizedlist>
+<para>The times below are for the sequence of 5 queries.
+As there is a query in the set that specifies no condition on S or O and only P,
+thus cannot be done with the default indices With Virtuoso v5. With Virtuoso Cluster v6 it can,
+because v6 is more space efficient. So we added the index:</para>
+<programlisting><![CDATA[
+create bitmap index rdf_quad_pogs on rdf_quad (p, o, g, s);
 ]]></programlisting>
-</sect3>	
-</sect2>	
-<sect2 id="rdfperfcost"><title>Erroneous Cost Estimates and Explicit Join Order</title>
+<table>
+<tgroup cols="4">
+<thead>
+<row>
+  <entry></entry>
+  <entry>Virtuoso v5 with  gspo, ogps, pogs</entry>
+  <entry>Virtuoso Cluster v6 with gspo, ogps</entry>
+  <entry>Virtuoso Cluster v6 with gspo, ogps, pogs</entry>
+</row>
+</thead>
+<tbody>
+<row><entry>cold</entry><entry>210 s</entry><entry>136 s</entry><entry>33.4 s</entry></row>
+<row><entry>warm</entry><entry>0.600 s</entry><entry>4.01 s</entry><entry>0.628 s</entry></row>
+</tbody>
+</tgroup>
+</table>
+<para>Now let us do it without a graph being specified. Note that alter index is valid for v6 or higher.
+For all platforms, we drop any existing indices, and:</para>
+<programlisting><![CDATA[
+create table r2 (g iri_id_8, s, iri_id_8, p iri_id_8, o any, primary key (s, p, o, g))
+alter index R2 on R2 partition (s int (0hexffff00));
 
-	<para>The selectivity of triple patterns is determined at query compile time from sampling the data.
-It is possible that misleading data is produced.
-To see if the cardinality guesses are generally valid, look at the query plan with <link linkend="fn_explain"><function>explain</function> ()</link>.</para>
-<para>Below is a sample from the LUBM qualification data set in the Virtuoso distribution.
-After running <emphasis>make test</emphasis> in <emphasis>binsrc/test/lubm</emphasis>, there is a loaded database with the data.
-Start a server in the same directory to see the data.</para>
+log_enable (2);
+insert into r2 (g, s, p, o) SELECT g, s, p, o from rdf_quad;
+
+drop table rdf_quad;
+alter table r2 rename RDF_QUAD;
+create bitmap index rdf_quad_opgs on rdf_quad (o, p, g, s) partition (o varchar (-1, 0hexffff));
+create bitmap index rdf_quad_pogs on rdf_quad (p, o, g, s) partition (o varchar (-1, 0hexffff));
+create bitmap index rdf_quad_gpos on rdf_quad (g, p, o, s) partition (o varchar (-1, 0hexffff));
+]]></programlisting>
+<para>The code is identical for v5 and v6, except that with v5 we use iri_id (32 bit) for
+the type, not iri_id_8 (64 bit). We note that we run out of IDs with v5 around a few billion
+triples, so with v6 we have double the ID length and still manage to be vastly more space efficient.</para>
+<para>With the above 4 indices, we can query the data pretty much in any combination without hitting
+a full scan of any index. We note that all indices that do not begin with s end with s as a bitmap.
+This takes about 60% of the space of a non-bitmap index for data such as DBpedia.</para>
+<para>If you intend to do completely arbitrary RDF queries in Virtuoso, then chances are
+you are best off with the above index scheme.</para>
+<table>
+<tgroup cols="3">
+<thead>
+<row>
+  <entry></entry>
+  <entry>Virtuoso v5 with  gspo, ogps, pogs</entry>
+  <entry>Virtuoso Cluster v6 with gspo, ogps, pogs</entry>
+</row>
+</thead>
+<tbody>
+<row><entry>warm</entry><entry>0.595 s</entry><entry>0.617 s</entry></row>
+</tbody>
+</tgroup>
+</table>
+<para>The cold times were about the same as above, so not reproduced.</para>
+<para>It is in the SPARQL spirit to specify a graph and for pretty much any application,
+there are entirely sensible ways of keeping the data in graphs and specifying which ones are
+concerned by queries. This is why Virtuoso is set up for this by default.</para>
+<para>On the other hand, for the open web scenario, dealing with an unknown large number of graphs,
+enumerating graphs is not possible and questions like which graph of which source asserts x become
+relevant. We have two distinct use cases which warrant different setups of the database, simple as that.</para>
+<para>The latter use case is not really within the SPARQL spec, so implementations may or may not
+support this.</para>
+<para>Once the indices are right, there is no difference between specifying a graph and not specifying a
+graph with the queries considered. With more complex queries, specifying a graph or set of graphs does
+allow some optimizations that cannot be done with no graph specified. For example, bitmap intersections
+are possible only when all leading key parts are given.</para>
+<para>The best warm cache time is with v5; the five queries run under 600 ms after the first go.
+This is noted to show that all-in-memory with a single thread of execution is hard to beat.</para>
+<para>Cluster v6 performs the same queries in 623 ms. What is gained in parallelism is lost in latency
+if all operations complete in microseconds. On the other hand, Cluster v6 leaves v5 in the dust in any
+situation that has less than 100% hit rate. This is due to actual benefit from parallelism if operations
+take longer than a few microseconds, such as in the case of disk reads. Cluster v6 has substantially
+better data layout on disk, as well as fewer pages to load for the same content.</para>
+<para>This makes it possible to run the queries without the pogs index on Cluster v6 even when v5 takes prohibitively long.</para>
+<para>The purpose is to have a lot of RAM and space-efficient data representation.</para>
+<para>For reference, the query texts specifying the graph are below. To run without specifying
+the graph, just drop the FROM <http://dbpedia.org> from each query. The returned row counts are
+indicated below each query's text.</para>
+<programlisting><![CDATA[
+SQL>SPARQL
+SELECT ?p ?o
+FROM <http://dbpedia.org>
+WHERE
+  {
+    <http://dbpedia.org/resource/Metropolitan_Museum_of_Art> ?p ?o .
+  };
+
+p                                                                                 o
+VARCHAR                                                                           VARCHAR
+_______________________________________________________________________________
+
+http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://umbel.org/umbel/ac/Artifact
+http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://dbpedia.org/class/yago/MuseumsInNewYorkCity
+http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://dbpedia.org/class/yago/ArtMuseumsAndGalleriesInTheUnitedStates
+http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://dbpedia.org/class/yago/Museum103800563
+..
+-- 335 rows
+
+SQL>SPARQL
+PREFIX p: <http://dbpedia.org/property/>
+SELECT ?film1 ?actor1 ?film2 ?actor2
+FROM <http://dbpedia.org>
+WHERE
+  {
+  ?film1 p:starring <http://dbpedia.org/resource/Kevin_Bacon> .
+  ?film1 p:starring ?actor1 .
+  ?film2 p:starring ?actor1 .
+    ?film2 p:starring ?actor2 .
+};
+
+film1                                       actor1                                    film2                                        ctor2
+VARCHAR                                     VARCHAR                                   VARCHAR                                      ARCHAR
+http://dbpedia.org/resource/The_River_Wild  http://dbpedia.org/resource/Kevin_Bacon   http://dbpedia.org/resource/The_River_Wild   http://dbpedia.org/resource/Kevin_Bacon
+http://dbpedia.org/resource/The_River_Wild  http://dbpedia.org/resource/Kevin_Bacon   http://dbpedia.org/resource/The_River_Wild   http://dbpedia.org/resource/Meryl_Streep
+http://dbpedia.org/resource/The_River_Wild  http://dbpedia.org/resource/Kevin_Bacon   http://dbpedia.org/resource/The_River_Wild   http://dbpedia.org/resource/Joseph_Mazzello
+http://dbpedia.org/resource/The_River_Wild  http://dbpedia.org/resource/Kevin_Bacon   http://dbpedia.org/resource/The_River_Wild   http://dbpedia.org/resource/David_Strathairn
+http://dbpedia.org/resource/The_River_Wild  http://dbpedia.org/resource/Kevin_Bacon   http://dbpedia.org/resource/The_River_Wild   http://dbpedia.org/resource/John_C._Reilly
+...
+--  23910 rows
+
+SQL>SPARQL
+PREFIX p: <http://dbpedia.org/property/>
+SELECT ?artist ?artwork ?museum ?director
+FROM <http://dbpedia.org>
+WHERE
+  {
+  ?artwork p:artist ?artist .
+  ?artwork p:museum ?museum .
+    ?museum p:director ?director
+  };
+
+artist                                          artwork                                              museum                                                                            director
+VARCHAR                                         VARCHAR                                              VARCHAR                                                                           VARCHAR
+_______________________________________________
+
+http://dbpedia.org/resource/Paul_C%C3%A9zanne   http://dbpedia.org/resource/The_Basket_of_Apples     http://dbpedia.org/resource/Art_Institute_of_Chicago                              James Cuno
+http://dbpedia.org/resource/Paul_Signac         http://dbpedia.org/resource/Neo-impressionism        http://dbpedia.org/resource/Art_Institute_of_Chicago                              James Cuno
+http://dbpedia.org/resource/Georges_Seurat      http://dbpedia.org/resource/Neo-impressionism        http://dbpedia.org/resource/Art_Institute_of_Chicago                              James Cuno
+http://dbpedia.org/resource/Edward_Hopper       http://dbpedia.org/resource/Nighthawks               http://dbpedia.org/resource/Art_Institute_of_Chicago                              James Cuno
+http://dbpedia.org/resource/Mary_Cassatt        http://dbpedia.org/resource/The_Child%27s_Bath       http://dbpedia.org/resource/Art_Institute_of_Chicago                              James Cuno
+..
+-- 303 rows
+
+SQL>SPARQL
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+SELECT ?s ?homepage
+FROM <http://dbpedia.org>
+WHERE
+  {
+   <http://dbpedia.org/resource/Berlin> geo:lat ?berlinLat .
+   <http://dbpedia.org/resource/Berlin> geo:long ?berlinLong .
+   ?s geo:lat ?lat .
+   ?s geo:long ?long .
+   ?s foaf:homepage ?homepage .
+   FILTER (
+     ?lat        <=     ?berlinLat + 0.03190235436 &&
+     ?long       >=     ?berlinLong - 0.08679199218 &&
+     ?lat        >=     ?berlinLat - 0.03190235436 &&
+     ?long       <=     ?berlinLong + 0.08679199218) };
 
-<programlisting><![CDATA[
-SQL> explain ('SPARQL prefix ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>
-SELECT *
-FROM <lubm>
-WHERE { ?x rdf:type ub:GraduateStudent }');
+s                                                                                 homepage
+VARCHAR                                                                           VARCHAR
+_______________________________________________________________________________
 
-REPORT
-VARCHAR
+http://dbpedia.org/resource/Berlin_University_of_the_Arts                         http://www.udk-berlin.de/
+http://dbpedia.org/resource/Berlin_University_of_the_Arts                         http://www.udk-berlin.de/
+http://dbpedia.org/resource/Berlin_Zoological_Garden                              http://www.zoo-berlin.de/en.html
+http://dbpedia.org/resource/Federal_Ministry_of_the_Interior_%28Germany%29        http://www.bmi.bund.de
+http://dbpedia.org/resource/Neues_Schauspielhaus                                  http://www.goya-berlin.com/
+http://dbpedia.org/resource/Bauhaus_Archive                                       http://www.bauhaus.de/english/index.htm
+http://dbpedia.org/resource/Canisius-Kolleg_Berlin                                http://www.canisius-kolleg.de
+http://dbpedia.org/resource/Franz%C3%B6sisches_Gymnasium_Berlin                   http://www.fg-berlin.cidsnet.de
+..
+-- 48 rows
+
+SQL>SPARQL
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX p: <http://dbpedia.org/property/>
+SELECT ?s ?a ?homepage
+FROM <http://dbpedia.org>
+WHERE
+  {
+   <http://dbpedia.org/resource/New_York_City> geo:lat ?nyLat .
+   <http://dbpedia.org/resource/New_York_City> geo:long ?nyLong .
+   ?s geo:lat ?lat .
+   ?s geo:long ?long .
+   ?s p:architect ?a .
+   ?a foaf:homepage ?homepage .
+   FILTER (
+     ?lat        <=     ?nyLat + 0.3190235436 &&
+     ?long       >=     ?nyLong - 0.8679199218 &&
+     ?lat        >=     ?nyLat - 0.3190235436 &&
+     ?long       <=     ?nyLong + 0.8679199218) };
+s                                                                                 a               homepage
+VARCHAR                                                                           VARCHAR              VARCHAR
 _______________________________________________________________________________
 
-{ 
- 
-Precode:
-      0: $25 "callret" := Call __BOX_FLAGS_TWEAK (<constant (lubm)>, <constant (1)>)
-      5: $26 "lubm" := Call DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE ($25 "callret")
-      12: $27 "callret" := Call __BOX_FLAGS_TWEAK (<constant (http://www.w3.org/1999/02/22-rdf-syntax-ns#type)>, <constant (1)>)
-      17: $28 "-ns#type" := Call DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE ($27 "callret")
-      24: $29 "callret" := Call __BOX_FLAGS_TWEAK (<constant (http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#GraduateStudent)>, <constant (1)>)
-      29: $30 "owl#GraduateStudent" := Call DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE ($29 "callret")
-      36: BReturn 0
-from DB.DBA.RDF_QUAD by RDF_QUAD_OGPS    1.9e+03 rows
-Key RDF_QUAD_OGPS  ASC ($32 "s-3-1-t0.S")
-<col=415 O = $30 "owl#GraduateStudent"> , <col=412 G = $26 "lubm"> , <col=414 P = $28 "-ns#type">
-row specs: <col=415 O LIKE <constant (T)>>
- 
-Current of: <$34 "<DB.DBA.RDF_QUAD s-3-1-t0>" spec 5>
- 
-After code:
-      0: $35 "x" := Call ID_TO_IRI ($32 "s-3-1-t0.S")
-      5: BReturn 0
-Select ($35 "x", <$34 "<DB.DBA.RDF_QUAD s-3-1-t0>" spec 5>)
-}
+http://dbpedia.org/resource/GE_Building                                           http://dbpedia.org/resource/Associated_Architects              http://www.associated-architects.co.uk
+http://dbpedia.org/resource/Giants_Stadium                                        http://dbpedia.org/resource/HNTB              http://www.hntb.com/
+http://dbpedia.org/resource/Fort_Tryon_Park_and_the_Cloisters                     http://dbpedia.org/resource/Frederick_Law_Olmsted              http://www.asla.org/land/061305/olmsted.html
+http://dbpedia.org/resource/Central_Park                                          http://dbpedia.org/resource/Frederick_Law_Olmsted              http://www.asla.org/land/061305/olmsted.html
+http://dbpedia.org/resource/Prospect_Park_%28Brooklyn%29                          http://dbpedia.org/resource/Frederick_Law_Olmsted              http://www.asla.org/land/061305/olmsted.html
+http://dbpedia.org/resource/Meadowlands_Stadium                                   http://dbpedia.org/resource/360_Architecture              http://oakland.athletics.mlb.com/oak/ballpark/new/faq.jsp
+http://dbpedia.org/resource/Citi_Field                                            http://dbpedia.org/resource/HOK_Sport_Venue_Event              http://www.hoksve.com/
+http://dbpedia.org/resource/Citigroup_Center                                      http://dbpedia.org/resource/Hugh_Stubbins_Jr.              http://www.klingstubbins.com
+http://dbpedia.org/resource/150_Greenwich_Street                                  http://dbpedia.org/resource/Fumihiko_Maki              http://www.pritzkerprize.com/maki2.htm
+http://dbpedia.org/resource/Freedom_Tower                                         http://dbpedia.org/resource/David_Childs              http://www.som.com/content.cfm/www_david_m_childs
+http://dbpedia.org/resource/7_World_Trade_Center                                  http://dbpedia.org/resource/David_Childs              http://www.som.com/content.cfm/www_david_m_childs
+http://dbpedia.org/resource/The_New_York_Times_Building                           http://dbpedia.org/resource/Renzo_Piano              http://www.rpbw.com/
+http://dbpedia.org/resource/Trump_World_Tower                                     http://dbpedia.org/resource/Costas_Kondylis              http://www.kondylis.com
 
-22 Rows. -- 1 msec.
+13 Rows. -- 2183 msec.
 ]]></programlisting>
-<para>
-This finds the graduate student instances in the lubm graph.  First
-the query converts the IRI literals to id's.  Then, using a match of
-OG on OGPS it finds the IRI's of the graduate students.  Then it
-converts the IRI id to return to the string form.</para>
-<para>The cardinality estimate of 1.9e+03 rows is on the FROM line.</para>
-<para>Doing an explain on the queries will show the cardinality estimates.  To drill down further, one can split the query into smaller chunks and see the estimates for these, up to doing it at the triple pattern level.  
-To indicate a variable that is bound but whose value is not a literal known at compile time, one can use the parameter marker <emphasis>??</emphasis>.</para>
-
+    </sect2>
+<sect2 id="rdfstorebenchmarks"><title>RDF Store Benchmarks</title>
+    <sect3 id="rdfstorebenchmarksintroduction"><title>Introduction</title>
+       <para>In a particular RDF Store Benchmarks there is difference if the queries are
+executed with specified graph or with specified multiple graphs. As Virtuoso is quad store,
+not triple store with many tables, it runs queries inefficiently if graphs are specified
+and there are no additional indexes except pre-set GSPO and OGPS. Proper use of the FROM clause
+or adding indexes with graph column will contribute for better results.
+       </para>
+    </sect3>
+    <sect3 id="rdfstorebenchmarksindexusage"><title>Using bitmap indexes</title>
+    <para>If is known in advance for the current RDF Store Benchmarks that some
+users will not indicate specific graphs then should be done: </para>
+    <itemizedlist>
+       <listitem>either create indexes with graph in last position</listitem>
+       <listitem>or load everything into single graph and specify it somewhere in querying application.</listitem>
+    </itemizedlist>
+    <para>Both methods do not require any changes in query texts</para>
+<itemizedlist mark="bullet">
+  <listitem>For users using Virtuoso 5 is strongly recommended is the usage of additional bitmap indexes:
 <programlisting><![CDATA[
-SQL>explain ('SPARQL define sql:table-option "order"  prefix ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>
-SELECT *
-FROM <lubm>
-WHERE { ?x rdf:type ?? }');
+SQL> create bitmap index RDF_QUAD_POGS on DB.DBA.RDF_QUAD (P,O,G,S);
+SQL> create bitmap index RDF_QUAD_PSOG on DB.DBA.RDF_QUAD (P,S,O,G);
 ]]></programlisting>
-
-<para>This will not know the type but will know that a type will be
-provided.  So instead of guessing 1900 matches, this will guess a
-smaller number, which is obviously less precise.  Thus literals are generally better.</para>
-<para>In some cases, generally to work around an optimization error, one can specify an explicit join order. 
-This is done with the sql:select-option "order"  clause in the SPARQL query prefix.</para>
-
+</listitem>
+  <listitem>For users using Virtuoso 6 or higher, see the new layout <link linkend="rdfperfrdfscheme">here</link>.</listitem>
+</itemizedlist>
+    <para>You can create other indexes as well. Bitmap indexes are preferable, but
+if O is the last column, then the index can not be bitmap, so it could be, for e.g.:</para>
 <programlisting><![CDATA[
-SQL>SELECT SPARQL_to_sql_text (' define sql:select-option "order" prefix ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>
-SELECT *
-FROM <lubm>
-WHERE
-  {
-    ?x rdf:type ub:GraduateStudent .
-    ?x ub:takesCourse <http://www.Department0.University0.edu/GraduateCourse0>
-  }');
+create index RDF_QUAD_PSGO on DB.DBA.RDF_QUAD (P, S, G, O);
 ]]></programlisting>
-
-<para>shows the SQL text with the order option at the end.</para>
-<para>If an estimate is radically wrong then this should be reported as a bug.</para>
-<para>If there is a FROM with a KEY on the next line and no column specs then this is a full table scan. The more columns are specified the less rows will be passed to the next operation in the chain. In the example above, there are three columns whose values are known before  reading the table and these columns are leading columns of the index in use so column specs are</para>
+    <para>but cannot be:</para>
 <programlisting><![CDATA[
-<col=415 O = $30 "owl#GraduateStudent"> , <col=412 G = $26 "lubm"> , <col=414 P = $28 "-ns#type">
+create bitmap index RDF_QUAD_PSGO on DB.DBA.RDF_QUAD (P, S, G, O);
 ]]></programlisting>
-<note><para>A KEY with only a row spec is a full table scan with the row spec applied as a filter.
-This is usually not good unless this is specifically intended.</para></note>
-<para>If queries are compiled to make full table scans when this is not specifically intended, this should be reported as a bug.
-The explain output and the query text should be included in the report.</para>
-<para>An explicit join order is specified by the <emphasis>define sql:select-option "order"</emphasis> clause in the SPARQL query prefix:
-Consider:</para>
-
+    </sect3>
+  </sect2>
+  <sect2 id="fastapproxdiffandpatch"><title>Fast Approximate RDF Graph Diff and Patch</title>
+<para>Two algorithms described below resemble "unified diff" and "patch by unified diff" 
+but they work on RDF graphs, not on plain texts.
+</para>
+<para>They work reasonably for graphs composed from CBDs (concise bounded descriptions) of 
+some subjects, if these subjects are either "named" IRIs or can be identified by values of 
+their inverse functional properties.
+</para>
+<para>Many sorts of commonly used graphs match these restrictions, including all graphs 
+without blank nodes, most of FOAF files, graphs that can be "pretty-printed" in JSON, most 
+of dumps of relational databases etc.
+</para>
+<para>The basic idea is as simple as zipper: 
+</para>
+<itemizedlist mark="bullet">
+  <listitem>Place one graph at the left and one to the right,</listitem>
+  <listitem>Find a retainer box at the right and a matching pin at the left,</listitem>
+  <listitem>Join them</listitem>
+  <listitem>Pull the slider as long as possible.</listitem>
+  <listitem>Repeat this while there are pins and boxes that can be matched and sliders that can be moved.</listitem>
+</itemizedlist>
+<para>An IRI in left graph <code>(say, G1)</code> matches to same IRI in right graph <code>(G2)</code> 
+as pin to box. The same is true for literals too.
+</para>
+<para>Functional and inverse functional properties are teeth that form chains, algorithm "moves sliders" along these chains, incrementally connecting more and more nodes.
+</para>
+<para>If there is a match of this sort <code>(O1 in G1 matches O2 in G2)</code> and the matched nodes 
+are values of same inverse functional property <code>P</code> (there are <code>{ S1 P O1 }</code> in 
+<code>G1</code> and <code>{ S2 P O2 }</code>  in <code>G2</code>) then we guess that <code>S1</code> 
+matches <code>S2</code>.
+</para>
+<para>If <code>S1</code> in <code>G1</code> matches <code>S2</code> in <code>G2</code> and the matched 
+nodes are subjects of same functional property <code>P</code> ( there are <code>{ S1 P N1 }</code> in 
+<code>G1</code> and <code>{ S2 P N2 }</code> in <code>G2</code> ) then we guess that <code>N1</code> 
+matches <code>N2</code>, now it's possible to try same interaction on triples where <code>N1</code> and 
+<code>N2</code> are in subject position, that's how slides move. A typical example of a long zipper 
+is closed list with matched heads.
+</para>
+<sect3 id="fastapproxdiffandpatchhow"><title>Make a Diff And Use It</title>
+<itemizedlist mark="bullet">
+  <listitem>Using <link linkend="fn_rdf_graph_diff">DB.DBA.RDF_GRAPH_DIFF</link></listitem>
+  <listitem>Using <link linkend="fn_rdf_suo_diff_ttl">DB.DBA.RDF_SUO_DIFF_TTL</link></listitem>
+  <listitem>Using <link linkend="fn_rdf_suo_apply_patch">DB.DBA.RDF_SUO_APPLY_PATCH</link></listitem>  
+</itemizedlist>
+</sect3>
+<sect3 id="fastapproxdiffandpatchclt"><title>Collect Functional And Inverse Functional Properties</title>
+<para>Lists of functional properties can be retrieved from an ontology graph by query like:</para>
 <programlisting><![CDATA[
-SQL>explain ('SPARQL define sql:select-option "order, loop" prefix ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>
-SELECT *
-FROM <lubm>
+SPARQL define output:valmode "LONG"
+SELECT (<LONG::sql:VECTOR_AGG(?s)) 
+FROM <my-ontology-graph>
+WHERE 
+  { 
+    ?s a owl:functionalProperty 
+  }
+]]></programlisting>
+<para>Inverse functional properties could be retrieved by a similar query, but unfortunately the 
+	ontology may mention so called NULL values that can be property values for many subjects. Current 
+	implementation of diff and patch does not recognize NULL values so they can cause patch with 
+	"false alarm" errors. The workaround is to retrieve only properties that have no NULL values declared:
+</para>
+<programlisting><![CDATA[
+SPARQL define output:valmode "LONG"
+SELECT (<LONG::sql:VECTOR_AGG(?s)) 
+FROM <my-ontology-graph>
 WHERE
   {
-    ?x ub:takesCourse ?c .
-    ?x rdf:type ub:GraduateStudent
-  }');
+    ?s a owl:inverseFunctionalProperty .
+    OPTIONAL { ?s owl:nullIFPValue ?v }
+    FILTER (!Bound(?v)) 
+  }
 ]]></programlisting>
-
-<para>One will see in the output that the first table access is to retrieve
-all in the lubm graph which take some course and then later to check
-if this is a graduate student.  This is obviously not the preferred
-order but the <emphasis>sql:select-option "order"</emphasis> forces the optimizer to join
-from left to right.</para>
-<para>It is very easy to end up with completely unworkable query plans in
-this manner but if the optimizer really is in error, then this is the
-only way of overriding its preferences. The effect of <emphasis>sql:select-option</emphasis> is pervasive, extending inside unions, optionals, subqueries etc within the statement.</para>
-<para>We note that if, in the above query, both the course taken by the
-student and the type of the student are given, the query compilation
-will be, at least for all non-cluster cases, an index intersection.
-This is not overridden by the sql:select-option clause since an index
-intersection is always a safe guess, regardless of the correctness of
-the cardinality guesses of the patterns involved.</para>
-</sect2>
-    <sect2 id="rdfperfloading"><title>Loading</title>
-	<para>There are many functions for loading RDF text, in RDF/XML and Turtle.</para>
-	<para>For loading RDF/XML, the best way is to split the data to be loaded into
-multiple streams and load these in parallel using <link linkend="fn_rdf_load_rdfxml"><function>RDF_LOAD_RDFXML ()</function></link>.
-To avoid running out of rollback space for large files and in order to have multiple concurrent loads not
-interfere with each other, the row autocommit mode should be enabled.</para>
-	<para>For example, </para>
+<para>If no ontology is available then appropriate predicates can be obtained from sample graphs using 
+	<link linkend="fn_rdf_graph_collect_fp_list">DB.DBA.RDF_GRAPH_COLLECT_FP_LIST</link>.
+</para>
+</sect3>
+<sect3 id="fastapproxdiffandpatchimpl"><title>Implementation-Specific Extensions of GUO Ontology</title>
+<para><emphasis>Note</emphasis>: This section contains implementation details that are needed only 
+if you want to write your own patch or diff procedure, you don't have to worry about internals if 
+you want to use existing procedures.
+</para>
+<para>Basic GUO ontology is not expressive enough to work with blank nodes, so some custom extensions $
+are needed.
+</para>
+<para>In the rest of the description:</para>
+<programlisting><![CDATA[
+ at prefix guo: <http://webr3.org/owl/guo#>
+]]></programlisting>
+<para>is assumed.</para>
+<para>The diff contains one node of <code>rdf:type guo:diff</code>.
+</para>
+<para>For debugging purpose it has properties <code>guo:graph1</code> and <code>guo:graph2</code> that 
+corespond to <code>gfrom</code> and <code>gto</code> arguments of <link linkend="fn_rdf_suo_diff_ttl">DB.DBA.RDF_SUO_DIFF_TTL</link>.
+</para>
+<para>The diff also contains zero or more nodes of <code>rdf:type guo:UpdateInstruction</code>. These 
+nodes are as described in basic GUO ontology, but <code>guo:target_graph</code> is now optional, 
+<code>guo:target_subject</code> can be a blank node and objects of predicates "inside" values of 
+<code>guo:insert</code> and <code>guo:delete</code> can also be blank nodes. These blank nodes are 
+"placeholders" for values, calculated according to the most important GUO extension - rule nodes.
+</para>
+<para>There are eight sorts of rule nodes, four for <code>gfrom</code> side of diff and four similar for 
+<code>gto</code> side. Out of four sorts related to one side, two are for functional properties and 
+two similar are for inverse functional properties. Thus <code>rdf:type-s</code> of these nodes are:
+</para>
+<programlisting><![CDATA[
+guo:from-rule-FP0, 
+guo:from-rule-FP1, 
+guo:from-rule-IFP0, 
+guo:from-rule-IFP1
+]]></programlisting>
+<para>and
+</para>
+<programlisting><![CDATA[
+guo:to-rule-FP0, 
+guo:to-rule-FP1, 
+guo:to-rule-IFP , 
+guo:to-rule-IFP1 .
+]]></programlisting>
+<para>Each rule node has property <code>guo:order</code> that is an non-negative integer.
+</para>
+<para>These integers enumerate all <code>guo:from-rule-</code>... nodes, starting from zero.
+</para>
+<para>When patch procedure works, these rules are used in this order, the result of each rule 
+	is a blank node that either exists in the graph or just created.
+</para>
+<para>All results are remembered for use in the rest of the patch procedure.
+</para>
+<para>Similarly, other sequence of these integers enumerate all <code>guo:to-rule-</code>... nodes, 
+also starting from zero.
+</para>
+<para>Consider a sequence of <code>guo:from-rule-</code>... nodes, because <code>guo:to-rule-</code> 
+nodes have identical properties.
+</para>
+<para>A rule node can have zero or more values of <code>guo:dep</code> property, each value is a 
+bnode that is rule node that should be calculated before the current one.
+</para>
+<para>Every rule has exactly one predicate <code>guo:path</code> that is a blank node. Each property 
+of this blank node describes one possible "move of slider": predicate to follow is in predicate 
+position and a node to start from is in object position. An IRI or a literal in object position is 
+used as is, a blank node in object position should be of type <code>guo:from-rule-</code>... and 
+have smaller <code>guo:order</code> so it refers to already calculated result bnode of some 
+preceding rule.
+</para>
+<para>Rule of form:
+</para>
+<programlisting><![CDATA[
+R a guo:from-rule-IFP1 ;
+  guo:path [ P1 O1 ; P2 O2 ; ... ; Pn On ] .
+]]></programlisting>
+<para>searches for a unique blank node <code>_:Rres</code> that is a common subject of triples:
+</para>
+<programlisting><![CDATA[
+ _:Rres P1 O1
+ _:Rres P2 O2
+  . . .
+ _:Rres Pn On
+]]></programlisting>
+<para>in the gfrom graph.
+</para>
+<para>If subjects differ in these triples or some triples are not found or the subject is not a 
+	blank node then an appropriate error is logged and rule fails, otherwise <code>_:Rres</code> 
+	is remembered as the result of the rule.
+</para>
+<para>Similarly, rule of form:
+</para>
+<programlisting><![CDATA[
+R a guo:from-rule-FP1 ;
+  guo:path [ P1 O1 ; P2 O2 ; ... ; Pn On ] .
+]]></programlisting>
+<para>searches for a unique blank node <code>_:Rres</code> that is a common object of triples:
+</para>
+<programlisting><![CDATA[
+ O1 P1 _:Rres
+ O2 P2 _:Rres
+  . . .
+ On Pn _:Rres
+]]></programlisting>
+<para>in the gfrom graph.
+</para>
+<para>Rule of form:
+</para>
+<programlisting><![CDATA[
+R a guo:from-rule-IFP0 ;
+  guo:path [ P1 O1 ; P2 O2 ; ... ; Pn On ] .
+]]></programlisting>
+<para>ensures that the <code>gfrom</code> graph does not contain any triple like:
+</para>
+<programlisting><![CDATA[
+ _:Rres P1 O1
+ _:Rres P2 O2
+]]></programlisting>
+<para>or
+</para>
+<programlisting><![CDATA[
+_:Rres Pn On
+]]></programlisting>
+<para>It is an error if something exists. If nothing found then the result of the rule is 
+	newly created unique blank node. That's how patch procedure creates new blank nodes when 
+	it inserts "totally new" data.
+</para>
+<para>Similarly, rule of form:
+</para>
+<programlisting><![CDATA[
+R a guo:from-rule-IFP0 ;
+  guo:path [ P1 O1 ; P2 O2 ; ... ; Pn On ] .
+]]></programlisting>
+<para>ensures that the <code>gfrom</code> graph does not contain any triple like:
+</para>
+<programlisting><![CDATA[
+O1 P1 _:Rres
+O2 P2 _:Rres
+]]></programlisting>
+<para>or
+</para>
 <programlisting><![CDATA[
-log_enable (2);
--- switch row-by-row autocommit on and logging off for this session
-DB.DBA.RDF_LOAD_RDFXML (file_to_string_output ('file.xml'), 'base_uri', 'target_graph');
--- more files here ...
-checkpoint;
+ On Pn _:Rres
 ]]></programlisting>
-<para>Loading a file with text like the above with isql will load the data. Since the transaction
-logging is off, make a manual checkpoint at the end to ensure that data is persisted upon server
-restart since there is no roll forward log.</para>
-<para>If large amounts of data are to be loaded, run multiple such streams in parallel. One may have
-for example 6 streams for 4 cores. This means that if up to two threads wait for disk, there is still work
-for all cores.</para>
-<para>Having substantially more threads than processors or disks is not particularly useful.</para>
-<para>There exist multithreaded load functions which will load one file on multiple threads. Experience
-shows that loading multiple files on one thread per file is better.</para>
-<para>For loading Turtle, some platforms may have a non-reentrant Turtle parser. This means that only
-one load may run at a time. One can try this by calling
-<link linkend="rdfapidataimport"><function>ttlp ()</function></link> from two sessions at the same time.
-If these do not execute concurrently, then the best way may be to try
-<link linkend="rdfapidataimport"><function>ttlp_mt</function></link> and see if this runs faster than
-a single threaded ttlp call.</para>
-
-       <sect3 id="rdfperfloadinglod"><title>Loading LOD RDF data</title>
-<para>To load the rdf data to LOD instance, perform the following steps:
+<para>Current version of patch procedure does not use rules <code>guo:to-rule-</code>...  , 
+however they can be used by custom procedure of few sorts. First, these rules can be used to 
+produce a "reversed diff". Next, these rules can be used to validate the result of the patch - 
+if the patch can not be reverted then the result is "suspicious". 
+</para>
+</sect3>
+</sect2>
+  <sect2 id="rdb2rdftriggers"><title>RDB2RDF Triggers</title>
+<para>RDF Views have many advantages, if compared to static dumps of the database in RDF triples. 
+	However, they does not solve few problems. First, inference is supported only for physically stored 
+	triples, so one had to chose between convenience of inference and convenience of RDF Views. Next, 
+	algorithms that selects triples with non-constant graphs and predicates tend to produce enormous 
+	texts of SQL queries if RDF Views are complicated enough. Finally, there may be a need in export 
+	of big and fresh static RDF dump but preparing this dump would take too much time via both RDF 
+	Views and traditional methods.
+</para>
+<para>The solution is set of triggers on source tables of an RDF View that edit parts of physical 
+	dump on each change of source data. Unlike RDF Views that cost nothing while not queried, these 
+	triggers add a significant overhead on any data manipulation on sources, continuously. To 
+	compensate this, the dump should be in an intensive use and not replaceable by RDF Views. In 
+	other cases, do not add these triggers.
+</para>
+<para>It is next to impossible to write such triggers by hands so a small API is provided to 
+	generate SQL texts from metadata of RDF Views.
+</para>
+<para>First of all, views in an RDF storage does not work in full isolation from each other. 
+	Some of them may partially disable others due to OPTION(EXCLUSIVE) and some may produce one 
+	triple in different ways. As a result, triggers are not made on per-view basis. Instead, a 
+	special RDF storage is introduced, namely virtrdf:SyncToQuads , all required triples are 
+	added to it and triggers are created for the whole storage. Typically an RDF View is created 
+	in some other storage, e.g., virtrdf:DefaultQuadStorage and then added to virtrdf:SyncToQuads via:
 </para>
-<itemizedlist mark="bullet">
-  <listitem>Configure & start cluster</listitem>
-  <listitem>Execute the file:
 <programlisting><![CDATA[
---
---  $Id: rdfandsparql.xml,v 1.95.2.36 2010/07/08 15:18:23 source Exp $
---
---  Alternate RDF index scheme for cases where G unspecified
---
---  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
---  project.
---
---  Copyright (C) 1998-2009 OpenLink Software
---
---  This project is free software; you can redistribute it and/or modify it
---  under the terms of the GNU General Public License as published by the
---  Free Software Foundation; only version 2 of the License, dated June 1991.
---
---  This program is distributed in the hope that it will be useful, but
---  WITHOUT ANY WARRANTY; without even the implied warranty of
---  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
---  General Public License for more details.
---
---  You should have received a copy of the GNU General Public License along
---  with this program; if not, write to the Free Software Foundation, Inc.,
---  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
---
---
-
-drop index RDF_QUAD_OGPS;
-checkpoint;
-create table R2 (G iri_id_8, S iri_id_8, P iri_id_8, O any, primary key (S, P, O, G))
-alter index R2 on R2 partition (S int (0hexffff00));
-
-log_enable (2);
-insert into R2 (G, S, P, O) SELECT G, S, P, O from rdf_quad;
-
-drop table RDF_QUAD;
-alter table r2 rename RDF_QUAD;
-checkpoint;
-create bitmap index RDF_QUAD_OPGS on RDF_QUAD (O, P, G, S) partition (O varchar (-1, 0hexffff));
-create bitmap index RDF_QUAD_POGS on RDF_QUAD (P, O, G, S) partition (O varchar (-1, 0hexffff));
-create bitmap index RDF_QUAD_GPOS on RDF_QUAD (G, P, O, S) partition (O varchar (-1, 0hexffff));
-
-checkpoint;
+sparql alter quad storage virtrdf:SyncToQuads {
+   create <my_rdf_view> using storage virtrdf:DefaultQuadStorage };
 ]]></programlisting>
-</listitem>
-  <listitem>Execute the file:
+<para>The following example procedure copies all user-defined RDF Views from default quad storage 
+	to virtrdf:SyncToQuads:
+</para>
 <programlisting><![CDATA[
-
-
-create table load_list (
-  ll_file varchar,
-  ll_graph varchar,
-  ll_state int default 0, -- 0 not started, 1 going, 2 done
-  ll_started datetime,
-  ll_done datetime,
-  ll_host int,
-  ll_work_time integer,
-  ll_error varchar,
-  primary key (ll_file))
-alter index load_list on load_list partition (ll_file varchar)
+create procedure DB.DBA.RDB2RDF_COPY_ALL_RDF_VIEWS_TO_SYNC ()
+{
+  for (sparql define input:storage ""
+    select (bif:aref(bif:sprintf_inverse (str(?idx), bif:concat (str(rdf:_), "%d"), 0), 0)) ?qm
+    from virtrdf:
+    where { virtrdf:DefaultQuadStorage-UserMaps ?idx ?qm . ?qm a virtrdf:QuadMap }
+    order by asc (bif:sprintf_inverse (bif:concat (str(rdf:_), "%d"), str (?idx), 1)) ) do
+    exec (sprintf ('sparql alter quad storage virtrdf:SyncToQuads { create <%s> using storage virtrdf:DefaultQuadStorage }', "qm"));
+}
 ;
-
-create index ll_state on load_list (ll_state, ll_file, ll_graph) partition (ll_state int)
+]]></programlisting>
+<para>When the virtrdf:SyncToQuads storage is fully prepared, two API functions can be used:
+</para>
+<itemizedlist mark="bullet">
+  <listitem><link linkend="fn_sparql_rdb2rdf_list_tables">DB.DBA.SPARQL_RDB2RDF_LIST_TABLES</link>: 
+  The function returns a vector of names of tables that are used as sources for RDF Views. Application 
+  developer should decide what to do with each of them - create triggers or do some application-specific 
+  workarounds.
+  <para>Note that if some SQL views are used as sources for RDF Views and these views does not have 
+  	INSTEAD triggers then workarounds become mandatory for them, not just a choice, because BEFORE 
+  	or AFTER triggers on views are not allowed if there is no appropriate INSTEAD trigger. The mode 
+  	argument should be zero in current version.
+  </para>
+  </listitem>
+  <listitem><link linkend="fn_sparql_rdb2rdf_codegen">DB.DBA.SPARQL_RDB2RDF_CODEGEN</link>: The 
+  function creates an SQL text for a given table and an operation specified by an opcode.
+  </listitem>
+</itemizedlist>
+<para>In some cases, RDF Views are complicated enough so that BEFORE UPDATE and AFTER DELETE 
+	triggers are required in additional to the minimal set. In this case, sparql_rdb2rdf_codegen 
+	calls will return a vector of two string sessions, not single string session, and both sessions 
+	are sql texts to inspect or execute. In this case, the BEFORE trigger will not delete obsolete 
+	quads from RDF_QUAD table, instead it will create records in a special table RDF_QUAD_DELETE_QUEUE 
+	as guesses what can be deleted. The AFTER trigger will re-check these guesses, delete related quads 
+	if needed and shorten the RDF_QUAD_DELETE_QUEUE.
+</para>
+<para>The extra activity of triggers on RDF_QUAD, RDF_OBJ, RDF_QUAD_DELETE_QUEUE and other tables 
+	and indexes of the storage of "physical" triples may cause deadlocks so the application should 
+	be carefully checked for proper support of deadlocks if they were very seldom before turning 
+	RDB2RDF triggers on. In some cases, the whole processing of RDB2RDF can be moved to a separate 
+	server and connected to the main workhorse server via replication.
+</para>
+<para>The following example functions create texts of all triggers, save them to files in for 
+	further studying and try to load them. That's probably quite bad scenario for a production 
+	database, because it's better to read procedures before loading them, especially if they're 
+	triggers, especially if some of them may contain errors.
+</para>
+<programlisting><![CDATA[
+-- This creates one or two files with one or two triggers or other texts and try to load the 
+generated sql texts.
+create procedure DB.DBA.RDB2RDF_EXEC_CODEGEN1_FOR_TABLE 
+(  in dump_prefix varchar, 
+   in tbl varchar, 
+   in dump_id any, 
+   in txt any )
+{
+  declare fname varchar;
+  declare stat, msg varchar;
+  if (isinteger (dump_id))
+    dump_id := cast (dump_id as varchar);
+  if (__tag of vector = __tag (txt))
+    {
+      DB.DBA.RDB2RDF_EXEC_CODEGEN1_FOR_TABLE (dump_prefix, tbl, dump_id, txt[0]);
+      DB.DBA.RDB2RDF_EXEC_CODEGEN1_FOR_TABLE (dump_prefix, tbl, dump_id || 'p' , txt[1]);
+      return;
+    }
+  if (__tag of varchar <> __tag (txt))
+    txt := string_output_string (txt);
+  fname := sprintf ('%s_Rdb2Rdf.%s.%s.sql', dump_prefix, tbl, dump_id);
+  string_to_file (fname, txt || '\n;\n', -2);
+  if ('0' = dump_id)
+    return;
+  stat := '00000';
+  msg := '';
+  exec (txt, stat, msg);
+  if ('00000' <> stat)
+    {
+      string_to_file (fname, '\n\n- - - - - 8< - - - - -\n\nError ' || stat || ' ' || msg, -1);
+      if (not (subseq (msg, 0, 5) in ('SQ091')))
+        signal (stat, msg);
+    }
+}
 ;
 
+-- This creates and loads all triggers, init procedure and debug dump related to one table.
+create procedure DB.DBA.RDB2RDF_PREPARE_TABLE (in dump_prefix varchar, in tbl varchar)
+{
+  declare ctr integer;
+  for (ctr := 0; ctr <= 4; ctr := ctr+1 )
+    DB.DBA.RDB2RDF_EXEC_CODEGEN1_FOR_TABLE (dump_prefix, tbl, ctr, sparql_rdb2rdf_codegen (tbl, ctr));
+}
+;
 
-create table ldlock (id int primary key)
-  alter index ldlock on ldlock partition (id int)
+-- This creates and loads all triggers, init procedure and debug dump related to all tables used by and RDF View.
+create procedure DB.DBA.RDB2RDF_PREPARE_ALL_TABLES (in dump_prefix varchar)
+{
+  declare tbl_list any;
+  tbl_list := sparql_rdb2rdf_list_tables (0);
+  foreach (varchar tbl in tbl_list) do
+    {
+      DB.DBA.RDB2RDF_PREPARE_TABLE (dump_prefix, tbl);
+    }
+}
 ;
+]]></programlisting>
+<para>The following combination of calls prepares all triggers for all RDF Views of the default storage:
+</para>
+<programlisting><![CDATA[
+DB.DBA.RDB2RDF_COPY_ALL_RDF_VIEWS_TO_SYNC ();
+DB.DBA.RDB2RDF_PREPARE_ALL_TABLES (cast (now() as varchar));
+]]></programlisting>
+<para>This does not copy the initial state of RDB2RDF graphs to the physical storage, because this can 
+	be dangerous for existing RDF data and even if all procedures will work as expected then they may 
+	produce huge amounts of RDF data, run out of transaction log limits and thus require 
+	application-specific precautions. It is also possible to make initial loading by a SPARUL statements 
+	like:
+</para>
+<programlisting><![CDATA[
+SPARQL 
+INSERT IN <snapshot-graph> { ?s ?p ?o } 
+FROM <snapshot-htaph> 
+WHERE 
+ { quad map <id-of-rdf-view> 
+ 	  { ?s ?p ?o } 
+ };
+]]></programlisting>
+</sect2>  
+</sect1>
 
-insert into ldlock values (0);
 
 
-create procedure
-ld_dir (in path varchar, in mask varchar, in graph varchar)
-{
-  declare ls any;
-  declare inx int;
-  ls := sys_dirlist (path, 1);
-  for (inx := 0; inx < length (ls); inx := inx + 1)
-    {
-      if (ls[inx] like mask)
-	{
-	  set isolation = 'serializable';
+<sect1 id="rdfnativestorageproviders"><title>RDF Data Access Providers (Drivers)</title>
+  <sect2 id="rdfnativestorageprovidersjena"><title>Virtuoso Jena Provider</title>
+    <sect3 id="rdfnativestorageprovidersjenawhatis"><title>What is Jena</title>
+    <para>Jena is an open source Semantic Web framework for Java. It provides an API to
+extract data from and write to RDF graphs. The graphs are represented as an abstract "model".
+A model can be sourced with data from files, databases, URIs or a combination of these. A Model
+can also be queried through SPARQL and updated through SPARUL.
+    </para>
+    </sect3>
+    <sect3 id="rdfnativestorageprovidersjenawhatisv"><title>What is the Virtuoso Jena Provider</title>
+    <para>The Virtuoso Jena RDF Data Provider is a fully operational Native Graph Model Storage
+Provider for the Jena Framework, enables Semantic Web applications written using the Jena RDF
+Frameworks to query the Virtuoso RDF Quad store directly. The Provider has been tested against
+the <ulink url="http://jena.sourceforge.net/">Jena 2.5.5</ulink> version currently available.
+    </para>
+    <figure id="rdfnativestorageprovidersjena1" float="1">
+      <title>Virtuoso Jena RDF Data Provider</title>
+      <graphic fileref="ui/VirtJenaProvider.png"/>
+    </figure>
+    </sect3>
+    <sect3 id="rdfnativestorageprovidersjenasetup"><title>Setup</title>
+    <sect4 id="rdfnativestorageprovidersjenareqfiles"><title>Required Files</title>
+    <itemizedlist mark="bullet">
+      <listitem>Virtuoso Jena Provider JAR file, <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VirtJenaProvider/virt_jena.jar">virt_jena.jar</ulink></listitem>
+      <listitem>Virtuoso JDBC Driver JAR file, <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VirtJenaProvider/virtjdbc3.jar">virtjdbc3.jar</ulink></listitem>
+      <listitem>Jena Framework and associated classes, <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VirtJenaProvider/jenajars.zip">jenajars.zip</ulink></listitem>
+      <listitem>Sample programs, <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VirtJenaProvider/virtjenasamples.zip">virtjenasamples.zip</ulink></listitem>
+    </itemizedlist>
+    </sect4>
+    <sect4 id="rdfnativestorageprovidersjenacmsmpr"><title>Compiling Jena Sample Programs</title>
+    <orderedlist>
+      <listitem>Edit the sample programs VirtuosoSPARQLExampleX.java, where X = 1 to 9.
+Set the JDBC connection strings within to point to a valid Virtuoso Server instance of the form:
+<programlisting><![CDATA[
+"jdbc:virtuoso://localhost:1111/charset=UTF-8/log_enable=2"
+]]></programlisting>
+      <itemizedlist>
+         <listitem>charset=UTF-8  will be added by Jena provider, if it isn't in connection string.
+So now you don't need add "charset=UTF-8" to the connection string any more, it is done by Jena provider.
 
-	  if (not (exists (SELECT 1 FROM DB.DBA.LOAD_LIST WHERE LL_FILE = path || '/' || ls[inx] for update)))
-	    {
-	      declare gfile, cgfile, ngraph varchar;
-	      gfile := path || '/' || replace (ls[inx], '.gz', '') || '.graph';
-	      cgfile := path || '/' || regexp_replace (replace (ls[inx], '.gz', ''), '\\-[0-9]+\\.n', '.n') || '.graph';
-	      if (file_stat (gfile) <> 0)
-		ngraph := trim (file_to_string (gfile), ' \r\n');
-              else if (file_stat (cgfile) <> 0)
-		ngraph := trim (file_to_string (cgfile), ' \r\n');
-	      else if (file_stat (path || '/' || 'global.graph') <> 0)
-		ngraph := trim (file_to_string (path || '/' || 'global.graph'), ' \r\n');
-	      else
-	        ngraph := graph;
-              if (ngraph is not null)
-                {
-		  insert into DB.DBA.LOAD_LIST (ll_file, ll_graph) values (path || '/' || ls[inx], ngraph);
-		}
-	    }
+         </listitem>
+         <listitem>log_enable=2: to use row auto commit
+         </listitem>
+         <listitem>use these settings to process large rdf data.
+         </listitem>
+      </itemizedlist>
+      </listitem>
+      <listitem>Ensure that full paths to <emphasis>jena.jar, arq.jar,</emphasis> and
+<emphasis>virtjdbc3.jar</emphasis> are included in the active CLASSPATH setting.
+      </listitem>
+      <listitem>Compile the Jena Sample applications using the following command:
+<programlisting><![CDATA[
+javac -cp "jena.jar:arq.jar:virtjdbc3.jar:virt_jena.jar:." VirtuosoSPARQLExample1.java
+VirtuosoSPARQLExample2.java VirtuosoSPARQLExample3.java VirtuosoSPARQLExample4.java
+VirtuosoSPARQLExample5.java VirtuosoSPARQLExample6.java VirtuosoSPARQLExample7.java
+VirtuosoSPARQLExample8.java VirtuosoSPARQLExample9.java
+]]></programlisting>
+      </listitem>
+    </orderedlist>
+    </sect4>
+    <sect4 id="rdfnativestorageprovidersjenatesting"><title>Testing</title>
+    <para>Once the Provider classes and sample program have been successfully compiled,
+the Provider can be tested using the sample programs included. Ensure your active CLASSPATH
+includes full paths to all of the following files, before executing the example commands:
+    </para>
+    <itemizedlist mark="bullet">
+      <listitem>icu4j_3_4.jar</listitem>
+      <listitem>iri.jar</listitem>
+      <listitem>xercesImpl.jar</listitem>
+      <listitem>axis.jar</listitem>
+      <listitem>commons-logging-1.1.1.jar</listitem>
+      <listitem>jena.jar</listitem>
+      <listitem>arq.jar</listitem>
+      <listitem>virtjdbc3.jar</listitem>
+      <listitem>virt_jena.jar</listitem>
+    </itemizedlist>
+    <orderedlist>
+      <listitem><link linkend="rdfnativestorageprovidersjenaexamples1">VirtuosoSPARQLExample1</link> returns the contents of the RDF Quad store of the targeted Virtuoso instance, with the following command:
+<programlisting><![CDATA[
+java VirtuosoSPARQLExample1
+]]></programlisting>
+      </listitem>
+      <listitem><link linkend="rdfnativestorageprovidersjenaexamples2">VirtuosoSPARQLExample2</link> reads in the contents of the following FOAF URIs --
+<programlisting><![CDATA[
+http://kidehen.idehen.net/dataspace/person/kidehen#this
+http://www.w3.org/People/Berners-Lee/card#i
+http://demo.openlinksw.com/dataspace/person/demo#this
+]]></programlisting>
+      <para>-- and returns the RDF data stored, with the following command:</para>
+<programlisting><![CDATA[
+java VirtuosoSPARQLExample2
+]]></programlisting>
+      </listitem>
+      <listitem><link linkend="rdfnativestorageprovidersjenaexamples3">VirtuosoSPARQLExample3</link> performs simple addition and deletion operation on
+the content of the triple store, with the following command:
+<programlisting><![CDATA[
+java VirtuosoSPARQLExample3
+]]></programlisting>
+      </listitem>
+      <listitem><link linkend="rdfnativestorageprovidersjenaexamples4">VirtuosoSPARQLExample4</link> demonstrates the use of the <emphasis>graph.contains</emphasis> method for searching triples, with the following command:
+<programlisting><![CDATA[
+java VirtuosoSPARQLExample4
+]]></programlisting>
+</listitem>
+      <listitem><link linkend="rdfnativestorageprovidersjenaexamples5">VirtuosoSPARQLExample5</link> demonstrates the use of the <emphasis>graph.find</emphasis> method for searching triples, with the following command:
+<programlisting><![CDATA[
+java VirtuosoSPARQLExample5
+]]></programlisting>
+      </listitem>
+      <listitem><link linkend="rdfnativestorageprovidersjenaexamples6">VirtuosoSPARQLExample6</link> demonstrates the use of the <emphasis>graph.getTransactionHandler</emphasis> method, with the following command:
+<programlisting><![CDATA[
+java VirtuosoSPARQLExample6
+]]></programlisting>
+      </listitem>
+      <listitem><link linkend="rdfnativestorageprovidersjenaexamples7">VirtuosoSPARQLExample7</link> demonstrates the use of the graph.getBulkUpdateHandler method, with the following command:
+<programlisting><![CDATA[
+java VirtuosoSPARQLExample7
+]]></programlisting>
+      </listitem>
+      <listitem><link linkend="rdfnativestorageprovidersjenaexamples8">VirtuosoSPARQLExample8</link> demonstrates how to insert triples into a graph, with the following command:
+<programlisting><![CDATA[
+java VirtuosoSPARQLExample8
+]]></programlisting>
+      </listitem>
+      <listitem><link linkend="rdfnativestorageprovidersjenaexamples9">VirtuosoSPARQLExample9</link> demonstrates the use of the <emphasis>CONSTRUCT, DESCRIBE,</emphasis> and <emphasis>ASK</emphasis> SPARQL query forms, with the following command:
+<programlisting><![CDATA[
+java VirtuosoSPARQLExample9
+]]></programlisting>
+     </listitem>
+    </orderedlist>
+    </sect4>
+    </sect3>
+    <sect3 id="rdfnativestorageprovidersjenaexamples"><title>Examples</title>
+    <sect4 id="rdfnativestorageprovidersjenaexamples1"><title>VirtJenaSPARQLExample1</title>
+<programlisting><![CDATA[
+import com.hp.hpl.jena.query.*;
+import com.hp.hpl.jena.rdf.model.RDFNode;
 
-	  commit work;
-	}
-    }
-}
-;
+import virtuoso.jena.driver.*;
 
-create procedure
-ld_dir_all (in path varchar, in mask varchar, in graph varchar)
-{
-  declare ls any;
-  declare inx int;
-  ls := sys_dirlist (path, 0);
-  ld_dir (path, mask, graph);
-  for (inx := 0; inx < length (ls); inx := inx + 1)
-    {
-      if (ls[inx] <> '.' and ls[inx] <> '..')
-	{
-	  ld_dir_all (path||'/'||ls[inx], mask, graph);
-	}
-    }
-}
-;
+public class VirtuosoSPARQLExample1 {
 
-create procedure
-ld_add (in _fname varchar, in _graph varchar)
-{
-  --log_message (sprintf ('ld_add: %s, %s', _fname, _graph));
+	/**
+	 * Executes a SPARQL query against a virtuoso url and prints results.
+	 */
+	public static void main(String[] args) {
 
-  set isolation = 'serializable';
+		String url;
+		if(args.length == 0)
+		    url = "jdbc:virtuoso://localhost:1111";
+		else
+		    url = args[0];
 
-  if (not (exists (SELECT 1 FROM DB.DBA.LOAD_LIST WHERE LL_FILE = _fname for update)))
-    {
-      insert into DB.DBA.LOAD_LIST (LL_FILE, LL_GRAPH) values (_fname, _graph);
-    }
-  commit work;
-}
-;
+/*			STEP 1			*/
+		VirtGraph set = new VirtGraph (url, "dba", "dba");
 
-create procedure ld_ttlp_flags (in fname varchar)
-{
-  if (fname like '%/btc-2009%' or fname like '%.nq%')
-    return 255 + 512;
-  return 255;
-}
+/*			STEP 2			*/
 
-create procedure
-ld_file (in f varchar, in graph varchar)
-{
-  declare gzip_name varchar;
-  declare exit handler for sqlstate '*' {
-    rollback work;
-    UPDATE DB.DBA.LOAD_LIST
-      SET LL_STATE = 2,
-          LL_DONE = curdatetime (),
-          LL_ERROR = __sql_state || ' ' || __sql_message
-      WHERE LL_FILE = f;
-    commit work;
 
-    log_message (sprintf (' File %s error %s %s', f, __sql_state, __sql_message));
-    return;
-  };
+/*			STEP 3			*/
+/*		Select all data in virtuoso	*/
+		Query sparql = QueryFactory.create("SELECT * WHERE { GRAPH ?graph { ?s ?p ?o } } limit 100");
 
-  if (f like '%.grdf' or f like '%.grdf.gz')
-    {
-      load_grdf (f);
-    }
-  else if (f like '%.gz')
-    {
-      gzip_name := regexp_replace (f, '\.gz\x24', '');
-      if (gzip_name like '%.xml' or gzip_name like '%.owl' or gzip_name like '%.rdf')
-	DB.DBA.RDF_LOAD_RDFXML (gz_file_open (f), graph, graph);
-      else if  (gzip_name like '%.n4')
-	TTLP (gz_file_open (f), graph, graph, 512 + 255);
-      else
-	TTLP (gz_file_open (f), graph, graph, ld_ttlp_flags (f));
-    }
-  else
-    {
-      if (f like '%.xml' or f like '%.owl' or f like '%.rdf')
-	DB.DBA.RDF_LOAD_RDFXML (file_open (f), graph, graph);
-      else if  (f like '%.n4')
-	TTLP (file_open (f), graph, graph, 512 + 255);
-      else
-	TTLP (file_open (f), graph, graph, ld_ttlp_flags (f));
-    }
+/*			STEP 4			*/
+		VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
 
-  --log_message (sprintf ('loaded %s', f));
+		ResultSet results = vqe.execSelect();
+		while (results.hasNext()) {
+			QuerySolution result = results.nextSolution();
+		    RDFNode graph = result.get("graph");
+		    RDFNode s = result.get("s");
+		    RDFNode p = result.get("p");
+		    RDFNode o = result.get("o");
+		    System.out.println(graph + " { " + s + " " + p + " " + o + " . }");
+		}
+	}
 }
-;
 
-create procedure
-rdf_load_dir (in path varchar,
-              in mask varchar := '%.nt',
-              in graph varchar := 'http://dbpedia.org')
-{
-
-  DELETE FROM DB.DBA.LOAD_LIST WHERE LL_FILE = '##stop';
-  commit work;
+]]></programlisting>
+    </sect4>
+    <sect4 id="rdfnativestorageprovidersjenaexamples2"><title>VirtJenaSPARQLExample2</title>
+<programlisting><![CDATA[
+import com.hp.hpl.jena.query.*;
+import com.hp.hpl.jena.rdf.model.RDFNode;
 
-  ld_dir (path, mask, graph);
+import virtuoso.jena.driver.*;
 
-  rdf_loader_run ();
-}
-;
+public class VirtuosoSPARQLExample2 {
 
+	/**
+	 * Executes a SPARQL query against a virtuoso url and prints results.
+	 */
+	public static void main(String[] args) {
 
-create procedure ld_array ()
-{
-  declare first, last, arr, len, local any;
-  declare cr cursor for
-      SELECT top 100 LL_FILE, LL_GRAPH
-        FROM DB.DBA.LOAD_LIST table option (index ll_state)
-        WHERE LL_STATE = 0
-	for update;
-  declare fill int;
-  declare f, g varchar;
-  declare r any;
-  whenever not found goto done;
-  first := 0;
-  last := 0;
- arr := make_array (100, 'any');
-  fill := 0;
-  open cr;
-  len := 0;
-  for (;;)
-    {
-      fetch cr into f, g;
-      if (0 = first) first := f;
-      last := f;
-      arr[fill] := vector (f, g);
-    len := len + cast (file_stat (f, 1) as int);
-      fill := fill + 1;
-      if (len > 2000000)
-	goto done;
-    }
- done:
-  if (0 = first)
-    return 0;
-  if (1 <> sys_stat ('cl_run_local_only'))
-    local := sys_stat ('cl_this_host');
-  UPDATE load_list set ll_state = 1, ll_started = curdatetime (), LL_HOST = local
-    WHERE ll_file >= first and ll_file <= last;
-  return arr;
-}
-;
+		String url;
+		if(args.length == 0)
+		    url = "jdbc:virtuoso://localhost:1111";
+		else
+		    url = args[0];
 
-create procedure
-rdf_loader_run (in max_files integer := null, in log_enable int := 2)
-{
-  declare sec_delay float;
-  declare _f, _graph varchar;
-  declare arr any;
-  declare xx, inx, tx_mode, ld_mode int;
-  ld_mode := log_enable;
-  if (0 = sys_stat ('cl_run_local_only'))
-    {
-      if (log_enable = 2 and cl_this_host () = 1)
-	{
-	  cl_exec ('checkpoint_interval (0)');
-	  cl_exec ('__dbf_set (''cl_non_logged_write_mode'', 1)');
-	}
-      if (cl_this_host () = 1)
-	cl_exec('__dbf_set(''cl_max_keep_alives_missed'',3000)');
-    }
-  tx_mode := bit_and (1, log_enable);
-  log_message ('Loader started');
+/*			STEP 1			*/
+		VirtGraph graph = new VirtGraph ("Example2", url, "dba", "dba");
 
-  DELETE FROM DB.DBA.LOAD_LIST WHERE LL_FILE = '##stop';
-  commit work;
+/*			STEP 2			*/
+/*		Load data to Virtuoso		*/
+		graph.clear ();
 
-  while (1)
-    {
-      set isolation = 'repeatable';
-      declare exit handler for sqlstate '40001' {
-	rollback work;
-        sec_delay := rnd(1000)*0.001;
-	log_message(sprintf('deadlock in loader, waiting %d milliseconds', cast (sec_delay * 1000 as integer)));
-	delay(sec_delay);
-	goto again;
-      };
+		System.out.print ("Begin read from 'http://www.w3.org/People/Berners-Lee/card#i'  ");
+		graph.read("http://www.w3.org/People/Berners-Lee/card#i", "RDF/XML");
+		System.out.println ("\t\t\t Done.");
 
-     again:;
+		System.out.print ("Begin read from 'http://demo.openlinksw.com/dataspace/person/demo#this'  ");
+		graph.read("http://demo.openlinksw.com/dataspace/person/demo#this", "RDF/XML");
+		System.out.println ("\t Done.");
 
-      if (exists (SELECT 1 FROM DB.DBA.LOAD_LIST WHERE LL_FILE = '##stop'))
-	{
-	  log_message ('File load stopped by rdf_load_stop.');
-	  return;
-	}
+		System.out.print ("Begin read from 'http://kidehen.idehen.net/dataspace/person/kidehen#this'  ");
+		graph.read("http://kidehen.idehen.net/dataspace/person/kidehen#this", "RDF/XML");
+		System.out.println ("\t Done.");
 
-      log_enable (tx_mode, 1);
 
-      if (max_files is not null and max_files <= 0)
-        {
-	  commit work;
-	  log_message ('Max_files reached. Finishing.');
-          return;
-	}
+/*			STEP 3			*/
+/*		Select only from VirtGraph	*/
+		Query sparql = QueryFactory.create("SELECT ?s ?p ?o WHERE { ?s ?p ?o }");
 
-      whenever not found goto looks_empty;
+/*			STEP 4			*/
+		VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, graph);
 
-      --      log_message ('Getting next file.');
-      set isolation = 'serializable';
-      SELECT id into xx FROM ldlock WHERE id = 0 for update;
-      arr := ld_array ();
-      commit work;
-      if (0 = arr)
-	goto looks_empty;
-      log_enable (ld_mode, 1);
+		ResultSet results = vqe.execSelect();
+		while (results.hasNext()) {
+			QuerySolution result = results.nextSolution();
+		    RDFNode graph_name = result.get("graph");
+		    RDFNode s = result.get("s");
+		    RDFNode p = result.get("p");
+		    RDFNode o = result.get("o");
+		    System.out.println(graph_name + " { " + s + " " + p + " " + o + " . }");
+		}
 
-      for (inx := 0; inx < 100; inx := inx + 1)
-	{
-	  if (0 = arr[inx])
-	    goto arr_done;
-	  ld_file (arr[inx][0], arr[inx][1]);
-	  UPDATE DB.DBA.LOAD_LIST set LL_STATE = 2, LL_DONE = curdatetime () WHERE LL_FILE = arr[inx][0];
+		System.out.println("graph.getCount() = " + graph.getCount());
 	}
-    arr_done:
-      log_enable (tx_mode, 1);
+}
+]]></programlisting>
+    </sect4>
+    <sect4 id="rdfnativestorageprovidersjenaexamples3"><title>VirtJenaSPARQLExample3</title>
+<programlisting><![CDATA[
+import java.util.*;
 
+import com.hp.hpl.jena.query.*;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
 
-      if (max_files is not null) max_files := max_files - 100;
+import virtuoso.jena.driver.*;
 
-      commit work;
-    }
+public class VirtuosoSPARQLExample3
+{
+    public static void main(String[] args)
+    {
+	String url;
 
- looks_empty:
-  commit work;
-  log_message ('No more files to load. Loader has finished,');
-  return;
+	if(args.length == 0)
+	    url = "jdbc:virtuoso://localhost:1111";
+	else
+	    url = args[0];
 
-}
-;
+	Node foo1 = Node.createURI("http://example.org/#foo1");
+	Node bar1 = Node.createURI("http://example.org/#bar1");
+	Node baz1 = Node.createURI("http://example.org/#baz1");
 
-create procedure rdf_load_stop (in force int := 0)
-{
-  insert into DB.DBA.LOAD_LIST (LL_FILE) values ('##stop');
-  commit work;
-  if (force)
-    cl_exec ('txn_killall (1)');
-}
-;
+	Node foo2 = Node.createURI("http://example.org/#foo2");
+	Node bar2 = Node.createURI("http://example.org/#bar2");
+	Node baz2 = Node.createURI("http://example.org/#baz2");
 
+	Node foo3 = Node.createURI("http://example.org/#foo3");
+	Node bar3 = Node.createURI("http://example.org/#bar3");
+	Node baz3 = Node.createURI("http://example.org/#baz3");
 
-create procedure RDF_LOADER_RUN_1 (in x int, in y int)
-{
-  rdf_loader_run (x, y);
-}
-;
+	List <Triple> triples = new ArrayList <Triple> ();
 
-create procedure rdf_ld_srv (in log_enable int)
-{
-  declare aq any;
-  aq := async_queue (1);
-  aq_request (aq, 'DB.DBA.RDF_LOADER_RUN_1', vector (null, log_enable));
-  aq_wait_all (aq);
-}
-;
+	VirtGraph graph = new VirtGraph ("Example3", url, "dba", "dba");
 
+	graph.clear ();
 
-create procedure load_grdf (in f varchar)
-{
-  declare line any;
-  declare inx int;
-  declare ses any;
-  declare gr varchar;
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+	System.out.println("Add 3 triples to graph <Example3>.");
 
-  if (f like '%.gz')
-    ses := gz_file_open (f);
-  else
-    ses := file_open (f);
-  inx := 0;
-  line := '';
-  while (line <> 0)
-    {
-      gr := ses_read_line (ses, 0, 0, 1);
-      if (gr = 0) return;
-      line := ses_read_line (ses, 0, 0, 1);
-      if (line = 0) return;
-      DB.DBA.RDF_LOAD_RDFXML (line, gr, gr);
-      inx := inx + 1;
-    }
-}
-;
+	graph.add(new Triple(foo1, bar1, baz1));
+	graph.add(new Triple(foo2, bar2, baz2));
+	graph.add(new Triple(foo3, bar3, baz3));
 
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+	System.out.println("graph.getCount() = " + graph.getCount());
 
+	triples.add(new Triple(foo1, bar1, baz1));
+	triples.add(new Triple(foo2, bar2, baz2));
 
--- cl_exec ('set lock_escalation_pct = 110');
--- cl_exec ('DB.DBA.RDF_LD_SRV (1)') &
--- cl_exec ('DB.DBA.RDF_LD_SRV (2)') &
-]]></programlisting>
-</listitem>
-  <listitem>Execute:
-<programlisting><![CDATA[
-SQL>cl_exec ('checkpoint);
-]]></programlisting>
-</listitem>
-  <listitem>Execute ld_dir ('directory' , 'mask' , 'graph'), for ex:
-<programlisting><![CDATA[
-SQL>ld_dir ('/dbs/data', '*.gz', 'http://dbpedia.org');
-]]></programlisting>
-</listitem>
-  <listitem>Execute on every node with separate client:
-<programlisting><![CDATA[
-SQL>rdf_loader_run();
-]]></programlisting>
-</listitem>
-</itemizedlist>
-</sect3>
+	graph.isEmpty();
 
+	System.out.println("Remove 2 triples from graph <Example3>");
+	graph.remove(triples);
+	System.out.println("graph.getCount() = " + graph.getCount());
+	System.out.println("Please check result with isql tool.");
 
-       <sect3 id="rdfperfloadingunitpro"><title>Loading UniProt RDF data</title>
-<para>To load the uniprot data, create a function for example such as:</para>
-<programlisting><![CDATA[
-create function DB.DBA.UNIPROT_LOAD (in log_mode integer := 1)
-{
-  DB.DBA.RDF_LOAD_RDFXML_MT (file_to_string_output('filename1'),'http://base_uri_1', 'destination_graph_1', log_mode, 3);
-  DB.DBA.RDF_LOAD_RDFXML_MT (file_to_string_output('filename2'),'http://base_uri_2', 'destination_graph_2', log_mode, 3);
-  ...
-  DB.DBA.RDF_LOAD_RDFXML_MT (file_to_string_output('filename9'),'http://base_uri_9', 'destination_graph_9', log_mode, 3);
-}
-]]></programlisting>
-<para>If you are starting from blank database and you can drop it and re-create in case of error signaled, use it this way:</para>
-<programlisting><![CDATA[
-checkpoint;
-checkpoint_interval(6000);
-DB.DBA.UNIPROT_LOAD (0),
-checkpoint;
-checkpoint_interval(60);
-]]></programlisting>
-<para>If the database contains important data already and there's no way to stop it and backup before the load then use:</para>
-<programlisting><![CDATA[
-checkpoint;
-checkpoint_interval(6000);
-DB.DBA.UNIPROT_LOAD (),
-checkpoint;
-checkpoint_interval(60);
-]]></programlisting>
-<para>Note that the 'number of threads' parameter of DB.DBA.RDF_LOAD_RDFXML() mentions threads
-used to process data from file, an extra thread will read the text and parse it,
-so for 4 CPU cores there's no need in parameter value greater than 3. Three processing
-threads per one parsing tread is usually good ratio because parsing is usually three
-times faster than the rest of loading so CPU loading is well balanced.
-If for example you are using 2 x Quad Xeon, then you can choose between 8
-single-threaded parsers or 2 parsers with 3 processing threads each. With 4 cores you may simply load
-file after file with 3 processing threads. The most important performance tuning is to set the
-[Parameters] section of virtuoso configuration file:</para>
-<programlisting><![CDATA[
-NumberOfBuffers = 1000000
-MaxDirtyBuffers = 800000
-MaxCheckpointRemap = 1000000
-DefaultIsolation = 2
-]]></programlisting>
-<para>Note: these numbers are reasonable for 16 GB RAM Linux box. Usually when there are no such massive operations as loading huge database, you can set up the values as:</para>
-<programlisting><![CDATA[
-NumberOfBuffers = 1500000
-MaxDirtyBuffers = 1200000
-MaxCheckpointRemap = 1500000
-DefaultIsolation = 2
-]]></programlisting>
-<para>Tip: Thus after loading all data you may wish to shutdown, tweak and start server again.
-If you have ext2fs or ext3fs filesystem, then it's better to have enough free space on disk not to
-make it more than 80% full.  When it's almost full it may allocate database file badly, resulting
-in measurable loss of disk access speed. That is not Virtuoso-specific fact, but a common hint
-for all database-like applications with random access to big files.</para>
-<para>Here is an example of using awk file for splitting big file smaller ones:</para>
-<programlisting><![CDATA[
-BEGIN {
-	file_part=1000
-	e_line = "</rdf:RDF>"
-        cur=0
-        cur_o=0
-	file=0
-	part=file_part
-      }
-	{
-	    res_file_i="res/"FILENAME
-	    line=$0
-	    s=$1
-	    res_file=res_file_i"_"file".rdf"
+	/* EXPECTED RESULT:
 
-	    if (index (s, "</rdf:Description>") == 1)
-	    {
-		cur=cur+1
-		part=part-1
-	    }
+SQL> SPARQL
+SELECT ?s ?p ?o
+FROM <Example3>
+WHERE {?s ?p ?o};
+s                                                    p                                                             o
+VARCHAR                                    VARCHAR                                              VARCHAR
+_______________________________________________________________________________
 
-	    if (part > 0)
-	    {
-	    	print line >> res_file
-	    }
+http://example.org/#foo3              http://example.org/#bar3                         http://example.org/#baz3
+
+1 Rows. -- 26 msec.
+SQL>
 
-	    if (part == 0)
-	    {
-#		print "===================== " cur
-	    	print line >> res_file
-		print e_line >> res_file
-		close (res_file)
-		file=file+1
-		part=file_part
-	    	res_file=res_file_i"_"file".rdf"
-		system ("cp beg.txt " res_file)
-	    }
-        }
-END { }
+*/
+
+	}
+}
 ]]></programlisting>
-       </sect3>
-       <sect3 id="rdfperfloadingdbpedia"><title>Loading DBPedia RDF data</title>
-<para>You can use the following script as an example for loading DBPedia RDF data in Virtuoso:</para>
+    </sect4>
+    <sect4 id="rdfnativestorageprovidersjenaexamples4"><title>VirtJenaSPARQLExample4</title>
 <programlisting><![CDATA[
-#!/bin/sh
+import java.util.*;
 
-PORT=$1
-USER=$2
-PASS=$3
-file=$4
-g=$5
-LOGF=`basename $0`.log
+import com.hp.hpl.jena.query.*;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
 
-if [ -z "$PORT" -o -z "$USER" -o -z "$PASS" -o -z "$file" -o -z "$g" ]
-then
-  echo "Usage: `basename $0` [DSN] [user] [password] [ttl-file] [graph-iri]"
-  exit
-fi
+import virtuoso.jena.driver.*;
 
-if [ ! -f "$file" -a ! -d "$file" ]
-then
-    echo "$file does not exists"
-    exit 1
-fi
+public class VirtuosoSPARQLExample4
+{
 
-mkdir READY 2>/dev/null
-rm -f $LOGF $LOGF.*
+    public static void main(String[] args)
+    {
+	String url;
+	if(args.length == 0)
+	    url = "jdbc:virtuoso://localhost:1111";
+	else
+	    url = args[0];
 
-echo "Starting..."
-echo "Logging into: $LOGF"
+	Node foo1 = Node.createURI("http://example.org/#foo1");
+	Node bar1 = Node.createURI("http://example.org/#bar1");
+	Node baz1 = Node.createURI("http://example.org/#baz1");
 
-DOSQL ()
-{
-    isql $PORT $USER $PASS verbose=on banner=off prompt=off echo=ON errors=stdout exec="$1" > $LOGF
-}
+	Node foo2 = Node.createURI("http://example.org/#foo2");
+	Node bar2 = Node.createURI("http://example.org/#bar2");
+	Node baz2 = Node.createURI("http://example.org/#baz2");
 
-LOAD_FILE ()
-{
-    f=$1
-    g=$2
-    echo "Loading $f (`cat $f | wc -l` lines) `date \"+%H:%M:%S\"`" | tee -a $LOG
+	Node foo3 = Node.createURI("http://example.org/#foo3");
+	Node bar3 = Node.createURI("http://example.org/#bar3");
+	Node baz3 = Node.createURI("http://example.org/#baz3");
 
-    DOSQL "ttlp_mt (file_to_string_output ('$f'), '', '$g', 17); checkpoint;" > $LOGF
+	VirtGraph graph = new VirtGraph ("Example4", url, "dba", "dba");
 
-    if [ $? != 0 ]
-    then
-	echo "An error occurred, please check $LOGF"
-	exit 1
-    fi
+	graph.clear ();
 
-    line_no=`grep Error $LOGF | awk '{ match ($0, /line [0-9]+/, x) ; match (x[0], /[0-9]+/, y); print y[0] }'`
-    newf=$f.part
-    inx=1
-    while [ ! -z "$line_no" ]
-    do
-	cat $f |  awk "BEGIN { i = 1 } { if (i==$line_no) { print \$0; exit; } i = i + 1 }"  >> bad.nt
-	line_no=`expr $line_no + 1`
-	echo "Retrying from line $line_no"
-	echo "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> ." > tmp.nt
-	cat $f |  awk "BEGIN { i = 1 } { if (i>=$line_no) print \$0; i = i + 1 }"  >> tmp.nt
-	mv tmp.nt $newf
-	f=$newf
-	mv $LOGF $LOGF.$inx
-	DOSQL "ttlp_mt (file_to_string_output ('$f'), '', '$g', 17); checkpoint;" > $LOGF
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
 
-	if [ $? != 0 ]
-    then
-	    echo "An error occurred, please check $LOGF"
-	    exit 1
-    fi
-	line_no=`grep Error $LOGF | awk '{ match ($0, /line [0-9]+/, x) ; match (x[0], /[0-9]+/, y); print y[0] }'`
-	inx=`expr $inx + 1`
-    done
-    rm -f $newf 2>/dev/null
-    echo "Loaded.  "
-}
+	System.out.println("Add 3 triples to graph <Example4>.");
 
-echo "======================================="
-echo "Loading started."
-echo "======================================="
+	graph.add(new Triple(foo1, bar1, baz1));
+	graph.add(new Triple(foo2, bar2, baz2));
+	graph.add(new Triple(foo3, bar3, baz3));
 
-if [ -f "$file" ]
-then
-    LOAD_FILE $file $g
-    mv $file READY 2>> /dev/null
-elif [ -d "$file" ]
-then
-    for ff in `find $file -name '*.nt'`
-    do
-	LOAD_FILE $ff $g
-	mv $ff READY 2>> /dev/null
-    done
-else
-   echo "The input is not file or directory"
-fi
-echo "======================================="
-echo "Final checkpoint."
-DOSQL "checkpoint;" > temp.res
-echo "======================================="
-echo "Check bad.nt file for skipped triples."
-echo "======================================="
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+	System.out.println("graph.getCount() = " + graph.getCount());
 
-exit 0
+	System.out.println ("graph.contains(new Triple(foo2, bar2, baz2) - " + graph.contains(new Triple(foo2, bar2, baz2)));
+	System.out.println ("graph.contains(new Triple(foo2, bar2, baz3) - " + graph.contains(new Triple(foo2, bar2, baz3)));
+
+	graph.clear ();
 
+    }
+}
 ]]></programlisting>
-       </sect3>
-       <sect3 id="rdfperfloadingbio2rdf"><title>Loading Bio2RDF data</title>
-<para>The shell script below was used to import files in n3 notation into OpenLink Virtuoso RDF storage.</para>
-<para>When an syntax error it will cut content from next line and will retry. This was used on ubuntu linux to import bio2rdf and freebase dumps.</para>
-<para>Note it uses gawk, so it must be available on system where is tried. Also for recovery additional disk space is needed at max the size of original file.</para>
+    </sect4>
+    <sect4 id="rdfnativestorageprovidersjenaexamples5"><title>VirtJenaSPARQLExample5</title>
 <programlisting><![CDATA[
-#!/bin/bash
+import java.util.*;
 
-PASS=$1
-f=$2
-g=$3
+import com.hp.hpl.jena.query.*;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
 
-# Usage
-if [ -z "$PASS" -o -z "$f" -o -z "$g" ]
-then
-  echo "Usage: $0 [password] [ttl-file] [graph-iri]"
-  exit
-fi
+import virtuoso.jena.driver.*;
 
-if [ ! -f "$f" ]
-then
-    echo "$f does not exists"
-    exit
-fi
+public class VirtuosoSPARQLExample5
+{
 
-# Your port here
-PORT=1111  #`inifile -f dbpedia.ini -s Parameters -k ServerPort`
-if test -z "$PORT"
-then
-    echo "Cannot find INI and inifile command"
-    exit
-fi
+    public static void main(String[] args)
+    {
+	String url;
+	if(args.length == 0)
+	    url = "jdbc:virtuoso://localhost:1111";
+	else
+	    url = args[0];
 
-# Initial run
-isql $PORT dba $PASS verbose=on banner=off prompt=off echo=ON errors=stdout exec="ttlp_mt (file_to_string_output ('$f'), '', '$g'); checkpoint;" > $0.log
+	Node foo1 = Node.createURI("http://example.org/#foo1");
+	Node bar1 = Node.createURI("http://example.org/#bar1");
+	Node baz1 = Node.createURI("http://example.org/#baz1");
+
+	Node foo2 = Node.createURI("http://example.org/#foo2");
+	Node bar2 = Node.createURI("http://example.org/#bar2");
+	Node baz2 = Node.createURI("http://example.org/#baz2");
+
+	Node foo3 = Node.createURI("http://example.org/#foo3");
+	Node bar3 = Node.createURI("http://example.org/#bar3");
+	Node baz3 = Node.createURI("http://example.org/#baz3");
+
+	VirtGraph graph = new VirtGraph ("Example5", url, "dba", "dba");
+
+	graph.clear ();
+
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+
+	System.out.println("Add 3 triples to graph <Example5>.");
+
+	graph.add(new Triple(foo1, bar1, baz1));
+	graph.add(new Triple(foo2, bar2, baz2));
+	graph.add(new Triple(foo3, bar3, baz3));
+	graph.add(new Triple(foo1, bar2, baz2));
+	graph.add(new Triple(foo1, bar3, baz3));
+
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+	System.out.println("graph.getCount() = " + graph.getCount());
+
+	ExtendedIterator iter = graph.find(foo1, Node.ANY, Node.ANY);
+	System.out.println ("\ngraph.find(foo1, Node.ANY, Node.ANY) \nResult:");
+	for ( ; iter.hasNext() ; )
+	    System.out.println ((Triple) iter.next());
+
+	iter = graph.find(Node.ANY, Node.ANY, baz3);
+	System.out.println ("\ngraph.find(Node.ANY, Node.ANY, baz3) \nResult:");
+	for ( ; iter.hasNext() ; )
+	    System.out.println ((Triple) iter.next());
+
+	iter = graph.find(foo1, Node.ANY, baz3);
+	System.out.println ("\ngraph.find(foo1, Node.ANY, baz3) \nResult:");
+	for ( ; iter.hasNext() ; )
+	    System.out.println ((Triple) iter.next());
+
+	graph.clear ();
+
+    }
+}
+]]></programlisting>
+    </sect4>
+    <sect4 id="rdfnativestorageprovidersjenaexamples6"><title>VirtJenaSPARQLExample6</title>
+<programlisting><![CDATA[
+import java.util.*;
+
+import com.hp.hpl.jena.query.*;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
+
+import virtuoso.jena.driver.*;
+
+public class VirtuosoSPARQLExample6
+{
 
-# If disconnect etc.
-if [ $? != 0 ]
-then
-    echo "An error occurred, please check $0.log"
-    exit
-fi
+    public static void main(String[] args)
+    {
+	String url;
+	if(args.length == 0)
+	    url = "jdbc:virtuoso://localhost:1111";
+	else
+	    url = args[0];
 
-# Check for error
-line_no=`grep Error $0.log | awk '{ match ($0, /line [0-9]+/, x) ; match (x[0], /[0-9]+/, y); print y[0] }'`
-newf=$f.part
-inx=1
+	Node foo1 = Node.createURI("http://example.org/#foo1");
+	Node bar1 = Node.createURI("http://example.org/#bar1");
+	Node baz1 = Node.createURI("http://example.org/#baz1");
 
-# Error recovery
-while [ ! -z "$line_no" ]
-do
-    cat $f |  awk "BEGIN { i = 0 } { if (i==$line_no) { print \$0; exit; } i = i + 1 }"  >> bad.nt
-    line_no=`expr $line_no + 1`
-    echo "Retrying from line $line_no"
-    cat $f |  awk "BEGIN { i = 0 } { if (i>=$line_no) print \$0; i = i + 1 }"  > tmp.nt
-    mv tmp.nt $newf
-    f=$newf
-    mv $0.log $0.log.$inx
-    # Run the recovered part
-    isql $PORT dba $PASS verbose=on banner=off prompt=off echo=ON errors=stdout exec="ttlp_mt (file_to_string_output ('$f'), '', '$g'); checkpoint;" > $0.log
+	Node foo2 = Node.createURI("http://example.org/#foo2");
+	Node bar2 = Node.createURI("http://example.org/#bar2");
+	Node baz2 = Node.createURI("http://example.org/#baz2");
 
-    if [ $? != 0 ]
-    then
-	echo "An error occurred, please check $0.log"
-	exit
-    fi
-   line_no=`grep Error $0.log | awk '{ match ($0, /line [0-9]+/, x) ; match (x[0], /[0-9]+/, y); print y[0] }'`
-   inx=`expr $inx + 1`
-done
-]]></programlisting>
+	Node foo3 = Node.createURI("http://example.org/#foo3");
+	Node bar3 = Node.createURI("http://example.org/#bar3");
+	Node baz3 = Node.createURI("http://example.org/#baz3");
 
-       </sect3>
-    </sect2>
-    <sect2 id="rdfperfsparul"><title>Using SPARUL</title>
-	<para>Since SPARUL updates are generally not ment to be transactional, it is
-	    best to run these in <link linkend="fn_log_enable"><function>log_enable (2)</function></link> mode,
-	    which commits every operation as it is done. This prevents one from running out of rollback space. Also for bulk updates, transaction logging can be turned off. If so, one should do a manual checkpoint after the operation to ensure persistence across server restart since there is no roll forward log.</para>
-<para>To have a roll forward log and row by row autocommit, one may use <link linkend="fn_log_enable"><function>log_enable (3)</function></link>. This will write constantly into the log which takes extra time. Having no logging and doing a checkpoint when the whole work is finished is faster.</para>
-<para>Many SPARUL operations can be run in parallel in this way. If they are independent with respect to their input and output, they can run in parallel and row by row autocommit will ensure they do not end up waiting for each others' locks.</para>
-    </sect2>
-    <sect2 id="rdfperfgeneraldbpedia"><title>DBpedia Benchmark</title>
-<para>We ran the DBpedia benchmark queries again with different configurations of Virtuoso.
-Comparing numbers given by different parties is a constant problem. In the case reported here,
-we loaded the full DBpedia 3, all languages, with about 198M triples, onto Virtuoso v5 and Virtuoso Cluster
-v6, all on the same 4 core 2GHz Xeon with 8G RAM. All databases were striped on 6 disks. The Cluster
-configuration was with 4 processes in the same box.
-We ran the queries in two variants:
-</para>
-<itemizedlist>
-  <listitem>With graph specified in the SPARQL FROM clause, using the default indices.</listitem>
-  <listitem>With no graph specified anywhere, using an alternate indexing scheme.</listitem>
-</itemizedlist>
-<para>The times below are for the sequence of 5 queries.
-As there is a query in the set that specifies no condition on S or O and only P,
-thus cannot be done with the default indices With Virtuoso v5. With Virtuoso Cluster v6 it can,
-because v6 is more space efficient. So we added the index:</para>
-<programlisting><![CDATA[
-create bitmap index rdf_quad_pogs on rdf_quad (p, o, g, s);
-]]></programlisting>
-<table>
-<tgroup cols="4">
-<thead>
-<row>
-  <entry></entry>
-  <entry>Virtuoso v5 with  gspo, ogps, pogs</entry>
-  <entry>Virtuoso Cluster v6 with gspo, ogps</entry>
-  <entry>Virtuoso Cluster v6 with gspo, ogps, pogs</entry>
-</row>
-</thead>
-<tbody>
-<row><entry>cold</entry><entry>210 s</entry><entry>136 s</entry><entry>33.4 s</entry></row>
-<row><entry>warm</entry><entry>0.600 s</entry><entry>4.01 s</entry><entry>0.628 s</entry></row>
-</tbody>
-</tgroup>
-</table>
-<para>Now let us do it without a graph being specified. Note that alter index is valid for v6 or higher.
-For all platforms, we drop any existing indices, and:</para>
-<programlisting><![CDATA[
-create table r2 (g iri_id_8, s, iri_id_8, p iri_id_8, o any, primary key (s, p, o, g))
-alter index R2 on R2 partition (s int (0hexffff00));
+	VirtGraph graph = new VirtGraph ("Example6", url, "dba", "dba");
 
-log_enable (2);
-insert into r2 (g, s, p, o) SELECT g, s, p, o from rdf_quad;
+	graph.clear ();
 
-drop table rdf_quad;
-alter table r2 rename RDF_QUAD;
-create bitmap index rdf_quad_opgs on rdf_quad (o, p, g, s) partition (o varchar (-1, 0hexffff));
-create bitmap index rdf_quad_pogs on rdf_quad (p, o, g, s) partition (o varchar (-1, 0hexffff));
-create bitmap index rdf_quad_gpos on rdf_quad (g, p, o, s) partition (o varchar (-1, 0hexffff));
-]]></programlisting>
-<para>The code is identical for v5 and v6, except that with v5 we use iri_id (32 bit) for
-the type, not iri_id_8 (64 bit). We note that we run out of IDs with v5 around a few billion
-triples, so with v6 we have double the ID length and still manage to be vastly more space efficient.</para>
-<para>With the above 4 indices, we can query the data pretty much in any combination without hitting
-a full scan of any index. We note that all indices that do not begin with s end with s as a bitmap.
-This takes about 60% of the space of a non-bitmap index for data such as DBpedia.</para>
-<para>If you intend to do completely arbitrary RDF queries in Virtuoso, then chances are
-you are best off with the above index scheme.</para>
-<table>
-<tgroup cols="3">
-<thead>
-<row>
-  <entry></entry>
-  <entry>Virtuoso v5 with  gspo, ogps, pogs</entry>
-  <entry>Virtuoso Cluster v6 with gspo, ogps, pogs</entry>
-</row>
-</thead>
-<tbody>
-<row><entry>warm</entry><entry>0.595 s</entry><entry>0.617 s</entry></row>
-</tbody>
-</tgroup>
-</table>
-<para>The cold times were about the same as above, so not reproduced.</para>
-<para>It is in the SPARQL spirit to specify a graph and for pretty much any application,
-there are entirely sensible ways of keeping the data in graphs and specifying which ones are
-concerned by queries. This is why Virtuoso is set up for this by default.</para>
-<para>On the other hand, for the open web scenario, dealing with an unknown large number of graphs,
-enumerating graphs is not possible and questions like which graph of which source asserts x become
-relevant. We have two distinct use cases which warrant different setups of the database, simple as that.</para>
-<para>The latter use case is not really within the SPARQL spec, so implementations may or may not
-support this.</para>
-<para>Once the indices are right, there is no difference between specifying a graph and not specifying a
-graph with the queries considered. With more complex queries, specifying a graph or set of graphs does
-allow some optimizations that cannot be done with no graph specified. For example, bitmap intersections
-are possible only when all leading key parts are given.</para>
-<para>The best warm cache time is with v5; the five queries run under 600 ms after the first go.
-This is noted to show that all-in-memory with a single thread of execution is hard to beat.</para>
-<para>Cluster v6 performs the same queries in 623 ms. What is gained in parallelism is lost in latency
-if all operations complete in microseconds. On the other hand, Cluster v6 leaves v5 in the dust in any
-situation that has less than 100% hit rate. This is due to actual benefit from parallelism if operations
-take longer than a few microseconds, such as in the case of disk reads. Cluster v6 has substantially
-better data layout on disk, as well as fewer pages to load for the same content.</para>
-<para>This makes it possible to run the queries without the pogs index on Cluster v6 even when v5 takes prohibitively long.</para>
-<para>The purpose is to have a lot of RAM and space-efficient data representation.</para>
-<para>For reference, the query texts specifying the graph are below. To run without specifying
-the graph, just drop the FROM <http://dbpedia.org> from each query. The returned row counts are
-indicated below each query's text.</para>
-<programlisting><![CDATA[
-SQL>SPARQL
-SELECT ?p ?o
-FROM <http://dbpedia.org>
-WHERE
-  {
-    <http://dbpedia.org/resource/Metropolitan_Museum_of_Art> ?p ?o .
-  };
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
 
-p                                                                                 o
-VARCHAR                                                                           VARCHAR
-_______________________________________________________________________________
+	System.out.println("test Transaction Commit.");
+	graph.getTransactionHandler().begin();
+	System.out.println("begin Transaction.");
+	System.out.println("Add 3 triples to graph <Example6>.");
 
-http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://umbel.org/umbel/ac/Artifact
-http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://dbpedia.org/class/yago/MuseumsInNewYorkCity
-http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://dbpedia.org/class/yago/ArtMuseumsAndGalleriesInTheUnitedStates
-http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://dbpedia.org/class/yago/Museum103800563
-..
--- 335 rows
+	graph.add(new Triple(foo1, bar1, baz1));
+	graph.add(new Triple(foo2, bar2, baz2));
+	graph.add(new Triple(foo3, bar3, baz3));
 
-SQL>SPARQL
-PREFIX p: <http://dbpedia.org/property/>
-SELECT ?film1 ?actor1 ?film2 ?actor2
-FROM <http://dbpedia.org>
-WHERE
-  {
-  ?film1 p:starring <http://dbpedia.org/resource/Kevin_Bacon> .
-  ?film1 p:starring ?actor1 .
-  ?film2 p:starring ?actor1 .
-    ?film2 p:starring ?actor2 .
-};
+	graph.getTransactionHandler().commit();
+	System.out.println("commit Transaction.");
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+	System.out.println("graph.getCount() = " + graph.getCount());
 
-film1                                       actor1                                    film2                                        ctor2
-VARCHAR                                     VARCHAR                                   VARCHAR                                      ARCHAR
-http://dbpedia.org/resource/The_River_Wild  http://dbpedia.org/resource/Kevin_Bacon   http://dbpedia.org/resource/The_River_Wild   http://dbpedia.org/resource/Kevin_Bacon
-http://dbpedia.org/resource/The_River_Wild  http://dbpedia.org/resource/Kevin_Bacon   http://dbpedia.org/resource/The_River_Wild   http://dbpedia.org/resource/Meryl_Streep
-http://dbpedia.org/resource/The_River_Wild  http://dbpedia.org/resource/Kevin_Bacon   http://dbpedia.org/resource/The_River_Wild   http://dbpedia.org/resource/Joseph_Mazzello
-http://dbpedia.org/resource/The_River_Wild  http://dbpedia.org/resource/Kevin_Bacon   http://dbpedia.org/resource/The_River_Wild   http://dbpedia.org/resource/David_Strathairn
-http://dbpedia.org/resource/The_River_Wild  http://dbpedia.org/resource/Kevin_Bacon   http://dbpedia.org/resource/The_River_Wild   http://dbpedia.org/resource/John_C._Reilly
-...
---  23910 rows
+	ExtendedIterator iter = graph.find(Node.ANY, Node.ANY, Node.ANY);
+	System.out.println ("\ngraph.find(Node.ANY, Node.ANY, Node.ANY) \nResult:");
+	for ( ; iter.hasNext() ; )
+	    System.out.println ((Triple) iter.next());
 
-SQL>SPARQL
-PREFIX p: <http://dbpedia.org/property/>
-SELECT ?artist ?artwork ?museum ?director
-FROM <http://dbpedia.org>
-WHERE
-  {
-  ?artwork p:artist ?artist .
-  ?artwork p:museum ?museum .
-    ?museum p:director ?director
-  };
+	graph.clear ();
+	System.out.println("\nCLEAR graph <Example6>");
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
 
-artist                                          artwork                                              museum                                                                            director
-VARCHAR                                         VARCHAR                                              VARCHAR                                                                           VARCHAR
-_______________________________________________
+	System.out.println("Add 1 triples to graph <Example6>.");
+	graph.add(new Triple(foo1, bar1, baz1));
 
-http://dbpedia.org/resource/Paul_C%C3%A9zanne   http://dbpedia.org/resource/The_Basket_of_Apples     http://dbpedia.org/resource/Art_Institute_of_Chicago                              James Cuno
-http://dbpedia.org/resource/Paul_Signac         http://dbpedia.org/resource/Neo-impressionism        http://dbpedia.org/resource/Art_Institute_of_Chicago                              James Cuno
-http://dbpedia.org/resource/Georges_Seurat      http://dbpedia.org/resource/Neo-impressionism        http://dbpedia.org/resource/Art_Institute_of_Chicago                              James Cuno
-http://dbpedia.org/resource/Edward_Hopper       http://dbpedia.org/resource/Nighthawks               http://dbpedia.org/resource/Art_Institute_of_Chicago                              James Cuno
-http://dbpedia.org/resource/Mary_Cassatt        http://dbpedia.org/resource/The_Child%27s_Bath       http://dbpedia.org/resource/Art_Institute_of_Chicago                              James Cuno
-..
--- 303 rows
+	System.out.println("test Transaction Abort.");
+	graph.getTransactionHandler().begin();
+	System.out.println("begin Transaction.");
+	System.out.println("Add 2 triples to graph <Example6>.");
 
-SQL>SPARQL
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-SELECT ?s ?homepage
-FROM <http://dbpedia.org>
-WHERE
-  {
-   <http://dbpedia.org/resource/Berlin> geo:lat ?berlinLat .
-   <http://dbpedia.org/resource/Berlin> geo:long ?berlinLong .
-   ?s geo:lat ?lat .
-   ?s geo:long ?long .
-   ?s foaf:homepage ?homepage .
-   FILTER (
-     ?lat        <=     ?berlinLat + 0.03190235436 &&
-     ?long       >=     ?berlinLong - 0.08679199218 &&
-     ?lat        >=     ?berlinLat - 0.03190235436 &&
-     ?long       <=     ?berlinLong + 0.08679199218) };
+	graph.add(new Triple(foo2, bar2, baz2));
+	graph.add(new Triple(foo3, bar3, baz3));
+
+	graph.getTransactionHandler().abort();
+	System.out.println("abort Transaction.");
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+	System.out.println("graph.getCount() = " + graph.getCount());
 
-s                                                                                 homepage
-VARCHAR                                                                           VARCHAR
-_______________________________________________________________________________
+	iter = graph.find(Node.ANY, Node.ANY, Node.ANY);
+	System.out.println ("\ngraph.find(Node.ANY, Node.ANY, Node.ANY) \nResult:");
+	for ( ; iter.hasNext() ; )
+	    System.out.println ((Triple) iter.next());
 
-http://dbpedia.org/resource/Berlin_University_of_the_Arts                         http://www.udk-berlin.de/
-http://dbpedia.org/resource/Berlin_University_of_the_Arts                         http://www.udk-berlin.de/
-http://dbpedia.org/resource/Berlin_Zoological_Garden                              http://www.zoo-berlin.de/en.html
-http://dbpedia.org/resource/Federal_Ministry_of_the_Interior_%28Germany%29        http://www.bmi.bund.de
-http://dbpedia.org/resource/Neues_Schauspielhaus                                  http://www.goya-berlin.com/
-http://dbpedia.org/resource/Bauhaus_Archive                                       http://www.bauhaus.de/english/index.htm
-http://dbpedia.org/resource/Canisius-Kolleg_Berlin                                http://www.canisius-kolleg.de
-http://dbpedia.org/resource/Franz%C3%B6sisches_Gymnasium_Berlin                   http://www.fg-berlin.cidsnet.de
-..
--- 48 rows
+	graph.clear ();
+	System.out.println("\nCLEAR graph <Example6>");
 
-SQL>SPARQL
-PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
-PREFIX foaf: <http://xmlns.com/foaf/0.1/>
-PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
-PREFIX p: <http://dbpedia.org/property/>
-SELECT ?s ?a ?homepage
-FROM <http://dbpedia.org>
-WHERE
-  {
-   <http://dbpedia.org/resource/New_York_City> geo:lat ?nyLat .
-   <http://dbpedia.org/resource/New_York_City> geo:long ?nyLong .
-   ?s geo:lat ?lat .
-   ?s geo:long ?long .
-   ?s p:architect ?a .
-   ?a foaf:homepage ?homepage .
-   FILTER (
-     ?lat        <=     ?nyLat + 0.3190235436 &&
-     ?long       >=     ?nyLong - 0.8679199218 &&
-     ?lat        >=     ?nyLat - 0.3190235436 &&
-     ?long       <=     ?nyLong + 0.8679199218) };
-s                                                                                 a               homepage
-VARCHAR                                                                           VARCHAR              VARCHAR
-_______________________________________________________________________________
+    }
+}
 
-http://dbpedia.org/resource/GE_Building                                           http://dbpedia.org/resource/Associated_Architects              http://www.associated-architects.co.uk
-http://dbpedia.org/resource/Giants_Stadium                                        http://dbpedia.org/resource/HNTB              http://www.hntb.com/
-http://dbpedia.org/resource/Fort_Tryon_Park_and_the_Cloisters                     http://dbpedia.org/resource/Frederick_Law_Olmsted              http://www.asla.org/land/061305/olmsted.html
-http://dbpedia.org/resource/Central_Park                                          http://dbpedia.org/resource/Frederick_Law_Olmsted              http://www.asla.org/land/061305/olmsted.html
-http://dbpedia.org/resource/Prospect_Park_%28Brooklyn%29                          http://dbpedia.org/resource/Frederick_Law_Olmsted              http://www.asla.org/land/061305/olmsted.html
-http://dbpedia.org/resource/Meadowlands_Stadium                                   http://dbpedia.org/resource/360_Architecture              http://oakland.athletics.mlb.com/oak/ballpark/new/faq.jsp
-http://dbpedia.org/resource/Citi_Field                                            http://dbpedia.org/resource/HOK_Sport_Venue_Event              http://www.hoksve.com/
-http://dbpedia.org/resource/Citigroup_Center                                      http://dbpedia.org/resource/Hugh_Stubbins_Jr.              http://www.klingstubbins.com
-http://dbpedia.org/resource/150_Greenwich_Street                                  http://dbpedia.org/resource/Fumihiko_Maki              http://www.pritzkerprize.com/maki2.htm
-http://dbpedia.org/resource/Freedom_Tower                                         http://dbpedia.org/resource/David_Childs              http://www.som.com/content.cfm/www_david_m_childs
-http://dbpedia.org/resource/7_World_Trade_Center                                  http://dbpedia.org/resource/David_Childs              http://www.som.com/content.cfm/www_david_m_childs
-http://dbpedia.org/resource/The_New_York_Times_Building                           http://dbpedia.org/resource/Renzo_Piano              http://www.rpbw.com/
-http://dbpedia.org/resource/Trump_World_Tower                                     http://dbpedia.org/resource/Costas_Kondylis              http://www.kondylis.com
 
-13 Rows. -- 2183 msec.
-]]></programlisting>
-    </sect2>
-<sect2 id="rdfstorebenchmarks"><title>RDF Store Benchmarks</title>
-    <sect3 id="rdfstorebenchmarksintroduction"><title>Introduction</title>
-       <para>In a particular RDF Store Benchmarks there is difference if the queries are
-executed with specified graph or with specified multiple graphs. As Virtuoso is quad store,
-not triple store with many tables, it runs queries inefficiently if graphs are specified
-and there are no additional indexes except pre-set GSPO and OGPS. Proper use of the FROM clause
-or adding indexes with graph column will contribute for better results.
-       </para>
-    </sect3>
-    <sect3 id="rdfstorebenchmarksindexusage"><title>Using bitmap indexes</title>
-    <para>If is known in advance for the current RDF Store Benchmarks that some
-users will not indicate specific graphs then should be done: </para>
-    <itemizedlist>
-       <listitem>either create indexes with graph in last position</listitem>
-       <listitem>or load everything into single graph and specify it somewhere in querying application.</listitem>
-    </itemizedlist>
-    <para>Both methods do not require any changes in query texts</para>
-<itemizedlist mark="bullet">
-  <listitem>For users using Virtuoso 5 is strongly recommended is the usage of additional bitmap indexes:
-<programlisting><![CDATA[
-SQL> create bitmap index RDF_QUAD_POGS on DB.DBA.RDF_QUAD (P,O,G,S);
-SQL> create bitmap index RDF_QUAD_PSOG on DB.DBA.RDF_QUAD (P,S,O,G);
-]]></programlisting>
-</listitem>
-  <listitem>For users using Virtuoso 6 or higher, see the new layout <link linkend="rdfperfrdfscheme">here</link>.</listitem>
-</itemizedlist>
-    <para>You can create other indexes as well. Bitmap indexes are preferable, but
-if O is the last column, then the index can not be bitmap, so it could be, for e.g.:</para>
-<programlisting><![CDATA[
-create index RDF_QUAD_PSGO on DB.DBA.RDF_QUAD (P, S, G, O);
 ]]></programlisting>
-    <para>but cannot be:</para>
+    </sect4>
+    <sect4 id="rdfnativestorageprovidersjenaexamples7"><title>VirtJenaSPARQLExample7</title>
 <programlisting><![CDATA[
-create bitmap index RDF_QUAD_PSGO on DB.DBA.RDF_QUAD (P, S, G, O);
-]]></programlisting>
-    </sect3>
-  </sect2>
-</sect1>
+import java.util.*;
 
+import com.hp.hpl.jena.query.*;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
 
+import virtuoso.jena.driver.*;
 
-<sect1 id="rdfnativestorageproviders"><title>RDF Data Access Providers (Drivers)</title>
-  <sect2 id="rdfnativestorageprovidersjena"><title>Virtuoso Jena Provider</title>
-    <sect3 id="rdfnativestorageprovidersjenawhatis"><title>What is Jena</title>
-    <para>Jena is an open source Semantic Web framework for Java. It provides an API to
-extract data from and write to RDF graphs. The graphs are represented as an abstract "model".
-A model can be sourced with data from files, databases, URIs or a combination of these. A Model
-can also be queried through SPARQL and updated through SPARUL.
-    </para>
-    </sect3>
-    <sect3 id="rdfnativestorageprovidersjenawhatisv"><title>What is the Virtuoso Jena Provider</title>
-    <para>The Virtuoso Jena RDF Data Provider is a fully operational Native Graph Model Storage
-Provider for the Jena Framework, enables Semantic Web applications written using the Jena RDF
-Frameworks to query the Virtuoso RDF Quad store directly. The Provider has been tested against
-the <ulink url="http://jena.sourceforge.net/">Jena 2.5.5</ulink> version currently available.
-    </para>
-    <figure id="rdfnativestorageprovidersjena1" float="1">
-      <title>Virtuoso Jena RDF Data Provider</title>
-      <graphic fileref="ui/VirtJenaProvider.png"/>
-    </figure>
-    </sect3>
-    <sect3 id="rdfnativestorageprovidersjenasetup"><title>Setup</title>
-    <sect4 id="rdfnativestorageprovidersjenareqfiles"><title>Required Files</title>
-    <itemizedlist mark="bullet">
-      <listitem>Virtuoso Jena Provider JAR file, <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VirtJenaProvider/virt_jena.jar">virt_jena.jar</ulink></listitem>
-      <listitem>Virtuoso JDBC Driver JAR file, <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VirtJenaProvider/virtjdbc3.jar">virtjdbc3.jar</ulink></listitem>
-      <listitem>Jena Framework and associated classes, <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VirtJenaProvider/jenajars.zip">jenajars.zip</ulink></listitem>
-      <listitem>Sample programs, <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VirtJenaProvider/virtjenasamples.zip">virtjenasamples.zip</ulink></listitem>
-    </itemizedlist>
-    </sect4>
-    <sect4 id="rdfnativestorageprovidersjenacmsmpr"><title>Compiling Jena Sample Programs</title>
-    <orderedlist>
-      <listitem>Edit the sample programs VirtuosoSPARQLExampleX.java, where X = 1 to 9.
-Set the JDBC connection strings within to point to a valid Virtuoso Server instance of the form:
-<programlisting><![CDATA[
-"jdbc:virtuoso://localhost:1111/charset=UTF-8/log_enable=2"
-]]></programlisting>
-      <itemizedlist>
-         <listitem>charset=UTF-8  will be added by Jena provider, if it isn't in connection string.
-So now you don't need add "charset=UTF-8" to the connection string any more, it is done by Jena provider.
+public class VirtuosoSPARQLExample7
+{
 
-         </listitem>
-         <listitem>log_enable=2: to use row auto commit
-         </listitem>
-         <listitem>use these settings to process large rdf data.
-         </listitem>
-      </itemizedlist>
-      </listitem>
-      <listitem>Ensure that full paths to <emphasis>jena.jar, arq.jar,</emphasis> and
-<emphasis>virtjdbc3.jar</emphasis> are included in the active CLASSPATH setting.
-      </listitem>
-      <listitem>Compile the Jena Sample applications using the following command:
-<programlisting><![CDATA[
-javac -cp "jena.jar:arq.jar:virtjdbc3.jar:virt_jena.jar:." VirtuosoSPARQLExample1.java
-VirtuosoSPARQLExample2.java VirtuosoSPARQLExample3.java VirtuosoSPARQLExample4.java
-VirtuosoSPARQLExample5.java VirtuosoSPARQLExample6.java VirtuosoSPARQLExample7.java
-VirtuosoSPARQLExample8.java VirtuosoSPARQLExample9.java
-]]></programlisting>
-      </listitem>
-    </orderedlist>
-    </sect4>
-    <sect4 id="rdfnativestorageprovidersjenatesting"><title>Testing</title>
-    <para>Once the Provider classes and sample program have been successfully compiled,
-the Provider can be tested using the sample programs included. Ensure your active CLASSPATH
-includes full paths to all of the following files, before executing the example commands:
-    </para>
-    <itemizedlist mark="bullet">
-      <listitem>icu4j_3_4.jar</listitem>
-      <listitem>iri.jar</listitem>
-      <listitem>xercesImpl.jar</listitem>
-      <listitem>axis.jar</listitem>
-      <listitem>commons-logging-1.1.1.jar</listitem>
-      <listitem>jena.jar</listitem>
-      <listitem>arq.jar</listitem>
-      <listitem>virtjdbc3.jar</listitem>
-      <listitem>virt_jena.jar</listitem>
-    </itemizedlist>
-    <orderedlist>
-      <listitem><link linkend="rdfnativestorageprovidersjenaexamples1">VirtuosoSPARQLExample1</link> returns the contents of the RDF Quad store of the targeted Virtuoso instance, with the following command:
-<programlisting><![CDATA[
-java VirtuosoSPARQLExample1
-]]></programlisting>
-      </listitem>
-      <listitem><link linkend="rdfnativestorageprovidersjenaexamples2">VirtuosoSPARQLExample2</link> reads in the contents of the following FOAF URIs --
-<programlisting><![CDATA[
-http://kidehen.idehen.net/dataspace/person/kidehen#this
-http://www.w3.org/People/Berners-Lee/card#i
-http://demo.openlinksw.com/dataspace/person/demo#this
-]]></programlisting>
-      <para>-- and returns the RDF data stored, with the following command:</para>
-<programlisting><![CDATA[
-java VirtuosoSPARQLExample2
-]]></programlisting>
-      </listitem>
-      <listitem><link linkend="rdfnativestorageprovidersjenaexamples3">VirtuosoSPARQLExample3</link> performs simple addition and deletion operation on
-the content of the triple store, with the following command:
-<programlisting><![CDATA[
-java VirtuosoSPARQLExample3
-]]></programlisting>
-      </listitem>
-      <listitem><link linkend="rdfnativestorageprovidersjenaexamples4">VirtuosoSPARQLExample4</link> demonstrates the use of the <emphasis>graph.contains</emphasis> method for searching triples, with the following command:
-<programlisting><![CDATA[
-java VirtuosoSPARQLExample4
-]]></programlisting>
-</listitem>
-      <listitem><link linkend="rdfnativestorageprovidersjenaexamples5">VirtuosoSPARQLExample5</link> demonstrates the use of the <emphasis>graph.find</emphasis> method for searching triples, with the following command:
-<programlisting><![CDATA[
-java VirtuosoSPARQLExample5
-]]></programlisting>
-      </listitem>
-      <listitem><link linkend="rdfnativestorageprovidersjenaexamples6">VirtuosoSPARQLExample6</link> demonstrates the use of the <emphasis>graph.getTransactionHandler</emphasis> method, with the following command:
-<programlisting><![CDATA[
-java VirtuosoSPARQLExample6
-]]></programlisting>
-      </listitem>
-      <listitem><link linkend="rdfnativestorageprovidersjenaexamples7">VirtuosoSPARQLExample7</link> demonstrates the use of the graph.getBulkUpdateHandler method, with the following command:
-<programlisting><![CDATA[
-java VirtuosoSPARQLExample7
-]]></programlisting>
-      </listitem>
-      <listitem><link linkend="rdfnativestorageprovidersjenaexamples8">VirtuosoSPARQLExample8</link> demonstrates how to insert triples into a graph, with the following command:
-<programlisting><![CDATA[
-java VirtuosoSPARQLExample8
-]]></programlisting>
-      </listitem>
-      <listitem><link linkend="rdfnativestorageprovidersjenaexamples9">VirtuosoSPARQLExample9</link> demonstrates the use of the <emphasis>CONSTRUCT, DESCRIBE,</emphasis> and <emphasis>ASK</emphasis> SPARQL query forms, with the following command:
-<programlisting><![CDATA[
-java VirtuosoSPARQLExample9
+    public static void main(String[] args)
+    {
+	String url;
+	if(args.length == 0)
+	    url = "jdbc:virtuoso://localhost:1111";
+	else
+	    url = args[0];
+
+	Node foo1 = Node.createURI("http://example.org/#foo1");
+	Node bar1 = Node.createURI("http://example.org/#bar1");
+	Node baz1 = Node.createURI("http://example.org/#baz1");
+
+	Node foo2 = Node.createURI("http://example.org/#foo2");
+	Node bar2 = Node.createURI("http://example.org/#bar2");
+	Node baz2 = Node.createURI("http://example.org/#baz2");
+
+	Node foo3 = Node.createURI("http://example.org/#foo3");
+	Node bar3 = Node.createURI("http://example.org/#bar3");
+	Node baz3 = Node.createURI("http://example.org/#baz3");
+
+	List triples1 = new ArrayList();
+	triples1.add(new Triple(foo1, bar1, baz1));
+	triples1.add(new Triple(foo2, bar2, baz2));
+	triples1.add(new Triple(foo3, bar3, baz3));
+
+	List triples2 = new ArrayList();
+	triples2.add(new Triple(foo1, bar1, baz1));
+	triples2.add(new Triple(foo2, bar2, baz2));
+
+	VirtGraph graph = new VirtGraph ("Example7", url, "dba", "dba");
+
+	graph.clear ();
+
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+	System.out.println("Add List with 3 triples to graph <Example7> via BulkUpdateHandler.");
+
+	graph.getBulkUpdateHandler().add(triples1);
+
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+	System.out.println("graph.getCount() = " + graph.getCount());
+
+	ExtendedIterator iter = graph.find(Node.ANY, Node.ANY, Node.ANY);
+	System.out.println ("\ngraph.find(Node.ANY, Node.ANY, Node.ANY) \nResult:");
+	for ( ; iter.hasNext() ; )
+	    System.out.println ((Triple) iter.next());
+
+
+	System.out.println("\n\nDelete List of 2 triples from graph <Example7> via BulkUpdateHandler.");
+
+	graph.getBulkUpdateHandler().delete(triples2);
+
+	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+	System.out.println("graph.getCount() = " + graph.getCount());
+
+	iter = graph.find(Node.ANY, Node.ANY, Node.ANY);
+	System.out.println ("\ngraph.find(Node.ANY, Node.ANY, Node.ANY) \nResult:");
+	for ( ; iter.hasNext() ; )
+	    System.out.println ((Triple) iter.next());
+
+	graph.clear ();
+	System.out.println("\nCLEAR graph <Example7>");
+
+    }
+}
 ]]></programlisting>
-      </listitem>
-    </orderedlist>
     </sect4>
-    </sect3>
-    <sect3 id="rdfnativestorageprovidersjenaexamples"><title>Examples</title>
-    <sect4 id="rdfnativestorageprovidersjenaexamples1"><title>VirtJenaSPARQLExample1</title>
+    <sect4 id="rdfnativestorageprovidersjenaexamples8"><title>VirtJenaSPARQLExample8</title>
 <programlisting><![CDATA[
 import com.hp.hpl.jena.query.*;
 import com.hp.hpl.jena.rdf.model.RDFNode;
 
 import virtuoso.jena.driver.*;
 
-public class VirtuosoSPARQLExample1 {
+public class VirtuosoSPARQLExample8 {
 
 	/**
 	 * Executes a SPARQL query against a virtuoso url and prints results.
@@ -36351,37 +21129,68 @@ public class VirtuosoSPARQLExample1 {
 		VirtGraph set = new VirtGraph (url, "dba", "dba");
 
 /*			STEP 2			*/
+System.out.println("\nexecute: CLEAR GRAPH <http://test1>");
+                String str = "CLEAR GRAPH <http://test1>";
+                VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(str, set);
+                vur.exec();
 
+System.out.println("\nexecute: INSERT INTO GRAPH <http://test1> { <aa> <bb> 'cc' . <aa1> <bb1> 123. }");
+                str = "INSERT INTO GRAPH <http://test1> { <aa> <bb> 'cc' . <aa1> <bb1> 123. }";
+                vur = VirtuosoUpdateFactory.create(str, set);
+                vur.exec();
 
 /*			STEP 3			*/
 /*		Select all data in virtuoso	*/
-		Query sparql = QueryFactory.create("SELECT * WHERE { GRAPH ?graph { ?s ?p ?o } } limit 100");
+System.out.println("\nexecute: SELECT * FROM <http://test1> WHERE { ?s ?p ?o }");
+		Query sparql = QueryFactory.create("SELECT * FROM <http://test1> WHERE { ?s ?p ?o }");
 
 /*			STEP 4			*/
 		VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
 
 		ResultSet results = vqe.execSelect();
 		while (results.hasNext()) {
-			QuerySolution result = results.nextSolution();
-		    RDFNode graph = result.get("graph");
-		    RDFNode s = result.get("s");
-		    RDFNode p = result.get("p");
-		    RDFNode o = result.get("o");
-		    System.out.println(graph + " { " + s + " " + p + " " + o + " . }");
-		}
-	}
-}
+			QuerySolution rs = results.nextSolution();
+		    RDFNode s = rs.get("s");
+		    RDFNode p = rs.get("p");
+		    RDFNode o = rs.get("o");
+		    System.out.println(" { " + s + " " + p + " " + o + " . }");
+    }
+
+
+System.out.println("\nexecute: DELETE FROM GRAPH <http://test1> { <aa> <bb> 'cc' }");
+                str = "DELETE FROM GRAPH <http://test1> { <aa> <bb> 'cc' }";
+                vur = VirtuosoUpdateFactory.create(str, set);
+                vur.exec();
+
+System.out.println("\nexecute: SELECT * FROM <http://test1> WHERE { ?s ?p ?o }");
+		vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
+                results = vqe.execSelect();
+		while (results.hasNext()) {
+			QuerySolution rs = results.nextSolution();
+		    RDFNode s = rs.get("s");
+		    RDFNode p = rs.get("p");
+		    RDFNode o = rs.get("o");
+		    System.out.println(" { " + s + " " + p + " " + o + " . }");
+    }
 
+
+}
+}
 ]]></programlisting>
     </sect4>
-    <sect4 id="rdfnativestorageprovidersjenaexamples2"><title>VirtJenaSPARQLExample2</title>
+    <sect4 id="rdfnativestorageprovidersjenaexamples9"><title>VirtJenaSPARQLExample9</title>
 <programlisting><![CDATA[
 import com.hp.hpl.jena.query.*;
 import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.rdf.model.*;
+import java.util.Iterator;
 
 import virtuoso.jena.driver.*;
 
-public class VirtuosoSPARQLExample2 {
+public class VirtuosoSPARQLExample9 {
 
 	/**
 	 * Executes a SPARQL query against a virtuoso url and prints results.
@@ -36395,1764 +21204,2692 @@ public class VirtuosoSPARQLExample2 {
 		    url = args[0];
 
 /*			STEP 1			*/
-		VirtGraph graph = new VirtGraph ("Example2", url, "dba", "dba");
+		VirtGraph set = new VirtGraph (url, "dba", "dba");
 
 /*			STEP 2			*/
-/*		Load data to Virtuoso		*/
-		graph.clear ();
+                String str = "CLEAR GRAPH <http://test1>";
+                VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(str, set);
+                vur.exec();
 
-		System.out.print ("Begin read from 'http://www.w3.org/People/Berners-Lee/card#i'  ");
-		graph.read("http://www.w3.org/People/Berners-Lee/card#i", "RDF/XML");
-		System.out.println ("\t\t\t Done.");
+                str = "INSERT INTO GRAPH <http://test1> { <http://aa> <http://bb> 'cc' . <http://aa1> <http://bb> 123. }";
+                vur = VirtuosoUpdateFactory.create(str, set);
+                vur.exec();
 
-		System.out.print ("Begin read from 'http://demo.openlinksw.com/dataspace/person/demo#this'  ");
-		graph.read("http://demo.openlinksw.com/dataspace/person/demo#this", "RDF/XML");
-		System.out.println ("\t Done.");
 
-		System.out.print ("Begin read from 'http://kidehen.idehen.net/dataspace/person/kidehen#this'  ");
-		graph.read("http://kidehen.idehen.net/dataspace/person/kidehen#this", "RDF/XML");
-		System.out.println ("\t Done.");
+/*		Select all data in virtuoso	*/
+		Query sparql = QueryFactory.create("SELECT * FROM <http://test1> WHERE { ?s ?p ?o }");
+		VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
+		ResultSet results = vqe.execSelect();
+                System.out.println("\nSELECT results:");
+		while (results.hasNext()) {
+			QuerySolution rs = results.nextSolution();
+		    RDFNode s = rs.get("s");
+		    RDFNode p = rs.get("p");
+		    RDFNode o = rs.get("o");
+		    System.out.println(" { " + s + " " + p + " " + o + " . }");
+}
+
+		sparql = QueryFactory.create("DESCRIBE <http://aa> FROM <http://test1>");
+		vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
+
+		Model model = vqe.execDescribe();
+ 	        Graph g = model.getGraph();
+                System.out.println("\nDESCRIBE results:");
+	        for (Iterator i = g.find(Node.ANY, Node.ANY, Node.ANY); i.hasNext();)
+{
+	              Triple t = (Triple)i.next();
+		      System.out.println(" { " + t.getSubject() + " " +
+		      				 t.getPredicate() + " " +
+		      				 t.getObject() + " . }");
+	        }
+
+
+
+		sparql = QueryFactory.create("CONSTRUCT { ?x <http://test> ?y } FROM <http://test1> WHERE { ?x <http://bb> ?y }");
+		vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
+
+		model = vqe.execConstruct();
+ 	        g = model.getGraph();
+                System.out.println("\nCONSTRUCT results:");
+	        for (Iterator i = g.find(Node.ANY, Node.ANY, Node.ANY); i.hasNext();)
+    {
+	              Triple t = (Triple)i.next();
+		      System.out.println(" { " + t.getSubject() + " " +
+		      				 t.getPredicate() + " " +
+		      				 t.getObject() + " . }");
+	        }
+
+
+		sparql = QueryFactory.create("ASK FROM <http://test1> WHERE { <http://aa> <http://bb> ?y }");
+		vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
+
+		boolean res = vqe.execAsk();
+                System.out.println("\nASK results: "+res);
+
+
+    }
+}
+]]></programlisting>
+    </sect4>
+    </sect3>
+    <sect3 id="rdfnativestorageprovidersjenajavadoc"><title>Javadoc API Documentation</title>
+    <para><ulink url="http://docs.openlinksw.com/jena/">Jena Provider Javadoc API Documentation</ulink> is available enabling the complete set of classes, interfaces and methods implemented for the provider to be viewed.
+</para>
+    </sect3>
+</sect2>  
+  <sect2 id="rdfnativestorageproviderssesame"><title>Virtuoso Sesame Provider</title>
+    <sect3 id="rdfnativestorageproviderssesamewhatis"><title>What is Sesame</title>
+      <para>Sesame is an open source Java framework for storing, querying and reasoning with RDF and RDF Schema. It can be used as a database for RDF and RDF Schema, or as a Java library for applications that need to work with RDF internally. For example, suppose you need to read a big RDF file, find the relevant information for your application, and use that information. Sesame provides you with the necessary tools to parse, interpret, query and store all this information, embedded in your own application if you want, or, if you prefer, in a separate database or even on a remote server. More generally: Sesame provides an application developer a toolbox that contains useful hammers screwdrivers etc. for doing 'Do-It-Yourself' with RDF.
+    </para>
+    </sect3>
+    <sect3 id="rdfnativestorageproviderssesamewhatisvirtuososesameprovider"><title>What is the Virtuoso Sesame Provider</title>
+    <para>The Virtuoso Sesame Provider is a fully operational Native Graph Model Storage Providers for the Sesame Framework, allowing users of Virtuoso to leverage the Sesame framework for modifying, querying, and reasoning with the Virtuoso quad store using the Java language. The Sesame Repository API offers a central access point for connecting to the Virtuoso quad store. Its purpose is to provides a java-friendly access point to Virtuoso. It offers various methods for querying and updating the data, while abstracting the details of the underlying machinery. The Provider has been tested against the <ulink url="http://sourceforge.net/project/showfiles.php?group_id=46509&package_id=168413">Sesame 2.1.2</ulink> version currently available.
+    </para>
+    <figure id="rdfnativestorageproviderssesame1" float="1">
+      <title>Fig. 1 Sesame Component Stack</title>
+      <graphic fileref="ui/VirtSesame2Provider.png"/>
+    </figure>
+    <para>If you need more information about how to set up your environment for working with the Sesame APIs, take a look at Chapter 4 of the Sesame User Guide, <ulink url="http://www.openrdf.org/doc/sesame2/users/RDF">Setting up to use the Sesame libraries</ulink>.
+    </para>
+    </sect3>
+    <sect3 id="rdfnativestorageproviderssesamesetup"><title>Setup</title>
+    <sect4 id="rdfnativestorageproviderssesamereqfiles"><title>Required Files</title>
+    <para>This tutorial assumes you have Virtuoso server installed and that the database is accessible at "localhost:1111". In addition, you will need the latest version of the Virtuoso Sesame Provider, and Sesame 2 or greater installed.
+    <para>You should download the Virtuoso Sesame 2 Provider JAR archive, Virtuoso JDBC Driver, Sesame Framework and associated classes and sample programs from our <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VOSDownload">download page</ulink></para>
+    </para>
+    </sect4>
+    <sect4 id="rdfnativestorageproviderssesamecmppr"><title>Compiling Sesame Sample Program</title>
+    <orderedlist>
+      <listitem>Ensure that full paths to the following files are all included in the active CLASSPATH setting --
+    <itemizedlist mark="bullet">
+      <listitem>openrdf-sesame-2.1.2-onejar.jar</listitem>
+      <listitem>slf4j-api-1.5.0.jar</listitem>
+      <listitem>slf4j-jdk14-1.5.0.jar</listitem>
+      <listitem>virtjdbc3.jar</listitem>
+      <listitem>virt_sesame2.jar</listitem>
+   </itemizedlist>
+      </listitem>
+      <listitem>Execute the following command:
+<programlisting><![CDATA[
+javac VirtuosoTest.java
+]]></programlisting>
+      <para>Note: to use utf-8 and to use row auto commit is recommended to add the following to the connect string: 
+      </para>
+<programlisting><![CDATA[
+"/charset=UTF-8/log_enable=2"
+-- i.e. in VirtuosoTest.java the line:
+Repository repository = new VirtuosoRepository("jdbc:virtuoso://" + sa[0] + ":" + sa[1], sa[2], sa[3]);
+-- should become:
+Repository repository = new VirtuosoRepository("jdbc:virtuoso://" + sa[0] + ":" + sa[1]+ "/charset=UTF-8/log_enable=2", sa[2], sa[3]);
+]]></programlisting>
+      </listitem>
+    </orderedlist>
+    </sect4>
+    <sect4 id="rdfnativestorageproviderssesametesting"><title>Testing</title>
+    <orderedlist>
+      <listitem>Ensure that full paths to the following files are all included in the active CLASSPATH setting:
+    <itemizedlist mark="bullet">
+      <listitem>openrdf-sesame-2.1.2-onejar.jar</listitem>
+      <listitem>slf4j-api-1.5.0.jar</listitem>
+      <listitem>slf4j-jdk14-1.5.0.jar</listitem>
+      <listitem>virtjdbc3.jar</listitem>
+      <listitem>virt_sesame2.jar</listitem>
+      <listitem>virtuoso_driver</listitem>
+    </itemizedlist>
+      </listitem>
+      <listitem>Run the <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSesame2Provider?att=VirtuosoTest.java">VirtuosoTest</ulink> program to test the Sesame 2 Provider with the following command:
+<programlisting><![CDATA[
+java VirtuosoTest <hostname> <port> <uid> <pwd>
+]]></programlisting>
+      </listitem>
+      <listitem>The test run should look like this:
+<programlisting><![CDATA[
+$ java VirtuosoTest localhost 1111 dba dba
+
+== TEST 1:  : Start
+   Loading data from URL: http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com/foaf.rdf
+== TEST 1:  : End
+PASSED: TEST 1
+
+== TEST 2:  : Start
+   Clearing triple store
+== TEST 2:  : End
+PASSED: TEST 2
+
+== TEST 3:  : Start
+   Loading data from file: virtuoso_driver/data.nt
+== TEST 3:  : End
+PASSED: TEST 3
 
+== TEST 4:  : Start
+   Loading UNICODE single triple
+== TEST 4:  : End
+PASSED: TEST 4
 
-/*			STEP 3			*/
-/*		Select only from VirtGraph	*/
-		Query sparql = QueryFactory.create("SELECT ?s ?p ?o WHERE { ?s ?p ?o }");
+== TEST 5:  : Start
+   Loading single triple
+== TEST 5:  : End
+PASSED: TEST 5
 
-/*			STEP 4			*/
-		VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, graph);
+== TEST 6:  : Start
+   Casted value type
+== TEST 6:  : End
+PASSED: TEST 6
 
-		ResultSet results = vqe.execSelect();
-		while (results.hasNext()) {
-			QuerySolution result = results.nextSolution();
-		    RDFNode graph_name = result.get("graph");
-		    RDFNode s = result.get("s");
-		    RDFNode p = result.get("p");
-		    RDFNode o = result.get("o");
-		    System.out.println(graph_name + " { " + s + " " + p + " " + o + " . }");
-		}
+== TEST 7:  : Start
+   Selecting property
+== TEST 7:  : End
+PASSED: TEST 7
 
-		System.out.println("graph.getCount() = " + graph.getCount());
-	}
-}
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfnativestorageprovidersjenaexamples3"><title>VirtJenaSPARQLExample3</title>
-<programlisting><![CDATA[
-import java.util.*;
+== TEST 8:  : Start
+   Statement does not exists
+== TEST 8:  : End
+PASSED: TEST 8
 
-import com.hp.hpl.jena.query.*;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.graph.Triple;
+== TEST 9:  : Start
+   Statement exists (by resultset size)
+== TEST 9:  : End
+PASSED: TEST 9
 
-import virtuoso.jena.driver.*;
+== TEST 10:  : Start
+   Statement exists (by hasStatement())
+== TEST 10:  : End
+PASSED: TEST 10
 
-public class VirtuosoSPARQLExample3
-{
-    public static void main(String[] args)
-    {
-	String url;
+== TEST 11:  : Start
+   Retrieving namespaces
+== TEST 11:  : End
+PASSED: TEST 11
 
-	if(args.length == 0)
-	    url = "jdbc:virtuoso://localhost:1111";
-	else
-	    url = args[0];
+== TEST 12:  : Start
+   Retrieving statement (http://myopenlink.net/dataspace/person/kidehen http://myopenlink.net/foaf/name null)
+== TEST 12:  : End
+PASSED: TEST 12
 
-	Node foo1 = Node.createURI("http://example.org/#foo1");
-	Node bar1 = Node.createURI("http://example.org/#bar1");
-	Node baz1 = Node.createURI("http://example.org/#baz1");
+== TEST 13:  : Start
+   Writing the statements to file: (/Users/hughwilliams/src/virtuoso-opensource/binsrc/sesame2/results.n3.txt)
+== TEST 13:  : End
+PASSED: TEST 13
 
-	Node foo2 = Node.createURI("http://example.org/#foo2");
-	Node bar2 = Node.createURI("http://example.org/#bar2");
-	Node baz2 = Node.createURI("http://example.org/#baz2");
+== TEST 14:  : Start
+   Retrieving graph ids
+== TEST 14:  : End
+PASSED: TEST 14
 
-	Node foo3 = Node.createURI("http://example.org/#foo3");
-	Node bar3 = Node.createURI("http://example.org/#bar3");
-	Node baz3 = Node.createURI("http://example.org/#baz3");
+== TEST 15:  : Start
+   Retrieving triple store size
+== TEST 15:  : End
+PASSED: TEST 15
 
-	List <Triple> triples = new ArrayList <Triple> ();
+== TEST 16:  : Start
+   Sending ask query
+== TEST 16:  : End
+PASSED: TEST 16
 
-	VirtGraph graph = new VirtGraph ("Example3", url, "dba", "dba");
+== TEST 17:  : Start
+   Sending construct query
+== TEST 17:  : End
+PASSED: TEST 17
 
-	graph.clear ();
+== TEST 18:  : Start
+   Sending describe query
+== TEST 18:  : End
+PASSED: TEST 18
 
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
-	System.out.println("Add 3 triples to graph <Example3>.");
+============================
+PASSED:18 FAILED:0
+]]></programlisting>
+      </listitem>
+    </orderedlist>
+    </sect4>
+    </sect3>
+    <sect3 id="rdfnativestorageproviderssesamegettingstarted"><title>Getting Started</title>
+    <para>This section covers the essentials for connecting to and manipulating data stored in a Virtuoso repository using the Sesame API. More information on the Sesame Framework, including extended examples on how to use the API, can be found in Chapter 8 of the Sesame User's guide, 
+<ulink url="http://www.openrdf.org/doc/sesame2/2.1.2/users/ch08.html#d0e833">the RepositoryConnection API</ulink>.
+    </para>
+    <para>The interfaces for the Repository API can be found in packages virtuoso.sesame2.driver and org.openrdf.repository. Several implementations for these interface exist in the Virtuoso Provider download package. The 
+    	<ulink url="http://www.openrdf.org/doc/sesame2/2.1.2/apidocs/">Javadoc reference for the Sesame API</ulink>
+is available online and can also be found in the doc directory of the download.
+    </para>
+    <sect4 id="rdfnativestorageproviderssesamegettingstartedcrrep"><title>Creating a VirtuosoRepositoryRDF object</title>
+      <para>The first step to connecting to Virtuoso through the Sesame API is to create a Repository for it. The Repository object operates on (stacks of) Sail object(s) for storage and retrieval of RDF data.
+      </para>
+      <para>One of the simplest configurations is a repository that just stores RDF data in main memory without applying any inference or whatsoever. This is also by far the fastest type of repository that can be used. The following code creates and initialize a non-inferencing main-memory repository:
+      </para>
+<programlisting><![CDATA[
+import virtuoso.sesame2.driver.VirtuosoRepository;
 
-	graph.add(new Triple(foo1, bar1, baz1));
-	graph.add(new Triple(foo2, bar2, baz2));
-	graph.add(new Triple(foo3, bar3, baz3));
+Repository myRepository = VirtuosoRepository("jdbc:virtuoso://localhost:1111”,”dba”,”dba”);
 
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
-	System.out.println("graph.getCount() = " + graph.getCount());
+myRepository.initialize();
+]]></programlisting>
+      <para>The constructor of the VirtuosoRepository class accepts the JDBC URL of the Virtuoso engine (the default port is 1111), the username and password of an authorized user. Following this example, the repository needs to be initialized to prepare the Sail(s) that it operates on, which includes operations such as restoring previously stored data, setting up connections to a relational database, etc.
+      </para>
+      <para>The repository that is created by the above code is volatile: its contents are lost when the object is garbage collected or when the program is shut down. This is fine for cases where, for example, the repository is used as a means for manipulating an RDF model in memory.
+      </para>
+    </sect4>
+    <sect4 id="rdfnativestorageproviderssesamegettingstartedrdfvirtcr"><title>Creating a Virtuoso Repository Connection</title>
+      <para>Now that we have created a VirtuosoRepository object instance, we want to do something 
+      	with it. This is achieved through the use of the VirtuosoRepositoryConnection class, which 
+      	can be created by the VirtuosoRepository class.
+      </para>
+      <para>A VirtuosoRepositoryConnection represents - as the name suggests - a connection to the 
+      	actual Virtuoso quad store. We can issue operations over this connection, and close it when 
+      	we are done to make sure we are not keeping resources unnecessarily occupied.
+      </para>
+      <para>In the following sections, we will show some examples of basic operations using the Northwind dataset.
+      </para>
+    </sect4>
+    <sect4 id="rdfnativestorageproviderssesamegettingstartedrdfvirt"><title>Adding RDF to Virtuoso</title>
+      <para>The Repository implements the Sesame Repository API offers various methods for adding data to a repository. Data can be added pro grammatically by specifying the location of a file that contains RDF data, and statements can be added individually or in collections.
+      </para>
+      <para>We perform operations on the repository by requesting a RepositoryConnection from the 
+      	repository, which returns a VirtuosoRepositoryConnection object. On this 
+      	VirtuosoRepositoryConnection object we can perform the various operations, such as query 
+      	evaluation, getting, adding, or removing statements, etc.
+      </para>
+      <para>The following example code adds two files, one local and one located on the WWW, to a repository:
+      </para>
+<programlisting><![CDATA[
+import org.openrdf.repository.RepositoryException;
 
-	triples.add(new Triple(foo1, bar1, baz1));
-	triples.add(new Triple(foo2, bar2, baz2));
+import org.openrdf.repository.Repository;
 
-	graph.isEmpty();
+import org.openrdf.repository.RepositoryConnection;
 
-	System.out.println("Remove 2 triples from graph <Example3>");
-	graph.remove(triples);
-	System.out.println("graph.getCount() = " + graph.getCount());
-	System.out.println("Please check result with isql tool.");
+import org.openrdf.rio.RDFFormat;
 
-	/* EXPECTED RESULT:
+import java.io.File;
 
-SQL> SPARQL
-SELECT ?s ?p ?o
-FROM <Example3>
-WHERE {?s ?p ?o};
-s                                                    p                                                             o
-VARCHAR                                    VARCHAR                                              VARCHAR
-_______________________________________________________________________________
+import java.net.URL;
 
-http://example.org/#foo3              http://example.org/#bar3                         http://example.org/#baz3
+File file = new File("/path/to/example.rdf");
 
-1 Rows. -- 26 msec.
-SQL>
+String baseURI = "http://example.org/example/localRDF";
 
-*/
+?
 
-	}
-}
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfnativestorageprovidersjenaexamples4"><title>VirtJenaSPARQLExample4</title>
-<programlisting><![CDATA[
-import java.util.*;
+try {
 
-import com.hp.hpl.jena.query.*;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.graph.Triple;
+   RepositoryConnection con = myRepository.getConnection();
 
-import virtuoso.jena.driver.*;
+   try {
 
-public class VirtuosoSPARQLExample4
-{
+      con.add(file, baseURI, RDFFormat.RDFXML);
 
-    public static void main(String[] args)
-    {
-	String url;
-	if(args.length == 0)
-	    url = "jdbc:virtuoso://localhost:1111";
-	else
-	    url = args[0];
+      URL url = new URL("http://example.org/example/remoteRDF");
 
-	Node foo1 = Node.createURI("http://example.org/#foo1");
-	Node bar1 = Node.createURI("http://example.org/#bar1");
-	Node baz1 = Node.createURI("http://example.org/#baz1");
+      con.add(url, url.toString(), RDFFormat.RDFXML);
 
-	Node foo2 = Node.createURI("http://example.org/#foo2");
-	Node bar2 = Node.createURI("http://example.org/#bar2");
-	Node baz2 = Node.createURI("http://example.org/#baz2");
+	}
 
-	Node foo3 = Node.createURI("http://example.org/#foo3");
-	Node bar3 = Node.createURI("http://example.org/#bar3");
-	Node baz3 = Node.createURI("http://example.org/#baz3");
+   finally {
 
-	VirtGraph graph = new VirtGraph ("Example4", url, "dba", "dba");
+      con.close();
 
-	graph.clear ();
+   }
 
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+}
 
-	System.out.println("Add 3 triples to graph <Example4>.");
+catch (RepositoryException rex) {
 
-	graph.add(new Triple(foo1, bar1, baz1));
-	graph.add(new Triple(foo2, bar2, baz2));
-	graph.add(new Triple(foo3, bar3, baz3));
+   // handle exception
 
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
-	System.out.println("graph.getCount() = " + graph.getCount());
+}
 
-	System.out.println ("graph.contains(new Triple(foo2, bar2, baz2) - " + graph.contains(new Triple(foo2, bar2, baz2)));
-	System.out.println ("graph.contains(new Triple(foo2, bar2, baz3) - " + graph.contains(new Triple(foo2, bar2, baz3)));
+catch (java.io.IOEXception e) {
 
-	graph.clear ();
+   // handle io exception
 
     }
-}
 ]]></programlisting>
+      <para>More information on other available methods can be found in the javadoc
+reference of the RepositoryConnection interface.
+      </para>
     </sect4>
-    <sect4 id="rdfnativestorageprovidersjenaexamples5"><title>VirtJenaSPARQLExample5</title>
+    <sect4 id="rdfnativestorageproviderssesamegettingstartedqr"><title>Querying Virtuoso</title>
+      <para>The Repository API has a number of methods for creating and evaluating queries. Three types of queries are distinguished: tuple queries, graph queries and boolean queries. The query types differ in the type of results that they produce.
+      </para>
+      <para><emphasis>Select Query:</emphasis> The result of a select query is a set of tuples (or 
+      variable bindings), where each tuple represents a solution of a query. This type of query is 
+      commonly used to get specific values (URIs, blank nodes, literals) from the stored RDF data. 
+      The method QueryFactory.executeQuery() returns a Value [ ][ ] for sparql “SELECT” queries. 
+The method QueryFactory.executeQuery() also calls the QueryFactory.setResult() which populates
+a set of tuples for SPARQL "SELECT" queries. The graph can be retrieved using
+QueryFactory.getBooleanResult().
+      </para>
+      <para><emphasis>Graph Query:</emphasis> The result of graph queries is an RDF graph (or set of statements). This type of query is very useful for extracting sub-graphs from the stored RDF data, which can then be queried further, serialized to an RDF document, etc. The method QueryFactory.executeQuery() calls the QueryFactory.setGraphResult() which populates a graph for SPARQL “DESCRIBE” and “CONSTRUCT” queries. The graph can be retrieved using QueryFactory.getGraphResult().
+      </para>
+      <para><emphasis>Boolean Query:</emphasis> The result of boolean queries is a simple boolean value, i.e. true of false. This type of query can be used to check if a repository contains specific information. The method QueryFactory.executeQuery() calls the QueryFactory.setBooleanResult() which sets a boolean value for sparql "ASK" queries. The value can be retrieved using QueryFactory.getBooleanResult().
+      </para>
+      <para>Note: Although Sesame 2 currently supports two query languages: SeRQL and SPARQL, the Virtuoso provider only supports the W3C SPARQL specification. 
+      </para>
+    </sect4>
+    <sect4 id="rdfnativestorageproviderssesamegettingstartevq"><title>Evaluating a SELECT Query</title>
+      <para>To evaluate a tuple query we simply do the following:
+      </para>
 <programlisting><![CDATA[
-import java.util.*;
+import java.util.List;
 
-import com.hp.hpl.jena.query.*;
-import com.hp.hpl.jena.util.iterator.ExtendedIterator;
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.graph.Triple;
+import org.openrdf.OpenRDFException;
 
-import virtuoso.jena.driver.*;
+import org.openrdf.repository.RepositoryConnection;
 
-public class VirtuosoSPARQLExample5
-{
+import org.openrdf.query.TupleQuery;
 
-    public static void main(String[] args)
-    {
-	String url;
-	if(args.length == 0)
-	    url = "jdbc:virtuoso://localhost:1111";
-	else
-	    url = args[0];
+import org.openrdf.query.TupleQueryResult;
 
-	Node foo1 = Node.createURI("http://example.org/#foo1");
-	Node bar1 = Node.createURI("http://example.org/#bar1");
-	Node baz1 = Node.createURI("http://example.org/#baz1");
+import org.openrdf.query.BindingSet;
 
-	Node foo2 = Node.createURI("http://example.org/#foo2");
-	Node bar2 = Node.createURI("http://example.org/#bar2");
-	Node baz2 = Node.createURI("http://example.org/#baz2");
+import org.openrdf.query.QueryLanguage;
 
-	Node foo3 = Node.createURI("http://example.org/#foo3");
-	Node bar3 = Node.createURI("http://example.org/#bar3");
-	Node baz3 = Node.createURI("http://example.org/#baz3");
+?
 
-	VirtGraph graph = new VirtGraph ("Example5", url, "dba", "dba");
+try {
 
-	graph.clear ();
+   RepositoryConnection con = myRepository.getConnection();
 
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+   try {
 
-	System.out.println("Add 3 triples to graph <Example5>.");
+      String queryString = "SELECT x, y FROM  WHERE {x} p {y}";
 
-	graph.add(new Triple(foo1, bar1, baz1));
-	graph.add(new Triple(foo2, bar2, baz2));
-	graph.add(new Triple(foo3, bar3, baz3));
-	graph.add(new Triple(foo1, bar2, baz2));
-	graph.add(new Triple(foo1, bar3, baz3));
+      TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
 
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
-	System.out.println("graph.getCount() = " + graph.getCount());
+      TupleQueryResult result = tupleQuery.evaluate();
 
-	ExtendedIterator iter = graph.find(foo1, Node.ANY, Node.ANY);
-	System.out.println ("\ngraph.find(foo1, Node.ANY, Node.ANY) \nResult:");
-	for ( ; iter.hasNext() ; )
-	    System.out.println ((Triple) iter.next());
+      try {
 
-	iter = graph.find(Node.ANY, Node.ANY, baz3);
-	System.out.println ("\ngraph.find(Node.ANY, Node.ANY, baz3) \nResult:");
-	for ( ; iter.hasNext() ; )
-	    System.out.println ((Triple) iter.next());
+         ? // do something with the result
 
-	iter = graph.find(foo1, Node.ANY, baz3);
-	System.out.println ("\ngraph.find(foo1, Node.ANY, baz3) \nResult:");
-	for ( ; iter.hasNext() ; )
-	    System.out.println ((Triple) iter.next());
+      }
 
-	graph.clear ();
+      finally {
+
+         result.close();
 
     }
+
 }
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfnativestorageprovidersjenaexamples6"><title>VirtJenaSPARQLExample6</title>
-<programlisting><![CDATA[
-import java.util.*;
 
-import com.hp.hpl.jena.query.*;
-import com.hp.hpl.jena.util.iterator.ExtendedIterator;
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.graph.Triple;
+   finally {
 
-import virtuoso.jena.driver.*;
+      con.close();
 
-public class VirtuosoSPARQLExample6
-{
+   }
 
-    public static void main(String[] args)
-    {
-	String url;
-	if(args.length == 0)
-	    url = "jdbc:virtuoso://localhost:1111";
-	else
-	    url = args[0];
+}
 
-	Node foo1 = Node.createURI("http://example.org/#foo1");
-	Node bar1 = Node.createURI("http://example.org/#bar1");
-	Node baz1 = Node.createURI("http://example.org/#baz1");
+catch (RepositoryException e) {
 
-	Node foo2 = Node.createURI("http://example.org/#foo2");
-	Node bar2 = Node.createURI("http://example.org/#bar2");
-	Node baz2 = Node.createURI("http://example.org/#baz2");
+   // handle exception
 
-	Node foo3 = Node.createURI("http://example.org/#foo3");
-	Node bar3 = Node.createURI("http://example.org/#bar3");
-	Node baz3 = Node.createURI("http://example.org/#baz3");
+}
+]]></programlisting>
+      <para>This evaluates a SPARQL query and returns a TupleQueryResult, which consists of a sequence 
+      	of BindingSet objects. Each BindingSet contains a set of pairs called Binding objects. A 
+      	Binding object represents a name/value pair for each variable in the query's projection.
+      </para>
+      <para>We can use the TupleQueryResult to iterate over all results and get each individual result for x and y:
+      </para>
+<programlisting><![CDATA[
+while (result.hasNext()) {
 
-	VirtGraph graph = new VirtGraph ("Example6", url, "dba", "dba");
+   BindingSet bindingSet = result.next();
 
-	graph.clear ();
+   Value valueOfX = bindingSet.getValue("x");
 
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+   Value valueOfY = bindingSet.getValue("y");
 
-	System.out.println("test Transaction Commit.");
-	graph.getTransactionHandler().begin();
-	System.out.println("begin Transaction.");
-	System.out.println("Add 3 triples to graph <Example6>.");
+   // do something interesting with the query variable values here?
 
-	graph.add(new Triple(foo1, bar1, baz1));
-	graph.add(new Triple(foo2, bar2, baz2));
-	graph.add(new Triple(foo3, bar3, baz3));
+}
+]]></programlisting>
+      <para>As you can see, we retrieve values by name rather than by an index. The names used should be the names of variables as specified in your query. The TupleQueryResult.getBindingNames() method returns a list of binding names, in the order in which they were specified in the query. To process the bindings in each binding set in the order specified by the projection, you can do the following:
+      </para>
+<programlisting><![CDATA[
+List bindingNames = result.getBindingNames();
 
-	graph.getTransactionHandler().commit();
-	System.out.println("commit Transaction.");
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
-	System.out.println("graph.getCount() = " + graph.getCount());
+while (result.hasNext()) {
 
-	ExtendedIterator iter = graph.find(Node.ANY, Node.ANY, Node.ANY);
-	System.out.println ("\ngraph.find(Node.ANY, Node.ANY, Node.ANY) \nResult:");
-	for ( ; iter.hasNext() ; )
-	    System.out.println ((Triple) iter.next());
+   BindingSet bindingSet = result.next();
 
-	graph.clear ();
-	System.out.println("\nCLEAR graph <Example6>");
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
+   Value firstValue = bindingSet.getValue(bindingNames.get(0));
 
-	System.out.println("Add 1 triples to graph <Example6>.");
-	graph.add(new Triple(foo1, bar1, baz1));
+   Value secondValue = bindingSet.getValue(bindingNames.get(1));
 
-	System.out.println("test Transaction Abort.");
-	graph.getTransactionHandler().begin();
-	System.out.println("begin Transaction.");
-	System.out.println("Add 2 triples to graph <Example6>.");
+   // do something interesting with the values here?
 
-	graph.add(new Triple(foo2, bar2, baz2));
-	graph.add(new Triple(foo3, bar3, baz3));
+}
+]]></programlisting>
+      <para>It is important to invoke the close() operation on the TupleQueryResult, 
+      	after we are done with it. A TupleQueryResult evaluates lazily and keeps resources 
+      	(such as connections to the underlying database) open. Closing the TupleQueryResult 
+      	frees up these resources. Do not forget that iterating over a result may cause exceptions! 
+      	The best way to make sure no connections are kept open unnecessarily is to invoke close() 
+      	in the finally clause.
+      </para>
+      <para>An alternative to producing a TupleQueryResult is to supply an object that implements the 
+      	TupleQueryResultHandler interface to the query's evaluate() method. The main difference is 
+      	that when using a return object, the caller has control over when the next answer is retrieved, 
+      	whereas with the use of a handler, the connection simply pushes answers to the handler object 
+      	as soon as it has them available.
+      </para>
+      <para>As an example we will use SPARQLResultsXMLWriter, which is a TupleQueryResultHandler
+implementation that writes SPARQL Results XML documents to an output stream or to a writer:
+      </para>
+<programlisting><![CDATA[
+import org.openrdf.query.resultio.sparqlxml.SPARQLResultsXMLWriter;
 
-	graph.getTransactionHandler().abort();
-	System.out.println("abort Transaction.");
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
-	System.out.println("graph.getCount() = " + graph.getCount());
+?
 
-	iter = graph.find(Node.ANY, Node.ANY, Node.ANY);
-	System.out.println ("\ngraph.find(Node.ANY, Node.ANY, Node.ANY) \nResult:");
-	for ( ; iter.hasNext() ; )
-	    System.out.println ((Triple) iter.next());
+FileOutputStream out = new FileOutputStream("/path/to/result.srx");
 
-	graph.clear ();
-	System.out.println("\nCLEAR graph <Example6>");
+try {
 
-    }
-}
+   SPARQLResultsXMLWriter sparqlWriter = new SPARQLResultsXMLWriter(out);
 
+   RepositoryConnection con = myRepository.getConnection();
 
-]]></programlisting>
-    </sect4>
-    <sect4 id="rdfnativestorageprovidersjenaexamples7"><title>VirtJenaSPARQLExample7</title>
-<programlisting><![CDATA[
-import java.util.*;
+   try {
 
-import com.hp.hpl.jena.query.*;
-import com.hp.hpl.jena.util.iterator.ExtendedIterator;
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.graph.Triple;
+      String queryString = "SELECT * FROM  WHERE {x} p {y}";
 
-import virtuoso.jena.driver.*;
+      TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
 
-public class VirtuosoSPARQLExample7
-{
+      tupleQuery.evaluate(sparqlWriter);
 
-    public static void main(String[] args)
-    {
-	String url;
-	if(args.length == 0)
-	    url = "jdbc:virtuoso://localhost:1111";
-	else
-	    url = args[0];
+   }
 
-	Node foo1 = Node.createURI("http://example.org/#foo1");
-	Node bar1 = Node.createURI("http://example.org/#bar1");
-	Node baz1 = Node.createURI("http://example.org/#baz1");
+   finally {
 
-	Node foo2 = Node.createURI("http://example.org/#foo2");
-	Node bar2 = Node.createURI("http://example.org/#bar2");
-	Node baz2 = Node.createURI("http://example.org/#baz2");
+      con.close();
 
-	Node foo3 = Node.createURI("http://example.org/#foo3");
-	Node bar3 = Node.createURI("http://example.org/#bar3");
-	Node baz3 = Node.createURI("http://example.org/#baz3");
+   }
 
-	List triples1 = new ArrayList();
-	triples1.add(new Triple(foo1, bar1, baz1));
-	triples1.add(new Triple(foo2, bar2, baz2));
-	triples1.add(new Triple(foo3, bar3, baz3));
+}
 
-	List triples2 = new ArrayList();
-	triples2.add(new Triple(foo1, bar1, baz1));
-	triples2.add(new Triple(foo2, bar2, baz2));
+finally {
 
-	VirtGraph graph = new VirtGraph ("Example7", url, "dba", "dba");
+   out.close();
 
-	graph.clear ();
+}
+]]></programlisting>
+      <para>You can just as easily supply your own application-specific implementation of TupleQueryResultHandler though.
+      </para>
+      <para>Lastly, an important warning: as soon as you are done with the RepositoryConnection
+object, you should close it. Notice that during processing of the TupleQueryResult object
+      	(for example, when iterating over its contents), the RepositoryConnection should still be 
+      	open. We can invoke con.close() after we have finished with the result. 
+      </para>
+    </sect4>
+    <sect4 id="rdfnativestorageproviderssesamegettingstartevcnq"><title>Evaluating a CONSTRUCT query</title>
+      <para>The following code evaluates a graph query on a repository:
+      </para>
+<programlisting><![CDATA[
+import org.openrdf.query.GraphQueryResult;
 
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
-	System.out.println("Add List with 3 triples to graph <Example7> via BulkUpdateHandler.");
+GraphQueryResult graphResult = con.prepareGraphQuery(
 
-	graph.getBulkUpdateHandler().add(triples1);
+      QueryLanguage.SPARQL, "CONSTRUCT * FROM {x} p {y}").evaluate();
+]]></programlisting>
+      <para> A GraphQueryResult is similar to TupleQueryResult in that is an object that 
+      	iterates over the query results. However, for graph queries the query results are RDF 
+      	statements, so a GraphQueryResult iterates over Statement objects:
+      </para>
+<programlisting><![CDATA[
+while (graphResult.hasNext()) {
 
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
-	System.out.println("graph.getCount() = " + graph.getCount());
+   Statement st = graphResult.next();
 
-	ExtendedIterator iter = graph.find(Node.ANY, Node.ANY, Node.ANY);
-	System.out.println ("\ngraph.find(Node.ANY, Node.ANY, Node.ANY) \nResult:");
-	for ( ; iter.hasNext() ; )
-	    System.out.println ((Triple) iter.next());
+   // ? do something with the resulting statement here.
+
+
+}
+]]></programlisting>
+      <para>The TupleQueryResultHandler equivalent for graph queries is org.openrdf.rio.RDFHandler.
+      	Again, this is a generic interface, each object implementing it can process the reported RDF 
+      	statements in any way it wants.
+      </para>
+      <para>All writers from Rio (such as the RDFXMLWriter, TurtleWriter, TriXWriter, etc.) implement
+      	the RDFHandler interface. This allows them to be used in combination with querying quite easily. 
+      	In the following example, we use a TurtleWriter to write the result of a SPARQL graph query to 
+      	standard output in Turtle format:
+      </para>
+<programlisting><![CDATA[
+import org.openrdf.rio.turtle.TurtleWriter;
+
+?
+
+RepositoryConnection con = myRepository.getConnection();
 
+try {
 
-	System.out.println("\n\nDelete List of 2 triples from graph <Example7> via BulkUpdateHandler.");
+   TurtleWriter turtleWriter = new TurtleWriter(System.out);
 
-	graph.getBulkUpdateHandler().delete(triples2);
+   con.prepareGraphQuery(QueryLanguage.SPARQL, "CONSTRUCT * FROM  WHERE {x} p {y}").evaluate(turtleWriter);
 
-	System.out.println("graph.isEmpty() = " + graph.isEmpty());
-	System.out.println("graph.getCount() = " + graph.getCount());
+    }
 
-	iter = graph.find(Node.ANY, Node.ANY, Node.ANY);
-	System.out.println ("\ngraph.find(Node.ANY, Node.ANY, Node.ANY) \nResult:");
-	for ( ; iter.hasNext() ; )
-	    System.out.println ((Triple) iter.next());
+finally {
 
-	graph.clear ();
-	System.out.println("\nCLEAR graph <Example7>");
+   con.close();
 
-    }
 }
 ]]></programlisting>
+      <para>Again, note that as soon as we are done with the result of the query (either after iterating over the contents of the GraphQueryResult? or after invoking the RDFHandler), we invoke con.close() to close the connection and free resources.
+      </para>
     </sect4>
-    <sect4 id="rdfnativestorageprovidersjenaexamples8"><title>VirtJenaSPARQLExample8</title>
+    <sect4 id="rdfnativestorageproviderssesamegettingstartevcnqapi"><title>Javadoc API Documentation</title>
+      <para><ulink url="http://docs.openlinksw.com/sesame/">Sesame Provider Javadoc API Documentation</ulink> is available enabling the complete set of classes, interfaces and methods implemented for the provider to be viewed.</para>
+    </sect4>
+    </sect3>
+    <sect3 id="rdfnativestorageproviderssesamestpandtesting"><title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+      <sect4 id="rdfnativestorageproviderssesamestpandtestingwhat"><title>What</title>
+<para>Sesame is an open source Java framework for storing, querying and reasoning with RDF and RDF Schema. It can be used as a
+database for RDF and RDF Schema, or as a Java library for applications that need to work with RDF internally. The Sesame HTTP
+repository serves as a proxy for a RDF store hosted on a remote Sesame server, enabling the querying of the RDF store using
+the Sesame HTTP protocol.
+</para>
+      </sect4>
+      <sect4 id="rdfnativestorageproviderssesamestpandtestingwhy"><title>Why</title>
+<para>The Sesame HTTP repository endpoint provides users with the greater flexibility for manipulating the RDF store via a common
+interface. Sesame provides you with the necessary tools to parse, interpret, query and store all this information, embedded
+in your own application if you want, or, if you prefer, in a separate database or even on a remote server.
+</para>
+      </sect4>
+      <sect4 id="rdfnativestorageproviderssesamestpandtestinghow"><title>How</title>
+<para>To create a new Sesame HTTP repository, the Console needs to create such an RDF document and submit it to the SYSTEM
+repository. The Console uses so called repository configuration templates to accomplish this. Repository configuration templates
+are simple Turtle RDF files that describe a repository configuration, where some of the parameters are replaced with variables.
+The Console parses these templates and asks the user to supply values for the variables. The variables are then substituted with
+the specified values, which produces the required configuration data.
+</para>
+      </sect4>
+      <sect4 id="rdfnativestorageproviderssesamestpandtestingmain"><title>Setup and Testing</title>
+<para>This section details the steps required for configuring and testing a Virtuoso Sesame
+Repository, both using the HTTP and Console Sesame repositories.</para>
+      <sect5 id="rdfnativestorageproviderssesamestpandtestingreq"><title>Requirements</title>
+<itemizedlist mark="bullet">
+  <listitem><ulink url="http://www.openrdf.org/download.jsp">Sesame 2.3.1</ulink> or higher</listitem>
+  <listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSesame2HttpRepository/virt_sesame2.jar">Virtuoso Sesame 2 Provider </ulink> (virt_sesame2.jar)</listitem>
+  <listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSesame2HttpRepository/virtjdbc3.jar">Virtuoso JDBC Driver</ulink> (virtjdbc3.jar)</listitem>
+  <listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSesame2HttpRepository/create.xsl">Sesame System Repository config file</ulink> (create.xsl)</listitem>
+  <listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSesame2HttpRepository/create-virtuoso.xsl">Sesame Virtuoso Repository config file </ulink> (create-virtuoso.xsl)</listitem>
+  <listitem><ulink url="http://tomcat.apache.org/download-60.cgi">Apache Tomcat</ulink> version 5 or 6</listitem>
+</itemizedlist>
+      </sect5>
+      <sect5 id="rdfnativestorageproviderssesamestpandtestinghttprep"><title>Setup Sesame HTTP Repository</title>
+<para>This section details the steps required for configuring and testing a Virtuoso HTTP Sesame Repository.</para>
+<orderedlist>
+  <listitem>Install <ulink url="http://tomcat.apache.org/tomcat-6.0-doc/index.html">Apache Tomcat</ulink> web server</listitem>
+  <listitem>From the Sesame 2.3.1 or higher "lib" directory copy the "openrdf-sesame.war" and "openrdf-worbbench.war" files to the
+tomcat "webapps" directory where they will automatically be deployed creating two new sub directories "openrdf-sesame" and
+"openrdf-workbench".</listitem>
+  <listitem>Place the Virtuoso Sesame Provider "virt_sesame2.jar" and JDBC Driver "virtjdbc3.jar" into the Tomcat
+<code>~/webapps/openrdf-sesame/WEB-INF/lib/</code> and <code>~/webapps/openrdf-workbench/WEB-INF/lib/</code> directories for
+use by the Sesame HTTP Repository for accessing the Virtuoso RDF repository.</listitem>
+  <listitem>Place the "create.xsl" and "create-virtuoso.xsl" files in the Tomcat
+<code>~/webapps/openrdf-workbench/transformations/</code> directory. Note "create.xsl" replaces the default provided with Sesame and contains the necessary entries required to reference the new "create-virtuoso.xsl" template file for Virtuoso repository configuration.</listitem>
+  <listitem>The Sesame HTTP Repository will now be accessible on the URLs
+<programlisting><![CDATA[
+http://localhost:8080/openrdf-sesame
+http://localhost:8080/openrdf-workbench
+]]></programlisting>
+</listitem>
+   <listitem>The Sesame OpenRDF Workbench is used for accessing the Sesame HTTP Repositories, loading
+"<ulink url="http://localhost:8080/openrdf-workbench">http://localhost:8080/openrdf-workbench</ulink>" will enable the
+default "SYSTEM" repository to be accessed.
+     <figure id="ss1" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss1.png"/>
+     </figure>
+  </listitem>
+   <listitem>Click on the "New Repository" link in the left frame to create a new Sesame Repository.
+     <figure id="ss2" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss2.png"/>
+     </figure>
+  </listitem>
+   <listitem>Select the "Virtuoso RDF Store" from the "Type" drop down list box presented.
+     <figure id="ss3" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss3.png"/>
+     </figure>
+  </listitem>
+   <listitem>Choose suitable repository "ID" and "Title" for the Virtuoso repository to be created and click "Next".
+     <figure id="ss4" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss4.png"/>
+     </figure>
+  </listitem>
+   <listitem>Fill in the connection parameters for the target Virtuoso sever the repository is to be created for and
+click the "create" button. The minimum required are the hostname, port number, username and password of the Virtuoso Server.
+     <figure id="ss5" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss5.png"/>
+     </figure>
+  </listitem>
+   <listitem>The new Virtuoso respository will be created and its summary page displayed.
+     <figure id="ss6" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss6.png"/>
+     </figure>
+  </listitem>
+   <listitem>Click on the "Namespaces" link in the left frame to obtain a list of the available namespaces in the Virtuoso repository.
+     <figure id="ss7" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss7.png"/>
+     </figure>
+  </listitem>
+   <listitem>Click on the "Context" link in the left frame to obtain a list of the available contexts in the Virtuoso repository.
+     <figure id="ss8" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss8.png"/>
+     </figure>
+  </listitem>
+   <listitem>Click on the "Types" link in the left frame to obtain a list of the available types in the Virtuoso repository.
+     <figure id="ss9" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss9.png"/>
+     </figure>
+  </listitem>
+   <listitem>Click on the "Query" link in the left frame, enter a suitable SPARQL query to execute against the Virtuoso repository
+and click the "execute" button.
+     <figure id="ss10" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss10.png"/>
+     </figure>
+  </listitem>
+   <listitem>The results of the SPARQL query are returned.
+     <figure id="ss11" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss11.png"/>
+     </figure>
+  </listitem>
+   <listitem>Click on the "Repositories" link in the left frame and the newly created Virtuoso repository entry is displayed along side
+the default SYSTEM repository.
+     <figure id="ss12" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss12.png"/>
+     </figure>
+  </listitem>
+</orderedlist>
+      </sect5>
+      <sect5 id="rdfnativestorageproviderssesamestpandtestingcons"><title>Setup Sesame Console Repository</title>
+<para>This section details the steps required for configuring and testing a Virtuoso Sesame Console Repository:</para>
+<orderedlist>
+  <listitem>Extract Sesame 2.3.1 or higher archive to a location of choice and place the virt_sesame2.jar and virtjdbc3.jar
+files to the sesame 2.3.1 "lib" directory</listitem>
+  <listitem>Start the <ulink url="http://www.openrdf.org/doc/sesame2/users/ch07.html#section-console-repository-creation">sesame console application</ulink> by running the "console.bat" script in the sesame "bin" directory and then "exit." the program
+<programlisting><![CDATA[
+$ sh console.sh
+SLF4J: Class path contains multiple SLF4J bindings.
+SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/logback-classic-0.9.18.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/slf4j-jdk14-1.5.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
+10:32:38.317 [main] DEBUG info.aduna.platform.PlatformFactory - os.name <http://os.name> <http://os.name> = mac os x
+10:32:38.351 [main] DEBUG info.aduna.platform.PlatformFactory - Detected Mac OS X platform
+Connected to default data directory
+Commands end with '.' at the end of a line
+Type 'help.' for help
+exit.
+]]></programlisting>
+</listitem>
+  <listitem>This will create the necessary sesame application data directories as detailed in the sesame
+<ulink url="http://www.openrdf.org/doc/sesame2/2.3.1/users/userguide.html#chapter-datadir-config">data directory configuration</ulink> documentation.
+<programlisting><![CDATA[
+Windows - C:\Documents and Settings\LocalService\Application Data\Aduna\
+Mac OS X - /Users/myuser/Library/Application Support/Aduna/
+Linux - $HOME/.aduna/
+]]></programlisting>
+</listitem>
+  <listitem>If you do not want to use the default sesame data directory location the Sesame console application can be started by
+specifying a custom data directory location with the "-d" option. Note in this case the directory "OpenRDF Sesame console" always
+has to be manually appended to the directory as Sesame assumes the data file will reside in a sub directory of this name.
+<programlisting><![CDATA[
+$ sh console.sh -d /Users/myuser/OpenRDF Sesame console
+]]></programlisting>
+</listitem>
+  <listitem>Start the sesame console application with the required data directory location and create a Virtuoso repository as
+detailed in the steps below, the key parameters to be specified being the target Virtuoso server hostname, port number,
+username, password and a unique "Repository ID".
+<programlisting><![CDATA[
+$ sh console.sh
+SLF4J: Class path contains multiple SLF4J bindings.
+SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/logback-classic-0.9.18.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/slf4j-jdk14-1.5.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
+10:32:38.317 [main] DEBUG info.aduna.platform.PlatformFactory - os.name <http://os.name> <http://os.name> = mac os x
+10:32:38.351 [main] DEBUG info.aduna.platform.PlatformFactory - Detected Mac OS X platform
+Connected to default data directory
+Commands end with '.' at the end of a line
+Type 'help.' for help
+create virtuoso .
+Please specify values for the following variables:
+Host list [localhost:1111]:
+Username [dba]:
+Password [dba]:
+Default graph name [sesame:nil]:
+Enable using batch optimization (false|true) [false]:
+Use RoundRobin for connection (false|true) [false]:
+Buffer fetch size [200]:
+Inference RuleSet name [null]:
+Repository ID [virtuoso]: myvirt
+Repository title [Virtuoso repository]:
+Repository created
+show r .
++----------
+|SYSTEM
+|myvirt ("Virtuoso repository")
++----------
+open myvirt .
+Opened repository 'myvirt'
+myvirt> show n .
++----------
+|bif  bif:
+|dawgt  http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#
+|dbpedia  http://dbpedia.org/resource/
+|dbpprop  http://dbpedia.org/property/
+|dc  http://purl.org/dc/elements/1.1/
+|foaf  http://xmlns.com/foaf/0.1/
+|geo  http://www.w3.org/2003/01/geo/wgs84_pos#
+|go  http://purl.org/obo/owl/GO#
+|math  http://www.w3.org/2000/10/swap/math#
+|mesh  http://purl.org/commons/record/mesh/
+|mf  http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#
+|nci  http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#
+|obo  http://www.geneontology.org/formats/oboInOwl#
+|owl  http://www.w3.org/2002/07/owl#
+|protseq  http://purl.org/science/protein/bysequence/
+|rdf  http://www.w3.org/1999/02/22-rdf-syntax-ns#
+|rdfdf  http://www.openlinksw.com/virtrdf-data-formats#
+|rdfs  http://www.w3.org/2000/01/rdf-schema#
+|sc  http://purl.org/science/owl/sciencecommons/
+|scovo  http://purl.org/NET/scovo#
+|skos  http://www.w3.org/2004/02/skos/core#
+|sql  sql:
+|vcard  http://www.w3.org/2001/vcard-rdf/3.0#
+|virtrdf  http://www.openlinksw.com/schemas/virtrdf#
+|void  http://rdfs.org/ns/void#
+|xf  http://www.w3.org/2004/07/xpath-functions
+|xml  http://www.w3.org/XML/1998/namespace
+|xsd  http://www.w3.org/2001/XMLSchema#
+|xsl10  http://www.w3.org/XSL/Transform/1.0
+|xsl1999  http://www.w3.org/1999/XSL/Transform
+|xslwd  http://www.w3.org/TR/WD-xsl
+|yago  http://dbpedia.org/class/yago/
++----------
+exit.
+]]></programlisting>
+</listitem>
+</orderedlist>
+      </sect5>
+      <sect5 id="rdfnativestorageproviderssesamestpandtestinghttpcons"><title>Connection to Sesame HTTP repository from Console repository</title>
+<para>The Sesame Console repository can connect to a Sesame HTTP repository and vice-versa, enabling access to remote Sesame
+HTTP repositories from a local server.</para>
+<orderedlist>
+  <listitem>The Sesame Console repository can connect to a Sesame HTTP repository and query it as if local using the "connect" command.
 <programlisting><![CDATA[
-import com.hp.hpl.jena.query.*;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-
-import virtuoso.jena.driver.*;
-
-public class VirtuosoSPARQLExample8 {
-
-	/**
-	 * Executes a SPARQL query against a virtuoso url and prints results.
-	 */
-	public static void main(String[] args) {
-
-		String url;
-		if(args.length == 0)
-		    url = "jdbc:virtuoso://localhost:1111";
-		else
-		    url = args[0];
-
-/*			STEP 1			*/
-		VirtGraph set = new VirtGraph (url, "dba", "dba");
-
-/*			STEP 2			*/
-System.out.println("\nexecute: CLEAR GRAPH <http://test1>");
-                String str = "CLEAR GRAPH <http://test1>";
-                VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(str, set);
-                vur.exec();
-
-System.out.println("\nexecute: INSERT INTO GRAPH <http://test1> { <aa> <bb> 'cc' . <aa1> <bb1> 123. }");
-                str = "INSERT INTO GRAPH <http://test1> { <aa> <bb> 'cc' . <aa1> <bb1> 123. }";
-                vur = VirtuosoUpdateFactory.create(str, set);
-                vur.exec();
-
-/*			STEP 3			*/
-/*		Select all data in virtuoso	*/
-System.out.println("\nexecute: SELECT * FROM <http://test1> WHERE { ?s ?p ?o }");
-		Query sparql = QueryFactory.create("SELECT * FROM <http://test1> WHERE { ?s ?p ?o }");
-
-/*			STEP 4			*/
-		VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
-
-		ResultSet results = vqe.execSelect();
-		while (results.hasNext()) {
-			QuerySolution rs = results.nextSolution();
-		    RDFNode s = rs.get("s");
-		    RDFNode p = rs.get("p");
-		    RDFNode o = rs.get("o");
-		    System.out.println(" { " + s + " " + p + " " + o + " . }");
-		}
-
-
-System.out.println("\nexecute: DELETE FROM GRAPH <http://test1> { <aa> <bb> 'cc' }");
-                str = "DELETE FROM GRAPH <http://test1> { <aa> <bb> 'cc' }";
-                vur = VirtuosoUpdateFactory.create(str, set);
-                vur.exec();
-
-System.out.println("\nexecute: SELECT * FROM <http://test1> WHERE { ?s ?p ?o }");
-		vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
-                results = vqe.execSelect();
-		while (results.hasNext()) {
-			QuerySolution rs = results.nextSolution();
-		    RDFNode s = rs.get("s");
-		    RDFNode p = rs.get("p");
-		    RDFNode o = rs.get("o");
-		    System.out.println(" { " + s + " " + p + " " + o + " . }");
-		}
-
-
-	}
-}
+$ sh console.sh
+SLF4J: Class path contains multiple SLF4J bindings.
+SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/logback-classic-0.9.18.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/slf4j-jdk14-1.5.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
+10:32:38.317 [main] DEBUG info.aduna.platform.PlatformFactory - os.name <http://os.name> <http://os.name> = mac os x
+10:32:38.351 [main] DEBUG info.aduna.platform.PlatformFactory - Detected Mac OS X platform
+Connected to default data directory
+Commands end with '.' at the end of a line
+Type 'help.' for help
+> connect http://localhost:8080/openrdf-sesame.
+Connected to http://localhost:8080/openrdf-sesame
+> show r.
++----------
+|SYSTEM ("System configuration repository")
+|VirtSesRep ("Virtuoso Sesame HTTP Repository")
++----------
+> open VirtSesRep.
+Opened repository 'VirtSesRep'
+VirtSesRep> sparql select * from <http://localhost:8890/Northwind> where {?s ?p ?o} Limit 10.
+Evaluating query...
++------------------------+------------------------+------------------------+
+| s                      | p                      | o                      |
++------------------------+------------------------+------------------------+
+| <http://localhost:8890/Northwind/CustomerContact/ALFKI#this>| rdf:type  | foaf:Person            |
+| <http://localhost:8890/Northwind/CustomerContact/ALFKI#this>| rdf:type  | northwind:CustomerContact|
+| <http://localhost:8890/Northwind/CustomerContact/ALFKI#this>| opl:isDescribedUsing   | northwind:             |
+| <http://localhost:8890/Northwind/CustomerContact/ANATR#this>| rdf:type | foaf:Person            |
+| <http://localhost:8890/Northwind/CustomerContact/ANATR#this>| rdf:type | northwind:CustomerContact|
+| <http://localhost:8890/Northwind/CustomerContact/ANATR#this>| opl:isDescribedUsing   | northwind:             |
+| <http://localhost:8890/Northwind/CustomerContact/ANTON#this>| rdf:type  | foaf:Person            |
+| <http://localhost:8890/Northwind/CustomerContact/ANTON#this>| rdf:type  | northwind:CustomerContact|
+| <http://localhost:8890/Northwind/CustomerContact/ANTON#this>| opl:isDescribedUsing   | northwind:             |
+| <http://localhost:8890/Northwind/CustomerContact/AROUT#this>| rdf:type  | foaf:Person            |
++------------------------+------------------------+------------------------+
+10 result(s) (530 ms)
+VirtSesRep> show n.
++----------
+|SearchResults  http://www.zillow.com/static/xsd/SearchResults.xsd
+|UpdatedPropertyDetails  http://www.zillow.com/static/xsd/UpdatedPropertyDetails.xsd
+|a  http://www.w3.org/2005/Atom
+|aapi  http://rdf.alchemyapi.com/rdf/v1/s/aapi-schema#
+|address  http://schemas.talis.com/2005/address/schema#
+|admin  http://webns.net/mvcb/
+|amz  http://webservices.amazon.com/AWSECommerceService/2005-10-05
+|atom  http://atomowl.org/ontologies/atomrdf#
+|audio  http://purl.org/media/audio#
+|awol  http://bblfish.net/work/atom-owl/2006-06-06/#
+|aws  http://soap.amazon.com/
+|b3s  http://b3s.openlinksw.com/
 ]]></programlisting>
-    </sect4>
-    <sect4 id="rdfnativestorageprovidersjenaexamples9"><title>VirtJenaSPARQLExample9</title>
+</listitem>
+  <listitem>Conversely the Sesame HTTP repository can be configured to access the repository created by the Sesame console.
+To do this the location of the data directory for both needs to be reconfigured using the Java system property
+info.aduna.platform.appdata.basedir (does not include "OpenRDF Sesame console directory) to point to the same location.
+When you are using Tomcat as the servlet container then you can set this property using the JAVA_OPTS parameter.
+Note, if you are using Apache Tomcat as a Windows Service you should use the Windows Services configuration tool to
+set this property. Other users can either edit the Tomcat startup script or set the property some other way.
 <programlisting><![CDATA[
-import com.hp.hpl.jena.query.*;
-import com.hp.hpl.jena.rdf.model.RDFNode;
-import com.hp.hpl.jena.graph.Triple;
-import com.hp.hpl.jena.graph.Node;
-import com.hp.hpl.jena.graph.Graph;
-import com.hp.hpl.jena.rdf.model.*;
-import java.util.Iterator;
-
-import virtuoso.jena.driver.*;
-
-public class VirtuosoSPARQLExample9 {
-
-	/**
-	 * Executes a SPARQL query against a virtuoso url and prints results.
-	 */
-	public static void main(String[] args) {
-
-		String url;
-		if(args.length == 0)
-		    url = "jdbc:virtuoso://localhost:1111";
-		else
-		    url = args[0];
-
-/*			STEP 1			*/
-		VirtGraph set = new VirtGraph (url, "dba", "dba");
-
-/*			STEP 2			*/
-                String str = "CLEAR GRAPH <http://test1>";
-                VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(str, set);
-                vur.exec();
-
-                str = "INSERT INTO GRAPH <http://test1> { <http://aa> <http://bb> 'cc' . <http://aa1> <http://bb> 123. }";
-                vur = VirtuosoUpdateFactory.create(str, set);
-                vur.exec();
-
-
-/*		Select all data in virtuoso	*/
-		Query sparql = QueryFactory.create("SELECT * FROM <http://test1> WHERE { ?s ?p ?o }");
-		VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
-		ResultSet results = vqe.execSelect();
-                System.out.println("\nSELECT results:");
-		while (results.hasNext()) {
-			QuerySolution rs = results.nextSolution();
-		    RDFNode s = rs.get("s");
-		    RDFNode p = rs.get("p");
-		    RDFNode o = rs.get("o");
-		    System.out.println(" { " + s + " " + p + " " + o + " . }");
-		}
-
-		sparql = QueryFactory.create("DESCRIBE <http://aa> FROM <http://test1>");
-		vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
-
-		Model model = vqe.execDescribe();
- 	        Graph g = model.getGraph();
-                System.out.println("\nDESCRIBE results:");
-	        for (Iterator i = g.find(Node.ANY, Node.ANY, Node.ANY); i.hasNext();)
-	           {
-	              Triple t = (Triple)i.next();
-		      System.out.println(" { " + t.getSubject() + " " +
-		      				 t.getPredicate() + " " +
-		      				 t.getObject() + " . }");
-	        }
-
-
-
-		sparql = QueryFactory.create("CONSTRUCT { ?x <http://test> ?y } FROM <http://test1> WHERE { ?x <http://bb> ?y }");
-		vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
-
-		model = vqe.execConstruct();
- 	        g = model.getGraph();
-                System.out.println("\nCONSTRUCT results:");
-	        for (Iterator i = g.find(Node.ANY, Node.ANY, Node.ANY); i.hasNext();)
-	           {
-	              Triple t = (Triple)i.next();
-		      System.out.println(" { " + t.getSubject() + " " +
-		      				 t.getPredicate() + " " +
-		      				 t.getObject() + " . }");
-	        }
-
-
-		sparql = QueryFactory.create("ASK FROM <http://test1> WHERE { <http://aa> <http://bb> ?y }");
-		vqe = VirtuosoQueryExecutionFactory.create (sparql, set);
-
-		boolean res = vqe.execAsk();
-                System.out.println("\nASK results: "+res);
-
-
-	}
-}
+ * set JAVA_OPTS=-Dinfo.aduna.platform.appdata.basedir=\path\to\other\dir\ (on Windows)
+    * export JAVA_OPTS='-Dinfo.aduna.platform.appdata.basedir=/path/to/other/dir/' (on Linux/UNIX/Mac OS X)
 ]]></programlisting>
+     <figure id="ss13" float="1">
+       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
+       <graphic fileref="ui/ss13.png"/>
+     </figure>
+
+</listitem>
+</orderedlist>
+       </sect5>
     </sect4>
     </sect3>
-    <sect3 id="rdfnativestorageprovidersjenajavadoc"><title>Javadoc API Documentation</title>
-    <para><ulink url="http://docs.openlinksw.com/jena/">Jena Provider Javadoc API Documentation</ulink> is available enabling the complete set of classes, interfaces and methods implemented for the provider to be viewed.
+    <sect3 id="rdfnativestorageproviderssesamejavadoc"><title>Javadoc API Documentation</title>
+    <para><ulink url="http://docs.openlinksw.com/sesame/">Sesame Provider Javadoc API Documentation</ulink>
+is available enabling the complete set of classes, interfaces and methods implemented for the provider to be viewed.
     </para>
     </sect3>
   </sect2>
-  <sect2 id="rdfnativestorageproviderssesame"><title>Virtuoso Sesame Provider</title>
-    <sect3 id="rdfnativestorageproviderssesamewhatis"><title>What is Sesame</title>
-      <para>Sesame is an open source Java framework for storing, querying and reasoning
-with RDF and RDF Schema. It can be used as a database for RDF and RDF Schema, or as a Java
-library for applications that need to work with RDF internally. For example, suppose you need
-to read a big RDF file, find the relevant information for your application, and use that information.
-Sesame provides you with the necessary tools to parse, interpret, query and store all this information,
-embedded in your own application if you want, or, if you prefer, in a separate database or even on a remote
-server. More generally: Sesame provides an application developer a toolbox that contains useful hammers
-screwdrivers etc. for doing 'Do-It-Yourself' with RDF.
+  <sect2 id="rdfnativestorageproviderredland"><title>Virtuoso Redland Provider</title>
+     <sect3 id="rdfnativestorageproviderredlandwhatis"><title>What is Redland</title>
+     <para><ulink url="http://librdf.org/">Redland</ulink> is a set of free software 'C' libraries that
+provide support for the Resource Description Framework (RDF), providing modular, object based libraries
+and APIs for manipulating the RDF graph, triples, URIs and Literals. Redland includes several high-level
+language APIs providing RDF manipulation and storage and requires the
+<ulink url="http://librdf.org/raptor/">Raptor</ulink> RDF parser and <ulink url="http://librdf.org/rasqal/">Rasqal</ulink>
+RDF syntax and query library
+for its use.
       </para>
     </sect3>
-    <sect3 id="rdfnativestorageproviderssesamewhatisvirtuososesameprovider"><title>What is the Virtuoso Sesame Provider</title>
-    <para>The Virtuoso Sesame Provider is a fully operational Native Graph Model Storage Providers
-for the Sesame Framework, allowing users of Virtuoso to leverage the Sesame framework for modifying,
-querying, and reasoning with the Virtuoso quad store using the Java language. The Sesame Repository
-API offers a central access point for connecting to the Virtuoso quad store. Its purpose is to
-provides a java-friendly access point to Virtuoso. It offers various methods for querying and
-updating the data, while abstracting the details of the underlying machinery. The Provider has
-been tested against the <ulink url="http://sourceforge.net/project/showfiles.php?group_id=46509&package_id=168413">Sesame 2.1.2</ulink> version currently available.
+    <sect3 id="rdfnativestorageproviderredlandwhatisv"><title>What is the Virtuoso Redland Provider</title>
+    <para>The Virtuoso Redland RDF Provider is an implementation of the Storage API, Model and Query
+interfaces of the Redland framework for RDF. This provider enables the execution of queries via the
+Redland Rasqal query engine or via Virtuoso query engine directly against the Virtuoso Quad store.
+The Virtuoso Redland Provider uses ODBC as the data access mechanism for communicating the Virtuoso
+Quad Store and requires the Virtuoso ODBC Driver be installed on the Redland client and a suitable
+ODBC DSN be configured for connecting to the target Virtuoso Quad Store instance. The provider has
+been tested against the <ulink url="http://download.librdf.org/source/">Redland 1.0.8</ulink> version currently available for download.
     </para>
-    <figure id="rdfnativestorageproviderssesame1" float="1">
-      <title>Fig. 1 Sesame Component Stack</title>
-      <graphic fileref="ui/VirtSesame2Provider.png"/>
+    <figure id="rdfnativestorageproviderredland1" float="1">
+      <title>Redland Component Stack</title>
+      <graphic fileref="ui/VirtRedLand.png"/>
     </figure>
-    <para>If you need more information about how to set up your environment for working with the
-Sesame APIs, take a look at Chapter 4 of the Sesame User Guide, <ulink url="http://www.openrdf.org/doc/sesame2/users/RDF">Setting up to use the Sesame libraries</ulink>.
+    <para>As indicated in the above diagram the Virtuoso Provider can be used to execute RDF queries either
+directly against the Virtuoso graph storage module supporting the <ulink url="http://dbpedia.org/resource/SPARQL">SPARQL</ulink>,
+<ulink url="http://dbpedia.org/resource/SPARUL">SPARQL</ulink>SPARUL, <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VOSArticleBISPARQL2">SPARQL-BI</ulink>
+query languages or via the Rasqal query engine built into Redland which supports the SPARQL query language.
+This is done by simply changing the syntax of the query using the "vsparql" rather then default "sparql"
+construct when executing a query as indicated in the sample queries below:
+    </para>
+<programlisting><![CDATA[
+rdfproc -r xml -t "user='dba',password='dba',dsn='Demo'" gr query sparql - "SELECT * WHERE { ?s ?p ?o }"   ;; via Redland Rasqal engine
+
+rdfproc -r xml -t "user='dba',password='dba',dsn='Demo'" gr query vsparql - "SELECT * WHERE { ?s ?p ?o }"  ;; direct to Virtuoso storage module
+]]></programlisting>
+    <para>The Virtuoso Provider uses the <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VOSSQL2RDF">SPASQL</ulink> query language for querying the remote Virtuoso QUAD store.
     </para>
     </sect3>
-    <sect3 id="rdfnativestorageproviderssesamesetup"><title>Setup Tutorial</title>
-    <sect4 id="rdfnativestorageproviderssesamereqfiles"><title>Required Files</title>
-    <para>This tutorial assumes you have Virtuoso server installed and that the database
-is accessible at "localhost:1111". In addition, you will need the latest version of the
-Virtuoso Sesame Provider, and Sesame 2 or greater installed.
+    <sect3 id="rdfnativestorageproviderredlandsetup"><title>Setup</title>
+      <sect4 id="rdfnativestorageproviderredlandreqfiles"><title>Required Files</title>
+      <para>The Virtuoso Redland Provider has been integrated into the Redland RDF Framework and submitted to
+the open source project to become part of the standard distribution available for
+<ulink url="http://librdf.org/INSTALL.html">download</ulink>. Until this
+submission has been accepted and committed into the available Redland release a tar ball created by
+OpenLink Software and a diff for application to a Redland 1.0.8 tree can be obtained from:
     </para>
     <itemizedlist mark="bullet">
-      <listitem>Virtuoso Sesame 2 Provider JAR file, <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VirtSesame2Provider/virt_sesame2.jar">virt_sesame2.jar</ulink></listitem>
-      <listitem>The Virtuoso JDBC Driver JAR file, <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VirtSesame2Provider/virtjdbc3.jar">virtjdbc3.jar</ulink></listitem>
-      <listitem>Sesame Framework and associated classes, <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VirtSesame2Provider/sesame2jars.zip">sesame2jars.zip</ulink></listitem>
-      <listitem>Sample programs, <ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/VirtSesame2Provider/virtsesame2samples.zip">virtsesame2samples.zip</ulink></listitem>
+        <listitem><ulink url="ftp://download.openlinksw.com/support/vos/redland-vos-1.0.8.tar.gz"></ulink>Redland 1.0.8 tar ball with Virtuoso storage support</listitem>
+        <listitem><ulink url="ftp://download.openlinksw.com/support/vos/redland-vos.diff">Redland 1.0.8 Diff file of changes made for Virtuoso storage support</ulink></listitem>
+      </itemizedlist>
+      </sect4>
+      <sect4 id="rdfnativestorageprovidersredlandcmsmpr"><title>Compiling Redland with Virtuoso storage support</title>
+        <itemizedlist mark="bullet">
+          <listitem><ulink url="http://svn.librdf.org/">Download Redland</ulink>, extract and apply diff
+above or download the tar ball above with diff already applied and extract to a location of choice.</listitem>
+          <listitem>The following additional configure options are available for enabling the Virtuoso
+storage support:
+<programlisting><![CDATA[
+  --with-virtuoso(=yes|no) Enable Virtuoso RDF store (default=auto)
+  --with-iodbc(=DIR)        Select iODBC support
+                            DIR is the iODBC base install directory
+                            (default=/usr/local)
+  --with-unixodbc(=DIR)   Select UnixODBC support
+                            DIR is the UnixODBC base install directory
+                            (default=/usr/local)
+  --with-datadirect(=DIR) Select DataDirect support
+                            DIR is the DataDirect base install directory
+                            (default=/usr/local)
+  --with-odbc-inc=DIR     Specify custom ODBC include directory
+                            (default=/usr/local/include)
+  --with-odbc-lib=DIR     Specify custom ODBC lib directory
+                            (default=/usr/local/lib)
+]]></programlisting>
+          </listitem>
+          <listitem>The "--with-virtuoso" option default to being auto enable if a valid ODBC Driver Manager
+(iODBC, UnixODBC? or DataDirect?) or include and lib directories for required ODBC header files and libraries
+are located with the suitable setting for one or more of the other ODBC related options above. Assuming
+iODBC is installed the following option can be used to enable Virtuoso storage support to be configured
+for compilation into your Redland build:
+<programlisting><![CDATA[
+./configure --with-iodbc=/usr/local/iODBC
+]]></programlisting>
+          </listitem>
+          <listitem>Run "make" to compile the Redland libraries and "sudo make install" to install in
+the default "/usr/local" location</listitem>
+          <listitem>Test compilation with test utility utils/rdfproc:
+<programlisting><![CDATA[
+
+rdfproc test parse http://planetrdf.com/guide/rss.rdf
+rdfproc test print
+rdfproc test serialize ntriples
+]]></programlisting>
+          <para>This test will use the default 'hashes' storage.</para>
+          </listitem>
+          <listitem>Ensure you have the Virtuoso ODBC Driver installed and a valid ODBC DSN called
+"Local Virtuoso" configured for your target Virtuoso Server</listitem>
+          <listitem>Set the following environment variable:
+<programlisting><![CDATA[
+export RDFPROC_STORAGE_TYPE=virtuoso                                   ;; Enable Virtuoso Storage
+export ODBCINI=<path_to_odbcini_directory>/odbc.ini                      ;; Enable ODBC DSN to be located
+export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH                     ;; May be required to enable Redland libraries to be located
+
+]]></programlisting>
+          </listitem>
+          <listitem>Test Virtuoso storage with the provided test program utils/vtest:
+<programlisting><![CDATA[
+$ utils/vtest
+  1: Remove all triples in <http://red> context
+**PASSED**: removed context triples from the graph
+  2: Add triples to <http://red> context
+**PASSED**: add triple to context
+  3: Print all triples in <http://red> context
+[[
+  {[aa], [bb], [cc]} with context [http://red]
+  {[aa], [bb1], [cc]} with context [http://red]
+  {[aa], [a2], "cc"} with context [http://red]
+  {[aa], [a2], (cc)} with context [http://red]
+  {[mm], [nn], "Some long literal with language at en"} with context [http://red]
+  {[oo], [pp], "12345^^<http://www.w3.org/2001/XMLSchema#int>"} with context [http://red]
+]]
+**PASSED**:
+  4: Count of triples in <http://red> context
+**PASSED**: graph has 6 triples
+  5: Exec:  ARC  aa bb
+Matched node: [cc]
+**PASSED**:
+  6: Exec:  ARCS  aa cc
+Matched node: [bb] with context [http://red]
+Matched node: [bb1] with context [http://red]
+: matching nodes: 2
+**PASSED**:
+  7: Exec:  ARCS-IN  cc
+Matched arc: [bb] with context [http://red]
+Matched arc: [bb1] with context [http://red]
+**PASSED**: matching arcs: 2
+  8: Exec:  ARCS-OUT  aa
+Matched arc: [bb] with context [http://red]
+Matched arc: [bb1] with context [http://red]
+Matched arc: [a2] with context [http://red]
+Matched arc: [a2] with context [http://red]
+**PASSED**: matching arcs: 4
+  9: Exec:  CONTAINS aa bb1 cc
+**PASSED**: the graph contains the triple
+ 10: Exec:  FIND aa - -
+Matched triple: {[aa], [bb], [cc]} with context [http://red]
+Matched triple: {[aa], [bb1], [cc]} with context [http://red]
+Matched triple: {[aa], [a2], "cc"} with context [http://red]
+Matched triple: {[aa], [a2], (cc)} with context [http://red]
+**PASSED**: matching triples: 4
+ 11: Exec:  HAS-ARC-IN cc bb
+**PASSED**: the graph contains the arc
+ 12: Exec:  HAS-ARC-OUT aa bb
+**PASSED**: the graph contains the arc
+ 13: Exec:  SOURCE  aa cc
+Matched node: [aa]
+**PASSED**:
+ 14: Exec:  SOURCES  bb cc
+Matched node: [aa] with context [http://red]
+: matching nodes: 1
+**PASSED**:
+ 15: Exec:  TARGET  aa bb
+Matched node: [cc]
+**PASSED**:
+ 16: Exec:  TARGETS  aa bb
+Matched node: [cc] with context [http://red]
+: matching nodes: 1
+**PASSED**:
+ 17: Exec:  REMOVE aa bb1 cc
+**PASSED**: removed triple from the graph
+ 18: Exec:  QUERY "CONSTRUCT {?s ?p ?o} FROM <http://red> WHERE {?s ?p ?o}"
+Matched triple: {[aa], [a2], "cc"}
+Matched triple: {[oo], [pp], "12345^^<http://www.w3.org/2001/XMLSchema#int>"}
+Matched triple: {[aa], [a2], (cc)}
+Matched triple: {[aa], [bb], [cc]}
+Matched triple: {[mm], [nn], "Some long literal with language at en"}
+**PASSED**: matching triples: 5
+ 19: Exec1:  QUERY_AS_BINDINGS "SELECT * WHERE {graph <http://red> { ?s ?p ?o }}"
+**: Formatting query result as 'xml':
+<?xml version="1.0" encoding="utf-8"?>
+<sparql xmlns="http://www.w3.org/2005/sparql-results#">
+  <head>
+    <variable name="s"/>
+    <variable name="p"/>
+    <variable name="o"/>
+  </head>
+  <results>
+    <result>
+      <binding name="s"><uri>aa</uri></binding>
+      <binding name="p"><uri>bb</uri></binding>
+      <binding name="o"><uri>cc</uri></binding>
+    </result>
+    <result>
+      <binding name="s"><uri>aa</uri></binding>
+      <binding name="p"><uri>a2</uri></binding>
+      <binding name="o"><literal>cc</literal></binding>
+    </result>
+    <result>
+      <binding name="s"><uri>aa</uri></binding>
+      <binding name="p"><uri>a2</uri></binding>
+      <binding name="o"><bnode>cc</bnode></binding>
+    </result>
+    <result>
+      <binding name="s"><uri>mm</uri></binding>
+      <binding name="p"><uri>nn</uri></binding>
+      <binding name="o"><literal>Some long literal with language at en</literal></binding>
+    </result>
+    <result>
+      <binding name="s"><uri>oo</uri></binding>
+      <binding name="p"><uri>pp</uri></binding>
+      <binding name="o"><literal>12345^^<http://www.w3.org/2001/XMLSchema#int></literal></binding>
+    </result>
+  </results>
+</sparql>
+**PASSED**:
+ 20: Exec2:  QUERY_AS_BINDINGS "SELECT * WHERE {graph <http://red> { ?s ?p ?o }}"
+: Query returned bindings results:
+result: [s=[aa], p=[bb], o=[cc]]
+result: [s=[aa], p=[a2], o=cc]
+result: [s=[aa], p=[a2], o=(cc)]
+result: [s=[mm], p=[nn], o=Some long literal with language at en]
+result: [s=[oo], p=[pp], o=12345^^<http://www.w3.org/2001/XMLSchema#int>]
+: Query returned 5 results
+**PASSED**:
+=============================================
+PASSED: 20  FAILED:  0
+]]></programlisting>
+          </listitem>
+        </itemizedlist>
+      </sect4>
+      <sect4 id="rdfnativestorageprovidersredlandcp"><title>Connection Parameters</title>
+        <para>The Virtuoso provider has the following connection parameters available fro use:</para>
+        <itemizedlist mark="bullet">
+          <listitem><emphasis>dsn</emphasis> - ODBC datasource name</listitem>
+          <listitem><emphasis>user</emphasis> - user name of database server</listitem>
+          <listitem><emphasis>password</emphasis> - password of database server</listitem>
+          <listitem><emphasis>host</emphasis> - hostname:portno of the database server</listitem>
+          <listitem><emphasis>charset</emphasis> - database charset to use</listitem>
     </itemizedlist>
+        <para>NOTE: Take care exposing the password as for example, program arguments or environment
+variables. The rdfproc utility can help this by reading the password from standard input. Inside programs,
+one way to prevent storing the password in a string is to construct a Redland hash of the storage options
+such as via librdf hash_from_string and use librdf_new_storage_with_options to create a storage. The
+rdfproc utility source code demonstrates this.
+        </para>
+        <para>The storage name parameter given to the storage constructor librdf new_storage is used
+inside the virtuoso store to allow multiple stores inside one Virtuoso database instance as parameterized
+with the above options.
+        </para>
+        <para>This store always provides contexts; the boolean storage option contexts is not checked.</para>
+        <para>Examples:</para>
+<programlisting><![CDATA[
+  /* A new Virtuoso store */
+  storage=librdf_new_storage(world, "virtuoso", "db1",
+      "dsn='Local Virtuoso',user='demo',password='demo'");
+
+  /* A different, existing Virtuoso store in the same database as above */
+  storage=librdf_new_storage(world, "virtuoso", "db2",
+      "dsn='Local Virtuoso',user='demo',password='demo'");
+
+  /* An existing Virtuoso store on a different database server */
+  storage=librdf_new_storage(world, "virtuoso", "http://red3",
+      "dsn='Remote Virtuoso',user='demo',password='demo'");
+
+  /* Opening with an options hash */
+  options=librdf_new_hash(world, NULL);
+  librdf_hash_from_string(options,
+      "dsn='Local Virtuoso',user='demo'");
+  librdf_hash_put_strings(options, "password", user_password);
+  storage=librdf_new_storage_with_options(world, "virtuoso", "http://red3", options);
+]]></programlisting>
     </sect4>
-    <sect4 id="rdfnativestorageproviderssesamecmppr"><title>Compiling Sesame Sample Programs</title>
-    <orderedlist>
-      <listitem>Ensure that full paths to the following files are all included in the active CLASSPATH setting --
+    </sect3>
+    <sect3 id="rdfnativestorageprovidersredlandref"><title>References</title>
     <itemizedlist mark="bullet">
-      <listitem>openrdf-sesame-2.1.2-onejar.jar</listitem>
-      <listitem>slf4j-api-1.5.0.jar</listitem>
-      <listitem>slf4j-jdk14-1.5.0.jar</listitem>
-      <listitem>virtjdbc3.jar</listitem>
-      <listitem>virt_sesame2.jar</listitem>
+        <listitem><ulink url="http://librdf.org/docs/api/redland-storage.html">RedLand Triple 
+        Store</ulink></listitem>
+        <listitem><ulink url="http://librdf.org/docs/api/redland-storage-modules.html">RedLand 
+        Storage Modules</ulink></listitem>
    </itemizedlist>
+    </sect3>
+  </sect2>
+</sect1>
+
+<sect1 id="rdfgraphreplication"><title>RDF Graph Replication</title>
+<para>The following section demonstrates how to replicate graphs from one Virtuoso 
+	instance to (an)other Virtuoso instance(s), using the RDF Replication Feature.</para>
+<para>Terms used in this section:</para> 
+<itemizedlist mark="bullet">
+  <listitem><emphasis>Host Virtuoso Instance</emphasis>, aka the publisher: the instance where we 
+  will insert RDF data into a Named Graph; then create a publication of this graph.</listitem>
+  <listitem><emphasis>Destination Virtuoso Instance</emphasis>, aka the subscriber: the instance 
+  which will subscribe to the publication from the Host Virtuoso Instance.</listitem>
+</itemizedlist>
+  <tip><title>See Also:</title>
+     <para><link linkend="fn_rdf_repl_start"><function>DB.DBA.RDF_REPL_START()</function></link></para>  
+     <para><link linkend="fn_rdf_repl_graph_ins"><function>DB.DBA.RDF_REPL_GRAPH_INS()</function></link></para>  
+     <para><link linkend="fn_rdf_repl_graph_del"><function>DB.DBA.RDF_RDF_REPL_GRAPH_DEL()</function></link></para>            
+  </tip>
+<para>The basic outline:</para>
+<itemizedlist mark="bullet">
+   <listitem>First, use the Virtuoso Conductor on a Host Virtuoso Instance to publish a named 
+   	graph.</listitem>
+   <listitem>Then, use the Virtuoso Conductor on a Destination Virtuoso Instance to subscribe 
+   	to deltas from the published graph.</listitem>
+   <listitem>Finally, see how a change in the publisher's graph will appear in the subscriber's 
+   	graph.</listitem>
+</itemizedlist>
+  <sect2 id="rdfgraphreplicationtopl"><title>Replication Topologies</title>
+<para>Typical replication topologies are Chains, Stars and Bi-directional. They can be achieved with 
+	Virtuoso, by repeating the "Publish" and/or "Subscribe" steps on each relevant node.</para>
+	  <sect3 id="rdfgraphreplicationtoplstar"><title>Star Replication Topology</title> 
+	     <para>In a Star, there is one Publisher, and many Subscribers.</para>
+	     <figure id="star1" float="1">
+         <title>Star Replication Topology</title>
+         <graphic fileref="ui/topo-star.png"/>
+       </figure>
+       <para>To set up a Star, follow the scenario:</para>
+       <orderedlist>
+         <listitem>Configure Instance #1 to Publish.</listitem>
+         <listitem>Configure Instance #2 to Subscribe to #1.</listitem>
+         <listitem>Repeat as necessary.</listitem>
+       </orderedlist>
+       <sect4 id="rdfgraphreplicationtoplstarex"><title>Star Replication Topology Example</title> 
+         <para>The following How-To walks you through setting up Virtuoso RDF Graph Replication in a Star Topology.</para>
+         <sect5 id="rdfgraphreplicationtoplstarexpr"><title>Prerequisites</title> 
+           <sect6 id="rdfgraphreplicationtoplstarexprini"><title>Database INI Parameters</title> 
+             <para>Suppose there are 3 Virtuoso instances respectively with the following ini parameters values:</para>
+             <orderedlist>
+               <listitem>virtuoso1.ini:
+<programlisting><![CDATA[
+...
+[Database]
+DatabaseFile    = virtuoso1.db
+TransactionFile = virtuoso1.trx
+ErrorLogFile     = virtuoso1.log
+...
+[Parameters]
+ServerPort               = 1111
+SchedulerInterval        = 1
+...
+[HTTPServer]
+ServerPort                  = 8891
+...
+[URIQA]
+DefaultHost = localhost:8891
+...
+[Replication]
+ServerName   = db1
+...
+	
+]]></programlisting>
       </listitem>
-      <listitem>Execute the following command --
+               <listitem>virtuoso2.ini:
 <programlisting><![CDATA[
-javac VirtuosoTest.java
+...
+[Database]
+DatabaseFile    = virtuoso2.db
+TransactionFile = virtuoso2.trx
+ErrorLogFile     = virtuoso2.log
+...
+[Parameters]
+ServerPort               = 1112
+SchedulerInterval        = 1
+...
+[HTTPServer]
+ServerPort                  = 8892
+...
+[URIQA]
+DefaultHost = localhost:8892
+...
+[Replication]
+ServerName   = db2
+...	
 ]]></programlisting>
-      <para>Note: to use row auto commit is recommended to add the following to the connect string:
-      </para>
+               </listitem>             	
+               <listitem>virtuoso3.ini:
 <programlisting><![CDATA[
-"/log_enable=2"
--- i.e. in VirtuosoTest.java the line:
-Repository repository = new VirtuosoRepository("jdbc:virtuoso://" + sa[0] + ":" + sa[1], sa[2], sa[3]);
--- should become:
-Repository repository = new VirtuosoRepository("jdbc:virtuoso://" + sa[0] + ":" + sa[1]+ "/log_enable=2", sa[2], sa[3]);
+...
+[Database]
+DatabaseFile    = virtuoso3.db
+TransactionFile = virtuoso3.trx
+ErrorLogFile     = virtuoso3.log
+...
+[Parameters]
+ServerPort               = 1113
+SchedulerInterval        = 1
+...
+[HTTPServer]
+ServerPort                  = 8893
+...
+[URIQA]
+DefaultHost = localhost:8893
+...
+[Replication]
+ServerName   = db3
+...
 ]]></programlisting>
       </listitem>
     </orderedlist>
-    </sect4>
-    <sect4 id="rdfnativestorageproviderssesametesting"><title>Testing</title>
+           </sect6> 
+           <sect6 id="rdfgraphreplicationtoplstarexprdsn"><title>Database DSNs</title> 
+             <para>Use the ODBC Administrator on your Virtuoso host (e.g., on Windows, Start menu -> Control Panel -> Administrative Tools -> Data Sources (ODBC); on Mac OS X, /Applications/Utilities/OpenLink ODBC Administrator.app) to create a System DSN for each of db1, db2, db3, with names db1, db2 and db3, respectively.</para>
+           </sect6>   
+           <sect6 id="rdfgraphreplicationtoplstarexprcnd"><title>Install Conductor package</title> 
+             <para>On each of the 3 Virtuoso instances install the <ulink url="http://s3.amazonaws.com/opldownload/uda/vad-packages/6.1/virtuoso/conductor_dav.vad">conductor_dav.vad</ulink> package.</para>
+           </sect6>                            
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplstarexprph"><title>Create a Publication on the Host Virtuoso Instance db1</title> 
     <orderedlist>
-      <listitem>Ensure that full paths to the following files are all included in the active CLASSPATH setting --
+   <listitem>Go to Conductor -> Replication -> Transactional -> Publications 
+     <figure id="star2" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r6.png"/>
+     </figure>
+  </listitem>
+   <listitem>Click Enable RDF Publishing</listitem>
+    <listitem>A publication with the name RDF Publication should be created: 
+     <figure id="star3" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r7.png"/>
+     </figure>
+  </listitem>
+    <listitem>Click the link which is the publication name.</listitem>
+    <listitem>You will be shown the publication items page: 
+     <figure id="star4" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r8.png"/>
+     </figure>
+  </listitem>
+    <listitem>Enter for Graph IRI:
+<programlisting><![CDATA[
+http://example.org	
+]]></programlisting>    	 
+     <figure id="star5" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r9.png"/>
+     </figure>
+  </listitem>
+    <listitem>Click Add New</listitem>
+    <listitem>The item will be created and shown in the list of items for the currently viewed publication. 
+     <figure id="star6" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r10.png"/>
+     </figure>
+  </listitem>    
+</orderedlist>
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplstarexprih"><title>Insert Data into a Named Graph on the Host 
+         Virtuoso Instance</title> 
+           <para>There are several ways to insert data into a Virtuoso Named Graph. In this example, we 
+           	will use the Virtuoso Conductor's Import RDF feature:</para>
+<orderedlist>
+  <listitem>In the Virtuoso Conductor, go to RDF -> RDF Store Upload 
+     <figure id="star7" float="1">
+       <title>Replication Topology</title>
+       <graphic fileref="ui/r1.png"/>
+     </figure>
+  </listitem> 
+  <listitem>In the form: 
+     <figure id="star8" float="1">
+       <title>Replication Topology</title>
+       <graphic fileref="ui/r2.png"/>
+     </figure>
     <itemizedlist mark="bullet">
-      <listitem>openrdf-sesame-2.1.2-onejar.jar</listitem>
-      <listitem>slf4j-api-1.5.0.jar</listitem>
-      <listitem>slf4j-jdk14-1.5.0.jar</listitem>
-      <listitem>virtjdbc3.jar</listitem>
-      <listitem>virt_sesame2.jar</listitem>
-      <listitem>virtuoso_driver</listitem>
-    </itemizedlist>
-      </listitem>
-      <listitem>Test the Sesame 2 Provider with the following command
+  <listitem>Tick the box for Resource URL and enter your resource URL, for e.g.: 
 <programlisting><![CDATA[
-java VirtuosoTest <hostname> <port> <uid> <pwd>
-]]></programlisting>
-      </listitem>
-      <listitem>The test run should look like this --
+http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this	
+]]></programlisting>  	
+  </listitem>
+  <listitem>Enter for Named Graph IRI:
 <programlisting><![CDATA[
-$ java VirtuosoTest localhost 1111 dba dba
-
-== TEST 1:  : Start
-   Loading data from URL: http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com/foaf.rdf
-== TEST 1:  : End
-PASSED: TEST 1
-
-== TEST 2:  : Start
-   Clearing triple store
-== TEST 2:  : End
-PASSED: TEST 2
-
-== TEST 3:  : Start
-   Loading data from file: virtuoso_driver/data.nt
-== TEST 3:  : End
-PASSED: TEST 3
-
-== TEST 4:  : Start
-   Loading UNICODE single triple
-== TEST 4:  : End
-PASSED: TEST 4
-
-== TEST 5:  : Start
-   Loading single triple
-== TEST 5:  : End
-PASSED: TEST 5
-
-== TEST 6:  : Start
-   Casted value type
-== TEST 6:  : End
-PASSED: TEST 6
-
-== TEST 7:  : Start
-   Selecting property
-== TEST 7:  : End
-PASSED: TEST 7
-
-== TEST 8:  : Start
-   Statement does not exists
-== TEST 8:  : End
-PASSED: TEST 8
-
-== TEST 9:  : Start
-   Statement exists (by resultset size)
-== TEST 9:  : End
-PASSED: TEST 9
-
-== TEST 10:  : Start
-   Statement exists (by hasStatement())
-== TEST 10:  : End
-PASSED: TEST 10
-
-== TEST 11:  : Start
-   Retrieving namespaces
-== TEST 11:  : End
-PASSED: TEST 11
-
-== TEST 12:  : Start
-   Retrieving statement (http://myopenlink.net/dataspace/person/kidehen http://myopenlink.net/foaf/name null)
-== TEST 12:  : End
-PASSED: TEST 12
-
-== TEST 13:  : Start
-   Writing the statements to file: (/Users/hughwilliams/src/virtuoso-opensource/binsrc/sesame2/results.n3.txt)
-== TEST 13:  : End
-PASSED: TEST 13
-
-== TEST 14:  : Start
-   Retrieving graph ids
-== TEST 14:  : End
-PASSED: TEST 14
-
-== TEST 15:  : Start
-   Retrieving triple store size
-== TEST 15:  : End
-PASSED: TEST 15
-
-== TEST 16:  : Start
-   Sending ask query
-== TEST 16:  : End
-PASSED: TEST 16
-
-== TEST 17:  : Start
-   Sending construct query
-== TEST 17:  : End
-PASSED: TEST 17
-
-== TEST 18:  : Start
-   Sending describe query
-== TEST 18:  : End
-PASSED: TEST 18
-
-============================
-PASSED:18 FAILED:0
-]]></programlisting>
+http://example.org	
+]]></programlisting>  	
+</listitem>
+    </itemizedlist>
       </listitem>
-    </orderedlist>
-    </sect4>
-    </sect3>
-    <sect3 id="rdfnativestorageproviderssesamegettingstarted"><title>Getting Started</title>
-    <para>This section covers the essentials for connecting to and manipulating data stored in
-a Virtuoso repository using the Sesame API. More information on the Sesame Framework, including
-extended examples on how to use the API, can be found in Chapter 8 of the Sesame User's guide,
-<ulink url="http://www.openrdf.org/doc/sesame2/2.1.2/users/ch08.html#d0e833">the RepositoryConnection API</ulink>.
-    </para>
-    <para>The interfaces for the Repository API can be found in packages virtuoso.sesame2.driver
-and org.openrdf.repository. Several implementations for these interface exist in the
-Virtuoso Provider download package.
-The <ulink url="http://www.openrdf.org/doc/sesame2/2.1.2/apidocs/">Javadoc reference for the Sesame API</ulink>
-is available online and can also be found in the doc directory of the download.
-    </para>
-    <sect4 id="rdfnativestorageproviderssesamegettingstartedcrrep"><title>Creating a VirtuosoRepositoryRDF object</title>
-      <para>The first step to connecting to Virtuoso through the Sesame API is to create a
-Repository for it. The Repository object operates on (stacks of) Sail object(s) for storage
-and retrieval of RDF data.
-      </para>
-      <para>One of the simplest configurations is a repository that just stores RDF data in main
-memory without applying any inference or whatsoever. This is also by far the fastest type of
-repository that can be used. The following code creates and initialize a non-inferencing main-memory
-repository:
-      </para>
+  <listitem>Click Upload</listitem> 
+  <listitem>A successful upload will result in this message: 
+     <figure id="star9" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r3.png"/>
+     </figure>
+  </listitem> 
+  <listitem>Check the inserted triples by executing a query like the following against the SPARQL endpoint, http://cname:port/sparql:
 <programlisting><![CDATA[
-import virtuoso.sesame2.driver.VirtuosoRepository;
-
-Repository myRepository = VirtuosoRepository("jdbc:virtuoso://localhost:1111","dba","dba");
-
-myRepository.initialize();
+SELECT * 
+  FROM <http://example.org>
+ WHERE { ?s ?p ?o }
 ]]></programlisting>
-      <para>The constructor of the VirtuosoRepositoryRDF class accepts the JDBC URL of the Virtuoso
-engine (the default port is 1111), the username and password of an authorized user. Following this
-example, the repository needs to be initialized to prepare the Sail(s) that it operates on, which
-includes operations such as restoring previously stored data, setting up connections to a relational
-database, etc.
-      </para>
-      <para>The repository that is created by the above code is volatile: its contents are lost
-when the object is garbage collected or when the program is shut down. This is fine for cases where,
-for example, the repository is used as a means for manipulating an RDF model in memory. Using the
-Virtuoso repository with RepositoryConnection.
-      </para>
-      <para>Now that we have created a VirtuosoRepositoryRDF, we want to do something with it.
-This is achieved through the use of the VirtuosoRepositoryConnection, which can be created by
-the VirtuosoRepositoryRDF.
-      </para>
-      <para>A VirtuosoRepositoryConnection represents - as the name suggests - a connection
-to the actual Virtuoso quad store. We can issue operations over this connection, and close it
-when we are done to make sure we are not keeping resources unnecessarily occupied.
-      </para>
-      <para>In the following sections, we will show some examples of basic operations
-using the Northwind dataset.
-      </para>
-    </sect4>
-    <sect4 id="rdfnativestorageproviderssesamegettingstartedrdfvirt"><title>Adding RDF to Virtuoso</title>
-      <para>The Repository implements the Sesame Repository API offers various methods for adding
-data to a repository. Data can be added pro grammatically by specifying the location of a file
-that contains RDF data, and statements can be added individually or in collections.
-      </para>
-      <para>We perform operations on the repository by requesting a RepositoryConnection from
-the repository, which returns a VirtuosoRepositoryConnection object. On this VirtuosoRepositoryConnection
-object we can perform the various operations, such as query evaluation, getting, adding, or removing
-statements, etc.
-      </para>
-      <para>The following example code adds two files, one local and one located on the WWW, to a repository:
-      </para>
+     <figure id="star10" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r4.png"/>
+     </figure>
+      </listitem>
+  <listitem>See how many triples have been inserted in your graph: 
 <programlisting><![CDATA[
-import org.openrdf.repository.RepositoryException;
-
-import org.openrdf.repository.Repository;
-
-import org.openrdf.repository.RepositoryConnection;
-
-import org.openrdf.rio.RDFFormat;
-
-import java.io.File;
-
-import java.net.URL;
-
-File file = new File("/path/to/example.rdf");
-
-String baseURI = "http://example.org/example/localRDF";
-
-
-try {
-
-   RepositoryConnection con = myRepository.getConnection();
-
-   try {
-
-      con.add(file, baseURI, RDFFormat.RDFXML);
-
-      URL url = new URL("http://example.org/example/remoteRDF");
-
-      con.add(url, url.toString(), RDFFormat.RDFXML);
-
-   }
-
-   finally {
-
-      con.close();
-
-   }
-
-}
-
-catch (RepositoryException rex) {
-
-   // handle exception
-
-}
-
-catch (java.io.IOEXception e) {
-
-   // handle io exception
-
-}
+SELECT COUNT(*) 
+  FROM <http://example.org>
+ WHERE { ?s ?p ?o }	
+]]></programlisting>  	
+     <figure id="star11" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r5.png"/>
+     </figure>
+  </listitem> 
+</orderedlist>
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplstarexprsp"><title>Subscribe to the Publication on the a 
+         Destination Virtuoso Instance db2, db3, etc.</title> 
+<orderedlist>
+  <listitem>Go to Conductor -> Replication -> Transactional -> Subscriptions 
+     <figure id="star12" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r11.png"/>
+     </figure>
+  </listitem> 
+  <listitem>Click New Subscription 
+     <figure id="star13" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r12.png"/>
+     </figure>
+  </listitem> 
+  <listitem>Specify a new Data Source Enter or selected target data source from the available connected Data Sources: 
+     <figure id="star14" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r13.png"/>
+     </figure>
+     <figure id="star15" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r13a.png"/>
+     </figure>
+  </listitem> 
+  <listitem>Click Publications list
+     <figure id="star16" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r15.png"/>
+     </figure>
+  </listitem> 
+  <listitem>Select the RDF Publication and click List Items 
+     <figure id="star17" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r16.png"/>
+     </figure>
+  </listitem> 
+  <listitem>Click Subscribe</listitem> 
+  <listitem>The subscription will be created 
+     <figure id="star18" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r18.png"/>
+     </figure>
+  </listitem> 
+  <listitem>Click Sync</listitem>       
+  <listitem>Check the retrieved triples by executing the following query 
+<programlisting><![CDATA[
+SELECT * 
+  FROM <http://example.org>
+ WHERE {?s ?p ?o}	
+]]></programlisting>  	
+     <figure id="star19" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r19.png"/>
+     </figure>
+  </listitem>
+  <listitem>See how many triples have been inserted into your graph by executing the following query: 
+<programlisting><![CDATA[
+SELECT COUNT(*) 
+  FROM <http://example.org>
+ WHERE {?s ?p ?o}	
+]]></programlisting>  	
+     <figure id="star20" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r5.png"/>
+     </figure>
+  </listitem>  
+</orderedlist>   
+<para>These steps may be repeated for any number of Subscriber.</para>
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplstarexprch"><title>Insert Triples into the Host Virtuoso 
+         Instance Graph and check availability at Destination Virtuoso Instance Graph</title> 
+<orderedlist>
+  <listitem>To check the starting count, on the Destination Virtuoso Instance SPARQL Endpoint, execute:
+<programlisting><![CDATA[
+SELECT COUNT(*) 
+  FROM <http://example.org>
+ WHERE { ?s ?p ?o }	
+]]></programlisting>  	
+  </listitem>
+  <listitem>On the Host Virtuoso Instance go to Conductor -> Database -> Interactive SQL and execute the following statement:
+<programlisting><![CDATA[
+SPARQL INSERT INTO GRAPH <http://example.org> 
+  { 
+     <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this>
+     <http://xmlns.com/foaf/0.1/interest>
+     <http://dbpedia.org/resource/Web_Services> 
+  } ;
+SPARQL INSERT INTO GRAPH <http://example.org> 
+  { 
+    <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this>  	
+    <http://xmlns.com/foaf/0.1/interest>  	
+    <http://dbpedia.org/resource/Web_Clients> 
+  } ;
+SPARQL INSERT INTO GRAPH <http://example.org> 
+  { 
+    <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this>  	
+    <http://xmlns.com/foaf/0.1/interest>  	
+    <http://dbpedia.org/resource/SPARQL> 
+  } ;	
+]]></programlisting> 
+     <figure id="star21" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r22.png"/>
+     </figure> 	
+     <figure id="star22" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r23.png"/>
+     </figure>     
+  </listitem>
+  <listitem>To confirm that the triple count has increased by the number of inserted triples, execute the following on the Destination Virtuoso Instance SPARQL Endpoint: 
+<programlisting><![CDATA[
+SELECT COUNT(*) 
+  FROM <http://example.org>
+ WHERE { ?s ?p ?o }	
 ]]></programlisting>
-      <para>More information on other available methods can be found in the javadoc
-reference of the RepositoryConnection interface.
-      </para>
-    </sect4>
-    <sect4 id="rdfnativestorageproviderssesamegettingstartedqr"><title>Querying Virtuoso</title>
-      <para>The Repository API has a number of methods for creating and evaluating queries.
-Three types of queries are distinguished: tuple queries, graph queries and boolean queries.
-The query types differ in the type of results that they produce.
-      </para>
-      <para><emphasis>Select Query:</emphasis> The result of a select query is a set of tuples
-(or variable bindings), where each tuple represents a solution of a query. This type of query
-is commonly used to get specific values (URIs, blank nodes, literals) from the stored RDF data.
-The method QueryFactory.executeQuery() returns a Value[][] for sparql "SELECT" queries.
-The method QueryFactory.executeQuery() also calls the QueryFactory.setResult() which populates
-a set of tuples for SPARQL "SELECT" queries. The graph can be retrieved using
-QueryFactory.getBooleanResult().
-      </para>
-      <para><emphasis>Graph Query:</emphasis> The result of graph queries is an RDF graph
-(or set of statements). This type of query is very useful for extracting sub-graphs from
-the stored RDF data, which can then be queried further, serialized to an RDF document,
-etc. The method QueryFactory.executeQuery() calls the QueryFactory.setGraphResult()
-which populates a graph for SPARQL "DESCRIBE" and "CONSTRUCT" queries. The graph can
-be retrieved using QueryFactory.getGraphResult().
-      </para>
-      <para><emphasis>Boolean Query:</emphasis> The result of boolean queries is a simple
-boolean value, i.e. true of false. This type of query can be used to check if a repository
-contains specific information. The method QueryFactory.executeQuery() calls the
-QueryFactory.setBooleanResult() which sets a boolean value for sparql "ASK" queries.
-The value can be retrieved using QueryFactory.getBooleanResult().
-      </para>
-      <para>Note: Although Sesame 2 currently supports two query languages: SeRQL and SPARQL,
-the Virtuoso provider only supports the W3C SPARQL specification.
-      </para>
+     <figure id="star23" float="1">
+       <title>Star Replication Topology</title>
+       <graphic fileref="ui/r24.png"/>
+     </figure> 	
+      </listitem>
+    </orderedlist>
+         </sect5>                                     
     </sect4>
-    <sect4 id="rdfnativestorageproviderssesamegettingstartevq"><title>Evaluating a SELECT Query</title>
-      <para>To evaluate a tuple query we simply do the following:
-      </para>
+    </sect3>
+	  <sect3 id="rdfgraphreplicationtoplchain"><title>Chain Replication Topology</title> 
+      <para>In a Chain, there is one original Publisher, to which there is only one Subscriber. That 
+      	Subscriber may also serve as a Publisher, again with only one Subscriber. The chain ends with 
+      	a Subscriber which does not Publish.</para>	  
+     <figure id="chain1" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/topo-chain.png"/>
+     </figure>   
+     <para>To set up a Chain, follow the scenario:</para>   	
+<orderedlist>
+   <listitem>Configure Instance #1 to Publish.</listitem>
+   <listitem>Configure Instance #2 to Subscribe to #1.</listitem>
+   <listitem>Configure Instance #2 to Publish.</listitem>
+   <listitem>Configure Instance #3 to Subscribe to #2.</listitem>
+   <listitem>Repeat as necessary.</listitem>
+</orderedlist>
+       <sect4 id="rdfgraphreplicationtoplchainex"><title>Chain Replication Topology Example</title> 
+         <para>The following How-To walks you through setting up Virtuoso RDF Graph Replication in a 
+         	Chain Topology.</para>
+         <sect5 id="rdfgraphreplicationtoplchainexpr"><title>Prerequisites</title> 
+           <sect6 id="rdfgraphreplicationtoplchainexprini"><title>Database INI Parameters</title> 
+<para>Suppose there are 3 Virtuoso instances respectively with the following ini parameters values:</para>
+             <orderedlist>
+               <listitem>virtuoso1.ini:
 <programlisting><![CDATA[
-import java.util.List;
-
-import org.openrdf.OpenRDFException;
-
-import org.openrdf.repository.RepositoryConnection;
-
-import org.openrdf.query.TupleQuery;
-
-import org.openrdf.query.TupleQueryResult;
-
-import org.openrdf.query.BindingSet;
-
-import org.openrdf.query.QueryLanguage;
-
-
-
-try {
-
-   RepositoryConnection? con = myRepository.getConnection();
-
-   try {
-
-      String queryString = "SELECT ?s ?p FROM  <http://mygraph.com> WHERE { ?s ?p ?o }";
-
-      TupleQuery? tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
-
-      TupleQueryResult? result = tupleQuery.evaluate();
-
-      try {
-
-         ? // do something with the result
-
-      }
-
-      finally {
-
-         result.close();
-
-      }
-
-   }
-
-   finally {
-
-      con.close();
-
-   }
-
-}
-
-catch (RepositoryException? e) {
-
-   // handle exception
+...
+[Database]
+DatabaseFile    = virtuoso1.db
+TransactionFile = virtuoso1.trx
+ErrorLogFile     = virtuoso1.log
+...
+[Parameters]
+ServerPort               = 1111
+SchedulerInterval        = 1
+...
+[HTTPServer]
+ServerPort                  = 8891
+...
+[URIQA]
+DefaultHost = localhost:8891
+...
+[Replication]
+ServerName   = db1
+...
 
-}
 ]]></programlisting>
-      <para>This evaluates a SPARQL query and returns a TupleQueryResult, which consists of a
-sequence of BindingSet objects. Each BindingSet contains a set of pairs called Binding objects.
-A Binding object represents a name/value pair for each variable in the query’s projection.
-      </para>
-      <para>We can use the TupleQueryResult to iterate over all results and get each individual
-result for x and y:
-      </para>
+               </listitem>
+               <listitem>virtuoso2.ini:
 <programlisting><![CDATA[
-while (result.hasNext()) {
-
-   BindingSet bindingSet = result.next();
-
-   Value valueOfX = bindingSet.getValue("s");
-
-   Value valueOfY = bindingSet.getValue("p");
-
-   // do something interesting with the query variable values here?
-
-}
+...
+[Database]
+DatabaseFile    = virtuoso2.db
+TransactionFile = virtuoso2.trx
+ErrorLogFile     = virtuoso2.log
+...
+[Parameters]
+ServerPort               = 1112
+SchedulerInterval        = 1
+...
+[HTTPServer]
+ServerPort                  = 8892
+...
+[URIQA]
+DefaultHost = localhost:8892
+...
+[Replication]
+ServerName   = db2
+...	
 ]]></programlisting>
-      <para>As you can see, we retrieve values by name rather than by an index. The names used
-should be the names of variables as specified in your query. The TupleQueryResult.getBindingNames()
-method returns a list of binding names, in the order in which they were specified in the query.
-To process the bindings in each binding set in the order specified by the projection, you can do
-the following:
-      </para>
+               </listitem>             	
+               <listitem>virtuoso3.ini:
 <programlisting><![CDATA[
-List bindingNames = result.getBindingNames();
-
-while (result.hasNext()) {
-
-   BindingSet bindingSet = result.next();
-
-   Value firstValue = bindingSet.getValue(bindingNames.get(0));
-
-   Value secondValue = bindingSet.getValue(bindingNames.get(1));
-
-   // do something interesting with the values here?
-
-}
+...
+[Database]
+DatabaseFile    = virtuoso3.db
+TransactionFile = virtuoso3.trx
+ErrorLogFile     = virtuoso3.log
+...
+[Parameters]
+ServerPort               = 1113
+SchedulerInterval        = 1
+...
+[HTTPServer]
+ServerPort                  = 8893
+...
+[URIQA]
+DefaultHost = localhost:8893
+...
+[Replication]
+ServerName   = db3
+...
 ]]></programlisting>
-      <para>It is important to invoke the close() operation on the TupleQueryResult, after we are
-done with it. A TupleQueryResult evaluates lazily and keeps resources (such as connections to
-the underlying database) open. Closing the TupleQueryResult frees up these resources. Do not
-forget that iterating over a result may cause exceptions! The best way to make sure no connections
-are kept open unnecessarily is to invoke close() in the finally clause.
-      </para>
-      <para>An alternative to producing a TupleQueryResult is to supply an object that implements
-the TupleQueryResultHandler interface to the query's evaluate() method. The main difference is that
-when using a return object, the caller has control over when the next answer is retrieved, whereas
-with the use of a handler, the connection simply pushes answers to the handler object as soon as it
-has them available.
-      </para>
-      <para>As an example we will use SPARQLResultsXMLWriter, which is a TupleQueryResultHandler
-implementation that writes SPARQL Results XML documents to an output stream or to a writer:
-      </para>
+               </listitem>               	
+             </orderedlist>           
+           </sect6> 
+           <sect6 id="rdfgraphreplicationtoplchainexprdsn"><title>Database DSNs</title> 
+             <para>Use the ODBC Administrator on your Virtuoso host (e.g., on Windows, Start menu -> Control Panel -> Administrative Tools -> Data Sources (ODBC); on Mac OS X, /Applications/Utilities/OpenLink ODBC Administrator.app) to create a System DSN for each of db1, db2, db3, with names db1, db2 and db3, respectively.</para>           
+           </sect6>   
+           <sect6 id="rdfgraphreplicationtoplchainexprcnd"><title>Install Conductor package</title> 
+             <para>On each of the 3 Virtuoso instances install the <ulink url="http://s3.amazonaws.com/opldownload/uda/vad-packages/6.1/virtuoso/conductor_dav.vad">conductor_dav.vad</ulink> package.</para>           
+           </sect6>                            
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplchainexpr"><title>Create Publication on db1</title> 
+<orderedlist>
+  <listitem>Go to http://localhost:8891/conductor and log in as dba</listitem> 
+  <listitem>Go to Conductor - > Replication - > Transactional - > Publications
+     <figure id="chain2" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m1.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Click <emphasis>Enable RDF Publishing</emphasis></listitem> 
+  <listitem>As result publication with the name <emphasis>RDF Publication</emphasis> should be created
+     <figure id="chain3" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m2.png"/>
+     </figure>
+   </listitem>   
+  <listitem>Click the link which is the publication name. </listitem> 
+  <listitem>You will be shown the publication items page
+     <figure id="chain4" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m3.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Enter for Graph IRI:
 <programlisting><![CDATA[
-import org.openrdf.query.resultio.sparqlxml.SPARQLResultsXMLWriter;
-
-?
-
-FileOutputStream out = new FileOutputStream("/path/to/result.srx");
-
-try {
-
-   SPARQLResultsXMLWriter sparqlWriter = new SPARQLResultsXMLWriter(out);
-
-   RepositoryConnection con = myRepository.getConnection();
-
-   try {
-
-      String queryString = "SELECT * FROM  WHERE { ?s ?p ?o }";
-
-      TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
-
-      tupleQuery.evaluate(sparqlWriter);
-
-   }
-
-   finally {
-
-      con.close();
-
-   }
-
-}
-
-finally {
-
-   out.close();
-
-}
+http://example.org
 ]]></programlisting>
-      <para>You can just as easily supply your own application-specific implementation of
-TupleQueryResultHandler though.
-      </para>
-      <para>Lastly, an important warning: as soon as you are done with the RepositoryConnection
-object, you should close it. Notice that during processing of the TupleQueryResult object
-(for example, when iterating over its contents), the RepositoryConnection should still be open.
-We can invoke con.close() after we have finished with the result.
-      </para>
-    </sect4>
-    <sect4 id="rdfnativestorageproviderssesamegettingstartevcnq"><title>Evaluating a CONSTRUCT query</title>
-      <para>The following code evaluates a graph query on a repository:
-      </para>
+     <figure id="chain5" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m4.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Click Add New</listitem> 
+  <listitem>The item will be created and shown in the list of items for the currently viewed publication. 
+     <figure id="chain6" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m5.png"/>
+     </figure>
+  </listitem>    
+</orderedlist>
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplchainexpr"><title>Create subscription from db2 to db1's Publication</title> 
+<orderedlist>
+  <listitem>Log in at http://localhost:8892/conductor</listitem> 
+  <listitem>Go to Replication - > Transactional - > Subscriptions 
+     <figure id="chain7" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m6.png"/>
+     </figure>
+  </listitem>   
+  <listitem>Click <emphasis>New Subscription</emphasis>
+     <figure id="chain8" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m7.png"/>
+     </figure>
+  </listitem>      
+  <listitem>From the list of "Specify new data source" select Data Source db1
+     <figure id="chain9" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m8.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Enter for db1 dba user credentials
+     <figure id="chain10" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m9.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Click "Add Data Source"</listitem> 
+  <listitem>As result <emphasis>db1</emphasis> will be shown in the "Connected Data Sources" list. 
+     <figure id="chain11" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m10.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Select <emphasis>db1</emphasis> the "Connected Data Sources" list and click "Publications list"
+     <figure id="chain12" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m11.png"/>
+     </figure>
+  </listitem>    
+  <listitem>As result will be shown the list of available publications for the selected data source. Select the one with name "RDF Publication" and click "List Items".
+     <figure id="chain13" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m12.png"/>
+     </figure>
+  </listitem>    
+  <listitem>As result will be shown the "Confirm subscription" page. 
+     <figure id="chain14" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m13.png"/>
+     </figure>
+  </listitem>    
+  <listitem>The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute.
+     <figure id="chain15" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m14.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Click "Subscribe"</listitem> 
+  <listitem>The subscription will be created. 
+     <figure id="chain16" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m15.png"/>
+     </figure>
+  </listitem>   
+</orderedlist>
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplchainexpr"><title>Create Publication on db2</title> 
+         <orderedlist>
+  <listitem>Go to http://localhost:8892/conductor and log in as dba</listitem> 
+  <listitem>Go to Conductor - > Replication - > Transactional - > Publications
+     <figure id="chain17" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m16.png"/>
+     </figure>
+  </listitem>   
+  <listitem>Click <emphasis>Enable RDF Publishing</emphasis></listitem> 
+  <listitem>As result publication with the name <emphasis>RDF Publication</emphasis> should be created
+     <figure id="chain18" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m17.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Click the link which is the publication name.</listitem>   
+  <listitem>You will be shown the publication items page
+     <figure id="chain19" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m18.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Enter for Graph IRI:
 <programlisting><![CDATA[
-import org.openrdf.query.GraphQueryResult;
-
-GraphQueryResult graphResult = con.prepareGraphQuery(
-
-      QueryLanguage.SPARQL, "CONSTRUCT * FROM <http://mygraph.com> WHERE { ?s ?p ?o }").evaluate();
+http://example.org
+]]></programlisting>
+     <figure id="chain20" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m19.png"/>
+     </figure>
+  </listitem>   
+  <listitem>Click Add New</listitem> 
+  <listitem>The item will be created and shown in the list of items for the currently viewed publication. 
+     <figure id="chain21" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m20.png"/>
+     </figure>
+  </listitem>    
+</orderedlist>
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplchainexpr"><title>Create subscription from db3 to db2's Publication</title> 
+         <orderedlist>
+  <listitem>Log in at http://localhost:8893/conductor</listitem> 
+  <listitem>Go to Replication - > Transactional - > Subscriptions 
+     <figure id="chain22" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m21.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Click <emphasis>New Subscription</emphasis>
+     <figure id="chain23" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m22.png"/>
+     </figure>
+  </listitem>    
+  <listitem>From the list of "Specify new data source" select Data Source db2
+     <figure id="chain24" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m23.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Enter for db2 dba user credentials
+     <figure id="chain25" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m24.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Click "Add Data Source"
+     <figure id="chain26" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m25.png"/>
+     </figure>
+  </listitem>    
+  <listitem>As result <emphasis>db2</emphasis> will be shown in the "Connected Data Sources" list. Select it and click "Publications list"
+     <figure id="chain27" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m26.png"/>
+     </figure>
+  </listitem>    
+  <listitem>As result will be shown the list of available publications for the selected data source. Select the one with name "RDF Publication" and click "List Items".
+     <figure id="chain28" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m27.png"/>
+     </figure>
+  </listitem>    
+  <listitem>As result will be shown the "Confirm subscription" page.  
+     <figure id="chain29" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m28.png"/>
+     </figure>
+  </listitem>    
+  <listitem>The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute.
+     <figure id="chain30" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m29.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Click "Subscribe"</listitem>
+  <listitem>The subscription will be created. 
+     <figure id="chain31" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m30.png"/>
+     </figure>
+  </listitem>    
+</orderedlist>
+         </sect5>  
+         <sect5 id="rdfgraphreplicationtoplchainind"><title>Insert Data into a Named Graph on the db1 Virtuoso Instance</title>                                    
+<orderedlist>
+  <listitem>Log in at http://localhost:8891/conductor</listitem> 
+  <listitem>Go to RDF - > RDF Store Upload 
+     <figure id="chain32" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m31.png"/>
+     </figure>
+  </listitem>    
+  <listitem>In the shown form:
+      <orderedlist>
+     <listitem>Tick the box for <emphasis>Resource URL</emphasis> and enter your resource URL, e.g.:
+<programlisting><![CDATA[
+http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this
+]]></programlisting>
+     </listitem> 
+     <listitem>Enter for Named Graph IRI:
+<programlisting><![CDATA[
+http://example.org
+]]></programlisting>
+     <figure id="chain33" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m32.png"/>
+     </figure>
+     </listitem> 
+      </orderedlist>
+  </listitem>     
+  <listitem>Click Upload</listitem> 
+  <listitem>A successful upload will result in a shown message.
+     <figure id="chain34" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m33.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Check the count of the inserted triples by executing a query like the following against the SPARQL endpoint, 
+http://localhost:8891/sparql:
+<programlisting><![CDATA[
+SELECT COUNT(*) 
+   FROM <http://example.org>
+WHERE { ?s ?p ?o }
+]]></programlisting>
+     <figure id="chain35" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m34.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Should return <emphasis>55</emphasis> as total.
+     <figure id="chain36" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m35.png"/>
+     </figure>
+  </listitem>    
+</orderedlist>
+         </sect5>           
+         <sect5 id="rdfgraphreplicationtoplchainexcdd"><title>Check data on the Destination instances db2 and db3</title>                                    
+<orderedlist>
+  <listitem>To check the starting count, on each of the Destination Virtuoso Instances db2 and db3 from  SPARQL Endpoint execute:
+<programlisting><![CDATA[
+SELECT COUNT(*) 
+   FROM <http://example.org>
+WHERE { ?s ?p ?o }
+]]></programlisting>
+  </listitem> 
+  <listitem>Should return <emphasis>55</emphasis> as total.
+     <figure id="chain37" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m35.png"/>
+     </figure>
+  </listitem>    
+</orderedlist>
+         </sect5>  
+         <sect5 id="rdfgraphreplicationtoplchainexadd"><title>Add new data on db1</title>                                    
+<orderedlist>
+  <listitem>Disconnect db2 and db3.</listitem> 
+  <listitem>On the Host Virtuoso Instance db1 go to Conductor - > Database - > Interactive SQL enter the following statement:
+<programlisting><![CDATA[
+SPARQL INSERT INTO GRAPH <http://example.org> 
+  { 
+     <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this>
+     <http://xmlns.com/foaf/0.1/interest>
+     <http://dbpedia.org/resource/Web_Services> 
+  } ;
+SPARQL INSERT INTO GRAPH <http://example.org> 
+  { 
+    <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this>  	
+    <http://xmlns.com/foaf/0.1/interest>  	
+    <http://dbpedia.org/resource/Web_Clients> 
+  } ;
+SPARQL INSERT INTO GRAPH <http://example.org> 
+  { 
+    <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this>  	
+    <http://xmlns.com/foaf/0.1/interest>  	
+    <http://dbpedia.org/resource/SPARQL> 
+  } ;
+]]></programlisting>
+     <figure id="chain38" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m35.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Click "Execute"</listitem> 
+  <listitem>As result the triples will be inserted
+     <figure id="chain39" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m36.png"/>
+     </figure>
+  </listitem>    
+  <listitem>Check the count of the destination instance graph's triples by executing the following query like against the SPARQL endpoint, 
+http://localhost:8891/sparql:
+<programlisting><![CDATA[
+SELECT COUNT(*) 
+   FROM <http://example.org>
+WHERE { ?s ?p ?o }
+]]></programlisting>
+  </listitem>  
+  <listitem>Should return <emphasis>58</emphasis> as total.
+     <figure id="chain40" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m38.png"/>
+     </figure>
+  </listitem>    
+</orderedlist>
+         </sect5>  
+         <sect5 id="rdfgraphreplicationtoplchainexchki"><title>Check data on the Destination instances db2 and db3</title>                                    
+         <orderedlist> 
+  <listitem>Start instances db2 and db3</listitem> 
+  <listitem>To confirm that the triple count has increased by the number of inserted triples, execute the following on the Destination Virtuoso Instance db2 and db3 SPARQL Endpoint:
+<programlisting><![CDATA[
+SELECT COUNT(*) 
+   FROM <http://example.org>
+WHERE { ?s ?p ?o }
 ]]></programlisting>
-      <para>A GraphQueryResult is similar to TupleQueryResult in that is an object that iterates
-over the query results. However, for graph queries the query results are RDF statements, so a
-GraphQueryResult iterates over Statement objects:
-      </para>
+  </listitem>  
+  <listitem>Should return <emphasis>58</emphasis> as total.
+     <figure id="chain41" float="1">
+       <title>Chain Replication Topology</title>
+       <graphic fileref="ui/m38.png"/>
+     </figure>
+  </listitem>    
+</orderedlist>
+         </sect5>                             
+    </sect4>
+    </sect3>
+	  <sect3 id="rdfgraphreplicationtoplbid"><title>Bi-directional Replication Topology</title> 
+       <sect4 id="rdfgraphreplicationtoplbidex"><title>Bi-directional Replication Topology Example</title> 
+         <para>The following How-To walks you through setting up Virtuoso RDF Graph Replication in a 
+         Bi-directional Topology.</para>
 <programlisting><![CDATA[
-while (graphResult.hasNext()) {
-
-   Statement st = graphResult.next();
-
-   // ? do something with the resulting statement here.
-
-
-}
+db1 <---- db2
+db1 ----> db2
 ]]></programlisting>
-      <para>The TupleQueryResultHandler equivalent for graph queries is org.openrdf.rio.RDFHandler.
-Again, this is a generic interface, each object implementing it can process the reported RDF statements
-in any way it wants.
-      </para>
-      <para>All writers from Rio (such as the RDFXMLWriter, TurtleWriter, TriXWriter, etc.) implement
-the RDFHandler interface. This allows them to be used in combination with querying quite easily. In
-the following example, we use a TurtleWriter to write the result of a SPARQL graph query to standard
-output in Turtle format:
-      </para>
+         <sect5 id="rdfgraphreplicationtoplbidexpr"><title>Prerequisites</title> 
+           <sect6 id="rdfgraphreplicationtoplbidexprini"><title>Database INI Parameters</title> 
+<para>Suppose there are 2 Virtuoso instances respectively with the following ini parameters values:</para>
+             <orderedlist>
+               <listitem>virtuoso1.ini:
 <programlisting><![CDATA[
-import org.openrdf.rio.turtle.TurtleWriter;
-
-
-RepositoryConnection con = myRepository.getConnection();
-
-try {
-
-   TurtleWriter turtleWriter = new TurtleWriter(System.out);
-
-   con.prepareGraphQuery(QueryLanguage.SPARQL, "CONSTRUCT * FROM <http://mygraph.com> WHERE { ?s ?p ?o }").evaluate(turtleWriter);
-
-}
-
-finally {
-
-   con.close();
-
-}
+...
+[Database]
+DatabaseFile    = virtuoso1.db
+TransactionFile = virtuoso1.trx
+ErrorLogFile     = virtuoso1.log
+...
+[Parameters]
+ServerPort               = 1111
+SchedulerInterval        = 1
+...
+[HTTPServer]
+ServerPort                  = 8891
+...
+[URIQA]
+DefaultHost = localhost:8891
+...
+[Replication]
+ServerName   = db1
+...
+	
 ]]></programlisting>
-      <para>Again, note that as soon as we are done with the result of the query (either after iterating over the contents of the GraphQueryResult or after invoking the RDFHandler),
-we invoke con.close() to close the connection and free resources.
-      </para>
-    </sect4>
-    </sect3>
-    <sect3 id="rdfnativestorageproviderssesamestpandtesting"><title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-      <sect4 id="rdfnativestorageproviderssesamestpandtestingwhat"><title>What</title>
-<para>Sesame is an open source Java framework for storing, querying and reasoning with RDF and RDF Schema. It can be used as a
-database for RDF and RDF Schema, or as a Java library for applications that need to work with RDF internally. The Sesame HTTP
-repository serves as a proxy for a RDF store hosted on a remote Sesame server, enabling the querying of the RDF store using
-the Sesame HTTP protocol.
-</para>
-      </sect4>
-      <sect4 id="rdfnativestorageproviderssesamestpandtestingwhy"><title>Why</title>
-<para>The Sesame HTTP repository endpoint provides users with the greater flexibility for manipulating the RDF store via a common
-interface. Sesame provides you with the necessary tools to parse, interpret, query and store all this information, embedded
-in your own application if you want, or, if you prefer, in a separate database or even on a remote server.
-</para>
-      </sect4>
-      <sect4 id="rdfnativestorageproviderssesamestpandtestinghow"><title>How</title>
-<para>To create a new Sesame HTTP repository, the Console needs to create such an RDF document and submit it to the SYSTEM
-repository. The Console uses so called repository configuration templates to accomplish this. Repository configuration templates
-are simple Turtle RDF files that describe a repository configuration, where some of the parameters are replaced with variables.
-The Console parses these templates and asks the user to supply values for the variables. The variables are then substituted with
-the specified values, which produces the required configuration data.
-</para>
-      </sect4>
-      <sect4 id="rdfnativestorageproviderssesamestpandtestingmain"><title>Setup and Testing</title>
-<para>This section details the steps required for configuring and testing a Virtuoso Sesame
-Repository, both using the HTTP and Console Sesame repositories.</para>
-      <sect5 id="rdfnativestorageproviderssesamestpandtestingreq"><title>Requirements</title>
-<itemizedlist mark="bullet">
-  <listitem><ulink url="http://www.openrdf.org/download.jsp">Sesame 2.3.1</ulink> or higher</listitem>
-  <listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSesame2HttpRepository/virt_sesame2.jar">Virtuoso Sesame 2 Provider </ulink> (virt_sesame2.jar)</listitem>
-  <listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSesame2HttpRepository/virtjdbc3.jar">Virtuoso JDBC Driver</ulink> (virtjdbc3.jar)</listitem>
-  <listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSesame2HttpRepository/create.xsl">Sesame System Repository config file</ulink> (create.xsl)</listitem>
-  <listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtSesame2HttpRepository/create-virtuoso.xsl">Sesame Virtuoso Repository config file </ulink> (create-virtuoso.xsl)</listitem>
-  <listitem><ulink url="http://tomcat.apache.org/download-60.cgi">Apache Tomcat</ulink> version 5 or 6</listitem>
-</itemizedlist>
+               </listitem>
+               <listitem>virtuoso2.ini:
+<programlisting><![CDATA[
+...
+[Database]
+DatabaseFile    = virtuoso2.db
+TransactionFile = virtuoso2.trx
+ErrorLogFile     = virtuoso2.log
+...
+[Parameters]
+ServerPort               = 1112
+SchedulerInterval        = 1
+...
+[HTTPServer]
+ServerPort                  = 8892
+...
+[URIQA]
+DefaultHost = localhost:8892
+...
+[Replication]
+ServerName   = db2
+...	
+]]></programlisting>
+               </listitem>             	
+             </orderedlist>           
+           </sect6> 
+           <sect6 id="rdfgraphreplicationtoplbidexprdsn"><title>Database DSNs</title> 
+           <para>Use the ODBC Administrator on your Virtuoso host (e.g., on Windows, Start menu -> Control Panel -> Administrative Tools -> Data Sources (ODBC); on Mac OS X, /Applications/Utilities/OpenLink ODBC Administrator.app) to create a System DSN for db1 and db2 with names db1 and db2 respectively.</para>
+           </sect6>   
+           <sect6 id="rdfgraphreplicationtoplbidexprcnd"><title>Install Conductor package</title> 
+             <para>On each of the 2 Virtuoso instances install the <ulink url="http://s3.amazonaws.com/opldownload/uda/vad-packages/6.1/virtuoso/conductor_dav.vad">conductor_dav.vad</ulink> package.</para>
+           </sect6>                            
       </sect5>
-      <sect5 id="rdfnativestorageproviderssesamestpandtestinghttprep"><title>Setup Sesame HTTP Repository</title>
-<para>This section details the steps required for configuring and testing a Virtuoso HTTP Sesame Repository.</para>
+         
+         <sect5 id="rdfgraphreplicationtoplbidexprcph"><title>Create Publication on db2</title> 
 <orderedlist>
-  <listitem>Install <ulink url="http://tomcat.apache.org/tomcat-6.0-doc/index.html">Apache Tomcat</ulink> web server</listitem>
-  <listitem>From the Sesame 2.3.1 or higher "lib" directory copy the "openrdf-sesame.war" and "openrdf-worbbench.war" files to the
-tomcat "webapps" directory where they will automatically be deployed creating two new sub directories "openrdf-sesame" and
-"openrdf-workbench".</listitem>
-  <listitem>Place the Virtuoso Sesame Provider "virt_sesame2.jar" and JDBC Driver "virtjdbc3.jar" into the Tomcat
-<code>~/webapps/openrdf-sesame/WEB-INF/lib/</code> and <code>~/webapps/openrdf-workbench/WEB-INF/lib/</code> directories for
-use by the Sesame HTTP Repository for accessing the Virtuoso RDF repository.</listitem>
-  <listitem>Place the "create.xsl" and "create-virtuoso.xsl" files in the Tomcat
-<code>~/webapps/openrdf-workbench/transformations/</code> directory. Note "create.xsl" replaces the default provided with Sesame and contains the necessary entries required to reference the new "create-virtuoso.xsl" template file for Virtuoso repository configuration.</listitem>
-  <listitem>The Sesame HTTP Repository will now be accessible on the URLs
+  <listitem>Go to http://localhost:8892/conductor and log in as dba</listitem>
+  <listitem>Go to Conductor -> Replication -> Transactional -> Publications
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd1.png"/>
+     </figure>
+  </listitem>   
+  <listitem>Click <emphasis>Enable RDF Publishing</emphasis></listitem>
+  <listitem>As result publication with the name <emphasis>RDF Publication</emphasis> should be created
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd2.png"/>
+     </figure>
+  </listitem>   
+  <listitem>Click the link which is the publication name.</listitem> 
+  <listitem>You will be shown the publication items page
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd3.png"/>
+     </figure>
+  </listitem>
+  <listitem>Enter for Graph IRI:
 <programlisting><![CDATA[
-http://localhost:8080/openrdf-sesame
-http://localhost:8080/openrdf-workbench
+http://example.org
 ]]></programlisting>
-</listitem>
-   <listitem>The Sesame OpenRDF Workbench is used for accessing the Sesame HTTP Repositories, loading
-"<ulink url="http://localhost:8080/openrdf-workbench">http://localhost:8080/openrdf-workbench</ulink>" will enable the
-default "SYSTEM" repository to be accessed.
-     <figure id="ss1" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss1.png"/>
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd4.png"/>
      </figure>
+</listitem>
+  <listitem>Click Add New
   </listitem>
-   <listitem>Click on the "New Repository" link in the left frame to create a new Sesame Repository.
-     <figure id="ss2" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss2.png"/>
+  <listitem>The item will be created and shown in the list of items for the currently viewed publication. 
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd5.png"/>
      </figure>
   </listitem>
-   <listitem>Select the "Virtuoso RDF Store" from the "Type" drop down list box presented.
-     <figure id="ss3" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss3.png"/>
+</orderedlist>         
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplbidexprcs"><title>Create subscription from db1 to db2's Publication</title> 
+<orderedlist>
+  <listitem>Log in at http://localhost:8891/conductor
+  </listitem>
+  <listitem>Go to Replication -> Transactional -> Subscriptions 
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd6.png"/>
      </figure>
   </listitem>
-   <listitem>Choose suitable repository "ID" and "Title" for the Virtuoso repository to be created and click "Next".
-     <figure id="ss4" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss4.png"/>
+  <listitem>Click <emphasis>New Subscription</emphasis>
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd7.png"/>
      </figure>
   </listitem>
-   <listitem>Fill in the connection parameters for the target Virtuoso sever the repository is to be created for and
-click the "create" button. The minimum required are the hostname, port number, username and password of the Virtuoso Server.
-     <figure id="ss5" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss5.png"/>
+  <listitem>From the list of "Specify new data source" select Data Source db2
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd8.png"/>
      </figure>
   </listitem>
-   <listitem>The new Virtuoso respository will be created and its summary page displayed.
-     <figure id="ss6" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss6.png"/>
+  <listitem>Enter for db2 dba user credentials
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd9.png"/>
      </figure>
   </listitem>
-   <listitem>Click on the "Namespaces" link in the left frame to obtain a list of the available namespaces in the Virtuoso repository.
-     <figure id="ss7" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss7.png"/>
+  <listitem>Click "Add Data Source"
+  </listitem>
+  <listitem>As result <emphasis>db2</emphasis> will be shown in the "Connected Data Sources" list. 
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd10.png"/>
      </figure>
   </listitem>
-   <listitem>Click on the "Context" link in the left frame to obtain a list of the available contexts in the Virtuoso repository.
-     <figure id="ss8" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss8.png"/>
+  <listitem>Select <emphasis>db2</emphasis> the "Connected Data Sources" list and click "Publications list"
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd11.png"/>
      </figure>
   </listitem>
-   <listitem>Click on the "Types" link in the left frame to obtain a list of the available types in the Virtuoso repository.
-     <figure id="ss9" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss9.png"/>
+  <listitem>As result will be shown the list of available publications for the selected data source. Select the one with name "RDF Publication" and click "List Items".
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd12.png"/>
      </figure>
   </listitem>
-   <listitem>Click on the "Query" link in the left frame, enter a suitable SPARQL query to execute against the Virtuoso repository
-and click the "execute" button.
-     <figure id="ss10" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss10.png"/>
+  <listitem>As result will be shown the "Confirm subscription" page. 
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd13.png"/>
      </figure>
   </listitem>
-   <listitem>The results of the SPARQL query are returned.
-     <figure id="ss11" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss11.png"/>
+  <listitem>The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute.
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd14.png"/>
      </figure>
   </listitem>
-   <listitem>Click on the "Repositories" link in the left frame and the newly created Virtuoso repository entry is displayed along side
-the default SYSTEM repository.
-     <figure id="ss12" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss12.png"/>
+  <listitem>Click "Subscribe"
+  </listitem>
+  <listitem>The subscription will be created. 
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd15.png"/>
      </figure>
   </listitem>
 </orderedlist>
-      </sect5>
-      <sect5 id="rdfnativestorageproviderssesamestpandtestingcons"><title>Setup Sesame Console Repository</title>
-<para>This section details the steps required for configuring and testing a Virtuoso Sesame Console Repository:</para>
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplbidexprcpd"><title>Create Publication on db1</title> 
 <orderedlist>
-  <listitem>Extract Sesame 2.3.1 or higher archive to a location of choice and place the virt_sesame2.jar and virtjdbc3.jar
-files to the sesame 2.3.1 "lib" directory</listitem>
-  <listitem>Start the <ulink url="http://www.openrdf.org/doc/sesame2/users/ch07.html#section-console-repository-creation">sesame console application</ulink> by running the "console.bat" script in the sesame "bin" directory and then "exit." the program
+  <listitem>Go to http://localhost:8891/conductor and log in as dba
+  </listitem>
+  <listitem>Go to Conductor -> Replication -> Transactional -> Publications
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd16.png"/>
+     </figure>
+  </listitem>
+  <listitem>Click <emphasis>Enable RDF Publishing</emphasis>
+  </listitem>
+  <listitem>As result publication with the name <emphasis>RDF Publication</emphasis> should be created
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd17.png"/>
+     </figure>
+  </listitem>
+  <listitem>Click the link which is the publication name. 
+  </listitem>
+  <listitem>You will be shown the publication items page
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd18.png"/>
+     </figure>
+  </listitem>
+  <listitem>Enter for Graph IRI:
 <programlisting><![CDATA[
-$ sh console.sh
-SLF4J: Class path contains multiple SLF4J bindings.
-SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/logback-classic-0.9.18.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/slf4j-jdk14-1.5.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
-10:32:38.317 [main] DEBUG info.aduna.platform.PlatformFactory - os.name <http://os.name> <http://os.name> = mac os x
-10:32:38.351 [main] DEBUG info.aduna.platform.PlatformFactory - Detected Mac OS X platform
-Connected to default data directory
-Commands end with '.' at the end of a line
-Type 'help.' for help
-exit.
+http://example.org
 ]]></programlisting>
-</listitem>
-  <listitem>This will create the necessary sesame application data directories as detailed in the sesame
-<ulink url="http://www.openrdf.org/doc/sesame2/2.3.1/users/userguide.html#chapter-datadir-config">data directory configuration</ulink> documentation.
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd19.png"/>
+     </figure>
+  </listitem>
+  <listitem>Click Add New
+  </listitem>
+  <listitem>The item will be created and shown in the list of items for the currently viewed publication. 
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd20.png"/>
+     </figure>
+  </listitem>
+</orderedlist>  
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplbidexprcsh"><title>Create subscription from db2 to db1's Publication</title> 
+<orderedlist>
+  <listitem>Log in at http://localhost:8892/conductor
+  </listitem>
+  <listitem>Go to Replication -> Transactional -> Subscriptions 
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd21.png"/>
+     </figure>
+  </listitem>
+  <listitem>Click <emphasis>New Subscription</emphasis>
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd22.png"/>
+     </figure>
+  </listitem>
+  <listitem>From the list of "Specify new data source" select Data Source db1
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd23.png"/>
+     </figure>
+  </listitem>
+  <listitem>Enter for db1 dba user credentials
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd24.png"/>
+     </figure>
+  </listitem>
+  <listitem>Click "Add Data Source"
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd25.png"/>
+     </figure>
+  </listitem>
+  <listitem>As result <emphasis>db1</emphasis> will be shown in the "Connected Data Sources" list. Select it and click "Publications list"
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd26.png"/>
+     </figure>
+  </listitem>
+  <listitem>As result will be shown the list of available publications for the selected data source. Select the one with name "RDF Publication" and click "List Items".
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd27.png"/>
+     </figure>
+  </listitem>
+  <listitem>As result will be shown the "Confirm subscription" page.  
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd28.png"/>
+     </figure>
+  </listitem>
+  <listitem>The sync interval by default is 10 minutes. For the testing purposes, we will change it to 1 minute.
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd29.png"/>
+     </figure>
+  </listitem>
+  <listitem>Click "Subscribe"
+  </listitem>
+  <listitem>The subscription will be created. 
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd30.png"/>
+     </figure>
+  </listitem>
+</orderedlist>  
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplbidexprinsh"><title>Insert Data into a Named Graph on the db2 Virtuoso Instance</title> 
+<orderedlist>
+  <listitem>Log in at http://localhost:8892/conductor
+  </listitem>
+  <listitem>Go to RDF -> RDF Store Upload 
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd31.png"/>
+     </figure>
+  </listitem>
+  <listitem>In the shown form:
+     </listitem>
+  <listitem>Tick the box for <emphasis>Resource URL</emphasis> and enter your resource URL, e.g.:
 <programlisting><![CDATA[
-Windows - C:\Documents and Settings\LocalService\Application Data\Aduna\
-Mac OS X - /Users/myuser/Library/Application Support/Aduna/
-Linux - $HOME/.aduna/
+http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this
 ]]></programlisting>
-</listitem>
-  <listitem>If you do not want to use the default sesame data directory location the Sesame console application can be started by
-specifying a custom data directory location with the "-d" option. Note in this case the directory "OpenRDF Sesame console" always
-has to be manually appended to the directory as Sesame assumes the data file will reside in a sub directory of this name.
+     </listitem>
+  <listitem>Enter for Named Graph IRI:
+<programlisting><![CDATA[
+http://example.org
+]]></programlisting>
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd32.png"/>
+     </figure>
+  </listitem>
+  <listitem>Click Upload
+  </listitem>
+  <listitem>A successful upload will result in a shown message.
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd33.png"/>
+     </figure>
+  </listitem>
+  <listitem>Check the count of the inserted triples by executing a query like the following against the SPARQL endpoint, 
+http://localhost:8892/sparql:
+<programlisting><![CDATA[
+SELECT COUNT(*) 
+   FROM <http://example.org>
+WHERE { ?s ?p ?o }
+]]></programlisting>
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd34.png"/>
+     </figure>
+  </listitem>
+  <listitem>Should return <emphasis>55</emphasis> as total.
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd35.png"/>
+     </figure>
+  </listitem>
+</orderedlist>
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplbidexprcdin"><title>Check data on the Destination instance db1</title> 
+<orderedlist>
+  <listitem>To check the starting count, execute from db1's SPARQL Endpoint:
+<programlisting><![CDATA[
+SELECT COUNT(*) 
+   FROM <http://example.org>
+WHERE { ?s ?p ?o }
+]]></programlisting>
+  </listitem>
+  <listitem>Should return <emphasis>55</emphasis> as total.
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd35.png"/>
+     </figure>
+  </listitem>
+</orderedlist>       
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplbidexprinsd"><title>Add new data on db2</title> 
+<orderedlist>
+  <listitem>Disconnect db1.
+  </listitem>
+  <listitem>On the Host Virtuoso Instance db2 go to Conductor -> Database -> Interactive SQL enter the following statement:
 <programlisting><![CDATA[
-$ sh console.sh -d /Users/myuser/OpenRDF Sesame console
+SPARQL INSERT INTO GRAPH <http://example.org> 
+  { 
+     <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this>
+     <http://xmlns.com/foaf/0.1/interest>
+     <http://dbpedia.org/resource/Web_Services> 
+  } ;
+]]></programlisting>
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd36.png"/>
+     </figure>
+  </listitem>
+  <listitem>Click "Execute"
+  </listitem>
+  <listitem>As result the triples will be inserted
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd37.png"/>
+     </figure>
+  </listitem>
+  <listitem>Check the count of the destination instance graph's triples by executing the following query like against the SPARQL endpoint, 
+http://localhost:8892/sparql:
+<programlisting><![CDATA[
+SELECT COUNT(*) 
+   FROM <http://example.org>
+WHERE { ?s ?p ?o }
 ]]></programlisting>
-</listitem>
-  <listitem>Start the sesame console application with the required data directory location and create a Virtuoso repository as
-detailed in the steps below, the key parameters to be specified being the target Virtuoso server hostname, port number,
-username, password and a unique "Repository ID".
+  </listitem>
+  <listitem>Should return <emphasis>56</emphasis> as total.
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd38.png"/>
+     </figure>
+  </listitem>
+</orderedlist>  
+         </sect5> 
+         <sect5 id="rdfgraphreplicationtoplbidexprcddi"><title>Check data on the Destination instance db1</title> 
+<orderedlist> 
+  <listitem>Start instance db1
+  </listitem>
+  <listitem>To confirm that the triple count has increased by the number of inserted triples, execute the following statement on db1's SPARQL Endpoint:
 <programlisting><![CDATA[
-$ sh console.sh
-SLF4J: Class path contains multiple SLF4J bindings.
-SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/logback-classic-0.9.18.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/slf4j-jdk14-1.5.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
-10:32:38.317 [main] DEBUG info.aduna.platform.PlatformFactory - os.name <http://os.name> <http://os.name> = mac os x
-10:32:38.351 [main] DEBUG info.aduna.platform.PlatformFactory - Detected Mac OS X platform
-Connected to default data directory
-Commands end with '.' at the end of a line
-Type 'help.' for help
-create virtuoso .
-Please specify values for the following variables:
-Host list [localhost:1111]:
-Username [dba]:
-Password [dba]:
-Default graph name [sesame:nil]:
-Enable using batch optimization (false|true) [false]:
-Use RoundRobin for connection (false|true) [false]:
-Buffer fetch size [200]:
-Inference RuleSet name [null]:
-Repository ID [virtuoso]: myvirt
-Repository title [Virtuoso repository]:
-Repository created
-show r .
-+----------
-|SYSTEM
-|myvirt ("Virtuoso repository")
-+----------
-open myvirt .
-Opened repository 'myvirt'
-myvirt> show n .
-+----------
-|bif  bif:
-|dawgt  http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#
-|dbpedia  http://dbpedia.org/resource/
-|dbpprop  http://dbpedia.org/property/
-|dc  http://purl.org/dc/elements/1.1/
-|foaf  http://xmlns.com/foaf/0.1/
-|geo  http://www.w3.org/2003/01/geo/wgs84_pos#
-|go  http://purl.org/obo/owl/GO#
-|math  http://www.w3.org/2000/10/swap/math#
-|mesh  http://purl.org/commons/record/mesh/
-|mf  http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#
-|nci  http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#
-|obo  http://www.geneontology.org/formats/oboInOwl#
-|owl  http://www.w3.org/2002/07/owl#
-|protseq  http://purl.org/science/protein/bysequence/
-|rdf  http://www.w3.org/1999/02/22-rdf-syntax-ns#
-|rdfdf  http://www.openlinksw.com/virtrdf-data-formats#
-|rdfs  http://www.w3.org/2000/01/rdf-schema#
-|sc  http://purl.org/science/owl/sciencecommons/
-|scovo  http://purl.org/NET/scovo#
-|skos  http://www.w3.org/2004/02/skos/core#
-|sql  sql:
-|vcard  http://www.w3.org/2001/vcard-rdf/3.0#
-|virtrdf  http://www.openlinksw.com/schemas/virtrdf#
-|void  http://rdfs.org/ns/void#
-|xf  http://www.w3.org/2004/07/xpath-functions
-|xml  http://www.w3.org/XML/1998/namespace
-|xsd  http://www.w3.org/2001/XMLSchema#
-|xsl10  http://www.w3.org/XSL/Transform/1.0
-|xsl1999  http://www.w3.org/1999/XSL/Transform
-|xslwd  http://www.w3.org/TR/WD-xsl
-|yago  http://dbpedia.org/class/yago/
-+----------
-exit.
+SELECT COUNT(*) 
+   FROM <http://example.org>
+WHERE { ?s ?p ?o }
 ]]></programlisting>
-</listitem>
+  </listitem>
+  <listitem>Should return <emphasis>56</emphasis> as total.
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd38.png"/>
+     </figure>
+  </listitem>
 </orderedlist>
       </sect5>
-      <sect5 id="rdfnativestorageproviderssesamestpandtestinghttpcons"><title>Connection to Sesame HTTP repository from Console repository</title>
-<para>The Sesame Console repository can connect to a Sesame HTTP repository and vice-versa, enabling access to remote Sesame
-HTTP repositories from a local server.</para>
+         <sect5 id="rdfgraphreplicationtoplbidexprinsah"><title>Add new data on db1</title> 
 <orderedlist>
-  <listitem>The Sesame Console repository can connect to a Sesame HTTP repository and query it as if local using the "connect" command.
-<programlisting><![CDATA[
-$ sh console.sh
-SLF4J: Class path contains multiple SLF4J bindings.
-SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/logback-classic-0.9.18.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: Found binding in [jar:file:/Users/myuser/openrdf-sesame-2.3.1/lib/slf4j-jdk14-1.5.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
-10:32:38.317 [main] DEBUG info.aduna.platform.PlatformFactory - os.name <http://os.name> <http://os.name> = mac os x
-10:32:38.351 [main] DEBUG info.aduna.platform.PlatformFactory - Detected Mac OS X platform
-Connected to default data directory
-Commands end with '.' at the end of a line
-Type 'help.' for help
-> connect http://localhost:8080/openrdf-sesame.
-Connected to http://localhost:8080/openrdf-sesame
-> show r.
-+----------
-|SYSTEM ("System configuration repository")
-|VirtSesRep ("Virtuoso Sesame HTTP Repository")
-+----------
-> open VirtSesRep.
-Opened repository 'VirtSesRep'
-VirtSesRep> sparql select * from <http://localhost:8890/Northwind> where {?s ?p ?o} Limit 10.
-Evaluating query...
-+------------------------+------------------------+------------------------+
-| s                      | p                      | o                      |
-+------------------------+------------------------+------------------------+
-| <http://localhost:8890/Northwind/CustomerContact/ALFKI#this>| rdf:type  | foaf:Person            |
-| <http://localhost:8890/Northwind/CustomerContact/ALFKI#this>| rdf:type  | northwind:CustomerContact|
-| <http://localhost:8890/Northwind/CustomerContact/ALFKI#this>| opl:isDescribedUsing   | northwind:             |
-| <http://localhost:8890/Northwind/CustomerContact/ANATR#this>| rdf:type | foaf:Person            |
-| <http://localhost:8890/Northwind/CustomerContact/ANATR#this>| rdf:type | northwind:CustomerContact|
-| <http://localhost:8890/Northwind/CustomerContact/ANATR#this>| opl:isDescribedUsing   | northwind:             |
-| <http://localhost:8890/Northwind/CustomerContact/ANTON#this>| rdf:type  | foaf:Person            |
-| <http://localhost:8890/Northwind/CustomerContact/ANTON#this>| rdf:type  | northwind:CustomerContact|
-| <http://localhost:8890/Northwind/CustomerContact/ANTON#this>| opl:isDescribedUsing   | northwind:             |
-| <http://localhost:8890/Northwind/CustomerContact/AROUT#this>| rdf:type  | foaf:Person            |
-+------------------------+------------------------+------------------------+
-10 result(s) (530 ms)
-VirtSesRep> show n.
-+----------
-|SearchResults  http://www.zillow.com/static/xsd/SearchResults.xsd
-|UpdatedPropertyDetails  http://www.zillow.com/static/xsd/UpdatedPropertyDetails.xsd
-|a  http://www.w3.org/2005/Atom
-|aapi  http://rdf.alchemyapi.com/rdf/v1/s/aapi-schema#
-|address  http://schemas.talis.com/2005/address/schema#
-|admin  http://webns.net/mvcb/
-|amz  http://webservices.amazon.com/AWSECommerceService/2005-10-05
-|atom  http://atomowl.org/ontologies/atomrdf#
-|audio  http://purl.org/media/audio#
-|awol  http://bblfish.net/work/atom-owl/2006-06-06/#
-|aws  http://soap.amazon.com/
-|b3s  http://b3s.openlinksw.com/
-]]></programlisting>
+  <listitem>Disconnect db2.
 </listitem>
-  <listitem>Conversely the Sesame HTTP repository can be configured to access the repository created by the Sesame console.
-To do this the location of the data directory for both needs to be reconfigured using the Java system property
-info.aduna.platform.appdata.basedir (does not include "OpenRDF Sesame console directory) to point to the same location.
-When you are using Tomcat as the servlet container then you can set this property using the JAVA_OPTS parameter.
-Note, if you are using Apache Tomcat as a Windows Service you should use the Windows Services configuration tool to
-set this property. Other users can either edit the Tomcat startup script or set the property some other way.
+  <listitem>On the Host Virtuoso Instance db1 go to Conductor -> Database -> Interactive SQL enter the following statement:
 <programlisting><![CDATA[
- * set JAVA_OPTS=-Dinfo.aduna.platform.appdata.basedir=\path\to\other\dir\ (on Windows)
-    * export JAVA_OPTS='-Dinfo.aduna.platform.appdata.basedir=/path/to/other/dir/' (on Linux/UNIX/Mac OS X)
-]]></programlisting>
-     <figure id="ss13" float="1">
-       <title>Virtuoso Sesame HTTP Repository Configuration and Usage</title>
-       <graphic fileref="ui/ss13.png"/>
+SPARQL INSERT INTO GRAPH <http://example.org> 
+  { 
+    <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this>  	
+    <http://xmlns.com/foaf/0.1/interest>  	
+    <http://dbpedia.org/resource/Web_Clients> 
+  } ;
+SPARQL INSERT INTO GRAPH <http://example.org> 
+  { 
+    <http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#this>  	
+    <http://xmlns.com/foaf/0.1/interest>  	
+    <http://dbpedia.org/resource/SPARQL> 
+  } ;
+]]></programlisting>
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd39.png"/>
      </figure>
-
 </listitem>
-</orderedlist>
-       </sect5>
-      </sect4>
-    </sect3>
-    <sect3 id="rdfnativestorageproviderssesamejavadoc"><title>Javadoc API Documentation</title>
-    <para><ulink url="http://docs.openlinksw.com/sesame/">Sesame Provider Javadoc API Documentation</ulink>
-is available enabling the complete set of classes, interfaces and methods implemented for the provider to be viewed.
-    </para>
-    </sect3>
-  </sect2>
-  <sect2 id="rdfnativestorageproviderredland"><title>Virtuoso Redland Provider</title>
-     <sect3 id="rdfnativestorageproviderredlandwhatis"><title>What is Redland</title>
-     <para><ulink url="http://librdf.org/">Redland</ulink> is a set of free software 'C' libraries that
-provide support for the Resource Description Framework (RDF), providing modular, object based libraries
-and APIs for manipulating the RDF graph, triples, URIs and Literals. Redland includes several high-level
-language APIs providing RDF manipulation and storage and requires the
-<ulink url="http://librdf.org/raptor/">Raptor</ulink> RDF parser and <ulink url="http://librdf.org/rasqal/">Rasqal</ulink>
-RDF syntax and query library
-for its use.
-    </para>
-    </sect3>
-    <sect3 id="rdfnativestorageproviderredlandwhatisv"><title>What is the Virtuoso Redland Provider</title>
-    <para>The Virtuoso Redland RDF Provider is an implementation of the Storage API, Model and Query
-interfaces of the Redland framework for RDF. This provider enables the execution of queries via the
-Redland Rasqal query engine or via Virtuoso query engine directly against the Virtuoso Quad store.
-The Virtuoso Redland Provider uses ODBC as the data access mechanism for communicating the Virtuoso
-Quad Store and requires the Virtuoso ODBC Driver be installed on the Redland client and a suitable
-ODBC DSN be configured for connecting to the target Virtuoso Quad Store instance. The provider has
-been tested against the <ulink url="http://download.librdf.org/source/">Redland 1.0.8</ulink> version currently available for download.
-    </para>
-    <figure id="rdfnativestorageproviderredland1" float="1">
-      <title>Redland Component Stack</title>
-      <graphic fileref="ui/VirtRedLand.png"/>
-    </figure>
-    <para>As indicated in the above diagram the Virtuoso Provider can be used to execute RDF queries either
-directly against the Virtuoso graph storage module supporting the <ulink url="http://dbpedia.org/resource/SPARQL">SPARQL</ulink>,
-<ulink url="http://dbpedia.org/resource/SPARUL">SPARQL</ulink>SPARUL, <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VOSArticleBISPARQL2">SPARQL-BI</ulink>
-query languages or via the Rasqal query engine built into Redland which supports the SPARQL query language.
-This is done by simply changing the syntax of the query using the "vsparql" rather then default "sparql"
-construct when executing a query as indicated in the sample queries below:
-    </para>
+  <listitem>Click "Execute"
+</listitem>
+  <listitem>As result the triples will be inserted
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd40.png"/>
+     </figure>
+  </listitem>
+  <listitem>Check the count of the destination instance graph's triples by executing the following query like against the SPARQL endpoint, 
+http://localhost:8891/sparql:
 <programlisting><![CDATA[
-rdfproc -r xml -t "user='dba',password='dba',dsn='Demo'" gr query sparql - "SELECT * WHERE { ?s ?p ?o }"   ;; via Redland Rasqal engine
-
-rdfproc -r xml -t "user='dba',password='dba',dsn='Demo'" gr query vsparql - "SELECT * WHERE { ?s ?p ?o }"  ;; direct to Virtuoso storage module
+SELECT COUNT(*) 
+   FROM <http://example.org>
+WHERE { ?s ?p ?o }
 ]]></programlisting>
-    <para>The Virtuoso Provider uses the <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VOSSQL2RDF">SPASQL</ulink> query language for querying the remote Virtuoso QUAD store.
-    </para>
-    </sect3>
-    <sect3 id="rdfnativestorageproviderredlandsetup"><title>Setup</title>
-      <sect4 id="rdfnativestorageproviderredlandreqfiles"><title>Required Files</title>
-      <para>The Virtuoso Redland Provider has been integrated into the Redland RDF Framework and submitted to
-the open source project to become part of the standard distribution available for
-<ulink url="http://librdf.org/INSTALL.html">download</ulink>. Until this
-submission has been accepted and committed into the available Redland release a tar ball created by
-OpenLink Software and a diff for application to a Redland 1.0.8 tree can be obtained from:
-      </para>
-      <itemizedlist mark="bullet">
-        <listitem><ulink url="ftp://download.openlinksw.com/support/vos/redland-vos-1.0.8.tar.gz"></ulink>Redland 1.0.8 tar ball with Virtuoso storage support</listitem>
-        <listitem><ulink url="ftp://download.openlinksw.com/support/vos/redland-vos.diff">Redland 1.0.8 Diff file of changes made for Virtuoso storage support</ulink></listitem>
-      </itemizedlist>
-      </sect4>
-      <sect4 id="rdfnativestorageprovidersredlandcmsmpr"><title>Compiling Redland with Virtuoso storage support</title>
-        <itemizedlist mark="bullet">
-          <listitem><ulink url="http://svn.librdf.org/">Download Redland</ulink>, extract and apply diff
-above or download the tar ball above with diff already applied and extract to a location of choice.</listitem>
-          <listitem>The following additional configure options are available for enabling the Virtuoso
-storage support:
+</listitem>
+  <listitem>Should return <emphasis>58</emphasis> as total.
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd41.png"/>
+     </figure>
+  </listitem>
+</orderedlist>
+      </sect5>
+         <sect5 id="rdfgraphreplicationtoplbidexprcdadi"><title>Check data on the Destination instance db2</title> 
+<orderedlist>
+  <listitem>Start instance db2
+</listitem>
+  <listitem>To confirm that the triple count has increased by the number of inserted triples, execute the following statement on db2's SPARQL Endpoint:
 <programlisting><![CDATA[
-  --with-virtuoso(=yes|no) Enable Virtuoso RDF store (default=auto)
-  --with-iodbc(=DIR)        Select iODBC support
-                            DIR is the iODBC base install directory
-                            (default=/usr/local)
-  --with-unixodbc(=DIR)   Select UnixODBC support
-                            DIR is the UnixODBC base install directory
-                            (default=/usr/local)
-  --with-datadirect(=DIR) Select DataDirect support
-                            DIR is the DataDirect base install directory
-                            (default=/usr/local)
-  --with-odbc-inc=DIR     Specify custom ODBC include directory
-                            (default=/usr/local/include)
-  --with-odbc-lib=DIR     Specify custom ODBC lib directory
-                            (default=/usr/local/lib)
+SELECT COUNT(*) 
+   FROM <http://example.org>
+WHERE { ?s ?p ?o }
 ]]></programlisting>
-          </listitem>
-          <listitem>The "--with-virtuoso" option default to being auto enable if a valid ODBC Driver Manager
-(iODBC, UnixODBC? or DataDirect?) or include and lib directories for required ODBC header files and libraries
-are located with the suitable setting for one or more of the other ODBC related options above. Assuming
-iODBC is installed the following option can be used to enable Virtuoso storage support to be configured
-for compilation into your Redland build:
+  </listitem>
+  <listitem>Should return <emphasis>58</emphasis> as total.
+     <figure id="bid1" float="1">
+        <title>Bi-directional Replication Topology</title>
+        <graphic fileref="ui/bd41.png"/>
+     </figure>
+</listitem>
+</orderedlist>
+       </sect5>
+      </sect4>
+    </sect3>
+  </sect2>
+  <sect2 id="rdfgraphreplicationsql"><title>Set up RDF Replication via procedure calls</title>
+   <sect3 id="rdfgraphreplicationsqlex"><title>Example</title> 
+         <para>The following example shows how to use SQL procedures to set up Virtuoso RDF Graph Replication in a Chain Topology.</para>
+         <figure id="chain1" float="1">
+           <title>Chain Replication Topology</title>
+           <graphic fileref="ui/topo-chain.png"/>
+         </figure> 
+         <para>This can also be done <link linkend="rdfgraphreplicationtoplchainex">through the HTTP-based Virtuoso Conductor</link>.</para>
+         <sect4 id="rdfgraphreplicationsqlexprx"><title>Prerequisites</title> 
+           <sect5 id="rdfgraphreplicationsqlexprxini"><title>Database INI Parameters</title> 
+             <para>Suppose there are 3 Virtuoso instances on the same machine.</para>
+             <para>The first instance holds the master copy of the data and publishes its changes to all other instances that subscribe to this master.</para>             
+             <para>The second instance subscribes to the publication of the master copy, but also publishes all of these changes to any instance that subscribes to it.</para>
+             <para>The third instance only subscribes to the publication of the second instance.</para>
+             <para>Each of these 3 servers need unique ports and ServerName, DefaultHost for this replication scheme to work properly. Although not needed, this example also sets separate names for the database and related files. This results in the following ini parameters values (only changes are shown, the rest can remain default):</para>
+             <orderedlist>
+               <listitem>repl1/virtuoso.ini:
 <programlisting><![CDATA[
-./configure --with-iodbc=/usr/local/iODBC
+...
+[Database]
+DatabaseFile    = virtuoso1.db
+TransactionFile = virtuoso1.trx
+ErrorLogFile     = virtuoso1.log
+...
+[Parameters]
+ServerPort               = 1111
+SchedulerInterval        = 1
+...
+[HTTPServer]
+ServerPort                  = 8891
+...
+[URIQA]
+DefaultHost = localhost:8891
+...
+[Replication]
+ServerName   = db1-r
+...
 ]]></programlisting>
           </listitem>
-          <listitem>Run "make" to compile the Redland libraries and "sudo make install" to install in
-the default "/usr/local" location</listitem>
-          <listitem>Test compilation with test utility utils/rdfproc:
+               <listitem>repl2/virtuoso.ini:
 <programlisting><![CDATA[
-
-rdfproc test parse http://planetrdf.com/guide/rss.rdf
-rdfproc test print
-rdfproc test serialize ntriples
+...
+[Database]
+DatabaseFile    = virtuoso2.db
+TransactionFile = virtuoso2.trx
+ErrorLogFile     = virtuoso2.log
+...
+[Parameters]
+ServerPort               = 1112
+SchedulerInterval        = 1
+...
+[HTTPServer]
+ServerPort                  = 8892
+...
+[URIQA]
+DefaultHost = localhost:8892
+...
+[Replication]
+ServerName   = db2-r
+...
 ]]></programlisting>
-          <para>This test will use the default 'hashes' storage.</para>
           </listitem>
-          <listitem>Ensure you have the Virtuoso ODBC Driver installed and a valid ODBC DSN called
-"Local Virtuoso" configured for your target Virtuoso Server</listitem>
-          <listitem>Set the following environment variable:
+               <listitem>repl3/virtuoso.ini:
 <programlisting><![CDATA[
-export RDFPROC_STORAGE_TYPE=virtuoso                                   ;; Enable Virtuoso Storage
-export ODBCINI=<path_to_odbcini_directory>/odbc.ini                      ;; Enable ODBC DSN to be located
-export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH                     ;; May be required to enable Redland libraries to be located
 
+...
+[Database]
+DatabaseFile    = virtuoso3.db
+TransactionFile = virtuoso3.trx
+ErrorLogFile     = virtuoso3.log
+...
+[Parameters]
+ServerPort               = 1113
+SchedulerInterval        = 1
+...
+[HTTPServer]
+ServerPort                  = 8893
+...
+[URIQA]
+DefaultHost = localhost:8893
+...
+[Replication]
+ServerName   = db3-r
+...
 ]]></programlisting>
           </listitem>
-          <listitem>Test Virtuoso storage with the provided test program utils/vtest:
+             </orderedlist>
+           </sect5> 
+
+           <sect5 id="rdfgraphreplicationsqlexprxdsn"><title>Database DSNs</title> 
+             <para>Use the ODBC Administrator on your Virtuoso host (e.g., on Windows, Start menu -> Control Panel -> Administrative Tools -> Data Sources (ODBC); on Mac OS X, /Applications/Utilities/OpenLink ODBC Administrator.app) to create a System DSN for each of db1, db2, db3, with names db1, db2 and db3, respectively.</para>
+           </sect5>   
+         </sect4>
+         
+         <sect4 id="rdfgraphreplicationsqlcrb"><title>Configure Publishers and Subscribers</title> 
+<orderedlist>
+   <listitem>Run the databases by starting start.sh, which has the following content:
 <programlisting><![CDATA[
-$ utils/vtest
-  1: Remove all triples in <http://red> context
-**PASSED**: removed context triples from the graph
-  2: Add triples to <http://red> context
-**PASSED**: add triple to context
-  3: Print all triples in <http://red> context
-[[
-  {[aa], [bb], [cc]} with context [http://red]
-  {[aa], [bb1], [cc]} with context [http://red]
-  {[aa], [a2], "cc"} with context [http://red]
-  {[aa], [a2], (cc)} with context [http://red]
-  {[mm], [nn], "Some long literal with language at en"} with context [http://red]
-  {[oo], [pp], "12345^^<http://www.w3.org/2001/XMLSchema#int>"} with context [http://red]
-]]
-**PASSED**:
-  4: Count of triples in <http://red> context
-**PASSED**: graph has 6 triples
-  5: Exec:  ARC  aa bb
-Matched node: [cc]
-**PASSED**:
-  6: Exec:  ARCS  aa cc
-Matched node: [bb] with context [http://red]
-Matched node: [bb1] with context [http://red]
-: matching nodes: 2
-**PASSED**:
-  7: Exec:  ARCS-IN  cc
-Matched arc: [bb] with context [http://red]
-Matched arc: [bb1] with context [http://red]
-**PASSED**: matching arcs: 2
-  8: Exec:  ARCS-OUT  aa
-Matched arc: [bb] with context [http://red]
-Matched arc: [bb1] with context [http://red]
-Matched arc: [a2] with context [http://red]
-Matched arc: [a2] with context [http://red]
-**PASSED**: matching arcs: 4
-  9: Exec:  CONTAINS aa bb1 cc
-**PASSED**: the graph contains the triple
- 10: Exec:  FIND aa - -
-Matched triple: {[aa], [bb], [cc]} with context [http://red]
-Matched triple: {[aa], [bb1], [cc]} with context [http://red]
-Matched triple: {[aa], [a2], "cc"} with context [http://red]
-Matched triple: {[aa], [a2], (cc)} with context [http://red]
-**PASSED**: matching triples: 4
- 11: Exec:  HAS-ARC-IN cc bb
-**PASSED**: the graph contains the arc
- 12: Exec:  HAS-ARC-OUT aa bb
-**PASSED**: the graph contains the arc
- 13: Exec:  SOURCE  aa cc
-Matched node: [aa]
-**PASSED**:
- 14: Exec:  SOURCES  bb cc
-Matched node: [aa] with context [http://red]
-: matching nodes: 1
-**PASSED**:
- 15: Exec:  TARGET  aa bb
-Matched node: [cc]
-**PASSED**:
- 16: Exec:  TARGETS  aa bb
-Matched node: [cc] with context [http://red]
-: matching nodes: 1
-**PASSED**:
- 17: Exec:  REMOVE aa bb1 cc
-**PASSED**: removed triple from the graph
- 18: Exec:  QUERY "CONSTRUCT {?s ?p ?o} FROM <http://red> WHERE {?s ?p ?o}"
-Matched triple: {[aa], [a2], "cc"}
-Matched triple: {[oo], [pp], "12345^^<http://www.w3.org/2001/XMLSchema#int>"}
-Matched triple: {[aa], [a2], (cc)}
-Matched triple: {[aa], [bb], [cc]}
-Matched triple: {[mm], [nn], "Some long literal with language at en"}
-**PASSED**: matching triples: 5
- 19: Exec1:  QUERY_AS_BINDINGS "SELECT * WHERE {graph <http://red> { ?s ?p ?o }}"
-**: Formatting query result as 'xml':
-<?xml version="1.0" encoding="utf-8"?>
-<sparql xmlns="http://www.w3.org/2005/sparql-results#">
-  <head>
-    <variable name="s"/>
-    <variable name="p"/>
-    <variable name="o"/>
-  </head>
-  <results>
-    <result>
-      <binding name="s"><uri>aa</uri></binding>
-      <binding name="p"><uri>bb</uri></binding>
-      <binding name="o"><uri>cc</uri></binding>
-    </result>
-    <result>
-      <binding name="s"><uri>aa</uri></binding>
-      <binding name="p"><uri>a2</uri></binding>
-      <binding name="o"><literal>cc</literal></binding>
-    </result>
-    <result>
-      <binding name="s"><uri>aa</uri></binding>
-      <binding name="p"><uri>a2</uri></binding>
-      <binding name="o"><bnode>cc</bnode></binding>
-    </result>
-    <result>
-      <binding name="s"><uri>mm</uri></binding>
-      <binding name="p"><uri>nn</uri></binding>
-      <binding name="o"><literal>Some long literal with language at en</literal></binding>
-    </result>
-    <result>
-      <binding name="s"><uri>oo</uri></binding>
-      <binding name="p"><uri>pp</uri></binding>
-      <binding name="o"><literal>12345^^<http://www.w3.org/2001/XMLSchema#int></literal></binding>
-    </result>
-  </results>
-</sparql>
-**PASSED**:
- 20: Exec2:  QUERY_AS_BINDINGS "SELECT * WHERE {graph <http://red> { ?s ?p ?o }}"
-: Query returned bindings results:
-result: [s=[aa], p=[bb], o=[cc]]
-result: [s=[aa], p=[a2], o=cc]
-result: [s=[aa], p=[a2], o=(cc)]
-result: [s=[mm], p=[nn], o=Some long literal with language at en]
-result: [s=[oo], p=[pp], o=12345^^<http://www.w3.org/2001/XMLSchema#int>]
-: Query returned 5 results
-**PASSED**:
-=============================================
-PASSED: 20  FAILED:  0
+cd repl1
+virtuoso -f &
+cd ../repl2
+virtuoso -f &
+cd ../repl3
+virtuoso -f &
+cd ..	
 ]]></programlisting>
           </listitem>
-        </itemizedlist>
-      </sect4>
-      <sect4 id="rdfnativestorageprovidersredlandcp"><title>Connection Parameters</title>
-        <para>The Virtuoso provider has the following connection parameters available fro use:</para>
-        <itemizedlist mark="bullet">
-          <listitem><emphasis>dsn</emphasis> - ODBC datasource name</listitem>
-          <listitem><emphasis>user</emphasis> - user name of database server</listitem>
-          <listitem><emphasis>password</emphasis> - password of database server</listitem>
-          <listitem><emphasis>host</emphasis> - hostname:portno of the database server</listitem>
-          <listitem><emphasis>charset</emphasis> - database charset to use</listitem>
-        </itemizedlist>
-        <para>NOTE: Take care exposing the password as for example, program arguments or environment
-variables. The rdfproc utility can help this by reading the password from standard input. Inside programs,
-one way to prevent storing the password in a string is to construct a Redland hash of the storage options
-such as via librdf hash_from_string and use librdf_new_storage_with_options to create a storage. The
-rdfproc utility source code demonstrates this.
-        </para>
-        <para>The storage name parameter given to the storage constructor librdf new_storage is used
-inside the virtuoso store to allow multiple stores inside one Virtuoso database instance as parameterized
-with the above options.
-        </para>
-        <para>This store always provides contexts; the boolean storage option contexts is not checked.</para>
-        <para>Examples:</para>
+   <listitem>Use the <emphasis>isql</emphasis> command to execute the following rep.sql file:
 <programlisting><![CDATA[
-  /* A new Virtuoso store */
-  storage=librdf_new_storage(world, "virtuoso", "db1",
-      "dsn='Local Virtuoso',user='demo',password='demo'");
+--
+--  connect to the first database which is only a publisher
+--
+set DSN=localhost:1111;
+reconnect;
 
-  /* A different, existing Virtuoso store in the same database as above */
-  storage=librdf_new_storage(world, "virtuoso", "db2",
-      "dsn='Local Virtuoso',user='demo',password='demo'");
+--
+-- start publishing the graph http://test.org
+---
+DB.DBA.RDF_REPL_START();
+DB.DBA.RDF_REPL_GRAPH_INS ('http://test.org');
 
-  /* An existing Virtuoso store on a different database server */
-  storage=librdf_new_storage(world, "virtuoso", "http://red3",
-      "dsn='Remote Virtuoso',user='demo',password='demo'");
 
-  /* Opening with an options hash */
-  options=librdf_new_hash(world, NULL);
-  librdf_hash_from_string(options,
-      "dsn='Local Virtuoso',user='demo'");
-  librdf_hash_put_strings(options, "password", user_password);
-  storage=librdf_new_storage_with_options(world, "virtuoso", "http://red3", options);
+
+--
+--  connect to the second database in the chain, which is both a publisher and a subscriber
+--
+set DSN=localhost:1112;
+reconnect;
+
+--
+--  start publishing the graph http://test.org
+--
+DB.DBA.RDF_REPL_START();
+DB.DBA.RDF_REPL_GRAPH_INS ('http://test.org');
+
+--
+--  contact the first database 
+--
+repl_server ('db1-r', 'db1', 'localhost:1111');
+
+--
+--  subscribe to its RDF publication(s)
+--
+repl_subscribe ('db1-r', '__rdf_repl', 'dav', 'dav', 'dba', 'dba');
+
+--
+--  bring the replication service online
+--
+repl_sync_all();
+
+--
+--  and set scheduler to check every minute
+--
+DB.DBA.SUB_SCHEDULE ('db1-r', '__rdf_repl', 1);
+
+
+
+--
+--  connect to the third database in the chain, which is only a subscriber
+--
+set DSN=localhost:1113;
+reconnect;
+
+--
+-- uncomment next 2 commands if this database should also be a publisher
+--
+--DB.DBA.RDF_REPL_START();
+--DB.DBA.RDF_REPL_GRAPH_INS ('http://test.org');
+
+--
+--  contact second database
+--
+repl_server ('db2-r', 'db2', 'localhost:1112');
+
+--
+--  subscribe to its RDF publication(s)
+--
+repl_subscribe ('db2-r', '__rdf_repl', 'dav', 'dav', 'dba', 'dba');
+
+--
+--  bring the replication service online
+--
+repl_sync_all();
+
+--
+--  and set schedule to check every minute
+--
+DB.DBA.SUB_SCHEDULE ('db2-r', '__rdf_repl', 1);
 ]]></programlisting>
+</listitem>
+</orderedlist>
       </sect4>
     </sect3>
-    <sect3 id="rdfnativestorageprovidersredlandref"><title>References</title>
-      <itemizedlist mark="bullet">
-        <listitem><ulink url="http://librdf.org/docs/api/redland-storage.html">RedLand Triple Store</ulink></listitem>
-        <listitem><ulink url="http://librdf.org/docs/api/redland-storage-modules.html">RedLand Storage Modules</ulink></listitem>
-      </itemizedlist>
-    </sect3>
   </sect2>
 </sect1>
 </chapter>
diff --git a/docsrc/xmlsource/rdfviewssamples.xml b/docsrc/xmlsource/rdfviewssamples.xml
new file mode 100644
index 0000000..15b1e82
--- /dev/null
+++ b/docsrc/xmlsource/rdfviewssamples.xml
@@ -0,0 +1,17292 @@
+<sect1 id="rdfviewsenterpr"><title>Examples of RDF Views</title>
+<sect2 id="rdfviewnorthwindexample1"><title>Simple Mapping Example -- Northwind RDF View</title>
+<para>Here is example of the basic Northwind RDF Views deployment. The sequence of operations is very common for adding SPARQL access to existing application.</para>
+<para>There exist few important questions to answer. Who should have access to data behind RDF View? Should someone have access to other sorts of RDF data but not to the new View? What are applications that should be interoperable with the new RDF data source? Are there any applications that produce similar data but that data sould be kept apart from data made by view? How to ensure that deployment the view will not cause problems for other applications?</para>
+<para>First of all, we decide whether the default web service endpoint should have access to the data in question. If it should then we have to grant SELECT privileges to the account "SPARQL" that is used for the default endpoint; if it should not but some custom edpoint should then grant to the owner account of that account. Granting access is less trivial that it is usual. On one hand, those who can make SQL SELECT statements on application's tables can also make SPARQL queries on RDF View over that tables, because it makes SQL inside. On the other hand, those who do not intend to query that data at all may get unexpected "permission denied" errors on queries that worked fine before adding an RDF View. If SPARQL compiler can not prove that the query can not access data from the view then it will generate SQL code that will access tables behind the view. In some cases permission problems should be resolved by creating RDF View in a separate <link linkend="rdfviewconfiguringrdfstorages">RDF storage</link>. In this example, data are public:</para>
+<programlisting><![CDATA[
+use DB;
+
+GRANT SELECT ON "Demo"."demo"."Products" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Suppliers" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Shippers" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Categories" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Customers" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Employees" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Orders" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Order_Details" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Countries" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Provinces" TO "SPARQL";
+]]></programlisting>
+
+<para>Interoperability is the next question. The example is not
+interoperable with anything so in can provide data of any form, a real
+application will probably use some ontology from external
+source. Sometimes data should be converted from internal application's
+representation to something different (such as metric to imperial or
+ATT country code to two-character country id); sometimes composed IRIs
+should follow special rules; <link
+linkend="rdfviewiriusingfunction">function-based IRI classes</link>
+may help in that cases. As this is the first example, only plain
+format-string-based IRI classes are used.</para>
+
+<para>We should also ensure that data generated by the new view will
+not be accidentally mixed with other data of the database. For that
+purpose the example will use a unique graph name that includes both
+application name and host name. In addition, the script will drop
+declarations that might remain  from a previous run of the same script. The
+script is executed many times during the development so erasing
+previous version is worth writing. It will report an error if there's
+nothing to erase but it's better than unpredictable errors due to
+writing new declarations over existing ones.</para>
+
+
+<note><para>Making graph name unique for every host is not needed if
+the application is supposed to be "local" and nobody will
+access more than one installation of the application. If this is
+the case, use some fixed graph IRI, not necessarily starting with
+hostname at all; this is much more convenient for querying because you
+don't have to calculate the graph name in each query. With fixed graph
+in use, it is still possible to clone the RDF View to map to a unique
+graph as soon as the application become "public" and requires
+merging data from many installations.</para></note>
+
+<programlisting><![CDATA[
+SPARQL drop quad map graph iri("http://^{URIQADefaultHost}^/Northwind")
+;
+SPARQL drop quad map virtrdf:NorthwindDemo
+;
+]]></programlisting>
+<note><para>The <emphasis>^{URIQADefaultHost}^</emphasis> macro is replaced with the value of <emphasis>DefaultHost</emphasis> parameter of <link linkend="ini_URIQA">[URIQA]</link> section of configuration file. The IRI is written as <emphasis>iri("http://^{URIQADefaultHost}^/Northwind")</emphasis>, not as <emphasis><http://^{URIQADefaultHost}^/Northwind></emphasis> because macro of this sort works only inside SPARQL string values.</para></note>
+
+<para>Now it's safe to create IRI classes needed for the view. If
+these classes are used only in the view we define then it is safe to
+create all of them in a single statement. If some of them are used
+across multiple declarations then errors may occur. it is impossible
+to redefine an IRI class that is in use; the compiler will try to
+avoid reporting errors by checking whether the new declaration is
+identical to the existing one and by trying garbage collection in hope
+that the IRI class is used only in garbage, but errors may occur
+anyway. Thus it is better to declare "shared" IRI classes by
+individual statements and group together only "private" IRI
+classes of a view. If a "class redefinition" error occurs in
+the middle of a group then "undefined class" errors may
+occur after because the processing of the group was interrupted before
+rest of group was not executed. When in trouble, try <link
+linkend="fn_rdf_audit_metadata"><function>DB.DBA.RDF_AUDIT_METADATA</function></link>
+procedure.</para>
+
+
+<programlisting><![CDATA[
+SPARQL
+create iri class northwind:Category "http://^{URIQADefaultHost}^/Northwind/Category/%d#this" (in category_id integer not null) .
+create iri class northwind:Shipper "http://^{URIQADefaultHost}^/Northwind/Shipper/%d#this" (in shipper_id integer not null) .
+create iri class northwind:Supplier "http://^{URIQADefaultHost}^/Northwind/Supplier/%d#this" (in supplier_id integer not null) .
+create iri class northwind:Product   "http://^{URIQADefaultHost}^/Northwind/Product/%d#this" (in product_id integer not null) .
+create iri class northwind:Customer "http://^{URIQADefaultHost}^/Northwind/Customer/%U#this" (in customer_id varchar not null) .
+create iri class northwind:Employee "http://^{URIQADefaultHost}^/Northwind/Employee/%U%U%d#this" (in employee_firstname varchar not null, in employee_lastname varchar not null, in employee_id integer not null) .
+create iri class northwind:Order "http://^{URIQADefaultHost}^/Northwind/Order/%d#this" (in order_id integer not null) .
+create iri class northwind:CustomerContact "http://^{URIQADefaultHost}^/Northwind/CustomerContact/%U#this" (in customer_id varchar not null) .
+create iri class northwind:OrderLine "http://^{URIQADefaultHost}^/Northwind/OrderLine/%d/%d#this" (in order_id integer not null, in product_id integer not null) .
+create iri class northwind:Province "http://^{URIQADefaultHost}^/Northwind/Province/%U/%U#this" (in country_name varchar not null, in province_name varchar not null) .
+create iri class northwind:Country "http://^{URIQADefaultHost}^/Northwind/Country/%U#this" (in country_name varchar not null) .
+create iri class northwind:Flag "http://^{URIQADefaultHost}^%U#this" (in flag_path varchar not null) .
+create iri class northwind:dbpedia_iri "http://dbpedia.org/resource/%U" (in uname varchar not null) .
+create iri class northwind:EmployeePhoto "http://^{URIQADefaultHost}^/DAV/VAD/demo/sql/EMP%d#this" (in emp_id varchar not null) .
+create iri class northwind:CategoryPhoto "http://^{URIQADefaultHost}^/DAV/VAD/demo/sql/CAT%d#this" (in category_id varchar not null) .
+;
+]]></programlisting>
+<para>One IRI class per subject type; format strings begin with same host but different directory names so this will let the compiler to guess the type of subject by the text of IRI. Most of declarations are <link linkend="rdfviewbijandreturns">bijections</link> and may get  <emphasis>option (bijection)</emphasis> hint but these format strings are so simple that the compiler may understand it by itself.
+(<emphasis>northwind:Employee</emphasis> is not a bijection because <link linkend="fn_sprintf_inverse"><function>sprintf_inverse</function></link> will be unable to split the tail of IRI string and find the boundary between first and last name.)</para>
+<para>The final operation is extending the default quad storage with new tree of quad map patterns.</para>
+<programlisting><![CDATA[
+SPARQL
+prefix northwind: <http://demo.openlinksw.com/schemas/northwind#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+
+alter quad storage virtrdf:DefaultQuadStorage
+from Demo.demo.Products as products
+from Demo.demo.Suppliers as suppliers
+from Demo.demo.Shippers as shippers
+from Demo.demo.Categories as categories
+from Demo.demo.Customers as customers
+from Demo.demo.Employees as employees
+from Demo.demo.Orders as orders
+from Demo.demo.Order_Details as order_lines
+from Demo.demo.Countries as countries
+from Demo.demo.Provinces as provinces
+where (^{suppliers.}^.Country = ^{countries.}^.Name)
+where (^{customers.}^.Country = ^{countries.}^.Name)
+where (^{employees.}^.Country = ^{countries.}^.Name)
+where (^{orders.}^.ShipCountry = ^{countries.}^.Name)
+{
+        create virtrdf:NorthwindDemo as graph iri ("http://^{URIQADefaultHost}^/Northwind") option (exclusive)
+        {
+                northwind:CustomerContact (customers.CustomerID)
+                        a foaf:Person
+                                as virtrdf:CustomerContact-foaf_Person .
+
+                northwind:CustomerContact (customers.CustomerID)
+                        a northwind:CustomerContact
+                                as virtrdf:CustomerContact-CustomerContact;
+                        foaf:name customers.ContactName
+                                as virtrdf:CustomerContact-contact_name ;
+                        foaf:phone customers.Phone
+                                as virtrdf:CustomerContact-foaf_phone ;
+                        northwind:is_contact_at northwind:Customer (customers.CustomerID)
+                                as virtrdf:CustomerContact-is_contact_at ;
+                        northwind:country northwind:Country (customers.Country)
+                                as virtrdf:CustomerContact-country ;
+                        rdfs:isDefinedBy northwind:customercontact_iri (customers.CustomerID) ;
+                        rdfs:isDefinedBy northwind:CustomerContact (customers.CustomerID) .
+
+                northwind:Country (customers.Country)
+                        northwind:is_country_of
+                northwind:CustomerContact (customers.CustomerID) as virtrdf:CustomerContact-is_country_of .
+
+                northwind:Product (products.ProductID)
+                        a northwind:Product
+                                as virtrdf:Product-ProductID ;
+                        northwind:has_category northwind:Category (products.CategoryID)
+                                as virtrdf:Product-product_has_category ;
+                        northwind:has_supplier northwind:Supplier (products.SupplierID)
+                                as virtrdf:Product-product_has_supplier ;
+                        northwind:productName products.ProductName
+                                as virtrdf:Product-name_of_product ;
+                        northwind:quantityPerUnit products.QuantityPerUnit
+                                as virtrdf:Product-quantity_per_unit ;
+                        northwind:unitPrice products.UnitPrice
+                                as virtrdf:Product-unit_price ;
+                        northwind:unitsInStock products.UnitsInStock
+                                as virtrdf:Product-units_in_stock ;
+                        northwind:unitsOnOrder products.UnitsOnOrder
+                                as virtrdf:Product-units_on_order ;
+                        northwind:reorderLevel products.ReorderLevel
+                                as virtrdf:Product-reorder_level ;
+                        northwind:discontinued products.Discontinued
+                                as virtrdf:Product-discontinued ;
+                        rdfs:isDefinedBy northwind:product_iri (products.ProductID) ;
+                        rdfs:isDefinedBy northwind:Product (products.ProductID) .
+
+                northwind:Category (products.CategoryID)
+                        northwind:category_of northwind:Product (products.ProductID) as virtrdf:Product-category_of .
+
+                northwind:Supplier (products.SupplierID)
+                        northwind:supplier_of northwind:Product (products.ProductID) as virtrdf:Product-supplier_of .
+
+                northwind:Supplier (suppliers.SupplierID)
+                        a northwind:Supplier
+                                as virtrdf:Supplier-SupplierID ;
+                        northwind:companyName suppliers.CompanyName
+                                as virtrdf:Supplier-company_name ;
+                        northwind:contactName suppliers.ContactName
+                                as virtrdf:Supplier-contact_name ;
+                        northwind:contactTitle suppliers.ContactTitle
+                                as virtrdf:Supplier-contact_title ;
+                        northwind:address suppliers.Address
+                                as virtrdf:Supplier-address ;
+                        northwind:city suppliers.City
+                                as virtrdf:Supplier-city ;
+                        northwind:dbpedia_city northwind:dbpedia_iri(suppliers.City)
+                                as virtrdf:Supplier-dbpediacity ;
+                        northwind:region suppliers.Region
+                                as virtrdf:Supplier-region ;
+                        northwind:postalCode suppliers.PostalCode
+                                as virtrdf:Supplier-postal_code ;
+                        northwind:country northwind:Country(suppliers.Country)
+                                as virtrdf:Supplier-country ;
+                        northwind:phone suppliers.Phone
+                                as virtrdf:Supplier-phone ;
+                        northwind:fax suppliers.Fax
+                                as virtrdf:Supplier-fax ;
+                        northwind:homePage suppliers.HomePage
+                                as virtrdf:Supplier-home_page ;
+                        rdfs:isDefinedBy northwind:supplier_iri (suppliers.SupplierID) ;
+                        rdfs:isDefinedBy northwind:Supplier (suppliers.SupplierID) .
+
+                northwind:Country (suppliers.Country)
+                        northwind:is_country_of
+                northwind:Supplier (suppliers.SupplierID) as virtrdf:Supplier-is_country_of .
+
+                northwind:Category (categories.CategoryID)
+                        a northwind:Category
+                                as virtrdf:Category-CategoryID ;
+                        northwind:categoryName categories.CategoryName
+                                as virtrdf:Category-home_page ;
+                        northwind:description categories.Description
+                                as virtrdf:Category-description ;
+                        foaf:img northwind:CategoryPhoto(categories.CategoryID)
+                                as virtrdf:Category-categories.CategoryPhoto ;
+                        rdfs:isDefinedBy northwind:category_iri (categories.CategoryID) ;
+                        rdfs:isDefinedBy northwind:Category (categories.CategoryID) .
+
+                northwind:CategoryPhoto(categories.CategoryID)
+                        a northwind:CategoryPhoto
+                                as virtrdf:Category-categories.CategoryPhotoID ;
+                        rdfs:isDefinedBy northwind:categoryphoto_iri (categories.CategoryID) ;
+                        rdfs:isDefinedBy northwind:CategoryPhoto(categories.CategoryID) .
+
+                northwind:Shipper (shippers.ShipperID)
+                        a northwind:Shipper
+                                as virtrdf:Shipper-ShipperID ;
+                        northwind:companyName shippers.CompanyName
+                                as virtrdf:Shipper-company_name ;
+                        northwind:phone shippers.Phone
+                                as virtrdf:Shipper-phone ;
+                        rdfs:isDefinedBy northwind:shipper_iri (shippers.ShipperID) ;
+                        rdfs:isDefinedBy northwind:Shipper (shippers.ShipperID) .
+
+                northwind:Customer (customers.CustomerID)
+                        a  northwind:Customer
+                                as virtrdf:Customer-CustomerID2 ;
+                        a  foaf:Organization
+                                as virtrdf:Customer-CustomerID ;
+                        foaf:name customers.CompanyName
+                                as virtrdf:Customer-foaf_name ;
+                        northwind:companyName customers.CompanyName
+                                as virtrdf:Customer-company_name ;
+                        northwind:has_contact northwind:CustomerContact (customers.CustomerID)
+                                as virtrdf:Customer-contact ;
+                        northwind:country northwind:Country (customers.Country)
+                                as virtrdf:Customer-country ;
+                        northwind:contactName customers.ContactName
+                                as virtrdf:Customer-contact_name ;
+                        northwind:contactTitle customers.ContactTitle
+                                as virtrdf:Customer-contact_title ;
+                        northwind:address customers.Address
+                                as virtrdf:Customer-address ;
+                        northwind:city customers.City
+                                as virtrdf:Customer-city ;
+                        northwind:dbpedia_city northwind:dbpedia_iri(customers.City)
+                                as virtrdf:Customer-dbpediacity ;
+                        northwind:region customers.Region
+                                as virtrdf:Customer-region ;
+                        northwind:PostalCode customers.PostalCode
+                                as virtrdf:Customer-postal_code ;
+                        foaf:phone customers.Phone
+                                as virtrdf:Customer-foaf_phone ;
+                        northwind:phone customers.Phone
+                                as virtrdf:Customer-phone ;
+                        northwind:fax customers.Fax
+                                as virtrdf:Customer-fax ;
+                        rdfs:isDefinedBy northwind:customer_iri (customers.CustomerID) ;
+                        rdfs:isDefinedBy northwind:Customer (customers.CustomerID) .
+
+                northwind:Country (customers.Country)
+                        northwind:is_country_of
+                northwind:Customer (customers.CustomerID) as virtrdf:Customer-is_country_of .
+
+                northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID)
+                        a northwind:Employee
+                                as virtrdf:Employee-EmployeeID2 ;
+                        a foaf:Person
+                                as virtrdf:Employee-EmployeeID ;
+                        foaf:surname employees.LastName
+                                as virtrdf:Employee-foaf_last_name ;
+                        northwind:lastName employees.LastName
+                                as virtrdf:Employee-last_name ;
+                        foaf:firstName employees.FirstName
+                                as virtrdf:Employee-foaf_first_name ;
+                        northwind:firstName employees.FirstName
+                                as virtrdf:Employee-first_name ;
+                        foaf:title employees.Title
+                                as virtrdf:Employee-title ;
+                        northwind:titleOfCourtesy employees.TitleOfCourtesy
+                                as virtrdf:Employee-title_of_courtesy ;
+                        foaf:birthday employees.BirthDate
+                                as virtrdf:Employee-foaf_birth_date ;
+                        northwind:birthday employees.BirthDate
+                                as virtrdf:Employee-birth_date ;
+                        northwind:hireDate employees.HireDate
+                                as virtrdf:Employee-hire_date ;
+                        northwind:address employees.Address
+                                as virtrdf:Employee-address ;
+                        northwind:city employees.City
+                                as virtrdf:Employee-city ;
+                        northwind:dbpedia_city northwind:dbpedia_iri(employees.City)
+                                as virtrdf:Employee-dbpediacity ;
+                        northwind:region employees.Region
+                                as virtrdf:Employee-region ;
+                        northwind:postalCode employees.PostalCode
+                                as virtrdf:Employee-postal_code ;
+                        northwind:country northwind:Country(employees.Country)
+                                as virtrdf:Employee-country ;
+                        foaf:phone employees.HomePhone
+                                as virtrdf:Employee-home_phone ;
+                        northwind:extension employees.Extension
+                                as virtrdf:Employee-extension ;
+                        northwind:notes employees.Notes
+                                as virtrdf:Employee-notes ;
+                        northwind:reportsTo northwind:Employee(employees.FirstName, employees.LastName, employees.ReportsTo) where (^{employees.}^.ReportsTo = ^{employees.}^.EmployeeID)
+                                as virtrdf:Employee-reports_to ;
+                        foaf:img northwind:EmployeePhoto(employees.EmployeeID)
+                                as virtrdf:Employee-employees.EmployeePhoto ;
+                        rdfs:isDefinedBy northwind:employee_iri (employees.EmployeeID) ;
+                        rdfs:isDefinedBy northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID) .
+
+                northwind:EmployeePhoto(employees.EmployeeID)
+                        a northwind:EmployeePhoto
+                                as virtrdf:Employee-employees.EmployeePhotoId ;
+                        rdfs:isDefinedBy northwind:employeephoto_iri (employees.EmployeeID) ;
+                        rdfs:isDefinedBy northwind:EmployeePhoto (employees.EmployeeID) .
+
+                northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID)
+                        northwind:is_salesrep_of
+                northwind:Order (orders.OrderID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID) as virtrdf:Order-is_salesrep_of .
+
+                northwind:Country (employees.Country)
+                        northwind:is_country_of
+                northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID) as virtrdf:Employee-is_country_of .
+
+                northwind:Order (orders.OrderID)
+                        a northwind:Order
+                                as virtrdf:Order-Order ;
+                        northwind:has_customer northwind:Customer (orders.CustomerID)
+                                as virtrdf:Order-order_has_customer ;
+                        northwind:has_salesrep northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID)
+                                as virtrdf:Customer-has_salesrep ;
+                        northwind:has_employee northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID)
+                                as virtrdf:Order-order_has_employee ;
+                        northwind:orderDate orders.OrderDate
+                                as virtrdf:Order-order_date ;
+                        northwind:requiredDate orders.RequiredDate
+                                as virtrdf:Order-required_date ;
+                        northwind:shippedDate orders.ShippedDate
+                                as virtrdf:Order-shipped_date ;
+                        northwind:order_ship_via northwind:Shipper (orders.ShipVia)
+                                as virtrdf:Order-order_ship_via ;
+                        northwind:freight orders.Freight
+                                as virtrdf:Order-freight ;
+                        northwind:shipName orders.ShipName
+                                as virtrdf:Order-ship_name ;
+                        northwind:shipAddress orders.ShipAddress
+                                as virtrdf:Order-ship_address ;
+                        northwind:shipCity orders.ShipCity
+                                as virtrdf:Order-ship_city ;
+                        northwind:dbpedia_shipCity northwind:dbpedia_iri(orders.ShipCity)
+                                as virtrdf:Order-dbpediaship_city ;
+                        northwind:shipRegion orders.ShipRegion
+                                as virtrdf:Order-ship_region ;
+                        northwind:shipPostal_code orders.ShipPostalCode
+                                as virtrdf:Order-ship_postal_code ;
+                        northwind:shipCountry northwind:Country(orders.ShipCountry)
+                                as virtrdf:ship_country ;
+                        rdfs:isDefinedBy northwind:order_iri (orders.OrderID) ;
+                        rdfs:isDefinedBy northwind:Order (orders.OrderID) .
+
+                northwind:Country (orders.ShipCountry)
+                        northwind:is_ship_country_of
+                northwind:Order (orders.OrderID) as virtrdf:Order-is_country_of .
+
+                northwind:Customer (orders.CustomerID)
+                        northwind:has_order northwind:Order (orders.OrderID) as virtrdf:Order-has_order .
+
+                northwind:Shipper (orders.ShipVia)
+                        northwind:ship_order northwind:Order (orders.OrderID) as virtrdf:Order-ship_order .
+
+                northwind:OrderLine (order_lines.OrderID, order_lines.ProductID)
+                        a northwind:OrderLine
+                                as virtrdf:OrderLine-OrderLines ;
+                        northwind:has_order_id northwind:Order (order_lines.OrderID)
+                                as virtrdf:order_lines_has_order_id ;
+                        northwind:has_product_id northwind:Product (order_lines.ProductID)
+                                as virtrdf:order_lines_has_product_id ;
+                        northwind:unitPrice order_lines.UnitPrice
+                                as virtrdf:OrderLine-unit_price ;
+                        northwind:quantity order_lines.Quantity
+                                as virtrdf:OrderLine-quantity ;
+                        northwind:discount order_lines.Discount
+                                as virtrdf:OrderLine-discount ;
+                        rdfs:isDefinedBy northwind:orderline_iri (order_lines.OrderID, order_lines.ProductID) ;
+                        rdfs:isDefinedBy northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) .
+
+                northwind:Order (orders.OrderID)
+                        northwind:is_order_of
+                northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) where (^{orders.}^.OrderID = ^{order_lines.}^.OrderID) as virtrdf:Order-is_order_of .
+
+                northwind:Product (products.ProductID)
+                        northwind:is_product_of
+                northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) where (^{products.}^.ProductID = ^{order_lines.}^.ProductID) as virtrdf:Product-is_product_of .
+
+                northwind:Country (countries.Name)
+                        a northwind:Country
+                                as virtrdf:Country-Type2 ;
+                        a wgs:SpatialThing
+                                as virtrdf:Country-Type ;
+                        owl:sameAs northwind:dbpedia_iri (countries.Name) ;
+                        northwind:name countries.Name
+                                as virtrdf:Country-Name ;
+                        northwind:code countries.Code
+                                as virtrdf:Country-Code ;
+                        northwind:smallFlagDAVResourceName countries.SmallFlagDAVResourceName
+                                as virtrdf:Country-SmallFlagDAVResourceName ;
+                        northwind:largeFlagDAVResourceName countries.LargeFlagDAVResourceName
+                                as virtrdf:Country-LargeFlagDAVResourceName ;
+                        northwind:smallFlagDAVResourceURI northwind:Flag(countries.SmallFlagDAVResourceURI)
+                                as virtrdf:Country-SmallFlagDAVResourceURI ;
+                        northwind:largeFlagDAVResourceURI northwind:Flag(countries.LargeFlagDAVResourceURI)
+                                as virtrdf:Country-LargeFlagDAVResourceURI ;
+                        wgs:lat countries.Lat
+                                as virtrdf:Country-Lat ;
+                        wgs:long countries.Lng
+                                as virtrdf:Country-Lng ;
+                        rdfs:isDefinedBy northwind:country_iri (countries.Name) ;
+                        rdfs:isDefinedBy northwind:Country (countries.Name) .
+
+                northwind:Country (countries.Name)
+                        northwind:has_province
+                northwind:Province (provinces.CountryCode, provinces.Province) where (^{provinces.}^.CountryCode = ^{countries.}^.Code) as virtrdf:Country-has_province .
+
+                northwind:Province (provinces.CountryCode, provinces.Province)
+                        a northwind:Province
+                                as virtrdf:Province-Provinces ;
+                        northwind:has_country_code provinces.CountryCode
+                                as virtrdf:has_country_code ;
+                        northwind:provinceName provinces.Province
+                                as virtrdf:Province-ProvinceName ;
+                        rdfs:isDefinedBy northwind:province_iri (provinces.CountryCode, provinces.Province) ;
+                        rdfs:isDefinedBy northwind:Province (provinces.CountryCode, provinces.Province) .
+
+                northwind:Province (provinces.CountryCode, provinces.Province)
+                        northwind:is_province_of
+                northwind:Country (countries.Name) where  (^{countries.}^.Code = ^{provinces.}^.CountryCode) as virtrdf:Province-country_of .
+        }.
+}.
+;
+]]></programlisting>
+<para>The created RDF View is sufficient for querying relational data via SPARQL but not for accessing data by dereferencing IRIs of subjects. Making IRIs dereferenceable requires configuring HTTP server; that is explained in <link linkend="rdfsparqlexnpointnorthwindexample">second part of the example</link>.</para>
+</sect2>
+<sect2 id="rdfviewsenterprbsm">
+      <title>BSBM to RDF</title>
+      <para>This section includes example mapping SQL Data to RDF for BSBM.</para>
+      <para>Each BSBM installation includes a demonstration database that includes a simple management system schema and instance data. This sample database provides an easy route for introducing BSBM users and developers to the virtues of RDF based Linked Data Views built atop existing BSBM relational databases.</para>      
+<programlisting><![CDATA[
+use DB;
+
+CREATE TABLE DB.DBA.ProductFeature (
+  nr integer primary key,
+  label varchar(100) not null,
+  comment varchar(1500) not null,
+  publisher integer not null,
+  publishDate date not null
+)
+;
+
+grant SELECT on DB.DBA.ProductFeature to public
+;
+
+CREATE TABLE DB.DBA.ProductType (
+  nr integer primary key,
+  label varchar(100) not null,
+  comment varchar(1500) not null,
+  parent integer,
+  publisher integer not null,
+  publishDate date not null
+)
+;
+
+grant SELECT on DB.DBA.ProductType to public
+;
+
+CREATE TABLE DB.DBA.Producer (
+  nr integer primary key,
+  label varchar(100) not null,
+  comment varchar(1500) not null,
+  homepage varchar(100) not null,
+  country char(2) not null,
+  publisher integer not null,
+  publishDate date not null
+)
+;
+
+grant SELECT on DB.DBA.Producer to public
+;
+create index producer_homepage on DB.DBA.Producer (homepage)
+;
+
+CREATE TABLE DB.DBA.Product (
+  nr integer primary key,
+  label varchar(100) not null,
+  comment varchar not null,
+  producer integer not null,
+  propertyNum1 integer,
+  propertyNum2 integer,
+  propertyNum3 integer,
+  propertyNum4 integer,
+  propertyNum5 integer,
+  propertyNum6 integer,
+  propertyTex1 varchar(200),
+  propertyTex2 varchar(200),
+  propertyTex3 varchar(200),
+  propertyTex4 varchar(200),
+  propertyTex5 varchar(200),
+  propertyTex6 varchar(200),
+  publisher integer not null,
+  publishDate date not null
+)
+;
+
+grant SELECT on DB.DBA.Product to public
+;
+
+create index product_lbl on DB.DBA.Product (label)
+;
+create unique index product_producer_nr on DB.DBA.Product (producer, nr)
+;
+create index product_pn1 on DB.DBA.Product (propertyNum1)
+;
+create index product_pn2 on DB.DBA.Product (propertyNum2)
+;
+create index product_pn3 on DB.DBA.Product (propertyNum3)
+;
+
+create text index on DB.DBA.Product (label) with key nr
+;
+
+CREATE TABLE DB.DBA.ProductTypeProduct (
+  product integer not null,
+  productType integer not null,
+  PRIMARY KEY (product, productType)
+)
+;
+
+grant SELECT on DB.DBA.ProductTypeProduct to public
+;
+
+create index ptype_inv on DB.DBA.ProductTypeProduct (productType, product)
+;
+
+CREATE TABLE DB.DBA.ProductFeatureProduct (
+  product integer not null,
+  productFeature integer not null,
+  PRIMARY KEY (product, productFeature)
+)
+;
+
+grant SELECT on DB.DBA.ProductFeatureProduct to public
+;
+
+create index pfeature_inv on DB.DBA.ProductFeatureProduct (productFeature, product)
+;
+
+CREATE TABLE DB.DBA.Vendor (
+  nr integer primary key,
+  label varchar(100) not null,
+  comment varchar not null,
+  homepage varchar(100) not null,
+  country char(2) not null,
+  publisher integer not null,
+  publishDate date not null
+)
+;
+
+grant SELECT on DB.DBA.Vendor to public
+;
+
+create index vendor_country on DB.DBA.Vendor (country)
+;
+create index vendor_homepage on DB.DBA.Vendor (homepage)
+;
+
+CREATE TABLE DB.DBA.Offer (
+  nr integer primary key,
+  product integer not null,
+  producer integer,
+  vendor integer not null,
+  price double precision not null,
+  validFrom date not null,
+  validTo date not null,
+  deliveryDays integer not null,
+  offerWebpage varchar(100) not null,
+  publisher integer not null,
+  publishDate date not null
+)
+;
+
+grant SELECT on DB.DBA.Offer to public
+;
+
+create index offer_product on DB.DBA.Offer (product, deliveryDays)
+;
+create unique index offer_producer_product on DB.DBA.Offer (producer, product, nr)
+;
+create index offer_validto on DB.DBA.Offer (validTo)
+;
+create index offer_vendor_product on DB.DBA.Offer (vendor, product)
+;
+create index offer_webpage on DB.DBA.Offer (offerWebpage)
+;
+
+CREATE TABLE DB.DBA.Person (
+  nr integer primary key,
+  name varchar(30) not null,
+  mbox_sha1sum char(40) not null,
+  country char(2) not null,
+  publisher integer not null,
+  publishDate date not null
+)
+;
+
+grant SELECT on DB.DBA.Person to public
+;
+
+CREATE TABLE DB.DBA.Review (
+  nr integer primary key,
+  product integer not null,
+  producer integer,
+  person integer not null,
+  reviewDate date not null,
+  title varchar(200) not null,
+  text long varchar not null,
+  textlang char(2) not null,
+  rating1 integer,
+  rating2 integer,
+  rating3 integer,
+  rating4 integer,
+  publisher integer not null,
+  publishDate date not null
+)
+;
+
+grant SELECT on DB.DBA.Review to public
+;
+
+create unique index review_product on DB.DBA.Review (product, producer, nr)
+;
+
+create unique index review_producer_product on DB.DBA.Review (producer, product, nr)
+;
+
+create bitmap index review_textlang on DB.DBA.Review (textlang)
+;
+
+DB.DBA.XML_SET_NS_DECL ('foaf', 'http://xmlns.com/foaf/0.1/', 2)
+;
+DB.DBA.XML_SET_NS_DECL ('dc', 'http://purl.org/dc/elements/1.1/', 2)
+;
+DB.DBA.XML_SET_NS_DECL ('xsd', 'http://www.w3.org/2001/XMLSchema-datatypes/', 2)
+;
+DB.DBA.XML_SET_NS_DECL ('rev', 'http://purl.org/stuff/rev#', 2)
+;
+DB.DBA.XML_SET_NS_DECL ('bsbm', 'http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/', 2)
+;
+DB.DBA.XML_SET_NS_DECL ('bsbm-inst', 'http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/', 2)
+;
+
+SPARQL drop quad map bsbm:SingleGraphView
+;
+
+SPARQL create iri class bsbm:ProductFeature-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature%d" (in nr integer not null)
+;
+
+SPARQL create iri class bsbm:ProductType-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductType%d" (in nr integer not null)
+;
+
+SPARQL create iri class bsbm:Producer-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer%d/Producer%d" (in nr_ integer not null, in nr integer not null)
+;
+
+SPARQL create iri class bsbm:Product-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromProducer%d/Product%d" (in producer integer not null, in nr integer not null)
+;
+
+SPARQL create iri class bsbm:Vendor-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromVendor%d/Vendor%d" (in nr_ integer not null, in nr integer not null)
+;
+
+SPARQL create iri class bsbm:Offer-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromVendor%d/Offer%d" (in vendor integer not null, in nr integer not null)
+;
+
+SPARQL create iri class bsbm:StdInst-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/StandardizationInstitution%d" (in publisher integer not null)
+;
+
+SPARQL create iri class bsbm:Person-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromRatingSite%d/Person%d" (in publisher integer not null, in nr integer not null)
+;
+
+SPARQL create iri class bsbm:Review-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromRatingSite%d/Review%d" (in site integer, in nr integer not null)
+;
+
+SPARQL create iri class bsbm:ISO3166-country-iri "http://downlode.org/rdf/iso-3166/countries#%s" (in code varchar not null)
+;
+
+SPARQL create iri class bsbm:homepage-iri "%s" (in homepage varchar not null) option (returns "http://%s")
+;
+
+SPARQL create iri class bsbm:RatingSite-iri "http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/dataFromRatingSite%d/RatingSite%d" (in nr_ integer not null, in nr integer not null)
+;
+
+SPARQL
+alter quad storage virtrdf:DefaultQuadStorage
+FROM DB.DBA.ProductFeature as pfeature
+FROM DB.DBA.ProductType as ptype
+FROM DB.DBA.Producer as producer
+FROM DB.DBA.Product as product text literal product.label
+FROM DB.DBA.ProductTypeProduct as ptypeproduct
+FROM DB.DBA.ProductFeatureProduct as pfeatureproduct
+FROM DB.DBA.Vendor as vendor
+FROM DB.DBA.Offer as offer
+FROM DB.DBA.Person as person
+FROM DB.DBA.Review as review
+where (^{product.}^.nr = ^{ptypeproduct.}^.product)
+where (^{product.}^.nr = ^{pfeatureproduct.}^.product)
+  {
+    create bsbm:SingleGraphView as graph <BSBM> option (exclusive)
+      {
+	bsbm:Product-iri (product.producer, product.nr)
+          a bsbm:Product ;
+	  rdfs:label product.label ;
+          rdfs:comment product.comment ;
+          bsbm:producer bsbm:Producer-iri (product.producer, product.producer) ;
+          bsbm:productPropertyTextual1 product.propertyTex1 ;
+          bsbm:productPropertyTextual2 product.propertyTex2 ;
+          bsbm:productPropertyTextual3 product.propertyTex3 ;
+          bsbm:productPropertyTextual4 product.propertyTex4 ;
+          bsbm:productPropertyTextual5 product.propertyTex5 ;
+          bsbm:productPropertyTextual6 product.propertyTex6 ;
+          bsbm:productPropertyNumeric1 product.propertyNum1 ;
+          bsbm:productPropertyNumeric2 product.propertyNum2 ;
+          bsbm:productPropertyNumeric3 product.propertyNum3 ;
+          bsbm:productPropertyNumeric4 product.propertyNum4 ;
+          bsbm:productPropertyNumeric5 product.propertyNum5 ;
+          bsbm:productPropertyNumeric6 product.propertyNum6 ;
+          rdf:type bsbm:ProductType-iri (ptypeproduct.productType) ;
+          bsbm:productFeature bsbm:ProductFeature-iri (pfeatureproduct.productFeature) ;
+          dc:publisher bsbm:Producer-iri (product.publisher, product.publisher) ;
+          dc:date product.publishDate .
+
+        bsbm:ProductType-iri (ptype.nr)
+          a bsbm:ProductType ;
+          rdfs:label ptype.label ;
+          rdfs:comment ptype.comment ;
+          rdfs:subClassOf bsbm:ProductType-iri (ptype.parent) ;
+          dc:publisher bsbm:StdInst-iri (ptype.publisher) ;
+          dc:date ptype.publishDate .
+
+        bsbm:ProductFeature-iri (pfeature.nr)
+          a bsbm:ProductFeature ;
+          rdfs:label pfeature.label ;
+          rdfs:comment pfeature.comment ;
+          dc:publisher bsbm:StdInst-iri (pfeature.publisher) ;
+          dc:date pfeature.publishDate .
+
+        bsbm:Producer-iri (producer.nr, producer.nr)
+          a bsbm:Producer ;
+          rdfs:label producer.label ;
+          rdfs:comment producer.comment ;
+          foaf:homepage bsbm:homepage-iri (producer.homepage) ;
+          bsbm:country bsbm:ISO3166-country-iri (producer.country) ;
+          dc:publisher bsbm:Producer-iri (producer.nr, producer.nr) ;
+          dc:date producer.publishDate .
+
+        bsbm:Vendor-iri (vendor.nr, vendor.nr)
+          a bsbm:Vendor ;
+          rdfs:label vendor.label ;
+          rdfs:comment vendor.comment ;
+          foaf:homepage bsbm:homepage-iri (vendor.homepage) ;
+          bsbm:country bsbm:ISO3166-country-iri (vendor.country) ;
+          dc:publisher bsbm:Vendor-iri (vendor.publisher, vendor.publisher) ;
+          dc:date vendor.publishDate .
+
+        bsbm:Offer-iri (offer.vendor, offer.nr)
+          a bsbm:Offer ;
+          bsbm:product bsbm:Product-iri (offer.producer, offer.product) ;
+          bsbm:vendor bsbm:Vendor-iri (offer.vendor, offer.vendor) ;
+          bsbm:vendor bsbm:Vendor-iri (offer.vendor, offer.vendor) ;
+          bsbm:price offer.price ;
+          bsbm:validFrom offer.validFrom ;
+          bsbm:validTo offer.validTo ;
+          bsbm:deliveryDays offer.deliveryDays ;
+          bsbm:offerWebpage bsbm:homepage-iri (offer.offerWebpage) ;
+          dc:publisher bsbm:Vendor-iri (offer.publisher, offer.publisher) ;
+          dc:date offer.publishDate .
+
+        bsbm:Person-iri (person.publisher, person.nr)
+          a foaf:Person ;
+          foaf:name person.name ;
+          foaf:mbox_sha1sum person.mbox_sha1sum ;
+          bsbm:country bsbm:ISO3166-country-iri (person.country) ;
+          dc:publisher bsbm:RatingSite-iri (person.publisher, person.publisher) ;
+          dc:date person.publishDate .
+
+        bsbm:Review-iri (review.publisher, review.nr)
+          a rev:Review ;
+          bsbm:reviewFor bsbm:Product-iri (review.producer, review.product) ;
+          bsbm:producer bsbm:Producer-iri (review.producer, review.producer) ;
+          rev:reviewer bsbm:Person-iri (review.publisher, review.person) ;
+          bsbm:reviewDate review.reviewDate ;
+          dc:title review.title ;
+          rev:text review.text lang review.textlang ;
+          bsbm:rating1 review.rating1 ;
+          bsbm:rating2 review.rating2 ;
+          bsbm:rating3 review.rating3 ;
+          bsbm:rating4 review.rating4 ;
+          dc:publisher bsbm:RatingSite-iri (review.publisher, review.publisher) ;
+          dc:date review.publishDate .
+      }
+  }
+;
+]]></programlisting>
+    </sect2>
+<sect2 id="rdfviewsbusint"><title>TPCH to RDF</title>
+<programlisting><![CDATA[
+use DB;
+
+GRANT SELECT ON TPCH.DBA.PARTSUPP  TO "SPARQL";
+GRANT SELECT ON TPCH.DBA.SUPPLIER  TO "SPARQL";
+GRANT SELECT ON TPCH.DBA.CUSTOMER  TO "SPARQL";
+GRANT SELECT ON TPCH.DBA.HISTORY   TO "SPARQL";
+GRANT SELECT ON TPCH.DBA.PART      TO "SPARQL";
+GRANT SELECT ON TPCH.DBA.LINEITEM  TO "SPARQL";
+GRANT SELECT ON TPCH.DBA.ORDERS    TO "SPARQL";
+GRANT SELECT ON TPCH.DBA.NATION    TO "SPARQL";
+GRANT SELECT ON TPCH.DBA.REGION    TO "SPARQL";
+
+SPARQL
+drop quad map virtrdf:TPCH
+;
+
+SPARQL
+prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+create iri class tpch:customer "http://^{URIQADefaultHost}^/tpch/customer/%U%d#this" (in custname varchar, in c_custkey integer not null) option (bijection, deref) .
+create iri class tpch:lineitem "http://^{URIQADefaultHost}^/tpch/lineitem/%d/%d#this" (in l_orderkey integer not null, in l_linenumber integer not null) option (bijection, deref) .
+create iri class tpch:nation "http://^{URIQADefaultHost}^/tpch/nation/%U%d#this" (in name varchar, in l_nationkey integer not null) option (bijection, deref) .
+create iri class tpch:order "http://^{URIQADefaultHost}^/tpch/order/%d#this" (in o_orderkey integer not null) option (bijection, deref) .
+create iri class tpch:part "http://^{URIQADefaultHost}^/tpch/part/%U%d#this" (in p_partname varchar, in p_partkey integer not null) option (bijection, deref) .
+create iri class tpch:partsupp "http://^{URIQADefaultHost}^/tpch/partsupp/%d/%d#this" (in ps_partkey integer not null, in ps_suppkey integer not null) option (bijection, deref) .
+create iri class tpch:region "http://^{URIQADefaultHost}^/tpch/region/%U%d#this" (in name varchar, in r_regionkey integer not null) option (bijection, deref) .
+create iri class tpch:supplier "http://^{URIQADefaultHost}^/tpch/supplier/%U%d#this" (in name varchar, in s_supplierkey integer not null) option (bijection, deref) .
+;
+
+SPARQL
+prefix tpch: <http://www.openlinksw.com/schemas/tpch#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+alter quad storage virtrdf:DefaultQuadStorage
+FROM TPCH.DBA.LINEITEM as lineitems
+FROM TPCH.DBA.CUSTOMER as customers
+FROM TPCH.DBA.NATION as nations
+FROM TPCH.DBA.ORDERS as orders
+FROM TPCH.DBA.PART as parts
+FROM TPCH.DBA.PARTSUPP as partsupps
+FROM TPCH.DBA.REGION as regions
+FROM TPCH.DBA.SUPPLIER as suppliers
+where (^{suppliers.}^.S_NATIONKEY = ^{nations.}^.N_NATIONKEY)
+where (^{customers.}^.C_NATIONKEY = ^{nations.}^.N_NATIONKEY)
+{
+    create virtrdf:TPCH as graph iri ("http://^{URIQADefaultHost}^/tpch") option (exclusive)
+    {
+# Customers
+        tpch:customer (customers.C_NAME, customers.C_CUSTKEY)
+            a  tpch:customer
+                as virtrdf:customer-tpch-type ;
+            a  foaf:Organization
+                as virtrdf:customer-foaf-type ;
+            tpch:custkey customers.C_CUSTKEY
+                as virtrdf:customer-c_custkey ;
+            foaf:name customers.C_NAME
+                as virtrdf:customer-foaf_name ;
+            tpch:companyName customers.C_NAME
+                as virtrdf:customer-c_name ;
+            tpch:has_nation tpch:nation (nations.N_NAME, customers.C_NATIONKEY)
+                as virtrdf:customer-c_nationkey ;
+            tpch:address customers.C_ADDRESS
+                as virtrdf:customer-c_address ;
+            foaf:phone customers.C_PHONE
+                as virtrdf:customer-foaf_phone ;
+            tpch:phone customers.C_PHONE
+                as virtrdf:customer-phone ;
+            tpch:acctbal customers.C_ACCTBAL
+                as virtrdf:customer-acctbal ;
+            tpch:mktsegment customers.C_MKTSEGMENT
+                as virtrdf:customer-c_mktsegment ;
+            tpch:comment customers.C_COMMENT
+                as virtrdf:customer-c_comment .
+
+# Nations
+        tpch:nation (nations.N_NAME, customers.C_NATIONKEY)
+            tpch:nation_of tpch:customer (customers.C_NAME, customers.C_CUSTKEY)
+            as virtrdf:customer-nation_of .
+
+        tpch:lineitem (lineitems.L_ORDERKEY, lineitems.L_LINENUMBER)
+            a tpch:lineitem
+                as virtrdf:lineitem-lineitems ;
+            tpch:has_order tpch:order (lineitems.L_ORDERKEY)
+                as virtrdf:lineitem-l_orderkey ;
+            tpch:has_part tpch:part (parts.P_NAME, lineitems.L_PARTKEY)
+                where (^{parts.}^.P_PARTKEY = ^{lineitems.}^.L_PARTKEY)
+                as virtrdf:lineitem-l_partkey ;
+            tpch:has_supplier tpch:supplier (suppliers.S_NAME, lineitems.L_SUPPKEY)
+                where (^{suppliers.}^.S_SUPPKEY = ^{lineitems.}^.L_SUPPKEY)
+                as virtrdf:lineitem-l_suppkey ;
+            tpch:linenumber lineitems.L_LINENUMBER
+                as virtrdf:lineitem-l_linenumber ;
+            tpch:linequantity lineitems.L_QUANTITY
+                as virtrdf:lineitem-l_linequantity ;
+            tpch:lineextendedprice lineitems.L_EXTENDEDPRICE
+                as virtrdf:lineitem-l_lineextendedprice ;
+            tpch:linediscount lineitems.L_DISCOUNT
+                as virtrdf:lineitem-l_linediscount ;
+            tpch:linetax lineitems.L_TAX
+                as virtrdf:lineitem-l_linetax ;
+            tpch:returnflag lineitems.L_RETURNFLAG
+                as virtrdf:lineitem-l_returnflag ;
+            tpch:linestatus lineitems.L_LINESTATUS
+                as virtrdf:lineitem-l_linestatus ;
+            tpch:shipdate lineitems.L_SHIPDATE
+                as virtrdf:lineitem-l_shipdate ;
+            tpch:commitdate lineitems.L_COMMITDATE
+                as virtrdf:lineitem-l_commitdate ;
+            tpch:receiptdate lineitems.L_RECEIPTDATE
+                as virtrdf:lineitem-l_receiptdate ;
+            tpch:shipinstruct lineitems.L_SHIPINSTRUCT
+                as virtrdf:lineitem-l_shipinstruct ;
+            tpch:shipmode lineitems.L_SHIPMODE
+                as virtrdf:lineitem-l_shipmode ;
+            tpch:comment lineitems.L_COMMENT
+                as virtrdf:lineitem-l_comment .
+
+        tpch:part (parts.P_NAME, lineitems.L_PARTKEY)
+            tpch:part_of tpch:lineitem (lineitems.L_ORDERKEY, lineitems.L_LINENUMBER)
+            where (^{parts.}^.P_PARTKEY = ^{lineitems.}^.L_PARTKEY)
+            as virtrdf:lineitem-part_of .
+
+        tpch:order (lineitems.L_ORDERKEY)
+            tpch:order_of tpch:lineitem (lineitems.L_ORDERKEY, lineitems.L_LINENUMBER) as virtrdf:lineitem-order_of .
+
+        tpch:supplier (suppliers.S_NAME, lineitems.L_SUPPKEY)
+            tpch:supplier_of tpch:lineitem (lineitems.L_ORDERKEY, lineitems.L_LINENUMBER)
+            where (^{suppliers.}^.S_SUPPKEY = ^{lineitems.}^.L_SUPPKEY)
+            as virtrdf:lineitem-supplier_of .
+
+# Nation
+        tpch:nation (nations.N_NAME, nations.N_NATIONKEY)
+            a tpch:nation
+                as virtrdf:nation-nations ;
+            tpch:name nations.N_NAME
+                as virtrdf:nation-n_name ;
+            tpch:has_region tpch:region (regions.R_NAME, nations.N_REGIONKEY)
+                where (^{regions.}^.R_REGIONKEY = ^{nations.}^.N_REGIONKEY)
+                as virtrdf:nation-n_regionkey ;
+            tpch:comment nations.N_COMMENT
+                as virtrdf:nation-n_comment .
+
+        tpch:region (regions.R_NAME, nations.N_REGIONKEY)
+            tpch:region_of tpch:nation (nations.N_NAME, nations.N_NATIONKEY)
+            where (^{regions.}^.R_REGIONKEY = ^{nations.}^.N_REGIONKEY)
+            as virtrdf:nation-region_of .
+
+# Order
+        tpch:order (orders.O_ORDERKEY)
+            a tpch:order
+                as virtrdf:order-orders ;
+            tpch:orderkey orders.O_ORDERKEY
+                as virtrdf:order-o_orderkey ;
+            tpch:has_customer tpch:customer (customers.C_NAME, orders.O_CUSTKEY)
+                where (^{orders.}^.O_CUSTKEY = ^{customers.}^.C_CUSTKEY)
+                as virtrdf:order-o_custkey ;
+            tpch:orderstatus orders.O_ORDERSTATUS
+                as virtrdf:order-o_orderstatus ;
+            tpch:ordertotalprice orders.O_TOTALPRICE
+                as virtrdf:order-o_totalprice ;
+            tpch:orderdate orders.O_ORDERDATE
+                as virtrdf:order-o_orderdate ;
+            tpch:orderpriority orders.O_ORDERPRIORITY
+                as virtrdf:order-o_orderpriority ;
+            tpch:clerk orders.O_CLERK
+                as virtrdf:order-o_clerk ;
+            tpch:shippriority orders.O_SHIPPRIORITY
+                as virtrdf:order-o_shippriority ;
+            tpch:comment orders.O_COMMENT
+                as virtrdf:order-o_comment .
+
+        tpch:customer (customers.C_CUSTKEY, orders.O_CUSTKEY)
+            tpch:customer_of tpch:order (orders.O_ORDERKEY)
+            where (^{orders.}^.O_CUSTKEY = ^{customers.}^.C_CUSTKEY)
+            as virtrdf:order-customer_of .
+
+# Part
+        tpch:part (parts.P_NAME, parts.P_PARTKEY)
+            a tpch:part
+                as virtrdf:part-parts ;
+            tpch:partkey parts.P_PARTKEY
+                as virtrdf:part-p_partkey ;
+            tpch:name parts.P_NAME
+                as virtrdf:part-p_name ;
+            tpch:mfgr parts.P_MFGR
+                as virtrdf:part-p_mfgr ;
+            tpch:brand parts.P_BRAND
+                as virtrdf:part-p_brand ;
+            tpch:type parts.P_TYPE
+                as virtrdf:part-p_type ;
+            tpch:size parts.P_SIZE
+                as virtrdf:part-p_size ;
+            tpch:container parts.P_CONTAINER
+                as virtrdf:part-p_container ;
+            tpch:comment parts.P_COMMENT
+                as virtrdf:part-p_comment .
+
+# Partsupp
+        tpch:partsupp (partsupps.PS_PARTKEY, partsupps.PS_SUPPKEY)
+            a tpch:partsupp
+                as virtrdf:partsupp-partsupps ;
+            tpch:has_part tpch:part (parts.P_NAME, partsupps.PS_PARTKEY)
+                where (^{parts.}^.P_PARTKEY = ^{partsupps.}^.PS_PARTKEY)
+                as virtrdf:partsupp-ps_partkey ;
+            tpch:has_supplier tpch:supplier (suppliers.S_NAME, partsupps.PS_SUPPKEY)
+                where (^{suppliers.}^.S_SUPPKEY = ^{partsupps.}^.PS_SUPPKEY)
+                as virtrdf:partsupp-ps_suppkey ;
+            tpch:availqty partsupps.PS_AVAILQTY
+                as virtrdf:partsupp-ps_availqty ;
+            tpch:supplycost partsupps.PS_SUPPLYCOST
+                as virtrdf:partsupp-ps_supplycost ;
+            tpch:comment partsupps.PS_COMMENT
+                as virtrdf:partsupp-ps_comment .
+
+        tpch:part (parts.P_NAME, partsupps.PS_PARTKEY)
+            tpch:part_of tpch:partsupp (partsupps.PS_PARTKEY, partsupps.PS_SUPPKEY)
+            where (^{parts.}^.P_PARTKEY = ^{partsupps.}^.PS_PARTKEY)
+            as virtrdf:partsupp-part_of .
+
+        tpch:supplier (suppliers.S_NAME, partsupps.PS_SUPPKEY)
+            tpch:supplier_of tpch:partsupp (partsupps.PS_PARTKEY, partsupps.PS_SUPPKEY)
+            where (^{suppliers.}^.S_SUPPKEY = ^{partsupps.}^.PS_SUPPKEY)
+            as virtrdf:partsupp-supplier_of .
+
+# Region
+        tpch:region (regions.R_NAME, regions.R_REGIONKEY)
+            a tpch:region
+                as virtrdf:region-regions ;
+            tpch:name regions.R_NAME
+                as virtrdf:region-r_name ;
+            tpch:comment regions.R_COMMENT
+                as virtrdf:region-r_comment .
+
+# Supplier
+        tpch:supplier (suppliers.S_NAME, suppliers.S_SUPPKEY)
+            a tpch:supplier
+                as virtrdf:supplier-suppliers ;
+            tpch:name suppliers.S_NAME
+                as virtrdf:supplier-s_name ;
+            tpch:address suppliers.S_ADDRESS
+                as virtrdf:supplier-s_address ;
+            tpch:has_nation tpch:nation (nations.N_NAME, suppliers.S_NATIONKEY)
+                where (^{nations.}^.N_NATIONKEY = ^{suppliers.}^.S_NATIONKEY)
+                as virtrdf:supplier-s_nationkey ;
+            foaf:phone suppliers.S_PHONE
+                as virtrdf:supplier-foaf_phone ;
+            tpch:phone suppliers.S_PHONE
+                as virtrdf:supplier-s_phone ;
+            tpch:acctbal suppliers.S_ACCTBAL
+                as virtrdf:supplier-s_acctbal ;
+            tpch:comment suppliers.S_COMMENT
+                as virtrdf:supplier-s_comment .
+
+        tpch:nation (nations.N_NAME, suppliers.S_NATIONKEY)
+            tpch:nation_of tpch:supplier (suppliers.S_NAME, suppliers.S_SUPPKEY)
+            where (^{nations.}^.N_NATIONKEY = ^{suppliers.}^.S_NATIONKEY)
+            as virtrdf:supplier-nation_of .
+    } .
+} .
+;
+
+DELETE FROM db.dba.url_rewrite_rule_list WHERE urrl_list like 'tpch_rule%';
+DELETE FROM db.dba.url_rewrite_rule WHERE urr_rule like 'tpch_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'tpch_rule2',
+    1,
+    '([^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/tpch%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'tpch_rule1',
+    1,
+    '([^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s%%23this',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'tpch_rule3',
+    1,
+    '(/[^#]*)/\x24',
+    vector('path'),
+    1,
+    '%s',
+    vector('path'),
+    null,
+    null,
+    0,
+    null
+    );
+
+create procedure DB.DBA.REMOVE_TPCH_RDF_DET()
+{
+  declare colid int;
+  colid := DAV_SEARCH_ID('/DAV/home/demo/tpch', 'C');
+  if (colid < 0)
+    return;
+  update WS.WS.SYS_DAV_COL set COL_DET=null where COL_ID = colid;
+}
+;
+
+DB.DBA.REMOVE_TPCH_RDF_DET();
+
+drop procedure DB.DBA.REMOVE_TPCH_RDF_DET;
+
+create procedure DB.DBA.TPCH_MAKE_RDF_DET()
+{
+    declare uriqa_str varchar;
+    uriqa_str := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+    uriqa_str := 'http://' || uriqa_str || '/tpch';
+    DB.DBA."RDFData_MAKE_DET_COL" ('/DAV/home/demo/tpch/RDFData/', uriqa_str, NULL);
+    VHOST_REMOVE (lpath=>'/tpch/data/rdf');
+    DB.DBA.VHOST_DEFINE (lpath=>'/tpch/data/rdf', ppath=>'/DAV/home/demo/tpch/RDFData/All/', is_dav=>1, vsp_user=>'dba');
+}
+;
+
+DB.DBA.TPCH_MAKE_RDF_DET();
+
+drop procedure DB.DBA.TPCH_MAKE_RDF_DET;
+
+create procedure DB.DBA.TPCH_DET_REF (in par varchar, in fmt varchar, in val varchar)
+{
+  declare res, iri any;
+  declare uriqa_str varchar;
+  uriqa_str := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+  uriqa_str := 'http://' || uriqa_str || '/tpch';
+  iri := uriqa_str || val;
+  res := sprintf ('iid (%d).rdf', iri_id_num (iri_to_id (iri)));
+  return sprintf (fmt, res);
+}
+;
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('tpch_rdf', 1,
+    '/tpch/(.*)', vector('path'), 1,
+    '/tpch/data/rdf/%U', vector('path'),
+    'DB.DBA.TPCH_DET_REF',
+    'application/rdf.xml',
+    2,
+    303);
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'tpch_rule_list1',
+    1,
+    vector (
+                'tpch_rule1',
+                'tpch_rule2',
+                'tpch_rule3',
+                'tpch_rdf'
+          ));
+
+DB.DBA.VHOST_REMOVE (lpath=>'/tpch');
+DB.DBA.VHOST_DEFINE (lpath=>'/tpch', ppath=>'/DAV/home/demo/tpch/', vsp_user=>'dba', is_dav=>1,
+          is_brws=>0, opts=>vector ('url_rewrite', 'tpch_rule_list1'));
+
+
+DB.DBA.VHOST_REMOVE (lpath=>'/tpch/linkeddata');
+DB.DBA.VHOST_DEFINE (lpath=>'/tpch/linkeddata', ppath=>'/DAV/home/demo/tpch/', vsp_user=>'dba', is_dav=>1,
+          is_brws=>1);
+]]></programlisting>
+</sect2>
+<sect2 id="rdfviewsbusinttpcd">
+      <title>TPCD to RDF</title>
+<para>Please load ~\binsrc\dav\DET_RDFData.sql before loadding this script (tpc-d has no vad to do this automatic)</para>
+<programlisting><![CDATA[
+use DB;
+
+create procedure DB.DBA.exec_no_error (in expr varchar) {
+  declare state, message, meta, result any;
+  exec(expr, state, message, vector(), 0, meta, result);
+}
+;
+
+DB.DBA.exec_no_error('GRANT \"SPARQL_UPDATE\" TO \"SPARQL\"')
+;
+GRANT SELECT ON tpcd.DBA.partsupp  TO "SPARQL";
+GRANT SELECT ON tpcd.DBA.supplier  TO "SPARQL";
+GRANT SELECT ON tpcd.DBA.customer  TO "SPARQL";
+GRANT SELECT ON tpcd.DBA.history   TO "SPARQL";
+GRANT SELECT ON tpcd.DBA.part      TO "SPARQL";
+GRANT SELECT ON tpcd.DBA.lineitem  TO "SPARQL";
+GRANT SELECT ON tpcd.DBA.orders    TO "SPARQL";
+GRANT SELECT ON tpcd.DBA.nation    TO "SPARQL";
+GRANT SELECT ON tpcd.DBA.region    TO "SPARQL";
+
+--SPARQL
+--prefix tpcd: <http://demo.openlinksw.com/schemas/tpcd#>
+--prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+--prefix sioc: <http://rdfs.org/sioc/ns#>
+--prefix foaf: <http://xmlns.com/foaf/0.1/>
+--prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+--drop quad map graph iri("http://^{URIQADefaultHost}^/tpcd") .
+--;
+
+SPARQL
+prefix tpcd: <http://demo.openlinksw.com/schemas/tpcd#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+drop silent quad map virtrdf:TpcdDemo .
+;
+
+SPARQL
+prefix tpcd: <http://demo.openlinksw.com/schemas/tpcd#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+create iri class tpcd:customer "http://^{URIQADefaultHost}^/tpcd/customer/%d#this" (in c_custkey integer not null) .
+create iri class tpcd:lineitem "http://^{URIQADefaultHost}^/tpcd/lineitem/%d/%d#this" (in l_orderkey integer not null, in l_linenumber integer not null) .
+create iri class tpcd:nation "http://^{URIQADefaultHost}^/tpcd/nation/%d#this" (in l_nationkey integer not null) .
+create iri class tpcd:order "http://^{URIQADefaultHost}^/tpcd/order/%d#this" (in o_orderkey integer not null) .
+create iri class tpcd:part "http://^{URIQADefaultHost}^/tpcd/part/%d#this" (in p_partkey integer not null) .
+create iri class tpcd:partsupp "http://^{URIQADefaultHost}^/tpcd/partsupp/%d/%d#this" (in ps_partkey integer not null, in ps_suppkey integer not null) .
+create iri class tpcd:region "http://^{URIQADefaultHost}^/tpcd/region/%d#this" (in r_regionkey integer not null) .
+create iri class tpcd:supplier "http://^{URIQADefaultHost}^/tpcd/supplier/%d#this" (in s_supplierkey integer not null) .
+;
+
+SPARQL
+prefix tpcd: <http://demo.openlinksw.com/schemas/tpcd#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+alter quad storage virtrdf:DefaultQuadStorage
+from tpcd.DBA.lineitem as lineitems
+from tpcd.DBA.customer as customers
+from tpcd.DBA.nation as nations
+from tpcd.DBA.orders as orders
+from tpcd.DBA.part as parts
+from tpcd.DBA.partsupp as partsupps
+from tpcd.DBA.region as regions
+from tpcd.DBA.supplier as suppliers
+where (^{suppliers.}^.s_nationkey = ^{nations.}^.n_nationkey)
+where (^{customers.}^.c_nationkey = ^{nations.}^.n_nationkey)
+{
+    create virtrdf:TpcdDemo as graph iri ("http://^{URIQADefaultHost}^/tpcd") option (exclusive)
+    {
+# Customers
+        tpcd:customer (customers.c_custkey)
+            a  tpcd:customer
+                as virtrdf:tpcdcustomer-type ;
+            a  foaf:Organization
+                as virtrdf:tpcdcustomer-foaf-type ;
+            tpcd:custkey customers.c_custkey
+                as virtrdf:tpcdcustomer-c_custkey ;
+            foaf:name customers.c_name
+                as virtrdf:tpcdcustomer-foaf_name ;
+            tpcd:companyName customers.c_name
+                as virtrdf:tpcdcustomer-c_name ;
+            tpcd:has_nation tpcd:nation (customers.c_nationkey)
+                as virtrdf:tpcdcustomer-c_nationkey ;
+            tpcd:address customers.c_address
+                as virtrdf:tpcdcustomer-c_address ;
+            foaf:phone customers.c_phone
+                as virtrdf:tpcdcustomer-foaf_phone ;
+            tpcd:phone customers.c_phone
+                as virtrdf:tpcdcustomer-phone ;
+            tpcd:acctbal customers.c_acctbal
+                as virtrdf:tpcdcustomer-acctbal ;
+            tpcd:mktsegment customers.c_mktsegment
+                as virtrdf:tpcdcustomer-c_mktsegment ;
+            tpcd:comment customers.c_comment
+                as virtrdf:tpcdcustomer-c_comment .
+
+# Nations
+        tpcd:nation (customers.c_nationkey)
+            tpcd:nation_of tpcd:customer (customers.c_custkey) as virtrdf:tpcdcustomer-nation_of .
+
+# Lineitems
+        tpcd:lineitem (lineitems.l_orderkey, lineitems.l_linenumber)
+            a tpcd:lineitem
+                as virtrdf:tpcdlineitem-lineitems ;
+            tpcd:has_order tpcd:order (lineitems.l_orderkey)
+                as virtrdf:tpcdlineitem-l_orderkey ;
+            tpcd:has_part tpcd:part (lineitems.l_partkey)
+                as virtrdf:tpcdlineitem-l_partkey ;
+            tpcd:has_supplier tpcd:supplier (lineitems.l_suppkey)
+                as virtrdf:tpcdlineitem-l_suppkey ;
+            tpcd:linenumber lineitems.l_linenumber
+                as virtrdf:tpcdlineitem-l_linenumber ;
+            tpcd:linequantity lineitems.l_quantity
+                as virtrdf:tpcdlineitem-l_linequantity ;
+            tpcd:lineextendedprice lineitems.l_extendedprice
+                as virtrdf:tpcdlineitem-l_lineextendedprice ;
+            tpcd:linediscount lineitems.l_discount
+                as virtrdf:tpcdlineitem-l_linediscount ;
+            tpcd:linetax lineitems.l_tax
+                as virtrdf:tpcdlineitem-l_linetax ;
+            tpcd:returnflag lineitems.l_returnflag
+                as virtrdf:tpcdlineitem-l_returnflag ;
+            tpcd:linestatus lineitems.l_linestatus
+                as virtrdf:tpcdlineitem-l_linestatus ;
+            tpcd:shipdate lineitems.l_shipdate
+                as virtrdf:tpcdlineitem-l_shipdate ;
+            tpcd:commitdate lineitems.l_commitdate
+                as virtrdf:tpcdlineitem-l_commitdate ;
+            tpcd:receiptdate lineitems.l_receiptdate
+                as virtrdf:tpcdlineitem-l_receiptdate ;
+            tpcd:shipinstruct lineitems.l_shipinstruct
+                as virtrdf:tpcdlineitem-l_shipinstruct ;
+            tpcd:shipmode lineitems.l_shipmode
+                as virtrdf:tpcdlineitem-l_shipmode ;
+            tpcd:comment lineitems.l_comment
+                as virtrdf:tpcdlineitem-l_comment .
+
+        tpcd:part (lineitems.l_partkey)
+            tpcd:part_of tpcd:lineitem (lineitems.l_orderkey, lineitems.l_linenumber) as virtrdf:tpcdlineitem-part_of .
+
+        tpcd:order (lineitems.l_orderkey)
+            tpcd:order_of tpcd:lineitem (lineitems.l_orderkey, lineitems.l_linenumber) as virtrdf:tpcdlineitem-order_of .
+
+        tpcd:supplier (lineitems.l_suppkey)
+            tpcd:supplier_of tpcd:lineitem (lineitems.l_orderkey, lineitems.l_linenumber) as virtrdf:tpcdlineitem-supplier_of .
+
+# Nation
+        tpcd:nation (nations.n_nationkey)
+            a tpcd:nation
+                as virtrdf:tpcdnation-nations ;
+            tpcd:name nations.n_name
+                as virtrdf:tpcdnation-n_name ;
+            tpcd:has_region tpcd:region (nations.n_regionkey)
+                as virtrdf:tpcdnation-n_regionkey ;
+            tpcd:comment nations.n_comment
+                as virtrdf:tpcdnation-n_comment .
+
+        tpcd:region (nations.n_regionkey)
+            tpcd:region_of tpcd:nation (nations.n_nationkey) as virtrdf:tpcdnation-region_of .
+
+# Order
+        tpcd:order (orders.o_orderkey)
+            a tpcd:order
+                as virtrdf:tpcdorder-orders ;
+            tpcd:orderkey orders.o_orderkey
+                as virtrdf:tpcdorder-o_orderkey ;
+            tpcd:has_customer tpcd:customer (orders.o_custkey)
+                as virtrdf:tpcdorder-o_custkey ;
+            tpcd:orderstatus orders.o_orderstatus
+                as virtrdf:tpcdorder-o_orderstatus ;
+            tpcd:ordertotalprice orders.o_totalprice
+                as virtrdf:tpcdorder-o_totalprice ;
+            tpcd:orderdate orders.o_orderdate
+                as virtrdf:tpcdorder-o_orderdate ;
+            tpcd:orderpriority orders.o_orderpriority
+                as virtrdf:tpcdorder-o_orderpriority ;
+            tpcd:clerk orders.o_clerk
+                as virtrdf:tpcdorder-o_clerk ;
+            tpcd:shippriority orders.o_shippriority
+                as virtrdf:tpcdorder-o_shippriority ;
+            tpcd:comment orders.o_comment
+                as virtrdf:tpcdorder-o_comment .
+
+        tpcd:customer (orders.o_custkey)
+            tpcd:customer_of tpcd:order (orders.o_orderkey) as virtrdf:tpcdorder-customer_of .
+
+# Part
+        tpcd:part (parts.p_partkey)
+            a tpcd:part
+                as virtrdf:tpcdpart-parts ;
+            tpcd:partkey parts.p_partkey
+                as virtrdf:tpcdpart-p_partkey ;
+            tpcd:name parts.p_name
+                as virtrdf:tpcdpart-p_name ;
+            tpcd:mfgr parts.p_mfgr
+                as virtrdf:tpcdpart-p_mfgr ;
+            tpcd:brand parts.p_brand
+                as virtrdf:tpcdpart-p_brand ;
+            tpcd:type parts.p_type
+                as virtrdf:tpcdpart-p_type ;
+            tpcd:size parts.p_size
+                as virtrdf:tpcdpart-p_size ;
+            tpcd:container parts.p_container
+                as virtrdf:tpcdpart-p_container ;
+            tpcd:comment parts.p_comment
+                as virtrdf:tpcdpart-p_comment .
+
+# Partsupp
+        tpcd:partsupp (partsupps.ps_partkey, partsupps.ps_suppkey)
+            a tpcd:partsupp
+                as virtrdf:tpcdpartsupp-partsupps ;
+            tpcd:has_part tpcd:part (partsupps.ps_partkey)
+                as virtrdf:tpcdpartsupp-ps_partkey ;
+            tpcd:has_supplier tpcd:supplier (partsupps.ps_suppkey)
+                as virtrdf:tpcdpartsupp-ps_suppkey ;
+            tpcd:availqty partsupps.ps_availqty
+                as virtrdf:tpcdpartsupp-ps_availqty ;
+            tpcd:supplycost partsupps.ps_supplycost
+                as virtrdf:tpcdpartsupp-ps_supplycost ;
+            tpcd:comment partsupps.ps_comment
+                as virtrdf:tpcdpartsupp-ps_comment .
+
+        tpcd:part (partsupps.ps_partkey)
+            tpcd:part_of tpcd:partsupp (partsupps.ps_partkey, partsupps.ps_suppkey) as virtrdf:tpcdpartsupp-part_of .
+
+        tpcd:supplier (partsupps.ps_suppkey)
+            tpcd:supplier_of tpcd:partsupp (partsupps.ps_partkey, partsupps.ps_suppkey) as virtrdf:tpcdpartsupp-supplier_of .
+
+# Region
+        tpcd:region (regions.r_regionkey)
+            a tpcd:region
+                as virtrdf:tpcdregion-regions ;
+            tpcd:name regions.r_name
+                as virtrdf:tpcdregion-r_name ;
+            tpcd:comment regions.r_comment
+                as virtrdf:tpcdregion-r_comment .
+
+# Supplier
+        tpcd:supplier (suppliers.s_suppkey)
+            a tpcd:supplier
+                as virtrdf:tpcdsupplier-suppliers ;
+            tpcd:name suppliers.s_name
+                as virtrdf:tpcdsupplier-s_name ;
+            tpcd:address suppliers.s_address
+                as virtrdf:tpcdsupplier-s_address ;
+            tpcd:has_nation tpcd:nation (suppliers.s_nationkey)
+                as virtrdf:tpcdsupplier-s_nationkey ;
+            foaf:phone suppliers.s_phone
+                as virtrdf:tpcdsupplier-foaf_phone ;
+            tpcd:phone suppliers.s_phone
+                as virtrdf:tpcdsupplier-s_phone ;
+            tpcd:acctbal suppliers.s_acctbal
+                as virtrdf:tpcdsupplier-s_acctbal ;
+            tpcd:comment suppliers.s_comment
+                as virtrdf:tpcdsupplier-s_comment .
+
+        tpcd:nation (suppliers.s_nationkey)
+            tpcd:nation_of tpcd:supplier (suppliers.s_suppkey) as virtrdf:tpcdsupplier-nation_of .
+    }
+}
+;
+
+create procedure tcpd_rdf_doc (in path varchar)
+{
+  declare r any;
+  r := regexp_match ('[^/]*\x24', path);
+  return r||'#this';
+};
+
+create procedure tcpd_html_doc (in path varchar)
+{
+  declare r any;
+  r := regexp_match ('[^/]*#', path);
+  return subseq (r, 0, length (r)-1);
+};
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'tcpd_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/tpcd%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'tcpd_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/rdfbrowser/index.html?uri=http%%3A//^{URIQADefaultHost}^%U%%23this',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'tcpd_rule3',
+    1,
+    '(/[^#]*)/\x24',
+    vector('path'),
+    1,
+    '%s',
+    vector('path'),
+    null,
+    null,
+    0,
+    null
+    );
+
+DB.DBA."RDFData_MAKE_DET_COL" ('/DAV/home/tpcd/RDFData/', 'http://^{URIQADefaultHost}^/tpcd', NULL);
+VHOST_REMOVE (lpath=>'/tpcd/data/rdf');
+DB.DBA.VHOST_DEFINE (lpath=>'/tpcd/data/rdf', ppath=>'/DAV/home/tpcd/RDFData/All/', is_dav=>1, vsp_user=>'dba');
+
+-- procedure to convert path to DET resource name
+create procedure DB.DBA.TPCD_DET_REF (in par varchar, in fmt varchar, in val varchar)
+{
+  declare res, iri any;
+  iri := 'http://^{URIQADefaultHost}^/tpcd' || val;
+  res := sprintf ('iid (%d).rdf', iri_id_num (iri_to_id (iri)));
+  return sprintf (fmt, res);
+}
+;
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('tpcd_rdf', 1,
+    '/tpcd/(.*)', vector('path'), 1,
+    '/tpcd/data/rdf/%U', vector('path'),
+    'DB.DBA.TPCD_DET_REF',
+    'application/rdf.xml',
+    2,
+    303);
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'tpcd_rule_list1',
+    1,
+    vector (
+                'tcpd_rule1',
+                'tcpd_rule2',
+                'tcpd_rule3',
+                'tpcd_rdf'
+          ));
+
+
+VHOST_REMOVE (lpath=>'/tpcd');
+DB.DBA.VHOST_DEFINE (lpath=>'/tpcd', ppath=>'/DAV/home/', vsp_user=>'dba', is_dav=>1, def_page=>'sfront.vspx',
+    is_brws=>0, opts=>vector ('url_rewrite', 'tpcd_rule_list1'));
+
+create procedure DB.DBA.LOAD_TPCD_ONTOLOGY_FROM_DAV()
+{
+	declare content, urihost varchar;
+	select cast (RES_CONTENT as varchar) into content from WS.WS.SYS_DAV_RES where RES_FULL_PATH = '/DAV/VAD/tpcd/tpcd.owl';
+	DB.DBA.RDF_LOAD_RDFXML (content, 'http://demo.openlinksw.com/schemas/tpcd#', 'http://demo.openlinksw.com/schemas/TPCDOntology/1.0/');
+	urihost := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+	if (urihost = 'demo.openlinksw.com')
+	{
+		DB.DBA.VHOST_REMOVE (lpath=>'/schemas/tpcd');
+		DB.DBA.VHOST_DEFINE (lpath=>'/schemas/tpcd', ppath=>'/DAV/VAD/tpcd/tpcd.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
+	}
+}
+;
+DB.DBA.LOAD_TPCD_ONTOLOGY_FROM_DAV()
+;
+drop procedure DB.DBA.LOAD_TPCD_ONTOLOGY_FROM_DAV
+;
+
+XML_SET_NS_DECL ('virt-tpcd', 'http://demo.openlinksw.com/schemas/tpcd#', 2)
+;
+
+]]></programlisting>
+</sect2>
+<sect2 id="rdfviewsbusintthalia">
+      <title>Thalia to RDF</title>
+<programlisting><![CDATA[
+
+use DB
+;
+
+SPARQL drop quad map virtrdf:ThaliaDemo
+;
+
+create procedure DB.DBA.SPARQL_THALIA_RUN (in txt varchar)
+{
+  declare REPORT, stat, msg, sqltext varchar;
+  declare metas, rowset any;
+  result_names (REPORT);
+  sqltext := string_output_string (sparql_to_sql_text (txt));
+  stat := '00000';
+  msg := '';
+  rowset := null;
+  exec (sqltext, stat, msg, vector (), 1000, metas, rowset);
+}
+;
+
+create procedure DB.DBA.exec_no_error(in expr varchar)
+{
+	declare state, message, meta, result any;
+	exec(expr, state, message, vector(), 0, meta, result);
+}
+;
+
+DB.DBA.exec_no_error('drop View thalia.Demo.asu_v');
+DB.DBA.exec_no_error('create View thalia.Demo.asu_v as select left(Title,3) code,* from thalia.Demo.asu');
+DB.DBA.exec_no_error('drop View thalia.Demo.gatech_v');
+DB.DBA.exec_no_error('create View thalia.Demo.gatech_v as select *, Room||\' \'||Building Place from thalia.Demo.gatech');
+DB.DBA.SPARQL_THALIA_RUN('drop quad map graph iri("http://^{URIQADefaultHost}^/Thalia") .
+')
+;
+
+GRANT SELECT ON thalia.Demo.asu TO "SPARQL"
+;
+GRANT SELECT ON thalia.Demo.asu_v TO "SPARQL"
+;
+GRANT SELECT ON thalia.Demo.brown TO "SPARQL"
+;
+GRANT SELECT ON thalia.Demo.cmu TO "SPARQL"
+;
+GRANT SELECT ON thalia.Demo.gatech TO "SPARQL"
+;
+GRANT SELECT ON thalia.Demo.gatech_v TO "SPARQL"
+;
+GRANT SELECT ON thalia.Demo.toronto TO "SPARQL"
+;
+GRANT SELECT ON thalia.Demo.ucsd TO "SPARQL"
+;
+GRANT SELECT ON thalia.Demo.umd TO "SPARQL"
+;
+
+DB.DBA.SPARQL_THALIA_RUN('drop quad map graph iri("http://^{URIQADefaultHost}^/thalia") .
+');
+
+DB.DBA.SPARQL_THALIA_RUN('drop quad map virtrdf:ThaliaDemo .
+');
+
+
+DB.DBA.SPARQL_THALIA_RUN('
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix xsd: <http://www.w3.org/2001/XMLSchema#>
+prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+prefix dc: <http://purl.org/dc/elements/1.1/>
+prefix time: <http://www.w3.org/2006/time#>
+prefix event: <http://purl.org/NET/c4dm/event.owl#>
+prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix skos: <http://www.w3.org/2004/02/skos/core#>
+prefix th: <http://demo.openlinksw.com/schemas/thalia#>
+
+create iri class th:Asu "http://^{URIQADefaultHost}^/thalia/asu/course/%U#this" (in code varchar not null) .
+create iri class th:Brown "http://^{URIQADefaultHost}^/thalia/brown/course/%U#this" (in Code varchar not null) .
+create iri class th:BrownInstructor "http://^{URIQADefaultHost}^/thalia/brown/instructor/%U#this" (in Code varchar not null) .
+create iri class th:BrownLecture "http://^{URIQADefaultHost}^/thalia/brown/lecture/%U#this" (in Code varchar not null) .
+create iri class th:BrownPlace "http://^{URIQADefaultHost}^/thalia/brown/place/%U#this" (in Code varchar not null) .
+
+create iri class th:Cmu "http://^{URIQADefaultHost}^/thalia/cmu/course/%U/%U#this" (in Code varchar not null, in Sec varchar) .
+create iri class th:CmuInstructor "http://^{URIQADefaultHost}^/thalia/cmu/instructor/%U/%U#this" (in Code varchar not null, in Sec varchar) .
+create iri class th:CmuLecture "http://^{URIQADefaultHost}^/thalia/cmu/lecture/%U/%U#this" (in Code varchar not null, in Sec varchar) .
+create iri class th:CmuPlace "http://^{URIQADefaultHost}^/thalia/cmu/place/%U/%U#this" (in Code varchar not null, in Sec varchar) .
+create iri class th:CmuEventTime "http://^{URIQADefaultHost}^/thalia/cmu/eventtime/%U/%U#this" (in Code varchar not null, in Sec varchar) .
+create iri class th:CmuDatetime "http://^{URIQADefaultHost}^/thalia/cmu/datetime/%U/%U#this" (in Code varchar not null, in Sec varchar) .
+
+create iri class th:Gatech "http://^{URIQADefaultHost}^/thalia/gatech/course/%U/%d/%U#this" (in Department varchar, in Code integer, in Section varchar) .
+create iri class th:GatechInstructor "http://^{URIQADefaultHost}^/thalia/gatech/instructor/%U/%d/%U#this" (in Department varchar, in Code integer, in Section varchar) .
+create iri class th:GatechLecture "http://^{URIQADefaultHost}^/thalia/gatech/lecture/%U/%d/%U#this" (in Department varchar, in Code integer, in Section varchar) .
+create iri class th:GatechEventTime "http://^{URIQADefaultHost}^/thalia/gatech/eventtime/%U/%d/%U#this" (in Department varchar, in Code integer, in Section varchar) .
+create iri class th:GatechDatetime "http://^{URIQADefaultHost}^/thalia/gatech/datetime/%U/%d/%U#this" (in Department varchar, in Code integer, in Section varchar) .
+create iri class th:GatechPlace "http://^{URIQADefaultHost}^/thalia/gatech/place/%U/%d/%U#this" (in Department varchar, in Code integer, in Section varchar) .
+
+create iri class th:Toronto "http://^{URIQADefaultHost}^/thalia/toronto/course/%U#this" (in No_ varchar) .
+create iri class th:TorontoInstructor "http://^{URIQADefaultHost}^/thalia/toronto/instructor/%U#this" (in No_ varchar) .
+create iri class th:TorontoLecture "http://^{URIQADefaultHost}^/thalia/toronto/lecture/%U#this" (in No_ varchar) .
+create iri class th:TorontoPlace "http://^{URIQADefaultHost}^/thalia/toronto/place/%U#this" (in No_ varchar) .
+
+create iri class th:Ucsd "http://^{URIQADefaultHost}^/thalia/ucsd/course/%U#this" (in Number varchar) .
+create iri class th:UcsdInstructor1 "http://^{URIQADefaultHost}^/thalia/ucsd/instructor1/%U#this" (in Number varchar) .
+create iri class th:UcsdInstructor2 "http://^{URIQADefaultHost}^/thalia/ucsd/instructor2/%U#this" (in Number varchar) .
+create iri class th:UcsdInstructor3 "http://^{URIQADefaultHost}^/thalia/ucsd/instructor3/%U#this" (in Number varchar) .
+
+create iri class th:Umd "http://^{URIQADefaultHost}^/thalia/umd/course/%U#this" (in Code varchar) .
+create iri class th:UmdLecture "http://^{URIQADefaultHost}^/thalia/umd/lecture/%U#this" (in Code varchar) .
+create iri class th:UmdEventTime "http://^{URIQADefaultHost}^/thalia/umd/eventtime/%U#this" (in Code varchar) .
+create iri class th:UmdDatetime "http://^{URIQADefaultHost}^/thalia/umd/datetime/%U#this" (in Code varchar) .
+')
+;
+
+DB.DBA.SPARQL_THALIA_RUN('prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix xsd: <http://www.w3.org/2001/XMLSchema#>
+prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+prefix dc: <http://purl.org/dc/elements/1.1/>
+prefix time: <http://www.w3.org/2006/time#>
+prefix event: <http://purl.org/NET/c4dm/event.owl#>
+prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix skos: <http://www.w3.org/2004/02/skos/core#>
+prefix th: <http://demo.openlinksw.com/schemas/thalia#>
+alter quad storage virtrdf:DefaultQuadStorage
+from thalia.demo.asu_v as asus
+from thalia.demo.brown as browns
+from thalia.demo.cmu as cmus
+from thalia.demo.gatech_v as gatechs
+from thalia.demo.toronto as torontos
+from thalia.demo.ucsd as ucsds
+from thalia.demo.umd as umds
+{
+        create virtrdf:ThaliaDemo as graph iri ("http://^{URIQADefaultHost}^/thalia") option (exclusive)
+        {
+                th:Asu (asus.code)
+                    a th:Course
+                        as virtrdf:Asu-Course ;
+                    dc:title asus.Title
+                        as virtrdf:Asu-Title ;
+                    dc:description asus.Description
+                        as virtrdf:Asu-Description ;
+                    rdfs:seeAlso asus.MoreInfoURL
+                        as virtrdf:Asu-MoreInfoURL ;
+                        th:forUniversity "http://purl.org/thalia/university/asu/university/asu"
+                            as virtrdf:Asu-University ;
+                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
+                            as virtrdf:Asu-Subject
+                            .
+
+                th:Brown (browns.Code)
+                        a th:Course
+                                as virtrdf:Brown-Course ;
+                        dc:title browns.Title
+                            as virtrdf:Brown-Title ;
+                        th:hasInstructor th:BrownInstructor (browns.Code)
+                            as virtrdf:Brown-hasInstructor ;
+                        th:hasLecture th:BrownLecture(browns.Code)
+                            as virtrdf:Brown-hasLecture ;
+                        th:forUniversity "http://purl.org/thalia/university/brown"
+                            as virtrdf:Brown-University ;
+                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
+                            as virtrdf:Brown-Subject
+                            .
+                th:BrownInstructor (browns.Code)
+                        a th:Instructor
+                                as virtrdf:Brown-Instructor ;
+                        dc:homepage browns.Instructor
+                            as virtrdf:Brown-Instructor-Homepage
+                            .
+                th:BrownLecture (browns.Code)
+                        a event:Event
+                                as virtrdf:Brown-Lecture ;
+                        event:place th:BrownPlace(browns.Code)
+                            as virtrdf:Brown-hasPlace
+                            .
+                th:BrownPlace (browns.Code)
+                        a geo:Point
+                                as virtrdf:Brown-Place;
+                        dc:title browns.Room
+                            as virtrdf:Brown-Room
+                            .
+
+                th:Cmu (cmus.Code, cmus.Sec)
+                    a th:Course
+                        as virtrdf:Cmu-Course ;
+                    dc:title cmus.CourseTitle
+                        as virtrdf:Cmu-CourseTitle ;
+                        th:hasInstructor th:CmuInstructor (cmus.Code, cmus.Sec)
+                            as virtrdf:Cmu-hasInstructor ;
+                        th:hasLecture th:CmuLecture(cmus.Code, cmus.Sec)
+                            as virtrdf:Cmu-hasLecture ;
+                        th:hasUnits cmus.Units
+                            as virtrdf:Cmu-hasUnits ;
+                        th:forUniversity "http://purl.org/thalia/university/cmu"
+                            as virtrdf:Cmu-University ;
+                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
+                            as virtrdf:Cmu-Subject
+                        .
+        th:CmuInstructor (cmus.Code, cmus.Sec)
+                        a th:Instructor
+                                as virtrdf:Cmu-Instructor ;
+                    foaf:name cmus.Lecturer
+                        as virtrdf:Cmu-Lecturer
+                            .
+        th:CmuLecture (cmus.Code, cmus.Sec)
+                        a event:Event
+                                as virtrdf:Cmu-Lecture ;
+                        event:time th:CmuEventTime(cmus.Code, cmus.Sec)
+                            as virtrdf:Cmu-hasEventTime ;
+                        event:place th:CmuPlace(cmus.Code, cmus.Sec)
+                            as virtrdf:Cmu-hasPlace
+                            .
+        th:CmuPlace (cmus.Code, cmus.Sec)
+                        a geo:Point
+                                as virtrdf:Cmu-Place;
+                        dc:title cmus.Room
+                            as virtrdf:Cmu-Room
+                            .
+        th:CmuEventTime (cmus.Code, cmus.Sec)
+                        a time:Interval
+                                as virtrdf:Cmu-EventTime;
+                        time:inDateTime th:CmuDatetime(cmus.Code, cmus.Sec)
+                            as virtrdf:Cmu-inDateTime
+                            .
+        th:CmuDatetime (cmus.Code, cmus.Sec)
+                        a time:DateTimeDescription
+                                as virtrdf:Cmu-Datetime;
+                    time:dayOfWeek cmus.Day_
+                        as virtrdf:Cmu-Day ;
+                    time:hour cmus.Time_
+                        as virtrdf:Cmu-Time
+                            .
+
+                th:Gatech (gatechs.Department, gatechs.Code, gatechs.Section)
+                    a th:Course
+                        as virtrdf:Gatech-Course ;
+                    dc:title gatechs.Title
+                        as virtrdf:Gatech-Title ;
+                        th:hasInstructor th:GatechInstructor(gatechs.Department, gatechs.Code, gatechs.Section)
+                            as virtrdf:Gatech-hasInstructor ;
+                    dc:description gatechs.Description
+                        as virtrdf:Gatech-Description ;
+                        th:hasLecture th:GatechLecture(gatechs.Department, gatechs.Code, gatechs.Section)
+                            as virtrdf:Gatech-hasLecture ;
+                        th:forUniversity "http://purl.org/thalia/university/gatech"
+                            as virtrdf:Gatech-University ;
+                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
+                            as virtrdf:Gatech-Subject
+                            .
+        th:GatechInstructor (gatechs.Department, gatechs.Code, gatechs.Section)
+                        a th:Instructor
+                                as virtrdf:Gatech-Instructor ;
+                    foaf:name gatechs.Instructor
+                        as virtrdf:Gatech-InstructorName
+                .
+        th:GatechLecture (gatechs.Department, gatechs.Code, gatechs.Section)
+                        a event:Event
+                                as virtrdf:Gatech-Lecture ;
+                        event:time th:GatechEventTime(gatechs.Department, gatechs.Code, gatechs.Section)
+                            as virtrdf:Gatech-hasEventTime ;
+                        event:place th:GatechPlace(gatechs.Department, gatechs.Code, gatechs.Section)
+                            as virtrdf:Gatech-hasPlace
+                .
+        th:GatechEventTime (gatechs.Department, gatechs.Code, gatechs.Section)
+                        a time:Interval
+                                as virtrdf:Gatech-EventTime ;
+                        time:inDateTime th:GatechDatetime(gatechs.Department, gatechs.Code, gatechs.Section)
+                            as virtrdf:Gatech-inDateTime
+                .
+        th:GatechDatetime (gatechs.Department, gatechs.Code, gatechs.Section)
+                        a time:DateTimeDescription
+                                as virtrdf:Gatech-Datetime ;
+                    time:dayOfWeek gatechs.Days
+                        as virtrdf:Gatech-Days ;
+                    time:hour gatechs.Time_
+                        as virtrdf:Gatech-Time_
+                .
+        th:GatechPlace (gatechs.Department, gatechs.Code, gatechs.Section)
+                        a geo:Point
+                                as virtrdf:Gatech-Place ;
+                        dc:title gatechs.Place
+                            as virtrdf:Gatech-RoomBuilding
+                .
+
+                th:Toronto (torontos.No_)
+                        a th:Course
+                                as virtrdf:Toronto-Course ;
+                        dc:title torontos.title
+                            as virtrdf:Toronto-Title ;
+                        dc:description torontos.text_
+                            as virtrdf:Toronto-Description ;
+                        th:hasInstructor th:TorontoInstructor(torontos.No_)
+                            as virtrdf:Toronto-hasInstructor ;
+                        th:hasLecture th:TorontoLecture(torontos.No_)
+                            as virtrdf:Toronto-hasLecture ;
+                        rdfs:seeAlso torontos.coursewebsite
+                            as virtrdf:Toronto-CourseWebSite ;
+                        th:hasPrerequisite torontos.prereq
+                            as virtrdf:Toronto-prereq ;
+                        th:text torontos.text_
+                            as virtrdf:Toronto-text;
+                        th:forUniversity "http://purl.org/thalia/university/toronto"
+                            as virtrdf:Toronto-University ;
+                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
+                            as virtrdf:Toronto-Subject
+                            .
+        th:TorontoInstructor (torontos.No_)
+                        a th:Instructor
+                                as virtrdf:Toronto-Instructor ;
+                        foaf:name torontos.instructorName
+                            as virtrdf:Toronto-InstructorName ;
+                        foaf:mbox torontos.instructorEmail
+                            as virtrdf:Toronto-InstructorEmail
+                .
+        th:TorontoLecture (torontos.No_)
+                        a event:Event
+                                as virtrdf:Toronto-Lecture ;
+                        event:place th:TorontoPlace(torontos.No_)
+                            as virtrdf:Toronto-hasPlace
+                .
+        th:TorontoPlace (torontos.No_)
+                        a geo:Point
+                                as virtrdf:Toronto-Place ;
+                        dc:title torontos.location
+                            as virtrdf:Toronto-Location
+                .
+
+                th:Ucsd (ucsds.Number)
+                        a th:Course
+                                as virtrdf:Ucsd-Course ;
+                        dc:title ucsds.Title
+                            as virtrdf:Ucsd-Title ;
+                        th:hasInstructor1 th:UcsdInstructor1 (ucsds.Number)
+                            as virtrdf:Ucsd-hasInstructor1 ;
+                        th:hasInstructor2 th:UcsdInstructor2 (ucsds.Number)
+                            as virtrdf:Ucsd-hasInstructor2 ;
+                        th:hasInstructor3 th:UcsdInstructor3 (ucsds.Number)
+                            as virtrdf:Ucsd-hasInstructor3 ;
+                        th:forUniversity "http://purl.org/thalia/university/ucsd"
+                            as virtrdf:Ucsd-University ;
+                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
+                            as virtrdf:Ucsd-Subject
+                            .
+                th:UcsdInstructor1 (ucsds.Number)
+                        a th:Instructor
+                                as virtrdf:Ucsd-Instructor1 ;
+                        foaf:name ucsds.Fall2003
+                            as virtrdf:Ucsd-Instructor-Fall2003
+                            .
+                th:UcsdInstructor2 (ucsds.Number)
+                        a th:Instructor
+                                as virtrdf:Ucsd-Instructor2 ;
+                        foaf:name ucsds.Winter2004
+                            as virtrdf:Ucsd-Instructor-Winter2004
+                            .
+                th:UcsdInstructor3 (ucsds.Number)
+                        a th:Instructor
+                                as virtrdf:Ucsd-Instructor3 ;
+                        foaf:name ucsds.Spring2004
+                            as virtrdf:Ucsd-Instructor-Spring2004
+                            .
+
+                th:Umd (umds.Code)
+                    a th:Course
+                        as virtrdf:Umd-Course ;
+                    dc:title umds.CourseName
+                        as virtrdf:Umd-Title ;
+                        th:hasSection th:SectionTitle
+                            as virtrdf:Umd-hasSection ;
+                        th:hasLecture th:UmdLecture(umds.Code)
+                            as virtrdf:Umd-hasLecture ;
+                        th:forUniversity "http://purl.org/thalia/university/umd"
+                            as virtrdf:Umd-University ;
+                        skos:subject "http://purl.org/subject/thalia/ComputerScience"
+                            as virtrdf:Umd-Subject
+                            .
+        th:UmdLecture (umds.Code)
+                        a event:Event
+                                as virtrdf:Umd-Lecture ;
+                        event:time th:UmdEventTime(umds.Code)
+                            as virtrdf:Umd-hasEventTime
+                .
+        th:UmdEventTime (umds.Code)
+                        a time:Interval
+                                as virtrdf:Umd-EventTime ;
+                        time:inDateTime th:UmdDatetime(umds.Code)
+                            as virtrdf:Umd-inDateTime
+                .
+        th:UmdDatetime (umds.Code)
+                        a time:DateTimeDescription
+                                as virtrdf:Umd-Datetime ;
+                    time:hour umds.SectionTime
+                        as virtrdf:Umd-SectionTime
+                .
+        }
+}
+')
+;
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'tut_th_%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'tut_th_%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'tut_th_rule1',
+    1,
+    '([^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s%%01this',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'tut_th_rule2',
+    1,
+    '([^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/thalia%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'tut_th_rule3',
+    1,
+    '(/[^#]*)/\x24',
+    vector('path'),
+    1,
+    '%U',
+    vector('path'),
+    null,
+    null,
+    0,
+    null
+    );
+
+create procedure DB.DBA.REMOVE_THALIA_RDF_DET()
+{
+  declare colid int;
+  colid := DAV_SEARCH_ID('/DAV/Thalia', 'C');
+  if (colid < 0)
+    return;
+  update WS.WS.SYS_DAV_COL set COL_DET=null where COL_ID = colid;
+}
+;
+
+DB.DBA.REMOVE_THALIA_RDF_DET();
+
+drop procedure DB.DBA.REMOVE_THALIA_RDF_DET;
+
+create procedure DB.DBA.THALIA_MAKE_RDF_DET()
+{
+    declare uriqa_str varchar;
+    uriqa_str := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+    uriqa_str := 'http://' || uriqa_str || '/thalia';
+    DB.DBA."RDFData_MAKE_DET_COL" ('/DAV/Thalia/RDFData/', uriqa_str, NULL);
+    VHOST_REMOVE (lpath=>'/thalia/data/rdf');
+    DB.DBA.VHOST_DEFINE (lpath=>'/thalia/data/rdf', ppath=>'/DAV/Thalia/RDFData/All/', is_dav=>1, vsp_user=>'dba');
+}
+;
+
+DB.DBA.THALIA_MAKE_RDF_DET();
+
+drop procedure DB.DBA.THALIA_MAKE_RDF_DET;
+
+-- procedure to convert path to DET resource name
+create procedure DB.DBA.THALIA_DET_REF (in par varchar, in fmt varchar, in val varchar)
+{
+  declare res, iri any;
+  declare uriqa_str varchar;
+  uriqa_str := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+  uriqa_str := 'http://' || uriqa_str || '/thalia';
+  iri := uriqa_str || replace(val, '/', '_');
+  res := sprintf ('iid (%d).rdf', iri_id_num (iri_to_id (iri)));
+  return sprintf (fmt, res);
+}
+;
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('tut_th_rdf', 1,
+    '/thalia/(.*)', vector('path'), 1,
+    '/thalia/data/rdf/%U', vector('path'),
+    'DB.DBA.THALIA_DET_REF',
+    'application/rdf.xml',
+    2,
+    303);
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'tut_th_rule_list1',
+    1,
+    vector (
+                'tut_th_rule1',
+                'tut_th_rule2',
+                'tut_th_rule3',
+                'tut_th_rdf'
+          ));
+
+DB.DBA.VHOST_REMOVE (lpath=>'/thalia');
+DB.DBA.VHOST_DEFINE (lpath=>'/thalia', ppath=>'/DAV/Thalia/', vsp_user=>'dba', is_dav=>1,
+           is_brws=>0, opts=>vector ('url_rewrite', 'tut_th_rule_list1'));
+
+create procedure DB.DBA.LOAD_THALIA_ONTOLOGY_FROM_DAV()
+{
+	declare content, urihost varchar;
+	select cast (RES_CONTENT as varchar) into content from WS.WS.SYS_DAV_RES where RES_FULL_PATH = '/DAV/Thalia/thalia.owl';
+	DB.DBA.RDF_LOAD_RDFXML (content, 'http://demo.openlinksw.com/schemas/thalia#', 'http://demo.openlinksw.com/schemas/ThaliaOntology/1.0/');
+	urihost := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+	if (urihost = 'demo.openlinksw.com')
+	{
+		DB.DBA.VHOST_REMOVE (lpath=>'/schemas/thalia');
+		DB.DBA.VHOST_DEFINE (lpath=>'/schemas/thalia', ppath=>'/DAV/Thalia/thalia.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
+	}
+}
+;
+DB.DBA.LOAD_THALIA_ONTOLOGY_FROM_DAV()
+;
+drop procedure DB.DBA.LOAD_THALIA_ONTOLOGY_FROM_DAV
+;
+
+DB.DBA.XML_SET_NS_DECL ('thalia', 'http://demo.openlinksw.com/schemas/thalia#', 2)
+;
+
+
+    * Demo : Thalia test queries
+
+
+#service:/sparql
+#should-sponge:soft
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX time: <http://www.w3.org/2006/time#>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX th: <http://purl.org/ontology/thalia/1.0/>
+
+SELECT distinct ?room
+FROM <http://demo.openlinksw.com/thalia>
+WHERE
+  {
+    ?course a th:Course;
+              dc:title ?title;
+	      th:hasLecture ?lecture.
+    ?lecture event:place [dc:title ?room].
+    FILTER regex(?title, "Software Engineering")
+}
+
+
+#service:/sparql
+#should-sponge:soft
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX time: <http://www.w3.org/2006/time#>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX th: <http://purl.org/ontology/thalia/1.0/>
+
+SELECT ?day, ?hour ?course
+FROM <http://demo.openlinksw.com/thalia>
+WHERE
+  {
+    ?course a th:Course;
+    th:hasLecture [event:time ?time];
+    dc:title ?title.
+    ?time time:inDateTime [time:dayOfWeek ?day];
+    time:inDateTime [time:hour ?hour].
+    FILTER regex(?title, "Computer Networks")
+  }
+
+
+
+#service:/sparql
+#should-sponge:soft
+
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX time: <http://www.w3.org/2006/time#>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX th: <http://purl.org/ontology/thalia/1.0/>
+
+SELECT distinct ?course
+FROM <http://demo.openlinksw.com/thalia>
+WHERE
+  {
+    ?course a th:Course;
+              dc:title ?Title;
+              th:hasLecture ?lecture.
+    ?lecture event:time [time:inDateTime ?dateTime].
+    ?dateTime time:hour ?hour.
+    FILTER regex(?Title, "Database System")
+    FILTER regex(?hour, "1:30 - 2:50")
+  }
+
+
+#service:/sparql
+#should-sponge:soft
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX time: <http://www.w3.org/2006/time#>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX th: <http://purl.org/ontology/thalia/1.0/>
+
+SELECT distinct ?course ?instructor ?name
+FROM <http://demo.openlinksw.com/thalia>
+WHERE
+  {
+    ?course a th:Course;
+              th:hasInstructor ?instructor.
+    ?instructor foaf:name ?name.
+
+  }
+
+
+#service:/sparql
+#should-sponge:soft
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX time: <http://www.w3.org/2006/time#>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX th: <http://purl.org/ontology/thalia/1.0/>
+
+SELECT distinct ?instructor
+FROM <http://demo.openlinksw.com/thalia>
+WHERE
+  {
+    ?course a th:Course;
+	      th:hasInstructor ?instructor;
+	      dc:title  ?title.
+    FILTER regex(?title, "Database")
+  }
+
+
+#service:/sparql
+#should-sponge:soft
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX time: <http://www.w3.org/2006/time#>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX th: <http://purl.org/ontology/thalia/1.0/>
+
+SELECT distinct ?instructor
+FROM <http://demo.openlinksw.com/thalia>
+WHERE
+  {
+    ?course a th:Course;
+              dc:title ?title;
+              th:hasInstructor ?instructor.
+    FILTER regex(?title, "Software")
+  }
+
+
+#service:/sparql
+#should-sponge:soft
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX time: <http://www.w3.org/2006/time#>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX th: <http://purl.org/ontology/thalia/1.0/>
+
+SELECT DISTINCT ?course
+FROM <http://demo.openlinksw.com/thalia>
+WHERE
+  {
+    ?course a th:Course;
+              dc:title ?title;
+              th:forUniversity 'http://purl.org/thalia/university/umd'.
+    FILTER regex(?title, "Data Structures")
+  }
+
+
+#service:/sparql
+#should-sponge:soft
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX time: <http://www.w3.org/2006/time#>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX th: <http://purl.org/ontology/thalia/1.0/>
+
+SELECT distinct ?course
+FROM <http://demo.openlinksw.com/thalia>
+WHERE
+  {
+    ?course a th:Course;
+              dc:title ?Title;
+              th:hasUnits ?credits.
+    FILTER (xsd:integer(?credits) > 10)
+    FILTER regex(?Title, "Database")
+  }
+
+
+#service:/sparql
+#should-sponge:soft
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX time: <http://www.w3.org/2006/time#>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX th: <http://purl.org/ontology/thalia/1.0/>
+
+SELECT distinct ?course
+FORM <http://demo.openlinksw.com/thalia>
+WHERE
+  {
+    ?course a th:Course;
+              dc:title ?title;
+              th:forUniversity 'http://purl.org/thalia/university/umd'.
+    FILTER regex(?title, "Database")
+  }
+
+
+#service:/sparql
+#should-sponge:soft
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX time: <http://www.w3.org/2006/time#>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX th: <http://purl.org/ontology/thalia/1.0/>
+
+SELECT distinct ?course
+FROM <http://demo.openlinksw.com/thalia>
+WHERE
+  {
+    ?course a th:Course;
+              dc:title ?Title;
+              th:hasUnits ?credits.
+    FILTER (xsd:integer(?credits) > 10)
+    FILTER regex(?Title, "Database")
+  }
+
+
+#service:/sparql
+#should-sponge:soft
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX time: <http://www.w3.org/2006/time#>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX th: <http://purl.org/ontology/thalia/1.0/>
+
+SELECT distinct ?text_
+FROM <http://demo.openlinksw.com/thalia>
+WHERE
+  {
+    ?course a th:Course;
+             dc:title ?title;
+             th:text ?text_.
+    FILTER regex(?title, "Verification")
+  }
+
+
+#service:/sparql
+#should-sponge:soft
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+PREFIX owl: <http://www.w3.org/2002/07/owl#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX time: <http://www.w3.org/2006/time#>
+PREFIX event: <http://purl.org/NET/c4dm/event.owl#>
+PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
+PREFIX : <http://purl.org/ontology/thalia/1.0/>
+
+SELECT distinct ?course
+FROM <http://demo.openlinksw.com/thalia>
+WHERE
+  {
+    ?course a th:Course;
+              dc:description ?description;
+              th:forUniversity 'http://purl.org/thalia/university/gatech'.
+    FILTER regex(?description, "JR")
+  }
+]]></programlisting>
+</sect2>
+<sect2 id="rdfviewsbusintmbr">
+      <title>Musicbrainz to RDF</title>
+<para>The following code creates the Musicbrainz RDF Views Deployment and Demo Scripts:</para>
+<programlisting><![CDATA[
+create text index on ZITGIST.MO.artist ("name") with key id;
+create text index on ZITGIST.MO.artistalias ("name") with key id;
+create text index on ZITGIST.MO.album ("name") with key id;
+create text index on ZITGIST.MO.track ("name") with key id;
+vt_batch_update (fix_identifier_case ('ZITGIST.MO.artist'), 'ON', NULL);
+vt_batch_update (fix_identifier_case ('ZITGIST.MO.artistalias'), 'ON', NULL);
+vt_batch_update (fix_identifier_case ('ZITGIST.MO.album'), 'ON', NULL);
+vt_batch_update (fix_identifier_case ('ZITGIST.MO.track'), 'ON', NULL);
+VT_INC_INDEX_DB_MO_artist ();
+VT_INC_INDEX_DB_MO_artistalias ();
+VT_INC_INDEX_DB_MO_album ();
+VT_INC_INDEX_DB_MO_track ();
+]]></programlisting>
+<para>Note: Making sure that the graphs and views are deleting to clean Virtuoso from the old definitions</para>
+<programlisting><![CDATA[
+SPARQL
+drop quad storage virtrdf:MBZROOT.
+;
+
+SPARQL
+prefix mbz: <http://musibrainz.org/schemas/mbz#>
+drop literal class mbz:duration
+;
+
+SPARQL
+prefix mbz: <http://musibrainz.org/schemas/mbz#>
+drop literal class mbz:created.
+drop literal class mbz:official_iri.
+drop literal class mbz:bootleg_iri.
+drop literal class mbz:promotion_iri.
+drop literal class mbz:album_iri.
+drop literal class mbz:single_iri.
+drop literal class mbz:ep_iri.
+drop literal class mbz:compilation_iri.
+drop literal class mbz:soundtrack_iri.
+drop literal class mbz:spokenword_iri.
+drop literal class mbz:interview_iri.
+drop literal class mbz:audiobook_iri.
+drop literal class mbz:live_iri.
+drop literal class mbz:remix_iri.
+;
+]]></programlisting>
+<para>The following SPARQL query will fix an issue Virtuoso has with its JSO system. Perform this query for now, the issue should be fixed in a future release</para>
+<programlisting><![CDATA[
+SPARQL define input:storage ""
+DELETE FROM GRAPH (iri(bif:JSO_SYS_GRAPH NIL)) { ?s virtrdf:version ?o }
+WHERE { graph `iri(bif:JSO_SYS_GRAPH NIL)` {?s virtrdf:version ?o}};
+SPARQL_RELOAD_QM_GRAPH();
+]]></programlisting>
+<para>Creation of IRIs classes.</para>
+<programlisting><![CDATA[
+SPARQL
+
+prefix mbz: <http://musibrainz.org/schemas/mbz#>
+prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+prefix dc: <http://purl.org/dc/elements/1.1/>
+prefix bio: <http://vocab.org/bio/0.1/#>
+prefix rel: <http://vocab.org/relationship/#>
+prefix mo: <http://purl.org/ontology/mo/>
+prefix timeline: <http://purl.org/NET/c4dm/timeline.owl#>
+prefix event: <http://purl.org/NET/c4dm/event.owl#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix sim: <http://purl.org/ontology/sim/>
+
+create iri class mbz:artist_iri  "http://zitgist.com/music/artist/%U" (in gid varchar not null) option (bijection) .
+create iri class mbz:artist_birth_event_iri  "http://zitgist.com/music/artist/birth/%U" (in gid varchar not null) option (bijection) .
+create iri class mbz:artist_death_event_iri  "http://zitgist.com/music/artist/death/%U" (in gid varchar not null) option (bijection) .
+create iri class mbz:sim_link_iri  "http://zitgist.com/music/artist/simlink/%U" (in gid varchar not null) option (bijection) .
+
+#create iri class mbz:band_iri  "http://zitgist.com/music/band/%U" (in gid varchar not null) option (bijection) .
+#create iri class mbz:band_birth_event_iri  "http://zitgist.com/music/band/birth/%U" (in gid varchar not null) option (bijection) .
+#create iri class mbz:band_death_event_iri  "http://zitgist.com/music/band/death/%U" (in gid varchar not null) option (bijection) .
+
+create iri class mbz:record_iri  "http://zitgist.com/music/record/%U" (in gid varchar not null) option (bijection) .
+create iri class mbz:performance_iri  "http://zitgist.com/music/performance/%U" (in gid varchar not null) option (bijection) .
+create iri class mbz:composition_iri  "http://zitgist.com/music/composition/%U" (in gid varchar not null) option (bijection) .
+create iri class mbz:musicalwork_iri  "http://zitgist.com/music/musicalwork/%U" (in gid varchar not null) option (bijection) .
+create iri class mbz:sound_iri  "http://zitgist.com/music/sound/%U" (in gid varchar not null) option (bijection) .
+create iri class mbz:recording_iri  "http://zitgist.com/music/recording/%U" (in gid varchar not null) option (bijection) .
+create iri class mbz:signal_iri  "http://zitgist.com/music/signal/%U" (in gid varchar not null) option (bijection) .
+
+create iri class mbz:track_iri  "http://zitgist.com/music/track/%U" (in gid varchar not null) option (bijection) .
+
+create iri class mbz:image_iri  "http://ec1.images-amazon.com/images/P/%U.01.MZZZZZZZ.jpg" (in image varchar not null) option (bijection) .
+
+create iri class mbz:amazon_asin_iri  "http://amazon.com/exec/obidos/ASIN/%U/searchcom07-20" (in gid varchar not null) option (bijection) .
+
+
+create literal class mbz:created using
+    function ZITGIST.MO.RECORD_CREATION_DATE (in datestring varchar) returns varchar,
+    function ZITGIST.MO.RECORD_CREATION_DATE_INVERSE (in datestring varchar) returns varchar .
+
+create iri class mbz:official_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_OFFICIAL (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/official') .
+
+create iri class mbz:promotion_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_PROMOTION (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/promotion') .
+
+create iri class mbz:bootleg_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_BOOTLEG (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/bootleg') .
+
+create iri class mbz:album_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_ALBUM (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/album') .
+
+create iri class mbz:single_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_SINGLE (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/single') .
+
+create iri class mbz:ep_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_EP (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/ep') .
+
+create iri class mbz:compilation_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_COMPILATION (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/compilation') .
+
+create iri class mbz:soundtrack_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_SOUNDTRACK (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/soundtrack') .
+
+create iri class mbz:spokenword_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_SPOKENWORD (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/spokenword') .
+
+create iri class mbz:interview_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_INTERVIEW (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/interview') .
+
+create iri class mbz:audiobook_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_AUDIOBOOK (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/audiobook') .
+
+create iri class mbz:live_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_LIVE (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/live') .
+
+create iri class mbz:remix_iri using
+    function ZITGIST.MO.RECORD_ATTRIBUTE_REMIX (in attributes varchar) returns varchar
+    option (returns 'http://purl.org/ontology/mo/remix') .
+
+create iri class mbz:duration_iri  "http://zitgist.com/music/track/duration/%U" (in gid varchar not null) .
+
+create literal class mbz:duration using
+    function ZITGIST.MO.TRACK_DURATION (in duration integer) returns varchar ,
+    function ZITGIST.MO.TRACK_DURATION_INVERSE (in durationXSD varchar) returns integer .
+
+create iri class mbz:geoname_country_iri  "http://www.geonames.org/countries/#%U" (in country varchar not null) .
+
+create iri class mbz:url_iri  "%s" (in url varchar not null) .
+create iri class mbz:mbz_release_url_iri  "http://musicbrainz.org/release/%s.html" (in mbz_gid varchar not null) .
+create iri class mbz:mbz_track_url_iri  "http://musicbrainz.org/track/%s.html" (in mbz_gid varchar not null) .
+create iri class mbz:mbz_artist_url_iri  "http://musicbrainz.org/artist/%s.html" (in mbz_gid varchar not null) .
+;
+]]></programlisting>
+<para><emphasis>List of functions used to compute some IRI classes:</emphasis></para>
+<para>Note:These functions have been developed to handle some weird user cases of the Musicbrainz data model (like the Attribute column of the album table, etc).</para>
+<programlisting><![CDATA[
+create function ZITGIST.MO.TRACK_DURATION_INVERSE(in durationXSD varchar)
+{
+    return null;
+};
+
+create function ZITGIST.MO.TRACK_DURATION(in duration integer)
+{
+    declare minutes, seconds, milliseconds integer;
+
+    minutes := ((duration / 1000) / 60);
+
+    if(minutes >= 1)
+    {
+        minutes := cast(minutes as integer);
+    }
+    else
+    {
+        minutes := 0;
+    }
+
+    seconds := (duration / 1000) - (minutes * 60);
+
+    if(seconds >= 1)
+    {
+        seconds := cast(seconds as integer);
+    }
+
+    milliseconds := duration - (seconds * 1000) - (minutes * 60000);
+
+    return sprintf('PT%dM%dS', minutes, seconds);
+}
+;
+
+
+create function ZITGIST.MO.RECORD_CREATION_DATE(in datestring varchar)
+{
+    return sprintf('%sT00:00:00Z', datestring);
+};
+
+create function ZITGIST.MO.RECORD_CREATION_DATE_INVERSE(in datestring varchar)
+{
+    declare pos integer;
+    pos := locate('T00:00:00Z', datestring) - 1;
+    return substring(datestring, 1, pos);
+};
+
+
+create function ZITGIST.MO.RECORD_ATTRIBUTE(in attribute integer, in attributes varchar)
+{
+    declare attributes_array any;
+
+    attributes_array := split_and_decode(ltrim(rtrim(attributes, '}'), '{'), 0, '\0\0,');
+
+    foreach(int attr in attributes_array) do
+    {
+        attr := cast(attr as integer);
+        if(attr = attribute)
+        {
+            if(attr = 100) return 'http://purl.org/ontology/mo/official';
+            if(attr = 101) return 'http://purl.org/ontology/mo/promotion';
+            if(attr = 102) return 'http://purl.org/ontology/mo/bootleg';
+            if(attr = 1)   return 'http://purl.org/ontology/mo/album';
+            if(attr = 2)   return 'http://purl.org/ontology/mo/single';
+            if(attr = 3)   return 'http://purl.org/ontology/mo/ep';
+            if(attr = 4)   return 'http://purl.org/ontology/mo/compilation';
+            if(attr = 5)   return 'http://purl.org/ontology/mo/soundtrack';
+            if(attr = 6)   return 'http://purl.org/ontology/mo/spokenword';
+            if(attr = 7)   return 'http://purl.org/ontology/mo/interview';
+            if(attr = 8)   return 'http://purl.org/ontology/mo/audiobook';
+            if(attr = 9)   return 'http://purl.org/ontology/mo/live';
+            if(attr = 10)  return 'http://purl.org/ontology/mo/remix';
+        }
+    }
+    return null;
+}
+;
+
+create function ZITGIST.MO.RECORD_ATTRIBUTE_OFFICIAL(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(100, attributes); }
+;
+create function ZITGIST.MO.RECORD_ATTRIBUTE_PROMOTION(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(101, attributes);}
+;
+create function ZITGIST.MO.RECORD_ATTRIBUTE_BOOTLEG(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(102, attributes);}
+;
+create function ZITGIST.MO.RECORD_ATTRIBUTE_ALBUM(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(1, attributes);}
+;
+create function ZITGIST.MO.RECORD_ATTRIBUTE_SINGLE(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(2, attributes);}
+;
+create function ZITGIST.MO.RECORD_ATTRIBUTE_EP(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(3, attributes);}
+;
+create function ZITGIST.MO.RECORD_ATTRIBUTE_COMPILATION(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(4, attributes);}
+;
+create function ZITGIST.MO.RECORD_ATTRIBUTE_SOUNDTRACK(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(5, attributes);}
+;
+create function ZITGIST.MO.RECORD_ATTRIBUTE_SPOKENWORD(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(6, attributes);}
+;
+create function ZITGIST.MO.RECORD_ATTRIBUTE_INTERVIEW(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(7, attributes);}
+;
+create function ZITGIST.MO.RECORD_ATTRIBUTE_AUDIOBOOK(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(8, attributes);}
+;
+create function ZITGIST.MO.RECORD_ATTRIBUTE_LIVE(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(9, attributes);}
+;
+create function ZITGIST.MO.RECORD_ATTRIBUTE_REMIX(in attributes varchar)
+{    return ZITGIST.MO.RECORD_ATTRIBUTE(10, attributes);}
+;
+]]></programlisting>
+<para><emphasis>Definition of the quad map patterns</emphasis></para>
+<para>This what creates the RDF triples from the musicbrainz relational database schema.</para>
+<programlisting><![CDATA[
+SPARQL
+prefix mbz: <http://musibrainz.org/schemas/mbz#>
+prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+prefix dc: <http://purl.org/dc/elements/1.1/>
+prefix dcterms: <http://purl.org/dc/terms/>
+prefix bio: <http://vocab.org/bio/0.1/#>
+prefix rel: <http://vocab.org/relationship/#>
+prefix mo: <http://purl.org/ontology/mo/>
+prefix timeline: <http://purl.org/NET/c4dm/timeline.owl#>
+prefix event: <http://purl.org/NET/c4dm/event.owl#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix sim: <http://purl.org/ontology/sim/>
+
+create quad storage virtrdf:MBZROOT
+
+
+#
+# Definition of the source tables from the mbz relational database and their joints.
+#########
+
+FROM ZITGIST.MO.track as track text literal name
+FROM ZITGIST.MO.artist as track_artist
+FROM ZITGIST.MO.puid as track_puid
+FROM ZITGIST.MO.track as track_track
+FROM ZITGIST.MO.url as track_url
+
+FROM ZITGIST.MO.artist as track_artist_creator where (^{track.}^.artist = ^{track_artist_creator.}^.id)
+
+FROM ZITGIST.MO.albumjoin as track_albumjoin where (^{track.}^.id = ^{track_albumjoin.}^.track)
+
+FROM ZITGIST.MO.l_artist_track as l_artist_track2 where (^{track.}^.id = ^{l_artist_track2.}^.link1)
+                                                      where (^{track_artist.}^.id = ^{l_artist_track2.}^.link0)
+
+
+FROM ZITGIST.MO.puidjoin as puidjoin where (^{track.}^.id = ^{puidjoin.}^.track)
+                                         where (^{puidjoin.}^.puid = ^{track_puid.}^.id)
+
+
+FROM ZITGIST.MO.l_track_track as l_track_track where (^{track.}^.id = ^{l_track_track.}^.link0)
+                                                   where (^{track_track.}^.id = ^{l_track_track.}^.link1)
+
+
+FROM ZITGIST.MO.l_track_url as l_track_url where (^{track.}^.id = ^{l_track_url.}^.link0)
+                                               where (^{track_url.}^.id = ^{l_track_url.}^.link1)
+
+
+
+FROM ZITGIST.MO.album as album text literal name
+FROM ZITGIST.MO.artist as album_artist
+FROM ZITGIST.MO.album as album_album
+FROM ZITGIST.MO.url as album_url
+FROM ZITGIST.MO.country as album_release_country
+FROM ZITGIST.MO.track as album_albumjoin_track
+
+FROM ZITGIST.MO.artist as album_artist_creator where (^{album.}^.artist = ^{album_artist_creator.}^.id)
+
+FROM ZITGIST.MO.album_amazon_asin as album_amazon_asin where (^{album.}^.id = ^{album_amazon_asin.}^.album)
+
+
+FROM ZITGIST.MO.albumjoin as album_albumjoin where (^{album.}^.id = ^{album_albumjoin.}^.album)
+                                                 where (^{album_albumjoin.}^.track = ^{album_albumjoin_track.}^.id)
+
+
+FROM ZITGIST.MO.l_album_artist as l_album_artist2 where (^{album.}^.id = ^{l_album_artist2.}^.link0)
+                                                      where (^{album_artist.}^.id = ^{l_album_artist2.}^.link1)
+
+
+FROM ZITGIST.MO.l_album_album as l_album_album where (^{album.}^.id = ^{l_album_album.}^.link0)
+                                                   where (^{album_album.}^.id = ^{l_album_album.}^.link1)
+
+
+FROM ZITGIST.MO.l_album_url as l_album_url where (^{album.}^.id = ^{l_album_url.}^.link0)
+                                               where (^{album_url.}^.id = ^{l_album_url.}^.link1)
+
+
+FROM ZITGIST.MO.release as album_release where (^{album.}^.id = ^{album_release.}^.album)
+                                             where (^{album_release.}^.country = ^{album_release_country.}^.id)
+
+
+
+
+
+FROM ZITGIST.MO.artist as sim_band
+FROM ZITGIST.MO.artist as sim_artist
+FROM ZITGIST.MO.url as band_url
+FROM ZITGIST.MO.artist as band_member
+FROM ZITGIST.MO.album as band_album
+FROM ZITGIST.MO.track as band_track
+FROM ZITGIST.MO.artist as band text literal name where (^{band.}^.type = 2)
+#FROM ZITGIST.MO.artist as artist text literal name where (^{artist.}^.type <> 2)
+FROM ZITGIST.MO.artist as artist text literal name where (__or (neq(^{artist.}^.type, 2), isnull (^{artist.}^.type)))
+FROM ZITGIST.MO.artist as artist_untyped text literal name where (^{artist_untyped.}^.type <> 2)
+                                                      where (^{artist.}^.gid = ^{artist_untyped.}^.gid)
+
+
+
+FROM ZITGIST.MO.album as band_album_creatorOf where (^{band_album_creatorOf.}^.artist = ^{band.}^.id)
+FROM ZITGIST.MO.track as band_track_creatorOf where (^{band_track_creatorOf.}^.artist = ^{band.}^.id)
+
+FROM ZITGIST.MO.artistalias as bandalias text literal name where (^{band.}^.id = ^{bandalias.}^."ref")
+
+FROM ZITGIST.MO.l_artist_artist as band_l_artist_artist where (^{band_member.}^.id = ^{band_l_artist_artist.}^.link0)
+                                                            where (^{band.}^.id = ^{band_l_artist_artist.}^.link1)
+                                                            where (^{band_l_artist_artist.}^.link_type = 2)
+
+
+FROM ZITGIST.MO.artist_relation as band_relation
+where (^{artist.}^.id = ^{band_relation.}^.artist)
+where (^{band.}^.id = ^{band_relation.}^.artist)
+where (^{sim_band.}^.id = ^{band_relation.}^."ref")
+
+FROM ZITGIST.MO.artist_relation as artist_relation
+where (^{artist.}^.id = ^{artist_relation.}^.artist)
+where (^{band.}^.id = ^{artist_relation.}^.artist)
+where (^{sim_artist.}^.id = ^{artist_relation.}^."ref")
+
+
+
+FROM ZITGIST.MO.l_artist_url as l_artist_url3 where (^{band.}^.id = ^{l_artist_url3.}^.link0)
+                                                  where (^{band_url.}^.id = ^{l_artist_url3.}^.link1)
+
+
+FROM ZITGIST.MO.l_album_artist as l_album_artist3 where (^{band.}^.id = ^{l_album_artist3.}^.link1)
+                                                      where (^{band_album.}^.id = ^{l_album_artist3.}^.link0)
+
+
+FROM ZITGIST.MO.l_artist_track as l_artist_track3 where (^{band.}^.id = ^{l_artist_track3.}^.link0)
+                                                      where (^{band_track.}^.id = ^{l_artist_track3.}^.link1)
+
+FROM ZITGIST.MO.url as artist_url
+FROM ZITGIST.MO.artist as artist_artist
+FROM ZITGIST.MO.track as artist_track
+FROM ZITGIST.MO.album as artist_album
+
+FROM ZITGIST.MO.album as artist_album_creatorOf where (^{artist_album_creatorOf.}^.artist = ^{artist.}^.id)
+FROM ZITGIST.MO.track as artist_track_creatorOf where (^{artist_track_creatorOf.}^.artist = ^{artist.}^.id)
+
+FROM ZITGIST.MO.artistalias as artistalias text literal name where (^{artist.}^.id = ^{artistalias.}^."ref")
+FROM ZITGIST.MO.l_artist_url as l_artist_url where (^{artist.}^.id = ^{l_artist_url.}^.link0)
+                                                 where (^{artist_url.}^.id = ^{l_artist_url.}^.link1)
+
+FROM ZITGIST.MO.l_artist_artist as l_artist_artist where (^{artist.}^.id = ^{l_artist_artist.}^.link0)
+                                                       where (^{artist_artist.}^.id = ^{l_artist_artist.}^.link1)
+
+FROM ZITGIST.MO.l_artist_track as l_artist_track where (^{artist.}^.id = ^{l_artist_track.}^.link0)
+                                                     where (^{artist_track.}^.id = ^{l_artist_track.}^.link1)
+FROM ZITGIST.MO.l_album_artist as l_album_artist where (^{artist.}^.id = ^{l_album_artist.}^.link1)
+                                                     where (^{artist_album.}^.id = ^{l_album_artist.}^.link0)
+
+{
+  create virtrdf:MBZ as graph iri ("http://musicbrainz.org/") option (exclusive)
+    {
+
+        # Track Composition Event
+        mbz:composition_iri (track.gid)
+            a mo:Composition as mbz:track_is_composition;
+            dc:title track.name as mbz:title_of_track;
+            mo:composer mbz:artist_iri (track_artist_creator.gid) as mbz:creator_composer_of_track;
+            mo:composer mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 14) option (using l_artist_track2) as mbz:composer14_of_track;
+            mo:producesWork mbz:musicalwork_iri (track.gid) as mbz:track_producesWork.
+
+        # Track Musical Work
+        mbz:musicalwork_iri (track.gid)
+            a mo:MusicalWork as mbz:track_is_mw;
+            dc:title track.name as mbz:name_of_mw;
+
+            mo:productOfComposition mbz:composition_iri(track.gid) as mbz:mw_is_productOfComposition_of;
+            mo:usedInPerformance mbz:performance_iri(track.gid) as mbz:mw_usedInPerformance.
+
+        # Track Performance Event
+        mbz:performance_iri (track.gid)
+            a mo:Performance;
+            dc:title track.name;
+            mo:performer mbz:artist_iri (track_artist_creator.gid);
+            mo:performer mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 2) option (using l_artist_track2);
+            mo:conductor mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 9) option (using l_artist_track2);
+
+            mo:usesWork mbz:musicalwork_iri (track.gid);
+            mo:producesSound mbz:sound_iri (track.gid);
+
+            mo:recordedAs mbz:signal_iri(track.gid).
+
+        # Track Sound
+        mbz:sound_iri (track.gid)
+            a mo:Sound;
+            dc:title track.name;
+
+            mo:productOfPerformance mbz:performance_iri (track.gid);
+            mo:usedInRecording mbz:recording_iri (track.gid).
+
+        # Track Recording Event
+        mbz:recording_iri (track.gid)
+            a mo:Recording;
+            dc:title track.name;
+
+            mo:recordsSound mbz:sound_iri (track.gid);
+            mo:producesSignal mbz:signal_iri (track.gid).
+
+        # Track Signal (Musical Expression)
+        mbz:signal_iri (track.gid)
+            a mo:Signal;
+            dc:title track.name;
+
+            mo:remixer mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 11) option (using l_artist_track2);
+            mo:sampler mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 12) option (using l_artist_track2);
+            mo:djmixed mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 40) option (using l_artist_track2);
+
+            mo:djmix_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 13) option (using l_track_track);
+            mo:remix_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 6) option (using l_track_track);
+            mo:remix_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 11) option (using l_track_track);
+            mo:mashup_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 8) option (using l_track_track);
+            mo:mashup_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 4) option (using l_track_track);
+            mo:remaster_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 3) option (using l_track_track);
+            mo:compilation_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 10) option (using l_track_track);
+            mo:compilation_of mbz:track_iri (track_track.gid) where (^{l_track_track.}^.link_type = 12) option (using l_track_track);
+            mo:medley_of mbz:record_iri (track_track.gid) where (^{l_track_track.}^.link_type = 14) option (using l_track_track);
+
+            mo:published_as mbz:track_iri (track.gid);
+            mo:signalTime mbz:duration_iri(track.gid);
+            mo:puid track_puid.puid option (using puidjoin).
+
+        # Track duration
+        mbz:duration_iri(track.gid)
+            a timeline:Interval;
+            timeline:durationXSD mbz:duration(track.length).
+
+
+        mbz:track_iri(track.gid)
+            a mo:Track;
+            dc:title track.name;
+
+            mo:trackNum track_albumjoin.sequence;
+
+
+            dc:creator mbz:artist_iri (track_artist_creator.gid);
+            dc:creator mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 14) option (using l_artist_track2);
+			mo:compiler mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 39) option (using l_artist_track2);
+            mo:producer mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 18) option (using l_artist_track2);
+            mo:publisher mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 35) option (using l_artist_track2);
+            mo:engineer mbz:artist_iri (track_artist.gid) where (^{l_artist_track2.}^.link_type = 19) option (using l_artist_track2);
+
+
+            mo:licence mbz:url_iri(track_url.url) where (^{l_track_url.}^.link_type = 21) option (using l_track_url);
+            mo:paiddownload mbz:url_iri(track_url.url) where (^{l_track_url.}^.link_type = 16) option (using l_track_url);
+            mo:freedownload mbz:url_iri(track_url.url) where (^{l_track_url.}^.link_type = 17) option (using l_track_url);
+            mo:olga mbz:url_iri(track_url.url) where (^{l_track_url.}^.link_type = 19) option (using l_track_url);
+
+            mo:musicbrainz mbz:mbz_track_url_iri(track.gid);
+
+            mo:duration track.length.
+
+        # Record Composition Event
+        mbz:composition_iri (album.gid)
+            a mo:Composition;
+            dc:title album.name;
+
+            mo:composer mbz:artist_iri (album_artist_creator.gid);
+            mo:composer mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 14) option (using l_album_artist2);
+
+            mo:producesWork mbz:musicalwork_iri (album.gid).
+
+        # Record Musical Work
+        mbz:musicalwork_iri (album.gid)
+            a mo:MusicalWork;
+            dc:title album.name;
+
+            mo:productOfComposition mbz:composition_iri(album.gid);
+            mo:usedInPerformance mbz:performance_iri(album.gid).
+
+
+        # Record Performance Event
+        mbz:performance_iri (album.gid)
+            a mo:Performance;
+            dc:title album.name;
+            mo:performer mbz:artist_iri (album_artist_creator.gid);
+            mo:performer mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 2) option (using l_album_artist2);
+            mo:conductor mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 9) option (using l_album_artist2);
+
+            mo:usesWork mbz:musicalwork_iri (album.gid);
+            mo:producesSound mbz:sound_iri (album.gid);
+
+            mo:recordedAs mbz:record_iri(album.gid).
+
+
+        # Record Sound
+        mbz:sound_iri (album.gid)
+            a mo:Sound;
+            dc:title album.name;
+
+            mo:productOfPerformance mbz:performance_iri (album.gid);
+            mo:usedInRecording mbz:recording_iri (album.gid).
+
+        # Record Recording Event
+        mbz:recording_iri (album.gid)
+            a mo:Recording;
+            dc:title album.name;
+
+            mo:recordsSound mbz:sound_iri (album.gid);
+            mo:producesSignal mbz:signal_iri (album.gid).
+
+        # Record Signal (Musical Expression)
+        mbz:signal_iri (album.gid)
+            a mo:Signal;
+            dc:title album.name;
+
+            mo:djmix_of mbz:record_iri (album_album.gid) where (^{l_album_album.}^.link_type = 9) option (using l_album_album);
+            mo:remix_of mbz:record_iri (album_album.gid) where (^{l_album_album.}^.link_type = 7) option (using l_album_album);
+            mo:remix_of mbz:record_iri (album_album.gid) where (^{l_album_album.}^.link_type = 4) option (using l_album_album);
+            mo:mashup_of mbz:record_iri (album_album.gid) where (^{l_album_album.}^.link_type = 5) option (using l_album_album);
+            mo:remaster_of mbz:record_iri (album_album.gid) where (^{l_album_album.}^.link_type = 3) option (using l_album_album);
+            mo:tribute_to mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 44) option (using l_album_artist2);
+
+            mo:remixer mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 11) option (using l_album_artist2);
+            mo:djmixed mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 38) option (using l_album_artist2);
+            mo:sampler mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 12) option (using l_album_artist2);
+
+            mo:published_as mbz:record_iri (album.gid).
+
+
+        # Record (Musical Manifestation)
+        mbz:record_iri (album.gid)
+            a mo:Record;
+            dc:title album.name;
+
+            dc:date mbz:created(album_release.releasedate);
+            mo:image mbz:image_iri(album_amazon_asin.asin);
+
+            #Empty for now.
+            mo:compilation_of mbz:record_iri (album_album.gid) where (^{l_album_album.}^.link_type = 8) option (using l_album_album);
+            mo:releaseStatus mbz:official_iri(album.attributes);
+            mo:releaseStatus mbz:promotion_iri(album.attributes);
+            mo:releaseStatus mbz:bootleg_iri(album.attributes);
+
+            mo:releaseType mbz:album_iri(album.attributes);
+            mo:releaseType mbz:single_iri(album.attributes);
+            mo:releaseType mbz:ep_iri(album.attributes);
+            mo:releaseType mbz:compilation_iri(album.attributes);
+            mo:releaseType mbz:soundtrack_iri(album.attributes);
+            mo:releaseType mbz:spokenword_iri(album.attributes);
+            mo:releaseType mbz:interview_iri(album.attributes);
+            mo:releaseType mbz:audiobook_iri(album.attributes);
+            mo:releaseType mbz:live_iri(album.attributes);
+            mo:releaseType mbz:remix_iri(album.attributes);
+
+
+            dc:creator mbz:artist_iri (album_artist_creator.gid);
+            dc:creator mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 14) option (using l_album_artist2);
+
+            mo:compiler mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 41) option (using l_album_artist2);
+            mo:producer mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 18) option (using l_album_artist2);
+            mo:publisher mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 35) option (using l_album_artist2);
+            mo:engineer mbz:artist_iri (album_artist.gid) where (^{l_album_artist2.}^.link_type = 19) option (using l_album_artist2);
+
+
+            mo:musicbrainz mbz:mbz_release_url_iri(album.gid);
+
+            mo:musicmoz mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 25) option (using l_album_url);
+            mo:discogs mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 24) option (using l_album_url);
+            mo:wikipedia mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 23) option (using l_album_url);
+            mo:discography mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 1) option (using l_album_url);
+            mo:freedownload mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 21) option (using l_album_url);
+            mo:discography mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 16) option (using l_album_url);
+            mo:mailorder mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 19) option (using l_album_url);
+            mo:imdb mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 27) option (using l_album_url);
+            mo:paiddownload mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 20) option (using l_album_url);
+            mo:licence mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 32) option (using l_album_url);
+            mo:review mbz:url_iri(album_url.url) where (^{l_album_url.}^.link_type = 17) option (using l_album_url);
+
+
+            mo:amazon_asin mbz:amazon_asin_iri(album_amazon_asin.asin);
+
+            mo:has_track mbz:track_iri (album_albumjoin_track.gid) option (using album_albumjoin).
+
+       # Music Group (Band)
+#       mbz:band_iri(band.gid)
+        mbz:artist_iri(band.gid)
+            a mo:MusicArtist;
+            a mo:MusicGroup;
+            a foaf:Group;
+            foaf:name band.name;
+            foaf:nick bandalias.name;
+
+#           bio:event mbz:band_birth_event_iri(band.gid);
+#           bio:event mbz:band_death_event_iri(band.gid);
+            bio:event mbz:artist_birth_event_iri(band.gid);
+            bio:event mbz:artist_death_event_iri(band.gid);
+
+#           mo:similar_to mbz:band_iri(sim_band.gid) option (using band_relation);
+            mo:similar_to mbz:artist_iri(sim_band.gid) option (using band_relation);
+            mo:similar_to mbz:artist_iri(sim_artist.gid) option (using artist_relation);
+#            sim:link mbz:sim_link_iri(sim_band.gid)  option (using band_relation);
+#            sim:link mbz:sim_link_iri(sim_artist.gid)  option (using artist_relation);
+
+            foaf:member mbz:artist_iri(band_member.gid) option (using band_l_artist_artist);
+
+            # l_artist_url
+            mo:myspace mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 19) option (using l_artist_url3);
+            mo:musicmoz mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 12) option (using l_artist_url3);
+            mo:discogs mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 11) option (using l_artist_url3);
+            mo:wikipedia mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 10) option (using l_artist_url3);
+            mo:discography mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 1) option (using l_artist_url3);
+            mo:freedownload mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 8) option (using l_artist_url3);
+            mo:fanpage mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 3) option (using l_artist_url3);
+            mo:biography mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 4) option (using l_artist_url3);
+            mo:discography mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 5) option (using l_artist_url3);
+            mo:mailorder mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 15) option (using l_artist_url3);
+            mo:imdb mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 17) option (using l_artist_url3);
+            mo:paiddownload mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 7) option (using l_artist_url3);
+            foaf:depiction mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 14) option (using l_artist_url3);
+            foaf:homepage mbz:url_iri(band_url.url) where (^{l_artist_url3.}^.link_type = 2) option (using l_artist_url3);
+
+            mo:musicbrainz mbz:mbz_artist_url_iri(band.gid);
+
+
+            # l_album_artist
+            mo:composed mbz:composition_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 14) option (using l_album_artist3);
+            mo:performed mbz:performance_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 14) option (using l_album_artist3);
+            mo:performed mbz:performance_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 2) option (using l_album_artist3);
+            mo:conducted mbz:performance_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 9) option (using l_album_artist3);
+            mo:compiled mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 41) option (using l_album_artist3);
+            mo:djmixed mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 38) option (using l_album_artist3);
+            mo:remixed mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 11) option (using l_album_artist3);
+            mo:sampled mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 12) option (using l_album_artist3);
+            mo:produced mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 18) option (using l_album_artist3);
+            mo:published mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 35) option (using l_album_artist3);
+            mo:engineered mbz:record_iri (band_album.gid) where (^{l_album_artist3.}^.link_type = 19) option (using l_album_artist3);
+
+#    #      mo:creatorOfRecord mbz:record_iri(band_album_creatorOf.gid);
+            foaf:made mbz:record_iri(band_album_creatorOf.gid);
+
+            # l_artist_track
+            mo:composed mbz:composition_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 14) option (using l_artist_track3);
+            mo:performed mbz:performance_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 14) option (using l_artist_track3);
+            mo:performed mbz:performance_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 2) option (using l_artist_track3);
+            mo:conducted mbz:performance_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 9) option (using l_artist_track3);
+            mo:compiled mbz:record_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 39) option (using l_artist_track3);
+            mo:djmixed mbz:track_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 40) option (using l_artist_track3);
+            mo:remixed mbz:track_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 11) option (using l_artist_track3);
+            mo:sampled mbz:track_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 12) option (using l_artist_track3);
+            mo:produced mbz:track_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 18) option (using l_artist_track3);
+            mo:published mbz:track_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 35) option (using l_artist_track3);
+            mo:engineered mbz:track_iri (band_track.gid) where (^{l_artist_track3.}^.link_type = 19) option (using l_artist_track3).
+
+#    #      mo:creatorOfTrack mbz:track_iri(band_track_creatorOf.gid).
+
+
+
+
+        # Music Group (Band)'s Birth Event
+#       mbz:band_birth_event_iri(band.gid)
+        mbz:artist_birth_event_iri(band.gid)
+            a bio:Birth;
+            bio:date band.begindate.
+
+        # Music Group (Band)'s Death Event
+#       mbz:band_death_event_iri(band.gid)
+        mbz:artist_death_event_iri(band.gid)
+            a bio:Death;
+            bio:date band.enddate.
+
+        # Similarity link
+        #mbz:sim_link_iri(sim_band.gid)
+        #    sim:relation mo:similar_to;
+        #    sim:level band_relation.weight;
+        #    sim:to sim_band.gid.
+
+
+        # Music Artist
+        mbz:artist_iri (artist.gid)
+
+            # artist
+            a mo:MusicArtist;
+            a mo:SoloMusicArtist where (^{artist_untyped.}^.gid is not null) option (using artist_untyped);
+            a foaf:Person where (^{artist_untyped.}^.gid is not null) option (using artist_untyped);
+            foaf:name artist.name;
+            foaf:nick artistalias.name;
+            bio:event mbz:artist_birth_event_iri(artist.gid);
+            bio:event mbz:artist_death_event_iri(artist.gid);
+
+            mo:member_of mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 2) option (using l_artist_artist);
+
+            # l_artist_artist
+            rel:siblingOf mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 7) option (using l_artist_artist);
+            rel:friendOf mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 5) option (using l_artist_artist);
+            rel:parentOf mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 6) option (using l_artist_artist);
+            rel:collaborated_with mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 11) option (using l_artist_artist);
+            rel:engagedTo mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 9) option (using l_artist_artist);
+            rel:spouseOf mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 8) option (using l_artist_artist);
+            mo:supporting_musician mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 13) option (using l_artist_artist);
+            mo:supporting_musician mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 14) option (using l_artist_artist);
+            mo:supporting_musician mbz:artist_iri(artist_artist.gid) where (^{l_artist_artist.}^.link_type = 15) option (using l_artist_artist);
+
+            mo:similar_to mbz:artist_iri(sim_artist.gid) option (using artist_relation);
+#           mo:similar_to mbz:band_iri(sim_band.gid) option (using band_relation);
+            mo:similar_to mbz:artist_iri(sim_band.gid) option (using band_relation);
+
+#            sim:link mbz:sim_link_iri(sim_band.gid)  option (using band_relation);
+#            sim:link mbz:sim_link_iri(sim_artist.gid)  option (using artist_relation);
+
+
+            # l_artist_url
+            mo:myspace mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 19) option (using l_artist_url);
+            mo:musicmoz mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 12) option (using l_artist_url);
+            mo:discogs mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 11) option (using l_artist_url);
+            mo:wikipedia mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 10) option (using l_artist_url);
+            mo:discography mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 1) option (using l_artist_url);
+            mo:freedownload mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 8) option (using l_artist_url);
+            mo:fanpage mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 3) option (using l_artist_url);
+            mo:biography mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 4) option (using l_artist_url);
+            mo:discography mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 5) option (using l_artist_url);
+            mo:mailorder mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 15) option (using l_artist_url);
+            mo:imdb mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 17) option (using l_artist_url);
+            mo:paiddownload mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 7) option (using l_artist_url);
+            foaf:depiction mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 14) option (using l_artist_url);
+            foaf:homepage mbz:url_iri(artist_url.url) where (^{l_artist_url.}^.link_type = 2) option (using l_artist_url);
+
+            mo:musicbrainz mbz:mbz_artist_url_iri(artist.gid);
+
+
+            # l_album_artist
+            mo:composed mbz:composition_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 14) option (using l_album_artist);
+            mo:performed mbz:performance_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 14) option (using l_album_artist);
+            mo:performed mbz:performance_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 2) option (using l_album_artist);
+            mo:conducted mbz:performance_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 9) option (using l_album_artist);
+            mo:compiled mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 41) option (using l_album_artist);
+            mo:djmixed mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 38) option (using l_album_artist);
+            mo:remixed mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 11) option (using l_album_artist);
+            mo:sampled mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 12) option (using l_album_artist);
+            mo:produced mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 18) option (using l_album_artist);
+            mo:published mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 35) option (using l_album_artist);
+            mo:engineered mbz:record_iri (artist_album.gid) where (^{l_album_artist.}^.link_type = 19) option (using l_album_artist);
+
+     #      mo:creatorOfRecord mbz:record_iri(artist_album_creatorOf.gid);
+            foaf:made mbz:record_iri(artist_album_creatorOf.gid);
+
+
+            # l_artist_track
+            mo:composed mbz:composition_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 14) option (using l_artist_track);
+            mo:performed mbz:performance_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 14) option (using l_artist_track);
+            mo:performed mbz:performance_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 2) option (using l_artist_track);
+            mo:conducted mbz:performance_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 9) option (using l_artist_track);
+            mo:compiled mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 39) option (using l_artist_track);
+            mo:djmixed mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 40) option (using l_artist_track);
+            mo:remixed mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 11) option (using l_artist_track);
+            mo:sampled mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 12) option (using l_artist_track);
+            mo:produced mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 18) option (using l_artist_track);
+            mo:published mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 35) option (using l_artist_track);
+            mo:engineered mbz:track_iri (artist_track.gid) where (^{l_artist_track.}^.link_type = 19) option (using l_artist_track).
+
+     #       mo:creatorOfTrack mbz:track_iri(artist_track_creatorOf.gid).
+
+
+        # Music Artist''s Birth Event
+        mbz:artist_birth_event_iri(artist.gid)
+            a bio:Birth;
+            bio:date artist.begindate.
+
+        # Music Artist''s Death Event
+        mbz:artist_death_event_iri(artist.gid)
+            a bio:Death;
+            bio:date artist.enddate.
+
+        # Similarity link
+        #mbz:sim_link_iri(sim_artist.gid)
+        #    sim:relation mo:similar_to;
+        #    sim:level artist_relation.weight;
+        #    sim:to sim_artist.gid.
+
+        }
+  }
+;
+
+
+grant execute on ZITGIST.MO.RECORD_CREATION_DATE to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_CREATION_DATE_INVERSE to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_OFFICIAL to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_PROMOTION to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_BOOTLEG to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_ALBUM to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_SINGLE to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_EP to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_COMPILATION to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_SOUNDTRACK to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_SPOKENWORD to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_INTERVIEW to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_AUDIOBOOK to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_LIVE to "SPARQL";
+grant execute on ZITGIST.MO.RECORD_ATTRIBUTE_REMIX to "SPARQL";
+grant execute on ZITGIST.MO.TRACK_DURATION to "SPARQL";
+grant execute on ZITGIST.MO.TRACK_DURATION_INVERSE to "SPARQL";
+grant execute on ZITGIST.MO.album_amazon_asin to "SPARQL";
+grant execute on ZITGIST.MO.album_name_WORDS to "SPARQL";
+grant execute on ZITGIST.MO.albumjoin to "SPARQL";
+grant execute on ZITGIST.MO.albummeta to "SPARQL";
+grant execute on ZITGIST.MO.artist to "SPARQL";
+grant execute on ZITGIST.MO.artist_name_WORDS to "SPARQL";
+grant execute on ZITGIST.MO.artist_relation to "SPARQL";
+grant execute on ZITGIST.MO.artistalias to "SPARQL";
+grant execute on ZITGIST.MO.artistalias_name_WORDS to "SPARQL";
+grant execute on ZITGIST.MO.country to "SPARQL";
+grant execute on ZITGIST.MO.l_album_album to "SPARQL";
+grant execute on ZITGIST.MO.l_album_artist to "SPARQL";
+grant execute on ZITGIST.MO.l_album_url to "SPARQL";
+grant execute on ZITGIST.MO.l_artist_artist to "SPARQL";
+grant execute on ZITGIST.MO.l_artist_track to "SPARQL";
+grant execute on ZITGIST.MO.l_artist_url to "SPARQL";
+grant execute on ZITGIST.MO.l_track_track to "SPARQL";
+grant execute on ZITGIST.MO.l_track_url to "SPARQL";
+grant execute on ZITGIST.MO."language" to "SPARQL";
+grant execute on ZITGIST.MO.puid to "SPARQL";
+grant execute on ZITGIST.MO.puidjoin to "SPARQL";
+grant execute on ZITGIST.MO.release to "SPARQL";
+grant execute on ZITGIST.MO.track to "SPARQL";
+grant execute on ZITGIST.MO.track_name_WORDS to "SPARQL";
+grant execute on ZITGIST.MO.url to "SPARQL";
+
+DB.DBA.XML_SET_NS_DECL ('mbz', 'http://musibrainz.org/schemas/mbz#', 2);
+]]></programlisting>
+</sect2>
+<sect2 id="rdfviewsbusintods">
+      <title>Virtuoso ODS to RDF</title>
+<para><emphasis>RDF View for ODS (the consolidated Graph)</emphasis></para>
+<programlisting><![CDATA[
+SPARQL drop quad map virtrdf:ODS_DS . ;
+
+SPARQL prefix ods: <http://www.openlinksw.com/virtuoso/ods/>
+       create iri class ods:graph "http://^{URIQADefaultHost}^/dataspace/%U" (in uname varchar not null)
+			    option (returns "http://^{URIQADefaultHost}^/dataspace/%U") .
+       create iri class ods:user "http://^{URIQADefaultHost}^/dataspace/%U#user" (in uname varchar not null)
+			    option (returns "http://^{URIQADefaultHost}^/dataspace/%U#user") .
+       create iri class ods:user_group "http://^{URIQADefaultHost}^/dataspace/%U#group" (in uname varchar not null)
+			    option (returns "http://^{URIQADefaultHost}^/dataspace/%U#group") .
+       create iri class ods:person "http://^{URIQADefaultHost}^/dataspace/%U#this" (in uname varchar not null)
+			    option (returns "http://^{URIQADefaultHost}^/dataspace/%U#this") .
+       create iri class ods:mbox "mailto:%s" (in email varchar not null)
+			    option (returns "mailto:%s") .
+       create iri class ods:phone "tel:%s" (in tel varchar not null)
+       			    option (returns "tel:%s") .
+       create iri class ods:geo_point "http://^{URIQADefaultHost}^/dataspace/%U#geo" (in uname varchar not null)
+       			    option (returns "http://^{URIQADefaultHost}^/dataspace/%U#geo") .
+       create iri class ods:forum "http://^{URIQADefaultHost}^/dataspace/%U/%U/%U"
+	    ( in uname varchar not null, in forum_type varchar not null, in forum_name varchar not null)
+	    		    option (returns "http://^{URIQADefaultHost}^/dataspace/%U/%U/%U") .
+       create iri class ods:proxy "http://^{URIQADefaultHost}^/proxy/%U" (in url varchar not null)
+       			    option (returns  "http://^{URIQADefaultHost}^/proxy/%U") .
+       create iri class ods:site "http://^{URIQADefaultHost}^/dataspace/%U#site" (in uname varchar not null)
+       			    option (returns "http://^{URIQADefaultHost}^/dataspace/%U#site") .
+       create iri class ods:role "http://^{URIQADefaultHost}^/dataspace/%U/%U/%U#%U"
+	    (in uname varchar not null, in tp varchar not null, in inst varchar not null, in role_name varchar not null)
+			    option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/%U/%U#%U" ) .
+	# Blog
+	create iri class ods:blog_forum "http://^{URIQADefaultHost}^/dataspace/%U/weblog/%U"
+		(in uname varchar not null, in forum_name varchar not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/weblog/%U") .
+	create iri class ods:blog_post "http://^{URIQADefaultHost}^/dataspace/%U/weblog/%U/%U"
+		(in uname varchar not null, in forum_name varchar not null, in postid varchar not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/weblog/%U/%U" ) .
+	create iri class ods:blog_comment "http://^{URIQADefaultHost}^/dataspace/%U/weblog/%U/%U/%d"
+		(in uname varchar not null, in forum_name varchar not null, in postid varchar not null, in comment_id int not null)
+ 	        option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/weblog/%U/%U/%d" ) .
+	create iri class ods:tag "http://^{URIQADefaultHost}^/dataspace/%U/concept#%U"
+		(in uname varchar not null, in tag varchar not null)
+                option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/concept#%U") .
+	create iri class ods:blog_post_text "http://^{URIQADefaultHost}^/dataspace/%U/weblog-text/%U/%U"
+		(in uname varchar not null, in forum_name varchar not null, in postid varchar not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/weblog-text/%U/%U" ) .
+	#Feeds
+	create iri class ods:feed "http://^{URIQADefaultHost}^/dataspace/feed/%d" (in feed_id integer not null)
+          	option (returns "http://^{URIQADefaultHost}^/dataspace/feed/%d" ) .
+	create iri class ods:feed_item "http://^{URIQADefaultHost}^/dataspace/feed/%d/%d" (in feed_id integer not null, in item_id integer not null)
+	 	option (returns  "http://^{URIQADefaultHost}^/dataspace/feed/%d/%d" ) .
+	create iri class ods:feed_item_text "http://^{URIQADefaultHost}^/dataspace/feed/%d/%d/text" (in feed_id integer not null, in item_id integer not null)
+		option (returns  "http://^{URIQADefaultHost}^/dataspace/feed/%d/%d/text" ) .
+	create iri class ods:feed_mgr "http://^{URIQADefaultHost}^/dataspace/%U/feeds/%U" (in uname varchar not null, in inst_name varchar not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/feeds/%U" ) .
+	create iri class ods:feed_comment "http://^{URIQADefaultHost}^/dataspace/%U/feeds/%U/%d/%d"
+		(in uname varchar not null, in inst_name varchar not null, in item_id integer not null, in comment_id integer not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/feeds/%U/%d/%d" ) .
+	#Bookmark
+	create iri class ods:bmk_post "http://^{URIQADefaultHost}^/dataspace/%U/bookmark/%U/%d"
+		(in uname varchar not null, in inst_name varchar not null, in bmk_id integer not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/bookmark/%U/%d") .
+	create iri class ods:bmk_post_text "http://^{URIQADefaultHost}^/dataspace/%U/bookmark/%U/%d/text"
+		(in uname varchar not null, in inst_name varchar not null, in bmk_id integer not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/bookmark/%U/%d/text" ) .
+	create iri class ods:bmk_forum "http://^{URIQADefaultHost}^/dataspace/%U/bookmark/%U"
+		( in uname varchar not null, in forum_name varchar not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/bookmark/%U") .
+	#Photo
+	create iri class ods:photo_forum "http://^{URIQADefaultHost}^/dataspace/%U/photos/%U"
+		(in uname varchar not null, in inst_name varchar not null)
+		option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/photos/%U") .
+	create iri class ods:photo_post "http://^{URIQADefaultHost}^%s"
+		(in path varchar not null) option (returns "http://^{URIQADefaultHost}^/DAV/%s") .
+	create iri class ods:photo_post_text "http://^{URIQADefaultHost}^%s/text"
+		(in path varchar not null) option (returns "http://^{URIQADefaultHost}^/DAV/%s/text") .
+	create iri class ods:photo_comment "http://^{URIQADefaultHost}^%s:comment_%d"
+		(in path varchar not null, in comment_id int not null)
+		option (returns "http://^{URIQADefaultHost}^/DAV/%s:comment_%d") .
+	# Community
+	create iri class ods:community_forum "http://^{URIQADefaultHost}^/dataspace/%U/community/%U"
+		(in uname varchar not null, in forum_name varchar not null)
+		option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/community/%U") .
+	# Briefcase
+	create iri class ods:odrive_forum "http://^{URIQADefaultHost}^/dataspace/%U/briefcase/%U"
+		(in uname varchar not null, in inst_name varchar not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/briefcase/%U" ) .
+	create iri class ods:odrive_post "http://^{URIQADefaultHost}^%s"
+		(in path varchar not null) option (returns "http://^{URIQADefaultHost}^/DAV/%s") .
+	create iri class ods:odrive_post_text "http://^{URIQADefaultHost}^%s/text"
+		(in path varchar not null) option (returns "http://^{URIQADefaultHost}^/DAV/%s/text") .
+	# Wiki
+	create iri class ods:wiki_post "http://^{URIQADefaultHost}^/dataspace/%U/wiki/%U/%U"
+		(in uname varchar not null, in inst_name varchar not null, in topic_id varchar not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/wiki/%U/%U") .
+	create iri class ods:wiki_post_text "http://^{URIQADefaultHost}^/dataspace/%U/wiki/%U/%U/text"
+		(in uname varchar not null, in inst_name varchar not null, in topic_id varchar not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/wiki/%U/%U/text" ) .
+	create iri class ods:wiki_forum "http://^{URIQADefaultHost}^/dataspace/%U/wiki/%U"
+		( in uname varchar not null, in forum_name varchar not null)
+		option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/wiki/%U" ) .
+	#Calendar
+	create iri class ods:calendar_event "http://^{URIQADefaultHost}^/dataspace/%U/calendar/%U/%d"
+		(in uname varchar not null, in inst_name varchar not null, in calendar_id integer not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/calendar/%U/%d" ) .
+	create iri class ods:calendar_event_text "http://^{URIQADefaultHost}^/dataspace/%U/calendar/%U/%d/text"
+		(in uname varchar not null, in inst_name varchar not null, in calendar_id integer not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/%U/calendar/%U/%d/text" ) .
+	create iri class ods:calendar_forum "http://^{URIQADefaultHost}^/dataspace/%U/calendar/%U"
+		( in uname varchar not null, in forum_name varchar not null)
+		option (returns  "http://^{URIQADefaultHost}^/dataspace/%U/calendar/%U") .
+	# NNTPF
+	create iri class ods:nntp_forum "http://^{URIQADefaultHost}^/dataspace/discussion/%U"
+		( in forum_name varchar not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/discussion/%U").
+	create iri class ods:nntp_post "http://^{URIQADefaultHost}^/dataspace/discussion/%U/%U"
+		( in group_name varchar not null, in message_id varchar not null)
+		option (returns  "http://^{URIQADefaultHost}^/dataspace/discussion/%U/%U" ) .
+	create iri class ods:nntp_post_text "http://^{URIQADefaultHost}^/dataspace/discussion/%U/%U/text"
+		( in group_name varchar not null, in message_id varchar not null)
+		option (returns  "http://^{URIQADefaultHost}^/dataspace/discussion/%U/%U/text") .
+	create iri class ods:nntp_role "http://^{URIQADefaultHost}^/dataspace/discussion/%U#reader"
+		(in forum_name varchar not null)
+		option (returns "http://^{URIQADefaultHost}^/dataspace/discussion/%U#reader") .
+       ;
+
+
+SPARQL
+    prefix sioc: <http://rdfs.org/sioc/ns#>
+    prefix sioct: <http://rdfs.org/sioc/types#>
+    prefix atom: <http://atomowl.org/ontologies/atomrdf#>
+    prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+    prefix foaf: <http://xmlns.com/foaf/0.1/>
+    prefix dc: <http://purl.org/dc/elements/1.1/>
+    prefix dct: <http://purl.org/dc/terms/>
+    prefix skos: <http://www.w3.org/2004/02/skos/core#>
+    prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+    prefix bm: <http://www.w3.org/2002/01/bookmark#>
+    prefix exif: <http://www.w3.org/2003/12/exif/ns/>
+    prefix ann: <http://www.w3.org/2000/10/annotation-ns#>
+    prefix wikiont: <http://sw.deri.org/2005/04/wikipedia/wikiont.owl#>
+    prefix calendar: <http://www.w3.org/2002/12/cal#>
+    prefix ods: <http://www.openlinksw.com/virtuoso/ods/>
+
+    alter quad storage virtrdf:DefaultQuadStorage
+      FROM DB.DBA.SIOC_USERS as users
+      FROM DB.DBA.SIOC_ODS_FORUMS as forums
+      FROM DB.DBA.SIOC_ROLES as roles
+      FROM DB.DBA.SIOC_ROLE_GRANTS as grants
+      FROM DB.DBA.SIOC_KNOWS as knows
+      FROM DB.DBA.ODS_FOAF_PERSON as person
+      where (^{person.}^.U_NAME = ^{users.}^.U_NAME)
+      where (^{forums.}^.U_NAME = ^{users.}^.U_NAME)
+      where (^{knows.}^.TO_NAME = ^{users.}^.U_NAME)
+      where (^{knows.}^.FROM_NAME = ^{users.}^.U_NAME)
+      where (^{grants.}^.U_NAME = ^{users.}^.U_NAME)
+      where (^{roles.}^.U_NAME = ^{users.}^.U_NAME)
+
+      FROM DB.DBA.ODS_BLOG_POSTS as blog_posts
+      where (^{blog_posts.}^.B_OWNER = ^{users.}^.U_NAME)
+      FROM DB.DBA.ODS_BLOG_POST_LINKS as blog_links
+      where (^{blog_links.}^.B_OWNER = ^{users.}^.U_NAME)
+      FROM DB.DBA.ODS_BLOG_POST_ATTS as blog_atts
+      where (^{blog_atts.}^.B_OWNER = ^{users.}^.U_NAME)
+      FROM DB.DBA.ODS_BLOG_POST_TAGS as blog_tags
+      where (^{blog_tags.}^.U_NAME = ^{users.}^.U_NAME)
+      FROM DB.DBA.ODS_BLOG_COMMENTS as blog_comms
+      where (^{blog_comms.}^.U_NAME = ^{users.}^.U_NAME)
+
+      FROM DB.DBA.ODS_BMK_POSTS as bmk_posts
+      where (^{bmk_posts.}^.U_NAME = ^{users.}^.U_NAME)
+      FROM DB.DBA.ODS_BMK_TAGS as bmk_tags
+      where (^{bmk_tags.}^.U_NAME = ^{users.}^.U_NAME)
+
+      FROM DB.DBA.ODS_ODRIVE_POSTS as odrv_posts
+      where (^{odrv_posts.}^.U_MEMBER = ^{users.}^.U_NAME)
+      FROM DB.DBA.ODS_ODRIVE_TAGS as odrv_tags
+      where (^{odrv_tags.}^.U_OWNER = ^{users.}^.U_NAME)
+
+      FROM DB.DBA.ODS_FEED_FEED_DOMAIN as feed_domain
+      where (^{feed_domain.}^.U_NAME = ^{users.}^.U_NAME)
+      FROM DB.DBA.ODS_FEED_POSTS as feed_posts
+      where (^{feed_posts.}^.EFI_FEED_ID = ^{feed_domain.}^.EF_ID)
+      FROM DB.DBA.ODS_FEED_COMMENTS as feed_comments
+      where (^{feed_comments.}^.U_NAME = ^{users.}^.U_NAME)
+      FROM DB.DBA.ODS_FEED_TAGS as feed_tags
+      where (^{feed_tags.}^.U_NAME = ^{users.}^.U_NAME)
+      FROM DB.DBA.ODS_FEED_LINKS as feed_links
+      where (^{feed_links.}^.EFI_FEED_ID = ^{feed_domain.}^.EF_ID)
+      FROM DB.DBA.ODS_FEED_ATTS as feed_atts
+      where (^{feed_atts.}^.EFI_FEED_ID = ^{feed_domain.}^.EF_ID)
+
+      FROM DB.DBA.ODS_PHOTO_POSTS as photo_posts
+      where (^{photo_posts.}^.U_MEMBER = ^{users.}^.U_NAME)
+      FROM DB.DBA.ODS_PHOTO_COMMENTS as photo_comments
+      where (^{photo_comments.}^.U_MEMBER = ^{users.}^.U_NAME)
+      FROM DB.DBA.ODS_PHOTO_TAGS as photo_tags
+      where (^{photo_tags.}^.U_MEMBER = ^{users.}^.U_NAME)
+
+      FROM DB.DBA.ODS_WIKI_POSTS as wiki_posts
+      where (^{wiki_posts.}^.U_NAME = ^{users.}^.U_NAME)
+
+      FROM DB.DBA.ODS_COMMUNITIES as community
+      where (^{community.}^.C_OWNER = ^{users.}^.U_NAME)
+
+      FROM DB.DBA.ODS_NNTP_GROUPS as nntp_groups
+      FROM DB.DBA.ODS_NNTP_POSTS as nntp_posts
+      FROM DB.DBA.ODS_NNTP_USERS as nntp_users
+      where (^{nntp_users.}^.U_NAME = ^{users.}^.U_NAME)
+      FROM DB.DBA.ODS_NNTP_LINKS as nntp_links
+
+
+    {
+	create virtrdf:ODS_DS as graph ods:graph (users.U_NAME) option (exclusive)
+	  {
+	    ods:user (users.U_NAME) a sioc:User ;
+            sioc:id users.U_NAME ;
+            sioc:name users.U_FULL_NAME ;
+            sioc:email ods:mbox (users.E_MAIL) ;
+            sioc:email_sha1 users.E_MAIL_SHA1 ;
+            sioc:account_of ods:person (users.U_NAME) .
+
+	    ods:person (person.U_NAME) a foaf:Person ;
+            foaf:nick person.U_NAME ;
+	    foaf:name person.U_FULL_NAME ;
+	    foaf:mbox ods:mbox (person.E_MAIL) ;
+            foaf:mbox_sha1sum person.E_MAIL_SHA1 ;
+            foaf:holdsAccount ods:user (person.U_NAME) ;
+            foaf:firstName person.FIRST_NAME ;
+            foaf:family_name person.LAST_NAME ;
+            foaf:gender person.GENDER ;
+            foaf:icqChatID person.ICQ ;
+            foaf:msnChatID person.MSN ;
+            foaf:aimChatID person.AIM ;
+            foaf:yahooChatID person.YAHOO ;
+            foaf:birthday person.BIRTHDAY ;
+            foaf:organization person.ORG ;
+            foaf:phone ods:phone (person.PHONE) ;
+	    foaf:based_near ods:geo_point (person.U_NAME)
+	    .
+
+	    ods:geo_point (person.U_NAME) a geo:Point ;
+		 geo:lat person.LAT ;
+		 geo:lng person.LNG .
+
+	    ods:person (knows.FROM_NAME) foaf:knows ods:person (knows.TO_NAME) .
+	    ods:person (knows.TO_NAME) foaf:knows ods:person (knows.FROM_NAME) .
+
+	    ods:user_group (grants.G_NAME) a sioc:Usergroup ;
+	    	sioc:id grants.G_NAME ;
+		sioc:has_member ods:user (grants.U_NAME) .
+	    ods:user (grants.U_NAME)  sioc:member_of ods:user_group (grants.G_NAME) .
+
+	    ods:role (roles.U_NAME, roles.APP_TYPE, roles.WAM_INST, roles.WMT_NAME)
+	      sioc:has_scope ods:forum (roles.U_NAME, roles.APP_TYPE, roles.WAM_INST) ;
+	      sioc:function_of ods:user (roles.U_NAME) .
+
+            ods:forum (roles.U_NAME, roles.APP_TYPE, roles.WAM_INST)
+	    	sioc:scope_of ods:role (roles.U_NAME, roles.APP_TYPE, roles.WAM_INST, roles.WMT_NAME) .
+            ods:user (roles.U_NAME)
+	    	sioc:has_function ods:role (roles.U_NAME, roles.APP_TYPE, roles.WAM_INST, roles.WMT_NAME) .
+
+	    ods:forum (forums.U_NAME, forums.APP_TYPE, forums.WAM_INST) a sioc:Container ;
+            sioc:id forums.WAM_INST ;
+	    sioc:type forums.APP_TYPE ;
+            sioc:description forums.WAI_DESCRIPTION ;
+            sioc:link ods:proxy (forums.LINK) ;
+            sioc:has_space ods:site (forums.U_NAME) .
+
+            # Weblog
+	    ods:blog_post (blog_posts.B_OWNER, blog_posts.B_INST, blog_posts.B_POST_ID) a sioct:BlogPost ;
+	    sioc:link ods:proxy (blog_posts.B_LINK) ;
+	    sioc:has_creator ods:user (blog_posts.B_CREATOR) ;
+	    foaf:maker ods:person (blog_posts.B_CREATOR) ;
+	    sioc:has_container ods:blog_forum (blog_posts.B_OWNER, blog_posts.B_INST) ;
+	    dc:title blog_posts.B_TITLE ;
+	    dct:created blog_posts.B_CREATED ;
+	    dct:modified blog_posts.B_MODIFIED ;
+	    sioc:content blog_posts.B_CONTENT .
+
+	    ods:blog_forum (blog_posts.B_OWNER, blog_posts.B_INST)
+	    sioc:container_of
+	    ods:blog_post (blog_posts.B_OWNER, blog_posts.B_INST, blog_posts.B_POST_ID) .
+
+	    ods:user (blog_posts.B_CREATOR)
+	    sioc:creator_of
+	    ods:blog_post (blog_posts.B_OWNER, blog_posts.B_INST, blog_posts.B_POST_ID) .
+
+	    ods:blog_post (blog_links.B_OWNER, blog_links.B_INST, blog_links.B_POST_ID)
+	    sioc:links_to
+	    ods:proxy (blog_links.PL_LINK) .
+	    # end Weblog
+
+            # Bookmark
+	    ods:bmk_post (bmk_posts.U_NAME, bmk_posts.WAI_NAME, bmk_posts.BD_BOOKMARK_ID)
+            a bm:Bookmark ;
+	    dc:title bmk_posts.BD_NAME;
+	    dct:created bmk_posts.BD_CREATED ;
+	    dct:modified bmk_posts.BD_LAST_UPDATE ;
+	    dc:date bmk_posts.BD_LAST_UPDATE ;
+	    ann:created bmk_posts.BD_CREATED ;
+	    dc:creator bmk_posts.U_NAME ;
+	    bm:recalls ods:proxy (bmk_posts.B_URI) ;
+	    sioc:link ods:proxy (bmk_posts.B_URI) ;
+	    sioc:content bmk_posts.BD_DESCRIPTION ;
+	    sioc:has_creator ods:user (bmk_posts.U_NAME) ;
+	    foaf:maker ods:person (bmk_posts.U_NAME) ;
+	    sioc:has_container ods:bmk_forum (bmk_posts.U_NAME, bmk_posts.WAI_NAME) .
+
+            ods:bmk_forum (bmk_posts.U_NAME, bmk_posts.WAI_NAME)
+	    sioc:container_of
+	    ods:bmk_post (bmk_posts.U_NAME, bmk_posts.WAI_NAME, bmk_posts.BD_BOOKMARK_ID) .
+
+	    ods:user (bmk_posts.U_NAME)
+	    sioc:creator_of
+	    ods:bmk_post (bmk_posts.U_NAME, bmk_posts.WAI_NAME, bmk_posts.BD_BOOKMARK_ID) .
+
+	    ods:bmk_post (bmk_tags.U_NAME, bmk_tags.WAM_INST, bmk_tags.ITEM_ID)
+	    sioc:topic
+	    ods:tag (bmk_tags.U_NAME, bmk_tags.BD_TAG) .
+
+	    ods:tag (bmk_tags.U_NAME, bmk_tags.BD_TAG) a skos:Concept ;
+	    skos:prefLabel bmk_tags.BD_TAG ;
+	    skos:isSubjectOf ods:bmk_post (bmk_tags.U_NAME, bmk_tags.WAM_INST, bmk_tags.ITEM_ID) .
+	    # end Bookmark
+
+            # Briefcase
+	    ods:odrive_post (odrv_posts.RES_FULL_PATH) a foaf:Document ;
+	    dc:title odrv_posts.RES_NAME ;
+	    dct:created odrv_posts.RES_CREATED ;
+	    dct:modified odrv_posts.RES_MODIFIED ;
+	    sioc:content odrv_posts.RES_DESCRIPTION ;
+	    sioc:has_creator ods:user (odrv_posts.U_OWNER) ;
+	    foaf:maker ods:person (odrv_posts.U_OWNER) ;
+	    sioc:has_container ods:odrive_forum (odrv_posts.U_MEMBER, odrv_posts.WAI_NAME) .
+
+	    ods:odrive_forum (odrv_posts.U_MEMBER, odrv_posts.WAI_NAME)
+	    sioc:container_of
+	    ods:odrive_post (odrv_posts.RES_FULL_PATH) .
+
+	    ods:user (odrv_posts.U_OWNER)
+	    sioc:creator_of
+	    ods:odrive_post (odrv_posts.RES_FULL_PATH) .
+
+	    ods:odrive_post (odrv_tags.RES_FULL_PATH)
+	    sioc:topic
+	    ods:tag (odrv_tags.U_OWNER, odrv_tags.TAG) .
+
+	    ods:tag (odrv_tags.U_OWNER, odrv_tags.TAG) a skos:Concept ;
+	    skos:prefLabel odrv_tags.TAG ;
+	    skos:isSubjectOf ods:odrive_post (odrv_tags.RES_FULL_PATH) .
+            # end Briefcase
+
+            # Feeds
+	    ods:feed (feed_domain.EF_ID) a atom:Feed ;
+	    sioc:link ods:proxy (feed_domain.EF_URI) ;
+	    atom:link ods:proxy (feed_domain.EF_URI) ;
+	    atom:title feed_domain.EF_TITLE ;
+	    sioc:has_parent ods:feed_mgr (feed_domain.U_NAME, feed_domain.WAI_NAME) .
+
+	    ods:feed_mgr (feed_domain.U_NAME, feed_domain.WAI_NAME)
+	    sioc:parent_of ods:feed (feed_domain.EF_ID) .
+
+
+	    ods:feed_item (feed_tags.EFI_FEED_ID, feed_tags.EFID_ITEM_ID)
+	    sioc:topic
+	    ods:tag (feed_tags.U_NAME, feed_tags.EFID_TAG) .
+
+	    ods:tag (feed_tags.U_NAME, feed_tags.EFID_TAG) a skos:Concept ;
+	    skos:prefLabel feed_tags.EFID_TAG ;
+	    skos:isSubjectOf ods:feed_item (feed_tags.EFI_FEED_ID, feed_tags.EFID_ITEM_ID) .
+
+	    ods:feed_comment (feed_comments.U_NAME, feed_comments.WAI_NAME, feed_comments.EFIC_ITEM_ID, feed_comments.EFIC_ID)
+	    a sioct:Comment ;
+	    dc:title feed_comments.EFIC_TITLE ;
+	    sioc:content feed_comments.EFIC_COMMENT ;
+	    dct:modified feed_comments.LAST_UPDATE ;
+	    dct:created feed_comments.LAST_UPDATE ;
+	    sioc:link ods:proxy (feed_comments.LINK) ;
+	    sioc:has_container ods:feed (feed_comments.EFI_FEED_ID) ;
+	    sioc:reply_of ods:feed_item (feed_comments.EFI_FEED_ID, feed_comments.EFIC_ITEM_ID) ;
+	    foaf:maker ods:proxy (feed_comments.EFIC_U_URL) .
+
+	    ods:proxy (feed_comments.EFIC_U_URL) a foaf:Person ;
+	    foaf:name feed_comments.EFIC_U_NAME;
+	    foaf:mbox ods:mbox (feed_comments.EFIC_U_MAIL) .
+
+            ods:feed (feed_comments.EFI_FEED_ID)
+	    sioc:container_of
+            ods:feed_comment (feed_comments.U_NAME, feed_comments.WAI_NAME, feed_comments.EFIC_ITEM_ID, feed_comments.EFIC_ID) .
+
+            ods:feed_item (feed_comments.EFI_FEED_ID, feed_comments.EFIC_ITEM_ID)
+	    sioc:has_reply
+	    ods:feed_comment (feed_comments.U_NAME, feed_comments.WAI_NAME, feed_comments.EFIC_ITEM_ID, feed_comments.EFIC_ID) .
+
+            ods:feed_item (feed_links.EFI_FEED_ID, feed_links.EFI_ID)
+	    sioc:links_to
+	    ods:proxy (feed_links.EFIL_LINK) .
+
+	    ods:feed_item (feed_atts.EFI_FEED_ID, feed_atts.EFI_ID)
+	    sioc:attachment
+	    ods:proxy (feed_atts.EFIE_URL) .
+
+	    ods:feed_item (feed_posts.EFI_FEED_ID, feed_posts.EFI_ID) a atom:Entry ;
+	    sioc:has_container ods:feed (feed_posts.EFI_FEED_ID) ;
+	    dc:title feed_posts.EFI_TITLE ;
+	    dct:created feed_posts.PUBLISH_DATE ;
+	    dct:modified feed_posts.PUBLISH_DATE ;
+	    sioc:link ods:proxy (feed_posts.EFI_LINK) ;
+	    sioc:content feed_posts.EFI_DESCRIPTION ;
+	    atom:title feed_posts.EFI_TITLE ;
+	    atom:source ods:feed (feed_posts.EFI_FEED_ID) ;
+	    atom:published feed_posts.PUBLISH_DATE ;
+	    atom:updated feed_posts.PUBLISH_DATE ;
+	    atom:content ods:feed_item_text (feed_posts.EFI_FEED_ID, feed_posts.EFI_ID) .
+
+	    ods:feed (feed_posts.EFI_FEED_ID) sioc:container_of ods:feed_item (feed_posts.EFI_FEED_ID, feed_posts.EFI_ID) .
+
+	    ods:feed_item_text (feed_posts.EFI_FEED_ID, feed_posts.EFI_ID) a atom:Content ;
+	    atom:type "text/xhtml" ;
+	    atom:lang "en-US" ;
+	    atom:body feed_posts.EFI_DESCRIPTION .
+
+	    ods:feed (feed_posts.EFI_FEED_ID)
+	    atom:contains
+	    ods:feed_item (feed_posts.EFI_FEED_ID, feed_posts.EFI_ID) .
+            # end Feeds
+
+	    # Photo
+	    ods:photo_post (photo_posts.RES_FULL_PATH) a exif:IFD ;
+	    dc:title photo_posts.RES_NAME ;
+	    dct:created photo_posts.RES_CREATED ;
+	    dct:modified photo_posts.RES_MODIFIED ;
+	    sioc:content photo_posts.RES_DESCRIPTION ;
+	    sioc:has_creator ods:user (photo_posts.U_OWNER) ;
+	    foaf:maker ods:person (photo_posts.U_OWNER) ;
+	    sioc:link ods:proxy (photo_posts.RES_LINK) ;
+	    sioc:has_container ods:photo_forum (photo_posts.U_MEMBER, photo_posts.WAI_NAME) .
+
+	    ods:photo_forum (photo_posts.U_MEMBER, photo_posts.WAI_NAME)
+	    sioc:container_of
+	    ods:photo_post (photo_posts.RES_FULL_PATH) .
+
+	    ods:user (photo_posts.U_OWNER)
+	    sioc:creator_of
+	    ods:photo_post (photo_posts.RES_FULL_PATH) .
+
+	    ods:photo_post (photo_tags.RES_FULL_PATH)
+	    sioc:topic
+	    ods:tag (photo_tags.U_MEMBER, photo_tags.RES_TAG) .
+
+	    ods:tag (photo_tags.U_MEMBER, photo_tags.RES_TAG) a skos:Concept ;
+	    skos:prefLabel photo_tags.RES_TAG ;
+	    skos:isSubjectOf ods:photo_post (photo_tags.RES_FULL_PATH) .
+
+	    ods:photo_comment (photo_comments.RES_FULL_PATH, photo_comments.COMMENT_ID) a sioct:Comment ;
+	    sioc:reply_of ods:photo_post (photo_comments.RES_FULL_PATH) ;
+	    sioc:has_container ods:photo_forum (photo_comments.U_MEMBER, photo_comments.WAI_NAME) ;
+	    dc:title photo_comments.RES_NAME ;
+	    dct:created photo_comments.CREATE_DATE ;
+	    dct:modified photo_comments.MODIFY_DATE ;
+	    sioc:content photo_comments.TEXT ;
+	    foaf:maker ods:person (photo_comments.U_MAKER) .
+
+	    ods:photo_post (photo_comments.RES_FULL_PATH)
+	    sioc:has_reply
+	    ods:photo_comment (photo_comments.RES_FULL_PATH, photo_comments.COMMENT_ID) .
+	    # end Photo
+
+	    # Polls
+	    # end Polls
+
+	    # Mail
+	    # end Mail
+
+	    # Wiki
+            ods:wiki_post (wiki_posts.U_NAME, wiki_posts.CLUSTERNAME, wiki_posts.LOCALNAME) a wikiont:Article ;
+	    dc:title wiki_posts.LOCALNAME ;
+	    dct:created wiki_posts.RES_CREATED ;
+	    dct:modified wiki_posts.RES_MODIFIED ;
+	    sioc:content wiki_posts.RES_CONTENT ;
+	    sioc:has_creator ods:user (wiki_posts.U_NAME) ;
+	    foaf:maker ods:person (wiki_posts.U_NAME) ;
+	    sioc:has_container ods:wiki_forum (wiki_posts.U_NAME, wiki_posts.CLUSTERNAME) .
+
+	    ods:wiki_forum (wiki_posts.U_NAME, wiki_posts.CLUSTERNAME)
+	    sioc:container_of
+	    ods:wiki_post (wiki_posts.U_NAME, wiki_posts.CLUSTERNAME, wiki_posts.LOCALNAME) .
+
+	    ods:user (wiki_posts.U_NAME)
+	    sioc:creator_of
+	    ods:wiki_post (wiki_posts.U_NAME, wiki_posts.CLUSTERNAME, wiki_posts.LOCALNAME) .
+
+	    # end Wiki
+
+            # Community
+	    ods:community_forum (community.C_OWNER, community.CM_COMMUNITY_ID) a sioc:Community ;
+	    sioc:has_part ods:forum (community.A_OWNER, community.A_TYPE, community.CM_MEMBER_APP) .
+
+	    ods:forum (community.A_OWNER, community.A_TYPE, community.CM_MEMBER_APP)
+	    sioc:part_of
+	    ods:community_forum (community.C_OWNER, community.CM_COMMUNITY_ID) .
+            # end Community
+
+	    # NNTP
+	    ods:nntp_forum (nntp_groups.NG_NAME) a sioct:MessageBoard ;
+	    sioc:id nntp_groups.NG_NAME ;
+	    sioc:description nntp_groups.NG_DESC .
+
+	    ods:nntp_post (nntp_posts.NG_NAME, nntp_posts.NM_ID) a sioct:BoardPost ;
+	    sioc:content nntp_posts.NM_BODY ;
+	    dc:title nntp_posts.FTHR_SUBJ ;
+	    dct:created  nntp_posts.REC_DATE ;
+	    dct:modified nntp_posts.REC_DATE ;
+	    foaf:maker ods:proxy (nntp_posts.MAKER) ;
+	    sioc:reply_of ods:nntp_post (nntp_posts.NG_NAME, nntp_posts.FTHR_REFER) ;
+	    sioc:has_container ods:nntp_forum (nntp_posts.NG_NAME) .
+
+	    ods:nntp_post (nntp_posts.NG_NAME, nntp_posts.FTHR_REFER)
+	    sioc:has_reply
+	    ods:nntp_post (nntp_posts.NG_NAME, nntp_posts.NM_ID) .
+
+	    ods:nntp_forum (nntp_posts.NG_NAME)
+	    sioc:container_of
+	    ods:nntp_post (nntp_posts.NG_NAME, nntp_posts.NM_ID) .
+
+
+	    ods:nntp_role (nntp_groups.NG_NAME)
+	    sioc:has_scope
+	    ods:nntp_forum (nntp_groups.NG_NAME) .
+
+	    ods:nntp_forum (nntp_groups.NG_NAME)
+	    sioc:scope_of
+	    ods:nntp_role (nntp_groups.NG_NAME) .
+
+	    ods:user (nntp_users.U_NAME)
+	    sioc:has_function
+	    ods:nntp_role (nntp_users.NG_NAME) .
+
+	    ods:nntp_role (nntp_users.NG_NAME)
+	    sioc:function_of
+	    ods:user (nntp_users.U_NAME) .
+
+	    ods:nntp_post (nntp_links.NG_NAME, nntp_links.NML_MSG_ID)
+	    sioc:links_to
+	    ods:proxy (nntp_links.NML_URL) .
+	    # end NNTP
+
+	  } .
+    } .
+;
+]]></programlisting>
+<para><emphasis>URL Rewrite Rules for ODS</emphasis></para>
+<programlisting><![CDATA[
+create procedure DB.DBA.URL_REW_ODS_ACCEPT ()
+{
+  declare accept, ret any;
+  accept := http_request_header (http_request_header (), 'Accept');
+  if (not isstring (accept))
+    return null;
+  ret := null;
+  if (regexp_match ('(application|text)/rdf.(xml|n3|turtle|ttl)', accept) is not null)
+    {
+      if (regexp_match ('application/rdf.xml', accept) is not null)
+	{
+	  ret := 'rdf';
+	}
+      else if (regexp_match ('text/rdf.n3', accept) is not null)
+	{
+	  ret := 'n3';
+	}
+      else if (regexp_match ('application/rdf.turtle', accept) is not null or
+	    regexp_match ('application/rdf.ttl', accept) is not null)
+	{
+	  ret := 'n3';
+	}
+    }
+  return ret;
+};
+
+create procedure  DB.DBA.URL_REW_ODS_SPQ (in graph varchar, in iri varchar, in acc varchar)
+{
+  declare q, ret any;
+  iri := replace (iri, '''', '%27');
+  iri := replace (iri, '<', '%3C');
+  iri := replace (iri, '>', '%3E');
+  q := sprintf ('define input:inference <%s> DESCRIBE <%s> FROM <%s>', graph, iri, graph);
+  ret := sprintf ('/sparql?query=%U&format=%U', q, acc);
+  return ret;
+};
+
+create procedure DB.DBA.URL_REW_ODS_USER (in par varchar, in fmt varchar, in val varchar)
+{
+--  dbg_obj_print (current_proc_name ());
+  declare acc, ret any;
+  declare q, iri, graph any;
+
+  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
+  if (acc is not null)
+    {
+      graph := sioc..get_graph ();
+      iri := sprintf ('%s/%U', graph, val);
+      if (val like 'person/%')
+	{
+	  val := substring (val, 8, length (val));
+	  ret := sprintf ('/ods/foaf.vsp?uname=%U&fmt=%U', val, acc);
+	}
+      else
+        ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+    }
+  else
+    {
+      http_header (http_header_get ()||sprintf ('X-XRDS-Location: %s\r\n',
+	    DB.DBA.wa_link (1, '/dataspace/'||val||'/yadis.xrds')));
+
+      if (val like 'person/%')
+	val := substring (val, 8, length (val));
+      ret := sprintf ('/ods/uhome.vspx?page=1&ufname=%s', val);
+    }
+  return ret;
+};
+
+create procedure DB.DBA.URL_REW_ODS_USER_GEM (in par varchar, in fmt varchar, in val varchar)
+{
+--  dbg_obj_print (current_proc_name ());
+  declare acc, ret any;
+  declare q, iri, graph, path, is_person any;
+
+  path := http_path ();
+  if (path like '%.rdf')
+    acc := 'rdf';
+  else if (path like '%.n3')
+    acc := 'n3';
+  else if (path like '%.ttl')
+    acc := 'n3';
+  else if (path like '%/yadis.xrds')
+    acc := 'yadis';
+  else
+    acc := 'rdf';
+
+  if (acc <> 'yadis')
+    {
+      is_person := matches_like (path, '%/about.%');
+      graph := sioc..get_graph ();
+      if (is_person)
+	{
+          --iri := sprintf ('%s/person/%U', graph, val);
+	  ret := sprintf ('/ods/foaf.vsp?uname=%U&fmt=%U', val, acc);
+	}
+      else
+	{
+          iri := sprintf ('%s/%U', graph, val);
+          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+	}
+    }
+  else
+    {
+      ret := sprintf ('/ods/yadis.vsp?uname=%U', val);
+    }
+  return ret;
+};
+
+create procedure DB.DBA.URL_REW_ODS_GEM (in par varchar, in fmt varchar, in val varchar)
+{
+--  dbg_obj_print (current_proc_name ());
+  declare acc, ret any;
+  declare q, iri, graph, path, pos any;
+
+  path := http_path ();
+  if (path like '%.rdf')
+    acc := 'rdf';
+  else if (path like '%.n3')
+    acc := 'n3';
+  else if (path like '%.ttl')
+    acc := 'n3';
+  else
+    acc := 'rdf';
+  graph := sioc..get_graph ();
+  pos := strrchr (path, '/');
+  path := subseq (path, 0, pos);
+
+  if (val = 'person')
+    {
+      pos := strrchr (path, '/');
+      val := subseq (path, pos+1, length (path));
+      ret := sprintf ('/ods/foaf.vsp?uname=%U&fmt=%U', val, acc);
+    }
+  else
+    {
+      iri := sprintf ('http://%s%s', sioc..get_cname (), path);
+      ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+    }
+  return ret;
+};
+
+
+create procedure DB.DBA.URL_REW_ODS_APP (in par varchar, in fmt varchar, in val varchar)
+{
+--  dbg_obj_print (current_proc_name (), val);
+  if (par = 'app')
+    return sprintf (fmt, wa_app_to_type (val));
+  return sprintf (fmt, val);
+};
+
+create procedure DB.DBA.URL_REW_ODS_BLOG (in par varchar, in fmt varchar, in val varchar)
+{
+--  dbg_obj_print (par, fmt, val);
+--  dbg_obj_print (current_proc_name (), val);
+  declare acc, ret any;
+
+  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
+  if (acc is not null)
+    {
+      if (par = 'inst')
+	{
+          declare q, iri, graph any;
+          graph := sioc..get_graph ();
+          iri := 'http://' || sioc..get_cname () || http_path ();
+          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+          return ret;
+	}
+      else
+	return '';
+    }
+  else if (par = 'inst')
+    {
+      declare url any;
+      val := split_and_decode (val)[0];
+      url := (SELECT WAM_HOME_PAGE FROM WA_MEMBER WHERE WAM_INST = val AND WAM_MEMBER_TYPE = 1);
+      if (url is not null)
+        val := url;
+      return sprintf (fmt, val);
+    }
+  else if (par = 'id' and val <> '')
+    {
+      if (atoi (val) = 0 and val <> '0')
+	fmt := '%s';
+      else
+        fmt := '?id=%s';
+      return sprintf (fmt, val);
+    }
+};
+
+create procedure DB.DBA.URL_REW_ODS_NNTP (in par varchar, in fmt varchar, in val varchar)
+{
+--  dbg_obj_print (par, fmt, val);
+--  dbg_obj_print (current_proc_name (), val);
+  declare acc, ret any;
+
+  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
+  if (acc is not null)
+    {
+       declare q, iri, graph any;
+       graph := sioc..get_graph ();
+       iri := 'http://' || sioc..get_cname () || http_path ();
+--       dbg_obj_print (iri);
+       ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+       return ret;
+    }
+  else if (par = 'grp')
+    {
+      declare gid int;
+      val := split_and_decode (val)[0];
+      gid := (SELECT NG_GROUP FROM DB.DBA.NEWS_GROUPS WHERE NG_NAME = val);
+      ret := sprintf ('/nntpf/nntpf_nthread_view.vspx?group=%d', gid);
+      return ret;
+    }
+  else if (par = 'post')
+    {
+      ret := sprintf ('/nntpf/nntpf_disp_article.vspx?id=%U', encode_base64 (val));
+      return ret;
+    }
+}
+;
+
+create procedure DB.DBA.URL_REW_ODS_XD (in par varchar, in fmt varchar, in val varchar)
+{
+--  dbg_obj_print (par, fmt, val);
+--  dbg_obj_print (current_proc_name (), val);
+  declare acc, ret any;
+
+  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
+  if (acc is not null)
+    {
+       declare q, iri, graph any;
+       graph := sioc..get_graph ();
+       iri := 'http://' || sioc..get_cname () || http_path ();
+--       dbg_obj_print (iri);
+       ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+       return ret;
+    }
+  else if (par = 'inst')
+    {
+      val := split_and_decode (val)[0];
+      ret := (SELECT WAM_HOME_PAGE FROM WA_MEMBER WHERE WAM_INST = val and WAM_MEMBER_TYPE = 1);
+      return ret;
+    }
+}
+;
+
+create procedure DB.DBA.URL_REW_ODS_WIKI (in par varchar, in fmt varchar, in val varchar)
+{
+--  dbg_obj_print (par, fmt, val);
+--  dbg_obj_print (current_proc_name (), val);
+  declare acc, ret any;
+
+  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
+  if (acc is not null)
+    {
+       declare q, iri, graph any;
+       graph := sioc..get_graph ();
+       iri := 'http://' || sioc..get_cname () || http_path ();
+--       dbg_obj_print (iri);
+       ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+       return ret;
+    }
+  else if (par = 'inst')
+    {
+      declare _inst DB.DBA.web_app;
+      _inst := (SELECT WAI_INST FROM WA_INSTANCE WHERE WAI_NAME = val);
+      ret := _inst.wa_post_url (null, null, val, val);
+--      dbg_obj_print ('ret', ret);
+      return ret;
+    }
+  else if (par = 'post')
+    {
+      return '/'||val;
+    }
+}
+;
+
+create procedure DB.DBA.URL_REW_ODS_PHOTO (in par varchar, in fmt varchar, in val varchar)
+{
+--  dbg_obj_print (par, fmt, val);
+--  dbg_obj_print (current_proc_name (), val);
+  declare acc, ret any;
+
+  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
+  if (acc is not null)
+    {
+       declare q, iri, graph any;
+       graph := sioc..get_graph ();
+       iri := 'http://' || sioc..get_cname () || http_path ();
+--       dbg_obj_print (iri);
+       ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+       return ret;
+    }
+  else if (par = 'inst')
+    {
+      val := split_and_decode (val)[0];
+      ret := (SELECT WAM_HOME_PAGE FROM WA_MEMBER WHERE WAM_INST = val AND WAM_MEMBER_TYPE = 1);
+      return ret;
+    }
+  else if (par = 'post')
+    {
+      declare id int;
+      declare col, nam varchar;
+      declare exit handler for not found
+	{
+	  signal ('22023', sprintf ('The resource %d doesn''t exists', id));
+	};
+      id := atoi(ltrim(val, '/'));
+      SELECT RES_FULL_PATH INTO nam FROM WS.WS.SYS_DAV_RES WHERE RES_ID = id;
+      return nam;
+    }
+}
+;
+
+create procedure DB.DBA.URL_REW_ODS_ADDRESSBOOK (in par varchar, in fmt varchar, in val varchar)
+{
+  declare acc, ret any;
+
+  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
+  if (acc is not null)
+    {
+      if (par = 'instance')
+      	{
+          declare q, iri, graph any;
+          graph := sioc..get_graph ();
+          iri := 'http://' || sioc..get_cname () || http_path ();
+          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+          return ret;
+	      }
+      else
+	      return '';
+    }
+  else if (par = 'instance')
+    {
+      declare id, url any;
+      val := split_and_decode (val)[0];
+      id := AB.WA.domain_id (val);
+      if (id is not null) {
+        url := AB.WA.ab_url (id);
+        if (url is not null)
+          val := url;
+      }
+      return sprintf (fmt, val);
+    }
+  else if (par = 'params')
+    {
+      if (atoi (val) = 0 and val <> '0')
+       	fmt := '%s';
+      else
+        fmt := '?id=%s';
+      return sprintf (fmt, val);
+    }
+}
+;
+
+create procedure DB.DBA.URL_REW_ODS_BOOKMARK (in par varchar, in fmt varchar, in val varchar)
+{
+  declare acc, ret any;
+
+  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
+  if (acc is not null)
+    {
+      if (par = 'instance')
+      	{
+          declare q, iri, graph any;
+          graph := sioc..get_graph ();
+          iri := 'http://' || sioc..get_cname () || http_path ();
+          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+          return ret;
+	      }
+      else
+	      return '';
+    }
+  else if (par = 'instance')
+    {
+      declare id, url any;
+      val := split_and_decode (val)[0];
+      id := BMK.WA.domain_id (val);
+      if (id is not null) {
+        url := BMK.WA.bookmark_url (id);
+        if (url is not null)
+          val := url;
+      }
+      return sprintf (fmt, val);
+    }
+  else if (par = 'params')
+    {
+      if (atoi (val) = 0 and val <> '0')
+       	fmt := '%s';
+      else
+        fmt := '?id=%s';
+      return sprintf (fmt, val);
+    }
+}
+;
+
+create procedure DB.DBA.URL_REW_ODS_BRIEFCASE (in par varchar, in fmt varchar, in val varchar)
+{
+  declare acc, ret any;
+
+  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
+  if (acc is not null)
+    {
+      if (par = 'instance')
+      	{
+          declare q, iri, graph any;
+          graph := sioc..get_graph ();
+          iri := 'http://' || sioc..get_cname () || http_path ();
+          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+          return ret;
+	      }
+      else
+	      return '';
+    }
+  else if (par = 'instance')
+    {
+      declare id, url any;
+      val := split_and_decode (val)[0];
+      id := ODRIVE.WA.domain_id (val);
+      if (id is not null) {
+        url := ODRIVE.WA.odrive_url (id);
+        if (url is not null)
+          val := url;
+      }
+      return sprintf (fmt, val);
+    }
+  else if (par = 'params')
+    {
+      if (atoi (val) = 0 and val <> '0')
+       	fmt := '%s';
+      else
+        fmt := '?id=%s';
+      return sprintf (fmt, val);
+    }
+}
+;
+
+create procedure DB.DBA.URL_REW_ODS_CALENDAR (in par varchar, in fmt varchar, in val varchar)
+{
+  declare acc, ret any;
+
+  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
+  if (acc is not null)
+    {
+      if (par = 'instance')
+      	{
+          declare q, iri, graph any;
+          graph := sioc..get_graph ();
+          iri := 'http://' || sioc..get_cname () || http_path ();
+          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+          return ret;
+	      }
+      else
+	      return '';
+    }
+  else if (par = 'instance')
+    {
+      declare id, url any;
+      val := split_and_decode (val)[0];
+      id := CAL.WA.domain_id (val);
+      if (id is not null) {
+        url := CAL.WA.calendar_url (id);
+        if (url is not null)
+          val := url;
+      }
+      return sprintf (fmt, val);
+    }
+  else if (par = 'params')
+    {
+      if (atoi (val) = 0 and val <> '0')
+       	fmt := '%s';
+      else
+        fmt := '?id=%s';
+      return sprintf (fmt, val);
+    }
+}
+;
+
+create procedure DB.DBA.URL_REW_ODS_FEEDS (in par varchar, in fmt varchar, in val varchar)
+{
+  declare acc, ret any;
+
+  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
+  if (acc is not null)
+    {
+      if (par = 'instance')
+      	{
+          declare q, iri, graph any;
+          graph := sioc..get_graph ();
+          iri := 'http://' || sioc..get_cname () || http_path ();
+          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+          return ret;
+	      }
+      else
+	      return '';
+    }
+  else if (par = 'instance')
+    {
+      declare id, url any;
+      val := split_and_decode (val)[0];
+      id := ENEWS.WA.domain_id (val);
+      if (id is not null) {
+        url := ENEWS.WA.enews_url (id) || 'news.vspx';
+        if (url is not null)
+          val := url;
+      }
+      return sprintf (fmt, val);
+    }
+  else if (par = 'params')
+    {
+      if (atoi (val) = 0 and val <> '0')
+       	fmt := '%s';
+      else
+        fmt := '?id=%s';
+      return sprintf (fmt, val);
+    }
+}
+;
+
+create procedure DB.DBA.URL_REW_ODS_POLLS (in par varchar, in fmt varchar, in val varchar)
+{
+  declare acc, ret any;
+
+  acc := DB.DBA.URL_REW_ODS_ACCEPT ();
+  if (acc is not null)
+    {
+      if (par = 'instance')
+      	{
+          declare q, iri, graph any;
+          graph := sioc..get_graph ();
+          iri := 'http://' || sioc..get_cname () || http_path ();
+          ret := DB.DBA.URL_REW_ODS_SPQ (graph, iri, acc);
+          return ret;
+	      }
+      else
+	      return '';
+    }
+  else if (par = 'instance')
+    {
+      declare id, url any;
+      val := split_and_decode (val)[0];
+      id := POLLS.WA.domain_id (val);
+      if (id is not null) {
+        url := POLLS.WA.polls_url (id);
+        if (url is not null)
+          val := url;
+      }
+      return sprintf (fmt, val);
+    }
+  else if (par = 'params')
+    {
+      if (atoi (val) = 0 and val <> '0')
+       	fmt := '%s';
+      else
+        fmt := '?id=%s';
+      return sprintf (fmt, val);
+    }
+}
+;
+
+create procedure DB.DBA.URL_REW_ODS_FOAF_EXT (in par varchar, in fmt varchar, in val varchar)
+{
+  if (par = '*accept*')
+    {
+      declare ext any;
+      ext := 'rdf';
+      if (val = 'text/rdf+n3')
+	ext := 'n3';
+      return sprintf (fmt, ext);
+    }
+  else
+    return sprintf (fmt, val);
+}
+;
+
+create procedure ur_ods_rdf_doc (in path varchar)
+{
+  declare r any;
+  r := regexp_match ('[^/]*\x24', path);
+  return r||'#this';
+};
+
+create procedure ur_ods_html_doc (in path varchar)
+{
+  declare pos, r any;
+  if (path like '%/foaf.%')
+    {
+      pos := strrchr (path, '/');
+    }
+  else if (path like '%#%')
+    {
+      pos := strrchr (path, '#');
+    }
+  if (pos > 0)
+    r := subseq (path, 0, pos);
+  else
+    r := '/';
+  return r;
+};
+-- ODS Rules
+
+-- http://cname/dataspace/uname
+-- http://cname/dataspace/person/uname
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule1', 1,
+    '/dataspace/((person/)?[^/#]*)', vector('ufname'), 1,
+    '%s', vector('ufname'),
+    'DB.DBA.URL_REW_ODS_USER');
+
+-- http://cname/dataspace/uname with Accept will do 303 to the /sparql
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule2', 1,
+    '/dataspace/([^/]*)', vector('ufname'), 1,
+    '/sparql?query=define+input%%3Ainference+%%3Chttp%%3A//^{URIQADefaultHost}^/dataspace%%3E+DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^/dataspace/%U%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/dataspace%%3E&format=%U', vector('ufname', '*accept*'),
+    null,
+    '(application|text)/rdf.(xml|n3|turtle|ttl)',
+    0,
+    303);
+
+-- http://cname/dataspace/uname/app_type
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule3', 1,
+    '/dataspace/((?!person)[^/]*)/([^\\./]*)', vector('ufname', 'app'), 2,
+    '/ods/app_inst.vspx?app=%s&ufname=%s&l=1', vector('app', 'ufname'),
+    'DB.DBA.URL_REW_ODS_APP');
+
+-- http://cname/dataspace/uname/file.ext
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule4', 1,
+    '/dataspace/([^/]*)/(sioc|about|yadis)\\.(rdf|n3|ttl|xrds)', vector('ufname', 'file', 'fmt'), 3,
+    '%s', vector('ufname'),
+    'DB.DBA.URL_REW_ODS_USER_GEM');
+
+-- Rules for FOAF profile
+
+-- http://cname/dataspace/person/uname with Accept, do 303 to http://cname/dataspace/person/uname/foaf.ext
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule5', 1,
+    '/dataspace/person/([^/#]*)/?', vector('ufname'), 1,
+    '/dataspace/person/%U/foaf.%s', vector('ufname', '*accept*'),
+    'DB.DBA.URL_REW_ODS_FOAF_EXT',
+    '(application|text)/rdf.(xml|n3|turtle|ttl)',
+    2,
+    303);
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule6', 1,
+    '/dataspace/person/([^/]*)/page/([^/]*)/?', vector('ufname', 'page'), 1,
+    '/dataspace/person/%U/foaf.%s?page=%s', vector('ufname', '*accept*', 'page'),
+    'DB.DBA.URL_REW_ODS_FOAF_EXT',
+    '(application|text)/rdf.(xml|n3|turtle|ttl)',
+    2,
+    303);
+
+-- http://cname/dataspace/person/uname/foaf.ext
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_rule7', 1,
+    '/dataspace/person/([^/]*)/foaf.(rdf|n3|ttl)', vector('ufname', 'fmt'), 1,
+    '/ods/foaf.vsp?uname=%U&fmt=%U', vector('ufname', 'fmt'),
+    null,
+    null,
+    2,
+    null);
+
+-- App Instance Gem
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_post_gem_rule', 1,
+    '/dataspace/([^/]*)/([^/]*)/([^/]*/)?([^/]*/)?(sioc|about)\\.(rdf|n3|ttl)', vector('ufname', 'app', 'inst'), 4,
+    '%s', vector('ufname'),
+    'DB.DBA.URL_REW_ODS_GEM');
+
+
+-- Weblog Rules
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_blog_rule1', 1,
+    '/dataspace/([^/]*)/weblog/([^/]*)', vector('ufname', 'inst'), 2,
+    '%s', vector('inst'),
+    'DB.DBA.URL_REW_ODS_BLOG');
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_blog_rule2', 1,
+    '/dataspace/([^/]*)/weblog/([^/]*)/([^/]*)', vector('ufname', 'inst', 'id'), 3,
+    '%s%s', vector('inst', 'id'),
+    'DB.DBA.URL_REW_ODS_BLOG');
+
+-- Discussion rules
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_nntp_rule1', 1,
+    '/dataspace/discussion/([^/]*)', vector('grp'), 1,
+    '%s', vector('grp'),
+    'DB.DBA.URL_REW_ODS_NNTP');
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_nntp_rule2', 1,
+    '/dataspace/discussion/([^/]*)/((?!sioc)(?!about)[^/]*)', vector('grp', 'post'), 2,
+    '%s', vector('post'),
+    'DB.DBA.URL_REW_ODS_NNTP');
+
+-- Community
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_xd_rule1', 1,
+    '/dataspace/([^/]*)/community/([^/]*)', vector('ufname', 'inst'), 2,
+    '%s', vector('inst'),
+    'DB.DBA.URL_REW_ODS_XD');
+
+-- Wiki
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_wiki_rule1', 1,
+    '/dataspace/([^/]*)/wiki/([^/]*)', vector('ufname', 'inst'), 2,
+    '%s', vector('inst'),
+    'DB.DBA.URL_REW_ODS_WIKI');
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_wiki_rule2', 1,
+    '/dataspace/([^/]*)/wiki/([^/]*)/([^/]*)', vector('ufname', 'inst', 'post'), 2,
+    '%s%s', vector('inst', 'post'),
+    'DB.DBA.URL_REW_ODS_WIKI');
+
+-- Gallery
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_photo_rule1', 1,
+    '/dataspace/([^/]*)/photos/([^/]*)', vector('ufname', 'inst'), 2,
+    '%s', vector('inst'),
+    'DB.DBA.URL_REW_ODS_PHOTO');
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('ods_photo_rule2', 1,
+    '/dataspace/([^/]*)/photos/([^/]*)/([^/]*)', vector('ufname', 'inst', 'post'), 2,
+    '%s', vector('post'),
+    'DB.DBA.URL_REW_ODS_PHOTO');
+
+
+-- AddressBook
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_addressbook_rule1',
+    1,
+    '/dataspace/([^/]*)/addressbook/([^/]*)',
+    vector('uname', 'instance'),
+    2,
+    '%s', vector('instance'),
+    'DB.DBA.URL_REW_ODS_ADDRESSBOOK');
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_addressbook_rule2',
+    1,
+    '/dataspace/([^/]*)/addressbook/([^/]*)/(.*)',
+    vector('uname', 'instance', 'params'),
+    3,
+    '%s%s',
+    vector('instance', 'params'),
+    'DB.DBA.URL_REW_ODS_ADDRESSBOOK');
+
+-- Bookmark
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_bookmark_rule1',
+    1,
+    '/dataspace/([^/]*)/bookmark/([^/]*)',
+    vector('uname', 'instance'),
+    2,
+    '%s', vector('instance'),
+    'DB.DBA.URL_REW_ODS_BOOKMARK');
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_bookmark_rule2',
+    1,
+    '/dataspace/([^/]*)/bookmark/([^/]*)/(.*)',
+    vector('uname', 'instance', 'params'),
+    3,
+    '%s%s',
+    vector('instance', 'params'),
+    'DB.DBA.URL_REW_ODS_BOOKMARK');
+
+-- Briefcase
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_briefcase_rule1',
+    1,
+    '/dataspace/([^/]*)/briefcase/([^/]*)',
+    vector('uname', 'instance'),
+    2,
+    '%s', vector('instance'),
+    'DB.DBA.URL_REW_ODS_BRIEFCASE');
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_briefcase_rule2',
+    1,
+    '/dataspace/([^/]*)/briefcase/([^/]*)/(.*)',
+    vector('uname', 'instance', 'params'),
+    3,
+    '%s%s',
+    vector('instance', 'params'),
+    'DB.DBA.URL_REW_ODS_BRIEFCASE');
+
+-- Calendar
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_calendar_rule1',
+    1,
+    '/dataspace/([^/]*)/calendar/([^/]*)',
+    vector('uname', 'instance'),
+    2,
+    '%s', vector('instance'),
+    'DB.DBA.URL_REW_ODS_CALENDAR');
+
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_calendar_rule2',
+    1,
+    '/dataspace/([^/]*)/calendar/([^/]*)/(.*)',
+    vector('uname', 'instance', 'params'),
+    3,
+    '%s%s',
+    vector('instance', 'params'),
+    'DB.DBA.URL_REW_ODS_CALENDAR');
+
+-- Feeds
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_feeds_rule1',
+    1,
+    '/dataspace/([^/]*)/feeds/([^/]*)',
+    vector('uname', 'instance'),
+    2,
+    '%s', vector('instance'),
+    'DB.DBA.URL_REW_ODS_FEEDS');
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_feeds_rule2',
+    1,
+    '/dataspace/([^/]*)/feeds/([^/]*)/(.*)',
+    vector('uname', 'instance', 'params'),
+    3,
+    '%s%s',
+    vector('instance', 'params'),
+    'DB.DBA.URL_REW_ODS_FEEDS');
+
+-- Polls
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_polls_rule1',
+    1,
+    '/dataspace/([^/]*)/polls/([^/]*)',
+    vector('uname', 'instance'),
+    2,
+    '%s', vector('instance'),
+    'DB.DBA.URL_REW_ODS_POLLS');
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ods_polls_rule2',
+    1,
+    '/dataspace/([^/]*)/polls/([^/]*)/(.*)',
+    vector('uname', 'instance', 'params'),
+    3,
+    '%s%s',
+    vector('instance', 'params'),
+    'DB.DBA.URL_REW_ODS_POLLS');
+
+-- ODS Base rules
+DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_base_rule_list1', 1,
+    	vector(
+	        'ods_rule1', 'ods_rule2', 'ods_rule3', 'ods_rule4'
+	      ));
+
+DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_foaf_rule_list1', 1,
+    	vector(
+	        'ods_rule5', 'ods_rule6', 'ods_rule7'
+	      ));
+
+DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_gems_rule_list1', 1,
+    	vector(
+	        'ods_post_gem_rule'
+	      ));
+
+-- ODS Blog rules
+DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_blog_rule_list1', 1,
+    	vector(
+	   	'ods_blog_rule1', 'ods_blog_rule2'
+	      ));
+
+-- ODS Discussion rules
+DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_nntp_rule_list1', 1,
+    	vector(
+	   	'ods_nntp_rule1', 'ods_nntp_rule2'
+	      ));
+
+-- ODS Community rules
+DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_xd_rule_list1', 1,
+    	vector(
+	   	'ods_xd_rule1'
+	      ));
+
+-- ODS Wiki rules
+DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_wiki_rule_list1', 1,
+    	vector(
+	   	'ods_wiki_rule1', 'ods_wiki_rule2'
+	      ));
+
+-- ODS Gallery rules
+DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_photo_rule_list1', 1,
+    	vector(
+	   	'ods_photo_rule1', 'ods_photo_rule2'
+	      ));
+
+-- ODS AddressBook rules
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'ods_addressbook_rule_list1',
+    1,
+    vector (
+  	 	'ods_addressbook_rule1',
+	    'ods_addressbook_rule2'
+	  ));
+
+-- ODS Bookmark rules
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'ods_bookmark_rule_list1',
+    1,
+    vector (
+  	 	'ods_bookmark_rule1',
+	    'ods_bookmark_rule2'
+	  ));
+
+-- ODS Briefcase rules
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'ods_briefcase_rule_list1',
+    1,
+    vector (
+  	 	'ods_briefcase_rule1',
+	    'ods_briefcase_rule2'
+	  ));
+
+-- ODS Calendar rules
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'ods_calendar_rule_list1',
+    1,
+    vector (
+  	 	'ods_calendar_rule1',
+	    'ods_calendar_rule2'
+	  ));
+
+-- ODS Feeds rules
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'ods_feeds_rule_list1',
+    1,
+    vector (
+  	 	'ods_feeds_rule1',
+	    'ods_feeds_rule2'
+	  ));
+
+-- ODS Polls rules
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'ods_polls_rule_list1',
+    1,
+    vector (
+  	 	'ods_polls_rule1',
+	    'ods_polls_rule2'
+	  ));
+
+-- All ODS Rules
+DB.DBA.URLREWRITE_CREATE_RULELIST ('ods_rule_list1', 1,
+    	vector(
+	  'ods_base_rule_list1',
+	  'ods_foaf_rule_list1',
+	  'ods_blog_rule_list1',
+	  'ods_nntp_rule_list1',
+	  'ods_xd_rule_list1',
+	  'ods_wiki_rule_list1',
+	  'ods_photo_rule_list1',
+	  'ods_addressbook_rule_list1',
+	  'ods_bookmark_rule_list1',
+	  'ods_briefcase_rule_list1',
+	  'ods_calendar_rule_list1',
+	  'ods_feeds_rule_list1',
+	  'ods_polls_rule_list1',
+	  'ods_gems_rule_list1'
+	      ));
+
+DB.DBA.XML_SET_NS_DECL ('ods', 'http://www.openlinksw.com/virtuoso/ods/', 2);
+]]></programlisting>
+</sect2>
+<sect2 id="rdfviewsbusintoplweb">
+      <title>Oplweb to RDF</title>
+<programlisting><![CDATA[
+-- Setup script for RDF view of OpenLink Product Portfolio version 2
+--
+
+/*
+ * This view is currently designed to SPECIFICALLY load on data.openlinksw.com. We recommend you
+ * search for `openlinksw.com'  (as `http://' is sometimes encoded) and replace with either the default
+ * URIQA macro or your own hostname as appropriate.
+ */
+
+-- views to get the codes out instead of the id's
+---- in hindsight these should ALL have been handled with
+---- proper IRI functions like the rest, oh well, no harm AFAIK
+---- will know for next time or might even replace this later.
+DROP VIEW oplweb2.oplweb.product_formats_categories;
+
+CREATE VIEW oplweb2.oplweb.product_formats_categories (
+    product_cat_code, product_cat_id, product_format_code, product_format_id, product_family_id
+  ) as
+SELECT distinct
+  pc.product_cat_code,
+  pc.product_cat_id,
+  pf.product_format_code,
+  pf.product_format_id,
+  pc.product_family_id
+FROM
+  oplweb2.oplweb.product_category pc,
+  oplweb2.oplweb.product_format pf,
+  oplweb2.oplweb.product p
+WHERE
+  p.product_cat_id = pc.product_cat_id and
+  p.product_format_id = pf.product_format_id
+  AND EXISTS (
+	SELECT 1 FROM oplweb2.oplweb.component_archive ca
+	WHERE ca.product_id = p.product_id
+	)
+;
+
+
+DROP VIEW oplweb2.oplweb.product_with_code;
+
+CREATE VIEW oplweb2.oplweb.product_with_code as
+  SELECT p.*, pc.product_cat_code, pf.product_format_code
+  FROM
+  oplweb2.oplweb.product_category pc,
+  oplweb2.oplweb.product_format pf,
+  oplweb2.oplweb.product p
+WHERE
+  p.product_cat_id = pc.product_cat_id and
+  p.product_format_id = pf.product_format_id ;
+
+
+DROP VIEW oplweb2.oplweb.product_category_with_code;
+
+CREATE VIEW oplweb2.oplweb.product_category_with_code as
+  SELECT pc.*, pf.product_family_code
+  from
+  oplweb2.oplweb.product_category pc,
+  oplweb2.oplweb.product_family pf
+where
+  pc.product_family_id = pf.product_family_id ;
+
+
+DROP VIEW oplweb2.oplweb.product_family_features_with_code;
+
+CREATE VIEW oplweb2.oplweb.product_family_features_with_code as
+  SELECT a.*, b.product_family_code
+  from
+  oplweb2.oplweb.product_family_features a,
+  oplweb2.oplweb.product_family b
+where
+  a.product_family_id = b.product_family_id
+;
+
+DROP VIEW oplweb2.oplweb.product_format_features_with_code;
+
+CREATE VIEW oplweb2.oplweb.product_format_features_with_code as
+  SELECT a.*, b.product_format_code
+  from
+  oplweb2.oplweb.product_format_features a,
+  oplweb2.oplweb.product_format b
+where
+  a.product_format_id = b.product_format_id
+;
+
+DROP VIEW oplweb2.oplweb.product_category_features_with_code;
+
+CREATE VIEW oplweb2.oplweb.product_category_features_with_code as
+  SELECT a.*, b.product_cat_code
+  from
+  oplweb2.oplweb.product_category_features a,
+  oplweb2.oplweb.product_category b
+where
+  a.product_cat_id = b.product_cat_id
+;
+
+DROP VIEW oplweb2.oplweb.components_for_rdfs;
+
+CREATE VIEW oplweb2.oplweb.components_for_rdfs as
+  SELECT *, cast(filesize as varchar) as str_filesize
+  from
+  oplweb2.oplweb.components
+;
+
+
+DROP VIEW oplweb2.oplweb.product_release_with_family;
+
+CREATE VIEW oplweb2.oplweb.product_release_with_family as
+  SELECT a.*, b.opsys_family_id, c.dbms_family_id
+  from
+  oplweb2.oplweb.product_release a,
+  oplweb2.oplweb.opsys b,
+  oplweb2.oplweb.dbms_engine c
+where
+  a.opsys_name = b.opsys_name and
+  a.dbms_name = c.dbms_name
+;
+
+drop view oplweb2.oplweb.archive_coverage_osdb;
+
+create view oplweb2.oplweb.archive_coverage_osdb as
+	SELECT distinct
+	  pfam.product_family_id, pfam.product_family_code,
+	  p.product_format_id, pf.product_format_code,
+	  p.product_cat_id, pc.product_cat_code,
+	  p.product_id,
+	  ca.opsys_name,
+	  os.opsys_family_id,
+	  ca.dbms_name,
+	  db.dbms_family_id,
+	  pr.processor_name,
+	  pr.processor_mode_id,
+	  pr.processor_family_id
+	from
+	   oplweb2.oplweb.product p
+  join oplweb2.oplweb.product_category pc on (p.product_cat_id = pc.product_cat_id)
+  join oplweb2.oplweb.product_format pf on (p.product_format_id = pf.product_format_id)
+  join oplweb2.oplweb.product_family pfam on (pc.product_family_id = pfam.product_family_id)
+  join oplweb2.oplweb.component_archive ca on (ca.product_id = p.product_id)
+  join oplweb2.oplweb.opsys os on (os.opsys_name = ca.opsys_name)
+  join oplweb2.oplweb.dbms_engine db on (db.dbms_name = ca.dbms_name)
+  join oplweb2.oplweb.processors pr on (pr.processor_name = os.processor_name and pr.processor_mode_id = os.processor_mode_id)
+;
+
+GRANT SELECT ON oplweb2.oplweb.component_archive TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.component_archive_type TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.component_category TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.component_mode TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.component_type TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.components TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.components_for_rdfs TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.dbms_engine TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.dbms_family TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.download_location TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.download_protocol TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.download_partner TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.opsys TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.opsys_family TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.opsys_type TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.processor_family TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.processor_mode TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.processors TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_benefits TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_benefits_category TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_category TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_category_with_code TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_category_features TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_family TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_family_features TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_features TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_format TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_format_features TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_feature_category TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_release TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_release_features TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.vendor_category TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.vendor_category_family TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.vendors TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_formats_categories TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_with_code TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_family_features_with_code TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_format_features_with_code TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_category_features_with_code TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.product_release_with_family TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON oplweb2.oplweb.archive_coverage_osdb TO "SPARQL", "SPARQL_UPDATE";
+
+
+drop index oplweb2_product_price_format_cat;
+
+create index oplweb2_product_price_format_cat on oplweb2.oplweb.product_price(product_cat_id, product_format_id, product_price_type_id);
+
+drop index oplweb2_product_discount_format_cat;
+
+create index oplweb2_product_discount_format_cat on oplweb2.oplweb.product_general_discount(product_cat_id, product_format_id, product_price_type_id);
+
+
+drop view oplweb2.DBA.license_model_type;
+
+create view oplweb2.DBA.license_model_type (
+	product_release_id, product_cat_id, product_format_id, product_id, product_price_type_id
+	)
+	as
+	SELECT distinct
+	product_release_id,
+	pp.product_cat_id, pp.product_format_id, product_id,
+	product_price_type_id
+	FROM
+	  oplweb2.oplweb.product_price pp,
+	  oplweb2.oplweb.product p
+	WHERE p.product_cat_id = pp.product_cat_id AND
+	p.product_format_id = pp.product_format_id
+	;
+
+grant SELECT on oplweb2.DBA.license_model_type to "SPARQL", "SPARQL_UPDATE";--, rdf;
+
+
+
+drop view oplweb2.DBA.license_model;
+
+create view oplweb2.DBA.license_model as
+  SELECT  distinct
+      product_release_id,
+      pc.product_cat_id,
+      pc.product_format_id,
+      pc.product_cat_code,
+      pc.product_format_code,
+      pc.product_id,
+      pp.opsys_family_id, pp.dbms_family_id,
+      replace(oo.opsys_family_name, ' ', '') as opsys_family_name,
+      replace(dd.dbms_family_name,  ' ', '') as dbms_family_name,
+      pp.opsys_type_id,
+      pp.product_price_type_id,
+	  pp.product_price_unit_type_id
+    from
+      oplweb2.oplweb.product_price pp,
+      oplweb2.oplweb.product_with_code pc, --category pc,
+      --oplweb2.oplweb.product_format pf,
+      oplweb2.oplweb.opsys os,
+      oplweb2.oplweb.dbms_engine dbe,
+      oplweb2.oplweb.dbms_family dd,
+      oplweb2.oplweb.opsys_family oo
+      --oplweb2.oplweb.product p
+    where
+      pp.product_format_id = pc.product_format_id and
+      pp.product_cat_id = pc.product_cat_id and
+      pp.opsys_family_id = oo.opsys_family_id and
+      pp.dbms_family_id = dd.dbms_family_id
+      --p.product_cat_id = pc.product_cat_id and
+      --p.product_format_id = pf.product_format_id and
+  ;
+
+grant SELECT on oplweb2.DBA.license_model to "SPARQL", "SPARQL_UPDATE";--, rdf;
+
+
+drop view oplweb2.DBA.license_model_units;
+
+create view oplweb2.DBA.license_model_units as
+  SELECT distinct
+      lm1.product_release_id,
+	  lm1.product_id,
+	  lm1.opsys_family_
+      pp.opsys_family_id, pp.dbms_family_id,
+      replace(oo.opsys_family_name, ' ', '') as opsys_family_name,
+      replace(dd.dbms_family_name,  ' ', '') as dbms_family_name,
+      pp.opsys_type_id, ot.short_description as opsys_type_code
+    from
+      oplweb2.oplweb.product_price pp,
+      oplweb2.oplweb.opsys_type ot,
+      oplweb2.oplweb.dbms_family dd,
+      oplweb2.oplweb.opsys_family oo
+    where
+      pp.opsys_type_id = ot.opsys_type_id and
+      pp.opsys_family_id = oo.opsys_family_id and
+      pp.dbms_family_id = dd.dbms_family_id
+      and
+      pp.product_release_id = '6.1'
+  ;
+
+grant SELECT on oplweb2.DBA.license_model_units to "SPARQL", "SPARQL_UPDATE";--, rdf;
+
+
+
+drop view oplweb2.DBA.product_general_discount_vc;
+
+create view oplweb2.DBA.product_general_discount_vc as
+  SELECT  distinct
+      product_release_id,
+      pgd.product_cat_id, pc.product_cat_code,
+      pgd.product_format_id, pc.product_format_code,
+	  pc.product_id,
+      pgd.opsys_family_id, pgd.dbms_family_id,
+      pgd.opsys_type_id,
+      product_discount_description,
+      product_price_type_id,
+      cast(unit_discount as varchar) as unit_discount,
+      discount_start,
+      discount_end,
+      discount_token
+    from
+      oplweb2.oplweb.product_general_discount pgd,
+      oplweb2.oplweb.product_with_code pc
+    where
+      pgd.product_format_id = pc.product_format_id and
+      pgd.product_cat_id = pc.product_cat_id
+  ;
+
+drop view oplweb2.DBA.product_price_varchar;
+
+create view oplweb2.DBA.product_price_varchar as
+  select
+      pp.product_price_id,
+      pp.product_release_id,
+      pp.product_cat_id, pc.product_cat_code,
+      pp.product_format_id, pf.product_format_code,
+      pp.opsys_family_id, pp.dbms_family_id,
+      replace(oo.opsys_family_name, ' ', '') as opsys_family_name,
+      replace(dd.dbms_family_name,  ' ', '') as dbms_family_name,
+      pp.opsys_type_id, ot.short_description as opsys_type_code,
+			pp.product_price_type_id,
+      pp.product_price_unit_type_id, cast(pp.unit_price as varchar) as unit_price,
+      pp.component_archive_available
+    from
+      oplweb2.oplweb.product_price pp,
+      oplweb2.oplweb.product_category pc,
+      oplweb2.oplweb.product_format pf,
+      oplweb2.oplweb.opsys_type ot,
+      oplweb2.oplweb.dbms_family dd,
+      oplweb2.oplweb.opsys_family oo
+    where
+      pp.product_format_id = pf.product_format_id and
+      pp.product_cat_id = pc.product_cat_id and
+      pp.opsys_type_id = ot.opsys_type_id and
+      pp.opsys_family_id = oo.opsys_family_id and
+      pp.dbms_family_id = dd.dbms_family_id
+      --and
+      --pp.product_release_id = '6.1'
+  ;
+
+grant SELECT on oplweb2.oplweb.product_price to "SPARQL", "SPARQL_UPDATE";--, rdf;
+grant SELECT on oplweb2.oplweb.product_price_type to "SPARQL", "SPARQL_UPDATE";--, rdf;
+grant SELECT on oplweb2.oplweb.product_price_unit_type to "SPARQL", "SPARQL_UPDATE";--, rdf;
+grant SELECT on oplweb2.DBA.product_general_discount_vc to "SPARQL", "SPARQL_UPDATE";--, rdf;
+grant SELECT on oplweb2.DBA.product_price_varchar to "SPARQL", "SPARQL_UPDATE";--, rdf;
+grant SELECT on oplweb2.DBA.license_model_type to "SPARQL", "SPARQL_UPDATE";--, rdf;
+
+
+
+DB.DBA.RDF_AUDIT_METADATA (1, '*');
+--DB.DBA.RDF_AUDIT_METADATA (2, '*');
+
+--sparql drop graph <http://www.openlinksw.com/dataspace/organization/openlink/ProductPortfolioOntology/1.0/>;
+
+--possible previous graph now merging with this oplweb graph
+sparql drop graph <http://data.openlinksw.com/shop_pricing/>;
+
+--others that have a dependency on this graph that may need kicking first
+--sparql drop graph <http://data.openlinksw.com/customer/>;
+--sparql drop graph <http://data.openlinksw.com/support/>;
+--sparql drop graph <http://data.openlinksw.com/shop_pricing/>;
+
+SPARQL drop graph <http://www.openlinksw.com/schemas/oplweb#> ;
+
+SPARQL drop graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb#> ;
+SPARQL drop graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/> ;
+
+
+-- should now use <http://www.openlinksw.com/dataspace/organization/openlink#this>
+
+SPARQL drop quad map virtrdf:product_portfolio ;
+
+--only use this if you really really mean it, it will totally nuke your RDF data, useful on
+--test boxes in a bit of jam (hasn't happened to me for a while now)
+--rdf_global_reset();
+
+--utility for stripping url killing stuff from friendly strings used as ids
+create function oplweb2.oplweb.FIXUP4URI (in _string varchar)
+	returns varchar
+	{
+	  declare _s varchar;
+      _s := replace (_string, ' ', '');
+      _s := replace (_s, '&', '_');
+      _s := replace (_s, '/', '');
+      return _s;
+	}
+	;
+
+--URI-IRI mapping functions
+create function oplweb2.oplweb.DOWNLOAD_LOCATION_URI (in uri varchar)
+returns varchar
+{
+  return sprintf('http://data.openlinksw.com/oplweb/download_location/%s#this',
+  	replace(uri, 'http://', ''));
+};
+
+create function oplweb2.oplweb.DOWNLOAD_LOCATION_URI_INVERSE (in dl_iri varchar)
+returns varchar
+{
+  declare parts any;
+
+  parts := sprintf_inverse(dl_iri,
+  	'http://data.openlinksw.com/oplweb/download_location/%s#this', 1);
+  if (parts is not null)
+    {
+      return sprintf('http://%s', parts[0]);
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.DOWNLOAD_LOCATION_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.DOWNLOAD_LOCATION_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.DBMS_FAMILY_URI (in _family_id integer)
+returns varchar
+{
+  declare _family_string varchar;
+  SELECT dbms_family_name into _family_string
+    FROM oplweb2.oplweb.dbms_family
+    WHERE dbms_family_id = _family_id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/dbms_family/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_family_string));
+};
+
+create function oplweb2.oplweb.DBMS_FAMILY_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _family_id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/dbms_family/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 dbms_family_id into _family_id FROM oplweb2.oplweb.dbms_family
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(dbms_family_name)) = lower(parts[0]);
+      return _family_id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.DBMS_FAMILY_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.DBMS_FAMILY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.COMPONENT_CATEGORY_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT short_description into _string
+    FROM oplweb2.oplweb.component_category
+    WHERE component_category_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/component_category/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.COMPONENT_CATEGORY_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/component_category/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 component_category_id into _id FROM oplweb2.oplweb.component_category
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_CATEGORY_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_CATEGORY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.COMPONENT_MODE_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT short_description into _string
+    FROM oplweb2.oplweb.component_mode
+    WHERE component_mode_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/component_mode/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.COMPONENT_MODE_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/component_mode/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 component_mode_id into _id FROM oplweb2.oplweb.component_mode
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_MODE_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_MODE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.COMPONENT_TYPE_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT short_description into _string
+    FROM oplweb2.oplweb.component_type
+    WHERE component_type_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/component_type/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.COMPONENT_TYPE_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/component_type/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 component_type_id into _id FROM oplweb2.oplweb.component_type
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_TYPE_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_TYPE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+
+create function oplweb2.oplweb.COMPONENT_ARCHIVE_TYPE_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT component_archive_short_name into _string
+    FROM oplweb2.oplweb.component_archive_type
+    WHERE component_archive_type_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/component_archive_type/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.COMPONENT_ARCHIVE_TYPE_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/component_archive_type/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 component_archive_type_id into _id FROM oplweb2.oplweb.component_archive_type
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(component_archive_short_name)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_ARCHIVE_TYPE_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.COMPONENT_ARCHIVE_TYPE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+
+create function oplweb2.oplweb.FEATURE_BENEFIT_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT product_benefit_desc into _string
+    FROM oplweb2.oplweb.product_benefits
+    WHERE product_benefit_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/feature_benefit/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.FEATURE_BENEFIT_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/feature_benefit/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 product_benefit_id into _id FROM oplweb2.oplweb.product_benefits
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(product_benefit_desc)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.FEATURE_BENEFIT_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.FEATURE_BENEFIT_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+
+create function oplweb2.oplweb.OPSYS_FAMILY_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT opsys_family_name into _string
+    FROM oplweb2.oplweb.opsys_family
+    WHERE opsys_family_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/opsys_family/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.OPSYS_FAMILY_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/opsys_family/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 opsys_family_id into _id FROM oplweb2.oplweb.opsys_family
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(opsys_family_name)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.OPSYS_FAMILY_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.OPSYS_FAMILY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+
+create function oplweb2.oplweb.OPSYS_TYPE_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT short_description into _string
+    FROM oplweb2.oplweb.opsys_type
+    WHERE opsys_type_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/opsys_type/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.OPSYS_TYPE_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/opsys_type/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT TOP 1 opsys_type_id into _id FROM oplweb2.oplweb.opsys_type
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.OPSYS_TYPE_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.OPSYS_TYPE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.PROCESSOR_FAMILY_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT processor_family_name into _string
+    FROM oplweb2.oplweb.processor_family
+    WHERE processor_family_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/processor_family/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.PROCESSOR_FAMILY_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/processor_family/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 processor_family_id into _id FROM oplweb2.oplweb.processor_family
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(processor_family_name)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.PROCESSOR_FAMILY_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.PROCESSOR_FAMILY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+--FIXME might have to do something with possible & symbols
+create function oplweb2.oplweb.PROCESSOR_MODE_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT processor_mode_name into _string
+    FROM oplweb2.oplweb.processor_mode
+    where processor_mode_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/processor_mode/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.PROCESSOR_MODE_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/processor_mode/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 processor_mode_id into _id FROM oplweb2.oplweb.processor_mode
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(processor_mode_name)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.PROCESSOR_MODE_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.PROCESSOR_MODE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT short_description into _string
+    FROM oplweb2.oplweb.product_category_features
+    WHERE product_category_feature_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/product_category_feature/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/product_category_feature/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 product_category_feature_id into _id FROM oplweb2.oplweb.product_category_features
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT short_description into _string
+    FROM oplweb2.oplweb.product_family_features
+    WHERE product_family_feature_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/product_family_feature/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/product_family_feature/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 product_family_feature_id into _id FROM oplweb2.oplweb.product_family_features
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT short_desc into _string
+    FROM oplweb2.oplweb.product_feature_category
+    WHERE product_feature_category_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/product_feature_category/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/product_feature_category/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 product_feature_category_id into _id FROM oplweb2.oplweb.product_feature_category
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_desc)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.PRODUCT_FEATURE_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT short_description into _string
+    FROM oplweb2.oplweb.product_features
+    WHERE product_feature_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/product_feature/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.PRODUCT_FEATURE_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/product_feature/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 product_feature_id into _id FROM oplweb2.oplweb.product_features
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT short_description into _string
+    FROM oplweb2.oplweb.product_format_features
+    WHERE product_format_feature_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/product_format_feature/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/product_format_feature/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 product_format_feature_id into _id FROM oplweb2.oplweb.product_format_features
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT short_description into _string
+    FROM oplweb2.oplweb.product_release_features
+    WHERE product_release_feature_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/product_release_feature/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/product_release_feature/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 product_release_feature_id into _id FROM oplweb2.oplweb.product_release_features
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(short_description)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.PRODUCT_BENEFIT_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT product_benefit_desc into _string
+    FROM oplweb2.oplweb.product_benefits
+    WHERE product_benefit_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/product_benefit/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.PRODUCT_BENEFIT_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/product_benefit/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 product_benefit_id into _id FROM oplweb2.oplweb.product_benefits
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(product_benefit_desc)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_BENEFIT_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_BENEFIT_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT description into _string
+    FROM oplweb2.oplweb.product_benefits_category
+    WHERE product_benefit_category_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/product_benefit_category/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/product_benefit_category/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 product_benefit_category_id into _id FROM oplweb2.oplweb.product_benefits_category
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(description)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.VENDOR_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT vendor_name into _string
+    FROM oplweb2.oplweb.vendors
+    where vendor_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/vendor/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.VENDOR_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/vendor/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 vendor_id into _id FROM oplweb2.oplweb.vendors
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(vendor_name)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.VENDOR_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.VENDOR_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.VENDOR_CATEGORY_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT vendor_category_description into _string
+    FROM oplweb2.oplweb.vendor_category
+    where vendor_category_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/vendor_category/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.VENDOR_CATEGORY_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/vendor_category/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 vendor_category_id into _id FROM oplweb2.oplweb.vendor_category
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(vendor_category_description)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.VENDOR_CATEGORY_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.VENDOR_CATEGORY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI (in _id integer)
+returns varchar
+{
+  declare _string varchar;
+  SELECT vendor_category_family_desc into _string
+    FROM oplweb2.oplweb.vendor_category_family
+    where vendor_category_family_id = _id ;
+
+  return sprintf('http://data.openlinksw.com/oplweb/vendor_category_family/%s#this',
+  	oplweb2.oplweb.FIXUP4URI(_string));
+};
+
+create function oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI_INVERSE (in _iri varchar)
+returns integer
+{
+  declare parts any;
+  declare _id integer;
+
+  parts := sprintf_inverse(_iri,
+  	'http://data.openlinksw.com/oplweb/vendor_category_family/%s#this', 1);
+  if (parts is not null)
+    {
+      declare exit handler for not found return null;
+      SELECT top 1 vendor_category_family_id into _id FROM oplweb2.oplweb.vendor_category_family
+        WHERE lower(oplweb2.oplweb.FIXUP4URI(vendor_category_family_desc)) = lower(parts[0]);
+      return _id;
+    }
+  return NULL;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI_INVERSE TO "SPARQL", "SPARQL_UPDATE";
+
+
+
+
+
+create function oplweb2.oplweb.LIT_PRODUCT_RELEASE_LABEL (
+	in _product_id varchar, in _id integer, in _opsys_name varchar, in _dbms_name varchar
+	)
+returns varchar
+{
+  declare _string varchar;
+  SELECT 'OpenLink ' || poduct_description || ' (Release ' || product_release_id || ') on ' || commercial_name into _string
+    FROM oplweb2.oplweb.product_release pr,
+      oplweb2.oplweb.product p,
+      oplweb2.oplweb.opsys o
+    where
+      p.product_id = pr.product_id and
+      o.opsys_name = pr.opsys_name and
+      pr.product_release_id = _id and
+      pr.product_id = _product_id and
+      pr.opsys_name = _opsys_name and
+      pr.dbms_name = _dbms_name ;
+
+  return _string;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.LIT_PRODUCT_RELEASE_LABEL TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.LIT_FORMAT_CAT_LABEL (
+	in _format integer, in _cat integer
+	)
+returns varchar
+{
+  declare _string varchar;
+  SELECT top 1 'OpenLink ' || cast(product_format_description as varchar) || ' ' || cast(product_category_description as varchar) into _string
+    from
+      oplweb2.oplweb.product_formats_categories fc,
+      oplweb2.oplweb.product_format f,
+      oplweb2.oplweb.product_category c
+    where
+fc.product_format_id = f.product_format_id and
+fc.product_cat_id = c.product_cat_id and
+    fc.product_format_id = _format and
+    fc.product_cat_id = _cat;
+
+  return _string;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.LIT_FORMAT_CAT_LABEL TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.LITRDF_openlink_logo (in _code varchar)
+returns varchar
+{
+  declare _string varchar;
+  SELECT top 1 product_family_logo_url into _string
+    FROM oplweb2.oplweb.product_family
+    WHERE product_family_code = _code;
+
+  return _string;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.LITRDF_openlink_logo TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.LITRDF_homepage (in _code varchar)
+returns varchar
+{
+  declare _string varchar;
+  SELECT top 1 product_family_homepage into _string
+    FROM oplweb2.oplweb.product_family
+    WHERE product_family_code = _code;
+
+  return _string;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.LITRDF_homepage TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.LITRDF_opsys_icon (in _id integer)
+returns varchar
+{
+  declare _string varchar; _string := '';
+  SELECT top 1 opsys_icon_name into _string
+    FROM oplweb2.oplweb.opsys_family
+    where opsys_family_id = _id;
+
+  _string := 'http://download.openlinksw.com/download/images/'||_string;
+
+  return _string;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.LITRDF_opsys_icon TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.LITRDF_to_shop (
+	in release_id varchar,
+	in product_id varchar,
+	in opsys varchar,
+	in dbms varchar
+	)
+returns varchar
+{
+  declare _string varchar; _string := '';
+  declare _cat, _format, _prod varchar;
+
+  _prod := product_id;
+
+  SELECT top 1 cast(product_cat_id as varchar), cast(product_format_id as varchar)
+      into _cat, _format
+    FROM oplweb2.oplweb.product p
+    WHERE p.product_id = _prod;
+
+  _string := sprintf(
+	'https://shop.openlinksw.com/?product_release_id=%s&product=%s&product_cat=%V&product_format=%V&os=%s&db=%s&buyme=yes',
+	release_id, product_id, _cat, _format, opsys, dbms
+	);
+
+  return _string;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.LITRDF_to_shop TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.LITRDF_license_model_type (
+		in _product_price_type_id integer
+	)
+returns varchar
+{
+  declare _string varchar; _string := '';
+
+  SELECT top 1 product_price_type_description into _string FROM oplweb2.oplweb.product_price_type
+    WHERE product_price_type_id = _product_price_type_id;
+
+  return _string || ' License';
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.LITRDF_license_model_type TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.LITRDF_license_model_explain (
+		in _product_price_type_id integer
+	)
+returns varchar
+{
+  declare _string varchar; _string := '';
+
+  SELECT top 1 product_price_type_long_description into _string FROM oplweb2.oplweb.product_price_type
+    WHERE product_price_type_id = _product_price_type_id;
+
+  return _string;
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.LITRDF_license_model_explain TO "SPARQL", "SPARQL_UPDATE";
+
+
+create function oplweb2.oplweb.LITRDF_shop_sample (
+	in release_id varchar,
+	in product_id varchar,
+	in opsys varchar,
+	in dbms varchar
+	)
+returns varchar
+{
+  declare _string varchar; _string := '';
+  declare _cat, _format, _prod, _pricetype varchar;
+
+  _prod := product_id;
+
+  SELECT top 1 cast(product_cat_id as varchar), cast(product_format_id as varchar), cast(product_price_type_id as varchar)
+      into _cat, _format, _pricetype
+    FROM oplweb2.DBA.license_model p, oplweb2.oplweb.opsys o, oplweb2.oplweb.dbms_engine e
+    WHERE p.product_id = _prod and product_release_id = release_id and o.opsys_name = opsys and e.dbms_name = dbms
+      and p.dbms_family_id = e.dbms_family_id and o.opsys_family_id = p.opsys_family_id;
+
+  _string := sprintf(
+	'https://shop.openlinksw.com/price_calc.vsp?release=%s&cat=%V&format=%V&os=%s&db=%s&lictype=%V',
+	release_id, _cat, _format, opsys, dbms, _pricetype
+	);
+
+  return http_client(_string);
+};
+
+GRANT EXECUTE ON oplweb2.oplweb.LITRDF_shop_sample TO "SPARQL", "SPARQL_UPDATE";
+
+
+-- $Id: rdfviewssamples.xml,v 1.1.2.1 2010/10/07 12:45:00 source Exp $
+-- Setup script for RDF view of OpenLink Product Portfolio version 2
+--
+
+--
+-- This view is currently designed to SPECIFICALLY load on data.openlinksw.com. The default URI macro has NOT
+-- been used here because it makes no sense on the target box which is actually my.usnet.private:8891 or
+-- something similar. If you want to use this view on another box, a simple search-replace should do the trick,
+-- but search-replace just`data.openlinksw.com' because http:// is sometimes encoded and you would miss it.
+--
+--
+
+
+
+SPARQL drop quad map virtrdf:product_portfolio2 ;
+SPARQL drop quad map virtrdf:product_portfolio ;
+
+SPARQL
+
+prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
+
+drop iri class opl:DownloadLocation .
+drop iri class opl:ComponentCategory .
+drop iri class opl:Component .
+drop iri class opl:ComponentArchive .
+drop iri class opl:ComponentArchiveType .
+drop iri class opl:ComponentCategory .
+drop iri class opl:ComponentMode .
+drop iri class opl:ComponentType .
+drop iri class opl:DbmsEngine .
+drop iri class opl:DbmsFamily .
+drop iri class opl:DownloadProtocol .
+drop iri class opl:DownloadPartner .
+drop iri class opl:FeatureBenefit .
+drop iri class opl:Opsys .
+drop iri class opl:OpsysFamily .
+drop iri class opl:OpsysType .
+drop iri class opl:Processor .
+drop iri class opl:ProcessorFamily .
+drop iri class opl:ProcessorMode .
+drop iri class opl:ProductRelease .
+drop iri class opl:Product .
+drop iri class opl:ProductCategory .
+drop iri class opl:ProductCategoryFeature .
+drop iri class opl:ProductPortfolio .
+drop iri class opl:ProductFamily .
+drop iri class opl:ProductFamilyFeature .
+drop iri class opl:ProductFeatureCategory .
+drop iri class opl:ProductFeature .
+drop iri class opl:ProductFormat .
+drop iri class opl:ProductFormatCategory .
+drop iri class opl:ProductFormatFeature .
+drop iri class opl:ProductReleaseFeature .
+drop iri class opl:ProductBenefit .
+drop iri class opl:ProductBenefitCategory .
+drop iri class opl:Vendor .
+drop iri class opl:VendorCategory .
+drop iri class opl:VendorCategoryFamily .
+drop iri class opl:PriceType .
+drop iri class opl:PriceUnitType .
+drop iri class opl:PriceUnitIncrementalDiscount .
+drop iri class opl:ProductPrice .
+drop iri class opl:LicenseType .
+drop iri class opl:LicenseModel .
+drop iri class opl:LicenseClass .
+drop iri class opl:Discount .
+drop literal class opl:lit_product_release_label .
+drop literal class opl:lit_format_cat_label .
+drop literal class opl:lit_openlink_logo .
+drop iri class opl:lit_openlink_logo .
+drop literal class opl:lit_homepage .
+drop iri class opl:lit_homepage .
+drop literal class opl:lit_opsys_icon .
+drop iri class opl:lit_opsys_icon .
+drop literal class opl:lit_to_shop .
+drop iri class opl:lit_to_shop .
+drop literal class opl:lit_license_model_type .
+drop literal class opl:lit_license_model_explain .
+drop literal class opl:lit_shop_sample .
+drop literal class opl:lit_wikipedia_to_dbpedia .
+drop iri class opl:lit_wikipedia_to_dbpedia .
+drop literal class opl:lit_to_string .
+drop iri class opl:wwwsitefamily .
+drop iri class opl:wwwsiteformat .
+drop iri class opl:wwwsitecategory .
+drop iri class opl:wwwsiteproduct .
+;
+
+DB.DBA.RDF_AUDIT_METADATA (1, '*');
+
+
+SPARQL
+
+prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
+
+create iri class opl:Component "http://data.openlinksw.com/oplweb/component/%s#this"
+	(in component_name varchar not null) .
+
+create iri class opl:ComponentArchive "http://data.openlinksw.com/oplweb/component_archive/%s#this"
+	(in component_archive_name varchar not null) .
+
+create iri class opl:ComponentArchiveType using
+	function oplweb2.oplweb.COMPONENT_CATEGORY_URI (in _id integer not null)
+		returns varchar,
+	function oplweb2.oplweb.COMPONENT_CATEGORY_URI_INVERSE (in _iri varchar)
+		returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/component_archive_type/%s#this' ).
+
+
+create iri class opl:ComponentCategory using
+	function oplweb2.oplweb.COMPONENT_CATEGORY_URI (in _id integer not null)
+		returns varchar,
+	function oplweb2.oplweb.COMPONENT_CATEGORY_URI_INVERSE (in _iri varchar)
+		returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/component_category/%s#this' ).
+
+create iri class opl:ComponentMode using
+	function oplweb2.oplweb.COMPONENT_MODE_URI (in _id integer not null)
+		returns varchar,
+	function oplweb2.oplweb.COMPONENT_MODE_URI_INVERSE (in _iri varchar)
+		returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/component_mode/%s#this' ).
+
+create iri class opl:ComponentType using
+	function oplweb2.oplweb.COMPONENT_TYPE_URI (in _id integer not null)
+		returns varchar,
+	function oplweb2.oplweb.COMPONENT_TYPE_URI_INVERSE (in _iri varchar)
+		returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/component_type/%s#this' ).
+
+create iri class opl:DbmsFamily using
+	function oplweb2.oplweb.DBMS_FAMILY_URI (in _family_id integer not null)
+		returns varchar,
+	function oplweb2.oplweb.DBMS_FAMILY_URI_INVERSE (in _iri varchar)
+		returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/dbms_family/%s#this' ).
+
+create iri class opl:DbmsEngine "http://data.openlinksw.com/oplweb/dbms_engine/%s#this"
+	(in dbms_name varchar not null) .
+
+create iri class opl:DownloadLocation using
+	function oplweb2.oplweb.DOWNLOAD_LOCATION_URI (in uri varchar not null)
+		returns varchar,
+	function oplweb2.oplweb.DOWNLOAD_LOCATION_URI_INVERSE (in dl_iri varchar)
+		returns varchar
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/download_location/%s#this' ).
+
+create iri class opl:DownloadProtocol "http://data.openlinksw.com/oplweb/download_protocol/%s#this"
+	(in protocol_name varchar not null) .
+
+create iri class opl:DownloadPartner "http://data.openlinksw.com/oplweb/download_partner/%s/%s#this"
+	(
+	  in host_name varchar not null,
+	  in domain_name varchar not null
+	) .
+
+create iri class opl:FeatureBenefit using
+  function oplweb2.oplweb.FEATURE_BENEFIT_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.FEATURE_BENEFIT_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/feature_benefit/%s#this' ).
+
+create iri class opl:Opsys "http://data.openlinksw.com/oplweb/opsys/%s#this"
+	(in opsys_name varchar not null) .
+
+create iri class opl:OpsysFamily 	using
+  function oplweb2.oplweb.OPSYS_FAMILY_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.OPSYS_FAMILY_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/opsys_family/%s#this' ).
+
+create iri class opl:OpsysType 			using
+  function oplweb2.oplweb.OPSYS_TYPE_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.OPSYS_TYPE_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/opsys_type/%s#this' ).
+
+create iri class opl:Processor "http://data.openlinksw.com/oplweb/processor/%s/%d#this"
+	(in processor_name varchar not null, in processor_mode_id integer not null) .
+
+create iri class opl:ProcessorFamily 	using
+  function oplweb2.oplweb.PROCESSOR_FAMILY_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.PROCESSOR_FAMILY_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/processor_family/%s#this' ).
+
+create iri class opl:ProcessorMode 			using
+  function oplweb2.oplweb.PROCESSOR_MODE_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.PROCESSOR_MODE_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/processor_mode/%s#this' ).
+
+create iri class opl:Product "http://data.openlinksw.com/oplweb/product/%s#this"
+	(in product_id varchar not null) .
+
+create iri class opl:ProductCategory "http://data.openlinksw.com/oplweb/product_category/%s#this"
+	(in product_cat_code varchar not null) .
+
+create iri class opl:ProductCategoryFeature 	using
+  function oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI (in _id integer not null) returns varchar,
+		function oplweb2.oplweb.PRODUCT_CATEGORY_FEATURE_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_category_feature/%s#this' ).
+
+create iri class opl:ProductPortfolio "http://data.openlinksw.com/oplweb/portfolio/%s#this"
+	(in x varchar not null) .
+
+create iri class opl:ProductFamily "http://data.openlinksw.com/oplweb/product_family/%s#this"
+	(in product_family_code varchar not null) .
+
+create iri class opl:ProductFamilyFeature 	using
+  function oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.PRODUCT_FAMILY_FEATURE_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_family_feature/%s#this' ).
+
+create iri class opl:ProductFeatureCategory 			using
+  function oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.PRODUCT_FEATURE_CATEGORY_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_feature_category/%s#this' ).
+
+create iri class opl:ProductFeature 					using
+  function oplweb2.oplweb.PRODUCT_FEATURE_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.PRODUCT_FEATURE_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_feature/%s#this' ).
+
+create iri class opl:ProductFormat "http://data.openlinksw.com/oplweb/product_format/%s#this"
+	(in product_format_code varchar not null) .
+
+create iri class opl:ProductFormatCategory "http://data.openlinksw.com/oplweb/product_format_category/%s/%s#this"
+	(in product_format_code varchar not null, in product_cat_code varchar not null) .
+
+create iri class opl:ProductFormatFeature 	using
+  function oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.PRODUCT_FORMAT_FEATURE_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_format_feature/%s#this' ).
+
+create iri class opl:ProductReleaseFeature 			using
+  function oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.PRODUCT_RELEASE_FEATURE_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_release_feature/%s#this' ).
+
+create iri class opl:ProductBenefit 					using
+  function oplweb2.oplweb.PRODUCT_BENEFIT_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.PRODUCT_BENEFIT_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_benefit/%s#this' ).
+
+create iri class opl:ProductBenefitCategory 							using
+  function oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.PRODUCT_BENEFIT_CATEGORY_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/product_benefit_category/%s#this' ).
+
+create iri class opl:ProductRelease "http://data.openlinksw.com/oplweb/product_release/%s/%s/%s/%s#this"
+	(
+	 in product_id varchar not null,
+	 in product_release_id varchar not null,
+	 in opsys_name varchar not null,
+	 in dbms_name varchar not null
+	) .
+
+create iri class opl:Vendor 	using
+  function oplweb2.oplweb.VENDOR_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.VENDOR_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/vendor/%s#this' ).
+
+create iri class opl:VendorCategory 			using
+  function oplweb2.oplweb.VENDOR_CATEGORY_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.VENDOR_CATEGORY_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/vendor_category/%s#this' ).
+
+create iri class opl:VendorCategoryFamily 					using
+  function oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.VENDOR_CATEGORY_FAMILY_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/vendor_category_family/%s#this' ).
+
+create iri class opl:PriceType "http://data.openlinksw.com/oplweb/price_type/%d#this"
+    (in product_price_type_id integer not null) .
+
+create iri class opl:LicenseType using
+  function oplweb2.oplweb.LICENSE_MODEL_TYPE_URI (in _id integer not null) returns varchar,
+  function oplweb2.oplweb.LICENSE_MODEL_TYPE_URI_INVERSE (in _iri varchar) returns integer
+	option (bijection, returns 'http://data.openlinksw.com/oplweb/license_type/%s#this' ).
+
+create iri class opl:PriceUnitType "http://data.openlinksw.com/oplweb/price_unit_type/%s_%s_%d_%d_%d_%s#this"
+    (
+    in product_release_id varchar not null,
+    in product_id varchar not null,
+    in opsys_family_id integer not null,
+    in dbms_family_id integer not null,
+    in product_price_type_id integer not null,
+	in product_price_unit_type_id varchar not null) .
+
+create iri class opl:PriceUnitIncrementalDiscount "http://data.openlinksw.com/oplweb/price_unit_discount/%s_%s_%d_%d_%d_%s#this"
+    (
+    in product_release_id varchar not null,
+    in product_id varchar not null,
+    in opsys_family_id integer not null,
+    in dbms_family_id integer not null,
+    in product_price_type_id integer not null,
+	in product_price_unit_type_id varchar not null) .
+
+create iri class opl:ProductPrice "http://data.openlinksw.com/oplweb/product_price/%d#this"
+    (in product_price_id integer not null) .
+
+
+create iri class opl:LicenseModel "http://data.openlinksw.com/oplweb/license_model/%s_%s_%d_%d_%d#this"
+    (
+      in product_release_id varchar not null,
+      in product_id varchar not null,
+      in opsys_family_id integer not null,
+      in dbms_family_id integer not null,
+	  in product_price_type_id integer not null
+    ) .
+
+create iri class opl:Discount "http://data.openlinksw.com/oplweb/discount/%s/%d/%s/%d/%d/%d#this"
+    (
+      in product_release_id varchar not null,
+      in opsys_type_id integer not null,
+      in product_id varchar not null,
+      in opsys_family_id integer not null,
+      in dbms_family_id integer not null,
+      in product_price_type_id integer not null
+    ) .
+
+create iri class opl:wwwsitefamily "http://%s.openlinksw.com/"
+    (
+      in product_family_code varchar not null
+    ) .
+
+create iri class opl:wwwsitecategory "http://%s.openlinksw.com/%s/"
+    (
+      in product_family_code varchar not null,
+      in product_category_code varchar not null
+    ) .
+
+create iri class opl:wwwsiteformat "http://%s.openlinksw.com/%s/%s/"
+    (
+      in product_family_code varchar not null,
+      in product_category_code varchar not null,
+      in product_format_code varchar not null
+    ) .
+
+create iri class opl:Uri "%s"
+    ( in uri varchar not null
+		) .
+
+create literal class opl:lit_product_release_label using
+	function oplweb2.oplweb.LIT_PRODUCT_RELEASE_LABEL(
+		in _product_id varchar, in _id integer, in _opsys_name varchar, in _dbms_name varchar
+		)
+	returns varchar .
+
+create literal class opl:lit_format_cat_label using
+	function oplweb2.oplweb.LIT_FORMAT_CAT_LABEL(
+		in _format integer, in _cat integer
+		)
+	returns varchar .
+
+create iri class opl:lit_openlink_logo using
+  function oplweb2.oplweb.LITRDF_openlink_logo(
+    in _code varchar
+  )
+	returns varchar .
+
+create iri class opl:lit_homepage using
+  function oplweb2.oplweb.LITRDF_homepage(
+    in _code varchar
+  )
+	returns varchar .
+
+create iri class opl:lit_opsys_icon using
+  function oplweb2.oplweb.LITRDF_opsys_icon(
+    in _id integer
+  )
+	returns varchar .
+
+create iri class opl:lit_to_shop using
+  function oplweb2.oplweb.LITRDF_to_shop(
+	in release_id varchar,
+	in product_id varchar,
+	in opsys varchar,
+	in dbms varchar
+  )
+  returns varchar .
+
+create literal class opl:lit_license_model_type using
+	function oplweb2.oplweb.LITRDF_license_model_type (
+		in _product_price_type_id integer
+	)
+	returns varchar .
+
+create literal class opl:lit_license_model_explain using
+	function oplweb2.oplweb.LITRDF_license_model_explain (
+		in _product_price_type_id integer
+	)
+	returns varchar .
+
+create literal class opl:lit_shop_sample using
+	function oplweb2.oplweb.LITRDF_shop_sample (
+	  in release_id varchar,
+	  in product_id varchar,
+	  in opsys varchar,
+  	  in dbms varchar
+	)
+	returns varchar .
+
+create iri class opl:lit_wikipedia_to_dbpedia using
+	function oplweb2.oplweb.LITRDF_wikipedia_to_dbpedia (
+	  in wikipedia_url varchar
+	)
+	returns varchar .
+
+create literal class opl:lit_to_string using
+	function oplweb2.oplweb.LITRDF_to_string (
+	  in _s varchar
+	)
+	returns varchar .
+
+create iri class opl:wwwsiteproduct using
+  function oplweb2.oplweb.wwwsiteproduct_URI (in _id varchar not null) returns varchar,
+  function oplweb2.oplweb.wwwsiteproduct_URI_INVERSE (in _iri varchar) returns varchar
+  .
+
+
+make opl:ProductCategory 	subclass of opl:ProductFamily .
+make opl:Product 			subclass of opl:ProductCategory .
+make opl:Product 			subclass of opl:ProductFormat .
+make opl:ProductRelease		subclass of opl:Product .
+make opl:Opsys		 		subclass of opl:OpsysFamily .
+make opl:DbmsEngine		 	subclass of opl:DbmsFamily .
+
+;
+
+
+
+DB.DBA.RDF_AUDIT_METADATA (1, '*');
+
+
+SPARQL
+prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
+prefix dc: <http://purl.org/dc/terms#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+prefix oplds: <http://www.openlinksw.com/dataspace/organization/openlink#>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+prefix umbel: <http://umbel.org/umbel/sc/>
+prefix gr: <http://purl.org/goodrelations/v1#>
+
+alter quad storage virtrdf:DefaultQuadStorage
+FROM oplweb2.oplweb.component_archive as component_archive_tbl
+FROM oplweb2.oplweb.component_archive_type as component_archive_type_tbl
+FROM oplweb2.oplweb.component_category as component_category_tbl text literal component_category_long_description
+FROM oplweb2.oplweb.component_mode as component_mode_tbl
+FROM oplweb2.oplweb.component_type as component_type_tbl
+FROM oplweb2.oplweb.components_for_rdfs as components_tbl
+FROM oplweb2.oplweb.dbms_engine as dbms_engine_tbl
+FROM oplweb2.oplweb.dbms_family as dbms_family_tbl
+FROM oplweb2.oplweb.download_location as download_location_tbl
+FROM oplweb2.oplweb.download_protocol as download_protocol_tbl
+FROM oplweb2.oplweb.download_partner as download_partner_tbl
+FROM oplweb2.oplweb.opsys as opsys_tbl
+FROM oplweb2.oplweb.opsys_family as opsys_family_tbl
+FROM oplweb2.oplweb.opsys_type as opsys_type_tbl
+FROM oplweb2.oplweb.processor_family as processor_family_tbl
+FROM oplweb2.oplweb.processor_mode as processor_mode_tbl
+FROM oplweb2.oplweb.processors as processors_tbl
+FROM oplweb2.oplweb.product as product_tbl text literal long_description
+FROM oplweb2.oplweb.product_benefits as product_benefits_tbl text literal product_benefit_explanation
+FROM oplweb2.oplweb.product_benefits_category as product_benefits_category_tbl
+FROM oplweb2.oplweb.product_category as product_category_tbl
+FROM oplweb2.oplweb.product_category_features_with_code as product_category_features_tbl text literal long_description
+FROM oplweb2.oplweb.product_family as product_family_tbl
+FROM oplweb2.oplweb.product_family as product_family_tbl_2
+FROM oplweb2.oplweb.product_family_features_with_code as product_family_features_tbl text literal long_description
+FROM oplweb2.oplweb.product_features as product_features_tbl text literal long_description
+FROM oplweb2.oplweb.product_feature_category as product_feature_category_tbl text literal description
+FROM oplweb2.oplweb.product_format_features_with_code as product_format_features_tbl text literal long_description
+FROM oplweb2.oplweb.product_release_features as product_release_features_tbl text literal long_description
+FROM oplweb2.oplweb.product_release_with_family as product_release_tbl
+FROM oplweb2.oplweb.vendor_category as vendor_category_tbl
+FROM oplweb2.oplweb.vendor_category_family as vendor_category_family_tbl
+FROM oplweb2.oplweb.vendors as vendors_tbl
+FROM oplweb2.oplweb.product_formats_categories as product_formats_categories
+FROM oplweb2.oplweb.product_with_code as product_with_code
+FROM oplweb2.oplweb.product_category_with_code as product_category_with_code
+FROM oplweb2.oplweb.product_format as product_format_with_code
+FROM oplweb2.oplweb.product_price as pp
+FROM oplweb2.oplweb.product_price_type as pt
+FROM oplweb2.DBA.license_model_unit_type as put
+FROM oplweb2.DBA.license_model_unit_type as put2
+FROM oplweb2.DBA.license_model as lm
+FROM oplweb2.DBA.license_model as lm2
+FROM oplweb2.DBA.license_model_type as license_model_type_tbl
+FROM oplweb2.DBA.product_price_varchar as ppv
+FROM oplweb2.DBA.product_general_discount_vc as gd
+FROM oplweb2.oplweb.archive_coverage_osdb as ac1
+{
+	create virtrdf:product_portfolio as
+		graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
+	{
+  opl:ProductPortfolio(product_family_tbl.product_family_code)
+    a opl:ProductPortfolio
+    as virtrdf:OplProductPortfolio .
+
+  opl:ProductPortfolio(product_family_tbl.product_family_code) opl:hasProductFamilies
+    opl:ProductFamily(product_family_tbl.product_family_code)
+	as virtrdf:OplProductPortfolioProductFamily .
+
+	  opl:ProductFamily(product_family_tbl.product_family_code)
+	    a opl:ProductFamily
+	    as virtrdf:OplProductFamily ;
+	  rdfs:label product_family_tbl.product_family_description
+	    as virtrdf:rdfsOplProductFamilyDescription ;
+	  foaf:name 	product_family_tbl.product_family_description
+		    as virtrdf:nameOplProductFamilyDescription ;
+	  foaf:logo  opl:lit_openlink_logo(product_family_tbl.product_family_code)
+	        as virtrdf:logoOpenLinkSoftware ;
+	  foaf:homepage opl:lit_homepage(product_family_tbl.product_family_code)
+	        as virtrdf:homepageProductFamily ;
+	  foaf:homepage opl:wwwsitefamily(product_family_tbl.product_family_code)
+#	    where (
+#			^{product_family_tbl.}^.product_family_code = 'uda'
+#		)
+	        as virtrdf:homepageProductFamilyUda ;
+	  foaf:maker oplds:this
+	        as virtrdf:OplDataspaceOpenLinkUri ;
+  	  owl:sameAs product_family_tbl.dbpedia_uri
+        as virtrdf:OplFamilyOwlSameAsDBPediaUri ;
+	  opl:ProductFamilyCode product_family_tbl.product_family_code
+	    as virtrdf:OplProductFamilyCode ;
+	  opl:ProductFamilyDescription product_family_tbl.product_family_description
+	    as virtrdf:OplProductFamilyDescription ;
+	  dc:description opl:lit_to_string(product_family_tbl.long_description)
+	    as virtrdf:OplProductFamilyLongDescription 		;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy foaf: ;
+      rdfs:isDefinedBy dc: ;
+      rdfs:isDefinedBy owl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+	  opl:ProductCategory(product_category_with_code.product_cat_code)
+	    a opl:ProductCategory
+	    as virtrdf:OplProductCategory ;
+	    a opl:ProductFamily
+	    as virtrdf:OplProductCategorySubClassOfProductFamily ;
+	  rdfs:label product_category_with_code.product_category_description
+	    as virtrdf:rdfsOplProductCategoryDescription ;
+	  foaf:homepage opl:wwwsitecategory(product_category_with_code.product_family_code, product_category_with_code.product_cat_code)
+#	    where (
+#			^{product_category_with_code.}^.product_family_code = 'uda'
+#		)
+	        as virtrdf:homepageProductFamilyCategoryUda ;
+	  opl:ProductCategoryCode product_category_with_code.product_cat_code
+	    as virtrdf:OplProductCategoryCode ;
+  	  owl:sameAs product_category_with_code.dbpedia_uri
+        as virtrdf:OplCategoryOwlSameAsDBPediaUri ;
+	  opl:hasFamily opl:ProductFamily(product_category_with_code.product_family_code)
+	    as virtrdf:OplProductCategoryIsOfFamily ;
+	  opl:ProductCategoryDescription product_category_with_code.product_category_description
+	    as virtrdf:OplProductCategoryDescription ;
+	  dc:description opl:lit_to_string(product_category_with_code.long_description)
+	    as virtrdf:OplProductCategoryLongDescription ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs: ;
+      rdfs:isDefinedBy foaf: ;
+      rdfs:isDefinedBy dc: ;
+      rdfs:isDefinedBy owl:
+		.
+
+	  opl:ProductFormat(product_format_with_code.product_format_code)
+	    a opl:ProductFormat
+	    as virtrdf:OplProductFormat ;
+	  opl:ProductFormatCode product_format_with_code.product_format_code
+	    as virtrdf:OplProductFormatCode ;
+	  rdfs:label product_format_with_code.product_format_description
+	    as virtrdf:rdfsOplProductFormatDescription ;
+	  dc:description product_format_with_code.product_format_description
+	    as virtrdf:OplProductFormatDescription ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs: ;
+      rdfs:isDefinedBy dc:
+		.
+
+	  opl:ProductFormatCategory(product_formats_categories.product_format_code, product_formats_categories.product_cat_code)
+	    a opl:ProductFormatCategory
+	    as virtrdf:OplProductFormatCategory ;
+	    a opl:ProductFormat
+	    as virtrdf:OplProductFormatCategoryProductFormat ;
+	    a opl:ProductCategory
+	    as virtrdf:OplProductFormatCategoryProductCategory ;
+	  foaf:homepage opl:wwwsiteformat(product_category_with_code.product_family_code, product_formats_categories.product_cat_code, product_formats_categories.product_format_code)
+	    where (
+			^{product_category_with_code.}^.product_cat_code = ^{product_formats_categories.}^.product_cat_code
+#			and
+#			^{product_category_with_code.}^.product_family_code = 'uda'
+		)
+	        as virtrdf:homepageProductFamilyCategoryFormatUda ;
+	  opl:ProductFormatCode product_formats_categories.product_format_code
+	    as virtrdf:OplProductFormatCategoryFormatCode ;
+	  opl:ProductCategoryCode product_formats_categories.product_cat_code
+	    as virtrdf:OplProductFormatCategoryCategoryCode ;
+      opl:isProductCategory opl:ProductCategory(product_formats_categories.product_cat_code)
+        as virtrdf:OplProductFormatCategoryisCategory ;
+      opl:isProductFormat opl:ProductFormat(product_formats_categories.product_format_code)
+        as virtrdf:OplProductFormatCategoryisFormat ;
+	  rdfs:label opl:lit_format_cat_label(product_formats_categories.product_format_id, product_formats_categories.product_cat_id)
+	    as virtrdf:rdfsOplProductFormatCategoryDescription ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy foaf: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+
+	  opl:ProductCategory(product_category_with_code.product_cat_code) opl:hasProduct
+	    opl:Product(product_with_code.product_id)
+	      where (^{product_with_code.}^.product_cat_id = ^{product_category_with_code.}^.product_cat_id)
+	    as virtrdf:OplProductCategoryIsCategoryOfProduct .
+
+	  opl:ProductFormat(product_format_with_code.product_format_code) opl:hasProduct
+	    opl:Product(product_with_code.product_id)
+	      where (^{product_with_code.}^.product_format_id = ^{product_format_with_code.}^.product_format_id)
+	    as virtrdf:OplProductFormatIsFormatOfProduct .
+
+	  opl:ProductFamily(product_family_tbl.product_family_code) opl:hasCategory
+	    opl:ProductCategory(product_category_with_code.product_cat_code)
+	      where (^{product_family_tbl.}^.product_family_id = ^{product_category_with_code.}^.product_family_id)
+	    as virtrdf:OplProductFamilyIsFamilyOfProductCategory .
+
+	  opl:ProductFamily(product_family_tbl.product_family_code) opl:hasFormat
+	    opl:ProductFormat(product_formats_categories.product_format_code)
+	      where (
+		    ^{product_family_tbl.}^.product_family_id = ^{product_formats_categories.}^.product_family_id
+		  )
+	    as virtrdf:OplProductFamilyIsFamilyOfProductFormats .
+
+	  opl:ProductFamily(product_family_tbl.product_family_code) opl:otherProductFamilies
+	    opl:ProductFamily(product_family_tbl_2.product_family_code)
+	      where (
+		    ^{product_family_tbl.}^.product_family_id <> ^{product_family_tbl_2.}^.product_family_id
+		  )
+	    as virtrdf:OplProductFamilyHasOtherProductFamilies .
+
+	  opl:ProductFormat(product_format_with_code.product_format_code) opl:hasCategory
+	    opl:ProductFormatCategory(product_formats_categories.product_format_code, product_formats_categories.product_cat_code)
+	      where (^{product_formats_categories.}^.product_format_id = ^{product_format_with_code.}^.product_format_id)
+	    as virtrdf:OplProductFormatIsFormatOfProductFormatCategories .
+
+	  opl:ProductFormatCategory(product_formats_categories.product_format_code, product_formats_categories.product_cat_code)
+	    opl:hasProduct
+	    opl:Product(product_with_code.product_id)
+	      where (
+		    ^{product_with_code.}^.product_cat_id = ^{product_formats_categories.}^.product_cat_id
+		    and
+		    ^{product_with_code.}^.product_format_id = ^{product_formats_categories.}^.product_format_id
+		  )
+	    as virtrdf:OplProductFormatCategoryIsFormatCategoryOfProduct .
+
+
+
+	  opl:VendorCategoryFamily(vendor_category_family_tbl.vendor_category_family_id)
+	    a opl:VendorCategoryFamily
+	    as virtrdf:OplVendorCategoryFamily ;
+	  opl:VendorCategoryFamilyDescription vendor_category_family_tbl.vendor_category_family_desc
+	    as virtrdf:OplVendorCategoryFamilyDesc .
+
+
+	  opl:VendorCategory(vendor_category_tbl.vendor_category_id)
+	    a opl:VendorCategory
+	    as virtrdf:OplVendorCategory ;
+	    a opl:VendorCategoryFamily
+	    as virtrdf:OplVendorCategorySubClassOfVendorCategoryFamily ;
+	  rdfs:label vendor_category_tbl.vendor_category_description
+	    as virtrdf:rdfsOplVendorCategoryDescription ;
+	  opl:VendorCategoryDescription vendor_category_tbl.vendor_category_description
+	    as virtrdf:OplVendorCategoryDescription ;
+	  opl:isVendorCategoryOf opl:VendorCategoryFamily(vendor_category_tbl.vendor_category_family_id)
+	    as virtrdf:OplVendorCategoryIsOfCategoryFamily ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+	  opl:Vendor(vendors_tbl.vendor_id)
+	    a opl:Vendor
+	    as virtrdf:OplVendor ;
+	    a opl:VendorCategory
+	    as virtrdf:OplVendorSubClassOfVendorCategory ;
+	  rdfs:label vendors_tbl.vendor_name
+	    as virtrdf:rdfsOplVendorsName ;
+	  opl:VendorName vendors_tbl.vendor_name
+	    as virtrdf:OplVendorsName ;
+	  opl:WikipediaPage opl:Uri(vendors_tbl.wikipedia_url)
+	    as virtrdf:OplVendorsWikipediaUrl ;
+	  owl:sameAs opl:lit_wikipedia_to_dbpedia(vendors_tbl.wikipedia_url)
+	    as virtrdf:OplVendorsWikipediaUrlOwlSameAs ;
+	  foaf:homepage opl:Uri(vendors_tbl.vendor_homepage)
+	    as virtrdf:OplFoafVendorHomepage ;
+	  opl:isOfVendorCategory opl:VendorCategory(vendors_tbl.vendor_category_id)
+	    as virtrdf:OplVendorIsOfVendorCategory ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs: ;
+      rdfs:isDefinedBy foaf: ;
+      rdfs:isDefinedBy owl:
+		.
+
+	  opl:VendorCategoryFamily(vendor_category_family_tbl.vendor_category_family_id)
+	    opl:hasVendorCategory
+	    opl:VendorCategory(vendor_category_tbl.vendor_category_id)
+	      where (
+		    ^{vendor_category_family_tbl.}^.vendor_category_family_id = ^{vendor_category_tbl.}^.vendor_category_family_id
+		  )
+	    as virtrdf:OplVendorCategoryFamilyHasVendorCategory .
+
+      opl:VendorCategory(vendor_category_tbl.vendor_category_id)
+	    opl:hasVendorCategory
+  	    opl:Vendor(vendors_tbl.vendor_id)
+	      where (
+		    ^{vendor_category_tbl.}^.vendor_category_id = ^{vendors_tbl.}^.vendor_category_id
+		  )
+	    as virtrdf:OplVendorCategoryHasVendors .
+
+  	opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
+	    a opl:OpsysFamily
+	    as virtrdf:OplOpsysFamily ;
+	  rdfs:label opsys_family_tbl.opsys_family_name
+  	  as virtrdf:rdfsOplOpsysFamilyName ;
+	  opl:OpsysFamilyName opsys_family_tbl.opsys_family_name
+  	  as virtrdf:OplOpsysFamilyName ;
+  	opl:OpsysFamilyLicenseCode opsys_family_tbl.opsys_license_code
+	    as virtrdf:OplOpsysFamilyLicenseCode ;
+	  opl:OpsysFamilyVendor opl:Vendor(opsys_family_tbl.vendor_id)
+  	  as virtrdf:OplOpsysFamilyVendor ;
+  	opl:OpsysFamilyRating opsys_family_tbl.rating
+	    as virtrdf:OplOpsysFamilyRating ;
+	foaf:logo opl:lit_opsys_icon(opsys_family_tbl.opsys_family_id)
+	  as virtrdf:OplLogoOpsysFamily ;
+	foaf:homepage opl:Uri(opsys_family_tbl.wikipedia_url)
+	  as virtrdf:FoafHomepageOpsysFamilyWikipediaUrl ;
+	owl:sameAs opl:lit_wikipedia_to_dbpedia(opsys_family_tbl.wikipedia_url)
+	  as virtrdf:FoafHomepageOpsysFamilyPediaUrlOwlSameAs ;
+	opl:WikipediaPage opl:Uri(opsys_family_tbl.wikipedia_url)
+	  as virtrdf:OplOpsysFamilyWikipediaUrl ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs: ;
+      rdfs:isDefinedBy foaf: ;
+      rdfs:isDefinedBy owl:
+		.
+
+	  opl:OpsysFamily(opsys_family_tbl.opsys_family_id) opl:hasOpsys
+	    opl:Opsys(opsys_tbl.opsys_name)
+	    where (^{opsys_tbl.}^.opsys_family_id = ^{opsys_family_tbl.}^.opsys_family_id)
+	    as virtrdf:OplOpsysFamilyIsOpsysFamilyOfOpsys .
+
+
+	  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
+  	  a opl:DbmsFamily
+	    as virtrdf:OplDbmsFamily ;
+	  rdfs:label dbms_family_tbl.dbms_family_name
+  	  as virtrdf:rdfsOplDbmsFamilyName ;
+	  opl:DbmsFamilyName dbms_family_tbl.dbms_family_name
+  	  as virtrdf:OplDbmsFamilyName ;
+  	opl:DbmsFamilyVendor opl:Vendor(dbms_family_tbl.vendor_id)
+      as virtrdf:OplDbmsFamilyVendor ;
+	foaf:homepage opl:Uri(dbms_family_tbl.wikipedia_url)
+ 	  as virtrdf:FoafHomepageDbmsFamilyWikipediaUrl ;
+	owl:sameAs opl:lit_wikipedia_to_dbpedia(dbms_family_tbl.wikipedia_url)
+ 	  as virtrdf:OwnSameAsDbmsFamilyPediaUrl ;
+	opl:WikipediaPage opl:Uri(dbms_family_tbl.wikipedia_url)
+	  as virtrdf:OplDbmsFamilyWikipediaUrl ;
+	  opl:DbmsFamilyRating dbms_family_tbl.rating
+  	  as virtrdf:OplDbmsFamilyRating ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs: ;
+      rdfs:isDefinedBy foaf: ;
+      rdfs:isDefinedBy owl:
+		.
+
+	  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
+  	  a opl:DbmsEngine
+	    as virtrdf:OplDbmsEngine ;
+  	  a opl:DbmsFamily
+	    as virtrdf:DbmsEngineSubClassOfDbmsFamily ;
+	    a umbel:RelationalDatabaseServerProgram
+	    as virtrdf:DbmEngineSubClassOfUmbel ;
+	  opl:isOfDbmsFamily opl:DbmsFamily(dbms_engine_tbl.dbms_family_id)
+  	  as virtrdf:OplDbmsEngineisOfDbmsFamily ;
+	  rdfs:label dbms_engine_tbl.dbms_name
+  	  as virtrdf:rdfsOplLabelDbmsName ;
+  	opl:DbmsEngineVersion dbms_engine_tbl.dbms_version
+	    as virtrdf:OplDbmsEngineVersion ;
+	  opl:DbmsEngineUpwardCompatible dbms_engine_tbl.upward_compatible
+  	  as virtrdf:OplDbmsEngineUpwardCompatible ;
+  	opl:DbmsEngineDownwardCompatible dbms_engine_tbl.downward_compatible
+	    as virtrdf:OplDbmsEngineDownwardCompatible ;
+	  opl:DbmsEngineRating dbms_engine_tbl.rating
+  	  as virtrdf:OplDbmsEngineRating ;
+  	opl:DbmsEngineOldArchiveCode dbms_engine_tbl.old_archive_code
+	    as virtrdf:OplDbmsEngineOldArchiveCode ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+
+  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
+    opl:hasDatabaseVersions
+    opl:DbmsEngine(dbms_engine_tbl.dbms_name)
+    where (
+        ^{dbms_family_tbl.}^.dbms_family_id = ^{dbms_engine_tbl.}^.dbms_family_id
+    )
+    as virtrdf:OplDbmsFamilyToDbms .
+
+
+	  opl:OpsysType(opsys_type_tbl.opsys_type_id)
+   	  a opl:OpsysType
+	    as virtrdf:OplOpsysType ;
+	  rdfs:label opsys_type_tbl.opsys_type_description
+  	  as virtrdf:rdfsOplOpsysTypeDescription ;
+	  opl:OpsysTypeDescription opsys_type_tbl.opsys_type_description
+  	  as virtrdf:OplOpsysTypeDescription ;
+  	opl:OpsysTypeShortDescription opsys_type_tbl.short_description
+	    as virtrdf:OplOpsysTypeShortDescription ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+
+	  opl:OpsysType(opsys_type_tbl.opsys_type_id) opl:hasOpsys
+	    opl:Opsys(opsys_tbl.opsys_name)
+	    where (^{opsys_tbl.}^.opsys_type_id = ^{opsys_type_tbl.}^.opsys_type_id)
+	    as virtrdf:OplOpsysTypeIsOpsysTypeOfOpsys .
+
+
+	  opl:ProcessorMode(processor_mode_tbl.processor_mode_id)
+  	  a opl:ProcessorMode
+	    as virtrdf:OplProcessorMode ;
+	  opl:ProcessorModeName processor_mode_tbl.processor_mode_name
+  	  as virtrdf:OplProcessorModeName .
+
+  	opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
+	    a opl:Processor
+	    as virtrdf:OplProcessor ;
+	  opl:ProcessorName processors_tbl.processor_name
+  	  as virtrdf:OplProcessorName ;
+  	opl:ProcessorVersion processors_tbl.processor_version
+	    as virtrdf:OplProcessorVersion ;
+	  rdfs:label processors_tbl.processor_description
+  	  as virtrdf:rdfsOplProcessorDescription ;
+	  opl:ProcessorDescription processors_tbl.processor_description
+  	  as virtrdf:OplProcessorDescription ;
+  	opl:ProcessorMode opl:ProcessorMode(processors_tbl.processor_mode_id)
+	    as virtrdf:OplProcessorProcessorMode ;
+	  opl:isOfProcessorFamily opl:ProcessorFamily(processors_tbl.processor_family_id)
+  	  as virtrdf:OplProcessorIsOfProcessorFamily ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+	opl:ProcessorFamily(processor_family_tbl.processor_family_id)
+  	  a opl:ProcessorFamily
+	    as virtrdf:OplProcessorFamily ;
+    opl:ProcessorFamilyName processor_family_tbl.processor_family_name
+  	  as virtrdf:OplProcessorFamilyName ;
+    opl:ProcessorFamilyVendor opl:Vendor(processor_family_tbl.vendor_id)
+	  as virtrdf:OplProcessorFamilyVendor ;
+	foaf:homepage opl:Uri(processor_family_tbl.wikipedia_url)
+	  as virtrdf:FoafHomepageProcessorFamilyWikipediaUrl ;
+	owl:sameAs opl:lit_wikipedia_to_dbpedia(processor_family_tbl.wikipedia_url)
+	  as virtrdf:OwlSameAsProcessorFamilyPediaUrl ;
+    opl:WikipediaPage opl:Uri(processor_family_tbl.wikipedia_url)
+	  as virtrdf:OplProcessorFamilyWikipediaUrl ;
+	rdfs:label processor_family_tbl.processor_family_description
+  	  as virtrdf:rdfsOplProcessorFamilyDescription ;
+	opl:ProcessorFamilyDescription processor_family_tbl.processor_family_description
+  	  as virtrdf:OplProcessorFamilyDescription ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy foaf: ;
+      rdfs:isDefinedBy owl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+	  opl:Opsys(opsys_tbl.opsys_name)
+  	  a opl:Opsys
+	    as virtrdf:OplOpsys ;
+  	  a opl:OpsysFamily
+	    as virtrdf:OpsysSubClassOfOplOpsysFamily ;
+  	  a umbel:OperatingSystem
+	    as virtrdf:OpsysSubClassOfUmbelOpsys ;
+	  opl:OpsysVersion opsys_tbl.opsys_version
+  	  as virtrdf:OplOpsysVersion ;
+  	opl:OpsysUpwardCompatible opsys_tbl.upward_compatible
+	    as virtrdf:OplOpsysUpwardCompatible ;
+	  opl:OpsysDownwardCompatible opsys_tbl.downward_compatible
+  	  as virtrdf:OplOpsysDownwardCompatible ;
+  	opl:OpsysSupported opsys_tbl.supported
+	    as virtrdf:OplOpsysSupported ;
+	  opl:OpsysLicenseCode opsys_tbl.opsys_license_code
+  	  as virtrdf:OplOpsysLicenseCode ;
+  	rdfs:label opsys_tbl.commercial_name
+	    as virtrdf:rdfsOplOpsysCommercialName ;
+  	opl:OpsysCommercialName opsys_tbl.commercial_name
+	    as virtrdf:OplOpsysCommercialName ;
+	  opl:OpsysEmulationMode opl:ProcessorMode(opsys_tbl.emulation_mode_id)
+  	  as virtrdf:OplOpsysEmulationMode ;
+  	opl:OpsysProcessor opl:Processor(opsys_tbl.processor_name, opsys_tbl.processor_mode_id)
+	    as virtrdf:OplOpsysProcessor ;
+	  opl:isOfOpsysFamily opl:OpsysFamily(opsys_tbl.opsys_family_id)
+  	  as virtrdf:OplOpsysIsOfOpsysFamily ;
+  	opl:isOfOpsysType opl:OpsysType(opsys_tbl.opsys_type_id)
+	    as virtrdf:OplOpsysIsOfOpsysType ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+
+	  opl:Product(product_with_code.product_id)
+	    a opl:Product
+	    as virtrdf:OplProduct ;
+	    a opl:ProductFormat
+	    as virtrdf:ProductSubClassOfProductFormat ;
+	    a opl:ProductCategory
+	    as virtrdf:ProductSubClassOfProductCategory ;
+	    a opl:ProductFormatCategory
+	    as virtrdf:OplProductProductFormatCategory ;
+	  rdfs:label product_with_code.poduct_description
+	    as virtrdf:rdfsOplProductDescription ;
+	  foaf:homepage opl:wwwsiteproduct(product_with_code.product_id)
+        as virtrdf:homepageProductFamilyCategoryFormatProductUda ;
+	  opl:ProductDescription product_with_code.poduct_description
+	    as virtrdf:OplProductDescription ;
+	  dc:description opl:lit_to_string(product_with_code.long_description)
+	    as virtrdf:OplProductLongDescription ;
+	  opl:isOfCategory opl:ProductCategory(product_with_code.product_cat_code)
+	    as virtrdf:OplProductIsOfCategory ;
+	  opl:isOfFormat opl:ProductFormat(product_with_code.product_format_code)
+	    as virtrdf:OplProductIsOfFormat ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy foaf: ;
+      rdfs:isDefinedBy dc: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+
+	  opl:Product(product_with_code.product_id) opl:hasProductRelease
+	    opl:ProductRelease(
+	      product_release_tbl.product_id,
+	      product_release_tbl.product_release_id,
+	      product_release_tbl.opsys_name,
+	      product_release_tbl.dbms_name
+	      )
+	      where (^{product_with_code.}^.product_id = ^{product_release_tbl.}^.product_id)
+	    as virtrdf:OplProductIsProductOfProductRelease .
+
+
+
+	  opl:ProductRelease(
+	      product_release_tbl.product_id,
+	      product_release_tbl.product_release_id,
+	      product_release_tbl.opsys_name,
+	      product_release_tbl.dbms_name
+	      )
+	    a opl:ProductRelease
+	    as virtrdf:OplProductRelease ;
+	    a opl:Product
+	    as virtrdf:OplProductReleaseSubClassProduct ;
+		a gr:ProductOrService
+		as virtrdf:OplProductReleaseAgrProductOrService ;
+	  rdfs:label opl:lit_product_release_label(
+	      product_release_tbl.product_id,
+	      product_release_tbl.product_release_id,
+	      product_release_tbl.opsys_name,
+	      product_release_tbl.dbms_name
+	  )
+	    as virtrdf:rdfsOplProductReleaseProductReleaseId ;
+	  opl:ProductReleaseProductReleaseId product_release_tbl.product_release_id
+	    as virtrdf:OplProductReleaseProductReleaseId ;
+	  opl:isOfProduct opl:Product(product_release_tbl.product_id)
+	    as virtrdf:OplProductReleaseIsOfProduct ;
+	  opl:isForOpsys opl:Opsys(product_release_tbl.opsys_name)
+	    as virtrdf:OplProductReleaseIsForOpsys ;
+	  opl:isForDbmsEngine opl:DbmsEngine(product_release_tbl.dbms_name)
+	    as virtrdf:OplProductReleaseIsForDbmsEngine ;
+  	  opl:UpwardCompatible product_release_tbl.upward_compatible
+	    as virtrdf:OplProductReleaseUpwardCompatible ;
+	  opl:DownwardCompatible product_release_tbl.downward_compatible
+  	    as virtrdf:OplProductReleaseDownwardCompatible ;
+      opl:PurchaseInShop opl:lit_to_shop (
+	      product_release_tbl.product_release_id,
+	      product_release_tbl.product_id,
+	      product_release_tbl.opsys_name,
+	      product_release_tbl.dbms_name
+	 	)
+   		as virtrdf:OplProductReleaseToShop ;
+	  gr:hasBusinessFunction gr:Sell as virtrdf:grbusinessfunctionsell;
+  	  opl:Supported product_release_tbl.supported
+	    as virtrdf:OplProductReleaseSupported ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy gr:
+		.
+
+	  opl:ProductRelease(
+	      product_release_tbl.product_id,
+	      product_release_tbl.product_release_id,
+	      product_release_tbl.opsys_name,
+	      product_release_tbl.dbms_name
+	      ) opl:hasComponentArchive
+	  opl:ComponentArchive(component_archive_tbl.component_archive_name)
+			where (
+					^{product_release_tbl.}^.product_id = ^{component_archive_tbl.}^.product_id and
+					^{product_release_tbl.}^.product_release_id = ^{component_archive_tbl.}^.product_release_id and
+					^{product_release_tbl.}^.opsys_name = ^{component_archive_tbl.}^.opsys_name and
+					^{product_release_tbl.}^.dbms_name = ^{component_archive_tbl.}^.dbms_name
+			)
+	    as virtrdf:OplProductReleaseIsProductReleaseOfComponentArchive .
+
+
+	  opl:Component(components_tbl.component_name)
+	    a opl:Component
+	    as virtrdf:OplComponent ;
+	  opl:isOfComponentCategory opl:ComponentCategory(components_tbl.component_category_id)
+	    as virtrdf:OplComponentIsOfComponentCategory ;
+	  opl:isOfComponentType opl:ComponentType(components_tbl.component_type_id)
+	    as virtrdf:OplComponentIsOfComponentType ;
+	  opl:isOfComponentMode opl:ComponentMode(components_tbl.component_mode_id)
+	    as virtrdf:OplComponentIsOfComponentMode ;
+	  opl:isForOpsys opl:Opsys(components_tbl.opsys_name)
+	    as virtrdf:OplComponentIsForOpsys ;
+	  opl:isForDbmsEngine opl:DbmsEngine(components_tbl.dbms_name)
+	    as virtrdf:OplComponentIsForDbmsEngine ;
+	  opl:ComponentCvsid components_tbl.component_cvsid
+	    as virtrdf:OplComponentComponentCvsId ;
+	  opl:ComponentBuildDate components_tbl.component_build_date
+	    as virtrdf:OplComponentComponentBuildDate ;
+	  opl:Notes components_tbl.notes
+	    as virtrdf:OplComponentNotes ;
+	  opl:BuildComments components_tbl.build_comments
+	    as virtrdf:OplComponentBuildComments ;
+	  opl:Filesize components_tbl.str_filesize
+	    as virtrdf:OplComponentFilesize ;
+      rdfs:isDefinedBy opl:
+		.
+
+    opl:DbmsEngine (dbms_engine_tbl.dbms_name) opl:hasComponents
+      opl:Component(components_tbl.component_name)
+      where (^{components_tbl.}^.dbms_name = ^{dbms_engine_tbl.}^.dbms_name)
+      as virtrdf:OplDbmsEngineForComponents .
+
+    opl:Opsys (opsys_tbl.opsys_name) opl:hasComponents
+      opl:Component(components_tbl.component_name)
+      where (^{components_tbl.}^.opsys_name = ^{opsys_tbl.}^.opsys_name)
+      as virtrdf:OplOpsysForComponents .
+
+
+	  opl:ComponentMode(component_mode_tbl.component_mode_id)
+	    a opl:ComponentMode
+	    as virtrdf:OplComponentMode ;
+	  rdfs:label component_mode_tbl.component_mode_description
+	    as virtrdf:rdfsOplComponentModeDescription ;
+	  opl:ComponentModeDescription component_mode_tbl.component_mode_description
+	    as virtrdf:OplComponentModeDescription ;
+	  opl:ComponentModeShortDescription component_mode_tbl.short_description
+	    as virtrdf:OplComponentModeShortDescription ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+	  opl:ComponentType(component_type_tbl.component_type_id)
+	    a opl:ComponentType
+	    as virtrdf:OplComponentType ;
+	  rdfs:label component_type_tbl.component_type_description
+	    as virtrdf:rdfsOplComponentTypeDescription ;
+	  opl:ComponentTypeDescription component_type_tbl.component_type_description
+	    as virtrdf:OplComponentTypeDescription ;
+	  opl:ComponentTypeShortDescription component_type_tbl.short_description
+	    as virtrdf:OplComponentTypeShortDescription ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+	  opl:ComponentCategory(component_category_tbl.component_category_id)
+	    a opl:ComponentCategory
+	    as virtrdf:OplComponentCategory ;
+	  rdfs:label component_category_tbl.component_category_description
+	    as virtrdf:rdfsOplComponentCategoryDescription ;
+	  opl:ComponentCategoryDescription component_category_tbl.component_category_description
+	    as virtrdf:OplComponentCategoryDescription ;
+	  opl:ComponentCategoryShortDescription component_category_tbl.short_description
+	    as virtrdf:OplComponentCategoryShortDescription ;
+	  dc:description opl:lit_to_string(component_category_tbl.component_category_long_description)
+	    as virtrdf:OplComponentCategoryLongDescription ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+	  opl:ComponentArchive(component_archive_tbl.component_archive_name)
+	    a opl:ComponentArchive
+	    as virtrdf:OplComponentArchive ;
+	    a opl:Component
+	    as virtrdf:ComponentArchiveSubClassOfComponent ;
+	  opl:ComponentArchiveName component_archive_tbl.component_archive_name
+	    as virtrdf:OplComponentArchiveComponentArchiveName ;
+	  rdfs:label component_archive_tbl.component_archive_name
+	    as virtrdf:rdfsComponentArchiveComponentArchiveName ;
+  	opl:ComponentArchiveType opl:ComponentArchiveType(component_archive_tbl.component_archive_type_id)
+	  	as virtrdf:ComponentArchiveComponentArchiveType ;
+	  opl:isOfComponent opl:Component(component_archive_tbl.component_name)
+	    as virtrdf:OplComponentArchiveIsOfComponent ;
+	  opl:isOfProductRelease opl:ProductRelease(
+	      component_archive_tbl.product_id,
+	      component_archive_tbl.product_release_id,
+	      component_archive_tbl.opsys_name,
+	      component_archive_tbl.dbms_name
+	      )
+	    as virtrdf:OplComponentArchiveIsOfProductRelease ;
+  	opl:AssemblyDate component_archive_tbl.assembly_date
+	  	as virtrdf:OplComponentArchiveAssemblyDate ;
+	  opl:FileUri component_archive_tbl.file_uri
+  		as virtrdf:OplComponentArchiveFileUri ;
+  	opl:LicenseCode component_archive_tbl.license_code
+		  as virtrdf:OplComponentArchiveLicenseCode ;
+	  opl:ResFullPath component_archive_tbl.res_full_path
+  		as virtrdf:OplComponentArchiveResFullPath ;
+  	opl:ResName component_archive_tbl.res_name
+		  as virtrdf:OplComponentArchiveResName ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+
+	opl:ComponentArchiveType(component_archive_type_tbl.component_archive_type_id)
+	  a opl:ComponentArchiveType
+		as virtrdf:OplComponentArchiveType ;
+	opl:ComponentArchiveShortName component_archive_type_tbl.component_archive_short_name
+		as virtrdf:OplComponentArchiveTypeComponentArchiveShortName ;
+	rdfs:label component_archive_type_tbl.component_archive_type_name
+		as virtrdf:rdfsOplComponentArchiveTypeComponentArchiveTypeName ;
+	opl:ComponentArchiveTypeName component_archive_type_tbl.component_archive_type_name
+		as virtrdf:OplComponentArchiveTypeComponentArchiveTypeName ;
+	opl:Extension component_archive_type_tbl.extension
+		as virtrdf:OplComponentArchiveTypeExtension ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+
+	opl:DownloadLocation(download_location_tbl.uri)
+	  a opl:DownloadLocation
+		as virtrdf:OplDownloadLocation ;
+	opl:isOfComponentArchive opl:ComponentArchive(download_location_tbl.component_archive_name)
+		as virtrdf:OplDownloadLocationIsOfComponentArchive ;
+	opl:hasDownloadProtocol opl:DownloadProtocol(download_location_tbl.protocol_name)
+		as virtrdf:DownloadLocationHasProtocolName ;
+	rdfs:label download_location_tbl.uri_old
+		as virtrdf:rdfsOplDownloadLocationLabel ;
+	opl:isOfProductRelease opl:ProductRelease(
+		download_location_tbl.product_id,
+		download_location_tbl.product_release_id,
+		download_location_tbl.opsys_name,
+		download_location_tbl.dbms_name
+		)
+		as virtrdf:OplDownloadLocationIsOfProductRelease ;
+	opl:Uri download_location_tbl.uri
+		as virtrdf:OplDownloadLocationUri ;
+	opl:UriOld download_location_tbl.uri_old
+		as virtrdf:OplDownloadLocationUriOld ;
+    opl:hasDownloadPartner opl:DownloadPartner(
+        download_location_tbl.host_name,
+        download_location_tbl.domain_name
+      )
+        as virtrdf:OplDownloadLocationHasDownloadPartner ;
+	opl:DomainName download_location_tbl.domain_name
+		as virtrdf:OplDownloadLocationDomainName ;
+	opl:HostName download_location_tbl.host_name
+		as virtrdf:OplDownloadLocationHostName ;
+	opl:ResName download_location_tbl.res_name
+		as virtrdf:OplDownloadLocationResName ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+	opl:DownloadProtocol(download_protocol_tbl.protocol_name)
+	  a opl:DownloadProtocol
+		as virtrdf:OplDownloadProtocolProtocolName ;
+	opl:ProtocolDescription download_protocol_tbl.protocol_description
+		as virtrdf:OplDownloadProtocolProtocolDescription .
+
+	opl:DownloadPartner(
+	  download_partner_tbl.host_name,
+	  download_partner_tbl.domain_name
+	  )
+	  a opl:DownloadPartner
+	  as virtrdf:OplDownloadPartner;
+	rdfs:label download_partner_tbl.partner_name
+	  as virtrdf:rdfsOplDownloadPartnerPartnerNamelabel ;
+	opl:DownloadPartner download_partner_tbl.partner_name
+	  as virtrdf:OplDownloadPartnerPartnerName ;
+	opl:PortNumber download_partner_tbl.port_number
+	  as virtrdf:OplDownloadPartnerPortNumber ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+    opl:ComponentArchive(component_archive_tbl.component_archive_name)
+      opl:hasDownloadLocation
+      opl:DownloadLocation(download_location_tbl.uri)
+		where (
+				^{component_archive_tbl.}^.component_archive_name = ^{download_location_tbl.}^.component_archive_name
+		)
+      as virtrdf:OplComponentArchiveIsComponentArchiveOfDownloadLocation .
+
+    opl:DownloadLocation(download_location_tbl.uri)
+      opl:isDownloadLocationOf
+      opl:ComponentArchive(component_archive_tbl.component_archive_name)
+		where (
+				 ^{download_location_tbl.}^.component_archive_name = ^{component_archive_tbl.}^.component_archive_name
+		)
+      as virtrdf:OplDownloadLocationIsDownloadLocationOfComponentArchive .
+
+
+#
+# Extra Peripheral family/cat/format/etc... to/from... dbfamily/opsysfamily/....
+# ==================================================================================
+
+
+# ---------------------> product_family
+
+#  opl:ProductFamily(product_family_tbl.product_family_code)
+#    opl:OperatingSystems
+#    opl:Opsys(ac1.opsys_name)
+#    where (
+#        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
+#    )
+#    as virtrdf:OplProductFamilyToOpsys .
+
+  opl:ProductFamily(product_family_tbl.product_family_code)
+    opl:OperatingSystemsFamilies
+    opl:OpsysFamily(ac1.opsys_family_id)
+    where (
+        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
+    )
+    as virtrdf:OplProductFamilyToOpsysFamily .
+
+#  opl:ProductFamily(product_family_tbl.product_family_code)
+#    opl:Databases
+#    opl:DbmsEngine(ac1.dbms_name)
+#    where (
+#        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
+#    )
+#    as virtrdf:OplProductFamilyToDbms .
+
+  opl:ProductFamily(product_family_tbl.product_family_code)
+    opl:DatabaseFamilies
+    opl:DbmsFamily(ac1.dbms_family_id)
+    where (
+        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
+    )
+    as virtrdf:OplProductFamilyToDbmsFamily .
+
+#  opl:ProductFamily(product_family_tbl.product_family_code)
+#    opl:Processors
+#  	opl:Processor(ac1.processor_name, ac1.processor_mode_id)
+#    where (
+#        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
+#    )
+#    as virtrdf:OplProductFamilyToProcessor .
+
+  opl:ProductFamily(product_family_tbl.product_family_code)
+    opl:ProcessorFamilies
+	opl:ProcessorFamily(ac1.processor_family_id)
+    where (
+        ^{product_family_tbl.}^.product_family_code = ^{ac1.}^.product_family_code
+    )
+    as virtrdf:OplProductFamilyToProcessorFamily .
+
+
+
+# ---------------------> product_format
+
+#  opl:ProductFormat(product_format_with_code.product_format_code)
+#    opl:OperatingSystems
+#    opl:Opsys(ac1.opsys_name)
+#    where (
+#        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
+#    )
+#    as virtrdf:OplProductFormatToOpsys .
+
+  opl:ProductFormat(product_format_with_code.product_format_code)
+    opl:OperatingSystemsFamilies
+    opl:OpsysFamily(ac1.opsys_family_id)
+    where (
+        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
+    )
+    as virtrdf:OplProductFormatToOpsysFamily .
+
+#  opl:ProductFormat(product_format_with_code.product_format_code)
+#    opl:Databases
+#    opl:DbmsEngine(ac1.dbms_name)
+#    where (
+#        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
+#    )
+#    as virtrdf:OplProductFormatToDbms .
+
+  opl:ProductFormat(product_format_with_code.product_format_code)
+    opl:DatabaseFamilies
+    opl:DbmsFamily(ac1.dbms_family_id)
+    where (
+        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
+    )
+    as virtrdf:OplProductFormatToDbmsFamily .
+
+  opl:ProductFormat(product_format_with_code.product_format_code)
+    opl:Processors
+  	opl:Processor(ac1.processor_name, ac1.processor_mode_id)
+    where (
+        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
+    )
+    as virtrdf:OplProductFormatToProcessor .
+
+  opl:ProductFormat(product_format_with_code.product_format_code)
+    opl:ProcessorFamilies
+	opl:ProcessorFamily(ac1.processor_family_id)
+    where (
+        ^{product_format_with_code.}^.product_format_code = ^{ac1.}^.product_format_code
+    )
+    as virtrdf:OplProductFormatToProcessorFamily .
+
+
+
+# ---------------------> product_category
+
+#  opl:ProductCategory(product_category_with_code.product_cat_code)
+#    opl:OperatingSystems
+#    opl:Opsys(ac1.opsys_name)
+#    where (
+#        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
+#    )
+#    as virtrdf:OplProductCatToOpsys .
+
+  opl:ProductCategory(product_category_with_code.product_cat_code)
+    opl:OperatingSystemsFamilies
+    opl:OpsysFamily(ac1.opsys_family_id)
+    where (
+        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
+    )
+    as virtrdf:OplProductCatToOpsysFamily .
+
+#  opl:ProductCategory(product_category_with_code.product_cat_code)
+#    opl:Databases
+#    opl:DbmsEngine(ac1.dbms_name)
+#    where (
+#        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
+#    )
+#    as virtrdf:OplProductCatToDbms .
+
+  opl:ProductCategory(product_category_with_code.product_cat_code)
+    opl:DatabaseFamilies
+    opl:DbmsFamily(ac1.dbms_family_id)
+    where (
+        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
+    )
+    as virtrdf:OplProductCatToDbmsFamily .
+
+#  opl:ProductCategory(product_category_with_code.product_cat_code)
+#    opl:Processors
+#  	opl:Processor(ac1.processor_name, ac1.processor_mode_id)
+#    where (
+#        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
+#    )
+#    as virtrdf:OplProductCatToProcessor .
+
+  opl:ProductCategory(product_category_with_code.product_cat_code)
+    opl:ProcessorFamilies
+	opl:ProcessorFamily(ac1.processor_family_id)
+    where (
+        ^{product_category_with_code.}^.product_cat_code = ^{ac1.}^.product_cat_code
+    )
+    as virtrdf:OplProductCatToProcessorFamily .
+
+
+
+
+# ---------------------> product
+
+  opl:Product(product_with_code.product_id)
+    opl:OperatingSystems
+    opl:Opsys(ac1.opsys_name)
+    where (
+        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
+    )
+    as virtrdf:OplProductToOpsys .
+
+  opl:Product(product_with_code.product_id)
+    opl:OperatingSystemsFamilies
+    opl:OpsysFamily(ac1.opsys_family_id)
+    where (
+        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
+    )
+    as virtrdf:OplProductToOpsysFamily .
+
+  opl:Product(product_with_code.product_id)
+    opl:Databases
+    opl:DbmsEngine(ac1.dbms_name)
+    where (
+        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
+    )
+    as virtrdf:OplProductToDbms .
+
+  opl:Product(product_with_code.product_id)
+    opl:DatabaseFamilies
+    opl:DbmsFamily(ac1.dbms_family_id)
+    where (
+        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
+    )
+    as virtrdf:OplProductToDbmsFamily .
+
+  opl:Product(product_with_code.product_id)
+    opl:Processors
+  	opl:Processor(ac1.processor_name, ac1.processor_mode_id)
+    where (
+        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
+    )
+    as virtrdf:OplProductToProcessor .
+
+  opl:Product(product_with_code.product_id)
+    opl:ProcessorFamilies
+	opl:ProcessorFamily(ac1.processor_family_id)
+    where (
+        ^{product_with_code.}^.product_id = ^{ac1.}^.product_id
+    )
+    as virtrdf:OplProductToProcessorFamily .
+
+
+
+
+# ---------------------> to product
+
+  opl:Opsys(opsys_tbl.opsys_name)
+    opl:hasProducts
+    opl:Product(ac1.product_id)
+    where (
+        ^{opsys_tbl.}^.opsys_name = ^{ac1.}^.opsys_name
+    )
+    as virtrdf:OplOpsysToProduct .
+
+  opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
+    opl:hasProducts
+    opl:Product(ac1.product_id)
+    where (
+        ^{opsys_family_tbl.}^.opsys_family_id = ^{ac1.}^.opsys_family_id
+    )
+    as virtrdf:OplOpsysFamilyToProduct .
+
+  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
+    opl:hasProducts
+    opl:Product(ac1.product_id)
+    where (
+        ^{dbms_engine_tbl.}^.dbms_name = ^{ac1.}^.dbms_name
+    )
+    as virtrdf:OplDbmsToProduct .
+
+  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
+    opl:hasProducts
+    opl:Product(ac1.product_id)
+    where (
+        ^{dbms_family_tbl.}^.dbms_family_id = ^{ac1.}^.dbms_family_id
+    )
+    as virtrdf:OplDbmsFamilyToProduct .
+
+  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
+    opl:hasProducts
+    opl:Product(ac1.product_id)
+    where (
+        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
+        and
+        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
+    )
+    as virtrdf:OplProcessorToProduct .
+
+  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
+    opl:hasProducts
+    opl:Product(ac1.product_id)
+    where (
+        ^{processor_family_tbl.}^.processor_family_id = ^{ac1.}^.processor_family_id
+    )
+    as virtrdf:OplProcessorFamilyProduct .
+
+
+
+
+# ---------------------> to product_cat
+
+#  opl:Opsys(opsys_tbl.opsys_name)
+#    opl:hasProductCategory
+#    opl:ProductCategory(ac1.product_cat_code)
+#    where (
+#        ^{opsys_tbl.}^.opsys_name = ^{ac1.}^.opsys_name
+#    )
+#    as virtrdf:OplOpsysToProductCategory .
+
+  opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
+    opl:hasProductCategory
+    opl:ProductCategory(ac1.product_cat_code)
+    where (
+        ^{opsys_family_tbl.}^.opsys_family_id = ^{ac1.}^.opsys_family_id
+    )
+    as virtrdf:OplOpsysFamilyToProductCategory .
+
+#  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
+#    opl:hasProductCategory
+#    opl:ProductCategory(ac1.product_cat_code)
+#    where (
+#        ^{dbms_engine_tbl.}^.dbms_name = ^{ac1.}^.dbms_name
+#    )
+#    as virtrdf:OplDbmsToProductCategory .
+
+  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
+    opl:hasProductCategory
+    opl:ProductCategory(ac1.product_cat_code)
+    where (
+        ^{dbms_family_tbl.}^.dbms_family_id = ^{ac1.}^.dbms_family_id
+    )
+    as virtrdf:OplDbmsFamilyToProductCategory .
+
+#  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
+#    opl:hasProductCategory
+#    opl:ProductCategory(ac1.product_cat_code)
+#    where (
+#        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
+#        and
+#        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
+#    )
+#    as virtrdf:OplProcessorToProductCategory .
+
+  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
+    opl:hasProductCategory
+    opl:ProductCategory(ac1.product_cat_code)
+    where (
+        ^{processor_family_tbl.}^.processor_family_id = ^{ac1.}^.processor_family_id
+    )
+    as virtrdf:OplProcessorFamilyProductCategory .
+
+
+
+
+# ---------------------> to product_format
+
+#  opl:Opsys(opsys_tbl.opsys_name)
+#    opl:hasProductFormat
+#    opl:ProductFormat(ac1.product_format_code)
+#    where (
+#        ^{opsys_tbl.}^.opsys_name = ^{ac1.}^.opsys_name
+#    )
+#    as virtrdf:OplOpsysToProductFormat .
+
+  opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
+    opl:hasProductFormat
+    opl:ProductFormat(ac1.product_format_code)
+    where (
+        ^{opsys_family_tbl.}^.opsys_family_id = ^{ac1.}^.opsys_family_id
+    )
+    as virtrdf:OplOpsysFamilyToProductFormat .
+
+#  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
+#    opl:hasProductFormat
+#    opl:ProductFormat(ac1.product_format_code)
+#    where (
+#        ^{dbms_engine_tbl.}^.dbms_name = ^{ac1.}^.dbms_name
+#    )
+#    as virtrdf:OplDbmsToProductFormat .
+
+  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
+    opl:hasProductFormat
+    opl:ProductFormat(ac1.product_format_code)
+    where (
+        ^{dbms_family_tbl.}^.dbms_family_id = ^{ac1.}^.dbms_family_id
+    )
+    as virtrdf:OplDbmsFamilyToProductFormat .
+
+#  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
+#    opl:hasProductFormat
+#    opl:ProductFormat(ac1.product_format_code)
+#    where (
+#        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
+#        and
+#        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
+#    )
+#    as virtrdf:OplProcessorToProductFormat .
+
+  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
+    opl:hasProductFormat
+    opl:ProductFormat(ac1.product_format_code)
+    where (
+        ^{processor_family_tbl.}^.processor_family_id = ^{ac1.}^.processor_family_id
+    )
+    as virtrdf:OplProcessorFamilyProductFormat .
+
+
+
+
+# ---------------------> to product_family
+
+#  opl:Opsys(opsys_tbl.opsys_name)
+#    opl:hasProductFamily
+#    opl:ProductFamily(ac1.product_family_code)
+#    where (
+#        ^{opsys_tbl.}^.opsys_name = ^{ac1.}^.opsys_name
+#    )
+#    as virtrdf:OplOpsysToProductFamily .
+
+  opl:OpsysFamily(opsys_family_tbl.opsys_family_id)
+    opl:hasProductFamily
+    opl:ProductFamily(ac1.product_family_code)
+    where (
+        ^{opsys_family_tbl.}^.opsys_family_id = ^{ac1.}^.opsys_family_id
+    )
+    as virtrdf:OplOpsysFamilyToProductFamily .
+
+#  opl:DbmsEngine(dbms_engine_tbl.dbms_name)
+#    opl:hasProductFamily
+#    opl:ProductFamily(ac1.product_family_code)
+#    where (
+#        ^{dbms_engine_tbl.}^.dbms_name = ^{ac1.}^.dbms_name
+#    )
+#    as virtrdf:OplDbmsToProductFamily .
+
+  opl:DbmsFamily(dbms_family_tbl.dbms_family_id)
+    opl:hasProductFamily
+    opl:ProductFamily(ac1.product_family_code)
+    where (
+        ^{dbms_family_tbl.}^.dbms_family_id = ^{ac1.}^.dbms_family_id
+    )
+    as virtrdf:OplDbmsFamilyToProductFamily .
+
+#  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
+#    opl:hasProductFamily
+#    opl:ProductFamily(ac1.product_family_code)
+#    where (
+#        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
+#        and
+#        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
+#    )
+#    as virtrdf:OplProcessorToProductFamily .
+
+  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
+    opl:hasProductFamily
+    opl:ProductFamily(ac1.product_family_code)
+    where (
+        ^{processor_family_tbl.}^.processor_family_id = ^{ac1.}^.processor_family_id
+    )
+    as virtrdf:OplProcessorFamilyProductFamily .
+
+
+#
+# Product Benefits and things
+# =========================================
+
+	opl:ProductBenefit(product_benefits_tbl.product_benefit_id)
+	  a opl:ProductBenefit
+	  as virtrdf:OplProductBenefit ;
+	rdfs:label product_benefits_tbl.product_benefit_desc
+	  as virtrdf:rdfsLabelProductBenefitDescription ;
+	opl:isOfProductBenefitCategory opl:ProductBenefitCategory(product_benefits_tbl.product_benefit_category_id)
+	  as virtrdf:OplProductBenefitIsOfProductBenefitCategory ;
+	opl:Description product_benefits_tbl.product_benefit_desc
+	  as virtrdf:OplProductBenefitDescription ;
+	opl:Acronym product_benefits_tbl.product_benefit_acronym
+	  as virtrdf:OplProductBenefitAcronym ;
+  opl:Explanation product_benefits_tbl.product_benefit_explanation
+    as virtrdf:OplProductBenefitExplanation ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+	opl:ProductBenefitCategory(product_benefits_category_tbl.product_benefit_category_id)
+	  a opl:ProductBenefitCategory
+	  as virtrdf:OplProductBenefitCategory ;
+	rdfs:label product_benefits_category_tbl.description
+	  as virtrdf:rdfsLabelProductBenefitCategoryDescription ;
+	opl:Description product_benefits_category_tbl.description
+	  as virtrdf:OplProductBenefitCategoryDescription ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+	opl:ProductFeatureCategory(product_feature_category_tbl.product_feature_category_id)
+	  a opl:ProductFeatureCategory
+	  as virtrdf:OplProductFeatureCategory ;
+	rdfs:label product_feature_category_tbl.short_desc
+	  as virtrdf:rdfsLabelProductFeatureCategoryShortDescription ;
+	opl:ShortDescription product_feature_category_tbl.short_desc
+	  as virtrdf:OplProductFeatureCategoryShortDescription ;
+	opl:Description product_feature_category_tbl.description
+	  as virtrdf:OplProductFeatureCategoryDescription ;
+	opl:StandardsId product_feature_category_tbl.standards_id
+	  as virtrdf:OplProductFeatureCategoryStandardsId ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+	opl:ProductFeature(product_features_tbl.product_feature_id)
+	  a opl:ProductFeature
+	  as virtrdf:OplProductFeature ;
+	rdfs:label product_features_tbl.short_description
+		as virtrdf:rdfsLabelProductFeaturesShortDescription ;
+	opl:Description product_features_tbl.short_description
+		as virtrdf:OplProductFeaturesShortDescription ;
+	dc:description opl:lit_to_string(product_features_tbl.long_description)
+		as virtrdf:OplProductFeaturesLongDescription ;
+	opl:isOfProductBenefit opl:ProductBenefit(product_features_tbl.product_feature_benefit_id)
+		as virtrdf:ProductFeaturesIsOfProductBenefit ;
+	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_features_tbl.product_feature_category_id)
+		as virtrdf:ProductFeaturesIsOfProductFeatureCategory ;
+	opl:isOfProduct opl:Product(product_features_tbl.product_id)
+		as virtrdf:ProductFeaturesIsOfProduct ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy dc: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+    opl:Product(product_with_code.product_id)
+      opl:hasFeature
+      opl:ProductFeature(product_features_tbl.product_feature_id)
+      where (
+	    ^{product_with_code.}^.product_id = ^{product_features_tbl.}^.product_id
+	)
+	as virtrdf:OplProductHasProductFeaturesProductFeatures .
+
+    opl:ProductFeature(product_features_tbl.product_feature_id)
+      opl:isFeatureOf
+      opl:Product(product_with_code.product_id)
+      where (
+        ^{product_with_code.}^.product_id = ^{product_features_tbl.}^.product_id
+    )
+    as virtrdf:OplProductFeaturesAreProductFeaturesProduct .
+
+
+	opl:ProductFamilyFeature(product_family_features_tbl.product_family_feature_id)
+	  a opl:ProductFamilyFeature
+		as virtrdf:OplProductFamilyFeature ;
+	rdfs:label product_family_features_tbl.short_description
+		as virtrdf:rdfsLabelProductFamilyFeaturesShortDescription ;
+	opl:Description product_family_features_tbl.short_description
+		as virtrdf:OplProductFamilyFeaturesShortDescription ;
+	dc:description opl:lit_to_string(product_family_features_tbl.long_description)
+		as virtrdf:OplProductFamilyFeaturesLongDescription ;
+	opl:isOfProductBenefit opl:ProductBenefit(product_family_features_tbl.product_family_feature_benefit_id)
+		as virtrdf:ProductFamilyFeaturesIsOfProductBenefit ;
+	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_family_features_tbl.product_family_feature_cat_id)
+		as virtrdf:ProductFamilyFeaturesIsOfProductFeatureCategory ;
+	opl:isOfProductFamily opl:ProductFamily(product_family_features_tbl.product_family_code)
+		as virtrdf:ProductFamilyFeaturesIsOfProductFamily ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy dc: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+    opl:ProductFamily(product_family_tbl.product_family_code)
+      opl:hasFeature
+      opl:ProductFamilyFeature(product_family_features_tbl.product_family_feature_id)
+      where (
+	    ^{product_family_tbl.}^.product_family_id = ^{product_family_features_tbl.}^.product_family_id
+	)
+	as virtrdf:OplProductFamilyHasProductFamilyFeaturesProductFamilyFeatures .
+
+    opl:ProductFamilyFeature(product_family_features_tbl.product_family_feature_id)
+      opl:isFeatureOf
+      opl:Product(product_family_tbl.product_family_code)
+      where (
+        ^{product_family_tbl.}^.product_family_id = ^{product_family_features_tbl.}^.product_family_id
+    )
+    as virtrdf:OplProductFamilyFeaturesAreProductFamilyFeaturesProductFamily .
+
+
+	opl:ProductFormatFeature(product_format_features_tbl.product_format_feature_id)
+	  a opl:ProductFormatFeature
+	  as virtrdf:OplProductFormatFeature ;
+	rdfs:label product_format_features_tbl.short_description
+		as virtrdf:rdfsLabelProductFormatFeaturesShortDescription ;
+	opl:Description product_format_features_tbl.short_description
+		as virtrdf:OplProductFormatFeaturesShortDescription ;
+	dc:description opl:lit_to_string(product_format_features_tbl.long_description)
+		as virtrdf:OplProductFormatFeaturesLongDescription ;
+	opl:isOfProductBenefit opl:ProductBenefit(product_format_features_tbl.product_format_feature_benefit_id)
+		as virtrdf:ProductFormatFeaturesIsOfProductBenefit ;
+	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_format_features_tbl.product_format_feature_cat_id)
+		as virtrdf:ProductFormatFeaturesIsOfProductFeatureCategory ;
+	opl:isOfProductFormat opl:ProductFormat(product_format_features_tbl.product_format_code)
+		as virtrdf:ProductFormatFeaturesIsOfProductFormat ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy dc: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+    opl:ProductFormat(product_format_with_code.product_format_code)
+      opl:hasFeature
+      opl:ProductFormatFeature(product_format_features_tbl.product_format_feature_id)
+      where (
+	    ^{product_format_with_code.}^.product_format_id = ^{product_format_features_tbl.}^.product_format_id
+	)
+	as virtrdf:OplProductFormatHasProductFormatFeaturesProductFormatFeatures .
+
+    opl:ProductFormatFeature(product_format_features_tbl.product_format_feature_id)
+      opl:isFeatureOf
+      opl:ProductFormat(product_format_with_code.product_format_code)
+      where (
+        ^{product_format_with_code.}^.product_format_id = ^{product_format_features_tbl.}^.product_format_id
+    )
+    as virtrdf:OplProductFormatFeaturesAreProductFormatFeaturesProductFormat .
+
+
+
+	opl:ProductCategoryFeature(product_category_features_tbl.product_category_feature_id)
+	  a opl:ProductCategoryFeature
+	  as virtrdf:OplProductCategoryFeature ;
+	rdfs:label product_category_features_tbl.short_description
+		as virtrdf:rdfsLabelProductCategoryFeaturesShortDescription ;
+	opl:Description product_category_features_tbl.short_description
+		as virtrdf:OplProductCategoryFeaturesShortDescription ;
+	dc:description opl:lit_to_string(product_category_features_tbl.long_description)
+		as virtrdf:OplProductCategoryFeaturesLongDescription ;
+	opl:isOfProductBenefit opl:ProductBenefit(product_category_features_tbl.product_category_feature_benefit_id)
+		as virtrdf:ProductCategoryFeaturesIsOfProductBenefit ;
+	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_category_features_tbl.product_category_feature_category_id)
+		as virtrdf:ProductCategoryFeaturesIsOfProductFeatureCategory ;
+	opl:isOfProductCategory opl:ProductCategory(product_category_features_tbl.product_cat_code)
+		as virtrdf:ProductCategoryFeaturesIsOfProductCategory ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy dc: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+    opl:ProductCategory(product_category_with_code.product_cat_code)
+      opl:hasFeature
+      opl:ProductCategoryFeature(product_category_features_tbl.product_category_feature_id)
+      where (
+	    ^{product_category_with_code.}^.product_cat_id = ^{product_category_features_tbl.}^.product_cat_id
+	)
+	as virtrdf:OplProductCategoryHasProductCategoryFeaturesProductCategoryFeatures .
+
+    opl:ProductCategoryFeature(product_category_features_tbl.product_category_feature_id)
+      opl:isFeatureOf
+      opl:ProductCategory(product_category_with_code.product_cat_code)
+      where (
+        ^{product_category_with_code.}^.product_cat_id = ^{product_category_features_tbl.}^.product_cat_id
+    )
+    as virtrdf:OplProductCategoryFeaturesAreProductCategoryFeaturesProductCategory .
+
+
+	opl:ProductReleaseFeature(product_release_features_tbl.product_release_feature_id)
+	  a opl:ProductReleaseFeature
+	  as virtrdf:OplProductReleaseFeature ;
+	rdfs:label product_release_features_tbl.short_description
+		as virtrdf:rdfsLabelProductReleaseFeaturesShortDescription ;
+	opl:Description product_release_features_tbl.short_description
+		as virtrdf:OplProductReleaseFeaturesShortDescription ;
+	dc:description opl:lit_to_string(product_release_features_tbl.long_description)
+		as virtrdf:OplProductReleaseFeaturesLongDescription ;
+	opl:isOfProductBenefit opl:ProductBenefit(product_release_features_tbl.product_release_feature_benefit_id)
+		as virtrdf:ProductReleaseFeaturesIsOfProductBenefit ;
+	opl:isOfProductFeatureCategory opl:ProductFeatureCategory(product_release_features_tbl.product_release_feature_cat_id)
+		as virtrdf:ProductReleaseFeaturesIsOfProductFeatureCategory ;
+	opl:isOfProduct opl:Product(product_release_features_tbl.product_id)
+		as virtrdf:ProductReleaseFeaturesIsOfProduct ;
+	opl:ProductReleaseId product_release_features_tbl.product_release_id
+		as virtrdf:ProductReleaseFeaturesProductRelease ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy dc: ;
+      rdfs:isDefinedBy rdfs:
+	.
+
+
+	} .
+} .
+;
+
+
+
+
+DB.DBA.RDF_AUDIT_METADATA (1, '*');
+
+
+SPARQL
+prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
+prefix dc: <http://purl.org/dc/terms#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+prefix oplds: <http://www.openlinksw.com/dataspace/organization/openlink#>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+prefix umbel: <http://umbel.org/umbel/sc/>
+prefix gr: <http://purl.org/goodrelations/v1#>
+
+alter quad storage virtrdf:DefaultQuadStorage
+FROM oplweb2.oplweb.component_archive as component_archive_tbl
+FROM oplweb2.oplweb.component_archive_type as component_archive_type_tbl
+FROM oplweb2.oplweb.component_category as component_category_tbl text literal component_category_long_description
+FROM oplweb2.oplweb.component_mode as component_mode_tbl
+FROM oplweb2.oplweb.component_type as component_type_tbl
+FROM oplweb2.oplweb.components_for_rdfs as components_tbl
+FROM oplweb2.oplweb.dbms_engine as dbms_engine_tbl
+FROM oplweb2.oplweb.dbms_family as dbms_family_tbl
+FROM oplweb2.oplweb.download_location as download_location_tbl
+FROM oplweb2.oplweb.download_protocol as download_protocol_tbl
+FROM oplweb2.oplweb.download_partner as download_partner_tbl
+FROM oplweb2.oplweb.opsys as opsys_tbl
+FROM oplweb2.oplweb.opsys_family as opsys_family_tbl
+FROM oplweb2.oplweb.opsys_type as opsys_type_tbl
+FROM oplweb2.oplweb.processor_family as processor_family_tbl
+FROM oplweb2.oplweb.processor_mode as processor_mode_tbl
+FROM oplweb2.oplweb.processors as processors_tbl
+FROM oplweb2.oplweb.product as product_tbl text literal long_description
+FROM oplweb2.oplweb.product_benefits as product_benefits_tbl text literal product_benefit_explanation
+FROM oplweb2.oplweb.product_benefits_category as product_benefits_category_tbl
+FROM oplweb2.oplweb.product_category as product_category_tbl
+FROM oplweb2.oplweb.product_category_features_with_code as product_category_features_tbl text literal long_description
+FROM oplweb2.oplweb.product_family as product_family_tbl
+FROM oplweb2.oplweb.product_family as product_family_tbl_2
+FROM oplweb2.oplweb.product_family_features_with_code as product_family_features_tbl text literal long_description
+FROM oplweb2.oplweb.product_features as product_features_tbl text literal long_description
+FROM oplweb2.oplweb.product_feature_category as product_feature_category_tbl text literal description
+FROM oplweb2.oplweb.product_format_features_with_code as product_format_features_tbl text literal long_description
+FROM oplweb2.oplweb.product_release_features as product_release_features_tbl text literal long_description
+FROM oplweb2.oplweb.product_release_with_family as product_release_tbl
+FROM oplweb2.oplweb.vendor_category as vendor_category_tbl
+FROM oplweb2.oplweb.vendor_category_family as vendor_category_family_tbl
+FROM oplweb2.oplweb.vendors as vendors_tbl
+FROM oplweb2.oplweb.product_formats_categories as product_formats_categories
+FROM oplweb2.oplweb.product_with_code as product_with_code
+FROM oplweb2.oplweb.product_category_with_code as product_category_with_code
+FROM oplweb2.oplweb.product_format as product_format_with_code
+FROM oplweb2.oplweb.product_price as pp
+FROM oplweb2.oplweb.product_price_type as pt
+FROM oplweb2.DBA.license_model_unit_type as put
+FROM oplweb2.DBA.license_model_unit_type as put2
+FROM oplweb2.DBA.license_model as lm
+FROM oplweb2.DBA.license_model as lm2
+FROM oplweb2.DBA.license_model_type as license_model_type_tbl
+FROM oplweb2.DBA.product_price_varchar as ppv
+FROM oplweb2.DBA.product_general_discount_vc as gd
+FROM oplweb2.oplweb.archive_coverage_osdb as ac1
+{
+	create virtrdf:product_portfolio2 as
+		graph <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
+	  option (exclusive)
+	{
+
+  opl:ProcessorFamily(processor_family_tbl.processor_family_id)
+    opl:hasProcessors
+    opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
+    where (
+        ^{processor_family_tbl.}^.processor_family_id = ^{processors_tbl.}^.processor_family_id
+    )
+    as virtrdf:OplProcessorFamilyHasProcessors .
+
+
+  opl:Processor(processors_tbl.processor_name, processors_tbl.processor_mode_id)
+    opl:hasProductFamily
+    opl:ProductFamily(ac1.product_family_code)
+    where (
+        ^{processors_tbl.}^.processor_name = ^{ac1.}^.processor_name
+        and
+        ^{processors_tbl.}^.processor_mode_id = ^{ac1.}^.processor_mode_id
+    )
+    as virtrdf:OplProcessorToProductFamily .
+
+
+
+#
+# Product Licensing and Shop stuff
+# =========================================
+
+
+	  opl:ProductRelease(
+	      product_release_tbl.product_id,
+	      product_release_tbl.product_release_id,
+	      product_release_tbl.opsys_name,
+	      product_release_tbl.dbms_name
+	      )
+      opl:hasLicenseModel
+      opl:LicenseModel(
+        lm.product_release_id,
+        lm.product_id,
+        lm.opsys_family_id,
+        lm.dbms_family_id,
+        lm.product_price_type_id
+	  )
+      where (
+        ^{lm.}^.product_id = ^{product_release_tbl.}^.product_id and
+        ^{lm.}^.product_release_id = ^{product_release_tbl.}^.product_release_id and
+        ^{lm.}^.opsys_family_id = ^{product_release_tbl.}^.opsys_family_id and
+        ^{lm.}^.dbms_family_id = ^{product_release_tbl.}^.dbms_family_id
+    )
+    as virtrdf:OplProductReleaseHasLicenseModel .
+
+	  opl:ProductRelease(
+	      product_release_tbl.product_id,
+	      product_release_tbl.product_release_id,
+	      product_release_tbl.opsys_name,
+	      product_release_tbl.dbms_name
+	      )
+      opl:hasPriceSample
+	  opl:lit_shop_sample (
+	      product_release_tbl.product_release_id,
+	      product_release_tbl.product_id,
+	      product_release_tbl.opsys_name,
+	      product_release_tbl.dbms_name
+      	)
+      as virtrdf:OplPriceSamples .
+
+
+	opl:LicenseModel(
+	    lm.product_release_id,
+        lm.product_id,
+        lm.opsys_family_id,
+        lm.dbms_family_id,
+		lm.product_price_type_id)
+	a opl:LicenseModel
+	as virtrdf:OplLicenseModel;
+	a gr:Sell
+	as virtrdf:OplLicenseModelAgrSell ;
+	a gr:ActualProductOrServiceInstance
+	as virtrdf:OplLicenseModelAgrProductOrServiceInstance ;
+	rdfs:label opl:lit_license_model_type(
+		lm.product_price_type_id
+	) as virtrdf:OplLabelLicenseModel ;
+	rdfs:description opl:lit_license_model_explain (
+		lm.product_price_type_id
+	) as virtrdf:OplLicenseModelExplain ;
+	opl:ProductReleaseId
+	  lm.product_release_id
+	  as virtrdf:lm_shop_price_product_release;
+	opl:isOfFormat
+	  opl:ProductFormat(lm.product_format_code)
+	  as virtrdf:lm_shop_price_product_format;
+	opl:isOfCategory
+	  opl:ProductCategory(lm.product_cat_code)
+	  as virtrdf:lm_shop_price_product_cat;
+	opl:OpsysFamily
+	  opl:OpsysFamily(lm.opsys_family_id)
+	  as virtrdf:lm_shop_price_opsys_family_oplweb;
+	opl:OpsysType
+	  opl:OpsysType(lm.opsys_type_id)
+	  as virtrdf:lm_shop_price_opsys_type;
+	opl:DbmsFamily
+	  opl:DbmsFamily(lm.dbms_family_id)
+	  as virtrdf:lm_shop_price_dbms_family	;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs: ;
+      rdfs:isDefinedBy gr:
+		.
+
+
+	opl:LicenseModel(
+	    lm.product_release_id,
+        lm.product_id,
+        lm.opsys_family_id,
+        lm.dbms_family_id,
+		lm.product_price_type_id)
+	opl:hasPriceUnitType
+	opl:PriceUnitType(
+	    lm2.product_release_id,
+        lm2.product_id,
+        lm2.opsys_family_id,
+        lm2.dbms_family_id,
+		lm2.product_price_type_id,
+		lm2.product_price_unit_type_id)
+      where (
+        ^{lm.}^.product_release_id = ^{lm2.}^.product_release_id AND
+        ^{lm.}^.product_id = ^{lm2.}^.product_id AND
+        ^{lm.}^.opsys_family_id = ^{lm2.}^.opsys_family_id AND
+        ^{lm.}^.opsys_type_id = ^{lm2.}^.opsys_type_id AND
+        ^{lm.}^.product_price_type_id = ^{lm2.}^.product_price_type_id AND
+		^{lm2.}^.product_price_unit_type_id <> 'db_sessions'
+        and
+        (
+          ^{lm.}^.dbms_family_id = ^{lm2.}^.dbms_family_id
+    	  OR
+          ^{lm2.}^.dbms_family_id = 15
+        )
+    )
+    as virtrdf:OplLicenseModelPriceUnitTypes .
+
+
+
+	opl:LicenseModel(
+	    lm.product_release_id,
+        lm.product_id,
+        lm.opsys_family_id,
+        lm.dbms_family_id,
+		lm.product_price_type_id)
+	gr:hasPriceSpecification
+	opl:PriceUnitType(
+	    lm2.product_release_id,
+        lm2.product_id,
+        lm2.opsys_family_id,
+        lm2.dbms_family_id,
+		lm2.product_price_type_id,
+		lm2.product_price_unit_type_id)
+      where (
+        ^{lm.}^.product_release_id = ^{lm2.}^.product_release_id AND
+        ^{lm.}^.product_id = ^{lm2.}^.product_id AND
+        ^{lm.}^.opsys_family_id = ^{lm2.}^.opsys_family_id AND
+        ^{lm.}^.opsys_type_id = ^{lm2.}^.opsys_type_id AND
+        ^{lm.}^.product_price_type_id = ^{lm2.}^.product_price_type_id AND
+		^{lm2.}^.product_price_unit_type_id = 'db_sessions'
+        and
+        (
+          ^{lm.}^.dbms_family_id = ^{lm2.}^.dbms_family_id
+    	  OR
+          ^{lm2.}^.dbms_family_id = 15
+        )
+    )
+    as virtrdf:OplLicenseModelBasePriceUnitTypes .
+
+
+	opl:Discount(
+	    gd.product_release_id,
+	    gd.opsys_type_id,
+	    gd.product_id,
+	    gd.opsys_family_id,
+	    gd.dbms_family_id,
+	    gd.product_price_type_id)
+	a opl:Discount
+	as virtrdf:product_discount;
+	rdfs:label gd.product_discount_description as virtrdf:OplLabelDiscount ;
+	rdfs:description gd.product_discount_description as virtrdf:OplDiscountExplain ;
+	opl:discount_description
+	  gd.product_discount_description
+	  as virtrdf:gd_discount_description;
+	opl:discount_start
+	  gd.discount_start
+	  as virtrdf:gd_discount_start;
+	opl:discount_end
+	  gd.discount_end
+	  as virtrdf:gd_discount_end;
+	opl:ProductPriceType
+	  opl:PriceType(gd.product_price_type_id)
+	  as virtrdf:gd_shop_price_type;
+	gr:hasUnitOfMeasurement
+	  opl:PriceType(gd.product_price_type_id)
+	  as virtrdf:gd_shop_price_type_grUnitOfMeasurement;
+	opl:ProductReleaseId
+	  gd.product_release_id
+	  as virtrdf:gd_shop_price_product_release;
+	opl:ProductFormat
+	  opl:ProductFormat(gd.product_format_code)
+	  as virtrdf:gd_shop_price_product_format;
+	opl:ProductCategory
+	  opl:ProductCategory(gd.product_cat_code)
+	  as virtrdf:gd_shop_price_product_cat;
+	opl:OpsysFamily
+	  opl:OpsysFamily(gd.opsys_family_id)
+	  as virtrdf:gd_shop_price_opsys_family_oplweb;
+	opl:OpsysType
+	  opl:OpsysType(gd.opsys_type_id)
+	  as virtrdf:gd_shop_price_opsys_type;
+	opl:DbmsFamily
+	  opl:DbmsFamily(gd.dbms_family_id)
+	  as virtrdf:gd_shop_price_dbms_family;
+	opl:discount_token
+	  gd.discount_token
+	  as virtrdf:gd_discount_token ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+
+
+
+	opl:PriceType(pt.product_price_type_id)
+	  a opl:PriceType
+	  as virtrdf:shop_product_price_type;
+	rdfs:label pt.product_price_type_description as virtrdf:OplLabelPriceType ;
+	rdfs:description pt.product_price_type_description as virtrdf:OplPriceTypeExplain ;
+	opl:PriceTypeDescription
+	  pt.product_price_type_description
+	  as virtrdf:shop_product_price_type_description;
+	dc:description
+	  pt.product_price_type_long_description
+	  as virtrdf:shop_product_price_type_long_description ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy dc: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+	opl:PriceUnitType(
+		put.product_release_id,
+        put.product_id,
+        put.opsys_family_id,
+        put.dbms_family_id,
+		put.product_price_type_id,
+		put.product_price_unit_type_id)
+	  a opl:PriceUnitType
+	  as virtrdf:shop_product_price_unit_type;
+	rdfs:label put.product_price_unit_description as virtrdf:OplLabelproductpriceunitdescription ;
+	rdfs:description put.product_price_unit_description as virtrdf:OplproductpriceunitdescriptionExplain ;
+	gr:hasUnitOfMeasurement
+	  opl:PriceType(put.product_price_type_id)
+	  as virtrdf:put_shop_price_type_grUnitOfMeasurement;
+	opl:unitValue
+	  put.unit_price
+	  as virtrdf:unit_type_unit_price;
+	gr:hasValue
+	  put.unit_price
+	  as virtrdf:unit_type_unit_price_grHasValue;
+	opl:graceUnits
+	  put.unit_grace
+	  as virtrdf:unit_type_unit_grace;
+	opl:minUnits
+	  put.unit_low
+	  as virtrdf:unit_type_unit_low;
+	opl:maxUnits
+	  put.unit_cap
+	  as virtrdf:unit_type_unit_cap;
+	opl:unit_type_description
+	  put.product_price_unit_description
+	  as virtrdf:unit_type_description ;
+      rdfs:isDefinedBy opl: ;
+      rdfs:isDefinedBy rdfs:
+		.
+
+
+    opl:PriceUnitType(
+		put.product_release_id,
+        put.product_id,
+        put.opsys_family_id,
+        put.dbms_family_id,
+		put.product_price_type_id,
+		put.product_price_unit_type_id
+	  )
+      opl:hasIncrementalDiscount
+      opl:PriceUnitIncrementalDiscount(
+		put2.product_release_id,
+        put2.product_id,
+        put2.opsys_family_id,
+        put2.dbms_family_id,
+		put2.product_price_type_id,
+		put2.product_price_unit_type_id
+	  )
+      where (
+		^{put.}^.product_release_id = ^{put2.}^.product_release_id and
+        ^{put.}^.product_id = ^{put2.}^.product_id and
+        ^{put.}^.opsys_family_id = ^{put2.}^.opsys_family_id and
+        ^{put.}^.dbms_family_id = ^{put2.}^.dbms_family_id and
+		^{put.}^.product_price_type_id = ^{put2.}^.product_price_type_id and
+		^{put.}^.product_price_unit_type_id = ^{put2.}^.product_price_unit_type_id
+    )
+    as virtrdf:OplLicenseModelUnitsIncrementalDiscounts .
+
+
+	opl:PriceUnitIncrementalDiscount(
+		put.product_release_id,
+        put.product_id,
+        put.opsys_family_id,
+        put.dbms_family_id,
+		put.product_price_type_id,
+		put.product_price_unit_type_id)
+	  a opl:PriceUnitIncrementalDiscount
+	  as virtrdf:shop_product_price_unit_type_incremental_discount;
+	rdfs:label put.product_price_unit_description as virtrdf:OplLabelproductpriceunitIncDisdescription ;
+	rdfs:description put.product_price_unit_description as virtrdf:OplproductpriceunitIncDisdescriptionExplain ;
+	opl:percentageOfBase
+	  put.unit_discount
+	  as virtrdf:unit_type_unit_discount;
+	opl:triggerPoint
+	  put.quantity
+	  as virtrdf:unit_type_unit_discount_quantity
+	.
+
+
+      opl:LicenseModel(
+        lm.product_release_id,
+        lm.product_id,
+        lm.opsys_family_id,
+        lm.dbms_family_id,
+        lm.product_price_type_id
+	  )
+      opl:hasGeneralDiscounts
+      opl:Discount(
+	    gd.product_release_id,
+	    gd.opsys_type_id,
+	    gd.product_id,
+	    gd.opsys_family_id,
+	    gd.dbms_family_id,
+	    gd.product_price_type_id
+	  )
+      where (
+        ^{lm.}^.product_release_id = ^{gd.}^.product_release_id AND
+        ^{lm.}^.product_id = ^{gd.}^.product_id AND
+        ^{lm.}^.opsys_family_id = ^{gd.}^.opsys_family_id AND
+        ^{lm.}^.dbms_family_id = ^{gd.}^.dbms_family_id AND
+        ^{lm.}^.opsys_type_id = ^{gd.}^.opsys_type_id AND
+        ^{lm.}^.product_price_type_id = ^{gd.}^.product_price_type_id
+    )
+    as virtrdf:OplLicenseModelGeneralDiscounts .
+
+
+
+	} .
+} .
+;
+
+
+DB.DBA.XML_SET_NS_DECL ('OpenLink', 'http://www.openlinksw.com/schemas/oplweb#', 2);
+DB.DBA.XML_SET_NS_DECL ('OplProductCategory', 'http://data.openlinksw.com/oplweb/product_category/', 2);
+DB.DBA.XML_SET_NS_DECL ('OplProductFamily', 'http://data.openlinksw.com/oplweb/product_family/', 2);
+DB.DBA.XML_SET_NS_DECL ('OplProductFormat', 'http://data.openlinksw.com/oplweb/product_format/', 2);
+DB.DBA.XML_SET_NS_DECL ('OplProduct', 'http://data.openlinksw.com/oplweb/product/', 2);
+DB.DBA.XML_SET_NS_DECL ('OplProductRelease', 'http://data.openlinksw.com/oplweb/product_release/', 2);
+
+
+DB.DBA.RDF_AUDIT_METADATA (1, '*');
+
+
+commit work;
+-- Clear the 'cache' for immediate effects
+SELECT hs_local_iri, exec ('SPARQL clear graph <'||hs_local_iri||'>')
+  FROM sys_http_sponge
+  WHERE hs_local_iri like '%oplweb%';
+
+SELECT id_to_iri(G), exec ('SPARQL clear graph <'||id_to_iri(G)||'>')
+  FROM rdf_quad
+  WHERE id_to_iri(G) like '%oplweb%';
+
+SPARQL CLEAR GRAPH <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>;
+commit work;
+
+
+SPARQL CONSTRUCT { <http://data.openlinksw.com/oplweb/product_family/uda#this> ?p ?o }
+  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
+  WHERE { <http://data.openlinksw.com/oplweb/product_family/uda#this> ?p ?o }
+;
+
+SPARQL SELECT *
+  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
+  WHERE { <http://data.openlinksw.com/oplweb/product_category/odbc#this> ?p ?o }
+  limit 100
+;
+
+SPARQL define get:soft "soft" SELECT *
+  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
+  WHERE { <http://data.openlinksw.com/oplweb/product_category/odbc#this> ?p ?o }
+  limit 100
+;
+
+SPARQL CONSTRUCT { <http://data.openlinksw.com/oplweb/product_category/jdbc#this> ?p ?o }
+  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
+  WHERE { <http://data.openlinksw.com/oplweb/product_category/jdbc#this> ?p ?o }
+  limit 100
+;
+
+SPARQL CONSTRUCT { <http://data.openlinksw.com/oplweb/product_format/mt#this> ?p ?o }
+  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
+  WHERE { <http://data.openlinksw.com/oplweb/product_format/mt#this> ?p ?o }
+  limit 1
+;
+
+
+SPARQL SELECT  ?p ?o
+  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
+  WHERE { <http://data.openlinksw.com/oplweb/product_family/uda#this> ?p ?o }
+  limit 1
+;
+
+SPARQL
+prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
+SELECT  ?s ?o
+  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
+  WHERE { ?s opl:hasProcessors ?o }
+  limit 1
+;
+
+SPARQL
+prefix opl: <http://www.openlinksw.com/schemas/oplweb#>
+SELECT distinct ?o
+  FROM <http://www.openlinksw.com/dataspace/organization/openlink/oplweb/>
+  WHERE { <http://data.openlinksw.com/oplweb/processor/i686_1#this> opl:hasProductFamily ?o }
+  limit 10
+;
+
+-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/price_unit_type/6.1_odbc-sqlserver-st_1_2_1_db_sessions#this"
+-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/price_unit_type/6.1_odbc-sqlserver-st_1_2_1_cpu#this"
+
+--SELECT top 10 * FROM oplweb2.DBA.license_model_unit_type WHERE product_release_id = '6.1' and product_id = 'odbc-sqlserver-st'
+--  and opsys_family_id = 1 and dbms_family_id = 15 and product_price_type_id = 1 and product_price_unit_type_id = 'cpu';
+
+-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/rdfbrowser/index.html?uri=http%3A//data.openlinksw.com/oplweb/component_archive/6.1-odbc-oracle-st-i686-generic-win-32-ora10-odbclt-clnt-only_mv.msi"
+-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_family/uda"
+-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_category/odbc"
+-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/dbms_family/MySQL"
+-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_release/odbc-oracle-mt_6.1_i686-generic-win-32_ora9"
+-- curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/license_model/6.1_odbc-sqlserver-st_1_2_1"
+
+
+
+
+curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/rdfbrowser/index.html?uri=http%3A//data.openlinksw.com/oplweb/component_archive/6.1-odbc-oracle-st-i686-generic-win-32-ora10-odbclt-clnt-only_mv.msi"
+curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_family/uda"
+curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_release/odbc-oracle-mt_6.1_i686-generic-win-32_ora9"
+curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/license_model/6.1_odbc-sqlserver-st_1_2_1"
+
+--
+-- XXX: note , the below would work only if www.openlinksw.com has the GRAPH <http://data.openlinksw.com/oplweb/>
+-- if experimenting on other box, then www.openlinksw.com should be replaced with [URIQA] DefaultHost INI value
+--
+
+
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'oplweb2_rule2',
+    1,
+    '/oplweb(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//data.openlinksw.com/oplweb%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//www.openlinksw.com/dataspace/organization/openlink/oplweb/%%3E+WHERE+{+%%3Chttp%%3A//data.openlinksw.com/oplweb%U%%23this%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'oplweb2_rule1',
+    1,
+    '(/oplweb/[^#]*)',
+    vector('path'),
+    1,
+    '/rdfbrowser/index.html?uri=http%%3A//data.openlinksw.com%U%',
+--    '/DAV/RDF/rdfqry.vsp?uri=http%%3A//data.openlinksw.com%U%%23this',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'oplweb2_rule3',
+    1,
+    '(/[^#]*)/\x24',
+    vector('path'),
+    1,
+    '%s',
+    vector('path'),
+    null,
+    null,
+    0,
+    null
+    );
+
+
+
+create procedure DB.DBA.REDO_OPLWEB2_RDF_DET()
+{
+  declare colid int;
+  colid := DAV_SEARCH_ID('/DAV/RDF/oplweb2/', 'C');
+  if (colid < 0)
+    return;
+  update WS.WS.SYS_DAV_COL set COL_DET=null where COL_ID = colid;
+}
+;
+
+DB.DBA.REDO_OPLWEB2_RDF_DET();
+
+drop procedure DB.DBA.REDO_OPLWEB2_RDF_DET;
+
+DB.DBA."RDFData_MAKE_DET_COL" ('/DAV/RDF/oplweb2/', 'http://data.openlinksw.com/oplweb', NULL);
+VHOST_REMOVE (lpath=>'/oplweb/data/rdf');
+DB.DBA.VHOST_DEFINE (lpath=>'/oplweb/data/rdf', ppath=>'/DAV/RDF/oplweb2/All/', is_dav=>1, vsp_user=>'dba');
+
+-- procedure to convert path to DET resource name
+create procedure DB.DBA.OPLWEB2_DET_REF (in par varchar, in fmt varchar, in val varchar)
+{
+  declare res, iri any;
+  iri := 'http://data.openlinksw.com/oplweb' || val;
+  res := sprintf ('iid (%d).rdf', iri_id_num (iri_to_id (iri)));
+  return sprintf (fmt, res);
+}
+;
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('oplweb2_rdf', 1,
+    '/oplweb/(.*)', vector('path'), 1,
+    '/oplweb/data/rdf/%U', vector('path'),
+    'DB.DBA.OPLWEB2_DET_REF',
+    'application/rdf.xml',
+    2,
+    303);
+
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'oplweb2_rule_list1',
+    1,
+    vector (
+                'oplweb2_rule1',
+                'oplweb2_rule2',
+                'oplweb2_rule3',
+                'oplweb2_rdf'
+          ));
+
+
+VHOST_REMOVE (vhost=>'data.openlinksw.com:80', lpath=>'/oplweb');
+DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lpath=>'/oplweb', ppath=>'/DAV/RDF/oplweb2/',
+  vsp_user=>'dba', is_dav=>1, def_page=>'sfront.vspx', is_brws=>0, opts=>vector ('url_rewrite', 'oplweb2_rule_list1'));
+
+
+/*
+
+DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lhost=>':80', lpath=>'/rdf_net', ppath=>'/rdf_net');
+DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lhost=>':80', lpath=>'/sparql/',
+  ppath => '/!sparql/', is_dav => 1, vsp_user => 'dba', opts => vector('noinherit', 1));
+
+VHOST_REMOVE (vhost=>'data.openlinksw.com', lpath=>'/proxy');
+DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com', lhost=>':80', lpath=>'/proxy',
+  ppath=>'/SOAP/Http/ext_http_proxy', soap_user=>'PROXY');
+
+DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lhost=>':80', lpath=>'/xml_a',
+  ppath=>'/SOAP/',soap_user=>'XML_A');
+DB.DBA.VHOST_DEFINE (vhost=>'data.openlinksw.com:80', lhost=>':80', lpath=>'/XMLA',
+  ppath=>'/SOAP/', soap_user=>'XMLA', soap_opts => vector ('ServiceName', 'XMLAnalysis', 'elementFormDefault', 'qualified'))
+
+GRANT EXECUTE ON DB.DBA.RDF_SPONGE_UP TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON DB.DBA.TTLP_EV_NEW_GRAPH TO "SPARQL", "SPARQL_UPDATE";
+grant SPARQL_UPDATE to "SPARQL";
+
+curl -H "Accept: application/rdf+xml" "http://data.openlinksw.com/oplweb/product_family/uda#this"
+
+SELECT hs_local_iri, exec ('sparql clear graph <'||hs_local_iri||'>') from sys_http_sponge;
+
+*/
+
+
+
+OWL based Ontology
+
+--sparql construct { ?x ?y ?z } from --<http://www.openlinksw.com/dataspace/organization/openlink#this>
+--	where { ?x ?y ?z }
+
+DB.DBA.RDF_LOAD_RDFXML_MT (
+'<?xml version="1.0"?>
+<rdf:RDF
+    xmlns="http://www.openlinksw.com/dataspace/organization/openlink/oplweb#"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+    xmlns:owl="http://www.w3.org/2002/07/owl#"
+    xmlns:foaf="http://xmlns.com/foaf/0.1/"
+    xmlns:virtrdf="http://www.openlinksw.com/schemas/virtrdf#"
+    xml:base="http://www.openlinksw.com/schemas/oplweb#">
+  <owl:Ontology rdf:about="http://www.openlinksw.com/schemas/oplweb#">
+        <rdfs:label>ProductPortfolio</rdfs:label>
+        <rdfs:comment>OpenLink Product Portfolio</rdfs:comment>
+        <virtrdf:catName>oplweb</virtrdf:catName>
+        <virtrdf:version>1.00</virtrdf:version>
+  </owl:Ontology>
+
+	<!-- Family / Category / Format -->
+
+	<rdfs:Class rdf:ID="ProductFamily">
+		<rdfs:label>Product Family</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Family
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProductCategory">
+		<rdfs:label>Product Category</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Category
+		</rdfs:comment>
+    <rdfs:subPropertyOf rdf:resource="#ProductFamily"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProductFormat">
+		<rdfs:label>Product Format</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Format
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProductFormatCategory">
+		<rdfs:label>Product Format Category</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Format Category
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdf:Property rdf:ID="ProductFamilyDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductFamily"/>
+    <rdfs:label>Product Family Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductFamilyLongDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductFamily"/>
+    <rdfs:label>Product Family Long Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductFamilyCode">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductFamily"/>
+    <rdfs:label>Product Family Long Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductFormatDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductFormat"/>
+    <rdfs:label>Product Format Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductFormatLongDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductFormat"/>
+    <rdfs:label>Product Format Long Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductFormatCode">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductFormat"/>
+    <rdfs:domain rdf:resource="#ProductFormatCategory"/>
+    <rdfs:label>Product Format Long Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductCategoryDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductCategory"/>
+    <rdfs:label>Product Category Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductCategoryLongDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductCategory"/>
+    <rdfs:label>Product Category Long Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductCategoryCode">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductCategory"/>
+    <rdfs:domain rdf:resource="#ProductFormatCategory"/>
+    <rdfs:label>Product Category Long Description</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="hasProduct">
+    <rdfs:range rdf:resource="#Product"/>
+    <rdfs:domain rdf:resource="#ProductCategory"/>
+    <rdfs:domain rdf:resource="#ProductFormat"/>
+    <rdfs:domain rdf:resource="#ProductFormatCategory"/>
+    <rdfs:label>Product</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="hasCategory">
+    <rdfs:range rdf:resource="#ProductCategory"/>
+    <rdfs:domain rdf:resource="#ProductFamily"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:label>Product</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="hasFormat">
+    <rdfs:range rdf:resource="#ProductFormat"/>
+    <rdfs:domain rdf:resource="#ProductFamily"/>
+    <rdfs:domain rdf:resource="#ProductFormat"/>
+    <rdfs:label>Product</rdfs:label>
+  </rdf:Property>
+
+
+	<!-- Vendor -->
+
+	<rdfs:Class rdf:ID="VendorCategoryFamily">
+		<rdfs:label>vendor_category_family</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			vendor_category_family
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="VendorCategory">
+		<rdfs:label>vendor_category</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			vendor_category
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="VendorCategoryFamily"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="Vendors">
+		<rdfs:label>vendors</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			vendors
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="VendorCategory"/>
+	</rdfs:Class>
+
+	<rdf:Property rdf:ID="VendorName">
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Vendors"/>
+    <rdfs:label>vendor name</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="VendorCategoryFamilyDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#VendorCategoryFamily"/>
+    <rdfs:label>vendor_category_family_description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="VendorCategoryDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#VendorCategory"/>
+    <rdfs:label>vendor_category_description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="isOfVendorCategory">
+    <rdfs:range rdf:resource="#VendorCategory"/>
+    <rdfs:domain rdf:resource="#Vendors"/>
+    <rdfs:label>vendor_category_description</rdfs:label>
+  </rdf:Property>
+
+	<!-- Opsys / DBMS -->
+
+	<rdfs:Class rdf:ID="OpsysFamily">
+		<rdfs:label>Opsys Family</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Opsys Family
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="DbmsFamily">
+		<rdfs:label>Dbms Family</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Dbms Family
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="DbmsEngine">
+		<rdfs:label>Dbms Engine</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Dbms Engine
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="DbmsFamily"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="OpsysType">
+		<rdfs:label>Opsys Type</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Opsys Type
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProcessorMode">
+		<rdfs:label>Processor Mode</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Processor Mode
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="Processor">
+		<rdfs:label>Processor</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Processor
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="ProcessorFamily"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProcessorFamily">
+		<rdfs:label>Processor Family</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Processor Family
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="Opsys">
+		<rdfs:label>Dbms Engine</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			opsys
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="OpsysFamily"/>
+    <rdfs:subClassOf rdf:resource="OpsysType"/>
+	</rdfs:Class>
+
+	<rdf:Property rdf:ID="OpsysFamilyName">
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#OpsysFamily"/>
+    <rdfs:label>Opsys Family Name</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysFamilyRating">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#OpsysFamily"/>
+    <rdfs:label>Opsys Family Rating</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysFamilyLicenseCode">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#OpsysFamily"/>
+    <rdfs:label>Opsys Family License Code</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysFamilyVendor">
+    <rdfs:range rdf:resource="#Vendors"/>
+    <rdfs:domain rdf:resource="#OpsysFamily"/>
+    <rdfs:label>Opsys Family Vendor</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="DbmsFamilyName">
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DbmsFamily"/>
+    <rdfs:label>DBMS Family Name</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="DbmsFamilyVendor">
+    <rdfs:range rdf:resource="#Vendors"/>
+    <rdfs:domain rdf:resource="#DbmsFamily"/>
+    <rdfs:label>DBMS Family Vendor</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="DbmsName">
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DbmsEngine"/>
+    <rdfs:label>DBMS Name</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="DbmsVersion">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DbmsEngine"/>
+    <rdfs:label>DBMS Version</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="DbmsEngineRating">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DbmsEngine"/>
+    <rdfs:label>DBMS Engine Rating</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="DbmsEngineOldArchiveCode">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DbmsEngine"/>
+    <rdfs:label>DBMS Engine old Archive Code</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="DbmsUpwardCompatible">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DbmsEngine"/>
+    <rdfs:label>DBMS Upward Compatible</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="DbmsDownwardCompatible">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DbmsEngine"/>
+    <rdfs:label>DBMS Downward Compatible</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysTypeDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#OpsysType"/>
+    <rdfs:label>Opsys Type Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysTypeShortDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#OpsysType"/>
+    <rdfs:label>Opsys Type Short Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysName">
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Opsys"/>
+    <rdfs:label>Opsys Name</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysVersion">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Opsys"/>
+    <rdfs:label>Opsys Version</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysUpwardCompatible">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Opsys"/>
+    <rdfs:label>Opsys Compatible</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysDownwardCompatible">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Opsys"/>
+    <rdfs:label>Opsys Downward Compatible</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysLicenseCode">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Opsys"/>
+    <rdfs:label>Opsys License Code</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysCommercialName">
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Opsys"/>
+    <rdfs:label>Opsys Commercial Name</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysProcessor">
+    <rdfs:range rdf:resource="#Processor"/>
+    <rdfs:domain rdf:resource="#Opsys"/>
+    <rdfs:label>Opsys Processor</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="OpsysEmulation">
+    <rdfs:range rdf:resource="#ProcessorMode"/>
+    <rdfs:domain rdf:resource="#Opsys"/>
+    <rdfs:label>Opsys Emulation Mode</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProcessorModeName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProcessorMode"/>
+    <rdfs:label>Processor Mode Name</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProcessorName">
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Processor"/>
+    <rdfs:label>Processor Name</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProcessorProcessorMode">
+    <rdfs:range rdf:resource="#ProcessorMode"/>
+    <rdfs:domain rdf:resource="#Processor"/>
+    <rdfs:label>Processor Mode</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProcessorDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Processor"/>
+    <rdfs:label>Processor Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProcessorFamilyName">
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProcessorFamily"/>
+    <rdfs:label>Processor Family Name</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProcessorFamilyDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProcessorFamily"/>
+    <rdfs:label>Processor Family Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProcessorFamilyVendor">
+    <rdfs:range rdf:resource="#Vendors"/>
+    <rdfs:domain rdf:resource="#ProcessorFamily"/>
+    <rdfs:label>Processor Family Vendor</rdfs:label>
+  </rdf:Property>
+
+
+	<!-- Product / Product Release -->
+
+	<rdfs:Class rdf:ID="Product">
+		<rdfs:label>Product</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product
+		</rdfs:comment>
+    <rdfs:subPropertyOf rdf:resource="#ProductFormat"/>
+    <rdfs:subPropertyOf rdf:resource="#ProductCategory"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProductRelease">
+		<rdfs:label>Product Release</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Release
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="#Product"/>
+	</rdfs:Class>
+
+	<rdf:Property rdf:ID="ProductId">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:label>Product ID</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="isOfCategory">
+    <rdfs:range rdf:resource="#ProductCategory"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:label>Product Category</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="isOfFormat">
+    <rdfs:range rdf:resource="#ProductFormat"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:label>Product Category</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductDescription">
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:label>Product Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductLongDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:label>Product Long Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductReleaseId">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductRelease"/>
+    <rdfs:label>Product Release ID</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductReleaseOpsys">
+    <rdfs:range rdf:resource="#Opsys"/>
+    <rdfs:domain rdf:resource="#ProductRelease"/>
+    <rdfs:label>Product Release Opsys</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductReleaseDbms">
+    <rdfs:range rdf:resource="#DbmsEngine"/>
+    <rdfs:domain rdf:resource="#ProductRelease"/>
+    <rdfs:label>Product Release DBMS</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductReleaseUpwardCompatible">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductRelease"/>
+    <rdfs:label>Product Release upward compatible</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductReleaseDownwardCompatible">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductRelease"/>
+    <rdfs:label>Product Release downward compatible</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ProductReleaseSupported">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductRelease"/>
+    <rdfs:label>Product Release Supported</rdfs:label>
+  </rdf:Property>
+
+	<!-- Components -->
+
+	<rdfs:Class rdf:ID="Component">
+		<rdfs:label>Components</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Components
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ComponentMode">
+		<rdfs:label>Component Mode</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Component
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ComponentType">
+		<rdfs:label>Component</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Component Type
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ComponentCategory">
+		<rdfs:label>Component Category</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Component
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdf:Property rdf:ID="ComponentModeDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentMode"/>
+    <rdfs:label>Component Mode Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ComponentModeShortDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentMode"/>
+    <rdfs:label>Component Mode Short Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ComponentTypeDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentType"/>
+    <rdfs:label>Component Type Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ComponentTypeShortDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentType"/>
+    <rdfs:label>Component Type Short Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ComponentCategoryDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentCategory"/>
+    <rdfs:label>Component Category Description</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ComponentCategoryLongDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentCategory"/>
+    <rdfs:label>Component Category Long Description</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentCategoryShortDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentCategory"/>
+    <rdfs:label>Component Category Short Description</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentName">
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Component"/>
+    <rdfs:label>Components Name</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentCvsid">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Component"/>
+    <rdfs:label>Components CVSID</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentBuildDate">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Component"/>
+    <rdfs:label>Components Build Date</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="Notes">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Component"/>
+    <rdfs:label>Components Notes</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="BuildComments">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Component"/>
+    <rdfs:label>Components Build Comments</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="Filesize">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Component"/>
+    <rdfs:label>Components Name</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ComponentComponentCategory">
+    <rdfs:range rdf:resource="#ComponentCategory"/>
+    <rdfs:domain rdf:resource="#Component"/>
+    <rdfs:label>Components Component Category</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentComponentType">
+    <rdfs:range rdf:resource="#ComponentType"/>
+    <rdfs:domain rdf:resource="#Component"/>
+    <rdfs:label>Components Component Type</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentComponentMode">
+    <rdfs:range rdf:resource="#ComponentMode"/>
+    <rdfs:domain rdf:resource="#Component"/>
+    <rdfs:label>Components Component Mode</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentOpsys">
+    <rdfs:range rdf:resource="#Opsys"/>
+    <rdfs:domain rdf:resource="#Component"/>
+    <rdfs:label>Components Opsys</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentDbmsEngine">
+    <rdfs:range rdf:resource="#DbmsEngine"/>
+    <rdfs:domain rdf:resource="#Component"/>
+    <rdfs:label>Components DBMS</rdfs:label>
+  </rdf:Property>
+
+	<!-- Component Archives -->
+
+	<rdfs:Class rdf:ID="ComponentArchive">
+		<rdfs:label>Component Archive</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Component Archives
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="#ProductRelease"/>
+    <rdfs:subClassOf rdf:resource="#Component"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ComponentArchiveType">
+		<rdfs:label>Component Archive Type</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Component Archives Type
+		</rdfs:comment>
+	</rdfs:Class>
+
+  <rdf:Property rdf:ID="ComponentArchiveTypeName">
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentArchiveType"/>
+    <rdfs:label>Component Archive Type Name</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentArchiveTypeShortName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentArchiveType"/>
+    <rdfs:label>Component Archive Type Name</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentArchiveTypeExtension">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentArchiveType"/>
+    <rdfs:label>Component Archive Type Extension</rdfs:label>
+  </rdf:Property>
+
+	<rdf:Property rdf:ID="ComponentArchiveComponentArchiveType">
+    <rdfs:range rdf:resource="#ComponentArchiveType"/>
+    <rdfs:domain rdf:resource="#ComponentArchive"/>
+    <rdfs:label>Component Archive Component Archive Type</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentArchiveName">
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentArchive"/>
+    <rdfs:label>Component Archive Name</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentArchiveAssemblyDate">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentArchive"/>
+    <rdfs:label>Component Archive Assembly Date</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentArchiveFileUri">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentArchive"/>
+    <rdfs:label>Component Archive File URI</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentArchiveLicenseCode">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentArchive"/>
+    <rdfs:label>Component Archive License Code</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentArchiveResName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentArchive"/>
+    <rdfs:label>Component Archive DAV Resource Name</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentArchiveResFullPath">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentArchive"/>
+    <rdfs:label>Component Archive DAV Full Path</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ComponentArchiveResFileSize">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ComponentArchive"/>
+    <rdfs:label>Component Archive File Size in DAV</rdfs:label>
+  </rdf:Property>
+
+	<!-- Download locations -->
+
+	<rdfs:Class rdf:ID="DownloadLocation">
+		<rdfs:label>Download Location</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Download Location
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="#ComponentArchive"/>
+    <rdfs:subClassOf rdf:resource="#DownloadPartner"/>
+    <rdfs:subClassOf rdf:resource="#DownloadProtocol"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="DownloadProtocol">
+		<rdfs:label>Download Protocol</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Download Protocol
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="DownloadPartner">
+		<rdfs:label>Download Partner</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Download Partner
+		</rdfs:comment>
+	</rdfs:Class>
+
+  <rdf:Property rdf:ID="ProtocolName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DownloadProtocol"/>
+    <rdfs:label>Protocol Name</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ProtocolDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DownloadProtocol"/>
+    <rdfs:label>Protocol Description</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ProtocolActive">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DownloadProtocol"/>
+    <rdfs:label>Protocol Active</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="PartnerName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DownloadPartner"/>
+    <rdfs:label>Download Partner Partner Name</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="HostName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DownloadPartner"/>
+    <rdfs:label>Download Partner Hostname</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="DomainName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DownloadPartner"/>
+    <rdfs:label>Download Partner Domain Name</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="PortNumber">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DownloadPartner"/>
+    <rdfs:label>Download Partner Port Number</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="Uri">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DownloadLocation"/>
+    <rdfs:label>Download Location URI</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="UriOld">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#DownloadLocation"/>
+    <rdfs:label>Download Location URI Old</rdfs:label>
+  </rdf:Property>
+
+	<!-- Features and Benefits -->
+
+	<rdfs:Class rdf:ID="ProductBenefit">
+		<rdfs:label>Product Benefit</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Benefit
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="#ProductBenefitCategory"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProductBenefitCategory">
+		<rdfs:label>Product Benefit</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Benefit
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProductFeatureCategory">
+		<rdfs:label>Product Feature Category</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Feature Category
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProductFeature">
+		<rdfs:label>Product Features</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Features
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
+    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
+    <rdfs:subClassOf rdf:resource="#Product"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProductFamilyFeature">
+		<rdfs:label>Product Family Features</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Family Features
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
+    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
+    <rdfs:subClassOf rdf:resource="#ProductFamily"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProductFormatFeature">
+		<rdfs:label>Product Format Features</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Format Features
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
+    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
+    <rdfs:subClassOf rdf:resource="#ProductFormat"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProductCategoryFeature">
+		<rdfs:label>Product Category Features</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Category Features
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
+    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
+    <rdfs:subClassOf rdf:resource="#ProductCategory"/>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="ProductReleaseFeature">
+		<rdfs:label>Product Benefit</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Product Benefit
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="#ProductFeatureCategory"/>
+    <rdfs:subClassOf rdf:resource="#ProductBenefit"/>
+    <rdfs:subClassOf rdf:resource="#ProductRelease"/>
+	</rdfs:Class>
+
+  <rdf:Property rdf:ID="ProductBenefitsCategoryDescription">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductBenefitsCategory"/>
+    <rdfs:label>product Benefits Category</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="Description">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductBenefit"/>
+    <rdfs:domain rdf:resource="#ProductBenefitCategory"/>
+    <rdfs:domain rdf:resource="#ProductFeatureCategory"/>
+    <rdfs:domain rdf:resource="#ProductFeature"/>
+    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
+    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
+    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
+    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
+    <rdfs:label>Product Benefits Description</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="Details">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductFeature"/>
+    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
+    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
+    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
+    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
+    <rdfs:label>Product Benefits Description Details</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ProductBenefitsAcronym">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductBenefit"/>
+    <rdfs:label>Product Benefits Acronym</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="ProductBenefitsExplanation">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductBenefit"/>
+    <rdfs:label>Product Benefits Explanation</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="DemoUrl">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
+    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
+    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
+    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
+    <rdfs:label>The Features Demo URL</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="HypesPerSecond">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
+    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
+    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
+    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
+    <rdfs:domain rdf:resource="#ProductreleaseFeature"/>
+    <rdfs:label>The Features Number of Hypes per second</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="Implemented">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
+    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
+    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
+    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
+    <rdfs:label>The Features Short Description</rdfs:label>
+  </rdf:Property>
+
+<!-- shop / pricing stuff -->
+
+	<rdfs:Class rdf:ID="LicenseType">
+		<rdfs:label>License Type</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			License Type
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="UnitType">
+		<rdfs:label>Unit Type</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Unit Type
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="GeneralDiscount">
+		<rdfs:label>General Discount</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			General Discount
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="IncrementalDiscount">
+		<rdfs:label>Incremental Discount</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			Incremental Discount
+		</rdfs:comment>
+	</rdfs:Class>
+
+	<rdfs:Class rdf:ID="License">
+		<rdfs:label>License</rdfs:label>
+    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
+			License
+		</rdfs:comment>
+    <rdfs:subClassOf rdf:resource="#LicenseType"/>
+    <rdfs:subClassOf rdf:resource="#ProductRelease"/>
+	</rdfs:Class>
+
+  <rdf:Property rdf:ID="BaseCostUnit">
+    <rdfs:range rdf:resource="#UnitType"/>
+    <rdfs:domain rdf:resource="#License"/>
+    <rdfs:label>Base Unit Cost</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="PriceUnit">
+    <rdfs:range rdf:resource="#UnitType"/>
+    <rdfs:domain rdf:resource="#License"/>
+    <rdfs:label>Price Unit Cost</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="hasDiscount">
+    <rdfs:range rdf:resource="#IncrementalDiscount"/>
+    <rdfs:domain rdf:resource="#UnitType"/>
+    <rdfs:label>Base Unit Cost</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="hasGeneralDiscount">
+    <rdfs:range rdf:resource="#GeneralDiscount"/>
+    <rdfs:domain rdf:resource="#License"/>
+    <rdfs:label>General Discount</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="unitValue">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#UnitType"/>
+    <rdfs:label>Unit Value</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="graceUnit">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#UnitType"/>
+    <rdfs:label>Grace Unit</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="minUnits">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#UnitType"/>
+    <rdfs:label>Minimum Units</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="maxUnits">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#UnitType"/>
+    <rdfs:label>Maximum Units</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="codeWord">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#GeneralDiscount"/>
+    <rdfs:label>Code Word needed to activate this discount</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="startDate">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#GeneralDiscount"/>
+    <rdfs:label>Discount Start Date</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="endDate">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#GeneralDiscount"/>
+    <rdfs:label>Discount End Date</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="percentageOfCost">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#GeneralDiscount"/>
+    <rdfs:label>Percentage of cost attributing as discount</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="triggerPoint">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#IncrementalDiscount"/>
+    <rdfs:label>Discount Trigger Point</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="percentageOfBase">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#IncrementalDiscount"/>
+    <rdfs:label>Percentage of base cost attributing as discount</rdfs:label>
+  </rdf:Property>
+
+<!-- common properties -->
+
+  <rdf:Property rdf:ID="label">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2001/XMLSchema#label"/>
+    <rdfs:domain rdf:resource="#ProductCategory"/>
+    <rdfs:domain rdf:resource="#ProductFormat"/>
+    <rdfs:domain rdf:resource="#ProductFamily"/>
+    <rdfs:domain rdf:resource="#ProductRelease"/>
+    <rdfs:domain rdf:resource="#VendorCategory"/>
+    <rdfs:domain rdf:resource="#Vendor"/>
+    <rdfs:domain rdf:resource="#OpsysFamily"/>
+    <rdfs:domain rdf:resource="#DbmsFamily"/>
+    <rdfs:domain rdf:resource="#DbmsEngine"/>
+    <rdfs:domain rdf:resource="#OpsysType"/>
+    <rdfs:domain rdf:resource="#Processor"/>
+    <rdfs:domain rdf:resource="#ProcessorFamily"/>
+    <rdfs:domain rdf:resource="#Opsys"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:domain rdf:resource="#ComponentMode"/>
+    <rdfs:domain rdf:resource="#ComponentType"/>
+    <rdfs:domain rdf:resource="#ComponentCategory"/>
+    <rdfs:domain rdf:resource="#ComponentArchive"/>
+    <rdfs:domain rdf:resource="#ComponentArchiveType"/>
+    <rdfs:domain rdf:resource="#DownloadLocation"/>
+    <rdfs:domain rdf:resource="#ProductBenefit"/>
+    <rdfs:domain rdf:resource="#ProductBenefitCategory"/>
+    <rdfs:domain rdf:resource="#ProductFeatureCategory"/>
+    <rdfs:domain rdf:resource="#ProductFeature"/>
+    <rdfs:domain rdf:resource="#ProductFamilyFeature"/>
+    <rdfs:domain rdf:resource="#ProductFormatFeature"/>
+    <rdfs:domain rdf:resource="#ProductCategoryFeature"/>
+    <rdfs:domain rdf:resource="#ProductReleaseFeature"/>
+    <rdfs:domain rdf:resource="#LicenseModel"/>
+    <rdfs:domain rdf:resource="#Discount"/>
+    <rdfs:domain rdf:resource="#PriceType"/>
+    <rdfs:domain rdf:resource="#PriceUnitType"/>
+    <rdfs:label>Label</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="name">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:domain rdf:resource="#ProductCategory"/>
+    <rdfs:domain rdf:resource="#ProductFormat"/>
+    <rdfs:domain rdf:resource="#ProductFamily"/>
+    <rdfs:domain rdf:resource="#ProductRelease"/>
+    <rdfs:label>Name</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="logo">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/logo"/>
+    <rdfs:domain rdf:resource="#ProductFamily"/>
+    <rdfs:label>logo</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="homepage">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/homepage"/>
+    <rdfs:domain rdf:resource="#ProductFamily"/>
+    <rdfs:domain rdf:resource="#ProcessorFamily"/>
+    <rdfs:domain rdf:resource="#OpsysFamily"/>
+    <rdfs:domain rdf:resource="#DbmsFamily"/>
+    <rdfs:label>homepage</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="maker">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/maker"/>
+    <rdfs:domain rdf:resource="#ProductCategory"/>
+    <rdfs:domain rdf:resource="#ProductFormat"/>
+    <rdfs:domain rdf:resource="#ProductFamily"/>
+    <rdfs:domain rdf:resource="#ProductRelease"/>
+    <rdfs:label>Maker</rdfs:label>
+  </rdf:Property>
+
+  <rdf:Property rdf:ID="sameAs">
+    <rdfs:range rdf:resource="owl#sameAs"/>
+    <rdfs:domain rdf:resource="#ProductCategory"/>
+    <rdfs:domain rdf:resource="#ProductFormat"/>
+    <rdfs:domain rdf:resource="#ProductFamily"/>
+    <rdfs:domain rdf:resource="#ProductRelease"/>
+    <rdfs:domain rdf:resource="#ProductFormatCategory"/>
+    <rdfs:label>Name</rdfs:label>
+  </rdf:Property>
+
+</rdf:RDF>
+
+',
+'http://www.openlinksw.com/schemas/oplweb#',
+'http://www.openlinksw.com/schemas/oplweb#')
+--'http://www.openlinksw.com/dataspace/organization/openlink/ProductPortfolioOntology/1.0/')
+;
+
+rdfs_rule_set ('oplweb2_owlset', 'http://www.openlinksw.com/schemas/oplweb#', 1);
+
+DB.DBA.XML_SET_NS_DECL ('opl', 'http://www.openlinksw.com/schemas/oplweb#', 2);
+]]></programlisting>
+</sect2>
+  <sect2 id="rdfviewsenterprsyb">
+      <title>Sybase using demonstration 'pubs2' database</title>
+<programlisting><![CDATA[
+-- Setup script for RDF views of Sybase 15 PUBS2 Sample Database --
+
+DB..vd_remote_data_source ('syb15ma-pubs2', '', '<uid>','<pwd>');
+
+ATTACH TABLE  "pubs2.dbo.au_pix"  PRIMARY KEY ("au_id")                  AS "pubs2"."syb"."au_pix"  FROM 'syb15ma-pubs2';
+ATTACH TABLE  "pubs2.dbo.authors"  PRIMARY KEY ("au_id")                  AS "pubs2"."syb"."authors"  FROM 'syb15ma-pubs2';
+ATTACH TABLE  "pubs2.dbo.discounts"  PRIMARY KEY ("stor_id")                  AS "pubs2"."syb"."discounts"  FROM 'syb15ma-pubs2';
+ATTACH TABLE  "pubs2.dbo.publishers"  PRIMARY KEY ("pub_id")                  AS "pubs2"."syb"."publishers"  FROM 'syb15ma-pubs2';
+ATTACH TABLE  "pubs2.dbo.roysched"  PRIMARY KEY ("title_id")                  AS "pubs2"."syb"."roysched"  FROM 'syb15ma-pubs2';
+ATTACH TABLE  "pubs2.dbo.sales"  PRIMARY KEY ("stor_id", "ord_num")                  AS "pubs2"."syb"."sales"  FROM 'syb15ma-pubs2';
+ATTACH TABLE  "pubs2.dbo.salesdetail"  PRIMARY KEY ("stor_id", "ord_num", "title_id")                   AS "pubs2"."syb"."salesdetail"  FROM 'syb15ma-pubs2';
+ATTACH TABLE  "pubs2.dbo.stores"  PRIMARY KEY ("stor_id")                  AS "pubs2"."syb"."stores"  FROM 'syb15ma-pubs2';
+ATTACH TABLE  "pubs2.dbo.titleauthor"  PRIMARY KEY ("au_id", "title_id")                  AS "pubs2"."syb"."titleauthor"  FROM 'syb15ma-pubs2';
+ATTACH TABLE  "pubs2.dbo.titles"  PRIMARY KEY ("title_id", "pub_id")                  AS "pubs2"."syb"."titles"  FROM 'syb15ma-pubs2';
+
+COMMIT WORK;
+
+GRANT SELECT ON pubs2.syb.au_pix TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON pubs2.syb.authors TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON pubs2.syb.discounts TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON pubs2.syb.publishers TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON pubs2.syb.roysched TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON pubs2.syb.sales TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON pubs2.syb.salesdetail TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON pubs2.syb.stores TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON pubs2.syb.titleauthor TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON pubs2.syb.titles TO "SPARQL", "SPARQL_UPDATE";
+
+-------------------------------------------------------------------
+
+-------- Create rdfs:Class definitions ----------------------------
+
+ttlp (
+'
+ at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+ at prefix syb: <http://localhost:8890/schemas/sybasepubs2/> .
+
+syb:titles a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
+	rdfs:label "titles" ;
+	rdfs:comment "Sybase Pubs2 titles table" .
+
+syb:title_id a rdf:Property ;
+	rdfs:domain syb:titles ;
+	rdfs:range xsd:string ;
+	rdfs:label "title id" .
+
+syb:title a rdf:Property ;
+	rdfs:domain syb:titles ;
+	rdfs:range xsd:string ;
+	rdfs:label "title" .
+
+syb:type a rdf:Property ;
+	rdfs:domain syb:titles ;
+	rdfs:range xsd:string ;
+	rdfs:label "type" .
+
+syb:pub_id a rdf:Property ;
+	rdfs:domain syb:titles ;
+	rdfs:range syb:publishers ;
+	rdfs:label "pub_id" .
+
+syb:advance a rdf:Property ;
+	rdfs:domain syb:titles ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "advance" .
+
+syb:price a rdf:Property ;
+	rdfs:domain syb:titles ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "price" .
+
+syb:total_sales a rdf:Property ;
+	rdfs:domain syb:titles ;
+	rdfs:range xsd:integer ;
+	rdfs:label "total_sales" .
+
+syb:notes a rdf:Property ;
+	rdfs:domain syb:titles ;
+	rdfs:range xsd:string ;
+	rdfs:label "notes" .
+
+syb:contract a rdf:Property ;
+	rdfs:domain syb:titles ;
+	rdfs:range xsd:integer ;
+	rdfs:label "contract" .
+
+syb:pubdate a rdf:Property ;
+	rdfs:domain syb:titles ;
+	rdfs:range xsd:dateTime ;
+	rdfs:label "publish date" .
+
+syb:authors a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
+	rdfs:label "authors" ;
+	rdfs:comment "Sybase Pubs2 authors table" .
+
+syb:au_id a rdf:Property ;
+	rdfs:domain syb:authors ;
+	rdfs:range xsd:string ;
+	rdfs:label "author id" .
+
+syb:au_lname a rdf:Property ;
+	rdfs:domain syb:authors ;
+	rdfs:range xsd:string ;
+	rdfs:label "author last name" .
+
+syb:au_fname a rdf:Property ;
+	rdfs:domain syb:authors ;
+	rdfs:range xsd:string ;
+	rdfs:label "author first name" .
+
+syb:phone a rdf:Property ;
+	rdfs:domain syb:authors ;
+	rdfs:range xsd:string ;
+	rdfs:label "phone number" .
+
+syb:address a rdf:Property ;
+	rdfs:domain syb:authors ;
+	rdfs:range xsd:string ;
+	rdfs:label "address" .
+
+syb:city a rdf:Property ;
+	rdfs:domain syb:authors ;
+	rdfs:range xsd:string ;
+	rdfs:label "city" .
+
+syb:state a rdf:Property ;
+	rdfs:domain syb:authors ;
+	rdfs:range xsd:string ;
+	rdfs:label "state" .
+
+syb:country a rdf:Property ;
+	rdfs:domain syb:authors ;
+	rdfs:range xsd:string ;
+	rdfs:label "country" .
+
+syb:postalcode a rdf:Property ;
+	rdfs:domain syb:authors ;
+	rdfs:range xsd:string ;
+	rdfs:label "postalcode" .
+
+syb:stores a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
+	rdfs:label "stores" ;
+	rdfs:comment "Sybase Pubs2 stores table" .
+
+syb:stor_id a rdf:Property ;
+	rdfs:domain syb:stores ;
+	rdfs:range xsd:string ;
+	rdfs:label "store id" .
+
+syb:stor_name a rdf:Property ;
+	rdfs:domain syb:stores ;
+	rdfs:range xsd:string ;
+	rdfs:label "store name" .
+
+syb:stor_address a rdf:Property ;
+	rdfs:domain syb:stores ;
+	rdfs:range xsd:string ;
+	rdfs:label "store address" .
+
+syb:city a rdf:Property ;
+	rdfs:domain syb:stores ;
+	rdfs:range xsd:string ;
+	rdfs:label "city" .
+
+syb:state a rdf:Property ;
+	rdfs:domain syb:stores ;
+	rdfs:range xsd:string ;
+	rdfs:label "state" .
+
+syb:country a rdf:Property ;
+	rdfs:domain syb:stores ;
+	rdfs:range xsd:string ;
+	rdfs:label "country" .
+
+syb:postalcode a rdf:Property ;
+	rdfs:domain syb:stores ;
+	rdfs:range xsd:string ;
+	rdfs:label "postal code" .
+
+syb:payterms a rdf:Property ;
+	rdfs:domain syb:stores ;
+	rdfs:range xsd:string ;
+	rdfs:label "payment terms" .
+
+syb:au_pix a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
+	rdfs:label "authors pictures" ;
+	rdfs:comment "Sybase Pubs2 au_pix table" .
+
+syb:au_id a rdf:Property ;
+	rdfs:domain syb:au_pix ;
+	rdfs:range syb:authors ;
+	rdfs:label "author id" .
+
+syb:format_type a rdf:Property ;
+	rdfs:domain syb:au_pix ;
+	rdfs:range xsd:string ;
+	rdfs:label "format type" .
+
+syb:bytesize a rdf:Property ;
+	rdfs:domain syb:au_pix ;
+	rdfs:range xsd:integer ;
+	rdfs:label "byte size" .
+
+syb:pixwidth_hor a rdf:Property ;
+	rdfs:domain syb:au_pix ;
+	rdfs:range xsd:string ;
+	rdfs:label "picture horizontal width" .
+
+syb:pixwidth_vert a rdf:Property ;
+	rdfs:domain syb:au_pix ;
+	rdfs:range xsd:string ;
+	rdfs:label "picture vertical width" .
+
+syb:discounts a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
+	rdfs:label "discounts" ;
+	rdfs:comment "Sybase Pubs2 discount table" .
+
+syb:discounttype a rdf:Property ;
+	rdfs:domain syb:discounts ;
+	rdfs:range xsd:string ;
+	rdfs:label "discounttype" .
+
+syb:stor_id a rdf:Property ;
+	rdfs:domain syb:discounts ;
+	rdfs:range syb:stores ;
+	rdfs:label "store id" .
+
+syb:lowqty a rdf:Property ;
+	rdfs:domain syb:discounts ;
+	rdfs:range xsd:integer ;
+	rdfs:label "min quantity" .
+
+syb:highqty a rdf:Property ;
+	rdfs:domain syb:discounts ;
+	rdfs:range xsd:integer ;
+	rdfs:label "max quantity" .
+
+syb:discount a rdf:Property ;
+	rdfs:domain syb:discounts ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "min quantity" .
+
+syb:salesdetail a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
+	rdfs:label "sales details" ;
+	rdfs:comment "Sybase Pubs2 sales detail table" .
+
+syb:store_id a rdf:Property ;
+	rdfs:domain syb:salesdetail ;
+	rdfs:range syb:stores ;
+	rdfs:label "store id" .
+
+syb:ord_num a rdf:Property ;
+	rdfs:domain syb:salesdetail ;
+	rdfs:range syb:sales ;
+	rdfs:label "order number" .
+
+syb:title_id a rdf:Property ;
+	rdfs:domain syb:salesdetail ;
+	rdfs:range syb:titles ;
+	rdfs:label "title id" .
+
+syb:qty a rdf:Property ;
+	rdfs:domain syb:salesdetail ;
+	rdfs:range xsd:integer ;
+	rdfs:label "quantity" .
+
+syb:discount a rdf:Property ;
+	rdfs:domain syb:salesdetail ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "discount" .
+
+syb:publishers a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
+	rdfs:label "Publishers" ;
+	rdfs:comment "Sybase Pubs2 publishers table" .
+
+syb:pub_id a rdf:Property ;
+	rdfs:domain syb:publishers ;
+	rdfs:range xsd:string ;
+	rdfs:label "publisher id" .
+
+syb:pub_name a rdf:Property ;
+	rdfs:domain syb:publishers ;
+	rdfs:range xsd:string ;
+	rdfs:label "publisher name" .
+
+syb:city a rdf:Property ;
+	rdfs:domain syb:publishers ;
+	rdfs:range xsd:string ;
+	rdfs:label "city" .
+
+syb:state a rdf:Property ;
+	rdfs:domain syb:publishers ;
+	rdfs:range xsd:string ;
+	rdfs:label "state" .
+
+syb:titleauthor a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
+	rdfs:label "title author" ;
+	rdfs:comment "Sybase Pubs2 titleauthor table" .
+
+syb:au_id a rdf:Property ;
+	rdfs:domain syb:titleauthor ;
+	rdfs:range syb:authors ;
+	rdfs:label "author id" .
+
+syb:title_id a rdf:Property ;
+	rdfs:domain syb:titleauthor ;
+	rdfs:range syb:titles ;
+	rdfs:label "title id" .
+
+syb:au_ord a rdf:Property ;
+	rdfs:domain syb:titleauthor ;
+	rdfs:range xsd:integer ;
+	rdfs:label "author order" .
+
+syb:royaltyper a rdf:Property ;
+	rdfs:domain syb:titleauthor ;
+	rdfs:range xsd:integer ;
+	rdfs:label "royalty per book" .
+
+syb:roysched a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
+	rdfs:label "Royalty Schedule" ;
+	rdfs:comment "Sybase Pubs2 roysched table" .
+
+syb:title_id a rdf:Property ;
+	rdfs:domain syb:roysched ;
+	rdfs:range syb:titles ;
+	rdfs:label "title id" .
+
+syb:lorange a rdf:Property ;
+	rdfs:domain syb:roysched ;
+	rdfs:range xsd:integer ;
+	rdfs:label "low range" .
+
+syb:hirange a rdf:Property ;
+	rdfs:domain syb:roysched ;
+	rdfs:range xsd:integer ;
+	rdfs:label "high range" .
+
+syb:royalty a rdf:Property ;
+	rdfs:domain syb:roysched ;
+	rdfs:range xsd:integer ;
+	rdfs:label "royalty" .
+
+syb:sales a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/sybasepubs2> ;
+	rdfs:label "Sales" ;
+	rdfs:comment "Sybase Pubs2 sales table" .
+
+syb:stor_id a rdf:Property ;
+	rdfs:domain syb:sales ;
+	rdfs:range xsd:string ;
+	rdfs:label "store id" .
+
+syb:ord_num a rdf:Property ;
+	rdfs:domain syb:sales ;
+	rdfs:range xsd:string ;
+	rdfs:label "order number" .
+
+syb:date a rdf:Property ;
+	rdfs:domain syb:sales ;
+	rdfs:range xsd:dateTime ;
+	rdfs:label "date" .
+', '', 'http://localhost:8890/schemas/sybasepubs2', 0);
+
+---------------------------------------------------------------
+
+----------- Create IRI Classes -------------
+
+SPARQL
+
+	create iri class <http://localhost:8890/schemas/sybasepubs2/titles_iri>
+	"http://^{URIQADefaultHost}^/sybasepubs2/titles/%s_%s#this"
+    	(in title_id varchar not null, in title varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/sybasepubs2/authors_iri>
+	"http://^{URIQADefaultHost}^/sybasepubs2/authors/%s#this"
+    	(in au_id varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/sybasepubs2/stores_iri>
+	"http://^{URIQADefaultHost}^/sybasepubs2/stores/%s#this"
+    	(in stor_id varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/sybasepubs2/au_pix_iri>
+	"http://^{URIQADefaultHost}^/sybasepubs2/au_pix/%s#this"
+    	(in au_id varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/sybasepubs2/discounts_iri>
+	"http://^{URIQADefaultHost}^/sybasepubs2/discounts/%s#this"
+    	(in discounttype varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/sybasepubs2/salesdetail_iri>
+	"http://^{URIQADefaultHost}^/sybasepubs2/salesdetail/%s_%s_%s#this"
+    	(in stor_id varchar not null, in ord_num varchar not null, in title_id varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/sybasepubs2/publishers_iri>
+	"http://^{URIQADefaultHost}^/sybasepubs2/publishers/%s#this"
+    	(in pub_id varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/sybasepubs2/titleauthor_iri>
+	"http://^{URIQADefaultHost}^/sybasepubs2/titleauthor/%s_%s#this"
+    	(in au_id varchar not null, in title_id varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/sybasepubs2/roysched_iri>
+	"http://^{URIQADefaultHost}^/sybasepubs2/roysched/%s#this"
+    	(in title_id varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/sybasepubs2/sales_iri>
+	"http://^{URIQADefaultHost}^/sybasepubs2/sales/%s_%s#this"
+    	(in stor_id varchar not null, in ord_num varchar not null) .
+
+;
+
+--------------------------------------------------------------------
+
+------------- Create Quad Store ------------------------------------
+
+SPARQL
+
+prefix syb: <http://localhost:8890/schemas/sybasepubs2/>
+
+alter quad storage virtrdf:DefaultQuadStorage
+  from pubs2.syb.au_pix as au_pix_tbl
+  from pubs2.syb.authors as authors_tbl
+  from pubs2.syb.discounts as discounts_tbl
+  from pubs2.syb.publishers as publishers_tbl
+  from pubs2.syb.roysched as roysched_tbl
+  from pubs2.syb.sales as sales_tbl
+  from pubs2.syb.salesdetail as salesdetail_tbl
+  from pubs2.syb.stores as stores_tbl
+  from pubs2.syb.titleauthor as titleauthor_tbl
+  from pubs2.syb.titles as titles_tbl
+{
+  create virtrdf:sybasepubs2 as
+      graph <http://localhost:8890/sybasepubs2>
+  {
+	syb:au_pix_iri (au_pix_tbl.au_id) a syb:au_pix as virtrdf:au_pix_id;
+	syb:au_id au_pix_tbl.au_id as virtrdf:au_pix_au_id;
+	syb:format_type au_pix_tbl.format_type as virtrdf:au_pix_format_type;
+	syb:bytesize au_pix_tbl.bytesize as virtrdf:au_pix_bytesize;
+	syb:pixwidth_hor au_pix_tbl.pixwidth_hor as virtrdf:au_pix_pixwidth_hor;
+	syb:pixwidth_vert au_pix_tbl.pixwidth_vert as virtrdf:au_pix_pixwidth_vert ;
+       	syb:has_author syb:authors_iri(authors_tbl.au_id) where (^{authors_tbl.}^.au_id = ^{au_pix_tbl.}^.au_id) as virtrdf:au_pix_has_author .
+
+        syb:authors_iri (authors_tbl.au_id) a syb:authors as virtrdf:authors_pk ;
+	syb:au_id authors_tbl.au_id as virtrdf:authors_au_id;
+       	syb:au_lname authors_tbl.au_lname as virtrdf:authors_au_lname;
+       	syb:au_fname authors_tbl.au_fname as virtrdf:authors_au_fname;
+       	syb:phone authors_tbl.phone  as virtrdf:authors_phone;
+       	syb:address authors_tbl.address  as virtrdf:authors_address;
+       	syb:city authors_tbl.city as virtrdf:authors_city;
+       	syb:state authors_tbl.state  as virtrdf:authors_state;
+       	syb:country authors_tbl.country as virtrdf:authors_country;
+       	syb:postalcode authors_tbl.postalcode as virtrdf:authors_postalcode;
+      	syb:has_title syb:titleauthor_iri(titleauthor_tbl.au_id, titleauthor_tbl.title_id) where (^{titleauthor_tbl.}^.au_id = ^{authors_tbl.}^.au_id) as virtrdf:authors_has_title;
+      	syb:has_pix syb:au_pix_iri(au_pix_tbl.au_id) where (^{au_pix_tbl.}^.au_id = ^{authors_tbl.}^.au_id) as virtrdf:authors_has_pix .
+
+	syb:discounts_iri (discounts_tbl.stor_id) a syb:discounts as virtrdf:discounts_pk;
+	syb:discounttype discounts_tbl.discounttype as virtrdf:discounts_discounttype;
+	syb:stor_id syb:stores_iri(stores_tbl.stor_id) where (^{stores_tbl.}^.stor_id = ^{stores_tbl.}^.stor_id) as virtrdf:discounts_stor_id;
+	syb:lowqty discounts_tbl.lowqty as virtrdf:discounts_lowqty;
+	syb:highqty discounts_tbl.highqty as virtrdf:discounts_highqty;
+	syb:discount discounts_tbl.discount as virtrdf:discounts_discount .
+
+	syb:publishers_iri (publishers_tbl.pub_id) a syb:publishers as virtrdf:publishers_pk;
+	syb:pub_id syb:titles_iri(titles_tbl.title_id, titles_tbl.pub_id) where (^{titles_tbl.}^.pub_id = ^{titles_tbl.}^.pub_id) as virtrdf:publisherss_pub_id;
+	syb:pub_name publishers_tbl.pub_name as virtrdf:publisherss_pub_name;
+	syb:city publishers_tbl.city as virtrdf:publisherss_city;
+	syb:state publishers_tbl.state as virtrdf:publisherss_state .
+
+	syb:roysched_iri (roysched_tbl.title_id) a syb:roysched as virtrdf:roysched_pk;
+       	syb:title_id syb:titleauthor_iri(titleauthor_tbl.au_id, titleauthor_tbl.title_id) where (^{titleauthor_tbl.}^.title_id = ^{roysched_tbl.}^.title_id) as virtrdf:roysched_title_id;
+	syb:lorange roysched_tbl.lorange as virtrdf:roysched_lorange;
+	syb:hirange roysched_tbl.hirange as virtrdf:roysched_hirange;
+	syb:royalty roysched_tbl.royalty as virtrdf:roysched_royalty .
+
+	syb:sales_iri (sales_tbl.stor_id, sales_tbl.ord_num) a syb:sales as virtrdf:sales_pk;
+	syb:stor_id sales_tbl.stor_id as virtrdf:sales_stor_id;
+	syb:ord_num sales_tbl.ord_num as virtrdf:sales_ord_num;
+	syb:date sales_tbl.date as virtrdf:sales_date;
+       	syb:has_salesdetail syb:salesdetail_iri(salesdetail_tbl.stor_id, salesdetail_tbl.ord_num, salesdetail_tbl.title_id) where (^{salesdetail_tbl.}^.stor_id = ^{sales_tbl.}^.stor_id and ^{salesdetail_tbl.}^.ord_num = ^{sales_tbl.}^.ord_num)  as virtrdf:sales_has_salesdetail;
+       	syb:has_stores syb:stores_iri(stores_tbl.stor_id) where (^{stores_tbl.}^.stor_id = ^{sales_tbl.}^.stor_id)  as virtrdf:sales_has_stores .
+
+	syb:salesdetail_iri (salesdetail_tbl.stor_id, salesdetail_tbl.ord_num, salesdetail_tbl.title_id) a syb:salesdetail as virtrdf:salesdetail_pk;
+	syb:stor_id salesdetail_tbl.stor_id as virtrdf:salesdetail_stor_id;
+	syb:ord_num salesdetail_tbl.ord_num as virtrdf:salesdetail_ord_num;
+	syb:title_id salesdetail_tbl.title_id as virtrdf:salesdetail_title_id;
+	syb:qty salesdetail_tbl.qty as virtrdf:salesdeail_qty;
+	syb:discount salesdetail_tbl.discount as virtrdf:salesdetail_discount;
+	syb:has_title  syb:titles_iri (titles_tbl.title_id, titles_tbl.pub_id) where (^{titles_tbl.}^.title_id = ^{salesdetail_tbl.}^.title_id) as virtrdf:salesdetail_has_title;
+       	syb:has_sales syb:sales_iri(sales_tbl.stor_id, sales_tbl.ord_num) where (^{salesdetail_tbl.}^.stor_id = ^{sales_tbl.}^.stor_id and ^{salesdetail_tbl.}^.ord_num = ^{sales_tbl.}^.ord_num ) as virtrdf:salesdetail_has_sales .
+
+	syb:stores_iri (stores_tbl.stor_id) a syb:stores as virtrdf:stores_pk;
+       	syb:stor_id stores_tbl.stor_id as virtrdf:stores_stor_id;
+	syb:stor_name stores_tbl.stor_name as virtrdf:stores_stor_name;
+	syb:stor_address stores_tbl.stor_address as virtrdf:stores_stor_address;
+	syb:city stores_tbl.city as virtrdf:stores_city;
+	syb:state stores_tbl.state as virtrdf:stores_state;
+	syb:country stores_tbl.country as virtrdf:stores_country;
+	syb:postalcode stores_tbl.postalcode as virtrdf:stores_postalcode;
+	syb:payterms stores_tbl.payterms as virtrdf:stores_payterms;
+       	syb:has_sales syb:sales_iri(sales_tbl.stor_id, sales_tbl.ord_num) where (^{sales_tbl.}^.stor_id = ^{stores_tbl.}^.stor_id) as virtrdf:stores_has_sales .
+
+	syb:titleauthor_iri (titleauthor_tbl.au_id, titleauthor_tbl.title_id) a syb:titleauthor as virtrdf:titleauthor_pk;
+	syb:au_id titleauthor_tbl.au_id as virtrdf:titleauthor_au_id;
+	syb:title_id titleauthor_tbl.title_id as virtrdf:titleauthor_title_id;
+	syb:au_ord titleauthor_tbl.au_ord as virtrdf:titleauthor_au_ord;
+	syb:royaltyper titleauthor_tbl.royaltyper as virtrdf:titleauthor_royaltyper;
+	syb:has_author syb:authors_iri(authors_tbl.au_id) where (^{authors_tbl.}^.au_id = ^{titleauthor_tbl.}^.au_id) as virtrdf:titleauthor_has_author;
+	syb:has_titles syb:titles_iri(titles_tbl.title_id, titles_tbl.pub_id) where (^{titles_tbl.}^.title_id = ^{titleauthor_tbl.}^.title_id) as virtrdf:titleauthor_has_titles .
+
+	syb:titles_iri (titles_tbl.title_id, titles_tbl.pub_id) a syb:titles as virtrdf:titles_pk;
+	syb:title_id titles_tbl.title_id as virtrdf:titles_title_idd;
+	syb:title titles_tbl.title as virtrdf:titles_title;
+	syb:type titles_tbl.type as virtrdf:titles_type;
+	syb:pub_id titles_tbl.pub_id as virtrdf:titles_pub_id;
+	syb:price titles_tbl.price as virtrdf:titles_price;
+	syb:advance titles_tbl.advance as virtrdf:titles_advance;
+	syb:total_sales titles_tbl.total_sales as virtrdf:titles_total_sales;
+	syb:notes titles_tbl.notes as virtrdf:titles_notes;
+	syb:pubdate titles_tbl.pubdate as virtrdf:titles_pubdate;
+	syb:contract titles_tbl.contract as virtrdf:titles_contract;
+       	syb:has_titleauthor syb:titleauthor_iri(titleauthor_tbl.au_id, titleauthor_tbl.title_id) where (^{titleauthor_tbl.}^.title_id = ^{titles_tbl.}^.title_id) as virtrdf:titles_has_titleauthor;
+       	syb:has_salesdetail syb:salesdetail_iri (salesdetail_tbl.stor_id, salesdetail_tbl.ord_num, salesdetail_tbl.title_id) where (^{salesdetail_tbl.}^.title_id = ^{titles_tbl.}^.title_id) as virtrdf:titles_has_salesdetail .
+
+  } .
+} .
+;
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'sybasepubs2_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'sybasepubs2_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'sybasepubs2_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'sybasepubs2_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/sybasepubs2%%3E&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'sybasepubs2_rule_list1',
+    1,
+    vector (
+  	 	'sybasepubs2_rule1',
+  	 	'sybasepubs2_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/sybasepubs2');
+
+VHOST_DEFINE (
+	lpath=>'/sybasepubs2',
+	ppath=>'/DAV/sybasepubs2/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'sybasepubs2_rule_list1')
+	);
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'sybase_schemas_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'sybase_schemas_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'sybase_schemas_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'sybase_schemas_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/sybasepubs2%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path','path','*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'sybase_schemas_rule_list1',
+    1,
+    vector (
+  	 	'sybase_schemas_rule1',
+  	 	'sybase_schemas_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/schema/sybasepubs2');
+
+VHOST_DEFINE (
+	lpath=>'/schemas/sybasepubs2',
+	ppath=>'/DAV/schemas/sybasepubs2/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'sybase_schemas_rule_list1')
+	);
+
+DB.DBA.XML_SET_NS_DECL ('hr', 'http://^{URIQADefaultHost}^/schemas/sybasepubs2', 2);
+]]></programlisting>
+  </sect2>
+  <sect2 id="rdfviewsenterprtn">
+      <title>Virtuoso's Northwind based Demo Database (Tutorials variant) to RDF </title>
+<programlisting><![CDATA[
+use DB;
+
+DB.DBA.exec_no_error('UPDATE WS.WS.SYS_DAV_RES set RES_TYPE=\'image/jpeg\' where RES_FULL_PATH like \'/DAV/VAD/demo/sql/CAT%\'')
+;
+
+DB.DBA.exec_no_error('UPDATE WS.WS.SYS_DAV_RES set RES_TYPE=\'image/jpeg\' where RES_FULL_PATH like \'/DAV/VAD/demo/sql/EMP%\'')
+;
+
+GRANT SELECT ON "Demo"."demo"."Products" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Suppliers" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Shippers" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Categories" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Customers" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Employees" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Orders" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Order_Details" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Countries" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Provinces" TO "SPARQL";
+
+SPARQL
+prefix tut_northwind: <http://demo.openlinksw.com/schemas/tutorial/northwind#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+drop quad map graph iri("http://^{URIQADefaultHost}^/tutorial/Northwind") .
+;
+
+SPARQL
+prefix tut_northwind: <http://demo.openlinksw.com/schemas/tutorial/northwind#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+drop quad map virtrdf:TutorialNorthwindDemo .
+;
+
+create function DB.DBA.TUT_NORTHWIND_ID_TO_IRI(in _prefix varchar,in _id varchar)
+{
+  declare iri, uriqa_host any;
+  uriqa_host := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+  iri := 'http://' || uriqa_host || '/tutorial/Northwind/' || _prefix || '/' || _id || '#this';
+  return sprintf ('http://%s/DAV/VAD/tutorial/rdfview/rd_v_1/RDFData/All/iid%%20(%d).rdf', uriqa_host, iri_id_num (iri_to_id (iri)));
+}
+;
+
+create function DB.DBA.TUT_NORTHWIND_IRI_TO_ID(in _iri varchar)
+{
+    declare parts any;
+    parts := sprintf_inverse (_iri, 'http://%s/DAV/VAD/tutorial/rdfview/rd_v_1/RDFData/All/iid (%d).rdf', 1 );
+    if (parts is not null)
+    {
+        declare uriqa_host, iri any;
+        uriqa_host := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+        if (parts[0] = uriqa_host)
+        {
+            iri := id_to_iri(iri_id_from_num(parts[1]));
+            parts := sprintf_inverse (iri, 'http://%s/tutorial/Northwind/%s/%s#this', 1 );
+            if (parts[0] = uriqa_host)
+            {
+                return parts[2];
+            }
+        }
+    }
+    return NULL;
+}
+;
+
+create function DB.DBA.TUT_CATEGORY_IRI (in _id integer) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('Category', cast(_id as varchar));
+}
+;
+
+create function DB.DBA.TUT_CATEGORY_IRI_INVERSE (in _iri varchar) returns integer
+{
+    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
+};
+
+create function DB.DBA.TUT_SHIPPER_IRI (in _id integer) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('Shipper', cast(_id as varchar));
+}
+;
+
+create function DB.DBA.TUT_SHIPPER_IRI_INVERSE (in _iri varchar) returns integer
+{
+    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
+};
+
+create function DB.DBA.TUT_SUPPLIER_IRI (in _id integer) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('Supplier', cast(_id as varchar));
+}
+;
+
+create function DB.DBA.TUT_SUPPLIER_IRI_INVERSE (in _iri varchar) returns integer
+{
+    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
+};
+
+create function DB.DBA.TUT_PRODUCT_IRI (in _id integer) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('Product', cast(_id as varchar));
+}
+;
+
+create function DB.DBA.TUT_PRODUCT_IRI_INVERSE (in _iri varchar) returns integer
+{
+    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
+};
+
+create function DB.DBA.TUT_CUSTOMER_IRI (in _id varchar) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('Customer', _id);
+}
+;
+
+create function DB.DBA.TUT_CUSTOMER_IRI_INVERSE (in _iri varchar) returns varchar
+{
+    return DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri);
+};
+
+create function DB.DBA.TUT_EMPLOYEE_IRI (in _id integer) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('Employee', cast(_id as varchar));
+}
+;
+
+create function DB.DBA.TUT_EMPLOYEE_IRI_INVERSE (in _iri varchar) returns integer
+{
+    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
+};
+
+create function DB.DBA.TUT_ORDER_IRI (in _id integer) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('Order', cast(_id as varchar));
+}
+;
+
+create function DB.DBA.TUT_ORDER_IRI_INVERSE (in _iri varchar) returns integer
+{
+    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
+};
+
+create function DB.DBA.TUT_CUSTOMERCONTACT_IRI (in _id integer) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('CustomerContact', cast(_id as varchar));
+}
+;
+
+create function DB.DBA.TUT_CUSTOMERCONTACT_IRI_INVERSE (in _iri varchar) returns integer
+{
+    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
+};
+
+create function DB.DBA.TUT_ORDERLINE_IRI (in _id1 integer, in _id2 integer) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('OrderLine', sprintf('%d/%d', _id1, _id2));
+}
+;
+
+create function DB.DBA.TUT_ORDERLINE_IRI_INV_1 (in _iri varchar) returns integer
+{
+    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
+};
+
+create function DB.DBA.TUT_ORDERLINE_IRI_INV_2 (in _iri varchar) returns integer
+{
+    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
+};
+
+
+create function DB.DBA.TUT_PROVINCE_IRI (in _id1 varchar, in _id2 varchar) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('Province', sprintf('%s/%s', _id1, _id2));
+}
+;
+
+create function DB.DBA.TUT_PROVINCE_IRI_INV_1 (in _iri varchar) returns varchar
+{
+    return DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri);
+};
+
+create function DB.DBA.TUT_PROVINCE_IRI_INV_2 (in _iri varchar) returns varchar
+{
+    return DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri);
+};
+
+create function DB.DBA.TUT_COUNTRY_IRI (in _id varchar) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('Country', _id);
+}
+;
+
+create function DB.DBA.TUT_COUNTRY_IRI_INVERSE (in _iri varchar) returns varchar
+{
+    return DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri);
+};
+
+create function DB.DBA.TUT_FLAG_IRI (in _id varchar) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('Flag', _id);
+}
+;
+
+create function DB.DBA.TUT_FLAG_IRI_INVERSE (in _iri varchar) returns varchar
+{
+    return DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri);
+};
+
+create function DB.DBA.TUT_EMPLOYEEPHOTO_IRI (in _id integer) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('EmployeePhoto', cast(_id as varchar));
+}
+;
+
+create function DB.DBA.TUT_EMPLOYEEPHOTO_IRI_INVERSE (in _iri varchar) returns integer
+{
+    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
+};
+
+create function DB.DBA.TUT_CATEGORYPHOTO_IRI (in _id integer) returns varchar
+{
+    return TUT_NORTHWIND_ID_TO_IRI('CategoryPhoto', cast(_id as varchar));
+}
+;
+
+create function DB.DBA.TUT_CATEGORYPHOTO_IRI_INVERSE (in _iri varchar) returns integer
+{
+    return atoi(DB.DBA.TUT_NORTHWIND_IRI_TO_ID(_iri));
+};
+
+grant execute on DB.DBA.TUT_CATEGORY_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_CATEGORY_IRI_INVERSE to "SPARQL";
+grant execute on DB.DBA.TUT_SHIPPER_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_SHIPPER_IRI_INVERSE to "SPARQL";
+grant execute on DB.DBA.TUT_SUPPLIER_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_SUPPLIER_IRI_INVERSE to "SPARQL";
+grant execute on DB.DBA.TUT_PRODUCT_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_PRODUCT_IRI_INVERSE to "SPARQL";
+grant execute on DB.DBA.TUT_CUSTOMER_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_CUSTOMER_IRI_INVERSE to "SPARQL";
+grant execute on DB.DBA.TUT_EMPLOYEE_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_EMPLOYEE_IRI_INVERSE to "SPARQL";
+grant execute on DB.DBA.TUT_ORDER_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_ORDER_IRI_INVERSE to "SPARQL";
+grant execute on DB.DBA.TUT_CUSTOMERCONTACT_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_CUSTOMERCONTACT_IRI_INVERSE to "SPARQL";
+grant execute on DB.DBA.TUT_ORDERLINE_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_ORDERLINE_IRI_INV_1 to "SPARQL";
+grant execute on DB.DBA.TUT_ORDERLINE_IRI_INV_2 to "SPARQL";
+grant execute on DB.DBA.TUT_PROVINCE_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_PROVINCE_IRI_INV_1 to "SPARQL";
+grant execute on DB.DBA.TUT_PROVINCE_IRI_INV_2 to "SPARQL";
+grant execute on DB.DBA.TUT_COUNTRY_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_COUNTRY_IRI_INVERSE to "SPARQL";
+grant execute on DB.DBA.TUT_FLAG_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_FLAG_IRI_INVERSE to "SPARQL";
+grant execute on DB.DBA.TUT_EMPLOYEEPHOTO_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_EMPLOYEEPHOTO_IRI_INVERSE to "SPARQL";
+grant execute on DB.DBA.TUT_CATEGORYPHOTO_IRI to "SPARQL";
+grant execute on DB.DBA.TUT_CATEGORYPHOTO_IRI_INVERSE to "SPARQL";
+
+SPARQL
+prefix tut_northwind: <http://demo.openlinksw.com/schemas/tutorial/northwind#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+create iri class tut_northwind:Category "http://^{URIQADefaultHost}^/tutorial/Northwind/Category/%d#this" (in category_id integer not null) .
+create iri class tut_northwind:Shipper "http://^{URIQADefaultHost}^/tutorial/Northwind/Shipper/%d#this" (in shipper_id integer not null) .
+create iri class tut_northwind:Supplier "http://^{URIQADefaultHost}^/tutorial/Northwind/Supplier/%d#this" (in supplier_id integer not null) .
+create iri class tut_northwind:Product   "http://^{URIQADefaultHost}^/tutorial/Northwind/Product/%d#this" (in product_id integer not null) .
+create iri class tut_northwind:Customer "http://^{URIQADefaultHost}^/tutorial/Northwind/Customer/%U#this" (in customer_id varchar not null) .
+create iri class tut_northwind:Employee "http://^{URIQADefaultHost}^/tutorial/Northwind/Employee/%U%U%d#this" (in employee_firstname varchar not null, in employee_lastname varchar not null, in employee_id integer not null) .
+create iri class tut_northwind:Order "http://^{URIQADefaultHost}^/tutorial/Northwind/Order/%d#this" (in order_id integer not null) .
+create iri class tut_northwind:CustomerContact "http://^{URIQADefaultHost}^/tutorial/Northwind/CustomerContact/%U#this" (in customer_id varchar not null) .
+create iri class tut_northwind:OrderLine "http://^{URIQADefaultHost}^/tutorial/Northwind/OrderLine/%d/%d#this" (in order_id integer not null, in product_id integer not null) .
+create iri class tut_northwind:Province "http://^{URIQADefaultHost}^/tutorial/Northwind/Province/%U/%U#this" (in country_name varchar not null, in province_name varchar not null) .
+create iri class tut_northwind:Country "http://^{URIQADefaultHost}^/tutorial/Northwind/Country/%U#this" (in country_name varchar not null) .
+create iri class tut_northwind:Flag "http://^{URIQADefaultHost}^%U#this" (in flag_path varchar not null) .
+create iri class tut_northwind:dbpedia_iri "http://dbpedia.org/resource/%U" (in uname varchar not null) .
+create iri class tut_northwind:EmployeePhoto "http://^{URIQADefaultHost}^/DAV/VAD/demo/sql/EMP%d#this" (in emp_id varchar not null) .
+create iri class tut_northwind:CategoryPhoto "http://^{URIQADefaultHost}^/DAV/VAD/demo/sql/CAT%d#this" (in category_id varchar not null) .
+;
+
+SPARQL
+prefix tut_northwind: <http://demo.openlinksw.com/schemas/tutorial/northwind#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+create iri class tut_northwind:customercontact_iri using
+    function DB.DBA.TUT_CUSTOMERCONTACT_IRI (in customer_id varchar) returns varchar,
+    function DB.DBA.TUT_CUSTOMERCONTACT_IRI_INVERSE (in customer_iri varchar) returns varchar.
+create iri class tut_northwind:category_iri using
+    function DB.DBA.TUT_CATEGORY_IRI (in customer_id integer) returns varchar,
+    function DB.DBA.TUT_CATEGORY_IRI_INVERSE (in customer_iri varchar) returns integer.
+create iri class tut_northwind:shipper_iri using
+    function DB.DBA.TUT_SHIPPER_IRI (in customer_id integer) returns varchar,
+    function DB.DBA.TUT_SHIPPER_IRI_INVERSE (in customer_iri varchar) returns integer.
+create iri class tut_northwind:supplier_iri using
+    function DB.DBA.TUT_SUPPLIER_IRI (in customer_id varchar) returns varchar,
+    function DB.DBA.TUT_SUPPLIER_IRI_INVERSE (in customer_iri varchar) returns varchar.
+create iri class tut_northwind:product_iri using
+    function DB.DBA.TUT_PRODUCT_IRI (in customer_id integer) returns varchar,
+    function DB.DBA.TUT_PRODUCT_IRI_INVERSE (in customer_iri varchar) returns integer.
+create iri class tut_northwind:customer_iri using
+    function DB.DBA.TUT_CUSTOMER_IRI (in customer_id varchar) returns varchar,
+    function DB.DBA.TUT_CUSTOMER_IRI_INVERSE (in customer_iri varchar) returns varchar.
+create iri class tut_northwind:employee_iri using
+    function DB.DBA.TUT_EMPLOYEE_IRI (in customer_id integer) returns varchar,
+    function DB.DBA.TUT_EMPLOYEE_IRI_INVERSE (in customer_iri varchar) returns integer.
+create iri class tut_northwind:order_iri using
+    function DB.DBA.TUT_ORDER_IRI (in customer_id integer) returns varchar,
+    function DB.DBA.TUT_ORDER_IRI_INVERSE (in customer_iri varchar) returns integer.
+create iri class tut_northwind:orderline_iri using
+    function DB.DBA.TUT_ORDERLINE_IRI (in customer_id integer, in customer_id2 integer) returns varchar,
+    function DB.DBA.TUT_ORDERLINE_IRI_INV_1 (in customer_iri varchar) returns integer,
+    function DB.DBA.TUT_ORDERLINE_IRI_INV_2 (in customer_iri varchar) returns integer.
+create iri class tut_northwind:province_iri using
+    function DB.DBA.TUT_PROVINCE_IRI (in customer_id varchar, in customer_id2 varchar) returns varchar,
+    function DB.DBA.TUT_PROVINCE_IRI_INV_1 (in customer_iri varchar) returns varchar,
+    function DB.DBA.TUT_PROVINCE_IRI_INV_2 (in customer_iri varchar) returns varchar.
+create iri class tut_northwind:country_iri using
+    function DB.DBA.TUT_COUNTRY_IRI (in customer_id varchar) returns varchar,
+    function DB.DBA.TUT_COUNTRY_IRI_INVERSE (in customer_iri varchar) returns varchar.
+create iri class tut_northwind:employeephoto_iri using
+    function DB.DBA.TUT_EMPLOYEEPHOTO_IRI (in customer_id integer) returns varchar,
+    function DB.DBA.TUT_EMPLOYEEPHOTO_IRI_INVERSE (in customer_iri varchar) returns integer.
+create iri class tut_northwind:categoryphoto_iri using
+    function DB.DBA.TUT_CATEGORYPHOTO_IRI (in customer_id integer) returns varchar,
+    function DB.DBA.TUT_CATEGORYPHOTO_IRI_INVERSE (in customer_iri varchar) returns integer.
+create iri class tut_northwind:flag_iri using
+    function DB.DBA.TUT_FLAG_IRI (in customer_id varchar) returns varchar,
+    function DB.DBA.TUT_FLAG_IRI_INVERSE (in customer_iri varchar) returns varchar.
+;
+
+SPARQL
+prefix tut_northwind: <http://demo.openlinksw.com/schemas/tutorial/northwind#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+alter quad storage virtrdf:DefaultQuadStorage
+from Demo.demo.Products as products
+from Demo.demo.Suppliers as suppliers
+from Demo.demo.Shippers as shippers
+from Demo.demo.Categories as categories
+from Demo.demo.Customers as customers
+from Demo.demo.Employees as employees
+from Demo.demo.Orders as orders
+from Demo.demo.Order_Details as order_lines
+from Demo.demo.Countries as countries
+from Demo.demo.Provinces as provinces
+where (^{suppliers.}^.Country = ^{countries.}^.Name)
+where (^{customers.}^.Country = ^{countries.}^.Name)
+where (^{employees.}^.Country = ^{countries.}^.Name)
+where (^{orders.}^.ShipCountry = ^{countries.}^.Name)
+{
+        create virtrdf:TutorialNorthwindDemo as graph iri ("http://^{URIQADefaultHost}^/tutorial/Northwind") option (exclusive)
+        {
+                tut_northwind:CustomerContact (customers.CustomerID)
+                        a foaf:Person
+                                as virtrdf:tutCustomerContact-foaf_Person .
+
+                tut_northwind:CustomerContact (customers.CustomerID)
+                        a tut_northwind:CustomerContact
+                                as virtrdf:tutCustomerContact-CustomerContact;
+                        foaf:name customers.ContactName
+                                as virtrdf:tutCustomerContact-contact_name ;
+                        foaf:phone customers.Phone
+                                as virtrdf:tutCustomerContact-foaf_phone ;
+                        tut_northwind:is_contact_at tut_northwind:Customer (customers.CustomerID)
+                                as virtrdf:tutCustomerContact-is_contact_at ;
+                        tut_northwind:country tut_northwind:Country (customers.Country)
+                                as virtrdf:tutCustomerContact-country ;
+                        rdfs:isDefinedBy tut_northwind:customercontact_iri (customers.CustomerID) ;
+                        rdfs:isDefinedBy tut_northwind:CustomerContact (customers.CustomerID) .
+
+                tut_northwind:Country (customers.Country)
+                        tut_northwind:is_country_of
+                tut_northwind:CustomerContact (customers.CustomerID) as virtrdf:tutCustomerContact-is_country_of .
+
+                tut_northwind:Product (products.ProductID)
+                        a tut_northwind:Product
+                                as virtrdf:tutProduct-ProductID ;
+                        tut_northwind:has_category tut_northwind:Category (products.CategoryID)
+                                as virtrdf:tutProduct-product_has_category ;
+                        tut_northwind:has_supplier tut_northwind:Supplier (products.SupplierID)
+                                as virtrdf:tutProduct-product_has_supplier ;
+                        tut_northwind:productName products.ProductName
+                                as virtrdf:tutProduct-name_of_product ;
+                        tut_northwind:quantityPerUnit products.QuantityPerUnit
+                                as virtrdf:tutProduct-quantity_per_unit ;
+                        tut_northwind:unitPrice products.UnitPrice
+                                as virtrdf:tutProduct-unit_price ;
+                        tut_northwind:unitsInStock products.UnitsInStock
+                                as virtrdf:tutProduct-units_in_stock ;
+                        tut_northwind:unitsOnOrder products.UnitsOnOrder
+                                as virtrdf:tutProduct-units_on_order ;
+                        tut_northwind:reorderLevel products.ReorderLevel
+                                as virtrdf:tutProduct-reorder_level ;
+                        tut_northwind:discontinued products.Discontinued
+                                as virtrdf:tutProduct-discontinued ;
+                        rdfs:isDefinedBy tut_northwind:product_iri (products.ProductID) ;
+                        rdfs:isDefinedBy tut_northwind:Product (products.ProductID).
+
+                tut_northwind:Category (products.CategoryID)
+                        tut_northwind:category_of tut_northwind:Product (products.ProductID) as virtrdf:tutProduct-category_of .
+
+                tut_northwind:Supplier (products.SupplierID)
+                        tut_northwind:supplier_of tut_northwind:Product (products.ProductID) as virtrdf:tutProduct-supplier_of .
+
+                tut_northwind:Supplier (suppliers.SupplierID)
+                        a tut_northwind:Supplier
+                                as virtrdf:tutSupplier-SupplierID ;
+                        tut_northwind:companyName suppliers.CompanyName
+                                as virtrdf:tutSupplier-company_name ;
+                        tut_northwind:contactName suppliers.ContactName
+                                as virtrdf:tutSupplier-contact_name ;
+                        tut_northwind:contactTitle suppliers.ContactTitle
+                                as virtrdf:tutSupplier-contact_title ;
+                        tut_northwind:address suppliers.Address
+                                as virtrdf:tutSupplier-address ;
+                        tut_northwind:city suppliers.City
+                                as virtrdf:tutSupplier-city ;
+                        tut_northwind:dbpedia_city tut_northwind:dbpedia_iri(suppliers.City)
+                                as virtrdf:tutSupplier-dbpedia_city ;
+                        tut_northwind:region suppliers.Region
+                                as virtrdf:tutSupplier-region ;
+                        tut_northwind:postalCode suppliers.PostalCode
+                                as virtrdf:tutSupplier-postal_code ;
+                        tut_northwind:country tut_northwind:Country(suppliers.Country)
+                                as virtrdf:tutSupplier-country ;
+                        tut_northwind:phone suppliers.Phone
+                                as virtrdf:tutSupplier-phone ;
+                        tut_northwind:fax suppliers.Fax
+                                as virtrdf:tutSupplier-fax ;
+                        tut_northwind:homePage suppliers.HomePage
+                                as virtrdf:tutSupplier-home_page ;
+                        rdfs:isDefinedBy tut_northwind:supplier_iri (suppliers.SupplierID) ;
+                        rdfs:isDefinedBy tut_northwind:Supplier (suppliers.SupplierID).
+
+                tut_northwind:Country (suppliers.Country)
+                        tut_northwind:is_country_of
+                tut_northwind:Supplier (suppliers.SupplierID) as virtrdf:tutSupplier-is_country_of .
+
+                tut_northwind:Category (categories.CategoryID)
+                        a tut_northwind:Category
+                                as virtrdf:tutCategory-CategoryID ;
+                        tut_northwind:categoryName categories.CategoryName
+                                as virtrdf:tutCategory-home_page ;
+                        tut_northwind:description categories.Description
+                                as virtrdf:tutCategory-description ;
+                        foaf:img tut_northwind:CategoryPhoto(categories.CategoryID)
+                                as virtrdf:tutCategory-categories.CategoryPhoto ;
+                        rdfs:isDefinedBy tut_northwind:category_iri (categories.CategoryID) ;
+                        rdfs:isDefinedBy tut_northwind:Category (categories.CategoryID).
+
+                tut_northwind:CategoryPhoto(categories.CategoryID)
+                        a tut_northwind:CategoryPhoto
+                                as virtrdf:tutCategory-categories.CategoryPhotoID ;
+                        rdfs:isDefinedBy tut_northwind:categoryphoto_iri (categories.CategoryID) ;
+                        rdfs:isDefinedBy tut_northwind:CategoryPhoto(categories.CategoryID).
+
+                tut_northwind:Shipper (shippers.ShipperID)
+                        a tut_northwind:Shipper
+                                as virtrdf:tutShipper-ShipperID ;
+                        tut_northwind:companyName shippers.CompanyName
+                                as virtrdf:tutShipper-company_name ;
+                        tut_northwind:phone shippers.Phone
+                                as virtrdf:tutShipper-phone ;
+                        rdfs:isDefinedBy tut_northwind:shipper_iri (shippers.ShipperID) ;
+                        rdfs:isDefinedBy tut_northwind:Shipper (shippers.ShipperID).
+
+                tut_northwind:Customer (customers.CustomerID)
+                        a  tut_northwind:Customer
+                                as virtrdf:tutCustomer-CustomerID2 ;
+                        a  foaf:Organization
+                                as virtrdf:tutCustomer-CustomerID ;
+                        foaf:name customers.CompanyName
+                                as virtrdf:tutCustomer-foaf_name ;
+                        tut_northwind:companyName customers.CompanyName
+                                as virtrdf:tutCustomer-company_name ;
+                        tut_northwind:has_contact tut_northwind:CustomerContact (customers.CustomerID)
+                                as virtrdf:tutCustomer-contact ;
+                        tut_northwind:country tut_northwind:Country (customers.Country)
+                                as virtrdf:tutCustomer-country ;
+                        tut_northwind:contactName customers.ContactName
+                                as virtrdf:tutCustomer-contact_name ;
+                        tut_northwind:contactTitle customers.ContactTitle
+                                as virtrdf:tutCustomer-contact_title ;
+                        tut_northwind:address customers.Address
+                                as virtrdf:tutCustomer-address ;
+                        tut_northwind:city customers.City
+                                as virtrdf:tutCustomer-city ;
+                        tut_northwind:dbpedia_city tut_northwind:dbpedia_iri(customers.City)
+                                as virtrdf:tutCustomer-dbpedia_city ;
+                        tut_northwind:region customers.Region
+                                as virtrdf:tutCustomer-region ;
+                        tut_northwind:PostalCode customers.PostalCode
+                                as virtrdf:tutCustomer-postal_code ;
+                        foaf:phone customers.Phone
+                                as virtrdf:tutCustomer-foaf_phone ;
+                        tut_northwind:phone customers.Phone
+                                as virtrdf:tutCustomer-phone ;
+                        tut_northwind:fax customers.Fax
+                                as virtrdf:tutCustomer-fax ;
+                        rdfs:isDefinedBy tut_northwind:customer_iri (customers.CustomerID) ;
+                        rdfs:isDefinedBy tut_northwind:Customer (customers.CustomerID).
+
+                tut_northwind:Country (customers.Country)
+                        tut_northwind:is_country_of
+                tut_northwind:Customer (customers.CustomerID) as virtrdf:tutCustomer-is_country_of .
+
+                tut_northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID)
+                        a tut_northwind:Employee
+                                as virtrdf:tutEmployee-EmployeeID2 ;
+                        a foaf:Person
+                                as virtrdf:tutEmployee-EmployeeID ;
+                        foaf:surname employees.LastName
+                                as virtrdf:tutEmployee-foaf_last_name ;
+                        tut_northwind:lastName employees.LastName
+                                as virtrdf:tutEmployee-last_name ;
+                        foaf:firstName employees.FirstName
+                                as virtrdf:tutEmployee-foaf_first_name ;
+                        tut_northwind:firstName employees.FirstName
+                                as virtrdf:tutEmployee-first_name ;
+                        foaf:title employees.Title
+                                as virtrdf:tutEmployee-title ;
+                        tut_northwind:titleOfCourtesy employees.TitleOfCourtesy
+                                as virtrdf:tutEmployee-title_of_courtesy ;
+                        foaf:birthday employees.BirthDate
+                                as virtrdf:tutEmployee-foaf_birth_date ;
+                        tut_northwind:birthday employees.BirthDate
+                                as virtrdf:tutEmployee-birth_date ;
+                        tut_northwind:hireDate employees.HireDate
+                                as virtrdf:tutEmployee-hire_date ;
+                        tut_northwind:address employees.Address
+                                as virtrdf:tutEmployee-address ;
+                        tut_northwind:city employees.City
+                                as virtrdf:tutEmployee-city ;
+                        tut_northwind:dbpedia_city tut_northwind:dbpedia_iri(employees.City)
+                                as virtrdf:tutEmployee-dbpedia_city ;
+                        tut_northwind:region employees.Region
+                                as virtrdf:tutEmployee-region ;
+                        tut_northwind:postalCode employees.PostalCode
+                                as virtrdf:tutEmployee-postal_code ;
+                        tut_northwind:country tut_northwind:Country (employees.Country)
+                                as virtrdf:tutEmployee-country ;
+                        foaf:phone employees.HomePhone
+                                as virtrdf:tutEmployee-home_phone ;
+                        tut_northwind:extension employees.Extension
+                                as virtrdf:tutEmployee-extension ;
+                        tut_northwind:notes employees.Notes
+                                as virtrdf:tutEmployee-notes ;
+                        tut_northwind:reportsTo tut_northwind:Employee(employees.FirstName, employees.LastName, employees.ReportsTo) where (^{employees.}^.ReportsTo = ^{employees.}^.EmployeeID)
+                                as virtrdf:tutEmployee-reports_to ;
+                        foaf:img tut_northwind:EmployeePhoto(employees.EmployeeID)
+                                as virtrdf:tutEmployee-employees.EmployeePhoto ;
+                        rdfs:isDefinedBy tut_northwind:employee_iri (employees.EmployeeID) ;
+                        rdfs:isDefinedBy tut_northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID).
+
+                tut_northwind:EmployeePhoto(employees.EmployeeID)
+                        a tut_northwind:EmployeePhoto
+                                as virtrdf:tut_Employee-employees.EmployeePhotoId ;
+                        rdfs:isDefinedBy tut_northwind:employeephoto_iri (employees.EmployeeID) ;
+                        rdfs:isDefinedBy tut_northwind:EmployeePhoto (employees.EmployeeID).
+
+                tut_northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID)
+                        tut_northwind:is_salesrep_of
+                tut_northwind:Order (orders.OrderID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID) as virtrdf:tutOrder-is_salesrep_of .
+
+                tut_northwind:Country (employees.Country)
+                        tut_northwind:is_country_of
+                tut_northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID) as virtrdf:tutEmployee-is_country_of .
+
+                tut_northwind:Order (orders.OrderID)
+                        a tut_northwind:Order
+                                as virtrdf:tutOrder-Order ;
+                        tut_northwind:has_customer tut_northwind:Customer (orders.CustomerID)
+                                as virtrdf:tutOrder-order_has_customer ;
+                        tut_northwind:has_salesrep tut_northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID)
+                                as virtrdf:tutCustomer-has_salesrep ;
+                        tut_northwind:has_employee tut_northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID)
+                                as virtrdf:tutOrder-order_has_employee ;
+                        tut_northwind:orderDate orders.OrderDate
+                                as virtrdf:tutOrder-order_date ;
+                        tut_northwind:requiredDate orders.RequiredDate
+                                as virtrdf:tutOrder-required_date ;
+                        tut_northwind:shippedDate orders.ShippedDate
+                                as virtrdf:tutOrder-shipped_date ;
+                        tut_northwind:order_ship_via tut_northwind:Shipper (orders.ShipVia)
+                                as virtrdf:tutOrder-order_ship_via ;
+                        tut_northwind:freight orders.Freight
+                                as virtrdf:tutOrder-freight ;
+                        tut_northwind:shipName orders.ShipName
+                                as virtrdf:tutOrder-ship_name ;
+                        tut_northwind:shipAddress orders.ShipAddress
+                                as virtrdf:tutOrder-ship_address ;
+                        tut_northwind:shipCity orders.ShipCity
+                                as virtrdf:tutOrder-ship_city ;
+                        tut_northwind:dbpedia_shipCity tut_northwind:dbpedia_iri(orders.ShipCity)
+                                as virtrdf:tutOrder-ship_dbpedia_city ;
+                        tut_northwind:shipRegion orders.ShipRegion
+                                as virtrdf:tutOrder-ship_region ;
+                        tut_northwind:shipPostal_code orders.ShipPostalCode
+                                as virtrdf:tutOrder-ship_postal_code ;
+                        tut_northwind:shipCountry tut_northwind:Country(orders.ShipCountry)
+                                as virtrdf:tutship_country ;
+                        rdfs:isDefinedBy tut_northwind:order_iri (orders.OrderID) ;
+                        rdfs:isDefinedBy tut_northwind:Order (orders.OrderID).
+
+                tut_northwind:Country (orders.ShipCountry)
+                        tut_northwind:is_ship_country_of
+                tut_northwind:Order (orders.OrderID) as virtrdf:tutOrder-is_country_of .
+
+                tut_northwind:Customer (orders.CustomerID)
+                        tut_northwind:has_order tut_northwind:Order (orders.OrderID) as virtrdf:tutOrder-has_order .
+
+                tut_northwind:Shipper (orders.ShipVia)
+                        tut_northwind:ship_order tut_northwind:Order (orders.OrderID) as virtrdf:tutOrder-ship_order .
+
+                tut_northwind:OrderLine (order_lines.OrderID, order_lines.ProductID)
+                        a tut_northwind:OrderLine
+                                as virtrdf:tutOrderLine-OrderLines ;
+                        tut_northwind:has_order_id tut_northwind:Order (order_lines.OrderID)
+                                as virtrdf:tutorder_lines_has_order_id ;
+                        tut_northwind:has_product_id tut_northwind:Product (order_lines.ProductID)
+                                as virtrdf:tutorder_lines_has_product_id ;
+                        tut_northwind:unitPrice order_lines.UnitPrice
+                                as virtrdf:tutOrderLine-unit_price ;
+                        tut_northwind:quantity order_lines.Quantity
+                                as virtrdf:tutOrderLine-quantity ;
+                        tut_northwind:discount order_lines.Discount
+                                as virtrdf:tutOrderLine-discount ;
+                        rdfs:isDefinedBy tut_northwind:orderline_iri (order_lines.OrderID, order_lines.ProductID) ;
+                        rdfs:isDefinedBy tut_northwind:OrderLine (order_lines.OrderID, order_lines.ProductID).
+
+                tut_northwind:Order (orders.OrderID)
+                        tut_northwind:is_order_of
+                tut_northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) where (^{orders.}^.OrderID = ^{order_lines.}^.OrderID) as virtrdf:tutOrder-is_order_of .
+
+                tut_northwind:Product (products.ProductID)
+                        tut_northwind:is_product_of
+                tut_northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) where (^{products.}^.ProductID = ^{order_lines.}^.ProductID) as virtrdf:tutProduct-is_product_of .
+
+                tut_northwind:Country (countries.Name)
+                        a tut_northwind:Country
+                                as virtrdf:tutCountry-Type2 ;
+                        a wgs:SpatialThing
+                                as virtrdf:tutCountry-Type ;
+                        owl:sameAs tut_northwind:dbpedia_iri (countries.Name) ;
+                        tut_northwind:name countries.Name
+                                as virtrdf:tutCountry-Name ;
+                        tut_northwind:code countries.Code
+                                as virtrdf:tutCountry-Code ;
+                        tut_northwind:smallFlagDAVResourceName countries.SmallFlagDAVResourceName
+                                as virtrdf:tutCountry-SmallFlagDAVResourceName ;
+                        tut_northwind:largeFlagDAVResourceName countries.LargeFlagDAVResourceName
+                                as virtrdf:tutCountry-LargeFlagDAVResourceName ;
+                        tut_northwind:smallFlagDAVResourceURI tut_northwind:Flag(countries.SmallFlagDAVResourceURI)
+                                as virtrdf:tutCountry-SmallFlagDAVResourceURI ;
+                        tut_northwind:largeFlagDAVResourceURI tut_northwind:Flag(countries.LargeFlagDAVResourceURI)
+                                as virtrdf:tutCountry-LargeFlagDAVResourceURI ;
+                        wgs:lat countries.Lat
+                                as virtrdf:tutCountry-Lat ;
+                        wgs:long countries.Lng
+                                as virtrdf:tutCountry-Lng ;
+                        rdfs:isDefinedBy tut_northwind:country_iri (countries.Name) ;
+                        rdfs:isDefinedBy tut_northwind:Country (countries.Name).
+
+                tut_northwind:Country (countries.Name)
+                        tut_northwind:has_province
+                tut_northwind:Province (provinces.CountryCode, provinces.Province) where (^{provinces.}^.CountryCode = ^{countries.}^.Code) as virtrdf:tutCountry-has_province .
+
+                tut_northwind:Province (provinces.CountryCode, provinces.Province)
+                        a tut_northwind:Province
+                                as virtrdf:tutProvince-Provinces ;
+                        tut_northwind:has_country_code provinces.CountryCode
+                                as virtrdf:tuthas_country_code ;
+                        tut_northwind:provinceName provinces.Province
+                                as virtrdf:tutProvince-ProvinceName ;
+                        rdfs:isDefinedBy tut_northwind:province_iri (provinces.CountryCode, provinces.Province) ;
+                        rdfs:isDefinedBy tut_northwind:Province (provinces.CountryCode, provinces.Province).
+
+                tut_northwind:Province (provinces.CountryCode, provinces.Province)
+                        tut_northwind:is_province_of
+                tut_northwind:Country (countries.Name) where  (^{countries.}^.Code = ^{provinces.}^.CountryCode) as virtrdf:tutProvince-country_of .
+        } .
+} .
+;
+
+DELETE FROM db.dba.url_rewrite_rule_list where urrl_list like 'tut_nw%';
+DELETE FROM db.dba.url_rewrite_rule where urr_rule like 'tut_nw%';
+
+create procedure DB.DBA.install_run ()
+{
+        declare file_text, uriqa varchar;
+        uriqa := registry_get('URIQADefaultHost');
+        file_text := (SELECT blob_to_string (RES_CONTENT) FROM WS.WS.SYS_DAV_RES where RES_FULL_PATH='/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.isparql');
+        file_text := replace(file_text, 'URIQA_MACRO', concat('http://', uriqa, '/tutorial/Northwind'));
+        update WS.WS.SYS_DAV_RES set RES_CONTENT=file_text where RES_FULL_PATH='/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.isparql';
+}
+;
+
+DB.DBA.install_run()
+;
+
+drop procedure DB.DBA.install_run
+;
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'tut_nw_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/tutorial/Northwind%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'tut_nw_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/rdfbrowser/index.html?uri=http%%3A//^{URIQADefaultHost}^%U%%23this',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'tut_nw_rule3',
+    1,
+    '(/[^#]*)/\x24',
+    vector('path'),
+    1,
+    '%s',
+    vector('path'),
+    null,
+    null,
+    0,
+    null
+    );
+
+create procedure DB.DBA.REMOVE_TUT_DEMO_RDF_DET()
+{
+  declare colid int;
+  colid := DAV_SEARCH_ID('/DAV/VAD/tutorial/rdfview/rd_v_1/', 'C');
+  if (colid < 0)
+    return;
+  update WS.WS.SYS_DAV_COL set COL_DET=null where COL_ID = colid;
+}
+;
+
+DB.DBA.REMOVE_TUT_DEMO_RDF_DET();
+
+drop procedure DB.DBA.REMOVE_TUT_DEMO_RDF_DET;
+
+create procedure DB.DBA.TUT_NORTHWIND_MAKE_RDF_DET()
+{
+    declare uriqa_str varchar;
+    uriqa_str := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+    uriqa_str := 'http://' || uriqa_str || '/tutorial/Northwind';
+    DB.DBA."RDFData_MAKE_DET_COL" ('/DAV/VAD/tutorial/rdfview/rd_v_1/RDFData/', uriqa_str, NULL);
+    VHOST_REMOVE (lpath=>'/tutorial/Northwind/data/rdf');
+    DB.DBA.VHOST_DEFINE (lpath=>'/tutorial/Northwind/data/rdf', ppath=>'/DAV/VAD/tutorial/rdfview/rd_v_1/RDFData/All/', is_dav=>1, vsp_user=>'dba');
+}
+;
+
+DB.DBA.TUT_NORTHWIND_MAKE_RDF_DET();
+
+drop procedure DB.DBA.TUT_NORTHWIND_MAKE_RDF_DET;
+
+-- procedure to convert path to DET resource name
+create procedure DB.DBA.TUT_NORTHWIND_DET_REF (in par varchar, in fmt varchar, in val varchar)
+{
+  declare res, iri any;
+  declare uriqa_str varchar;
+  uriqa_str := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+  uriqa_str := 'http://' || uriqa_str || '/tutorial/Northwind';
+  iri := uriqa_str || val;
+  res := sprintf ('iid (%d).rdf', iri_id_num (iri_to_id (iri)));
+  return sprintf (fmt, res);
+}
+;
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE ('tut_nw_rdf', 1,
+    '/tutorial/Northwind/(.*)', vector('path'), 1,
+    '/tutorial/Northwind/data/rdf/%U', vector('path'),
+    'DB.DBA.TUT_NORTHWIND_DET_REF',
+    'application/rdf.xml',
+    2,
+    303);
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'tut_nw_rule_list1',
+    1,
+    vector (
+                'tut_nw_rule1',
+                'tut_nw_rule2',
+                'tut_nw_rule3',
+                'tut_nw_rdf'
+          ));
+
+
+VHOST_REMOVE (lpath=>'/tutorial/Northwind');
+DB.DBA.VHOST_DEFINE (lpath=>'/tutorial/Northwind', ppath=>'/DAV/VAD/tutorial/rdfview/rd_v_1/', vsp_user=>'dba', is_dav=>1, def_page=>'sfront.vspx',
+          is_brws=>0, opts=>vector ('url_rewrite', 'tut_nw_rule_list1'));
+
+create procedure DB.DBA.LOAD_TUTNW_ONTOLOGY_FROM_DAV()
+{
+  declare content, urihost varchar;
+  whenever not found goto endpoint;
+  SELECT cast (RES_CONTENT as varchar) into content FROM WS.WS.SYS_DAV_RES where RES_FULL_PATH = '/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.owl';
+  if (content is null or content = '')
+    goto endpoint;
+  DB.DBA.RDF_LOAD_RDFXML (content, 'http://demo.openlinksw.com/schemas/tutorial/northwind#', 'http://demo.openlinksw.com/schemas/TutorialNorthwindOntology/1.0/');
+  if (urihost = 'demo.openlinksw.com')
+  {
+    DB.DBA.VHOST_REMOVE (lpath=>'/schemas/tutorial/northwind#');
+    DB.DBA.VHOST_DEFINE (lpath=>'/schemas/tutorial/northwind#', ppath=>'/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
+    DB.DBA.VHOST_REMOVE (lpath=>'/schemas/tutorial/northwind');
+    DB.DBA.VHOST_DEFINE (lpath=>'/schemas/tutorial/northwind', ppath=>'/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
+  }
+  endpoint:
+  ;
+}
+;
+
+DB.DBA.LOAD_TUTNW_ONTOLOGY_FROM_DAV()
+;
+
+drop procedure DB.DBA.LOAD_TUTNW_ONTOLOGY_FROM_DAV
+;
+
+create procedure DB.DBA.LOAD_TUTNW_ONTOLOGY_FROM_DAV2()
+{
+  declare urihost varchar;
+  sparql base <http://demo.openlinksw.com/schemas/tutorial/northwind#> load bif:concat ("http://", bif:registry_get("URIQADefaultHost"), "/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.owl")
+   into graph <http://demo.openlinksw.com/schemas/TutorialNorthwindOntology/1.0/>;
+  urihost := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+  if (urihost = 'demo.openlinksw.com')
+  {
+    DB.DBA.VHOST_REMOVE (lpath=>'/tutorial/northwind#');
+    DB.DBA.VHOST_DEFINE (lpath=>'/tutorial/northwind#', ppath=>'/DAV/VAD/tutorial/rdfview/rd_v_1/rd_v_1.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
+  }
+}
+;
+
+--DB.DBA.LOAD_TUTNW_ONTOLOGY_FROM_DAV2();
+
+drop procedure DB.DBA.LOAD_TUTNW_ONTOLOGY_FROM_DAV2
+;
+
+DB.DBA.XML_SET_NS_DECL ('tut_northwind', 'http://demo.openlinksw.com/schemas/tutorial/northwind#', 2);
+]]></programlisting>
+    </sect2>
+    <sect2 id="rdfviewsenterprsn">
+      <title>SQL Server's Northwind Demo Database</title>
+<programlisting><![CDATA[
+use DB;
+
+DB.DBA.exec_stmt ('UPDATE WS.WS.SYS_DAV_RES set RES_TYPE=\'image/jpeg\' where RES_FULL_PATH like \'/DAV/VAD/demo/sql/CAT%\'', 0)
+;
+
+DB.DBA.exec_stmt ('UPDATE WS.WS.SYS_DAV_RES set RES_TYPE=\'image/jpeg\' where RES_FULL_PATH like \'/DAV/VAD/demo/sql/EMP%\'', 0)
+;
+
+GRANT SELECT ON "Demo"."demo"."Products" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Suppliers" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Shippers" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Categories" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Customers" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Employees" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Orders" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Order_Details" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Countries" TO "SPARQL";
+GRANT SELECT ON "Demo"."demo"."Provinces" TO "SPARQL";
+
+
+SPARQL drop quad map graph iri("http://^{URIQADefaultHost}^/Northwind") .
+;
+
+SPARQL drop quad map virtrdf:NorthwindDemo .
+;
+
+SPARQL
+prefix northwind: <http://demo.openlinksw.com/schemas/northwind#>
+drop iri class northwind:Category .
+drop iri class northwind:CategoryDoc .
+drop iri class northwind:Shipper .
+drop iri class northwind:ShipperDoc .
+drop iri class northwind:Supplier .
+drop iri class northwind:SupplierDoc .
+drop iri class northwind:Product .
+drop iri class northwind:ProductDoc .
+drop iri class northwind:Customer .
+drop iri class northwind:CustomerDoc .
+drop iri class northwind:Employee .
+drop iri class northwind:EmployeeDoc .
+drop iri class northwind:Order .
+drop iri class northwind:OrderDoc .
+drop iri class northwind:CustomerContact .
+drop iri class northwind:CustomerContactDoc .
+drop iri class northwind:OrderLine .
+drop iri class northwind:OrderLineDoc .
+drop iri class northwind:Province .
+drop iri class northwind:ProvinceDoc .
+drop iri class northwind:Country .
+drop iri class northwind:CountryDoc .
+drop iri class northwind:Flag .
+drop iri class northwind:FlagDoc .
+drop iri class northwind:dbpedia_iri2 .
+drop iri class northwind:EmployeePhoto .
+drop iri class northwind:CategoryPhoto .
+
+drop iri class northwind:category_iri .
+drop iri class northwind:categorydoc_iri .
+drop iri class northwind:shipper_iri .
+drop iri class northwind:shipperdoc_iri .
+drop iri class northwind:supplier_iri .
+drop iri class northwind:supplierdoc_iri .
+drop iri class northwind:product_iri .
+drop iri class northwind:productdoc_iri .
+drop iri class northwind:customer_iri .
+drop iri class northwind:customerdoc_iri .
+drop iri class northwind:employee_iri .
+drop iri class northwind:employeedoc_iri .
+drop iri class northwind:order_iri .
+drop iri class northwind:orderdoc_iri .
+drop iri class northwind:customercontact_iri .
+drop iri class northwind:customercontactdoc_iri .
+drop iri class northwind:orderline_iri .
+drop iri class northwind:orderlinedoc_iri .
+drop iri class northwind:province_iri .
+drop iri class northwind:provincedoc_iri .
+drop iri class northwind:country_iri .
+drop iri class northwind:countrydoc_iri .
+drop iri class northwind:employeephoto_iri .
+drop iri class northwind:categoryphoto_iri .
+drop iri class northwind:flag_iri .
+drop iri class northwind:flagdoc_iri .
+;
+
+SPARQL
+prefix northwind: <http://demo.openlinksw.com/schemas/northwind#>
+
+create iri class northwind:Category "http://^{URIQADefaultHost}^/Northwind/Category/%d#this" (in category_id integer not null) .
+create iri class northwind:CategoryDoc "http://^{URIQADefaultHost}^/Northwind/Category/%d" (in category_id integer not null) .
+create iri class northwind:Shipper "http://^{URIQADefaultHost}^/Northwind/Shipper/%d#this" (in shipper_id integer not null) .
+create iri class northwind:ShipperDoc "http://^{URIQADefaultHost}^/Northwind/Shipper/%d" (in shipper_id integer not null) .
+create iri class northwind:Supplier "http://^{URIQADefaultHost}^/Northwind/Supplier/%d#this" (in supplier_id integer not null) .
+create iri class northwind:SupplierDoc "http://^{URIQADefaultHost}^/Northwind/Supplier/%d" (in supplier_id integer not null) .
+create iri class northwind:Product   "http://^{URIQADefaultHost}^/Northwind/Product/%d#this" (in product_id integer not null) .
+create iri class northwind:ProductDoc   "http://^{URIQADefaultHost}^/Northwind/Product/%d" (in product_id integer not null) .
+create iri class northwind:Customer "http://^{URIQADefaultHost}^/Northwind/Customer/%U#this" (in customer_id varchar not null) .
+create iri class northwind:CustomerDoc "http://^{URIQADefaultHost}^/Northwind/Customer/%U" (in customer_id varchar not null) .
+create iri class northwind:Employee "http://^{URIQADefaultHost}^/Northwind/Employee/%U_%U_%d#this" (in employee_firstname varchar not null, in employee_lastname varchar not null, in employee_id integer not null) .
+create iri class northwind:EmployeeDoc "http://^{URIQADefaultHost}^/Northwind/Employee/%U_%U_%d" (in employee_firstname varchar not null, in employee_lastname varchar not null, in employee_id integer not null) .
+create iri class northwind:Order "http://^{URIQADefaultHost}^/Northwind/Order/%d#this" (in order_id integer not null) .
+create iri class northwind:OrderDoc "http://^{URIQADefaultHost}^/Northwind/Order/%d" (in order_id integer not null) .
+create iri class northwind:CustomerContact "http://^{URIQADefaultHost}^/Northwind/CustomerContact/%U#this" (in customer_id varchar not null) .
+create iri class northwind:CustomerContactDoc "http://^{URIQADefaultHost}^/Northwind/CustomerContact/%U" (in customer_id varchar not null) .
+create iri class northwind:OrderLine "http://^{URIQADefaultHost}^/Northwind/OrderLine/%d/%d#this" (in order_id integer not null, in product_id integer not null) .
+create iri class northwind:OrderLineDoc "http://^{URIQADefaultHost}^/Northwind/OrderLine/%d/%d" (in order_id integer not null, in product_id integer not null) .
+create iri class northwind:Province "http://^{URIQADefaultHost}^/Northwind/Province/%U/%U#this" (in country_name varchar not null, in province_name varchar not null) .
+create iri class northwind:ProvinceDoc "http://^{URIQADefaultHost}^/Northwind/Province/%U/%U" (in country_name varchar not null, in province_name varchar not null) .
+create iri class northwind:Country "http://^{URIQADefaultHost}^/Northwind/Country/%U#this" (in country_name varchar not null) .
+create iri class northwind:CountryDoc "http://^{URIQADefaultHost}^/Northwind/Country/%U" (in country_name varchar not null) .
+create iri class northwind:Flag "http://^{URIQADefaultHost}^%U#this" (in flag_path varchar not null) .
+create iri class northwind:FlagDoc "http://^{URIQADefaultHost}^%U" (in flag_path varchar not null) .
+create iri class northwind:dbpedia_iri2 "http://dbpedia.org/resource/%U" (in uname varchar not null) .
+create iri class northwind:EmployeePhoto "http://^{URIQADefaultHost}^/DAV/VAD/demo/sql/EMP%d#this" (in emp_id varchar not null) .
+create iri class northwind:CategoryPhoto "http://^{URIQADefaultHost}^/DAV/VAD/demo/sql/CAT%d#this" (in category_id varchar not null) .
+create iri class northwind:Phone "tel:%s" (in phone_number varchar) .
+create iri class northwind:Fax "fax:%s" (in fax_number varchar) .
+;
+
+SPARQL
+prefix northwind: <http://demo.openlinksw.com/schemas/northwind#>
+prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
+prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+prefix sioc: <http://rdfs.org/sioc/ns#>
+prefix foaf: <http://xmlns.com/foaf/0.1/>
+prefix owl: <http://www.w3.org/2002/07/owl#>
+prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
+
+alter quad storage virtrdf:DefaultQuadStorage
+FROM Demo.demo.Products as products
+FROM Demo.demo.Suppliers as suppliers
+FROM Demo.demo.Shippers as shippers
+FROM Demo.demo.Categories as categories
+FROM Demo.demo.Customers as customers
+FROM Demo.demo.Employees as employees
+FROM Demo.demo.Orders as orders
+FROM Demo.demo.Order_Details as order_lines
+FROM Demo.demo.Countries as countries
+FROM Demo.demo.Provinces as provinces
+where (^{suppliers.}^.Country = ^{countries.}^.Name)
+where (^{customers.}^.Country = ^{countries.}^.Name)
+where (^{employees.}^.Country = ^{countries.}^.Name)
+where (^{orders.}^.ShipCountry = ^{countries.}^.Name)
+{
+        create virtrdf:NorthwindDemo as graph iri ("http://^{URIQADefaultHost}^/Northwind") option (exclusive)
+        {
+                northwind:CustomerContact (customers.CustomerID)
+                        a foaf:Person
+                                as virtrdf:CustomerContact-foaf_Person .
+
+                northwind:CustomerContact (customers.CustomerID)
+                        a northwind:CustomerContact
+                                as virtrdf:CustomerContact-CustomerContact;
+                        foaf:name customers.ContactName
+                                as virtrdf:CustomerContact-contact_name ;
+                        foaf:phone northwind:Phone (customers.Phone)
+                                as virtrdf:CustomerContact-foaf_phone ;
+                        northwind:is_contact_at northwind:Customer (customers.CustomerID)
+                                as virtrdf:CustomerContact-is_contact_at ;
+                        northwind:country northwind:Country (customers.Country)
+                                as virtrdf:CustomerContact-country ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:CustomerContactDoc (customers.CustomerID)
+                        a northwind:CustomerContactDoc
+                                as virtrdf:CustomerContactDoc-CustomerID ;
+                        a foaf:Document
+                                as virtrdf:CustomerContactDoc-foaf_DocCustomerID ;
+                        foaf:primaryTopic northwind:CustomerContact (customers.CustomerID)
+                                as virtrdf:CustomerContactDoc-foaf_primarytopic ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:Country (customers.Country)
+                        northwind:is_country_of
+                northwind:CustomerContact (customers.CustomerID) as virtrdf:CustomerContact-is_country_of .
+
+                northwind:Product (products.ProductID)
+                        a northwind:Product
+                                as virtrdf:Product-ProductID ;
+                        northwind:has_category northwind:Category (products.CategoryID)
+                                as virtrdf:Product-product_has_category ;
+                        northwind:has_supplier northwind:Supplier (products.SupplierID)
+                                as virtrdf:Product-product_has_supplier ;
+                        northwind:productName products.ProductName
+                                as virtrdf:Product-name_of_product ;
+                        northwind:quantityPerUnit products.QuantityPerUnit
+                                as virtrdf:Product-quantity_per_unit ;
+                        northwind:unitPrice products.UnitPrice
+                                as virtrdf:Product-unit_price ;
+                        northwind:unitsInStock products.UnitsInStock
+                                as virtrdf:Product-units_in_stock ;
+                        northwind:unitsOnOrder products.UnitsOnOrder
+                                as virtrdf:Product-units_on_order ;
+                        northwind:reorderLevel products.ReorderLevel
+                                as virtrdf:Product-reorder_level ;
+                        northwind:discontinued products.Discontinued
+                                as virtrdf:Product-discontinued ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:ProductDoc (products.ProductID)
+                        a northwind:ProductDoc
+                                as virtrdf:ProductDoc-ProductID ;
+                        a foaf:Document
+                                as virtrdf:ProductDoc-foaf_DocProductID ;
+                        foaf:primaryTopic northwind:Product (products.ProductID)
+                                as virtrdf:ProductDoc-foaf_primarytopic ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:Category (products.CategoryID)
+                        northwind:category_of northwind:Product (products.ProductID) as virtrdf:Product-category_of .
+
+                northwind:Supplier (products.SupplierID)
+                        northwind:supplier_of northwind:Product (products.ProductID) as virtrdf:Product-supplier_of .
+
+                northwind:Supplier (suppliers.SupplierID)
+                        a northwind:Supplier
+                                as virtrdf:Supplier-SupplierID ;
+                        northwind:companyName suppliers.CompanyName
+                                as virtrdf:Supplier-company_name ;
+                        northwind:contactName suppliers.ContactName
+                                as virtrdf:Supplier-contact_name ;
+                        northwind:contactTitle suppliers.ContactTitle
+                                as virtrdf:Supplier-contact_title ;
+                        northwind:address suppliers.Address
+                                as virtrdf:Supplier-address ;
+                        northwind:city northwind:dbpedia_iri2(suppliers.City)
+                                as virtrdf:Supplier-dbpediacity ;
+                        northwind:region suppliers.Region
+                                as virtrdf:Supplier-region ;
+                        northwind:postalCode suppliers.PostalCode
+                                as virtrdf:Supplier-postal_code ;
+                        northwind:country northwind:Country(suppliers.Country)
+                                as virtrdf:Supplier-country ;
+                        northwind:phone northwind:Phone (suppliers.Phone)
+                                as virtrdf:Supplier-phone ;
+                        northwind:fax northwind:Fax (suppliers.Fax)
+                                as virtrdf:Supplier-fax ;
+                        northwind:homePage suppliers.HomePage
+                                as virtrdf:Supplier-home_page ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:SupplierDoc (suppliers.SupplierID)
+                        a northwind:SupplierDoc
+                                as virtrdf:SupplierDoc-SupplierID ;
+                        a foaf:Document
+                                as virtrdf:SupplierDoc-foaf_DocSupplierID ;
+                        foaf:primaryTopic northwind:Supplier (suppliers.SupplierID)
+                                as virtrdf:SupplierDoc-foaf_primarytopic ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:Country (suppliers.Country)
+                        northwind:is_country_of
+                northwind:Supplier (suppliers.SupplierID) as virtrdf:Supplier-is_country_of .
+
+                northwind:Category (categories.CategoryID)
+                        a northwind:Category
+                                as virtrdf:Category-CategoryID ;
+                        northwind:categoryName categories.CategoryName
+                                as virtrdf:Category-home_page ;
+                        northwind:description categories.Description
+                                as virtrdf:Category-description ;
+                        foaf:img northwind:CategoryPhoto(categories.CategoryID)
+                                as virtrdf:Category-categories.CategoryPhoto ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:CategoryDoc (categories.CategoryID)
+                        a northwind:CategoryDoc
+                                as virtrdf:CategoryDoc-CategoryID ;
+                        a foaf:Document
+                                as virtrdf:CategoryDoc-foaf_DocCategoryID ;
+                        foaf:primaryTopic northwind:Category (categories.CategoryID)
+                                as virtrdf:CategoryDoc-foaf_primarytopic ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:CategoryPhoto(categories.CategoryID)
+                        a northwind:CategoryPhoto
+                                as virtrdf:Category-categories.CategoryPhotoID ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:Shipper (shippers.ShipperID)
+                        a northwind:Shipper
+                                as virtrdf:Shipper-ShipperID ;
+                        northwind:companyName shippers.CompanyName
+                                as virtrdf:Shipper-company_name ;
+                        northwind:phone northwind:Phone (shippers.Phone)
+                                as virtrdf:Shipper-phone ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:ShipperDoc (shippers.ShipperID)
+                        a northwind:ShipperDoc
+                                as virtrdf:ShipperDoc-ShipperID ;
+                        a foaf:Document
+                                as virtrdf:ShipperDoc-foaf_DocShipperID ;
+                        foaf:primaryTopic northwind:Shipper (shippers.ShipperID)
+                                as virtrdf:ShipperDoc-foaf_primarytopic ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:Customer (customers.CustomerID)
+                        a  northwind:Customer
+                                as virtrdf:Customer-CustomerID2 ;
+                        a  foaf:Organization
+                                as virtrdf:Customer-CustomerID ;
+                        foaf:name customers.CompanyName
+                                as virtrdf:Customer-foaf_name ;
+                        northwind:companyName customers.CompanyName
+                                as virtrdf:Customer-company_name ;
+                        northwind:has_contact northwind:CustomerContact (customers.CustomerID)
+                                as virtrdf:Customer-contact ;
+                        northwind:country northwind:Country (customers.Country)
+                                as virtrdf:Customer-country ;
+                        northwind:contactName customers.ContactName
+                                as virtrdf:Customer-contact_name ;
+                        northwind:contactTitle customers.ContactTitle
+                                as virtrdf:Customer-contact_title ;
+                        northwind:address customers.Address
+                                as virtrdf:Customer-address ;
+                        northwind:city northwind:dbpedia_iri2(customers.City)
+                                as virtrdf:Customer-dbpediacity ;
+                        northwind:region customers.Region
+                                as virtrdf:Customer-region ;
+                        northwind:PostalCode customers.PostalCode
+                                as virtrdf:Customer-postal_code ;
+                        foaf:phone northwind:Phone (customers.Phone)
+                                as virtrdf:Customer-foaf_phone ;
+                        northwind:phone northwind:Phone (customers.Phone)
+                                as virtrdf:Customer-phone ;
+                        northwind:fax northwind:Fax (customers.Fax)
+                                as virtrdf:Customer-fax ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:CustomerDoc (customers.CustomerID)
+                        a  northwind:CustomerDoc
+                                as virtrdf:CustomerDoc-CustomerID2 ;
+                        a  foaf:Document
+                                as virtrdf:CustomerDoc-CustomerID3 ;
+                        foaf:primaryTopic northwind:Customer (customers.CustomerID)
+                                as virtrdf:CustomerDoc-foaf_primarytopic ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:Country (customers.Country)
+                        northwind:is_country_of
+                northwind:Customer (customers.CustomerID) as virtrdf:Customer-is_country_of .
+
+                northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID)
+                        a northwind:Employee
+                                as virtrdf:Employee-EmployeeID2 ;
+                        a foaf:Person
+                                as virtrdf:Employee-EmployeeID ;
+                        foaf:surname employees.LastName
+                                as virtrdf:Employee-foaf_last_name ;
+                        northwind:lastName employees.LastName
+                                as virtrdf:Employee-last_name ;
+                        foaf:firstName employees.FirstName
+                                as virtrdf:Employee-foaf_first_name ;
+                        northwind:firstName employees.FirstName
+                                as virtrdf:Employee-first_name ;
+                        foaf:title employees.Title
+                                as virtrdf:Employee-title ;
+                        northwind:titleOfCourtesy employees.TitleOfCourtesy
+                                as virtrdf:Employee-title_of_courtesy ;
+                        foaf:birthday employees.BirthDate
+                                as virtrdf:Employee-foaf_birth_date ;
+                        northwind:birthday employees.BirthDate
+                                as virtrdf:Employee-birth_date ;
+                        northwind:hireDate employees.HireDate
+                                as virtrdf:Employee-hire_date ;
+                        northwind:address employees.Address
+                                as virtrdf:Employee-address ;
+                        northwind:city northwind:dbpedia_iri2(employees.City)
+                                as virtrdf:Employee-dbpediacity ;
+                        northwind:region employees.Region
+                                as virtrdf:Employee-region ;
+                        northwind:postalCode employees.PostalCode
+                                as virtrdf:Employee-postal_code ;
+                        northwind:country northwind:Country(employees.Country)
+                                as virtrdf:Employee-country ;
+                        foaf:phone employees.HomePhone
+                                as virtrdf:Employee-home_phone ;
+                        northwind:extension employees.Extension
+                                as virtrdf:Employee-extension ;
+                        northwind:notes employees.Notes
+                                as virtrdf:Employee-notes ;
+                        northwind:reportsTo northwind:Employee(employees.FirstName, employees.LastName, employees.ReportsTo) where (^{employees.}^.ReportsTo = ^{employees.}^.EmployeeID)
+                                as virtrdf:Employee-reports_to ;
+                        foaf:img northwind:EmployeePhoto(employees.EmployeeID)
+                                as virtrdf:Employee-employees.EmployeePhoto ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:EmployeeDoc (employees.FirstName, employees.LastName, employees.EmployeeID)
+                        a  northwind:EmployeeDoc
+                                as virtrdf:EmployeeDoc-EmployeeID2 ;
+                        a  foaf:Document
+                                as virtrdf:EmployeeDoc-EmployeeID3 ;
+                        foaf:primaryTopic northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID)
+                                as virtrdf:EmployeeDoc-foaf_primarytopic ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:EmployeePhoto(employees.EmployeeID)
+                        a northwind:EmployeePhoto
+                                as virtrdf:Employee-employees.EmployeePhotoId ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID)
+                        northwind:is_salesrep_of
+                northwind:Order (orders.OrderID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID) as virtrdf:Order-is_salesrep_of .
+
+                northwind:Country (employees.Country)
+                        northwind:is_country_of
+                northwind:Employee (employees.FirstName, employees.LastName, employees.EmployeeID) as virtrdf:Employee-is_country_of .
+
+                northwind:Order (orders.OrderID)
+                        a northwind:Order
+                                as virtrdf:Order-Order ;
+                        northwind:has_customer northwind:Customer (orders.CustomerID)
+                                as virtrdf:Order-order_has_customer ;
+                        northwind:has_salesrep northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID)
+                                as virtrdf:Customer-has_salesrep ;
+                        northwind:has_employee northwind:Employee (employees.FirstName, employees.LastName, orders.EmployeeID) where (^{orders.}^.EmployeeID = ^{employees.}^.EmployeeID)
+                                as virtrdf:Order-order_has_employee ;
+                        northwind:orderDate orders.OrderDate
+                                as virtrdf:Order-order_date ;
+                        northwind:requiredDate orders.RequiredDate
+                                as virtrdf:Order-required_date ;
+                        northwind:shippedDate orders.ShippedDate
+                                as virtrdf:Order-shipped_date ;
+                        northwind:order_ship_via northwind:Shipper (orders.ShipVia)
+                                as virtrdf:Order-order_ship_via ;
+                        northwind:freight orders.Freight
+                                as virtrdf:Order-freight ;
+                        northwind:shipName orders.ShipName
+                                as virtrdf:Order-ship_name ;
+                        northwind:shipAddress orders.ShipAddress
+                                as virtrdf:Order-ship_address ;
+                        northwind:shipCity northwind:dbpedia_iri2(orders.ShipCity)
+                                as virtrdf:Order-dbpediaship_city ;
+                        northwind:shipRegion orders.ShipRegion
+                                as virtrdf:Order-ship_region ;
+                        northwind:shipPostal_code orders.ShipPostalCode
+                                as virtrdf:Order-ship_postal_code ;
+                        northwind:shipCountry northwind:Country(orders.ShipCountry)
+                                as virtrdf:ship_country ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:OrderDoc (orders.OrderID)
+                        a  northwind:OrderDoc
+                                as virtrdf:OrderDoc-OrderID2 ;
+                        a  foaf:Document
+                                as virtrdf:OrderDoc-OrderID3 ;
+                        foaf:primaryTopic northwind:Order (orders.OrderID)
+                                as virtrdf:OrderDoc-foaf_primarytopic ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:Country (orders.ShipCountry)
+                        northwind:is_ship_country_of
+                northwind:Order (orders.OrderID) as virtrdf:Order-is_country_of .
+
+                northwind:Customer (orders.CustomerID)
+                        northwind:has_order northwind:Order (orders.OrderID) as virtrdf:Order-has_order .
+
+                northwind:Shipper (orders.ShipVia)
+                        northwind:ship_order northwind:Order (orders.OrderID) as virtrdf:Order-ship_order .
+
+                northwind:OrderLine (order_lines.OrderID, order_lines.ProductID)
+                        a northwind:OrderLine
+                                as virtrdf:OrderLine-OrderLines ;
+                        northwind:has_order_id northwind:Order (order_lines.OrderID)
+                                as virtrdf:order_lines_has_order_id ;
+                        northwind:has_product_id northwind:Product (order_lines.ProductID)
+                                as virtrdf:order_lines_has_product_id ;
+                        northwind:unitPrice order_lines.UnitPrice
+                                as virtrdf:OrderLine-unit_price ;
+                        northwind:quantity order_lines.Quantity
+                                as virtrdf:OrderLine-quantity ;
+                        northwind:discount order_lines.Discount
+                                as virtrdf:OrderLine-discount ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:OrderLineDoc (order_lines.OrderID, order_lines.ProductID)
+                        a  northwind:OrderLineDoc
+                                as virtrdf:OrderLineDoc-OrderLineID2 ;
+                        a  foaf:Document
+                                as virtrdf:OrderLineDoc-OrderLineID3 ;
+                        foaf:primaryTopic northwind:OrderLine (order_lines.OrderID, order_lines.ProductID)
+                                as virtrdf:OrderLineDoc-foaf_primarytopic ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:Order (orders.OrderID)
+                        northwind:is_order_of
+                northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) where (^{orders.}^.OrderID = ^{order_lines.}^.OrderID) as virtrdf:Order-is_order_of .
+
+                northwind:Product (products.ProductID)
+                        northwind:is_product_of
+                northwind:OrderLine (order_lines.OrderID, order_lines.ProductID) where (^{products.}^.ProductID = ^{order_lines.}^.ProductID) as virtrdf:Product-is_product_of .
+
+                northwind:Country (countries.Name)
+                        a northwind:Country
+                                as virtrdf:Country-Type2 ;
+                        a wgs:SpatialThing
+                                as virtrdf:Country-Type ;
+                        owl:sameAs northwind:dbpedia_iri2 (countries.Name) ;
+                        northwind:name countries.Name
+                                as virtrdf:Country-Name ;
+                        northwind:code countries.Code
+                                as virtrdf:Country-Code ;
+                        northwind:smallFlagDAVResourceName countries.SmallFlagDAVResourceName
+                                as virtrdf:Country-SmallFlagDAVResourceName ;
+                        northwind:largeFlagDAVResourceName countries.LargeFlagDAVResourceName
+                                as virtrdf:Country-LargeFlagDAVResourceName ;
+                        northwind:smallFlagDAVResourceURI northwind:Flag(countries.SmallFlagDAVResourceURI)
+                                as virtrdf:Country-SmallFlagDAVResourceURI ;
+                        northwind:largeFlagDAVResourceURI northwind:Flag(countries.LargeFlagDAVResourceURI)
+                                as virtrdf:Country-LargeFlagDAVResourceURI ;
+                        wgs:lat countries.Lat
+                                as virtrdf:Country-Lat ;
+                        wgs:long countries.Lng
+                                as virtrdf:Country-Lng ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:CountryDoc (countries.Name)
+                        a  northwind:CountryDoc
+                                as virtrdf:CountryDoc-CountryID2 ;
+                        a  foaf:Document
+                                as virtrdf:CountryDoc-CountryID3 ;
+                        foaf:primaryTopic northwind:Country (countries.Name)
+                                as virtrdf:CountryDoc-foaf_primarytopic ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:Country (countries.Name)
+                        northwind:has_province
+                northwind:Province (provinces.CountryCode, provinces.Province) where (^{provinces.}^.CountryCode = ^{countries.}^.Code) as virtrdf:Country-has_province .
+
+                northwind:Province (provinces.CountryCode, provinces.Province)
+                        a northwind:Province
+                                as virtrdf:Province-Provinces ;
+                        owl:sameAs northwind:dbpedia_iri2 (provinces.Province) ;
+                        northwind:has_country_code provinces.CountryCode
+                                as virtrdf:has_country_code ;
+                        northwind:provinceName provinces.Province
+                                as virtrdf:Province-ProvinceName ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:ProvinceDoc (provinces.CountryCode, provinces.Province)
+                        a  northwind:ProvinceDoc
+                                as virtrdf:ProvinceDoc-ProvinceID2 ;
+                        a  foaf:Document
+                                as virtrdf:ProvinceDoc-ProvinceID3 ;
+                        foaf:primaryTopic northwind:Province (provinces.CountryCode, provinces.Province)
+                                as virtrdf:ProvinceDoc-foaf_primarytopic ;
+                        rdfs:isDefinedBy northwind: .
+
+                northwind:Province (provinces.CountryCode, provinces.Province)
+                        northwind:is_province_of
+                northwind:Country (countries.Name) where  (^{countries.}^.Code = ^{provinces.}^.CountryCode) as virtrdf:Province-country_of .
+        }.
+}.
+;
+
+delete FROM DB.DBA.URL_REWRITE_RULE_LIST where urrl_list like 'demo_nw%';
+delete FROM DB.DBA.URL_REWRITE_RULE where urr_rule like 'demo_nw%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'demo_nw_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/Northwind%%3E&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'demo_nw_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'demo_nw_rule_list1',
+    1,
+    vector (
+                'demo_nw_rule1',
+                'demo_nw_rule2'
+          ));
+
+
+VHOST_REMOVE (lpath=>'/Northwind');
+DB.DBA.VHOST_DEFINE (lpath=>'/Northwind', ppath=>'/DAV/home/demo/', vsp_user=>'dba', is_dav=>1,
+          is_brws=>0, opts=>vector ('url_rewrite', 'demo_nw_rule_list1'));
+
+create procedure DB.DBA.LOAD_NW_ONTOLOGY_FROM_DAV()
+{
+  declare content1, urihost varchar;
+  SELECT cast (RES_CONTENT as varchar) into content1 FROM WS.WS.SYS_DAV_RES where RES_FULL_PATH = '/DAV/VAD/demo/sql/nw.owl';
+  DB.DBA.RDF_LOAD_RDFXML (content1, 'http://demo.openlinksw.com/schemas/northwind#', 'http://demo.openlinksw.com/schemas/NorthwindOntology/1.0/');
+  urihost := cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost');
+  if (urihost = 'demo.openlinksw.com')
+  {
+    DB.DBA.VHOST_REMOVE (lpath=>'/schemas/northwind');
+    DB.DBA.VHOST_DEFINE (lpath=>'/schemas/northwind', ppath=>'/DAV/VAD/demo/sql/nw.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
+    DB.DBA.VHOST_REMOVE (lpath=>'/schemas/northwind#');
+    DB.DBA.VHOST_DEFINE (lpath=>'/schemas/northwind#', ppath=>'/DAV/VAD/demo/sql/nw.owl', vsp_user=>'dba', is_dav=>1, is_brws=>0);
+  }
+};
+
+DB.DBA.LOAD_NW_ONTOLOGY_FROM_DAV();
+drop procedure DB.DBA.LOAD_NW_ONTOLOGY_FROM_DAV;
+
+DB.DBA.XML_SET_NS_DECL ('northwind', 'http://demo.openlinksw.com/schemas/northwind#', 2);
+]]></programlisting>
+    <para><emphasis>Basic Northwind Ontology</emphasis></para>
+<programlisting><![CDATA[
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ -
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2007 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+-->
+<rdf:RDF xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+         xmlns:owl ="http://www.w3.org/2002/07/owl#"
+         xmlns:virtrdf="http://www.openlinksw.com/schemas/virtrdf#"
+         xml:base="http://demo.openlinksw.com/schemas/northwind#">
+  <owl:Ontology rdf:about="http://demo.openlinksw.com/schemas/northwind#">
+        <rdfs:label>Northwind</rdfs:label>
+        <rdfs:comment>Northwind database classes and properties</rdfs:comment>
+        <virtrdf:catName>Northwind</virtrdf:catName>
+        <virtrdf:version>1.00</virtrdf:version>
+  </owl:Ontology>
+
+  <rdfs:Class rdf:ID="Product">
+    <rdfs:label>Product</rdfs:label>
+  </rdfs:Class>
+  <rdf:Property rdf:ID="has_category">
+    <rdfs:range rdf:resource="#Category"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Category</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="has_supplier">
+    <rdfs:range rdf:resource="#Supplier"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Supplier</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ProductName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ProductName</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="QuantityPerUnit">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>QuantityPerUnit</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="UnitPrice">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#double"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:domain rdf:resource="#OrderLine"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>UnitPrice</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="UnitsInStock">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>UnitsInStock</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="UnitsOnOrder">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>UnitsOnOrder</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ReorderLevel">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ReorderLevel</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Discontinued">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
+    <rdfs:domain rdf:resource="#Product"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Discontinued</rdfs:label>
+  </rdf:Property>
+
+  <rdfs:Class rdf:ID="Supplier">
+    <rdfs:label>Supplier</rdfs:label>
+  </rdfs:Class>
+  <rdf:Property rdf:ID="CompanyName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:domain rdf:resource="#Supplier"/>
+    <rdfs:domain rdf:resource="#Shipper"/>
+    <rdfs:domain rdf:resource="#Customer"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>CompanyName</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ContactName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/name"/>
+    <rdfs:domain rdf:resource="#Supplier"/>
+    <rdfs:domain rdf:resource="#Customer"/>
+    <rdfs:domain rdf:resource="#CustomerContact"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ContactName</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ContactTitle">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/title"/>
+    <rdfs:domain rdf:resource="#Supplier"/>
+    <rdfs:domain rdf:resource="#Customer"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ContactTitle</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Address">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Supplier"/>
+    <rdfs:domain rdf:resource="#Customer"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Address</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="City">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Supplier"/>
+    <rdfs:domain rdf:resource="#Customer"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>City</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Region">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Supplier"/>
+    <rdfs:domain rdf:resource="#Customer"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Region</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="PostalCode">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Supplier"/>
+    <rdfs:domain rdf:resource="#Customer"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>PostalCode</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="CountryName">
+    <rdfs:range rdf:resource="#Country"/>
+    <rdfs:domain rdf:resource="#Supplier"/>
+    <rdfs:domain rdf:resource="#Customer"/>
+    <rdfs:domain rdf:resource="#CustomerContact"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Country</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Phone">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/phone"/>
+    <rdfs:domain rdf:resource="#Supplier"/>
+    <rdfs:domain rdf:resource="#Shipper"/>
+    <rdfs:domain rdf:resource="#Customer"/>
+    <rdfs:domain rdf:resource="#CustomerContact"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Phone</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Fax">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Supplier"/>
+    <rdfs:domain rdf:resource="#Customer"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Fax</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="HomePage">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Supplier"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>HomePage</rdfs:label>
+  </rdf:Property>
+
+  <rdfs:Class rdf:ID="Category">
+    <rdfs:label>Category</rdfs:label>
+  </rdfs:Class>
+  <rdf:Property rdf:ID="CategoryName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Category"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>CategoryName</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Description">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Category"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Description</rdfs:label>
+  </rdf:Property>
+
+  <rdfs:Class rdf:ID="Shipper">
+    <rdfs:label>Shipper</rdfs:label>
+  </rdfs:Class>
+
+  <rdfs:Class rdf:ID="CustomerContact">
+    <rdfs:label>CustomerContact</rdfs:label>
+    <rdfs:subClassOf rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
+  </rdfs:Class>
+
+  <rdfs:Class rdf:ID="Customer">
+    <rdfs:label>Customer</rdfs:label>
+    <rdfs:subClassOf rdf:resource="http://xmlns.com/foaf/0.1/Organization"/>
+  </rdfs:Class>
+
+  <rdfs:Class rdf:ID="Employee">
+    <rdfs:label>Employee</rdfs:label>
+    <rdfs:subClassOf rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
+  </rdfs:Class>
+  <rdf:Property rdf:ID="LastName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/surname"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>LastName</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="FirstName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/firstName"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>FirstName</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Title">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/title"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Title</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="TitleOfCourtesy">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>TitleOfCourtesy</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="BirthDate">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/birthday"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>BirthDate</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="HireDate">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>HireDate</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Extension">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Extension</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Notes">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Notes</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ReportsTo">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
+    <rdfs:domain rdf:resource="#Employee"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ReportsTo</rdfs:label>
+  </rdf:Property>
+
+  <rdfs:Class rdf:ID="Order">
+    <rdfs:label>Order</rdfs:label>
+  </rdfs:Class>
+  <rdf:Property rdf:ID="has_customer">
+    <rdfs:range rdf:resource="#Customer"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Customer</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="has_employee">
+    <rdfs:range rdf:resource="#Employee"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Employee</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="OrderDate">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>OrderDate</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="RequiredDate">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>RequiredDate</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ShippedDate">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ShippedDate</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="order_ship_via">
+    <rdfs:range rdf:resource="#Shipper"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Shipper</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Freight">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#double"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Freight</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ShipName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ShipName</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ShipAddress">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ShipAddress</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ShipCity">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ShipCity</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ShipRegion">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ShipRegion</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ShipPostalCode">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ShipPostalCode</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ShipCountry">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Order"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ShipCountry</rdfs:label>
+  </rdf:Property>
+
+  <rdfs:Class rdf:ID="OrderLine">
+    <rdfs:label>OrderLine</rdfs:label>
+  </rdfs:Class>
+  <rdf:Property rdf:ID="has_order_id">
+    <rdfs:range rdf:resource="#Order"/>
+    <rdfs:domain rdf:resource="#OrderLine"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Order</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="has_product_id">
+    <rdfs:range rdf:resource="#Product"/>
+    <rdfs:domain rdf:resource="#OrderLine"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Product</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Quantity">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
+    <rdfs:domain rdf:resource="#OrderLine"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Quantity</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Discount">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#double"/>
+    <rdfs:domain rdf:resource="#OrderLine"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Discount</rdfs:label>
+  </rdf:Property>
+
+  <rdfs:Class rdf:ID="Country">
+    <rdfs:label>Country</rdfs:label>
+    <rdfs:subClassOf rdf:resource="http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing"/>
+  </rdfs:Class>
+  <rdf:Property rdf:ID="Name">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Country"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Name</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Code">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Country"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Code</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="SmallFlagDAVResourceName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Country"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>SmallFlagDAVResourceName</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="LargeFlagDAVResourceName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Country"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>LargeFlagDAVResourceName</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="SmallFlagDAVResourceURI">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Country"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>SmallFlagDAVResourceURI</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="LargeFlagDAVResourceURI">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Country"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>LargeFlagDAVResourceURI</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Lat">
+    <rdfs:range rdf:resource="ttp://www.w3.org/2003/01/geo/wgs84_pos#lat"/>
+    <rdfs:domain rdf:resource="#Country"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Lat</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="Lng">
+    <rdfs:range rdf:resource="ttp://www.w3.org/2003/01/geo/wgs84_pos#lng"/>
+    <rdfs:domain rdf:resource="#Country"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Lng</rdfs:label>
+  </rdf:Property>
+
+  <rdfs:Class rdf:ID="Province">
+    <rdfs:label>Province</rdfs:label>
+  </rdfs:Class>
+  <rdf:Property rdf:ID="has_country_code">
+    <rdfs:range rdf:resource="#Country"/>
+    <rdfs:domain rdf:resource="#Provinces"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>Country Code</rdfs:label>
+  </rdf:Property>
+  <rdf:Property rdf:ID="ProvinceName">
+    <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
+    <rdfs:domain rdf:resource="#Province"/>
+    <rdfs:cardinality>1</rdfs:cardinality>
+    <rdfs:label>ProvinceName</rdfs:label>
+  </rdf:Property>
+
+</rdf:RDF>
+]]></programlisting>
+    </sect2>
+    <sect2 id="rdfviewsenterohr">
+      <title>Oracle Demonstration 'HR' Database </title>
+<para><emphasis>Live links to a sample instance</emphasis></para>
+<itemizedlist mark="bullet">
+<listitem><ulink url="http://demo.openlinksw.com/sparql?default-graph-uri=&should-sponge=&query=%20prefix%20hr%3A%20%3Chttp%3A%2F%2Fdemo.openlinksw.com%2Fschemas%2Foraclehr%2F%3E%20select%20*%20from%20%3Chttp%3A%2F%2Fdemo.openlinksw.com%2Foraclehr%3E%20WHERE%20%7B%3Fs%20a%20hr%3Aemployees%7D&format=text%2Fhtml&debug=on">list all employee URIs</ulink></listitem>
+<listitem><ulink url="http://demo.openlinksw.com/about/html/http/demo.openlinksw.com/oraclehr/employees/105">description of employee 105</ulink></listitem>
+</itemizedlist>
+<para><emphasis>Script to set up your own instance</emphasis></para>
+<programlisting><![CDATA[
+-- Setup script for RDF views of Oracle 10 Human Resources Sample Database --
+
+GRANT SELECT ON HR.orama.COUNTRIES TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON HR.orama.REGIONS TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON HR.orama.DEPARTMENTS TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON HR.orama.LOCATIONS TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON HR.orama.EMPLOYEES TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON HR.orama.JOBS TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON HR.orama.JOB_HISTORY TO "SPARQL", "SPARQL_UPDATE";
+
+-------------------------------------------------------------------
+
+-------- Create rdfs:Class definitions ----------------------------
+
+ttlp (
+'
+ at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+ at prefix hr: <http://localhost:8890/schemas/oraclehr/> .
+
+hr:countries a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "COUNTRIES" ;
+	rdfs:comment "Oracle HR COUNTRIES table" .
+
+hr:country_id a rdf:Property ;
+	rdfs:domain hr:countries ;
+	rdfs:range xsd:string ;
+	rdfs:label "COUNTRY ID" .
+
+hr:country_name a rdf:Property ;
+	rdfs:domain hr:countries ;
+	rdfs:range xsd:string ;
+	rdfs:label "COUNTRY NAME" .
+
+hr:region_id a rdf:Property ;
+	rdfs:domain hr:countries ;
+	rdfs:range hr:regions ;
+	rdfs:label "REGION ID" .
+
+hr:regions a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "REGIONS" ;
+	rdfs:comment "Oracle HR REGIONS table" .
+
+hr:region_id a rdf:Property ;
+	rdfs:domain hr:regions ;
+	rdfs:range xsd:integer ;
+        rdfs:label "REGION ID" .
+
+hr:region_name a rdf:Property ;
+	rdfs:domain hr:regions ;
+	rdfs:range xsd:string ;
+	rdfs:label "REGION NAME" .
+
+hr:departments a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "DEPARTMENTS" ;
+	rdfs:comment "Oracle HR DEPARTMENT table" .
+
+hr:department_id a rdf:Property ;
+	rdfs:domain hr:departments ;
+	rdfs:range xsd:integer ;
+	rdfs:label "DEPARTMENT ID" .
+
+hr:department_name a rdf:Property ;
+   	rdfs:domain hr:departments ;
+	rdfs:range xsd:string ;
+	rdfs:comment "DEPARTMENT NAME" .
+
+hr:manager_id a rdf:Property ;
+ 	rdfs:domain hr:departments ;
+	rdfs:range hr:employees ;
+	rdfs:comment "MANAGER ID" .
+
+hr:location_id a rdf:Property ;
+	rdfs:domain hr:departments ;
+	rdfs:range hr:locations ;
+	rdfs:comment "LOCATION ID" .
+
+hr:employees a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "employees" ;
+	rdfs:comment "Oracle HR EMPLOYEES table" .
+
+hr:employee_id a rdf:Property ;
+	rdfs:domain hr:employees;
+	rdfs:range xsd:integer ;
+	rdfs:label "EMPLOYEE ID" .
+
+hr:first_name a rdf:Property ;
+	rdfs:domain hr:employees;
+	rdfs:range xsd:string ;
+	rdfs:label "FIRST NAME" .
+
+hr:last_name a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range xsd:string ;
+	rdfs:label "LAST NAME" .
+
+hr:email a rdf:Property ;
+	rdfs:domain hr:employees;
+	rdfs:range xsd:string ;
+	rdfs:label "EMAIL" .
+
+hr:phone_number a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range xsd:string ;
+	rdfs:label "PHONE NUMBER" .
+
+hr:hire_date a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range xsd:date ;
+	rdfs:label "HIRE DATE" .
+
+hr:job_id a rdf:Property ;
+	rdfs:domain hr:employees;
+	rdfs:range hr:jobs ;
+	rdfs:label "JOB ID" .
+
+hr:salary a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range xsd:integer ;
+	rdfs:label "SALARY" .
+
+hr:commission_pct a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range xsd:integer ;
+	rdfs:label "COMMISSION PCT" .
+
+hr:manager_id a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range xsd:string ;
+	rdfs:label "MANAGER ID" .
+
+hr:department_id a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range hr:departments ;
+	rdfs:label "DEPARTMENT ID" .
+
+hr:jobs a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "JOBS" ;
+	rdfs:comment "Oracle HR JOBS table" .
+
+hr:job_id a rdf:Property ;
+
+	rdfs:domain hr:jobs ;
+	rdfs:range xsd:string ;
+	rdfs:label "JOB ID" .
+
+hr:job_title a rdf:Property ;
+	rdfs:domain hr:jobs ;
+	rdfs:range xsd:string ;
+	rdfs:label "JOB TITLE" .
+
+hr:min_salary a rdf:Property ;
+	rdfs:domain hr:jobs ;
+	rdfs:range xsd:number;
+	rdfs:label "MIN SALARY" .
+
+hr:max_salary a rdf:Property ;
+	rdfs:domain hr:jobs ;
+	rdfs:range xsd:number;
+	rdfs:label "MAXSALARY" .
+
+hr:job_history a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "JOB HISTORY" ;
+	rdfs:comment "Oracle HR JOB HISTORY table" .
+
+hr:employee_id a rdf:Property ;
+	rdfs:domain hr:job_history ;
+	rdfs:range hr:employees ;
+	rdfs:label "EMPLOYEE ID" .
+
+hr:start_date a rdf:Property ;
+	rdfs:domain hr:job_history ;
+	rdfs:range xsd:date ;
+	rdfs:label "START DATE" .
+
+hr:end_date a rdf:Property ;
+	rdfs:domain hr:job_history ;
+	rdfs:range xsd:date ;
+	rdfs:label "END DATE" .
+
+hr:job_id a rdf:Property ;
+	rdfs:domain hr:job_history ;
+	rdfs:range hr:jobs ;
+	rdfs:label "JOB ID" .
+
+hr:department_id a rdf:Property ;
+	rdfs:domain hr:job_history ;
+	rdfs:range hr:departments ;
+	rdfs:label "DEPARTMENT ID" .
+
+hr:locations a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "LOCATIONS" ;
+	rdfs:comment "Oracle HR JOB LOCATIONS table" .
+
+hr:location_id a rdf:Property ;
+	rdfs:domain hr:locations ;
+	rdfs:range xsd:number ;
+	rdfs:label "LOCATION ID" .
+
+hr:street_address a rdf:Property ;
+	rdfs:domain hr:locations ;
+	rdfs:range xsd:string ;
+	rdfs:label "STREET ADDRESS" .
+
+hr:postal_code a rdf:Property ;
+	rdfs:domain hr:locations ;
+	rdfs:range xsd:string ;
+	rdfs:label "POSTAL CODE" .
+
+hr:city a rdf:Property ;
+	rdfs:domain hr:locations ;
+	rdfs:range xsd:string ;
+	rdfs:label "CITY" .
+
+hr:state_province a rdf:Property ;
+	rdfs:domain hr:locations ;
+	rdfs:range xsd:string ;
+	rdfs:label "STATE PROVINCE" .
+
+hr:country_id a rdf:Property ;
+	rdfs:domain hr:locations ;
+	rdfs:range hr:countries ;
+	rdfs:label "COUNTRY" .
+', '', 'http://localhost:8890/schemas/oraclehr', 0);
+
+---------------------------------------------------------------
+
+----------- Create IRI Classes -------------
+
+create function DB.DBA.JOB_HISTORY (in EMPLOYEE_ID integer, in
+START_DATE date) returns varchar
+{
+  return sprintf_or_null
+('http://localhost:8890/oraclehr/job_history/%d_%s#this',
+  EMPLOYEE_ID, cast (START_DATE as varchar) );
+}
+;
+
+create function DB.DBA.JOB_HISTORY_INV_1 (in id varchar) returns integer
+{
+  return sprintf_inverse (id,
+'http://localhost:8890/oraclehr/job_history/%d_%s#this',
+2)[0];
+}
+;
+
+create function DB.DBA.JOB_HISTORY_INV_2 (in id varchar) returns date
+{
+  declare exit handler for sqlstate '*' { return NULL; };
+  return cast (sprintf_inverse (id,
+'http://localhost:8890/oraclehr/job_history/%d_%s#this',
+2)[1] as date);
+}
+;
+
+
+GRANT EXECUTE ON DB.DBA.JOB_HISTORY TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON DB.DBA.JOB_HISTORY_URI_INV_1 TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON DB.DBA.JOB_HISTORY_URI_INV_2 TO "SPARQL", "SPARQL_UPDATE";
+
+SPARQL
+
+
+	create iri class <http://localhost:8890/schemas/oraclehr/countries_iri>
+	"http://^{URIQADefaultHost}^/oraclehr/countries/%s#this"
+    	(in COUNTRY_ID varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/oraclehr/regions_iri>
+	"http://^{URIQADefaultHost}^/oraclehr/regions/%d#this"
+	    (in REGION_ID integer not null) .
+
+	create iri class <http://localhost:8890/schemas/oraclehr/departments_iri>
+	"http://^{URIQADefaultHost}^/oraclehr/departments/%d#this"
+	    (in DEPARTMENT_ID integer not null) .
+
+	create iri class <http://localhost:8890/schemas/oraclehr/employees_iri>
+	"http://^{URIQADefaultHost}^/oraclehr/employees/%d#this"
+		(in EMPLOYEE_ID integer not null) .
+
+	create iri class <http://localhost:8890/schemas/oraclehr/jobs_iri>
+	"http://^{URIQADefaultHost}^/oraclehr/jobs/%s#this"
+	    (in JOB_ID varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/oraclehr/job_history_iri>
+		using function DB.DBA.JOB_HISTORY (in EMPLOYEE_ID integer not null, in
+		START_DATE date not null) returns varchar not null,
+		function DB.DBA.JOB_HISTORY_INV_1 (in id varchar) returns integer,
+		function DB.DBA.JOB_HISTORY_INV_2 (in id varchar) returns date
+		option (bijection, returns
+		"http://localhost:8890/oraclehr/job_history/%d_%s#this") .
+
+	create iri class <http://localhost:8890/schemas/oraclehr/locations_iri>
+	"http://^{URIQADefaultHost}^/oraclehr/locations/%d#this"
+	    (in LOCATION_ID integer not null) .
+;
+
+--------------------------------------------------------------------
+
+------------- Create Quad Store ------------------------------------
+
+SPARQL
+
+prefix hr: <http://localhost:8890/schemas/oraclehr/>
+
+alter quad storage virtrdf:DefaultQuadStorage
+  FROM HR.orama.COUNTRIES as countries_tbl
+  FROM HR.orama.REGIONS as regions_tbl
+  FROM HR.orama.DEPARTMENTS as departments_tbl
+  FROM HR.orama.EMPLOYEES as employees_tbl
+  FROM HR.orama.EMPLOYEES as employees_tbl_1		### alias required to represent recursive FK relationship (hr: has_manager ) below.
+  FROM HR.orama.JOBS as jobs_tbl
+  FROM HR.orama.JOB_HISTORY as job_history_tbl
+  FROM HR.orama.LOCATIONS as locations_tbl
+{
+  create virtrdf:oraclehr as
+      graph <http://localhost:8890/oraclehr>
+  {
+        hr:countries_iri(countries_tbl.COUNTRY_ID) a hr:countries  as virtrdf:countires_country_id ;
+        hr:country_name countries_tbl.COUNTRY_NAME  as virtrdf:countries_country_name ;
+        hr:region_id hr:regions_iri(regions_tbl.REGION_ID) where (^{countries_tbl.}^.REGION_ID = ^{regions_tbl.}^.REGION_ID)  as virtrdf:countries_region_id .
+
+	hr:regions_iri(regions_tbl.REGION_ID) a hr:regions as virtrdf:regions_region_id ;
+	hr:region_name regions_tbl.REGION_NAME  as virtrdf:regions_region_name .
+
+	hr:departments_iri(departments_tbl.DEPARTMENT_ID) a hr:departments as virtrdf:departments_department_id ;
+	hr:department_name departments_tbl.DEPARTMENT_NAME as virtrdf:departments_department_name ;
+	hr:location_id hr:locations_iri(locations_tbl.LOCATION_ID) where (^{departments_tbl.}^.LOCATION_ID = ^{locations_tbl.}^.LOCATION_ID) as virtrdf:departments_location_id ;
+	hr:manager_id hr:employees_iri(employees_tbl.EMPLOYEE_ID) where (^{departments_tbl.}^.MANAGER_ID = ^{employees_tbl.}^.EMPLOYEE_ID) as virtrdf:departments_manager_id .
+
+	hr:employees_iri(employees_tbl.EMPLOYEE_ID) a hr:employees as virtrdf:employees_employee_id ;
+	hr:department_id hr:departments_iri(departments_tbl.DEPARTMENT_ID) where (^{employees_tbl.}^.DEPARTMENT_ID = ^{departments_tbl.}^.DEPARTMENT_ID) as virtrdf:employees_department_id ;
+	hr:job_id hr:jobs_iri(jobs_tbl.JOB_ID) where (^{employees_tbl.}^.JOB_ID = ^{jobs_tbl.}^.JOB_ID) as virtrdf:employees_job_id ;
+	hr:manager_id employees_tbl.MANAGER_ID as virtrdf:employees_manager_id ;
+	hr:commissin_pct employees_tbl.COMMISSION_PCT as virtrdf:employees_commission_pct ;
+	hr:email employees_tbl.EMAIL as virtrdf:employees_email ;
+	hr:first_name employees_tbl.FIRST_NAME as virtrdf:employees_first_name ;
+	hr:hire_date employees_tbl.HIRE_DATE as virtrdf:employees_hire_date ;
+	hr:last_name employees_tbl.LAST_NAME as virtrdf:employees_last_name ;
+	hr:phone_number employees_tbl.PHONE_NUMBER as virtrdf:employees_phone_number ;
+	hr:salary employees_tbl.SALARY as virtrdf:employees_salary ;
+	hr:has_job_history hr:job_history_iri(job_history_tbl.EMPLOYEE_ID, job_history_tbl.START_DATE) where (^{employees_tbl.}^.EMPLOYEE_ID = ^{job_history_tbl.}^.EMPLOYEE_ID) as virtrdf:employees_has_job_history;
+	hr:has_manager hr:employees_iri(employees_tbl_1.EMPLOYEE_ID) where (^{employees_tbl.}^.MANAGER_ID = ^{employees_tbl_1.}^.EMPLOYEE_ID) as virtrdf:employees_has_manager.
+
+	hr:locations_iri(locations_tbl.LOCATION_ID) a hr:locations as virtrdf:locations_location_id ;
+	hr:country_id hr:countries_iri(countries_tbl.COUNTRY_ID) where (^{locations_tbl.}^.COUNTRY_ID = ^{countries_tbl.}^.COUNTRY_ID) as virtrdf:locations_country_id ;
+	hr:city locations_tbl.CITY as virtrdf:locations_city ;
+	hr:postal_code locations_tbl.POSTAL_CODE as virtrdf:locations_postal_code ;
+	hr:state_province locations_tbl.STATE_PROVINCE as virtrdf:locations_state_province ;
+	hr:street_address locations_tbl.STREET_ADDRESS as virtrdf:locations_street_address .
+
+	hr:jobs_iri(jobs_tbl.JOB_ID) a hr:jobs as virtrdf:jobs_job_id ;
+	hr:job_title jobs_tbl.JOB_TITLE as virtrdf:jobs_job_title ;
+	hr:max_salary jobs_tbl.MAX_SALARY as virtrdf:jobs_max_salary ;
+	hr:min_salary jobs_tbl.MIN_SALARY as virtrdf:jobs_min_salary .
+
+	hr:job_history_iri(job_history_tbl.EMPLOYEE_ID, job_history_tbl.START_DATE) a hr:job_history as virtrdf:job_history_pk ;
+	hr:employee_id hr:employees_iri(employees_tbl.EMPLOYEE_ID) where (^{job_history_tbl.}^.EMPLOYEE_ID = ^{employees_tbl.}^.EMPLOYEE_ID) as virtrdf:job_history_employee_id ;
+	hr:department_id hr:departments_iri(departments_tbl.DEPARTMENT_ID) where (^{job_history_tbl.}^.DEPARTMENT_ID = ^{departments_tbl.}^.DEPARTMENT_ID) as virtrdf:job_history_department_id ;
+	hr:job_id hr:jobs_iri(jobs_tbl.JOB_ID) where (^{job_history_tbl.}^.JOB_ID = ^{jobs_tbl.}^.JOB_ID) as virtrdf:job_history_job_id ;
+	hr:start_date job_history_tbl.START_DATE as virtrdf:job_history_start_date ;
+	hr:end_date job_history_tbl.END_DATE as virtrdf:job_history_end_date .
+
+  } .
+} .
+;
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'oraclehr_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'oraclehr_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'oraclehr_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'oraclehr_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/oraclehr%%3E&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'oraclehr_rule_list1',
+    1,
+    vector (
+  	 	'oraclehr_rule1',
+  	 	'oraclehr_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/oraclehr');
+
+VHOST_DEFINE (
+	lpath=>'/oraclehr',
+	ppath=>'/DAV/oraclehr/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'oraclehr_rule_list1')
+	);
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'oracle_schemas_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'oracle_schemas_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'oracle_schemas_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'oracle_schemas_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/oraclehr%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path','path','*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'oracle_schemas_rule_list1',
+    1,
+    vector (
+  	 	'oracle_schemas_rule1',
+  	 	'oracle_schemas_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/schema/oraclehr');
+
+VHOST_DEFINE (
+	lpath=>'/schemas/oraclehr',
+	ppath=>'/DAV/schemas/oraclehr/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'oracle_schemas_rule_list1')
+	);
+
+DB.DBA.XML_SET_NS_DECL ('hr', 'http://^{URIQADefaultHost}^/schemas/oraclehr/', 2);
+]]></programlisting>
+    </sect2>
+    <sect2 id="rdfviewsenterprohd">
+      <title>Oracle using the demonstration 'Human Resources' database</title>
+<para><emphasis>Live links to a sample instance</emphasis></para>
+<itemizedlist mark="bullet">
+<listitem><ulink url="http://demo.openlinksw.com/sparql?default-graph-uri=&should-sponge=&query=%20prefix%20hr%3A%20%3Chttp%3A%2F%2Fdemo.openlinksw.com%2Fschemas%2Foraclehr%2F%3E%20select%20*%20from%20%3Chttp%3A%2F%2Fdemo.openlinksw.com%2Foraclehr%3E%20WHERE%20%7B%3Fs%20a%20hr%3Aemployees%7D&format=text%2Fhtml&debug=on">list all employee URIs</ulink></listitem>
+<listitem><ulink url="http://demo.openlinksw.com/about/html/http/demo.openlinksw.com/oraclehr/employees/105">description of employee 105</ulink></listitem>
+</itemizedlist>
+<para><emphasis>Script to set up your own instance</emphasis></para>
+<programlisting><![CDATA[
+-- Setup script for RDF views of Oracle 10 Human Resources Sample Database --
+
+GRANT SELECT ON HR.orama.COUNTRIES TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON HR.orama.REGIONS TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON HR.orama.DEPARTMENTS TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON HR.orama.LOCATIONS TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON HR.orama.EMPLOYEES TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON HR.orama.JOBS TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON HR.orama.JOB_HISTORY TO "SPARQL", "SPARQL_UPDATE";
+
+-------------------------------------------------------------------
+
+-------- Create rdfs:Class definitions ----------------------------
+
+ttlp (
+'
+ at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+ at prefix hr: <http://localhost:8890/schemas/oraclehr/> .
+
+hr:countries a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "COUNTRIES" ;
+	rdfs:comment "Oracle HR COUNTRIES table" .
+
+hr:country_id a rdf:Property ;
+	rdfs:domain hr:countries ;
+	rdfs:range xsd:string ;
+	rdfs:label "COUNTRY ID" .
+
+hr:country_name a rdf:Property ;
+	rdfs:domain hr:countries ;
+	rdfs:range xsd:string ;
+	rdfs:label "COUNTRY NAME" .
+
+hr:region_id a rdf:Property ;
+	rdfs:domain hr:countries ;
+	rdfs:range hr:regions ;
+	rdfs:label "REGION ID" .
+
+hr:regions a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "REGIONS" ;
+	rdfs:comment "Oracle HR REGIONS table" .
+
+hr:region_id a rdf:Property ;
+	rdfs:domain hr:regions ;
+	rdfs:range xsd:integer ;
+        rdfs:label "REGION ID" .
+
+hr:region_name a rdf:Property ;
+	rdfs:domain hr:regions ;
+	rdfs:range xsd:string ;
+	rdfs:label "REGION NAME" .
+
+hr:departments a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "DEPARTMENTS" ;
+	rdfs:comment "Oracle HR DEPARTMENT table" .
+
+hr:department_id a rdf:Property ;
+	rdfs:domain hr:departments ;
+	rdfs:range xsd:integer ;
+	rdfs:label "DEPARTMENT ID" .
+
+hr:department_name a rdf:Property ;
+   	rdfs:domain hr:departments ;
+	rdfs:range xsd:string ;
+	rdfs:comment "DEPARTMENT NAME" .
+
+hr:manager_id a rdf:Property ;
+ 	rdfs:domain hr:departments ;
+	rdfs:range hr:employees ;
+	rdfs:comment "MANAGER ID" .
+
+hr:location_id a rdf:Property ;
+	rdfs:domain hr:departments ;
+	rdfs:range hr:locations ;
+	rdfs:comment "LOCATION ID" .
+
+hr:employees a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "employees" ;
+	rdfs:comment "Oracle HR EMPLOYEES table" .
+
+hr:employee_id a rdf:Property ;
+	rdfs:domain hr:employees;
+	rdfs:range xsd:integer ;
+	rdfs:label "EMPLOYEE ID" .
+
+hr:first_name a rdf:Property ;
+	rdfs:domain hr:employees;
+	rdfs:range xsd:string ;
+	rdfs:label "FIRST NAME" .
+
+hr:last_name a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range xsd:string ;
+	rdfs:label "LAST NAME" .
+
+hr:email a rdf:Property ;
+	rdfs:domain hr:employees;
+	rdfs:range xsd:string ;
+	rdfs:label "EMAIL" .
+
+hr:phone_number a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range xsd:string ;
+	rdfs:label "PHONE NUMBER" .
+
+hr:hire_date a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range xsd:date ;
+	rdfs:label "HIRE DATE" .
+
+hr:job_id a rdf:Property ;
+	rdfs:domain hr:employees;
+	rdfs:range hr:jobs ;
+	rdfs:label "JOB ID" .
+
+hr:salary a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range xsd:integer ;
+	rdfs:label "SALARY" .
+
+hr:commission_pct a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range xsd:integer ;
+	rdfs:label "COMMISSION PCT" .
+
+hr:manager_id a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range xsd:string ;
+	rdfs:label "MANAGER ID" .
+
+hr:department_id a rdf:Property ;
+	rdfs:domain hr:employees ;
+	rdfs:range hr:departments ;
+	rdfs:label "DEPARTMENT ID" .
+
+hr:jobs a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "JOBS" ;
+	rdfs:comment "Oracle HR JOBS table" .
+
+hr:job_id a rdf:Property ;
+
+	rdfs:domain hr:jobs ;
+	rdfs:range xsd:string ;
+	rdfs:label "JOB ID" .
+
+hr:job_title a rdf:Property ;
+	rdfs:domain hr:jobs ;
+	rdfs:range xsd:string ;
+	rdfs:label "JOB TITLE" .
+
+hr:min_salary a rdf:Property ;
+	rdfs:domain hr:jobs ;
+	rdfs:range xsd:number;
+	rdfs:label "MIN SALARY" .
+
+hr:max_salary a rdf:Property ;
+	rdfs:domain hr:jobs ;
+	rdfs:range xsd:number;
+	rdfs:label "MAXSALARY" .
+
+hr:job_history a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "JOB HISTORY" ;
+	rdfs:comment "Oracle HR JOB HISTORY table" .
+
+hr:employee_id a rdf:Property ;
+	rdfs:domain hr:job_history ;
+	rdfs:range hr:employees ;
+	rdfs:label "EMPLOYEE ID" .
+
+hr:start_date a rdf:Property ;
+	rdfs:domain hr:job_history ;
+	rdfs:range xsd:date ;
+	rdfs:label "START DATE" .
+
+hr:end_date a rdf:Property ;
+	rdfs:domain hr:job_history ;
+	rdfs:range xsd:date ;
+	rdfs:label "END DATE" .
+
+hr:job_id a rdf:Property ;
+	rdfs:domain hr:job_history ;
+	rdfs:range hr:jobs ;
+	rdfs:label "JOB ID" .
+
+hr:department_id a rdf:Property ;
+	rdfs:domain hr:job_history ;
+	rdfs:range hr:departments ;
+	rdfs:label "DEPARTMENT ID" .
+
+hr:locations a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/oraclehr> ;
+	rdfs:label "LOCATIONS" ;
+	rdfs:comment "Oracle HR JOB LOCATIONS table" .
+
+hr:location_id a rdf:Property ;
+	rdfs:domain hr:locations ;
+	rdfs:range xsd:number ;
+	rdfs:label "LOCATION ID" .
+
+hr:street_address a rdf:Property ;
+	rdfs:domain hr:locations ;
+	rdfs:range xsd:string ;
+	rdfs:label "STREET ADDRESS" .
+
+hr:postal_code a rdf:Property ;
+	rdfs:domain hr:locations ;
+	rdfs:range xsd:string ;
+	rdfs:label "POSTAL CODE" .
+
+hr:city a rdf:Property ;
+	rdfs:domain hr:locations ;
+	rdfs:range xsd:string ;
+	rdfs:label "CITY" .
+
+hr:state_province a rdf:Property ;
+	rdfs:domain hr:locations ;
+	rdfs:range xsd:string ;
+	rdfs:label "STATE PROVINCE" .
+
+hr:country_id a rdf:Property ;
+	rdfs:domain hr:locations ;
+	rdfs:range hr:countries ;
+	rdfs:label "COUNTRY" .
+', '', 'http://localhost:8890/schemas/oraclehr', 0);
+
+---------------------------------------------------------------
+
+----------- Create IRI Classes -------------
+
+create function DB.DBA.JOB_HISTORY (in EMPLOYEE_ID integer, in
+START_DATE date) returns varchar
+{
+  return sprintf_or_null
+('http://localhost:8890/oraclehr/job_history/%d_%s#this',
+  EMPLOYEE_ID, cast (START_DATE as varchar) );
+}
+;
+
+create function DB.DBA.JOB_HISTORY_INV_1 (in id varchar) returns integer
+{
+  return sprintf_inverse (id,
+'http://localhost:8890/oraclehr/job_history/%d_%s#this',
+2)[0];
+}
+;
+
+create function DB.DBA.JOB_HISTORY_INV_2 (in id varchar) returns date
+{
+  declare exit handler for sqlstate '*' { return NULL; };
+  return cast (sprintf_inverse (id,
+'http://localhost:8890/oraclehr/job_history/%d_%s#this',
+2)[1] as date);
+}
+;
+
+
+GRANT EXECUTE ON DB.DBA.JOB_HISTORY TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON DB.DBA.JOB_HISTORY_URI_INV_1 TO "SPARQL", "SPARQL_UPDATE";
+GRANT EXECUTE ON DB.DBA.JOB_HISTORY_URI_INV_2 TO "SPARQL", "SPARQL_UPDATE";
+
+SPARQL
+
+
+	create iri class <http://localhost:8890/schemas/oraclehr/countries_iri>
+	"http://^{URIQADefaultHost}^/oraclehr/countries/%s#this"
+    	(in COUNTRY_ID varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/oraclehr/regions_iri>
+	"http://^{URIQADefaultHost}^/oraclehr/regions/%d#this"
+	    (in REGION_ID integer not null) .
+
+	create iri class <http://localhost:8890/schemas/oraclehr/departments_iri>
+	"http://^{URIQADefaultHost}^/oraclehr/departments/%d#this"
+	    (in DEPARTMENT_ID integer not null) .
+
+	create iri class <http://localhost:8890/schemas/oraclehr/employees_iri>
+	"http://^{URIQADefaultHost}^/oraclehr/employees/%d#this"
+		(in EMPLOYEE_ID integer not null) .
+
+	create iri class <http://localhost:8890/schemas/oraclehr/jobs_iri>
+	"http://^{URIQADefaultHost}^/oraclehr/jobs/%s#this"
+	    (in JOB_ID varchar not null) .
+
+	create iri class <http://localhost:8890/schemas/oraclehr/job_history_iri>
+		using function DB.DBA.JOB_HISTORY (in EMPLOYEE_ID integer not null, in
+		START_DATE date not null) returns varchar not null,
+		function DB.DBA.JOB_HISTORY_INV_1 (in id varchar) returns integer,
+		function DB.DBA.JOB_HISTORY_INV_2 (in id varchar) returns date
+		option (bijection, returns
+		"http://localhost:8890/oraclehr/job_history/%d_%s#this") .
+
+	create iri class <http://localhost:8890/schemas/oraclehr/locations_iri>
+	"http://^{URIQADefaultHost}^/oraclehr/locations/%d#this"
+	    (in LOCATION_ID integer not null) .
+;
+
+--------------------------------------------------------------------
+
+------------- Create Quad Store ------------------------------------
+
+SPARQL
+
+prefix hr: <http://localhost:8890/schemas/oraclehr/>
+
+alter quad storage virtrdf:DefaultQuadStorage
+  from HR.orama.COUNTRIES as countries_tbl
+  from HR.orama.REGIONS as regions_tbl
+  from HR.orama.DEPARTMENTS as departments_tbl
+  from HR.orama.EMPLOYEES as employees_tbl
+  from HR.orama.EMPLOYEES as employees_tbl_1		### alias required to represent recursive FK relationship (hr: has_manager ) below.
+  from HR.orama.JOBS as jobs_tbl
+  from HR.orama.JOB_HISTORY as job_history_tbl
+  from HR.orama.LOCATIONS as locations_tbl
+{
+  create virtrdf:oraclehr as
+      graph <http://localhost:8890/oraclehr>
+  {
+        hr:countries_iri(countries_tbl.COUNTRY_ID) a hr:countries  as virtrdf:countires_country_id ;
+        hr:country_name countries_tbl.COUNTRY_NAME  as virtrdf:countries_country_name ;
+        hr:region_id hr:regions_iri(regions_tbl.REGION_ID) where (^{countries_tbl.}^.REGION_ID = ^{regions_tbl.}^.REGION_ID)  as virtrdf:countries_region_id .
+
+	hr:regions_iri(regions_tbl.REGION_ID) a hr:regions as virtrdf:regions_region_id ;
+	hr:region_name regions_tbl.REGION_NAME  as virtrdf:regions_region_name .
+
+	hr:departments_iri(departments_tbl.DEPARTMENT_ID) a hr:departments as virtrdf:departments_department_id ;
+	hr:department_name departments_tbl.DEPARTMENT_NAME as virtrdf:departments_department_name ;
+	hr:location_id hr:locations_iri(locations_tbl.LOCATION_ID) where (^{departments_tbl.}^.LOCATION_ID = ^{locations_tbl.}^.LOCATION_ID) as virtrdf:departments_location_id ;
+	hr:manager_id hr:employees_iri(employees_tbl.EMPLOYEE_ID) where (^{departments_tbl.}^.MANAGER_ID = ^{employees_tbl.}^.EMPLOYEE_ID) as virtrdf:departments_manager_id .
+
+	hr:employees_iri(employees_tbl.EMPLOYEE_ID) a hr:employees as virtrdf:employees_employee_id ;
+	hr:department_id hr:departments_iri(departments_tbl.DEPARTMENT_ID) where (^{employees_tbl.}^.DEPARTMENT_ID = ^{departments_tbl.}^.DEPARTMENT_ID) as virtrdf:employees_department_id ;
+	hr:job_id hr:jobs_iri(jobs_tbl.JOB_ID) where (^{employees_tbl.}^.JOB_ID = ^{jobs_tbl.}^.JOB_ID) as virtrdf:employees_job_id ;
+	hr:manager_id employees_tbl.MANAGER_ID as virtrdf:employees_manager_id ;
+	hr:commissin_pct employees_tbl.COMMISSION_PCT as virtrdf:employees_commission_pct ;
+	hr:email employees_tbl.EMAIL as virtrdf:employees_email ;
+	hr:first_name employees_tbl.FIRST_NAME as virtrdf:employees_first_name ;
+	hr:hire_date employees_tbl.HIRE_DATE as virtrdf:employees_hire_date ;
+	hr:last_name employees_tbl.LAST_NAME as virtrdf:employees_last_name ;
+	hr:phone_number employees_tbl.PHONE_NUMBER as virtrdf:employees_phone_number ;
+	hr:salary employees_tbl.SALARY as virtrdf:employees_salary ;
+	hr:has_job_history hr:job_history_iri(job_history_tbl.EMPLOYEE_ID, job_history_tbl.START_DATE) where (^{employees_tbl.}^.EMPLOYEE_ID = ^{job_history_tbl.}^.EMPLOYEE_ID) as virtrdf:employees_has_job_history;
+	hr:has_manager hr:employees_iri(employees_tbl_1.EMPLOYEE_ID) where (^{employees_tbl.}^.MANAGER_ID = ^{employees_tbl_1.}^.EMPLOYEE_ID) as virtrdf:employees_has_manager.
+
+	hr:locations_iri(locations_tbl.LOCATION_ID) a hr:locations as virtrdf:locations_location_id ;
+	hr:country_id hr:countries_iri(countries_tbl.COUNTRY_ID) where (^{locations_tbl.}^.COUNTRY_ID = ^{countries_tbl.}^.COUNTRY_ID) as virtrdf:locations_country_id ;
+	hr:city locations_tbl.CITY as virtrdf:locations_city ;
+	hr:postal_code locations_tbl.POSTAL_CODE as virtrdf:locations_postal_code ;
+	hr:state_province locations_tbl.STATE_PROVINCE as virtrdf:locations_state_province ;
+	hr:street_address locations_tbl.STREET_ADDRESS as virtrdf:locations_street_address .
+
+	hr:jobs_iri(jobs_tbl.JOB_ID) a hr:jobs as virtrdf:jobs_job_id ;
+	hr:job_title jobs_tbl.JOB_TITLE as virtrdf:jobs_job_title ;
+	hr:max_salary jobs_tbl.MAX_SALARY as virtrdf:jobs_max_salary ;
+	hr:min_salary jobs_tbl.MIN_SALARY as virtrdf:jobs_min_salary .
+
+	hr:job_history_iri(job_history_tbl.EMPLOYEE_ID, job_history_tbl.START_DATE) a hr:job_history as virtrdf:job_history_pk ;
+	hr:employee_id hr:employees_iri(employees_tbl.EMPLOYEE_ID) where (^{job_history_tbl.}^.EMPLOYEE_ID = ^{employees_tbl.}^.EMPLOYEE_ID) as virtrdf:job_history_employee_id ;
+	hr:department_id hr:departments_iri(departments_tbl.DEPARTMENT_ID) where (^{job_history_tbl.}^.DEPARTMENT_ID = ^{departments_tbl.}^.DEPARTMENT_ID) as virtrdf:job_history_department_id ;
+	hr:job_id hr:jobs_iri(jobs_tbl.JOB_ID) where (^{job_history_tbl.}^.JOB_ID = ^{jobs_tbl.}^.JOB_ID) as virtrdf:job_history_job_id ;
+	hr:start_date job_history_tbl.START_DATE as virtrdf:job_history_start_date ;
+	hr:end_date job_history_tbl.END_DATE as virtrdf:job_history_end_date .
+
+  } .
+} .
+;
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'oraclehr_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'oraclehr_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'oraclehr_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'oraclehr_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/oraclehr%%3E&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'oraclehr_rule_list1',
+    1,
+    vector (
+  	 	'oraclehr_rule1',
+  	 	'oraclehr_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/oraclehr');
+
+VHOST_DEFINE (
+	lpath=>'/oraclehr',
+	ppath=>'/DAV/oraclehr/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'oraclehr_rule_list1')
+	);
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'oracle_schemas_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'oracle_schemas_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'oracle_schemas_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'oracle_schemas_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/oraclehr%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path','path','*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'oracle_schemas_rule_list1',
+    1,
+    vector (
+  	 	'oracle_schemas_rule1',
+  	 	'oracle_schemas_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/schema/oraclehr');
+
+VHOST_DEFINE (
+	lpath=>'/schemas/oraclehr',
+	ppath=>'/DAV/schemas/oraclehr/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'oracle_schemas_rule_list1')
+	);
+
+DB.DBA.XML_SET_NS_DECL ('hr', 'http://^{URIQADefaultHost}^/schemas/oraclehr/', 2);
+]]></programlisting>
+    </sect2>
+    <sect2 id="rdfviewsenterprdb">
+      <title>DB2 using the demonstration 'Sample' database</title>
+<para><emphasis>Version defined using explicit host - localhost:8890</emphasis></para>
+<programlisting><![CDATA[
+-- $Id: rdfviewssamples.xml,v 1.1.2.1 2010/10/07 12:45:00 source Exp $
+-- Setup script for RDF view of portions of DB2 SAMPLE database included
+-- in DB2 Express Edition v9.5
+--
+-- The script assumes external DB2 tables are linked into Virtuoso using
+-- local schema name db2sample.
+
+DB..vd_remote_data_source ('db2ma-smpl', '', '<uid>','<pwd>);
+
+ATTACH TABLE  "DB2ADMIN"."ACT"      PRIMARY KEY ("ACTNO")              AS "DB"."db2sample"."ACT"      FROM 'db2ma-smpl';
+ATTACH TABLE  "DB2ADMIN"."DEPARTMENT"      PRIMARY KEY ("DEPTNO")              AS "DB"."db2sample"."DEPARTMENT"      FROM 'db2ma-smpl';
+ATTACH TABLE  "DB2ADMIN"."EMPLOYEE"      PRIMARY KEY ("EMPNO")              AS "DB"."db2sample"."EMPLOYEE"      FROM 'db2ma-smpl';
+ATTACH TABLE  "DB2ADMIN"."EMPPROJACT"      PRIMARY KEY ("EMPNO", "PROJNO", "ACTNO", "EMSTDATE")              AS "DB"."db2sample"."EMPPROJACT"      FROM 'db2ma-smpl';
+ATTACH TABLE  "DB2ADMIN"."EMP_RESUME"      PRIMARY KEY ("EMPNO", "RESUME_FORMAT)              AS "DB"."db2sample"."EMP_RESUME"      FROM 'db2ma-smpl';
+ATTACH TABLE  "DB2ADMIN"."PROJACT"      PRIMARY KEY ("PROJNO", "ACTNO", "ACSTDATE")              AS "DB"."db2sample"."PROJACT"      FROM 'db2ma-smpl';
+ATTACH TABLE  "DB2ADMIN"."PROJECT"      PRIMARY KEY ("PROJNO")              AS "DB"."db2sample"."PROJECT"      FROM 'db2ma-smpl';
+
+COMMIT WORK;
+
+GRANT SELECT ON DB.db2sample.ACT TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON DB.db2sample.DEPARTMENT TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON DB.db2sample.EMPLOYEE TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON DB.db2sample.EMPPROJACT TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON DB.db2sample.EMP_RESUME TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON DB.db2sample.PROJACT TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON DB.db2sample.PROJECT TO "SPARQL", "SPARQL_UPDATE";
+
+create function DB.DBA.PROJ_ACT_IRI (
+  in proj_no varchar,
+  in act_no integer,
+  in ac_st_date date
+  ) returns varchar
+{
+  declare _act_no, _datetime, _date any;
+  _act_no := cast(act_no as varchar);
+  _datetime := cast(ac_st_date as varchar);
+  _date := left(_datetime, 10);
+  return sprintf('http://localhost:8890/db2sample/proj_act/%s_%s_%s#this',
+    proj_no, _act_no, _date);
+};
+
+create function
+DB.DBA.PROJ_ACT_IRI_INV_1 (in proj_act_iri varchar) returns varchar
+{
+  declare exit handler for sqlstate '*' { return NULL; };
+  declare parts any;
+  parts := sprintf_inverse (proj_act_iri,
+   'http://localhost:8890/db2sample/proj_act/%s_%s_%s#this', 1);
+  if (parts is not null)
+  {
+    return parts[0];
+  }
+  return NULL;
+};
+
+create function
+DB.DBA.PROJ_ACT_IRI_INV_2 (in proj_act_iri varchar) returns integer
+{
+  declare exit handler for sqlstate '*' { return NULL; };
+  declare parts any;
+  parts := sprintf_inverse (proj_act_iri,
+   'http://localhost:8890/db2sample/proj_act/%s_%s_%s#this', 1);
+  if (parts is not null)
+  {
+    return cast(parts[1] as integer);
+  }
+  return NULL;
+};
+
+create function
+DB.DBA.PROJ_ACT_IRI_INV_3 (in proj_act_iri varchar) returns date
+{
+  declare exit handler for sqlstate '*' { return NULL; };
+  declare parts any;
+  parts := sprintf_inverse (proj_act_iri,
+   'http://localhost:8890/db2sample/proj_act/%s_%s_%s#this', 1);
+  if (parts is not null)
+  {
+    return cast(parts[2] as date);
+  }
+  return NULL;
+};
+
+create function DB.DBA.EMP_PROJ_ACT_IRI (
+  in emp_no varchar,
+  in proj_no varchar,
+  in act_no integer,
+  in emp_start_date date
+  ) returns varchar
+{
+  declare _act_no, _datetime, _date any;
+  _act_no := cast(act_no as varchar);
+  _datetime := cast(emp_start_date as varchar);
+  _date := left(_datetime, 10);
+  return sprintf(
+      'http://localhost:8890/db2sample/emp_proj_act/%s_%s_%s_%s#this',
+    emp_no, proj_no, _act_no, _date);
+};
+
+create function
+DB.DBA.EMP_PROJ_ACT_IRI_INV_1 (in emp_proj_act_iri varchar) returns varchar
+{
+  declare exit handler for sqlstate '*' { return NULL; };
+  declare parts any;
+  parts := sprintf_inverse (emp_proj_act_iri,
+   'http://localhost:8890/db2sample/emp_proj_act/%s_%s_%s_%s#this', 1);
+  if (parts is not null)
+  {
+    return parts[0];
+  }
+  return NULL;
+};
+
+create function
+DB.DBA.EMP_PROJ_ACT_IRI_INV_2 (in emp_proj_act_iri varchar) returns varchar
+{
+  declare exit handler for sqlstate '*' { return NULL; };
+  declare parts any;
+  parts := sprintf_inverse (emp_proj_act_iri,
+   'http://localhost:8890/db2sample/emp_proj_act/%s_%s_%s_%s#this', 1);
+  if (parts is not null)
+  {
+    return parts[1];
+  }
+  return NULL;
+};
+
+create function
+DB.DBA.EMP_PROJ_ACT_IRI_INV_3 (in emp_proj_act_iri varchar) returns integer
+{
+  declare exit handler for sqlstate '*' { return NULL; };
+  declare parts any;
+  parts := sprintf_inverse (emp_proj_act_iri,
+   'http://localhost:8890/db2sample/emp_proj_act/%s_%s_%s_%s#this', 1);
+  if (parts is not null)
+  {
+    return cast(parts[2] as integer);
+  }
+  return NULL;
+};
+
+create function
+DB.DBA.EMP_PROJ_ACT_IRI_INV_4 (in emp_proj_act_iri varchar) returns date
+{
+  declare exit handler for sqlstate '*' { return NULL; };
+  declare parts any;
+  parts := sprintf_inverse (emp_proj_act_iri,
+   'http://localhost:8890/db2sample/emp_proj_act/%s_%s_%s_%s#this', 1);
+  if (parts is not null)
+  {
+    return cast(parts[3] as date);
+  }
+  return NULL;
+};
+
+grant execute on DB.DBA.PROJ_ACT_IRI to "SPARQL", "SPARQL_UPDATE";
+grant execute on DB.DBA.PROJ_ACT_IRI_INV_1 to "SPARQL", "SPARQL_UPDATE";
+grant execute on DB.DBA.PROJ_ACT_IRI_INV_2 to "SPARQL", "SPARQL_UPDATE";
+grant execute on DB.DBA.PROJ_ACT_IRI_INV_3 to "SPARQL", "SPARQL_UPDATE";
+
+grant execute on DB.DBA.EMP_PROJ_ACT_IRI to "SPARQL", "SPARQL_UPDATE";
+grant execute on DB.DBA.EMP_PROJ_ACT_IRI_INV_1 to "SPARQL", "SPARQL_UPDATE";
+grant execute on DB.DBA.EMP_PROJ_ACT_IRI_INV_2 to "SPARQL", "SPARQL_UPDATE";
+grant execute on DB.DBA.EMP_PROJ_ACT_IRI_INV_3 to "SPARQL", "SPARQL_UPDATE";
+grant execute on DB.DBA.EMP_PROJ_ACT_IRI_INV_4 to "SPARQL", "SPARQL_UPDATE";
+
+SPARQL drop graph <http://localhost:8890/schemas/db2sample> ;
+SPARQL drop graph <http://localhost:8890/db2sample> ;
+
+SPARQL drop quad map virtrdf:db2sample ;
+
+--------------------------
+-- RDFS class definitions
+ttlp (
+'
+ at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+ at prefix opl: <http://localhost:8890/schemas/db2sample/> .
+
+opl:Act a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
+	rdfs:label "Act" ;
+	rdfs:comment "Activity" .
+
+# ACTNO SMALLINT PRIMARY KEY
+opl:act_no a rdf:Property ;
+	rdfs:domain opl:Act ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Activity number" .
+
+# ACTKWD VARCHAR(6)
+opl:act_kwd a rdf:Property ;
+	rdfs:domain opl:Act ;
+	rdfs:range xsd:string ;
+	rdfs:label "Activity keyword" .
+
+# ACTDESC VARCHAR(20)
+opl:act_desc a rdf:Property ;
+	rdfs:domain opl:Act ;
+	rdfs:range xsd:string ;
+	rdfs:label "Activity description" .
+
+#####
+opl:Department a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
+	rdfs:label "Department" ;
+	rdfs:comment "Department" .
+
+# DEPTNO VARCHAR(3) PRIMARY KEY
+opl:dept_no a rdf:Property ;
+	rdfs:domain opl:Department ;
+	rdfs:range xsd:string ;
+	rdfs:label "Department number" .
+
+# DEPTNAME VARCHAR(36)
+opl:dept_name a rdf:Property ;
+	rdfs:domain opl:Department ;
+	rdfs:range xsd:string ;
+	rdfs:label "Department name" .
+
+# MGRNO CHAR(6)
+opl:dept_manager a rdf:Property ;
+	rdfs:domain opl:Department ;
+	rdfs:range xsd:Employee ;
+	rdfs:label "Department manager" .
+
+# ADMRDEPT CHAR(3)
+opl:supervising_dept a rdf:Property ;
+	rdfs:domain opl:Department ;
+	rdfs:range opl:Department ;
+	rdfs:label "Department reported to" .
+
+# LOCATION CHAR(6)
+opl:location a rdf:Property ;
+	rdfs:domain opl:Department ;
+	rdfs:range xsd:string ;
+	rdfs:label "Location" .
+
+opl:employee_collection a rdf:Property ;
+	rdfs:domain opl:Department ;
+	rdfs:range opl:Employee ;
+	rdfs:label "Department employees" .
+
+opl:dept_project_collection a rdf:Property ;
+	rdfs:domain opl:Department ;
+	rdfs:range opl:Project ;
+	rdfs:label "Department projects" .
+
+#####
+opl:Employee a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
+	rdfs:label "Employee" ;
+	rdfs:comment "Employee" .
+
+# EMPNO VARCHAR(6) PRIMARY KEY
+opl:emp_no a rdf:Property ;
+	rdfs:domain opl:Employee;
+	rdfs:range xsd:string ;
+	rdfs:label "Employee number" .
+
+# FIRSTNME VARCHAR(12)
+opl:first_name a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range xsd:string ;
+	rdfs:label "First name" .
+
+# MIDINIT VARCHAR(1)
+opl:middle_initial a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range xsd:string ;
+	rdfs:label "Middle initial" .
+
+# LASTNAME VARCHAR(15)
+opl:last_name a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range xsd:string ;
+	rdfs:label "Last name" .
+
+# WORKDEPT VARCHAR(3)
+opl:work_dept a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range opl:Department ;
+	rdfs:label "Work department" .
+
+# PHONENO VARCHAR(4)
+opl:phone_no a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range xsd:string ;
+	rdfs:label "Phone number" .
+
+# HIREDATE DATE
+opl:hire_date a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range xsd:date;
+	rdfs:label "Hire date" .
+
+# JOB VARCHAR(8)
+opl:job a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range xsd:string ;
+	rdfs:label "Job" .
+
+# EDLEVEL SMALLINT
+opl:education_level a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Education level" .
+
+# SEX VARCHAR(1)
+opl:gender a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range xsd:string ;
+	rdfs:label "Gender" .
+
+# BIRTHDATE DATE
+opl:date_of_birth a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range xsd:date ;
+	rdfs:label "Date of birth" .
+
+# SALARY DECIMAL(9,2)
+opl:salary a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Salary" .
+
+# BONUS DECIMAL(9,2)
+opl:bonus a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Bonus" .
+
+# COMM DECIMAL(9,2)
+opl:commission a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Commission" .
+
+opl:resume_collection a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range opl:EmployeeResume ;
+	rdfs:label "Employee resumes" .
+
+opl:projects_responsible_for_collection a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range opl:Project ;
+	rdfs:label "responsible for project" .
+
+opl:activity_collection a rdf:Property ;
+	rdfs:domain opl:Employee ;
+	rdfs:range opl:EmpProjAct ;
+	rdfs:label "project activities" .
+
+#####
+opl:EmpProjAct a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
+	rdfs:label "EmpProjAct" ;
+	rdfs:comment "Employee project activity" .
+
+# EMPNO VARCHAR(6) PRIMARY KEY
+opl:epa_emp_no a rdf:Property ;
+	rdfs:domain opl:EmpProjAct ;
+	rdfs:range xsd:string ;
+	rdfs:label "Employee number" .
+
+# PROJNO VARCHAR(6) PRIMARY KEY
+opl:epa_proj_no a rdf:Property ;
+	rdfs:domain opl:EmpProjAct ;
+	rdfs:range xsd:string ;
+	rdfs:label "Project number" .
+
+# ACTNO SMALLINT PRIMARY KEY
+opl:epa_act_no a rdf:Property ;
+	rdfs:domain opl:EmpProjAct ;
+	rdfs:range xsd:string ;
+	rdfs:label "Activity number" .
+
+# EMSTDATE DATE PRIMARY KEY
+opl:emp_start_date a rdf:Property ;
+	rdfs:domain opl:EmpProjAct ;
+	rdfs:range xsd:date ;
+	rdfs:label "Employee activity start date" .
+
+# EMPTIME DECIMAL(5,2)
+opl:emp_time a rdf:Property ;
+	rdfs:domain opl:EmpProjAct ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Employee time" .
+
+# EMENDATE DATE PRIMARY KEY
+opl:emp_end_date a rdf:Property ;
+	rdfs:domain opl:EmpProjAct ;
+	rdfs:range xsd:date ;
+	rdfs:label "Employee activity end date" .
+
+opl:assigned_to a rdf:Property ;
+	rdfs:domain opl:EmpProjAct ;
+	rdfs:range opl:Employee ;
+	rdfs:label "Assigned to" .
+
+opl:project_activity a rdf:Property ;
+	rdfs:domain opl:EmpProjAct ;
+	rdfs:range opl:ProjAct ;
+	rdfs:label "Project activity" .
+
+#####
+opl:EmployeeResume a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
+	rdfs:label "EmployeeResume" ;
+	rdfs:comment "Employee resume" .
+
+# EMPNO VARCHAR(6) PRIMARY KEY
+opl:er_emp_no a rdf:Property ;
+	rdfs:domain opl:EmployeeResume ;
+	rdfs:range xsd:string ;
+	rdfs:label "Employee number" .
+
+# RESUME_FORMAT VARCHAR(10) PRIMARY KEY
+opl:resume_format a rdf:Property ;
+	rdfs:domain opl:EmployeeResume ;
+	rdfs:range xsd:string ;
+	rdfs:label "Resume format" .
+
+# RESUME VARCHAR(5120)
+opl:resume a rdf:Property ;
+	rdfs:domain opl:EmployeeResume ;
+	rdfs:range xsd:string ;
+	rdfs:label "Resume" .
+
+opl:resume_of a rdf:Property ;
+	rdfs:domain opl:EmployeeResume ;
+	rdfs:range opl:Employee ;
+	rdfs:label "Resume subject" .
+
+#####
+opl:ProjAct a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
+	rdfs:label "ProjAct" ;
+	rdfs:comment "Project activity" .
+
+# PROJNO VARCHAR(6) PRIMARY KEY
+opl:pa_proj_no a rdf:Property ;
+	rdfs:domain opl:ProjAct ;
+	rdfs:range xsd:string ;
+	rdfs:label "Project number" .
+
+# ACTNO SMALLINT PRIMARY KEY
+opl:pa_act_no a rdf:Property ;
+	rdfs:domain opl:ProjAct ;
+	rdfs:range xsd:string ;
+	rdfs:label "Activity number" .
+
+# ACSTDATE DATE PRIMARY KEY
+opl:ac_st_date a rdf:Property ;
+	rdfs:domain opl:ProjAct ;
+	rdfs:range xsd:date ;
+	rdfs:label "Activity start date" .
+
+# ACSTAFF DECIMAL(5,2)
+opl:ac_staff a rdf:Property ;
+	rdfs:domain opl:ProjAct ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Acstaff" .
+
+# ACENDATE DATE
+opl:ac_en_date a rdf:Property ;
+	rdfs:domain opl:ProjAct ;
+	rdfs:range xsd:date ;
+	rdfs:label "Activity end date" .
+
+opl:project a rdf:Property ;
+	rdfs:domain opl:ProjAct ;
+	rdfs:range opl:Project ;
+	rdfs:label "Project" .
+
+opl:activity a rdf:Property ;
+	rdfs:domain opl:ProjAct ;
+	rdfs:range opl:Act ;
+	rdfs:label "Activity" .
+
+opl:employee_activity_collection a rdf:Property ;
+	rdfs:domain opl:ProjAct ;
+	rdfs:range opl:EmpProjAct ;
+	rdfs:label "Employee activity collection" .
+
+#####
+opl:Project a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/db2sample> ;
+	rdfs:label "Project" ;
+	rdfs:comment "Project" .
+
+# PROJNO VARCHAR(6) PRIMARY KEY
+opl:proj_no a rdf:Property ;
+	rdfs:domain opl:Project ;
+	rdfs:range xsd:string ;
+	rdfs:label "Project number" .
+
+# PROJNAME VARCHAR(24)
+opl:proj_name a rdf:Property ;
+	rdfs:domain opl:Project ;
+	rdfs:range xsd:string ;
+	rdfs:label "Project name" .
+
+# DEPTNO CHAR(3)
+opl:is_project_of_department a rdf:Property ;
+	rdfs:domain opl:Project ;
+	rdfs:range opl:Department ;
+	rdfs:label "is project of department" .
+
+# RESPEMP VARCHAR(6)
+opl:resp_emp a rdf:Property ;
+	rdfs:domain opl:Project ;
+	rdfs:range opl:Employee ;
+	rdfs:label "Employee responsible" .
+
+# PRSTAFF DECIMAL(5,2)
+opl:pr_staff a rdf:Property ;
+	rdfs:domain opl:Project ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "PrStaff" .
+
+# PRSTDATE DATE
+opl:pr_st_date a rdf:Property ;
+	rdfs:domain opl:Project ;
+	rdfs:range xsd:date ;
+	rdfs:label "Project start date" .
+
+# PRENDATE DATE
+opl:pr_en_date a rdf:Property ;
+	rdfs:domain opl:Project ;
+	rdfs:range xsd:date ;
+	rdfs:label "Project end date" .
+
+# MAJPROJ VARCHAR(6)
+opl:maj_proj a rdf:Property ;
+	rdfs:domain opl:Project ;
+	rdfs:range xsd:string ;
+	rdfs:label "MajProj" .
+
+opl:proj_activity_collection a rdf:Property ;
+	rdfs:domain opl:Project ;
+	rdfs:range opl:ProjAct ;
+	rdfs:label "Project activities" .
+
+', '', 'http://localhost:8890/schemas/db2sample', 0);
+
+--------------------------
+
+SPARQL
+prefix opl: <http://localhost:8890/schemas/db2sample/>
+
+create iri class
+<http://localhost:8890/schemas/db2sample/act_iri>
+	"http://localhost:8890/db2sample/act/%d#this"
+	(
+	 in act_no integer not null
+	) .
+
+create iri class
+<http://localhost:8890/schemas/db2sample/department_iri>
+	"http://localhost:8890/db2sample/department/%s#this"
+	(
+	 in dept_no varchar not null
+	) .
+
+create iri class
+<http://localhost:8890/schemas/db2sample/employee_iri>
+	"http://localhost:8890/db2sample/employee/%s#this"
+	(
+	 in emp_no varchar not null
+	) .
+
+create iri class opl:emp_proj_act_iri using
+	function DB.DBA.EMP_PROJ_ACT_IRI (
+	 	in emp_no varchar,
+	 	in proj_no varchar,
+	 	in act_no integer,
+	 	in emp_start_date date
+		) returns varchar,
+	function DB.DBA.EMP_PROJ_ACT_IRI_INV_1 (in emp_proj_act_iri varchar)
+		returns varchar ,
+	function DB.DBA.EMP_PROJ_ACT_IRI_INV_2 (in emp_proj_act_iri varchar)
+		returns varchar ,
+	function DB.DBA.EMP_PROJ_ACT_IRI_INV_3 (in emp_proj_act_iri varchar)
+		returns integer ,
+	function DB.DBA.EMP_PROJ_ACT_IRI_INV_4 (in emp_proj_act_iri varchar)
+		returns date
+	option (bijection, returns
+	  "http://localhost:8890/db2sample/emp_proj_act/%s_%s_%s_%s#this")
+	.
+
+
+create iri class
+<http://localhost:8890/schemas/db2sample/employee_resume_iri>
+	"http://localhost:8890/db2sample/employee_resume/%s_%s#this"
+	(
+	 in emp_no varchar not null,
+	 in resume_format varchar not null
+	) .
+
+create iri class opl:proj_act_iri using
+	function DB.DBA.PROJ_ACT_IRI (
+		in proj_no varchar,
+		in act_no integer,
+		in ac_st_date date
+		) returns varchar,
+	function DB.DBA.PROJ_ACT_IRI_INV_1 (in proj_act_iri varchar)
+		returns varchar ,
+	function DB.DBA.PROJ_ACT_IRI_INV_2 (in proj_act_iri varchar)
+		returns integer ,
+	function DB.DBA.PROJ_ACT_IRI_INV_3 (in proj_act_iri varchar)
+		returns date
+	option (bijection, returns
+		"http://localhost:8890/db2sample/proj_act/%s_%s_%s#this")
+	.
+
+create iri class
+<http://localhost:8890/schemas/db2sample/project_iri>
+	"http://localhost:8890/db2sample/project/%s#this"
+	(
+	 in proj_no varchar not null
+	) .
+;
+
+SPARQL
+prefix opl: <http://localhost:8890/schemas/db2sample/>
+
+alter quad storage virtrdf:DefaultQuadStorage
+from DB.db2sample.ACT as act_tbl
+from DB.db2sample.DEPARTMENT as dept_tbl
+from DB.db2sample.EMPLOYEE as emp_tbl
+from DB.db2sample.EMPPROJACT as emp_proj_act_tbl
+from DB.db2sample.EMP_RESUME as emp_resume_tbl
+from DB.db2sample.PROJACT as proj_act_tbl
+from DB.db2sample.PROJECT as project_tbl
+{
+	create virtrdf:db2sample as
+		graph <http://localhost:8890/db2sample>
+	{
+	opl:act_iri(act_tbl.ACTNO) a opl:Act
+		as virtrdf:act_id ;
+	opl:act_no act_tbl.ACTNO
+		as virtrdf:act_act_no ;
+	opl:act_kwd act_tbl.ACTKWD
+		as virtrdf:act_act_kwd ;
+	opl:act_desc act_tbl.ACTDESC
+		as virtrdf:act_act_desc .
+
+	opl:department_iri(dept_tbl.DEPTNO) a opl:Department
+		as virtrdf:dept_id ;
+	opl:dept_no dept_tbl.DEPTNO
+		as virtrdf:dept_dept_no ;
+	opl:dept_name dept_tbl.DEPTNAME
+		as virtrdf:dept_dept_name ;
+	opl:dept_manager opl:employee_iri(dept_tbl.MGRNO)
+		as virtrdf:dept_mgr_no ;
+	opl:supervising_dept opl:department_iri(dept_tbl.ADMRDEPT)
+		as virtrdf:dept_supervising_dept ;
+	opl:location dept_tbl.LOCATION
+		as virtrdf:dept_location ;
+	opl:employee_collection opl:employee_iri(emp_tbl.EMPNO)
+		where (^{emp_tbl.}^.WORKDEPT = ^{dept_tbl.}^.DEPTNO)
+		as virtrdf:dept_employee_collection ;
+	opl:dept_project_collection opl:project_iri(project_tbl.PROJNO)
+		where (^{project_tbl.}^.DEPTNO = ^{dept_tbl.}^.DEPTNO)
+		as virtrdf:dept_project_collection .
+
+	opl:employee_iri(emp_tbl.EMPNO) a opl:Employee
+		as virtrdf:employee_id ;
+	opl:emp_no emp_tbl.EMPNO
+		as virtrdf:employee_emp_no ;
+	opl:first_name emp_tbl.FIRSTNME
+		as virtrdf:employee_first_name ;
+	opl:middle_initial emp_tbl.MIDINIT
+		as virtrdf:employee_middle_initial ;
+	opl:last_name emp_tbl.LASTNAME
+		as virtrdf:employee_last_name ;
+	opl:work_dept opl:department_iri(emp_tbl.WORKDEPT)
+		as virtrdf:employee_work_dept ;
+	opl:phone_no emp_tbl.PHONENO
+		as virtrdf:employee_phone_no ;
+	opl:hire_date emp_tbl.HIREDATE
+		as virtrdf:employee_hire_date ;
+	opl:job emp_tbl.JOB
+		as virtrdf:employee_job ;
+	opl:education_level emp_tbl.EDLEVEL
+		as virtrdf:employee_education_level ;
+	opl:gender emp_tbl.SEX
+		as virtrdf:employee_gender ;
+	opl:date_of_birth emp_tbl.BIRTHDATE
+		as virtrdf:employee_date_of_birth ;
+	opl:salary emp_tbl.SALARY
+		as virtrdf:employee_salary ;
+	opl:bonus emp_tbl.BONUS
+		as virtrdf:employee_bonus ;
+	opl:commission emp_tbl.COMM
+		as virtrdf:employee_commission ;
+	opl:resume_collection opl:employee_resume_iri(
+		emp_resume_tbl.EMPNO,
+		emp_resume_tbl.RESUME_FORMAT
+		)
+		where (^{emp_tbl.}^.EMPNO = ^{emp_resume_tbl.}^.EMPNO)
+		as virtrdf:employee_resume_collection ;
+	opl:projects_responsible_for_collection
+ 		opl:project_iri(project_tbl.PROJNO)
+		where (^{project_tbl.}^.RESPEMP = ^{emp_tbl.}^.EMPNO)
+		as virtrdf:employee_projects_responsible_for_collection ;
+	opl:activity_collection opl:emp_proj_act_iri(
+		emp_proj_act_tbl.EMPNO,
+		emp_proj_act_tbl.PROJNO,
+		emp_proj_act_tbl.ACTNO,
+		emp_proj_act_tbl.EMSTDATE
+		)
+		where (^{emp_tbl.}^.EMPNO = ^{emp_proj_act_tbl.}^.EMPNO)
+		as virtrdf:employee_activity_collection .
+
+	opl:emp_proj_act_iri(
+		emp_proj_act_tbl.EMPNO,
+		emp_proj_act_tbl.PROJNO,
+		emp_proj_act_tbl.ACTNO,
+		emp_proj_act_tbl.EMSTDATE
+		) a opl:EmpProjAct
+		as virtrdf:empprojact_id ;
+	opl:epa_emp_no emp_proj_act_tbl.EMPNO
+		as virtrdf:empprojact_emp_no ;
+	opl:epa_proj_no emp_proj_act_tbl.PROJNO
+		as virtrdf:empprojact_proj_no ;
+	opl:epa_act_no emp_proj_act_tbl.ACTNO
+		as virtrdf:empprojact_act_no ;
+	opl:emp_start_date emp_proj_act_tbl.EMSTDATE
+		as virtrdf:empprojact_emp_start_date ;
+	opl:emp_time emp_proj_act_tbl.EMPTIME
+		as virtrdf:empprojact_emp_time ;
+	opl:emp_end_date emp_proj_act_tbl.EMENDATE
+		as virtrdf:empprojact_emp_end_date ;
+	opl:assigned_to opl:employee_iri(emp_proj_act_tbl.EMPNO)
+		as virtrdf:empprojact_assigned_to ;
+	opl:project_activity opl:proj_act_iri(
+		emp_proj_act_tbl.PROJNO,
+		emp_proj_act_tbl.ACTNO,
+		emp_proj_act_tbl.EMSTDATE
+		)
+		as virtrdf:empprojact_project_activity .
+
+	opl:employee_resume_iri(
+		emp_resume_tbl.EMPNO,
+		emp_resume_tbl.RESUME_FORMAT
+		) a opl:EmployeeResume
+		as virtrdf:employee_resume_id ;
+	opl:er_emp_no emp_resume_tbl.EMPNO
+		as virtrdf:employee_resume_emp_no ;
+	opl:resume_format emp_resume_tbl.RESUME_FORMAT
+		as virtrdf:employee_resume_resume_format ;
+	opl:resume emp_resume_tbl.RESUME
+		as virtrdf:employee_resume_resume ;
+	opl:resume_of opl:employee_iri(emp_resume_tbl.EMPNO)
+		as virtrdf:employee_resume_resume_of .
+
+	opl:proj_act_iri(
+		proj_act_tbl.PROJNO,
+		proj_act_tbl.ACTNO,
+		proj_act_tbl.ACSTDATE
+		) a opl:ProjAct
+		as virtrdf:projact_id;
+	opl:pa_proj_no proj_act_tbl.PROJNO
+		as virtrdf:projact_proj_no ;
+	opl:pa_act_no proj_act_tbl.ACTNO
+		as virtrdf:projact_act_no ;
+	opl:ac_st_date proj_act_tbl.ACSTDATE
+		as virtrdf:projact_ac_st_date ;
+	opl:ac_staff proj_act_tbl.ACSTAFF
+		as virtrdf:projact_ac_staff ;
+	opl:ac_en_date proj_act_tbl.ACENDATE
+		as virtrdf:projact_ac_en_date ;
+	opl:project opl:project_iri(proj_act_tbl.PROJNO)
+		as virtrdf:projact_project ;
+	opl:activity opl:act_iri(proj_act_tbl.ACTNO)
+		as virtrdf:projact_activity ;
+	opl:employee_activity_collection opl:emp_proj_act_iri(
+		emp_proj_act_tbl.EMPNO,
+		emp_proj_act_tbl.PROJNO,
+		emp_proj_act_tbl.ACTNO,
+		emp_proj_act_tbl.EMSTDATE
+		)
+		where (
+		^{proj_act_tbl.}^.PROJNO = ^{emp_proj_act_tbl.}^.PROJNO AND
+	        ^{proj_act_tbl.}^.ACTNO = ^{emp_proj_act_tbl.}^.ACTNO AND
+	        ^{proj_act_tbl.}^.ACSTDATE = ^{emp_proj_act_tbl.}^.EMSTDATE
+	        )
+		as virtrdf:project_employee_activity_collection .
+
+	opl:project_iri(project_tbl.PROJNO) a opl:Project
+		as virtrdf:project_id ;
+	opl:proj_no project_tbl.PROJNO
+		as virtrdf:project_proj_no ;
+	opl:proj_name project_tbl.PROJNAME
+		as virtrdf:project_proj_name ;
+	opl:is_project_of_department opl:department_iri(project_tbl.DEPTNO)
+		as virtrdf:project_is_project_of_department ;
+	opl:resp_emp opl:employee_iri(project_tbl.RESPEMP)
+		as virtrdf:project_resp_emp ;
+	opl:pr_staff project_tbl.PRSTAFF
+		as virtrdf:project_pr_staff ;
+	opl:pr_st_date project_tbl.PRSTDATE
+		as virtrdf:project_pr_st_date ;
+	opl:pr_en_date project_tbl.PRENDATE
+		as virtrdf:project_pr_en_date ;
+	opl:maj_proj project_tbl.MAJPROJ
+		as virtrdf:project_maj_proj ;
+	opl:proj_activity_collection opl:proj_act_iri(
+		proj_act_tbl.PROJNO,
+		proj_act_tbl.ACTNO,
+		proj_act_tbl.ACSTDATE
+		)
+		where (^{project_tbl.}^.PROJNO = ^{proj_act_tbl.}^.PROJNO)
+		as virtrdf:project_activity_collection .
+	} .
+} .
+;
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'db2sample_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'db2sample_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'db2sample_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/localhost:8890%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'db2sample_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/db2sample%%3E&format=%U',
+
+    vector('path','path','*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'db2sample_rule_list1',
+    1,
+    vector (
+  	 	'db2sample_rule1',
+  	 	'db2sample_rule2'
+	  ));
+
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/db2sample');
+
+VHOST_DEFINE (
+	lpath=>'/db2sample',
+	ppath=>'/DAV/db2sample/',
+	vsp_user=>'dba',
+    	is_dav=>1,
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'db2sample_rule_list1')
+	);
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'db2sample_schema_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'db2sample_schema_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'db2sample_schema_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/localhost:8890%U',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'db2sample_schema_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/db2sample%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path','path','*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'db2sample_schema_rule_list1',
+    1,
+    vector (
+  	 	'db2sample_schema_rule1',
+  	 	'db2sample_schema_rule2'
+	  ));
+
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/schemas/db2sample');
+
+VHOST_DEFINE (
+	lpath=>'/schemas/db2sample',
+	ppath=>'/DAV/schemas_db2sample/',
+	vsp_user=>'dba',
+    	is_dav=>1,
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'db2sample_schema_rule_list1')
+	);
+]]></programlisting>
+    </sect2>
+    <sect2 id="rdfviewsenterprinf">
+      <title>Informix using demonstration 'Stores' database</title>
+<programlisting><![CDATA[
+DB..vd_remote_data_source ('inf10_stores_demo_rdf', '', '<uid>','<pwd>');
+
+ATTACH TABLE  "informix"."call_type"  PRIMARY KEY ("call_code")                  AS "stores_demo_rdf"."inf10_stores_demo_rdf"."call_type"  FROM 'inf10_stores_demo_rdf';
+ATTACH TABLE  "informix"."catalog"    PRIMARY KEY ("catalog_num")                AS "stores_demo_rdf"."inf10_stores_demo_rdf"."catalog"    FROM 'inf10_stores_demo_rdf';
+ATTACH TABLE  "informix"."cust_calls" PRIMARY KEY ("customer_num", "call_dtime") AS "stores_demo_rdf"."inf10_stores_demo_rdf"."cust_calls" FROM 'inf10_stores_demo_rdf';
+ATTACH TABLE  "informix"."customer"   PRIMARY KEY ("customer_num")               AS "stores_demo_rdf"."inf10_stores_demo_rdf"."customer"   FROM 'inf10_stores_demo_rdf';
+ATTACH TABLE  "informix"."items"      PRIMARY KEY ("item_num", "order_num")      AS "stores_demo_rdf"."inf10_stores_demo_rdf"."items"      FROM 'inf10_stores_demo_rdf';
+ATTACH TABLE  "informix"."manufact"   PRIMARY KEY ("manu_code")                  AS "stores_demo_rdf"."inf10_stores_demo_rdf"."manufact"   FROM 'inf10_stores_demo_rdf';
+ATTACH TABLE  "informix"."msgs"       PRIMARY KEY ("lang", "number", "message")  AS "stores_demo_rdf"."inf10_stores_demo_rdf"."msgs"       FROM 'inf10_stores_demo_rdf';
+ATTACH TABLE  "informix"."orders"     PRIMARY KEY ("order_num")                  AS "stores_demo_rdf"."inf10_stores_demo_rdf"."orders"     FROM 'inf10_stores_demo_rdf';
+ATTACH TABLE  "informix"."state"      PRIMARY KEY ("code", "sname")              AS "stores_demo_rdf"."inf10_stores_demo_rdf"."state"      FROM 'inf10_stores_demo_rdf';
+ATTACH TABLE  "informix"."stock"      PRIMARY KEY ("stock_num", "manu_code")     AS "stores_demo_rdf"."inf10_stores_demo_rdf"."stock"      FROM 'inf10_stores_demo_rdf';
+
+COMMIT WORK;
+
+GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.items      TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.catalog    TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.msgs       TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.state      TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.orders     TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.stock      TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.customer   TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.call_type  TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.manufact   TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON stores_demo_rdf.inf10_stores_demo_rdf.cust_calls TO "SPARQL", "SPARQL_UPDATE";
+GRANT SPARQL_UPDATE to "SPARQL";
+
+
+create function DB.DBA.CUST_CALLS_IRI (in customer_num integer, in call_dtime datetime) returns varchar
+{
+	declare _call_dtime any;
+	_call_dtime := cast(call_dtime as varchar);
+	return sprintf('http://localhost:8890/informix/stores_demo/cust_calls/%d_%U#this', customer_num, _call_dtime);
+};
+
+create function DB.DBA.CUST_CALLS_IRI_INV_1 (in cust_calls_iri varchar) returns integer
+{
+	declare parts any;
+	parts := sprintf_inverse(cust_calls_iri, 'http://localhost:8890/informix/stores_demo/cust_calls/%d_%U#this', 1);
+	if(parts is not null)
+	{
+		return parts[0];
+	}
+	return NULL;
+};
+
+create function DB.DBA.CUST_CALLS_IRI_INV_2 (in cust_calls_iri varchar) returns datetime
+{
+	declare parts any;
+	parts := sprintf_inverse(cust_calls_iri, 'http://localhost:8890/informix/stores_demo/cust_calls/%d_%U#this', 1);
+	if(parts is not null)
+	{
+		return parts[1];
+	}
+	return NULL;
+};
+
+
+grant execute on DB.DBA.CUST_CALLS_IRI to "SPARQL", "SPARQL_UPDATE";
+grant execute on DB.DBA.CUST_CALLS_IRI_INV_1 to "SPARQL", "SPARQL_UPDATE";
+grant execute on DB.DBA.CUST_CALLS_IRI_INV_2 to "SPARQL", "SPARQL_UPDATE";
+
+
+-------- Create rdfs:Class definitions ----------------------------
+
+ttlp (
+'
+ at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+ at prefix items:   <http://localhost:8890/schemas/informix/stores_demo/items/> .
+ at prefix catalog: <http://localhost:8890/schemas/informix/stores_demo/catalog/> .
+ at prefix stock:   <http://localhost:8890/schemas/informix/stores_demo/stock/> .
+ at prefix msgs:    <http://localhost:8890/schemas/informix/stores_demo/msgs/> .
+ at prefix state:   <http://localhost:8890/schemas/informix/stores_demo/state/> .
+ at prefix orders:  <http://localhost:8890/schemas/informix/stores_demo/orders/> .
+ at prefix manuf:   <http://localhost:8890/schemas/informix/stores_demo/manufact/> .
+ at prefix cust:    <http://localhost:8890/schemas/informix/stores_demo/customer/> .
+ at prefix callt:   <http://localhost:8890/schemas/informix/stores_demo/call_type/> .
+ at prefix custc:   <http://localhost:8890/schemas/informix/stores_demo/cust_calls/> .
+
+
+
+items:Items a rdfs:Class ;
+	rdfs:label "Items" ;
+	rdfs:comment "Informix SD items table" .
+
+items:item_num a rdf:Property ;
+	rdfs:domain items:Items ;
+	rdfs:range xsd:integer ;
+	rdfs:label "ITEM NUMBER" .
+
+items:quantity a rdf:Property ;
+	rdfs:domain items:Items ;
+	rdfs:range xsd:integer ;
+	rdfs:label "QUANTITY" .
+
+items:total_price a rdf:Property ;
+	rdfs:domain items:Items ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "TOTAL PRICE" .
+
+items:order_num_fk a rdf:Property ;
+	rdfs:domain items:Items ;
+	rdfs:range orders:Orders ;
+	rdfs:label "ORDER NUMBER" .
+
+items:stock_num_fk a rdf:Property ;
+	rdfs:domain items:Items ;
+	rdfs:range stock:Stock ;
+	rdfs:label "STOCK NUMBER" .
+
+items:manu_code_fk a rdf:Property ;
+	rdfs:domain items:Items ;
+	rdfs:range stock:Stock ;
+	rdfs:label "MANUAL CODE" .
+
+
+
+catalog:Catalog a rdfs:Class ;
+	rdfs:label "Catalog" ;
+	rdfs:comment "Informix SD catalog table" .
+
+catalog:manu_code a rdf:Property ;
+	rdfs:domain catalog:Catalog ;
+	rdfs:range xsd:integer ;
+	rdfs:label "MANUAL CODE" .
+
+catalog:cat_descr a rdf:Property ;
+	rdfs:domain catalog:Catalog ;
+	rdfs:range xsd:string ;
+	rdfs:label "CATALOG DESCRIPTION" .
+
+catalog:cat_picture a rdf:Property ;
+	rdfs:domain catalog:Catalog ;
+	rdfs:range xsd:byte ;
+	rdfs:label "CATALOG PICTURE" .
+
+catalog:cat_advert a rdf:Property ;
+	rdfs:domain catalog:Catalog ;
+	rdfs:range xsd:string ;
+	rdfs:label "CATALOG ADVERT" .
+
+catalog:catalog_num_fk a rdf:Property ;
+	rdfs:domain catalog:Catalog ;
+	rdfs:range stock:Stock ;
+	rdfs:label "CATALOG NUMBER" .
+
+catalog:stock_num_fk a rdf:Property ;
+	rdfs:domain catalog:Catalog ;
+	rdfs:range stock:Stock ;
+	rdfs:label "STOCK NUMBER" .
+
+
+
+msgs:Msgs a rdfs:Class ;
+	rdfs:label "Msgs" ;
+	rdfs:comment "Informix SD msgs table" .
+
+msgs:lang a rdf:Property ;
+	rdfs:domain msgs:Msgs ;
+	rdfs:range xsd:string ;
+	rdfs:label "LANGUAGE" .
+
+msgs:number a rdf:Property ;
+	rdfs:domain msgs:Msgs ;
+	rdfs:range xsd:integer ;
+	rdfs:label "NUMBER" .
+
+msgs:message a rdf:Property ;
+	rdfs:domain msgs:Msgs ;
+	rdfs:range xsd:string ;
+	rdfs:label "MESSAGE" .
+
+
+
+state:State a rdfs:Class ;
+	rdfs:label "State" ;
+	rdfs:comment "Informix SD state table" .
+
+state:code a rdf:Property ;
+	rdfs:domain state:State ;
+	rdfs:range xsd:string ;
+	rdfs:label "STATE CODE" .
+
+state:sname a rdf:Property ;
+	rdfs:domain state:State ;
+	rdfs:range xsd:string ;
+	rdfs:label "STATE NAME" .
+
+
+
+orders:Orders a rdfs:Class ;
+	rdfs:label "Orders" ;
+	rdfs:comment "Informix SD orders table" .
+
+orders:order_num a rdf:Property ;
+	rdfs:domain orders:Orders ;
+	rdfs:range xsd:integer ;
+	rdfs:label "ORDER NUMBER" .
+
+orders:order_date a rdf:Property ;
+	rdfs:domain orders:Orders ;
+	rdfs:range xsd:date ;
+	rdfs:label "ORDER DATE" .
+
+orders:ship_instruct a rdf:Property ;
+	rdfs:domain orders:Orders ;
+	rdfs:range xsd:string ;
+	rdfs:label "SHIPPING INSTRUCTION" .
+
+orders:backlog a rdf:Property ;
+	rdfs:domain orders:Orders ;
+	rdfs:range xsd:string ;
+	rdfs:label "BACKLOG" .
+
+orders:po_num a rdf:Property ;
+	rdfs:domain orders:Orders ;
+	rdfs:range xsd:string ;
+	rdfs:label "PURCHASE ORDER NUMBER" .
+
+orders:ship_date a rdf:Property ;
+	rdfs:domain orders:Orders ;
+	rdfs:range xsd:date ;
+	rdfs:label "SHIPPING DATE" .
+
+orders:ship_weight a rdf:Property ;
+	rdfs:domain orders:Orders ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "SHIPPING WEIGHT" .
+
+orders:ship_charge a rdf:Property ;
+	rdfs:domain orders:Orders ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "SHIPPING CHARGE" .
+
+orders:paid_date a rdf:Property ;
+	rdfs:domain orders:Orders ;
+	rdfs:range xsd:date ;
+	rdfs:label "PAID DATE" .
+
+orders:customer_num_fk a rdf:Property ;
+	rdfs:domain orders:Orders ;
+	rdfs:range cust:Customer ;
+	rdfs:label "CUSTOMER NUMBER" .
+
+
+
+stock:Stock a rdfs:Class ;
+	rdfs:label "Stock" ;
+	rdfs:comment "Informix SD stock table" .
+
+stock:stock_num a rdf:Property ;
+	rdfs:domain stock:Stock ;
+	rdfs:range xsd:integer ;
+	rdfs:label "STOCK NUMBER" .
+
+stock:description a rdf:Property ;
+	rdfs:domain stock:Stock ;
+	rdfs:range xsd:string ;
+	rdfs:label "DESCRIPTION" .
+
+stock:unit_price a rdf:Property ;
+	rdfs:domain stock:Stock ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "UNIT PRICE" .
+
+stock:unit a rdf:Property ;
+	rdfs:domain stock:Stock ;
+	rdfs:range xsd:string ;
+	rdfs:label "UNIT" .
+
+stock:unit_descr a rdf:Property ;
+	rdfs:domain stock:Stock ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "UNIT DESCRIPTION" .
+
+stock:manu_code_fk a rdf:Property ;
+	rdfs:domain stock:Stock ;
+	rdfs:range manuf:Manufact ;
+	rdfs:label "MANUAL CODE" .
+
+
+
+cust:Customer a rdfs:Class ;
+	rdfs:label "Customer" ;
+	rdfs:comment "Informix SD customer table" .
+
+cust:customer_num a rdf:Property ;
+	rdfs:domain cust:Customer ;
+	rdfs:range xsd:integer ;
+	rdfs:label "CUSTOMER NUMBER" .
+
+cust:fname a rdf:Property ;
+	rdfs:domain cust:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "FIRST NAME" .
+
+cust:lname a rdf:Property ;
+	rdfs:domain cust:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "LAST NAME" .
+
+cust:company a rdf:Property ;
+	rdfs:domain cust:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "COMPANY" .
+
+cust:address1 a rdf:Property ;
+	rdfs:domain cust:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "ADDRESS1" .
+
+cust:address2 a rdf:Property ;
+	rdfs:domain cust:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "ADDRESS2" .
+
+cust:city a rdf:Property ;
+	rdfs:domain cust:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "CITY" .
+
+cust:state a rdf:Property ;
+	rdfs:domain cust:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "STATE" .
+
+cust:zipcode a rdf:Property ;
+	rdfs:domain cust:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "ZIP CODE" .
+
+cust:phone a rdf:Property ;
+	rdfs:domain cust:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "PHONE NUMBER" .
+
+
+
+callt:Call_type a rdfs:Class ;
+	rdfs:label "Call_type" ;
+	rdfs:comment "Informix SD call_type table" .
+
+callt:call_code a rdf:Property ;
+	rdfs:domain callt:Call_type ;
+	rdfs:range xsd:string ;
+	rdfs:label "CALL CODE" .
+
+callt:code_descr a rdf:Property ;
+	rdfs:domain callt:Call_type ;
+	rdfs:range xsd:string ;
+	rdfs:label "CODE DESCRIPTION" .
+
+
+
+manuf:Manufact a rdfs:Class ;
+	rdfs:label "Manufact" ;
+	rdfs:comment "Informix SD manufact table" .
+
+manuf:manu_code a rdf:Property ;
+	rdfs:domain manuf:Manufact ;
+	rdfs:range xsd:string ;
+	rdfs:label "MANUFACTURE CODE" .
+
+manuf:manu_name a rdf:Property ;
+	rdfs:domain manuf:Manufact ;
+	rdfs:range xsd:string ;
+	rdfs:label "MANUFACTURE NAME" .
+
+manuf:lead_time a rdf:Property ;
+	rdfs:domain manuf:Manufact ;
+	rdfs:range xsd:integer ;
+	rdfs:label "LEAD TIME" .
+
+
+
+custc:Cust_calls a rdfs:Class ;
+	rdfs:label "Cust_calls" ;
+	rdfs:comment "Informix SD cust_calls table" .
+
+custc:call_dtime a rdf:Property ;
+	rdfs:domain manuf:Cust_calls ;
+	rdfs:range xsd:datetime ;
+	rdfs:label "CALL TIME" .
+
+custc:user_id a rdf:Property ;
+	rdfs:domain manuf:Cust_calls ;
+	rdfs:range xsd:string ;
+	rdfs:label "USER ID" .
+
+custc:call_descr a rdf:Property ;
+	rdfs:domain manuf:Cust_calls ;
+	rdfs:range xsd:string ;
+	rdfs:label "CALL DESCRIPTION" .
+
+custc:res_dtime a rdf:Property ;
+	rdfs:domain manuf:Cust_calls ;
+	rdfs:range xsd:datetime ;
+	rdfs:label "RES TIME" .
+
+custc:res_descr a rdf:Property ;
+	rdfs:domain manuf:Cust_calls ;
+	rdfs:range xsd:string ;
+	rdfs:label "RES DESCRIPTION" .
+
+custc:customer_num_fk a rdf:Property ;
+	rdfs:domain manuf:Cust_calls ;
+	rdfs:range cust:Customer ;
+	rdfs:label "CUSTOMER NUM" .
+
+custc:call_code_fk a rdf:Property ;
+	rdfs:domain manuf:Cust_calls ;
+	rdfs:range callt:Call_type ;
+	rdfs:label "CALL CODE" .
+
+
+', '', 'http://localhost:8890/schemas/informix/stores_demo', 0);
+
+
+
+----------- Create IRI Classes -------------
+
+
+
+
+SPARQL
+
+prefix items:   <http://localhost:8890/schemas/informix/stores_demo/items/>
+prefix catalog: <http://localhost:8890/schemas/informix/stores_demo/catalog/>
+prefix stock:   <http://localhost:8890/schemas/informix/stores_demo/stock/>
+prefix msgs:    <http://localhost:8890/schemas/informix/stores_demo/msgs/>
+prefix state:   <http://localhost:8890/schemas/informix/stores_demo/state/>
+prefix orders:  <http://localhost:8890/schemas/informix/stores_demo/orders/>
+prefix manuf:   <http://localhost:8890/schemas/informix/stores_demo/manufact/>
+prefix cust:    <http://localhost:8890/schemas/informix/stores_demo/customer/>
+prefix callt:   <http://localhost:8890/schemas/informix/stores_demo/call_type/>
+prefix custc:   <http://localhost:8890/schemas/informix/stores_demo/cust_calls/>
+
+create iri class items:items_iri
+	"http://localhost:8890/informix/stores_demo/items/%d_%d#this"
+	(in item_num integer not null, in order_num integer not null) .
+
+create iri class catalog:catalog_iri
+	"http://localhost:8890/informix/stores_demo/catalog/%d#this"
+    	(in catalog_num integer not null) .
+
+create iri class msgs:msgs_iri
+	"http://localhost:8890/informix/stores_demo/msgs/%U_%d_%U#this"
+    	(in _lang varchar not null, in number integer not null, in message varchar not null) .
+
+create iri class state:state_iri
+	"http://localhost:8890/informix/stores_demo/state/%U#this"
+    	(in code varchar not null) .
+
+create iri class orders:orders_iri
+	"http://localhost:8890/informix/stores_demo/orders/%d#this"
+    	(in order_num integer not null) .
+
+create iri class stock:stock_iri
+	"http://localhost:8890/informix/stores_demo/stock/%d_%U#this"
+    	(in stock_num integer not null, in manu_code varchar not null) .
+
+create iri class cust:customer_iri
+	"http://localhost:8890/informix/stores_demo/customer/%d#this"
+    	(in customer_num integer not null) .
+
+create iri class callt:call_type_iri
+	"http://localhost:8890/informix/stores_demo/call_type/%U#this"
+    	(in call_code varchar not null) .
+
+create iri class manuf:manufact_iri
+	"http://localhost:8890/informix/stores_demo/manufact/%U#this"
+    	(in manu_code varchar not null) .
+
+create iri class custc:cust_calls_iri using
+	function DB.DBA.CUST_CALLS_IRI (in customer_num integer, in call_dtime datetime) returns varchar,
+	function DB.DBA.CUST_CALLS_IRI_INV_1 (in cust_calls_iri varchar) returns integer,
+        function DB.DBA.CUST_CALLS_IRI_INV_2 (in cust_calls_iri varchar) returns datetime .
+;
+
+
+
+
+
+
+
+------------- Create Quad Store ------------------------------------
+
+SPARQL
+
+prefix items:   <http://localhost:8890/schemas/informix/stores_demo/items/>
+prefix catalog: <http://localhost:8890/schemas/informix/stores_demo/catalog/>
+prefix stock:   <http://localhost:8890/schemas/informix/stores_demo/stock/>
+prefix msgs:    <http://localhost:8890/schemas/informix/stores_demo/msgs/>
+prefix state:   <http://localhost:8890/schemas/informix/stores_demo/state/>
+prefix orders:  <http://localhost:8890/schemas/informix/stores_demo/orders/>
+prefix manuf:   <http://localhost:8890/schemas/informix/stores_demo/manufact/>
+prefix cust:    <http://localhost:8890/schemas/informix/stores_demo/customer/>
+prefix callt:   <http://localhost:8890/schemas/informix/stores_demo/call_type/>
+prefix custc:   <http://localhost:8890/schemas/informix/stores_demo/cust_calls/>
+
+alter quad storage virtrdf:DefaultQuadStorage
+  from stores_demo_rdf.inf10_stores_demo_rdf.items      as items_tbl
+  from stores_demo_rdf.inf10_stores_demo_rdf.catalog    as catalog_tbl
+  from stores_demo_rdf.inf10_stores_demo_rdf.msgs       as msgs_tbl
+  from stores_demo_rdf.inf10_stores_demo_rdf.state      as state_tbl
+  from stores_demo_rdf.inf10_stores_demo_rdf.orders     as orders_tbl
+  from stores_demo_rdf.inf10_stores_demo_rdf.stock      as stock_tbl
+  from stores_demo_rdf.inf10_stores_demo_rdf.customer   as customer_tbl
+  from stores_demo_rdf.inf10_stores_demo_rdf.call_type  as call_type_tbl
+  from stores_demo_rdf.inf10_stores_demo_rdf.manufact   as manufact_tbl
+  from stores_demo_rdf.inf10_stores_demo_rdf.cust_calls as cust_calls_tbl
+{
+  create virtrdf:informix_stores_demo as graph <http://localhost:8890/informix/stores_demo>
+  {
+    items:items_iri (items_tbl.item_num, items_tbl.order_num) a items:Items as virtrdf:items_pk ;
+    items:item_num    items_tbl.item_num       as virtrdf:items_item_num ;
+    items:order_num   items_tbl.order_num      as virtrdf:items_order_num ;
+    items:stock_num   items_tbl.stock_num      as virtrdf:items_stock_num ;
+    items:manu_code   items_tbl.manu_code      as virtrdf:items_manu_code ;
+    items:quantity    items_tbl.quantity       as virtrdf:items_quantity ;
+    items:total_price items_tbl.total_price    as virtrdf:items_total_price ;
+    items:from_order  orders:orders_iri (orders_tbl.order_num) where (^{items_tbl.}^.order_num = ^{orders_tbl.}^.order_num) as virtrdf:Items-from_order ;
+    items:has_stock   stock:stock_iri (stock_tbl.stock_num, stock_tbl.manu_code) where (^{items_tbl.}^.stock_num = ^{stock_tbl.}^.stock_num and ^{items_tbl.}^.manu_code = ^{stock_tbl.}^.manu_code)  as virtrdf:Item-has_stock .
+
+    catalog:catalog_iri (catalog_tbl.catalog_num) a catalog:Catalog as virtrdf:catalog_num;
+    catalog:stock_num   catalog_tbl.stock_num    as virtrdf:catalog_stock_num ;
+    catalog:manu_code   catalog_tbl.manu_code    as virtrdf:catalog_manu_code ;
+    catalog:cat_descr   catalog_tbl.cat_descr    as virtrdf:catalog_cat_descr ;
+    catalog:cat_picture catalog_tbl.cat_picture  as virtrdf:catalog_cat_picture ;
+    catalog:cat_advert  catalog_tbl.cat_advert   as virtrdf:catalog_cat_advert ;
+    catalog:has_stock   stock:stock_iri (stock_tbl.stock_num, stock_tbl.manu_code) where (^{catalog_tbl.}^.stock_num = ^{stock_tbl.}^.stock_num and ^{catalog_tbl.}^.manu_code = ^{stock_tbl.}^.manu_code)  as virtrdf:Catalog-has_stock .
+
+    msgs:msgs_iri (msgs_tbl.lang, msgs_tbl.number, msgs_tbl.message) a msgs:Msgs as virtrdf:msgs_pk ;
+    msgs:lang     msgs_tbl.lang    as virtrdf:msgs_lang ;
+    msgs:number   msgs_tbl.number  as virtrdf:msgs_number ;
+    msgs:message  msgs_tbl.message as virtrdf:msgs_message .
+
+    state:state_iri (state_tbl.code) a state:State as virtrdf:code ;
+    state:code   state_tbl.code   as virtrdf:state_code ;
+    state:sname  state_tbl.sname  as virtrdf:state_sname .
+
+    orders:orders_iri (orders_tbl.order_num) a orders:Orders as virtrdf:order_num ;
+    orders:order_num     orders_tbl.order_num     as virtrdf:orders_order_num ;
+    orders:order_date    orders_tbl.order_date    as virtrdf:orders_order_date ;
+    orders:customer_num  orders_tbl.customer_num  as virtrdf:orders_customer_num ;
+    orders:ship_instruct orders_tbl.ship_instruct as virtrdf:orders_ship_instruct ;
+    orders:backlog       orders_tbl.backlog       as virtrdf:orders_backlog ;
+    orders:po_num        orders_tbl.po_num        as virtrdf:orders_po_num ;
+    orders:ship_date     orders_tbl.ship_date     as virtrdf:orders_ship_date ;
+    orders:ship_weight   orders_tbl.ship_weight   as virtrdf:orders_ship_weight ;
+    orders:ship_charge   orders_tbl.ship_charge   as virtrdf:orders_ship_charge ;
+    orders:paid_date     orders_tbl.paid_date     as virtrdf:orders_paid_date ;
+    orders:has_customer cust:customer_iri (customer_tbl.customer_num) where (^{orders_tbl.}^.customer_num = ^{customer_tbl.}^.customer_num) as virtrdf:Orders-has_customer ;
+    orders:has_item     items:items_iri (items_tbl.item_num, items_tbl.order_num) where (^{orders_tbl.}^.order_num = ^{items_tbl.}^.order_num) as virtrdf:Orders-has_item .
+
+    stock:stock_iri (stock_tbl.stock_num, stock_tbl.manu_code) a stock:Stock as virtrdf:stock_pk ;
+    stock:stock_num    stock_tbl.stock_num    as virtrdf:stock_stock_num ;
+    stock:manu_code    stock_tbl.manu_code    as virtrdf:stock_manu_code ;
+    stock:description  stock_tbl.description  as virtrdf:stock_description ;
+    stock:unit_price   stock_tbl.unit_price   as virtrdf:stock_unit_price ;
+    stock:unit         stock_tbl.unit         as virtrdf:stock_unit ;
+    stock:unit_descr   stock_tbl.unit_descr   as virtrdf:stock_unit_descr ;
+    stock:manufactured_by manuf:manufact_iri (manufact_tbl.manu_code) where (^{stock_tbl.}^.manu_code = ^{manufact_tbl.}^.manu_code) as virtrdf:Stock-manufactured_by ;
+    stock:in_catalog  catalog:catalog_iri (catalog_tbl.catalog_num) where (^{stock_tbl.}^.stock_num = ^{catalog_tbl.}^.stock_num and ^{stock_tbl.}^.manu_code = ^{catalog_tbl.}^.manu_code) as virtrdf:Stock-in_catalog ;
+    stock:in_item     items:items_iri (items_tbl.item_num, items_tbl.order_num) where (^{stock_tbl.}^.stock_num = ^{items_tbl.}^.stock_num and ^{stock_tbl.}^.manu_code = ^{items_tbl.}^.manu_code) as virtrdf:Stock-in_items .
+
+
+    cust:customer_iri (customer_tbl.customer_num) a cust:Customer as virtrdf:customer_num ;
+    cust:customer_num  customer_tbl.customer_num  as virtrdf:customer_customer_num ;
+    cust:fname         customer_tbl.fname         as virtrdf:customer_fname ;
+    cust:lname         customer_tbl.lname         as virtrdf:customer_lname ;
+    cust:company       customer_tbl.company       as virtrdf:customer_company ;
+    cust:address1      customer_tbl.address1      as virtrdf:customer_address1 ;
+    cust:address2      customer_tbl.address2      as virtrdf:customer_address2 ;
+    cust:city          customer_tbl.city          as virtrdf:customer_city ;
+    cust:state         customer_tbl.state         as virtrdf:customer_state ;
+    cust:zipcode       customer_tbl.zipcode       as virtrdf:customer_zipcode ;
+    cust:phone         customer_tbl.phone         as virtrdf:customer_phone ;
+    cust:placed_order orders:orders_iri (orders_tbl.order_num) where (^{customer_tbl.}^.customer_num = ^{orders_tbl.}^.customer_num) as virtrdf:Customer-placed_order ;
+    cust:made_call    custc:cust_calls_iri (cust_calls_tbl.customer_num, cust_calls_tbl.call_dtime ) where (^{customer_tbl.}^.customer_num = ^{cust_calls_tbl.}^.customer_num) as virtrdf:Cust_calls-made_call .
+
+    callt:call_type_iri (call_type_tbl.call_code) a callt:Call_type as virtrdf:call_code ;
+    callt:call_code   call_type_tbl.call_code as virtrdf:call_type_call_code ;
+    callt:code_descr  call_type_tbl.code_descr as virtrdf:call_type_code_descr ;
+    callt:call_is_type  custc:cust_calls_iri (cust_calls_tbl.customer_num, cust_calls_tbl.call_dtime) where (^{call_type_tbl.}^.call_code = ^{cust_calls_tbl.}^.call_code) as virtrdf:Call_type-call_is_type .
+
+    manuf:manufact_iri (manufact_tbl.manu_code) a manuf:Manufact as virtrdf:manu_code ;
+    manuf:manu_code     manufact_tbl.manu_code   as virtrdf:manufact_tbl_manu_code ;
+    manuf:manu_name     manufact_tbl.manu_name   as virtrdf:manufact_tbl_manu_name ;
+    manuf:lead_time     manufact_tbl.lead_time   as virtrdf:manufact_tbl_lead_time ;
+    manuf:manufactures stock:stock_iri (stock_tbl.stock_num, stock_tbl.manu_code) where (^{manufact_tbl.}^.manu_code = ^{stock_tbl.}^.manu_code) as virtrdf:Manufact-manufactures .
+
+    custc:cust_calls_iri  (cust_calls_tbl.customer_num, cust_calls_tbl.call_dtime) a custc:Cust_calls as virtrdf:cust_calls_pk ;
+    custc:user_id    cust_calls_tbl.user_id      as virtrdf:cust_calls_user_id ;
+    custc:call_code  cust_calls_tbl.call_code    as virtrdf:cust_calls_call_code ;
+    custc:call_descr cust_calls_tbl.call_descr   as virtrdf:cust_calls_call_descr ;
+    custc:res_dtime  cust_calls_tbl.res_dtime    as virtrdf:cust_calls_res_dtime ;
+    custc:res_descr  cust_calls_tbl.res_descr    as virtrdf:cust_calls_res_descr ;
+    custc:made_by_customer cust:customer_iri   (customer_tbl.customer_num) where (^{cust_calls_tbl.}^.customer_num = ^{customer_tbl.}^.customer_num) as virtrdf:Cust_calls-made_by_customer ;
+    custc:is_call_type     callt:call_type_iri (call_type_tbl.call_code)   where (^{cust_calls_tbl.}^.call_code    = ^{call_type_tbl.}^.call_code)   as virtrdf:Cust_calls-is_call_type .
+
+  } .
+} .
+;
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'informix_sd_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'informix_sd_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'informix_sd_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'informix_sd_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/informix/stores_demo%%3E&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'informix_sd_rule_list1',
+    1,
+    vector (
+  	 	'informix_sd_rule1',
+  	 	'informix_sd_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/informix/stores_demo');
+
+VHOST_DEFINE (
+	lpath=>'/informix/stores_demo',
+	ppath=>'/DAV/informix/stores_demo/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'informix_sd_rule_list1')
+	);
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'informix_sd_schemas_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'informix_sd_schemas_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'informix_sd_schemas_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'informix_sd_schemas_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/informix/stores_demo%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path','path','*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'informix_sd_schemas_rule_list1',
+    1,
+    vector (
+  	 	'informix_sd_schemas_rule1',
+  	 	'informix_sd_schemas_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/schemas/informix/stores_demo');
+
+VHOST_DEFINE (
+	lpath=>'/schemas/informix/stores_demo',
+	ppath=>'/DAV/schemas/informix/stores_demo/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'informix_sd_schemas_rule_list1')
+	);
+
+DB.DBA.XML_SET_NS_DECL ('items',   'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/items/', 2);
+DB.DBA.XML_SET_NS_DECL ('catalog', 'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/catalog/', 2);
+DB.DBA.XML_SET_NS_DECL ('stock',   'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/stock/', 2);
+DB.DBA.XML_SET_NS_DECL ('msgs',    'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/msgs/', 2);
+DB.DBA.XML_SET_NS_DECL ('state',   'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/state/', 2);
+DB.DBA.XML_SET_NS_DECL ('orders',  'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/orders/', 2);
+DB.DBA.XML_SET_NS_DECL ('manuf',   'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/manufact/', 2);
+DB.DBA.XML_SET_NS_DECL ('cust',    'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/customer/', 2);
+DB.DBA.XML_SET_NS_DECL ('callt',   'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/call_type/', 2);
+DB.DBA.XML_SET_NS_DECL ('custc',   'http://^{URIQADefaultHost}^/schemas/informix/stores_demo/cust_calls/', 2);
+]]></programlisting>
+    </sect2>
+    <sect2 id="rdfviewsenterpringr">
+      <title>Ingres using demonstration 'Tutorial' database</title>
+<programlisting><![CDATA[
+-- Setup script for RDF views of Ingres R3 Tutorial Sample Database --
+
+DB..vd_remote_data_source ('ingiima-tut', '', '<uid>','<pwd>');
+
+ATTACH TABLE  "ingres"."book_list"      PRIMARY KEY ("book_no")              AS "TUT"."ingiima"."book_list"      FROM 'ingiima-tut';
+ATTACH TABLE  "ingres"."book_orders"      PRIMARY KEY ("order_no")              AS "TUT"."ingiima"."book_orders"      FROM 'ingiima-tut';
+ATTACH TABLE  "ingres"."cust_info"      PRIMARY KEY ("cust_no")              AS "TUT"."ingiima"."cust_info"      FROM 'ingiima-tut';
+ATTACH TABLE  "ingres"."cust_orders"      PRIMARY KEY ("order_no")              AS "TUT"."ingiima"."cust_orders"      FROM 'ingiima-tut';
+
+COMMIT WORK;
+
+GRANT SELECT ON TUT.ingiima.book_list TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON TUT.ingiima.book_orders TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON TUT.ingiima.cust_info TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON TUT.ingiima.cust_orders TO "SPARQL", "SPARQL_UPDATE";
+
+-------------------------------------------------------------------
+
+-------- Create rdfs:Class definitions ----------------------------
+
+ttlp (
+'
+ at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+ at prefix tut: <http://localhost:8890/schemas/ingrestut/> .
+
+tut:book_list a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/ingrestut> ;
+	rdfs:label "book_list" ;
+	rdfs:comment "Ingres Tutorial Database book_list table" .
+
+tut:book_no a rdf:Property ;
+	rdfs:domain tut:book_list ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Book No" .
+
+tut:title a rdf:Property ;
+	rdfs:domain tut:book_list ;
+	rdfs:range xsd:string ;
+	rdfs:label "Title" .
+
+tut:author a rdf:Property ;
+	rdfs:domain tut:book_list ;
+	rdfs:range xsd:string ;
+	rdfs:label "Author" .
+
+tut:price a rdf:Property ;
+	rdfs:domain tut:book_list ;
+	rdfs:range xsd:money;
+	rdfs:label "Price" .
+
+tut:category a rdf:Property ;
+	rdfs:domain tut:book_list ;
+	rdfs:range xsd:string ;
+	rdfs:label "Category" .
+
+tut:stock a rdf:Property ;
+	rdfs:domain tut:book_list ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Stock" .
+
+tut:dist_no a rdf:Property ;
+	rdfs:domain tut:book_list ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Dist No" .
+
+tut:book_orders a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/ingrestut> ;
+	rdfs:label "Book Orders" ;
+	rdfs:comment "Ingres Tutorial Database book_orders table" .
+
+tut:order_no a rdf:Property ;
+	rdfs:domain tut:book_orders ;
+	rdfs:range xsd:integer ;
+         rdfs:label "Order No" .
+
+tut:book_no_no a rdf:Property ;
+	rdfs:domain tut:book_orders ;
+	rdfs:range tut:book_list ;
+         rdfs:label "Book No" .
+
+tut:sale_price a rdf:Property ;
+	rdfs:domain tut:book_orders ;
+	rdfs:range xsd:money ;
+         rdfs:label "Sale Price" .
+
+tut:quantity a rdf:Property ;
+	rdfs:domain tut:book_orders ;
+	rdfs:range xsd:integer ;
+         rdfs:label "Quantity" .
+
+tut:extension a rdf:Property ;
+	rdfs:domain tut:book_orders ;
+	rdfs:range xsd:money ;
+         rdfs:label "Extension" .
+
+tut:cust_info a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/ingrestut> ;
+	rdfs:label "Customer Information" ;
+	rdfs:comment "Ingres Tutorial Database cust_info table" .
+
+tut:cust_no a rdf:Property ;
+	rdfs:domain tut:cust_info ;
+	rdfs:range xsd:integer ;
+         rdfs:label "Customer No" .
+
+tut:name a rdf:Property ;
+	rdfs:domain tut:cust_info ;
+	rdfs:range xsd:string ;
+         rdfs:label "Name" .
+
+tut:company a rdf:Property ;
+	rdfs:domain tut:cust_info ;
+	rdfs:range xsd:string ;
+         rdfs:label "Company" .
+
+tut:street a rdf:Property ;
+	rdfs:domain tut:cust_info ;
+	rdfs:range xsd:string;
+         rdfs:label "Street" .
+
+tut:city a rdf:Property ;
+	rdfs:domain tut:cust_info ;
+	rdfs:range xsd:string;
+         rdfs:label "City" .
+
+tut:state a rdf:Property ;
+	rdfs:domain tut:cust_info ;
+	rdfs:range xsd:string;
+         rdfs:label "State" .
+
+tut:city a rdf:Property ;
+	rdfs:domain tut:cust_info ;
+	rdfs:range xsd:string;
+         rdfs:label "City" .
+
+tut:state a rdf:Property ;
+	rdfs:domain tut:cust_info ;
+	rdfs:range xsd:string;
+         rdfs:label "State" .
+
+tut:zip a rdf:Property ;
+	rdfs:domain tut:cust_info ;
+	rdfs:range xsd:string;
+         rdfs:label "Zip Code" .
+
+tut:card_no a rdf:Property ;
+	rdfs:domain tut:cust_info ;
+	rdfs:range xsd:string;
+         rdfs:label "Card No" .
+
+tut:exp_date a rdf:Property ;
+	rdfs:domain tut:cust_info ;
+	rdfs:range xsd:date;
+         rdfs:label "Expire Date" .
+
+tut:ship_to a rdf:Property ;
+	rdfs:domain tut:cust_info ;
+	rdfs:range xsd:string;
+         rdfs:label "Ship To" .
+
+tut:cust_orders a rdfs:Class ;
+	rdfs:isDefinedBy <http://localhost:8890/schemas/ingrestut> ;
+	rdfs:label "Customer Orders" ;
+	rdfs:comment "Ingres Tutorial Database cust_orders table" .
+
+tut:order_no a rdf:Property ;
+	rdfs:domain tut:cust_orders ;
+	rdfs:range tut:book_orders ;
+         rdfs:label "Order No" .
+
+tut:book_no a rdf:Property ;
+	rdfs:domain tut:cust_orders ;
+	rdfs:range tut:cust_info ;
+         rdfs:label "Book No" .
+
+tut:order_date a rdf:Property ;
+	rdfs:domain tut:cust_orders ;
+	rdfs:range xsd:date ;
+         rdfs:label "Order Date" .
+
+tut:status a rdf:Property ;
+	rdfs:domain tut:cust_orders ;
+	rdfs:range xsd:string ;
+         rdfs:label "Status" .
+
+tut:order_total a rdf:Property ;
+	rdfs:domain tut:cust_orders ;
+	rdfs:range xsd:money ;
+         rdfs:label "Order Total" .
+', '', 'http://localhost:8890/schemas/ingrestut', 0);
+
+---------------------------------------------------------------
+
+----------- Create IRI Classes -------------
+
+SPARQL
+
+	create iri class <http://localhost:8890/schemas/ingrestut/book_list_iri>
+	"http://^{URIQADefaultHost}^/ingrestut/book_list/%d#this"
+    	(in book_no integer not null) .
+
+	create iri class <http://localhost:8890/schemas/ingrestut/book_orders_iri>
+	"http://^{URIQADefaultHost}^/ingrestut/book_orders/%d_%d#this"
+	 (in order_no integer not null, in book_no integer not null ) .
+
+	create iri class <http://localhost:8890/schemas/ingrestut/cust_info_iri>
+	"http://^{URIQADefaultHost}^/ingrestut/cust_info/%d#this"
+    	(in cust_no integer not null) .
+
+	create iri class <http://localhost:8890/schemas/ingrestut/cust_orders_iri>
+	"http://^{URIQADefaultHost}^/ingrestut/cust_orders/%d#this"
+    	(in order_no integer not null) .
+
+	;
+
+--------------------------------------------------------------------
+
+------------- Create Quad Store ------------------------------------
+
+SPARQL
+
+prefix tut:	<http://localhost:8890/schemas/ingrestut/>
+
+alter quad storage virtrdf:DefaultQuadStorage
+  from TUT.ingiima.book_list as book_list_tbl
+  from TUT.ingiima.book_orders as book_orders_tbl
+  from TUT.ingiima.cust_info as cust_info_tbl
+  from TUT.ingiima.cust_orders as cust_orders_tbl
+{
+  create virtrdf:ingrestut as
+      graph <http://localhost:8890/ingrestut>
+  {
+        tut:book_list_iri(book_list_tbl.book_no) a tut:book_list
+               as virtrdf:book_list_book_no ;
+        tut:title book_list_tbl.title
+	     as virtrdf:book_list_title;
+        tut:author book_list_tbl.author
+              as virtrdf:book_list_author;
+        tut:price book_list_tbl.price
+              as virtrdf:book_list_price;
+        tut:category book_list_tbl.category
+              as virtrdf:book_list_category;
+        tut:stock book_list_tbl.stock
+              as virtrdf:book_list_stock;
+        tut:dist_no book_list_tbl.dist_no
+              as virtrdf:book_list_dist_no .
+
+	tut:book_orders_iri(book_orders_tbl.order_no, book_orders_tbl.book_no) a tut:book_orders
+		as virtrdf:book_orders_pk;
+	tut:order_no book_orders_tbl.order_no
+		as virtrdf:book_orders_order_no;
+	tut:book_no tut:book_list_iri(book_list_tbl.book_no)
+		where(^{book_orders_tbl.}^.book_no = ^{book_list_tbl.}^.book_no)
+		as virtrdf:book_orders_book_no;
+	tut:sale_price book_orders_tbl.sale_price
+		as virtrdf:book_orders_sale_price;
+	tut:quantity book_orders_tbl.quantity
+		as virtrdf:book_orders_quantity;
+	tut:extension book_orders_tbl.extension
+		as virtrdf:book_orders_extension .
+
+ 	tut:cust_info_iri(cust_info_tbl.cust_no) a tut:cust_info
+		as virtrdf:cust_info_cust_no;
+	tut:name cust_info_tbl.name
+		as virtrdf:cust_info_name;
+	tut:company cust_info_tbl.company
+		as virtrdf:cust_info_company;
+	tut:street cust_info_tbl.street
+		as virtrdf:cust_info_street;
+	tut:city cust_info_tbl.city
+		as virtrdf:cust_info_city;
+	tut:state cust_info_tbl.state
+		as virtrdf:cust_info_state;
+	tut:zip cust_info_tbl.zip
+		as virtrdf:cust_info_zip;
+	tut:card_no cust_info_tbl.card_no
+		as virtrdf:cust_info_card_no;
+	tut:exp_date cust_info_tbl.exp_date
+		as virtrdf:cust_info_exp_date;
+	tut:ship_to cust_info_tbl.ship_to
+		as virtrdf:cust_info_ship_to .
+
+ 	tut:cust_orders_iri(cust_orders_tbl.order_no) a tut:cust_orders
+		as virtrdf:cust_orders_order_no;
+
+	tut:cust_no tut:cust_info_iri(cust_info_tbl.cust_no)
+		where (^{cust_orders_tbl.}^.cust_no = ^{cust_info_tbl.}^.cust_no)
+		as virtrdf:cust_orders_cust_no;
+	tut:order_date cust_orders_tbl.order_date
+		as virtrdf:cust_orders_order_date;
+	tut:status cust_orders_tbl.status
+		as virtrdf:cust_orders_status;
+	tut:order_total cust_orders_tbl.order_total
+		as virtrdf:cust_orders_order_total   .
+  } .
+} .
+;
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'ingrestut_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'ingrestut_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ingrestut_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ingrestut_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/ingrestut%%3E&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'ingrestut_rule_list1',
+    1,
+    vector (
+  	 	'ingrestut_rule1',
+  	 	'ingrestut_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/ingrestut');
+
+VHOST_DEFINE (
+	lpath=>'/ingrestut',
+	ppath=>'/DAV/ingrestut/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'ingrestut_rule_list1')
+	);
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'ingres_schemas_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'ingres_schemas_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ingres_schemas_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'ingres_schemas_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/ingrestut%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path','path','*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'ingres_schemas_rule_list1',
+    1,
+    vector (
+  	 	'ingres_schemas_rule1',
+  	 	'ingres_schemas_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/schema/ingrestut');
+
+VHOST_DEFINE (
+	lpath=>'/schemas/ingrestut',
+	ppath=>'/DAV/schemas/ingrestut/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'ingres_schemas_rule_list1')
+	);
+
+DB.DBA.XML_SET_NS_DECL ('tut', 'http://^{URIQADefaultHost}^/schemas/ingrestut/', 2);
+]]></programlisting>
+    </sect2>
+    <sect2 id="rdfviewsenterprs89">
+      <title>Progress (SQL-89) using demonstration 'iSports' database</title>
+<programlisting><![CDATA[
+ATTACH TABLE  "ISPORTS_RDF"."Customer" PRIMARY KEY ("Cust-Num")
+AS "isports_rdf"."pro91_isports_rdf"."Customer"
+FROM 'pro91_isports_rdf';
+
+ATTACH TABLE  "ISPORTS_RDF"."Invoice" PRIMARY KEY ("Invoice-Num")
+AS "isports_rdf"."pro91_isports_rdf"."Invoice"
+FROM 'pro91_isports_rdf';
+
+ATTACH TABLE  "ISPORTS_RDF"."Item" PRIMARY KEY ("Item-num")
+AS "isports_rdf"."pro91_isports_rdf"."Item"
+FROM 'pro91_isports_rdf';
+
+ATTACH TABLE  "ISPORTS_RDF"."Local-Default" PRIMARY KEY ("Country")
+AS "isports_rdf"."pro91_isports_rdf"."Local-Default"
+FROM 'pro91_isports_rdf';
+
+ATTACH TABLE  "ISPORTS_RDF"."Order" PRIMARY KEY ("Order-num")
+AS "isports_rdf"."pro91_isports_rdf"."Order"
+FROM 'pro91_isports_rdf';
+
+ATTACH TABLE  "ISPORTS_RDF"."Order-Line"  PRIMARY KEY ("Order-num", "Line-num")
+AS "isports_rdf"."pro91_isports_rdf"."Order-Line"
+FROM 'pro91_isports_rdf';
+
+ATTACH TABLE  "ISPORTS_RDF"."Ref-Call" PRIMARY KEY ("Call-Num")
+AS "isports_rdf"."pro91_isports_rdf"."Ref-Call"
+FROM 'pro91_isports_rdf';
+
+ATTACH TABLE  "ISPORTS_RDF"."Salesrep" PRIMARY KEY ("Sales-Rep")
+AS "isports_rdf"."pro91_isports_rdf"."Salesrep"
+FROM 'pro91_isports_rdf';
+
+ATTACH TABLE  "ISPORTS_RDF"."State" PRIMARY KEY ("State")
+AS "isports_rdf"."pro91_isports_rdf"."State"
+FROM 'pro91_isports_rdf';
+
+COMMIT WORK;
+
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.Customer        TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf."Order"         TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.Item            TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf."Order-Line"    TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.Invoice         TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf."Local-Default" TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf."Ref-Call"      TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.Salesrep        TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.State           TO "SPARQL", "SPARQL_UPDATE";
+
+GRANT SPARQL_UPDATE to "SPARQL";
+
+CREATE VIEW isports_rdf.pro91_isports_rdf.VCustomer      AS SELECT "Cust-Num" AS Cust_Num, Name, Address, Address2, City, State, Country, Phone, Contact, "Sales-Rep" AS Sales_Rep, Comments, "Credit-Limit" AS Credit_Limit, Balance, Terms, Discount, "Postal-Code" AS Postal_Code FROM "isports_rdf"."pro91_isports_rdf"."Customer";
+CREATE VIEW isports_rdf.pro91_isports_rdf.VOrder         AS SELECT "Order-num" AS Order_num, "Cust-Num" AS Cust_Num, "Order-Date" AS Order_Date, "Ship-Date" AS Ship_Date, "Promise-Date" AS Promise_Date, Carrier, Instructions, PO, Terms, "Sales-Rep" AS Sales_Rep FROM isports_rdf.pro91_isports_rdf."Order";
+CREATE VIEW isports_rdf.pro91_isports_rdf.VItem          AS SELECT "Item-num" AS Item_num, "Item-Name" AS Item_Name, "Cat-Page" AS Cat_Page, Price, "Cat-Description" AS Cat_Description, "On-hand" AS On_hand, Allocated, "Re-Order" AS Re_Order, "On-Order" AS On_Order FROM isports_rdf.pro91_isports_rdf.Item;
+CREATE VIEW isports_rdf.pro91_isports_rdf.VOrder_Line    AS SELECT "Order-num" AS Order_num, "Line-num" AS Line_num, "Item-num" AS Item_num, Price, Qty, Discount, "Extended-Price" AS Extended_Price, Backorder FROM isports_rdf.pro91_isports_rdf."Order-Line";
+CREATE VIEW isports_rdf.pro91_isports_rdf.VInvoice       AS SELECT "Invoice-Num" AS Invoice_Num, "Cust-Num" AS Cust_Num, "Invoice-Date" AS Invoice_Date, Amount, "Total-Paid" AS Total_Paid, Adjustment, "Order-Num" AS Order_Num, "Ship-Charge" AS Ship_Charge FROM isports_rdf.pro91_isports_rdf.Invoice;
+CREATE VIEW isports_rdf.pro91_isports_rdf.VLocal_Default AS SELECT Country, "Region1-Label" AS Region1_Label, "Region2-Label" AS Region2_Label, "Postal-Label" AS Postal_Label, "Postal-Format" AS Postal_Format, "Tel-Format" AS Tel_Format, "Date-Format" AS Date_Format, "Currency-Symbol" AS Currency_Symbol FROM isports_rdf.pro91_isports_rdf."Local-Default";
+CREATE VIEW isports_rdf.pro91_isports_rdf.VRef_Call      AS SELECT "Call-Num" AS Call_Num, "Cust-Num" AS Cust_Num, "Call-Date" AS Call_Date, "Sales-Rep" AS Sales_Rep, Parent, Txt FROM isports_rdf.pro91_isports_rdf."Ref-Call";
+CREATE VIEW isports_rdf.pro91_isports_rdf.VSalesrep      AS SELECT "Rep-Name" AS Rep_Name, Region, "Sales-Rep" AS Sales_Rep, "Month-Quota at 1" AS Month_Quota_1, "Month-Quota at 2" AS Month_Quota_2, "Month-Quota at 3" AS Month_Quota_3, "Month-Quota at 4" AS Month_Quota_4, "Month-Quota at 5" AS Month_Quota_5, "Month-Quota at 6" AS Month_Quota_6, "Month-Quota at 7" AS Month_Quota_7, "Month-Quota at 8" AS Month_Quota_8, "Month-Quota at 9" AS Month_Quota_9, "Month-Quota at 10" AS Month_Quota_10, "Month-Quota at 11" AS Month_Quota_11, "Month-Quota at 12" AS Month_Quota_12 FROM isports_rdf.pro91_isports_rdf.Salesrep;
+CREATE VIEW isports_rdf.pro91_isports_rdf.VState         AS SELECT State, "State-Name" AS State_Name, Region FROM isports_rdf.pro91_isports_rdf.State;
+
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.VCustomer      TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.VOrder         TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.VItem          TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.VOrder_Line    TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.VInvoice       TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.VLocal_Default TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.VRef_Call      TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.VSalesrep      TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.pro91_isports_rdf.VState         TO "SPARQL", "SPARQL_UPDATE";
+
+
+-------- Create rdfs:Class definitions ----------------------------
+
+ttlp (
+'
+ at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+ at prefix customer:     <http://localhost:8890/schemas/progress/isports/customer/> .
+ at prefix order:        <http://localhost:8890/schemas/progress/isports/order/> .
+ at prefix item:         <http://localhost:8890/schemas/progress/isports/item/> .
+ at prefix orderline:    <http://localhost:8890/schemas/progress/isports/order_line/> .
+ at prefix invoice:      <http://localhost:8890/schemas/progress/isports/invoice/> .
+ at prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/> .
+ at prefix refcall:      <http://localhost:8890/schemas/progress/isports/ref_call/> .
+ at prefix salesrep:     <http://localhost:8890/schemas/progress/isports/salesrep/> .
+ at prefix state:        <http://localhost:8890/schemas/progress/isports/state/> .
+
+
+
+customer:Customer a rdfs:Class ;
+	rdfs:label "Customer" ;
+	rdfs:comment "Progress isports Customer table" .
+
+customer:Cust-Num a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Cust-Num" .
+
+customer:Name a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Name" .
+
+customer:Address a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Address" .
+
+customer:Address2 a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Address2" .
+
+customer:City a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "City" .
+
+customer:State a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "State" .
+
+customer:Country a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Country" .
+
+customer:Phone a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Phone" .
+
+customer:Contact a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Contact" .
+
+customer:Sales-Rep a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Sales-Rep" .
+
+customer:Comments a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Comments" .
+
+customer:Credit-Limit a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Credit-Limit" .
+
+customer:Balance a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Balance" .
+
+customer:Terms a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Terms" .
+
+customer:Discount a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Discount" .
+
+customer:Postal-Code a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Postal-Code" .
+
+
+
+order:Order a rdfs:Class ;
+	rdfs:label "Order" ;
+	rdfs:comment "Progress isports Order table" .
+
+order:Order-num a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Order-num" .
+
+order:Cust-Num a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Cust-Num" .
+
+order:Order-Date a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:date ;
+	rdfs:label "Order-Date" .
+
+order:Ship-Date a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:date ;
+	rdfs:label "Ship-Date" .
+
+order:Promise-Date a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:date ;
+	rdfs:label "Promise-Date" .
+
+order:Carrier a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:string ;
+	rdfs:label "Carrier" .
+
+order:Instructions a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:string ;
+	rdfs:label "Instructions" .
+
+order:PO a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:string ;
+	rdfs:label "PO" .
+
+order:Terms a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:string ;
+	rdfs:label "Terms" .
+
+order:Sales-Rep a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:string ;
+	rdfs:label "Sales-Rep" .
+
+
+
+item:Item a rdfs:Class ;
+	rdfs:label "Item" ;
+	rdfs:comment "Progress isports Item table" .
+
+item:Item-num a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Item-num" .
+
+item:Item-Name a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:string ;
+	rdfs:label "Item-Name" .
+
+item:Cat-Page a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Cat-Page" .
+
+item:Price a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Price" .
+
+item:Cat-Description a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:string ;
+	rdfs:label "Cat-Description" .
+
+item:On-hand a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:integer ;
+	rdfs:label "On-hand" .
+
+item:Allocated a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Allocated" .
+
+item:Re-Order a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Re-Order" .
+
+item:On-Order a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:integer ;
+	rdfs:label "On-Order" .
+
+
+
+orderline:Order-Line a rdfs:Class ;
+	rdfs:label "Order-Line" ;
+	rdfs:comment "Progress isports Order-Line table" .
+
+orderline:Order-num a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Order-num" .
+
+orderline:Line-num a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Line-num" .
+
+orderline:Item-num a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Item-num" .
+
+orderline:Price a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Price" .
+
+orderline:Qty a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Qty" .
+
+orderline:Discount a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Discount" .
+
+orderline:Extended-Price a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Extended-Price" .
+
+orderline:Backorder a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:byte ;
+	rdfs:label "Backorder" .
+
+
+
+invoice:Invoice a rdfs:Class ;
+	rdfs:label "Invoice" ;
+	rdfs:comment "Progress isports Invoice table" .
+
+invoice:Invoice-Num a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Invoice-Num" .
+
+invoice:Cust-Num a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Cust-Num" .
+
+invoice:Invoice-Date a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:date ;
+	rdfs:label "Invoice-Date" .
+
+invoice:Amount a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Amount" .
+
+invoice:Total-Paid a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Total-Paid" .
+
+invoice:Adjustment a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Adjustment" .
+
+invoice:Order-Num a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Order-Num" .
+
+invoice:Ship-Charge a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Ship-Charge" .
+
+
+
+localdefault:Local-Default a rdfs:Class ;
+	rdfs:label "Local-Default" ;
+	rdfs:comment "Progress isports Local-Default table" .
+
+localdefault:Country a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Country" .
+
+localdefault:Region1-Label a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Region1-Label" .
+
+localdefault:Region2-Label a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Region2-Label" .
+
+localdefault:Postal-Label a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Postal-Label" .
+
+localdefault:Postal-Format a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Postal-Format" .
+
+localdefault:Tel-Format a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Tel-Format" .
+
+localdefault:Date-Format a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Date-Format" .
+
+localdefault:Currency-Symbol a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Currency-Symbol" .
+
+
+
+refcall:Ref-Call a rdfs:Class ;
+	rdfs:label "Ref-Call" ;
+	rdfs:comment "Progress isports Ref-Call table" .
+
+refcall:Call-Num a rdf:Property ;
+	rdfs:domain refcall:Ref-Call ;
+	rdfs:range xsd:string ;
+	rdfs:label "Call-Num" .
+
+refcall:Cust-Num a rdf:Property ;
+	rdfs:domain refcall:Ref-Call ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Cust-Num" .
+
+refcall:Call-Date a rdf:Property ;
+	rdfs:domain refcall:Ref-Call ;
+	rdfs:range xsd:date ;
+	rdfs:label "Call-Date" .
+
+refcall:Sales-Rep a rdf:Property ;
+	rdfs:domain refcall:Ref-Call ;
+	rdfs:range xsd:string ;
+	rdfs:label "Sales-Rep" .
+
+refcall:Parent a rdf:Property ;
+	rdfs:domain refcall:Ref-Call ;
+	rdfs:range xsd:string ;
+	rdfs:label "Parent" .
+
+refcall:Txt a rdf:Property ;
+	rdfs:domain refcall:Ref-Call ;
+	rdfs:range xsd:string ;
+	rdfs:label "Txt" .
+
+
+
+salesrep:Salesrep a rdfs:Class ;
+	rdfs:label "Salesrep" ;
+	rdfs:comment "Progress isports Salesrep table" .
+
+salesrep:Sales-Rep a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Sales-Rep" .
+
+salesrep:Rep-Name a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Rep-Name" .
+
+salesrep:Region a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Region" .
+
+salesrep:Month-Quota-1 a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota at 1" .
+
+salesrep:Month-Quota-2 a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota at 2" .
+
+salesrep:Month-Quota-3 a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota at 3" .
+
+salesrep:Month-Quota-4 a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota at 4" .
+
+salesrep:Month-Quota-5 a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota at 5" .
+
+salesrep:Month-Quota-6 a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota at 6" .
+
+salesrep:Month-Quota-7 a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota at 7" .
+
+salesrep:Month-Quota-8 a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota at 8" .
+
+salesrep:Month-Quota-9 a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota at 9" .
+
+salesrep:Month-Quota-10 a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota at 10" .
+
+salesrep:Month-Quota-11 a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota at 11" .
+
+salesrep:Month-Quota-12 a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota at 12" .
+
+
+
+state:State a rdfs:Class ;
+	rdfs:label "State" ;
+	rdfs:comment "Progress isports State table" .
+
+state:State_ a rdf:Property ;
+	rdfs:domain state:State ;
+	rdfs:range xsd:string ;
+	rdfs:label "State" .
+
+state:State-Name a rdf:Property ;
+	rdfs:domain state:State ;
+	rdfs:range xsd:string ;
+	rdfs:label "State-Name" .
+
+state:Region a rdf:Property ;
+	rdfs:domain state:State ;
+	rdfs:range xsd:string ;
+	rdfs:label "Region" .
+
+', '', 'http://localhost:8890/schemas/progress/isports', 0);
+
+
+
+----------- Create IRI Classes -------------
+
+
+
+
+SPARQL
+
+prefix customer:     <http://localhost:8890/schemas/progress/isports/customer/>
+prefix order:        <http://localhost:8890/schemas/progress/isports/order/>
+prefix item:         <http://localhost:8890/schemas/progress/isports/item/>
+prefix orderline:    <http://localhost:8890/schemas/progress/isports/order_line/>
+prefix invoice:      <http://localhost:8890/schemas/progress/isports/invoice/>
+prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/>
+prefix refcall:      <http://localhost:8890/schemas/progress/isports/ref_call/>
+prefix salesrep:     <http://localhost:8890/schemas/progress/isports/salesrep/>
+prefix state:        <http://localhost:8890/schemas/progress/isports/state/>
+
+create iri class customer:customer_iri
+	"http://localhost:8890/progress/isports/customer/%d#this"
+	(in Cust_Num integer not null) .
+
+create iri class order:order_iri
+	"http://localhost:8890/progress/isports/order/%d#this"
+	(in Order_Num integer not null) .
+
+create iri class item:item_iri
+	"http://localhost:8890/progress/isports/item/%d#this"
+	(in Item_num integer not null) .
+
+create iri class orderline:order-line_iri
+	"http://localhost:8890/progress/isports/order-line/%d_%d#this"
+	(in Order_num integer not null, in Line_num integer not null) .
+
+create iri class invoice:invoice_iri
+	"http://localhost:8890/progress/isports/invoice/%d#this"
+	(in Invoice_Num integer not null) .
+
+create iri class localdefault:local-default_iri
+	"http://localhost:8890/progress/isports/local-default/%U#this"
+	(in Country varchar not null) .
+
+create iri class refcall:ref-call_iri
+	"http://localhost:8890/progress/isports/ref-call/%U#this"
+	(in Call_Num varchar not null) .
+
+create iri class salesrep:salesrep_iri
+	"http://localhost:8890/progress/isports/salesrep/%U#this"
+	(in Sales_Rep varchar not null) .
+
+create iri class state:state_iri
+	"http://localhost:8890/progress/isports/state/%U#this"
+	(in State varchar not null) .
+
+;
+
+
+
+
+
+
+
+------------- Create Quad Store ------------------------------------
+
+SPARQL
+
+prefix customer:     <http://localhost:8890/schemas/progress/isports/customer/>
+prefix order:        <http://localhost:8890/schemas/progress/isports/order/>
+prefix item:         <http://localhost:8890/schemas/progress/isports/item/>
+prefix orderline:    <http://localhost:8890/schemas/progress/isports/order_line/>
+prefix invoice:      <http://localhost:8890/schemas/progress/isports/invoice/>
+prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/>
+prefix refcall:      <http://localhost:8890/schemas/progress/isports/ref_call/>
+prefix salesrep:     <http://localhost:8890/schemas/progress/isports/salesrep/>
+prefix state:        <http://localhost:8890/schemas/progress/isports/state/>
+
+alter quad storage virtrdf:DefaultQuadStorage
+  from isports_rdf.pro91_isports_rdf.VCustomer      as Customer_tbl
+  from isports_rdf.pro91_isports_rdf.VOrder         as Order_tbl
+  from isports_rdf.pro91_isports_rdf.VItem          as Item_tbl
+  from isports_rdf.pro91_isports_rdf.VOrder_Line    as Order_Line_tbl
+  from isports_rdf.pro91_isports_rdf.VInvoice       as Invoice_tbl
+  from isports_rdf.pro91_isports_rdf.VRef_Call      as Ref_Call_tbl
+  from isports_rdf.pro91_isports_rdf.VRef_Call      as Ref_Call_tbl_1
+  from isports_rdf.pro91_isports_rdf.VLocal_Default as Local_Default_tbl
+  from isports_rdf.pro91_isports_rdf.VSalesrep      as Salesrep_tbl
+  from isports_rdf.pro91_isports_rdf.VState         as State_tbl
+{
+  create virtrdf:progress_isports as graph <http://localhost:8890/progress/isports>
+  {
+    customer:customer_iri (Customer_tbl.Cust_Num) a customer:Customer as virtrdf:customer_pk ;
+    customer:Cust-Num     Customer_tbl.Cust_Num     as virtrdf:Customer_cust-num ;
+    customer:Name         Customer_tbl.Name         as virtrdf:Customer_name ;
+    customer:Address      Customer_tbl.Address      as virtrdf:Customer_address ;
+    customer:Address2     Customer_tbl.Address2     as virtrdf:Customer_address2 ;
+    customer:City         Customer_tbl.City         as virtrdf:Customer_city ;
+    customer:State        Customer_tbl.State        as virtrdf:Customer_state ;
+    customer:Country      Customer_tbl.Country      as virtrdf:Customer_country ;
+    customer:Phone        Customer_tbl.Phone        as virtrdf:Customer_phone ;
+    customer:Contact      Customer_tbl.Contact      as virtrdf:Customer_contact ;
+    customer:Sales-Rep    Customer_tbl.Sales_Rep    as virtrdf:Customer_sales_rep ;
+    customer:Comments     Customer_tbl.Comments     as virtrdf:Customer_comments ;
+    customer:Credit-Limit Customer_tbl.Credit_Limit as virtrdf:Customer_credit-limit ;
+    customer:Balance      Customer_tbl.Balance      as virtrdf:Customer_balance ;
+    customer:Terms        Customer_tbl.Terms        as virtrdf:Customer_terms ;
+    customer:Discount     Customer_tbl.Discount     as virtrdf:Customer_discount ;
+    customer:Postal-Code  Customer_tbl.Postal_Code  as virtrdf:Customer_postal-code ;
+    customer:from_state        state:state_iri (State_tbl.State)                           where ( ^{Customer_tbl.}^.State     = ^{State_tbl.}^.State )           as virtrdf:Customer_from_state ;
+    customer:has_sales_rep     salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)              where ( ^{Customer_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep )    as virtrdf:Customer_has_sales_rep ;
+    customer:has_local_default localdefault:local-default_iri (Local_Default_tbl.Country)  where ( ^{Customer_tbl.}^.Country   = ^{Local_Default_tbl.}^.Country ) as virtrdf:Customer_has_local_default ;
+    customer:placed_order      order:order_iri (Order_tbl.Order_num)                       where ( ^{Customer_tbl.}^.Cust_Num  = ^{Order_tbl.}^.Cust_Num )        as virtrdf:Customer_placed_order ;
+    customer:has_invoice       invoice:invoice_iri (Invoice_tbl.Invoice_Num)               where ( ^{Customer_tbl.}^.Cust_Num  = ^{Invoice_tbl.}^.Cust_Num )      as virtrdf:Customer_has_invoice ;
+    customer:ref_call          refcall:ref-call_iri (Ref_Call_tbl.Call_Num)                where ( ^{Customer_tbl.}^.Cust_Num  = ^{Ref_Call_tbl.}^.Cust_Num )     as virtrdf:Customer_ref-call .
+
+    order:order_iri (Order_tbl.Order_num) a order:Order as virtrdf:order_pk ;
+    order:Order-num    Order_tbl.Order_num    as virtrdf:Order_order-num ;
+    order:Cust-Num     Order_tbl.Cust_Num     as virtrdf:Order_cust_num ;
+    order:Order-Date   Order_tbl.Order_Date   as virtrdf:Order_order-date ;
+    order:Ship-Date    Order_tbl.Ship_Date    as virtrdf:Order_ship-date ;
+    order:Promise-Date Order_tbl.Promise_Date as virtrdf:Order_promise-date ;
+    order:Carrier      Order_tbl.Carrier      as virtrdf:Order_carrier ;
+    order:Instructions Order_tbl.Instructions as virtrdf:Order_instructions ;
+    order:PO           Order_tbl.PO           as virtrdf:Order_po ;
+    order:Terms        Order_tbl.Terms        as virtrdf:Order_terms ;
+    order:placed_by    customer:customer_iri (Customer_tbl.Cust_Num)                                 where ( ^{Order_tbl.}^.Cust_Num  = ^{Customer_tbl.}^.Cust_Num )    as virtrdf:Order_placed_by ;
+    order:Sales-Rep    salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)                                where ( ^{Order_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep )   as virtrdf:Order_sales_rep ;
+    order:invoiced_on  invoice:invoice_iri (Invoice_tbl.Invoice_Num)                                 where ( ^{Order_tbl.}^.Order_num = ^{Invoice_tbl.}^.Order_Num )    as virtrdf:Order_invoiced_on ;
+    order:has_lines    orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num)  where ( ^{Order_tbl.}^.Order_num = ^{Order_Line_tbl.}^.Order_num ) as virtrdf:Order_has_lines .
+
+    item:item_iri (Item_tbl.Item_num) a item:Item as virtrdf:item_pk ;
+    item:Item-num        Item_tbl.Item_num        as virtrdf:item_item-num ;
+    item:Item-Name       Item_tbl.Item_Name       as virtrdf:Item_item-Name ;
+    item:Cat-Page        Item_tbl.Cat_Page        as virtrdf:Item_cat-page ;
+    item:Price           Item_tbl.Price           as virtrdf:Item_price ;
+    item:Cat-Description Item_tbl.Cat_Description as virtrdf:Item_cat-description ;
+    item:On-hand         Item_tbl.On_hand         as virtrdf:Item_on-hand ;
+    item:Allocated       Item_tbl.Allocated       as virtrdf:Item_allocated ;
+    item:Re-Order        Item_tbl.Re_Order        as virtrdf:Item_re-order ;
+    item:On-Order        Item_tbl.On_Order        as virtrdf:Item_on-order ;
+    item:order_line  orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num)  where ( ^{Item_tbl.}^.Item_num  = ^{Order_Line_tbl.}^.Item_num )   as virtrdf:Item_order_line .
+
+    orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num) a orderline:Order-Line as virtrdf:order-line_pk ;
+    orderline:Line-num       Order_Line_tbl.Line_num       as virtrdf:Order-Line_line-num ;
+    orderline:Price          Order_Line_tbl.Price          as virtrdf:Order-Line_price ;
+    orderline:Qty            Order_Line_tbl.Qty            as virtrdf:Order-Line_qty ;
+    orderline:Discount       Order_Line_tbl.Discount       as virtrdf:Order-Line_discount ;
+    orderline:Extended-Price Order_Line_tbl.Extended_Price as virtrdf:Order-Line_extended-price ;
+    orderline:Backorder      Order_Line_tbl.Backorder      as virtrdf:Order-Line_backorder ;
+    orderline:Order-num  order:order_iri (Order_tbl.Order_num)  where ( ^{Order_Line_tbl.}^.Order_num = ^{Order_tbl.}^.Order_num ) as virtrdf:Order_Line_order_num ;
+    orderline:Item-num   item:item_iri (Item_tbl.Item_num)      where ( ^{Order_Line_tbl.}^.Item_num  = ^{Item_tbl.}^.Item_num )   as virtrdf:Order_Line_item_num .
+
+    invoice:invoice_iri (Invoice_tbl.Invoice_Num) a invoice:Invoice as virtrdf:invoice_pk ;
+    invoice:Invoice-Num  Invoice_tbl.Invoice_Num  as virtrdf:Invoice_invoice-num ;
+    invoice:Cust-Num     Invoice_tbl.Cust_Num    as virtrdf:Invoice_cust_num ;
+    invoice:Invoice-Date Invoice_tbl.Invoice_Date as virtrdf:Invoice_invoice-date ;
+    invoice:Amount       Invoice_tbl.Amount       as virtrdf:Invoice_amount ;
+    invoice:Total-Paid   Invoice_tbl.Total_Paid   as virtrdf:Invoice_total-paid ;
+    invoice:Adjustment   Invoice_tbl.Adjustment   as virtrdf:Invoice_adjustment ;
+    invoice:Order-Num    Invoice_tbl.Order_Num    as virtrdf:Invoice_order-num ;
+    invoice:Ship-Charge  Invoice_tbl.Ship_Charge  as virtrdf:Invoice_ship-charge ;
+    invoice:invoiced_to  customer:customer_iri (Customer_tbl.Cust_Num)  where ( ^{Invoice_tbl.}^.Cust_Num  = ^{Customer_tbl.}^.Cust_Num ) as virtrdf:Invoice_invoiced_to ;
+    invoice:Order-Num    order:order_iri (Order_tbl.Order_num)          where ( ^{Invoice_tbl.}^.Order_Num = ^{Order_tbl.}^.Order_num )   as virtrdf:Invoice_order_num .
+
+    localdefault:local-default_iri (Local_Default_tbl.Country) a localdefault:Local-Default as virtrdf:local-default_pk ;
+    localdefault:Country         Local_Default_tbl.Country as virtrdf:local-default_country ;
+    localdefault:Region1-Label   Local_Default_tbl.Region1_Label   as virtrdf:Local-Default_region1-label ;
+    localdefault:Region2-Label   Local_Default_tbl.Region2_Label   as virtrdf:Local-Default_region2-label ;
+    localdefault:Postal-Label    Local_Default_tbl.Postal_Label    as virtrdf:Local-Default_postal-label ;
+    localdefault:Postal-Format   Local_Default_tbl.Postal_Format   as virtrdf:Local-Default_postal-format ;
+    localdefault:Tel-Format      Local_Default_tbl.Tel_Format      as virtrdf:Local-Default_tel-format ;
+    localdefault:Date-Format     Local_Default_tbl.Date_Format     as virtrdf:Local-Default_date-format ;
+    localdefault:Currency-Symbol Local_Default_tbl.Currency_Symbol as virtrdf:Local-Default_currency-symbol ;
+    localdefault:has_customer customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Local_Default_tbl.}^.Country = ^{Customer_tbl.}^.Country ) as virtrdf:Local-Default_has_customer .
+
+
+    refcall:ref-call_iri (Ref_Call_tbl.Call_Num) a refcall:Ref-Call as virtrdf:ref-call_pk ;
+    refcall:Call-Num   Ref_Call_tbl.Call_Num   as virtrdf:Ref-Call_call-num ;
+    refcall:Cust-Num   Ref_Call_tbl.Cust_Num   as virtrdf:Ref-Call_cust-num ;
+    refcall:Call-Date  Ref_Call_tbl.Call_Date  as virtrdf:Ref-Call_call-date ;
+    refcall:Sales-Rep  Ref_Call_tbl.Sales_Rep  as virtrdf:Ref-sales-rep ;
+    refcall:Parent     Ref_Call_tbl.Parent     as virtrdf:Ref-Call_parent ;
+    refcall:Txt        Ref_Call_tbl.Txt        as virtrdf:Ref-Call_txt ;
+    refcall:made_to     customer:customer_iri (Customer_tbl.Cust_Num)   where  ( ^{Ref_Call_tbl.}^.Cust_Num  = ^{Customer_tbl.}^.Cust_Num )   as virtrdf:Ref-Call_made_to ;
+    refcall:made_by     salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)  where  ( ^{Ref_Call_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep )  as virtrdf:Ref-Call_made-by ;
+    refcall:has_parent  refcall:ref-call_iri (Ref_Call_tbl_1.Call_Num)    where  ( ^{Ref_Call_tbl.}^.Parent    = ^{Ref_Call_tbl_1.}^.Call_Num )   as virtrdf:Ref-Call_has_parent .
+
+    salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep) a salesrep:Salesrep as virtrdf:salesrep_pk ;
+    salesrep:Sales-Rep      Salesrep_tbl.Sales_Rep       as virtrdf:Salesrep_sales-rep ;
+    salesrep:Region         Salesrep_tbl.Region          as virtrdf:Salesrep_region ;
+    salesrep:Rep-Name       Salesrep_tbl.Rep_Name        as virtrdf:Salesrep_rep-name ;
+    salesrep:Month-Quota-1  Salesrep_tbl.Month_Quota_1   as virtrdf:Salesrep_month-quota-1 ;
+    salesrep:Month-Quota-2  Salesrep_tbl.Month_Quota_2   as virtrdf:Salesrep_month-quota-2 ;
+    salesrep:Month-Quota-3  Salesrep_tbl.Month_Quota_3   as virtrdf:Salesrep_month-quota-3 ;
+    salesrep:Month-Quota-4  Salesrep_tbl.Month_Quota_4   as virtrdf:Salesrep_month-quota-4 ;
+    salesrep:Month-Quota-5  Salesrep_tbl.Month_Quota_5   as virtrdf:Salesrep_month-quota-5 ;
+    salesrep:Month-Quota-6  Salesrep_tbl.Month_Quota_6   as virtrdf:Salesrep_month-quota-6 ;
+    salesrep:Month-Quota-7  Salesrep_tbl.Month_Quota_7   as virtrdf:Salesrep_month-quota-7 ;
+    salesrep:Month-Quota-8  Salesrep_tbl.Month_Quota_8   as virtrdf:Salesrep_month-quota-8 ;
+    salesrep:Month-Quota-9  Salesrep_tbl.Month_Quota_9   as virtrdf:Salesrep_month-quota-9 ;
+    salesrep:Month-Quota-10 Salesrep_tbl.Month_Quota_10  as virtrdf:Salesrep_month-quota-10 ;
+    salesrep:Month-Quota-11 Salesrep_tbl.Month_Quota_11  as virtrdf:Salesrep_month-quota-11 ;
+    salesrep:Month-Quota-12 Salesrep_tbl.Month_Quota_12  as virtrdf:Salesrep_month-quota-12 ;
+    salesrep:is_sales_rep_for customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Customer_tbl.}^.Sales_Rep ) as virtrdf:Salesrep_is_sales_rep_for ;
+    salesrep:has_order        order:order_iri (Order_tbl.Order_num)         where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Order_tbl.}^.Sales_Rep )    as virtrdf:Salesrep_has_order ;
+    salesrep:manages_region   state:state_iri (State_tbl.State)             where ( ^{Salesrep_tbl.}^.Region    = ^{State_tbl.}^.Region )       as virtrdf:Salesrep_manages_region ;
+    salesrep:made_call        refcall:ref-call_iri (Ref_Call_tbl.Call_Num)  where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Ref_Call_tbl.}^.Sales_Rep ) as virtrdf:Ref-Call_made_call .
+
+    state:state_iri (State_tbl.State) a state:State as virtrdf:state_pk ;
+    state:State_     State_tbl.State        as virtrdf:State_state ;
+    state:State-Name State_tbl.State_Name   as virtrdf:State_state-name ;
+    state:Region     State_tbl.Region       as virtrdf:State_region ;
+    state:has_customer   customer:customer_iri (Customer_tbl.Cust_Num)   where ( ^{State_tbl.}^.State  = ^{Customer_tbl.}^.State )  as virtrdf:State_has_customer ;
+    state:has_sales_rep  salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)  where ( ^{State_tbl.}^.Region = ^{Salesrep_tbl.}^.Region ) as virtrdf:State_has_sales_rep .
+
+
+  } .
+} .
+;
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'progress_isports_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'progress_isports_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'progress_isports_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'progress_isports_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/progress/isports%%3E&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'progress_isports_rule_list1',
+    1,
+    vector (
+  	 	'progress_isports_rule1',
+  	 	'progress_isports_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/progress/isports');
+
+VHOST_DEFINE (
+	lpath=>'/progress/isports',
+	ppath=>'/DAV/progress/isports/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'progress_isports_rule_list1')
+	);
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'progress_isports_schemas_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'progress_isports_schemas_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'progress_isports_schemas_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'progress_isports_schemas_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/progress/isports%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path','path','*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'progress_isports_schemas_rule_list1',
+    1,
+    vector (
+  	 	'progress_isports_schemas_rule1',
+  	 	'progress_isports_schemas_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/schemas/progress/isports');
+
+VHOST_DEFINE (
+	lpath=>'/schemas/progress/isports',
+	ppath=>'/DAV/schemas/progress/isports/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'progress_isports_schemas_rule_list1')
+	);
+
+DB.DBA.XML_SET_NS_DECL ('customer',     'http://^{URIQADefaultHost}^/schemas/progress/isports/customer/', 2);
+DB.DBA.XML_SET_NS_DECL ('order',        'http://^{URIQADefaultHost}^/schemas/progress/isports/order/', 2);
+DB.DBA.XML_SET_NS_DECL ('item',         'http://^{URIQADefaultHost}^/schemas/progress/isports/item/', 2);
+DB.DBA.XML_SET_NS_DECL ('orderline',    'http://^{URIQADefaultHost}^/schemas/progress/isports/order_line/', 2);
+DB.DBA.XML_SET_NS_DECL ('invoice',      'http://^{URIQADefaultHost}^/schemas/progress/isports/invoice/', 2);
+DB.DBA.XML_SET_NS_DECL ('localdefault', 'http://^{URIQADefaultHost}^/schemas/progress/isports/local_default/', 2);
+DB.DBA.XML_SET_NS_DECL ('refcall',      'http://^{URIQADefaultHost}^/schemas/progress/isports/ref_call/', 2);
+DB.DBA.XML_SET_NS_DECL ('salesrep',     'http://^{URIQADefaultHost}^/schemas/progress/isports/salesrep/', 2);
+DB.DBA.XML_SET_NS_DECL ('state',        'http://^{URIQADefaultHost}^/schemas/progress/isports/state/', 2);
+]]></programlisting>
+    </sect2>
+    <sect2 id="rdfviewsenterprs92">
+      <title>Progress (SQL-92) using demonstration 'iSports' database</title>
+<programlisting><![CDATA[
+ATTACH TABLE  "PUB"."Customer"      PRIMARY KEY ("Cust-Num")              AS "isports_rdf"."prs10_isports_rdf"."Customer"      FROM 'prs10_isports_rdf';
+ATTACH TABLE  "PUB"."Invoice"       PRIMARY KEY ("Invoice-Num")           AS "isports_rdf"."prs10_isports_rdf"."Invoice"       FROM 'prs10_isports_rdf';
+ATTACH TABLE  "PUB"."Item"          PRIMARY KEY ("Item-num")              AS "isports_rdf"."prs10_isports_rdf"."Item"          FROM 'prs10_isports_rdf';
+ATTACH TABLE  "PUB"."Local-Default" PRIMARY KEY ("Country")               AS "isports_rdf"."prs10_isports_rdf"."Local-Default" FROM 'prs10_isports_rdf';
+ATTACH TABLE  "PUB"."Order"         PRIMARY KEY ("Order-num")             AS "isports_rdf"."prs10_isports_rdf"."Order"         FROM 'prs10_isports_rdf';
+ATTACH TABLE  "PUB"."Order-Line"    PRIMARY KEY ("Order-num", "Line-num") AS "isports_rdf"."prs10_isports_rdf"."Order-Line"    FROM 'prs10_isports_rdf';
+ATTACH TABLE  "PUB"."Ref-Call"      PRIMARY KEY ("Call-Num")              AS "isports_rdf"."prs10_isports_rdf"."Ref-Call"      FROM 'prs10_isports_rdf';
+ATTACH TABLE  "PUB"."Salesrep"      PRIMARY KEY ("Sales-Rep")             AS "isports_rdf"."prs10_isports_rdf"."Salesrep"      FROM 'prs10_isports_rdf';
+ATTACH TABLE  "PUB"."State"         PRIMARY KEY ("State")                 AS "isports_rdf"."prs10_isports_rdf"."State"         FROM 'prs10_isports_rdf';
+
+COMMIT WORK;
+
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.Customer        TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf."Order"         TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.Item            TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf."Order-Line"    TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.Invoice         TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf."Local-Default" TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf."Ref-Call"      TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.Salesrep        TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.State           TO "SPARQL", "SPARQL_UPDATE";
+
+GRANT SPARQL_UPDATE to "SPARQL";
+
+
+CREATE VIEW isports_rdf.prs10_isports_rdf.VCustomer      AS SELECT "Cust-Num" AS Cust_Num, Name, Address, Address2, City, State, Country, Phone, Contact, "Sales-Rep" AS Sales_Rep, Comments, "Credit-Limit" AS Credit_Limit, Balance, Terms, Discount, "Postal-Code" AS Postal_Code FROM isports_rdf.prs10_isports_rdf.Customer;
+CREATE VIEW isports_rdf.prs10_isports_rdf.VOrder         AS SELECT "Order-num" AS Order_num, "Cust-Num" AS Cust_Num, "Order-Date" AS Order_Date, "Ship-Date" AS Ship_Date, "Promise-Date" AS Promise_Date, Carrier, Instructions, PO, Terms, "Sales-Rep" AS Sales_Rep FROM isports_rdf.prs10_isports_rdf."Order";
+CREATE VIEW isports_rdf.prs10_isports_rdf.VItem          AS SELECT "Item-num" AS Item_num, "Item-Name" AS Item_Name, "Cat-Page" AS Cat_Page, Price, "Cat-Description" AS Cat_Description, "On-hand" AS On_hand, Allocated, "Re-Order" AS Re_Order, "On-Order" AS On_Order FROM isports_rdf.prs10_isports_rdf.Item;
+CREATE VIEW isports_rdf.prs10_isports_rdf.VOrder_Line    AS SELECT "Order-num" AS Order_num, "Line-num" AS Line_num, "Item-num" AS Item_num, Price, Qty, Discount, "Extended-Price" AS Extended_Price, Backorder FROM isports_rdf.prs10_isports_rdf."Order-Line";
+CREATE VIEW isports_rdf.prs10_isports_rdf.VInvoice       AS SELECT "Invoice-Num" AS Invoice_Num, "Cust-Num" AS Cust_Num, "Invoice-Date" AS Invoice_Date, Amount, "Total-Paid" AS Total_Paid, Adjustment, "Order-Num" AS Order_Num, "Ship-Charge" AS Ship_Charge FROM isports_rdf.prs10_isports_rdf.Invoice;
+CREATE VIEW isports_rdf.prs10_isports_rdf.VLocal_Default AS SELECT Country, "Region1-Label" AS Region1_Label, "Region2-Label" AS Region2_Label, "Postal-Label" AS Postal_Label, "Postal-Format" AS Postal_Format, "Tel-Format" AS Tel_Format, "Date-Format" AS Date_Format, "Currency-Symbol" AS Currency_Symbol FROM isports_rdf.prs10_isports_rdf."Local-Default";
+CREATE VIEW isports_rdf.prs10_isports_rdf.VRef_Call      AS SELECT "Call-Num" AS Call_Num, "Cust-Num" AS Cust_Num, "Call-Date" AS Call_Date, "Sales-Rep" AS Sales_Rep, Parent, Txt FROM isports_rdf.prs10_isports_rdf."Ref-Call";
+CREATE VIEW isports_rdf.prs10_isports_rdf.VSalesrep      AS SELECT "Rep-Name" AS Rep_Name, Region, "Sales-Rep" AS Sales_Rep, "Month-Quota" AS Month_Quota FROM isports_rdf.prs10_isports_rdf.Salesrep;
+CREATE VIEW isports_rdf.prs10_isports_rdf.VState         AS SELECT State, "State-Name" AS State_Name, Region FROM isports_rdf.prs10_isports_rdf.State;
+
+
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.VCustomer      TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.VOrder         TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.VItem          TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.VOrder_Line    TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.VInvoice       TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.VLocal_Default TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.VRef_Call      TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.VSalesrep      TO "SPARQL", "SPARQL_UPDATE";
+GRANT SELECT ON isports_rdf.prs10_isports_rdf.VState         TO "SPARQL", "SPARQL_UPDATE";
+
+
+-------- Create rdfs:Class definitions ----------------------------
+
+ttlp (
+'
+ at prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+ at prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+ at prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+ at prefix customer:     <http://localhost:8890/schemas/progress/isports/customer/> .
+ at prefix order:        <http://localhost:8890/schemas/progress/isports/order/> .
+ at prefix item:         <http://localhost:8890/schemas/progress/isports/item/> .
+ at prefix orderline:    <http://localhost:8890/schemas/progress/isports/order_line/> .
+ at prefix invoice:      <http://localhost:8890/schemas/progress/isports/invoice/> .
+ at prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/> .
+ at prefix refcall:      <http://localhost:8890/schemas/progress/isports/ref_call/> .
+ at prefix salesrep:     <http://localhost:8890/schemas/progress/isports/salesrep/> .
+ at prefix state:        <http://localhost:8890/schemas/progress/isports/state/> .
+
+
+
+customer:Customer a rdfs:Class ;
+	rdfs:label "Customer" ;
+	rdfs:comment "Progress isports Customer table" .
+
+customer:Cust-Num a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Cust-Num" .
+
+customer:Name a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Name" .
+
+customer:Address a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Address" .
+
+customer:Address2 a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Address2" .
+
+customer:City a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "City" .
+
+customer:State a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "State" .
+
+customer:Country a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Country" .
+
+customer:Phone a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Phone" .
+
+customer:Contact a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Contact" .
+
+customer:Sales-Rep a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Sales-Rep" .
+
+customer:Comments a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Comments" .
+
+customer:Credit-Limit a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Credit-Limit" .
+
+customer:Balance a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Balance" .
+
+customer:Terms a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Terms" .
+
+customer:Discount a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Discount" .
+
+customer:Postal-Code a rdf:Property ;
+	rdfs:domain customer:Customer ;
+	rdfs:range xsd:string ;
+	rdfs:label "Postal-Code" .
+
+
+
+order:Order a rdfs:Class ;
+	rdfs:label "Order" ;
+	rdfs:comment "Progress isports Order table" .
+
+order:Order-num a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Order-num" .
+
+order:Cust-Num a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Cust-Num" .
+
+order:Order-Date a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:date ;
+	rdfs:label "Order-Date" .
+
+order:Ship-Date a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:date ;
+	rdfs:label "Ship-Date" .
+
+order:Promise-Date a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:date ;
+	rdfs:label "Promise-Date" .
+
+order:Carrier a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:string ;
+	rdfs:label "Carrier" .
+
+order:Instructions a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:string ;
+	rdfs:label "Instructions" .
+
+order:PO a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:string ;
+	rdfs:label "PO" .
+
+order:Terms a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:string ;
+	rdfs:label "Terms" .
+
+order:Sales-Rep a rdf:Property ;
+	rdfs:domain order:Order ;
+	rdfs:range xsd:string ;
+	rdfs:label "Sales-Rep" .
+
+
+
+item:Item a rdfs:Class ;
+	rdfs:label "Item" ;
+	rdfs:comment "Progress isports Item table" .
+
+item:Item-num a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Item-num" .
+
+item:Item-Name a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:string ;
+	rdfs:label "Item-Name" .
+
+item:Cat-Page a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Cat-Page" .
+
+item:Price a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Price" .
+
+item:Cat-Description a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:string ;
+	rdfs:label "Cat-Description" .
+
+item:On-hand a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:integer ;
+	rdfs:label "On-hand" .
+
+item:Allocated a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Allocated" .
+
+item:Re-Order a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Re-Order" .
+
+item:On-Order a rdf:Property ;
+	rdfs:domain item:Item ;
+	rdfs:range xsd:integer ;
+	rdfs:label "On-Order" .
+
+
+
+orderline:Order-Line a rdfs:Class ;
+	rdfs:label "Order-Line" ;
+	rdfs:comment "Progress isports Order-Line table" .
+
+orderline:Order-num a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Order-num" .
+
+orderline:Line-num a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Line-num" .
+
+orderline:Item-num a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Item-num" .
+
+orderline:Price a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Price" .
+
+orderline:Qty a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Qty" .
+
+orderline:Discount a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Discount" .
+
+orderline:Extended-Price a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Extended-Price" .
+
+orderline:Backorder a rdf:Property ;
+	rdfs:domain orderline:Order-Line ;
+	rdfs:range xsd:byte ;
+	rdfs:label "Backorder" .
+
+
+
+invoice:Invoice a rdfs:Class ;
+	rdfs:label "Invoice" ;
+	rdfs:comment "Progress isports Invoice table" .
+
+invoice:Invoice-Num a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Invoice-Num" .
+
+invoice:Cust-Num a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Cust-Num" .
+
+invoice:Invoice-Date a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:date ;
+	rdfs:label "Invoice-Date" .
+
+invoice:Amount a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Amount" .
+
+invoice:Total-Paid a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Total-Paid" .
+
+invoice:Adjustment a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Adjustment" .
+
+invoice:Order-Num a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Order-Num" .
+
+invoice:Ship-Charge a rdf:Property ;
+	rdfs:domain invoice:Invoice ;
+	rdfs:range xsd:decimal ;
+	rdfs:label "Ship-Charge" .
+
+
+
+localdefault:Local-Default a rdfs:Class ;
+	rdfs:label "Local-Default" ;
+	rdfs:comment "Progress isports Local-Default table" .
+
+localdefault:Country a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Country" .
+
+localdefault:Region1-Label a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Region1-Label" .
+
+localdefault:Region2-Label a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Region2-Label" .
+
+localdefault:Postal-Label a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Postal-Label" .
+
+localdefault:Postal-Format a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Postal-Format" .
+
+localdefault:Tel-Format a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Tel-Format" .
+
+localdefault:Date-Format a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Date-Format" .
+
+localdefault:Currency-Symbol a rdf:Property ;
+	rdfs:domain localdefault:Local-Default ;
+	rdfs:range xsd:string ;
+	rdfs:label "Currency-Symbol" .
+
+
+
+refcall:Ref-Call a rdfs:Class ;
+	rdfs:label "Ref-Call" ;
+	rdfs:comment "Progress isports Ref-Call table" .
+
+refcall:Call-Num a rdf:Property ;
+	rdfs:domain refcall:Ref-Call ;
+	rdfs:range xsd:string ;
+	rdfs:label "Call-Num" .
+
+refcall:Cust-Num a rdf:Property ;
+	rdfs:domain refcall:Ref-Call ;
+	rdfs:range xsd:integer ;
+	rdfs:label "Cust-Num" .
+
+refcall:Call-Date a rdf:Property ;
+	rdfs:domain refcall:Ref-Call ;
+	rdfs:range xsd:date ;
+	rdfs:label "Call-Date" .
+
+refcall:Sales-Rep a rdf:Property ;
+	rdfs:domain refcall:Ref-Call ;
+	rdfs:range xsd:string ;
+	rdfs:label "Sales-Rep" .
+
+refcall:Parent a rdf:Property ;
+	rdfs:domain refcall:Ref-Call ;
+	rdfs:range xsd:string ;
+	rdfs:label "Parent" .
+
+refcall:Txt a rdf:Property ;
+	rdfs:domain refcall:Ref-Call ;
+	rdfs:range xsd:string ;
+	rdfs:label "Txt" .
+
+
+
+salesrep:Salesrep a rdfs:Class ;
+	rdfs:label "Salesrep" ;
+	rdfs:comment "Progress isports Salesrep table" .
+
+salesrep:Sales-Rep a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Sales-Rep" .
+
+salesrep:Rep-Name a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Rep-Name" .
+
+salesrep:Region a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Region" .
+
+salesrep:Month-Quota a rdf:Property ;
+	rdfs:domain salesrep:Salesrep ;
+	rdfs:range xsd:string ;
+	rdfs:label "Month-Quota" .
+
+
+
+state:State a rdfs:Class ;
+	rdfs:label "State" ;
+	rdfs:comment "Progress isports State table" .
+
+state:State_ a rdf:Property ;
+	rdfs:domain state:State ;
+	rdfs:range xsd:string ;
+	rdfs:label "State" .
+
+state:State-Name a rdf:Property ;
+	rdfs:domain state:State ;
+	rdfs:range xsd:string ;
+	rdfs:label "State-Name" .
+
+state:Region a rdf:Property ;
+	rdfs:domain state:State ;
+	rdfs:range xsd:string ;
+	rdfs:label "Region" .
+
+', '', 'http://localhost:8890/schemas/progress/isports', 0);
+
+
+
+----------- Create IRI Classes -------------
+
+
+
+
+SPARQL
+
+prefix customer:     <http://localhost:8890/schemas/progress/isports/customer/>
+prefix order:        <http://localhost:8890/schemas/progress/isports/order/>
+prefix item:         <http://localhost:8890/schemas/progress/isports/item/>
+prefix orderline:    <http://localhost:8890/schemas/progress/isports/order_line/>
+prefix invoice:      <http://localhost:8890/schemas/progress/isports/invoice/>
+prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/>
+prefix refcall:      <http://localhost:8890/schemas/progress/isports/ref_call/>
+prefix salesrep:     <http://localhost:8890/schemas/progress/isports/salesrep/>
+prefix state:        <http://localhost:8890/schemas/progress/isports/state/>
+
+create iri class customer:customer_iri
+	"http://localhost:8890/progress/isports/customer/%d#this"
+	(in Cust_Num integer not null) .
+
+create iri class order:order_iri
+	"http://localhost:8890/progress/isports/order/%d#this"
+	(in Order_Num integer not null) .
+
+create iri class item:item_iri
+	"http://localhost:8890/progress/isports/item/%d#this"
+	(in Item_num integer not null) .
+
+create iri class orderline:order-line_iri
+	"http://localhost:8890/progress/isports/order-line/%d_%d#this"
+	(in Order_num integer not null, in Line_num integer not null) .
+
+create iri class invoice:invoice_iri
+	"http://localhost:8890/progress/isports/invoice/%d#this"
+	(in Invoice_Num integer not null) .
+
+create iri class localdefault:local-default_iri
+	"http://localhost:8890/progress/isports/local-default/%U#this"
+	(in Country varchar not null) .
+
+create iri class refcall:ref-call_iri
+	"http://localhost:8890/progress/isports/ref-call/%U#this"
+	(in Call_Num varchar not null) .
+
+create iri class salesrep:salesrep_iri
+	"http://localhost:8890/progress/isports/salesrep/%U#this"
+	(in Sales_Rep varchar not null) .
+
+create iri class state:state_iri
+	"http://localhost:8890/progress/isports/state/%U#this"
+	(in State varchar not null) .
+
+;
+
+
+
+
+
+
+
+------------- Create Quad Store ------------------------------------
+
+SPARQL
+
+prefix customer:     <http://localhost:8890/schemas/progress/isports/customer/>
+prefix order:        <http://localhost:8890/schemas/progress/isports/order/>
+prefix item:         <http://localhost:8890/schemas/progress/isports/item/>
+prefix orderline:    <http://localhost:8890/schemas/progress/isports/order_line/>
+prefix invoice:      <http://localhost:8890/schemas/progress/isports/invoice/>
+prefix localdefault: <http://localhost:8890/schemas/progress/isports/local_default/>
+prefix refcall:      <http://localhost:8890/schemas/progress/isports/ref_call/>
+prefix salesrep:     <http://localhost:8890/schemas/progress/isports/salesrep/>
+prefix state:        <http://localhost:8890/schemas/progress/isports/state/>
+
+alter quad storage virtrdf:DefaultQuadStorage
+  from isports_rdf.prs10_isports_rdf.VCustomer      as Customer_tbl
+  from isports_rdf.prs10_isports_rdf.VOrder         as Order_tbl
+  from isports_rdf.prs10_isports_rdf.VItem          as Item_tbl
+  from isports_rdf.prs10_isports_rdf.VOrder_Line    as Order_Line_tbl
+  from isports_rdf.prs10_isports_rdf.VInvoice       as Invoice_tbl
+  from isports_rdf.prs10_isports_rdf.VRef_Call      as Ref_Call_tbl
+  from isports_rdf.prs10_isports_rdf.VRef_Call      as Ref_Call_tbl_1  -- Additional Ref_Call_tbl_1 alias required to represent recursive FK relationship (refcall:has_parent) below.
+  from isports_rdf.prs10_isports_rdf.VLocal_Default as Local_Default_tbl
+  from isports_rdf.prs10_isports_rdf.VSalesrep      as Salesrep_tbl
+  from isports_rdf.prs10_isports_rdf.VState         as State_tbl
+{
+  create virtrdf:progress_isports as graph <http://localhost:8890/progress/isports>
+  {
+    customer:customer_iri (Customer_tbl.Cust_Num) a customer:Customer as virtrdf:customer_pk ;
+    customer:Cust-Num     Customer_tbl.Cust_Num     as virtrdf:Customer_cust-num ;
+    customer:Name         Customer_tbl.Name         as virtrdf:Customer_name ;
+    customer:Address      Customer_tbl.Address      as virtrdf:Customer_address ;
+    customer:Address2     Customer_tbl.Address2     as virtrdf:Customer_address2 ;
+    customer:City         Customer_tbl.City         as virtrdf:Customer_city ;
+    customer:State        Customer_tbl.State        as virtrdf:Customer_state ;
+    customer:Country      Customer_tbl.Country      as virtrdf:Customer_country ;
+    customer:Phone        Customer_tbl.Phone        as virtrdf:Customer_phone ;
+    customer:Contact      Customer_tbl.Contact      as virtrdf:Customer_contact ;
+    customer:Sales-Rep    Customer_tbl.Sales_Rep    as virtrdf:Customer_sales_rep ;
+    customer:Comments     Customer_tbl.Comments     as virtrdf:Customer_comments ;
+    customer:Credit-Limit Customer_tbl.Credit_Limit as virtrdf:Customer_credit-limit ;
+    customer:Balance      Customer_tbl.Balance      as virtrdf:Customer_balance ;
+    customer:Terms        Customer_tbl.Terms        as virtrdf:Customer_terms ;
+    customer:Discount     Customer_tbl.Discount     as virtrdf:Customer_discount ;
+    customer:Postal-Code  Customer_tbl.Postal_Code  as virtrdf:Customer_postal-code ;
+    customer:from_state        state:state_iri (State_tbl.State)                           where ( ^{Customer_tbl.}^.State     = ^{State_tbl.}^.State )           as virtrdf:Customer_from_state ;
+    customer:has_sales_rep     salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)              where ( ^{Customer_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep )    as virtrdf:Customer_has_sales_rep ;
+    customer:has_local_default localdefault:local-default_iri (Local_Default_tbl.Country)  where ( ^{Customer_tbl.}^.Country   = ^{Local_Default_tbl.}^.Country ) as virtrdf:Customer_has_local_default ;
+    customer:placed_order      order:order_iri (Order_tbl.Order_num)                       where ( ^{Customer_tbl.}^.Cust_Num  = ^{Order_tbl.}^.Cust_Num )        as virtrdf:Customer_placed_order ;
+    customer:has_invoice       invoice:invoice_iri (Invoice_tbl.Invoice_Num)               where ( ^{Customer_tbl.}^.Cust_Num  = ^{Invoice_tbl.}^.Cust_Num )      as virtrdf:Customer_has_invoice ;
+    customer:ref_call          refcall:ref-call_iri (Ref_Call_tbl.Call_Num)                where ( ^{Customer_tbl.}^.Cust_Num  = ^{Ref_Call_tbl.}^.Cust_Num )     as virtrdf:Customer_ref-call .
+
+    order:order_iri (Order_tbl.Order_num) a order:Order as virtrdf:order_pk ;
+    order:Order-num    Order_tbl.Order_num    as virtrdf:Order_order-num ;
+    order:Cust-Num     Order_tbl.Cust_Num     as virtrdf:Order_cust_num ;
+    order:Order-Date   Order_tbl.Order_Date   as virtrdf:Order_order-date ;
+    order:Ship-Date    Order_tbl.Ship_Date    as virtrdf:Order_ship-date ;
+    order:Promise-Date Order_tbl.Promise_Date as virtrdf:Order_promise-date ;
+    order:Carrier      Order_tbl.Carrier      as virtrdf:Order_carrier ;
+    order:Instructions Order_tbl.Instructions as virtrdf:Order_instructions ;
+    order:PO           Order_tbl.PO           as virtrdf:Order_po ;
+    order:Terms        Order_tbl.Terms        as virtrdf:Order_terms ;
+    order:placed_by    customer:customer_iri (Customer_tbl.Cust_Num)                                 where ( ^{Order_tbl.}^.Cust_Num  = ^{Customer_tbl.}^.Cust_Num )    as virtrdf:Order_placed_by ;
+    order:Sales-Rep    salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)                                where ( ^{Order_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep )   as virtrdf:Order_sales_rep ;
+    order:invoiced_on  invoice:invoice_iri (Invoice_tbl.Invoice_Num)                                 where ( ^{Order_tbl.}^.Order_num = ^{Invoice_tbl.}^.Order_Num )    as virtrdf:Order_invoiced_on ;
+    order:has_lines    orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num)  where ( ^{Order_tbl.}^.Order_num = ^{Order_Line_tbl.}^.Order_num ) as virtrdf:Order_has_lines .
+
+    item:item_iri (Item_tbl.Item_num) a item:Item as virtrdf:item_pk ;
+    item:Item-num        Item_tbl.Item_num        as virtrdf:item_item-num ;
+    item:Item-Name       Item_tbl.Item_Name       as virtrdf:Item_item-Name ;
+    item:Cat-Page        Item_tbl.Cat_Page        as virtrdf:Item_cat-page ;
+    item:Price           Item_tbl.Price           as virtrdf:Item_price ;
+    item:Cat-Description Item_tbl.Cat_Description as virtrdf:Item_cat-description ;
+    item:On-hand         Item_tbl.On_hand         as virtrdf:Item_on-hand ;
+    item:Allocated       Item_tbl.Allocated       as virtrdf:Item_allocated ;
+    item:Re-Order        Item_tbl.Re_Order        as virtrdf:Item_re-order ;
+    item:On-Order        Item_tbl.On_Order        as virtrdf:Item_on-order ;
+    item:order_line  orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num)  where ( ^{Item_tbl.}^.Item_num  = ^{Order_Line_tbl.}^.Item_num )   as virtrdf:Item_order_line .
+
+    orderline:order-line_iri (Order_Line_tbl.Order_num, Order_Line_tbl.Line_num) a orderline:Order-Line as virtrdf:order-line_pk ;
+    orderline:Line-num       Order_Line_tbl.Line_num       as virtrdf:Order-Line_line-num ;
+    orderline:Price          Order_Line_tbl.Price          as virtrdf:Order-Line_price ;
+    orderline:Qty            Order_Line_tbl.Qty            as virtrdf:Order-Line_qty ;
+    orderline:Discount       Order_Line_tbl.Discount       as virtrdf:Order-Line_discount ;
+    orderline:Extended-Price Order_Line_tbl.Extended_Price as virtrdf:Order-Line_extended-price ;
+    orderline:Backorder      Order_Line_tbl.Backorder      as virtrdf:Order-Line_backorder ;
+    orderline:Order-num  order:order_iri (Order_tbl.Order_num)  where ( ^{Order_Line_tbl.}^.Order_num = ^{Order_tbl.}^.Order_num ) as virtrdf:Order_Line_order_num ;
+    orderline:Item-num   item:item_iri (Item_tbl.Item_num)      where ( ^{Order_Line_tbl.}^.Item_num  = ^{Item_tbl.}^.Item_num )   as virtrdf:Order_Line_item_num .
+
+    invoice:invoice_iri (Invoice_tbl.Invoice_Num) a invoice:Invoice as virtrdf:invoice_pk ;
+    invoice:Invoice-Num  Invoice_tbl.Invoice_Num  as virtrdf:Invoice_invoice-num ;
+    invoice:Cust-Num     Invoice_tbl.Cust_Num    as virtrdf:Invoice_cust_num ;
+    invoice:Invoice-Date Invoice_tbl.Invoice_Date as virtrdf:Invoice_invoice-date ;
+    invoice:Amount       Invoice_tbl.Amount       as virtrdf:Invoice_amount ;
+    invoice:Total-Paid   Invoice_tbl.Total_Paid   as virtrdf:Invoice_total-paid ;
+    invoice:Adjustment   Invoice_tbl.Adjustment   as virtrdf:Invoice_adjustment ;
+    invoice:Order-Num    Invoice_tbl.Order_Num    as virtrdf:Invoice_order-num ;
+    invoice:Ship-Charge  Invoice_tbl.Ship_Charge  as virtrdf:Invoice_ship-charge ;
+    invoice:invoiced_to  customer:customer_iri (Customer_tbl.Cust_Num)  where ( ^{Invoice_tbl.}^.Cust_Num  = ^{Customer_tbl.}^.Cust_Num ) as virtrdf:Invoice_invoiced_to ;
+    invoice:Order-Num    order:order_iri (Order_tbl.Order_num)          where ( ^{Invoice_tbl.}^.Order_Num = ^{Order_tbl.}^.Order_num )   as virtrdf:Invoice_order_num .
+
+    localdefault:local-default_iri (Local_Default_tbl.Country) a localdefault:Local-Default as virtrdf:local-default_pk ;
+    localdefault:Country         Local_Default_tbl.Country as virtrdf:local-default_country ;
+    localdefault:Region1-Label   Local_Default_tbl.Region1_Label   as virtrdf:Local-Default_region1-label ;
+    localdefault:Region2-Label   Local_Default_tbl.Region2_Label   as virtrdf:Local-Default_region2-label ;
+    localdefault:Postal-Label    Local_Default_tbl.Postal_Label    as virtrdf:Local-Default_postal-label ;
+    localdefault:Postal-Format   Local_Default_tbl.Postal_Format   as virtrdf:Local-Default_postal-format ;
+    localdefault:Tel-Format      Local_Default_tbl.Tel_Format      as virtrdf:Local-Default_tel-format ;
+    localdefault:Date-Format     Local_Default_tbl.Date_Format     as virtrdf:Local-Default_date-format ;
+    localdefault:Currency-Symbol Local_Default_tbl.Currency_Symbol as virtrdf:Local-Default_currency-symbol ;
+    localdefault:has_customer customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Local_Default_tbl.}^.Country = ^{Customer_tbl.}^.Country ) as virtrdf:Local-Default_has_customer .
+
+    refcall:ref-call_iri (Ref_Call_tbl.Call_Num) a refcall:Ref-Call as virtrdf:ref-call_pk ;
+    refcall:Call-Num   Ref_Call_tbl.Call_Num   as virtrdf:Ref-Call_call-num ;
+    refcall:Cust-Num   Ref_Call_tbl.Cust_Num   as virtrdf:Ref-Call_cust-num ;
+    refcall:Call-Date  Ref_Call_tbl.Call_Date  as virtrdf:Ref-Call_call-date ;
+    refcall:Sales-Rep  Ref_Call_tbl.Sales_Rep  as virtrdf:Ref-sales-rep ;
+    refcall:Parent     Ref_Call_tbl.Parent     as virtrdf:Ref-Call_parent ;
+    refcall:Txt        Ref_Call_tbl.Txt        as virtrdf:Ref-Call_txt ;
+    refcall:made_to     customer:customer_iri (Customer_tbl.Cust_Num)   where  ( ^{Ref_Call_tbl.}^.Cust_Num  = ^{Customer_tbl.}^.Cust_Num )    as virtrdf:Ref-Call_made_to ;
+    refcall:made_by     salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)  where  ( ^{Ref_Call_tbl.}^.Sales_Rep = ^{Salesrep_tbl.}^.Sales_Rep )   as virtrdf:Ref-Call_made-by ;
+    refcall:has_parent  refcall:ref-call_iri (Ref_Call_tbl_1.Call_Num)  where  ( ^{Ref_Call_tbl.}^.Parent    = ^{Ref_Call_tbl_1.}^.Call_Num )  as virtrdf:Ref-Call_has_parent .
+
+    salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep) a salesrep:Salesrep as virtrdf:salesrep_pk ;
+    salesrep:Sales-Rep   Salesrep_tbl.Sales_Rep   as virtrdf:Salesrep_sales-rep ;
+    salesrep:Region      Salesrep_tbl.Region      as virtrdf:Salesrep_region ;
+    salesrep:Rep-Name    Salesrep_tbl.Rep_Name    as virtrdf:Salesrep_rep-name ;
+    salesrep:Month-Quota Salesrep_tbl.Month_Quota as virtrdf:Salesrep_month-quota ;
+    salesrep:is_sales_rep_for customer:customer_iri (Customer_tbl.Cust_Num) where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Customer_tbl.}^.Sales_Rep ) as virtrdf:Salesrep_is_sales_rep_for ;
+    salesrep:has_order        order:order_iri (Order_tbl.Order_num)         where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Order_tbl.}^.Sales_Rep )    as virtrdf:Salesrep_has_order ;
+    salesrep:manages_region   state:state_iri (State_tbl.State)             where ( ^{Salesrep_tbl.}^.Region    = ^{State_tbl.}^.Region )       as virtrdf:Salesrep_manages_region ;
+    salesrep:made_call        refcall:ref-call_iri (Ref_Call_tbl.Call_Num)  where ( ^{Salesrep_tbl.}^.Sales_Rep = ^{Ref_Call_tbl.}^.Sales_Rep ) as virtrdf:Ref-Call_made_call .
+
+    state:state_iri (State_tbl.State) a state:State as virtrdf:state_pk ;
+    state:State_     State_tbl.State        as virtrdf:State_state ;
+    state:State-Name State_tbl.State_Name   as virtrdf:State_state-name ;
+    state:Region     State_tbl.Region       as virtrdf:State_region ;
+    state:has_customer   customer:customer_iri (Customer_tbl.Cust_Num)   where ( ^{State_tbl.}^.State  = ^{Customer_tbl.}^.State )  as virtrdf:State_has_customer ;
+    state:has_sales_rep  salesrep:salesrep_iri (Salesrep_tbl.Sales_Rep)  where ( ^{State_tbl.}^.Region = ^{Salesrep_tbl.}^.Region ) as virtrdf:State_has_sales_rep .
+
+
+  } .
+} .
+;
+
+
+-- Setup re-write rules that enable de-referencing of RDF based descriptions of
+-- iSports Entities
+
+-- Cleanup old rules
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'progress_isports_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'progress_isports_rule%';
+
+-- Create rules for handling HTML representation of Entity (resource) description requests
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'progress_isports_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+-- Create rules for handling RDF based representations (N3 or RDF/XML) of Entity (resource) descriptions
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'progress_isports_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=DESCRIBE+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+%%3Chttp%%3A//localhost%%3A8890%U%%23this%%3E+FROM+%%3Chttp%%3A//localhost%%3A8890/progress/isports%%3E&format=%U',
+    vector('path', 'path', '*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'progress_isports_rule_list1',
+    1,
+    vector (
+  	 	'progress_isports_rule1',
+  	 	'progress_isports_rule2'
+	  ));
+
+-- Setup OWL ontology data space that describes iSports entities
+
+-- Create Virtual Directory access point
+
+VHOST_REMOVE (lpath=>'/progress/isports');
+
+VHOST_DEFINE (
+	lpath=>'/progress/isports',
+	ppath=>'/DAV/progress/isports/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'progress_isports_rule_list1')
+	);
+
+delete from db.dba.url_rewrite_rule_list where urrl_list like 'progress_isports_schemas_rule%';
+delete from db.dba.url_rewrite_rule where urr_rule like 'progress_isports_schemas_rule%';
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'progress_isports_schemas_rule1',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/about/html/http/^{URIQADefaultHost}^%s',
+    vector('path'),
+    null,
+    '(text/html)|(\\*/\\*)',
+    0,
+    303
+    );
+
+DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    'progress_isports_schemas_rule2',
+    1,
+    '(/[^#]*)',
+    vector('path'),
+    1,
+    '/sparql?query=CONSTRUCT+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}%%0D%%0AFROM+%%3Chttp%%3A//localhost%%3A8890/schemas/progress/isports%%3E+%%0D%%0AWHERE+{+%%3Chttp%%3A//localhost%%3A8890%U%%3E+%%3Fp+%%3Fo+}&format=%U',
+    vector('path','path','*accept*'),
+    null,
+    '(text/rdf.n3)|(application/rdf.xml)',
+    0,
+    null
+    );
+
+DB.DBA.URLREWRITE_CREATE_RULELIST (
+    'progress_isports_schemas_rule_list1',
+    1,
+    vector (
+  	 	'progress_isports_schemas_rule1',
+  	 	'progress_isports_schemas_rule2'
+	  ));
+
+-- ensure a VD for the IRIs which begins with /
+VHOST_REMOVE (lpath=>'/schemas/progress/isports');
+
+VHOST_DEFINE (
+	lpath=>'/schemas/progress/isports',
+	ppath=>'/DAV/schemas/progress/isports/',
+    	is_dav=>1,
+	vsp_user=>'dba',
+	is_brws=>0,
+	opts=>vector ('url_rewrite', 'progress_isports_schemas_rule_list1')
+	);
+
+DB.DBA.XML_SET_NS_DECL ('customer',     'http://^{URIQADefaultHost}^/schemas/progress/isports/customer/', 2);
+DB.DBA.XML_SET_NS_DECL ('order',        'http://^{URIQADefaultHost}^/schemas/progress/isports/order/', 2);
+DB.DBA.XML_SET_NS_DECL ('item',         'http://^{URIQADefaultHost}^/schemas/progress/isports/item/', 2);
+DB.DBA.XML_SET_NS_DECL ('orderline',    'http://^{URIQADefaultHost}^/schemas/progress/isports/order_line/', 2);
+DB.DBA.XML_SET_NS_DECL ('invoice',      'http://^{URIQADefaultHost}^/schemas/progress/isports/invoice/', 2);
+DB.DBA.XML_SET_NS_DECL ('localdefault', 'http://^{URIQADefaultHost}^/schemas/progress/isports/local_default/', 2);
+DB.DBA.XML_SET_NS_DECL ('refcall',      'http://^{URIQADefaultHost}^/schemas/progress/isports/ref_call/', 2);
+DB.DBA.XML_SET_NS_DECL ('salesrep',     'http://^{URIQADefaultHost}^/schemas/progress/isports/salesrep/', 2);
+DB.DBA.XML_SET_NS_DECL ('state',        'http://^{URIQADefaultHost}^/schemas/progress/isports/state/', 2);
+]]></programlisting>
+    </sect2>
+</sect1>
diff --git a/docsrc/xmlsource/relnotes.xml b/docsrc/xmlsource/relnotes.xml
index 647e2b9..e8c1c9f 100644
--- a/docsrc/xmlsource/relnotes.xml
+++ b/docsrc/xmlsource/relnotes.xml
@@ -65,7 +65,7 @@
 <listitem><para><emphasis>Bug 3919</emphasis> There is no way to format columns data in editing controls.</para></listitem>
 <listitem><para><emphasis>Bug 3920</emphasis> v:button @style=url or @style=image not working properly.</para></listitem>
 <listitem><para><emphasis>Bug 3921</emphasis> Logical validators error in Data-Set.</para></listitem>
-<listitem><para><emphasis>Bug 3923</emphasis> xslt_format_number doesn’t work properly with value 0.</para></listitem> 
+<listitem><para><emphasis>Bug 3923</emphasis> xslt_format_number doesn't work properly with value 0.</para></listitem> 
 <listitem><para><emphasis>Bug 3924</emphasis> "Cancel" failed after Edit mode in Data-Set.</para></listitem>
 <listitem><para><emphasis>Bug 3925</emphasis> v:column is not more needed in v:data-set.</para></listitem>
 <listitem><para><emphasis>Bug 3926</emphasis> v:update-field obsoleted.</para></listitem>
diff --git a/docsrc/xmlsource/secureodbc.xml b/docsrc/xmlsource/secureodbc.xml
index 434f8e1..eb01119 100644
--- a/docsrc/xmlsource/secureodbc.xml
+++ b/docsrc/xmlsource/secureodbc.xml
@@ -46,8 +46,8 @@ ID (OID) of the username attribute can be used any valid object identifier that
 does not conflict with existing OIDs (for example 2.16.840.1.NNNNNN).
 It will be best to have one's own registered OID for that purpose.</para>
 
-  <sect3 id="secureodbcx509foafsll"><title>FOAF+SSL ODBC Login</title>
-    <para>Virtuoso supports FOAF+SSL ODBC Login. Thus, the INI parameter X509ClientVerify can accept the following values:</para>
+  <sect3 id="secureodbcx509foafsll"><title>WebID Protocol ODBC Login</title>
+    <para>Virtuoso supports WebID Protocol ODBC Login. Thus, the INI parameter X509ClientVerify can accept the following values:</para>
     <itemizedlist mark="bullet">
       <listitem>0 - do not require</listitem>
       <listitem>1 - ask for trusted certificates</listitem>
diff --git a/docsrc/xmlsource/server.xml b/docsrc/xmlsource/server.xml
index 7bcf9a8..f0665b2 100644
--- a/docsrc/xmlsource/server.xml
+++ b/docsrc/xmlsource/server.xml
@@ -36,83 +36,11 @@ command line SQL interface.
 
 <sect2 id="dbadm"><title>Database</title>
 
-  <sect3 id="srvadminstallreqt"><title>Installation Requirements</title>
-    <para>A typical installation will require a minimum of 400Mb of hard disk
-    space to install the code, samples, documentation and sample database.
-The database will need additional space for data inserted, backups,
-    logs and reports, web pages, etc.
-
-</para>
-    <para>The size of the database .db file will not reduce when data is
-    removed. The spare space will however be reclaimed for later use.</para>
-  </sect3>
-
-  <sect3 id="srvadmopreq"><title>Operational Requirements</title>
-    <para>The Virtuoso database requires a minimum of 64Mb of system memory
-    for each instance to operate in. Each connection will take between 70kb
-    and 130kb of memory.</para>
-    <para>The memory usage is affected by the following parameters in the
-    <link linkend="VIRTINI">Virtuoso configuration file</link>.</para>
-    <simplelist>
-      <member>ServerThreads</member>
-      <member>ServerThreadSize</member>
-      <member>MainThreadSize</member>
-      <member>FutureThreadSize</member>
-      <member>NumberOfBuffers</member>
-    </simplelist>
-    <para>See the following <link linkend="parameters">Parameter section</link>
-    for more details.</para>
-  </sect3>
-
-  <sect3 id="srvadmossupport"><title>Operating System Support</title>
-    <para>Virtuoso runs on the following operating systems:</para>
-    <simplelist>
-      <member>Windows 2000,XP,ME,98,95</member>
-      <member>Linux</member>
-      <member>Unix</member>
-      <member>Mac OS X</member>
-    </simplelist>
-  </sect3>
-
-
-<sect3 id="limitsandparameters">
-<title>Limits</title>
-
-<para>
-The below table lists the most important parameters and limits for a database or a Virtuoso server instance.  For space consumption of individual data types, see <link linkend="SpaceConsump">Space Consumption</link>.
-</para>
-
-
-<table> 
-<tbody>
-<row><entry>Identifier length</entry> <entry>100</entry></row>
-<row><entry>User name and password length</entry> <entry>100</entry></row>
-<row><entry>SQLstmt and proc text</entry> <entry>100K+</entry></row>
-<row><entry>varchar length</entry> <entry>Constrained by max row length when stored into non-LOB column, 10MB inside procedure code.</entry></row>
-<row><entry>Numeric precision</entry> <entry>Max 40 digits</entry></row>
-<row><entry>LOB column length</entry> <entry>2GB</entry></row>
-<row><entry>row length</entry> <entry>4086</entry></row>
-<row><entry>Columns per row</entry> <entry>200</entry></row>
-<row><entry>Database size</entry> <entry>32TB for data, 32TB for temp data </entry></row>
-<row><entry>Page size</entry> <entry>8K</entry></row>
-<row><entry>File size</entry> <entry>64 bit file offsets on supporting OS's</entry></row>
-<row><entry>Files per database</entry> <entry>unlimited</entry></row>
-<row><entry>Table size</entry> <entry>Up to database size </entry></row>
-<row><entry>Tables per database</entry> <entry>64K keys, a table takes 1 key for primary key, 1 key per index and 1 key for each obsolete primary key layout  resulting from adding or dropping columns.</entry></row>
-<row><entry>Indexes per table</entry> <entry>Unlimited, subject to global cap on keys.</entry></row>
-<row><entry>Row in sorting/distinct temp</entry> <entry>4078b, as in tables </entry></row>
-<row><entry>Locks per transaction</entry> <entry>Depends on memory, 16b per row lock, 60b per page with at least one row lock.</entry></row>
-<row><entry>Changes per transaction</entry> <entry>Depends on memory, ini parameter allows cap on  rollback before image.</entry></row>
-<row><entry>Virtual memory></entry> <entry>Depends on OS, 64 bit pointers on 64 bit platforms</entry></row>
-<row><entry>Threads</entry> <entry>Depends on OS, ini files specifies cap for pool for SQL client and web server worker thread pools.</entry></row>
-<row><entry>Max connections</entry> <entry>Depends on OS fdset size, at least 2048, license can set a limit</entry></row>
-<row><entry>Memory per connection</entry> <entry>22K plus up to 100 cached SQL statement compilations</entry></row>
-</tbody>
-</table>
-
-</sect3>
-
 
+<para>See details for <link linkend="srvadminstallreqt">Installation Requirements</link>, 
+<link linkend="srvadmopreq">Operational Requirements</link>, 
+	<link linkend="srvadmossupport">Operating System Support</link> and 
+	<link linkend="limitsandparameters">Limits</link>.</para>
 
   <sect3 id="srvadmsrvinst"><title>Server Instance Creation</title>
     <para>Multiple Virtuoso server instances  may coexist on a single machine. Each
@@ -398,7 +326,7 @@ forces Virtuoso to only run on one CPU in a multiprocessor environment.</para>
 				</listitem>
 				<listitem id="ini_Parameters_ServerPort">
 					<formalpara>
-						<title>ServerPort=[<IP Address>]<port></title>
+						<title>ServerPort=[<IP Address>]:<port></title>
 						<para>This is the IP Address and port number where the server will start listening.
 You do not need to specify the listening IP Address but can do in a situation that you want the server to bind to a specific address only.</para>
 					</formalpara>
@@ -996,6 +924,8 @@ LIMIT 1000
                     <listitem>the relevant tables to the above are not created</listitem>
                     <listitem>the index tree maps is set to 8 if no other setting is given</listitem>
                     <listitem>memory reserve is not allocated</listitem>
+                    <listitem>affects DisableTcpSocket. So DisableTcpSocket setting is treated as 1 
+                    	when LiteMode=1, regardless of value in INI file</listitem>
                   </itemizedlist>
 		</para>
 	    </formalpara>
@@ -1021,15 +951,65 @@ lite is 2 in 'normal' mode is 256 by default.
 	<listitem id="ini_DisableTcpSocket">
 	    <formalpara>
 		<title>DisableTcpSocket = 1/0 </title>
-		<para>Disable odbc listen on tcp port, if this given unix socket will always be used.
-In lite mode is 0, thus no tcp listen for sql/odbc connections, can connect
-only via unix socket.
+		<para>Default = 0. If set to 1, disables database listener on TCP port; unix socket must be 
+			used for data access connections (ODBC, JDBC, ADO.NET, OLE DB). When LiteMode=1, 
+			DisableTcpSocket setting in INI file is ignored and treated as if set to 1.
 		</para>
 	    </formalpara>
 	</listitem>
-
-
+	    <listitem id="ini_ExtentReadThreshold">
+	    <formalpara>
+		    <title>ExtentReadThreshold</title>
+		    <para>Controls speculative read of disk pages. If pages are read in close succession 
+        from an extent of 256 consecutive pages, the system may decide to speculatively read 
+        the entire extent.</para>
+        <para>ExtentReadThreshold parameter gives how many consecutive reads are needed to 
+        trigger this.</para>
+        <para>When is set to 0, this means that anytime a page is read, the whole extent is 
+        read along with it</para>
+        <para>When is set to 1, this means that if the first read is at time <emphasis>t</emphasis> 
+        and the next one at time <emphasis>t1</emphasis> and <emphasis>t1-t</emphasis> < ini_ExtentReadWindow msec, 
+        then 2nd read triggers the speculative read.</para>
+        <para>Default is 2.</para> 
+        <para>Takes effect after the buffer pool is full.</para>
+	    </formalpara>
+	  </listitem>
+	  <listitem id="ini_ExtentReadWindow">
+	    <formalpara>
+		    <title>ExtentReadWindow</title>
+		    <para>Controls speculative read of disk pages. If pages are read in close succession 
+        from an extent of 256 consecutive pages, the system may decide to speculatively read 
+        the entire extent.</para>
+		    <para>ExtentReadWindow parameter gives the time within which the reads must fall.</para>
+		    <para>Default is 1000.</para>
+		    <para>Takes effect after the buffer pool is full.</para>
+	    </formalpara>
+	  </listitem>
+	  <listitem id="ini_ExtentReadStartupThreshold">
+	    <formalpara>
+		    <title>ExtentReadStartupThreshold</title>
+		    <para>Controls speculative read of disk pages. If pages are read in close succession 
+        from an extent of 256 consecutive pages, the system may decide to speculatively read 
+        the entire extent.</para>
+		    <para>ExtentReadStartupThreshold parameter value applies while the server is freshly 
+        started and the buffer pool is not yet full. It can be set to preread more aggressively.</para>
+		    <para>Default is 0.</para>
+	    </formalpara>
+	  </listitem>
+	  <listitem id="ini_ExtentReadStartupWindow">
+	    <formalpara>
+		    <title>ExtentReadStartupWindow</title>
+		    <para>Controls speculative read of disk pages. If pages are read in close succession 
+        from an extent of 256 consecutive pages, the system may decide to speculatively read 
+        the entire extent.</para>
+		    <para>ExtentReadStartupWindow parameter value applies while the server is freshly 
+        started and the buffer pool is not yet full. It can be set to preread more aggressively.</para>
+		    <para>Default is 40000.</para>
+	    </formalpara>
+	  </listitem>
           </itemizedlist>
+          <para>Note: The default for startup behavior is to always read full extents and the default for the normal 
+behavior is to trigger preread on the third read inside one second.</para>
 		</sect5>
   <sect5 id="ini_HTTPServer">
 			<title>[HTTPServer]</title>
@@ -1151,6 +1131,18 @@ This is a timeout in seconds before Virtuoso closes an idle HTTP 1.1 connection.
         outside world under any situation.</para>
         </note>
 				</listitem>
+				<listitem id="ini_HTTPServer_HTTPProxyServer">
+            <formalpara>
+        	<title>HTTPProxyServer = proxylocal:3128</title>
+        	<para>HTTP proxy server name and port</para>
+            </formalpara>
+        </listitem>
+        <listitem id="ini_HTTPServer_HTTPProxyExceptions">
+            <formalpara>
+        	<title>HTTPProxyExceptions = localhost:8890, 127.0.0.1:8890</title>
+        	<para>HTTP proxy exceptions name and port.</para>
+            </formalpara>
+        </listitem>   
                                 <listitem id="ini_HTTPServer_HTTPLogFile">
 				<formalpara><title>HTTPLogFile = log.out</title>
 <para>If specified, Virtuoso will produce an HTTP server log file with the date
@@ -1262,13 +1254,13 @@ then the service will be disabled.</para>
 						<para>Whether the server will require X509 certificates from the browsers.</para>
 					</formalpara>
  <simplelist>
-  <member><emphasis>X509ClientVerify = 0</emphasis> - do not require</member>
+  <member><emphasis>X509ClientVerify = 0</emphasis> - no certificate verification required</member>
   <member><emphasis>X509ClientVerify = 1</emphasis> - ask for trusted certificates</member>
-  <member><emphasis>X509ClientVerify = 2</emphasis> - optionally ask, if certificate is given will be verified</member>
-  <member><emphasis>X509ClientVerify = 3</emphasis> - accept optionally any certificate even self-signed</member>
+  <member><emphasis>X509ClientVerify = 2</emphasis> - optionally ask for trusted certificates, if trusted certificate is presented it will be verified</member>
+  <member><emphasis>X509ClientVerify = 3</emphasis> - optionally accept any certificate including self-signed certificates</member>
  </simplelist>
   <tip><title>See Also:</title>
-    <para><link linkend="secureodbcx509foafsll">FOAF+SSL ODBC Login</link></para>
+    <para><link linkend="secureodbcx509foafsll">WebID Protocol ODBC Login</link></para>
   </tip>
 				</listitem>
 				<listitem id="ini_HTTPServer_X509ClientVerifyDepth">
@@ -1458,6 +1450,14 @@ Section <link linkend="rdfandsparql">RDF Data Access and Data Management</link>
 	<para>This controls processing of the "query-uri" parameter of the SPARQL query protocol webservice, means enable 1 or prohibited 0.</para>
     </formalpara>
 </listitem>
+<listitem id="ini_MinExpiration">
+    <formalpara>
+	<title>MinExpiration = 86400</title>
+	<para>Sponger caching parameter in seconds. It will cause sponger to use this value as minimal 
+		expiration of the pages, which would help in cases where source document's server do not 
+		report expiration or it reports no caching at all.</para>
+    </formalpara>
+</listitem>
 <listitem id="ini_MaxCacheExpiration">
     <formalpara>
 	<title>MaxCacheExpiration = 1</title>
@@ -1553,6 +1553,35 @@ impractical in all cases.
 		<sect5 id="ini_I18N">
                   <title>[I18N]</title>
                   <itemizedlist>
+                  	
+                  	<listitem id="ini_I18N_XAnyNormalization">
+                      <formalpara>
+                        <title>WideFileNames = 1/2/3/0</title>
+                        <para>0: default value. It means not to normalize anything, so for ex. 
+                        	"José" and "Jose" are two distinct words.</para>
+                        <para>1: Any pair of base char and combinig char (NSM, non-spacing
+modifier) is replaced with a single combined char, so if character "é" is written as a sequence 
+of "base" character "e" and a unicode char U +301 ("combining acute accent") then the pair will 
+be replaced with single U+00E9 ("latin small letter e acute").
+</para>
+                        <para>2: Any combined char is converted to its (smallest known) base. So
+"é" will lose its accent and become plain old ASCII "e".
+</para>
+                        <para>3: This is equl to 1|2 and when set then performs both conversions. 
+As a result, pair of base char and combinig char loses its second char and chars with accents will lose
+accents.</para>
+                        <para>If the parameter is required at all, the needed value is probably 3. 
+So the fragment of virtuoso.ini should be:</para>
+<programlisting><![CDATA[
+[I18N]
+XAnyNormalization=3	
+]]></programlisting>                        
+  <tip><title>See Also:</title>
+    <para><link linkend="virtuosotipsandtrickscontrolunicode3">How Can I Control the normalization of UNICODE3 accented chars in free-text index?</link></para>
+  </tip>
+                      </formalpara>
+                    </listitem>
+                    
                     <listitem id="ini_I18N_WideFileNames">
                       <formalpara>
                         <title>WideFileNames = 1/0</title>
@@ -2626,6 +2655,10 @@ where the remote is not available. It is SYNCING if a resync is in
 progress, IN SYNC if the account is up to date or REMOTE DISCONNECTED if
 there was a connection to a remote party which subsequently disconnected.
 </para>
+
+  <tip><title>See Also:</title>
+    <para><link linkend="rdfgraphreplication">RDF Graph Replication</link></para>
+  </tip>
 		</sect4>
 		<sect4 id="indexusage">
 			<title>Index Usage</title>
@@ -2924,7 +2957,7 @@ The following functions are restricted by file Access Control Lists (ACL) in the
 
 &usermodel;
 
-&vad;
+&vaddistr;
 
 &backups;
 
diff --git a/docsrc/xmlsource/soap.xml b/docsrc/xmlsource/soap.xml
index 77084f2..44b1f49 100644
--- a/docsrc/xmlsource/soap.xml
+++ b/docsrc/xmlsource/soap.xml
@@ -2083,7 +2083,7 @@ In that case clients are instructed to look at annotation/appinfo of a simple ty
 ]]></programlisting>
 <para>
 This is a little-bit tricky, but this is how  to indicate the type of the content and how to resolve the
-references to the attachments as per the ’WSDL Extension for SOAP in DIME' proposal.
+references to the attachments as per the WSDL Extension for SOAP in DIME' proposal.
 </para>
 
 </example>
diff --git a/docsrc/xmlsource/sqlprocedures.xml b/docsrc/xmlsource/sqlprocedures.xml
index 5d50fdf..ddb6000 100644
--- a/docsrc/xmlsource/sqlprocedures.xml
+++ b/docsrc/xmlsource/sqlprocedures.xml
@@ -424,7 +424,7 @@ CREATE PROCEDURE CFIBO (IN X INTEGER)
 </screen>
 </sect2>
 		<sect2 id="grantprocstmt">
-			<title>Grant Execute Statement</title>
+			<title>Grand Execute Statement</title>
 <programlisting><![CDATA[
 GRANT EXECUTE ON proceudre_name TO grantee_commalist;
 ]]></programlisting>
diff --git a/docsrc/xmlsource/vad.xml b/docsrc/xmlsource/vad.xml
index 604ccc0..f1b22d0 100644
--- a/docsrc/xmlsource/vad.xml
+++ b/docsrc/xmlsource/vad.xml
@@ -21,14 +21,19 @@
  -  
  -  
 -->
-<sect2 id="VAD"><title>VAD - Virtuoso Application Distribution</title>
-
-<para>VAD provides a package distribution framework for installation, management, 
-dependency checking and un-installation of Virtuoso applications.  A VAD package 
-contains all required Virtuoso components, which would constitute an application or 
+<chapter label="vad.xml" id="vad">
+	<title>VAD - Virtuoso Application Distribution</title>
+	<abstract>
+<para>This chapter describes how to use VAD implementation for 
+distribution framework for installation, management,
+dependency checking and un-installation of Virtuoso applications.</para>
+<para>
+A VAD package contains all required Virtuoso components, which would constitute an application or
 hosted solution, within a single distributable file.  A VAD package cannot contain any 
 system parts independent of Virtuoso thus excluding operating system executables, 
-shared objects, installers or settings.  </para>
+shared objects, installers or settings.
+</para>
+</abstract>
 <para>Virtuoso and VAD provide the following abilities:  </para>
 <simplelist>
   <member>List all installed VAD packages.</member>
@@ -41,7 +46,7 @@ shared objects, installers or settings.  </para>
   <member>Uninstall a VAD package.</member>
 </simplelist>
 
-<sect3 id="vadsummary">
+<sect1 id="vadsummary">
 <title>Summary of VAD Operations</title>
 <para>
 The following is what the dba needs to know about VAD packages.</para>
@@ -50,7 +55,9 @@ The following is what the dba needs to know about VAD packages.</para>
 function.  The first argument is the file path, which must be in a
 location that the server process can open, i.e. it is in the DirsAllowed list in the virtuoso.ini file.  The second argument is 0, meaning that we are installing from a file.</para>
 
-<para>SQL> vad_install ('conductor_dav.vad', 0);</para>
+<programlisting><![CDATA[
+SQL> vad_install ('conductor_dav.vad', 0);
+]]></programlisting>
 
 <para>is an example.  If the package installation fails, the server exits
 and will have to be restarted.  No effects of a failed installation
@@ -59,7 +66,9 @@ VAD package for further instructions.</para>
 
 <para>To know what is installed, do:</para>
 
-<para>SQL> vad_list_packages ();</para>
+<programlisting><![CDATA[
+SQL> vad_list_packages ();
+]]></programlisting>
 
 <para>VAD package installations are not recorded in the transaction log.
 Thus, if there is a backup followed by archived transaction logs
@@ -70,10 +79,10 @@ place in the replay sequence.  In practice it is simplest to make an incremental
 
 <para>For any further information, including how to make VAD packages, see the rest of this chapter.
 </para>
-</sect3>
+</sect1>
 
 
-<sect3 id="vadpackcomposition"><title>VAD Package Composition</title>
+<sect1 id="vadpackcomposition"><title>VAD Package Composition</title>
 
 <para>A VAD package has no developer tie-ins; it is built in a development environment 
 from source code that can be managed and versioned in the developers system of preference. </para>
@@ -121,9 +130,9 @@ of the following: </para>
   </listitem>
 </itemizedlist>
 
-</sect3>
+</sect1>
 
-<sect3 id="vadpackversion"><title>Package Versioning</title>
+<sect1 id="vadpackversion"><title>Package Versioning</title>
 
 <para>All required packages should be listed in the VAD sticker.  Known conflict 
 may be listed in either of the conflicting VAD packages stickers, hence VAD stickers 
@@ -143,9 +152,9 @@ various localizations of the package, or divide it into kernel package for any
 language-independent parts and set of language-specific packages, with some 
 dependency between them.  </para>
 
-</sect3>
+</sect1>
 
-<sect3 id="vadprocessres"><title>Processing of Resources</title>
+<sect1 id="vadprocessres"><title>Processing of Resources</title>
 
 <para>During creation of a VAD package, the "location" mentioned above may be 
 name of a file in file system or URI or DAV path.  Upon package-time, URIs will be
@@ -155,9 +164,9 @@ itself, and the target location. </para>
 <para>All SQL files have a specific order of loading.  Tables, views etc. must be 
 defined before being referenced.  </para>
 
-</sect3>
+</sect1>
 
-<sect3 id="vadunsupportfeat"><title>Unsupported Features of VAD</title>
+<sect1 id="vadunsupportfeat"><title>Unsupported Features of VAD</title>
 
 <para>The VAD specification explicitly does not define the following: </para>
 
@@ -207,53 +216,47 @@ package on a single server</title>
   cluster manager about this event. </para>
   </formalpara>
 
-</sect3>
+</sect1>
 
-<sect3 id="vadsecurity"><title>Security</title>
+<sect1 id="vadsecurity"><title>Security</title>
 
 <para>Since VAD packages are run by an administrator as the database DBA user, 
 care must be taken to ensure the package comes from a safe source.  Any new package 
 installed may violate the security regulations of the target database and may even 
 inflict damage to files under the web-root of the Virtuoso Server or in directories 
-specified in the “DirsAllowed” parameter of the virtuoso.ini.  If the 
-virtuoso.ini parameter “AllowOsCalls” is enabled then the installation procedures 
+specified in the "DirsAllowed" parameter of the virtuoso.ini. If the
+virtuoso.ini parameter "AllowOsCalls" is enabled then the installation procedures
 of the package may call operating executables.  It is the responsibility of the 
-database administrator to control this via the “AllowOsCalls”, "SafeExecutables" 
+database administrator to control this via the "AllowOsCalls", "SafeExecutables"
 and "DbaExecutables" parameters of the virtuoso.ini.</para>
 <para>VAD packages do not offer any automatic protection against unauthorized 
 modifications.  Although ever VAD package contains a checksum, its purpose 
 is to guard against data transfer errors, it may not be sufficient to detect 
 unwanted modification.</para>
 
-</sect3>
+</sect1>
 
-<sect3 id="vadbuildingvadpacks"><title>Building VAD Packages</title>
+<sect1 id="vadbuildingvadpacks"><title>Building VAD Packages</title>
 
 <para>Initially, the VAD sticker and resources may reside in the file system, 
 DAV directory and or other locations available through the 
 <function>DB.DBA.HTTP_URI_GET()</function> function.  </para>
-<para>The VAD creation operation parses the VAD sticker’s XML description 
-and constructs the VAD file. </para>
-
-<para><function>DB.DBA.VAD_PACK 
-  <paramdef>in <parameter>sticker_uri</parameter> varchar</paramdef>
-  <paramdef>in <parameter>base_uri_of_resources</parameter> varchar</paramdef>
-  <paramdef>in <parameter>package_uri</parameter> varchar</paramdef> returns varchar</function></para>
-
+<para>The VAD creation operation parses the VAD sticker's XML description
+and constructs the VAD file by calling <link linkend="fn_vad_pack"><function>DB.DBA.VAD_PACK</function></link>.</para>
 <para>This function reads the VAD sticker identified by the <parameter>sticker_uri</parameter> which 
 contains the <computeroutput>vad:package</computeroutput> root element.  
 Then the resources identified in the 
 sticker are retrieved.  All resource URIs are interpreted in the context of the 
 <parameter>base_uri_of_resources</parameter> and are parsed and checked 
 to be syntactically correct.  Resources are appended to generated package that will 
-be stored at the <parameter>package_uri</parameter>.  <function>Vad_pack()</function> 
+be stored at the <parameter>package_uri</parameter>. <link linkend="fn_vad_pack"><function>DB.DBA.VAD_PACK</function></link>
 returns a human readable log of error and warning messages, it will signal 
 errors if any resource or database objects are unavailable at build time.</para>
-<para>By convention, VAD package files have the extension <computeroutput>'.vad'</computeroutput>. </para>
+<para>By convention, VAD package files have the extension '.vad'.</para>
 
-</sect3>
+</sect1>
 
-<sect3 id="vadutils"><title>VAD Utilities</title>
+<sect1 id="vadutils"><title>VAD Utilities</title>
 
 <para>An optional VAD package named VADutils provides various tools for capturing 
 changes made in the database after some point in time.  The result of a capture consists of:</para>
@@ -283,9 +286,9 @@ the underlying VAD package is updated the local customizations will be overwritt
 Being saved in a VAD package, customizations can be reapplied over the 
 updated base package. </para>
 
-</sect3>
+</sect1>
 
-<sect3 id="vadadminrspnslts"><title>VAD Administrator Responsibilities</title>
+<sect1 id="vadadminrspnslts"><title>VAD Administrator Responsibilities</title>
 
 <para>VAD package installation, upgrade and uninstallation requires a 
 temporary break of service.  The package checks may be performed on the 
@@ -301,11 +304,7 @@ functions that can ignore error signals, and provide an interactive editor for
 the VAD Registry etc. </para>
 <para>All operations described below require DBA access to the database.</para>
 
-<para>Check if a VAD package may be installed</para>
-<para><function>DB.DBA.VAD_CHECK_INSTALLABILITY
-  <paramdef>in <parameter>package_uri</parameter> varchar</paramdef>
-  <paramdef>in <parameter>is_dav</parameter> integer</paramdef>
-  returns varchar</function></para>
+<para>Check if a VAD package may be installed by calling <link linkend="fn_vad_check_installability"><function>DB.DBA.VAD_CHECK_INSTALLABILITY</function></link>.</para>
 
 <para>Checks the presence and correct versions of required packages and of the 
 Virtuoso platform. It does not executes any pre-install Virtuoso/PL code from the 
@@ -313,11 +312,7 @@ package, so there's no guarantee that installation will be successful if the
 check found no error. If <parameter>package_uri</parameter> is DAV 
 path, <parameter>is_dav=1</parameter>, else <parameter>is_dav=0</parameter>.</para>
 
-<para>VAD Package Installation</para>
-
-<para><function>DB.DBA.VAD_INSTALL 
-  <paramdef>in <parameter>package_uri</parameter> varchar</paramdef>
-  <paramdef>in <parameter>is_dav</parameter> integer</paramdef> returns varchar</function></para>
+<para>Perform VAD Package Installation by calling <link linkend="fn_vad_install"><function>DB.DBA.VAD_INSTALL</function></link>.</para>
 
 <para>If <parameter>package_uri</parameter> is DAV path, 
 <parameter>is_dav=1</parameter>, else <parameter>is_dav=0</parameter>.</para>
@@ -333,7 +328,7 @@ path, <parameter>is_dav=1</parameter>, else <parameter>is_dav=0</parameter>.</pa
     <listitem>Make a database checkpoint.</listitem>
     <listitem>Run the pre-install SQL script. </listitem>
     <listitem>Load SQL code in the VAD package, in the order specified by the developer.</listitem>
-    <listitem>Copy web resources (VSP, VSPX, XSLT, etc…) into their designated places in WebDAV or file system Web root.</listitem>
+    <listitem>Copy web resources (VSP, VSPX, XSLT, etc.) into their designated places in WebDAV or file system Web root.</listitem>
     <listitem>Run any post-install SQL code.</listitem></itemizedlist>
 	</listitem>
   <listitem>If the installation was successful, the server will come back on-line. </listitem>
@@ -345,7 +340,7 @@ path, <parameter>is_dav=1</parameter>, else <parameter>is_dav=0</parameter>.</pa
   transaction log file (.trx).  Upon Virtuoso restart, the server will continue from 
   the last checkpoint, made prior to install, as if the installation never took place.</listitem>
 </itemizedlist>
-<para>The return value of the <function>VAD_INSTALL()</function> function is 
+<para>The return value of the <link linkend="fn_vad_install"><function>DB.DBA.VAD_INSTALL()</function></link> function is
 usually a sum of messages from pre- and post-installation procedures of the 
 package.  It should normally contain at least the following:</para>
 
@@ -366,22 +361,14 @@ The completeness of the source archive of the application and its independence
 from any ad hoc SQL objects is important, this is the only way the package can 
 be reliably versioned, tracked or uninstalled. </para>
 
-<para>Check if a VAD package may be uninstalled</para>
-
-<para><function>DB.DBA.VAD_CHECK_UNINSTALLABILITY 
-  <paramdef>in <parameter>package_name</parameter> varchar</paramdef>
-  returns varchar</function></para>
+<para>Check if a VAD package may be uninstalled by calling <link linkend="fn_vad_check_uninstallability"><function>DB.DBA.VAD_CHECK_UNINSTALLABILITY</function></link></para>
 
 <para>Performs a preliminary read-only checks to see whether the package given can 
 be uninstalled.  This does not execute any pre-uninstall Virtuoso/PL code from within the 
 package at this stage.  Hence, the success of this function does not guarantee 
 that uninstallation will be successful.  </para>
 
-<para>VAD Package Uninstallation </para>
-
-<para><function>DB.DBA.VAD_UNINSTALL 
-  <paramdef>in <parameter>package_name</parameter> varchar</paramdef>
-  returns varchar</function></para>
+<para>Perform VAD Package Uninstallation by calling <link linkend="fn_vad_uninstall"><function>DB.DBA.VAD_UNINSTALL</function></link>.</para>
 
 <para>The administrator will perform the following operations for the uninstallation process: </para>
 
@@ -412,11 +399,7 @@ that uninstallation will be successful.  </para>
   administrator should consult the log file for clues to the failure. </listitem>
 </itemizedlist>
 
-<para>Check the state of VAD package installation</para>
-
-<para><function>DB.DBA.VAD_CHECK 
-  <paramdef>in <parameter>package_uri</parameter> varchar</paramdef>
- returns varchar</function></para>
+<para>Check the state of VAD package installation by calling <link linkend="fn_vad_check"><function>DB.DBA.VAD_CHECK</function></link>.</para>
 
 <para>This checks to see if the elements of the package are as they are defined 
 in the original distribution. A list of differing elements is returned.  Differences 
@@ -432,9 +415,9 @@ elements may not be part of some other package, hence no package uninstall
 would be available leading the DBA to drop them with the appropriate 
 SQL commands.</para>
 
-</sect3>
+</sect1>
 
-<sect3 id="vadpackageoverlap"><title>Package Overlap</title>
+<sect1 id="vadpackageoverlap"><title>Package Overlap</title>
 
 <para>Each package contains full definitions of all tables and indices.  
 Upon installing the following outcomes can occur: </para>
@@ -465,15 +448,15 @@ columns by another package installed later.  These elements will only be
 dropped when the owner package is dropped.  Tables created ad-hoc from 
 interactive SQL do not have any owner package.  </para>
 
-</sect3>
-<sect3 id="vadsticker"><title>VAD Sticker</title>
+</sect1>
+<sect1 id="vadsticker"><title>VAD Sticker</title>
 
 <para>The VAD Sticker contains meta-data and descriptions of resources contained, 
 or to be contained, within a VAD package.  Like any XML documents, the target 
 VAD package sticker can be sourced from more than one source file, which can 
 aid maintenance and development.</para>
 
-<sect4 id="vadstickerdtd"><title>VAD Sticker DTD</title>
+<sect2 id="vadstickerdtd"><title>VAD Sticker DTD</title>
 
 <para>The namespace vad, used below, represents the URI 
 <computeroutput>http://www.openlinksw.com/urn/vad</computeroutput>. </para>
@@ -798,6 +781,7 @@ from 1.00 to 2.17, inclusive -->
 </sticker>
 ]]></programlisting>
 </example>
-</sect4>
-</sect3>
 </sect2>
+</sect1>
+
+</chapter>
\ No newline at end of file
diff --git a/docsrc/xmlsource/vaddistr.xml b/docsrc/xmlsource/vaddistr.xml
new file mode 100644
index 0000000..46716dc
--- /dev/null
+++ b/docsrc/xmlsource/vaddistr.xml
@@ -0,0 +1,781 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ -
+ -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ -  project.
+ -
+ -  Copyright (C) 1998-2006 OpenLink Software
+ -
+ -  This project is free software; you can redistribute it and/or modify it
+ -  under the terms of the GNU General Public License as published by the
+ -  Free Software Foundation; only version 2 of the License, dated June 1991.
+ -
+ -  This program is distributed in the hope that it will be useful, but
+ -  WITHOUT ANY WARRANTY; without even the implied warranty of
+ -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ -  General Public License for more details.
+ -
+ -  You should have received a copy of the GNU General Public License along
+ -  with this program; if not, write to the Free Software Foundation, Inc.,
+ -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ -
+ -
+-->
+<sect2 id="vaddistr"><title>VAD - Virtuoso Application Distribution</title>
+
+<para>VAD provides a package distribution framework for installation, management,
+dependency checking and un-installation of Virtuoso applications. A VAD package
+contains all required Virtuoso components, which would constitute an application or
+hosted solution, within a single distributable file. A VAD package cannot contain any
+system parts independent of Virtuoso thus excluding operating system executables,
+shared objects, installers or settings.</para>
+<para>Virtuoso and VAD provide the following abilities:  </para>
+<simplelist>
+  <member>List all installed VAD packages.</member>
+  <member>List all completed operations over VAD packages.</member>
+  <member>Dependency checking - Check preconditions for installation of a package.</member>
+  <member>Install a VAD package.</member>
+  <member>Verification of installed package, compare to distribution state with ability
+  to build of list of locally changed parts of the package.</member>
+  <member>Check preconditions for un-installation of a package.</member>
+  <member>Uninstall a VAD package.</member>
+</simplelist>
+
+<sect3 id="vadsummary">
+<title>Summary of VAD Operations</title>
+<para>
+The following is what the dba needs to know about VAD packages.</para>
+
+<para>A VAD package is installed from a file with the db..vad_install SQL
+function. The first argument is the file path, which must be in a
+location that the server process can open, i.e. it is in the DirsAllowed list in the virtuoso.ini file. The second argument is 0, meaning that we are installing from a file.</para>
+
+<programlisting><![CDATA[
+SQL> vad_install ('conductor_dav.vad', 0);
+]]></programlisting>
+
+<para>is an example. If the package installation fails, the server exits
+and will have to be restarted. No effects of a failed installation
+will remain in the database after restart. Contact the supplier of the
+VAD package for further instructions.</para>
+
+<para>To know what is installed, do:</para>
+
+<programlisting><![CDATA[
+SQL> vad_list_packages ();
+]]></programlisting>
+
+<para>VAD package installations are not recorded in the transaction log.
+Thus, if there is a backup followed by archived transaction logs
+produced if CheckpointAuditTrail is on in virtuoso.ini, the VAD install
+must be performed before replaying any logs that were made after the
+VAD installation. The package installation must be just in the right
+place in the replay sequence. In practice it is simplest to make an incremental backup after installing and packages, see backup_online () or the section on backing up.</para>
+
+<para>For any further information, including how to make VAD packages, see the rest of this chapter.
+</para>
+</sect3>
+
+
+<sect3 id="vadpackcomposition"><title>VAD Package Composition</title>
+
+<para>A VAD package has no developer tie-ins; it is built in a development environment
+from source code that can be managed and versioned in the developers system of preference.</para>
+<para>The VAD package is described by an XML structure called the 'VAD Sticker'. The
+VAD sticker describes items to deploy, procedures to execute at install and uninstall time
+and all conditions to be checked to ensure correct installation. The VAD Sticker consists
+of the following:</para>
+
+<itemizedlist>
+  <listitem>VAD package meta data
+  <itemizedlist>
+    <listitem>Names of package, developer, copyright holder etc. </listitem>
+    <listitem>Version number of package, build date, build number, build type (e.g.
+	sort of optimization performed). </listitem>
+    <listitem>Dependency information: minimal/maximal allowed version numbers of
+	Virtuoso server and depending VAD packages. Every required package may
+	include hint-text that may help the administrator determine (a) why the dependent
+	package is required, and (b) how to obtain the required package.</listitem>
+    <listitem>Information regarding known conflicts between packages; conflicting
+	package names and version number, with optional troubleshooting hints.</listitem>
+    <listitem>Ability to uninstall, a flag and list of reasons why it may be impossible
+	to uninstall the package.</listitem>
+    <listitem>Custom configuration data to be placed in the VAD Registry </listitem>
+    </itemizedlist>
+  </listitem>
+  <listitem>Locations of SQL files containing main and installation code:
+  <itemizedlist>
+    <listitem>Pre-install code, used to check application-specific installation preconditions.</listitem>
+    <listitem>Application specific table and view definitions.</listitem>
+    <listitem>Application specific stored procedure and trigger definitions. </listitem>
+    <listitem>Post-install (initialization) code, such as initial contents of tables.</listitem>
+    <listitem>Pre-uninstall code, used to check that it is safe to uninstall a package. </listitem>
+    <listitem>Post-uninstall code, used for removal of cached resources unusable or
+	meaningless without the package.</listitem>
+    </itemizedlist>
+  </listitem>
+  <listitem>Locations of Resources:
+  <itemizedlist>
+    <listitem>Documentation files. </listitem>
+    <listitem>Samples data for demonstration or package sanity check.</listitem>
+    <listitem>VSP/VSPX pages, related graphics, Java scripts, stylesheets, other
+	web content. </listitem>
+    <listitem>XML docs, XSLT sheets, DTDs and Schemas. </listitem>
+    </itemizedlist>
+  </listitem>
+</itemizedlist>
+
+</sect3>
+
+<sect3 id="vadpackversion"><title>Package Versioning</title>
+
+<para>All required packages should be listed in the VAD sticker. Known conflict
+may be listed in either of the conflicting VAD packages stickers, hence VAD stickers
+of all installed packages should be checked.</para>
+<para>Later versions of a package may be installed replacing earlier versions
+of the same package. This however can be prohibited by listing either version
+(or limit) as a known conflict in either VAD package sticker in the usual way.
+Furthermore, it is possible to prevent re-installation of a package by stating that it
+conflicts with itself. This provides some security against exploits involving attempts
+to upgrade, downgrade or re-install a package, in the hope that the administrator
+may corrupt the existing installation by installing new packages and working through
+installing their dependencies.</para>
+<para>Packages may differ in language and encoding of documentation and resource
+files, even though the version number remains the same. If a package is sensitive to
+internationalization issues, the developer should either assign different names to
+various localizations of the package, or divide it into kernel package for any
+language-independent parts and set of language-specific packages, with some
+dependency between them.</para>
+
+</sect3>
+
+<sect3 id="vadprocessres"><title>Processing of Resources</title>
+
+<para>During creation of a VAD package, the "location" mentioned above may be
+name of a file in file system or URI or DAV path. Upon package-time, URIs will be
+resolved and resources under them will be copied into the package. The resulting
+sticker will thus contain the location of resource within the package, the resource
+itself, and the target location.</para>
+<para>All SQL files have a specific order of loading. Tables, views etc. must be
+defined before being referenced.</para>
+
+</sect3>
+
+<sect3 id="vadunsupportfeat"><title>Unsupported Features of VAD</title>
+
+<para>The VAD specification explicitly does not define the following:</para>
+
+<formalpara><title>Method of development or environment</title>
+  <para>There are no specific restrictions for the schema or Virtuoso/PL code of the
+  package. The VAD system does not make assumptions on the method of
+  software development.</para>
+  </formalpara>
+<formalpara><title>Method of source code control or versioning</title>
+  <para>Version numbers used in the sticker have nothing common with tag labels
+  in a developers versioning system. Procedures edited directly within the
+  database using a web interface or CASE tools should be exported to a file for
+  inclusion in a VAD package. If the application developer uses some script to
+  export such code, this script is not usually part of sticker or the resulting package.</para>
+  </formalpara>
+<formalpara><title>Shipping/Deployment the VAD package from vendor to user</title>
+  <para>VAD provides no methods for downloading dependent packages, or check
+  for package updates etc.</para>
+  </formalpara>
+<formalpara><title>Concurrent running of multiple versions of the same VAD
+package on a single server</title>
+  <para>There can be no guarantee that pre- or post-installation checks will
+  provide valid results if more than one VAD is being processed at the same
+  time. VAD does however guarantee that a package installation will be
+  either entirely successful or entirely rolled back.</para>
+  </formalpara>
+<formalpara><title>Installation or maintenance of non-Virtuoso hosted components</title>
+  <para>Unlike Virtuoso-based packages, these components are usually operating
+  system specific, they may require some complex tuning, and their usage from
+  within Virtuoso applications may even require changes in virtuoso.ini configuration
+  file. VAD packages may contain test calls in pre-installation SQL procedures
+  to check that required external executables are available and provide
+  the functionality required.</para>
+  </formalpara>
+<formalpara><title>Data migration</title>
+  <para>Some installations may require several days to complete migration/conversion
+  of stored data. Whilst it may be possible to provide a restricted service
+  during such time, VAD contains no tools to simplify such a process, this is
+  left to the administrator or developer. VAD completes its work right after
+  the execution of the post-installation code.</para>
+  </formalpara>
+<formalpara><title>Synchronous installation of a package on all hosts of a distributed system or cluster</title>
+  <para>VAD has no standardized metadata regarding replication issues, hence
+  package-specific code may be required. Similarly, if a cluster uses
+  "round-robin" or a "director" loading management system and the server should
+  be stopped for VAD installation, the administrator should explicitly inform the
+  cluster manager about this event.</para>
+  </formalpara>
+
+</sect3>
+
+<sect3 id="vadsecurity"><title>Security</title>
+
+<para>Since VAD packages are run by an administrator as the database DBA user,
+care must be taken to ensure the package comes from a safe source. Any new package
+installed may violate the security regulations of the target database and may even
+inflict damage to files under the web-root of the Virtuoso Server or in directories
+specified in the "DirsAllowed" parameter of the virtuoso.ini. If the
+virtuoso.ini parameter "AllowOsCalls" is enabled then the installation procedures
+of the package may call operating executables. It is the responsibility of the
+database administrator to control this via the "AllowOsCalls", "SafeExecutables"
+and "DbaExecutables" parameters of the virtuoso.ini.</para>
+<para>VAD packages do not offer any automatic protection against unauthorized
+modifications. Although ever VAD package contains a checksum, its purpose
+is to guard against data transfer errors, it may not be sufficient to detect
+unwanted modification.</para>
+
+</sect3>
+
+<sect3 id="vadbuildingvadpacks"><title>Building VAD Packages</title>
+
+<para>Initially, the VAD sticker and resources may reside in the file system,
+DAV directory and or other locations available through the
+<function>DB.DBA.HTTP_URI_GET()</function> function.</para>
+<para>The VAD creation operation parses the VAD sticker's XML description
+and constructs the VAD file by calling <link linkend="fn_vad_pack"><function>DB.DBA.VAD_PACK</function></link>.</para>
+<para>This function reads the VAD sticker identified by the <parameter>sticker_uri</parameter> which
+contains the <computeroutput>vad:package</computeroutput> root element.
+Then the resources identified in the
+sticker are retrieved. All resource URIs are interpreted in the context of the
+<parameter>base_uri_of_resources</parameter> and are parsed and checked
+to be syntactically correct. Resources are appended to generated package that will
+be stored at the <parameter>package_uri</parameter>. <link linkend="fn_vad_pack"><function>DB.DBA.VAD_PACK</function></link>
+returns a human readable log of error and warning messages, it will signal
+errors if any resource or database objects are unavailable at build time.</para>
+<para>By convention, VAD package files have the extension '.vad'.</para>
+
+</sect3>
+
+<sect3 id="vadutils"><title>VAD Utilities</title>
+
+<para>An optional VAD package named VADutils provides various tools for capturing
+changes made in the database after some point in time. The result of a capture consists of:</para>
+
+<itemizedlist>
+  <listitem>Database object additions whose names match given patterns (e.g.
+  all tables and procedures within a particular catalog/qualifier).</listitem>
+  <listitem>Resource additions under particular locations.</listitem>
+  <listitem>Post-install local customizations of selected packages.</listitem>
+</itemizedlist>
+
+<para>The capture results may be useful for the following purposes:</para>
+
+<itemizedlist>
+  <listitem>Archival of changes for replaying later.</listitem>
+  <listitem>Creating a special package of the changes for applying against a
+  fresh installation of the package. </listitem>
+  <listitem>Creating a new complete package containing both the original and
+  changes that will be included in the package sticker.</listitem>
+</itemizedlist>
+
+<para>These mechanisms provide good support for centralized development and custom
+deployment methodology. If a site is localized to contain local links, graphics,
+custom layout and such, then VAD capabilities offer help to the developer to
+define the specific overlay of customizations over another VAD package. When
+the underlying VAD package is updated the local customizations will be overwritten.
+Being saved in a VAD package, customizations can be reapplied over the
+updated base package.</para>
+
+</sect3>
+
+<sect3 id="vadadminrspnslts"><title>VAD Administrator Responsibilities</title>
+
+<para>VAD package installation, upgrade and uninstallation requires a
+temporary break of service. The package checks may be performed on the
+fly if it can be guaranteed that the resources being inspected will not be
+altered by any users. The package check is a read-only process and operates
+solely within the VAD Registry using read-only functions.</para>
+<para>All VAD operations are logged in the server event log. All completed
+operations are reflected in the <computeroutput>DB.DBA.VAD_HISTORY</computeroutput>
+system table.</para>
+<para>The optional VADutils package provides some additional administrative tools,
+mostly for troubleshooting. These include special installation and de-installation
+functions that can ignore error signals, and provide an interactive editor for
+the VAD Registry etc.</para>
+<para>All operations described below require DBA access to the database.</para>
+
+<para>Check if a VAD package may be installed by calling <link linkend="fn_vad_check_installability"><function>DB.DBA.VAD_CHECK_INSTALLABILITY</function></link>.</para>
+
+<para>Checks the presence and correct versions of required packages and of the
+Virtuoso platform. It does not executes any pre-install Virtuoso/PL code from the
+package, so there's no guarantee that installation will be successful if the
+check found no error. If <parameter>package_uri</parameter> is DAV
+path, <parameter>is_dav=1</parameter>, else <parameter>is_dav=0</parameter>.</para>
+
+<para>Perform VAD Package Installation by calling <link linkend="fn_vad_install"><function>DB.DBA.VAD_INSTALL</function></link>.</para>
+
+<para>If <parameter>package_uri</parameter> is DAV path,
+<parameter>is_dav=1</parameter>, else <parameter>is_dav=0</parameter>.</para>
+
+<para>The administrator performs the following operations when installing:</para>
+
+<itemizedlist>
+  <listitem>Invoke the install procedure from the web user interface or interactive SQL. This will perform the following:
+  <itemizedlist>
+    <listitem>Install documentation files.</listitem>
+    <listitem>Check for version and prerequisite package compatibility.</listitem>
+    <listitem>Disconnect SQL users and terminate web processing.</listitem>
+    <listitem>Make a database checkpoint.</listitem>
+    <listitem>Run the pre-install SQL script. </listitem>
+    <listitem>Load SQL code in the VAD package, in the order specified by the developer.</listitem>
+    <listitem>Copy web resources (VSP, VSPX, XSLT, etc.) into their designated places in WebDAV or file system Web root.</listitem>
+    <listitem>Run any post-install SQL code.</listitem></itemizedlist>
+	</listitem>
+  <listitem>If the installation was successful, the server will come back on-line. </listitem>
+  <listitem>If the installation was unsuccessful, e.g., mid-install failure due
+  to running out of disk space, or some other serious unrecoverable database error,
+  the Virtuoso server will exit. The administrator should consult the Virtuoso log
+  file to see what caused the failure. The installation can be completely undone
+  manually by halting the server (if not already stopped), and removing the
+  transaction log file (.trx). Upon Virtuoso restart, the server will continue from
+  the last checkpoint, made prior to install, as if the installation never took place.</listitem>
+</itemizedlist>
+<para>The return value of the <link linkend="fn_vad_install"><function>DB.DBA.VAD_INSTALL()</function></link> function is
+usually a sum of messages from pre- and post-installation procedures of the
+package. It should normally contain at least the following:</para>
+
+<itemizedlist>
+  <listitem>any errors and/or warnings encountered.</listitem>
+  <listitem>created users and catalogs/qualifiers </listitem>
+  <listitem>root VSP page for accessing the application, if applicable.</listitem>
+  <listitem>path to installed documentation files.</listitem>
+  <listitem>performance optimization hints.</listitem>
+</itemizedlist>
+
+<para>The VAD packages should be tested to install on an empty Virtuoso database,
+after any required VAD packages. Installing a package on an empty server is
+useful for determining that no other procedures or components were missed.
+Since the application would normally run on the development machine where
+the VAD package was built, it can be easy to overlook some components.
+The completeness of the source archive of the application and its independence
+from any ad hoc SQL objects is important, this is the only way the package can
+be reliably versioned, tracked or uninstalled.</para>
+
+<para>Check if a VAD package may be uninstalled by calling <link linkend="fn_vad_check_uninstallability"><function>DB.DBA.VAD_CHECK_UNINSTALLABILITY</function></link></para>
+
+<para>Performs a preliminary read-only checks to see whether the package given can
+be uninstalled. This does not execute any pre-uninstall Virtuoso/PL code from within the
+package at this stage. Hence, the success of this function does not guarantee
+that uninstallation will be successful.</para>
+
+<para>Perform VAD Package Uninstallation by calling <link linkend="fn_vad_uninstall"><function>DB.DBA.VAD_UNINSTALL</function></link>.</para>
+
+<para>The administrator will perform the following operations for the uninstallation process:</para>
+
+<itemizedlist>
+  <listitem>Invoke the uninstall procedure from the web user interface or
+  interactive SQL. This will initiate the following:
+  <itemizedlist>
+    <listitem>Check that no other packages are using the package to be uninstalled. </listitem>
+    <listitem>disconnect SQL users and terminate web processing.</listitem>
+    <listitem>Make a database checkpoint.</listitem>
+    <listitem>Run the pre-uninstall SQL script.</listitem>
+    <listitem>Remove web resources installed by the package (all VSP , VSPX,
+	XSLT, etc files) in WebDAV or the filesystem under the web root.</listitem>
+    <listitem>Drop all SQL procedures and data. This is performed in reverse order to the install. </listitem>
+    <listitem>Run any post-uninstall SQL code.</listitem>
+    <listitem>Remove documentation files explicitly marked as removable. Usually
+	documentation would not be deleted as part of package uninstallation in case it is
+	needed e.g. if a set of documents is distributed as VAD package) </listitem>
+  </itemizedlist>
+  </listitem>
+  <listitem>If uninstallation was successful the server will come back on-line. </listitem>
+  <listitem>If uninstallation was unsuccessful, the server will exit. Uninstallation could
+  fail due to lack of disk space or some other serious unrecoverable database error.
+  The failed uninstallation attempt can be manually reversed by halting the
+  server (if not already) and deleting the transaction log file (.trx). Upon
+  server restart Virtuoso will continue from the last checkpoint, made prior to
+  uninstallation, as if the uninstallation was never attempted. The
+  administrator should consult the log file for clues to the failure. </listitem>
+</itemizedlist>
+
+<para>Check the state of VAD package installation by calling <link linkend="fn_vad_check"><function>DB.DBA.VAD_CHECK</function></link>.</para>
+
+<para>This checks to see if the elements of the package are as they are defined
+in the original distribution. A list of differing elements is returned. Differences
+revealed may not indicate a corruption, such changes could have been made
+intentionally by another package, possibly a later version or upgrade that added
+some columns to tables, and some resources may be customized by the user
+post-installation.</para>
+<para>This will check for the prior existence of tables, views etc owned by
+other applications that are not compatible with this application. Any such
+schema objects found are listed, the installation will not continue. These
+may be dropped by the DBA to help the installation to succeed. Some such
+elements may not be part of some other package, hence no package uninstall
+would be available leading the DBA to drop them with the appropriate
+SQL commands.</para>
+
+</sect3>
+
+<sect3 id="vadpackageoverlap"><title>Package Overlap</title>
+
+<para>Each package contains full definitions of all tables and indices.
+Upon installing the following outcomes can occur:</para>
+
+<itemizedlist>
+  <listitem>If a table already exists with the same primary key as the new
+  definition, additional columns are added to the table. If the primary keys
+  differ, the installation automatically fails. Note that a pre-install SQL script can
+  be defined to explicitly alter tables if consecutive versions of an application
+  use different primary keys. </listitem>
+  <listitem>Existing indexes are left untouched. New indices are added as specified
+  in the package. If indices should be modified or dropped, the pre-install
+  script is a reasonable place for dropping these.</listitem>
+</itemizedlist>
+
+<para>Thus the same SQL schema can be loaded twice without ill effect.</para>
+<para>The post install script should be used to populate tables and such.
+Inserts should be executed using the insert soft statement so that attempts to
+insert duplicate are silently ignored without causing the installation to fail. The
+post install script can perform any application level data format changes.</para>
+<para>Packages should define their own distinct catalog or qualifier. They
+should not overwrite another package unless upgrading a prior version.
+Sometimes a package will require the use of another package's tables. This
+should be achieved via grants issued in a pre-install script. A schema
+element such as a table, view or procedure will always have at most one
+owner package even though it may be referenced or even modified with additional
+columns by another package installed later. These elements will only be
+dropped when the owner package is dropped. Tables created ad-hoc from
+interactive SQL do not have any owner package.</para>
+
+</sect3>
+<sect3 id="vadsticker"><title>VAD Sticker</title>
+
+<para>The VAD Sticker contains meta-data and descriptions of resources contained,
+or to be contained, within a VAD package. Like any XML documents, the target
+VAD package sticker can be sourced from more than one source file, which can
+aid maintenance and development.</para>
+
+<sect4 id="vadstickerdtd"><title>VAD Sticker DTD</title>
+
+<para>The namespace vad, used below, represents the URI
+<computeroutput>http://www.openlinksw.com/urn/vad</computeroutput>.</para>
+<para>The top level element of a VAD Sticker is <sticker>. It must contain a
+<caption> element and may contain <dependencies>,
+<procedures>, <ddls> and <resources> elements.</para>
+
+<programlisting><![CDATA[
+<!--<<top>>-->
+<!ENTITY % vad.source_sticker "INCLUDE">
+<!ENTITY % vad.package_sticker "IGNORE">
+<!ENTITY % vad.ecm.group_content "(dependencies | procedures | ddls | resources | registry)" >
+<![%vad.source_sticker;[
+  <!ENTITY % vad.ecm.sticker "(caption, (group | %vad.ecm.group_content;)*)">
+  <!ELEMENT group ((group | %vad.ecm.group_content;)*) >
+  ]]>]]><![CDATA[
+<![%vad.package_sticker;[
+  <!ENTITY % vad.ecm.sticker "(caption, %vad.ecm.group_content;)">
+  ]]>]]><![CDATA[
+<!ELEMENT sticker %vad.ecm.sticker; >
+<!ATTLIST sticker
+  version     NMTOKEN #REQUIRED
+  xml:lang    CDATA   #REQUIRED
+  >
+    <!--<</top>>-->
+
+    <!--<<caption>>-->
+<!ELEMENT caption (name, version)>
+<!ELEMENT name ((prop)*)>
+<!ATTLIST name
+  package NMTOKEN #REQUIRED
+  >
+<!ELEMENT version ((prop)*)>
+<!ATTLIST version
+  package NMTOKEN #REQUIRED
+  >
+<!ELEMENT prop EMPTY>
+<!ATTLIST prop
+  name NMTOKEN #REQUIRED
+  value CDATA #REQUIRED
+  >
+    <!--<</caption>>-->
+]]></programlisting>
+
+<para>The caption contains one name and one version element. These elements
+have a package attribute for keeping requisites used by VAD procedures.
+Other prop-s are for keeping admin-readable info, but they will not affect the
+installer's behavior. Typical names of properties here are Vendor, Copyright,
+Release+Date, Build, Language, Encoding, but any (even non-unique) names
+are acceptable.</para>
+
+<para>Sticker's elements for dependencies</para>
+
+<programlisting><![CDATA[
+<!--<<dependencies>>-->
+<!ELEMENT dependencies ((require | allow | conflict)*) >
+<!ATTLIST dependencies>
+<!ENTITY % vad.ecm.version_list "((version | versions_earlier | versions_later)*)">
+<!ELEMENT require (name, %vad.ecm.version_list;) >
+<!ELEMENT allow (name, %vad.ecm.version_list;) >
+<!ELEMENT conflict (name, %vad.ecm.version_list;) >
+<!ATTLIST require
+  group NMTOKEN #IMPLIED
+  >
+<!ELEMENT versions_earlier ((prop)*)>
+<!ATTLIST versions_earlier
+  package NMTOKEN #REQUIRED
+  >
+<!ELEMENT versions_later ((prop)*)>
+<!ATTLIST versions_later
+  package NMTOKEN #REQUIRED
+  >
+    <!--<</dependencies>>-->
+]]></programlisting>
+
+<para>Element dependencies contains an list of packages related to given one.
+For every version or range of versions of every package, developer may specify
+whether the given version is required for the package, or allowed but not
+required, or will cause some sort of troubles.</para>
+<para>More precisely, to find information about some particular version of a
+package, the list of children of dependencies element will be scanned from top
+to bottom. If the first matching record is in conflict group, not in require or
+allow, then installation is impossible. From other side, there must be at least
+one installed package for every require section.</para>
+<para>Element require may be labeled with optional group attribute. As an
+exception from common rule, there must be at least one installed package for
+every group of require sections with identical name. E.g. If an installation of
+package B requires either of two interchangeable packages A1 and A2, sticker
+should contain a pair of nodes in the same group:</para>
+
+<programlisting><![CDATA[
+<require group="G">
+  <name package="A1">...</name>
+</require>
+]]></programlisting>
+<para>...</para>
+<programlisting><![CDATA[
+<require group="G">
+  <name package="A2">...</name>
+</require>
+]]></programlisting>
+
+<note><title>Note:</title>
+  <para>There are no methods to specify that exactly one package, either A1 or
+  A2, should be installed. It must be done by placing proper conflict
+  descriptions in stickers of A1 and/or A2, but not in the sticker of B.</para></note>
+
+<para>Sticker's elements for procedures</para>
+<programlisting><![CDATA[
+<!--<<procedures>>-->
+<!ELEMENT procedures ((sql)*)>
+<!ATTLIST procedures
+  uninstallation (supported | prohibited) #REQUIRED
+  >
+<![%vad.source_sticker;[
+  <!ENTITY % vad.sql.include "include CDATA #IMPLIED">
+  ]]>]]><![CDATA[
+<![%vad.package_sticker;[
+  <!ENTITY % vad.sql.include "">
+  ]]>]]><![CDATA[
+<!ELEMENT sql (#PCDATA)>
+<!ATTLIST sql
+  purpose (install-check | pre-install | post-install | uninstall-check | pre-uninstall | post-uninstall) #REQUIRED
+  %vad.sql.include;
+  >
+    <!--<</procedures>>-->
+]]></programlisting>
+
+<para>Element procedures contains an list of Virtuoso/PL fragments, and every fragment
+is tagged by one of four values of the purpose attribute. At every stage of install
+or uninstall VAD procedure, a whole list of procedures will be scanned from the
+beginning to the end, and all procedures of appropriate sort will be executed in
+the same order as they are listed. In source sticker files, include attribute may
+be used to insert text of some external file instead of having SQL code written
+inside the element.</para>
+
+<para>Sticker's elements for ddls</para>
+
+<programlisting><![CDATA[
+<!--<<ddls>>-->
+<!ELEMENT ddls ((sql)*)>
+<!ATTLIST ddls
+  >
+    <!--<</ddls>>-->
+]]></programlisting>
+
+<para>Element ddls is very similar to procedures and contains an list of
+Virtuoso/PL fragments to create schemas etc.</para>
+
+<para>Sticker's elements for resources</para>
+
+<programlisting><![CDATA[
+<!--<<resources>>-->
+<!ELEMENT resources ((file | location)*)>
+<!ATTLIST resources >
+<![%vad.source_sticker;[
+  <!ENTITY % vad.file.source_uri "source_uri CDATA #IMPLIED">
+  ]]>]]><![CDATA[
+<![%vad.package_sticker;[
+  <!ENTITY % vad.file.source_uri "">
+  ]]>]]><![CDATA[
+<!ELEMENT file EMPTY>
+<!ATTLIST file
+  type (doc | http | dav | code | special) #REQUIRED
+  source (http) "http"
+  target_uri CDATA #REQUIRED
+  makepath (yes | no | abort) "abort"
+  overwrite (yes | no | abort | equal | expected) "equal"
+  package_id CDATA #IMPLIED
+  location IDREF #IMPLIED
+  dav_owner CDATA #IMPLIED
+  dav_grp CDATA #IMPLIED
+  dav_perm CDATA #IMPLIED
+  %vad.file.source_uri;
+  >
+<!ELEMENT location ((prop)*) >
+<!ATTLIST location
+  id ID #REQUIRED
+  default_target_uri CDATA #REQUIRED
+  >
+    <!--<</resources>>-->
+]]></programlisting>
+
+<para>Element resources lists all files to be copied onto target box. For every
+file, source and target URIs should be specified, and suggested behavior for
+cases when a directory should be created or file should be overwritten. Target
+URI may be relative to one of roots: for documentation, web-resources, DAV,
+SQL code (it's where virtuoso.ini is located) and one of special locations,
+additionally specified by location elements. (Installer may query administrator
+to allow changing of locations' roots; in such case, information from
+location's properties will be shown to the administrator.) By default, the
+value of <parameter>package_id</parameter> is a space delimited list of
+type, location ID (if any) and target URI.</para>
+
+<simplelist>
+  <member>dav_owner - DAV owner for file (used if type="dav", ignored if "filesystem");</member>
+  <member>dav_grp - DAV group for file (used if type="dav", ignored if "filesystem");</member>
+  <member>dav_perm - DAV permissions for file (used if type="dav", ignored if "filesystem").</member>
+</simplelist>
+
+<example id="ex_vadstickfile"><title>VAD installable file descriptions</title>
+
+<para>To install files into DAV:</para>
+
+<programlisting><![CDATA[
+<file type="dav" source="http" target_uri="yacutia/yacutia_style.css" dav_owner='dav' dav_grp='administrators' dav_perm='111101101N' makepath="yes"/>
+<file type="dav" source="http" target_uri="yacutia/yacutia_vdir_style.css"  dav_owner='dav' dav_grp='administrators' dav_perm='111101101N' makepath="yes"/>
+]]></programlisting>
+
+<para>To install files into file system:</para>
+
+<programlisting><![CDATA[
+<file type="http" source="http" target_uri="yacutia/yacutia_style.css" makepath="yes"/>
+<file type="http" source="http" target_uri="yacutia/yacutia_vdir_style.css" makepath="yes"/>
+]]></programlisting>
+</example>
+
+<para>Sticker's elements for registry</para>
+
+<programlisting><![CDATA[
+<!--<<registry>>-->
+      <!ELEMENT registry ((record)*)>
+      <!ATTLIST registry >
+      <!ELEMENT record ANY>
+      <!ATTLIST record
+        key CDATA #REQUIRED
+        type (STRING | INTEGER | KEY | URL | XML) #REQUIRED
+        overwrite (yes | no | abort | equal | expected) "equal"
+        >
+    <!--<</registry>>-->
+]]></programlisting>
+
+<para>Element registry lists all branches to be defined in the VAD Registry. Every
+record element contain data of one record. The first children of record element
+(either a text or an element) will be serialized and stored as a value of
+<parameter>DB.DBA.VAD_REGISTRY.R_VALUE</parameter> cell. To prevent errors,
+it is recommended to keep comments to the data outside the record element:
+being in the wrong place inside, they may be stored in the registry instead
+of actually needed data.</para>
+
+<example id="ex_vadstickers"><title>Sample Stickers</title>
+
+<para>A package that contains only some commonly useful ("exported") functions,
+one table for internal purposes, a small sample VSP application, and small
+set of documentation files.</para>
+
+<programlisting><![CDATA[
+<?xml version="1.0" encoding="ASCII" ?>
+<!DOCTYPE sticker SYSTEM "vad_sticker.dtd">
+<sticker version="1.0.010505A" xml:lang="en-UK">
+ <!-- Name and version; common data about the package -->
+ <caption>
+  <name package="rdf_lib">
+   <prop name="Title" value="RDF Support Library" />
+   <prop name="Developer" value="OpenLink Software" />
+   <prop name="Copyright" value="(C) 2003 OpenLink Software" />
+   <prop name="Download" value="http://www.openlinksw.com/virtuoso/rdf_lib/download" />
+   <prop name="Download" value="http://www.openlinksw.co.uk/virtuoso/rdf_lib/download" />
+  </name>
+  <version package="3.14">
+   <prop name="Release+Date" value="2003-05-05" />
+   <prop name="Build" value="Release, optimized" />
+  </version>
+ </caption>
+ <!-- This package requires no other packages,
+but it conflicts with package virtodp of versions
+from 1.00 to 2.17, inclusive -->
+ <dependencies>
+  <allow>
+   <name package="virtodp"></name>
+   <versions_earlier package="1.00"></versions_earlier>
+  </allow>
+  <conflict>
+   <name package="virtodp">
+    <prop name="Title" value="Virtuoso ODP Sample" />
+   </name>
+   <versions_earlier package="2.17">
+    <prop name="Date" value="2001-01-26" />
+    <prop name="Comment"
+	  value="An incompatible version of RDF library is included in some old versions of virtodp " />
+   </versions_earlier>
+  </conflict>
+ </dependencies>
+ <!-- There are no installation procedures, other than DDLs -->
+ <procedures uninstallation="supported"></procedures>
+ <!-- There are some procedures, which may be re-applying and (maybe) reverted automatically -->
+ <ddls>
+  <sql purpose="pre-install">
+   "DB"."DBA"."VAD_CREATE_TABLE" ('DB', 'DBA', 'RDF_SCHEDULED_IMPORTS',
+      'ID integer,
+	   URI varchar,
+	   CALLBACK varchar,
+	   VERSION varchar,
+	   REPORT long varchar,
+	   primary key (ID)');
+  </sql>
+  <sql purpose="post-install">
+   "DB"."DBA"."VAD_LOAD_RESOURCE" ('rdf_functions');
+  </sql>
+ </ddls>
+ <!-- Resources include... -->
+ <resources>
+  <!-- ...documentation, ... -->
+  <file type="doc" target_uri="rdf_lib/1.1/intro.dxt" />
+  <file type="doc" target_uri="rdf_lib/1.1/interface.dxt" />
+  <file type="doc" target_uri="rdf_lib/1.1/implementation.dxt" />
+  <file type="doc" target_uri="rdf_lib/1.1/sample_app.dxt" />
+  <!-- ...the file of commonly-useful functions, ... -->
+  <file package_id="rdf_functions"
+    type="code" target_uri="rdf_lib/1.1/rdf_lib.sql" />
+  <!-- ...pages of the sample application, named rdf_edit, ... -->
+  <file type="http" target_uri="rdf_lib/rdf_edit/default.htm" />
+  <file type="http" target_uri="rdf_lib/rdf_edit/browse.vsp" />
+  <file type="http" target_uri="rdf_lib/rdf_edit/edit.vsp" />
+  <!-- ...a DAV resource with sample RDF data, ... -->
+  <file type="dav" target_uri="rdf_lib/sample_odp_structure.rdf" />
+  <!-- ...two files of sample application's functions. -->
+  <file type="code" target_uri="rdf_lib/1.1/rdf_edit/content_level.sql" />
+  <file type="code" target_uri="rdf_lib/1.1/rdf_edit/view_level.sql" />
+ </resources>
+ <!-- There are no application-specific registry items in this package -->
+</sticker>
+]]></programlisting>
+</example>
+</sect4>
+</sect3>
+</sect2>
diff --git a/docsrc/xmlsource/vfoafssl.xml b/docsrc/xmlsource/vfoafssl.xml
index 729ee2a..4c41738 100644
--- a/docsrc/xmlsource/vfoafssl.xml
+++ b/docsrc/xmlsource/vfoafssl.xml
@@ -22,21 +22,21 @@
  -
 -->
 
-<sect1 id="vfoafssl"><title>FOAF+SSL Support</title>
-  <para>FOAF+SSL is an authentication and authorization protocol that links a "Web ID" or
+<sect1 id="vfoafssl"><title>WebID Protocol Support</title>
+  <para>WebID Protocol is an authentication and authorization protocol that links a "Web ID" or
 "<ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/GetAPersonalURIIn5MinutesOrLess">Personal URI</ulink>"
 to a public key to create a global, decentralized, distributed, and secure authentication system that
 functions with existing browsers.</para>
-  <para>FOAF+SSL uses PKI standards - usually thought of as hierarchical trust management tools -
+  <para>WebID Protocol uses PKI standards - usually thought of as hierarchical trust management tools -
 <ulink url="http://blogs.sun.com/bblfish/entry/foaf_ssl_pki_and_the">in a decentralized web-of-trust way</ulink>.
 The web of trust is built using semantic web vocabularies (particularly <ulink url="http://www.foaf-project.org/">FOAF</ulink>) published in RESTful manner to
 form Linked Data.</para>
-  <para>Based on well known existing standards, FOAF+SSL is currently in development, and is being discussed
+  <para>Based on well known existing standards, WebID Protocol is currently in development, and is being discussed
 on the <ulink url="http://lists.foaf-project.org/mailman/listinfo/foaf-protocols">FOAF protocols mailing list</ulink>.</para>
   <para>For the most recent description of the protocol, read the one-page
-"<ulink url="http://blogs.sun.com/bblfish/entry/foaf_ssl_adding_security_to">FOAF+SSL: Adding Security to
+"<ulink url="http://blogs.sun.com/bblfish/entry/foaf_ssl_adding_security_to">WebID Protocol: Adding Security to
 Open Distributed Social Networks</ulink>". For a more detailed explanation of how the authentication works,
-see "<ulink url="http://blogs.sun.com/bblfish/entry/more_on_authorization_in_foaf">FOAF+SSL: Creating a Web of Trust without Key Signing Parties</ulink>".</para>
+see "<ulink url="http://blogs.sun.com/bblfish/entry/more_on_authorization_in_foaf">WebID Protocol: Creating a Web of Trust without Key Signing Parties</ulink>".</para>
   <para>Automatic discovery of interpersonal trust relationships enables automatic application of appropriate
 permissions.</para>
   <para>In other words, data owners can set fuzzy permissions like "only let my friends see this" or "only
@@ -52,7 +52,7 @@ and the visitor), and if they matched up (in other words, the visitor could not
 a family relationship; the relationship must be confirmed by the owner's FOAF data), the pictures would
 be shown.</para>
   <sect2 id="vfoafsslx509"><title>x.509 certificate</title>
-  <para>The FOAF+SSL consumer needs an x509 certificate with v3 extension "Subject Alternate Name". This
+  <para>The WebID Protocol consumer needs an x509 certificate with v3 extension "Subject Alternate Name". This
 attribute is used for the owner's Web ID. For testing purposes we used OpenSSL demo CA to generate such
 certificates. If you are not using the OpenSSL demo CA, you must first setup a self-signed CA; read
 OpenSSL documents on how to do this.</para>
@@ -148,7 +148,7 @@ configured, i.e., https://virtuoso.example.com:4443/</listitem>
    <listitem>Click to the "Your Certificates" tab, and import mycert.p12.</listitem>
 </orderedlist>
   </sect2>
-  <sect2 id="vfoafsslconf"><title>Configuring ODS Account to use FOAF+SSL</title>
+  <sect2 id="vfoafsslconf"><title>Configuring ODS Account to use WebID Protocol</title>
 <orderedlist>
   <listitem>Log in to your ODS account, and edit your profile. </listitem>
   <listitem>Click to the Security Tab, and scroll to the bottom, where you will
@@ -187,8 +187,8 @@ public data!
 </listitem>
 </orderedlist>
   </sect2>
-  <sect2 id="vfoafsslacl"><title>FOAF+SSL ACLs</title>
-  <para>You can <link linkend="sparqloauthendpointfoafssl">set FOAF+SSL ACLs</link> from the Virtuoso Authentication Server UI. </para>
+  <sect2 id="vfoafsslacl"><title>WebID Protocol ACLs</title>
+    <para>You can <link linkend="sparqloauthendpointfoafssl">set WebID Protocol ACLs</link> from the Virtuoso Authentication Server UI. </para>
   </sect2>
   <sect2 id="sparqloauthendpointfoafsslsparql"><title>SPARQL-SSL based Endpoint</title>
     <para>See details how to <link linkend="sparqloauthendpointfoafssl">create and use a SPARQL-SSL based Endpoint</link>.</para>
@@ -344,7 +344,7 @@ ask for a certificate; select the one generated in the steps above.
        <graphic fileref="ui/foafssl25.png"/>
      </figure>
 </listitem>
-   <listitem>You should now be logged in to ODS via FOAF+SSL.
+   <listitem>You should now be logged in to ODS via WebID Protocol.
      <figure id="foafssl26" float="1">
        <title>Setting-Up issuer CA</title>
        <graphic fileref="ui/foafssl26.png"/>
@@ -352,7 +352,7 @@ ask for a certificate; select the one generated in the steps above.
 </listitem>
 </orderedlist>
   </sect2>
-  <sect2 id="vfoafsslsethttpsfoafsll"><title>FOAF+SSL ODBC Login</title>
+  <sect2 id="vfoafsslsethttpsfoafsll"><title>WebID Protocol ODBC Login</title>
     <para>See details and examples <link linkend="secureodbcx509foafsll">here</link>.</para>
   </sect2>
 </sect1>
diff --git a/docsrc/xmlsource/virtclientref.xml b/docsrc/xmlsource/virtclientref.xml
index 46f20a5..4f748b5 100644
--- a/docsrc/xmlsource/virtclientref.xml
+++ b/docsrc/xmlsource/virtclientref.xml
@@ -617,6 +617,149 @@ an VirtuosoConnection object.</para>
 	  </section>
 
 	  <section>
+	    <title>ConnectionString Property</title>
+
+	    <para>The Virtuoso ADO.NET Provider ConnectionString property implements the 
+	    IDbConnection.ConnectionString property to get or set the string used to open a Virtuoso 
+	    database connection, and includes the source database name and other parameters needed to 
+	    establish the initial connection. The default value is an empty string.</para>
+
+	    <fieldsynopsis>
+	      <modifier>public</modifier>
+	      <type>string</type>
+	      <varname>ConnectionString</varname>
+	    </fieldsynopsis>
+
+	    <section>
+	      <title>Property Value</title>
+	      <para>Includes the source database name and other parameters needed to establish the 
+	      initial connection. The default value is an empty string.</para>
+	      <para>ConnectionString has the following syntax: Each connection string is a sequence of settings 
+	      Individual settings are separated by semicolons. Each setting is a pair of name and value delimited 
+	      by the equal sign. Whitespace is ignored on either side of both names and values. Names are case 
+	      insensitive. The value part can be quoted by either single or double quote characters or remain 
+	      unquoted at all. However if it includes a semicolon, single quote, or double quote characters, 
+	      it must be enclosed in either type of quotes. To embed the same character that is used for 
+	      enclosing the value the character within the value must be doubled.</para>
+	      
+	      <para>The following table lists the valid names for values within the ConnectionString:</para>
+
+	      <table>
+		      <tgroup cols="3">
+		        <thead>
+		          <row>
+		            <entry>Name</entry>
+		            <entry>Default</entry>
+		            <entry>Description</entry>		            
+		          </row>
+		        </thead>
+		        <tbody>
+		          <row>
+		            <entry>Connect Timeout or<br/>Connection Timeout</entry>
+		            <entry>15</entry>
+		            <entry>The number of seconds to wait for a connection to the server before terminating the attempt and generating an error.</entry>		            
+		          </row>
+		          <row>
+		            <entry>Connection Lifetime</entry>
+		            <entry>0</entry>
+		            <entry>When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by connection lifetime. Useful in clustered configurations to force load balancing between a running server and a server just brought on-line.</entry>		            
+		          </row>
+		          <row>
+		            <entry>Charset</entry>
+		            <entry>utf-16</entry>
+		            <entry>Specifies the character set to be used by the provider when passing string values to and from the database. Must be set to utf-8 to handle Unicode strings passed in SPARQL/SPASQL queries of RDF data.</entry>		            
+		          </row>
+		          <row>
+		            <entry>Data Source or<br/>Server or<br/>Address or<br/>Network Address or<br/>Host</entry>
+		            <entry></entry>
+		            <entry>The name or network address of the instance of Virtuoso server to which to connect. Can take comma delimited list of instances for connection fail over.</entry>		            
+		          </row>
+		          <row>
+		            <entry>Encrypt</entry>
+		            <entry>false</entry>
+		            <entry>Specifies if the connection must be SSL encrypted. Currently encryption only works with an ODBC-based provider.</entry>		            
+		          </row>
+		          <row>
+		            <entry>Enlist</entry>
+		            <entry>true</entry>
+		            <entry>When true, the pooler automatically enlists the connection in the creation thread's current transaction context.</entry>		            
+		          </row>
+		          <row>
+		            <entry>Initial Catalog or<br/>Database</entry>
+		            <entry></entry>
+		            <entry>The name of the database.</entry>		            
+		          </row>
+		          <row>
+		            <entry>Max Pool Size</entry>
+		            <entry>100</entry>
+		            <entry>The maximum number of connections allowed in the pool.</entry>		            
+		          </row>
+		          <row>
+		            <entry>Min Pool Size</entry>
+		            <entry>0</entry>
+		            <entry>The minimum number of connections allowed in the pool.</entry>		            
+		          </row>
+		          <row>
+		            <entry>Password or<br/>Pwd</entry>
+		            <entry></entry>
+		            <entry>The password for the Virtuoso account logging on. </entry>		            
+		          </row>
+		          <row>
+		            <entry>Persist Security Info</entry>
+		            <entry>false</entry>
+		            <entry>When set to 'false', security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open State. Resetting the connection string resets all connection string values including the password.</entry>		            
+		          </row>
+		          <row>
+		            <entry>Pooling</entry>
+		            <entry>true</entry>
+		            <entry>	When true, the VirtuosoConnection object is drawn from the appropriate pool, or if necessary, is created and added to the appropriate pool.</entry>		            
+		          </row>
+		          <row>
+		            <entry>RoundRobin</entry>
+		            <entry>false</entry>
+		            <entry>Enables load balancing in which case the server for the connection is chosen at random from the comma delimited provided as for a Failover connection.</entry>		            
+		          </row>
+		          <row>
+		            <entry>User ID or<br/>Uid</entry>
+		            <entry></entry>
+		            <entry>The Virtuoso login name.</entry>		            
+		          </row>		          
+		        </tbody>
+		      </tgroup>
+	      </table>
+	    </section>
+
+	    <section>
+	      <title>Implements</title>
+	      <para>IDbCommand.ConnectionString</para>
+	    </section>
+ 
+      <section>
+	      <title>Remarks</title>
+	       <para>The <emphasis>ConnectionString</emphasis> is similar to an OLE DB connection string, but 
+	       is not identical. Unlike OLE DB or ADO, the connection string that is returned is the same as the 
+	       user set <emphasis>ConnectionString</emphasis> minus security information if the 
+	       <emphasis>Persist Security Info</emphasis> value is set to <emphasis>false</emphasis> (default). 
+	       The Virtuoso ADO.NET Data Provider neither persists nor returns the password in a connection 
+	       string unless you set <emphasis>Persist Security Info</emphasis> to true.</para>
+	       <para>The <emphasis>ConnectionString</emphasis> property can be set only when the connection is 
+	       closed. Many of the connection string values have corresponding read-only properties. When the 
+	       connection string is set, all of these properties are updated, except when an error is detected; 
+	       in this case, none of the properties are updated. <emphasis>VirtuosoConnection</emphasis> 
+	       properties return only those settings contained in the <emphasis>ConnectionString</emphasis>.</para>
+	       <para>Resetting the <emphasis>ConnectionString</emphasis> on a closed connection resets all 
+	       connection string values (and related properties) including the password. For example, if you set a 
+	       connection string that includes "<emphasis>Database=Demo</emphasis>", and then reset the connection 
+	       string to "<emphasis>Data Source=myserver;User ID=dba;Password=dba</emphasis>", the Database 
+	       property is no longer set to <emphasis>Demo</emphasis>.</para>	      
+	       <para>The connection string is parsed immediately after being set. If errors in syntax are found 
+	       when parsing, a runtime exception (e.g., <emphasis>ArgumentException</emphasis>) is generated. 
+	       Other errors can be found only when an attempt is made to open the connection.</para>	       
+	    </section>
+	    
+	  </section>
+	  
+	  <section>
 	    <title>VirtuosoCommand Constructor (string, VirtuosoConnection, VirtuosoTransaction)</title>
 
 	    <para>Initializes a new instance of the VirtuosoCommand class with the text of the query,
diff --git a/docsrc/xmlsource/virtdocs.xml b/docsrc/xmlsource/virtdocs.xml
index 2e1e5a2..9c67d1a 100644
--- a/docsrc/xmlsource/virtdocs.xml
+++ b/docsrc/xmlsource/virtdocs.xml
@@ -309,8 +309,19 @@
 <!ENTITY rdf_graph_group_ins                    SYSTEM  "funcref/rdf_graph_group_ins.xml">
 <!ENTITY rdfs_rule_set                          SYSTEM  "funcref/rdfs_rule_set.xml">
 
+<!ENTITY rdf_load_rdfa                          SYSTEM  "funcref/rdf_load_rdfa.xml">
 <!ENTITY rdf_load_rdfxml        		SYSTEM "funcref/rdf_load_rdfxml.xml">
 <!ENTITY rdf_load_rdfxml_mt     		SYSTEM "funcref/rdf_load_rdfxml_mt.xml">
+
+<!ENTITY rdf_graph_collect_fp_list              SYSTEM  "funcref/rdf_graph_collect_fp_list.xml">
+<!ENTITY rdf_graph_diff                         SYSTEM  "funcref/rdf_graph_diff.xml">
+<!ENTITY rdf_suo_apply_patch                    SYSTEM  "funcref/rdf_suo_apply_patch.xml">
+<!ENTITY rdf_suo_diff_ttl                       SYSTEM  "funcref/rdf_suo_diff_ttl.xml">
+<!ENTITY sparql_rdb2rdf_codegen                 SYSTEM  "funcref/sparql_rdb2rdf_codegen.xml">
+<!ENTITY sparql_rdb2rdf_list_tables             SYSTEM  "funcref/sparql_rdb2rdf_list_tables.xml">
+<!ENTITY sparql_select_known_graphs             SYSTEM  "funcref/sparql_select_known_graphs.xml">
+
+<!ENTITY ld_dir                                 SYSTEM  "funcref/ld_dir.xml">
 <!ENTITY ttlp                   		SYSTEM "funcref/ttlp.xml">
 <!ENTITY ttlp_mt                		SYSTEM "funcref/ttlp_mt.xml">
 <!ENTITY ttlp_mt_local_file                     SYSTEM  "funcref/ttlp_mt_local_file.xml">
@@ -385,6 +396,12 @@
 <!ENTITY REPL_ADD_CR  	 			SYSTEM "funcref/REPL_ADD_CR.xml">
 <!ENTITY REPL_ADD_DAV_CR  	 		SYSTEM "funcref/REPL_ADD_DAV_CR.xml">
 <!ENTITY REPL_ADD_SNAPSHOT_CR  	 		SYSTEM "funcref/REPL_ADD_SNAPSHOT_CR.xml">
+
+<!ENTITY rdf_repl_start  	     SYSTEM	"funcref/rdf_repl_start.xml">
+<!ENTITY rdf_repl_graph_ins  	 SYSTEM	"funcref/rdf_repl_graph_ins.xml">
+<!ENTITY rdf_repl_graph_del  	 SYSTEM	"funcref/rdf_repl_graph_del.xml">
+
+
 <!ENTITY replace				SYSTEM "funcref/replace.xml">
 <!ENTITY replay					SYSTEM "funcref/replay.xml">
 <!ENTITY result					SYSTEM "funcref/result.xml">
@@ -423,6 +440,8 @@
 <!ENTITY sinv_drop_inverse			SYSTEM "funcref/sinv_drop_inverse.xml">
 <!ENTITY smime_sign				SYSTEM "funcref/smime_sign.xml">
 <!ENTITY smime_verify				SYSTEM "funcref/smime_verify.xml">
+<!ENTITY smime_encrypt				SYSTEM	"funcref/smime_encrypt.xml">
+<!ENTITY smime_decrypt				SYSTEM	"funcref/smime_decrypt.xml">
 <!ENTITY smtp_send				SYSTEM "funcref/smtp_send.xml">
 <!ENTITY soap_call				SYSTEM "funcref/soap_call.xml">
 <!ENTITY soap_client				SYSTEM "funcref/soap_client.xml">
@@ -850,6 +869,8 @@ ls xpf_*.xml | sed 's/.xml//g' | sed 's/^\(.*\)$/\<!ENTITY \1 		SYSTEM "xmlref\/
 <!ENTITY xenc_SPKI_read			SYSTEM	"funcref/xenc_SPKI_read.xml">
 <!ENTITY xenc_bn2dec			SYSTEM	"funcref/xenc_bn2dec.xml">
 
+  <!ENTITY vacuum SYSTEM	"funcref/vacuum.xml">
+
 <!-- include the document chapters/sections -->
 <!ENTITY xmltableview 				SYSTEM "xmltableview.xml">
 <!ENTITY overview 				SYSTEM "overview.xml">
@@ -865,7 +886,7 @@ ls xpf_*.xml | sed 's/.xml//g' | sed 's/^\(.*\)$/\<!ENTITY \1 		SYSTEM "xmlref\/
 <!ENTITY isql 					SYSTEM "isql.xml">
 <!ENTITY perfdiag               		SYSTEM "perfdiag.xml">
 <!ENTITY ptune 					SYSTEM "ptune.xml">
-<!ENTITY fault 	                SYSTEM "fault.xml">
+<!ENTITY fault 	                		SYSTEM "fault.xml">
 <!ENTITY sqlreference 				SYSTEM "sqlreference.xml">
 <!ENTITY functions 				SYSTEM "functions.xml">
 <!ENTITY sqlprocedures 				SYSTEM "sqlprocedures.xml">
@@ -873,7 +894,7 @@ ls xpf_*.xml | sed 's/.xml//g' | sed 's/^\(.*\)$/\<!ENTITY \1 		SYSTEM "xmlref\/
 <!ENTITY odbcimplementation 			SYSTEM "odbcimplementation.xml">
 <!ENTITY oledbimplementation 			SYSTEM "oledbimplementation.xml">
 <!ENTITY repl 					SYSTEM "repl.xml">
-<!ENTITY vad 					SYSTEM "vad.xml">
+<!ENTITY vaddistr 				SYSTEM "vaddistr.xml">
 <!ENTITY dbpump 				SYSTEM "dbpump.xml">
 <!ENTITY webserver 				SYSTEM "webserver.xml">
 <!ENTITY uddi	 				SYSTEM "uddi.xml">
@@ -889,6 +910,7 @@ ls xpf_*.xml | sed 's/.xml//g' | sed 's/^\(.*\)$/\<!ENTITY \1 		SYSTEM "xmlref\/
 <!ENTITY adminui 				SYSTEM "adminui.xml">
 <!ENTITY adminui.dbadmin  			SYSTEM "adminui.dbadmin.xml">
 <!ENTITY adminui.mailsrvadm  			SYSTEM "adminui.mailsrvadm.xml">
+  <!ENTITY adminui.newssrvadm  SYSTEM "adminui.rdfadm.xml">
 <!ENTITY adminui.newssrvadm  			SYSTEM "adminui.newssrvadm.xml">
 <!ENTITY adminui.querytools  			SYSTEM "adminui.querytools.xml">
 <!ENTITY adminui.replicationandsynchronization  SYSTEM "adminui.replicationandsynchronization.xml">
@@ -943,7 +965,7 @@ ls xpf_*.xml | sed 's/.xml//g' | sed 's/^\(.*\)$/\<!ENTITY \1 		SYSTEM "xmlref\/
 <!ENTITY xmla    				SYSTEM "xmla.xml">
 <!ENTITY jsphosting  		  		SYSTEM "jsphosting.xml">
 <!ENTITY rth.aspx    				SYSTEM "rth.aspx.xml">
-<!ENTITY migrate27to30    			SYSTEM "migrate27to30.xml">
+  <!--ENTITY migrate27to30    SYSTEM "migrate27to30.xml"-->
 <!ENTITY rendezvous    				SYSTEM "rendezvous.xml">
 <!ENTITY secureodbc    				SYSTEM "secureodbc.xml">
 <!ENTITY virtclientref    			SYSTEM "virtclientref.xml">
@@ -967,7 +989,7 @@ ls xpf_*.xml | sed 's/.xml//g' | sed 's/^\(.*\)$/\<!ENTITY \1 		SYSTEM "xmlref\/
 <!ENTITY xsql       				SYSTEM "xsql.xml">
 <!ENTITY blogger       				SYSTEM "blogger.xml">
 <!ENTITY rdfandsparql       			SYSTEM "rdfandsparql.xml">
-<!ENTITY vacuum 				SYSTEM "funcref/vacuum.xml">
+  <!ENTITY rdfviewssamples       SYSTEM "rdfviewssamples.xml">
 ]>
 <book id="virtdocs">
 	<title>OpenLink Virtuoso Universal Server: Documentation</title>
diff --git a/docsrc/xmlsource/webserver.xml b/docsrc/xmlsource/webserver.xml
index 32a3a06..4e26d55 100644
--- a/docsrc/xmlsource/webserver.xml
+++ b/docsrc/xmlsource/webserver.xml
@@ -292,6 +292,21 @@ we will discuss in the Virtual hosting and Multihosting section of this document
 -->
 
 </sect3>
+<sect3 id="virtmetahost"><title>Managing Host Metadata</title>
+<para>To add metadata in /.well-known/host-meta, execute:</para>
+<programlisting><![CDATA[
+WS.WS.host_meta_add ([app-name], [xrd-xml-fragment])	
+]]></programlisting>
+<para>For example:</para>
+<programlisting><![CDATA[
+WS.WS.host_meta_add 
+  ( 
+    'dbpedia.page-descriptor', 
+    '<Link rel="http://dbpedia.org/resource-descriptor" template="http://dbpedia.org/page/{uri}"/>'
+  )
+  ;	
+]]></programlisting>
+</sect3>
 
 <sect3 id="virtproxy"><title>Virtuoso As A Proxy</title>
 
@@ -1193,7 +1208,7 @@ No-Operation.</para>
     <para>
 	In some situations  Virtuoso services like WebDAV, JSP, PHP etc.
         may need to be accessed via an Apache Web Server. All this can be done
-        through  apache’s mod_proxy to Virtuoso HTTP server and the Virtuoso HTTP
+        through  apache's mod_proxy to Virtuoso HTTP server and the Virtuoso HTTP
         server can be configured to take requests coming only from localhost.
     </para>
     <para>
@@ -1221,7 +1236,173 @@ No-Operation.</para>
 	...
 	]]></programlisting>
 </sect2>
+<sect2 id="webserverhttpslistenerset"><title>Setting Up the Virtuoso HTTPS Listener</title>
+<para>The Setting up of the Virtuoso HTTPS Listener can be done by using the file system or using the Virtuoso conductor.</para>
+<para>Note that when you want to change from Virtuoso hosted Cert and Public Key to File System and vice versa, first should
+be stopped the listener for either setup.</para>
+<sect3 id="webserverhttpslistenersetfs"><title>Setting Up the Virtuoso HTTPS Listener to host Certificate and Public Key using File System</title>
+<orderedlist>
+  <listitem>X.509 certificate Generation
+<para>The WebID Protocol consumer needs an x509 certificate with v3 extension "Subject Alternate Name". 
+This attribute is used for the owner's Web ID. For testing purposes we used OpenSSL demo CA 
+to generate such certificates. If you are not using the OpenSSL demo CA, you must first setup  
+a self-signed CA; read OpenSSL documents on how to do this.</para> 
+<orderedlist>
+  <listitem>Add the following line to the <code>[usr_cert]</code> section of the <code>openssl.cnf</code> 
+file:
+<programlisting><![CDATA[
+subjectAltName=$ENV::ALTNAME	
+]]></programlisting>
+</listitem>
+  <listitem>Set the environment variable <code>ALTNAME</code> to the owner's Web ID, e.g., 
+<programlisting><![CDATA[
+export ALTNAME=URI:http://localhost/dataspace/person/myname#this	
+]]></programlisting>
+</listitem>
+  <listitem>Make a self-signed certificate, e.g., 
+<programlisting><![CDATA[
+$ CA.pl -newreq (follow the dialog) 
+$ CA.pl -sign	
+]]></programlisting>
+</listitem>
+  <listitem>When asked to commit the certificate, make sure you see several lines above, like
+<programlisting><![CDATA[
+X509v3 Subject Alternative Name: 
+    URI:http://localhost/dataspace/person/myname#this 	
+]]></programlisting>
+</listitem>
+  <listitem>If your browser wants a <code>PKCS#12</code> bundle, you must make one
+<programlisting><![CDATA[
+$ openssl pkcs12 -export -in newcert.pem -inkey newkey.pem -out mycert.p12 	
+]]></programlisting>
+</listitem>
+  <listitem>Rename <code>newcert.pem</code> and <code>newkey.pem</code>, to <code>mycert.pem</code> 
+and <code>mykey.pem</code> for example.  
+</listitem>
+</orderedlist>  	
+</listitem>
+  <listitem>Move <code>newcert.pem</code>, <code>newkey.pem</code>, and <code>cacert.pem</code> 
+into the server's working directory.  In our test case, we put the keys in a '<code>keys</code>' 
+sub-directory, and added the following lines to the <code>[HTTPServer]</code> section of the Virtuoso 
+INI file, <code>virtuoso.ini</code>:
+<programlisting><![CDATA[
+SSLPort                     = 4443
+SSLCertificate              = ./keys/localhost.cert.pem
+SSLPrivateKey               = ./keys/localhost.key.pem
+X509ClientVerifyCAFile      = ./keys/localhost.ca.pem
+X509ClientVerify            = 1
+X509ClientVerifyDepth       = 15	
+]]></programlisting>
+</listitem>
+  <listitem>Also in the Virtuoso INI file, in the <code>[URIQA]</code> section, <code>DefaultHost</code>
+(<code>localhost:8890</code> below) must be edited to correspond to the DNS-resolvable host name 
+("CNAME") of the Virtuoso host, combined with the <code>ServerPort</code> as set in the 
+<code>[HTTPServer]</code> section of the same INI file. 
+<programlisting><![CDATA[
+[URIQA]
+DynamicLocal = 1
+DefaultHost  = localhost:8890	
+]]></programlisting>
+<para>For example, if the CNAME of the host is <code>virtuoso.example.com</code>, and the 
+<code>ServerPort</code> is <code>4321</code>, the <code>DefaultHost</code> should be set to 
+<code>virtuoso.example.com:4321</code></para>
+<programlisting><![CDATA[
+[URIQA]
+DynamicLocal = 1
+DefaultHost  = virtuoso.example.com:4321	
+]]></programlisting>
+</listitem>
+  <listitem>Start the Virtuoso server, and look at the log file.  Once HTTPS is up, you should see 
+something like:
+<programlisting><![CDATA[
+HTTPS Using X509 Client CA ....
+HTTPS/X509 server online at 4443	
+]]></programlisting>
+</listitem>
+  <listitem>Setting Up Firefox:
+<orderedlist>
+  <listitem>In the Preferences dialog, open the Advanced tab, and click the "View certificates" button. 
+    <figure id="sphttps1" float="1">
+      <title>HTTPS Listener</title>
+      <graphic fileref="ui/htps1.png"/>
+    </figure>  	
+</listitem>
+  <listitem>Click the "Add exception" button ,and enter the address of the HTTPS server you've just
+configured, i.e. https://virtuoso.example.com:4443/</listitem>
+  <listitem>Click OK, and confirm the exception.
+    <figure id="sphttps2" float="1">
+      <title>HTTPS Listener</title>
+      <graphic fileref="ui/htps2.png"/>
+    </figure>   	
+</listitem>
+  <listitem>Click to the "Your Certificates" tab, and import <code>mycert.p12</code>. </listitem>  
+</orderedlist>  	
+</listitem>
+</orderedlist>
+</sect3>
+<sect3 id="webserverhttpslistenersetvt"><title>Setting Up the Virtuoso HTTPS Listener to host Certificate and Public Key using Virtuoso Conductor</title>
+<orderedlist>
+  <listitem>Go to the <code>http://cname:port/conductor</code> URL, enter the DBA user credentials.
+  	<figure id="sphttps3" float="1">
+      <title>HTTPS Listener</title>
+      <graphic fileref="ui/htps3.png"/>
+    </figure>  
+</listitem>
+<listitem>Go to System Admin->Security
+  	<figure id="sphttps4" float="1">
+      <title>HTTPS Listener</title>
+      <graphic fileref="ui/htps4.png"/>
+    </figure>  
+</listitem>
+<listitem>Enter the Issuer details:
+  	<figure id="sphttps5" float="1">
+      <title>HTTPS Listener</title>
+      <graphic fileref="ui/htps5.png"/>
+    </figure>  
+</listitem>
+<listitem>Click Generate
+  	<figure id="sphttps6" float="1">
+      <title>HTTPS Listener</title>
+      <graphic fileref="ui/htps6.png"/>
+    </figure>  
+</listitem>
+<listitem>Click Configure HTTPS Listeners
+  	<figure id="sphttps7" float="1">
+      <title>HTTPS Listener</title>
+      <graphic fileref="ui/htps7.png"/>
+    </figure>  
+</listitem>
+<listitem>Edit the new listener, and click "Generate New" key.
+  	<figure id="sphttps8" float="1">
+      <title>HTTPS Listener</title>
+      <graphic fileref="ui/htps8.png"/>
+    </figure>  
+</listitem>
+<listitem>Click Save
+  	<figure id="sphttps9" float="1">
+      <title>HTTPS Listener</title>
+      <graphic fileref="ui/htps9.png"/>
+    </figure>  
+</listitem>
+<listitem>Setting Up Firefox:
+	<orderedlist>
+		<listitem>In the Preferences dialog, open the Advanced tab, and click the "View certificates" button.</listitem> 
+		<listitem>Click the "Add exception" button and enter the address of the HTTPS server you've just
+configured, i.e. https://virtuoso.example.com:4433/
+</listitem>
+<listitem>Click OK, and confirm the exception.
+  	<figure id="sphttps10" float="1">
+      <title>HTTPS Listener</title>
+      <graphic fileref="ui/htps10.png"/>
+    </figure>  
+</listitem>
+  </orderedlist>
+</listitem>
+</orderedlist>
 
+</sect3>
+
+</sect2>
 </sect1>
 
 
diff --git a/docsrc/xmlsource/wsdl.xml b/docsrc/xmlsource/wsdl.xml
index af235d0..31b9147 100644
--- a/docsrc/xmlsource/wsdl.xml
+++ b/docsrc/xmlsource/wsdl.xml
@@ -493,7 +493,6 @@ Interop.INTEROP.echoVoid
  published by OpenLink containing the descriptions of these tests can be found
  at <ulink url="http://demo.openlinksw.com:8890/Interop/">http://demo.openlinksw.com:8890/Interop/</ulink>.
  This URL will be updated as new interoperability tests are devised.</para>
- <para>As of the general release of Virtuoso 2.7, the SOAP implementation
- passes all known interoperability tests.</para>
+ <para>The SOAP implementation passes all known interoperability tests.</para>
  </sect2>
 </sect1>
diff --git a/libsrc/Dk/Dkalloc.c b/libsrc/Dk/Dkalloc.c
index 1d98fde..9e10f64 100644
--- a/libsrc/Dk/Dkalloc.c
+++ b/libsrc/Dk/Dkalloc.c
@@ -1,7 +1,7 @@
 /*
  *  Dkalloc.c
  *
- *  $Id: Dkalloc.c,v 1.9 2009/04/07 22:00:54 source Exp $
+ *  $Id: Dkalloc.c,v 1.9.2.1 2011/02/14 12:33:59 source Exp $
  *
  *  Memory Allocation
  *
@@ -770,7 +770,10 @@ dk_alloc (size_t c)
 {
   void *thing = dbg_malloc (__FILE__, __LINE__, c);
   if (NULL == thing)
-    GPF_T1 ("Out of memory");
+    {
+      dbg_dump_mem();
+      GPF_T1 ("Out of memory");
+    }
   return thing;
 }
 
@@ -780,7 +783,10 @@ dbg_dk_alloc (DBG_PARAMS size_t c)
 {
   void *thing = dbg_malloc (DBG_ARGS c);
   if (NULL == thing)
-    GPF_T1 ("Out of memory");
+    {
+      dbg_dump_mem();
+      GPF_T1 ("Out of memory");
+    }
   return thing;
 }
 
diff --git a/libsrc/Dk/Dkbox.c b/libsrc/Dk/Dkbox.c
index d90fadb..f1362bd 100644
--- a/libsrc/Dk/Dkbox.c
+++ b/libsrc/Dk/Dkbox.c
@@ -1,7 +1,7 @@
 /*
  *  Dkbox.c
  *
- *  $Id: Dkbox.c,v 1.22.2.5 2009/12/09 10:58:42 source Exp $
+ *  $Id: Dkbox.c,v 1.22.2.7 2011/01/05 12:50:16 source Exp $
  *
  *  Boxes
  *
@@ -41,6 +41,9 @@
 /*#define DV_UNAME_UNIT_DEBUG*/
 /*#define DV_UNAME_STATS*/
 
+#ifndef DOUBLE_ALIGN
+#error boxes must be aligned at 8
+#endif
 
 #ifdef _DEBUG
 long box_types_alloc[256];	/* implicit zero-fill assumed */
@@ -159,21 +162,22 @@ dk_alloc_box (size_t bytes, dtp_t tag)
   if (bytes & ~0xffffff)
     GPF_T1 ("box to allocate is too large");
 #endif
+
   /* This assumes dk_alloc aligns at least at 4 */
 #ifdef DOUBLE_ALIGN
-  align_bytes = IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_8 (bytes);
+  align_bytes = 8 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_8 (bytes));
 #else
-  align_bytes = IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes);
+  align_bytes = 4 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes));
 #endif
 
-#ifdef DOUBLE_ALIGN
-  align_bytes += 8;
-  ptr = (unsigned char *) dk_alloc (align_bytes) + 4;
-#else
-#error boxes must be aligned at 8
-  align_bytes += 4;
   ptr = (unsigned char *) dk_alloc (align_bytes);
+  if (!ptr)
+    return (box_t) ptr;
+
+#ifdef DOUBLE_ALIGN
+  ptr += 4;
 #endif
+
 #ifdef _DEBUG
   box_types_alloc[(unsigned) tag]++;
 #endif
@@ -192,21 +196,22 @@ dk_alloc_box_long (size_t bytes, dtp_t tag)
   if (bytes > 100000000)
     GPF_T1 ("malloc debug only check for large boxes, over 100M");
 #endif
+
   /* This assumes dk_alloc aligns at least at 4 */
 #ifdef DOUBLE_ALIGN
-  align_bytes = IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_8 (bytes);
+  align_bytes = 8 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_8 (bytes));
 #else
-  align_bytes = IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes);
+  align_bytes = 4 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes));
 #endif
 
-#ifdef DOUBLE_ALIGN
-  align_bytes += 8;
-  ptr = (unsigned char *) dk_alloc (align_bytes) + 4;
-#else
-#error boxes must be aligned at 8
-  align_bytes += 4;
   ptr = (unsigned char *) dk_alloc (align_bytes);
+  if (!ptr)
+    return (box_t) ptr;
+
+#ifdef DOUBLE_ALIGN
+  ptr += 4;
 #endif
+
 #ifdef _DEBUG
   box_types_alloc[(unsigned) tag]++;
 #endif
@@ -228,25 +233,25 @@ dk_try_alloc_box (size_t bytes, dtp_t tag)
   if (bytes & ~0xffffff)
     GPF_T1 ("box to allocate is too large");
 #endif
-  /* This assumes dk_alloc aligns at least at 4 */
-  align_bytes = IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes);
 
+  /* This assumes dk_alloc aligns at least at 4 */
 #ifdef DOUBLE_ALIGN
-  align_bytes += 8;
+  align_bytes = 8 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_8 (bytes));
+#else
+  align_bytes = 4 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes));
+#endif
+
   ptr = (unsigned char *) dk_try_alloc (align_bytes);
   if (!ptr)
     return (box_t) ptr;
-  ptr += 4;
-#else
-  align_bytes += 4;
-  ptr = (unsigned char *) dk_try_alloc (align_bytes);
-#endif
+
 #ifdef _DEBUG
   box_types_alloc[(unsigned) tag]++;
 #endif
 
-  if (!ptr)
-    return (box_t) ptr;
+#ifdef DOUBLE_ALIGN
+  ptr += 4;
+#endif
 
   WRITE_BOX_HEADER (ptr, bytes, tag);
   /* memset (ptr, 0, bytes); */
@@ -262,15 +267,20 @@ dk_alloc_box_zero (size_t bytes, dtp_t tag)
   size_t align_bytes;
 
   /* This assumes dk_alloc aligns at least at 4 */
-  align_bytes = IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes);
-
 #ifdef DOUBLE_ALIGN
-  align_bytes += 8;
-  ptr = (unsigned char *) dk_alloc (align_bytes) + 4;
+  align_bytes = 8 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_8 (bytes));
 #else
-  align_bytes += 4;
+  align_bytes = 4 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes));
+#endif
+
   ptr = (unsigned char *) dk_alloc (align_bytes);
+  if (!ptr)
+    return (box_t) ptr;
+
+#ifdef DOUBLE_ALIGN
+  ptr += 4;
 #endif
+
 #ifdef _DEBUG
   box_types_alloc[tag]++;
 #endif
@@ -290,15 +300,20 @@ dbg_dk_alloc_box (DBG_PARAMS size_t bytes, dtp_t tag)
   uint32 align_bytes;
 
   /* This assumes dk_alloc aligns at least at 4 */
-  align_bytes = IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes);
-
 #ifdef DOUBLE_ALIGN
-  align_bytes += 8;
-  ptr = (unsigned char *) dbg_malloc (DBG_ARGS align_bytes) + 4;
+  align_bytes = 8 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_8 (bytes));
 #else
-  align_bytes += 4;
+  align_bytes = 4 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes));
+#endif
+
   ptr = (unsigned char *) dbg_malloc (DBG_ARGS align_bytes);
+  if (!ptr)
+    return (box_t) ptr;
+
+#ifdef DOUBLE_ALIGN
+  ptr += 4;
 #endif
+
 #ifdef _DEBUG
   box_types_alloc[tag]++;
 #endif
@@ -317,15 +332,20 @@ dbg_dk_alloc_box_long (DBG_PARAMS size_t bytes, dtp_t tag)
   uint32 align_bytes;
 
   /* This assumes dk_alloc aligns at least at 4 */
-  align_bytes = IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes);
-
 #ifdef DOUBLE_ALIGN
-  align_bytes += 8;
-  ptr = (unsigned char *) dbg_malloc (DBG_ARGS align_bytes) + 4;
+  align_bytes = 8 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_8 (bytes));
 #else
-  align_bytes += 4;
+  align_bytes = 4 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes));
+#endif
+
   ptr = (unsigned char *) dbg_malloc (DBG_ARGS align_bytes);
+  if (!ptr)
+    return (box_t) ptr;
+
+#ifdef DOUBLE_ALIGN
+  ptr += 4;
 #endif
+
 #ifdef _DEBUG
   box_types_alloc[tag]++;
 #endif
@@ -346,17 +366,20 @@ dbg_dk_try_alloc_box (DBG_PARAMS size_t bytes, dtp_t tag)
   uint32 align_bytes;
 
   /* This assumes dk_alloc aligns at least at 4 */
-  align_bytes = IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes);
-
 #ifdef DOUBLE_ALIGN
-  align_bytes += 8;
-  ptr = (unsigned char *) dbg_malloc (DBG_ARGS align_bytes) + 4;
+  align_bytes = 8 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_8 (bytes));
 #else
-  align_bytes += 4;
-  ptr = (unsigned char *) dbg_malloc (DBG_ARGS align_bytes);
+  align_bytes = 4 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes));
 #endif
+
+  ptr = (unsigned char *) dbg_malloc (DBG_ARGS align_bytes);
   if (!ptr)
     return (box_t) ptr;
+
+#ifdef DOUBLE_ALIGN
+  ptr += 4;
+#endif
+
 #ifdef _DEBUG
   box_types_alloc[tag]++;
 #endif
@@ -375,15 +398,20 @@ dbg_dk_alloc_box_zero (DBG_PARAMS size_t bytes, dtp_t tag)
   uint32 align_bytes;
 
   /* This assumes dk_alloc aligns at least at 4 */
-  align_bytes = IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes);
-
 #ifdef DOUBLE_ALIGN
-  align_bytes += 8;
-  ptr = (unsigned char *) dbg_malloc (DBG_ARGS align_bytes) + 4;
+  align_bytes = 8 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_8 (bytes));
 #else
-  align_bytes += 4;
+  align_bytes = 4 + (IS_STRING_ALIGN_DTP (tag) ? ALIGN_STR (bytes) : ALIGN_4 (bytes));
+#endif
+
   ptr = (unsigned char *) dbg_malloc (DBG_ARGS align_bytes);
+  if (!ptr)
+    return (box_t) ptr;
+
+#ifdef DOUBLE_ALIGN
+  ptr += 4;
 #endif
+
 #ifdef _DEBUG
   box_types_alloc[tag]++;
 #endif
@@ -564,7 +592,11 @@ dk_free_box (box_t box)
       if (box_destr[tag])
 	if (0 != box_destr[tag] (box))
 	  return 0;
+#ifdef DOUBLE_ALIGN
+      len = ALIGN_8 (len);
+#else
       len = ALIGN_4 (len);
+#endif
     }
 
 #ifndef NDEBUG
@@ -678,7 +710,11 @@ dk_free_tree (box_t box)
       if (box_destr[tag])
 	if (0 != box_destr[tag] (box))
 	  return 0;
+#ifdef DOUBLE_ALIGN
+      len = ALIGN_8 (len);
+#else
       len = ALIGN_4 (len);
+#endif
     }
 
 #ifndef NDEBUG
@@ -711,7 +747,7 @@ box_reuse (caddr_t box, ccaddr_t data, size_t len, dtp_t dtp)
 }
 
 
-#ifdef DEBUG
+#ifdef DK_ALLOC_BOX_DEBUG
 void
 dk_check_tree_iter (box_t box, box_t parent, dk_hash_t * known)
 {
@@ -723,12 +759,10 @@ dk_check_tree_iter (box_t box, box_t parent, dk_hash_t * known)
   tag = box_tag (box);
   if ((DV_UNAME == tag) || (DV_REFERENCE == tag))
     return;
-#ifndef NDEBUG
   if (TAG_FREE == tag)
     GPF_T1 ("Tree contains a pointer to a freed box");
   if (TAG_BAD == tag)
     GPF_T1 ("Tree contains a pointer to a box marked bad");
-#endif
   if (!box_can_appear_twice_in_tree[tag])
     {
       box_t other_parent = gethash (box, known);
@@ -765,12 +799,10 @@ dk_check_tree_heads_iter (box_t box, box_t parent, dk_hash_t * known, int count_
   tag = box_tag (box);
   if ((DV_UNAME == tag) || (DV_REFERENCE == tag))
     return;
-#ifndef NDEBUG
   if (TAG_FREE == tag)
     GPF_T1 ("Tree contains a pointer to a freed box");
   if (TAG_BAD == tag)
     GPF_T1 ("Tree contains a pointer to a box marked bad");
-#endif
   if (!box_can_appear_twice_in_tree[tag])
     {
       box_t other_parent = gethash (box, known);
@@ -809,12 +841,10 @@ dk_check_domain_of_connectivity_iter (box_t box, box_t parent, dk_hash_t * known
   tag = box_tag (box);
   if ((DV_UNAME == tag) || (DV_REFERENCE == tag))
     return;
-#ifndef NDEBUG
   if (TAG_FREE == tag)
     GPF_T1 ("Domain of connectivity contains a pointer to a freed box");
   if (TAG_BAD == tag)
     GPF_T1 ("Domain of connectivity contains a pointer to a box marked bad");
-#endif
   if (IS_NONLEAF_DTP (tag))
     {
       box_t *obj = (box_t *) box;
diff --git a/libsrc/Dk/Dkbox.h b/libsrc/Dk/Dkbox.h
index de8f5f9..b39f1ed 100644
--- a/libsrc/Dk/Dkbox.h
+++ b/libsrc/Dk/Dkbox.h
@@ -1,7 +1,7 @@
 /*
  *  Dkbox.h
  *
- *  $Id: Dkbox.h,v 1.32.2.7 2010/05/07 09:14:31 source Exp $
+ *  $Id: Dkbox.h,v 1.32.2.9 2011/03/08 13:41:56 source Exp $
  *
  *  Boxes
  *
@@ -652,13 +652,21 @@ EXE_EXPORT (box_t, dk_alloc_box_zero, (size_t bytes, dtp_t tag));
 #define dk_alloc_list(n) 		((caddr_t *)dk_alloc_box ((n) * sizeof (caddr_t), DV_ARRAY_OF_POINTER))
 
 #ifdef MALLOC_DEBUG
+#define DK_ALLOC_BOX_DEBUG
+#endif
+
+#ifdef DV_UNAME_UNIT_DEBUG
+#define DK_ALLOC_BOX_DEBUG
+#endif
+
+#ifdef MALLOC_DEBUG
 void dk_alloc_box_assert (box_t box);
 #else
 #define dk_alloc_box_assert(box)	;
 #endif
 
 EXE_EXPORT (int, dk_free_box, (box_t box));
-#ifdef DEBUG
+#ifdef DK_ALLOC_BOX_DEBUG
 extern void dk_check_tree (box_t box);
 extern void dk_check_tree_heads (box_t box, int count_of_sample_children);
 extern void dk_check_domain_of_connectivity (box_t box);
diff --git a/libsrc/Dk/Dkernel.c b/libsrc/Dk/Dkernel.c
index 1dd72ad..309030f 100644
--- a/libsrc/Dk/Dkernel.c
+++ b/libsrc/Dk/Dkernel.c
@@ -1,7 +1,7 @@
 /*
  *  Dkernel.c
  *
- *  $Id: Dkernel.c,v 1.25.2.8 2010/03/22 13:45:37 source Exp $
+ *  $Id: Dkernel.c,v 1.25.2.12 2011/03/08 13:41:56 source Exp $
  *
  *  RPC Kernel
  *
@@ -27,7 +27,7 @@
 
 /* Sorry, this still is a mess - merge not complete yet - PmN */
 
-#define NO_DBG_PRINTF
+#undef DBG_PRINTF
 
 #include "Dk.h"
 #include "Dk/Dksystem.h"
@@ -483,6 +483,34 @@ int prpc_disable_burst_mode = 0;
 int prpc_force_burst_mode = 0;
 int prpc_self_signal_initialized = 0;
 
+static void
+check_inputs_for_errors (int eno, int protocol)
+{
+#ifndef WIN32
+  int s, n;
+again:
+  for (n = 0; eno == EBADF && n < last_session; n++)
+    {
+      dk_session_t *ses = served_sessions[n];
+      if (ses && is_protocol (ses->dks_session, protocol))
+	{
+	  if (SESSION_SCH_DATA (ses)->sio_random_read_ready_action ||
+	      SESSION_SCH_DATA (ses)->sio_default_read_ready_action ||
+	      SESSION_SCH_DATA (ses)->sio_random_write_ready_action)
+	    {
+	      s = DKS_SOCK (ses);
+	      if (-1 == fcntl (s, F_GETFL))
+		{
+		  log_error ("Bad file descriptor (%d) in served sessions, removing", s);
+		  remove_from_served_sessions (ses);
+		  goto again;
+		}
+	    }
+	}
+    }
+#endif
+}
+
 static int
 check_inputs_low (TAKE_G timeout_t * timeout_org, int is_recursive, select_func_t select_fun, int protocol)
 {
@@ -553,6 +581,8 @@ check_inputs_low (TAKE_G timeout_t * timeout_org, int is_recursive, select_func_
 
   if (rc < 0)
     {
+      int eno = errno;
+      check_inputs_for_errors (eno, protocol); 
       PROCESS_ALLOW_SCHEDULE ();
       return 0;
     }
@@ -4281,7 +4311,7 @@ PrpcConnect2 (char *address, int sesclass, char *ssl_usage, char *pass, char *ca
 	  SSL *ssl = NULL;
 	  int ssl_err = 0;
 	  int dst = tcpses_get_fd (session->dks_session);
-	  SSL_METHOD *ssl_method = SSLv23_client_method ();
+	  const SSL_METHOD *ssl_method = SSLv23_client_method ();
 	  SSL_CTX *ssl_ctx = SSL_CTX_new (ssl_method);
 	  ssl = SSL_new (ssl_ctx);
 	  SSL_set_fd (ssl, dst);
@@ -4816,7 +4846,7 @@ dk_ssl_free (void *old)
 static void
 ssl_server_init ()
 {
-  SSL_METHOD *ssl_server_method = NULL;
+  const SSL_METHOD *ssl_server_method;
   unsigned char tmp[1024];
 #ifndef NO_THREAD
   char err_buf[1024];
@@ -4910,12 +4940,12 @@ ssl_server_init ()
       SSL_CTX_set_session_id_context (ssl_server_ctx, (unsigned char *) &session_id_context, sizeof session_id_context);
 
       skCAList = SSL_CTX_get_client_CA_list (ssl_server_ctx);
-      if (sk_X509_ALGOR_num (skCAList) == 0)
+      if (sk_X509_NAME_num (skCAList) == 0)
 	log_warning ("ODBC X509 Client authentication requested but no CA known for verification");
-      for (i = 0; i < sk_X509_ALGOR_num (skCAList); i++)
+      for (i = 0; i < sk_X509_NAME_num (skCAList); i++)
 	{
 	  char ca_buf[1024];
-	  X509_NAME *ca_name = (X509_NAME *) sk_X509_ALGOR_value (skCAList, i);
+	  X509_NAME *ca_name = (X509_NAME *) sk_X509_NAME_value (skCAList, i);
 	  if (X509_NAME_oneline (ca_name, ca_buf, sizeof (ca_buf)))
 	    log_debug ("ODBC Server Using X509 Client CA %s", ca_buf);
 	}
@@ -5080,7 +5110,7 @@ ssl_setup:
 
   if (ca && ca[0] != 0)
     {
-      sk_X509_ALGOR_pop_free (ca_list, (void (*)(void *)) X509_free);
+      sk_X509_pop_free (ca_list, X509_free);
       ca_list = NULL;
       ca_list = PEM_load_certs (ca, passwd);
     }
@@ -5089,30 +5119,30 @@ ssl_setup:
     {
       X509_free (cert);
       EVP_PKEY_free (pkey);
-      sk_X509_ALGOR_pop_free (ca_list, (void (*)(void *)) X509_free);
+      sk_X509_pop_free (ca_list, X509_free);
       return 0;
     }
   EVP_PKEY_free (pkey);
   if (!SSL_use_certificate (ssl, cert))
     {
       X509_free (cert);
-      sk_X509_ALGOR_pop_free (ca_list, (void (*)(void *)) X509_free);
+      sk_X509_pop_free (ca_list, X509_free);
       return 0;
     }
   X509_free (cert);
 
   if (!SSL_check_private_key (ssl))
     {
-      sk_X509_ALGOR_pop_free (ca_list, (void (*)(void *)) X509_free);
+      sk_X509_pop_free (ca_list, X509_free);
       return 0;
     }
-  for (i = 0; i < sk_X509_ALGOR_num (ca_list); i++)
+  for (i = 0; i < sk_X509_num (ca_list); i++)
     {
-      X509 *ca = (X509 *) sk_X509_ALGOR_value (ca_list, i);
+      X509 *ca = (X509 *) sk_X509_value (ca_list, i);
       SSL_add_client_CA (ssl, ca);
       X509_STORE_add_cert (SSL_CTX_get_cert_store (ssl_ctx), ca);
     }
-  sk_X509_ALGOR_pop_free (ca_list, (void (*)(void *)) X509_free);
+  sk_X509_pop_free (ca_list, X509_free);
   return 1;
 }
 
@@ -5301,6 +5331,9 @@ dk_alloc_reserve_malloc (size_t size, int gpf_if_not)
 #if defined (UNIX) && !defined (MALLOC_DEBUG)
       log_error ("Current location of the program break %ld", (long) sbrk (0) - init_brk);
 #endif
+#ifdef MALLOC_DEBUG
+      dbg_dump_mem();
+#endif
       GPF_T1 ("Out of memory");
     }
   return thing;
@@ -5319,6 +5352,9 @@ dk_alloc_reserve_malloc (size_t size, int gpf_if_not)
 #if defined (UNIX) && !defined (MALLOC_DEBUG)
       log_error ("Current location of the program break %ld", (long) sbrk (0) - init_brk);
 #endif
+#ifdef MALLOC_DEBUG
+      dbg_dump_mem();
+#endif
       GPF_T1 ("Out of memory");
     }
   return thing;
diff --git a/libsrc/Dk/Dkernel.h b/libsrc/Dk/Dkernel.h
index e14d4d8..93ce380 100644
--- a/libsrc/Dk/Dkernel.h
+++ b/libsrc/Dk/Dkernel.h
@@ -1,7 +1,7 @@
 /*
  *  Dkernel.h
  *
- *  $Id: Dkernel.h,v 1.19.2.2 2009/11/04 01:19:42 source Exp $
+ *  $Id: Dkernel.h,v 1.19.2.3 2011/01/05 12:50:32 source Exp $
  *
  *  RPC Kernel
  *
@@ -245,52 +245,52 @@ typedef struct
 } service_desc_t;
 
 #define SERVICE_0(name1, str, send, ret_dtp) \
-  service_desc_t name1 = { str, 0, NULL, send, ret_dtp };
+  service_desc_t name1 = { str, 0, NULL, send, ret_dtp }
 
 #define SERVICE_1(name1, name2, str, send, ret_dtp, a1, n1) \
   static long _args_##name1 [1] = { a1 }; \
   static char _args_null_##name1 [1] = { n1 }; \
-  service_desc_t name1 = { str, 1, _args_##name1, send, ret_dtp, _args_null_##name1 };
+  service_desc_t name1 = { str, 1, _args_##name1, send, ret_dtp, _args_null_##name1 }
 
 #define SERVICE_2(name1, name2, str, send, ret_dtp, a1, n1, a2, n2) \
   static long _args_##name1 [2] = { a1,a2 }; \
   static char _args_null_##name1 [2] = { n1,n2 }; \
-  service_desc_t name1 = { str, 2, _args_##name1, send, ret_dtp, _args_null_##name1 };
+  service_desc_t name1 = { str, 2, _args_##name1, send, ret_dtp, _args_null_##name1 }
 
 #define SERVICE_3(name1, name2, str, send, ret_dtp, a1,n1,a2,n2,a3,n3) \
   static long _args_##name1 [3] = { a1,a2,a3 }; \
   static char _args_null_##name1 [3] = { n1,n2,n3 }; \
-  service_desc_t name1 = { str, 3, _args_##name1, send, ret_dtp, _args_null_##name1 };
+  service_desc_t name1 = { str, 3, _args_##name1, send, ret_dtp, _args_null_##name1 }
 
 #define SERVICE_4(name1, name2, str, send, ret_dtp, a1,n1,a2,n2,a3,n3,a4,n4) \
   static long _args_##name1 [4] = { a1,a2,a3,a4 }; \
   static char _args_null_##name1 [4] = { n1,n2,n3,n4 }; \
-  service_desc_t name1 = { str, 4, _args_##name1, send, ret_dtp, _args_null_##name1 };
+  service_desc_t name1 = { str, 4, _args_##name1, send, ret_dtp, _args_null_##name1 }
 
 #define SERVICE_5(name1, name2, str, send, ret_dtp, a1,n1,a2,n2,a3,n3,a4,n4,a5,n5) \
   static long _args_##name1 [5] = { a1,a2,a3,a4,a5 }; \
   static char _args_null_##name1 [5] = { n1,n2,n3,n4,n5 }; \
-  service_desc_t name1 = { str, 5, _args_##name1, send, ret_dtp, _args_null_##name1 };
+  service_desc_t name1 = { str, 5, _args_##name1, send, ret_dtp, _args_null_##name1 }
 
 #define SERVICE_6(name1, name2, str, send, ret_dtp, a1,n1,a2,n2,a3,n3,a4,n4,a5,n5,a6,n6) \
   static long _args_##name1 [6] = { a1,a2,a3,a4,a5,a6 }; \
   static char _args_null_##name1 [6] = { n1,n2,n3,n4,n5,n6 }; \
-  service_desc_t name1 = { str, 6, _args_##name1, send, ret_dtp, _args_null_##name1 };
+  service_desc_t name1 = { str, 6, _args_##name1, send, ret_dtp, _args_null_##name1 }
 
 #define SERVICE_7(name1, name2, str, send, ret_dtp, a1,n1,a2,n2,a3,n3,a4,n4,a5,n5,a6,n6,a7,n7) \
   static long _args_##name1 [7] = { a1,a2,a3,a4,a5,a6,a7 }; \
   static char _args_null_##name1 [7] = { n1,n2,n3,n4,n5,n6,n7 }; \
-  service_desc_t name1 = {str, 7, _args_##name1, send, ret_dtp, _args_null_##name1 };
+  service_desc_t name1 = {str, 7, _args_##name1, send, ret_dtp, _args_null_##name1 }
 
 #define SERVICE_8(name1, name2, str, send, ret_dtp, a1,n1,a2,n2,a3,n3,a4,n4,a5,n5,a6,n6,a7,n7,a8,n8) \
   static long _args_##name1 [8] = { a1,a2,a3,a4,a5,a6,a7,a8 }; \
   static char _args_null_##name1 [8] = { n1,n2,n3,n4,n5,n6,n7,n8 }; \
-  service_desc_t name1 = {str, 8, _args_##name1, send, ret_dtp, _args_null_##name1 };
+  service_desc_t name1 = {str, 8, _args_##name1, send, ret_dtp, _args_null_##name1 }
 
 #define SERVICE_9(name1, name2, str, send, ret_dtp, a1,n1,a2,n2,a3,n3,a4,n4,a5,n5,a6,n6,a7,n7,a8,n8,a9,n9) \
   static long _args_##name1 [9] = { a1,a2,a3,a4,a5,a6,a7,a8,a9 }; \
   static char _args_null_##name1 [9] = { n1,n2,n3,n4,n5,n6,n7,n8,n9 }; \
-  service_desc_t name1 = {str, 9, _args_##name1, send, ret_dtp, _args_null_##name1 };
+  service_desc_t name1 = {str, 9, _args_##name1, send, ret_dtp, _args_null_##name1 }
 
 
 /*
diff --git a/libsrc/Dk/Dkhash.h b/libsrc/Dk/Dkhash.h
index ad7a705..d810291 100644
--- a/libsrc/Dk/Dkhash.h
+++ b/libsrc/Dk/Dkhash.h
@@ -1,7 +1,7 @@
 /*
  *  Dkhash.h
  *
- *  $Id: Dkhash.h,v 1.11 2009/04/07 22:00:54 source Exp $
+ *  $Id: Dkhash.h,v 1.11.2.1 2011/03/08 13:41:56 source Exp $
  *
  *  Hash tables
  *
@@ -165,7 +165,7 @@ extern void dk_hash_set_rehash (dk_hash_t * ht, uint32 ov_per_bucket);
 typedef int32 (*box_hash_func_t) (caddr_t);
 typedef int (*box_hash_cmp_func_t) (ccaddr_t, ccaddr_t);
 void dk_dtp_register_hash (dtp_t dtp, box_hash_func_t hf, box_hash_cmp_func_t cmp);
-#ifdef DEBUG						   /* These definitions are here because they need dk_hash_t, otherwise they would be placed into Dkbox.h */
+#ifdef DK_ALLOC_BOX_DEBUG						   /* These definitions are here because they need dk_hash_t, otherwise they would be placed into Dkbox.h */
 extern void dk_check_tree_iter (box_t box, box_t parent, dk_hash_t * known);
 extern void dk_check_domain_of_connectivity_iter (box_t box, box_t parent, dk_hash_t * known);
 #endif
diff --git a/libsrc/Dk/Dkmarshal.c b/libsrc/Dk/Dkmarshal.c
index 5c3184c..0010c85 100644
--- a/libsrc/Dk/Dkmarshal.c
+++ b/libsrc/Dk/Dkmarshal.c
@@ -1,7 +1,7 @@
 /*
  *  Dkmarshal.c
  *
- *  $Id: Dkmarshal.c,v 1.16.2.4 2009/12/09 10:58:42 source Exp $
+ *  $Id: Dkmarshal.c,v 1.16.2.5 2011/01/25 14:32:56 source Exp $
  *
  *  Marshalling on top of sessions
  *
@@ -891,7 +891,7 @@ double_to_buf (double d, char *buf)
   unsigned char buf2[8];
   XDR x;
 
-  xdrmem_create (&x, (char *) buf, sizeof (buf2), XDR_ENCODE);
+  xdrmem_create (&x, (char *) buf2, sizeof (buf2), XDR_ENCODE);
   xdr_double (&x, &d);
   memcpy (buf, buf2, sizeof (double));
 #endif
diff --git a/libsrc/Dk/Dksestcp.c b/libsrc/Dk/Dksestcp.c
index dfefd80..240bf25 100644
--- a/libsrc/Dk/Dksestcp.c
+++ b/libsrc/Dk/Dksestcp.c
@@ -1,7 +1,7 @@
 /*
  *  Dksestcp.c
  *
- *  $Id: Dksestcp.c,v 1.14 2009/04/07 22:00:54 source Exp $
+ *  $Id: Dksestcp.c,v 1.14.2.2 2011/03/08 13:41:56 source Exp $
  *
  *  TCP/IP sessions
  *
@@ -25,7 +25,7 @@
  *
  */
 
-#define NO_DBG_PRINTF
+#undef DBG_PRINTF
 
 #include "Dk.h"
 #include "Dksestcp.h"
@@ -226,7 +226,7 @@ dk_parse_address (char *str)
 }
 
 
-static char addrinfo[100];
+static char addrinfo[256];
 
 #define SEPARATOR " :"
 
@@ -289,7 +289,7 @@ tcpses_set_address (session_t * ses, char *addrinfo1)
 
   {
     char *stringplace;
-    char localstring[50];
+    char localstring[256];
     strncpy (localstring, addrinfo, sizeof (localstring));
     localstring[sizeof (localstring) - 1] = 0;
     stringplace = strtok_r (localstring, SEPARATOR, &strs);
diff --git a/libsrc/Dk/Dksets.c b/libsrc/Dk/Dksets.c
index 63b0f00..b87e5ef 100644
--- a/libsrc/Dk/Dksets.c
+++ b/libsrc/Dk/Dksets.c
@@ -1,7 +1,7 @@
 /*
  *  Dksets.c
  *
- *  $Id: Dksets.c,v 1.7 2009/04/07 22:00:54 source Exp $
+ *  $Id: Dksets.c,v 1.7.2.2 2010/12/06 10:37:13 source Exp $
  *
  *  Sets
  *
@@ -449,4 +449,24 @@ dk_set_push (s_node_t ** set, void *item)
 {
   dbg_dk_set_push (__FILE__, __LINE__, set, item);
 }
+
+#undef list_to_array
+caddr_t
+list_to_array (dk_set_t l)
+{
+  return dbg_list_to_array (__FILE__, __LINE__, l);
+}
+
+#undef copy_list_to_array
+caddr_t
+copy_list_to_array (dk_set_t l)
+{
+  return dbg_copy_list_to_array (__FILE__, __LINE__, l);
+}
+#undef revlist_to_array
+caddr_t
+revlist_to_array (dk_set_t l)
+{
+  return dbg_revlist_to_array (__FILE__, __LINE__, l);
+}
 #endif
diff --git a/libsrc/Dk/Dksets.h b/libsrc/Dk/Dksets.h
index d45738a..faf0011 100644
--- a/libsrc/Dk/Dksets.h
+++ b/libsrc/Dk/Dksets.h
@@ -1,7 +1,7 @@
 /*
  *  Dksets.h
  *
- *  $Id: Dksets.h,v 1.7 2009/04/07 22:00:54 source Exp $
+ *  $Id: Dksets.h,v 1.7.2.2 2010/12/06 10:37:13 source Exp $
  *
  *  Sets
  *
@@ -122,6 +122,9 @@ uint32 dk_set_length (s_node_t * set);
 dk_set_t dk_set_last (dk_set_t set);
 dk_set_t dk_set_conc (dk_set_t s1, dk_set_t s2);
 
+EXE_EXPORT (caddr_t, list_to_array, (dk_set_t l));
+EXE_EXPORT (caddr_t, copy_list_to_array, (dk_set_t l));
+EXE_EXPORT (caddr_t, revlist_to_array, (dk_set_t l));
 EXE_EXPORT (int, dk_set_delete, (dk_set_t * set, void *item));
 EXE_EXPORT (void *, dk_set_delete_nth, (dk_set_t * set, int idx));
 EXE_EXPORT (void, dk_set_push, (s_node_t ** set, void *item));
@@ -162,7 +165,6 @@ dk_set_t dbg_dk_set_copy (const char *file, int line, dk_set_t s);
 #else
 dk_set_t dk_set_cons (void *s1, dk_set_t s2);
 void **dk_set_to_array (s_node_t * set);
-caddr_t list_to_array (dk_set_t l);
 caddr_t copy_list_to_array (dk_set_t l);
 caddr_t revlist_to_array (dk_set_t l);
 void dk_set_pushnew (s_node_t ** set, void *item);
diff --git a/libsrc/Dk/Dktrace.h b/libsrc/Dk/Dktrace.h
index c006062..61e221b 100644
--- a/libsrc/Dk/Dktrace.h
+++ b/libsrc/Dk/Dktrace.h
@@ -1,7 +1,7 @@
 /*
  *  Dktrace.h
  *
- *  $Id: Dktrace.h,v 1.3 2009/04/07 22:00:54 source Exp $
+ *  $Id: Dktrace.h,v 1.3.2.1 2011/03/08 13:41:57 source Exp $
  *
  *  Tracing & Debugging
  *
@@ -31,12 +31,11 @@
 #define GPF_T1(tx) \
 	gpf_notice (__FILE__, __LINE__, tx)
 
-#ifndef DEBUG
-#undef NO_DBG_PRINTF
-#define NO_DBG_PRINTF
+#ifdef NDEBUG
+#undef DBG_PRINTF
 #endif
 
-#ifndef NO_DBG_PRINTF
+#ifdef DBG_PRINTF
 # ifdef __GNUC__
 /* This macro uses a gcc specific preprocessor extension */
 #  define _dbg_print(fmt, args...) \
diff --git a/libsrc/Dk/Makefile.in b/libsrc/Dk/Makefile.in
index 93ea1b0..b6b0330 100644
--- a/libsrc/Dk/Makefile.in
+++ b/libsrc/Dk/Makefile.in
@@ -211,6 +211,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/Dk/config.h.in b/libsrc/Dk/config.h.in
index 71e1671..bd7e5c5 100644
--- a/libsrc/Dk/config.h.in
+++ b/libsrc/Dk/config.h.in
@@ -172,6 +172,9 @@
 /* Define to 1 if you have the `pthread_attr_setstacksize' function. */
 #undef HAVE_PTHREAD_ATTR_SETSTACKSIZE
 
+/* Define to 1 if you have the `pthread_sigmask' function. */
+#undef HAVE_PTHREAD_SIGMASK
+
 /* Define to 1 if the system has the type `ptrdiff_t'. */
 #undef HAVE_PTRDIFF_T
 
@@ -242,13 +245,13 @@
 /* Define to 1 if you have the `strtok_r' function. */
 #undef HAVE_STRTOK_R
 
-/* Define to 1 if `st_blksize' is member of `struct stat'. */
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_BLKSIZE
 
-/* Define to 1 if `st_blocks' is member of `struct stat'. */
+/* Define to 1 if `st_blocks' is a member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_BLOCKS
 
-/* Define to 1 if `st_rdev' is member of `struct stat'. */
+/* Define to 1 if `st_rdev' is a member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_RDEV
 
 /* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use
@@ -457,6 +460,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
diff --git a/libsrc/JDBCDriverType4/Makefile.in b/libsrc/JDBCDriverType4/Makefile.in
index eb91855..60f752f 100644
--- a/libsrc/JDBCDriverType4/Makefile.in
+++ b/libsrc/JDBCDriverType4/Makefile.in
@@ -200,6 +200,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/JDBCDriverType4/test4.sh b/libsrc/JDBCDriverType4/test4.sh
old mode 100644
new mode 100755
diff --git a/libsrc/JDBCDriverType4/testsuite_2.0/Makefile.in b/libsrc/JDBCDriverType4/testsuite_2.0/Makefile.in
index 8447fa6..673a579 100644
--- a/libsrc/JDBCDriverType4/testsuite_2.0/Makefile.in
+++ b/libsrc/JDBCDriverType4/testsuite_2.0/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/JDBCDriverType4/testsuite_2.0/TestExecuteFetch.java b/libsrc/JDBCDriverType4/testsuite_2.0/TestExecuteFetch.java
index 2b85af4..385df1c 100644
--- a/libsrc/JDBCDriverType4/testsuite_2.0/TestExecuteFetch.java
+++ b/libsrc/JDBCDriverType4/testsuite_2.0/TestExecuteFetch.java
@@ -64,8 +64,8 @@ public class TestExecuteFetch
             System.out.println("    FAILED");
             System.exit(-1);
          }
-         System.out.println("Execute select * from sys_keys");
-         boolean more = stmt.execute("select * from sys_keys");
+         System.out.println("Execute select * from INFORMATION_SCHEMA.TABLES");
+         boolean more = stmt.execute("select * from INFORMATION_SCHEMA.TABLES");
          ResultSetMetaData data = stmt.getResultSet().getMetaData();
          for(int i = 1;i <= data.getColumnCount();i++)
             System.out.println(data.getColumnLabel(i) + "\t" + data.getColumnTypeName(i));
diff --git a/libsrc/JDBCDriverType4/testsuite_3.0/Makefile.in b/libsrc/JDBCDriverType4/testsuite_3.0/Makefile.in
index bbc8c13..458b523 100644
--- a/libsrc/JDBCDriverType4/testsuite_3.0/Makefile.in
+++ b/libsrc/JDBCDriverType4/testsuite_3.0/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/JDBCDriverType4/testsuite_3.0/TestExecuteFetch.java b/libsrc/JDBCDriverType4/testsuite_3.0/TestExecuteFetch.java
index 298c8b5..a947179 100644
--- a/libsrc/JDBCDriverType4/testsuite_3.0/TestExecuteFetch.java
+++ b/libsrc/JDBCDriverType4/testsuite_3.0/TestExecuteFetch.java
@@ -64,8 +64,8 @@ public class TestExecuteFetch
             System.out.println("    FAILED");
             System.exit(-1);
          }
-         System.out.println("Execute select * from sys_keys");
-         boolean more = stmt.execute("select * from sys_keys");
+         System.out.println("Execute select * from INFORMATION_SCHEMA.TABLES");
+         boolean more = stmt.execute("select * from INFORMATION_SCHEMA.TABLES");
          ResultSetMetaData data = stmt.getResultSet().getMetaData();
          for(int i = 1;i <= data.getColumnCount();i++)
             System.out.println(data.getColumnLabel(i) + "\t" + data.getColumnTypeName(i));
diff --git a/libsrc/JDBCDriverType4/testsuite_3.0/TestPrepareBatch.java b/libsrc/JDBCDriverType4/testsuite_3.0/TestPrepareBatch.java
index b860a2c..f6aa245 100644
--- a/libsrc/JDBCDriverType4/testsuite_3.0/TestPrepareBatch.java
+++ b/libsrc/JDBCDriverType4/testsuite_3.0/TestPrepareBatch.java
@@ -86,7 +86,7 @@ public class TestPrepareBatch
             if(res[i] != 1)
             {
                System.out.println(i + " " + res[i]);
-               System.out.print("    FAILED");
+               System.out.println("    FAILED");
                System.exit(-1);
             }
          System.out.println("    PASSED");
diff --git a/libsrc/JDBCDriverType4/testsuite_4.0/Makefile.in b/libsrc/JDBCDriverType4/testsuite_4.0/Makefile.in
index e24e8b4..1cfceb0 100644
--- a/libsrc/JDBCDriverType4/testsuite_4.0/Makefile.in
+++ b/libsrc/JDBCDriverType4/testsuite_4.0/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/JDBCDriverType4/testsuite_4.0/TestExecuteFetch.java b/libsrc/JDBCDriverType4/testsuite_4.0/TestExecuteFetch.java
index 3b9ddb2..878c2f3 100644
--- a/libsrc/JDBCDriverType4/testsuite_4.0/TestExecuteFetch.java
+++ b/libsrc/JDBCDriverType4/testsuite_4.0/TestExecuteFetch.java
@@ -64,8 +64,8 @@ public class TestExecuteFetch
             System.out.println("    FAILED");
             System.exit(-1);
          }
-         System.out.println("Execute select * from sys_keys");
-         boolean more = stmt.execute("select * from sys_keys");
+         System.out.println("Execute select * from INFORMATION_SCHEMA.TABLES");
+         boolean more = stmt.execute("select * from INFORMATION_SCHEMA.TABLES");
          ResultSetMetaData data = stmt.getResultSet().getMetaData();
          for(int i = 1;i <= data.getColumnCount();i++)
             System.out.println(data.getColumnLabel(i) + "\t" + data.getColumnTypeName(i));
diff --git a/libsrc/JDBCDriverType4/virtuoso/Makefile.in b/libsrc/JDBCDriverType4/virtuoso/Makefile.in
index 46a4788..55096fc 100644
--- a/libsrc/JDBCDriverType4/virtuoso/Makefile.in
+++ b/libsrc/JDBCDriverType4/virtuoso/Makefile.in
@@ -200,6 +200,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc2/Driver.java b/libsrc/JDBCDriverType4/virtuoso/jdbc2/Driver.java
index 6601408..49e9dac 100644
--- a/libsrc/JDBCDriverType4/virtuoso/jdbc2/Driver.java
+++ b/libsrc/JDBCDriverType4/virtuoso/jdbc2/Driver.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: Driver.java,v 1.16.2.27 2010/07/09 14:22:28 source Exp $
+ *  $Id: Driver.java,v 1.16.2.30 2011/03/23 12:01:46 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -62,7 +62,7 @@ public class Driver implements java.sql.Driver
    // The major and minor version number
    protected static final int major = 3;
 
-   protected static final int minor = 54;
+   protected static final int minor = 57;
 
    // Some variables
    private String host = "localhost";
diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc2/Makefile.in b/libsrc/JDBCDriverType4/virtuoso/jdbc2/Makefile.in
index e80bc63..37e0405 100644
--- a/libsrc/JDBCDriverType4/virtuoso/jdbc2/Makefile.in
+++ b/libsrc/JDBCDriverType4/virtuoso/jdbc2/Makefile.in
@@ -164,6 +164,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoConnection.java b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoConnection.java
index 4ea3cd3..0a55932 100644
--- a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoConnection.java
+++ b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoConnection.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtuosoConnection.java,v 1.9.2.11 2010/07/09 14:22:28 source Exp $
+ *  $Id: VirtuosoConnection.java,v 1.9.2.12 2010/09/27 14:37:00 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -128,7 +128,8 @@ public class VirtuosoConnection implements Connection
    private boolean readOnly = false;
 
    // The timeout for I/O
-   protected int timeout = 60;
+   protected int timeout_def = 60;
+   protected int timeout = 0;
    protected int txn_timeout = 0;
 
    protected int fbs = VirtuosoTypes.DEFAULTPREFETCH;
@@ -358,6 +359,7 @@ public class VirtuosoConnection implements Connection
    public boolean isConnectionLost() 
    {
      try{
+	pingStatement.setQueryTimeout(1);
         pingStatement.execute();
         return false;
      } catch (Exception e ) {
@@ -533,7 +535,9 @@ public class VirtuosoConnection implements Connection
 	else
 #endif
 	 socket = new Socket(host,port);
-	 socket.setSoTimeout(timeout*1000);
+
+	 if (timeout > 0)
+	   socket.setSoTimeout(timeout*1000);
 	 socket.setTcpNoDelay(true);
 #if JDK_VER >= 12
          socket.setReceiveBufferSize(recvbs);
@@ -656,13 +660,23 @@ public class VirtuosoConnection implements Connection
 			 //  System.err.println (client_charset.elementAt(0).toString());
 			 //else
 			 //  System.err.println ("<NULL>");
-			 timeout = (int) (cdef_param (client_defaults, "SQL_QUERY_TIMEOUT", timeout * 1000) / 1000);
-			 //System.err.println ("timeout = " + timeout);
-			 socket.setSoTimeout(timeout*1000);
-			 txn_timeout = (int) (cdef_param (client_defaults, "SQL_TXN_TIMEOUT", txn_timeout * 1000)/ 1000);
-			 //System.err.println ("txn timeout = " + txn_timeout);
-			 trxisolation = (int) cdef_param (client_defaults, "SQL_TXN_ISOLATION", trxisolation);
-			 //System.err.println ("txn isolation = " + trxisolation);
+
+			 if (timeout <= 0) {
+			   timeout = (int) (cdef_param (client_defaults, "SQL_QUERY_TIMEOUT", timeout_def * 1000) / 1000);
+			   //System.err.println ("timeout = " + timeout);
+			 }
+                         if (timeout > 0)
+			   socket.setSoTimeout(timeout*1000);
+
+			 if (txn_timeout <= 0) {
+			   txn_timeout = (int) (cdef_param (client_defaults, "SQL_TXN_TIMEOUT", txn_timeout * 1000)/ 1000);
+			   //System.err.println ("txn timeout = " + txn_timeout);
+			 }
+
+			 if (trxisolation <= 0) {
+			   trxisolation = (int) cdef_param (client_defaults, "SQL_TXN_ISOLATION", trxisolation);
+			   //System.err.println ("txn isolation = " + trxisolation);
+			 }
 
 			 utf8_execs = cdef_param (client_defaults, "SQL_UTF8_EXECS", 0) != 0;
 			 //System.err.println ("utf8_execs = " + utf8_execs);
diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoExplicitString.java b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoExplicitString.java
index 55bab98..a95edea 100644
--- a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoExplicitString.java
+++ b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoExplicitString.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtuosoExplicitString.java,v 1.4.2.2 2009/08/20 20:13:28 source Exp $
+ *  $Id: VirtuosoExplicitString.java,v 1.4.2.3 2011/03/23 12:01:46 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -63,24 +63,16 @@ public class VirtuosoExplicitString
 	    }
 	  else if (dtp == VirtuosoTypes.DV_STRING || dtp == VirtuosoTypes.DV_SHORT_STRING_SERIAL ||
 	      dtp == VirtuosoTypes.DV_STRICT_STRING || dtp == VirtuosoTypes.DV_C_STRING ||
-	      dtp == VirtuosoTypes.DV_BLOB)
+	      dtp == VirtuosoTypes.DV_BLOB || dtp == VirtuosoTypes.DV_ANY)
 	    {
 	      // If it's an narrow parameter
  	      if (con != null && con.charset_utf8)
 	        bytes = str.getBytes ("UTF8");
 	      else if (con != null && con.charset != null)
-		{
 		  bytes = con.charsetBytes(str);
-		  //System.out.println ("after charsetBytes len=" + bytes.length);
-		  //try {
-		  //  FileOutputStream fo = new FileOutputStream ("setstr.gb");
-		  //  fo.write (bytes);
-		  //  fo.flush();
-		  //  fo = null;
-		  //} catch (Exception e) {};
-		}
 	      else
 		cli_wide_to_narrow (str, con != null ? con.client_charset_hash : null);
+
 	      if (bytes.length < 256)
 		this.dtp = VirtuosoTypes.DV_SHORT_STRING_SERIAL;
 	      else
@@ -108,8 +100,11 @@ public class VirtuosoExplicitString
 		}
 	      else
 		{
-		  if (con != null && con.charset != null)
+ 	          if (con != null && con.charset_utf8)
+	            bytes = str.getBytes ("UTF8");
+	          else if (con != null && con.charset != null)
 		    bytes = con.charsetBytes(str);
+
 		  if (bytes.length < 256)
 		    this.dtp = VirtuosoTypes.DV_SHORT_STRING_SERIAL;
 		  else
@@ -141,24 +136,19 @@ public class VirtuosoExplicitString
 	  return (true);
 	}
 
-      //System.err.println ("cli_wide_to_narrow");
       bytes = new byte[str.length()];
-      if (charset_ht == null) {
-        for (int i = 0; i < str.length(); i++)
+      if (charset_ht == null) 
 	  {
+        for (int i = 0; i < str.length(); i++)
 	    bytes[i] = (byte)str.charAt(i);
 	  }
-      } else {
+      else 
+       {
         for (int i = 0; i < str.length(); i++)
 	  {
 	    Character ch = new Character (str.charAt(i));
 	    Byte b;
 	    b = (Byte)(charset_ht != null ? charset_ht.get (ch) : new Byte ((byte) (ch.charValue())));
-	    //System.err.print ("Searching " + ((int)str.charAt(i)) + "=");
-	    //if (b != null)
-	    //  System.err.println (b.intValue());
-	    //else
-	    //  System.err.println ("<not found>");
 	    if (b == null)
 	      {
 	        bytes[i] = (byte) '?';
@@ -235,21 +225,6 @@ public class VirtuosoExplicitString
 	os.write (bytes.length);
       else
 	os.writelongint (bytes.length);
-      if ((dtp == VirtuosoTypes.DV_WIDE || dtp == VirtuosoTypes.DV_LONG_WIDE)
-	  && str != null)
-	{
-	  for (int i = 0; i < str.length(); i++)
-	    {
-	      byte [] utf8;
-	      utf8 = str.substring(i, i + 1).getBytes("UTF8");
-	      if (utf8 != null)
-		{
-		  os.write (utf8, 0, utf8.length);
-		  os.flush();
-		}
-	    }
-	}
-      else
 	os.write (bytes, 0, bytes.length);
     }
 
diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoPooledConnection.java b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoPooledConnection.java
index 8cae16b..754237b 100644
--- a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoPooledConnection.java
+++ b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoPooledConnection.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtuosoPooledConnection.java,v 1.2.2.5 2010/03/26 19:48:27 source Exp $
+ *  $Id: VirtuosoPooledConnection.java,v 1.2.2.7 2011/02/18 10:25:13 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -183,7 +183,7 @@ public class VirtuosoPooledConnection implements PooledConnection, Cloneable {
    *
    * @exception SQLException if a database access error occurs
    */
-  public void close() throws java.sql.SQLException {
+  public synchronized void close() throws java.sql.SQLException {
     SQLException ex = null;
     if (connWrapper != null) {
       try {
@@ -266,7 +266,7 @@ public class VirtuosoPooledConnection implements PooledConnection, Cloneable {
     if (conn == null) {
        return true;
     }
-    return conn.isConnectionLost();
+    return conn.isClosed() || conn.isConnectionLost();
   }
 
 #if JDK_VER >= 16
diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoPreparedStatement.java b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoPreparedStatement.java
index 5b46594..e5c8848 100644
--- a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoPreparedStatement.java
+++ b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoPreparedStatement.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtuosoPreparedStatement.java,v 1.6.2.5 2009/08/21 11:36:14 source Exp $
+ *  $Id: VirtuosoPreparedStatement.java,v 1.6.2.7 2011/03/23 12:01:46 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -98,7 +98,7 @@ public class VirtuosoPreparedStatement extends VirtuosoStatement implements Prep
 	      // Create a future
 	      future = connection.getFuture(VirtuosoFuture.prepare,args, this.rpc_timeout);
 	      // Process result to get information about results meta data
-	      vresultSet = new VirtuosoResultSet(this,metaData);
+	      vresultSet = new VirtuosoResultSet(this,metaData, true);
               clearParameters();
 	    }
 	  catch(IOException e)
@@ -160,7 +160,7 @@ public class VirtuosoPreparedStatement extends VirtuosoStatement implements Prep
 	     // Put the options array in the args array
 	     args[5] = getStmtOpts();
 	     future = connection.getFuture(VirtuosoFuture.exec,args, this.rpc_timeout);
-	     vresultSet.getMoreResults();
+	     vresultSet.getMoreResults(false);
 	   }
 	 catch(IOException e)
 	   {
@@ -261,7 +261,7 @@ public class VirtuosoPreparedStatement extends VirtuosoStatement implements Prep
 	     for (inx = 0; inx < size; inx++)
 	     {
 		 vresultSet.setUpdateCount (0);
-		 vresultSet.getMoreResults ();
+		 vresultSet.getMoreResults (false);
 		 res[inx] = vresultSet.getUpdateCount();
 	     }
 	   }
@@ -968,55 +968,40 @@ public class VirtuosoPreparedStatement extends VirtuosoStatement implements Prep
     * @exception virtuoso.jdbc2.VirtuosoException if a database access error occurs
     * @see java.sql.PreparedStatement#setString
     */
-   public void setString(int parameterIndex, String x1) throws VirtuosoException
+   public void setString(int parameterIndex, String x) throws VirtuosoException
    {
       // Check parameters
       if(parameterIndex < 1 || parameterIndex > parameters.capacity())
          throw new VirtuosoException("Index " +
 	     parameterIndex + " is not 1<n<" + parameters.capacity(),VirtuosoException.BADPARAM);
-      if(x1 == null)
+      if(x == null)
 	this.setNull(parameterIndex, Types.VARCHAR);
       else
 	{
-	  String x;
-//	  int zero_inx = x1.indexOf (0);
-	  /*
-	     if (zero_inx == -1)
-	     {
-	     char zeroc [] = { 0 };
-	     x = x1 + (new String (zeroc));
-	     }
-	     else */
-//	     if (zero_inx > 0 && zero_inx < x1.length())
-//	    {
-//	      //System.out.println ("truncate @ " + zero_inx);
-//	      x = x1.substring (0, zero_inx);
-//	    }
-//	  else
-	    x = x1;
 	  if (parameters != null && parameters.elementAt(parameterIndex - 1) instanceof openlink.util.Vector)
 	    {
 	      openlink.util.Vector pd = (openlink.util.Vector)parameters.elementAt(parameterIndex - 1);
 	      int dtp = ((Number)pd.elementAt (0)).intValue();
 	      VirtuosoExplicitString ret;
-	      ret = new
-		  VirtuosoExplicitString (x, dtp, connection);
+	      ret = new VirtuosoExplicitString (x, dtp, connection);
 	      objparams.setElementAt (ret, parameterIndex - 1);
 	    }
 	  else
+	    {
 	    objparams.setElementAt(x,parameterIndex - 1);
 	}
    }
+   }
 
-   protected void setString(int parameterIndex, VirtuosoExplicitString x1) throws VirtuosoException
+   protected void setString(int parameterIndex, VirtuosoExplicitString x) throws VirtuosoException
    {
      if(parameterIndex < 1 || parameterIndex > parameters.capacity())
        throw new VirtuosoException("Index " +
 	   parameterIndex + " is not 1<n<" + parameters.capacity(),VirtuosoException.BADPARAM);
-     if(x1 == null)
+     if(x == null)
        this.setNull(parameterIndex, Types.VARCHAR);
      else
-        objparams.setElementAt(x1, parameterIndex - 1);
+        objparams.setElementAt(x, parameterIndex - 1);
    }
    /**
     * Sets the designated parameter to a java.sql.Time value.  The driver converts this
diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoResultSet.java b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoResultSet.java
index 93238f1..9eb369e 100644
--- a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoResultSet.java
+++ b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoResultSet.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtuosoResultSet.java,v 1.4.2.7 2010/03/24 22:18:44 source Exp $
+ *  $Id: VirtuosoResultSet.java,v 1.4.2.8 2010/11/22 11:27:19 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -182,7 +182,7 @@ public class VirtuosoResultSet implements ResultSet
     * @param metaData   The metadata of the result. (It can be null)
     * @exception virtuoso.jdbc2.VirtuosoException An internal error occurred.
     */
-   VirtuosoResultSet(VirtuosoStatement statement, VirtuosoResultSetMetaData metaData) throws VirtuosoException
+   VirtuosoResultSet(VirtuosoStatement statement, VirtuosoResultSetMetaData metaData, boolean isPrepare) throws VirtuosoException
    {
       this.statement = statement;
       this.metaData = metaData;
@@ -199,7 +199,7 @@ public class VirtuosoResultSet implements ResultSet
       stmt_co_last_in_batch = false;
       //System.err.print ("init: rows :");
       //System.err.println (rows.toString());
-      process_result();
+      process_result(isPrepare);
       //System.err.print ("init: after process : rows :");
       //System.err.println (rows.toString());
    }
@@ -230,7 +230,7 @@ public class VirtuosoResultSet implements ResultSet
     *
     * @exception virtuoso.jdbc2.VirtuosoException An internal error occurred
     */
-   protected void getMoreResults() throws VirtuosoException
+   protected void getMoreResults(boolean isPrepare) throws VirtuosoException
    {
      synchronized (statement.connection)
        {
@@ -244,7 +244,7 @@ public class VirtuosoResultSet implements ResultSet
 	 else
 	   rows.removeAllElements();
 	 // One more time
-	 process_result();
+	 process_result(isPrepare);
 	 more_result = true;
 	 //System.err.print ("more_results: after process : rows :");
 	 //System.err.println (rows.toString());
@@ -326,11 +326,11 @@ public class VirtuosoResultSet implements ResultSet
 	    statement.future = statement.connection.getFuture(
 		VirtuosoFuture.extendedfetch,args, statement.rpc_timeout);
 
-	    getMoreResults();
+	    getMoreResults(false);
 	    // Remove future
 	    //statement.connection.removeFuture(statement.future);
 	    if (statement.connection.getAutoCommit())
-	      process_result();
+	      process_result(false);
 	  }
       }
       catch(IOException e)
@@ -364,7 +364,7 @@ public class VirtuosoResultSet implements ResultSet
 	      case VirtuosoTypes.SQL_DELETE:
 		  do
 		    {
-		      pstmt.vresultSet.getMoreResults();
+		      pstmt.vresultSet.getMoreResults(false);
 		    }
 		  while(!pstmt.vresultSet.isLastRow && isLastResult);
 		  rowIsDeleted = (pstmt.vresultSet.getUpdateCount() > 0);
@@ -378,7 +378,7 @@ public class VirtuosoResultSet implements ResultSet
 		    {
 		      // Reset some flags
 		      pstmt.vresultSet.is_complete = pstmt.vresultSet.more_result = false;
-		      pstmt.vresultSet.process_result();
+		      pstmt.vresultSet.process_result(false);
 		    }
 		  while(!pstmt.vresultSet.isLastRow && isLastResult);
 		  rowIsUpdated = (pstmt.vresultSet.getUpdateCount() > 0);
@@ -386,7 +386,7 @@ public class VirtuosoResultSet implements ResultSet
 	      case VirtuosoTypes.SQL_ADD:
 		  do
 		    {
-		      pstmt.vresultSet.getMoreResults();
+		      pstmt.vresultSet.getMoreResults(false);
 		    }
 		  while(!pstmt.vresultSet.isLastRow && isLastResult);
 		  rowIsInserted = (pstmt.vresultSet.getUpdateCount() > 0);
@@ -400,7 +400,7 @@ public class VirtuosoResultSet implements ResultSet
 		    {
 		      // Reset some flags
 		      pstmt.vresultSet.is_complete = pstmt.vresultSet.more_result = false;
-		      pstmt.vresultSet.process_result();
+		      pstmt.vresultSet.process_result(false);
 		    }
 		  while(pstmt.vresultSet.more_result());
 		  totalRows = pstmt.vresultSet.totalRows;
@@ -417,7 +417,7 @@ public class VirtuosoResultSet implements ResultSet
     *
     * @exception virtuoso.jdbc2.VirtuosoException An internal error occurred;
     */
-   private void process_result() throws VirtuosoException
+   private void process_result(boolean isPrepare) throws VirtuosoException
    {
       Object curr;
       openlink.util.Vector result;
@@ -519,7 +519,7 @@ public class VirtuosoResultSet implements ResultSet
 		  //more_result = true;
                   //mutexMetaData.freeSem();
                   // Check if it's a prepared statement
-                  if(statement instanceof PreparedStatement)
+                  if(statement instanceof PreparedStatement && isPrepare)
                   {
                      Object obj = v.elementAt(3);
                      statement.objparams = null;
@@ -550,7 +550,9 @@ public class VirtuosoResultSet implements ResultSet
 #endif
 		       }
 		     else
-		       statement.parameters = null;
+		       {
+		         statement.parameters = null;
+		       }
                   }
                   break;
                case VirtuosoTypes.QA_ROWS_AFFECTED:
@@ -2205,7 +2207,7 @@ public class VirtuosoResultSet implements ResultSet
 			   stmt_current_of = -1;
 			   stmt_co_last_in_batch = false;
 		       }
-		       process_result ();
+		       process_result (false);
 		       //System.err.print ("fetch: after process : rows :");
 		       //System.err.println (rows.toString());
 		   }
diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoStatement.java b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoStatement.java
index 6919033..dc1fd40 100644
--- a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoStatement.java
+++ b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoStatement.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtuosoStatement.java,v 1.5.2.4 2010/03/18 10:20:07 source Exp $
+ *  $Id: VirtuosoStatement.java,v 1.5.2.5 2010/11/22 11:27:19 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -254,7 +254,7 @@ public class VirtuosoStatement implements Statement
 		   // Put the options array in the args array
 		   args[5] = getStmtOpts();
 		   future = connection.getFuture(VirtuosoFuture.exec,args, this.rpc_timeout);
-		   return new VirtuosoResultSet(this,metaData);
+		   return new VirtuosoResultSet(this,metaData,false);
 	       }
 	       catch(IOException e)
 	       {
@@ -484,7 +484,7 @@ public class VirtuosoStatement implements Statement
 		   args[1] = new Long(future.hashCode());
 		   future.send_message(VirtuosoFuture.fetch,args);
 		   // ReArm the process
-		   vresultSet.getMoreResults();
+		   vresultSet.getMoreResults(false);
 		   return true;
 	       }
 	       catch(IOException e)
diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoTypes.java b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoTypes.java
index 998950a..b591634 100644
--- a/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoTypes.java
+++ b/libsrc/JDBCDriverType4/virtuoso/jdbc2/VirtuosoTypes.java
@@ -1,5 +1,5 @@
 /*
- *  $Id: VirtuosoTypes.java,v 1.6.2.3 2009/08/20 20:13:29 source Exp $
+ *  $Id: VirtuosoTypes.java,v 1.6.2.4 2011/03/23 12:01:46 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -239,6 +239,7 @@ class VirtuosoTypes
 
    public static final int DV_DATETIME = 211;
 
+   public static final int DV_ANY = 242;
    /*
     *  IRI
     */
diff --git a/libsrc/Makefile.in b/libsrc/Makefile.in
index 44e4ffb..ca8ebb9 100644
--- a/libsrc/Makefile.in
+++ b/libsrc/Makefile.in
@@ -203,6 +203,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/Thread/Makefile.in b/libsrc/Thread/Makefile.in
index f77e24e..b94aeb8 100644
--- a/libsrc/Thread/Makefile.in
+++ b/libsrc/Thread/Makefile.in
@@ -211,6 +211,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/Thread/thread_int.h b/libsrc/Thread/thread_int.h
index 50eaebb..a026d84 100644
--- a/libsrc/Thread/thread_int.h
+++ b/libsrc/Thread/thread_int.h
@@ -1,7 +1,7 @@
 /*
  *  thread_int.h
  *
- *  $Id: thread_int.h,v 1.6 2009/03/19 10:12:21 source Exp $
+ *  $Id: thread_int.h,v 1.6.2.1 2010/11/09 11:01:45 source Exp $
  *
  *  Thread internals
  *  
@@ -132,6 +132,9 @@ struct thread_s
   void *		thr_sql_scs;
   int                   thr_attached;
   caddr_t		thr_dbg;
+#ifndef NDEBUG
+  void *		thr_pg_dbg;
+#endif  
 };
 
 
diff --git a/libsrc/Tidy/Makefile.in b/libsrc/Tidy/Makefile.in
index d0564d5..c2ade91 100644
--- a/libsrc/Tidy/Makefile.in
+++ b/libsrc/Tidy/Makefile.in
@@ -190,6 +190,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/Wi/2pc.c b/libsrc/Wi/2pc.c
index 39c6089..9967381 100644
--- a/libsrc/Wi/2pc.c
+++ b/libsrc/Wi/2pc.c
@@ -1,7 +1,7 @@
 /*
  *  2pc.c
  *
- *  $Id: 2pc.c,v 1.15.2.15 2010/05/21 12:40:47 source Exp $
+ *  $Id: 2pc.c,v 1.15.2.17 2010/10/05 09:39:17 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -556,11 +556,6 @@ lt_2pc_prepare (lock_trx_t * lt)
   _2pc_printf (("lt_2pc_prepare\n"));
   lt->lt_status = LT_PREPARE_PENDING;
 
-  if (LTE_OK != lt_log_replication (lt))
-    {
-      rc = LTE_LOG_FAILED;
-      goto failed;
-    }
 
   LEAVE_TXN;
   mutex_enter (log_write_mtx);
@@ -612,7 +607,6 @@ lt_2pc_commit (lock_trx_t * lt)
   lt->lt_status = LT_COMMITTED;
 
   log_final_transact (lt, 1);
-  lt_send_repl_cast (lt);
   if (lt->lt_mode == TM_SNAPSHOT)
     {
       lt_close_snapshot (lt);
@@ -1390,7 +1384,7 @@ virt_xa_set_client (void *xid, struct client_connection_s *cli)
 	  return rc;
 #else
 	  mutex_leave (global_xa_map->xm_mtx);
-	  return VXA_AGAIN;
+	  return VXA_ERROR;
 #endif
 	}
     }
diff --git a/libsrc/Wi/CLIodbc3.c b/libsrc/Wi/CLIodbc3.c
index a9d5e07..0376f9b 100644
--- a/libsrc/Wi/CLIodbc3.c
+++ b/libsrc/Wi/CLIodbc3.c
@@ -1,7 +1,7 @@
 /*
  *  CLIodbc3.c
  *
- *  $Id: CLIodbc3.c,v 1.26.2.2 2010/07/06 09:58:07 source Exp $
+ *  $Id: CLIodbc3.c,v 1.26.2.4 2011/03/04 14:46:59 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -717,12 +717,10 @@ virtodbc__SQLGetStmtAttr (SQLHSTMT statementHandle,
     SQLINTEGER BufferLength,
     SQLINTEGER * StringLengthPtr)
 {
-  SQLINTEGER dummy;
+  SQLLEN dummy = 0;
   STMT (stmt, statementHandle);
-
   if (!stmt)
     return (SQL_INVALID_HANDLE);
-
   if (!ValuePtr)
     ValuePtr = &dummy;
 
@@ -1336,6 +1334,7 @@ get_rdf_literal_prop (cli_connection_t * con, SQLSMALLINT ftype, short key)
     }
   else
     ret = gethash ((void *)(ptrlong) key, ht);
+  LEAVE_CON (con);
 
   if (!ret) /* not in cache */
     {
@@ -1351,7 +1350,6 @@ get_rdf_literal_prop (cli_connection_t * con, SQLSMALLINT ftype, short key)
       rc = virtodbc__SQLAllocHandle (SQL_HANDLE_STMT, con, &hstmt);
       if (rc != SQL_SUCCESS)
 	{
-	  LEAVE_CON (con);
 	  return NULL;
 	}
       rc = virtodbc__SQLBindParameter (hstmt, 1, SQL_PARAM_INPUT, SQL_C_SSHORT,
@@ -1370,12 +1368,13 @@ get_rdf_literal_prop (cli_connection_t * con, SQLSMALLINT ftype, short key)
       if (SQL_SUCCESS != rc)
 	goto err_cleanup;
       ret = box_dv_short_string (buf);
+      IN_CON (con);
       sethash ((void*)(ptrlong)key, ht, (void*) ret);
+      LEAVE_CON (con);
 err_cleanup:
       virtodbc__SQLFreeStmt (hstmt, SQL_CLOSE);
       virtodbc__SQLFreeHandle (SQL_HANDLE_STMT, (SQLHANDLE) hstmt);
     }
-  LEAVE_CON (con);
   return ret;
 }
 
diff --git a/libsrc/Wi/CLIsql1.c b/libsrc/Wi/CLIsql1.c
index b4d4d18..596ef28 100644
--- a/libsrc/Wi/CLIsql1.c
+++ b/libsrc/Wi/CLIsql1.c
@@ -1,7 +1,7 @@
 /*
  *  CLIsql1.c
  *
- *  $Id: CLIsql1.c,v 1.22.2.8 2010/07/09 15:29:31 source Exp $
+ *  $Id: CLIsql1.c,v 1.22.2.9 2010/09/21 11:20:07 source Exp $
  *
  *  Client API
  *
@@ -727,11 +727,8 @@ ssl_get_password (char * name, char *tpass)
 }
 #endif
 
-
 #ifdef INPROCESS_CLIENT
 
-#include "sqlnode.h"
-
 static void *
 get_inprocess_client ()
 {
@@ -1846,11 +1843,11 @@ virtodbc__SQLFreeStmt (SQLHSTMT hstmt, SQLUSMALLINT fOption)
 
       if (stmt->stmt_bookmarks)
 	stmt_free_bookmarks (stmt);
-
       if (stmt->stmt_future)
 	PrpcFutureFree (stmt->stmt_future);
-
+      IN_CON (stmt->stmt_connection);
       dk_set_delete (&stmt->stmt_connection->con_statements, (void *) stmt);
+      LEAVE_CON (stmt->stmt_connection);
       stmt_free_current_rows (stmt);
       dk_free_tree (stmt->stmt_prefetch_row);
       stmt->stmt_prefetch_row = NULL;
diff --git a/libsrc/Wi/CLIsql2.c b/libsrc/Wi/CLIsql2.c
index 45fda07..a78ba0f 100644
--- a/libsrc/Wi/CLIsql2.c
+++ b/libsrc/Wi/CLIsql2.c
@@ -1,7 +1,7 @@
 /*
  *  CLIsql2.c
  *
- *  $Id: CLIsql2.c,v 1.21.2.3 2010/07/06 14:24:06 source Exp $
+ *  $Id: CLIsql2.c,v 1.21.2.5 2011/03/02 12:24:08 source Exp $
  *
  *  Client API, ODBC Extensions
  *
@@ -36,6 +36,7 @@
 
 /* #include <transact.h>
 #include "mts_client.h"*/
+#define IN_ODBC_CLIENT
 #include "wi.h"
 #include "msdtc.h"
 #include "2pc.h"
@@ -4449,16 +4450,16 @@ virtodbc__SQLForeignKeys (
       _szFkTableQualifier[KUBL_IDENTIFIER_MAX_LENGTH],
       _szFkTableOwner[KUBL_IDENTIFIER_MAX_LENGTH], _szFkTableName[KUBL_IDENTIFIER_MAX_LENGTH];
 
-  if (!szFkTableQualifier)
-    {
-      szFkTableQualifier = (SQLCHAR *) qual;
-      cbFkTableQualifier = SQL_NTS;
-    }
-
   if (!szPkTableQualifier)
     {
       szPkTableQualifier = (SQLCHAR *) qual;
       cbPkTableQualifier = SQL_NTS;
+
+      if (!szFkTableQualifier)
+        {
+          szFkTableQualifier = (SQLCHAR *) qual;
+          cbFkTableQualifier = SQL_NTS;
+        }
     }
 
   BIND_NAME_PART (hstmt, 1, szPkTableQualifier, _szPkTableQualifier, cbPkTableQualifier, l1);
diff --git a/libsrc/Wi/CLIuti.c b/libsrc/Wi/CLIuti.c
index f63f0de..0e02a1f 100644
--- a/libsrc/Wi/CLIuti.c
+++ b/libsrc/Wi/CLIuti.c
@@ -1,7 +1,7 @@
 /*
  *  CLIuti.c
  *
- *  $Id: CLIuti.c,v 1.35.2.3 2010/07/06 14:24:06 source Exp $
+ *  $Id: CLIuti.c,v 1.35.2.5 2010/12/20 18:09:05 source Exp $
  *
  *  Auxiliary functions for the ODBC driver
  *
@@ -31,8 +31,10 @@
 #include <wchar.h>
 #endif
 
+#define IN_ODBC_CLIENT
 #include "wi.h"
 
+
 caddr_t
 stmt_param_place_ptr (parm_binding_t * pb, int nth, cli_stmt_t * stmt,
     SQLULEN length)
@@ -208,6 +210,9 @@ dv_to_sql_type (dtp_t dv, int cli_binary_timestamp)
     case DV_INT64:
       return SQL_INTEGER;
 
+    case DV_IRI_ID:
+      return SQL_VARCHAR;
+
     default:
       return SQL_VARCHAR;
     }
@@ -1000,7 +1005,7 @@ con_make_current_ofs (cli_connection_t * con, cli_stmt_t * stmt)
 {
   dk_set_t res = NULL;
   caddr_t arr;
-
+  IN_CON (con);
   DO_SET (cli_stmt_t *, cr, &con->con_statements)
   {
     if (cr->stmt_compilation
@@ -1011,10 +1016,9 @@ con_make_current_ofs (cli_connection_t * con, cli_stmt_t * stmt)
       }
   }
   END_DO_SET ();
-
+  LEAVE_CON (con);
   arr = (caddr_t) dk_set_to_array (res);
   dk_set_free (res);
-
   return arr;
 }
 
@@ -3525,6 +3529,9 @@ col_desc_get_display_size (col_desc_t *cd, int cli_binary_timestamp)
 	  return 8;
       }
 
+    case DV_IRI_ID:
+	return 23; /* i# + 20 digits precision */
+
     default:
       return SQL_NO_TOTAL;
     }
diff --git a/libsrc/Wi/ChangeLog b/libsrc/Wi/ChangeLog
deleted file mode 100644
index 92a3848..0000000
--- a/libsrc/Wi/ChangeLog
+++ /dev/null
@@ -1,10877 +0,0 @@
-2010-06-24 17:31  source
-
-	* http_client.c: * Fixed check proxy and remove if host is an exception
-
-2010-06-24 17:13  source
-
-	* http_client.c: * Fixed check proxy and remove if host is an exception
-
-2010-06-24 10:20  source
-
-	* http.c: * Fixed listener serialization
-	* Fixed hash
-
-2010-06-24 10:05  source
-
-	* http.c: * Merged from V6
-
-2010-06-23 00:54  source
-
-	* url_rewrite.sql: * Merged from V6
-
-2010-06-22 17:50  source
-
-	* rdfxml_parser.c: * Fixed rdfa failing to parse both rel/rev
-
-2010-06-22 17:50  source
-
-	* users.sql: * Fixed normalize_modulus
-
-2010-06-18 13:08  source
-
-	* http.c, url_rewrite.sql: * Fixed url rewrite should happen before parsing parameters in order
-	  to check if we are dealing with php or proxy page when we use raw
-	  request body
-
-2010-06-12 14:59  source
-
-	* sparql_core.c: * Fixed do not free on SQL_SUCCESS, as this will be done at end of loop
-
-2010-06-12 14:57  source
-
-	* bif_soap.c, virtual_dir.sql: * Fixed do not explicitly set header if it is already set; in proxy
-	  remove content-type as it will be set from sparql
-
-2010-06-11 14:48  source
-
-	* http.c: * Fixed bad condition check
-
-2010-06-10 20:46  source
-
-	* obackup.c: * Fixed fd can be 0 in background mode
-
-2010-06-09 15:24  source
-
-	* auxfiles.c, wifn.h: * Merged from V6
-
-2010-06-09 15:23  source
-
-	* hash.c: * Fixed must return a failed ctx to itc e.g. on out of space case
-
-2010-06-09 14:30  source
-
-	* extent.c, wifn.h: * Added check for automatic repair
-	* Fixed when taking a dp from extent map, must decrease the free
-	  pages accordingly
-
-2010-06-09 12:15  source
-
-	* system.sql: * Fixed VDB/DB2 stats procedure
-
-2010-06-07 15:27  source
-
-	* virtual_dir.sql: * Fixed use explicit format if supplied
-
-2010-06-07 15:26  source
-
-	* sparql.sql: * Fixed ODATA feed title locality
-
-2010-06-01 17:26  source
-
-	* rdfbox.c, sparql.sql, sparql2sqltext.c, sparql_io.sql: * Added support for odata/json in describe and construct
-
-2010-05-31 22:47  source
-
-	* rltrx.c: * Fixed incomplete check condition as locks with pos at end do not
-	  count
-
-2010-05-31 22:45  source
-
-	* sparql.sql: * Fixed use request line for ID
-
-2010-05-31 13:08  source
-
-	* rdfbox.c, sparql.sql, sparql2sqltext.c, sparql_io.sql: * Added initial support for OData atom serialization
-	* Use CBG describe for OData format
-	* Use EMD types for generic types
-
-2010-05-31 13:00  source
-
-	* auxfiles.c, extent.c: * Added option DensePageAllocation which offers up some near page
-	  locality so resulting db uses less disk space
-
-2010-05-31 13:00  source
-
-	* sparql.sql: * Fixed issue with ?? with sparql compiler inside sql query
-
-2010-05-25 13:30  source
-
-	* system2.sql: * Fixed bug in b32 decode
-
-2010-05-25 13:30  source
-
-	* http.c: * Merged from V6
-
-2010-05-25 00:36  source
-
-	* bif_file.c: * Fixed memleak
-
-2010-05-24 20:02  source
-
-	* rdfinf.c, rdfinf.h, sparql.sql, sparql2sqltext.c: * Added improvements in inference handling
-	* FIxed support for subproperties of inverse functional properties
-	* Fixed support for loading aaa ruleset from multiple contology graphs
-
-2010-05-22 21:18  source
-
-	* bif_file.c: * Added support for gunzip session
-
-2010-05-21 14:40  source
-
-	* 2pc.c, auxfiles.c, bif_file.c, disk.c, http.c, log.c, obackup.c,
-	  recovery.c, replsri.c, sqlbif.c, wiservic.c: * Fixed checking return code from fd_open call
-
-2010-05-21 14:27  source
-
-	* system2.sql: * Added automatic error correction for some common typos in
-	  decode_b32_num
-
-2010-05-21 14:26  source
-
-	* lock.c, log.c, wifn.h: * Fixed when doing log replay, we should remove old roots to free
-	  memory as at this time the grim reaper is not available
-
-2010-05-21 14:24  source
-
-	* http.c: * Fixed allow reset of xslt in PP hook
-
-2010-05-19 12:19  source
-
-	* system2.sql: * Merged b32 encoding/decoding from HEAD
-
-2010-05-18 11:08  source
-
-	* sqlo.c: * Fixed when statement has implicit group by, do not remove order by
-
-2010-05-17 10:21  source
-
-	* xslt.c: * Fixed error messages
-
-2010-05-17 10:21  source
-
-	* search.c: * Fixed wrong dv_compare on boxes with box flags
-
-2010-05-16 19:54  source
-
-	* rdf_sponge.sql, sparql.sql: * Merged RDFa only patch from v6
-
-2010-05-16 19:54  source
-
-	* http.c, http.h: * Merged http proxy patches from v6
-
-2010-05-13 21:38  source
-
-	* url_rewrite.sql: * Fixed do not decode anything. We just match what is in and print
-	  it out, if source is bad encoded, the result is bad encoded,
-	  otherwise can not figure-out what was it before and what should
-	  be after, so we keep it simple
-
-2010-05-12 14:24  source
-
-	* blob.c, log.c, log.h, regist.c, replsri.c: * Fixed use special cl_non_logged_write_mode used to load extrememly
-	  large datasets needs to ensure no log will be made at all. If one
-	  node dies, the rest will do same. Use this flag only in safe
-	  environment
-
-2010-05-12 14:17  source
-
-	* sparul2sql.c: * Fixed GPF in SPARUL INSERT optimization that happens when an
-	  auxiliary retval with vector of variables is wrapped in alias
-
-2010-05-12 14:16  source
-
-	* disk.c, obackup.c, srvstat.c, wifn.h: * Fixed when looking at free set from disk must stop at last, as
-	  the dbs pages can be out of sync. Do this only when reading from
-	  disk otherwise error
-
-2010-05-11 18:53  source
-
-	* rdf_sponge.sql, sparql.sql: * Added option to skip sponger and do RDFa along with other rdf
-	  formats
-
-2010-05-10 11:39  source
-
-	* system.sql: * Fixed keep dashes in words and use escape whenever it occurs;
-	  words starting with numbers should also be escaped
-
-2010-05-07 11:14  source
-
-	* rdfbox.c, sparql2sqltext.c, sqlbif.c, widv.h, xslt.c: * Added new bifs for graph diff functionality, iteration over
-	 dictionary and obtaining biggest possible IRI_ID on 32/64bit
-	 platforms
-
-2010-05-03 21:31  source
-
-	* http.c, http.h: * Added support for logging x-forwarded-for when instance is using
-	  a proxy
-
-2010-05-03 10:54  source
-
-	* sqlbif.c: * Added shortcut for debugging variables
-
-2010-04-29 12:54  source
-
-	* sparql.sql: * Fixed cleaning new schema properly
-
-2010-04-28 17:21  source
-
-	* system.sql: * Fixed if Host header is present use that, and do not add port as may be
-	  behind proxy
-
-2010-04-26 16:41  source
-
-	* sqlexp.c: * Fixed when a signal error arrives, pop the bad instruction so the
-	  free is not confused by dk_set when IS_NULL
-
-2010-04-23 22:03  source
-
-	* meta.c: * Fixed do not continue when missing part of key, as it is uninitialized
-	  and needs to be dropped before causing a gpf
-
-2010-04-23 22:02  source
-
-	* hash.c: * Fixed only serialize box flags for dependant part
-
-2010-04-22 13:12  source
-
-	* url_rewrite.sql: * Fixed http header ends with proper CRLF sequence
-
-2010-04-21 18:18  source
-
-	* sqlrcomp.c: * Fixed when doing something that may reference the control_exp
-	  private elements set the so_df_private_elts, otherwise may get a
-	  new df which is in global so df hash
-
-2010-04-21 14:44  source
-
-	* sqlexp.c: * Fixed treat sort read node like a ts in tracking ssl refs, else
-	  partitioned top oby goes wrong
-
-2010-04-20 21:24  source
-
-	* hash.c: * Fixed when gby serialize box flag if any
-
-2010-04-18 01:23  source
-
-	* hash.c: * Fixed can have uninitialized null flag in hash temp; can be extra
-	  nulls in gby or hash join
-
-2010-04-15 16:05  source
-
-	* sqlbif.c: * Fixed memleak when error in bif and no error var given
-
-2010-04-15 16:03  source
-
-	* sqlsrv.c: * Fixed memleak when client drops conneciton before prepare
-
-2010-04-15 14:32  source
-
-	* sqlsrv.c: * Fixed leak when client drops connection before prepare
-
-2010-04-15 14:30  source
-
-	* sqlbif.c: * Fixed memleak when error and no var given
-
-2010-04-14 15:48  source
-
-	* security.h: * Fixed export check to call in plugins
-
-2010-04-14 15:19  source
-
-	* security.h: * Fixed export check to call in plugins
-
-2010-04-12 21:42  source
-
-	* url_rewrite.sql: * Added possibility to do URL encoding in TCN rules
-
-2010-04-12 14:37  source
-
-	* url_rewrite.sql: * Fixed use UTF-8 as source and dest charsets when doing urls
-
-2010-04-12 09:28  source
-
-	* xqf.c: * Fixed check for third argument
-
-2010-04-09 16:43  source
-
-	* sqlgen.c: * Fixed if we got a single ts as first and it is outer, put a dummy in
-	  front
-
-2010-04-08 16:31  source
-
-	* bif_file.c, system.sql: * Added CSV parser lax mode
-	* Fixed log errors from loading
-
-2010-04-08 16:30  source
-
-	* bif_file.c, system.sql: * Added CSV parser lax mode
-	* FIxed log errors from loading
-
-2010-04-07 23:41  source
-
-	* sqlcomp2.c: * Fixed memleak
-
-2010-04-07 21:25  source
-
-	* sqlcomp2.c: * Fixed memleak
-
-2010-04-07 21:25  source
-
-	* disk.c: * Fixed release it_maps as it is allocated dynamic
-
-2010-04-07 09:56  source
-
-	* rdfbox.c: * Fixed wrong TTL output of CONSTRUCT of wierd IRIs
-
-2010-04-07 09:55  source
-
-	* rdfbox.c: * FIxed wrong TTL output of CONSTRUCT of weird IRIs
-
-2010-04-06 17:25  source
-
-	* bif_file.c, system.sql: * Added support for getting list of files from zip file
-	* Added support for encodings in CSV line-by-line parser
-	* Fixed memory leak
-
-2010-04-06 16:43  source
-
-	* sqlcost.c: * Fixed find const iri when nested call of i2id is used
-
-2010-04-06 14:16  source
-
-	* bif_file.c: * Added support for listing content of zip file
-	* Fixed memleak in unzip_file
-
-2010-04-01 00:30  source
-
-	* http_client.c, http_client.h, system.sql: * Fixed insecure https client connections
-	* Fixed memleaks on connection error
-
-2010-04-01 00:07  source
-
-	* http_client.c, http_client.h, system.sql: * Fixed insecure https client connections
-	* Fixed memleaks on connection error
-
-2010-04-01 00:06  source
-
-	* bif_file.c: * Fixed no value is null
-
-2010-04-01 00:03  source
-
-	* bif_file.c: * Fixed empty strings are nulls
-
-2010-03-30 13:10  source
-
-	* sqlver.h: * Updated version number
-
-2010-03-29 15:37  source
-
-	* system.sql: * Fixed skip identity columns
-
-2010-03-29 15:27  source
-
-	* system.sql: * Fixed skip IDN cols
-
-2010-03-29 10:16  source
-
-	* bif_file.c, system.sql: * Added CSV parser options
-
-2010-03-26 20:35  source
-
-	* bif_file.c, system.sql: * Added options to CSV parser for delimiter and quote char
-
-2010-03-26 17:10  source
-
-	* bif_file.c, system.sql: * Added CSV parser
-
-2010-03-25 20:31  source
-
-	* system.sql: * Added csv_parse function
-
-2010-03-24 23:21  source
-
-	* bif_file.c, system.sql: * Added support for reading CSV files into tables
-
-2010-03-24 17:43  source
-
-	* sparql.sql: * Fixed typo
-
-2010-03-24 11:23  source
-
-	* http.c, sparql_io.sql: * Added options for /sparql
-	* Added function http_header_array_get to retrieve headers as an
-	  array of strings
-
-2010-03-24 02:03  source
-
-	* sparql.sql, sparql2sql.h, sparql2sqltext.c, sparql_io.sql,
-	  sparqld.c: * Added optimization of sprintf_inverse(const)
-
-2010-03-24 02:02  source
-
-	* sqlinx.c: * Fixed save the jt before doing ts; this is needed because ic_after_pos
-	  expects in jt but because of in_list it can be modified
-
-2010-03-24 02:00  source
-
-	* sqldf.c: * Fixed compiler warning
-
-2010-03-23 11:07  source
-
-	* sqldf.c: * Fixed use globally known dfe for a select even in cond exp, else it
-	  ruins the dt by repeatedly adding the same items when making a second
-	  dfe for the same select
-
-2010-03-23 11:04  source
-
-	* sparql2sql.c: * Fixed incorrect codegen of formatter in ssg_select_known_graphs_codegen
-
-2010-03-23 11:01  source
-
-	* sparql2sql.c: * Fixed incorrect codegen of formatter in ssg_select_known_graphs_codegen
-
-2010-03-22 17:11  source
-
-	* sparql_io.sql: * Fixed do not encode default graph
-
-2010-03-22 17:09  source
-
-	* users.sql: * Added FOAF+SSL login for SQL clients
-
-2010-03-22 14:45  source
-
-	* http.c: * Fixed use sk_X509_ALGOR_* macros
-
-2010-03-22 14:40  source
-
-	* http.c: * Fixed use sk_X509_ALGOR_* macros
-
-2010-03-22 13:35  source
-
-	* users.sql: * Added support for FOAF+SSL login for SQL connections
-
-2010-03-22 12:54  source
-
-	* sparql_io.sql: * Fixed do not encode default graph
-
-2010-03-22 12:54  source
-
-	* sparql.h, sparql_l.l, sparql_p.y: * Fixed SPARQL 1.1 compatibility in result set syntax
-
-2010-03-19 11:08  source
-
-	* sparql.sql, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  xmltree.h, xslt.c: * Added improved version of xsl:for-each-row for both SPARQL and SQL
-
-2010-03-19 11:05  source
-
-	* log.c: * FIxed issue with backup
-
-2010-03-18 16:45  source
-
-	* 2pc.c: * Fixed when transaction is prepared but not committed before commit
-	  we must check if cpt is pending. If so we must wait as xa trx has
-	  special processing in cpt_rollback and log_cpt
-	* Fixed compiler warning
-
-2010-03-18 16:43  source
-
-	* rltrx.c: * Fixed better serialization on lt_lock_mtx
-
-2010-03-18 11:59  source
-
-	* log.c: * Fixed enter mtx before truncating log
-	* Fixed when a 2pc transaction as finished, invalidate its commit
-	  flag offset since the log is rewritten already. The trx must already
-	  be in cpt state.
-
-2010-03-17 00:53  source
-
-	* sqlsrv.c: * Fixed check lt
-
-2010-03-16 19:58  source
-
-	* sqlsrv.c: * Fixed check if lt present
-
-2010-03-16 19:21  source
-
-	* sqlsrv.c: * Fixed when txn error remove trx from global pool. It cannot be
-	  committed anyway
-
-2010-03-16 19:20  source
-
-	* 2pc.c: * Fixed properly set lt_threads
-
-2010-03-16 19:15  source
-
-	* sqlsrv.c: * Fixed when killed during the cpt, remove trx from global pool,
-	  cannot commit anyway
-
-2010-03-16 15:04  source
-
-	* 2pc.c: * Fixed when doing xa commit set the lt_threads properly
-
-2010-03-16 13:57  source
-
-	* log.c: * Fixed enter log mtx when writing byte order and version checks
-
-2010-03-16 12:39  source
-
-	* log.c: * Fixed when writing log entries always check the mtx
-
-2010-03-16 12:39  source
-
-	* 2pc.c: * Fixed when setting up a XA trx wait for any checkpoint in progress
-	  to finish before proceeding
-
-2010-03-16 11:54  source
-
-	* sqlgen.c: * Fixed if not box or dfe false, skip rest
-
-2010-03-15 17:46  source
-
-	* 2pc.c: * Fixed resume waiting
-
-2010-03-15 16:51  source
-
-	* meta.c: * Fixed check array index not out of bound
-
-2010-03-15 14:16  source
-
-	* neodisk.c: * Fixed missing case for LT_PREPARE_PENDING
-
-2010-03-10 21:28  source
-
-	* virtual_dir.sql: * Fixed JSON support
-
-2010-03-10 11:34  source
-
-	* sqlbif.c: * Fixed allow nulls, DV_C_STRING and memleak
-
-2010-03-10 11:32  source
-
-	* sqlbif.c: * Fixed arg check and memleak
-
-2010-03-09 21:14  source
-
-	* sqlbif.c: * Added support for nvarchar to __like_min and __like_max
-
-2010-03-09 21:12  source
-
-	* sqlgen.c: * Fixed possible dfe_false in context
-
-2010-03-08 15:20  source
-
-	* http_client.c: * Fixed allow chunked content to be read as strses
-
-2010-03-08 15:18  source
-
-	* http_client.c: * Merged fixes from v6
-
-2010-03-08 13:10  source
-
-	* sqlbif.c: * Added support for nvarchar to set_qualifier
-
-2010-03-08 13:04  source
-
-	* bif_file.c, bif_text.c, bif_xper.c, bitmap.c, bitmap.h, blob.c,
-	  ddlrun.c, disk.c, eqlcomp.c, extent.c, gate.c, hash.c, inxop.c,
-	  ksrvext.h, lock.c, mtwrite.c, rdf_core.h, rdf_sponge.sql,
-	  rdfbox.c, rdfxml_parser.c, rltrx.c, search.c, soap.sql, space.c,
-	  sparql2sql.c, sparql2sql.h, sparql2sqltext.c, sparql_core.c,
-	  sqlbif.c, sqlbif2.c, sqlcomp2.c, sqldf.c, sqlgen.c, sqlnode.h,
-	  sqloby.c, sqlrun.c, sqlsrv.c, sqltype.c, update.c, wi.h,
-	  xmltree.h: * Fixed typos
-
-2010-03-08 13:02  source
-
-	* bif_audio.c: * Fixed typo in tag MusicianCreditsList
-
-2010-03-08 13:01  source
-
-	* rdf_schema_objects.sql: * Fixed typo in scovo:dimension
-
-2010-03-08 12:54  source
-
-	* sqlbif.c: * Added wide char support to set_qualifier
-
-2010-03-08 12:53  source
-
-	* http_client.c: * Fixed issue when no content len is give but content is sent as
-	  http/1.0 protocol e.g. with connection-close
-
-2010-03-08 10:21  source
-
-	* rdf_schema_objects.sql: * Fixed typo in scovo:dimension
-
-2010-03-07 09:20  source
-
-	* ltrx.h, rltrx.c, search.c, sparql.h, sparql2sql.c, sparql_p.y,
-	  sqlcost.c, xmltree.h: * Fixed typo
-	 CVS: ----------------------------------------------------------------------
-
-2010-03-07 09:18  source
-
-	* sparql2sqltext.c, sparqld.c: * Fixed SERVICE parameter passing
-	* Fixed (!ask(...)) in filters
-
-2010-03-05 00:44  source
-
-	* sparql2sqltext.c: * Fixed improved codegen for FILTER (?local = IRI(?:global)) .
-
-2010-03-05 00:43  source
-
-	* datesupp.c: * Added support for fractions of second in bif_dateadd
-
-2010-03-04 17:39  source
-
-	* 2pc.c, 2pc.h, lock.c, sqlsrv.c: * Fixed memory leaks
-	* Fixed read memory after free
-	* Fixed when one connection does prepare and then uses another
-	  connection to commit/rollback, must reset 1st cli's trx
-	* Fixed when writing to log enter mutex to avoid concurrent writing
-
-2010-03-04 15:46  source
-
-	* 2pc.c, sqlsrv.c: * Fixed when one connection does a prepare and then uses another
-	  connection to commit/rollback, must reset 1st cli's trx
-
-2010-03-04 14:40  source
-
-	* sqlsrv.c: * Fixed use trx mtx
-
-2010-03-04 14:31  source
-
-	* 2pc.c, 2pc.h, sqlsrv.c: * Fixed reading possibly freed memory
-	* Fixed when writing to log enter log_write_mtx to avoid concurrent
-	  writing
-
-2010-03-04 13:23  source
-
-	* 2pc.c, 2pc.h, sqlsrv.c: * Fixed possible read of free memory, as lt_2pc._2pc_xid can be released
-	  on one thread and xa_prep_log to look in tpd_trx_cookie on the TP
-	  thread
-
-2010-03-03 23:55  source
-
-	* http.c: * Fixed do not setup unknown for special methods
-
-2010-03-03 21:34  source
-
-	* 2pc.c, sqlsrv.c: * Fixed memory leaks
-
-2010-03-03 12:17  source
-
-	* 2pc.c: * Fixed mem leak
-	* Fixed read after free
-
-2010-03-02 23:00  source
-
-	* 2pc.c, sqlsrv.c: * Fixed memory leaks
-
-2010-03-02 20:34  source
-
-	* 2pc.c: * Fixed remove id from hash before free structure
-
-2010-03-02 15:46  source
-
-	* http.c, http.h, http_client.c, http_client.h: * Added OPTIONS for http server
-
-2010-03-02 11:01  source
-
-	* http.c, http.h, http_client.c, http_client.h: * Added OPTIONS support for http server
-
-2010-03-01 22:05  source
-
-	* rdfbox.c, sparql.h, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_io.sql, sparql_l.l,
-	  sparql_p.y, sparql_tree.c, sparqld.c, sparul2sql.c: * Added initial support for basic SPARQL federation
-
-2010-03-01 21:46  source
-
-	* sparql.sql: * Added DefaultServiceMap and DefaultServiceStorage
-
-2010-03-01 21:42  source
-
-	* sparql_l.l: * Fixed support for positional and named parameters from exec() or
-	  similar in SPARQL, as if they where global variables of other
-	  sorts
-
-2010-03-01 02:03  source
-
-	* xmltree.c, xmltree.h: * Added immortal IRI for uname_virtrdf_ns_uri_DefaultServiceStorage
-
-2010-03-01 02:01  source
-
-	* bif_file.c: * Added support for unzip_file ()
-
-2010-02-27 23:21  source
-
-	* aqueue.c: * Fixed diagnosics of async_queue specific errors like aq invocation
-	  on log replay or security issues
-
-2010-02-26 18:31  source
-
-	* sparql_tree.c: * Fixed missing label
-
-2010-02-26 18:28  source
-
-	* meta.c, recovery.c, row.c, update.c, wifn.h: * Fixed use union for local automatic variables to avoid alignment
-	  problems
-
-2010-02-25 13:00  source
-
-	* lock.c, wifn.h: * Fixed external
-
-2010-02-24 21:55  source
-
-	* sparql.sql, sparql2sql.c, sparql2sqltext.c, sparql_io.sql: * Added proper ASK support in web service endpoing
-	* Fixed faster loading of inference sets
-	* Fixed loading of inference sets from graph groups, not only from
-	  single graphs
-	* Fixed creation of graph groups on cluster
-
-2010-02-24 21:53  source
-
-	* http.c, lock.c, wifn.h: * Added swap guard to kill trx and log ws when swapping is over 300 pages
-
-2010-02-24 14:02  source
-
-	* widisk.h: * Fixed use unsigned for lower parts else we risk sign extent on large
-	  numbers
-
-2010-02-23 15:50  source
-
-	* sqlinx.c: * Fixed when looking at col_preds and seeking for column, make sure cp
-	  dfe is a column
-
-2010-02-23 15:49  source
-
-	* wifn.h: * Added prototype
-
-2010-02-23 15:49  source
-
-	* page.c: * Fixed when unbox iri make sure value is of type DV_IRI_ID
-
-2010-02-23 15:48  source
-
-	* auxfiles.c: * FIxed 2pc file name does not change with log file if log trail on
-
-2010-02-23 11:44  source
-
-	* sparql.h, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_tree.c, sparqld.c: * Fixed rewriting of group patterns with filters replaced with restrictions on
-	  equivs
-
-2010-02-23 11:21  source
-
-	* sqldf.c: * Fixed stop compilation where comp time over run time
-
-2010-02-19 01:22  source
-
-	* log.c: * Fixed when doing a log replay, mark prepared XA trx as such
-
-2010-02-19 01:22  source
-
-	* bif_file.c, log.c, obackup.c: * Fixed more macros for 64bit fs
-
-2010-02-18 22:37  source
-
-	* bif_file.c, log.c, neodisk.c, obackup.c, recovery.c, replsr.h: * Use macros for file calls for 64bit fs
-
-2010-02-18 22:36  source
-
-	* 2pc.c, log.c, ltrx.h, neodisk.c, sqlsrv.c: * Merged XA fixes from HEAD
-
-2010-02-18 21:46  source
-
-	* sqlbif.c: * FIxed mem leak
-
-2010-02-18 21:24  source
-
-	* rdf_core.c: * Fixed mem leak
-
-2010-02-18 18:01  source
-
-	* sqlbif.c: * Fixed memory leak
-
-2010-02-18 15:33  source
-
-	* 2pc.c, blobio.c, rltrx.c, security.c, shuric.c, sparql2sqltext.c,
-	  sparql_core.c, sparql_p.y: * Fixed compiler warnings
-
-2010-02-18 15:30  source
-
-	* rdf_sponge.sql: * Fixed detection of n3 and nt formats
-
-2010-02-18 15:29  source
-
-	* sqlo.c: * Merged back from V6
-
-2010-02-18 15:29  source
-
-	* sqlsrv.c: * Fixed when starting new XA transaction and client has one already,
-	  we leave old and make new for the new xid
-
-2010-02-18 15:13  source
-
-	* rdfbox.c: * Fixed if avail always use ro_id for hash
-
-2010-02-18 15:12  source
-
-	* sqlrcomp.c: * Fixed text for NOT pred
-
-2010-02-18 11:57  source
-
-	* bif_explain.c, map_schema.c, name.c, sqlcomp.c, sqlcost.c,
-	  sqlcr.c, sqldf.c, sqlexp.c, sqlgen.c, sqlinx.c, sqlo.c, sqlo.h,
-	  sqloby.c, sqlocr.c, sqloinv.c, sqlparext.h, sqlpfn.c, sqlrcomp.c,
-	  sqltype.c, sqlview.c, xmlsql.c, xpath.c: * Fixed use separate macro for COL_DOTTED
-
-2010-02-17 23:06  source
-
-	* sqloby.c: * Fixed order must be greater than 0
-
-2010-02-17 17:58  source
-
-	* sqlo.c: * Fixed remove null in gby as it is not needed
-	* Fixed jts to check for call
-
-2010-02-17 17:56  source
-
-	* bif_soap.c: * Fixed do not print default port for http and https in urls
-
-2010-02-16 16:03  source
-
-	* sqldf.c, sqlgen.c, sqlinx.c, sqlnode.h, sqlo.h: * Fixed IN pred as iterator before index path
-
-2010-02-16 13:47  source
-
-	* sqlcomp2.c: * Fixed leave semaphore before jump
-
-2010-02-16 12:58  source
-
-	* rdf_sponge.sql: * Fixed detection of n3 and nt formats
-
-2010-02-15 22:23  source
-
-	* extent.c: * Fixed use macro
-
-2010-02-15 20:46  source
-
-	* sparql_core.c: * FIxed GPF when 2nd argument is not a string
-
-2010-02-15 20:46  source
-
-	* sqloinx.c: * Fixed inx int not applicable to keys with no pk ref
-
-2010-02-15 14:17  source
-
-	* sparql.sql: * Added DB.DBA.BEST_LANGMATCH() aggregate
-
-2010-02-15 14:16  source
-
-	* bif_text.c, log.c, mtwrite.c, rendezvous.c, rltrx.c, search.c,
-	  sqlbif.c, sqlsrv.c, xpath.c, xpf.c: * Fixed compiler warnings
-
-2010-02-12 23:14  source
-
-	* sqlexp.c: * Fixed bad array index check
-
-2010-02-12 21:05  source
-
-	* rdfbox.c, sparql_io.sql: * Fixed NT serializations (_:_ is not a valid bnode in NT so it is
-	  replaced with _:ResultSet2053 )
-
-2010-02-12 14:00  source
-
-	* sqlver.h: * Updated version to 3127
-
-2010-02-12 12:53  source
-
-	* sparql.sql: * Fixed combination of RDF_OBJ_OF_LONG(RDF_LONG_OF_SQLVAL(string))
-	  that screwed up RDF_DELETE_TRIPLES_AGG()
-
-2010-02-12 00:18  source
-
-	* http.c: [no log message]
-
-2010-02-12 00:17  source
-
-	* http.c: * Fixed serialize ha_hits hash lookups
-
-2010-02-11 15:00  source
-
-	* sparql2sqltext.c: * Fixed codegen in LIMIT ?:global-variable and OFFSET ?:global-variable
-
-2010-02-10 17:10  source
-
-	* rdfbox.c: * Fixed move assignment of oplval_len before jump since we know
-	  oplval_strval is a string box already
-
-2010-02-10 17:09  source
-
-	* disk.c, sparql2sqltext.c, rdfbox.c: * Fixed whitespace
-
-2010-02-10 17:08  source
-
-	* disk.c, sparql2sqltext.c, sqlbif.c: * Fixed compiler warning about possible uninitialized vars
-
-2010-02-10 17:05  source
-
-	* security.c: * Fixed typo in if expression
-
-2010-02-10 17:05  source
-
-	* bif_uuencode.c: * Fixed use err_ret
-
-2010-02-10 17:04  source
-
-	* bif_soap.c: * Fixed should use int64 type
-
-2010-02-10 17:03  source
-
-	* bif_text.c, page.c, rendezvous.c, search.c, shuric.c, xpath.c,
-	  xpf.c: * Fixed compiler warnings
-
-2010-02-10 15:05  source
-
-	* sparql.sql: * Fixed SPARQL_SELECT_KNOWN_GRAPHS
-
-2010-02-10 15:04  source
-
-	* system.sql: * Fixed define dpipe before anything else is called
-
-2010-02-10 13:58  source
-
-	* sqlcost.c: * Fixed check for array boundary
-
-2010-02-10 13:57  source
-
-	* 2pc.c, disk.c, insert.c, log.c, mtwrite.c, page.c, rltrx.c,
-	  sqlbif.c, sqlrun.c, sqlsrv.c: * Fixed compiler warnings
-
-2010-02-10 12:03  source
-
-	* hash.c, sqlfn.h, sqlsrv.c: * Added DKS box serialization flag DKS_TO_HA_DISK_ROW to preserve
-	  box flags in procedure views temp tables
-
-2010-02-10 12:03  source
-
-	* sqlinx.c: * Fixed missing initialization in calculation of cost and cardinality
-
-2010-02-09 18:38  source
-
-	* sparql.sql: * Fixed workaround for non-iri g1
-
-2010-02-09 18:37  source
-
-	* sqlcost.c: * Fixed check to include iri_to_id
-
-2010-02-09 16:11  source
-
-	* sql3.y: * Fixed do not make an artm op 0-n for neg literal -n
-
-2010-02-09 15:34  source
-
-	* hosting.sql: * Fixed version number in http headers
-
-2010-02-09 15:33  source
-
-	* trans.c: * Fixed check trans node max mem when reading rows
-
-2010-02-09 15:23  source
-
-	* http_client.c: * Fixed mem leaks in client
-
-2010-02-09 12:39  source
-
-	* sqlgen.c, trans.c: * Fixed memory leak in trans node compilation
-
-2010-02-08 22:24  source
-
-	* sparql.sql: * Added protection against abnormally bif number of distinct datatypes
-	  or languages
-
-2010-02-08 22:22  source
-
-	* sparql2sqltext.c: * Fixed SQL codegen for NOT() retval expression
-
-2010-02-08 22:22  source
-
-	* rdf_core.c: * Fixed memory leak
-
-2010-02-08 13:38  source
-
-	* rdfbox.c: * FIxed gpf in serializer when using default constand
-	* Fixed gpf when type is bad or zero
-
-2010-02-08 13:34  source
-
-	* sparql.sql: * Fixed log replay for rdfs_load_schema on cluster
-
-2010-02-08 13:33  source
-
-	* sparql.sql: * Fixed loading literals of type xsd:Token
-
-2010-02-03 20:39  source
-
-	* sqlver.h: * Updated version to 06.01
-
-2010-02-03 20:13  source
-
-	* bif_file.c: * Fixed building with external zlib
-
-2010-02-03 19:03  source
-
-	* bif_file.c: * Fixed building with external zlib
-
-2010-02-03 15:54  source
-
-	* sqlgen.c: * Fixed do not put sort node as ks_stp if the sort node has precode that
-	  hs a dpipe part
-
-2010-02-03 11:29  source
-
-	* bif_intl.c, sparql.sql: * Added DB.DBA.BEST_LANGMATCH() and bif_langmatches_pct_http()
-
-2010-02-03 11:29  source
-
-	* sqlexp.c, sqlgen.c: * Fixed bad init in trans node if multiple inputs or step output values
-
-2010-02-03 01:44  source
-
-	* rdf_core.c, rdf_core.h, turtle_l.l: * Fixed redundant trailing '>' in results of TTL load when IRIs contain
-	  special chars
-
-2010-02-03 01:00  source
-
-	* jso_reformat.awk: * Add comment to generated code
-
-2010-02-03 00:54  source
-
-	* bif_intl.c: * Added bif_langmatches_pct_http()
-
-2010-02-03 00:53  source
-
-	* sqlbif2.c: * Fixed crash of rfc1808_expand_uri on base without schema
-
-2010-02-03 00:24  source
-
-	* rdf_core.c, rdf_core.h, turtle_l.l: * Fixed redundant trailing '>' in results of TTL load when IRIs contain
-	  special chars
-
-2010-02-02 15:39  source
-
-	* sparql.h, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_tree.c: * Fixed "option (score ...)" in a gp with multiple OPTIONAL {...}
-
-2010-02-02 15:37  source
-
-	* http_client.c: * Fixed memory leak in cache
-
-2010-02-02 15:20  source
-
-	* sparql.h, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_tree.c: * Fixed "option (score ...)" in a gp with multiple OPTIONAL (...)
-
-2010-02-02 15:18  source
-
-	* rltrx.c: * Fixed align buffer to sizeof pointer to avoid crash on strict
-	  checking platforms like sparc
-
-2010-02-02 15:17  source
-
-	* http_client.c: * FIxed memleak when cache is used
-
-2010-02-02 15:16  source
-
-	* bif_explain.c, regist.c, sqlintrp.c, sqlpfn.c: * Fixed compiler warnings
-
-2010-02-02 15:15  source
-
-	* sqlbif2.c: * Fixed problem with rfc1808_expand_uri not using proper macros
-	  and allocate byte extra for strings
-
-2010-02-02 00:14  source
-
-	* widisk.h: * Fixed compiler warning
-
-2010-02-02 00:13  source
-
-	* sqlinx.c: * Fixed bad cast
-
-2010-02-01 16:15  source
-
-	* clrdf23.sql: * Added conversion code to migrate DB to 2+3 index
-
-2010-02-01 15:51  source
-
-	* http_client.c, rdf_core.c: * Fixed building without ssl support
-
-2010-02-01 15:38  source
-
-	* xslt.c: * Fixed mutex_leave in bif_dict_destructive_list_rnd_keys
-
-2010-02-01 14:08  source
-
-	* sqlcmps.h: * Fixed missing prototype
-
-2010-02-01 14:02  source
-
-	* sqlinx.c: * Added missing file
-
-2010-02-01 13:53  source
-
-	* Makefile.am, bif_explain.c, bif_text.c, ddlrun.c, disk.c,
-	  eqlcomp.c, insert.c, meta.c, page.c, rdf_core.c, rdf_mapping.jso,
-	  rdfinf.c, regist.c, row.c, scn3.l, search.c, search_in.c,
-	  sparql.h, sparql.sql, sparql2sql.c, sparql2sqltext.c,
-	  sparql_core.c, sparql_p.y, sparql_tree.c, sparqld.c,
-	  sparul2sql.c, sql3.y, sqlbif.h, sqlbif2.c, sqlcomp.c, sqlcomp2.c,
-	  sqlcost.c, sqldf.c, sqlexp.c, sqlgen.c, sqlintrp.c, sqlnode.h,
-	  sqlo.h, sqloby.c, sqloinv.c, sqloprt.c, sqlparext.h, sqlrun.c,
-	  sqlver.h, sqlwords.gperf, srvstat.c, text.c, update.c, wi.h,
-	  widd.h, xmlnode.h, xmlschema.c, xmltree.c, xslt.c: * Merged 2+3 index into VOS
-	* Merged new inlined string code into VOS
-	* Added support for owl:inverseOf, owl:SymmetricProperty and
-	  owl:TransitiveProperty.
-	* Fixed graph-level security in cluster
-	* Fixed loading XMLs into single via RDF/XML
-	* Fixed SPARQL select distinct ?g where { graph ?g { ...}}
-
-2010-02-01 13:35  source
-
-	* disk.c: * Fixed check db size and exit if not correct
-	* Fixed text of version mismatch messages
-
-2010-02-01 10:39  source
-
-	* sparql2sqltext.c, sparql_p.y: * FIxed SPARQL parsing and SQL codegen for negative numbers
-
-2010-02-01 10:26  source
-
-	* cl_stubs.c: * Removed unused variables
-
-2010-02-01 03:45  source
-
-	* blobio.h, sparql.h, sqlo.h, xmlnode.h: * Fixed function prototypes
-
-2010-02-01 03:43  source
-
-	* bif_xper.c: * Fixed xper not supported in cluster
-
-2010-02-01 03:39  source
-
-	* sparql2sqltext.c, sparql_p.y: * Improved SPARQL parsing and SQL codegen for negative numbers
-
-2010-02-01 03:36  source
-
-	* sqlbif.c: * Fixed explicit rb not allowed in cl tx branch
-	* Fixed when rdf box then must take dtp1 and sizeof char one more time
-	* Fixed support of literals with languages in SPARQL INSERT DATA
-	  with data in state slot
-
-2010-02-01 03:32  source
-
-	* cluster.h, rdf_core.h, rdfbox.c: * Added new rdf box function
-
-2010-02-01 03:18  source
-
-	* sqlrun.c: * Fixed inside cpt do not notice anytimes and disconnects
-
-2010-02-01 03:16  source
-
-	* users.sql: * Fixed security in cluster
-
-2010-02-01 03:10  source
-
-	* rdf_core.c: * Partial rollback of patch
-
-2010-02-01 03:08  source
-
-	* rdf_core.c, rdf_core.h, sqlcmps.h, sqlcost.c, widv.h: * Fixed look up rdf lit ids in cost model to get the card
-
-2010-02-01 03:00  source
-
-	* rdfinf.c, rdfinf.h, sparql.h, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_p.y, sparql_tree.c: * Added initial support for owl:inverseOf, owl:SymmetricProperty
-	  and owl:TransitiveProperty
-
-2010-02-01 02:45  source
-
-	* bif_explain.c, rdfinf.c, sort.c, sqlo.h: * Fixed index path outer join
-
-2010-02-01 02:45  source
-
-	* lock.c, neodisk.c: * Fixed if cls rollback during cpt, it would not wait and would rb
-	  a tx while it had uncommitted state that was restored by the cpt
-	  at the end. This would make trxs in trx rc have locks which is
-	  impossible. So check for thread continues during cpt if simultaneous
-	  cpt freeze and rb. Check txns in trx rc don't get locks.
-
-2010-02-01 02:08  source
-
-	* rltrx.c: * Fixed gpf during rfwd containing XA transaction
-
-2010-02-01 02:00  source
-
-	* neodisk.c, wi.h: * Fixed atomic must proceed even if uncommitted 2pc prepared
-
-2010-02-01 01:53  source
-
-	* bif_intl.c: * Added function __uname
-
-2010-02-01 00:07  source
-
-	* sqlbif.c: * Added new function __rdf_rng_min
-
-2010-02-01 00:06  source
-
-	* sqlbif.c: * Added new implementation of log_text and log_text_array
-
-2010-02-01 00:04  source
-
-	* sqlbif.c: * Fixed compiler warnings
-
-2010-01-31 21:48  source
-
-	* http.c, http_client.c: * Fixed reading of last chunk
-
-2010-01-31 21:46  source
-
-	* rdf_sponge.sql: * Added debug flag for sponger
-
-2010-01-31 21:44  source
-
-	* rdf_core.c, sqlcmps.h, sqlcost.c, sqlexp.c: * Fixed declare iri to ir et all as no cluster
-
-2010-01-31 21:43  source
-
-	* sqlfn.h, wifn.h: * Fixed missing externals
-
-2010-01-31 21:41  source
-
-	* log.c, neodisk.c: * Fixed checkpoint messages in log
-
-2010-01-31 21:37  source
-
-	* system.sql: * Fixed do not run dav init on cluster before cluster is up
-
-2010-01-31 21:36  source
-
-	* autoexec.sql, system.sql: * Fixed rdf init on dav does not need to be done on empty db, thus run
-	  only in single when update is needed
-
-2010-01-31 21:32  source
-
-	* space.c, system.sql: * Fixed fault tolerance
-
-2010-01-31 17:09  source
-
-	* bif_file.c: * Fixed compiler warning
-
-2010-01-31 13:43  source
-
-	* sqlpfn.c, sqlpfn.h: * Fixed if negative numeric literal, do not make it 0 - litt
-
-2010-01-31 00:28  source
-
-	* sparql_io.sql: * Fixed some 'exotic' cases of NT outputs
-
-2010-01-30 10:48  source
-
-	* disk.c, gate.c, obackup.c, rdf_core.c, sparql2sql.c,
-	  sparql_core.c, sqlparext.h, xmltree.c: * Fixed whitespace
-
-2010-01-30 00:59  source
-
-	* disk.c, sparql2sql.c, sqlparext.h: * Fixed whitespace
-
-2010-01-29 21:54  source
-
-	* http_client.c, rdf_core.c: * Fixed for building without SSL
-
-2010-01-29 03:41  source
-
-	* rdf_sponge.sql: * Fixed uploading large files
-
-2010-01-29 03:40  source
-
-	* sparql.sql: * Fixed make sure version is intact as changes to .ttl file must
-	  reflect in sparql.sql
-
-2010-01-29 03:02  source
-
-	* bif_file.c, blobio.c, http_client.h, security.c, sqltype.c,
-	  srvcr.c: * Fixed use MD5 from OpenSSL when possible
-
-2010-01-29 02:56  source
-
-	* bif_file.c, blobio.c, http_client.h, security.c, sqltype.c,
-	  srvcr.c: * Fixed use MD5 from OpenSSL when possible
-
-2010-01-28 18:08  source
-
-	* sparql.sql: * Fixed make sure version is intact as changes to .ttl file must
-	  reflect in sparql.sql
-
-2010-01-28 15:42  source
-
-	* sparql.sql: * Fixed version of virtrdf ttl
-
-2010-01-28 11:57  source
-
-	* http.c: * Fixed issue reading last chunk
-
-2010-01-28 11:54  source
-
-	* http_client.c: * Fixed issue reading last chunk
-
-2010-01-28 02:14  source
-
-	* aqueue.c, aqueue.h: * Fixed make new aqt in io sect
-	* Fixed return error when no cli
-	* Fixed if aq called and no aq thread available, signal error
-
-2010-01-28 02:11  source
-
-	* disk.c, widisk.h: * Fixed automatically allocate bufs
-
-2010-01-27 21:36  source
-
-	* virtual_dir.sql: * Fixed do not post when no post parameters
-
-2010-01-27 21:36  source
-
-	* log.c, neodisk.c: * Fixed checkpoint messages in log
-
-2010-01-27 13:55  source
-
-	* xslt.c: * Fixed use DV_SHORT_STRING_SERIAL tag when serializing short strings
-
-2010-01-27 13:54  source
-
-	* lock.c: * Fixed varlgrind warning about using uninitialized memory read
-
-2010-01-27 13:52  source
-
-	* page.c: * Fixed in getting page_row reset rd leaf if not a leaf.
-
-2010-01-27 13:51  source
-
-	* virtual_dir.sql: * Fixed do not POST when no post parameters
-
-2010-01-26 12:17  source
-
-	* disk.c, widisk.h: * Fixed missing symbols
-
-2010-01-25 21:45  source
-
-	* rdf_sponge.sql: * Fixed must commit before aq_wait
-
-2010-01-25 16:19  source
-
-	* sparql.h, sparql.sql, sparql2sql.c, sparql2sqltext.c,
-	  sparql_core.c, sparql_p.y, sparql_tree.c, sparqld.c,
-	  sparul2sql.c: * Added support for expressions in LIMIT and OFFSET clauses
-
-2010-01-25 16:15  source
-
-	* http_client.c: * Fixed accept different headers in pipeline request; add header only
-	  if it contains something
-
-2010-01-25 11:39  source
-
-	* http_client.c: * Fixed accept different headers in pipeline request; add header only if
-	  it contains something
-
-2010-01-21 01:59  source
-
-	* sparql2sql.c: * Fixed compilation of ORDER BY column_idz clause in iterator of sponge
-	  with loop
-
-2010-01-19 18:56  source
-
-	* sparql2sqltext.c: * Fixed UNION of SELECTs and for multiple OPTIONALs at one level with
-	  "good" and "bad" equalities
-
-2010-01-15 14:50  source
-
-	* sqlrun.c: * Fixed crash when timeout was sent using dv_array_of_long
-
-2010-01-15 14:47  source
-
-	* sqlrun.c: * Fixed crash when timeout was sent using dv_array_of_long
-
-2010-01-15 14:02  source
-
-	* sparql2sqltext.c: * Fixed small lang conversion issue
-
-2010-01-13 16:02  source
-
-	* http.c: * Fixed missing type cast
-
-2010-01-13 00:21  source
-
-	* http.c: * Fixed decoding unicode escape sequences in post request
-
-2010-01-12 13:19  source
-
-	* multibyte.c, multibyte.h, rdf_void.sql, rdfinf.h, sparql.sql: * Fixed automated labels extraction
-
-2010-01-12 13:15  source
-
-	* update.c: * Fixed memory leak
-
-2010-01-07 17:58  source
-
-	* soap.sql, sqlver.h: * Fixed copyright year to 2010
-
-2010-01-07 17:41  source
-
-	* soap.sql, sqlver.h: * Updated copyright year to 2010
-
-2010-01-06 17:49  source
-
-	* neodisk.c, wifn.h: * Added flag (DuplicateCheckpointRemaps) which should ONLY be used
-	  in recovery mode when a bad db can have cpt remap page which links
-	  back to itself. In this situation as last chance to recover we can
-	  look if remap already is registered and at that point stop looking.
-	  Further DBA must check for inconsistencies.
-
-2010-01-06 17:47  source
-
-	* sparql_core.c: * Fixed default log mode in SPARUL MDW operations to distinquish
-	  between NULL and 0 log mode
-
-2010-01-06 17:45  source
-
-	* rdf_core.c: * Fixed check if qi is actually available in this context
-
-2010-01-05 19:30  source
-
-	* neodisk.c, wifn.h: * Added flag (DuplicateCheckpointRemaps) which should ONLY be used in
-	  recovery mode when a bad db can have cpt remap page which links back to
-	  itself. In this situation as last chance to recover we can look if remap
-	  already is registered and at that point stop looking. Further DBA must
-	  check for inconsistencies.
-
-2010-01-05 19:24  source
-
-	* rdf_sponge.sql: * Fixed moved commit work else async exec might generate new rdf_obj
-
-2010-01-04 12:54  source
-
-	* rdfbox.c: * Fixed if null box then use 0 to prevent core dump
-
-2010-01-04 12:49  source
-
-	* Makefile.am: * Fixed building on debian
-
-2010-01-04 12:47  source
-
-	* Makefile.am: * Fixed dependency
-
-2010-01-04 12:47  source
-
-	* sha.h: * Removed deprecated file
-
-2010-01-04 12:42  source
-
-	* sha.h: * Removed deprecated file
-
-2009-12-30 13:19  source
-
-	* Makefile.am, xpath.c: * FIxed compiler warning
-
-2009-12-30 12:23  source
-
-	* sparql_core.c: * Fixed compiler construction
-
-2009-12-30 12:21  source
-
-	* xpath.c: * Fixed compiler warning
-
-2009-12-29 13:28  source
-
-	* rdfbox.c, sparql.h, sparql.sql, sparql2sql.h, sparql_core.c,
-	  sparql_p.y, sparul2sql.c: * Added new error reporting for unsupported syntax
-	* Added initial support for SPARQL-FED
-	* Added initial (disabled) support for SERVICE { ... };
-
-2009-12-29 13:17  source
-
-	* rdf_sponge.sql: * Fixed arguments in wrong order
-
-2009-12-28 16:00  source
-
-	* sparql.sql: * Fixed issues with transactions
-
-2009-12-28 15:59  source
-
-	* sqlbif.c: * Fixed allow UNAME in toupper and tolower
-
-2009-12-28 10:39  source
-
-	* sparql2sqltext.c: * Fixed removed redundant comparision codegen. Now if (for COST rvr
-	  on equiv) short valmode comparison is done then the fill comparison
-	  is not printed.
-
-2009-12-24 15:04  source
-
-	* sqlbif.c: * Removed duplicate check
-
-2009-12-24 15:01  source
-
-	* lock.c: * Fixed remove check
-
-2009-12-24 15:00  source
-
-	* sqlgen.c: * FIxed if there is an invariant cond in a query and a precode gets
-	  shifted to before this cond, then shift the dpipe of the precode
-	  also, else we get the wrong exec order
-
-2009-12-24 14:58  source
-
-	* rdf_core.c, rdf_core.h: * Fixed dynamic local support
-
-2009-12-23 17:22  source
-
-	* sparql2sql.c: * FIxed merge of many '=' and 'IN' inside OR into single 'IN'
-
-2009-12-23 17:19  source
-
-	* sparql.sql: * Improved speed of big insert/deletes in SPARUL
-
-2009-12-22 16:59  source
-
-	* hash.c: * Fixed handling of out of disk situation
-
-2009-12-22 00:31  source
-
-	* space.c: * Fixed if all buffers are wired for multiset gb or such, make it an
-	  out of disk situation instead of a hang
-
-2009-12-22 00:19  source
-
-	* sqldf.c: * Fixed input card from dfe_arity_with_supers; do not turn off hash
-	  join of short tables
-
-2009-12-21 22:37  source
-
-	* hash.c, sqlrun.c, srvstat.c: * Added mem bashed hash join for small tables
-
-2009-12-21 22:10  source
-
-	* disk.c: * Fixed check for minimum db engine
-
-2009-12-19 16:19  source
-
-	* sqlcost.c: * FIxed if this is text index may reference bad or null data
-
-2009-12-17 23:46  source
-
-	* rltrx.c, widisk.h: * Fixed alignment issues
-
-2009-12-16 22:12  source
-
-	* sqldf.c: * Fixed if text pred looks like a not but it is not to be treated for
-	  const cond like a not
-
-2009-12-16 22:10  source
-
-	* regist.c: * Fixed if serializing rb box w/o id as string, it can be longer than
-	  50 chars
-
-2009-12-16 00:21  source
-
-	* sparql.sql, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_l.l, sparql_p.y, sparql_tree.c, sparul2sql.c: * Added build-in predicate IsRef()
-	* Fixed replace lost filters with equivs that have no spog vars and
-	  no "good" subequivs.
-
-2009-12-15 22:52  source
-
-	* sparql.sql, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_l.l, sparql_p.y, sparql_tree.c, sparul2sql.c: * Added built-in predicate IsRef()
-	* Fixed replace lost filters with equivs that have no spog vars and
-	  no "good" subequivs.
-
-2009-12-14 15:51  source
-
-	* sqlsrv.c: * Added new variant of QUIETCAST sorting for ANY cols
-
-2009-12-13 00:31  source
-
-	* bif_file.c: * Fixed issue withclosing gzip session
-
-2009-12-11 18:03  source
-
-	* bif_file.c: * Fixed issue with closing gzip session
-
-2009-12-11 15:24  source
-
-	* hash.c, row.c, search.c, sort.c, sparql2sqltext.c, sqlfn.h,
-	  sqlhash.c, sqlo.c, wi.h, xmltree.c: * Added new variant of QUIETCAST sorting for ANY cols
-
-2009-12-11 15:23  source
-
-	* text.c: * Fixed wrong assert
-
-2009-12-09 22:37  source
-
-	* disk.c, wifn.h: * Added new sort funcs
-
-2009-12-09 22:32  source
-
-	* disk.c: * Fixed buf_stats would screw up if buffers changed dp during sort,
-	  so copy the dps and check for sortable data changed during qsort
-	  so as not to get overruns of result buffer
-
-2009-12-09 22:18  source
-
-	* rdf_core.c: * Fixed only show debug information when DEBUG is defined
-
-2009-12-09 17:46  source
-
-	* rdf_core.c: * Fixed only show debug information when DEBUG is defined
-
-2009-12-09 17:03  source
-
-	* Makefile.am, sql_to_c.awk: * Add comment to generated files
-
-2009-12-09 11:52  source
-
-	* sqlver.h: * Updated version
-
-2009-12-09 11:51  source
-
-	* rdfbox.c: * Fixed only serialize as rdf box when client is recent
-
-2009-12-09 11:50  source
-
-	* http.c, http.h, virtual_dir.sql: * Added flag to limit bandwidth
-
-2009-12-09 11:43  source
-
-	* http.c, http.h, virtual_dir.sql: * Added flag to limit bandwidth
-
-2009-12-09 10:54  source
-
-	* sparql_core.c: * Fixed composing parse tree of option list for
-	  FROM <graph> OPTION (...) clause
-
-2009-12-08 21:50  source
-
-	* sparql_core.c: * Fixed composing parse tree of option list for
-	  FROM <graph> OPTION (...) clause
-
-2009-12-08 11:18  source
-
-	* shcompo.c: * Fixed clear cache at end of loop otherwise it could hit free mem
-
-2009-12-08 11:13  source
-
-	* shcompo.c: * Fixed clear cache at end of loop otherwise it could hit free mem
-
-2009-12-07 22:26  source
-
-	* bif_file.c, http.c, sqlbif.h: * Fixed write number of bytes sent when using gz compression
-	* Fixed do not write -1 in log file
-
-2009-12-07 22:21  source
-
-	* sparql_io.sql: * Fixed whitespace
-
-2009-12-07 22:05  source
-
-	* bif_file.c, http.c, sqlbif.h: * Fixed write number of bytes sent when using gz compression
-	* Fixed do not write -1 in log file
-
-2009-12-07 16:41  source
-
-	* CLIsql1.c: * Fixed duplicate connection
-
-2009-12-04 17:54  source
-
-	* virtual_dir.sql: * Fixed should not sent content-length
-
-2009-12-04 17:42  source
-
-	* virtual_dir.sql: * Fixed do not send content len
-
-2009-12-04 16:24  source
-
-	* rdf_sponge.sql, sparql.sql: * Fixed problem with SPARQL_CLEAN
-
-2009-12-04 13:14  source
-
-	* sparql.sql: * Fixed whitespace
-
-2009-12-04 13:13  source
-
-	* sparql.sql: * Fixed FT
-
-2009-12-04 12:02  source
-
-	* rdfbox.c, sparql_io.sql: * Fixed serialization of XML in SPARQL output formats
-
-2009-12-04 11:54  source
-
-	* rdfbox.c, sparql_io.sql: * Fixed serialization of XML in SPARQL output formats
-
-2009-12-03 22:24  source
-
-	* sparql.sql: * Fixed list of all distinct graphs in SPARQL
-
-2009-12-03 18:37  source
-
-	* rdfbox.c, sparql.sql, sparql_core.c, sparul2sql.c: * Fixed support for log mode instead of intermediate "commit work"
-	  in SPARUL
-
-2009-12-03 18:35  source
-
-	* rdf_sponge.sql: * Fixed add debug cookie in async mode
-
-2009-12-03 18:35  source
-
-	* http.c: * FIxed check length as encoded len is double size
-
-2009-12-03 18:34  source
-
-	* bif_file.c: * Fixed set member to NULL after being freed
-
-2009-12-03 18:33  source
-
-	* sparql_l.l: * Fixed missing keyword
-
-2009-12-03 18:21  source
-
-	* rdf_sponge.sql: * Fixed add debug cookie in async mode
-
-2009-12-03 16:24  source
-
-	* http.c: * Fixed check lenght as encoded len is double size
-
-2009-12-02 15:49  source
-
-	* http.c: * Fixed when in atomic and maintenance mode, do not rewrite at all,
-	  the user will only see maint.page
-
-2009-12-02 15:19  source
-
-	* http.c: * Fixed when in atomic and maintainance mode, do not rewrite at all,
-	  the user will only see maint.page
-
-2009-12-02 04:21  source
-
-	* rdf_sponge.sql: * Fixed allow sponger task to run in background eliminating async
-	  rollback
-
-2009-12-01 23:41  source
-
-	* bif_file.c: * Fixed set member to NULL after being freed
-
-2009-12-01 23:38  source
-
-	* eqlcomp.c, eqlcomp.h, sparql.h, sparql.sql, sparql2sql.c,
-	  sparql2sqltext.c, sparql_core.c, sparql_p.y, sparql_tree.c,
-	  sparqld.c, sparul2sql.c, sqlcmps.h, sqlcomp2.c, sqlcost.c,
-	  sqldf.c, sqlexp.c: * Added support for SPARQL INSERT DATA / DELETE DATA
-	* Added support for SPARQL HAVING
-	* Added special codegen for
-	  sparql select distinct ?g where { graph ?g { ?s ?p ?o }}
-
-2009-12-01 23:30  source
-
-	* rdfbox.c: * Fixed NTRIPLES serialization of triples
-
-2009-12-01 23:18  source
-
-	* bif_file.c, http.c, sqlbif.h: * Fixed memory leak when session closed during gzip
-
-2009-12-01 23:16  source
-
-	* bif_soap.c: * Fixed return an error to avoid jump into unknown context
-
-2009-12-01 21:55  source
-
-	* bif_file.c, http.c, sqlbif.h: * Fixed memory leak in gzip when write fails
-
-2009-12-01 21:53  source
-
-	* bif_soap.c: * Fixed return an error to avoid jump into unknown context
-
-2009-12-01 18:31  source
-
-	* rdf_core.c, rdfbox.c: * Fixed NTRIPLES serialization of triples
-
-2009-11-30 22:47  source
-
-	* eqlcomp.c, eqlcomp.h, sparql.h, sparql.sql, sparql2sqltext.c,
-	  sparql_core.c, sparql_p.y, sparul2sql.c, sqlcmps.h, sqlcomp2.c,
-	  sqlexp.c: * Added support for SPARQL INSERT DATA / DELETE DATA
-
-2009-11-30 17:53  source
-
-	* sqlbif2.c: * Fixed current proc name extension
-
-2009-11-30 17:52  source
-
-	* http_client.c, rdf_sponge.sql: * Fixed 304 must have no body
-	* Fixed when no etag use the last load date
-
-2009-11-30 17:51  source
-
-	* sqldf.c: * Fixed woing input card from dfe-arity_with_supoers, do not turn off
-	  hash join of short tables
-
-2009-11-30 17:45  source
-
-	* http_client.c, rdf_sponge.sql: * Fixed 304 must have no body
-	* Fixed when no etag, use the last load date
-
-2009-11-27 17:20  source
-
-	* rdf_sponge.sql: * Fixed when expiry is false, and we have etag, use a etag mechanism to
-	  see if the data is modified
-
-2009-11-27 16:07  source
-
-	* http.c: * Fixed enable disk cache when reading body as this can be large chunk
-	  of data
-
-2009-11-26 19:20  source
-
-	* sqlbif.c: * Added _ to format modifier
-
-2009-11-26 15:28  source
-
-	* sqldf.c: * Fixed when remote table in outer join place at same order
-
-2009-11-26 15:28  source
-
-	* sqlbif.c: * Added _ to format modifier
-
-2009-11-25 23:06  source
-
-	* http_client.c: * Fixed no proxy for https
-
-2009-11-25 23:05  source
-
-	* turtle_p.y: * Fixed parsing sequences in TTL
-
-2009-11-25 23:05  source
-
-	* sqlbif.c: * Added the R format char to sprintf, replace left padded spaces with
-	  modifier
-
-2009-11-25 22:18  source
-
-	* sqlbif.c: * Added R format char to sprintf to replace left padded spaces with
-	  modifier
-
-2009-11-25 21:46  source
-
-	* http_client.c: * Fixed no proxy for https
-
-2009-11-25 21:46  source
-
-	* turtle_p.y: * Fixed parsing sequences in TTL
-
-2009-11-25 17:09  source
-
-	* http.c: * FIxed checks in http kill
-
-2009-11-25 14:54  source
-
-	* rdfbox.c: * Added initial support for dumping xml entity data
-
-2009-11-25 14:53  source
-
-	* rdf_core.c, rdf_core.h, xslt.c: * Fixed always convert URIQADefaultHost to local: even if current host
-	  is different
-
-2009-11-24 18:39  source
-
-	* rdf_core.c, rdf_core.h, xslt.c: * Fixed always convert URIQADefaultHost to local: even if current host
-	  is different
-
-2009-11-23 15:08  source
-
-	* http.c: * Fixed crash in http monitor
-
-2009-11-20 16:01  source
-
-	* rdfbox.c, sparql.sql, sparql2sqltext.c: * Improved recovery of lists in DB.DBA.RDF_AUDIT_METADATA()
-
-2009-11-20 13:09  source
-
-	* rdfbox.c, sparql.sql, sparql2sqltext.c: * Improved recovery of lists in DB.DBA.RDF_AUDIT_METADATA()
-
-2009-11-19 21:16  source
-
-	* scn3.l, sparql2sqltext.c: * FIxed memory leaks
-
-2009-11-19 21:16  source
-
-	* bif_dav.c: * Fixed when reading from ws_session, we need to touch the ws_req_len
-	  in order to avoid hang when calling http_body_read next
-
-2009-11-19 20:33  source
-
-	* scn3.l, sparql2sqltext.c: * Fixed memory leaks
-
-2009-11-19 16:30  source
-
-	* sparql_core.c: * Fixed catch signal from ssg_make_sql_query_text and resignal in order to
-	  free session
-
-2009-11-19 16:29  source
-
-	* sparql_core.c: * Fixed catch signal on error in ssg_make_sql_query_text and re-signal
-	  in order to free session
-
-2009-11-19 14:40  source
-
-	* bif_dav.c: * Fixed when reading from ws_session, we need to touch the ws_req_len
-	  in order to avoid hang when calling http_body_read next
-
-2009-11-18 15:40  source
-
-	* sparql.sql, xslt.c: * Added bif_dict_zap
-	* Fixed adding huge number of graph keywords in one operation
-
-2009-11-18 15:39  source
-
-	* bif_text.c: * Fixed memory leak with dump strings
-
-2009-11-18 15:34  source
-
-	* bif_text.c: * Fixed memory leak in dump strings
-
-2009-11-18 15:34  source
-
-	* sparql.sql, xslt.c: * Added bif_dict_zip
-	* Fixed bug adding many graph keywords in one operation
-
-2009-11-18 15:33  source
-
-	* text.c: * Fixed write past end of buffer
-
-2009-11-18 13:44  source
-
-	* text.c: * Fixed write past end of buffer
-
-2009-11-17 21:58  source
-
-	* srvstat.c: * Fixed as we are reading the disk, there could be buffers still not
-	  written, so we read free set from disk and use it to make stats
-
-2009-11-17 21:58  source
-
-	* ddlrun.c, widd.h: * Fixed max column count increased
-
-2009-11-17 21:27  source
-
-	* sparql.h, sparql.sql, sparql2sql.c, sparql2sqltext.c,
-	  sparql_core.c, sparql_l.l, sparql_p.y, sparql_tree.c, sparqld.c: * Added support for HAVING in sparql
-	* Added special codegen for
-	  sparql select distinct ?g where { graph ?g { ?s ?p ?o }}
-
-2009-11-10 14:43  source
-
-	* sqlo.c: * Fixed group by to expand automatically when col is not referenced
-
-2009-11-10 14:43  source
-
-	* hash.c: * Fixed smaller hash sz as box has limit
-
-2009-11-10 13:42  source
-
-	* sqlo.c: * Fixed group by to expand automatically when grouping functions are
-	  used
-
-2009-11-09 23:21  source
-
-	* http.c: * Fixed bad content after rewrite
-
-2009-11-09 23:19  source
-
-	* http.c: * FIxed bad content after rewrite
-
-2009-11-09 23:19  source
-
-	* sqlgen.c: * Fixed mem only chase must be off when op is HA_FILL
-
-2009-11-09 23:18  source
-
-	* sparql_io.sql: * Fixed missing headers in result
-
-2009-11-09 23:18  source
-
-	* url_rewrite.sql: * Fixed warnings
-
-2009-11-06 18:10  source
-
-	* sparql_core.c: * Fixed ignore lists
-
-2009-11-06 18:08  source
-
-	* xpath.c: * Fixed box flags
-
-2009-11-06 18:06  source
-
-	* datesupp.c, xqf.c: * Added support for half-legal 'Thu, 24 Jul 2008 17:11:59 +0200' and
-	  'Thu, 24 Jul 2008 17:11:59 +02:00' datetime syntax
-
-2009-11-06 17:49  source
-
-	* sparql_core.c: * Fixed memory leak
-
-2009-11-06 13:09  source
-
-	* sparql_core.c: * Fixed memory leak
-
-2009-11-06 13:09  source
-
-	* datesupp.c, xqf.c: * Added support for half-legal 'Thu, 24 Jul 2008 17:11:59 +0200' and
-	  'Thu, 24 Jul 2008 17:11:59 +02:00' datetime syntax
-
-2009-11-05 09:47  source
-
-	* cluster.h: * Reverted previous patch
-
-2009-11-04 10:56  source
-
-	* cluster.h, wifn.h: * Removed duplicate lines
-
-2009-11-04 02:49  source
-
-	* sparql_io.sql: * Fixed whitespace
-
-2009-11-03 23:52  source
-
-	* sqlver.h: * Fixed version number of engine
-
-2009-11-03 23:52  source
-
-	* wifn.h: * Fixed prototypes
-
-2009-11-03 23:51  source
-
-	* sqlgen.c, srvstat.c, xmlschema.c: * Minor cleanups
-
-2009-11-03 23:49  source
-
-	* page.c, wi.h: * Fixed move typedef to header file
-
-2009-11-03 23:47  source
-
-	* cl_stubs.c, cluster.h, lock.c: * Fixed prototype
-
-2009-11-03 08:39  source
-
-	* sparql.sql: * Added optimization daq delete for many dels with all key columns known
-
-2009-11-03 08:38  source
-
-	* sqlbif.c: * Added strcontains(), starts_with() and ends_with()
-
-2009-11-03 08:37  source
-
-	* shcompo.c: * Fixed check ref count to avoid double free etc
-
-2009-11-03 08:03  source
-
-	* sqlbif.c: * Added strcontains, starts_with and ends_with
-
-2009-11-02 15:58  source
-
-	* shcompo.c: * Fixed check ref count to avoid double free
-
-2009-11-02 10:37  source
-
-	* rdfbox.c, sqlbif.c: * Fixed box flags of IRIs
-
-2009-11-02 10:32  source
-
-	* sparql.sql, sparql_io.sql: * Fixed support for define output:format "JSON"
-
-2009-11-02 10:31  source
-
-	* bif_file.c, http.c, http.h: * Fixed problem with uploading large files using HTTP
-	* Fixed compiler warnings
-
-2009-11-02 10:24  source
-
-	* sparql.sql, sparql_io.sql: * Fixed support for define output:format "JSON"
-
-2009-10-30 17:35  source
-
-	* bif_file.c, http.c, http.h: * Fixed problem with uploading large files using HTTP
-	* Fixed compiler warnings
-
-2009-10-29 21:03  source
-
-	* shcompo.c: * Added shared qr cache cleaner
-
-2009-10-29 21:00  source
-
-	* rdf_schema_objects.sql: * Added rule for bin objects
-
-2009-10-28 22:17  source
-
-	* rdf_schema_objects.sql: * Fixed separate drop statements for rdf view into separate call
-
-2009-10-28 22:16  source
-
-	* rdf_schema_objects.sql: * Fixed separate drop statements for rdf views in separate call
-
-2009-10-28 22:15  source
-
-	* space.c: * Fixed compilin with mtx debug
-
-2009-10-28 12:03  source
-
-	* xslt.c: * Fixed enabled draft code in xslt
-
-2009-10-28 12:02  source
-
-	* url_rewrite.sql: * Fixed indentation
-
-2009-10-28 11:58  source
-
-	* xslt.c: * Fixed enabled draft code in xslt
-
-2009-10-27 14:36  source
-
-	* rdfbox.c: * Fixed issue with broken IRI
-
-2009-10-27 12:47  source
-
-	* bif_xml.c, rdf_sponge.sql, sparql.h, sparql.sql, sparql2sql.c,
-	  sparql2sql.h, sparql2sqltext.c, sparql_core.c, sparql_io.sql,
-	  sparql_tree.c, xmltree.c, xpath.c, xpath.h, xslt.c, xslt_impl.h,
-	  xslt_opt.c: * Added support for RDFa export
-	* Added support for output:maxrows
-	* Fixed support for XMLLiteral
-	* Fixed bad box flags for strings for bnodes and types
-
-2009-10-27 12:39  source
-
-	* sqlbif.c: * Added support for isvector and __transparent_or
-
-2009-10-27 12:10  source
-
-	* sparql2sql.c, sparql_core.c: * Added support for define output:maxrows
-	* Fixed memory leak
-
-2009-10-26 21:46  source
-
-	* rdf_sponge.sql, sparql.h, sparql.sql, sparql2sql.c,
-	  sparql2sqltext.c, sparql_core.c, xmltree.c, xmltree.h, xpath.c,
-	  xpath.h, xqf.c, xslt.c, xslt_impl.h, xslt_opt.c: * Added xsl:for-each-row loop
-	* Fixed support for XMLLiteral
-	* Fixed support for SPARQL queries with sponge and subqueries in one
-	* Fixed support for sameAs sponge and and subqueries in one
-	* Fixed behaviour of sponge on unusal protocols
-
-2009-10-26 21:44  source
-
-	* arith.c: * Added support for comparison of XML trees
-
-2009-10-26 10:19  source
-
-	* bif_file.c, rdfbox.c, sparql.sql, sparql2sqltext.c,
-	  sparql_io.sql, xmltree.c: * Added RDFa export
-
-2009-10-26 10:19  source
-
-	* sql3.y: * Fixed missing cast
-
-2009-10-26 10:18  source
-
-	* sqlbif.c: * Added bif_isvector()
-
-2009-10-26 10:17  source
-
-	* auxfiles.c: * Fixed minimum ServerThreadSize to 60k
-
-2009-10-23 14:22  source
-
-	* auxfiles.c: * Fixed minimum ServerThreadSize to 60k
-
-2009-10-20 15:07  source
-
-	* sparql_l.l: * Fixed new rules for special chars in names
-
-2009-10-19 22:21  source
-
-	* sqlcost.c: * Fixed bad cost for top 1 since log(1) is 0
-
-2009-10-19 22:20  source
-
-	* sparql_l.l: * Fixed new rules for special chars in names
-
-2009-10-19 00:15  source
-
-	* sqlstmts.c: * Fixed if del with given key, do not run trigs, else they could
-	  read another key outside of partition and this single key del
-	  needs to be within partition
-
-2009-10-19 00:13  source
-
-	* sqlintrp.c: * Fixed initialize all nodes when running a subq in a proc
-
-2009-10-19 00:12  source
-
-	* sqlcost.c: * Fixed cost for TOP 1 since log(1) is 0
-
-2009-10-19 00:11  source
-
-	* sparql_l.l: * Fixed syntax of IRI parts to match SPARQL1.0 W3C recommendation
-
-2009-10-19 00:07  source
-
-	* sparql_l.l: * Fixed IRI parts syntax to match SPARQL 1.0 W3C recommendation
-
-2009-10-16 18:57  source
-
-	* Makefile.am: * Merged from HEAD
-
-2009-10-16 18:42  source
-
-	* Makefile.am: * Fixed use external zlib when requested
-
-2009-10-16 13:09  source
-
-	* aqueue.c, bif_xml.c, http.c, text.c, xslt.c, xslt_opt.c: * Merged from V6
-
-2009-10-16 13:06  source
-
-	* http.c: * Fixed buffer overrun
-
-2009-10-16 13:05  source
-
-	* aqueue.c: * Fixed issue when thread is not allocated
-
-2009-10-15 23:24  source
-
-	* url_rewrite.sql: * Merged from V6
-
-2009-10-15 22:08  source
-
-	* scn3.l: * Fixed handling of single quote in iri
-
-2009-10-15 22:07  source
-
-	* sparql.sql: * Added support for DB.DBA.RDF_LOAD_RDFA_WITH_IRI_TRANSLATION () and
-	  DB.DBA.TTLP_WITH_IRI_TRANSLATION())
-
-2009-10-15 21:52  source
-
-	* scn3.l: * Merged from V6
-
-2009-10-15 21:38  source
-
-	* sparql.sql: * Merged from V6
-
-2009-10-15 21:34  source
-
-	* rdfbox.c: * Fixed GPF on xml literal
-
-2009-10-15 20:32  source
-
-	* srvstat.c: * Merged from V6
-
-2009-10-15 10:52  source
-
-	* neodisk.c: * Merged from V6
-
-2009-10-15 09:38  source
-
-	* extent.c, lock.c, ltrx.h, obackup.c, rdf_core.h, rdf_sponge.sql,
-	  rdfbox.c, rdfinf.c, search.c, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_l.l, sparql_tree.c,
-	  sqlbif.c, sqlgen.c, xmltree.c, xmltree.h: * Merged from V6
-
-2009-10-14 23:18  source
-
-	* rdfbox.c: * Fixed indent
-
-2009-10-14 23:17  source
-
-	* http.c, rdfbox.c, sparql2sqltext.c, sparql_core.c, sqlbif.c,
-	  sqlgen.c, xqf.c: * Fixed compiler warnings
-
-2009-10-14 23:17  source
-
-	* sparql_l.l: * Fixed support for single quote in IRI_REF
-
-2009-10-14 22:13  source
-
-	* odbcinc.h: * Merged from HEAD
-
-2009-10-14 22:00  source
-
-	* sparql2sql.c, sparql2sqltext.c, sparql_tree.c, xmltree.c: * Fixed compiler warnings
-
-2009-10-14 17:22  source
-
-	* rdf_core.h, sparql2sqltext.c, xmltree.h: * Fixed compiler warnings
-
-2009-10-14 16:31  source
-
-	* odbcinc.h: * Fixed compiler warnings due to multiple include of config.h
-
-2009-10-13 20:55  source
-
-	* sqlrcomp.c: * Merged from V6
-
-2009-10-13 18:16  source
-
-	* sqlrcomp.c: * Fixed bad performance of sprintf_more on some compilers when buffer
-	  is very long
-
-2009-10-13 18:15  source
-
-	* bif_intl.c: * Fixed return type of charset_canonical_name
-
-2009-10-12 23:41  source
-
-	* http.c: * Fixed do not convert when file name is NULL
-
-2009-10-12 23:40  source
-
-	* rdf_sponge.sql: * Fixed send characterset to cartridges
-
-2009-10-12 22:14  source
-
-	* http.c, rdf_sponge.sql: * Merged from V6
-
-2009-10-09 01:36  source
-
-	* rdfbox.c, rdfinf.c: * Merged from V6
-
-2009-10-09 00:50  source
-
-	* rdfbox.c: * Fixed double dt for date time objects
-
-2009-10-07 13:09  source
-
-	* rdfxml_parser.c: * Merged from V6
-
-2009-10-07 13:07  source
-
-	* rdfxml_parser.c: * Fixed hang on syntax errors in CURIE and SafeCURI attributes
-
-2009-10-07 02:47  source
-
-	* sparql2sqltext.c: * Fixed SPARQL FILTER() results
-
-2009-10-07 02:41  source
-
-	* sparql2sqltext.c: * Merged from V6
-
-2009-10-06 20:54  source
-
-	* sparql.sql: * Merged from V6
-
-2009-10-06 17:38  source
-
-	* rdfbox.c, sparql.sql, xmltree.c: * Merged from V6
-
-2009-10-06 16:52  source
-
-	* sparql_io.sql: * Fixed ASK output in application/sparql-results+xml
-
-2009-10-06 11:37  source
-
-	* virtual_dir.sql: * Merged from V6
-
-2009-10-06 11:33  source
-
-	* sparql.sql: * Fixed commit work so we dont loose the iri creation
-
-2009-10-05 21:14  source
-
-	* sparql2sql.c, sparql2sql.h: * Merged from V6
-
-2009-10-05 21:11  source
-
-	* virtual_dir.sql: * Fixed check for longer idn first
-
-2009-10-05 12:48  source
-
-	* url_rewrite.sql: * Fixed wrong behaviour when flag is set to not continue
-
-2009-10-05 12:47  source
-
-	* http.c: * Fixed store raw post data for php when posting multipart data
-
-2009-10-05 10:48  source
-
-	* sparql2sql.c, sparql2sql.h: * Fixed force localization of free-text predicate into members of union
-	  made for tc_list.
-
-2009-10-02 17:27  source
-
-	* rdfxml_parser.c, sqlver.h: * Merged from V6
-
-2009-10-02 17:24  source
-
-	* sqlver.h: * Updated version to 05.12.3041
-
-2009-10-02 17:07  source
-
-	* rdfxml_parser.c: * Fixed failed assertion on a document with some elements closed
-	  outside any "interesting" elements
-
-2009-10-02 13:08  source
-
-	* sparql.h, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_tree.c, sparul2sql.c: * Fixed equivs on SPARQL with scalar subquery filter with aggregate
-	  in result-set
-
-2009-10-01 15:24  source
-
-	* insert.c, page.c, sparql.h, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_tree.c, sparul2sql.c,
-	  sqlfn.h, sqlhash.c: * Merged from V6
-
-2009-10-01 09:56  source
-
-	* wifn.h: * Merged from HEAD
-
-2009-09-30 23:17  source
-
-	* sparql.h, sparql2sql.c, sparql_tree.c: * Fixed detection of invalid equiv indexes
-
-2009-09-30 12:24  source
-
-	* wifn.h: * Added setting to enable http client cache on startup
-
-2009-09-30 12:23  source
-
-	* sqlbif2.c: * Fixed current_proc_name to take proc name from upper frames
-
-2009-09-28 23:01  source
-
-	* url_rewrite.sql, virtual_dir.sql: * Merged from V6
-
-2009-09-28 13:38  source
-
-	* http.c, http.h: * Fixed failing post after rewrite rules
-
-2009-09-28 00:03  source
-
-	* disk.c, eqlcomp.c, rdfinf.c, sqlcost.c, sqlorder.c, trans.c: * Merged from V6
-
-2009-09-27 23:40  source
-
-	* arith.c, rdfbox.c, sparql.sql, xmltree.c, xmltree.h, xqf.c: * Improved support for rdf:XMLLiteral exp in RDF loaders
-
-2009-09-25 15:17  source
-
-	* sqlbif.c: * Merged from V5
-
-2009-09-25 15:15  source
-
-	* sqlbif.c: * Fixed portability problem with memmem
-
-2009-09-25 00:47  source
-
-	* search.c: * Merged from V6
-
-2009-09-24 15:32  source
-
-	* cl_stubs.c, sqlsrv.c: * Fixed init of itcl clo memory hook
-
-2009-09-24 14:32  source
-
-	* rdfinf.c, sqlcmps.h, trans.c: * Mergedf from V6
-
-2009-09-23 23:39  source
-
-	* sparql.sql, sqlnode.h, srvstat.c: * Merged from V6
-
-2009-09-23 23:32  source
-
-	* sparql.sql: * Added initial support for Concise Bound Description
-	  (define sql:describe-mode "CBD")
-
-2009-09-23 23:31  source
-
-	* virtual_dir.sql: * Fixed http header for id/entity
-
-2009-09-22 11:35  source
-
-	* ddlrun.c, extent.c, rdf_core.c, rdfbox.c, recovery.c, srvstat.c: * Merged from V6
-
-2009-09-22 11:31  source
-
-	* rdfbox.c: * Fixed memory leak in TALIS JSON
-
-2009-09-22 01:01  source
-
-	* dks_esc.c, http.h, rdfbox.c, sparql.sql: * Fixed TALIS JSON serialization
-
-2009-09-22 00:58  source
-
-	* dks_esc.c, http.h, rdfbox.c, sparql.sql: * FIxed TALIS-JSON serialization
-
-2009-09-21 21:57  source
-
-	* sparql2sqltext.c: * Merged from HEAD
-
-2009-09-21 21:52  source
-
-	* sparql2sqltext.c: * Fixed redundand optimization of valmode when a better valmode is found
-	  in non-NULLable variable inside OPTIONAL member.
-
-2009-09-21 10:07  source
-
-	* blob.c, hash.c, meta.c, neodisk.c, page.c, rltrx.c, space.c,
-	  sqlfn.h, sqlnode.h, srvstat.c, wi.h, widd.h, wifn.h: * Merged from V6
-
-2009-09-21 00:55  source
-
-	* search_in.c, sparql2sql.c, sparql2sqltext.c, sparql_p.y,
-	  sqlexp.c, sqlrun.c, update.c: * Merged from V6
-
-2009-09-19 20:06  source
-
-	* sparql2sql.c, sparql2sqltext.c, sparql_p.y: * Added optimization for bif:COUNT
-
-2009-09-18 18:30  source
-
-	* rdfxml_parser.c, sparql.sql, sparql2sql.c, sparql2sqltext.c,
-	  sparql_tree.c: * Fixed GPF on SPARQL query with external variable in aggregate in
-	  result-set of a scalar subquery
-	* Added support for HTML parsing mode in RDFa parser
-	* Added RDFXML_DEBUG macro
-
-2009-09-18 18:28  source
-
-	* virtual_dir.sql: * Fixed set default to rdf/xml since ODE will be broken
-
-2009-09-18 18:16  source
-
-	* rdfxml_parser.c, sparql.sql, sparql2sqltext.c, sparql_io.sql: * Merged from V6
-
-2009-09-18 00:29  source
-
-	* scn3.l, sqlbif.c, sqlpfn.h, xpath.h: * Merged from HEAD
-
-2009-09-18 00:28  source
-
-	* scn3.l, sqlbif.c, sqlpfn.h, xpath.h: * Fixed porting problem with flex 2.5.35
-
-2009-09-17 16:25  source
-
-	* bif_xml.c, insert.c, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_l.l, sparql_p.y, sparql_tree.c,
-	  sparqld.c, sqlbif.c, srvstat.c, xmltree.c, xpath.c, xslt.c: * Merged from V6
-
-2009-09-16 12:30  source
-
-	* bif_xml.c, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_l.l, sparql_p.y, sparql_tree.c, sparqld.c, xpath.c: * Added support for SCORE_LIMIT in bif:contains
-	* Fixed problem with non-ascii characters in bif:contains
-
-2009-09-16 10:06  source
-
-	* sparql.sql, xslt.c: * Fixed SPARUL INSERT of very large dictionaries
-
-2009-09-15 22:19  source
-
-	* srvstat.c: * Added settable callstack_on_exception parameter
-
-2009-09-15 11:53  source
-
-	* xmltree.c: * Fixed bif_xtree_sum64
-
-2009-09-13 23:46  source
-
-	* bif_xml.c, bitmap.c, hosting.sql, http.c, log.c, rdf_core.c,
-	  rdf_core.h, rdfbox.c, rdfxml_parser.c, rltrx.c, search.c,
-	  sparql.sql, sparql2sqltext.c, sparql_io.sql, sqlbif.c, sqlbif.h,
-	  sqlbif2.c, sqlcmps.h, sqlcost.c, sqldf.c, sqlexp.c, sqlgen.c,
-	  sqlnode.h, sqloinx.c, sqlrun.c, sqlstmts.c, update.c, wi.h,
-	  wifn.h, xmltree.c, xmltree.h: * Merged from V6
-
-2009-09-13 21:19  source
-
-	* auxfiles.c, bif_date.c, bif_file.c, bif_regexp.c, bif_soap.c,
-	  bif_text.c, bif_xml.c, blob.c, datesupp.c, ddlrun.c, dks_esc.c,
-	  http_client.c, lock.c, log.c, multibyte.c, neodisk.c, rdf_core.c,
-	  rdfbox.c, rdfinf.c, rdfxml_parser.c, search_in.c, security.c,
-	  sort.c, sparql.sql, sparql2sql.c, sparql2sqltext.c,
-	  sparql_core.c, sparql_io.sql, sparql_l.l, sparql_tree.c,
-	  sparqld.c, sql_to_c.awk, sqlbif.c, sqlo.c, srvstat.c, text.c,
-	  turtle_l.l, turtle_p.y, url_rewrite.sql, virtual_dir.sql,
-	  xmlenc.c, xmltree.c, xpath.c, xqf.c: * Fixed indentation and whitespace
-
-2009-09-13 16:20  source
-
-	* sqloinx.c: * Fixed next col dfe eq should not overwrite the previous, else going
-	  to make too many -_all-eqs
-
-2009-09-13 16:19  source
-
-	* sqlgen.c: * Fixed upd subq conditions should not mess with keyset flag
-
-2009-09-13 16:18  source
-
-	* sqldf.c: * Fixed when placing after test exp on inx int, placing cols fails
-	  because the super of the test exp is the inx int and only the
-	  first table is checked to see if it defines the ot requested by
-	  the test exp, instead of checking them all
-
-2009-09-13 16:15  source
-
-	* rdfbox.c: * Fixed missing BF_IRI for blank nodes
-
-2009-09-11 11:52  source
-
-	* bif_xml.c, rdf_core.c, rdfxml_parser.c, sparql.sql,
-	  sparql_io.sql, sqlbif2.c, xmltree.c, xmltree.h: * Fixed RDFa parser
-
-2009-09-11 11:51  source
-
-	* url_rewrite.sql: * Fixed do not escape full urls
-
-2009-09-10 12:26  source
-
-	* bif_xml.c, rdf_core.c, rdf_core.h, rdfxml_parser.c, sparql.sql,
-	  sparql_io.sql, sqlbif.c, sqlbif.h, sqlbif2.c, xmltree.c,
-	  xmltree.h: * Added initial support for RDFa parser
-
-2009-09-10 12:25  source
-
-	* sparql2sqltext.c: * Fixed AUTO mode subexpressions in a str(NULL)
-
-2009-09-10 12:24  source
-
-	* url_rewrite.sql: * Fixed placeholders in TCN rules
-
-2009-09-10 12:24  source
-
-	* hosting.sql: * Fixed server variable HTTPS to return "on" similar to Apache
-
-2009-09-04 14:28  source
-
-	* hash.c: * Merged from V6
-
-2009-09-04 12:43  source
-
-	* bif_dav.c, bif_soap.c, bif_xml.c, bitmap.c, http.c, http.h,
-	  lock.c, rltrx.c, sqlrun.c, srvstat.c, wifn.h: * Merged from V6
-
-2009-09-04 01:33  source
-
-	* url_rewrite.sql, virtual_dir.sql: * Fixed tcn support
-
-2009-09-03 12:20  source
-
-	* sparql_io.sql: * Fixed missing double-quote
-
-2009-08-28 18:07  source
-
-	* http.c, http.h, rdfbox.c, sparql.sql, sparql2sqltext.c,
-	  sparql_io.sql, sqlbif.c, sqlbif.h: * Merged from V6
-
-2009-08-28 15:08  source
-
-	* http_client.c, url_rewrite.sql, virtual_dir.sql: * Merged from V6
-
-2009-08-28 14:23  source
-
-	* sparql_io.sql: * Fixed whitespace
-
-2009-08-28 14:22  source
-
-	* sparql_io.sql: * Removed debugging output
-
-2009-08-28 12:38  source
-
-	* http.c, http.h, rdf_sponge.sql, rdfbox.c, sparql.sql,
-	  sparql2sqltext.c, sparql_io.sql, sqlbif.c, sqlbif.h: * Fixed/enhanced multiple issues in SPARQL endpoint and serializations
-	  (including NTriples, JSON, callbacks for JSON, MIME types,
-	  dict as result-set etc)
-
-2009-08-28 00:48  source
-
-	* url_rewrite.sql: * Fixed bug with absolute oriented pattern for directory
-
-2009-08-26 15:09  source
-
-	* sparql_io.sql, virtual_dir.sql: * Added support for text/n3 mime type
-
-2009-08-25 20:29  source
-
-	* http_client.c, url_rewrite.sql, virtual_dir.sql: * Fixed TCN rules
-
-2009-08-22 09:57  source
-
-	* rdf_sponge.sql, sparql_io.sql: * Merged from V6
-
-2009-08-20 20:00  source
-
-	* dks_esc.c, rdf_mapping.jso, sparql.sql, sparql2sql.h,
-	  sparql2sqltext.c, sparql_sff.c, sparqld.c, sqlbif.c, sqlbif.h,
-	  sqlrcomp.c: * Merged from V6
-
-2009-08-20 19:47  source
-
-	* dks_esc.c, rdf_mapping.jso, rdfbox.c, sparql.sql, sparql2sql.h,
-	  sparql2sqltext.c, sparql_sff.c, sparqld.c, sqlbif.c, sqlbif.h,
-	  sqlrcomp.c: * Added support for NVARCHAR in sparql
-
-2009-08-20 13:16  source
-
-	* sparql_io.sql: * Fixed missing 'else'
-
-2009-08-19 09:29  source
-
-	* 2pc.c, CLIsql1.c, auxfiles.c, bif_crypto.c, bif_explain.c,
-	  bif_file.c, bif_regexp.c, bif_text.c, bif_xml.c, blob.c, disk.c,
-	  http.c, http_client.c, insert.c, lock.c, log.c, ltrx.h,
-	  mtwrite.c, multibyte.c, neodisk.c, nquad_p.y, page.c, rdf_core.c,
-	  rdfbox.c, rdfinf.c, rdfxml_parser.c, recovery.c, rltrx.c, row.c,
-	  search.c, security.c, sparql.sql, sparql2sql.c, sparql2sqltext.c,
-	  sparql_core.c, sparql_l.l, sparqld.c, sql_to_c.awk, sqlbif.c,
-	  sqlcost.c, sqldf.c, sqlexp.c, sqlintrp.c, sqlo.c, sqlprt.c,
-	  sqlsrv.c, srvstat.c, text.c, turtle_l.l, turtle_p.y, update.c,
-	  virtual_dir.sql, xmltree.c, xpath.c: * Fixed whitespace
-
-2009-08-19 09:07  source
-
-	* sparql2sql.c, sparql_core.c, sparql_p.y, xslt.c: * Merged from V6
-
-2009-08-19 01:59  source
-
-	* bif_text.c: * Fixed indentation
-
-2009-08-19 01:59  source
-
-	* sparql2sql.c, sparql_core.c, xslt.c: * Fixed compiler warnings
-
-2009-08-19 01:58  source
-
-	* sparql2sql.c: * Fixed uninitialized variable
-
-2009-08-19 01:47  source
-
-	* bif_crypto.c: * Fixed indentation
-
-2009-08-19 01:45  source
-
-	* xpf.c: * Fixed whitespace
-
-2009-08-18 20:20  source
-
-	* CLIsql1.c, CLIsql2.c, bif_file.c, bif_text.c, ddlrun.c, disk.c,
-	  http.c, page.c, rdfbox.c, rdfinf.c, security.c, sparql.h,
-	  sparql.sql, sparql2sqltext.c, sparql_core.c, sparql_tree.c,
-	  sqlbif.c, sqlcost.c, sqldf.c, sqlexp.c, sqlnode.h, sqlo.c,
-	  turtle_p.y, xmlenc.c, xslt.c: * Merged from HEAD
-
-2009-08-18 20:17  source
-
-	* bif_file.c, http.c, http.h: * Merged from V6
-
-2009-08-18 19:49  source
-
-	* CLIsql1.c, CLIsql2.c, aqueue.c, bif_xml.c, ddlrun.c, lock.c,
-	  log.c, neodisk.c, rdfbox.c, security.c, sparql.h, sparql.sql,
-	  sparql2sqltext.c, sparql_core.c, sparql_tree.c, sqlbif.c,
-	  sqldf.c, sqlgen.c, sqlo.c, xmlenc.c, xslt.c: * Fixed whitespace at end of line
-
-2009-08-18 19:32  source
-
-	* bif_file.c, http.c, http.h: * Fixed problem with http HEAD method with dynamic content
-
-2009-08-18 01:42  source
-
-	* bif_file.c, bif_intl.c, bif_text.c, multibyte.c, multibyte.h,
-	  rdf_sponge.sql, rdfbox.c, sparql2sqltext.c, sparql_core.c,
-	  sqlbif.c, sqlcomp.c, sqlovdb.c, srvmultibyte.h, virtual_dir.sql,
-	  xpath.c, xslt.c: * Merged from V6
-
-2009-08-18 01:35  source
-
-	* bif_file.c, sparql2sqltext.c, sqlovdb.c, xslt.c: * Fixed compiler warnings
-
-2009-08-18 01:34  source
-
-	* sqlcomp.c: * Fixed wrong pointer
-
-2009-08-18 00:36  source
-
-	* rdfbox.c: * Fixed compiler warnings
-
-2009-08-18 00:34  source
-
-	* bif_file.c, bif_intl.c, bif_text.c, multibyte.c, multibyte.h,
-	  sqlbif.c, srvmultibyte.h, virtual_dir.sql, xpath.c: * Added i18N debugging macros and support for dir lists with non-LATIN-1
-	  names
-
-2009-08-18 00:33  source
-
-	* rdf_sponge.sql: * Fixed removed table option
-
-2009-08-18 00:31  source
-
-	* sparql_core.c: * Added new sparp_exec_Narg to avoid GPF in converting IRI to/from IRI_ID
-	  in SPARQL compiler
-
-2009-08-15 19:32  source
-
-	* sparql.sql, sparql_core.c, sqlbif.c, update.c: * Merged from V6
-
-2009-08-15 19:29  source
-
-	* sqlbif.c: * Fixed compiler warnings
-
-2009-08-15 12:40  source
-
-	* sparql_core.c: * Fixed variable declaration and compiler warning
-
-2009-08-15 10:40  source
-
-	* sparql.sql: * Added support for 'CREATE IRI CLASS' for nvarchar
-
-2009-08-14 15:00  source
-
-	* bif_xml.c, rdf_core.c, rdf_core.h, rdf_sponge.sql, rdfbox.c,
-	  security.c, security.h, sparql.h, sparql.sql, sparql2sql.c,
-	  sparql2sqltext.c, sparql_core.c, sparql_io.sql, sparul2sql.c,
-	  sqlnode.h, turtle_l.l, xmltree.c, xmltree.h: * Merged from V6
-
-2009-08-14 11:19  source
-
-	* bif_file.c, bif_xml.c, rdf_core.h, rdf_sponge.sql, rdfbox.c,
-	  security.c, security.h, sparql.h, sparql.sql, sparql2sql.c,
-	  sparql2sqltext.c, sparql_core.c, sparul2sql.c, sqlnode.h,
-	  turtle_l.l, xmltree.c, xmltree.h: * Added SPARQL graph-level security
-
-2009-08-14 11:19  source
-
-	* sparql_io.sql: * Fixed print XML data as escaped string in HTML outputs of SPARQL
-
-2009-08-13 01:07  source
-
-	* sqlcost.c, sqlgen.c: * Merged from V6
-
-2009-08-13 00:57  source
-
-	* sqlgen.c: * Fixed when an aggregate has a false data independent condition it must
-	  still init data independent, as they can be refd in the select that
-	  gets done even if no rows selected
-
-2009-08-13 00:55  source
-
-	* sqlcost.c: * Fixed set default card on empty table to 10 instead of 1 so that it
-	  will still prefer index lookup to full scan
-
-2009-08-12 14:37  source
-
-	* xqf.c: * Fixed parsing of xsd:int('30000')
-
-2009-08-12 09:48  source
-
-	* xqf.c: * Merged from V6
-
-2009-08-11 11:08  source
-
-	* sqlexp.c, sqlfn.h, sqlprocc.c, sqlver.h: * Merged from V6
-
-2009-08-10 10:29  source
-
-	* bif_xml.c, disk.c: * Merged from V6
-
-2009-08-09 16:59  source
-
-	* disk.c: * Fixed when saving tree roots in cpt, first set the deleted tree
-	  roots to 0 then set the rest.
-
-2009-08-09 02:11  source
-
-	* sqldf.c: * Merged from V6
-
-2009-08-08 13:48  source
-
-	* sqldf.c: * Fixed do not import conds from enclosing where into dt with a top
-	  clause
-
-2009-08-05 16:32  source
-
-	* aqueue.c, aqueue.h: * Fixed use right user acct for aqueue
-
-2009-08-05 11:14  source
-
-	* aqueue.c: * Fixed refuse to run without proper cli_client
-
-2009-08-04 20:15  source
-
-	* srvstat.c: * Merged from V6
-
-2009-08-04 20:08  source
-
-	* bitmap.c, meta.c, search_in.c, sqlfn.h, sqlgen.c, text.c, wifn.h: * Added extra key arg to ksp_cmp_func as fixed keyu cols are not in key
-	  part order but in dtp dependent order. However inlined cmp funcs only
-	  work if cols are laid out in key order
-
-2009-08-03 14:28  source
-
-	* blob.c, hash.c, page.c, sqlnode.h, sqlprt.c, system.sql,
-	  widisk.h: * Merged from V6
-
-2009-08-03 14:12  source
-
-	* srvstat.c: * Fixed gpf if no client info available
-
-2009-08-01 12:55  source
-
-	* sqlver.h: * Updated engine version to 3040
-
-2009-08-01 12:50  source
-
-	* 2pc.c, lock.c, log.c, ltrx.h, neodisk.c, sqlsrv.c: * Fixed XA to replay prepared xa branches and to keep log entry
-	  consistently during checkpoints and killing the server
-
-2009-08-01 12:23  source
-
-	* log.c: * Fixed improper setting of dbs_log_length set by log_checkpoint
-
-2009-07-31 11:10  source
-
-	* sparql_core.c: * Fixed condition
-
-2009-07-30 21:20  source
-
-	* virtual_dir.sql: * Added optimization for new proxy iri scheme
-
-2009-07-28 15:09  source
-
-	* 2pc.c, sqlsrv.c: * Merged from V6
-
-2009-07-28 15:07  source
-
-	* 2pc.c, sqlsrv.c: * Fixed gpf when tm reconnects to rm errors with distinct sub code
-
-2009-07-28 10:49  source
-
-	* http.c: * Fixed loading static http maintenance page on checkpoint and atomic
-
-2009-07-28 00:52  source
-
-	* eqlcomp.c, sqlnode.h: * Merged from V6
-
-2009-07-24 16:40  source
-
-	* http.c, sparql.sql, sparql_io.sql: * Merged from V6
-
-2009-07-24 16:37  source
-
-	* sparql.sql: * Fixed utf8 via jdbc
-
-2009-07-23 09:35  source
-
-	* datesupp.c: * Merged from HEAD
-
-2009-07-22 23:29  source
-
-	* datesupp.c: * Fixed remove leading and trailing spaces before parsing date
-
-2009-07-21 21:24  source
-
-	* 2pc.c, 2pc.h, 2pc.sql, lock.c, log.c, ltrx.h, sqlsrv.c, wi.h,
-	  wi_xid.c, widd.h: * Merged from V6
-
-2009-07-21 17:50  source
-
-	* 2pc.c, 2pc.h, 2pc.sql, log.c, ltrx.h, sqlsrv.c, wi.h, wi_xid.c: * Fixed xa_resume in Virtuoso RM
-	* Fixed wrong offsets
-	* Fixed wrong datatype for int deserialization
-	* Fixed wrong lt taken
-	* Fixed no need to keep trx string in memory, just replay and keep lt
-	  detached
-
-2009-07-20 10:34  source
-
-	* http.c: * Fixed serialization on http connection cache mtx
-
-2009-07-17 16:09  source
-
-	* rdf_sponge.sql: * Added alternative way to execute sponger
-
-2009-07-17 11:14  source
-
-	* insert.c: * Merged from V6
-
-2009-07-16 21:52  source
-
-	* sqloinx.c: * Merged from V6
-
-2009-07-16 17:34  source
-
-	* sqloinx.c: * Fixed when considering inx int, do not consider keys where there
-	  is a full match of all parts, i.e. a unique combination is already
-	  given. If you do, the inx int will be generated incorrect because
-	  tailing parts of the equality of the pk parts of the keys involved
-	  will not be generated
-
-2009-07-16 17:08  source
-
-	* http.c: * Merged from V6
-
-2009-07-16 17:06  source
-
-	* http.c: * Fixed checking values
-
-2009-07-16 15:51  source
-
-	* wi.h: * Fixed initialize n_lock_escalations to 0 or random page lock can
-	  occur
-
-2009-07-16 15:43  source
-
-	* bitmap.c: * Merged from V6
-
-2009-07-15 09:45  source
-
-	* sqlrun.c: * Fixed update casting changes to parameters of open cursors
-
-2009-07-15 06:43  source
-
-	* sqlcmps.h, sqlexp.c, sqlgen.c, sqlo.h: * When making a hash filler with a predicate filtering the hash,
-	  unplace all the ssls set during this so that if the same expression
-	  repeats again outside of the hash filler filter it will get generated
-	  again and will not ref to the ssl's value that is inapplicable.
-	  With cond exps, note the private df elts
-
-2009-07-15 00:19  source
-
-	* sqlexp.c, sqlgen.c, sqlo.h: * Merged from V6
-
-2009-07-15 00:12  source
-
-	* bitmap.c: * Fixed weird case in bm inx order
-
-2009-07-14 21:04  source
-
-	* autoexec.sql, ftp.sql, hosting.sql, http_auth.sql,
-	  information_schema.sql, mail_cli.sql, oledb.sql,
-	  rdf_schema_objects.sql, rdf_sponge.sql, repl.sql, replddk.sql,
-	  snapshot_repl.sql, sparql.sql, sparql_io.sql, system.sql,
-	  system2.sql, uddi.sql, users.sql, virtual_dir.sql, vt_text.sql,
-	  xml_view.sql: * Fixed indentation and whitespace
-
-2009-07-14 20:15  source
-
-	* bif_explain.c, insert.c, rdf_core.c, sort.c, sparql.sql,
-	  sqlintrp.c, virtual_dir.sql: * Merged from V6
-
-2009-07-12 13:41  source
-
-	* bitmap.c: * Merged from V6
-
-2009-07-10 17:34  source
-
-	* http.c, sparql_p.y, sqlo.c, sqlsrv.c, xslt_impl.h: * Merged from V6
-
-2009-07-10 15:36  source
-
-	* sparql_p.y: * Fixed problem with sparql load
-
-2009-07-10 15:35  source
-
-	* sqlo.c: * Fixed when replacing cols in inlining dts, if the col is an int
-	  constant, make it + 0 when putting it in an oby clause else it
-	  takes it for a col index
-
-2009-07-10 15:34  source
-
-	* http.c: * Fixed setup https listener via UI
-
-2009-07-09 23:43  source
-
-	* sparql.sql: * Fixed unsupported conversion from string session and the like in
-	  RDF_LONG_TO_TTL
-
-2009-07-09 20:05  source
-
-	* bif_regexp.c, insert.c, neodisk.c, rdf_core.c, recovery.c,
-	  rltrx.c, search.c, sparql2sql.c, sparql2sqltext.c, sqlcost.c,
-	  sqlexp.c: * Merged from V6
-
-2009-07-09 20:01  source
-
-	* bif_text.c, sparql.sql: * Merged from V6
-
-2009-07-09 16:03  source
-
-	* rdf_schema_objects.sql, rdf_sponge.sql, rdf_void.sql, sparql.sql,
-	  sparql_io.sql, system.sql, virtual_dir.sql: * Merged from V6
-
-2009-07-09 15:53  source
-
-	* sparql2sqltext.c, sparql_io.sql: * Merged from V6
-
-2009-07-09 13:27  source
-
-	* 2pc.c, 2pc.h, disk.c, rdf_schema_objects.sql, sqlsrv.c: * Merged from V6
-
-2009-07-09 13:21  source
-
-	* 2pc.c, 2pc.h, sqlsrv.c: * Added initial support for XA RM  suspend and resume
-
-2009-07-07 22:02  source
-
-	* sparql_core.c: * Fixed check for count and type of arguments of free-text special
-	  predicates
-
-2009-07-07 22:01  source
-
-	* sparql2sqltext.c: * Fixed printing IRI as SGG_VALMODE_BOOL
-
-2009-07-07 08:49  source
-
-	* sparql2sql.c: * Merged from V6
-
-2009-07-04 17:08  source
-
-	* sparql2sqltext.c, sparql_core.c: * Merged from V6
-
-2009-07-03 16:29  source
-
-	* sqlbif.c: * Merged from V6
-
-2009-07-03 14:46  source
-
-	* bif_xml.c, sqlexp.c, xmltree.c, xmltree.h, xslt.c, xslt_impl.h,
-	  xslt_opt.c: * Merged from V6
-
-2009-07-03 12:53  source
-
-	* bif_xml.c, xmltree.c, xmltree.h, xslt.c, xslt_impl.h, xslt_opt.c: * Added support for exclude-result-prefixes and writing namespace
-	  prefixes before use
-
-2009-07-02 11:32  source
-
-	* disk.c: * Fixed log message
-
-2009-07-02 11:12  source
-
-	* rdf_core.h, sort.c, sparql2sql.c, sqlgen.c, turtle_p.y: * Merged from V6
-
-2009-07-02 00:38  source
-
-	* rdf_core.c, rdf_core.h, turtle_p.y: * Fixed loading LISP-style lists (sequences) in TURTLE files
-
-2009-07-02 00:38  source
-
-	* sparql2sql.c: * Fixed issue when a contains() disappears because the filter is
-	  localized into UNION_L member group and stays unused
-
-2009-07-01 21:57  source
-
-	* bif_text.c, sparql_core.c, sqlo.c: * Merged from V6
-
-2009-07-01 21:21  source
-
-	* sqlo.c: * Added inlining dts traverse trees of explicit join expressions.
-	  Full ojs are left as is.  Do not expand things right of left oj
-
-2009-07-01 12:33  source
-
-	* lock.c, rdf_core.c, turtle_l.l: * Merged from V6
-
-2009-06-30 11:07  source
-
-	* rdf_core.c, turtle_l.l: * Fixed parsing \<newline> in N3
-
-2009-06-29 15:58  source
-
-	* bif_explain.c, extent.c, ltrx.h, rdf_schema_objects.sql,
-	  sparql.sql, sparql2sql.c, sqlcost.c, sqldf.c, sqlo.c, turtle_l.l: * Merged from V6
-
-2009-06-29 15:24  source
-
-	* bif_explain.c, ltrx.h, sqldf.c, sqlo.c: * Fixed SQL compiler so it accepts joins without making dt s all the time
-	  which is slowing down execution
-
-2009-06-29 15:23  source
-
-	* rdf_schema_objects.sql, sparql.sql: * Added support for bigint cols in rdf views
-
-2009-06-29 15:20  source
-
-	* sparql2sql.c: * Fixed GPF on flattening of sub-GP that contains a potential nullable
-	  non-exported variable
-
-2009-06-26 19:16  source
-
-	* rdf_schema_objects.sql, sparql2sql.c, sparql2sqltext.c,
-	  sparql_core.c, sparql_p.y, turtle_l.l, virtual_dir.sql: * Merged from V6
-
-2009-06-26 17:55  source
-
-	* sparql.h, sparql2sql.c, sparql_io.sql, sparql_p.y, sparql_qm.c: * Fixed HTML output of XML entities is now complete
-	* Fixed NOT FROM NAMED
-
-2009-06-26 17:53  source
-
-	* rdf_schema_objects.sql, virtual_dir.sql: * Fixed duplicates in FROM
-	* Fixed generation for tablenames with space
-
-2009-06-25 19:48  source
-
-	* rdf_schema_objects.sql: * Fixed splitting the views onto smaller parts
-
-2009-06-25 16:17  source
-
-	* sparql_io.sql: * Merged from V6
-
-2009-06-25 11:51  source
-
-	* sparql2sql.c, sparql2sqltext.c, sparql_core.c, sparql_p.y: * Added new optimizations for codegen for OPTIONAL
-
-2009-06-23 21:40  source
-
-	* rdfinf.c: * Merged from V6
-
-2009-06-23 14:58  source
-
-	* bif_file.c: * Fixed bug in Adobe Flash platform which caused HTTP POST file uploads
-	  to fail
-
-2009-06-23 14:48  source
-
-	* bif_file.c: * Merged from V6
-
-2009-06-23 14:11  source
-
-	* http_client.c: * Merged from HEAD
-
-2009-06-23 13:52  source
-
-	* http_client.c: * Fixed wrong length calculation
-
-2009-06-23 13:18  source
-
-	* Makefile.am, sqlsrv.c: * Merged from HEAD
-
-2009-06-23 13:07  source
-
-	* Makefile.am: * Fixed rule for (re)generating cached_resources.c
-
-2009-06-22 14:37  source
-
-	* bif_file.c: * Fixed bug reading from pipe
-
-2009-06-22 11:56  source
-
-	* search.c: * Mergred from V6
-
-2009-06-22 10:06  source
-
-	* log.c, sqlo.c, sqlo.h, sqlsrv.c: * Merged from HEAD
-
-2009-06-22 09:28  source
-
-	* nquad_p.y, rdf_core.c, rdf_core.h, rdfxml_parser.c, sparql_l.l,
-	  turtle_l.l, turtle_p.y: * Fixed turtle and nquads validation
-	* Fixed memory leaks on errors
-	* Fixed error recovery
-
-2009-06-22 09:27  source
-
-	* sqlsrv.c: * Fixed running out of threads
-
-2009-06-19 12:23  source
-
-	* 2pc.c, rdf_core.c, sparql_l.l, sqlsrv.c, turtle_l.l, wi_xid.c,
-	  wi_xid.h: * Merged from V6
-
-2009-06-18 22:08  source
-
-	* sqlbif.c: * Fixed setting sequence from registry at startup since V6 has stored
-	  procedure with same name
-
-2009-06-18 16:30  source
-
-	* mtwrite.c: * Merged from V6
-
-2009-06-18 12:06  source
-
-	* bif_xper.c, bitmap.c, blob.c, mtwrite.c, neodisk.c, row.c,
-	  srvstat.c, wifn.h: * Merged from V6
-
-2009-06-17 11:43  source
-
-	* rdf_core.c, rdf_core.h, sparql.h, sparql.sql, sparql_core.c,
-	  sparql_io.sql, sparql_p.y, sparql_qm.c: * Merged from V6
-
-2009-06-17 09:47  source
-
-	* sparql_core.c, sparql_p.y: * Fixed several issues using SPARQL LOAD
-
-2009-06-16 18:30  source
-
-	* 2pc.c, sqlsrv.c: * Fixed XA support
-
-2009-06-15 16:04  source
-
-	* sparql2sqltext.c: * Fixed stack check margin
-
-2009-06-15 15:20  source
-
-	* CLIsql1.c: * Merged from V6
-
-2009-06-15 11:42  source
-
-	* CLIsql1.c: * Fixed move srand to SQLAllocEnv to make sure it is only called once
-
-2009-06-14 20:31  source
-
-	* ddlrun.c: * Merged from V6
-
-2009-06-12 16:07  source
-
-	* sqlcomp.c, sqlcost.c: * Merged from V6
-
-2009-06-12 13:35  source
-
-	* sqlcomp.c, sqlcost.c: * Fixed valgrind warnings about ref to uninit data
-
-2009-06-12 12:16  source
-
-	* 2pc.c, sqlsrv.c: * Fixed allocate error struct, never use SQL_ERROR as it causes deref -1
-
-2009-06-11 22:10  source
-
-	* bif_text.c, rdfbox.c, sqlver.h: * Merged from V6
-
-2009-06-11 21:43  source
-
-	* 2pc.c, wi_xid.c, wi_xid.h: * Fixed problem with xa on 64bit machines
-
-2009-06-11 21:42  source
-
-	* sqlcomp.c: * Fixed return error if star in place of a col in an exp
-
-2009-06-11 10:29  source
-
-	* sparql_core.c: * Merged from V6
-
-2009-06-10 22:14  source
-
-	* sparql_core.c: * Fixed query re airports with lat,long and four optional runways
-
-2009-06-10 16:13  source
-
-	* extent.c, extent.h, sqlcmps.h, sqlexp.c: * Merged from V6
-
-2009-06-10 09:29  source
-
-	* lock.c, meta.c: * Fixed protect schema for longer period
-
-2009-06-09 16:09  source
-
-	* rdf_schema_objects.sql, sparql.sql, sparql_core.c, system.sql: * Merged from V6
-
-2009-06-09 13:17  source
-
-	* system.sql: * Fixed missing grant
-
-2009-06-09 00:50  source
-
-	* rdf_schema_objects.sql, sparql.sql, system.sql: * Fixed fake ns prefix
-	* Fixed long varbinary to be an obj ref, unless setup for other type
-	* Fixed use of columns for tables and view; we cannot use sys_cols here
-	  because there are under tables as well as migrated tables
-
-2009-06-09 00:48  source
-
-	* sparql2sqltext.c: * Fixed compilation of query with equality for T_IN variable and a constant
-	  and without a ny other use of T_IN variable outside the transitive part.
-
-2009-06-09 00:28  source
-
-	* sparql.sql, sparql2sqltext.c: * Merged from V6
-
-2009-06-08 16:27  source
-
-	* disk.c, remote.h, sqlfn.h, sqlver.h, wi.h, widisk.h: * Merged from V6
-
-2009-06-08 15:17  source
-
-	* rdf_sponge.sql: * Fixed transaction boundaries
-	* Fixed bad test for /rdf/about uri
-
-2009-06-08 15:16  source
-
-	* rdfbox.c: * Fixed ttl serialization
-
-2009-06-08 15:15  source
-
-	* sparql.sql, sparql_core.c: * Fixed do not create locks when compiling sparql inline
-
-2009-06-08 10:54  source
-
-	* nquad_p.y, rdf_core.c, rdf_core.h, rdfbox.c, rdfxml_parser.c,
-	  turtle_l.l, turtle_p.y: * Merged from V6
-
-2009-06-07 12:30  source
-
-	* rdf_core.c, rdfbox.c: * Fixed TTL serialization of IRIs with local parts beginning with '-'
-	* Fixed TTL serialization for redundant namespace decls
-
-2009-06-07 12:26  source
-
-	* bitmap.c, lock.c, ltrx.h, neodisk.c, rdf_core.c, rdfbox.c,
-	  rltrx.c: * Merged from V6
-
-2009-06-05 21:52  source
-
-	* sparql2sqltext.c: * Fixed codegen of function call when native rettype of function is
-	  SSG_VALMODE_LONG and needed is SSG_VALMODE_SHORT_OR_LONG
-
-2009-06-05 21:50  source
-
-	* rdf_schema_objects.sql: * Fixed editing properties
-	* Fixed use prefs not virtrdf
-	* Fixed pkcols
-
-2009-06-05 21:50  source
-
-	* rdf_core.h, turtle_l.l: * Fixed recover form syntax error on badly formed bnode IDs in TURTLE
-
-2009-06-05 21:43  source
-
-	* rdf_core.h, rdf_schema_objects.sql, sparql2sqltext.c, turtle_l.l: * Merged from V6
-
-2009-06-04 16:51  source
-
-	* sqlbif.c, sqlcomp.c: * Merged from V6
-
-2009-06-04 14:32  source
-
-	* sparql2sqltext.c: * Fixed whitespace
-
-2009-06-04 14:31  source
-
-	* rdf_sponge.sql: * Fixed use proxy iri for pinging
-
-2009-06-04 14:31  source
-
-	* obackup.c: * Fixed allow clients to run during online backup
-
-2009-06-04 09:41  source
-
-	* CLI.h, CLIsql1.c, CLIsql3.c, bif_file.c, ddlrun.c, disk.c,
-	  extent.c, mtwrite.c, obackup.c, rdf_core.h,
-	  rdf_schema_objects.sql, rdf_sponge.sql, rdfbox.c, rdfinf.c,
-	  sparql.sql, sparql2sqltext.c, sparql_io.sql, sql3.y, sqlparext.h,
-	  sqlwords.gperf, system.sql, xslt.c: * Merged from V6
-
-2009-06-03 17:21  source
-
-	* .cvsignore, Makefile.am, nquad_p.y, rdf_core.h, sparql.h,
-	  sparql.sql, sparql2sqltext.c, sparql_core.c, sparqld.c,
-	  sqlovdb.c, turtle_l.l, turtle_p.y, xslt.c: * Added support for NQuads
-	* Fixed minor problem in TURTLE parser
-	* Fixed Talis JSON support
-
-2009-06-03 17:04  source
-
-	* rdf_core.h, rdfbox.c, sparql.sql, sparql2sqltext.c,
-	  sparql_io.sql: * Added support for Talis-style JSON an N-Triples
-
-2009-06-03 17:01  source
-
-	* disk.c, mtwrite.c: * Fixed use LSEEK in case system has largefile support
-
-2009-06-03 14:34  source
-
-	* CLI.h, CLIsql1.c, CLIsql3.c: * Added initial support for failover/roundrobin connections
-
-2009-06-03 13:32  source
-
-	* rdf_schema_objects.sql, sparql.h, sparql.sql, sparql2sqltext.c,
-	  sparql_core.c, sparqld.c: * Merged from V6
-
-2009-06-02 17:07  source
-
-	* rdf_schema_objects.sql: * Fixed separate class decl
-
-2009-06-02 13:51  source
-
-	* wi.h: * Fixed missing define
-
-2009-06-02 13:23  source
-
-	* rdf_mapping.jso, sparql.h, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_tree.c, sparqld.c: * Added new optimizations for handling of OPTIONAL clause in SPARQL
-	* Fixed small bugs
-
-2009-06-02 13:21  source
-
-	* sparql.sql: * Fixed SPARUL_CLEAR with IRI_ID argument instead of IRI
-	  and LANGMATCHES on NULL
-
-2009-06-02 13:20  source
-
-	* sqlbif.c: * Fixed use 0 for negative scale in exec result names
-
-2009-06-02 13:19  source
-
-	* aqueue.c: * Fixed automatic commit on rb of an aq function; leaves no locks
-	  in error exit
-
-2009-06-02 12:27  source
-
-	* rdf_mapping.jso, rdf_sponge.sql, sparql.h, sparql2sql.c,
-	  sparql2sql.h, sparql2sqltext.c, sparql_core.c, sparql_tree.c,
-	  sparqld.c: * Merged from V6
-
-2009-05-31 15:10  source
-
-	* .cvsignore, CLIsql2.c, Makefile.am, ddlrun.c, http.c, nquad_p.y,
-	  rdf_core.h, rdf_schema_objects.sql, rdf_sponge.sql, sparql2sql.c,
-	  turtle_l.l, turtle_p.y, users.sql, virtual_dir.sql: * Merged from V6
-
-2009-05-29 15:03  source
-
-	* rdf_schema_objects.sql: * Fixed labeling support
-
-2009-05-29 15:03  source
-
-	* rdf_sponge.sql: * Fixed use rest protocol
-
-2009-05-29 15:03  source
-
-	* http.c: * Fixed must use a loop
-
-2009-05-27 13:39  source
-
-	* virtual_dir.sql: * Fixed canonic port
-
-2009-05-26 17:03  source
-
-	* CLIsql2.c: * Fixed SQLGetInfo returning 32bit integer values/masks
-
-2009-05-26 13:33  source
-
-	* rdf_schema_objects.sql: * Fixed wrong suffix
-
-2009-05-26 13:32  source
-
-	* sparql2sql.c: * Fixed bad argument to call
-
-2009-05-26 13:31  source
-
-	* sparql2sqltext.c: * Added extra stack protect
-
-2009-05-26 13:31  source
-
-	* virtual_dir.sql: * Fixed use new iri scheme
-
-2009-05-26 13:31  source
-
-	* http.c: * Fixed use 822 mode for Accept
-
-2009-05-25 12:02  source
-
-	* http.c: * Fixed headers concatination as they can be N*
-
-2009-05-22 21:51  source
-
-	* ddlrun.c, http.c, rdf_schema_objects.sql, sqlcost.c, sqldf.c,
-	  sqlexp.c, sqlgen.c, sqlintrp.c, sqlocr.c: * Merged from V6
-
-2009-05-22 18:13  source
-
-	* sort.c, sqlbif.c: * Added support for vectors in IN predicate
-
-2009-05-22 17:56  source
-
-	* sparql.sql: * Fixed DESCRIBE with known graph
-
-2009-05-22 17:55  source
-
-	* rdf_schema_objects.sql: * Added support to use column descriptions for content handling
-
-2009-05-21 09:57  source
-
-	* neodisk.c, rdfinf.c, rdfxml_parser.c, sparql.sql, sparql2sql.c,
-	  sparql2sqltext.c, sparqld.c, srvstat.c, turtle_l.l: * Merged from V6
-
-2009-05-18 22:20  source
-
-	* ddlrun.c, scn3.l, sparql.sql, sqlfn.h, sqlsrv.c, wifn.h: * Fixed problem compiling rdf view containing sparql subselect
-	  When view is defined as sparql subselect, signal error on 1st init
-	  phase.  After rdf is initialized, read view again and try to re-compile
-	  the ones containing sparql subselect. This is needed to handle dt from
-	  sparql query over rdf view.
-
-2009-05-18 22:17  source
-
-	* http.c: * Fixed ignore the 406 error code for hosing and eventually proxy
-
-2009-05-18 22:16  source
-
-	* sparql_tree.c: * Added stack check
-
-2009-05-18 12:51  source
-
-	* sqldf.c: * Merged from V6
-
-2009-05-18 12:42  source
-
-	* CLIuti.c, odbccat.c, odbccat.sql, shcompo.c: * Merged from HEAD
-
-2009-05-18 11:56  source
-
-	* bif_explain.c, http.c, http.h, shcompo.c, sqldf.c, xmlenc.c: * Merged from V6
-
-2009-05-15 12:58  source
-
-	* cl_stubs.c: * Merged from V6
-
-2009-05-15 12:36  source
-
-	* http.c, http.h: * Fixed return 406 when asked for some unavailable mime type
-
-2009-05-15 12:35  source
-
-	* xmlenc.c: * Added DSA support for certificates
-
-2009-05-14 15:52  source
-
-	* rdf_schema_objects.sql, sqlnode.h, ssl.c: * Merged from V6
-
-2009-05-14 15:33  source
-
-	* shcompo.c: * Fixed memory leak
-
-2009-05-13 14:15  source
-
-	* sparql.sql: * Fixed startup latency
-
-2009-05-13 10:12  source
-
-	* bif_explain.c, bitmap.c, disk.c, eqlcomp.c, eqlcomp.h, hash.c,
-	  rdfinf.c, row.c, search.c, sort.c, sql3.y, sqlbif.c, sqlcmps.h,
-	  sqlcomp.c, sqlcost.c, sqldf.c, sqlexp.c, sqlfn.h, sqlgen.c,
-	  sqlhash.c, sqlintrp.c, sqlnode.h, sqlo.c, sqlo.h, sqlparext.h,
-	  sqlprocc.c, sqlrun.c, sqlver.h, srvstat.c: * Merged from V6
-
-2009-05-12 23:54  source
-
-	* rdf_schema_objects.sql: * Fixed separate vd for ontology
-
-2009-05-12 23:53  source
-
-	* url_rewrite.sql: * Fixed URLs like /resource/Category:Internet_Society when doing TCN
-	* Fixed missing escape of resource
-
-2009-05-11 09:36  source
-
-	* arith.c, bif_file.c, bif_soap.c, bif_xml.c, hosting.c,
-	  http_client.c, obackup.c, page.c, rdf_sponge.sql, recovery.c,
-	  sqlrun.c, xmlenc-dec.c, xmlenc.c, xpath.c, xslt_opt.c: * Merged from V6
-
-2009-05-11 09:19  source
-
-	* rdf_sponge.sql: * Fixed temp disable using aq until gpf is fixed
-
-2009-05-08 16:45  source
-
-	* arith.c, bif_file.c, bif_soap.c, bif_xml.c, hosting.c,
-	  http_client.c, obackup.c, recovery.c, sqlrun.c, xmlenc-dec.c,
-	  xmlenc.c, xpath.c, xslt_opt.c: * Fixed gcc -Wformat-security warnings
-
-2009-05-07 21:23  source
-
-	* rdf_sponge.sql: * Added support for executing sponge in AQ, eliminating possiblity
-	  of incorrect cache
-	* Fixed if bad RDF revert to cartridges
-
-2009-05-07 21:22  source
-
-	* system2.sql: * Added functions encode_b32_num and decode_b32_num for shortning
-	  integer ids
-
-2009-05-05 16:03  source
-
-	* rdf_schema_objects.sql, sparql.sql, sparql_p.y, xmlenc.c: * Merged from V6
-
-2009-05-05 15:24  source
-
-	* rdf_schema_objects.sql, sparql.sql, sparql_p.y: * Added support for optional SILENT keyword in quad map manipulation
-	  grammar
-
-2009-05-05 00:30  source
-
-	* xmlenc.c: * Fixed set the evp key member when making the rsa key
-
-2009-05-03 22:47  source
-
-	* sparql.h, sparql.sql, sparql2sql.c, sparql_core.c, sparql_p.y,
-	  sparul2sql.c: *  Added application-specific callbacks for graph-level security
-
-2009-05-03 22:47  source
-
-	* xmlenc.c: * Fixed avoid hardcoded values when makeing a cert
-
-2009-05-03 22:45  source
-
-	* bif_regexp.c, rdfbox.c: * Fixed SPARQL REGEX i18n patterns
-
-2009-05-03 14:54  source
-
-	* bif_regexp.c, rdfbox.c: * Fixed problems with i18n in REGEX
-
-2009-05-03 12:27  source
-
-	* sparql.h, sparql.sql, sparql2sql.c, sparql_core.c, sparul2sql.c: * Added application specific callbacks to graph-level security
-
-2009-04-29 16:48  source
-
-	* sparql.h, sparql.sql, sparql_core.c, sparql_p.y: * Added additional checks for graph security
-
-2009-04-29 16:48  source
-
-	* xpathp.y: * Added support for (exp) in FT expressions
-
-2009-04-29 16:47  source
-
-	* bif_regexp.c: * Added extra flags s (DOTALL) and u (UTF-8) for regex_match
-
-2009-04-24 18:02  source
-
-	* xpathp.y: * Added ( exp ) in FT expression
-
-2009-04-23 14:02  source
-
-	* rdf_core.c: * Merged from V6
-
-2009-04-22 21:47  source
-
-	* rdf_sponge.sql, sqlbif.c, xslt.c: * Merged from V6
-
-2009-04-22 21:41  source
-
-	* rdf_sponge.sql: * Fixed new param for sparul_clear
-
-2009-04-22 20:29  source
-
-	* system.sql: * Merged from V6
-
-2009-04-22 14:47  source
-
-	* sqlbif.h, sqlbif2.c: * Merged from V6
-
-2009-04-22 14:36  source
-
-	* sqlbif2.c: * Merged from V6
-
-2009-04-22 10:37  source
-
-	* blobio.c, sqlsrv.c: * Merged from V6
-
-2009-04-21 20:49  source
-
-	* rdf_void.sql, sqlrun.c: * Merged from V6
-
-2009-04-21 16:35  source
-
-	* sqlver.h: * Updated version to 05.11.3039
-
-2009-04-21 16:34  source
-
-	* sqlver.h: * Updated version to 06.00.3118
-
-2009-04-21 12:45  source
-
-	* sqlcost.c: * Merged from V6
-
-2009-04-21 11:03  source
-
-	* sqlrun.c: * Merged from V6
-
-2009-04-20 23:22  source
-
-	* sqlsrv.c: * Removed debug warning
-
-2009-04-19 11:52  source
-
-	* sparql2sql.h, sparql_sff.c: * Fixed compiler warnings
-
-2009-04-18 23:55  source
-
-	* 2pc.c, 2pc.h, 2pc.sql, 2pc_client.c, 2pc_client.h, CLI.h,
-	  CLIodbc3.c, CLIuti.c, Makefile.am, aqueue.c, aqueue.h, arith.c,
-	  arith.h, autoexec.sql, auxfiles.c, bif_crypto.c, bif_date.c,
-	  bif_dav.c, bif_diff.c, bif_explain.c, bif_file.c, bif_gnw.c,
-	  bif_intl.c, bif_json.c, bif_kerberoscli.c, bif_ldapcli.c,
-	  bif_mts.c, bif_nntp.c, bif_phrasematch.c, bif_pop3.c,
-	  bif_purify.c, bif_regexp.c, bif_repl.c, bif_smtp.c, bif_soap.c,
-	  bif_text.c, bif_text.h, bif_tidy.c, bif_uuencode.c, bif_xml.c,
-	  bif_xper.c, bif_xper.h, bitmap.c, bitmap.h, blob.c, blobio.c,
-	  blobio.h, cluster.h, crsr.h, crypt.c, date.h, datesupp.c,
-	  datesupp.h, ddlrun.c, disk.c, dks_esc.c, eqlcomp.c, eqlcomp.h,
-	  extent.c, extent.h, ftp.sql, gate.c, hash.c, hosting.c,
-	  hosting.h, hosting.sql, http.c, http.h, http_auth.sql,
-	  http_client.c, http_client.h, insert.c, inxop.c, iodbcinst.c,
-	  jso.c, jso.h, jso_reformat.awk, json.l, json.y, ksrvext.h,
-	  ksrvextphp.h, lisprdr.c, lisprdr.h, list2.h, list_lex_props.sh,
-	  lock.c, log.c, log.h, ltrx.h, mail_cli.sql, map_schema.c,
-	  map_schema.h, meta.c, msdtc.h, mts.h, mts_client.c, mts_client.h,
-	  mts_com.cpp, mts_com.h, mtwrite.c, mtx.cpp, multibyte.c,
-	  multibyte.h, name.c, neodisk.c, nn_svr.sql, numeric.c, numeric.h,
-	  obackup.c, odbccat.c, odbccat.sql, odbcinc.h, oledb.sql,
-	  openxml.sql, page.c, phrasematch.sql, pldbgcli.c, pldebug.c,
-	  pldebug.h, plugin_gate.c, plugin_loader.c, pop3_svr.sql,
-	  rdf_core.c, rdf_core.h, rdf_void.sql, rdfbox.c, rdfinf.c,
-	  rdfinf.h, rdfxml_parser.c, recovery.c, recovery.h, regist.c,
-	  remote.h, rendezvous.c, rendezvous.h, repl.h, repl.sql, repldb.c,
-	  replddk.sql, replpush.c, replsr.h, replsri.c, replsub.c, rltrx.c,
-	  row.c, schspace.c, schspace.h, scn3.l, search.c, search_in.c,
-	  security.c, security.h, sha.h, shcompo.c, shcompo.h, shuric.c,
-	  shuric.h, snapshot_repl.sql, soap.h, soap.sql, sort.c, space.c,
-	  sparql.h, sparql.sql, sparql2sql.c, sparql2sqltext.c,
-	  sparql_core.c, sparql_io.sql, sparql_l.l, sparql_p.y,
-	  sparql_qm.c, sparql_tree.c, sparqld.c, sparul2sql.c, sql3.y,
-	  sql3_vc.c, sql_code_blog.c, sql_code_cache_impl.c, sql_to_c.awk,
-	  sqlbif.c, sqlbif.h, sqlbif2.c, sqlcmps.h, sqlcomp.c, sqlcomp.h,
-	  sqlcomp2.c, sqlcost.c, sqlcr.c, sqlcstate.h, sqldf.c, sqlexp.c,
-	  sqlfn.h, sqlgen.c, sqlhash.c, sqlintrp.c, sqlintrp.h, sqlnode.h,
-	  sqlo.c, sqlo.h, sqloby.c, sqlocr.c, sqlocr.h, sqlofn.h,
-	  sqloinv.c, sqloinv.h, sqloinx.c, sqlopcod.h, sqloprt.c,
-	  sqlorder.c, sqlovdb.c, sqlpar.h, sqlparext.h, sqlpfn.c, sqlpfn.h,
-	  sqlprocc.c, sqlprt.c, sqlrbuf.c, sqlrcomp.c, sqlrcomp.h,
-	  sqlrrun.c, sqlrun.c, sqlsrv.c, sqlstmts.c, sqltrig.c, sqltype.c,
-	  sqltype.h, sqltype_c.h, sqlver.c, sqlver.h, sqlview.c, srvcr.c,
-	  srvmultibyte.c, srvmultibyte.h, srvstat.c, srvstat.h, ssl.c,
-	  statuslog.h, string.c, string_tmpl.c, strlike.h, subseq.c,
-	  subseq.h, system.sql, system2.sql, text.c, text.h, trans.c,
-	  turtle_l.l, turtle_p.y, uddi.sql, update.c, useraggr.sql,
-	  users.sql, uuencode.c, uuencode_impl.h, vdb.sql, virtext.h,
-	  virtpwd.h, virtual_dir.sql, vt_text.sql, wi.h, wi_xid.c,
-	  wi_xid.h, widd.h, widisk.h, widv.h, wifn.h, wirpc.c, wirpce.h,
-	  wiservic.c, wiservic.h, xml.h, xml_a.sql, xml_view.sql, xmla.sql,
-	  xmlenc-dec.c, xmlenc.c, xmlenc.h, xmlenc_algos.c, xmlenc_algos.h,
-	  xmlenc_test.h, xmlgen.h, xmlnode.h, xmlres.h, xmlschema.c,
-	  xmlsearch.c, xmlsql.c, xmltree.c, xmltree.h, xpath.c, xpath.h,
-	  xpathp.y, xpathp_impl.h, xpf.c, xpf.h, xpscn.l, xqf.c, xqf.h,
-	  xslt.c, xslt_fmt.c, xslt_impl.h, xslt_opt.c: * Code cleanups
-
-2009-04-18 16:00  source
-
-	* 2pc.c, 2pc.h, 2pc.sql, 2pc_client.c, 2pc_client.h, CLI.h,
-	  CLIodbc3.c, CLIuti.c, Makefile.am, aqueue.h, arith.c, arith.h,
-	  autoexec.sql, auxfiles.c, bif_crypto.c, bif_date.c, bif_dav.c,
-	  bif_diff.c, bif_explain.c, bif_file.c, bif_gnw.c, bif_intl.c,
-	  bif_json.c, bif_kerberoscli.c, bif_ldapcli.c, bif_mts.c,
-	  bif_nntp.c, bif_phrasematch.c, bif_pop3.c, bif_purify.c,
-	  bif_regexp.c, bif_repl.c, bif_smtp.c, bif_soap.c, bif_text.c,
-	  bif_text.h, bif_tidy.c, bif_uuencode.c, bif_xml.c, bif_xper.c,
-	  bif_xper.h, bitmap.c, bitmap.h, blob.c, blobio.c, blobio.h,
-	  crsr.h, crypt.c, date.h, datesupp.c, datesupp.h, ddlrun.c,
-	  disk.c, dks_esc.c, eqlcomp.c, eqlcomp.h, ftp.sql, gate.c, hash.c,
-	  hosting.c, hosting.h, hosting.sql, http.c, http.h, http_auth.sql,
-	  http_client.c, http_client.h, insert.c, inxop.c, iodbcinst.c,
-	  jso.c, jso.h, jso_reformat.awk, json.l, json.y, ksrvext.h,
-	  ksrvextphp.h, lisprdr.c, lisprdr.h, list2.h, list_lex_props.sh,
-	  lock.c, log.c, log.h, ltrx.h, mail_cli.sql, map_schema.c,
-	  map_schema.h, meta.c, msdtc.h, mts.h, mts_client.c, mts_client.h,
-	  mts_com.cpp, mts_com.h, mtwrite.c, mtx.cpp, multibyte.c,
-	  multibyte.h, name.c, neodisk.c, nn_svr.sql, numeric.c, numeric.h,
-	  obackup.c, odbccat.c, odbccat.sql, odbcinc.h, oledb.sql,
-	  openxml.sql, phrasematch.sql, pldbgcli.c, pldebug.c, pldebug.h,
-	  plugin_gate.c, plugin_loader.c, pop3_svr.sql, rdf_core.c,
-	  rdf_core.h, rdfbox.c, rdfinf.c, rdfinf.h, rdfxml_parser.c,
-	  recovery.c, recovery.h, regist.c, remote.h, rendezvous.c,
-	  rendezvous.h, repl.h, repl.sql, repldb.c, replddk.sql,
-	  replpush.c, replsr.h, replsri.c, replsub.c, rltrx.c, row.c,
-	  schspace.c, schspace.h, scn3.l, search.c, search_in.c,
-	  security.c, security.h, sha.h, shcompo.c, shcompo.h, shuric.c,
-	  shuric.h, snapshot_repl.sql, soap.h, soap.sql, sort.c, space.c,
-	  sparql.h, sparql.sql, sparql2sql.c, sparql2sqltext.c,
-	  sparql_core.c, sparql_l.l, sparql_p.y, sparql_qm.c,
-	  sparql_tree.c, sparqld.c, sparul2sql.c, sql3.y, sql3_vc.c,
-	  sql_code_blog.c, sql_code_cache_impl.c, sql_to_c.awk, sqlbif.c,
-	  sqlbif.h, sqlbif2.c, sqlcmps.h, sqlcomp.c, sqlcomp.h, sqlcomp2.c,
-	  sqlcost.c, sqlcr.c, sqlcstate.h, sqldf.c, sqlexp.c, sqlfn.h,
-	  sqlgen.c, sqlhash.c, sqlintrp.c, sqlintrp.h, sqlnode.h, sqlo.c,
-	  sqlo.h, sqloby.c, sqlocr.c, sqlocr.h, sqlofn.h, sqloinv.c,
-	  sqloinv.h, sqloinx.c, sqlopcod.h, sqloprt.c, sqlorder.c,
-	  sqlovdb.c, sqlpar.h, sqlparext.h, sqlpfn.c, sqlpfn.h, sqlprocc.c,
-	  sqlprt.c, sqlrbuf.c, sqlrcomp.c, sqlrcomp.h, sqlrrun.c, sqlrun.c,
-	  sqlsrv.c, sqlstmts.c, sqltrig.c, sqltype.c, sqltype.h,
-	  sqltype_c.h, sqlver.c, sqlver.h, sqlview.c, srvcr.c,
-	  srvmultibyte.c, srvmultibyte.h, srvstat.c, srvstat.h, ssl.c,
-	  statuslog.h, string.c, string_tmpl.c, strlike.h, subseq.c,
-	  subseq.h, system.sql, system2.sql, text.c, text.h, turtle_l.l,
-	  turtle_p.y, uddi.sql, update.c, useraggr.sql, users.sql,
-	  uuencode.c, uuencode_impl.h, vdb.sql, virtext.h, virtpwd.h,
-	  virtual_dir.sql, vt_text.sql, wi.h, wi_xid.c, wi_xid.h, widd.h,
-	  widisk.h, widv.h, wifn.h, wirpc.c, wirpce.h, wiservic.c,
-	  wiservic.h, xml.h, xml_a.sql, xml_view.sql, xmla.sql,
-	  xmlenc-dec.c, xmlenc.c, xmlenc.h, xmlenc_algos.c, xmlenc_algos.h,
-	  xmlenc_test.h, xmlgen.h, xmlnode.h, xmlres.h, xmlschema.c,
-	  xmlsearch.c, xmlsql.c, xmltree.c, xmltree.h, xpath.c, xpath.h,
-	  xpathp.y, xpathp_impl.h, xpf.c, xpf.h, xpscn.l, xqf.c, xqf.h,
-	  xslt.c, xslt_fmt.c, xslt_impl.h, xslt_opt.c: * Code cleanup
-
-2009-04-18 10:32  source
-
-	* sparql2sql.h, sparql_sff.c: * Merged from HEAD
-
-2009-04-18 10:12  source
-
-	* jso.c: * Merged from HEAD
-
-2009-04-18 10:09  source
-
-	* jso.c: * Fixed handling of class instance array
-
-2009-04-17 14:01  source
-
-	* Makefile.am: [no log message]
-
-2009-04-17 13:59  source
-
-	* Makefile.am: * Added missing files to distribution
-
-2009-04-16 22:35  source
-
-	* sparql.sql, sparql2sqltext.c, sparql_core.c, sparql_io.sql,
-	  sparql_tree.c: * Merged from V6
-
-2009-04-16 21:34  source
-
-	* bif_regexp.c: * Merged from HEAD
-
-2009-04-16 21:33  source
-
-	* bif_regexp.c: * Fix for FILTER regex(?o, "P\u00E5", "i" )
-
-2009-04-16 21:08  source
-
-	* sparql2sql.h, sqlbif.c: * Merged from HEAD
-
-2009-04-16 19:45  source
-
-	* sparql.sql, sparql2sqltext.c: * Merged from V6
-
-2009-04-16 17:42  source
-
-	* rdf_void.sql, sparql.sql: * Merged from V6
-
-2009-04-16 17:00  source
-
-	* sparql.sql, sparql2sqltext.c: * Added more support for SHORT_OR_LONG
-
-2009-04-16 12:17  source
-
-	* sparql.sql, sparql2sql.h, sparql2sqltext.c, sparql_core.c: * Added support for SSG_VALMODE_SHORT_OR_LONG
-
-2009-04-16 11:54  source
-
-	* rdf_core.c, rdf_core.h, sparql.sql, sparql2sqltext.c,
-	  sparql_core.c, sparql_io.sql: * Merged from V6
-
-2009-04-16 11:48  source
-
-	* 2pc.c, cluster.h, ddlrun.c, disk.c, json.y, lock.c, neodisk.c,
-	  obackup.c, page.c, rdfinf.c, row.c, search.c, sqlbif.c,
-	  sqlintrp.c, sqlorder.c, sqlovdb.c, srvstat.c: * Fixed compiler warnings
-
-2009-04-16 11:48  source
-
-	* cov_report.xsl, wsdl2rdf.xsl: * Fixed header
-
-2009-04-16 09:55  source
-
-	* wsdl2rdf.xsl: * Fixed missing header
-
-2009-04-16 09:54  source
-
-	* 2pc.c, ddlrun.c, lock.c, sqlbif.c: * Fixed compiler warnings
-
-2009-04-15 16:32  source
-
-	* Makefile.am, aqueue.c, aqueue.h, auxfiles.c, bif_explain.c,
-	  bif_file.c, bif_text.c, bif_text.h, bif_xml.c, bitmap.c,
-	  bitmap.h, blob.c, blobio.c, blobio.h, cl_stubs.c, cluster.h,
-	  ddlrun.c, disk.c, eqlcomp.c, eqlcomp.h, extent.c, extent.h,
-	  gate.c, hash.c, http.c, http_auth.sql, insert.c, inxop.c,
-	  ksrvext.h, lock.c, log.c, log.h, ltrx.h, mail_cli.sql, meta.c,
-	  mtwrite.c, neodisk.c, nn_svr.sql, numeric.c, numeric.h,
-	  obackup.c, page.c, phrasematch.sql, rdf_core.c, rdf_core.h,
-	  rdf_sponge.sql, rdf_void.sql, rdfbox.c, rdfinf.c, rdfinf.h,
-	  recovery.c, recovery.h, regist.c, replsri.c, rltrx.c, row.c,
-	  scn3.l, search.c, search_in.c, sort.c, space.c, sql3.y,
-	  sql_to_c.awk, sqlbif.c, sqlbif.h, sqlbif2.c, sqlcmps.h,
-	  sqlcomp2.c, sqlcost.c, sqlcr.c, sqlcstate.h, sqldf.c, sqlexp.c,
-	  sqlfn.h, sqlgen.c, sqlhash.c, sqlintrp.c, sqlintrp.h, sqlnode.h,
-	  sqlo.c, sqlo.h, sqloby.c, sqloinv.c, sqloinx.c, sqloprt.c,
-	  sqlorder.c, sqlparext.h, sqlpfn.c, sqlpfn.h, sqlprocc.c,
-	  sqlrun.c, sqlsrv.c, sqlstmts.c, sqltrig.c, sqltype.c, sqlver.h,
-	  sqlview.c, sqlwords.gperf, srvcr.c, srvmultibyte.c, srvstat.c,
-	  system.sql, system2.sql, text.c, text.h, trans.c, update.c,
-	  url_rewrite.sql, useraggr.sql, users.sql, virtual_dir.sql,
-	  vt_text.sql, wi.h, wi_xid.c, widd.h, widisk.h, widv.h, wifn.h,
-	  xmlnode.h, xmlschema.c, xmlsearch.c, xmltree.c: * Initial checkin of V6 single engine code
-
-2009-04-15 11:31  source
-
-	* sparql.h, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_p.y, sparql_tree.c,
-	  sparqld.c, sparul2sql.c: * Added support for graph groups
-
-2009-04-14 14:10  source
-
-	* sqlbif.c: * Fixed compiler warnings
-
-2009-04-14 01:51  source
-
-	* bif_crypto.c, bif_explain.c, datesupp.c, dks_esc.c, gate.c,
-	  rdfinf.c, regist.c, sparql2sql.c, sparql2sqltext.c,
-	  sparql_core.c, sparql_tree.c, sparqld.c, sparul2sql.c, sqlbif.c,
-	  sqlbif2.c, sqlcost.c, sqldf.c, sqlpfn.c, srvmultibyte.c,
-	  xmltree.c, xqf.c: * Fixed compiler warnings
-
-2009-04-13 11:52  source
-
-	* sparql.h, sparql.sql, sparql_core.c: * Added optimization of secuirity checks for public graphs in
-	  "allow nothing" storage
-
-2009-04-13 11:51  source
-
-	* datesupp.c: * Fixed debug output only with DT_DEBUG not with DEBUG
-
-2009-04-11 20:25  source
-
-	* xmltree.h: * Fixed missing prototype
-
-2009-04-11 01:06  source
-
-	* bif_file.c, bif_xper.c: * Added initial support for gzipped stream session
-
-2009-04-11 01:04  source
-
-	* sqlbif2.c: * Added format_number()
-
-2009-04-11 01:04  source
-
-	* url_rewrite.sql: * Fixed reserved word
-
-2009-04-10 13:33  source
-
-	* CLIsql2.c, CLIw.c, arith.c, bif_crypto.c, bif_intl.c,
-	  bif_kerberoscli.c, bif_phrasematch.c, bif_soap.c, bif_text.c,
-	  bif_xml.c, bitmap.c, bitmap.h, blob.c, datesupp.c, ddlrun.c,
-	  disk.c, gate.c, hash.c, http.c, http.h, inxop.c, jso.h, list2.h,
-	  lock.c, ltrx.h, mtwrite.c, multibyte.h, obackup.c,
-	  phrasematch.sql, rdf_core.c, rdf_core.h, rdf_mapping.jso,
-	  rdf_sponge.sql, rdfbox.c, rdfinf.c, rdfxml_parser.c, rltrx.c,
-	  search.c, security.c, shcompo.h, space.c, sparql.h, sparql.sql,
-	  sparql2sql.c, sparql2sql.h, sparql2sqltext.c, sparql_core.c,
-	  sparql_io.sql, sparql_p.y, sparql_qm.c, sparql_sff.c,
-	  sparql_tree.c, sparqld.c, sparul2sql.c, sql3.y, sqlbif.c,
-	  sqlcost.c, sqldf.c, sqlfn.h, sqlgen.c, sqlintrp.c, sqlpfn.c,
-	  sqlrun.c, sqlsrv.c, sqltype.c, system.sql, update.c,
-	  url_rewrite.sql, users.sql, wi.h, xmlenc.c, xmltree.c, xpath.c,
-	  xpathp.y, xslt_impl.h: * FIxed spelling
-
-2009-04-09 19:27  source
-
-	* xmlsql.c: * Fixed 64bit compatibility
-
-2009-04-09 15:22  source
-
-	* 2pc.c, 2pc.h, 2pc.sql, 2pc_client.c, 2pc_client.h, CLI.h,
-	  aqueue.h, arith.c, arith.h, auxfiles.c, bif_audio_tags.h,
-	  bif_crypto.c, bif_date.c, bif_dav.c, bif_diff.c, bif_explain.c,
-	  bif_file.c, bif_gnw.c, bif_intl.c, bif_json.c, bif_kerberoscli.c,
-	  bif_ldapcli.c, bif_mts.c, bif_nntp.c, bif_phrasematch.c,
-	  bif_pop3.c, bif_purify.c, bif_regexp.c, bif_repl.c, bif_smtp.c,
-	  bif_soap.c, bif_text.c, bif_text.h, bif_tidy.c, bif_uuencode.c,
-	  bif_xml.c, bif_xper.c, bif_xper.h, bitmap.c, bitmap.h, blob.c,
-	  blobio.c, blobio.h, blog.xsl, cov_time.xsl, crsr.h, crypt.c,
-	  date.h, datesupp.c, datesupp.h, ddlrun.c, disk.c, dks_esc.c,
-	  eqlcomp.c, eqlcomp.h, ftp.sql, gate.c, hash.c, hosting.c,
-	  hosting.h, http.c, http.h, http_client.c, http_client.h,
-	  insert.c, inxop.c, iodbcinst.c, iodbcinst.h, jso.h, json.l,
-	  json.y, ksrvext.h, ksrvextphp.h, lisprdr.c, lisprdr.h, list2.h,
-	  list_lex_props.sh, lock.c, log.c, log.h, ltrx.h, map_schema.c,
-	  map_schema.h, meta.c, msdtc.h, mts.h, mts_client.c, mts_client.h,
-	  mts_com.h, mtwrite.c, multibyte.c, multibyte.h, name.c,
-	  neodisk.c, numeric.c, numeric.h, obackup.c, odbcinc.h,
-	  phrasematch.sql, pldbgcli.c, pldebug.c, pldebug.h, plugin_gate.c,
-	  plugin_loader.c, rdf_core.c, rdf_core.h, rdf_mapping.jso,
-	  rdfbox.c, rdfinf.c, rdfinf.h, rdfxml_parser.c, recovery.c,
-	  recovery.h, regist.c, remote.h, rendezvous.c, rendezvous.h,
-	  repl.h, repldb.c, replpush.c, replsr.h, replsri.c, replsub.c,
-	  rltrx.c, row.c, schspace.c, schspace.h, scn3.l, search.c,
-	  search_in.c, security.c, security.h, shcompo.c, shcompo.h,
-	  shuric.c, shuric.h, soap.h, soap12_router.xsl,
-	  soap_import_sch.xsl, soap_sch.xsl, soap_xmlrpc.xsl, sort.c,
-	  space.c, sparql.h, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_l.l, sparql_p.y, sparql_qm.c, sparql_sff.c,
-	  sparql_tree.c, sparqld.c, sparul2sql.c, sql3.y, sql3_vc.c,
-	  sql_code_cache_impl.c, sqlbif.c, sqlbif.h, sqlbif2.c, sqlcmps.h,
-	  sqlcomp.c, sqlcomp.h, sqlcomp2.c, sqlcost.c, sqlcr.c,
-	  sqlcstate.h, sqldf.c, sqlexp.c, sqlfn.h, sqlgen.c, sqlhash.c,
-	  sqlintrp.c, sqlintrp.h, sqlnode.h, sqlo.c, sqlo.h, sqloby.c,
-	  sqlocr.c, sqlocr.h, sqlofn.h, sqloinv.c, sqloinv.h, sqloinx.c,
-	  sqlopcod.h, sqloprt.c, sqlorder.c, sqlovdb.c, sqlpar.h,
-	  sqlparext.h, sqlpfn.c, sqlpfn.h, sqlprocc.c, sqlprt.c, sqlrbuf.c,
-	  sqlrcomp.h, sqlrrun.c, sqlrun.c, sqlsrv.c, sqlstmts.c, sqltrig.c,
-	  sqltype.c, sqltype.h, sqltype_c.h, sqlver.c, sqlver.h, sqlview.c,
-	  sqlwords.gperf, srvcr.c, srvmultibyte.c, srvmultibyte.h,
-	  srvstat.c, srvstat.h, ssl.c, statuslog.h, string.c,
-	  string_tmpl.c, strlike.h, subseq.c, subseq.h, text.c, text.h,
-	  turtle_l.l, turtle_p.y, update.c, url_rewrite.sql, uuencode.c,
-	  uuencode_impl.h, virtext.h, virtpwd.h, wi.h, wi_xid.c, wi_xid.h,
-	  widd.h, widisk.h, widv.h, wifn.h, wirpc.c, wirpce.h, wiservic.c,
-	  wiservic.h, wsdl_expand.xsl, wsdl_import.xsl, wsdl_parts.xsl,
-	  wsrp_error.xsl, wsrp_interm.xsl, wsrp_resp.xsl, xml.h,
-	  xmlenc-dec.c, xmlenc.c, xmlenc.h, xmlenc_algos.c, xmlenc_algos.h,
-	  xmlenc_test.h, xmlgen.h, xmllazy.c, xmlnode.h, xmlres.h,
-	  xmlrpc_soap.xsl, xmlschema.c, xmlsearch.c, xmlsql.c, xmltree.c,
-	  xmltree.h, xpath.c, xpath.h, xpathp.y, xpathp_impl.h, xpf.c,
-	  xpf.h, xpscn.l, xqf.c, xqf.h, xslt.c, xslt_fmt.c, xslt_impl.h,
-	  xslt_opt.c: * Fixed header comment
-
-2009-04-08 14:55  source
-
-	* sparql.sql, sparql2sqltext.c, sparql_core.c, sparql_io.sql,
-	  sparul2sql.c, sqlbif.c, xpathp.y, xpscn.l: * Fixed SPARQL/SPARUL security
-	* Fixed problem with FT optimization
-
-2009-04-07 23:00  source
-
-	* rdf_core.h, rdf_sponge.sql, rdfbox.c, scn3.l, sparql.h,
-	  sparql.sql, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_p.y, sparql_tree.c, sqlfn.h, widv.h: * Added compiler extensions for SPARQL security
-
-2009-04-03 12:47  source
-
-	* rdf_core.h, rdfbox.c, sparql.sql: * Added draft of RDF graph-level security metadata functions
-
-2009-04-01 12:27  source
-
-	* datesupp.c: * Fixed problem with DEBUG code
-
-2009-03-31 15:25  source
-
-	* rdfbox.c: * Fixed i18N serialization of RDF/XML box
-
-2009-03-31 13:06  source
-
-	* rdf_core.c, sparql.sql, sparql2sqltext.c: * Added rdf box argument to iri_to_id
-	* Deprecated RDF_MAKE_IID_OF_QNAME_SAFE and RDF_MAKE_IID_OF_LONG
-
-2009-03-31 13:03  source
-
-	* rdf_schema_objects.sql: * Fixed rdf view generation
-
-2009-03-31 13:03  source
-
-	* datesupp.h: * Fixed proper subtype when casting string to time
-
-2009-03-30 16:22  source
-
-	* datesupp.c: * Fixed compiler warning
-
-2009-03-30 10:22  source
-
-	* CLIuti.c, bif_date.c, bif_soap.c, blobio.h, datesupp.c,
-	  datesupp.h, row.c, sparql_core.c, xqf.c: * Replaced string_to_time_dt and iso8601_string_to_dt with common parser
-	  for both ODBC adn iso8601 strings
-
-2009-03-30 10:20  source
-
-	* sparql_io.sql: * Added support for XML literals in RDF/XML, SPARQL XML resultset and
-	  JSON outputs
-
-2009-03-30 10:19  source
-
-	* xmlsql.c: * Fixed 64bit portability
-
-2009-03-29 12:02  source
-
-	* sparql.sql: * Fixed cleanup entries loaded with sparql load into
-
-2009-03-26 11:02  source
-
-	* sparul2sql.c: * Fixed conflict between user-defined aggregates and SPARUL aggregates
-
-2009-03-26 11:00  source
-
-	* sparql_core.c, sparql_p.y: * Added support for user-defined aggregates in SPARQL
-
-2009-03-26 10:59  source
-
-	* rdf_schema_objects.sql: * Fixed Oracle HR issue
-
-2009-03-26 10:59  source
-
-	* text.c: * Fixed variable declaration
-
-2009-03-25 11:05  source
-
-	* sparql.sql, sparql2sqltext.c: * Fixed i18n issues with freetext search in RDF
-
-2009-03-25 10:41  source
-
-	* text.c: * Fixed needless call to wp_proximity
-
-2009-03-25 10:16  source
-
-	* bif_soap.c, http.c: * Fixed compiler warnings
-
-2009-03-25 10:13  source
-
-	* http.c: * Fixed listen if non-normalized interface e.g. w/o port is recorded
-	  in http_path table
-
-2009-03-22 11:37  source
-
-	* sqlbif2.c: * Fixed compiler warnings
-
-2009-03-22 11:36  source
-
-	* sparql2sqltext.c: * Fixed passing retvals of variables from OPTION(), like ?SCORE ?x,
-	  from deeply nested subselects
-
-2009-03-20 00:42  source
-
-	* sparql.sql, sparul2sql.c, srvstat.c, xslt.c: * Added support for MaxMemInUse parameter in [SPARQL] section
-	* Fixed related bugs in resultset size restrictions
-
-2009-03-20 00:41  source
-
-	* json.y: * FIxed include "..." instead of include <...> for dependencies
-
-2009-03-20 00:39  source
-
-	* sparql_io.sql: * Fixed wrong output to http instead of output to session in single-value
-	  result sets
-
-2009-03-18 17:04  source
-
-	* rdf_void.sql: * Fixed names and string limits
-
-2009-03-18 10:14  source
-
-	* rdf_core.h, turtle_p.y: * Added support for nonstandard '[' predicate-object-list ']' '.' syntax
-	  at top level of N3 files
-
-2009-03-18 10:12  source
-
-	* bif_date.c: * Fixed problem with dateadd and datediff on first day of month with pos
-	  timezone and on last day of month with neg timezone
-
-2009-03-17 11:36  source
-
-	* sparql.sql, sparql_core.c, sparul2sql.c: * Fixed problem with wrong dictionary limit
-
-2009-03-15 16:14  source
-
-	* sparql_io.sql: * Fixed bad http header
-
-2009-03-11 15:57  source
-
-	* http.c, http_client.c: * Added support for URIQA methods in http_client
-	* Added support for gunzip in http_client
-	* Rewrote http_get to use http_client call
-
-2009-03-11 15:44  source
-
-	* bif_file.c: * Fixed memory leak in file stat
-
-2009-03-10 15:33  source
-
-	* sparql2sql.c: * Fixed GPF in rare case when using NOT FROM / NOT FROM NAMED
-
-2009-03-10 15:23  source
-
-	* bif_date.c, date.h, datesupp.c, datesupp.h, soap.sql,
-	  sparql2sqltext.c, xqf.c: * Fixed handling of fractions in datetime
-
-2009-03-09 16:58  source
-
-	* bif_file.c: * Fixed dirlist on windows
-
-2009-03-09 10:27  source
-
-	* http.c, http.h, http_client.c, http_client.h, rdf_sponge.sql,
-	  sqlver.h, system.sql: * Added support for squid, socks4 and socks5 proxy with optional auth
-	* Added support for define sparql-get:proxy for RDF mappers
-
-2009-03-09 10:23  source
-
-	* bif_file.c: * Fixed failing file_stat on windows because of trailing slash on directory
-
-2009-03-03 21:45  source
-
-	* rdf_void.sql: * Fixed IRI
-
-2009-03-03 20:59  source
-
-	* bif_soap.c, http_client.c, http_client.h: * Fixed long files support in http client
-
-2009-03-03 20:58  source
-
-	* rdf_void.sql: * Fixed missing group by for voID
-	* Fixed iri
-
-2009-03-03 14:36  source
-
-	* rdfbox.c: * Fixed problem with TURTLE serialization of a triple with an O field
-	  that is an unknown IRI_ID
-
-2009-03-02 21:47  source
-
-	* rdfbox.c, sparql.sql, sparql_io.sql: * Fixed output format selection for SPARQL protocol clients that accept
-	  both XML result-sets and TTL triple dictionaries
-
-2009-03-02 10:01  source
-
-	* sparql.sql: * Fixed problem with FILTER and DB.DBA.RDF_STRSQLVAL_OF_SQLVAL
-
-2009-02-27 22:12  source
-
-	* xpf.c: * Added support for xpf_abs and apf_round_half_to_even
-
-2009-02-27 14:03  source
-
-	* xmlenc.c: * Fixed wrong function name in bif_args
-
-2009-02-27 12:00  source
-
-	* sparql.sql, sparql2sql.h, sparql2sqltext.c, sparql_io.sql: * Fixed incorrect result when Accept is set to "text/rdf-n3"
-	* Fixed compilation of SPARQL_SELECT_DISTINCT query returning bad result
-
-2009-02-27 11:39  source
-
-	* xpf.c: * Fixed urlify to avoid using '+' and match final URL recommendations
-
-2009-02-27 00:23  source
-
-	* bif_crypto.c, http.c: * Fixed gpf on db:cert_key in certificate info
-
-2009-02-25 16:24  source
-
-	* search.c: * Fixed problem with checkpoint rollback which left empty pages
-
-2009-02-25 15:17  source
-
-	* ddlrun.c: * Fixed memory leak when an executed select statement leaves a qi and
-	  not all rows are fetched
-
-2009-02-25 09:38  source
-
-	* rdf_core.c, rdfbox.c, sparql.sql, sparql2sqltext.c,
-	  sparql_io.sql: * Enhanced speed of TTL output
-	* Fixed other output modes
-
-2009-02-20 23:30  source
-
-	* sparql_p.y: * Fixed gpf
-
-2009-02-20 15:16  source
-
-	* http.c, rdf_core.c, rdf_core.h, rdf_void.sql, rdfbox.c, sparql.h,
-	  sparql.sql, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_io.sql, sparql_p.y, sparul2sql.c,
-	  xmltree.c, xmltree.h: * Added initial infrastructure for new SPARQL result serialization
-	* Added function bif_rdf_strsqlval
-	* Fixed RDF_STRSQLVAL_OF_xxx for IRI attributes
-
-2009-02-20 15:13  source
-
-	* sqlbif.c: * Added function bif_isnotnull
-
-2009-02-20 15:13  source
-
-	* dks_esc.c, http.h: * Fixed compiler warnings
-
-2009-02-20 15:11  source
-
-	* users.sql, xmlenc.c: * Added CA functions
-
-2009-02-20 15:10  source
-
-	* bif_file.c: * Added bif to open strses without dumping into temp file
-
-2009-02-20 15:08  source
-
-	* text.c, text.h, bif_text.c: * Fixed bug accessing memory past the end of st_buffer
-
-2009-02-13 16:16  source
-
-	* sqlver.h: * Updated version to 05.10
-
-2009-02-13 12:41  source
-
-	* rdf_sponge.sql: * Fixed duplicate code
-
-2009-02-13 11:54  source
-
-	* CLIsql1.c, CLIuti.c, aqueue.c, arith.c, autoexec.sql, auxfiles.c,
-	  bif_dav.c, bif_file.c, bif_phrasematch.c, bif_regexp.c,
-	  bif_repl.c, bif_soap.c, bif_uuencode.c, bif_xml.c, bitmap.c,
-	  blobio.h, ddlrun.c, disk.c, dks_esc.c, eqlcomp.c, ftp.sql,
-	  gate.c, hash.c, hosting.c, http.c, http_client.c, insert.c,
-	  inxop.c, jso.c, json.y, lock.c, log.c, meta.c, neodisk.c,
-	  nn_svr.sql, obackup.c, rdf_core.c, rdf_schema_objects.sql,
-	  rdf_void.sql, rdfbox.c, rdfinf.h, rdfxml_parser.c, recovery.c,
-	  rltrx.c, row.c, scn3.l, search.c, snapshot_repl.sql, soap.sql,
-	  sort.c, sparql.h, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_l.l, sparql_p.y,
-	  sparql_qm.c, sparql_sff.c, sparqld.c, sparul2sql.c, sql3.y,
-	  sqlbif2.c, sqlcomp2.c, sqlcost.c, sqldf.c, sqlexp.c, sqlgen.c,
-	  sqlintrp.c, sqlnode.h, sqloinx.c, sqlovdb.c, sqlrcomp.c,
-	  sqlrrun.c, sqlrun.c, sqlsrv.c, sqlstmts.c, sqltrig.c, system.sql,
-	  text.c, turtle_l.l, turtle_p.y, update.c, url_rewrite.sql,
-	  users.sql, virtual_dir.sql, wi.h, widisk.h, wifn.h, xmla.sql,
-	  xmlsql.c, xmltree.c, xmltree.h, xpf.c, xqf.c, xslt.c, xslt_opt.c: * Fixed indentation
-
-2009-02-12 16:15  source
-
-	* list_lex_props.sh: * Fixed problem with LOCALE handling in scripts
-
-2009-02-11 23:09  source
-
-	* sparql_io.sql: * Fixed /sparql?find=a error diagnostics
-
-2009-02-11 21:03  source
-
-	* Makefile.am: * Added initial Amazon S3 DET
-
-2009-02-11 17:37  source
-
-	* sparql2sqltext.c: * Fixed sparql codegen for free-text preficates in triples that have no
-	  variants
-
-2009-02-11 00:28  source
-
-	* rdf_core.c: * Fixed initialization
-
-2009-02-10 13:56  source
-
-	* http.c, http.h: * Added support for self-signed certificates as well as optional client
-	  verification to https
-	* Fixed session id context when verifying
-
-2009-02-10 13:54  source
-
-	* http_client.c, http_client.h: * Added DAV methods to new http client
-
-2009-02-10 13:53  source
-
-	* CLIodbc3.c: * Fixed use of ODBC 3.x SQLLEN for 64bit ports
-
-2009-02-09 20:24  source
-
-	* bif_file.c: * Fixed sys_dirlist on windows
-
-2009-02-09 12:55  source
-
-	* xmltree.c: * Fixed handling of WIDE data
-
-2009-02-09 11:42  source
-
-	* bif_file.c: * Fixed checking system call setting
-
-2009-02-06 10:40  source
-
-	* soap.sql, sqlver.h: * Updated copyright year to 2009
-
-2009-02-05 11:41  source
-
-	* rdf_core.c, rdf_core.h: * Fixed https and 'local:'
-
-2009-02-03 16:39  source
-
-	* bif_crypto.c: * Added initial support for foaf+ssl
-
-2009-02-03 16:38  source
-
-	* neodisk.c: * Fixed writing cpt revov file which needs cpt_dbs to be set when there
-	  are uncommitted transactions
-
-2009-02-03 01:07  source
-
-	* bif_date.c, bif_file.c, bif_intl.c, bif_xper.c, multibyte.h,
-	  rdfbox.c, sqlnode.h, srvmultibyte.h, xmllazy.c, xmlsql.c: * Fixed compiler warnings
-
-2009-02-03 01:06  source
-
-	* dks_esc.c: * Fixed escaping of weird IRIs in TURTLE and javascript output of SPARQL
-	  results via SPARQL web service endpoint
-
-2009-02-03 01:04  source
-
-	* rdfbox.c: * Fixed for dot in namespace prefix preamble
-
-2009-01-29 23:00  source
-
-	* sqlintrp.c, sqlnode.h: * Fixed deadlock handler as remove need to do rb before first goto.
-	  Also the explicit rb is now optional
-
-2009-01-29 22:58  source
-
-	* sparql_core.c, xqf.c: * Fixed memory leaks
-
-2009-01-29 14:00  source
-
-	* scn3.l, sparql2sqltext.c, sparql_l.l, sqlrcomp.c, sqlrcomp.h: * Fixed support for SPARQL expressions with weird strings in WHERE (...)
-	  SQL fragments
-
-2009-01-29 13:52  source
-
-	* rdfbox.c: * Fixed TURLE initialization after running out of limit for namespace
-	  prefixes in a hugh output
-
-2009-01-29 13:51  source
-
-	* bif_file.c: * Fixed double close of file descriptor after interrupted file read
-
-2009-01-29 13:49  source
-
-	* http.c, http.h: * Fixed rate limit to take samples within 1 second before comparing
-	* Fixed precision as hits/count/elapsed time gives better results
-
-2009-01-29 13:47  source
-
-	* sparql.sql: * Added support for mapping of TIME columns to xsd:time literals
-
-2009-01-26 11:23  source
-
-	* rdf_core.c, rdf_core.h, rdfbox.c, rdfxml_parser.c, sparql.sql,
-	  turtle_l.l, turtle_p.y: * Added error/warning/info reporting callback to triple feeder
-	* Added printer of human-readable turtle files
-	* Fixed hash of RDF boxes
-
-2009-01-26 11:18  source
-
-	* http.c, http.h, rdf_void.sql, virtual_dir.sql: * Added HTTP ACL to support hit rate limit
-
-2009-01-26 11:17  source
-
-	* date.h, datesupp.c, xqf.c: * Added dt_audit_fields and fixes related bugs
-
-2009-01-26 11:15  source
-
-	* bif_file.c, sqlbif.c, sqlbif.h, sqlbif2.c, sqlfn.h: * Added support for filesystems with non-latin1 charsets for filenames
-
-2009-01-22 23:56  source
-
-	* sparql_io.sql: * Fixed CSS for /sparql interface
-
-2009-01-22 23:49  source
-
-	* .cvsignore: * Added more files to ignore
-
-2009-01-22 23:48  source
-
-	* Makefile.am, sqlnode.h: * Fixed use of --disable-pldebug
-
-2009-01-21 14:28  source
-
-	* rdf_schema_objects.sql: * Fixed wrong graph in VD rule
-
-2009-01-21 12:08  source
-
-	* rdf_core.h, turtle_l.l, turtle_p.y: * Fixed extended error recovery to allow for wierd relative URIs and
-	  can skip severe syntax errors upto dot with whitespace
-
-2009-01-21 12:02  source
-
-	* sparql.sql: * Fixed define sql:describe-mode "SPO"
-
-2009-01-19 11:16  source
-
-	* sparql.sql, sparql2sqltext.c, sparql_l.l, sparql_p.y,
-	  sparql_tree.c: * Fixed select * where { ?s ?p ?o filter (?o = 'something'@lang) }
-
-2009-01-19 11:15  source
-
-	* http_client.c: * Fixed check for content lenght limit
-
-2009-01-19 10:02  source
-
-	* information_schema.sql: * Fixed typo in columns view
-
-2009-01-14 16:57  source
-
-	* sparql.sql: * Added support for nvarchar / long nvarchar fields in RDF views
-
-2009-01-14 16:57  source
-
-	* sparql_tree.c: * Fixed partial rollback of patch
-
-2009-01-14 16:56  source
-
-	* rdf_void.sql: * Fixed use seeAlso as it seems sameAs is wrong
-
-2009-01-14 12:01  source
-
-	* sparql2sql.c, sparql_tree.c: * Fixed sparp_rvr_tighten to finally pass SparqlQmPure.sql
-
-2009-01-14 12:01  source
-
-	* xmltree.h: * Fixed compiler warning
-
-2009-01-13 11:18  source
-
-	* Makefile.am, bif_xper.c, multibyte.h, xmllazy.c, xmlschema.c,
-	  xmltree.c, xmltree.h, xpath.c, xpf.c: * Added support for lazy xml entities
-
-2009-01-09 12:20  source
-
-	* rdf_schema_objects.sql: * Added support of timestamp and nvarchar in rdf schema generation
-
-2009-01-08 15:32  source
-
-	* http.c: * Fixed handeling of 100-continue was only activated on certain content
-	  types
-
-2009-01-08 15:31  source
-
-	* 2pc.h, mts_client.c: * Fixed compiler error
-
-2009-01-07 20:55  source
-
-	* sql3.y, sqlwords.gperf: * Renamed SQLSTATE token to SQLSTATE_L to avoid namespace clash
-
-2009-01-06 11:18  source
-
-	* rdf_schema_objects.sql: * Fixed use temp directory for larger script otherwise url param may not fit
-	* Fixed use of IRI in the rdf view definition
-
-2009-01-05 22:20  source
-
-	* rdf_schema_objects.sql, sparql.sql: * Fixed voID in RDF views
-	* Fixed URL deref
-
-2009-01-02 13:46  source
-
-	* sparql.h, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_p.y, sparql_tree.c,
-	  sparqld.c: * Added SPAR_GRAPH (with SPART_GRAPH_FROM ... and SPART_GRAPH_NOT_NAMED
-	  subtypes)
-
-2009-01-02 13:45  source
-
-	* turtle_l.l: * Fixed SPAR_NCNAME_X to accept dot right after QName
-
-2009-01-02 13:44  source
-
-	* bif_intl.c, bif_xper.c, srvmultibyte.h, xmlenc.c, xmlsql.c,
-	  xmltree.c: * Added wcharset_by_name_or_dftl()
-
-2008-12-24 01:10  source
-
-	* ddlrun.c, system.sql: * Fixed no fk trigger on remote table
-
-2008-12-24 01:09  source
-
-	* sqlbif.c: * Added support for ROUND function
-
-2008-12-23 11:05  source
-
-	* bif_file.c: * Fixed enabled output buffering
-
-2008-12-22 17:20  source
-
-	* sort.c, sql3.y, sqlrun.c: * Added TOP (N, -1) to skip N rows and then return rest of result set
-
-2008-12-22 17:09  source
-
-	* rdf_schema_objects.sql: * Added optional support for voID to RDF views
-
-2008-12-22 12:30  source
-
-	* sparql.sql, sparql2sqltext.c: * Added partial (and bad) support for quad maps with 4 constants and no
-	  quad map values
-
-2008-12-22 12:29  source
-
-	* rdf_void.sql: * Fixed problem with rdf_void_store
-
-2008-12-18 14:45  source
-
-	* sqlver.h: * Updated version to 3037
-
-2008-12-18 14:32  source
-
-	* Makefile.am: * Added new LiteMode setting so virtuoso can run in restricted mode
-
-2008-12-18 10:36  source
-
-	* sparql2sql.c, sparql2sql.h, sparqld.c: * Fixed wrong localization of glued filters
-	* Fixed wrong placing of glued filters with restrictions on equiv
-	* Improved SPARQL-D printer
-
-2008-12-17 17:55  source
-
-	* auxfiles.c, ddlrun.c, disk.c, http.c, log.c, rendezvous.c,
-	  soap.sql, sparql.sql, sqlnode.h, sqlsrv.c, srvstat.c, system.sql,
-	  users.sql, virtual_dir.sql: * Added new LiteMode setting so virtuoso can run in restricted mode
-
-2008-12-17 17:49  source
-
-	* gate.c, recovery.c, wi.h: * Fixed error messages
-
-2008-12-17 17:47  source
-
-	* CLI.h, CLIodbc3.c, odbcinc.h: * Added SQL_DESC_COL_LITERAL_LANG and SQL_DESC_COL_LITERAL_TYPE to
-	  translate RDF metadata
-
-2008-12-17 17:43  source
-
-	* wifn.h: * Added option DisableTcpSocket
-
-2008-12-17 17:39  source
-
-	* disk.c, rdf_core.c, wi.h: * Added options RdfFreeTextRulesSize and IndexTreeMaps to better control
-	  memory consumption for small installations
-
-2008-12-16 20:56  source
-
-	* sparql_io.sql: * Fixed use special function to cast
-
-2008-12-16 20:55  source
-
-	* rdf_void.sql: * Added RDF_VOID_STORE proc
-
-2008-12-16 12:46  source
-
-	* Makefile.am, rdf_void.sql: * Added support for voID generation
-
-2008-12-15 21:29  source
-
-	* url_rewrite.sql: * Fixed missing order by
-
-2008-12-15 21:29  source
-
-	* system.sql: * Fixed when altering PK, keep grants too
-
-2008-12-15 21:28  source
-
-	* sparql_io.sql: * Fixed missing cast to string
-
-2008-12-12 15:07  source
-
-	* http_client.c: * Fixed problem with http://dot.domain without path, must use / instead of
-	  /index.html as this may not be there on server
-
-2008-12-12 15:03  source
-
-	* sparql2sql.h: * Fixed missing struct members
-
-2008-12-12 14:30  source
-
-	* Makefile.am, rdf_sponge.sql, sparql.h, sparql.sql, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_io.sql, sparqld.c,
-	  sparul2sql.c: * Added support for SPARUL to write to DAV
-	* Fixed SPARQL printer
-	* Fixed split sparql.sql into sparql.sql, sparql_io.sql and rdf_sponge.sql
-
-2008-12-12 13:50  source
-
-	* information_schema.sql, sqlbif2.c: * Fixed show procedure/view text only to owner or dba
-	* Fixed grants
-
-2008-12-11 15:28  source
-
-	* sqlbif.c: * Fixed error message
-
-2008-12-11 15:22  source
-
-	* information_schema.sql: * Added support to upgrade information schema views in existing database
-
-2008-12-09 16:58  source
-
-	* sqlver.h: * Updated version to 05.09.3036
-
-2008-12-09 16:49  source
-
-	* sparql.sql: * Added support for GET+MGET
-	* Fixed issues with sponger
-
-2008-12-09 16:47  source
-
-	* sparql.sql, sqlbif.c: * Fixed debugging code
-
-2008-12-09 16:45  source
-
-	* sqldf.c, wifn.h: * Added flag to enable/disable constant predicate optimization
-
-2008-12-09 16:43  source
-
-	* system.sql: * Fixed missing table qualifier
-
-2008-12-09 01:40  source
-
-	* sqlo.h: * Fixed constant to -1L for 64bit portability
-
-2008-12-04 14:33  source
-
-	* obackup.c: * Fixed problem with restore when header cannot be read
-	* Fixed error messages
-
-2008-12-01 12:29  source
-
-	* virtual_dir.sql: * Fixed vhost_remove to work identical to vhost_define re lhost
-
-2008-12-01 12:28  source
-
-	* auxfiles.c, disk.c: * Fixed step calculation to prevent crash when number of buffers is low
-	* Fixed set minimum number of buffers to 256
-
-2008-11-27 15:20  source
-
-	* rdfbox.c: * Fixed compiler warning
-
-2008-11-27 00:55  source
-
-	* sparql.sql: * Fixed check for valid graph IRI
-
-2008-11-27 00:54  source
-
-	* sparul2sql.c: * Fixed CONTRUCT with expressions in triple patterns
-
-2008-11-27 00:53  source
-
-	* sparql_core.c: * Fixed SPAR_CODEGEN in DEBUG mode
-
-2008-11-27 00:52  source
-
-	* sparql.sql, sparql2sqltext.c: * Fixed double-quoted identifiers in mappings
-
-2008-11-27 00:49  source
-
-	* sparql.h, sparql2sqltext.c, sparql_core.c, sparql_l.l,
-	  sparql_p.y, sparql_tree.c: * Added support for IFP
-
-2008-11-27 00:46  source
-
-	* rdf_core.c, sparql.sql: * Added support for cache of matches between datatype IRIs and twobyte
-	  codes
-	* Added similar support for languages
-
-2008-11-26 12:38  source
-
-	* sparql.sql: * Fixed display message only when inf is actually loading
-
-2008-11-26 12:38  source
-
-	* bif_file.c, widv.h: * Added support to read line from file
-
-2008-11-25 11:43  source
-
-	* sparql.sql: * Fixed parameter name
-
-2008-11-25 09:33  source
-
-	* sparql.sql: * Added option to load inference deferred
-
-2008-11-25 09:33  source
-
-	* srvstat.c, system.sql: * Fixed do not run scheduled proc when refreshing VDB stats
-
-2008-11-25 01:13  source
-
-	* sparql2sql.c: * Fixed typo
-
-2008-11-24 12:10  source
-
-	* sparql.sql: * Added default namespaces
-
-2008-11-24 12:10  source
-
-	* bif_xml.c: * Added support for DV_DB_NULL in composing UTF-8 representation of box
-
-2008-11-24 12:09  source
-
-	* multibyte.c: * Fixed DEBUG assertion for invalid box lenght before conversion wchar
-	  to UTF-8
-
-2008-11-24 12:09  source
-
-	* rdf_core.c, rdf_core.h, rdfbox.c: * Added bif_http_ttl_triple
-
-2008-11-24 12:08  source
-
-	* rdf_schema_objects.sql: * Fixed table and column name escape
-
-2008-11-20 15:42  source
-
-	* security.c, sqlfn.h: * Fixed cli_encryption_on_password statistic on 64bit
-
-2008-11-20 15:40  source
-
-	* sparql.sql: * Fixed problem with maxrows as construct and resultset are optional
-
-2008-11-19 12:26  source
-
-	* sparql2sql.c, sparql2sql.h, sparql_p.y, sparql_tree.c: * Fixed tree rewriting when filters are duplicated for branches of UNION
-	  and there are subqueries inside filters
-
-2008-11-19 12:24  source
-
-	* simile.sql: * Fixed empty body inside procedure which breaks the awk script
-
-2008-11-19 12:24  source
-
-	* nn_svr.sql: * Fixed return id of message
-
-2008-11-19 12:23  source
-
-	* virtual_dir.sql: * Fixed name of stored procedure to uppercase
-
-2008-11-19 12:23  source
-
-	* rdf_schema_objects.sql: * Added generation of OWL and VDs from DB schema
-
-2008-11-13 12:59  source
-
-	* sqlocr.c, sqlcr.c, sqlocr.h: * Fixed suppress sqlstate 42000 only for internal IUD operations
-
-2008-11-13 11:06  source
-
-	* bif_file.c: * Removed duplicated function
-
-2008-11-13 11:04  source
-
-	* sparql2sqltext.c: * Fixed faster location of gp of external global var
-
-2008-11-13 11:03  source
-
-	* sparql2sql.c: * Fixed sparp_expns_are_equal() is extended to compare (inaccurately)
-	  SPAR_GP trees
-
-2008-11-13 11:02  source
-
-	* sparql.sql: * Fixed codegen for cast of SSG_VALMODE_LONG to short of multipart
-	  sprintf IRI class
-
-2008-11-12 10:11  source
-
-	* sparql2sql.c, sparql2sql.h, sparql2sqltext.c: * Fixed code generation of OPTIONAL clause
-
-2008-11-12 10:09  source
-
-	* sparql.sql: * Added 'find' param in /sparql
-
-2008-11-12 10:08  source
-
-	* sparql_p.y: * Fixed sparql select ((select ...)), count(...) ...
-
-2008-11-12 10:07  source
-
-	* sparql.sql: * Added post-processing hook for sponger
-
-2008-11-12 10:06  source
-
-	* sparql.sql, sparql2sqltext.c: * Added extensions for SPARQL REGEX
-
-2008-11-12 10:03  source
-
-	* sparql.sql: * Fixed code generation when table or owner name contains spaces
-
-2008-11-12 09:58  source
-
-	* bif_regexp.c: * Added extensions for SPARQL REGEX
-
-2008-11-11 23:40  source
-
-	* bif_phrasematch.c: * Added support for multiple phrases per checksum
-
-2008-11-11 23:38  source
-
-	* text.c: * Added lang and encoding arguments to vtb_match
-
-2008-11-11 23:04  source
-
-	* turtle_l.l: * Fixed for loading DBpedia 3.2 (local parts of QNames)
-
-2008-11-11 23:03  source
-
-	* sqlbif.c: * Fixed use int64 for bit ops
-
-2008-11-11 23:00  source
-
-	* ksrvext.h, srvmultibyte.c, srvmultibyte.h: * Fixed compiler warnings
-
-2008-11-11 22:55  source
-
-	* bif_file.c, blob.c: * Fixed VAD to work with resources larger than 10MB
-	* Fixed md5_update to take strsess
-	* Fixed return sql error when blob to big for string conversion
-
-2008-11-11 22:01  source
-
-	* sparql_core.c, sparql_sff.c: * Fixed memory leak in sparql
-
-2008-11-11 21:58  source
-
-	* sqldf.c, sqloinx.c: * Fixed memory leak
-
-2008-11-04 16:09  source
-
-	* turtle_p.y: * Added debian control files
-
-2008-11-03 13:58  source
-
-	* sqlver.h: * Updated version to 05.09
-
-2008-10-31 17:16  source
-
-	* sparql_core.c: * Fixed check argument count
-
-2008-10-31 16:31  source
-
-	* sparql.sql: * Fixed primary key to hook
-
-2008-10-31 16:29  source
-
-	* sqlcomp2.c: * Fixed reporting garbage message
-
-2008-10-30 18:18  source
-
-	* Makefile.am, rdf_schema_objects.sql, sqlver.h, system.sql: * Added initial implementation of new rdf view generation
-
-2008-10-30 18:17  source
-
-	* http_client.c: * Fixed descriptor leak if client does a retry
-
-2008-10-30 13:50  source
-
-	* information_schema.sql: * Fixed prefix system tables in case we are in non-default database
-
-2008-10-29 21:51  source
-
-	* sparql.sql: * Added application/vnd.ms-excel output option to SPARQL endpoint
-
-2008-10-29 15:56  source
-
-	* sparql.sql: * Fixed ensure string argument otherwise UNAME can lead to lcase error
-
-2008-10-29 15:56  source
-
-	* regist.c, sqlbif.c, sqlfn.h: * Fixed log registry settings
-
-2008-10-29 15:55  source
-
-	* bif_phrasematch.c: * Fixed is_html flag indicating html mode 1 (fine_html) or 2 (dead_html)
-
-2008-10-28 20:09  source
-
-	* xpf.c: * Fixed do error check before trying to use the return value
-
-2008-10-27 09:13  source
-
-	* bif_phrasematch.c: * Fixed skip bad words in non-debug more
-
-2008-10-27 09:12  source
-
-	* text.c: * Fixed memory leak in vt_batch_match
-
-2008-10-22 22:10  source
-
-	* sparql.h, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_l.l, sparql_p.y, sparql_tree.c,
-	  sparul2sql.c, sqlcomp2.c, sqldf.c, sqlo.c: * Added support for triple optionof bif:contains .
-
-2008-10-21 14:21  source
-
-	* http.c: * Fixed memory leak in ws_params when server returns 303
-	* Fixed return url params in redirect so that /ode?x=y will redirect
-	  to /ode/?x=y
-	* Fixed check in dav_metadata extraction if procedure actually exists
-	  before calling it
-
-2008-10-21 14:18  source
-
-	* virtual_dir.sql: * Fixed new table layout
-
-2008-10-21 14:17  source
-
-	* sqlcost.c: * Fixed check for proper bif name in non-debug mode to get same
-	  execution path
-
-2008-10-21 14:17  source
-
-	* sqlexp.c: * Fixed check if iri is actually split, else we could free an uninitialized
-	  pointer
-
-2008-10-20 16:30  source
-
-	* bif_ldapcli.c, sqlo.h, turtle_p.y: * Fixed compiler warnings
-
-2008-10-20 11:49  source
-
-	* sparql.h, sparql2sql.h, sparql2sqltext.c, sparql_core.c,
-	  sparql_tree.c: * Added support for option(transitive) for triples
-
-2008-10-17 17:53  source
-
-	* http_auth.sql, sparql.sql, virtual_dir.sql: * Added sparql-auth endpoint similar to /proxy
-	* Added check if endpoint needs to be redefined
-
-2008-10-17 17:52  source
-
-	* users.sql: * Fixed qualifier check
-
-2008-10-16 14:30  source
-
-	* information_schema.sql: * Added foreign key information to KEY_COLUMNS_USAGE
-	* Fixed primary key name in REFERENTIAL_CONSTRAINS
-
-2008-10-16 10:24  source
-
-	* rdf_mapping.jso, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_sff.c: * Fixed codegen for SPARQL SELECT DISTINCT
-
-2008-10-15 21:57  source
-
-	* bif_text.c: * Added support for stop words
-
-2008-10-15 12:07  source
-
-	* turtle_l.l, turtle_p.y: * Added support for @base in TURTLE
-	* Added case for QNAME_NS in q_complete rule
-
-2008-10-14 21:25  source
-
-	* http_client.c, sparql.sql: * Fixed use http_client for sponging
-	* Fixed check in http_client if ua-id is already set in the headers
-
-2008-10-14 21:22  source
-
-	* aqueue.c: * Fixed if proc undefined, return error message
-
-2008-10-14 12:47  source
-
-	* sparql.sql, sparql2sql.c, sparql2sqltext.c: * Fixed support for SELECT DISTINCT subqueries in SPARQL
-
-2008-10-14 12:46  source
-
-	* users.sql: * Fixed error when granting sparql-update to user
-
-2008-10-14 12:46  source
-
-	* sqldf.c: * Fixed set and copy the dfe hash for value subqueries etc else they
-	  get placed multiple times if eg ordering col and result set col
-
-2008-10-14 12:45  source
-
-	* sparql.sql: * Added connection var to allow making authorized endpoints
-
-2008-10-13 11:14  source
-
-	* bif_file.c, sqlsrv.c: * Fixed call to init_server_cwd should be before backup/restore check
-	* Fixed problem trying to add db files from hash in restore mode
-
-2008-10-12 23:10  source
-
-	* sparql2sql.c, sparql2sql.h, sparql2sqltext.c, sparql_core.c,
-	  sparql_l.l, sparql_p.y, sparql_tree.c, sqlfn.h: * Added support for SAME_AS_S_O_L
-	* Added ssg_make_rb_complete_wrapped
-	* Added iri_split_ttl_qname
-	* Fixed case for FROM NAMED without FROM
-
-2008-10-12 23:08  source
-
-	* sqlpfn.c: * Fixed spelling error
-
-2008-10-10 12:31  source
-
-	* bif_file.c, sqlsrv.c, wifn.h: * Add all DB files explicitly to deny list
-	* Fixed initialization of server working directory
-	* Fixed use dynamic buffers
-
-2008-10-10 12:24  source
-
-	* bif_phrasematch.c: * Added support for filling vt batch in html mode
-
-2008-10-09 09:55  source
-
-	* sparql2sql.c, sparql2sql.h, sparql_tree.c: * FIxed scalar subqueries in result sets
-
-2008-10-08 14:05  source
-
-	* xmltree.c, xmltree.h: * Added uname_nodeID_ns
-
-2008-10-08 14:05  source
-
-	* sqlcomp2.c: * Fixed truncate error messages longer than 2K text
-
-2008-10-07 17:33  source
-
-	* http_client.c: * Fixed do not try to do any post when no data e.g. vector() is given
-
-2008-10-07 12:46  source
-
-	* sqlbif.c: * Fixed compiler warnings
-
-2008-10-07 00:47  source
-
-	* inxop.c: * Fixed when 2-d param is null, clear the params otherwise we end up with
-	  an incomplete params array
-
-2008-10-06 21:56  source
-
-	* bif_phrasematch.c: * Fixed serialize loading when phrases are not loaded and multiple clients
-	  trying to access same class
-
-2008-10-06 17:16  source
-
-	* sparql2sqltext.c, sparql_core.c: * Fixed compiler warnings
-
-2008-10-06 17:15  source
-
-	* sparql.h, sparql.sql, sparql2sql.c, sparql2sqltext.c: * Fixed sparql constructions like T_STOP
-
-2008-10-06 17:12  source
-
-	* blobio.h, datesupp.c, datesupp.h, sqlbif.c, sqlbif.h: * Fixed compiler warnings
-
-2008-10-04 00:30  source
-
-	* sparql.h, sparql2sql.c, sparul2sql.c: * Fixed automatic grouping result-sets of SPARQL queries using subqueries
-	  with aggregates
-
-2008-10-03 17:02  source
-
-	* sqlpfn.c: * Fixed stack check for solaris
-
-2008-10-03 11:47  source
-
-	* sparql2sql.c, sparql2sqltext.c, sparql_tree.c: * Fixed scalar subqueries that are used as items of result set
-
-2008-10-02 22:54  source
-
-	* ddlrun.c, scn3.l, sqlbif.c, users.sql: * Fixed empty identifiers like "" should be syntax error
-	* Fixed checks for empty owners and qualifiers
-
-2008-10-02 22:52  source
-
-	* http.c, http_client.c: * Added new http_pipeline for very large HTTP client requests
-
-2008-10-02 22:50  source
-
-	* sparql2sql.c: * Fixed  sparql select ?s, ((select count (1) where { ?s <knows> ?z}))
-	  where { ?s ?p ?o };
-
-2008-10-02 22:48  source
-
-	* sparql2sqltext.c: * Fixed missing space after WHERE keyword
-
-2008-10-02 11:11  source
-
-	* sparul2sql.c: * Fixed sparql insert ... where { {select ... }...}
-
-2008-10-02 11:10  source
-
-	* system.sql: * Fixed procedure name in ucase
-
-2008-10-01 16:38  source
-
-	* sparql.sql, sparql2sql.c, sparql2sqltext.c, sqlbif.c: * Fixed SPARQL OPTIONS
-	* Fixed decision about proper common valmode for != operator on G and
-	  global IRI expressions
-
-2008-10-01 13:09  source
-
-	* rdfbox.c: * Fixed description of __ro2sq as returning 'any' to fix problem with
-	  SQL_COLUMN_DISPLAY_SIZE
-
-2008-10-01 11:44  source
-
-	* bif_phrasematch.c: * Fixed memory leak
-
-2008-09-30 18:21  source
-
-	* http.c: * Fixed content check
-
-2008-09-30 18:02  source
-
-	* sparql2sql.c, sparql2sqltext.c, sparql_l.l, sparql_p.y,
-	  sparql_tree.c: * Added initial support for SPARQL triple options SAME_AS, SAME_AS_S
-	  and SAME_AS_O
-	* Fixed INFERENCE and SAME_AS
-
-2008-09-30 18:00  source
-
-	* sql_to_c.awk, system.sql: * Fixed problem tagging procedures as public
-
-2008-09-30 12:59  source
-
-	* bif_file.c, http.c, http.h: * Added support for http_get to receive gzipped data
-
-2008-09-29 22:34  source
-
-	* sqlbif.c: * Fixed signal an error if the result set is too long
-
-2008-09-29 11:06  source
-
-	* rdf_mapping.jso, sparql.h, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_p.y, sparql_tree.c: * Added support for two free-text tables (say RO_OBJ and RO_FT)
-	* Fixed SPARQL select * where {{select * where { ?s <knows> ?o }} .
-	  filter (?s=<me>)}
-	* Fixed validation of group pattern options
-
-2008-09-28 17:30  source
-
-	* search.c, wifn.h: * Fixed compiler warnings
-
-2008-09-26 14:45  source
-
-	* sparql.h, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_l.l, sparql_p.y, sparql_tree.c: * Added draft support of TRANSITIVE in SPARQL
-
-2008-09-26 00:08  source
-
-	* sqlcmps.h, sqlcr.c: * Fixed select TOP N .. order by ... using cursor
-
-2008-09-26 00:07  source
-
-	* sqlview.c: * Fixed memory leak
-
-2008-09-24 23:48  source
-
-	* sparql.sql: * Added timeout for transaction
-
-2008-09-23 21:13  source
-
-	* sqlo.c, sqlrun.c: * Fixed problem with col ref w/o prefix when replacing the prefixes
-	  indexed AND in outer join; use the ts_inx_op->iop_ts instead of order_ks
-
-2008-09-23 17:26  source
-
-	* sparql.sql, virtual_dir.sql: * Fixed handle blank nodes in proxy service
-	* Fixed support for post process hook in sponger for rdf type of data
-
-2008-09-23 17:25  source
-
-	* sqlbif2.c: * Fixed gpf on rfc1808_expand_uri
-
-2008-09-22 15:17  source
-
-	* sqlcomp2.c, sqlcost.c, sqldf.c, sqlgen.c, sqlo.c, sqlpfn.c: * Fixed stack margin since 1k is not sufficient
-
-2008-09-19 12:16  source
-
-	* search.c, sqlexp.c, sqlrun.c, wifn.h: * Added support for LIKE on LOBs
-
-2008-09-18 12:17  source
-
-	* http.c: * Fixed setting proxy flag and new physical path when doing internal redirect
-	* Fixed clear proxy request flag explicitly in ws_clear
-
-2008-09-18 12:15  source
-
-	* sparql2sql.c, sparql2sql.h, sparql_p.y: * Added support for ORDER BY ?alias where ?alias is used in top-level
-	  result set
-	* Fixed bad relocation of single-variable FILTER down to SELECT statement
-
-2008-09-18 12:14  source
-
-	* sqldf.c: * Fixed use of local vars for stack check
-
-2008-09-18 12:13  source
-
-	* gate.c, search.c, wifn.h: * Added read ahead all siblings in random access if there are free buffers
-
-2008-09-17 12:29  source
-
-	* sparql.sql, sqlbif.h, srvstat.c, xslt.c: * Added setting to protect against exhaustive sparql CONSTRUCT and DESCRIBE
-
-2008-09-17 10:38  source
-
-	* Makefile.am: * Fixed build dependencies
-	* Fixed missing files from distribution
-
-2008-09-17 10:35  source
-
-	* Makefile.am: * Updated generate script
-	* Updated bison and flex rules to use the generate script
-	* Fixed CLEANFILES rule not to remove generated files that might be hard
-	  to rebuild on some systems
-
-2008-09-16 15:15  source
-
-	* hosting.c, hosting.h, plugin_loader.c: * Fixed dynamic loading on Mac OS X
-	* Code cleanups
-
-2008-09-15 11:55  source
-
-	* sparql_core.c: * Removed duplicate function
-
-2008-09-15 11:52  source
-
-	* sparql2sql.c, sparql2sql.h, sparql2sqltext.c, sparql_core.c: * Fixed SPARQL select ?t where { ?s ?p ?o . optional { ?s a ?t . filter
-	  (?t = <bad>)}} that always returned <bad> instead of NULL
-
-2008-09-15 11:51  source
-
-	* inxop.c: * Fixed problem with descending index in itc_il_search since there is
-	  no guarantee that new starting point is above the starting point last
-	  cached in the il
-
-2008-09-15 11:47  source
-
-	* sqlbif.c, sqldf.c: * Added escape character support to like_min and like_max
-
-2008-09-13 19:41  source
-
-	* sqldf.c: * Fixed needless calls to _all_eq when multiple eqs on a col
-	* Fixed redundant invariant preds
-
-2008-09-13 19:38  source
-
-	* sqlcost.c, sqlpfn.c: * Fixed shorter names of iri funcs
-
-2008-09-13 11:05  source
-
-	* sparql.h, sparql_core.c, sparql_p.y: * Added spar_make_regex_or_like_or_eq() optimization
-
-2008-09-13 09:16  source
-
-	* sparql2sqltext.c: * Fixed problem with where_or_and codegen in NDEBUG
-
-2008-09-13 02:34  source
-
-	* sparql2sql.c: * Added detection of self-join on key values that are equal to same
-	  constant QName
-
-2008-09-13 02:34  source
-
-	* sparql2sqltext.c: * Fixed SQL generation in NDEBUG build
-
-2008-09-12 11:19  source
-
-	* sparql_sff.c: * Fixed problem ...Country/Saint%20Lucia#this is not sff_like
-	  ...Country/%U#this
-
-2008-09-12 01:04  source
-
-	* rdf_core.c, rdfbox.c, sparql.h, sparql.sql, sparql2sqltext.c,
-	  sparql_core.c, sqlbif.c: * Added support for define sql:describe-mode "SPO"
-	* Fixed SQL generation in NDEBUG build
-
-2008-09-12 01:03  source
-
-	* shcompo.c: * Fixed problem with tsparql_demo.sh
-
-2008-09-11 15:06  source
-
-	* search.c: * Fixed sampling; distinct count of an int col cannot be more than the
-	  difference of max and min
-
-2008-09-11 10:36  source
-
-	* ddlrun.c: * Fixed alter table modify column checks for change in nullable flag that
-	  affect layout
-
-2008-09-11 10:35  source
-
-	* system.sql: * Fixed for integer columns do not allow random stats to generate
-	  distinct > max-min
-
-2008-09-11 10:34  source
-
-	* sqlbif.c: * Fixed IN cast for non-null args only
-
-2008-09-11 10:33  source
-
-	* sqldf.c: * Fixed size to allow for calling sql_new_error and descendants
-
-2008-09-10 14:07  source
-
-	* sparql2sql.c: * Fixed FROM <x> FROM NAMED <y> ... GRAPH <y> {...}
-
-2008-09-10 12:52  source
-
-	* ddlrun.c, eqlcomp.c, eqlcomp.h, sparql2sql.c, sqlintrp.c,
-	  sqlnode.h, sqlprocc.c: * Fixed support for re-compilation of queries if RDF views are changed
-
-2008-09-10 12:50  source
-
-	* sqlbif.c: * Fixed IN predicate list now attempts cast when different datatypes
-
-2008-09-09 12:04  source
-
-	* bif_xml.c: * Fixed serialize XHTML escape & etc in attribute values
-
-2008-09-08 10:37  source
-
-	* virtual_dir.sql: * Added support for Accept header in /proxy/rdf
-
-2008-09-08 10:37  source
-
-	* sparql.sql: * Fixed remember the url where we started from and record the end of the
-	  redirect location
-
-2008-09-08 10:35  source
-
-	* sqlgen.c, sqloinx.c: * Fixed bitmap index can not have more than one non-fixed column.
-
-2008-09-08 10:34  source
-
-	* sparql.sql: * Fixed reloading of an RDF view deletes old metadata triples
-
-2008-09-08 10:32  source
-
-	* sparql.sql: * Fixed removed commit in order to allow providers to do transactions
-
-2008-09-08 10:30  source
-
-	* Makefile.am, shcompo.c, shcompo.h, sparql.sql, sparql_p.y,
-	  sqlbif.c, sqlsrv.c: * Added caching of precompiled queries to SPARQL endpoint
-	* Added caching of precompiled queries for bif_exec()
-
-2008-09-08 10:21  source
-
-	* sqltrig.c: * Fixed ignore sql_no_data_found returned by trigger
-
-2008-09-04 11:30  source
-
-	* http.c, virtual_dir.sql: * Added option to return rdf description when http resource is not found
-
-2008-09-04 11:29  source
-
-	* virtual_dir.sql: * Added /proxy/rdf rule to allow adding more rules by rdf_mappers/rdfdesc
-
-2008-09-04 11:28  source
-
-	* system.sql: * Added dba only PL function exec_as
-
-2008-09-04 11:26  source
-
-	* text.c: * Added check if terms are mergeable ie all terms to be near and chain
-
-2008-08-27 12:33  source
-
-	* sqlver.h: * Updated database engine version to 05.08.3034
-
-2008-08-27 12:33  source
-
-	* sqlgen.c, sqlnode.h: * Fixed problem with complex queries that use more thant 65000 variables in
-	  state
-
-2008-08-27 02:16  source
-
-	* sparql2sql.c: * FIxed wrong election of BREAKUP instead of UNION in Q11 of latest BSBM
-
-2008-08-26 11:18  source
-
-	* sparql.sql: * Added optmimzation loading of RDF views
-
-2008-08-26 11:18  source
-
-	* sparql2sqltext.c: * Fixed sparql select ?y where { ... optional { ?x <p> ?y . optional
-	  { ... } } when ?y has non-nullable native valmode
-
-2008-08-25 16:35  source
-
-	* rdfinf.c: * Fixed possible miss count of left join nulls when in iter or rdf inf
-	  iter because the count code is at the end of the end node that keeps
-	  track of any or no result
-
-2008-08-22 09:59  source
-
-	* sparql.sql: * Removed debugging line
-
-2008-08-22 09:26  source
-
-	* http.c, http.h, http_client.c, system.sql: * Added HTTP client cache (for tsuite use)
-
-2008-08-22 09:26  source
-
-	* gate.c, search.c: * Fixed problem with concurrent sampling by SQL compiler
-	* Fixed mtx debug
-
-2008-08-20 21:19  source
-
-	* sparql.sql: * Fixed use %V to escape the values
-
-2008-08-20 21:18  source
-
-	* pldbgcli.c, pldebug.h: * Fixed compiler warnings
-
-2008-08-18 23:48  source
-
-	* repldb.c, sqldf.c, sqlfn.h, sqloinv.c, sqlrcomp.h, turtle_l.l,
-	  xpath.c: * Fixed compiler warnings
-
-2008-08-18 23:47  source
-
-	* jso.c: * Fixed argument check
-
-2008-08-18 23:47  source
-
-	* sqlcomp2.c: * Fixed serialize on parse semaphore to prevent multiple dlls to compile
-	  at the same time
-
-2008-08-17 15:21  source
-
-	* sparql.h, sparql.sql, sparql2sqltext.c, sparql_core.c,
-	  sparql_l.l, sparql_p.y, turtle_l.l: * Added support for "define input:param" and "define input:param-valmode"
-
-2008-08-15 19:34  source
-
-	* sparql2sql.c: * Fixed problem with truncated value
-
-2008-08-15 16:11  source
-
-	* obackup.c, rdf_core.c: * Fixed problem with mtx debugging
-
-2008-08-13 14:07  source
-
-	* rdf_core.h, sparql.h, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, turtle_l.l: * Added table reuse optimization  for OPTIONAL with single triple
-	* Added option to allow '/' and '#' in local part of QName if appropriate
-	  flag is set
-
-2008-08-12 14:39  source
-
-	* rdf_core.c, rdf_core.h, rdfxml_parser.c, sparql.sql, turtle_l.l,
-	  turtle_p.y: * Added support for TriG format
-
-2008-08-11 14:15  source
-
-	* sqltype.c, xmlenc-dec.c: * Fixed compiler warnings
-
-2008-08-11 12:44  source
-
-	* bif_file.c, sqlbif.c, xslt.c: * Fixed compiler warnings
-
-2008-08-07 13:14  source
-
-	* sparql.h, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_p.y, sparql_tree.c, sqlrcomp.c, sqlrcomp.h: * Fixed sparql construction for
-	  { ?s1 ?p1 ?o1 . OPTIONAL { ?s2 ?p2 ?o2 . FILTER (?s1=?s2 && ?o1 < ?o2)}}
-
-2008-08-06 13:32  source
-
-	* sparql2sqltext.c, sqlbif.c, sqlbif.h: * Added ssg_const_is_good_for_split_into_short() and the related
-	  elimination of sprintf_inverse (const, const, 2) in the generated code.
-
-2008-08-06 13:31  source
-
-	* sqlo.c, sqlo.h: * Fixed optimization of identity self joins, like twide the same table with
-	  uniq key equal between them, or equal uniq conditions repeated for both.
-
-2008-08-06 13:30  source
-
-	* sqldf.c: * Fixed 64 bit portability
-
-2008-08-06 13:30  source
-
-	* obackup.c: * Fixed bad seek pos check in restore of strip over 2G
-
-2008-08-05 15:33  source
-
-	* sparql.sql, sparql_qm.c: * Fixed indent
-
-2008-08-05 11:05  source
-
-	* row.c: * Fixed if bm inx inserted before non-unq unq inx, the failed non-unq has
-	  no reset ctx
-
-2008-08-05 11:05  source
-
-	* sqldf.c: * Fixed hash passed to the t_id_hash_set_with_hash_number
-
-2008-08-04 13:48  source
-
-	* rdf_mapping.jso, sparql.h, sparql.sql, sparql2sql.c,
-	  sparql2sql.h, sparql2sqltext.c, sparql_p.y, sparql_qm.c: * Added improvements for BSBM benchmark; including DATATYPE and LANG
-	  clauses in quad mapping, better choice of mode for comparison operations
-	  with global expressions, optimization of filters with NEQ operator
-
-2008-08-04 11:35  source
-
-	* sqlcmps.h: * Fixed typo
-
-2008-08-04 10:30  source
-
-	* bif_explain.c: * Added score to explain
-
-2008-08-02 14:09  source
-
-	* sqlver.h: * Updated database engine version to 3033
-
-2008-08-02 14:08  source
-
-	* sqlcost.c, sqldf.c, sqlo.h, sqloinx.c: * Fixed underflow with inx ints and with multiple mutually eq cols eq
-	  to one col
-	* Added store hash no of the dfe tree in the dfe to cut down on needless
-	  tree compares
-	* Fixed generation of reduntant permutations of inx int joins
-
-2008-08-02 14:04  source
-
-	* eqlcomp.h, sqlbif.c, sqlcomp2.c, sqlcstate.h, sqlo.c, sqlo.h,
-	  sqlpfn.c, sqlpfn.h, sqlrcomp.c, sqlrcomp.h, sqlstmts.c: * Added reentrant sqlc
-	* Added target_rds to thread attr
-	* Fixed parse sem crit sect for yacc only
-	* Removed needless leaves of parse semsince not inside to begin with
-
-2008-08-02 14:00  source
-
-	* auxfiles.c: * Added setting StopCompilerWhenXOverRunTime
-
-2008-07-30 15:21  source
-
-	* regist.c, sparql.sql, sqlcmps.h, sqlcost.c, sqldf.c, sqlgen.c,
-	  sqlo.h, sqloinx.c, sqloprt.c, sqlpfn.c, sqlpfn.h: * Added time limit for compilation
-	* Fixed no iop_other trick for inxint of more than 2
-	* Fixed get box flags func out of iri to id const arg. meter for compiler
-	* Fixed index int card is not the product of component cards but of
-	  them divided by the total rows
-
-2008-07-30 15:18  source
-
-	* widv.h: * Fixed workaround for nil iri_id
-
-2008-07-29 15:50  source
-
-	* Makefile.am, rdf_mapping.jso, sparql.h, sparql.sql, sparql2sql.c,
-	  sparql2sql.h, sparql2sqltext.c, sparql_core.c, sparql_l.l,
-	  sparql_p.y, sparql_tree.c: * Added SPARQL-BI extensions
-	* Added support for iri_to_id_nosignal ()
-	* Fixed sponger and freetext handling
-	* Fixed problem with 404 or connection error; erase the record in the table
-	  so we can retry later
-
-2008-07-29 15:47  source
-
-	* bif_phrasematch.c: * Fixed indentation
-
-2008-07-29 15:42  source
-
-	* rdf_core.c: * Added iri_to_id_nosignal ()
-
-2008-07-28 16:55  source
-
-	* sqldf.c, sqlgen.c: * Fixed compiler speed on complex sql generated by sparql
-
-2008-07-24 16:35  source
-
-	* sparql.sql: * Do not send if-modified if there is an explicit refresh
-
-2008-07-24 13:44  source
-
-	* http.c: * Use session_buffered_read_n instead of dks_readline which has different
-	  purpose, also use catch over the session_buffered_read_n to catch last
-	  char from the input http stream
-
-2008-07-24 13:43  source
-
-	* sparql.sql: * Fixed condition of expiration
-	* Fixed RDF_FT_INDEX_GRABBED
-
-2008-07-24 13:42  source
-
-	* bif_soap.c: * Fixed needlessly large allocation
-
-2008-07-24 13:41  source
-
-	* sort.c: * Fixed WHERE conditions in BREAKUP when boxed zero is returned as
-	  the value of WHERE
-
-2008-07-24 13:40  source
-
-	* virtual_dir.sql: * Optimized sponger not to sponge ref to self
-
-2008-07-16 23:04  source
-
-	* sparql2sqltext.c: * Fixed possible buffer overrun
-
-2008-07-16 11:46  source
-
-	* ksrvext.h: * Added missing symbols for win32 build
-
-2008-07-15 18:36  source
-
-	* xslt.c: * Fixed box zero as xslt engine treats nil as no value
-
-2008-07-11 13:44  source
-
-	* CLIodbc3.c, CLIsql2.c, CLIuti.c, auxfiles.c, bif_audio.c,
-	  bif_file.c, bif_gnw.c, bif_soap.c, bif_text.c, bif_xml.c,
-	  blobio.c, blobio.h, ddlrun.c, disk.c, http.c, insert.c, jso.c,
-	  lock.c, log.c, neodisk.c, numeric.c, oledb.sql, openxml.sql,
-	  rendezvous.c, repl.sql, rltrx.c, row.c, security.c,
-	  snapshot_repl.sql, sparql.sql, sql3.y, sqlbif.c, sqlcomp.c,
-	  sqldf.c, sqlnode.h, sqlo.c, sqloby.c, sqloinx.c, sqlpfn.c,
-	  sqlprocc.c, sqlrun.c, sqlsrv.c, srvcr.c, srvmultibyte.c,
-	  string_tmpl.c, system.sql, text.h, url_rewrite.sql, users.sql,
-	  uuencode.c, widv.h, wiservic.c, wiservic.h, xml_view.sql,
-	  xmlsql.c, xmltree.c, xslt.c: * Fixed spelling
-
-2008-07-10 17:08  source
-
-	* sqlver.h: * Updated engine version to 3032
-
-2008-07-10 16:57  source
-
-	* sparql.sql, sparql2sql.h, sparql2sqltext.c, sparql_core.c,
-	  sparql_sff.c: * Fix for code generation when the SPARQL query has LIMIT and/or OFFSET
-	  clause and uses backquoted expressions in constructor template.
-
-2008-07-10 16:55  source
-
-	* sparql.sql, url_rewrite.sql, useraggr.sql: * Fix for SPARQL metadata manipulation errors in case-sensitive CaseMode.
-
-2008-07-10 16:52  source
-
-	* sparql.h, sparql2sql.c, sparul2sql.c: * Optimization for sparql delete { ?s ?p ?o } where { ?s ?p ?o } and
-	  all similar "delete everything what is found by simple condition"
-
-2008-07-10 16:49  source
-
-	* bif_soap.c, xmltree.c: * Fixed namespaces in SOAP
-
-2008-07-07 13:15  source
-
-	* sparql2sqltext.c: * Added special cases for 'zeropart' IRI and literal formats
-
-2008-07-07 13:14  source
-
-	* sparql_sff.c: * Fixed sff_dislike() for fragments like %U%d and %D%d
-
-2008-07-04 21:51  source
-
-	* bif_explain.c: * Fixed declaration
-
-2008-07-04 16:55  source
-
-	* bif_explain.c, sqlfn.h, sqlprt.c: * Fixed GPF with explain in LUBM testsuite
-
-2008-07-04 15:36  source
-
-	* inxop.c: * Fixed warning from valgrind
-
-2008-07-04 15:09  source
-
-	* sqlbif.c: * Indentation
-
-2008-07-04 15:03  source
-
-	* sqlbif.c: * Added support for %{conn-var-name}s
-
-2008-07-04 14:47  source
-
-	* xmltree.c: * Fixed crash of xml_cli_ms_2dict
-
-2008-07-04 14:47  source
-
-	* sparql_sff.c: * Improved handling of %U and matching %{variable}U with {%variable}U
-
-2008-07-04 14:46  source
-
-	* sqlovdb.c: * Fixed loc local for all tables else inx samples and optimization will
-	  be off
-
-2008-07-04 14:46  source
-
-	* sparql.sql: * Added support for 'zeropart' IRI classes etc.
-
-2008-07-04 14:45  source
-
-	* url_rewrite.sql: * Added support for ^{DynamicLocalFormat}^
-
-2008-07-04 14:44  source
-
-	* sqlsrv.c: * Fixed memory leak
-
-2008-07-04 14:44  source
-
-	* dks_esc.c: * Fixed $U will escape slash
-
-2008-07-04 13:35  source
-
-	* sql3.y: * Fixed support of exists ( ... uniion ... )
-
-2008-07-03 16:02  source
-
-	* sqldf.c: * Fixed compilation of queries with various unusual DFE_TRUE and DFE_FALSE
-	  occurrences (2nd try)
-
-2008-07-03 16:01  source
-
-	* obackup.c: * Fixed allocation of more pages when using stripes
-
-2008-07-03 11:23  source
-
-	* xmltree.c: * Disabled xmlns patch
-
-2008-07-02 17:39  source
-
-	* sqldf.c: * Reverted previous patch
-
-2008-07-02 17:35  source
-
-	* sqlbif.c, sqlbif.h, sqlprt.c: * Fixed describe of status() and other bifs as select not as sproc call
-
-2008-07-02 10:01  source
-
-	* CLIsql3.c: * Fixed threading problem with global options array
-	* Code cleanup
-
-2008-07-02 08:31  source
-
-	* ltrx.h, srvstat.c: * Added srv_stat for tc_aq_from_queue
-
-2008-07-02 08:31  source
-
-	* aqueue.c: * Fixed aq_wait_all that was able not to wait for everything without
-	  signalling an error
-
-2008-07-02 08:30  source
-
-	* bif_xml.c: * Added using of persistent ns declarations in XML outputs
-
-2008-07-02 08:30  source
-
-	* xmltree.c, xmltree.h: * Added xml_get_cli_or_global_ns_prefix as separate C function
-
-2008-07-02 08:29  source
-
-	* sqldf.c: * Fixed workaround to allow compilation of queries with various unusual
-	  DFE_TRUE and DFE_FALSE occurrences
-
-2008-07-02 08:29  source
-
-	* sparql2sqltext.c: * Fixed compilation of queries that are optimized "too much"
-	* Improved codegen for build-ins that are proven to return constants
-
-2008-07-02 08:28  source
-
-	* sparql.sql, sparql_qm.c: * Added support for ^{DynamicLocalFormat}^ and related
-
-2008-06-30 16:41  source
-
-	* sqlbif.c, sqlbif.h, sqlstmts.c: * Fixed problem using auto-increment via insert on view
-
-2008-06-30 16:37  source
-
-	* disk.c, srvstat.c: * Added tests for simulating running out of disk space
-
-2008-06-30 08:38  source
-
-	* sparql2sqltext.c: * Fixed invalid comparison of non-bijection IRI class instances
-
-2008-06-30 08:37  source
-
-	* blob.c: * Disabled page re-use as this may lead to corruption (see tretmp.sql)
-
-2008-06-30 08:36  source
-
-	* sqlbif2.c: * Fixed resolving IRIs where relative part ends with '#'
-
-2008-06-30 08:36  source
-
-	* srvmultibyte.h: * Fixed macro used with MALLOC_DEBUG
-
-2008-06-27 13:29  source
-
-	* disk.c, row.c: * Added safety checks for blob by reference
-	* Added restrict to temp spaces
-
-2008-06-27 11:37  source
-
-	* disk.c, neodisk.c, widisk.h: * Fixed use fsync on Unix and _commit on win32
-
-2008-06-27 07:54  source
-
-	* ddlrun.c, sqlbif.c, sqlbif.h, sqltype.c, system2.sql: * Added protection for system sequences and registry settings
-
-2008-06-26 20:55  source
-
-	* auxfiles.c: * Fixed minimum extend value
-
-2008-06-26 20:53  source
-
-	* regist.c: * Added more regist entries
-
-2008-06-26 14:32  source
-
-	* neodisk.c, regist.c, wifn.h: * Added checkpoint safety
-
-2008-06-26 14:29  source
-
-	* space.c, widisk.h: * Added more safety margin for insert related remap page need.
-
-2008-06-26 11:29  source
-
-	* Makefile.am: * Added rdf det into server
-
-2008-06-26 11:23  source
-
-	* sparql.sql: * Fixed start with alt rdf inx layout unless exec of dyn stmt
-
-2008-06-26 11:21  source
-
-	* sparql.sql: * Fixed return of IRI as id
-
-2008-06-26 11:20  source
-
-	* sparql2sqltext.c: * Added extra debug code
-
-2008-06-26 11:17  source
-
-	* xmltree.h: * Added length check
-
-2008-06-25 20:58  source
-
-	* srvstat.c: * Fixed "unknown" host name resolution on some platforms
-
-2008-06-25 20:53  source
-
-	* system.sql: * Moved RDF objects from yacutia to system.sql
-
-2008-06-25 14:19  source
-
-	* sparql.sql, sparql2sqltext.c, sqlbif.c: * Fixed SPARUL rowcount
-
-2008-06-25 14:18  source
-
-	* sqlbif.c: * Fixed calls to box_narrow_string_as_wide
-
-2008-06-25 12:35  source
-
-	* srvmultibyte.c: * Fixed transform to the end of the box
-
-2008-06-25 11:14  source
-
-	* regist.c: * Fixed limit check only for bif
-
-2008-06-25 11:12  source
-
-	* bif_intl.c, bif_regexp.c, bif_xml.c, sqlbif.c, srvmultibyte.c,
-	  srvmultibyte.h, xmltree.c: * Fixed conversion from wide full of zeros to utf-8 when length is ok
-	* Fixed error handling when cast of too long string
-
-2008-06-24 17:09  source
-
-	* multibyte.c, sqlbif.c: * Fixed check for size
-
-2008-06-24 17:08  source
-
-	* bif_xml.c, sqlbif.c: * Disabled deprecated bif calls
-
-2008-06-24 17:07  source
-
-	* sqlbif.c, sqlbif.h, sqlexp.c, sqlgen.c, sqlintrp.h: * Fixed clear_temp to be invisible for users
-
-2008-06-24 17:06  source
-
-	* sqlbif.c, sqlbif.h: * Fixed bug in arithmetic functions when called with null argument
-
-2008-06-24 17:04  source
-
-	* regist.c, sqlbif.c, wifn.h: * Added limit to registry
-
-2008-06-24 17:02  source
-
-	* ddlrun.c, sqlbif.c, sqlbif2.c, sqloinv.c: * Fixed security issues
-
-2008-06-24 11:59  source
-
-	* eqlcomp.h, rdfbox.c: * Added bif_rdf_long_from_batch_params()
-
-2008-06-22 13:55  source
-
-	* sparql.h, sparql.sql, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_p.y, sparul2sql.c: * Changed SPARUL operations to set row_count and not return anything
-	  when output:format is "_JAVA_"
-
-2008-06-19 18:06  source
-
-	* sparql.sql: * Depricated but not removed  DB.DBA.RDF_QNAME_OF_LONG_SAFE()
-
-2008-06-19 14:41  source
-
-	* dks_esc.c, http.h, rdf_core.c, rdf_core.h, sparql_sff.c,
-	  sqlbif.c, xmltree.h: * Added uriqa_get_default_for_connvad for sprintg/sprintf_inverse with
-	  connection variables
-	* Added support for connecion variables syntax in sprintf plus related
-	  support in SPARQL front-end optimizer
-
-2008-06-19 14:40  source
-
-	* bif_file.c: * Added access control check
-
-2008-06-19 14:17  source
-
-	* auxfiles.c, disk.c: * Added new code for stripe extend
-
-2008-06-19 14:12  source
-
-	* lock.c: * Fixed set lt_status to pending at the end of lt_restart otherwise there
-	  is a window when kill_other_trx may mark to wait
-
-2008-06-19 14:09  source
-
-	* rdf_core.c: * Fixed disable log iri when server initializes
-
-2008-06-18 15:38  source
-
-	* sparql.sql: * Fixed JSO_LOAD_GRAPH to run with any indexes
-
-2008-06-18 10:48  source
-
-	* information_schema.sql: [no log message]
-
-2008-06-17 20:15  source
-
-	* information_schema.sql: * Fixed unneeded re-create of information schema on startup
-
-2008-06-17 14:06  source
-
-	* srvstat.c: * Added check for run local
-
-2008-06-17 14:05  source
-
-	* sqlver.c: * Fixed typo
-
-2008-06-17 14:05  source
-
-	* log.c: * Removed deprecated code
-
-2008-06-17 09:08  source
-
-	* disk.c, log.c: * Fixed duplicate check for dbs_log_name
-	* Fixed check for many FD per file
-
-2008-06-17 09:07  source
-
-	* bif_explain.c, neodisk.c: * Fixed var decls should be at beginning of block
-
-2008-06-16 21:39  source
-
-	* disk.c, log.c, log.h, sqlbif.h, wi.h: * Added new test to check for duplicate segment/database names
-
-2008-06-16 21:36  source
-
-	* sparql.sql: * Fixed _JAVA_ format to only return three columns
-
-2008-06-16 21:35  source
-
-	* xslt.c: * Fixed calculating length when no format is given
-
-2008-06-16 17:38  source
-
-	* sparql.sql, sparql2sqltext.c, sparql_p.y: * Aded output:valmode '_JAVA_' which returns three columns
-
-2008-06-16 17:36  source
-
-	* bif_explain.c, sqlbif.c, sqlbif.h, sqlcost.c, sqldf.c, sqlfn.h,
-	  sqlgen.c, sqlintrp.c, sqlnode.h, sqlrun.c, wifn.h: * Added top skip exps check; not if gb or sorted gb
-	* Added show card guess in explain
-	* Added explain of notes and exec of skip
-	* Fixed alloc for cast
-	* Fixed skip node before select exps and select exps generated at end
-	  and not outside loops if skip.
-	* Fixed top query with no order by
-	* Fixed no copy when returning value of func from proc
-	* Fixed cost calculation sparql iri literal since this uses 2 function
-	  calls not 1; Compiler cannot determine the constant value at compiler
-	  time which crews up cost model.
-
-2008-06-16 17:28  source
-
-	* disk.c: * Added support for cpt recovery for killed during cpt
-
-2008-06-16 17:16  source
-
-	* auxfiles.c, neodisk.c, obackup.c, recovery.h, sqlbif2.c,
-	  sqlsrv.c, wi.h, wifn.h: * Added support for cpt recovery for killed during cpt
-
-2008-06-16 15:21  source
-
-	* rdfbox.c: * Fixed typos
-
-2008-06-16 14:23  source
-
-	* aqueue.c: * Fixed indentation
-
-2008-06-16 14:21  source
-
-	* aqueue.c: * Fixed code not to ignore errors across aq_wait_all
-
-2008-06-14 09:08  source
-
-	* ksrvext.h: * Added latest struct into to header file
-
-2008-06-14 09:02  source
-
-	* sqlsrv.c: * Fixed set checkpoint last time after checkpoint has finished
-
-2008-06-14 09:01  source
-
-	* vt_text.sql: * Added grant to public to create freetext-index on own tables
-
-2008-06-14 09:00  source
-
-	* sparql.h, sparql.sql, sparql_core.c, sparql_p.y: * Added SPARUL_CREATE, SPARUL_DROP and related infrastructure in the
-	  SPARQL frontend
-	* Added DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS
-
-2008-06-13 14:28  source
-
-	* sparql.sql: * Fixed redundant conversion calls to iri_to_id and id_to_iri in SPARQL
-	  web service endpoint
-
-2008-06-13 14:26  source
-
-	* rdf_core.c: * Fixed use of  ws_get_mime_header instead of old ws_header function
-	  that does not handle spaces
-	* Fixed memory leak
-
-2008-06-13 14:23  source
-
-	* sparql2sqltext.c: * Added call of __box_flag_tweak() to sql code generated for SQL valmode
-	  for IRI variables that have proven constant value.
-
-2008-06-13 14:23  source
-
-	* rltrx.c, update.c: * Fixed problem with deleted flag left on post commit; make a note about
-	  it but no GPF. Like error in cpt rb or cpt recov or such could make
-	  these in principle
-
-2008-06-12 15:17  source
-
-	* rdfinf.c, sparql.sql: * Added support of equivalent class and property
-
-2008-06-12 15:16  source
-
-	* neodisk.c: * Fixed problem in checkpoint of uncommitted blob; do not alter allocated
-	  items if no tree associated or if temp tree
-
-2008-06-12 12:56  source
-
-	* rdf_core.c: * Added initial support for DynamicLocal
-
-2008-06-12 12:27  source
-
-	* CLIuti.c: * Fixed DV_RDF for inlinded integers when rb_box is not a pointer
-
-2008-06-11 12:15  source
-
-	* sparql2sql.c, sparql2sqltext.c: * Improved selection of union valmode for when all variants produce
-	  references only (not literals) and the smallest common valmode is
-	  SSG_VALMODE_LONG. In that case we are making SSG_VALMODE_SQLVAL instead
-	  so we do not call iri_to_id without the strong need
-
-2008-06-11 12:14  source
-
-	* bif_date.c: * Move declaration to start of function
-
-2008-06-11 12:14  source
-
-	* CLIodbc3.c, odbcinc.h: * Added extention for SQLGetFieldDesc to retrieve RDF metadata
-
-2008-06-11 10:50  source
-
-	* sparql_sff.c: * Improved sff_isect and LIKE for pattern and actual string
-
-2008-06-11 10:49  source
-
-	* bif_date.c, datesupp.c, sqlbif.c, sqlbif.h, datesupp.h: * Added support for %D into bif_sprintf and bif_sprintf_inverse
-
-2008-06-11 10:48  source
-
-	* sparql2sqltext.c: * Improved code generation for a filter for GRAPH `iri(my_expression)` { ... }
-	  where graph is made by mapping with a fixed graph. Without the
-	  special optization it becomes iri_to_id ('graph iri string from view
-	  declaration') = DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE (my_expression)
-
-2008-06-09 16:57  source
-
-	* rdfinf.c: * Fixed memory leak
-
-2008-06-09 15:27  source
-
-	* ddlrun.c, log.c, log.h, security.h, sqlbif.c, sqlbif.h, sqlfn.h,
-	  system2.sql: * Added support for running log_nnn as user
-
-2008-06-09 14:57  source
-
-	* bif_dav.c: * Fixed typo
-
-2008-06-09 14:56  source
-
-	* sparql.sql: * Fixed use of rb_box to handle itf-8
-
-2008-06-09 14:55  source
-
-	* CLIuti.c: * Fixed calc length of a string rb_box
-
-2008-06-05 12:49  source
-
-	* sparql.sql: * Suppressed errors for non-string values
-
-2008-06-05 12:48  source
-
-	* bif_dav.c: * Added support for chunked transfer input in PUT method, which some
-	  clients use to store large files
-
-2008-06-05 12:47  source
-
-	* obackup.c: * Fixed problem with checking 4th argument which should be an array
-
-2008-06-04 13:19  source
-
-	* rdfbox.c: * Fixed named bnode in obj not shown
-
-2008-06-04 09:45  source
-
-	* rdfbox.c, sparql.sql: * Fixes for "SPARQL and Java" valmode tricks
-	* Fixed function to not return IRI_ID
-
-2008-06-04 09:43  source
-
-	* xqf.c: * Fixed problem with RDF box argument
-
-2008-05-29 21:24  source
-
-	* rdfinf.c, rdfinf.h, sparql.sql: * Added inference loading optimization, i.e. traverse subclasses from the
-	  superclass, also use HT instead of looking into linked list for presence
-
-2008-05-29 18:17  source
-
-	* sqlbif.c: * Fixed compile error
-
-2008-05-29 10:21  source
-
-	* rdf_core.c, sparql.h, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql_l.l, sparql_p.y, sqlbif.c, widv.h: * Added extentions for Jena and other providers:
-	   - Named blank nodes
-	   - INSERT DATA
-	   - DELETE DATA
-
-2008-05-28 23:41  source
-
-	* CLIuti.c, rdf_mapping.jso, rdfbox.c, sparql.h, sparql.sql,
-	  sparql2sql.h, sparql2sqltext.c, sparql_p.y, sparul2sql.c,
-	  sqlbif.c, sqlbif.h: * Added additional SPARQL support for Java clients
-
-2008-05-28 02:12  source
-
-	* obackup.c: * Added checkpoint before starting backup_online
-
-2008-05-28 02:12  source
-
-	* rdf_core.c, rdf_core.h, turtle_l.l, turtle_p.y: * Fixed Turtle parser to be re-entrant
-
-2008-05-28 01:47  source
-
-	* CLIuti.c, arith.c, bif_file.c, bif_pop3.c, bif_soap.c, bif_xml.c,
-	  ddlrun.c, disk.c, lock.c, mtwrite.c, row.c, search.c, sort.c,
-	  sqlbif.c, sqlbif.h, sqlcmps.h, sqlrun.c, srvstat.c, virtext.h,
-	  wi.h, xml.h, xmlnode.h, xmlschema.c, xmlsearch.c, xmlsql.c,
-	  xmltree.c: * Removed remnants of previous database engine that clutter the sources
-
-2008-05-26 22:36  source
-
-	* sqlo.c: * Fixed frash when row-level security is used and no access to table
-	* Fixed bad url in comment footer
-
-2008-05-26 22:35  source
-
-	* bif_soap.c, http.c: * Added improved error passing for ODS api
-
-2008-05-26 22:31  source
-
-	* lisprdr.c: * Fixed to box return value as caller expects this
-
-2008-05-26 22:28  source
-
-	* sqlbif.c: * Added check for DBA group to limit access to:
-	    __atomic, client_trace, disconnect_user, log_enable, log_text,
-	    mem_enter_reserve_mode, mem_set_hard_limit, page_dump, replay,
-	    repl_set_raw, repl_text, repl_text_pushback, set_hit_memlimit,
-	    txn_killall and *_meter
-	* Disabled *_meter functions in production build
-	* Removed deprecated function corrupt_page from function list
-
-2008-05-21 14:38  source
-
-	* rdfinf.c: * Fixed pointer returned by function
-
-2008-05-18 17:15  source
-
-	* eqlcomp.c, sqlcmps.h, sqlcost.c, sqldf.c, sqlgen.c: * Added MaxSqlExpressionDepth setting to virtuoso.ini to limit complex
-	  queries to overflow the stack
-
-2008-05-16 18:05  source
-
-	* 2pc.c, CLI.h, CLIuti.c, auxfiles.c, bif_crypto.c, json.l, json.y,
-	  rdfbox.c, search.c, security.c, sparql2sql.c, sparql_core.c,
-	  sparql_p.y, sparql_sff.c, sql3.y, sqlfn.h, text.h, wi_xid.c,
-	  xslt.c: * Fixed compiler warnings
-
-2008-05-16 10:22  source
-
-	* sparql_core.c: * Fixed wrong arguments
-
-2008-05-15 18:04  source
-
-	* sqlver.h: * Updated version
-
-2008-05-15 18:03  source
-
-	* sparql.sql: * Added support for parallelized and ft-enabled SPONGE
-
-2008-05-15 18:02  source
-
-	* scn3.l, sparql.h, sparql.sql, sparql_core.c, sparql_p.y,
-	  sqlnode.h, sqlsrv.c, xmltree.c, xmltree.h: * Added support for persistent namespace declarations
-
-2008-05-15 17:57  source
-
-	* sparql2sql.c: * Added _refresh_fre_text param for ssg_grabber_codegen
-
-2008-05-15 17:56  source
-
-	* sparql2sqltext.c: * Improved pretty-print for long function calls
-
-2008-05-15 15:49  source
-
-	* arith.c, arith.h, numeric.c, numeric.h, search.c: * Fixed collation of num in any col
-
-2008-05-15 15:47  source
-
-	* bif_xml.c, xslt.c: * Fixed cast
-
-2008-05-15 15:47  source
-
-	* CLIuti.c, blobio.h, rdf_core.h, rdfbox.c: * Added DV_RDF box support in clients
-
-2008-05-11 23:46  source
-
-	* bif_file.c: * Added new bif_mdigest5
-
-2008-05-08 10:58  source
-
-	* sqlver.h: * Updated version to 05.00.3030
-
-2008-05-08 10:57  source
-
-	* sqlbif.c, sqlsrv.c, widv.h: * Dropped the unused dv blob header tag, replaced by the new rdf box tag dv.
-	* Init string print to transmit the tag to newer clients
-
-2008-05-08 10:36  source
-
-	* rdfbox.c, text.c, rdf_core.c: * Fixed problem with bf_iri
-
-2008-05-08 10:30  source
-
-	* bitmap.c, rdfbox.c, search.c, search_in.c, wi.h, wifn.h: * For any collation, when different dtp, distinguish dtp range from
-	  value range. Binary-or the dvc noorder bit into the result to show it us
-	  a difference of dtp and not magnitude.  Like this lte 10 will give
-	  numbers but not strings. Same for rdf boxes that differ in type or lang
-
-2008-05-07 15:55  source
-
-	* sparql2sqltext.c: * Disabled typemax / typemin comparisons for now
-
-2008-05-07 15:52  source
-
-	* xslt.c: * Fixed support of dictionaries
-
-2008-05-07 15:51  source
-
-	* http_client.c: * Fixed double free if error is raised inside context
-
-2008-05-05 11:05  source
-
-	* rdf_core.c: * Fixed error message
-
-2008-05-05 11:04  source
-
-	* sparql.sql: * Added new role SPARQL_SPONGE
-
-2008-05-05 10:51  source
-
-	* blob.c: * Fixed problem trying to free when recovering from deleted blob
-
-2008-04-21 10:08  source
-
-	* ksrvextphp.h: * Fixed prototype
-
-2008-04-18 15:55  source
-
-	* sql3.y, sql_to_c.awk: * Fixed compatibility
-
-2008-04-18 15:52  source
-
-	* bif_soap.c, http_client.c: * Fixed Content-Length to use 64bit format
-
-2008-04-15 12:58  source
-
-	* widisk.h: * Removed unused defines
-
-2008-04-15 12:57  source
-
-	* mail_cli.sql, nn_svr.sql, phrasematch.sql, replddk.sql,
-	  simile.sql, sparql.sql, system.sql, uddi.sql, url_rewrite.sql,
-	  virtual_dir.sql, xmla.sql: * Added ifdef around 5.0 specific upgrades
-
-2008-04-11 11:16  source
-
-	* http.c, sparql.sql, sqlbif.c, sqlbif.h: * Fixed support for varbinary results in RDF/XML, TTL and JSON serialization
-
-2008-04-10 11:48  source
-
-	* hosting.sql: * Added http authorization to hosting plugin
-
-2008-04-10 11:46  source
-
-	* plugin_loader.c: * Added new plugin type "attach" to preload shared libraries
-
-2008-04-10 11:45  source
-
-	* Makefile.am, bif_soap.c, http.c, http.h, soap.h, wsdl2rdf.xsl: * Added support for WSDL 2.0 and WSDL 2.0-RDF
-
-2008-04-10 11:41  source
-
-	* sqlgen.c: * Fixed problem with an exp that is a hash join key and is thereafter
-	  reused in the after join test gets a bad ssl cause the ssl is refd outside
-	  of context so do not associate ssls to stuff placed inside hash fillers
-
-2008-04-02 12:20  source
-
-	* .cvsignore: * More files to ignore
-
-2008-04-02 12:20  source
-
-	* hosting.c, hosting.sql, http.c: * Added extra CGI variables
-	* Added code to run hosting requests under same user id as vsp code
-
-2008-04-02 12:19  source
-
-	* bif_xml.c: * Fixed inlining long varbinary giving a dv_bin
-
-2008-04-02 12:18  source
-
-	* ddlrun.c, sqlparext.h, sqlwords.gperf: * Added dummy partition def syntax
-
-2008-04-02 12:16  source
-
-	* virtual_dir.sql: * Added content location header
-
-2008-04-02 12:16  source
-
-	* sql3.y: * Added empty rules for testing
-
-2008-04-02 12:15  source
-
-	* update.c: * Fixed update to use default value instead of NULL in init of new columns
-
-2008-04-02 12:14  source
-
-	* sparql_p.y: * Fixed parsing scalar subqueries
-
-2008-03-26 14:04  source
-
-	* sqlbif.c: * Added support for DV_BIN in subseq
-
-2008-03-24 18:19  source
-
-	* sparql_core.c, xqf.c: * Fixed datatype conversion problem with sparql insert
-	  { <s> <p> "11.04"^^<http://www.w3.org/2001/XMLSchema#double> . }
-
-2008-03-21 11:29  source
-
-	* rdfbox.c: * Fixed comparison of typed RDF boxes with XML content
-
-2008-03-21 11:28  source
-
-	* bif_file.c: * Added support for writing DV_BIN to file system
-
-2008-03-20 00:50  source
-
-	* bif_file.c: * If strerror_t returns char * we should check != NULL instead of == 0
-
-2008-03-20 00:49  source
-
-	* sparql.h: * Fixed typo in function prototype leading to core dump on 64bit machines
-
-2008-03-19 15:19  source
-
-	* sparql2sql.c, sparql2sqltext.c, xmltree.c: * Fixed breakup on union of joins with fake joins optimized away
-	* Improved support for long varchar columns in RDF views
-
-2008-03-19 15:18  source
-
-	* phrasematch.sql: * Added AP_LINK_DATA_LONG to support long data associated with phrases
-
-2008-03-19 15:16  source
-
-	* http.c, http.h, system.sql, url_rewrite.sql: * Flag to url rewrite to keep logical path, used in /~user rule in ODS
-
-2008-03-19 15:12  source
-
-	* sqlbif.c: * Added bif to change runtime mem sql hash max size for testing purposes only
-
-2008-03-19 15:11  source
-
-	* hash.c, row.c, sqlfn.h: * Use same serialization for longer strings as for key_has_box when
-	  longvarbinary and inlined string are returned
-
-2008-03-14 16:14  source
-
-	* http.c, meta.c, sqlbif.c: * Added code to allow deserialize a content from dv_bin
-	* Added code in blob_to_string/output to allocate properly varchar from bin
-	* Added code to allow http to send dv_bin directly to client
-
-2008-03-14 13:06  source
-
-	* ltrx.h: * Removed deprecated define
-
-2008-03-13 22:06  source
-
-	* Makefile.am, phrasematch.sql: * Moved phrasematch.sql to main engine directory
-
-2008-03-13 18:23  source
-
-	* url_rewrite.sql: * Fixed printing (NULL) as a parameter value; this means value is empty
-
-2008-03-13 18:22  source
-
-	* odbccat.c, remote.h: * Fixed missing globals
-
-2008-03-13 18:20  source
-
-	* sqlbif.c: * Fixed support for 8-bit delimiters in bif_split_and_decode()
-
-2008-03-13 18:19  source
-
-	* json.l, json.y, sparql_core.c: * Fixed JSON parser to pass the JSON checker test suite
-
-2008-03-13 15:17  source
-
-	* sparql2sqltext.c: * Fixed sponge with build-in metadata
-
-2008-03-13 15:16  source
-
-	* sparql.sql: * Fix for attempts to sponge on non-IRI values
-	* Fix for numeric in DB.DBA.RDF_QM_DEFINE_IRI_CLASS_FUNCTIONS
-
-2008-03-13 15:15  source
-
-	* xmla.sql: * Added rudimentary support of procedure execution via XMLA
-
-2008-03-13 15:13  source
-
-	* wifn.h, sqlbif.c: * Small cleanup
-
-2008-03-13 15:12  source
-
-	* sqldf.c, sqlo.c, sqlo.h, sqlparext.h, sqlpfn.c: * Fixed bug making an in into an exists record
-
-2008-03-13 15:09  source
-
-	* sqlbif.c: * Added bif_deserialize() extentions
-
-2008-03-13 15:08  source
-
-	* bif_phrasematch.c: * Added AP_LINK_DATA_LONG to support long data associated with phrases
-
-2008-03-13 15:07  source
-
-	* bif_json.c, json.l, json.y, sparql.h, sparql_core.c, sparql_l.l: * Fixed JSON parsing
-
-2008-03-13 15:04  source
-
-	* odbccat.c, remote.h, sqlovdb.c, sqlrcomp.c, sqlrrun.c: * Regenerated stubs
-	* Reindented code
-
-2008-03-10 12:16  source
-
-	* url_rewrite.sql: * Removed default port from host
-
-2008-03-07 19:44  source
-
-	* sparql.h, sparql.sql, sparql2sql.c, sparql2sql.h, sparql_core.c,
-	  sparql_l.l, sparql_p.y, sparql_sff.c, sqlbif.c: * Added support for NUMERIC in RDF views
-	* Small bugfixes and cleanups
-
-2008-03-06 17:39  source
-
-	* sqlrrun.c: * Added missing global
-
-2008-03-06 16:34  source
-
-	* aqueue.c, search.c: * Fixed compiler warnings about const mismatch
-	* Fixed compiler warnings about missing cast
-	* Fixed compiler warnings about unused variables
-	* Fixed compiler warnings about possible uninitialized variables
-	* Fixed compiler warnings about printf format
-	* Fixed compiler warnings about unreachable code
-
-2008-03-06 16:24  source
-
-	* numeric.c: * A top level numer add needs no scale greather than that of the more
-	  precise operand.
-	* Optimized handling of trailing zeros; detect them better in
-	  numeric_normalize
-
-2008-03-06 16:06  source
-
-	* CLIuti.c: * Use wi.h instead of widd.h
-
-2008-03-06 16:05  source
-
-	* widisk.h: * Fixed problems with macro argument expansion
-
-2008-03-06 16:04  source
-
-	* sqlsrv.c: * Fixed compiler warning about dangling else
-
-2008-03-06 16:03  source
-
-	* bitmap.c, bitmap.h, sqlbif2.c: * Fixed warnings on long constants
-
-2008-03-06 16:02  source
-
-	* CLIodbc3.c, CLIsql1.c, CLIuti.c, eqlcomp.c, sqlbif.c, sqlcomp.h: * Fixed column descriptor to use box_int on all members of struct
-
-2008-03-06 15:58  source
-
-	* 2pc.c, CLIsql2.c, CLIuti.c, bif_explain.c, bif_file.c,
-	  bif_phrasematch.c, bif_pop3.c, bif_soap.c, bif_text.c, bif_xml.c,
-	  bitmap.c, blob.c, ddlrun.c, disk.c, eqlcomp.c, hash.c, http.c,
-	  insert.c, inxop.c, jso.c, log.c, meta.c, mtwrite.c, multibyte.c,
-	  multibyte.h, numeric.c, obackup.c, rdf_core.c, rdfbox.c,
-	  rdfinf.c, rltrx.c, row.c, scn3.l, search.c, security.h,
-	  sparql2sql.c, sparql2sql.h, sparql2sqltext.c, sparql_core.c,
-	  sparql_sff.c, sqlbif.c, sqlbif2.c, sqlcomp.c, sqlcomp2.c,
-	  sqlcost.c, sqldf.c, sqlexp.c, sqlgen.c, sqlintrp.c, sqlo.h,
-	  sqloinx.c, sqlpfn.c, sqlprocc.c, sqlrrun.c, sqltype.c,
-	  srvmultibyte.c, srvstat.c, ssl.c, text.c, update.c, wifn.h,
-	  xmlenc.c, xmltree.c, xpath.c, xpathp.y, xpf.c, xqf.c, xslt.c,
-	  xslt_opt.c: * Fixed compiler warnings about const mismatch
-	* Fixed compiler warnings about missing cast
-	* Fixed compiler warnings about unused variables
-	* Fixed compiler warnings about possible uninitialized variables
-	* Fixed compiler warnings about printf format
-	* Fixed compiler warnings about unreachable code
-
-2008-03-05 16:58  source
-
-	* ddlrun.c, hosting.c, neodisk.c, sqltype.c, srvstat.c, xslt.c: * Fixed prototypes of maphash_func arg1 of maphash
-
-2008-03-05 16:57  source
-
-	* bif_phrasematch.c: * Fixed compatibility with old databases
-
-2008-03-03 15:10  source
-
-	* sqlcost.c, sqldf.c, sqlgen.c: * Existing preds have a card of less than one. If a hash filler has local
-	  ubq conds that also make hash fillers, then make it so the hash fillers
-	  get done inermost first, as seen in sqlgen diff.
-	* Added some more logic for conds known at compile time.
-	* Added cost of hash fillers if these involve other hash fillers
-	* Fixed try the hash filler preds biz if less than half pool left
-
-2008-03-01 14:01  source
-
-	* bif_phrasematch.c: * Fixed types in struct for Windows
-
-2008-02-28 22:08  source
-
-	* bif_phrasematch.c: * Fixed 64bit compatibility
-
-2008-02-28 22:07  source
-
-	* sparql.sql: * Adde DB.DBA.RDF_CONVERT_RDFXML_TO_TTL()
-	* Minor fixes inclusing fix in audit
-
-2008-02-28 22:05  source
-
-	* search_in.c, xqf.c, sqlbif2.c: * Fixed compiler warnings
-
-2008-02-28 22:05  source
-
-	* bif_json.c, json.y, sqlfn.h, scn3.l: * Fixed compiler warnings about missing prototypes
-
-2008-02-28 22:04  source
-
-	* sqlbif.c: * Added bif_aset_zap_arg() and bif_vector_zap_args()
-
-2008-02-28 22:03  source
-
-	* bif_uuencode.c, uuencode.c: * Added support for string sessions with non-NULL strsestmpfile_t storage
-
-2008-02-28 22:01  source
-
-	* sqldf.c: * Fixed compiler warning
-
-2008-02-28 22:01  source
-
-	* url_rewrite.sql: * Added absolute URL in Location header
-
-2008-02-27 21:41  source
-
-	* CLI.h, rdf_core.c, rdfbox.c, rltrx.c, sparql2sql.c,
-	  sparql_core.c, sparql_p.y, sparql_sff.c, sql3.y, sqldf.c,
-	  sqlfn.h, sqlgen.c, sqlintrp.c, sqlsrv.c, sqlstmts.c,
-	  srvmultibyte.c, srvstat.c: * Fixed compiler warnings for 64bit build
-
-2008-02-27 21:36  source
-
-	* sparql_core.c: * Fixed GPF as sparp argument was missing
-
-2008-02-27 21:33  source
-
-	* auxfiles.c, http.c, http.h: * Fixed bug with SSL support on 64bit
-
-2008-02-27 21:28  source
-
-	* virtual_dir.sql: * Fixed escape special chars
-
-2008-02-27 21:27  source
-
-	* aqueue.c: * Added bif_aq_request_zap_args()
-
-2008-02-27 21:25  source
-
-	* rdf_core.c, rdf_core.h: * Added bif_iri_to_id_if_cached()
-
-2008-02-26 21:03  source
-
-	* virtual_dir.sql: * Upgrade existing /proxy path
-
-2008-02-23 00:55  source
-
-	* sort.c, sqlfn.h, sqlgen.c, sqlnode.h, sqlorder.c: * When having an order by with top, do not flush to disk, but read from the
-	  mem temp instead. Circumvents length limits for sort temp rows.
-
-2008-02-22 15:26  source
-
-	* sparql.sql: * Fixed indentation
-
-2008-02-22 15:24  source
-
-	* sparql.sql: * Fixed printing double dt
-
-2008-02-22 13:43  source
-
-	* rltrx.c: * Removed putting a lock on a leaf ptr; these are never checked and can get
-	  lost in double lp insert after split
-
-2008-02-22 11:44  source
-
-	* sqlver.h: * Updated engine version
-
-2008-02-22 11:44  source
-
-	* rdfbox.c, sparql.sql, sqlbif.c, sqlbif.h: * FIxed various RDF related serialization issues
-
-2008-02-22 11:43  source
-
-	* rdf_core.c, rdf_core.h: * Added key_name_to_existing_cached_iri_id()
-
-2008-02-22 11:42  source
-
-	* search.c: * Fixed problem with serializable itc locking leaf pointers
-
-2008-02-22 11:41  source
-
-	* hash.c, row.c, sqlfn.h: * Fixed HA_DISTINCT to use new box_to_shorten_any() function to eliminate
-	  problem with long values to hash
-
-2008-02-22 11:40  source
-
-	* sparql2sqltext.c, sparql_core.c: * Added checks to not deref NIL
-
-2008-02-22 11:37  source
-
-	* virtual_dir.sql: * Fixed proxy services
-
-2008-02-22 11:37  source
-
-	* aqueue.c: * Fixed aq_wait_all to not loop throught the ht each time it waits for a
-	  pending. Loop once and wait for each and then check if all are ready
-
-2008-02-20 15:59  source
-
-	* search.c: * Fixed problem with alter table add column using a default value
-
-2008-02-20 12:32  source
-
-	* http.c: * Fixed use char-by-char reading when contact length is unknown
-	* Fixed use session_flush_1 inside write ctx to avoid leaving ctx
-	  prematurely
-
-2008-02-19 21:57  source
-
-	* sparql.sql: * Added passing content type to mappers
-
-2008-02-19 21:57  source
-
-	* arith.c: * Fixed comparison of two UDTs of type reference
-
-2008-02-19 11:24  source
-
-	* sqlver.h: * Updated version to 05.00.3027
-
-2008-02-19 11:24  source
-
-	* rdf_core.c, rdf_core.h, rdfbox.c, sparql.sql, turtle_l.l,
-	  xmltree.c, xqf.c: * Fixed printing datetime types and parsing of integers and strings
-
-2008-02-19 11:23  source
-
-	* arith.c, arith.h, bif_explain.c, sort.c, sparql.sql,
-	  sparql_core.c, sparql_p.y, sql3.y, sqlcomp.c, sqldf.c, sqlexp.c,
-	  sqlintrp.c, sqlintrp.h, wi.h: * Added initial support for DVC_NOORDER
-
-2008-02-19 11:08  source
-
-	* sparql.sql: * Added instructions how to grant SPARQL_UPDATE role to SPARQL
-
-2008-02-19 11:03  source
-
-	* aqueue.c, disk.c, http.c, lock.c, ltrx.h, neodisk.c, rltrx.c,
-	  sqlbif.c, srvstat.c, auxfiles.c: * Added hash table for locks
-
-2008-02-18 10:38  source
-
-	* sqlgen.c: * A locus that becomes a hash filler may miss output cols because it is
-	  placed in places where not all out cols are out cols. Depends on order
-	  of trying plans. So if it is a hash filler then make sure that the out
-	  cols are actually on the output of the locus
-
-2008-02-18 09:59  source
-
-	* sparql.sql: * Added max cache ttl
-
-2008-02-18 09:58  source
-
-	* sparql2sql.c: * Fixed GPF in code generation for:
-	  sparql select distinct ?o where {?s ?p ?o . filter(?o=0 || ?o=1)}
-	* Fixed sparp_optimize_BOP_OR_filter_walk() at IN operator with good
-	  variable at left
-
-2008-02-18 09:56  source
-
-	* sparql2sqltext.c: * Improved SQL code generation for SAMETERM build-in when some arguments
-	  are known to be IRIs
-	* Fixed sparql generation for:
-	  select 1 where { <s> <p> ?o . filter ((?o in (<qname>)) || 1) }
-	* Fixed generation of "(bad)" aliases for columns of RDF_QUAD inside breakup
-	  FROM clause.
-
-2008-02-18 09:51  source
-
-	* xslt.c: * Fixed parameter passing in sprintf of error reporter
-
-2008-02-18 09:50  source
-
-	* xpscn.l: * Removed unused function
-
-2008-02-18 09:49  source
-
-	* sqlexp.c: * Added check for NULL when calling iri to id for effect only
-
-2008-02-08 17:24  source
-
-	* sqlver.h: * Updated version to 05.00.3026
-
-2008-02-08 16:08  source
-
-	* sqlwords.h: * Removed generated file from CVS
-
-2008-02-08 15:29  source
-
-	* sqlwords.h: * Regenerated with gperf 3.0.2
-
-2008-02-07 10:53  source
-
-	* sparql2sqltext.c: * Fixed problem in code generation
-
-2008-02-07 10:31  source
-
-	* bif_file.c: * Fixed compiler warnings
-
-2008-02-07 10:28  source
-
-	* sqlorder.c: * Fixed expressions in select with top distinct order must be done before
-	  the distinct, not before the order by
-
-2008-02-07 09:55  source
-
-	* sqlcmps.h, sqlgen.c: * Fixed expressions in select with top distinct order must be done before
-	  the distinct, not before the order by
-
-2008-02-07 00:33  source
-
-	* sqlcmps.h, sqlgen.c: * Fixed group by with grouping col being an exp with an AS alias
-
-2008-02-07 00:32  source
-
-	* sparql_sff.c: * Added extra checks of pointers to debug crash
-
-2008-02-07 00:31  source
-
-	* hash.c: * Fixed size of initial hash
-
-2008-02-07 00:30  source
-
-	* xslt.c: * Added rehash for dict
-
-2008-02-07 00:30  source
-
-	* http_client.c: * Added support to make canonic host e.g. remove :PORT
-
-2008-02-07 00:29  source
-
-	* bif_file.c: * Added additional bifs for TPC-H
-
-2008-02-01 12:23  source
-
-	* sqlver.h: * Updated version to 05.00.3025
-
-2008-02-01 11:39  source
-
-	* sqldf.c: * Do not place funcs as early as possible, but at the place with the
-	  lowest cardinality. Not on by default cause card guess not always
-	  right
-
-2008-02-01 11:38  source
-
-	* inxop.c, sqlgen.c, sqlnode.h: * Added inxop option for bitmap index
-	* Check other bitmaps to avoid needless seeks
-	* Do not reassign all search pars before every seeek
-
-2008-02-01 01:07  source
-
-	* sparql.h, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_p.y: * Fixed BREAKUP with more than one triple per row
-	* Fixed printing non-nullable results of OPTIONAL as nullable
-	* Added draft support for sub-SELECT and sub-ASK in expressions
-	* Minor SPARQL fixes
-
-2008-02-01 01:05  source
-
-	* sqlfn.h, sqlrun.c: * Added qi_check_stack as separate function that implements QI_CHECK_STACK
-	  in DEBUG mode
-
-2008-02-01 01:04  source
-
-	* xmlenc.c: * Added new function bif_xenc_rand_bytes()
-
-2008-02-01 01:03  source
-
-	* blobio.h: * Fixed compiler warnings
-
-2008-02-01 01:03  source
-
-	* http.c: * Fixed bug in error message when URI is abnormally long
-
-2008-02-01 01:02  source
-
-	* sqlbif2.c: * Added draft implementation of bif_zorder_index()
-
-2008-02-01 01:01  source
-
-	* sql3.y: * Fixed warnings on duplicate declaration of terminals
-
-2008-01-31 10:18  source
-
-	* sqlcost.c: * Fixed float underflow in cost model by adjusting cardinality
-
-2008-01-30 16:25  source
-
-	* sqlcost.c: * Adjusted inx int cost model calculations
-
-2008-01-29 15:58  source
-
-	* sqlver.h: * Updated copyright to 2008
-
-2008-01-29 15:53  source
-
-	* sqlver.h: * Updated version number of executable
-
-2008-01-29 15:50  source
-
-	* inxop.c, rdfinf.c, sqlexp.c: * Fixed problem with inxop bm bad if extra search params supplied, as in
-	  the case of likes etc other non inx conds. do not count on search par fill
-	  to know the target.
-	* Fixed iri names to iri valued ssl and their entailed
-
-2008-01-28 23:33  source
-
-	* inxop.c, log.c, rdfinf.c, search.c, sqlcmps.h, sqlcomp2.c,
-	  sqlcost.c, sqldf.c, sqlsrv.c: * Fixed cache compile samples
-	* Fixed using like of any to do the is iri test
-	* Fixed no kill of delta rolled back
-
-2008-01-28 23:31  source
-
-	* rdf_core.c: * Fixed iri id cache read integrity
-
-2008-01-28 23:31  source
-
-	* rltrx.c: * Fixed reuse of rb has when not resized
-
-2008-01-28 23:29  source
-
-	* sparql_core.c: * Fixed missing function prototype
-
-2008-01-28 10:47  source
-
-	* rdf_core.h, rdfbox.c, sqlbif.c, sqlbif2.c: * Added box_cast for RDF_BOX source values
-
-2008-01-25 11:56  source
-
-	* blobio.c, rdfbox.c: * Fixed 64 bit range of iri id and ro ids
-
-2008-01-25 11:56  source
-
-	* virtual_dir.sql: * Fixed all sparql defines
-
-2008-01-24 17:15  source
-
-	* sqlwords.h: * Regenerated
-
-2008-01-24 10:28  source
-
-	* blobio.h, rdf_core.c, rdf_core.h, rdfbox.c, sparql.h, sparql.sql,
-	  sparql2sqltext.c, xmltree.c: * Added complete support for xsd:float in SPARQL
-	* Replaced Virtuoso/PL procedures RQ_LONG_OF_O, RDF_BOX_COMPLETE,
-	  RQ_SQLVAL_OF_O, RQ_IID_OF_O, RQ_O_IS_LIT, RDF_SQLVAL_OF_OBJ,
-	  RDF_QNAME_OF_OBJ, RDF_SQLVAL_OF_LONG, RDF_LONG_OF_OBJ with
-	  new BIF
-
-2008-01-22 21:07  source
-
-	* rdf_core.c, sparql.sql, sparql2sql.c, sparql2sqltext.c,
-	  sparql_p.y, sql3.y, sqlwords.gperf: * Added convenient syntax for dtp_t bytes in SQL test: __TAG OF data_type
-	* Added id_to_iri_nosignal
-	* Fixed sparp_flatten_join() for joins with OPTIONAL_L members
-	* Fixed printing breakups on triples with reused tabids
-	* Fixed restriction bits of unary plus and unary minus expressions
-
-2008-01-22 12:41  source
-
-	* rdfinf.c: * Fixed check same_as to use query option
-
-2008-01-22 12:41  source
-
-	* sparql2sqltext.c: * Added valmode optimization for IN operator
-
-2008-01-22 12:40  source
-
-	* sparql2sql.c, sparql2sql.h: * Added sparp_flatten_join()
-	* Improved sparp_flatten_union()
-	* Fixed traverse when out handlers are disabled
-
-2008-01-21 15:16  source
-
-	* sparql.sql: * Removed debug code
-
-2008-01-21 13:25  source
-
-	* sqldf.c, sqloinx.c: * In inx int join, sort the tables lowest card first else it's no gain in
-	  lubm. Also reset dfe_unit after using this for sorting what to try next
-
-2008-01-21 13:24  source
-
-	* rdfinf.c: * Fixed no inf ctr error message
-	* Fixed "same as" is not always on if inf is on, must be enabled separately
-
-2008-01-21 12:17  source
-
-	* rdf_mapping.jso, sparql.h, sparql.sql, sparql2sql.c,
-	  sparql2sql.h, sparql2sqltext.c, sparql_core.c, sparql_l.l,
-	  sparql_p.y, sparql_qm.c, sparul2sql.c: * Added basic SPARQL BI support
-	* Added +> and *> operator in SPARUL BI extensions
-	* Added support for aggregates in ORDER BY expressions
-	* Added improved diagnostics of non-mappable triple patterns using new
-	  spar_dbg_string_of_triple_field() diagnostic output function.
-	* Added optimization for comparison operations when LONG_EQ_SQL
-	* Added SPARQL optimization: result restriction bits for expressions,
-	  SPART_VARR_LONG_EQ_SQL
-	* Added optimization for native SQL values in
-	  DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL
-	* Added smarter creation of IRI classes: A redefinition of a class that
-	  is identical to the previous definition is no longer reported as error
-	  even if the class is in use.
-	* Added stub for REDUCED
-	* Added support for XML entities in _MT parser
-	* Fixed code generation for queries with detected but not fully eliminated
-	  conflicts
-	* Fixed bug in processing of queries without default graph
-	* Fixed composing objects from rdf_boxes in functions that expect SQL values
-	  as arguments
-	* Fixed loading RDF views: better auto-recovery, better audit
-	* Fixed XML replies in protocol; addded XML preamble
-	* Fixed RDF_FT_RULE_ADD ('', '', ...)
-	* Fixed IN operator
-	* Fixed compilation of select * from <http://example.com/tpcd> where
-	  { ?r tpcd:name ?nam . filter (?nam = 'EUROPE') }
-	* Fixed division bug
-	* Updated version of virtdrf-data-formats.ttl
-	* Fixed bugs found while converting Q1 and Q2 of TPC-D into SPARQL on mapped
-	  data
-
-2008-01-21 12:05  source
-
-	* turtle_p.y: * Fixed double free in case of 'undefined namespace prefix' error on
-	  object or object type IRI
-	* Relaxed syntax for '[]' bnode, now can be '[ whitespace ]' where
-	  '[ pred_obj_list ]' is allowed
-
-2008-01-21 11:59  source
-
-	* sqlsrv.c: * Added temporary patch to avoid gpf
-
-2008-01-21 11:58  source
-
-	* rdfinf.c: * Fixed problem with "same as" which was not on by default
-
-2008-01-21 11:54  source
-
-	* http.c: * Fixed bug in proxy with chunked & head
-
-2008-01-21 11:54  source
-
-	* bitmap.c, inxop.c: * In bm inx int: when getting new row, set the iobb. Clear itc_bp's
-	  flags when resetting.  When finding in an array ce, remember the pos in
-	  ce and the ce's offset.
-
-2008-01-18 15:26  source
-
-	* http.h: * Fixed proxy failures
-
-2008-01-18 15:24  source
-
-	* inxop.c, rdfinf.c, sqldf.c, sqlo.h, sqloby.c, sqloinx.c,
-	  sqloprt.c: * In join order, try the one with most connections to placed stuff
-	  first. Recognize leaves, i.e. lookups that depend on placed and on which
-	  no unplaced depends. Place them as a unit, most restrictive first, do
-	  not do all permutations. Fix the disable of inx int and fix placing and
-	  unplacing of inxc int. Fix the missing leave of the page when doing
-	  next bm row on bm inx int. Fix the rdf inf ctx retrieval for inx ints.
-
-2008-01-18 15:22  source
-
-	* xqf.c: * Added support for fraction of seconds in __get_iso_date()
-
-2008-01-18 15:21  source
-
-	* ddlrun.c: * Removed extra call to serialize
-
-2008-01-18 15:20  source
-
-	* xslt.c: * Added bif_rowvector_digit_sort
-
-2008-01-18 15:19  source
-
-	* system.sql: * Added extra CRLF at end of http header
-
-2008-01-18 15:17  source
-
-	* ftp.sql: * Fixed hang with ftp server
-	* Fixed problem with connect in pasv mode
-
-2008-01-18 15:16  source
-
-	* bif_file.c, obackup.c, sqlbif.h, sqlsrv.c: * Fixed restore status check
-	* Fixed wait and exit status of child process
-	* Fixed filedesciptors in child process
-
-2008-01-18 15:14  source
-
-	* xmlsql.c: * Fixed hash length as data is int64
-
-2008-01-18 15:12  source
-
-	* datesupp.c: * Fixed compiler warnings on HP/UX
-
-2008-01-18 15:11  source
-
-	* bif_date.c: * Added cast DT_DATE to long where appropriate
-	* Added cast to boxint, prevent unsigned int cast
-
-2008-01-18 15:10  source
-
-	* http.c: * Fixed proxy failures
-	* Avoid messages when session recording is enabled but nntp, pop3 or ftp
-	  is used
-
-2008-01-18 15:09  source
-
-	* arith.c: * Use QUIETCAST to disable 'non-arithmetic arguments' error message
-
-2008-01-18 15:07  source
-
-	* xmlenc.c, xmlenc.h, xmlenc_algos.c, xmlenc_algos.h: * Added support for SHA256
-
-2007-12-10 15:45  source
-
-	* sparql2sql.c, sparql_core.c: * Fixed calling order
-
-2007-12-10 15:44  source
-
-	* text.h: * When id is 0 the mostsignificant bits for 'num' may becomes a
-	  non-zero. Therefore we set the number as it's a d_id in network order, so
-	  we don't use num at all
-
-2007-12-10 10:02  source
-
-	* sparql2sql.c, sparql2sql.h: * Added check of quad map values for applicability of a given triple
-	  pattern, graph field
-
-2007-12-10 10:01  source
-
-	* sparql_l.l: * Added SOFT_L
-
-2007-12-10 10:00  source
-
-	* sqlbif.c: * Added overflow protection to bif_concat
-
-2007-12-07 13:02  source
-
-	* sparql.sql: * Added more fast garbage collection
-
-2007-12-06 20:58  source
-
-	* sparql.sql: * Accelerated version of DB.DBA.RDF_QM_GC_SUBTREE().
-
-2007-12-06 14:19  source
-
-	* security.c: * Fixed bug removed possibility of updating U_id
-
-2007-12-06 14:18  source
-
-	* bif_pop3.c: * Fixed buffer overflow
-
-2007-12-06 12:05  source
-
-	* sparql.sql: * Changed default behaviour of _MT routines. Now they will log everything
-	  and autocommit.
-	* Added aq thread count as a parameter.
-
-2007-12-05 10:10  source
-
-	* sparql.h, sparql2sql.c, sparql_p.y: * Added improved support for aggregate expressions
-
-2007-12-04 21:07  source
-
-	* gate.c, lock.c: * For bad parent link, spurious detection possible if the page one comes
-	  from split while in the child and before the back link check. Task switch
-	  can do this, not only waiting for the child. So then actually land on
-	  the page and get the parent and checjk the actual link with both wired.
-	  If bad, stop or fix, else no message and containue as is or reset the
-	  seek if not landed. For locks, when there is checkpoint freeze, the
-	  condition could result in rollback instead of freeze if detected just
-	  before deadlock check or right after lock wait ended. So must consider
-	  the freeze case specially.
-
-2007-12-04 18:49  source
-
-	* rdf_core.c: * Allocate iri ids from a range that is selected based on the thread.
-	  Makes distributed inserts when loading rdf and less waiting
-
-2007-12-03 15:52  source
-
-	* bif_pop3.c, ftp.sql: * Fixed pop and ftp protocol to allow large file transfers
-
-2007-12-03 14:30  source
-
-	* http.c: * Fixed http_get to accept string session as argument body
-
-2007-12-03 08:50  source
-
-	* sqlbif2.c: * Fixed missing include
-
-2007-12-03 08:36  source
-
-	* rdf_core.c: * Fixed C compiler problem with variable declaration
-
-2007-11-30 20:54  source
-
-	* obackup.c: * Added check for stored procedure hook DB.DBA.BACKUP_COMPLETED
-	* Removed log messages from normal build
-	* Use function instead of hardcoding task name
-
-2007-11-30 20:37  source
-
-	* sqlver.h: * Updated to 3023
-
-2007-11-30 20:36  source
-
-	* bif_xml.c, rdf_core.c, rdf_core.h, rdfxml_parser.c, sparql.sql,
-	  sqlbif2.c, system.sql, turtle_p.y, xmlenc.c, xmltree.h, xslt.c: * Accelerated RDF loader
-
-2007-11-30 20:34  source
-
-	* url_rewrite.sql: * Fixed TCN rules in ODS
-
-2007-11-29 16:54  source
-
-	* ftp.sql: * Fixed ftp session problems with IIS
-
-2007-11-29 16:02  source
-
-	* sqlver.h: * Updated version to 3022
-
-2007-11-29 16:01  source
-
-	* virtual_dir.sql: * Changed proxy to send headers
-
-2007-11-27 12:16  source
-
-	* sparql.sql: * Added improvements for deadlock handling
-	* Fixed DB.DBA.RDF_GLOBAL_RESET
-
-2007-11-26 11:04  source
-
-	* sparql.sql: * Added bif_gvector_digit_sort()
-	* Fixed free-text index transaction size
-
-2007-11-26 11:03  source
-
-	* xslt.c: * Added bif_gvector_digit_sort()
-
-2007-11-23 22:51  source
-
-	* bif_intl.c, dks_esc.c, multibyte.h, sqlbif2.c, srvmultibyte.c,
-	  srvmultibyte.h: * Added bif_rfc1808_expand_uri()
-
-2007-11-23 22:51  source
-
-	* search.c: * Fixed bug with zero itc_position
-
-2007-11-23 22:51  source
-
-	* meta.c, sqlbif.c, sqlintrp.c, sqlsrv.c: * Prevent GPF with long qualifiers
-
-2007-11-22 23:30  source
-
-	* gate.c, sqlbif2.c: * Added debugging bif_itc_dive_transit_call_ctr() and
-	  bif_itc_try_land_call_ctr().
-
-2007-11-22 23:30  source
-
-	* xmlenc_algos.c: * Added room for 2048 byte keys
-
-2007-11-20 13:15  source
-
-	* virtual_dir.sql: * Fixed POST support
-
-2007-11-19 11:34  source
-
-	* sparql.sql: * Added setting to enable debug of various rdf extractors
-
-2007-11-18 16:07  source
-
-	* sparql.sql: * Added Adaptive size of dictionary of objects for graph keyword in
-	  RDF/XML and TURTLE parsers when free-text is on
-
-2007-11-18 16:05  source
-
-	* sparql.sql: * Added extra parameter for number of worker threads
-
-2007-11-18 16:03  source
-
-	* sqlbif2.c: * Fixed bug in bif_rdf1808_parse_uri
-	* Added rfc1808_parse_wide_uri for wide strings
-
-2007-11-18 16:00  source
-
-	* xslt.c: * Fix to ensure valid dictionary size on wrong argument of bif_dict_new
-
-2007-11-16 11:27  source
-
-	* soap.sql, sparql.sql, sqlbif2.c, system.sql, url_rewrite.sql,
-	  users.sql: * Replaced WS.WS.PARSE_URI with bif rdf1808_parse_uri
-
-2007-11-16 11:26  source
-
-	* sparql.sql: * Added DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL_FT
-	* Fixed RDF_ADD_GRAPH_KEYWORD to workb etter in _MT parser
-
-2007-11-16 11:23  source
-
-	* rdf_core.c: * Fixed __rdf_obj_ft_rule_count_in_graph on 32bit boxes
-
-2007-11-15 15:40  source
-
-	* hosting.c: * Fixed old style plugins which return a string, not a box
-
-2007-11-14 22:17  source
-
-	* sparql2sqltext.c: * Fixes for define output:valmode "LONG" select (isblank(?o)) as ?ot ...
-	  and the like, also fix for langmatches()
-
-2007-11-13 23:01  source
-
-	* sparql.h, sparql_core.c: * Added spar_add_rgc_vars_consts_from retvals() in order to provide better
-	  sponge behaviour for:
-
-	  define input:grab-all "yes" define input:grab-depth 2 define
-	          input:grab-seealso
-	          <http://dbpedia.org/property/hasPhotoCollection> PREFIX foaf:
-	          <http://xmlns.com/foaf/0.1/> describe
-	          <http://dbpedia.org/resource/Paris>
-	          <http://dbpedia.org/resource/New_York>
-
-	  Now it can sponge IRIs from the result set.
-
-2007-11-13 23:00  source
-
-	* sparql2sql.c: * Added optimizations for filters that are ORs or equalities and
-	  IN predicates with same variable
-
-2007-11-12 14:06  source
-
-	* jso.c, rdf_mapping.jso, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql_p.y: * Initial support for option (SOFT EXCLUSIVE)
-	* Initial support for PROVEN_MATCH for ssprintffs of variable and
-	  sprintffs of IRI class
-
-2007-11-10 01:24  source
-
-	* sparql2sql.c: * Added special case for ASK
-
-2007-11-10 01:23  source
-
-	* row.c: * Added check for stack overflow
-
-2007-11-10 01:23  source
-
-	* url_rewrite.sql: * Added TTL support for DET
-
-2007-11-09 01:12  source
-
-	* ltrx.h, sqlfn.h: * Record the thread
-
-2007-11-09 01:12  source
-
-	* sparql2sql.c: * Fix for 'sparql select * where { graph ?g { ?s a ?o }}' on a database
-	  with 94 quad map patterns for rdf:type and default quad map pattern.
-
-2007-11-09 01:10  source
-
-	* sparql.sql: * Removed debug statement
-
-2007-11-08 11:55  source
-
-	* sparql2sqltext.c, sparql_core.c: * Fixed error in loading missing source graphs when RDF_SPONGE_UP returned
-	  varchar but the expression was like
-	  'G in (RDF_SPONGE_UP(...), RDF_SPONGE_UP(...), ...)'
-	* Added calls to iri_to_id
-
-2007-11-08 11:53  source
-
-	* rdfbox.c, sparql.sql: * Fixed reloading of RDF free-text indexing rules at server restart
-	* Fixed free-text index support in SPARUL
-
-2007-11-08 11:52  source
-
-	* url_rewrite.sql: * Fixed bad aref
-
-2007-11-08 11:51  source
-
-	* sqlintrp.c: * Added box_err_print_box, so callstack dump is improved for RDF boxes
-
-2007-11-05 13:21  source
-
-	* sparql.h, sparql2sql.c, sparql2sql.h, sparql2sqltext.c: * Fix for grouping variables in LONG valmode
-	* Fix for SPARQL aggregates in LONG valmode
-	* Fixed traversal functions to use stack of structures instead of
-	  stack of void pointers
-
-2007-11-05 13:19  source
-
-	* url_rewrite.sql: * Added new url rewrite rules
-	* Use DET to return the ODS data
-
-2007-11-05 13:19  source
-
-	* rdfbox.c: * Added bif_rdf_box_needs_digest
-
-2007-11-05 13:18  source
-
-	* aqueue.c, gate.c: * Fixed debug messages
-
-2007-10-31 22:14  source
-
-	* system.sql, url_rewrite.sql: * Added transparent content negotiation
-
-2007-10-31 22:13  source
-
-	* sqlbif.c: * Fixed recursive UPDATE bug
-
-2007-10-31 13:30  source
-
-	* sqlver.h: * Updated version
-
-2007-10-31 13:30  source
-
-	* sqlstmts.c: * Fixed bug updating sequences
-
-2007-10-31 13:29  source
-
-	* bif_explain.c, search.c, sqlbif.c, sqlcmps.h, sqlfn.h, sqlgen.c,
-	  sqlnode.h, sqlrun.c, sqlstmts.c, update.c, wifn.h: * Fixed recursive UPDATE bug
-
-2007-10-31 13:26  source
-
-	* sqlpfn.c: * Increased stack margin as it needs to call yy error
-
-2007-10-31 13:25  source
-
-	* sparql.sql: * Added better error limit message
-
-2007-10-25 13:46  source
-
-	* xmlenc.c: * Fixed xenv_sha1_digest to use exact buffer length
-	* Fixed MTX unlock
-
-2007-10-24 09:43  source
-
-	* xmlenc.c: * Use the exact BN lenghth
-	* Added error reporting
-
-2007-10-23 15:14  source
-
-	* CLIuti.c: * Patches for 64 bit Ole DB provider
-
-2007-10-22 15:37  source
-
-	* bif_file.c, widisk.h: * Added new parameter CreateMask for file/directory permissions umask
-	* Fixed default file/directory permissions
-
-2007-10-18 11:37  source
-
-	* virtual_dir.sql: * Fixed registering HTTPS endpoints
-
-2007-10-18 11:35  source
-
-	* hosting.sql: * Fixed hosting on HTTPS endpoint
-
-2007-10-18 11:35  source
-
-	* http.c: * Fixed typo
-
-2007-10-17 21:54  source
-
-	* CLIodbc3.c: * Virtuoso does not support unsigned types
-
-2007-10-16 23:55  source
-
-	* sqlver.h: * Updated version
-
-2007-10-16 23:55  source
-
-	* CLIodbc3.c: * Virtuoso does not support unsigned types
-
-2007-10-16 23:51  source
-
-	* sqldf.c: * The IN list left side is constant so don't merge
-	* Moved IN after test if IN col is no-key part
-
-2007-10-16 23:50  source
-
-	* bitmap.c, search.c: * When delete on bitmap index and new row is obtained, position on the
-	  right place, start or end depending of the order
-
-2007-10-16 23:49  source
-
-	* sqlpfn.c: * Added extra stack overflow checks
-
-2007-10-16 23:48  source
-
-	* information_schema.sql: * Fixed incorrect grant
-
-2007-10-16 23:48  source
-
-	* sqlcr.c: * Encapsulate TOP in a DT so scrollable cursor will become static
-
-2007-10-16 23:47  source
-
-	* widisk.h: * Fixewd permission of database files on Windows
-
-2007-10-15 14:24  source
-
-	* bif_soap.c: * Create fake procname on bad request and no method found
-
-2007-10-11 10:31  source
-
-	* hosting.sql, http.c: * Added separate http_request_header_full bif for hosting code
-
-2007-10-11 10:30  source
-
-	* sparql2sqltext.c: * Fixed buffer overflow
-
-2007-10-09 16:06  source
-
-	* hosting.c, hosting.h, hosting.sql, http.c, sqlver.h: * Added new hosting plugin for PHP
-
-2007-10-09 16:06  source
-
-	* sparql.h, sparql2sql.c, sparql_core.c: * Added support for DESCRIBE <constant> in grabber
-
-2007-10-09 16:05  source
-
-	* sparql.sql: * Added conversion of all langtags to lowercase
-
-2007-10-09 16:04  source
-
-	* soap.sql, xmlrpc_soap.xsl: * Fixed proper element names from member name
-
-2007-10-04 12:00  source
-
-	* sparql.sql, sparql2sqltext.c, sparql_core.c: * Fixed free-text index for multiple possible graphs
-	* Make string wide so http_value can convert it to UTF-8
-	* Fixed graph clear to remove the sponger record
-
-2007-10-04 11:59  source
-
-	* system.sql: * Added escape for \ in dump function
-
-2007-10-04 11:56  source
-
-	* http.c: * Added noinherit option to http_map_get dav
-
-2007-10-04 11:56  source
-
-	* url_rewrite.sql: * Added noinherit option to http_map_get dav
-	* Added check on regular expression prior to executing it, or "*/*" will
-	  break the matching process
-
-2007-10-04 11:54  source
-
-	* users.sql: * Remove user if sql login disabled
-
-2007-10-04 11:54  source
-
-	* search.c: * Removed check for lock if it is a leaf pointer
-
-2007-10-04 11:53  source
-
-	* sqldf.c: * Added check for stack overflow
-
-2007-10-04 11:53  source
-
-	* ksrvext.h: * Fixed return type of function prototype
-
-2007-10-04 11:52  source
-
-	* CLIsql3.c: * Fixed problem with SQLConnect returing SQL_SUCCESS_WITH_INFO
-
-2007-09-26 15:16  source
-
-	* sqlgen.c: * Fixed internal compiler error with IN predicate
-
-2007-09-25 16:07  source
-
-	* repldb.c: * Fixed problem with unusually long transactions (> max string limit)
-
-2007-09-24 14:07  source
-
-	* sparql.sql: * Fixed DESCRIBE on unspecified graphs
-
-2007-09-21 21:55  source
-
-	* sparql.sql: * Enclose xml literals in CDATA
-
-2007-09-21 21:54  source
-
-	* search.c: * If bm_landed_lock returns something to wait, we need to release the
-	  buffer as it's marked for writing and sequential operation on it
-	  would block even on same thread
-
-2007-09-21 15:19  source
-
-	* sparql.sql: * Additional patch for DATATYPE
-
-2007-09-21 15:19  source
-
-	* aqueue.c, neodisk.c, sqlfn.h: * Added check to prevent running async queues in atomic sections
-
-2007-09-21 14:31  source
-
-	* sparql2sqltext.c: * Fixed DATATYPE () of everything
-
-2007-09-20 21:05  source
-
-	* sparql.sql, sparql2sqltext.c, xqf.c: * Added better support for xsd:string() and sxd:boolean()
-
-2007-09-20 21:04  source
-
-	* wi.h: * Added more debug code
-
-2007-09-20 17:44  source
-
-	* Makefile.am: * Fixed make dist
-
-2007-09-20 01:21  source
-
-	* sparql_p.y: * Updated sparql syntax to allow () which means an empty list
-
-2007-09-20 01:21  source
-
-	* sparql_core.c: * Added input:grab_follow_predicate
-
-2007-09-20 01:20  source
-
-	* sparql2sqltext.c, xmltree.c: * Changed processing of DV_STRING in __xsd_type() BIF
-
-2007-09-20 01:20  source
-
-	* sparql2sql.c: * Added support and optimization for SAMETERM
-	* Added new spar_var_eq_to_equiv function
-
-2007-09-20 01:18  source
-
-	* sparql.sql: * Fixed remote execution, esp in datatype support and handling of empty
-	  local IRIs
-	* Fixed missing grant
-
-2007-09-19 00:00  source
-
-	* sparql.sql: * Fixed wrong stored procedure name
-	* Fixed soap call missing parameters
-
-2007-09-18 23:59  source
-
-	* gate.c, wi.h, wifn.h: * Added extra page access debugging code
-
-2007-09-18 13:06  source
-
-	* sparql.sql: * Added LONG VARCHAR support
-
-2007-09-18 13:06  source
-
-	* rdfbox.c: * Added error for LOB arguments to bif_rdf_box
-
-2007-09-17 21:58  source
-
-	* sparql.sql: * Fixed sparql endpoint interop
-
-2007-09-17 16:31  source
-
-	* sqlwords.h: * Regenerated
-
-2007-09-17 13:50  source
-
-	* ddlrun.c, lock.c: * Removed unused code section
-
-2007-09-17 12:22  source
-
-	* aqueue.c, rdf_core.c, rdf_core.h, rdfxml_parser.c, sparql.sql,
-	  sparql2sqltext.c, sqlbif.h, xslt.c: * Added SPARQL free-text support with graph keywords
-
-2007-09-17 12:20  source
-
-	* bif_explain.c, bif_phrasematch.c: * Added sqlc_compile_static for better checking leaks with MEM_DEBUG
-
-2007-09-17 12:19  source
-
-	* rdfbox.c: * Fix to support XML trees as values of RDF boxes
-	* Fix for case when bif_rdf_box gets NULL as value
-
-2007-09-17 12:10  source
-
-	* bif_soap.c, bif_xml.c, ddlrun.c, eqlcomp.c, eqlcomp.h, http.c,
-	  meta.c, rdfinf.c, security.c, sqlbif.c, sqlcomp2.c, sqlcr.c,
-	  sqlgen.c, sqlnode.h, sqlofn.h, sqlsrv.c, xmlschema.c, xmlsql.c,
-	  xpath.c: * Added sqlc_compile_static for better checking leaks with MEM_DEBUG
-
-2007-09-17 12:03  source
-
-	* system.sql, url_rewrite.sql, virtual_dir.sql: * Added dump SQL defs of VD and rewrite rules
-
-2007-09-17 12:02  source
-
-	* CLIsql1.c: * Fixed gpf when application does free connect without disconnect
-
-2007-09-17 12:01  source
-
-	* bif_xml.c, xml.h, xmlnode.h, xmlschema.c, xpath.c, xpath.h,
-	  xpathp.y: * Wrapped __doc XPATH option and references to VXML_DOCUMENT table into
-	  OLD_VXML_TABLES
-
-2007-09-13 15:41  source
-
-	* sqlintrp.c: * Removed debugging code
-
-2007-09-13 15:38  source
-
-	* CLIsql1.c: * Fixed memory leak on error
-
-2007-09-13 00:32  source
-
-	* sparql.sql: * Fixed bug in SPARUL_CLEAR
-
-2007-09-12 15:41  source
-
-	* .cvsignore, Makefile.am, bif_json.c, json.y: * Added JSON parser
-
-2007-09-12 14:39  source
-
-	* sparql2sqltext.c, sparql_core.c, sparql_p.y: * Added support for sameTerm ()
-
-2007-09-12 14:38  source
-
-	* xpathp.y: * Fixed typo in syntax
-
-2007-09-12 14:13  source
-
-	* sparql_l.l, sparql_p.y: * Fixed syntax only to reflext recent spec changes
-	* Added support for "OFFSET x LIMIT y'
-
-2007-09-12 14:11  source
-
-	* xpathp.y: * Added syntax extention to allow parsing parameters in the middle of
-	  free-text query string (for automatic edits of user query when a graph
-	  condition is added)
-
-2007-09-12 14:10  source
-
-	* turtle_l.l: * Added support for UTF-8 in TURTLE
-	* Fixed usage of ttl_lex_mtx
-
-2007-09-12 14:09  source
-
-	* rdf_core.c, rdf_core.h: * Fixed usage of ttl_lex_mtx
-
-2007-09-12 14:08  source
-
-	* xmlenc.c, xmlenc.h, xmlenc_algos.c, xmlenc_algos.h: * Added Diffie_-Hellman key exchange bif functions using OpenSSL lib
-	* Added support for DH-SH1 session mode in OpenID server
-
-2007-09-11 12:10  source
-
-	* sqlver.h: * Updated engine version number
-
-2007-09-11 12:10  source
-
-	* sparql.sql: * Fixed sparql-results-xml parsing
-	* Fixed sprintf error in RDF view code generation
-
-2007-09-11 12:07  source
-
-	* sort.c: * Fixed error diagnostics for bad limit/offset
-
-2007-09-11 12:06  source
-
-	* sparql2sql.c: * Fixed DESCRIBE .... from <.../dataspace/username>
-
-2007-09-11 12:06  source
-
-	* sparql.h: * Increased depth of parse tree
-
-2007-09-11 12:03  source
-
-	* sqlcost.c, sqldf.c: * Fixed read uninitialized data in sql compiler
-
-2007-09-11 12:00  source
-
-	* bif_xml.c, multibyte.c, multibyte.h, srvmultibyte.c,
-	  srvmultibyte.h: * Added MALLOC_DEBUG improvements debugging conversion of string to UTF8
-
-2007-09-11 11:58  source
-
-	* http.c: * Fixed bug in new dav rdf sync folders
-
-2007-09-11 02:41  source
-
-	* json.l, json.y, sqlbif.c: * Added tiny JSON parser
-
-2007-09-11 02:38  source
-
-	* sqlbif.c: * Fixed deadlock on checkpoint by adding IO_SECT blocs
-	* Small re-indentation
-
-2007-09-11 02:28  source
-
-	* xpath.c: * Fix to eliminate an error report in debugging section
-
-2007-09-11 02:27  source
-
-	* auxfiles.c, wifn.h: * Added cl_run_local_only
-
-2007-09-11 02:25  source
-
-	* 2pc.c: * Added missing include
-
-2007-08-24 14:31  source
-
-	* CLIuti.c: * Fixed building ODBC driver
-
-2007-08-24 14:29  source
-
-	* Makefile.am: * Added missing object
-
-2007-08-24 12:34  source
-
-	* sparql.sql: * Fixed code generation issue when one rdf view refers to another and empty
-	  rdf view
-
-2007-08-24 12:25  source
-
-	* aqueue.c: * Fixed memory leak
-
-2007-08-24 12:25  source
-
-	* sqlbif.c: * Added __max_notnull and __min_notnull functions
-
-2007-08-23 11:23  source
-
-	* dks_esc.c, http.c, sparql.sql, url_rewrite.sql: * Fixed encoding of braces and space with percent in URL
-	* Fixed URL rewriting for PHP hosting
-
-2007-08-23 11:20  source
-
-	* http.c: * Fixed missing IO section around proxy function
-
-2007-08-13 10:24  source
-
-	* disk.c: * Removed debugging loop from normal build
-
-2007-08-13 10:22  source
-
-	* bif_intl.c: * Fixed typo
-
-2007-08-10 14:29  source
-
-	* remote.h, sqlfn.h: * Fixed compiler warning
-
-2007-08-06 10:50  source
-
-	* rdf_mapping.jso, sparql.sql, sparql2sqltext.c: * Fix for isblank() and isiri() in resultset lists.
-
-2007-08-03 14:21  source
-
-	* dks_esc.c, http.h, jso.c, sparql.sql, sparql2sqltext.c: * Fixed problem with HTML output of web service endpoint and XML item
-	  item in the output
-	* Fixed small memory leak
-
-2007-08-03 14:19  source
-
-	* hash.c: * When dv_int64 is asked but data is dv_long_int there is nothing to
-	  convert; the box is int64 already
-
-2007-08-03 14:18  source
-
-	* http.c: * Added host name to error message
-
-2007-08-03 14:14  source
-
-	* disk.c, shuric.c, shuric.h, sparql2sql.c, sqlsrv.c, wi.h: * Additional code for malloc_debug testing
-
-2007-07-26 15:49  source
-
-	* Makefile.am, rdf_net.sql, sparul2sql.c: * Added new files
-
-2007-07-26 14:32  source
-
-	* sqlver.h: * Updated version and storage version to 3016
-
-2007-07-26 14:31  source
-
-	* sparql.sql, sparql2sql.c, sparql2sqltext.c: * Added hooking of URN etc. non-HTTP IRI schemas
-	* Added error diagnostics for 'col index for ^{column-N}^ exceedes number
-	  of columns' and the like.
-	* Added check that number of columns in quad map value is equal to number
-	  of arguments of its IRI class
-	* Small bugfixes
-
-2007-07-26 14:28  source
-
-	* sqlparext.h: * Added missing define
-
-2007-07-26 14:27  source
-
-	* xslt.c: * Various small fixes
-
-2007-07-26 14:25  source
-
-	* xpath.c, xpath.h, xslt.c: * Fixed 64bit issues
-
-2007-07-26 14:23  source
-
-	* text.c: * Fixed 64bit issues
-	* Removed old code
-
-2007-07-26 14:22  source
-
-	* sqlpfn.h: * Fixed compiler warning
-
-2007-07-26 14:21  source
-
-	* sparql.sql, virtual_dir.sql: * Fixed to use get:login options for fb
-
-2007-07-26 14:20  source
-
-	* sqldf.c, sqlgen.c, sqlo.h: * Fixed handling of intersects
-	* Fixed small cost based optimizer issues
-
-2007-07-26 14:16  source
-
-	* sql3.y: * Fixed multiple memory leaks
-
-2007-07-26 14:13  source
-
-	* sqlbif.c: * Fixed compiler warning
-
-2007-07-26 14:13  source
-
-	* sqlbif.c: * Updated log_enable ()
-
-2007-07-26 14:06  source
-
-	* sql3.y, sqlbif.c, sqlbif.h: * Added new functions for 64bit iri_id and bnodes
-	* Removed some functions from sql3.y as they belong in sqlbif.c
-
-2007-07-26 14:02  source
-
-	* sqlbif.c: * Fixed DVB_INT64 info
-
-2007-07-26 13:57  source
-
-	* rltrx.c: * Removed DEBUG check
-
-2007-07-26 13:56  source
-
-	* rdf_core.c, sparql_core.c: * Fixed multiple memory leaks
-
-2007-07-26 13:51  source
-
-	* ddlrun.c: * Fixed getting schema information until after we have have aquired the
-	  recompile mutex, as another thread may have changed the schema while
-	  we where waiting
-
-2007-07-26 13:48  source
-
-	* blob.c: * Fixed handling of blobs in 64bit more
-
-2007-07-26 13:31  source
-
-	* blob.c, blobio.c: * Fixed compiler warnings
-
-2007-07-18 21:49  source
-
-	* srvcr.c: * Fixed error diagnosics for 'key too long' error
-
-2007-07-18 16:05  source
-
-	* sqlcost.c: * Major rewrite of cost based optimizer code
-
-2007-07-18 16:04  source
-
-	* turtle_p.y: * Fixed 64bit compiler warnings
-
-2007-07-18 16:03  source
-
-	* jso.c, rdf_core.c, rdf_mapping.jso, rdfinf.c, rdfinf.h,
-	  rdfxml_parser.c, sparql.h, sparql.sql, sparql2sql.c,
-	  sparql2sql.h, sparql2sqltext.c, sparql_core.c, sparql_l.l,
-	  sparql_p.y, xqf.c: * Added support for 64bit IRI ID
-	* Added sameAS and subproperties
-	* Added support for SQL functions and aliases in sparp_tree_full_copy
-	* Added bif_sparql_sql_cols_of_quad for dereferencing IRIs
-	* Added code for rdf:value attribute (both 'legal' and 'recovery' versions)
-	* Added qmfDerefFlags
-	* Added SPARUL optimization
-	* Added support for BASE
-	* Added 'define uinput:same-as' syntax
-	* Added 'sparql define sql:signal-void-variables 1/0'
-	* Check if number of columns in quad map value is equal to number of
-	  arguments of its IRI class
-	* Fix for GPF at SPARQL DESCRIBE `xyz`
-	* Fix for running RDF metadata manipulation from non-dba account with
-	  all privileges
-	* Fix for audit of very big set of RDF views
-	* Fixed bug in IID to IRI translations
-	* Fixed sparql SELECT DISTINCT
-	* Fix bug in RDF_DIST_SER_LONG when serializing rdf box
-	* Fix bug in parsing bad UTF-8 in literal
-	* Fix parsing xml:base first (actuallyu xml:*)
-	* Fix composing BREAKUP code for any QUAD map with bijection formats
-	* Fix for JSO_DUMP_ALL
-	* Fix SYS_HTTP_SPONGE_UP; divide into smaller transactions
-	* Fixed JSON serialization of bnodes
-	* Fix for code generation of OPTIONAL that is proven to be totally empty
-	* Fix bug in bif_iri_to_id
-	* Fix for parsing nodeID://nn in 32bit version
-	* Fix codegen for string (and similar literals) in LONG valmode
-	* Fix garbage collection
-
-2007-07-18 15:42  source
-
-	* bitmap.c, inxop.c: * Fixed key comp
-
-2007-07-18 15:39  source
-
-	* virtual_dir.sql: * Fixed url rewrite
-
-2007-07-18 15:38  source
-
-	* xslt_opt.c: * Added check for additional urls
-
-2007-07-18 15:37  source
-
-	* xslt.c: * Fixed GPF on 64bit platforms when stack margin is not sufficient for
-	  sql_new_error call
-
-2007-07-18 15:34  source
-
-	* xmltree.c, xmltree.h: * Added support for rdf:value
-
-2007-07-18 15:33  source
-
-	* sqlbif.c: * Fixed initialization of icc_locks_mutex before any bifs are called
-
-2007-07-18 15:30  source
-
-	* rdf_core.c, sqlbif.c, srvstat.c, wifn.h, xslt.c: * Fixed 64bit compiler warnings
-
-2007-07-18 15:20  source
-
-	* Makefile.am, bif_audio.c, bif_audio_tags.h, sqlbif.c: * Added support for reading audio tags
-
-2007-07-18 15:16  source
-
-	* sqlwords.gperf: * Added support for sameAs
-
-2007-07-18 15:15  source
-
-	* sqlcomp.c, sqlo.c, sqlstmts.c, sqlview.c: * Improved diagnostics of permissions
-
-2007-07-18 15:10  source
-
-	* search.c: * Fixed typo causing wrong length to be returned
-
-2007-07-18 15:08  source
-
-	* pldebug.c: * Fixed GPF
-
-2007-07-18 15:08  source
-
-	* lock.c: * Fixed deadlock trying to kill RDS connections when server is not idle
-
-2007-07-18 15:06  source
-
-	* http.c, http.h: * Fixed URL rewriting
-	* Fixed 64bit compiler warnings
-
-2007-07-18 15:05  source
-
-	* hosting.c: * Fixed compiler warning
-
-2007-07-18 15:04  source
-
-	* hash.c: * Added GPF to deprecated function
-
-2007-07-18 15:02  source
-
-	* bif_xml.c: * Fixed bug using wrong client structure during bootstrap
-
-2007-07-18 15:00  source
-
-	* bif_soap.c: * Fixed io locking
-
-2007-07-18 14:38  source
-
-	* bif_explain.c: * Added sameAs and subproperties
-	* Fixed 64bit compiler warnings
-
-2007-07-18 14:35  source
-
-	* CLIsql2.c, auxfiles.c: * Fixed compiler warnings
-
-2007-07-18 14:25  source
-
-	* url_rewrite.sql: * Added macro for calling function for the header
-	* Fixed root handling
-	* Fixed  http response codes and headers
-	* Enhanced rewrite logic
-	* Fixed parsing path string
-	* Fixed URL params
-	* Fixed bug in content negotiation rules
-
-2007-07-09 13:39  source
-
-	* CLIuti.c, arith.c, bif_phrasematch.c, bif_soap.c, bif_text.c,
-	  bif_xml.c, bitmap.c, bitmap.h, ddlrun.c, disk.c, eqlcomp.c,
-	  eqlcomp.h, hash.c, log.c, log.h, meta.c, numeric.c, numeric.h,
-	  rdf_core.c, rdfbox.c, regist.c, replsub.c, row.c, scn3.l,
-	  search.c, search_in.c, sql3.y, sqlbif.h, sqlexp.c, sqlfn.h,
-	  sqlgen.c, sqlhash.c, sqlintrp.c, sqloprt.c, sqlrun.c, sqlsrv.c,
-	  sqltype.c, sqlwords.gperf, srvcr.c, srvstat.c, system.sql,
-	  text.c, text.h, wi.h, widisk.h, widv.h, xmlsql.c, xmltree.c,
-	  xpf.c: * Added support for 64bit BIGINT type
-	* Added support for 64bit IRI_ID type
-
-2007-05-31 12:10  source
-
-	* sqldf.c: * Fixed rdf inf cost calculation
-
-2007-05-30 22:26  source
-
-	* sqldf.c: * Reverted previous patch
-
-2007-05-30 14:40  source
-
-	* sqldf.c: * Removed hash for RDF quad for now
-
-2007-05-29 14:27  source
-
-	* sqlver.h: * Updated version of database
-
-2007-05-29 14:27  source
-
-	* CLIsql2.c: * Cast int as ptrlong when passing trailing args of future
-
-2007-05-29 14:27  source
-
-	* bif_explain.c, gate.c, ltrx.h, rdfinf.c, rdfinf.h, search.c,
-	  sort.c, sqlcost.c, sqldf.c, sqlfn.h, sqlgen.c, sqlo.h, srvstat.c,
-	  system.sql, wi.h, wifn.h: * Fixed cost model
-	* Fixed cost calc for RD inf nodes
-	* Fixed cost calc for nodes in OJ tables
-	* Added larger sample in query cost model sampling and table initial stats
-	* Added api key_estimate for index sample
-
-2007-05-29 14:23  source
-
-	* aqueue.c, http.c, lock.c, sqlbif.c, sqlfn.h, sqlnode.h, sqlrun.c,
-	  sqltrig.c, update.c: * Added row autocommit mode
-
-2007-05-29 13:29  source
-
-	* rdf_mapping.jso, sparql.h, sparql.sql, sparql2sql.c,
-	  sparql2sql.h, sparql2sqltext.c, sparql_core.c, sparql_p.y,
-	  sparql_qm.c: * Added BREAKUP in sql code
-	* Added Breakup with joins of triples
-	* Added explicit 'define sql:table-option "LOOP, index RDF_QUAD" to
-	  all queries inside DB.DBA.SPARQL_RELOAD_QM_GRAPH
-	* Fixed CONSTRUCT...LIMIT...
-	* Fixed sparql define output:format "TTL"
-	* Fixed build on AIX
-	* Fixed proper detection of columns as nullable if COL_NULLABLE is null
-
-2007-05-23 12:13  source
-
-	* bif_file.c, sparql.h, sparql.sql, sparql_core.c: * Added source serial number to SPART structures for tripes
-	* Fixed for tridgell32 to improve performance of DB.DBA.RDF_MAKE_RO_DIGEST
-
-2007-05-22 16:42  source
-
-	* sparql.h, sparql.sql, sparql2sql.c, sparql2sql.h, sparql_core.c,
-	  sparql_l.l, sparql_p.y, xmltree.c, xmltree.h: * Added new INI parameter names for sparql
-	* Added support for QUAD MAP <...> { ... } group pattern
-
-2007-05-17 17:33  source
-
-	* sqlver.h: * Updated version to 3013
-
-2007-05-17 17:33  source
-
-	* sqlcost.c, sqldf.c: * Do not pass ref of the a1 as it is a ref anyway
-
-2007-05-17 17:32  source
-
-	* CLIuti.c: * Removed unneeded datastructure
-
-2007-05-14 11:19  source
-
-	* sparql.h, sparql.sql, sparql2sql.c, sparql_core.c: * Fixes and extentions for bio2rdf
-
-2007-05-14 11:18  source
-
-	* url_rewrite.sql: * Commented out debugging lines
-
-2007-05-11 15:45  source
-
-	* url_rewrite.sql: * Fixed debugging mode
-
-2007-05-10 09:34  source
-
-	* rdf_mapping.jso, sparql.sql, sparql2sqltext.c: * Added "ShortOfNiceSqlvalTmpl" optimization
-
-2007-05-10 09:34  source
-
-	* virtual_dir.sql: * Added parameter for output format
-
-2007-05-09 10:54  source
-
-	* sparql.sql, sqldf.c, sqlver.h: * Disabled IN pred optimization temp
-
-2007-05-08 19:57  source
-
-	* sqldf.c: * Return NULL for fake columns
-
-2007-05-07 16:26  source
-
-	* hash.c: * Fixed GPF in hash space fill when DV_NULL in ANY column
-
-2007-05-04 15:50  source
-
-	* blobio.h, jso.c, jso.h, jso_reformat.awk, rdfbox.c, sparql.h,
-	  sparql.sql, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_p.y, sqlgen.c, sqlsrv.c, sqlver.h,
-	  xmltree.c, xpath.c, xslt_opt.c: * Added bif:xcontains SPARQL magic predicate
-	* Added code generation for IN.
-	* Added support for array of integers built-in type (e.g. for private data)
-	* Added declaration of struct qm_atable_use_s (for breakup)
-	* Added error masquerading for virtuoso/PL backward-compatibility versions
-	  of XSD constructor functions.  These functions now return NULL instead
-	  of signalling a parse/cast error.
-	* Added code generation for an additional flag to xqf_str_parse(),
-	  to return NULL instead of signalling a parse error.
-	* Added support for REAL and SHORTINT columns in mapping.
-	* Added DB.DBA.RDF_GRAPH_TO_TTL()
-	* Added flag for the mapper to enable/disable
-	* Return sparql ini parameters via /sparql endpoint
-	* Fixes for Musicbrainz:
-	  1. Improved DEBUG diagnostics for invalid fixed IRIs in restrictions.
-	  2. Improved metadata generation for IRI classes with non-bijection
-	     functions.
-	  3. Improved code generation for 'field=const' restrictions in
-	     fields with non-bijection formats.
-	  4. Improved generation of restrictions on graph variable if sponge
-	     is in use.
-	* Fixed max returns NULL if 1-st arg is null, therefore pas only integers
-	  to be sure it will find ':' for example
-	* Fixed bad aref message
-	* Fixed code generation for FILTER (?var = <iri>)
-	* Fix for compilation of ORDER BY with grab: there was missing case in
-	  sparp_tree_full_copy ().
-	* Fix for pronting templates with loop in the middle when the number
-	  of columns is zero and the loop is not the last phrase in the template.
-	* Cleanup for private fields in jso_delete(), not used ATM but may be
-	  used for BREAKUP.
-	* Functions that will be used in BREAKUP processing but not yet in use.
-	* Fixes ctr instead of arg_ctr in __xqf_str_parse codegen
-	* Fixed bad var name in DATATYPE_OF_LONG.
-	* Improved compilation of Fred's Q15 from long list: match of quad map
-	  patterns and triple patterns can use sprintff restriction for constant
-	  fields of triples.
-	* Fixes for file & https urls
-	*  Added http OWL added to be extracted by rdf mappers
-	* Fixed bug in sparp_full_clone_int for built-in functions, including
-	  'IN' operator.
-	* Fixed and enabled sparp_gp_trav_reuse_tabids
-	* Fix for caching of free-text indexing rules in memory at startup.
-	* Fix for DATATYPE() and LANGUAGE() builtins in SPARQL
-	  (additional default param)
-	* Changes in the syntax annotations.
-	* Fixed bad number of params
-
-2007-05-04 15:47  source
-
-	* disk.c: * Added extra check
-
-2007-05-04 15:46  source
-
-	* virtual_dir.sql: * Added new function to reload vd map
-
-2007-05-04 15:46  source
-
-	* insert.c, wifn.h: * Added dump into a file
-	* Added more logging
-
-2007-05-04 15:45  source
-
-	* sqlbif.c: * Added BIF __trx_disk_log_length().
-	* Prevent cpt to hang on this thread if it waiting
-
-2007-05-04 15:43  source
-
-	* xqf.c: * Added additional flag to xqf_str_parse(), to return NULL instead of
-	  signalling a parse error.
-
-2007-05-04 15:42  source
-
-	* aqueue.c, aqueue.h: * Fixed gpf when thread leave the client
-
-2007-05-04 15:42  source
-
-	* sort.c, sqlcost.c, sqldf.c, sqlfn.h, sqlnode.h, sqlo.h, sqloby.c: * Fixed predicate with exp list to use index when possible
-	* Fixed cost model to fit.
-	* If many in exp list preds on same inx, will be good for one
-	* Safety checks in binary search that prevent GPF if the sorting criterion
-	  is not transitive.
-
-2007-05-04 15:40  source
-
-	* http.c: * Fixed optimize problem with readed variable
-
-2007-04-06 19:02  source
-
-	* xmlsql.c: * Added check argument type
-
-2007-04-06 12:45  source
-
-	* sparql.sql: * Added support for DB.DBA.RDF_OBJ_FT_RECOVER
-
-2007-04-06 12:45  source
-
-	* gate.c: * If root page is dead then GPF and say to recover, not wait
-
-2007-04-06 12:21  source
-
-	* sparql2sql.c, sparql_core.c: * Fix for creating redundant graph variable in a query with special predicate
-
-2007-04-05 19:26  source
-
-	* bif_file.c, rdfbox.c, scn3.l, sparql.sql, sqlbif.c, srvstat.c,
-	  xmltree.c, xmltree.h, xqf.c: * Added RecoveryMode parameter in [SPARQL] section of virtuoso.ini
-	* Added support for XML tree entities as RDF literals
-	* Fixed overkill parsing of small xsd:integer values as DV_NUMBER
-	* Added xtree_sum64 checksum
-	* Fixed number of conversions in __xml_deserialize_packed
-	* Fixed cosmetics (DV_LONG_STRING is now equal to DV_SHORT_STRING)
-	* Fixed tridgell32 function
-	* Fixed line numbers in error messages
-
-2007-04-05 11:03  source
-
-	* virtual_dir.sql: * Added expiration headers
-
-2007-04-04 14:13  source
-
-	* sparql_l.l, sparql_p.y: * Fixed syntax of "sparql drop quad map graph <xxx>"
-
-2007-04-04 11:21  source
-
-	* insert.c: * Removed debug code
-
-2007-04-04 09:16  source
-
-	* sparql.sql: * Added support for multiple default graphs in web service endpoint
-	* Check the expiration of pages coming from rdf mappers
-	* Fixed GRDDL attrs in RDF using rdf mappers
-
-2007-04-04 09:13  source
-
-	* hash.c: * Added check for over long key parts in ORDER BY temp
-
-2007-04-03 11:56  source
-
-	* xmltree.c: * Added support for xsd:float in BIF __xsd_type()
-
-2007-04-03 11:55  source
-
-	* sparql.sql: * Added support for application/turtle and application/x-turtle
-	* Added better selection of returned Content-Type by requested Accept
-	* Fixed data truncation in JSON
-	* Minor bugfixes in the audit
-
-2007-04-02 12:18  source
-
-	* sqlrun.c: * Fixed reused placeholder itc_bp when unq match of bm inx
-
-2007-04-02 12:15  source
-
-	* sparql_p.y: * Fixed non-terminal w/o return
-
-2007-04-02 12:15  source
-
-	* disk.c: * Added db version in log file
-
-2007-04-02 09:28  source
-
-	* sparql.h, sparql.sql, sparql2sqltext.c, sparql_core.c,
-	  sparql_l.l, sparql_p.y: * Added support for SPASQL
-	* Fixed RDFs unknown
-
-2007-04-02 09:26  source
-
-	* rdfbox.c: * Added dtp_register_hash support
-
-2007-03-30 23:48  source
-
-	* Makefile.am: * Removed file
-
-2007-03-30 16:11  source
-
-	* Makefile.am: * More files to distribute
-
-2007-03-30 15:49  source
-
-	* sqlver.h: * Updated version of DB engine to prevent opening a new database with an
-	  old server
-
-2007-03-30 15:48  source
-
-	* sparql.sql: * Added WS handler for .rq (sparql query) files
-
-2007-03-30 15:30  source
-
-	* Makefile.am: * Fixed typo in distibution list
-
-2007-03-30 15:29  source
-
-	* sqlbif.c: * Added more tables to system table list
-
-2007-03-30 14:52  source
-
-	* Makefile.am: * Added missing files to distribution
-
-2007-03-29 12:30  source
-
-	* sparql.sql: * Fix for RDF FT upgrade bug
-
-2007-03-29 10:55  source
-
-	* sparql.h, sparql2sql.c, sparql2sqltext.c, sparql_core.c,
-	  sparql_l.l, sparql_p.y: * Added aggregate functions
-	* Added auto-grouping
-	* Added SELECT COUNT DISTINCT
-	* Fixed ".0" issue in printing non-integers that have no digits after dot
-
-2007-03-29 10:52  source
-
-	* insert.c: * Fixed typo in debug code
-
-2007-03-28 16:59  source
-
-	* rdf_core.c: * Fixed entering mutex instead of leaving it
-
-2007-03-28 16:59  source
-
-	* sqlsrv.c: * Fixed missing leave txn mutex when done
-
-2007-03-28 16:58  source
-
-	* sparql.sql: * Suppress upgrade message on a new database
-
-2007-03-28 13:57  source
-
-	* recovery.c: * Fixed get registry also when starting with different inis for schema
-	  and data
-
-2007-03-27 22:44  source
-
-	* sparql.h, sparql.sql, sparql2sql.c, sparql2sqltext.c,
-	  sparql_core.c, sparql_l.l, sparql_p.y: * Added support for define input:inference and for option (inference ...)
-
-2007-03-27 17:53  source
-
-	* sqlbif.c: * Fix no IN_CPT during atomic
-
-2007-03-27 12:17  source
-
-	* Makefile.am, davxml2n3xml.xsl, davxml2rdfxml.xsl,
-	  erdf2rdfxml.xsl, n3xml2uriqahtml.xsl, rdfa2rdfxml.xsl,
-	  rdfxml2n3xml.xsl: * Moved to rdf_mappers
-	* Removed deprecated files
-
-2007-03-27 12:09  source
-
-	* arith.c, multibyte.c, rdfbox.c, sparql.sql, wifn.h, xqf.c, xqf.h: * Added full support for typed non-string rdf boxes
-	* Changed RDF FT data column to RO_DIGEST
-	* Added arithmetics on rdf boxes
-	* Fixed XQF constructors
-
-2007-03-27 12:07  source
-
-	* http.c: * Removed 1 byte read inside the select thread, which can hang the server
-
-2007-03-26 16:47  source
-
-	* Makefile.am: * Moved binsrc/tests/dav to binsrc/dav
-
-2007-03-26 15:24  source
-
-	* Makefile.am: * Removed deprecated defines
-
-2007-03-26 15:21  source
-
-	* Makefile.am: * Fixed build dependencies
-
-2007-03-26 15:20  source
-
-	* Makefile.am: * Fixed whitespace
-
-2007-03-26 14:55  source
-
-	* Makefile.am: * Added missing url rewrite functions
-
-2007-03-26 12:51  source
-
-	* sqlpfn.c: * Fixed variable declaration order
-
-2007-03-26 09:58  source
-
-	* bitmap.c, gate.c, insert.c, inxop.c, lock.c, search.c, sqlver.h,
-	  wifn.h: * Fixed problem registering/unregistering pagelock
-
-2007-03-26 09:57  source
-
-	* sparql.sql: * Added message informing user of RDF index upgrade time
-
-2007-03-26 01:14  source
-
-	* sparql_core.c, sparql_l.l, sqlfn.h: * Changed parameter counter to int
-
-2007-03-24 12:46  source
-
-	* rdfbox.c: * Fixed return value of rb_copy
-
-2007-03-23 14:13  source
-
-	* sort.c, sql3.y, sqlcomp2.c, sqldf.c, sqlfn.h, sqlgen.c,
-	  sqlnode.h, sqlo.h, sqlparext.h, sqlpfn.c, sqlpfn.h,
-	  sqlwords.gperf: * Added support for SELECT BREAKUP(expr) in subquery
-
-2007-03-23 14:11  source
-
-	* rdf_core.c, sparql.sql: * Fixed backward compatibility
-	* Changed error handling in upgrade
-
-2007-03-23 14:10  source
-
-	* http.c: * Fixed memory leak
-
-2007-03-23 10:17  source
-
-	* sparql.sql, sqlver.h: * Fix for upgrading database to new rdf ft
-
-2007-03-22 17:27  source
-
-	* Makefile.am: * Fixed typo
-
-2007-03-22 17:11  source
-
-	* Makefile.am: * Moved Syncml to binsrc/sync
-
-2007-03-22 16:36  source
-
-	* sparql.sql: * Fixes for BOOL of an empty string and for DISTINCT of calculated
-	  non-storable rdf boxes in LONG valmode
-
-2007-03-22 16:35  source
-
-	* http.c: * Fixed memory leak
-
-2007-03-22 14:22  source
-
-	* Makefile.am, atom2rdf.xsl, atom2sioc.xsl, cc2rdf.xsl, dc2rdf.xsl,
-	  flickr2rdf.xsl, geo2rdf.xsl, google2rdf.xsl, hcal2rdf.xsl,
-	  hcard2rdf.xsl, hreview2rdf.xsl, html2rdf.xsl, ning2rdf.xsl: * Moved to rdf_mappers
-
-2007-03-22 14:20  source
-
-	* Makefile.am, bif_explain.c, blobio.h, rdf_core.c, rdf_core.h,
-	  rdfbox.c, rdfinf.c, rdfinf.h, rltrx.c, sparql.sql, sql3.y,
-	  sqlcost.c, sqldf.c, sqlgen.c, sqlnode.h, sqlo.h, sqloinx.c,
-	  sqlparext.h, sqltype.c, sqlver.h, srvstat.c, system.sql, widv.h: * Use DF_RDF boxes in RDF_QUAD and RDF_OBJ
-	* Added support for RDF inference
-	* Added long ANY type
-
-2007-03-22 14:12  source
-
-	* meta.c: * Fixed memory leak
-
-2007-03-22 11:36  source
-
-	* srvstat.c: * Fixed duplicate symbol on Mac OS X
-
-2007-03-21 11:12  source
-
-	* bif_xml.c, sqlfn.h: * Fixed memory leak
-
-2007-03-19 21:40  source
-
-	* xmltree.c: * Fixed memory leak
-
-2007-03-19 12:42  source
-
-	* Makefile.am: * Fixed when building in separate directory from source
-
-2007-03-19 12:38  source
-
-	* Makefile.am, jso_reformat.awk: * Fix for generating JSO code when doing out-of-source build
-
-2007-03-16 18:55  source
-
-	* Makefile.am: * Extensive changes for new database optimization (vajra)
-	* Added build rule for sponges
-
-2007-03-16 18:55  source
-
-	* search_in.c: * Extensive changes for new database optimization (vajra)
-
-2007-03-16 18:54  source
-
-	* http.c: * Removed redundant check
-
-2007-03-16 15:10  source
-
-	* sparql.sql: * Fix for SPARQL define output:valmode "LONG" define get:soft "soft"
-	  DESCRIBE ?s ?p ?o FROM <http://del.icio.us/tag/sweo> WHERE { ?s ?p ?o }
-
-2007-03-16 13:51  source
-
-	* CLI.h, bif_file.c, http.c, numeric.c, obackup.c, odbcinc.h,
-	  recovery.c, scn3.l, soap.h, sparql_l.l, sqlsrv.c, turtle_l.l,
-	  xpscn.l: * Removed references to old BORLAND compiler
-
-2007-03-16 13:20  source
-
-	* 2pc.c, CLIsql1.c, arith.c, auxfiles.c, bif_explain.c, bif_text.c,
-	  bif_xper.c, bitmap.c, bitmap.h, blob.c, blobio.c, blobio.h,
-	  ddlrun.c, disk.c, eqlcomp.c, gate.c, hash.c, insert.c, inxop.c,
-	  ksrvext.h, ksrvextphp.h, lock.c, ltrx.h, meta.c, neodisk.c,
-	  obackup.c, recovery.c, regist.c, rltrx.c, row.c, search.c,
-	  security.c, security.h, sort.c, space.c, sql_to_c.awk, sqlbif2.c,
-	  sqlcomp2.c, sqlexp.c, sqlfn.h, sqlgen.c, sqlintrp.c, sqlintrp.h,
-	  sqlnode.h, sqlo.c, sqlo.h, sqlorder.c, sqlparext.h, sqlrun.c,
-	  sqlsrv.c, sqltype.c, sqlver.h, srvmultibyte.c, srvstat.c, ssl.c,
-	  system.sql, text.c, update.c, wi.h, widd.h, widv.h, wifn.h: * Extensive changes for new database optimization (vajra)
-	* Added new RDF box type
-	* Fixed missing cases in hash join, group, distinct
-	* Remember distinct value counts for p and g cols in RDF. Use these for
-	  cost model cardinality when compar with non-leading const.
-
-2007-03-16 13:14  source
-
-	* mtwrite.c: * Changes for new database optimization (vajra)
-	* If c_use_aio == 2, the threads for background write must have a stack
-	  size large enough for MAX_MERGE * PAGE_SZ.
-	* Added initial support for aoi
-
-2007-03-16 13:11  source
-
-	* bif_date.c, datesupp.c: * Use gmtime_r where available
-
-2007-03-16 13:10  source
-
-	* sqlbif.c, sqlbif.h: * Changes for new database optimization (vajra)
-	* Added nicknames for bif_xqf_str_parse with typed return values for
-	  different types.
-	* Added rdf_box type
-	* Added bif_chr1()
-	* Fixed GPF when array is not a box
-
-2007-03-16 13:07  source
-
-	* aqueue.c, aqueue.h: * Changes for new database optimization (vajra)
-	* Fixed misplaced ";", always skip 1st recompiled proc call, return only
-	  if there is an error
-	* Fixed possible threading issue
-
-2007-03-16 13:03  source
-
-	* http.c, http.h, url_rewrite.sql: * Added new URL rewriting rules
-	* Added user-agent substitution via http_get
-	* Fixed HTTPS connection handshake so it does not block
-	* Fixed non-mozilla UA when sponging
-
-2007-03-16 12:56  source
-
-	* sqldf.c: * Changes for new database optimization (vajra)
-	* Different sort of candidate next tables
-	* Cost model for RDF ft inx
-	* When importing oreds into dt, no not assume their type. Some can change
-	  due to known false or etc. Otherwise, if it comes out a dt or value subq
-	  from import, the real meaning is exists.
-	* Small bug fixes
-
-2007-03-16 12:53  source
-
-	* sqlcost.c: * Maybe have a pred's mon cardinality so that it doesn't underflow w/ too
-	  many.
-	* Preserve order of cardinality but not absolute cardinality
-	* Remember distinct value counts for p and g cols in RDF. Use these for
-	  cost model cardinality when compare with non-leading const.
-	* Note outer joings in cost model, can't have cardinality < 1
-	* Added cost model for RDF ft inx.
-	* Generic cost model fix for text preds when text pred is driving.
-
-2007-03-16 12:49  source
-
-	* bif_date.c, bif_file.c, blobio.c, datesupp.c, security.c,
-	  sqlpfn.c, sqltype.c, srvcr.c, wi_xid.h: * Changed include <...> into include "..." for local vos headers
-
-2007-03-16 12:37  source
-
-	* virtual_dir.sql: * Added extended proxy service
-	* Added UTF-8 for /proxy default category when none bnode in xml
-	  serialization
-	* Use "soft" as "replacing" can kill the /dataspace
-
-2007-03-16 12:33  source
-
-	* rdf_core.c, rdf_core.h, rdf_mapping.jso, rdfxml_parser.c,
-	  sparql.h, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_l.l, sparql_p.y,
-	  sparql_qm.c: * Added optimizations for SPARQL DESCRIBE
-	* Added optimizations for RDF loaders: no more separate callback calls for
-	  obtaining IRI IDs, no more local hashtable of IRI_IDs of IRIs,
-	  optional log_mode parameter for multithreaded loaders
-	* Added free-text suppport for RDF views
-	* Added improved seeAlso support
-	* Added PingService. After receiving some URL from outside, ping a service
-	  if configured
-	* Added output format aliases
-	* Added support for zero-argument iri classes and views
-	* Added feed discovery link in search try to get embedded rdf from xhtml
-	* Added support for Flickr
-	* Added sparp_qp_trav_localize_filters rewriting. This fixes problem with
-	    sparql .... where {?x <y> ?z optional { ?x <p> <q> }
-	      filter {bif:contains (?x ...)))}
-	  This also improves code generation for cases when filter with one non-NULL
-	  variable is placed too close to expression root
-	* Added describe when asked for rdf in a dataspace
-	* Added support for vcalendar 1.1 to syncml immuytablegraphs
-	* Added subjects of a given object to DESCRIBE
-	* Added nicknames for big_xqf_str_parse with typed return values for different
-	  types
-	* Added define input:grab-intermediate
-	* Added support for xsd:date and xsd:time (dbpedia:birthdate)
-	* Changed index RDF_QUAD_PGOS into RDF_QUAD_OGPS
-	* Fixed SPARQL DESCRIBE with sponge
-	* Fix for MusicBrainz RDF views
-	* Fixed UTF-8 for /proxy default category when non bnode in xml serialization
-	* Fixed sending UTF-8 strings as UTF-8
-	* Enforce UTF-8 in /sparql use http_value & wide string as otherwise <> etc
-	  symbols may not be escaped
-	* Fixed SPARQL define output:format "TTL" select distinct
-	* Fixed default query for /sparql
-	* Fixed last chance to get meta data, call the dav's metadata extractor
-	* Fixed SPARQL define output:valmode "LONG" define get:soft "soft"
-	  DESCRIBE ?s ?p ?o from <http:del.icio.us/tag/sweo> where {?s ?p ?o}
-	* Fixed RDF parsing of nested elements with parsetype="Resource"
-	* Fixed SPARQL define output:valmode "LONG" select distinct ...
-	* Fixed memory pool corruption during declaration of free-text table in quad
-	  map view
-	* Small bugfixes
-
-2007-03-16 11:26  source
-
-	* turtle_l.l: * Fixed supported for backquote in TURTLE
-
-2007-03-16 11:25  source
-
-	* jso.c: * Added bif_jso_make_digest and bif_jso_parse_digest
-
-2007-03-16 11:00  source
-
-	* autoexec.sql: * Added VAD_AUTO_UPGRADE call to server startup
-
-2007-03-16 10:59  source
-
-	* xqf.c, xqf.h: * Added nicknames for bif_xqd_str_parse with types return values for
-	  different types
-	* Added support for xsd:date and xsd:time
-	* Extended __get_iso_date(0 to accept values that match DATE-TIME from RFC
-	* Small bugfixes
-
-2007-03-16 10:56  source
-
-	* xslt.c: * Added bif_dict_size()
-
-2007-03-16 10:56  source
-
-	* atom2rdf.xsl, atom2sioc.xsl, blog.xsl, cc2rdf.xsl,
-	  cov_report.xsl, cov_time.xsl, davxml2n3xml.xsl,
-	  davxml2rdfxml.xsl, dc2rdf.xsl, erdf2rdfxml.xsl, flickr2rdf.xsl,
-	  geo2rdf.xsl, google2rdf.xsl, hcal2rdf.xsl, hcard2rdf.xsl,
-	  hreview2rdf.xsl, html2rdf.xsl, n3xml2uriqahtml.xsl, ning2rdf.xsl,
-	  rdfa2rdfxml.xsl, rdfxml2n3xml.xsl, soap12_router.xsl,
-	  soap_import_sch.xsl, soap_sch.xsl, soap_xmlrpc.xsl,
-	  wsdl_expand.xsl, wsdl_import.xsl, wsdl_parts.xsl, wsrp_error.xsl,
-	  wsrp_interm.xsl, wsrp_resp.xsl, wsrp_ultim.xsl, xmlrpc_soap.xsl: * Added support for flickr
-	* Added more sponges
-	* Fixed base URL for hcal
-	* Small bugfixes
-
-2007-03-16 10:45  source
-
-	* xmltree.c, xmltree.h: * Added support for xsd:date and xsd:time
-	* Added bif:contains _predicate_
-
-2007-03-16 10:39  source
-
-	* rdfbox.c, Makefile.am: * Added initial implementation of rdf_box
-
-2007-03-16 10:35  source
-
-	* bif_phrasematch.c: * Fixed debug warning messages
-
-2007-03-16 10:23  source
-
-	* numeric.c: * Small bugfix
-
-2007-03-14 13:28  source
-
-	* 2pc.c, auxfiles.c, bif_repl.c, bif_text.c, bif_xml.c, ddlrun.c,
-	  lock.c, ltrx.h, meta.c, repldb.c, rltrx.c, security.c, sqlbif.c,
-	  sqlcmps.h, sqlcomp2.c, sqlexp.c, sqlfn.h, sqlgen.c, sqlintrp.c,
-	  sqlprocc.c, sqlrcomp.c, sqlrun.c, sqlsrv.c, sqlstmts.c, sqlver.c,
-	  sqlview.c, srvstat.c, wifn.h: * Removed rest of UNIVERSE code
-
-2007-02-27 14:43  source
-
-	* rdf_mapping.jso, scn3.l, sparql2sql.c, sparql2sqltext.c,
-	  sparql_core.c, sparql_sff.c: * Fixed sparp_rvr_copy: always return something
-	* Fixed GPF in sprintff optimization in wb/SparqlQMJoin when
-	  oplsioc:subname-of-supername is added
-	* Small fixes
-
-2007-02-27 14:41  source
-
-	* sparql2sql.h: * Fixed non-DEBUG build
-
-2007-02-27 14:40  source
-
-	* atom2rdf.xsl, atom2sioc.xsl, cc2rdf.xsl, dc2rdf.xsl,
-	  erdf2rdfxml.xsl, geo2rdf.xsl, google2rdf.xsl, hcal2rdf.xsl,
-	  hcard2rdf.xsl, hreview2rdf.xsl, html2rdf.xsl, ning2rdf.xsl,
-	  rdfa2rdfxml.xsl: * Added more sponges
-
-2007-02-27 14:36  source
-
-	* nn_svr.sql: * Fixed small bugs
-
-2007-02-27 14:35  source
-
-	* xslt_opt.c: * Relaxed syntax for wierd comments inside stylesheet
-	  (xhtml:div inside xsl:stylesheet)
-
-2007-02-27 14:33  source
-
-	* sqloinx.c: * Do not make an inx int join if all key parts are given.
-	* Do not make join or local inx ints involving remote tables
-
-2007-02-27 14:32  source
-
-	* sqlbif.c: * Fixed GPF when non-boxed 0 is given as argument
-
-2007-02-27 14:32  source
-
-	* regist.c, wifn.h, xmlsql.c: * Fixed compiler warnings
-
-2007-02-27 14:30  source
-
-	* sparql.sql: * Added handling of application/rdf+n3
-	* Fixed getting predefined default graph if one is omitted from request
-	* Added grants for SPARQL_CONSTRUCT_*
-	* Fixed processing default-graph only if not null and not empty
-	* Fixed to show the fully generated query on error
-	* Added alias output for param format
-	* Fixed google base * ning filters to rdf
-	* Fixed bug with multiple meta links
-	* Added GRDDL support
-	* Fixes for GPF in sprintff optimization in wb/SparqlQmJoin when
-	  oplsioc:subname-of-supername is added.
-	* Added more microformats
-	* Added sponge to take feeds if it's a basic html page
-
-2007-02-08 10:28  source
-
-	* CLIsql1.c, CLIuti.c, eqlcomp.c: * Simplified patch for precision of DV_ANY type
-
-2007-02-07 17:19  source
-
-	* CLIodbc3.c, CLIsql1.c, CLIuti.c: * Describe DV_ANY field as VARCHAR with LENGTH of 4070
-
-2007-02-01 13:03  source
-
-	* rdf_mapping.jso, scn3.l, sparql.h, sparql.sql, sparql2sql.c,
-	  sparql2sql.h, sparql2sqltext.c, sparql_core.c, sparql_p.y,
-	  sparql_sff.c, sqlcomp2.c, sqlfn.h: * Fix for propagation SPART_VARR_SPRINGDD restruction from receivers down
-	* Caching for qmv matching results
-	* Added initial support for content negotiation and microformats
-	* Added timeout on transaction to prevent it to run forever
-	* SPARQL optimization: check for formats when quad maps are compared with
-	  triples
-	* Added support for SPARQL option ( return ) for sprintf-based IRI classes
-	* Fixed sorting of submaps in quad map when a new submap is added
-	* Fixed intersection
-	* Added SPARQL define sql:table-option ... define sql:select-option
-	* Fixed bug in SIOCref queries
-	* Fixed bug passing IRI graph into exec() calls
-	* Fixed "multi-column alias should have an alias name" and removed warning
-	* Faster RDF meta-schema update
-	* Added 2006-November semantic for graphs
-
-2007-02-01 12:58  source
-
-	* sqlver.h: * Update version to 29.21 due to changes in RDF views
-
-2007-02-01 12:56  source
-
-	* sqlbif.c, sqldf.c, sqlo.h, wifn.h: * Allocate dfe with variable length
-	* Check the mp allocated bytes in sqlo, to prevent killing the server
-	  with hugh query
-
-2007-01-22 16:44  source
-
-	* sparql_sff.c: * Added SPARQL 'sprintff' analysis and optimization
-
-2007-01-22 16:44  source
-
-	* Makefile.am, bif_intl.c, jso.c, jso.h, rdf_core.c, rdf_core.h,
-	  rdf_mapping.jso, rdfxml_parser.c, sparql.h, sparql.sql,
-	  sparql2sql.c, sparql2sql.h, sparql2sqltext.c, sparql_core.c,
-	  sparql_l.l, sparql_p.y, sparql_qm.c, sqlver.h, turtle_l.l,
-	  turtle_p.y, widv.h, xmltree.c, xmltree.h, xslt.c: * Added SPARQL 'sprintff' analysis and optimization
-	* Added SPARQL/MaxExecutionTime to linmit the sparql execution time based on
-	  cost
-	* Added new functions like get_keyword_ucase
-	* Added support for literal classes plus minor fixes
-	* Optimized code for faster ODS upgrade
-	* Fixed speed of DB.DBA.RDF_QM_GC_SUBTREE
-	* Fix for membername-of-groupname quad map
-	* Added distinction between @-keywords and language identifiers
-	* Fixed names without colons
-	* Fixed blank node ids inside formulas
-	* Extended N3 parser; support for {} reification formulas, variables
-	  blank node verbs, error recovery for literal subjects
-	* Fix for resolving IRIs with "#' in IRI dereferencer
-	* Fix for codegen input:grab for list of constants
-	* Fixed error diagnostic in RDF/XML parser
-	* Fixes for DROP IRI/LITERAL CLASS
-	* Fixed for get:... and input:grab... parameters
-	* Extended should_sponge parameter of /sparql endpoint to pass the value
-	  to the core
-
-2007-01-22 16:35  source
-
-	* sqlcomp2.c, sqlrun.c, xpath.c: * Have dedicated field for thread mem pool for t_alloc*
-
-2007-01-22 16:30  source
-
-	* log.c: * Fixed compiler warning
-
-2007-01-22 16:28  source
-
-	* http_client.c: * Fixed memory leaks
-
-2007-01-22 16:28  source
-
-	* http.h: * Added maintenance page
-
-2007-01-22 16:26  source
-
-	* http.c: * Added maintenance page
-	* Added new bif function ses_read for reading string_output session
-
-2007-01-22 16:25  source
-
-	* mts_client.c: * Fixed include path
-
-2007-01-22 16:25  source
-
-	* map_schema.c: * Fixed dk_alloc_zero to allocate right amount of bytes and initialize to 0
-
-2007-01-22 16:22  source
-
-	* neodisk.c: * Before to write remap pages, check if they actually a remap as in mean
-	  time can be corrupted if there is a corruption, use a new set of free
-	  pages to write the remap
-
-2007-01-22 16:22  source
-
-	* numeric.c: * Use memmove instead of memcpy as memory areas are overlapping
-
-2007-01-22 16:21  source
-
-	* insert.c, lock.c, sqlfn.h: * Fixed compiler warnings
-
-2007-01-22 16:19  source
-
-	* wi_xid.h: * Added missing prototypes
-
-2007-01-22 16:18  source
-
-	* virtual_dir.sql: * Cannot delete an empty host
-	* Make sure we commit our work in the right places to release the locks
-
-2007-01-22 16:16  source
-
-	* eqlcomp.c, hash.c, meta.c, sqlgen.c, sqlnode.h, sqlpfn.c,
-	  system.sql, xmlsql.c: * Fixed memory leaks
-
-2007-01-22 16:13  source
-
-	* disk.c: * Added lock check on database files to make sure we do not corrupt the
-	  database when someone removes the .lck file by mistake and starts
-	  virtuoso again
-
-2007-01-22 16:12  source
-
-	* blob.c, regist.c, wifn.h: * Prevent crash in the middle of a checkpoint
-
-2007-01-22 16:10  source
-
-	* bitmap.c, bitmap.h: * Fixed comment
-
-2007-01-22 16:10  source
-
-	* bitmap.c, bitmap.h: * bitmap inx ins of new ce after array that is one short of full.
-	* bitmap sequential search with cond on non-bm col and no cond on bm col
-	* bitmap inx row's range starts at the bm start, not the ce start of the
-	  first ce.  After delete this can screw things up.
-
-2007-01-22 16:07  source
-
-	* bif_soap.c: * Fixed memory leak
-	* Changed Openlink into OpenLink
-
-2007-01-22 16:07  source
-
-	* bif_phrasematch.c: * Make checksums and masks all uint32 instead of int and ptrlong for
-	  64bit compatibility
-
-2007-01-22 16:03  source
-
-	* bif_file.c: * Added support for DV_UNAME to bif_md5()
-	* Clarified error message of bif_vector_sort
-
-2007-01-22 16:01  source
-
-	* bif_file.c: * Fixed second argument of tridgell32 function
-
-2007-01-22 15:58  source
-
-	* sqlbif.c: * Fixed compiler warning
-
-2007-01-22 15:57  source
-
-	* sqlbif.c, sqlbif.h: * Added function exec_score to return the cost in msec
-
-2007-01-22 15:53  source
-
-	* sqlbif.c: * Added param to row_count to return the caller n_affected
-
-2007-01-22 15:51  source
-
-	* sqlbif.c: * Added support for DV_UNAME to bif_subseq
-
-2007-01-22 15:48  source
-
-	* sqlbif.c: * If the server is in atomic mode, the thread already has a mutex on cpt,
-	  so in this case we should not lock here to avoid a deadlock
-
-2007-01-22 15:38  source
-
-	* CLI.h, CLIsql2.c, CLIsql3.c: * Added option to treat VIEWS as TABLES in SQLTables
-
-2006-12-01 19:17  source
-
-	* ksrvext.h: * Use Dksystem.h to fix problems with Mac OS X universal build
-
-2006-12-01 18:55  source
-
-	* disk.c: * Fixed core dump rewriting database when byte order changes
-
-2006-12-01 16:52  source
-
-	* ksrvextphp.h: * Removed duplicate typedef
-
-2006-12-01 16:51  source
-
-	* xmlenc_algos.c: * Fixed building when _SSL is not defined
-
-2006-12-01 16:50  source
-
-	* rdfxml_parser.c: * Disable XML validation for RDFXML files. Since callbacks check every
-	  element and attribute anyway and at the same time the file almost never
-	  contains DTD.
-
-2006-12-01 16:01  source
-
-	* http.c, http.h: * Simplified allocating http threads
-
-2006-12-01 16:00  source
-
-	* http.c: * When atomic is inside ws, release the lock after all
-
-2006-12-01 15:58  source
-
-	* http.c: * Fixed CA file when ssl_virtual_host != default_ssl_host
-
-2006-12-01 15:57  source
-
-	* bif_soap.c, http.c, virtual_dir.sql: * http cache needs url to be matched against full url not only path
-
-2006-12-01 15:50  source
-
-	* virtual_dir.sql: * Added virtual dir for installer
-
-2006-12-01 02:46  source
-
-	* rdf_mapping.jso, sparql.h, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_l.l, sparql_p.y,
-	  sparql_qm.c, sql3.y, sqlfn.h, virtual_dir.sql: * Added SPAR_CODEGEN type of SPARQL trees
-	* Fixed SPARQL syntax (IDENTIFIED BY)
-	* Fixed invocation of SPARQL schema manipulation statements from SQL
-	* Fixed RDF parsing errors
-	* Fixed empty rules for old bison parsers
-	* Changes to quad map
-	* Fixed JSON result format for value type bnode
-	* Fixed proper prefix and removed extra cosing brace
-
-2006-12-01 02:39  source
-
-	* xmltree.c, xmltree.h: * Fixed RDF parsing errors
-	* Added extra UNAMEs
-	* Fixed compiler warnings
-
-2006-12-01 02:37  source
-
-	* sparql.sql, sqlcost.c, wifn.h, search.c: * Implement iri-to-id translation in C
-
-2006-12-01 02:32  source
-
-	* rdfxml_parser.c: * Fixed accessing uninitialized pointer on finding ns URI and local part
-	  of qname without ':' with allowed default and no default namespace
-	  decl in the context.
-	* Fixed RDF parsing errors
-
-2006-12-01 02:29  source
-
-	* sqlbif.c, sqlbif.h: * Fixed RDF parsing errors
-	* Fixed bug on server startup when SPARQL_RELOAD_QM_GRAPH() leaves garbage
-	  in sy graph
-	* Fixed compiler warnings
-	* Small fixes from quad map
-
-2006-12-01 02:27  source
-
-	* sqlbif.c: * Use an automatic var for hash table, as the one from the compiler is
-	  not reentrant to change
-
-2006-12-01 02:24  source
-
-	* rdf_core.c: * Extended functionality of iri_to_id
-
-2006-12-01 02:20  source
-
-	* multibyte.c: * Fixed compiler warnings
-
-2006-12-01 02:19  source
-
-	* odbccat.c: * Fixed spelling
-
-2006-12-01 02:17  source
-
-	* ksrvextphp.h: * Fixed prototypes
-
-2006-12-01 02:16  source
-
-	* ddlrun.c: * Fixed compiler warning
-	* Fixed bounds check
-
-2006-11-30 19:07  source
-
-	* sqlbif.c: * Added sprintf_or_null function
-
-2006-11-30 19:05  source
-
-	* search.c: * Added log message for the bad dtp
-
-2006-11-30 19:02  source
-
-	* sqlrun.c: * Fixed GPF when params are changed on open cursor, by doing a rebind
-
-2006-11-30 18:55  source
-
-	* sqlintrp.c, sqlintrp.h: * Fixed GPF when params are changed on open cursor, by doing a rebind
-
-2006-11-30 18:51  source
-
-	* ltrx.h, rltrx.c: * Added lt_no_rb_insert function
-
-2006-11-30 16:34  source
-
-	* pldebug.c: * Fixed check to stop in trigger; format is <trig>@<table>
-
-2006-11-30 16:30  source
-
-	* sqlbif2.c: * Added host_id function
-
-2006-11-30 16:29  source
-
-	* disk.c, insert.c, log.c, neodisk.c, obackup.c, recovery.c,
-	  sqlbif.c, widisk.h, wifn.h: * Added new aligned IO buffers
-
-2006-11-30 16:23  source
-
-	* insert.c: * Added workaround for Solaris AMD64 compiler bug
-
-2006-11-30 16:19  source
-
-	* bitmap.c: * Fixed atomic mode and deletion
-
-2006-11-30 16:16  source
-
-	* bif_xml.c: * Simplified argument check
-
-2006-11-30 16:15  source
-
-	* bif_intl.c: * Added bif_charset_canonical_name function
-
-2006-11-30 16:14  source
-
-	* sqlver.c: * Fixed host_id for Windows 32 & 64
-
-2006-11-30 16:12  source
-
-	* bif_xml.c, blob.c, sqldf.c, sqlgen.c, sqlo.c, sqltype.c: * Use DO_SET_WRITABLE and DO_SET_WRITABLE2 macros
-
-2006-11-30 16:04  source
-
-	* jso.c, jso.h, jso_reformat.awk: * Added support for 'array of any' and 'array of strings' field types
-
-2006-11-30 16:01  source
-
-	* auxfiles.c: * Added more globals
-
-2006-11-30 16:00  source
-
-	* CLIsql2.c: * Use DO_SET_WRITABLE2 macro
-
-2006-11-30 15:58  source
-
-	* sqlbif2.c, sqlnode.h, sqlsrv.c, srvstat.c: * Added extra info on client
-	* Added info when server was started
-
-2006-11-30 15:52  source
-
-	* bif_file.c: * Added gz_compress_file and gz_uncompress_file
-
-2006-11-30 15:51  source
-
-	* hash.c, sqlhash.c: * In quietcast mode, if a distinct hash gets a row that is a blog or
-	  will not fit, then such a row is not remembered and is considered ipso
-	  facto distinct. Good for sparql
-	* Added debug info when gpf in hash space fill
-
-2006-11-30 15:44  source
-
-	* system.sql, http_client.c: * Added timeout in client
-
-2006-11-30 15:43  source
-
-	* autoexec.sql: * Removed obsolete code, use sql_split_text instead
-
-2006-11-30 15:41  source
-
-	* bitmap.h, sqlnode.h, sqlo.h, wi.h: * Changed type of flags to bitf_t
-
-2006-11-07 21:25  source
-
-	* 2pc.c, 2pc.h, CLIodbc3.c, CLIsql1.c, arith.c, bif_soap.c,
-	  ddlrun.c, eqlcomp.c, http.c, information_schema.sql,
-	  ksrvextphp.h, numeric.c, numeric.h, rdf_core.c, repl.h, repl.sql,
-	  repldb.c, replpush.c, replsr.h, soap.h, soap.sql, sparql.sql,
-	  sparql2sql.c, sparql_core.c, sqlbif.c, sqlcomp.h, sqlcr.c,
-	  sqlexp.c, sqlocr.c, sqlocr.h, sqlview.c, uuencode.c, wi_xid.c,
-	  xmlenc-dec.c, xmlenc.c, xmlenc.h, xmltree.c, xpath.c, xpath.h,
-	  xpathp_impl.h, xpf.c, xpscn.l, xqf.c: * Fixed spelling in function names, variables and identifiers
-
-2006-11-07 21:19  source
-
-	* 2pc.c, CLIsql2.c, CLIuti.c, bif_crypto.c, bif_date.c, bif_diff.c,
-	  bif_file.c, bif_gnw.c, bif_phrasematch.c, bif_regexp.c,
-	  bif_soap.c, bif_xml.c, bif_xper.c, bitmap.c, ddlrun.c, disk.c,
-	  ftp.sql, gate.c, hash.c, http.c, insert.c, iodbcinst.h, jso.c,
-	  jso.h, jso_reformat.awk, lock.c, log.c, ltrx.h, map_schema.c,
-	  meta.c, msdtc.h, mtwrite.c, mtx.cpp, nn_svr.sql, obackup.c,
-	  odbccat.c, openxml.sql, pldebug.c, pldebug.h, pop3_svr.sql,
-	  rdf_mapping.jso, rdfxml_parser.c, recovery.c, rendezvous.c,
-	  replpush.c, replsri.c, search.c, sha.h, shuric.c, shuric.h,
-	  soap.sql, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_l.l, sparql_p.y, sql3.y,
-	  sql_to_c.awk, sqlbif.c, sqlbif2.c, sqlcomp.c, sqlcomp2.c,
-	  sqlcost.c, sqldf.c, sqlfn.h, sqlgen.c, sqlintrp.c, sqlnode.h,
-	  sqlo.c, sqlo.h, sqloby.c, sqloinx.c, sqlparext.h, sqlrun.c,
-	  sqlsrv.c, sqltype.c, srvcr.c, system.sql, system2.sql, users.sql,
-	  uuencode.c, virtual_dir.sql, wi.h, widisk.h, widv.h, wifn.h,
-	  xmlenc-dec.c, xmlenc.c, xmlenc_algos.c, xmlenc_algos.h, xmlsql.c,
-	  xmltree.c, xmltree.h, xpath.c, xpathp.y, xpathp_impl.h, xpf.c,
-	  xpscn.l, xslt.c, xslt_opt.c: * Fixed spelling in comments and messages
-
-2006-11-03 00:06  source
-
-	* CLIsql3.c: * Added support for reading both system and user DSNs on Unix and Mac OS X
-
-2006-11-02 23:09  source
-
-	* http.c: * If we fail parsing the Authorization: key, we return "- -" otherwise
-	  the log_info_http function either GPFs or produces unparsable log line
-	  (pvk)
-
-2006-10-27 14:16  source
-
-	* sqlrrun.c: * Added option to trim trailing spaces in CHAR(N) col from a remote table
-
-2006-10-27 12:51  source
-
-	* bif_repl.c, wifn.h: * Added option to trim trailing spaces in CHAR(N) col from a remote table
-
-2006-10-27 12:51  source
-
-	* sparql_l.l, sparql_p.y: * Changed syntax for subclass declaration
-
-2006-10-27 12:50  source
-
-	* sqlbif.c, sqlnode.h: * Fixed GPF on nesting calls of bif_exec
-
-2006-10-26 12:41  source
-
-	* insert.c: * Fixed typo
-
-2006-10-25 22:27  source
-
-	* http.c: * When session is kept in the hash and another thread gets to re-use it,
-	  it must wait until the initial thread finishes
-
-2006-10-25 22:26  source
-
-	* srvstat.c: * Added w% and measure of how many bufs in io queue
-
-2006-10-25 22:25  source
-
-	* neodisk.c: * Added sync with flush before going atomic, resulting in shorter
-	  atomic time
-
-2006-10-25 22:24  source
-
-	* sqlbif.c: * Added getrusage bif
-
-2006-10-25 22:20  source
-
-	* virtual_dir.sql: * Updated caching
-
-2006-10-25 22:19  source
-
-	* blob.c: * Fixed undefined return value in bh_read_dir
-
-2006-10-25 12:26  source
-
-	* sqlwords.h: * Regenerated
-
-2006-10-21 15:52  source
-
-	* rdf_core.c: * Fixed memory leak in tf_free
-
-2006-10-21 12:08  source
-
-	* bif_repl.c, sqlsrv.c, system.sql, wifn.h: * VDB stat refresh and vacuum ()
-
-2006-10-18 23:02  source
-
-	* disk.c: * New buffer replacement. Prefer a free one if in the the next 20 buffers
-	  in the pool, else take the oldest if it is older than minimum reuse age
-
-2006-10-18 17:40  source
-
-	* xmla.sql: * Fixed error in db schema rowset
-
-2006-10-18 17:40  source
-
-	* sparql.sql: * Fixed typo
-
-2006-10-18 09:54  source
-
-	* auxfiles.c, blob.c, ddlrun.c, disk.c, eqlcomp.c, gate.c,
-	  insert.c, inxop.c, lock.c, ltrx.h, meta.c, neodisk.c, rdf_core.c,
-	  recovery.c, rltrx.c, row.c, search.c, space.c, sparql_qm.c,
-	  sql3.y, sqlcost.c, sqlfn.h, sqlgen.c, sqlnode.h, sqlparext.h,
-	  sqlrun.c, sqlsrv.c, sqlver.h, sqlwords.gperf, srvstat.c, ssl.c,
-	  update.c, wi.h, widd.h, wifn.h: * Added new bitmap index
-	* Prefer buffers of deleted pages for reuse before using clean old
-	* Shorter buffer_desc_t struct
-	* Adjusted buf_touch and other macros
-	* Do not call buf_set_last frivolously
-	* Sequence of leaving deleted butter set to reset bd_space_last
-	* Do not forget final cost of value subq in cost model
-	* Pre-cpt buffer flush need not be in txn mtx
-	* Read ahead to tolerate deletes of ra batch pages between assembling ra set
-	  and schedulting the read
-	* Fix to serializable desc order
-	* Fixes to mtx_debug
-	* Hold mutex in compact leave
-	* Leave evenly divided space after rows in pg_write_compace for growth of rows
-	  in upd_refit_row
-	* Vacuum table option for compacting read of inx
-	* Shorter sections with page map mtx in transits and land
-	* Re-enabled atomic_dive
-	* Use log_write_mtx to serialize log write to reduce in_txn contention
-
-2006-10-18 09:45  source
-
-	* bif_repl.c: * Scheduler must always start in DB qualifier
-
-2006-10-18 01:25  source
-
-	* blobio.h: * Fixed compiler warning
-
-2006-10-18 01:25  source
-
-	* datesupp.c: * Fixed GPF in date string
-	* Fixed bug in http_string_date bif
-
-2006-10-18 01:23  source
-
-	* rdfxml_parser.c: * Added missing app env for rdfxml load callbacks
-
-2006-10-18 01:22  source
-
-	* obackup.c: * Faster count of inc backup set pages
-
-2006-10-18 01:21  source
-
-	* sparql.sql: * Fixed isolation level
-	* Better security on /sparql/ endpoint in HTTP sponge
-	* More comments
-	* Fixed typo in function name in grant
-	* Added rdf_load_rdfxml_mt
-
-2006-10-18 01:17  source
-
-	* system.sql: * Fixed proper HTTP dates in 'Expire: ...' dates
-	* Grant execute on safe procedures to public
-
-2006-10-18 01:16  source
-
-	* http.c: * Added optional argument to bif http_string_date()
-	* Added check for NULL and bad values of a source date string
-
-2006-10-18 01:13  source
-
-	* Makefile.am, bitmap.c, bitmap.h: * Added new bitmap index code
-
-2006-10-10 15:39  source
-
-	* http.c: * Fixed detection of multiple interfaces
-
-2006-10-10 13:52  source
-
-	* insert.c: * Lock pagemap before calling pr_free
-
-2006-10-09 23:36  source
-
-	* .cvsignore, Makefile.am, sparql_qm.c: * Merged QUAD-MAP work into tree
-
-2006-10-09 16:03  source
-
-	* jso_reformat.awk, rdf_core.c, rdf_core.h, rdf_mapping.jso,
-	  sparql.h, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_l.l, sparql_p.y: * Fix for 'SPARQL define input:default-graph-uri ...' when an IRI was
-	  treated as a literal, not as an IRI, resulting check that G is a
-	  loteral (of DV_UNAME type)
-	* Default graph in the ini, docs about SPARQL INI
-	* Merged QUAD-MAP work into tree
-
-2006-10-09 16:00  source
-
-	* rltrx.c: * When itcs wait for rl and row at rl expands and causes split and ends
-	  up extend side of split, set the waiting llt's as owners of the pl on
-	  the extended side
-
-2006-10-09 15:59  source
-
-	* lock.c: * Added optional check of correct pl_owners of lock release, so matches
-	  owner/waiting set of all rl's
-
-2006-10-09 15:58  source
-
-	* recovery.c: * Make sure not to write past end if tree too deep
-
-2006-10-09 15:57  source
-
-	* aqueue.c: * Make sure lt_leave is in trx scope
-
-2006-10-09 14:23  source
-
-	* rdf_core.c: * Fixed argument check
-
-2006-10-09 14:22  source
-
-	* soap.sql: * Added test for response and return reasonable error message
-
-2006-10-09 14:21  source
-
-	* virtual_dir.sql: * Fixed problem when no http port is defined
-
-2006-10-09 14:21  source
-
-	* xmltree.h: * Namespace change XML_* to VXml_*
-	* Namespace change xml_parser_* to vxml_parser_*
-
-2006-10-09 14:20  source
-
-	* dks_esc.c: * Almost final version of HTTP sponge
-
-2006-10-09 14:19  source
-
-	* sqlbif.c: * Added new formats to sprintf
-	* Fixed possible infinite loop problem
-
-2006-10-09 14:18  source
-
-	* sqlbif.c: * Updated search excerpt
-
-2006-10-09 14:16  source
-
-	* sqlbif.c: * Added busy_meter, spinlock_meter and flags for mutex_meter
-
-2006-10-09 14:13  source
-
-	* bif_intl.c, bif_text.c, multibyte.c, multibyte.h: * Added #define UTF8_DEBUG and ASSERT_BOX_UTF8 ... ASSERT_NCHARS_WCHAR
-	  macro definitions
-
-2006-10-09 14:11  source
-
-	* row.c: * Fixed compiler 'variable redefinition' warning
-
-2006-10-09 14:10  source
-
-	* bif_phrasematch.c, bif_xml.c, bif_xper.c, map_schema.h,
-	  rdfxml_parser.c, xmltree.c, xslt_opt.c: * Namespace change XML_* to VXml_*
-	* Namespace change xml_parser_* to vxml_parser_*
-
-2006-10-09 14:09  source
-
-	* CLIsql2.c: * Fixed SQLMoreResults to return success on empty dataset
-
-2006-09-25 17:14  source
-
-	* eqlcomp.c, eqlcomp.h, http.c, jso.c, jso.h, scn3.l, sqlfn.h,
-	  sqlnode.h: * Partial merge with QUAD-MAP-EXP branch
-
-2006-09-25 17:13  source
-
-	* sort.c, sqlcmps.h, sqlexp.c, sqlintrp.c: * Remember all ssls assigned before the rts with array params in vdb select
-	* In union, for use in except and intersect, make sure each term is
-	  exhausted before starting next. Must do so to flush unprocessed array
-	  parameters from terms
-
-2006-09-25 17:07  source
-
-	* sqlbif.c: * Added mem_meter
-
-2006-09-25 17:06  source
-
-	* xmltree.c, xmltree.h, xslt.c: * Fixed prototypes
-
-2006-09-25 17:01  source
-
-	* CLI.h, CLIuti.c: * Fixed prototypes
-
-2006-09-25 16:59  source
-
-	* sqlcstate.h: * Dependency tracking between QM JS objects and compiled query_t
-
-2006-09-25 16:58  source
-
-	* inxop.c: * Fixed possible GPF in inc intersection if seek to target gave index end
-	  or dvc_greater
-
-2006-09-25 16:57  source
-
-	* security.c, security.h: * Fixed function prototypes
-
-2006-09-25 16:55  source
-
-	* virtual_dir.sql: * Fixed typo
-
-2006-09-25 16:55  source
-
-	* auxfiles.c: * Added more ini settings
-
-2006-09-25 16:54  source
-
-	* bif_xml.c: * Added bif_wbxml2xml
-
-2006-09-25 16:53  source
-
-	* sparql2sqltext.c: * Using special names like 'callretRDF/XML-O' for column of result-set
-	  with formatted output of CONSTRUCT
-
-2006-09-25 16:52  source
-
-	* sparql.sql: * Fixed SPARQL web service endpoint, re. 'define output:format ...' and
-	  'auto' format.
-	* Fixed SPARQL_RESULTS_XML_WRITE_ROW when the result-set contains string
-	  output that is returned by a formatter (say, due to define output:format
-	  'TTL')
-	* Added new format output type RDF+XML
-	* Fixed blob handle
-	* Fix for nulls to have empty cell
-	* Removed redundant 'commit work' statements
-
-2006-09-25 16:48  source
-
-	* blob.c, gate.c, search.c, widd.h, wifn.h: * Change row count in dd and count estimate code to int64 to avoid overflow
-	* Recover from bad blob reads in converting blob to string or copying blob
-	  between rows
-
-2006-09-25 16:45  source
-
-	* repl.sql, sqlsrv.c: * Fixed replication to always do a cpt after log replay
-
-2006-09-25 16:44  source
-
-	* sql_code_cache_impl.c, sqlsrv.c, system.sql: * Cached resources may be upgraded when the server is upgraded
-
-2006-09-11 13:18  source
-
-	* 2pc.c, remote.h, sqlbif.h, sqlfn.h, sqlnode.h, sqlver.h, wifn.h: * Array params for dml only
-	* Fixed sending stmt options so often
-	* Cache the hash no on the remote stmt text
-
-2006-09-11 13:17  source
-
-	* system.sql: * Added new vdb functionality for SYS_STAT_ANALYZE
-
-2006-09-11 13:15  source
-
-	* sqlbif.c: * Added bif_string_or_uname_or_wide_or_null_arg
-	* Added get_keyword_ucase_int
-	* Fix for returning from sprintf_inverse without POP_QR_RESET
-
-2006-09-11 13:13  source
-
-	* sqlbif2.c: * Make table name uppercase to compile query in case mode 0, otherwise GPF
-
-2006-09-11 13:12  source
-
-	* sqlintrp.c: * If CPT pending noticed at vdb_enter, freeze if no delta. Was wrong,
-	  cancelling txn even if no delta
-
-2006-09-11 13:10  source
-
-	* srvstat.c: * Add vdb exec etc counters in status report
-
-2006-08-31 13:24  source
-
-	* sqlver.h: * Updated version to 04.50.2916
-
-2006-08-31 13:23  source
-
-	* sqlgen.c, sqloinx.c, sqloprt.c: * INX intersect fixes
-	* Fixed bad extraction of result cols for non-first term
-	* Fixed missing dependent preds for non-first term
-	* Fixed printing of inx int dfe's in debug output
-
-2006-08-31 13:21  source
-
-	* disk.c, insert.c, neodisk.c, sql3.y, sqlbif2.c, sqlcost.c,
-	  sqldf.c, sqlo.h, sqlparext.h, wifn.h: * Added autocompact of adjacent dirty pages, off by default.
-	* Added SQL opt for in pred to loop join
-	* Fixes and adjustments for cost model
-
-2006-08-31 13:18  source
-
-	* list_lex_props.sh: * Fixed Lexer, parser and C code for SPARQL metadata description language
-
-2006-08-31 13:17  source
-
-	* hash.c: * Changed function name to box_md5
-
-2006-08-31 13:16  source
-
-	* bif_repl.c: * Do not try to schedule activity when atomic mode is on
-
-2006-08-31 13:15  source
-
-	* sqlbif.h: * Added support for SPARQL INSERT and SPARQL DELETE
-
-2006-08-31 13:15  source
-
-	* sqlbif.c: * Added bif functions __and, __or and __not
-	* Added support for UNAMES in get_keyword
-
-2006-08-22 22:11  source
-
-	* meta.c, sqlfn.h: * Make sure column is visible
-
-2006-08-22 22:09  source
-
-	* jso.c, jso.h: * Added draft and incomplete (but usefull) small storage of tripples
-	  that are not preset properties of objects
-
-2006-08-22 22:08  source
-
-	* sparql2sqltext.c: * Fix for LIKE operator when nested inside filters
-
-2006-08-22 22:07  source
-
-	* xmltree.c, xmltree.h: * Added support for IRI classes (non-hierarchical for now)
-
-2006-08-17 20:27  source
-
-	* CLIsql3.c, CLIuti.c, jso.h: * Small cleanups
-
-2006-08-17 15:36  source
-
-	* sqlver.h: * Updated version to 2913
-
-2006-08-17 15:36  source
-
-	* xmlenc.c, xmlenc.h, xmlenc_algos.c, xmlenc_algos.h: * Added HMAC SHA1 functions
-
-2006-08-17 15:35  source
-
-	* sqlcost.c: * If we know nothing about the remote table, assume it has 10K rows
-
-2006-08-17 12:45  source
-
-	* CLIuti.c: * Additional fixes for specific SQLRowCount issues
-
-2006-08-16 13:03  source
-
-	* CLIsql1.c, CLIuti.c: * Fixed bug in SQLRowCount when using dynamic cursor
-
-2006-08-16 13:00  source
-
-	* sqldf.c, sqlver.h: * Do not generate exists subqueries as pass-through in VDB queries, so
-	  that virt side hash joins etc will get tried for these
-
-2006-08-16 09:58  source
-
-	* 2pc.sql, autoexec.sql, hosting.sql, http_auth.sql, nn_svr.sql,
-	  odbccat.sql, openxml.sql, pop3_svr.sql, soap.sql, sparql.sql,
-	  system.sql, system2.sql, useraggr.sql, vdb.sql, xml_a.sql,
-	  xmla.sql: * Fixed headers in sql files
-
-2006-08-16 00:09  source
-
-	* cov_time.xsl: * Fixed headers in xsl pages
-
-2006-08-14 23:35  source
-
-	* Makefile.am: * Fixed dependency generating *_code.c using sql_to_c.awk
-
-2006-08-14 23:28  source
-
-	* sparql.sql: * Additional sparql params to the service
-	* Added support for soap 1.2 for sparql service
-	* Added support for wsdl 2.0 for sparql service
-	* Do not set default graph if it's empty
-	* Disabled obsolete url to sparql service
-
-2006-08-14 23:22  source
-
-	* http.c: * Fixed bad size to snprintf
-
-2006-08-14 23:20  source
-
-	* xmlsql.c: * Default graph attr in template
-
-2006-08-14 23:20  source
-
-	* sqldf.c: * Fixed bug in join of two unions with an equality on calculated columns
-
-2006-08-14 23:19  source
-
-	* jso.c: * Fixed diagnostics
-	* Remove access to freed memory in jso_set of ANY field
-
-2006-08-14 23:18  source
-
-	* sql_to_c.awk: * Remove leading spaces from generated stored procedure text
-
-2006-08-11 00:31  source
-
-	* Makefile.am: * SImplified code generation rules for gawk and gperf
-
-2006-08-11 00:30  source
-
-	* sqlwords.h: * Regenerated using gperf 3.0.1
-
-2006-08-10 23:39  source
-
-	* sqlwords.gperf: * Renamed keyword to keiiyword in struct rather then doing this with
-	  sed command
-
-2006-08-10 16:28  source
-
-	* Makefile.am: * Fixed locale problem when using gawk
-
-2006-08-08 13:12  source
-
-	* blog.xsl, cov_report.xsl, cov_time.xsl, soap12_router.xsl,
-	  soap_import_sch.xsl, soap_sch.xsl, soap_xmlrpc.xsl,
-	  wsdl_expand.xsl, wsdl_import.xsl, wsdl_parts.xsl, wsrp_error.xsl,
-	  wsrp_interm.xsl, wsrp_resp.xsl, wsrp_ultim.xsl, xmlrpc_soap.xsl: * Fixed whitespace
-
-2006-08-08 13:11  source
-
-	* Makefile.am, simile.sql: * Added support for SIMILE
-
-2006-08-08 12:34  source
-
-	* sql3.y: * Added support for CREATE VIEW ... AS SPARQL SELECT
-
-2006-08-07 22:46  source
-
-	* Makefile.am: * Minor fixes for building sql_code_dav.c
-
-2006-08-07 22:22  source
-
-	* sparql2sqltext.c: * Replaced isiri() with isiri_id()
-
-2006-08-07 15:49  source
-
-	* sparql.sql: * Force SPARQL endpoint to run queries as SPARQL which has the SPARQL_SELECT
-	  role granted
-
-2006-08-07 15:47  source
-
-	* sparql_core.c: * Fixed compilation of SPARQL views during server startup
-
-2006-08-04 15:29  source
-
-	* sparql.sql: * Changed isparql.vad to isparql_dav.vad
-
-2006-08-03 20:23  source
-
-	* bif_soap.c, sparql.sql, sparql_l.l, xmla.sql: * Added text describing the page and referring to docs and isparql package
-	* Fixed wrong procedure names
-	* XML entity and related need tag to be closed in outer code as print_box
-	  does not close them
-	* Allow IRI to contain spaces and curly braces, as they are accepted by the
-	  W3C validator
-	* Fixed procedure names in RDF_RDFXML_TO_DICT
-	* Added support for application/xml in REXEC and results with namespace
-	  http://www.w3.org/2001/sw/DataAccess/rf1/result2
-	* Fixed a problem showing error in remote execution and big response
-
-2006-07-28 17:33  source
-
-	* xmla.sql: * Added missing argument to function replace
-
-2006-07-27 16:38  source
-
-	* ddlrun.c: * Fixed column lengths for SQLGetTypeInfo
-
-2006-07-27 14:50  source
-
-	* CLIodbc3.c: * Fixed bug in SQL_DESC_TYPE and SQL_DESC_CONCISE_TYPE
-
-2006-07-26 22:36  source
-
-	* sparql_p.y: * Fixed 'a' shorthand
-
-2006-07-25 21:42  source
-
-	* sparql.sql: * Fixed missing argument to DB.DBA.RDF_TTL2HASH
-
-2006-07-25 18:27  source
-
-	* system.sql, xmlsql.c: * Added SIOC in seeAlso xml template to execute sparql
-
-2006-07-25 00:20  source
-
-	* jso.c: * Improved diagnostics
-
-2006-07-24 17:23  source
-
-	* CLIuti.c: * Fixed buffer length calculation
-
-2006-07-24 15:45  source
-
-	* sparql.sql: * Fixes for MT loading of TURTLE
-
-2006-07-24 13:45  source
-
-	* CLIuti.c, widv.h: * Fixed wrong size in snprintf causing memory corruption
-
-2006-07-24 09:55  source
-
-	* bif_xml.c, sparql2sql.c, sparql2sqltext.c, sparql_core.c,
-	  sparql_l.l, sparql_p.y: * Added support for IN and LIKE operators (implemented as builtins)
-	* Fixed garbage collection
-
-2006-07-24 09:54  source
-
-	* inxop.c: * If itc_next or itc_search return DVC_GREATER or DBV_INDEX_END, leave
-	  the page and return IOP_AT_END
-
-2006-07-24 09:50  source
-
-	* sqlgen.c: * INX op disables option for inlining setp into order or main ks
-
-2006-07-24 09:49  source
-
-	* rdf_core.c, rdf_core.h, sparql.sql, turtle_l.l: * Fixed TURTLE reader
-
-2006-07-24 09:48  source
-
-	* wsdl_import.xsl: * Fixed empty resultset
-
-2006-07-19 18:05  source
-
-	* CLIodbc3.c: * Map SQL_DESC_AUTO_UNIQUE_VALUE, SQL_DESC_CASE_SENSITIVE and
-	  SQL_DESC_DISPLAY_SIZE to equivalent SQLColAttributes (ODBC 2.x) call
-
-2006-07-19 17:58  source
-
-	* CLIodbc3.c: * Use SQLColAttributes (SQL_COLUMN_DISPLAY_SIZE) instead of
-	  SQLDescribeCol(scale)
-
-2006-07-19 16:55  source
-
-	* ddlrun.c: * Do not check the NULL in fk row
-
-2006-07-19 16:54  source
-
-	* sparql2sql.c, sparql2sql.h, sparql2sqltext.c: * Added support for LIMIT, OFFSET and ORDER BY for sparql construct
-
-2006-07-19 16:53  source
-
-	* aqueue.c, sqlfn.h, sqlsrv.c: * Sync entry into transactions for aqueue threads and other db
-	  connect/disconnects.
-
-2006-07-19 09:48  source
-
-	* sparql.sql: * Unqualified use of rdf:about is deprecated
-	* Added mising grants
-
-2006-07-18 18:07  source
-
-	* Makefile.am: * Added aqueue.c to second library
-
-2006-07-18 14:39  source
-
-	* sparql.sql: * Added RDF parallel load
-
-2006-07-18 14:38  source
-
-	* Makefile.am, aqueue.c, aqueue.h, sqlbif.c, widv.h: * Added async_queue and related functions
-
-2006-07-17 21:11  source
-
-	* sparql.sql: * Fixed layout of sparql query help page
-	* Added border=1 to HTML result
-
-2006-07-17 21:10  source
-
-	* rdf_core.c: * Fixed memory leak
-
-2006-07-17 15:43  source
-
-	* Makefile.am: * Removed unwanted files from sparql target
-
-2006-07-17 15:28  source
-
-	* CLIcr.c, CLIsql1.c: * Setting sql_query_timeout to 0 had no effect. Make this set it to near
-	  maxint for about 23 days.
-
-2006-07-17 15:08  source
-
-	* ddlrun.c: * Fixed TYPE_NAME, LOCAL_TYPENAME and CREATE_PARAMS length to 32
-
-2006-07-17 15:06  source
-
-	* CLIsql2.c: * Fixed max identifier length for column/table/procedure names to 128
-
-2006-07-17 14:51  source
-
-	* CLI.h, CLIuti.c: * Added new function to calculate display size
-
-2006-07-17 14:50  source
-
-	* CLIsql1.c: * Fixed ODBC 2.x SQLColAttributes
-
-2006-07-17 14:48  source
-
-	* CLIodbc3.c: * Fixed SQLSMALLINT/SQLINTEGER mapping of arguments
-
-2006-07-17 14:46  source
-
-	* CLIodbc3.c: * Fixed SQLGetDescField (SQL_DESC_UPDATABLE)
-
-2006-07-14 19:07  source
-
-	* rdfxml_parser.c, sparql.sql: * Added security role for SPARQL
-
-2006-07-14 19:06  source
-
-	* sqlcomp2.c: * Added better error reporting in debug build
-
-2006-07-14 19:05  source
-
-	* rdf_core.c, row.c: * Fixed error message for bad type for iri col
-	* Added cache replacement for tf_cached_iid
-
-2006-07-14 09:15  source
-
-	* sqlver.h: * Updated version number
-
-2006-07-14 09:14  source
-
-	* sqldf.c: * Fixed computed col pred conditions for value subq, i.e. cond expression
-
-2006-07-14 09:12  source
-
-	* xslt.c: * Fixed memory leak in dict_duplicate()
-
-2006-07-13 14:30  source
-
-	* sparql.sql, sparql2sql.h, sparql2sqltext.c, sparql_core.c: * SPARQL to SQL compilation fixes including
-	  1. Proper support for case modes (in bif:lname and sql:lname function
-	     names
-	  2. Proper support for xsd:date, xsd:time and xsd:dateTime literals
-	     in expressions.
-
-2006-07-13 13:22  source
-
-	* wi.h: * No Universe support in vos
-
-2006-07-13 12:32  source
-
-	* jso.c: * Added bif_jso_validate()
-
-2006-07-13 12:32  source
-
-	* sparql.sql: * Fixed SPARQL_RESULTS_JAVASCRIPT_HTML_WRITE problem when returning
-	  javascript results
-	* Cleared Graph default value Changed query default value
-	* Fix for uninitialized format on remote SPARQL exec
-	* Added tree of quad maps instead of list
-	* Added functions for attaching and detaching filters
-	* Bugfix for case when triple is matched to quad map and constant field
-	  of triple matches to the non-const field of quad map
-
-2006-07-13 12:29  source
-
-	* disk.c, mtwrite.c, space.c: * When freeing temp tree:
-	  1. in cancel of write, could deadlock between page map and
-	     iq_mtx.
-	  2. could free a buffer and then revisit it after it was reallocated
-	     to other tree, serializing on wrong page map etc.
-	  Further, turn off not-in-any-check for mtx debug since timing impact
-	  is excessive.
-
-2006-07-13 12:28  source
-
-	* bif_file.c, ddlrun.c, eqlcomp.c, gate.c, insert.c, ltrx.h,
-	  meta.c, numeric.c, search.c, sql3.y, sqlbif.c, sqlcost.c,
-	  sqldf.c, sqlfn.h, sqlgen.c, sqlnode.h, sqlo.c, sqlo.h, sqloby.c,
-	  sqloinv.c, sqloinx.c, sqlparext.h, sqlprocc.c, sqlrun.c,
-	  sqlver.h, sqlwords.gperf, srvstat.c, system.sql, wi.h, widd.h,
-	  wifn.h: * Added __cost directive for procedures
-	* Cost model for and join order for procedures and procedure views.
-	* New implementation of random table option
-	* Sampling of table and column cardinality on demain
-	* Sampling of search condition selectivity when leading const key parts
-	* Certain items of ddlrun not allowd for public
-	* Add sys_col_auto_stats view and col_stat bif to see auto samples
-	* Understand rdf const funcs from iri and ext const syntax as const for
-	  in- cost model
-	* do not try  hash join if already have join inx op
-	* use swapping strses if file too long in file_to_string_output
-	* numeric box_hash corrected, box_hash bif added
-	* slqlo_statistics define out. auxfiles.c
-
-2006-07-13 12:21  source
-
-	* xmla.sql: * Added rowcount
-	* Fixed foreign keys
-
-2006-07-13 12:20  source
-
-	* xpath.c: * Fix to remove garbage from error message
-
-2006-07-13 12:18  source
-
-	* recovery.c: * Check for inx root not being proper node
-
-2006-07-13 12:07  source
-
-	* hosting.c, sqlbif.h: * Initial support for FCGI
-
-2006-07-13 12:07  source
-
-	* sqlstmts.c: * Added better diagnostics
-
-2006-07-13 12:06  source
-
-	* xmltree.h: * Increased xml local name from 100 to 500 characters
-
-2006-06-27 21:29  source
-
-	* jso.c, jso.h, jso_reformat.awk, rdf_mapping.jso: * Added support for xsd:anyURI type in Java-Script style Objects.
-	* Map DB.DBA.SYS_USERS to RDF_QUAD
-	* Added bif_jso_validate
-	* Rewrote triple with long qm_list into union of triples with short qm_list
-	* New calculation of smalles common valmode
-
-2006-06-27 17:48  source
-
-	* sparql.sql: * Added support for JSON serialization of SPARQL result-sets.
-	* Added recognition of MIME application/json in SPARQL web service.
-	* Added new calculation of smallest common valmode, search for triple
-	  by selid and tabid, valmode hierarchy.
-	* Added redirect to default page (like SPARQL demo) when the query is
-	  not specified.
-	* Fixed uninitialized format on remote SPARQL exec.
-	* Small bugfixes
-
-2006-06-27 17:43  source
-
-	* turtle_p.y: * Fixed invalid syntax error message on semicolon at the end of [ ... ]
-	  blank node.
-	* Added workaround for popular syntax bug: top-level blank node subject
-	  without predicate-object-list after subject (because all predicates
-	  and objects are inside square brackets).
-	* Improved error diagnostics.
-
-2006-06-27 17:42  source
-
-	* xmla.sql: * Up case column names.
-
-2006-06-27 17:41  source
-
-	* sqlbif.c: * Added function bif_sprintf_inverse
-
-2006-06-27 17:41  source
-
-	* sql3.y, sqlexp.c, sqlpfn.h, widv.h: * No more warnings about mismatch UNAME versus VARCHAR.
-
-2006-06-27 17:39  source
-
-	* security.c: * trig on insert
-
-2006-06-27 17:27  source
-
-	* scn3.l, sparql2sql.c, sparql2sqltext.c, sqlcomp2.c: * Added proper error recovery for cases when SPARQL compilation creates
-	  an SQL text with syntax errors, yyparse signals an error and next
-	  parse runs yyrestart() that writes to an yy_input_buffer that resided
-	  in memory pool of previous compilation.
-
-2006-06-27 17:23  source
-
-	* xmltree.c, xmltree.h: * Added support for xsd:anyURI type in Java-Script style Objects
-
-2006-06-27 17:22  source
-
-	* sqlstmts.c: * Made an explicit value given to an identity column in insert override
-	  the value from the sequence
-
-2006-06-27 17:21  source
-
-	* sqlbif2.c: * Added function to return current stored procedure name
-
-2006-06-27 17:19  source
-
-	* sqlrun.c: * Removed debugging code
-
-2006-06-23 01:09  source
-
-	* CLIcr.c, CLIodbc3.c, CLIsql1.c, CLIsql2.c, CLIsql3.c, CLIuti.c: * Use cli_dbg_printf instead of OutputDebugString
-	* Removed old debugging code
-
-2006-06-22 23:05  source
-
-	* CLIcr.c, CLIodbc3.c, CLIsql1.c, CLIsql2.c, CLIsql3.c, CLIsql3W.c,
-	  CLIuti.c, CLIw.c: * Reindented code
-
-2006-06-08 14:23  source
-
-	* Makefile.am: * Fixed missing files from make dist
-
-2006-06-07 14:40  source
-
-	* sqlbif.c: * Fixed trailing '\0' in case of wide char
-
-2006-05-31 15:56  source
-
-	* virtual_dir.sql: * Normalize interface name
-
-2006-05-31 15:48  source
-
-	* sparql.sql: * Fix for TTL output of result sets
-	* Fixed namespace prefix
-
-2006-05-31 15:46  source
-
-	* security.c: * Fixed possible GPF when password is NULL
-
-2006-05-31 15:45  source
-
-	* jso.c, rdf_mapping.jso: * Final fixes for loading arrays
-
-2006-05-31 15:44  source
-
-	* list2.h, sqldf.c: * Added L2_DEBUG
-
-2006-05-31 15:42  source
-
-	* sqlintrp.c: * Replaced warning with error since it is not possible to continue if
-	  the procedure name is NULL
-
-2006-05-30 14:39  source
-
-	* Makefile.am: * Added missing dav_meta.sql file
-
-2006-05-26 13:54  source
-
-	* scn3.l, sqlbif.c, sqlcomp2.c, sqltype.c: * Fixed compilation issue on some platforms
-
-2006-05-26 13:53  source
-
-	* xmla.sql: * Fixed tag names
-
-2006-05-25 13:16  source
-
-	* sqlver.h: * Updated version number
-
-2006-05-25 13:15  source
-
-	* Makefile.am, scn3.l, sql3.y, sqlbif.c, sqlcmps.h, sqlfn.h,
-	  sqlpar.h, sqlpfn.c, sqlpfn.h: * Fixed BIF sql_split_text() function
-
-2006-05-25 13:11  source
-
-	* jso.c, jso.h, jso_reformat.awk, rdf_mapping.jso: * Added code for cross-referencing between objects, named constants,
-	  and debug dump
-
-2006-05-25 13:09  source
-
-	* inxop.c: * When index is at end, leave the page
-
-2006-05-25 13:07  source
-
-	* Makefile.am, scn3.l, sparql_l.l, turtle_l.l, xpscn.l: * Replaced flex command line params with %option to ensure portability
-	  across FLEX versions and to enable non-interactive parsing mode
-
-2006-05-25 12:42  source
-
-	* Makefile.am: * Added missing line continuation
-
-2006-05-20 00:51  source
-
-	* sqlver.h: * Updated version number
-
-2006-05-20 00:51  source
-
-	* virtual_dir.sql: * Added call to WS.WS.URIQA_VHOST_RESET
-
-2006-05-20 00:49  source
-
-	* system.sql: * Use UTF-8 code page for apps
-
-2006-05-20 00:48  source
-
-	* sparql.sql: * Fix for proper RDF/XML loading
-	* Extra conversion cases for different valmodes
-	* Final version of support of long O
-	* Initial support of long literals
-	* bif_http_escape() is extended to support TURTLE serializations
-
-2006-05-20 00:47  source
-
-	* sparql.h, sparql2sql.h, sparql2sqltext.c: * Fix for SPARQL queries with optional in optional in graph
-	* Added support for external variables in SPARQL patterns and result sets
-
-2006-05-20 00:43  source
-
-	* sparql_core.c: * Fixed GPF on internal errors during SQL text generation of inlined SPARQL
-
-2006-05-20 00:40  source
-
-	* sqlbif.c: * Fixed wrong argument name
-
-2006-05-20 00:39  source
-
-	* sqlbif.c: * Fixed compiler warning
-
-2006-05-20 00:37  source
-
-	* sqlbif.c: * iri_id_from_num can now get IRI_ID as argument.
-
-2006-05-20 00:34  source
-
-	* jso.c, jso.h, jso_reformat.awk, rdf_mapping.jso: * Initial support for JavaScript-lite Objects (JSO) for loading RDF data
-	  into C structures, like loading RDF mapping metadata
-
-2006-05-20 00:33  source
-
-	* text.c: * Fixed platform-dependent memory leak in free-text indexing
-
-2006-05-20 00:31  source
-
-	* xmla.sql: * Fixed handling of blobs
-	* Fixed cursor and bookmark support
-
-2006-05-20 00:26  source
-
-	* turtle_p.y: * Rewrote RDF/XML parser to be more efficient
-
-2006-05-20 00:25  source
-
-	* turtle_l.l: * Fix for import of IRIs with quotes
-
-2006-05-20 00:25  source
-
-	* dks_esc.c, http.h: * Extended  bif_http_escape() to support TURTLE serializations
-
-2006-05-20 00:19  source
-
-	* Makefile.am, autoexec.sql, bif_xml.c, rdf_core.c, rdf_core.h,
-	  rdfxml_parser.c, xmltree.c, xmltree.h: * Rewrote RDF/XML parser to be more efficient
-
-2006-05-20 00:09  source
-
-	* inxop.c: * In itc_il_search, if there is local code or local test in the itc_ks,
-	  and the code signals an error, the buffer will stay occupied after
-	  control exits. Fixed by using itc_next and not itc_search.
-
-2006-05-20 00:03  source
-
-	* bif_soap.c, http.c: * Fixed problem with SOAP rest protocol
-
-2006-05-19 23:58  source
-
-	* bif_file.c: * Added addler32 and tridgell32 functions
-
-2006-05-19 23:57  source
-
-	* bif_file.c: * Added bif_spotlight_status function
-
-2006-05-19 23:54  source
-
-	* bif_explain.c, ksrvext.h, sqlbif2.c, sqlfn.h, sqlprt.c,
-	  srvstat.c: * Fixed compiler warnings
-
-2006-05-19 22:18  source
-
-	* xmlenc_test.h: * Fixed compiler warning
-
-2006-04-27 20:43  source
-
-	* sqlver.h: * Updated version number
-
-2006-04-27 20:42  source
-
-	* sqlbif.c: * Fixed compiler warning
-
-2006-04-25 23:35  source
-
-	* sparql.sql: * Added stored procedure to reset RDF state
-
-2006-04-25 23:31  source
-
-	* sparql.sql: * Fixed function name in error message
-
-2006-04-25 23:24  source
-
-	* sparql_core.c, sparql_p.y: * Fixes for WIN64 build
-
-2006-04-25 16:44  source
-
-	* system.sql: * Added normalization of path strings of resources and results made
-	  repeatable by sorting the result.
-
-2006-04-25 16:42  source
-
-	* xmltree.c: * Fixed compiler warnings
-
-2006-04-25 16:42  source
-
-	* xslt.c: * Added sorting of vector of groups of elements
-
-2006-04-25 16:29  source
-
-	* sqlbif.c: * Simplified is<TYPE> functions
-	* Added isuname function
-
-2006-04-25 16:28  source
-
-	* sparql_core.c: * Fixed memory leak
-
-2006-04-25 16:27  source
-
-	* http.h: * Added missing include for OpenSSL 0.9.8
-
-2006-04-20 20:01  source
-
-	* CLIodbc3.c, CLIsql2.c, odbcinc.h: * Added SQL_GETLASTSERIAL to SQLGetStmtAttr
-
-2006-04-20 17:25  source
-
-	* sqlver.h: * Updated version number
-
-2006-04-20 17:24  source
-
-	* disk.c: * Fixed error message when database is opened by server with different
-	  storage magic number
-
-2006-04-20 12:07  source
-
-	* sparql.sql, xmla.sql: * Fixed security problem with XMLA and SPARQL user in new database
-
-2006-04-19 00:17  source
-
-	* CLI.h, CLIodbc3.c, CLIsql1.c, CLIsql2.c, CLIsql3.c, CLIuti.c,
-	  CLIw.c, bif_diff.c, bif_phrasematch.c, bif_soap.c, bif_text.h,
-	  ddlrun.c, disk.c, hash.c, hosting.c, http.c, lock.c, log.c,
-	  meta.c, obackup.c, rdf_core.c, replsri.c, row.c, sql3.y,
-	  sqlbif.c, sqlhash.c, sqloinv.c, sqloinx.c, sqlrun.c, sqltype.c,
-	  sqlview.c, wi_xid.c: * Fixes for building with C++ compiler
-
-2006-04-18 21:24  source
-
-	* bif_smtp.c, bif_text.c, bif_xper.c, blob.c, blobio.c, sqlbif.c,
-	  sqltype.c, srvcr.c, text.c, xmltree.c, xmltree.h, xslt.c: * Changed logic in dk_free_box() and dk_free_tree(): destructors now
-	  return a flag whether the box should be deleted or left as is.
-
-2006-04-18 21:22  source
-
-	* scn3.l, sparql.h, sparql2sql.c, sparql2sql.h, sparql2sqltext.c,
-	  sparql_core.c, sparql_l.l, sparql_p.y, sqlfn.h: * Added support for external variables in SPARQL patterns and result sets
-	* Added '#pragma prefix'
-
-2006-04-18 21:15  source
-
-	* disk.c, wi.h, wifn.h: * Replaced errcode type by int
-
-2006-04-18 01:11  source
-
-	* CLI.h: * Changed int to SQLRETURN to clarify usage of rc variable
-
-2006-04-17 22:28  source
-
-	* CLIsql1.c, CLIuti.c, xmltree.c: * Changed int to SQLRETURN to clarify usage of rc variable
-
-2006-04-17 22:24  source
-
-	* 2pc.c, CLI.h, CLIodbc3.c, CLIsql1.c, CLIsql2.c, CLIsql3.c,
-	  CLIuti.c, CLIw.c, mts_client.c: * Changed old RETCODE into ODBC 3.x SQLRETURN
-
-2006-04-17 21:57  source
-
-	* 2pc.c, CLI.h, CLIodbc3.c, CLIsql1.c, CLIsql2.c, CLIw.c: * Changed old PTR into ODBC 3.x SQLPOINTER
-
-2006-04-17 21:53  source
-
-	* 2pc.c, CLI.h, CLIcr.c, CLIodbc3.c, CLIsql1.c, CLIsql2.c,
-	  CLIsql3.c, CLIuti.c, CLIw.c, bif_xml.c, iodbcinst.c, remote.h: * Changed old SWORD/UWORD into ODBC 3.x SQLSMALLINT/SQLUSMALLINT
-
-2006-04-17 21:32  source
-
-	* sqlwords.h: * Regenerated with gperf 3.0.1
-
-2006-04-17 21:20  source
-
-	* 2pc.c, CLI.h, CLIcr.c, CLIodbc3.c, CLIsql1.c, CLIsql2.c,
-	  CLIsql3.c, CLIuti.c, CLIw.c: * Changed old UCHAR into ODBC 3.x SQLCHAR
-
-2006-04-17 20:58  source
-
-	* CLI.h, CLIcr.c, CLIodbc3.c, CLIsql1.c, CLIsql2.c, CLIsql3.c,
-	  CLIw.c, iodbcinst.c, iodbcinst.h, mts_client.c: * Removed old ODBC 2.x keyword FAR as we are no longer on 16bit platforms
-
-2006-04-17 20:50  source
-
-	* bif_file.c: * Always clear node before use
-
-2006-04-17 20:50  source
-
-	* Makefile.am: * Fixed problem in gperf rule
-
-2006-04-17 20:50  source
-
-	* sqlprt.c: * Fixed problem with possible memory overlap
-
-2006-04-17 20:50  source
-
-	* 2pc.c, 2pc.h, 2pc_client.c, 2pc_client.h, CLI.h, CLIcr.c,
-	  CLIodbc3.c, CLIsql1.c, CLIsql2.c, CLIsql3.c, CLIuti.c, CLIw.c,
-	  bif_xml.c, mts_client.c, remote.h, sqlrrun.c, sqlwords.h: * Changed old HENV/HDBC/HSTMT into ODBC 3.x SQLHENV, SQLHDBC and SQLHSTMT
-
-2006-04-13 20:26  source
-
-	* plugin_loader.c, sqlsrv.c: * Fixes for building and testing on Windows platform
-
-2006-04-13 20:08  source
-
-	* xpathp_impl.h: * Basic support for passing parameters into SPARQL query.
-
-2006-04-13 20:07  source
-
-	* sqlbif.c: * flush the client connection before exit in raw_exit so that a possible
-	  error result set is shown before the disconnect
-
-2006-04-13 20:06  source
-
-	* xmla.sql: * Merged latest xmla code
-
-2006-04-13 19:56  source
-
-	* scn3.l, sparql.h, sparql.sql, sparql2sql.c, sparql2sql.h,
-	  sparql2sqltext.c, sparql_core.c, sparql_l.l, sparql_p.y, sqlfn.h: * Merged latest version of sparql/rdf
-
-2006-04-13 19:45  source
-
-	* numeric.c: * Fixed double to number conversion problem on BSD and Apple
-
-2006-04-13 19:43  source
-
-	* CLIodbc3.c: * Added missing SQLCloseCursor function
-
-2006-04-11 19:56  source
-
-	* .cvsignore, 2pc.c, 2pc.h, 2pc.sql, 2pc_client.c, 2pc_client.h,
-	  CLI.h, CLIcr.c, CLIodbc3.c, CLIsql1.c, CLIsql2.c, CLIsql3.c,
-	  CLIsql3W.c, CLIuti.c, CLIw.c, Makefile.am, arith.c, arith.h,
-	  autoexec.sql, auxfiles.c, bif_crypto.c, bif_date.c, bif_dav.c,
-	  bif_diff.c, bif_explain.c, bif_file.c, bif_gnw.c, bif_intl.c,
-	  bif_kerberoscli.c, bif_ldapcli.c, bif_mts.c, bif_nntp.c,
-	  bif_phrasematch.c, bif_pop3.c, bif_purify.c, bif_regexp.c,
-	  bif_repl.c, bif_smtp.c, bif_soap.c, bif_text.c, bif_text.h,
-	  bif_tidy.c, bif_uuencode.c, bif_xml.c, bif_xper.c, bif_xper.h,
-	  blob.c, blobio.c, blobio.h, blog.xsl, cov_report.xsl,
-	  cov_time.xsl, crsr.h, crypt.c, date.h, datesupp.c, datesupp.h,
-	  ddlrun.c, disk.c, dks_esc.c, eqlcomp.c, eqlcomp.h, ftp.sql,
-	  gate.c, hash.c, hosting.c, hosting.h, hosting.sql, http.c,
-	  http.h, http_auth.sql, http_client.c, http_client.h,
-	  information_schema.sql, insert.c, inxop.c, iodbcinst.c,
-	  iodbcinst.h, ksrvext.h, ksrvextphp.h, lisprdr.c, lisprdr.h,
-	  list2.h, list_lex_props.sh, lock.c, log.c, log.h, ltrx.h,
-	  mail_cli.sql, map_schema.c, map_schema.h, meta.c, msdtc.h, mts.h,
-	  mts_client.c, mts_client.h, mts_com.cpp, mts_com.h, mtwrite.c,
-	  mtx.cpp, multibyte.c, multibyte.h, name.c, neodisk.c, nn_svr.sql,
-	  numeric.c, numeric.h, obackup.c, odbccat.c, odbccat.sql,
-	  odbcinc.h, oledb.sql, openxml.sql, pldbgcli.c, pldebug.c,
-	  pldebug.h, plugin_gate.c, plugin_loader.c, pop3_svr.sql,
-	  rdf_core.c, rdf_core.h, recovery.c, recovery.h, regist.c,
-	  remote.h, rendezvous.c, rendezvous.h, repl.h, repl.sql, repldb.c,
-	  replddk.sql, replpush.c, replsr.h, replsri.c, replsub.c, rltrx.c,
-	  row.c, schspace.c, schspace.h, scn3.l, search.c, security.c,
-	  security.h, sha.h, shuric.c, shuric.h, snapshot_repl.sql, soap.h,
-	  soap.sql, soap12_router.xsl, soap_import_sch.xsl, soap_sch.xsl,
-	  soap_xmlrpc.xsl, sort.c, space.c, sparql.h, sparql.sql,
-	  sparql2sql.c, sparql2sql.h, sparql2sqltext.c, sparql_core.c,
-	  sparql_l.l, sparql_p.y, sql3.y, sql3_vc.c, sql_code_blog.c,
-	  sql_code_cache_impl.c, sql_to_c.awk, sqlbif.c, sqlbif.h,
-	  sqlbif2.c, sqlcmps.h, sqlcomp.c, sqlcomp.h, sqlcomp2.c,
-	  sqlcost.c, sqlcr.c, sqlcstate.h, sqldf.c, sqlexp.c, sqlfn.h,
-	  sqlgen.c, sqlhash.c, sqlintrp.c, sqlintrp.h, sqlnode.h, sqlo.c,
-	  sqlo.h, sqloby.c, sqlocr.c, sqlocr.h, sqlofn.h, sqloinv.c,
-	  sqloinv.h, sqloinx.c, sqlopcod.h, sqloprt.c, sqlorder.c,
-	  sqlovdb.c, sqlpar.h, sqlparext.h, sqlpfn.c, sqlpfn.h, sqlprocc.c,
-	  sqlprt.c, sqlrbuf.c, sqlrcomp.c, sqlrcomp.h, sqlrrun.c, sqlrun.c,
-	  sqlsrv.c, sqlstmts.c, sqltrig.c, sqltype.c, sqltype.h,
-	  sqltype_c.h, sqlver.c, sqlver.h, sqlview.c, sqlwords.gperf,
-	  sqlwords.h, srvcr.c, srvmultibyte.c, srvmultibyte.h, srvstat.c,
-	  srvstat.h, ssl.c, statuslog.h, string.c, string_tmpl.c,
-	  strlike.h, subseq.c, subseq.h, system.sql, system2.sql, text.c,
-	  text.h, turtle_l.l, turtle_p.y, uddi.sql, update.c, useraggr.sql,
-	  users.sql, uuencode.c, uuencode_impl.h, vdb.sql, virtext.h,
-	  virtpwd.h, virtual_dir.sql, vt_text.sql, wi.h, wi_xid.c,
-	  wi_xid.h, widd.h, widisk.h, widv.h, wifn.h, wirpc.c, wirpce.h,
-	  wiservic.c, wiservic.h, wsdl_expand.xsl, wsdl_import.xsl,
-	  wsdl_parts.xsl, wsrp_error.xsl, wsrp_interm.xsl, wsrp_resp.xsl,
-	  wsrp_ultim.xsl, xml.h, xml_a.sql, xml_view.sql, xmla.sql,
-	  xmlenc-dec.c, xmlenc.c, xmlenc.h, xmlenc_algos.c, xmlenc_algos.h,
-	  xmlenc_test.h, xmlgen.h, xmlnode.h, xmlres.h, xmlrpc_soap.xsl,
-	  xmlschema.c, xmlsearch.c, xmlsql.c, xmltree.c, xmltree.h,
-	  xpath.c, xpath.h, xpathp.y, xpathp_impl.h, xpf.c, xpf.h, xpscn.l,
-	  xqf.c, xqf.h, xslt.c, xslt_fmt.c, xslt_impl.h, xslt_opt.c: Initial release of Virtuoso Open Source Edition
-
-2006-04-11 19:56  source
-
-	* .cvsignore, 2pc.c, 2pc.h, 2pc.sql, 2pc_client.c, 2pc_client.h,
-	  CLI.h, CLIcr.c, CLIodbc3.c, CLIsql1.c, CLIsql2.c, CLIsql3.c,
-	  CLIsql3W.c, CLIuti.c, CLIw.c, Makefile.am, arith.c, arith.h,
-	  autoexec.sql, auxfiles.c, bif_crypto.c, bif_date.c, bif_dav.c,
-	  bif_diff.c, bif_explain.c, bif_file.c, bif_gnw.c, bif_intl.c,
-	  bif_kerberoscli.c, bif_ldapcli.c, bif_mts.c, bif_nntp.c,
-	  bif_phrasematch.c, bif_pop3.c, bif_purify.c, bif_regexp.c,
-	  bif_repl.c, bif_smtp.c, bif_soap.c, bif_text.c, bif_text.h,
-	  bif_tidy.c, bif_uuencode.c, bif_xml.c, bif_xper.c, bif_xper.h,
-	  blob.c, blobio.c, blobio.h, blog.xsl, cov_report.xsl,
-	  cov_time.xsl, crsr.h, crypt.c, date.h, datesupp.c, datesupp.h,
-	  ddlrun.c, disk.c, dks_esc.c, eqlcomp.c, eqlcomp.h, ftp.sql,
-	  gate.c, hash.c, hosting.c, hosting.h, hosting.sql, http.c,
-	  http.h, http_auth.sql, http_client.c, http_client.h,
-	  information_schema.sql, insert.c, inxop.c, iodbcinst.c,
-	  iodbcinst.h, ksrvext.h, ksrvextphp.h, lisprdr.c, lisprdr.h,
-	  list2.h, list_lex_props.sh, lock.c, log.c, log.h, ltrx.h,
-	  mail_cli.sql, map_schema.c, map_schema.h, meta.c, msdtc.h, mts.h,
-	  mts_client.c, mts_client.h, mts_com.cpp, mts_com.h, mtwrite.c,
-	  mtx.cpp, multibyte.c, multibyte.h, name.c, neodisk.c, nn_svr.sql,
-	  numeric.c, numeric.h, obackup.c, odbccat.c, odbccat.sql,
-	  odbcinc.h, oledb.sql, openxml.sql, pldbgcli.c, pldebug.c,
-	  pldebug.h, plugin_gate.c, plugin_loader.c, pop3_svr.sql,
-	  rdf_core.c, rdf_core.h, recovery.c, recovery.h, regist.c,
-	  remote.h, rendezvous.c, rendezvous.h, repl.h, repl.sql, repldb.c,
-	  replddk.sql, replpush.c, replsr.h, replsri.c, replsub.c, rltrx.c,
-	  row.c, schspace.c, schspace.h, scn3.l, search.c, security.c,
-	  security.h, sha.h, shuric.c, shuric.h, snapshot_repl.sql, soap.h,
-	  soap.sql, soap12_router.xsl, soap_import_sch.xsl, soap_sch.xsl,
-	  soap_xmlrpc.xsl, sort.c, space.c, sparql.h, sparql.sql,
-	  sparql2sql.c, sparql2sql.h, sparql2sqltext.c, sparql_core.c,
-	  sparql_l.l, sparql_p.y, sql3.y, sql3_vc.c, sql_code_blog.c,
-	  sql_code_cache_impl.c, sql_to_c.awk, sqlbif.c, sqlbif.h,
-	  sqlbif2.c, sqlcmps.h, sqlcomp.c, sqlcomp.h, sqlcomp2.c,
-	  sqlcost.c, sqlcr.c, sqlcstate.h, sqldf.c, sqlexp.c, sqlfn.h,
-	  sqlgen.c, sqlhash.c, sqlintrp.c, sqlintrp.h, sqlnode.h, sqlo.c,
-	  sqlo.h, sqloby.c, sqlocr.c, sqlocr.h, sqlofn.h, sqloinv.c,
-	  sqloinv.h, sqloinx.c, sqlopcod.h, sqloprt.c, sqlorder.c,
-	  sqlovdb.c, sqlpar.h, sqlparext.h, sqlpfn.c, sqlpfn.h, sqlprocc.c,
-	  sqlprt.c, sqlrbuf.c, sqlrcomp.c, sqlrcomp.h, sqlrrun.c, sqlrun.c,
-	  sqlsrv.c, sqlstmts.c, sqltrig.c, sqltype.c, sqltype.h,
-	  sqltype_c.h, sqlver.c, sqlver.h, sqlview.c, sqlwords.gperf,
-	  sqlwords.h, srvcr.c, srvmultibyte.c, srvmultibyte.h, srvstat.c,
-	  srvstat.h, ssl.c, statuslog.h, string.c, string_tmpl.c,
-	  strlike.h, subseq.c, subseq.h, system.sql, system2.sql, text.c,
-	  text.h, turtle_l.l, turtle_p.y, uddi.sql, update.c, useraggr.sql,
-	  users.sql, uuencode.c, uuencode_impl.h, vdb.sql, virtext.h,
-	  virtpwd.h, virtual_dir.sql, vt_text.sql, wi.h, wi_xid.c,
-	  wi_xid.h, widd.h, widisk.h, widv.h, wifn.h, wirpc.c, wirpce.h,
-	  wiservic.c, wiservic.h, wsdl_expand.xsl, wsdl_import.xsl,
-	  wsdl_parts.xsl, wsrp_error.xsl, wsrp_interm.xsl, wsrp_resp.xsl,
-	  wsrp_ultim.xsl, xml.h, xml_a.sql, xml_view.sql, xmla.sql,
-	  xmlenc-dec.c, xmlenc.c, xmlenc.h, xmlenc_algos.c, xmlenc_algos.h,
-	  xmlenc_test.h, xmlgen.h, xmlnode.h, xmlres.h, xmlrpc_soap.xsl,
-	  xmlschema.c, xmlsearch.c, xmlsql.c, xmltree.c, xmltree.h,
-	  xpath.c, xpath.h, xpathp.y, xpathp_impl.h, xpf.c, xpf.h, xpscn.l,
-	  xqf.c, xqf.h, xslt.c, xslt_fmt.c, xslt_impl.h, xslt_opt.c: Initial revision
-
diff --git a/libsrc/Wi/Makefile.am b/libsrc/Wi/Makefile.am
index 4456215..0d20c0e 100644
--- a/libsrc/Wi/Makefile.am
+++ b/libsrc/Wi/Makefile.am
@@ -32,7 +32,7 @@ if WITH_KERBEROS
 endif
 
 if WITH_IMSG
-    IMSG_BIF= bif_pop3.c bif_nntp.c
+    IMSG_BIF= bif_pop3.c bif_imap.c bif_nntp.c
 endif
 
 if WITH_PLDEBUG
@@ -61,7 +61,7 @@ noinst_HEADERS = \
 	wiservic.h wi_xid.h xmlenc_algos.h xmlenc.h xmlenc_test.h xmlgen.h \
 	xml.h xmlnode.h xmlres.h xmltree.h xpath.h xpathp.h xpathp_impl.h \
 	xpf.h xqf.h xslt_impl.h aqueue.h rdf_mapping_jso.h bitmap.h jso.h \
-	json_p.h bif_audio_tags.h shcompo.h cluster.h extent.h
+	json_p.h bif_audio_tags.h shcompo.h cluster.h extent.h uname_const_decl.h
 
 
 generated_code = \
@@ -129,6 +129,7 @@ C_FILES_SPARQL	= \
 	sparql_qm.c \
 	sparql_sff.c \
 	sparql_tree.c \
+	sparql_rdb2rdf.c \
 	sparul2sql.c \
 	sql_code_sparql.c \
 	turtle_l.c \
@@ -369,19 +370,6 @@ libwi_odbc_la_SOURCES = \
 	xpscn.c \
 	$(C_FILES_SPARQL)
 
-#KUBL_REPL_FILES
-libwi_la_SOURCES += \
-	repldb.c \
-	replsri.c \
-	replsub.c \
-	replpush.c
-
-libwi_odbc_la_SOURCES += \
-	repldb.c \
-	replsri.c \
-	replsub.c \
-	replpush.c
-
 libwi_la_SOURCES += \
 	$(PLDEBUG_FILES)
 
@@ -403,6 +391,7 @@ libwi_la_SOURCES += \
 	shuric.c \
 	subseq.c \
 	text.c \
+	uname_const_decl.c \
 	xmlenc_algos.c \
 	xmlenc.c \
 	xmlenc-dec.c \
@@ -435,6 +424,7 @@ libwi_odbc_la_SOURCES += \
 	shuric.c \
 	subseq.c \
 	text.c \
+	uname_const_decl.c \
 	xmlenc_algos.c \
 	xmlenc.c \
 	xmlenc-dec.c \
@@ -580,6 +570,7 @@ SQL_FILES_DAV		= \
 	$(top_srcdir)/binsrc/dav/DET_PropFilter.sql \
 	$(top_srcdir)/binsrc/dav/DET_RDFData.sql \
 	$(top_srcdir)/binsrc/dav/DET_S3.sql \
+	$(top_srcdir)/binsrc/dav/DET_DynaRes.sql \
 	$(top_srcdir)/binsrc/dav/Versioning/DET_Versioning.sql \
 	$(srcdir)/xml_view.sql
 
@@ -623,7 +614,8 @@ SQL_FILES_SPARQL	= \
 	$(srcdir)/sparql_io.sql \
 	$(srcdir)/rdf_sponge.sql \
 	$(srcdir)/rdf_schema_objects.sql \
-	$(srcdir)/rdf_void.sql
+	$(srcdir)/rdf_void.sql \
+	$(srcdir)/rdflddir2.sql
 
 SQL_FILES_SYS 		= \
 	$(srcdir)/users.sql
@@ -667,6 +659,7 @@ SQL_FILES_WS		= \
 	$(top_srcdir)/binsrc/ws/wsrm/wsrmcall.xsl \
 	$(srcdir)/rdf_net.sql \
 	$(srcdir)/simile.sql \
+	$(srcdir)/xrd2json.xsl \
 	$(srcdir)/http_auth.sql \
 	$(srcdir)/xmla.sql \
 	$(srcdir)/openxml.sql \
diff --git a/libsrc/Wi/Makefile.in b/libsrc/Wi/Makefile.in
index 0a9788c..a764d0c 100644
--- a/libsrc/Wi/Makefile.in
+++ b/libsrc/Wi/Makefile.in
@@ -58,7 +58,7 @@ build_triplet = @build@
 host_triplet = @host@
 subdir = libsrc/Wi
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in ChangeLog
+	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/binsrc/config/libtool.m4 \
 	$(top_srcdir)/binsrc/config/libxml.m4 \
@@ -100,16 +100,15 @@ am__libwi_la_SOURCES_DIST = aqueue.c arith.c auxfiles.c bif_audio.c \
 	rdf_mapping_jso.c rdfxml_parser.c nquad_p.c nquad_p.h \
 	sparql2sql.c sparql2sqltext.c sparqld.c sparql_core.c \
 	sparql_l.c sparql_p.c sparql_qm.c sparql_sff.c sparql_tree.c \
-	sparul2sql.c turtle_l.c turtle_p.c repldb.c replsri.c \
-	replsub.c replpush.c pldebug.c bif_date.c bif_dav.c \
-	bif_explain.c bif_file.c bif_phrasematch.c bif_smtp.c \
-	bif_soap.c bif_text.c bif_tidy.c http_client.c shuric.c \
-	subseq.c text.c xmlenc_algos.c xmlenc.c xmlenc-dec.c \
-	xmlschema.c xmlsearch.c xmlsql.c xmllazy.c xmltree.c xpath.c \
-	xpf.c xqf.c xslt.c xslt_fmt.c xslt_opt.c bif_ldapcli.c \
-	bif_kerberoscli.c bif_pop3.c bif_nntp.c bif_xper.c 2pc.c \
-	bif_repl.c bif_xml.c odbccat.c sqlrbuf.c sqlrcomp.c sqlrrun.c \
-	wi_xid.c
+	sparql_rdb2rdf.c sparul2sql.c turtle_l.c turtle_p.c pldebug.c \
+	bif_date.c bif_dav.c bif_explain.c bif_file.c \
+	bif_phrasematch.c bif_smtp.c bif_soap.c bif_text.c bif_tidy.c \
+	http_client.c shuric.c subseq.c text.c uname_const_decl.c \
+	xmlenc_algos.c xmlenc.c xmlenc-dec.c xmlschema.c xmlsearch.c \
+	xmlsql.c xmllazy.c xmltree.c xpath.c xpf.c xqf.c xslt.c \
+	xslt_fmt.c xslt_opt.c bif_ldapcli.c bif_kerberoscli.c \
+	bif_pop3.c bif_imap.c bif_nntp.c bif_xper.c 2pc.c bif_repl.c \
+	bif_xml.c odbccat.c sqlrbuf.c sqlrcomp.c sqlrrun.c wi_xid.c
 am__objects_1 = libwi_la-jso.lo libwi_la-rdfbox.lo \
 	libwi_la-rdf_core.lo libwi_la-rdfinf.lo \
 	libwi_la-rdf_mapping_jso.lo libwi_la-rdfxml_parser.lo \
@@ -118,13 +117,14 @@ am__objects_1 = libwi_la-jso.lo libwi_la-rdfbox.lo \
 	libwi_la-sparql_core.lo libwi_la-sparql_l.lo \
 	libwi_la-sparql_p.lo libwi_la-sparql_qm.lo \
 	libwi_la-sparql_sff.lo libwi_la-sparql_tree.lo \
-	libwi_la-sparul2sql.lo libwi_la-sql_code_sparql.lo \
-	libwi_la-turtle_l.lo libwi_la-turtle_p.lo
+	libwi_la-sparql_rdb2rdf.lo libwi_la-sparul2sql.lo \
+	libwi_la-sql_code_sparql.lo libwi_la-turtle_l.lo \
+	libwi_la-turtle_p.lo
 @WITH_PLDEBUG_TRUE at am__objects_2 = libwi_la-pldebug.lo
 @WITH_LDAP_TRUE at am__objects_3 = libwi_la-bif_ldapcli.lo
 @WITH_KERBEROS_TRUE at am__objects_4 = libwi_la-bif_kerberoscli.lo
 @WITH_IMSG_TRUE at am__objects_5 = libwi_la-bif_pop3.lo \
- at WITH_IMSG_TRUE@	libwi_la-bif_nntp.lo
+ at WITH_IMSG_TRUE@	libwi_la-bif_imap.lo libwi_la-bif_nntp.lo
 am_libwi_la_OBJECTS = libwi_la-aqueue.lo libwi_la-arith.lo \
 	libwi_la-auxfiles.lo libwi_la-bif_audio.lo \
 	libwi_la-bif_crypto.lo libwi_la-bif_diff.lo \
@@ -168,13 +168,12 @@ am_libwi_la_OBJECTS = libwi_la-aqueue.lo libwi_la-arith.lo \
 	libwi_la-string.lo libwi_la-trans.lo libwi_la-update.lo \
 	libwi_la-uuencode.lo libwi_la-wirpc.lo libwi_la-wiservic.lo \
 	libwi_la-xpathp.lo libwi_la-xpscn.lo $(am__objects_1) \
-	libwi_la-repldb.lo libwi_la-replsri.lo libwi_la-replsub.lo \
-	libwi_la-replpush.lo $(am__objects_2) libwi_la-bif_date.lo \
-	libwi_la-bif_dav.lo libwi_la-bif_explain.lo \
-	libwi_la-bif_file.lo libwi_la-bif_phrasematch.lo \
-	libwi_la-bif_smtp.lo libwi_la-bif_soap.lo libwi_la-bif_text.lo \
-	libwi_la-bif_tidy.lo libwi_la-http_client.lo \
-	libwi_la-shuric.lo libwi_la-subseq.lo libwi_la-text.lo \
+	$(am__objects_2) libwi_la-bif_date.lo libwi_la-bif_dav.lo \
+	libwi_la-bif_explain.lo libwi_la-bif_file.lo \
+	libwi_la-bif_phrasematch.lo libwi_la-bif_smtp.lo \
+	libwi_la-bif_soap.lo libwi_la-bif_text.lo libwi_la-bif_tidy.lo \
+	libwi_la-http_client.lo libwi_la-shuric.lo libwi_la-subseq.lo \
+	libwi_la-text.lo libwi_la-uname_const_decl.lo \
 	libwi_la-xmlenc_algos.lo libwi_la-xmlenc.lo \
 	libwi_la-xmlenc-dec.lo libwi_la-xmlschema.lo \
 	libwi_la-xmlsearch.lo libwi_la-xmlsql.lo libwi_la-xmllazy.lo \
@@ -215,16 +214,15 @@ am__libwi_odbc_la_SOURCES_DIST = aqueue.c arith.c auxfiles.c \
 	rdf_mapping_jso.c rdfxml_parser.c nquad_p.c nquad_p.h \
 	sparql2sql.c sparql2sqltext.c sparqld.c sparql_core.c \
 	sparql_l.c sparql_p.c sparql_qm.c sparql_sff.c sparql_tree.c \
-	sparul2sql.c turtle_l.c turtle_p.c repldb.c replsri.c \
-	replsub.c replpush.c pldebug.c bif_date.c bif_dav.c \
-	bif_explain.c bif_file.c bif_phrasematch.c bif_smtp.c \
-	bif_soap.c bif_text.c bif_tidy.c http_client.c shuric.c \
-	subseq.c text.c xmlenc_algos.c xmlenc.c xmlenc-dec.c \
-	xmlschema.c xmlsearch.c xmlsql.c xmllazy.c xmltree.c xpath.c \
-	xpf.c xqf.c xslt.c xslt_fmt.c xslt_opt.c bif_ldapcli.c \
-	bif_kerberoscli.c bif_pop3.c bif_nntp.c bif_xper.c 2pc.c \
-	bif_repl.c bif_xml.c odbccat.c sqlrbuf.c sqlrcomp.c sqlrrun.c \
-	wi_xid.c
+	sparql_rdb2rdf.c sparul2sql.c turtle_l.c turtle_p.c pldebug.c \
+	bif_date.c bif_dav.c bif_explain.c bif_file.c \
+	bif_phrasematch.c bif_smtp.c bif_soap.c bif_text.c bif_tidy.c \
+	http_client.c shuric.c subseq.c text.c uname_const_decl.c \
+	xmlenc_algos.c xmlenc.c xmlenc-dec.c xmlschema.c xmlsearch.c \
+	xmlsql.c xmllazy.c xmltree.c xpath.c xpf.c xqf.c xslt.c \
+	xslt_fmt.c xslt_opt.c bif_ldapcli.c bif_kerberoscli.c \
+	bif_pop3.c bif_imap.c bif_nntp.c bif_xper.c 2pc.c bif_repl.c \
+	bif_xml.c odbccat.c sqlrbuf.c sqlrcomp.c sqlrrun.c wi_xid.c
 am__objects_6 = libwi_odbc_la-jso.lo libwi_odbc_la-rdfbox.lo \
 	libwi_odbc_la-rdf_core.lo libwi_odbc_la-rdfinf.lo \
 	libwi_odbc_la-rdf_mapping_jso.lo \
@@ -233,13 +231,14 @@ am__objects_6 = libwi_odbc_la-jso.lo libwi_odbc_la-rdfbox.lo \
 	libwi_odbc_la-sparqld.lo libwi_odbc_la-sparql_core.lo \
 	libwi_odbc_la-sparql_l.lo libwi_odbc_la-sparql_p.lo \
 	libwi_odbc_la-sparql_qm.lo libwi_odbc_la-sparql_sff.lo \
-	libwi_odbc_la-sparql_tree.lo libwi_odbc_la-sparul2sql.lo \
-	libwi_odbc_la-sql_code_sparql.lo libwi_odbc_la-turtle_l.lo \
-	libwi_odbc_la-turtle_p.lo
+	libwi_odbc_la-sparql_tree.lo libwi_odbc_la-sparql_rdb2rdf.lo \
+	libwi_odbc_la-sparul2sql.lo libwi_odbc_la-sql_code_sparql.lo \
+	libwi_odbc_la-turtle_l.lo libwi_odbc_la-turtle_p.lo
 @WITH_PLDEBUG_TRUE at am__objects_7 = libwi_odbc_la-pldebug.lo
 @WITH_LDAP_TRUE at am__objects_8 = libwi_odbc_la-bif_ldapcli.lo
 @WITH_KERBEROS_TRUE at am__objects_9 = libwi_odbc_la-bif_kerberoscli.lo
 @WITH_IMSG_TRUE at am__objects_10 = libwi_odbc_la-bif_pop3.lo \
+ at WITH_IMSG_TRUE@	libwi_odbc_la-bif_imap.lo \
 @WITH_IMSG_TRUE@	libwi_odbc_la-bif_nntp.lo
 am_libwi_odbc_la_OBJECTS = libwi_odbc_la-aqueue.lo \
 	libwi_odbc_la-arith.lo libwi_odbc_la-auxfiles.lo \
@@ -298,16 +297,14 @@ am_libwi_odbc_la_OBJECTS = libwi_odbc_la-aqueue.lo \
 	libwi_odbc_la-trans.lo libwi_odbc_la-update.lo \
 	libwi_odbc_la-uuencode.lo libwi_odbc_la-wirpc.lo \
 	libwi_odbc_la-wiservic.lo libwi_odbc_la-xpathp.lo \
-	libwi_odbc_la-xpscn.lo $(am__objects_6) \
-	libwi_odbc_la-repldb.lo libwi_odbc_la-replsri.lo \
-	libwi_odbc_la-replsub.lo libwi_odbc_la-replpush.lo \
-	$(am__objects_7) libwi_odbc_la-bif_date.lo \
-	libwi_odbc_la-bif_dav.lo libwi_odbc_la-bif_explain.lo \
-	libwi_odbc_la-bif_file.lo libwi_odbc_la-bif_phrasematch.lo \
-	libwi_odbc_la-bif_smtp.lo libwi_odbc_la-bif_soap.lo \
-	libwi_odbc_la-bif_text.lo libwi_odbc_la-bif_tidy.lo \
-	libwi_odbc_la-http_client.lo libwi_odbc_la-shuric.lo \
-	libwi_odbc_la-subseq.lo libwi_odbc_la-text.lo \
+	libwi_odbc_la-xpscn.lo $(am__objects_6) $(am__objects_7) \
+	libwi_odbc_la-bif_date.lo libwi_odbc_la-bif_dav.lo \
+	libwi_odbc_la-bif_explain.lo libwi_odbc_la-bif_file.lo \
+	libwi_odbc_la-bif_phrasematch.lo libwi_odbc_la-bif_smtp.lo \
+	libwi_odbc_la-bif_soap.lo libwi_odbc_la-bif_text.lo \
+	libwi_odbc_la-bif_tidy.lo libwi_odbc_la-http_client.lo \
+	libwi_odbc_la-shuric.lo libwi_odbc_la-subseq.lo \
+	libwi_odbc_la-text.lo libwi_odbc_la-uname_const_decl.lo \
 	libwi_odbc_la-xmlenc_algos.lo libwi_odbc_la-xmlenc.lo \
 	libwi_odbc_la-xmlenc-dec.lo libwi_odbc_la-xmlschema.lo \
 	libwi_odbc_la-xmlsearch.lo libwi_odbc_la-xmlsql.lo \
@@ -451,6 +448,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
@@ -562,7 +560,7 @@ vaddir = @vaddir@
 @WITH_IODBC_TRUE at IODBC_LIBS = libwi_odbc.la
 @WITH_LDAP_TRUE at LDAP_BIF = bif_ldapcli.c
 @WITH_KERBEROS_TRUE at KRB_BIF = bif_kerberoscli.c
- at WITH_IMSG_TRUE@IMSG_BIF = bif_pop3.c bif_nntp.c
+ at WITH_IMSG_TRUE@IMSG_BIF = bif_pop3.c bif_imap.c bif_nntp.c
 @WITH_PLDEBUG_TRUE at PLDEBUG_FILES = pldebug.c
 @WITH_PLDEBUG_TRUE at PLDEBUG_CLI_FILES = pldbgcli.c
 GEN = $(SHELL) ${top_srcdir}/bin/generate
@@ -583,7 +581,7 @@ noinst_HEADERS = \
 	wiservic.h wi_xid.h xmlenc_algos.h xmlenc.h xmlenc_test.h xmlgen.h \
 	xml.h xmlnode.h xmlres.h xmltree.h xpath.h xpathp.h xpathp_impl.h \
 	xpf.h xqf.h xslt_impl.h aqueue.h rdf_mapping_jso.h bitmap.h jso.h \
-	json_p.h bif_audio_tags.h shcompo.h cluster.h extent.h
+	json_p.h bif_audio_tags.h shcompo.h cluster.h extent.h uname_const_decl.h
 
 generated_code = \
 	json_l.c \
@@ -649,14 +647,13 @@ C_FILES_SPARQL = \
 	sparql_qm.c \
 	sparql_sff.c \
 	sparql_tree.c \
+	sparql_rdb2rdf.c \
 	sparul2sql.c \
 	sql_code_sparql.c \
 	turtle_l.c \
 	turtle_p.c
 
 
-#KUBL_REPL_FILES
-
 #BIF_FILES
 
 #BIF_XPER
@@ -683,16 +680,15 @@ libwi_la_SOURCES = aqueue.c arith.c auxfiles.c bif_audio.c \
 	sqlprocc.c sqlprt.c sqlrun.c sqlsrv.c sqlstmts.c sqltrig.c \
 	sqltype.c sqlver.c sqlview.c srvcr.c srvmultibyte.c srvstat.c \
 	string.c trans.c update.c uuencode.c wirpc.c wiservic.c \
-	xpathp.c xpscn.c $(C_FILES_SPARQL) repldb.c replsri.c \
-	replsub.c replpush.c $(PLDEBUG_FILES) bif_date.c bif_dav.c \
-	bif_explain.c bif_file.c bif_phrasematch.c bif_smtp.c \
-	bif_soap.c bif_text.c bif_tidy.c http_client.c shuric.c \
-	subseq.c text.c xmlenc_algos.c xmlenc.c xmlenc-dec.c \
-	xmlschema.c xmlsearch.c xmlsql.c xmllazy.c xmltree.c xpath.c \
-	xpf.c xqf.c xslt.c xslt_fmt.c xslt_opt.c $(LDAP_BIF) \
-	$(KRB_BIF) $(IMSG_BIF) bif_xper.c 2pc.c bif_repl.c bif_xml.c \
-	odbccat.c sqlrbuf.c sqlrcomp.c sqlrrun.c wi_xid.c \
-	$(libwi_base_la_sources)
+	xpathp.c xpscn.c $(C_FILES_SPARQL) $(PLDEBUG_FILES) bif_date.c \
+	bif_dav.c bif_explain.c bif_file.c bif_phrasematch.c \
+	bif_smtp.c bif_soap.c bif_text.c bif_tidy.c http_client.c \
+	shuric.c subseq.c text.c uname_const_decl.c xmlenc_algos.c \
+	xmlenc.c xmlenc-dec.c xmlschema.c xmlsearch.c xmlsql.c \
+	xmllazy.c xmltree.c xpath.c xpf.c xqf.c xslt.c xslt_fmt.c \
+	xslt_opt.c $(LDAP_BIF) $(KRB_BIF) $(IMSG_BIF) bif_xper.c 2pc.c \
+	bif_repl.c bif_xml.c odbccat.c sqlrbuf.c sqlrcomp.c sqlrrun.c \
+	wi_xid.c $(libwi_base_la_sources)
 
 #KUBL_UNIV_FILES_ODBC
 libwi_odbc_la_SOURCES = aqueue.c arith.c auxfiles.c bif_audio.c \
@@ -716,15 +712,15 @@ libwi_odbc_la_SOURCES = aqueue.c arith.c auxfiles.c bif_audio.c \
 	sqlprocc.c sqlprt.c sqlrun.c sqlsrv.c sqlstmts.c sqltrig.c \
 	sqltype.c sqlver.c sqlview.c srvcr.c srvmultibyte.c srvstat.c \
 	string.c trans.c update.c uuencode.c wirpc.c wiservic.c \
-	xpathp.c xpscn.c $(C_FILES_SPARQL) repldb.c replsri.c \
-	replsub.c replpush.c $(PLDEBUG_FILES) bif_date.c bif_dav.c \
-	bif_explain.c bif_file.c bif_phrasematch.c bif_smtp.c \
-	bif_soap.c bif_text.c bif_tidy.c http_client.c shuric.c \
-	subseq.c text.c xmlenc_algos.c xmlenc.c xmlenc-dec.c \
-	xmlschema.c xmlsearch.c xmlsql.c xmllazy.c xmltree.c xpath.c \
-	xpathp.c xpf.c xqf.c xslt.c xslt_fmt.c xslt_opt.c $(LDAP_BIF) \
-	$(KRB_BIF) $(IMSG_BIF) bif_xper.c 2pc.c bif_repl.c bif_xml.c \
-	odbccat.c sqlrbuf.c sqlrcomp.c sqlrrun.c wi_xid.c
+	xpathp.c xpscn.c $(C_FILES_SPARQL) $(PLDEBUG_FILES) bif_date.c \
+	bif_dav.c bif_explain.c bif_file.c bif_phrasematch.c \
+	bif_smtp.c bif_soap.c bif_text.c bif_tidy.c http_client.c \
+	shuric.c subseq.c text.c uname_const_decl.c xmlenc_algos.c \
+	xmlenc.c xmlenc-dec.c xmlschema.c xmlsearch.c xmlsql.c \
+	xmllazy.c xmltree.c xpath.c xpathp.c xpf.c xqf.c xslt.c \
+	xslt_fmt.c xslt_opt.c $(LDAP_BIF) $(KRB_BIF) $(IMSG_BIF) \
+	bif_xper.c 2pc.c bif_repl.c bif_xml.c odbccat.c sqlrbuf.c \
+	sqlrcomp.c sqlrrun.c wi_xid.c
 libwi_base_la_cflags = @VIRT_AM_CFLAGS@ -I$(top_srcdir)/libsrc \
 	-I$(top_srcdir)/libsrc/Dk @ZLIB_INC@ -I$(srcdir) \
 	-I$(top_srcdir)/libsrc/langfunc -I$(top_srcdir)/libsrc/plugin \
@@ -791,6 +787,7 @@ SQL_FILES_DAV = \
 	$(top_srcdir)/binsrc/dav/DET_PropFilter.sql \
 	$(top_srcdir)/binsrc/dav/DET_RDFData.sql \
 	$(top_srcdir)/binsrc/dav/DET_S3.sql \
+	$(top_srcdir)/binsrc/dav/DET_DynaRes.sql \
 	$(top_srcdir)/binsrc/dav/Versioning/DET_Versioning.sql \
 	$(srcdir)/xml_view.sql
 
@@ -832,7 +829,8 @@ SQL_FILES_SPARQL = \
 	$(srcdir)/sparql_io.sql \
 	$(srcdir)/rdf_sponge.sql \
 	$(srcdir)/rdf_schema_objects.sql \
-	$(srcdir)/rdf_void.sql
+	$(srcdir)/rdf_void.sql \
+	$(srcdir)/rdflddir2.sql
 
 SQL_FILES_SYS = \
 	$(srcdir)/users.sql
@@ -876,6 +874,7 @@ SQL_FILES_WS = \
 	$(top_srcdir)/binsrc/ws/wsrm/wsrmcall.xsl \
 	$(srcdir)/rdf_net.sql \
 	$(srcdir)/simile.sql \
+	$(srcdir)/xrd2json.xsl \
 	$(srcdir)/http_auth.sql \
 	$(srcdir)/xmla.sql \
 	$(srcdir)/openxml.sql \
@@ -999,6 +998,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-bif_diff.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-bif_explain.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-bif_file.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-bif_imap.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-bif_intl.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-bif_json.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-bif_kerberoscli.Plo at am__quote@
@@ -1058,10 +1058,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-recovery.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-regist.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-rendezvous.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-repldb.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-replpush.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-replsri.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-replsub.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-rltrx.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-row.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-schspace.Plo at am__quote@
@@ -1079,6 +1075,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-sparql_l.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-sparql_p.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-sparql_qm.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-sparql_rdb2rdf.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-sparql_sff.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-sparql_tree.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-sparqld.Plo at am__quote@
@@ -1145,6 +1142,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-trans.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-turtle_l.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-turtle_p.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-uname_const_decl.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-update.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-uuencode.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_la-wi_xid.Plo at am__quote@
@@ -1177,6 +1175,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-bif_diff.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-bif_explain.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-bif_file.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-bif_imap.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-bif_intl.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-bif_json.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-bif_kerberoscli.Plo at am__quote@
@@ -1236,10 +1235,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-recovery.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-regist.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-rendezvous.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-repldb.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-replpush.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-replsri.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-replsub.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-rltrx.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-row.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-schspace.Plo at am__quote@
@@ -1257,6 +1252,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-sparql_l.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-sparql_p.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-sparql_qm.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-sparql_rdb2rdf.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-sparql_sff.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-sparql_tree.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-sparqld.Plo at am__quote@
@@ -1323,6 +1319,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-trans.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-turtle_l.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-turtle_p.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-uname_const_decl.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-update.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-uuencode.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libwi_odbc_la-wi_xid.Plo at am__quote@
@@ -2291,6 +2288,13 @@ libwi_la-sparql_tree.lo: sparql_tree.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -c -o libwi_la-sparql_tree.lo `test -f 'sparql_tree.c' || echo '$(srcdir)/'`sparql_tree.c
 
+libwi_la-sparql_rdb2rdf.lo: sparql_rdb2rdf.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -MT libwi_la-sparql_rdb2rdf.lo -MD -MP -MF $(DEPDIR)/libwi_la-sparql_rdb2rdf.Tpo -c -o libwi_la-sparql_rdb2rdf.lo `test -f 'sparql_rdb2rdf.c' || echo '$(srcdir)/'`sparql_rdb2rdf.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_la-sparql_rdb2rdf.Tpo $(DEPDIR)/libwi_la-sparql_rdb2rdf.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='sparql_rdb2rdf.c' object='libwi_la-sparql_rdb2rdf.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -c -o libwi_la-sparql_rdb2rdf.lo `test -f 'sparql_rdb2rdf.c' || echo '$(srcdir)/'`sparql_rdb2rdf.c
+
 libwi_la-sparul2sql.lo: sparul2sql.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -MT libwi_la-sparul2sql.lo -MD -MP -MF $(DEPDIR)/libwi_la-sparul2sql.Tpo -c -o libwi_la-sparul2sql.lo `test -f 'sparul2sql.c' || echo '$(srcdir)/'`sparul2sql.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_la-sparul2sql.Tpo $(DEPDIR)/libwi_la-sparul2sql.Plo
@@ -2312,34 +2316,6 @@ libwi_la-turtle_p.lo: turtle_p.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -c -o libwi_la-turtle_p.lo `test -f 'turtle_p.c' || echo '$(srcdir)/'`turtle_p.c
 
-libwi_la-repldb.lo: repldb.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -MT libwi_la-repldb.lo -MD -MP -MF $(DEPDIR)/libwi_la-repldb.Tpo -c -o libwi_la-repldb.lo `test -f 'repldb.c' || echo '$(srcdir)/'`repldb.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_la-repldb.Tpo $(DEPDIR)/libwi_la-repldb.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='repldb.c' object='libwi_la-repldb.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -c -o libwi_la-repldb.lo `test -f 'repldb.c' || echo '$(srcdir)/'`repldb.c
-
-libwi_la-replsri.lo: replsri.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -MT libwi_la-replsri.lo -MD -MP -MF $(DEPDIR)/libwi_la-replsri.Tpo -c -o libwi_la-replsri.lo `test -f 'replsri.c' || echo '$(srcdir)/'`replsri.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_la-replsri.Tpo $(DEPDIR)/libwi_la-replsri.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='replsri.c' object='libwi_la-replsri.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -c -o libwi_la-replsri.lo `test -f 'replsri.c' || echo '$(srcdir)/'`replsri.c
-
-libwi_la-replsub.lo: replsub.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -MT libwi_la-replsub.lo -MD -MP -MF $(DEPDIR)/libwi_la-replsub.Tpo -c -o libwi_la-replsub.lo `test -f 'replsub.c' || echo '$(srcdir)/'`replsub.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_la-replsub.Tpo $(DEPDIR)/libwi_la-replsub.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='replsub.c' object='libwi_la-replsub.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -c -o libwi_la-replsub.lo `test -f 'replsub.c' || echo '$(srcdir)/'`replsub.c
-
-libwi_la-replpush.lo: replpush.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -MT libwi_la-replpush.lo -MD -MP -MF $(DEPDIR)/libwi_la-replpush.Tpo -c -o libwi_la-replpush.lo `test -f 'replpush.c' || echo '$(srcdir)/'`replpush.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_la-replpush.Tpo $(DEPDIR)/libwi_la-replpush.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='replpush.c' object='libwi_la-replpush.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -c -o libwi_la-replpush.lo `test -f 'replpush.c' || echo '$(srcdir)/'`replpush.c
-
 libwi_la-pldebug.lo: pldebug.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -MT libwi_la-pldebug.lo -MD -MP -MF $(DEPDIR)/libwi_la-pldebug.Tpo -c -o libwi_la-pldebug.lo `test -f 'pldebug.c' || echo '$(srcdir)/'`pldebug.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_la-pldebug.Tpo $(DEPDIR)/libwi_la-pldebug.Plo
@@ -2438,6 +2414,13 @@ libwi_la-text.lo: text.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -c -o libwi_la-text.lo `test -f 'text.c' || echo '$(srcdir)/'`text.c
 
+libwi_la-uname_const_decl.lo: uname_const_decl.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -MT libwi_la-uname_const_decl.lo -MD -MP -MF $(DEPDIR)/libwi_la-uname_const_decl.Tpo -c -o libwi_la-uname_const_decl.lo `test -f 'uname_const_decl.c' || echo '$(srcdir)/'`uname_const_decl.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_la-uname_const_decl.Tpo $(DEPDIR)/libwi_la-uname_const_decl.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='uname_const_decl.c' object='libwi_la-uname_const_decl.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -c -o libwi_la-uname_const_decl.lo `test -f 'uname_const_decl.c' || echo '$(srcdir)/'`uname_const_decl.c
+
 libwi_la-xmlenc_algos.lo: xmlenc_algos.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -MT libwi_la-xmlenc_algos.lo -MD -MP -MF $(DEPDIR)/libwi_la-xmlenc_algos.Tpo -c -o libwi_la-xmlenc_algos.lo `test -f 'xmlenc_algos.c' || echo '$(srcdir)/'`xmlenc_algos.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_la-xmlenc_algos.Tpo $(DEPDIR)/libwi_la-xmlenc_algos.Plo
@@ -2557,6 +2540,13 @@ libwi_la-bif_pop3.lo: bif_pop3.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -c -o libwi_la-bif_pop3.lo `test -f 'bif_pop3.c' || echo '$(srcdir)/'`bif_pop3.c
 
+libwi_la-bif_imap.lo: bif_imap.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -MT libwi_la-bif_imap.lo -MD -MP -MF $(DEPDIR)/libwi_la-bif_imap.Tpo -c -o libwi_la-bif_imap.lo `test -f 'bif_imap.c' || echo '$(srcdir)/'`bif_imap.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_la-bif_imap.Tpo $(DEPDIR)/libwi_la-bif_imap.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='bif_imap.c' object='libwi_la-bif_imap.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -c -o libwi_la-bif_imap.lo `test -f 'bif_imap.c' || echo '$(srcdir)/'`bif_imap.c
+
 libwi_la-bif_nntp.lo: bif_nntp.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_la_CFLAGS) $(CFLAGS) -MT libwi_la-bif_nntp.lo -MD -MP -MF $(DEPDIR)/libwi_la-bif_nntp.Tpo -c -o libwi_la-bif_nntp.lo `test -f 'bif_nntp.c' || echo '$(srcdir)/'`bif_nntp.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_la-bif_nntp.Tpo $(DEPDIR)/libwi_la-bif_nntp.Plo
@@ -3537,6 +3527,13 @@ libwi_odbc_la-sparql_tree.lo: sparql_tree.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -c -o libwi_odbc_la-sparql_tree.lo `test -f 'sparql_tree.c' || echo '$(srcdir)/'`sparql_tree.c
 
+libwi_odbc_la-sparql_rdb2rdf.lo: sparql_rdb2rdf.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -MT libwi_odbc_la-sparql_rdb2rdf.lo -MD -MP -MF $(DEPDIR)/libwi_odbc_la-sparql_rdb2rdf.Tpo -c -o libwi_odbc_la-sparql_rdb2rdf.lo `test -f 'sparql_rdb2rdf.c' || echo '$(srcdir)/'`sparql_rdb2rdf.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_odbc_la-sparql_rdb2rdf.Tpo $(DEPDIR)/libwi_odbc_la-sparql_rdb2rdf.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='sparql_rdb2rdf.c' object='libwi_odbc_la-sparql_rdb2rdf.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -c -o libwi_odbc_la-sparql_rdb2rdf.lo `test -f 'sparql_rdb2rdf.c' || echo '$(srcdir)/'`sparql_rdb2rdf.c
+
 libwi_odbc_la-sparul2sql.lo: sparul2sql.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -MT libwi_odbc_la-sparul2sql.lo -MD -MP -MF $(DEPDIR)/libwi_odbc_la-sparul2sql.Tpo -c -o libwi_odbc_la-sparul2sql.lo `test -f 'sparul2sql.c' || echo '$(srcdir)/'`sparul2sql.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_odbc_la-sparul2sql.Tpo $(DEPDIR)/libwi_odbc_la-sparul2sql.Plo
@@ -3558,34 +3555,6 @@ libwi_odbc_la-turtle_p.lo: turtle_p.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -c -o libwi_odbc_la-turtle_p.lo `test -f 'turtle_p.c' || echo '$(srcdir)/'`turtle_p.c
 
-libwi_odbc_la-repldb.lo: repldb.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -MT libwi_odbc_la-repldb.lo -MD -MP -MF $(DEPDIR)/libwi_odbc_la-repldb.Tpo -c -o libwi_odbc_la-repldb.lo `test -f 'repldb.c' || echo '$(srcdir)/'`repldb.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_odbc_la-repldb.Tpo $(DEPDIR)/libwi_odbc_la-repldb.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='repldb.c' object='libwi_odbc_la-repldb.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -c -o libwi_odbc_la-repldb.lo `test -f 'repldb.c' || echo '$(srcdir)/'`repldb.c
-
-libwi_odbc_la-replsri.lo: replsri.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -MT libwi_odbc_la-replsri.lo -MD -MP -MF $(DEPDIR)/libwi_odbc_la-replsri.Tpo -c -o libwi_odbc_la-replsri.lo `test -f 'replsri.c' || echo '$(srcdir)/'`replsri.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_odbc_la-replsri.Tpo $(DEPDIR)/libwi_odbc_la-replsri.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='replsri.c' object='libwi_odbc_la-replsri.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -c -o libwi_odbc_la-replsri.lo `test -f 'replsri.c' || echo '$(srcdir)/'`replsri.c
-
-libwi_odbc_la-replsub.lo: replsub.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -MT libwi_odbc_la-replsub.lo -MD -MP -MF $(DEPDIR)/libwi_odbc_la-replsub.Tpo -c -o libwi_odbc_la-replsub.lo `test -f 'replsub.c' || echo '$(srcdir)/'`replsub.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_odbc_la-replsub.Tpo $(DEPDIR)/libwi_odbc_la-replsub.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='replsub.c' object='libwi_odbc_la-replsub.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -c -o libwi_odbc_la-replsub.lo `test -f 'replsub.c' || echo '$(srcdir)/'`replsub.c
-
-libwi_odbc_la-replpush.lo: replpush.c
- at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -MT libwi_odbc_la-replpush.lo -MD -MP -MF $(DEPDIR)/libwi_odbc_la-replpush.Tpo -c -o libwi_odbc_la-replpush.lo `test -f 'replpush.c' || echo '$(srcdir)/'`replpush.c
- at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_odbc_la-replpush.Tpo $(DEPDIR)/libwi_odbc_la-replpush.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='replpush.c' object='libwi_odbc_la-replpush.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -c -o libwi_odbc_la-replpush.lo `test -f 'replpush.c' || echo '$(srcdir)/'`replpush.c
-
 libwi_odbc_la-pldebug.lo: pldebug.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -MT libwi_odbc_la-pldebug.lo -MD -MP -MF $(DEPDIR)/libwi_odbc_la-pldebug.Tpo -c -o libwi_odbc_la-pldebug.lo `test -f 'pldebug.c' || echo '$(srcdir)/'`pldebug.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_odbc_la-pldebug.Tpo $(DEPDIR)/libwi_odbc_la-pldebug.Plo
@@ -3684,6 +3653,13 @@ libwi_odbc_la-text.lo: text.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -c -o libwi_odbc_la-text.lo `test -f 'text.c' || echo '$(srcdir)/'`text.c
 
+libwi_odbc_la-uname_const_decl.lo: uname_const_decl.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -MT libwi_odbc_la-uname_const_decl.lo -MD -MP -MF $(DEPDIR)/libwi_odbc_la-uname_const_decl.Tpo -c -o libwi_odbc_la-uname_const_decl.lo `test -f 'uname_const_decl.c' || echo '$(srcdir)/'`uname_const_decl.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_odbc_la-uname_const_decl.Tpo $(DEPDIR)/libwi_odbc_la-uname_const_decl.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='uname_const_decl.c' object='libwi_odbc_la-uname_const_decl.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -c -o libwi_odbc_la-uname_const_decl.lo `test -f 'uname_const_decl.c' || echo '$(srcdir)/'`uname_const_decl.c
+
 libwi_odbc_la-xmlenc_algos.lo: xmlenc_algos.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -MT libwi_odbc_la-xmlenc_algos.lo -MD -MP -MF $(DEPDIR)/libwi_odbc_la-xmlenc_algos.Tpo -c -o libwi_odbc_la-xmlenc_algos.lo `test -f 'xmlenc_algos.c' || echo '$(srcdir)/'`xmlenc_algos.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_odbc_la-xmlenc_algos.Tpo $(DEPDIR)/libwi_odbc_la-xmlenc_algos.Plo
@@ -3803,6 +3779,13 @@ libwi_odbc_la-bif_pop3.lo: bif_pop3.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -c -o libwi_odbc_la-bif_pop3.lo `test -f 'bif_pop3.c' || echo '$(srcdir)/'`bif_pop3.c
 
+libwi_odbc_la-bif_imap.lo: bif_imap.c
+ at am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -MT libwi_odbc_la-bif_imap.lo -MD -MP -MF $(DEPDIR)/libwi_odbc_la-bif_imap.Tpo -c -o libwi_odbc_la-bif_imap.lo `test -f 'bif_imap.c' || echo '$(srcdir)/'`bif_imap.c
+ at am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_odbc_la-bif_imap.Tpo $(DEPDIR)/libwi_odbc_la-bif_imap.Plo
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='bif_imap.c' object='libwi_odbc_la-bif_imap.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -c -o libwi_odbc_la-bif_imap.lo `test -f 'bif_imap.c' || echo '$(srcdir)/'`bif_imap.c
+
 libwi_odbc_la-bif_nntp.lo: bif_nntp.c
 @am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwi_odbc_la_CFLAGS) $(CFLAGS) -MT libwi_odbc_la-bif_nntp.lo -MD -MP -MF $(DEPDIR)/libwi_odbc_la-bif_nntp.Tpo -c -o libwi_odbc_la-bif_nntp.lo `test -f 'bif_nntp.c' || echo '$(srcdir)/'`bif_nntp.c
 @am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libwi_odbc_la-bif_nntp.Tpo $(DEPDIR)/libwi_odbc_la-bif_nntp.Plo
diff --git a/libsrc/Wi/arith.c b/libsrc/Wi/arith.c
index 4cc9c40..55bb64c 100644
--- a/libsrc/Wi/arith.c
+++ b/libsrc/Wi/arith.c
@@ -1,7 +1,7 @@
 /*
  *  arith.c
  *
- *  $Id: arith.c,v 1.13.2.3 2009/10/26 20:44:34 source Exp $
+ *  $Id: arith.c,v 1.13.2.4 2010/12/13 10:24:21 source Exp $
  *
  *  Arithmetic operators and comparisons.
  *
@@ -710,6 +710,11 @@ cmp_boxes (caddr_t box1, caddr_t box2, collation_t *collation1, collation_t *col
 	case DV_STRING:
 	  n1--;
 	  break;
+	case DV_UNAME:
+	  n1--;
+	  dtp1 = DV_STRING;
+	  collation1 = collation2 = NULL;
+	  break;
 	case DV_LONG_WIDE:
 	  dtp1 = DV_WIDE;
 	case DV_WIDE:
@@ -739,6 +744,11 @@ cmp_boxes (caddr_t box1, caddr_t box2, collation_t *collation1, collation_t *col
 	  else
 	    collation1 = collation2;
 	  break;
+	case DV_UNAME:
+	  n2--;
+	  dtp2 = DV_STRING;
+	  collation1 = NULL;
+	  break;
 	case DV_LONG_BIN:
 	  dtp2 = DV_BIN;
 	  collation1 = NULL;
diff --git a/libsrc/Wi/auxfiles.c b/libsrc/Wi/auxfiles.c
index b95d321..1b69fa3 100644
--- a/libsrc/Wi/auxfiles.c
+++ b/libsrc/Wi/auxfiles.c
@@ -1,7 +1,7 @@
 /*
  *  auxfiles.c
  *
- *  $Id: auxfiles.c,v 1.20.2.7 2010/05/31 11:00:21 source Exp $
+ *  $Id: auxfiles.c,v 1.20.2.8 2010/09/17 16:35:46 source Exp $
  *
  *  License file (license.dat)
  *  Error logging (wi.err)
@@ -543,22 +543,9 @@ _db_read_cfg (dbe_storage_t * ignore, char *mode)
   if (t_future_sz < 140000) /* was 100000 */
     t_future_sz = 140000; /* was 100000 */
 
-#if REPLICATION_SUPPORT
-  /* reserved threads: repldb, replsub, replpush, mtwrite, server, main */
-  n_threads = MIN (n_threads, MAX_THREADS - 6);
-
-  db_name = cfg_get_parm (wholefile, "\ndb_name:", 1);
-
-  repl_server_enable = cfg_get_parm (wholefile, "\nreplication_server:", 1);
-
-  repl_queue_max = (long) (ptrlong) cfg_get_parm (wholefile, "\nreplication_queue:", 0);
-  if (!repl_queue_max)
-    repl_queue_max = 50000;
-#else
 
   /* reserved threads: mtwrite, server, main */
   n_threads = MIN (n_threads, MAX_THREADS - 3);
-#endif
 
   sqlc_add_views_qualifiers = (long) (ptrlong) cfg_get_parm (wholefile, "\nsqlc_add_views_qualifiers:", 0);
 
diff --git a/libsrc/Wi/bif_crypto.c b/libsrc/Wi/bif_crypto.c
index ec12e99..3764ba5 100644
--- a/libsrc/Wi/bif_crypto.c
+++ b/libsrc/Wi/bif_crypto.c
@@ -1,7 +1,7 @@
 /*
  *  bif_crypto.c
  *
- *  $Id: bif_crypto.c,v 1.8.2.2 2009/08/19 07:29:52 source Exp $
+ *  $Id: bif_crypto.c,v 1.8.2.5 2011/01/27 14:19:53 source Exp $
  *
  *  Cryptography functions
  *
@@ -904,6 +904,158 @@ bif_smime_sign (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return ret;
 }
 
+static caddr_t
+bif_smime_encrypt (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  char * me = "smime_encrypt";
+  caddr_t msg = bif_string_arg (qst, args, 0, me);
+  caddr_t scerts = bif_array_arg (qst, args, 1, me);
+  caddr_t cipher_name = bif_string_arg (qst, args, 2, me);
+  caddr_t ret = NULL;
+  caddr_t err = NULL;
+  BIO *out_bio = NULL, *in_bio = NULL;
+  PKCS7 *p7 = NULL;
+  X509_STORE *store = NULL;
+  STACK_OF (X509) * certs = NULL;
+  int inx;
+  char err_buf[512];
+  char *ptr = NULL;
+  int flags = 0;
+  const EVP_CIPHER *cipher = NULL;
+
+  cipher = EVP_get_cipherbyname (cipher_name);
+  if (!cipher)
+    sqlr_new_error ("42000", "CR006", "Cannot find cipher");
+  store = smime_get_store_from_array (scerts, &err);
+  if (err)
+    sqlr_resignal (err);
+  if (!store)
+    sqlr_new_error ("42000", "CR006", "No recipient certificates");
+
+  certs = sk_X509_new_null ();
+  if (store && store->objs)
+    {
+      for (inx = 0; inx < sk_X509_OBJECT_num (store->objs); inx++)
+	{
+	  X509_OBJECT *obj = sk_X509_OBJECT_value (store->objs, inx);
+	  if (obj->type == X509_LU_X509)
+	    sk_X509_push (certs, X509_dup (obj->data.x509));
+	}
+    }
+  if (store)
+    X509_STORE_free (store);
+  in_bio = BIO_new_mem_buf (msg, box_length (msg) - 1);
+  if (in_bio)
+    {
+      p7 = PKCS7_encrypt(certs, in_bio, cipher, flags);
+      BIO_free (in_bio);
+      in_bio = BIO_new_mem_buf (msg, box_length (msg) - 1);
+    }
+  sk_X509_pop_free (certs, X509_free);
+
+  if (!p7)
+    {
+      if (in_bio)
+	BIO_free (in_bio);
+      sqlr_new_error ("42000", "CR009", "Cannot generate PKCS7 structure. SSL error : %s", get_ssl_error_text (err_buf, sizeof (err_buf)));
+    }
+
+  out_bio = BIO_new (BIO_s_mem ());
+  if (!out_bio)
+    {
+      if (p7)
+	PKCS7_free (p7);
+      if (in_bio)
+	BIO_free (in_bio);
+      sqlr_new_error ("42000", "CR010", "Cannot allocate output storage. SSL error : %s", get_ssl_error_text (err_buf, sizeof (err_buf)));
+    }
+
+  SMIME_write_PKCS7 (out_bio, p7, in_bio, flags);
+  PKCS7_free (p7);
+  BIO_free (in_bio);
+
+  ret = dk_alloc_box (BIO_get_mem_data (out_bio, &ptr) + 1, DV_SHORT_STRING);
+  memcpy (ret, ptr, box_length (ret) - 1);
+  ret[box_length (ret) - 1] = 0;
+
+  BIO_free (out_bio);
+  return ret;
+}
+
+static caddr_t
+bif_smime_decrypt (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  char * me = "smime_decrypt";
+  caddr_t msg = bif_string_arg (qst, args, 0, me);
+  caddr_t cert = bif_string_arg (qst, args, 1, me);
+  caddr_t privatekey = bif_string_arg (qst, args, 2, me);
+  caddr_t privatepass = bif_string_or_null_arg (qst, args, 3, me);
+  int flags = 0;
+  caddr_t ret = NULL;
+  BIO *out_bio = NULL, *in_bio = NULL, *data_bio = NULL;
+  PKCS7 *p7 = NULL;
+  X509 *recip_cert = NULL;
+  EVP_PKEY *recip_key = NULL;
+  int rc;
+  char err_buf[512];
+  char *ptr = NULL;
+
+  recip_cert = x509_get_cert_from_buffer (cert);
+  if (!recip_cert)
+    {
+      sqlr_new_error ("42000", "CR007", "Error reading the recipient certificate. SSL error : %s", get_ssl_error_text (err_buf, sizeof (err_buf)));
+    }
+
+  recip_key = x509_get_pkey_from_buffer (privatekey, privatepass);
+  if (!recip_key)
+    {
+      X509_free (recip_cert);
+      sqlr_new_error ("42000", "CR008", "Error reading the recipient private key. SSL error : %s", get_ssl_error_text (err_buf, sizeof (err_buf)));
+    }
+
+  in_bio = BIO_new_mem_buf (msg, box_length (msg) - 1);
+  if (in_bio)
+    {
+      p7 = SMIME_read_PKCS7 (in_bio, &data_bio);
+      BIO_free (in_bio);
+    }
+  if (!p7)
+    {
+      X509_free (recip_cert);
+      EVP_PKEY_free (recip_key);
+      if (data_bio) BIO_free (data_bio);
+      sqlr_new_error ("42000", "CR004", "Cannot read PKCS7 attached signature. SSL Error : %s", get_ssl_error_text (err_buf, sizeof (err_buf)));
+    }
+  out_bio = BIO_new (BIO_s_mem ());
+  if (!out_bio)
+    {
+      X509_free (recip_cert);
+      EVP_PKEY_free (recip_key);
+      PKCS7_free (p7);
+      if (data_bio) BIO_free (data_bio);
+      sqlr_new_error ("42000", "CR010", "Cannot allocate output storage. SSL error : %s", get_ssl_error_text (err_buf, sizeof (err_buf)));
+    }
+
+  rc = PKCS7_decrypt(p7, recip_key, recip_cert, out_bio, flags);
+
+  X509_free (recip_cert);
+  EVP_PKEY_free (recip_key);
+
+  if (rc)
+    {
+      ret = dk_alloc_box (BIO_get_mem_data (out_bio, &ptr) + 1, DV_SHORT_STRING);
+      memcpy (ret, ptr, box_length (ret) - 1);
+      ret[box_length (ret) - 1] = 0;
+    }
+  else
+    ret = NEW_DB_NULL;
+
+  PKCS7_free (p7);
+  if (data_bio) BIO_free (data_bio);
+  BIO_free (out_bio);
+  return ret;
+}
+
 
 static caddr_t
 bif_pem_certificates_to_array (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
@@ -1104,6 +1256,7 @@ bif_get_certificate_info (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args
   long type = bif_long_arg (qst, args, 0, "get_certificate_info");
   caddr_t scert = BOX_ELEMENTS (args) > 1 ? bif_string_or_null_arg (qst, args, 1, "get_certificate_info") : NULL;
   int internal = 0;
+  char buffer[4096];
 
   if (qi->qi_client->cli_ws)
     ssl = (SSL *) tcpses_get_ssl (qi->qi_client->cli_ws->ws_session->dks_session);
@@ -1173,7 +1326,6 @@ bif_get_certificate_info (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args
 	X509_NAME *subj = X509_get_subject_name (cert);
 	if (subj)
 	  {
-	    char buffer[4096];
 	    X509_NAME_oneline (subj, buffer, sizeof (buffer));
 	    ret = box_dv_short_string (buffer);
 	    break;
@@ -1185,7 +1337,6 @@ bif_get_certificate_info (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args
 	X509_NAME *subj = X509_get_issuer_name (cert);
 	if (subj)
 	  {
-	    char buffer[4096];
 	    X509_NAME_oneline (subj, buffer, sizeof (buffer));
 	    ret = box_dv_short_string (buffer);
 	    break;
@@ -1313,6 +1464,43 @@ bif_get_certificate_info (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args
 	  *err_ret = srv_make_new_error ("42000", "XXXXX", "Can not read the public key from the certificate");
 	break;
       }
+    case 10:
+      {
+	char *attr = BOX_ELEMENTS (args) > 4 ? bif_string_arg (qst, args, 4, "get_certificate_info") : "CN";
+	X509_NAME *subj = X509_get_subject_name (cert);
+	X509_NAME_ENTRY *ne, *ne_ret = NULL;
+	int n, i, len;
+	char *s, *data_ptr;
+	BIO *mem = BIO_new (BIO_s_mem ());
+	for (i = 0; NULL != subj && i < sk_X509_NAME_ENTRY_num(subj->entries); i++)
+	  {
+	    ne = sk_X509_NAME_ENTRY_value(subj->entries,i);
+	    n = OBJ_obj2nid (ne->object);
+	    if ((n == NID_undef) || ((s = OBJ_nid2sn (n)) == NULL))
+	      {
+		i2t_ASN1_OBJECT (buffer, sizeof (buffer), ne->object);
+		s = buffer;
+	      }
+	    if (!strcmp (s, attr))
+	      {
+		ne_ret = ne;
+		break;
+	      }
+	  }
+	if (ne_ret)
+	  {
+	    ASN1_STRING_print (mem, ne_ret->value);
+	    len = BIO_get_mem_data (mem, &data_ptr);
+	    if (len > 0 && data_ptr)
+	      {
+		ret = dk_alloc_box (len + 1, DV_SHORT_STRING);
+		memcpy (ret, data_ptr, len);
+		ret[len] = 0;
+	      }
+	  }
+	BIO_free (mem);
+	break;
+      }
     default:
       {
 	if (!internal)
@@ -1368,6 +1556,8 @@ bif_crypto_init (void)
   bif_define_typed ("tree_hmac", bif_tree_hmac, &bt_varchar);
   bif_define_typed ("smime_verify", bif_smime_verify, &bt_varchar);
   bif_define_typed ("smime_sign", bif_smime_sign, &bt_varchar);
+  bif_define_typed ("smime_encrypt", bif_smime_encrypt, &bt_varchar);
+  bif_define_typed ("smime_decrypt", bif_smime_decrypt, &bt_varchar);
   bif_define_typed ("pem_certificates_to_array", bif_pem_certificates_to_array, &bt_any);
   bif_define_typed ("get_certificate_info", bif_get_certificate_info, &bt_any);
   bif_define_typed ("x509_certificate_verify", bif_x509_certificate_verify, &bt_any);
diff --git a/libsrc/Wi/bif_date.c b/libsrc/Wi/bif_date.c
index 5e657b1..f92a59b 100644
--- a/libsrc/Wi/bif_date.c
+++ b/libsrc/Wi/bif_date.c
@@ -1,7 +1,7 @@
 /*
  *  bif_date.c
  *
- *  $Id: bif_date.c,v 1.12.2.1 2009/04/18 21:55:09 source Exp $
+ *  $Id: bif_date.c,v 1.12.2.3 2011/03/03 11:56:44 source Exp $
  *
  *  Bifs for date
  *
@@ -227,8 +227,11 @@ dt_scan_from_buffer (const char *buf, int mode, caddr_t *dt_ret, const char **er
             } while (isdigit (tail[0]));
           ts.fraction = acc * (msec_factor ? msec_factor : 1);
         }
-      err_msg_ret[0] = "Colon is expected after minute";
-      return 0;
+      if ('Z' != tail[0] && strncmp (tail, " GMT", 4))
+	{
+	  err_msg_ret[0] = "Colon or time zone is expected after minute";
+	  return 0;
+	}
     }
   else
     {
@@ -266,7 +269,7 @@ scan_tz:
     DT_SET_MINUTE (dt_ret[0], ts.minute);
     DT_SET_SECOND (dt_ret[0], ts.second);
     DT_SET_FRACTION (dt_ret[0], ts.fraction);
-    DT_SET_TZ (dt_ret[0], 0);
+    DT_SET_TZ (dt_ret[0], dt_local_tz);
   }
   SET_DT_TYPE_BY_DTP (dt_ret[0], (ymd_found ? (hms_found ? DV_DATETIME : DV_DATE) : DV_TIME));
   return (tail - buf);
@@ -558,11 +561,13 @@ bif_timestampadd (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   ptrlong part = bif_long_arg (qst, args, 0, "timestampadd");
   int n = (int) bif_long_arg (qst, args, 1, "timestampadd");
   caddr_t dt = bif_date_arg (qst, args, 2, "timestampadd");
+  int saved_tz = DT_TZ (dt);
   GMTIMESTAMP_STRUCT ts;
   dt_to_GMTimestamp_struct (dt, &ts);
   ts_add (&ts, n, interval_odbc_to_text (part, "timestampadd"));
   res = dk_alloc_box (DT_LENGTH, DV_DATETIME);
   GMTimestamp_struct_to_dt (&ts, res);
+  DT_SET_TZ (res, saved_tz);
   return res;
 }
 
diff --git a/libsrc/Wi/bif_explain.c b/libsrc/Wi/bif_explain.c
index b8a846c..ce68e3b 100644
--- a/libsrc/Wi/bif_explain.c
+++ b/libsrc/Wi/bif_explain.c
@@ -1,7 +1,7 @@
 /*
  *  bif_explain.c
  *
- *  $Id: bif_explain.c,v 1.17.2.11 2010/02/18 10:57:16 source Exp $
+ *  $Id: bif_explain.c,v 1.17.2.13 2011/02/11 13:19:31 source Exp $
  *
  *  Implements bif 'explain'
  *
@@ -50,6 +50,7 @@
 #include "sqlcstate.h"
 #include "sqlo.h"
 #include "rdfinf.h"
+#include "rdf_core.h"
 
 /* sqlprt.c */
 void trset_start (caddr_t *qst);
@@ -62,6 +63,28 @@ static void qr_print (query_t * qr);
 static void node_print (data_source_t * node);
 
 
+
+caddr_t
+dv_iri_short_name (caddr_t x)
+{
+  caddr_t pref, local, r;
+  iri_id_t iid = unbox_iri_id (x);
+  caddr_t name = key_id_to_iri ((query_instance_t*)THR_ATTR (THREAD_CURRENT_THREAD, TA_REPORT_QST), iid);
+  if (!name)
+    return NULL;
+  if (iri_split (name, &pref, &local))
+    {
+      dk_free_box (name);
+      dk_free_box (pref);
+      r = box_dv_short_string (local + 4);
+      dk_free_box (local);
+      return r;
+    }
+  dk_free_box (name);
+  return NULL;
+}
+
+
 static void
 ssl_print (state_slot_t * ssl)
 {
@@ -90,6 +113,7 @@ ssl_print (state_slot_t * ssl)
 
     case SSL_CONSTANT:
 	{
+	  dtp_t dtp = DV_TYPE_OF (ssl->ssl_constant);
 	  caddr_t err_ret = NULL;
 	  if (DV_TYPE_OF (ssl->ssl_constant) == DV_DB_NULL)
 	    stmt_printf (("<constant DB_NULL>"));
@@ -100,7 +124,26 @@ ssl_print (state_slot_t * ssl)
 		  NUMERIC_MAX_PRECISION, NUMERIC_MAX_SCALE,
 		  &err_ret);
 	      if (!err_ret && strval)
-		stmt_printf (("<constant (" EXPLAIN_LINE_MAX_STR_FORMAT ")>", strval));
+		{
+		  switch (dtp)
+		    {
+		      case DV_IRI_ID:
+			    {
+			      caddr_t str = dv_iri_short_name (ssl->ssl_constant);
+			      if (str)
+				{
+				  stmt_printf ((" #" EXPLAIN_LINE_MAX_STR_FORMAT " ", str));
+				  dk_free_box (str);
+				  break;
+				}
+			    }
+		      case DV_LONG_INT: case DV_NUMERIC: case DV_SINGLE_FLOAT: case DV_DOUBLE_FLOAT:
+			  stmt_printf ((" " EXPLAIN_LINE_MAX_STR_FORMAT " ", strval));
+			  break;
+		      default:
+			  stmt_printf (("<c " EXPLAIN_LINE_MAX_STR_FORMAT ">", strval));
+		    }
+		}
 	      else
 		stmt_printf (("<constant>"));
 	      if (err_ret)
@@ -423,7 +466,7 @@ ks_print (key_source_t * ks)
   stmt_printf (("\n%s", ks->ks_spec.ksp_key_cmp ? " inlined " : ""));
 
   sp_list_print (ks->ks_spec.ksp_spec_array);
-  stmt_printf (("\n"));
+  stmt_printf (("%s\n", ks->ks_copy_search_pars ? " [copies params]" : ""));
 
   if (ks->ks_row_spec)
     {
diff --git a/libsrc/Wi/bif_file.c b/libsrc/Wi/bif_file.c
index 3a251ef..4cba56b 100644
--- a/libsrc/Wi/bif_file.c
+++ b/libsrc/Wi/bif_file.c
@@ -1,7 +1,7 @@
 /*
  *  bif_file.c
  *
- *  $Id: bif_file.c,v 1.44.2.30 2010/05/24 22:36:52 source Exp $
+ *  $Id: bif_file.c,v 1.44.2.34 2011/02/10 20:58:38 source Exp $
  *
  *  Bifs for file I/O
  *
@@ -2428,11 +2428,10 @@ bif_mdigest5 (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 #define MOD_ADLER 65521
 #define ADLER_MAX_BLOCK_LEN 5550
 #define MOD_ADLER_WRAP(x) x = (x & 0xffff) | ((x >> 16) * (65536 - MOD_ADLER))
-static caddr_t
-bif_adler32 (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+
+int
+adler32_of_buffer (unsigned char *data, size_t len)
 {
-  unsigned char *data = (unsigned char *) bif_string_arg (qst, args, 0, "adler32");
-  size_t len = box_length (data) - 1;
   unsigned lo = 1, hi = 0;
   while (len)
    {
@@ -2451,7 +2450,15 @@ bif_adler32 (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
     lo -= MOD_ADLER;
   if (hi >= MOD_ADLER)
     hi -= MOD_ADLER;
-  return box_num ((hi << 16) | lo);
+  return ((hi << 16) | lo);
+}
+
+static caddr_t
+bif_adler32 (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  unsigned char *data = (unsigned char *) bif_string_arg (qst, args, 0, "adler32");
+  size_t len = box_length (data) - 1;
+  return box_num (adler32_of_buffer (data, len));
 }
 
 static caddr_t
@@ -2984,6 +2991,49 @@ mime_find_boundry (char *szMessage, long message_size, long offset,
   while (1);
 }
 
+caddr_t
+mime_parse_header (int *rfc822, caddr_t szMessage, long message_size, long offset)
+{
+  char szNewBoundry[1000], szHeaderLine[1000], szAttr[1000], szValue[1000];
+  long newOffset = offset, tempOffset = 0, lineOffset;
+  int new_mode = *rfc822;
+  int override_to_mime = 0;
+  dk_set_t attrs = NULL;
+  caddr_t result = NULL;
+
+  *szNewBoundry = 0;
+
+  /* skip the empty lines if in RFC822 header */
+  if (*rfc822)
+    while ((iswhite (szMessage + newOffset) || isendline (szMessage + newOffset)) && newOffset < message_size)
+      newOffset++;
+  while (0 < (tempOffset = mime_get_line (szMessage, message_size, newOffset, szHeaderLine, 1000)))
+    {
+      newOffset = tempOffset;
+      lineOffset = 0;
+      if (strlen (szHeaderLine) < 2)
+	break;
+      override_to_mime = 0;
+
+      lineOffset = mime_get_attr (szHeaderLine, 0, ':', rfc822, &override_to_mime, szAttr, 1000, szValue, 1000);
+      if (lineOffset == -1)
+	continue;
+      dk_set_push (&attrs, (void *) box_dv_short_string (szAttr));
+      dk_set_push (&attrs, (void *) box_dv_short_string (szValue));
+      if (override_to_mime || !*rfc822)
+	{
+	  new_mode = 0;
+	  while (-1 != (lineOffset = mime_get_attr (szHeaderLine, lineOffset, '=', rfc822, &override_to_mime, szAttr, 1000, szValue, 1000)))
+	    {
+	      dk_set_push (&attrs, (void *) box_dv_short_string (szAttr));
+	      dk_set_push (&attrs, (void *) box_dv_short_string (szValue));
+	    }
+	}
+    }
+  if (attrs)
+    result = list_to_array (dk_set_nreverse (attrs));
+  return result;
+}
 
 long
 get_mime_part (int *rfc822, caddr_t szMessage, long message_size, long offset,
@@ -3009,8 +3059,6 @@ get_mime_part (int *rfc822, caddr_t szMessage, long message_size, long offset,
       DV_ARRAY_OF_POINTER);
   *_result = result;
 
-  memset (result, 3 * sizeof (caddr_t), 0);
-
   /* skip the empty lines if in RFC822 header */
   if (*rfc822)
     while ((iswhite (szMessage + newOffset)
@@ -3766,6 +3814,19 @@ bif_mime_tree (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return (caddr_t) result;
 }
 
+static caddr_t
+bif_mime_header (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  char *szMessage = bif_string_arg (qst, args, 0, "mime_header");
+  int rfc822 = 1;
+  caddr_t result = NULL;
+
+  if (BOX_ELEMENTS (args) > 1)
+    rfc822 = (int) bif_long_arg (qst, args, 1, "mime_header");
+
+  result = mime_parse_header (&rfc822, szMessage, box_length (szMessage) - 1, 0);
+  return result ? result : NEW_DB_NULL;
+}
 
 static voidpf
 zlib_dk_alloc (voidpf opaque, uInt items, uInt size)
@@ -5985,6 +6046,16 @@ signal_error:
   return NULL;
 }
 
+caddr_t
+bif_getenv (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  caddr_t var = bif_string_arg (qst, args, 0, "getenv");
+  char * res = NULL;
+  sec_check_dba ((query_instance_t *)qst, "getenv");
+  res = getenv (var);
+  return res ? box_dv_short_string (res) : NEW_DB_NULL;
+}
+
 /* hooks for operating on gz stram via string session */
 
 OFF_T
@@ -6528,6 +6599,7 @@ bif_file_init (void)
     bif_define_typed ("system", bif_system, &bt_integer);
   bif_define_typed ("run_executable", bif_run_executable, &bt_integer);
   bif_define_typed ("mime_tree", bif_mime_tree, &bt_any);
+  bif_define_typed ("mime_header", bif_mime_header, &bt_any);
   bif_define_typed ("gz_compress", bif_gz_compress, &bt_varchar);
   bif_define_typed ("string_output_gz_compress",
       bif_string_output_gz_compress, &bt_integer);
@@ -6565,6 +6637,7 @@ bif_file_init (void)
   bif_define_typed ("file_open", bif_file_open, &bt_any);
   bif_define_typed ("gz_file_open", bif_gz_file_open, &bt_any);
   bif_define_typed ("get_csv_row", bif_get_csv_row, &bt_any);
+  bif_define_typed ("getenv", bif_getenv, &bt_varchar);
 #ifdef HAVE_BIF_GPF
   bif_define ("__gpf", bif_gpf);
 #endif
diff --git a/libsrc/Wi/bif_imap.c b/libsrc/Wi/bif_imap.c
new file mode 100644
index 0000000..a5e8432
--- /dev/null
+++ b/libsrc/Wi/bif_imap.c
@@ -0,0 +1,836 @@
+/*
+ *  bif_imap.c
+ *
+ *  $Id: bif_imap.c,v 1.1.2.8 2011/01/28 13:32:49 source Exp $
+ *
+ *  IMAP4 client function
+ *
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *
+ *  Copyright (C) 1998-2010 OpenLink Software
+ *
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "Dk.h"
+#include "sqlnode.h"
+#include "http.h"
+#include "multibyte.h"
+#include "srvmultibyte.h"
+#include "sqlbif.h"
+#include "libutil.h"
+#include <stddef.h>
+#include "xml.h"
+
+#define IS_OK_NEXT(ses, resp, rc, err_c, err_t, need_logout)  \
+	CATCH_READ_FAIL (ses) \
+	  { \
+	    resp[0] = 0; \
+	    rc = dks_read_line (ses, resp, sizeof (resp)); \
+	    if (is_ok (resp)) \
+		{ \
+			strncpy (err_text, err_t, sizeof(err_text)); \
+			strncpy (err_code, err_c, sizeof(err_code)); \
+			if (need_logout) \
+				goto logout; \
+			else \
+	      goto error_end; \
+	  } \
+	  } \
+	FAILED \
+	  { \
+	    goto error_end; \
+	  } \
+	END_READ_FAIL (ses)
+
+#define SEND(ses, rc, cmd, var)	\
+	CATCH_WRITE_FAIL (ses) \
+	  { \
+	    SES_PRINT (ses, cmd); \
+	    SES_PRINT (ses, var); \
+	    SES_PRINT (ses, "\r\n"); \
+	    session_flush_1 (ses);\
+	  } \
+	FAILED \
+	  { \
+	  goto error_end; \
+	  } \
+	END_WRITE_FAIL (ses)
+
+static int
+is_ok (char *resp)
+{
+  if (strlen (resp) > 2 && !strncmp ("OK", resp + 2, 2))
+    return 0;
+  if (strlen (resp) > 2 && !strncmp ("NO", resp + 2, 2))
+    return 1;
+  if (strlen (resp) > 2 && !strncmp ("BAD", resp + 2, 3))
+    return 1;
+  if (strlen (resp) > 2 && !strncmp ("CAPABILITY", resp + 2, 10))
+    return 0;
+  if (strlen (resp) > 2 && !strncmp ("BYE", resp + 2, 3))
+    return 0;
+  if (strlen (resp) > 2 && !strncmp ("LIST", resp + 2, 4))
+    return 0;
+  if (strlen (resp) > 2 && !strncmp ("SELECT", resp + 2, 6))
+    return 0;
+  if (strlen (resp) > 2 && !strncmp ("FETCH", resp + 2, 5))
+    return 0;
+  if (strlen (resp) > 2 && !strncmp ("RENAME", resp + 2, 6))
+    return 0;
+  if (strlen (resp) > 2 && !strncmp ("DELETE", resp + 2, 6))
+    return 0;
+  if (strlen (resp) > 2 && !strncmp ("CREATE", resp + 2, 6))
+    return 0;
+  if (strlen (resp) > 2 && !strncmp ("STORE", resp + 2, 5))
+    return 0;
+  if (strlen (resp) > 2 && !strncmp ("COPY", resp + 2, 4))
+    return 0;
+  if (strlen (resp) > 2 && !strncmp ("EXPUNGE", resp + 2, 7))
+    return 0;
+  return 0;
+}
+
+void
+imap_quote_string (char *dest, size_t dlen, const char *src)
+{
+  char quote[] = "\"\\", *pt;
+  const char *s;
+
+  pt = dest;
+  s = src;
+
+  *pt++ = '"';
+  /* save room for trailing quote-char */
+  dlen -= 2;
+
+  for (; *s && dlen; s++)
+    {
+      if (strchr (quote, *s))
+	{
+	  dlen -= 2;
+	  if (!dlen)
+	    break;
+	  *pt++ = '\\';
+	  *pt++ = *s;
+	}
+      else
+	{
+	  *pt++ = *s;
+	  dlen--;
+	}
+    }
+  *pt++ = '"';
+  *pt = 0;
+}
+
+#define ISSPACE(c) isspace((unsigned char)c)
+#define SKIPWS(c) while (*(c) && isspace ((unsigned char) *(c))) c++;
+
+/* imap_next_word: return index into string where next IMAP word begins */
+char *
+imap_next_word (char *s)
+{
+  char *p;
+  int quoted = 0;
+  p = s;
+
+  while (*p)
+    {
+      if (*p == '\\')
+	{
+	  p++;
+	  if (*p)
+	    p++;
+	  continue;
+	}
+      if (*p == '\"')
+	quoted = quoted ? 0 : 1;
+      if (!quoted && ISSPACE (*p))
+	break;
+      p++;
+    }
+
+  SKIPWS (p);
+  return p;
+}
+
+int
+ascii_isupper (int c)
+{
+  return (c >= 'A') && (c <= 'Z');
+}
+
+int
+ascii_islower (int c)
+{
+  return (c >= 'a') && (c <= 'z');
+}
+
+int
+ascii_toupper (int c)
+{
+  if (ascii_islower (c))
+    return c & ~32;
+
+  return c;
+}
+
+int
+ascii_tolower (int c)
+{
+  if (ascii_isupper (c))
+    return c | 32;
+
+  return c;
+}
+
+int
+ascii_strncasecmp (const char *a, const char *b, int n)
+{
+  int i, j;
+
+  if (a == b)
+    return 0;
+  if (a == NULL && b)
+    return -1;
+  if (b == NULL && a)
+    return 1;
+
+  for (j = 0; (*a || *b) && j < n; a++, b++, j++)
+    {
+      if ((i = ascii_tolower (*a) - ascii_tolower (*b)))
+	return i;
+    }
+
+  return 0;
+}
+
+static void
+imap_get (char *host, caddr_t * err_ret, caddr_t user, caddr_t pass,
+    long end_size, caddr_t mode, dk_set_t * ret_v, caddr_t folder_id, caddr_t * in, caddr_t * qst, long cert)
+{
+  int rc;
+  volatile int inx_mails;
+  unsigned int uid, message_begin;
+  volatile long size;
+  dk_session_t *ses = dk_session_allocate (SESCLASS_TCPIP);
+  char resp[1024];
+  char message[128], err_text[512], err_code[6], login_message[512], username[512], password[512];
+  char end_msg[1] = ")";
+  char *s, *ps;
+  caddr_t target_folder_id = NULL;
+  dk_session_t *msg = NULL;
+  dk_session_t *msg2 = NULL;
+#ifdef _SSL
+  SSL *ssl;
+  SSL_CTX *ssl_ctx = NULL;
+  SSL_METHOD *ssl_method;
+#endif
+  resp[0] = 0;
+  err_code[0] = 0;
+  if (!_thread_sched_preempt)
+    {
+      ses->dks_read_block_timeout = dks_fibers_blocking_read_default_to;
+    }
+  rc = session_set_address (ses->dks_session, host);
+  if (SER_SUCC != rc)
+    {
+      PrpcSessionFree (ses);
+      *err_ret = srv_make_new_error ("2E000", "IM001", "Cannot resolve host in imap_get");
+      return;
+    }
+  rc = session_connect (ses->dks_session);
+  if (SER_SUCC != rc)
+    {
+      if (rc != SER_NOREC)
+	session_disconnect (ses->dks_session);
+      PrpcSessionFree (ses);
+      *err_ret = srv_make_new_error ("08001", "IM002", "Cannot connect in imap_get");
+      return;
+    }
+  if (cert)
+    {
+      int ssl_err = 0;
+      int fd = tcpses_get_fd (ses->dks_session);
+      ssl_method = SSLv23_client_method ();
+      ssl_ctx = SSL_CTX_new (ssl_method);
+      ssl = SSL_new (ssl_ctx);
+      SSL_set_fd (ssl, fd);
+      ssl_err = SSL_connect (ssl);
+      if (ssl_err != 1)
+	{
+	  strcpy_ck (err_code, "08006");
+	  if (ERR_peek_error ())
+	    cli_ssl_get_error_string (err_text, sizeof (err_text));
+	  else
+	    strcpy_ck (err_text, "Cannot connect via SSL");
+	  goto error_end;
+	}
+      else
+	tcpses_to_sslses (ses->dks_session, ssl);
+    }
+
+  msg = strses_allocate ();
+  msg2 = strses_allocate ();
+  /* send AUTHORIZATION */
+
+  IS_OK_NEXT (ses, resp, rc, "IM003", "No response from remote IMAP server", 0);
+
+  imap_quote_string (username, sizeof (username), user);
+  imap_quote_string (password, sizeof (password), pass);
+
+  snprintf (login_message, sizeof (login_message), " %s %s", username, password);
+
+  SEND (ses, rc, "1 LOGIN ", login_message);
+  IS_OK_NEXT (ses, resp, rc, "IM004", "Could not login to remote IMAP server. Please check user or password parameters.", 0);
+
+  inx_mails = 0;
+  size = 0;
+
+  /* get LIST of message and set size */
+  SEND (ses, rc, "2 CAPABILITY", "");
+  while (1)
+    {
+      IS_OK_NEXT (ses, resp, rc, "IM005", "CAPABILITY command to remote IMAP server failed", 1);
+      if (strlen (resp) > 2 && !strncmp ("2 OK", resp, 4))
+	break;
+    }
+  /* list of folders in folder or in root */
+  if (!stricmp ("list", mode))
+    {
+      if (folder_id && strlen (folder_id) > 0)
+			snprintf (message, sizeof (message), "3 LIST \"\" \"%s\"", folder_id);
+      else
+			snprintf (message, sizeof (message), "3 LIST \"\" \"%%\"");
+      SEND (ses, rc, message, "");
+      message_begin = 0;
+      strses_flush (msg);
+      strses_enable_paging (msg, http_ses_size);
+      CATCH_READ_FAIL (ses)
+      {
+	rc = dks_read_line (ses, resp, sizeof (resp));
+	while (strlen (resp) > 2 && strncmp ("3 OK", resp, 4))
+	  {
+	    ps = resp;
+	    ps = imap_next_word (ps);
+	    if (!ascii_strncasecmp ("LIST", ps, 4))
+	      ps = imap_next_word (ps);
+	    else
+	      {
+		strcpy_ck (err_text, "Some error in the list of folders");
+		strcpy_ck (err_code, "IM006");
+		SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+		goto logout;
+	      }
+	    dk_set_push (ret_v, box_dv_short_string (ps));
+	    if (tcpses_check_disk_error (msg, qst, 0))
+	      {
+		strcpy_ck (err_text, "Server error in accessing temp file");
+		strcpy_ck (err_code, "IM007");
+		SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+		goto logout;
+	      }
+	    rc = dks_read_line (ses, resp, sizeof (resp));
+	  }
+	if (tcpses_check_disk_error (msg, NULL, 0))
+	  {
+	    strcpy_ck (err_text, "Server error in accessing temp file");
+	    strcpy_ck (err_code, "IM008");
+	    SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+	    goto logout;
+	  }
+	if (!STRSES_CAN_BE_STRING (msg))
+	  {
+	    strcpy_ck (err_text, "Server error in storing data into a string session");
+	    strcpy_ck (err_code, "IM009");
+	    SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+	    goto logout;
+	  }
+      }
+      FAILED
+      {
+	strcpy_ck (err_code, "IM010");
+	strcpy_ck (err_text, "Failed reading output of FETCH command on remote IMAP server");
+	goto error_end;
+      }
+      END_READ_FAIL (ses);
+      goto logout;
+    }
+
+  /* delete folder */
+  if (!stricmp ("delete", mode))
+    {
+      if (folder_id && strlen (folder_id) > 0)
+		snprintf (message, sizeof (message), "3 DELETE \"%s\"", folder_id);
+      else
+	{
+	  strcpy_ck (err_code, "IM011");
+	  strcpy_ck (err_text, "There must be folder name to delete (6th argument)");
+	  goto logout;
+	}
+      SEND (ses, rc, message, "");
+      while (1)
+	{
+	  IS_OK_NEXT (ses, resp, rc, "IM012", "DELETE command to remote IMAP server failed", 1);
+	  if (strlen (resp) > 2 && !strncmp ("3 OK", resp, 4))
+	    break;
+	  if (strlen (resp) > 2 && !strncmp ("3 BAD", resp, 5))
+	    {
+	      strcpy_ck (err_code, "IM013");
+	      strcpy_ck (err_text, "Error during deletion");
+	      break;
+	    }
+	  if (strlen (resp) > 2 && !strncmp ("3 NO", resp, 4))
+	    {
+	      strcpy_ck (err_code, "IM014");
+	      strcpy_ck (err_text, "Folder does not exist");
+	      break;
+	    }
+	}
+      goto logout;
+    }
+
+  if (!stricmp ("create", mode))
+    {
+      if (folder_id && strlen (folder_id) > 0)
+		snprintf (message, sizeof (message), "3 CREATE \"%s\"", folder_id);
+      else
+	{
+	  strcpy_ck (err_code, "IM015");
+	  strcpy_ck (err_text, "There must be folder name to create (6th argument)");
+	  goto logout;
+	}
+      SEND (ses, rc, message, "");
+      while (1)
+	{
+	  IS_OK_NEXT (ses, resp, rc, "IM016", "CREATE command to remote IMAP server failed", 1);
+	  if (strlen (resp) > 2 && !strncmp ("3 OK", resp, 4))
+	    break;
+	  if (strlen (resp) > 2 && !strncmp ("3 BAD", resp, 5))
+	    {
+	      strcpy_ck (err_code, "IM017");
+	      strcpy_ck (err_text, "Error during creation");
+	      break;
+	    }
+	  if (strlen (resp) > 2 && !strncmp ("3 NO", resp, 4))
+	    {
+	      strcpy_ck (err_code, "IM018");
+	      strcpy_ck (err_text, "Folder does not exist");
+	      break;
+	    }
+	}
+      goto logout;
+    }
+
+  /* list all messages' headers from selected folder */
+  if (!stricmp ("select", mode) || !stricmp ("expunge", mode))
+    {
+      if (folder_id && strlen (folder_id) > 0)
+		snprintf (message, sizeof (message), "4 SELECT \"%s\"", folder_id);
+      else
+		snprintf (message, sizeof (message), "4 SELECT \"INBOX\"");
+      SEND (ses, rc, message, "");
+      while (1)
+	{
+	  IS_OK_NEXT (ses, resp, rc, "IM019", "SELECT command to remote IMAP server failed", 1);
+	  ps = resp;
+	  s = imap_next_word (ps);
+	  ps = imap_next_word (s);
+	  if (ascii_strncasecmp ("EXISTS", ps, 6) == 0)
+	    inx_mails = atoi (s);
+	  if (strlen (resp) > 2 && !strncmp ("4 OK", resp, 4))
+	    break;
+	}
+      if (!stricmp ("expunge", mode))
+	{
+	  snprintf (message, sizeof (message), "5 EXPUNGE");
+	  SEND (ses, rc, message, "");
+	  while (1)
+	    {
+	      IS_OK_NEXT (ses, resp, rc, "IM020", "EXPUNGE command to remote IMAP server failed", 1);
+	      if (strlen (resp) > 2 && !strncmp ("5 OK", resp, 4))
+		break;
+	      if (strlen (resp) > 2 && !strncmp ("5 BAD", resp, 5))
+		{
+		  strcpy_ck (err_code, "IM021");
+		  strcpy_ck (err_text, "Error during deletion");
+		  break;
+		}
+	      if (strlen (resp) > 2 && !strncmp ("5 NO", resp, 4))
+		{
+		  strcpy_ck (err_code, "IM022");
+		  strcpy_ck (err_text, "Folder does not exist");
+		  break;
+		}
+	    }
+	  goto logout;
+	}
+      if (inx_mails > 0)
+	{
+	  SEND (ses, rc,
+	      "5 FETCH 1:* (UID FLAGS INTERNALDATE RFC822.SIZE BODY.PEEK[HEADER.FIELDS (DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL)])",
+	      "");
+	  while (1)
+	    {
+	      message_begin = 0;
+	      strses_flush (msg);
+	      strses_enable_paging (msg, http_ses_size);
+	      strses_flush (msg2);
+	      strses_enable_paging (msg2, http_ses_size);
+	      CATCH_READ_FAIL (ses)
+	      {
+		rc = dks_read_line (ses, resp, sizeof (resp));
+		if (strlen (resp) > 2 && !strncmp ("5 OK", resp, 4))
+		  break;
+		while (strncmp (end_msg, resp, sizeof (end_msg)))
+		  {
+		    ps = resp;
+		    if (!message_begin)
+		      {
+			message_begin = 1;
+			ps = imap_next_word (ps);
+			ps = imap_next_word (ps);
+			if (!ascii_strncasecmp ("FETCH", ps, 5))
+			  {
+			    ps = imap_next_word (ps);
+			    if (ps[0] == '(')
+			      ps++;
+			    if (ascii_strncasecmp ("UID", ps, 3) == 0)
+			      {
+				ps = imap_next_word (ps);
+				uid = atoi (ps);
+				ps = imap_next_word (ps);
+				SES_PRINT (msg2, ps);
+				if (tcpses_check_disk_error (msg2, qst, 0))
+				  {
+				    strcpy_ck (err_text, "Server error in accessing temp file");
+				    strcpy_ck (err_code, "IM024");
+				    SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+				    goto logout;
+				  }
+				goto next_statement;
+			      }
+			  }
+			else
+			  {
+			    strcpy_ck (err_text, "Some error");
+			    strcpy_ck (err_code, "IM023");
+			    SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+			    goto logout;
+			  }
+		      }
+		    SES_PRINT (msg, ps);
+		    if (tcpses_check_disk_error (msg, qst, 0))
+		      {
+			strcpy_ck (err_text, "Server error in accessing temp file");
+			strcpy_ck (err_code, "IM024");
+			SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+			goto logout;
+		      }
+		  next_statement:
+		    rc = dks_read_line (ses, resp, sizeof (resp));
+		  }
+		session_flush_1 (msg);
+		session_flush_1 (msg2);
+		if (tcpses_check_disk_error (msg, NULL, 0) || tcpses_check_disk_error (msg2, NULL, 0))
+		  {
+		    strcpy_ck (err_text, "Server error in accessing temp file");
+		    strcpy_ck (err_code, "IM025");
+		    SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+		    goto logout;
+		  }
+		if (!STRSES_CAN_BE_STRING (msg) || !STRSES_CAN_BE_STRING (msg2))
+		  {
+		    strcpy_ck (err_text, "Server error in storing data into a string session");
+		    strcpy_ck (err_code, "IM026");
+		    SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+		    goto logout;
+		  }
+		dk_set_push (ret_v, list (3, uid, strses_string (msg2), strses_string (msg)));
+	      }
+	      FAILED
+	      {
+		strcpy_ck (err_code, "IM027");
+		strcpy_ck (err_text, "Failed reading output of FETCH command on remote IMAP server");
+		goto error_end;
+	      }
+	      END_READ_FAIL (ses);
+	    }
+	}
+      goto logout;
+    }
+  /* rename folder */
+  if (!stricmp ("rename", mode))
+    {
+      volatile int l;
+      dtp_t type1, type2;
+      if (in)
+	l = BOX_ELEMENTS (in);
+      if (l != 2)
+	{
+	  strcpy_ck (err_code, "IM028");
+	  strcpy_ck (err_text, "There must be 2 string items in vector of argument 7 (old folder name to rename and a new name)");
+	  goto logout;
+	}
+      type1 = DV_TYPE_OF (in[0]);
+      type2 = DV_TYPE_OF (in[1]);
+      if (!IS_STRING_DTP (type1) || !IS_STRING_DTP (type2))
+	{
+	  strcpy_ck (err_code, "IM029");
+	  strcpy_ck (err_text, "There must be 2 string items in vector of argument 7 (old folder name to rename and a new name)");
+	  goto logout;
+	}
+		snprintf (message, sizeof (message), "4 RENAME \"%s\" \"%s\"", in[0], in[1]);
+      SEND (ses, rc, message, "");
+      while (1)
+	{
+	  IS_OK_NEXT (ses, resp, rc, "IM030", "RENAME command to remote IMAP server failed", 1);
+	  if (strlen (resp) > 2 && !strncmp ("4 OK", resp, 4))
+	    break;
+	  if (strlen (resp) > 2 && (!strncmp ("4 BAD", resp, 5) || !strncmp ("4 NO", resp, 4)))
+	    {
+	      strcpy_ck (err_code, "IM031");
+	      strcpy_ck (err_text, "Re-naming failed");
+	      goto logout;
+	      break;
+	    }
+	}
+      goto logout;
+    }
+
+  /*  manipuation with select messages in selected folder */
+  if (!stricmp ("fetch", mode) || !stricmp ("message_delete", mode) || !stricmp ("message_copy", mode))
+    {
+      if (folder_id && strlen (folder_id) > 0)
+		snprintf (message, sizeof (message), "4 SELECT \"%s\"", folder_id);
+      else
+	snprintf (message, sizeof (message), "4 SELECT INBOX");
+      SEND (ses, rc, message, "");
+      while (1)
+	{
+	  IS_OK_NEXT (ses, resp, rc, "IM032", "SELECT command to remote IMAP server failed", 1);
+	  ps = resp;
+	  s = imap_next_word (ps);
+	  ps = imap_next_word (s);
+	  if (ascii_strncasecmp ("EXISTS", ps, 6) == 0)
+	    inx_mails = atoi (s);
+	  if (strlen (resp) > 2 && !strncmp ("4 OK", resp, 4))
+	    break;
+	}
+      if (inx_mails > 0)
+	{
+	  volatile int l, br;
+	  int start = 0;
+	  dtp_t type;
+	  if (in)
+	    l = BOX_ELEMENTS (in);
+	  if (l < 1)
+	    {
+	      strcpy_ck (err_text, "No messages in list");
+	      strcpy_ck (err_code, "IM033");
+	      SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+	      goto logout;
+	    }
+	  if (!stricmp ("message_copy", mode))
+	    {
+	      target_folder_id = in[0];
+	      start = 1;
+	    }
+	  for (br = start; br < l; br++)
+	    {
+	      type = DV_TYPE_OF (in[br]);
+	      if (!IS_INT_DTP (type))
+		{
+		  strcpy_ck (err_code, "IM034");
+		  strcpy_ck (err_text, "There must be integer items in vector of argument 7");
+		  goto logout;
+		}
+	      if (!stricmp ("fetch", mode))
+					snprintf (message, sizeof (message), "5 UID FETCH %d BODY.PEEK[]", (int)(in[br]));
+	      if (!stricmp ("message_delete", mode))
+					snprintf (message, sizeof (message), "5 UID STORE %d +FLAGS (\\Deleted)", (int)(in[br]));
+	      if (!stricmp ("message_copy", mode))
+					snprintf (message, sizeof (message), "5 UID COPY %d \"%s\"", (int)(in[br]), target_folder_id);
+	      SEND (ses, rc, message, "");
+	      while (1)
+		{
+		  message_begin = 0;
+		  strses_flush (msg);
+		  strses_enable_paging (msg, http_ses_size);
+		  CATCH_READ_FAIL (ses)
+		  {
+		    rc = dks_read_line (ses, resp, sizeof (resp));
+		    if (strlen (resp) > 2 && !strncmp ("5 OK", resp, 4))
+		      break;
+		    if (strlen (resp) > 2 && !strncmp ("5 BAD", resp, 5))
+		      {
+			strcpy_ck (err_text, "Error in IMAP command UID STORE");
+			strcpy_ck (err_code, "IM035");
+			break;
+		      }
+		    if (strlen (resp) > 2 && !strncmp ("5 NO", resp, 4))
+		      {
+			strcpy_ck (err_text, "Error in IMAP command UID STORE");
+			strcpy_ck (err_code, "IM036");
+			break;
+		      }
+		    while (strncmp (end_msg, resp, sizeof (end_msg)))
+		      {
+			ps = resp;
+			if (!message_begin)
+			  {
+			    message_begin = 1;
+			    ps = imap_next_word (ps);
+			    ps = imap_next_word (ps);
+			    if (!ascii_strncasecmp ("FETCH", ps, 5))
+			      {
+				ps = imap_next_word (ps);
+				if (ps[0] == '(')
+				  ps++;
+				if (ascii_strncasecmp ("UID", ps, 3) == 0)
+				  {
+				    ps = imap_next_word (ps);
+				    uid = atoi (ps);
+				  }
+			      }
+			    else
+			      {
+				strcpy_ck (err_text, "Some error");
+				strcpy_ck (err_code, "IM037");
+				SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+				goto logout;
+			      }
+			    if (!stricmp ("message_delete", mode) || !stricmp ("message_copy", mode))
+			      break;
+			    goto next_message;
+			  }
+			SES_PRINT (msg, ps);
+			if (tcpses_check_disk_error (msg, qst, 0))
+			  {
+			    strcpy_ck (err_text, "Server error in accessing temp file");
+			    strcpy_ck (err_code, "IM038");
+			    SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+			    goto logout;
+			  }
+		      next_message:
+			rc = dks_read_line (ses, resp, sizeof (resp));
+		      }
+		    session_flush_1 (msg);
+		    if (tcpses_check_disk_error (msg, NULL, 0))
+		      {
+			strcpy_ck (err_text, "Server error in accessing temp file");
+			strcpy_ck (err_code, "IM039");
+			SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+			goto logout;
+		      }
+		    if (!STRSES_CAN_BE_STRING (msg))
+		      {
+			strcpy_ck (err_text, "Server error in storing data into a string session");
+			strcpy_ck (err_code, "IM040");
+			SESSION_SCH_DATA (ses)->sio_read_fail_on = 0;
+			goto logout;
+		      }
+		    dk_set_push (ret_v, list (2, uid, strses_string (msg)));
+		  }
+		  FAILED
+		  {
+		    strcpy_ck (err_code, "IM041");
+		    strcpy_ck (err_text, "Failed reading output of FETCH command on remote IMAP server");
+		    goto error_end;
+		  }
+		  END_READ_FAIL (ses);
+		}
+	    }
+	}
+      goto logout;
+    }
+  else if (strlen (mode) > 0 && stricmp ("", mode))
+    {
+      strcpy_ck (err_code, "IM042");
+      strcpy_ck (err_text, "No such command (5th parameter) in protocol");
+      *err_ret = srv_make_new_error ("08006", err_code, "%s: %s", err_text, mode);
+    }
+logout:
+  /* QUIT from pop3 server */
+  SEND (ses, rc, "9 LOGOUT", "");
+  while (1)
+    {
+      IS_OK_NEXT (ses, resp, rc, "IM043", "Could not LOGOUT from remote IMAP server", 0);
+      if (strlen (resp) > 2 && !strncmp ("9 OK", resp, 4))
+	break;
+    }
+error_end:
+  if (err_code[0] != 0)
+    *err_ret = srv_make_new_error ("08006", err_code, "%s", err_text);
+  strses_free (msg);
+  strses_free (msg2);
+  PrpcDisconnect (ses);
+  PrpcSessionFree (ses);
+  SSL_CTX_free (ssl_ctx);
+  return;
+  /* *err_ret = srv_make_new_error ("08006", "IM044", "Misc. error in connection in imap_get"); */
+}
+
+static caddr_t
+bif_imap_get (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  caddr_t *in_uidl = NULL;
+  caddr_t folder_id = NULL;
+  caddr_t addr = bif_string_arg (qst, args, 0, "imap_get");
+  caddr_t user = bif_string_arg (qst, args, 1, "imap_get");
+  caddr_t pass = bif_string_arg (qst, args, 2, "imap_get");
+  long end_size = (long) bif_long_arg (qst, args, 3, "imap_get");
+  caddr_t ret = NULL;
+  caddr_t mode = "";
+  caddr_t err = NULL;
+  long cert = 0;
+  dk_set_t volatile uidl_mes = NULL;
+  IO_SECT (qst);
+  if (BOX_ELEMENTS (args) > 4)
+    mode = bif_string_arg (qst, args, 4, "imap_get");
+  if (BOX_ELEMENTS (args) > 5)
+    folder_id = bif_string_arg (qst, args, 5, "imap_get");
+  if (BOX_ELEMENTS (args) > 6)
+    {
+      in_uidl = (caddr_t *) bif_array_or_null_arg (qst, args, 6, "imap_get");
+      if (in_uidl && DV_TYPE_OF (in_uidl) != DV_ARRAY_OF_POINTER)
+	sqlr_new_error ("08000", "IM013", "Argument 7 to imap_get must be a vector");
+    }
+  if (BOX_ELEMENTS (args) > 7)
+    cert = bif_long_arg (qst, args, 7, "imap_get");
+  imap_get (addr, &err, user, pass, end_size, mode, (dk_set_t *) & uidl_mes, folder_id, in_uidl, qst, cert);
+  if (err)
+    {
+      dk_free_tree (list_to_array (uidl_mes));
+      uidl_mes = NULL;
+      sqlr_resignal (err);
+    }
+  END_IO_SECT (err_ret);
+  ret = list_to_array (dk_set_nreverse (uidl_mes));
+  if (*err_ret)
+    {
+      dk_free_tree (ret);
+      ret = NULL;
+    }
+  return ret;
+}
+
+void
+bif_imap_init (void)
+{
+  bif_define_typed ("imap_get", bif_imap_get, &bt_varchar);
+}
diff --git a/libsrc/Wi/bif_intl.c b/libsrc/Wi/bif_intl.c
index ae626d9..3a481de 100644
--- a/libsrc/Wi/bif_intl.c
+++ b/libsrc/Wi/bif_intl.c
@@ -1,7 +1,7 @@
 /*
  *  bif_intl.c
  *
- *  $Id: bif_intl.c,v 1.11.2.4 2010/02/03 10:29:47 source Exp $
+ *  $Id: bif_intl.c,v 1.11.2.8 2011/01/28 13:32:49 source Exp $
  *
  *  Internationalization functions
  *
@@ -38,6 +38,7 @@
 #include "multibyte.h"
 #include "srvmultibyte.h"
 #include "xml.h"
+#include "security.h"
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -535,7 +536,10 @@ bif_uname (caddr_t *qst, caddr_t *err_ret, state_slot_t ** args)
     default:
     case 3: allow_long = bif_long_arg (qst, args, 2, "uname");
     case 2: cs1_name = bif_string_or_null_arg (qst, args, 1, "uname");
-    case 1: break;
+    case 1:
+      if (DV_UNAME == dtp)
+        return box_copy (narrow);
+      break;
     }
   cs1_uname = cs1_name ? sqlp_box_upcase (cs1_name) : NULL;
 
@@ -1029,6 +1033,15 @@ bif_dbg_assert_encoding (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return box_copy_tree (box);
 }
 
+static
+caddr_t
+bif_dbg_set_lh_xany_normalization_flags (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  sec_check_dba ((query_instance_t *)qst, "dbg_set_lh_xany_normalization_flags");
+  lh_xany_normalization_flags = bif_long_arg (qst, args, 0, "dbg_set_lh_xany_normalization_flags");
+  return box_num (lh_xany_normalization_flags);
+}
+
 wcharset_t *
 wcharset_by_name_or_dflt (ccaddr_t cs_name, query_instance_t *qi)
 {
@@ -1101,7 +1114,6 @@ get_q_of_lang_in_http_accept_language (const char *lang, const char *line)
         }
 garbage_after_q:
       while ((' ' <= tail[0]) && (',' != tail[0])) tail++;
-q_done:
       match_weight = lang_match_to_accept_language_range (lang, key, key_end);
       if (match_weight > best_match_weight)
         {
@@ -1150,6 +1162,7 @@ bif_intl_init (void)
   bif_define ("set_utf8_output", bif_set_utf8_output);
 #endif
   bif_define ("dbg_assert_encoding", bif_dbg_assert_encoding);
+  bif_define ("__dbg_set_lh_xany_normalization_flags", bif_dbg_set_lh_xany_normalization_flags);
   bif_define_typed ("langmatches_pct_http", bif_langmatches_pct_http, &bt_integer);
 }
 
diff --git a/libsrc/Wi/bif_ldapcli.c b/libsrc/Wi/bif_ldapcli.c
index f289c4f..232a0f3 100644
--- a/libsrc/Wi/bif_ldapcli.c
+++ b/libsrc/Wi/bif_ldapcli.c
@@ -1,7 +1,7 @@
 /*
  *  bif_ldapcli.c
  *
- *  $Id: bif_ldapcli.c,v 1.3.2.1 2009/04/18 21:55:10 source Exp $
+ *  $Id: bif_ldapcli.c,v 1.3.2.2 2011/01/10 11:51:54 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -455,7 +455,7 @@ ldap_print_sresult (LDAP *ld, dk_set_t * s)
 	      case LDAP_RES_SEARCH_REFERENCE:
 		    { /* 'reference', (<ref>, ...) */
 		      char **refs = NULL;
-		      LDAPControl **ctrls;
+		      LDAPControl **ctrls = NULL;
 		      int rc, i;
 		      dk_set_t p = NULL;
 		      rc = LDAP_PARSE_REFERENCE (ld, msg, &refs, &ctrls, 0);
diff --git a/libsrc/Wi/bif_pop3.c b/libsrc/Wi/bif_pop3.c
index e4fda3b..770cbf5 100644
--- a/libsrc/Wi/bif_pop3.c
+++ b/libsrc/Wi/bif_pop3.c
@@ -1,7 +1,7 @@
 /*
  *  bif_pop3.c
  *
- *  $Id: bif_pop3.c,v 1.6.2.1 2009/04/18 21:55:10 source Exp $
+ *  $Id: bif_pop3.c,v 1.6.2.2 2010/08/02 11:20:51 source Exp $
  *
  *  POP3 client function
  *
@@ -72,9 +72,9 @@ is_ok (char *resp)
 }
 
 
-static dk_session_t *
+static void
 pop3_get (char *host, caddr_t * err_ret, caddr_t user, caddr_t pass,
-    long end_size, caddr_t mode, dk_set_t * ret_v, caddr_t * in, caddr_t *qst)
+    long end_size, caddr_t mode, dk_set_t * ret_v, caddr_t * in, caddr_t *qst, long cert)
 {
   int rc;
   volatile int inx, inx_mails;
@@ -84,11 +84,16 @@ pop3_get (char *host, caddr_t * err_ret, caddr_t user, caddr_t pass,
   caddr_t * volatile my_list = NULL;
   dk_session_t *ses = dk_session_allocate (SESCLASS_TCPIP);
   char num[11], resp[1024];
-  char message[16], err_text[64], err_code[6];
+  char message[16], err_text[512], err_code[6];
   char end_msg[5] = ".\x0D\x0A\x00";
   dk_session_t *msg = NULL;
+#ifdef _SSL
+  SSL *ssl;
+  SSL_CTX *ssl_ctx = NULL;
+  SSL_METHOD *ssl_method;
+#endif
 
-  resp[0] = 0;
+  resp[0] = 0; err_code[0] = 0;
   if (!_thread_sched_preempt)
     {
       ses->dks_read_block_timeout = dks_fibers_blocking_read_default_to;
@@ -98,7 +103,7 @@ pop3_get (char *host, caddr_t * err_ret, caddr_t user, caddr_t pass,
     {
       PrpcSessionFree (ses);
       *err_ret = srv_make_new_error ("2E000", "PO001", "Cannot resolve host in pop3_get");
-      return NULL;
+      return;
     }
 
   rc = session_connect (ses->dks_session);
@@ -108,7 +113,28 @@ pop3_get (char *host, caddr_t * err_ret, caddr_t user, caddr_t pass,
 	session_disconnect (ses->dks_session);
       PrpcSessionFree (ses);
       *err_ret = srv_make_new_error ("08001", "PO002", "Cannot connect in pop3_get");
-      return NULL;
+      return;
+    }
+  if (cert)
+    {
+      int ssl_err = 0;
+      int fd = tcpses_get_fd (ses->dks_session);
+      ssl_method = SSLv23_client_method ();
+      ssl_ctx = SSL_CTX_new (ssl_method);
+      ssl = SSL_new (ssl_ctx);
+      SSL_set_fd (ssl, fd);
+      ssl_err = SSL_connect (ssl);
+      if (ssl_err != 1)
+	{
+	  strcpy_ck (err_code, "08006");
+	  if (ERR_peek_error ())
+	    cli_ssl_get_error_string (err_text, sizeof (err_text));
+	  else
+	    strcpy_ck (err_text, "Cannot connect via SSL");
+	  goto error_end;
+	}
+      else
+	tcpses_to_sslses (ses->dks_session, ssl);
     }
 
   msg = strses_allocate ();
@@ -299,22 +325,32 @@ pop3_get (char *host, caddr_t * err_ret, caddr_t user, caddr_t pass,
   /* QUIT from pop3 server */
   SEND (ses, rc, "QUIT", "");
   IS_OK_NEXT (ses, resp, rc, "PO012", "Could not QUIT from remote POP3 server");
+
   strses_free (msg);
   dk_free_tree ((box_t) my_list);
-  return ses;
-error_end:
-  session_disconnect (ses->dks_session);
+  PrpcDisconnect (ses);
   PrpcSessionFree (ses);
+  SSL_CTX_free (ssl_ctx);
+  return;
+
+error_end:
+
   strses_free (msg);
   dk_free_tree ((box_t) my_list);
+  PrpcDisconnect (ses);
+  PrpcSessionFree (ses);
+  SSL_CTX_free (ssl_ctx);
+
+  if (err_code[0] != 0)
   *err_ret = srv_make_new_error ("08006", err_code, "%s", err_text);
-  return NULL;
+  else
+    *err_ret = srv_make_new_error ("08006", "PO014", "Misc. error in connection in pop3_get");
+  return;
 }
 
 static caddr_t
 bif_pop3_get (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
-  dk_session_t *ses = NULL;
   caddr_t * in_uidl = NULL;
   caddr_t addr = bif_string_arg (qst, args, 0, "pop3_get");
   caddr_t user = bif_string_arg (qst, args, 1, "pop3_get");
@@ -324,6 +360,7 @@ bif_pop3_get (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 
   caddr_t mode = "";
   caddr_t err = NULL;
+  long cert = 0;
   dk_set_t volatile uidl_mes = NULL;
   IO_SECT(qst);
 
@@ -332,14 +369,15 @@ bif_pop3_get (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 
   if (BOX_ELEMENTS (args) > 5)
     {
-      in_uidl = (caddr_t *) bif_array_arg (qst, args, 5, "pop3_get");
+      in_uidl = (caddr_t *) bif_array_or_null_arg (qst, args, 5, "pop3_get");
 
-      if (DV_TYPE_OF (in_uidl) != DV_ARRAY_OF_POINTER)
-	sqlr_new_error ("08000", "PO013",
-			"Argument 6 to pop3_get must be a vector");
+      if (in_uidl && DV_TYPE_OF (in_uidl) != DV_ARRAY_OF_POINTER)
+	sqlr_new_error ("08000", "PO013", "Argument 6 to pop3_get must be a vector");
     }
+  if (BOX_ELEMENTS (args) > 6)
+    cert = bif_long_arg (qst, args, 6, "pop3_get");
 
-  ses = pop3_get (addr, &err, user, pass, end_size, mode, (dk_set_t *) &uidl_mes, in_uidl, qst);
+  pop3_get (addr, &err, user, pass, end_size, mode, (dk_set_t *) &uidl_mes, in_uidl, qst, cert);
 
   if (err)
     {
@@ -347,14 +385,6 @@ bif_pop3_get (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
       uidl_mes = NULL;
       sqlr_resignal (err);
     }
-  if (!ses)
-    {
-      dk_free_tree (list_to_array (uidl_mes));
-      uidl_mes = NULL;
-      sqlr_new_error ("08006", "PO014", "Misc. error in connection in pop3_get");
-    }
-  session_disconnect (ses->dks_session);
-  PrpcSessionFree (ses);
   END_IO_SECT (err_ret);
   ret = list_to_array (dk_set_nreverse (uidl_mes));
   if (*err_ret)
diff --git a/libsrc/Wi/bif_soap.c b/libsrc/Wi/bif_soap.c
index 9b4e123..5764d5a 100644
--- a/libsrc/Wi/bif_soap.c
+++ b/libsrc/Wi/bif_soap.c
@@ -1,7 +1,7 @@
 /*
  *  bif_soap.c
  *
- *  $Id: bif_soap.c,v 1.26.2.7 2010/06/12 12:57:17 source Exp $
+ *  $Id: bif_soap.c,v 1.26.2.9 2010/11/15 10:13:33 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -57,6 +57,12 @@
 #define WSS_WSU_URI 	"http://schemas.xmlsoap.org/ws/2002/07/utility"
 #endif
 
+#ifdef SOAP_USES_TYPES
+#error "soaptypes build option is no longer needed in $HOME/Makeconfig"
+#endif
+
+#define SOAP_USES_TYPES ((soap_version) >= 11 && (!ctx || !ctx->def_enc))
+
 #define WSP_URI		"http://schemas.xmlsoap.org/ws/2002/12/policy"
 #define WSRM_URI 	"http://schemas.xmlsoap.org/ws/2003/03/rm"
 #define WSA_URI 	"http://schemas.xmlsoap.org/ws/2003/03/addressing"
@@ -1304,7 +1310,6 @@ soap_box_xml_entity (caddr_t *entity, caddr_t *err_ret, dtp_t proposed_type, int
     }
 }
 
-#define SOAP_USES_TYPES ((soap_version) >= 11 && (!ctx || !ctx->def_enc))
 static caddr_t
 soap_print_box (caddr_t object, dk_session_t *out, const char *tag, int soap_version,
     		const char * h_namespace, dtp_t obj_type, soap_ctx_t * ctx)
@@ -3941,6 +3946,12 @@ ws_soap (ws_connection_t * ws, int soap_version, caddr_t method_fld)
 
   if (!err)
     {
+      if (NULL == req_xml)
+	{
+	  err = ws_soap_error (ws->ws_strses, "300", "SOAPS", "Can\'t read the SOAP request",
+	      soap_version, uddi_action, &http_resp_code, NULL);
+	  goto end;
+	}
       /* In the following call of xml_make_tree() query_instance_t * is not needed: req_xml is non-BLOB. */
       if (DO_LOG(LOG_SOAP))
 	{
@@ -11406,8 +11417,7 @@ ws_soap_http (ws_connection_t * ws)
 #ifdef SOAP_HTTP
       else
 	{
-	  snprintf (mime_type, sizeof (mime_type), "Content-Type: text/xml; charset=\"%s\"\r\n", CHARSET_NAME (charset,
-		  "ISO-8859-1"));
+	  snprintf (mime_type, sizeof (mime_type), "Content-Type: text/xml; charset=\"%s\"\r\n", CHARSET_NAME (charset, "ISO-8859-1"));
 	  ws->ws_header = box_dv_short_string (mime_type);
 	}
 #endif
diff --git a/libsrc/Wi/bif_text.c b/libsrc/Wi/bif_text.c
index 9f6639a..fb07856 100644
--- a/libsrc/Wi/bif_text.c
+++ b/libsrc/Wi/bif_text.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: bif_text.c,v 1.12.2.12 2010/03/08 12:04:11 source Exp $
+ *  $Id: bif_text.c,v 1.12.2.15 2011/03/14 15:46:28 source Exp $
  *
  *  Bifs for text index
  *
@@ -279,6 +279,7 @@ vt_noise_word_init (char *file, id_hash_t ** noise_ht)
       res |= lh_iterate_patched_words (eh, lh, nw, tail - nw, lh->lh_is_vtb_word, lh->lh_tocapital_word, noise_word_init_callback, (void *) (future_noise_words));
       res |= lh_iterate_patched_words (eh, lh, nw, tail - nw, lh->lh_is_vtb_word, lh->lh_toupper_word, noise_word_init_callback, (void *) (future_noise_words));
       res |= lh_iterate_patched_words (eh, lh, nw, tail - nw, lh->lh_is_vtb_word, lh->lh_tolower_word, noise_word_init_callback, (void *) (future_noise_words));
+      res |= lh_iterate_patched_words (eh, lh, nw, tail - nw, lh->lh_is_vtb_word, lh->lh_normalize_word, noise_word_init_callback, (void *) (future_noise_words));
       if (res)
 	log_error ("Broken text in noise.txt file, (encoding \"%s\"): %s", eh->eh_names[0], nw);
     }
@@ -1241,7 +1242,7 @@ bif_vt_batch_feed (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 	}
       return NULL;
     }
-  if (dtp == DV_BLOB_HANDLE)
+  if (dtp == DV_BLOB_HANDLE || dtp == DV_BLOB_BIN)
     {
       is_serialized_xml = blob_looks_like_serialized_xml (qi, (blob_handle_t *)(str));
       if (XE_XPER_SERIALIZATION == is_serialized_xml)
@@ -1297,7 +1298,7 @@ bif_vt_batch_feed (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
       temp_str = strses_string ((dk_session_t *) str);
       goto process_string;
     }
-  if (!DV_STRINGP (str))
+  if (!DV_STRINGP (str) && dtp != DV_BIN)
     return NULL;
 process_string:
   if (temp_str)
@@ -1461,14 +1462,22 @@ vtb_wordump (vt_batch_t * vtb, dk_session_t * ses)
 
 
 caddr_t
-vtb_strings (vt_batch_t * vtb, dk_session_t * ses)
+vtb_strings (vt_batch_t * vtb, dk_session_t * ses, caddr_t * err_ret)
 {
   word_batch_t * wb;
   int fill = 0;
   lenmem_t *lm;
-  caddr_t * res = (caddr_t*) dk_alloc_box
-    (sizeof (caddr_t) * 2 * vtb->vtb_words->ht_inserts, DV_ARRAY_OF_POINTER);
+  caddr_t * res;
+  size_t ret_len = sizeof (caddr_t) * 2 * vtb->vtb_words->ht_inserts;
   id_hash_iterator_t hit;
+
+  if (ret_len >= MAX_BOX_LENGTH)
+    {
+      if (err_ret)
+	err_ret [0] = srv_make_new_error ("22023", "FT...", "The result array too large");
+      return NULL;
+    }
+  res = (caddr_t*) dk_alloc_box (ret_len, DV_ARRAY_OF_POINTER);
   if (vtb->vtb_strings_taken)
     id_hash_clear (vtb->vtb_words);
   id_hash_iterator (&hit, vtb->vtb_words);
@@ -1528,7 +1537,7 @@ bif_vt_batch_strings (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 	    "vt_batch_strings needs a string_output as a second argument, not an argument of type %s (%d)",
 	    dv_type_title (out_dtp), out_dtp);
     }
-  return (vtb_strings (vtb, out));
+  return (vtb_strings (vtb, out, err_ret));
 }
 
 /*caddr_t
@@ -1544,7 +1553,7 @@ caddr_t
 bif_vt_batch_strings_array (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   vt_batch_t * vtb = bif_vtb_arg (qst, args, 0, "vt_batch_strings_array");
-  caddr_t *words = (caddr_t *)vtb_strings (vtb, NULL);
+  caddr_t *words = (caddr_t *)vtb_strings (vtb, NULL, err_ret);
   return (caddr_t)(words);
 }
 
@@ -1690,7 +1699,7 @@ vtb_destroy (vt_batch_t * vtb)
   if (vtb->vtb_ref_count)
     return 1;
   if (vtb->vtb_words->ht_inserts)
-    dk_free_tree (vtb_strings (vtb, NULL));
+    dk_free_tree (vtb_strings (vtb, NULL, NULL));
   id_hash_free (vtb->vtb_words);
   dk_free_box (vtb->vtb_min_word.lm_memblock);
   dk_free_box (vtb->vtb_max_word.lm_memblock);
diff --git a/libsrc/Wi/bif_tidy.c b/libsrc/Wi/bif_tidy.c
index d01dcbc..a219211 100644
--- a/libsrc/Wi/bif_tidy.c
+++ b/libsrc/Wi/bif_tidy.c
@@ -1,7 +1,7 @@
 /*
  *  bif_tidy.c
  *
- *  $Id: bif_tidy.c,v 1.2.2.1 2009/04/18 21:55:10 source Exp $
+ *  $Id: bif_tidy.c,v 1.2.2.4 2011/02/18 10:37:24 source Exp $
  *
  *  Build in Functions for tidying HTML pages
  *
@@ -38,7 +38,8 @@
 #ifdef OLD_TIDY
 #include "html.h"
 #else
-#include "tidy.h"
+#include <tidy/tidy.h>
+#include <tidy/buffio.h>
 #endif
 #ifndef WIN32
 #undef __USE_MISC
@@ -46,6 +47,106 @@
 
 static dk_mutex_t *tidy_mtx;
 
+#ifndef OLD_TIDY
+static void *
+tidy_malloc (size_t len)
+{
+  if (len >= MAX_BOX_LENGTH)
+    return NULL;
+  return t_alloc_box (len, DV_CUSTOM);
+}
+
+static void *
+tidy_realloc (void * buf, size_t len)
+{
+  int buf_size = IS_BOX_POINTER (buf) ? box_length (buf) : 0;
+  int copy_size = buf_size > len ? len : buf_size;
+  void *new;
+  if (len >= MAX_BOX_LENGTH)
+    return NULL;
+  new = t_alloc_box (len, DV_CUSTOM);
+  if (buf && copy_size)
+    memcpy (new, buf, copy_size);
+  return new;
+}
+
+static void
+tidy_free (void * buf)
+{
+  /* void, will release on MP_DONE */
+}
+
+static void
+tidy_panic (const char * err)
+{
+  /* log_error ("Tidy panic: %s", err); */
+  sqlr_new_error ("42000", "TIDYE", "Tidy panic: %s", err);
+}
+
+#define READING_NAME 1
+#define READING_VALUE 2
+
+static int
+tidy_parse_config (TidyDoc doc, caddr_t config_str)
+{
+  dk_session_t * ses;
+  volatile int rc = -1, i = 0;
+  char name[64] = {0}, value[8192] = {0}, stat = READING_NAME;
+
+  ses = strses_allocate ();
+  ses->dks_in_buffer = config_str;
+  ses->dks_in_fill = box_length (config_str) - 1;
+
+  CATCH_READ_FAIL (ses)
+    {
+      char c;
+      for (;;)
+	{
+	  c = session_buffered_read_char (ses);
+	  if (READING_VALUE == stat && (c == '\r' || c == '\n'))
+	    {
+	      value[i] = 0;
+	      rc = tidyOptParseValue (doc, name, value);
+	      i = 0;
+	      stat = READING_NAME;
+	      continue;
+	    }
+	  if (isspace (c))
+	    continue;
+	  if (READING_NAME == stat && c == ':') /* delimiter */
+	    {
+	      name[i] = 0;
+	      i = 0;
+	      stat = READING_VALUE;
+	      continue;
+	    }
+	  if (READING_NAME == stat)
+	    name[i++] = c;
+	  if (READING_VALUE == stat)
+	    value[i++] = c;
+	  /* check for overflow */
+	  if (READING_NAME == stat && i >= sizeof (name))
+	    break;
+	  if (READING_VALUE == stat && i >= sizeof (value))
+	    break;
+	}
+    }
+  FAILED
+    {
+      if (READING_VALUE == stat)
+	{
+	  value[i] = 0;
+	  rc = tidyOptParseValue (doc, name, value);
+	}
+    }
+  END_READ_FAIL (ses);
+
+  ses->dks_in_buffer = NULL;
+  dk_free_box (ses);
+  return 0;
+}
+#endif
+
 caddr_t
 bif_tidy_html (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
@@ -65,36 +166,56 @@ bif_tidy_html (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   mutex_leave (tidy_mtx);
   if (NULL != tidy_errout.tio_data.lm_memblock)
     dk_free (tidy_errout.tio_data.lm_memblock, -1);
-  if ((NULL == html_output) || (2 == res)) /* errors */
+  if ((NULL == html_output) || (2 == res))	/* errors */
     {
       dk_free_box (html_output);
       sqlr_new_error ("42000", "HT076", "HTML Tidy failed, try tidy_list_errors(...) to get more information");
     }
 #else
-  TidyBuffer output = {0};
-  TidyBuffer errbuf = {0};
-  tidyDoc doc = tidyCreate();
-  tidySetErrorBuffer (doc, &errbuf);
-  res = tidyLoadConfig (doc, config_input);
-  if (res >= 0)
-    res = tidyParseString (doc, input);
-  if (res >= 0)
-    res = tidyCleanAndRepair (doc);
-  if (res >= 0)
-    res = tidyRunDiagnostics (doc);
-  if (res > 1)
-    res = ( tidyOptSetBool(tdoc, TidyForceOutput, yes) ? res : -1 );
-  if (res >= 0)
-    res = tidySaveBuffer(doc, &output);
-  if (res >= 0)
-  html_output = box_dv_short_string (output.bp);
-  tidyBufFree( &output );
-  tidyBufFree( &errbuf );
-  tidyRelease( tdoc );
+  TidyBuffer output;
+  TidyBuffer errbuf;
+  TidyDoc doc;
+
+  MP_START ();
+  QR_RESET_CTX
+  {
+    doc = tidyCreate ();
+    tidyBufInit (&output);
+    tidyBufInit (&errbuf);
+    tidySetErrorBuffer (doc, &errbuf);
+    /* cannot load cfg file here, must parse the config string */
+    tidy_parse_config (doc, config_input);
+    res = tidyParseString (doc, html_input);
+    if (res >= 0)
+      res = tidyCleanAndRepair (doc);
+    if (res >= 0)
+      res = tidyRunDiagnostics (doc);
+    if (res > 1)
+      res = (tidyOptSetBool (doc, TidyForceOutput, yes) ? res : -1);
+    if (res >= 0)
+      res = tidySaveBuffer (doc, &output);
+    if (res >= 0)
+      html_output = box_dv_short_string ((char *) output.bp);
+  }
+  QR_RESET_CODE
+  {
+    caddr_t err;
+    POP_QR_RESET;
+    err = thr_get_error_code (THREAD_CURRENT_THREAD);
+    MP_DONE ();
+    sqlr_resignal (err);
+  }
+  END_QR_RESET;
+  MP_DONE ();
+  /*
+     tidyBufFree( &output );
+     tidyBufFree( &errbuf );
+     tidyRelease (doc);
+   */
   if (res < 0)
     {
       dk_free_box (html_output);
-      sqlr_error ("XTID2", "HTML Tidy failed with a severe error (%d), try tidy_list_errors(...) to get more information", res);
+      sqlr_new_error ("42000", "HT076", "HTML Tidy failed, try tidy_list_errors(...) to get more information");
     }
 #endif
   return html_output;
@@ -105,7 +226,7 @@ bif_tidy_list_errors (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   caddr_t html_input = bif_string_arg (qst, args, 0, "tidy_list_errors");
   caddr_t config_input = bif_string_arg (qst, args, 1, "tidy_list_errors");
-  caddr_t errlist;
+  caddr_t errlist = NULL;
 #ifdef OLD_TIDY
   tidy_io_t tidy_errout;
   tidy_errout.tio_data.lm_memblock = NULL;
@@ -117,42 +238,76 @@ bif_tidy_list_errors (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   errout = NULL;
   mutex_leave (tidy_mtx);
   if (NULL == tidy_errout.tio_data.lm_memblock)
-    errlist = box_dv_short_string("");
+    errlist = box_dv_short_string ("");
   else
     {
       errlist = box_dv_short_nchars (tidy_errout.tio_data.lm_memblock, tidy_errout.tio_pos);
       dk_free (tidy_errout.tio_data.lm_memblock, -1);
     }
 #else
-  TidyBuffer errbuf = {0};
-  tidyDoc doc = tidyCreate();
-  tidySetErrorBuffer (doc, &errbuf);
-  res = tidyLoadConfig (doc, config_input);
-  if (res >= 0)
-    res = tidyParseString (doc, input);
-  if (res >= 0)
-    res = tidyCleanAndRepair (doc);
-  if (res >= 0)
-    res = tidyRunDiagnostics (doc);
-  if (res > 1)
-    res = ( tidyOptSetBool(tdoc, TidyForceOutput, yes) ? res : -1 );
-  if (res >= 0)
-  errlist = box_dv_short_string (errbuf.bp);
-  tidyBufFree( &errbuf );
-  tidyRelease( tdoc );
-  if (res < 0)
-    {
-      dk_free_box (html_output);
-      sqlr_error ("XTID2", "HTML Tidy failed with a severe error (%d), try tidy_list_errors(...) to get more information", res);
-    }
+  int res = -1;
+  TidyBuffer errbuf;
+  TidyDoc doc;
+
+  MP_START ();
+  QR_RESET_CTX
+  {
+    doc = tidyCreate ();
+    tidyBufInit (&errbuf);
+    tidySetErrorBuffer (doc, &errbuf);
+    /* cannot load cfg file here, must parse the config string */
+    tidy_parse_config (doc, config_input);
+    res = tidyParseString (doc, html_input);
+    if (res >= 0)
+      res = tidyCleanAndRepair (doc);
+    if (res >= 0)
+      res = tidyRunDiagnostics (doc);
+    if (res > 1)
+      res = (tidyOptSetBool (doc, TidyForceOutput, yes) ? res : -1);
+    if (res >= 0)
+      errlist = box_dv_short_string ((char *) errbuf.bp);
+    else
+      errlist = box_dv_short_string ("");
+  }
+  QR_RESET_CODE
+  {
+    caddr_t err;
+    POP_QR_RESET;
+    err = thr_get_error_code (THREAD_CURRENT_THREAD);
+    MP_DONE ();
+    sqlr_resignal (err);
+  }
+  END_QR_RESET;
+  MP_DONE ();
+  /*
+     tidyBufFree( &errbuf );
+     tidyRelease (doc);
+   */
 #endif
   return errlist;
 }
 
+caddr_t
+bif_tidy_external (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+#ifdef OLD_TIDY
+  return box_num (0);
+#else
+  return box_num (1);
+#endif
+}
+
 int bif_tidy_init(void)
 {
   tidy_mtx = mutex_allocate ();
   bif_define ("tidy_html", bif_tidy_html);
   bif_define ("tidy_list_errors", bif_tidy_list_errors);
+  bif_define ("tidy_external", bif_tidy_external);
+#ifndef OLD_TIDY
+  tidySetMallocCall (tidy_malloc);
+  tidySetReallocCall (tidy_realloc);
+  tidySetFreeCall (tidy_free);
+  tidySetPanicCall (tidy_panic);
+#endif
   return 0;
 }
diff --git a/libsrc/Wi/bif_xml.c b/libsrc/Wi/bif_xml.c
index f0f76ec..7ce6a52 100644
--- a/libsrc/Wi/bif_xml.c
+++ b/libsrc/Wi/bif_xml.c
@@ -1,7 +1,7 @@
 /*
  *  bif_xml.c
  *
- *  $Id: bif_xml.c,v 1.31.2.11 2009/10/16 11:09:37 source Exp $
+ *  $Id: bif_xml.c,v 1.31.2.13 2010/12/13 10:23:35 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -390,6 +390,9 @@ xp_element_end (void *userdata, const char * name)
   children = CONS (current->xn_attrs, children);
   l = (caddr_t *) list_to_array (children);
   dk_set_push (&parent->xn_children, (void*) l);
+  parent->xn_n_children++;
+  if (parent->xn_n_children >= MAX_BOX_ELEMENTS)
+    xn_error (current, "The number of children elements is over the limits");
   xp->xp_current = parent;
   current->xn_parent = xp->xp_free_list;
   xp->xp_free_list = current;
@@ -403,12 +406,12 @@ xp_xslt_element (void *userdata,  char * name, vxml_parser_attrdata_t *attrdata)
 /* copy from xp_element - start */
   caddr_t boxed_name;
   xp_node_t *xn = xp->xp_free_list;
+  XP_STRSES_FLUSH (xp);
   if (NULL == xn)
     xn = dk_alloc (sizeof (xp_node_t));
   else
     xp->xp_free_list = xn->xn_parent;
   memset (xn, 0, sizeof (xp_node_t));
-  XP_STRSES_FLUSH (xp);
   xn->xn_xp = xp;
   xn->xn_parent = xp->xp_current;
   xp->xp_current = xn;
@@ -485,6 +488,9 @@ xp_xslt_element_end (void *userdata, const char * name)
   children = CONS (current->xn_attrs, children);
   l = (caddr_t *) list_to_array (children);
   dk_set_push (&parent->xn_children, (void*) l);
+  parent->xn_n_children++;
+  if (parent->xn_n_children >= MAX_BOX_ELEMENTS)
+    xn_error (current, "The number of children elements is over the limits");
   xp->xp_current = parent;
   if (current->xn_namespaces && xp->xp_namespaces)
     {
@@ -576,6 +582,9 @@ xp_entity (vxml_parser_t * parser, const char * refname, int reflen, int isparam
 	box_dv_short_nchars (refname, reflen) )
       );
   dk_set_push (&xp->xp_current->xn_children, (void*)list (1, head));
+  xp->xp_current->xn_n_children++;
+  if (xp->xp_current->xn_n_children >= MAX_BOX_ELEMENTS)
+    xn_error (xp->xp_current, "The number of children elements is over the limits");
 }
 
 void
@@ -592,6 +601,9 @@ xp_pi (vxml_parser_t * parser, const char *target, const char *data)
       (NULL != data) ?
       list (2, head, box_dv_short_string (data)) :
       list (1, head) ) );
+  xp->xp_current->xn_n_children++;
+  if (xp->xp_current->xn_n_children >= MAX_BOX_ELEMENTS)
+    xn_error (xp->xp_current, "The number of children elements is over the limits");
 }
 
 void
@@ -607,6 +619,9 @@ xp_comment (vxml_parser_t * parser, const char *text)
   else
     dk_set_push (&xp->xp_current->xn_children, (void*)
       list (1, list (1, uname__comment)) );
+  xp->xp_current->xn_n_children++;
+  if (xp->xp_current->xn_n_children >= MAX_BOX_ELEMENTS)
+    xn_error (xp->xp_current, "The number of children elements is over the limits");
 }
 
 
@@ -4277,9 +4292,11 @@ bif_vectorbld_init (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return NULL;
 }
 
+#define bif_vectorbld_acc_impl_BIT_PRESERVE_ARGS 1
+#define bif_vectorbld_acc_impl_BIT_IGNORE_NULLS 2
 
 caddr_t
-bif_vectorbld_acc_impl (caddr_t * qst, state_slot_t ** args, int preserve_args, caddr_t **acc_ptr)
+bif_vectorbld_acc_impl (caddr_t * qst, state_slot_t ** args, int flags, caddr_t **acc_ptr)
 {
   int acc_length, new_acc_length;
   int filled_count;	/* number of non-null elements in the first argument, excluding the counter */
@@ -4303,6 +4320,16 @@ bif_vectorbld_acc_impl (caddr_t * qst, state_slot_t ** args, int preserve_args,
     sqlr_new_error ("22003", "SR346", "The first argument of vectorbld_acc is not made by vectorbld_init() function");
   filled_count = (int) unbox (acc[0]);
   acc_length = BOX_ELEMENTS (acc);
+  if (flags & bif_vectorbld_acc_impl_BIT_IGNORE_NULLS)
+    {
+      new_filled_count = filled_count;
+      for (arg_inx = 1; arg_inx < argcount; arg_inx++)
+        {
+          if (DV_DB_NULL != DV_TYPE_OF (QST_GET (qst, args[arg_inx])))
+            new_filled_count++;
+        }
+    }
+  else
   new_filled_count = filled_count + argcount - 1;
   for (new_acc_length = acc_length; (new_filled_count) >= new_acc_length; new_acc_length += (new_acc_length + 1)); /* do nothing */;
   if (new_acc_length > MAX_BOX_ELEMENTS)
@@ -4322,8 +4349,11 @@ bif_vectorbld_acc_impl (caddr_t * qst, state_slot_t ** args, int preserve_args,
   dst = acc + filled_count + 1;
   for (arg_inx = 1; arg_inx < argcount; arg_inx++)
     {
-      dst[0] = QST_GET (qst, args[arg_inx]);
-      if (preserve_args)
+      caddr_t arg = QST_GET (qst, args[arg_inx]);
+      if ((flags & bif_vectorbld_acc_impl_BIT_IGNORE_NULLS) && (DV_DB_NULL == DV_TYPE_OF (arg)))
+        continue;
+      dst[0] = arg;
+      if (flags & bif_vectorbld_acc_impl_BIT_PRESERVE_ARGS)
     	dst[0] = box_try_copy_tree (dst[0], NULL);
       else
 	{
@@ -4456,9 +4486,8 @@ bif_vectorbld_concat_acc_impl (caddr_t * qst, state_slot_t ** args, int preserve
   return NULL;
 }
 
-
 caddr_t
-bif_vectorbld_final_impl (caddr_t * qst, state_slot_t ** args, int plain_return)
+bif_vectorbld_final_impl (caddr_t * qst, state_slot_t ** args, int return_bits)
 {
   caddr_t *acc = NULL, new_box;
   size_t filled_size;
@@ -4482,12 +4511,17 @@ bif_vectorbld_final_impl (caddr_t * qst, state_slot_t ** args, int plain_return)
     }
   filled_size = sizeof (caddr_t) * (unbox (acc[0]));
   dk_check_vectorbld_acc (acc);
-  new_box = dk_alloc_box (filled_size, DV_ARRAY_OF_POINTER);
   dk_free_box (acc[0]);
+  if ((0 == filled_size) && (2 & return_bits))
+    new_box = NEW_DB_NULL;
+  else
+    {
+      new_box = dk_alloc_box (filled_size, DV_ARRAY_OF_POINTER);
   memcpy (new_box, acc + 1, filled_size);
   dk_free_box /*not ..._tree*/ ((caddr_t)acc);
+    }
   acc = (caddr_t *)new_box;
-  if (plain_return)
+  if (1 & return_bits)
     return (caddr_t) acc;
   qst_set (qst, args[0], (caddr_t) acc);
   return NULL;
@@ -4582,7 +4616,14 @@ bif_vectorbld_acc (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 caddr_t
 bif_vectorbld_agg_acc (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
-  return bif_vectorbld_acc_impl (qst, args, 1, ((caddr_t **)(QST_GET_ADDR (qst, args[0]))));
+  return bif_vectorbld_acc_impl (qst, args, bif_vectorbld_acc_impl_BIT_PRESERVE_ARGS, ((caddr_t **)(QST_GET_ADDR (qst, args[0]))));
+}
+
+
+caddr_t
+bif_vector_of_nonnulls_bld_agg_acc (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  return bif_vectorbld_acc_impl (qst, args, bif_vectorbld_acc_impl_BIT_PRESERVE_ARGS | bif_vectorbld_acc_impl_BIT_IGNORE_NULLS, ((caddr_t **)(QST_GET_ADDR (qst, args[0]))));
 }
 
 
@@ -4615,6 +4656,13 @@ bif_vectorbld_agg_final (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 
 
 caddr_t
+bif_vector_or_null_bld_agg_final (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  return bif_vectorbld_final_impl (qst, args, 3);
+}
+
+
+caddr_t
 bif_xq_sequencebld_init (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   caddr_t * acc = (caddr_t *) dk_alloc_box_zero (sizeof (caddr_t) * 15 /*  2^n - 1 */, DV_ARRAY_OF_POINTER);
@@ -5823,10 +5871,12 @@ bif_xml_init (void)
   bif_define ("vectorbld_init", bif_vectorbld_init);
   bif_define ("vectorbld_acc", bif_vectorbld_acc);
   bif_define ("vectorbld_agg_acc", bif_vectorbld_agg_acc);
+  bif_define ("vector_of_nonnulls_bld_agg_acc", bif_vector_of_nonnulls_bld_agg_acc);
   bif_define ("vectorbld_concat_acc", bif_vectorbld_concat_acc);
   bif_define ("vectorbld_concat_agg_acc", bif_vectorbld_concat_agg_acc);
   bif_define ("vectorbld_final", bif_vectorbld_final);
   bif_define ("vectorbld_agg_final", bif_vectorbld_agg_final);
+  bif_define ("vector_or_null_bld_agg_final", bif_vector_or_null_bld_agg_final);
   bif_define ("vectorbld_length", bif_vectorbld_length);
   bif_define ("vectorbld_crop", bif_vectorbld_crop);
 
diff --git a/libsrc/Wi/bif_xper.c b/libsrc/Wi/bif_xper.c
index 5b95672..3d71037 100644
--- a/libsrc/Wi/bif_xper.c
+++ b/libsrc/Wi/bif_xper.c
@@ -1,7 +1,7 @@
 /*
  *  bif_xper.c
  *
- *  $Id: bif_xper.c,v 1.10.2.4 2010/03/08 12:04:11 source Exp $
+ *  $Id: bif_xper.c,v 1.10.2.6 2011/02/23 17:31:50 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -2670,6 +2670,8 @@ parse_source:
 	config.dtd_config = dtd_config;
 	config.uri = ((NULL == uri) ? uname___empty : uri);
 	config.root_lang_handler = lh;
+        if (file_read == iter)
+          config.feed_buf_size = 0x10000;
 	context.xpc_parser = VXmlParserCreate (&config);
 	VXmlSetUserData (context.xpc_parser, &context);
 	VXmlSetElementHandler (context.xpc_parser, cb_element_start, cb_element_end);
@@ -4394,6 +4396,156 @@ done:
   XP_SET (ret, box);
 }
 
+int
+xp_string_value_is_nonempty (xml_entity_t * xe)
+{
+#ifdef XPER_DEBUG
+  wcharset_t *charset = QST_CHARSET (xe->xe_doc.xd->xd_qi);
+#endif
+  xper_entity_t *xpe = (xper_entity_t *) xe;
+  caddr_t box = NULL;
+  long pos;
+  long epos;
+  unsigned char *ptr;
+  int type;
+  int namelen;
+  long num_word, atts_fill, addons, alen;
+  switch (xpe->xper_type)
+    {
+    case XML_MKUP_COMMENT:
+      return (1 < box_length (xpe->xper_name));
+    case XML_MKUP_PI:
+      {
+	long len, num_word, atts_fill, addons;
+	box = get_tag_data (xpe, xpe->xper_pos);
+	len = box_length (box);
+	ptr = (unsigned char *) (box + 1);
+	ptr += full_dv_string_length (ptr);
+	ptr += STR_ATTR_NO_OFF;
+	num_word = LONG_REF_NA (ptr);
+	ptr += 4;
+	atts_fill = num_word & 0xFFFF;
+	addons = ((unsigned long) (num_word)) >> 16;
+	ptr += addons;
+	for (; atts_fill > 1; atts_fill -= 2)
+	  {
+	    namelen = (int) skip_string_length (&ptr);
+	    ptr += namelen;
+	    alen = (long) skip_string_length (&ptr);
+	    if (alen);
+	      return 1;
+	    ptr += alen;
+	  }
+	return 0;
+      }
+    }
+  box = get_tag_data (xpe, xpe->xper_pos);
+  xper_dbg_print ("xp_string_value\n");
+
+  if (DV_XML_MARKUP == box_tag (box))
+    {
+      epos = xpe->xper_end;
+      for (pos = xpe->xper_pos + box_length (box) + 5; pos < epos; /* no step */)
+	{
+#if 0
+	  long box_pos = pos;
+#endif
+	  dk_free_box (box);
+	  box = get_tag_data (xpe, pos);
+	  pos += box_length (box) + ((DV_SHORT_STRING_SERIAL == box_tag (box)) ? 2 : 5);
+	  if ((DV_STRING == box_tag (box)) || (DV_SHORT_STRING_SERIAL == box_tag (box)))
+	    {
+	      if (box_length (box))
+	        return 1;
+	    }
+	  else
+	    {
+	      ptr = (unsigned char *) box;
+	      type = *ptr++;
+	      namelen = (int) skip_string_length (&ptr);
+	      switch (type)
+		{
+		case XML_MKUP_PI:
+		  ptr += namelen + STR_ATTR_NO_OFF;
+		  num_word = LONG_REF_NA (ptr);
+		  ptr += 4;
+		  atts_fill = num_word & 0xFFFF;
+		  addons = ((unsigned long) (num_word)) >> 16;
+		  ptr += addons;
+		  for (; atts_fill > 1; atts_fill -= 2)
+		    {
+		      namelen = (int) skip_string_length (&ptr);
+		      ptr += namelen;
+		      alen = (long) skip_string_length (&ptr);
+		      if (alen);
+			return 1;
+		      ptr += alen;
+		    }
+		  break;
+#if 0
+/* TBD: references should be extended and converted to string, but probably with disabled signaling of errors. */
+		case XML_MKUP_REF:
+		  {
+		    xper_entity_t *ref_xpe = (xper_entity_t *)xe->_->xe_copy (xe);
+		    fill_xper_entity (ref_xpe, box_pos);
+		    if (XI_RESULT == xp_down ((xml_entity_t *) ref_xpe, (XT *) XP_NODE))
+		      {
+		        caddr_t ref_val = NULL;
+/* There's no transit allowed in the following line, thus it climbs up to the root of the referenced doc */
+			ref_xpe->_->xe_up ((xml_entity_t *) ref_xpe, (XT *) XP_NODE, 0);
+		        ref_xpe->_->xe_string_value ((xml_entity_t *) ref_xpe, &ref_val, DV_STRING);
+		        session_buffered_write (ses, ref_val, box_length (ref_val) - 1);
+		      }
+		    dk_free_box (ref_xpe);
+		    break;
+		  }
+#endif
+		case XML_MKUP_COMMENT:
+		  if (namelen)
+		    return 1;
+		  break;
+	      }
+	    }
+	}
+      return 0;
+    }
+  if ((DV_STRING == box_tag (box)) || (DV_SHORT_STRING_SERIAL == box_tag (box)))
+    {
+      long box_pos = pos = xpe->xper_pos;
+      for (;;)
+	{
+	  if (box_length (box))
+	    return 1;
+	  box_pos = pos;
+	  pos += box_length (box) + ((DV_SHORT_STRING_SERIAL == box_tag (box)) ? 2 : 5);
+	  dk_free_box (box);
+	  box = get_tag_data (xpe, pos);
+	  if ((DV_STRING == box_tag (box)) || (DV_SHORT_STRING_SERIAL == box_tag (box)))
+	    continue;
+#if 0
+/* TBD: support for strings that starts in one subdocument and continues in a nested reference */
+	  if (box[0] == XML_MKUP_REF)
+	    {
+	      xper_entity_t *ref_xpe = (xper_entity_t *)xe->_->xe_copy (xe);
+	      fill_xper_entity (ref_xpe, box_pos);
+	      if (XI_RESULT == xp_down ((xml_entity_t *) ref_xpe, (XT *) XP_NODE))
+		{
+		  caddr_t ref_val = NULL;
+		  ref_xpe->_.xe_string_value ((xml_entity_t *) ref_xpe, &ref_val, DV_STRING);
+		  session_buffered_write (ses, ref_val, box_length (ref_val) - 1);
+		}
+	      dk_free_box (ref_xpe);
+	      continue;
+	    }
+#endif
+	  break;
+	}
+      return 0;
+    }
+  return 0;
+}
+
+
 struct ns_def_s
 {
   caddr_t nsd_prefix;		/*!< prefix assigned to a namespace */
@@ -6804,6 +6956,7 @@ bif_xper_init (void)
   xec_xper_xe.xe_attribute = xp_attribute;
   xec_xper_xe.xe_string_value = xp_string_value;
 #endif
+  xec_xper_xe.xe_string_value_is_nonempty = xp_string_value_is_nonempty;
   xec_xper_xe.xe_first_child = xp_first_child;
   xec_xper_xe.xe_last_child = NULL;	/* Not implemented and no need */
   xec_xper_xe.xe_get_child_count_any = xp_get_child_count_any;
diff --git a/libsrc/Wi/bitmap.c b/libsrc/Wi/bitmap.c
index 3799a07..1ca9de6 100644
--- a/libsrc/Wi/bitmap.c
+++ b/libsrc/Wi/bitmap.c
@@ -1,7 +1,7 @@
 /*
  *  bitmap.c
  *
- *  $Id: bitmap.c,v 1.17.2.10 2010/03/08 12:04:11 source Exp $
+ *  $Id: bitmap.c,v 1.17.2.15 2011/02/17 15:23:40 source Exp $
  *
  *  Bitmap Index
  *
@@ -143,6 +143,58 @@ bm_print (db_buf_t bm, short bm_len, bitno_t bm_start, int all)
 }
 
 
+caddr_t *
+itc_bm_array (it_cursor_t * itc, buffer_desc_t * buf)
+{
+  dk_set_t res = NULL;
+  db_buf_t bm, ce;
+  int off;
+  short bm_len;
+  bitno_t bm_start;
+  dbe_key_t * key = itc->itc_insert_key;
+  dtp_t dtp = key->key_bit_cl->cl_sqt.sqt_dtp;
+  BIT_COL (bm_start, buf, itc->itc_row_data, key);
+  KEY_PRESENT_VAR_COL (itc->itc_insert_key, itc->itc_row_data, (*key->key_bm_cl), off, bm_len);
+  ce = bm = itc->itc_row_data + off;
+  while (ce < bm + bm_len)
+    {
+      int ce_len = CE_LENGTH (ce);
+      bitno_t ce_start = bm_start + CE_OFFSET (ce);
+      if (!ce_len)
+	{
+	  printf ("Error: 0 length ce\n");
+	  break;
+	}
+      if (CE_IS_SINGLE (ce))
+	{
+	  dk_set_push (&res, box_iri_int64 (bm_start + (LONG_REF_NA (ce) & 0x7fffffff), dtp));
+	}
+      else if (CE_IS_ARRAY (ce))
+	{
+	  int inx;
+	  for (inx = 0; inx < (ce_len - 4) / 2; inx++)
+	    {
+	      dk_set_push (&res, box_iri_int64 (ce_start + SA_REF (ce + 4, inx), dtp));
+	    }
+	}
+      else
+	{
+	  short bit = 0;
+	  for (;;)
+	    {
+	      bit = ce_bitmap_value (ce + 4, bit, 1);
+	      if (bit == CE_N_VALUES)
+		break;
+	      dk_set_push (&res, box_iri_int64 (ce_start + bit, dtp));
+	      bit++;
+	    }
+	}
+      ce += ce_len;
+    }
+  return (caddr_t*)list_to_array (dk_set_nreverse (res));
+}
+
+
 void
 ce_array_to_bitmap (db_buf_t ce)
 {
@@ -426,12 +478,12 @@ itc_bm_insert_single (it_cursor_t * itc, buffer_desc_t * buf, row_delta_t * rd,
     ITC_OWNS_PARAM (itc, box);
     upd_rd.rd_values[key->key_bit_cl->cl_nth] = box_iri_int64 (bm_start, key->key_bit_cl->cl_sqt.sqt_dtp);
     ITC_OWNS_PARAM (itc, upd_rd.rd_values[key->key_bit_cl->cl_nth]);
-    upd_rd.rd_values[key->key_bm_cl->cl_nth] = box_dv_short_nchars (bmstr, 4);
+    upd_rd.rd_values[key->key_bm_cl->cl_nth] = box_dv_short_nchars ((char *)bmstr, 4);
     ITC_OWNS_PARAM (itc, upd_rd.rd_values[key->key_bm_cl->cl_nth]);
+  }
 #endif
       itc_page_leave  (itc, buf);
       itc->itc_search_mode = SM_INSERT;
-  }
   itc->itc_key_spec = itc->itc_insert_key->key_insert_spec; /* have insert specs, there can be other specs from prev seek */
   upd_rd.rd_itc = itc;
   rc = itc_insert_unq_ck (itc, &upd_rd, NULL);
@@ -739,7 +791,7 @@ itc_bm_insert_in_row (it_cursor_t * itc, buffer_desc_t * buf, row_delta_t * rd)
       upd_rd.rd_values = upd_values;
       if (key->key_bm_cl->cl_nth >= sizeof (cl_array) / sizeof (caddr_t)) GPF_T1 ("too many leading parts in bm inx");
       page_row (buf, itc->itc_map_pos, &upd_rd, RO_LEAF);
-      upd_rd.rd_values[key->key_bm_cl->cl_nth] = box_dv_short_nchars (ext, ext_len);
+      upd_rd.rd_values[key->key_bm_cl->cl_nth] = box_dv_short_nchars ((char *)ext, ext_len);
       upd_rd.rd_n_values++;
       memset (&cl_array, 0, sizeof (caddr_t) * key->key_bm_cl->cl_nth);
       cl_array[key->key_bm_cl->cl_nth] = key->key_bm_cl;
@@ -748,7 +800,7 @@ itc_bm_insert_in_row (it_cursor_t * itc, buffer_desc_t * buf, row_delta_t * rd)
       upd_rd.rd_leaf = 0;
       if (!buf->bd_is_write || buf->bd_readers)
 	GPF_T1 ("should have excl buffer in bm ins in row");
-#ifdef MTX_DEBUG
+#ifdef PAGE_DEBUG
       if (buf->bd_writer != THREAD_CURRENT_THREAD)
 	GPF_T1 ("cur thread supposed to be the writer in ins bm row");
 #endif
@@ -783,7 +835,7 @@ itc_bm_insert_in_row (it_cursor_t * itc, buffer_desc_t * buf, row_delta_t * rd)
       else
 	upd_rd.rd_values[inx] = box_copy_tree (rd->rd_values[inx]);
     }
-  upd_rd.rd_values[key->key_bm_cl->cl_nth] = box_dv_short_nchars (ext, ext_len);
+  upd_rd.rd_values[key->key_bm_cl->cl_nth] = box_dv_short_nchars ((char *)ext, ext_len);
   upd_rd.rd_n_values = key->key_bm_cl->cl_nth + 1;
   memcpy (&left_pl, itc, sizeof (placeholder_t));
   left_pl.itc_type = ITC_PLACEHOLDER;
@@ -1549,7 +1601,10 @@ pl_next_bit (placeholder_t * itc, db_buf_t bm, short bm_len, bitno_t bm_start, i
 {
   db_buf_t ce = bm + itc->itc_bp.bp_ce_offset;
   if (!itc->itc_bp.bp_is_pos_valid)
-    GPF_T1 ("next/prev of non-valid bit pos");
+    {
+      log_error ("Invalid bit position on index: %s", itc->itc_tree->it_key->key_name);
+      GPF_T1 ("next/prev of non-valid bit pos");
+    }
   switch (itc->itc_bp.bp_ce_type)
     {
     case CE_SINGLETON_ROW:
diff --git a/libsrc/Wi/datesupp.c b/libsrc/Wi/datesupp.c
index 9a9d10b..8ffc737 100644
--- a/libsrc/Wi/datesupp.c
+++ b/libsrc/Wi/datesupp.c
@@ -1,7 +1,7 @@
 /*
  *  datesupp.c
  *
- *  $Id: datesupp.c,v 1.16.2.4 2010/03/04 23:43:28 source Exp $
+ *  $Id: datesupp.c,v 1.16.2.5 2011/03/03 11:56:44 source Exp $
  *
  *  Date support functions
  *
@@ -713,6 +713,47 @@ short_buf:
 }
 
 void
+dbg_dt_to_string (const char *dt, char *str, int len)
+{
+  TIMESTAMP_STRUCT ts;
+  int dt_type, tz;
+  char *tail = str;
+  dt_to_GMTimestamp_struct (dt, &ts);
+  tz = DT_TZ (dt);
+  dt_type = DT_DT_TYPE (dt);
+  if (len < 50)
+    {
+      snprintf (str, len, "??? short output buffer for dbg_dt_to_string()");
+      return;
+    }
+  switch (dt_type)
+    {
+      case DT_TYPE_DATE:	tail += snprintf (str, len, "{date "); break;
+      case DT_TYPE_TIME:	tail += snprintf (str, len, "{time "); break;
+      case DT_TYPE_DATETIME:	tail += snprintf (str, len, "{datetime "); break;
+      default:	tail += snprintf (str, len, "{BAD(%d) ", dt_type); break;
+    }
+  tail += snprintf (tail, (str + len) - tail, "%04d-%02d-%02d %02d:%02d:%02d",
+    ts.year, ts.month, ts.day, ts.hour, ts.minute, ts.second );
+  if (ts.fraction)
+    {
+      if (ts.fraction % 1000)
+        tail += snprintf (tail, (str + len) - tail, ".%09d", (int)ts.fraction);
+      else if (ts.fraction % 1000000)
+        tail += snprintf (tail, (str + len) - tail, ".%06d", (int)(ts.fraction / 1000));
+      else
+        tail += snprintf (tail, (str + len) - tail, ".%03d", (int)(ts.fraction / 1000000));
+    }
+  if (tz)
+    tail += snprintf (tail, (str + len) - tail, "Z in %+02d:%02d}", tz/60, tz%60);
+  else
+    tail += snprintf (tail, (str + len) - tail, "Z}");
+  return;
+short_buf:
+  snprintf (str, len, "??? short output buffer for dt_to_string()");
+}
+
+void
 dt_to_iso8601_string (const char *dt, char *str, int len)
 {
   GMTIMESTAMP_STRUCT ts;
diff --git a/libsrc/Wi/datesupp.h b/libsrc/Wi/datesupp.h
index b0cc0ab..41c7806 100644
--- a/libsrc/Wi/datesupp.h
+++ b/libsrc/Wi/datesupp.h
@@ -1,7 +1,7 @@
 /*
  *  datesupp.c
  *
- *  $Id: datesupp.h,v 1.7.2.1 2009/04/18 21:55:11 source Exp $
+ *  $Id: datesupp.h,v 1.7.2.2 2011/03/03 11:56:44 source Exp $
  *
  *  Date support functions
  *
@@ -58,6 +58,7 @@ void dt_date_round (char *dt);
 void dt_init (void);
 int dt_part_ck (char *str, int min, int max, int *err);
 void dt_to_string (const char *dt, char *str, int len);
+void dbg_dt_to_string (const char *dt, char *str, int len);
 void dt_to_iso8601_string (const char *dt, char *str, int len);
 void dt_to_rfc1123_string (const char *dt, char *str, int len);
 int print_dt_to_buffer (char *buf, caddr_t arg, int mode);
diff --git a/libsrc/Wi/ddlrun.c b/libsrc/Wi/ddlrun.c
index bdc0660..5d06782 100644
--- a/libsrc/Wi/ddlrun.c
+++ b/libsrc/Wi/ddlrun.c
@@ -1,7 +1,7 @@
 /*
  *  ddlrun.c
  *
- *  $Id: ddlrun.c,v 1.34.2.12 2010/03/08 12:04:11 source Exp $
+ *  $Id: ddlrun.c,v 1.34.2.14 2010/09/17 16:35:46 source Exp $
  *
  *  SQL DDL Functionality
  *
@@ -2748,10 +2748,6 @@ ddl_drop_index (caddr_t * qst, const char *table, const char *name, int log_to_t
 	log_text_cluster (qi, temp_tx);
       else
 	log_text (qi->qi_trx, temp_tx);
-      temp_tx_box = box_string (temp_tx);
-      log_repl_text_array_all (key->key_table->tb_name, 2, temp_tx_box, qi->qi_client, qi,
-	  LOG_REPL_TEXT_ARRAY_MASK_ALL);
-      dk_free_box (temp_tx_box);
     }
   dk_free_box(szTheTableName);
   dk_free_box(szTheIndexName);
@@ -3957,8 +3953,6 @@ sql_ddl_node_input_1 (ddl_node_t * ddl, caddr_t * inst, caddr_t * state)
 
 	ddl_index_def (qi, tree->_.index.name, tb_name,
 	  tree->_.index.cols, tree->_.index.opts);
-	trx_repl_log_ddl_index_def (qi, tree->_.index.name, tb_name,
-	  tree->_.index.cols, tree->_.index.opts);
 	break;
       }
     case ADD_COLUMN:
@@ -4657,10 +4651,6 @@ scan_SYS_PROCEDURES:
       long p_type = DV_TYPE_OF (p_type_box) == DV_LONG_INT ? (long) unbox (p_type_box) : 0;
       caddr_t p_name = lc_nth_col (lc, 5);
   /* Procedure's calls published for replication */
-#ifdef REPLICATION_SUPPORT2
-      char *replic_acct = NULL;
-      char *procstmt = NULL;
-#endif
       err = NULL;
       HANDLE_S_QUAL (qual);
       CLI_SET_QUAL (bootstrap_cli, qual);
@@ -4712,26 +4702,6 @@ scan_SYS_PROCEDURES:
 	    }
 	}
   /* Procedure's calls published for replication */
-#ifdef REPLICATION_SUPPORT2
-      procstmt = src_text;
-      replic_acct = find_repl_account_in_src_text (&procstmt);
-      if (p_type ||
-	  reading_user_aggregates ||
-	  !CASEMODESTRCMP (p_name, "DB.DBA.DBEV_COMPILE") ||
-	  replic_acct) /* has to be compiled on startup */
-	proc_qr = sql_compile (procstmt, bootstrap_cli, &err, SQLC_DO_NOT_STORE_PROC);
-      else
-	{
-	  if (NULL == (proc_qr = sql_proc_to_recompile (procstmt, bootstrap_cli, p_name, 0)))
-	    proc_qr = sql_compile (procstmt, bootstrap_cli, &err, SQLC_DO_NOT_STORE_PROC);
-	}
-      if (proc_qr)
-	{
-	  proc_qr->qr_proc_repl_acct = ((NULL != replic_acct) ? box_string (replic_acct) : NULL);
-	  if (!err)
-	    qr_proc_repl_check_valid (proc_qr, &err);
-	}
-#else
       if (p_type == 3 || reading_user_aggregates) /* is module or user aggr */
 	proc_qr = sql_compile (src_text, bootstrap_cli, &err, SQLC_DO_NOT_STORE_PROC);
       else
@@ -4739,7 +4709,6 @@ scan_SYS_PROCEDURES:
 	  if (NULL == (proc_qr = sql_proc_to_recompile (src_text, bootstrap_cli, p_name, 0)))
 	    proc_qr = sql_compile (src_text, bootstrap_cli, &err, SQLC_DO_NOT_STORE_PROC);
 	}
-#endif
 
       if (err)
 	{
@@ -4900,7 +4869,7 @@ du_thread_t * recomp_thread;
 void
 qr_recompile_enter (int * is_entered)
 {
-  client_connection_t * cli = GET_IMMEDIATE_CLIENT_OR_NULL;
+  /* client_connection_t * cli = GET_IMMEDIATE_CLIENT_OR_NULL; */
   if (THREAD_CURRENT_THREAD == recomp_thread)
     return;
   mutex_enter (recomp_mtx);
@@ -4919,7 +4888,7 @@ qr_recompile_enter (int * is_entered)
 void
 qr_recompile_leave (int * is_entered)
 {
-  client_connection_t * cli = GET_IMMEDIATE_CLIENT_OR_NULL;
+  /* client_connection_t * cli = GET_IMMEDIATE_CLIENT_OR_NULL; */
   if (*is_entered)
     {
       recomp_thread = NULL;
@@ -5166,10 +5135,6 @@ ddl_store_proc (caddr_t * state, op_node_t * op)
 /* Procedure's calls published for replication */
   query_t *qr_proc = sch_proc_def (wi_inst.wi_schema,
       (char *) qst_get (state, op->op_arg_1));
-#ifdef REPLICATION_SUPPORT2
-  char * replic_acct = NULL;
-  caddr_t r_text = NULL;
-#endif
   caddr_t escapes_text = NULL;
   char trig_name [MAX_QUAL_NAME_LEN]; /*two-part trigger name*/
 
@@ -5213,22 +5178,6 @@ ddl_store_proc (caddr_t * state, op_node_t * op)
       short_text = text;
       long_text = db_null;
     }
-#ifdef REPLICATION_SUPPORT2
-  /* If procedure calls published for replication */
-  if (qr_proc)
-    replic_acct = qr_proc->qr_proc_repl_acct;
-  if (replic_acct)
-    {
-      r_text = dk_alloc_box (strlen (text) + strlen (replic_acct) + 9, DV_SHORT_STRING);
-      snprintf (r_text, box_length (r_text), "__repl %s %s", replic_acct, text);
-      if (long_text == db_null)
-	short_text = r_text;
-      else
-	long_text = r_text;
-    }
-  /* If procedure definition published for replication */
-  log_repl_text_array_all (qst_get (state, op->op_arg_1), 3, text, cli, qi, 2);
-#endif
 
   if (op->op_code == OP_STORE_TRIGGER)
     {
@@ -5276,9 +5225,6 @@ ddl_store_proc (caddr_t * state, op_node_t * op)
 	}
     }
 /* Procedure's calls published for replication */
-#ifdef REPLICATION_SUPPORT2
-  dk_free_box (r_text);
-#endif
   dk_free_box (db_null);
   if (escapes_text)
     dk_free_box (escapes_text);
@@ -5308,9 +5254,6 @@ ddl_store_proc (caddr_t * state, op_node_t * op)
 #ifdef VIRT30_40
 skip_incomp:
 #endif
-#ifdef REPLICATION_SUPPORT2
-   dk_free_box (r_text);
-#endif
   dk_free_box (db_null);
   if (escapes_text)
     dk_free_box (escapes_text);
@@ -5838,7 +5781,7 @@ const char *proc_add_col =
 "  add_col_recursive (tb_name, col_id);\n"
 "  update DB.DBA.SYS_KEYS set KEY_MIGRATE_TO = NULL where KEY_MIGRATE_TO = -1;\n"
 "  ddl_read_table_tree (tb_name);\n"
-"  DB.DBA.__INT_REPL_ALTER_REDO_TRIGGERS (tb_name);\n"
+"  --DB.DBA.__INT_REPL_ALTER_REDO_TRIGGERS (tb_name);\n"
 "}";
 
 static const char *proc_decoy_repl_modify_col =
@@ -5877,7 +5820,7 @@ const char *proc_modify_col =
 "    COL_OPTIONS = _col_options \n"
 "   where COL_ID = _col_id;\n"
 "  ddl_read_table_tree (_tb_name);\n"
-"  DB.DBA.__INT_REPL_ALTER_ADD_COL (_tb_name, _col_name, _col_dtp, _col_scale, _col_prec, _col_check, 'MODIFY');\n"
+"  --DB.DBA.__INT_REPL_ALTER_ADD_COL (_tb_name, _col_name, _col_dtp, _col_scale, _col_prec, _col_check, 'MODIFY');\n"
 "}";
 
 
@@ -5995,10 +5938,10 @@ const char *proc_drop_col =
 "  ddl_drop_col_recursive (tb, c_id);"
 "  update DB.DBA.SYS_KEYS set KEY_MIGRATE_TO = NULL where KEY_MIGRATE_TO = -1;"
 "  ddl_read_table_tree (tb);"
-"  if (not sys_stat ('st_lite_mode')) { \n"
-"  DB.DBA.__INT_REPL_ALTER_DROP_COL (tb, col, _col_dtp, _col_scale, _col_prec, c_check, 'DROP');\n"
-"  DB.DBA.__INT_REPL_ALTER_REDO_TRIGGERS (tb);\n"
-"  } \n"
+"  --if (not sys_stat ('st_lite_mode')) { \n"
+"  --DB.DBA.__INT_REPL_ALTER_DROP_COL (tb, col, _col_dtp, _col_scale, _col_prec, c_check, 'DROP');\n"
+"  --DB.DBA.__INT_REPL_ALTER_REDO_TRIGGERS (tb);\n"
+"  --} \n"
 "  for select distinct PK_TABLE from DB.DBA.SYS_FOREIGN_KEYS where 0 = casemode_strcmp (FK_TABLE, tb)"
 /*"      and (UPDATE_RULE > 0 or DELETE_RULE > 0)"*/
 "      do {"
@@ -6123,7 +6066,7 @@ const char *proc_add_col_row =
 "			COL_NULLABLE, COL_CHECK, COL_DEFAULT, COL_OPTIONS)\n"
 "    values (tb, col, c_id, dv, prec, scale, nullable, ck, serialize (deflt), _col_options);\n"
 "\n"
-"  DB.DBA.__INT_REPL_ALTER_ADD_COL (tb, col, dv, scale, prec, ck);\n"
+"  --DB.DBA.__INT_REPL_ALTER_ADD_COL (tb, col, dv, scale, prec, ck);\n"
 "\n"
 "  if (_ddl_foreign_key is not null)\n"
 "    ddl_foreign_key (_ddl_foreign_key[0], _ddl_foreign_key[1], _ddl_foreign_key[2]);\n"
diff --git a/libsrc/Wi/disk.c b/libsrc/Wi/disk.c
index 5a50472..e419738 100644
--- a/libsrc/Wi/disk.c
+++ b/libsrc/Wi/disk.c
@@ -1,7 +1,7 @@
 /*
  *  disk.c
  *
- *  $Id: disk.c,v 1.36.2.25 2010/05/21 12:40:47 source Exp $
+ *  $Id: disk.c,v 1.36.2.27 2011/03/11 12:17:30 source Exp $
  *
  *  Managing buffer rings and paging to disk.
  *
@@ -522,17 +522,20 @@ it_free (index_tree_t * it)
 }
 
 
-void
+int
 it_temp_tree (index_tree_t * it)
 {
   buffer_desc_t * buf = it_new_page (it, 0, DPF_INDEX, 0, 0);
   it_map_t * itm;
+  if (!buf)
+    return 0;
   pg_init_new_root (buf);
   it->it_root = buf->bd_page;
   itm = IT_DP_MAP (it, buf->bd_page);
   mutex_enter (&itm->itm_mtx);
   page_leave_inner (buf);
   mutex_leave (&itm->itm_mtx);
+  return 1;
 }
 
 
@@ -3550,7 +3553,7 @@ wi_open_dbs ()
 extern dk_mutex_t * log_write_mtx;
 extern   dk_mutex_t * transit_list_mtx;
 
-int32 bdf_is_avail_mask;
+int64 bdf_is_avail_mask;
 
 void
 wi_open (char *mode)
@@ -3579,7 +3582,7 @@ wi_open (char *mode)
   wi_inst.wi_n_bps = (short) BOX_ELEMENTS (wi_inst.wi_bps);
   {
     buffer_desc_t bd;
-    bd.bdf.flags = 0xffffffff;
+    bd.bdf.flags = 0xffffffffffffffff;
     bd.bdf.r.is_read_aside = 0;
     bdf_is_avail_mask = bd.bdf.flags;
   }
diff --git a/libsrc/Wi/eqlcomp.c b/libsrc/Wi/eqlcomp.c
index 3ba4211..26ae627 100644
--- a/libsrc/Wi/eqlcomp.c
+++ b/libsrc/Wi/eqlcomp.c
@@ -1,7 +1,7 @@
 /*
  *  eqlcomp.c
  *
- *  $Id: eqlcomp.c,v 1.16.2.8 2010/03/08 12:04:11 source Exp $
+ *  $Id: eqlcomp.c,v 1.16.2.13 2011/03/16 10:34:26 source Exp $
  *
  *  SQL Query Node Constructors.
  *
@@ -416,6 +416,8 @@ qr_free (query_t * qr)
 	}
       id_hash_free (qr->qr_call_counts);
     }
+  if (qr->qr_stats_mtx)
+    mutex_free (qr->qr_stats_mtx);
 #endif
 #if defined (MALLOC_DEBUG) || defined (VALGRIND)
   if ((NULL != qr->qr_static_prev) || (NULL != qr->qr_static_next) || (qr == static_qr_dllist))
@@ -1716,7 +1718,13 @@ key_source_om (comp_context_t * cc, key_source_t * ks)
       else if (CI_ROW == (ptrlong) col)
 	om[inx++].om_is_null = OM_ROW;
       else
-	om[inx++].om_cl = *key_find_cl (ks->ks_key, col->col_id);
+	{
+	  dbe_col_loc_t * cl = key_find_cl (ks->ks_key, col->col_id);
+	  if (cl)
+	    om[inx++].om_cl = *cl;
+	  else
+	    SQL_GPF_T1 (cc, "cannot find column in index");
+	}
     }
   END_DO_SET();
   ks->ks_out_map = om;
@@ -2504,6 +2512,7 @@ eql_compile_eql (const char *string, client_connection_t * cli, caddr_t * err)
     eql_stmt_comp (&cc, (caddr_t) text, &head, &tail);
 
     qr->qr_head_node = head;
+    qr->qr_text = box_string (string);
 
     qr_add_current_of_output (qr);
     QR_POST_COMPILE (qr, (&cc));
diff --git a/libsrc/Wi/extent.c b/libsrc/Wi/extent.c
index 9577ee1..614429a 100644
--- a/libsrc/Wi/extent.c
+++ b/libsrc/Wi/extent.c
@@ -1,7 +1,7 @@
 /*
  *  extent.c
  *
- *  $Id: extent.c,v 1.1.2.11 2010/06/09 12:30:04 source Exp $
+ *  $Id: extent.c,v 1.1.2.13 2010/11/05 20:23:01 source Exp $
  *
  *  Disk extent management
  *
@@ -305,19 +305,22 @@ dbs_file_extend (dbe_storage_t * dbs, extent_t ** new_ext_ret, int is_in_sys_em)
       if (n_allocated)
 	dbs_page_allocated (dbs, ext_first);
       last->bd_page = last->bd_physical_page = em_try_get_dp (em, EXT_INDEX, DP_ANY);
-      if (last->bd_page) EM_DEC_FREE (em, EXT_INDEX);
+      if (!last->bd_page) GPF_T1 ("0 dp for page set page");
+      EM_DEC_FREE (em, EXT_INDEX);
 
       last = page_set_extend (dbs, &dbs->dbs_incbackup_set, 0, DPF_INCBACKUP_SET);
       page_set_checksum_init (last->bd_buffer + DP_DATA);
       last->bd_page = last->bd_physical_page = em_try_get_dp (em, EXT_INDEX, DP_ANY);
-      if (last->bd_page) EM_DEC_FREE (em, EXT_INDEX);
+      if (!last->bd_page) GPF_T1 ("0 dp for page set page");
+      EM_DEC_FREE (em, EXT_INDEX);
       dbs->dbs_n_pages_in_sets += BITS_ON_PAGE;
     }
   if (dbs->dbs_n_pages > dbs->dbs_n_pages_in_extent_set)
     {
       buffer_desc_t * last = page_set_extend (dbs, &dbs->dbs_extent_set, 0, DPF_EXTENT_SET);
       last->bd_page = last->bd_physical_page = em_try_get_dp (em, EXT_INDEX, DP_ANY);
-      if (last->bd_page) EM_DEC_FREE (em, EXT_INDEX);
+      if (!last->bd_page) GPF_T1 ("0 dp for extents alloc page");
+      EM_DEC_FREE (em, EXT_INDEX);
       LONG_SET (last->bd_buffer + DP_DATA, 1); /* the newly made ext is the 1st of this page of the ext set, so set the bm 1st bit to 1 */
       page_set_checksum_init (last->bd_buffer + DP_DATA);
       dbs->dbs_n_pages_in_extent_set += EXTENT_SZ * BITS_ON_PAGE;
@@ -1627,9 +1630,29 @@ ext_read (index_tree_t * it, extent_t * ext, int keep_ts, dk_hash_t * phys_to_lo
       EXT_BIT (ext, ext->ext_dp + inx, word, bit);
       if (ext->ext_pages[word] & 1 << bit)
 	{
-	  buffer_desc_t * buf = bp_get_buffer (NULL, BP_BUF_IF_AVAIL);
+	  buffer_desc_t *buf;
 	  it_map_t * itm;
 	  dp_addr_t log;
+	  extern dbe_storage_t *cpt_dbs;
+
+	  if (dbs_is_free_page (cpt_dbs, ext->ext_dp + inx))
+	    {
+	      dp_addr_t log;
+
+	      if ((log = (ptrlong) gethash (DP_ADDR2VOID (ext->ext_dp + inx), phys_to_log)))
+		{
+		  log_error ("Remap %d corresponding to logical %d was marked free. marking allocated.", ext->ext_dp + inx, log);
+		  dbs_page_allocated (cpt_dbs, ext->ext_dp + inx);
+		}
+	      else
+		{
+		  log_error ("Correcting bad remap allocation %d", ext->ext_dp + inx);
+		  ext->ext_pages[word] &= ~(1 << bit);
+		}
+	      continue;
+	    }
+
+	  buf = bp_get_buffer (NULL, BP_BUF_IF_AVAIL);
 	  if (!buf)
 	    break;
 	  dk_set_push (&buf_list, (void*)buf);
diff --git a/libsrc/Wi/gate.c b/libsrc/Wi/gate.c
index 2e776ed..57d4196 100644
--- a/libsrc/Wi/gate.c
+++ b/libsrc/Wi/gate.c
@@ -1,7 +1,7 @@
 /*
  *  gate.c
  *
- *  $Id: gate.c,v 1.20.2.4 2010/03/08 12:04:11 source Exp $
+ *  $Id: gate.c,v 1.20.2.8 2010/11/17 21:29:09 source Exp $
  *
  *  Hyperspace and gate.
  *
@@ -100,9 +100,13 @@ itc_adaptive_read_inc (it_cursor_t * itc, buffer_desc_t * dest_buf)
 #define ADAPTIVE_READ_INC(itc, dest_buf) \
   itc_adaptive_read_inc (itc, dest_buf)
 
-#ifdef MTX_DEBUG
+#ifdef PAGE_DEBUG
 #define AL_WAIT_SET_WRITER(buf) \
-  { if ((buf) && (buf)->bd_is_write) (buf)->bd_writer = THREAD_CURRENT_THREAD;}
+  { \
+    if ((buf) && (buf)->bd_is_write) \
+      (buf)->bd_writer = THREAD_CURRENT_THREAD; \
+    BUF_DBG_ENTER (buf); \
+  }
 #else
 #define AL_WAIT_SET_WRITER(buf)
 #endif
@@ -118,13 +122,15 @@ itc_adaptive_read_inc (it_cursor_t * itc, buffer_desc_t * dest_buf)
 buffer_desc_t * bounds_check_buf;
 
 int
-page_wait_access (it_cursor_t * itc, dp_addr_t dp,  buffer_desc_t * buf_from, buffer_desc_t ** buf_ret, int mode, int max_change)
+DBGP_NAME (page_wait_access) (DBGP_PARAMS it_cursor_t * itc, dp_addr_t dp,  buffer_desc_t * buf_from,
+    buffer_desc_t ** buf_ret, int mode, int max_change)
 {
   buffer_desc_t decoy;
   buffer_desc_t *buf;
   dp_addr_t phys_dp;
   itc->itc_to_reset = RWG_NO_WAIT;
   itc->itc_max_transit_change = max_change;
+  itc->itc_must_kill_trx = 0;
   if (!dp)
     GPF_T1 ("Zero DP in page_fault_map_sem");
 
@@ -155,6 +161,7 @@ page_wait_access (it_cursor_t * itc, dp_addr_t dp,  buffer_desc_t * buf_from, bu
 	  else
 	    {
 	      *buf_ret = PF_OF_DELETED;
+	      itc->itc_must_kill_trx = 1;
 	      itc->itc_to_reset = RWG_WAIT_ANY;
 	      ITC_LEAVE_MAPS (itc);
 	      return RWG_WAIT_ANY;
@@ -214,6 +221,7 @@ page_wait_access (it_cursor_t * itc, dp_addr_t dp,  buffer_desc_t * buf_from, bu
       BUF_BOUNDS_CHECK (buf);
       buf_ext_check (buf);
       *buf_ret = buf;
+      BUF_DBG_ENTER (buf);
       return itc->itc_to_reset;
     }
   if (buf->bd_being_read)
@@ -264,6 +272,7 @@ page_wait_access (it_cursor_t * itc, dp_addr_t dp,  buffer_desc_t * buf_from, bu
 	  BUF_BOUNDS_CHECK (buf);
 	  *buf_ret = buf;
 	  BUF_TOUCH (buf);
+	  BUF_DBG_ENTER (buf);
 	  return  itc->itc_to_reset;
 	}
       else
@@ -287,6 +296,7 @@ page_wait_access (it_cursor_t * itc, dp_addr_t dp,  buffer_desc_t * buf_from, bu
 	  itc->itc_pl = buf->bd_pl;
 	  *buf_ret = buf;
 	  BUF_TOUCH (buf);
+	  BUF_DBG_ENTER (buf);
 	  return itc->itc_to_reset;
 	}
       else
@@ -340,7 +350,7 @@ page_release_read (buffer_desc_t * buf)
 	  if (PA_WRITE == waiting->itc_dive_mode)
 	    {
 	      /* if adaptive landing made this a write, then free no more cursors. */
-#ifdef MTX_DEBUG
+#ifdef PAGE_DEBUG
 	      buf->bd_writer = waiting->itc_thread;
 #endif
 	      buf->bd_read_waiting = next;
@@ -384,7 +394,7 @@ page_release_writes (buffer_desc_t * buf)
 	  BUF_BOUNDS_CHECK (buf);
 	  waiting->itc_pl = buf->bd_pl;
 	  BD_SET_IS_WRITE (buf, 1);
-#ifdef MTX_DEBUG
+#ifdef PAGE_DEBUG
 	  buf->bd_writer = waiting->itc_thread;
 #endif
 	  buf->bd_write_waiting = next;
@@ -414,13 +424,14 @@ page_release_writes (buffer_desc_t * buf)
 
 
 void
-page_leave_inner (buffer_desc_t * buf)
+DBGP_NAME (page_leave_inner) (DBGP_PARAMS buffer_desc_t * buf)
 {
 #ifdef MTX_DEBUG
   if (!is_crash_dump && buf->bd_tree)
     ASSERT_IN_MAP (buf->bd_tree, buf->bd_page);
 #endif
   BUF_BOUNDS_CHECK(buf);
+  BUF_DBG_LEAVE (buf);
   if (buf->bd_readers)
     {
       buf->bd_readers--;
@@ -558,7 +569,7 @@ itc_try_land (it_cursor_t * itc, buffer_desc_t ** buf_ret)
       ITC_SEM_WAIT (itc);
       if (itc->itc_to_reset <= RWG_WAIT_DATA)
 	{
-#ifdef MTX_DEBUG
+#ifdef PAGE_DEBUG
 	  buf->bd_writer = THREAD_CURRENT_THREAD;
 #endif
 	  itc->itc_pl = buf->bd_pl;
@@ -662,6 +673,12 @@ retry:
   if (ctl_itc->itc_to_reset > RWG_WAIT_KEY)
     {
       TC (tc_reentry_split);
+      if (ctl_itc->itc_must_kill_trx) /* reference to free remap, kill trx */
+	{
+	  ctl_itc->itc_must_kill_trx = 0;
+	  if (!wi_inst.wi_checkpoint_atomic && ctl_itc->itc_ltrx)
+	    itc_bust_this_trx (ctl_itc, NULL, ITC_BUST_THROW);
+	}
       goto retry;
     }
   if (PF_OF_DELETED == buf)
@@ -792,7 +809,10 @@ itc_dive_transit (it_cursor_t * itc, buffer_desc_t ** buf_ret, dp_addr_t to)
       if (itm1 != itm2)
 	mutex_leave (&itm2->itm_mtx);
       if (BUF_NONE_WAITING (old_buf))
+	{
+	  BUF_DBG_LEAVE_INL (old_buf);
 	old_buf->bd_readers--;
+	}
       else
 	page_leave_inner (old_buf);
       /* If the itms were different, the target itm is already exited */
@@ -822,7 +842,10 @@ itc_dive_transit (it_cursor_t * itc, buffer_desc_t ** buf_ret, dp_addr_t to)
       dest_buf->bd_readers++;
       mutex_leave (&itm2->itm_mtx);
       if (BUF_NONE_WAITING (old_buf))
+	{
+	  BUF_DBG_LEAVE_INL (old_buf);
 	old_buf->bd_readers--;
+	}
       else
 	page_leave_inner (old_buf);
       mutex_leave (&itm1->itm_mtx);
@@ -854,7 +877,10 @@ itc_dive_transit (it_cursor_t * itc, buffer_desc_t ** buf_ret, dp_addr_t to)
       ADAPTIVE_READ_INC (itc, dest_buf);
       mutex_leave (&itm2->itm_mtx);
       if (BUF_NONE_WAITING (old_buf))
+	{
+	  BUF_DBG_LEAVE_INL (old_buf);
 	old_buf->bd_readers--;
+	}
       else
 	page_leave_inner (old_buf);
       mutex_leave (&itm1->itm_mtx);
@@ -883,6 +909,7 @@ itc_dive_transit (it_cursor_t * itc, buffer_desc_t ** buf_ret, dp_addr_t to)
   goto check_link_2;
  check_link:
   BUF_TOUCH (dest_buf);
+  BUF_DBG_ENTER_INL (dest_buf);
  check_link_2:
   back_link = LONG_REF (dest_buf->bd_buffer + DP_PARENT);
   itc->itc_page = dest_buf->bd_page;
@@ -893,11 +920,19 @@ itc_dive_transit (it_cursor_t * itc, buffer_desc_t ** buf_ret, dp_addr_t to)
   if ((*buf_ret)->bd_readers <= 0 && !(*buf_ret)->bd_is_write)
     GPF_T1 ("dive transit ends in bd_readers <= 0 or is_write > 0");
 #endif
+  if ((*buf_ret)->bd_is_dirty && (*buf_ret)->bd_physical_page != (*buf_ret)->bd_page)
+    {
+      it_map_t * itm = IT_DP_MAP (tree, to);
+      mutex_enter (&itm->itm_mtx);
+      if (!gethash ((void*)(void*)(ptrlong)to, &itm->itm_remap))
+	GPF_T;
+      mutex_leave (&itm->itm_mtx);
+    }
 }
 
 
 void
-itc_landed_down_transit (it_cursor_t * itc, buffer_desc_t ** buf_ret, dp_addr_t to)
+DBGP_NAME (itc_landed_down_transit) (DBGP_PARAMS it_cursor_t * itc, buffer_desc_t ** buf_ret, dp_addr_t to)
 {
   buffer_desc_t *old_buf = *buf_ret;
   int waited = 0;
@@ -911,7 +946,7 @@ itc_landed_down_transit (it_cursor_t * itc, buffer_desc_t ** buf_ret, dp_addr_t
   if (!old_buf->bd_is_write) GPF_T1 ("landed transit got no write");
 #endif
   itc->itc_is_on_row = 1;
-  page_wait_access (itc, to, *buf_ret, buf_ret, PA_WRITE, RWG_NO_WAIT);
+  DBGP_NAME (page_wait_access) (DBGP_ARGS itc, to, *buf_ret, buf_ret, PA_WRITE, RWG_NO_WAIT);
   if (itc->itc_to_reset > RWG_NO_WAIT)
     {
       /* there was a wait and the itc was registered.  To unregister, reenter the page and go back to itc_search to see where to goo. The leaf could have been deld or split */
@@ -954,10 +989,10 @@ itc_landed_down_transit (it_cursor_t * itc, buffer_desc_t ** buf_ret, dp_addr_t
 }
 
 void
-itc_down_transit (it_cursor_t * itc, buffer_desc_t ** buf_ret, dp_addr_t to)
+DBGP_NAME (itc_down_transit) (DBGP_PARAMS it_cursor_t * itc, buffer_desc_t ** buf_ret, dp_addr_t to)
 {
   if (itc->itc_landed)
-    itc_landed_down_transit (itc, buf_ret, to);
+    DBGP_NAME (itc_landed_down_transit) (DBGP_ARGS itc, buf_ret, to);
   else
     itc_dive_transit (itc, buf_ret, to);
 }
@@ -1162,7 +1197,7 @@ it_root_image_invalidate (index_tree_t * tree)
 
 
 buffer_desc_t *
-itc_reset (it_cursor_t * it)
+DBGP_NAME (itc_reset) (DBGP_PARAMS it_cursor_t * it)
 {
   /* Enter to root in read mode and return the buffer */
   buffer_desc_t *buf;
@@ -1183,7 +1218,7 @@ itc_reset (it_cursor_t * it)
       if (it->itc_is_registered)
 	GPF_T1 ("should not be registered when resetting to a hi");
       ITC_IN_KNOWN_MAP (it, it->itc_tree->it_hash_first);
-        page_wait_access (it, it->itc_tree->it_hash_first, NULL, &buf, PA_WRITE, RWG_WAIT_ANY);
+        DBGP_NAME (page_wait_access) (DBGP_ARGS it, it->itc_tree->it_hash_first, NULL, &buf, PA_WRITE, RWG_WAIT_ANY);
 	ITC_LEAVE_MAPS (it);
 	it->itc_map_pos = DP_DATA + HASH_HEAD_LEN; /* offset into the page, not inx of page map */
       it->itc_page = buf->bd_page;
@@ -1201,7 +1236,8 @@ itc_reset (it_cursor_t * it)
       if (buf)
 	return buf;
     }
-  if (tree->it_is_single_page)
+  if (tree->it_is_single_page
+    )
     it->itc_dive_mode = PA_WRITE;
 
   for (;;)
@@ -1235,7 +1271,7 @@ itc_reset (it_cursor_t * it)
 	    }
 	}
       TC (tc_root_cache_miss);
-      page_wait_access (it, dp, NULL, &buf, it->itc_dive_mode, RWG_WAIT_KEY);
+      DBGP_NAME (page_wait_access) (DBGP_ARGS it, dp, NULL, &buf, it->itc_dive_mode, RWG_WAIT_KEY);
       if (buf == PF_OF_DELETED)
 	GPF_T1 ("The root page of an index is free do a crash dump for recovery.");
       if (it->itc_to_reset > RWG_WAIT_KEY)
@@ -1245,7 +1281,8 @@ itc_reset (it_cursor_t * it)
     }
   BUF_TOUCH (buf);
   if (!tree->it_is_single_page && !tree->it_root_image_version
-      && tree->it_key->key_id != KI_TEMP)
+      && tree->it_key->key_id != KI_TEMP
+     )
     {
       it_new_root_image (tree, buf);
     }
diff --git a/libsrc/Wi/hash.c b/libsrc/Wi/hash.c
index 00e6e01..96e4932 100644
--- a/libsrc/Wi/hash.c
+++ b/libsrc/Wi/hash.c
@@ -1,7 +1,7 @@
 /*
  *  hash.c
  *
- *  $Id: hash.c,v 1.19.2.15 2010/04/23 20:02:26 source Exp $
+ *  $Id: hash.c,v 1.19.2.18 2011/03/11 12:17:30 source Exp $
  *
  *  Hash Index
  *
@@ -1463,6 +1463,8 @@ ha_rehash (caddr_t * inst, hash_area_t * ha, index_tree_t * it)
     {
       if (inx >= ha->ha_n_keys)
 	break;
+      if (ssl->ssl_type == SSL_CONSTANT)
+	continue;
       qst_set (inst, ssl, save[inx]);
     }
   END_DO_BOX;
@@ -1700,12 +1702,14 @@ setp_print_input (setp_node_t * setp, caddr_t * qst)
 void
 setp_group_row (setp_node_t * setp, caddr_t * qst)
 {
+  dtp_t row_image[MAX_ROW_BYTES];
   hash_area_t * ha = setp->setp_ha;
   itc_ha_feed_ret_t ihfr;
   int rc = itc_ha_feed (&ihfr, ha, qst, 0);
   index_tree_t * tree;
   hash_index_t * hi;
   LOCAL_RF (rf, 0, 0, ha->ha_key);
+  rf.rf_large_row = &row_image[0];
   /*setp_print_input (setp, qst);*/
   if (DVC_MATCH == rc)
     goto runX_begin; /* see below */
@@ -2010,7 +2014,11 @@ setp_order_row (setp_node_t * setp, caddr_t * qst)
     {
       tree = it_temp_allocate (wi_inst.wi_temp);
       tree->it_key = ha->ha_key;
-      it_temp_tree (tree);
+      if (!it_temp_tree (tree))
+	{
+	  it_free (tree);
+	  sqlr_new_error ("42000", "SR...", "Can't allocate tree for temp space.");
+	}
       qst_set (qst, ha->ha_tree, (caddr_t) tree);
     }
   ins_itc = (it_cursor_t *) QST_GET_V (qst, ha->ha_ref_itc);
diff --git a/libsrc/Wi/http.c b/libsrc/Wi/http.c
index 4e66111..51e58dd 100644
--- a/libsrc/Wi/http.c
+++ b/libsrc/Wi/http.c
@@ -1,7 +1,7 @@
 /*
  *  http.c
  *
- *  $Id: http.c,v 1.71.2.40 2010/06/24 08:20:53 source Exp $
+ *  $Id: http.c,v 1.71.2.57 2011/03/11 13:08:29 source Exp $
  *
  *  HTTP access to Virtuoso
  *
@@ -103,6 +103,9 @@ static id_hash_t * http_acls = NULL; /* ACL lists */
 static id_hash_t * http_url_cache = NULL; /* WS cached URLs */
 
 long http_ses_trap = 0;
+int www_maintenance = 0;
+
+#define MAINTENANCE (NULL != www_maintenance_page && (wi_inst.wi_is_checkpoint_pending || www_maintenance))
 
 caddr_t
 temp_aspx_dir_get (void)
@@ -1221,7 +1224,7 @@ ws_url_rewrite (ws_connection_t *ws)
   int rc = LTE_OK, retc = 0;
   local_cursor_t * lc = NULL;
 
-  if (!ws || !ws->ws_map || !ws->ws_map->hm_url_rewrite_rule || (NULL != www_maintenance_page && wi_inst.wi_is_checkpoint_pending))
+  if (!ws || !ws->ws_map || !ws->ws_map->hm_url_rewrite_rule || MAINTENANCE)
     return 0;
 
   if (!(proc = (query_t *)sch_name_to_object (wi_inst.wi_schema, sc_to_proc, "DB.DBA.HTTP_URLREWRITE", NULL, "dba", 0)))
@@ -1619,6 +1622,7 @@ ws_clear (ws_connection_t * ws, int error_cleanup)
       client_connection_reset (ws->ws_cli);
       dk_free_box (ws->ws_client_ip);
       ws->ws_client_ip = NULL;
+      ws->ws_forward = 0;
       dk_free_box (ws->ws_req_line);
       ws->ws_req_line = NULL;
       dk_free_box (ws->ws_path_string);
@@ -1825,7 +1829,7 @@ ws_check_accept (ws_connection_t * ws, char * mime, const char * code, int check
       code = "HTTP/1.1 406 Unacceptable";
       dk_free_tree (ws->ws_header);
       snprintf (buf, sizeof (buf), "Alternates: {\"%s\" 1 {type %s} {charset %s} {length " OFF_T_PRINTF_FMT "}}\r\n",
-	  cname, mime, charset, clen);
+	  cname, mime, charset, (OFF_T_PRINTF_DTP)clen);
       ws->ws_header = box_dv_short_string (buf);
       strses_flush (ws->ws_strses);
       tmpbuf = box_sprintf (1000, fmt, cname, cname, cname, mime, charset);
@@ -1844,6 +1848,73 @@ ws_check_accept (ws_connection_t * ws, char * mime, const char * code, int check
   return check_only ? NULL : code;
 }
 
+#define WS_CORS_STAR (caddr_t*)-1
+
+static caddr_t *
+ws_split_cors (caddr_t str)
+{
+  char *tok_s = NULL, *tok;
+  dk_set_t acl_set_ptr = NULL;
+  caddr_t acl_string = str ? box_dv_short_string (str) : NULL;
+  if (NULL != acl_string)
+    {
+      tok_s = NULL;
+      tok = strtok_r (acl_string, " ", &tok_s);
+      while (tok)
+	{
+	  if (tok && strlen (tok) > 0)
+	    {
+	      if (!strcmp (tok, "*"))
+		{
+		  dk_free_tree (list_to_array (dk_set_nreverse (acl_set_ptr)));
+		  dk_free_box (acl_string);
+		  return WS_CORS_STAR;
+		}
+	      dk_set_push (&acl_set_ptr, box_dv_short_string (tok));
+	    }
+	  tok = strtok_r (NULL, " ", &tok_s);
+	}
+      dk_free_box (acl_string);
+    }
+  return (caddr_t *) list_to_array (dk_set_nreverse (acl_set_ptr));
+}
+
+static int
+ws_cors_check (ws_connection_t * ws, char * buf, size_t buf_len)
+{
+#ifdef VIRTUAL_DIR
+  caddr_t origin = ws_mime_header_field (ws->ws_lines, "Origin", NULL, 1);
+  int rc = 0;
+  if (origin && ws->ws_status_code < 400 && ws->ws_map && ws->ws_map->hm_cors)
+    {
+      caddr_t * orgs = ws_split_cors (origin), * place = NULL;
+      int inx;
+      if (ws->ws_map->hm_cors == (id_hash_t *) WS_CORS_STAR)
+	rc = 1;
+      else if (orgs != WS_CORS_STAR)
+	{
+	  DO_BOX (caddr_t, org, inx, orgs)
+	    {
+	      if (NULL != (place = (caddr_t *) id_hash_get_key (ws->ws_map->hm_cors, (caddr_t) & org)))
+		{
+		  rc = 1;
+		  break;
+		}
+	    }
+	  END_DO_BOX;
+	}
+      if (orgs != WS_CORS_STAR)
+	dk_free_tree (orgs);
+      if (rc)
+	snprintf (buf, buf_len, "Access-Control-Allow-Origin: %s\r\n", place ? *place : "*");
+    }
+  dk_free_tree (origin);
+  if (0 == rc && ws->ws_map && ws->ws_map->hm_cors_restricted)
+    return 0;
+#endif
+  return 1;
+}
+
 void
 ws_strses_reply (ws_connection_t * ws, const char * volatile code)
 {
@@ -1969,6 +2040,7 @@ ws_strses_reply (ws_connection_t * ws, const char * volatile code)
       code = "HTTP/1.1 509 Bandwidth Limit Exceeded";
       HTTP_SET_STATUS_LINE (ws, code, 1);
       strses_flush (ws->ws_strses);
+      ws_http_error (ws, "HTTP/1.1 509 Bandwidth Limit Exceeded", "Bandwidth Limit Exceeded", ws->ws_p_path_string, ws->ws_path_string);
       len = strses_length (ws->ws_strses);
     }
 
@@ -2041,6 +2113,18 @@ ws_strses_reply (ws_connection_t * ws, const char * volatile code)
 	  SES_PRINT (ws->ws_session, "\r\n");
 	}
 
+      if (!ws->ws_header || NULL == nc_strstr ((unsigned char *) ws->ws_header, (unsigned char *) "Access-Control-Allow-Origin:"))
+	{
+	  tmp[0] = 0;
+	  if (0 == ws_cors_check (ws, tmp, sizeof (tmp)))
+	    {
+	      strses_flush (ws->ws_strses);
+	      len = strses_length (ws->ws_strses);
+	    }
+	  if (tmp[0] != 0)
+	    SES_PRINT (ws->ws_session, tmp);
+	}
+
       SES_PRINT (ws->ws_session, "Accept-Ranges: bytes\r\n");
 
       if (ws->ws_header) /* user-defined headers */
@@ -2616,6 +2700,8 @@ ws_file (ws_connection_t * ws)
     }
   else if (n_ranges)
     strcpy_ck (head_beg, "HTTP/1.1 206 Partial content");
+  else if (MAINTENANCE)
+    strcpy_ck (head_beg, "HTTP/1.1 503 Service Temporarily Unavailable");
   else
     strcpy_ck (head_beg, "HTTP/1.1 200 OK");
 
@@ -2675,6 +2761,8 @@ ws_file (ws_connection_t * ws)
 	      "Date: %s\r\n"
 	      "Server: %.1000s\r\n"
 	      "Connection: %s\r\n"
+	      "%s"
+	      "%s"
 	      "%s",
 	      head_beg,
 	      (OFF_T_PRINTF_DTP) off,
@@ -2684,6 +2772,8 @@ ws_file (ws_connection_t * ws)
 	      date_now,
 	      http_server_id_string,
 	      ws->ws_try_pipeline ? "Keep-Alive" : "close",
+	      (MAINTENANCE) ? "Retry-After: 1800\r\n" : "",
+	      ws->ws_header ? ws->ws_header : "",
 	      ranges_buffer
 	      );
 	  SES_PRINT (ws->ws_session, head);
@@ -2870,7 +2960,7 @@ error_end:
 }
 #endif
 
-static void
+void
 ws_connection_vars_clear (client_connection_t * cli)
 {
   caddr_t *name, *val;
@@ -2941,6 +3031,9 @@ ws_auth_check (ws_connection_t * ws)
   int rc = LTE_OK, retc = 0;
   query_t * proc;
 
+  if (MAINTENANCE)
+    return 1;
+
   if (!http_auth_qr)
     http_auth_qr = sql_compile_static ("call (?) (?)", bootstrap_cli, &err, SQLC_DEFAULT);
 
@@ -3215,7 +3308,7 @@ request_do_again:
   ws->ws_ignore_disconnect = 0;
   CHUNKED_STATE_CLEAR (ws);
 
-  if (NULL != www_maintenance_page && wi_inst.wi_is_checkpoint_pending)
+  if (MAINTENANCE)
     {
       int print_slash;
       size_t alen;
@@ -3714,6 +3807,7 @@ do_file:
 	  MP_DONE ();
 	  log_error ("non-empty MP after %s", ws->ws_path_string ? ws->ws_path_string : "<no-url>");
 	}
+      THR_DBG_PAGE_CHECK;
 
       if (!ws_check_rdf_accept (ws))
 	{
@@ -3808,6 +3902,7 @@ do_file:
       MP_DONE ();
       log_error ("non-empty MP after %s", ws->ws_path_string ? ws->ws_path_string : "<no-url>");
     }
+  THR_DBG_PAGE_CHECK;
   /* instead of connection_set (cli, con_dav_v_name, NULL);
    * we'll clear all connection settings if connection is dirty */
   ws_connection_vars_clear (cli);
@@ -3827,16 +3922,20 @@ http_client_ip (session_t * ses)
   return (box_dv_short_string (buf));
 }
 
+#define IS_GATEWAY_PROXY(ws) (ws->ws_forward || \
+    (http_proxy_address && (ws) && (ws)->ws_client_ip && !strcmp ((ws)->ws_client_ip, http_proxy_address)))
+
 void
 http_set_client_address (ws_connection_t * ws)
 {
   caddr_t xfwd;
-  if (!http_proxy_address || (ws && ws->ws_client_ip && strcmp (ws->ws_client_ip, http_proxy_address)))
+  if (!IS_GATEWAY_PROXY (ws))
     return;
-  if (ws && ws->ws_lines  && NULL != (xfwd = ws_mime_header_field (ws->ws_lines, "X-Forwarded-For", NULL, 1)))
+  if (ws && ws->ws_lines && NULL != (xfwd = ws_mime_header_field (ws->ws_lines, "X-Forwarded-For", NULL, 1)))
     {
       dk_free_box (ws->ws_client_ip);
       ws->ws_client_ip = xfwd;
+      ws->ws_forward = 1;
     }
 }
 
@@ -3849,20 +3948,6 @@ ws_read_req (ws_connection_t * ws)
   dk_session_t * ses = ws->ws_session;
   ws_clear (ws, 0);
   ws->ws_client_ip = http_client_ip (ws->ws_session->dks_session);
-#ifdef _IMSG
-  if (
-      (!pop3_port || ws->ws_port != pop3_port)
-      && (!nntp_port || ws->ws_port != nntp_port)
-      && (!ftp_port || ws->ws_port != ftp_port)
-      && 0 == ws_check_acl (ws, &hit)
-     )
-#else
-  if (0 == ws_check_acl (ws, &hit))
-#endif
-    {
-      ws->ws_try_pipeline = 0;
-      goto end_req;
-    }
 
   if (!_thread_sched_preempt)
     {
@@ -3931,6 +4016,12 @@ ws_read_req (ws_connection_t * ws)
 	    }
 	  ws->ws_lines = (caddr_t*) list_to_array (dk_set_nreverse (lines));
 	  http_set_client_address (ws);
+	  if (0 == ws_check_acl (ws, &hit))
+	    {
+	      ws->ws_try_pipeline = 0;
+	      ws_strses_reply (ws, hit ? "HTTP/1.1 509 Bandwidth Limit Exceeded" : "HTTP/1.1 403 Forbidden");
+	      goto end_req;
+	    }
 	  if (ws_path_and_params (ws))
 	    goto end_req;
 #ifdef _IMSG
@@ -4611,6 +4702,8 @@ bif_http_result (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   dk_session_t * out = http_session_no_catch_arg (qst, args, 1, "http");
   dtp_t dtp = DV_TYPE_OF (string);
 
+  /* potentially long time when session is flushed or chunked, then should use io sect
+     for now as almost we using to go to string session we keep it w/o io sect */
   /* IO_SECT (qst); */
   if (dtp == DV_SHORT_STRING || dtp == DV_LONG_STRING || dtp == DV_C_STRING || dtp == DV_BIN)
     session_buffered_write (out, string, box_length (string) - (IS_STRING_DTP (DV_TYPE_OF (string)) ? 1 : 0));
@@ -4799,6 +4892,65 @@ bif_http_dav_url (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return (bif_http_value_1 (qst, err_ret, args, "http_dav_url", DKS_ESC_DAV));
 }
 
+caddr_t
+bif_http_xmlelement_impl (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args, int is_empty, const char *bifname)
+{
+  ws_connection_t * ws = ((query_instance_t *)qst)->qi_client->cli_ws;
+  caddr_t elt = bif_string_or_uname_arg (qst, args, 0, bifname);
+  dk_session_t * out = http_session_no_catch_arg (qst, args, 1, bifname);
+  int argctr, argcount = BOX_ELEMENTS (args), attr_printed = 0;
+  session_buffered_write_char ('<', out);
+  session_buffered_write (out, elt, box_length (elt)-1);
+  for (argctr = 2; argctr < argcount; argctr += 2)
+    {
+      caddr_t attrname = bif_string_or_uname_arg (qst, args, argctr, bifname);
+      caddr_t attrvalue = bif_arg (qst, args, argctr+1, bifname);
+      if (DV_DB_NULL == DV_TYPE_OF (attrvalue))
+        continue;
+      session_buffered_write_char (' ', out);
+      session_buffered_write (out, attrname, box_length (attrname)-1);
+      session_buffered_write (out, "=\"", 2);
+      dks_sqlval_esc_write (qst, out, attrvalue, WS_CHARSET (ws, qst), default_charset, DKS_ESC_DQATTR);
+      session_buffered_write_char ('"', out);
+      attr_printed++;
+    }
+  if ('?' == elt[0])
+    {
+      if (!is_empty)
+        sqlr_new_error ("22023", "SR641", "%s() is only for only plain elements, not for processing instructions like <%.200s ...?>", bifname, elt);
+      session_buffered_write_char ('?', out);
+    }
+  else
+    {
+      if (is_empty)
+        session_buffered_write (out, " /", 2);
+    }
+  session_buffered_write_char ('>', out);
+  return box_num (attr_printed);
+}
+
+caddr_t
+bif_http_xmlelement_start (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  return bif_http_xmlelement_impl (qst, err_ret, args, 0, "http_xmlelement_start");
+}
+
+caddr_t
+bif_http_xmlelement_empty (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  return bif_http_xmlelement_impl (qst, err_ret, args, 1, "http_xmlelement_empty");
+}
+
+caddr_t
+bif_http_xmlelement_end (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  caddr_t elt = bif_string_or_uname_arg (qst, args, 0, "http_xmlelement_end");
+  dk_session_t * out = http_session_no_catch_arg (qst, args, 1, "http_xmlelement_end");
+  session_buffered_write (out, "</", 2);
+  session_buffered_write (out, elt, box_length (elt)-1);
+  session_buffered_write_char ('>', out);
+  return box_num (0);
+}
 
 caddr_t
 bif_http_rewrite (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
@@ -4838,12 +4990,15 @@ bif_http_header (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 caddr_t
 bif_http_host (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
-  query_instance_t * qi = (query_instance_t *) qst;
+  query_instance_t *qi = (query_instance_t *) qst;
   caddr_t deflt = ((BOX_ELEMENTS (args) > 0) ? bif_arg (qst, args, 0, "http_host") : NULL);
   caddr_t host = NULL;
-  ws_connection_t * ws = qi->qi_client->cli_ws;
-  if (ws && ws->ws_lines && NULL == (host = ws_mime_header_field (ws->ws_lines, "X-Forwarded-Host", NULL, 1)))
-    host = ws_mime_header_field (ws->ws_lines, "Host", NULL, 1);
+  ws_connection_t *ws = qi->qi_client->cli_ws;
+  if (ws && ws->ws_lines)
+    {
+      if (NULL == (host = ws_mime_header_field (ws->ws_lines, "X-Forwarded-Host", NULL, 1)))
+	host = ws_mime_header_field (ws->ws_lines, "Host", NULL, 1);
+    }
   if (!host)
     host = box_copy (deflt);
   return host;
@@ -4929,6 +5084,67 @@ bif_http_pending_req (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return ((caddr_t) list_to_array (dk_set_nreverse (set)));
 }
 
+static void
+http_kill_all ()
+{
+  dk_set_t killed = NULL;
+  ws_connection_t * ws;
+  IN_TXN;
+again:
+  DO_SET (lock_trx_t *, lt, &all_trxs)
+    {
+      if (lt->lt_status == LT_PENDING && !dk_set_member (killed, (void*)lt) &&
+	  (lt->lt_threads > 0 || lt_has_locks (lt)) && lt->lt_client && lt->lt_client->cli_ws)
+	{
+	  ws = lt->lt_client->cli_ws;
+	  CHECK_DK_MEM_RESERVE (lt);
+	  lt->lt_error = LTE_TIMEOUT;
+	  dk_set_push (&killed, (void*) lt);
+	  lt_kill_other_trx (lt, NULL, NULL, LT_KILL_ROLLBACK);
+	  goto again;
+	}
+    }
+  END_DO_SET ();
+  dk_set_free (killed);
+  LEAVE_TXN;
+}
+
+caddr_t
+bif_http_lock (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  caddr_t pass = bif_string_arg (qst, args, 0, "http_lock");
+  user_t * user = sec_name_to_user ("dba");
+
+  if (strcmp (pass, user->usr_pass))
+    sqlr_new_error ("22023", "HT042", "Invalid DBA credentials");
+  sec_check_dba ((query_instance_t *) qst, "http_lock");
+
+  if (!MAINTENANCE)
+    {
+      www_maintenance = 1;
+      http_kill_all ();
+    }
+  else
+    sqlr_new_error ("42000", "HTERR", "Cannot enter in maintenance mode when it is already entered");
+  return NULL;
+}
+
+caddr_t
+bif_http_unlock (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  caddr_t pass = bif_string_arg (qst, args, 0, "http_lock");
+  user_t * user = sec_name_to_user ("dba");
+
+  if (strcmp (pass, user->usr_pass))
+    sqlr_new_error ("22023", "HT042", "Invalid DBA credentials");
+  sec_check_dba ((query_instance_t *) qst, "http_unlock");
+  if (MAINTENANCE)
+    www_maintenance = 0;
+  else
+    sqlr_new_error ("42000", "HTERR", "Cannot leave maintenance mode when it is already left");
+  return NULL;
+}
+
 caddr_t
 bif_http_kill (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
@@ -5127,8 +5343,10 @@ void
 http_session_used (dk_session_t * ses, char * host, long peer_max_timeout)
 {
   ws_cached_connection_t * proxy_cache = NULL;
+  mutex_enter (ws_cache_mtx);
   if (!host || (((long) dk_set_length (ws_proxy_cache)) >= http_max_cached_proxy_connections))
     {
+      mutex_leave (ws_cache_mtx);
       PrpcDisconnect (ses);
       PrpcSessionFree (ses);
       return;
@@ -5139,7 +5357,6 @@ http_session_used (dk_session_t * ses, char * host, long peer_max_timeout)
   proxy_cache->hit = get_msec_real_time ();
   proxy_cache->timeout = peer_max_timeout > 0 ? peer_max_timeout : http_proxy_connection_cache_timeout;
 
-  mutex_enter (ws_cache_mtx);
   dk_set_push (&ws_proxy_cache, (void *) proxy_cache);
   tws_cached_connections++;
   tws_cached_connections_in_use--;
@@ -6070,7 +6287,7 @@ ws_mime_header_field (caddr_t * head, char * f, char *subf, int initial_mode)
   DO_BOX (caddr_t, line, inx, head)
     {
       int rfc822 = initial_mode, offset = 0, override_to_mime = (subf ? 1 : 0);
-      char szName[1024], szValue[1024];
+      char szName[1024], szValue[1024*16];
       if (!DV_STRINGP (line))
 	continue;
       while (0 <=  (offset =
@@ -6080,8 +6297,8 @@ ws_mime_header_field (caddr_t * head, char * f, char *subf, int initial_mode)
 	    ':',
 	    &rfc822,
 	    &override_to_mime,
-	    szName, 1024,
-	    szValue, 1024
+	    szName, sizeof (szName),
+	    szValue, sizeof (szValue)
 	  ))
 	 )
 	{
@@ -6093,7 +6310,7 @@ ws_mime_header_field (caddr_t * head, char * f, char *subf, int initial_mode)
 	      if (subf)
 		{
 		  while (-1 != (offset = mime_get_attr (line,
-			  offset, '=', &rfc822, &override_to_mime, szName, 1024, szValue, 1024)))
+			  offset, '=', &rfc822, &override_to_mime, szName, sizeof (szName), szValue, sizeof (szValue))))
 		    if (!stricmp (szName, subf))
 		      break;
 		  if (offset == -1)
@@ -7573,10 +7790,12 @@ caddr_t * all_host_names = NULL;
 * if input is *sslini* copy https_port and return it
 ***********************************************************/
 caddr_t
-http_host_normalize_1 (caddr_t host, int to_ip, int def_port)
+http_host_normalize_1 (caddr_t host, int to_ip, int def_port, int physical_port)
 {
   char * sep;
   caddr_t host1, host2;
+  int port = 0;
+  char buf [6];
 
   if (!host)
     return NULL;
@@ -7590,28 +7809,39 @@ http_host_normalize_1 (caddr_t host, int to_ip, int def_port)
   if (!host2)
     return NULL;
 
+  host2 = box_string (host2);
   sep = strchr (host2, ':');
-  if (!sep && !alldigits (host2))
+  if (sep) /* host:port notation */
     {
-      char buf [6];
-      snprintf (buf, sizeof (buf), "%d", def_port);
-      host1 = dk_alloc_box (strlen (host2) + strlen (buf) + 2, DV_SHORT_STRING);
-      snprintf (host1, box_length (host1), "%s:%s", host2, buf);
+      *sep = 0;
+      sep ++;
+      port = atoi (sep);
     }
-  else if (!sep && alldigits (host2))
+  else if (alldigits (host2)) /* just port numer  */
     {
-      host1 = dk_alloc_box (strlen (host2) + 2, DV_SHORT_STRING);
-      snprintf (host1, box_length (host1), ":%s", host2);
+      port = atoi (host2);
+      host2[0] = 0;
     }
-  else
-    host1 = box_dv_short_string (host2);
+  /* else just host, default ports used, see next */
+
+  if (port <= 0 || port >= 0xffff) /* non-numeric, bad port number, or no port given, then rollback to default  */
+    port = def_port;
+
+  if (physical_port && port != physical_port)
+    port = physical_port;
+
+  snprintf (buf, sizeof (buf), "%d", port);
+  host1 = dk_alloc_box (strlen (host2) + strlen (buf) + 2, DV_SHORT_STRING);
+  snprintf (host1, box_length (host1), "%s:%s", host2, buf);
+
+  dk_free_box (host2);
   return host1;
 }
 
 caddr_t
 http_host_normalize (caddr_t host, int to_ip)
 {
-  return http_host_normalize_1 (host, to_ip, 80);
+  return http_host_normalize_1 (host, to_ip, 80, 0);
 }
 
 /*
@@ -7805,6 +8035,30 @@ bif_http_map_table (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 		map->hm_url_rewrite_rule = box_copy_tree (opts[i+1]);
 	      else if (DV_STRINGP (opts[i]) && !stricmp (opts[i],"url_rewrite_keep_lpath"))
 		map->hm_url_rewrite_keep_lpath = unbox (opts[i+1]);
+	      else if (DV_STRINGP (opts[i]) && !stricmp (opts[i],"cors_restricted"))
+		map->hm_cors_restricted = unbox (opts[i+1]);
+	      else if (DV_STRINGP (opts[i]) && !stricmp (opts[i],"cors"))
+		{
+		  caddr_t * orgs = ws_split_cors (opts[i+1]);
+		  id_hash_t * ht = NULL;
+		  if (orgs)
+		    {
+		      if (orgs != WS_CORS_STAR)
+			{
+			  int inx;
+			  ptrlong one = 1;
+			  ht = id_str_hash_create (7);
+			  DO_BOX (caddr_t, org, inx, orgs)
+			    {
+			      id_hash_set (ht, (caddr_t) & org, (caddr_t) & one);
+			    }
+			  END_DO_BOX;
+			}
+		      else
+			ht = (id_hash_t *) orgs;
+		    }
+		  map->hm_cors = ht;
+		}
 	    }
 	  map->hm_opts = (caddr_t *) box_copy_tree ((box_t) opts);
 	}
@@ -7991,7 +8245,7 @@ http_set_ssl_listen (dk_session_t * listening, caddr_t * https_opts)
 {
   char err_buf [1024];
   SSL_CTX* ssl_ctx = NULL;
-  SSL_METHOD *ssl_meth = NULL;
+  const SSL_METHOD *ssl_meth = NULL;
   char * https_cvfile = NULL;
   char *cert = NULL;
   char *skey = NULL;
@@ -8076,13 +8330,13 @@ http_set_ssl_listen (dk_session_t * listening, caddr_t * https_opts)
       SSL_CTX_set_client_CA_list (ssl_ctx, skCAList);
       skCAList = SSL_CTX_get_client_CA_list(ssl_ctx);
 
-      if (sk_X509_ALGOR_num(skCAList) == 0)
+      if (sk_X509_NAME_num(skCAList) == 0)
 	log_warning ("HTTPS Client authentication requested but no CA known for verification");
 
-      for (i = 0; i < sk_X509_ALGOR_num(skCAList); i++)
+      for (i = 0; i < sk_X509_NAME_num(skCAList); i++)
 	{
 	  char ca_buf[1024];
-	  X509_NAME *ca_name = (X509_NAME *) sk_X509_ALGOR_value (skCAList, i);
+	  X509_NAME *ca_name = (X509_NAME *) sk_X509_NAME_value (skCAList, i);
 	  if (X509_NAME_oneline (ca_name, ca_buf, sizeof (ca_buf)))
 	    log_debug ("HTTPS Using X509 Client CA %s", ca_buf);
 	}
@@ -8152,7 +8406,8 @@ bif_http_listen_host (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   caddr_t host = http_host_normalize (bif_string_arg (qst, args, 0, "http_listen_host"), 0);
   ptrlong stop = bif_long_arg (qst, args, 1, "http_listen_host");
-  caddr_t *https_opts = BOX_ELEMENTS (args) > 2 ? (caddr_t *) bif_array_or_null_arg (qst, args, 2, "http_listen_host") : NULL;
+  caddr_t * https_opts = BOX_ELEMENTS (args) > 2 ?
+      (caddr_t *) bif_array_or_null_arg (qst, args, 2, "http_listen_host") : NULL;
   dk_session_t *listening = NULL;
   int rc = 0;
   dk_session_t **place = NULL;
@@ -8405,6 +8660,7 @@ ws_set_phy_path (ws_connection_t * ws, int dir, char * vsp_path)
   SSL *ssl = NULL;
 #endif
   socklen_t len = sizeof (sa);
+  int port = 0;
 
   if (!ws)
     return;
@@ -8413,7 +8669,8 @@ ws_set_phy_path (ws_connection_t * ws, int dir, char * vsp_path)
   if (!getsockname (s, (struct sockaddr *) &sa, &len))
     {
       unsigned char *addr = (unsigned char *) &sa.sin_addr;
-      snprintf (nif, sizeof (nif), "%d.%d.%d.%d:%u", addr[0], addr[1], addr[2], addr[3], ntohs (sa.sin_port));
+      port = ntohs (sa.sin_port);
+      snprintf (nif, sizeof (nif), "%d.%d.%d.%d:%u", addr[0], addr[1], addr[2], addr[3], port);
     }
   else
     nif[0] = 0;
@@ -8424,8 +8681,12 @@ ws_set_phy_path (ws_connection_t * ws, int dir, char * vsp_path)
 #endif
 
   tcpses_addr_info (ws->ws_session->dks_session, listen_host, sizeof (listen_host), 80, 1);
-  host_hf = ws_get_packed_hf (ws, "Host:", listen_host);
-  host = http_host_normalize_1 (host_hf, 0, (is_https ? 443 : 80));
+  /* was: host_hf = ws_get_packed_hf (ws, "Host:", listen_host);*/
+  if (NULL == (host_hf = ws_mime_header_field (ws->ws_lines, "X-Forwarded-Host", NULL, 1)))
+    host_hf = ws_mime_header_field (ws->ws_lines, "Host", NULL, 1);
+  if (NULL == host_hf)
+    host_hf = box_dv_short_string (listen_host);
+  host = http_host_normalize_1 (host_hf, 0, (is_https ? 443 : 80), IS_GATEWAY_PROXY (ws) ? port : 0);
   http_trace (("host hf: %s, host nfo:, %s nif: %s\n", host, listen_host, nif));
 
   if (!vsp_path)
@@ -8474,6 +8735,7 @@ ws_get_http_map (ws_connection_t * ws, int dir, caddr_t lpath, int set_map)
   socklen_t len = sizeof (sa);
   ws_http_map_t * pmap = NULL;
   ws_http_map_t ** map = set_map ? &(ws->ws_map) : &pmap;
+  int port = 0;
 
   if (!ws)
     return NULL;
@@ -8482,16 +8744,21 @@ ws_get_http_map (ws_connection_t * ws, int dir, caddr_t lpath, int set_map)
   if (!getsockname (s, (struct sockaddr *) &sa, &len))
     {
       unsigned char *addr = (unsigned char *) &sa.sin_addr;
-      snprintf (nif, sizeof (nif), "%d.%d.%d.%d:%u", addr[0], addr[1], addr[2], addr[3], ntohs (sa.sin_port));
+      port = ntohs (sa.sin_port);
+      snprintf (nif, sizeof (nif), "%d.%d.%d.%d:%u", addr[0], addr[1], addr[2], addr[3], port);
     }
 
   tcpses_addr_info (ws->ws_session->dks_session, listen_host, sizeof (listen_host), 80, 1);
-  host_hf = ws_get_packed_hf (ws, "Host:", listen_host);
+  /* was : host_hf = ws_get_packed_hf (ws, "Host:", listen_host); */
+  if (NULL == (host_hf = ws_mime_header_field (ws->ws_lines, "X-Forwarded-Host", NULL, 1)))
+    host_hf = ws_mime_header_field (ws->ws_lines, "Host", NULL, 1);
+  if (NULL == host_hf)
+    host_hf = box_dv_short_string (listen_host);
 #ifdef _SSL
   ssl = (SSL *) tcpses_get_ssl (ws->ws_session->dks_session);
   is_https = (NULL != ssl);
 #endif
-  host = http_host_normalize_1 (host_hf, 0, (is_https ? 443 : 80));
+  host = http_host_normalize_1 (host_hf, 0, (is_https ? 443 : 80), IS_GATEWAY_PROXY (ws) ? port : 0);
 
   if (0 != nif[0])
     ppath = get_http_map (map, lpath, dir, host, nif); /* trying vhost & ip */
@@ -9802,13 +10069,12 @@ bif_http_methods_set (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
     sqlr_new_error ("42000", "HT012", "http_methods_set function is allowed only inside HTTP request");
   ws = qi->qi_client->cli_ws;
   http_set_default_options (ws);
-  DO_BOX (state_slot_t *, arg, inx, args)
+  for (inx = 0; inx < BOX_ELEMENTS (args); inx ++)
     {
       caddr_t v = bif_string_or_null_arg (qst, args, inx, "http_methods_set");
       m = http_method_id (v);
       ws->ws_options [m] = '\x1';
     }
-  END_DO_BOX;
   return NULL;
 }
 
@@ -9911,10 +10177,14 @@ http_init_part_one ()
   bif_define ("http_rewrite", bif_http_rewrite);
   bif_define ("http_enable_gz", bif_http_enable_gz);
   bif_define ("http_header", bif_http_header);
+  bif_define ("http_response_header", bif_http_header);
   bif_define ("http_host", bif_http_host);
   bif_define_typed ("http_header_get", bif_http_header_get, &bt_varchar);
   bif_define_typed ("http_header_array_get", bif_http_header_array_get, &bt_any);
   bif_define ("http", bif_http_result);
+  bif_define ("http_xmlelement_start", bif_http_xmlelement_start);
+  bif_define ("http_xmlelement_empty", bif_http_xmlelement_empty);
+  bif_define ("http_xmlelement_end", bif_http_xmlelement_end);
   bif_define ("http_value", bif_http_value);
   bif_define ("http_url", bif_http_url);
   bif_define ("http_uri", bif_http_uri);
@@ -9947,6 +10217,8 @@ http_init_part_one ()
   bif_define("http_flush", bif_http_flush);
   bif_define ("http_pending_req", bif_http_pending_req);
   bif_define ("http_kill", bif_http_kill);
+  bif_define ("http_lock", bif_http_lock);
+  bif_define ("http_unlock", bif_http_unlock);
   bif_define ("http_request_header", bif_http_request_header);
   bif_define ("http_request_header_full", bif_http_request_header_full);
   bif_define_typed ("http_param", bif_http_param, &bt_any);
@@ -10154,7 +10426,7 @@ http_init_part_two ()
     {
       char err_buf [1024];
       SSL_CTX* ssl_ctx = NULL;
-      SSL_METHOD *ssl_meth = NULL;
+      const SSL_METHOD *ssl_meth = NULL;
       ssl_meth = SSLv23_server_method();
       ssl_ctx = SSL_CTX_new (ssl_meth);
       if (!ssl_ctx)
@@ -10204,13 +10476,13 @@ http_init_part_two ()
 
 	  SSL_CTX_set_client_CA_list (ssl_ctx, skCAList);
 	  skCAList = SSL_CTX_get_client_CA_list (ssl_ctx);
-	  if (sk_X509_ALGOR_num(skCAList) == 0)
+	  if (sk_X509_NAME_num(skCAList) == 0)
 	    log_warning ("HTTPS Client authentication requested but no CA known for verification");
 
-	  for (i = 0; i < sk_X509_ALGOR_num(skCAList); i++)
+	  for (i = 0; i < sk_X509_NAME_num(skCAList); i++)
 	    {
 	      char ca_buf[1024];
-	      X509_NAME *ca_name = (X509_NAME *) sk_X509_ALGOR_value (skCAList, i);
+	      X509_NAME *ca_name = (X509_NAME *) sk_X509_NAME_value (skCAList, i);
               if (X509_NAME_oneline (ca_name, ca_buf, sizeof (ca_buf)))
 		log_debug ("HTTPS Using X509 Client CA %s", ca_buf);
 	    }
@@ -10700,6 +10972,3 @@ soap_mime_tree (ws_connection_t * ws, dk_set_t * set, caddr_t * err, int soap_ve
 	}
     }
 }
-
-
-
diff --git a/libsrc/Wi/http.h b/libsrc/Wi/http.h
index c49baa6..2e8e487 100644
--- a/libsrc/Wi/http.h
+++ b/libsrc/Wi/http.h
@@ -1,7 +1,7 @@
 /*
  *  http.h
  *
- *  $Id: http.h,v 1.22.2.10 2010/05/03 19:31:46 source Exp $
+ *  $Id: http.h,v 1.22.2.14 2010/11/12 21:00:15 source Exp $
  *
  *  Definitions for HTTP server
  *
@@ -77,6 +77,8 @@ typedef struct ws_http_map_s
     caddr_t 	hm_htkey;
     caddr_t     hm_url_rewrite_rule;
     int		hm_url_rewrite_keep_lpath;
+    id_hash_t *	hm_cors;
+    int 	hm_cors_restricted;
   } ws_http_map_t;
 #endif
 
@@ -122,6 +124,7 @@ typedef struct ws_connection_s
     unsigned long 	ws_flushed;
 #endif
     caddr_t		ws_client_ip;
+    char 		ws_forward;
     wcharset_t *	ws_charset;
     int			ws_ignore_disconnect;
     caddr_t 		ws_store_in_cache;     /* the url to be cached */
@@ -292,7 +295,7 @@ char * ws_usr_qual (ws_connection_t * ws, int is_soap);
 extern void dks_sqlval_esc_write (caddr_t *qst, dk_session_t *out, caddr_t val, wcharset_t *tgt_carset, wcharset_t *src_charset, int dks_esc_mode);
 extern void http_value_esc (caddr_t *qst, dk_session_t *out, caddr_t val, char *tag, int dks_esc_mode);
 #if 0
-#define http_trace(a) printf a
+#define http_trace(a) do { printf ("HTTP trace: "); printf a; } while (0)
 #else
 #define http_trace(a)
 #endif
@@ -362,6 +365,7 @@ void http_client_cache_register (query_instance_t * qi, caddr_t url, caddr_t hea
 void zlib_box_gzip_uncompress (caddr_t src, dk_session_t * out, caddr_t * err_ret);
 
 extern caddr_t http_sys_find_best_accept_impl (caddr_t * qst, state_slot_t *ret_val_ssl, caddr_t accept_strg, caddr_t *supp, const char *fname);
+void ws_http_error (ws_connection_t * ws, const caddr_t code, const caddr_t message, const caddr_t uri, const caddr_t path);
 
 
 #ifdef _SSL
@@ -381,6 +385,7 @@ typedef struct https_ctx_info_s
 #endif
 extern char * http_cli_proxy_server;
 int http_cli_target_is_proxy_exception (char *);
+void ws_http_body_read (ws_connection_t * ws, dk_session_t **out);
 
 #define WS_CE_NONE 1
 #define WS_CE_CHUNKED 2
diff --git a/libsrc/Wi/insert.c b/libsrc/Wi/insert.c
index bce30e8..f79472c 100644
--- a/libsrc/Wi/insert.c
+++ b/libsrc/Wi/insert.c
@@ -1,7 +1,7 @@
 /*
  *  insert.c
  *
- *  $Id: insert.c,v 1.19.2.10 2010/02/10 12:57:36 source Exp $
+ *  $Id: insert.c,v 1.19.2.11 2010/11/09 10:59:15 source Exp $
  *
  *  Insert
  *
@@ -344,7 +344,7 @@ pg_check_map_1 (buffer_desc_t * buf)
   /* for debug, copy the entries, the whole struct may overflow addr space. */
   if (!buf->bd_is_write && !wi_inst.wi_checkpoint_atomic)
     GPF_T1 ("must have written access to buffer to check it");
-#ifdef MTX_DEBUG
+#ifdef PAGE_DEBUG
   if (buf->bd_is_write && buf->bd_writer != THREAD_CURRENT_THREAD)
     GPF_T1 ("Must have write on buffer to check it");
 #endif
diff --git a/libsrc/Wi/inxop.c b/libsrc/Wi/inxop.c
index 562341e..85d5582 100644
--- a/libsrc/Wi/inxop.c
+++ b/libsrc/Wi/inxop.c
@@ -1,7 +1,7 @@
 /*
  *  inxop.c
  *
- *  $Id: inxop.c,v 1.21.2.3 2010/03/08 12:04:12 source Exp $
+ *  $Id: inxop.c,v 1.21.2.4 2010/08/26 18:03:48 source Exp $
  *
  *  SQL query execution
  *
@@ -417,7 +417,7 @@ inxop_bm_next (inx_op_t * iop , query_instance_t * qi, int op,
   if (0 && IOP_TARGET == op)
     check_target (itc);
   iob = (inxop_bm_t *) QST_GET (qst, iop->iop_bitmap);
-  if (iob &&  iob->iob_is_inited)
+  if (iob &&  iob->iob_is_inited && itc->itc_bp.bp_is_pos_valid)
     {
       rc = inxop_iob_next (iop, itc, iob, op, qst);
       if (rc != IOP_READ_INDEX)
diff --git a/libsrc/Wi/json_l.c b/libsrc/Wi/json_l.c
index 911aa46..0ed047e 100644
--- a/libsrc/Wi/json_l.c
+++ b/libsrc/Wi/json_l.c
@@ -670,7 +670,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( jsonyytext, jsonyyleng, 1, jsonyyout )
+#define ECHO do { if (fwrite( jsonyytext, jsonyyleng, 1, jsonyyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
diff --git a/libsrc/Wi/ksrvext.h b/libsrc/Wi/ksrvext.h
index 0d3718f..bb9a25d 100644
--- a/libsrc/Wi/ksrvext.h
+++ b/libsrc/Wi/ksrvext.h
@@ -1,7 +1,7 @@
 /*
  *  ksrvext.h
  *
- *  $Id: ksrvext.h,v 1.9.2.3 2010/03/08 12:04:12 source Exp $
+ *  $Id: ksrvext.h,v 1.9.2.6 2010/11/26 10:46:33 source Exp $
  *
  *  Virtuoso Server Extension API
  *
@@ -161,8 +161,9 @@ caddr_t bif_strict_array_or_null_arg (caddr_t * qst, state_slot_t ** args, int n
 caddr_t bif_array_or_null_arg (caddr_t * qst, state_slot_t ** args, int nth, const char *func);
 void bif_result_inside_bif (int n, ...);
 
-
-caddr_t srv_make_new_error (const char *code, const char *virt_code, const char *msg,...);
+#ifndef srv_make_new_error
+extern caddr_t srv_make_new_error (const char *code, const char *virt_code, const char *msg,...);
+#endif
 void sqlr_error (const char *code, const char *msg,...);
 void sqlr_new_error (const char *code, const char *virt_code, const char *msg,...);
 void sqlr_resignal (caddr_t err);
@@ -381,6 +382,9 @@ struct thread_s
   void *		thr_tmp_pool;
   int                   thr_attached;
   caddr_t		thr_dbg;
+#ifndef NDEBUG
+  void *		thr_pg_dbg;
+#endif
 };
 
 #define MAX_NESTED_FUTURES      20
@@ -395,6 +399,8 @@ struct dk_thread_s
   future_request_t *  dkt_requests[MAX_NESTED_FUTURES];
 };
 
+typedef int (*mtx_entry_check_t) (dk_mutex_t * mtx, thread_t * self, void * cd);
+
 struct mutex_s
   {
     /* os specific handle */
@@ -623,12 +629,16 @@ struct s_node_s
    s_node_t *          next;
 };
 
-
+EXE_EXPORT (caddr_t, list_to_array, (dk_set_t l));
 #ifdef MALLOC_DEBUG
 caddr_t dbg_strses_string (DBG_PARAMS dk_session_t * ses);
 caddr_t dbg_list_to_array (char *file, int line, dk_set_t l);
 #define strses_string(S) dbg_strses_string (__FILE__, __LINE__, (S))
+#ifndef _USRDLL
+#ifndef EXPORT_GATE
 #define list_to_array(S)	dbg_list_to_array (__FILE__, __LINE__, (S))
+#endif
+#endif
 #else
 caddr_t strses_string (dk_session_t * ses);
 caddr_t list_to_array (dk_set_t l);
diff --git a/libsrc/Wi/lock.c b/libsrc/Wi/lock.c
index 4891506..11aabd8 100644
--- a/libsrc/Wi/lock.c
+++ b/libsrc/Wi/lock.c
@@ -1,7 +1,7 @@
 /*
  *  lock.c
  *
- *  $Id: lock.c,v 1.20.2.17 2010/05/21 12:26:35 source Exp $
+ *  $Id: lock.c,v 1.20.2.20 2011/03/23 12:25:08 source Exp $
  *
  *  Locking concurrency control
  *
@@ -474,8 +474,6 @@ lt_done (lock_trx_t * lt)
   {
     int64 plt = 0;
     int inx;
-    if (local_cll.cll_id_to_trx)
-      gethash_64 (plt, lt->lt_trx_no, local_cll.cll_id_to_trx);
     if (plt)
       GPF_T1 ("lt in id to trx  at lt_done");
     for (inx = 0; inx < trx_rc->rc_fill; inx++)
@@ -513,13 +511,6 @@ lt_commit (lock_trx_t * lt, int free_trx)
 	return LTE_2PC_ERROR;
       }
 #endif
-  if (LTE_OK != lt_log_replication (lt))
-    {
-      lt_rollback_1 (lt, free_trx);
-      LT_ERROR_DETAIL_SET (lt, box_dv_short_string (
-	    "Problem writing to the replication log"));
-      return LTE_LOG_FAILED;
-    }
 
   LEAVE_TXN;
   mutex_enter (log_write_mtx);
@@ -534,7 +525,6 @@ lt_commit (lock_trx_t * lt, int free_trx)
     }
   mutex_leave (log_write_mtx);
   IN_TXN;
-  lt_send_repl_cast (lt);
   DBG_PT_COMMIT (lt);
       ASSERT_IN_TXN;
       LT_CLOSE_ACK_THREADS(lt);
@@ -631,7 +621,6 @@ lt_rollback_1 (lock_trx_t * lt, int free_trx)
   LEAVE_TXN;
   log_cl_final (lt, SQL_ROLLBACK);
   IN_TXN;
-  lt_repl_rollback (lt);
   DBG_PT_ROLLBACK (lt);
   if (lt->lt_status != LT_DELTA_ROLLED_BACK)
     {
@@ -1752,7 +1741,7 @@ pl_release (page_lock_t * pl, lock_trx_t * lt, buffer_desc_t * buf)
       if (pl->pl_n_row_locks)
 	GPF_T1 ("can't free pl with row locks");
       if (pl->pl_owner)
-	GPF_T1 (";lock should not have an owner when it is gettingf freed");
+	GPF_T1 ("lock should not have an owner when it is getting freed");
       mutex_enter (&itm->itm_mtx);
       if (DP_DELETED != pl->pl_page && PL_FINISHING != pl->pl_page)
 	{
diff --git a/libsrc/Wi/log.c b/libsrc/Wi/log.c
index 918d7a2..fffde7e 100644
--- a/libsrc/Wi/log.c
+++ b/libsrc/Wi/log.c
@@ -1,7 +1,7 @@
 /*
  *  log.c
  *
- *  $Id: log.c,v 1.16.2.18 2010/05/21 12:40:47 source Exp $
+ *  $Id: log.c,v 1.16.2.21 2011/01/25 18:54:23 source Exp $
  *
  *  Transaction log write and recovery
  *
@@ -1092,7 +1092,7 @@ log_replay_text (lock_trx_t * lt, dk_session_t * in, int is_pushback, int use_st
   int n_args = 0;
   caddr_t *entry = (caddr_t *) scan_session (in);
   dtp_t dtp = DV_TYPE_OF (entry);
-  caddr_t text = DV_ARRAY_OF_POINTER == dtp ? entry[0] : (caddr_t) entry;
+  caddr_t text = DV_ARRAY_OF_POINTER == dtp && BOX_ELEMENTS (entry) > 0 ? entry[0] : (caddr_t) entry;
   caddr_t err = NULL;
   caddr_t stmt_id = box_dv_short_string ("repl_stmt");
   query_t *qr;
@@ -1102,6 +1102,12 @@ log_replay_text (lock_trx_t * lt, dk_session_t * in, int is_pushback, int use_st
   caddr_t *arr = NULL;
   LOG_REPL_OPTIONS (opts);
 
+  if (!DV_STRINGP (text))
+    {
+      dk_free_box ((box_t) entry);
+      return srv_make_new_error ("42000", "TR100", "log_replay_text: invalid query text");
+    }
+
   if (!is_pushback)
     {
       if (dtp == DV_ARRAY_OF_POINTER)
@@ -1739,6 +1745,16 @@ try_again:
       cli_set_new_trx (cli);
       rc = LTE_OK;
     }
+  if (in_log_replay)
+    {
+      wi_free_old_qrs ();
+      DO_SET (dbe_schema_t *, sc, &wi_inst.wi_free_schemas)
+	{
+	  dk_set_delete (&wi_inst.wi_free_schemas, (void *) sc);
+	  dbe_schema_free (sc);
+	}
+      END_DO_SET ();
+    }
   LEAVE_TXN;
   if (LTE_LOG_FAILED == rc)
     {
@@ -1759,48 +1775,6 @@ int level_print = 0;
 void
 logh_set_level (lock_trx_t * lt, caddr_t * logh)
 {
-#if REPLICATION_SUPPORT
-  if (logh && logh[LOGH_REPLICATION])
-    {
-      caddr_t *replh = (caddr_t *) logh[LOGH_REPLICATION];
-      repl_acct_t *ra;
-      ra = ra_find (replh[REPLH_SERVER], replh[REPLH_ACCOUNT]);
-      if (level_print)
-        {
-	  dbg_printf ((" Rfwd level %s %s " BOXINT_FMT "\n", replh [REPLH_SERVER], replh [REPLH_ACCOUNT] ? replh [REPLH_ACCOUNT] : "-", unbox (replh [REPLH_LEVEL])));
-	}
-      if (!ra)
-	{
-	  ra = ra_add (replh[REPLH_SERVER], replh[REPLH_ACCOUNT], 1, 0, 0);
-	}
-
-      if (replh[REPLH_LEVEL])
-	{
-	  caddr_t log_array;
-#ifdef UNIX
-	  gettimeofday (&ra->ra_last_txn, NULL);
-#else
-	  ra->ra_last_txn.tv_sec = (long) time (NULL);
-#endif
-	  log_array = list (4, box_string ("sequence_set (?, ?, ?)"),
-		box_string (ra->ra_sequence),
-		box_num (unbox (replh[REPLH_LEVEL])), box_num (SET_ALWAYS));
-	  ASSERT_IN_TXN;
-	  sequence_set (ra->ra_sequence, (long) unbox (replh[REPLH_LEVEL]), SET_ALWAYS, INSIDE_MAP);
-	  log_text_array (lt, log_array);
-	  dk_free_tree (log_array);
-	  /* having replayed a replication record, log its level as a sequence set in the roll forward
-	   * log of this txn since the replication feed record itself will not be logged */
-	}
-      else
-	{
-	  /* A zero level on an account means the replicator is now synced */
-	  ra->ra_synced = RA_IN_SYNC;
-	  log_info ("Replication Account %s %s IN sync, level %ld.\n",
-		    ra->ra_server, ra->ra_account, sequence_set (ra->ra_sequence, 0, SEQUENCE_GET, INSIDE_MAP));
-	}
-    }
-#endif
 }
 
 
diff --git a/libsrc/Wi/meta.c b/libsrc/Wi/meta.c
index 4264b55..1917027 100644
--- a/libsrc/Wi/meta.c
+++ b/libsrc/Wi/meta.c
@@ -1,7 +1,7 @@
 /*
  *  meta.c
  *
- *  $Id: meta.c,v 1.17.2.7 2010/04/23 20:03:56 source Exp $
+ *  $Id: meta.c,v 1.17.2.8 2010/07/19 06:59:14 source Exp $
  *
  *  META
  *
@@ -1748,9 +1748,9 @@ sch_full_proc_name_1 (dbe_schema_t * sc, const char *ref_name, char *q_def, char
     m[0] = 0;
 
   if (m[0] == 0)
-    snprintf (qn, sizeof (qn), "%s.%s", q ? q : q_def, n);
+    snprintf (qn, sizeof (qn), "%s.%s", q, n);
   else
-    snprintf (qn, sizeof (qn), "%s.%s.%s", q ? q : q_def, m, n);
+    snprintf (qn, sizeof (qn), "%s.%s.%s", q, m, n);
 
   proc = (query_t *) sch_name_to_object_sc (sc, sc_to_proc, o_def, o, qn, 1);
   if (proc && proc != (query_t *) -1)
diff --git a/libsrc/Wi/neodisk.c b/libsrc/Wi/neodisk.c
index 62bd9eb..a3a2f01 100644
--- a/libsrc/Wi/neodisk.c
+++ b/libsrc/Wi/neodisk.c
@@ -1,7 +1,7 @@
 /*
  *  neodisk.c
  *
- *  $Id: neodisk.c,v 1.19.2.17 2010/03/15 13:16:30 source Exp $
+ *  $Id: neodisk.c,v 1.19.2.21 2011/02/25 17:31:18 source Exp $
  *
  *  Neodisk Checkpoint
  *
@@ -143,7 +143,9 @@ cpt_rollback (int may_freeze)
 #endif
 	  rdbg_printf (("trx %lx killed by checkpoint while closing\n", lt));
 	  lt_kill_other_trx (lt, NULL, NULL, may_freeze);
-	  goto next;
+	  if (lt->lt_threads)
+	    goto next;
+	  break;
 	case LT_FREEZE:
 	  if (!lt->lt_close_ack_threads && lt->lt_threads && !lt->lt_vdb_threads && !lt->lt_lw_threads)
 	    {
@@ -1078,7 +1080,7 @@ buf_unremap (buffer_desc_t * buf)
 
 
 void
-cpt_unremap_ram (int target)
+cpt_unremap_ram (int target, int * bufs_done_total)
 {
   /* take buffers that already happen to be in memory and unremap them, stop if quota met */
   DO_SET (index_tree_t *, it, &cpt_dbs->dbs_trees)
@@ -1092,6 +1094,7 @@ cpt_unremap_ram (int target)
 	      if (buf->bd_page != buf->bd_physical_page)
 		{
 		  buf_unremap (buf);
+		  *bufs_done_total += 1;
 		  if (cpt_dbs->dbs_cpt_remap->ht_count <= target)
 		    {
 		      mutex_leave (&it->it_maps[inx].itm_mtx);
@@ -1109,7 +1112,7 @@ cpt_unremap_ram (int target)
 
 
 void
-cpt_em_unremap_read (extent_map_t * em, index_tree_t * it, int * bufs_done, int buf_quota, dk_set_t * bufs_list)
+cpt_em_unremap_read (extent_map_t * em, index_tree_t * it, int * bufs_done, int buf_quota, dk_set_t * bufs_list, int *bufs_done_total)
 {
   DO_EXT (ext, em)
     {
@@ -1121,6 +1124,7 @@ cpt_em_unremap_read (extent_map_t * em, index_tree_t * it, int * bufs_done, int
 	continue;
       dk_set_push (bufs_list, (void*) bufs);
       *bufs_done += BOX_ELEMENTS (bufs);
+      *bufs_done_total += BOX_ELEMENTS (bufs);
       if (*bufs_done > buf_quota)
 	goto enough_read;
     }
@@ -1161,12 +1165,12 @@ cpt_unremap_bufs (it_cursor_t * itc, dk_set_t * bufs_list)
 
 
 void
-em_unremap (index_tree_t * it, it_cursor_t * itc, extent_map_t * em, int * bufs_done, int buf_quota, int target, dk_set_t * bufs_list)
+em_unremap (index_tree_t * it, it_cursor_t * itc, extent_map_t * em, int * bufs_done, int buf_quota, int target, dk_set_t * bufs_list, int *bufs_done_total)
 {
   for (;;)
     {
       int l1 = dk_set_length (*bufs_list);
-      cpt_em_unremap_read (em, it, bufs_done, buf_quota, bufs_list);
+      cpt_em_unremap_read (em, it, bufs_done, buf_quota, bufs_list, bufs_done_total);
       if (l1 == dk_set_length (*bufs_list))
 	break;
       if (*bufs_done > buf_quota)
@@ -1214,24 +1218,40 @@ cpt_place_buffers ()
 
 
 void dbs_cache_check (dbe_storage_t * dbs, int mode);
+long cpt_remap_free_logical_pages;
+long cpt_reamp_free_physical_pages;
+long cpt_reamp_free_pages;
 
 void
 cpt_unremap (dbe_storage_t * dbs, it_cursor_t * itc)
 {
-  int bufs_done = 0, buf_quota = main_bufs / 4, target;
+  int bufs_done = 0, bufs_done_total, buf_quota = main_bufs / 4, target;
   dk_set_t bufs_list = NULL;
   cpt_remap_reverse = hash_table_allocate (cpt_dbs->dbs_cpt_remap->ht_actual_size);
+  cpt_remap_free_logical_pages = cpt_reamp_free_physical_pages = cpt_reamp_free_pages = 0;
   DO_HT (ptrlong, log, ptrlong, phys, dbs->dbs_cpt_remap)
     {
+#ifndef NDEBUG
+      int pf, lf;
+      pf = dbs_is_free_page (dbs, phys);
+      lf = dbs_is_free_page (dbs, log);
+      if (pf && lf)
+	cpt_reamp_free_pages++;
+      else if (pf)
+	cpt_reamp_free_physical_pages++;
+      else if (lf)
+	cpt_remap_free_logical_pages++;
+#endif
       sethash ((void*)phys, cpt_remap_reverse, (void*)log);
     }
   END_DO_HT;
   target = MIN (dbs->dbs_max_cp_remaps, (dbs->dbs_cpt_remap->ht_count / 20) * 19);
  again:
-  cpt_unremap_ram (target);
+  bufs_done_total = 0;
+  cpt_unremap_ram (target, &bufs_done_total);
   if (cpt_dbs->dbs_cpt_remap->ht_count > target)
     {
-      em_unremap (dbs->dbs_cpt_tree, itc, dbs->dbs_extent_map, &bufs_done, buf_quota, target, &bufs_list);
+      em_unremap (dbs->dbs_cpt_tree, itc, dbs->dbs_extent_map, &bufs_done, buf_quota, target, &bufs_list, &bufs_done_total);
       cpt_unremap_bufs (itc, &bufs_list);
       bufs_done = 0;
       cpt_place_buffers ();
@@ -1239,7 +1259,7 @@ cpt_unremap (dbe_storage_t * dbs, it_cursor_t * itc)
 	{
 	  if (it->it_extent_map != dbs->dbs_extent_map && it->it_extent_map)
 	    {
-	      em_unremap (it, itc, it->it_extent_map, &bufs_done, buf_quota, target, &bufs_list);
+	      em_unremap (it, itc, it->it_extent_map, &bufs_done, buf_quota, target, &bufs_list, &bufs_done_total);
 	      if (cpt_dbs->dbs_cpt_remap->ht_count <= target)
 		break;
 	    }
@@ -1248,7 +1268,7 @@ cpt_unremap (dbe_storage_t * dbs, it_cursor_t * itc)
       cpt_unremap_bufs (itc, &bufs_list);
     }
   bp_flush_all ();
-  if (cpt_dbs->dbs_cpt_remap->ht_count > target)
+  if (bufs_done_total && cpt_dbs->dbs_cpt_remap->ht_count > target)
     goto again;
   iq_shutdown (IQ_STOP);
   /* verify all unremaps are written.  shutdown exityy with bufs in iq will lose the pages, very corrupt, often visible as bad parent linkand sometimes as just lost updates.  */
@@ -1404,10 +1424,12 @@ wi_write_dirty (void)
 
 
 void
-dbs_backup_check (dbe_storage_t * dbs)
+dbs_backup_check (dbe_storage_t * dbs, int flag)
 {
 #if 1
   int n;
+  if (flag != CPT_INC_RESET)
+    return;
   for (n = 0; n < dbs->dbs_n_pages; n++)
     {
       int fl;
@@ -1877,7 +1899,7 @@ dbs_checkpoint (char *log_name, int shutdown)
   DO_SET (dbe_storage_t *, dbs, &wi_inst.wi_master_wd->wd_storage)
     {
       dbs_cache_check (dbs, IT_CHECK_ALL);
-      dbs_backup_check (dbs);
+      dbs_backup_check (dbs, shutdown);
     }
   END_DO_SET();
 
@@ -1975,7 +1997,7 @@ dbs_checkpoint (char *log_name, int shutdown)
   DO_SET (dbe_storage_t *, dbs, &wi_inst.wi_master_wd->wd_storage)
     {
       dbs_cache_check (dbs, IT_CHECK_POST);
-      dbs_backup_check (dbs);
+      dbs_backup_check (dbs, shutdown);
     }
   END_DO_SET();
   if (CPT_NORMAL == shutdown)
diff --git a/libsrc/Wi/nquad_p.c b/libsrc/Wi/nquad_p.c
index ccdb928..5ef61e2 100644
--- a/libsrc/Wi/nquad_p.c
+++ b/libsrc/Wi/nquad_p.c
@@ -585,14 +585,14 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   147,   147,   149,   153,   153,   154,   155,   158,   161,
-     162,   163,   164,   165,   168,   170,   174,   177,   179,   181,
-     184,   189,   190,   194,   195,   196,   197,   198,   199,   203,
-     204,   205,   206,   207,   208,   212,   221,   222,   223,   227,
-     228,   229,   230,   231,   232,   233,   234,   240,   240,   246,
-     246,   251,   251,   256,   258,   260,   264,   268,   272,   276,
-     282,   282,   290,   291,   294,   294,   298,   302,   307,   314,
-     315,   320,   327,   331,   338,   346
+       0,   147,   147,   149,   153,   153,   154,   155,   174,   177,
+     178,   179,   180,   181,   184,   186,   190,   193,   195,   197,
+     200,   205,   206,   210,   211,   212,   213,   214,   215,   219,
+     220,   221,   222,   223,   224,   228,   237,   238,   239,   243,
+     244,   245,   246,   247,   248,   249,   250,   256,   256,   262,
+     262,   267,   267,   272,   274,   276,   280,   284,   288,   292,
+     298,   298,   306,   307,   310,   310,   314,   318,   323,   330,
+     331,   336,   343,   347,   354,   362
 };
 #endif
 
@@ -1611,14 +1611,30 @@ yyreduce:
 /* Line 1455 of yacc.c  */
 #line 155 "./nquad_p.y"
     {
-		dk_set_push (&(ttlp_arg->ttlp_namespaces), (yyvsp[(3) - (4)].box));
-		dk_set_push (&(ttlp_arg->ttlp_namespaces), (yyvsp[(2) - (4)].box)); }
+		caddr_t *old_uri_ptr;
+		if (NULL != ttlp_arg->ttlp_namespaces_prefix2iri)
+		  old_uri_ptr = (caddr_t *)id_hash_get (ttlp_arg->ttlp_namespaces_prefix2iri, &((yyvsp[(2) - (4)].box)));
+		else
+		  {
+		    ttlp_arg->ttlp_namespaces_prefix2iri = (id_hash_t *)box_dv_dict_hashtable (31);
+		    old_uri_ptr = NULL;
+		  }
+		if (NULL != old_uri_ptr)
+		  {
+		    int err = strcmp (old_uri_ptr[0], (yyvsp[(3) - (4)].box));
+		    dk_free_box ((yyvsp[(2) - (4)].box));
+		    dk_free_box ((yyvsp[(3) - (4)].box));
+		    if (err)
+		      ttlyyerror_action ("Namespace prefix is re-used for a different namespace IRI");
+		  }
+		else
+		  id_hash_set (ttlp_arg->ttlp_namespaces_prefix2iri, &((yyvsp[(2) - (4)].box)), &((yyvsp[(3) - (4)].box))); }
     break;
 
   case 8:
 
 /* Line 1455 of yacc.c  */
-#line 158 "./nquad_p.y"
+#line 174 "./nquad_p.y"
     {
 		dk_free_box (ttlp_arg->ttlp_default_ns_uri);
 		ttlp_arg->ttlp_default_ns_uri = (yyvsp[(3) - (4)].box); }
@@ -1627,14 +1643,14 @@ yyreduce:
   case 13:
 
 /* Line 1455 of yacc.c  */
-#line 165 "./nquad_p.y"
+#line 181 "./nquad_p.y"
     { ttlyyerror_action ("Only a triple or a special clause (like prefix declaration) is allowed here"); }
     break;
 
   case 16:
 
 /* Line 1455 of yacc.c  */
-#line 174 "./nquad_p.y"
+#line 190 "./nquad_p.y"
     { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = ttlp_arg->ttlp_last_complete_uri;
 		ttlp_arg->ttlp_last_complete_uri = NULL; }
@@ -1643,7 +1659,7 @@ yyreduce:
   case 17:
 
 /* Line 1455 of yacc.c  */
-#line 177 "./nquad_p.y"
+#line 193 "./nquad_p.y"
     { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = (yyvsp[(1) - (1)].box); }
     break;
@@ -1651,7 +1667,7 @@ yyreduce:
   case 18:
 
 /* Line 1455 of yacc.c  */
-#line 179 "./nquad_p.y"
+#line 195 "./nquad_p.y"
     { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = (yyvsp[(1) - (1)].box); }
     break;
@@ -1659,7 +1675,7 @@ yyreduce:
   case 19:
 
 /* Line 1455 of yacc.c  */
-#line 181 "./nquad_p.y"
+#line 197 "./nquad_p.y"
     {
 		TTLYYERROR_ACTION_COND (TTLP_SKIP_LITERAL_SUBJECTS, "Virtuoso does not support literal subjects");
 		dk_free_tree (ttlp_arg->ttlp_subj_uri); ttlp_arg->ttlp_subj_uri = NULL; }
@@ -1668,7 +1684,7 @@ yyreduce:
   case 20:
 
 /* Line 1455 of yacc.c  */
-#line 184 "./nquad_p.y"
+#line 200 "./nquad_p.y"
     { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = NULL; }
     break;
@@ -1676,98 +1692,98 @@ yyreduce:
   case 21:
 
 /* Line 1455 of yacc.c  */
-#line 189 "./nquad_p.y"
+#line 205 "./nquad_p.y"
     { ttlp_arg->ttlp_special_qnames &= ~((yyvsp[(1) - (1)].token_type)); }
     break;
 
   case 22:
 
 /* Line 1455 of yacc.c  */
-#line 190 "./nquad_p.y"
+#line 206 "./nquad_p.y"
     { ttlp_arg->ttlp_special_qnames &= ~((yyvsp[(3) - (3)].token_type)); }
     break;
 
   case 23:
 
 /* Line 1455 of yacc.c  */
-#line 194 "./nquad_p.y"
+#line 210 "./nquad_p.y"
     { (yyval.token_type) = ttlp_bit_of_special_qname ((yyvsp[(1) - (1)].box)); }
     break;
 
   case 24:
 
 /* Line 1455 of yacc.c  */
-#line 195 "./nquad_p.y"
+#line 211 "./nquad_p.y"
     { (yyval.token_type) = TTLP_ALLOW_QNAME_A; }
     break;
 
   case 25:
 
 /* Line 1455 of yacc.c  */
-#line 196 "./nquad_p.y"
+#line 212 "./nquad_p.y"
     { (yyval.token_type) = TTLP_ALLOW_QNAME_HAS; }
     break;
 
   case 26:
 
 /* Line 1455 of yacc.c  */
-#line 197 "./nquad_p.y"
+#line 213 "./nquad_p.y"
     { (yyval.token_type) = TTLP_ALLOW_QNAME_IS; }
     break;
 
   case 27:
 
 /* Line 1455 of yacc.c  */
-#line 198 "./nquad_p.y"
+#line 214 "./nquad_p.y"
     { (yyval.token_type) = TTLP_ALLOW_QNAME_OF; }
     break;
 
   case 28:
 
 /* Line 1455 of yacc.c  */
-#line 199 "./nquad_p.y"
+#line 215 "./nquad_p.y"
     { (yyval.token_type) = TTLP_ALLOW_QNAME_THIS; }
     break;
 
   case 29:
 
 /* Line 1455 of yacc.c  */
-#line 203 "./nquad_p.y"
+#line 219 "./nquad_p.y"
     { dk_free_tree (ttlp_arg->ttlp_pred_uri); ttlp_arg->ttlp_pred_uri = ttlp_arg->ttlp_last_complete_uri; ttlp_arg->ttlp_last_complete_uri = NULL; }
     break;
 
   case 30:
 
 /* Line 1455 of yacc.c  */
-#line 204 "./nquad_p.y"
+#line 220 "./nquad_p.y"
     { dk_free_tree (ttlp_arg->ttlp_pred_uri); ttlp_arg->ttlp_pred_uri = (yyvsp[(1) - (1)].box); }
     break;
 
   case 31:
 
 /* Line 1455 of yacc.c  */
-#line 205 "./nquad_p.y"
+#line 221 "./nquad_p.y"
     { dk_free_tree (ttlp_arg->ttlp_pred_uri); ttlp_arg->ttlp_pred_uri = uname_rdf_ns_uri_type; }
     break;
 
   case 32:
 
 /* Line 1455 of yacc.c  */
-#line 206 "./nquad_p.y"
+#line 222 "./nquad_p.y"
     { dk_free_tree (ttlp_arg->ttlp_pred_uri); ttlp_arg->ttlp_pred_uri = box_dv_uname_string ("http://www.w3.org/2002/07/owl#sameAs"); }
     break;
 
   case 33:
 
 /* Line 1455 of yacc.c  */
-#line 207 "./nquad_p.y"
+#line 223 "./nquad_p.y"
     { dk_free_tree (ttlp_arg->ttlp_pred_uri); ttlp_arg->ttlp_pred_uri = box_dv_uname_string ("http://www.w3.org/2000/10/swap/log#implies"); }
     break;
 
   case 34:
 
 /* Line 1455 of yacc.c  */
-#line 209 "./nquad_p.y"
+#line 225 "./nquad_p.y"
     {
 		  TTLYYERROR_ACTION_COND (TTLP_VERB_MAY_BE_BLANK, "Blank node (written as '[]') can not be used as a predicate");
 		  dk_free_tree (ttlp_arg->ttlp_pred_uri); ttlp_arg->ttlp_pred_uri = tf_bnode_iid (ttlp_arg->ttlp_tf, NULL); }
@@ -1776,7 +1792,7 @@ yyreduce:
   case 35:
 
 /* Line 1455 of yacc.c  */
-#line 213 "./nquad_p.y"
+#line 229 "./nquad_p.y"
     {
 		  TTLYYERROR_ACTION_COND (TTLP_VERB_MAY_BE_BLANK, "Blank node (written as '_:...' label) can not be used as a predicate");
                   dk_free_tree (ttlp_arg->ttlp_pred_uri);
@@ -1790,28 +1806,28 @@ yyreduce:
   case 36:
 
 /* Line 1455 of yacc.c  */
-#line 221 "./nquad_p.y"
+#line 237 "./nquad_p.y"
     { ttlp_arg->ttlp_pred_is_reverse = 1; dk_free_tree (ttlp_arg->ttlp_pred_uri); ttlp_arg->ttlp_pred_uri = ttlp_arg->ttlp_last_complete_uri; ttlp_arg->ttlp_last_complete_uri = NULL; }
     break;
 
   case 37:
 
 /* Line 1455 of yacc.c  */
-#line 222 "./nquad_p.y"
+#line 238 "./nquad_p.y"
     { ttlp_arg->ttlp_pred_is_reverse = 1; dk_free_tree (ttlp_arg->ttlp_pred_uri); ttlp_arg->ttlp_pred_uri = (yyvsp[(2) - (3)].box); }
     break;
 
   case 38:
 
 /* Line 1455 of yacc.c  */
-#line 223 "./nquad_p.y"
+#line 239 "./nquad_p.y"
     { ttlp_arg->ttlp_pred_is_reverse = 1; dk_free_tree (ttlp_arg->ttlp_pred_uri); ttlp_arg->ttlp_pred_uri = box_dv_uname_string ("http://www.w3.org/2000/10/swap/log#implies"); /* Note this 'double reversed' meaning :) */ }
     break;
 
   case 46:
 
 /* Line 1455 of yacc.c  */
-#line 234 "./nquad_p.y"
+#line 250 "./nquad_p.y"
     {
 			dk_free_tree (ttlp_arg->ttlp_last_complete_uri);
 			ttlp_arg->ttlp_last_complete_uri = NULL; }
@@ -1820,7 +1836,7 @@ yyreduce:
   case 47:
 
 /* Line 1455 of yacc.c  */
-#line 240 "./nquad_p.y"
+#line 256 "./nquad_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = ttlp_arg->ttlp_last_complete_uri;
@@ -1830,7 +1846,7 @@ yyreduce:
   case 48:
 
 /* Line 1455 of yacc.c  */
-#line 244 "./nquad_p.y"
+#line 260 "./nquad_p.y"
     {
 		ttlp_triple_and_inf (ttlp_arg, ttlp_arg->ttlp_obj); }
     break;
@@ -1838,7 +1854,7 @@ yyreduce:
   case 49:
 
 /* Line 1455 of yacc.c  */
-#line 246 "./nquad_p.y"
+#line 262 "./nquad_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (1)].box); }
@@ -1847,7 +1863,7 @@ yyreduce:
   case 50:
 
 /* Line 1455 of yacc.c  */
-#line 249 "./nquad_p.y"
+#line 265 "./nquad_p.y"
     {
 		ttlp_triple_and_inf (ttlp_arg, (yyvsp[(1) - (3)].box)); }
     break;
@@ -1855,7 +1871,7 @@ yyreduce:
   case 51:
 
 /* Line 1455 of yacc.c  */
-#line 251 "./nquad_p.y"
+#line 267 "./nquad_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (1)].box); }
@@ -1864,7 +1880,7 @@ yyreduce:
   case 52:
 
 /* Line 1455 of yacc.c  */
-#line 254 "./nquad_p.y"
+#line 270 "./nquad_p.y"
     {
 		ttlp_triple_and_inf (ttlp_arg, (yyvsp[(1) - (3)].box)); }
     break;
@@ -1872,7 +1888,7 @@ yyreduce:
   case 53:
 
 /* Line 1455 of yacc.c  */
-#line 256 "./nquad_p.y"
+#line 272 "./nquad_p.y"
     {
 		ttlp_triple_l_and_inf (ttlp_arg, (caddr_t)((ptrlong)1), uname_xmlschema_ns_uri_hash_boolean, NULL); }
     break;
@@ -1880,7 +1896,7 @@ yyreduce:
   case 54:
 
 /* Line 1455 of yacc.c  */
-#line 258 "./nquad_p.y"
+#line 274 "./nquad_p.y"
     {
 		ttlp_triple_l_and_inf (ttlp_arg, (caddr_t)((ptrlong)0), uname_xmlschema_ns_uri_hash_boolean, NULL); }
     break;
@@ -1888,7 +1904,7 @@ yyreduce:
   case 55:
 
 /* Line 1455 of yacc.c  */
-#line 260 "./nquad_p.y"
+#line 276 "./nquad_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (2)].box);
@@ -1898,7 +1914,7 @@ yyreduce:
   case 56:
 
 /* Line 1455 of yacc.c  */
-#line 264 "./nquad_p.y"
+#line 280 "./nquad_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (2)].box);
@@ -1908,7 +1924,7 @@ yyreduce:
   case 57:
 
 /* Line 1455 of yacc.c  */
-#line 268 "./nquad_p.y"
+#line 284 "./nquad_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (2)].box);
@@ -1918,7 +1934,7 @@ yyreduce:
   case 58:
 
 /* Line 1455 of yacc.c  */
-#line 272 "./nquad_p.y"
+#line 288 "./nquad_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (2)].box);
@@ -1928,7 +1944,7 @@ yyreduce:
   case 59:
 
 /* Line 1455 of yacc.c  */
-#line 276 "./nquad_p.y"
+#line 292 "./nquad_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (3)].box);
@@ -1940,7 +1956,7 @@ yyreduce:
   case 60:
 
 /* Line 1455 of yacc.c  */
-#line 282 "./nquad_p.y"
+#line 298 "./nquad_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (3)].box);
@@ -1952,7 +1968,7 @@ yyreduce:
   case 61:
 
 /* Line 1455 of yacc.c  */
-#line 288 "./nquad_p.y"
+#line 304 "./nquad_p.y"
     {
 		ttlp_triple_l_and_inf (ttlp_arg, ttlp_arg->ttlp_obj, ttlp_arg->ttlp_obj_type, NULL);	}
     break;
@@ -1960,14 +1976,14 @@ yyreduce:
   case 62:
 
 /* Line 1455 of yacc.c  */
-#line 290 "./nquad_p.y"
+#line 306 "./nquad_p.y"
     { }
     break;
 
   case 63:
 
 /* Line 1455 of yacc.c  */
-#line 291 "./nquad_p.y"
+#line 307 "./nquad_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (4)].box); }
@@ -1976,7 +1992,7 @@ yyreduce:
   case 64:
 
 /* Line 1455 of yacc.c  */
-#line 294 "./nquad_p.y"
+#line 310 "./nquad_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_last_complete_uri);
 		ttlp_arg->ttlp_last_complete_uri = NULL; }
@@ -1985,21 +2001,21 @@ yyreduce:
   case 65:
 
 /* Line 1455 of yacc.c  */
-#line 297 "./nquad_p.y"
+#line 313 "./nquad_p.y"
     { }
     break;
 
   case 66:
 
 /* Line 1455 of yacc.c  */
-#line 298 "./nquad_p.y"
+#line 314 "./nquad_p.y"
     { }
     break;
 
   case 67:
 
 /* Line 1455 of yacc.c  */
-#line 302 "./nquad_p.y"
+#line 318 "./nquad_p.y"
     {
 		triple_feed_t *tf = ttlp_arg->ttlp_tf;
 		if ((NULL == tf->tf_current_graph_uri) || strcmp (tf->tf_current_graph_uri, tf->tf_default_graph_uri))
@@ -2010,7 +2026,7 @@ yyreduce:
   case 68:
 
 /* Line 1455 of yacc.c  */
-#line 307 "./nquad_p.y"
+#line 323 "./nquad_p.y"
     {
 		triple_feed_t *tf = ttlp_arg->ttlp_tf;
 		if ((NULL == tf->tf_current_graph_uri) || strcmp (tf->tf_current_graph_uri, ttlp_arg->ttlp_last_complete_uri))
@@ -2023,21 +2039,21 @@ yyreduce:
   case 69:
 
 /* Line 1455 of yacc.c  */
-#line 314 "./nquad_p.y"
+#line 330 "./nquad_p.y"
     { }
     break;
 
   case 70:
 
 /* Line 1455 of yacc.c  */
-#line 315 "./nquad_p.y"
+#line 331 "./nquad_p.y"
     { }
     break;
 
   case 71:
 
 /* Line 1455 of yacc.c  */
-#line 321 "./nquad_p.y"
+#line 337 "./nquad_p.y"
     {
                   if (ttlp_arg->ttlp_formula_iid)
 		    (yyval.box) = tf_formula_bnode_iid (ttlp_arg, (yyvsp[(1) - (1)].box));
@@ -2049,14 +2065,14 @@ yyreduce:
   case 72:
 
 /* Line 1455 of yacc.c  */
-#line 327 "./nquad_p.y"
+#line 343 "./nquad_p.y"
     { (yyval.box) = tf_bnode_iid (ttlp_arg->ttlp_tf, NULL); }
     break;
 
   case 73:
 
 /* Line 1455 of yacc.c  */
-#line 332 "./nquad_p.y"
+#line 348 "./nquad_p.y"
     {
                   if (NULL != ttlp_arg->ttlp_last_complete_uri)
 		    ttlyyerror_action ("Internal error: proven memory leak");
@@ -2068,7 +2084,7 @@ yyreduce:
   case 74:
 
 /* Line 1455 of yacc.c  */
-#line 339 "./nquad_p.y"
+#line 355 "./nquad_p.y"
     {
                   if (NULL != ttlp_arg->ttlp_last_complete_uri)
 		    ttlyyerror_action ("Internal error: proven memory leak");
@@ -2081,7 +2097,7 @@ yyreduce:
   case 75:
 
 /* Line 1455 of yacc.c  */
-#line 347 "./nquad_p.y"
+#line 363 "./nquad_p.y"
     {
                   if (NULL != ttlp_arg->ttlp_last_complete_uri)
 		    ttlyyerror_action ("Internal error: proven memory leak");
@@ -2094,7 +2110,7 @@ yyreduce:
 
 
 /* Line 1455 of yacc.c  */
-#line 2098 "nquad_p.c"
+#line 2114 "nquad_p.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/libsrc/Wi/nquad_p.y b/libsrc/Wi/nquad_p.y
index 5cffd2f..9031ff2 100644
--- a/libsrc/Wi/nquad_p.y
+++ b/libsrc/Wi/nquad_p.y
@@ -1,5 +1,5 @@
 /*
- *  $Id: nquad_p.y,v 1.1.2.3 2009/08/19 07:29:53 source Exp $
+ *  $Id: nquad_p.y,v 1.1.2.4 2011/01/03 10:17:27 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -153,8 +153,24 @@ clause
         : _AT_keywords_L { ttlp_arg->ttlp_special_qnames = ~0; } keyword_list dot_opt
 	| _AT_base_L Q_IRI_REF dot_opt { dk_free_box (ttlp_arg->ttlp_tf->tf_base_uri); ttlp_arg->ttlp_tf->tf_base_uri = $2; }
         | _AT_prefix_L QNAME_NS Q_IRI_REF dot_opt {
-		dk_set_push (&(ttlp_arg->ttlp_namespaces), $3);
-		dk_set_push (&(ttlp_arg->ttlp_namespaces), $2); }
+		caddr_t *old_uri_ptr;
+		if (NULL != ttlp_arg->ttlp_namespaces_prefix2iri)
+		  old_uri_ptr = (caddr_t *)id_hash_get (ttlp_arg->ttlp_namespaces_prefix2iri, &($2));
+		else
+		  {
+		    ttlp_arg->ttlp_namespaces_prefix2iri = (id_hash_t *)box_dv_dict_hashtable (31);
+		    old_uri_ptr = NULL;
+		  }
+		if (NULL != old_uri_ptr)
+		  {
+		    int err = strcmp (old_uri_ptr[0], $3);
+		    dk_free_box ($2);
+		    dk_free_box ($3);
+		    if (err)
+		      ttlyyerror_action ("Namespace prefix is re-used for a different namespace IRI");
+		  }
+		else
+		  id_hash_set (ttlp_arg->ttlp_namespaces_prefix2iri, &($2), &($3)); }
 	| _AT_prefix_L _COLON Q_IRI_REF dot_opt	{
 		dk_free_box (ttlp_arg->ttlp_default_ns_uri);
 		ttlp_arg->ttlp_default_ns_uri = $3; }
diff --git a/libsrc/Wi/numeric.c b/libsrc/Wi/numeric.c
index d0bb3d5..30dff28 100644
--- a/libsrc/Wi/numeric.c
+++ b/libsrc/Wi/numeric.c
@@ -1,7 +1,7 @@
 /*
  *  numeric.c
  *
- *  $Id: numeric.c,v 1.13.2.2 2009/04/18 21:55:12 source Exp $
+ *  $Id: numeric.c,v 1.13.2.4 2011/01/28 13:31:34 source Exp $
  *
  *  Implements numeric data type
  *
@@ -62,13 +62,6 @@ static struct numeric_s _num_10	= { 2, 0, 0, 0, { 1, 0	}};	/* 10 */
 #define NUM_SET_1(N)		memcpy (N, &_num_1, sizeof (_num_1))
 #define NUM_SET_10(N)		memcpy (N, &_num_10, sizeof (_num_10))
 
-#define num_is_zero(N)		((N)->n_len + (N)->n_scale == 0)
-#define num_is_invalid(N)	((N)->n_invalid)
-#define num_is_nan(N)		((N)->n_invalid & NDF_NAN)
-#define num_is_inf(N)		((N)->n_invalid & NDF_INF)
-#define num_is_plus_inf(N)	(num_is_inf (N) && (N)->n_neg == 0)
-#define num_is_minus_inf(N)	(num_is_inf (N) && (N)->n_neg == 1)
-
 #ifdef NUMERIC_DEBUG
 # define num_warn(X)	puts(X)
 #else
@@ -82,15 +75,6 @@ static struct numeric_s _num_10	= { 2, 0, 0, 0, { 1, 0	}};	/* 10 */
 #define NDV_L		3	/* #bytes encoding number before . */
 #define NDV_DATA	4	/* bcd */
 
-/* flags in marshalled number */
-#define NDF_INF		0x10	/* Inf */
-#define NDF_NAN		0x08	/* NaN */
-#define NDF_LEAD0	0x04	/* Leading 0 */
-#define NDF_TRAIL0	0x02	/* Trailing 0 */
-#define NDF_NEG		0x01	/* Negative */
-
-#define is_dv_negative(X)	((X)[NDV_FLAGS] & NDF_NEG)
-
 #ifndef TRUE
 # define TRUE		1
 # define FALSE		0
@@ -1502,7 +1486,7 @@ numeric_error (int code, char *sqlstate, int state_len, char *sqlerror, int erro
 int
 numeric_from_string (numeric_t n, const char *s)
 {
-  const char *cp;
+  const char *cp=s;
   const char *dot;
   char *dp;
   int error;
@@ -1513,8 +1497,12 @@ numeric_from_string (numeric_t n, const char *s)
   int rc;
 
   /* strip leading whitespace */
-  for (cp = s; isspace (*cp) || *cp == '$'; cp++)
-    ;
+  while (isspace (*cp)) cp++;
+  if ('$' == *cp)
+    {
+      cp++;
+      while (isspace (*cp)) cp++;
+    }
 
   /* get sign */
   if (*cp == '-')
@@ -1530,7 +1518,7 @@ numeric_from_string (numeric_t n, const char *s)
     }
 
   /* accept space between the sign & the digits - as M$ SQL does */
-  while (*cp && isspace (*cp))
+  while (isspace (*cp))
     cp++;
 
   /* handles cases for numeric_from_double */
@@ -1666,6 +1654,57 @@ numeric_from_string (numeric_t n, const char *s)
 
 
 /*
+ *  Returns NULL if numeric_from_string would return an error, first significant char of the string otherwise
+ */
+const char *
+numeric_from_string_is_ok (const char *s)
+{
+  const char *cp = s;
+  const char *first_significant_char;
+  int plain_digits = 0;
+  /* strip leading whitespace */
+  while (isspace (cp[0])) cp++;
+  if ('$' == cp[0])
+    {
+      cp++;
+      while (isspace (cp[0])) cp++;
+    }
+  first_significant_char = cp;
+  /* get sign */
+  if ((cp[0] == '-')|| (cp[0] == '+'))
+    cp++;
+  /* accept space between the sign & the digits - as M$ SQL does */
+  while (isspace (cp[0]))
+    cp++;
+  /* handles cases for numeric_from_double */
+  if (!isdigit (cp[0]) && (!strcmp (cp, "Inf") || !strcmp (cp, "Infinity") || !strcmp (cp, "NaN")))
+    return first_significant_char;
+  while (isdigit (cp[0])) { plain_digits++; cp++; }
+  if (cp[0] == '.')
+    {
+      cp++;
+      while (isdigit (cp[0])) { plain_digits++; cp++; }
+    }
+  if (0 == plain_digits)
+    return NULL;
+  if (('E' == cp[0]) || ('e' == cp[0]))
+    {
+      int exp_digits = 0;
+      cp++;
+      if ((cp[0] == '-')|| (cp[0] == '+'))
+        cp++;
+      while (isdigit (cp[0])) { exp_digits++; cp++; }
+      if (!exp_digits)
+        return NULL;
+    }
+  while (isspace (cp[0])) cp++;
+  if (cp[0])
+    return NULL;
+  return first_significant_char;
+}
+
+
+/*
  *  Assign an integer to a number
  */
 int
diff --git a/libsrc/Wi/numeric.h b/libsrc/Wi/numeric.h
index c71c8bf..f8d0a8e 100644
--- a/libsrc/Wi/numeric.h
+++ b/libsrc/Wi/numeric.h
@@ -1,7 +1,7 @@
 /*
  *  numeric.h
  *
- *  $Id: numeric.h,v 1.5.2.2 2009/04/18 21:55:12 source Exp $
+ *  $Id: numeric.h,v 1.5.2.4 2011/01/28 13:31:34 source Exp $
  *
  *  Numeric data type
  *
@@ -43,6 +43,22 @@ struct numeric_s
       char n_value[NUMERIC_PADDING];
     };
 
+#define num_is_zero(N)		((N)->n_len + (N)->n_scale == 0)
+#define num_is_invalid(N)	((N)->n_invalid)
+#define num_is_nan(N)		((N)->n_invalid & NDF_NAN)
+#define num_is_inf(N)		((N)->n_invalid & NDF_INF)
+#define num_is_plus_inf(N)	(num_is_inf (N) && (N)->n_neg == 0)
+#define num_is_minus_inf(N)	(num_is_inf (N) && (N)->n_neg == 1)
+
+/* flags in marshalled number */
+#define NDF_INF		0x10	/* Inf */
+#define NDF_NAN		0x08	/* NaN */
+#define NDF_LEAD0	0x04	/* Leading 0 */
+#define NDF_TRAIL0	0x02	/* Trailing 0 */
+#define NDF_NEG		0x01	/* Negative */
+
+#define is_dv_negative(X)	((X)[NDV_FLAGS] & NDF_NEG)
+
 /* intrinsics */
 #define DV_NUMERIC			219
 
@@ -110,6 +126,7 @@ int numeric_error (int code, char *sqlstate, int state_len, char *sqlerror, int
 
 /* conversion */
 int numeric_from_string (numeric_t n, const char *s);
+const char *numeric_from_string_is_ok (const char *s);
 int numeric_from_int32 (numeric_t n, int32 i);
 int numeric_from_int64 (numeric_t n, int64 i);
 int numeric_from_double (numeric_t n, double d);
diff --git a/libsrc/Wi/obackup.c b/libsrc/Wi/obackup.c
index e437b4d..3f66c1d 100644
--- a/libsrc/Wi/obackup.c
+++ b/libsrc/Wi/obackup.c
@@ -1,7 +1,7 @@
 /*
  *  obackup.c
  *
- *  $Id: obackup.c,v 1.20.2.12 2010/06/10 18:46:26 source Exp $
+ *  $Id: obackup.c,v 1.20.2.13 2010/09/17 23:10:41 source Exp $
  *
  *  Online & Incremental Backup
  *
@@ -1136,26 +1136,28 @@ void bp_sec_user_check (query_instance_t * qi)
     }
 }
 
-void bp_sec_check_prefix (query_instance_t * qi, char * file_prefix)
+void
+bp_sec_check_prefix (query_instance_t * qi, char *file_prefix)
 {
   char * s;
+
   if (!file_prefix[0])
     sqlr_new_error ("42000", FILE_FORM_ERR_CODE , "Backup prefix must contains at least one char");
 
+  if (file_prefix[0] == '/')
+    sqlr_new_error ("42000", FILE_FORM_ERR_CODE, "Absolute path as backup prefix is not allowed");
 
   s = strchr (file_prefix, ':');
-
   if (s)
     sqlr_new_error ("42000", FILE_FORM_ERR_CODE , "Semicolon in backup prefix is not allowed");
 
-  do { /* .. check */
     s = strchr (file_prefix, '.');
-    if (s && s[1] == '.')
+  while (s)
+    {
+      if (s[1] == '.')
       sqlr_new_error ("42000", FILE_FORM_ERR_CODE , "\"..\" substring in backup prefix is not allowed");
-  } while (s);
-
-  if (file_prefix[0] == '/')
-    sqlr_new_error ("42000", FILE_FORM_ERR_CODE , "Absolute path as backup prefix is not allowed");
+      s = strchr (s + 1, '.');
+    }
 }
 
 
diff --git a/libsrc/Wi/odbcinc.h b/libsrc/Wi/odbcinc.h
index eed48a4..f8864be 100644
--- a/libsrc/Wi/odbcinc.h
+++ b/libsrc/Wi/odbcinc.h
@@ -1,7 +1,7 @@
 /*
  *  odbcinc.h
  *
- *  $Id: odbcinc.h,v 1.6.2.2 2009/10/14 20:13:11 source Exp $
+ *  $Id: odbcinc.h,v 1.6.2.5 2010/09/17 22:49:23 source Exp $
  *
  *  Include the ODBC header, whichever appropriate
  *
@@ -148,6 +148,8 @@ typedef void * SQLHANDLE;
 		  (strstr (rds_get_info (rds, SQL_DRIVER_VER), "ViaSQL")) \
 		)
 #define IS_ORACLE_RDS(rds) (strindex (rds_get_info (rds, SQL_DBMS_NAME), "Oracle"))
+#define IS_INFORMIX_RDS(rds) (nc_strstr ((unsigned char *) rds_get_info (rds, SQL_DBMS_NAME), (unsigned char *) "Informix") != NULL)
+#define IS_PROGRESS_RDS(rds) (nc_strstr ((unsigned char *) rds_get_info (rds, SQL_DBMS_NAME), (unsigned char *) "Progress") != NULL)
 #define SHOULD_USE_SCROLLABLE(rcon) (IS_SQLSERVER (rcon))
 #define SHOULD_USE_SCROLLABLE_RDS(rds) (IS_SQLSERVER_RDS (rds))
 
diff --git a/libsrc/Wi/page.c b/libsrc/Wi/page.c
index d6ec1b4..fdbdca3 100644
--- a/libsrc/Wi/page.c
+++ b/libsrc/Wi/page.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: page.c,v 1.1.2.15 2010/02/23 14:49:24 source Exp $
+ *  $Id: page.c,v 1.1.2.16 2011/03/14 15:47:01 source Exp $
  *
  *  Page and Row Layout, Key Compression
  *
@@ -2348,7 +2348,9 @@ page_apply_1 (it_cursor_t * itc, buffer_desc_t * buf, int n_delta, row_delta_t *
 	    GPF_T1 ("unmoved non-deleted row lock");
 	  PL_RL_ADD (buf->bd_pl, rlocks[inx], ITC_AT_END);
 	  buf->bd_pl->pl_n_row_locks++;
+#ifndef NDEBUG
 	  log_info ("deleted rl kept around for page apply");
+#endif
 	}
     }
   if (pf.pf_left)
@@ -2363,7 +2365,8 @@ page_apply_1 (it_cursor_t * itc, buffer_desc_t * buf, int n_delta, row_delta_t *
   if (t_buf->bd_registered) GPF_T1 ("registrations are not supposed to go to the temp buf");
   if (PA_REWRITE_ONLY == op)
     return;
-  if (PA_AUTOCOMPACT == op)
+  if (PA_AUTOCOMPACT == op
+     )
     first_affected = 0;
   page_apply_parent (buf, &pf, first_affected, op, change, paf);
   dk_set_free (pf.pf_left);
diff --git a/libsrc/Wi/rdf_core.c b/libsrc/Wi/rdf_core.c
index e5ee073..5ffcb7d 100644
--- a/libsrc/Wi/rdf_core.c
+++ b/libsrc/Wi/rdf_core.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: rdf_core.c,v 1.59.2.29 2010/06/25 16:42:03 source Exp $
+ *  $Id: rdf_core.c,v 1.59.2.36 2011/02/28 17:02:46 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -601,8 +601,7 @@ void
 ttlp_free (ttlp_t *ttlp)
 {
   dk_free_box (ttlp->ttlp_default_ns_uri);
-  while (NULL != ttlp->ttlp_namespaces)
-    dk_free_tree ((box_t) dk_set_pop (&(ttlp->ttlp_namespaces)));
+  dk_free_box (ttlp->ttlp_namespaces_prefix2iri);
   while (NULL != ttlp->ttlp_saved_uris)
     dk_free_tree ((box_t) dk_set_pop (&(ttlp->ttlp_saved_uris)));
   while (NULL != ttlp->ttlp_unused_seq_bnodes)
@@ -765,8 +764,8 @@ ttlp_bit_of_special_qname (caddr_t qname)
 caddr_t DBG_NAME (ttlp_expand_qname_prefix) (DBG_PARAMS ttlp_t *ttlp_arg, caddr_t qname)
 {
   char *lname = strchr (qname, ':');
-  dk_set_t ns_dict;
-  caddr_t ns_pref, ns_uri, res;
+  id_hash_t *ns_dict;
+  caddr_t ns_pref, ns_uri, *ns_uri_ptr, res;
   int ns_uri_len, local_len, res_len;
   if (NULL == lname)
     {
@@ -810,10 +809,12 @@ this means that <#foo> can be written :foo and using @keywords one can reduce th
       goto ns_uri_found; /* see below */
     }
   lname++;
-  ns_dict = ttlp_arg[0].ttlp_namespaces;
+  ns_dict = ttlp_arg[0].ttlp_namespaces_prefix2iri;
   ns_pref = box_dv_short_nchars (qname, lname - qname);
-  ns_uri = (caddr_t) dk_set_get_keyword (ns_dict, ns_pref, NULL);
-  if (NULL == ns_uri)
+  ns_uri_ptr = ((NULL == ns_dict) ? NULL : (caddr_t *) id_hash_get (ns_dict, (caddr_t)(&ns_pref)));
+  if (NULL != ns_uri_ptr)
+    ns_uri = ns_uri_ptr[0];
+  else
     {
       if (!strcmp (ns_pref, "rdf:"))
         ns_uri = uname_rdf_ns_uri;
@@ -939,6 +940,7 @@ tf_triple (triple_feed_t *tf, caddr_t s_uri, caddr_t p_uri, caddr_t o_uri)
   char params_buf [BOX_AUTO_OVERHEAD + sizeof (caddr_t) * 5];
   void **params;
   caddr_t err;
+  caddr_t replica_of = box_copy (tf->tf_qi->qi_trx->lt_replica_of);
   query_t *cbk_qr = tf->tf_cbk_qrs[TRIPLE_FEED_TRIPLE];
   if (NULL == cbk_qr)
     return;
@@ -960,6 +962,10 @@ tf_triple (triple_feed_t *tf, caddr_t s_uri, caddr_t p_uri, caddr_t o_uri)
   err = qr_exec (tf->tf_qi->qi_client, cbk_qr, tf->tf_qi, NULL, NULL, NULL, (caddr_t *)params, NULL, 0);
   BOX_DONE (params, params_buf);
   tf->tf_triple_count++;
+  if (!tf->tf_qi->qi_trx->lt_replica_of)
+    tf->tf_qi->qi_trx->lt_replica_of = replica_of;
+  else
+    dk_free_box (replica_of);
   if (!(tf->tf_triple_count % TF_TRIPLE_PROGRESS_MESSAGE_MOD))
     tf_report (tf, 'P', NULL, NULL, "Loading is in progress");
   if (NULL != err)
@@ -971,6 +977,7 @@ void tf_triple_l (triple_feed_t *tf, caddr_t s_uri, caddr_t p_uri, caddr_t obj_s
   char params_buf [BOX_AUTO_OVERHEAD + sizeof (caddr_t) * 7];
   void **params;
   caddr_t err;
+  caddr_t replica_of = box_copy (tf->tf_qi->qi_trx->lt_replica_of);
   query_t *cbk_qr = tf->tf_cbk_qrs[TRIPLE_FEED_TRIPLE_L];
   if (NULL == cbk_qr)
     return;
@@ -996,6 +1003,10 @@ void tf_triple_l (triple_feed_t *tf, caddr_t s_uri, caddr_t p_uri, caddr_t obj_s
   err = qr_exec (tf->tf_qi->qi_client, cbk_qr, tf->tf_qi, NULL, NULL, NULL, (caddr_t *)params, NULL, 0);
   BOX_DONE (params, params_buf);
   tf->tf_triple_count++;
+  if (!tf->tf_qi->qi_trx->lt_replica_of)
+    tf->tf_qi->qi_trx->lt_replica_of = replica_of;
+  else
+    dk_free_box (replica_of);
   if (!(tf->tf_triple_count % TF_TRIPLE_PROGRESS_MESSAGE_MOD))
     tf_report (tf, 'P', NULL, NULL, "Loading is in progress");
   if (NULL != err)
@@ -1043,6 +1054,7 @@ bif_rdf_load_turtle_local_file (caddr_t * qst, caddr_t * err_ret, state_slot_t *
     sqlr_new_error ("22023", "RDF01",
       "The argument #4 of rdf_load_turtle() should be a vector of %d texts of SQL statements",
       COUNTOF__TRIPLE_FEED );
+  file_path_assert (str, NULL, 0);
   res = rdf_load_turtle (str, 1, base_uri, graph_uri, flags,
     (ccaddr_t *) cbk_names, app_env,
     (query_instance_t *)qst, QST_CHARSET(qst), &err );
@@ -1753,8 +1765,9 @@ re_search:
     }
   ITC_FAILED
       {
+	du_thread_t * self = THREAD_CURRENT_THREAD;
 	itc_free (itc);
-	if (!lt)
+	if (!lt || !self->thr_reset_ctx)
 	  return NULL;
       }
   END_FAIL (itc);
@@ -1819,7 +1832,7 @@ iri_split_ttl_qname (const char * iri, caddr_t * pref_ret, caddr_t * name_ret, i
   iri_strlen = strlen (iri);
   for (tail = iri + iri_strlen; tail > iri; tail--)
     {
-      char c = tail[-1];
+      unsigned char c = (unsigned char) tail[-1];
       if (!isalnum(c) && ('_' != c) && ('-' != c) && !(c & 0x80))
         break;
     }
@@ -2134,22 +2147,21 @@ bif_iri_id_new (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return box_iri_id (id);
 }
 
-
-caddr_t
-iri_to_id (caddr_t *qst, caddr_t name, int mode, caddr_t *err_ret)
+int
+iri_canonicalize (query_instance_t *qi, caddr_t name, int mode, caddr_t *res_ret, caddr_t *err_ret)
 {
-  query_instance_t * qi = (query_instance_t *) qst;
-  caddr_t box_to_delete = NULL;
-  caddr_t res = NULL;
   dtp_t dtp = DV_TYPE_OF (name);
   dtp_t orig_dtp = dtp;
-  err_ret[0] = NULL;
+  caddr_t box_to_delete = NULL;
+  res_ret[0] = NULL;
 again:
   switch (dtp)
     {
     case DV_DB_NULL:
+      return 0;
     case DV_IRI_ID:
-      return box_copy (name);
+      res_ret[0] = name;
+      return 1;
     case DV_WIDE:
       box_to_delete = name = box_wide_as_utf8_char (name, (box_length (name) / sizeof (wchar_t)) - 1, DV_STRING);
       break;
@@ -2176,8 +2188,8 @@ again:
         if (!rb->rb_is_complete)
           {
             if (IRI_TO_ID_IF_CACHED == mode)
-              return NULL;
-            rb_complete (rb, ((query_instance_t *)qst)->qi_trx, ((query_instance_t *)qst));
+              return 0;
+            rb_complete (rb, qi->qi_trx, qi);
           }
         name = rb->rb_box;
         dtp = DV_TYPE_OF (name);
@@ -2222,7 +2234,8 @@ again:
         }
       if (NULL != box_to_delete)
         dk_free_box (box_to_delete);
-      return box_iri_int64 (acc, DV_IRI_ID);
+      res_ret[0] = box_iri_int64 (acc, DV_IRI_ID);
+      return 1;
     }
   if (uriqa_dynamic_local)
     {
@@ -2236,42 +2249,90 @@ again:
           memcpy (localized_name, "local:", 6);
           memcpy (localized_name + 6, name + ofs, name_box_len - ofs);
           if (box_to_delete == name)
-            dk_free_box (name);
+            dk_free_box (box_to_delete);
           box_to_delete = name = localized_name;
         }
     }
+  res_ret[0] = name;
+  if ((NULL != box_to_delete) && (name != box_to_delete))
+    dk_free_box (box_to_delete);
+  return 2;
+return_error:
+  if (NULL != box_to_delete)
+    dk_free_box (box_to_delete);
+  return 0;
+}
+
+caddr_t
+canon_iri_to_id (query_instance_t *qi, caddr_t canon_name, int mode, caddr_t *err_ret)
+{
   switch (cl_run_local_only)
     {
     case CL_RUN_LOCAL:
       switch (mode)
         {
         case IRI_TO_ID_IF_KNOWN:
-          res = key_name_to_iri_id (qi->qi_trx, name, 0); break;
+          return key_name_to_iri_id (qi->qi_trx, canon_name, 0); break;
         case IRI_TO_ID_WITH_CREATE:
-          res = key_name_to_iri_id (qi->qi_trx, name, 1);
+          return key_name_to_iri_id (qi->qi_trx, canon_name, 1);
 #ifdef DEBUG
-	  if (!res) bing ();
+	  if (!boxed_iid) bing ();
 #endif
 	  break;
         case IRI_TO_ID_IF_CACHED:
-          res = key_name_to_existing_cached_iri_id (qi->qi_trx, name); break;
+          return key_name_to_existing_cached_iri_id (qi->qi_trx, canon_name); break;
         }
       break;
     default: err_ret[0] = srv_make_new_error ("RDFXX", ".....",
               "iri_to_id () refers to partitioned tables and can not be used before cluster is up");
     }
-  if (NULL == res)
+  return NULL;
+}
+
+caddr_t
+iri_to_id (caddr_t *qst, caddr_t raw_name, int mode, caddr_t *err_ret)
     {
-      if (NULL != box_to_delete)
-        dk_free_box (box_to_delete);
-      return NEW_DB_NULL;
+  query_instance_t *qi = (query_instance_t *) qst;
+  caddr_t canon_name = NULL;
+  caddr_t boxed_iid = NULL;
+  int status;
+  err_ret[0] = NULL;
+  status = iri_canonicalize (qi, raw_name, mode, &canon_name, err_ret);
+  if (NULL != err_ret[0])
+    goto return_error;
+  switch (status)
+    {
+    case 0:
+      break;
+    case 1:
+#ifndef NDEBUG
+      if (DV_IRI_ID != DV_TYPE_OF (canon_name))
+	GPF_T1 ("iri_to_id: weird dv_type, should be IRI_ID");
+#endif
+      return ((canon_name == raw_name) ? box_copy_tree (canon_name) : canon_name);
+    case 2:
+      boxed_iid = canon_iri_to_id (qi, canon_name, mode, err_ret);
+      break;
     }
-  if (NULL != box_to_delete)
-    dk_free_box (box_to_delete);
-  return res;
+  dk_check_tree (canon_name);
+#ifndef NDEBUG
+  if (DV_IRI_ID == DV_TYPE_OF (canon_name))
+    GPF_T1 ("iri_to_id: weird dv_type, should not be IRI_ID");
+  if ((canon_name == boxed_iid) && IS_BOX_POINTER (canon_name))
+    GPF_T1 ("iri_to_id: weird cast");
+#endif
+  if ((NULL != canon_name) && (canon_name != raw_name))
+    dk_free_box (canon_name);
+  if (NULL == boxed_iid)
+    return NEW_DB_NULL;
+#ifndef NDEBUG
+  if ((boxed_iid == raw_name) && IS_BOX_POINTER (raw_name))
+    GPF_T1 ("iri_to_id: arg not copied and returned");
+#endif
+  return boxed_iid;
 return_error:
-  if (NULL != box_to_delete)
-    dk_free_box (box_to_delete);
+  if (canon_name != raw_name)
+    dk_free_box (canon_name);
   return NULL;
 }
 
@@ -2294,6 +2355,79 @@ bif_iri_to_id (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 }
 
 caddr_t
+bif_iri_to_id_repl (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  caddr_t name = bif_arg (qst, args, 0, "iri_to_id_repl");
+  caddr_t tmp_name = NULL;
+  caddr_t err = NULL;
+  caddr_t res;
+  switch (DV_TYPE_OF (name))
+    {
+    case DV_LONG_INT: case DV_IRI_ID:
+      {
+        iri_id_t iid = unbox_iri_int64 (name);
+        if (iid < min_bnode_iri_id ())
+          sqlr_new_error ("22023", "SR626", "The argument of iri_to_id_repl() is an IRI_ID of URI");
+#if 0
+        if (iid >= MIN_64BIT_BNODE_IRI_ID)
+          tmp_name = box_sprintf (40, "_:rr_b" BOXINT_FMT, (boxint)(iid - MIN_64BIT_BNODE_IRI_ID));
+        else
+          tmp_name = box_sprintf (40, "_:rr" BOXINT_FMT, (boxint)iid);
+        res = canon_iri_to_id ((query_instance_t *)qst, tmp_name, IRI_TO_ID_WITH_CREATE, &err);
+        dk_free_box (tmp_name);
+        if (NULL != err)
+          sqlr_resignal (err);
+        return res;
+#else
+        return box_copy (name);
+#endif
+      }
+    case DV_STRING: case DV_UNAME:
+      break;
+    default:
+      sqlr_new_error ("22023", "SR626", "The argument of iri_to_id_repl() is of wrong type");
+    }
+  res = canon_iri_to_id ((query_instance_t *)qst, name, IRI_TO_ID_WITH_CREATE, &err);
+  if (NULL != err)
+    sqlr_resignal (err);
+  return res;
+}
+
+caddr_t
+bif_iri_canonicalize (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  caddr_t raw_name = bif_arg (qst, args, 0, "iri_canonicalize");
+  caddr_t canon_name = NULL;
+  caddr_t err = NULL;
+  err_ret[0] = NULL;
+  iri_canonicalize ((query_instance_t *)qst, raw_name, IRI_TO_ID_WITH_CREATE, &canon_name, &err);
+  if (NULL != err)
+    {
+      if ((NULL != canon_name) && (canon_name != raw_name))
+        dk_free_box (canon_name);
+      sqlr_resignal (err);
+    }
+  if (NULL == canon_name)
+    return NEW_DB_NULL;
+  if (DV_IRI_ID == DV_TYPE_OF (canon_name))
+    {
+      iri_id_t iid = unbox_iri_int64 (canon_name);
+      if (min_bnode_iri_id() > iid)
+        {
+          caddr_t iri = key_id_to_iri ((query_instance_t *)qst, iid);
+          if (canon_name != raw_name)
+            dk_free_tree (canon_name);
+          if (!iri)
+            sqlr_new_error ("22023", "SR626", "Can not canonicalize unknown IRI ID " BOXINT_FMT, (boxint)(iid));
+          return iri;
+        }
+    }
+  if (canon_name == raw_name)
+    return box_copy_tree (canon_name);
+  return canon_name;
+}
+
+caddr_t
 bif_iri_to_id_nosignal (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   caddr_t name = bif_arg (qst, args, 0, "iri_to_id_nosignal");
@@ -2380,22 +2514,23 @@ tb_id_to_name (lock_trx_t * lt, char * tb_name, caddr_t id)
 }
 
 caddr_t
-uriqa_dynamic_local_replace (caddr_t name, client_connection_t * cli)
-{
-  if (!strncmp (name, "local:", 6))
+uriqa_dynamic_local_replace_nocheck (caddr_t name, client_connection_t * cli)
     {
       caddr_t host;
       int is_https = 0;
+#ifndef NDEBUG
+  if (strncmp (name, "local:", 6))
+    GPF_T1 ("uriqa_dynamic_local_replace_nocheck(): should check but misused");
+#endif
       host = uriqa_get_host_for_dynamic_local (cli, &is_https);
       if (NULL != host)
         {
           int name_box_len = box_length (name);
           int host_strlen = strlen (host);
           caddr_t expanded_name = dk_alloc_box (name_box_len - 6 + (7 + is_https + host_strlen), DV_STRING);
-/*                                01234567 */
-	  if (!is_https)
+      if (!is_https)         /* 01234567 */
 	    memcpy (expanded_name, "http://", 7);
-	  else
+      else                   /* 012345678 */
 	    memcpy (expanded_name, "https://", 8);
           memcpy (expanded_name + 7 + is_https, host, host_strlen);
           memcpy (expanded_name + 7 + is_https + host_strlen, name + 6, name_box_len - 6);
@@ -2403,12 +2538,11 @@ uriqa_dynamic_local_replace (caddr_t name, client_connection_t * cli)
           name = expanded_name;
 	  dk_free_box (host);
         }
-    }
   return name;
 }
 
 caddr_t
-key_id_to_iri (query_instance_t * qi, iri_id_t iri_id_no)
+key_id_to_canonicalized_iri (query_instance_t * qi, iri_id_t iri_id_no)
 {
   boxint pref_id;
   lock_trx_t * lt = qi->qi_trx;
@@ -2467,32 +2601,21 @@ key_id_to_iri (query_instance_t * qi, iri_id_t iri_id_no)
   memcpy (name + box_length (prefix) - 1, local + 4, box_length (local) - 4);
   dk_free_box (prefix);
   dk_free_box (local);
+  return name;
+}
 
-  /* may be replace following with uriqa_dynamic_local_replace */
-/*                    0123456 */
-  if (!strncmp (name, "local:", 6))
-    {
-      caddr_t host;
-      int is_https = 0;
-      host = uriqa_get_host_for_dynamic_local (qi->qi_client, &is_https);
-      if (NULL != host)
+
+caddr_t
+key_id_to_iri (query_instance_t * qi, iri_id_t iri_id_no)
         {
-          int name_box_len = box_length (name);
-          int host_strlen = strlen (host);
-          caddr_t expanded_name = dk_alloc_box (name_box_len - 6 + (7 + is_https + host_strlen), DV_STRING);
-/*                                01234567 */
-	  if (!is_https)
-	    memcpy (expanded_name, "http://", 7);
-	  else
-	    memcpy (expanded_name, "https://", 8);
-          memcpy (expanded_name + 7 + is_https, host, host_strlen);
-          memcpy (expanded_name + 7 + is_https + host_strlen, name + 6, name_box_len - 6);
-          dk_free_box (name);
-          name = expanded_name;
-	  dk_free_box (host);
-        }
-    }
+  caddr_t name = key_id_to_canonicalized_iri (qi, iri_id_no);
+  caddr_t name_with_local_extended;
+  dk_check_tree (name);
+  if (NULL == name)
   return name;
+  name_with_local_extended = uriqa_dynamic_local_replace (name, qi->qi_client);
+  dk_check_tree (name_with_local_extended);
+  return name_with_local_extended;
 }
 
 int
@@ -3239,6 +3362,11 @@ rdf_core_init (void)
   bif_define ("iri_ensure", bif_iri_ensure);
   bif_set_uses_index (bif_iri_to_id);
   bif_set_no_cluster ("iri_to_id");
+  bif_define ("iri_to_id_repl", bif_iri_to_id_repl);
+  bif_set_uses_index (bif_iri_to_id_repl);
+  bif_define ("iri_canonicalize", bif_iri_canonicalize);
+  bif_set_uses_index (bif_iri_canonicalize);
+  bif_set_no_cluster ("iri_to_id_repl");
   bif_define ("iri_to_id_nosignal", bif_iri_to_id_nosignal);
   bif_set_uses_index (bif_iri_to_id_nosignal);
   bif_set_no_cluster ("iri_to_id_nosignal");
diff --git a/libsrc/Wi/rdf_core.h b/libsrc/Wi/rdf_core.h
index 9329666..e2d7b49 100644
--- a/libsrc/Wi/rdf_core.h
+++ b/libsrc/Wi/rdf_core.h
@@ -1,5 +1,5 @@
 /*
- *  $Id: rdf_core.h,v 1.30.2.19 2010/06/25 16:39:58 source Exp $
+ *  $Id: rdf_core.h,v 1.30.2.23 2011/01/03 10:17:27 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -24,6 +24,7 @@
 #ifndef __RDF_CORE_H
 #define __RDF_CORE_H
 #include "langfunc.h"
+#include "uname_const_decl.h"
 #include "sqlnode.h"
 #include "rdf_mapping_jso.h"
 #include "xmlparser.h" /* for xml_read_func_t and xml_read_abend_func_t */
@@ -33,13 +34,19 @@
 #define IRI_TO_ID_IF_KNOWN	0 /*!< Return IRI_ID if known, integer zero (NULL) if not known or error is not NULL */
 #define IRI_TO_ID_WITH_CREATE	1 /*!< Return IRI_ID if known or created on the fly, integer zero (NULL) if error is not NULL */
 #define IRI_TO_ID_IF_CACHED	2 /*!< Return IRI_ID if known and is in cache, integer zero (NULL) if not known or known but not cached or error is not NULL */
+
+/*!< returns 0 for NULL or non-cached rdf box or error, 1 for ready to use iri_id, 2 for URI string */
+extern int iri_canonicalize (query_instance_t *qi, caddr_t name, int mode, caddr_t *res_ret, caddr_t *err_ret);
 extern caddr_t iri_to_id (caddr_t *qst, caddr_t name, int mode, caddr_t *err_ret);
+extern caddr_t key_id_to_canonicalized_iri (query_instance_t * qi, iri_id_t iri_id_no);
 extern caddr_t key_id_to_iri (query_instance_t * qi, iri_id_t iri_id_no);
 extern int key_id_to_namespace_and_local (query_instance_t *qi, iri_id_t iid, caddr_t *subj_ns_ret, caddr_t *subj_loc_ret);
 #define rdf_type_twobyte_to_iri(twobyte) nic_id_name (rdf_type_cache, (twobyte))
 #define rdf_lang_twobyte_to_string(twobyte) nic_id_name (rdf_lang_cache, (twobyte))
 /*! \returns NULL for string, (ccaddr_t)((ptrlong)1) for unsupported, 2 for NULL, UNAME for others */
 extern ccaddr_t xsd_type_of_box (caddr_t arg);
+/*! Casts \c new_val to some datatype appropriate for XPATH/XSLT and stores in an XSLT variable value or XQI slot passed as an address to free and set */
+extern void rb_cast_to_xpath_safe (query_instance_t *qi, caddr_t new_val, caddr_t *retval_ptr);
 #define BNODE_IID_TO_LABEL_BUFFER(buf,iid) (((iid) >= MIN_64BIT_BNODE_IRI_ID) ? \
   sprintf (buf, "nodeID://b" BOXINT_FMT, (boxint)((iid)-MIN_64BIT_BNODE_IRI_ID)) : \
   sprintf (buf, "nodeID://" BOXINT_FMT, (boxint)(iid)) )
@@ -166,7 +173,7 @@ typedef struct ttlp_s
   const char *ttlp_err_hdr;	/*!< Human-readable phrase that gives a name to the parsing routine, e.g. "Turtle parser of web crawler" */
   caddr_t ttlp_catched_error;	/*!< The error that stopped the processing, as a three-element vector made by srv_make_new_error () */
   caddr_t ttlp_default_ns_uri;	/*!< IRI associated with ':' prefix */
-  dk_set_t ttlp_namespaces;	/*!< get_keyword style list of namespace prefixes (keys) and IRIs (values) */
+  id_hash_t *ttlp_namespaces_prefix2iri;	/*!< A hashtable of namespace prefixes (keys) and IRIs (values) */
   dk_set_t ttlp_saved_uris;	/*!< Stack that keeps URIs. YACC stack is not used to let us free memory on error */
   dk_set_t ttlp_unused_seq_bnodes;	/*!< A list of bnodes that were allocated for use in lists but not used because lists are terminated before use */
   caddr_t ttlp_last_complete_uri;	/*!< Last \c QNAME or \c Q_IRI_REF that is expanded and resolved if needed */
@@ -274,7 +281,9 @@ extern caddr_t boxed_nobody_uid;
 
 caddr_t iri_ensure (caddr_t * qst, caddr_t name, int flag, caddr_t * err_ret);
 void rdf_graph_keyword (iri_id_t id, char *ret);
-caddr_t uriqa_dynamic_local_replace (caddr_t name, client_connection_t * cli);
+extern caddr_t uriqa_dynamic_local_replace_nocheck (caddr_t name, client_connection_t * cli);
+#define uriqa_dynamic_local_replace(name, cli) \
+  (strncmp ((name), "local:", 6) ? (name) : uriqa_dynamic_local_replace_nocheck ((name), (cli)))
 
 /* if rb content longer than this, use md5 in rdf_obj table key */
 #define RB_BOX_HASH_MIN_LEN 50
diff --git a/libsrc/Wi/rdf_mapping.jso b/libsrc/Wi/rdf_mapping.jso
index 0c74a3b..a7621f2 100644
--- a/libsrc/Wi/rdf_mapping.jso
+++ b/libsrc/Wi/rdf_mapping.jso
@@ -1,5 +1,5 @@
 --
---  $Id: rdf_mapping.jso,v 1.24.2.3 2010/02/01 12:53:43 source Exp $
+--  $Id: rdf_mapping.jso,v 1.24.2.4 2010/09/17 22:49:23 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -207,6 +207,7 @@ JSO_SCALAR qmTableRowFilter STRING OPTIONAL		--!< DEPRECATED Filter expression t
 JSO_POINTER qmUserSubMaps quad_map_array OPTIONAL	--!< Array of user-defined submaps, should never appear in MJVs or default storage
 JSO_SCALAR qmMatchingFlags BITMASK OPTIONAL		--!< What should be done in case of match of triple pattern to conditions of the quad map
 JSO_SCALAR qmPriorityOrder INTEGER OPTIONAL		--!< Integer to specify default order in parent's qmUserSubMaps
+JSO_SCALAR qmAliasesKeyrefdByQuad STRING_array OPTIONAL	--!< List of aliases such that any quad made by the quad map can be made from exactly one row from the alias, so quad identifies the row there
 JSO_SCALAR qmAllATableUses INTEGER_array PRIVATE	--!< Complete list of all qmatu made for qmATables and qmvATables, sorted alphabetically by qmatu_alias
 JSO_SCALAR qmAllATableUseCount INTEGER PRIVATE		--!< Number of used elements in qmAllATableUseCount
 JSO_SCALAR qmAllConds STRING_array PRIVATE		--!< Complete list of all join conditions from qmConds and qmvConds, sorted alphabetically
diff --git a/libsrc/Wi/rdf_mapping_jso.c b/libsrc/Wi/rdf_mapping_jso.c
index 02fcc45..f8993ad 100644
--- a/libsrc/Wi/rdf_mapping_jso.c
+++ b/libsrc/Wi/rdf_mapping_jso.c
@@ -1,5 +1,5 @@
 /*  */
-/* $Id: rdf_mapping.jso,v 1.24.2.3 2010/02/01 12:53:43 source Exp $ */
+/* $Id: rdf_mapping.jso,v 1.24.2.4 2010/09/17 22:49:23 source Exp $ */
 /*  */
 /* This file is part of the OpenLink Software Virtuoso Open-Source (VOS) */
 /* project. */
@@ -286,6 +286,7 @@ jso_field_descr_t jso_fields__quad_map[] = {
   { NULL	, "qmUserSubMaps"	, JSO_IRI_OF_quad_map_array	, JSO_OPTIONAL	, JSO_FIELD_OFFSET(quad_map_t,qmUserSubMaps)	, NULL },
   { NULL	, "qmMatchingFlags"	, JSO_BITMASK	, JSO_OPTIONAL	, JSO_FIELD_OFFSET(quad_map_t,qmMatchingFlags)	, NULL },
   { NULL	, "qmPriorityOrder"	, JSO_INTEGER	, JSO_OPTIONAL	, JSO_FIELD_OFFSET(quad_map_t,qmPriorityOrder)	, NULL },
+  { NULL	, "qmAliasesKeyrefdByQuad"	, JSO_STRING_array	, JSO_OPTIONAL	, JSO_FIELD_OFFSET(quad_map_t,qmAliasesKeyrefdByQuad)	, NULL },
   { NULL	, "qmAllATableUses"	, JSO_INTEGER_array	, JSO_PRIVATE	, JSO_FIELD_OFFSET(quad_map_t,qmAllATableUses)	, NULL },
   { NULL	, "qmAllATableUseCount"	, JSO_INTEGER	, JSO_PRIVATE	, JSO_FIELD_OFFSET(quad_map_t,qmAllATableUseCount)	, NULL },
   { NULL	, "qmAllConds"	, JSO_STRING_array	, JSO_PRIVATE	, JSO_FIELD_OFFSET(quad_map_t,qmAllConds)	, NULL },
diff --git a/libsrc/Wi/rdf_mapping_jso.h b/libsrc/Wi/rdf_mapping_jso.h
index 193a726..692bbbc 100644
--- a/libsrc/Wi/rdf_mapping_jso.h
+++ b/libsrc/Wi/rdf_mapping_jso.h
@@ -1,7 +1,7 @@
 #ifndef __RFD_MAPPING_JSO_H
 #define __RFD_MAPPING_JSO_H
 /*  */
-/* $Id: rdf_mapping.jso,v 1.24.2.3 2010/02/01 12:53:43 source Exp $ */
+/* $Id: rdf_mapping.jso,v 1.24.2.4 2010/09/17 22:49:23 source Exp $ */
 /*  */
 /* This file is part of the OpenLink Software Virtuoso Open-Source (VOS) */
 /* project. */
@@ -217,6 +217,7 @@ typedef struct quad_map_s
   quad_map_array_t	qmUserSubMaps;	/*!< Array of user-defined submaps, should never appear in MJVs or default storage */
   ptrlong	qmMatchingFlags;	/*!< What should be done in case of match of triple pattern to conditions of the quad map */
   ptrlong	qmPriorityOrder;	/*!< Integer to specify default order in parent's qmUserSubMaps */
+  ccaddr_t *	qmAliasesKeyrefdByQuad;	/*!< List of aliases such that any quad made by the quad map can be made from exactly one row from the alias, so quad identifies the row there */
   ptrlong *	qmAllATableUses;	/*!< Complete list of all qmatu made for qmATables and qmvATables, sorted alphabetically by qmatu_alias */
   ptrlong	qmAllATableUseCount;	/*!< Number of used elements in qmAllATableUseCount */
   ccaddr_t *	qmAllConds;	/*!< Complete list of all join conditions from qmConds and qmvConds, sorted alphabetically */
diff --git a/libsrc/Wi/rdf_mapping_jso.ttl b/libsrc/Wi/rdf_mapping_jso.ttl
index 7042b6b..8db24a8 100644
--- a/libsrc/Wi/rdf_mapping_jso.ttl
+++ b/libsrc/Wi/rdf_mapping_jso.ttl
@@ -5,7 +5,7 @@
 @prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#> .
 
 <!--  -->
-<!-- $Id: rdf_mapping.jso,v 1.24.2.3 2010/02/01 12:53:43 source Exp $ -->
+<!-- $Id: rdf_mapping.jso,v 1.24.2.4 2010/09/17 22:49:23 source Exp $ -->
 <!--  -->
 <!-- This file is part of the OpenLink Software Virtuoso Open-Source (VOS) -->
 <!-- project. -->
@@ -986,6 +986,13 @@
 	rdfs:Range xsd:integer ;
 	virtrdf:cardinality 'single' ;
 	.
+ <http://www.openlinksw.com/schemas/virtrdf#qmAliasesKeyrefdByQuad>
+	rdf:type rdf:Property ;
+	rdfs:comment  "List of aliases such that any quad made by the quad map can be made from exactly one row from the alias, so quad identifies the row there" ;
+	rdfs:Domain  <http://www.openlinksw.com/schemas/virtrdf#QuadMap> ;
+	rdfs:Range xsd:any ;
+	virtrdf:cardinality 'single' ;
+	.
  <http://www.openlinksw.com/schemas/virtrdf#qmAllATableUses>
 	rdf:type rdf:Property ;
 	rdfs:comment  "Complete list of all qmatu made for qmATables and qmvATables, sorted alphabetically by qmatu_alias" ;
diff --git a/libsrc/Wi/rdf_mapping_jso.ttl-sample b/libsrc/Wi/rdf_mapping_jso.ttl-sample
index 97d0f5d..274cbc3 100644
--- a/libsrc/Wi/rdf_mapping_jso.ttl-sample
+++ b/libsrc/Wi/rdf_mapping_jso.ttl-sample
@@ -5,7 +5,7 @@
 @prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#> .
 
 <!--  -->
-<!-- $Id: rdf_mapping.jso,v 1.24.2.3 2010/02/01 12:53:43 source Exp $ -->
+<!-- $Id: rdf_mapping.jso,v 1.24.2.4 2010/09/17 22:49:23 source Exp $ -->
 <!--  -->
 <!-- This file is part of the OpenLink Software Virtuoso Open-Source (VOS) -->
 <!-- project. -->
@@ -182,6 +182,7 @@
 	ns0:qmUserSubMaps '';	# JSO_IRI_OF_quad_map_array OPTIONAL Array of user-defined submaps, should never appear in MJVs or default storage
 	ns0:qmMatchingFlags '';	# JSO_BITMASK OPTIONAL What should be done in case of match of triple pattern to conditions of the quad map
 	ns0:qmPriorityOrder '';	# JSO_INTEGER OPTIONAL Integer to specify default order in parent's qmUserSubMaps
+	ns0:qmAliasesKeyrefdByQuad '';	# JSO_STRING_array OPTIONAL List of aliases such that any quad made by the quad map can be made from exactly one row from the alias, so quad identifies the row there
 	ns0:qmAllATableUses '';	# JSO_INTEGER_array PRIVATE Complete list of all qmatu made for qmATables and qmvATables, sorted alphabetically by qmatu_alias
 	ns0:qmAllATableUseCount '';	# JSO_INTEGER PRIVATE Number of used elements in qmAllATableUseCount
 	ns0:qmAllConds '';	# JSO_STRING_array PRIVATE Complete list of all join conditions from qmConds and qmvConds, sorted alphabetically
diff --git a/libsrc/Wi/rdf_schema_objects.sql b/libsrc/Wi/rdf_schema_objects.sql
index b7e0067..cde31d6 100644
--- a/libsrc/Wi/rdf_schema_objects.sql
+++ b/libsrc/Wi/rdf_schema_objects.sql
@@ -1,5 +1,5 @@
 --
---  $Id: rdf_schema_objects.sql,v 1.11.2.15 2010/03/08 12:01:04 source Exp $
+--  $Id: rdf_schema_objects.sql,v 1.11.2.17 2010/09/17 23:11:37 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -891,6 +891,7 @@ skip_this:
 create procedure RDF_VIEW_GEN_VD (in qual varchar)
 {
   declare ses, pref any;
+  declare fct_installed int;
   ses := string_output ();
   pref := lower (qual);
 
@@ -905,6 +906,9 @@ create procedure RDF_VIEW_GEN_VD (in qual varchar)
     return '\n-- WARNING: there are already created virtual directory "/'||qual||'", skipping virtual directory generation\n'||
     '-- WARNING: To avoid this message chose different base URL or drop existing virtual directory and its rewrite rules.\n';
 
+  if (exists (select 1 from VAD.DBA.VAD_REGISTRY where R_KEY like '/VAD/fct/%/resources/dav/%'))
+    fct_installed := 1;
+
   http (
   'DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
     ''<pref>_rule2'',
@@ -915,7 +919,7 @@ create procedure RDF_VIEW_GEN_VD (in qual varchar)
     ''/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/<qual>%%23%%3E&format=%U'',
     vector(''path'', ''*accept*''),
     null,
-    ''(text/rdf.n3)|(application/rdf.xml)'',
+    ''(text/rdf.n3)|(application/rdf.xml)|(text/n3)|(application/json)'',
     2,
     null
     );', ses);
@@ -932,7 +936,7 @@ create procedure RDF_VIEW_GEN_VD (in qual varchar)
     ''/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^/<qual>/stat%%23%%3E+%%3Fo+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/<qual>%%23%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^/<qual>/stat%%23%%3E+%%3Fp+%%3Fo+}&format=%U'',
     vector(''*accept*''),
     null,
-    ''(text/rdf.n3)|(application/rdf.xml)'',
+    ''(text/rdf.n3)|(application/rdf.xml)|(text/n3)|(application/json)'',
     2,
     null
     );', ses);
@@ -948,26 +952,56 @@ create procedure RDF_VIEW_GEN_VD (in qual varchar)
     ''/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^/<qual>/objects/%U%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/<qual>%%23%%3E&format=%U'',
     vector(''path'', ''*accept*''),
     null,
-    ''(text/rdf.n3)|(application/rdf.xml)'',
+    ''(text/rdf.n3)|(application/rdf.xml)|(text/n3)|(application/json)'',
     2,
     null
     );', ses);
 
   http ('\n', ses);
-  http (
+  http (concat (
   'DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
     ''<pref>_rule1'',
     1,
     ''([^#]*)'',
     vector(''path''),
+    1,\n',
+
+    case when fct_installed
+    then
+      '''/describe/?url=http://^{URIQADefaultHost}^%U%%23this&graph=http%%3A//^{URIQADefaultHost}^/<qual>%%23'','
+    else
+      '''/about/html/http://^{URIQADefaultHost}^%s'','
+    end
+
+    ,'\nvector(''path''),
+    null,
+    null,
+    2,
+    303
+    );'), ses);
+  http ('\n', ses);
+
+  http (concat (
+  'DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
+    ''<pref>_rule7'',
     1,
-    ''/about/html/http://^{URIQADefaultHost}^%s'',
+    ''/<qual>/stat([^#]*)'',
     vector(''path''),
+    1,\n',
+
+    case when fct_installed
+    then
+      '''/describe/?url=http://^{URIQADefaultHost}^/<qual>/stat%%23&graph=http%%3A//^{URIQADefaultHost}^/<qual>%%23'','
+    else
+      '''/about/html/http://^{URIQADefaultHost}^/<qual>/stat%%01'','
+    end
+
+    ,'\nvector(''path''),
     null,
     null,
     2,
     303
-    );', ses);
+    );'), ses);
   http ('\n', ses);
 
   http (
@@ -986,7 +1020,7 @@ create procedure RDF_VIEW_GEN_VD (in qual varchar)
     );', ses);
 
   http ('\n', ses);
-  http ('DB.DBA.URLREWRITE_CREATE_RULELIST ( ''<pref>_rule_list1'', 1, vector ( ''<pref>_rule1'', ''<pref>_rule5'', ''<pref>_rule2'', ''<pref>_rule4'', ''<pref>_rule6''));', ses);
+  http ('DB.DBA.URLREWRITE_CREATE_RULELIST ( ''<pref>_rule_list1'', 1, vector ( ''<pref>_rule1'', ''<pref>_rule7'', ''<pref>_rule5'', ''<pref>_rule2'', ''<pref>_rule4'', ''<pref>_rule6''));', ses);
 
   http ('\n', ses);
   http ('DB.DBA.VHOST_REMOVE (lpath=>''/<qual>'');', ses);
@@ -1003,6 +1037,7 @@ create procedure RDF_VIEW_GEN_VD (in qual varchar)
 
 create procedure RDF_OWL_GEN_VD (in qual varchar)
 {
+  declare fct_installed int;
   declare ses, pref any;
   ses := string_output ();
   pref := lower (qual);
@@ -1016,6 +1051,9 @@ create procedure RDF_OWL_GEN_VD (in qual varchar)
     return '\n-- WARNING: there are already created virtual directory "/schemas/'||qual||'", skipping virtual directory generation\n'||
     '-- WARNING: To avoid this message chose different base URL or drop existing virtual directory and its rewrite rules.\n';
 
+  if (exists (select 1 from VAD.DBA.VAD_REGISTRY where R_KEY like '/VAD/fct/%/resources/dav/%'))
+    fct_installed := 1;
+
   http (
   'DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
     ''<pref>_owl_rule2'',
@@ -1026,26 +1064,32 @@ create procedure RDF_OWL_GEN_VD (in qual varchar)
     ''/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/schemas/<qual>%%23%%3E&format=%U'',
     vector(''path'', ''*accept*''),
     null,
-    ''(text/rdf.n3)|(application/rdf.xml)'',
+    ''(text/rdf.n3)|(application/rdf.xml)|(text/n3)|(application/json)'',
     2,
     null
     );', ses);
 
   http ('\n', ses);
   http (
+  concat (
   'DB.DBA.URLREWRITE_CREATE_REGEX_RULE (
     ''<pref>_owl_rule1'',
     1,
     ''([^#]*)'',
     vector(''path''),
-    1,
-    ''/about/html/http://^{URIQADefaultHost}^%s'',
-    vector(''path''),
+    1,\n',
+    case when fct_installed
+    then
+    '''/describe/?url=http://^{URIQADefaultHost}^%U&graph=http%%3A//^{URIQADefaultHost}^/schemas/<qual>%%23'','
+    else
+    '''/about/html/http://^{URIQADefaultHost}^%s'','
+    end,
+    '\nvector(''path''),
     null,
     null,
     2,
     303
-    );', ses);
+    );'), ses);
   http ('\n', ses);
   http ('DB.DBA.URLREWRITE_CREATE_RULELIST ( ''<pref>_owl_rule_list1'', 1, vector ( ''<pref>_owl_rule1'', ''<pref>_owl_rule2''));', ses);
 
@@ -1061,3 +1105,98 @@ create procedure RDF_OWL_GEN_VD (in qual varchar)
    return ses;
 }
 ;
+
+create procedure
+RDF_VIEW_CHECK_SYNC_TB (in tb varchar)
+{
+  declare tree, tbname any;
+  tree := sql_parse (sprintf ('SELECT 1 from %s', tb));
+  tbname := tree [4][1][0][1][1];
+  tbname := complete_table_name (tbname, 1);
+  if (exists (select 1 from SYS_VIEWS where V_NAME = tbname))
+    return 0;
+  return 1;
+}
+;
+
+create procedure
+RDF_VIEW_DO_SYNC (in qualifier varchar, in load_data int := 0)
+{
+   declare mask varchar;
+   declare txt, tbls, err_ret any;
+   declare stat, msg varchar;
+
+   tbls := vector ();
+   err_ret := vector ();
+   mask := sprintf ('http://%s/schemas/%s/qm-%%', cfg_item_value(virtuoso_ini_path(), 'URIQA','DefaultHost'), qualifier);
+   for select "o" from
+   (sparql define input:storage "" select ?o from virtrdf:
+     {
+       virtrdf:DefaultQuadStorage-UserMaps ?p ?o .
+       ?o a virtrdf:QuadMap  .
+       filter (?o like ?:mask)
+     }
+     order by asc (bif:sprintf_inverse (bif:concat (str(rdf:_), "%d"), str (?p), 1))) x do
+   {
+     declare qm varchar;
+     if ("o" not like '%/qm-VoidStatistics')
+       {
+	 exec (sprintf ('sparql alter quad storage virtrdf:SyncToQuads { drop quad map <%s> }', "o"), stat, msg);
+	 stat := '00000';
+	 exec (sprintf ('sparql alter quad storage virtrdf:SyncToQuads { create <%s> using storage virtrdf:DefaultQuadStorage }', "o"), stat, msg);
+	 if (stat <> '00000')
+	   err_ret := vector_concat (err_ret, vector (vector (stat, msg)));
+
+	 qm := "o";
+	 for select "tb" from (sparql define input:storage ""
+	    select distinct ?tb from virtrdf:
+	    {
+	      ?:qm virtrdf:qmUserSubMaps ?sm .
+	      ?sm ?inx ?q .
+	      ?q virtrdf:qmTableName ?tb  .
+	    }) xx do
+	   {
+	     if (RDF_VIEW_CHECK_SYNC_TB ("tb"))
+ 	       tbls := vector_concat (tbls, vector ("tb"));
+	     else
+	       err_ret := vector_concat (err_ret, vector (vector ('42000', sprintf ('Reference to VIEW %s cannot be added automatically', "tb"))));
+	   }
+       }
+   }
+  foreach (varchar tb in tbls) do
+    {
+      for (declare ctr int, ctr := 1; ctr <= 4; ctr := ctr + 1)
+        {
+	  txt := sparql_rdb2rdf_codegen (tb, ctr);
+	  stat := '00000';
+	  if (isvector (txt))
+	    {
+	      exec (cast (txt[0] as varchar), stat, msg);
+	      if (stat <> '00000')
+		{
+		  err_ret := vector_concat (err_ret, vector (vector (stat, msg)));
+		  stat := '00000';
+		}
+	      exec (cast (txt[1] as varchar), stat, msg);
+	      if (stat <> '00000')
+		err_ret := vector_concat (err_ret, vector (vector (stat, msg)));
+	    }
+	  else
+	    {
+	      exec (cast (txt as varchar), stat, msg);
+	      if (stat <> '00000')
+		err_ret := vector_concat (err_ret, vector (vector (stat, msg)));
+	    }
+	}
+      if (load_data)
+	{
+	  declare pname varchar;
+	  pname := sprintf ('DB.DBA."RDB2RDF_FILL__%s" ()', replace (replace (tb, '"', '`'), '.', '~'));
+	  stat := '00000';
+	  exec (pname, stat, msg);
+	  if (stat <> '00000') err_ret := vector_concat (err_ret, vector (sprintf ('%s: %s', stat, msg)));
+	}
+    }
+  return err_ret;
+}
+;
diff --git a/libsrc/Wi/rdf_sponge.sql b/libsrc/Wi/rdf_sponge.sql
index 21f312d..a062b4c 100644
--- a/libsrc/Wi/rdf_sponge.sql
+++ b/libsrc/Wi/rdf_sponge.sql
@@ -1,5 +1,5 @@
 --
---  $Id: rdf_sponge.sql,v 1.5.2.24 2010/05/11 16:53:34 source Exp $
+--  $Id: rdf_sponge.sql,v 1.5.2.38 2011/03/29 22:55:26 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -89,7 +89,8 @@ create function DB.DBA.RDF_GRAB_SINGLE (in val any, inout grabbed any, inout env
         'get:method', get_method,
         'get:destination', final_dest,
         'get:group-destination', final_gdest,
-        'get:strategy', get_keyword_ucase ('get:strategy', env)
+        'get:strategy', get_keyword_ucase ('get:strategy', env),
+        'get:error-recovery', get_keyword_ucase ('get:error-recovery', env)
 	 );
       dict_put (grabbed, url, 1);
       call (get_keyword ('loader', env))(url, opts);
@@ -110,11 +111,14 @@ create function DB.DBA.RDF_GRAB_SINGLE (in val any, inout grabbed any, inout env
   }
 end_of_sponge:
   commit work;
+  -- dbg_obj_princ ('DB.DBA.RDF_GRAB_SINGLE will try to recover after ', __SQL_STATE, __SQL_MESSAGE, ' with ', get_keyword_ucase ('get:error-recovery', env));
   recov := get_keyword_ucase ('get:error-recovery', env);
   if (recov is not null)
     {
+      if (recov = 'signal')
+        signal (__SQL_STATE, __SQL_MESSAGE);
       whenever sqlstate '*' goto end_of_recov;
-      call (recov) (__SQL_STATE, __SQL_MESSAGE);
+      call (recov) (__SQL_STATE, __SQL_MESSAGE, val, grabbed, env);
       commit work;
       return 0;
 end_of_recov:
@@ -147,6 +151,26 @@ create function DB.DBA.RDF_GRAB_SEEALSO (in subj varchar, in opt_g varchar, inou
   sa_preds := get_keyword ('sa_preds', env);
   sa_graphs := get_keyword ('sa_graphs', env);
   -- dbg_obj_princ ('DB.DBA.RDF_GRAB_SEEALSO (', subj, opt_g, ') in graphs ', sa_graphs, ' with preds ', sa_preds);
+  if (sa_graphs is null)
+    {
+      foreach (varchar pred in sa_preds) do
+        {
+          for (sparql define input:storage "" select ?val where { ?:subj ?:pred ?val . filter (isIRI(?val)) } ) do
+            {
+              -- dbg_obj_princ ('found { ?g, ', subj, pred, val, '}');
+              if ("val" like 'http://%')
+                {
+                  -- dbg_obj_princ ('DB.DBA.RDF_GRAB_SEEALSO () aq_request ', vector ("val", '...', env, doc_limit));
+                  --DB.DBA.RDF_GRAB_SINGLE_ASYNC ("val", grabbed, env, doc_limit);
+                  aq_request (aq, 'DB.DBA.RDF_GRAB_SINGLE_ASYNC', vector ("val", grabbed, env, doc_limit));
+                  if (dict_size (grabbed) > doc_limit)
+                    goto out_of_limit;
+                }
+            }
+        }
+    }
+  else
+    {
   foreach (varchar pred in sa_preds) do
     {
       foreach (varchar graph in sa_graphs) do
@@ -165,6 +189,7 @@ create function DB.DBA.RDF_GRAB_SEEALSO (in subj varchar, in opt_g varchar, inou
             }
         }
     }
+    }
   if (opt_g is not null)
     {
       foreach (varchar pred in sa_preds) do
@@ -214,7 +239,7 @@ DB.DBA.RDF_GRAB (
 {
   declare rctr, rcount, colcount, iter_ctr integer;
   declare stat, msg varchar;
-  declare grab_params, all_params any;
+  declare grab_params, all_params, sa_params any;
   declare grabbed, metas, rset, aq any;
   -- dbg_obj_princ ('DB.DBA.RDF_GRAB (..., ', ret_limit, const_iris, depth, doc_limit, base_iri, destination, group_destination, resolver, loader, plain_ret, ')');
   grab_params := vector ('sa_graphs', sa_graphs, 'sa_preds', sa_preds,
@@ -224,9 +249,11 @@ DB.DBA.RDF_GRAB (
     'resolver', resolver, 'loader', loader,
     'refresh_free_text', refresh_free_text,
     'flags', flags, 'grabbed', dict_new() );
-  all_params := vector_concat (vector (grab_params), app_params);
+  all_params := vector_concat (grab_params, app_params);
   aq := async_queue (8);
   grabbed := dict_new ();
+  if (sa_preds is not null)
+    sa_params := vector_concat (all_params, vector ('grabbed', grabbed));
   foreach (any val in const_iris) do
     {
       -- dbg_obj_princ ('DB.DBA.RDF_GRAB: const IRI', val);
@@ -235,6 +262,11 @@ DB.DBA.RDF_GRAB (
           -- dbg_obj_princ ('DB.DBA.RDF_GRAB () aq_request ', vector (val, '...', grab_params, doc_limit));
           --DB.DBA.RDF_GRAB_SINGLE_ASYNC (val, grabbed, grab_params, doc_limit);
           aq_request (aq, 'DB.DBA.RDF_GRAB_SINGLE_ASYNC', vector (val, grabbed, grab_params, doc_limit));
+          if (sa_preds is not null)
+            {
+              -- dbg_obj_princ ('DB.DBA.RDF_GRAB () grabs seealso for ', val);
+              DB.DBA.RDF_GRAB_SEEALSO (val, null, sa_params);
+            }
         }
     }
   commit work;
@@ -262,6 +294,8 @@ DB.DBA.RDF_GRAB (
             {
               declare val any;
               declare dest varchar;
+              if (dict_size (grabbed) >= doc_limit)
+                goto final_exec;
               val := rset[rctr][colctr];
               if (is_named_iri_id (val) and __rgs_ack_cbk (val, uid, 4))
                 {
@@ -270,6 +304,13 @@ DB.DBA.RDF_GRAB (
                   aq_request (aq, 'DB.DBA.RDF_GRAB_SINGLE_ASYNC', vector (val, grabbed, grab_params, doc_limit));
                   if (dict_size (grabbed) >= doc_limit)
                     goto final_exec;
+                  if (sa_preds is not null)
+                    {
+                      -- dbg_obj_princ ('DB.DBA.RDF_GRAB () grabs seealso for ', val);
+                      DB.DBA.RDF_GRAB_SEEALSO (val, null, sa_params);
+                    }
+                  if (dict_size (grabbed) >= doc_limit)
+                    goto final_exec;
                 }
             }
         }
@@ -279,8 +320,11 @@ DB.DBA.RDF_GRAB (
       DB.DBA.RDF_FT_INDEX_GRABBED (grabbed, grab_params);
       commit work;
       if (old_doc_count = dict_size (grabbed))
+        {
+          -- dbg_obj_princ ('DB.DBA.RDF_GRAB () has reached a stable point with ', old_doc_count, ' grabbed docs');
         goto final_exec;
     }
+    }
 
 final_exec:
   stat := '00000';
@@ -450,25 +494,33 @@ create procedure DB.DBA.SYS_HTTP_SPONGE_GET_CACHE_PARAMS
   ret_dt_date := http_string_date (ret_date, NULL, NULL);
   ret_dt_expires := http_string_date (ret_expires, NULL, now());
   ret_dt_last_modified := http_string_date (ret_last_modif, NULL, now());
+  -- if no cache directive we say it is now
   if (http_request_header (ret_hdr, 'Pragma', null, null) = 'no-cache' or
     http_request_header (ret_hdr, 'Cache-Control', null, null) like 'no-cache%' )
     ret_dt_expires := now ();
+  -- if not modified and no last given we take old last modified
   if (ret_304_not_modified and ret_dt_last_modified is null)
     ret_dt_last_modified := old_last_modified;
+  -- if we have date given
   if (ret_dt_date is not null)
     {
+      -- we calculate on which date it expiry
       if (ret_dt_expires is not null)
         ret_dt_expires := dateadd ('second', datediff ('second', ret_dt_date, now()), ret_dt_expires);
+      -- if we have last modified we calculate based on date given
       if (ret_dt_last_modified is not null)
         ret_dt_last_modified := dateadd ('second', datediff ('second', ret_dt_date, now()), ret_dt_last_modified);
     }
+  -- if we have expires and it is less tand date we reset to null
   if (ret_dt_expires is not null and
     (ret_dt_expires < coalesce (ret_dt_date, ret_dt_last_modified, now ())) )
     ret_dt_expires := NULL;
+  -- new expiration is expires date if not null
   if (ret_dt_expires is not null)
     new_expiration := ret_dt_expires;
   else
     {
+      -- we have date and last modified but not expires, so we calculate based on date and modified date
       if (ret_dt_date is not null and ret_dt_last_modified is not null and (ret_dt_date >= ret_dt_last_modified))
         new_expiration := dateadd ('second',
 		__min (
@@ -479,9 +531,11 @@ create procedure DB.DBA.SYS_HTTP_SPONGE_GET_CACHE_PARAMS
     }
   if (ret_304_not_modified)
     {
+      -- if not modified and we have explicit refresh, we use explicit
       if (new_expiration is null and explicit_refresh is not null)
         new_expiration := dateadd ('second', 0.7 * explicit_refresh, now());
 
+      -- we take less from new expiration and expilicit refresh
       if (ret_dt_expires is null and new_expiration is not null and explicit_refresh is not null)
         new_expiration := __min (new_expiration, dateadd ('second', explicit_refresh, now()));
     }
@@ -565,9 +619,10 @@ create function DB.DBA.SYS_HTTP_SPONGE_UP (in local_iri varchar, in get_uri varc
   declare req_hdr varchar;
   declare ret_body, ret_content_type, ret_etag, ret_last_modified, ret_date, ret_last_modif, ret_expires varchar;
   declare get_proxy varchar;
-  declare ret_dt_date, ret_dt_last_modified, ret_dt_expires datetime;
+  declare ret_dt_date, ret_dt_last_modified, ret_dt_expires, expiration, min_expiration datetime;
   declare ret_304_not_modified integer;
   declare parser_rc, max_refresh int;
+  declare stat, msg varchar;
 
   -- dbg_obj_princ ('DB.DBA.SYS_HTTP_SPONGE_UP (', local_iri, get_uri, options, ')');
   new_origin_uri := cast (get_keyword_ucase ('get:uri', options, get_uri) as varchar);
@@ -585,6 +640,9 @@ create function DB.DBA.SYS_HTTP_SPONGE_UP (in local_iri varchar, in get_uri varc
     }
   else if (isstring (explicit_refresh))
     explicit_refresh := atoi (explicit_refresh);
+  min_expiration := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'MinExpiration'), '-1'));
+  if (min_expiration < 0)
+    min_expiration := null;
   set isolation='serializable';
   whenever not found goto add_new_origin;
   select HS_ORIGIN_URI, HS_ORIGIN_LOGIN, HS_LAST_LOAD, HS_LAST_ETAG,
@@ -724,6 +782,19 @@ perform_actual_load:
           ret_304_not_modified := 1;
           goto resp_received;
         }
+      if (ret_hdr[0] like 'HTTP/1._ 5__ %' or ret_hdr[0] like 'HTTP/1._ 4__ %')
+	{
+	  rollback work;
+	  update DB.DBA.SYS_HTTP_SPONGE
+	      set HS_SQL_STATE = 'RDFXX',
+	      HS_SQL_MESSAGE = sprintf ('Unable to retrieve RDF data from "%.500s": %.500s', new_origin_uri, ret_hdr[0]),
+	      HS_EXPIRATION = now (),
+	      HS_EXP_IS_TRUE = 0
+		  where
+		  HS_LOCAL_IRI = local_iri and HS_PARSER = parser;
+	  commit work;
+	  signal ('RDFXX', sprintf ('Unable to retrieve RDF data from "%.500s": %.500s', new_origin_uri, ret_hdr[0]));
+	}
       goto resp_received;
     }
   if (eraser is not null)
@@ -802,11 +873,14 @@ resp_received:
     new_expiration := dateadd ('second', load_end_msec - load_begin_msec, now()); -- assuming that expiration is at least 1000 times larger than load time.
   if (ret_dt_expires is null and explicit_refresh is not null)
     new_expiration := __min (new_expiration, dateadd ('second', 0.7 * explicit_refresh, now()));
+  expiration := coalesce (ret_dt_expires, new_expiration, now());
+  if (explicit_refresh is null and min_expiration is not null)
+    expiration := __max (dateadd ('second', min_expiration, now()), expiration);
   commit work;
   update DB.DBA.SYS_HTTP_SPONGE
   set HS_LAST_LOAD = now(), HS_LAST_ETAG = new_last_etag, HS_LAST_READ = now(),
     HS_EXP_IS_TRUE = case (isnull (ret_dt_expires)) when 1 then 0 else 1 end,
-    HS_EXPIRATION = coalesce (ret_dt_expires, new_expiration, now()),
+    HS_EXPIRATION = expiration,
     HS_LAST_MODIFIED = ret_dt_last_modified,
     HS_DOWNLOAD_SIZE = new_download_size,
     HS_DOWNLOAD_MSEC_TIME = load_end_msec - load_begin_msec,
@@ -821,7 +895,8 @@ resp_received:
 error_during_load:
   rollback work;
   -- dbg_obj_princ ('error during load: ', __SQL_STATE, __SQL_MESSAGE);
-
+  stat := __SQL_STATE;
+  msg := __SQL_MESSAGE;
   load_end_msec := msec_time();
   if (new_expiration is null)
     new_expiration := dateadd ('second', load_end_msec - load_begin_msec, now());
@@ -829,13 +904,16 @@ error_during_load:
     new_expiration := __min (new_expiration, dateadd ('second', 0.7 * explicit_refresh, now()));
 
   update DB.DBA.SYS_HTTP_SPONGE
-  set HS_SQL_STATE = __SQL_STATE,
-    HS_SQL_MESSAGE = __SQL_MESSAGE,
+  set HS_SQL_STATE = stat,
+    HS_SQL_MESSAGE = msg,
     HS_EXPIRATION = coalesce (ret_dt_expires, new_expiration, now()),
     HS_EXP_IS_TRUE = case (isnull (ret_dt_expires)) when 1 then 0 else 1 end
   where
     HS_LOCAL_IRI = local_iri and HS_PARSER = parser;
   commit work;
+  -- dbg_obj_princ ('DB.DBA.SYS_HTTP_SPONGE_UP logged ', stat, msg, local_iri, parser, ', get:error-recovery is ', get_keyword_ucase ('get:error-recovery', options));
+  if (get_keyword_ucase ('get:error-recovery', options) is not null)
+    signal (stat, msg);
   return local_iri;
 }
 ;
@@ -883,7 +961,7 @@ create function DB.DBA.RDF_SPONGE_GUESS_CONTENT_TYPE (in origin_uri varchar, in
         return 'text/rdf+n3';
     }
   declare ret_begin, ret_html any;
-  ret_begin := subseq (ret_body, 0, 1024);
+  ret_begin := subseq (ret_body, 0, 4096);
   ret_html := xtree_doc (ret_begin, 2);
   if (xpath_eval ('/html|/xhtml', ret_html) is not null)
     return 'text/html';
@@ -1077,7 +1155,7 @@ create procedure DB.DBA.RDF_PROC_COLS (in pname varchar)
 -- /* Load the document in triple store. returns 1 if the document is an RDF , otherwise if it has links etc. it returns 0 */
 create procedure DB.DBA.RDF_LOAD_HTTP_RESPONSE (in graph_iri varchar, in new_origin_uri varchar, inout ret_content_type varchar, inout ret_hdr any, inout ret_body any, inout options any, inout req_hdr_arr any)
 {
-  declare dest, groupdest, cset varchar;
+  declare dest, groupdest, cset, base, first_stat, first_msg varchar;
   declare rc any;
   declare aq, ps any;
   declare xd, xt any;
@@ -1094,28 +1172,31 @@ create procedure DB.DBA.RDF_LOAD_HTTP_RESPONSE (in graph_iri varchar, in new_ori
   -- dbg_obj_princ ('ret_content_type is ', ret_content_type);
   dest := get_keyword_ucase ('get:destination', options);
   groupdest := get_keyword_ucase ('get:group-destination', options);
+  base := get_keyword ('http-redirect-to', options, new_origin_uri);
   if (get_keyword_ucase ('get:strategy', options, 'default') = 'rdfa-only')
     only_rdfa := 1;
   else
     only_rdfa := 0;
   if (strstr (ret_content_type, 'application/sparql-results+xml') is not null)
     signal ('RDFXX', sprintf ('Unable to load RDF graph <%.500s> from <%.500s>: the sparql-results XML answer does not contain triples', graph_iri, new_origin_uri));
+  if (get_keyword ('http-headers', options) is null)
+    options := vector_concat (options, vector ('http-headers', vector (req_hdr_arr, ret_hdr)));
   if (strstr (ret_content_type, 'application/rdf+xml') is not null)
     {
       --if (dest is null)
       --  DB.DBA.SPARUL_CLEAR (coalesce (dest, graph_iri), 1);
       whenever sqlstate '*' goto load_grddl;
-      log_enable (2, 1);
+      --log_enable (2, 1);
       xt := xtree_doc (ret_body);
       -- we test for GRDDL inside RDF/XML, if so do it inside mappers, else it will fail because of dv:transformation attr
       if (xpath_eval ('[ xmlns:dv="http://www.w3.org/2003/g/data-view#" ] /*[1]/@dv:transformation', xt) is not null)
 	goto load_grddl;
-      DB.DBA.RDF_LOAD_RDFXML (ret_body, new_origin_uri, coalesce (dest, graph_iri));
+      DB.DBA.RDF_LOAD_RDFXML (ret_body, base, coalesce (dest, graph_iri));
       if (groupdest is not null)
-        DB.DBA.RDF_LOAD_RDFXML (ret_body, new_origin_uri, groupdest);
+        DB.DBA.RDF_LOAD_RDFXML (ret_body, base, groupdest);
       if (__proc_exists ('DB.DBA.RDF_LOAD_POST_PROCESS') and only_rdfa = 0) -- optional step, by default skip
 	call ('DB.DBA.RDF_LOAD_POST_PROCESS') (graph_iri, new_origin_uri, dest, ret_body, ret_content_type, options);
-      log_enable (saved_log_mode, 1);
+      --log_enable (saved_log_mode, 1);
       if (aq is not null)
         aq_request (aq, 'DB.DBA.RDF_SW_PING', vector (ps, new_origin_uri));
       return 1;
@@ -1131,16 +1212,16 @@ create procedure DB.DBA.RDF_LOAD_HTTP_RESPONSE (in graph_iri varchar, in new_ori
        strstr (ret_content_type, 'application/turtle') is not null or
        strstr (ret_content_type, 'application/x-turtle') is not null )
     {
-      whenever sqlstate '*' goto load_grddl;
-      log_enable (2, 1);
+      whenever sqlstate '*' goto load_grddl_after_error;
+      --log_enable (2, 1);
       --if (dest is null)
       --  DB.DBA.SPARUL_CLEAR (coalesce (dest, graph_iri), 1);
-      DB.DBA.TTLP (ret_body, new_origin_uri, coalesce (dest, graph_iri), 255);
+      DB.DBA.TTLP (ret_body, base, coalesce (dest, graph_iri), 255);
       if (groupdest is not null)
-        DB.DBA.TTLP (ret_body, new_origin_uri, groupdest);
+        DB.DBA.TTLP (ret_body, base, groupdest);
       if (__proc_exists ('DB.DBA.RDF_LOAD_POST_PROCESS') and only_rdfa = 0) -- optional step, by default skip
 	call ('DB.DBA.RDF_LOAD_POST_PROCESS') (graph_iri, new_origin_uri, dest, ret_body, ret_content_type, options);
-      log_enable (saved_log_mode, 1);
+      --log_enable (saved_log_mode, 1);
       if (aq is not null)
         aq_request (aq, 'DB.DBA.RDF_SW_PING', vector (ps, new_origin_uri));
       return 1;
@@ -1148,11 +1229,11 @@ create procedure DB.DBA.RDF_LOAD_HTTP_RESPONSE (in graph_iri varchar, in new_ori
   else if (only_rdfa = 1 and strstr (ret_content_type, 'text/html') is not null)
     {
       whenever sqlstate '*' goto load_grddl;
-      log_enable (2, 1);
-      DB.DBA.RDF_LOAD_RDFA (ret_body, new_origin_uri, coalesce (dest, graph_iri), 2);
+      --log_enable (2, 1);
+      DB.DBA.RDF_LOAD_RDFA (ret_body, base, coalesce (dest, graph_iri), 2);
       if (groupdest is not null and groupdest <> coalesce (dest, graph_iri))
-	DB.DBA.RDF_LOAD_RDFA (ret_body, new_origin_uri, groupdest, 2);
-      log_enable (saved_log_mode, 1);
+	DB.DBA.RDF_LOAD_RDFA (ret_body, base, groupdest, 2);
+      --log_enable (saved_log_mode, 1);
       if (aq is not null)
         aq_request (aq, 'DB.DBA.RDF_SW_PING', vector (ps, new_origin_uri));
       return 1;
@@ -1249,31 +1330,60 @@ load_grddl:;
     }
   if (strstr (ret_content_type, 'text/plain') is not null)
     {
+      -- dbg_obj_princ ('DB.DBA.RDF_LOAD_HTTP_RESPONSE will signal text/plain error re. ', graph_iri, new_origin_uri, ret_content_type);
       signal ('RDFXX', sprintf (
-          'Unable to load RDF graph <%.500s> from <%.500s>: returned Content-Type ''%.300s'' status ''%.300s''\n%.500s',
-          graph_iri, new_origin_uri, ret_content_type, ret_hdr[0], subseq (ret_body, 0, 500) ) );
+          'Unable to load RDF graph <%.500s> from <%.500s>: returned Content-Type ''%.300s'' status ''%.300s'' body %.300s',
+          graph_iri, new_origin_uri, ret_content_type, ret_hdr[0], subseq (ret_body, 0, 300) ) );
     }
   if (strstr (ret_content_type, 'text/html') is not null)
     {
+      -- dbg_obj_princ ('DB.DBA.RDF_LOAD_HTTP_RESPONSE will signal text/html error re. ', graph_iri, new_origin_uri, ret_content_type);
       signal ('RDFZZ', sprintf (
-          'Unable to load RDF graph <%.500s> from <%.500s>: returned Content-Type ''%.300s'' status ''%.300s''\n%.500s',
+          'Unable to load RDF graph <%.500s> from <%.500s>: returned Content-Type ''%.300s'' status ''%.300s''\n%.300s',
           graph_iri, new_origin_uri, ret_content_type, ret_hdr[0],
---          "LEFT" (cast (xtree_doc (ret_body, 2) as varchar), 500)
-          subseq (ret_body, 0, 500)
- ) );
+--          "LEFT" (cast (xtree_doc (ret_body, 2) as varchar), 300)
+          subseq (ret_body, 0, 300) ) );
     }
+  if (isstring (first_stat))
+    {
+      -- dbg_obj_princ ('DB.DBA.RDF_LOAD_HTTP_RESPONSE will signal first error re. ', graph_iri, new_origin_uri, ret_content_type, first_stat, first_msg);
+      signal ('RDFZZ', sprintf (
+          'Unable to load RDF graph <%.200s> from <%.200s> with Content-Type ''%.50s'': %.6s: %.1000s',
+          graph_iri, new_origin_uri, ret_content_type, first_stat, first_msg ) );
+    }
+  -- dbg_obj_princ ('DB.DBA.RDF_LOAD_HTTP_RESPONSE will signal generic error re. ', graph_iri, new_origin_uri, ret_content_type);
   signal ('RDFZZ', sprintf (
       'Unable to load RDF graph <%.500s> from <%.500s>: returned unsupported Content-Type ''%.300s''',
       graph_iri, new_origin_uri, ret_content_type ) );
 resignal_parse_error:
-  log_enable (saved_log_mode, 1);
+--  log_enable (saved_log_mode, 1);
+  -- dbg_obj_princ ('DB.DBA.RDF_LOAD_HTTP_RESPONSE will resignal ', __SQL_STATE, __SQL_MESSAGE);
   resignal;
+
+load_grddl_after_error:
+  first_stat := __SQL_STATE;
+  first_msg := __SQL_MESSAGE;
+  goto load_grddl;
 }
 ;
 
 create procedure DB.DBA.RDF_FORGET_HTTP_RESPONSE (in graph_iri varchar, in new_origin_uri varchar, inout options any)
 {
   declare dest varchar;
+  declare deadl int;
+  deadl := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'MaxDeadlockRetries'), '5'));
+  declare exit handler for sqlstate '40001'
+    {
+      deadl := deadl - 1;
+      rollback work;
+      if (deadl > 0)
+	{
+	  delay (0.2);
+	  goto again;
+	}
+      resignal;
+    };
+again:
   dest := get_keyword_ucase ('get:destination', options);
   if (dest is null)
     DB.DBA.SPARUL_CLEAR (graph_iri, 1, 0);
@@ -1290,7 +1400,7 @@ create function DB.DBA.RDF_SPONGE_UP (in graph_iri varchar, in options any, in u
       return DB.DBA.RDF_SPONGE_UP_1 (graph_iri, options, uid);
     }
   commit work;
-  set_user_id ('dba', 1);
+  --set_user_id ('dba', 1);
   cookie := connection_get ('__rdf_sponge_sid');
   if (cookie is not null)
     options := vector_concat (options, vector ('rdf_sponge_sid', cookie));
@@ -1298,6 +1408,7 @@ create function DB.DBA.RDF_SPONGE_UP (in graph_iri varchar, in options any, in u
     options := vector_concat (options, vector ('rdf_sponge_debug', connection_get ('__rdf_sponge_debug')));
   if (is_http_ctx ())
     options := vector_concat (options, vector ('http_host', http_request_header(http_request_header (), 'Host', null, null)));
+  options := vector_concat (options, vector ('__rdf_sponge_log_mode', log_enable (null, 1)));
   aq := async_queue (1);
   aq_request (aq, 'DB.DBA.RDF_SPONGE_UP_1', vector (graph_iri, options, uid));
   commit work;
@@ -1316,10 +1427,10 @@ create function DB.DBA.RDF_SPONGE_UP (in graph_iri varchar, in options any, in u
 create function DB.DBA.RDF_SPONGE_UP_1 (in graph_iri varchar, in options any, in uid integer := -1)
 {
   declare dest, get_soft, local_iri, immg, res_graph_iri, cookie varchar;
-  declare perms integer;
+  declare perms, log_mode integer;
   -- dbg_obj_princ ('DB.DBA.RDF_SPONGE_UP (', graph_iri, options, ')');
   graph_iri := cast (graph_iri as varchar);
-  set_user_id ('dba', 1);
+  --set_user_id ('dba', 1);
   dest := get_keyword_ucase ('get:destination', options);
   if (dest is not null)
     local_iri := 'destMD5=' || md5(dest) || '&graphMD5=' || md5(graph_iri);
@@ -1332,12 +1443,15 @@ create function DB.DBA.RDF_SPONGE_UP_1 (in graph_iri varchar, in options any, in
     connection_set ('__rdf_sponge_debug', get_keyword ('rdf_sponge_debug', options));
   if (get_keyword ('http_host', options) is not null)
     connection_set ('__http_host', get_keyword ('http_host', options));
+  log_mode := get_keyword ('__rdf_sponge_log_mode', options);
+  if (log_mode is not null) -- when in aq mode
+    log_enable (log_mode, 1);
   -- dbg_obj_princ ('DB.DBA.RDF_SPONGE_UP (', graph_iri, options, ') set local_iri=', local_iri);
   perms := DB.DBA.RDF_GRAPH_USER_PERMS_GET (dest, case (uid) when -1 then http_nobody_uid() else uid end);
   get_soft := get_keyword_ucase ('get:soft', options);
   if ('soft' = get_soft)
     {
-      if ((dest = graph_iri) and exists (select 1 from DB.DBA.RDF_QUAD where G = iri_to_id (graph_iri, 0) ) and
+      if ((dest = graph_iri) and exists (select 1 from DB.DBA.RDF_QUAD table option (index RDF_QUAD_GS) where G = iri_to_id (graph_iri, 0) ) and
         not exists (select 1 from DB.DBA.SYS_HTTP_SPONGE
           where HS_LOCAL_IRI = local_iri and HS_PARSER = 'DB.DBA.RDF_LOAD_HTTP_RESPONSE' and
 	  HS_EXPIRATION is not null))
@@ -1371,7 +1485,7 @@ create function DB.DBA.RDF_SPONGE_UP_1 (in graph_iri varchar, in options any, in
   -- if requested iri is immutable, do not try to get it at all
   -- this is to preserve rdf storage in certain cases
   immg := cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'ImmutableGraphs');
-  if (immg is not null)
+  if (immg is not null and user <> 'dba')
     {
       immg := split_and_decode (immg, 0, '\0\0,');
       foreach (any imm in immg) do
@@ -1383,9 +1497,22 @@ create function DB.DBA.RDF_SPONGE_UP_1 (in graph_iri varchar, in options any, in
               -- dbg_obj_princ ('immutable');
               goto graph_is_ready;
             }
-	}
+	  if (imm = 'inference-graphs' and exists (select 1 from DB.DBA.SYS_RDF_SCHEMA where RS_URI = dest))
+	    {
+              res_graph_iri := dest;
+              -- dbg_obj_princ ('immutable');
+              goto graph_is_ready;
+	    }
+	  -- Like pattern allowed
+	  if (dest like imm)
+	    {
+	      res_graph_iri := local_iri;
+	      goto graph_is_ready;
+	    }
+        }
     }
   -- dbg_obj_princ ('will sponge...');
+  set_user_id ('dba', 1);
   if (lower (graph_iri) like 'file:%')
     {
       res_graph_iri := DB.DBA.SYS_FILE_SPONGE_UP (local_iri, graph_iri, null, 'DB.DBA.RDF_FORGET_HTTP_RESPONSE', options);
diff --git a/libsrc/Wi/rdf_void.sql b/libsrc/Wi/rdf_void.sql
index bcdb042..34f0204 100644
--- a/libsrc/Wi/rdf_void.sql
+++ b/libsrc/Wi/rdf_void.sql
@@ -1,5 +1,5 @@
 --
---  $Id: rdf_void.sql,v 1.10.2.6 2010/01/12 12:19:47 source Exp $
+--  $Id: rdf_void.sql,v 1.10.2.7 2010/11/17 21:29:42 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -246,7 +246,7 @@ create procedure RDF_VOID_GEN_1 (in graph varchar, in gr_name varchar := null,
     declare exit handler for sqlstate '*' { goto end1; };
      _cnt_subj := (select count(distinct S) from DB.DBA.RDF_QUAD where G = iri_to_id (graph));
      http (sprintf ('%s:DistinctSubjectsStat a scovo:Item ; \n rdf:value %d ; \n', ns_pref, _cnt_subj), ses);
-     http (sprintf (' scovo:dimension void:numOfTriples . \n'), ses);
+     http (sprintf (' scovo:dimension void:numberOfDistinctSubjects . \n'), ses);
     end1:;
   }
   if (details)
@@ -261,7 +261,7 @@ create procedure RDF_VOID_GEN_1 (in graph varchar, in gr_name varchar := null,
 	_cnt_obj  := (sparql define input:storage "" select count(distinct (?o)) where { graph `iri (?:graph)` { ?s ?p ?o . filter (isIRI (?o)) } });
       }
     http (sprintf ('%s:DistinctObjectsStat a scovo:Item ; \n rdf:value %d ; \n', ns_pref, _cnt_obj), ses);
-    http (sprintf (' scovo:dimension void:numOfTriples . \n'), ses);
+    http (sprintf (' scovo:dimension void:numberOfDistinctObjects . \n'), ses);
     end2:;
   }
 
diff --git a/libsrc/Wi/rdfbox.c b/libsrc/Wi/rdfbox.c
index 7c3a999..54be0f7 100644
--- a/libsrc/Wi/rdfbox.c
+++ b/libsrc/Wi/rdfbox.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: rdfbox.c,v 1.47.2.40 2010/06/01 15:26:39 source Exp $
+ *  $Id: rdfbox.c,v 1.47.2.52 2011/03/23 16:45:20 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -29,6 +29,10 @@
 #include "http.h" /* For DKS_ESC_XXX constants */
 #include "date.h" /* For DT_TYPE_DATE and the like */
 #include "security.h" /* For sec_check_dba() */
+#include "repl.h"	/* For repl_level_t in replsr.h */
+#include "replsr.h"	/* For log_repl_text_array() */
+#include "xslt_impl.h"	/* For vector_sort_t */
+#include "aqueue.h"	/* For aq_allocate() in rdf replication */
 
 void
 rb_complete_1 (rdf_box_t * rb, lock_trx_t * lt, void * /*actually query_instance_t * */ caller_qi_v, int is_local)
@@ -754,9 +758,13 @@ rb_serialize (caddr_t x, dk_session_t * ses)
       rb_ext_serialize (rb, ses);
       return;
     }
-  if  ((!unbox_inline (rb->rb_box) && !rb->rb_is_complete)
-       || ((rdf_no_string_inline || rb->rb_serialize_id_only)
-	   && ((DV_STRINGP (rb->rb_box) && !with_content))))
+  if  (!unbox_inline (rb->rb_box) && !rb->rb_is_complete)
+    {
+      rb_id_serialize (rb, ses);
+      return;
+    }
+  if  ((rdf_no_string_inline || rb->rb_serialize_id_only)
+    && ((DV_STRINGP (rb->rb_box) && !with_content)) )
     {
       rb_id_serialize (rb, ses);
       return;
@@ -1265,11 +1273,8 @@ rdf_box_hash (caddr_t box)
   rdf_box_audit (rb);
   if (0 != rb->rb_ro_id)
     return rb->rb_ro_id + (rb->rb_ro_id << 16);
-  if (rb->rb_is_complete && rb->rb_type >= RDF_BOX_DEFAULT_TYPE)
-    {
-      if ((RDF_BOX_DEFAULT_LANG == rb->rb_lang) && (RDF_BOX_DEFAULT_TYPE == rb->rb_type))
+  if (rb->rb_is_complete && (RDF_BOX_DEFAULT_LANG == rb->rb_lang) && (RDF_BOX_DEFAULT_TYPE == rb->rb_type))
         return box_hash (rb->rb_box);
-    }
   return rb->rb_lang * 17 + rb->rb_type * 13 + rb->rb_is_complete * 9 +
     (rb->rb_chksum_tail ?
       (box_hash (((rdf_bigbox_t *)rb)->rbb_chksum) + 113) :
@@ -1279,7 +1284,81 @@ rdf_box_hash (caddr_t box)
 int
 rdf_box_hash_cmp (ccaddr_t a1, ccaddr_t a2)
 {
-  return (DVC_MATCH == rdf_box_compare (a1, a2)) ? 1 : 0;
+  rdf_box_t * rb1 = (rdf_box_t *) a1;
+  rdf_box_t * rb2 = (rdf_box_t *) a2;
+  rdf_box_t tmp_rb2;
+  dtp_t dtp1 = DV_TYPE_OF (rb1), dtp2 = DV_TYPE_OF (rb2);
+  dtp_t data_dtp1, data_dtp2;
+  int len1, len2, cmp_len, cmp_headlen, mcmp;
+  caddr_t data1 = NULL, data2 = NULL;
+  /* arrange so that if both are not rdf boxes, the one that is a box is first */
+  if (DV_RDF != dtp1)
+    {
+      if (DV_RDF != dtp2)
+        GPF_T1 ("misused rdf_box_hash_cmp()");
+      return rdf_box_hash_cmp (a2, a1);
+    }
+  if (DV_RDF == dtp2)
+    {
+      if ((0 != rb1->rb_ro_id) && (0 != rb2->rb_ro_id))
+        return (rb1->rb_ro_id == rb2->rb_ro_id) ? 1 : 0;
+      else if ((0 != rb1->rb_ro_id) || (0 != rb2->rb_ro_id))
+        return 0;
+      if ((rb1->rb_lang != rb2->rb_lang) || (rb1->rb_type != rb2->rb_type) || (rb1->rb_is_complete != rb2->rb_is_complete) || (rb1->rb_chksum_tail != rb2->rb_chksum_tail))
+        return 0;
+      if (rb1->rb_is_complete && (RDF_BOX_DEFAULT_LANG == rb1->rb_lang) && (RDF_BOX_DEFAULT_TYPE == rb1->rb_type)
+        && rb2->rb_is_complete && (RDF_BOX_DEFAULT_LANG == rb2->rb_lang) && (RDF_BOX_DEFAULT_TYPE == rb2->rb_type) )
+        return box_equal (rb1->rb_box, rb2->rb_box);
+      if (rb1->rb_chksum_tail)
+        return box_equal (((rdf_bigbox_t *)rb1)->rbb_chksum, ((rdf_bigbox_t *)rb2)->rbb_chksum);
+      return box_equal (rb1->rb_box, rb2->rb_box);
+    }
+  if ((0 == rb1->rb_ro_id) && rb1->rb_is_complete && (RDF_BOX_DEFAULT_LANG == rb1->rb_lang) && (RDF_BOX_DEFAULT_TYPE == rb1->rb_type))
+    return box_equal (rb1->rb_box, a2);
+  return 0;
+}
+
+void
+rb_cast_to_xpath_safe (query_instance_t *qi, caddr_t new_val, caddr_t *retval_ptr)
+{
+  switch (DV_TYPE_OF (new_val))
+    {
+    case DV_DB_NULL:
+      new_val = NULL;
+      goto xb_set_new_val; /* see below */
+    case DV_IRI_ID:
+      dk_free_tree (retval_ptr[0]);
+      retval_ptr[0] = NULL;
+      retval_ptr[0] = key_id_to_iri (qi, ((iri_id_t*)new_val)[0]);
+      return;
+    case DV_RDF:
+      {
+        rdf_box_t *rb = (rdf_box_t *)new_val;
+        if (!rb->rb_is_complete)
+          rb_complete (rb, qi->qi_trx, qi);
+/*
+        if ((RDF_BOX_DEFAULT_TYPE == rb->rb_type) && (RDF_BOX_DEFAULT_LANG == rb->rb_lang))
+          new_val = rb->rb_box;
+*/
+        break;
+      }
+    default:
+      if (NULL == new_val)
+        {
+          if ((DV_LONG_INT != DV_TYPE_OF (retval_ptr[0])) || (0 != unbox (retval_ptr[0])) || (NULL == retval_ptr[0]))
+            {
+              dk_free_tree (retval_ptr[0]);
+              retval_ptr[0] = box_num_nonull (0);
+              return;
+            }
+        }
+    }
+xb_set_new_val:
+   if (new_val != retval_ptr[0])
+     {
+       dk_free_tree (retval_ptr[0]);
+       retval_ptr[0] = box_copy_tree (new_val);
+     }
 }
 
 caddr_t
@@ -1366,7 +1445,7 @@ caddr_t
 bif_rdf_strsqlval (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   caddr_t res, val = bif_arg (qst, args, 0, "__rdf_strsqlval");
-  int set_bf_iri = ((1 < BOX_ELEMENTS (args)) ? bif_long_arg (qst, args, 1, "__rdf_strsqlval") : 1);
+  int set_bf_iri = ((1 < BOX_ELEMENTS (args)) ? bif_long_arg (qst, args, 1, "__rdf_strsqlval") : 0x1);
   dtp_t val_dtp = DV_TYPE_OF (val);
   query_instance_t * qi = (query_instance_t *) qst;
   if (DV_RDF == val_dtp)
@@ -1403,7 +1482,9 @@ bif_rdf_strsqlval (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
         }
       case DV_STRING:
         res = box_copy (val);
-        if (!((box_flags (res) & BF_IRI) && set_bf_iri))
+        if ((set_bf_iri && (box_flags (res) & BF_IRI)) || (set_bf_iri & 0x2))
+          box_flags(res) = BF_IRI;
+        else
           box_flags(res) = BF_UTF8;
         return res;
       case DV_UNAME:
@@ -1414,7 +1495,7 @@ bif_rdf_strsqlval (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
         return NEW_DB_NULL;
       default:
         res = box_cast_to_UTF8 (qst, val);
-        box_flags(res) = BF_UTF8;
+        box_flags (res) = ((set_bf_iri & 0x2) ? BF_IRI : BF_UTF8);
         return res;
     }
 }
@@ -1424,7 +1505,7 @@ bif_rdf_long_to_ttl (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   caddr_t val = bif_arg (qst, args, 0, "__rdf_long_to_ttl");
   dk_session_t *out = http_session_no_catch_arg (qst, args, 1, "__rdf_long_to_ttl");
-  query_instance_t *qi = (query_instance_t *)qi;
+  query_instance_t *qi = (query_instance_t *)qst;
   dtp_t val_dtp = DV_TYPE_OF (val);
   char temp[256];
   if (DV_RDF == val_dtp)
@@ -1692,7 +1773,7 @@ iri_cast_and_split_ttl_qname (query_instance_t *qi, caddr_t iri, caddr_t *ns_pre
             int local_len = strlen (local);
             for (tail = local + local_len; tail > local; tail--)
               {
-                char c = tail[-1];
+                unsigned char c = (unsigned char) tail[-1];
                 if (!isalnum(c) && ('_' != c) && ('-' != c) && !(c & 0x80))
                   break;
               }
@@ -1779,29 +1860,32 @@ bif_http_sys_find_best_sparql_accept (caddr_t * qst, caddr_t * err_ret, state_sl
     {
       int ctr;
       caddr_t *tmp;
-      tmp = (caddr_t *)list (22*2,
-        "text/rdf+n3"				, "TTL"		,
-        "text/rdf+ttl"				, "TTL"		,
-        "text/rdf+turtle"			, "TTL"		,
-        "text/turtle"				, "TTL"		,
-        "text/n3"				, "TTL"		,
-        "application/turtle"			, "TTL"		,
-        "application/x-turtle"			, "TTL"		,
-        "application/sparql-results+json"	, "JSON;RES"	,
-        "application/json"			, "JSON"	,
-        "application/soap+xml"			, "SOAP"	,
-        "application/soap+xml;11"		, "SOAP"	,
-        "application/sparql-results+xml"	, "XML"		,
-        "text/html"				, "HTML"	,
-        "application/vnd.ms-excel"		, "HTML"	,
-        "application/javascript"		, "JS"		,
-        "application/rdf+json"			, "JSON;TALIS"	,
-        "application/x-rdf+json"		, "JSON;TALIS"	,
-        "application/rdf+xml"			, "RDFXML"	,
-        "application/atom+xml"			, "ATOM;XML"	,
-        "application/odata+json"		, "JSON;ODATA"	,
-	"text/rdf+nt"				, "NT"		,
-        "text/plain"				, "NT"	/* Increase count in this list() call when add more MIME types! */ );
+      tmp = (caddr_t *)list (25*2,
+        "text/rdf+n3"				, "TTL"		, /*  0 */
+        "text/rdf+ttl"				, "TTL"		, /*  1 */
+        "text/rdf+turtle"			, "TTL"		, /*  2 */
+        "text/turtle"				, "TTL"		, /*  3 */
+        "text/n3"				, "TTL"		, /*  4 */
+        "application/turtle"			, "TTL"		, /*  5 */
+        "application/x-turtle"			, "TTL"		, /*  6 */
+        "application/sparql-results+json"	, "JSON;RES"	, /*  7 */
+        "application/json"			, "JSON"	, /*  8 */
+        "application/soap+xml"			, "SOAP"	, /*  9 */
+        "application/soap+xml;11"		, "SOAP"	, /* 10 */
+        "application/sparql-results+xml"	, "XML"		, /* 11 */
+        "text/html"				, "HTML"	, /* 12 */
+        "application/vnd.ms-excel"		, "HTML"	, /* 13 */
+        "application/javascript"		, "JS"		, /* 14 */
+        "application/rdf+json"			, "JSON;TALIS"	, /* 15 */
+        "application/x-rdf+json"		, "JSON;TALIS"	, /* 16 */
+        "application/rdf+xml"			, "RDFXML"	, /* 17 */
+        "application/atom+xml"			, "ATOM;XML"	, /* 18 */
+        "application/odata+json"		, "JSON;ODATA"	, /* 19 */
+        "text/rdf+nt"				, "NT"		, /* 20 */
+        "text/plain"				, "NT"		, /* 21 */
+        "text/cxml+qrcode"			, "CXML"	, /* 22 */
+        "text/cxml"				, "CXML"	, /* 23 */
+        "text/csv"				, "CSV" /* 24 Increase count in this list() call when add more MIME types! */ );
       for (ctr = BOX_ELEMENTS (tmp); ctr--; /* no step */)
         tmp[ctr] = box_dv_short_string (tmp[ctr]);
       supp_rset = tmp;
@@ -1810,30 +1894,33 @@ bif_http_sys_find_best_sparql_accept (caddr_t * qst, caddr_t * err_ret, state_sl
     {
       int ctr;
       caddr_t *tmp;
-      tmp = (caddr_t *)list (22*2,
-        "text/rdf+n3"				, "TTL"		,
-        "text/rdf+ttl"				, "TTL"		,
-        "text/rdf+turtle"			, "TTL"		,
-        "text/turtle"				, "TTL"		,
-        "text/n3"				, "TTL"		,
-        "application/turtle"			, "TTL"		,
-        "application/x-turtle"			, "TTL"		,
-        "application/json"			, "JSON"	,
-        "application/rdf+json"			, "JSON;TALIS"	,
-        "application/x-rdf+json"		, "JSON;TALIS"	,
-        "application/soap+xml"			, "SOAP"	,
-        "application/soap+xml;11"		, "SOAP"	,
-        "application/rdf+xml"			, "RDFXML"	,
-        "text/rdf+nt"				, "NT"		,
-        "application/xhtml+xml"			, "RDFA;XHTML"	,
-        "text/plain"				, "NT"		,
-        "application/sparql-results+json"	, "JSON;RES"	,
-        "text/html"				, "HTML"	,
-        "application/vnd.ms-excel"		, "HTML"	,
-        "application/javascript"		, "JS"		,
-        "application/atom+xml"			, "ATOM;XML"	,
-        "application/odata+json"		, "JSON;ODATA"	,
-        "application/sparql-results+xml"	, "XML"		/* Increase count in this list() call when add more MIME types! */ );
+      tmp = (caddr_t *)list (26*2,
+        "text/rdf+n3"				, "TTL"		, /*  0 */
+        "text/rdf+ttl"				, "TTL"		, /*  1 */
+        "text/rdf+turtle"			, "TTL"		, /*  2 */
+        "text/turtle"				, "TTL"		, /*  3 */
+        "text/n3"				, "TTL"		, /*  4 */
+        "application/turtle"			, "TTL"		, /*  5 */
+        "application/x-turtle"			, "TTL"		, /*  6 */
+        "application/json"			, "JSON"	, /*  7 */
+        "application/rdf+json"			, "JSON;TALIS"	, /*  8 */
+        "application/x-rdf+json"		, "JSON;TALIS"	, /*  9 */
+        "application/soap+xml"			, "SOAP"	, /* 10 */
+        "application/soap+xml;11"		, "SOAP"	, /* 11 */
+        "application/rdf+xml"			, "RDFXML"	, /* 12 */
+        "text/rdf+nt"				, "NT"		, /* 13 */
+        "application/xhtml+xml"			, "RDFA;XHTML"	, /* 14 */
+        "text/plain"				, "NT"		, /* 15 */
+        "application/sparql-results+json"	, "JSON;RES"	, /* 16 */
+        "text/html"				, "HTML"	, /* 17 */
+        "application/vnd.ms-excel"		, "HTML"	, /* 18 */
+        "application/javascript"		, "JS"		, /* 19 */
+        "application/atom+xml"			, "ATOM;XML"	, /* 20 */
+        "application/odata+json"		, "JSON;ODATA"	, /* 21 */
+        "application/sparql-results+xml"	, "XML"		, /* 22 */
+        "text/cxml+qrcode"			, "CXML;QRCODE"	, /* 23 */
+        "text/cxml"				, "CXML"	, /* 24 */
+        "text/csv"				, "CSV" /* 25 Increase count in this list() call when add more MIME types! */ );
       for (ctr = BOX_ELEMENTS (tmp); ctr--; /* no step */)
         tmp[ctr] = box_dv_short_string (tmp[ctr]);
       supp_dict = tmp;
@@ -2260,9 +2347,8 @@ typedef struct nt_env_s {
 } nt_env_t;
 
 void
-nt_http_write_ref (dk_session_t *ses, nt_env_t *env, ttl_iriref_t *ti, caddr_t dflt_uri)
+nt_http_write_ref_1 (dk_session_t *ses, nt_env_t *env, ttl_iriref_t *ti, caddr_t dflt_uri, int esc)
 {
-  caddr_t full_uri;
   caddr_t uri = ti->uri;
   if (NULL == uri)
     uri = dflt_uri;
@@ -2275,13 +2361,25 @@ nt_http_write_ref (dk_session_t *ses, nt_env_t *env, ttl_iriref_t *ti, caddr_t d
   if (NULL != ti->prefix)
     GPF_T;
 #endif
+  if (esc)
+    SES_PRINT (ses, "<");
+  else
   session_buffered_write_char ('<', ses);
   dks_esc_write (ses, uri, box_length (uri) - 1, CHARSET_UTF8, CHARSET_UTF8, DKS_ESC_TTL_IRI);
+  if (esc)
+    SES_PRINT (ses, ">");
+  else
   session_buffered_write_char ('>', ses);
 }
 
+void
+nt_http_write_ref (dk_session_t *ses, nt_env_t *env, ttl_iriref_t *ti, caddr_t dflt_uri)
+{
+  nt_http_write_ref_1 (ses, env, ti, dflt_uri, 0);
+}
+
 static void
-http_nt_write_obj (dk_session_t *ses, nt_env_t *env, query_instance_t *qi, caddr_t obj, dtp_t obj_dtp, ttl_iriref_t *dt_ptr)
+http_nt_write_obj (dk_session_t *ses, nt_env_t *env, query_instance_t *qi, caddr_t obj, dtp_t obj_dtp, ttl_iriref_t *dt_ptr, int esc_mode)
 {
   caddr_t obj_box_value;
   dtp_t obj_box_value_dtp;
@@ -2304,7 +2402,7 @@ http_nt_write_obj (dk_session_t *ses, nt_env_t *env, query_instance_t *qi, caddr
         session_buffered_write_char ('"', ses);
         session_buffered_write (ses, temp, strlen (temp));
         session_buffered_write_char ('"', ses);
-        if (DV_RDF != obj_box_value_dtp)
+        if (DV_RDF != obj_dtp)
           {
             session_buffered_write (ses, "^^", 2);
             nt_http_write_ref (ses, env, dt_ptr, NULL);
@@ -2313,7 +2411,7 @@ http_nt_write_obj (dk_session_t *ses, nt_env_t *env, query_instance_t *qi, caddr
       }
     case DV_STRING:
       session_buffered_write_char ('"', ses);
-      dks_esc_write (ses, obj_box_value, box_length (obj_box_value) - 1, CHARSET_UTF8, CHARSET_UTF8, DKS_ESC_TTL_DQ);
+      dks_esc_write (ses, obj_box_value, box_length (obj_box_value) - 1, CHARSET_UTF8, CHARSET_UTF8, esc_mode);
       session_buffered_write_char ('"', ses);
       break;
     case DV_XML_ENTITY:
@@ -2327,7 +2425,7 @@ http_nt_write_obj (dk_session_t *ses, nt_env_t *env, query_instance_t *qi, caddr
       break;
     case DV_STRING_SESSION:
       session_buffered_write_char ('"', ses);
-      dks_esc_write (ses, obj_box_value, box_length (obj_box_value) - 1, CHARSET_UTF8, CHARSET_UTF8, DKS_ESC_TTL_DQ);
+      dks_esc_write (ses, obj_box_value, box_length (obj_box_value) - 1, CHARSET_UTF8, CHARSET_UTF8, esc_mode);
       session_buffered_write_char ('"', ses);
       break;
     default:
@@ -2342,8 +2440,15 @@ http_nt_write_obj (dk_session_t *ses, nt_env_t *env, query_instance_t *qi, caddr
           {
             if (!IS_BOX_POINTER (iri))
               sqlr_new_error ("22023", "SR624", "Unsupported datatype %d in NT serialization of an object", obj_dtp);
-            SES_PRINT (ses, "^^<");
+            SES_PRINT (ses, "^^");
+	    if (esc_mode == DKS_ESC_PTEXT)
+	      SES_PRINT (ses, "<");
+	    else
+	      session_buffered_write_char ('<', ses);
             dks_esc_write (ses, iri, box_length_inline (iri)-1, CHARSET_UTF8, CHARSET_UTF8, DKS_ESC_TTL_IRI);
+	    if (esc_mode == DKS_ESC_PTEXT)
+	      SES_PRINT (ses, ">");
+	    else
             session_buffered_write_char ('>', ses);
           }
         break;
@@ -2364,7 +2469,7 @@ http_nt_write_obj (dk_session_t *ses, nt_env_t *env, query_instance_t *qi, caddr
       if (RDF_BOX_DEFAULT_TYPE != rb->rb_type)
         {
           session_buffered_write (ses, "^^", 2);
-          nt_http_write_ref (ses, env, dt_ptr, NULL);
+          nt_http_write_ref_1 (ses, env, dt_ptr, NULL, esc_mode == DKS_ESC_PTEXT);
         }
     }
 }
@@ -2413,7 +2518,7 @@ bif_http_nt_triple (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   if (obj_is_iri)
     nt_http_write_ref (ses, env, &(tii.o), obj);
   else
-    http_nt_write_obj (ses, env, qi, obj, obj_dtp, &tii.dt);
+    http_nt_write_obj (ses, env, qi, obj, obj_dtp, &tii.dt, DKS_ESC_TTL_DQ);
   SES_PRINT (ses, " .\n");
 fail:
   dk_free_box (tii.s.uri);
@@ -2429,7 +2534,7 @@ bif_http_nt_object (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   query_instance_t *qi = (query_instance_t *)qst;
   nt_env_t env;
   caddr_t obj = bif_arg (qst, args, 0, "http_nt_object");
-  dk_session_t *ses = http_session_no_catch_arg (qst, args, 1, "http_ttl_triple");
+  dk_session_t *ses = http_session_no_catch_arg (qst, args, 1, "http_nt_object");
   int status = 0;
   int obj_is_iri = 0;
   dtp_t obj_dtp = 0;
@@ -2455,7 +2560,47 @@ bif_http_nt_object (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   if (obj_is_iri)
     nt_http_write_ref (ses, &env, &(tii.o), obj);
   else
-    http_nt_write_obj (ses, &env, qi, obj, obj_dtp, &tii.dt);
+    http_nt_write_obj (ses, &env, qi, obj, obj_dtp, &tii.dt, DKS_ESC_TTL_DQ);
+fail:
+  dk_free_box (tii.o.uri);
+  dk_free_box (tii.dt.uri);
+  return (caddr_t)(ptrlong)(status);
+}
+
+caddr_t
+bif_http_rdf_object (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  query_instance_t *qi = (query_instance_t *)qst;
+  nt_env_t env;
+  caddr_t obj = bif_arg (qst, args, 0, "http_rdf_object");
+  dk_session_t *ses = http_session_no_catch_arg (qst, args, 1, "http_rdf_object");
+  int esc_mode = BOX_ELEMENTS (args) > 2 ? bif_long_arg (qst, args, 2, "http_rdf_object") : DKS_ESC_PTEXT;
+  int status = 0;
+  int obj_is_iri = 0;
+  dtp_t obj_dtp = 0;
+  ttl_iriref_items_t tii;
+  memset (&tii,0, sizeof (ttl_iriref_items_t));
+  env.ne_out_ses = ses;
+  obj_dtp = DV_TYPE_OF (obj);
+  switch (obj_dtp)
+    {
+    case DV_UNAME: case DV_IRI_ID: case DV_IRI_ID_8: obj_is_iri = 1; break;
+    case DV_STRING: obj_is_iri = (BF_IRI & box_flags (obj)) ? 1 : 0; break;
+    default: obj_is_iri = 0; break;
+    }
+  if (obj_is_iri)
+    {
+      if (!iri_cast_nt_absname (qi, obj, &tii.o.uri, &tii.o.is_bnode))
+        goto fail; /* see below */
+    }
+  else
+    {
+      http_ttl_or_nt_prepare_obj (qi, obj, obj_dtp, &tii.dt);
+    }
+  if (obj_is_iri)
+    nt_http_write_ref (ses, &env, &(tii.o), obj);
+  else
+    http_nt_write_obj (ses, &env, qi, obj, obj_dtp, &tii.dt, esc_mode);
 fail:
   dk_free_box (tii.o.uri);
   dk_free_box (tii.dt.uri);
@@ -2881,7 +3026,7 @@ bif_sparql_rset_nt_write_row (caddr_t * qst, caddr_t * err_ret, state_slot_t **
       if (col_ti->is_iri)
         nt_http_write_ref (ses, env, col_ti, obj);
       else
-        http_nt_write_obj (ses, env, qi, obj, obj_dtp, col_ti);
+        http_nt_write_obj (ses, env, qi, obj, obj_dtp, col_ti, DKS_ESC_TTL_DQ);
       SES_PRINT (ses, " .\n");
       dk_free_box (col_ti->uri); col_ti->uri = NULL;
     }
@@ -3049,7 +3194,7 @@ sparql_rset_xml_write_row_impl (query_instance_t *qi, dk_session_t *ses, caddr_t
                     goto literal_elt_printed; /* see below */
                   }
                 else
-                  SES_PRINT (ses, "<!-- bad datatype ID -->");
+                  SES_PRINT (ses, "<literal><!-- bad datatype ID -->");
               }
             else if (RDF_BOX_DEFAULT_LANG != rb->rb_lang)
               {
@@ -3062,7 +3207,7 @@ sparql_rset_xml_write_row_impl (query_instance_t *qi, dk_session_t *ses, caddr_t
                     goto literal_elt_printed; /* see below */
                   }
                 else
-                  SES_PRINT (ses, "<!-- bad language ID -->");
+                  SES_PRINT (ses, "<literal><!-- bad language ID -->");
               }
             else
               SES_PRINT (ses, "<literal>");
@@ -3185,7 +3330,7 @@ bif_sparql_iri_split_rdfa_qname (caddr_t * qst, caddr_t * err_ret, state_slot_t
   iri_strlen = strlen (iri);
   for (tail = iri + iri_strlen; tail > iri; tail--)
     {
-      char c = tail[-1];
+      unsigned char c = (unsigned char) tail[-1];
       if (!isalnum(c) && ('_' != c) && ('-' != c) && !(c & 0x80))
         break;
     }
@@ -3604,6 +3749,212 @@ bif_rgs_ack_cbk (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return bif_rgs_impl (qst, err_ret, args, fname, RGU_ACK, 1);
 }
 
+caddr_t
+bif_rdf_graph_is_in_enabled_repl (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+    return box_num (0);
+}
+
+#define RDF_REPL_QUAD_INS_PLAIN_LIT	80
+#define RDF_REPL_QUAD_INS_DT_LIT	81
+#define RDF_REPL_QUAD_INS_LANG_LIT	82
+#define RDF_REPL_QUAD_INS_AUTO_LIT	83
+#define RDF_REPL_QUAD_INS_REF		84
+#define RDF_REPL_QUAD_INS_GEO		85
+#define RDF_REPL_QUAD_INS_MAX_OP	85
+#define RDF_REPL_QUAD_HASH_MASK		0xF
+
+#define RDF_REPL_QUAD_DEL_PLAIN_LIT	160
+#define RDF_REPL_QUAD_DEL_DT_LIT	161
+#define RDF_REPL_QUAD_DEL_LANG_LIT	162
+#define RDF_REPL_QUAD_DEL_AUTO_LIT	163
+#define RDF_REPL_QUAD_DEL_REF		164
+
+#define RDF_REPL_BATCH_SIZE		10000
+
+id_hash_t *repl_items_to_del = NULL;
+id_hash_t *repl_items_to_ins = NULL;
+
+int
+rdf_repl_vector_sort_cmp (caddr_t * e1, caddr_t * e2, vector_sort_t * specs)
+{
+  caddr_t *rquad1 = (caddr_t *)(e1[0]);
+  caddr_t *rquad2 = (caddr_t *)(e2[0]);
+  dtp_t dtp1;
+  int cmp;
+  cmp = strcmp (rquad1[1], rquad2[1]);
+  if (cmp > 0) return DVC_GREATER;
+  else if (cmp < 0) return DVC_LESS;
+  cmp = strcmp (rquad1[2], rquad2[2]);
+  if (cmp > 0) return DVC_GREATER;
+  else if (cmp < 0) return DVC_LESS;
+  dtp1 = DV_TYPE_OF (rquad1[3]);
+  cmp = (int)(dtp1) - (int)(DV_TYPE_OF (rquad2[3]));
+  if (cmp > 0) return DVC_GREATER;
+  else if (cmp < 0) return DVC_LESS;
+  if (DV_STRING == dtp1)
+    {
+      cmp = strcmp (rquad1[3], rquad2[3]);
+      if (cmp > 0) return DVC_GREATER;
+      else if (cmp < 0) return DVC_LESS;
+    }
+  return DVC_MATCH;
+}
+
+caddr_t **
+rdf_repl_hash_to_sorted_vector (id_hash_t *ht)
+{
+  id_hash_iterator_t hit;
+  int quad_count = ht->ht_count;
+  caddr_t **quad_ptr, *val_stub_ptr;
+  caddr_t **res = (caddr_t **) dk_alloc_box (quad_count * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
+  caddr_t **tail = res;
+  vector_sort_t specs;
+  id_hash_iterator (&hit, ht);
+  while (hit_next (&hit, (char **)&quad_ptr, (char **)&val_stub_ptr))
+    {
+      (tail++)[0] = quad_ptr[0];
+    }
+  specs.vs_block_elts = 1;
+  specs.vs_key_ofs = 0;
+  specs.vs_sort_asc = 1;
+  specs.vs_cmp_fn = rdf_repl_vector_sort_cmp;
+  vector_qsort ((caddr_t *)res, quad_count, &specs);
+  dk_check_tree (res);
+  id_hash_clear (ht);
+  return res;
+}
+
+void
+rdf_repl_feed_batch_of_rquads (query_instance_t *qi, caddr_t **rquads_vector, ccaddr_t *cbk_names, caddr_t *app_env)
+{
+  static int fake_lineno = 0;
+  triple_feed_t *tf;
+  int rquads_count = BOX_ELEMENTS (rquads_vector);
+  int rquad_ctr;
+  query_t *geo_qr = NULL;
+  caddr_t prev_graph = "";
+  if (0 == rquads_count)
+    return; /* no data -- nothing to feed */
+  tf = tf_alloc ();
+  tf->tf_qi = qi;
+  tf->tf_default_graph_uri = NULL;
+  tf->tf_current_graph_uri = NULL;
+  tf->tf_app_env = app_env;
+  tf->tf_creator = "__rdf_repl_action";
+  tf->tf_input_name = NEW_DB_NULL;
+  tf->tf_line_no_ptr = &fake_lineno;
+  tf_set_cbk_names (tf, cbk_names);
+  DO_BOX_FAST (caddr_t *, rquad, rquad_ctr, rquads_vector)
+    {
+      int opcode = (ptrlong)(rquad[0]);
+      caddr_t g = rquad[1];
+      caddr_t s = rquad[2];
+      caddr_t p = rquad[3];
+      caddr_t oval = rquad[4];
+      if (strcmp (g, prev_graph))
+        {
+          if (NULL != tf->tf_current_graph_uri)
+            tf_commit (tf);
+          tf->tf_current_graph_uri = g;
+          if (TF_ONE_GRAPH_AT_TIME(tf))
+            {
+              dk_free_tree ((tf)->tf_current_graph_iid);
+              tf->tf_current_graph_iid = NULL; /* to avoid double free in case of error in tf_get_iid() below */
+              tf->tf_current_graph_iid = tf_get_iid ((tf), (tf)->tf_current_graph_uri);
+              tf_new_graph (tf, tf->tf_current_graph_uri);
+            }
+          prev_graph = g;
+        }
+      switch (opcode)
+        {
+        case RDF_REPL_QUAD_INS_PLAIN_LIT & RDF_REPL_QUAD_HASH_MASK:
+          tf_triple_l (tf, s, p, oval, NULL, NULL);
+          break;
+        case RDF_REPL_QUAD_INS_DT_LIT & RDF_REPL_QUAD_HASH_MASK:
+          tf_triple_l (tf, s, p, oval, rquad[5], NULL);
+          break;
+        case RDF_REPL_QUAD_INS_LANG_LIT & RDF_REPL_QUAD_HASH_MASK:
+          tf_triple_l (tf, s, p, oval, NULL, rquad[5]);
+          break;
+        case RDF_REPL_QUAD_INS_REF & RDF_REPL_QUAD_HASH_MASK:
+          tf_triple (tf, s, p, oval);
+	  break;
+        case RDF_REPL_QUAD_INS_GEO & RDF_REPL_QUAD_HASH_MASK:
+          {
+            caddr_t err = NULL;
+            char params_buf [BOX_AUTO_OVERHEAD + sizeof (caddr_t) * 4];
+            void **params;
+            static const char *geo_qr_text = "insert soft DB.DBA.RDF_QUAD (G,S,P,O) \
+ values (iri_to_id_repl (?), iri_to_id_repl (?), iri_to_id (\'http://www.w3.org/2003/01/geo/wgs84_pos#geometry\'), \
+ rdf_geo_add (rdf_box (st_point (?, ?), 256, 257, 0, 1)))";
+            if (NULL == geo_qr)
+              {
+                geo_qr = sql_compile (geo_qr_text, qi->qi_client, &err, SQLC_DEFAULT);
+                if (NULL != err)
+                  GPF_T1 ("rdf_repl_feed_batch_of_rquads() failed to compile geo qr");
+              }
+            BOX_AUTO_TYPED (void **, params, params_buf, sizeof (caddr_t) * 4, DV_ARRAY_OF_POINTER);
+            params[0] = box_copy_tree(g);
+            params[1] = box_copy_tree(s);
+            params[2] = box_copy_tree(rquad[3]);
+            params[3] = box_copy_tree(rquad[4]);
+            err = qr_exec (qi->qi_client, geo_qr, qi, NULL, NULL, NULL, (caddr_t *)params, NULL, 0);
+            BOX_DONE (params, params_buf);
+            break;
+          }
+        }
+      dk_check_tree (rquad);
+    }
+  END_DO_BOX_FAST;
+  tf_commit (tf);
+  tf->tf_current_graph_uri = NULL; /* To not free it twice (there's no box_copy_tree from rquad[1] to it, just copying the pointer) */
+  dk_free_box ((caddr_t) tf->tf_input_name);
+  tf_free (tf);
+  dk_free_tree (rquads_vector);
+}
+
+
+caddr_t
+iri_canonicalize_and_cast_to_repl (query_instance_t *qi, caddr_t arg, caddr_t *err_ret)
+{
+  caddr_t res = NULL;
+  int status;
+  if (DV_IRI_ID == DV_TYPE_OF (arg))
+    {
+      iri_id_t arg_iidt = unbox_iri_id (arg);
+      if (arg_iidt >= min_bnode_iri_id())
+        return arg;
+      return key_id_to_canonicalized_iri (qi, arg_iidt);
+    }
+  status = iri_canonicalize (qi, arg, IRI_TO_ID_IF_CACHED, &res, err_ret);
+  if (0 == status)
+    err_ret[0] = srv_make_new_error ("22023", "SRxxx", "Can not cast IRI in RDF replication");
+  return res;
+}
+
+static caddr_t repl_pub_name;
+static caddr_t text5arg;
+static caddr_t text6arg;
+
+caddr_t
+bif_rdf_repl_quad (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  return 0;
+}
+
+caddr_t
+bif_rdf_repl_action (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  return NULL;
+}
+
+caddr_t
+bif_rdf_repl_flush_queue (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  return NULL;
+}
+
 static int
 rdf_single_check (query_instance_t *qi, caddr_t start_box_arg, boxint ro_id, rdf_box_t **complete_rb_ptr, long opcode, caddr_t opval)
 {
@@ -3822,7 +4173,7 @@ extern box_tmp_copy_f box_tmp_copier[256];
 void
 rdf_box_init ()
 {
-  dk_mem_hooks (DV_RDF, (box_copy_f) rb_copy, (box_destr_f)rb_free, 0);
+  dk_mem_hooks (DV_RDF, (box_copy_f) rb_copy, (box_destr_f)rb_free, 1);
   box_tmp_copier[DV_RDF] = (box_tmp_copy_f) rb_tmp_copy;
   PrpcSetWriter (DV_RDF, (ses_write_func) rb_serialize);
   dk_dtp_register_hash (DV_RDF, rdf_box_hash, rdf_box_hash_cmp);
@@ -3883,7 +4234,9 @@ rdf_box_init ()
   bif_define ("http_talis_json_triple", bif_http_talis_json_triple);
   bif_set_uses_index (bif_http_talis_json_triple);
   bif_define ("http_nt_object", bif_http_nt_object);
-  bif_set_uses_index (bif_http_nt_triple);
+  bif_set_uses_index (bif_http_nt_object);
+  bif_define ("http_rdf_object", bif_http_rdf_object);
+  bif_set_uses_index (bif_http_rdf_object);
   bif_define ("sparql_rset_ttl_write_row", bif_sparql_rset_ttl_write_row);
   bif_set_uses_index (bif_sparql_rset_ttl_write_row);
   bif_define ("sparql_rset_nt_write_row", bif_sparql_rset_nt_write_row);
@@ -3910,6 +4263,16 @@ rdf_box_init ()
   bif_define ("__rgs_ack", bif_rgs_ack);
   bif_define ("__rgs_ack_cbk", bif_rgs_ack_cbk);
   bif_set_uses_index (bif_rgs_ack_cbk );
+  repl_pub_name = box_dv_short_string ("__rdf_repl");
+  text5arg = box_dv_short_string ("__rdf_repl_action (?, ?, ?, ?, ?)");
+  text6arg = box_dv_short_string ("__rdf_repl_action (?, ?, ?, ?, ?, ?)");
+  bif_define ("__rdf_graph_is_in_enabled_repl", bif_rdf_graph_is_in_enabled_repl);
+  bif_set_uses_index (bif_rdf_graph_is_in_enabled_repl);
+  bif_define ("__rdf_repl_quad", bif_rdf_repl_quad);
+  bif_define ("__rdf_repl_action", bif_rdf_repl_action);
+  bif_set_uses_index (bif_rdf_repl_action);
+  bif_define ("__rdf_repl_flush_queue", bif_rdf_repl_flush_queue);
+  bif_set_uses_index (bif_rdf_repl_flush_queue);
   bif_define ("__rdf_range_check", bif_rdf_range_check);
   bif_set_uses_index (bif_rdf_range_check );
 }
diff --git a/libsrc/Wi/rdfinf.c b/libsrc/Wi/rdfinf.c
index 9cac8f9..e1ff9c7 100644
--- a/libsrc/Wi/rdfinf.c
+++ b/libsrc/Wi/rdfinf.c
@@ -1,7 +1,7 @@
 /*
  *  rdfinf.c
  *
- *  $Id: rdfinf.c,v 1.19.2.18 2010/06/25 16:39:58 source Exp $
+ *  $Id: rdfinf.c,v 1.19.2.28 2011/03/25 12:20:03 source Exp $
  *
  *  RDF Inference
  *
@@ -235,9 +235,9 @@ ri_list (rdf_inf_pre_node_t * ri, caddr_t iri, rdf_sub_t ** sub_ret)
     {
       switch (ri->ri_mode)
 	{
-	case RI_SUBCLASS: return sub->rs_sub;
+	  case RI_SUBCLASS: return sub->rs_sub ? sub->rs_sub : sub->rs_equiv;
 	case RI_SUPERCLASS: return sub->rs_super;
-	case RI_SUBPROPERTY: return sub->rs_sub;
+	  case RI_SUBPROPERTY: return sub->rs_sub ? sub->rs_sub : sub->rs_equiv;
 	case RI_SUPERPROPERTY: return sub->rs_super;
 	}
     }
@@ -361,6 +361,12 @@ query_t * tn_ifp_no_graph_qr;
 query_t * tn_ifp_dist_qr;
 query_t * tn_ifp_dist_no_graph_qr;
 
+id_hash_t * sas_tn_ht;
+id_hash_t * sas_tn_no_graph_ht;
+id_hash_t * tn_ifp_ht;
+id_hash_t * tn_ifp_no_graph_ht;
+dk_mutex_t * tn_cache_mtx;
+
 void
 sas_ensure ()
 {
@@ -375,9 +381,24 @@ sas_ensure ()
       tn_ifp_no_graph_qr = sql_compile (tn_ifp_no_graph_text, bootstrap_cli, &err, SQLC_DEFAULT);
       tn_ifp_dist_qr = sql_compile (tn_ifp_dist_text, bootstrap_cli, &err, SQLC_DEFAULT);
       tn_ifp_dist_no_graph_qr = sql_compile (tn_ifp_dist_no_graph_text, bootstrap_cli, &err, SQLC_DEFAULT);
+
+      sas_tn_ht = id_hash_allocate (31, sizeof (caddr_t), sizeof (caddr_t), treehash, treehashcmp);
+      sas_tn_no_graph_ht = id_hash_allocate (31, sizeof (caddr_t), sizeof (caddr_t), treehash, treehashcmp);
+      tn_ifp_ht = id_hash_allocate (31, sizeof (caddr_t), sizeof (caddr_t), treehash, treehashcmp);
+      tn_ifp_no_graph_ht = id_hash_allocate (31, sizeof (caddr_t), sizeof (caddr_t), treehash, treehashcmp);
+      tn_cache_mtx = mutex_allocate ();
     }
 }
 
+id_hash_t *
+tn_hash_table_get (trans_node_t * tn)
+{
+  if (sas_tn_qr == tn->tn_prepared_step) return sas_tn_ht;
+  if (sas_tn_no_graph_qr == tn->tn_prepared_step) return sas_tn_no_graph_ht;
+  if (tn_ifp_qr == tn->tn_prepared_step) return tn_ifp_ht;
+  if (tn_ifp_no_graph_qr == tn->tn_prepared_step) return tn_ifp_no_graph_ht;
+  return NULL;
+}
 
 caddr_t same_as_iri;
 caddr_t owl_sub_class_iri = NULL;
@@ -736,19 +757,11 @@ rdf_inf_ctx (char * name)
 
 
 rdf_inf_ctx_t *
-bif_ctx_arg (caddr_t * qst, state_slot_t ** args, int nth, char * name, int create)
-{
-  caddr_t ctx_name = bif_string_arg (qst, args, nth, name);
-  rdf_inf_ctx_t ** place = (rdf_inf_ctx_t **) id_hash_get (rdf_name_to_ric, (caddr_t)&ctx_name), * ctx;
-  if (!place && !create)
-    sqlr_new_error ("42000", "RDFI.", "No RDF inference rule set '%.200s'", ctx_name);
-  if (!place)
+ric_allocate (caddr_t n2)
     {
-      caddr_t n2 = box_copy (ctx_name);
-      NEW_VARZ (rdf_inf_ctx_t, c1);
-      c1->ric_name = n2;
-      id_hash_set (rdf_name_to_ric, (caddr_t)&n2, (caddr_t)&c1);
-      ctx = c1;
+  NEW_VARZ (rdf_inf_ctx_t, ctx);
+  ctx->ric_name = n2;
+  id_hash_set (rdf_name_to_ric, (caddr_t)&n2, (caddr_t)&ctx);
       ctx->ric_iri_to_subclass = id_hash_allocate (61, sizeof (caddr_t), sizeof (caddr_t), treehash, treehashcmp);
       ctx->ric_iri_to_subproperty = id_hash_allocate (61, sizeof (caddr_t), sizeof (caddr_t), treehash, treehashcmp);
       ctx->ric_iid_to_rel_ifp = id_hash_allocate (61, sizeof (caddr_t), sizeof (caddr_t), treehash, treehashcmp);
@@ -760,10 +773,26 @@ bif_ctx_arg (caddr_t * qst, state_slot_t ** args, int nth, char * name, int crea
       id_hash_set_rehash_pct (ctx->ric_iid_to_rel_ifp, 200);
       id_hash_set_rehash_pct (ctx->ric_samples, 200);
       id_hash_set_rehash_pct (ctx->ric_ifp_exclude, 200);
-      /*id_hash_set_rehash_pct (ctx->ric_prop_props, 200);*/
+  ctx->ric_ifp_exclude = id_hash_allocate (61, sizeof (caddr_t), sizeof (caddr_t), treehash, treehashcmp);;
       ctx->ric_mtx = mutex_allocate ();
+  ctx->ric_samples = id_hash_allocate (61, sizeof (caddr_t), sizeof (text_count_t), treehash, treehashcmp);
+  id_hash_set_rehash_pct (ctx->ric_samples, 200);
       return ctx;
     }
+
+rdf_inf_ctx_t *
+bif_ctx_arg (caddr_t * qst, state_slot_t ** args, int nth, char * name, int create)
+{
+  caddr_t ctx_name = bif_string_arg (qst, args, nth, name);
+  rdf_inf_ctx_t ** place = (rdf_inf_ctx_t **) id_hash_get (rdf_name_to_ric, (caddr_t)&ctx_name);
+  if (!place && !create)
+    sqlr_new_error ("42000", "RDFI.", "No RDF inference rule set '%.200s' specified as argument #%d of %.200s()", ctx_name, nth, name);
+  if (!place)
+    {
+      caddr_t n2 = box_copy (ctx_name);
+      NEW_VARZ (rdf_inf_ctx_t, c1);
+      return ric_allocate (n2);
+    }
   else
     return * place;
 }
@@ -773,7 +802,7 @@ bif_rdf_super_sub_list (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   caddr_t iri = bif_arg (qst, args, 1, "rdf_super_sub_list");
   int mode = bif_long_arg (qst, args, 2, "rdf_super_sub_list");
-  rdf_inf_ctx_t * ctx = bif_ctx_arg (qst, args, 0, "", 0);
+  rdf_inf_ctx_t * ctx = bif_ctx_arg (qst, args, 0, "rdf_super_sub_list", 0);
   rdf_sub_t * sub;
   if (mode < RI_SUBCLASS || mode > RI_SUPERPROPERTY)
     sqlr_new_error ("42000", "RDF..", "RDF inference type must be between 1 and 4");
@@ -800,7 +829,7 @@ bif_rdf_is_sub (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   caddr_t sub_iri = bif_arg (qst, args, 1, "rdf_is_sub");
   caddr_t iri = bif_arg (qst, args, 2, "rdf_is_sub");
   int mode = bif_long_arg (qst, args, 3, "rdf_is_sub");
-  rdf_inf_ctx_t * ctx = bif_ctx_arg (qst, args, 0, "", 0);
+  rdf_inf_ctx_t * ctx = bif_ctx_arg (qst, args, 0, "rdf_is_sub", 0);
   rdf_sub_t * sub;
   if (mode != RI_SUBCLASS && mode != RI_SUBPROPERTY)
     sqlr_new_error ("42000", "RDF..", "RDF inference type for rdf_is_sub() must be 1 for subclass  or 3 for subproperty");
@@ -1103,10 +1132,11 @@ bif_rdf_inf_set_ifp_list (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args
 caddr_t
 bif_rdf_inf_ifp_exclude_list (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
-  rdf_inf_ctx_t * ctx = bif_ctx_arg (qst, args, 0, "rdf_inf_ifp_exclude_list", 1);
+  rdf_inf_ctx_t * ctx = bif_ctx_arg (qst, args, 0, "rdf_inf_ifp_exclude_list", 0);
   iri_id_t ifp = bif_iri_id_arg (qst, args, 1, "rdf_inf_ifp_exclude_list");
   caddr_t box = box_iri_id (ifp);
   caddr_t *place = (caddr_t *)id_hash_get (ctx->ric_ifp_exclude, (void *)(&box));
+  dk_free_tree (box);
   if (NULL == place)
     return list (0);
   return box_copy_tree (place[0]);
@@ -1152,7 +1182,7 @@ caddr_t
 bif_rdf_inf_set_inverses (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   caddr_t *lst = bif_array_of_pointer_arg (qst, args, 1, "rdf_inf_set_inverses");
-  rdf_inf_ctx_t * ctx = bif_ctx_arg (qst, args, 0, "rdf_inf_set_inverses", 0);
+  rdf_inf_ctx_t * ctx = bif_ctx_arg (qst, args, 0, "rdf_inf_set_inverses", 1);
   dk_free_tree (ctx->ric_inverse_prop_pair_sortedalist);
   ctx->ric_inverse_prop_pair_sortedalist = box_copy_tree (lst);
   return NULL;
@@ -1162,7 +1192,7 @@ caddr_t
 bif_rdf_inf_set_prop_props (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   caddr_t *lst = bif_array_of_pointer_arg (qst, args, 1, "rdf_inf_set_prop_props");
-  rdf_inf_ctx_t * ctx = bif_ctx_arg (qst, args, 0, "rdf_inf_set_prop_props", 0);
+  rdf_inf_ctx_t * ctx = bif_ctx_arg (qst, args, 0, "rdf_inf_set_prop_props", 1);
   dk_free_tree (ctx->ric_prop_props);
   ctx->ric_prop_props = box_copy_tree (lst);
   return NULL;
@@ -1343,6 +1373,7 @@ cl_rdf_inf_init (client_connection_t * cli, caddr_t * err_ret)
   /* called from compiler when an inf ctx is found in the parse tree. Must complete before the compilation can proceed.  For cluster only */
   int lt_threads = cli->cli_trx->lt_threads;
   static query_t * qr;
+  caddr_t err = NULL;
   IN_TXN;
   if (1 == cl_rdf_inf_inited)
     {
@@ -1358,7 +1389,7 @@ cl_rdf_inf_init (client_connection_t * cli, caddr_t * err_ret)
       semaphore_enter (self->thr_sem);
       vdb_leave_lt (cli->cli_trx, err_ret);
       if (1 != cl_rdf_inf_inited)
-	*err_ret = srv_make_new_error ("42000", "CL...", "Rdf inf init failed while waiting for other thread to do the rdf inf init");
+	*err_ret = srv_make_new_error ("42000", "CLRI1", "Rdf inf init failed while waiting for other thread to do the rdf inf init");
       return;
     }
   cl_rdf_inf_init_user = cli->cli_user;
@@ -1377,7 +1408,7 @@ cl_rdf_inf_init (client_connection_t * cli, caddr_t * err_ret)
       rc = lt_enter (cli->cli_trx);
       if (LTE_OK != rc)
 	{
-	  *err_ret = srv_make_new_error ("42000", "CL...", "Cluster rrdf inf init failed because bad transaction state.  Rollback and retry.");
+	  *err_ret = srv_make_new_error ("42000", "CLRI2", "Cluster rdf inf init failed because bad transaction state.  Rollback and retry.");
 	  goto init_error;
 	}
     }
@@ -1394,6 +1425,8 @@ cl_rdf_inf_init (client_connection_t * cli, caddr_t * err_ret)
   cl_rdf_inf_init_done (cli, 1);
   return;
  init_error:
+  err = *err_ret;
+  log_error ("Error executing a cluster RDF inf init: %s: %s", ((caddr_t *) err)[QC_ERRNO], ((caddr_t *) err)[QC_ERROR_STRING]);
   cl_rdf_inf_init_done (cli, 0);
 }
 
@@ -1408,11 +1441,31 @@ cl_rdf_inf_init_1 (caddr_t * qst)
     sqlr_resignal (err);
 }
 
+#define TN_HASH_CLEANUP(ht) \
+      DO_IDHASH (caddr_t, k, caddr_t, d, ht) \
+	{ \
+	  dk_free_tree (k); \
+	  dk_free_tree (d); \
+	} \
+      END_DO_IDHASH; \
+      id_hash_clear (ht)
+
+caddr_t
+bif_tn_cache_clear (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  mutex_enter (tn_cache_mtx);
+  TN_HASH_CLEANUP (sas_tn_ht);
+  TN_HASH_CLEANUP (sas_tn_no_graph_ht);
+  TN_HASH_CLEANUP (tn_ifp_ht);
+  TN_HASH_CLEANUP (tn_ifp_no_graph_ht);
+  mutex_leave (tn_cache_mtx);
+  return NULL;
+}
 
 void
 cl_rdf_bif_check_init (bif_t bif)
 {
-  if (cl_rdf_inf_inited)
+  if (1 == cl_rdf_inf_inited)
     return;
   if  (bif_rdf_inf_ifp_list == bif || bif_rdf_inf_ifp_is_excluded == bif
        || bif_rdf_is_sub == bif || bif_rdf_super_sub_list == bif)
@@ -1428,7 +1481,7 @@ cl_rdf_bif_check_init (bif_t bif)
 	}
     }
 }
-
+rdf_inf_ctx_t * empty_ric;
 
 void
 rdf_inf_init ()
@@ -1456,8 +1509,10 @@ rdf_inf_init ()
   bif_define ("rdf_super_sub_list", bif_rdf_super_sub_list);
   bif_define ("rdf_is_sub", bif_rdf_is_sub);
   bif_define ("rdf_inf_dump", bif_rdf_inf_dump);
+  bif_define ("tn_cache_clear", bif_tn_cache_clear);
   dk_mem_hooks (DV_RI_ITERATOR, box_non_copiable, rit_free, 0);
   sas_init ();
+  empty_ric = ric_allocate (box_dv_short_string ("__ empty"));
 }
 
 
@@ -1870,6 +1925,40 @@ sqlg_rdf_inf_same_as_opt (df_elt_t * tb_dfe)
   return NULL;
 }
 
+static void
+sqlg_ts_copies_search_pars (table_source_t * ts)
+{
+  if (ts->ts_inx_op)
+    {
+      inx_op_t *iop = ts->ts_inx_op;
+      int inx;
+      DO_BOX (inx_op_t *, term, inx, iop->iop_terms)
+        {
+          term->iop_ks->ks_copy_search_pars = 1;
+        }
+      END_DO_BOX
+    }
+  if (ts->ts_order_ks)
+    ts->ts_order_ks->ks_copy_search_pars = 1;
+  if (ts->ts_main_ks)
+    ts->ts_main_ks->ks_copy_search_pars = 1;
+}
+
+#define TS_COPIES_SEARCH_PARS do { \
+    sqlg_ts_copies_search_pars ((table_source_t *)(ts)); \
+    if (NULL != q_head[0]) \
+      { \
+        data_source_t *h = q_head[0]; \
+        if (IS_TS (h)) \
+          sqlg_ts_copies_search_pars ((table_source_t *)h); \
+        while (h->src_continuations) \
+          { \
+            h = (data_source_t *) h->src_continuations->data; \
+            if (h && IS_TS (h)) \
+              sqlg_ts_copies_search_pars ((table_source_t *)h); \
+          } \
+      } \
+  } while (0);
 
 #define LEADING_SUBCLASS \
   sqlg_leading_subclass_inf (tb_dfe->dfe_sqlo, q_head, ts, p_dfe, const_p, o_dfe, const_o, ctx, tb_dfe, inxop_inx, sas_o)
@@ -1982,7 +2071,7 @@ sqlg_rdf_inf_1 (df_elt_t * tb_dfe, data_source_t * ts, data_source_t ** q_head,
   caddr_t ctx_name = sqlo_opt_value (tb_dfe->_.table.ot->ot_opts, OPT_RDF_INFERENCE);
   rdf_inf_ctx_t * ctx, **place, *sas_ctx;
   rdf_inf_pre_node_t * sas_s = NULL, * sas_o = NULL, * sas_p = NULL;
-  caddr_t const_s = NULL, const_p = NULL, const_o = NULL;
+  caddr_t /*const_s = NULL,*/ const_p = NULL, const_o = NULL;
   df_elt_t * g_dfe = NULL, * s_dfe = NULL, * p_dfe = NULL, * o_dfe = NULL;
   if (!IS_TS (((table_source_t*)ts))
       && (qn_input_fn)hash_source_input != ts->src_input)
@@ -2025,13 +2114,14 @@ sqlg_rdf_inf_1 (df_elt_t * tb_dfe, data_source_t * ts, data_source_t ** q_head,
 	}
     }
   END_DO_SET();
-  const_s = dfe_iri_const (s_dfe);
+  /*const_s = dfe_iri_const (s_dfe);*/
   const_p = dfe_iri_const (p_dfe);
   const_o = dfe_iri_const (o_dfe);
   memset (&ris, 0, sizeof (ris));
   sc->sc_rdf_inf_slots = &ris;
   if (!s_dfe && !p_dfe && !o_dfe)
     {
+      TS_COPIES_SEARCH_PARS;
       TRAILING_SUBCLASS;
       TRAILING_SUBP;
     }
@@ -2040,12 +2130,14 @@ sqlg_rdf_inf_1 (df_elt_t * tb_dfe, data_source_t * ts, data_source_t ** q_head,
       LEADING_IFP_O;
       LEADING_SAME_AS_O;
       LEADING_SUBCLASS;
+      TS_COPIES_SEARCH_PARS;
       TRAILING_SUBP;
     }
   else if (!s_dfe && p_dfe && !o_dfe)
     {
       LEADING_SAME_AS_P;
       LEADING_SUBP;
+      TS_COPIES_SEARCH_PARS;
       TRAILING_SUBCLASS;
     }
   else if (!s_dfe && p_dfe && o_dfe)
@@ -2060,6 +2152,7 @@ sqlg_rdf_inf_1 (df_elt_t * tb_dfe, data_source_t * ts, data_source_t ** q_head,
     {
       LEADING_IFP_S;
       LEADING_SAME_AS_S;
+      TS_COPIES_SEARCH_PARS;
       TRAILING_SUBCLASS;
       TRAILING_SUBP;
     }
@@ -2070,6 +2163,7 @@ sqlg_rdf_inf_1 (df_elt_t * tb_dfe, data_source_t * ts, data_source_t ** q_head,
       LEADING_SAME_AS_O;
       LEADING_SAME_AS_S;
       LEADING_SUBCLASS;
+      TS_COPIES_SEARCH_PARS;
       TRAILING_SUBP;
     }
   else if (s_dfe && p_dfe && !o_dfe)
@@ -2078,6 +2172,7 @@ sqlg_rdf_inf_1 (df_elt_t * tb_dfe, data_source_t * ts, data_source_t ** q_head,
       LEADING_SAME_AS_S;
       LEADING_SAME_AS_P;
       LEADING_SUBP;
+      TS_COPIES_SEARCH_PARS;
       TRAILING_SUBCLASS;
     }
   else if (s_dfe && p_dfe && o_dfe)
@@ -2092,6 +2187,8 @@ sqlg_rdf_inf_1 (df_elt_t * tb_dfe, data_source_t * ts, data_source_t ** q_head,
     }
   else
     GPF_T1 (" all possibilities of spo already covered");
+  dk_free_box (const_p);
+  dk_free_box (const_o);
   sc->sc_rdf_inf_slots = NULL;
 }
 
@@ -2165,6 +2262,8 @@ sqlg_cl_bracket_outer (sqlo_t * so, data_source_t * first)
   outer_seq_end_node_t * ose;
   dk_hash_t * res = hash_table_allocate (11);
   data_source_t * first1 = qn_next (first);
+  data_source_t * org_first = first1;
+  void * dp;
   SET_THR_ATTR (THREAD_CURRENT_THREAD, TA_SQLC_ASG_SET, res);
   sc->sc_any_clb = 1;
   while (first1)
@@ -2197,6 +2296,11 @@ sqlg_cl_bracket_outer (sqlo_t * so, data_source_t * first)
     ose->ose_sctr = sctr;
     for (qn = qn_next ((data_source_t*)sctr); qn != (data_source_t*)ose && qn; qn = qn_next (qn))
       dk_set_push (&sctr->sctr_continuable, (void*)qn);
+    if (sc->sc_qn_to_dpipe && (dp = (data_source_t*)gethash ((void*)org_first, sc->sc_qn_to_dpipe)))
+      {
+	remhash ((void*)org_first, sc->sc_qn_to_dpipe);
+	sethash ((void*)sctr, sc->sc_qn_to_dpipe, (void*)dp);
+      }
   }
   return ose;
 }
diff --git a/libsrc/Wi/rdfinf.h b/libsrc/Wi/rdfinf.h
index 2836263..3db3344 100644
--- a/libsrc/Wi/rdfinf.h
+++ b/libsrc/Wi/rdfinf.h
@@ -1,5 +1,5 @@
 /*
- *  $Id: rdfinf.h,v 1.6.2.5 2010/05/24 18:02:28 source Exp $
+ *  $Id: rdfinf.h,v 1.6.2.6 2011/01/10 20:49:47 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -186,6 +186,7 @@ struct trans_node_s
   ptrlong		tn_max_memory;
   caddr_t		tn_ifp_ctx_name;
   state_slot_t *	tn_ifp_g_list;
+  int	        tn_nth_cache_result;
 };
 
 #define TN_DEFAULT_MAX_MEMORY 100000000
@@ -215,6 +216,8 @@ rdf_inf_ctx_t * rdf_inf_ctx (char * name);
 rdf_sub_t * rit_next (ri_iterator_t * rit);
 ri_iterator_t * ri_iterator (rdf_sub_t * rs, int mode, int distinct);
 void sas_ensure ();
+id_hash_t * tn_hash_table_get (trans_node_t * tn);
+extern dk_mutex_t * tn_cache_mtx;
 
 caddr_t iri_ensure (caddr_t * qst, caddr_t name, int flag, caddr_t * err_ret);
 #endif
diff --git a/libsrc/Wi/rdflddir2.sql b/libsrc/Wi/rdflddir2.sql
new file mode 100644
index 0000000..0d4aa8d
--- /dev/null
+++ b/libsrc/Wi/rdflddir2.sql
@@ -0,0 +1,379 @@
+--
+--  $Id: rdflddir2.sql,v 1.1.2.1 2011/03/24 16:15:42 source Exp $
+--
+--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+--  project.
+--
+--  Copyright (C) 1998-2011 OpenLink Software
+--
+--  This project is free software; you can redistribute it and/or modify it
+--  under the terms of the GNU General Public License as published by the
+--  Free Software Foundation; only version 2 of the License, dated June 1991.
+--
+--  This program is distributed in the hope that it will be useful, but
+--  WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+--  General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License along
+--  with this program; if not, write to the Free Software Foundation, Inc.,
+--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+--
+--
+
+create table DB.DBA.LOAD_LIST (
+  ll_file varchar,
+  ll_graph varchar,
+  ll_state int default 0, -- 0 not started, 1 going, 2 done
+  ll_started datetime,
+  ll_done datetime,
+  ll_host int,
+  ll_work_time integer,
+  ll_error varchar,
+  primary key (ll_file))
+alter index LOAD_LIST on DB.DBA.LOAD_LIST partition (ll_file varchar)
+create index LL_STATE on DB.DBA.LOAD_LIST (ll_state, ll_file, ll_graph) partition (ll_state int)
+;
+
+
+create table LDLOCK (id int primary key)
+alter index LDLOCK on LDLOCK partition (id int)
+;
+
+insert soft DB.DBA.LDLOCK values (0)
+;
+
+
+create procedure
+ld_dir (in path varchar, in mask varchar, in graph varchar)
+{
+  declare ls any;
+  declare inx int;
+  ls := sys_dirlist (path, 1);
+  for (inx := 0; inx < length (ls); inx := inx + 1)
+    {
+      if (ls[inx] like mask)
+	{
+	  set isolation = 'serializable';
+
+	  if (not (exists (select 1 from DB.DBA.LOAD_LIST where LL_FILE = path || '/' || ls[inx] for update)))
+	    {
+	      declare gfile, cgfile, ngraph varchar;
+	      gfile := path || '/' || replace (ls[inx], '.gz', '') || '.graph';
+	      cgfile := path || '/' || regexp_replace (replace (ls[inx], '.gz', ''), '\\-[0-9]+\\.n', '.n') || '.graph';
+	      if (file_stat (gfile) <> 0)
+		ngraph := trim (file_to_string (gfile), ' \r\n');
+              else if (file_stat (cgfile) <> 0)
+		ngraph := trim (file_to_string (cgfile), ' \r\n');
+	      else if (file_stat (path || '/' || 'global.graph') <> 0)
+		ngraph := trim (file_to_string (path || '/' || 'global.graph'), ' \r\n');
+	      else
+	        ngraph := graph;
+              if (ngraph is not null)
+                {
+		  insert into DB.DBA.LOAD_LIST (ll_file, ll_graph) values (path || '/' || ls[inx], ngraph);
+		}
+	    }
+
+	  commit work;
+	}
+    }
+}
+;
+
+
+create procedure
+rdf_read_dir (in path varchar, in mask varchar, in graph varchar)
+{
+  ld_dir (path, mask, graph);
+}
+;
+
+
+create procedure
+ld_dir_all (in path varchar, in mask varchar, in graph varchar)
+{
+  declare ls, ngraph any;
+  declare inx int;
+  ls := sys_dirlist (path, 0);
+  if (file_stat (path || '/' || 'global.graph') <> 0)
+    {
+      ngraph := trim (file_to_string (path || '/' || 'global.graph'), ' \r\n');
+      if (length (ngraph))
+	graph := ngraph;
+    }
+  ld_dir (path, mask, graph);
+  for (inx := 0; inx < length (ls); inx := inx + 1)
+    {
+      if (ls[inx] <> '.' and ls[inx] <> '..')
+	{
+	  ld_dir_all (path||'/'||ls[inx], mask, graph);
+	}
+    }
+}
+;
+
+create procedure
+ld_add (in _fname varchar, in _graph varchar)
+{
+  --log_message (sprintf ('ld_add: %s, %s', _fname, _graph));
+
+  set isolation = 'serializable';
+
+  if (not (exists (select 1 from DB.DBA.LOAD_LIST where LL_FILE = _fname for update)))
+    {
+      insert into DB.DBA.LOAD_LIST (LL_FILE, LL_GRAPH) values (_fname, _graph);
+    }
+  commit work;
+}
+;
+
+create procedure ld_ttlp_flags (in fname varchar)
+{
+  if (fname like '%/btc-2009%' or fname like '%.nq%' or fname like '%.n4')
+    return 255 + 512;
+  return 255;
+}
+;
+
+create procedure
+ld_file (in f varchar, in graph varchar)
+{
+  declare gzip_name varchar;
+  declare exit handler for sqlstate '*' {
+    rollback work;
+    update DB.DBA.LOAD_LIST
+      set LL_STATE = 2,
+          LL_DONE = curdatetime (),
+          LL_ERROR = __sql_state || ' ' || __sql_message
+      where LL_FILE = f;
+    commit work;
+
+    log_message (sprintf (' File %s error %s %s', f, __sql_state, __sql_message));
+    return;
+  };
+
+  if (graph like 'sql:%')
+    {
+      exec (subseq (graph, 4), null, null, vector (f), vector ('max_rows', 0, 'use_cache', 1));
+      return;
+    }
+
+  if (f like '%.grdf' or f like '%.grdf.gz')
+    {
+      load_grdf (f);
+    }
+  else if (f like '%.gz')
+    {
+      gzip_name := regexp_replace (f, '\.gz\x24', '');
+      if (gzip_name like '%.xml' or gzip_name like '%.owl' or gzip_name like '%.rdf')
+	DB.DBA.RDF_LOAD_RDFXML (gz_file_open (f), graph, graph);
+      else
+	TTLP (gz_file_open (f), graph, graph, ld_ttlp_flags (gzip_name));
+    }
+  else
+    {
+      if (f like '%.xml' or f like '%.owl' or f like '%.rdf')
+	DB.DBA.RDF_LOAD_RDFXML (file_open (f), graph, graph);
+      else
+	TTLP (file_open (f), graph, graph, ld_ttlp_flags (f));
+    }
+
+  --log_message (sprintf ('loaded %s', f));
+}
+;
+
+create procedure
+rdf_load_dir (in path varchar,
+              in mask varchar := '%.nt',
+              in graph varchar := 'http://dbpedia.org')
+{
+
+  delete from DB.DBA.LOAD_LIST where LL_FILE = '##stop';
+  commit work;
+
+  ld_dir (path, mask, graph);
+
+  rdf_loader_run ();
+}
+;
+
+
+create procedure ld_array ()
+{
+  declare first, last, arr, len, local any;
+  declare cr cursor for
+      select top 100 LL_FILE, LL_GRAPH
+        from DB.DBA.LOAD_LIST table option (index ll_state)
+        where LL_STATE = 0
+	for update;
+  declare fill int;
+  declare f, g varchar;
+  declare r any;
+  whenever not found goto done;
+  first := 0;
+  last := 0;
+ arr := make_array (100, 'any');
+  fill := 0;
+  open cr;
+  len := 0;
+  for (;;)
+    {
+      fetch cr into f, g;
+      if (0 = first) first := f;
+      last := f;
+      arr[fill] := vector (f, g);
+    len := len + cast (file_stat (f, 1) as int);
+      fill := fill + 1;
+      if (len > 2000000 or fill >= 100)
+	goto done;
+    }
+ done:
+  if (0 = first)
+    return 0;
+  if (1 <> sys_stat ('cl_run_local_only'))
+    local := sys_stat ('cl_this_host');
+  update load_list set ll_state = 1, ll_started = curdatetime (), LL_HOST = local
+    where ll_file >= first and ll_file <= last;
+  return arr;
+}
+;
+
+create procedure
+rdf_loader_run (in max_files integer := null, in log_enable int := 2)
+{
+  declare sec_delay float;
+  declare _f, _graph varchar;
+  declare arr any;
+  declare xx, inx, tx_mode, ld_mode int;
+  ld_mode := log_enable;
+  if (0 = sys_stat ('cl_run_local_only'))
+    {
+      if (log_enable = 2 and cl_this_host () = 1)
+	{
+	  cl_exec ('checkpoint_interval (0)');
+	  cl_exec ('__dbf_set (''cl_non_logged_write_mode'', 1)');
+	}
+      if (cl_this_host () = 1)
+	cl_exec('__dbf_set(''cl_max_keep_alives_missed'',3000)');
+    }
+  tx_mode := bit_and (1, log_enable);
+  log_message ('Loader started');
+
+  delete from DB.DBA.LOAD_LIST where LL_FILE = '##stop';
+  commit work;
+
+  while (1)
+    {
+      set isolation = 'repeatable';
+      declare exit handler for sqlstate '40001' {
+	rollback work;
+        sec_delay := rnd(1000)*0.001;
+	log_message(sprintf('deadlock in loader, waiting %d milliseconds', cast (sec_delay * 1000 as integer)));
+	delay(sec_delay);
+	goto again;
+      };
+
+     again:;
+
+      if (exists (select 1 from DB.DBA.LOAD_LIST where LL_FILE = '##stop'))
+	{
+	  log_message ('File load stopped by rdf_load_stop.');
+	  return;
+	}
+
+      log_enable (tx_mode, 1);
+
+      if (max_files is not null and max_files <= 0)
+        {
+	  commit work;
+	  log_message ('Max_files reached. Finishing.');
+          return;
+	}
+
+      whenever not found goto looks_empty;
+
+      --      log_message ('Getting next file.');
+      set isolation = 'serializable';
+      select id into xx from ldlock where id = 0 for update;
+      arr := ld_array ();
+      commit work;
+      if (0 = arr)
+	goto looks_empty;
+      log_enable (ld_mode, 1);
+
+      for (inx := 0; inx < 100; inx := inx + 1)
+	{
+	  if (0 = arr[inx])
+	    goto arr_done;
+	  ld_file (arr[inx][0], arr[inx][1]);
+	  update DB.DBA.LOAD_LIST set LL_STATE = 2, LL_DONE = curdatetime () where LL_FILE = arr[inx][0];
+	}
+    arr_done:
+      log_enable (tx_mode, 1);
+
+
+      if (max_files is not null) max_files := max_files - 100;
+
+      commit work;
+    }
+
+ looks_empty:
+  commit work;
+  log_message ('No more files to load. Loader has finished,');
+  return;
+
+}
+;
+
+create procedure rdf_load_stop (in force int := 0)
+{
+  insert into DB.DBA.LOAD_LIST (LL_FILE) values ('##stop');
+  commit work;
+  if (force)
+    cl_exec ('txn_killall (1)');
+}
+;
+
+
+create procedure RDF_LOADER_RUN_1 (in x int, in y int)
+{
+  rdf_loader_run (x, y);
+}
+;
+
+create procedure rdf_ld_srv (in log_enable int := 2)
+{
+  declare aq any;
+  aq := async_queue (1);
+  aq_request (aq, 'DB.DBA.RDF_LOADER_RUN_1', vector (null, log_enable));
+  aq_wait_all (aq);
+}
+;
+
+
+create procedure load_grdf (in f varchar)
+{
+  declare line any;
+  declare inx int;
+  declare ses any;
+  declare gr varchar;
+
+  if (f like '%.gz')
+    ses := gz_file_open (f);
+  else
+    ses := file_open (f);
+  inx := 0;
+  line := '';
+  while (line <> 0)
+    {
+      gr := ses_read_line (ses, 0, 0, 1);
+      if (gr = 0) return;
+      line := ses_read_line (ses, 0, 0, 1);
+      if (line = 0) return;
+      DB.DBA.RDF_LOAD_RDFXML (line, gr, gr);
+      inx := inx + 1;
+    }
+}
+;
+
diff --git a/libsrc/Wi/rdfxml_parser.c b/libsrc/Wi/rdfxml_parser.c
index 656af6c..beb01ff 100644
--- a/libsrc/Wi/rdfxml_parser.c
+++ b/libsrc/Wi/rdfxml_parser.c
@@ -1,7 +1,7 @@
 /*
  *  rdfxml_parser.c
  *
- *  $Id: rdfxml_parser.c,v 1.17.2.10 2010/06/22 15:50:49 source Exp $
+ *  $Id: rdfxml_parser.c,v 1.17.2.11 2011/02/23 17:31:50 source Exp $
  *
  *  RDF/XML parser
  *
@@ -2022,6 +2022,8 @@ rdfxml_parse (query_instance_t * qi, caddr_t text, caddr_t *err_ret,
     default_rdf_dtd_config = box_dv_short_string ("Validation=DISABLE SchemaDecl=DISABLE IdCache=DISABLE");
   config.dtd_config = default_dtd_config;
   config.root_lang_handler = lh;
+  if (file_read == xrie.xrie_iter)
+    config.feed_buf_size = 0x10000;
   parser = VXmlParserCreate (&config);
   parser->fill_ns_2dict = 0;
   context.xp_parser = parser;
diff --git a/libsrc/Wi/rendezvous.c b/libsrc/Wi/rendezvous.c
index 5dc2724..616adcd 100644
--- a/libsrc/Wi/rendezvous.c
+++ b/libsrc/Wi/rendezvous.c
@@ -1,7 +1,7 @@
 /*
  *  rendezvous.c
  *
- *  $Id: rendezvous.c,v 1.5.2.2 2010/02/10 16:03:28 source Exp $
+ *  $Id: rendezvous.c,v 1.5.2.3 2010/09/17 20:49:12 source Exp $
  *
  *  Rendezvous registration for Virtuoso
  *
@@ -331,6 +331,21 @@ rendezvous_thread (void *arg)
   int result;
   int wakeup;
 
+#if defined (HAVE_PTHREAD_SIGMASK)
+  sigset_t newset, oldset;
+
+  /*
+   *  This thread should not handle these signals
+   */
+  sigemptyset (&newset);
+  sigaddset (&newset, SIGINT);
+  sigaddset (&newset, SIGCHLD);
+  sigaddset (&newset, SIGQUIT);
+  sigaddset (&newset, SIGALRM);
+  sigaddset (&newset, SIGTERM);
+  pthread_sigmask (SIG_BLOCK, &newset, &oldset);
+#endif
+
 #ifdef RVDEBUG
   log (L_DEBUG, N_("ZeroConfig thread started"));
 #endif
diff --git a/libsrc/Wi/repl.h b/libsrc/Wi/repl.h
index e6d0da3..d944e04 100644
--- a/libsrc/Wi/repl.h
+++ b/libsrc/Wi/repl.h
@@ -1,7 +1,7 @@
 /*
  *  repl.h
  *
- *  $Id: repl.h,v 1.3.2.1 2009/04/18 21:55:13 source Exp $
+ *  $Id: repl.h,v 1.3.2.2 2010/09/17 16:35:47 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -104,9 +104,5 @@ repl_subscriber_t *rs_find (repl_acct_t *ra, char *subscriber);
 repl_subscriber_t *repl_save_subscriber (
     repl_acct_t *ra, char *subscriber, int level, int valid);
 query_t *repl_compile (char *text);
-#ifdef REPLICATION_SUPPORT2
-extern id_hash_t * repl_grants;
-int get_repl_grants (char *acct, char *user);
-#endif
 
 #endif /* _REPL_H */
diff --git a/libsrc/Wi/repl.sql b/libsrc/Wi/repl.sql
index 7022789..e052022 100644
--- a/libsrc/Wi/repl.sql
+++ b/libsrc/Wi/repl.sql
@@ -1,7 +1,7 @@
 --
 --  repl.sql
 --
---  $Id: repl.sql,v 1.4.2.1 2009/04/18 21:55:13 source Exp $
+--  $Id: repl.sql,v 1.4.2.2 2010/09/17 22:49:23 source Exp $
 --
 --  TRX replication support
 --
@@ -101,8 +101,43 @@ create procedure REPL_PUB_REMOVE (in __pub varchar, in _item varchar, in _type i
 }
 ;
 
+create procedure REPL_GET_ADDR_FROM_DSN (in dsn varchar)
+{
+  declare arr, dsn_exists any;
+  dsn_exists := 0;
+  declare exit handler for sqlstate '*'
+    {
+      rollback work;
+      signal ('42000', sprintf ('Can not get host address from DSN "%s"', dsn));
+    };
+  arr := sql_get_private_profile_string (dsn, 'user');
+  if (isvector (arr))
+    {
+      foreach (any x in arr) do
+	{
+	  dsn_exists := 1;
+	  if (lower (x[0]) = 'address' or lower (x[0]) = 'host')
+	    return x[1];
+	}
+    }
+  arr := sql_get_private_profile_string (dsn, 'system');
+  if (isvector (arr))
+    {
+      foreach (any x in arr) do
+	{
+	  dsn_exists := 1;
+	  if (lower (x[0]) = 'address' or lower (x[0]) = 'host')
+	    return x[1];
+	}
+    }
+  if (dsn_exists)
+    return 'localhost:1111';
+  signal ('22023', sprintf ('Can not find DSN "%s"', dsn));
+}
+;
+
 
-create procedure REPL_SERVER (in name varchar, in addr varchar, in repl_addr varchar)
+create procedure REPL_SERVER (in name varchar, in addr varchar, in repl_addr varchar := null)
 {
   if (not isstring (sys_stat ('st_repl_server_enable')))
     {
@@ -113,8 +148,15 @@ create procedure REPL_SERVER (in name varchar, in addr varchar, in repl_addr var
     }
   if (name = repl_this_server ())
     return;
+  if (repl_addr is null)
+    {
+      if (__proc_exists ('sql_get_private_profile_string', 2) is not null)
+	repl_addr := REPL_GET_ADDR_FROM_DSN (addr);
+      else
+	repl_addr := addr;
+    }
   insert replacing DB.DBA.SYS_SERVERS (SERVER, DB_ADDRESS, REPL_ADDRESS)
-      values (name, addr, coalesce (repl_addr, addr));
+      values (name, addr, repl_addr);
   repl_changed ();
   log_text ('repl_changed ()');
 }
@@ -181,6 +223,11 @@ cont:
       REPL_REVOKE (pub, grnt);
     }
   delete from DB.DBA.SYS_REPL_ACCOUNTS  where SERVER = repl_this_server () and ACCOUNT = pub;
+  delete from SYS_REPL_SUBSCRIBERS where RS_SERVER = repl_this_server () and RS_ACCOUNT = pub;
+  sequence_remove (sprintf ('repl_%s_%s', repl_this_server (), pub));
+  registry_remove (sprintf ('repl_%s_%s', repl_this_server (), pub));
+  commit work;
+  repl_account_remove (pub);
   repl_changed ();
 }
 ;
@@ -294,6 +341,8 @@ create procedure REPL_UNSUBSCRIBE (in serv varchar, in _pub varchar, in _item va
     }
   else
       delete from DB.DBA.SYS_TP_ITEM where TI_SERVER = serv and TI_ACCT = pub and TI_ITEM = _item;
+  sequence_remove (sprintf ('repl_%s_%s', serv, pub));
+  registry_remove (sprintf ('repl_%s_%s', serv, pub));
   repl_changed ();
   log_text ('repl_changed ()');
 }
@@ -3067,7 +3116,7 @@ create procedure DB.DBA.REPL_TRX_CHECK ()
       log_message ('or Conductor interface.');
       raw_exit ();
     }
-  else
+  else if (isstring (ini))
     {
       registry_set ('__repl_this_server', ini);
     }
diff --git a/libsrc/Wi/repldb.c b/libsrc/Wi/repldb.c
deleted file mode 100644
index 26a3069..0000000
--- a/libsrc/Wi/repldb.c
+++ /dev/null
@@ -1,1410 +0,0 @@
-/*
- *  repldb.c
- *
- *  $Id: repldb.c,v 1.6.2.1 2009/04/18 21:55:13 source Exp $
- *
- *  DB Server side replication support
- *
- *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- *  project.
- *
- *  Copyright (C) 1998-2006 OpenLink Software
- *
- *  This project is free software; you can redistribute it and/or modify it
- *  under the terms of the GNU General Public License as published by the
- *  Free Software Foundation; only version 2 of the License, dated June 1991.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include "sqlnode.h"
-#include "sqlfn.h"
-#include "log.h"
-#include "repl.h"
-#include "replsr.h"
-#include "wirpce.h"
-#include "sqlbif.h"
-#include "datesupp.h"
-#include "security.h"
-
-/* Receiving Replication */
-
-#define REPL_FREE 0
-#define REPL_TO_DISCONNECT -1
-#define REPL_DO_RECONNECT -2  /* If the subscription is disconnected by full queue reason */
-
-#define REPL_THREAD_SZ future_thread_sz
-
-client_connection_t *repl_cli;
-dk_session_t *repl_str_in;
-basket_t repl_in_queue;
-dk_thread_t *repl_thread;
-dk_mutex_t *repl_in_q_mtx;
-semaphore_t *repl_ready_sem;
-dk_set_t servers;
-dk_set_t repl_accounts;
-dk_mutex_t *repl_accounts_mtx;
-client_connection_t *repl_util_cli;
-dk_mutex_t *repl_uc_mtx;
-
-static void repl_sync (repl_acct_t * ra, char * usr, char * pwd);
-
-static int
-repl_input_ready (dk_session_t * ses)
-{
-  remove_from_served_sessions (ses);
-  mutex_enter (repl_in_q_mtx);
-  basket_add (&repl_in_queue, (void *) ses);
-  mutex_leave (repl_in_q_mtx);
-  semaphore_leave (repl_ready_sem);
-  return 0;
-}
-
-/*Note: this macro suppose that header is an array an empty account is a signal for resync */
-#define IS_REPL_DISC(h)		(h[LOGH_REPLICATION] && !(((caddr_t *) h [LOGH_REPLICATION]) [REPLH_ACCOUNT]))
-
-#ifndef VIRTTP
-#define MIN_LOG_HEADER_LENGTH LOG_HEADER_LENGTH
-#else
-#define MIN_LOG_HEADER_LENGTH LOG_HEADER_LENGTH_OLD
-#endif
-
-int
-repl_check_header (caddr_t * header)
-{
-#if 1
-  caddr_t * replh;
-  if (!IS_BOX_POINTER(header) || BOX_ELEMENTS(header) < MIN_LOG_HEADER_LENGTH)
-    {
-      if (IS_BOX_POINTER (header))
-	log_error ("Bad log replication header len (%d). The connection will be terminated.",
-	    BOX_ELEMENTS(header));
-      return 0;
-    }
-  replh = (caddr_t *)header[LOGH_REPLICATION];
-  if (!IS_BOX_POINTER(replh) || BOX_ELEMENTS(replh) < REPLH_CIRCULATION)
-    {
-      if (IS_BOX_POINTER(replh))
-	log_error ("Bad replication header len (%d). The connection will be terminated.",
-	    BOX_ELEMENTS(replh));
-      else
-	log_error ("Bad replication header. The connection will be terminated.");
-      return 0;
-    }
-#endif
-  return 1;
-}
-
-static void
-repl_process_message (dk_session_t * ses)
-{
-  scheduler_io_data_t trx_sio;
-  size_t bytes;
-  caddr_t *header;
-  caddr_t trx_string;
-  header = (caddr_t *) PrpcReadObject (ses);
-  /* check for header length and replication structure if present */
-  if (!header || DKSESSTAT_ISSET (ses, SST_BROKEN_CONNECTION)
-      || !repl_check_header(header))
-    {
-      if (DKS_DB_DATA (ses)->cli_repl_pending != REPL_DO_RECONNECT) /*If isn't disconnected by full queue*/
-        DKS_DB_DATA (ses)->cli_repl_pending = REPL_TO_DISCONNECT;
-    }
-  else
-    {
-      bytes = (size_t) unbox (header[LOGH_BYTES]);
-      if (bytes)
-	{
-	  trx_string = dk_alloc (bytes);
-	  CATCH_READ_FAIL (ses)
-	    {
-	      session_buffered_read (ses, trx_string, bytes);
-	    }
-	  END_READ_FAIL (ses);
-	  memset (&trx_sio, 0, sizeof (trx_sio));
-	  if (!SESSION_SCH_DATA (repl_str_in))
-	    SESSION_SCH_DATA (repl_str_in) = &trx_sio;
-
-	  if (DKSESSTAT_ISSET (ses, SST_BROKEN_CONNECTION))
-	    {
-	      dk_free_tree ((caddr_t) header);
-	      DKS_DB_DATA (ses)->cli_repl_pending = REPL_TO_DISCONNECT;
-	      dk_free (trx_string, bytes);
-	      return;
-	    }
-	  else
-	    {
-              repl_acct_t *ra;
-
-	      repl_str_in->dks_in_buffer = trx_string;
-	      repl_str_in->dks_in_read = 0;
-	      repl_str_in->dks_in_fill = bytes;
-	      repl_cli->cli_session = ses;
-              ra = (repl_acct_t *) DKS_DB_DATA(ses)->cli_ra;
-              if (!set_user_id (repl_cli, ra->ra_sync_user, NULL))
-                {
-                  log_error ("Can't set user to '%s' for account '%s' from '%s'.",
-                      ra->ra_sync_user, ra->ra_account, ra->ra_server);
-                  dk_free_tree ((caddr_t) header);
-                  DKS_DB_DATA (ses)->cli_repl_pending = REPL_TO_DISCONNECT;
-	          dk_free (trx_string, bytes);
-                  return;
-                }
-	      if (LTE_OK == log_replay_trx (repl_str_in, repl_cli,
-					    (caddr_t) header, 1, 0))
-		{
-		}
-	      else
-		{
-		  log_error ("(%s, %s): Can't replay replication feed.",
-                      ra->ra_server, ra->ra_account);
-		  DKS_DB_DATA (ses)->cli_repl_pending = REPL_TO_DISCONNECT;
-		}
-
-	      dk_free (trx_string, bytes);
-	    }
-	}
-      else if (IS_REPL_DISC(header))
-	{ /* if we receive queue full follow disconnect message then mark session to reconnect
-	   and we will try one time to sync via replication log */
-	  DKS_DB_DATA (ses)->cli_repl_pending = REPL_DO_RECONNECT;
-	  dk_free_tree ((caddr_t) header);
-	  return;
-	}
-      else
-        {
-          lock_trx_t *lt = NULL;
-          caddr_t *replh = (caddr_t *) header[LOGH_REPLICATION];
-
-          /*
-           * there can be two cases here:
-           * - sync notice (zero REPLH_LEVEL)
-           * - no data (non-zero REPLH_LEVEL)
-           */
-          if (replh && replh[REPLH_LEVEL])
-            {
-              IN_TXN;
-	      lt = cli_set_new_trx (repl_cli);
-	      lt_threads_set_inner (lt, 1);
-              lt->lt_replicate = REPL_LOG;
-            }
-	  logh_set_level (lt, header);
-          if (lt)
-            {
-              lt_commit (lt, TRX_CONT);
-	      lt_leave (lt);
-              LEAVE_TXN;
-            }
-        }
-
-      DKS_DB_DATA (ses)->cli_repl_pending = REPL_FREE;
-    }
-  dk_free_tree ((caddr_t) header);
-}
-
-static void
-repl_base_loop (void)
-{
-  timeout_t zero_timeout = {0, 0};
-  int ctr;
-  dk_session_t *ses;
-  SET_THR_ATTR (THREAD_CURRENT_THREAD, TA_IMMEDIATE_CLIENT, repl_cli);
-  for (;;)
-    {
-      semaphore_enter (repl_ready_sem);
-      mutex_enter (repl_in_q_mtx);
-      ses = (dk_session_t *) basket_get (&repl_in_queue);
-      mutex_leave (repl_in_q_mtx);
-      if (!_thread_sched_preempt)
-	SESSION_SCH_DATA (ses)->sio_default_read_ready_action = NULL;
-
-      for (ctr = 0; ; ctr++)
-	{
-          int pending;
-          repl_acct_t *ra = (repl_acct_t *) DKS_DB_DATA (ses)->cli_ra;
-
-          if (ra->ra_synced == RA_TO_DISCONNECT)
-            {
-              dbg_printf (("repl_base_loop: RA_TO_DISCONNECT: account '%s' (server '%s')",
-                  ra->ra_account, ra->ra_server));
-              ra->ra_synced = RA_DISCONNECTED;
-              DKS_DB_DATA(ses)->cli_repl_pending = REPL_TO_DISCONNECT;
-            }
-          else
-	    repl_process_message (ses);
-
-          pending = DKS_DB_DATA (ses)->cli_repl_pending;
-          if (pending == REPL_TO_DISCONNECT || pending == REPL_DO_RECONNECT)
-	    {
-	      log_info ("Replication server %s disconnected, level of %s is %d.",
-		  ra->ra_server, ra->ra_account,
-                  ra_trx_no (ra));
-              if (ra->ra_synced != RA_DISCONNECTED)
-		ra->ra_synced = RA_REMOTE_DISCONNECTED;
-	      PrpcDisconnect (ses);
-	      /* as client_connection_t is moved together with the session,
-		 it must be freed */
-	      client_connection_free (DKS_DB_DATA (ses));
-	      DKS_DB_DATA (ses) = NULL;
-	      PrpcSessionFree (ses);
-	      if (pending == REPL_DO_RECONNECT) /* The publication was disconnected because replication queue is full on publisher server*/
-		{
-                  QR_RESET_CTX
-                    {
-		      repl_sync (ra, NULL, NULL); /* we will try to reconnect and send sync message
-						       the sync will be done via replication log */
-		      log_info ("Sync request sent to publishing server '%s' for account '%s' as '%s'.",
-                          ra->ra_server, ra->ra_account, ra->ra_usr);
-                    }
-                  QR_RESET_CODE
-                    {
-                      du_thread_t * self = THREAD_CURRENT_THREAD;
-                      caddr_t err = thr_get_error_code (self);
-                      log_error ("repl_sync: SQL Error: %s : %s",
-                          ((caddr_t *) err)[1], ((caddr_t *) err)[2]);
-		      dk_free_tree (err);
-                    }
-                  END_QR_RESET
-		}
-	      break;
-	    }
-	  else if (ctr > 20)
-	    {
-	      if (!_thread_sched_preempt)
-		SESSION_SCH_DATA (ses)->sio_default_read_ready_action =
-		    repl_input_ready;
-	      PrpcCheckInAsync (ses);
-	      break;
-	    }
-	  else
-	    {
-              /*
-               *  Because tcpses_is_read_ready with zero timeout with fibers
-               *  always returns with ready, we need to cheat here.
-               */
-              if (!_thread_sched_preempt)
-                {
-                  zero_timeout = dks_fibers_blocking_read_default_to;
-                }
-
-	      tcpses_is_read_ready (ses->dks_session, &zero_timeout);
-	      if (SESSTAT_ISSET (ses->dks_session, SST_TIMED_OUT))
-		{
-		  if (!_thread_sched_preempt)
-		    SESSION_SCH_DATA (ses)->sio_default_read_ready_action =
-			repl_input_ready;
-		  PrpcCheckInAsync (ses);
-		  break;
-		}
-	      TC (tc_repl_connect_quick_reuse);
-	    }
-	}
-    }
-}
-
-char *
-repl_peer_name (repl_acct_t * ra)
-{
-  char *p;
-
-  /*
-   * ra->ra_server + space + ra->ra_account + trailing NUL
-   */
-  p = dk_alloc_box (
-      strlen (ra->ra_server) + 1 + strlen (ra->ra_account) + 1, DV_C_STRING);
-  snprintf (p, box_length (p), "%s %s", ra->ra_server, ra->ra_account);
-  return p;
-}
-
-static dk_session_t *
-repl_connect (char * addr, repl_acct_t * ra)
-{
-  dk_session_t *ses = PrpcConnect (addr, SESCLASS_TCPIP);
-  if (!DKSESSTAT_ISSET (ses, SST_OK))
-    {
-      PrpcDisconnect (ses);
-      PrpcSessionFree (ses);
-      log_error ("Failed connect to '%s'.", addr);
-      return NULL;
-    }
-
-  if (!_thread_sched_preempt)
-    ses->dks_read_block_timeout = dks_fibers_blocking_read_default_to;
-  DKS_DB_DATA (ses) = client_connection_create ();
-  DKS_DB_DATA (ses)->cli_ra = (void *) ra;
-
-  SESSION_SCH_DATA (ses)->sio_default_read_ready_action = repl_input_ready;
-  dk_free_box (ses->dks_peer_name);
-  ses->dks_peer_name = repl_peer_name (ra);
-  log_info ("Connected to replication server '%s'.", addr);
-  return ses;
-}
-
-static char *read_repl_text =
-"(seq (from SYS_REPL_ACCOUNTS (SERVER ACCOUNT LEVEL IS_MANDATORY IS_UPDATEABLE SYNC_USER P_MONTH P_DAY P_WDAY P_TIME) by SYS_REPL_ACCOUNTS prefix R)"
-"     (select (R.SERVER R.ACCOUNT R.LEVEL R.IS_MANDATORY R.IS_UPDATEABLE R.SYNC_USER R.P_MONTH R.P_DAY R.P_WDAY R.P_TIME)))";
-
-static char *ra_add_text =
-"(seq (insert SYS_REPL_ACCOUNTS (NTH SERVER ACCOUNT LEVEL)(:N :SR :AC :L))(end))";
-
-#if 0
-static char *ra_upd_text =
-"(seq (from SYS_REPL_ACCOUNTS (LEVEL) by SYS_REPL_ACCOUNTS prefix R "
-"          where ((SERVER = :SR) (ACCOUNT = :AC)))"
-"  (update SYS_REPL_ACCOUNTS R (LEVEL :L)) (end))";
-#endif
-
-static char *sa_read_text =
-"(seq (from SYS_SERVERS (SERVER DB_ADDRESS REPL_ADDRESS) by SYS_SERVERS prefix S)"
-"    (select (S.SERVER S.DB_ADDRESS S.REPL_ADDRESS)))";
-
-static char *rs_read_text =
-  "(seq (from SYS_REPL_SUBSCRIBERS (RS_SERVER RS_ACCOUNT RS_SUBSCRIBER RS_LEVEL RS_VALID) by SYS_REPL_SUBSCRIBERS prefix S)"
-  "  (select (S.RS_SERVER S.RS_ACCOUNT S.RS_SUBSCRIBER S.RS_VALID S.RS_LEVEL)))";
-
-static char *rs_save_text =
-  "insert replacing SYS_REPL_SUBSCRIBERS"
-  "    (RS_SERVER, RS_ACCOUNT, RS_SUBSCRIBER, RS_LEVEL, RS_VALID) "
-  "values (?, ?, ?, ?, ?)";
-
-static query_t *read_repl_qr;
-static query_t *ra_add_qr;
-static query_t *sa_read_qr;
-static query_t *rs_read_qr;
-static query_t *rs_save_qr;
-#if 0
-static query_t *ra_upd_qr;
-#endif
-
-
-repl_acct_t *
-ra_find (char * server, char * account)
-{
-  if (!account)
-    account = server;
-  DO_SET (repl_acct_t *, ra, &repl_accounts)
-  {
-    if (0 == strcmp (ra->ra_server, server) &&
-        0 == strcmp (ra->ra_account, account))
-      return ra;
-  }
-  END_DO_SET ();
-  return NULL;
-}
-
-repl_acct_t *
-ra_find_pushback (char * server, char * account)
-{
-  if (!account)
-    account = server;
-  DO_SET (repl_acct_t *, ra, &repl_accounts)
-  {
-    if (0 == strcmp (ra->ra_server, server) &&
-        RA_IS_PUSHBACK(ra->ra_account) &&
-        0 == strcmp (ra->ra_account + 1, account))
-      return ra;
-  }
-  END_DO_SET ();
-  return NULL;
-}
-
-repl_acct_t *
-ra_add (char *server, char *account, repl_level_t level, int mand, int is_updatable)
-{
-  char tmp[2000];
-  NEW_VARZ (repl_acct_t, ra);
-  if (!account)
-    account = server;
-  ra->ra_server = box_string (server);
-  ra->ra_account = box_dv_short_string (account);
-  ra->ra_level = level;
-  ra->ra_is_mandatory = mand;
-  ra->ra_is_updatable = is_updatable;
-  ra->ra_synced = RA_OFF;
-  snprintf (tmp, sizeof (tmp), "%s_%s_%s",
-          RA_IS_PUSHBACK(ra->ra_account) ? "replback" : "repl",
-          ra->ra_server, account);
-  ra->ra_sequence = box_string (tmp);
-  if (RA_IS_PUSHBACK(ra->ra_account))
-    {
-      snprintf (tmp, sizeof (tmp), "replbackpub_%s_%s", ra->ra_server, account);
-      ra->ra_pub_sequence = box_string (tmp);
-    }
-  ra->ra_parent = NULL;
-  ra->ra_subscribers = id_hash_allocate (
-      101, sizeof (caddr_t), sizeof (caddr_t), strhash, strhashcmp);
-  repl_accounts = dk_set_conc (repl_accounts, dk_set_cons ((caddr_t) ra, NULL));
-
-#if 0
-  dbg_printf_1 (("ra_server: '%s', ra_account: '%s', ra_sequence: '%s', ra_is_mandatory: %d, ra_is_updatable: %d",
-          ra->ra_server, ra->ra_account, ra->ra_sequence, ra->ra_is_mandatory,
-          ra->ra_is_updatable));
-#endif
-
-  return ra;
-}
-
-/*
- * Assumes that repl_accounts_mtx is held
- */
-repl_subscriber_t *
-rs_find (repl_acct_t *ra, char *subscriber)
-{
-  repl_subscriber_t **rs_ptr;
-  if (!ra)
-    return NULL;
-
-  rs_ptr = (repl_subscriber_t **) id_hash_get (
-      ra->ra_subscribers, (caddr_t) &subscriber);
-  return rs_ptr == NULL ? NULL : *rs_ptr;
-}
-
-/*
- * Add new subscriber for replication account
- *
- * Assumes that repl_accounts_mtx is held.
- * Assumes that subscriber does not exist in ra->ra_subscribers
- */
-static repl_subscriber_t *
-rs_add (repl_acct_t *ra, char *subscriber, int level, int valid)
-{
-  NEW_VARZ (repl_subscriber_t, rs);
-
-  subscriber = box_string (subscriber);
-  rs->rs_subscriber = box_string (subscriber);
-  rs->rs_level = level;
-  rs->rs_valid = valid;
-  id_hash_set (ra->ra_subscribers, (caddr_t) &subscriber, (caddr_t) &rs);
-  dbg_printf_1 (("rs_add: (%s, %s) (%s, %d, %d)",
-      ra->ra_server, ra->ra_account,
-      rs->rs_subscriber, rs->rs_level, rs->rs_valid));
-  rs = rs_find (ra, subscriber);
-  assert (rs != NULL);
-  return rs;
-}
-
-/*
- * Assumes that repl_accounts_mtx is held.
- * Assumes that rs does not exist in SYS_REPL_SUBSCRIBERS
- * and is already added to ra->ra_subscribers
- */
-static void
-save_subscriber (query_instance_t *qi,
-    repl_acct_t *ra, repl_subscriber_t *rs)
-{
-  caddr_t err;
-
-  dbg_printf_1 (("save_subscriber: (%s, %s) (%s, %d, %d)",
-      ra->ra_server, ra->ra_account,
-      rs->rs_subscriber, rs->rs_level, rs->rs_valid));
-  if (qi)
-    {
-      err = qr_rec_exec (rs_save_qr, qi->qi_client, NULL, qi, NULL, 5,
-          ":0", ra->ra_server, QRP_STR,
-          ":1", ra->ra_account, QRP_STR,
-          ":2", rs->rs_subscriber, QRP_STR,
-          ":3", (ptrlong) rs->rs_level, QRP_INT,
-          ":4", (ptrlong) rs->rs_valid, QRP_INT);
-      if ((caddr_t) SQL_SUCCESS != err)
-        sqlr_resignal (err);
-    }
-  else
-    {
-      lock_trx_t *lt;
-
-      mutex_enter (repl_uc_mtx);
-      IN_TXN;
-      lt = cli_set_new_trx (repl_util_cli);
-      lt_threads_set_inner (lt, 1);
-      lt->lt_replicate = REPL_LOG;
-      LEAVE_TXN;
-
-      err = qr_quick_exec (rs_save_qr, repl_util_cli, "", NULL, 5,
-          ":0", ra->ra_server, QRP_STR,
-          ":1", ra->ra_account, QRP_STR,
-          ":2", rs->rs_subscriber, QRP_STR,
-          ":3", (ptrlong) rs->rs_level, QRP_INT,
-          ":4", (ptrlong) rs->rs_valid, QRP_INT);
-      if ((caddr_t) SQL_SUCCESS != err)
-        {
-          IN_TXN;
-          lt_rollback (lt, TRX_CONT);
-	  lt_leave (lt);
-          LEAVE_TXN;
-          log_error ("repl_sync_acct: SQL Error: %s : %s",
-              ((caddr_t *) err)[1], ((caddr_t *) err)[2]);
-        }
-      else
-        {
-          IN_TXN;
-          lt_commit (lt, TRX_CONT);
-	  lt_leave (lt);
-          LEAVE_TXN;
-        }
-      mutex_leave (repl_uc_mtx);
-    }
-}
-
-repl_subscriber_t *
-repl_save_subscriber (repl_acct_t *ra, char *subscriber, int level, int valid)
-{
-  repl_subscriber_t *rs;
-
-  mutex_enter (repl_accounts_mtx);
-  if ((rs = rs_find(ra, subscriber)) == NULL)
-    rs = rs_add (ra, subscriber, level, valid);
-  else
-    {
-      rs->rs_level = level;
-      rs->rs_valid = valid;
-      dbg_printf_1 (("repl_save_subscriber_1: (%d, %d)",
-        rs->rs_level, rs->rs_valid));
-    }
-  save_subscriber (NULL, ra, rs);
-  mutex_leave (repl_accounts_mtx);
-
-  return rs;
-}
-
-repl_level_t
-ra_new_trx_no (lock_trx_t * lt, repl_acct_t * ra)
-{
-  repl_level_t  no;
-  ASSERT_IN_TXN;
-  if (!ra)
-    return 1;
-  no = sequence_next (ra->ra_sequence, INSIDE_MAP);
-  if (0 == no)
-    no = sequence_next (ra->ra_sequence, INSIDE_MAP);
-  if (REPL_WRAPAROUND == no)
-    {
-      caddr_t log_array;
-
-      log_array = list (4, box_string ("sequence_set (?, ?, ?)"),
-	    box_string (ra->ra_pub_sequence), box_num (1), box_num (SET_ALWAYS));
-      sequence_set (ra->ra_sequence, 1, SET_ALWAYS, INSIDE_MAP);
-      log_text_array (lt, log_array);
-      dk_free_tree (log_array);
-      no = sequence_next (ra->ra_sequence, INSIDE_MAP);
-    }
-#if 0
-  log_info ("ra_new_trx_no: %s: account %s: level %ld",
-      db_name, ra->ra_account, no);
-#endif
-  return no;
-}
-
-repl_level_t
-ra_trx_no (repl_acct_t * ra)
-{
-  return (sequence_set (ra->ra_sequence, 0, SEQUENCE_GET, OUTSIDE_MAP));
-}
-
-repl_level_t
-ra_pub_trx_no(repl_acct_t *ra)
-{
-  return (sequence_set (ra->ra_pub_sequence, 0, SEQUENCE_GET, OUTSIDE_MAP));
-}
-
-void
-ra_set_pub_trx_no(repl_acct_t *ra, repl_level_t level)
-{
-  lock_trx_t *lt;
-  caddr_t log_array;
-
-  log_array = list (4, box_string ("sequence_set (?, ?, ?)"),
-	box_string (ra->ra_pub_sequence), box_num (level), box_num (SET_ALWAYS));
-  mutex_enter (repl_uc_mtx);
-  IN_TXN;
-  lt = cli_set_new_trx (repl_util_cli);
-  lt_threads_set_inner (lt, 1);
-  lt->lt_replicate = REPL_LOG;
-  sequence_set (ra->ra_pub_sequence, level, SET_ALWAYS, INSIDE_MAP);
-  log_text_array (lt, log_array);
-  dk_free_tree (log_array);
-  lt_commit (lt, TRX_CONT);
-  lt_leave (lt);
-  LEAVE_TXN;
-  mutex_leave (repl_uc_mtx);
-}
-
-static server_addr_t *
-sa_find (char *server)
-{
-  DO_SET (server_addr_t *, sa, &servers)
-  {
-    if (0 == strcmp (sa->sa_server, server))
-      return sa;
-  }
-  END_DO_SET ();
-  return NULL;
-}
-
-static local_cursor_t *
-repl_qr_exec (query_t *qr, client_connection_t *cli, query_instance_t *qi)
-{
-  caddr_t err;
-  local_cursor_t *lc;
-
-  if (qi)
-    err = qr_rec_exec (qr, qi->qi_client, &lc, qi, NULL, 0);
-  else
-    err = qr_quick_exec (qr, cli, "", &lc, 0);
-  if ((caddr_t) SQL_SUCCESS != err)
-    sqlr_resignal (err);
-
-  return lc;
-}
-
-static void
-sa_read_db (client_connection_t * cli, query_instance_t * qi)
-{
-  local_cursor_t *lc;
-
-  if (!sa_read_qr)
-    {
-      sqlr_new_error ("08001", "TR072",
-          "Can't read replication addresses: NULL qr.");
-    }
-
-  lc = repl_qr_exec (sa_read_qr, cli, qi);
-  while (lc_next (lc))
-    {
-      char *server = lc_get_col (lc, "S.SERVER");
-      server_addr_t *sa = sa_find (server);
-      if (!sa)
-	{
-	  NEW_VARZ (server_addr_t, new_sa);
-	  sa = new_sa;
-	  dk_set_push (&servers, (void *) sa);
-	}
-      sa->sa_server = box_string (server);
-      sa->sa_repl_address = box_string (lc_get_col (lc, "S.REPL_ADDRESS"));
-      sa->sa_db_address = box_string (lc_get_col (lc, "S.DB_ADDRESS"));
-    }
-  lc_free (lc);
-}
-
-static ptrlong
-unbox_null_ck (caddr_t box)
-{
-  if (IS_BOX_POINTER (box) && box_tag (box) != DV_LONG_INT)
-    return 0;
-  else
-    return (unbox (box));
-}
-
-static void
-rs_read_db (client_connection_t *cli, query_instance_t *qi)
-{
-  local_cursor_t *lc;
-
-  if (!rs_read_qr)
-    {
-      sqlr_new_error ("08001", "TR072",
-          "Can't read replication subscribers: NULL qr.");
-    }
-
-  lc = repl_qr_exec (rs_read_qr, cli, qi);
-
-  DO_SET (repl_acct_t *, ra, &repl_accounts)
-    {
-      id_hash_clear (ra->ra_subscribers);
-    }
-  END_DO_SET ();
-
-  while (lc_next (lc))
-    {
-      char *server = lc_get_col (lc, "S.RS_SERVER");
-      char *account = lc_get_col (lc, "S.RS_ACCOUNT");
-      repl_acct_t *ra = ra_find (server, account);
-      repl_subscriber_t *rs;
-      char *subscriber;
-
-      if (!ra)
-        {
-          log_error ("rs_read_db: (%s, %s): No such replication account.",
-              server, account);
-          continue;
-        }
-
-      subscriber = lc_get_col (lc, "S.RS_SUBSCRIBER");
-      mutex_enter (repl_accounts_mtx);
-      if ((rs = rs_find (ra, subscriber)) == NULL)
-        {
-          rs_add (ra,
-              lc_get_col (lc, "S.RS_SUBSCRIBER"),
-              (int) unbox_null_ck (lc_get_col (lc, "S.RS_LEVEL")),
-              (int) unbox_null_ck (lc_get_col (lc, "S.RS_VALID")));
-        }
-      else
-        {
-          rs->rs_level = (int) unbox_null_ck (lc_get_col (lc, "S.RS_LEVEL"));
-          rs->rs_valid = (int) unbox_null_ck (lc_get_col (lc, "S.RS_VALID"));
-        }
-      mutex_leave (repl_accounts_mtx);
-    }
-  lc_free (lc);
-}
-
-static void
-ra_read_db (client_connection_t * cli, query_instance_t * qi, int read_levels)
-{
-  local_cursor_t *lc;
-
-  if (!read_repl_qr)
-    {
-      sqlr_new_error ("08001", "TR072",
-          "Can't read replication accounts: NULL qr.");
-    }
-
-  lc = repl_qr_exec (read_repl_qr, cli, qi);
-  while (lc_next (lc))
-    {
-      char *srv = lc_get_col (lc, "R.SERVER");
-      char *acct = lc_get_col (lc, "R.ACCOUNT");
-      repl_acct_t *ra = ra_find (srv, acct);
-      caddr_t dt, sync_user;
-
-      if (!repl_server_enable &&
-	  (!db_name || !srv || strcmp (db_name, srv) || !acct || strcmp (db_name, acct)))
-	{
-	  log_error (
-	      "The database has transactional replication roles defined, "
-	      "but the Server is not enabled for transactional replication."
-	      " Please re-enable the transactional replication support ("
-	      " by setting the INI setting ServerEnable to 1) and restart"
-	      " the server.");
-	  call_exit (-1);
-	}
-      if (!ra)
-	{
-	  ra = ra_add (srv, acct,
-	      (int) unbox_null_ck (lc_get_col (lc, "R.LEVEL")),
-	      (int) unbox_null_ck (lc_get_col (lc, "R.IS_MANDATORY")),
-	      (int) unbox_null_ck (lc_get_col (lc, "R.IS_UPDATEABLE")));
-	}
-      else if (read_levels)
-        {
-	  ra->ra_level = (int) unbox_null_ck (lc_get_col (lc, "R.LEVEL"));
-	}
-
-      if (ra->ra_sync_user)
-        dk_free_box (ra->ra_sync_user);
-      sync_user = lc_get_col (lc, "R.SYNC_USER");
-      if (IS_STRING_DTP (DV_TYPE_OF (sync_user)) &&
-          0 != strcmp (sync_user, ""))
-        ra->ra_sync_user = box_string (sync_user);
-      else
-        ra->ra_sync_user = box_string ("dba");
-
-      ra->ra_p_month = (int) unbox_null_ck (lc_get_col (lc, "R.P_MONTH"));
-      ra->ra_p_day = (int) unbox_null_ck (lc_get_col (lc, "R.P_DAY"));
-      ra->ra_p_wday = (int) unbox_null_ck (lc_get_col (lc, "R.P_WDAY"));
-      dt = lc_get_col (lc, "R.P_TIME");
-      if (ra->ra_p_time)
-        {
-          dk_free (ra->ra_p_time, sizeof (*ra->ra_p_time));
-          ra->ra_p_time = NULL;
-        }
-      if (DV_TYPE_OF (dt) == DV_DATETIME)
-        {
-          ra->ra_p_time = (TIME_STRUCT *) dk_alloc (sizeof (*ra->ra_p_time));
-          dt_to_time_struct (dt, ra->ra_p_time);
-          dbg_printf_1 (("%s: %d:%d",
-              acct, ra->ra_p_time->hour, ra->ra_p_time->minute));
-        }
-    }
-  lc_free (lc);
-  if (db_name)
-    {
-      if (!ra_find (db_name, db_name))
-	{
-          caddr_t err;
-
-	  ra_add (db_name, db_name, LEVEL_0, 0, 0);
-	  err = qr_quick_exec (ra_add_qr, cli, "", NULL, 4,
-	      ":N", (ptrlong) 0, QRP_INT,
-	      ":SR", db_name, QRP_STR,
-	      ":AC", db_name, QRP_STR,
-	      ":L", (ptrlong) 1, QRP_INT);
-          if (err != (caddr_t) SQL_SUCCESS)
-            sqlr_resignal (err);
-	}
-
-      /*
-       * link parent
-       */
-      DO_SET (repl_acct_t *, ra, &repl_accounts)
-        {
-          if (ra->ra_is_updatable &&
-              !RA_IS_PUSHBACK(ra->ra_account) &&
-              !!strcmp (ra->ra_server, db_name))
-            {
-              DO_SET (repl_acct_t *, ra2, &repl_accounts)
-                {
-                  if (ra2->ra_is_updatable &&
-                      RA_IS_PUSHBACK(ra2->ra_account) &&
-                      !strcmp(ra->ra_server, ra2->ra_server) &&
-                      !strcmp(ra->ra_account, ra2->ra_account + 1))
-                    {
-                      dbg_printf_1 (("(%s, %s) <- (%s, %s)",
-                          ra->ra_server, ra->ra_account,
-                          ra2->ra_server, ra2->ra_account));
-                      ra2->ra_parent = ra;
-                    }
-                }
-              END_DO_SET ();
-            }
-        }
-      END_DO_SET ();
-    }
-}
-
-#if 0
-void
-ra_update_db (client_connection_t * cli)
-{
-  DO_SET (repl_acct_t *, ra, &repl_accounts)
-  {
-    qr_quick_exec (ra_upd_qr, cli, "", NULL, 3,
-	":SR", ra->ra_server, QRP_STR,
-	":AC", ra->ra_account, QRP_STR,
-	":L", (ptrlong) ra->ra_level, QRP_INT);
-  }
-  END_DO_SET ();
-}
-#endif
-
-char *
-repl_server_to_address (char * srv)
-{
-  server_addr_t *sa = sa_find (srv);
-  if (sa)
-    return (sa->sa_repl_address);
-  else
-    return NULL;
-}
-
-int
-repl_sync_acct (repl_acct_t * ra, char * _usr, char * _pwd)
-{
-  char *usr, *pwd;
-  char *addr = repl_server_to_address (ra->ra_server);
-  int saved_stat = ra->ra_synced;
-  char *hashed_pwd;
-  char *subscriber_name;
-  dk_session_t *ses = NULL; /* PrpcFindPeer (ra->ra_server); */
-
-  if (!addr)
-    return -1;
-
-  usr = _usr ? _usr : ra->ra_usr;
-  pwd = _pwd ? _pwd : ra->ra_pwd;
-  if (!usr || !pwd) /* We must be sure that user/password are not null */
-    return -1;
-
-  if (RA_IN_SYNC == ra->ra_synced || RA_SYNCING == ra->ra_synced)
-    return 0;
-
-  ra->ra_synced = RA_SYNCING; /* because the connection can be slow we first set the status
-				     if can't connect revert the status */
-  if (!ses)
-    {
-      ses = repl_connect (addr, ra);
-      if (!ses || !DKSESSTAT_ISSET (ses, SST_OK))
-	{
-	  ra->ra_synced = saved_stat;
-	  sqlr_new_error ("08001", "TR072", "Replication connect to %s failed.", addr);
-	}
-    }
-
-  log_info ("Requesting sync from '%s' for '%s' level %ld.",
-      ra->ra_server, ra->ra_account, ra_trx_no (ra));
-  hashed_pwd = dk_alloc_box (17, DV_SHORT_STRING);
-  sec_login_digest (ses->dks_own_name, usr, pwd, (unsigned char *) hashed_pwd);
-  hashed_pwd[16] = 0;
-  subscriber_name = box_dv_short_string (db_name);
-  PrpcFutureFree (PrpcFuture (ses, &s_resync_acct,
-      ra->ra_account, ra_trx_no (ra), subscriber_name, usr, hashed_pwd));
-  dk_free_box (hashed_pwd);
-  dk_free_box (subscriber_name);
-
-  if (_usr)
-    {
-      dk_free_box (ra->ra_usr);
-      ra->ra_usr = box_copy (_usr);
-    }
-  if (_pwd)
-    {
-      dk_free_box (ra->ra_pwd);
-      ra->ra_pwd = box_copy (_pwd);
-    }
-  return 0;
-}
-
-#if 0
-static caddr_t *
-repl_make_spec (caddr_t * spec)
-{
-  caddr_t *repl;
-  int len;
-  if (!spec || !IS_POINTER (spec))
-    return spec;
-  if (!db_name)
-    return REPL_LOG;
-  len = box_length ((caddr_t) spec);
-  repl = (caddr_t *) dk_alloc_box (2 * sizeof (caddr_t) + len,
-      DV_ARRAY_OF_POINTER);
-  repl[REPLH_SERVER] = box_string (db_name);
-  repl[REPLH_ACCOUNT] = spec[0];
-  repl[REPLH_LEVEL] = 0;
-  memcpy (&repl[REPLH_CIRCULATION], &spec[1], len - sizeof (caddr_t));
-  dk_free_box (spec);
-  return (repl);
-}
-#endif
-
-void
-repl_read_db_levels (void)
-{
-  ra_read_db (bootstrap_cli, NULL, 1);
-  local_commit (bootstrap_cli);
-  IN_TXN;
-  lt_leave (bootstrap_cli->cli_trx);
-  LEAVE_TXN;
-}
-
-/* DISCONNECT REPLICATION command */
-
-static caddr_t
-bif_repl_disconnect (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
-{
-  caddr_t server = bif_string_arg (qst, args, 0, "repl_disconnect");
-  (void) err_ret;
-
-  if (0 == strlen (server))
-    server = NULL;
-
-  DO_SET (repl_acct_t *, ra, &repl_accounts)
-    {
-      dk_set_t peers;
-      char *peer_name;
-
-      if (server && 0 != strcmp (server, ra->ra_server))
-        goto next_acct;
-
-      peers = PrpcListPeers ();
-      peer_name = repl_peer_name (ra);
-      DO_SET (dk_session_t *, ses, &peers)
-        {
-          if (!ses->dks_peer_name || !!strcmp (ses->dks_peer_name, peer_name))
-            continue;
-
-          if (RA_IS_PUSHBACK(ra->ra_account))
-            repl_sub_dropped(&repl_push_queue, ses);
-          else
-            {
-	      PrpcDisconnect (ses);
-              ra->ra_synced = RA_DISCONNECTED;
-            }
-        }
-      END_DO_SET ();
-      dk_set_free (peers);
-      dk_free_box (peer_name);
-
-    next_acct:
-      ;
-    }
-  END_DO_SET ();
-
-  return 0;
-}
-
-static void
-repl_sync (repl_acct_t * ra, char * usr, char * pwd)
-{
-  if (ra->ra_is_updatable && repl_sync_updatable_acct (ra, usr, pwd) < 0)
-    return;
-
-  repl_sync_acct (ra, usr, pwd);
-}
-
-/* bif interface */
-
-static caddr_t
-bif_repl_sync (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
-{
-  repl_acct_t * ra;
-  query_instance_t *qi = (query_instance_t *) QST_INSTANCE (qst);
-  char * server = bif_string_arg (qst, args, 0, "repl_sync");
-  char * account = bif_string_arg (qst, args, 1, "repl_sync");
-  char * usr = bif_string_arg (qst, args, 2, "repl_sync");
-  char * pwd = bif_string_arg (qst, args, 3, "repl_sync");
-  (void) err_ret;
-
-  ra_read_db (NULL, qi, 0);
-  ra = ra_find (server, account);
-  if (!ra)
-    {
-      sqlr_new_error ("37000", "TR067",
-          "No replication account '%s' (server '%s')", account, server);
-    }
-
-  repl_sync (ra, usr, pwd);
-  return box_num (ra->ra_synced);
-}
-
-static caddr_t
-bif_repl_status (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
-{
-  char *source = bif_string_arg (qst, args, 0, "repl_status");
-  char *account = bif_string_arg (qst, args, 1, "repl_status");
-  repl_acct_t *ra;
-  (void) err_ret;
-
-  bif_arg (qst, args, 3, "repl_status"); /* check arg count */
-  ra = ra_find (source, account);
-  if (!ra)
-    sqlr_new_error ("37000", "TR068", "No such account");
-  if (RA_IS_PUSHBACK(ra->ra_account))
-    qst_set (qst, args[2], box_num (ra_pub_trx_no (ra)));
-  else
-    qst_set (qst, args[2], box_num (ra_trx_no (ra)));
-  qst_set (qst, args[3], box_num (ra->ra_synced));
-
-  PROCESS_ALLOW_SCHEDULE();
-  return NULL;
-}
-
-static caddr_t
-bif_this_server (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
-{
-  (void) qst;
-  (void) err_ret;
-  (void) args;
-
-  if (db_name)
-    {
-      caddr_t box = box_dv_short_string (db_name);
-      return box;
-    }
-  else
-    sqlr_new_error ("37000", "TR069", "Server must have a DBName entry in its ini file for replication");
-  return 0; /*dummy*/
-}
-
-static caddr_t
-bif_repl_new_log (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
-{
-  caddr_t srv = bif_string_arg (qst, args, 0, "repl_new_log");
-  caddr_t acct = bif_string_arg (qst, args, 1, "repl_new_log");
-  caddr_t file = bif_string_arg (qst, args, 2, "repl_new_log");
-  repl_acct_t *ra;
-  (void) err_ret;
-
-  if ((ra = ra_find (srv, acct)) == NULL)
-    {
-      sqlr_new_error ("42000", "TR098",
-          "Replication account missing for server '%s', account '%s'.",
-          srv, acct);
-    }
-
-  if (0 == strlen (file))
-    file = NULL;
-  repl_trail_new_file (ra, file, 1);
-  return 0;
-}
-
-static caddr_t
-bif_repl_changed (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
-{
-  query_instance_t * qi = (query_instance_t *) qst;
-  (void) err_ret;
-  (void) args;
-
-  sa_read_db (NULL, qi);
-  ra_read_db (NULL, qi, 0);
-  rs_read_db (NULL, qi);
-  return 0;
-}
-
-static caddr_t
-bif_repl_purge (caddr_t *qst, caddr_t *err_ret, state_slot_t **args)
-{
-  caddr_t srv = bif_string_arg (qst, args, 0, "repl_purge");
-  caddr_t acct = bif_string_arg (qst, args, 1, "repl_purge");
-  (void) err_ret;
-
-  repl_purge (srv, acct);
-  return 0;
-}
-
-static caddr_t
-bif_repl_add_subscriber (caddr_t *qst, caddr_t *err_ret, state_slot_t **args)
-{
-  query_instance_t * qi = (query_instance_t *) qst;
-  caddr_t srv = bif_string_arg (qst, args, 0, "repl_add_subscriber");
-  caddr_t acct = bif_string_arg (qst, args, 1, "repl_add_subscriber");
-  caddr_t subscriber = bif_string_arg (qst, args, 2, "repl_add_subscriber");
-  repl_acct_t *ra;
-  repl_subscriber_t *rs;
-  (void) err_ret;
-
-  if ((ra = ra_find (srv, acct)) == NULL)
-    {
-      sqlr_new_error ("42000", "TR099",
-          "Replication account '%s' from '%s' does not exist",
-          acct, srv);
-    }
-
-  mutex_enter (repl_accounts_mtx);
-  if (rs_find(ra, subscriber))
-    {
-      mutex_leave (repl_accounts_mtx);
-      sqlr_new_error ("42000", "TR100",
-          "Subscriber '%s' for account '%s' from '%s' already exists",
-          subscriber, acct, srv);
-    }
-  rs = rs_add (ra, subscriber, 0, 1);
-  save_subscriber (qi, ra, rs);
-  mutex_leave (repl_accounts_mtx);
-  return 0;
-}
-
-static caddr_t
-bif_repl_update_subscriber (caddr_t *qst, caddr_t *err_ret, state_slot_t **args)
-{
-  query_instance_t * qi = (query_instance_t *) qst;
-  caddr_t srv = bif_string_arg (qst, args, 0, "repl_update_subscriber");
-  caddr_t acct = bif_string_arg (qst, args, 1, "repl_update_subscriber");
-  caddr_t subscriber = bif_string_arg (qst, args, 2, "repl_update_subscriber");
-  repl_acct_t *ra;
-  repl_subscriber_t *rs;
-  (void) err_ret;
-
-  if ((ra = ra_find (srv, acct)) == NULL)
-    {
-      sqlr_new_error ("42000", "TR101",
-          "Replication account '%s' from '%s' does not exist",
-          acct, srv);
-    }
-
-  if ((rs = rs_find (ra, subscriber)) == NULL)
-    {
-      sqlr_new_error ("42000", "TR102",
-          "Subscriber '%s' for account '%s' from '%s' does not exist",
-          subscriber, acct, srv);
-    }
-
-  rs->rs_level = (int) bif_long_arg (qst, args, 3, "repl_update_subscriber");
-  rs->rs_valid = (int) bif_long_arg (qst, args, 4, "repl_update_subscriber");
-  save_subscriber (qi, ra, rs);
-  return 0;
-}
-
-static caddr_t
-bif_repl_is_pushback (caddr_t *qst, caddr_t *err_ret, state_slot_t **args)
-{
-  caddr_t account = bif_string_arg (qst, args, 1, "repl_update_subscriber");
-  (void) err_ret;
-
-  if (!account)
-    return 0;
-  return box_num (RA_IS_PUSHBACK(account));
-}
-
-/* Replication grants */
-#ifdef REPLICATION_SUPPORT2
-id_hash_t * repl_grants;
-static char *repl_grants_tbl =
-" create table SYS_TP_GRANT ( "
-"        TPG_ACCT 	varchar,"
-"        TPG_GRANTEE 	varchar,"
-" primary key (TPG_ACCT, TPG_GRANTEE))";
-
-static caddr_t
-bif_repl_grant (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
-{
-  caddr_t acct = bif_string_arg (qst, args, 0, "__repl_grants");
-  caddr_t grnt = bif_string_or_null_arg (qst, args, 1, "__repl_grants");
-  caddr_t gkey = NULL;
-  caddr_t g_copy = box_copy (grnt);
-  (void) err_ret;
-
-  if (acct == NULL)
-    sqlr_new_error ("22023", "TR065", "Replication account can not be empty");
-
-  if (grnt != NULL)
-    {
-      gkey = dk_alloc_box (box_length (acct) + box_length (grnt), DV_SHORT_STRING);
-      snprintf (gkey, box_length (gkey), "%s\n%s", acct, grnt);
-    }
-  else
-    {
-      gkey = dk_alloc_box (box_length (acct) + 1, DV_SHORT_STRING);
-      snprintf (gkey, box_length (gkey), "%s", acct);
-    }
-  id_hash_set (repl_grants, (caddr_t) & gkey, (caddr_t) & g_copy);
-  return (box_num (0));
-}
-
-static caddr_t
-bif_repl_revoke (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
-{
-  caddr_t acct = bif_string_arg (qst, args, 0, "__repl_revoke");
-  caddr_t grnt = bif_string_or_null_arg (qst, args, 1, "__repl_revoke");
-  caddr_t gkey = NULL;
-  caddr_t * kp = NULL;
-  caddr_t k;
-  caddr_t *place = NULL;
-  (void) err_ret;
-
-  if (acct == NULL)
-    sqlr_new_error ("22023", "TR066", "Replication account can not be empty");
-
-  if (grnt != NULL)
-    {
-      gkey = dk_alloc_box (box_length (acct) + box_length (grnt), DV_SHORT_STRING);
-      snprintf (gkey, box_length (gkey), "%s\n%s", acct, grnt);
-    }
-  else
-    {
-      gkey = dk_alloc_box (box_length (acct) + 1, DV_SHORT_STRING);
-      snprintf (gkey, box_length (gkey), "%s", acct);
-    }
-  place = (caddr_t*) id_hash_get (repl_grants, (caddr_t) & gkey);
-  if (place && *place)
-    {
-      kp = (caddr_t *) id_hash_get_key (repl_grants, (caddr_t) & gkey);
-      k = kp ? *kp : NULL;
-      if (k)
-	dk_free_box (k);
-      dk_free_tree (*place);
-      id_hash_remove (repl_grants, (caddr_t) & gkey);
-    }
-  dk_free_box (gkey);
-  return (box_num (0));
-}
-
-int
-get_repl_grants (char *acct, char *user)
-{
-  caddr_t * place;
-  caddr_t gkey = NULL;
-
-  place = (caddr_t *) id_hash_get (repl_grants, (caddr_t) & acct);
-  if (place)
-    return 1;
-  if (user == NULL)
-    return 0;
-  gkey = dk_alloc_box (strlen (acct) + strlen (user) + 2, DV_SHORT_STRING);
-  snprintf (gkey, box_length (gkey), "%s\n%s", acct, user);
-  place = (caddr_t *) id_hash_get (repl_grants, (caddr_t) & gkey);
-  dk_free_box (gkey);
-  if (place)
-    return 1;
-  return 0;
-}
-/*End replication grants */
-#endif
-
-query_t *
-repl_compile (char *text)
-{
-  caddr_t err = NULL;
-  query_t *qr = eql_compile_2 (text, bootstrap_cli, &err, SQLC_DEFAULT);
-  if (err)
-    {
-      log_error ("Error compiling a replication init statement: %s: %s -- %s",
-	  ((caddr_t *) err)[QC_ERRNO], ((caddr_t *) err)[QC_ERROR_STRING],
-          text);
-      dk_free_tree (err);
-      return NULL;
-    }
-  return qr;
-}
-
-void
-repl_init (void)
-{
-
-  if (!db_name)
-    {
-      db_name = box_string ("anonymous");
-    }
-
-  bif_define ("repl_sync", bif_repl_sync);
-  bif_define ("repl_status", bif_repl_status);
-  bif_define_typed ("repl_this_server", bif_this_server, &bt_varchar);
-  bif_define ("repl_new_log", bif_repl_new_log);
-  bif_define ("repl_changed", bif_repl_changed);
-  bif_define ("repl_disconnect", bif_repl_disconnect);
-  bif_define ("repl_purge", bif_repl_purge);
-  bif_define ("repl_add_subscriber", bif_repl_add_subscriber);
-  bif_define ("repl_update_subscriber", bif_repl_update_subscriber);
-  bif_define ("repl_is_pushback", bif_repl_is_pushback);
-#ifdef REPLICATION_SUPPORT2
-  bif_define ("__repl_grant", bif_repl_grant);
-  bif_define ("__repl_revoke", bif_repl_revoke);
-
-  repl_grants = id_str_hash_create (101);
-  ddl_ensure_table ("DB.DBA.SYS_TP_GRANT", repl_grants_tbl);
-  ddl_sel_for_effect ("select count (*) from SYS_TP_GRANT where __repl_grant (TPG_ACCT, TPG_GRANTEE)");
-#endif
-
-  repl_str_in = strses_allocate ();
-  repl_in_q_mtx = mutex_allocate ();
-  repl_ready_sem = semaphore_allocate (0);
-  repl_accounts_mtx = mutex_allocate ();
-
-  repl_thread = PrpcThreadAllocate ((thread_init_func) repl_base_loop,
-      REPL_THREAD_SZ, NULL);
-  if (!repl_thread)
-    {
-      log_error ("Can's start the server because it can't create a system thread. Exiting.");
-      GPF_T;
-    }
-
-  repl_cli = client_connection_create ();
-  repl_cli->cli_is_log = 1;
-  repl_util_cli = client_connection_create();
-  repl_util_cli->cli_is_log = 1;
-  repl_uc_mtx = mutex_allocate();
-
-  read_repl_qr = repl_compile (read_repl_text);
-  ra_add_qr = repl_compile (ra_add_text);
-  sa_read_qr = repl_compile (sa_read_text);
-  rs_read_qr = repl_compile (rs_read_text);
-  rs_save_qr = repl_compile (rs_save_text);
-#if 0
-  ra_upd_qr = eql_compile (ra_upd_text, bootstrap_cli);
-#endif
-
-  QR_RESET_CTX
-    {
-      sa_read_db (bootstrap_cli, NULL);
-      ra_read_db (bootstrap_cli, NULL, 0);
-      rs_read_db (bootstrap_cli, NULL);
-    }
-  QR_RESET_CODE
-    {
-      du_thread_t * self = THREAD_CURRENT_THREAD;
-      caddr_t err = thr_get_error_code (self);
-      log_error ("repl_init: SQL Error: %s : %s",
-          ((caddr_t *) err)[QC_ERRNO], ((caddr_t *) err)[QC_ERROR_STRING]);
-      dk_free_tree (err);
-    }
-  END_QR_RESET
-
-  local_commit (bootstrap_cli);
-  PrpcSuckAvidly (0);
-}
diff --git a/libsrc/Wi/replpush.c b/libsrc/Wi/replpush.c
deleted file mode 100644
index a67e977..0000000
--- a/libsrc/Wi/replpush.c
+++ /dev/null
@@ -1,831 +0,0 @@
-/*
- *  replpush.c
- *
- *  $Id: replpush.c,v 1.4.2.1 2009/04/18 21:55:13 source Exp $
- *
- *  Push replication subscriptions.
- *
- *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- *  project.
- *
- *  Copyright (C) 1998-2006 OpenLink Software
- *
- *  This project is free software; you can redistribute it and/or modify it
- *  under the terms of the GNU General Public License as published by the
- *  Free Software Foundation; only version 2 of the License, dated June 1991.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include "sqlnode.h"
-#include "log.h"
-#include "repl.h"
-#include "replsr.h"
-#include "wirpce.h"
-#include "security.h"
-#include "sqlbif.h"
-
-#define DKS_REPL_DATA(s) (*(repl_acct_t **) &(s)->dks_dbs_data)
-
-static int repl_push_log (void *);
-
-
-repl_queue_t repl_replay_queue;   /* replay queue (on publisher side) */
-repl_queue_t repl_push_queue;     /* push queue (on subscriber side) */
-resource_t *replay_rc;
-dk_session_t *replay_str_in;
-client_connection_t *replay_cli;
-
-static dk_set_t publishers;
-
-replay_message_t *
-rpm_allocate (void)
-{
-  NEW_VARZ (replay_message_t, rpm);
-  return rpm;
-}
-
-void
-rpm_free (replay_message_t * rpm)
-{
-  strses_free (rpm->rpm_ses);
-  dk_free_box (rpm->rpm_msg);
-  dk_free ((caddr_t) rpm, sizeof (replay_message_t));
-}
-
-void
-rpm_clear (replay_message_t * rpm)
-{
-  rpm->rpm_mode = 0;
-  rpm->rpm_ses = NULL;
-  rpm->rpm_msg = NULL;
-}
-
-static int
-publisher_dropped (dk_session_t * ses)
-{
-  repl_sub_dropped(&repl_push_queue, ses);
-  return 0;
-}
-
-static void
-repl_set_synced (repl_acct_t *ra, int synced, int disconnect_parent)
-{
-  if (disconnect_parent)
-    {
-      /* queue [publisher -> subscriber] disconnect */
-      dbg_printf_1 (("repl_set_synced: queuing parent disconnect: account '%s' (server '%s')",
-          ra->ra_account, ra->ra_server));
-      ra->ra_parent->ra_synced = RA_TO_DISCONNECT;
-    }
-  ra->ra_synced = synced;
-}
-
-static void
-repl_disconnect_publisher (subscription_t *sub, int synced, int disconnect_parent)
-{
-  repl_acct_t *ra = DKS_REPL_DATA(sub->sub_session);
-
-  dbg_printf_1 (("repl_disconnect_publisher: account '%s' (server '%s')",
-      ra->ra_account, ra->ra_server));
-  repl_set_synced (ra, synced, disconnect_parent);
-  sub_free (sub);
-}
-
-int
-repl_sync_updatable_acct (repl_acct_t *ra, char * _usr, char * _pwd)
-{
-  subscription_t *sub;
-
-  char *usr, *pwd;
-  char *addr;
-  char *hashed_pwd;
-  char *subscriber_name;
-  int saved_synced;
-  dk_session_t *ses = NULL; /* PrpcFindPeer (ra->ra_server); */
-  caddr_t res;
-  repl_acct_t *ra2;
-  repl_subscriber_t *rs;
-  repl_level_t level_at, pub_level;
-
-  ra2 = ra_find_pushback (ra->ra_server, ra->ra_account);
-  if (ra2 == NULL)
-    {
-      log_info ("repl_sync_updatable_acct: Can't find pushback account for updatable replication account '%s' (server '%s')",
-              ra->ra_account, ra->ra_server);
-      return -1;
-    }
-  ra = ra2;
-  if (ra->ra_parent == NULL)
-    {
-      log_info ("repl_sync_updatable_acct: NULL parent for account '%s' (server '%s')",
-              ra->ra_account, ra->ra_server);
-      return -1;
-    }
-  if (!ra->ra_rt)
-    {
-      log_info ("repl_sync_updatable_acct: No replication trail found for account '%s' (server '%s')\n",
-          ra->ra_account, ra->ra_server);
-      return -1;
-    }
-
-  usr = _usr ? _usr : ra->ra_usr;
-  pwd = _pwd ? _pwd : ra->ra_pwd;
-  if (!usr || !pwd) /* We must be sure that user/password are not null */
-    return -1;
-
-  addr = repl_server_to_address (ra->ra_server);
-  if (!addr)
-    return -1;
-
-  saved_synced = ra->ra_synced;
-  if (RA_IN_SYNC == ra->ra_synced || RA_SYNCING == ra->ra_synced)
-    return 0;
-
-  ra->ra_synced = RA_SYNCING; /* because the connection can be slow we first set the status
-				     if can't connect revert the status */
-  if (!ses)
-    {
-      ses = PrpcConnect (addr, SESCLASS_TCPIP);
-      if (!DKSESSTAT_ISSET (ses, SST_OK))
-        {
-          repl_set_synced (ra, saved_synced, 0);
-          PrpcDisconnect (ses);
-          PrpcSessionFree (ses);
-	  sqlr_new_error ("08001", "TR072", "Replication connect to '%s' failed.", addr);
-        }
-
-      if (!_thread_sched_preempt)
-	ses->dks_read_block_timeout = dks_fibers_blocking_read_default_to;
-      dk_free_box (ses->dks_peer_name);
-      ses->dks_peer_name = repl_peer_name (ra);
-      log_info ("repl_sync_updatable_acct: Connected to replication server '%s'.\n", addr);
-    }
-
-  pub_level = ra_pub_trx_no (ra);
-  level_at = ra_trx_no (ra);
-  log_info ("repl_sync_updatable_acct: Initiating sync for '%s' (server '%s') level %ld.",
-      ra->ra_account, ra->ra_server, pub_level);
-
-  hashed_pwd = dk_alloc_box (17, DV_SHORT_STRING);
-  sec_login_digest (ses->dks_own_name, usr, pwd, (unsigned char *) hashed_pwd);
-  hashed_pwd[16] = '\0';
-  subscriber_name = box_dv_short_string (db_name);
-  res = PrpcSync (PrpcFuture (ses, &s_resync_replay,
-      ra->ra_parent->ra_account, subscriber_name, usr, hashed_pwd));
-  PrpcCheckOut (ses);
-  SESSION_SCH_DATA (ses)->sio_default_read_ready_action = NULL;
-  dk_free_box (hashed_pwd);
-  dk_free_box (subscriber_name);
-  if (!unbox (res))
-    {
-      dk_free_box(res);
-      repl_set_synced (ra, saved_synced, 0);
-      PrpcDisconnect (ses);
-      PrpcSessionFree (ses);
-      sqlr_new_error ("08001", "TR080", "Login to '%s' as '%s' failed.",
-          ra->ra_server, usr);
-    }
-  dk_free_box(res);
-
-  if (_usr)
-    {
-      dk_free_box (ra->ra_usr);
-      ra->ra_usr = box_copy (_usr);
-    }
-  if (_pwd)
-    {
-      dk_free_box (ra->ra_pwd);
-      ra->ra_pwd = box_copy (_pwd);
-    }
-
-  if ((rs = rs_find (ra, ra->ra_server)) != NULL && !rs->rs_valid)
-    {
-      repl_set_synced (ra, saved_synced, 0);
-      PrpcDisconnect (ses);
-      PrpcSessionFree (ses);
-      sqlr_new_error ("08001", "TR094",
-          "Pushback account '%s' from '%s' is not valid (level %ld, pub level %ld)",
-          ra->ra_account, ra->ra_server, (long)level_at, (long)pub_level);
-    }
-  rs = repl_save_subscriber (
-      ra, ra->ra_server, pub_level, REPL_LEVEL_OK (pub_level, level_at));
-  if (!rs->rs_valid)
-    {
-      repl_set_synced (ra, saved_synced, 0);
-      PrpcDisconnect (ses);
-      PrpcSessionFree (ses);
-      sqlr_new_error ("08001", "TR095",
-          "Pushback account '%s' from '%s' is not valid (level %ld, pub level %ld)",
-          ra->ra_account, ra->ra_server, (long)level_at, (long)pub_level);
-    }
-
-  DKS_REPL_DATA (ses) = ra;
-  sub = sub_allocate (ra->ra_server, ra->ra_account, ses);
-
-  if (PrpcThreadAllocate (repl_push_log, future_thread_sz, sub) == NULL)
-    {
-       repl_disconnect_publisher (sub, saved_synced, 0);
-       sqlr_new_error ("08001", "TR093",
-          "Can's create a resync thread for '%s' (server '%s')",
-          ra->ra_account, ra->ra_server);
-    }
-
-  return 0;
-}
-
-/*
- * Assumes that rt->rt_lock is acquired for read
- */
-static dk_set_t
-repl_trail_find_first (repl_trail_t * rt, repl_level_t level)
-{
-  dk_set_t rtf_list, rtf_prev = NULL;
-
-  mutex_enter (rt->rt_mtx);
-  for (rtf_list = rt->rt_files; rtf_list != NULL;
-          rtf_prev = rtf_list, rtf_list = rtf_list->next)
-    {
-      repl_trail_file_t * rtf = (repl_trail_file_t *) rtf_list->data;
-
-      if (repl_is_below (level, rtf->rtf_level))
-        break;
-
-#if 0
-      dbg_printf_1 (("repl_trail_find_first: skipped '%s' (%ld <= %ld)",
-          rtf->rtf_file, rtf->rtf_level, level));
-#endif
-    }
-
-  if (rtf_prev == NULL)
-    rtf_prev = rt->rt_files;
-  mutex_leave (rt->rt_mtx);
-
-  return rtf_prev;
-}
-
-static int
-repl_push (repl_acct_t * ra, dk_session_t * ses, caddr_t * header,
-    dk_session_t * str_ses, caddr_t string, long bytes)
-{
-  caddr_t res;
-  int retval;
-  caddr_t *replh;
-  repl_level_t level;
-
-  mutex_enter (ses->dks_mtx);
-  CATCH_WRITE_FAIL (ses)
-    {
-      if (DKSESSTAT_ISSET (ses, SST_OK))
-        print_object ((caddr_t) header, ses, NULL, NULL);
-      if (DKSESSTAT_ISSET (ses, SST_OK))
-        {
-          if (str_ses != NULL)
-            strses_write_out (str_ses, ses);
-          else
-            session_buffered_chunked_write (ses, string, bytes);
-        }
-      session_flush_1 (ses);
-    }
-  END_WRITE_FAIL (ses);
-  mutex_leave (ses->dks_mtx);
-
-  if (!DKSESSTAT_ISSET (ses, SST_OK))
-    {
-      log_error ("repl_push: Can't send replication log");
-      return -1;
-    }
-
-  res = (caddr_t) PrpcReadObject (ses);
-  if (!DKSESSTAT_ISSET (ses, SST_OK))
-    {
-      log_error ("repl_push: Can't read result");
-      return -1;
-    }
-
-  if (0 == (retval = (int) unbox (res)))
-    {
-      log_error ("repl_push: Can't replay replication log on publisher");
-      return -1;
-    }
-  dk_free_box(res);
-
-  if (2 == retval)
-    {
-      /* handle resyncs here (XXX not implemented yet) */
-      log_info (("repl_push: Resync is not implemented yet"));
-    }
-
-  replh = (caddr_t *) header[LOGH_REPLICATION];
-#if 0
-  dbg_printf_1 (("repl_push: setting pub trx no to %ld",
-      unbox (replh[REPLH_LEVEL])));
-#endif
-  level = (repl_level_t) unbox (replh[REPLH_LEVEL]);
-  ra_set_pub_trx_no (ra, level);
-#ifdef REPL_SAVE_SUBSCRIBER_LEVEL
-  repl_save_subscriber (ra, ra->ra_server, level, 1);
-#endif
-  return 0;
-}
-
-static int
-repl_push_log (void *arg)
-{
-  subscription_t *sub = (subscription_t *) arg;
-  repl_acct_t *ra = DKS_REPL_DATA(sub->sub_session);
-  dk_session_t *ses = dk_session_allocate (SESCLASS_TCPIP);
-
-  volatile dk_set_t rtf_list;
-  volatile repl_level_t level_at;
-  repl_level_t level, level_back;
-  repl_trail_t *rt = ra->ra_rt;
-  caddr_t *header;
-
-  rwlock_rdlock (rt->rt_lock);
-  level_at = level = ra_pub_trx_no (ra);
-#if 0
-  dbg_printf_1 (("repl_push_log: account '%s' (server '%s'), level %d",
-      ra->ra_account, ra->ra_server, level));
-#endif
-
-  if ((rtf_list = repl_trail_find_first (rt, level)) == NULL)
-    {
-      log_info ("repl_push_log: No replication log files found for account '%s' (server '%s')\n",
-          ra->ra_account, ra->ra_server);
-      goto synced;
-    }
-
-  while (rtf_list)
-    {
-      repl_trail_file_t * rtf = (repl_trail_file_t *) rtf_list->data;
-      char * file = rtf->rtf_file;
-      int fd;
-
-      if ((fd = fd_open (file, OPEN_FLAGS_RO)) < 0)
-        {
-          if (errno == ENOENT && !strcmp(file, rt->rt_file_name) && !rt->rt_out)
-            {
-              dbg_printf_1 (("repl_push_log: (last) trail file is not created yet, ok"));
-              goto synced;
-            }
-          log_error ("repl_push_log: %s: %s", file, strerror (errno));
-          goto err;
-        }
-      tcpses_set_fd (ses->dks_session, fd);
-
-      for (;;)
-        {
-	  volatile long bytes;
-
-          /* see if we're at the end of last log */
-	  mutex_enter (rt->rt_mtx);
-          if (0 == strcmp (file, rt->rt_file_name))
-	    {
-	      OFF_T pos = LSEEK (fd, 0, SEEK_CUR);
-	      if (pos == rt->rt_commit_length
-		&& ses->dks_in_read == ses->dks_in_fill)
-	        {
-		  mutex_leave (rt->rt_mtx);
-                  fd_close (fd, file);
-		  goto synced;
-	        }
-	    }
-	  mutex_leave (rt->rt_mtx);
-
-	  header = (caddr_t *) PrpcReadObject (ses);
-	  if (!header || DKSESSTAT_ISSET (ses, SST_NOT_OK))
-            break;
-	  bytes = (long) unbox (header[LOGH_BYTES]);
-	  level_back = level_at;
-	  level_at = (repl_level_t) LOGH_LEVEL (header);
-#if 0
-          dbg_printf_1 (("repl_push_log: repl header: level %ld", level_at));
-#endif
-	  if (repl_is_below (level, level_at))
-	    {
-              int res;
-	      caddr_t string = (caddr_t) dk_alloc (bytes);
-
-	      CATCH_READ_FAIL (ses)
-	      {
-                session_buffered_read (ses, string, bytes);
-	      }
-	      FAILED
-	      { /* If reading failed we are in commit area after commit length,
-		 hence we send sync notice and go ahead */
-	        dk_free_tree ((caddr_t) header);
-	        dk_free (string, bytes);
-                level_at = level_back;
-	        fd_close (fd, file);
-	        goto synced;
-	      }
-	      END_READ_FAIL (ses);
-
-              res = repl_push (
-                  ra, sub->sub_session, header, NULL, string, bytes);
-              dk_free_tree ((caddr_t) header);
-              dk_free (string, bytes);
-              if (res < 0)
-                {
-                  fd_close(fd, file);
-                  log_error ("repl_push_log: Can't push replication log");
-                  goto err;
-                }
-	    }
-	  else
-	    {
-	      OFF_T off;
-	      dk_free_tree ((caddr_t) header);
-	      if (ses->dks_in_read + bytes < ses->dks_in_fill)
-	        {
-		  ses->dks_in_read += bytes;
-	        }
-	      else
-	        {
-		  bytes -= ses->dks_in_fill - ses->dks_in_read;
-		  off = LSEEK (fd, bytes, SEEK_CUR);
-		  ses->dks_in_fill = 0;
-		  ses->dks_in_read = 0;
-	        }
-	    }
-        }
-
-      fd_close (fd, file);
-
-      mutex_enter (rt->rt_mtx);
-      rtf_list = rtf_list->next;
-      mutex_leave (rt->rt_mtx);
-    }
-  log_error ("repl_push_log: No replication logs for level %ld", level);
-
-err:
-  rwlock_unlock (rt->rt_lock);
-  PrpcSessionFree (ses);
-  repl_disconnect_publisher (sub, RA_DISCONNECTED, 0);
-  return -1;
-
-synced:
-  rwlock_unlock (rt->rt_lock);
-  PrpcSessionFree (ses);
-  ra->ra_synced = RA_IN_SYNC;
-  sub->sub_session->dks_is_server = 0; /* no auto dealloc when dead hook called */
-  PrpcSetPartnerDeadHook (sub->sub_session, publisher_dropped);
-  repl_sub_synced (sub, level_at);
-  return 0;
-}
-
-void
-repl_push_loop (void)
-{
-  for (;;)
-    {
-      repl_message_t *rm;
-      caddr_t *header;
-      dk_session_t *string;
-      caddr_t *replh;
-
-      repl_queue_t *rq = &repl_push_queue;
-
-      dk_set_t publist = publishers;
-
-      semaphore_enter (rq->rq_sem);
-      mutex_enter (rq->rq_mtx);
-      rm = (repl_message_t *) basket_get (&rq->rq_basket);
-      header = rm->rm_header;
-      string = rm->rm_string;
-      if (IS_BOX_POINTER (header))
-	rq->rq_bytes -= (long) unbox (header[LOGH_BYTES]);
-      mutex_leave (rq->rq_mtx);
-
-      if (header == REPL_QUEUE_FULL)
-	{
-          DO_SET (subscription_t *, sub, &publishers)
-            {
-              repl_disconnect_publisher (sub, RA_DISCONNECTED, 1);
-            }
-          END_DO_SET ();
-          dk_set_free (publishers);
-          publishers = NULL;
-          mutex_enter (rq->rq_mtx);
-          rq->rq_to_disconnect = 0;
-          mutex_leave (rq->rq_mtx);
-	  rm_free (rm);
-	  continue;
-	}
-
-      if (header == REPL_QUEUE_SYNCED)
-	{
-	  dk_set_push (&publishers, (void *) rm->rm_synced_sub);
-	  PrpcCheckIn (rm->rm_synced_sub->sub_session);
-	  rm_free (rm);
-	  continue;
-	}
-
-      if (header == REPL_QUEUE_DISCONNECT)
-	{
-	  DO_SET (subscription_t *, sub, &publishers)
-	    {
-	      if (sub->sub_session == rm->rm_data)
-		{
-		  dk_set_delete (&publishers, (void *) sub);
-                  repl_disconnect_publisher (sub, RA_DISCONNECTED, 1);
-		  break;
-		}
-	    }
-	  END_DO_SET();
-	  rm_free (rm);
-	  continue;
-	}
-
-      if (header == REPL_PURGE)
-        {
-          repl_acct_t *ra = ra_find (rm->rm_srv, rm->rm_acct);
-          if (!ra)
-            {
-              log_error ("Log purge for non-existent account '%s' from '%s' requested.",
-                  rm->rm_acct, rm->rm_srv);
-              continue;
-            }
-          rm_free (rm);
-          repl_purge_run (ra);
-          continue;
-        }
-
-      replh = (caddr_t *) header[LOGH_REPLICATION];
-      publist = publishers;
-#if 0
-      log_debug ("repl_push_loop: start");
-#endif
-      while (publist)
-	{
-	  dk_set_t pub_next = publist->next;
-	  subscription_t *sub = (subscription_t *) publist->data;
-          repl_acct_t *ra = DKS_REPL_DATA(sub->sub_session);
-
-#if 0
-          log_debug ("repl_push_loop: '%s' (%s)", sub->sub_account, sub->sub_subscriber_name);
-#endif
-	  if (0 == strcmp (sub->sub_subscriber_name, ra->ra_parent->ra_server) &&
-              0 == strcmp (sub->sub_account, replh[REPLH_ACCOUNT]))
-            {
-              if (repl_push (ra, sub->sub_session, header, string, NULL, 0) < 0)
-                {
-#if 0
-                  dbg_printf_1 (("repl_push_loop: repl_push failed: disconnecting publisher"));
-#endif
-		  dk_set_delete (&publishers, (void *) sub);
-                  repl_disconnect_publisher (sub, RA_DISCONNECTED, 1);
-                }
-	    }
-
-	  publist = pub_next;
-	}
-#if 0
-      log_debug ("repl_push_loop: end");
-#endif
-
-      rm_free (rm);
-    }
-}
-
-static int
-repl_replay_session_dropped (dk_session_t * ses)
-{
-  if (DKSESSTAT_ISSET (ses, SST_NOT_OK))
-    remove_from_served_sessions (ses);
-  return 0;
-}
-
-static void
-replay_message_add (int mode, dk_session_t * ses, caddr_t msg)
-{
-  repl_queue_t *rq = &repl_replay_queue;
-  replay_message_t *rpm;
-
-  rpm = (replay_message_t *) resource_get (replay_rc);
-  rpm->rpm_mode = mode;
-  rpm->rpm_ses = ses;
-  rpm->rpm_msg = msg;
-
-  mutex_enter (rq->rq_mtx);
-  basket_add (&rq->rq_basket, (void *) rpm);
-  mutex_leave (rq->rq_mtx);
-
-  semaphore_leave (rq->rq_sem);
-}
-
-static int
-repl_replay_input_ready (dk_session_t * ses)
-{
-  remove_from_served_sessions (ses);
-  replay_message_add(RPM_IN, ses, NULL);
-  return 0;
-}
-
-
-caddr_t
-sf_resync_replay (char *account, char *subscriber_name,
-        caddr_t name, caddr_t digest)
-{
-  user_t * user;
-  dk_session_t *client = IMMEDIATE_CLIENT;
-  repl_acct_t *ra;
-
-  ra = ra_find (db_name, account);
-  if (ra == NULL)
-    {
-      log_info ("Resync of non-existent account '%s' initiated by '%s'.",
-          account, subscriber_name);
-      PrpcDisconnect (client);
-      return box_num(0);
-    }
-  DKS_REPL_DATA(client) = ra;
-
-  user = sec_check_login (name, digest, client);
-/* Check grants */
-#ifdef REPLICATION_SUPPORT2
-  if (!user)
-    {
-      log_info ("Bad replication login '%s' for account '%s' from '%s'.",
-		name, account, subscriber_name);
-      PrpcDisconnect (client);
-      return box_num(0);
-    }
-  if (!sec_user_has_group (G_ID_DBA, user->usr_id))
-    {
-      int kpg = 0;
-      kpg = get_repl_grants (account, name);
-      if (!kpg)
-	{
-	  log_info ("User '%s' does not have privileges for account '%s' from '%s'.",
-	      name, account, subscriber_name);
-          PrpcDisconnect (client);
-	  return box_num(0);
-	}
-    }
-#else
-  if (!user || !sec_user_has_group (G_ID_DBA, user->usr_id))
-    {
-      log_info ("Bad replication login '%s' for account '%s' from '%s' (not in DBA group).",
-	  name, account, subscriber_name);
-      PrpcDisconnect (client);
-      return box_num(0);
-    }
-#endif
-/* End check grants */
-
-  client->dks_is_server = 0; /* no auto dealloc when dead hook called */
-  PrpcSetPartnerDeadHook (client, repl_replay_session_dropped);
-  SESSION_SCH_DATA (client)->sio_default_read_ready_action =
-      repl_replay_input_ready;
-  mutex_enter (thread_mtx);
-  if (client->dks_thread_state == DKST_BURST)
-    {
-      thrs_printf ((thrs_fo, "ses %p thr:%p going from burst to idle for sf_resync_replay\n",
-	    client, THREAD_CURRENT_THREAD));
-      client->dks_thread_state = DKST_IDLE;
-      PrpcCheckInAsync (client);
-    }
-  mutex_leave (thread_mtx);
-  return box_num(1);
-}
-
-static void
-replay_session_cleanup (dk_session_t *ses)
-{
-  DKS_REPL_DATA (ses) = NULL;
-}
-
-static int
-replay_process_msg (dk_session_t * ses)
-{
-  scheduler_io_data_t trx_sio;
-  caddr_t *header;
-  volatile int bytes;
-  volatile caddr_t trx_string = NULL;
-  int res;
-  volatile repl_acct_t *ra;
-
-  header = (caddr_t *) PrpcReadObject (ses);
-  if (!header || DKSESSTAT_ISSET (ses, SST_BROKEN_CONNECTION)
-      || !repl_check_header(header))
-    goto seserr;
-
-  bytes = (long) unbox (header[LOGH_BYTES]);
-  trx_string = (caddr_t) dk_alloc(bytes);
-  CATCH_READ_FAIL (ses)
-  {
-    session_buffered_read (ses, trx_string, bytes);
-  }
-  FAILED
-  {
-    goto seserr;
-  }
-  END_READ_FAIL (ses);
-
-  memset (&trx_sio, 0, sizeof (trx_sio));
-  if (!SESSION_SCH_DATA (replay_str_in))
-    SESSION_SCH_DATA (replay_str_in) = &trx_sio;
-  replay_str_in->dks_in_buffer = trx_string;
-  replay_str_in->dks_in_read = 0;
-  replay_str_in->dks_in_fill = bytes;
-  replay_cli->cli_session = ses;
-  ra = DKS_REPL_DATA(ses);
-  if (!set_user_id (replay_cli, ra->ra_sync_user, NULL))
-    {
-      log_error ("Can't set user to '%s' for account '%s'.",
-          ra->ra_sync_user, ra->ra_account);
-      goto seserr;
-    }
-  res = log_replay_trx (replay_str_in, replay_cli, (caddr_t) header, 1, 1);
-  if (LTE_OK == res)
-    {
-      replay_message_add (RPM_OUT, ses, box_num(1));
-    }
-  else if (LTE_REJECT == res)
-    {
-      replay_message_add (RPM_OUT, ses, box_num(2));
-    }
-  else
-    {
-      replay_message_add (RPM_OUT, ses, box_num(0));
-    }
-  dk_free_tree ((caddr_t) header);
-  dk_free (trx_string, bytes);
-  return 0;
-
-seserr:
-  dk_free_tree ((caddr_t) header);
-  if (trx_string != NULL)
-    dk_free (trx_string, bytes);
-  PrpcCheckOut (ses);
-  PrpcDisconnect (ses);
-  PrpcSessionFree (ses);
-  return -1;
-}
-
-void
-repl_replay_loop (void)
-{
-  for (; ;)
-    {
-      repl_queue_t *rq = &repl_replay_queue;
-      replay_message_t *rpm;
-
-      int mode;
-      dk_session_t *ses;
-      caddr_t msg;
-
-      semaphore_enter (rq->rq_sem);
-      mutex_enter (rq->rq_mtx);
-      rpm = (replay_message_t *) basket_get (&rq->rq_basket);
-      mode = rpm->rpm_mode;
-      ses = rpm->rpm_ses;
-      msg = rpm->rpm_msg;
-      resource_store (replay_rc, (void *) rpm);
-      mutex_leave (rq->rq_mtx);
-
-      if (!DKSESSTAT_ISSET (ses, SST_OK))
-	{
-          replay_session_cleanup (ses);
-          PrpcCheckOut (ses);
-	  PrpcDisconnect (ses);
-	  PrpcSessionFree (ses);
-	  continue;
-	}
-
-      /* do operation */
-      switch (mode)
-	{
-	  case RPM_IN:
-            if (replay_process_msg(ses) == 0)
-	      PrpcCheckInAsync (ses);
-	    break;
-
-	  case RPM_OUT:
-	    PrpcWriteObject (ses, msg);
-	    if (!DKSESSTAT_ISSET (ses, SST_OK))
-              {
-		replay_session_cleanup (ses);
-                PrpcCheckOut (ses);
-		PrpcDisconnect (ses);
-		PrpcSessionFree (ses);
-              }
-	    break;
-
-	  default:
-	      break;
-	}
-
-      dk_free_tree (msg);
-    }
-}
diff --git a/libsrc/Wi/replsri.c b/libsrc/Wi/replsri.c
deleted file mode 100644
index 72dbe50..0000000
--- a/libsrc/Wi/replsri.c
+++ /dev/null
@@ -1,1233 +0,0 @@
-/*
- *  replsri.c
- *
- *  $Id: replsri.c,v 1.4.2.4 2010/05/21 12:40:48 source Exp $
- *
- *  Replication Server Process
- *
- *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- *  project.
- *
- *  Copyright (C) 1998-2006 OpenLink Software
- *
- *  This project is free software; you can redistribute it and/or modify it
- *  under the terms of the GNU General Public License as published by the
- *  Free Software Foundation; only version 2 of the License, dated June 1991.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include "sqlnode.h"
-#include "log.h"
-#include "repl.h"
-#include "replsr.h"
-#include "sqlbif.h"
-#include "wirpce.h"
-#include "security.h"
-#include "datesupp.h"
-
-#ifdef WIN32
-#include "wiservic.h"
-#endif
-
-
-static resource_t * tr_rc;
-static char REPL_CFG[] = "repl.cfg";
-static char REPL_CFG_TMP[] = "repl.cfg~";
-static dk_mutex_t *cfg_mtx;
-
-static repl_trail_t *repl_trail_add (repl_acct_t *ra, char * file);
-
-static void
-repl_queue_init (repl_queue_t *rq)
-{
-  rq->rq_mtx = mutex_allocate ();
-  rq->rq_sem = semaphore_allocate (0);
-}
-
-static int
-repl_write_extra_log (repl_acct_t *ra, caddr_t * head, dk_session_t * string)
-{
-  volatile int rc = LTE_OK;
-  OFF_T len_before;
-  repl_trail_t *rt;
-
-  if (!ra || (rt = ra->ra_rt) == NULL)
-    return LTE_OK;
-
-  if (!rt->rt_out)
-    {
-      repl_trail_file_t *rtf = (repl_trail_file_t *) dk_set_last (rt->rt_files)->data;
-      char *f_name = rtf->rtf_file;
-      int fd;
-
-      file_set_rw (f_name);
-      fd = fd_open (f_name, OPEN_FLAGS);
-      if (fd < 0)
-	{
-	  log_error ("Can't open replication log '%s'.", f_name);
-	  return LTE_LOG_FAILED;
-	}
-      rt->rt_out = dk_session_allocate (SESCLASS_TCPIP);
-      tcpses_set_fd (rt->rt_out->dks_session, fd);
-      LSEEK (fd, 0, SEEK_END);
-    }
-
-  len_before = LSEEK (tcpses_get_fd (rt->rt_out->dks_session), 0, SEEK_CUR);
-  CATCH_WRITE_FAIL (rt->rt_out)
-    {
-      print_object ((caddr_t) head, rt->rt_out, NULL, NULL);
-      strses_write_out (string, rt->rt_out);
-      session_flush_1 (rt->rt_out);
-      if (rt->rt_out->dks_bytes_sent > rt->rt_bytes_per_file)
-	repl_trail_new_file (ra, NULL, 1);
-    }
-  FAILED
-    {
-      FTRUNCATE (tcpses_get_fd (rt->rt_out->dks_session), len_before);
-      rt->rt_out->dks_bytes_sent = len_before;
-      rc = LTE_LOG_FAILED;
-    }
-  END_WRITE_FAIL (rt->rt_out);
-
-  return rc;
-}
-
-void
-rm_free (repl_message_t * rm)
-{
-  dk_session_t * strses = rm->rm_string;
-  dk_free_box (rm->rm_srv);
-  dk_free_box (rm->rm_acct);
-  dk_free_tree ((box_t) rm->rm_header);
-  if (rm->rm_log_file)
-    dk_free_box (rm->rm_log_file);
-  memset (rm, 0, sizeof (repl_message_t));
-  rm->rm_string = strses;
-  resource_store (tr_rc, (void*) rm);
-}
-
-int
-repl_is_below (repl_level_t log, repl_level_t req)
-{
-  if (log <= req && req - log < REPL_MAX_DELTA)
-    return log < req;
-  if (log > REPL_WRAPAROUND - REPL_MAX_DELTA && req < REPL_MAX_DELTA)
-    return 1;
-  return 0;
-}
-
-#if 0
-dk_set_t
-repl_trail_start_pos (repl_trail_t * rt, repl_level_t level)
-{
-  repl_trail_file_t ** rtfs = (repl_trail_file_t **)
-    dk_set_to_array (rt->rt_files);
-  repl_trail_file_t * rtf = NULL;
-  int n_files = BOX_ELEMENTS (rtfs);
-  int inx;
-  for (inx = n_files - 1; inx >= 0; inx--)
-    {
-      if (repl_is_below (rtfs[inx]->rtf_level, level))
-	{
-	  rtf = rtfs[inx];
-	  break;
-	}
-    }
-  dk_free_box ((caddr_t) rtfs);
-  if (!rtf)
-    return (rt->rt_files);
-  return (dk_set_member (rt->rt_files, (void*) rtf));
-}
-#endif
-
-#define MAX_TO_GO_UNCHUNKED   2048
-
-int
-session_buffered_chunked_write (dk_session_t * ses, char *buffer, int length)
-{
-  if (length <= MAX_TO_GO_UNCHUNKED)
-    {
-      return session_buffered_write (ses, buffer, length);
-    }
-  else
-    {
-      int chunk_sz, inx = 0;
-      while (inx < length)
-	{
-	  chunk_sz = length - inx > MAX_TO_GO_UNCHUNKED ? MAX_TO_GO_UNCHUNKED : length - inx;
-	/*  fprintf (stderr, "REPL write : %d bytes %d remaining\n", chunk_sz, length - inx);*/
-	  session_buffered_write (ses, buffer + inx, chunk_sz);
-/*	  session_flush_1 (ses);*/
-	  inx += chunk_sz;
-	}
-      return 0;
-    }
-}
-
-#if 0
-static int
-session_buffered_chunked_read (dk_session_t * ses, char *buffer, int length)
-{
-  if (length <= MAX_TO_GO_UNCHUNKED)
-    {
-      return session_buffered_read (ses, buffer, length);
-    }
-  else
-    {
-      int chunk_sz, inx = 0;
-      while (inx < length)
-	{
-	  chunk_sz = length - inx > MAX_TO_GO_UNCHUNKED ? MAX_TO_GO_UNCHUNKED : length - inx;
-	  session_buffered_read (ses, buffer + inx, chunk_sz);
-	  inx += chunk_sz;
-	}
-      return 0;
-    }
-}
-#endif
-
-/**
- * Create new replication trail file description
- */
-static repl_trail_file_t *
-rtf_allocate (char * file, repl_level_t level)
-{
-  NEW_VARZ (repl_trail_file_t, rtf);
-  rtf->rtf_file = box_string (file);
-  rtf->rtf_level = level;
-  return rtf;
-}
-
-static void
-rtf_free (repl_trail_file_t *rtf)
-{
-  dk_free_box (rtf->rtf_file);
-  dk_free (rtf, sizeof (*rtf));
-}
-
-static void
-rtf_list_free (dk_set_t rtf_list)
-{
-  DO_SET (repl_trail_file_t *, rtf, &rtf_list)
-    {
-      rtf_free (rtf);
-    }
-  END_DO_SET ();
-  dk_set_free (rtf_list);
-}
-
-static void
-repl_cfg_writeln (FILE *cfg, repl_acct_t *ra, char *filename)
-{
-    if (0 == strcmp (db_name, ra->ra_server))
-      fprintf (cfg, "%-20s %s\n", ra->ra_account, filename);
-    else
-      {
-        fprintf (cfg, "%-20s %-20s %s\n",
-            ra->ra_server, ra->ra_account, filename);
-      }
-}
-
-void
-repl_trail_new_file (repl_acct_t *ra, char *file, int lock)
-{
-  repl_trail_file_t * rtf = NULL;
-  repl_trail_t *rt = ra->ra_rt;
-  OFF_T len;
-
-#if 0
-  dbg_printf_1 (("repl_trail_new_file: srv '%s', acct '%s'",
-      ra->ra_server, ra->ra_account));
-#endif
-  if (!rt)
-    rt = repl_trail_add (ra, file);
-  if (!file)
-    file = log_new_name (rt->rt_file_name);
-  if (lock)
-    rwlock_rdlock (rt->rt_lock);
-  mutex_enter (rt->rt_mtx);
-  if (rt->rt_out)
-    {
-      int new_fd;
-      int fd = tcpses_get_fd (rt->rt_out->dks_session);
-
-      file_set_rw (file);
-      new_fd = fd_open (file, OPEN_FLAGS);
-      if (new_fd < 0)
-	{
-	  log_error ("Cannot open new replication log '%s': %s (errno %d).",
-              file, strerror(errno), errno);
-	  mutex_leave (rt->rt_mtx);
-          if (lock)
-            rwlock_unlock (rt->rt_lock);
-          return;
-	}
-      fd_close (fd, NULL);
-      len = LSEEK (new_fd, 0, SEEK_END); /* if switched w/in 1 sec, the same file gets reopened. Append */
-      tcpses_set_fd (rt->rt_out->dks_session, new_fd);
-      rt->rt_out->dks_bytes_sent = len;
-      rt->rt_commit_length = len;
-    }
-
-  rtf = rtf_allocate (
-      file, sequence_set (ra->ra_sequence, 0, SEQUENCE_GET, INSIDE_MAP));
-  rt->rt_files = dk_set_conc (rt->rt_files,
-      dk_set_cons ((caddr_t) rtf, NULL));
-
-  dk_free_box (rt->rt_file_name);
-  rt->rt_file_name = box_string (file);
-  log_info ("Started replication log '%s'.", rt->rt_file_name);
-  {
-    FILE *cfg;
-
-    mutex_enter (cfg_mtx);
-    cfg = fopen (REPL_CFG, "a");
-    if (cfg == NULL)
-      {
-        log_error ("Can't open '%s' for append: %s (errno %d)",
-            REPL_CFG, strerror (errno), errno);
-      }
-    else
-      {
-        repl_cfg_writeln (cfg, ra, rt->rt_file_name);
-        fclose (cfg);
-      }
-    mutex_leave (cfg_mtx);
-  }
-  mutex_leave (rt->rt_mtx);
-  if (lock)
-    rwlock_unlock (rt->rt_lock);
-}
-
-/**
- * Add replication trail for specified account
- *
- * @param account account
- */
-static repl_trail_t *
-repl_trail_add (repl_acct_t *ra, char * file)
-{
-  NEW_VARZ (repl_trail_t, rt);
-
-#if 0
-  dbg_printf_1 (("repl_trail_add: srv '%s', account '%s'", srv, account));
-#endif
-  rt->rt_mtx = mutex_allocate ();
-  rt->rt_lock = rwlock_allocate ();
-  rt->rt_bytes_per_file = 10000000;
-  if (file)
-    rt->rt_file_name = box_string (file);
-  else
-    {
-      char *prefix;
-      char *account = ra->ra_account;
-
-      /* skip first '!' */
-      if (RA_IS_PUSHBACK(account))
-        {
-          prefix = "replback_";
-          account++;
-        }
-      else
-        prefix = "repl_";
-
-      rt->rt_file_name = dk_alloc_box (
-          strlen(prefix) + strlen (ra->ra_server) + 1 + strlen (account) + 1 + 1,
-          DV_SHORT_STRING);
-      strcpy_box_ck (rt->rt_file_name, prefix);
-      strcat_box_ck (rt->rt_file_name, ra->ra_server);
-      strcat_box_ck (rt->rt_file_name, "_");
-      strcat_box_ck (rt->rt_file_name, account);
-      strcat_box_ck (rt->rt_file_name, "_");
-    }
-  ra->ra_rt = rt;
-  return rt;
-}
-
-/**
- * Read log start level from file
- */
-static repl_level_t
-repl_log_start_level (char * name)
-{
-  repl_level_t volatile level = -1;
-  dk_session_t * ses;
-  caddr_t * head;
-  int fd;
-
-  if ((fd = fd_open (name, O_RDONLY | O_BINARY)) < 0)
-    return -1;
-  ses = dk_session_allocate (SESCLASS_TCPIP);
-  tcpses_set_fd (ses->dks_session, fd);
-  CATCH_READ_FAIL (ses)
-    {
-      head = (caddr_t*) read_object (ses);
-      if (IS_BOX_POINTER (head) && head[LOGH_REPLICATION])
-	{
-	  caddr_t * repl = (caddr_t*) head[LOGH_REPLICATION];
-	  level = (repl_level_t) unbox (repl[REPLH_LEVEL]);
-	}
-    }
-  FAILED
-    {
-      level = -1;
-    }
-  END_READ_FAIL (ses);
-  close (fd);
-  PrpcSessionFree (ses);
-  return level;
-}
-
-/**
- * Read repl.cfg
- *
- * Read replication trails and set their log start level
- */
-static void
-repl_read_cfg (void)
-{
-  repl_trail_file_t * rtf;
-  FILE *cfg_file;
-  char cfg_line[100];
-  char srv[100];
-  char acct[100];
-  char file[100];
-  repl_trail_t * volatile rt;
-
-  cfg_file = fopen (REPL_CFG, "r");
-  if (cfg_file)
-    {
-      while (fgets (cfg_line, sizeof (cfg_line), cfg_file))
-	{
-          repl_level_t level;
-          char *curr_db_name;
-          repl_acct_t *ra;
-
-	  if (1 == sscanf (cfg_line, "db_name: %s", acct))
-	    {
-              if (db_name)
-                dk_free_box (db_name);
-              db_name = box_string (acct);
-	      continue;
-	    }
-
-          if (3 == sscanf (cfg_line, "%s %s %s", srv, acct, file))
-            curr_db_name = srv;
-          else if (2 == sscanf (cfg_line, "%s %s", acct, file))
-	    {
-	      if (!db_name)
-		{
-		  log_error ("Add a db_name: line to repl.cfg");
-		  call_exit (1);
-		}
-              curr_db_name = db_name;
-            }
-          else
-            continue;
-
-	  if (!repl_server_enable)
-	    {
-	      log_error (
-		  "The repl.cfg has transactional replication roles defined, "
-		  "but the Server is not enabled for transactional replication."
-		  " Please re-enable the transactional replication support ("
-		  " by setting the INI setting ServerEnable to 1) and restart"
-		  " the server.");
-	      call_exit (-1);
-	    }
-          ra = ra_find (curr_db_name, acct);
-          if (!ra)
-            {
-              log_error ("Non-existent account '%s' from '%s'.", acct, curr_db_name);
-              continue;
-            }
-          rt = ra->ra_rt;
-	  if (!rt)
-	    rt = repl_trail_add (ra, file);
-          else
-            {
-	      dk_free_box (rt->rt_file_name);
-	      rt->rt_file_name = box_string (file);
-            }
-	  level = repl_log_start_level (file);
-	  rtf = rtf_allocate (file, level);
-	  rt->rt_files = dk_set_conc (rt->rt_files, dk_set_cons (rtf, NULL));
-	}
-      fclose (cfg_file);
-    }
-
-  DO_SET (repl_acct_t *, ra, &repl_accounts)
-    {
-      int fd;
-      OFF_T len;
-      repl_trail_t *rt = ra->ra_rt;
-
-      if (!ra->ra_rt)
-        continue;
-
-      file_set_rw (rt->rt_file_name);
-      if ((fd = fd_open (rt->rt_file_name, OPEN_FLAGS)) < 0)
-	{
-          if (errno == ENOENT)
-            {
-              dbg_printf_1 (("repl_read_cfg: %s: ENOENT, ok", rt->rt_file_name));
-              continue;
-            }
-	  log_error ("Can't open replication log '%s' : %m.", rt->rt_file_name);
-	}
-      else
-        {
-	  rt->rt_out = dk_session_allocate (SESCLASS_TCPIP);
-	  tcpses_set_fd (rt->rt_out->dks_session, fd);
-	  len = LSEEK (fd, 0, SEEK_END);
-	  rt->rt_out->dks_bytes_sent = len;
-	  rt->rt_commit_length = len;
-	}
-    }
-  END_DO_SET();
-}
-
-static repl_message_t *
-rm_allocate (void)
-{
-  NEW_VARZ (repl_message_t, rm);
-  rm->rm_string = strses_allocate ();
-  return rm;
-}
-
-static void
-rm_rc_free (repl_message_t * rm)
-{
-  dk_free_box (rm->rm_acct);
-  strses_free (rm->rm_string);
-  dk_free ((caddr_t) rm, sizeof (repl_message_t));
-}
-
-static void
-rm_clear (repl_message_t * rm)
-{
-  dk_free_box (rm->rm_acct);
-  rm->rm_acct = NULL;
-  strses_flush (rm->rm_string);
-}
-
-/**
- * Find replication message for account in trx lock
- *
- * If no replication message for account found in trx lock
- * new one is created in tr_rc and added to trx lock
- *
- * @param lt transaction lock
- * @param acct account
- * @returns replication message
- */
-static repl_message_t *
-lt_find_rm (lock_trx_t * lt, char * srv, char * acct)
-{
-  repl_message_t * rm;
-
-  DO_SET (repl_message_t *, tr, &lt->lt_repl_logs)
-    {
-      if (0 == strcmp (tr->rm_acct, acct) &&
-          0 == strcmp (tr->rm_srv, srv))
-	return tr;
-    }
-  END_DO_SET();
-
-  rm = (repl_message_t *) resource_get (tr_rc);
-  rm->rm_srv = box_string (srv);
-  rm->rm_acct = box_string (acct);
-  dk_set_push (&lt->lt_repl_logs, (void *) rm);
-  return rm;
-}
-
-void
-log_repl_text_array (lock_trx_t * lt, char * srv, char * acct, caddr_t box)
-{
-  repl_message_t * rm;
-  repl_acct_t *ra;
-
-  if (!srv)
-    srv = db_name;
-
-  if (lt->lt_replicate == REPL_NO_LOG || cl_non_logged_write_mode)
-    return;
-  if (0 != strcmp(srv, db_name) && lt->lt_repl_is_raw)
-    {
-      /*
-       * do not log raw txn on updatable subscriber
-       */
-      return;
-    }
-
-  mutex_enter (lt->lt_log_mtx);
-  if ((ra = ra_find (srv, acct)) == NULL)
-    {
-      mutex_leave (lt->lt_log_mtx);
-      sqlr_new_error ("42000", "TR071", "Replication account missing for server '%s', account '%s' in logging replication.", srv, acct);
-    }
-  if (!ra->ra_rt)
-    {
-      mutex_leave (lt->lt_log_mtx);
-      sqlr_new_error ("42000", "TR071", "Replication trail missing for server '%s', account '%s' in logging replication.", srv, acct);
-    }
-  rm = lt_find_rm (lt, srv, acct);
-  session_buffered_write_char (LOG_TEXT, rm->rm_string);
-  print_object (box, rm->rm_string, NULL, NULL);
-  mutex_leave (lt->lt_log_mtx);
-}
-
-/* GK:calls log_repl_text_array on all the publications the item is participating in */
-void
-log_repl_text_array_all (const char *obj_name, int obj_type, caddr_t text,
-    client_connection_t *cli, query_instance_t *qi, ptrlong opt_mask)
-{
-  local_cursor_t *lc_item;
-  static query_t *tp_item = NULL;
-  if (!tp_item)
-    tp_item =
-	sql_compile ("select TI_OPTIONS, TI_ACCT from DB.DBA.SYS_TP_ITEM where \
-	TI_SERVER = ? and TI_ITEM = ? and TI_TYPE = ?",
-	    bootstrap_cli, NULL, SQLC_DEFAULT);
-
-  /* If procedure definition published for replication */
-  if (tp_item)
-    {
-      caddr_t ti_opt = NULL;
-      char * repl_acct_name;
-      caddr_t err;
-      err = qr_rec_exec (tp_item, cli, &lc_item, qi, NULL, 3,
-	  ":0", db_name, QRP_STR,
-	  ":1", obj_name, QRP_STR,
-	  ":2", (ptrlong) obj_type, QRP_INT);
-      while (lc_next (lc_item))
-	{
-	  ti_opt = lc_nth_col (lc_item, 0);
-	  repl_acct_name = lc_nth_col (lc_item, 1);
-	  if ((ptrlong) ti_opt & opt_mask)
-	    log_repl_text_array (qi->qi_trx, NULL, repl_acct_name, (caddr_t) box_copy_tree (text));
-	}
-      lc_free (lc_item);
-    }
-}
-
-
-void
-trx_repl_log_ddl_index_def (query_instance_t * qi, caddr_t name, caddr_t table, caddr_t * cols, caddr_t * opts)
-{
-  caddr_t * arr;
-
-  arr = (caddr_t *) dk_alloc_box ((opts ? 5 : 4) * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
-  arr [0] = box_string (opts ? "__ddl_index_def (?,?,?,?)" : "__ddl_index_def (?,?,?)");
-  arr [1] = box_string (name);
-  arr [2] = box_string (table);
-  arr [3] = box_copy_tree ((box_t) cols);
-  if (opts)
-    {
-      arr [4] = (caddr_t) box_copy_tree ((box_t) opts);
-    }
-  log_repl_text_array_all (table, 2, (caddr_t) arr, qi->qi_client, qi,
-      LOG_REPL_TEXT_ARRAY_MASK_ALL);
-  dk_free_tree ((box_t) arr);
-}
-
-
-static void
-lt_repl_log_truncate (lock_trx_t * lt)
-{
-  /* if not all logs successful, truncate to previous committed length */
-  /* done as part of log section of transact, so serialized on page map */
-  ASSERT_IN_TXN;
-  DO_SET (repl_message_t *, rm, &lt->lt_repl_logs)
-    {
-      repl_acct_t *ra = ra_find (rm->rm_srv, rm->rm_acct);
-      repl_trail_t *rt;
-
-      if (!ra)
-        continue;
-      if ((rt = ra->ra_rt) == NULL)
-        continue;
-
-      if (rt->rt_out)
-	{
-	  FTRUNCATE (tcpses_get_fd (rt->rt_out->dks_session), rt->rt_commit_length);
-	  LSEEK (tcpses_get_fd (rt->rt_out->dks_session), 0, SEEK_END);
-	        rt->rt_out->dks_bytes_sent = rt->rt_commit_length;
-
-	}
-    }
-  END_DO_SET();
-}
-
-static void
-repl_rm_commit (repl_message_t * rm)
-{
-  long trx_len = strses_length (rm->rm_string);
-  repl_acct_t *ra = ra_find (rm->rm_srv, rm->rm_acct);
-  repl_trail_t *rt;
-  repl_queue_t *rq;
-
-  if (!ra || (rt = ra->ra_rt) == NULL)
-    return;
-
-  rwlock_rdlock (rt->rt_lock);
-  mutex_enter (rt->rt_mtx);
-  rt->rt_commit_length = rt->rt_out->dks_bytes_sent;
-  if (rm->rm_blobs_start)
-    GPF_T1 ("no blobs allowed in replication");
-
-  rq = RA_IS_PUSHBACK(rm->rm_acct) ?  &repl_push_queue : &repl_queue;
-  mutex_enter (rq->rq_mtx);
-  if (rq->rq_to_disconnect)
-    {
-      rm_free (rm);
-      mutex_leave (rq->rq_mtx);
-      mutex_leave (rt->rt_mtx);
-      rwlock_unlock (rt->rt_lock);
-      return;
-    }
-
-  basket_add (&rq->rq_basket, rm);
-  rq->rq_bytes += trx_len;
-  if (rq->rq_bytes > repl_queue_max)
-    {
-      repl_message_t * rm_end = (repl_message_t *) resource_get (tr_rc);
-      log_info ("Sync queue exceeded %ld bytes, disconnecting all subscriptions.",
-          repl_queue_max);
-      rm_end->rm_header = REPL_QUEUE_FULL;
-      basket_add (&rq->rq_basket, rm_end);
-      rq->rq_to_disconnect = 1;
-      semaphore_leave (rq->rq_sem);
-    }
-
-  mutex_leave (rq->rq_mtx);
-  semaphore_leave (rq->rq_sem);
-  mutex_leave (rt->rt_mtx);
-  rwlock_unlock (rt->rt_lock);
-}
-
-static void
-rm_log_head (lock_trx_t * lt, repl_message_t * rm)
-{
-  repl_acct_t * ra = ra_find (rm->rm_srv, rm->rm_acct);
-  long bytes = strses_length (rm->rm_string);
-  caddr_t * cbox;
-  caddr_t * repl =
-    (caddr_t *) dk_alloc_box (
-			      REPLH_CIRCULATION * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
-  cbox = (caddr_t *) dk_alloc_box (sizeof (caddr_t) * LOG_HEADER_LENGTH,
-				   DV_ARRAY_OF_POINTER);
-
-  memset (repl, 0, box_length ((caddr_t) repl));
-  memset (cbox, 0, sizeof (caddr_t) * LOG_HEADER_LENGTH);
-  cbox[LOGH_CL_2PC] = 0;
-  cbox[LOGH_USER] = box_string ("");
-  cbox[LOGH_BYTES] = box_num (bytes);
-
-  repl[REPLH_SERVER] = box_string (db_name);
-  repl[REPLH_ACCOUNT] = box_string (ra->ra_account);
-  repl[REPLH_LEVEL] = box_num (ra_new_trx_no (lt, ra));
-  log_sequence (lt, ra->ra_sequence, (long) unbox (repl[REPLH_LEVEL]));
-  repl[REPL_ORIGIN] = box_copy_tree (lt->lt_replica_of ? lt->lt_replica_of : db_name);
-  cbox[LOGH_REPLICATION] = (caddr_t) repl;
-  rm->rm_header = cbox;
-}
-
-int
-lt_log_replication (lock_trx_t * lt)
-{
-  int rc = LTE_OK;
-  if (REPL_NO_LOG == lt->lt_replicate || cl_non_logged_write_mode)
-    return LTE_OK;
-  DO_SET (repl_message_t *, rm, &lt->lt_repl_logs)
-    {
-      repl_acct_t *ra = ra_find (rm->rm_srv, rm->rm_acct);
-      rm_log_head (lt, rm);
-      rc = repl_write_extra_log (ra, rm->rm_header, rm->rm_string);
-      if (rc != LTE_OK)
-	break;
-    }
-  END_DO_SET ();
-  dk_free_box (lt->lt_replica_of);
-  lt->lt_replica_of = NULL;
-  return rc;
-}
-
-void
-lt_send_repl_cast (lock_trx_t * lt)
-{
-  DO_SET (repl_message_t *, rm, &lt->lt_repl_logs)
-    {
-      repl_rm_commit (rm);
-    }
-  END_DO_SET();
-  dk_set_free (lt->lt_repl_logs);
-  lt->lt_repl_logs = NULL;
-  return;
-}
-
-void
-lt_repl_rollback (lock_trx_t * lt)
-{
-  lt_repl_log_truncate (lt);
-  DO_SET (repl_message_t *, rm, &lt->lt_repl_logs)
-    {
-    }
-  END_DO_SET();
-  dk_set_free (lt->lt_repl_logs);
-  lt->lt_repl_logs = NULL;
-  dk_free_box (lt->lt_replica_of);
-  lt->lt_replica_of = NULL;
-}
-
-subscription_t *
-sub_allocate (char * subscriber, char * account, dk_session_t *ses)
-{
-  NEW_VARZ (subscription_t, sub);
-
-  sub->sub_account = box_string (account);
-  sub->sub_session = ses;
-  sub->sub_subscriber_name = box_string (subscriber);
-  return sub;
-}
-
-void
-sub_free (subscription_t * sub)
-{
-#if 0
-  dbg_printf_1 (("sub_free: Disconnect replication for '%s' (sub->sub_session %p)",
-      sub->sub_subscriber_name, sub->sub_session));
-#endif
-  if (sub->sub_session)
-    {
-#if 0
-      dbg_printf_1 (("sub_free: sub->sub_session %p", sub->sub_session));
-#endif
-      PrpcCheckOut (sub->sub_session);
-      PrpcDisconnect (sub->sub_session);
-      PrpcSessionFree (sub->sub_session);
-    }
-  dk_free_box (sub->sub_account);
-  dk_free_box (sub->sub_subscriber_name);
-  dk_free ((caddr_t) sub, sizeof (*sub));
-}
-
-void
-repl_sub_synced (subscription_t * sub, repl_level_t level_at)
-{
-  repl_message_t * rm;
-  repl_queue_t * rq = RA_IS_PUSHBACK(sub->sub_account) ?
-      &repl_push_queue : &repl_queue;
-  int rq_to_disconnect;
-
-  mutex_enter (rq->rq_mtx);
-  rq_to_disconnect = rq->rq_to_disconnect;
-  log_info ("Subscription of '%s' for '%s' level %ld moved to sync set.%s",
-     sub->sub_subscriber_name, sub->sub_account, level_at,
-     rq_to_disconnect ?
-        " General disconnect pending, disconnecting this subscription." : "");
-  if (rq_to_disconnect)
-    {
-      mutex_leave (rq->rq_mtx);
-      if (!RA_IS_PUSHBACK(sub->sub_account))
-        {
-          /* Send resync message before disconnect */
-          repl_send_resync (sub->sub_session);
-          sub->sub_session->dks_to_close = 1;
-          sub->sub_session = NULL;  /* will be freed by future_wrapper */
-        }
-      sub_free (sub);
-      return;
-    }
-  rm = (repl_message_t *) resource_get (tr_rc);
-  rm->rm_header = REPL_QUEUE_SYNCED;
-  rm->rm_synced_sub = sub;
-  basket_add (&rq->rq_basket, (void *) rm);
-  mutex_leave (rq->rq_mtx);
-  semaphore_leave (rq->rq_sem);
-}
-
-void
-repl_sub_dropped(repl_queue_t * rq, dk_session_t * ses)
-{
-  repl_message_t * rm = (repl_message_t *) resource_get (tr_rc);
-
-  remove_from_served_sessions (ses);
-
-  rm->rm_header = REPL_QUEUE_DISCONNECT;
-  rm->rm_data = (void *) ses;
-
-  mutex_enter (rq->rq_mtx);
-  if (rq->rq_to_disconnect)
-    {
-      mutex_leave (rq->rq_mtx);
-      rm_free (rm);
-      return;
-    }
-  basket_add (&rq->rq_basket, (void*) rm);
-  mutex_leave (rq->rq_mtx);
-
-  semaphore_leave (rq->rq_sem);
-}
-
-void
-repl_purge (char *srv, char *acct)
-{
-  repl_queue_t *rq;
-  repl_message_t *rm;
-
-  if (!ra_find (srv, acct))
-    {
-      sqlr_new_error ("42000", "TR096",
-          "Replication account '%s' from '%s' does not exist",
-          acct, srv);
-    }
-
-  rm = (repl_message_t *) resource_get (tr_rc);
-  rm->rm_header = REPL_PURGE;
-  rm->rm_srv = box_string (srv);
-  rm->rm_acct = box_string (acct);
-
-  rq = RA_IS_PUSHBACK(acct) ?  &repl_push_queue : &repl_queue;
-  mutex_enter (rq->rq_mtx);
-  basket_add (&rq->rq_basket, rm);
-  mutex_leave (rq->rq_mtx);
-  semaphore_leave (rq->rq_sem);
-}
-
-static query_t *sched_save_qr;
-
-/*
- * sched next purger run
- */
-static void
-repl_sched_purger (query_instance_t *qi, repl_acct_t *ra)
-{
-  char dt[DT_LENGTH];
-  char now_str[32], next_str[32];
-  TIMESTAMP_STRUCT now_ts, next_ts;
-
-  caddr_t err;
-
-  if (!sched_save_qr)
-    {
-      log_error ("NULL sched_save_qr: can't sched next purger run");
-      return;
-    }
-
-  if (!ra->ra_p_time)
-    {
-      dbg_printf_1 (("repl_purge_end: (%s, %s): null p_time: next purger run not scheduled",
-          ra->ra_server, ra->ra_account));
-      return;
-    }
-
-  dt_now(dt);
-  dt_to_string (dt, now_str, sizeof (now_str));
-  dbg_printf_1 (("repl_purge_end: (%s, %s): now: %s",
-      ra->ra_server, ra->ra_account, now_str));
-  dt_to_timestamp_struct(dt, &now_ts);
-  dt_to_timestamp_struct(dt, &next_ts);
-  if (ra->ra_p_month)
-    {
-      /*
-       * purger should be run yearly on every specified month and day
-       */
-      if (!ra->ra_p_day)
-        ra->ra_p_day = 1;
-      if (ra->ra_p_month <= now_ts.month)
-        ts_add (&next_ts, 1, "year");
-      ts_add (&next_ts, ra->ra_p_month - now_ts.month, "month");
-      ts_add (&next_ts, ra->ra_p_day - now_ts.day, "day");
-    }
-  else if (ra->ra_p_day)
-    {
-      /*
-       * purger should be run monthly on every specified day of month
-       */
-      if (ra->ra_p_day <= now_ts.day)
-        ts_add (&next_ts, 1, "month");
-      ts_add (&next_ts, ra->ra_p_day - now_ts.day, "day");
-    }
-  else if (ra->ra_p_wday)
-    {
-      /*
-       * purger should be run weekly on every specified week day
-       */
-      int now_wday = date2weekday (now_ts.year, now_ts.month, now_ts.day);
-
-      if (ra->ra_p_wday <= now_wday)
-        ts_add (&next_ts, 7, "day");
-      ts_add (&next_ts, ra->ra_p_wday - now_wday, "day");
-    }
-  else
-    {
-      /*
-       * purger should be run daily
-       */
-      if (ra->ra_p_time->hour < now_ts.hour ||
-          (ra->ra_p_time->hour == now_ts.hour &&
-           ra->ra_p_time->minute <= now_ts.minute))
-        ts_add (&next_ts, 1, "day");
-    }
-
-  ts_add (&next_ts, ra->ra_p_time->hour - now_ts.hour, "hour");
-  ts_add (&next_ts, ra->ra_p_time->minute - now_ts.minute, "minute");
-  next_ts.second = 0;
-  timestamp_struct_to_dt (&next_ts, dt);
-  dt_to_string (dt, next_str, sizeof (next_str));
-  dbg_printf_1 (("repl_purge_end: (%s, %s): next run: %s",
-      ra->ra_server, ra->ra_account, next_str));
-
-  if (qi)
-    {
-      err = qr_rec_exec (sched_save_qr, qi->qi_client, NULL, qi, NULL, 6,
-          ":0", ra->ra_server, QRP_STR,
-          ":1", ra->ra_account, QRP_STR,
-          ":2", now_str, QRP_STR,
-          ":3", next_str, QRP_STR,
-          ":4", ra->ra_server, QRP_STR,
-          ":5", ra->ra_account, QRP_STR);
-      if ((caddr_t) SQL_SUCCESS != err)
-        sqlr_resignal (err);
-    }
-  else
-    {
-      lock_trx_t *lt;
-
-      mutex_enter (repl_uc_mtx);
-      IN_TXN;
-      lt = cli_set_new_trx (repl_util_cli);
-      lt_threads_set_inner (lt, 1);
-      lt->lt_replicate = REPL_LOG;
-      LEAVE_TXN;
-
-      err = qr_quick_exec (sched_save_qr, repl_util_cli, "", NULL, 6,
-          ":0", ra->ra_server, QRP_STR,
-          ":1", ra->ra_account, QRP_STR,
-          ":2", now_str, QRP_STR,
-          ":3", next_str, QRP_STR,
-          ":4", ra->ra_server, QRP_STR,
-          ":5", ra->ra_account, QRP_STR);
-      if ((caddr_t) SQL_SUCCESS != err)
-        {
-          IN_TXN;
-          lt_rollback (lt, TRX_CONT);
-	  lt_leave (lt);
-          LEAVE_TXN;
-          log_error ("repl_purge_end: SQL Error: %s : %s",
-              ((caddr_t *) err)[1], ((caddr_t *) err)[2]);
-        }
-      else
-        {
-          IN_TXN;
-          lt_commit (lt, TRX_CONT);
-	  lt_leave (lt);
-          LEAVE_TXN;
-        }
-      mutex_leave (repl_uc_mtx);
-    }
-}
-
-void
-repl_purge_run (repl_acct_t *ra)
-{
-  repl_trail_t *rt = ra->ra_rt;
-  dk_set_t rtf_list_new = NULL;
-  dk_set_t rtf_list_purge = NULL;
-  repl_level_t level_at;
-  FILE *cfg;
-
-  if (!rt)
-    {
-      log_error ("Log purger: Replication trail missing for server '%s', account '%s'.", ra->ra_server, ra->ra_account);
-      return;
-    }
-
-  rwlock_wrlock (rt->rt_lock);
-  level_at = ra_trx_no (ra);
-  dbg_printf_1 (("repl_purge_run: (%s, %s): level %ld",
-      ra->ra_server, ra->ra_account, level_at));
-
-  /*
-   * build new repl trail files list
-   */
-  DO_SET (repl_trail_file_t *, rtf, &rt->rt_files)
-    {
-      repl_trail_file_t *rtf_new = rtf_allocate (rtf->rtf_file, rtf->rtf_level);
-
-      if (REPL_LEVEL_OK (rtf->rtf_level, level_at))
-        {
-          log_info ("Log purger: %s (start level %ld): ok",
-              rtf->rtf_file, rtf->rtf_level);
-	  rtf_list_new = dk_set_conc (
-              rtf_list_new, dk_set_cons (rtf_new, NULL));
-        }
-      else
-        {
-          log_info ("Log purger: %s (start level %ld): added to purge list",
-              rtf->rtf_file, rtf->rtf_level);
-	  rtf_list_purge = dk_set_conc (
-              rtf_list_purge, dk_set_cons (rtf_new, NULL));
-        }
-    }
-  END_DO_SET ();
-
-  if (!rtf_list_purge)
-    {
-      rtf_list_free (rtf_list_new);
-      rwlock_unlock (rt->rt_lock);
-      goto purge_done;
-    }
-
-  /*
-   * write new config
-   */
-  cfg = fopen (REPL_CFG_TMP, "w");
-  if (cfg == NULL)
-    {
-      log_error ("Log purger: Can't open '%s' for write: %s (errno %d)",
-          REPL_CFG_TMP, strerror (errno), errno);
-      rtf_list_free (rtf_list_new);
-      goto purge_done;
-    }
-  DO_SET (repl_acct_t *, r, &repl_accounts)
-    {
-      repl_trail_t *t = r->ra_rt;
-      dk_set_t rtf_list;
-
-      if (!t)
-        continue;
-
-      rtf_list = r == ra ? rtf_list_new : t->rt_files;
-      DO_SET (repl_trail_file_t *, rtf, &rtf_list)
-        {
-          repl_cfg_writeln (cfg, r, rtf->rtf_file);
-        }
-      END_DO_SET ();
-    }
-  END_DO_SET ();
-  fclose (cfg);
-#ifdef WIN32
-  file_set_rw (REPL_CFG);
-  if (unlink (REPL_CFG) < 0)
-    {
-      log_error ("Log purger: Can't unlink '%s': %s (errno %d).",
-          REPL_CFG, strerror (errno), errno);
-      rtf_list_free (rtf_list_new);
-      goto purge_done;
-    }
-#endif
-  if (rename (REPL_CFG_TMP, REPL_CFG) < 0)
-    {
-      log_error ("Log purger: Can't rename '%s' to '%s': %s (errno %d).",
-          REPL_CFG_TMP, REPL_CFG, strerror (errno), errno);
-      rtf_list_free (rtf_list_new);
-      goto purge_done;
-    }
-
-  /*
-   * cfg is written successfully: purge files now
-   */
-  rtf_list_free (rt->rt_files);
-  rt->rt_files = rtf_list_new;
-  repl_trail_new_file (ra, NULL, 0);
-
-  DO_SET (repl_trail_file_t *, rtf, &rtf_list_purge)
-    {
-      file_set_rw (rtf->rtf_file);
-      if (unlink (rtf->rtf_file) < 0)
-        {
-          log_warning ("Log purger: unlink: %s: %s (errno %d).",
-              rtf->rtf_file, strerror (errno), errno);
-        }
-      log_info ("Log purger: %s (start level %d): purged.",
-          rtf->rtf_file, rtf->rtf_level);
-      rtf_free (rtf);
-    }
-  END_DO_SET ();
-  dk_set_free (rtf_list_purge);
-
-purge_done:
-  rwlock_unlock (rt->rt_lock);
-  repl_sched_purger (NULL, ra);
-}
-
-static caddr_t
-bif_repl_sched_purger (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
-{
-  query_instance_t * qi = (query_instance_t *) qst;
-  caddr_t srv = bif_string_arg (qst, args, 0, "repl_add_subscriber");
-  caddr_t acct = bif_string_arg (qst, args, 1, "repl_add_subscriber");
-  repl_acct_t *ra;
-  (void) err_ret;
-
-  if ((ra = ra_find (srv, acct)) == NULL)
-    {
-      sqlr_new_error ("42000", "TR097",
-          "Replication account '%s' from '%s' does not exist",
-          acct, srv);
-    }
-
-  repl_sched_purger (qi, ra);
-  return 0;
-}
-
-void
-repl_serv_init (int make_thr)
-{
-  (void) make_thr;
-
-  tr_rc = resource_allocate (100, (rc_constr_t) rm_allocate, (rc_destr_t) rm_rc_free, (rc_destr_t) rm_clear, 0);
-  replay_rc = resource_allocate (100, (rc_constr_t) rpm_allocate, (rc_destr_t) rpm_free, (rc_destr_t) rpm_clear, 0);
-  replay_str_in = strses_allocate ();
-  replay_cli = client_connection_create ();
-  replay_cli->cli_is_log = 1;
-
-  bif_define ("repl_sched_purger", bif_repl_sched_purger);
-
-  repl_queue_init (&repl_queue);
-  repl_queue_init (&repl_replay_queue);
-  repl_queue_init (&repl_push_queue);
-
-  cfg_mtx = mutex_allocate ();
-  repl_read_cfg ();
-
-  if (!PrpcThreadAllocate ((thread_init_func) repl_push_loop, future_thread_sz, NULL))
-    {
-      log_error ("Can's start the server because it can't create replication push thread. Exiting.");
-      GPF_T;
-    }
-
-  if (repl_server_enable)
-    {
-      sched_save_qr = repl_compile (
-          "insert replacing SYS_SCHEDULED_EVENT"
-          " (SE_NAME, SE_START, SE_LAST_COMPLETED, SE_INTERVAL, SE_SQL) "
-          "values (concat ('repl_purge_', ?, '_', ?), now(), now(), "
-                  "datediff ('minute', stringdate(?), stringdate(?)), "
-                  "sprintf ('repl_purge (''%s'', ''%s'')', ?, ?))");
-      PrpcRegisterServiceDesc (&s_resync_replay, (server_func) sf_resync_replay);
-      PrpcRegisterServiceDesc (&s_resync_acct, (server_func) sf_resync_acct);
-      if (!PrpcThreadAllocate ((thread_init_func) resend_thread_loop, future_thread_sz, NULL))
-        {
-          log_error ("Can's start the server because it can't create replication resend thread. Exiting.");
-          GPF_T;
-        }
-
-      if (!PrpcThreadAllocate ((thread_init_func) repl_replay_loop, future_thread_sz, NULL))
-        {
-          log_error ("Can's start the server because it can't create replication replay thread. Exiting.");
-          GPF_T;
-        }
-    }
-}
diff --git a/libsrc/Wi/replsub.c b/libsrc/Wi/replsub.c
deleted file mode 100644
index faeeeb3..0000000
--- a/libsrc/Wi/replsub.c
+++ /dev/null
@@ -1,652 +0,0 @@
-/*
- *  replsub.c
- *
- *  $Id: replsub.c,v 1.3.2.1 2009/04/18 21:55:13 source Exp $
- *
- *  Subscriptions routines.
- *
- *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- *  project.
- *
- *  Copyright (C) 1998-2006 OpenLink Software
- *
- *  This project is free software; you can redistribute it and/or modify it
- *  under the terms of the GNU General Public License as published by the
- *  Free Software Foundation; only version 2 of the License, dated June 1991.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include "sqlnode.h"
-#include "log.h"
-#include "repl.h"
-#include "replsr.h"
-#include "security.h"
-
-repl_queue_t repl_queue;
-
-static dk_set_t subscriptions;
-
-static void send_sync_notice (subscription_t * sub, repl_level_t level);
-static void sub_send_blobs (subscription_t * sub, repl_message_t * rm,
-        dk_session_t * volatile log);
-static void log_skip_blobs (dk_session_t * log);
-static int subscriber_dropped (dk_session_t * ses);
-static int is_in_circulation (subscription_t * sub, caddr_t * replh);
-static int repl_trail_send (repl_acct_t *ra, subscription_t * sub,
-        repl_level_t level);
-#ifdef REPL_SAVE_SUBSCRIBER_LEVEL
-static void sub_save (subscription_t *sub, repl_level_t level);
-#endif
-
-void
-resend_thread_loop (void)
-{
-  repl_message_t *rm;
-  caddr_t *header;
-  dk_session_t *string;
-  caddr_t *replh;
-  for (;;)
-    {
-      repl_queue_t *rq = &repl_queue;
-      dk_set_t sublist = subscriptions;
-      subscription_t *sub;
-
-      semaphore_enter (rq->rq_sem);
-      mutex_enter (rq->rq_mtx);
-      rm = (repl_message_t *) basket_get (&rq->rq_basket);
-      header = rm->rm_header;
-      string = rm->rm_string;
-      if (IS_BOX_POINTER (header))
-	rq->rq_bytes -= (long) unbox (header[LOGH_BYTES]);
-      mutex_leave (rq->rq_mtx);
-
-      if (header == REPL_QUEUE_FULL)
-	{
-          DO_SET (subscription_t *, sub, &subscriptions)
-            {
-              /* Send resync message before disconnect */
-              repl_send_resync (sub->sub_session);
-              sub_free (sub);
-            }
-          END_DO_SET ();
-          dk_set_free (subscriptions);
-          subscriptions = NULL;
-          mutex_enter (rq->rq_mtx);
-          rq->rq_to_disconnect = 0;
-          mutex_leave (rq->rq_mtx);
-	  rm_free (rm);
-	  continue;
-	}
-      else if (header == REPL_QUEUE_SYNCED)
-	{
-          subscription_t *sub = rm->rm_synced_sub;
-
-	  dk_set_push (&subscriptions, (void *) sub);
-	  SESSION_SCH_DATA (sub->sub_session)->sio_default_read_ready_action = subscriber_dropped;
-	  PrpcCheckIn (sub->sub_session);
-	  rm_free (rm);
-	  continue;
-	}
-      else if (header == REPL_QUEUE_DISCONNECT)
-	{
-	  DO_SET (subscription_t *, sub, &subscriptions)
-	    {
-	      if (sub->sub_session == rm->rm_data)
-		{
-		  dk_set_delete (&subscriptions, (void *) sub);
-		  sub_free (sub);
-		  break;
-		}
-	    }
-	  END_DO_SET();
-	  rm_free (rm);
-	  continue;
-	}
-      else if (header == REPL_PURGE)
-        {
-          repl_acct_t *ra = ra_find (db_name, rm->rm_acct);
-          if (!ra)
-            {
-              log_error ("Log purge for non-existent account '%s' requested.",
-                  rm->rm_acct);
-              continue;
-            }
-          rm_free (rm);
-          repl_purge_run (ra);
-        }
-      else
-	{
-	  dk_set_t sub_next;
-
-	  replh = (caddr_t *) header[LOGH_REPLICATION];
-
-	  for (sublist = subscriptions; sublist; sublist = sub_next)
-	    {
-              int rc;
-	      dk_session_t *ses;
-              repl_level_t level;
-
-              sub_next = sublist->next;
-	      sub = (subscription_t *) sublist->data;
-
-              level = (repl_level_t) unbox (replh [REPLH_LEVEL]);
-	      if ((rc = is_in_circulation (sub, replh)) <= 0)
-                {
-                  if (rc < 0)
-                    {
-                      send_sync_notice (sub, level);
-#ifdef REPL_SAVE_SUBSCRIBER_LEVEL
-                      sub_save (sub, level);
-#endif
-                    }
-                  continue;
-                }
-
-              ses = sub->sub_session;
-	      mutex_enter (ses->dks_mtx);
-	      CATCH_WRITE_FAIL (ses)
-		{
-		  if (DKSESSTAT_ISSET (ses, SST_OK))
-		    print_object ((caddr_t) header, ses, NULL, NULL);
-		  if (DKSESSTAT_ISSET (ses, SST_OK))
-		    {
-		      strses_write_out (string, ses);
-		    }
-		  if (rm->rm_blobs_start)
-		    sub_send_blobs (sub, rm, NULL);
-		  session_flush_1 (ses);
-		  /* _1 because inside the ses mtx. */
-#ifdef REPL_SAVE_SUBSCRIBER_LEVEL
-                  sub_save (sub, level);
-#endif
-		}
-	      END_WRITE_FAIL (ses);
-	      /* if connection broken the select thread will send a disconnect message.
-	       * disconnect when that arrives, not now so as to avoid double free */
-	        mutex_leave (ses->dks_mtx);
-
-	      sublist = sub_next;
-	    }
-
-	  rm_free (rm);
-	}
-    }
-}
-
-static int
-dummy_read_ready_action (dk_session_t *ses)
-{
-  (void) ses;
-  GPF_T1 ("dummy_read_ready_action");
-  return 0;
-}
-
-
-void
-sf_resync_acct (char *account, repl_level_t level, char *subscriber_name,
-		caddr_t name, caddr_t digest)
-{
-  user_t * user;
-  dk_session_t *client = IMMEDIATE_CLIENT;
-  subscription_t *sub;
-  repl_acct_t *ra;
-  repl_subscriber_t *rs;
-  repl_level_t level_at;
-
-  user = sec_check_login (name, digest, client);
-/* Check grants */
-#ifdef REPLICATION_SUPPORT2
-  if (!user)
-    {
-      log_info ("Bad replication login '%s' for account '%s' from '%s'.",
-		name, account, subscriber_name);
-      thrs_printf ((thrs_fo, "ses %p thr:%p in sf_resync_acct1\n", client, THREAD_CURRENT_THREAD));
-      DKST_RPC_DONE (client);
-      return;
-    }
-  if (!sec_user_has_group (G_ID_DBA, user->usr_id))
-    {
-      int kpg = 0;
-      kpg = get_repl_grants (account, name);
-      if (!kpg)
-	{
-	  log_info ("User '%s' does not have privileges for account '%s' requested from '%s'.",
-	      name, account, subscriber_name);
-	  thrs_printf ((thrs_fo, "ses %p thr:%p in sf_resync_acct2\n", client, THREAD_CURRENT_THREAD));
-	  DKST_RPC_DONE (client);
-          return;
-	}
-    }
-#else
-  if (!user || !sec_user_has_group (G_ID_DBA, user->usr_id))
-    {
-      log_info ("Bad replication login '%s' for account '%s' requested from '%s' (not in DBA group).",
-	  name, account, subscriber_name);
-      thrs_printf ((thrs_fo, "ses %p thr:%p in sf_resync_acct3\n", client, THREAD_CURRENT_THREAD));
-      DKST_RPC_DONE (client);
-      return;
-    }
-#endif
-/* End check grants */
-
-  /* Before any action we should be sure that account exists */
-  if ((ra = ra_find (db_name, account)) == NULL)
-    {
-      log_info ("The account '%s' requested from %s does not exist.",
-	  account, subscriber_name);
-      thrs_printf ((thrs_fo, "ses %p thr:%p in sf_resync_acct4\n", client, THREAD_CURRENT_THREAD));
-      DKST_RPC_DONE (client);
-      return;
-    }
-  if (!ra->ra_rt)
-    {
-      log_info ("Replication trail missing for account '%s'.", account);
-      thrs_printf ((thrs_fo, "ses %p thr:%p in sf_resync_acct5\n", client, THREAD_CURRENT_THREAD));
-      DKST_RPC_DONE (client);
-      return;
-    }
-
-  if ((rs = rs_find (ra, subscriber_name)) != NULL && !rs->rs_valid)
-    {
-      log_info ("Subscriber '%s' for '%s' is not valid",
-	  subscriber_name, ra->ra_account);
-      thrs_printf ((thrs_fo, "ses %p thr:%p in sf_resync_acct6\n", client, THREAD_CURRENT_THREAD));
-      DKST_RPC_DONE (client);
-      return;
-    }
-  level_at = ra_trx_no (ra);
-  rs = repl_save_subscriber (
-      ra, subscriber_name, level, REPL_LEVEL_OK (level, level_at));
-  if (!rs->rs_valid)
-    {
-      log_info ("Subscriber '%s' for '%s' is not valid (level %d, requested level %d)",
-	  subscriber_name, ra->ra_account, level_at, level);
-      thrs_printf ((thrs_fo, "ses %p thr:%p in sf_resync_acct7\n", client, THREAD_CURRENT_THREAD));
-      DKST_RPC_DONE (client);
-      return;
-    }
-
-  sub = sub_allocate (subscriber_name, account, client);
-  thrs_printf ((thrs_fo, "ses %p thr:%p in sf_resync_acct7.5\n", client, THREAD_CURRENT_THREAD));
-  PrpcCheckOut (sub->sub_session);
-  SESSION_SCH_DATA (client)->sio_default_read_ready_action = dummy_read_ready_action;
-  /* the session is not in select while syncing. It will go back
-   * there when in sync. */
-
-  thrs_printf ((thrs_fo, "ses %p thr:%p in sf_resync_acct8\n", client, THREAD_CURRENT_THREAD));
-  DKST_RPC_DONE (client);
-  repl_trail_send (ra, sub, level);
-}
-
-void
-repl_send_resync (dk_session_t * ses)
-{
-  caddr_t *header = (caddr_t *) dk_alloc_box_zero (LOG_HEADER_LENGTH * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
-  caddr_t *replh = (caddr_t *) dk_alloc_box_zero (REPLH_CIRCULATION * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
-  header[LOGH_REPLICATION] = (caddr_t) replh;
-  replh[REPLH_ACCOUNT] = NULL;
-  replh[REPLH_SERVER] = box_string (db_name);
-  PrpcWriteObject (ses, (caddr_t) header);
-  dk_free_tree ((box_t) header);
-}
-
-static void
-send_sync_notice (subscription_t * sub, repl_level_t level)
-{
-  caddr_t *header = (caddr_t *) dk_alloc_box (
-      LOG_HEADER_LENGTH * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
-  caddr_t *replh = (caddr_t *) dk_alloc_box (
-      REPLH_CIRCULATION * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
-  memset (header, 0, box_length ((caddr_t) header));
-  memset (replh, 0, box_length ((caddr_t) replh));
-  header[LOGH_REPLICATION] = (caddr_t) replh;
-  replh[REPLH_ACCOUNT] = box_string (sub->sub_account);
-  replh[REPLH_SERVER] = box_string (db_name);
-  replh[REPLH_LEVEL] = box_num (level);
-  PrpcWriteObject (sub->sub_session, (caddr_t) header);
-  dk_free_tree ((box_t) header);
-}
-
-#define session_buffered_unread_char(s)	(s->dks_in_read --)
-
-static void
-sub_send_blobs (subscription_t * sub, repl_message_t * rm,
-    dk_session_t * volatile log)
-{
-  volatile int any = 1;
-  OFF_T off;
-  char page[PAGE_SZ];
-  dtp_t dv;
-  long len;
-  volatile int fd = 0;
-  if (rm)
-    {
-      log = dk_session_allocate (SESCLASS_TCPIP);
-      fd = fd_open (rm->rm_log_file, OPEN_FLAGS_RO);
-      tcpses_set_fd (log->dks_session, fd);
-      off = LSEEK (fd, rm->rm_blobs_start, SEEK_SET);
-    }
-  CATCH_READ_FAIL (log)
-  {
-
-    for (;;)
-      {
-	dv = (dtp_t) session_buffered_read_char (log);
-	if (dv == 0)
-	  {
-	    session_buffered_write_char (0, sub->sub_session);
-	    dbg_printf_1 (("      Blob done."));
-	  }
-	else if (dv == DV_SHORT_STRING)
-	  {
-	    len = (dtp_t) session_buffered_read_char (log);
-	    session_buffered_read (log, page, len);
-	    session_buffered_write_char (dv, sub->sub_session);
-	    session_buffered_write_char (len, sub->sub_session);
-	    session_buffered_write (sub->sub_session, page, len);
-	  }
-	else if (dv == DV_LONG_STRING)
-	  {
-	    len = read_long (log);
-	    session_buffered_read (log, page, len);
-	    session_buffered_write_char (dv, sub->sub_session);
-	    print_long (len, sub->sub_session);
-	    session_buffered_write (sub->sub_session, page, len);
-	  }
-	else
-	  {
-	    session_buffered_unread_char (log);
-	    any = 0;
-	    break;
-	  }
-      }
-
-  }
-  END_READ_FAIL (log);
-  if (any)
-    {
-      dbg_printf_1 (("      Txn blobs replicated"));
-    }
-  if (rm)
-    {
-      close (fd);
-      PrpcSessionFree (log);
-    }
-}
-
-static void
-log_skip_blobs (dk_session_t * log)
-{
-  char page[PAGE_SZ];
-  dtp_t dv;
-  long len;
-
-  CATCH_READ_FAIL (log)
-  {
-    for (;;)
-      {
-	dv = (dtp_t) session_buffered_read_char (log);
-	if (dv == 0)
-	  ;
-	else if (dv == DV_SHORT_STRING)
-	  {
-	    len = (dtp_t) session_buffered_read_char (log);
-	    session_buffered_read (log, page, len);
-	  }
-	else if (dv == DV_LONG_STRING)
-	  {
-	    len = read_long (log);
-	    session_buffered_read (log, page, len);
-	  }
-	else
-	  {
-	    session_buffered_unread_char (log);
-	    break;
-	  }
-      }
-  }
-  END_READ_FAIL (log);
-}
-
-static int
-subscriber_dropped (dk_session_t * ses)
-{
-  repl_sub_dropped(&repl_queue, ses);
-  return 0;
-}
-
-static int
-subscriber_dropped_dead (dk_session_t * ses)
-{
-  repl_sub_dropped(&repl_queue, ses);
-  log_debug ("subscriber_dropped_dead");
-  fprintf (stderr, "subscriber_dropped_dead\n");
-  srv_client_session_died (ses);
-  return 0;
-}
-
-static int replh_print = 0;
-
-static int
-is_in_circulation (subscription_t * sub, caddr_t * replh)
-{
-  int inx;
-  if ((unsigned long) (uptrlong) replh > 100)
-    {
-
-      long len = box_length ((caddr_t) replh) / sizeof (caddr_t);
-      char *acct = replh[REPLH_ACCOUNT];
-      char *from_server = replh[REPLH_SERVER];
-      char *origin = replh[REPL_ORIGIN];
-
-      if (replh_print)
-        {
-	  dbg_printf_1 (("replh from '%s' level " BOXINT_FMT,
-              from_server, unbox (replh [REPLH_LEVEL])));
-        }
-      if (!from_server || 0 != strcmp (db_name, from_server))
-	/* This replicated somebody else's transaction. Don't forward. */
-	return 0;
-
-      if (!origin || 0 == strcmp (sub->sub_subscriber_name, origin))
-        {
-#if 0
-          dbg_printf_1 (("is_in_circulation: origin == sub->subscriber_name (%s)",
-              sub->sub_subscriber_name));
-#endif
-          return -1;
-        }
-
-      if (!acct)
-	/* if acct == server the acct field is compressed to null */
-	acct = replh[REPLH_SERVER];
-
-      if (0 != strcmp (acct, sub->sub_account))
-	return 0;
-      if (len == REPLH_CIRCULATION)
-	return 1;
-      for (inx = REPLH_CIRCULATION; inx < len; inx++)
-	{
-	  if (0 == strcmp (sub->sub_subscriber_name, replh[inx]))
-	    return 1;
-	}
-      return 0;
-    }
-  else
-    return 0;
-}
-
-static int
-repl_trail_send (repl_acct_t *ra, subscription_t * sub, repl_level_t level)
-{
-  repl_level_t volatile level_at = level;
-  repl_level_t volatile lvl_back;
-  repl_trail_t *rt = ra->ra_rt;
-  dk_set_t volatile rtf_list;
-  dk_session_t *ses = dk_session_allocate (SESCLASS_TCPIP);
-
-  rwlock_rdlock (rt->rt_lock);
-
-  log_info ("Subscription of '%s' for '%s' sync starts at %ld.",
-      sub->sub_subscriber_name, sub->sub_account, level);
-  if ((rtf_list = rt->rt_files) == NULL)
-    goto synced;
-
-  while (rtf_list)
-  {
-    repl_trail_file_t * rtf = (repl_trail_file_t *) rtf_list->data;
-    char * file = rtf->rtf_file;
-    int fd;
-
-    if ((fd = fd_open (file, OPEN_FLAGS_RO)) < 0)
-      {
-        log_error ("repl_trail_send: %s: %s", file, strerror (errno));
-        goto err;
-      }
-    tcpses_set_fd (ses->dks_session, fd);
-
-    for (;;)
-      {
-	caddr_t *header;
-	volatile long bytes;
-        int rc = 0;
-
-	/* see if we're at the end of last log */
-	mutex_enter (rt->rt_mtx);
-	if (0 == strcmp (file, rt->rt_file_name))
-	  {
-	    OFF_T pos = LSEEK (fd, 0, SEEK_CUR);
-	    if (pos == rt->rt_commit_length
-		&& ses->dks_in_read == ses->dks_in_fill)
-	      {
-		mutex_leave (rt->rt_mtx);
-	        fd_close (fd, file);
-		goto synced;
-	      }
-	  }
-	mutex_leave (rt->rt_mtx);
-	header = (caddr_t *) PrpcReadObject (ses);
-	if (!header || DKSESSTAT_ISSET (ses, SST_NOT_OK))
-          break;
-	bytes = (long) unbox (header[LOGH_BYTES]);
-	lvl_back = level_at;
-	level_at = (repl_level_t) LOGH_LEVEL (header);
-	if (repl_is_below (level, level_at) &&
-            (rc = is_in_circulation (sub, (caddr_t *) header[LOGH_REPLICATION])) > 0)
-	  {
-	    caddr_t string = (caddr_t) dk_alloc (bytes);
-
-	    CATCH_READ_FAIL (ses)
-	    {
-	      session_buffered_read (ses, string, bytes);
-	    }
-	    FAILED
-	    { /* If reading failed we are in commit area after commit length,
-		 hence we send sync notice and go ahead */
-	      dk_free_tree ((caddr_t) header);
-	      dk_free (string, bytes);
-              level_at = lvl_back;
-	      fd_close (fd, file);
-	      goto synced;
-	    }
-	    END_READ_FAIL (ses);
-
-	    CATCH_WRITE_FAIL (sub->sub_session)
-	    {
-	      print_object ((caddr_t) header, sub->sub_session, NULL, NULL);
-	      session_buffered_chunked_write (sub->sub_session, string, bytes);
-	      sub_send_blobs (sub, NULL, ses);
-	      session_flush_1 (sub->sub_session);
-#ifdef REPL_SAVE_SUBSCRIBER_LEVEL
-              sub_save (sub, level_at);
-#endif
-	    }
-	    END_WRITE_FAIL (sub->sub_session);
-
-	    dk_free_tree ((caddr_t) header);
-	    dk_free (string, bytes);
-	    if (DKSESSTAT_ISSET (sub->sub_session, SST_NOT_OK))
-              {
-		fd_close (fd, file);
-                log_error ("repl_trail_send: Can't send replication log.");
-                goto err;
-              }
-	  }
-	else
-	  {
-	    OFF_T off;
-	    dk_free_tree ((caddr_t) header);
-	    if (ses->dks_in_read + bytes < ses->dks_in_fill)
-	      {
-		ses->dks_in_read += bytes;
-		log_skip_blobs (ses);
-	      }
-	    else
-	      {
-		bytes -= ses->dks_in_fill - ses->dks_in_read;
-		off = LSEEK (fd, bytes, SEEK_CUR);
-		ses->dks_in_fill = 0;
-		ses->dks_in_read = 0;
-		log_skip_blobs (ses);
-	      }
-            if (repl_is_below (level, level_at) && rc < 0)
-              {
-                send_sync_notice (sub, level_at);
-#ifdef REPL_SAVE_SUBSCRIBER_LEVEL
-                sub_save (sub, level_at);
-#endif
-              }
-	  }
-      }
-
-    fd_close (fd, file);
-
-    mutex_enter (rt->rt_mtx);
-    rtf_list = rtf_list->next;
-    mutex_leave (rt->rt_mtx);
-  }
-  log_error ("No replication logs for level %ld.", level);
-
-err:
-  rwlock_unlock (rt->rt_lock);
-  PrpcSessionFree (ses);
-  sub->sub_session->dks_to_close = 1;
-  sub->sub_session = NULL;  /* will be freed by future_wrapper */
-  sub_free (sub);
-  return -1;
-
-synced:
-  rwlock_unlock (rt->rt_lock);
-  PrpcSessionFree (ses);
-  sub->sub_session->dks_is_server = 0; /* no auto dealloc when dead hook called */
-  PrpcSetPartnerDeadHook (sub->sub_session, subscriber_dropped_dead);
-  send_sync_notice (sub, 0);
-  repl_sub_synced (sub, level_at);
-  return 0;
-}
-
-#ifdef REPL_SAVE_SUBSCRIBER_LEVEL
-static void
-sub_save (subscription_t *sub, repl_level_t level)
-{
-  repl_acct_t *ra;
-
-  if ((ra = ra_find (db_name, sub->sub_account)) == NULL)
-    {
-      log_error ("Saving for non-existent account '%s' requested",
-          sub->sub_account);
-      return;
-    }
-
-  repl_save_subscriber (ra, sub->sub_subscriber_name, level, 1);
-}
-#endif
diff --git a/libsrc/Wi/rltrx.c b/libsrc/Wi/rltrx.c
index 9582649..0013d25 100644
--- a/libsrc/Wi/rltrx.c
+++ b/libsrc/Wi/rltrx.c
@@ -1,7 +1,7 @@
 /*
  *  rltrx.c
  *
- *  $Id: rltrx.c,v 1.18.2.16 2010/05/31 20:47:30 source Exp $
+ *  $Id: rltrx.c,v 1.18.2.19 2011/03/14 15:47:01 source Exp $
  *
  *  Locking concurrency control
  *
@@ -103,7 +103,9 @@ pl_rlock_table (page_lock_t * pl, row_lock_t ** locks, int *fill_ret)
     }
   DO_RLOCK (rl, pl)
   {
+#ifndef NDEBUG
     if (ITC_AT_END == rl->rl_pos) log_info ("suspect to have deld rls on pl outside of transact");
+#endif
     locks[fill++] = rl;
   }
   END_DO_RLOCK;
@@ -156,8 +158,10 @@ pg_move_lock (it_cursor_t * itc, row_lock_t ** locks, int n_locks, int from, int
 	  pl_to->pl_n_row_locks++;
 	  if (is_to_extend)
 	    {
+#ifndef NDEBUG
 	      if (ITC_AT_END == to)
 		log_info ("Unusual to shift a deleted rl to the right side of a split");
+#endif
 	      rl_add_pl_to_owners (itc, rl, pl_to);
 	    }
 	  return;
@@ -350,7 +354,7 @@ itc_insert_rl (it_cursor_t * itc, buffer_desc_t * buf, int pos, row_lock_t * rl,
     return;
   if (!pl)
     {
-#ifdef MTX_DEBUG
+#ifdef PAGE_DEBUG
       if (buf && buf->bd_writer != THREAD_CURRENT_THREAD)
 	GPF_T1 ("Thread not writer of buffer in insert row lock");
 #endif
@@ -647,7 +651,7 @@ itc_set_lock_on_row (it_cursor_t * itc, buffer_desc_t ** buf_ret)
   key_ver_t kv;
   page_lock_t *pl = itc->itc_pl;
   cl_enlist_ck (itc);
-#ifdef MTX_DEBUG
+#ifdef PAGE_DEBUG
   if ((*buf_ret)->bd_writer != THREAD_CURRENT_THREAD)
     GPF_T1 ("the thread setting a lock is not the writer of the buffer");
 #endif
@@ -1037,6 +1041,12 @@ pl_finalize_page (page_lock_t * pl, it_cursor_t * itc)
 	}
       ITC_IN_KNOWN_MAP (itc, pl->pl_page);
       page_wait_access (itc, pl->pl_page, NULL, &buf, PA_WRITE, RWG_WAIT_KEY);
+      /* when free remap we do same as on deleted */
+      if (itc->itc_must_kill_trx)
+	{
+	  itc->itc_must_kill_trx = 0;
+	  break;
+	}
     }
   while (itc->itc_to_reset > RWG_WAIT_KEY);
 
diff --git a/libsrc/Wi/row.c b/libsrc/Wi/row.c
index ae84997..6594011 100644
--- a/libsrc/Wi/row.c
+++ b/libsrc/Wi/row.c
@@ -1,7 +1,7 @@
 /*
  *  row.c
  *
- *  $Id: row.c,v 1.18.2.9 2010/02/26 17:28:10 source Exp $
+ *  $Id: row.c,v 1.18.2.10 2010/12/22 10:25:44 source Exp $
  *
  *  Row Operations.
  *
@@ -986,7 +986,7 @@ qst_set_bin_string (caddr_t * state, state_slot_t * sl, db_buf_t data, size_t le
     {
       dtp_t old_dtp = box_tag (old);
       if (!IS_STRING_DTP (old_dtp) &&
-	  ALIGN_4 (box_length (old)) == ALIGN_4 ((uint32) len))
+	  ALIGN_8 (box_length (old)) == ALIGN_8 ((uint32) len))
 	{
 	  box_reuse ((box_t) old, (box_t) data, len, dtp);
 	}
@@ -1569,12 +1569,19 @@ caddr_t
 box_to_shorten_any (caddr_t data, caddr_t * err_ret)
 {
   dtp_t data_dtp = DV_TYPE_OF (data);
+  caddr_t box = NULL, ret;
   size_t data_len;
   if (THR_IS_STACK_OVERFLOW (THREAD_CURRENT_THREAD, &err_ret, (PAGE_DATA_SZ+1500)))
     {
       *err_ret = srv_make_new_error ("42000", "SR483", "Stack Overflow");
       return NULL;
     }
+  if (DV_WIDE == data_dtp)
+    {
+      box = box_wide_as_utf8_char (data, box_length (data) / sizeof (wchar_t) - 1, DV_LONG_STRING);
+      data_dtp = DV_TYPE_OF (box);
+      data = box;
+    }
 #define BOX_SHORT_ANY_LIMIT (128+1+(BOX_AUTO_OVERHEAD-8))
   if (((DV_STRING == data_dtp) || (DV_WIDE == data_dtp) || (DV_BIN == data_dtp)) &&
     (BOX_SHORT_ANY_LIMIT < (data_len = box_length (data))) )
@@ -1595,9 +1602,13 @@ box_to_shorten_any (caddr_t data, caddr_t * err_ret)
       ((boxint *)(tmp + BOX_SHORT_ANY_LIMIT-17))[0] = hi;
       ((boxint *)(tmp + BOX_SHORT_ANY_LIMIT-9))[0] = lo;
       tmp[BOX_SHORT_ANY_LIMIT-1] = '\0';
-      return box_to_any_1 (tmp, err_ret, NULL, 0);
+      ret = box_to_any_1 (tmp, err_ret, NULL, 0);
+      dk_free_box (box);
+      return ret;
     }
-  return box_to_any_1 (data, err_ret, NULL, 0);
+  ret = box_to_any_1 (data, err_ret, NULL, 0);
+  dk_free_box (box);
+  return ret;
 }
 
 
diff --git a/libsrc/Wi/scn3.c b/libsrc/Wi/scn3.c
index 8c99c4d..1389bd2 100644
--- a/libsrc/Wi/scn3.c
+++ b/libsrc/Wi/scn3.c
@@ -370,7 +370,7 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[607] =
+static yyconst flex_int16_t yy_accept[558] =
     {   0,
         0,    0,    0,    0,    0,    0,  112,  112,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
@@ -416,29 +416,23 @@ static yyconst flex_int16_t yy_accept[607] =
         0,    0,    0,    0,   89,   89,    0,    0,  104,  104,
       104,  104,   43,   43,   74,    0,    4,   53,  145,  146,
 
-      133,  134,    0,    0,    0,    0,    0,    0,   96,  104,
-      104,  104,  104,   43,   43,    0,  145,  146,  133,  134,
-        1,    0,   86,   86,    0,    0,    0,    0,    0,    0,
-       89,    0,    0,    0,  104,  104,  104,  104,   43,   43,
-        5,  145,  146,  133,  134,    0,    0,    0,   86,   86,
-        0,    0,    0,    0,    0,    0,   89,    0,  104,  104,
-      104,  104,   43,   43,   43,   43,   43,   43,  145,  146,
-      133,  134,    0,    0,    0,    0,   86,    0,    0,   86,
-        0,    0,    0,    0,    0,   86,    0,    0,    0,   88,
-       88,    0,    0,    0,    0,  104,  104,  104,  103,  103,
-
-      104,  104,   43,   43,   43,   43,   43,   43,   43,   43,
-      145,  146,  133,  134,    0,    0,   89,   89,    0,    0,
-        0,   86,    0,    0,    0,   86,    0,    0,    0,   87,
-       87,    0,    0,    0,  104,  102,  104,   20,   43,   43,
-       43,   43,   43,   43,   43,    0,    0,   89,    0,   86,
-       86,    0,    0,   86,   86,    0,    0,   88,    0,    0,
-        0,  104,  102,  104,   19,   43,   43,   43,   22,   15,
-       43,    0,    0,   86,    0,   86,   88,    0,   87,    0,
-      104,  104,   43,   21,   43,   16,    0,    0,   87,    0,
-      104,  104,  104,   18,   17,   91,   98,   99,  101,  104,
-
-       98,   99,  101,  100,  100,    0
+      133,  134,    0,    0,    0,    0,    0,   96,  104,  104,
+      104,  104,   43,   43,    0,  145,  146,  133,  134,    1,
+        0,   86,   86,    0,    0,    0,    0,    0,   89,    0,
+        0,    0,  104,  104,  104,  104,   43,   43,    5,  145,
+      146,  133,  134,    0,    0,    0,    0,    0,   89,    0,
+      104,  104,  104,  104,   43,   43,   43,   43,   43,   43,
+      145,  146,  133,  134,    0,    0,   86,    0,   88,   88,
+        0,    0,    0,    0,  104,  104,  104,  103,  103,  104,
+      104,   43,   43,   43,   43,   43,   43,   43,   43,  145,
+      146,  133,  134,    0,   86,    0,    0,   87,   87,    0,
+
+        0,    0,  104,  102,  104,   20,   43,   43,   43,   43,
+       43,   43,   43,    0,    0,   88,    0,    0,    0,  104,
+      102,  104,   19,   43,   43,   43,   22,   15,   43,   88,
+        0,   87,    0,  104,  104,   43,   21,   43,   16,   87,
+        0,  104,  104,  104,   18,   17,   91,   98,   99,  101,
+      104,   98,   99,  101,  100,  100,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -486,184 +480,172 @@ static yyconst flex_int32_t yy_meta[85] =
        25,    1,   25,   26
     } ;
 
-static yyconst flex_int16_t yy_base[739] =
+static yyconst flex_int16_t yy_base[686] =
     {   0,
         0,    2,   64,    0,    4,    6,  139,  193,    1,    3,
        14,   22,   24,   26,   34,   37,  256,    0,   40,  148,
       160,  172,  338,  419,  180,  185,  161,  340,  348,  350,
-      352,  363, 1694, 4418, 4418, 1690,  125,  370,   10, 4418,
-     1689,  377, 1682,  336, 4418, 4418, 4418, 4418, 1663,  135,
-     1659,  416,  188,  210, 4418,   30, 1644, 1644, 1627,  160,
-     1640,  173,    0,  166,  331, 1639,  338,  168,  176, 1638,
-     1639,  433, 4418,  461,  463, 4418,  470,    0, 4418, 1642,
-     1625,  182, 4418, 4418,    0, 4418,  201,    0, 1624,    0,
-     4418, 1624, 1598, 1593, 4418, 1600,   26, 1589, 4418, 4418,
-
-      220, 4418, 1566, 4418,  235,  436,  463,    0, 4418, 1578,
-     1573,  244, 1540, 4418, 4418, 4418, 1522, 4418, 4418, 4418,
-     4418, 4418, 4418, 1493, 4418, 1534, 4418,  314, 1481, 4418,
-     1532, 4418,  323,  358, 4418, 1517,  487,  332,  365, 4418,
-     1510,  500,  335, 4418,    1,  505,  385, 4418, 1494, 1461,
-      507,  358,  354,  508,  542, 4418,  548,  571,  580,  383,
-        0,  552, 4418, 4418,    0, 4418, 4418, 4418, 4418, 4418,
-        0,  413, 4418,  364,  436,  388,  417, 4418,  467,  467,
-      470,  464, 4418,    0, 1448,    0,  597,  606,  610,  486,
-      476,  481,  615,  616,    0, 4418,    0,    0,    0, 1428,
-
-        0,  428,    0,    0,    0, 4418,  605, 1400, 1387, 4418,
-     4418, 4418,  393,  463, 4418, 1343, 1361,    0, 1266,  608,
-      627,  638,    0, 4418, 1301, 1219,  527, 4418, 1186, 1168,
-     1162, 1133, 4418, 1093,  473, 4418,    0, 1031,  507, 4418,
-        0,  527,  531,  563, 4418, 1069,  658,    0,  494,  526,
-      587, 4418, 1067,  669,    0,  547, 1056,  665,  669,  608,
+      352,  363, 1455, 4314, 4314, 1444,  125,  370,   10, 4314,
+     1443,  377, 1438,  336, 4314, 4314, 4314, 4314, 1428,  135,
+     1430,  416,  188,  210, 4314,   30, 1406, 1406, 1404,  160,
+     1420,  173,    0,  166,  331, 1408,  338,  168,  176, 1404,
+     1406,  433, 4314,  461,  463, 4314,  470,    0, 4314, 1409,
+     1393,  182, 4314, 4314,    0, 4314,  201,    0, 1391,    0,
+     4314, 1388, 1362, 1376, 4314, 1385,   26, 1360, 4314, 4314,
+
+      220, 4314, 1344, 4314,  235,  436,  463,    0, 4314, 1365,
+     1360,  244, 1348, 4314, 4314, 4314, 1329, 4314, 4314, 4314,
+     4314, 4314, 4314, 1291, 4314, 1342, 4314,  314, 1289, 4314,
+     1340, 4314,  323,  358, 4314, 1321,  487,  332,  365, 4314,
+     1318,  500,  335, 4314,    1,  505,  385, 4314, 1305, 1297,
+      507,  358,  354,  508,  542, 4314,  548,  571,  580,  383,
+        0,  552, 4314, 4314,    0, 4314, 4314, 4314, 4314, 4314,
+        0,  413, 4314,  364,  436,  388,  417, 4314,  467,  467,
+      470,  464, 4314,    0, 1251,    0,  597,  606,  610,  486,
+      476,  481,  615,  616,    0, 4314,    0,    0,    0, 1253,
+
+        0,  428,    0,    0,    0, 4314,  605, 1230, 1218, 4314,
+     4314, 4314,  393,  463, 4314, 1191, 1207,    0, 1124,  608,
+      627,  638,    0, 4314, 1154, 1129,  527, 4314, 1124, 1113,
+     1095, 1061, 4314, 1031,  473, 4314,    0, 1024,  507, 4314,
+        0,  527,  531,  563, 4314, 1024,  658,    0,  494,  526,
+      587, 4314, 1020,  669,    0,  547, 1014,  665,  669,  608,
       605,    0,  690,  609,  626,  627,  626,  689,  695,  708,
       699,  717,  644,    0,    0,    0,  661,  633,    0,    0,
-      968,    0,  672,  680, 1013, 4418, 1008,    0,  742,  742,
+      948,    0,  672,  680,  950, 4314,  949,    0,  742,  742,
       748,  752,  691,    0,    0,    0,    0,    0,    0,    0,
 
-     4418,  697,  972, 4418,    0,  902,  943,  892, 4418,  744,
-     4418, 4418, 4418,    0,    0,  880, 4418,    0,  874, 4418,
-        0,  538,  756,  707,  719,  861,  855,  726,  726,  760,
-      771,  779,  788,    0,  738,  637,  739,  746,  751,  881,
-      871,  801,  765,  770, 4418, 4418,  771,  863,  800, 4418,
-      717,  719,  798,    0,    0,    0,    0,  820,  825,  789,
-      800,  801,  834,  685,  825,  829,    0,    0,  789,  791,
-      644, 4418,  801,    0, 4418,  587,  625, 4418,    0,    0,
-        0,    0,  806,  894, 4418,  606,  581,  805,  538,  819,
-      968,  520,  816,  825, 4418,  816, 4418, 4418, 1034, 1079,
-
-     1133, 1190,  818,  869,  901,  857,  831,  615,  875,  832,
-      871, 1253,  874,  502,  850,    0, 1319, 1364, 1418, 1463,
-     4418,  940, 4418,  448,  982, 1007,  855,  863,  877,  872,
-      928,  944, 1130,  966,  878,  883,  943,  888, 1166,  916,
-     4418, 1508, 1553, 1598, 1643,    0,  382, 1028, 4418,  951,
-     1055, 1100, 1267, 1142,  872,  938, 4418,  943,  976,  977,
-     1291,  984,  989,  977, 1085, 1011, 1028, 1129, 1688, 1733,
-     1778, 1823,  373, 1002, 1036, 1075, 4418, 1034, 1298, 1077,
-     1326, 1385, 1413, 1079, 1316, 1081, 1439, 1484, 1213, 4418,
-      372,  341, 1353, 1012, 1053, 1078,  235, 1122, 4418,  236,
-
-     1512, 1101, 1077, 1099, 1107, 1130, 1153, 1174, 1172, 1190,
-      141,  132,  565, 1868, 1357, 1177,  169, 1179, 1103, 1233,
-     1281, 4418, 1542, 1235, 1288, 4418, 1574, 1114, 1549, 4418,
-      164,  136, 1605, 1212, 1129, 1126, 1159,    0, 1183, 1240,
-     1249, 1255, 1259, 1282, 1281, 1620, 1635,   53, 1360,   51,
-     1368, 1166, 1405,   46, 1407, 1240, 1270, 1362, 1388, 1639,
-     1355, 1368, 1322,   22,    0, 1327, 1399, 1377,    0,    0,
-     1411, 1664, 1679,   39, 1683,   12, 4418, 1453, 1459, 1393,
-     1417, 1647, 1437,    0, 1457,    0, 1709, 1726, 4418, 1464,
-       17, 1431, 1457,    0,    0, 1465, 1505, 1506, 1507, 1507,
-
-     1554, 1555, 1587, 1595, 1596, 4418, 1931, 1957, 1983, 2009,
-     2035, 2061, 2087, 2113, 2139, 2165, 2191, 2217, 2243, 2269,
-     2283, 2292, 2313, 2334, 2360, 2386, 1586, 2412, 2438, 2464,
-     2480, 2500, 2521, 2547, 2573, 2599, 2621, 2647, 2668, 2690,
-     2711, 2733, 2754, 2776, 2797, 2819, 2845, 1634, 2859, 2871,
-     2880, 2897, 2909, 2935, 2961, 2987, 3013, 3039, 1678, 3065,
-     3091, 3117, 3143, 3159, 3179, 3200, 3204, 3215, 3239, 3265,
-     3291, 3317, 3339, 3365, 3386, 1719, 3408, 3429, 1721, 3451,
-     3472, 1743, 3494, 3515, 1756, 3537, 1758, 3551, 3563, 3584,
-     3604, 3616, 3642, 3668, 3694, 3720, 3746, 3772, 3798, 3820,
-
-     3829, 3840, 3859, 3873, 1760, 1767, 3897, 1769, 3923, 1771,
-     3949, 1788, 3963, 3984, 4003, 1801, 1803, 1805, 1812, 4027,
-     1814, 1816, 1833, 1846, 4053, 4079, 4105, 4131, 4157, 4183,
-     4209, 4235, 4261, 4287, 4313, 4339, 4365, 4391
+     4314,  697,  923, 4314,    0,  879,  894,  831, 4314,  744,
+     4314, 4314, 4314,    0,    0,  815, 4314,    0,  811, 4314,
+        0,  538,  756,  707,  719,  799,  716,  726,  726,  760,
+      771,  779,  788,    0,  738,  637,  739,  746,  751,  720,
+      700,  801,  765,  770, 4314, 4314,  771,  647,  587, 4314,
+      576,  602,  798,    0,    0,    0,    0,  820,  825,  789,
+      800,  801,  834,  575,  825,  829,    0,    0,  789,  791,
+      585, 4314,  801,    0, 4314,  521,  552, 4314,    0,    0,
+        0,    0,  806,  894, 4314,  448,  382,  805,  323,  819,
+      968,  318,  816,  825, 4314,  816, 4314, 4314, 1034, 1079,
+
+     1133, 1190,  818,  869,  850,  831,  615,  873,  842,  846,
+     1253,  846,  300,  850,    0, 1319, 1364, 1418, 1463, 4314,
+      921, 4314,  246,  223,  857,  855,  858,  908,  914,  940,
+      957,  958,  859,  859,  932,  868,  967,  886, 4314, 1508,
+     1553, 1598, 1643,    0,  940,  985,  895,  922, 4314,  891,
+      954,  967, 1041,  976,  981,  896, 1036,  979,  996, 1045,
+     1688, 1733, 1778, 1823,  189,  968, 1013, 1068, 4314,  184,
+      160, 1113,  959, 1014, 1027,  153, 1117, 4314,  149, 1128,
+     1027, 1024, 1031, 1081, 1092, 1096, 1114, 1112, 1108,    5,
+        3,  565, 1868, 1155, 4314, 1015, 1173, 4314,   50,   32,
+
+     1182, 1144, 1136,  959, 1142,    0, 1152, 1150, 1152, 1158,
+     1156, 1171, 1170, 1267, 1079, 1087, 1122, 1282, 1168, 1179,
+     1035,   20,    0, 1166, 1179, 1176,    0,    0, 1212, 4314,
+     1166, 1179, 1221, 1226, 1246, 1256,    0, 1258,    0, 4314,
+     1233,   17, 1244, 1258,    0,    0, 1234, 1235, 1291, 1292,
+     1247, 1300, 1301, 1306, 1308, 1312, 4314, 1931, 1957, 1983,
+     2009, 2035, 2061, 2087, 2113, 2139, 2165, 2191, 2217, 2243,
+     2269, 2283, 2292, 2313, 2334, 2360, 2386, 1310, 2412, 2438,
+     2464, 2480, 2500, 2521, 2547, 2573, 2599, 2621, 2647, 2668,
+     2690, 2711, 2733, 2754, 2776, 2797, 2819, 2845, 1312, 2859,
+
+     2871, 2880, 2897, 2909, 2935, 2961, 2987, 3013, 3039, 1314,
+     3065, 3091, 3117, 3143, 3159, 3179, 3200, 3204, 3215, 3239,
+     3265, 3291, 3317, 3339, 3365, 3386, 1329, 3408, 3429, 1342,
+     3451, 3472, 1344, 3494, 3515, 1346, 3537, 1353, 3551, 3563,
+     3584, 3604, 3616, 3642, 3668, 3694, 3720, 3746, 3772, 3798,
+     3820, 3829, 3840, 3859, 3873, 1357, 1374, 3897, 1387, 3923,
+     1389, 3949, 1391, 3963, 3984, 4003, 1398, 1402, 1416, 1423,
+     4027, 1441, 1443, 1445, 1452, 4053, 4079, 4105, 4131, 4157,
+     4183, 4209, 4235, 4261, 4287
     } ;
 
-static yyconst flex_int16_t yy_def[739] =
+static yyconst flex_int16_t yy_def[686] =
     {   0,
-      607,  607,  606,    3,  608,  608,  609,  609,  609,  609,
-      610,  610,  611,  611,  612,  612,  606,   17,  613,  613,
-      614,  614,  615,  615,  616,  616,  617,  617,  618,  618,
-      619,  619,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  620,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  621,  606,  606,  606,  606,  606,  622,
-      622,  622,  622,  622,  622,  622,  622,  622,  622,  622,
-      623,  624,  606,  606,  606,  606,  622,  625,  606,  606,
-      606,  626,  606,  606,  627,  606,  606,  628,  606,  629,
-      606,  606,  606,  630,  606,  606,  630,  606,  606,  606,
-
-      631,  606,  606,  606,  632,  606,  606,  633,  606,  606,
-      634,  635,  636,  606,  606,  606,  637,  606,  606,  606,
-      606,  606,  606,  638,  606,  606,  606,  639,  640,  606,
-      606,  606,  641,  642,  606,  606,  642,  643,  644,  606,
-      606,  644,  645,  606,  606,  606,  606,  606,  646,  606,
-      606,  606,  606,  647,  606,  606,  606,  606,  606,  606,
-      648,  606,  606,  606,  649,  606,  606,  606,  606,  606,
-      650,  650,  606,  650,  650,  650,  650,  606,  650,  650,
-      650,  650,  606,  651,  652,  653,  653,  606,  606,  606,
-      606,  606,  606,  650,  654,  606,  655,  656,  657,  658,
-
-      659,  606,  660,  661,  662,  606,  606,  663,  663,  606,
-      606,  606,  664,  664,  606,  665,  666,  667,  668,  606,
-      606,  606,  669,  606,  670,  606,  671,  606,  606,  672,
-      606,  673,  606,  674,  675,  606,  676,  677,  678,  606,
-      679,  680,  680,  681,  606,  606,  680,  682,  683,  683,
-      684,  606,  606,  683,  685,  606,  606,  606,  606,  606,
-      606,  686,  686,  686,  686,  686,  686,  606,  606,  606,
-      606,  606,  606,  687,  688,  689,  689,  689,  689,  689,
-      689,  689,  689,  689,  690,  606,  691,  692,  692,  606,
-      606,  606,  606,  693,  694,  695,  696,  697,  698,  699,
-
-      606,  606,  700,  606,  701,  702,  703,  704,  606,  606,
-      606,  606,  606,  705,  706,  707,  606,  708,  709,  606,
-      710,  606,  606,  606,  606,  711,  711,  711,  711,  606,
-      606,  606,  606,  712,  713,  713,  713,  713,  713,  606,
-      714,  606,  606,  606,  606,  606,  606,  715,  702,  606,
-      606,  703,  606,  716,  717,  718,  719,  606,  606,  606,
-      711,  711,  711,  711,  606,  606,  712,  713,  713,  713,
-      713,  606,  606,  720,  606,  606,  715,  606,  721,  722,
-      723,  724,  606,  606,  606,  606,  606,  606,  711,  711,
-      725,  711,  713,  713,  606,  606,  606,  606,  726,  727,
-
-      728,  709,  606,  606,  606,  606,  606,  729,  606,  711,
-      711,  725,  711,  713,  713,  730,  726,  727,  728,  402,
-      606,  606,  606,  606,  729,  606,  606,  606,  606,  729,
-      729,  606,  606,  606,  711,  711,  711,  711,  713,  713,
-      606,  417,  418,  419,  402,  731,  606,  729,  606,  729,
-      732,  729,  733,  606,  606,  606,  606,  606,  711,  711,
-      711,  711,  713,  713,  713,  713,  713,  713,  417,  418,
-      419,  402,  731,  733,  734,  729,  606,  732,  732,  732,
-      732,  732,  729,  733,  733,  733,  733,  733,  606,  606,
-      606,  606,  606,  606,  606,  711,  711,  711,  606,  606,
-
-      711,  711,  713,  713,  713,  713,  713,  713,  713,  713,
-      726,  727,  728,  402,  606,  734,  731,  734,  732,  735,
-      732,  606,  732,  736,  733,  606,  733,  737,  606,  606,
-      606,  606,  606,  606,  711,  711,  711,  713,  713,  713,
-      713,  713,  713,  713,  713,  606,  729,  731,  735,  731,
-      735,  732,  736,  731,  736,  733,  737,  737,  738,  606,
-      606,  711,  711,  711,  713,  713,  713,  713,  713,  713,
-      713,  729,  732,  731,  733,  731,  606,  738,  738,  606,
-      711,  711,  713,  713,  713,  713,  732,  733,  606,  606,
-      711,  711,  711,  713,  713,  606,  711,  711,  711,  711,
-
-      711,  711,  711,  711,  711,    0,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
+      558,  558,  557,    3,  559,  559,  560,  560,  560,  560,
+      561,  561,  562,  562,  563,  563,  557,   17,  564,  564,
+      565,  565,  566,  566,  567,  567,  568,  568,  569,  569,
+      570,  570,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  571,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  572,  557,  557,  557,  557,  557,  573,
+      573,  573,  573,  573,  573,  573,  573,  573,  573,  573,
+      574,  575,  557,  557,  557,  557,  573,  576,  557,  557,
+      557,  577,  557,  557,  578,  557,  557,  579,  557,  580,
+      557,  557,  557,  581,  557,  557,  581,  557,  557,  557,
+
+      582,  557,  557,  557,  583,  557,  557,  584,  557,  557,
+      585,  586,  587,  557,  557,  557,  588,  557,  557,  557,
+      557,  557,  557,  589,  557,  557,  557,  590,  591,  557,
+      557,  557,  592,  593,  557,  557,  593,  594,  595,  557,
+      557,  595,  596,  557,  557,  557,  557,  557,  597,  557,
+      557,  557,  557,  598,  557,  557,  557,  557,  557,  557,
+      599,  557,  557,  557,  600,  557,  557,  557,  557,  557,
+      601,  601,  557,  601,  601,  601,  601,  557,  601,  601,
+      601,  601,  557,  602,  603,  604,  604,  557,  557,  557,
+      557,  557,  557,  601,  605,  557,  606,  607,  608,  609,
+
+      610,  557,  611,  612,  613,  557,  557,  614,  614,  557,
+      557,  557,  615,  615,  557,  616,  617,  618,  619,  557,
+      557,  557,  620,  557,  621,  557,  622,  557,  557,  623,
+      557,  624,  557,  625,  626,  557,  627,  628,  629,  557,
+      630,  631,  631,  632,  557,  557,  631,  633,  634,  634,
+      635,  557,  557,  634,  636,  557,  557,  557,  557,  557,
+      557,  637,  637,  637,  637,  637,  637,  557,  557,  557,
+      557,  557,  557,  638,  639,  640,  640,  640,  640,  640,
+      640,  640,  640,  640,  641,  557,  642,  643,  643,  557,
+      557,  557,  557,  644,  645,  646,  647,  648,  649,  650,
+
+      557,  557,  651,  557,  652,  653,  654,  655,  557,  557,
+      557,  557,  557,  656,  657,  658,  557,  659,  660,  557,
+      661,  557,  557,  557,  557,  662,  662,  662,  662,  557,
+      557,  557,  557,  663,  664,  664,  664,  664,  664,  557,
+      665,  557,  557,  557,  557,  557,  557,  666,  653,  557,
+      557,  654,  557,  667,  668,  669,  670,  557,  557,  557,
+      662,  662,  662,  662,  557,  557,  663,  664,  664,  664,
+      664,  557,  557,  671,  557,  557,  666,  557,  672,  673,
+      674,  675,  557,  557,  557,  557,  557,  557,  662,  662,
+      676,  662,  664,  664,  557,  557,  557,  557,  677,  678,
+
+      679,  660,  557,  557,  557,  557,  680,  557,  662,  662,
+      676,  662,  664,  664,  681,  677,  678,  679,  402,  557,
+      557,  557,  557,  557,  557,  557,  557,  680,  680,  557,
+      557,  557,  662,  662,  662,  662,  664,  664,  557,  416,
+      417,  418,  402,  682,  683,  557,  557,  557,  557,  557,
+      662,  662,  662,  662,  664,  664,  664,  664,  664,  664,
+      416,  417,  418,  402,  682,  683,  683,  557,  557,  557,
+      557,  557,  557,  557,  662,  662,  662,  557,  557,  662,
+      662,  664,  664,  664,  664,  664,  664,  664,  664,  677,
+      678,  679,  402,  557,  557,  684,  557,  557,  557,  557,
+
+      557,  557,  662,  662,  662,  664,  664,  664,  664,  664,
+      664,  664,  664,  557,  684,  684,  685,  557,  557,  662,
+      662,  662,  664,  664,  664,  664,  664,  664,  664,  557,
+      685,  685,  557,  662,  662,  664,  664,  664,  664,  557,
+      557,  662,  662,  662,  664,  664,  557,  662,  662,  662,
+      662,  662,  662,  662,  662,  662,    0,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
 
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557
     } ;
 
-static yyconst flex_int16_t yy_nxt[4503] =
+static yyconst flex_int16_t yy_nxt[4399] =
     {   0,
-      606,  606,   35,   36,   35,   36,   79,   80,   79,   80,
-       86,  147,   86,   81,  147,   81,   79,   80,  515,   87,
+      557,  557,   35,   36,   35,   36,   79,   80,   79,   80,
+       86,  147,   86,   81,  147,   81,   79,   80,  557,   87,
        87,   87,   87,   89,   79,   80,   91,   92,   91,   92,
-      597,   89,  598,   37,  256,   37,   95,   96,  606,   95,
-       96,  103,   83,  211,  103,  515,   97,  582,   93,   97,
-       93,   98,  515,  103,   98,  166,  167,  515,   82,  515,
+      548,   89,  549,   37,  256,   37,   95,   96,  557,   95,
+       96,  103,   83,  211,  103,  535,   97,  517,   93,   97,
+       93,   98,  498,  103,   98,  166,  167,  239,   82,  235,
        82,   37,  256,   37,   38,   39,   40,   41,   39,   42,
        43,   44,   38,   45,   46,   47,   48,   48,   48,   49,
        50,   51,   52,   53,   53,   53,   54,   55,   56,   57,
@@ -674,17 +656,17 @@ static yyconst flex_int16_t yy_nxt[4503] =
        63,   60,   61,   62,   63,   64,   63,   63,   63,   63,
        63,   63,   65,   66,   63,   63,   63,   63,   67,   68,
        69,   63,   70,   63,   74,   75,   76,   77,   84,  103,
-       83,  559,  103,  155,  155,  155,  155,   85,   85,   85,
-       85,  103,   83,  130,  131,  105,  530,  132,   85,   85,
-       85,   85,   85,   85,   83,  515,  145,  105,  106,  107,
-      107,  107,  125,  126,  199,  200,  239,  125,  126,  127,
-      106,  107,  107,  107,  127,  235,   85,   85,   85,   85,
+       83,  478,  103,  155,  155,  155,  155,   85,   85,   85,
+       85,  103,   83,  130,  131,  105,  504,  132,   85,   85,
+       85,   85,   85,   85,   83,  496,  145,  105,  106,  107,
+      107,  107,  125,  126,  199,  200,  469,  125,  126,  127,
+      106,  107,  107,  107,  127,  494,   85,   85,   85,   85,
 
        85,   85,   84,  145,  157,  181,  158,  158,  158,  158,
       172,   85,   85,   85,   85,  133,  174,  175,  182,  202,
       202,  159,   85,   85,   85,   85,   85,   85,  162,  162,
-      162,  162,  163,  181,  128,  164,  214,  172,  499,  128,
-      217,  218,  215,  174,  175,  182,  228,  229,  536,  159,
+      162,  162,  163,  181,  128,  164,  214,  172,  445,  128,
+      217,  218,  215,  174,  175,  182,  228,  229,  422,  159,
        85,   85,   85,   85,   85,   85,   99,   99,   83,   99,
        99,   99,   99,   99,   99,   99,   99,   99,   99,   99,
        99,   99,   99,   99,   99,   99,   99,   99,  100,   99,
@@ -696,21 +678,21 @@ static yyconst flex_int16_t yy_nxt[4503] =
       101,  101,  101,  101,  101,  101,  101,  101,  101,  101,
       101,  101,  101,  101,  101,  101,   99,   99,   99,   99,
       109,  110,  130,  131,  111,  112,  132,  113,  114,  115,
-      135,  136,  135,  136,  140,  141,  528,  137,  142,  137,
+      135,  136,  135,  136,  140,  141,  437,  137,  142,  137,
       176,  116,  117,  237,  118,  140,  141,  243,  177,  142,
-      146,  250,  241,  151,  490,  146,  152,  146,  146,  515,
+      146,  250,  241,  151,  412,  146,  152,  146,  146,  409,
       153,  248,  146,  179,  255,  146,  147,  180,  176,  147,
-      237,  119,  120,  121,  133,  260,  177,  474,  146,  241,
+      237,  119,  120,  121,  133,  260,  177,  407,  146,  241,
 
       261,  151,  138,  152,  138,  146,  143,  153,  248,  214,
       179,  255,  244,  277,  180,  215,  273,  143,  122,  251,
       123,  109,  110,  260,  146,  111,  112,  261,  113,  114,
       115,  146,  157,  146,  158,  158,  158,  158,  146,  279,
       277,  146,  116,  117,  273,  118,  202,  202,  276,  159,
-      423,  146,  160,  146,  220,  221,  221,  221,  146,  280,
+      385,  146,  160,  146,  220,  221,  221,  221,  146,  280,
       146,  146,  188,  146,  188,  188,  279,  161,  146,  278,
       146,  146,  119,  120,  121,  146,  276,  159,  146,  214,
-      160,  222,  222,  222,  222,  606,  280,  146,  189,  245,
+      160,  222,  222,  222,  222,  557,  280,  146,  189,  245,
       246,  146,  190,  284,  161,  191,  247,  278,  194,  122,
 
       250,  123,  252,  253,  192,  146,  254,  281,  282,  263,
@@ -718,158 +700,158 @@ static yyconst flex_int16_t yy_nxt[4503] =
       190,  284,  237,  191,  146,  258,  258,  258,  258,  228,
       229,  192,  319,  146,  281,  282,  243,  259,  283,  358,
       316,  244,  358,  293,  193,  294,  146,  295,  251,  237,
-      264,  146,  265,  194,  251,  266,  241,  267,  439,  146,
+      264,  146,  265,  194,  251,  266,  241,  267,  376,  146,
       155,  155,  155,  155,  269,  259,  270,  270,  270,  270,
-      162,  162,  162,  162,  243,  268,  413,  264,  322,  265,
+      162,  162,  162,  162,  243,  268,  398,  264,  322,  265,
       251,  244,  266,  241,  267,  244,  146,  157,  146,  158,
-      158,  158,  158,  271,  410,  271,  408,  146,  272,  272,
+      158,  158,  158,  271,  395,  271,  392,  146,  272,  272,
 
-      272,  272,  146,  268,  159,  146,  322,  188,  385,  188,
-      188,  291,  248,  291,  291,  146,  146,  385,  431,  244,
+      272,  272,  146,  268,  159,  146,  322,  188,  351,  188,
+      188,  291,  248,  291,  291,  146,  146,  385,  429,  244,
       146,  146,  301,  146,  146,  146,  220,  221,  221,  221,
-      301,  376,  159,  290,  325,  292,  255,  190,  358,  248,
-      191,  358,  398,  146,  194,  222,  222,  222,  222,  192,
-      324,  289,  326,  395,  301,  302,  310,  310,  310,  310,
+      301,  378,  159,  290,  325,  292,  255,  190,  358,  248,
+      191,  358,  350,  146,  194,  222,  222,  222,  222,  192,
+      324,  289,  326,  376,  301,  302,  310,  310,  310,  310,
       245,  246,  325,  255,  336,  190,  327,  317,  191,  146,
       146,  252,  253,  328,  329,  320,  192,  324,  146,  326,
       289,  301,  302,  258,  258,  258,  258,  323,  323,  323,
       323,  263,  336,  327,  263,  334,  146,  146,  146,  194,
 
-      328,  329,  330,  335,  330,  338,  392,  331,  331,  331,
+      328,  329,  330,  335,  330,  338,  340,  331,  331,  331,
       331,  269,  244,  332,  332,  332,  332,  272,  272,  272,
-      272,  339,  334,  251,  269,  351,  270,  270,  270,  270,
+      272,  339,  334,  251,  269,  372,  270,  270,  270,  270,
       335,  344,  264,  338,  265,  272,  272,  272,  272,  267,
       359,  333,  146,  291,  347,  291,  291,  146,  339,  291,
       146,  291,  291,  342,  360,  342,  342,  363,  344,  264,
       364,  265,  353,  353,  353,  353,  267,  292,  359,  333,
-      146,  347,  378,  292,  323,  323,  323,  323,  331,  331,
+      146,  347,  362,  292,  323,  323,  323,  323,  331,  331,
       331,  331,  360,  343,  371,  363,  368,  369,  364,  331,
       331,  331,  331,  370,  373,  269,  289,  332,  332,  332,
 
       332,  365,  342,  365,  342,  342,  366,  366,  366,  366,
       374,  343,  371,  368,  369,  375,  353,  353,  353,  353,
       370,  358,  373,  146,  358,  289,  384,  385,  386,  384,
-      388,  389,  343,  390,  409,  391,  393,  374,  391,  394,
+      388,  389,  343,  390,  408,  391,  393,  374,  391,  394,
       387,  396,  375,  366,  366,  366,  366,  366,  366,  366,
-      366,  403,  411,  414,  415,  350,  416,  388,  421,  389,
-      343,  390,  409,  393,  429,  435,  394,  383,  396,  376,
-      422,  423,  424,  422,  385,  431,  432,  340,  403,  433,
-      411,  414,  415,  416,  425,  421,  372,  405,  405,  405,
-      405,  440,  429,  435,  383,  384,  385,  386,  384,  454,
-
-      427,  436,  422,  423,  424,  422,  428,  438,  493,  404,
-      455,  362,  405,  405,  405,  405,  426,  361,  440,  405,
-      405,  405,  405,  434,  456,  459,  454,  427,  251,  436,
-      457,  431,  460,  428,  244,  438,  493,  455,  406,  462,
-      407,  422,  423,  424,  422,  432,  446,  309,  432,  351,
-      434,  456,  459,  477,  431,  447,  461,  350,  461,  460,
-      468,  461,  461,  461,  461,  406,  462,  407,  262,  391,
-      434,  494,  391,  262,  262,  262,  262,  262,  262,  262,
-      262,  262,  262,  448,  449,  450,  448,  468,  458,  495,
-      262,  262,  262,  262,  262,  262,  262,  451,  304,  494,
-
-      452,  452,  452,  452,  423,  486,  152,  496,  422,  423,
-      424,  422,  497,  286,  434,  458,  495,  502,  503,  340,
-      504,  262,  453,  262,  337,  405,  405,  405,  405,  448,
-      449,  450,  448,  152,  475,  496,  449,  480,  517,  518,
-      497,  434,  430,  476,  507,  502,  503,  504,  262,  262,
-      262,  262,  417,  417,  417,  417,  479,  449,  480,  479,
-      533,  508,  149,  417,  417,  417,  417,  417,  417,  252,
-      481,  245,  507,  482,  482,  482,  482,  385,  431,  522,
-      480,  423,  486,  526,  486,  239,  534,  533,  235,  508,
-      519,  417,  417,  417,  417,  417,  417,  418,  418,  418,
-
-      418,  448,  449,  450,  448,  449,  480,  535,  418,  418,
-      418,  418,  418,  418,  534,  483,  490,  558,  452,  452,
-      452,  452,  505,  498,  499,  500,  498,  563,  506,  538,
-      563,  432,  537,  239,  433,  535,  418,  418,  418,  418,
-      418,  418,  243,  489,  490,  491,  489,  235,  539,  540,
-      505,  419,  419,  419,  419,  506,  538,  492,  509,  233,
-      537,  510,  419,  419,  419,  419,  419,  419,  449,  480,
-      152,  313,  541,  562,  458,  539,  540,  311,  434,  517,
-      518,  548,  518,  547,  542,  547,  509,  244,  228,  510,
-      419,  419,  419,  419,  419,  419,  250,  152,  463,  541,
-
-      562,  458,  464,  543,  544,  434,  564,  465,  420,  420,
-      420,  420,  542,  466,  489,  490,  491,  489,  467,  420,
-      420,  420,  420,  420,  420,  312,  463,  545,  492,  565,
-      464,  543,  544,  564,  465,  550,  551,  554,  555,  478,
-      466,  484,  423,  486,  251,  467,  561,  420,  420,  420,
-      420,  420,  420,  262,  262,  545,  565,  262,  262,  262,
-      262,  262,  262,  262,  262,  262,  262,  262,  485,  423,
-      486,  485,  490,  558,  561,  437,  262,  262,  262,  262,
-      262,  262,  487,  449,  480,  488,  488,  488,  488,  566,
-      423,  486,  498,  499,  500,  498,  552,  567,  568,  479,
-
-      449,  480,  479,  556,  520,  569,  262,  311,  262,  501,
-      501,  501,  501,  521,  570,  571,  566,  485,  423,  486,
-      485,  309,  524,  563,  567,  568,  563,  479,  449,  480,
-      479,  525,  569,  262,  262,  262,  262,  442,  442,  442,
-      442,  481,  570,  571,  482,  482,  482,  482,  442,  442,
-      442,  442,  442,  442,  529,  530,  531,  529,  546,  423,
-      424,  546,  550,  551,  577,  558,  573,  305,  532,  304,
-      574,  551,  447,  235,  573,  583,  442,  442,  442,  442,
-      442,  442,  443,  443,  443,  443,  479,  449,  480,  479,
-      530,  579,  580,  443,  443,  443,  443,  443,  443,  606,
-
-      523,  581,  583,  482,  482,  482,  482,  554,  555,  576,
-      555,  575,  209,  575,  448,  449,  450,  448,  239,  585,
-      580,  443,  443,  443,  443,  443,  443,  243,  451,  581,
-      199,  452,  452,  452,  452,  584,  444,  444,  444,  444,
-      485,  423,  486,  485,  590,  586,  585,  444,  444,  444,
-      444,  444,  444,  286,  487,  530,  579,  488,  488,  488,
-      488,  589,  579,  584,  591,  596,  596,  149,  596,  596,
-      594,  590,  244,  586,  599,  444,  444,  444,  444,  444,
-      444,  445,  445,  445,  445,  485,  423,  486,  485,  595,
-      600,  591,  445,  445,  445,  445,  445,  445,  594,  527,
-
-      257,  599,  488,  488,  488,  488,  601,  602,  603,  601,
-      602,  603,  252,  498,  499,  500,  498,  595,  600,  245,
-      445,  445,  445,  445,  445,  445,  469,  469,  469,  469,
-      501,  501,  501,  501,  240,  239,  236,  469,  469,  469,
-      469,  469,  469,  479,  449,  480,  479,  235,  233,  231,
-      529,  530,  531,  529,  604,  601,  602,  481,  601,  602,
-      482,  482,  482,  482,  532,  469,  469,  469,  469,  469,
-      469,  470,  470,  470,  470,  485,  423,  486,  485,  226,
-      224,  604,  470,  470,  470,  470,  470,  470,  603,  487,
-      216,  603,  488,  488,  488,  488,  605,  605,  201,  605,
-
-      605,  212,  210,  201,  201,  209,  560,  385,  386,  560,
-      470,  470,  470,  470,  470,  470,  471,  471,  471,  471,
-      387,  546,  423,  424,  546,  207,  206,  471,  471,  471,
-      471,  471,  471,  204,  197,  447,  572,  449,  450,  572,
-      560,  385,  386,  560,  196,  184,  274,  183,  178,  173,
-      476,  274,  274,  170,  387,  471,  471,  471,  471,  471,
-      471,  472,  472,  472,  472,  572,  449,  450,  572,  169,
-      168,  156,  472,  472,  472,  472,  472,  472,  154,  476,
-      587,  449,  480,  587,  588,  423,  486,  588,  150,  592,
-      201,  148,  144,  606,  521,  201,  201,  606,  525,  593,
-
-      472,  472,  472,  472,  472,  472,  511,  511,  511,  511,
-      587,  449,  480,  587,  606,  606,  592,  511,  511,  511,
-      511,  511,  511,  606,  521,  606,  593,  588,  423,  486,
-      588,  314,  606,  315,  606,  606,  314,  314,  315,  315,
-      606,  525,  606,  606,  606,  511,  511,  511,  511,  511,
-      511,  512,  512,  512,  512,  318,  606,  606,  606,  606,
-      318,  318,  512,  512,  512,  512,  512,  512,  321,  606,
-      274,  606,  354,  321,  321,  274,  274,  354,  354,  355,
-      606,  356,  606,  357,  355,  355,  356,  356,  357,  357,
-      512,  512,  512,  512,  512,  512,  513,  513,  513,  513,
-
-      367,  606,  606,  606,  606,  367,  367,  513,  513,  513,
-      513,  513,  513,  379,  606,  380,  606,  381,  379,  379,
-      380,  380,  381,  381,  382,  606,  399,  606,  400,  382,
-      382,  399,  399,  400,  400,  513,  513,  513,  513,  513,
-      513,  514,  514,  514,  514,  401,  606,  606,  606,  606,
-      401,  401,  514,  514,  514,  514,  514,  514,  402,  606,
-      606,  606,  606,  402,  402,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      514,  514,  514,  514,  514,  514,  249,  249,  249,  249,
-      606,  606,  606,  606,  606,  606,  606,  249,  249,  249,
+      366,  403,  410,  413,  414,  361,  415,  388,  420,  389,
+      343,  390,  408,  393,  427,  251,  394,  383,  396,  244,
+      421,  422,  423,  421,  430,  433,  434,  431,  403,  436,
+      410,  413,  414,  415,  424,  420,  309,  404,  404,  404,
+      404,  438,  427,  425,  383,  384,  385,  386,  384,  426,
+
+      351,  446,  447,  433,  434,  448,  451,  436,  452,  387,
+      385,  429,  404,  404,  404,  404,  449,  429,  438,  454,
+      425,  432,  421,  422,  423,  421,  426,  444,  446,  447,
+      460,  472,  448,  451,  350,  452,  424,  474,  405,  483,
+      406,  430,  422,  467,  430,  453,  454,  453,  432,  304,
+      453,  453,  453,  453,  286,  473,  340,  460,  430,  472,
+      521,  431,  432,  521,  474,  405,  483,  406,  262,  391,
+      422,  467,  391,  262,  262,  262,  262,  262,  262,  262,
+      262,  262,  262,  473,  450,  475,  468,  469,  470,  468,
+      262,  262,  262,  262,  262,  262,  262,  152,  152,  455,
+
+      471,  450,  476,  456,  337,  432,  432,  501,  457,  481,
+      482,  450,  486,  475,  458,  495,  467,  469,  516,  459,
+      149,  262,  252,  262,  152,  152,  245,  455,  450,  487,
+      476,  456,  432,  432,  501,  457,  521,  481,  482,  521,
+      486,  458,  477,  478,  479,  477,  459,  502,  262,  262,
+      262,  262,  416,  416,  416,  416,  503,  487,  505,  480,
+      480,  480,  480,  416,  416,  416,  416,  416,  416,  468,
+      469,  470,  468,  484,  488,  502,  506,  489,  239,  485,
+      507,  469,  516,  471,  503,  235,  505,  233,  235,  530,
+      516,  416,  416,  416,  416,  416,  416,  417,  417,  417,
+
+      417,  484,  488,  506,  313,  489,  485,  507,  417,  417,
+      417,  417,  417,  417,  497,  498,  499,  497,  477,  478,
+      479,  477,  311,  508,  498,  532,  228,  510,  500,  477,
+      478,  479,  477,  239,  509,  312,  417,  417,  417,  417,
+      417,  417,  243,  511,  512,  513,  480,  480,  480,  480,
+      508,  418,  418,  418,  418,  510,  514,  422,  423,  514,
+      311,  509,  418,  418,  418,  418,  418,  418,  498,  532,
+      424,  511,  512,  513,  497,  498,  499,  497,  519,  309,
+      520,  540,  532,  518,  385,  386,  518,  244,  500,  522,
+      418,  418,  418,  418,  418,  418,  250,  387,  523,  524,
+
+      525,  526,  527,  528,  529,  533,  519,  520,  419,  419,
+      419,  419,  534,  305,  536,  537,  522,  304,  538,  419,
+      419,  419,  419,  419,  419,  523,  524,  525,  526,  527,
+      557,  528,  529,  533,  547,  547,  552,  547,  547,  552,
+      534,  536,  209,  537,  251,  538,  539,  419,  419,  419,
+      419,  419,  419,  262,  262,  199,  286,  262,  262,  262,
+      262,  262,  262,  262,  262,  262,  262,  262,  514,  422,
+      423,  514,  541,  542,  539,  435,  262,  262,  262,  262,
+      262,  262,  424,  518,  385,  386,  518,  550,  543,  545,
+      546,  551,  553,  554,  555,  553,  554,  387,  544,  541,
+
+      542,  552,  553,  149,  552,  553,  262,  554,  262,  556,
+      554,  257,  556,  556,  550,  543,  556,  545,  546,  551,
+      252,  555,  201,  245,  274,  544,  201,  201,  201,  274,
+      274,  201,  201,  262,  262,  262,  262,  440,  440,  440,
+      440,  314,  240,  239,  236,  235,  314,  314,  440,  440,
+      440,  440,  440,  440,  315,  233,  318,  231,  321,  315,
+      315,  318,  318,  321,  321,  274,  226,  224,  216,  354,
+      274,  274,  212,  235,  354,  354,  440,  440,  440,  440,
+      440,  440,  441,  441,  441,  441,  355,  210,  209,  207,
+      206,  355,  355,  441,  441,  441,  441,  441,  441,  356,
+
+      204,  357,  197,  367,  356,  356,  357,  357,  367,  367,
+      379,  196,  184,  183,  380,  379,  379,  178,  239,  380,
+      380,  441,  441,  441,  441,  441,  441,  243,  381,  173,
+      170,  169,  168,  381,  381,  382,  442,  442,  442,  442,
+      382,  382,  156,  154,  150,  148,  144,  442,  442,  442,
+      442,  442,  442,  399,  557,  400,  557,  401,  399,  399,
+      400,  400,  401,  401,  402,  557,  557,  557,  557,  402,
+      402,  557,  244,  557,  557,  442,  442,  442,  442,  442,
+      442,  443,  443,  443,  443,  557,  557,  557,  557,  557,
+      557,  557,  443,  443,  443,  443,  443,  443,  557,  557,
 
-      249,  249,  249,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  249,  249,  249,  249,  249,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      443,  443,  443,  443,  443,  443,  461,  461,  461,  461,
+      557,  557,  557,  557,  557,  557,  557,  461,  461,  461,
+      461,  461,  461,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  461,  461,  461,  461,  461,
+      461,  462,  462,  462,  462,  557,  557,  557,  557,  557,
+      557,  557,  462,  462,  462,  462,  462,  462,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      462,  462,  462,  462,  462,  462,  463,  463,  463,  463,
+      557,  557,  557,  557,  557,  557,  557,  463,  463,  463,
+      463,  463,  463,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  463,  463,  463,  463,  463,
+      463,  464,  464,  464,  464,  557,  557,  557,  557,  557,
+      557,  557,  464,  464,  464,  464,  464,  464,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+
+      464,  464,  464,  464,  464,  464,  490,  490,  490,  490,
+      557,  557,  557,  557,  557,  557,  557,  490,  490,  490,
+      490,  490,  490,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  490,  490,  490,  490,  490,
+      490,  491,  491,  491,  491,  557,  557,  557,  557,  557,
+      557,  557,  491,  491,  491,  491,  491,  491,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      491,  491,  491,  491,  491,  491,  492,  492,  492,  492,
+
+      557,  557,  557,  557,  557,  557,  557,  492,  492,  492,
+      492,  492,  492,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  492,  492,  492,  492,  492,
+      492,  493,  493,  493,  493,  557,  557,  557,  557,  557,
+      557,  557,  493,  493,  493,  493,  493,  493,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      493,  493,  493,  493,  493,  493,  249,  249,  249,  249,
+      557,  557,  557,  557,  557,  557,  557,  249,  249,  249,
+
+      249,  249,  249,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  249,  249,  249,  249,  249,
       249,   34,   34,   34,   34,   34,   34,   34,   34,   34,
        34,   34,   34,   34,   34,   34,   34,   34,   34,   34,
        34,   34,   34,   34,   34,   34,   34,   78,   78,   78,
@@ -907,263 +889,251 @@ static yyconst flex_int16_t yy_nxt[4503] =
       134,  134,  134,  139,  139,  139,  139,  139,  139,  139,
       139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
       139,  139,  139,  139,  139,  139,  139,  139,  139,  149,
-      149,  606,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  557,  149,  149,  149,  149,  149,  149,  149,  149,
       149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
-      149,  149,  149,  149,  149,  165,  165,  606,  165,  606,
+      149,  149,  149,  149,  149,  165,  165,  557,  165,  557,
 
-      165,  165,  165,  165,  171,  606,  606,  606,  171,  171,
-      171,  171,  171,  606,  606,  171,  606,  171,  185,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      185,  185,  185,  185,  186,  606,  606,  606,  186,  606,
-      606,  186,  606,  606,  606,  606,  606,  606,  606,  606,
-      186,  186,  186,  186,  186,  186,  606,  186,  606,  186,
-      195,  195,  606,  606,  195,  195,  195,  195,  606,  195,
+      165,  165,  165,  165,  171,  557,  557,  557,  171,  171,
+      171,  171,  171,  557,  557,  171,  557,  171,  185,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      185,  185,  185,  185,  186,  557,  557,  557,  186,  557,
+      557,  186,  557,  557,  557,  557,  557,  557,  557,  557,
+      186,  186,  186,  186,  186,  186,  557,  186,  557,  186,
+      195,  195,  557,  557,  195,  195,  195,  195,  557,  195,
       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
-      195,  606,  195,  195,  195,  195,  198,  198,  198,  198,
+      195,  557,  195,  195,  195,  195,  198,  198,  198,  198,
       198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
 
       198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
-      198,  198,  203,  203,  606,  606,  203,  203,  203,  203,
-      606,  203,  203,  203,  203,  203,  203,  203,  203,  203,
+      198,  198,  203,  203,  557,  557,  203,  203,  203,  203,
+      557,  203,  203,  203,  203,  203,  203,  203,  203,  203,
       203,  203,  203,  203,  203,  203,  203,  203,  205,  205,
-      606,  606,  205,  205,  205,  205,  205,  205,  205,  205,
-      205,  205,  606,  205,  205,  205,  205,  205,  205,  205,
-      205,  205,  205,  205,  208,  208,  606,  606,  208,  208,
-      208,  208,  208,  208,  208,  606,  208,  208,  208,  208,
+      557,  557,  205,  205,  205,  205,  205,  205,  205,  205,
+      205,  205,  557,  205,  205,  205,  205,  205,  205,  205,
+      205,  205,  205,  205,  208,  208,  557,  557,  208,  208,
+      208,  208,  208,  208,  208,  557,  208,  208,  208,  208,
       208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
-      213,  606,  213,  213,  606,  606,  606,  213,  213,  213,
+      213,  557,  213,  213,  557,  557,  557,  213,  213,  213,
 
-      213,  606,  606,  213,  219,  219,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  219,  219,  219,
-      219,  223,  223,  606,  606,  223,  606,  606,  223,  606,
-      223,  223,  223,  223,  223,  606,  223,  223,  223,  223,
-      223,  223,  606,  606,  223,  606,  223,  225,  225,  606,
+      213,  557,  557,  213,  219,  219,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  219,  219,  219,
+      219,  223,  223,  557,  557,  223,  557,  557,  223,  557,
+      223,  223,  223,  223,  223,  557,  223,  223,  223,  223,
+      223,  223,  557,  557,  223,  557,  223,  225,  225,  557,
       225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
-      225,  225,  225,  225,  225,  225,  225,  225,  606,  225,
+      225,  225,  225,  225,  225,  225,  225,  225,  557,  225,
       225,  225,  225,  227,  227,  227,  227,  227,  227,  227,
       227,  227,  227,  227,  227,  227,  227,  227,  227,  227,
       227,  227,  227,  227,  227,  227,  227,  227,  227,  230,
 
-      230,  606,  230,  230,  230,  230,  230,  230,  230,  230,
+      230,  557,  230,  230,  230,  230,  230,  230,  230,  230,
       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
-      606,  230,  230,  230,  230,  232,  606,  232,  232,  232,
-      232,  232,  232,  232,  232,  606,  232,  232,  232,  232,
-      232,  232,  606,  232,  232,  606,  232,  234,  234,  606,
-      606,  234,  234,  234,  234,  606,  234,  234,  234,  234,
+      557,  230,  230,  230,  230,  232,  557,  232,  232,  232,
+      232,  232,  232,  232,  232,  557,  232,  232,  232,  232,
+      232,  232,  557,  232,  232,  557,  232,  234,  234,  557,
+      557,  234,  234,  234,  234,  557,  234,  234,  234,  234,
       234,  234,  234,  234,  234,  234,  234,  234,  234,  234,
-      234,  234,  234,  234,  606,  606,  234,  606,  606,  606,
-      606,  606,  606,  606,  606,  234,  606,  606,  234,  234,
-      238,  238,  606,  606,  238,  606,  238,  238,  238,  238,
+      234,  234,  234,  234,  557,  557,  234,  557,  557,  557,
+      557,  557,  557,  557,  557,  234,  557,  557,  234,  234,
+      238,  238,  557,  557,  238,  557,  238,  238,  238,  238,
 
       238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
-      238,  238,  238,  238,  238,  238,  238,  606,  606,  238,
-      606,  606,  606,  606,  606,  606,  606,  606,  238,  606,
-      606,  238,  238,  242,  242,  606,  606,  242,  242,  242,
+      238,  238,  238,  238,  238,  238,  238,  557,  557,  238,
+      557,  557,  557,  557,  557,  557,  557,  557,  238,  557,
+      557,  238,  238,  242,  242,  557,  557,  242,  242,  242,
       242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
       242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      606,  606,  242,  606,  606,  606,  606,  606,  606,  606,
-      606,  242,  606,  606,  242,  242,  249,  249,  606,  606,
+      557,  557,  242,  557,  557,  557,  557,  557,  557,  557,
+      557,  242,  557,  557,  242,  242,  249,  249,  557,  557,
       249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
       249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 
-      249,  249,  249,  606,  606,  249,  606,  606,  606,  606,
-      606,  606,  606,  606,  249,  606,  606,  249,  249,  149,
-      149,  606,  149,  149,  149,  149,  149,  149,  149,  149,
+      249,  249,  249,  557,  557,  249,  557,  557,  557,  557,
+      557,  557,  557,  557,  249,  557,  557,  249,  249,  149,
+      149,  557,  149,  149,  149,  149,  149,  149,  149,  149,
       149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
-      149,  149,  149,  149,  149,  262,  262,  606,  606,  262,
+      149,  149,  149,  149,  149,  262,  262,  557,  557,  262,
       262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
       262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
-      262,  275,  606,  606,  606,  606,  275,  275,  275,  275,
-      606,  606,  275,  171,  606,  606,  606,  171,  171,  171,
-      171,  171,  606,  606,  171,  606,  171,  285,  285,  285,
-
-      285,  287,  606,  606,  606,  606,  606,  287,  287,  287,
-      287,  606,  606,  606,  287,  287,  287,  287,  606,  606,
-      287,  288,  288,  606,  606,  606,  288,  288,  288,  288,
-      288,  606,  288,  606,  288,  195,  195,  606,  606,  195,
-      195,  195,  195,  606,  195,  195,  195,  195,  195,  195,
-      195,  195,  195,  195,  195,  195,  606,  195,  195,  195,
-      195,  296,  296,  606,  606,  296,  296,  296,  296,  606,
+      262,  275,  557,  557,  557,  557,  275,  275,  275,  275,
+      557,  557,  275,  171,  557,  557,  557,  171,  171,  171,
+      171,  171,  557,  557,  171,  557,  171,  285,  285,  285,
+
+      285,  287,  557,  557,  557,  557,  557,  287,  287,  287,
+      287,  557,  557,  557,  287,  287,  287,  287,  557,  557,
+      287,  288,  288,  557,  557,  557,  288,  288,  288,  288,
+      288,  557,  288,  557,  288,  195,  195,  557,  557,  195,
+      195,  195,  195,  557,  195,  195,  195,  195,  195,  195,
+      195,  195,  195,  195,  195,  195,  557,  195,  195,  195,
+      195,  296,  296,  557,  557,  296,  296,  296,  296,  557,
       296,  296,  296,  296,  296,  296,  296,  296,  296,  296,
-      296,  296,  606,  296,  296,  296,  296,  297,  297,  606,
-      606,  297,  297,  297,  297,  606,  297,  297,  297,  297,
-
-      297,  297,  297,  297,  297,  297,  297,  297,  606,  297,
-      297,  297,  297,  298,  298,  606,  606,  298,  298,  298,
-      298,  606,  298,  298,  298,  298,  298,  298,  298,  298,
-      298,  298,  298,  298,  606,  298,  298,  298,  298,  299,
-      299,  299,  606,  299,  299,  299,  299,  606,  299,  299,
+      296,  296,  557,  296,  296,  296,  296,  297,  297,  557,
+      557,  297,  297,  297,  297,  557,  297,  297,  297,  297,
+
+      297,  297,  297,  297,  297,  297,  297,  297,  557,  297,
+      297,  297,  297,  298,  298,  557,  557,  298,  298,  298,
+      298,  557,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  557,  298,  298,  298,  298,  299,
+      299,  299,  557,  299,  299,  299,  299,  557,  299,  299,
       299,  299,  299,  299,  299,  299,  299,  299,  299,  299,
-      606,  299,  299,  299,  299,  203,  203,  606,  606,  203,
-      203,  203,  203,  606,  203,  203,  203,  203,  203,  203,
+      557,  299,  299,  299,  299,  203,  203,  557,  557,  203,
+      203,  203,  203,  557,  203,  203,  203,  203,  203,  203,
       203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
-      203,  300,  300,  606,  606,  300,  300,  300,  300,  606,
+      203,  300,  300,  557,  557,  300,  300,  300,  300,  557,
 
       300,  300,  300,  300,  300,  300,  300,  300,  300,  300,
-      300,  300,  300,  300,  300,  300,  300,  205,  205,  606,
-      606,  205,  205,  205,  205,  205,  205,  205,  205,  205,
-      205,  606,  205,  205,  205,  205,  205,  205,  205,  205,
-      205,  205,  205,  208,  208,  606,  606,  208,  208,  208,
-      208,  208,  208,  208,  606,  208,  208,  208,  208,  208,
+      300,  300,  300,  300,  300,  300,  300,  205,  205,  557,
+      557,  205,  205,  205,  205,  205,  205,  205,  205,  205,
+      205,  557,  205,  205,  205,  205,  205,  205,  205,  205,
+      205,  205,  205,  208,  208,  557,  557,  208,  208,  208,
+      208,  208,  208,  208,  557,  208,  208,  208,  208,  208,
       208,  208,  208,  208,  208,  208,  208,  208,  208,  213,
-      606,  213,  213,  606,  606,  606,  213,  213,  213,  213,
-      606,  606,  213,  303,  303,  303,  303,  606,  303,  303,
-      303,  303,  303,  606,  303,  303,  303,  303,  303,  303,
-
-      303,  303,  303,  606,  303,  306,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  306,  306,  306,
-      306,  307,  307,  307,  307,  308,  308,  308,  308,  606,
-      606,  606,  308,  308,  308,  308,  606,  308,  308,  223,
-      223,  606,  606,  223,  606,  606,  223,  606,  223,  223,
-      223,  223,  223,  606,  223,  223,  223,  223,  223,  223,
-      606,  606,  223,  606,  223,  225,  225,  606,  225,  225,
+      557,  213,  213,  557,  557,  557,  213,  213,  213,  213,
+      557,  557,  213,  303,  303,  303,  303,  557,  303,  303,
+      303,  303,  303,  557,  303,  303,  303,  303,  303,  303,
+
+      303,  303,  303,  557,  303,  306,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  306,  306,  306,
+      306,  307,  307,  307,  307,  308,  308,  308,  308,  557,
+      557,  557,  308,  308,  308,  308,  557,  308,  308,  223,
+      223,  557,  557,  223,  557,  557,  223,  557,  223,  223,
+      223,  223,  223,  557,  223,  223,  223,  223,  223,  223,
+      557,  557,  223,  557,  223,  225,  225,  557,  225,  225,
       225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
-      225,  225,  225,  225,  225,  225,  606,  225,  225,  225,
+      225,  225,  225,  225,  225,  225,  557,  225,  225,  225,
       225,  227,  227,  227,  227,  227,  227,  227,  227,  227,
 
       227,  227,  227,  227,  227,  227,  227,  227,  227,  227,
-      227,  227,  227,  227,  227,  227,  227,  230,  230,  606,
+      227,  227,  227,  227,  227,  227,  227,  230,  230,  557,
       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
-      230,  230,  230,  230,  230,  230,  230,  230,  606,  230,
-      230,  230,  230,  232,  606,  232,  232,  232,  232,  232,
-      232,  232,  232,  606,  232,  232,  232,  232,  232,  232,
-      606,  232,  232,  606,  232,  234,  234,  606,  606,  234,
-      234,  234,  234,  606,  234,  234,  234,  234,  234,  234,
+      230,  230,  230,  230,  230,  230,  230,  230,  557,  230,
+      230,  230,  230,  232,  557,  232,  232,  232,  232,  232,
+      232,  232,  232,  557,  232,  232,  232,  232,  232,  232,
+      557,  232,  232,  557,  232,  234,  234,  557,  557,  234,
+      234,  234,  234,  557,  234,  234,  234,  234,  234,  234,
       234,  234,  234,  234,  234,  234,  234,  234,  234,  234,
-      234,  234,  606,  606,  234,  606,  606,  606,  606,  606,
+      234,  234,  557,  557,  234,  557,  557,  557,  557,  557,
 
-      606,  606,  606,  234,  606,  606,  234,  234,  238,  238,
-      606,  606,  238,  606,  238,  238,  238,  238,  238,  238,
+      557,  557,  557,  234,  557,  557,  234,  234,  238,  238,
+      557,  557,  238,  557,  238,  238,  238,  238,  238,  238,
       238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
-      238,  238,  238,  238,  238,  606,  606,  238,  606,  606,
-      606,  606,  606,  606,  606,  606,  238,  606,  606,  238,
-      238,  242,  242,  606,  606,  242,  242,  242,  242,  242,
+      238,  238,  238,  238,  238,  557,  557,  238,  557,  557,
+      557,  557,  557,  557,  557,  557,  238,  557,  557,  238,
+      238,  242,  242,  557,  557,  242,  242,  242,  242,  242,
       242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  606,  606,
-      242,  606,  606,  606,  606,  606,  606,  606,  606,  242,
-      606,  606,  242,  242,  249,  249,  606,  606,  249,  249,
+      242,  242,  242,  242,  242,  242,  242,  242,  557,  557,
+      242,  557,  557,  557,  557,  557,  557,  557,  557,  242,
+      557,  557,  242,  242,  249,  249,  557,  557,  249,  249,
 
       249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
       249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
-      249,  606,  606,  249,  606,  606,  606,  606,  606,  606,
-      606,  606,  249,  606,  606,  249,  249,  262,  262,  606,
-      606,  262,  262,  262,  262,  262,  262,  262,  262,  262,
+      249,  557,  557,  249,  557,  557,  557,  557,  557,  557,
+      557,  557,  249,  557,  557,  249,  249,  262,  262,  557,
+      557,  262,  262,  262,  262,  262,  262,  262,  262,  262,
       262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
-      262,  262,  262,  275,  606,  606,  606,  606,  275,  275,
-      275,  275,  606,  606,  275,  171,  606,  606,  606,  171,
-      171,  171,  171,  171,  606,  606,  171,  606,  171,  341,
-      606,  606,  606,  606,  341,  341,  341,  341,  606,  606,
-
-      606,  341,  341,  341,  341,  606,  606,  341,  287,  606,
-      606,  606,  606,  606,  287,  287,  287,  287,  606,  606,
-      606,  287,  287,  287,  287,  606,  606,  287,  288,  288,
-      606,  606,  606,  288,  288,  288,  288,  288,  606,  288,
-      606,  288,  345,  345,  345,  345,  345,  345,  345,  345,
-      345,  345,  345,  345,  606,  345,  345,  345,  345,  606,
-      606,  606,  606,  345,  345,  606,  345,  345,  346,  346,
+      262,  262,  262,  275,  557,  557,  557,  557,  275,  275,
+      275,  275,  557,  557,  275,  171,  557,  557,  557,  171,
+      171,  171,  171,  171,  557,  557,  171,  557,  171,  341,
+      557,  557,  557,  557,  341,  341,  341,  341,  557,  557,
+
+      557,  341,  341,  341,  341,  557,  557,  341,  287,  557,
+      557,  557,  557,  557,  287,  287,  287,  287,  557,  557,
+      557,  287,  287,  287,  287,  557,  557,  287,  288,  288,
+      557,  557,  557,  288,  288,  288,  288,  288,  557,  288,
+      557,  288,  345,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  345,  345,  557,  345,  345,  345,  345,  557,
+      557,  557,  557,  345,  345,  557,  345,  345,  346,  346,
       346,  346,  346,  346,  346,  346,  346,  346,  346,  346,
-      606,  346,  346,  346,  346,  606,  606,  606,  606,  346,
-      346,  606,  346,  346,  296,  296,  606,  606,  296,  296,
+      557,  346,  346,  346,  346,  557,  557,  557,  557,  346,
+      346,  557,  346,  346,  296,  296,  557,  557,  296,  296,
 
-      296,  296,  606,  296,  296,  296,  296,  296,  296,  296,
-      296,  296,  296,  296,  296,  606,  296,  296,  296,  296,
-      297,  297,  606,  606,  297,  297,  297,  297,  606,  297,
+      296,  296,  557,  296,  296,  296,  296,  296,  296,  296,
+      296,  296,  296,  296,  296,  557,  296,  296,  296,  296,
+      297,  297,  557,  557,  297,  297,  297,  297,  557,  297,
       297,  297,  297,  297,  297,  297,  297,  297,  297,  297,
-      297,  606,  297,  297,  297,  297,  298,  298,  606,  606,
-      298,  298,  298,  298,  606,  298,  298,  298,  298,  298,
-      298,  298,  298,  298,  298,  298,  298,  606,  298,  298,
-      298,  298,  299,  299,  606,  606,  299,  299,  299,  299,
-      606,  299,  299,  299,  299,  299,  299,  299,  299,  299,
-      299,  299,  299,  606,  299,  299,  299,  299,  300,  300,
-
-      606,  606,  300,  300,  300,  300,  606,  300,  300,  300,
+      297,  557,  297,  297,  297,  297,  298,  298,  557,  557,
+      298,  298,  298,  298,  557,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  557,  298,  298,
+      298,  298,  299,  299,  557,  557,  299,  299,  299,  299,
+      557,  299,  299,  299,  299,  299,  299,  299,  299,  299,
+      299,  299,  299,  557,  299,  299,  299,  299,  300,  300,
+
+      557,  557,  300,  300,  300,  300,  557,  300,  300,  300,
       300,  300,  300,  300,  300,  300,  300,  300,  300,  300,
-      300,  300,  300,  300,  303,  303,  303,  303,  606,  303,
-      303,  303,  303,  303,  606,  303,  303,  303,  303,  303,
-      303,  303,  303,  303,  606,  303,  348,  348,  348,  348,
-      349,  349,  349,  349,  606,  606,  606,  349,  349,  349,
-      349,  606,  349,  349,  352,  606,  606,  606,  606,  352,
-      352,  352,  352,  606,  606,  606,  352,  352,  352,  352,
-      606,  606,  352,  308,  308,  308,  308,  606,  606,  606,
-      308,  308,  308,  308,  606,  308,  308,  242,  242,  606,
-
-      606,  242,  242,  242,  242,  606,  242,  242,  242,  242,
+      300,  300,  300,  300,  303,  303,  303,  303,  557,  303,
+      303,  303,  303,  303,  557,  303,  303,  303,  303,  303,
+      303,  303,  303,  303,  557,  303,  348,  348,  348,  348,
+      349,  349,  349,  349,  557,  557,  557,  349,  349,  349,
+      349,  557,  349,  349,  352,  557,  557,  557,  557,  352,
+      352,  352,  352,  557,  557,  557,  352,  352,  352,  352,
+      557,  557,  352,  308,  308,  308,  308,  557,  557,  557,
+      308,  308,  308,  308,  557,  308,  308,  242,  242,  557,
+
+      557,  242,  242,  242,  242,  557,  242,  242,  242,  242,
       242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  249,  249,  606,  606,  249,  606,  249,
+      242,  242,  242,  249,  249,  557,  557,  249,  557,  249,
       249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
       249,  249,  249,  249,  249,  249,  249,  249,  249,  262,
-      262,  606,  606,  262,  262,  262,  262,  262,  262,  262,
+      262,  557,  557,  262,  262,  262,  262,  262,  262,  262,
       262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
-      262,  262,  262,  262,  262,  171,  606,  606,  606,  171,
-      171,  171,  171,  171,  606,  606,  171,  606,  171,  341,
-      606,  606,  606,  606,  341,  341,  341,  341,  606,  606,
-
-      606,  341,  341,  341,  341,  606,  606,  341,  377,  606,
-      606,  606,  606,  377,  377,  377,  377,  606,  606,  606,
-      377,  377,  377,  377,  606,  606,  377,  397,  397,  397,
-      397,  397,  397,  397,  397,  397,  397,  397,  397,  606,
-      397,  397,  397,  397,  606,  606,  606,  606,  397,  397,
-      606,  397,  397,  412,  412,  606,  606,  412,  412,  412,
-      412,  412,  412,  412,  412,  412,  412,  412,  412,  412,
-      412,  412,  412,  412,  412,  412,  412,  412,  412,  234,
-      234,  606,  606,  234,  234,  234,  234,  606,  234,  234,
+      262,  262,  262,  262,  262,  171,  557,  557,  557,  171,
+      171,  171,  171,  171,  557,  557,  171,  557,  171,  341,
+      557,  557,  557,  557,  341,  341,  341,  341,  557,  557,
+
+      557,  341,  341,  341,  341,  557,  557,  341,  377,  557,
+      557,  557,  557,  377,  377,  377,  377,  557,  557,  557,
+      377,  377,  377,  377,  557,  557,  377,  397,  397,  397,
+      397,  397,  397,  397,  397,  397,  397,  397,  397,  557,
+      397,  397,  397,  397,  557,  557,  557,  557,  397,  397,
+      557,  397,  397,  411,  411,  557,  557,  411,  411,  411,
+      411,  411,  411,  411,  411,  411,  411,  411,  411,  411,
+      411,  411,  411,  411,  411,  411,  411,  411,  411,  234,
+      234,  557,  557,  234,  234,  234,  234,  557,  234,  234,
       234,  234,  234,  234,  234,  234,  234,  234,  234,  234,
 
-      234,  234,  234,  234,  234,  238,  238,  606,  606,  238,
-      606,  238,  238,  238,  238,  238,  238,  238,  238,  238,
+      234,  234,  234,  234,  234,  238,  238,  557,  557,  238,
+      557,  238,  238,  238,  238,  238,  238,  238,  238,  238,
       238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
-      238,  242,  242,  606,  606,  242,  242,  242,  242,  242,
+      238,  242,  242,  557,  557,  242,  242,  242,  242,  242,
       242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  430,  430,  430,
-      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
-      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
-      430,  430,  430,  441,  441,  441,  441,  441,  441,  441,
-      441,  441,  441,  441,  441,  606,  441,  441,  441,  441,
-
-      606,  606,  606,  606,  441,  441,  606,  441,  441,  473,
-      473,  473,  473,  473,  606,  473,  473,  473,  473,  473,
-      473,  473,  473,  473,  473,  473,  473,  473,  473,  473,
-      473,  473,  473,  473,  473,  478,  478,  478,  478,  478,
-      478,  478,  478,  478,  478,  478,  478,  478,  478,  478,
-      478,  478,  478,  478,  478,  478,  478,  478,  478,  478,
-      478,  484,  484,  484,  484,  484,  484,  484,  484,  484,
-      484,  484,  484,  484,  484,  484,  484,  484,  484,  484,
-      484,  484,  484,  484,  484,  484,  484,  516,  516,  516,
-      516,  516,  516,  516,  516,  516,  516,  516,  516,  516,
-
-      516,  516,  516,  516,  516,  516,  516,  516,  516,  516,
-      516,  516,  516,  549,  549,  549,  549,  549,  549,  549,
-      549,  549,  549,  549,  549,  549,  549,  549,  549,  549,
-      549,  549,  549,  549,  549,  549,  549,  549,  549,  553,
-      553,  553,  553,  553,  553,  553,  553,  553,  553,  553,
-      553,  553,  553,  553,  553,  553,  553,  553,  553,  553,
-      553,  553,  553,  553,  553,  557,  557,  557,  557,  557,
+      242,  242,  242,  242,  242,  242,  242,  428,  428,  428,
+      428,  428,  428,  428,  428,  428,  428,  428,  428,  428,
+      428,  428,  428,  428,  428,  428,  428,  428,  428,  428,
+      428,  428,  428,  439,  439,  439,  439,  439,  439,  439,
+      439,  439,  439,  439,  439,  557,  439,  439,  439,  439,
+
+      557,  557,  557,  557,  439,  439,  557,  439,  439,  465,
+      465,  465,  465,  465,  557,  465,  465,  465,  465,  465,
+      465,  465,  465,  465,  465,  465,  465,  465,  465,  465,
+      465,  465,  465,  465,  465,  466,  466,  466,  466,  466,
+      466,  466,  466,  466,  466,  466,  466,  466,  466,  466,
+      466,  466,  466,  466,  466,  466,  466,  466,  466,  466,
+      466,  515,  515,  515,  515,  515,  515,  515,  515,  515,
+      515,  515,  515,  515,  515,  515,  515,  515,  515,  515,
+      515,  515,  515,  515,  515,  515,  515,  531,  531,  531,
+      531,  531,  531,  531,  531,  531,  531,  531,  531,  531,
+
+      531,  531,  531,  531,  531,  531,  531,  531,  531,  531,
+      531,  531,  531,   33,  557,  557,  557,  557,  557,  557,
       557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
       557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
-      557,  578,  578,  578,  578,  578,  578,  578,  578,  578,
-
-      578,  578,  578,  578,  578,  578,  578,  578,  578,  578,
-      578,  578,  578,  578,  578,  578,  578,   33,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557
 
-      606,  606
     } ;
 
-static yyconst flex_int16_t yy_chk[4503] =
+static yyconst flex_int16_t yy_chk[4399] =
     {   0,
         0,    0,    1,    1,    2,    2,    5,    5,    6,    6,
-        9,   39,   10,    5,   39,    6,   11,   11,  576,    9,
+        9,   39,   10,    5,   39,    6,   11,   11,    0,    9,
         9,   10,   10,   11,   12,   12,   13,   13,   14,   14,
-      591,   12,  591,    1,  145,    2,   15,   15,   97,   16,
-       16,   19,   19,   97,   19,  574,   15,  564,   13,   16,
-       14,   15,  554,   19,   16,   56,   56,  550,    5,  548,
+      542,   12,  542,    1,  145,    2,   15,   15,   97,   16,
+       16,   19,   19,   97,   19,  522,   15,  500,   13,   16,
+       14,   15,  499,   19,   16,   56,   56,  491,    5,  490,
         6,    1,  145,    2,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
@@ -1174,17 +1144,17 @@ static yyconst flex_int16_t yy_chk[4503] =
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    7,   20,
-       20,  532,   20,   50,   50,   50,   50,    7,    7,    7,
-        7,   20,   21,   27,   27,   21,  531,   27,    7,    7,
-        7,    7,    7,    7,   22,  517,   37,   22,   21,   21,
-       21,   21,   25,   25,   82,   82,  512,   26,   26,   25,
-       22,   22,   22,   22,   26,  511,    7,    7,    7,    7,
+       20,  479,   20,   50,   50,   50,   50,    7,    7,    7,
+        7,   20,   21,   27,   27,   21,  476,   27,    7,    7,
+        7,    7,    7,    7,   22,  471,   37,   22,   21,   21,
+       21,   21,   25,   25,   82,   82,  470,   26,   26,   25,
+       22,   22,   22,   22,   26,  465,    7,    7,    7,    7,
 
         7,    7,    8,   37,   53,   68,   53,   53,   53,   53,
        60,    8,    8,    8,    8,   27,   62,   64,   69,   87,
        87,   53,    8,    8,    8,    8,    8,    8,   54,   54,
-       54,   54,   54,   68,   25,   54,  101,   60,  500,   26,
-      105,  105,  101,   62,   64,   69,  112,  112,  497,   53,
+       54,   54,   54,   68,   25,   54,  101,   60,  424,   26,
+      105,  105,  101,   62,   64,   69,  112,  112,  423,   53,
         8,    8,    8,    8,    8,    8,   17,   17,   17,   17,
        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
@@ -1196,18 +1166,18 @@ static yyconst flex_int16_t yy_chk[4503] =
        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
        23,   23,   28,   28,   23,   23,   28,   23,   23,   23,
-       29,   29,   30,   30,   31,   31,  492,   29,   31,   30,
+       29,   29,   30,   30,   31,   31,  413,   29,   31,   30,
        65,   23,   23,  128,   23,   32,   32,  134,   65,   32,
-       38,  139,  133,   44,  491,   38,   44,   42,   38,  473,
+       38,  139,  133,   44,  392,   38,   44,   42,   38,  389,
        44,  138,   42,   67,  143,   42,  147,   67,   65,  147,
-      128,   23,   23,   23,   28,  152,   65,  447,   38,  133,
+      128,   23,   23,   23,   28,  152,   65,  387,   38,  133,
 
       153,   44,   29,   44,   30,   42,   31,   44,  138,  213,
        67,  143,  134,  174,   67,  213,  160,   32,   23,  139,
        23,   24,   24,  152,   38,   24,   24,  153,   24,   24,
        24,   42,   52,   72,   52,   52,   52,   52,   72,  176,
       174,   72,   24,   24,  160,   24,  202,  202,  172,   52,
-      424,   38,   52,   38,  106,  106,  106,  106,   42,  177,
+      386,   38,   52,   38,  106,  106,  106,  106,   42,  177,
        42,   72,   74,   75,   74,   74,  176,   52,   75,  175,
        77,   75,   24,   24,   24,   77,  172,   52,   77,  214,
        52,  107,  107,  107,  107,  214,  177,   72,   74,  137,
@@ -1218,31 +1188,31 @@ static yyconst flex_int16_t yy_chk[4503] =
        74,  182,  235,   74,   77,  151,  151,  151,  151,  227,
       227,   74,  250,  146,  179,  180,  242,  151,  181,  322,
       243,  137,  322,  190,   75,  191,   75,  192,  249,  235,
-      154,   77,  154,   77,  142,  154,  239,  154,  414,  146,
+      154,   77,  154,   77,  142,  154,  239,  154,  377,  146,
       155,  155,  155,  155,  157,  151,  157,  157,  157,  157,
-      162,  162,  162,  162,  513,  155,  392,  154,  256,  154,
+      162,  162,  162,  162,  492,  155,  376,  154,  256,  154,
       250,  242,  154,  239,  154,  243,  146,  158,  146,  158,
-      158,  158,  158,  159,  389,  159,  387,  187,  159,  159,
+      158,  158,  158,  159,  371,  159,  364,  187,  159,  159,
 
-      159,  159,  187,  155,  158,  187,  256,  188,  386,  188,
-      188,  189,  244,  189,  189,  193,  194,  408,  408,  513,
+      159,  159,  187,  155,  158,  187,  256,  188,  352,  188,
+      188,  189,  244,  189,  189,  193,  194,  407,  407,  492,
       193,  194,  207,  193,  194,  187,  220,  220,  220,  220,
-      207,  377,  158,  188,  261,  189,  251,  188,  336,  244,
-      188,  336,  376,  193,  194,  221,  221,  221,  221,  188,
-      260,  187,  264,  371,  207,  207,  222,  222,  222,  222,
+      207,  351,  158,  188,  261,  189,  251,  188,  336,  244,
+      188,  336,  349,  193,  194,  221,  221,  221,  221,  188,
+      260,  187,  264,  348,  207,  207,  222,  222,  222,  222,
       247,  247,  261,  251,  278,  188,  265,  247,  188,  193,
       194,  254,  254,  266,  267,  254,  188,  260,  187,  264,
       187,  207,  207,  258,  258,  258,  258,  259,  259,  259,
       259,  263,  278,  265,  263,  273,  193,  194,  193,  194,
 
-      266,  267,  268,  277,  268,  283,  364,  268,  268,  268,
+      266,  267,  268,  277,  268,  283,  341,  268,  268,  268,
       268,  269,  247,  269,  269,  269,  269,  271,  271,  271,
-      271,  284,  273,  254,  270,  352,  270,  270,  270,  270,
+      271,  284,  273,  254,  270,  340,  270,  270,  270,  270,
       277,  293,  263,  283,  263,  272,  272,  272,  272,  263,
       324,  270,  289,  290,  302,  290,  290,  289,  284,  291,
       289,  291,  291,  292,  325,  292,  292,  328,  293,  263,
       329,  263,  310,  310,  310,  310,  263,  290,  324,  270,
-      289,  302,  351,  291,  323,  323,  323,  323,  330,  330,
+      289,  302,  327,  291,  323,  323,  323,  323,  330,  330,
       330,  330,  325,  292,  339,  328,  335,  337,  329,  331,
       331,  331,  331,  338,  343,  332,  289,  332,  332,  332,
 
@@ -1251,409 +1221,397 @@ static yyconst flex_int16_t yy_chk[4503] =
       338,  358,  343,  289,  358,  289,  359,  359,  359,  359,
       360,  361,  342,  362,  388,  363,  369,  344,  363,  370,
       359,  373,  347,  365,  365,  365,  365,  366,  366,  366,
-      366,  383,  390,  393,  394,  349,  396,  360,  403,  361,
-      342,  362,  388,  369,  407,  410,  370,  358,  373,  348,
-      404,  404,  404,  404,  430,  430,  409,  341,  383,  409,
-      390,  393,  394,  396,  404,  403,  340,  404,  404,  404,
-      404,  415,  407,  410,  358,  384,  384,  384,  384,  427,
-
-      406,  411,  405,  405,  405,  405,  406,  413,  455,  384,
-      428,  327,  384,  384,  384,  384,  405,  326,  415,  405,
-      405,  405,  405,  409,  429,  435,  427,  406,  319,  411,
-      431,  431,  436,  406,  316,  413,  455,  428,  384,  438,
-      384,  422,  422,  422,  422,  432,  422,  308,  432,  307,
-      409,  429,  435,  450,  450,  422,  437,  306,  437,  436,
-      440,  437,  437,  437,  437,  384,  438,  384,  391,  391,
-      434,  456,  391,  391,  391,  391,  391,  391,  391,  391,
-      391,  391,  391,  425,  425,  425,  425,  440,  432,  458,
-      391,  391,  391,  391,  391,  391,  391,  425,  303,  456,
-
-      425,  425,  425,  425,  474,  474,  434,  459,  426,  426,
-      426,  426,  460,  287,  434,  432,  458,  462,  463,  285,
-      464,  391,  426,  391,  281,  426,  426,  426,  426,  448,
-      448,  448,  448,  434,  448,  459,  478,  478,  475,  475,
-      460,  434,  475,  448,  466,  462,  463,  464,  391,  391,
-      391,  391,  399,  399,  399,  399,  451,  451,  451,  451,
-      494,  467,  257,  399,  399,  399,  399,  399,  399,  253,
-      451,  246,  466,  451,  451,  451,  451,  476,  476,  480,
-      480,  484,  484,  486,  486,  238,  495,  494,  399,  467,
-      476,  399,  399,  399,  399,  399,  399,  400,  400,  400,
-
-      400,  452,  452,  452,  452,  519,  519,  496,  400,  400,
-      400,  400,  400,  400,  495,  452,  528,  528,  452,  452,
-      452,  452,  465,  498,  498,  498,  498,  536,  465,  503,
-      536,  433,  502,  400,  433,  496,  400,  400,  400,  400,
-      400,  400,  401,  454,  454,  454,  454,  234,  504,  505,
-      465,  401,  401,  401,  401,  465,  503,  454,  468,  232,
-      502,  468,  401,  401,  401,  401,  401,  401,  552,  552,
-      433,  231,  506,  535,  433,  504,  505,  230,  433,  516,
-      516,  518,  518,  516,  507,  518,  468,  401,  229,  468,
-      401,  401,  401,  401,  401,  401,  402,  433,  439,  506,
-
-      535,  433,  439,  508,  509,  433,  537,  439,  402,  402,
-      402,  402,  507,  439,  489,  489,  489,  489,  439,  402,
-      402,  402,  402,  402,  402,  226,  439,  510,  489,  539,
-      439,  508,  509,  537,  439,  520,  520,  524,  524,  520,
-      439,  524,  556,  556,  402,  439,  534,  402,  402,  402,
-      402,  402,  402,  412,  412,  510,  539,  412,  412,  412,
-      412,  412,  412,  412,  412,  412,  412,  412,  453,  453,
-      453,  453,  557,  557,  534,  412,  412,  412,  412,  412,
-      412,  412,  453,  521,  521,  453,  453,  453,  453,  540,
-      525,  525,  461,  461,  461,  461,  521,  541,  542,  479,
-
-      479,  479,  479,  525,  479,  543,  412,  225,  412,  461,
-      461,  461,  461,  479,  544,  545,  540,  485,  485,  485,
-      485,  219,  485,  563,  541,  542,  563,  481,  481,  481,
-      481,  485,  543,  412,  412,  412,  412,  417,  417,  417,
-      417,  481,  544,  545,  481,  481,  481,  481,  417,  417,
-      417,  417,  417,  417,  493,  493,  493,  493,  515,  515,
-      515,  515,  549,  549,  558,  558,  549,  217,  493,  216,
-      551,  551,  515,  417,  551,  566,  417,  417,  417,  417,
-      417,  417,  418,  418,  418,  418,  482,  482,  482,  482,
-      559,  559,  561,  418,  418,  418,  418,  418,  418,  209,
-
-      482,  562,  566,  482,  482,  482,  482,  553,  553,  555,
-      555,  553,  208,  555,  483,  483,  483,  483,  418,  568,
-      561,  418,  418,  418,  418,  418,  418,  419,  483,  562,
-      200,  483,  483,  483,  483,  567,  419,  419,  419,  419,
-      487,  487,  487,  487,  580,  571,  568,  419,  419,  419,
-      419,  419,  419,  185,  487,  578,  578,  487,  487,  487,
-      487,  579,  579,  567,  581,  590,  596,  150,  590,  596,
-      583,  580,  419,  571,  592,  419,  419,  419,  419,  419,
-      419,  420,  420,  420,  420,  488,  488,  488,  488,  585,
-      593,  581,  420,  420,  420,  420,  420,  420,  583,  488,
-
-      149,  592,  488,  488,  488,  488,  597,  598,  599,  597,
-      598,  599,  141,  501,  501,  501,  501,  585,  593,  136,
-      420,  420,  420,  420,  420,  420,  442,  442,  442,  442,
-      501,  501,  501,  501,  131,  129,  126,  442,  442,  442,
-      442,  442,  442,  523,  523,  523,  523,  124,  117,  113,
-      529,  529,  529,  529,  600,  601,  602,  523,  601,  602,
-      523,  523,  523,  523,  529,  442,  442,  442,  442,  442,
-      442,  443,  443,  443,  443,  527,  527,  527,  527,  111,
-      110,  600,  443,  443,  443,  443,  443,  443,  603,  527,
-      103,  603,  527,  527,  527,  527,  604,  605,  627,  604,
-
-      605,   98,   96,  627,  627,   94,  533,  533,  533,  533,
-      443,  443,  443,  443,  443,  443,  444,  444,  444,  444,
-      533,  546,  546,  546,  546,   93,   92,  444,  444,  444,
-      444,  444,  444,   89,   81,  546,  547,  547,  547,  547,
-      560,  560,  560,  560,   80,   71,  648,   70,   66,   61,
-      547,  648,  648,   59,  560,  444,  444,  444,  444,  444,
-      444,  445,  445,  445,  445,  572,  572,  572,  572,   58,
-       57,   51,  445,  445,  445,  445,  445,  445,   49,  572,
-      573,  573,  573,  573,  575,  575,  575,  575,   43,  582,
-      659,   41,   36,   33,  573,  659,  659,    0,  575,  582,
-
-      445,  445,  445,  445,  445,  445,  469,  469,  469,  469,
-      587,  587,  587,  587,    0,    0,  582,  469,  469,  469,
-      469,  469,  469,    0,  587,    0,  582,  588,  588,  588,
-      588,  676,    0,  679,    0,    0,  676,  676,  679,  679,
-        0,  588,    0,    0,    0,  469,  469,  469,  469,  469,
-      469,  470,  470,  470,  470,  682,    0,    0,    0,    0,
-      682,  682,  470,  470,  470,  470,  470,  470,  685,    0,
-      687,    0,  705,  685,  685,  687,  687,  705,  705,  706,
-        0,  708,    0,  710,  706,  706,  708,  708,  710,  710,
-      470,  470,  470,  470,  470,  470,  471,  471,  471,  471,
-
-      712,    0,    0,    0,    0,  712,  712,  471,  471,  471,
-      471,  471,  471,  716,    0,  717,    0,  718,  716,  716,
-      717,  717,  718,  718,  719,    0,  721,    0,  722,  719,
-      719,  721,  721,  722,  722,  471,  471,  471,  471,  471,
-      471,  472,  472,  472,  472,  723,    0,    0,    0,    0,
-      723,  723,  472,  472,  472,  472,  472,  472,  724,    0,
-        0,    0,    0,  724,  724,    0,    0,    0,    0,    0,
+      366,  383,  390,  393,  394,  326,  396,  360,  403,  361,
+      342,  362,  388,  369,  406,  319,  370,  358,  373,  316,
+      404,  404,  404,  404,  408,  409,  410,  408,  383,  412,
+      390,  393,  394,  396,  404,  403,  308,  404,  404,  404,
+      404,  414,  406,  405,  358,  384,  384,  384,  384,  405,
+
+      307,  425,  426,  409,  410,  427,  433,  412,  434,  384,
+      428,  428,  384,  384,  384,  384,  429,  429,  414,  436,
+      405,  408,  421,  421,  421,  421,  405,  421,  425,  426,
+      438,  447,  427,  433,  306,  434,  421,  450,  384,  456,
+      384,  430,  445,  445,  430,  435,  436,  435,  408,  303,
+      435,  435,  435,  435,  287,  448,  285,  438,  431,  447,
+      504,  431,  432,  504,  450,  384,  456,  384,  391,  391,
+      466,  466,  391,  391,  391,  391,  391,  391,  391,  391,
+      391,  391,  391,  448,  430,  451,  446,  446,  446,  446,
+      391,  391,  391,  391,  391,  391,  391,  431,  432,  437,
+
+      446,  431,  452,  437,  281,  431,  432,  473,  437,  454,
+      455,  430,  458,  451,  437,  467,  467,  496,  496,  437,
+      257,  391,  253,  391,  431,  432,  246,  437,  431,  459,
+      452,  437,  431,  432,  473,  437,  521,  454,  455,  521,
+      458,  437,  453,  453,  453,  453,  437,  474,  391,  391,
+      391,  391,  399,  399,  399,  399,  475,  459,  481,  453,
+      453,  453,  453,  399,  399,  399,  399,  399,  399,  468,
+      468,  468,  468,  457,  460,  474,  482,  460,  238,  457,
+      483,  515,  515,  468,  475,  234,  481,  232,  399,  516,
+      516,  399,  399,  399,  399,  399,  399,  400,  400,  400,
+
+      400,  457,  460,  482,  231,  460,  457,  483,  400,  400,
+      400,  400,  400,  400,  472,  472,  472,  472,  477,  477,
+      477,  477,  230,  484,  517,  517,  229,  486,  472,  480,
+      480,  480,  480,  400,  485,  226,  400,  400,  400,  400,
+      400,  400,  401,  487,  488,  489,  480,  480,  480,  480,
+      484,  401,  401,  401,  401,  486,  494,  494,  494,  494,
+      225,  485,  401,  401,  401,  401,  401,  401,  531,  531,
+      494,  487,  488,  489,  497,  497,  497,  497,  502,  219,
+      503,  532,  532,  501,  501,  501,  501,  401,  497,  505,
+      401,  401,  401,  401,  401,  401,  402,  501,  507,  508,
+
+      509,  510,  511,  512,  513,  519,  502,  503,  402,  402,
+      402,  402,  520,  217,  524,  525,  505,  216,  526,  402,
+      402,  402,  402,  402,  402,  507,  508,  509,  510,  511,
+      209,  512,  513,  519,  541,  547,  548,  541,  547,  548,
+      520,  524,  208,  525,  402,  526,  529,  402,  402,  402,
+      402,  402,  402,  411,  411,  200,  185,  411,  411,  411,
+      411,  411,  411,  411,  411,  411,  411,  411,  514,  514,
+      514,  514,  533,  534,  529,  411,  411,  411,  411,  411,
+      411,  411,  514,  518,  518,  518,  518,  543,  535,  536,
+      538,  544,  549,  550,  551,  549,  550,  518,  535,  533,
+
+      534,  552,  553,  150,  552,  553,  411,  554,  411,  555,
+      554,  149,  555,  556,  543,  535,  556,  536,  538,  544,
+      141,  551,  578,  136,  599,  535,  610,  578,  578,  599,
+      599,  610,  610,  411,  411,  411,  411,  416,  416,  416,
+      416,  627,  131,  129,  126,  124,  627,  627,  416,  416,
+      416,  416,  416,  416,  630,  117,  633,  113,  636,  630,
+      630,  633,  633,  636,  636,  638,  111,  110,  103,  656,
+      638,  638,   98,  416,  656,  656,  416,  416,  416,  416,
+      416,  416,  417,  417,  417,  417,  657,   96,   94,   93,
+       92,  657,  657,  417,  417,  417,  417,  417,  417,  659,
+
+       89,  661,   81,  663,  659,  659,  661,  661,  663,  663,
+      667,   80,   71,   70,  668,  667,  667,   66,  417,  668,
+      668,  417,  417,  417,  417,  417,  417,  418,  669,   61,
+       59,   58,   57,  669,  669,  670,  418,  418,  418,  418,
+      670,  670,   51,   49,   43,   41,   36,  418,  418,  418,
+      418,  418,  418,  672,   33,  673,    0,  674,  672,  672,
+      673,  673,  674,  674,  675,    0,    0,    0,    0,  675,
+      675,    0,  418,    0,    0,  418,  418,  418,  418,  418,
+      418,  419,  419,  419,  419,    0,    0,    0,    0,    0,
+        0,    0,  419,  419,  419,  419,  419,  419,    0,    0,
+
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+      419,  419,  419,  419,  419,  419,  440,  440,  440,  440,
+        0,    0,    0,    0,    0,    0,    0,  440,  440,  440,
+      440,  440,  440,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  440,  440,  440,  440,  440,
+      440,  441,  441,  441,  441,    0,    0,    0,    0,    0,
+        0,    0,  441,  441,  441,  441,  441,  441,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-      472,  472,  472,  472,  472,  472,  514,  514,  514,  514,
-        0,    0,    0,    0,    0,    0,    0,  514,  514,  514,
 
-      514,  514,  514,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,  514,  514,  514,  514,  514,
-      514,  607,  607,  607,  607,  607,  607,  607,  607,  607,
-      607,  607,  607,  607,  607,  607,  607,  607,  607,  607,
-      607,  607,  607,  607,  607,  607,  607,  608,  608,  608,
-      608,  608,  608,  608,  608,  608,  608,  608,  608,  608,
-      608,  608,  608,  608,  608,  608,  608,  608,  608,  608,
-      608,  608,  608,  609,  609,  609,  609,  609,  609,  609,
-      609,  609,  609,  609,  609,  609,  609,  609,  609,  609,
+      441,  441,  441,  441,  441,  441,  442,  442,  442,  442,
+        0,    0,    0,    0,    0,    0,    0,  442,  442,  442,
+      442,  442,  442,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  442,  442,  442,  442,  442,
+      442,  443,  443,  443,  443,    0,    0,    0,    0,    0,
+        0,    0,  443,  443,  443,  443,  443,  443,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
-      609,  609,  609,  609,  609,  609,  609,  609,  609,  610,
-      610,  610,  610,  610,  610,  610,  610,  610,  610,  610,
-      610,  610,  610,  610,  610,  610,  610,  610,  610,  610,
-      610,  610,  610,  610,  610,  611,  611,  611,  611,  611,
-      611,  611,  611,  611,  611,  611,  611,  611,  611,  611,
+      443,  443,  443,  443,  443,  443,  461,  461,  461,  461,
+        0,    0,    0,    0,    0,    0,    0,  461,  461,  461,
+      461,  461,  461,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  461,  461,  461,  461,  461,
+      461,  462,  462,  462,  462,    0,    0,    0,    0,    0,
+        0,    0,  462,  462,  462,  462,  462,  462,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+      462,  462,  462,  462,  462,  462,  463,  463,  463,  463,
+
+        0,    0,    0,    0,    0,    0,    0,  463,  463,  463,
+      463,  463,  463,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  463,  463,  463,  463,  463,
+      463,  464,  464,  464,  464,    0,    0,    0,    0,    0,
+        0,    0,  464,  464,  464,  464,  464,  464,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+      464,  464,  464,  464,  464,  464,  493,  493,  493,  493,
+        0,    0,    0,    0,    0,    0,    0,  493,  493,  493,
+
+      493,  493,  493,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  493,  493,  493,  493,  493,
+      493,  558,  558,  558,  558,  558,  558,  558,  558,  558,
+      558,  558,  558,  558,  558,  558,  558,  558,  558,  558,
+      558,  558,  558,  558,  558,  558,  558,  559,  559,  559,
+      559,  559,  559,  559,  559,  559,  559,  559,  559,  559,
+      559,  559,  559,  559,  559,  559,  559,  559,  559,  559,
+      559,  559,  559,  560,  560,  560,  560,  560,  560,  560,
+      560,  560,  560,  560,  560,  560,  560,  560,  560,  560,
+
+      560,  560,  560,  560,  560,  560,  560,  560,  560,  561,
+      561,  561,  561,  561,  561,  561,  561,  561,  561,  561,
+      561,  561,  561,  561,  561,  561,  561,  561,  561,  561,
+      561,  561,  561,  561,  561,  562,  562,  562,  562,  562,
+      562,  562,  562,  562,  562,  562,  562,  562,  562,  562,
+      562,  562,  562,  562,  562,  562,  562,  562,  562,  562,
+      562,  563,  563,  563,  563,  563,  563,  563,  563,  563,
+      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
+      563,  563,  563,  563,  563,  563,  563,  564,  564,  564,
+      564,  564,  564,  564,  564,  564,  564,  564,  564,  564,
+
+      564,  564,  564,  564,  564,  564,  564,  564,  564,  564,
+      564,  564,  564,  565,  565,  565,  565,  565,  565,  565,
+      565,  565,  565,  565,  565,  565,  565,  565,  565,  565,
+      565,  565,  565,  565,  565,  565,  565,  565,  565,  566,
+      566,  566,  566,  566,  566,  566,  566,  566,  566,  566,
+      566,  566,  566,  566,  566,  566,  566,  566,  566,  566,
+      566,  566,  566,  566,  566,  567,  567,  567,  567,  567,
+      567,  567,  567,  567,  567,  567,  567,  567,  567,  567,
+      567,  567,  567,  567,  567,  567,  567,  567,  567,  567,
+      567,  568,  568,  568,  568,  568,  568,  568,  568,  568,
+
+      568,  568,  568,  568,  568,  568,  568,  568,  568,  568,
+      568,  568,  568,  568,  568,  568,  568,  569,  569,  569,
+      569,  569,  569,  569,  569,  569,  569,  569,  569,  569,
+      569,  569,  569,  569,  569,  569,  569,  569,  569,  569,
+      569,  569,  569,  570,  570,  570,  570,  570,  570,  570,
+      570,  570,  570,  570,  570,  570,  570,  570,  570,  570,
+      570,  570,  570,  570,  570,  570,  570,  570,  570,  571,
+      571,    0,  571,  571,  571,  571,  571,  571,  571,  571,
+      571,  571,  571,  571,  571,  571,  571,  571,  571,  571,
+      571,  571,  571,  571,  571,  572,  572,    0,  572,    0,
+
+      572,  572,  572,  572,  573,    0,    0,    0,  573,  573,
+      573,  573,  573,    0,    0,  573,    0,  573,  574,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+      574,  574,  574,  574,  575,    0,    0,    0,  575,    0,
+        0,  575,    0,    0,    0,    0,    0,    0,    0,    0,
+      575,  575,  575,  575,  575,  575,    0,  575,    0,  575,
+      576,  576,    0,    0,  576,  576,  576,  576,    0,  576,
+      576,  576,  576,  576,  576,  576,  576,  576,  576,  576,
+      576,    0,  576,  576,  576,  576,  577,  577,  577,  577,
+      577,  577,  577,  577,  577,  577,  577,  577,  577,  577,
+
+      577,  577,  577,  577,  577,  577,  577,  577,  577,  577,
+      577,  577,  579,  579,    0,    0,  579,  579,  579,  579,
+        0,  579,  579,  579,  579,  579,  579,  579,  579,  579,
+      579,  579,  579,  579,  579,  579,  579,  579,  580,  580,
+        0,    0,  580,  580,  580,  580,  580,  580,  580,  580,
+      580,  580,    0,  580,  580,  580,  580,  580,  580,  580,
+      580,  580,  580,  580,  581,  581,    0,    0,  581,  581,
+      581,  581,  581,  581,  581,    0,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      582,    0,  582,  582,    0,    0,    0,  582,  582,  582,
+
+      582,    0,    0,  582,  583,  583,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,  583,  583,  583,
+      583,  584,  584,    0,    0,  584,    0,    0,  584,    0,
+      584,  584,  584,  584,  584,    0,  584,  584,  584,  584,
+      584,  584,    0,    0,  584,    0,  584,  585,  585,    0,
+      585,  585,  585,  585,  585,  585,  585,  585,  585,  585,
+      585,  585,  585,  585,  585,  585,  585,  585,    0,  585,
+      585,  585,  585,  586,  586,  586,  586,  586,  586,  586,
+      586,  586,  586,  586,  586,  586,  586,  586,  586,  586,
+      586,  586,  586,  586,  586,  586,  586,  586,  586,  587,
+
+      587,    0,  587,  587,  587,  587,  587,  587,  587,  587,
+      587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
+        0,  587,  587,  587,  587,  588,    0,  588,  588,  588,
+      588,  588,  588,  588,  588,    0,  588,  588,  588,  588,
+      588,  588,    0,  588,  588,    0,  588,  589,  589,    0,
+        0,  589,  589,  589,  589,    0,  589,  589,  589,  589,
+      589,  589,  589,  589,  589,  589,  589,  589,  589,  589,
+      589,  589,  589,  590,    0,    0,  590,    0,    0,    0,
+        0,    0,    0,    0,    0,  590,    0,    0,  590,  590,
+      591,  591,    0,    0,  591,    0,  591,  591,  591,  591,
+
+      591,  591,  591,  591,  591,  591,  591,  591,  591,  591,
+      591,  591,  591,  591,  591,  591,  592,    0,    0,  592,
+        0,    0,    0,    0,    0,    0,    0,    0,  592,    0,
+        0,  592,  592,  593,  593,    0,    0,  593,  593,  593,
+      593,  593,  593,  593,  593,  593,  593,  593,  593,  593,
+      593,  593,  593,  593,  593,  593,  593,  593,  593,  594,
+        0,    0,  594,    0,    0,    0,    0,    0,    0,    0,
+        0,  594,    0,    0,  594,  594,  595,  595,    0,    0,
+      595,  595,  595,  595,  595,  595,  595,  595,  595,  595,
+      595,  595,  595,  595,  595,  595,  595,  595,  595,  595,
+
+      595,  595,  596,    0,    0,  596,    0,    0,    0,    0,
+        0,    0,    0,    0,  596,    0,    0,  596,  596,  597,
+      597,    0,  597,  597,  597,  597,  597,  597,  597,  597,
+      597,  597,  597,  597,  597,  597,  597,  597,  597,  597,
+      597,  597,  597,  597,  597,  598,  598,    0,    0,  598,
+      598,  598,  598,  598,  598,  598,  598,  598,  598,  598,
+      598,  598,  598,  598,  598,  598,  598,  598,  598,  598,
+      598,  600,    0,    0,    0,    0,  600,  600,  600,  600,
+        0,    0,  600,  601,    0,    0,    0,  601,  601,  601,
+      601,  601,    0,    0,  601,    0,  601,  602,  602,  602,
+
+      602,  603,    0,    0,    0,    0,    0,  603,  603,  603,
+      603,    0,    0,    0,  603,  603,  603,  603,    0,    0,
+      603,  604,  604,    0,    0,    0,  604,  604,  604,  604,
+      604,    0,  604,    0,  604,  605,  605,    0,    0,  605,
+      605,  605,  605,    0,  605,  605,  605,  605,  605,  605,
+      605,  605,  605,  605,  605,  605,    0,  605,  605,  605,
+      605,  606,  606,    0,    0,  606,  606,  606,  606,    0,
+      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
+      606,  606,    0,  606,  606,  606,  606,  607,  607,    0,
+        0,  607,  607,  607,  607,    0,  607,  607,  607,  607,
+
+      607,  607,  607,  607,  607,  607,  607,  607,    0,  607,
+      607,  607,  607,  608,  608,    0,    0,  608,  608,  608,
+      608,    0,  608,  608,  608,  608,  608,  608,  608,  608,
+      608,  608,  608,  608,    0,  608,  608,  608,  608,  609,
+      609,  609,    0,  609,  609,  609,  609,    0,  609,  609,
+      609,  609,  609,  609,  609,  609,  609,  609,  609,  609,
+        0,  609,  609,  609,  609,  611,  611,    0,    0,  611,
+      611,  611,  611,    0,  611,  611,  611,  611,  611,  611,
       611,  611,  611,  611,  611,  611,  611,  611,  611,  611,
-      611,  612,  612,  612,  612,  612,  612,  612,  612,  612,
-      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
-      612,  612,  612,  612,  612,  612,  612,  613,  613,  613,
-      613,  613,  613,  613,  613,  613,  613,  613,  613,  613,
+      611,  612,  612,    0,    0,  612,  612,  612,  612,    0,
 
-      613,  613,  613,  613,  613,  613,  613,  613,  613,  613,
-      613,  613,  613,  614,  614,  614,  614,  614,  614,  614,
-      614,  614,  614,  614,  614,  614,  614,  614,  614,  614,
+      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
+      612,  612,  612,  612,  612,  612,  612,  613,  613,    0,
+        0,  613,  613,  613,  613,  613,  613,  613,  613,  613,
+      613,    0,  613,  613,  613,  613,  613,  613,  613,  613,
+      613,  613,  613,  614,  614,    0,    0,  614,  614,  614,
+      614,  614,  614,  614,    0,  614,  614,  614,  614,  614,
       614,  614,  614,  614,  614,  614,  614,  614,  614,  615,
-      615,  615,  615,  615,  615,  615,  615,  615,  615,  615,
-      615,  615,  615,  615,  615,  615,  615,  615,  615,  615,
-      615,  615,  615,  615,  615,  616,  616,  616,  616,  616,
-      616,  616,  616,  616,  616,  616,  616,  616,  616,  616,
-      616,  616,  616,  616,  616,  616,  616,  616,  616,  616,
-      616,  617,  617,  617,  617,  617,  617,  617,  617,  617,
-
-      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
-      617,  617,  617,  617,  617,  617,  617,  618,  618,  618,
-      618,  618,  618,  618,  618,  618,  618,  618,  618,  618,
-      618,  618,  618,  618,  618,  618,  618,  618,  618,  618,
-      618,  618,  618,  619,  619,  619,  619,  619,  619,  619,
-      619,  619,  619,  619,  619,  619,  619,  619,  619,  619,
-      619,  619,  619,  619,  619,  619,  619,  619,  619,  620,
-      620,    0,  620,  620,  620,  620,  620,  620,  620,  620,
-      620,  620,  620,  620,  620,  620,  620,  620,  620,  620,
-      620,  620,  620,  620,  620,  621,  621,    0,  621,    0,
-
-      621,  621,  621,  621,  622,    0,    0,    0,  622,  622,
-      622,  622,  622,    0,    0,  622,    0,  622,  623,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-      623,  623,  623,  623,  624,    0,    0,    0,  624,    0,
-        0,  624,    0,    0,    0,    0,    0,    0,    0,    0,
-      624,  624,  624,  624,  624,  624,    0,  624,    0,  624,
-      625,  625,    0,    0,  625,  625,  625,  625,    0,  625,
+        0,  615,  615,    0,    0,    0,  615,  615,  615,  615,
+        0,    0,  615,  616,  616,  616,  616,    0,  616,  616,
+      616,  616,  616,    0,  616,  616,  616,  616,  616,  616,
+
+      616,  616,  616,    0,  616,  617,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,  617,  617,  617,
+      617,  618,  618,  618,  618,  619,  619,  619,  619,    0,
+        0,    0,  619,  619,  619,  619,    0,  619,  619,  620,
+      620,    0,    0,  620,    0,    0,  620,    0,  620,  620,
+      620,  620,  620,    0,  620,  620,  620,  620,  620,  620,
+        0,    0,  620,    0,  620,  621,  621,    0,  621,  621,
+      621,  621,  621,  621,  621,  621,  621,  621,  621,  621,
+      621,  621,  621,  621,  621,  621,    0,  621,  621,  621,
+      621,  622,  622,  622,  622,  622,  622,  622,  622,  622,
+
+      622,  622,  622,  622,  622,  622,  622,  622,  622,  622,
+      622,  622,  622,  622,  622,  622,  622,  623,  623,    0,
+      623,  623,  623,  623,  623,  623,  623,  623,  623,  623,
+      623,  623,  623,  623,  623,  623,  623,  623,    0,  623,
+      623,  623,  623,  624,    0,  624,  624,  624,  624,  624,
+      624,  624,  624,    0,  624,  624,  624,  624,  624,  624,
+        0,  624,  624,    0,  624,  625,  625,    0,    0,  625,
+      625,  625,  625,    0,  625,  625,  625,  625,  625,  625,
       625,  625,  625,  625,  625,  625,  625,  625,  625,  625,
-      625,    0,  625,  625,  625,  625,  626,  626,  626,  626,
-      626,  626,  626,  626,  626,  626,  626,  626,  626,  626,
-
-      626,  626,  626,  626,  626,  626,  626,  626,  626,  626,
-      626,  626,  628,  628,    0,    0,  628,  628,  628,  628,
-        0,  628,  628,  628,  628,  628,  628,  628,  628,  628,
-      628,  628,  628,  628,  628,  628,  628,  628,  629,  629,
-        0,    0,  629,  629,  629,  629,  629,  629,  629,  629,
-      629,  629,    0,  629,  629,  629,  629,  629,  629,  629,
-      629,  629,  629,  629,  630,  630,    0,    0,  630,  630,
-      630,  630,  630,  630,  630,    0,  630,  630,  630,  630,
-      630,  630,  630,  630,  630,  630,  630,  630,  630,  630,
-      631,    0,  631,  631,    0,    0,    0,  631,  631,  631,
-
-      631,    0,    0,  631,  632,  632,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,  632,  632,  632,
-      632,  633,  633,    0,    0,  633,    0,    0,  633,    0,
-      633,  633,  633,  633,  633,    0,  633,  633,  633,  633,
-      633,  633,    0,    0,  633,    0,  633,  634,  634,    0,
+      625,  626,    0,    0,  626,    0,    0,    0,    0,    0,
+
+        0,    0,    0,  626,    0,    0,  626,  626,  628,  628,
+        0,    0,  628,    0,  628,  628,  628,  628,  628,  628,
+      628,  628,  628,  628,  628,  628,  628,  628,  628,  628,
+      628,  628,  628,  628,  629,    0,    0,  629,    0,    0,
+        0,    0,    0,    0,    0,    0,  629,    0,    0,  629,
+      629,  631,  631,    0,    0,  631,  631,  631,  631,  631,
+      631,  631,  631,  631,  631,  631,  631,  631,  631,  631,
+      631,  631,  631,  631,  631,  631,  631,  632,    0,    0,
+      632,    0,    0,    0,    0,    0,    0,    0,    0,  632,
+        0,    0,  632,  632,  634,  634,    0,    0,  634,  634,
+
       634,  634,  634,  634,  634,  634,  634,  634,  634,  634,
-      634,  634,  634,  634,  634,  634,  634,  634,    0,  634,
-      634,  634,  634,  635,  635,  635,  635,  635,  635,  635,
-      635,  635,  635,  635,  635,  635,  635,  635,  635,  635,
-      635,  635,  635,  635,  635,  635,  635,  635,  635,  636,
-
-      636,    0,  636,  636,  636,  636,  636,  636,  636,  636,
-      636,  636,  636,  636,  636,  636,  636,  636,  636,  636,
-        0,  636,  636,  636,  636,  637,    0,  637,  637,  637,
-      637,  637,  637,  637,  637,    0,  637,  637,  637,  637,
-      637,  637,    0,  637,  637,    0,  637,  638,  638,    0,
-        0,  638,  638,  638,  638,    0,  638,  638,  638,  638,
-      638,  638,  638,  638,  638,  638,  638,  638,  638,  638,
-      638,  638,  638,  639,    0,    0,  639,    0,    0,    0,
-        0,    0,    0,    0,    0,  639,    0,    0,  639,  639,
-      640,  640,    0,    0,  640,    0,  640,  640,  640,  640,
-
-      640,  640,  640,  640,  640,  640,  640,  640,  640,  640,
-      640,  640,  640,  640,  640,  640,  641,    0,    0,  641,
-        0,    0,    0,    0,    0,    0,    0,    0,  641,    0,
-        0,  641,  641,  642,  642,    0,    0,  642,  642,  642,
-      642,  642,  642,  642,  642,  642,  642,  642,  642,  642,
-      642,  642,  642,  642,  642,  642,  642,  642,  642,  643,
-        0,    0,  643,    0,    0,    0,    0,    0,    0,    0,
-        0,  643,    0,    0,  643,  643,  644,  644,    0,    0,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  645,    0,    0,  645,    0,    0,    0,    0,
-        0,    0,    0,    0,  645,    0,    0,  645,  645,  646,
-      646,    0,  646,  646,  646,  646,  646,  646,  646,  646,
-      646,  646,  646,  646,  646,  646,  646,  646,  646,  646,
-      646,  646,  646,  646,  646,  647,  647,    0,    0,  647,
-      647,  647,  647,  647,  647,  647,  647,  647,  647,  647,
+      634,  634,  634,  634,  634,  634,  634,  634,  634,  634,
+      635,    0,    0,  635,    0,    0,    0,    0,    0,    0,
+        0,    0,  635,    0,    0,  635,  635,  637,  637,    0,
+        0,  637,  637,  637,  637,  637,  637,  637,  637,  637,
+      637,  637,  637,  637,  637,  637,  637,  637,  637,  637,
+      637,  637,  637,  639,    0,    0,    0,    0,  639,  639,
+      639,  639,    0,    0,  639,  640,    0,    0,    0,  640,
+      640,  640,  640,  640,    0,    0,  640,    0,  640,  641,
+        0,    0,    0,    0,  641,  641,  641,  641,    0,    0,
+
+        0,  641,  641,  641,  641,    0,    0,  641,  642,    0,
+        0,    0,    0,    0,  642,  642,  642,  642,    0,    0,
+        0,  642,  642,  642,  642,    0,    0,  642,  643,  643,
+        0,    0,    0,  643,  643,  643,  643,  643,    0,  643,
+        0,  643,  644,  644,  644,  644,  644,  644,  644,  644,
+      644,  644,  644,  644,    0,  644,  644,  644,  644,    0,
+        0,    0,    0,  644,  644,    0,  644,  644,  645,  645,
+      645,  645,  645,  645,  645,  645,  645,  645,  645,  645,
+        0,  645,  645,  645,  645,    0,    0,    0,    0,  645,
+      645,    0,  645,  645,  646,  646,    0,    0,  646,  646,
+
+      646,  646,    0,  646,  646,  646,  646,  646,  646,  646,
+      646,  646,  646,  646,  646,    0,  646,  646,  646,  646,
+      647,  647,    0,    0,  647,  647,  647,  647,    0,  647,
       647,  647,  647,  647,  647,  647,  647,  647,  647,  647,
-      647,  649,    0,    0,    0,    0,  649,  649,  649,  649,
-        0,    0,  649,  650,    0,    0,    0,  650,  650,  650,
-      650,  650,    0,    0,  650,    0,  650,  651,  651,  651,
-
-      651,  652,    0,    0,    0,    0,    0,  652,  652,  652,
-      652,    0,    0,    0,  652,  652,  652,  652,    0,    0,
-      652,  653,  653,    0,    0,    0,  653,  653,  653,  653,
-      653,    0,  653,    0,  653,  654,  654,    0,    0,  654,
-      654,  654,  654,    0,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  654,  654,  654,    0,  654,  654,  654,
-      654,  655,  655,    0,    0,  655,  655,  655,  655,    0,
-      655,  655,  655,  655,  655,  655,  655,  655,  655,  655,
-      655,  655,    0,  655,  655,  655,  655,  656,  656,    0,
-        0,  656,  656,  656,  656,    0,  656,  656,  656,  656,
-
-      656,  656,  656,  656,  656,  656,  656,  656,    0,  656,
-      656,  656,  656,  657,  657,    0,    0,  657,  657,  657,
-      657,    0,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,    0,  657,  657,  657,  657,  658,
-      658,  658,    0,  658,  658,  658,  658,    0,  658,  658,
+      647,    0,  647,  647,  647,  647,  648,  648,    0,    0,
+      648,  648,  648,  648,    0,  648,  648,  648,  648,  648,
+      648,  648,  648,  648,  648,  648,  648,    0,  648,  648,
+      648,  648,  649,  649,    0,    0,  649,  649,  649,  649,
+        0,  649,  649,  649,  649,  649,  649,  649,  649,  649,
+      649,  649,  649,    0,  649,  649,  649,  649,  650,  650,
+
+        0,    0,  650,  650,  650,  650,    0,  650,  650,  650,
+      650,  650,  650,  650,  650,  650,  650,  650,  650,  650,
+      650,  650,  650,  650,  651,  651,  651,  651,    0,  651,
+      651,  651,  651,  651,    0,  651,  651,  651,  651,  651,
+      651,  651,  651,  651,    0,  651,  652,  652,  652,  652,
+      653,  653,  653,  653,    0,    0,    0,  653,  653,  653,
+      653,    0,  653,  653,  654,    0,    0,    0,    0,  654,
+      654,  654,  654,    0,    0,    0,  654,  654,  654,  654,
+        0,    0,  654,  655,  655,  655,  655,    0,    0,    0,
+      655,  655,  655,  655,    0,  655,  655,  658,  658,    0,
+
+        0,  658,  658,  658,  658,    0,  658,  658,  658,  658,
       658,  658,  658,  658,  658,  658,  658,  658,  658,  658,
-        0,  658,  658,  658,  658,  660,  660,    0,    0,  660,
-      660,  660,  660,    0,  660,  660,  660,  660,  660,  660,
+      658,  658,  658,  660,  660,    0,    0,  660,    0,  660,
       660,  660,  660,  660,  660,  660,  660,  660,  660,  660,
-      660,  661,  661,    0,    0,  661,  661,  661,  661,    0,
-
-      661,  661,  661,  661,  661,  661,  661,  661,  661,  661,
-      661,  661,  661,  661,  661,  661,  661,  662,  662,    0,
-        0,  662,  662,  662,  662,  662,  662,  662,  662,  662,
-      662,    0,  662,  662,  662,  662,  662,  662,  662,  662,
-      662,  662,  662,  663,  663,    0,    0,  663,  663,  663,
-      663,  663,  663,  663,    0,  663,  663,  663,  663,  663,
-      663,  663,  663,  663,  663,  663,  663,  663,  663,  664,
-        0,  664,  664,    0,    0,    0,  664,  664,  664,  664,
-        0,    0,  664,  665,  665,  665,  665,    0,  665,  665,
-      665,  665,  665,    0,  665,  665,  665,  665,  665,  665,
-
-      665,  665,  665,    0,  665,  666,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,  666,  666,  666,
-      666,  667,  667,  667,  667,  668,  668,  668,  668,    0,
-        0,    0,  668,  668,  668,  668,    0,  668,  668,  669,
-      669,    0,    0,  669,    0,    0,  669,    0,  669,  669,
-      669,  669,  669,    0,  669,  669,  669,  669,  669,  669,
-        0,    0,  669,    0,  669,  670,  670,    0,  670,  670,
-      670,  670,  670,  670,  670,  670,  670,  670,  670,  670,
-      670,  670,  670,  670,  670,  670,    0,  670,  670,  670,
-      670,  671,  671,  671,  671,  671,  671,  671,  671,  671,
-
-      671,  671,  671,  671,  671,  671,  671,  671,  671,  671,
-      671,  671,  671,  671,  671,  671,  671,  672,  672,    0,
-      672,  672,  672,  672,  672,  672,  672,  672,  672,  672,
-      672,  672,  672,  672,  672,  672,  672,  672,    0,  672,
-      672,  672,  672,  673,    0,  673,  673,  673,  673,  673,
-      673,  673,  673,    0,  673,  673,  673,  673,  673,  673,
-        0,  673,  673,    0,  673,  674,  674,    0,    0,  674,
-      674,  674,  674,    0,  674,  674,  674,  674,  674,  674,
-      674,  674,  674,  674,  674,  674,  674,  674,  674,  674,
-      674,  675,    0,    0,  675,    0,    0,    0,    0,    0,
-
-        0,    0,    0,  675,    0,    0,  675,  675,  677,  677,
-        0,    0,  677,    0,  677,  677,  677,  677,  677,  677,
+      660,  660,  660,  660,  660,  660,  660,  660,  660,  662,
+      662,    0,    0,  662,  662,  662,  662,  662,  662,  662,
+      662,  662,  662,  662,  662,  662,  662,  662,  662,  662,
+      662,  662,  662,  662,  662,  664,    0,    0,    0,  664,
+      664,  664,  664,  664,    0,    0,  664,    0,  664,  665,
+        0,    0,    0,    0,  665,  665,  665,  665,    0,    0,
+
+        0,  665,  665,  665,  665,    0,    0,  665,  666,    0,
+        0,    0,    0,  666,  666,  666,  666,    0,    0,    0,
+      666,  666,  666,  666,    0,    0,  666,  671,  671,  671,
+      671,  671,  671,  671,  671,  671,  671,  671,  671,    0,
+      671,  671,  671,  671,    0,    0,    0,    0,  671,  671,
+        0,  671,  671,  676,  676,    0,    0,  676,  676,  676,
+      676,  676,  676,  676,  676,  676,  676,  676,  676,  676,
+      676,  676,  676,  676,  676,  676,  676,  676,  676,  677,
+      677,    0,    0,  677,  677,  677,  677,    0,  677,  677,
       677,  677,  677,  677,  677,  677,  677,  677,  677,  677,
-      677,  677,  677,  677,  678,    0,    0,  678,    0,    0,
-        0,    0,    0,    0,    0,    0,  678,    0,    0,  678,
-      678,  680,  680,    0,    0,  680,  680,  680,  680,  680,
+
+      677,  677,  677,  677,  677,  678,  678,    0,    0,  678,
+        0,  678,  678,  678,  678,  678,  678,  678,  678,  678,
+      678,  678,  678,  678,  678,  678,  678,  678,  678,  678,
+      678,  679,  679,    0,    0,  679,  679,  679,  679,  679,
+      679,  679,  679,  679,  679,  679,  679,  679,  679,  679,
+      679,  679,  679,  679,  679,  679,  679,  680,  680,  680,
+      680,  680,  680,  680,  680,  680,  680,  680,  680,  680,
       680,  680,  680,  680,  680,  680,  680,  680,  680,  680,
-      680,  680,  680,  680,  680,  680,  680,  681,    0,    0,
-      681,    0,    0,    0,    0,    0,    0,    0,    0,  681,
-        0,    0,  681,  681,  683,  683,    0,    0,  683,  683,
+      680,  680,  680,  681,  681,  681,  681,  681,  681,  681,
+      681,  681,  681,  681,  681,    0,  681,  681,  681,  681,
 
+        0,    0,    0,    0,  681,  681,    0,  681,  681,  682,
+      682,  682,  682,  682,    0,  682,  682,  682,  682,  682,
+      682,  682,  682,  682,  682,  682,  682,  682,  682,  682,
+      682,  682,  682,  682,  682,  683,  683,  683,  683,  683,
       683,  683,  683,  683,  683,  683,  683,  683,  683,  683,
       683,  683,  683,  683,  683,  683,  683,  683,  683,  683,
-      684,    0,    0,  684,    0,    0,    0,    0,    0,    0,
-        0,    0,  684,    0,    0,  684,  684,  686,  686,    0,
-        0,  686,  686,  686,  686,  686,  686,  686,  686,  686,
-      686,  686,  686,  686,  686,  686,  686,  686,  686,  686,
-      686,  686,  686,  688,    0,    0,    0,    0,  688,  688,
-      688,  688,    0,    0,  688,  689,    0,    0,    0,  689,
-      689,  689,  689,  689,    0,    0,  689,    0,  689,  690,
-        0,    0,    0,    0,  690,  690,  690,  690,    0,    0,
-
-        0,  690,  690,  690,  690,    0,    0,  690,  691,    0,
-        0,    0,    0,    0,  691,  691,  691,  691,    0,    0,
-        0,  691,  691,  691,  691,    0,    0,  691,  692,  692,
-        0,    0,    0,  692,  692,  692,  692,  692,    0,  692,
-        0,  692,  693,  693,  693,  693,  693,  693,  693,  693,
-      693,  693,  693,  693,    0,  693,  693,  693,  693,    0,
-        0,    0,    0,  693,  693,    0,  693,  693,  694,  694,
-      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
-        0,  694,  694,  694,  694,    0,    0,    0,    0,  694,
-      694,    0,  694,  694,  695,  695,    0,    0,  695,  695,
-
-      695,  695,    0,  695,  695,  695,  695,  695,  695,  695,
-      695,  695,  695,  695,  695,    0,  695,  695,  695,  695,
-      696,  696,    0,    0,  696,  696,  696,  696,    0,  696,
-      696,  696,  696,  696,  696,  696,  696,  696,  696,  696,
-      696,    0,  696,  696,  696,  696,  697,  697,    0,    0,
-      697,  697,  697,  697,    0,  697,  697,  697,  697,  697,
-      697,  697,  697,  697,  697,  697,  697,    0,  697,  697,
-      697,  697,  698,  698,    0,    0,  698,  698,  698,  698,
-        0,  698,  698,  698,  698,  698,  698,  698,  698,  698,
-      698,  698,  698,    0,  698,  698,  698,  698,  699,  699,
-
-        0,    0,  699,  699,  699,  699,    0,  699,  699,  699,
-      699,  699,  699,  699,  699,  699,  699,  699,  699,  699,
-      699,  699,  699,  699,  700,  700,  700,  700,    0,  700,
-      700,  700,  700,  700,    0,  700,  700,  700,  700,  700,
-      700,  700,  700,  700,    0,  700,  701,  701,  701,  701,
-      702,  702,  702,  702,    0,    0,    0,  702,  702,  702,
-      702,    0,  702,  702,  703,    0,    0,    0,    0,  703,
-      703,  703,  703,    0,    0,    0,  703,  703,  703,  703,
-        0,    0,  703,  704,  704,  704,  704,    0,    0,    0,
-      704,  704,  704,  704,    0,  704,  704,  707,  707,    0,
-
-        0,  707,  707,  707,  707,    0,  707,  707,  707,  707,
-      707,  707,  707,  707,  707,  707,  707,  707,  707,  707,
-      707,  707,  707,  709,  709,    0,    0,  709,    0,  709,
-      709,  709,  709,  709,  709,  709,  709,  709,  709,  709,
-      709,  709,  709,  709,  709,  709,  709,  709,  709,  711,
-      711,    0,    0,  711,  711,  711,  711,  711,  711,  711,
-      711,  711,  711,  711,  711,  711,  711,  711,  711,  711,
-      711,  711,  711,  711,  711,  713,    0,    0,    0,  713,
-      713,  713,  713,  713,    0,    0,  713,    0,  713,  714,
-        0,    0,    0,    0,  714,  714,  714,  714,    0,    0,
-
-        0,  714,  714,  714,  714,    0,    0,  714,  715,    0,
-        0,    0,    0,  715,  715,  715,  715,    0,    0,    0,
-      715,  715,  715,  715,    0,    0,  715,  720,  720,  720,
-      720,  720,  720,  720,  720,  720,  720,  720,  720,    0,
-      720,  720,  720,  720,    0,    0,    0,    0,  720,  720,
-        0,  720,  720,  725,  725,    0,    0,  725,  725,  725,
-      725,  725,  725,  725,  725,  725,  725,  725,  725,  725,
-      725,  725,  725,  725,  725,  725,  725,  725,  725,  726,
-      726,    0,    0,  726,  726,  726,  726,    0,  726,  726,
-      726,  726,  726,  726,  726,  726,  726,  726,  726,  726,
-
-      726,  726,  726,  726,  726,  727,  727,    0,    0,  727,
-        0,  727,  727,  727,  727,  727,  727,  727,  727,  727,
-      727,  727,  727,  727,  727,  727,  727,  727,  727,  727,
-      727,  728,  728,    0,    0,  728,  728,  728,  728,  728,
-      728,  728,  728,  728,  728,  728,  728,  728,  728,  728,
-      728,  728,  728,  728,  728,  728,  728,  729,  729,  729,
-      729,  729,  729,  729,  729,  729,  729,  729,  729,  729,
-      729,  729,  729,  729,  729,  729,  729,  729,  729,  729,
-      729,  729,  729,  730,  730,  730,  730,  730,  730,  730,
-      730,  730,  730,  730,  730,    0,  730,  730,  730,  730,
-
-        0,    0,    0,    0,  730,  730,    0,  730,  730,  731,
-      731,  731,  731,  731,    0,  731,  731,  731,  731,  731,
-      731,  731,  731,  731,  731,  731,  731,  731,  731,  731,
-      731,  731,  731,  731,  731,  732,  732,  732,  732,  732,
-      732,  732,  732,  732,  732,  732,  732,  732,  732,  732,
-      732,  732,  732,  732,  732,  732,  732,  732,  732,  732,
-      732,  733,  733,  733,  733,  733,  733,  733,  733,  733,
-      733,  733,  733,  733,  733,  733,  733,  733,  733,  733,
-      733,  733,  733,  733,  733,  733,  733,  734,  734,  734,
-      734,  734,  734,  734,  734,  734,  734,  734,  734,  734,
-
-      734,  734,  734,  734,  734,  734,  734,  734,  734,  734,
-      734,  734,  734,  735,  735,  735,  735,  735,  735,  735,
-      735,  735,  735,  735,  735,  735,  735,  735,  735,  735,
-      735,  735,  735,  735,  735,  735,  735,  735,  735,  736,
-      736,  736,  736,  736,  736,  736,  736,  736,  736,  736,
-      736,  736,  736,  736,  736,  736,  736,  736,  736,  736,
-      736,  736,  736,  736,  736,  737,  737,  737,  737,  737,
-      737,  737,  737,  737,  737,  737,  737,  737,  737,  737,
-      737,  737,  737,  737,  737,  737,  737,  737,  737,  737,
-      737,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-
-      738,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-      738,  738,  738,  738,  738,  738,  738,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
+      683,  684,  684,  684,  684,  684,  684,  684,  684,  684,
+      684,  684,  684,  684,  684,  684,  684,  684,  684,  684,
+      684,  684,  684,  684,  684,  684,  684,  685,  685,  685,
+      685,  685,  685,  685,  685,  685,  685,  685,  685,  685,
+
+      685,  685,  685,  685,  685,  685,  685,  685,  685,  685,
+      685,  685,  685,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557
 
-      606,  606
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -1676,7 +1634,7 @@ char *yytext;
 /*
  *  scn3.l
  *
- *  $Id: scn3.l,v 1.21.2.6 2010/02/01 12:53:44 source Exp $
+ *  $Id: scn3.l,v 1.21.2.7 2010/10/27 12:51:33 source Exp $
  *
  *  SQL Scanner
  *
@@ -2063,7 +2021,7 @@ void yyfatalerror (const char *s);
 
 /* Internals of triple-double-quoted SPARQL string lit */
 
-#line 2067 "scn3.c"
+#line 2025 "scn3.c"
 
 #define INITIAL 0
 #define SQL 1
@@ -2167,7 +2125,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -2263,7 +2221,7 @@ YY_DECL
 #line 419 "./scn3.l"
 
 
-#line 2267 "scn3.c"
+#line 2225 "scn3.c"
 
 	if ( !(yy_init) )
 		{
@@ -2322,13 +2280,13 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 607 )
+				if ( yy_current_state >= 558 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_current_state != 606 );
+		while ( yy_current_state != 557 );
 		yy_cp = (yy_last_accepting_cpos);
 		yy_current_state = (yy_last_accepting_state);
 
@@ -3559,7 +3517,7 @@ YY_RULE_SETUP
 #line 1033 "./scn3.l"
 ECHO;
 	YY_BREAK
-#line 3563 "scn3.c"
+#line 3521 "scn3.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(STRLIT):
 case YY_STATE_EOF(HEXLIT):
@@ -3859,7 +3817,7 @@ static int yy_get_next_buffer (void)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 607 )
+			if ( yy_current_state >= 558 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -3887,11 +3845,11 @@ static int yy_get_next_buffer (void)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 607 )
+		if ( yy_current_state >= 558 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 606);
+	yy_is_jam = (yy_current_state == 557);
 
 	return yy_is_jam ? 0 : yy_current_state;
 }
diff --git a/libsrc/Wi/scn3.l b/libsrc/Wi/scn3.l
index 70854ac..641993d 100644
--- a/libsrc/Wi/scn3.l
+++ b/libsrc/Wi/scn3.l
@@ -1,7 +1,7 @@
 /*
  *  scn3.l
  *
- *  $Id: scn3.l,v 1.21.2.6 2010/02/01 12:53:44 source Exp $
+ *  $Id: scn3.l,v 1.21.2.7 2010/10/27 12:51:33 source Exp $
  *
  *  SQL Scanner
  *
@@ -824,7 +824,7 @@ EXEC[ \t]+SQL		{ sqlp_bin_op_serial = 0; BEGIN SQL;  }
 <SQL>[ \t]+	{ save_str(" "); RETURN_WS (WS_WHITESPACE); }
 
 	/* Pragmas */
-<SQL>"#"("pragma"[\ t]+)?"line"[ \t]+[0-9-]+([ \t]+[""][^""]+[""])?[ \t]*("--".*)?{S_NL} { scn3_pragma_line (yytext); scn3_lineno_increment = 1; scn3_plineno++; RETURN_WS(WS_PRAGMA_LINE); }
+<SQL>"#"("pragma"[\ t]+)?"line"[ \t]+[0-9]+([ \t]+[""][^""]+[""])?[ \t]*("--".*)?{S_NL} { scn3_pragma_line (yytext); scn3_lineno_increment = 1; scn3_plineno++; RETURN_WS(WS_PRAGMA_LINE); }
 <SQL>"#"("pragma"[\ t]+)?"line"[ \t]+"push"[ \t]*("--".*)?{S_NL} { scn3_pragma_line_push (); scn3_lineno_increment = 1; scn3_plineno++; RETURN_WS(WS_PRAGMA_LINE); }
 <SQL>"#"("pragma"[\ t]+)?"line"[ \t]+"pop"[ \t]*("--".*)?{S_NL} { scn3_pragma_line_pop (); scn3_lineno_increment = 1; scn3_plineno++; RETURN_WS(WS_PRAGMA_LINE); }
 <SQL>"#"("pragma"[\ t]+)?"line"([ \t]+"reset")?[ \t]*("--".*)?{S_NL} { scn3_pragma_line_reset (); scn3_lineno_increment = 1; scn3_plineno++; RETURN_WS(WS_PRAGMA_LINE); }
diff --git a/libsrc/Wi/scn3split.c b/libsrc/Wi/scn3split.c
index d05643a..fbdd667 100644
--- a/libsrc/Wi/scn3split.c
+++ b/libsrc/Wi/scn3split.c
@@ -389,7 +389,7 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[607] =
+static yyconst flex_int16_t yy_accept[558] =
     {   0,
         0,    0,    0,    0,    0,    0,  112,  112,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
@@ -435,29 +435,23 @@ static yyconst flex_int16_t yy_accept[607] =
         0,    0,    0,    0,   89,   89,    0,    0,  104,  104,
       104,  104,   43,   43,   74,    0,    4,   53,  145,  146,
 
-      133,  134,    0,    0,    0,    0,    0,    0,   96,  104,
-      104,  104,  104,   43,   43,    0,  145,  146,  133,  134,
-        1,    0,   86,   86,    0,    0,    0,    0,    0,    0,
-       89,    0,    0,    0,  104,  104,  104,  104,   43,   43,
-        5,  145,  146,  133,  134,    0,    0,    0,   86,   86,
-        0,    0,    0,    0,    0,    0,   89,    0,  104,  104,
-      104,  104,   43,   43,   43,   43,   43,   43,  145,  146,
-      133,  134,    0,    0,    0,    0,   86,    0,    0,   86,
-        0,    0,    0,    0,    0,   86,    0,    0,    0,   88,
-       88,    0,    0,    0,    0,  104,  104,  104,  103,  103,
-
-      104,  104,   43,   43,   43,   43,   43,   43,   43,   43,
-      145,  146,  133,  134,    0,    0,   89,   89,    0,    0,
-        0,   86,    0,    0,    0,   86,    0,    0,    0,   87,
-       87,    0,    0,    0,  104,  102,  104,   20,   43,   43,
-       43,   43,   43,   43,   43,    0,    0,   89,    0,   86,
-       86,    0,    0,   86,   86,    0,    0,   88,    0,    0,
-        0,  104,  102,  104,   19,   43,   43,   43,   22,   15,
-       43,    0,    0,   86,    0,   86,   88,    0,   87,    0,
-      104,  104,   43,   21,   43,   16,    0,    0,   87,    0,
-      104,  104,  104,   18,   17,   91,   98,   99,  101,  104,
-
-       98,   99,  101,  100,  100,    0
+      133,  134,    0,    0,    0,    0,    0,   96,  104,  104,
+      104,  104,   43,   43,    0,  145,  146,  133,  134,    1,
+        0,   86,   86,    0,    0,    0,    0,    0,   89,    0,
+        0,    0,  104,  104,  104,  104,   43,   43,    5,  145,
+      146,  133,  134,    0,    0,    0,    0,    0,   89,    0,
+      104,  104,  104,  104,   43,   43,   43,   43,   43,   43,
+      145,  146,  133,  134,    0,    0,   86,    0,   88,   88,
+        0,    0,    0,    0,  104,  104,  104,  103,  103,  104,
+      104,   43,   43,   43,   43,   43,   43,   43,   43,  145,
+      146,  133,  134,    0,   86,    0,    0,   87,   87,    0,
+
+        0,    0,  104,  102,  104,   20,   43,   43,   43,   43,
+       43,   43,   43,    0,    0,   88,    0,    0,    0,  104,
+      102,  104,   19,   43,   43,   43,   22,   15,   43,   88,
+        0,   87,    0,  104,  104,   43,   21,   43,   16,   87,
+        0,  104,  104,  104,   18,   17,   91,   98,   99,  101,
+      104,   98,   99,  101,  100,  100,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -505,184 +499,172 @@ static yyconst flex_int32_t yy_meta[85] =
        25,    1,   25,   26
     } ;
 
-static yyconst flex_int16_t yy_base[739] =
+static yyconst flex_int16_t yy_base[686] =
     {   0,
         0,    2,   64,    0,    4,    6,  139,  193,    1,    3,
        14,   22,   24,   26,   34,   37,  256,    0,   40,  148,
       160,  172,  338,  419,  180,  185,  161,  340,  348,  350,
-      352,  363, 1694, 4418, 4418, 1690,  125,  370,   10, 4418,
-     1689,  377, 1682,  336, 4418, 4418, 4418, 4418, 1663,  135,
-     1659,  416,  188,  210, 4418,   30, 1644, 1644, 1627,  160,
-     1640,  173,    0,  166,  331, 1639,  338,  168,  176, 1638,
-     1639,  433, 4418,  461,  463, 4418,  470,    0, 4418, 1642,
-     1625,  182, 4418, 4418,    0, 4418,  201,    0, 1624,    0,
-     4418, 1624, 1598, 1593, 4418, 1600,   26, 1589, 4418, 4418,
-
-      220, 4418, 1566, 4418,  235,  436,  463,    0, 4418, 1578,
-     1573,  244, 1540, 4418, 4418, 4418, 1522, 4418, 4418, 4418,
-     4418, 4418, 4418, 1493, 4418, 1534, 4418,  314, 1481, 4418,
-     1532, 4418,  323,  358, 4418, 1517,  487,  332,  365, 4418,
-     1510,  500,  335, 4418,    1,  505,  385, 4418, 1494, 1461,
-      507,  358,  354,  508,  542, 4418,  548,  571,  580,  383,
-        0,  552, 4418, 4418,    0, 4418, 4418, 4418, 4418, 4418,
-        0,  413, 4418,  364,  436,  388,  417, 4418,  467,  467,
-      470,  464, 4418,    0, 1448,    0,  597,  606,  610,  486,
-      476,  481,  615,  616,    0, 4418,    0,    0,    0, 1428,
-
-        0,  428,    0,    0,    0, 4418,  605, 1400, 1387, 4418,
-     4418, 4418,  393,  463, 4418, 1343, 1361,    0, 1266,  608,
-      627,  638,    0, 4418, 1301, 1219,  527, 4418, 1186, 1168,
-     1162, 1133, 4418, 1093,  473, 4418,    0, 1031,  507, 4418,
-        0,  527,  531,  563, 4418, 1069,  658,    0,  494,  526,
-      587, 4418, 1067,  669,    0,  547, 1056,  665,  669,  608,
+      352,  363, 1455, 4314, 4314, 1444,  125,  370,   10, 4314,
+     1443,  377, 1438,  336, 4314, 4314, 4314, 4314, 1428,  135,
+     1430,  416,  188,  210, 4314,   30, 1406, 1406, 1404,  160,
+     1420,  173,    0,  166,  331, 1408,  338,  168,  176, 1404,
+     1406,  433, 4314,  461,  463, 4314,  470,    0, 4314, 1409,
+     1393,  182, 4314, 4314,    0, 4314,  201,    0, 1391,    0,
+     4314, 1388, 1362, 1376, 4314, 1385,   26, 1360, 4314, 4314,
+
+      220, 4314, 1344, 4314,  235,  436,  463,    0, 4314, 1365,
+     1360,  244, 1348, 4314, 4314, 4314, 1329, 4314, 4314, 4314,
+     4314, 4314, 4314, 1291, 4314, 1342, 4314,  314, 1289, 4314,
+     1340, 4314,  323,  358, 4314, 1321,  487,  332,  365, 4314,
+     1318,  500,  335, 4314,    1,  505,  385, 4314, 1305, 1297,
+      507,  358,  354,  508,  542, 4314,  548,  571,  580,  383,
+        0,  552, 4314, 4314,    0, 4314, 4314, 4314, 4314, 4314,
+        0,  413, 4314,  364,  436,  388,  417, 4314,  467,  467,
+      470,  464, 4314,    0, 1251,    0,  597,  606,  610,  486,
+      476,  481,  615,  616,    0, 4314,    0,    0,    0, 1253,
+
+        0,  428,    0,    0,    0, 4314,  605, 1230, 1218, 4314,
+     4314, 4314,  393,  463, 4314, 1191, 1207,    0, 1124,  608,
+      627,  638,    0, 4314, 1154, 1129,  527, 4314, 1124, 1113,
+     1095, 1061, 4314, 1031,  473, 4314,    0, 1024,  507, 4314,
+        0,  527,  531,  563, 4314, 1024,  658,    0,  494,  526,
+      587, 4314, 1020,  669,    0,  547, 1014,  665,  669,  608,
       605,    0,  690,  609,  626,  627,  626,  689,  695,  708,
       699,  717,  644,    0,    0,    0,  661,  633,    0,    0,
-      968,    0,  672,  680, 1013, 4418, 1008,    0,  742,  742,
+      948,    0,  672,  680,  950, 4314,  949,    0,  742,  742,
       748,  752,  691,    0,    0,    0,    0,    0,    0,    0,
 
-     4418,  697,  972, 4418,    0,  902,  943,  892, 4418,  744,
-     4418, 4418, 4418,    0,    0,  880, 4418,    0,  874, 4418,
-        0,  538,  756,  707,  719,  861,  855,  726,  726,  760,
-      771,  779,  788,    0,  738,  637,  739,  746,  751,  881,
-      871,  801,  765,  770, 4418, 4418,  771,  863,  800, 4418,
-      717,  719,  798,    0,    0,    0,    0,  820,  825,  789,
-      800,  801,  834,  685,  825,  829,    0,    0,  789,  791,
-      644, 4418,  801,    0, 4418,  587,  625, 4418,    0,    0,
-        0,    0,  806,  894, 4418,  606,  581,  805,  538,  819,
-      968,  520,  816,  825, 4418,  816, 4418, 4418, 1034, 1079,
-
-     1133, 1190,  818,  869,  901,  857,  831,  615,  875,  832,
-      871, 1253,  874,  502,  850,    0, 1319, 1364, 1418, 1463,
-     4418,  940, 4418,  448,  982, 1007,  855,  863,  877,  872,
-      928,  944, 1130,  966,  878,  883,  943,  888, 1166,  916,
-     4418, 1508, 1553, 1598, 1643,    0,  382, 1028, 4418,  951,
-     1055, 1100, 1267, 1142,  872,  938, 4418,  943,  976,  977,
-     1291,  984,  989,  977, 1085, 1011, 1028, 1129, 1688, 1733,
-     1778, 1823,  373, 1002, 1036, 1075, 4418, 1034, 1298, 1077,
-     1326, 1385, 1413, 1079, 1316, 1081, 1439, 1484, 1213, 4418,
-      372,  341, 1353, 1012, 1053, 1078,  235, 1122, 4418,  236,
-
-     1512, 1101, 1077, 1099, 1107, 1130, 1153, 1174, 1172, 1190,
-      141,  132,  565, 1868, 1357, 1177,  169, 1179, 1103, 1233,
-     1281, 4418, 1542, 1235, 1288, 4418, 1574, 1114, 1549, 4418,
-      164,  136, 1605, 1212, 1129, 1126, 1159,    0, 1183, 1240,
-     1249, 1255, 1259, 1282, 1281, 1620, 1635,   53, 1360,   51,
-     1368, 1166, 1405,   46, 1407, 1240, 1270, 1362, 1388, 1639,
-     1355, 1368, 1322,   22,    0, 1327, 1399, 1377,    0,    0,
-     1411, 1664, 1679,   39, 1683,   12, 4418, 1453, 1459, 1393,
-     1417, 1647, 1437,    0, 1457,    0, 1709, 1726, 4418, 1464,
-       17, 1431, 1457,    0,    0, 1465, 1505, 1506, 1507, 1507,
-
-     1554, 1555, 1587, 1595, 1596, 4418, 1931, 1957, 1983, 2009,
-     2035, 2061, 2087, 2113, 2139, 2165, 2191, 2217, 2243, 2269,
-     2283, 2292, 2313, 2334, 2360, 2386, 1586, 2412, 2438, 2464,
-     2480, 2500, 2521, 2547, 2573, 2599, 2621, 2647, 2668, 2690,
-     2711, 2733, 2754, 2776, 2797, 2819, 2845, 1634, 2859, 2871,
-     2880, 2897, 2909, 2935, 2961, 2987, 3013, 3039, 1678, 3065,
-     3091, 3117, 3143, 3159, 3179, 3200, 3204, 3215, 3239, 3265,
-     3291, 3317, 3339, 3365, 3386, 1719, 3408, 3429, 1721, 3451,
-     3472, 1743, 3494, 3515, 1756, 3537, 1758, 3551, 3563, 3584,
-     3604, 3616, 3642, 3668, 3694, 3720, 3746, 3772, 3798, 3820,
-
-     3829, 3840, 3859, 3873, 1760, 1767, 3897, 1769, 3923, 1771,
-     3949, 1788, 3963, 3984, 4003, 1801, 1803, 1805, 1812, 4027,
-     1814, 1816, 1833, 1846, 4053, 4079, 4105, 4131, 4157, 4183,
-     4209, 4235, 4261, 4287, 4313, 4339, 4365, 4391
+     4314,  697,  923, 4314,    0,  879,  894,  831, 4314,  744,
+     4314, 4314, 4314,    0,    0,  815, 4314,    0,  811, 4314,
+        0,  538,  756,  707,  719,  799,  716,  726,  726,  760,
+      771,  779,  788,    0,  738,  637,  739,  746,  751,  720,
+      700,  801,  765,  770, 4314, 4314,  771,  647,  587, 4314,
+      576,  602,  798,    0,    0,    0,    0,  820,  825,  789,
+      800,  801,  834,  575,  825,  829,    0,    0,  789,  791,
+      585, 4314,  801,    0, 4314,  521,  552, 4314,    0,    0,
+        0,    0,  806,  894, 4314,  448,  382,  805,  323,  819,
+      968,  318,  816,  825, 4314,  816, 4314, 4314, 1034, 1079,
+
+     1133, 1190,  818,  869,  850,  831,  615,  873,  842,  846,
+     1253,  846,  300,  850,    0, 1319, 1364, 1418, 1463, 4314,
+      921, 4314,  246,  223,  857,  855,  858,  908,  914,  940,
+      957,  958,  859,  859,  932,  868,  967,  886, 4314, 1508,
+     1553, 1598, 1643,    0,  940,  985,  895,  922, 4314,  891,
+      954,  967, 1041,  976,  981,  896, 1036,  979,  996, 1045,
+     1688, 1733, 1778, 1823,  189,  968, 1013, 1068, 4314,  184,
+      160, 1113,  959, 1014, 1027,  153, 1117, 4314,  149, 1128,
+     1027, 1024, 1031, 1081, 1092, 1096, 1114, 1112, 1108,    5,
+        3,  565, 1868, 1155, 4314, 1015, 1173, 4314,   50,   32,
+
+     1182, 1144, 1136,  959, 1142,    0, 1152, 1150, 1152, 1158,
+     1156, 1171, 1170, 1267, 1079, 1087, 1122, 1282, 1168, 1179,
+     1035,   20,    0, 1166, 1179, 1176,    0,    0, 1212, 4314,
+     1166, 1179, 1221, 1226, 1246, 1256,    0, 1258,    0, 4314,
+     1233,   17, 1244, 1258,    0,    0, 1234, 1235, 1291, 1292,
+     1247, 1300, 1301, 1306, 1308, 1312, 4314, 1931, 1957, 1983,
+     2009, 2035, 2061, 2087, 2113, 2139, 2165, 2191, 2217, 2243,
+     2269, 2283, 2292, 2313, 2334, 2360, 2386, 1310, 2412, 2438,
+     2464, 2480, 2500, 2521, 2547, 2573, 2599, 2621, 2647, 2668,
+     2690, 2711, 2733, 2754, 2776, 2797, 2819, 2845, 1312, 2859,
+
+     2871, 2880, 2897, 2909, 2935, 2961, 2987, 3013, 3039, 1314,
+     3065, 3091, 3117, 3143, 3159, 3179, 3200, 3204, 3215, 3239,
+     3265, 3291, 3317, 3339, 3365, 3386, 1329, 3408, 3429, 1342,
+     3451, 3472, 1344, 3494, 3515, 1346, 3537, 1353, 3551, 3563,
+     3584, 3604, 3616, 3642, 3668, 3694, 3720, 3746, 3772, 3798,
+     3820, 3829, 3840, 3859, 3873, 1357, 1374, 3897, 1387, 3923,
+     1389, 3949, 1391, 3963, 3984, 4003, 1398, 1402, 1416, 1423,
+     4027, 1441, 1443, 1445, 1452, 4053, 4079, 4105, 4131, 4157,
+     4183, 4209, 4235, 4261, 4287
     } ;
 
-static yyconst flex_int16_t yy_def[739] =
+static yyconst flex_int16_t yy_def[686] =
     {   0,
-      607,  607,  606,    3,  608,  608,  609,  609,  609,  609,
-      610,  610,  611,  611,  612,  612,  606,   17,  613,  613,
-      614,  614,  615,  615,  616,  616,  617,  617,  618,  618,
-      619,  619,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  620,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  621,  606,  606,  606,  606,  606,  622,
-      622,  622,  622,  622,  622,  622,  622,  622,  622,  622,
-      623,  624,  606,  606,  606,  606,  622,  625,  606,  606,
-      606,  626,  606,  606,  627,  606,  606,  628,  606,  629,
-      606,  606,  606,  630,  606,  606,  630,  606,  606,  606,
-
-      631,  606,  606,  606,  632,  606,  606,  633,  606,  606,
-      634,  635,  636,  606,  606,  606,  637,  606,  606,  606,
-      606,  606,  606,  638,  606,  606,  606,  639,  640,  606,
-      606,  606,  641,  642,  606,  606,  642,  643,  644,  606,
-      606,  644,  645,  606,  606,  606,  606,  606,  646,  606,
-      606,  606,  606,  647,  606,  606,  606,  606,  606,  606,
-      648,  606,  606,  606,  649,  606,  606,  606,  606,  606,
-      650,  650,  606,  650,  650,  650,  650,  606,  650,  650,
-      650,  650,  606,  651,  652,  653,  653,  606,  606,  606,
-      606,  606,  606,  650,  654,  606,  655,  656,  657,  658,
-
-      659,  606,  660,  661,  662,  606,  606,  663,  663,  606,
-      606,  606,  664,  664,  606,  665,  666,  667,  668,  606,
-      606,  606,  669,  606,  670,  606,  671,  606,  606,  672,
-      606,  673,  606,  674,  675,  606,  676,  677,  678,  606,
-      679,  680,  680,  681,  606,  606,  680,  682,  683,  683,
-      684,  606,  606,  683,  685,  606,  606,  606,  606,  606,
-      606,  686,  686,  686,  686,  686,  686,  606,  606,  606,
-      606,  606,  606,  687,  688,  689,  689,  689,  689,  689,
-      689,  689,  689,  689,  690,  606,  691,  692,  692,  606,
-      606,  606,  606,  693,  694,  695,  696,  697,  698,  699,
-
-      606,  606,  700,  606,  701,  702,  703,  704,  606,  606,
-      606,  606,  606,  705,  706,  707,  606,  708,  709,  606,
-      710,  606,  606,  606,  606,  711,  711,  711,  711,  606,
-      606,  606,  606,  712,  713,  713,  713,  713,  713,  606,
-      714,  606,  606,  606,  606,  606,  606,  715,  702,  606,
-      606,  703,  606,  716,  717,  718,  719,  606,  606,  606,
-      711,  711,  711,  711,  606,  606,  712,  713,  713,  713,
-      713,  606,  606,  720,  606,  606,  715,  606,  721,  722,
-      723,  724,  606,  606,  606,  606,  606,  606,  711,  711,
-      725,  711,  713,  713,  606,  606,  606,  606,  726,  727,
-
-      728,  709,  606,  606,  606,  606,  606,  729,  606,  711,
-      711,  725,  711,  713,  713,  730,  726,  727,  728,  402,
-      606,  606,  606,  606,  729,  606,  606,  606,  606,  729,
-      729,  606,  606,  606,  711,  711,  711,  711,  713,  713,
-      606,  417,  418,  419,  402,  731,  606,  729,  606,  729,
-      732,  729,  733,  606,  606,  606,  606,  606,  711,  711,
-      711,  711,  713,  713,  713,  713,  713,  713,  417,  418,
-      419,  402,  731,  733,  734,  729,  606,  732,  732,  732,
-      732,  732,  729,  733,  733,  733,  733,  733,  606,  606,
-      606,  606,  606,  606,  606,  711,  711,  711,  606,  606,
-
-      711,  711,  713,  713,  713,  713,  713,  713,  713,  713,
-      726,  727,  728,  402,  606,  734,  731,  734,  732,  735,
-      732,  606,  732,  736,  733,  606,  733,  737,  606,  606,
-      606,  606,  606,  606,  711,  711,  711,  713,  713,  713,
-      713,  713,  713,  713,  713,  606,  729,  731,  735,  731,
-      735,  732,  736,  731,  736,  733,  737,  737,  738,  606,
-      606,  711,  711,  711,  713,  713,  713,  713,  713,  713,
-      713,  729,  732,  731,  733,  731,  606,  738,  738,  606,
-      711,  711,  713,  713,  713,  713,  732,  733,  606,  606,
-      711,  711,  711,  713,  713,  606,  711,  711,  711,  711,
-
-      711,  711,  711,  711,  711,    0,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
+      558,  558,  557,    3,  559,  559,  560,  560,  560,  560,
+      561,  561,  562,  562,  563,  563,  557,   17,  564,  564,
+      565,  565,  566,  566,  567,  567,  568,  568,  569,  569,
+      570,  570,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  571,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  572,  557,  557,  557,  557,  557,  573,
+      573,  573,  573,  573,  573,  573,  573,  573,  573,  573,
+      574,  575,  557,  557,  557,  557,  573,  576,  557,  557,
+      557,  577,  557,  557,  578,  557,  557,  579,  557,  580,
+      557,  557,  557,  581,  557,  557,  581,  557,  557,  557,
+
+      582,  557,  557,  557,  583,  557,  557,  584,  557,  557,
+      585,  586,  587,  557,  557,  557,  588,  557,  557,  557,
+      557,  557,  557,  589,  557,  557,  557,  590,  591,  557,
+      557,  557,  592,  593,  557,  557,  593,  594,  595,  557,
+      557,  595,  596,  557,  557,  557,  557,  557,  597,  557,
+      557,  557,  557,  598,  557,  557,  557,  557,  557,  557,
+      599,  557,  557,  557,  600,  557,  557,  557,  557,  557,
+      601,  601,  557,  601,  601,  601,  601,  557,  601,  601,
+      601,  601,  557,  602,  603,  604,  604,  557,  557,  557,
+      557,  557,  557,  601,  605,  557,  606,  607,  608,  609,
+
+      610,  557,  611,  612,  613,  557,  557,  614,  614,  557,
+      557,  557,  615,  615,  557,  616,  617,  618,  619,  557,
+      557,  557,  620,  557,  621,  557,  622,  557,  557,  623,
+      557,  624,  557,  625,  626,  557,  627,  628,  629,  557,
+      630,  631,  631,  632,  557,  557,  631,  633,  634,  634,
+      635,  557,  557,  634,  636,  557,  557,  557,  557,  557,
+      557,  637,  637,  637,  637,  637,  637,  557,  557,  557,
+      557,  557,  557,  638,  639,  640,  640,  640,  640,  640,
+      640,  640,  640,  640,  641,  557,  642,  643,  643,  557,
+      557,  557,  557,  644,  645,  646,  647,  648,  649,  650,
+
+      557,  557,  651,  557,  652,  653,  654,  655,  557,  557,
+      557,  557,  557,  656,  657,  658,  557,  659,  660,  557,
+      661,  557,  557,  557,  557,  662,  662,  662,  662,  557,
+      557,  557,  557,  663,  664,  664,  664,  664,  664,  557,
+      665,  557,  557,  557,  557,  557,  557,  666,  653,  557,
+      557,  654,  557,  667,  668,  669,  670,  557,  557,  557,
+      662,  662,  662,  662,  557,  557,  663,  664,  664,  664,
+      664,  557,  557,  671,  557,  557,  666,  557,  672,  673,
+      674,  675,  557,  557,  557,  557,  557,  557,  662,  662,
+      676,  662,  664,  664,  557,  557,  557,  557,  677,  678,
+
+      679,  660,  557,  557,  557,  557,  680,  557,  662,  662,
+      676,  662,  664,  664,  681,  677,  678,  679,  402,  557,
+      557,  557,  557,  557,  557,  557,  557,  680,  680,  557,
+      557,  557,  662,  662,  662,  662,  664,  664,  557,  416,
+      417,  418,  402,  682,  683,  557,  557,  557,  557,  557,
+      662,  662,  662,  662,  664,  664,  664,  664,  664,  664,
+      416,  417,  418,  402,  682,  683,  683,  557,  557,  557,
+      557,  557,  557,  557,  662,  662,  662,  557,  557,  662,
+      662,  664,  664,  664,  664,  664,  664,  664,  664,  677,
+      678,  679,  402,  557,  557,  684,  557,  557,  557,  557,
+
+      557,  557,  662,  662,  662,  664,  664,  664,  664,  664,
+      664,  664,  664,  557,  684,  684,  685,  557,  557,  662,
+      662,  662,  664,  664,  664,  664,  664,  664,  664,  557,
+      685,  685,  557,  662,  662,  664,  664,  664,  664,  557,
+      557,  662,  662,  662,  664,  664,  557,  662,  662,  662,
+      662,  662,  662,  662,  662,  662,    0,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
 
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557
     } ;
 
-static yyconst flex_int16_t yy_nxt[4503] =
+static yyconst flex_int16_t yy_nxt[4399] =
     {   0,
-      606,  606,   35,   36,   35,   36,   79,   80,   79,   80,
-       86,  147,   86,   81,  147,   81,   79,   80,  515,   87,
+      557,  557,   35,   36,   35,   36,   79,   80,   79,   80,
+       86,  147,   86,   81,  147,   81,   79,   80,  557,   87,
        87,   87,   87,   89,   79,   80,   91,   92,   91,   92,
-      597,   89,  598,   37,  256,   37,   95,   96,  606,   95,
-       96,  103,   83,  211,  103,  515,   97,  582,   93,   97,
-       93,   98,  515,  103,   98,  166,  167,  515,   82,  515,
+      548,   89,  549,   37,  256,   37,   95,   96,  557,   95,
+       96,  103,   83,  211,  103,  535,   97,  517,   93,   97,
+       93,   98,  498,  103,   98,  166,  167,  239,   82,  235,
        82,   37,  256,   37,   38,   39,   40,   41,   39,   42,
        43,   44,   38,   45,   46,   47,   48,   48,   48,   49,
        50,   51,   52,   53,   53,   53,   54,   55,   56,   57,
@@ -693,17 +675,17 @@ static yyconst flex_int16_t yy_nxt[4503] =
        63,   60,   61,   62,   63,   64,   63,   63,   63,   63,
        63,   63,   65,   66,   63,   63,   63,   63,   67,   68,
        69,   63,   70,   63,   74,   75,   76,   77,   84,  103,
-       83,  559,  103,  155,  155,  155,  155,   85,   85,   85,
-       85,  103,   83,  130,  131,  105,  530,  132,   85,   85,
-       85,   85,   85,   85,   83,  515,  145,  105,  106,  107,
-      107,  107,  125,  126,  199,  200,  239,  125,  126,  127,
-      106,  107,  107,  107,  127,  235,   85,   85,   85,   85,
+       83,  478,  103,  155,  155,  155,  155,   85,   85,   85,
+       85,  103,   83,  130,  131,  105,  504,  132,   85,   85,
+       85,   85,   85,   85,   83,  496,  145,  105,  106,  107,
+      107,  107,  125,  126,  199,  200,  469,  125,  126,  127,
+      106,  107,  107,  107,  127,  494,   85,   85,   85,   85,
 
        85,   85,   84,  145,  157,  181,  158,  158,  158,  158,
       172,   85,   85,   85,   85,  133,  174,  175,  182,  202,
       202,  159,   85,   85,   85,   85,   85,   85,  162,  162,
-      162,  162,  163,  181,  128,  164,  214,  172,  499,  128,
-      217,  218,  215,  174,  175,  182,  228,  229,  536,  159,
+      162,  162,  163,  181,  128,  164,  214,  172,  445,  128,
+      217,  218,  215,  174,  175,  182,  228,  229,  422,  159,
        85,   85,   85,   85,   85,   85,   99,   99,   83,   99,
        99,   99,   99,   99,   99,   99,   99,   99,   99,   99,
        99,   99,   99,   99,   99,   99,   99,   99,  100,   99,
@@ -715,21 +697,21 @@ static yyconst flex_int16_t yy_nxt[4503] =
       101,  101,  101,  101,  101,  101,  101,  101,  101,  101,
       101,  101,  101,  101,  101,  101,   99,   99,   99,   99,
       109,  110,  130,  131,  111,  112,  132,  113,  114,  115,
-      135,  136,  135,  136,  140,  141,  528,  137,  142,  137,
+      135,  136,  135,  136,  140,  141,  437,  137,  142,  137,
       176,  116,  117,  237,  118,  140,  141,  243,  177,  142,
-      146,  250,  241,  151,  490,  146,  152,  146,  146,  515,
+      146,  250,  241,  151,  412,  146,  152,  146,  146,  409,
       153,  248,  146,  179,  255,  146,  147,  180,  176,  147,
-      237,  119,  120,  121,  133,  260,  177,  474,  146,  241,
+      237,  119,  120,  121,  133,  260,  177,  407,  146,  241,
 
       261,  151,  138,  152,  138,  146,  143,  153,  248,  214,
       179,  255,  244,  277,  180,  215,  273,  143,  122,  251,
       123,  109,  110,  260,  146,  111,  112,  261,  113,  114,
       115,  146,  157,  146,  158,  158,  158,  158,  146,  279,
       277,  146,  116,  117,  273,  118,  202,  202,  276,  159,
-      423,  146,  160,  146,  220,  221,  221,  221,  146,  280,
+      385,  146,  160,  146,  220,  221,  221,  221,  146,  280,
       146,  146,  188,  146,  188,  188,  279,  161,  146,  278,
       146,  146,  119,  120,  121,  146,  276,  159,  146,  214,
-      160,  222,  222,  222,  222,  606,  280,  146,  189,  245,
+      160,  222,  222,  222,  222,  557,  280,  146,  189,  245,
       246,  146,  190,  284,  161,  191,  247,  278,  194,  122,
 
       250,  123,  252,  253,  192,  146,  254,  281,  282,  263,
@@ -737,158 +719,158 @@ static yyconst flex_int16_t yy_nxt[4503] =
       190,  284,  237,  191,  146,  258,  258,  258,  258,  228,
       229,  192,  319,  146,  281,  282,  243,  259,  283,  358,
       316,  244,  358,  293,  193,  294,  146,  295,  251,  237,
-      264,  146,  265,  194,  251,  266,  241,  267,  439,  146,
+      264,  146,  265,  194,  251,  266,  241,  267,  376,  146,
       155,  155,  155,  155,  269,  259,  270,  270,  270,  270,
-      162,  162,  162,  162,  243,  268,  413,  264,  322,  265,
+      162,  162,  162,  162,  243,  268,  398,  264,  322,  265,
       251,  244,  266,  241,  267,  244,  146,  157,  146,  158,
-      158,  158,  158,  271,  410,  271,  408,  146,  272,  272,
+      158,  158,  158,  271,  395,  271,  392,  146,  272,  272,
 
-      272,  272,  146,  268,  159,  146,  322,  188,  385,  188,
-      188,  291,  248,  291,  291,  146,  146,  385,  431,  244,
+      272,  272,  146,  268,  159,  146,  322,  188,  351,  188,
+      188,  291,  248,  291,  291,  146,  146,  385,  429,  244,
       146,  146,  301,  146,  146,  146,  220,  221,  221,  221,
-      301,  376,  159,  290,  325,  292,  255,  190,  358,  248,
-      191,  358,  398,  146,  194,  222,  222,  222,  222,  192,
-      324,  289,  326,  395,  301,  302,  310,  310,  310,  310,
+      301,  378,  159,  290,  325,  292,  255,  190,  358,  248,
+      191,  358,  350,  146,  194,  222,  222,  222,  222,  192,
+      324,  289,  326,  376,  301,  302,  310,  310,  310,  310,
       245,  246,  325,  255,  336,  190,  327,  317,  191,  146,
       146,  252,  253,  328,  329,  320,  192,  324,  146,  326,
       289,  301,  302,  258,  258,  258,  258,  323,  323,  323,
       323,  263,  336,  327,  263,  334,  146,  146,  146,  194,
 
-      328,  329,  330,  335,  330,  338,  392,  331,  331,  331,
+      328,  329,  330,  335,  330,  338,  340,  331,  331,  331,
       331,  269,  244,  332,  332,  332,  332,  272,  272,  272,
-      272,  339,  334,  251,  269,  351,  270,  270,  270,  270,
+      272,  339,  334,  251,  269,  372,  270,  270,  270,  270,
       335,  344,  264,  338,  265,  272,  272,  272,  272,  267,
       359,  333,  146,  291,  347,  291,  291,  146,  339,  291,
       146,  291,  291,  342,  360,  342,  342,  363,  344,  264,
       364,  265,  353,  353,  353,  353,  267,  292,  359,  333,
-      146,  347,  378,  292,  323,  323,  323,  323,  331,  331,
+      146,  347,  362,  292,  323,  323,  323,  323,  331,  331,
       331,  331,  360,  343,  371,  363,  368,  369,  364,  331,
       331,  331,  331,  370,  373,  269,  289,  332,  332,  332,
 
       332,  365,  342,  365,  342,  342,  366,  366,  366,  366,
       374,  343,  371,  368,  369,  375,  353,  353,  353,  353,
       370,  358,  373,  146,  358,  289,  384,  385,  386,  384,
-      388,  389,  343,  390,  409,  391,  393,  374,  391,  394,
+      388,  389,  343,  390,  408,  391,  393,  374,  391,  394,
       387,  396,  375,  366,  366,  366,  366,  366,  366,  366,
-      366,  403,  411,  414,  415,  350,  416,  388,  421,  389,
-      343,  390,  409,  393,  429,  435,  394,  383,  396,  376,
-      422,  423,  424,  422,  385,  431,  432,  340,  403,  433,
-      411,  414,  415,  416,  425,  421,  372,  405,  405,  405,
-      405,  440,  429,  435,  383,  384,  385,  386,  384,  454,
-
-      427,  436,  422,  423,  424,  422,  428,  438,  493,  404,
-      455,  362,  405,  405,  405,  405,  426,  361,  440,  405,
-      405,  405,  405,  434,  456,  459,  454,  427,  251,  436,
-      457,  431,  460,  428,  244,  438,  493,  455,  406,  462,
-      407,  422,  423,  424,  422,  432,  446,  309,  432,  351,
-      434,  456,  459,  477,  431,  447,  461,  350,  461,  460,
-      468,  461,  461,  461,  461,  406,  462,  407,  262,  391,
-      434,  494,  391,  262,  262,  262,  262,  262,  262,  262,
-      262,  262,  262,  448,  449,  450,  448,  468,  458,  495,
-      262,  262,  262,  262,  262,  262,  262,  451,  304,  494,
-
-      452,  452,  452,  452,  423,  486,  152,  496,  422,  423,
-      424,  422,  497,  286,  434,  458,  495,  502,  503,  340,
-      504,  262,  453,  262,  337,  405,  405,  405,  405,  448,
-      449,  450,  448,  152,  475,  496,  449,  480,  517,  518,
-      497,  434,  430,  476,  507,  502,  503,  504,  262,  262,
-      262,  262,  417,  417,  417,  417,  479,  449,  480,  479,
-      533,  508,  149,  417,  417,  417,  417,  417,  417,  252,
-      481,  245,  507,  482,  482,  482,  482,  385,  431,  522,
-      480,  423,  486,  526,  486,  239,  534,  533,  235,  508,
-      519,  417,  417,  417,  417,  417,  417,  418,  418,  418,
-
-      418,  448,  449,  450,  448,  449,  480,  535,  418,  418,
-      418,  418,  418,  418,  534,  483,  490,  558,  452,  452,
-      452,  452,  505,  498,  499,  500,  498,  563,  506,  538,
-      563,  432,  537,  239,  433,  535,  418,  418,  418,  418,
-      418,  418,  243,  489,  490,  491,  489,  235,  539,  540,
-      505,  419,  419,  419,  419,  506,  538,  492,  509,  233,
-      537,  510,  419,  419,  419,  419,  419,  419,  449,  480,
-      152,  313,  541,  562,  458,  539,  540,  311,  434,  517,
-      518,  548,  518,  547,  542,  547,  509,  244,  228,  510,
-      419,  419,  419,  419,  419,  419,  250,  152,  463,  541,
-
-      562,  458,  464,  543,  544,  434,  564,  465,  420,  420,
-      420,  420,  542,  466,  489,  490,  491,  489,  467,  420,
-      420,  420,  420,  420,  420,  312,  463,  545,  492,  565,
-      464,  543,  544,  564,  465,  550,  551,  554,  555,  478,
-      466,  484,  423,  486,  251,  467,  561,  420,  420,  420,
-      420,  420,  420,  262,  262,  545,  565,  262,  262,  262,
-      262,  262,  262,  262,  262,  262,  262,  262,  485,  423,
-      486,  485,  490,  558,  561,  437,  262,  262,  262,  262,
-      262,  262,  487,  449,  480,  488,  488,  488,  488,  566,
-      423,  486,  498,  499,  500,  498,  552,  567,  568,  479,
-
-      449,  480,  479,  556,  520,  569,  262,  311,  262,  501,
-      501,  501,  501,  521,  570,  571,  566,  485,  423,  486,
-      485,  309,  524,  563,  567,  568,  563,  479,  449,  480,
-      479,  525,  569,  262,  262,  262,  262,  442,  442,  442,
-      442,  481,  570,  571,  482,  482,  482,  482,  442,  442,
-      442,  442,  442,  442,  529,  530,  531,  529,  546,  423,
-      424,  546,  550,  551,  577,  558,  573,  305,  532,  304,
-      574,  551,  447,  235,  573,  583,  442,  442,  442,  442,
-      442,  442,  443,  443,  443,  443,  479,  449,  480,  479,
-      530,  579,  580,  443,  443,  443,  443,  443,  443,  606,
-
-      523,  581,  583,  482,  482,  482,  482,  554,  555,  576,
-      555,  575,  209,  575,  448,  449,  450,  448,  239,  585,
-      580,  443,  443,  443,  443,  443,  443,  243,  451,  581,
-      199,  452,  452,  452,  452,  584,  444,  444,  444,  444,
-      485,  423,  486,  485,  590,  586,  585,  444,  444,  444,
-      444,  444,  444,  286,  487,  530,  579,  488,  488,  488,
-      488,  589,  579,  584,  591,  596,  596,  149,  596,  596,
-      594,  590,  244,  586,  599,  444,  444,  444,  444,  444,
-      444,  445,  445,  445,  445,  485,  423,  486,  485,  595,
-      600,  591,  445,  445,  445,  445,  445,  445,  594,  527,
-
-      257,  599,  488,  488,  488,  488,  601,  602,  603,  601,
-      602,  603,  252,  498,  499,  500,  498,  595,  600,  245,
-      445,  445,  445,  445,  445,  445,  469,  469,  469,  469,
-      501,  501,  501,  501,  240,  239,  236,  469,  469,  469,
-      469,  469,  469,  479,  449,  480,  479,  235,  233,  231,
-      529,  530,  531,  529,  604,  601,  602,  481,  601,  602,
-      482,  482,  482,  482,  532,  469,  469,  469,  469,  469,
-      469,  470,  470,  470,  470,  485,  423,  486,  485,  226,
-      224,  604,  470,  470,  470,  470,  470,  470,  603,  487,
-      216,  603,  488,  488,  488,  488,  605,  605,  201,  605,
-
-      605,  212,  210,  201,  201,  209,  560,  385,  386,  560,
-      470,  470,  470,  470,  470,  470,  471,  471,  471,  471,
-      387,  546,  423,  424,  546,  207,  206,  471,  471,  471,
-      471,  471,  471,  204,  197,  447,  572,  449,  450,  572,
-      560,  385,  386,  560,  196,  184,  274,  183,  178,  173,
-      476,  274,  274,  170,  387,  471,  471,  471,  471,  471,
-      471,  472,  472,  472,  472,  572,  449,  450,  572,  169,
-      168,  156,  472,  472,  472,  472,  472,  472,  154,  476,
-      587,  449,  480,  587,  588,  423,  486,  588,  150,  592,
-      201,  148,  144,  606,  521,  201,  201,  606,  525,  593,
-
-      472,  472,  472,  472,  472,  472,  511,  511,  511,  511,
-      587,  449,  480,  587,  606,  606,  592,  511,  511,  511,
-      511,  511,  511,  606,  521,  606,  593,  588,  423,  486,
-      588,  314,  606,  315,  606,  606,  314,  314,  315,  315,
-      606,  525,  606,  606,  606,  511,  511,  511,  511,  511,
-      511,  512,  512,  512,  512,  318,  606,  606,  606,  606,
-      318,  318,  512,  512,  512,  512,  512,  512,  321,  606,
-      274,  606,  354,  321,  321,  274,  274,  354,  354,  355,
-      606,  356,  606,  357,  355,  355,  356,  356,  357,  357,
-      512,  512,  512,  512,  512,  512,  513,  513,  513,  513,
-
-      367,  606,  606,  606,  606,  367,  367,  513,  513,  513,
-      513,  513,  513,  379,  606,  380,  606,  381,  379,  379,
-      380,  380,  381,  381,  382,  606,  399,  606,  400,  382,
-      382,  399,  399,  400,  400,  513,  513,  513,  513,  513,
-      513,  514,  514,  514,  514,  401,  606,  606,  606,  606,
-      401,  401,  514,  514,  514,  514,  514,  514,  402,  606,
-      606,  606,  606,  402,  402,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      514,  514,  514,  514,  514,  514,  249,  249,  249,  249,
-      606,  606,  606,  606,  606,  606,  606,  249,  249,  249,
+      366,  403,  410,  413,  414,  361,  415,  388,  420,  389,
+      343,  390,  408,  393,  427,  251,  394,  383,  396,  244,
+      421,  422,  423,  421,  430,  433,  434,  431,  403,  436,
+      410,  413,  414,  415,  424,  420,  309,  404,  404,  404,
+      404,  438,  427,  425,  383,  384,  385,  386,  384,  426,
+
+      351,  446,  447,  433,  434,  448,  451,  436,  452,  387,
+      385,  429,  404,  404,  404,  404,  449,  429,  438,  454,
+      425,  432,  421,  422,  423,  421,  426,  444,  446,  447,
+      460,  472,  448,  451,  350,  452,  424,  474,  405,  483,
+      406,  430,  422,  467,  430,  453,  454,  453,  432,  304,
+      453,  453,  453,  453,  286,  473,  340,  460,  430,  472,
+      521,  431,  432,  521,  474,  405,  483,  406,  262,  391,
+      422,  467,  391,  262,  262,  262,  262,  262,  262,  262,
+      262,  262,  262,  473,  450,  475,  468,  469,  470,  468,
+      262,  262,  262,  262,  262,  262,  262,  152,  152,  455,
+
+      471,  450,  476,  456,  337,  432,  432,  501,  457,  481,
+      482,  450,  486,  475,  458,  495,  467,  469,  516,  459,
+      149,  262,  252,  262,  152,  152,  245,  455,  450,  487,
+      476,  456,  432,  432,  501,  457,  521,  481,  482,  521,
+      486,  458,  477,  478,  479,  477,  459,  502,  262,  262,
+      262,  262,  416,  416,  416,  416,  503,  487,  505,  480,
+      480,  480,  480,  416,  416,  416,  416,  416,  416,  468,
+      469,  470,  468,  484,  488,  502,  506,  489,  239,  485,
+      507,  469,  516,  471,  503,  235,  505,  233,  235,  530,
+      516,  416,  416,  416,  416,  416,  416,  417,  417,  417,
+
+      417,  484,  488,  506,  313,  489,  485,  507,  417,  417,
+      417,  417,  417,  417,  497,  498,  499,  497,  477,  478,
+      479,  477,  311,  508,  498,  532,  228,  510,  500,  477,
+      478,  479,  477,  239,  509,  312,  417,  417,  417,  417,
+      417,  417,  243,  511,  512,  513,  480,  480,  480,  480,
+      508,  418,  418,  418,  418,  510,  514,  422,  423,  514,
+      311,  509,  418,  418,  418,  418,  418,  418,  498,  532,
+      424,  511,  512,  513,  497,  498,  499,  497,  519,  309,
+      520,  540,  532,  518,  385,  386,  518,  244,  500,  522,
+      418,  418,  418,  418,  418,  418,  250,  387,  523,  524,
+
+      525,  526,  527,  528,  529,  533,  519,  520,  419,  419,
+      419,  419,  534,  305,  536,  537,  522,  304,  538,  419,
+      419,  419,  419,  419,  419,  523,  524,  525,  526,  527,
+      557,  528,  529,  533,  547,  547,  552,  547,  547,  552,
+      534,  536,  209,  537,  251,  538,  539,  419,  419,  419,
+      419,  419,  419,  262,  262,  199,  286,  262,  262,  262,
+      262,  262,  262,  262,  262,  262,  262,  262,  514,  422,
+      423,  514,  541,  542,  539,  435,  262,  262,  262,  262,
+      262,  262,  424,  518,  385,  386,  518,  550,  543,  545,
+      546,  551,  553,  554,  555,  553,  554,  387,  544,  541,
+
+      542,  552,  553,  149,  552,  553,  262,  554,  262,  556,
+      554,  257,  556,  556,  550,  543,  556,  545,  546,  551,
+      252,  555,  201,  245,  274,  544,  201,  201,  201,  274,
+      274,  201,  201,  262,  262,  262,  262,  440,  440,  440,
+      440,  314,  240,  239,  236,  235,  314,  314,  440,  440,
+      440,  440,  440,  440,  315,  233,  318,  231,  321,  315,
+      315,  318,  318,  321,  321,  274,  226,  224,  216,  354,
+      274,  274,  212,  235,  354,  354,  440,  440,  440,  440,
+      440,  440,  441,  441,  441,  441,  355,  210,  209,  207,
+      206,  355,  355,  441,  441,  441,  441,  441,  441,  356,
+
+      204,  357,  197,  367,  356,  356,  357,  357,  367,  367,
+      379,  196,  184,  183,  380,  379,  379,  178,  239,  380,
+      380,  441,  441,  441,  441,  441,  441,  243,  381,  173,
+      170,  169,  168,  381,  381,  382,  442,  442,  442,  442,
+      382,  382,  156,  154,  150,  148,  144,  442,  442,  442,
+      442,  442,  442,  399,  557,  400,  557,  401,  399,  399,
+      400,  400,  401,  401,  402,  557,  557,  557,  557,  402,
+      402,  557,  244,  557,  557,  442,  442,  442,  442,  442,
+      442,  443,  443,  443,  443,  557,  557,  557,  557,  557,
+      557,  557,  443,  443,  443,  443,  443,  443,  557,  557,
 
-      249,  249,  249,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  249,  249,  249,  249,  249,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      443,  443,  443,  443,  443,  443,  461,  461,  461,  461,
+      557,  557,  557,  557,  557,  557,  557,  461,  461,  461,
+      461,  461,  461,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  461,  461,  461,  461,  461,
+      461,  462,  462,  462,  462,  557,  557,  557,  557,  557,
+      557,  557,  462,  462,  462,  462,  462,  462,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      462,  462,  462,  462,  462,  462,  463,  463,  463,  463,
+      557,  557,  557,  557,  557,  557,  557,  463,  463,  463,
+      463,  463,  463,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  463,  463,  463,  463,  463,
+      463,  464,  464,  464,  464,  557,  557,  557,  557,  557,
+      557,  557,  464,  464,  464,  464,  464,  464,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+
+      464,  464,  464,  464,  464,  464,  490,  490,  490,  490,
+      557,  557,  557,  557,  557,  557,  557,  490,  490,  490,
+      490,  490,  490,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  490,  490,  490,  490,  490,
+      490,  491,  491,  491,  491,  557,  557,  557,  557,  557,
+      557,  557,  491,  491,  491,  491,  491,  491,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      491,  491,  491,  491,  491,  491,  492,  492,  492,  492,
+
+      557,  557,  557,  557,  557,  557,  557,  492,  492,  492,
+      492,  492,  492,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  492,  492,  492,  492,  492,
+      492,  493,  493,  493,  493,  557,  557,  557,  557,  557,
+      557,  557,  493,  493,  493,  493,  493,  493,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      493,  493,  493,  493,  493,  493,  249,  249,  249,  249,
+      557,  557,  557,  557,  557,  557,  557,  249,  249,  249,
+
+      249,  249,  249,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  249,  249,  249,  249,  249,
       249,   34,   34,   34,   34,   34,   34,   34,   34,   34,
        34,   34,   34,   34,   34,   34,   34,   34,   34,   34,
        34,   34,   34,   34,   34,   34,   34,   78,   78,   78,
@@ -926,263 +908,251 @@ static yyconst flex_int16_t yy_nxt[4503] =
       134,  134,  134,  139,  139,  139,  139,  139,  139,  139,
       139,  139,  139,  139,  139,  139,  139,  139,  139,  139,
       139,  139,  139,  139,  139,  139,  139,  139,  139,  149,
-      149,  606,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  557,  149,  149,  149,  149,  149,  149,  149,  149,
       149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
-      149,  149,  149,  149,  149,  165,  165,  606,  165,  606,
+      149,  149,  149,  149,  149,  165,  165,  557,  165,  557,
 
-      165,  165,  165,  165,  171,  606,  606,  606,  171,  171,
-      171,  171,  171,  606,  606,  171,  606,  171,  185,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      185,  185,  185,  185,  186,  606,  606,  606,  186,  606,
-      606,  186,  606,  606,  606,  606,  606,  606,  606,  606,
-      186,  186,  186,  186,  186,  186,  606,  186,  606,  186,
-      195,  195,  606,  606,  195,  195,  195,  195,  606,  195,
+      165,  165,  165,  165,  171,  557,  557,  557,  171,  171,
+      171,  171,  171,  557,  557,  171,  557,  171,  185,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      185,  185,  185,  185,  186,  557,  557,  557,  186,  557,
+      557,  186,  557,  557,  557,  557,  557,  557,  557,  557,
+      186,  186,  186,  186,  186,  186,  557,  186,  557,  186,
+      195,  195,  557,  557,  195,  195,  195,  195,  557,  195,
       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
-      195,  606,  195,  195,  195,  195,  198,  198,  198,  198,
+      195,  557,  195,  195,  195,  195,  198,  198,  198,  198,
       198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
 
       198,  198,  198,  198,  198,  198,  198,  198,  198,  198,
-      198,  198,  203,  203,  606,  606,  203,  203,  203,  203,
-      606,  203,  203,  203,  203,  203,  203,  203,  203,  203,
+      198,  198,  203,  203,  557,  557,  203,  203,  203,  203,
+      557,  203,  203,  203,  203,  203,  203,  203,  203,  203,
       203,  203,  203,  203,  203,  203,  203,  203,  205,  205,
-      606,  606,  205,  205,  205,  205,  205,  205,  205,  205,
-      205,  205,  606,  205,  205,  205,  205,  205,  205,  205,
-      205,  205,  205,  205,  208,  208,  606,  606,  208,  208,
-      208,  208,  208,  208,  208,  606,  208,  208,  208,  208,
+      557,  557,  205,  205,  205,  205,  205,  205,  205,  205,
+      205,  205,  557,  205,  205,  205,  205,  205,  205,  205,
+      205,  205,  205,  205,  208,  208,  557,  557,  208,  208,
+      208,  208,  208,  208,  208,  557,  208,  208,  208,  208,
       208,  208,  208,  208,  208,  208,  208,  208,  208,  208,
-      213,  606,  213,  213,  606,  606,  606,  213,  213,  213,
+      213,  557,  213,  213,  557,  557,  557,  213,  213,  213,
 
-      213,  606,  606,  213,  219,  219,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  219,  219,  219,
-      219,  223,  223,  606,  606,  223,  606,  606,  223,  606,
-      223,  223,  223,  223,  223,  606,  223,  223,  223,  223,
-      223,  223,  606,  606,  223,  606,  223,  225,  225,  606,
+      213,  557,  557,  213,  219,  219,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  219,  219,  219,
+      219,  223,  223,  557,  557,  223,  557,  557,  223,  557,
+      223,  223,  223,  223,  223,  557,  223,  223,  223,  223,
+      223,  223,  557,  557,  223,  557,  223,  225,  225,  557,
       225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
-      225,  225,  225,  225,  225,  225,  225,  225,  606,  225,
+      225,  225,  225,  225,  225,  225,  225,  225,  557,  225,
       225,  225,  225,  227,  227,  227,  227,  227,  227,  227,
       227,  227,  227,  227,  227,  227,  227,  227,  227,  227,
       227,  227,  227,  227,  227,  227,  227,  227,  227,  230,
 
-      230,  606,  230,  230,  230,  230,  230,  230,  230,  230,
+      230,  557,  230,  230,  230,  230,  230,  230,  230,  230,
       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
-      606,  230,  230,  230,  230,  232,  606,  232,  232,  232,
-      232,  232,  232,  232,  232,  606,  232,  232,  232,  232,
-      232,  232,  606,  232,  232,  606,  232,  234,  234,  606,
-      606,  234,  234,  234,  234,  606,  234,  234,  234,  234,
+      557,  230,  230,  230,  230,  232,  557,  232,  232,  232,
+      232,  232,  232,  232,  232,  557,  232,  232,  232,  232,
+      232,  232,  557,  232,  232,  557,  232,  234,  234,  557,
+      557,  234,  234,  234,  234,  557,  234,  234,  234,  234,
       234,  234,  234,  234,  234,  234,  234,  234,  234,  234,
-      234,  234,  234,  234,  606,  606,  234,  606,  606,  606,
-      606,  606,  606,  606,  606,  234,  606,  606,  234,  234,
-      238,  238,  606,  606,  238,  606,  238,  238,  238,  238,
+      234,  234,  234,  234,  557,  557,  234,  557,  557,  557,
+      557,  557,  557,  557,  557,  234,  557,  557,  234,  234,
+      238,  238,  557,  557,  238,  557,  238,  238,  238,  238,
 
       238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
-      238,  238,  238,  238,  238,  238,  238,  606,  606,  238,
-      606,  606,  606,  606,  606,  606,  606,  606,  238,  606,
-      606,  238,  238,  242,  242,  606,  606,  242,  242,  242,
+      238,  238,  238,  238,  238,  238,  238,  557,  557,  238,
+      557,  557,  557,  557,  557,  557,  557,  557,  238,  557,
+      557,  238,  238,  242,  242,  557,  557,  242,  242,  242,
       242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
       242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      606,  606,  242,  606,  606,  606,  606,  606,  606,  606,
-      606,  242,  606,  606,  242,  242,  249,  249,  606,  606,
+      557,  557,  242,  557,  557,  557,  557,  557,  557,  557,
+      557,  242,  557,  557,  242,  242,  249,  249,  557,  557,
       249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
       249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
 
-      249,  249,  249,  606,  606,  249,  606,  606,  606,  606,
-      606,  606,  606,  606,  249,  606,  606,  249,  249,  149,
-      149,  606,  149,  149,  149,  149,  149,  149,  149,  149,
+      249,  249,  249,  557,  557,  249,  557,  557,  557,  557,
+      557,  557,  557,  557,  249,  557,  557,  249,  249,  149,
+      149,  557,  149,  149,  149,  149,  149,  149,  149,  149,
       149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
-      149,  149,  149,  149,  149,  262,  262,  606,  606,  262,
+      149,  149,  149,  149,  149,  262,  262,  557,  557,  262,
       262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
       262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
-      262,  275,  606,  606,  606,  606,  275,  275,  275,  275,
-      606,  606,  275,  171,  606,  606,  606,  171,  171,  171,
-      171,  171,  606,  606,  171,  606,  171,  285,  285,  285,
-
-      285,  287,  606,  606,  606,  606,  606,  287,  287,  287,
-      287,  606,  606,  606,  287,  287,  287,  287,  606,  606,
-      287,  288,  288,  606,  606,  606,  288,  288,  288,  288,
-      288,  606,  288,  606,  288,  195,  195,  606,  606,  195,
-      195,  195,  195,  606,  195,  195,  195,  195,  195,  195,
-      195,  195,  195,  195,  195,  195,  606,  195,  195,  195,
-      195,  296,  296,  606,  606,  296,  296,  296,  296,  606,
+      262,  275,  557,  557,  557,  557,  275,  275,  275,  275,
+      557,  557,  275,  171,  557,  557,  557,  171,  171,  171,
+      171,  171,  557,  557,  171,  557,  171,  285,  285,  285,
+
+      285,  287,  557,  557,  557,  557,  557,  287,  287,  287,
+      287,  557,  557,  557,  287,  287,  287,  287,  557,  557,
+      287,  288,  288,  557,  557,  557,  288,  288,  288,  288,
+      288,  557,  288,  557,  288,  195,  195,  557,  557,  195,
+      195,  195,  195,  557,  195,  195,  195,  195,  195,  195,
+      195,  195,  195,  195,  195,  195,  557,  195,  195,  195,
+      195,  296,  296,  557,  557,  296,  296,  296,  296,  557,
       296,  296,  296,  296,  296,  296,  296,  296,  296,  296,
-      296,  296,  606,  296,  296,  296,  296,  297,  297,  606,
-      606,  297,  297,  297,  297,  606,  297,  297,  297,  297,
-
-      297,  297,  297,  297,  297,  297,  297,  297,  606,  297,
-      297,  297,  297,  298,  298,  606,  606,  298,  298,  298,
-      298,  606,  298,  298,  298,  298,  298,  298,  298,  298,
-      298,  298,  298,  298,  606,  298,  298,  298,  298,  299,
-      299,  299,  606,  299,  299,  299,  299,  606,  299,  299,
+      296,  296,  557,  296,  296,  296,  296,  297,  297,  557,
+      557,  297,  297,  297,  297,  557,  297,  297,  297,  297,
+
+      297,  297,  297,  297,  297,  297,  297,  297,  557,  297,
+      297,  297,  297,  298,  298,  557,  557,  298,  298,  298,
+      298,  557,  298,  298,  298,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  557,  298,  298,  298,  298,  299,
+      299,  299,  557,  299,  299,  299,  299,  557,  299,  299,
       299,  299,  299,  299,  299,  299,  299,  299,  299,  299,
-      606,  299,  299,  299,  299,  203,  203,  606,  606,  203,
-      203,  203,  203,  606,  203,  203,  203,  203,  203,  203,
+      557,  299,  299,  299,  299,  203,  203,  557,  557,  203,
+      203,  203,  203,  557,  203,  203,  203,  203,  203,  203,
       203,  203,  203,  203,  203,  203,  203,  203,  203,  203,
-      203,  300,  300,  606,  606,  300,  300,  300,  300,  606,
+      203,  300,  300,  557,  557,  300,  300,  300,  300,  557,
 
       300,  300,  300,  300,  300,  300,  300,  300,  300,  300,
-      300,  300,  300,  300,  300,  300,  300,  205,  205,  606,
-      606,  205,  205,  205,  205,  205,  205,  205,  205,  205,
-      205,  606,  205,  205,  205,  205,  205,  205,  205,  205,
-      205,  205,  205,  208,  208,  606,  606,  208,  208,  208,
-      208,  208,  208,  208,  606,  208,  208,  208,  208,  208,
+      300,  300,  300,  300,  300,  300,  300,  205,  205,  557,
+      557,  205,  205,  205,  205,  205,  205,  205,  205,  205,
+      205,  557,  205,  205,  205,  205,  205,  205,  205,  205,
+      205,  205,  205,  208,  208,  557,  557,  208,  208,  208,
+      208,  208,  208,  208,  557,  208,  208,  208,  208,  208,
       208,  208,  208,  208,  208,  208,  208,  208,  208,  213,
-      606,  213,  213,  606,  606,  606,  213,  213,  213,  213,
-      606,  606,  213,  303,  303,  303,  303,  606,  303,  303,
-      303,  303,  303,  606,  303,  303,  303,  303,  303,  303,
-
-      303,  303,  303,  606,  303,  306,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  306,  306,  306,
-      306,  307,  307,  307,  307,  308,  308,  308,  308,  606,
-      606,  606,  308,  308,  308,  308,  606,  308,  308,  223,
-      223,  606,  606,  223,  606,  606,  223,  606,  223,  223,
-      223,  223,  223,  606,  223,  223,  223,  223,  223,  223,
-      606,  606,  223,  606,  223,  225,  225,  606,  225,  225,
+      557,  213,  213,  557,  557,  557,  213,  213,  213,  213,
+      557,  557,  213,  303,  303,  303,  303,  557,  303,  303,
+      303,  303,  303,  557,  303,  303,  303,  303,  303,  303,
+
+      303,  303,  303,  557,  303,  306,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  306,  306,  306,
+      306,  307,  307,  307,  307,  308,  308,  308,  308,  557,
+      557,  557,  308,  308,  308,  308,  557,  308,  308,  223,
+      223,  557,  557,  223,  557,  557,  223,  557,  223,  223,
+      223,  223,  223,  557,  223,  223,  223,  223,  223,  223,
+      557,  557,  223,  557,  223,  225,  225,  557,  225,  225,
       225,  225,  225,  225,  225,  225,  225,  225,  225,  225,
-      225,  225,  225,  225,  225,  225,  606,  225,  225,  225,
+      225,  225,  225,  225,  225,  225,  557,  225,  225,  225,
       225,  227,  227,  227,  227,  227,  227,  227,  227,  227,
 
       227,  227,  227,  227,  227,  227,  227,  227,  227,  227,
-      227,  227,  227,  227,  227,  227,  227,  230,  230,  606,
+      227,  227,  227,  227,  227,  227,  227,  230,  230,  557,
       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
-      230,  230,  230,  230,  230,  230,  230,  230,  606,  230,
-      230,  230,  230,  232,  606,  232,  232,  232,  232,  232,
-      232,  232,  232,  606,  232,  232,  232,  232,  232,  232,
-      606,  232,  232,  606,  232,  234,  234,  606,  606,  234,
-      234,  234,  234,  606,  234,  234,  234,  234,  234,  234,
+      230,  230,  230,  230,  230,  230,  230,  230,  557,  230,
+      230,  230,  230,  232,  557,  232,  232,  232,  232,  232,
+      232,  232,  232,  557,  232,  232,  232,  232,  232,  232,
+      557,  232,  232,  557,  232,  234,  234,  557,  557,  234,
+      234,  234,  234,  557,  234,  234,  234,  234,  234,  234,
       234,  234,  234,  234,  234,  234,  234,  234,  234,  234,
-      234,  234,  606,  606,  234,  606,  606,  606,  606,  606,
+      234,  234,  557,  557,  234,  557,  557,  557,  557,  557,
 
-      606,  606,  606,  234,  606,  606,  234,  234,  238,  238,
-      606,  606,  238,  606,  238,  238,  238,  238,  238,  238,
+      557,  557,  557,  234,  557,  557,  234,  234,  238,  238,
+      557,  557,  238,  557,  238,  238,  238,  238,  238,  238,
       238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
-      238,  238,  238,  238,  238,  606,  606,  238,  606,  606,
-      606,  606,  606,  606,  606,  606,  238,  606,  606,  238,
-      238,  242,  242,  606,  606,  242,  242,  242,  242,  242,
+      238,  238,  238,  238,  238,  557,  557,  238,  557,  557,
+      557,  557,  557,  557,  557,  557,  238,  557,  557,  238,
+      238,  242,  242,  557,  557,  242,  242,  242,  242,  242,
       242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  242,  606,  606,
-      242,  606,  606,  606,  606,  606,  606,  606,  606,  242,
-      606,  606,  242,  242,  249,  249,  606,  606,  249,  249,
+      242,  242,  242,  242,  242,  242,  242,  242,  557,  557,
+      242,  557,  557,  557,  557,  557,  557,  557,  557,  242,
+      557,  557,  242,  242,  249,  249,  557,  557,  249,  249,
 
       249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
       249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
-      249,  606,  606,  249,  606,  606,  606,  606,  606,  606,
-      606,  606,  249,  606,  606,  249,  249,  262,  262,  606,
-      606,  262,  262,  262,  262,  262,  262,  262,  262,  262,
+      249,  557,  557,  249,  557,  557,  557,  557,  557,  557,
+      557,  557,  249,  557,  557,  249,  249,  262,  262,  557,
+      557,  262,  262,  262,  262,  262,  262,  262,  262,  262,
       262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
-      262,  262,  262,  275,  606,  606,  606,  606,  275,  275,
-      275,  275,  606,  606,  275,  171,  606,  606,  606,  171,
-      171,  171,  171,  171,  606,  606,  171,  606,  171,  341,
-      606,  606,  606,  606,  341,  341,  341,  341,  606,  606,
-
-      606,  341,  341,  341,  341,  606,  606,  341,  287,  606,
-      606,  606,  606,  606,  287,  287,  287,  287,  606,  606,
-      606,  287,  287,  287,  287,  606,  606,  287,  288,  288,
-      606,  606,  606,  288,  288,  288,  288,  288,  606,  288,
-      606,  288,  345,  345,  345,  345,  345,  345,  345,  345,
-      345,  345,  345,  345,  606,  345,  345,  345,  345,  606,
-      606,  606,  606,  345,  345,  606,  345,  345,  346,  346,
+      262,  262,  262,  275,  557,  557,  557,  557,  275,  275,
+      275,  275,  557,  557,  275,  171,  557,  557,  557,  171,
+      171,  171,  171,  171,  557,  557,  171,  557,  171,  341,
+      557,  557,  557,  557,  341,  341,  341,  341,  557,  557,
+
+      557,  341,  341,  341,  341,  557,  557,  341,  287,  557,
+      557,  557,  557,  557,  287,  287,  287,  287,  557,  557,
+      557,  287,  287,  287,  287,  557,  557,  287,  288,  288,
+      557,  557,  557,  288,  288,  288,  288,  288,  557,  288,
+      557,  288,  345,  345,  345,  345,  345,  345,  345,  345,
+      345,  345,  345,  345,  557,  345,  345,  345,  345,  557,
+      557,  557,  557,  345,  345,  557,  345,  345,  346,  346,
       346,  346,  346,  346,  346,  346,  346,  346,  346,  346,
-      606,  346,  346,  346,  346,  606,  606,  606,  606,  346,
-      346,  606,  346,  346,  296,  296,  606,  606,  296,  296,
+      557,  346,  346,  346,  346,  557,  557,  557,  557,  346,
+      346,  557,  346,  346,  296,  296,  557,  557,  296,  296,
 
-      296,  296,  606,  296,  296,  296,  296,  296,  296,  296,
-      296,  296,  296,  296,  296,  606,  296,  296,  296,  296,
-      297,  297,  606,  606,  297,  297,  297,  297,  606,  297,
+      296,  296,  557,  296,  296,  296,  296,  296,  296,  296,
+      296,  296,  296,  296,  296,  557,  296,  296,  296,  296,
+      297,  297,  557,  557,  297,  297,  297,  297,  557,  297,
       297,  297,  297,  297,  297,  297,  297,  297,  297,  297,
-      297,  606,  297,  297,  297,  297,  298,  298,  606,  606,
-      298,  298,  298,  298,  606,  298,  298,  298,  298,  298,
-      298,  298,  298,  298,  298,  298,  298,  606,  298,  298,
-      298,  298,  299,  299,  606,  606,  299,  299,  299,  299,
-      606,  299,  299,  299,  299,  299,  299,  299,  299,  299,
-      299,  299,  299,  606,  299,  299,  299,  299,  300,  300,
-
-      606,  606,  300,  300,  300,  300,  606,  300,  300,  300,
+      297,  557,  297,  297,  297,  297,  298,  298,  557,  557,
+      298,  298,  298,  298,  557,  298,  298,  298,  298,  298,
+      298,  298,  298,  298,  298,  298,  298,  557,  298,  298,
+      298,  298,  299,  299,  557,  557,  299,  299,  299,  299,
+      557,  299,  299,  299,  299,  299,  299,  299,  299,  299,
+      299,  299,  299,  557,  299,  299,  299,  299,  300,  300,
+
+      557,  557,  300,  300,  300,  300,  557,  300,  300,  300,
       300,  300,  300,  300,  300,  300,  300,  300,  300,  300,
-      300,  300,  300,  300,  303,  303,  303,  303,  606,  303,
-      303,  303,  303,  303,  606,  303,  303,  303,  303,  303,
-      303,  303,  303,  303,  606,  303,  348,  348,  348,  348,
-      349,  349,  349,  349,  606,  606,  606,  349,  349,  349,
-      349,  606,  349,  349,  352,  606,  606,  606,  606,  352,
-      352,  352,  352,  606,  606,  606,  352,  352,  352,  352,
-      606,  606,  352,  308,  308,  308,  308,  606,  606,  606,
-      308,  308,  308,  308,  606,  308,  308,  242,  242,  606,
-
-      606,  242,  242,  242,  242,  606,  242,  242,  242,  242,
+      300,  300,  300,  300,  303,  303,  303,  303,  557,  303,
+      303,  303,  303,  303,  557,  303,  303,  303,  303,  303,
+      303,  303,  303,  303,  557,  303,  348,  348,  348,  348,
+      349,  349,  349,  349,  557,  557,  557,  349,  349,  349,
+      349,  557,  349,  349,  352,  557,  557,  557,  557,  352,
+      352,  352,  352,  557,  557,  557,  352,  352,  352,  352,
+      557,  557,  352,  308,  308,  308,  308,  557,  557,  557,
+      308,  308,  308,  308,  557,  308,  308,  242,  242,  557,
+
+      557,  242,  242,  242,  242,  557,  242,  242,  242,  242,
       242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  249,  249,  606,  606,  249,  606,  249,
+      242,  242,  242,  249,  249,  557,  557,  249,  557,  249,
       249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
       249,  249,  249,  249,  249,  249,  249,  249,  249,  262,
-      262,  606,  606,  262,  262,  262,  262,  262,  262,  262,
+      262,  557,  557,  262,  262,  262,  262,  262,  262,  262,
       262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
-      262,  262,  262,  262,  262,  171,  606,  606,  606,  171,
-      171,  171,  171,  171,  606,  606,  171,  606,  171,  341,
-      606,  606,  606,  606,  341,  341,  341,  341,  606,  606,
-
-      606,  341,  341,  341,  341,  606,  606,  341,  377,  606,
-      606,  606,  606,  377,  377,  377,  377,  606,  606,  606,
-      377,  377,  377,  377,  606,  606,  377,  397,  397,  397,
-      397,  397,  397,  397,  397,  397,  397,  397,  397,  606,
-      397,  397,  397,  397,  606,  606,  606,  606,  397,  397,
-      606,  397,  397,  412,  412,  606,  606,  412,  412,  412,
-      412,  412,  412,  412,  412,  412,  412,  412,  412,  412,
-      412,  412,  412,  412,  412,  412,  412,  412,  412,  234,
-      234,  606,  606,  234,  234,  234,  234,  606,  234,  234,
+      262,  262,  262,  262,  262,  171,  557,  557,  557,  171,
+      171,  171,  171,  171,  557,  557,  171,  557,  171,  341,
+      557,  557,  557,  557,  341,  341,  341,  341,  557,  557,
+
+      557,  341,  341,  341,  341,  557,  557,  341,  377,  557,
+      557,  557,  557,  377,  377,  377,  377,  557,  557,  557,
+      377,  377,  377,  377,  557,  557,  377,  397,  397,  397,
+      397,  397,  397,  397,  397,  397,  397,  397,  397,  557,
+      397,  397,  397,  397,  557,  557,  557,  557,  397,  397,
+      557,  397,  397,  411,  411,  557,  557,  411,  411,  411,
+      411,  411,  411,  411,  411,  411,  411,  411,  411,  411,
+      411,  411,  411,  411,  411,  411,  411,  411,  411,  234,
+      234,  557,  557,  234,  234,  234,  234,  557,  234,  234,
       234,  234,  234,  234,  234,  234,  234,  234,  234,  234,
 
-      234,  234,  234,  234,  234,  238,  238,  606,  606,  238,
-      606,  238,  238,  238,  238,  238,  238,  238,  238,  238,
+      234,  234,  234,  234,  234,  238,  238,  557,  557,  238,
+      557,  238,  238,  238,  238,  238,  238,  238,  238,  238,
       238,  238,  238,  238,  238,  238,  238,  238,  238,  238,
-      238,  242,  242,  606,  606,  242,  242,  242,  242,  242,
+      238,  242,  242,  557,  557,  242,  242,  242,  242,  242,
       242,  242,  242,  242,  242,  242,  242,  242,  242,  242,
-      242,  242,  242,  242,  242,  242,  242,  430,  430,  430,
-      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
-      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
-      430,  430,  430,  441,  441,  441,  441,  441,  441,  441,
-      441,  441,  441,  441,  441,  606,  441,  441,  441,  441,
-
-      606,  606,  606,  606,  441,  441,  606,  441,  441,  473,
-      473,  473,  473,  473,  606,  473,  473,  473,  473,  473,
-      473,  473,  473,  473,  473,  473,  473,  473,  473,  473,
-      473,  473,  473,  473,  473,  478,  478,  478,  478,  478,
-      478,  478,  478,  478,  478,  478,  478,  478,  478,  478,
-      478,  478,  478,  478,  478,  478,  478,  478,  478,  478,
-      478,  484,  484,  484,  484,  484,  484,  484,  484,  484,
-      484,  484,  484,  484,  484,  484,  484,  484,  484,  484,
-      484,  484,  484,  484,  484,  484,  484,  516,  516,  516,
-      516,  516,  516,  516,  516,  516,  516,  516,  516,  516,
-
-      516,  516,  516,  516,  516,  516,  516,  516,  516,  516,
-      516,  516,  516,  549,  549,  549,  549,  549,  549,  549,
-      549,  549,  549,  549,  549,  549,  549,  549,  549,  549,
-      549,  549,  549,  549,  549,  549,  549,  549,  549,  553,
-      553,  553,  553,  553,  553,  553,  553,  553,  553,  553,
-      553,  553,  553,  553,  553,  553,  553,  553,  553,  553,
-      553,  553,  553,  553,  553,  557,  557,  557,  557,  557,
+      242,  242,  242,  242,  242,  242,  242,  428,  428,  428,
+      428,  428,  428,  428,  428,  428,  428,  428,  428,  428,
+      428,  428,  428,  428,  428,  428,  428,  428,  428,  428,
+      428,  428,  428,  439,  439,  439,  439,  439,  439,  439,
+      439,  439,  439,  439,  439,  557,  439,  439,  439,  439,
+
+      557,  557,  557,  557,  439,  439,  557,  439,  439,  465,
+      465,  465,  465,  465,  557,  465,  465,  465,  465,  465,
+      465,  465,  465,  465,  465,  465,  465,  465,  465,  465,
+      465,  465,  465,  465,  465,  466,  466,  466,  466,  466,
+      466,  466,  466,  466,  466,  466,  466,  466,  466,  466,
+      466,  466,  466,  466,  466,  466,  466,  466,  466,  466,
+      466,  515,  515,  515,  515,  515,  515,  515,  515,  515,
+      515,  515,  515,  515,  515,  515,  515,  515,  515,  515,
+      515,  515,  515,  515,  515,  515,  515,  531,  531,  531,
+      531,  531,  531,  531,  531,  531,  531,  531,  531,  531,
+
+      531,  531,  531,  531,  531,  531,  531,  531,  531,  531,
+      531,  531,  531,   33,  557,  557,  557,  557,  557,  557,
       557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
       557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
-      557,  578,  578,  578,  578,  578,  578,  578,  578,  578,
-
-      578,  578,  578,  578,  578,  578,  578,  578,  578,  578,
-      578,  578,  578,  578,  578,  578,  578,   33,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557
 
-      606,  606
     } ;
 
-static yyconst flex_int16_t yy_chk[4503] =
+static yyconst flex_int16_t yy_chk[4399] =
     {   0,
         0,    0,    1,    1,    2,    2,    5,    5,    6,    6,
-        9,   39,   10,    5,   39,    6,   11,   11,  576,    9,
+        9,   39,   10,    5,   39,    6,   11,   11,    0,    9,
         9,   10,   10,   11,   12,   12,   13,   13,   14,   14,
-      591,   12,  591,    1,  145,    2,   15,   15,   97,   16,
-       16,   19,   19,   97,   19,  574,   15,  564,   13,   16,
-       14,   15,  554,   19,   16,   56,   56,  550,    5,  548,
+      542,   12,  542,    1,  145,    2,   15,   15,   97,   16,
+       16,   19,   19,   97,   19,  522,   15,  500,   13,   16,
+       14,   15,  499,   19,   16,   56,   56,  491,    5,  490,
         6,    1,  145,    2,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
@@ -1193,17 +1163,17 @@ static yyconst flex_int16_t yy_chk[4503] =
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    7,   20,
-       20,  532,   20,   50,   50,   50,   50,    7,    7,    7,
-        7,   20,   21,   27,   27,   21,  531,   27,    7,    7,
-        7,    7,    7,    7,   22,  517,   37,   22,   21,   21,
-       21,   21,   25,   25,   82,   82,  512,   26,   26,   25,
-       22,   22,   22,   22,   26,  511,    7,    7,    7,    7,
+       20,  479,   20,   50,   50,   50,   50,    7,    7,    7,
+        7,   20,   21,   27,   27,   21,  476,   27,    7,    7,
+        7,    7,    7,    7,   22,  471,   37,   22,   21,   21,
+       21,   21,   25,   25,   82,   82,  470,   26,   26,   25,
+       22,   22,   22,   22,   26,  465,    7,    7,    7,    7,
 
         7,    7,    8,   37,   53,   68,   53,   53,   53,   53,
        60,    8,    8,    8,    8,   27,   62,   64,   69,   87,
        87,   53,    8,    8,    8,    8,    8,    8,   54,   54,
-       54,   54,   54,   68,   25,   54,  101,   60,  500,   26,
-      105,  105,  101,   62,   64,   69,  112,  112,  497,   53,
+       54,   54,   54,   68,   25,   54,  101,   60,  424,   26,
+      105,  105,  101,   62,   64,   69,  112,  112,  423,   53,
         8,    8,    8,    8,    8,    8,   17,   17,   17,   17,
        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
@@ -1215,18 +1185,18 @@ static yyconst flex_int16_t yy_chk[4503] =
        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
        17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
        23,   23,   28,   28,   23,   23,   28,   23,   23,   23,
-       29,   29,   30,   30,   31,   31,  492,   29,   31,   30,
+       29,   29,   30,   30,   31,   31,  413,   29,   31,   30,
        65,   23,   23,  128,   23,   32,   32,  134,   65,   32,
-       38,  139,  133,   44,  491,   38,   44,   42,   38,  473,
+       38,  139,  133,   44,  392,   38,   44,   42,   38,  389,
        44,  138,   42,   67,  143,   42,  147,   67,   65,  147,
-      128,   23,   23,   23,   28,  152,   65,  447,   38,  133,
+      128,   23,   23,   23,   28,  152,   65,  387,   38,  133,
 
       153,   44,   29,   44,   30,   42,   31,   44,  138,  213,
        67,  143,  134,  174,   67,  213,  160,   32,   23,  139,
        23,   24,   24,  152,   38,   24,   24,  153,   24,   24,
        24,   42,   52,   72,   52,   52,   52,   52,   72,  176,
       174,   72,   24,   24,  160,   24,  202,  202,  172,   52,
-      424,   38,   52,   38,  106,  106,  106,  106,   42,  177,
+      386,   38,   52,   38,  106,  106,  106,  106,   42,  177,
        42,   72,   74,   75,   74,   74,  176,   52,   75,  175,
        77,   75,   24,   24,   24,   77,  172,   52,   77,  214,
        52,  107,  107,  107,  107,  214,  177,   72,   74,  137,
@@ -1237,31 +1207,31 @@ static yyconst flex_int16_t yy_chk[4503] =
        74,  182,  235,   74,   77,  151,  151,  151,  151,  227,
       227,   74,  250,  146,  179,  180,  242,  151,  181,  322,
       243,  137,  322,  190,   75,  191,   75,  192,  249,  235,
-      154,   77,  154,   77,  142,  154,  239,  154,  414,  146,
+      154,   77,  154,   77,  142,  154,  239,  154,  377,  146,
       155,  155,  155,  155,  157,  151,  157,  157,  157,  157,
-      162,  162,  162,  162,  513,  155,  392,  154,  256,  154,
+      162,  162,  162,  162,  492,  155,  376,  154,  256,  154,
       250,  242,  154,  239,  154,  243,  146,  158,  146,  158,
-      158,  158,  158,  159,  389,  159,  387,  187,  159,  159,
+      158,  158,  158,  159,  371,  159,  364,  187,  159,  159,
 
-      159,  159,  187,  155,  158,  187,  256,  188,  386,  188,
-      188,  189,  244,  189,  189,  193,  194,  408,  408,  513,
+      159,  159,  187,  155,  158,  187,  256,  188,  352,  188,
+      188,  189,  244,  189,  189,  193,  194,  407,  407,  492,
       193,  194,  207,  193,  194,  187,  220,  220,  220,  220,
-      207,  377,  158,  188,  261,  189,  251,  188,  336,  244,
-      188,  336,  376,  193,  194,  221,  221,  221,  221,  188,
-      260,  187,  264,  371,  207,  207,  222,  222,  222,  222,
+      207,  351,  158,  188,  261,  189,  251,  188,  336,  244,
+      188,  336,  349,  193,  194,  221,  221,  221,  221,  188,
+      260,  187,  264,  348,  207,  207,  222,  222,  222,  222,
       247,  247,  261,  251,  278,  188,  265,  247,  188,  193,
       194,  254,  254,  266,  267,  254,  188,  260,  187,  264,
       187,  207,  207,  258,  258,  258,  258,  259,  259,  259,
       259,  263,  278,  265,  263,  273,  193,  194,  193,  194,
 
-      266,  267,  268,  277,  268,  283,  364,  268,  268,  268,
+      266,  267,  268,  277,  268,  283,  341,  268,  268,  268,
       268,  269,  247,  269,  269,  269,  269,  271,  271,  271,
-      271,  284,  273,  254,  270,  352,  270,  270,  270,  270,
+      271,  284,  273,  254,  270,  340,  270,  270,  270,  270,
       277,  293,  263,  283,  263,  272,  272,  272,  272,  263,
       324,  270,  289,  290,  302,  290,  290,  289,  284,  291,
       289,  291,  291,  292,  325,  292,  292,  328,  293,  263,
       329,  263,  310,  310,  310,  310,  263,  290,  324,  270,
-      289,  302,  351,  291,  323,  323,  323,  323,  330,  330,
+      289,  302,  327,  291,  323,  323,  323,  323,  330,  330,
       330,  330,  325,  292,  339,  328,  335,  337,  329,  331,
       331,  331,  331,  338,  343,  332,  289,  332,  332,  332,
 
@@ -1270,409 +1240,397 @@ static yyconst flex_int16_t yy_chk[4503] =
       338,  358,  343,  289,  358,  289,  359,  359,  359,  359,
       360,  361,  342,  362,  388,  363,  369,  344,  363,  370,
       359,  373,  347,  365,  365,  365,  365,  366,  366,  366,
-      366,  383,  390,  393,  394,  349,  396,  360,  403,  361,
-      342,  362,  388,  369,  407,  410,  370,  358,  373,  348,
-      404,  404,  404,  404,  430,  430,  409,  341,  383,  409,
-      390,  393,  394,  396,  404,  403,  340,  404,  404,  404,
-      404,  415,  407,  410,  358,  384,  384,  384,  384,  427,
-
-      406,  411,  405,  405,  405,  405,  406,  413,  455,  384,
-      428,  327,  384,  384,  384,  384,  405,  326,  415,  405,
-      405,  405,  405,  409,  429,  435,  427,  406,  319,  411,
-      431,  431,  436,  406,  316,  413,  455,  428,  384,  438,
-      384,  422,  422,  422,  422,  432,  422,  308,  432,  307,
-      409,  429,  435,  450,  450,  422,  437,  306,  437,  436,
-      440,  437,  437,  437,  437,  384,  438,  384,  391,  391,
-      434,  456,  391,  391,  391,  391,  391,  391,  391,  391,
-      391,  391,  391,  425,  425,  425,  425,  440,  432,  458,
-      391,  391,  391,  391,  391,  391,  391,  425,  303,  456,
-
-      425,  425,  425,  425,  474,  474,  434,  459,  426,  426,
-      426,  426,  460,  287,  434,  432,  458,  462,  463,  285,
-      464,  391,  426,  391,  281,  426,  426,  426,  426,  448,
-      448,  448,  448,  434,  448,  459,  478,  478,  475,  475,
-      460,  434,  475,  448,  466,  462,  463,  464,  391,  391,
-      391,  391,  399,  399,  399,  399,  451,  451,  451,  451,
-      494,  467,  257,  399,  399,  399,  399,  399,  399,  253,
-      451,  246,  466,  451,  451,  451,  451,  476,  476,  480,
-      480,  484,  484,  486,  486,  238,  495,  494,  399,  467,
-      476,  399,  399,  399,  399,  399,  399,  400,  400,  400,
-
-      400,  452,  452,  452,  452,  519,  519,  496,  400,  400,
-      400,  400,  400,  400,  495,  452,  528,  528,  452,  452,
-      452,  452,  465,  498,  498,  498,  498,  536,  465,  503,
-      536,  433,  502,  400,  433,  496,  400,  400,  400,  400,
-      400,  400,  401,  454,  454,  454,  454,  234,  504,  505,
-      465,  401,  401,  401,  401,  465,  503,  454,  468,  232,
-      502,  468,  401,  401,  401,  401,  401,  401,  552,  552,
-      433,  231,  506,  535,  433,  504,  505,  230,  433,  516,
-      516,  518,  518,  516,  507,  518,  468,  401,  229,  468,
-      401,  401,  401,  401,  401,  401,  402,  433,  439,  506,
-
-      535,  433,  439,  508,  509,  433,  537,  439,  402,  402,
-      402,  402,  507,  439,  489,  489,  489,  489,  439,  402,
-      402,  402,  402,  402,  402,  226,  439,  510,  489,  539,
-      439,  508,  509,  537,  439,  520,  520,  524,  524,  520,
-      439,  524,  556,  556,  402,  439,  534,  402,  402,  402,
-      402,  402,  402,  412,  412,  510,  539,  412,  412,  412,
-      412,  412,  412,  412,  412,  412,  412,  412,  453,  453,
-      453,  453,  557,  557,  534,  412,  412,  412,  412,  412,
-      412,  412,  453,  521,  521,  453,  453,  453,  453,  540,
-      525,  525,  461,  461,  461,  461,  521,  541,  542,  479,
-
-      479,  479,  479,  525,  479,  543,  412,  225,  412,  461,
-      461,  461,  461,  479,  544,  545,  540,  485,  485,  485,
-      485,  219,  485,  563,  541,  542,  563,  481,  481,  481,
-      481,  485,  543,  412,  412,  412,  412,  417,  417,  417,
-      417,  481,  544,  545,  481,  481,  481,  481,  417,  417,
-      417,  417,  417,  417,  493,  493,  493,  493,  515,  515,
-      515,  515,  549,  549,  558,  558,  549,  217,  493,  216,
-      551,  551,  515,  417,  551,  566,  417,  417,  417,  417,
-      417,  417,  418,  418,  418,  418,  482,  482,  482,  482,
-      559,  559,  561,  418,  418,  418,  418,  418,  418,  209,
-
-      482,  562,  566,  482,  482,  482,  482,  553,  553,  555,
-      555,  553,  208,  555,  483,  483,  483,  483,  418,  568,
-      561,  418,  418,  418,  418,  418,  418,  419,  483,  562,
-      200,  483,  483,  483,  483,  567,  419,  419,  419,  419,
-      487,  487,  487,  487,  580,  571,  568,  419,  419,  419,
-      419,  419,  419,  185,  487,  578,  578,  487,  487,  487,
-      487,  579,  579,  567,  581,  590,  596,  150,  590,  596,
-      583,  580,  419,  571,  592,  419,  419,  419,  419,  419,
-      419,  420,  420,  420,  420,  488,  488,  488,  488,  585,
-      593,  581,  420,  420,  420,  420,  420,  420,  583,  488,
-
-      149,  592,  488,  488,  488,  488,  597,  598,  599,  597,
-      598,  599,  141,  501,  501,  501,  501,  585,  593,  136,
-      420,  420,  420,  420,  420,  420,  442,  442,  442,  442,
-      501,  501,  501,  501,  131,  129,  126,  442,  442,  442,
-      442,  442,  442,  523,  523,  523,  523,  124,  117,  113,
-      529,  529,  529,  529,  600,  601,  602,  523,  601,  602,
-      523,  523,  523,  523,  529,  442,  442,  442,  442,  442,
-      442,  443,  443,  443,  443,  527,  527,  527,  527,  111,
-      110,  600,  443,  443,  443,  443,  443,  443,  603,  527,
-      103,  603,  527,  527,  527,  527,  604,  605,  627,  604,
-
-      605,   98,   96,  627,  627,   94,  533,  533,  533,  533,
-      443,  443,  443,  443,  443,  443,  444,  444,  444,  444,
-      533,  546,  546,  546,  546,   93,   92,  444,  444,  444,
-      444,  444,  444,   89,   81,  546,  547,  547,  547,  547,
-      560,  560,  560,  560,   80,   71,  648,   70,   66,   61,
-      547,  648,  648,   59,  560,  444,  444,  444,  444,  444,
-      444,  445,  445,  445,  445,  572,  572,  572,  572,   58,
-       57,   51,  445,  445,  445,  445,  445,  445,   49,  572,
-      573,  573,  573,  573,  575,  575,  575,  575,   43,  582,
-      659,   41,   36,   33,  573,  659,  659,    0,  575,  582,
-
-      445,  445,  445,  445,  445,  445,  469,  469,  469,  469,
-      587,  587,  587,  587,    0,    0,  582,  469,  469,  469,
-      469,  469,  469,    0,  587,    0,  582,  588,  588,  588,
-      588,  676,    0,  679,    0,    0,  676,  676,  679,  679,
-        0,  588,    0,    0,    0,  469,  469,  469,  469,  469,
-      469,  470,  470,  470,  470,  682,    0,    0,    0,    0,
-      682,  682,  470,  470,  470,  470,  470,  470,  685,    0,
-      687,    0,  705,  685,  685,  687,  687,  705,  705,  706,
-        0,  708,    0,  710,  706,  706,  708,  708,  710,  710,
-      470,  470,  470,  470,  470,  470,  471,  471,  471,  471,
-
-      712,    0,    0,    0,    0,  712,  712,  471,  471,  471,
-      471,  471,  471,  716,    0,  717,    0,  718,  716,  716,
-      717,  717,  718,  718,  719,    0,  721,    0,  722,  719,
-      719,  721,  721,  722,  722,  471,  471,  471,  471,  471,
-      471,  472,  472,  472,  472,  723,    0,    0,    0,    0,
-      723,  723,  472,  472,  472,  472,  472,  472,  724,    0,
-        0,    0,    0,  724,  724,    0,    0,    0,    0,    0,
+      366,  383,  390,  393,  394,  326,  396,  360,  403,  361,
+      342,  362,  388,  369,  406,  319,  370,  358,  373,  316,
+      404,  404,  404,  404,  408,  409,  410,  408,  383,  412,
+      390,  393,  394,  396,  404,  403,  308,  404,  404,  404,
+      404,  414,  406,  405,  358,  384,  384,  384,  384,  405,
+
+      307,  425,  426,  409,  410,  427,  433,  412,  434,  384,
+      428,  428,  384,  384,  384,  384,  429,  429,  414,  436,
+      405,  408,  421,  421,  421,  421,  405,  421,  425,  426,
+      438,  447,  427,  433,  306,  434,  421,  450,  384,  456,
+      384,  430,  445,  445,  430,  435,  436,  435,  408,  303,
+      435,  435,  435,  435,  287,  448,  285,  438,  431,  447,
+      504,  431,  432,  504,  450,  384,  456,  384,  391,  391,
+      466,  466,  391,  391,  391,  391,  391,  391,  391,  391,
+      391,  391,  391,  448,  430,  451,  446,  446,  446,  446,
+      391,  391,  391,  391,  391,  391,  391,  431,  432,  437,
+
+      446,  431,  452,  437,  281,  431,  432,  473,  437,  454,
+      455,  430,  458,  451,  437,  467,  467,  496,  496,  437,
+      257,  391,  253,  391,  431,  432,  246,  437,  431,  459,
+      452,  437,  431,  432,  473,  437,  521,  454,  455,  521,
+      458,  437,  453,  453,  453,  453,  437,  474,  391,  391,
+      391,  391,  399,  399,  399,  399,  475,  459,  481,  453,
+      453,  453,  453,  399,  399,  399,  399,  399,  399,  468,
+      468,  468,  468,  457,  460,  474,  482,  460,  238,  457,
+      483,  515,  515,  468,  475,  234,  481,  232,  399,  516,
+      516,  399,  399,  399,  399,  399,  399,  400,  400,  400,
+
+      400,  457,  460,  482,  231,  460,  457,  483,  400,  400,
+      400,  400,  400,  400,  472,  472,  472,  472,  477,  477,
+      477,  477,  230,  484,  517,  517,  229,  486,  472,  480,
+      480,  480,  480,  400,  485,  226,  400,  400,  400,  400,
+      400,  400,  401,  487,  488,  489,  480,  480,  480,  480,
+      484,  401,  401,  401,  401,  486,  494,  494,  494,  494,
+      225,  485,  401,  401,  401,  401,  401,  401,  531,  531,
+      494,  487,  488,  489,  497,  497,  497,  497,  502,  219,
+      503,  532,  532,  501,  501,  501,  501,  401,  497,  505,
+      401,  401,  401,  401,  401,  401,  402,  501,  507,  508,
+
+      509,  510,  511,  512,  513,  519,  502,  503,  402,  402,
+      402,  402,  520,  217,  524,  525,  505,  216,  526,  402,
+      402,  402,  402,  402,  402,  507,  508,  509,  510,  511,
+      209,  512,  513,  519,  541,  547,  548,  541,  547,  548,
+      520,  524,  208,  525,  402,  526,  529,  402,  402,  402,
+      402,  402,  402,  411,  411,  200,  185,  411,  411,  411,
+      411,  411,  411,  411,  411,  411,  411,  411,  514,  514,
+      514,  514,  533,  534,  529,  411,  411,  411,  411,  411,
+      411,  411,  514,  518,  518,  518,  518,  543,  535,  536,
+      538,  544,  549,  550,  551,  549,  550,  518,  535,  533,
+
+      534,  552,  553,  150,  552,  553,  411,  554,  411,  555,
+      554,  149,  555,  556,  543,  535,  556,  536,  538,  544,
+      141,  551,  578,  136,  599,  535,  610,  578,  578,  599,
+      599,  610,  610,  411,  411,  411,  411,  416,  416,  416,
+      416,  627,  131,  129,  126,  124,  627,  627,  416,  416,
+      416,  416,  416,  416,  630,  117,  633,  113,  636,  630,
+      630,  633,  633,  636,  636,  638,  111,  110,  103,  656,
+      638,  638,   98,  416,  656,  656,  416,  416,  416,  416,
+      416,  416,  417,  417,  417,  417,  657,   96,   94,   93,
+       92,  657,  657,  417,  417,  417,  417,  417,  417,  659,
+
+       89,  661,   81,  663,  659,  659,  661,  661,  663,  663,
+      667,   80,   71,   70,  668,  667,  667,   66,  417,  668,
+      668,  417,  417,  417,  417,  417,  417,  418,  669,   61,
+       59,   58,   57,  669,  669,  670,  418,  418,  418,  418,
+      670,  670,   51,   49,   43,   41,   36,  418,  418,  418,
+      418,  418,  418,  672,   33,  673,    0,  674,  672,  672,
+      673,  673,  674,  674,  675,    0,    0,    0,    0,  675,
+      675,    0,  418,    0,    0,  418,  418,  418,  418,  418,
+      418,  419,  419,  419,  419,    0,    0,    0,    0,    0,
+        0,    0,  419,  419,  419,  419,  419,  419,    0,    0,
+
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+      419,  419,  419,  419,  419,  419,  440,  440,  440,  440,
+        0,    0,    0,    0,    0,    0,    0,  440,  440,  440,
+      440,  440,  440,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  440,  440,  440,  440,  440,
+      440,  441,  441,  441,  441,    0,    0,    0,    0,    0,
+        0,    0,  441,  441,  441,  441,  441,  441,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-      472,  472,  472,  472,  472,  472,  514,  514,  514,  514,
-        0,    0,    0,    0,    0,    0,    0,  514,  514,  514,
 
-      514,  514,  514,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,  514,  514,  514,  514,  514,
-      514,  607,  607,  607,  607,  607,  607,  607,  607,  607,
-      607,  607,  607,  607,  607,  607,  607,  607,  607,  607,
-      607,  607,  607,  607,  607,  607,  607,  608,  608,  608,
-      608,  608,  608,  608,  608,  608,  608,  608,  608,  608,
-      608,  608,  608,  608,  608,  608,  608,  608,  608,  608,
-      608,  608,  608,  609,  609,  609,  609,  609,  609,  609,
-      609,  609,  609,  609,  609,  609,  609,  609,  609,  609,
+      441,  441,  441,  441,  441,  441,  442,  442,  442,  442,
+        0,    0,    0,    0,    0,    0,    0,  442,  442,  442,
+      442,  442,  442,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  442,  442,  442,  442,  442,
+      442,  443,  443,  443,  443,    0,    0,    0,    0,    0,
+        0,    0,  443,  443,  443,  443,  443,  443,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
-      609,  609,  609,  609,  609,  609,  609,  609,  609,  610,
-      610,  610,  610,  610,  610,  610,  610,  610,  610,  610,
-      610,  610,  610,  610,  610,  610,  610,  610,  610,  610,
-      610,  610,  610,  610,  610,  611,  611,  611,  611,  611,
-      611,  611,  611,  611,  611,  611,  611,  611,  611,  611,
+      443,  443,  443,  443,  443,  443,  461,  461,  461,  461,
+        0,    0,    0,    0,    0,    0,    0,  461,  461,  461,
+      461,  461,  461,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  461,  461,  461,  461,  461,
+      461,  462,  462,  462,  462,    0,    0,    0,    0,    0,
+        0,    0,  462,  462,  462,  462,  462,  462,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+      462,  462,  462,  462,  462,  462,  463,  463,  463,  463,
+
+        0,    0,    0,    0,    0,    0,    0,  463,  463,  463,
+      463,  463,  463,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  463,  463,  463,  463,  463,
+      463,  464,  464,  464,  464,    0,    0,    0,    0,    0,
+        0,    0,  464,  464,  464,  464,  464,  464,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+      464,  464,  464,  464,  464,  464,  493,  493,  493,  493,
+        0,    0,    0,    0,    0,    0,    0,  493,  493,  493,
+
+      493,  493,  493,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  493,  493,  493,  493,  493,
+      493,  558,  558,  558,  558,  558,  558,  558,  558,  558,
+      558,  558,  558,  558,  558,  558,  558,  558,  558,  558,
+      558,  558,  558,  558,  558,  558,  558,  559,  559,  559,
+      559,  559,  559,  559,  559,  559,  559,  559,  559,  559,
+      559,  559,  559,  559,  559,  559,  559,  559,  559,  559,
+      559,  559,  559,  560,  560,  560,  560,  560,  560,  560,
+      560,  560,  560,  560,  560,  560,  560,  560,  560,  560,
+
+      560,  560,  560,  560,  560,  560,  560,  560,  560,  561,
+      561,  561,  561,  561,  561,  561,  561,  561,  561,  561,
+      561,  561,  561,  561,  561,  561,  561,  561,  561,  561,
+      561,  561,  561,  561,  561,  562,  562,  562,  562,  562,
+      562,  562,  562,  562,  562,  562,  562,  562,  562,  562,
+      562,  562,  562,  562,  562,  562,  562,  562,  562,  562,
+      562,  563,  563,  563,  563,  563,  563,  563,  563,  563,
+      563,  563,  563,  563,  563,  563,  563,  563,  563,  563,
+      563,  563,  563,  563,  563,  563,  563,  564,  564,  564,
+      564,  564,  564,  564,  564,  564,  564,  564,  564,  564,
+
+      564,  564,  564,  564,  564,  564,  564,  564,  564,  564,
+      564,  564,  564,  565,  565,  565,  565,  565,  565,  565,
+      565,  565,  565,  565,  565,  565,  565,  565,  565,  565,
+      565,  565,  565,  565,  565,  565,  565,  565,  565,  566,
+      566,  566,  566,  566,  566,  566,  566,  566,  566,  566,
+      566,  566,  566,  566,  566,  566,  566,  566,  566,  566,
+      566,  566,  566,  566,  566,  567,  567,  567,  567,  567,
+      567,  567,  567,  567,  567,  567,  567,  567,  567,  567,
+      567,  567,  567,  567,  567,  567,  567,  567,  567,  567,
+      567,  568,  568,  568,  568,  568,  568,  568,  568,  568,
+
+      568,  568,  568,  568,  568,  568,  568,  568,  568,  568,
+      568,  568,  568,  568,  568,  568,  568,  569,  569,  569,
+      569,  569,  569,  569,  569,  569,  569,  569,  569,  569,
+      569,  569,  569,  569,  569,  569,  569,  569,  569,  569,
+      569,  569,  569,  570,  570,  570,  570,  570,  570,  570,
+      570,  570,  570,  570,  570,  570,  570,  570,  570,  570,
+      570,  570,  570,  570,  570,  570,  570,  570,  570,  571,
+      571,    0,  571,  571,  571,  571,  571,  571,  571,  571,
+      571,  571,  571,  571,  571,  571,  571,  571,  571,  571,
+      571,  571,  571,  571,  571,  572,  572,    0,  572,    0,
+
+      572,  572,  572,  572,  573,    0,    0,    0,  573,  573,
+      573,  573,  573,    0,    0,  573,    0,  573,  574,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+      574,  574,  574,  574,  575,    0,    0,    0,  575,    0,
+        0,  575,    0,    0,    0,    0,    0,    0,    0,    0,
+      575,  575,  575,  575,  575,  575,    0,  575,    0,  575,
+      576,  576,    0,    0,  576,  576,  576,  576,    0,  576,
+      576,  576,  576,  576,  576,  576,  576,  576,  576,  576,
+      576,    0,  576,  576,  576,  576,  577,  577,  577,  577,
+      577,  577,  577,  577,  577,  577,  577,  577,  577,  577,
+
+      577,  577,  577,  577,  577,  577,  577,  577,  577,  577,
+      577,  577,  579,  579,    0,    0,  579,  579,  579,  579,
+        0,  579,  579,  579,  579,  579,  579,  579,  579,  579,
+      579,  579,  579,  579,  579,  579,  579,  579,  580,  580,
+        0,    0,  580,  580,  580,  580,  580,  580,  580,  580,
+      580,  580,    0,  580,  580,  580,  580,  580,  580,  580,
+      580,  580,  580,  580,  581,  581,    0,    0,  581,  581,
+      581,  581,  581,  581,  581,    0,  581,  581,  581,  581,
+      581,  581,  581,  581,  581,  581,  581,  581,  581,  581,
+      582,    0,  582,  582,    0,    0,    0,  582,  582,  582,
+
+      582,    0,    0,  582,  583,  583,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,  583,  583,  583,
+      583,  584,  584,    0,    0,  584,    0,    0,  584,    0,
+      584,  584,  584,  584,  584,    0,  584,  584,  584,  584,
+      584,  584,    0,    0,  584,    0,  584,  585,  585,    0,
+      585,  585,  585,  585,  585,  585,  585,  585,  585,  585,
+      585,  585,  585,  585,  585,  585,  585,  585,    0,  585,
+      585,  585,  585,  586,  586,  586,  586,  586,  586,  586,
+      586,  586,  586,  586,  586,  586,  586,  586,  586,  586,
+      586,  586,  586,  586,  586,  586,  586,  586,  586,  587,
+
+      587,    0,  587,  587,  587,  587,  587,  587,  587,  587,
+      587,  587,  587,  587,  587,  587,  587,  587,  587,  587,
+        0,  587,  587,  587,  587,  588,    0,  588,  588,  588,
+      588,  588,  588,  588,  588,    0,  588,  588,  588,  588,
+      588,  588,    0,  588,  588,    0,  588,  589,  589,    0,
+        0,  589,  589,  589,  589,    0,  589,  589,  589,  589,
+      589,  589,  589,  589,  589,  589,  589,  589,  589,  589,
+      589,  589,  589,  590,    0,    0,  590,    0,    0,    0,
+        0,    0,    0,    0,    0,  590,    0,    0,  590,  590,
+      591,  591,    0,    0,  591,    0,  591,  591,  591,  591,
+
+      591,  591,  591,  591,  591,  591,  591,  591,  591,  591,
+      591,  591,  591,  591,  591,  591,  592,    0,    0,  592,
+        0,    0,    0,    0,    0,    0,    0,    0,  592,    0,
+        0,  592,  592,  593,  593,    0,    0,  593,  593,  593,
+      593,  593,  593,  593,  593,  593,  593,  593,  593,  593,
+      593,  593,  593,  593,  593,  593,  593,  593,  593,  594,
+        0,    0,  594,    0,    0,    0,    0,    0,    0,    0,
+        0,  594,    0,    0,  594,  594,  595,  595,    0,    0,
+      595,  595,  595,  595,  595,  595,  595,  595,  595,  595,
+      595,  595,  595,  595,  595,  595,  595,  595,  595,  595,
+
+      595,  595,  596,    0,    0,  596,    0,    0,    0,    0,
+        0,    0,    0,    0,  596,    0,    0,  596,  596,  597,
+      597,    0,  597,  597,  597,  597,  597,  597,  597,  597,
+      597,  597,  597,  597,  597,  597,  597,  597,  597,  597,
+      597,  597,  597,  597,  597,  598,  598,    0,    0,  598,
+      598,  598,  598,  598,  598,  598,  598,  598,  598,  598,
+      598,  598,  598,  598,  598,  598,  598,  598,  598,  598,
+      598,  600,    0,    0,    0,    0,  600,  600,  600,  600,
+        0,    0,  600,  601,    0,    0,    0,  601,  601,  601,
+      601,  601,    0,    0,  601,    0,  601,  602,  602,  602,
+
+      602,  603,    0,    0,    0,    0,    0,  603,  603,  603,
+      603,    0,    0,    0,  603,  603,  603,  603,    0,    0,
+      603,  604,  604,    0,    0,    0,  604,  604,  604,  604,
+      604,    0,  604,    0,  604,  605,  605,    0,    0,  605,
+      605,  605,  605,    0,  605,  605,  605,  605,  605,  605,
+      605,  605,  605,  605,  605,  605,    0,  605,  605,  605,
+      605,  606,  606,    0,    0,  606,  606,  606,  606,    0,
+      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
+      606,  606,    0,  606,  606,  606,  606,  607,  607,    0,
+        0,  607,  607,  607,  607,    0,  607,  607,  607,  607,
+
+      607,  607,  607,  607,  607,  607,  607,  607,    0,  607,
+      607,  607,  607,  608,  608,    0,    0,  608,  608,  608,
+      608,    0,  608,  608,  608,  608,  608,  608,  608,  608,
+      608,  608,  608,  608,    0,  608,  608,  608,  608,  609,
+      609,  609,    0,  609,  609,  609,  609,    0,  609,  609,
+      609,  609,  609,  609,  609,  609,  609,  609,  609,  609,
+        0,  609,  609,  609,  609,  611,  611,    0,    0,  611,
+      611,  611,  611,    0,  611,  611,  611,  611,  611,  611,
       611,  611,  611,  611,  611,  611,  611,  611,  611,  611,
-      611,  612,  612,  612,  612,  612,  612,  612,  612,  612,
-      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
-      612,  612,  612,  612,  612,  612,  612,  613,  613,  613,
-      613,  613,  613,  613,  613,  613,  613,  613,  613,  613,
+      611,  612,  612,    0,    0,  612,  612,  612,  612,    0,
 
-      613,  613,  613,  613,  613,  613,  613,  613,  613,  613,
-      613,  613,  613,  614,  614,  614,  614,  614,  614,  614,
-      614,  614,  614,  614,  614,  614,  614,  614,  614,  614,
+      612,  612,  612,  612,  612,  612,  612,  612,  612,  612,
+      612,  612,  612,  612,  612,  612,  612,  613,  613,    0,
+        0,  613,  613,  613,  613,  613,  613,  613,  613,  613,
+      613,    0,  613,  613,  613,  613,  613,  613,  613,  613,
+      613,  613,  613,  614,  614,    0,    0,  614,  614,  614,
+      614,  614,  614,  614,    0,  614,  614,  614,  614,  614,
       614,  614,  614,  614,  614,  614,  614,  614,  614,  615,
-      615,  615,  615,  615,  615,  615,  615,  615,  615,  615,
-      615,  615,  615,  615,  615,  615,  615,  615,  615,  615,
-      615,  615,  615,  615,  615,  616,  616,  616,  616,  616,
-      616,  616,  616,  616,  616,  616,  616,  616,  616,  616,
-      616,  616,  616,  616,  616,  616,  616,  616,  616,  616,
-      616,  617,  617,  617,  617,  617,  617,  617,  617,  617,
-
-      617,  617,  617,  617,  617,  617,  617,  617,  617,  617,
-      617,  617,  617,  617,  617,  617,  617,  618,  618,  618,
-      618,  618,  618,  618,  618,  618,  618,  618,  618,  618,
-      618,  618,  618,  618,  618,  618,  618,  618,  618,  618,
-      618,  618,  618,  619,  619,  619,  619,  619,  619,  619,
-      619,  619,  619,  619,  619,  619,  619,  619,  619,  619,
-      619,  619,  619,  619,  619,  619,  619,  619,  619,  620,
-      620,    0,  620,  620,  620,  620,  620,  620,  620,  620,
-      620,  620,  620,  620,  620,  620,  620,  620,  620,  620,
-      620,  620,  620,  620,  620,  621,  621,    0,  621,    0,
-
-      621,  621,  621,  621,  622,    0,    0,    0,  622,  622,
-      622,  622,  622,    0,    0,  622,    0,  622,  623,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-      623,  623,  623,  623,  624,    0,    0,    0,  624,    0,
-        0,  624,    0,    0,    0,    0,    0,    0,    0,    0,
-      624,  624,  624,  624,  624,  624,    0,  624,    0,  624,
-      625,  625,    0,    0,  625,  625,  625,  625,    0,  625,
+        0,  615,  615,    0,    0,    0,  615,  615,  615,  615,
+        0,    0,  615,  616,  616,  616,  616,    0,  616,  616,
+      616,  616,  616,    0,  616,  616,  616,  616,  616,  616,
+
+      616,  616,  616,    0,  616,  617,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,  617,  617,  617,
+      617,  618,  618,  618,  618,  619,  619,  619,  619,    0,
+        0,    0,  619,  619,  619,  619,    0,  619,  619,  620,
+      620,    0,    0,  620,    0,    0,  620,    0,  620,  620,
+      620,  620,  620,    0,  620,  620,  620,  620,  620,  620,
+        0,    0,  620,    0,  620,  621,  621,    0,  621,  621,
+      621,  621,  621,  621,  621,  621,  621,  621,  621,  621,
+      621,  621,  621,  621,  621,  621,    0,  621,  621,  621,
+      621,  622,  622,  622,  622,  622,  622,  622,  622,  622,
+
+      622,  622,  622,  622,  622,  622,  622,  622,  622,  622,
+      622,  622,  622,  622,  622,  622,  622,  623,  623,    0,
+      623,  623,  623,  623,  623,  623,  623,  623,  623,  623,
+      623,  623,  623,  623,  623,  623,  623,  623,    0,  623,
+      623,  623,  623,  624,    0,  624,  624,  624,  624,  624,
+      624,  624,  624,    0,  624,  624,  624,  624,  624,  624,
+        0,  624,  624,    0,  624,  625,  625,    0,    0,  625,
+      625,  625,  625,    0,  625,  625,  625,  625,  625,  625,
       625,  625,  625,  625,  625,  625,  625,  625,  625,  625,
-      625,    0,  625,  625,  625,  625,  626,  626,  626,  626,
-      626,  626,  626,  626,  626,  626,  626,  626,  626,  626,
-
-      626,  626,  626,  626,  626,  626,  626,  626,  626,  626,
-      626,  626,  628,  628,    0,    0,  628,  628,  628,  628,
-        0,  628,  628,  628,  628,  628,  628,  628,  628,  628,
-      628,  628,  628,  628,  628,  628,  628,  628,  629,  629,
-        0,    0,  629,  629,  629,  629,  629,  629,  629,  629,
-      629,  629,    0,  629,  629,  629,  629,  629,  629,  629,
-      629,  629,  629,  629,  630,  630,    0,    0,  630,  630,
-      630,  630,  630,  630,  630,    0,  630,  630,  630,  630,
-      630,  630,  630,  630,  630,  630,  630,  630,  630,  630,
-      631,    0,  631,  631,    0,    0,    0,  631,  631,  631,
-
-      631,    0,    0,  631,  632,  632,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,  632,  632,  632,
-      632,  633,  633,    0,    0,  633,    0,    0,  633,    0,
-      633,  633,  633,  633,  633,    0,  633,  633,  633,  633,
-      633,  633,    0,    0,  633,    0,  633,  634,  634,    0,
+      625,  626,    0,    0,  626,    0,    0,    0,    0,    0,
+
+        0,    0,    0,  626,    0,    0,  626,  626,  628,  628,
+        0,    0,  628,    0,  628,  628,  628,  628,  628,  628,
+      628,  628,  628,  628,  628,  628,  628,  628,  628,  628,
+      628,  628,  628,  628,  629,    0,    0,  629,    0,    0,
+        0,    0,    0,    0,    0,    0,  629,    0,    0,  629,
+      629,  631,  631,    0,    0,  631,  631,  631,  631,  631,
+      631,  631,  631,  631,  631,  631,  631,  631,  631,  631,
+      631,  631,  631,  631,  631,  631,  631,  632,    0,    0,
+      632,    0,    0,    0,    0,    0,    0,    0,    0,  632,
+        0,    0,  632,  632,  634,  634,    0,    0,  634,  634,
+
       634,  634,  634,  634,  634,  634,  634,  634,  634,  634,
-      634,  634,  634,  634,  634,  634,  634,  634,    0,  634,
-      634,  634,  634,  635,  635,  635,  635,  635,  635,  635,
-      635,  635,  635,  635,  635,  635,  635,  635,  635,  635,
-      635,  635,  635,  635,  635,  635,  635,  635,  635,  636,
-
-      636,    0,  636,  636,  636,  636,  636,  636,  636,  636,
-      636,  636,  636,  636,  636,  636,  636,  636,  636,  636,
-        0,  636,  636,  636,  636,  637,    0,  637,  637,  637,
-      637,  637,  637,  637,  637,    0,  637,  637,  637,  637,
-      637,  637,    0,  637,  637,    0,  637,  638,  638,    0,
-        0,  638,  638,  638,  638,    0,  638,  638,  638,  638,
-      638,  638,  638,  638,  638,  638,  638,  638,  638,  638,
-      638,  638,  638,  639,    0,    0,  639,    0,    0,    0,
-        0,    0,    0,    0,    0,  639,    0,    0,  639,  639,
-      640,  640,    0,    0,  640,    0,  640,  640,  640,  640,
-
-      640,  640,  640,  640,  640,  640,  640,  640,  640,  640,
-      640,  640,  640,  640,  640,  640,  641,    0,    0,  641,
-        0,    0,    0,    0,    0,    0,    0,    0,  641,    0,
-        0,  641,  641,  642,  642,    0,    0,  642,  642,  642,
-      642,  642,  642,  642,  642,  642,  642,  642,  642,  642,
-      642,  642,  642,  642,  642,  642,  642,  642,  642,  643,
-        0,    0,  643,    0,    0,    0,    0,    0,    0,    0,
-        0,  643,    0,    0,  643,  643,  644,  644,    0,    0,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-      644,  644,  644,  644,  644,  644,  644,  644,  644,  644,
-
-      644,  644,  645,    0,    0,  645,    0,    0,    0,    0,
-        0,    0,    0,    0,  645,    0,    0,  645,  645,  646,
-      646,    0,  646,  646,  646,  646,  646,  646,  646,  646,
-      646,  646,  646,  646,  646,  646,  646,  646,  646,  646,
-      646,  646,  646,  646,  646,  647,  647,    0,    0,  647,
-      647,  647,  647,  647,  647,  647,  647,  647,  647,  647,
+      634,  634,  634,  634,  634,  634,  634,  634,  634,  634,
+      635,    0,    0,  635,    0,    0,    0,    0,    0,    0,
+        0,    0,  635,    0,    0,  635,  635,  637,  637,    0,
+        0,  637,  637,  637,  637,  637,  637,  637,  637,  637,
+      637,  637,  637,  637,  637,  637,  637,  637,  637,  637,
+      637,  637,  637,  639,    0,    0,    0,    0,  639,  639,
+      639,  639,    0,    0,  639,  640,    0,    0,    0,  640,
+      640,  640,  640,  640,    0,    0,  640,    0,  640,  641,
+        0,    0,    0,    0,  641,  641,  641,  641,    0,    0,
+
+        0,  641,  641,  641,  641,    0,    0,  641,  642,    0,
+        0,    0,    0,    0,  642,  642,  642,  642,    0,    0,
+        0,  642,  642,  642,  642,    0,    0,  642,  643,  643,
+        0,    0,    0,  643,  643,  643,  643,  643,    0,  643,
+        0,  643,  644,  644,  644,  644,  644,  644,  644,  644,
+      644,  644,  644,  644,    0,  644,  644,  644,  644,    0,
+        0,    0,    0,  644,  644,    0,  644,  644,  645,  645,
+      645,  645,  645,  645,  645,  645,  645,  645,  645,  645,
+        0,  645,  645,  645,  645,    0,    0,    0,    0,  645,
+      645,    0,  645,  645,  646,  646,    0,    0,  646,  646,
+
+      646,  646,    0,  646,  646,  646,  646,  646,  646,  646,
+      646,  646,  646,  646,  646,    0,  646,  646,  646,  646,
+      647,  647,    0,    0,  647,  647,  647,  647,    0,  647,
       647,  647,  647,  647,  647,  647,  647,  647,  647,  647,
-      647,  649,    0,    0,    0,    0,  649,  649,  649,  649,
-        0,    0,  649,  650,    0,    0,    0,  650,  650,  650,
-      650,  650,    0,    0,  650,    0,  650,  651,  651,  651,
-
-      651,  652,    0,    0,    0,    0,    0,  652,  652,  652,
-      652,    0,    0,    0,  652,  652,  652,  652,    0,    0,
-      652,  653,  653,    0,    0,    0,  653,  653,  653,  653,
-      653,    0,  653,    0,  653,  654,  654,    0,    0,  654,
-      654,  654,  654,    0,  654,  654,  654,  654,  654,  654,
-      654,  654,  654,  654,  654,  654,    0,  654,  654,  654,
-      654,  655,  655,    0,    0,  655,  655,  655,  655,    0,
-      655,  655,  655,  655,  655,  655,  655,  655,  655,  655,
-      655,  655,    0,  655,  655,  655,  655,  656,  656,    0,
-        0,  656,  656,  656,  656,    0,  656,  656,  656,  656,
-
-      656,  656,  656,  656,  656,  656,  656,  656,    0,  656,
-      656,  656,  656,  657,  657,    0,    0,  657,  657,  657,
-      657,    0,  657,  657,  657,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,    0,  657,  657,  657,  657,  658,
-      658,  658,    0,  658,  658,  658,  658,    0,  658,  658,
+      647,    0,  647,  647,  647,  647,  648,  648,    0,    0,
+      648,  648,  648,  648,    0,  648,  648,  648,  648,  648,
+      648,  648,  648,  648,  648,  648,  648,    0,  648,  648,
+      648,  648,  649,  649,    0,    0,  649,  649,  649,  649,
+        0,  649,  649,  649,  649,  649,  649,  649,  649,  649,
+      649,  649,  649,    0,  649,  649,  649,  649,  650,  650,
+
+        0,    0,  650,  650,  650,  650,    0,  650,  650,  650,
+      650,  650,  650,  650,  650,  650,  650,  650,  650,  650,
+      650,  650,  650,  650,  651,  651,  651,  651,    0,  651,
+      651,  651,  651,  651,    0,  651,  651,  651,  651,  651,
+      651,  651,  651,  651,    0,  651,  652,  652,  652,  652,
+      653,  653,  653,  653,    0,    0,    0,  653,  653,  653,
+      653,    0,  653,  653,  654,    0,    0,    0,    0,  654,
+      654,  654,  654,    0,    0,    0,  654,  654,  654,  654,
+        0,    0,  654,  655,  655,  655,  655,    0,    0,    0,
+      655,  655,  655,  655,    0,  655,  655,  658,  658,    0,
+
+        0,  658,  658,  658,  658,    0,  658,  658,  658,  658,
       658,  658,  658,  658,  658,  658,  658,  658,  658,  658,
-        0,  658,  658,  658,  658,  660,  660,    0,    0,  660,
-      660,  660,  660,    0,  660,  660,  660,  660,  660,  660,
+      658,  658,  658,  660,  660,    0,    0,  660,    0,  660,
       660,  660,  660,  660,  660,  660,  660,  660,  660,  660,
-      660,  661,  661,    0,    0,  661,  661,  661,  661,    0,
-
-      661,  661,  661,  661,  661,  661,  661,  661,  661,  661,
-      661,  661,  661,  661,  661,  661,  661,  662,  662,    0,
-        0,  662,  662,  662,  662,  662,  662,  662,  662,  662,
-      662,    0,  662,  662,  662,  662,  662,  662,  662,  662,
-      662,  662,  662,  663,  663,    0,    0,  663,  663,  663,
-      663,  663,  663,  663,    0,  663,  663,  663,  663,  663,
-      663,  663,  663,  663,  663,  663,  663,  663,  663,  664,
-        0,  664,  664,    0,    0,    0,  664,  664,  664,  664,
-        0,    0,  664,  665,  665,  665,  665,    0,  665,  665,
-      665,  665,  665,    0,  665,  665,  665,  665,  665,  665,
-
-      665,  665,  665,    0,  665,  666,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,  666,  666,  666,
-      666,  667,  667,  667,  667,  668,  668,  668,  668,    0,
-        0,    0,  668,  668,  668,  668,    0,  668,  668,  669,
-      669,    0,    0,  669,    0,    0,  669,    0,  669,  669,
-      669,  669,  669,    0,  669,  669,  669,  669,  669,  669,
-        0,    0,  669,    0,  669,  670,  670,    0,  670,  670,
-      670,  670,  670,  670,  670,  670,  670,  670,  670,  670,
-      670,  670,  670,  670,  670,  670,    0,  670,  670,  670,
-      670,  671,  671,  671,  671,  671,  671,  671,  671,  671,
-
-      671,  671,  671,  671,  671,  671,  671,  671,  671,  671,
-      671,  671,  671,  671,  671,  671,  671,  672,  672,    0,
-      672,  672,  672,  672,  672,  672,  672,  672,  672,  672,
-      672,  672,  672,  672,  672,  672,  672,  672,    0,  672,
-      672,  672,  672,  673,    0,  673,  673,  673,  673,  673,
-      673,  673,  673,    0,  673,  673,  673,  673,  673,  673,
-        0,  673,  673,    0,  673,  674,  674,    0,    0,  674,
-      674,  674,  674,    0,  674,  674,  674,  674,  674,  674,
-      674,  674,  674,  674,  674,  674,  674,  674,  674,  674,
-      674,  675,    0,    0,  675,    0,    0,    0,    0,    0,
-
-        0,    0,    0,  675,    0,    0,  675,  675,  677,  677,
-        0,    0,  677,    0,  677,  677,  677,  677,  677,  677,
+      660,  660,  660,  660,  660,  660,  660,  660,  660,  662,
+      662,    0,    0,  662,  662,  662,  662,  662,  662,  662,
+      662,  662,  662,  662,  662,  662,  662,  662,  662,  662,
+      662,  662,  662,  662,  662,  664,    0,    0,    0,  664,
+      664,  664,  664,  664,    0,    0,  664,    0,  664,  665,
+        0,    0,    0,    0,  665,  665,  665,  665,    0,    0,
+
+        0,  665,  665,  665,  665,    0,    0,  665,  666,    0,
+        0,    0,    0,  666,  666,  666,  666,    0,    0,    0,
+      666,  666,  666,  666,    0,    0,  666,  671,  671,  671,
+      671,  671,  671,  671,  671,  671,  671,  671,  671,    0,
+      671,  671,  671,  671,    0,    0,    0,    0,  671,  671,
+        0,  671,  671,  676,  676,    0,    0,  676,  676,  676,
+      676,  676,  676,  676,  676,  676,  676,  676,  676,  676,
+      676,  676,  676,  676,  676,  676,  676,  676,  676,  677,
+      677,    0,    0,  677,  677,  677,  677,    0,  677,  677,
       677,  677,  677,  677,  677,  677,  677,  677,  677,  677,
-      677,  677,  677,  677,  678,    0,    0,  678,    0,    0,
-        0,    0,    0,    0,    0,    0,  678,    0,    0,  678,
-      678,  680,  680,    0,    0,  680,  680,  680,  680,  680,
+
+      677,  677,  677,  677,  677,  678,  678,    0,    0,  678,
+        0,  678,  678,  678,  678,  678,  678,  678,  678,  678,
+      678,  678,  678,  678,  678,  678,  678,  678,  678,  678,
+      678,  679,  679,    0,    0,  679,  679,  679,  679,  679,
+      679,  679,  679,  679,  679,  679,  679,  679,  679,  679,
+      679,  679,  679,  679,  679,  679,  679,  680,  680,  680,
+      680,  680,  680,  680,  680,  680,  680,  680,  680,  680,
       680,  680,  680,  680,  680,  680,  680,  680,  680,  680,
-      680,  680,  680,  680,  680,  680,  680,  681,    0,    0,
-      681,    0,    0,    0,    0,    0,    0,    0,    0,  681,
-        0,    0,  681,  681,  683,  683,    0,    0,  683,  683,
+      680,  680,  680,  681,  681,  681,  681,  681,  681,  681,
+      681,  681,  681,  681,  681,    0,  681,  681,  681,  681,
 
+        0,    0,    0,    0,  681,  681,    0,  681,  681,  682,
+      682,  682,  682,  682,    0,  682,  682,  682,  682,  682,
+      682,  682,  682,  682,  682,  682,  682,  682,  682,  682,
+      682,  682,  682,  682,  682,  683,  683,  683,  683,  683,
       683,  683,  683,  683,  683,  683,  683,  683,  683,  683,
       683,  683,  683,  683,  683,  683,  683,  683,  683,  683,
-      684,    0,    0,  684,    0,    0,    0,    0,    0,    0,
-        0,    0,  684,    0,    0,  684,  684,  686,  686,    0,
-        0,  686,  686,  686,  686,  686,  686,  686,  686,  686,
-      686,  686,  686,  686,  686,  686,  686,  686,  686,  686,
-      686,  686,  686,  688,    0,    0,    0,    0,  688,  688,
-      688,  688,    0,    0,  688,  689,    0,    0,    0,  689,
-      689,  689,  689,  689,    0,    0,  689,    0,  689,  690,
-        0,    0,    0,    0,  690,  690,  690,  690,    0,    0,
-
-        0,  690,  690,  690,  690,    0,    0,  690,  691,    0,
-        0,    0,    0,    0,  691,  691,  691,  691,    0,    0,
-        0,  691,  691,  691,  691,    0,    0,  691,  692,  692,
-        0,    0,    0,  692,  692,  692,  692,  692,    0,  692,
-        0,  692,  693,  693,  693,  693,  693,  693,  693,  693,
-      693,  693,  693,  693,    0,  693,  693,  693,  693,    0,
-        0,    0,    0,  693,  693,    0,  693,  693,  694,  694,
-      694,  694,  694,  694,  694,  694,  694,  694,  694,  694,
-        0,  694,  694,  694,  694,    0,    0,    0,    0,  694,
-      694,    0,  694,  694,  695,  695,    0,    0,  695,  695,
-
-      695,  695,    0,  695,  695,  695,  695,  695,  695,  695,
-      695,  695,  695,  695,  695,    0,  695,  695,  695,  695,
-      696,  696,    0,    0,  696,  696,  696,  696,    0,  696,
-      696,  696,  696,  696,  696,  696,  696,  696,  696,  696,
-      696,    0,  696,  696,  696,  696,  697,  697,    0,    0,
-      697,  697,  697,  697,    0,  697,  697,  697,  697,  697,
-      697,  697,  697,  697,  697,  697,  697,    0,  697,  697,
-      697,  697,  698,  698,    0,    0,  698,  698,  698,  698,
-        0,  698,  698,  698,  698,  698,  698,  698,  698,  698,
-      698,  698,  698,    0,  698,  698,  698,  698,  699,  699,
-
-        0,    0,  699,  699,  699,  699,    0,  699,  699,  699,
-      699,  699,  699,  699,  699,  699,  699,  699,  699,  699,
-      699,  699,  699,  699,  700,  700,  700,  700,    0,  700,
-      700,  700,  700,  700,    0,  700,  700,  700,  700,  700,
-      700,  700,  700,  700,    0,  700,  701,  701,  701,  701,
-      702,  702,  702,  702,    0,    0,    0,  702,  702,  702,
-      702,    0,  702,  702,  703,    0,    0,    0,    0,  703,
-      703,  703,  703,    0,    0,    0,  703,  703,  703,  703,
-        0,    0,  703,  704,  704,  704,  704,    0,    0,    0,
-      704,  704,  704,  704,    0,  704,  704,  707,  707,    0,
-
-        0,  707,  707,  707,  707,    0,  707,  707,  707,  707,
-      707,  707,  707,  707,  707,  707,  707,  707,  707,  707,
-      707,  707,  707,  709,  709,    0,    0,  709,    0,  709,
-      709,  709,  709,  709,  709,  709,  709,  709,  709,  709,
-      709,  709,  709,  709,  709,  709,  709,  709,  709,  711,
-      711,    0,    0,  711,  711,  711,  711,  711,  711,  711,
-      711,  711,  711,  711,  711,  711,  711,  711,  711,  711,
-      711,  711,  711,  711,  711,  713,    0,    0,    0,  713,
-      713,  713,  713,  713,    0,    0,  713,    0,  713,  714,
-        0,    0,    0,    0,  714,  714,  714,  714,    0,    0,
-
-        0,  714,  714,  714,  714,    0,    0,  714,  715,    0,
-        0,    0,    0,  715,  715,  715,  715,    0,    0,    0,
-      715,  715,  715,  715,    0,    0,  715,  720,  720,  720,
-      720,  720,  720,  720,  720,  720,  720,  720,  720,    0,
-      720,  720,  720,  720,    0,    0,    0,    0,  720,  720,
-        0,  720,  720,  725,  725,    0,    0,  725,  725,  725,
-      725,  725,  725,  725,  725,  725,  725,  725,  725,  725,
-      725,  725,  725,  725,  725,  725,  725,  725,  725,  726,
-      726,    0,    0,  726,  726,  726,  726,    0,  726,  726,
-      726,  726,  726,  726,  726,  726,  726,  726,  726,  726,
-
-      726,  726,  726,  726,  726,  727,  727,    0,    0,  727,
-        0,  727,  727,  727,  727,  727,  727,  727,  727,  727,
-      727,  727,  727,  727,  727,  727,  727,  727,  727,  727,
-      727,  728,  728,    0,    0,  728,  728,  728,  728,  728,
-      728,  728,  728,  728,  728,  728,  728,  728,  728,  728,
-      728,  728,  728,  728,  728,  728,  728,  729,  729,  729,
-      729,  729,  729,  729,  729,  729,  729,  729,  729,  729,
-      729,  729,  729,  729,  729,  729,  729,  729,  729,  729,
-      729,  729,  729,  730,  730,  730,  730,  730,  730,  730,
-      730,  730,  730,  730,  730,    0,  730,  730,  730,  730,
-
-        0,    0,    0,    0,  730,  730,    0,  730,  730,  731,
-      731,  731,  731,  731,    0,  731,  731,  731,  731,  731,
-      731,  731,  731,  731,  731,  731,  731,  731,  731,  731,
-      731,  731,  731,  731,  731,  732,  732,  732,  732,  732,
-      732,  732,  732,  732,  732,  732,  732,  732,  732,  732,
-      732,  732,  732,  732,  732,  732,  732,  732,  732,  732,
-      732,  733,  733,  733,  733,  733,  733,  733,  733,  733,
-      733,  733,  733,  733,  733,  733,  733,  733,  733,  733,
-      733,  733,  733,  733,  733,  733,  733,  734,  734,  734,
-      734,  734,  734,  734,  734,  734,  734,  734,  734,  734,
-
-      734,  734,  734,  734,  734,  734,  734,  734,  734,  734,
-      734,  734,  734,  735,  735,  735,  735,  735,  735,  735,
-      735,  735,  735,  735,  735,  735,  735,  735,  735,  735,
-      735,  735,  735,  735,  735,  735,  735,  735,  735,  736,
-      736,  736,  736,  736,  736,  736,  736,  736,  736,  736,
-      736,  736,  736,  736,  736,  736,  736,  736,  736,  736,
-      736,  736,  736,  736,  736,  737,  737,  737,  737,  737,
-      737,  737,  737,  737,  737,  737,  737,  737,  737,  737,
-      737,  737,  737,  737,  737,  737,  737,  737,  737,  737,
-      737,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-
-      738,  738,  738,  738,  738,  738,  738,  738,  738,  738,
-      738,  738,  738,  738,  738,  738,  738,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
-      606,  606,  606,  606,  606,  606,  606,  606,  606,  606,
+      683,  684,  684,  684,  684,  684,  684,  684,  684,  684,
+      684,  684,  684,  684,  684,  684,  684,  684,  684,  684,
+      684,  684,  684,  684,  684,  684,  684,  685,  685,  685,
+      685,  685,  685,  685,  685,  685,  685,  685,  685,  685,
+
+      685,  685,  685,  685,  685,  685,  685,  685,  685,  685,
+      685,  685,  685,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557,  557,  557,
+      557,  557,  557,  557,  557,  557,  557,  557
 
-      606,  606
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -1695,7 +1653,7 @@ char *scn3splityytext;
 /*
  *  scn3.l
  *
- *  $Id: scn3.l,v 1.21.2.6 2010/02/01 12:53:44 source Exp $
+ *  $Id: scn3.l,v 1.21.2.7 2010/10/27 12:51:33 source Exp $
  *
  *  SQL Scanner
  *
@@ -2082,7 +2040,7 @@ void yyfatalerror (const char *s);
 
 /* Internals of triple-double-quoted SPARQL string lit */
 
-#line 2086 "scn3split.c"
+#line 2044 "scn3split.c"
 
 #define INITIAL 0
 #define SQL 1
@@ -2186,7 +2144,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( scn3splityytext, scn3splityyleng, 1, scn3splityyout )
+#define ECHO do { if (fwrite( scn3splityytext, scn3splityyleng, 1, scn3splityyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -2282,7 +2240,7 @@ YY_DECL
 #line 419 "./scn3.l"
 
 
-#line 2286 "scn3split.c"
+#line 2244 "scn3split.c"
 
 	if ( !(yy_init) )
 		{
@@ -2341,13 +2299,13 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 607 )
+				if ( yy_current_state >= 558 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_current_state != 606 );
+		while ( yy_current_state != 557 );
 		yy_cp = (yy_last_accepting_cpos);
 		yy_current_state = (yy_last_accepting_state);
 
@@ -3578,7 +3536,7 @@ YY_RULE_SETUP
 #line 1033 "./scn3.l"
 ECHO;
 	YY_BREAK
-#line 3582 "scn3split.c"
+#line 3540 "scn3split.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(STRLIT):
 case YY_STATE_EOF(HEXLIT):
@@ -3878,7 +3836,7 @@ static int yy_get_next_buffer (void)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 607 )
+			if ( yy_current_state >= 558 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -3906,11 +3864,11 @@ static int yy_get_next_buffer (void)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 607 )
+		if ( yy_current_state >= 558 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 606);
+	yy_is_jam = (yy_current_state == 557);
 
 	return yy_is_jam ? 0 : yy_current_state;
 }
diff --git a/libsrc/Wi/search.c b/libsrc/Wi/search.c
index 5c50454..cc77346 100644
--- a/libsrc/Wi/search.c
+++ b/libsrc/Wi/search.c
@@ -1,7 +1,7 @@
 /*
  *  search.c
  *
- *  $Id: search.c,v 1.35.2.17 2010/07/06 10:34:08 source Exp $
+ *  $Id: search.c,v 1.35.2.27 2011/03/18 10:51:37 source Exp $
  *
  *  Search
  *
@@ -1321,6 +1321,8 @@ itc_row_check (it_cursor_t * itc, buffer_desc_t * buf)
 	  out_map_t * om = ITC_OUT_MAP (itc);
 	  DO_SET (state_slot_t *, ssl, &ks->ks_out_slots)
 	    {
+	      if (ssl->ssl_type == SSL_CONSTANT)
+		continue;
 	      if (om[inx].om_is_null)
 		{
 		  if (OM_NULL == om[inx].om_is_null)
@@ -2037,6 +2039,13 @@ pg_key_compare (buffer_desc_t * buf, int pos, it_cursor_t * it)
   return DVC_MATCH;
 }
 
+#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 10))
+#define PREFETCH \
+  guess = (at_or_above + below) / 2; \
+  __builtin_prefetch (page + map->pm_entries[guess])
+#else
+#define PREFETCH
+#endif
 
 int
 itc_page_split_search (it_cursor_t * it, buffer_desc_t ** buf_ret)
@@ -2053,6 +2062,7 @@ itc_page_split_search (it_cursor_t * it, buffer_desc_t ** buf_ret)
   int guess;
   int at_or_above_res = -100;
   key_ver_t kv;
+  PREFETCH;
   if (it->itc_dive_mode == PA_READ ? buf->bd_is_write : !buf->bd_is_write)
     GPF_T1 ("split search supposed to be in read mode");
   if (map->pm_count == 0)
@@ -2113,6 +2123,7 @@ itc_page_split_search (it_cursor_t * it, buffer_desc_t ** buf_ret)
 	{
 	case DVC_LESS:
 	  at_or_above = guess;
+	  PREFETCH;
 	  at_or_above_res = res;
 	  break;
 	case DVC_MATCH:	/* row found, dependent not checked */
@@ -2125,10 +2136,12 @@ itc_page_split_search (it_cursor_t * it, buffer_desc_t ** buf_ret)
 	    {
 	      below = guess;
 	    }
+	  PREFETCH;
 	  break;
 
 	case DVC_GREATER:
 	  below = guess;
+	  PREFETCH;
 	  break;
 	default: GPF_T1 ("key_cmp_t can't return that");
 	}
@@ -2197,6 +2210,7 @@ itc_page_insert_search (it_cursor_t * it, buffer_desc_t ** buf_ret)
       it->itc_map_pos = ITC_AT_END;
       return DVC_GREATER;
     }
+  PREFETCH;
   for (;;)
     {
       if ((below - at_or_above) <= 1)
@@ -2250,6 +2264,7 @@ itc_page_insert_search (it_cursor_t * it, buffer_desc_t ** buf_ret)
 	{
 	case DVC_LESS:
 	  at_or_above = guess;
+	  PREFETCH;
 	  at_or_above_res = res;
 	  break;
 	case DVC_MATCH:	/* row found, dependent not checked */
@@ -2271,6 +2286,7 @@ itc_page_insert_search (it_cursor_t * it, buffer_desc_t ** buf_ret)
 	  return res;
 	case DVC_GREATER:
 	  below = guess;
+	  PREFETCH;
 	  break;
 	    default: GPF_T1 ("can't have this res for key_cmp_t");
 	}
@@ -2488,6 +2504,7 @@ itc_read_ahead1 (it_cursor_t * itc, buffer_desc_t ** buf_ret)
 
 
 long tc_read_aside;
+int enable_iq_always = 0;
 
 
 void
@@ -2495,7 +2512,7 @@ itc_read_ahead_blob (it_cursor_t * itc, ra_req_t *ra, int flags)
 {
   int inx;
   buffer_pool_t * action_bp = NULL;
-  if (!itc || !ra || ra->ra_fill < 2)
+  if (!itc || !ra || (ra->ra_fill < 2 && !enable_iq_always))
     goto fin;
 
   if (!iq_is_on ())
@@ -2609,46 +2626,54 @@ itc_read_ahead (it_cursor_t * itc, buffer_desc_t ** buf_ret)
 }
 
 int enable_read_aside = 1;
-int em_ra_window = 1000;
-int em_ra_threshold = 2;
+int32 em_ra_window = 1000;
+int32 em_ra_threshold = 2;
+int32 em_ra_startup_window = 40000;
+int32 em_ra_startup_threshold = 0;
 
-ra_req_t *
-itc_read_aside (it_cursor_t * itc, buffer_desc_t * buf, dp_addr_t dp)
+
+int
+em_trigger_ra (extent_map_t * em, dp_addr_t ext_dp, uint32 now, int window, int threshold)
 {
-  /* mark the read history of the extent.  If more than so many inside a short time, do the whole extent
-  * the buf is the parent of the dp. */
-  extent_map_t * em = itc->itc_tree->it_extent_map;
-  extent_t * ext;
-  int inx, fill = 0;
-  dp_addr_t leaves[EXTENT_SZ];
-  dp_addr_t ext_dp = EXT_ROUND (dp);
-  uint32 now, rh;
-  ra_req_t *ra=NULL;
-  if (!enable_read_aside || em == em->em_dbs->dbs_extent_map)
-    return NULL; /* do not apply to the sys ext map */
-  now = get_msec_real_time ();
+  ptrlong rh;
+  if (main_bufs < 10000)
+    return 0;
+  if (em == em->em_dbs->dbs_extent_map)
+    return 0;
+  if (0 == threshold)
+    return 1;
   mutex_enter (&em->em_read_history_mtx);
   rh = (ptrlong) gethash (DP_ADDR2VOID(ext_dp), em->em_read_history);
   if (!rh)
     {
       sethash (DP_ADDR2VOID(ext_dp), em->em_read_history, (void*)(ptrlong)(now << 8));
       mutex_leave (&em->em_read_history_mtx);
-      return NULL;
+      return 0;
     }
-  if (now - (rh >> 8) > em_ra_window)
+  if (now - (rh >> 8) > window)
     {
       sethash (DP_ADDR2VOID(ext_dp), em->em_read_history, (void*)(ptrlong)(now << 8));
       mutex_leave (&em->em_read_history_mtx);
-      return NULL;
+      return 0;
     }
   if ((rh & 0xff) < em_ra_threshold)
     {
       sethash (DP_ADDR2VOID(ext_dp), em->em_read_history, (void*)(ptrlong)(rh + 1));
       mutex_leave (&em->em_read_history_mtx);
-      return NULL;
+      return 0;
     }
   remhash (DP_ADDR2VOID(ext_dp), em->em_read_history);
   mutex_leave (&em->em_read_history_mtx);
+  return 1;
+}
+
+int
+em_ext_ra_pages (extent_map_t * em, it_cursor_t * itc, dp_addr_t ext_dp, dp_addr_t * leaves, int max, dp_addr_t except_dp, dk_hash_t * except)
+{
+  extent_t * ext;
+  int fill = 0, inx;
+  if (max <= 0)
+    return 0;
   mutex_enter (em->em_mtx);
   ext = EM_DP_TO_EXT (em, ext_dp);
   if (!ext)
@@ -2659,7 +2684,7 @@ itc_read_aside (it_cursor_t * itc, buffer_desc_t * buf, dp_addr_t dp)
       if (!ext)
 	log_error ("in read aside, ext for dp %d not in the ext map and not in sys ext map ", ext_dp);
       mutex_leave (em->em_dbs->dbs_extent_map->em_mtx);
-      return NULL;
+      return 0;
     }
 
   mutex_leave (em->em_mtx);
@@ -2671,7 +2696,9 @@ itc_read_aside (it_cursor_t * itc, buffer_desc_t * buf, dp_addr_t dp)
 	{
 	  dp_addr_t other_dp = ext_dp + (BITS_IN_LONG * inx) + b_idx, phys_dp;
 	  int is_allocd = 0;
-	  if (dp == other_dp)
+	  if (except_dp == other_dp)
+	    continue;
+	  if (except && gethash (DP_ADDR2VOID (other_dp), except))
 	    continue;
 	  mutex_enter (em->em_mtx);
 	  if (0 == (ext->ext_pages[inx] & (1 << b_idx)))
@@ -2692,11 +2719,48 @@ itc_read_aside (it_cursor_t * itc, buffer_desc_t * buf, dp_addr_t dp)
 	  if (phys_dp != other_dp)
 	    continue;
 	  leaves[fill++] = other_dp;
+	  if (fill >= max)
+	    break;
 	}
     }
+  return fill;
+}
+
+extern long tc_new_page;
+
+ra_req_t *
+itc_read_aside (it_cursor_t * itc, buffer_desc_t * buf, dp_addr_t dp)
+{
+  /* mark the read history of the extent.  If more than so many inside a short time, do the whole extent
+  * the buf is the parent of the dp. */
+  int window, threshold;
+  extent_map_t * em = itc->itc_tree->it_extent_map;
+  int fill = 0;
+  dp_addr_t leaves[EXTENT_SZ];
+  dp_addr_t ext_dp = EXT_ROUND (dp);
+  uint32 now;
+  ra_req_t *ra=NULL;
+  if (disk_reads + tc_new_page < main_bufs)
+    {
+      threshold = em_ra_startup_threshold;
+      window = em_ra_startup_window;
+	}
+  else
+    {
+      threshold = em_ra_threshold;
+      window = em_ra_window;
+    }
+  if (!enable_read_aside || em == em->em_dbs->dbs_extent_map)
+    return NULL; /* do not apply to the sys ext map */
+  now = get_msec_real_time ();
+  if (!em_trigger_ra (em, ext_dp, now, window, threshold))
+    return NULL;
+  fill = em_ext_ra_pages (em, itc, ext_dp, leaves, EXTENT_SZ, dp, NULL);
   if (!fill)
     return NULL;
   tc_read_aside += fill;
+  if (itc->itc_ltrx)
+    itc->itc_ltrx->lt_client->cli_activity.da_spec_disk_reads += fill;
   ra= (ra_req_t *) dk_alloc_box(sizeof(ra_req_t),DV_CUSTOM);
   memset (ra, 0, sizeof (*ra));
   memcpy (&ra->ra_dp, leaves, fill * sizeof (dp_addr_t));
@@ -2708,6 +2772,7 @@ itc_read_aside (it_cursor_t * itc, buffer_desc_t * buf, dp_addr_t dp)
 void
 dbs_timeout_read_history (dbe_storage_t * dbs)
 {
+  int window = disk_reads < main_bufs ? em_ra_startup_window : em_ra_window;
   int now = approx_msec_real_time (), inx, nth;
   if (wi_inst.wi_checkpoint_atomic)
     return;
@@ -2728,7 +2793,7 @@ dbs_timeout_read_history (dbe_storage_t * dbs)
       mutex_enter (&em->em_read_history_mtx);
       DO_HT (void*, dp, ptrlong, rh, em->em_read_history)
 	{
-      if (now - (rh >> 8)  > 4 * em_ra_window)
+      if (now - (rh >> 8)  > 4 * window)
 	{
 	  pages[fill++] = (dp_addr_t)((ptrlong)(dp));
 	  if (fill >= 100)
@@ -2849,24 +2914,43 @@ itc_col_stat_free (it_cursor_t * itc, int upd_col, float est)
 void
 itc_row_col_stat (it_cursor_t * itc, buffer_desc_t * buf)
 {
+  int n_data = 1;
   db_buf_t row = BUF_ROW (buf, itc->itc_map_pos);
+  dbe_key_t * key = itc->itc_insert_key;
   key_ver_t kv = IE_KEY_VERSION (row);
+  int len_limit = -1, first_match = 0;
   if (!kv ||  KV_LEFT_DUMMY == kv)
     return;
-  itc->itc_st.n_sample_rows++;
   itc->itc_row_data = row;
   itc->itc_row_key = itc->itc_insert_key->key_versions[kv];
   DO_SET (dbe_column_t *, col, &itc->itc_row_key->key_parts)
     {
       col_stat_t * col_stat;
+      caddr_t * data_col = NULL;
       caddr_t data = NULL;
       dbe_column_t * current_col;
       int len, is_data = 0;
       ptrlong * place;
-      dbe_col_loc_t *cl  = key_find_cl (itc->itc_row_key, col->col_id);
+      dbe_col_loc_t *cl;
+      if (key->key_is_col)
+	cl = cl_list_find (key->key_row_var, col->col_id);
+      else
+	cl = key_find_cl (itc->itc_row_key, col->col_id);
       if (!IS_BLOB_DTP (col->col_sqt.sqt_dtp))
 	{
+	  if (key->key_bit_cl && col->col_id == key->key_bit_cl->cl_col_id)
+	    {
+	      data_col = itc_bm_array (itc, buf);
+	    }
+	  else
+	    {
 	  data = itc_box_column (itc, buf, col->col_id, cl);
+	      if (col == (dbe_column_t*)key->key_parts->data && 1 == itc->itc_search_par_fill && !box_equal (data, itc->itc_search_params[0]))
+		{
+		  dk_free_tree (data);
+		return;
+	    }
+	    }
 	  is_data = 1;
 	}
       current_col = sch_id_to_column (wi_inst.wi_schema, col->col_id);
@@ -2882,7 +2966,20 @@ itc_row_col_stat (it_cursor_t * itc, buffer_desc_t * buf)
 
       if (is_data)
 	{
-	  if (cl->cl_fixed_len > 0)
+	  int data_inx;
+	  n_data = data_col ? BOX_ELEMENTS (data_col) : 1;
+	  if (-1 != len_limit)
+	    n_data = MIN (BOX_ELEMENTS (data_col), len_limit);
+	  for (data_inx = first_match; data_inx < n_data; data_inx++)
+	    {
+	      if (data_col)
+		{
+		  data = data_col[data_inx];
+		  data_col[data_inx] = NULL;
+		}
+	      if (key->key_is_col && dtp_is_fixed (col->col_sqt.sqt_dtp))
+		len = 4;
+	      else if (cl->cl_fixed_len > 0)
 	    len = cl->cl_fixed_len;
 	  else
 	    len = IS_BOX_POINTER (data) ? box_length (data) : 8;
@@ -2904,10 +3001,51 @@ itc_row_col_stat (it_cursor_t * itc, buffer_desc_t * buf)
 	      id_hash_set (col_stat->cs_distinct, (caddr_t) &data, (caddr_t)&one);
 	    }
 	}
+	  if (data_col)
+	    {
+	      dk_free_tree ((caddr_t)data_col);
+	      data_col = NULL;
+	    }
+	}
     }
   END_DO_SET();
+  itc->itc_st.n_sample_rows += n_data;
+}
+
+
+void
+itc_n_p_matches_in_col (it_cursor_t * itc, caddr_t * data_col, int * first, int *last)
+{
+  /* in column wise inx sample can hit a seg with many different values of the 1st key part.  If so, count how many there are. */
+  caddr_t param = itc->itc_search_params[0];
+  int len = BOX_ELEMENTS (data_col);
+  int inx = 0;
+  for (inx = 0; inx < len; inx++)
+    {
+      if (box_equal (param, data_col[inx]))
+	{
+	  *first = inx;
+	  break;
+	}
+    }
+  if (inx == len)
+    {
+      *last = *first = 0;
+      return;
+    }
+  for (inx = len - 1; inx >= 0; inx--)
+	{
+	  if (box_equal (param, data_col[inx]))
+	    {
+	      *last = inx + 1;
+	      break;
+	    }
+	  if (inx == -1)
+	    *first = *last = 0;
+}
 }
 
+
 void
 itc_page_col_stat (it_cursor_t * itc, buffer_desc_t * buf)
 {
@@ -3021,7 +3159,7 @@ itc_random_leaf (it_cursor_t * itc, buffer_desc_t *buf, dp_addr_t * leaf_ret)
     nth = sqlbif_rnd (&inx_rnd_seed) % pm->pm_count;
   else
     {
-      log_error ("itc>_sample: should not get pages with 0 entries in pm");
+      log_error ("itc_sample: should not get pages with 0 entries in pm");
       return DVC_INDEX_END;
     }
   row = page + pm->pm_entries[nth];
@@ -3283,6 +3421,63 @@ samples_stddev (int64 * samples, int n_samples, float * mean_ret, float * stddev
   *mean_ret = mean;
 }
 
+int enable_p_stat = 1;
+
+int
+itc_sample_is_rdf_p (it_cursor_t * itc)
+{
+  return enable_p_stat && strstr (itc->itc_insert_key->key_table->tb_name, "RDF_QUAD")
+    &&  0 == strcmp  (((dbe_column_t*)itc->itc_insert_key->key_parts->data)->col_name, "P")
+    && itc->itc_key_spec.ksp_spec_array && !itc->itc_key_spec.ksp_spec_array->sp_next
+    && CMP_EQ == itc->itc_key_spec.ksp_spec_array->sp_min_op;
+}
+
+
+
+
+void
+itc_record_rdf_p (it_cursor_t * itc, int64 est)
+{
+  /* store the stats of the sog fpr the given p. */
+  dbe_key_t * key = itc->itc_insert_key;
+  float distincts[4];
+  iri_id_t p = unbox_iri_id (itc->itc_search_params[0]);
+  int fill = 1;
+  col_stat_t * cs;
+  mutex_enter (alt_ts_mtx); /*any mtx that is never enterd, not worth one of its own */
+  if (!key->key_p_stat)
+    {
+      key->key_p_stat = id_hash_allocate (201, sizeof (iri_id_t), 4 * sizeof (float), boxint_hash, boxint_hashcmp);
+      id_hash_set_rehash_pct (key->key_p_stat, 200);
+    }
+  distincts[0] = est;
+  DO_SET (dbe_column_t *, col, &key->key_parts->next)
+    {
+      cs = gethash ((void*)col, itc->itc_st.cols);
+      distincts[fill++] = (float)cs->cs_distinct->ht_count * (float)est / itc->itc_st.n_sample_rows;
+      DO_IDHASH (caddr_t, k, caddr_t, ign,  cs->cs_distinct)
+	dk_free_box (k);
+      END_DO_IDHASH;
+      id_hash_free (cs->cs_distinct);
+      dk_free ((caddr_t)cs, sizeof (col_stat_t));
+      if (fill >= 4)
+	break;
+    }
+  END_DO_SET();
+  /* free stats on P */
+  cs = gethash (key->key_parts->data, itc->itc_st.cols);
+  DO_IDHASH (caddr_t, k, caddr_t, ign,  cs->cs_distinct)
+      dk_free_box (k);
+  END_DO_IDHASH;
+  id_hash_free (cs->cs_distinct);
+  dk_free ((caddr_t)cs, sizeof (col_stat_t));
+
+  hash_table_free (itc->itc_st.cols);
+  itc->itc_st.cols = NULL;
+  id_hash_set (key->key_p_stat, (caddr_t)&p, (caddr_t)&distincts);
+  mutex_leave (alt_ts_mtx);
+}
+
 #define MAX_SAMPLES 20
 
 int64
@@ -3293,6 +3488,7 @@ itc_local_sample (it_cursor_t * itc)
   float mean, stddev;
   int64 samples[MAX_SAMPLES];
   int64 n_leaves, sample, tb_count;
+  int is_rdf_p = itc_sample_is_rdf_p (itc);
   dbe_table_t * tb = itc->itc_insert_key->key_table;
   int n_samples = 1;
   itc->itc_random_search = RANDOM_SEARCH_ON;
@@ -3310,6 +3506,10 @@ itc_local_sample (it_cursor_t * itc)
     return samples[0];
   {
     int angle, step = 248, offset = 5;
+    if (is_rdf_p)
+      {
+	itc->itc_st.cols = hash_table_allocate (11);
+      }
     for (;;)
       {
 	for (angle = step + offset; angle < 1000; angle += step)
@@ -3336,6 +3536,8 @@ itc_local_sample (it_cursor_t * itc)
   }
   if (CL_RUN_SINGLE_CLUSTER == cl_run_local_only && itc->itc_insert_key->key_partition && itc->itc_insert_key->key_partition->kpd_map != clm_replicated)
     mean *= key_n_partitions (itc->itc_insert_key);
+  if (is_rdf_p)
+    itc_record_rdf_p (itc, mean);
   return ((int64) mean);
 }
 
diff --git a/libsrc/Wi/security.c b/libsrc/Wi/security.c
index 89a3043..0eb00b4 100644
--- a/libsrc/Wi/security.c
+++ b/libsrc/Wi/security.c
@@ -1,7 +1,7 @@
 /*
  *  security.c
  *
- *  $Id: security.c,v 1.14.2.6 2010/02/10 16:05:35 source Exp $
+ *  $Id: security.c,v 1.14.2.8 2010/11/11 15:53:45 source Exp $
  *
  *  Security Checks
  *
@@ -101,7 +101,7 @@ bif_user_t_arg_int (caddr_t uid_or_uname, int nth, const char *func, int flags,
     u = sec_name_to_user (uid_or_uname);
   else
     u = sec_id_to_user ((oid_t) unbox(uid_or_uname));
-  if (0 == (flags & (USER_SHOULD_EXIST | USER_SHOULD_BE_SQL_ENABLED | USER_SHOULD_BE_DAV_ENABLED)))
+  if (0 == (flags & (USER_SHOULD_EXIST | USER_SHOULD_BE_LOGIN_ENABLED | USER_SHOULD_BE_SQL_ENABLED | USER_SHOULD_BE_DAV_ENABLED)))
     return u;
   if (NULL == u)
     {
@@ -129,14 +129,14 @@ bif_user_t_arg_int (caddr_t uid_or_uname, int nth, const char *func, int flags,
     }
   if ((USER_NOBODY_IS_PERMITTED & flags) && (U_ID_NOBODY == uid))
     return u;
-  if (u->usr_disabled)
-    {
      if ((USER_SPARQL_IS_PERMITTED & flags) && !strcmp (u->usr_name, "SPARQL"))
        return u;
+  if ((USER_SHOULD_BE_LOGIN_ENABLED & flags) && u->usr_disabled)
+    {
       switch (error_level) { case 0: goto ret_null; case 1: goto generic_error; }
       sqlr_new_error ("22023", "SR614",
-          "Function %s needs a valid user ID in argument %d, "
-          "but the passed UID %ld (\"%.200s\") belongs to a disabled user",
+          "Function %s needs an ID of a user with enabled login in argument %d, "
+          "but the passed UID %ld (\"%.200s\") belongs to a user with the login disabled",
       func, nth + 1, (long)uid, u->usr_name);
     }
   if ((USER_SHOULD_BE_SQL_ENABLED & flags) && !(u->usr_is_sql))
@@ -1783,8 +1783,8 @@ sec_read_users (void)
       sec_user_by_id = hash_table_allocate (101);
 
       read_users_qr = sql_compile_static (
-	  "select U_NAME, U_PASSWORD, U_GROUP, U_ID, U_DATA, U_ACCOUNT_DISABLED, U_SQL_ENABLE, U_IS_ROLE "
-	  "from SYS_USERS where U_SQL_ENABLE = 1", cli, &err, 0);
+	  "select U_NAME, U_PASSWORD, U_GROUP, U_ID, U_DATA, U_ACCOUNT_DISABLED, U_SQL_ENABLE, U_IS_ROLE, U_DAV_ENABLE "
+	  "from SYS_USERS", cli, &err, 0);
       PRINT_ERR(err);
 
       read_grants_qr = sql_compile_static (
@@ -1877,6 +1877,11 @@ sec_read_users (void)
       caddr_t name = lc_nth_col (lc, 0);
       caddr_t pass = lc_nth_col (lc, 1);
       int disabled = (int) unbox (lc_nth_col (lc, 5));
+      int is_sql = (int) unbox (lc_nth_col (lc, 6));
+      int is_role = (int) unbox (lc_nth_col (lc, 7));
+      int is_dav = (int) unbox (lc_nth_col (lc, 8));
+      if (is_dav && !is_sql) /* disable web accounts for SQL/ODBC login */
+	disabled = 1;
       if (!DV_STRINGP (pass))
 	{
 	  pass = box_string ("");
@@ -1903,8 +1908,8 @@ sec_read_users (void)
 	  (oid_t) unbox (lc_nth_col (lc, 2)),
 	  (oid_t) unbox (lc_nth_col (lc, 3)),
 	  disabled,
-	  (int) unbox (lc_nth_col (lc, 6)),
-	  (int) unbox (lc_nth_col (lc, 7)));
+	  is_sql,
+	  is_role);
       sec_set_user_data (name, lc_nth_col (lc, 4));
       sec_user_read_groups (name);
     }
diff --git a/libsrc/Wi/security.h b/libsrc/Wi/security.h
index a665ea7..9a6b6e8 100644
--- a/libsrc/Wi/security.h
+++ b/libsrc/Wi/security.h
@@ -1,7 +1,7 @@
 /*
  *  security.h
  *
- *  $Id: security.h,v 1.6.2.3 2010/04/14 13:19:58 source Exp $
+ *  $Id: security.h,v 1.6.2.4 2010/11/11 15:53:46 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -102,10 +102,11 @@ void sec_user_disable (caddr_t u_name, int flag);
 int set_user_id (client_connection_t * cli, caddr_t name, caddr_t preserve_qual);
 
 #define USER_SHOULD_EXIST 0x1
-#define USER_SHOULD_BE_SQL_ENABLED 0x2
-#define USER_SHOULD_BE_DAV_ENABLED 0x4
-#define USER_NOBODY_IS_PERMITTED 0x8
-#define USER_SPARQL_IS_PERMITTED 0x10
+#define USER_SHOULD_BE_LOGIN_ENABLED 0x2
+#define USER_SHOULD_BE_SQL_ENABLED 0x4
+#define USER_SHOULD_BE_DAV_ENABLED 0x8
+#define USER_NOBODY_IS_PERMITTED 0x1000
+#define USER_SPARQL_IS_PERMITTED 0x2000
 extern caddr_t bif_user_id_or_name_arg (caddr_t * qst, state_slot_t ** args, int nth, const char *func);
 extern user_t *bif_user_t_arg_int (caddr_t uid_or_uname, int nth, const char *func, int flags, int error_level);
 extern user_t *bif_user_t_arg (caddr_t * qst, state_slot_t ** args, int nth, const char *func, int flags, int error_level);
diff --git a/libsrc/Wi/shcompo.c b/libsrc/Wi/shcompo.c
index 7010ffb..f7d3321 100644
--- a/libsrc/Wi/shcompo.c
+++ b/libsrc/Wi/shcompo.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: shcompo.c,v 1.3.2.6 2009/12/08 10:18:47 source Exp $
+ *  $Id: shcompo.c,v 1.3.2.10 2011/03/17 13:53:45 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -30,6 +30,8 @@
 #include "security.h"
 
 static void shcompo_release_int (shcompo_t *shc);
+long shc_waits = 0;
+long shc_recompiled = 0;
 
 /* PART 1. Generic functionality */
 
@@ -48,16 +50,19 @@ shcompo_get_or_compile (shcompo_vtable_t *vt, caddr_t key, int key_is_const, str
       mutex_leave (vt->shcompo_cache_mutex);
       if (NULL != res->shcompo_comp_mutex)
         {
-          mutex_enter (res->shcompo_comp_mutex);
+	  IO_SECT (qi);
+          SHC_ENTER (res);
+	  END_IO_SECT (err_ret);
+	  shc_waits ++;
           if (NULL != res->shcompo_error)
             {
               if (NULL != err_ret)
                 err_ret[0] = box_copy_tree (res->shcompo_error);
-              mutex_leave (res->shcompo_comp_mutex);
+              SHC_LEAVE (res);
               shcompo_release (res);
               return NULL;
             }
-          mutex_leave (res->shcompo_comp_mutex);
+          SHC_LEAVE (res);
         }
       return res;
     }
@@ -89,12 +94,14 @@ static int32 shc_rnd_seed;
               old_data->shcompo_ref_count -= 1;
               if (0 == old_data->shcompo_ref_count)
 	        shcompo_release_int (old_data);
+	      else /* we must increase again as it may happen to be released prematurely by other thread waiting on same condition */
+		old_data->shcompo_ref_count += 1;
             }
           rnd++;
 	}
     }
   id_hash_add_new (vt->shcompo_cache, (caddr_t)(&key), (caddr_t)(&res));
-  mutex_enter (res->shcompo_comp_mutex); /* Safe to enter there inside vt->shcompo_cache_mutex because nobody else knows about the res at all */
+  SHC_ENTER (res); /* Safe to enter there inside vt->shcompo_cache_mutex because nobody else knows about the res at all */
   mutex_leave (vt->shcompo_cache_mutex);
   vt->shcompo_compile (res, qi, env);
   if (NULL != res->shcompo_error)
@@ -105,11 +112,11 @@ static int32 shc_rnd_seed;
       if (id_hash_remove (vt->shcompo_cache, (caddr_t)(&key)))
         res->shcompo_ref_count -= 1;
       mutex_leave (vt->shcompo_cache_mutex);
-      mutex_leave (res->shcompo_comp_mutex);
+      SHC_LEAVE (res);
       shcompo_release (res);
       return NULL;
     }
-  mutex_leave (res->shcompo_comp_mutex);
+  SHC_LEAVE (res);
   return res;
 }
 
@@ -126,14 +133,14 @@ shcompo_get (shcompo_vtable_t *vt, caddr_t key)
       mutex_leave (vt->shcompo_cache_mutex);
       if (NULL != res->shcompo_comp_mutex)
         {
-          mutex_enter (res->shcompo_comp_mutex);
+          SHC_ENTER (res);
           if (NULL != res->shcompo_error)
             {
-              mutex_leave (res->shcompo_comp_mutex);
+              SHC_LEAVE (res);
               shcompo_release (res);
               return NULL;
             }
-          mutex_leave (res->shcompo_comp_mutex);
+          SHC_LEAVE (res);
         }
       return res;
     }
@@ -155,6 +162,7 @@ shcompo_release_int (shcompo_t *shc)
   shcompo_vtable_t *vt = shc->_;
   if (NULL != shc->shcompo_comp_mutex)
     {
+      SHC_COMP_MTX_CHECK (shc);
       dk_set_push (&(vt->shcompo_spare_mutexes), shc->shcompo_comp_mutex);
       shc->shcompo_comp_mutex = NULL;
     }
@@ -209,8 +217,6 @@ shcompo_stale_if_needed (shcompo_t *shc)
   vt = shc->_;
   if (NULL == vt->shcompo_check_if_stale)
     return;
-  if (shc->shcompo_is_stale || (NULL == shc->shcompo_data))
-    return;
   mutex_enter (vt->shcompo_cache_mutex);
   if (shc->shcompo_is_stale || (NULL == shc->shcompo_data))
     {
@@ -254,7 +260,8 @@ shcompo_recompile (shcompo_t **shc_ptr)
     new_shc->shcompo_comp_mutex = (dk_mutex_t *)(dk_set_pop (&(vt->shcompo_spare_mutexes)));
   else
     new_shc->shcompo_comp_mutex = mutex_allocate ();
-  mutex_enter (new_shc->shcompo_comp_mutex);
+  SHC_ENTER (new_shc);
+  shc_recompiled ++;
   mutex_leave (vt->shcompo_cache_mutex);
   vt->shcompo_recompile (old_shc, new_shc);
   if (NULL != new_shc->shcompo_error)
@@ -265,12 +272,13 @@ shcompo_recompile (shcompo_t **shc_ptr)
       old_shc->shcompo_is_stale = 1;
       if (1 == old_shc->shcompo_ref_count)
         {
+	  SHC_COMP_MTX_CHECK (old_shc);
           dk_set_push (&(old_shc->_->shcompo_spare_mutexes), old_shc->shcompo_comp_mutex);
           old_shc->shcompo_comp_mutex = NULL;
         }
       new_shc->shcompo_key = NULL;
       mutex_leave (vt->shcompo_cache_mutex);
-      mutex_leave (new_shc->shcompo_comp_mutex);
+      SHC_LEAVE (new_shc);
       shcompo_release (new_shc);
       return;
     }
@@ -279,7 +287,7 @@ shcompo_recompile (shcompo_t **shc_ptr)
   new_shc->shcompo_ref_count += 1;
   old_shc->shcompo_key = NULL;
   mutex_leave (vt->shcompo_cache_mutex);
-  mutex_leave (new_shc->shcompo_comp_mutex);
+  SHC_LEAVE (new_shc);
   shcompo_stale (old_shc);
   shc_ptr[0] = new_shc;
 }
@@ -329,7 +337,26 @@ shcompo_compile__qr(shcompo_t *shc, query_instance_t *qi, void *env)
   caddr_t txt = ((caddr_t *)(shc->shcompo_key))[0];
   long saved_mrows = qi->qi_client->cli_resultset_max_rows;
   qi->qi_client->cli_resultset_max_rows = -1;
-  shc->shcompo_data = sql_compile (txt, qi->qi_client, &(shc->shcompo_error), 0);
+  QR_RESET_CTX_T (qi->qi_thread)
+    {
+      shc->shcompo_data = sql_compile (txt, qi->qi_client, &(shc->shcompo_error), 0);
+    }
+  QR_RESET_CODE
+    {
+      POP_QR_RESET;
+      /* if it compiles possibly will have an non-empty mem pool */
+      if (THR_TMP_POOL)
+	MP_DONE ();
+      switch (reset_code)
+	{
+	  case RST_ERROR:
+	      shc->shcompo_error = thr_get_error_code (THREAD_CURRENT_THREAD);
+	      break;
+	  default:
+	      shc->shcompo_error = srv_make_new_error ("S1T00", "SR490", "Transaction timed out");
+	}
+    }
+  END_QR_RESET;
   qi->qi_client->cli_resultset_max_rows = saved_mrows;
 }
 
diff --git a/libsrc/Wi/shcompo.h b/libsrc/Wi/shcompo.h
index b12f863..4941cd8 100644
--- a/libsrc/Wi/shcompo.h
+++ b/libsrc/Wi/shcompo.h
@@ -1,5 +1,5 @@
 /*
- *  $Id: shcompo.h,v 1.3.2.1 2009/04/18 21:55:13 source Exp $
+ *  $Id: shcompo.h,v 1.3.2.2 2010/11/26 10:47:00 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -103,8 +103,30 @@ typedef struct shcompo_s
 #ifdef DEBUG
     int		shcompo_watchdog;	/*!< Last moment when the shcompo is in shcompo_global_hashtable. */
 #endif
+#ifndef NDEBUG
+    thread_t *  shcompo_owner;
+#endif
   } shcompo_t;
 
+#ifdef NDEBUG
+#define SHC_ENTER(s) mutex_enter ((s)->shcompo_comp_mutex)
+#define SHC_LEAVE(s) mutex_leave ((s)->shcompo_comp_mutex)
+#define SHC_COMP_MTX_CHECK(s)
+#else
+#define SHC_ENTER(s) \
+    do { \
+      mutex_enter ((s)->shcompo_comp_mutex); \
+      (s)->shcompo_owner = THREAD_CURRENT_THREAD; \
+    } while (0)
+#define SHC_LEAVE(s) \
+    do { \
+      mutex_leave ((s)->shcompo_comp_mutex); \
+      (s)->shcompo_owner = NULL; \
+    } while (0)
+#define SHC_COMP_MTX_CHECK(s) \
+    if ((s)->shcompo_comp_mutex && (s)->shcompo_owner != NULL) GPF_T
+#endif
+
 /*! Tries to get a thing or create it by compiling a (copy of) key.
 If \c key_is_const then \c key is not changed (cache will store a copy if needed, otherwise \c key can be freed or placed into cache).
 \returns an old or a previously compiled shcompo, locked. */
diff --git a/libsrc/Wi/soap.sql b/libsrc/Wi/soap.sql
index 87c505c..b10dd23 100644
--- a/libsrc/Wi/soap.sql
+++ b/libsrc/Wi/soap.sql
@@ -1,5 +1,5 @@
 --
---  $Id: soap.sql,v 1.11.2.3 2010/03/08 12:04:12 source Exp $
+--  $Id: soap.sql,v 1.11.2.4 2011/02/03 09:25:01 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -2324,7 +2324,7 @@ err:;
 ?>
 </TD></TR></TABLE>
 </DIV>
-<DIV class="foot"><SPAN class="foot">Virtuoso Universal Server <?=sys_stat('st_dbms_ver')?> - Copyright© 1998-2010 OpenLink Software.</SPAN></DIV>
+<DIV class="foot"><SPAN class="foot">Virtuoso Universal Server <?=sys_stat('st_dbms_ver')?> - Copyright© 1998-2011 OpenLink Software.</SPAN></DIV>
  </BODY>
 </HTML>
 <?vsp
diff --git a/libsrc/Wi/soap_sch.xsl b/libsrc/Wi/soap_sch.xsl
index 1f618af..28e12b4 100644
--- a/libsrc/Wi/soap_sch.xsl
+++ b/libsrc/Wi/soap_sch.xsl
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!--
  -
- -  $Id: soap_sch.xsl,v 1.4 2009/04/09 13:22:13 source Exp $
+ -  $Id: soap_sch.xsl,v 1.4.2.1 2010/11/05 10:56:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -238,9 +238,8 @@
     <xsl:choose>
 	<xsl:when test="not boolean ($udt_struct)">
 	  <xsl:variable name="ext" select="vs:getExtension (@base)"/>
-	  <xsl:if test="not $ext//xs:element or not xs:sequence/xs:element">
-             <extension error="The 'extension' element is not supported"/>
-	 </xsl:if>
+	  <xsl:choose>
+	      <xsl:when test="$ext//xs:element or xs:sequence/xs:element">
 	  <restriction base="enc:Struct">
 	      <sequence>
 		  <xsl:apply-templates select="$ext//xs:element">
@@ -250,6 +249,20 @@
 	      </sequence>
 	  </restriction>
       </xsl:when>
+	      <xsl:when test="$ext//xs:simpleContent">
+		  <restriction base="enc:Struct">
+		      <xsl:apply-templates select="$ext//xs:simpleContent/xs:attribute"/>
+		      <xsl:apply-templates select="xs:attribute"/>
+		  </restriction>
+	      </xsl:when>
+	      <xsl:otherwise>
+		  <xsl:message terminate="no"><xsl:copy-of select="vs:getExtension (@base)"/></xsl:message>
+		  <extension>
+		      <xsl:attribute name="error">The 'extension' element [<xsl:value-of select="@base"/>] can not be found when expanding <xsl:value-of select="ancestor::*[@name]/@name"/></xsl:attribute>
+		  </extension>
+	      </xsl:otherwise>
+	  </xsl:choose>
+      </xsl:when>
       <xsl:otherwise>
         <xsl:copy>
           <xsl:copy-of select="@*"/>
diff --git a/libsrc/Wi/space.c b/libsrc/Wi/space.c
index 35c2ef9..4e710b5 100644
--- a/libsrc/Wi/space.c
+++ b/libsrc/Wi/space.c
@@ -1,7 +1,7 @@
 /*
  *  space.c
  *
- *  $Id: space.c,v 1.7.2.7 2010/03/08 12:04:12 source Exp $
+ *  $Id: space.c,v 1.7.2.8 2011/03/18 10:51:37 source Exp $
  *
  *  Delta spaces
  *
@@ -191,6 +191,7 @@ itc_delta_this_buffer (it_cursor_t * itc, buffer_desc_t * buf, int stay_in_map)
   return buf;
 }
 
+long tc_new_page;
 
 buffer_desc_t *
 it_new_page (index_tree_t * it, dp_addr_t addr, int type, int in_pmap,
@@ -303,6 +304,7 @@ it_new_page (index_tree_t * it, dp_addr_t addr, int type, int in_pmap,
   buf_set_dirty (buf);
   DBG_PT_PRINTF (("New page L=%d B=%p FL=%d K=%s \n", buf->bd_page, buf, type,
 		 it->it_key ? (it->it_key->key_name ? it->it_key->key_name : "unnamed key") : "no key"));
+  TC (tc_new_page);
   return buf;
 }
 
diff --git a/libsrc/Wi/sparql.h b/libsrc/Wi/sparql.h
index 8e0dce4..e360ffe 100644
--- a/libsrc/Wi/sparql.h
+++ b/libsrc/Wi/sparql.h
@@ -1,5 +1,5 @@
 /*
- *  $Id: sparql.h,v 1.58.2.18 2010/03/22 11:54:09 source Exp $
+ *  $Id: sparql.h,v 1.58.2.25 2011/02/18 11:19:39 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -68,6 +68,7 @@ extern "C" {
 #define SPAR_GRAPH		(ptrlong)1018
 #define SPAR_WHERE_MODIFS	(ptrlong)1019
 #define SPAR_SERVICE_INV	(ptrlong)1020	/*!< Tree type for details of invocation of an external service endpoint */
+#define SPAR_BINDINGS_INV	(ptrlong)1021	/*!< Tree type for details of bindings associated with gp */
 /* Don't forget to update spart_count_specific_elems_by_type(), sparp_tree_full_clone_int(), sparp_tree_full_copy(), spart_dump() and comments inside typedef struct spar_tree_s */
 
 #define SPARP_MAX_LEXDEPTH 50
@@ -224,6 +225,8 @@ typedef struct sparp_env_s
     dk_set_t		spare_context_gp_subtypes;	/*!< Subtypes of not-yet-completed graph patterns */
     dk_set_t		spare_acc_triples;		/*!< Sets of accumulated triples of GPs */
     dk_set_t		spare_acc_filters;		/*!< Sets of accumulated filters of GPs */
+    SPART **		spare_bindings_vars;		/*!< List of variables enumerated in local BINDINGS Var+ list */
+    SPART ***		spare_bindings_rowset;		/*!< Array of arrays of values in BINDINGS {...} */
     dk_set_t		spare_good_graph_varnames;	/*!< Varnames found in non-optional triples before or outside, (including non-optional inside previous non-optional siblings), but not after or inside */
     dk_set_t		spare_good_graph_varname_sets;	/*!< Pointers to the spare_known_gspo_varnames stack, to pop */
     dk_set_t		spare_good_graph_bmk;		/*!< Varnames found in non-optional triples before or outside, (including non-optional inside previous non-optional siblings), but not after or inside */
@@ -286,9 +289,10 @@ typedef struct sparp_s {
   spar_lexem_t *sparp_curr_lexem;
   spar_lexbmk_t sparp_curr_lexem_bmk;
   int sparp_in_precode_expn;		/*!< If nonzero (usually 1) then the parser reads precode-safe expression so it can not contain non-global variables, if bit 2 is set then even global variables are prohibited (like it is in INSERT DATA statement) */
-  int sparp_allow_aggregates_in_expn;	/*!< The parser reads result-set expressions or HAVING but not HAVING SELECT ... */
+  int sparp_allow_aggregates_in_expn;	/*!< The parser reads result-set expressions, GROUP BY, ORDER BY, or HAVING. Each bit is responsible for one level of nesting. */
   int sparp_query_uses_aggregates;	/*!< Nonzero if there is at least one aggregate in the whole source query, (not in the current SELECT!). This is solely for bypassing expanding top retvals for "plain SPARQL" queries, not for other logic of the compiler */
   int sparp_query_uses_sinvs;		/*!< Nonzero if there is at least one SERVICE invocation in the whole source query, (not in the current SELECT!). This forces (re) composing of \c sinv.param_varnames and \c sinv.retval_varnames lists */
+  int sparp_disable_big_const;		/*!< INSERT DATA requires either an sql_comp_t for ssl or define sql:big-data-const 0. The define sets this value to 1 */
   dk_set_t sparp_created_jsos;		/*!< Get-keyword style list of created JS objects. Object IRIs are keys, types (as free-text const char *) are values. This is solely for early (and incomplete) detection of probable errors. */
 /* Environment of lex */
   size_t sparp_text_ofs;
@@ -517,7 +521,7 @@ typedef struct spar_tree_s
         ptrlong ft_type;
         ptrlong src_serial;	/*!< Assigned once at parser and preserved in all clone operations */
       } triple;
-    struct { /* Note that all first members of \c retval case should match to \c var case */
+    struct { /* Note that all first members of \c retval and bnode cases should match to \c var case */
         /* #define SPAR_BLANK_NODE_LABEL	(ptrlong)1002 */
         /* #define SPAR_VARIABLE		(ptrlong)1013 */
         caddr_t vname;
@@ -527,7 +531,18 @@ typedef struct spar_tree_s
         ptrlong equiv_idx;
         rdf_val_range_t rvr;
       } var;
-    struct { /* Note that all first members of \c retval case should match to \c var case */
+    struct { /* Note that all first members of \c retval and bnode cases should match to \c var case */
+        /* #define SPAR_BLANK_NODE_LABEL	(ptrlong)1002 */
+        /* #define SPAR_VARIABLE		(ptrlong)1013 */
+        caddr_t vname;
+        caddr_t selid;
+        caddr_t tabid;
+        ptrlong tr_idx;		/*!< Index in quad (0 = graph ... 3 = obj) */
+        ptrlong equiv_idx;
+        rdf_val_range_t rvr;
+        ptrlong bracketed;  /*!< 0 for plain, 1 for [...], 2 for fake and bnodes made for default graphs */
+      } bnode;
+    struct { /* Note that all first members of \c retval and bnode cases should match to \c var case */
         /* #define SPAR_RETVAL		(ptrlong)1008 */
         caddr_t vname;
         caddr_t selid;
@@ -580,11 +595,18 @@ typedef struct spar_tree_s
         SPART **iri_params;	/*!< A get_keyword style array of parameters to pass in the IRI, like maxrows */
         caddr_t syntax;		/*!< Boxed bitmask of SSG_SD_xxx flags of allowed query serialization features */
         caddr_t *param_varnames;	/*!< Names of variables that are passed as parameters */
+        ptrlong in_list_implicit;	/*!< Flags if IN variables were specified using '*' or not specified at all */
         caddr_t *rset_varnames;	/*!< Names of variables that are returned in the result set from the endpoint, in the order in the rset */
         SPART **defines;	/*!< List of defines to pass, as a get_keyword style list of qnames and values or arrays of values */
         SPART **sources;	/*!< List of sources, similar to one in req_top. If NULL then sources of parent req_top are used */
         caddr_t storage_uri;	/*!< Storage to use: JSO UNAME if specified explicitly for a service IRI, uname_virtrdf_ns_uri_DefaultServiceStorage if unknown service */
       } sinv;
+    struct {
+        /* define SPAR_BINDINGS_INV		(ptrlong)1021 */
+        ptrlong own_idx;	/*!< Boxed serial of the bindings invocation in the parser */
+        SPART *vars;		/*!< Names of variables that are passed as parameters */
+	SPART ***data_rows;	/*!< Rows of data. Note that they're not copied from spare_bindings_rowset and not duplicated if enclosing GP is duplicated. */
+      } binv;
   } _;
 } sparp_tree_t;
 
@@ -592,8 +614,8 @@ typedef unsigned char SPART_buf[sizeof (sparp_tree_t) + BOX_AUTO_OVERHEAD];
 #define SPART_AUTO(ptr,buf,t) \
   do { \
     BOX_AUTO_TYPED(SPART *,ptr,buf,sizeof(SPART),DV_ARRAY_OF_POINTER); \
-    memset (ptr, 0, sizeof (SPART)); \
-    ptr->type = t; \
+    memset ((ptr), 0, sizeof (SPART)); \
+    (ptr)->type = t; \
     } while (0)
 
 extern sparp_t * sparp_query_parse (char * str, spar_query_env_t *sparqre, int rewrite_all);
@@ -604,26 +626,27 @@ extern void spart_dump (void *tree_arg, dk_session_t *ses, int indent, const cha
 
 #define SPAR_IS_BLANK_OR_VAR(tree) \
   ((DV_ARRAY_OF_POINTER == DV_TYPE_OF (tree)) && \
-   ((SPAR_VARIABLE == tree->type) || \
-    (SPAR_BLANK_NODE_LABEL == tree->type) ) )
+   ((SPAR_VARIABLE == (tree)->type) || \
+    (SPAR_BLANK_NODE_LABEL == (tree)->type) ) )
 
 #define SPAR_IS_LIT(tree) \
   ((DV_ARRAY_OF_POINTER != DV_TYPE_OF (tree)) || \
-   (SPAR_LIT == tree->type) )
+   (SPAR_LIT == (tree)->type) )
 
 #define SPAR_IS_LIT_OR_QNAME(tree) \
   ((DV_ARRAY_OF_POINTER != DV_TYPE_OF (tree)) || \
-   (SPAR_LIT == tree->type) || (SPAR_QNAME == tree->type)/* || (SPAR_QNAME_NS == tree->type)*/ )
+   (SPAR_LIT == (tree)->type) || (SPAR_QNAME == (tree)->type)/* || (SPAR_QNAME_NS == (tree)->type)*/ )
 
 #define SPAR_LIT_VAL(tree) \
-  ((DV_ARRAY_OF_POINTER != DV_TYPE_OF (tree)) ? ((caddr_t)tree) : \
-   (SPAR_LIT == tree->type) ? tree->_.lit.val : NULL )
+  ((DV_ARRAY_OF_POINTER != DV_TYPE_OF (tree)) ? ((caddr_t)(tree)) : \
+   (SPAR_LIT == (tree)->type) ? (tree)->_.lit.val : NULL )
 
 #define SPAR_LIT_OR_QNAME_VAL(tree) \
-  ((DV_ARRAY_OF_POINTER != DV_TYPE_OF (tree)) ? ((caddr_t)tree) : \
-   ((SPAR_LIT == tree->type) || (SPAR_QNAME == tree->type)/* || (SPAR_QNAME_NS == tree->type)*/) ? tree->_.lit.val : NULL )
+  ((DV_ARRAY_OF_POINTER != DV_TYPE_OF (tree)) ? ((caddr_t)(tree)) : \
+   ((SPAR_LIT == (tree)->type) || (SPAR_QNAME == (tree)->type)/* || (SPAR_QNAME_NS == tree->type)*/) ? (tree)->_.lit.val : NULL )
 
 #define SPART_VARNAME_IS_GLOB(varname) (':' == (varname)[0])
+#define SPART_VARNAME_IS_SPECIAL(varname) ('@' == (varname)[0])
 #define SPART_IRI_IS_NAMED_BNODE(iri) (('_' == (iri)[0]) && (':' == (iri)[1]))
 
 #define SPART_IS_DEFAULT_GRAPH_BLANK(g) ( \
@@ -694,6 +717,7 @@ extern caddr_t spar_selid_push (sparp_t *sparp);
 extern caddr_t spar_selid_push_reused (sparp_t *sparp, caddr_t selid);
 extern caddr_t spar_selid_pop (sparp_t *sparp);
 extern void spar_gp_init (sparp_t *sparp, ptrlong subtype);
+#define SPARP_ENV_CONTEXT_GP_SUBTYPE(sparp) ((ptrlong)((sparp)->sparp_env->spare_context_gp_subtypes->data))
 extern SPART *spar_gp_finalize (sparp_t *sparp, SPART **options);
 extern SPART *spar_gp_finalize_with_subquery (sparp_t *sparp, SPART **options, SPART *subquery);
 extern void spar_gp_add_member (sparp_t *sparp, SPART *memb);
@@ -720,6 +744,7 @@ extern void spar_add_rgc_vars_and_consts_from_retvals (sparp_t *sparp, SPART **r
 extern SPART *spar_make_wm (sparp_t *sparp, SPART *pattern, SPART **groupings, SPART *having, SPART **order, SPART *limit, SPART *offset);
 extern SPART *spar_make_top_or_special_case_from_wm (sparp_t *sparp, ptrlong subtype, SPART **retvals,
   caddr_t retselid, SPART *wm );
+extern void spar_alloc_fake_equivs_for_bindings_inv (sparp_t *sparp, SPART *binv);
 extern SPART **spar_make_sources_like_top (sparp_t *sparp);
 extern SPART *spar_make_top (sparp_t *sparp, ptrlong subtype, SPART **retvals,
   caddr_t retselid, SPART *pattern, SPART **groupings, SPART *having, SPART **order, SPART *limit, SPART *offset);
diff --git a/libsrc/Wi/sparql.sql b/libsrc/Wi/sparql.sql
index f40d34a..a1d8933 100644
--- a/libsrc/Wi/sparql.sql
+++ b/libsrc/Wi/sparql.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sparql.sql,v 1.205.2.69 2010/07/07 12:43:17 source Exp $
+--  $Id: sparql.sql,v 1.205.2.91 2011/03/29 22:55:27 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -164,6 +164,18 @@ alter index RDF_GEO on RDF_GEO partition (ID int (0hexffff00))
 
 create table DB.DBA.RDF_LABEL (RL_O any primary key, RL_RO_ID bigint, RL_TEXT varchar, RL_LANG int)
 alter index RDF_LABEL on RDF_LABEL partition (RL_O varchar (-1, 0hexffff))
+create index RDF_LABEL_TEXT on RDF_LABEL (RL_TEXT, RL_O) partition (RL_TEXT varchar (6, 0hexffff))
+;
+
+create table DB.DBA.RDF_QUAD_DELETE_QUEUE (
+  EVENT_ID bigint not null,
+  RULE_ID bigint not null,
+  QG IRI_ID not null,
+  QS IRI_ID not null,
+  QP IRI_ID not null,
+  QO any not null,
+  primary key (EVENT_ID, RULE_ID,  QG, QS, QP, QO)
+)
 ;
 
 create table DB.DBA.SYS_FAKE_0
@@ -338,6 +350,7 @@ create procedure DB.DBA.XML_LOAD_ALL_NS_DECLS ()
   DB.DBA.XML_SET_NS_DECL (	'dc'	, 'http://purl.org/dc/elements/1.1/'		, 2);
   DB.DBA.XML_SET_NS_DECL (	'go'	, 'http://purl.org/obo/owl/GO#'		, 2);
   DB.DBA.XML_SET_NS_DECL (	'geo'	, 'http://www.w3.org/2003/01/geo/wgs84_pos#'		, 2);
+  DB.DBA.XML_SET_NS_DECL (	'fn'	, 'http://www.w3.org/2005/xpath-functions/#'	, 2);
   DB.DBA.XML_SET_NS_DECL (	'foaf'	, 'http://xmlns.com/foaf/0.1/'		, 2);
   DB.DBA.XML_SET_NS_DECL (	'obo'	, 'http://www.geneontology.org/formats/oboInOwl#'		, 2);
   DB.DBA.XML_SET_NS_DECL (	'owl'	, 'http://www.w3.org/2002/07/owl#'		, 2);
@@ -350,10 +363,13 @@ create procedure DB.DBA.XML_LOAD_ALL_NS_DECLS ()
   DB.DBA.XML_SET_NS_DECL (	'rdfdf'	, 'http://www.openlinksw.com/virtrdf-data-formats#'	, 2);
   DB.DBA.XML_SET_NS_DECL (	'rdfs'	, 'http://www.w3.org/2000/01/rdf-schema#'	, 2);
   DB.DBA.XML_SET_NS_DECL (	'sc'	, 'http://purl.org/science/owl/sciencecommons/'		, 2);
+  DB.DBA.XML_SET_NS_DECL (	'sioc'	, 'http://rdfs.org/sioc/ns#'	, 2);
   DB.DBA.XML_SET_NS_DECL (	'skos'	, 'http://www.w3.org/2004/02/skos/core#'	, 2);
   DB.DBA.XML_SET_NS_DECL (	'sql'	, 'sql:'	, 2);
   DB.DBA.XML_SET_NS_DECL (	'virtrdf'	, 'http://www.openlinksw.com/schemas/virtrdf#'	, 2);
+  DB.DBA.XML_SET_NS_DECL (	'virtcxml'	, 'http://www.openlinksw.com/schemas/virtcxml#'	, 2);
   DB.DBA.XML_SET_NS_DECL (	'vcard'	, 'http://www.w3.org/2001/vcard-rdf/3.0#'	, 2);
+  DB.DBA.XML_SET_NS_DECL (	'vcard2006'	, 'http://www.w3.org/2006/vcard/ns#'	, 2);
   DB.DBA.XML_SET_NS_DECL (	'xf'	, 'http://www.w3.org/2004/07/xpath-functions'	, 2);
   DB.DBA.XML_SET_NS_DECL (	'xml'	, 'http://www.w3.org/XML/1998/namespace'	, 2);
   DB.DBA.XML_SET_NS_DECL (	'xsd'	, 'http://www.w3.org/2001/XMLSchema#'	, 2);
@@ -388,9 +404,159 @@ again:
 DB.DBA.RDF_LOAD_ALL_FT_RULES ()
 ;
 
+create procedure DB.DBA.RDF_REPL_START (in quiet integer := 0)
+{
+  if (repl_this_server () is null)
+    return;
+  if (isstring (registry_get ('DB.DBA.RDF_REPL')))
+    {
+      if (quiet)
+        return;
+      signal ('RDF99', 'RDF replication is already enabled');
+    }
+  for (select RGGM_MEMBER_IID from DB.DBA.RDF_GRAPH_GROUP_MEMBER
+  where RGGM_GROUP_IID = iri_to_id (UNAME'http://www.openlinksw.com/schemas/virtrdf#rdf_repl_graph_group')
+    and not (bit_and (__rdf_graph_approx_perms (RGGM_MEMBER_IID, http_nobody_uid()), 1)) ) do
+    {
+      signal ('RDF99', 'RDF replication can not be enabled because it will violate security rules for public read access to graph <' || id_to_iri(RGGM_MEMBER_IID) || '>');
+    }
+  repl_publish ('__rdf_repl', '__rdf_repl.log');
+  repl_text ('__rdf_repl', '__rdf_repl_flush_queue()');
+  DB.DBA.RDF_GRAPH_GROUP_CREATE (UNAME'http://www.openlinksw.com/schemas/virtrdf#rdf_repl_graph_group', 1);
+  registry_set ('DB.DBA.RDF_REPL', cast (now() as varchar));
+  exec ('checkpoint');
+}
+;
+
+create procedure DB.DBA.RDF_REPL_STOP (in quiet integer := 0)
+{
+  if (not isstring (registry_get ('DB.DBA.RDF_REPL')))
+    {
+      if (quiet)
+        return;
+      signal ('RDF99', 'RDF replication is not enabled');
+    }
+  repl_unpublish ('__rdf_repl');
+  registry_remove ('DB.DBA.RDF_REPL');
+}
+;
+
+create procedure DB.DBA.RDF_REPL_GRAPH_INS (in memb_iri varchar)
+{
+  declare memb_iid IRI_ID;
+  memb_iid := iri_to_id (memb_iri);
+  memb_iri := id_to_iri (memb_iid);
+  if (memb_iri = DB.DBA.JSO_SYS_GRAPH())
+    signal ('RDF99', 'Can not enable RDF replication of <' || memb_iri || '> (the system metadata graph)');
+  DB.DBA.RDF_GRAPH_GROUP_INS (UNAME'http://www.openlinksw.com/schemas/virtrdf#rdf_repl_graph_group', memb_iri);
+  if (not (bit_and (__rdf_graph_approx_perms (memb_iid, http_nobody_uid()), 1)))
+    signal ('RDF99', 'Can not enable RDF replication of graph <' || memb_iri || '> because it is not readable by public');
+}
+;
+
+create procedure DB.DBA.RDF_REPL_GRAPH_DEL (in memb_iri varchar)
+{
+  declare memb_iid IRI_ID;
+  DB.DBA.RDF_GRAPH_GROUP_DEL (UNAME'http://www.openlinksw.com/schemas/virtrdf#rdf_repl_graph_group', memb_iri);
+}
+;
+
+create procedure DB.DBA.RDF_REPL_SYNC (in publisher varchar, in u varchar, in pwd varchar)
+{
+  declare lvl, stat integer;
+  if (repl_this_server () is null)
+    return;
+  commit work;
+retr:
+
+  repl_sync (publisher, '__rdf_repl', u, pwd);
+again:
+  repl_status (publisher, '__rdf_repl', lvl, stat);
+  if (0 = stat)
+    {
+      __rdf_repl_flush_queue();
+      return;
+    }
+  if (1 = stat)
+    {
+      delay (0.1);
+      goto again;
+    }
+  if (2 = stat)
+    {
+      __rdf_repl_flush_queue();
+      return;
+    }
+  goto retr;
+}
+;
+
+
+create procedure DB.DBA.RDF_REPL_INSERT_TRIPLES (in graph_iri varchar, inout triples any)
+{
+  declare ctr integer;
+  for (ctr := length (triples) - 1; ctr >= 0; ctr := ctr - 1)
+    {
+      declare s_iri, p_iri, o_val, o_type, o_lang any;
+      s_iri := iri_canonicalize (triples[ctr][0]);
+      p_iri := iri_canonicalize (triples[ctr][1]);
+      o_val := triples[ctr][2];
+      if (isiri_id (o_val))
+        __rdf_repl_quad (84, graph_iri, s_iri, p_iri, iri_canonicalize (o_val));
+      else if (__tag of rdf_box <> __tag (o_val))
+        __rdf_repl_quad (80, graph_iri, s_iri, p_iri, o_val);
+      else
+        {
+          declare dt_twobyte, lang_twobyte integer;
+          dt_twobyte := rdf_box_type (o_val);
+          lang_twobyte := rdf_box_lang (o_val);
+          if (257 <> dt_twobyte)
+            __rdf_repl_quad (81, graph_iri, s_iri, p_iri, rdf_box_data (o_val), (select RDT_QNAME from DB.DBA.RDF_DATATYPE where RDT_TWOBYTE = dt_twobyte), NULL);
+          else if (257 <> lang_twobyte)
+            __rdf_repl_quad (82, graph_iri, s_iri, p_iri, rdf_box_data (o_val), NULL, (select RL_ID from DB.DBA.RDF_LANGUAGE where RL_TWOBYTE = lang_twobyte));
+          else
+            __rdf_repl_quad (80, graph_iri, s_iri, p_iri, rdf_box_data (o_val));
+        }
+    }
+}
+;
+
+create procedure DB.DBA.RDF_REPL_DELETE_TRIPLES (in graph_iri varchar, inout triples any)
+{
+  declare ctr integer;
+  for (ctr := length (triples) - 1; ctr >= 0; ctr := ctr - 1)
+    {
+      declare s_iri, p_iri, o_val, o_type, o_lang any;
+      s_iri := iri_canonicalize (triples[ctr][0]);
+      p_iri := iri_canonicalize (triples[ctr][1]);
+      o_val := triples[ctr][2];
+      if (isiri_id (o_val))
+        __rdf_repl_quad (164, graph_iri, s_iri, p_iri, iri_canonicalize (o_val));
+      else if (__tag of rdf_box <> __tag (o_val))
+        __rdf_repl_quad (160, graph_iri, s_iri, p_iri, o_val);
+      else
+        {
+          declare dt_twobyte, lang_twobyte integer;
+          dt_twobyte := rdf_box_type (o_val);
+          lang_twobyte := rdf_box_lang (o_val);
+          if (257 <> dt_twobyte)
+            __rdf_repl_quad (161, graph_iri, s_iri, p_iri, rdf_box_data (o_val), (select RDT_QNAME from DB.DBA.RDF_DATATYPE where RDT_TWOBYTE = dt_twobyte), NULL);
+          else if (257 <> lang_twobyte)
+            __rdf_repl_quad (162, graph_iri, s_iri, p_iri, rdf_box_data (o_val), NULL, (select RL_ID from DB.DBA.RDF_LANGUAGE where RL_TWOBYTE = lang_twobyte));
+          else
+            __rdf_repl_quad (160, graph_iri, s_iri, p_iri, rdf_box_data (o_val));
+        }
+    }
+}
+;
+
 --!AFTER
 create procedure DB.DBA.RDF_GLOBAL_RESET (in hard integer := 0)
 {
+  if (isstring (registry_get ('DB.DBA.RDF_REPL')))
+    {
+      signal ('42RDF', 'Can not make DB.DBA.RDF_GLOBAL_RESET while an RDF replication is enabled');
+    }
 --  checkpoint;
   __atomic (1);
   iri_id_cache_flush ();
@@ -471,6 +637,13 @@ virtrdf:DefaultServiceStorage
   virtrdf:qsMatchingFlags virtrdf:SPART_QS_NO_IMPLICIT_USER_QM .
 virtrdf:DefaultServiceStorage-UserMaps
   rdf:type virtrdf:array-of-QuadMap .
+
+virtrdf:SyncToQuads
+  rdf:type virtrdf:QuadStorage ;
+  virtrdf:qsUserMaps virtrdf:SyncToQuads-UserMaps .
+virtrdf:SyncToQuads-UserMaps
+  rdf:type virtrdf:array-of-QuadMap .
+
   ', '', 'http://www.openlinksw.com/schemas/virtrdf#' );
   delete from SYS_HTTP_SPONGE where HS_PARSER = 'DB.DBA.RDF_LOAD_HTTP_RESPONSE';
   commit work;
@@ -535,7 +708,7 @@ skip_acc: ;
 -----
 -- Datatypes and languages
 
-create function DB.DBA.RDF_TWOBYTE_OF_DATATYPE (in iid IRI_ID) returns integer
+create function DB.DBA.RDF_TWOBYTE_OF_DATATYPE (in iid any) returns integer
 {
   declare res integer;
   declare qname varchar;
@@ -778,6 +951,33 @@ create function rdf_geo_add (in v any)
 }
 ;
 
+create function rdf_geo_set_id (inout v any)
+{
+  declare id, h, ser, g any;
+  if (rdf_box_ro_id (v))
+    return v;
+  g := rdf_box_data (v);
+  if (not isgeometry (g))
+    signal ('22023', 'RDFXX', 'Must be geometry box if to be stored as geo object');
+  ser := serialize (g);
+  if (length (ser) > 50)
+    h := mdigest5 (ser);
+  else
+    {
+      h := ser;
+      ser := null;
+    }
+  set isolation = 'committed';
+  id := (select RO_ID from RDF_OBJ where RO_VAL = h and RO_DT_AND_LANG = 0hex1000101
+  	and case when RO_LONG is not null then eq (blob_to_string (RO_LONG),  ser) else 1 end );
+  if (id is not null)
+    {
+      rdf_box_set_ro_id (v, id);
+      return v;
+    }
+  return null;
+}
+;
 create function DB.DBA.RDF_OBJ_ADD (in dt_twobyte integeR, in v varchar, in lang_twobyte integeR, in ro_id_dict any := null) returns varchar
 {
   declare llong, id, need_digest integer;
@@ -1249,6 +1449,8 @@ create function DB.DBA.RDF_DATATYPE_OF_OBJ (in shortobj any, in dflt varchar :=
     {
       if (isiri_id (shortobj))
         return null;
+      if (isstring (shortobj) and bit_and (__box_flags (shortobj), 1))
+        return null;
       return iri_to_id (__xsd_type (shortobj, dflt));
     }
   twobyte := rdf_box_type (shortobj);
@@ -1269,7 +1471,13 @@ create function DB.DBA.RDF_LANGUAGE_OF_OBJ (in shortobj any, in dflt varchar :=
   declare twobyte integer;
   declare res varchar;
   if (__tag of rdf_box <> __tag (shortobj))
-    return case (isiri_id (shortobj)) when 0 then dflt else null end;
+    {
+      if (isiri_id (shortobj))
+        return null;
+      if (isstring (shortobj) and bit_and (__box_flags (shortobj), 1))
+        return null;
+      return dflt;
+    }
   twobyte := rdf_box_lang (shortobj);
   if (257 = twobyte)
     return dflt;
@@ -1357,6 +1565,28 @@ create function DB.DBA.RDF_OBJ_OF_LONG (in longobj any) returns any
 }
 ;
 
+create function DB.DBA.RDF_OBJ_OF_LONG (in longobj any, in g_iid IRI_ID, inout old_g_iid IRI_ID, in ro_id_dict any := null) returns any
+{
+  declare t int;
+  t := __tag (longobj);
+  if (__tag of rdf_box <> t)
+    {
+      if (not (t in (__tag of varchar, 126, 217, __tag of nvarchar)))
+        return longobj;
+      if (__tag of nvarchar = t)
+        longobj := charset_recode (longobj, '_WIDE_', 'UTF-8');
+      else if (t in (126, 217))
+        longobj := cast (longobj as varchar);
+      else if (bit_and (1, __box_flags (longobj)))
+        return iri_to_id (longobj);
+      return DB.DBA.RDF_OBJ_ADD (257, longobj, 257);
+    }
+  if (0 = rdf_box_needs_digest (longobj))
+    return longobj;
+  return DB.DBA.RDF_OBJ_ADD (257, longobj, 257);
+}
+;
+
 create function DB.DBA.RDF_OBJ_OF_SQLVAL (in v any) returns any
 {
   declare t int;
@@ -1452,7 +1682,7 @@ create function DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL_STRINGS (
       return DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL (
         o_val,
         iri_to_id (o_type),
-        o_lang );
+        null );
     }
   if (__tag (o_lang) in (__tag of varchar, 217))
     return DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL (o_val, NULL, o_lang);
@@ -1509,7 +1739,7 @@ create function DB.DBA.RDF_DATATYPE_OF_LONG (in longobj any, in dflt any := UNAM
   if (__tag of rdf_box = __tag (longobj))
     {
       declare twobyte integer;
-      declare res varchar;
+      declare res IRI_ID;
       twobyte := rdf_box_type (longobj);
       if (257 = twobyte)
         return case (rdf_box_lang (longobj)) when 257 then iri_to_id (dflt) else null end;
@@ -1644,7 +1874,7 @@ create function DB.DBA.RDF_DATATYPE_OF_SQLVAL (in v any,
   if (__tag of rdf_box = __tag (v))
     {
       declare twobyte integer;
-      declare res varchar;
+      declare res IRI_ID;
       twobyte := rdf_box_type (v);
       if (257 = twobyte)
         return case (rdf_box_lang (v)) when 257 then iri_to_id (strg_datatype) else null end;
@@ -1659,6 +1889,7 @@ badtype:
 }
 ;
 
+-- /* keep the input parameter as varchar in order to make jdbc happy and receive 182 instead of 242 on which it breaks the utf8 support */
 create function DB.DBA.RDF_LONG_OF_SQLVAL (in v varchar) returns any
 {
   declare t int;
@@ -1671,6 +1902,11 @@ create function DB.DBA.RDF_LONG_OF_SQLVAL (in v varchar) returns any
     v := cast (v as varchar);
   else if ((t = __tag of varchar) and (1 = __box_flags (v)))
     return iri_to_id (v);
+--  if ((t = __tag of varchar) and (v like 'http://%'))
+--    {
+--     -- dbg_obj_princ ('DB.DBA.RDF_LONG_OF_SQLVAL (', v, '): no box flag, suspicious value');
+--      ;
+--    }
   return rdf_box (v, 257, 257, 0, 1);
 }
 ;
@@ -1741,7 +1977,7 @@ create function DB.DBA.RDF_IS_BLANK_REF (in v any) returns any
     }
   if (__tag (v) = 243)
     {
-      if (v < min_bnode_iri_id)
+      if (v < min_bnode_iri_id ())
         return 0;
       return 1;
     }
@@ -1760,7 +1996,7 @@ create function DB.DBA.RDF_IS_URI_REF (in v any) returns any
     }
   if (__tag (v) = 243)
     {
-      if (v < min_bnode_iri_id)
+      if (v < min_bnode_iri_id ())
         return 1;
       return 0;
     }
@@ -1946,9 +2182,13 @@ create function DB.DBA.__not (in e1 any) returns integer
 
 create procedure DB.DBA.RDF_QUAD_URI (in g_uri varchar, in s_uri varchar, in p_uri varchar, in o_uri varchar)
 {
+  declare g_iid IRI_ID;
+  g_iid := iri_to_id (g_uri);
+  if (__rdf_graph_is_in_enabled_repl (g_iid))
+    __rdf_repl_quad (84, iri_canonicalize (g_uri), iri_canonicalize (s_uri), iri_canonicalize (p_uri), iri_canonicalize (o_uri));
   insert soft DB.DBA.RDF_QUAD (G,S,P,O)
   values (
-    iri_to_id (g_uri),
+    g_iid,
     iri_to_id (s_uri),
     iri_to_id (p_uri),
     iri_to_id (o_uri) );
@@ -1957,40 +2197,86 @@ create procedure DB.DBA.RDF_QUAD_URI (in g_uri varchar, in s_uri varchar, in p_u
 
 create procedure DB.DBA.RDF_QUAD_URI_L (in g_uri varchar, in s_uri varchar, in p_uri varchar, in o_lit any, in ro_id_dict any := null)
 {
-  declare g_iid, p_iid IRI_ID;
+  declare g_iid, s_iid, p_iid IRI_ID;
+  declare o_obj any;
   g_iid := iri_to_id (g_uri);
+  s_iid := iri_to_id (s_uri);
   p_iid := iri_to_id (p_uri);
-  insert soft DB.DBA.RDF_QUAD (G,S,P,O)
-  values (
-    g_iid,
-    iri_to_id (s_uri),
-    p_iid,
-    DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL_FT (o_lit, g_iid, p_iid, ro_id_dict) );
+  o_obj := DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL_FT (o_lit, g_iid, p_iid, ro_id_dict);
+  if (__rdf_graph_is_in_enabled_repl (g_iid))
+    {
+      declare triples any;
+      triples := vector (vector (s_iid, p_iid, o_obj));
+      DB.DBA.RDF_REPL_INSERT_TRIPLES (id_to_iri (g_iid), triples);
+    }
+  insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_iid, s_iid, p_iid, o_obj);
 }
 ;
 
 create procedure DB.DBA.RDF_QUAD_URI_L_TYPED (in g_uri varchar, in s_uri varchar, in p_uri varchar, in o_lit any, in dt any, in lang varchar, in ro_id_dict any := null)
 {
-  declare g_iid, p_iid IRI_ID;
+  declare g_iid, s_iid, p_iid IRI_ID;
+  declare o_obj any;
   g_iid := iri_to_id (g_uri);
+  s_iid := iri_to_id (s_uri);
   p_iid := iri_to_id (p_uri);
   if (dt is null and lang is null)
+    o_obj := DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL_FT (o_lit, g_iid, p_iid, ro_id_dict);
+  else
+    o_obj := DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL_FT (o_lit, iri_to_id (dt), lang, g_iid, p_iid, ro_id_dict);
+  if (__rdf_graph_is_in_enabled_repl (g_iid))
     {
-      insert soft DB.DBA.RDF_QUAD (G,S,P,O)
-      values (
-        g_iid,
-        iri_to_id (s_uri),
-        p_iid,
-        DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL_FT (o_lit, g_iid, p_iid, ro_id_dict) );
-      return;
+      declare triples any;
+      triples := vector (vector (s_iid, p_iid, o_obj));
+      DB.DBA.RDF_REPL_INSERT_TRIPLES (id_to_iri (g_iid), triples);
     }
-  insert soft DB.DBA.RDF_QUAD (G,S,P,O)
-  values (
-    g_iid,
-    iri_to_id (s_uri),
-    p_iid,
-    DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL_FT (
-      o_lit, iri_to_id (dt), lang, g_iid, p_iid, ro_id_dict ) );
+  insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_iid, s_iid, p_iid, o_obj);
+}
+;
+
+create procedure DB.DBA.RDF_QUAD_L_RDB2RDF (in g_iid varchar, in s_iid varchar, in p_iid varchar, inout o_val any, inout old_g_iid any, inout ro_id_dict any)
+{
+  declare t int;
+  if (__rdf_graph_is_in_enabled_repl (g_iid))
+    {
+      declare triples any;
+      triples := vector (vector (s_iid, p_iid, o_val));
+      DB.DBA.RDF_REPL_INSERT_TRIPLES (id_to_iri (g_iid), triples);
+    }
+  t := __tag (o_val);
+  if (__tag of rdf_box <> t)
+    {
+      if (not (t in (__tag of varchar, 126, 217, __tag of nvarchar)))
+        {
+          goto o_val_done;
+        }
+      if (__tag of nvarchar = t)
+        o_val := charset_recode (o_val, '_WIDE_', 'UTF-8');
+      else if (t in (126, 217))
+        o_val := cast (o_val as varchar);
+      else if (bit_and (1, __box_flags (o_val)))
+        {
+          o_val := iri_to_id (o_val);
+          goto o_val_done;
+        }
+    }
+  if (__rdf_obj_ft_rule_check (g_iid, p_iid))
+    {
+      if (old_g_iid <> g_iid)
+        {
+          if (dict_size (ro_id_dict))
+            DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH (old_g_iid, ro_id_dict);
+          old_g_iid := g_iid;
+        }
+      if (ro_id_dict is null)
+        ro_id_dict := dict_new ();
+      o_val := DB.DBA.RDF_OBJ_ADD (257, o_val, 257, ro_id_dict);
+    }
+  else
+    o_val := DB.DBA.RDF_OBJ_ADD (257, o_val, 257);
+
+o_val_done:
+  insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_iid, s_iid, p_iid, o_val);
 }
 ;
 
@@ -2000,12 +2286,16 @@ create procedure DB.DBA.TTLP_EV_NEW_GRAPH (inout g varchar, inout g_iid IRI_ID,
     app_env[1] := dict_new (app_env[2]);
   else
     app_env[1] := null;
+  if (__rdf_graph_is_in_enabled_repl (g_iid))
+    app_env[3] := g;
+  else
+    app_env[3] := null;
 }
 ;
 
 create procedure DB.DBA.TTLP_EV_NEW_BLANK (inout g_iid IRI_ID, inout app_env any, inout res IRI_ID) {
   res := iri_id_from_num (sequence_next ('RDF_URL_IID_BLANK'));
-  -- dbg_obj_princ ('DB.DBA.TTLP_EV_NEW_BLANK (', g, app_env, ') returns ', res);
+  -- dbg_obj_princ ('DB.DBA.TTLP_EV_NEW_BLANK (', g_iid, app_env, ') returns ', res);
 }
 ;
 
@@ -2022,8 +2312,9 @@ create procedure DB.DBA.TTLP_EV_TRIPLE (
   inout app_env any )
 {
   -- dbg_obj_princ ('DB.DBA.TTLP_EV_TRIPLE (', g_iid, s_uri, p_uri, o_uri, ');');
-  insert soft DB.DBA.RDF_QUAD (G,S,P,O)
-  values (g_iid, iri_to_id (s_uri), iri_to_id (p_uri), iri_to_id (o_uri) );
+  if (app_env[3] is not null)
+    __rdf_repl_quad (84, app_env[3], iri_canonicalize (s_uri), iri_canonicalize (p_uri), iri_canonicalize (o_uri));
+  insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_iid, iri_to_id (s_uri), iri_to_id (p_uri), iri_to_id (o_uri));
 }
 ;
 
@@ -2036,6 +2327,15 @@ create procedure DB.DBA.TTLP_EV_TRIPLE_L (
   declare log_mode integer;
   declare p_iid IRI_ID;
   declare ro_id_dict any;
+  if (app_env[3] is not null)
+    {
+      if (isstring (o_type))
+        __rdf_repl_quad (81, app_env[3], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val, iri_canonicalize (o_type), NULL);
+      else if (isstring (o_lang))
+        __rdf_repl_quad (82, app_env[3], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val, null, o_lang);
+      else
+        __rdf_repl_quad (80, app_env[3], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val);
+    }
   log_mode := app_env[0];
   ro_id_dict := app_env[1];
   p_iid := iri_to_id (p_uri);
@@ -2128,8 +2428,8 @@ create procedure DB.DBA.TTLP_EV_TRIPLE_XLAT (
   declare xlat_cbk, s_xlat, o_xlat varchar;
   declare xlat_env any;
   -- dbg_obj_princ ('DB.DBA.TTLP_EV_TRIPLE_XLAT (', g_iid, s_uri, p_uri, o_uri, ');');
-  xlat_cbk := app_env[3];
-  xlat_env := app_env[4];
+  xlat_cbk := app_env[4];
+  xlat_env := app_env[5];
   s_xlat := call(xlat_cbk)(s_uri, xlat_env);
   o_xlat := call(xlat_cbk)(o_uri, xlat_env);
   DB.DBA.TTLP_EV_TRIPLE (g_iid, s_xlat, p_uri, o_xlat, app_env);
@@ -2144,8 +2444,8 @@ create procedure DB.DBA.TTLP_EV_TRIPLE_L_XLAT (
   declare xlat_cbk, s_xlat varchar;
   declare xlat_env any;
   -- dbg_obj_princ ('DB.DBA.TTLP_EV_TRIPLE_L_XLAT (', g_iid, s_uri, p_uri, o_val, o_type, o_lang, app_env, ');');
-  xlat_cbk := app_env[3];
-  xlat_env := app_env[4];
+  xlat_cbk := app_env[4];
+  xlat_env := app_env[5];
   s_xlat := call(xlat_cbk)(s_uri, xlat_env);
   DB.DBA.TTLP_EV_TRIPLE_L (g_iid, s_xlat, p_uri, o_val, o_type, o_lang, app_env);
 }
@@ -2168,6 +2468,7 @@ create procedure DB.DBA.TTLP (in strg varchar, in base varchar, in graph varchar
 {
   declare app_env any;
   declare old_log_mode int;
+  declare ret any;
   if (graph = '')
     signal ('22023', 'Empty string is not a valid graph IRI in DB.DBA.TTLP()');
   else if (graph is null)
@@ -2193,8 +2494,8 @@ create procedure DB.DBA.TTLP (in strg varchar, in base varchar, in graph varchar
     }
   if (126 = __tag (strg))
     strg := cast (strg as varchar);
-  app_env := vector (flags, null, __max (length (strg) / 100, 100000));
-  return rdf_load_turtle (strg, base, graph, flags,
+  app_env := vector (flags, null, __max (length (strg) / 100, 100000), null);
+  ret := rdf_load_turtle (strg, base, graph, flags,
     vector (
       'DB.DBA.TTLP_EV_NEW_GRAPH',
       'DB.DBA.TTLP_EV_NEW_BLANK',
@@ -2204,6 +2505,9 @@ create procedure DB.DBA.TTLP (in strg varchar, in base varchar, in graph varchar
       'DB.DBA.TTLP_EV_COMMIT',
       'DB.DBA.TTLP_EV_REPORT_DEFAULT' ),
     app_env);
+  if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))
+    repl_text ('__rdf_repl', '__rdf_repl_flush_queue ()');
+  return ret;
 }
 ;
 
@@ -2238,7 +2542,7 @@ create procedure DB.DBA.TTLP_WITH_IRI_TRANSLATION (in strg varchar, in base varc
     }
   if (126 = __tag (strg))
     strg := cast (strg as varchar);
-  app_env := vector (flags, null, __max (length (strg) / 100, 100000), iri_xlate_cbk, iri_xlate_env);
+  app_env := vector (flags, null, __max (length (strg) / 100, 100000), null, iri_xlate_cbk, iri_xlate_env);
   return rdf_load_turtle (strg, base, graph, flags,
     vector (
       'DB.DBA.TTLP_EV_NEW_GRAPH',
@@ -2434,7 +2738,11 @@ create procedure DB.DBA.RDF_LOAD_RDFXML (in strg varchar, in base varchar, in gr
     }
   if (1 <> sys_stat ('cl_run_local_only'))
     return rdf_load_rdfxml_cl (strg, base, graph);
-  app_env := vector (null, null, __max (length (strg) / 100, 100000));
+  app_env := vector (
+    null,
+    null,
+    __max (length (strg) / 100, 100000),
+    null );
   rdf_load_rdfxml (strg, 0,
     graph,
     vector (
@@ -2447,6 +2755,8 @@ create procedure DB.DBA.RDF_LOAD_RDFXML (in strg varchar, in base varchar, in gr
       'DB.DBA.TTLP_EV_REPORT_DEFAULT' ),
     app_env,
     base );
+  if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))
+    repl_text ('__rdf_repl', '__rdf_repl_flush_queue ()');
   return graph;
 }
 ;
@@ -2484,7 +2794,11 @@ create procedure DB.DBA.RDF_LOAD_RDFA (in strg varchar, in base varchar, in grap
     }
   if (1 <> sys_stat ('cl_run_local_only'))
     return DB.DBA.RDF_LOAD_RDFA_CL (strg, base, graph, xml_parse_mode);
-  app_env := vector (null, null, __max (length (strg) / 100, 100000));
+  app_env := vector (
+    null,
+    null,
+    __max (length (strg) / 100, 100000),
+    null );
   rdf_load_rdfxml (strg, bit_or (2, bit_shift (xml_parse_mode, 8)),
     graph,
     vector (
@@ -2497,6 +2811,8 @@ create procedure DB.DBA.RDF_LOAD_RDFA (in strg varchar, in base varchar, in grap
       'DB.DBA.TTLP_EV_REPORT_DEFAULT' ),
     app_env,
     base );
+  if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))
+    repl_text ('__rdf_repl', '__rdf_repl_flush_queue ()');
   return graph;
 }
 ;
@@ -2515,7 +2831,13 @@ create procedure DB.DBA.RDF_LOAD_RDFA_WITH_IRI_TRANSLATION (in strg varchar, in
     }
   if (1 <> sys_stat ('cl_run_local_only'))
     return DB.DBA.RDF_LOAD_RDFA_WITH_IRI_TRANSLATION_CL (strg, base, graph, xml_parse_mode, iri_xlate_cbk, iri_xlate_env);
-  app_env := vector (null, null, __max (length (strg) / 100, 100000), iri_xlate_cbk, iri_xlate_env);
+  app_env := vector (
+    null,
+    null,
+    __max (length (strg) / 100, 100000),
+    null,
+    iri_xlate_cbk,
+    iri_xlate_env );
   rdf_load_rdfxml (strg, bit_or (2, bit_shift (xml_parse_mode, 8)),
     graph,
     vector (
@@ -2528,6 +2850,8 @@ create procedure DB.DBA.RDF_LOAD_RDFA_WITH_IRI_TRANSLATION (in strg varchar, in
       'DB.DBA.TTLP_EV_REPORT_DEFAULT' ),
     app_env,
     base );
+  if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))
+    repl_text ('__rdf_repl', '__rdf_repl_flush_queue ()');
   return graph;
 }
 ;
@@ -3003,7 +3327,7 @@ create procedure DB.DBA.RDF_GRAPH_TO_TTL (in graph_iri varchar, inout ses any)
   tcount := 0;
   prev_s := null;
   prev_p := null;
-  for (select S as subj, P as pred, O as obj from RDF_QUAD where G = iri_to_id (graph_iri)) do
+  for (select S as subj, P as pred, O as obj from DB.DBA.RDF_QUAD where G = iri_to_id (graph_iri)) do
     {
       if (prev_s = subj)
         {
@@ -3343,6 +3667,27 @@ create procedure DB.DBA.RDF_TRIPLES_TO_JSON (inout triples any, inout ses any)
 }
 ;
 
+create procedure DB.DBA.RDF_TRIPLES_TO_CSV (inout triples any, inout ses any)
+{
+  declare env any;
+  declare tcount, tctr, status integer;
+  http ('"subject","predicate","object"\n', ses);
+  tcount := length (triples);
+  -- dbg_obj_princ ('DB.DBA.RDF_TRIPLES_TO_CSV:'); for (tctr := 0; tctr < tcount; tctr := tctr + 1) -- dbg_obj_princ (triples[tctr]);
+  { whenever sqlstate '*' goto p_done; rowvector_subj_sort (triples, 1, 1); p_done: ; }
+  { whenever sqlstate '*' goto s_done; rowvector_subj_sort (triples, 0, 1); s_done: ; }
+  for (tctr := 0; tctr < tcount; tctr := tctr + 1)
+    {
+      DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (ses, triples[tctr][0]);
+      http (',', ses);
+      DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (ses, triples[tctr][1]);
+      http (',', ses);
+      DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (ses, triples[tctr][2]);
+      http ('\n', ses);
+    }
+}
+;
+
 create procedure DB.DBA.RDF_TRIPLES_TO_RDFA_XHTML (inout triples any, inout ses any)
 {
   declare env, prev_subj, nsdict, nslist any;
@@ -3959,16 +4304,17 @@ create function DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_FIN (inout _env any) returns
 
 create aggregate DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL (in colvalues any, in colnames any) returns long varchar
 from DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_FIN
+order
 ;
 
 
 create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_INIT (inout _env any)
 {
-  _env := string_output();
+  _env := vector (0, 0, string_output());
   http ('@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
 @prefix rs: <http://www.w3.org/2005/sparql-results#> .
 @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
-_:_ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2005/sparql-results#results> .\n', _env);
+_:_ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2005/sparql-results#results> .\n', _env[2]);
 }
 ;
 
@@ -3978,6 +4324,8 @@ create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_ACC (inout _env any, inout c
   declare rowid varchar;
   declare blank_ids any;
   if (__tag of vector <> __tag(_env))
+    DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_INIT (_env);
+  if (isinteger (_env[1]))
     {
       declare col_buf any;
       col_count := length (colnames);
@@ -3986,7 +4334,7 @@ create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_ACC (inout _env any, inout c
       col_buf := make_array (col_count * 7, 'any');
       for (col_ctr := 0; col_ctr < col_count; col_ctr := col_ctr + 1)
         col_buf [col_ctr * 7] := colnames[col_ctr];
-      _env := vector (0, col_buf, _env);
+      _env[1] := col_buf;
     }
   sparql_rset_nt_write_row (0, _env, colvalues);
 }
@@ -3994,14 +4342,15 @@ create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_ACC (inout _env any, inout c
 
 create function DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_FIN (inout _env any) returns long varchar
 {
-  if (185 <> __tag(_env))
+  if (__tag of vector <> __tag(_env))
     DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_INIT (_env);
-  return string_output_string (_env);
+  return string_output_string (_env[2]);
 }
 ;
 
 create aggregate DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT (in colvalues any, in colnames any) returns long varchar
 from DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_FIN
+order
 ;
 
 create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_INIT (inout _env any)
@@ -4096,6 +4445,7 @@ create function DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_FIN (inout _env any) ret
 
 create aggregate DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML (in colvalues any, in colnames any) returns long varchar
 from DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_FIN
+order
 ;
 
 create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_INIT (inout _env any)
@@ -4159,6 +4509,137 @@ create function DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_FIN (inout _env any) return
 
 create aggregate DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON (in colvalues any, in colnames any) returns long varchar
 from DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_FIN
+order
+;
+
+
+
+create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_INIT (inout _env any)
+{
+  _env := 0;
+}
+;
+
+create procedure DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (inout _env any, in val any)
+{
+  declare t integer;
+  t := __tag (val);
+  if (t = __tag of rdf_box)
+    {
+      val := rdf_box_data (val);
+      t := __tag (val);
+    }
+  if (t in (__tag of integer, __tag of numeric, __tag of double precision, __tag of float, __tag of date, __tag of time, __tag of datetime))
+    {
+      http_value (val, 0, _env);
+      return;
+    }
+  if (t = __tag of IRI_ID)
+    val := id_to_iri (val);
+  http ('"', _env);
+  http (replace (cast (val as varchar), '"', '"""'), _env);
+  http ('"', _env);
+}
+;
+
+create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_ACC (inout _env any, inout colvalues any, inout colnames any)
+{
+  declare sol_id varchar;
+  declare col_ctr, col_count integer;
+  declare blank_ids any;
+  col_count := length (colnames);
+  if (185 <> __tag(_env))
+    {
+      _env := string_output ();
+      for (col_ctr := 0; col_ctr < col_count; col_ctr := col_ctr + 1)
+        {
+          if (col_ctr > 0)
+            http(',', _env);
+          DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (_env, colnames[col_ctr]);
+        }
+      http ('\n', _env);
+    }
+  for (col_ctr := 0; col_ctr < col_count; col_ctr := col_ctr + 1)
+    {
+      declare val any;
+      val := colvalues[col_ctr];
+      if (col_ctr > 0)
+        http(',', _env);
+      if (val is not null)
+        DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (_env, val);
+    }
+  http('\n', _env);
+}
+;
+
+create function DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_FIN (inout _env any) returns long varchar
+{
+  if (185 <> __tag(_env))
+    return '';
+  return string_output_string (_env);
+}
+;
+
+create aggregate DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV (in colvalues any, in colnames any) returns long varchar
+from DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_FIN
+order
+;
+
+create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_INIT (inout _env any)
+{
+  _env := 0;
+}
+;
+
+create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_ACC (inout _env any, inout colvalues any, inout colnames any)
+{
+  declare agg, colvalues_copy any;
+  colvalues_copy := colvalues;
+  if (isinteger (_env))
+    {
+      vectorbld_init (agg);
+      _env := vector (0, colnames);
+    }
+  else
+    {
+      agg := aref_set_0 (_env, 0);
+    }
+  vectorbld_acc (agg, colvalues_copy);
+  aset_zap_arg (_env, 0, agg);
+}
+;
+
+create function DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_FIN (inout _env any) returns long varchar
+{
+  declare ses, metas, rset any;
+  declare accept varchar;
+  declare add_http_headers integer;
+  ses := string_output ();
+  if (isinteger (_env))
+    {
+      metas := vector (vector (vector ('s')), 1);
+      rset := vector ();
+      DB.DBA.SPARQL_RESULTS_CXML_WRITE (ses, metas, rset, accept, add_http_headers);
+    }
+  else
+    {
+      declare cols any;
+      declare colctr, colcount integer;
+      rset := aref_set_0 (_env, 0);
+      vectorbld_final (rset);
+      cols := aref_set_0 (_env, 1);
+      colcount := length (cols);
+      for (colctr := 0; colctr < colcount; colctr := colctr + 1) cols[colctr] := vector (cols[colctr]);
+      metas := vector (cols, vector ());
+      DB.DBA.SPARQL_RESULTS_CXML_WRITE (ses, metas, rset, accept, add_http_headers);
+    }
+  return string_output_string (ses);
+}
+;
+
+create aggregate DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML (in colvalues any, in colnames any) returns long varchar
+from DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_FIN
+order
 ;
 
 create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TTL (inout triples_dict any) returns long varchar
@@ -4221,6 +4702,21 @@ create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TALIS_JSON (inout triples_dict
 }
 ;
 
+create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CSV (inout triples_dict any) returns long varchar
+{
+  declare triples, ses any;
+  ses := string_output ();
+  if (214 <> __tag (triples_dict))
+    {
+      triples := vector ();
+    }
+  else
+    triples := dict_list_keys (triples_dict, 1);
+  DB.DBA.RDF_TRIPLES_TO_CSV (triples, ses);
+  return ses;
+}
+;
+
 create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_RDFA_XHTML (inout triples_dict any) returns long varchar
 {
   declare triples, ses any;
@@ -4236,6 +4732,42 @@ create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_RDFA_XHTML (inout triples_dict
 }
 ;
 
+create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CXML (inout triples_dict any) returns long varchar
+{
+  declare triples, ses any;
+  declare accept varchar;
+  declare add_http_headers integer;
+  add_http_headers := 0;
+  ses := string_output ();
+  if (214 <> __tag (triples_dict))
+    {
+      triples := vector ();
+    }
+  else
+    triples := dict_list_keys (triples_dict, 1);
+  DB.DBA.RDF_TRIPLES_TO_CXML (triples, ses, accept, add_http_headers, 0);
+  return ses;
+}
+;
+
+create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CXML_QRCODE (inout triples_dict any) returns long varchar
+{
+  declare triples, ses any;
+  declare accept varchar;
+  declare add_http_headers integer;
+  add_http_headers := 0;
+  ses := string_output ();
+  if (214 <> __tag (triples_dict))
+    {
+      triples := vector ();
+    }
+  else
+    triples := dict_list_keys (triples_dict, 1);
+  DB.DBA.RDF_TRIPLES_TO_CXML (triples, ses, accept, add_http_headers, 1);
+  return ses;
+}
+;
+
 --!AWK PUBLIC
 create procedure DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_INIT (inout _env any)
 {
@@ -4301,7 +4833,7 @@ create function DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_FIN (inout _env any) re
  xmlns:rs="http://www.w3.org/2005/sparql-results#"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema#" >
   <rs:results rdf:nodeID="rset">
-   <rs:boolean rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">' || ans || '</rs:boolean></results></rdf:RDF>', ses);
+   <rs:boolean rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">' || ans || '</rs:boolean></rs:results></rdf:RDF>', ses);
   return ses;
 }
 ;
@@ -4361,9 +4893,32 @@ create function DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_FIN (inout _env any) returns
 ;
 
 create aggregate DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT (inout one any) returns long varchar
-from DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_INIT, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_ACC, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_FIN
+from DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_INIT,	-- Not DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_INIT
+ DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_ACC,	-- Not DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_ACC
+ DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_FIN
+;
+
+
+create aggregate DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL (inout one any) returns long varchar
+from DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_INIT, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_ACC, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_FIN
+;
+
+--!AWK PUBLIC
+create function DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_CSV_FIN (inout _env any) returns long varchar
+{
+  declare ans varchar;
+  if (isinteger (_env) and _env)
+    return '"bool"\n1\n';
+  else
+    return '"bool"\n0\n';
+}
 ;
 
+create aggregate DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_CSV (inout one any) returns long varchar
+from DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_INIT,	-- Not DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_CSV_INIT
+ DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_ACC,	-- Not DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_CSV_ACC
+ DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_CSV_FIN
+;
 
 -----
 -- Insert, delete, modify operations for lists of triples
@@ -4376,6 +4931,8 @@ create procedure DB.DBA.RDF_INSERT_TRIPLES_CL (inout graph_iri any, inout triple
     is_text := 1;
   if (not isiri_id (graph_iri))
     graph_iri := iri_to_id (graph_iri);
+  if (__rdf_graph_is_in_enabled_repl (graph_iri))
+    DB.DBA.RDF_REPL_INSERT_TRIPLES (id_to_iri (graph_iri), triples);
   connection_set ('g_iid', graph_iri);
   ro_id_dict := dict_new ();
   connection_set ('g_dict', ro_id_dict);
@@ -4432,6 +4989,8 @@ create procedure DB.DBA.RDF_INSERT_TRIPLES (in graph_iri any, inout triples any,
     return RDF_INSERT_TRIPLES_CL (graph_iri, triples, log_mode);
   if (not isiri_id (graph_iri))
     graph_iri := iri_to_id (graph_iri);
+  if (__rdf_graph_is_in_enabled_repl (graph_iri))
+    DB.DBA.RDF_REPL_INSERT_TRIPLES (id_to_iri (graph_iri), triples);
   old_log_enable := log_enable (log_mode, 1);
   declare exit handler for sqlstate '*' { log_enable (old_log_enable, 1); resignal; };
   ro_id_dict := null;
@@ -4466,7 +5025,7 @@ create procedure DB.DBA.RDF_INSERT_TRIPLES (in graph_iri any, inout triples any,
             }
         }
 do_insert:
-      -- dbg_obj_princ ('DB.DBA.RDF_INSERT_TRIPLES: ', graph_iri, triples[ctr][0], p_iid, o_final);
+      -- dbg_obj_princ ('DB.DBA.RDF_INSERT_TRIPLES inserts ', graph_iri, triples[ctr][0], p_iid, o_final);
       insert soft DB.DBA.RDF_QUAD (G,S,P,O)
       values (graph_iri, triples[ctr][0], p_iid, o_final);
     }
@@ -4481,6 +5040,8 @@ create procedure DB.DBA.RDF_DELETE_TRIPLES (in graph_iri any, in triples any, in
   declare ctr, old_log_enable integer;
   if (not isiri_id (graph_iri))
     graph_iri := iri_to_id (graph_iri);
+  if (__rdf_graph_is_in_enabled_repl (graph_iri))
+    DB.DBA.RDF_REPL_DELETE_TRIPLES (id_to_iri (graph_iri), triples);
   old_log_enable := log_enable (log_mode, 1);
   declare exit handler for sqlstate '*' { log_enable (old_log_enable, 1); resignal; };
   for (ctr := length (triples) - 1; ctr >= 0; ctr := ctr - 1)
@@ -4506,11 +5067,13 @@ create procedure DB.DBA.RDF_DELETE_TRIPLES (in graph_iri any, in triples any, in
 ;
 
 
-create procedure DB.DBA.RDF_DELETE_TRIPLES_AGG (in graph_iri any, inout triples any, in log_mode integer := null)
+create procedure DB.DBA.RDF_DELETE_TRIPLES_AGG (in graph_iid any, inout triples any, in log_mode integer := null)
 {
   declare ctr, old_log_enable, l integer;
-  if (not isiri_id (graph_iri))
-    graph_iri := iri_to_id (graph_iri);
+  if (not isiri_id (graph_iid))
+    graph_iid := iri_to_id (graph_iid);
+  if (__rdf_graph_is_in_enabled_repl (graph_iid))
+    DB.DBA.RDF_REPL_DELETE_TRIPLES (id_to_iri (graph_iid), triples);
   old_log_enable := log_enable (log_mode, 1);
   declare exit handler for sqlstate '*' { log_enable (old_log_enable, 1); resignal; };
   if (0 = sys_stat ('cl_run_local_only'))
@@ -4523,7 +5086,7 @@ create procedure DB.DBA.RDF_DELETE_TRIPLES_AGG (in graph_iri any, inout triples
 --	{
 --	  declare r any;
 --	r := triples[ctr];
---	  daq_delete (daq, 'DB.DBA.RDF_QUAD', cols, vector (graph_iri, r[0], r[1], r[2] ));
+--	  daq_delete (daq, 'DB.DBA.RDF_QUAD', cols, vector (graph_iid, r[0], r[1], r[2] ));
 --	}
 --      daq_results (daq);
 --      if (bit_and (coalesce (log_mode, old_log_enable), 2))
@@ -4532,7 +5095,7 @@ create procedure DB.DBA.RDF_DELETE_TRIPLES_AGG (in graph_iri any, inout triples
       log_enable (bit_and (coalesce (log_mode, old_log_enable), 1), 1);
       dp := dpipe (0, '__I2IDN', '__I2IDN', 'O_LOOKN');
       dpipe_set_rdf_load (dp, 3);
-      connection_set ('g_iid', graph_iri);
+      connection_set ('g_iid', graph_iid);
       l := length (triples);
       for (ctr := 0; ctr < l; ctr := ctr + 1)
 	{
@@ -4559,8 +5122,9 @@ create procedure DB.DBA.RDF_DELETE_TRIPLES_AGG (in graph_iri any, inout triples
 	{
 	  declare o_short any;
 	o_short := DB.DBA.RDF_OBJ_OF_LONG (triples[ctr][2]);
+          -- dbg_obj_princ ('DB.DBA.RDF_DELETE_TRIPLES_AGG: delete from DB.DBA.RDF_QUAD where G = ', graph_iid, ' and S = ', triples[ctr][0], ' and P = ', triples[ctr][1], ' and O = ', o_short);
 	  delete from DB.DBA.RDF_QUAD
-	    where G = graph_iri and S = triples[ctr][0] and P = triples[ctr][1] and O = o_short;
+            where G = graph_iid and S = triples[ctr][0] and P = triples[ctr][1] and O = o_short;
 	}
       log_enable (old_log_enable, 1);
     }
@@ -4589,6 +5153,7 @@ create procedure DB.DBA.SPARQL_INS_OR_DEL_CTOR_IMPL (inout _env any, in graph_ir
   declare action_ctr integer;
   declare old_log_enable integer;
   old_log_enable := log_enable (log_mode, 1);
+  -- dbg_obj_princ ('DB.DBA.SPARQL_INS_OR_DEL_CTOR_IMPL (', _env, graph_iri, opcodes, vars, log_mode, ctor_op, ')');
   declare exit handler for sqlstate '*' { log_enable (old_log_enable, 1); resignal; };
   blank_ids := 0;
   action_ctr := 0;
@@ -4763,8 +5328,15 @@ create function DB.DBA.SPARQL_INSERT_DICT_CONTENT (in graph_iri any, in triples_
     }
   if (isiri_id (graph_iri))
     graph_iri := id_to_iri (graph_iri);
+  if (graph_iri is not null and __rdf_graph_is_in_enabled_repl (iri_to_id (graph_iri)))
+    repl_text ('__rdf_repl', '__rdf_repl_flush_queue ()');
   if (compose_report)
-    return sprintf ('Insert into <%s>, %d triples -- done', graph_iri, ins_count);
+    {
+      if (ins_count)
+        return sprintf ('Insert into <%s>, %d (or less) triples -- done', graph_iri, ins_count);
+      else
+        return sprintf ('Insert into <%s>, 0 triples -- nothing to do', graph_iri);
+    }
   else
     return ins_count;
 }
@@ -4789,8 +5361,15 @@ create function DB.DBA.SPARQL_DELETE_DICT_CONTENT (in graph_iri any, in triples_
     }
   if (isiri_id (graph_iri))
     graph_iri := id_to_iri (graph_iri);
+  if (graph_iri is not null and __rdf_graph_is_in_enabled_repl (iri_to_id (graph_iri)))
+    repl_text ('__rdf_repl', '__rdf_repl_flush_queue ()');
   if (compose_report)
-    return sprintf ('Delete from <%s>, %d triples -- done', graph_iri, del_count);
+    {
+      if (del_count)
+        return sprintf ('Delete from <%s>, %d (or less) triples -- done', graph_iri, del_count);
+      else
+        return sprintf ('Delete from <%s>, 0 triples -- nothing to do', graph_iri);
+    }
   else
     return del_count;
 }
@@ -4820,42 +5399,120 @@ create function DB.DBA.SPARQL_MODIFY_BY_DICT_CONTENTS (in graph_iri any, in del_
     }
   if (isiri_id (graph_iri))
     graph_iri := id_to_iri (graph_iri);
+  if (graph_iri is not null and __rdf_graph_is_in_enabled_repl (iri_to_id (graph_iri)))
+    repl_text ('__rdf_repl', '__rdf_repl_flush_queue ()');
   if (compose_report)
-    return sprintf ('Modify <%s>, delete %d and insert %d triples -- done', graph_iri, del_count, ins_count);
+    return sprintf ('Modify <%s>, delete %d (or less) and insert %d (or less) triples -- done', graph_iri, del_count, ins_count);
   else
     return del_count + ins_count;
 }
 ;
 
+-- /* delete quads */
+create procedure DB.DBA.RDF_REPL_DEL (inout rquads any)
+{
+  declare rquads_ctr, rquads_count, opcode integer;
+  declare g_iri, prev_g_iri varchar;
+  declare g_iid varchar;
+  declare ro_id_dict, app_env any;
+  rquads_count := length (rquads);
+  prev_g_iri := '';
+  for (rquads_ctr := 0; rquads_ctr < rquads_count; rquads_ctr := rquads_ctr + 1)
+    {
+      -- dbg_obj_princ ('DB.DBA.RDF_REPL_DEL(), rquad ', rquads_ctr, ' / ', rquads_count, ': ', rquads[rquads_ctr]);
+      g_iri := rquads[rquads_ctr][1];
+      if (g_iri <> prev_g_iri)
+        {
+          g_iid := iri_to_id (g_iri);
+          --DB.DBA.TTLP_EV_CL_GS_NEW_GRAPH (g_iri, g_iid, app_env);
+          prev_g_iri := g_iri;
+        }
+      opcode := rquads[rquads_ctr][0];
+      if (0 = opcode)
+	{
+          delete from DB.DBA.RDF_QUAD
+	      where G = g_iid and S = iri_to_id_repl (rquads[rquads_ctr][2]) and P = iri_to_id_repl (rquads[rquads_ctr][3])
+	      and O = DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL (rquads[rquads_ctr][4]);
+	  if (__rdf_graph_is_in_enabled_repl (g_iid))
+	    __rdf_repl_quad (160 + opcode, g_iri, rquads[rquads_ctr][2], rquads[rquads_ctr][3], rquads[rquads_ctr][4]);
+	}
+      else if (1 = opcode)
+	{
+	  declare obj any;
+	  if (isgeometry (rquads[rquads_ctr][4]))
+	    {
+	      obj := rdf_box (rquads[rquads_ctr][4], 256, 257, 0, 1);
+	      rdf_geo_set_id (obj);
+	    }
+	  else
+	    obj := DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL (rquads[rquads_ctr][4], iri_to_id_repl (rquads[rquads_ctr][5]), null);
+	  delete from DB.DBA.RDF_QUAD
+	      where G = g_iid and S = iri_to_id_repl (rquads[rquads_ctr][2]) and P = iri_to_id_repl (rquads[rquads_ctr][3]) and O = obj;
+	  if (__rdf_graph_is_in_enabled_repl (g_iid))
+	    __rdf_repl_quad (160 + opcode, g_iri, rquads[rquads_ctr][2], rquads[rquads_ctr][3], rquads[rquads_ctr][4], rquads[rquads_ctr][5], null);
+	}
+      else if (2 = opcode)
+	{
+	  delete from DB.DBA.RDF_QUAD
+	      where G = g_iid and S = iri_to_id_repl (rquads[rquads_ctr][2]) and P = iri_to_id_repl (rquads[rquads_ctr][3])
+	      and O = DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL (rquads[rquads_ctr][4], null, rquads[rquads_ctr][5]);
+	  if (__rdf_graph_is_in_enabled_repl (g_iid))
+	    __rdf_repl_quad (160 + opcode, g_iri, rquads[rquads_ctr][2], rquads[rquads_ctr][3], rquads[rquads_ctr][4], null, rquads[rquads_ctr][5]);
+	}
+      else if (4 = opcode)
+	{
+	  delete from DB.DBA.RDF_QUAD
+	      where G = g_iid and S = iri_to_id_repl (rquads[rquads_ctr][2]) and P = iri_to_id_repl (rquads[rquads_ctr][3])
+	      and O = iri_to_id_repl (rquads[rquads_ctr][4]);
+	  if (__rdf_graph_is_in_enabled_repl (g_iid))
+	    __rdf_repl_quad (160 + opcode, g_iri, rquads[rquads_ctr][2], rquads[rquads_ctr][3], rquads[rquads_ctr][4]);
+	}
+
+
+    }
+  app_env := vector (1, null);
+  DB.DBA.TTLP_EV_COMMIT (g_iri, app_env);
+  --if (1 <> sys_stat ('cl_run_local_only'))
+  --  rdf_dpipe_flush_gs (app_env, 1);
+  connection_set ('g_dict', null);
+  commit work;
+}
+;
+
 --#IF VER=5
 --!AFTER
 --#ENDIF
 create function DB.DBA.SPARUL_CLEAR (in graph_iri any, in inside_sponge integer, in uid integer := 0, in log_mode integer := null, in compose_report integer := 0) returns any
 {
   declare g any;
+  declare g_iid IRI_ID;
   declare old_log_enable integer;
   g := graph_iri;
   if (isiri_id (g))
    g := id_to_iri (g);
+  g_iid := iri_to_id (g);
   __rgs_assert_cbk (graph_iri, uid, 2, 'SPARUL CLEAR GRAPH');
+  if (__rdf_graph_is_in_enabled_repl (g_iid))
+    {
+      repl_text ('__rdf_repl', '__rdf_repl_flush_queue()');
+      repl_text ('__rdf_repl', 'sparql define input:storage "" clear graph iri ( ?? )', g);
+    }
   old_log_enable := log_enable (log_mode, 1);
   declare exit handler for sqlstate '*' { log_enable (old_log_enable, 1); resignal; };
   exec (sprintf ('
   delete from DB.DBA.RDF_QUAD
   where G = __i2id (''%S'') ', g));
   delete from DB.DBA.RDF_OBJ_RO_FLAGS_WORDS
-  where VT_WORD = rdf_graph_keyword (iri_to_id (graph_iri));
-  if (isiri_id (graph_iri))
-    graph_iri := id_to_iri (graph_iri);
+  where VT_WORD = rdf_graph_keyword (g_iid);
   if (not inside_sponge)
     {
-      delete from DB.DBA.SYS_HTTP_SPONGE where HS_LOCAL_IRI = graph_iri;
-      delete from DB.DBA.SYS_HTTP_SPONGE where HS_LOCAL_IRI like concat ('destMD5=', md5 (graph_iri), '&graphMD5=%');
+      delete from DB.DBA.SYS_HTTP_SPONGE where HS_LOCAL_IRI = g;
+      delete from DB.DBA.SYS_HTTP_SPONGE where HS_LOCAL_IRI like concat ('destMD5=', md5 (g), '&graphMD5=%');
     }
   /*091202 commit work; */
   log_enable (old_log_enable, 1);
   if (compose_report)
-    return sprintf ('Clear <%s> -- done', graph_iri);
+    return sprintf ('Clear <%s> -- done', g);
   else
     return 1;
 }
@@ -4904,9 +5561,13 @@ create function DB.DBA.SPARUL_LOAD (in graph_iri any, in resource varchar, in ui
 
 create function DB.DBA.SPARUL_CREATE (in graph_iri any, in silent integer, in uid integer, in log_mode integer, in compose_report integer) returns any
 {
+  declare g_iid IRI_ID;
   declare old_log_enable integer;
   __rgs_assert_cbk (graph_iri, uid, 2, 'SPARUL CREATE GRAPH');
-  if (exists (select top 1 1 from DB.DBA.RDF_EXPLICITLY_CREATED_GRAPH where REC_GRAPH_IID = iri_to_id (graph_iri)))
+  g_iid := iri_to_id (graph_iri);
+  if (__rdf_graph_is_in_enabled_repl (g_iid))
+    repl_text ('__rdf_repl', 'sparql define input:storage "" create graph iri ( ?? )', graph_iri);
+  if (exists (select top 1 1 from DB.DBA.RDF_EXPLICITLY_CREATED_GRAPH where REC_GRAPH_IID = g_iid))
     {
       if (silent)
         {
@@ -4950,8 +5611,15 @@ create function DB.DBA.SPARUL_CREATE (in graph_iri any, in silent integer, in ui
 
 create function DB.DBA.SPARUL_DROP (in graph_iri any, in silent integer, in uid integer, in log_mode integer, in compose_report integer) returns any
 {
+  declare g_iid IRI_ID;
   declare old_log_enable integer;
   __rgs_assert_cbk (graph_iri, uid, 2, 'SPARUL DROP GRAPH');
+  g_iid := iri_to_id (graph_iri);
+  if (__rdf_graph_is_in_enabled_repl (g_iid))
+    {
+      repl_text ('__rdf_repl', '__rdf_repl_flush_queue()');
+      repl_text ('__rdf_repl', 'sparql define input:storage "" drop graph iri ( ?? )', graph_iri);
+    }
   old_log_enable := log_enable (log_mode, 1);
   declare exit handler for sqlstate '*' { log_enable (old_log_enable, 1); resignal; };
   if (not exists (select top 1 1 from DB.DBA.RDF_EXPLICITLY_CREATED_GRAPH where REC_GRAPH_IID = iri_to_id (graph_iri)))
@@ -5373,12 +6041,13 @@ create procedure DB.DBA.SPARQL_DESC_DICT (in subj_dict any, in consts any, in go
 {
   declare all_subj_descs, phys_subjects, sorted_good_graphs, sorted_bad_graphs, g_dict, res any;
   declare uid, graphs_listed, g_ctr, good_g_count, bad_g_count, s_ctr, all_s_count, phys_s_count integer;
-  declare gs_app_callback, gs_app_uid varchar;
+  declare gs_app_callback, gs_app_uid, inf_ruleset varchar;
   declare rdf_type_iid IRI_ID;
   uid := get_keyword ('uid', options, http_nobody_uid());
   gs_app_callback := get_keyword ('gs-app-callback', options);
   if (gs_app_callback is not null)
     gs_app_uid := get_keyword ('gs-app-uid', options);
+  inf_ruleset := get_keyword ('inference', options);
   rdf_type_iid := iri_to_id (UNAME'http://www.w3.org/1999/02/22-rdf-syntax-ns#type');
   res := dict_new ();
   if (isinteger (consts))
@@ -5422,7 +6091,7 @@ create procedure DB.DBA.SPARQL_DESC_DICT (in subj_dict any, in consts any, in go
   vectorbld_init (phys_subjects);
   if (isinteger (storage_name))
     storage_name := 'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage';
-  else if ('' = storage_name)
+  else if (('' = storage_name) and (inf_ruleset is null))
     {
       for (s_ctr := 0; s_ctr < all_s_count; s_ctr := s_ctr + 1)
         {
@@ -5449,7 +6118,7 @@ create procedure DB.DBA.SPARQL_DESC_DICT (in subj_dict any, in consts any, in go
       maps := sparql_quad_maps_for_quad (NULL, s, NULL, NULL, storage_name, case (graphs_listed) when 0 then vector() else sorted_good_graphs end, sorted_bad_graphs);
       -- dbg_obj_princ ('s = ', s, ' maps = ', maps);
       maps_len := length (maps);
-      if ((maps_len > 0) and (maps[maps_len-1][0] = UNAME'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadMap'))
+      if ((maps_len > 0) and (inf_ruleset is null) and (maps[maps_len-1][0] = UNAME'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadMap'))
         {
           if (isiri_id (s))
             {
@@ -5484,12 +6153,12 @@ create procedure DB.DBA.SPARQL_DESC_DICT (in subj_dict any, in consts any, in go
       s := s_desc[0];
       maps := s_desc[1];
       maps_len := length (maps);
-      fname := sprintf ('SPARQL_DESC_DICT_QMV1_%U', md5 (storage_name || cast (graphs_listed as varchar) || md5_box (maps) || md5_box (sorted_bad_graphs)));
+      fname := sprintf ('SPARQL_DESC_DICT_QMV1_%U', md5 (storage_name || inf_ruleset || cast (graphs_listed as varchar) || md5_box (maps) || md5_box (sorted_bad_graphs)));
       if (not exists (select top 1 1 from Db.DBA.SYS_PROCEDURES where P_NAME = 'DB.DBA.' || fname))
         {
           declare ses, txt, saved_user any;
           ses := string_output ();
-          http ('create procedure DB.DBA."' || fname || '" (in subj any, inout res any', ses);
+          http ('create procedure DB.DBA."' || fname || '" (in subj any, in res any', ses);
           if (graphs_listed)
             http (', inout sorted_good_graphs any', ses);
           http (')\n', ses);
@@ -5501,6 +6170,8 @@ create procedure DB.DBA.SPARQL_DESC_DICT (in subj_dict any, in consts any, in go
             {
               http ('  define input:named-graph-exclude <' || id_to_iri_nosignal (g) || '>\n', ses);
             }
+          if (inf_ruleset is not null)
+              http ('  define input:inference <' || inf_ruleset || '>\n', ses);
           http ('select ?g1 ?p1 ?o1\n', ses);
           http ('      where { graph ?g1 {\n', ses);
           for (map_ctr := 0; map_ctr < maps_len; map_ctr := map_ctr + 1)
@@ -5508,7 +6179,7 @@ create procedure DB.DBA.SPARQL_DESC_DICT (in subj_dict any, in consts any, in go
               if (map_ctr > 0) http ('              union\n', ses);
               http ('              { quad map <' || maps[map_ctr][0] || '> { ?:subj_iri ?p1 ?o1 } }\n', ses);
             }
-          http ('            } } ) do { ', ses);
+          http ('            } } ) do {\n', ses);
           if (graphs_listed)
             http ('      if (position (__i2idn ("g1"), sorted_good_graphs))\n', ses);
           http ('      dict_put (res, vector (subj, "p1", "o1"), 1); } }\n', ses);
@@ -5640,12 +6311,13 @@ create procedure DB.DBA.SPARQL_DESC_DICT_SPO (in subj_dict any, in consts any, i
 {
   declare all_subj_descs, phys_subjects, sorted_good_graphs, sorted_bad_graphs, res any;
   declare uid, graphs_listed, g_ctr, good_g_count, bad_g_count, s_ctr, all_s_count, phys_s_count integer;
-  declare gs_app_callback, gs_app_uid varchar;
+  declare gs_app_callback, gs_app_uid, inf_ruleset varchar;
   declare rdf_type_iid IRI_ID;
   uid := get_keyword ('uid', options, http_nobody_uid());
   gs_app_callback := get_keyword ('gs-app-callback', options);
   if (gs_app_callback is not null)
     gs_app_uid := get_keyword ('gs-app-uid', options);
+  inf_ruleset := get_keyword ('inference', options);
   rdf_type_iid := iri_to_id (UNAME'http://www.w3.org/1999/02/22-rdf-syntax-ns#type');
   res := dict_new ();
   if (isinteger (consts))
@@ -5689,7 +6361,7 @@ create procedure DB.DBA.SPARQL_DESC_DICT_SPO (in subj_dict any, in consts any, i
   vectorbld_init (phys_subjects);
   if (isinteger (storage_name))
     storage_name := 'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage';
-  else if ('' = storage_name)
+  else if (('' = storage_name) and (inf_ruleset is null))
     {
       for (s_ctr := 0; s_ctr < all_s_count; s_ctr := s_ctr + 1)
         {
@@ -5716,7 +6388,7 @@ create procedure DB.DBA.SPARQL_DESC_DICT_SPO (in subj_dict any, in consts any, i
       maps := sparql_quad_maps_for_quad (NULL, s, NULL, NULL, storage_name, case (graphs_listed) when 0 then vector() else sorted_good_graphs end, sorted_bad_graphs);
       -- dbg_obj_princ ('s = ', s, ' maps = ', maps);
       maps_len := length (maps);
-      if ((maps_len > 0) and (maps[maps_len-1][0] = UNAME'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadMap'))
+      if ((maps_len > 0) and (inf_ruleset is null) and (maps[maps_len-1][0] = UNAME'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadMap'))
         {
           if (isiri_id (s))
             {
@@ -5751,12 +6423,12 @@ create procedure DB.DBA.SPARQL_DESC_DICT_SPO (in subj_dict any, in consts any, i
       s := s_desc[0];
       maps := s_desc[1];
       maps_len := length (maps);
-      fname := sprintf ('SPARQL_DESC_DICT_QMV1_%U', md5 (storage_name || cast (graphs_listed as varchar) || md5_box (maps) || md5_box (sorted_bad_graphs)));
+      fname := sprintf ('SPARQL_DESC_DICT_QMV1_%U', md5 (storage_name || inf_ruleset || cast (graphs_listed as varchar) || md5_box (maps) || md5_box (sorted_bad_graphs)));
       if (not exists (select top 1 1 from Db.DBA.SYS_PROCEDURES where P_NAME = 'DB.DBA.' || fname))
         {
           declare ses, txt, saved_user any;
           ses := string_output ();
-          http ('create procedure DB.DBA."' || fname || '" (in subj any, inout res any', ses);
+          http ('create procedure DB.DBA."' || fname || '" (in subj any, in res any', ses);
           if (graphs_listed)
             http (', inout sorted_good_graphs any', ses);
           http (')\n', ses);
@@ -5768,6 +6440,8 @@ create procedure DB.DBA.SPARQL_DESC_DICT_SPO (in subj_dict any, in consts any, i
             {
               http ('  define input:named-graph-exclude <' || id_to_iri_nosignal (g) || '>\n', ses);
             }
+          if (inf_ruleset is not null)
+              http ('  define input:inference <' || inf_ruleset || '>\n', ses);
           http ('select ?g1 ?p1 ?o1\n', ses);
           http ('      where { graph ?g1 {\n', ses);
           for (map_ctr := 0; map_ctr < maps_len; map_ctr := map_ctr + 1)
@@ -5775,9 +6449,9 @@ create procedure DB.DBA.SPARQL_DESC_DICT_SPO (in subj_dict any, in consts any, i
               if (map_ctr > 0) http ('              union\n', ses);
               http ('              { quad map <' || maps[map_ctr][0] || '> { ?:subj_iri ?p1 ?o1 } }\n', ses);
             }
-          http ('            } } ) do { ', ses);
+          http ('            } } ) do {\n', ses);
           if (graphs_listed)
-            http ('      if (position ("g1", sorted_good_graphs))\n', ses);
+            http ('      if (position (__i2idn ("g1"), sorted_good_graphs))\n', ses);
           http ('      dict_put (res, vector (subj, "p1", "o1"), 1); } }\n', ses);
           txt := string_output_string (ses);
           -- dbg_obj_princ ('Procedure text: ', txt);
@@ -6010,12 +6684,13 @@ create procedure DB.DBA.SPARQL_DESC_DICT_CBD (in subj_dict any, in consts any, i
 {
   declare all_subjs, phys_subjects, sorted_good_graphs, sorted_bad_graphs, next_iter_subjs, res any;
   declare uid, graphs_listed, g_ctr, good_g_count, bad_g_count, s_ctr, all_s_count, phys_s_count integer;
-  declare gs_app_callback, gs_app_uid varchar;
+  declare gs_app_callback, gs_app_uid, inf_ruleset varchar;
   declare rdf_type_iid IRI_ID;
   uid := get_keyword ('uid', options, http_nobody_uid());
   gs_app_callback := get_keyword ('gs-app-callback', options);
   if (gs_app_callback is not null)
     gs_app_uid := get_keyword ('gs-app-uid', options);
+  inf_ruleset := get_keyword ('inference', options);
   rdf_type_iid := iri_to_id (UNAME'http://www.w3.org/1999/02/22-rdf-syntax-ns#type');
   res := dict_new ();
   if (isinteger (consts))
@@ -6064,7 +6739,7 @@ next_iteration:
   vectorbld_init (phys_subjects);
   if (isinteger (storage_name))
     storage_name := 'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage';
-  else if ('' = storage_name)
+  else if (('' = storage_name) and (inf_ruleset is null))
     {
       for (s_ctr := 0; s_ctr < all_s_count; s_ctr := s_ctr + 1)
         {
@@ -6091,7 +6766,7 @@ next_iteration:
       maps := sparql_quad_maps_for_quad (NULL, s, NULL, NULL, storage_name, case (graphs_listed) when 0 then vector() else sorted_good_graphs end, sorted_bad_graphs);
       -- dbg_obj_princ ('s = ', s, id_to_iri (s), ' maps = ', maps);
       maps_len := length (maps);
-      if ((maps_len > 0) and (maps[maps_len-1][0] = UNAME'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadMap'))
+      if ((maps_len > 0) and (inf_ruleset is null) and (maps[maps_len-1][0] = UNAME'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadMap'))
         {
           if (isiri_id (s))
             {
@@ -6126,12 +6801,12 @@ next_iteration:
       s := s_desc[0];
       maps := s_desc[1];
       maps_len := length (maps);
-      fname := sprintf ('SPARQL_DESC_DICT_CBD_QMV1_%U', md5 (storage_name || cast (graphs_listed as varchar) || md5_box (maps) || md5_box (sorted_bad_graphs)));
+      fname := sprintf ('SPARQL_DESC_DICT_CBD_QMV1_%U', md5 (storage_name || inf_ruleset || cast (graphs_listed as varchar) || md5_box (maps) || md5_box (sorted_bad_graphs)));
       if (not exists (select top 1 1 from Db.DBA.SYS_PROCEDURES where P_NAME = 'DB.DBA.' || fname))
         {
           declare ses, txt, saved_user any;
           ses := string_output ();
-          http ('create procedure DB.DBA."' || fname || '" (in subj any, inout subj_dict any, inout next_iter_subjs any, inout res any', ses);
+          http ('create procedure DB.DBA."' || fname || '" (in subj any, in subj_dict any, in next_iter_subjs any, in res any', ses);
           if (graphs_listed)
             http (', inout sorted_good_graphs any', ses);
           http (')\n', ses);
@@ -6143,6 +6818,8 @@ next_iteration:
             {
               http ('  define input:named-graph-exclude <' || id_to_iri_nosignal (g) || '>\n', ses);
             }
+          if (inf_ruleset is not null)
+              http ('  define input:inference <' || inf_ruleset || '>\n', ses);
           http ('select ?g1 ?p1 ?o1 ?g2 ?st2\n', ses);
           http ('      where { graph ?g1 {\n', ses);
           for (map_ctr := 0; map_ctr < maps_len; map_ctr := map_ctr + 1)
@@ -6153,20 +6830,19 @@ next_iteration:
           http ('            }\n', ses);
           http ('          optional { graph ?g2 {\n', ses);
           http ('                  ?st2 a rdf:Statement ; rdf:subject ?:subj_iri ; rdf:predicate ?p1 ; rdf:object ?o1 } }\n', ses);
-          http (' } ) do { ', ses);
-          http ('            } } ) do { ', ses);
+          http ('            } ) do {\n', ses);
           if (graphs_listed)
-            http ('      if (position ("g1", sorted_good_graphs)) {\n', ses);
+            http ('      if (position (__i2idn ("g1"), sorted_good_graphs)) {\n', ses);
           http ('      dict_put (res, vector (subj, "p1", "o1"), 1);\n', ses);
           http ('      if (isiri_id ("o1") and "o1" > min_bnode_iri_id() and dict_get (subj_dict, "o1") is null)\n', ses);
           http ('        dict_put (next_iter_subjs, "o1", 1);\n', ses);
           if (graphs_listed)
-            http ('      if (position ("g2", sorted_good_graphs)) {\n', ses);
+            http ('      if (position (__i2idn ("g2"), sorted_good_graphs)) {\n', ses);
           http ('      if ("st2" is not null and dict_get (subj_dict, "st2") is null)\n', ses);
           http ('        dict_put (next_iter_subjs, "o1", 1);\n', ses);
           if (graphs_listed)
             http ('        } }\n', ses);
-          http ('      } } }\n', ses);
+          http ('      } }\n', ses);
           txt := string_output_string (ses);
           -- dbg_obj_princ ('Procedure text: ', txt);
 	  saved_user := user;
@@ -6218,7 +6894,7 @@ describe_physical_subjects:
                             ?st2 a rdf:Statement ; rdf:subject ?:subj ; rdf:predicate ?:p1 ; rdf:object ?:obj1 } } ) do
                     {
                       if (position ("g2", sorted_good_graphs) and dict_get (subj_dict, "st2") is null)
-                        dict_put (next_iter_subjs, st2, 1);
+                        dict_put (next_iter_subjs, "st2", 1);
                     }
                 }
             }
@@ -6249,7 +6925,7 @@ describe_physical_subjects:
                     dict_get (subj_dict, "st2") is null and
                     __rgs_ack_cbk ("g2", uid, 1) and
                     (gs_app_callback is null or bit_and (1, call (gs_app_callback) ("g2", gs_app_uid))) )
-                    dict_put (next_iter_subjs, st2, 1);
+                    dict_put (next_iter_subjs, "st2", 1);
                 }
             }
         }
@@ -6349,7 +7025,7 @@ next_iteration:
                             ?st2 a rdf:Statement ; rdf:subject ?:subj ; rdf:predicate ?:p1 ; rdf:object ?:obj1 } } ) do
                     {
                       if (position ("g2", sorted_good_graphs) and dict_get (subj_dict, "st2") is null)
-                        dict_put (next_iter_subjs, st2, 1);
+                        dict_put (next_iter_subjs, "st2", 1);
                     }
                 }
             }
@@ -6380,7 +7056,7 @@ next_iteration:
                     dict_get (subj_dict, "st2") is null and
                     __rgs_ack_cbk ("g2", uid, 1) and
                     (gs_app_callback is null or bit_and (1, call (gs_app_callback) ("g2", gs_app_uid))) )
-                    dict_put (next_iter_subjs, st2, 1);
+                    dict_put (next_iter_subjs, "st2", 1);
                 }
             }
         }
@@ -6644,10 +7320,10 @@ create function DB.DBA.RDF_DIST_DESER_LONG (in strg any) returns any
 -----
 -- JSO procedures
 
-create function JSO_MAKE_INHERITANCE (in jgraph varchar, in class varchar, in rootinst varchar, in destinst varchar, in dest_iid iri_id, inout noinherits any, inout inh_stack any)
+create function DB.DBA.JSO_MAKE_INHERITANCE (in jgraph varchar, in class varchar, in rootinst varchar, in destinst varchar, in dest_iid iri_id, inout noinherits any, inout inh_stack any)
 {
   declare base_iid iri_id;
-  declare baseinst, "pred" varchar;
+  declare baseinst varchar;
   -- dbg_obj_princ ('JSO_MAKE_INHERITANCE (', jgraph, class, rootinst, destinst, ')');
   inh_stack := vector_concat (inh_stack, vector (destinst));
   baseinst := null;
@@ -6701,23 +7377,22 @@ create function JSO_MAKE_INHERITANCE (in jgraph varchar, in class varchar, in ro
     }
   if (position (baseinst, inh_stack))
     signal ('22023', 'JSO_MAKE_INHERITANCE has found that the object <' || baseinst || '> is recursively inherited from itself');
-/* This fails. !!!TBD: fix sparql2sql.c to preserve data about equalities, fixed values and globals when triples are moved from gp to gp
-  for (sparql
-    define input:storage ""
-    prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#>
-    select ?pred
-    where {
-        graph ?:jgraph {
-            { {
-                ?destnode rdf:type `iri(?:class)` .
-                filter (?destnode = iri(?:destinst)) }
-              union
-              {
-                ?destnode rdf:type `iri(?:class)` .
-                ?destnode rdf:name `iri(?:destinst)` } } .
-            ?destnode virtrdf:noInherit ?pred .
-          } } ) do
-*/
+-- This fails. !!!TBD: fix sparql2sql.c to preserve data about equalities, fixed values and globals when triples are moved from gp to gp
+--  for (sparql
+--    define input:storage ""
+--    prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#>
+--    select ?pred
+--    where {
+--        graph ?:jgraph {
+--            { {
+--                ?destnode rdf:type `iri(?:class)` .
+--                filter (?destnode = iri(?:destinst)) }
+--              union
+--              {
+--                ?destnode rdf:type `iri(?:class)` .
+--                ?destnode rdf:name `iri(?:destinst)` } } .
+--            ?destnode virtrdf:noInherit ?pred .
+--           } } ) do
   for (sparql
     define input:storage ""
     prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#>
@@ -6749,6 +7424,7 @@ create function JSO_MAKE_INHERITANCE (in jgraph varchar, in class varchar, in ro
           ask where { graph ?:jgraph { ?:"t00"."pred_id" virtrdf:loadAs virtrdf:jsoTriple } } )
       ) do
     {
+      declare "pred" any;
       "pred" := id_to_iri ("pred_id");
       if (DB.DBA.RDF_LANGUAGE_OF_LONG ("predval", null) is not null)
         signal ('22023', 'JSO_MAKE_INHERITANCE does not support language marks on objects');
@@ -6766,11 +7442,11 @@ create function JSO_MAKE_INHERITANCE (in jgraph varchar, in class varchar, in ro
           dict_put (noinherits, "pred", baseinst);
         }
     }
-  JSO_MAKE_INHERITANCE (jgraph, class, rootinst, baseinst, base_iid, noinherits, inh_stack);
+  DB.DBA.JSO_MAKE_INHERITANCE (jgraph, class, rootinst, baseinst, base_iid, noinherits, inh_stack);
 }
 ;
 
-create function JSO_LOAD_INSTANCE (in jgraph varchar, in jinst varchar, in delete_first integer, in make_new integer, in jsubj_iid iri_id := 0)
+create function DB.DBA.JSO_LOAD_INSTANCE (in jgraph varchar, in jinst varchar, in delete_first integer, in make_new integer, in jsubj_iid iri_id := 0)
 {
   declare jinst_iid, jgraph_iid IRI_ID;
   declare jclass varchar;
@@ -6850,11 +7526,11 @@ create function JSO_LOAD_INSTANCE (in jgraph varchar, in jinst varchar, in delet
         }
     }
   inh_stack := vector ();
-  JSO_MAKE_INHERITANCE (jgraph, jclass, jinst, jinst, jsubj_iid, noinherits, inh_stack);
+  DB.DBA.JSO_MAKE_INHERITANCE (jgraph, jclass, jinst, jinst, jsubj_iid, noinherits, inh_stack);
 }
 ;
 
-create procedure JSO_LIST_INSTANCES_OF_GRAPH (in jgraph varchar, out instances any)
+create procedure DB.DBA.JSO_LIST_INSTANCES_OF_GRAPH (in jgraph varchar, out instances any)
 {
   declare md, res, st, msg any;
   st:= '00000';
@@ -6884,13 +7560,13 @@ create procedure JSO_LIST_INSTANCES_OF_GRAPH (in jgraph varchar, out instances a
 }
 ;
 
-create function JSO_LOAD_GRAPH (in jgraph varchar, in pin_now integer := 1)
+create function DB.DBA.JSO_LOAD_GRAPH (in jgraph varchar, in pin_now integer := 1)
 {
   declare jgraph_iid IRI_ID;
   declare instances, chk any;
   -- dbg_obj_princ ('JSO_LOAD_GRAPH (', jgraph, ')');
   jgraph_iid := iri_ensure (jgraph);
-  JSO_LIST_INSTANCES_OF_GRAPH (jgraph, instances);
+  DB.DBA.JSO_LIST_INSTANCES_OF_GRAPH (jgraph, instances);
 /* Pass 1. Deleting all obsolete instances. */
   foreach (any j in instances) do
     jso_delete (j[0], j[1], 1);
@@ -6899,7 +7575,7 @@ create function JSO_LOAD_GRAPH (in jgraph varchar, in pin_now integer := 1)
     jso_new (j[0], j[1]);
 /* Pass 3. Loading all instances, including loading inherited values. */
   foreach (any j in instances) do
-    JSO_LOAD_INSTANCE (jgraph, j[1], 0, 0, j[2]);
+    DB.DBA.JSO_LOAD_INSTANCE (jgraph, j[1], 0, 0, j[2]);
 /* Pass 4. Validation all instances. */
   foreach (any j in instances) do
     jso_validate (j[0], j[1], 1);
@@ -6924,39 +7600,39 @@ create function JSO_LOAD_GRAPH (in jgraph varchar, in pin_now integer := 1)
 }
 ;
 
-create function JSO_PIN_GRAPH (in jgraph varchar)
+create function DB.DBA.JSO_PIN_GRAPH (in jgraph varchar)
 {
   declare instances any;
-  JSO_LIST_INSTANCES_OF_GRAPH (jgraph, instances);
+  DB.DBA.JSO_LIST_INSTANCES_OF_GRAPH (jgraph, instances);
   foreach (any j in instances) do
     jso_pin (j[0], j[1]);
 }
 ;
 
 --!AWK PUBLIC
-create function JSO_SYS_GRAPH () returns varchar
+create function DB.DBA.JSO_SYS_GRAPH () returns varchar
 {
   return 'http://www.openlinksw.com/schemas/virtrdf#';
 }
 ;
 
--- same as JSO_LOAD_AND_PIN_SYS_GRAPH but no drop procedures
-create procedure JSO_LOAD_AND_PIN_SYS_GRAPH_RO (in graphiri varchar := null)
+-- same as DB.DBA.JSO_LOAD_AND_PIN_SYS_GRAPH but no drop procedures
+create procedure DB.DBA.JSO_LOAD_AND_PIN_SYS_GRAPH_RO (in graphiri varchar := null)
 {
   if (graphiri is null)
-    graphiri := JSO_SYS_GRAPH();
-  JSO_LOAD_GRAPH (graphiri, 0);
-  JSO_PIN_GRAPH (graphiri);
+    graphiri := DB.DBA.JSO_SYS_GRAPH();
+  DB.DBA.JSO_LOAD_GRAPH (graphiri, 0);
+  DB.DBA.JSO_PIN_GRAPH (graphiri);
 }
 ;
 
-create procedure JSO_LOAD_AND_PIN_SYS_GRAPH (in graphiri varchar := null)
+create procedure DB.DBA.JSO_LOAD_AND_PIN_SYS_GRAPH (in graphiri varchar := null)
 {
   if (graphiri is null)
-    graphiri := JSO_SYS_GRAPH();
+    graphiri := DB.DBA.JSO_SYS_GRAPH();
   commit work;
-  JSO_LOAD_GRAPH (graphiri, 0);
-  JSO_PIN_GRAPH (graphiri);
+  DB.DBA.JSO_LOAD_GRAPH (graphiri, 0);
+  DB.DBA.JSO_PIN_GRAPH (graphiri);
   for (select P_NAME from SYS_PROCEDURES
     where (
       (P_NAME like 'DB.DBA.SPARQL_DESC_DICT_QMV1_%') or
@@ -6969,7 +7645,7 @@ create procedure JSO_LOAD_AND_PIN_SYS_GRAPH (in graphiri varchar := null)
 }
 ;
 
-create function JSO_DUMP_IRI (in v varchar, inout ses any)
+create function DB.DBA.JSO_DUMP_IRI (in v varchar, inout ses any)
 {
 --            0         1         2         3      %
 --            01234567890123456789012345678901234567-
@@ -7001,14 +7677,14 @@ create function JSO_DUMP_IRI (in v varchar, inout ses any)
 }
 ;
 
-create function JSO_DUMP_FLD (in v any, inout ses any)
+create function DB.DBA.JSO_DUMP_FLD (in v any, inout ses any)
 {
   declare v_tag integer;
   v_tag := __tag(v);
   if (v_tag = 217)
-    JSO_DUMP_IRI (cast (v as varchar), ses);
+    DB.DBA.JSO_DUMP_IRI (cast (v as varchar), ses);
   else if (v_tag = 243)
-    JSO_DUMP_IRI (id_to_iri (v), ses);
+    DB.DBA.JSO_DUMP_IRI (id_to_iri (v), ses);
   else if (v_tag = 203)
     http (jso_dbg_dump_rtti (v), ses);
   else if (v_tag = __tag of varchar)
@@ -7063,12 +7739,12 @@ create function DB.DBA.JSO_VECTOR_TO_TTL (inout proplist any) returns any
           else
 	    http ('.\n', ses);
 	  prev_obj := obj;
-	  JSO_DUMP_FLD (obj, ses);
+	  DB.DBA.JSO_DUMP_FLD (obj, ses);
           http ('\n  ', ses);
 	}
-      JSO_DUMP_FLD (p, ses);
+      DB.DBA.JSO_DUMP_FLD (p, ses);
       http ('\t', ses);
-      JSO_DUMP_FLD (o, ses);
+      DB.DBA.JSO_DUMP_FLD (o, ses);
     }
   if (prev_obj is not null)
     http ('.\n', ses);
@@ -9165,7 +9841,7 @@ create function DB.DBA.RDF_QM_DEFINE_MAPPING (in storage varchar,
         {
           tablename := 'DB.DBA.SYS_FAKE_1';
           if (0 < length (conds))
-            signal ('22023', 'Quad Mapping <' || qmid || '> has four constants and no one quad map value; it do not access tables so it can not have WHERE conditions');
+            signal ('22023', 'Quad Mapping <' || qmid || '> has four constants and no one quad map value; it does not access tables so it can not have WHERE conditions');
         }
     }
   if ('' = tablename)
@@ -9269,6 +9945,7 @@ create function DB.DBA.RDF_QM_DEFINE_MAPPING (in storage varchar,
           `iri(?:qmcondsid)`
             `iri (bif:sprintf ("%s%d", str (rdf:_), ?:condctr+1))` ?:sqlcond };
     }
+  DB.DBA.RDF_ADD_qmAliasesKeyrefdByQuad (qmid);
   if (qm_is_default is not null)
     DB.DBA.RDF_QM_SET_DEFAULT_MAPPING (storage, qmid);
   else
@@ -9506,6 +10183,79 @@ create procedure DB.DBA.RDF_QM_SET_DEFAULT_MAPPING (in storage varchar, in qmid
 }
 ;
 
+create procedure DB.DBA.RDF_ADD_qmAliasesKeyrefdByQuad (in qm_iri varchar)
+{
+  declare kr_iri varchar;
+  declare good_ctr, all_ctr integer;
+  kr_iri := qm_iri || '--qmAliasesKeyrefdByQuad';
+  sparql define input:storage "" delete from virtrdf: { `iri(?:kr_iri)` ?p ?o } from virtrdf: where { `iri(?:kr_iri)` ?p ?o };
+  sparql define input:storage "" insert in virtrdf: { `iri(?:qm_iri)` virtrdf:qmAliasesKeyrefdByQuad `iri(?:kr_iri)` . `iri(?:kr_iri)` a virtrdf:array-of-string };
+  good_ctr := 0;
+  all_ctr := 0;
+  for ( sparql define input:storage ""
+    select ?alias ?tbl (sql:VECTOR_AGG (str(?col))) as ?cols
+    from virtrdf:
+    where {
+        `iri(?:qm_iri)` a virtrdf:QuadMap ;
+          ?fld_p ?qmv .
+        filter (?fld_p in (virtrdf:qmGraphMap , virtrdf:qmSubjectMap , virtrdf:qmPredicateMap , virtrdf:qmObjectMap))
+        ?qmv a virtrdf:QuadMapValue ;
+          virtrdf:qmvATables [
+              ?qmvat_p [ a virtrdf:QuadMapATable ;
+                  virtrdf:qmvaAlias ?alias ;
+                  virtrdf:qmvaTableName ?tbl ] ] ;
+          virtrdf:qmvColumns [
+              ?qmvc_p [ a virtrdf:QuadMapColumn ;
+                  virtrdf:qmvcAlias ?alias ;
+                  virtrdf:qmvcColumnName ?col ] ] ;
+          virtrdf:qmvFormat [ a virtrdf:QuadMapFormat ;
+              virtrdf:qmfIsBijection ?bij ] .
+        filter (?bij != 0)
+      } ) do
+    {
+      -- dbg_obj_princ ('Quad map ', "qm_iri", ' has alias ', "alias", ' of table ', "tbl", ' with cols ', "cols");
+      all_ctr := all_ctr + 1;
+      for (select KEY_ID, KEY_N_SIGNIFICANT from DB.DBA.SYS_KEYS where KEY_TABLE = "tbl" and KEY_IS_UNIQUE) do
+        {
+          for (select "COLUMN" from DB.DBA.SYS_KEY_PARTS, DB.DBA.SYS_COLS
+            where  KP_KEY_ID = KEY_ID and KP_NTH < KEY_N_SIGNIFICANT and COL_ID = KP_COL ) do
+            {
+              if (not position ("COLUMN", "cols"))
+                {
+                  -- dbg_obj_princ ("COLUMN", ' not in ', "cols");
+                  goto wrong_key;
+                }
+            }
+          good_ctr := good_ctr + 1;
+          -- dbg_obj_princ ('Quad map ', qm_iri, ' can identify source rows in alias ', "alias", ' of table ', "tbl");
+          sparql define input:storage "" insert in virtrdf: { `iri(?:kr_iri)` `iri(bif:sprintf("%s%d", str(rdf:_), ?:good_ctr))` ?:"alias" };
+          goto right_key;
+wrong_key: ;
+        }
+right_key: ;
+    }
+  -- dbg_obj_princ ('Quad map ', qm_iri, ' can identify source rows in ', good_ctr, ' of ', all_ctr, ' its aliases with bijections.');
+}
+;
+
+create procedure DB.DBA.RDF_UPGRADE_QUAD_MAP (in qm_iri varchar)
+{
+  declare keyrefd any;
+  if (not exists (sparql define input:storage "" select (1) from virtrdf: where { `iri(?:qm_iri)` a virtrdf:QuadMap }))
+    signal ('RDFxx', sprintf ('Quad map <%s> does not exist, nothing to upgrade', qm_iri));
+  if (not exists (sparql define input:storage "" select (1) from virtrdf: where { `iri(?:qm_iri)` virtrdf:qmAliasesKeyrefdByQuad ?keyrefs }))
+    DB.DBA.RDF_ADD_qmAliasesKeyrefdByQuad (qm_iri);
+}
+;
+
+create procedure DB.DBA.RDF_UPGRADE_METADATA ()
+{
+  for (sparql define input:storage "" select ?qm_iri from virtrdf: where { ?qm_iri a virtrdf:QuadMap }) do
+    {
+      DB.DBA.RDF_UPGRADE_QUAD_MAP ("qm_iri");
+    }
+}
+;
 
 -----
 -- RDF parallel load
@@ -9519,6 +10269,9 @@ create procedure DB.DBA.TTLP_EV_TRIPLE_W (
   declare log_mode integer;
   declare s_iid, p_iid, o_iid IRI_ID;
   log_mode := env[0];
+  if (isstring (registry_get ('DB.DBA.RDF_REPL')))
+    repl_publish ('__rdf_repl', '__rdf_repl.log');
+
   if (log_mode = 1)
     {
       whenever sqlstate '40001' goto deadlock_1;
@@ -9652,6 +10405,10 @@ create procedure DB.DBA.TTLP_EV_NEW_GRAPH_A (inout g varchar, inout g_iid IRI_ID
     app_env[2][1] := dict_new (app_env[3]);
   else
     app_env[2][1] := null;
+  if (__rdf_graph_is_in_enabled_repl (g_iid))
+    app_env[4] := g;
+  else
+    app_env[4] := null;
 }
 ;
 
@@ -9661,6 +10418,8 @@ create procedure DB.DBA.TTLP_EV_TRIPLE_A (
   inout app_env any )
 {
   -- dbg_obj_princ ('DB.DBA.TTLP_EV_TRIPLE_A (', g_iid, s_uri, p_uri, o_uri, app_env, ')');
+  if (app_env[4] is not null)
+    __rdf_repl_quad (84, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), iri_canonicalize (o_uri));
   app_env[1] := aq_request (
     app_env[0], 'DB.DBA.TTLP_EV_TRIPLE_W',
     vector (g_iid, s_uri, p_uri, o_uri, app_env[2]) );
@@ -9682,6 +10441,15 @@ create procedure DB.DBA.TTLP_EV_TRIPLE_L_A (
   inout app_env any )
 {
   -- dbg_obj_princ ('DB.DBA.TTLP_EV_TRIPLE_L_A (', g_iid, s_uri, p_uri, o_val, o_type, o_lang, app_env, ')');
+  if (app_env[4] is not null)
+    {
+      if (isstring (o_type))
+        __rdf_repl_quad (81, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val, iri_canonicalize (o_type), NULL);
+      else if (isstring (o_lang))
+        __rdf_repl_quad (82, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val, null, o_lang);
+      else
+        __rdf_repl_quad (80, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val);
+    }
   if (__tag of XML = __tag (o_val))
     {
       DB.DBA.TTLP_EV_TRIPLE_L_W (g_iid, s_uri, p_uri, o_val, o_type, o_lang, app_env[2]);
@@ -9714,6 +10482,69 @@ create procedure DB.DBA.TTLP_EV_COMMIT_A (
 }
 ;
 
+-- for replication should not use AQ
+create procedure DB.DBA.TTLP_EV_TRIPLE_R (
+  inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,
+  inout o_uri varchar,
+  inout app_env any )
+{
+  -- dbg_obj_princ ('DB.DBA.TTLP_EV_TRIPLE_A (', g_iid, s_uri, p_uri, o_uri, app_env, ')');
+  if (app_env[4] is not null)
+    __rdf_repl_quad (84, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), iri_canonicalize (o_uri));
+  commit work;
+  app_env[1] := coalesce (app_env[1], 0) + 1;
+  DB.DBA.TTLP_EV_TRIPLE_W (g_iid, s_uri, p_uri, o_uri, app_env[2]);
+  if (mod (app_env[1], 100000) = 0)
+    {
+      declare ro_id_dict any;
+      ro_id_dict := app_env[2][1];
+      if (ro_id_dict is not null)
+        DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH (g_iid, ro_id_dict);
+    }
+}
+;
+
+create procedure DB.DBA.TTLP_EV_TRIPLE_L_R (
+  inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,
+  inout o_val any, inout o_type varchar, inout o_lang varchar,
+  inout app_env any )
+{
+  -- dbg_obj_princ ('DB.DBA.TTLP_EV_TRIPLE_L_A (', g_iid, s_uri, p_uri, o_val, o_type, o_lang, app_env, ')');
+  if (app_env[4] is not null)
+    {
+      if (isstring (o_type))
+        __rdf_repl_quad (81, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val, iri_canonicalize (o_type), NULL);
+      else if (isstring (o_lang))
+        __rdf_repl_quad (82, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val, null, o_lang);
+      else
+        __rdf_repl_quad (80, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val);
+    }
+  commit work;
+  if (__tag of XML = __tag (o_val))
+    {
+      DB.DBA.TTLP_EV_TRIPLE_L_W (g_iid, s_uri, p_uri, o_val, o_type, o_lang, app_env[2]);
+      return;
+    }
+  app_env[1] := coalesce (app_env[1], 0) + 1;
+  DB.DBA.TTLP_EV_TRIPLE_L_W (g_iid, s_uri, p_uri, o_val, o_type, o_lang, app_env[2]);
+  if (mod (app_env[1], 100000) = 0)
+    {
+      declare ro_id_dict any;
+      ro_id_dict := app_env[2][1];
+      if (ro_id_dict is not null)
+        DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH (g_iid, ro_id_dict);
+    }
+}
+;
+
+create procedure DB.DBA.TTLP_EV_COMMIT_R (
+  inout graph_iri varchar, inout app_env any )
+{
+  -- dbg_obj_princ ('DB.DBA.TTLP_EV_COMMIT_A (', graph_iri, app_env, ')');
+  DB.DBA.TTLP_EV_COMMIT (graph_iri, app_env[2]);
+}
+;
+
 create function DB.DBA.TTLP_MT (in strg varchar, in base varchar, in graph varchar := null, in flags integer := 0,
 				 in log_mode integer := 2, in threads integer := 3, in transactional int := 0)
 {
@@ -9738,7 +10569,11 @@ create function DB.DBA.TTLP_MT (in strg varchar, in base varchar, in graph varch
     }
   if (126 = __tag (strg))
     strg := cast (strg as varchar);
-  app_env := vector (async_queue (threads), 0, vector (log_mode, null), __max (length (strg) / 100, 100000));
+  app_env := vector ( async_queue (threads), -- #0
+    0, -- #1
+    vector (log_mode, null), -- #2
+    __max (length (strg) / 100, 100000), -- #3
+    null ); -- #4
   rdf_load_turtle (strg, base, graph, flags,
     vector (
       'DB.DBA.TTLP_EV_NEW_GRAPH_A',
@@ -9749,6 +10584,8 @@ create function DB.DBA.TTLP_MT (in strg varchar, in base varchar, in graph varch
       'DB.DBA.TTLP_EV_COMMIT_A',
       'DB.DBA.TTLP_EV_REPORT_DEFAULT' ),
     app_env);
+  if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))
+    repl_text ('__rdf_repl', '__rdf_repl_flush_queue ()');
   return graph;
 }
 ;
@@ -9775,7 +10612,12 @@ create function DB.DBA.TTLP_MT_LOCAL_FILE (in filename varchar, in base varchar,
       DB.DBA.TTLP_CL_LOCAL_FILE (filename, base, graph, flags);
       return;
     }
-  app_env := vector (async_queue (threads), 0, vector (log_mode, null), 1000000);
+  app_env := vector (
+    async_queue (threads),
+    0,
+    vector (log_mode, null),
+    1000000,
+    null );
   rdf_load_turtle_local_file (filename, base, graph, flags,
     vector (
       'DB.DBA.TTLP_EV_NEW_GRAPH_A',
@@ -9786,6 +10628,8 @@ create function DB.DBA.TTLP_MT_LOCAL_FILE (in filename varchar, in base varchar,
       'DB.DBA.TTLP_EV_COMMIT_A',
       'DB.DBA.TTLP_EV_REPORT_DEFAULT' ),
     app_env);
+  if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))
+    repl_text ('__rdf_repl', '__rdf_repl_flush_queue ()');
   return graph;
 }
 ;
@@ -9813,7 +10657,12 @@ create function DB.DBA.RDF_LOAD_RDFXML_MT (in strg varchar, in base varchar, in
     ro_id_dict := dict_new ();
   else
     ro_id_dict := null;
-  app_env := vector (async_queue (threads), 0, vector (log_mode, ro_id_dict), __max (length (strg) / 100, 100000));
+  app_env := vector (
+    async_queue (threads),
+    0,
+    vector (log_mode, ro_id_dict),
+    __max (length (strg) / 100, 100000),
+    null );
   rdf_load_rdfxml (strg, 0,
     graph,
     vector (
@@ -9826,6 +10675,8 @@ create function DB.DBA.RDF_LOAD_RDFXML_MT (in strg varchar, in base varchar, in
       'DB.DBA.TTLP_EV_REPORT_DEFAULT' ),
     app_env,
     base );
+  if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))
+    repl_text ('__rdf_repl', '__rdf_repl_flush_queue ()');
   return graph;
 }
 ;
@@ -10774,6 +11625,8 @@ create procedure DB.DBA.RDF_DEFAULT_USER_PERMS_SET (in uname varchar, in perms i
 --      for (select RGU_GRAPH_IID, RGU_USER_ID, RGU_PERMISSIONS from DB.DBA.RDF_GRAPH_USER where RGU_USER_ID <> uid and RGU_GRAPH_IID <> #i0 and bit_and (bit_not (RGU_PERMISSIONS), perms) <> 0)
 --        signal ('RDF99', sprintf ('Default permissions of unauthenticated user ("nobody") on RDF quad store can not become broader than permissions of user %s (UID %d) on specific graph <%s>',
 --          (select top 1 U_NAME from Db.DBA.SYS_USER where U_ID = RGU_USER_ID), RGU_USER_ID, id_to_iri (RGU_GRAPH_IID) ) );
+      if (isstring (registry_get ('DB.DBA.RDF_REPL')) and not (bit_and (perms, 1)))
+        signal ('RDF99', 'Can not disable public read while RDF replication is enabled');
     }
   if (uname <> 'dba')
     {
@@ -10840,7 +11693,13 @@ create procedure DB.DBA.RDF_GRAPH_USER_PERMS_SET (in graph_iri varchar, in uname
   if (bit_and (bit_not (perms), common_perms))
     signal ('RDF99', sprintf ('Default permissions of user "%s" on RDF quad store are broader than new permissions on specific graph <%s>', uname, graph_iri));
   if (uname = 'nobody')
+    {
     jso_mark_affected (graph_iri);
+      if (isstring (registry_get ('DB.DBA.RDF_REPL')) and not (bit_and (perms, 1)) and
+        exists (select top 1 1 from DB.DBA.RDF_GRAPH_GROUP_MEMBER
+          where RGGM_GROUP_IID = iri_to_id (UNAME'http://www.openlinksw.com/schemas/virtrdf#rdf_repl_graph_group') and RGGM_MEMBER_IID = graph_iid) )
+        signal ('RDF99', 'Can not disable public read access to <' || id_to_iri (graph_iid) || '> while it is included in RDF replication and the replication is enabled');
+    }
   else
     {
       common_perms := coalesce (
@@ -10989,7 +11848,7 @@ create procedure DB.DBA.SPARQL_RELOAD_QM_GRAPH ()
 {
   declare ver varchar;
   declare inx int;
-  ver := '2010-03-22 0003v6g';
+  ver := '2010-08-29 0001v6g';
   if (USER <> 'dba')
     signal ('RDFXX', 'Only DBA can reload quad map metadata');
   if (not exists (sparql define input:storage "" ask where {
@@ -11026,6 +11885,12 @@ virtrdf:DefaultServiceStorage
   virtrdf:qsMatchingFlags virtrdf:SPART_QS_NO_IMPLICIT_USER_QM .
 virtrdf:DefaultServiceStorage-UserMaps
   rdf:type virtrdf:array-of-QuadMap .
+
+virtrdf:SyncToQuads
+  rdf:type virtrdf:QuadStorage ;
+  virtrdf:qsUserMaps virtrdf:SyncToQuads-UserMaps .
+virtrdf:SyncToQuads-UserMaps
+  rdf:type virtrdf:array-of-QuadMap .
       ';
       jso_sys_g_iid := iri_to_id (JSO_SYS_GRAPH ());
       dict1 := DB.DBA.RDF_TTL2HASH (txt1, '');
@@ -11170,6 +12035,7 @@ create procedure DB.DBA.RDF_CREATE_SPARQL_ROLES ()
     'grant execute on DB.DBA.RDF_GRAPH_TO_TTL to SPARQL_SELECT',
     'grant execute on DB.DBA.RDF_TRIPLES_TO_RDF_XML_TEXT to SPARQL_SELECT',
     'grant execute on DB.DBA.RDF_TRIPLES_TO_TALIS_JSON to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_TRIPLES_TO_CSV to SPARQL_SELECT',
     'grant execute on DB.DBA.RDF_TRIPLES_TO_RDFA_XHTML to SPARQL_SELECT',
     'grant execute on DB.DBA.RDF_TRIPLES_TO_ATOM_XML_TEXT to SPARQL_SELECT',
     'grant execute on DB.DBA.RDF_TRIPLES_TO_ODATA_JSON to SPARQL_SELECT',
@@ -11185,9 +12051,22 @@ create procedure DB.DBA.RDF_CREATE_SPARQL_ROLES ()
     'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_INIT to SPARQL_SELECT',
     'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_ACC to SPARQL_SELECT',
     'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_FIN to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_INIT to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_ACC to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_FIN to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_INIT to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_ACC to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_FIN to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_ATOM_XML to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_ODATA_JSON to SPARQL_SELECT',
     'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TTL to SPARQL_SELECT',
     'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_NT to SPARQL_SELECT',
     'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_RDF_XML to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TALIS_JSON to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CSV to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_RDFA_XHTML to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CXML to SPARQL_SELECT',
+    'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CXML_QRCODE to SPARQL_SELECT',
     'grant execute on DB.DBA.RDF_INSERT_TRIPLES to SPARQL_UPDATE',
     'grant execute on DB.DBA.RDF_DELETE_TRIPLES to SPARQL_UPDATE',
     'grant execute on DB.DBA.RDF_DELETE_TRIPLES_AGG to SPARQL_UPDATE',
@@ -11224,6 +12103,7 @@ create procedure DB.DBA.RDF_CREATE_SPARQL_ROLES ()
     'grant execute on DB.DBA.TTLP_EV_NEW_GRAPH_A to SPARQL_UPDATE',
     'grant execute on DB.DBA.TTLP_EV_TRIPLE_A to SPARQL_UPDATE',
     'grant execute on DB.DBA.TTLP_EV_TRIPLE_L_A to SPARQL_UPDATE',
+    'grant execute on DB.DBA.TTLP_EV_REPORT_DEFAULT to SPARQL_UPDATE',
     'grant execute on DB.DBA.RDF_LOAD_RDFXML_MT to SPARQL_UPDATE',
     'grant execute on DB.DBA.RDF_LOAD_HTTP_RESPONSE to SPARQL_UPDATE',
     'grant execute on DB.DBA.RDF_FORGET_HTTP_RESPONSE to SPARQL_UPDATE',
@@ -11347,13 +12227,6 @@ create procedure DB.DBA.RDF_QUAD_FT_UPGRADE ()
     from DB.DBA.RDF_GRAPH_USER where RGU_USER_ID = http_nobody_uid () );
   fake := (select count (__rdf_graph_specific_perms_of_user (RGU_GRAPH_IID, RGU_USER_ID, RGU_PERMISSIONS))
     from DB.DBA.RDF_GRAPH_USER where RGU_USER_ID <> http_nobody_uid () and not (RGU_GRAPH_IID in (#i0, #i8192)) );
-  if (1 <> sys_stat ('cl_run_local_only'))
-    goto final_qm_reload;
-  if (244 = coalesce ((select COL_DTP from SYS_COLS where "TABLE" = 'DB.DBA.RDF_QUAD' and "COLUMN"='G'), 0))
-    {
-      __set_64bit_min_bnode_iri_id();
-      sequence_set ('RDF_URL_IID_BLANK', iri_id_num (min_bnode_iri_id ()), 1);
-    }
   if (coalesce (cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'RecoveryMode'), '0') > '0')
     {
       log_message ('Switching to RecoveryMode as set in [SPARQL] section of the configuration.');
@@ -11361,36 +12234,13 @@ create procedure DB.DBA.RDF_QUAD_FT_UPGRADE ()
       exec ('revoke "SPARQL_UPDATE" from "SPARQL"', stat, msg);
       return;
     }
-  if (not isstring (registry_get ('DB.DBA.RDF_QUAD_FT_UPGRADE-tridgell32-2')))
+  if (1 <> sys_stat ('cl_run_local_only'))
+    goto final_qm_reload;
+  if (244 = coalesce ((select COL_DTP from SYS_COLS where "TABLE" = 'DB.DBA.RDF_QUAD' and "COLUMN"='G'), 0))
     {
-      __atomic (1);
-      {
-      set isolation='uncommitted';
-        declare exit handler for sqlstate '*'
-          {
-            log_message ('Error during upgrade of RDF_OBJ:');
-            log_message (__SQL_STATE || ': ' || "LEFT" (__SQL_MESSAGE, 1000));
-            goto describe_recovery;
-          };
-        declare rolong_cur cursor for select RO_VAL, RO_LONG from DB.DBA.RDF_OBJ where RO_LONG is not null and length (RO_VAL) = 6 for update;
-        whenever not found goto rolong_cur_end;
-        open rolong_cur;
-        while (1)
-          {
-            declare rl any;
-            declare old_rv, new_rv varchar;
-            fetch rolong_cur into old_rv, rl;
-            new_rv := tridgell32 (blob_to_string (rl));
-            if (new_rv <> old_rv)
-            update DB.DBA.RDF_OBJ set RO_VAL = new_rv where current of rolong_cur;
-          }
-rolong_cur_end: ;
-        registry_set ('DB.DBA.RDF_QUAD_FT_UPGRADE-tridgell32-2', '1');
-      }
-      __atomic (0);
-      exec ('checkpoint');
+      __set_64bit_min_bnode_iri_id();
+      sequence_set ('RDF_URL_IID_BLANK', iri_id_num (min_bnode_iri_id ()), 1);
     }
-tridgell_ok:
   --exec ('create index RO_DIGEST on DB.DBA.RDF_OBJ (RO_DIGEST)', stat, msg);
   if (exists (select top 1 1 from DB.DBA.SYS_COLS
     where "TABLE" = fix_identifier_case ('DB.DBA.RDF_OBJ_RO_FLAGS_WORDS')
@@ -11407,125 +12257,6 @@ tridgell_ok:
     0, 0, vector (), 1, ''*ini*'', ''UTF-8-QR'')', stat, msg);
   __vt_index ('DB.DBA.RDF_QUAD', 'RDF_QUAD_OP', 'O', 'O', 'DB.DBA.RDF_OBJ_RO_FLAGS_WORDS');
   exec ('DB.DBA.vt_batch_update (fix_identifier_case (''DB.DBA.RDF_OBJ''), ''ON'', 1)', stat, msg);
-  if (isstring (registry_get ('DB.DBA.RDF_QUAD_FT_UPGRADE')))
-    goto final_qm_reload;
-  __atomic (1);
-  {
-  declare exit handler for sqlstate '*'
-    {
-      log_message ('Error during upgrade of free-text index of RDF_QUAD:');
-      log_message (__SQL_STATE || ': ' || "LEFT" (__SQL_MESSAGE, 1000));
-      goto describe_recovery;
-    };
---  checkpoint;
-  log_enable (0);
-  if (exists (select top 1 1 from DB.DBA.RDF_QUAD))
-    log_message ('Upgrading RDF indices.  Can be up to an hour per GB of RDF data.');
-  registry_set ('DB.DBA.RDF_QUAD_FT_UPGRADE', '1');
-  if (exists (select top 1 1 from DB.DBA.SYS_COLS
-    where "TABLE" = fix_identifier_case ('DB.DBA.RDF_OBJ')
-    and "COLUMN" = fix_identifier_case ('RO_DIGEST')
-    and COL_DTP = __tag of varchar ))
-    {
-      exec ('drop index RO_DIGEST', stat, msg);
-      exec ('alter table DB.DBA.RDF_OBJ drop RO_DIGEST', stat, msg);
---      exec ('alter table DB.DBA.RDF_OBJ add RO_DIGEST any', stat, msg);
-      exec ('alter table DB.DBA.RDF_OBJ add RO_FLAGS smallint not null default 0', stat, msg);
-      exec ('alter table DB.DBA.RDF_OBJ add RO_DT_AND_LANG integer not null default 16843009', stat, msg);
---      exec ('create index RO_DIGEST on DB.DBA.RDF_OBJ (RO_DIGEST)', stat, msg);
-      commit work;
-    }
-  set isolation='uncommitted';
-  {
-    declare longtyped_cur cursor for select G,S,P,O
-    from DB.DBA.RDF_QUAD
-    where isstring (O) and length (O) = 29;
-    declare g_old, s_old, p_old any;
-    declare o_old varchar;
-    declare val_len, o_id integeR;
-    declare o_new any;
-    whenever not found goto longtyped_cur_end;
-    open longtyped_cur;
-    while (1)
-      {
-        declare o_long any;
-        declare o_strval varchar;
-        fetch longtyped_cur into g_old, s_old, p_old, o_old;
-        -- dbg_obj_princ ('o_old (longtyped) = ', o_old);
-        if (o_old [22] <> 0)
-          {
-            log_message ('The function DB.DBA.RDF_QUAD_FT_UPGRADE() has found ill formed object literal in DB.DBA.RDF_QUAD');
-            log_message ('This means that this version of Virtuoso server can not process RDF data stored in the database.');
-            log_message ('To fix the problem, remove the transaction log and start previous version of Virtuoso.');
-            log_message (sprintf ('The example of ill literal is |%U|, if escaped like URL', o_old));
-            goto describe_recovery;
-          }
-        o_long := jso_parse_digest (o_old);
-        o_strval := (select case (isnull (RO_LONG)) when 0 then blob_to_string (RO_LONG) else RO_VAL end from DB.DBA.RDF_OBJ where RO_ID = o_long[3]);
-        o_new := DB.DBA.RDF_OBJ_ADD (o_long[0], o_strval, o_long[2]);
-        insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_old, s_old, p_old, o_new);
-      }
-longtyped_cur_end: ;
-  }
-  delete from DB.DBA.RDF_QUAD where isstring (O) and length (O) = 29;
---  checkpoint;
-  {
-    declare shortobj_cur cursor for select G,S,P,O from DB.DBA.RDF_QUAD where isstring (O) and length (O) < 29;
-    declare g_old, s_old, p_old any;
-    declare o_old varchar;
-    declare val_len, o_id integeR;
-    declare o_new any;
-    whenever not found goto shortobj_cur_end;
-    open shortobj_cur;
-    while (1)
-      {
-        declare o_dt, o_lang integeR;
-        fetch shortobj_cur into g_old, s_old, p_old, o_old;
-        val_len := length (o_old) - 5;
-        if (o_old [val_len+2] <> 0)
-          {
-            log_message ('The function DB.DBA.RDF_QUAD_FT_UPGRADE() has found ill formed object literal in DB.DBA.RDF_QUAD');
-            log_message ('This means that this version of Virtuoso server can not process RDF data stored in the database.');
-            log_message ('To fix the problem, remove the transaction log and start previous version of Virtuoso.');
-            log_message (sprintf ('The example of ill literal is |%U|, if escaped like URL', o_old));
-            goto describe_recovery;
-          }
-        o_dt := o_old[0] + o_old[1]*256;
-        o_lang := o_old[val_len+3] + o_old[val_len+4]*256;
-        o_new := DB.DBA.RDF_OBJ_ADD (o_dt, subseq (o_old, 2, val_len+2), o_lang);
-        if (isstring (o_new))
-          insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_old, s_old, p_old, o_new || '012345678901234567890123456789');
-        else
-          insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_old, s_old, p_old, o_new);
-        commit work;
-      }
-shortobj_cur_end: ;
-  }
-  delete from DB.DBA.RDF_QUAD where isstring (O) and length (O) < 29;
---  checkpoint;
-  {
-    declare tmpval_cur cursor for select G,S,P,O
-    from DB.DBA.RDF_QUAD
-    where isstring (O) and length (O) > 29;
-    declare g_old, s_old, p_old any;
-    declare o_old varchar;
-    whenever not found goto tmpval_cur_end;
-    open tmpval_cur;
-    while (1)
-      {
-        fetch tmpval_cur into g_old, s_old, p_old, o_old;
-        -- dbg_obj_princ ('o_old (tmp) = ', o_old);
-        insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_old, s_old, p_old, subseq (o_old, 0, length (o_old) - 30));
-      }
-tmpval_cur_end: ;
-  }
-  delete from DB.DBA.RDF_QUAD where isstring (O) and length (O) > 29;
---  checkpoint;
-  commit work;
-  log_enable (1);
-  }
-  __atomic (0);
-  exec ('checkpoint');
 
 final_qm_reload:
   DB.DBA.SPARQL_RELOAD_QM_GRAPH ();
@@ -11533,16 +12264,6 @@ final_qm_reload:
     (iri_to_id ('http://www.openlinksw.com/schemas/virtrdf#Geometry'), 256, 'http://www.openlinksw.com/schemas/virtrdf#Geometry');
 
   return;
-
-describe_recovery:
-  log_message ('Remove the transaction log and start previous version of Virtuoso.');
-  log_message ('You may use the database with new version of Virtuoso server for');
-  log_message ('diagnostics and error recovery; to make it possible, add parameter');
-  log_message ('"RecoveryMode=1" to the [SPARQL] section of ' || virtuoso_ini_path ());
-  log_message ('and restart the server; remove the parameter and restart as soon as possible');
-  log_message ('This error is critical. The server will now exit. Sorry.');
-  -- __atomic (0);
-  raw_exit ();
 }
 ;
 
@@ -11608,7 +12329,9 @@ create function rdfs_load_schema (in ri_name varchar, in gn varchar := null) ret
   declare v any;
   declare inx int;
   declare from_text varchar;
+  declare rules_count integer;
   from_text := '';
+  res := 0;
   if (gn is null)
     {
       for (select rs_uri from sys_rdf_schema where rs_name=ri_name) do
@@ -11639,9 +12362,13 @@ create function rdfs_load_schema (in ri_name varchar, in gn varchar := null) ret
 	{
 	  rdf_inf_dir (ri_name, s, o, 2);
 	  rdf_inf_dir (ri_name, s, o, 3);
+              rules_count := rules_count + 2;
 	}
       else
+            {
             rdf_inf_dir (ri_name, o, s, idx);
+              rules_count := rules_count + 1;
+            }
         }
     }
   exec_close (cc);
@@ -11682,9 +12409,10 @@ create function rdfs_load_schema (in ri_name varchar, in gn varchar := null) ret
                 v := vector_concat (v, vector (subp));
             }
         }
-      -- dbg_obj_princ ('known ifps are: '); foreach (IRI_ID i in v) do dbg_obj_princ (id_to_iri(i));
+      -- dbg_obj_princ ('known ifps are: '); foreach (IRI_ID i in v) do -- dbg_obj_princ (id_to_iri(i));
       gvector_digit_sort (v, 1, 0, 1);
       rdf_inf_set_ifp_list (ri_name, v); --- Note that this should be after all super/sub relations in order to fill ric_iid_to_rel_ifp
+      rules_count := rules_count + length (v);
       txt := sprintf ('
         select vector_agg (sub."o") from
           (sparql define output:valmode "LONG" define input:storage ""
@@ -11727,6 +12455,7 @@ create function rdfs_load_schema (in ri_name varchar, in gn varchar := null) ret
     {
       gvector_sort (v, 2, 0, 1);
       rdf_inf_set_inverses (ri_name, v);
+      rules_count := rules_count + length (v);
     }
 -- Loading bitmask properties of functions
   txt := sprintf ('select DB.DBA.VECTOR_CONCAT_AGG (vector (sub."s", 1)) from
@@ -11739,8 +12468,10 @@ create function rdfs_load_schema (in ri_name varchar, in gn varchar := null) ret
     {
       gvector_sort (v, 2, 0, 1);
       rdf_inf_set_prop_props (ri_name, v);
+      rules_count := rules_count + length (v);
     }
-  return 1;
+  jso_mark_affected (ri_name);
+  return rules_count + 1;
 }
 ;
 
@@ -11757,12 +12488,13 @@ rdf_schema_ld ()
 ;
 
 
-create procedure CL_RDF_INF_CHANGED_SRV (in name varchar)
+create function CL_RDF_INF_CHANGED_SRV (in name varchar) returns integer
 {
+  declare res integer;
   set isolation = 'committed';
   rdf_inf_clear (name);
   return case (rdfs_load_schema (name)) when 0 then 1 else 0 end;
-  jso_mark_affected (name);
+  return res;
 }
 ;
 
@@ -11777,7 +12509,7 @@ create procedure CL_RDF_INF_CHANGED (in name varchar)
 }
 ;
 
-create procedure rdfs_rule_set (in name varchar, in gn varchar, in remove int := 0)
+create function rdfs_rule_set (in name varchar, in gn varchar, in remove int := 0) returns integer
 {
     delete from sys_rdf_schema where rs_name = name and rs_uri = gn;
   if (not remove)
@@ -11786,12 +12518,17 @@ create procedure rdfs_rule_set (in name varchar, in gn varchar, in remove int :=
     }
   commit work;
   if (0 = sys_stat ('cl_run_local_only'))
+    {
     DB.DBA.SECURITY_CL_EXEC_AND_LOG ('DB.DBA.CL_RDF_INF_CHANGED (?)', vector (name));
+      return 1;
+    }
   else
     {
+      declare res integer;
       rdf_inf_clear (name);
-      rdfs_load_schema (name);
+      res := rdfs_load_schema (name);
       log_text ('db.dba.rdfs_load_schema (?)', name);
+      return res;
     }
 }
 ;
diff --git a/libsrc/Wi/sparql2sql.c b/libsrc/Wi/sparql2sql.c
index cff435d..e584ff8 100644
--- a/libsrc/Wi/sparql2sql.c
+++ b/libsrc/Wi/sparql2sql.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: sparql2sql.c,v 1.88.2.33 2010/03/23 10:04:52 source Exp $
+ *  $Id: sparql2sql.c,v 1.88.2.41 2011/03/02 12:24:56 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -199,7 +199,7 @@ sparp_expand_top_retvals (sparp_t *sparp, SPART *query, int safely_copy_all_vars
       sparp_gp_localtrav_treelist (sparp, retvals,
         NULL, &lnar,
         NULL, NULL,
-        sparp_gp_trav_list_nonaggregate_retvals, NULL, NULL,
+        sparp_gp_trav_list_nonaggregate_retvals, NULL, sparp_gp_trav_list_nonaggregate_retvals,
         NULL );
       if (NULL != query->_.req_top.having)
         {
@@ -210,13 +210,13 @@ sparp_expand_top_retvals (sparp_t *sparp, SPART *query, int safely_copy_all_vars
           stss[1].sts_ofs_of_curr_in_array = 0;
           sparp_gp_trav_int (sparp, query->_.req_top.having, stss+1, &lnar,
           NULL, NULL,
-          sparp_gp_trav_list_nonaggregate_retvals, NULL, NULL,
+          sparp_gp_trav_list_nonaggregate_retvals, NULL, sparp_gp_trav_list_nonaggregate_retvals,
           NULL );
         }
       sparp_gp_localtrav_treelist (sparp, query->_.req_top.order,
         NULL, &lnar,
         NULL, NULL,
-        sparp_gp_trav_list_nonaggregate_retvals, NULL, NULL,
+        sparp_gp_trav_list_nonaggregate_retvals, NULL, sparp_gp_trav_list_nonaggregate_retvals,
         NULL );
       if (0 == lnar.agg_found)
         return;
@@ -1000,7 +1000,7 @@ sparp_equiv_contains_t_io (sparp_t *sparp, sparp_equiv_t *eq)
 
 /*! For an equality in group \c curr between member of \c eq_l and expression \c r,
 the function restricts \c eq_l or even merges it with variable of other equiv.
-\returns SPART_VARR_XXX bits that can be added to eq_l->e_repoalces_filter if equality is no longer needed due to merge, 0 otherwise */
+\returns SPART_VARR_XXX bits that can be added to eq_l->e_replaces_filter if equality is no longer needed due to merge, 0 otherwise */
 int
 spar_var_eq_to_equiv (sparp_t *sparp, SPART *curr, sparp_equiv_t *eq_l, SPART *r)
 {
@@ -1164,6 +1164,51 @@ sparp_filter_to_equiv (sparp_t *sparp, SPART *curr, SPART *filt)
                   return 0;
                 }
             }
+          case SPAR_LIT:
+            {
+              caddr_t str_lval = NULL;
+              switch (DV_TYPE_OF (l))
+                {
+                case DV_ARRAY_OF_POINTER:
+                  str_lval = l->_.lit.val;
+                  if (DV_STRING != DV_TYPE_OF (str_lval))
+                    str_lval = NULL;
+                  break;
+                case DV_STRING:
+                  str_lval = (caddr_t)l;
+                  break;
+                }
+              if ((NULL != str_lval) && (SPAR_BUILT_IN_CALL == SPART_TYPE (r)) && (STR_L == r->_.builtin.btype))
+                {
+                  SPART *rarg1 = r->_.builtin.args[0];
+                  if (SPAR_IS_BLANK_OR_VAR (rarg1))
+                    {
+                      sparp_equiv_t *rarg1_eq = sparp_equiv_get (sparp, curr, rarg1, 0);
+                      flags = SPART_VARR_NOT_NULL;
+                      rarg1_eq->e_rvr.rvrRestrictions |= flags;
+                      rarg1_eq->e_replaces_filter |= flags;
+                      if (SPART_VARR_IS_REF & rarg1_eq->e_rvr.rvrRestrictions)
+                        {
+                          int old_rvr = rarg1_eq->e_rvr.rvrRestrictions;
+                          int restr_ret;
+                          SPART *lval_tmp_qname = spartlist (sparp, 2, SPAR_QNAME, t_box_dv_uname_nchars (str_lval, box_length (str_lval)-1));
+                          restr_ret = sparp_equiv_restrict_by_constant (sparp, rarg1_eq, NULL, lval_tmp_qname);
+                          if (
+                            (SPARP_EQUIV_MERGE_OK != restr_ret) &&
+                            (SPARP_EQUIV_MERGE_CONFLICT != restr_ret) &&
+                            (SPARP_EQUIV_MERGE_DUPE != restr_ret) )
+                            return 0;
+                          flags = SPART_VARR_FIXED | (rarg1_eq->e_rvr.rvrRestrictions & ~old_rvr);
+/* no need in <code>if (sparp_equiv_contains_t_io (sparp, eq_l)) return 0;</code> as it is written in spar_var_eq_to_equiv(),
+because const=str(var) is never recognized as a special condition on t_in or t_out variables. */
+/* no need in <code>rarg1_eq->e_rvr.rvrRestrictions |= flags;</code>, because it is set in sparp_equiv_restrict_by_constant() above */
+                          rarg1_eq->e_replaces_filter |= flags;
+                          return 1;
+                        }
+                    }
+                  return 0;
+                }
+            }
           }
         break;
       }
@@ -1614,6 +1659,17 @@ sparp_make_aliases (sparp_t *sparp)
 sparp_equiv_t *
 sparp_find_external_namesake_eq_of_varname (sparp_t *sparp, caddr_t varname, dk_set_t parent_gps)
 {
+  if (NULL != sparp->sparp_env->spare_bindings_vars)
+    {
+      int ctr;
+      DO_BOX_FAST_REV (SPART *, bvar, ctr, sparp->sparp_env->spare_bindings_vars)
+        {
+          if (strcmp (varname, bvar->_.var.vname))
+            continue;
+          return SPARP_EQUIV (sparp, bvar->_.var.equiv_idx);
+        }
+      END_DO_BOX_FAST_REV;
+    }
   DO_SET (SPART *, parent, &parent_gps)
     {
       sparp_equiv_t *parent_eq = sparp_equiv_get (sparp, parent, (SPART *)varname, SPARP_EQUIV_GET_NAMESAKES);
@@ -1644,7 +1700,7 @@ sparp_gp_trav_label_external_vars_gp_in (sparp_t *sparp, SPART *curr, sparp_trav
     return 0;
   if (SELECT_L == curr->_.gp.subtype)
     return SPAR_GPT_NODOWN;
-  if (NULL == parent_gps)
+  if ((NULL == parent_gps) && (NULL == sparp->sparp_env->spare_bindings_vars))
     return SPAR_GPT_ENV_PUSH;
   SPARP_FOREACH_GP_EQUIV (sparp, curr, eqctr, eq)
     {
@@ -1688,7 +1744,7 @@ sparp_gp_trav_label_external_vars_expn_subq (sparp_t *sparp, SPART *curr, sparp_
   dk_set_t parent_gps = (dk_set_t)common_env;
   SPART *anc_gp = sts_this->sts_ancestor_gp;
   sparp_t *sub_sparp = sparp_down_to_sub (sparp, curr);
-  if (NULL != anc_gp)
+  if ((NULL != anc_gp) || (NULL != sparp->sparp_env->spare_bindings_vars))
     {
       s_node_t tmp_env;
       tmp_env.data = anc_gp;
@@ -1710,7 +1766,10 @@ sparp_label_external_vars (sparp_t *sparp, dk_set_t parent_gps)
   tmp_env.next = parent_gps;
   sparp_trav_out_clauses (sparp, top, &tmp_env,
     NULL, NULL,
-    ((NULL != parent_gps) ? sparp_gp_trav_label_external_vars_expn_in : NULL), NULL, sparp_gp_trav_label_external_vars_expn_subq,
+    (((NULL != parent_gps) || (NULL != sparp->sparp_env->spare_bindings_vars)) ?
+      sparp_gp_trav_label_external_vars_expn_in : NULL ),
+    NULL,
+    sparp_gp_trav_label_external_vars_expn_subq,
     NULL );
   sparp_gp_trav (sparp, top_pattern, parent_gps,
     sparp_gp_trav_label_external_vars_gp_in, NULL,
@@ -1938,13 +1997,14 @@ sparp_restr_of_join_eq_from_connected_subvalues (sparp_t *sparp, sparp_equiv_t *
 }
 
 void
-sparp_find_best_join_eq_for_optional (sparp_t *sparp, SPART *parent, int pos_of_curr_memb, sparp_equiv_t *eq, sparp_equiv_t **ret_parent_eq, SPART **ret_tree_in_parent)
+sparp_find_best_join_eq_for_optional (sparp_t *sparp, SPART *parent, int pos_of_curr_memb, sparp_equiv_t *eq, sparp_equiv_t **ret_parent_eq, SPART **ret_tree_in_parent, SPART **ret_source_in_parent)
 {
   SPART *curr = NULL, *prev = NULL;
   int varname_ctr, ctr;
   int pos_of_prev_memb;
   int good_is_gp = 0;
   caddr_t good_varname = NULL;
+  SPART *good_prev = NULL;
   SPART *good_prev_var = NULL;
   sparp_equiv_t *good_parent_eq = NULL;
   sparp_equiv_t *good_prev_eq = NULL;
@@ -1954,6 +2014,7 @@ sparp_find_best_join_eq_for_optional (sparp_t *sparp, SPART *parent, int pos_of_
 #endif
   ret_parent_eq[0] = NULL;
   ret_tree_in_parent[0] = NULL;
+  ret_source_in_parent[0] = NULL;
   if (0 == pos_of_curr_memb)
     return;
   curr = parent->_.gp.members[pos_of_curr_memb];
@@ -1971,6 +2032,7 @@ sparp_find_best_join_eq_for_optional (sparp_t *sparp, SPART *parent, int pos_of_
               prev_eq = sparp_equiv_get_ro (sparp->sparp_sg->sg_equivs, sparp->sparp_sg->sg_equiv_count, prev, (SPART *)varname, SPARP_EQUIV_GET_NAMESAKES);
               if (NULL == prev_eq)
                 continue;
+              good_prev = prev;
               good_varname = varname;
               good_parent_eq = parent_eq;
               good_prev_var = NULL;
@@ -1996,6 +2058,7 @@ sparp_find_best_join_eq_for_optional (sparp_t *sparp, SPART *parent, int pos_of_
                     continue;
                   if (strcmp (prev_var->_.var.tabid, prev->_.triple.tabid))
                     continue;
+                  good_prev = prev;
                   good_varname = NULL;
                   good_parent_eq = parent_eq;
                   good_prev_var = prev_var;
@@ -2008,6 +2071,8 @@ sparp_find_best_join_eq_for_optional (sparp_t *sparp, SPART *parent, int pos_of_
         }
     }
 good_found:
+  ret_parent_eq[0] = good_parent_eq;
+  ret_source_in_parent[0] = good_prev;
   if (good_is_gp)
     {
       SPART *var_rv = (SPART *)t_alloc_box (sizeof (SPART), DV_ARRAY_OF_POINTER);
@@ -2018,12 +2083,10 @@ good_found:
       memcpy (&(var_rv->_.retval.rvr), &(good_prev_eq->e_rvr), sizeof (rdf_val_range_t));
       var_rv->_.retval.selid = prev->_.gp.selid;
       var_rv->_.retval.vname = good_varname;
-      ret_parent_eq[0] = good_parent_eq;
       ret_tree_in_parent[0] = var_rv;
     }
   else
     {
-      ret_parent_eq[0] = good_parent_eq;
       ret_tree_in_parent[0] = good_prev_var;
     }
 }
@@ -3407,11 +3470,63 @@ This may change semantics if an OPTIONAL contains a variable that is nullable in
             continue;
 /*!!! TBD: moving members from first_conflicting_predecessor_idx+1 to memb_ctr-1 inclusive into left part of memb if appropriate */
 #endif
-          continue;
         }
       continue;
 
 just_remove_braces:
+      if (0 != memb->_.gp.glued_filters_count)
+        {
+          int glued_last_idx = BOX_ELEMENTS (memb->_.gp.filters);
+          int glued_first_idx = glued_last_idx - memb->_.gp.glued_filters_count;
+          sparp_equiv_t *suspicious_filt_eq = NULL;
+          int glued_idx, memb_equiv_inx;
+          if (parent_gp->_.gp.glued_filters_count)
+            continue; /* Don't know how to safely mix two lists of glued filters, one already in parent and one from member, hence the sabotage */
+/* Consider a glued filter in memb that refers to ?x . ?x may present in memb or not, it may also present in parent_gp or not.
+?x in memb	| ?x in parent	| Can filter be moved?
+Yes & bound	| Yes & bound	| These two are equal due to join so filter can be moved
+Yes & bound	| Yes & !bound	| Empty join, filter does not matter, so it can be moved
+Yes & bound	| No		| Safe to move, the only occurence will define the value as it was
+Yes & !bound	| Yes & bound	| Empty join, filter does not matter, so it can be moved
+Yes & !bound	| Yes & !bound	| Empty join, filter does not matter, so it can be moved
+Yes & !bound	| No		| Safe to move, the only occurence will define the value as it was
+No		| Yes & bound	| !!! Can't move, not bound may become bound
+No		| Yes & !bound	| Safe to move, unbound anyway
+No		| No		| Safe to move, unbound anyway
+So the only unsafe case is a fixed filter on a variable that is missing where the filter resides but present at the parent.
+*/
+          SPARP_FOREACH_GP_EQUIV (sparp, memb, memb_equiv_inx, memb_eq)
+            {
+              int parent_conn_ctr;
+              if (SPART_VARR_NOT_NULL & memb_eq->e_rvr.rvrRestrictions)
+                continue;
+              DO_BOX_FAST (ptrlong, parent_equiv_idx, parent_conn_ctr, memb_eq->e_receiver_idxs)
+                {
+                  sparp_equiv_t *parent_equiv = SPARP_EQUIV (sparp, parent_equiv_idx);
+                  int glued_idx;
+                  for (glued_idx = glued_first_idx; glued_idx < glued_last_idx; glued_idx++)
+                    {
+                      SPART *glued_filt = memb->_.gp.filters[glued_idx];
+                      if (sparp_tree_uses_var_of_eq (sparp, glued_filt, parent_equiv))
+                        {
+                          suspicious_filt_eq = memb_eq;
+                          goto suspicious_filt_eq_found; /* see below */
+                        }
+                    }
+                }
+              END_DO_BOX_FAST;
+            }
+          END_SPARP_FOREACH_GP_EQUIV;
+suspicious_filt_eq_found:
+          if (NULL != suspicious_filt_eq)
+            continue;
+          for (glued_idx = glued_first_idx; glued_idx < glued_last_idx; glued_idx++)
+            {
+              SPART *filt = sparp_gp_detach_filter (sparp, memb, glued_first_idx, NULL);
+              sparp_gp_attach_filter (sparp, parent_gp, filt, BOX_ELEMENTS (parent_gp->_.gp.filters), NULL);
+            }
+          parent_gp->_.gp.glued_filters_count += (glued_last_idx - glued_first_idx);
+        }
       memb_filters = sparp_gp_detach_all_filters (sparp, memb, NULL);
       memb_filters_count = BOX_ELEMENTS_0 (memb_filters);
       for (sub_ctr = sub_count; sub_ctr--; /* no step */)
@@ -4213,7 +4328,7 @@ sparp_gp_trav_union_of_joins_out (sparp_t *sparp, SPART *curr, sparp_trav_state_
 }
 
 static void
-sparp_collect_single_atable_use (sparp_t *sparp, ccaddr_t alias, ccaddr_t tablename, qm_atable_use_t *uses, ptrlong *use_count_ptr )
+sparp_collect_single_atable_use (sparp_t *sparp_or_null, ccaddr_t alias, ccaddr_t tablename, qm_atable_use_t *uses, ptrlong *use_count_ptr )
 {
   ptrlong old_qmatu_idx = ecm_find_name (alias, uses, use_count_ptr[0], sizeof (qm_atable_use_t));
   if (ECM_MEM_NOT_FOUND == old_qmatu_idx)
@@ -4228,25 +4343,30 @@ sparp_collect_single_atable_use (sparp_t *sparp, ccaddr_t alias, ccaddr_t tablen
     {
       qm_atable_use_t *qmatu = uses + old_qmatu_idx;
       if (strcmp (tablename, qmatu->qmatu_tablename))
-        spar_internal_error (sparp, "sparp_" "collect_atable_uses(): probable corruption of some quad map");
+        {
+          if (NULL == sparp_or_null)
+            sqlr_new_error ("22023", "SR640", "internal error in processing table \"%.200s\" (alias \"%.200s\") in some RDF View", tablename, alias);
+          else
+            spar_internal_error (sparp_or_null, "sparp_" "collect_atable_uses(): probable corruption of some quad map");
+        }
     }
 }
 
 static void
-sparp_collect_atable_uses (sparp_t *sparp, ccaddr_t singletablename, qm_atable_array_t qmatables, qm_atable_use_t *uses, ptrlong *use_count_ptr )
+sparp_collect_atable_uses (sparp_t *sparp_or_null, ccaddr_t singletablename, qm_atable_array_t qmatables, qm_atable_use_t *uses, ptrlong *use_count_ptr )
 {
   int ata_ctr;
   if ((NULL != singletablename) && ('\0' != singletablename[0]))
-    sparp_collect_single_atable_use (sparp, uname___empty, singletablename, uses, use_count_ptr);
+    sparp_collect_single_atable_use (sparp_or_null, uname___empty, singletablename, uses, use_count_ptr);
   DO_BOX_FAST (qm_atable_t *, ata, ata_ctr, qmatables)
     {
-      sparp_collect_single_atable_use (sparp, ata->qmvaAlias, ata->qmvaTableName, uses, use_count_ptr);
+      sparp_collect_single_atable_use (sparp_or_null, ata->qmvaAlias, ata->qmvaTableName, uses, use_count_ptr);
     }
   END_DO_BOX_FAST;
 }
 
 void
-sparp_collect_all_atable_uses (sparp_t *sparp, quad_map_t *qm)
+sparp_collect_all_atable_uses (sparp_t *sparp_or_null, quad_map_t *qm)
 {
   int fld_ctr, max_uses = 0, default_qm_table_used = 0;
   ptrlong use_count = 0;
@@ -4282,11 +4402,11 @@ sparp_collect_all_atable_uses (sparp_t *sparp, quad_map_t *qm)
             }
         }
       END_DO_BOX_FAST;
-      sparp_collect_atable_uses (sparp,
+      sparp_collect_atable_uses (sparp_or_null,
         (default_qm_val_table_used ? qmv->qmvTableName : NULL),
         qmv->qmvATables, uses, &use_count );
     }
-  sparp_collect_atable_uses (sparp,
+  sparp_collect_atable_uses (sparp_or_null,
     (default_qm_table_used ? qm->qmTableName : NULL),
     qm->qmATables, uses, &use_count );
   qm->qmAllATableUses = (ptrlong *)uses;
@@ -4325,8 +4445,8 @@ qmatu_exists: ;
 }
 #endif
 
-static void
-sparp_collect_all_conds (sparp_t *sparp, quad_map_t *qm)
+void
+sparp_collect_all_conds (sparp_t *sparp_or_null, quad_map_t *qm)
 {
   int fld_ctr, max_conds = 0;
   ptrlong cond_ctr, cond_count = 0;
@@ -5461,6 +5581,8 @@ retry_preopt:
         continue;
       if (!SPARP_EQ_IS_USED(eq))
         continue;
+      if ((1 == eq->e_var_count) && SPART_VARNAME_IS_SPECIAL (eq->e_varnames[0]))
+        continue; /* Special variable is not assigned in SPARQL (by BGPs or externals) but it is assigned in SQL code by codegen. Can't check, just believe in the codegen :) */
       /* At this point we know that some variable is used but not assigned. It may be non-optional variable in FILTER inside OPTIONAL or an error. */
       if (sparp_dig_and_glue_loj_filter_for_eq (sparp, eq))
         goto retry_preopt; /* see above */
@@ -5578,7 +5700,7 @@ sparp_retval_should_wrap_distinct (sparp_t *sparp, SPART *tree, SPART *rv)
   if (SSG_VALMODE_LONG == rv_valmode)
     {
       ptrlong rv_restr = sparp_restr_bits_of_expn (sparp, rv);
-      if (rv_restr & SPART_VARR_IS_REF)
+      if (rv_restr & (SPART_VARR_IS_REF | SPART_VARR_LONG_EQ_SQL))
         return 0;
       return 1;
     }
@@ -5588,7 +5710,7 @@ sparp_retval_should_wrap_distinct (sparp_t *sparp, SPART *tree, SPART *rv)
       if (!rv_valmode->qmfWrapDistinct)
         return 0;
       rv_restr = sparp_restr_bits_of_expn (sparp, rv);
-      if (rv_restr & SPART_VARR_IS_REF)
+      if (rv_restr & (SPART_VARR_IS_REF | SPART_VARR_LONG_EQ_SQL))
         return 0;
       return 1;
     }
@@ -5706,8 +5828,12 @@ sparp_fill_sinv_varlists (sparp_t *sparp, SPART *root)
                   continue;
                 }
               if (0 > dk_set_position_of_string (used_globals, param_var_name))
+                {
+                  if (!sinv->_.sinv.in_list_implicit)
                 spar_error (sparp, "SERVICE <%.200s> (...) declares IN ?%.200s variable but an IN variable should be used both inside and outside the SERVICE clause",
                   sinv->_.sinv.endpoint, param_var_name );
+                  param_varnames_ptr[0] = t_list_remove_nth ((caddr_t)(param_varnames_ptr[0]), varctr);
+                }
             }
         }
       END_DO_BOX_FAST_REV;
@@ -5749,7 +5875,7 @@ sparp_fill_sinv_varlists (sparp_t *sparp, SPART *root)
 name_from_eq_is_found_in_params: ;
         }
       END_SPARP_FOREACH_GP_EQUIV;
-      sinv->_.sinv.rset_varnames = t_revlist_to_array (rset_varnames);
+      sinv->_.sinv.rset_varnames = t_list_to_array (rset_varnames);
     }
   END_DO_SET()
 }
@@ -5865,6 +5991,8 @@ retry_after_reducing_optionals:
           (0 != BOX_ELEMENTS_0 (eq->e_receiver_idxs)) ) &&
         !(eq->e_rvr.rvrRestrictions & (SPART_VARR_FIXED | SPART_VARR_GLOBAL | SPART_VARR_EXTERNAL)) )
         {
+          if ((1 == eq->e_var_count) && SPART_VARNAME_IS_SPECIAL (eq->e_varnames[0]))
+            continue; /* Special variable can not be bound in SPARQL because they does not exist in SPARQL. Thus no restricitons can be ifrerred from SPARQL context. */
           if (!sparp->sparp_env->spare_signal_void_variables)
             eq->e_rvr.rvrRestrictions |= SPART_VARR_CONFLICT;
           else if (eq->e_rvr.rvrRestrictions & SPART_VARR_EXPORTED)
@@ -5910,8 +6038,8 @@ end_of_equiv_checks:
       END_DO_SET();
     }
   END_DO_BOX_FAST;
-  if (sparp->sparp_query_uses_sinvs)
-    sparp_fill_sinv_varlists (sparp, root);
+  if ((NULL == sparp->sparp_parent_sparp) && sparp->sparp_query_uses_sinvs)
+    sparp_fill_sinv_varlists (sparp, root); /* This is global so can (and should) be made only at top level */
 }
 
 
@@ -6120,6 +6248,8 @@ ssg_grabber_codegen (struct spar_sqlgen_s *ssg, struct spar_tree_s *spart, ...)
   ssg_puts ("vector (");
   DO_SET (caddr_t, vname, &(ssg->ssg_sparp->sparp_env->spare_global_var_names))
     {
+      if ('@' == vname[1])
+        continue;
       if (need_comma)
         ssg_puts (", ");
       else
@@ -6242,9 +6372,14 @@ ssg_select_known_graphs_codegen (struct spar_sqlgen_s *ssg, struct spar_tree_s *
   ssg_puts ("SELECT");
   if (has_limofs)
     ssg_puts (limofs_strg);
-  ssg_putchar (' ');
+
+  if (SSG_VALMODE_LONG != retvalmode)
+    ssg_puts (" __box_flags_tweak (");
   ssg_prin_id_with_suffix (ssg, retselid, "~pview");
-  ssg_puts (".g_enum AS ");
+  ssg_puts (".g_enum");
+  if (SSG_VALMODE_LONG != retvalmode)
+    ssg_puts (", 1)");
+  ssg_puts (" AS ");
   ssg_prin_id (ssg, retname);
   ssg_puts (" FROM DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS(return_iris, lim) ");
   ssg_puts ((SSG_VALMODE_LONG == retvalmode) ? "(g_enum IRI_ID) " : "(g_enum varchar) ");
diff --git a/libsrc/Wi/sparql2sql.h b/libsrc/Wi/sparql2sql.h
index d568697..e9f93c3 100644
--- a/libsrc/Wi/sparql2sql.h
+++ b/libsrc/Wi/sparql2sql.h
@@ -1,5 +1,5 @@
 /*
- *  $Id: sparql2sql.h,v 1.55.2.16 2010/03/24 01:03:30 source Exp $
+ *  $Id: sparql2sql.h,v 1.55.2.22 2011/01/03 10:21:00 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -191,13 +191,15 @@ typedef struct sparp_equiv_s
 #define SPARP_EQUIV_ADD_OPTIONAL_READ	0x80	/*!< \c sparp_equiv_get() will increment \c e_optional_reads if variable is added */
 /* There's no SPARP_EQUIV_ADD_OPTIONAL_READ because subquery vars are not added to the equiv */
 
+/*! This allocates a new quivalence class. Don't use it in vain, use sparp_equiv_get with SPARP_EQUIV_INS_CLASS instead. */
+extern sparp_equiv_t *sparp_equiv_alloc (sparp_t *sparp);
+
 /*! Finds or create an equiv class for a \c needle_var in \c haystack_gp.
 The core behaviour is specified by (flags & (SPARP_EQUIV_INS_CLASS | SPARP_EQUIV_INS_VARIABLE)):
    when 0 then only existing equiv with existing occurrence is returned;
    when SPARP_EQUIV_INS_CLASS | SPARP_EQUIV_INS_VARIABLE then new equiv with 1 new variable can be added;
    when SPARP_EQUIV_INS_CLASS then new equiv with no variables can be added, for passing from alias to alias.
-If (flags & SPARP_EQUIV_GET_NAMESAKES) then \c needle_var can be a boxed string with name of variable.
-*/
+If (flags & SPARP_EQUIV_GET_NAMESAKES) then \c needle_var can be a boxed string with name of variable. */
 extern sparp_equiv_t *sparp_equiv_get (sparp_t *sparp, SPART *haystack_gp, SPART *needle_var, int flags);
 /*! Similar to sparp_equiv_get(), but gets a vector of pointers to equivs instead of \c sparp */
 extern sparp_equiv_t *sparp_equiv_get_ro (sparp_equiv_t **equivs, ptrlong equiv_count, SPART *haystack_gp, SPART *needle_var, int flags);
@@ -404,8 +406,13 @@ otherwise a triple should contain a field whose selid, tabid, name and tr_idx ma
 The \c var may b blank node or retval as well, but retval has no meaning if \c need_strong_match is set */
 extern SPART *sparp_find_triple_of_var_or_retval (sparp_t *sparp, SPART *gp, SPART *var, int need_strong_match);
 
-/*! This finds a variable that is a source of value of a given external variable or an appropriate retval. */
-extern SPART *sparp_find_origin_of_external_var (sparp_t *sparp, SPART *var);
+/*! This finds a variable that is a source of value of a given VARR_EXTERNAL variable \c var or an appropriate retval.
+If \c find_exact_specimen then the function will try return a variable from origin eq or its subequivs
+that will provide as many restrictions and valmode preferences as possible, but may be unusable for direct use in the codegen
+because it can be nested too deep in subqueries and its alias will not be visible at the location of \c var.
+If not \c find_exact_specimen then an upper-level retval can be returned instead of deeply buried origin var.
+ */
+extern SPART *sparp_find_origin_of_external_var (sparp_t *sparp, SPART *var, int find_exact_specimen);
 
 /*! This finds a variable or SPAR_ALIAS in \c retvals whose name is equal to \c varname, return the expression or, if \c return_alias, the whole SPAR_ALIAS */
 extern SPART *sparp_find_subexpn_in_retlist (sparp_t *sparp, const char *varname, SPART **retvals, int return_alias);
@@ -610,6 +617,12 @@ extern SPART *sparp_new_empty_gp (sparp_t *sparp, ptrlong subtype, ptrlong srcli
 /*! This turns \c gp into a union of zero cases and adjust VARR flags of variables to make them always-NULL */
 extern void sparp_gp_produce_nothing (sparp_t *sparp, SPART *gp);
 
+/*! This fills in "all atables" member of the given quad map */
+extern void sparp_collect_all_atable_uses (sparp_t *sparp_or_null, quad_map_t *qm);
+
+/*! This fills in "all conds" member of the given quad map */
+extern void sparp_collect_all_conds (sparp_t *sparp_or_null, quad_map_t *qm);
+
 /*! Perform all rewritings according to the type of the tree, grab logc etc. */
 extern void sparp_rewrite_all (sparp_t *sparp, int safely_copy_retvals);
 
@@ -636,7 +649,7 @@ this finds the most restrictive variable or retval at left side, and fills in \c
 If \c eq->e_replaces_filter and eq is not assigned locally then a condition with ret_tree_in_parent[0] instead of \c eq will act as a filter.
 The repeated expression can be placed in ON (...) clause of the generated LEFT OUTER JOIN and thus preserved from being lost due to lack of
 appropriated variables in scope of WHERE clause of SELECT at the right size of loj. */
-extern void sparp_find_best_join_eq_for_optional (sparp_t *sparp, SPART *parent, int pos_of_curr_memb, sparp_equiv_t *eq, sparp_equiv_t **ret_parent_eq, SPART **ret_tree_in_parent);
+extern void sparp_find_best_join_eq_for_optional (sparp_t *sparp, SPART *parent, int pos_of_curr_memb, sparp_equiv_t *eq, sparp_equiv_t **ret_parent_eq, SPART **ret_tree_in_parent, SPART **ret_source_in_parent);
 
 /*! Convert a query with grab vars into a select with procedure view with seed/iter/final sub-SQLs as arguments. */
 extern void sparp_rewrite_grab (sparp_t *sparp);
@@ -680,14 +693,15 @@ struct rdf_ds_field_s;
 struct rdf_ds_s;
 
 /* Special 'macro' names of ssg_valmode_t modes. The order of numeric values is important ssg_shortest_valmode() */
-#define SSG_VALMODE_SHORT_OR_LONG	((ssg_valmode_t)((ptrlong)(0x300)))
-#define SSG_VALMODE_LONG		((ssg_valmode_t)((ptrlong)(0x310)))
-#define SSG_VALMODE_SQLVAL		((ssg_valmode_t)((ptrlong)(0x320)))
-#define SSG_VALMODE_DATATYPE		((ssg_valmode_t)((ptrlong)(0x330)))
-#define SSG_VALMODE_LANGUAGE		((ssg_valmode_t)((ptrlong)(0x340)))
-#define SSG_VALMODE_AUTO		((ssg_valmode_t)((ptrlong)(0x350)))
-#define SSG_VALMODE_BOOL		((ssg_valmode_t)((ptrlong)(0x360)))
-#define SSG_VALMODE_SPECIAL		((ssg_valmode_t)((ptrlong)(0x370)))
+#define SSG_VALMODE_SHORT_OR_LONG	((ssg_valmode_t)((ptrlong)(0x300)))	/*!< Any representation, whatever is "shorter" */
+#define SSG_VALMODE_NUM			((ssg_valmode_t)((ptrlong)(0x310)))	/*!< Something that is number for numbers, date for date, NULL or something else for everything else; a shortest reasonable input for arithmetics */
+#define SSG_VALMODE_LONG		((ssg_valmode_t)((ptrlong)(0x320)))	/*!< Completed RDF objects */
+#define SSG_VALMODE_SQLVAL		((ssg_valmode_t)((ptrlong)(0x330)))	/*!< SQL value to bereturned to the SQL caller */
+#define SSG_VALMODE_DATATYPE		((ssg_valmode_t)((ptrlong)(0x340)))	/*!< Datatype is needed, not a value */
+#define SSG_VALMODE_LANGUAGE		((ssg_valmode_t)((ptrlong)(0x350)))	/*!< Language is needed, not a value */
+#define SSG_VALMODE_AUTO		((ssg_valmode_t)((ptrlong)(0x360)))	/*!< Something simplest */
+#define SSG_VALMODE_BOOL		((ssg_valmode_t)((ptrlong)(0x370)))	/*!< No more than a boolean is needed */
+#define SSG_VALMODE_SPECIAL		((ssg_valmode_t)((ptrlong)(0x380)))
 /* typedef struct rdf_ds_field_s *ssg_valmode_t; -- moved to sparql.h */
 
 extern ssg_valmode_t ssg_smallest_union_valmode (ssg_valmode_t m1, ssg_valmode_t m2);
@@ -721,8 +735,10 @@ typedef struct rdf_ds_usage_s
 #define NULL_ASNAME ((const char *)NULL)
 #define COL_IDX_ASNAME (((const char *)NULL) + 0x100)
 
+/*! Prints a subalias (and dot after alias, if flagged by the last argument), returns whether everything is printed */
+extern int ssg_prin_subalias (struct spar_sqlgen_s *ssg, const char *alias, const char *colalias, int dot_after_alias);
 /*! Prints the SQL expression based on \c tmpl template of \c qm_fmt valmode. \c asname is name used for AS xxx clauses, other arguments form context */
-extern void ssg_print_tmpl (struct spar_sqlgen_s *ssg, qm_format_t *qm_fmt, ccaddr_t tmpl, caddr_t alias, qm_value_t *qm_val, SPART *tree, const char *asname);
+extern void ssg_print_tmpl (struct spar_sqlgen_s *ssg, qm_format_t *qm_fmt, ccaddr_t tmpl, ccaddr_t alias, qm_value_t *qm_val, SPART *tree, const char *asname);
 extern void sparp_check_tmpl (sparp_t *sparp, ccaddr_t tmpl, int qmv_known, dk_set_t *used_aliases);
 extern caddr_t sparp_patch_tmpl (sparp_t *sparp, ccaddr_t tmpl, dk_set_t alias_replacements);
 
@@ -776,6 +792,9 @@ typedef struct spar_sqlgen_s
   caddr_t		ssg_sd_single_from;	/*!< The IRI in FROM clause, if there's only one FROM clause, NULL otherwise */
   int			ssg_sd_graph_gp_nesting;	/*!< Count of GRAPH {...} gps that are opened but not yet closed */
   dk_set_t		ssg_param_pos_set;	/*!< revlist of byte offsets of params in text and numbers of params in question, for sinv templates with unsupported named params */
+/* RDB2RDF Codegen temporary values */
+  const char *		ssg_alias_to_search;	/*!< Alias to select for search-and-replace (say, to replace "main alias" with prefixes for old or new columns) */
+  const char *		ssg_alias_to_replace;	/*!< Replacing alias for search-and-replace */
 } spar_sqlgen_t;
 
 /*!< Releases non-mempooled internals of \c ssg (currently the ssg_out) but does not free \c ssg itself (it's supposed to be on stack (if top-level) or in mem pool (if top-level or nested) */
@@ -783,6 +802,11 @@ void ssg_free_internals (spar_sqlgen_t *ssg);
 
 #define ssg_putchar(c) session_buffered_write_char (c, ssg->ssg_out)
 #define ssg_puts(strg) session_buffered_write (ssg->ssg_out, strg, strlen (strg))
+#ifdef NDEBUG
+#define ssg_puts_with_comment(strg,cmt) session_buffered_write (ssg->ssg_out, strg, strlen (strg))
+#else
+#define ssg_puts_with_comment(strg,cmt) session_buffered_write (ssg->ssg_out, strg " /* " cmt " */", strlen (strg " /* " cmt " */"))
+#endif
 #define ssg_putbuf(buf,bytes) session_buffered_write (ssg->ssg_out, (buf), (bytes))
 
 #ifdef DEBUG
@@ -814,6 +838,7 @@ extern void spar_sqlprint_error_impl (spar_sqlgen_t *ssg, const char *msg);
 extern void ssg_qr_uses_jso (spar_sqlgen_t *ssg, ccaddr_t jso_inst, ccaddr_t jso_name);
 extern void ssg_qr_uses_table (spar_sqlgen_t *ssg, const char *tbl);
 
+extern ssg_valmode_t sparp_lit_native_valmode (SPART *tree);
 extern ssg_valmode_t sparp_expn_native_valmode (sparp_t *sparp, SPART *tree);
 extern ptrlong sparp_restr_bits_of_dtp (dtp_t dtp);
 extern ptrlong sparp_restr_bits_of_expn (sparp_t *sparp, SPART *tree);
@@ -884,6 +909,7 @@ extern void ssg_print_scalar_subquery_exp (spar_sqlgen_t *ssg, SPART *sub_req_to
 extern void ssg_print_union (spar_sqlgen_t *ssg, SPART *gp, SPART **retlist, int head_flags, int retval_flags, ssg_valmode_t needed);
 
 extern void ssg_print_orderby_item (spar_sqlgen_t *ssg, SPART *gp, SPART *oby_itm);
+extern void ssg_print_where_or_and (spar_sqlgen_t *ssg, const char *location);
 
 /*! Returns nonzero if \c rv may produce value that may screw up result of SELECT DISTINCT if not wrapped in RDF_DIST_SER_LONG/RDF_DIST_DESER_LONG */
 extern int sparp_retval_should_wrap_distinct (sparp_t *sparp, SPART *tree, SPART *rv);
@@ -921,7 +947,10 @@ An occurrence of a non-blocking feature provides some hint to the optimizer of t
 #define SSG_SD_VOS_5_LATEST	0x0FFF	/*!< Allows everything that is supported by CVS had of Virtuoso Open Source 5.x.x */
 #define SSG_SD_TRANSIT		0x1000	/*!< Allows the use of transitivity extension, blocking */
 #define SSG_SD_VOS_6		0x1FFF	/*!< Allows everything that is supported by Virtuoso Open Source 6.0.0 */
-#define SSG_SD_VOS_CURRENT	SSG_SD_VOS_6	/*!< Allows everything that is supported by current version of Virtuoso */
+#define SSG_SD_VOS_CURRENT	SSG_SD_VOS_6	/*!< Allows everything that is supported by current version of Virtuoso Open Source */
+#define SSG_SD_SPARQL11		0x2000	/*!< Allows the use of SPARQL 1.1 extensions, blocking in most of cases */
+#define SSG_SD_DEPRECATED_MASK	0x0	/*!< All bits of deprecated flags (none so far) */
+#define SSG_SD_MAXVALUE		(SSG_SD_VOS_CURRENT | SSG_SD_DEPRECATED_MASK)
 
 extern void ssg_sdprin_literal (spar_sqlgen_t *ssg, SPART *tree);
 extern void ssg_sdprin_qname (spar_sqlgen_t *ssg, SPART *tree);
diff --git a/libsrc/Wi/sparql2sqltext.c b/libsrc/Wi/sparql2sqltext.c
index e6949b6..3b0ce72 100644
--- a/libsrc/Wi/sparql2sqltext.c
+++ b/libsrc/Wi/sparql2sqltext.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: sparql2sqltext.c,v 1.113.2.59 2010/06/28 10:34:01 source Exp $
+ *  $Id: sparql2sqltext.c,v 1.113.2.88 2011/03/29 10:53:08 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -97,7 +97,7 @@ void rdf_ds_load_all (void)
   qmf->qmfUriOfShortTmpl = box_dv_short_string (" __id2i (^{tree}^)");
   qmf->qmfStrsqlvalOfShortTmpl = box_dv_short_string (" __bft (__id2i (^{tree}^), 2)");
   qmf->qmfShortOfTypedsqlvalTmpl = box_dv_short_string (" NULL");
-  qmf->qmfShortOfSqlvalTmpl = box_dv_short_string (" __i2idn (^{tree}^)");
+  qmf->qmfShortOfSqlvalTmpl = box_dv_short_string (" __i2idn (^{sqlval-of-tree}^)");
   qmf->qmfShortOfLongTmpl = box_dv_short_string (" /* SHORT of LONG: */ ^{tree}^");
   qmf->qmfShortOfUriTmpl = box_dv_short_string (" __i2idn (^{tree}^)");
   qmf->qmfCmpFuncName = box_dv_short_string ("DB.DBA.RDF_IID_CMP");
@@ -138,7 +138,7 @@ void rdf_ds_load_all (void)
   qmf->qmfUriOfShortTmpl = box_dv_short_string (" id_to_iri_nosignal (^{tree}^)");
   qmf->qmfStrsqlvalOfShortTmpl = box_dv_short_string (" __rdf_strsqlval (^{tree}^, 0)");
   qmf->qmfShortOfTypedsqlvalTmpl = box_dv_short_string (" DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL (^{sqlval-of-tree}^, __i2idn (^{datatype-of-tree}^), ^{language-of-tree}^)");
-  qmf->qmfShortOfSqlvalTmpl = box_dv_short_string (" DB.DBA.RDF_OBJ_OF_SQLVAL (^{tree}^)");
+  qmf->qmfShortOfSqlvalTmpl = box_dv_short_string (" DB.DBA.RDF_OBJ_OF_SQLVAL (^{sqlval-of-tree}^)");
   qmf->qmfShortOfLongTmpl = box_dv_short_string (" DB.DBA.RDF_OBJ_OF_LONG (^{tree}^)");
   qmf->qmfShortOfUriTmpl = box_dv_short_string (" __i2idn (^{tree}^)");
   qmf->qmfCmpFuncName = box_dv_short_string ("DB.DBA.RDF_OBJ_CMP");
@@ -221,6 +221,8 @@ ssg_find_valmode_by_name (ccaddr_t name)
     return SSG_VALMODE_SQLVAL;
   else if (!strcmp (name, "LONG"))
     return SSG_VALMODE_LONG;
+  else if (!strcmp (name, "NUM"))
+    return SSG_VALMODE_NUM;
   if (!strcmp (name, "AUTO"))
     return SSG_VALMODE_AUTO;
   spar_error (NULL, "Unsupported valmode name '%.30s', only 'SQLVAL' and 'LONG' are supported", name);
@@ -307,6 +309,14 @@ ssg_find_formatter_by_name_and_subtype (ccaddr_t name, ptrlong subtype,
       case ASK_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL"; return;
       default: return;
       }
+  if (!strcmp (name, "NT"))
+    switch (subtype)
+      {
+      case SELECT_L: case COUNT_DISTINCT_L: case DISTINCT_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT"; return;
+      case CONSTRUCT_L: case DESCRIBE_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_NT"; return;
+      case ASK_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT"; return;
+      default: return;
+      }
   if (!strcmp (name, "JSON"))
     switch (subtype)
       {
@@ -339,11 +349,37 @@ ssg_find_formatter_by_name_and_subtype (ccaddr_t name, ptrlong subtype,
       case CONSTRUCT_L: case DESCRIBE_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_ODATA_JSON"; return;
       default: return;
       }
+  if (!strcmp (name, "CXML"))
+    switch (subtype)
+      {
+      case SELECT_L: case COUNT_DISTINCT_L: case DISTINCT_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML"; return;
+      case CONSTRUCT_L: case DESCRIBE_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CXML"; return;
+      case ASK_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_CXML"; return;
+      default: return;
+      }
+  if (!strcmp (name, "CXML;QRCODE"))
+    switch (subtype)
+      {
+      case SELECT_L: case COUNT_DISTINCT_L: case DISTINCT_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML"; return;
+      case CONSTRUCT_L: case DESCRIBE_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CXML_QRCODE"; return;
+      case ASK_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_CXML"; return;
+      default: return;
+      }
+  if (!strcmp (name, "CSV"))
+    switch (subtype)
+      {
+      case SELECT_L: case COUNT_DISTINCT_L: case DISTINCT_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV"; return;
+      case CONSTRUCT_L: case DESCRIBE_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CSV"; return;
+      case ASK_L: ret_formatter[0] = "DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_CSV"; return;
+      default: return;
+      }
   spar_error (NULL, "Unsupported format name '%.40s'", name);
+/*
 bad_ask:
   spar_error (NULL, "Format name '%.30s' is not supported for boolean results made by SPARQL %s", name, spart_dump_opname (subtype, 0));
 bad_descr:
   spar_error (NULL, "Format name '%.30s' is not supported for triple dictionaries made by SPARQL %s", name, spart_dump_opname (subtype, 0));
+*/
 }
 
 /* Dependency tracking */
@@ -372,7 +408,7 @@ ssg_qr_uses_jso (spar_sqlgen_t *ssg, ccaddr_t jso_inst, ccaddr_t jso_name)
     return;
   if (NULL == jso_name)
     {
-      jso_rtti_t *jso_rtti = gethash (jso_inst, jso_rttis_of_names);
+      jso_rtti_t *jso_rtti = gethash (jso_inst, jso_rttis_of_structs);
       if (NULL == jso_rtti)
         return; /* Built-in anonymous JSO, like one used when define input:storage "" */
       jso_name = jso_rtti->jrtti_inst_iri;
@@ -455,10 +491,53 @@ ccaddr_t ssg_find_jl_by_jr (spar_sqlgen_t *ssg, SPART *gp, ccaddr_t jr_alias)
   return "";
 }
 
+int
+ssg_prin_subalias (struct spar_sqlgen_s *ssg, const char *alias, const char *colalias, int dot_after_alias)
+{
+  if ((NULL != ssg->ssg_alias_to_search) &&
+    !strcmp (
+      ((NULL == colalias) ? "" : colalias),
+      ((NULL == ssg->ssg_alias_to_search) ? "" : ssg->ssg_alias_to_search) ) )
+    {
+      if (NULL != ssg->ssg_alias_to_replace)
+        {
+          ssg_prin_id (ssg, ssg->ssg_alias_to_replace);
+          if (dot_after_alias)
+            ssg_putchar ('.');
+          return 1;
+        }
+      if (dot_after_alias)
+        return 1; /* neither alias nor dot is printed but nothing has left to print, hence 1 */
+      return 0;
+    }
+  if (NULL != alias)
+    {
+      if ((NULL == colalias) || ('!' == colalias[0]))
+        ssg_prin_id (ssg, alias);
+      else
+        {
+          caddr_t subalias = t_box_sprintf (210, "%.100s~%.100s", alias, colalias);
+          ssg_prin_id (ssg, subalias);
+        }
+      if (dot_after_alias)
+        ssg_putchar ('.');
+      return 1;
+    }
+  if (!((NULL == colalias) || ('!' == colalias[0])))
+    {
+      ssg_prin_id (ssg, colalias);
+      if (dot_after_alias)
+        ssg_putchar ('.');
+      return 1;
+    }
+  if (dot_after_alias)
+    return 1; /* neither alias nor dot is printed but nothing has left to print, hence 1 */
+  return 0;
+}
 
 #define CMD_EQUAL(w,l) ((l == cmdlen) && (!memcmp (w, cmd, l)))
 int
-ssg_print_tmpl_phrase (struct spar_sqlgen_s *ssg, qm_format_t *qm_fmt, const char *tmpl, const char *tmpl_end, caddr_t alias, qm_value_t *qm_val, SPART *tree, int col_idx, const char *asname)
+ssg_print_tmpl_phrase (struct spar_sqlgen_s *ssg, qm_format_t *qm_fmt, const char *tmpl, const char *tmpl_end, ccaddr_t alias, qm_value_t *qm_val, SPART *tree, int col_idx, const char *asname)
 {
 /* IMPORTANT: keep this function in sync with sparp_check_tmpl(), otherwise syntax changes may be blocked by the compiler. */
   const char *tail;
@@ -492,14 +571,16 @@ ssg_print_tmpl_phrase (struct spar_sqlgen_s *ssg, qm_format_t *qm_fmt, const cha
       if ('.' == cmd [cmdlen-1])
         {
           caddr_t a = t_box_dv_short_nchars (cmd, cmdlen - 1);
-          caddr_t subalias;
-          if (NULL == alias)
-            spar_sqlprint_error2 ("ssg_" "print_tmpl(): can't print NULL alias", asname_printed);
-          if ('!' == a[0])
-            subalias = alias;
+          int res;
+          if ('.' == tail[0])
+            {
+              res = ssg_prin_subalias (ssg, alias, a, 1);
+              tail++;
+            }
           else
-            subalias = t_box_sprintf (210, "%.100s~%.100s", alias, a);
-          ssg_prin_id (ssg, subalias);
+            res = ssg_prin_subalias (ssg, alias, a, 0);
+          if (0 == res)
+            spar_sqlprint_error2 ("ssg_" "print_tmpl(): can't print NULL alias", asname_printed);
         }
 /*                   0         1         2 */
 /*                   012345678901234567890 */
@@ -525,26 +606,25 @@ ssg_print_tmpl_phrase (struct spar_sqlgen_s *ssg, qm_format_t *qm_fmt, const cha
 /*                        012345678901234567890 */
       else if (CMD_EQUAL("alias", 5))
         {
-          if (NULL == alias)
-            spar_sqlprint_error2 ("ssg_" "print_tmpl(): can't print NULL alias", asname_printed);
+          if (NULL != alias)
           ssg_prin_id (ssg, alias);
+          else if ('.' == tail[0])
+            tail++;
+          else
+            spar_sqlprint_error2 ("ssg_" "print_tmpl(): can't print NULL alias", asname_printed);
         }
 /*                        0         1         2 */
 /*                        012345678901234567890 */
       else if (CMD_EQUAL("alias-0", 7))
         {
           ccaddr_t colalias;
-          if (NULL == alias)
-            spar_sqlprint_error2 ("ssg_" "print_tmpl(): can't print NULL alias", asname_printed);
           if (NULL == qm_val)
             spar_sqlprint_error2 ("ssg_" "print_tmpl(): can't use ^{alias-0}^ if qm_val is NULL", asname_printed);
           colalias = qm_val->qmvColumns[0]->qmvcAlias;
-          if ((NULL == colalias) || ('!' == colalias[0]))
-            ssg_prin_id (ssg, alias);
-          else
+          if (!ssg_prin_subalias (ssg, alias, colalias, 0))
             {
-              caddr_t subalias = t_box_sprintf (210, "%.100s~%.100s", alias, colalias);
-              ssg_prin_id (ssg, subalias);
+              if (NULL == alias)
+                spar_sqlprint_error2 ("ssg_" "print_tmpl(): can't print NULL alias", asname_printed);
             }
         }
 /*                        0         1         2 */
@@ -552,17 +632,13 @@ ssg_print_tmpl_phrase (struct spar_sqlgen_s *ssg, qm_format_t *qm_fmt, const cha
       else if (CMD_EQUAL("alias-1", 7))
         {
           ccaddr_t colalias;
-          if (NULL == alias)
-            spar_sqlprint_error2 ("ssg_" "print_tmpl(): can't print NULL alias", asname_printed);
           if (NULL == qm_val)
             spar_sqlprint_error2 ("ssg_" "print_tmpl(): can't use ^{alias-1}^ if qm_val is NULL", asname_printed);
           colalias = qm_val->qmvColumns[1]->qmvcAlias;
-          if ((NULL == colalias) || ('!' == colalias[0]))
-            ssg_prin_id (ssg, alias);
-          else
+          if (!ssg_prin_subalias (ssg, alias, colalias, 0))
             {
-              caddr_t subalias = t_box_sprintf (210, "%.100s~%.100s", alias, colalias);
-              ssg_prin_id (ssg, subalias);
+              if (NULL == alias)
+                spar_sqlprint_error2 ("ssg_" "print_tmpl(): can't print NULL alias", asname_printed);
             }
         }
 /*                        0         1         2 */
@@ -580,17 +656,7 @@ ssg_print_tmpl_phrase (struct spar_sqlgen_s *ssg, qm_format_t *qm_fmt, const cha
           if (col_idx >= 0)
             spar_sqlprint_error2 ("ssg_" "print_tmpl(): can't use ^{alias-dot}^ inside a loop, should be ^{column-N}^", asname_printed);
           colalias = qm_val->qmvColumns[0]->qmvcAlias;
-          if (NULL != alias)
-            {
-              if ((NULL == colalias) || ('!' == colalias[0]))
-                ssg_prin_id (ssg, alias);
-              else
-                {
-                  caddr_t subalias = t_box_sprintf (210, "%.100s~%.100s", alias, colalias);
-                  ssg_prin_id (ssg, subalias);
-                }
-              ssg_putchar ('.');
-            }
+          ssg_prin_subalias (ssg, alias, colalias, 1);
         }
 /*                        0         1         2 */
 /*                        012345678901234567890 */
@@ -604,17 +670,7 @@ ssg_print_tmpl_phrase (struct spar_sqlgen_s *ssg, qm_format_t *qm_fmt, const cha
           if (col_idx >= BOX_ELEMENTS (qm_val->qmvColumns))
             spar_sqlprint_error2 ("ssg_" "print_tmpl(): col index for ^{alias-N-dot}^ exceeds number of columns", asname_printed);
           colalias = qm_val->qmvColumns[col_idx]->qmvcAlias;
-          if (NULL != alias)
-            {
-              if ((NULL == colalias) || ('!' == colalias[0]))
-                ssg_prin_id (ssg, alias);
-              else
-                {
-                  caddr_t subalias = t_box_sprintf (210, "%.100s~%.100s", alias, colalias);
-                  ssg_prin_id (ssg, subalias);
-                }
-              ssg_putchar ('.');
-            }
+          ssg_prin_subalias (ssg, alias, colalias, 1);
         }
 /*                        0         1         2 */
 /*                        012345678901234567890 */
@@ -995,7 +1051,7 @@ ssg_print_tmpl_phrase (struct spar_sqlgen_s *ssg, qm_format_t *qm_fmt, const cha
 }
 
 
-void ssg_print_tmpl (struct spar_sqlgen_s *ssg, qm_format_t *qm_fmt, ccaddr_t tmpl, caddr_t alias, qm_value_t *qm_val, SPART *tree, const char *asname)
+void ssg_print_tmpl (struct spar_sqlgen_s *ssg, qm_format_t *qm_fmt, ccaddr_t tmpl, ccaddr_t alias, qm_value_t *qm_val, SPART *tree, const char *asname)
 {
   const char *tmpl_end;
   int asname_printed;
@@ -1382,6 +1438,56 @@ ssg_prin_id_with_suffix (spar_sqlgen_t *ssg, const char *name, const char *suffi
 }
 
 ssg_valmode_t
+sparp_lit_native_valmode (SPART *tree)
+{
+  dtp_t dtp;
+  if (!IS_BOX_POINTER (tree))
+    return SSG_VALMODE_NUM; /* because it's integer */
+  dtp = DV_TYPE_OF (tree);
+  if (DV_ARRAY_OF_POINTER == dtp)
+    {
+      if (NULL != tree->_.lit.language)
+        return SSG_VALMODE_LONG; /* Otherwise printing literal as (default) SQLVAL may lose the language */
+      dtp = DV_TYPE_OF (tree->_.lit.val);
+      if (NULL != tree->_.lit.datatype)
+        {
+        switch (dtp)
+          {
+          case DV_DOUBLE_FLOAT:
+            if (uname_xmlschema_ns_uri_hash_double == tree->_.lit.datatype)
+              return SSG_VALMODE_NUM;
+            /* no break */
+          case DV_SINGLE_FLOAT:
+          case DV_NUMERIC:
+            if (uname_xmlschema_ns_uri_hash_decimal == tree->_.lit.datatype)
+              return SSG_VALMODE_NUM;
+            /* no break */
+          case DV_LONG_INT:
+            if (uname_xmlschema_ns_uri_hash_integer == tree->_.lit.datatype)
+              return SSG_VALMODE_NUM;
+            if (uname_xmlschema_ns_uri_hash_boolean == tree->_.lit.datatype)
+              return SSG_VALMODE_BOOL;
+            break;
+          case DV_DATETIME:
+            if (uname_xmlschema_ns_uri_hash_dateTime == tree->_.lit.datatype)
+              return SSG_VALMODE_NUM;
+            if (uname_xmlschema_ns_uri_hash_date == tree->_.lit.datatype)
+              return SSG_VALMODE_NUM;
+            if (uname_xmlschema_ns_uri_hash_time == tree->_.lit.datatype)
+              return SSG_VALMODE_NUM;
+            break;
+          }
+        }
+      return SSG_VALMODE_SQLVAL;
+    }
+  switch (dtp)
+    {
+    case DV_STRING: case DV_UNAME: case DV_WIDE: return SSG_VALMODE_SQLVAL;
+    default: return SSG_VALMODE_NUM;
+    }
+}
+
+ssg_valmode_t
 sparp_equiv_native_valmode (sparp_t *sparp, SPART *gp, sparp_equiv_t *eq)
 {
   int var_count = eq->e_var_count;
@@ -1545,15 +1651,12 @@ sparp_expn_native_valmode (sparp_t *sparp, SPART *tree)
     case BOP_AND: case BOP_OR: case BOP_NOT:
       return SSG_VALMODE_BOOL;
     case BOP_PLUS: case BOP_MINUS: case BOP_TIMES: case BOP_DIV: case BOP_MOD:
+      return SSG_VALMODE_NUM;
     case SPAR_QNAME:
     /*case SPAR_QNAME_NS:*/
       return SSG_VALMODE_SQLVAL;
     case SPAR_LIT:
-      if (!IS_BOX_POINTER (tree))
-        return SSG_VALMODE_SQLVAL;
-      if (NULL != tree->_.lit.language)
-        return SSG_VALMODE_LONG; /* Otherwise printing literal as (default) SQLVAL may lose the language */
-      return SSG_VALMODE_SQLVAL;
+      return sparp_lit_native_valmode (tree);
     case SPAR_ALIAS:
       if (SSG_VALMODE_AUTO == tree->_.alias.native)
         tree->_.alias.native = sparp_expn_native_valmode (sparp, tree->_.alias.arg);
@@ -1577,12 +1680,25 @@ sparp_expn_native_valmode (sparp_t *sparp, SPART *tree)
       }
     case SPAR_VARIABLE: case SPAR_BLANK_NODE_LABEL:
       if (SPART_VARR_FIXED & tree->_.var.rvr.rvrRestrictions)
-        return SSG_VALMODE_SQLVAL;
+        {
+          ptrlong eq_idx = tree->_.var.equiv_idx;
+          sparp_equiv_t *eq = SPARP_EQUIV (sparp, eq_idx);
+          SPART *gp = eq->e_gp;
+#ifndef NDEBUG
+          if (eq != sparp->sparp_sg->sg_equivs[eq_idx])
+            spar_internal_error (sparp, "sparp_" "expn_native_valmode(): eq differs in old and new variants (1)");
+          if (gp != sparp_find_gp_by_eq_idx (sparp, eq_idx))
+            spar_internal_error (sparp, "sparp_" "expn_native_valmode(): gp differs in old and new variants (1)");
+#endif
+          if (SPAR_BINDINGS_INV == gp->type)
+            return SSG_VALMODE_LONG;
+          return sparp_equiv_native_valmode (sparp, gp, eq);
+        }
       else if (SPART_VARR_GLOBAL & tree->_.var.rvr.rvrRestrictions)
         return sparp_rettype_of_global_param (sparp, tree->_.var.vname);
       else if (SPART_VARR_EXTERNAL & tree->_.var.rvr.rvrRestrictions)
         {
-          SPART *orig = sparp_find_origin_of_external_var (sparp, tree);
+          SPART *orig = sparp_find_origin_of_external_var (sparp, tree, 1);
           return sparp_expn_native_valmode (sparp, orig);
         }
       else if (NULL != tree->_.var.tabid)
@@ -1612,8 +1728,16 @@ sparp_expn_native_valmode (sparp_t *sparp, SPART *tree)
       else
         {
           ptrlong eq_idx = tree->_.var.equiv_idx;
-          sparp_equiv_t *eq = sparp->sparp_sg->sg_equivs[eq_idx];
-          SPART *gp = sparp_find_gp_by_eq_idx (sparp, eq_idx);
+          sparp_equiv_t *eq = SPARP_EQUIV (sparp, eq_idx);
+          SPART *gp = eq->e_gp;
+#ifndef NDEBUG
+          if (eq != sparp->sparp_sg->sg_equivs[eq_idx])
+            spar_internal_error (sparp, "sparp_" "expn_native_valmode(): eq differs in old and new variants (2)");
+          if (gp != sparp_find_gp_by_eq_idx (sparp, eq_idx))
+            spar_internal_error (sparp, "sparp_" "expn_native_valmode(): gp differs in old and new variants (2)");
+#endif
+          if (SPAR_BINDINGS_INV == gp->type)
+            return SSG_VALMODE_LONG;
           return sparp_equiv_native_valmode (sparp, gp, eq);
         }
     case SPAR_RETVAL:
@@ -1673,6 +1797,8 @@ sparp_expn_native_valmode (sparp_t *sparp, SPART *tree)
             }
           else
             {
+              if (SPAR_BINDINGS_INV == gp->type)
+                return SSG_VALMODE_LONG;
 #ifndef NDEBUG
               if (strcmp (gp->_.gp.selid, tree->_.retval.selid))
                 spar_internal_error (sparp, "sparp_" "expn_native_valmode(): bad cached gp in retval");
@@ -1701,9 +1827,9 @@ sparp_expn_native_valmode (sparp_t *sparp, SPART *tree)
         sparp_t *sub_sparp;
         SPART *subq = tree->_.gp.subquery;
         ssg_valmode_t res;
-        if (ASK_L != tree->_.gp.subtype)
-          return SSG_VALMODE_SQLVAL;
-        if (SELECT_L != tree->_.gp.subtype)
+        if (ASK_L == subq->_.req_top.subtype)
+          return SSG_VALMODE_NUM;
+        if (SELECT_L != subq->_.req_top.subtype)
           break;
         if (1 != BOX_ELEMENTS (subq->_.req_top.retvals))
           break;
@@ -1878,7 +2004,7 @@ sparp_restr_bits_of_expn (sparp_t *sparp, SPART *tree)
     case SPAR_GP:
       if (tree->_.gp.subtype != SELECT_L)
         spar_internal_error (sparp, "sparp_" "restr_bits_of_expn(): unsupported subtype of GP tree");
-      return sparp_restr_bits_of_expn (sparp, tree->_.gp.subquery->_.req_top.retvals[0]);
+      return sparp_restr_bits_of_expn (sparp, tree->_.gp.subquery->_.req_top.retvals[0]) & ~SPART_VARR_NOT_NULL;
     default: spar_internal_error (sparp, "sparp_" "restr_bits_of_expn(): unsupported case");
     }
   return 0; /* Never reached, to keep compiler happy */
@@ -2133,24 +2259,15 @@ ssg_print_literal_as_sqlval (spar_sqlgen_t *ssg, ccaddr_t type, SPART *lit)
     value = (caddr_t)lit;
   if (NULL == type)
     type = dt;
-#if 0
-  if (uname_xmlschema_ns_uri_hash_boolean == type)
+  if ((NULL != lang) && (NULL == type) && (DV_STRING == DV_TYPE_OF (value)))
     {
-      if (unbox (value))
-        ssg_puts ("1");
-      else
-        ssg_puts ("0");
+      ssg_print_box_as_sql_atom (ssg, value, SQL_ATOM_NARROW_OR_WIDE);
       return;
     }
-#else
-  if ((NULL != type) || (NULL != lang))
+  if ((NULL != type) && (NULL == lang))
     {
-      if (((NULL == lang) && (
-          ((uname_xmlschema_ns_uri_hash_string == type) && (DV_STRING == DV_TYPE_OF (value))) ||
-          ((uname_xmlschema_ns_uri_hash_integer == type) && (DV_LONG_INT == DV_TYPE_OF (value))) ||
-          ((uname_xmlschema_ns_uri_hash_double == type) && (DV_DOUBLE_FLOAT == DV_TYPE_OF (value))) ||
-          ((uname_xmlschema_ns_uri_hash_decimal == type) && (DV_NUMERIC == DV_TYPE_OF (value))) ) ) ||
-        ((NULL != lang) && (NULL == type) && (DV_STRING == DV_TYPE_OF (value))) )
+      ccaddr_t dflt_xsd_type_of_box = xsd_type_of_box (value);
+      if ((type == dflt_xsd_type_of_box) || ((uname_xmlschema_ns_uri_hash_decimal == type) && (uname_xmlschema_ns_uri_hash_double == dflt_xsd_type_of_box)))
         {
           ssg_print_box_as_sql_atom (ssg, value, SQL_ATOM_NARROW_OR_WIDE);
           return;
@@ -2174,7 +2291,6 @@ ssg_print_literal_as_sqlval (spar_sqlgen_t *ssg, ccaddr_t type, SPART *lit)
       ssg_puts ("))");
       return;
     }
-#endif
   ssg_print_box_as_sql_atom (ssg, value, SQL_ATOM_NARROW_OR_WIDE);
 }
 
@@ -2293,6 +2409,9 @@ ssg_print_tr_field_expn (spar_sqlgen_t *ssg, qm_value_t *field, caddr_t tabid, s
         tmpl = (field_format->qmfDatatypeTmpl ? field_format->qmfDatatypeTmpl : field_format->qmfDatatypeOfShortTmpl) ;
       else if (SSG_VALMODE_LANGUAGE == needed)
         tmpl = (field_format->qmfLanguageTmpl ? field_format->qmfLanguageTmpl : field_format->qmfLanguageOfShortTmpl) ;
+      else if (SSG_VALMODE_NUM == needed)
+        tmpl = ((field_format->qmfIsSubformatOfLong || field_format->qmfIsSubformatOfLongWhenEqToSql) ?
+          field_format->qmfShortTmpl : field_format->qmfLongOfShortTmpl );
       else if (SSG_VALMODE_BOOL == needed)
         tmpl = field_format->qmfBoolTmpl;
       else if (SSG_VALMODE_AUTO == needed)
@@ -2360,7 +2479,12 @@ ssg_print_tr_var_expn (spar_sqlgen_t *ssg, SPART *var, ssg_valmode_t needed, con
             rv->_.retval.vname = (caddr_t)(qmv->qmvColumns[0]->qmvcColumnName);
           else
             rv->_.retval.vname = var->_.var.vname;
-          ssg_print_valmoded_scalar_expn (ssg, rv, needed, native, asname);
+/* Can be removed
+          if (needed == native)
+            ssg_print_scalar_expn (ssg, rv, needed, asname);
+          else
+*/
+            ssg_print_valmoded_scalar_expn (ssg, rv, needed, native, asname);
           return;
         }
       for (col_ctr = 0; col_ctr < col_count; col_ctr++)
@@ -2474,6 +2598,8 @@ ssg_largest_intersect_valmode (ssg_valmode_t m1, ssg_valmode_t m2)
     return SSG_VALMODE_BOOL;
   if (!IS_BOX_POINTER (m2))
     {
+      if (SSG_VALMODE_NUM == m1)
+        return m1;
       if (SSG_VALMODE_AUTO == m2)
         return m1;
       return SSG_VALMODE_LONG;
@@ -2487,12 +2613,13 @@ ssg_largest_intersect_valmode (ssg_valmode_t m1, ssg_valmode_t m2)
           else
             return SSG_VALMODE_LONG;
         }
-      else if (SSG_VALMODE_AUTO == m1)
+      if (SSG_VALMODE_AUTO == m1)
         return m2;
-      else if ((SSG_VALMODE_LONG == m1) && (m2->qmfIsSubformatOfLong))
+      if ((SSG_VALMODE_NUM == m1) && (m2->qmfIsSubformatOfLong || m2->qmfIsSubformatOfLongWhenEqToSql))
+        return SSG_VALMODE_NUM;
+      if ((SSG_VALMODE_LONG == m1) && (m2->qmfIsSubformatOfLong))
         return m2;
-      else
-        return SSG_VALMODE_LONG;
+      return SSG_VALMODE_LONG;
     }
   DO_BOX_FAST (qm_format_t *, sup1, ctr1, m1->qmfSuperFormats)
     {
@@ -2561,16 +2688,19 @@ ssg_largest_eq_valmode (ssg_valmode_t m1, ssg_valmode_t m2)
   if ((SSG_VALMODE_AUTO == m1) || (SSG_VALMODE_AUTO == m2))
     GPF_T1 ("ssg_largest_eq_valmode (): SSG_VALMODE_AUTO argument");
 #endif
-  if (SSG_VALMODE_BOOL == m2)
-    return SSG_VALMODE_BOOL;
   if (!IS_BOX_POINTER (m2))
     {
-      return SSG_VALMODE_LONG;
+      if ((SSG_VALMODE_NUM == m1) && ((SSG_VALMODE_LONG == m2) || (SSG_VALMODE_SQLVAL == m2)))
+        return SSG_VALMODE_NUM;
+      if (SSG_VALMODE_BOOL == m2)
+        return SSG_VALMODE_BOOL;
     }
   if (!IS_BOX_POINTER (m1))
     {
-      if ((SSG_VALMODE_SQLVAL == m1) && (m2->qmfOkForAnySqlvalue))
+      if ((SSG_VALMODE_SQLVAL == m1) && IS_BOX_POINTER (m2) && (m2->qmfOkForAnySqlvalue))
         return m2;
+      if ((SSG_VALMODE_NUM == m1) && IS_BOX_POINTER (m2) && (m2->qmfIsSubformatOfLong || m2->qmfIsSubformatOfLongWhenEqToSql))
+        return SSG_VALMODE_NUM;
       return SSG_VALMODE_LONG;
     }
   if (!(m1->qmfIsBijection) || !(m2->qmfIsBijection))
@@ -2741,6 +2871,11 @@ ssg_print_bop_bool_expn (spar_sqlgen_t *ssg, SPART *tree, const char *bool_op, c
     }
   left_vmode = sparp_expn_native_valmode (ssg->ssg_sparp, left);
   right_vmode = sparp_expn_native_valmode (ssg->ssg_sparp, right);
+  if ((SSG_VALMODE_NUM == left_vmode) || (SSG_VALMODE_NUM == right_vmode))
+    {
+      left_vmode = right_vmode = min_mode = SSG_VALMODE_NUM;
+      goto vmodes_found; /* see below */
+    }
 /* There exists a special popular case for a filter for GRAPH `iri(my_expression)` { ... } where graph is made by mapping with a fixed graph.
 Without the special optimization it becomes iri_to_id ('graph iri string from view declaration') = iri_to_id_nosignal (my_expression) */
   if ((BOP_EQ == ttype) &&
@@ -2960,7 +3095,7 @@ ssg_print_bop_calc_expn (spar_sqlgen_t *ssg, SPART *tree, const char *s1, const
       ssg_puts (" NULL");
       return;
     }
-  if ((SSG_VALMODE_LONG != needed) && (SSG_VALMODE_SQLVAL != needed))
+  if ((SSG_VALMODE_LONG != needed) && (SSG_VALMODE_NUM != needed) && (SSG_VALMODE_SQLVAL != needed))
     {
       ssg_print_valmoded_scalar_expn (ssg, tree, needed, SSG_VALMODE_SQLVAL, NULL);
       return;
@@ -2981,7 +3116,7 @@ ssg_print_bop_cmp_expn (spar_sqlgen_t *ssg, SPART *tree, const char *bool_op, co
   SPART *right = tree->_.bin_exp.right;
   ssg_valmode_t left_native;
   ssg_valmode_t right_native;
-  ssg_valmode_t smallest_union;
+  ssg_valmode_t op_arg_valmode;
   const char *cmp_func_name = NULL;
   if (
     (needed != SSG_VALMODE_SQLVAL) && /* Trick! All representations are equal. */
@@ -2990,29 +3125,36 @@ ssg_print_bop_cmp_expn (spar_sqlgen_t *ssg, SPART *tree, const char *bool_op, co
     spar_sqlprint_error ("ssg_print_bop_cmp_expn(): unsupported valmode");
   left_native = sparp_expn_native_valmode (ssg->ssg_sparp, left);
   right_native = sparp_expn_native_valmode (ssg->ssg_sparp, right);
-  smallest_union = ssg_smallest_union_valmode (left_native, right_native);
-  if ((SSG_VALMODE_LONG == smallest_union) ||
-    (IS_BOX_POINTER (smallest_union) && smallest_union->qmfIsSubformatOfLong) )
+#if 0
+  if ((SSG_VALMODE_NUM == left_native) || (SSG_VALMODE_NUM == right_native))
+    op_arg_valmode = SSG_VALMODE_NUM;
+  else
+    op_arg_valmode = ssg_smallest_union_valmode (left_native, right_native);
+#else
+    op_arg_valmode = ssg_largest_eq_valmode (left_native, right_native);
+#endif
+  if ((SSG_VALMODE_LONG == op_arg_valmode) ||
+    (IS_BOX_POINTER (op_arg_valmode) && op_arg_valmode->qmfIsSubformatOfLong) )
     {
       ptrlong left_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, left);
       ptrlong right_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, right);
       if ((SPART_VARR_LONG_EQ_SQL & left_restr_bits) && (SPART_VARR_LONG_EQ_SQL & right_restr_bits))
-        smallest_union = SSG_VALMODE_SQLVAL;
-      else if ((SSG_VALMODE_LONG == smallest_union) &&
+        op_arg_valmode = SSG_VALMODE_SQLVAL;
+      else if ((SSG_VALMODE_LONG == op_arg_valmode) &&
         (SPART_VARR_IS_REF & left_restr_bits) && (SPART_VARR_IS_REF & right_restr_bits) )
-        smallest_union = SSG_VALMODE_SQLVAL;
+        op_arg_valmode = SSG_VALMODE_SQLVAL;
     }
-  if (SSG_VALMODE_LONG == smallest_union)
+  if (SSG_VALMODE_LONG == op_arg_valmode)
     cmp_func_name = "DB.DBA.RDF_LONG_CMP";
-  else if (IS_BOX_POINTER (smallest_union))
-    cmp_func_name = smallest_union->qmfCmpFuncName;
+  else if (IS_BOX_POINTER (op_arg_valmode))
+    cmp_func_name = op_arg_valmode->qmfCmpFuncName;
   else
     { /* Fallback to usual SQL comparison, with possible lack of type checking. */
       ssg_print_bop_bool_expn (ssg, tree, bool_op, sqlval_fn, top_filter_op, needed);
       return;
     }
   if (top_filter_op &&
-    IS_BOX_POINTER (smallest_union) &&
+    IS_BOX_POINTER (op_arg_valmode) &&
     ((SPAR_VARIABLE == SPART_TYPE (left)) || (SPAR_BLANK_NODE_LABEL == SPART_TYPE (left)) ||
       (SPAR_VARIABLE == SPART_TYPE (right)) || (SPAR_BLANK_NODE_LABEL == SPART_TYPE (right)) ) )
     { /* Comparison that is partially optimizable for indexing */
@@ -3020,15 +3162,15 @@ ssg_print_bop_cmp_expn (spar_sqlgen_t *ssg, SPART *tree, const char *bool_op, co
       const char *typemin, *typemax;
       ssg_puts ("((");
       ssg->ssg_indent += 2;
-      ssg_print_scalar_expn (ssg, left, smallest_union, NULL_ASNAME);
+      ssg_print_scalar_expn (ssg, left, op_arg_valmode, NULL_ASNAME);
       ssg_puts (bool_op);
-      ssg_print_scalar_expn (ssg, right, smallest_union, NULL_ASNAME);
+      ssg_print_scalar_expn (ssg, right, op_arg_valmode, NULL_ASNAME);
       ssg_puts (") AND");
       ssg_newline(SSG_INDENT_FACTOR);
       ssg_puts ("(");
 #if 1
-      typemin = smallest_union->qmfTypeminTmpl;
-      typemax = smallest_union->qmfTypemaxTmpl;
+      typemin = op_arg_valmode->qmfTypeminTmpl;
+      typemax = op_arg_valmode->qmfTypemaxTmpl;
 #endif
       if ((BOP_LT == SPART_TYPE (tree)) || (BOP_LTE == SPART_TYPE (tree)))
         {
@@ -3042,15 +3184,15 @@ ssg_print_bop_cmp_expn (spar_sqlgen_t *ssg, SPART *tree, const char *bool_op, co
           else
             typemax = left_native->qmfTypemaxTmpl;
 #endif
-          ssg_print_tmpl (ssg, smallest_union, typemin, NULL, NULL, right, NULL_ASNAME);
+          ssg_print_tmpl (ssg, op_arg_valmode, typemin, NULL, NULL, right, NULL_ASNAME);
           ssg_puts (" <=");
-          ssg_print_scalar_expn (ssg, left, smallest_union, NULL_ASNAME);
+          ssg_print_scalar_expn (ssg, left, op_arg_valmode, NULL_ASNAME);
           ssg_puts (") AND");
           ssg_newline(SSG_INDENT_FACTOR);
           ssg_puts ("(");
-          ssg_print_scalar_expn (ssg, right, smallest_union, NULL_ASNAME);
+          ssg_print_scalar_expn (ssg, right, op_arg_valmode, NULL_ASNAME);
           ssg_puts (" <=");
-          ssg_print_tmpl (ssg, smallest_union, typemax, NULL, NULL, left, NULL_ASNAME);
+          ssg_print_tmpl (ssg, op_arg_valmode, typemax, NULL, NULL, left, NULL_ASNAME);
         }
       else
         {
@@ -3064,24 +3206,24 @@ ssg_print_bop_cmp_expn (spar_sqlgen_t *ssg, SPART *tree, const char *bool_op, co
           else
             typemin = left_native->qmfTypeminTmpl;
 #endif
-          ssg_print_tmpl (ssg, smallest_union, typemax, NULL, NULL, right, NULL_ASNAME);
+          ssg_print_tmpl (ssg, op_arg_valmode, typemax, NULL, NULL, right, NULL_ASNAME);
           ssg_puts (" >=");
-          ssg_print_scalar_expn (ssg, left, smallest_union, NULL_ASNAME);
+          ssg_print_scalar_expn (ssg, left, op_arg_valmode, NULL_ASNAME);
           ssg_puts (") AND");
           ssg_newline(SSG_INDENT_FACTOR);
           ssg_puts ("(");
-          ssg_print_scalar_expn (ssg, right, smallest_union, NULL_ASNAME);
+          ssg_print_scalar_expn (ssg, right, op_arg_valmode, NULL_ASNAME);
           ssg_puts (" >=");
-          ssg_print_tmpl (ssg, smallest_union, typemin, NULL, NULL, left, NULL_ASNAME);
+          ssg_print_tmpl (ssg, op_arg_valmode, typemin, NULL, NULL, left, NULL_ASNAME);
         }
       ssg->ssg_indent -= 2;
       ssg_puts ("))");
 #else
       ssg_puts ("(");
       ssg->ssg_indent += 1;
-      ssg_print_scalar_expn (ssg, left, smallest_union, NULL_ASNAME);
+      ssg_print_scalar_expn (ssg, left, op_arg_valmode, NULL_ASNAME);
       ssg_puts (bool_op);
-      ssg_print_scalar_expn (ssg, right, smallest_union, NULL_ASNAME);
+      ssg_print_scalar_expn (ssg, right, op_arg_valmode, NULL_ASNAME);
       ssg_puts (")");
       ssg->ssg_indent -= 1;
 #endif
@@ -3094,9 +3236,9 @@ ssg_print_bop_cmp_expn (spar_sqlgen_t *ssg, SPART *tree, const char *bool_op, co
       ssg_puts (cmp_func_name);
       ssg_puts ("(");
       ssg->ssg_indent += 2;
-      ssg_print_scalar_expn (ssg, left, smallest_union, NULL_ASNAME);
+      ssg_print_scalar_expn (ssg, left, op_arg_valmode, NULL_ASNAME);
       ssg_puts (",");
-      ssg_print_scalar_expn (ssg, right, smallest_union, NULL_ASNAME);
+      ssg_print_scalar_expn (ssg, right, op_arg_valmode, NULL_ASNAME);
       ssg->ssg_indent -= 2;
       ssg_puts (")");
       ssg_puts (bool_op);
@@ -3108,9 +3250,9 @@ ssg_print_bop_cmp_expn (spar_sqlgen_t *ssg, SPART *tree, const char *bool_op, co
       ssg_puts (cmp_func_name);
       ssg_puts ("(");
       ssg->ssg_indent += 2;
-      ssg_print_scalar_expn (ssg, left, smallest_union, NULL_ASNAME);
+      ssg_print_scalar_expn (ssg, left, op_arg_valmode, NULL_ASNAME);
       ssg_puts (",");
-      ssg_print_scalar_expn (ssg, right, smallest_union, NULL_ASNAME);
+      ssg_print_scalar_expn (ssg, right, op_arg_valmode, NULL_ASNAME);
       ssg->ssg_indent -= 2;
       ssg_puts ("), 0)");
     }
@@ -3125,6 +3267,25 @@ ssg_print_builtin_expn (spar_sqlgen_t *ssg, SPART *tree, int top_filter_op, ssg_
   int argctr;
   ssg_valmode_t op_fmt = NULL;
   int arg1_restr_bits;
+  int builtin_ret_bool;
+  switch (tree->_.builtin.btype)
+    {
+    case BOUND_L: case SAMETERM_L: case LIKE_L: case IN_L:
+    case isBLANK_L: case isURI_L: case isIRI_L: case isREF_L: case isLITERAL_L:
+    case REGEX_L: case LANGMATCHES_L:
+      builtin_ret_bool = 1;
+      break;
+    default:
+      builtin_ret_bool = 0;
+      break;
+    }
+  if (builtin_ret_bool && (
+      (SSG_VALMODE_LONG != needed) && (SSG_VALMODE_SQLVAL != needed) && (SSG_VALMODE_NUM != needed)
+      && (SSG_VALMODE_SHORT_OR_LONG != needed) && (SSG_VALMODE_AUTO != needed) && (SSG_VALMODE_BOOL != needed) ) )
+    {
+      ssg_print_valmoded_scalar_expn (ssg, tree, needed, SSG_VALMODE_BOOL, NULL_ASNAME);
+      return;
+    }
   switch (tree->_.builtin.btype)
     {
     case BOUND_L:
@@ -3133,20 +3294,12 @@ ssg_print_builtin_expn (spar_sqlgen_t *ssg, SPART *tree, int top_filter_op, ssg_
         arg1_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, arg1);
         if (arg1_restr_bits & SPART_VARR_NOT_NULL)
           {
-#ifdef NDEBUG
-            ssg_puts (" 1");
-#else
-            ssg_puts (" 1 /* optimized BOUND */");
-#endif
+            ssg_puts_with_comment (" 1", "optimized BOUND");
             return;
           }
         if (arg1_restr_bits & (SPART_VARR_ALWAYS_NULL | SPART_VARR_CONFLICT))
           {
-#ifdef NDEBUG
-            ssg_puts (" 0");
-#else
-            ssg_puts (" 0 /* optimized BOUND */");
-#endif
+            ssg_puts_with_comment (" 0", "optimized BOUND");
             return;
           }
         if (top_filter_op)
@@ -3244,72 +3397,70 @@ expanded_sameterm_ready:
         }
       return;
     case IN_L:
-      if ((SSG_VALMODE_BOOL != needed) && (SSG_VALMODE_SQLVAL != needed) && (SSG_VALMODE_LONG != needed))
-        ssg_print_valmoded_scalar_expn (ssg, tree, needed, SSG_VALMODE_BOOL, NULL_ASNAME);
-      else
+      if ((SSG_VALMODE_BOOL != needed) && (SSG_VALMODE_NUM != needed) && (SSG_VALMODE_SQLVAL != needed) && (SSG_VALMODE_LONG != needed))
         {
-          if (IS_BOX_POINTER (arg1_native) && (1 == arg1_native->qmfColumnCount))
+          ssg_print_valmoded_scalar_expn (ssg, tree, needed, SSG_VALMODE_BOOL, NULL_ASNAME);
+          return;
+        }
+      switch (BOX_ELEMENTS (tree->_.builtin.args))
+        {
+        case 1: ssg_puts (/*top_filter_op ? " (1=2)" :*/ " 0"); return;
+        case 2:
+          if (SPAR_IS_LIT_OR_QNAME (tree->_.builtin.args[1]))
+            {
+              SPART *eq = spartlist (ssg->ssg_sparp, 3, BOP_EQ, arg1, tree->_.builtin.args[1]);
+              ssg_print_bop_bool_expn (ssg, eq, " = ", " equ (", top_filter_op, needed);
+              return;
+            }
+        default: break;
+        }
+      if (IS_BOX_POINTER (arg1_native) ? (arg1_native->qmfIsBijection) : (SSG_VALMODE_LONG != arg1_native))
+        {
+          op_fmt = sparp_expn_native_valmode (ssg->ssg_sparp, tree->_.builtin.args[1]);
+          for (argctr = BOX_ELEMENTS (tree->_.builtin.args); argctr-- > 2; /* no step */)
+            {
+              SPART * argN = tree->_.builtin.args[argctr];
+              ssg_valmode_t argN_native = sparp_expn_native_valmode (ssg->ssg_sparp, argN);
+              if (argN_native != op_fmt)
+                {
+                  op_fmt = ssg_smallest_union_valmode (op_fmt, argN_native);
+                  if (SSG_VALMODE_LONG == op_fmt)
+                    break;
+                }
+            }
+          op_fmt = ssg_largest_eq_valmode (op_fmt, arg1_native);
+          if (SSG_VALMODE_LONG == op_fmt)
             {
-              op_fmt = arg1_native;
               DO_BOX_FAST (SPART *, argN, argctr, tree->_.builtin.args)
                 {
                   ssg_valmode_t argN_native;
-                  if (0 == argctr)
-                    continue;
                   argN_native = sparp_expn_native_valmode (ssg->ssg_sparp, argN);
-                  if (argN_native != op_fmt)
+                  if ((SSG_VALMODE_SQLVAL == argN_native) || (SSG_VALMODE_BOOL == argN_native))
+                    continue;
+                  if (IS_BOX_POINTER (argN_native) &&
+                    ((argN_native->qmfIsSubformatOfLong &&
+                        (SPART_VARR_LONG_EQ_SQL & argN_native->qmfValRange.rvrRestrictions ) ) ||
+                       !strcmp (argN_native->qmfSqlvalOfShortTmpl, " ^{tree}^") ) )
+                    continue;
+                  if ((IS_BOX_POINTER (argN_native) &&
+                    argN_native->qmfIsSubformatOfLong) ||
+                    (SSG_VALMODE_LONG == argN_native) )
                     {
-                      op_fmt = ssg_smallest_union_valmode (op_fmt, argN_native);
-                      if (!IS_BOX_POINTER (op_fmt))
-                        break;
+                      ptrlong rbits = sparp_restr_bits_of_expn (ssg->ssg_sparp, argN);
+                      if (SPART_VARR_LONG_EQ_SQL & rbits)
+                        continue;
                     }
+                  goto IN_cant_use_SQLVAL; /* see below */
                 }
               END_DO_BOX_FAST;
-              if (SSG_VALMODE_LONG == op_fmt)
-                {
-                  DO_BOX_FAST (SPART *, argN, argctr, tree->_.builtin.args)
-                    {
-                      ssg_valmode_t argN_native;
-                      argN_native = sparp_expn_native_valmode (ssg->ssg_sparp, argN);
-                      if ((SSG_VALMODE_SQLVAL == argN_native) || (SSG_VALMODE_BOOL == argN_native))
-                        continue;
-                      if (IS_BOX_POINTER (argN_native) &&
-                        ((argN_native->qmfIsSubformatOfLong &&
-                            (SPART_VARR_LONG_EQ_SQL & argN_native->qmfValRange.rvrRestrictions ) ) ||
-                           !strcmp (argN_native->qmfSqlvalOfShortTmpl, " ^{tree}^") ) )
-                        continue;
-                      if ((IS_BOX_POINTER (argN_native) &&
-                        argN_native->qmfIsSubformatOfLong) ||
-                        (SSG_VALMODE_LONG == argN_native) )
-                        {
-                          ptrlong rbits = sparp_restr_bits_of_expn (ssg->ssg_sparp, argN);
-                          if (SPART_VARR_LONG_EQ_SQL & rbits)
-                            continue;
-                        }
-                      goto IN_cant_use_SQLVAL; /* see below */
-                    }
-                  END_DO_BOX_FAST;
-                  op_fmt = SSG_VALMODE_SQLVAL;
-                  goto IN_op_fnt_found; /* see below */
+              op_fmt = SSG_VALMODE_SQLVAL;
+              goto IN_op_fnt_found; /* see below */
 IN_cant_use_SQLVAL: ;
-                }
             }
-          else
-            op_fmt = SSG_VALMODE_LONG;
         }
+      else
+        op_fmt = SSG_VALMODE_LONG;
 IN_op_fnt_found:
-      switch (BOX_ELEMENTS (tree->_.builtin.args))
-        {
-        case 0: ssg_puts (/*top_filter_op ? " (1=2)" :*/ " 0"); return;
-        case 1:
-          ssg_puts (top_filter_op ? " (" : " equ (");
-          ssg_print_scalar_expn (ssg, arg1, op_fmt, NULL_ASNAME);
-          ssg_puts (top_filter_op ? " = /* in one */ " : " ,");
-          ssg_print_scalar_expn (ssg, tree->_.builtin.args[1], op_fmt, NULL_ASNAME);
-          ssg_puts (")");
-          return;
-        default: break;
-        }
       DO_BOX_FAST (SPART *, argN, argctr, tree->_.builtin.args)
         {
           switch (argctr)
@@ -3331,11 +3482,7 @@ IN_op_fnt_found:
           arg1_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, arg1);
           if (arg1_restr_bits & (SPART_VARR_IS_LIT | SPART_VARR_ALWAYS_NULL | SPART_VARR_CONFLICT))
             {
-#ifdef NDEBUG
-              ssg_puts (" 0");
-#else
-              ssg_puts (" 0 /* optimized isBLANK */");
-#endif
+              ssg_puts_with_comment (" 0", "optimized isBLANK");
               return;
             }
           if (IS_BOX_POINTER (arg1_native))
@@ -3364,11 +3511,7 @@ IN_op_fnt_found:
           arg1_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, arg1);
           if (arg1_restr_bits & (SPART_VARR_IS_REF | SPART_VARR_LONG_EQ_SQL | SPART_VARR_ALWAYS_NULL))
             {
-#ifdef NDEBUG
-              ssg_puts (" NULL");
-#else
-              ssg_puts (" NULL /* optimized LANG */");
-#endif
+              ssg_puts_with_comment (" NULL", "optimized LANG");
               return;
             }
           ssg_print_scalar_expn (ssg, arg1, SSG_VALMODE_LANGUAGE, NULL_ASNAME);
@@ -3376,117 +3519,78 @@ IN_op_fnt_found:
       return;
     case isURI_L:
     case isIRI_L:
-      if ((SSG_VALMODE_BOOL != needed) && (SSG_VALMODE_SQLVAL != needed) && (SSG_VALMODE_LONG != needed))
-        ssg_print_valmoded_scalar_expn (ssg, tree, needed, SSG_VALMODE_BOOL, NULL_ASNAME);
-      else
+      arg1_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, arg1);
+      if (arg1_restr_bits & (SPART_VARR_IS_LIT | SPART_VARR_ALWAYS_NULL | SPART_VARR_CONFLICT))
         {
-          arg1_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, arg1);
-          if (arg1_restr_bits & (SPART_VARR_IS_LIT | SPART_VARR_ALWAYS_NULL | SPART_VARR_CONFLICT))
-            {
-#ifdef NDEBUG
-              ssg_puts (" 0");
-#else
-              ssg_puts (" 0 /* optimized isIRI */");
-#endif
-              return;
-            }
-          if (arg1_restr_bits & SPART_VARR_IS_REF & SPART_VARR_NOT_NULL)
-            {
-#ifdef NDEBUG
-              ssg_puts (" 1");
-#else
-              ssg_puts (" 1 /* optimized isIRI */");
-#endif
-              return;
-            }
-          if (IS_BOX_POINTER (arg1_native))
-            {
-              const char *tmpl = ((top_filter_op || (NULL == arg1_native->qmf01uriOfShortTmpl)) ?
-                arg1_native->qmfIsuriOfShortTmpl : arg1_native->qmf01uriOfShortTmpl );
-              ssg_print_tmpl (ssg, arg1_native, tmpl, NULL, NULL, arg1, NULL_ASNAME);
-            }
-          else if (SSG_VALMODE_LONG == arg1_native)
-            ssg_print_tmpl (ssg, arg1_native,
-              (top_filter_op ?
-                " ((isiri_id (^{tree}^) and (^{tree}^ < min_bnode_iri_id ()))" :
-                " either (isiri_id (^{tree}^), lt (^{tree}^, min_bnode_iri_id ()), 0)" ),
-              NULL, NULL, arg1, NULL );
-          else if (SSG_VALMODE_SQLVAL == arg1_native)
-            ssg_print_tmpl (ssg, arg1_native, " DB.DBA.RDF_IS_URI_REF (^{tree}^)", NULL, NULL, arg1, NULL_ASNAME);
-          else
-            spar_sqlprint_error ("ssg_" "print_builtin_expn(): bad native type for isURI()");
+          ssg_puts_with_comment (" 0", "optimized isIRI");
+          return;
+        }
+      if (arg1_restr_bits & SPART_VARR_IS_REF & SPART_VARR_NOT_NULL)
+        {
+          ssg_puts_with_comment (" 1", "optimized isIRI");
+          return;
+        }
+      if (IS_BOX_POINTER (arg1_native))
+        {
+          const char *tmpl = ((top_filter_op || (NULL == arg1_native->qmf01uriOfShortTmpl)) ?
+            arg1_native->qmfIsuriOfShortTmpl : arg1_native->qmf01uriOfShortTmpl );
+          ssg_print_tmpl (ssg, arg1_native, tmpl, NULL, NULL, arg1, NULL_ASNAME);
         }
+      else if (SSG_VALMODE_LONG == arg1_native)
+        ssg_print_tmpl (ssg, arg1_native,
+          (top_filter_op ?
+            " ((isiri_id (^{tree}^) and (^{tree}^ < min_bnode_iri_id ()))" :
+            " either (isiri_id (^{tree}^), lt (^{tree}^, min_bnode_iri_id ()), 0)" ),
+          NULL, NULL, arg1, NULL );
+      else if (SSG_VALMODE_SQLVAL == arg1_native)
+        ssg_print_tmpl (ssg, arg1_native, " DB.DBA.RDF_IS_URI_REF (^{tree}^)", NULL, NULL, arg1, NULL_ASNAME);
+      else
+        spar_sqlprint_error ("ssg_" "print_builtin_expn(): bad native type for isURI()");
       return;
     case isREF_L:
-      if ((SSG_VALMODE_BOOL != needed) && (SSG_VALMODE_SQLVAL != needed) && (SSG_VALMODE_LONG != needed))
-        ssg_print_valmoded_scalar_expn (ssg, tree, needed, SSG_VALMODE_BOOL, NULL_ASNAME);
-      else
+      arg1_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, arg1);
+      if (arg1_restr_bits & (SPART_VARR_IS_LIT | SPART_VARR_ALWAYS_NULL | SPART_VARR_CONFLICT))
         {
-          arg1_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, arg1);
-          if (arg1_restr_bits & (SPART_VARR_IS_LIT | SPART_VARR_ALWAYS_NULL | SPART_VARR_CONFLICT))
-            {
-#ifdef NDEBUG
-              ssg_puts (" 0");
-#else
-              ssg_puts (" 0 /* optimized isREF */");
-#endif
-              return;
-            }
-          if (arg1_restr_bits & SPART_VARR_IS_REF & SPART_VARR_NOT_NULL)
-            {
-#ifdef NDEBUG
-              ssg_puts (" 1");
-#else
-              ssg_puts (" 1 /* optimized isREF */");
-#endif
-              return;
-            }
-          if (IS_BOX_POINTER (arg1_native))
-            ssg_print_tmpl (ssg, arg1_native, arg1_native->qmfIsrefOfShortTmpl, NULL, NULL, arg1, NULL_ASNAME);
-          else if (SSG_VALMODE_LONG == arg1_native)
-            ssg_print_tmpl (ssg, arg1_native, " isiri_id (^{tree}^)", NULL, NULL, arg1, NULL);
-          else if (SSG_VALMODE_SQLVAL == arg1_native)
-            ssg_print_tmpl (ssg, arg1_native, " DB.DBA.RDF_IS_REF (^{tree}^)", NULL, NULL, arg1, NULL_ASNAME);
-          else
-            spar_sqlprint_error ("ssg_" "print_builtin_expn(): bad native type for isREF()");
+          ssg_puts_with_comment (" 0", "optimized isREF");
+          return;
+        }
+      if (arg1_restr_bits & SPART_VARR_IS_REF & SPART_VARR_NOT_NULL)
+        {
+          ssg_puts_with_comment (" 1", "optimized isREF");
+          return;
         }
+      if (IS_BOX_POINTER (arg1_native))
+        ssg_print_tmpl (ssg, arg1_native, arg1_native->qmfIsrefOfShortTmpl, NULL, NULL, arg1, NULL_ASNAME);
+      else if (SSG_VALMODE_LONG == arg1_native)
+        ssg_print_tmpl (ssg, arg1_native, " isiri_id (^{tree}^)", NULL, NULL, arg1, NULL);
+      else if (SSG_VALMODE_SQLVAL == arg1_native)
+        ssg_print_tmpl (ssg, arg1_native, " DB.DBA.RDF_IS_REF (^{tree}^)", NULL, NULL, arg1, NULL_ASNAME);
+      else
+        spar_sqlprint_error ("ssg_" "print_builtin_expn(): bad native type for isREF()");
       return;
     case isLITERAL_L:
-      if ((SSG_VALMODE_BOOL != needed) && (SSG_VALMODE_SQLVAL != needed) && (SSG_VALMODE_LONG != needed))
-        ssg_print_valmoded_scalar_expn (ssg, tree, needed, SSG_VALMODE_BOOL, NULL_ASNAME);
-      else
+      arg1_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, arg1);
+      if (arg1_restr_bits & (SPART_VARR_IS_REF | SPART_VARR_ALWAYS_NULL | SPART_VARR_CONFLICT))
         {
-          arg1_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, arg1);
-          if (arg1_restr_bits & (SPART_VARR_IS_REF | SPART_VARR_ALWAYS_NULL | SPART_VARR_CONFLICT))
-            {
-#ifdef NDEBUG
-              ssg_puts (" 0");
-#else
-              ssg_puts (" 0 /* optimized isLITERAL */");
-#endif
-              return;
-            }
-          if (arg1_restr_bits & SPART_VARR_IS_LIT & SPART_VARR_NOT_NULL)
-            {
-#ifdef NDEBUG
-              ssg_puts (" 1");
-#else
-              ssg_puts (" 1 /* optimized isLITERAL */");
-#endif
-              return;
-            }
-          if (IS_BOX_POINTER (arg1_native))
-            ssg_print_tmpl (ssg, arg1_native, arg1_native->qmfIslitOfShortTmpl, NULL, NULL, arg1, NULL_ASNAME);
-          else if (SSG_VALMODE_LONG == arg1_native)
-            ssg_print_tmpl (ssg, arg1_native,
-              (top_filter_op ?
-                " (not (isiri_id (^{tree}^)))" : " iszero (isiri_id (^{tree}^))" ),
-              NULL, NULL, arg1, NULL );
-          else if (SSG_VALMODE_SQLVAL == arg1_native)
-            ssg_print_tmpl (ssg, arg1_native, " DB.DBA.RDF_IS_LITERAL (^{tree}^)", NULL, NULL, arg1, NULL_ASNAME);
-          else
-            spar_sqlprint_error ("ssg_" "print_builtin_expn(): bad native type for isLITERAL()");
+          ssg_puts_with_comment (" 0", "optimized isLITERAL");
+          return;
         }
+      if (arg1_restr_bits & SPART_VARR_IS_LIT & SPART_VARR_NOT_NULL)
+        {
+          ssg_puts_with_comment (" 1", "optimized isLITERAL");
+          return;
+        }
+      if (IS_BOX_POINTER (arg1_native))
+        ssg_print_tmpl (ssg, arg1_native, arg1_native->qmfIslitOfShortTmpl, NULL, NULL, arg1, NULL_ASNAME);
+      else if (SSG_VALMODE_LONG == arg1_native)
+        ssg_print_tmpl (ssg, arg1_native,
+          (top_filter_op ?
+            " (not (isiri_id (^{tree}^)))" : " iszero (isiri_id (^{tree}^))" ),
+          NULL, NULL, arg1, NULL );
+      else if (SSG_VALMODE_SQLVAL == arg1_native)
+        ssg_print_tmpl (ssg, arg1_native, " DB.DBA.RDF_IS_LITERAL (^{tree}^)", NULL, NULL, arg1, NULL_ASNAME);
+      else
+        spar_sqlprint_error ("ssg_" "print_builtin_expn(): bad native type for isLITERAL()");
       return;
     case IRI_L:
       {
@@ -3508,11 +3612,19 @@ IN_op_fnt_found:
           {
             const char *tmpl = NULL;
             if (IS_BOX_POINTER (arg1_native))
-              tmpl = arg1_native->qmfStrsqlvalOfShortTmpl;
-            else if ((SSG_VALMODE_LONG == arg1_native) || (SSG_VALMODE_SQLVAL == arg1_native))
-              tmpl = " __rdf_strsqlval (^{tree}^)";
+              {
+                ssg_puts (" __bft (");
+                tmpl = arg1_native->qmfStrsqlvalOfShortTmpl;
+                ssg_print_tmpl (ssg, arg1_native, tmpl, NULL, NULL, arg1, NULL_ASNAME);
+                ssg_puts (", 1)");
+                return;
+              }
+            else if ((SSG_VALMODE_LONG == arg1_native) || (SSG_VALMODE_SQLVAL == arg1_native) || (SSG_VALMODE_AUTO == arg1_native))
+              tmpl = " __rdf_strsqlval (^{tree}^, 2)"; /* SSG_VALMODE_AUTO is here as a fallback for a query optimized down to an empty select */
+            else if (SSG_VALMODE_BOOL == arg1_native)
+              tmpl = " __bft (case (^{tree}^) when 0 then 'false' else 'true' end, 1)";
             else
-              spar_sqlprint_error ("ssg_" "print_builtin_expn(): bad native type for IRI()");
+              spar_sqlprint_error ("ssg_" "print_builtin_expn(): bad native type for STR()");
             ssg_print_tmpl (ssg, arg1_native, tmpl, NULL, NULL, arg1, NULL_ASNAME);
           }
         else if (SSG_VALMODE_LONG == needed)
@@ -3541,7 +3653,7 @@ IN_op_fnt_found:
             const char *tmpl = NULL;
             if (IS_BOX_POINTER (arg1_native))
               tmpl = arg1_native->qmfStrsqlvalOfShortTmpl;
-            else if ((SSG_VALMODE_LONG == arg1_native) || (SSG_VALMODE_SQLVAL == arg1_native) || (SSG_VALMODE_AUTO == arg1_native))
+            else if ((SSG_VALMODE_LONG == arg1_native) || (SSG_VALMODE_SQLVAL == arg1_native) || (SSG_VALMODE_AUTO == arg1_native) || (SSG_VALMODE_NUM == arg1_native))
               tmpl = " __rdf_strsqlval (^{tree}^, 0)"; /* SSG_VALMODE_AUTO is here as a fallback for a query optimized down to an empty select */
             else if (SSG_VALMODE_BOOL == arg1_native)
               tmpl = " case (^{tree}^) when 0 then 'false' else 'true' end";
@@ -3558,43 +3670,30 @@ IN_op_fnt_found:
         return;
       }
     case REGEX_L:
-      if ((SSG_VALMODE_BOOL != needed) && (SSG_VALMODE_SQLVAL != needed))
-        ssg_print_valmoded_scalar_expn (ssg, tree, needed, SSG_VALMODE_BOOL, NULL_ASNAME);
-      else
-        { /*!!!TBD extra 'between'*/
-          ssg_puts (" rdf_regex_impl (");
-          ssg_print_scalar_expn (ssg, arg1, SSG_VALMODE_SQLVAL, NULL_ASNAME);
+      /*!!!TBD extra 'between'*/
+      ssg_puts (" rdf_regex_impl (");
+      ssg_print_scalar_expn (ssg, arg1, SSG_VALMODE_SQLVAL, NULL_ASNAME);
+      ssg_putchar (',');
+      ssg_print_scalar_expn (ssg, tree->_.builtin.args[1], SSG_VALMODE_SQLVAL, NULL_ASNAME);
+      if (3 == BOX_ELEMENTS (tree->_.builtin.args))
+        {
           ssg_putchar (',');
-          ssg_print_scalar_expn (ssg, tree->_.builtin.args[1], SSG_VALMODE_SQLVAL, NULL_ASNAME);
-          if (3 == BOX_ELEMENTS (tree->_.builtin.args))
-            {
-              ssg_putchar (',');
-              ssg_print_scalar_expn (ssg, tree->_.builtin.args[2], SSG_VALMODE_SQLVAL, NULL_ASNAME);
-            }
-          ssg_putchar (')');
+          ssg_print_scalar_expn (ssg, tree->_.builtin.args[2], SSG_VALMODE_SQLVAL, NULL_ASNAME);
         }
+      ssg_putchar (')');
       return;
     case LANGMATCHES_L:
-      if ((SSG_VALMODE_BOOL != needed) && (SSG_VALMODE_SQLVAL != needed) && (SSG_VALMODE_LONG != needed))
-        ssg_print_valmoded_scalar_expn (ssg, tree, needed, SSG_VALMODE_BOOL, NULL_ASNAME);
-      else
+      arg1_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, arg1);
+      if (arg1_restr_bits & (SPART_VARR_IS_REF | SPART_VARR_ALWAYS_NULL))
         {
-          arg1_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, arg1);
-          if (arg1_restr_bits & (SPART_VARR_IS_REF | SPART_VARR_ALWAYS_NULL))
-            {
-#ifdef NDEBUG
-              ssg_puts (" 0");
-#else
-              ssg_puts (" 0 /* optimized LANGMATCHES */");
-#endif
-              return;
-            }
-          ssg_puts (" DB.DBA.RDF_LANGMATCHES (");
-          ssg_print_scalar_expn (ssg, arg1, SSG_VALMODE_SQLVAL, NULL_ASNAME);
-          ssg_putchar (',');
-          ssg_print_scalar_expn (ssg, tree->_.builtin.args[1], SSG_VALMODE_SQLVAL, NULL_ASNAME);
-          ssg_putchar (')');
+          ssg_puts_with_comment (" 0", "optimized LANGMATCHES");
+          return;
         }
+      ssg_puts (" DB.DBA.RDF_LANGMATCHES (");
+      ssg_print_scalar_expn (ssg, arg1, SSG_VALMODE_SQLVAL, NULL_ASNAME);
+      ssg_putchar (',');
+      ssg_print_scalar_expn (ssg, tree->_.builtin.args[1], SSG_VALMODE_SQLVAL, NULL_ASNAME);
+      ssg_putchar (')');
       return;
     default:
       spar_sqlprint_error ("ssg_" "print_builtin_expn(): unsupported builtin");
@@ -3635,6 +3734,7 @@ sparp_find_valmode_by_name_prefix (sparp_t *sparp, caddr_t name, ssg_valmode_t d
   if (!strncmp (name_begin, "SQLVAL::"		, 8))	return SSG_VALMODE_SQLVAL;
   if (!strncmp (name_begin, "LONG::"		, 6))	return SSG_VALMODE_LONG;
   if (!strncmp (name_begin, "BOOL::"		, 6))	return SSG_VALMODE_BOOL;
+  if (!strncmp (name_begin, "NUM::"		, 5))	return SSG_VALMODE_NUM;
   if (!strncmp (name_begin, "SHORT::"		, 7))	return qm_format_default;
   if (!strncmp (name_begin, "SPECIAL::"		, 9))	return SSG_VALMODE_SPECIAL;
   if (!strncmp (name_begin, "SHORT_OR_LONG::"	, 15))	return SSG_VALMODE_SHORT_OR_LONG;
@@ -3691,13 +3791,38 @@ sparp_rettype_of_function (sparp_t *sparp, caddr_t name)
         return SSG_VALMODE_SQLVAL;
       spar_internal_error (sparp, "sparp_" "rettype_of_function(): unsupported SPECIAL");
     }
-  if (!strcmp (name, uname_xmlschema_ns_uri_hash_string))
-    return SSG_VALMODE_LONG;
-#if 0
-  return res;
-#else
+  if (!strncmp (name, "bif:", 4))
+    {
+      caddr_t iduqname = sqlp_box_id_upcase (name+4);
+      bif_type_t ** bt = (bif_type_t **) id_hash_get (name_to_bif_type, (char *) &iduqname);
+      if (NULL != bt)
+        {
+          switch (bt[0]->bt_dtp)
+            {
+              case DV_DOUBLE_FLOAT:
+              case DV_SINGLE_FLOAT:
+              case DV_NUMERIC:
+              case DV_LONG_INT:
+              case DV_DATE:
+              case DV_TIME:
+              case DV_DATETIME: return SSG_VALMODE_NUM;
+              default: return SSG_VALMODE_SQLVAL;
+            }
+        }
+    }
+  else if (!strncmp (name, XMLSCHEMA_NS_URI, XMLSCHEMA_NS_URI_LEN))
+    {
+      const char *localpart = name + XMLSCHEMA_NS_URI_LEN;
+      if (!strcmp (localpart, uname_xmlschema_ns_uri_hash_boolean + XMLSCHEMA_NS_URI_LEN))	return SSG_VALMODE_BOOL;
+      if (!strcmp (localpart, uname_xmlschema_ns_uri_hash_date + XMLSCHEMA_NS_URI_LEN))		return SSG_VALMODE_LONG;
+      if (!strcmp (localpart, uname_xmlschema_ns_uri_hash_dateTime + XMLSCHEMA_NS_URI_LEN))	return SSG_VALMODE_LONG;
+      if (!strcmp (localpart, uname_xmlschema_ns_uri_hash_decimal + XMLSCHEMA_NS_URI_LEN))	return SSG_VALMODE_NUM;
+      if (!strcmp (localpart, uname_xmlschema_ns_uri_hash_double + XMLSCHEMA_NS_URI_LEN))	return SSG_VALMODE_NUM;
+      if (!strcmp (localpart, uname_xmlschema_ns_uri_hash_float + XMLSCHEMA_NS_URI_LEN))	return SSG_VALMODE_NUM;
+      if (!strcmp (localpart, uname_xmlschema_ns_uri_hash_string + XMLSCHEMA_NS_URI_LEN))	return SSG_VALMODE_LONG;
+      if (!strcmp (localpart, uname_xmlschema_ns_uri_hash_time + XMLSCHEMA_NS_URI_LEN))		return SSG_VALMODE_LONG;
+    }
   return SSG_VALMODE_SQLVAL /* not "return res" */;
-#endif
 }
 
 
@@ -3872,6 +3997,8 @@ ssg_tmpl_X_of_short (ssg_valmode_t needed, qm_format_t *qm_fmt)
     return qm_fmt->qmfBoolOfShortTmpl;
   if (SSG_VALMODE_SHORT_OR_LONG == needed)
     return qm_fmt->qmfLongOfShortTmpl;
+  if (SSG_VALMODE_NUM == needed)
+    return ((qm_fmt->qmfIsSubformatOfLong || qm_fmt->qmfIsSubformatOfLongWhenEqToSql) ? " ^{tree}^" : qm_fmt->qmfLongOfShortTmpl);
   spar_internal_error (NULL, "ssg_" "tmpl_X_of_short(): bad mode needed");
   return NULL; /* Never reached, to keep compiler happy */
 }
@@ -3880,6 +4007,7 @@ const char *ssg_tmpl_literal_short_of_X (qm_format_t *qm_fmt, ssg_valmode_t nati
 {
   if (SSG_VALMODE_LONG == native)	return qm_fmt->qmfShortOfLongTmpl;
   if (SSG_VALMODE_SQLVAL == native)	return qm_fmt->qmfShortOfSqlvalTmpl;
+  if (SSG_VALMODE_NUM == native)	return qm_fmt->qmfShortOfSqlvalTmpl;
   spar_internal_error (NULL, "ssg_" "tmpl_literal_short_of_X(): bad mode needed");
   return NULL; /* Never reached, to keep compiler happy */
 }
@@ -3898,27 +4026,39 @@ const char *ssg_tmpl_X_of_Y (ssg_valmode_t needed, ssg_valmode_t native)
     {
       if (SSG_VALMODE_LONG	== native)	return " ^{tree}^";
       if (SSG_VALMODE_SQLVAL	== native)	return " DB.DBA.RDF_LONG_OF_SQLVAL (^{tree}^)";
+      if (SSG_VALMODE_NUM	== native)	return " ^{tree}^";
     }
   else if (SSG_VALMODE_SQLVAL == needed)
     {
       if (SSG_VALMODE_LONG	== native)	return " __rdf_sqlval_of_obj /*l*/ (^{tree}^)";
       if (SSG_VALMODE_SQLVAL	== native)	return " ^{tree}^";
+      if (SSG_VALMODE_NUM	== native)	return " ^{tree}^";
     }
   else if (SSG_VALMODE_DATATYPE == needed)
     {
       if (SSG_VALMODE_LONG	== native)	return " DB.DBA.RDF_DATATYPE_OF_LONG (^{tree}^)";
       if (SSG_VALMODE_SQLVAL	== native)	return " DB.DBA.RDF_DATATYPE_OF_SQLVAL (^{tree}^)";
+      if (SSG_VALMODE_NUM	== native)	return " DB.DBA.RDF_DATATYPE_OF_SQLVAL (^{tree}^)";
     }
   else if (SSG_VALMODE_LANGUAGE == needed)
     {
       if (SSG_VALMODE_LONG	== native)	return " DB.DBA.RDF_LANGUAGE_OF_LONG (^{tree}^)";
       if (SSG_VALMODE_SQLVAL	== native)	return " DB.DBA.RDF_LANGUAGE_OF_SQLVAL (^{tree}^)";
+      if (SSG_VALMODE_NUM	== native)	return " NULL";
+      if (SSG_VALMODE_BOOL	== native)	return " NULL";
     }
   else if (SSG_VALMODE_BOOL == needed)
     {
+      if (SSG_VALMODE_NUM	== native)	return " (^{tree}^)";
       if (SSG_VALMODE_LONG	== native)	return " DB.DBA.RDF_BOOL_OF_LONG (^{tree}^)";
       if (SSG_VALMODE_SQLVAL	== native)	return " (^{tree}^)";
     }
+  else if (SSG_VALMODE_NUM == needed)
+    {
+      if (SSG_VALMODE_SQLVAL	== native)	return " (^{tree}^)";
+      if (SSG_VALMODE_LONG	== native)	return " (^{tree}^)";
+      return ((native->qmfIsSubformatOfLong || native->qmfIsSubformatOfLongWhenEqToSql) ? " ^{tree}^" : native->qmfLongOfShortTmpl);
+    }
   spar_internal_error (NULL, "ssg_tmpl_X_of_Y(): bad mode needed");
   return NULL; /* Never reached, to keep compiler happy */
 }
@@ -3927,7 +4067,22 @@ const char *ssg_tmpl_X_of_Y (ssg_valmode_t needed, ssg_valmode_t native)
 void
 ssg_print_valmoded_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t needed, ssg_valmode_t native, const char *asname)
 {
-  if ((native == needed) || (SSG_VALMODE_AUTO == needed))
+  if (native == needed)
+    {
+#if 0
+      static SPART *prev_tree, *pp_tree;
+      static const char *prev_asname, *pp_asname;
+      if ((prev_tree == tree) && (pp_tree == prev_tree) && (prev_asname == asname) && (pp_asname == prev_asname))
+        spar_internal_error (NULL, "ssg_print_valmoded_scalar_expn(): cyclic call?");
+      pp_tree = prev_tree;
+      prev_tree = tree;
+      pp_asname = prev_asname;
+      prev_asname = asname;
+#endif
+      ssg_print_scalar_expn (ssg, tree, native, asname);
+      return;
+    }
+  if (SSG_VALMODE_AUTO == needed)
     {
       ssg_print_scalar_expn (ssg, tree, native, asname);
       return;
@@ -3936,11 +4091,21 @@ ssg_print_valmoded_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t n
     native = sparp_expn_native_valmode (ssg->ssg_sparp, tree);
   if (SSG_VALMODE_BOOL == native)
     {
-      if ((SSG_VALMODE_SQLVAL == needed) || (SSG_VALMODE_LONG == needed) || (SSG_VALMODE_SHORT_OR_LONG == needed))
+      if ((SSG_VALMODE_SQLVAL == needed) || (SSG_VALMODE_LONG == needed) || (SSG_VALMODE_SHORT_OR_LONG == needed) || (SSG_VALMODE_NUM == needed))
         {
           ssg_print_scalar_expn (ssg, tree, SSG_VALMODE_BOOL, asname);
           return;
         }
+      if (SSG_VALMODE_DATATYPE == needed)
+        {
+          ssg_print_box_as_sql_atom (ssg, uname_xmlschema_ns_uri_hash_boolean, SQL_ATOM_UNAME_ALLOWED);
+          return;
+        }
+      if (SSG_VALMODE_LANGUAGE == needed)
+        {
+          ssg_puts (" NULL /* lang of bool */");
+          return;
+        }
       native = SSG_VALMODE_LONG;
     }
   if (
@@ -3977,6 +4142,11 @@ ssg_print_valmoded_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t n
           ssg_print_scalar_expn (ssg, tree, native, asname);
           return;
         }
+      if ((SSG_VALMODE_NUM == needed) && (native->qmfIsSubformatOfLong || native->qmfIsSubformatOfLongWhenEqToSql))
+        {
+          ssg_print_scalar_expn (ssg, tree, native, asname);
+          return;
+        }
       if (((SSG_VALMODE_LONG == needed) || (SSG_VALMODE_SHORT_OR_LONG == needed)) && native->qmfIsSubformatOfLongWhenRef)
         {
           ptrlong tree_restr_bits = sparp_restr_bits_of_expn (ssg->ssg_sparp, tree);
@@ -4075,7 +4245,7 @@ ssg_triple_retval_alias (spar_sqlgen_t *ssg, SPART *triple, int field_idx, int c
             {
               const char *t = v + box_length (v) - 1;
               int ctr = 20;
-              while ((0 < ctr--) && (v < t) && (isalnum (t[-1]))) t--;
+              while ((0 < ctr--) && (v < t) && (isalnum ((unsigned char) (t[-1])))) t--;
               tail = t;
             }
           full_vname = t_box_sprintf (210, "%lx~%.100s", box_hash (v), tail);
@@ -4184,9 +4354,20 @@ ssg_print_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t needed, co
             if (SPART_BAD_EQUIV_IDX == eq_idx)
               spar_error (ssg->ssg_sparp, "Unable to use variable ?%.100s in OPTION () clause, try to rephrase the query", tree->_.var.vname);
             eq = ssg->ssg_equivs[eq_idx];
+#if 0 /* old */
             gp = sparp_find_gp_by_alias (ssg->ssg_sparp, tree->_.var.selid);
             if ((NULL == gp) && (SPART_VARR_EXPORTED & tree->_.var.rvr.rvrRestrictions))
               gp = ssg->ssg_tree->_.req_top.pattern;
+#else /* new */
+#ifndef NDEBUG
+            gp = sparp_find_gp_by_alias (ssg->ssg_sparp, tree->_.var.selid);
+            if ((NULL == gp) && (SPART_VARR_EXPORTED & tree->_.var.rvr.rvrRestrictions))
+              gp = ssg->ssg_tree->_.req_top.pattern;
+            if ((NULL != gp) && (gp != eq->e_gp))
+              spar_internal_error (ssg->ssg_sparp, "ssg_ " "print_scalar_expn(): mismatch between old and new methods for gp");
+#endif
+            gp = eq->e_gp;
+#endif
             ssg_print_equiv_retval_expn (ssg, gp, eq, SSG_RETVAL_FROM_JOIN_MEMBER | SSG_RETVAL_MUST_PRINT_SOMETHING | SSG_RETVAL_CAN_PRINT_NULL | SSG_RETVAL_USES_ALIAS, needed, asname);
           }
 #endif
@@ -4222,7 +4403,19 @@ ssg_print_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t needed, co
         parser_desc = function_is_xqf_str_parser (tree->_.funcall.qname);
         if (NULL != parser_desc)
           {
-            const char *cvtname = parser_desc->p_typed_bif_name;
+	    const char *cvtname;
+            if ((NULL != parser_desc->p_sql_cast_type) && (1 == arg_count))
+              {
+                ssg_puts (" CAST (");
+                ssg->ssg_indent++;
+                ssg_print_scalar_expn (ssg, tree->_.funcall.argtrees[0], SSG_VALMODE_SQLVAL, NULL_ASNAME);
+                ssg->ssg_indent--;
+                ssg_puts (" AS ");
+                ssg_puts (parser_desc->p_sql_cast_type);
+                ssg_puts (")");
+                goto print_asname;
+              }
+            cvtname = parser_desc->p_typed_bif_name;
             if (NULL == cvtname)
               cvtname = "__xqf_str_parse";
             ssg_puts (cvtname);
@@ -4241,6 +4434,21 @@ ssg_print_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t needed, co
             ssg_putchar (')');
             goto print_asname;
           }
+        if (!strncmp (tree->_.funcall.qname, "xpath:", 6))
+          {
+            ssg_puts ("xpath_funcall ('");
+            ssg_puts (tree->_.funcall.qname + 6);
+            ssg_puts ("', null");
+            ssg->ssg_indent++;
+            for (arg_ctr = 0; arg_ctr < arg_count; arg_ctr++)
+              {
+                ssg_puts (", ");
+                ssg_print_scalar_expn (ssg, tree->_.funcall.argtrees[arg_ctr], SSG_VALMODE_SQLVAL, NULL_ASNAME);
+              }
+            ssg->ssg_indent--;
+            ssg_putchar (')');
+            goto print_asname;
+          }
         ssg_putchar (' ');
         ssg_prin_function_name (ssg, tree->_.funcall.qname);
         ssg_puts (" (");
@@ -4280,13 +4488,9 @@ ssg_print_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t needed, co
         if (DV_UNAME == tree_dtp)
           {
             if (SSG_VALMODE_DATATYPE == needed)
-              {
-                ssg_puts (" UNAME'" XMLSCHEMA_NS_URI "#anyURI'");
-              }
+              ssg_puts (" UNAME'" XMLSCHEMA_NS_URI "#anyURI'");
             else if (SSG_VALMODE_LANGUAGE == needed)
-              {
-                ssg_puts (" NULL");
-              }
+              ssg_puts_with_comment (" NULL", "lang of UNAME");
             else if ((SSG_VALMODE_LONG == needed) || (SSG_VALMODE_SHORT_OR_LONG == needed))
               {
                 ssg_puts (" __i2id (");
@@ -4295,6 +4499,10 @@ ssg_print_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t needed, co
               }
             else if (SSG_VALMODE_SQLVAL == needed)
               ssg_print_literal_as_sqlval (ssg, NULL, tree);
+            else if (SSG_VALMODE_BOOL == needed)
+              ssg_puts_with_comment (" 1", "UNAME as bool");
+            else if (SSG_VALMODE_NUM == needed)
+              ssg_puts_with_comment (" NULL", "UNAME as num");
             else if (IS_BOX_POINTER (needed))
               {
                 if (NULL != needed->qmfShortOfUriTmpl)
@@ -4332,11 +4540,11 @@ ssg_print_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t needed, co
         if (SSG_VALMODE_LANGUAGE == needed)
           {
             if (DV_ARRAY_OF_POINTER != tree_dtp)
-              ssg_puts (" NULL");
+              ssg_puts_with_comment (" NULL", "lang of plain");
             else if (NULL != tree->_.lit.language)
               ssg_print_box_as_sql_atom (ssg, tree->_.lit.language, SQL_ATOM_ASCII_ONLY);
             else
-              ssg_puts (" NULL");
+              ssg_puts_with_comment (" NULL", "lang of plain boxed");
             goto print_asname;
           }
         if (SSG_VALMODE_LONG == needed)
@@ -4349,8 +4557,71 @@ ssg_print_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t needed, co
             ssg_print_literal_as_sqlval (ssg, NULL, tree);
             goto print_asname;
           }
+        if (SSG_VALMODE_NUM == needed)
+          {
+            ssg_valmode_t native = sparp_lit_native_valmode (tree);
+            if (SSG_VALMODE_NUM == native)
+              ssg_print_literal_as_sqlval (ssg, NULL, tree);
+            else
+              ssg_puts_with_comment (" NULL", "non-NUM literal as num");
+            goto print_asname;
+          }
+        if (SSG_VALMODE_BOOL == needed)
+          {
+            caddr_t litvalue = SPAR_LIT_VAL (tree);
+            switch (DV_TYPE_OF (litvalue))
+              {
+              case DV_LONG_INT:
+                if (0 == unbox (litvalue))
+                  {
+                    ssg_puts_with_comment (" 0", "int false");
+                    goto print_asname;
+                  }
+                break;
+              case DV_NUMERIC:
+              case DV_SINGLE_FLOAT:
+              case DV_DOUBLE_FLOAT:
+                if (DVC_MATCH == cmp_boxes (litvalue, NULL, NULL, NULL))
+                  {
+                    ssg_puts_with_comment (" 0", "float false");
+                    goto print_asname;
+                  }
+                break;
+              default: break;
+              }
+            ssg_puts_with_comment (" 1", "bool");
+            goto print_asname;
+          }
         if (IS_BOX_POINTER (needed))
-          ssg_print_tmpl (ssg, needed, needed->qmfShortOfTypedsqlvalTmpl, NULL, NULL, tree, asname);
+          {
+            caddr_t litvalue, littype, litlang;
+            if (DV_ARRAY_OF_POINTER == DV_TYPE_OF (tree))
+              {
+                litvalue = tree->_.lit.val;
+                littype = tree->_.lit.datatype;
+                litlang = tree->_.lit.language;
+              }
+            else
+              {
+                litvalue = (caddr_t)tree;
+                littype = litlang = NULL;
+              }
+            if ((DV_STRING == DV_TYPE_OF (litvalue)) &&
+              ((NULL != littype) || (NULL != litlang)) )
+              ssg_print_tmpl (ssg, needed, needed->qmfShortOfTypedsqlvalTmpl, NULL, NULL, tree, asname);
+            else if ((0 != needed->qmfDtpOfNiceSqlval) &&
+              (needed->qmfDtpOfNiceSqlval == DV_TYPE_OF (litvalue)) &&
+              (NULL != needed->qmfShortOfNiceSqlvalTmpl) )
+              ssg_print_tmpl (ssg, needed, needed->qmfShortOfNiceSqlvalTmpl, NULL, NULL, (SPART *)litvalue, asname);
+            else if ((needed->qmfIsSubformatOfLong || needed->qmfIsSubformatOfLongWhenEqToSql) &&
+              (SSG_VALMODE_NUM == sparp_lit_native_valmode (tree)) )
+              {
+                ssg_print_literal_as_sqlval (ssg, NULL, tree);
+                goto print_asname;
+              }
+            else
+              ssg_print_tmpl (ssg, needed, needed->qmfShortOfSqlvalTmpl, NULL, NULL, (SPART *)litvalue, asname);
+          }
         else
           ssg_print_valmoded_scalar_expn (ssg, tree, needed, SSG_VALMODE_SQLVAL, asname);
         return;
@@ -4358,13 +4629,9 @@ ssg_print_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t needed, co
     case SPAR_QNAME:
     /*case SPAR_QNAME_NS:*/
       if (SSG_VALMODE_DATATYPE == needed)
-        {
-          ssg_puts (" UNAME'" XMLSCHEMA_NS_URI "#anyURI'");
-        }
+        ssg_puts (" UNAME'" XMLSCHEMA_NS_URI "#anyURI'");
       else if (SSG_VALMODE_LANGUAGE == needed)
-        {
-          ssg_puts (" NULL");
-        }
+        ssg_puts_with_comment (" NULL", "lang of qName");
       else if ((SSG_VALMODE_LONG == needed) || (SSG_VALMODE_SHORT_OR_LONG == needed))
         ssg_print_literal_as_long (ssg, tree);
       else if (SSG_VALMODE_SQLVAL == needed)
@@ -4378,7 +4645,9 @@ ssg_print_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t needed, co
           ssg_puts (", 1)");
         }
       else if (SSG_VALMODE_BOOL == needed)
-        ssg_puts (" 1");
+        ssg_puts_with_comment (" 1", "bool of qName");
+      else if (SSG_VALMODE_NUM == needed)
+        ssg_puts_with_comment (" NULL", "qName as num");
       else
         ssg_print_tmpl (ssg, needed, needed->qmfShortOfUriTmpl, NULL, NULL, tree, asname);
       goto print_asname;
@@ -4401,7 +4670,23 @@ ssg_print_scalar_expn (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t needed, co
         goto print_asname;
       }
     case SPAR_GP:
-      if ((SSG_VALMODE_SQLVAL != needed) && (SSG_VALMODE_LONG != needed))
+      if ((ASK_L == tree->_.gp.subquery->_.req_top.subtype) &&
+        (!IS_BOX_POINTER (needed) || needed->qmfIsSubformatOfLongWhenEqToSql) )
+        {
+          if (SSG_VALMODE_BOOL == needed)
+            {
+              ssg_puts (" EXISTS (");
+              ssg->ssg_indent++;
+            }
+          ssg_print_scalar_subquery_exp (ssg, tree->_.gp.subquery, tree, SSG_VALMODE_LONG);
+          if (SSG_VALMODE_BOOL == needed)
+            {
+              ssg_putchar (')');
+              ssg->ssg_indent--;
+            }
+          goto print_asname;
+        }
+      if ((SSG_VALMODE_SQLVAL != needed) && (SSG_VALMODE_LONG != needed) && (SSG_VALMODE_NUM != needed))
         {
           ssg_print_valmoded_scalar_expn (ssg, tree, needed, SSG_VALMODE_LONG, asname);
           return;
@@ -4454,7 +4739,15 @@ ssg_print_retval (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t vmode, const ch
       goto print_asname;
     }
   e_varname = ssg->ssg_equivs[tree->_.var.equiv_idx]->e_varnames[0];
-  if ((NULL != tree->_.retval.gp) && (SERVICE_L == tree->_.retval.gp->_.gp.subtype))
+  if (NULL != tree->_.retval.gp)
+    {
+      if (SPAR_BINDINGS_INV == tree->_.retval.gp->type)
+        {
+          char buf[20]; sprintf (buf, ":binv_%ld", (long)(tree->_.retval.equiv_idx));
+          ssg_puts (buf);
+          goto print_asname; /* see below */
+        }
+      if (SERVICE_L == tree->_.retval.gp->_.gp.subtype)
     {
       int pos = -1;
       char buf[50];
@@ -4480,6 +4773,7 @@ ssg_print_retval (spar_sqlgen_t *ssg, SPART *tree, ssg_valmode_t vmode, const ch
 #endif
       goto print_asname; /* see below */
     }
+    }
   if (IS_BOX_POINTER (vmode) && (1 < vmode->qmfColumnCount) && (IS_BOX_POINTER (asname) || (NULL == asname)))
     {
       int colctr;
@@ -4764,15 +5058,7 @@ ssg_print_fld_lit_restrictions (spar_sqlgen_t *ssg, quad_map_t *qmap, qm_value_t
           else
             ssg_print_tr_field_expn (ssg, field, tabid, qmf, eq_asname);
           ssg_puts (" =");
-          if ((DV_STRING == DV_TYPE_OF (litvalue)) &&
-            ((NULL != littype) || (NULL != litlang)) )
-            ssg_print_tmpl (ssg, field->qmvFormat, qmf->qmfShortOfTypedsqlvalTmpl, tabid, field, fld_tree, eq_asname);
-          else if ((0 != qmf->qmfDtpOfNiceSqlval) &&
-	    (qmf->qmfDtpOfNiceSqlval == DV_TYPE_OF (litvalue)) &&
-	    (NULL != qmf->qmfShortOfNiceSqlvalTmpl) )
-            ssg_print_tmpl (ssg, field->qmvFormat, qmf->qmfShortOfNiceSqlvalTmpl, tabid, field, (SPART *)litvalue, eq_asname);
-	  else
-            ssg_print_tmpl (ssg, field->qmvFormat, qmf->qmfShortOfSqlvalTmpl, tabid, field, (SPART *)litvalue, eq_asname);
+          ssg_print_scalar_expn (ssg, fld_tree, field->qmvFormat, eq_asname);
         }
       if (0 != col_count)
         return;
@@ -5047,6 +5333,11 @@ ssg_print_equiv_retval_expn (spar_sqlgen_t *ssg, SPART *gp, sparp_equiv_t *eq, i
     asname = NULL;
   if (NULL == eq)
     goto try_write_null; /* see below */
+  if (SPART_VARNAME_IS_SPECIAL(eq->e_varnames[0]))
+    {
+      ssg_puts (eq->e_varnames[0]+1);
+      goto write_assuffix;
+    }
   if (SPART_VARR_CONFLICT & eq->e_rvr.rvrRestrictions)
     {
 #ifdef NDEBUG
@@ -5115,11 +5406,17 @@ ssg_print_equiv_retval_expn (spar_sqlgen_t *ssg, SPART *gp, sparp_equiv_t *eq, i
       ssg_find_external_in_equiv (eq, &vartree, &varname);
       if (NULL != vartree)
         {
-          SPART *orig = sparp_find_origin_of_external_var (ssg->ssg_sparp, vartree);
+          SPART *orig = sparp_find_origin_of_external_var (ssg->ssg_sparp, vartree, 0);
           ssg_print_scalar_expn (ssg, orig, needed, asname);
           return 1;
         }
     }
+  if (SPAR_BINDINGS_INV == gp->type)
+    {
+      char buf[20]; sprintf (buf, " :binv_%ld", (long)(eq->e_own_idx));
+      ssg_puts (buf);
+      return 1;
+    }
   if (flags & SSG_RETVAL_FROM_JOIN_MEMBER)
     {
       for (var_ctr = 0; var_ctr < var_count; var_ctr++)
@@ -5207,8 +5504,13 @@ ssg_print_equiv_retval_expn (spar_sqlgen_t *ssg, SPART *gp, sparp_equiv_t *eq, i
         rv->_.retval.vname = eq->e_varnames[0];
         if (NULL == native)
           native = sparp_equiv_native_valmode (ssg->ssg_sparp, gp, eq);
-        if ((native == needed) || (SSG_VALMODE_AUTO == needed))
+        if (SSG_VALMODE_AUTO == native)
+          {
+            if (native == needed)
           name_as_expn = rv->_.retval.vname;
+            else if (rv->_.retval.rvr.rvrRestrictions & SPART_VARR_ALWAYS_NULL)
+              native = SSG_VALMODE_NUM;
+          }
         if (flags & SSG_RETVAL_OPTIONAL_MAKES_NULLABLE)
           rv->_.retval.optional_makes_nullable = 1;
         ssg_print_valmoded_scalar_expn (ssg, rv, needed, native, asname);
@@ -5379,6 +5681,8 @@ ssg_print_equivalences (spar_sqlgen_t *ssg, SPART *gp, sparp_equiv_t *eq, dk_set
               sparp_equiv_t *sub_eq = SPARP_EQUIV (ssg->ssg_sparp, sub_idx);
               if (OPTIONAL_L == sub_eq->e_gp->_.gp.subtype)
                 continue;
+              if (!(SPART_VARR_NOT_NULL & sub_eq->e_rvr.rvrRestrictions) && (0 == sub_eq->e_gspo_uses))
+                continue;
               restrs_not_filtered_in_subqs &= (~(sub_eq->e_rvr.rvrRestrictions) |
                 ~(SPART_VARR_IS_BLANK | SPART_VARR_IS_IRI | SPART_VARR_IS_LIT | SPART_VARR_IS_REF | SPART_VARR_NOT_NULL ) );
               if ((SPART_VARR_FIXED & restrs_not_filtered_in_subqs) &&
@@ -5468,13 +5772,14 @@ ssg_print_equivalences (spar_sqlgen_t *ssg, SPART *gp, sparp_equiv_t *eq, dk_set
     {
       SPART *var = eq->e_vars[var_ctr];
       caddr_t tabid = var->_.var.tabid;
-      if ((SPART_VARR_FIXED & eq->e_rvr.rvrRestrictions) && (NULL != tabid))
+      int mixed_restrictions = (eq->e_rvr.rvrRestrictions | var->_.var.rvr.rvrRestrictions);
+      if ((SPART_VARR_FIXED & mixed_restrictions) && (NULL != tabid))
         {
           SPART *var_triple = sparp_find_triple_of_var_or_retval (ssg->ssg_sparp, NULL, var, 1);
           ssg_print_nice_equality_for_var_and_eq_fixed_val (ssg, &(eq->e_rvr), var, var_triple);
           continue;
         }
-      if ((NULL != tabid) && ((SPART_VARR_GLOBAL | SPART_VARR_EXTERNAL) & eq->e_rvr.rvrRestrictions))
+      if (((SPART_VARR_GLOBAL | SPART_VARR_EXTERNAL) & mixed_restrictions) && (NULL != tabid))
         {
           SPART *glob_var;
           caddr_t glob_name;
@@ -5488,13 +5793,13 @@ ssg_print_equivalences (spar_sqlgen_t *ssg, SPART *gp, sparp_equiv_t *eq, dk_set
           var_rv->_.retval.vname = "";
           vmode = sparp_expn_native_valmode (ssg->ssg_sparp, var_rv);
           SPART_AUTO (glob_rv, glob_rv_buf, SPAR_RETVAL);
-          if (SPART_VARR_GLOBAL & eq->e_rvr.rvrRestrictions)
+          if (SPART_VARR_GLOBAL & mixed_restrictions)
             ssg_find_global_in_equiv (eq, &glob_var, &glob_name);
           else
             {
               SPART *local_glob_var;
               ssg_find_external_in_equiv (eq, &local_glob_var, &glob_name);
-              glob_var = sparp_find_origin_of_external_var (ssg->ssg_sparp, local_glob_var);
+              glob_var = sparp_find_origin_of_external_var (ssg->ssg_sparp, local_glob_var, 0);
             }
           if (NULL != glob_var)
             {
@@ -5544,7 +5849,7 @@ ssg_print_equivalences (spar_sqlgen_t *ssg, SPART *gp, sparp_equiv_t *eq, dk_set
               ssg_print_scalar_expn (ssg, glob_rv, SSG_VALMODE_SQLVAL, NULL_ASNAME);
             }
         }
-      if ((SPART_VARR_TYPED & eq->e_rvr.rvrRestrictions) &&
+      else if ((SPART_VARR_TYPED & eq->e_rvr.rvrRestrictions) &&
         ((NULL != tabid) ||
          ((SPART_VARR_TYPED & eq->e_replaces_filter) && (0 == eq->e_gspo_uses) && (0 == var_ctr)) ) )
         {
@@ -5850,48 +6155,49 @@ void ssg_print_retval_bop_calc_expn (spar_sqlgen_t *ssg, SPART *gp, SPART *tree,
 {
   SPART *left = tree->_.bin_exp.left;
   SPART *right = tree->_.bin_exp.right;
-  if (needed == SSG_VALMODE_LONG)
-#if 1
+  ssg_valmode_t op_arg_valmode;
+  if ((needed == SSG_VALMODE_LONG) || (needed == SSG_VALMODE_NUM))
     needed = SSG_VALMODE_SQLVAL; /* Trick! This uses the fact that integers 0 and 1 are stored identically in SQLVAL and LONG valmodes */
-#else
-    {
-      ssg_puts (" DB.DBA.RDF_LONG_OF_SQLVAL (");
-      ssg_print_retval_bop_calc_expn (ssg, gp, tree, s1, s2, s3, cmp_op, SSG_VALMODE_SQLVAL);
-      ssg_puts (")");
-      return;
-    }
-#endif
   else if (needed != SSG_VALMODE_SQLVAL)
     spar_sqlprint_error ("ssg_print_retval_bop_calc_expn(): unsupported valmode");
   if (cmp_op)
     {
       ssg_valmode_t left_native = sparp_expn_native_valmode (ssg->ssg_sparp, left);
       ssg_valmode_t right_native = sparp_expn_native_valmode (ssg->ssg_sparp, right);
-      ssg_valmode_t smallest_union;
       const char *cmp_func_name = NULL;
-      smallest_union = ssg_smallest_union_valmode (left_native, right_native);
-      if (SSG_VALMODE_LONG == smallest_union)
+      if ((left_native == SSG_VALMODE_NUM) || (right_native == SSG_VALMODE_NUM))
+        op_arg_valmode = SSG_VALMODE_NUM;
+      else
+        op_arg_valmode = ssg_largest_eq_valmode (left_native, right_native);
+      if (SSG_VALMODE_LONG == op_arg_valmode)
         cmp_func_name = "DB.DBA.RDF_LONG_CMP";
-      else if (IS_BOX_POINTER (smallest_union))
-        cmp_func_name = smallest_union->qmfCmpFuncName;
+      else if (IS_BOX_POINTER (op_arg_valmode))
+        cmp_func_name = op_arg_valmode->qmfCmpFuncName;
       else
-        goto sqlval_operation;
+        goto non_cmp_func_operation;
       ssg_puts (s1);
       ssg_puts (cmp_func_name);
       ssg_puts ("(");
-      ssg_print_retval_simple_expn (ssg, gp, left, smallest_union, NULL_ASNAME);
+      ssg_print_retval_simple_expn (ssg, gp, left, op_arg_valmode, NULL_ASNAME);
       ssg_puts (" ,");
-      ssg_print_retval_simple_expn (ssg, gp, right, smallest_union, NULL_ASNAME);
+      ssg_print_retval_simple_expn (ssg, gp, right, op_arg_valmode, NULL_ASNAME);
       ssg_puts ("), 0)");
       return;
     }
-sqlval_operation:
+  else
+    switch (tree->type)
+      {
+      case BOP_AND: case BOP_OR: op_arg_valmode = SSG_VALMODE_BOOL; break;
+      case BOP_PLUS: case BOP_MINUS: case BOP_TIMES: case BOP_DIV: case BOP_MOD: op_arg_valmode = SSG_VALMODE_NUM; break;
+      default: op_arg_valmode = SSG_VALMODE_SQLVAL; break;
+      }
+non_cmp_func_operation:
   ssg_puts (s1);
-  ssg_print_retval_simple_expn (ssg, gp, left, SSG_VALMODE_SQLVAL, NULL_ASNAME);
+  ssg_print_retval_simple_expn (ssg, gp, left, op_arg_valmode, NULL_ASNAME);
   ssg_puts (s2);
   if (NULL == s3)
     return;
-  ssg_print_retval_simple_expn (ssg, gp, right, SSG_VALMODE_SQLVAL, NULL_ASNAME);
+  ssg_print_retval_simple_expn (ssg, gp, right, op_arg_valmode, NULL_ASNAME);
   ssg_puts (s3);
 }
 
@@ -5984,9 +6290,12 @@ ssg_print_retval_simple_expn (spar_sqlgen_t *ssg, SPART *gp, SPART *tree, ssg_va
         int bigtext, arg_ctr, arg_count = BOX_ELEMENTS (tree->_.funcall.argtrees);
         xqf_str_parser_desc_t *parser_desc;
 	ssg_valmode_t native = sparp_rettype_of_function (ssg->ssg_sparp, tree->_.funcall.qname);
-        if ((SSG_VALMODE_SHORT_OR_LONG == needed) && (SSG_VALMODE_LONG == native))
-          needed = SSG_VALMODE_LONG;
-        if (needed != native)
+        if (((SSG_VALMODE_SHORT_OR_LONG == needed) && (SSG_VALMODE_LONG == native)) ||
+          ((SSG_VALMODE_NUM == needed) && (SSG_VALMODE_SQLVAL == native)) ||
+          ((SSG_VALMODE_SQLVAL == needed) && (SSG_VALMODE_NUM == native)) ||
+          ((SSG_VALMODE_LONG == needed) && (SSG_VALMODE_NUM == native)) )
+          needed = native;
+        else if (needed != native)
           {
             if (((SSG_VALMODE_LONG == needed) || (SSG_VALMODE_SHORT_OR_LONG == needed)) && (SSG_VALMODE_SQLVAL == native))
               {
@@ -6012,7 +6321,19 @@ ssg_print_retval_simple_expn (spar_sqlgen_t *ssg, SPART *gp, SPART *tree, ssg_va
         parser_desc = function_is_xqf_str_parser (tree->_.funcall.qname);
         if (NULL != parser_desc)
           {
-            const char *cvtname = parser_desc->p_typed_bif_name;
+	    const char *cvtname;
+            if ((NULL != parser_desc->p_sql_cast_type) && (1 == arg_count))
+              {
+                ssg_puts (" CAST (");
+                ssg->ssg_indent++;
+                ssg_print_retval_simple_expn (ssg, gp, tree->_.funcall.argtrees[0], SSG_VALMODE_SQLVAL, NULL_ASNAME);
+                ssg->ssg_indent--;
+                ssg_puts (" AS ");
+                ssg_puts (parser_desc->p_sql_cast_type);
+                ssg_puts (")");
+                goto print_asname;
+              }
+            cvtname = parser_desc->p_typed_bif_name;
             if (NULL == cvtname)
               cvtname = "__xqf_str_parse";
             ssg_puts (cvtname);
@@ -6031,6 +6352,21 @@ ssg_print_retval_simple_expn (spar_sqlgen_t *ssg, SPART *gp, SPART *tree, ssg_va
             ssg_putchar (')');
             goto print_asname;
           }
+         if (!strncmp (tree->_.funcall.qname, "xpath:", 6))
+          {
+            ssg_puts ("xpath_funcall ('");
+            ssg_puts (tree->_.funcall.qname + 6);
+            ssg_puts ("', null");
+            ssg->ssg_indent++;
+            for (arg_ctr = 0; arg_ctr < arg_count; arg_ctr++)
+              {
+                ssg_puts (", ");
+                ssg_print_retval_simple_expn (ssg, gp, tree->_.funcall.argtrees[arg_ctr], SSG_VALMODE_SQLVAL, NULL_ASNAME);
+              }
+            ssg->ssg_indent--;
+            ssg_putchar (')');
+            goto print_asname;
+          }
         if (!strcmp (tree->_.funcall.qname, "sql:SPARUL_RUN"))
           {
             ssg_print_sparul_run_call (ssg, gp, tree, 1);
@@ -6747,7 +7083,7 @@ static const char *same_as__names [SAME_AS__VARIANT_COUNT] = {"IFP", "SAME_AS",
           if (NULL != val)
             t_set_push (&tblopts, val);
         }
-      if (NULL != active_inference)
+      if (NULL != active_inference && active_inference != (caddr_t)((ptrlong)1))
         t_set_push (&tblopts, t_box_sprintf (200, "WITH '%.100s'", active_inference));
       if (NULL != tblopts)
         has_table_options = 1;
@@ -6855,9 +7191,62 @@ ssg_prepare_sinv_template (spar_sqlgen_t *parent_ssg, SPART *sinv, SPART *gp, ca
   define_count = BOX_ELEMENTS_0 (sinv->_.sinv.defines);
   for (define_ctr = 0; define_ctr < define_count; define_ctr += 2)
     {
+      caddr_t name = (caddr_t)(sinv->_.sinv.defines[define_ctr]);
+      SPART ***vals = (SPART ***)(sinv->_.sinv.defines[define_ctr+1]);
+      int valctr;
+      if (!strcmp (name, "lang:dialect"))
+        continue;
       ssg_puts (" DEFINE ");
-      ssg_puts ((caddr_t)(sinv->_.sinv.defines[define_ctr]));
-      ssg_sdprint_tree (parent_ssg, sinv->_.sinv.defines[define_ctr+1]);
+      ssg_puts (name);
+      DO_BOX_FAST (SPART **, val, valctr, vals)
+        {
+          if (valctr) ssg_putchar (',');
+          ssg_sdprint_tree (ssg, val[1]);
+        }
+      END_DO_BOX_FAST;
+    }
+/* There exists a special case of SERVICE that consists of solely one SELECT that is used as a wrapper for aggregates, limits etc. */
+  if ((0 == BOX_ELEMENTS (gp->_.gp.filters))
+    && (1 == BOX_ELEMENTS (gp->_.gp.members))
+    && (SPAR_GP == gp->_.gp.members[0]->type)
+    && (SELECT_L == gp->_.gp.members[0]->_.gp.subtype) )
+    {
+      SPART *single_subq = gp->_.gp.members[0]->_.gp.subquery;
+      caddr_t *rset_varnames = sinv->_.sinv.rset_varnames;
+      SPART **rvals = single_subq->_.req_top.retvals;
+      int rset_len = BOX_ELEMENTS (rset_varnames);
+      int rvals_len = BOX_ELEMENTS (rvals);
+      int vname_ctr, expn_ctr;
+      if (rset_len != rvals_len)
+        goto failed_single_subq_optimization; /* see below */
+      for (vname_ctr = rset_len; vname_ctr--; /* no step */)
+        {
+          caddr_t rset_varname = rset_varnames[vname_ctr];
+#ifndef NDEBUG
+          int vname_ctr2;
+          for (vname_ctr2 = vname_ctr; vname_ctr2--; /* no step */)
+            if (!strcmp (rset_varname, rset_varnames[vname_ctr2]))
+              GPF_T;
+#endif
+          for (expn_ctr = rvals_len; expn_ctr--; /* no step */)
+            {
+              SPART *val = rvals [expn_ctr];
+              caddr_t rval_name;
+              switch (SPART_TYPE (val))
+                {
+                case SPAR_ALIAS: rval_name = val->_.alias.aname; break;
+                case SPAR_VARIABLE: case SPAR_BLANK_NODE_LABEL: rval_name = val->_.var.vname; break;
+                default: goto failed_single_subq_optimization; /* see below */
+                }
+              if (!strcmp (rval_name, rset_varname))
+                break;
+            }
+          if (0 > expn_ctr)
+            goto failed_single_subq_optimization; /* see below */
+        }
+      ssg_sdprint_tree (ssg, single_subq);
+      goto query_text_is_composed; /* see below */
+failed_single_subq_optimization: ;
     }
   ssg_puts (" SELECT");
   DO_BOX_FAST (caddr_t, retname, retctr, sinv->_.sinv.rset_varnames)
@@ -6870,7 +7259,8 @@ ssg_prepare_sinv_template (spar_sqlgen_t *parent_ssg, SPART *sinv, SPART *gp, ca
   gp->_.gp.subtype = WHERE_L;
   ssg_sdprint_tree (ssg, gp);
   gp->_.gp.subtype = SERVICE_L;
-  /* Query text composing ends here */
+
+query_text_is_composed:
   qtext_template_ret[0] = t_strses_string (ssg->ssg_out);
   posmap_itm_ctr = dk_set_length (ssg->ssg_param_pos_set);
   qtext_posmap = (wchar_t *)t_alloc_box (sizeof (wchar_t) * (posmap_itm_ctr + 1), DV_WIDE);
@@ -6918,9 +7308,9 @@ ssg_print_sinv_table_exp (spar_sqlgen_t *ssg, SPART *gp, int pass)
   if (SSG_TABLE_SELECT_PASS == pass)
     {
 #if 0
-      ssg_puts (" DB.DBA.SPARQL_SINV_IMP (ws_endpoint, ws_params, qtext_template, qtext_posmap, param_row)(rset any) ");
+      ssg_puts (" DB.DBA.SPARQL_SINV_IMP (ws_endpoint, ws_params, qtext_template, qtext_posmap, param_row, expected_var_list)(rset any) ");
 #else
-      ssg_puts (" DB.DBA.SPARQL_SINV ");
+      ssg_puts (" DB.DBA.SPARQL_SINV_2 ");
 #endif
       ssg_prin_id (ssg, gp->_.gp.selid);
       return;
@@ -6945,6 +7335,17 @@ ssg_print_sinv_table_exp (spar_sqlgen_t *ssg, SPART *gp, int pass)
           ssg_print_scalar_expn (ssg, sinv->_.sinv.iri_params[ctr+1], SSG_VALMODE_LONG, NULL_ASNAME);
         }
       ssg_putchar (')');
+      ssg_print_where_or_and (ssg, "sinv");
+      ssg_prin_id (ssg, gp->_.gp.selid); ssg_puts (".expected_vars = vector (");
+      DO_BOX_FAST (caddr_t, varname, ctr, sinv->_.sinv.rset_varnames)
+        {
+          if (ctr)
+            ssg_putchar (',');
+          ssg_print_box_as_sql_atom (ssg, varname, SQL_ATOM_ASCII_ONLY);
+        }
+      END_DO_BOX_FAST;
+      ssg_putchar (')');
+      sinv->_.sinv.syntax = t_box_num (unbox (sinv->_.sinv.syntax) & ~SSG_SD_GLOBALS);
       ssg_prepare_sinv_template (ssg, sinv, gp, &qtext_template, &qtext_posmap);
       ssg_print_where_or_and (ssg, "sinv");
       ssg_prin_id (ssg, gp->_.gp.selid); ssg_puts (".qtext_template = ");
@@ -6961,7 +7362,22 @@ ssg_print_sinv_table_exp (spar_sqlgen_t *ssg, SPART *gp, int pass)
           int varctr, membctr;
           if (ctr)
             ssg_putchar (',');
-          local_eq = sparp_equiv_get (sparp, gp, (SPART *)varname, SPARP_EQUIV_GET_NAMESAKES | SPARP_EQUIV_GET_ASSERT);
+          local_eq = sparp_equiv_get (sparp, gp, (SPART *)varname, SPARP_EQUIV_GET_NAMESAKES);
+          if (NULL == local_eq)
+            {
+              SPART *new_var;
+              if (!SPART_VARNAME_IS_GLOB(varname))
+                goto param_value_cant_be_printed; /* see below */
+              /* dirty hack here */
+              new_var = spartlist (sparp, 6 + (sizeof (rdf_val_range_t) / sizeof (caddr_t)),
+                SPAR_VARIABLE, varname,
+                gp->_.gp.selid, NULL,
+                (ptrlong)(0), SPART_BAD_EQUIV_IDX, SPART_RVR_LIST_OF_NULLS );
+              new_var->_.var.rvr.rvrRestrictions |= SPART_VARR_GLOBAL;
+              local_eq = sparp_equiv_get (sparp, gp, new_var, SPARP_EQUIV_INS_CLASS | SPARP_EQUIV_INS_VARIABLE); /* Better late than never */
+              ssg_print_scalar_expn (ssg, local_eq->e_vars[0], SSG_VALMODE_LONG, NULL_ASNAME); /*!!!TBD better print for typed/lang literals */
+              goto param_value_is_printed; /* see below */
+            }
           if (((SPART_VARR_FIXED | SPART_VARR_ALWAYS_NULL | SPART_VARR_CONFLICT) & local_eq->e_rvr.rvrRestrictions))
             {
               ssg_print_scalar_expn (ssg, (SPART *)(local_eq->e_rvr.rvrFixedValue), SSG_VALMODE_LONG, NULL_ASNAME); /*!!!TBD better print for typed/lang literals */
@@ -7004,13 +7420,14 @@ ssg_print_sinv_table_exp (spar_sqlgen_t *ssg, SPART *gp, int pass)
             }
           /* No appropriate triple pattern found to the left from sinv gp, let's try to find a subgroup */
           sparp_equiv_sort_subvalue_idxs_by_child_order (sparp, parent_eq);
-          first_sibling_eq = SPARP_EQUIV (sparp, local_eq->e_subvalue_idxs[0]);
+          first_sibling_eq = SPARP_EQUIV (sparp, parent_eq->e_subvalue_idxs[0]);
           if (first_sibling_eq->e_gp != gp)
             {
               ssg_print_equiv_retval_expn (ssg, first_sibling_eq->e_gp, first_sibling_eq, SSG_RETVAL_FROM_GOOD_SELECTED | SSG_RETVAL_MUST_PRINT_SOMETHING, SSG_VALMODE_LONG, NULL_ASNAME);
               goto param_value_is_printed; /* see below */
             }
-          spar_error (sparp, "Unable to compose an SQL code to pass parameter ?%.200s to the service <%.200s> (not use if it can be calculated before use)",
+param_value_cant_be_printed: ;
+          spar_error (sparp, "Unable to compose an SQL code to pass parameter ?%.200s to the service <%.200s>",
             varname, sinv->_.sinv.endpoint );
 param_value_is_printed: ;
         }
@@ -7043,7 +7460,7 @@ ssg_print_scalar_subquery_exp (spar_sqlgen_t *ssg, SPART *sub_req_top, SPART *wr
   subq_ssg->ssg_indent = ssg->ssg_indent;
   if ((SSG_VALMODE_LONG == needed) || (SSG_VALMODE_AUTO == needed))
     sub_sparp->sparp_env->spare_output_valmode_name = t_box_dv_short_string ("LONG");
-  else if (SSG_VALMODE_SQLVAL == needed)
+  else if ((SSG_VALMODE_SQLVAL == needed) || (SSG_VALMODE_NUM == needed))
     sub_sparp->sparp_env->spare_output_valmode_name = NULL;
   else
     spar_internal_error (ssg->ssg_sparp, "ssg_" "print_scalar_subquery_exp: unsupported valmode");
@@ -7395,11 +7812,12 @@ ssg_print_union_member_item (spar_sqlgen_t *ssg, SPART *member, int *itm_idx_ptr
             {
               sparp_equiv_t *memb_eq = NULL;
               SPART *left_tree = NULL;
+              SPART *left_gp_or_triple = NULL;
               if (!itm_eq->e_replaces_filter)
                 continue;
               if (SPARP_EQ_IS_ASSIGNED_LOCALLY (itm_eq))
                 continue;
-              sparp_find_best_join_eq_for_optional (ssg->ssg_sparp, member, itm_idx_ptr[0], itm_eq, &memb_eq, &left_tree);
+              sparp_find_best_join_eq_for_optional (ssg->ssg_sparp, member, itm_idx_ptr[0], itm_eq, &memb_eq, &left_tree, &left_gp_or_triple);
               if (NULL == left_tree)
                 {
                   if (itm_eq->e_replaces_filter & (SPART_VARR_FIXED | SPART_VARR_IS_BLANK | SPART_VARR_IS_IRI |  SPART_VARR_IS_LIT | SPART_VARR_IS_REF | SPART_VARR_NOT_NULL))
@@ -7415,9 +7833,13 @@ ssg_print_union_member_item (spar_sqlgen_t *ssg, SPART *member, int *itm_idx_ptr
                   tmp_rvr.rvrRestrictions = itm_eq->e_replaces_filter;
                   if (SPAR_IS_BLANK_OR_VAR (left_tree))
                     {
-                      SPART *left_triple = member->_.gp.members[itm_idx_ptr[0]-1];
+                      SPART *left_triple = left_gp_or_triple;
                       quad_map_t *left_qm = left_triple->_.triple.tc_list[0]->tc_qm;
                       qm_value_t *left_qmv = NULL;
+#if 0
+                      if (left_gp_or_triple != member->_.gp.members[itm_idx_ptr[0]-1])
+                        spar_internal_error (ssg->ssg_sparp, "Unusual left outer join");
+#endif
                       if (SPART_TRIPLE_FIELDS_COUNT > left_tree->_.var.tr_idx)
                         left_qmv = SPARP_FIELD_QMV_OF_QM (left_qm, left_tree->_.var.tr_idx);
                       ssg_print_fld_var_restrictions_ex (ssg, left_qm, left_qmv, left_triple->_.triple.tabid, left_tree, left_triple, NULL /*fld_if_outer*/, &tmp_rvr);
@@ -7472,7 +7894,7 @@ ssg_print_union (spar_sqlgen_t *ssg, SPART *gp, SPART **retlist, int head_flags,
     {
       int col_count = BOX_ELEMENTS (retlist);
       int col_ctr;
-      retlist_restr_bits = t_alloc_box (col_count * sizeof (caddr_t), DV_ARRAY_OF_LONG);
+      retlist_restr_bits = (ptrlong *)t_alloc_box (col_count * sizeof (caddr_t), DV_ARRAY_OF_LONG);
       for (col_ctr = col_count; col_ctr--; /* no step */)
         retlist_restr_bits [col_ctr] = sparp_restr_bits_of_expn (ssg->ssg_sparp, retlist[col_ctr]);
     }
@@ -7772,7 +8194,7 @@ ssg_req_top_needs_rb_complete (spar_sqlgen_t *ssg)
   ssg_valmode_t retvalmode;
   if ((SELECT_L != subtype) && (DISTINCT_L != subtype))
     return 0;
-  if (NULL != tree->_.req_top.formatmode_name)
+  if (NULL != tree->_.req_top.formatmode_name && strcmp (tree->_.req_top.formatmode_name, "_JAVA_"))
     return 0;
   retvalmode = ssg_find_valmode_by_name (tree->_.req_top.retvalmode_name);
   if ((SSG_VALMODE_SQLVAL != retvalmode) && (NULL != retvalmode))
@@ -7811,10 +8233,14 @@ void ssg_print_limofs_expn (spar_sqlgen_t *ssg)
   if ((DV_LONG_INT == DV_TYPE_OF (lim)) && (DV_LONG_INT == DV_TYPE_OF (ofs)))
     {
       char limofs_strg [50];
-      if (0 != unbox ((caddr_t)(ofs)))
-        snprintf (limofs_strg, sizeof (limofs_strg), " TOP %ld, %ld", (long)unbox ((caddr_t)(ofs)), (long)unbox ((caddr_t)(lim)));
+      long lim_num = unbox ((caddr_t)(lim));
+      long ofs_num = unbox ((caddr_t)(ofs));
+      if ((SPARP_MAXLIMIT == lim_num) && (0 < ofs_num))
+        lim_num -= ofs_num;
+      if (0 != ofs_num)
+        snprintf (limofs_strg, sizeof (limofs_strg), " TOP %ld, %ld", ofs_num, lim_num);
       else
-        snprintf (limofs_strg, sizeof (limofs_strg), " TOP %ld", (long)unbox ((caddr_t)(lim)));
+        snprintf (limofs_strg, sizeof (limofs_strg), " TOP %ld", lim_num);
       ssg_puts (limofs_strg);
       return;
     }
@@ -7864,6 +8290,8 @@ ssg_make_sql_query_text (spar_sqlgen_t *ssg)
     {
       if ('\0' != ssg->ssg_sparp->sparp_env->spare_storage_name[0])
         ssg_qr_uses_jso (ssg, NULL, ssg->ssg_sparp->sparp_env->spare_storage_name);
+      else
+        ssg_qr_uses_jso (ssg, NULL, uname_virtrdf_ns_uri_DefaultQuadMap); /* this is to reflect security changes even if the used built-in JSO has no associated IRI */
     }
   else
     ssg_qr_uses_jso (ssg, NULL, uname_virtrdf_ns_uri_DefaultQuadStorage);
@@ -8051,6 +8479,14 @@ ssg_make_sql_query_text (spar_sqlgen_t *ssg)
       break;
     default: spar_sqlprint_error ("ssg_make_sql_query_text(): unsupported type of tree");
     }
+#if 0 /*!!! TBD */
+  if (NULL != ssg->ssg_sparp->sparp_env->spare_bindings_vars)
+    {
+      dk_session_t *curr_ssg_out = ssg->ssg_out;
+      ssg->ssg_out = strses_allocate ();
+      ssg_puts ("SELECT "
+    }
+#endif
   ssg_print_union (ssg, tree->_.req_top.pattern, retvals,
     SSG_PRINT_UNION_NOFIRSTHEAD | SSG_PRINT_UNION_NONEMPTY_STUB | SSG_RETVAL_MUST_PRINT_SOMETHING,
     top_retval_flags, retvalmode );
@@ -8086,7 +8522,7 @@ ssg_make_sql_query_text (spar_sqlgen_t *ssg)
 #endif
       ssg->ssg_indent--;
     }
-  if ((0 < BOX_ELEMENTS_INT_0 (tree->_.req_top.order)) && (NULL == formatter))
+  if ((0 < BOX_ELEMENTS_INT_0 (tree->_.req_top.order)) && ((SELECT_L == tree->_.req_top.subtype) || (DISTINCT_L == tree->_.req_top.subtype) || has_limofs))
     {
       ssg_newline (0);
       ssg_puts ("ORDER BY");
diff --git a/libsrc/Wi/sparql_core.c b/libsrc/Wi/sparql_core.c
index 55d4b1b..aea6776 100644
--- a/libsrc/Wi/sparql_core.c
+++ b/libsrc/Wi/sparql_core.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: sparql_core.c,v 1.87.2.38 2010/06/12 12:59:59 source Exp $
+ *  $Id: sparql_core.c,v 1.87.2.50 2011/02/18 11:19:40 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -46,12 +46,19 @@ extern "C" {
 #include "sqlo.h" /* to load rdfinf.h :) */
 #include "rdfinf.h"
 #include "rdf_mapping_jso.h"
+#include "xpf.h"
 
 #ifdef MALLOC_DEBUG
 const char *spartlist_impl_file="???";
 int spartlist_impl_line;
 #endif
 
+#ifdef DEBUG
+#define SPAR_ERROR_DEBUG
+#endif
+
+/*#define SPAR_ERROR_DEBUG*/
+
 extern void jsonyyerror_impl(const char *s);
 
 size_t
@@ -61,7 +68,7 @@ spart_count_specific_elems_by_type (ptrlong type)
   switch (type)
     {
     case SPAR_ALIAS:		return sizeof (sample._.alias);
-    case SPAR_BLANK_NODE_LABEL:	return sizeof (sample._.var);
+    case SPAR_BLANK_NODE_LABEL:	return sizeof (sample._.bnode);
     case SPAR_BUILT_IN_CALL:	return sizeof (sample._.builtin);
     case SPAR_CONV:		return sizeof (sample._.conv);
     case SPAR_FUNCALL:		return sizeof (sample._.funcall);
@@ -301,11 +308,17 @@ spar_error (sparp_t *sparp, const char *format, ...)
 int
 spar_audit_error (sparp_t *sparp, const char *format, ...)
 {
+#ifdef SPAR_ERROR_DEBUG
+  const char *txt;
+#endif
   va_list ap;
   caddr_t msg;
   va_start (ap, format);
   msg = t_box_vsprintf (1500, format, ap);
-  fprintf (stderr, "%s\n", msg);
+#ifdef SPAR_ERROR_DEBUG
+  txt = ((NULL != sparp) ? sparp->sparp_text : "(no text, sparp is NULL)");
+  printf ("Internal SPARQL audit error %s while processing\n-----8<-----\n%s\n-----8<-----\n", msg, txt);
+#endif
 #ifdef DEBUG
   if (sparp->sparp_internal_error_runs_audit)
     return 1;
@@ -320,18 +333,10 @@ spar_audit_error (sparp_t *sparp, const char *format, ...)
 void
 spar_internal_error (sparp_t *sparp, const char *msg)
 {
-#if 0
-  const char *txt = ((NULL != sparp) ? sparp->sparp_text : "(no text, sparp is NULL)");
-  FILE *core_reason1;
-  fprintf (stderr, "Internal error %s while processing\n-----8<-----\n%s\n-----8<-----\n", msg, txt);
-  core_reason1 = fopen ("core_reason1","wt");
-  fprintf (core_reason1, "Internal error %s while processing\n-----8<-----\n%s\n-----8<-----\n", msg, txt);
-  fclose (core_reason1);
-  GPF_T1(msg);
-#else
-#ifdef DEBUG
-  const char *txt = ((NULL != sparp) ? sparp->sparp_text : "(no text, sparp is NULL)");
-  printf ("Internal error %s while processing\n-----8<-----\n%s\n-----8<-----\n", msg, txt);
+#ifdef SPAR_ERROR_DEBUG
+  const char *txt;
+  txt = ((NULL != sparp) ? sparp->sparp_text : "(no text, sparp is NULL)");
+  printf ("Internal SPARQL error %s while processing\n-----8<-----\n%s\n-----8<-----\n", msg, txt);
   if ((NULL != sparp) && !sparp->sparp_internal_error_runs_audit)
     {
       sparp->sparp_internal_error_runs_audit = 1;
@@ -343,7 +348,6 @@ spar_internal_error (sparp_t *sparp, const char *msg)
   sqlr_new_error ("37000", "SP031",
     "%.400s: Internal error: %.1500s",
     ((NULL != sparp && sparp->sparp_err_hdr) ? sparp->sparp_err_hdr : "SPARQL"), msg);
-#endif
 }
 
 void
@@ -814,7 +818,7 @@ static const char *sparp_known_get_params[] = {
     "get:login", "get:method", "get:proxy", "get:query", "get:refresh", "get:soft", "get:uri", NULL };
 
 static const char *sparp_integer_defines[] = {
-    "input:grab-depth", "input:grab-limit", "output:maxrows", "sql:log-enable", "sql:signal-void-variables", NULL };
+    "input:grab-depth", "input:grab-limit", "output:maxrows", "sql:big-data-const", "sql:log-enable", "sql:signal-void-variables", NULL };
 
 static const char *sparp_var_defines[] = { NULL };
 
@@ -1081,6 +1085,12 @@ sparp_define (sparp_t *sparp, caddr_t param, ptrlong value_lexem_type, caddr_t v
       if (!strcmp (param, "sql:describe-mode")) {
           sparp->sparp_env->spare_describe_mode = t_box_dv_uname_string (value);
           return; }
+      if (!strcmp (param, "sql:big-data-const")) {
+          ptrlong val = ((DV_LONG_INT == DV_TYPE_OF (value)) ? unbox_ptrlong (value) : -1);
+          if ((0 > val) || (1 < val))
+            spar_error (sparp, "define sql:big-data-const should have value 0 or 1");
+            sparp->sparp_disable_big_const = 1-val;
+          return; }
       if (!strcmp (param, "sql:signal-void-variables")) {
           ptrlong val = ((DV_LONG_INT == DV_TYPE_OF (value)) ? unbox_ptrlong (value) : -1);
           if ((0 > val) || (1 < val))
@@ -1125,8 +1135,8 @@ void spar_gp_init (sparp_t *sparp, ptrlong subtype)
   t_set_push (&(env->spare_acc_filters), NULL);
   t_set_push (&(env->spare_context_gp_subtypes), (caddr_t)subtype);
   t_set_push (&(env->spare_good_graph_varname_sets), env->spare_good_graph_varnames);
-  if (WHERE_L != subtype)
-    t_set_push (&(sparp->sparp_env->spare_propvar_sets), NULL); /* For WHERE_L it's done at beginning of the result-set. */
+  if ((WHERE_L != subtype) && (CONSTRUCT_L != subtype))
+    t_set_push (&(sparp->sparp_env->spare_propvar_sets), NULL); /* For WHERE_L and CONSTRUCT_L it's done at beginning of the result-set. */
 }
 
 void spar_gp_replace_selid (sparp_t *sparp, dk_set_t membs, caddr_t old_selid, caddr_t new_selid)
@@ -1160,14 +1170,17 @@ spar_gp_finalize (sparp_t *sparp, SPART **options)
 {
   sparp_env_t *env = sparp->sparp_env;
   caddr_t orig_selid = env->spare_selids->data;
-  dk_set_t propvars = (dk_set_t) t_set_pop (&(env->spare_propvar_sets));
   dk_set_t membs;
   int all_ctr, opt_ctr;
   dk_set_t filts;
   ptrlong subtype;
   SPART *res;
   spar_dbg_printf (("spar_gp_finalize (..., %ld)\n", (long)subtype));
+  subtype = (ptrlong)(env->spare_context_gp_subtypes->data);
+  if (CONSTRUCT_L != subtype) /* CONSTRUCT_L did not push to spare_propvar_sets, using one that will be used in WHERE_L */
+    {
 /* Create triple patterns for distinct '+>' propvars and OPTIONAL triple patterns for distinct '*>' propvars */
+      dk_set_t propvars = (dk_set_t) t_set_pop (&(env->spare_propvar_sets));
   DO_SET (spar_propvariable_t *, pv, &propvars)
     {
       if (_STAR_GT == pv->sparpv_op)
@@ -1185,11 +1198,12 @@ spar_gp_finalize (sparp_t *sparp, SPART **options)
         }
     }
   END_DO_SET();
+    }
 /* Pop the rest of the environment and adjust graph varnames */
   membs = (dk_set_t) t_set_pop (&(env->spare_acc_triples));
   membs = dk_set_nreverse (membs);
   filts = (dk_set_t) t_set_pop (&(env->spare_acc_filters));
-  subtype = (ptrlong)((void *)t_set_pop (&(env->spare_context_gp_subtypes)));
+  t_set_pop (&(env->spare_context_gp_subtypes));
   env->spare_good_graph_bmk = t_set_pop (&(env->spare_good_graph_varname_sets));
 /* The following 'if' does not mention UNIONs because UNIONs are handled right in .y file
    For OPTIONAL GP we roll back spare_good_graph_vars at bookmarked level
@@ -1641,6 +1655,46 @@ in_local_set:
   return spar_make_variable (sparp, curr_pv->sparpv_obj_var_name);
 }
 
+void
+spar_list_triple_vars_in_gp (sparp_t *sparp, SPART *tree, dk_set_t *all_varnames_ret)
+{
+  int ctr;
+  switch (SPART_TYPE (tree))
+    {
+    case SPAR_ALIAS: t_set_push_new_string (all_varnames_ret, tree->_.alias.aname); break;
+    case SPAR_VARIABLE: t_set_push_new_string (all_varnames_ret, tree->_.var.vname); break;
+    case SPAR_TRIPLE:
+      for (ctr = SPART_TRIPLE_FIELDS_COUNT; ctr--; /* no step */)
+        {
+          SPART *fld = tree->_.triple.tr_fields[ctr];
+          if (SPAR_VARIABLE == SPART_TYPE (fld))
+            t_set_push_new_string (all_varnames_ret, fld->_.var.vname);
+        }
+      break;
+    case SPAR_GP:
+      DO_BOX_FAST_REV (SPART *, memb, ctr, tree->_.gp.members)
+        {
+          spar_list_triple_vars_in_gp (sparp, memb, all_varnames_ret);
+        }
+      END_DO_BOX_FAST_REV;
+      if (NULL != tree->_.gp.subquery)
+        {
+          SPART **retvals = tree->_.gp.subquery->_.req_top.retvals;
+          if (DV_ARRAY_OF_POINTER == DV_TYPE_OF (retvals))
+            {
+              DO_BOX_FAST_REV (SPART *, memb, ctr, tree->_.req_top.retvals)
+                {
+                  spar_list_triple_vars_in_gp (sparp, memb, all_varnames_ret);
+                }
+              END_DO_BOX_FAST_REV;
+            }
+          else
+            spar_internal_error (sparp, "Usupported combination of subqueries and service invocations");
+        }
+      break;
+    }
+}
+
 SPART *
 spar_make_service_inv (sparp_t *sparp, caddr_t endpoint, dk_set_t all_options, ptrlong permitted_syntax, SPART **sources, caddr_t sinv_storage)
 {
@@ -1648,6 +1702,7 @@ spar_make_service_inv (sparp_t *sparp, caddr_t endpoint, dk_set_t all_options, p
   dk_set_t param_varnames = NULL;
   dk_set_t rset_varnames = NULL;
   dk_set_t defines = NULL;
+  int in_list_implicit = 0;
   ptrlong sinvcount = sparp->sparp_sg->sg_sinv_count;
   SPART **sinvs = sparp->sparp_sg->sg_sinvs;
   SPART *sinv;
@@ -1662,6 +1717,21 @@ spar_make_service_inv (sparp_t *sparp, caddr_t endpoint, dk_set_t all_options, p
         }
       else if (IN_L == (ptrlong)optname)
         {
+          if (_STAR == (ptrlong)optvalue)
+            {
+              in_list_implicit = 1;
+              DO_SET (dk_set_t, members_before, &(sparp->sparp_env->spare_acc_triples))
+                {
+                  DO_SET (SPART *, member, &members_before)
+                    {
+                      spar_list_triple_vars_in_gp (sparp, member, &param_varnames);
+                    }
+                  END_DO_SET()
+                }
+              END_DO_SET()
+            }
+          else
+            {
           DO_SET (SPART *, var, (dk_set_t *)(&optvalue))
             {
               caddr_t vname = var->_.var.vname;
@@ -1671,6 +1741,7 @@ spar_make_service_inv (sparp_t *sparp, caddr_t endpoint, dk_set_t all_options, p
             }
           END_DO_SET()
         }
+        }
 /*! TBD: add other cases */
     }
   if (BOX_ELEMENTS_INT_0 (sinvs) == sinvcount)
@@ -1685,12 +1756,13 @@ spar_make_service_inv (sparp_t *sparp, caddr_t endpoint, dk_set_t all_options, p
 #endif
       sparp->sparp_sg->sg_sinvs = sinvs = new_sinvs;
     }
-  sinv = spartlist (sparp, 10, SPAR_SERVICE_INV,
+  sinv = spartlist (sparp, 11, SPAR_SERVICE_INV,
     sparp->sparp_sg->sg_sinv_count,
     endpoint,
     t_revlist_to_array (iri_params),
     t_box_num (permitted_syntax),
     t_revlist_to_array (param_varnames),
+    (ptrlong)in_list_implicit,
     t_revlist_to_array (rset_varnames),
     t_revlist_to_array (defines),
     sources,
@@ -1707,6 +1779,7 @@ spar_describe_restricted_by_physical (sparp_t *sparp, SPART **retvals)
   SPART *triple;
   int s_ctr;
   spar_selid_push_reused (sparp, uname__ref);
+  t_set_push (&(sparp->sparp_env->spare_context_gp_subtypes), (caddr_t)((ptrlong)WHERE_L));
   triple = spar_make_plain_triple (sparp,
     spar_make_fake_blank_node (sparp),
     NULL,
@@ -1714,6 +1787,7 @@ spar_describe_restricted_by_physical (sparp_t *sparp, SPART **retvals)
     spar_make_fake_blank_node (sparp),
     (caddr_t)(_STAR), NULL );
   spar_selid_pop (sparp);
+  t_set_pop (&(sparp->sparp_env->spare_context_gp_subtypes));
   DO_BOX_FAST (SPART *, s, s_ctr, retvals)
     {
       triple_case_t **cases;
@@ -1764,7 +1838,7 @@ spar_retvals_of_describe (sparp_t *sparp, SPART **retvals, SPART *limit_expn, SP
   SPART *agg_call;
   SPART *var_vector_expn;
   SPART *var_vector_arg;
-  SPART **opts;
+  dk_set_t opts_revlist = NULL;
   caddr_t limofs_name;
   const char *descr_name;
   int need_limofs_trick = (
@@ -1791,7 +1865,7 @@ spar_retvals_of_describe (sparp_t *sparp, SPART **retvals, SPART *limit_expn, SP
     (SPART **)t_list_to_array (vars) );
   if (need_limofs_trick)
     {
-      limofs_name = t_box_dv_short_string (":\"limofs\".\"describe-1\"");
+      limofs_name = t_box_dv_short_string ("@\"limofs\".\"describe-1\"");
       var_vector_arg = spar_make_variable (sparp, limofs_name);
     }
   else
@@ -1800,7 +1874,7 @@ spar_retvals_of_describe (sparp_t *sparp, SPART **retvals, SPART *limit_expn, SP
       (SPART **)t_list (1, var_vector_arg ) );
   if (NULL != sparp->sparp_env->spare_describe_mode)
     {
-      int phys_only = spar_describe_restricted_by_physical (sparp, retvals);
+      int phys_only = ((NULL == sparp->sparp_env->spare_inference_name) && spar_describe_restricted_by_physical (sparp, retvals));
       if (phys_only)
         descr_name = t_box_sprintf (100, "sql:SPARQL_DESC_DICT_%.50s_PHYSICAL", sparp->sparp_env->spare_describe_mode);
       else
@@ -1813,12 +1887,23 @@ spar_retvals_of_describe (sparp_t *sparp, SPART **retvals, SPART *limit_expn, SP
   else
     good_graphs = (SPART *)t_box_num_nonull (0);
   bad_graphs = spar_make_list_of_sources_expn (sparp, SPART_GRAPH_NOT_FROM, SPART_GRAPH_NOT_GROUP, SPART_GRAPH_NOT_NAMED, 0x0, NULL);
-  if (NULL == sparp->sparp_gs_app_callback)
-    opts = (SPART **)t_list (2, t_box_dv_short_string ("uid"), spar_boxed_exec_uid (sparp));
-  else
-    opts = (SPART **)t_list (6, t_box_dv_short_string ("uid"), spar_boxed_exec_uid (sparp),
-      t_box_dv_short_string ("gs-app-callback"), sparp->sparp_gs_app_callback,
-      t_box_dv_short_string ("gs-app-uid"), ((NULL == sparp->sparp_gs_app_uid) ? t_NEW_DB_NULL : sparp->sparp_gs_app_uid) );
+  t_set_push (&opts_revlist, t_box_dv_short_string ("uid"));
+  t_set_push (&opts_revlist, spar_boxed_exec_uid (sparp));
+  if (NULL != sparp->sparp_gs_app_callback)
+    {
+      t_set_push (&opts_revlist, t_box_dv_short_string ("gs-app-callback"));
+      t_set_push (&opts_revlist, sparp->sparp_gs_app_callback );
+    }
+  if (NULL != sparp->sparp_gs_app_uid)
+    {
+      t_set_push (&opts_revlist, t_box_dv_short_string ("gs-app-uid"));
+      t_set_push (&opts_revlist, sparp->sparp_gs_app_uid);
+    }
+  if (NULL != sparp->sparp_env->spare_inference_name)
+    {
+      t_set_push (&opts_revlist, t_box_dv_short_string ("inference"));
+      t_set_push (&opts_revlist, sparp->sparp_env->spare_inference_name);
+    }
   descr_call = spar_make_funcall (sparp, 0, descr_name,
       (SPART **)t_list (6,
         agg_call,
@@ -1827,7 +1912,7 @@ spar_retvals_of_describe (sparp_t *sparp, SPART **retvals, SPART *limit_expn, SP
         good_graphs,
         bad_graphs,
         sparp->sparp_env->spare_storage_name,
-        spar_make_funcall (sparp, 0, "bif:vector", opts) ) ); /*!!!TBD describe options will be added here */
+        spar_make_funcall (sparp, 0, "bif:vector", (SPART **)t_revlist_to_array (opts_revlist)) ) ); /*!!!TBD describe options will be added here */
   if (need_limofs_trick)
     return (SPART **)t_list (2, descr_call,
       spartlist (sparp, 4, SPAR_ALIAS, var_vector_expn, t_box_dv_short_string ("describe-1"), SSG_VALMODE_AUTO) );
@@ -1951,6 +2036,7 @@ spar_make_top_or_special_case_from_wm (sparp_t *sparp, ptrlong subtype, SPART **
     SPART *grp, *triple, *retvar, *gvar;
     caddr_t retname, gname;
     int ctr1, ctr2;
+    if (NULL != sparp->sparp_env->spare_parent_env) break;
     if (DISTINCT_L != subtype) break;
     if (NULL != sparp->sparp_env->spare_named_graphs) break;
     if (!IS_BOX_POINTER (retvals)) break;
@@ -2009,6 +2095,75 @@ spar_make_top_or_special_case_from_wm (sparp_t *sparp, ptrlong subtype, SPART **
   return spar_make_top (sparp, subtype, retvals, retselid, pattern, groupings, having, order, limit, offset);
 }
 
+void
+spar_alloc_fake_equivs_for_bindings_inv (sparp_t *sparp, SPART *binv)
+{
+  int varctr, rowctr;
+  DO_BOX_FAST_REV (SPART *, var, varctr, binv->_.binv.vars)
+    {
+      sparp_equiv_t *eq;
+      int restr_set = SPART_VARR_NOT_NULL | SPART_VARR_IS_REF | SPART_VARR_IS_IRI | SPART_VARR_IS_LIT;
+      int restr_drop = 0;
+      var->_.var.rvr.rvrRestrictions = SPART_VARR_CONFLICT;
+      DO_BOX_FAST (SPART **, row, rowctr, binv->_.binv.data_rows)
+        {
+          SPART *datum = row[varctr];
+          if (NULL == datum)
+            restr_drop |= SPART_VARR_NOT_NULL;
+          else
+            switch (SPART_TYPE (datum))
+              {
+              case SPAR_QNAME: restr_drop |= SPART_VARR_IS_LIT; break;
+              case SPAR_LIT: restr_drop |= SPART_VARR_IS_REF | SPART_VARR_IS_IRI; break;
+              }
+        }
+      END_DO_BOX_FAST;
+      if (rowctr)
+        var->_.var.rvr.rvrRestrictions = restr_set & ~restr_drop;
+      else
+        var->_.var.rvr.rvrRestrictions = SPART_VARR_CONFLICT;
+      if (1 == rowctr)
+        {
+          SPART *datum = binv->_.binv.data_rows[0][varctr];
+          if (NULL == datum)
+            var->_.var.rvr.rvrRestrictions = SPART_VARR_ALWAYS_NULL;
+          else
+          switch (SPART_TYPE (datum))
+            {
+            case SPAR_QNAME:
+              var->_.var.rvr.rvrRestrictions |= SPART_VARR_FIXED;
+              var->_.var.rvr.rvrFixedValue = datum->_.qname.val;
+              break;
+            case SPAR_LIT:
+              if (DV_ARRAY_OF_POINTER == DV_TYPE_OF (datum))
+                {
+                  if (NULL != datum->_.lit.language)
+                    break;
+                  if (NULL != datum->_.lit.datatype)
+                    break;
+                  var->_.var.rvr.rvrRestrictions |= SPART_VARR_FIXED;
+                  var->_.var.rvr.rvrFixedValue = datum->_.lit.val;
+                  break;
+                }
+              var->_.var.rvr.rvrRestrictions |= SPART_VARR_FIXED;
+              var->_.var.rvr.rvrFixedValue = (ccaddr_t)datum;
+              break;
+            }
+        }
+      eq = sparp_equiv_alloc (sparp);
+      eq->e_varnames = (caddr_t *)t_list (1, var->_.var.vname);
+      eq->e_vars = (SPART **)t_list (1, var);
+      eq->e_var_count = 1;
+      eq->e_nested_bindings = 1; /* fake, to not reset rvr to conflict */
+      eq->e_gp = binv;
+      eq->e_const_reads = 1;
+      sparp_equiv_tighten (sparp, eq, &(var->_.var.rvr), ~0);
+      var->_.var.equiv_idx = eq->e_own_idx;
+    }
+  END_DO_BOX_FAST_REV;
+}
+
+
 SPART **
 spar_make_sources_like_top (sparp_t *sparp)
 {
@@ -2239,6 +2394,11 @@ spar_gp_add_triple_or_special_filter (sparp_t *sparp, SPART *graph, SPART *subje
     predicate = (SPART *)t_box_copy_tree (env->spare_context_predicates->data);
   if (NULL == object)
     object = (SPART *)t_box_copy_tree (env->spare_context_objects->data);
+  if (CONSTRUCT_L == SPARP_ENV_CONTEXT_GP_SUBTYPE(sparp))
+    {
+      graph = spar_make_blank_node (sparp, spar_mkid (sparp, "_::default"), 2);
+      goto plain_triple_in_ctor; /* see below */
+    }
 #if 1
   if (NULL == qm_iri_or_pair)
     {
@@ -2304,8 +2464,8 @@ spar_gp_add_triple_or_special_filter (sparp_t *sparp, SPART *graph, SPART *subje
   if ((NULL != inf_ctx) && (SPAR_QNAME == SPART_TYPE (predicate)))
         {
       caddr_t p_name = predicate->_.qname.val;
-      caddr_t *propprops = sparp->sparp_env->spare_inference_ctx->ric_prop_props;
-      caddr_t *invlist = sparp->sparp_env->spare_inference_ctx->ric_inverse_prop_pair_sortedalist;
+      caddr_t *propprops = inf_ctx->ric_prop_props;
+      caddr_t *invlist = inf_ctx->ric_inverse_prop_pair_sortedalist;
       if (NULL != propprops)
         {
           int propproplen = BOX_ELEMENTS (propprops);
@@ -2378,7 +2538,7 @@ spar_gp_add_triple_or_special_filter (sparp_t *sparp, SPART *graph, SPART *subje
       dflts = env->spare_default_graphs;
       if ((NULL == dflts) && (NULL != env->spare_named_graphs))
         { /* Special case: if no FROM clauses specified but there are some FROM NAMED then default graph is totally empty */
-          graph = spar_make_blank_node (sparp, spar_mkid (sparp, "_::default"), 1);
+          graph = spar_make_blank_node (sparp, spar_mkid (sparp, "_::default"), 2);
           graph->_.var.rvr.rvrRestrictions |= SPART_VARR_CONFLICT;
           break;
         }
@@ -2390,7 +2550,7 @@ spar_gp_add_triple_or_special_filter (sparp_t *sparp, SPART *graph, SPART *subje
             {
               caddr_t iri_arg = single_dflt->_.graph.iri;
               SPART *eq;
-              graph = spar_make_blank_node (sparp, spar_mkid (sparp, "_::default"), 1);
+              graph = spar_make_blank_node (sparp, spar_mkid (sparp, "_::default"), 2);
               eq = spartlist (sparp, 3, BOP_EQ, sparp_tree_full_copy (sparp, graph, NULL), sparp_tree_full_copy (sparp, single_dflt->_.graph.expn, NULL));
               spar_gp_add_filter (sparp, eq);
               graph->_.var.rvr.rvrRestrictions |= SPART_VARR_FIXED | SPART_VARR_IS_REF | SPART_VARR_NOT_NULL;
@@ -2402,10 +2562,11 @@ spar_gp_add_triple_or_special_filter (sparp_t *sparp, SPART *graph, SPART *subje
             break;
         }
       else
-        graph = spar_make_blank_node (sparp, spar_mkid (sparp, "_::default"), 1);
+        graph = spar_make_blank_node (sparp, spar_mkid (sparp, "_::default"), 2);
       spar_gp_add_filters_for_graph (sparp, graph, 0, 0);
       break;
     }
+plain_triple_in_ctor:
   if (SPAR_IS_BLANK_OR_VAR (graph))
     graph->_.var.selid = env->spare_selids->data;
   triple = spar_make_plain_triple (sparp, graph, subject, predicate, object, qm_iri_or_pair, options);
@@ -2430,6 +2591,8 @@ spar_make_plain_triple (sparp_t *sparp, SPART *graph, SPART *subject, SPART *pre
     env->spare_selids->data, key, NULL,
     NULL, NULL, NULL, NULL,
     options, (ptrlong)0, (ptrlong)((sparp->sparp_unictr)++) );
+  if (CONSTRUCT_L == SPARP_ENV_CONTEXT_GP_SUBTYPE(sparp))
+    return triple;
   for (fctr = 0; fctr < SPART_TRIPLE_FIELDS_COUNT; fctr++)
     {
       SPART *fld = triple->_.triple.tr_fields[fctr];
@@ -2507,6 +2670,8 @@ spar_make_variable (sparp_t *sparp, caddr_t name)
     selid = env->spare_selids->data;
   else if (is_global) /* say, 'insert in graph ?:someglobalvariable {...} where {...} */
     selid = t_box_dv_uname_string ("(global)");
+  else if (SPART_VARNAME_IS_SPECIAL(name)) /* say, '@"limofs"."describe-1"' */
+    selid = t_box_dv_uname_string ("(special)");
   else
     spar_internal_error (sparp, "non-global variable outside any group pattern or result-set list");
   res = spartlist (sparp, 6 + (sizeof (rdf_val_range_t) / sizeof (caddr_t)),
@@ -2521,10 +2686,14 @@ SPART *spar_make_blank_node (sparp_t *sparp, caddr_t name, int bracketed)
 {
   sparp_env_t *env = sparp->sparp_env;
   SPART *res;
-  res = spartlist (sparp, 6 + (sizeof (rdf_val_range_t) / sizeof (caddr_t)),
+  if ((sparp->sparp_in_precode_expn) && !(bracketed & 0x2))
+    spar_error (sparp, "Blank node '%.100s' is not allowed in a constant clause", name);
+  if (NULL == env->spare_selids)
+    spar_error (sparp, "Blank nodes (e.g., '%.100s') can not be used outside any group pattern or result-set list", name);
+  res = spartlist (sparp, 7 + (sizeof (rdf_val_range_t) / sizeof (caddr_t)),
       SPAR_BLANK_NODE_LABEL, name,
       env->spare_selids->data, NULL,
-      (ptrlong)(bracketed), SPART_BAD_EQUIV_IDX, SPART_RVR_LIST_OF_NULLS );
+      (ptrlong)0, SPART_BAD_EQUIV_IDX, SPART_RVR_LIST_OF_NULLS, (ptrlong)bracketed );
   res->_.var.rvr.rvrRestrictions = /*SPART_VARR_IS_REF | SPART_VARR_IS_BLANK |*/ SPART_VARR_NOT_NULL;
   return res;
 }
@@ -2532,10 +2701,10 @@ SPART *spar_make_blank_node (sparp_t *sparp, caddr_t name, int bracketed)
 SPART *spar_make_fake_blank_node (sparp_t *sparp)
 {
   SPART *res;
-  res = spartlist (sparp, 6 + (sizeof (rdf_val_range_t) / sizeof (caddr_t)),
+  res = spartlist (sparp, 7 + (sizeof (rdf_val_range_t) / sizeof (caddr_t)),
       SPAR_BLANK_NODE_LABEL, uname__ref,
       uname__ref, NULL,
-      (ptrlong)(0), SPART_BAD_EQUIV_IDX, SPART_RVR_LIST_OF_NULLS );
+      (ptrlong)(0), SPART_BAD_EQUIV_IDX, SPART_RVR_LIST_OF_NULLS, (ptrlong)0x2 );
   res->_.var.rvr.rvrRestrictions = /*SPART_VARR_IS_REF | SPART_VARR_IS_BLANK |*/ SPART_VARR_NOT_NULL;
   return res;
 }
@@ -2682,6 +2851,7 @@ sparp_make_and_push_new_graph_source (sparp_t *sparp, ptrlong subtype, SPART *ir
       group_members_ptr = (caddr_t **)id_hash_get (rdf_graph_group_dict_htable, (caddr_t)(&iid));
           mutex_leave (rdf_graph_group_dict_htable->ht_mutex);
         }
+      dk_free_tree (iid);
     }
   else
     group_members_ptr = NULL;
@@ -2953,7 +3123,7 @@ spar_make_funcall (sparp_t *sparp, int aggregate_mode, const char *funname, SPAR
   aggregate_mode = 1;
   if (sparp->sparp_in_precode_expn)
     spar_error (sparp, "Aggregate function %.100s() is not allowed in 'precode' expressions that should be calculated before the result-set of the query", funname);
-  if (!sparp->sparp_allow_aggregates_in_expn)
+  if (!(sparp->sparp_allow_aggregates_in_expn & 1))
     spar_error (sparp, "Aggregate function %.100s() is not allowed outside result-set expressions", funname);
 aggr_checked:
   if (aggregate_mode)
@@ -3742,20 +3912,19 @@ bif_sparql_to_sql_text (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   int param_ctr = 0;
   spar_query_env_t sparqre;
   sparp_t * sparp;
-  caddr_t str;
+  caddr_t str, uname = NULL;
   spar_sqlgen_t ssg;
   sql_comp_t sc;
   dk_session_t *res;
   str = bif_string_arg (qst, args, 0, "sparql_to_sql_text");
+  if (1 < BOX_ELEMENTS (args))
+    uname = bif_string_arg (qst, args, 1, "sparql_to_sql_text"); /* set before MP_START () for case of argument of wrong type causing signal w/o MP_DONE() */
   MP_START ();
   memset (&sparqre, 0, sizeof (spar_query_env_t));
   sparqre.sparqre_param_ctr = &param_ctr;
   sparqre.sparqre_qi = (query_instance_t *) qst;
-  if (1 < BOX_ELEMENTS (args))
-    {
-      caddr_t uname = bif_string_arg (qst, args, 1, "sparql_to_sql_text");
+  if (NULL != uname)
       sparqre.sparqre_exec_user = sec_name_to_user (uname);
-    }
   sparp = sparp_query_parse (str, &sparqre, 1);
   if (NULL != sparqre.sparqre_catched_error)
     {
@@ -3903,6 +4072,7 @@ bif_sparql_quad_maps_for_quad_impl (caddr_t * qst, caddr_t * err_ret, state_slot
         storage_name = t_box_dv_uname_string (storage_name);
       sparp.sparp_storage = sparp_find_storage_by_name (storage_name);
       t_set_push (&(spare.spare_selids), t_box_dv_short_string (fname));
+      t_set_push (&(spare.spare_context_gp_subtypes), (caddr_t)((ptrlong)WHERE_L));
       triple = spar_make_plain_triple (&sparp,
         spar_make_literal_from_sql_box (&sparp, sqlvals[SPART_TRIPLE_GRAPH_IDX]		, (int)(flags & 1)),
         spar_make_literal_from_sql_box (&sparp, sqlvals[SPART_TRIPLE_SUBJECT_IDX]	, (int)(flags & 1)),
@@ -4041,7 +4211,7 @@ bif_sparql_quad_maps_for_quad_impl (caddr_t * qst, caddr_t * err_ret, state_slot
       sparqre.sparqre_catched_error = thr_get_error_code (self);
       thr_set_error_code (self, NULL);
       POP_QR_RESET;
-      if (SQL_SUCCESS != sparqre.sparqre_catched_error) /* if err is SQL_SUCCESS will be done below as no jump will occur */
+      if (SQL_SUCCESS != sparqre.sparqre_catched_error) /* if err is SQL_SUCCESS will be done bellow as no jump will occur */
 	{
           ssg_free_internals (&ssg);
           MP_DONE ();
@@ -4294,6 +4464,8 @@ end_of_test:
 }
 #endif
 
+extern caddr_t bif_sparql_rdb2rdf_codegen (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args);
+extern caddr_t bif_sparql_rdb2rdf_list_tables (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args);
 
 void
 sparql_init (void)
@@ -4308,6 +4480,8 @@ sparql_init (void)
   bif_define ("sparql_lex_analyze", bif_sparql_lex_analyze);
   bif_define ("sparql_quad_maps_for_quad", bif_sparql_quad_maps_for_quad);
   bif_define ("sparql_sql_cols_for_quad", bif_sparql_sql_cols_for_quad);
+  bif_define ("sparql_rdb2rdf_codegen", bif_sparql_rdb2rdf_codegen);
+  bif_define ("sparql_rdb2rdf_list_tables", bif_sparql_rdb2rdf_list_tables);
   bif_define ("__sprintff_is_proven_bijection", bif_sprintff_is_proven_bijection);
   bif_define ("__sprintff_is_proven_unparseable", bif_sprintff_is_proven_unparseable);
   bif_define ("__sprintff_intersect", bif_sprintff_intersect);
diff --git a/libsrc/Wi/sparql_io.sql b/libsrc/Wi/sparql_io.sql
index 3387b6c..5936791 100644
--- a/libsrc/Wi/sparql_io.sql
+++ b/libsrc/Wi/sparql_io.sql
@@ -1,5 +1,5 @@
 --
---  $Id: sparql_io.sql,v 1.14.2.26 2010/06/01 15:26:40 source Exp $
+--  $Id: sparql_io.sql,v 1.14.2.54 2011/03/23 16:45:20 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -24,7 +24,7 @@
 --!AWK PUBLIC
 create procedure DB.DBA.SPARQL_RSET_XML_WRITE_NS (inout ses any)
 {
-  -- http ('<?xml version="1.0" ?>\n', ses);
+  --http ('<?xml version="1.0" encoding="UTF-8"?>\n', ses);
   http ('<sparql xmlns="http://www.w3.org/2005/sparql-results#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/sw/DataAccess/rf1/result2.xsd">', ses);
 }
 ;
@@ -50,6 +50,7 @@ create function DB.DBA.SPARQL_RSET_XML_HTTP_PRE (in colnames any, in accept varc
 {
   declare ses integer;
   ses := 0;
+  -- dbg_obj_princ ('DB.DBA.SPARQL_RSET_XML_HTTP_PRE (', colnames, accept, ')');
   if (strchr (accept, ' ') is not null)
     accept := subseq (accept, strchr (accept, ' ')+1);
   http_header ('Content-Type: ' || accept || '; charset=UTF-8\r\n');
@@ -81,6 +82,7 @@ create aggregate DB.DBA.SPARQL_RSET_XML_HTTP (inout colnames any, inout row any)
   DB.DBA.SPARQL_RSET_XML_HTTP_INIT,
   sparql_rset_xml_write_row,
   DB.DBA.SPARQL_RSET_XML_HTTP_FINAL
+order
 ;
 
 
@@ -88,6 +90,7 @@ create aggregate DB.DBA.SPARQL_RSET_XML_HTTP (inout colnames any, inout row any)
 create function DB.DBA.SPARQL_DICT_XML_HTTP_PRE (in colnames any, in accept varchar)
 {
   declare ses integer;
+  -- dbg_obj_princ ('DB.DBA.SPARQL_DICT_XML_HTTP_PRE (', colnames, accept, ')');
   http_header ('Content-Type: ' || accept || '; charset=UTF-8\r\n');
   http_flush (1);
   ses := 0;
@@ -107,7 +110,7 @@ create aggregate DB.DBA.SPARQL_DICT_XML_HTTP (inout colnames any, inout row any)
 
 
 --!AWK PUBLIC
-create procedure SPARQL_RSET_TTL_WRITE_NS (inout ses any)
+create procedure DB.DBA.SPARQL_RSET_TTL_WRITE_NS (inout ses any)
 {
   http ('@prefix res: <http://www.w3.org/2005/sparql-results#> .
 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@@ -173,6 +176,7 @@ create aggregate DB.DBA.SPARQL_RSET_TTL_HTTP (inout colnames any, inout row any)
   DB.DBA.SPARQL_RSET_TTL_HTTP_INIT,
   sparql_rset_ttl_write_row,
   DB.DBA.SPARQL_RSET_TTL_HTTP_FINAL
+order
 ;
 
 --!AWK PUBLIC
@@ -222,6 +226,7 @@ create aggregate DB.DBA.SPARQL_RSET_NT_HTTP (inout colnames any, inout row any)
   DB.DBA.SPARQL_RSET_TTL_HTTP_INIT,
   sparql_rset_nt_write_row,
   DB.DBA.SPARQL_RSET_TTL_HTTP_FINAL
+order
 ;
 
 -----
@@ -237,12 +242,22 @@ create procedure DB.DBA.SPARQL_REXEC_INT (
   inout req_hdr any,
   in maxrows integer,
   inout metas any,
-  inout bnode_dict any
+  inout bnode_dict any,
+  in expected_var_list any := null
   )
 {
+  declare quest_pos integer;
   declare req_uri, req_method, req_body, local_req_hdr, ret_body, ret_hdr any;
   declare ret_content_type, ret_known_content_type, ret_format varchar;
+  -- dbg_obj_princ ('DB.DBA.SPARQL_REXEC_INT (', res_mode, res_make_obj, service, query, dflt_graph, named_graphs, req_hdr, maxrows, metas, bnode_dict, ')');
+  quest_pos := strchr (service, '?');
   req_body := string_output();
+  if (quest_pos is not null)
+    {
+      http (subseq (service, quest_pos+1), req_body);
+      http ('&', req_body);
+      service := subseq (service, 0, quest_pos);
+    }
   http ('query=', req_body);
   http_url (query, 0, req_body);
   if (dflt_graph is not null and dflt_graph <> '')
@@ -283,25 +298,23 @@ create procedure DB.DBA.SPARQL_REXEC_INT (
   -- dbg_obj_princ ('DB.DBA.SPARQL_REXEC_INT Returned body: ', ret_body);
   ret_content_type := http_request_header (ret_hdr, 'Content-Type', null, null);
   ret_known_content_type := http_sys_find_best_sparql_accept (ret_content_type, 0, ret_format);
+  -- dbg_obj_princ ('DB.DBA.SPARQL_REXEC_INT ret_content_type=', ret_content_type, ' ret_known_content_type=', ret_known_content_type, ' ret_format=', ret_format);
   if (ret_format is null or not (ret_format in ('XML', 'RDFXML', 'TTL')))
     {
       declare ret_begin, ret_html any;
       ret_begin := "LEFT" (ret_body, 1024);
       ret_html := xtree_doc (ret_begin, 2);
+      -- dbg_obj_princ ('DB.DBA.SPARQL_REXEC_INT ret_html=', ret_html);
       if (xpath_eval ('/html|/xhtml', ret_html) is not null)
-        ret_content_type := 'text/html';
+        ret_format := 'HTML';
       else if (xpath_eval ('[xmlns:rset="http://www.w3.org/2005/sparql-results#"] /rset:sparql', ret_html) is not null
             or xpath_eval ('[xmlns:rset2="http://www.w3.org/2001/sw/DataAccess/rf1/result2"] /rset2:sparql', ret_html) is not null)
-        ret_content_type := 'application/sparql-results+xml';
+        ret_format := 'XML';
       else if (xpath_eval ('[xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"] /rdf:rdf', ret_html) is not null)
-        ret_content_type := 'application/rdf+xml';
+        ret_format := 'RDFXML';
       else if (strstr (ret_begin, '<html>') is not null or
         strstr (ret_begin, '<xhtml>') is not null )
-        ret_content_type := 'text/html';
-      else
-        {
-          ret_content_type := 'text/plain';
-        }
+        ret_format := 'HTML';
     }
   if (ret_format = 'XML')
     {
@@ -309,10 +322,10 @@ create procedure DB.DBA.SPARQL_REXEC_INT (
       declare var_ctr, var_count integer;
       declare vect_acc any;
       declare row_inx integer;
-       -- dbg_obj_princ ('application/sparql-results+xml ret_body=', ret_body);
+      -- dbg_obj_princ ('application/sparql-results+xml ret_body=', ret_body); string_to_file ('DB.DBA.SPARQL_REXEC_INT.reply.xml', ret_body, -2);
       ret_xml := xtree_doc (ret_body, 0);
       var_list := xpath_eval ('[xmlns:rset="http://www.w3.org/2005/sparql-results#"] [xmlns:rset2="http://www.w3.org/2001/sw/DataAccess/rf1/result2"]
-                               /rset:sparql/rset:head/rset:variable | /rset2:sparql/rset2:head/rset2:variable', ret_xml, 0);
+                               /rset:sparql/rset:head/rset:variable/@name | /rset2:sparql/rset2:head/rset2:variable/@name', ret_xml, 0);
       if (0 = length (var_list))
         {
 	  declare bool_ret any;
@@ -349,12 +362,26 @@ create procedure DB.DBA.SPARQL_REXEC_INT (
 	    service ) );
 	}
       var_count := length (var_list);
+      if (expected_var_list is not null)
+        {
+          for (var_ctr := var_count - 1; var_ctr >= 0; var_ctr := var_ctr - 1)
+            {
+              declare var_name varchar;
+              var_name := cast (var_list[var_ctr] as varchar);
+              if (0 >= position (var_name, expected_var_list))
+                signal ('RDFZZ', sprintf (
+                  'DB.DBA.SPARQL_REXEC(''%.300s'', ...) has received result with unexpected variable name ''%.300s''',
+                  service, var_name ) );
+            }
+          var_list := expected_var_list;
+          var_count := length (var_list);
+        }
       var_metas := make_array (var_count, 'any');
       out_nulls := make_array (var_count, 'any');
       for (var_ctr := var_count - 1; var_ctr >= 0; var_ctr := var_ctr - 1)
         {
           declare var_name varchar;
-          var_name := cast (xpath_eval ('@name', var_list[var_ctr]) as varchar);
+          var_name := cast (var_list[var_ctr] as varchar);
           var_list [var_ctr] := var_name;
           var_metas [var_ctr] := vector (var_name, 242, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0);
           out_nulls [var_ctr] := null;
@@ -490,7 +517,7 @@ create procedure DB.DBA.SPARQL_REXEC_INT (
       signal ('RDFZZ', sprintf (
           'DB.DBA.SPARQL_REXEC(''%.300s'', ...) returned Content-Type ''%.300s'' status ''%.300s''\n%.1000s',
           service, ret_content_type, ret_hdr[0],
-	  cast (xtree_doc (ret_body, 2) as varchar) ) );
+	  "LEFT" (cast (xtree_doc (ret_body, 2) as varchar), 1024) ) );
     }
   signal ('RDFZZ', sprintf (
       'DB.DBA.SPARQL_REXEC(''%.300s'', ...) returned unsupported Content-Type ''%.300s''',
@@ -520,11 +547,12 @@ create function DB.DBA.SPARQL_REXEC_TO_ARRAY (
   in named_graphs any,
   in req_hdr any,
   in maxrows integer,
-  in bnode_dict any
+  in bnode_dict any,
+  in expected_var_list any := null
   ) returns any
 {
   declare metas any;
-  return DB.DBA.SPARQL_REXEC_INT (1, 0, service, query, dflt_graph, named_graphs, req_hdr, maxrows, metas, bnode_dict);
+  return DB.DBA.SPARQL_REXEC_INT (1, 0, service, query, dflt_graph, named_graphs, req_hdr, maxrows, metas, bnode_dict, expected_var_list);
 }
 ;
 
@@ -535,11 +563,12 @@ create function DB.DBA.SPARQL_REXEC_TO_ARRAY_OF_OBJ (
   in named_graphs any,
   in req_hdr any,
   in maxrows integer,
-  in bnode_dict any
+  in bnode_dict any,
+  in expected_var_list any := null
   ) returns any
 {
   declare metas any;
-  return DB.DBA.SPARQL_REXEC_INT (1, 1, service, query, dflt_graph, named_graphs, req_hdr, maxrows, metas, bnode_dict);
+  return DB.DBA.SPARQL_REXEC_INT (1, 1, service, query, dflt_graph, named_graphs, req_hdr, maxrows, metas, bnode_dict, expected_var_list);
 }
 ;
 
@@ -561,23 +590,24 @@ create procedure DB.DBA.SPARQL_REXEC_WITH_META (
 ;
 
 
-create procedure DB.DBA.SPARQL_SINV_IMP (in ws_endpoint varchar, in ws_params any, in qtext_template varchar, in qtext_posmap nvarchar, in param_row any)
+create procedure DB.DBA.SPARQL_SINV_IMP (in ws_endpoint varchar, in ws_params any, in qtext_template varchar, in qtext_posmap nvarchar, in param_row any, in expected_vars any)
 {
   declare RSET, retarray any;
   result_names (RSET);
-  -- dbg_obj_princ ('DB.DBA.SPARQL_SINV_IMP (', ws_endpoint, ws_params, qtext_template, qtext_posmap, param_row, ')');
+  -- dbg_obj_princ ('DB.DBA.SPARQL_SINV_IMP (', ws_endpoint, ws_params, qtext_template, qtext_posmap, param_row, expected_var_list, ')');
   if (N'' <> qtext_posmap)
     {
       declare qtext_ses any;
-      declare prev_pos, qctr integer;
+      declare prev_pos, qctr, qcount integer;
       qtext_ses := string_output ();
       prev_pos := 0;
-      for (qctr := length (qtext_posmap); qctr > 0; qctr := qctr-2)
+      qcount := length (qtext_posmap)-1;
+      for (qctr := 0; qctr < qcount; qctr := qctr+2)
         {
           declare qpos integer;
-          qpos := qtext_posmap[qctr-2];
+          qpos := qtext_posmap[qctr];
           http (subseq (qtext_template, prev_pos, qpos), qtext_ses);
-          http_nt_object (param_row[qtext_posmap[qctr-1]-1], qtext_ses);
+          http_nt_object (param_row[qtext_posmap[qctr+1]-1], qtext_ses);
           prev_pos := qpos+8;
         }
       http (subseq (qtext_template, prev_pos), qtext_ses);
@@ -590,8 +620,8 @@ create procedure DB.DBA.SPARQL_SINV_IMP (in ws_endpoint varchar, in ws_params an
     NULL, --in named_graphs any,
     NULL, -- in req_hdr any,
     10000000,
-    NULL --  in bnode_dict any
-  );
+    NULL, --  in bnode_dict any
+    expected_vars );
   foreach (any retrow in retarray) do
     {
       -- dbg_obj_princ ('DB.DBA.SPARQL_SINV_IMP returns ', retrow);
@@ -600,7 +630,7 @@ create procedure DB.DBA.SPARQL_SINV_IMP (in ws_endpoint varchar, in ws_params an
 }
 ;
 
-create procedure view DB.DBA.SPARQL_SINV as DB.DBA.SPARQL_SINV_IMP (ws_endpoint, ws_params, qtext_template, qtext_posmap, param_row)(RSET any)
+create procedure view DB.DBA.SPARQL_SINV_2 as DB.DBA.SPARQL_SINV_IMP (ws_endpoint, ws_params, qtext_template, qtext_posmap, param_row, expected_vars)(RSET any)
 ;
 
 -----
@@ -640,7 +670,7 @@ create procedure "querySoap"  (in  "Command" varchar
 ;
 
 --!AWK PUBLIC
-create procedure SPARQL_WRITE_EXEC_STATUS (inout ses any, in line_format varchar, inout status any)
+create procedure DB.DBA.SPARQL_WRITE_EXEC_STATUS (inout ses any, in line_format varchar, inout status any)
 {
   declare lctr, lcount integer;
   declare lines any;
@@ -659,7 +689,7 @@ create procedure SPARQL_WRITE_EXEC_STATUS (inout ses any, in line_format varchar
 ;
 
 
-create procedure SPARQL_RESULTS_XML_WRITE_HEAD (inout ses any, in mdta any)
+create procedure DB.DBA.SPARQL_RESULTS_XML_WRITE_HEAD (inout ses any, in mdta any)
 {
   declare i, col_count integer;
 
@@ -685,7 +715,7 @@ create procedure SPARQL_RESULTS_XML_WRITE_HEAD (inout ses any, in mdta any)
 }
 ;
 
-create procedure SPARQL_RESULTS_XML_WRITE_RES (inout ses any, in mdta any, inout dta any)
+create procedure DB.DBA.SPARQL_RESULTS_XML_WRITE_RES (inout ses any, in mdta any, inout dta any)
 {
   http ('\n <results distinct="false" ordered="true">', ses);
 
@@ -709,6 +739,7 @@ create procedure DB.DBA.SPARQL_RESULTS_XML_WRITE_ROW (inout ses any, in mdta any
       _val := dta[x];
       if (_val is null)
         goto end_of_binding;
+      -- dbg_obj_princ ('_name=', _name, ',val=', _val, __tag(_val), __box_flags (_val));
       if (isiri_id (_val))
         {
           if (_val >= min_bnode_iri_id ())
@@ -792,7 +823,7 @@ end_of_binding: ;
 }
 ;
 
-create procedure SPARQL_RESULTS_RDFXML_WRITE_NS (inout ses any)
+create procedure DB.DBA.SPARQL_RESULTS_RDFXML_WRITE_NS (inout ses any)
 {
   http ('<rdf:RDF xmlns:res="http://www.w3.org/2005/sparql-results#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
   <rdf:Description rdf:nodeID="rset">
@@ -800,7 +831,7 @@ create procedure SPARQL_RESULTS_RDFXML_WRITE_NS (inout ses any)
 }
 ;
 
-create procedure SPARQL_RESULTS_RDFXML_WRITE_HEAD (inout ses any, in mdta any)
+create procedure DB.DBA.SPARQL_RESULTS_RDFXML_WRITE_HEAD (inout ses any, in mdta any)
 {
   declare i, col_count integer;
   mdta := mdta[0];
@@ -821,7 +852,7 @@ create procedure SPARQL_RESULTS_RDFXML_WRITE_HEAD (inout ses any, in mdta any)
 }
 ;
 
-create procedure SPARQL_RESULTS_RDFXML_WRITE_RES (inout ses any, in mdta any, inout dta any)
+create procedure DB.DBA.SPARQL_RESULTS_RDFXML_WRITE_RES (inout ses any, in mdta any, inout dta any)
 {
   for (declare ctr integer, ctr := 0; ctr < length (dta); ctr := ctr + 1)
     {
@@ -832,7 +863,7 @@ create procedure SPARQL_RESULTS_RDFXML_WRITE_RES (inout ses any, in mdta any, in
 }
 ;
 
-create procedure SPARQL_RESULTS_RDFXML_WRITE_ROW (inout ses any, in mdta any, inout dta any, in rowno integer)
+create procedure DB.DBA.SPARQL_RESULTS_RDFXML_WRITE_ROW (inout ses any, in mdta any, inout dta any, in rowno integer)
 {
   mdta := mdta[0];
   for (declare x any, x := 0; x < length (mdta); x := x + 1)
@@ -918,7 +949,7 @@ end_of_binding: ;
 }
 ;
 
-create procedure SPARQL_RESULTS_TTL_WRITE_NS (inout ses any)
+create procedure DB.DBA.SPARQL_RESULTS_TTL_WRITE_NS (inout ses any)
 {
   http ('@prefix res: <http://www.w3.org/2005/sparql-results#> .
 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@@ -926,7 +957,7 @@ _:_ a res:ResultSet .\n', ses);
 }
 ;
 
-create procedure SPARQL_RESULTS_TTL_WRITE_HEAD (inout ses any, in mdta any)
+create procedure DB.DBA.SPARQL_RESULTS_TTL_WRITE_HEAD (inout ses any, in mdta any)
 {
   declare i, col_count integer;
   mdta := mdta[0];
@@ -953,7 +984,7 @@ create procedure SPARQL_RESULTS_TTL_WRITE_HEAD (inout ses any, in mdta any)
 }
 ;
 
-create procedure SPARQL_RESULTS_TTL_WRITE_RES (inout ses any, in mdta any, inout dta any)
+create procedure DB.DBA.SPARQL_RESULTS_TTL_WRITE_RES (inout ses any, in mdta any, inout dta any)
 {
   declare colctr, colcount, rowctr, len, fake_agg_ctx integer;
   declare cols, colbuf, env any;
@@ -978,13 +1009,13 @@ create procedure SPARQL_RESULTS_TTL_WRITE_RES (inout ses any, in mdta any, inout
 }
 ;
 
-create procedure SPARQL_RESULTS_NT_WRITE_NS (inout ses any)
+create procedure DB.DBA.SPARQL_RESULTS_NT_WRITE_NS (inout ses any)
 {
   http ('_:ResultSet2053 rdf:type <http://www.w3.org/1999/02/22-rdf-syntax-ns#res:ResultSet> .\n', ses);
 }
 ;
 
-create procedure SPARQL_RESULTS_NT_WRITE_HEAD (inout ses any, in mdta any)
+create procedure DB.DBA.SPARQL_RESULTS_NT_WRITE_HEAD (inout ses any, in mdta any)
 {
   declare i, col_count integer;
   mdta := mdta[0];
@@ -1007,7 +1038,7 @@ create procedure SPARQL_RESULTS_NT_WRITE_HEAD (inout ses any, in mdta any)
 }
 ;
 
-create procedure SPARQL_RESULTS_NT_WRITE_RES (inout ses any, in mdta any, inout dta any)
+create procedure DB.DBA.SPARQL_RESULTS_NT_WRITE_RES (inout ses any, in mdta any, inout dta any)
 {
   declare colctr, colcount, rowctr, len, fake_agg_ctx integer;
   declare cols, colbuf, env any;
@@ -1032,7 +1063,7 @@ create procedure SPARQL_RESULTS_NT_WRITE_RES (inout ses any, in mdta any, inout
 }
 ;
 
-create procedure SPARQL_RESULTS_JAVASCRIPT_HTML_WRITE (inout ses any, inout metas any, inout rset any, in is_js integer := 0, in esc_mode integer := 1)
+create procedure DB.DBA.SPARQL_RESULTS_JAVASCRIPT_HTML_WRITE (inout ses any, inout metas any, inout rset any, in is_js integer := 0, in esc_mode integer := 1)
 {
   declare varctr, varcount, resctr, rescount integer;
   declare trnewline, newline varchar;
@@ -1102,6 +1133,8 @@ create procedure SPARQL_RESULTS_JAVASCRIPT_HTML_WRITE (inout ses any, inout meta
               --else
                 --http_value (val, 0, ses);
 	    }
+	  else if (__tag of rdf_box = __tag (val))
+	      http_rdf_object (val, ses, 1);
           else
             {
               http_escape (__rdf_strsqlval (val), esc_mode, ses, 1, 1);
@@ -1115,7 +1148,7 @@ end_of_val_print: ;
 }
 ;
 
-create procedure SPARQL_RESULTS_JSON_WRITE_BINDING (inout ses any, in colname varchar, inout val any)
+create procedure DB.DBA.SPARQL_RESULTS_JSON_WRITE_BINDING (inout ses any, in colname varchar, inout val any)
 {
   http(' "', ses);
   http_escape (colname, 11, ses, 0, 1);
@@ -1209,7 +1242,7 @@ create procedure SPARQL_RESULTS_JSON_WRITE_BINDING (inout ses any, in colname va
 }
 ;
 
-create procedure SPARQL_RESULTS_JSON_WRITE (inout ses any, inout metas any, inout rset any)
+create procedure DB.DBA.SPARQL_RESULTS_JSON_WRITE (inout ses any, inout metas any, inout rset any)
 {
   declare varctr, varcount, resctr, rescount integer;
   varcount := length (metas[0]);
@@ -1252,6 +1285,35 @@ end_of_val_print: ;
 }
 ;
 
+create procedure DB.DBA.SPARQL_RESULTS_CSV_WRITE (inout ses any, inout metas any, inout rset any)
+{
+  declare varctr, varcount, resctr, rescount integer;
+  varcount := length (metas[0]);
+  rescount := length (rset);
+  for (varctr := 0; varctr < varcount; varctr := varctr + 1)
+    {
+      if (varctr > 0)
+        http(',', ses);
+      DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (ses, metas[0][varctr][0]);
+    }
+  http ('\n', ses);
+  for (resctr := 0; resctr < rescount; resctr := resctr + 1)
+    {
+      for (varctr := 0; varctr < varcount; varctr := varctr + 1)
+        {
+          declare val any;
+          val := rset[resctr][varctr];
+          if (varctr > 0)
+            http(',', ses);
+          if (val is not null)
+            DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (ses, val);
+        }
+      http('\n', ses);
+    }
+}
+;
+
+
 create function DB.DBA.SPARQL_RESULTS_WRITE (inout ses any, inout metas any, inout rset any, in accept varchar, in add_http_headers integer, in status any := null) returns varchar
 {
   declare singlefield varchar;
@@ -1295,6 +1357,10 @@ create function DB.DBA.SPARQL_RESULTS_WRITE (inout ses any, inout metas any, ino
           http ('@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n at prefix rs: <http://www.w3.org/2005/sparql-results#> .\n', ses);
           http (sprintf ('[] rdf:type rs:results ; rs:boolean %s .', case (length (rset)) when 0 then 'false' else 'true' end), ses);
         }
+      else if (ret_format = 'CSV')
+        {
+          http (sprintf ('"bool"\n%d\n', case (length (rset)) when 0 then 0 else 1 end), ses);
+        }
       else
         {
           ret_mime := 'text/html';
@@ -1329,6 +1395,12 @@ create function DB.DBA.SPARQL_RESULTS_WRITE (inout ses any, inout metas any, ino
         DB.DBA.RDF_TRIPLES_TO_ATOM_XML_TEXT (triples, 1, ses);
       else if (ret_format = 'JSON;ODATA')
         DB.DBA.RDF_TRIPLES_TO_ODATA_JSON (triples, ses);
+      else if (ret_format = 'CXML')
+        DB.DBA.RDF_TRIPLES_TO_CXML (triples, ses, accept, add_http_headers, 0, status);
+      else if (ret_format = 'CXML;QRCODE')
+        DB.DBA.RDF_TRIPLES_TO_CXML (triples, ses, accept, add_http_headers, 1, status);
+      else if (ret_format = 'CSV')
+        DB.DBA.RDF_TRIPLES_TO_CSV (triples, ses);
       else if (ret_format = 'SOAP')
 	{
 	  declare soap_ns, spt_ns varchar;
@@ -1459,6 +1531,17 @@ create function DB.DBA.SPARQL_RESULTS_WRITE (inout ses any, inout metas any, ino
       http ('\n</rdf:RDF>', ses);
       goto body_complete;
     }
+  if ((ret_format = 'CXML') or (ret_format = 'CXML;QRCODE'))
+    {
+      DB.DBA.SPARQL_RESULTS_CXML_WRITE(ses, metas, rset, accept, add_http_headers, status);
+      goto body_complete;
+    }
+  if (ret_format = 'CSV')
+    {
+      ret_mime := 'text/csv';
+      DB.DBA.SPARQL_RESULTS_CSV_WRITE (ses, metas, rset);
+      goto body_complete;
+    }
   ret_mime := 'application/sparql-results+xml';
   SPARQL_RSET_XML_WRITE_NS (ses);
   SPARQL_RESULTS_XML_WRITE_HEAD (ses, metas);
@@ -1547,7 +1630,7 @@ create procedure DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (
     }
   http_request_status (sprintf ('HTTP/1.1 %s %s', httpcode, httpstatus));
   http_header ('Content-Type: text/plain\r\n');
-  http (concat (state, ' Error ', msg));
+  http (concat ('Virtuoso ', state, ' Error ', msg));
   if (query is not null)
     {
       http ('\n\nSPARQL query:\n');
@@ -1667,13 +1750,81 @@ create procedure DB.DBA.rdf_find_str (in x any)
 grant execute on DB.DBA.rdf_find_str to public
 ;
 
+create procedure WS.WS.sparql_enpoint_format_opts (in can_cxml varchar, in can_qrcode varchar, in params varchar, in qr varchar)
+{
+  declare opts any;
+  declare format varchar;
+  format := get_keyword ('format', params, get_keyword ('output', params, ''));
+  qr := lower (qr);
+  if (format <> '')
+  {
+    format := (
+      case lower(format)
+        when 'json' then 'application/sparql-results+json'
+        when 'js' then 'application/javascript'
+        when 'html' then 'text/html'
+        when 'sparql' then 'application/sparql-results+xml'
+        when 'xml' then 'application/sparql-results+xml'
+        when 'rdf' then 'application/rdf+xml'
+        when 'n3' then 'text/rdf+n3'
+        when 'cxml' then 'text/cxml'
+        when 'cxml+qrcode' then 'text/cxml+qrcode'
+        when 'csv' then 'text/csv'
+        else format
+      end);
+  }
+  if (
+      regexp_match ('\\bconstruct\\b', qr) is not null
+      or
+      regexp_match ('\\bdescribe\\b', qr) is not null
+      )
+    {
+      opts := vector (
+      		vector ('text/rdf+n3', 'N3/Turtle'),
+      		vector ('application/rdf+json', 'JSON'),
+      		vector ('application/rdf+xml', 'RDF/XML'),
+      		vector ('text/plain', 'NTriples'),
+      		vector ('application/xhtml+xml', 'XHTML+RDFa'),
+      		vector ('application/atom+xml', 'ATOM+XML'),
+      		vector ('application/odata+json', 'ODATA/JSON')
+      );
+    }
+  else
+    {
+      if (not length (format)) format := 'text/html';
+      opts := vector (
+      		vector ('auto', 'Auto'),
+      		vector ('text/html', 'HTML'),
+      		vector ('application/vnd.ms-excel', 'Spreadsheet'),
+      		vector ('application/sparql-results+xml', 'XML'),
+      		vector ('application/sparql-results+json', 'JSON'),
+      		vector ('application/javascript', 'Javascript'),
+      		vector ('text/plain', 'NTriples'),
+      		vector ('application/rdf+xml', 'RDF/XML')
+		);
+    }
+  foreach (any x in opts) do
+    {
+      http(sprintf ('<option value="%V" %s>%V</option>\n',
+	  x[0], case when format = x[0] then 'selected' else '' end , x[1]));
+    }
+  http('			    <option value="text/csv">CSV</option>\n');
+  if (can_cxml)
+    {
+      http('			    <option value="text/cxml">CXML (Pivot Collection)</option>\n');
+      if (can_qrcode)
+	http('			    <option value="text/cxml+qrcode">CXML (Pivot Collection with QRcode)</option>\n');
+    }
+}
+;
+
 -- Web service endpoint.
 
 create procedure WS.WS."/!sparql/" (inout path varchar, inout params any, inout lines any)
 {
   declare query, full_query, format, should_sponge, debug, def_qry varchar;
   declare dflt_graphs, named_graphs any;
-  declare paramctr, paramcount, qry_params, maxrows, can_sponge, start_time integer;
+  declare paramctr, paramcount, qry_params, maxrows, can_sponge, can_cxml, can_pivot, can_qrcode, start_time integer;
   declare ses, content any;
   declare def_max, add_http_headers, hard_timeout, timeout, client_supports_partial_res, sp_ini, soap_ver int;
   declare http_meth, content_type, ini_dflt_graph, get_user, jsonp_callback varchar;
@@ -1681,9 +1832,26 @@ create procedure WS.WS."/!sparql/" (inout path varchar, inout params any, inout
   declare metas, rset any;
   declare accept, soap_action, user_id varchar;
   declare exec_time, exec_db_activity any;
-  -- dbg_obj_princ (path, params, lines);
+  declare __debug_mode integer;
+  declare qtxt, deadl integer;
+  declare save_mode, save_dir, fname varchar;
+  declare save_dir_id any;
+  declare help_topic varchar;
+  -- dbg_obj_princ ('===============');
+  -- dbg_obj_princ ('===============');
+  -- dbg_obj_princ ('===============');
+  -- dbg_obj_princ ('WS.WS."/!sparql/" (', path, params, lines, ')');
+  for (declare i int, i := 0; i < length (params); i := i + 2)
+    {
+      declare vn, vv varchar;
+      vn := params[i];
+      vv := params[i+1];
+      if (not (isstring (vv)) or (vv <> ''))
+        connection_set ('SPARQL_' || vn, vv);
+    }
   if (registry_get ('__sparql_endpoint_debug') = '1')
     {
+      __debug_mode := 1;
       for (declare i int, i := 0; i < length (params); i := i + 2)
         {
 	  if (isstring (params[i+1]))
@@ -1707,17 +1875,42 @@ create procedure WS.WS."/!sparql/" (inout path varchar, inout params any, inout
   dflt_graphs := vector ();
   named_graphs := vector ();
   maxrows := 1024*1024; -- More than enough for web-interface.
+  deadl := 0;
   http_meth := http_request_get ('REQUEST_METHOD');
   ini_dflt_graph := cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'DefaultGraph');
   hard_timeout := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'MaxQueryExecutionTime'), '0')) * 1000;
   timeout := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'ExecutionTimeout'), '0')) * 1000;
   client_supports_partial_res := 0;
-  def_qry := cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'DefaultQuery');
-  if (def_qry is null)
-    def_qry := 'SELECT * WHERE {?s ?p ?o}';
+  user_id := connection_get ('SPARQLUserId', 'SPARQL');
+  help_topic := get_keyword ('help', params, null);
+  if (help_topic is not null)
+    goto brief_help;
+
+  def_qry := get_keyword('qtxt', params, '');
+
+  if ('' <> def_qry)
+    qtxt := 1;
   def_max := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'ResultSetMaxRows'), '-1'));
   -- if timeout specified and it's over 1 second
-  user_id := connection_get ('SPARQLUserId', 'SPARQL');
+  save_mode := get_keyword ('save', params, null);
+  if (save_mode is not null and save_mode = 'display')
+    save_mode := null;
+  else if (save_mode is not null)
+    {
+      save_dir := coalesce ((select U_HOME from DB.DBA.SYS_USERS where U_NAME = user_id and U_DAV_ENABLE));
+      if (DAV_HIDE_ERROR (DAV_SEARCH_ID (save_dir, 'C')) is null)
+        save_dir := null;
+      else
+        {
+          save_dir := save_dir || 'saved-sparql-results/';
+          save_dir_id := DAV_SEARCH_ID (save_dir, 'C');
+          if (DAV_HIDE_ERROR (save_dir_id) is null)
+            save_dir := null;
+        }
+    }
+  fname := trim (get_keyword ('fname', params, ''));
+  if (fname = '')
+    fname := null;
   get_user := '';
   soap_ver := 0;
   soap_action := http_request_header (lines, 'SOAPAction', null, null);
@@ -1729,11 +1922,6 @@ create procedure WS.WS."/!sparql/" (inout path varchar, inout params any, inout
     soap_ver := 11;
 
   content := null;
-  can_sponge := coalesce ((select top 1 1
-      from DB.DBA.SYS_USERS as sup
-        join DB.DBA.SYS_ROLE_GRANTS as g on (sup.U_ID = g.GI_SUPER)
-        join DB.DBA.SYS_USERS as sub on (g.GI_SUB = sub.U_ID)
-      where sup.U_NAME = 'SPARQL' and sub.U_NAME = 'SPARQL_SPONGE' ), 0);
   declare exit handler for sqlstate '*' {
     DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (path, params, lines,
       '500', 'SPARQL Request Failed',
@@ -1756,8 +1944,22 @@ create procedure WS.WS."/!sparql/" (inout path varchar, inout params any, inout
       return;
     }
 
+  if (__debug_mode) dbg_printf ('%d', soap_ver);
+
+  can_sponge := coalesce ((select top 1 1
+      from DB.DBA.SYS_USERS as sup
+        join DB.DBA.SYS_ROLE_GRANTS as g on (sup.U_ID = g.GI_SUPER)
+        join DB.DBA.SYS_USERS as sub on (g.GI_SUB = sub.U_ID)
+      where sup.U_NAME = 'SPARQL' and sub.U_NAME = 'SPARQL_SPONGE' ), 0);
+  can_cxml := case (isnull (DB.DBA.VAD_CHECK_VERSION ('sparql_cxml'))) when 0 then 1 else 0 end;
+  can_pivot := case (isnull (DB.DBA.VAD_CHECK_VERSION ('PivotViewer'))) when 0 then 1 else 0 end;
+  can_qrcode := isstring (__proc_exists ('QRcode encodeString8bit', 2));
+
   paramcount := length (params);
-  if (((0 = paramcount) or ((2 = paramcount) and ('Content' = params[0]))) and soap_ver = 0)
+
+  if ((0 = paramcount) or
+      (((2 = paramcount) and ('Content' = params[0])) and soap_ver = 0) or
+      qtxt = 1)
     {
        declare redir varchar;
        redir := registry_get ('WS.WS.SPARQL_DEFAULT_REDIRECT');
@@ -1767,6 +1969,12 @@ create procedure WS.WS."/!sparql/" (inout path varchar, inout params any, inout
             http_header (sprintf ('Location: %s\r\n', redir));
             return;
          }
+      if (not qtxt)
+        {
+          def_qry := cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'DefaultQuery');
+          if (def_qry is null)
+            def_qry := 'SELECT * WHERE {?s ?p ?o}';
+        }
 http('<html xmlns="http://www.w3.org/1999/xhtml">\n');
 http('	<head>\n');
 http('		<title>Virtuoso SPARQL Query Form</title>\n');
@@ -1790,7 +1998,7 @@ http('{\n');
 http('  var query = query_obg.value; \n');
 http('  var format = query_obg.form.format;\n');
 http('\n');
-http('  if ((query.match(/construct/i) || query.match(/describe/i)) && last_format == 1) {\n');
+http('  if ((query.match(/\\bconstruct\\b/i) || query.match(/\\bdescribe\\b/i)) && last_format == 1) {\n');
 http('    for(var i = format.options.length; i > 0; i--)\n');
 http('      format.options[i] = null;');
 http('    format.options[1] = new Option(\'N3/Turtle\',\'text/rdf+n3\');\n');
@@ -1800,11 +2008,18 @@ http('    format.options[4] = new Option(\'NTriples\',\'text/plain\');\n');
 http('    format.options[5] = new Option(\'XHTML+RDFa\',\'application/xhtml+xml\');\n');
 http('    format.options[6] = new Option(\'ATOM+XML\',\'application/atom+xml\');\n');
 http('    format.options[7] = new Option(\'ODATA/JSON\',\'application/odata+json\');\n');
+http('    format.options[8] = new Option(\'CSV\',\'text/csv\');\n');
+if (can_cxml)
+  {
+    http('    format.options[9] = new Option(\'CXML (Pivot Collection)\',\'text/cxml\');\n');
+    if (can_qrcode)
+      http('    format.options[10] = new Option(\'CXML (Pivot Collection with QRcodes)\',\'text/cxml+qrcode\');\n');
+  }
 http('    format.selectedIndex = 1;\n');
 http('    last_format = 2;\n');
 http('  }\n');
 http('\n');
-http('  if (!(query.match(/construct/i) || query.match(/describe/i)) && last_format == 2) {\n');
+http('  if (!(query.match(/\\bconstruct\\b/i) || query.match(/\\bdescribe\\b/i)) && last_format == 2) {\n');
 http('    for(var i = format.options.length; i > 0; i--)\n');
 http('      format.options[i] = null;\n');
 http('    format.options[1] = new Option(\'HTML\',\'text/html\');\n');
@@ -1815,6 +2030,9 @@ http('    format.options[5] = new Option(\'Javascript\',\'application/javascript
 http('    format.options[6] = new Option(\'N3/Turtle\',\'text/rdf+n3\');\n');
 http('    format.options[7] = new Option(\'RDF/XML\',\'application/rdf+xml\');\n');
 http('    format.options[8] = new Option(\'NTriples\',\'text/plain\');\n');
+http('    format.options[9] = new Option(\'CSV\',\'text/csv\');\n');
+if (can_cxml)
+  http('    format.options[10] = new Option(\'CXML (Pivot Collection)\',\'text/cxml\');\n');
 http('    format.selectedIndex = 1;\n');
 http('    last_format = 1;\n');
 http('  }\n');
@@ -1867,37 +2085,10 @@ http('			  <br />\n');
   }
 else
   {
-declare host_ur varchar;
-      host_ur := registry_get ('URIQADefaultHost');
-
-http('			  <i>Security restrictions of this server do not allow you to retrieve remote RDF data.
-DBA may wish to grant "SPARQL_SPONGE" privilege to "SPARQL" account to remove the restriction.\n');
-http('In order to do this, please perform the following steps:</i>\n');
-http('<br />\n');
-http('1. Go to the Virtuoso Administration Conductor i.e. \n');
-if (not isstring (host_ur))
-  {
-    http('http://host:port/conductor\n');
+    http('			  <font size="-1"><i>(Security restrictions of this server do not allow you to retrieve remote RDF data.
+    Database administrator can change them, accodring to these <a href="/sparql?help=enable_sponge">instructions</a>.)</i></font>\n');
   }
-else
-  {
-    http(sprintf('http://%s/conductor\n',host_ur));
-  };
-
-http('<br />\n');
-http('2. Login as dba user\n');
-http('<br />\n');
-http('3. Go to System Admin->User Accounts->Roles\n');
-http('<br />\n');
-http('4. Click the link "Edit" for "SPARQL_SPONGE"\n');
-http('<br />\n');
-http('5. Select from the list of available user/groups "SPARQL" and click the ">>" button so to add it to the right-positioned list.\n');
-http('<br />\n');
-http('6. Click the button "Update"\n');
-http('<br />\n');
-http('7. Access again the sparql endpoint in order to be able to retrieve remote data.\n');
 http('<br /><br />\n');
-  }
 http('			  <label for="query">Query text</label>\n');
 http('			  <br />\n');
 http('			  <textarea rows="10" cols="80" name="query" id="query" onchange="format_select(this)" onkeyup="format_select(this)">'|| def_qry ||'</textarea>\n');
@@ -1906,24 +2097,61 @@ http('			  <br /><br />\n');
 --http('			  <input type="text" name="maxrows" id="maxrows"\n');
 --http(sprintf('				  	value="%d"/>',maxrows));
 --http('			  <br />\n');
-http('			  <label for="format" class="n">Display Results As:</label>\n');
+http('<label for="debug" class="n"><nobr>Rigorous check of the query:</nobr></label>');
+http(' <input name="debug" type="checkbox"' || case (debug) when '' then '' else ' checked' end || '/>');
+http('      \n');
+http('<label for="timeout" class="n"><nobr>Execution timeout, in milliseconds, values less than 1000 are ignored:</nobr></label>');
+http(' <input name="timeout" type="text"' || case (isnull (timeout)) when 0 then cast (timeout as varchar) else '' end || '/>');
+http('      \n');
+http('			  <label for="format" class="n">Format Results As:</label>\n');
 http('			  <select name="format">\n');
-http('			    <option value="auto">Auto</option>\n');
-http('			    <option value="text/html" selected="selected">HTML</option>\n');
-http('			    <option value="application/vnd.ms-excel">Spreadsheet</option>\n');
-http('			    <option value="application/sparql-results+xml">XML</option>\n');
-http('			    <option value="application/sparql-results+json">JSON</option>\n');
-http('			    <option value="application/javascript">Javascript</option>\n');
-http('			    <option value="text/plain">NTriples</option>\n');
-http('			    <option value="application/rdf+xml">RDF/XML</option>\n');
+	WS.WS.sparql_enpoint_format_opts (can_cxml, can_qrcode, params, def_qry);
+http('			  </select>\n');
+if (can_cxml)
+  {
+http('<div style="display:none">\n');
+http('      \n');
+http('			  <label for="redir_for_subjs" class="n">Style for RDF subjects:</label>\n');
+http('			  <select name="CXML_redir_for_subjs">\n');
+http('			    <option value="" selected="selected">Convert to string facets</option>\n');
+http('			    <option value="121">Make Plain Links</option>\n');
+if (can_pivot is not null)
+  http('			    <option value="LOCAL_PIVOT">Make SPARQL DESCRIBE Pivot links</option>\n');
+http('			    <option value="LOCAL_TTL">Make SPARQL DESCRIBE download links (TTL)</option>\n');
+http('			    <option value="LOCAL_CXML">Make SPARQL DESCRIBE download links (CXML)</option>\n');
+http('			  </select>\n');
+http('</div>\n');
+http('      \n');
+-- http('			  <label for="redir_for_hrefs" class="n">Style for other links:</label>\n');
+http('			  <label for="redir_for_hrefs" class="n">CXML link behavior:</label>\n');
+http('			  <select name="CXML_redir_for_hrefs">\n');
+http('			    <option value="" selected="selected">Local faceted navigation links</option>\n');
+http('			    <option value="121">External resource links</option>\n');
+if (can_pivot is not null)
+  http('			    <option value="LOCAL_PIVOT">External faceted navigation links</option>\n');
+http('			    <option value="LOCAL_TTL">External description resource (TTL)</option>\n');
+http('			    <option value="LOCAL_CXML">External description resource (CXML)</option>\n');
 http('			  </select>\n');
-http('   \n');
-http('<input name="debug" type="checkbox"' || case (debug) when '' then '' else ' checked' end || '/>');
-http(' <label for="debug" class="n"><nobr>Rigorous check of the query</nobr></label>\n');
-http('   \n');
-http('<input name="timeout" type="text"' || case (isnull (timeout)) when 0 then cast (timeout as varchar) else '' end || '/>');
-http(' <label for="timeout" class="n"><nobr>Execution timeout, in milliseconds, values less than 1000 are ignored</nobr></label>\n');
-http('   \n');
+  }
+if (not can_cxml)
+  http(' <font size="-1"><i>(The CXML output is disabled, see <a href="/sparql?help=enable_cxml">details</a>)</i></font>\n');
+else if (not can_qrcode)
+  http(' <font size="-1"><i>(The QRcode output is disabled, no "qrcode" plugin found</a>)</i></font>\n');
+http('      \n');
+if (save_dir is not null)
+{
+--http('			  <label for="save" class="n">Save Results As:</label>\n');
+http('			  <select name="save">\n');
+http('			    <option value="display" selected="selected">Display the result and not save</option>\n');
+http('			    <option value="tmpstatic">Save the result to the DAV as a temporary document with the specified name:</option>\n');
+http('			    <option value="dynamic">Save the result to the DAV and refresh it periodically with the specified name:</option>\n');
+http('			  </select>');
+http(' <input name="fname" type="text" />');
+http('      \n');
+}
+else
+  http(' <font size="-1"><i>(The result can only be sent back to browser, but not saved on the server, see <a href="/sparql?help=enable_det">details</a>)</i></font>\n');
+http('<br /><br />\n');
 http('			  <input type="submit" value="Run Query"/>');
 http(' <input type="reset" value="Reset"/>\n');
 http('			</fieldset>\n');
@@ -1933,7 +2161,7 @@ http('		<div id="footer">\n');
 http('		<div id="ft_b">\n');
 http('<a href="http://www.openlinksw.com/virtuoso/">OpenLink Virtuoso</a> version '); http(sys_stat ('st_dbms_ver')); http(', on ');
 http(sys_stat ('st_build_opsys_id')); http (sprintf (' (%s), ', host_id ()));
-http(case when sys_stat ('cl_run_local_only') = 1 then 'Single' else 'Cluster' end); http (' Edition ');
+http(case when sys_stat ('cl_run_local_only') = 1 then 'Single Server' else 'Cluster' end); http (' Edition ');
 http(case when sys_stat ('cl_run_local_only') = 0 then sprintf ('(%d server processes)', sys_stat ('cl_n_hosts')) else '' end);
 http('		</div>\n');
 http('		</div>\n');
@@ -1999,7 +2227,7 @@ http('</html>\n');
         {
 	  format := pvalue;
 	}
-      else if ('timeout' = pname)
+      else if ('timeout' = pname and length (pvalue))
         {
           declare t integer;
           t := cast (pvalue as integer) * 1000;
@@ -2084,6 +2312,9 @@ http('</html>\n');
         when 'xml' then 'application/sparql-results+xml'
         when 'rdf' then 'application/rdf+xml'
         when 'n3' then 'text/rdf+n3'
+        when 'cxml' then 'text/cxml'
+        when 'cxml+qrcode' then 'text/cxml+qrcode'
+        when 'csv' then 'text/csv'
         else format
       end);
   }
@@ -2208,31 +2439,13 @@ host_found:
     }
   else
     qry_params := vector ();
-  state := '00000';
-  metas := null;
-  rset := null;
-  if (registry_get ('__sparql_endpoint_debug') = '1')
-    dbg_printf ('query=[%s]', full_query);
+  if (save_mode is not null and save_mode <> 'display')
+    client_supports_partial_res := 0; -- because result is not sent at all in this case
 
-  declare sc_max int;
-  declare sc decimal;
-  sc_max := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'MaxQueryCostEstimationTime'), '-1'));
-  if (sc_max < 0)
-    sc_max := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'MaxExecutionTime'), '-1'));
-  if (sc_max > 0)
+  if (format <> '')
     {
-      state := '00000';
-      sc := exec_score (concat ('sparql ', full_query), state, msg);
-      if ((sc/1000) > sc_max)
-	{
-	  signal ('42000', sprintf ('The estimated execution time %d (sec) exceeds the limit of %d (sec).', sc/1000, sc_max));
-	}
+      full_query := '\n#output-format:' || format || '\n' || full_query;
     }
-
-  state := '00000';
-  metas := null;
-  rset := null;
-
   if (not client_supports_partial_res) -- partial results do not work with chunked encoding
     {
     -- No need to choose accurately if there are no variants.
@@ -2278,9 +2491,38 @@ host_found:
     {
       full_query := 'define sql:describe-mode "CBD" ' || full_query;
     }
+
+  state := '00000';
+  metas := null;
+  rset := null;
+  if (registry_get ('__sparql_endpoint_debug') = '1')
+    dbg_printf ('query=[%s]', full_query);
+
+  declare sc_max int;
+  declare sc decimal;
+  sc_max := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'MaxQueryCostEstimationTime'), '-1'));
+  if (sc_max < 0)
+    sc_max := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), 'SPARQL', 'MaxExecutionTime'), '-1'));
+  if (sc_max > 0)
+    {
+      state := '00000';
+      full_query := concat ('define sql:big-data-const 0 ', full_query);
+      sc := exec_score (concat ('sparql ', full_query), state, msg);
+      if ((sc/1000) > sc_max)
+	{
+	  signal ('42000', sprintf ('The estimated execution time %d (sec) exceeds the limit of %d (sec).', sc/1000, sc_max));
+	}
+    }
+
+  state := '00000';
+  metas := null;
+  rset := null;
+
   -- dbg_obj_princ ('accept = ', accept);
+  -- dbg_obj_princ ('format = ', format);
   -- dbg_obj_princ ('full_query = ', full_query);
   -- dbg_obj_princ ('qry_params = ', qry_params);
+  -- dbg_obj_princ ('save_mode = ', save_mode, ' save_dir = ', save_dir);
   commit work;
   if (client_supports_partial_res and (timeout > 0))
     {
@@ -2292,7 +2534,9 @@ host_found:
     {
       set TRANSACTION_TIMEOUT=hard_timeout;
     }
-  set_user_id (user_id);
+  set_user_id (user_id, 1);
+  again:
+  state := '00000';
   start_time := msec_time();
   exec ( concat ('sparql ', full_query), state, msg, qry_params, vector ('max_rows', maxrows, 'use_cache', 1), metas, rset);
   commit work;
@@ -2307,6 +2551,15 @@ host_found:
       --                 xmlelement ("complete", cplete),
       --                 xmlelement ("db-activity", db_activity ()), res[0][0]);
     }
+  else if ((not http_is_flushed ()) and state = '40001' and deadl < 6)
+    {
+      declare dt int;
+      rollback work;
+      deadl := deadl + 1;
+      dt := ((rnd (5) + 1) / 10.0) * (2 * deadl);
+      delay (dt);
+      goto again;
+    }
   else
     {
       declare state2, msg2 varchar;
@@ -2325,6 +2578,17 @@ host_found:
       return;
     }
 write_results:
+  if (save_mode is not null)
+    {
+      declare status any;
+      if ((1 = length (metas[0])) and ('aggret-0' = metas[0][0][0]))
+        {
+          DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (path, params, lines,
+            '500', 'SPARQL Request Failed',
+            full_query, '00000', 'The result of the query can not be saved to a DAV resource', format);
+          return;
+        }
+    }
   if ((1 <> length (metas[0])) or ('aggret-0' <> metas[0][0][0]))
     {
       declare status any;
@@ -2332,19 +2596,177 @@ write_results:
         status := NULL;
       else
         status := vector (state, msg, exec_time, exec_db_activity);
+      if (save_mode is not null)
+        {
+          if ((not isinteger (save_dir_id)) or not exists (select top 1 1 from WS.WS.SYS_DAV_COL where COL_ID = save_dir_id and COL_DET='DynaRes'))
+            {
+              DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (path, params, lines,
+                '500', 'SPARQL Request Failed',
+                full_query, '00000', sprintf ('To keep saved SPARQL results, the DAV directory "%.200s" should be of DAV extension type "DynaRes"', save_dir), format);
+              return;
+            }
+          if (fname is not null)
+            {
+              if (strchr (fname, '/') is not null)
+                {
+                  DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (path, params, lines,
+                    '500', 'SPARQL Request Failed',
+                    full_query, '00000', sprintf ('The specified resource name "%.200s" contains illegal characters', fname), format);
+                  return;
+                }
+            }
+          ses := string_output ();
+          add_http_headers := 0;
+        }
       if (isstring (jsonp_callback))
-        http (jsonp_callback || '(\n');
+        http (jsonp_callback || '(\n', ses);
       DB.DBA.SPARQL_RESULTS_WRITE (ses, metas, rset, accept, add_http_headers, status);
       if (isstring (jsonp_callback))
-        http (')');
+        http (')', ses);
+      if (save_mode is not null)
+        {
+          declare sparql_uid integer;
+          declare refresh_sec, ttl_sec integer;
+          declare full_uri varchar;
+          sparql_uid := (SELECT U_ID from DB.DBA.SYS_USERS where U_NAME = user_id);
+          if (fname is null)
+            {
+              if (save_mode = 'tmpstatic')
+                fname := sprintf ('%.100s - SPARQL result - made by %.100s', cast (now() as varchar), user_id);
+              else
+                fname := sprintf ('%.100s - cached and renewable SPARQL result - made by %.100s', cast (now() as varchar), user_id);
+            }
+          refresh_sec := case (save_mode) when 'tmpstatic' then null else __max (600, coalesce (hard_timeout, 1000)/100) end;
+          ttl_sec := 172800;
+          full_uri := concat ('http://', registry_get ('URIQADefaultHost'), DAV_SEARCH_PATH (save_dir_id, 'C'), fname);
+          "DynaRes_INSERT_RESOURCE" (detcol_id => save_dir_id, fname => fname,
+            owner_uid => sparql_uid,
+            refresh_seconds => refresh_sec,
+            ttl_seconds => ttl_sec,
+            mime => accept,
+            exec_stmt => 'DB.DBA.SPARQL_REFRESH_DYNARES_RESULTS (?, ?, ?, ?, ?, ?, ?)',
+            exec_params => vector (full_query, qry_params, maxrows, accept, user_id, hard_timeout, jsonp_callback),
+            exec_uname => user_id, content => ses );
+          http ('<html><head><title>The SPARQL result is successfully saved</title></head><body>');
+          http ('<h3>Done!</h3>');
+          http ('<p>The SPARQL result is successfully saved in DAV storage as <a href="');
+          http_value (full_uri);
+          http ('">');
+          http_value (full_uri);
+          http ('</a></p>');
+          if (refresh_sec is not null)
+            http (sprintf ('<p>The content of the linked resource will be re-calculated on demand, and the result will be cached for %d minutes.</p>', refresh_sec/60));
+          if (ttl_sec is not null)
+            http (sprintf ('<p>The link will stay valid for %d days. To preserve the referenced document for future use, copy it to some other location before expiration.</p>', ttl_sec/(60*60*24)));
+          if (accept <> 'text/html')
+            http (sprintf ('<p>The resource MIME type is "%s". This type will be reported to the browser when you click on the link.
+If the browser is unable to open the link itself it can prompt for action like lauching an additional program.
+The program may let you to edit the loaded resource, in this case save the changed version should be saved to a different place, so use "Save As" command, not plain "Save".</p>', accept));
+          http ('</body></html>');
+        }
     }
+  else
+    {
+      if (save_mode is not null)
+        {
+          DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (path, params, lines,
+            '500', 'SPARQL Request Failed',
+            full_query, '00000', 'The result of the query can not be saved to a DAV resource', format);
+          return;
+        }
+    }
+return;
+
+brief_help:
+  http ('<html><head><title>SPARQL Web Service Endpoint | Quick Help</title></head><body>');
+  if (help_topic='enable_sponge')
+    {
+      declare host_ur varchar; host_ur := registry_get ('URIQADefaultHost');
+      http('<h3>How To Enable Sponge?</h3>
+      <p>When a new Virtuoso server is installed, default security restrictions do not allow SPARQL endpoint users to retrieve remote RDF data.
+      To remove the restriction, DBA should grant "SPARQL_SPONGE" privilege to "SPARQL" account.
+      If you are the administrator, you can perform the following steps:</p>\n');
+      http('<ol>\n');
+      http('<li>Go to the Virtuoso Administration Conductor i.e. \n');
+      if (not isstring (host_ur))
+          http('http://host:port/conductor .');
+      else
+          http( sprintf('<a href="http://%s/conductor">http://%s/conductor</a>.', host_ur, host_ur));
+      http('</li>\n<li>Login as dba user.');
+      http('</li>\n<li>Go to System Admin->User Accounts->Roles\n');
+      http('</li>\n<li>Click the link "Edit" for "SPARQL_SPONGE"\n');
+      http('</li>\n<li>Select from the list of available user/groups "SPARQL" and click the ">>" button so to add it to the right-positioned list.\n');
+      http('</li>\n<li>Click the button "Update"\n');
+      http('</li>\n<li>Access again the sparql endpoint in order to be able to retrieve remote data.\n');
+      http('</li></ol>\n');
+    }
+  else if (help_topic='enable_cxml')
+    {
+      http('<h3>How To Enable CXML Support</h3>');
+      http('<p>CXML is data exchange format for so-called "faceted view". It can be displayed by programs like Microsoft Pivot.
+For best results, the result of the query should contain links to images associated with described data and follow some rules, described in the User's Guide.</p>
+<p>This feature is supported by combination of three components:</p>\n');
+      http('<ol>\n');
+      http('<li>Virtuoso Universal Server (Virtuoso Open Source does not contain some required functions)\n');
+      http('</li>\n<li>ImageMagick plugin of version 0.6 or newer\n');
+      http('</li>\n<li>sparql_cxml VAD package (it will in turn require "RDF mappers" package)\n');
+      http('</li></ol>\n');
+      http('<p>As soon as all components are installed, SPARQL web service endpoint will contain "CXML" option to the list of available formats.</p>\n');
+    }
+  else if (help_topic='enable_det')
+    {
+      declare host_ur varchar; host_ur := registry_get ('URIQADefaultHost');
+      http('<h3>How To Let the SPARQL Endpoint Save Results In DAV?</h3>
+<p>By default, SPARQL endpoint can only sent the result back to the client. That can be inconvenient if the result should be accessible for programs like file managers and archivers.</p>
+<p>The solution is to let the endpoint create "dynamic"resources in DAV storage of the Virtuoso server. A DAV client, e.g., the boilt-in client of Windows Explorer, can connect to that storage and access these resources as if they are plain local files.</p>
+<p>If you are the administrator and want to enable this feature, you can perform the following steps:</p>\n');
+      http('<ol>\n');
+      http( sprintf('<li>This web service endpoint runs under "%.100s" account. This user should have an access to DAV (U_DAV_ENABLE=1 in DB.DBA.SYS_USERS)\n', user_id));
+      http( sprintf('</li>\n<li>The DAV home directory (e.g., <a href="/DAV/home/%.100s/">/DAV/home/%.100s/</a>) should be created and the path to it should be remembered in DB.DBA.SYS_USERS (U_HOME field; do not forget the leading and the trailing slash chars).\n', user_id, user_id));
+      http( sprintf('</li>\n<li>The home directory should contain a subdirectory named "saved-sparql-results", and the subdirectory should be of "DynaRes" DAV Extension Type.'));
+      http('</li></ol>\n');
+      http('<p>As soon as the appropriated directory exists, SPARQL web service endpoint will show additional controls to choose how to save results.</p>\n');
+    }
+  else if (help_topic='enable_det')
+    {
+      DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (path, params, lines,
+        '500', 'Request Failed',
+        'Invalid help topic', format);
+    }
+  http('<p><font size="-1">To close this help, press the "back" button of the browser.</font></p>\n');
 }
 ;
 
 registry_set ('/!sparql/', 'no_vsp_recompile')
 ;
 
-
+create procedure DB.DBA.SPARQL_REFRESH_DYNARES_RESULTS (in full_query varchar, in qry_params any, in maxrows integer, in accept varchar, in user_id varchar, in hard_timeout integer, in jsonp_callback any)
+{
+  -- dbg_obj_princ ('DB.DBA.SPARQL_REFRESH_DYNARES_RESULTS (', full_query, qry_params, maxrows, accept, user_id, hard_timeout, ')');
+  declare state, msg varchar;
+  declare metas, rset any;
+  declare RES any;
+  declare ses any;
+  result_names (RES);
+  set_user_id (user_id, 1);
+  if (hard_timeout >= 1000)
+    set TRANSACTION_TIMEOUT = hard_timeout;
+  set_user_id (user_id);
+  state := '00000';
+  exec ( concat ('sparql ', full_query), state, msg, qry_params, vector ('max_rows', maxrows, 'use_cache', 1), metas, rset);
+  commit work;
+  -- dbg_obj_princ ('exec metas=', metas, ', state=', state, ', msg=', msg);
+  if (state <> '00000')
+    signal (state, msg);
+  ses := string_output ();
+  if (isstring (jsonp_callback))
+    http (jsonp_callback || '(\n', ses);
+  DB.DBA.SPARQL_RESULTS_WRITE (ses, metas, rset, accept, 0, null);
+  if (isstring (jsonp_callback))
+    http (')', ses);
+  result (ses);
+}
+;
 
 -- SPARUL manipulation by remote resources.
 
@@ -2483,6 +2905,9 @@ DB.DBA.http_rq_file_handler (in content any, in params any, in lines any, inout
       when 'xml' then 'application/sparql-results+xml'
       when 'rdf' then 'application/rdf+xml'
       when 'n3' then 'text/rdf+n3'
+      when 'cxml' then 'text/cxml'
+      when 'cxml+qrcode' then 'text/cxml+qrcode'
+      when 'csv' then 'text/csv'
       else _format
       end);
     }
@@ -2498,7 +2923,10 @@ DB.DBA.http_rq_file_handler (in content any, in params any, in lines any, inout
       strcasestr (accept, 'application/rdf+xml') is not null or
       strcasestr (accept, 'application/javascript') is not null or
       strcasestr (accept, 'application/soap+xml') is not null or
-      strcasestr (accept, 'application/rdf+turtle') is not null
+      strcasestr (accept, 'application/rdf+turtle') is not null or
+      strcasestr (accept, 'text/cxml') is not null or
+      strcasestr (accept, 'text/cxml+qrcode') is not null or
+      strcasestr (accept, 'text/csv') is not null
      )
     {
       http_request_status ('HTTP/1.1 303 See Other');
@@ -2523,7 +2951,10 @@ create procedure DB.DBA.RDF_GRANT_SPARQL_IO ()
     'grant execute on DB.DBA.SPARQL_REXEC_TO_ARRAY to SPARQL_SELECT',
     'grant execute on DB.DBA.SPARQL_REXEC_WITH_META to SPARQL_SELECT',
     'grant execute on WS.WS."/!sparql/" to "SPARQL"',
-    'grant execute on DB.DBA.SPARQL_ROUTE_DICT_CONTENT_DAV to SPARQL_UPDATE' );
+    'grant execute on DB.DBA.SPARQL_REFRESH_DYNARES_RESULTS to "SPARQL"',
+    'grant execute on DB.DBA.SPARQL_ROUTE_DICT_CONTENT_DAV to SPARQL_UPDATE',
+    'grant execute on DB.DBA.SPARQL_SINV_IMP to SPARQL_SPONGE',
+    'grant select on DB.DBA.SPARQL_SINV_2 to SPARQL_SPONGE' );
   foreach (varchar cmd in cmds) do
     {
       exec (cmd, state, msg);
diff --git a/libsrc/Wi/sparql_l.c b/libsrc/Wi/sparql_l.c
index 45e9434..9a79756 100644
--- a/libsrc/Wi/sparql_l.c
+++ b/libsrc/Wi/sparql_l.c
@@ -380,8 +380,8 @@ static void yy_fatal_error (yyconst char msg[]  );
 	*yy_cp = '\0'; \
 	(yy_c_buf_p) = yy_cp;
 
-#define YY_NUM_RULES 221
-#define YY_END_OF_BUFFER 222
+#define YY_NUM_RULES 227
+#define YY_END_OF_BUFFER 228
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -389,102 +389,105 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[857] =
+static yyconst flex_int16_t yy_accept[882] =
     {   0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,  222,  221,  220,  212,
-      210,  210,    3,  175,  211,  220,  220,  174,  137,  138,
-       19,   15,    6,   13,    7,   18,  158,  145,   17,   12,
-        8,   10,  220,  220,  154,  154,  154,  154,  154,  154,
-      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
-      154,  154,  154,  154,  154,  154,  141,  142,  220,  154,
-        2,   21,  139,  220,  140,  220,  180,  178,  178,  176,
-      182,  181,  179,  179,  177,  183,  168,  166,  166,  172,
-
-      170,  169,  167,  167,  173,  171,  217,  212,  210,  211,
-      184,  217,  219,  212,  210,  192,  211,  191,  188,  187,
-      218,  212,  210,  211,  218,  193,  193,  193,  203,  201,
-      196,  197,  200,  221,  194,  195,  216,  216,  216,  216,
-      209,  205,  205,  204,  221,  212,  210,   14,    0,    0,
-      161,  211,  210,  210,  148,    0,  152,    1,    0,  161,
-       20,   16,  159,  159,  158,    0,  144,    0,   11,  143,
-        9,  147,    0,  151,  153,    0,    0,  154,  145,  154,
-      154,   23,  154,  154,  154,  154,   30,  154,  154,  154,
-      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
-
-      154,  154,  154,   55,  154,  154,  154,  154,  154,  154,
-      154,  154,  154,  154,  154,  154,  154,   82,  154,  136,
-      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
-      154,  154,  154,  154,  154,  154,  154,  154,    5,    0,
-      154,    0,    4,    0,  180,    0,  178,    0,    0,  181,
-        0,  179,    0,    0,  168,    0,    0,  166,  166,  166,
-        0,    0,    0,  169,    0,    0,  167,  167,  167,    0,
-        0,    0,    0,    0,    0,  186,  193,  193,  203,  199,
-      213,  216,    0,  215,  214,  209,  205,  208,  207,  206,
-      206,  161,  161,  163,  210,  148,    0,    0,  150,  150,
-
-      162,  159,    0,  160,  144,    0,  147,    0,    0,  149,
-      149,    0,    0,    0,  155,  154,  135,   24,   25,   26,
-      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
-      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
-      154,  154,  154,  154,   54,  154,  154,  154,  154,   60,
-      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
-      154,   73,   74,   75,  154,  154,   78,   79,  154,  154,
-      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
-      154,  154,  154,  154,  154,  154,  107,  154,  110,  154,
-      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
-
-      154,  154,  154,  154,  154,  131,    0,  155,  146,    0,
-        0,    0,    0,    0,  164,    0,    0,    0,  165,    0,
-        0,    0,  190,  189,  202,  199,  198,  198,  208,  207,
-      206,  206,  206,    0,  150,    0,  150,  150,    0,  150,
-        0,  150,    0,  149,    0,  149,  149,    0,  149,    0,
-      149,  153,    0,  155,    0,  156,  155,  154,   27,  154,
-      154,  154,  154,  154,  154,  154,   36,  154,  154,  154,
-      154,   42,  154,   45,  154,  154,  154,   49,  154,  154,
-      154,  154,  154,  154,  154,  154,   59,  154,  154,  154,
-      154,  154,   66,   68,  154,  154,   71,   72,  154,  154,
-
-       80,  154,  154,  154,  154,  154,  154,  154,   90,  154,
-      154,  154,  154,  154,  154,  154,  154,  105,  154,  154,
-      154,  154,  154,  130,  154,  127,  154,  154,  154,  154,
-      154,  118,  154,  154,  154,  154,  154,  154,  154,  154,
-      154,  156,  155,  146,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,  198,  198,    0,  150,  150,    0,
-      150,    0,    0,  149,  149,    0,  149,    0,    0,  156,
-        0,  156,   22,  154,   29,   31,   32,  154,   34,  154,
-      154,  154,  154,  154,   41,  154,  154,  154,   47,  154,
-      154,   51,   52,  154,  154,   56,  154,  154,  154,   62,
-
-      154,   64,   65,  154,   69,  154,  154,   77,  154,  154,
-      154,  154,   87,  154,  154,  154,   91,  154,  154,  154,
-       94,  154,  154,  154,  154,  154,  154,  154,  154,  154,
-      154,  154,  154,  154,  154,  154,  119,  120,  154,  121,
-      154,  154,  128,  129,  133,    0,  156,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,  150,  150,    0,
-      149,  149,    0,  157,  154,  154,   35,  154,  154,   39,
-       40,  154,  154,  154,   48,  154,   53,  154,  154,   58,
-      154,  154,  154,  154,   76,   81,  154,   84,   86,  154,
-       89,  154,  154,  154,  154,  154,  102,  154,  104,  134,
-
-      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
-      154,  154,  154,  154,  125,  157,    0,    0,    0,    0,
-        0,    0,  157,  157,  154,  154,  154,   38,  154,  154,
-      154,  154,  154,  154,   61,  154,  154,   70,   83,  154,
-      154,   92,   93,  154,   96,  154,  103,  106,  154,  109,
-      154,  154,  154,  154,  154,  154,  154,  154,  154,  154,
-      154,  157,    0,    0,    0,    0,    0,  154,  154,   37,
-       43,   44,  154,   50,  154,  154,  154,  154,   85,  154,
-      101,  154,  154,  108,  154,  154,  154,  154,  154,  154,
-      116,  154,  154,  154,  154,    0,    0,    0,    0,  185,
-
-       28,   33,   46,  154,   57,   63,  154,   88,   97,   98,
-       99,  154,  154,  154,  154,  154,  154,  154,  154,  154,
-      154,  154,    0,    0,    0,    0,  132,  154,  154,  154,
-      154,  126,  154,  154,  114,  115,  117,  154,  123,  154,
-       67,  100,   95,  154,  154,  113,  122,  154,  111,  154,
-      154,  112,  154,  154,  124,    0
+        0,    0,    0,    0,    0,    0,  228,  227,  226,  218,
+      216,  216,    3,  181,  217,  226,  226,  180,  143,  144,
+       19,   15,    6,   13,    7,   18,  164,  151,   17,   12,
+        8,   10,  226,  226,  160,  160,  160,  160,  160,  160,
+      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,
+      160,  160,  160,  160,  160,  160,  147,  148,  226,  160,
+        2,   21,  145,  226,  146,  226,  186,  184,  184,  182,
+      188,  187,  185,  185,  183,  189,  174,  172,  172,  178,
+
+      176,  175,  173,  173,  179,  177,  223,  218,  216,  217,
+      190,  223,  225,  218,  216,  198,  217,  197,  194,  193,
+      224,  218,  216,  217,  224,  199,  199,  199,  209,  207,
+      202,  203,  206,  227,  200,  201,  222,  222,  222,  222,
+      215,  211,  211,  210,  227,  218,  216,   14,    0,    0,
+      167,  217,  216,  216,  154,    0,  158,    1,    0,  167,
+       20,   16,  165,  165,  164,    0,  150,    0,   11,  149,
+        9,  153,    0,  157,  159,    0,    0,  160,  151,  160,
+      160,   23,  160,  160,  160,  160,   31,  160,  160,  160,
+      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,
+
+      160,  160,  160,   57,  160,  160,  160,  160,  160,  160,
+      160,  160,  160,  160,  160,  160,  160,   86,  160,  142,
+      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,
+      160,  160,  160,  160,  160,  160,  160,  160,  160,    5,
+        0,  160,    0,    4,    0,  186,    0,  184,    0,    0,
+      187,    0,  185,    0,    0,  174,    0,    0,  172,  172,
+      172,    0,    0,    0,  175,    0,    0,  173,  173,  173,
+        0,    0,    0,    0,    0,    0,  192,  199,  199,  209,
+      205,  219,  222,    0,  221,  220,  215,  211,  214,  213,
+      212,  212,  167,  167,  169,  216,  154,    0,    0,  156,
+
+      156,  168,  165,    0,  166,  150,    0,  153,    0,    0,
+      155,  155,    0,    0,    0,  161,  160,  141,   24,   25,
+       26,  160,  160,  160,  160,  160,  160,  160,  160,  160,
+      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,
+      160,  160,  160,  160,  160,  160,  160,   56,  160,  160,
+      160,  160,   62,  160,  160,  160,  160,  160,  160,  160,
+      160,  160,  160,  160,   75,   76,   77,  160,  160,   81,
+       82,  160,  160,  160,  160,  160,  160,  160,  160,  160,
+      160,  160,  160,  160,  160,  160,  160,  160,  160,  111,
+      160,  114,  160,  160,  160,  160,  160,  160,  160,  160,
+
+      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,
+      137,    0,  161,  152,    0,    0,    0,    0,    0,  170,
+        0,    0,    0,  171,    0,    0,    0,  196,  195,  208,
+      205,  204,  204,  214,  213,  212,  212,  212,    0,  156,
+        0,  156,  156,    0,  156,    0,  156,    0,  155,    0,
+      155,  155,    0,  155,    0,  155,  159,    0,  161,    0,
+      162,  161,  160,   27,  160,  160,  160,  160,  160,  160,
+      160,  160,   37,  160,  160,  160,  160,   43,  160,   46,
+      160,  160,  160,  160,   51,  160,  160,  160,  160,  160,
+      160,  160,  160,   61,  160,  160,  160,  160,  160,   68,
+
+       70,  160,  160,   73,   74,  160,  160,  160,    0,   84,
+      160,  160,  160,  160,  160,  160,  160,   94,  160,  160,
+      160,  160,  160,  160,  160,  160,  109,  160,  160,  160,
+      160,  160,  136,  160,  131,  160,  160,  160,  160,  160,
+      122,  160,  160,  160,  160,  160,  160,  160,  160,  160,
+      160,  135,  162,  161,  152,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,  204,  204,    0,  156,  156,
+        0,  156,    0,    0,  155,  155,    0,  155,    0,    0,
+      162,    0,  162,   22,  160,  160,   30,   32,   33,  160,
+       35,  160,  160,  160,  160,  160,   42,  160,  160,  160,
+
+      160,   49,  160,  160,   53,   54,  160,  160,   58,  160,
+      160,  160,   64,  160,   66,   67,  160,   71,  160,   78,
+      160,   80,    0,  160,  160,  160,  160,   91,  160,  160,
+      160,   95,  160,  160,  160,   98,  160,  160,  160,  160,
+      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,
+      160,  123,  124,  160,  125,  160,  160,  160,  133,  134,
+      139,    0,  162,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,  156,  156,    0,  155,  155,    0,  163,
+      160,  160,  160,   36,  160,  160,   40,   41,  160,  160,
+      160,   48,   50,  160,   55,  160,  160,   60,  160,  160,
+
+      160,  160,   79,    0,   85,  160,   88,   90,  160,   93,
+      160,  160,  160,  160,  160,  106,  160,  108,  140,  160,
+      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,
+      160,  160,  160,  129,  160,  163,    0,    0,    0,    0,
+        0,    0,  163,  163,  160,  160,  160,  160,   39,  160,
+      160,  160,  160,  160,  160,   63,  160,  160,   72,    0,
+       87,  160,  160,   96,   97,  160,  100,  160,  107,  110,
+      160,  113,  160,  160,  160,  160,  160,  160,  160,  160,
+      160,  160,  160,  132,  163,    0,    0,    0,    0,    0,
+      160,   28,  160,   38,   44,   45,  160,   52,  160,  160,
+
+      160,  160,   83,   89,  160,  105,  160,  160,  112,  160,
+      160,  160,  160,  160,  160,  120,  160,  160,  160,  160,
+        0,    0,    0,    0,  191,   29,   34,   47,  160,   59,
+       65,  160,   92,  101,  102,  103,  160,  160,  160,  160,
+      160,  160,  160,  160,  160,  160,  160,    0,    0,    0,
+        0,  138,  160,  160,  160,  160,  130,  160,  160,  118,
+      119,  121,  160,  127,  160,   69,  104,   99,  160,  160,
+      117,  126,  160,  115,  160,  160,  116,  160,  160,  128,
+        0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -532,227 +535,235 @@ static yyconst flex_int32_t yy_meta[90] =
        14,   14,   14,   14,   14,   17,    1,   17,   18
     } ;
 
-static yyconst flex_int16_t yy_base[967] =
+static yyconst flex_int16_t yy_base[992] =
     {   0,
         0,    0,    0,    0,   87,   89,   91,   98,  102,  104,
       106,  113,  118,  124,  160,  171,  131,  182,  187,  204,
-      137,  199,  216,  221,    0,    0,  895, 7366, 7366,  892,
-      889,  884,  861,  133,  120,  122,  873,  870, 7366, 7366,
-      853,  847, 7366, 7366,  848, 7366,  177,    0, 7366,  145,
-     7366,  840,  124,    0,  213,  227,  243,  291,  221,  290,
+      137,  199,  216,  221,    0,    0,  944, 7544, 7544,  932,
+      927,  918,  890,  133,  120,  122,  902,  899, 7544, 7544,
+      883,  879, 7544, 7544,  881, 7544,  177,    0, 7544,  145,
+     7544,  872,  124,    0,  213,  227,  243,  291,  221,  290,
       260,  312,  385,  232,  311,  324,  345,  394,  344,  417,
-      424,  486,  408,  463,  307,  472, 7366, 7366,  806,   78,
-     7366,  478, 7366,  766, 7366,   93,  796,  845,  843, 7366,
-      514,  787,  836,  798, 7366,  552,   92,  795,  795,  225,
-
-      575,  146,  793,  793,  293,  586, 7366,  767,  765,  176,
-     7366,  158, 7366,  765,  763,  759,  262,  749, 7366, 7366,
-     7366,  757,  755,  264,  153,    0,  752,  752,    0, 7366,
-     7366, 7366,  737,  739, 7366, 7366,  737, 7366,  221,  707,
-        0,  715,  715,  705,  303,  686, 7366, 7366,  208,  676,
-      170,  340,  675,  342,    0,  662, 7366, 7366,  667,  664,
-     7366, 7366,  358,  368,  459,  283,  656,  648,  647, 7366,
-     7366,    0,  742, 7366,  654,  111,  525,  365,    0,  581,
-      484,  588,  811,  598,  813,  818,  443,  820,  826,  837,
-      839,  858,  844,  871,  913,  893,  899,  923,  931,  941,
-
-      668,  936,  956,  963,  969, 1042, 1006,  996, 1036, 1083,
-     1056, 1081, 1044, 1088, 1071, 1118, 1125, 1090, 1120, 1130,
-     1163, 1157, 1169, 1184, 1194, 1204, 1216, 1221, 1243, 1273,
-     1253, 1278, 1290, 1350, 1304, 1310, 1331, 1298, 7366,  252,
-      651,    0, 7366,  313,  609, 1378, 7366, 1416, 1432,  607,
-     1460, 7366, 1498, 1514,  302,  388, 1542, 7366,  657,  654,
-      952, 1580, 1596,  309,  369, 1624, 7366,  649,  646,  443,
-     1662, 1678,  205,  639,  632, 7366,    0,    0,  636,  406,
-     7366,  625,  624, 7366, 7366,    0, 7366,    0,    0,  633,
-      624,  606, 7366, 7366,  618,    0,  615,  227, 1726, 1791,
-
-     7366,  462,  600,  591,  592,  590,    0,  598,  371, 1827,
-     1892,    0,  597,  744,  663, 1336, 1065, 1223, 1318, 1338,
-     1468, 1492, 1481, 1574, 1414, 1656, 1565, 1929, 1931, 1937,
-     1632, 1648, 1945, 1943, 1950, 1959, 1964, 1966, 1466, 1978,
-     1985, 1983, 2020, 2006, 1384, 2033, 2041, 2059, 1994, 1547,
-     2064, 2069, 2075, 2081, 2083, 2099, 2119, 2089, 2145, 2121,
-     2150, 1630, 1696, 1797, 2138, 2158, 1897, 2168, 2174, 2179,
-     2200, 2184, 2198, 2207, 2238, 2232, 2258, 2265, 2267, 2215,
-     2276, 2285, 2293, 2299, 2315, 2331, 2320, 2350, 2341, 2352,
-     2368, 2376, 2378, 2384, 2404, 2411, 2417, 2437, 2443, 2427,
-
-     2459, 2470, 2478, 2497, 2491, 2465,  595,  578,  572, 2513,
-     2533, 2559, 2579,  534, 7366, 2585, 2605,  533, 7366, 2631,
-     2651,  373, 7366, 7366, 7366,  483,  581,  504,    0,    0,
-        0,    0,    0,  578,  565,  576,  560,    0,  572,  559,
-      555, 2699,  566,  550,  558,  537,    0,  549,  522,  516,
-     2735,  513,  523,  493,  494, 2513, 2539, 2609, 2564, 2772,
-     2774, 2779, 2790, 2792, 2797, 2799, 2805, 2810, 2812, 2830,
-     2874, 2838, 2885, 2583, 2824, 2848, 2879, 2705, 2899, 2905,
-     2907, 2913, 2924, 2915, 2930, 2938, 2940, 2952, 2972, 2974,
-     2993, 2988, 2999, 3013, 3015, 3028, 3026, 3033, 3047, 3058,
-
-     3049, 3066, 3080, 3082, 3074, 3089, 3106, 3108, 3114, 3132,
-     3139, 3147, 3162, 3167, 3183, 3189, 3194, 3209, 3222, 3216,
-     3229, 3237, 3242, 3244, 3264, 3269, 3274, 3295, 3276, 3302,
-     3304, 3311, 3329, 3334, 3339, 3361, 3350, 3369, 3378, 3388,
-     3393,  474,  457,  455,  452, 3432, 3455, 3470, 3493, 3508,
-     3531, 3546, 3569,  442, 7366,  463,  422, 7366,    0,  411,
-        0,  268,  408, 7366,    0,  388,    0,  335,  363,  275,
-      853, 3417, 3425, 3565, 3438, 3453, 3455, 3596, 3491, 3603,
-     3567, 3619, 3625, 3631, 3529, 3643, 3653, 3651, 3659, 3670,
-     3665, 3681, 3686, 3700, 3688, 3695, 3718, 3720, 3728, 3734,
-
-     3740, 3747, 3762, 3770, 3775, 3785, 3794, 3801, 3803, 3814,
-     3816, 3821, 3823, 3831, 3848, 3836, 3854, 3863, 3890, 3868,
-     3880, 3897, 3909, 3928, 3930, 3938, 3946, 3960, 3966, 3974,
-     3979, 3984, 3991, 4008, 4013, 4015, 4023, 4035, 4044, 4060,
-     4066, 4071, 4077, 4082, 4092,  250,  204, 4144, 4158, 4164,
-     4182, 4220, 4234, 4240, 4258,  462,  190, 7366,    0,  159,
-     7366,    0,  152, 4109, 4111, 4258, 4127, 4218, 4292, 4141,
-     4238, 4307, 4312, 4314, 4294, 4323, 4328, 4334, 4336, 4341,
-     4352, 4343, 4358, 4368, 4374, 4393, 4398, 4410, 4417, 4425,
-     4431, 4433, 4438, 4448, 4454, 4462, 4471, 4477, 4486, 4494,
-
-     4513, 4500, 4518, 4531, 4537, 4550, 4569, 4574, 4591, 4583,
-     4604, 4615, 4620, 4627, 4629,    0, 4659, 4682, 4697, 4720,
-      491,  148, 7366, 4643, 4665, 4746, 4754, 4652, 4756, 4748,
-     4772, 4781, 4779, 4786, 4716, 4796, 4811, 4813, 4821, 4841,
-     4834, 4846, 4848, 4861, 4866, 4871, 4873, 4878, 4888, 4897,
-     4899, 4904, 4911, 4926, 4928, 4958, 4935, 4973, 4966, 4947,
-     4986,    0, 5028, 5048, 5054, 5074,  492, 4981, 5078, 5009,
-     5103, 5105, 5110, 5112, 5123, 5129, 5131, 5141, 5147, 5163,
-     5154, 5179, 5186, 5161, 5188, 5193, 5198, 5211, 5216, 5223,
-     5242, 5244, 5252, 5263, 5268, 5306, 5330, 5344, 5368, 7366,
-
-     5276, 5289, 5298, 5393, 5300, 5326, 5395, 5362, 5364, 5400,
-     5402, 5418, 5425, 5423, 5431, 5448, 5450, 5458, 5460, 5477,
-     5482, 5498, 5532, 5550, 5570, 5588, 5500, 5608, 5533, 5619,
-     5567, 5515, 5606, 5621, 5555, 5640, 5642, 5647, 5652, 5654,
-     5659, 5664, 5666, 5683, 5688, 5671, 5696, 5702, 5716, 5728,
-     5721, 5733, 5740, 5746, 5748, 7366, 5837, 5855, 5873, 5891,
-     5909, 5927, 5945, 5963, 5981, 5999, 6017, 6035, 6053, 6061,
-     6077, 6085, 6100, 6108,  104, 6117, 6127, 6136, 6154, 6172,
-     6190, 6208, 6226, 6244, 6262, 6280, 6298, 6316, 6334, 6342,
-     6360, 6371, 6386, 6394,  443, 6408, 6419, 6427, 6441, 6449,
-
-     6455, 6473, 6491, 6509, 6527, 6545, 6563, 6581, 6599, 6617,
-     6635, 6653, 6671, 6689, 6697, 6715, 6729, 6738, 6746, 6764,
-     6778,  393, 6794, 6808, 6819, 6830, 6844, 6852, 6861, 6879,
-     6897, 6915, 6933, 6951, 6969, 6987, 7005, 7023, 7031, 7043,
-     7051, 7067, 7085, 7093, 7105, 7113, 7122, 7136, 7154, 7165,
-     7176, 7187, 7197, 7205, 7214, 7232, 7240, 7252, 7268, 7276,
-     7288, 7300, 7314, 7330, 7341, 7349
+      424,  486,  408,  463,  307,  472, 7544, 7544,  837,   78,
+     7544,  478, 7544,  798, 7544,   93,  828,  877,  875, 7544,
+      514,  818,  866,  862, 7544,  552,   92,  860,  860,  225,
+
+      575,  146,  857,  852,  293,  586, 7544,  851,  848,  176,
+     7544,  158, 7544,  847,  843,  836,  262,  829, 7544, 7544,
+     7544,  799,  796,  264,  153,    0,  794,  794,    0, 7544,
+     7544, 7544,  779,  755, 7544, 7544,  754, 7544,  221,  753,
+        0,  762,  762,  749,  303,  757, 7544, 7544,  208,  752,
+      170,  341,  752,  353,    0,  662, 7544, 7544,  744,  743,
+     7544, 7544,  314,  368,  459,  283,  735,  726,  696, 7544,
+     7544,    0,  742, 7544,  702,  111,  525,  365,    0,  581,
+      484,  588,  811,  598,  813,  818,  443,  820,  826,  839,
+      841,  872,  851,  874,  905,  915,  921,  934,  941,  947,
+
+      668,  953,  960,  966,  984, 1057,  998, 1020, 1044, 1089,
+     1062, 1067, 1096, 1030, 1094, 1103, 1126, 1105, 1132, 1140,
+     1148, 1170, 1179, 1184, 1172, 1199, 1201, 1214, 1232, 1246,
+      858, 1234, 1274, 1334, 1279, 1248, 1293, 1311, 1321, 7544,
+      252,  700,    0, 7544,  373,  661, 1366, 7544, 1404, 1420,
+      633, 1448, 7544, 1486, 1502,  388,  396, 1530, 7544,  678,
+      676, 1021, 1568, 1584,  309,  335, 1612, 7544,  674,  672,
+      443, 1650, 1666,  205,  668,  662, 7544,    0,    0,  666,
+      406, 7544,  657,  655, 7544, 7544,    0, 7544,    0,    0,
+      660,  659,  643, 7544, 7544,  653,    0,  647,  227, 1714,
+
+     1779, 7544,  462,  629,  625,  625,  624,    0,  633,  408,
+     1815, 1880,    0,  632,  744,  663, 1327, 1334, 1366, 1368,
+     1401, 1456, 1480, 1562, 1535, 1644, 1917, 1919, 1553, 1925,
+     1930, 1939, 1620, 1636, 1951, 1945, 1961, 1966, 1999, 2005,
+     1953, 1454, 2031, 2026, 1977, 2042, 2050, 1618, 2055, 2063,
+     2068, 2086, 1684, 2091, 2081, 2100, 2117, 2124, 2129, 2155,
+     2161, 2167, 2173, 2175, 1785, 2138, 2193, 2199, 2191, 2204,
+     2228, 2230, 2236, 2257, 2216, 2274, 2290, 2281, 2242, 2292,
+     2309, 2311, 2316, 2330, 2347, 2356, 2324, 2365, 2390, 2374,
+     2397, 2404, 2412, 2423, 2431, 2439, 2429, 2456, 2444, 2470,
+
+     2490, 2498, 2479, 2519, 2525, 2531, 2533, 2544, 2553, 2559,
+     2565,  631,  609,  606, 2607, 2627, 2633, 2653,  567, 7544,
+     2679, 2699,  566, 7544, 2705, 2725,  373, 7544, 7544, 7544,
+      483,  616,  504,    0,    0,    0,    0,    0,  605,  583,
+      584,  568,    0,  579,  566,  562, 2773,  576,  537,  533,
+      517,    0,  524,  511,  500, 2809,  494,  494,  474,  469,
+     2585, 2611, 2703, 2658, 2846, 2848, 2854, 2856, 2861, 2872,
+     2874, 2879, 2886, 2892, 2906, 2894, 2911, 2939, 2931, 2684,
+     2953, 2968, 2970, 2975, 2779, 2988, 2996, 3001, 3008, 3019,
+     3033, 3035, 3044, 3006, 3051, 3057, 3070, 3082, 3084, 3089,
+
+     3065, 3109, 3117, 3124, 3146, 3151, 3158, 3164,  538, 3166,
+     3172, 3182, 3187, 3194, 3200, 3207, 3220, 3231, 3242, 3249,
+     3263, 3269, 3261, 3277, 3285, 3294, 3296, 3316, 3301, 3324,
+     3338, 3347, 3326, 3354, 3359, 3371, 3376, 3386, 3402, 3423,
+     3391, 3434, 3440, 3408, 3429, 3450, 3413, 3461, 3469, 3477,
+     3482, 3498,  452,  439,  406,  404, 3531, 3545, 3552, 3569,
+     3591, 3607, 3629, 3645,  442, 7544,  413,  398, 7544,    0,
+      371,    0,  268,  363, 7544,    0,  325,    0,  547,  307,
+      275,  907, 3514, 3536, 3664, 3625, 3627, 3662, 3678, 3683,
+     3700, 3702, 3709, 3715, 3720, 3738, 3727, 3729, 3758, 3760,
+
+     3790, 3796, 3803, 3805, 3811, 3816, 3822, 3833, 3840, 3842,
+     3849, 3854, 3860, 3866, 3872, 3886, 3891, 3896, 3916, 3903,
+     3918, 3924,  458, 3935, 3942, 3947, 3956, 3929, 3970, 3972,
+     3978, 3991, 3999, 4017, 4026, 4004, 4035, 4047, 4052, 4057,
+     4066, 4073, 4086, 4101, 4108, 4117, 4122, 4140, 4146, 4132,
+     4152, 4164, 4174, 4184, 4182, 4199, 4206, 4213, 4215, 4221,
+     4230,  250,  204, 4236, 4283, 4297, 4303, 4321, 4359, 4373,
+     4379,  516,  190, 7544,    0,  159, 7544,    0,  152, 4266,
+     4288, 4379, 4377, 4357, 4409, 4411, 4397, 4430, 4432, 4442,
+     4452, 4457, 4459, 4464, 4474, 4484, 4491, 4493, 4505, 4507,
+
+     4512, 4518, 4533,  522, 4544, 4550, 4569, 4581, 4587, 4593,
+     4599, 4606, 4608, 4614, 4625, 4619, 4627, 4633, 4648, 4654,
+     4656, 4662, 4683, 4689, 4694, 4702, 4712, 4721, 4729, 4710,
+     4672, 4742, 4748, 4753, 4767,    0, 4783, 4821, 4835, 4841,
+      542,  148, 7544, 4788, 4818, 4841, 4858, 4891, 4804, 4893,
+     4911, 4873, 4900, 4916, 4921, 4927, 4932, 4946, 4948,  536,
+     4953, 4960, 4976, 4970, 4985, 4994, 4996, 5007, 5001, 5009,
+     5015, 5023, 5030, 5035, 5051, 5059, 5061, 5070, 5090, 5096,
+     5105, 5125, 5134, 5110,    0, 5141, 5180, 5187, 5201,  531,
+     5218, 5165, 5239, 5207, 5250, 5252, 5257, 5259, 5266, 5276,
+
+     5264, 5284, 7544, 5292, 5294, 5299, 5326, 5339, 5306, 5345,
+     5357, 5359, 5316, 5368, 5391, 5373, 5404, 5419, 5424, 5426,
+     5466, 5489, 5504, 5527, 7544, 5449, 5456, 5484, 5553, 5489,
+     5522, 5562, 5564, 5578, 5580, 5585, 5587, 5592, 5597, 5603,
+     5614, 5616, 5623, 5629, 5647, 5676, 5631, 5694, 5709, 5715,
+     5761, 5641, 5765, 5743, 5780, 5745, 5778, 5787, 5789, 5795,
+     5797, 5818, 5820, 5827, 5829, 5834, 5840, 5847, 5853, 5862,
+     5864, 5871, 5878, 5885, 5887, 5893, 5904, 5910, 5920, 5926,
+     7544, 6015, 6033, 6051, 6069, 6087, 6105, 6123, 6141, 6159,
+     6177, 6195, 6213, 6231, 6239, 6255, 6263, 6278, 6286,  104,
+
+     6295, 6305, 6314, 6332, 6350, 6368, 6386, 6404, 6422, 6440,
+     6458, 6476, 6494, 6512, 6520, 6538, 6549, 6564, 6572,  459,
+     6586, 6597, 6605, 6619, 6627, 6633, 6651, 6669, 6687, 6705,
+     6723, 6741, 6759, 6777, 6795, 6813, 6831, 6849, 6867, 6875,
+     6893, 6907, 6916, 6924, 6942, 6956,  566, 6972, 6986, 6997,
+     7008, 7022, 7030, 7039, 7057, 7075, 7093, 7111, 7129, 7147,
+     7165, 7183, 7201, 7209, 7221, 7229, 7245, 7263, 7271, 7283,
+     7291, 7300, 7314, 7332, 7343, 7354, 7365, 7375, 7383, 7392,
+     7410, 7418, 7430, 7446, 7454, 7466, 7478, 7492, 7508, 7519,
+     7527
+
     } ;
 
-static yyconst flex_int16_t yy_def[967] =
+static yyconst flex_int16_t yy_def[992] =
     {   0,
-      857,  857,  856,    3,  858,  858,  859,  859,  860,  860,
-      861,  861,  862,  862,  863,  863,  864,  864,  865,  865,
-      866,  866,  867,  867,  857,  857,  856,  856,  856,  856,
-      856,  856,  856,  868,  869,  870,  856,  871,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  872,  856,  873,
-      856,  856,  874,  875,  876,  876,  876,  876,  876,   58,
-      876,  876,  876,  876,   56,   56,   56,  876,  876,  876,
-      876,   56,   58,  876,  876,  876,  856,  856,  856,  877,
-      856,  876,  856,  856,  856,  878,  879,  856,  856,  856,
-      856,  880,  856,  856,  856,  856,  881,  856,  856,  881,
-
-      856,  882,  856,  856,  882,  856,  856,  856,  856,  869,
-      856,  856,  856,  856,  856,  856,  869,  856,  856,  856,
-      856,  856,  856,  869,  856,  883,  883,  883,  884,  856,
-      856,  856,  856,  856,  856,  856,  885,  856,  885,  856,
-      886,  856,  856,  856,  887,  856,  856,  856,  888,  889,
-      856,  869,  856,  869,  890,  856,  856,  856,  891,  856,
-      856,  856,  856,  856,  856,  856,  892,  893,  893,  856,
-      856,  894,  856,  856,  895,  878,  896,  897,  898,  897,
-      897,  897,  897,  897,  897,  897,  897,  897,  897,  897,
-      897,  897,  897,  897,  897,  897,  897,  897,  897,  897,
-
-      897,  897,  897,  897,  897,  897,  897,  897,  897,  897,
-      897,  897,  897,  897,  897,  897,  897,  897,  897,  897,
-      897,  897,  897,  897,  897,  897,  897,  897,  897,  897,
-      897,  897,  897,  204,  897,  897,  897,  897,  856,  899,
-      900,  901,  856,  878,  902,  856,  856,  856,  856,  903,
-      856,  856,  856,  856,  904,  904,  856,  856,  856,  856,
-      904,  856,  856,  905,  905,  856,  856,  856,  856,  905,
-      856,  856,  856,  856,  856,  856,  906,  906,  907,  908,
-      856,  909,  909,  856,  856,  910,  856,  911,  912,  913,
-      914,  856,  856,  856,  856,  915,  916,  917,  856,  299,
-
-      856,  856,  856,  856,  918,  918,  919,  920,  921,  856,
-      310,  922,  923,  924,  925,  926,  926,  926,  926,  926,
-      926,  926,  926,  926,  926,  926,  926,  926,  926,  926,
-      926,  926,  926,  926,  926,  926,  926,  926,  926,  926,
-      926,  926,  926,  926,  926,  926,  926,  926,  926,  926,
-      926,  926,  926,  926,  926,  926,  926,  926,  926,  926,
-      926,  926,  926,  926,  926,  926,  926,  926,  926,  926,
-      926,  926,  926,  926,  926,  926,  926,  926,  926,  926,
-      926,  926,  926,  926,  926,  926,  926,  926,  926,  926,
-      926,  926,  926,  926,  926,  926,  926,  926,  926,  926,
-
-      926,  926,  926,  926,  926,  926,  927,  928,  929,  856,
-      856,  856,  856,  930,  856,  856,  856,  931,  856,  856,
-      856,  856,  856,  856,  856,  932,  856,  932,  933,  934,
-      935,  935,  936,  937,  856,  938,  856,  939,  940,  941,
-      856,  941,  942,  856,  943,  856,  944,  945,  946,  856,
-      946,  947,  948,  856,  949,  950,  951,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  953,  954,  955,  955,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  938,  856,  939,  956,
-      957,  958,  943,  856,  944,  959,  960,  961,  949,  856,
-      962,  950,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  963,  953,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  956,  856,  957,  959,
-      856,  960,  964,  965,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  966,  856,  856,  856,  856,
-      856,  964,  856,  965,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  966,  856,  856,  856,  856,  856,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  856,  856,  856,  856,  856,
-
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  856,  856,  856,  856,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,  952,  952,  952,  952,  952,
-      952,  952,  952,  952,  952,    0,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856
+      882,  882,  881,    3,  883,  883,  884,  884,  885,  885,
+      886,  886,  887,  887,  888,  888,  889,  889,  890,  890,
+      891,  891,  892,  892,  882,  882,  881,  881,  881,  881,
+      881,  881,  881,  893,  894,  895,  881,  896,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  897,  881,  898,
+      881,  881,  899,  900,  901,  901,  901,  901,  901,   58,
+      901,  901,  901,  901,   56,   56,   56,  901,  901,  901,
+      901,   56,   58,  901,  901,  901,  881,  881,  881,  902,
+      881,  901,  881,  881,  881,  903,  904,  881,  881,  881,
+      881,  905,  881,  881,  881,  881,  906,  881,  881,  906,
+
+      881,  907,  881,  881,  907,  881,  881,  881,  881,  894,
+      881,  881,  881,  881,  881,  881,  894,  881,  881,  881,
+      881,  881,  881,  894,  881,  908,  908,  908,  909,  881,
+      881,  881,  881,  881,  881,  881,  910,  881,  910,  881,
+      911,  881,  881,  881,  912,  881,  881,  881,  913,  914,
+      881,  894,  881,  894,  915,  881,  881,  881,  916,  881,
+      881,  881,  881,  881,  881,  881,  917,  918,  918,  881,
+      881,  919,  881,  881,  920,  903,  921,  922,  923,  922,
+      922,  922,  922,  922,  922,  922,  922,  922,  922,  922,
+      922,  922,  922,  922,  922,  922,  922,  922,  922,  922,
+
+      922,  922,  922,  922,  922,  922,  922,  922,  922,  922,
+      922,  922,  922,  922,  922,  922,  922,  922,  922,  922,
+      922,  922,  922,  922,  922,  922,  922,  922,  922,  922,
+      922,  922,  922,  204,  922,  922,  922,  922,  922,  881,
+      924,  925,  926,  881,  903,  927,  881,  881,  881,  881,
+      928,  881,  881,  881,  881,  929,  929,  881,  881,  881,
+      881,  929,  881,  881,  930,  930,  881,  881,  881,  881,
+      930,  881,  881,  881,  881,  881,  881,  931,  931,  932,
+      933,  881,  934,  934,  881,  881,  935,  881,  936,  937,
+      938,  939,  881,  881,  881,  881,  940,  941,  942,  881,
+
+      300,  881,  881,  881,  881,  943,  943,  944,  945,  946,
+      881,  311,  947,  948,  949,  950,  951,  951,  951,  951,
+      951,  951,  951,  951,  951,  951,  951,  951,  951,  951,
+      951,  951,  951,  951,  951,  951,  951,  951,  951,  951,
+      951,  951,  951,  951,  951,  951,  951,  951,  951,  951,
+      951,  951,  951,  951,  951,  951,  951,  951,  951,  951,
+      951,  951,  951,  951,  951,  951,  951,  951,  951,  951,
+      951,  951,  951,  951,  951,  951,  951,  951,  951,  951,
+      951,  951,  951,  951,  951,  951,  951,  951,  951,  951,
+      951,  951,  951,  951,  951,  951,  951,  951,  951,  951,
+
+      951,  951,  951,  951,  951,  951,  951,  951,  951,  951,
+      951,  952,  953,  954,  881,  881,  881,  881,  955,  881,
+      881,  881,  956,  881,  881,  881,  881,  881,  881,  881,
+      957,  881,  957,  958,  959,  960,  960,  961,  962,  881,
+      963,  881,  964,  965,  966,  881,  966,  967,  881,  968,
+      881,  969,  970,  971,  881,  971,  972,  973,  881,  974,
+      975,  976,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+
+      977,  977,  977,  977,  977,  977,  977,  977,  881,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  978,  979,  980,  980,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  963,  881,  964,
+      981,  982,  983,  968,  881,  969,  984,  985,  986,  974,
+      881,  987,  975,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  881,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  988,  978,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  981,  881,  982,  984,  881,  985,  989,  990,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+
+      977,  977,  977,  881,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  991,  881,  881,  881,  881,
+      881,  989,  881,  990,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  881,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  991,  881,  881,  881,  881,  881,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+
+      977,  977,  881,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      881,  881,  881,  881,  881,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  881,  881,  881,
+      881,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+      977,  977,  977,  977,  977,  977,  977,  977,  977,  977,
+        0,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881
+
     } ;
 
-static yyconst flex_int16_t yy_nxt[7456] =
+static yyconst flex_int16_t yy_nxt[7634] =
     {   0,
        29,   30,   31,   32,   33,   34,   35,   36,   29,   37,
        38,   39,   40,   41,   42,   43,   44,   45,   46,   47,
@@ -763,820 +774,840 @@ static yyconst flex_int16_t yy_nxt[7456] =
        56,   57,   58,   59,   60,   61,   62,   63,   64,   64,
        65,   66,   67,   68,   69,   70,   71,   72,   73,   74,
        64,   75,   76,   64,   64,   83,   84,   85,   86,   88,
-       89,   88,   89,   93,   94,  240,   95,   90,  242,   90,
+       89,   88,   89,   93,   94,  241,   95,   90,  243,   90,
 
-       93,   94,  256,   95,   98,   99,   98,   99,  103,  104,
-      244,  105,  100,  179,  100,  103,  104,  175,  105,  108,
-       31,  109,  153,  154,  110,  108,   31,  109,  244,  111,
+       93,   94,  257,   95,   98,   99,   98,   99,  103,  104,
+      245,  105,  100,  179,  100,  103,  104,  175,  105,  108,
+       31,  109,  153,  154,  110,  108,   31,  109,  245,  111,
       110,  179,  122,   31,  123,  111,  150,  124,  151,   28,
-      138,   91,  156,   91,  173,   96,  257,  157,  112,  174,
-      139,  265,   96,  723,  112,  140,  101,  723,  101,  125,
-      106,  114,   31,  115,  661,  116,  117,  106,  169,  170,
-      118,  119,  114,   31,  115,  294,  116,  117,  153,  154,
-      112,  118,  119,  122,   31,  123,  112,  240,  124,  127,
-      128,  125,  129,  273,  164,  658,  165,  130,  131,  132,
-
-      266,   28,  138,  133,  276,  134,  127,  128,  166,  129,
-      125,  150,  139,  292,  130,  131,  132,  140,  142,  143,
-      133,  646,  134,  142,  143,  273,  144,  259,  260,  176,
-      177,  144,  436,  179,  856,  261,  276,  176,  177,  284,
-      166,  179,  125,  176,  177,  120,  437,  179,  176,  177,
-      422,  180,  179,  181,  184,  663,  120,  313,  182,  176,
-      177,  183,  185,  179,  153,  154,  153,  154,  186,  407,
-      145,  195,  135,  297,  136,  145,  176,  177,  187,  257,
-      179,  188,  422,  180,  189,  181,  184,  190,  298,  135,
-      182,  136,  646,  183,  185,  268,  269,  303,  270,  303,
-
-      186,  176,  304,  195,  200,  290,  291,  176,  177,  176,
-      187,  179,  256,  188,  265,  176,  189,  196,  191,  190,
+      138,   91,  156,   91,  173,   96,  258,  157,  112,  174,
+      139,  266,   96,  743,  112,  140,  101,  743,  101,  125,
+      106,  114,   31,  115,  677,  116,  117,  106,  169,  170,
+      118,  119,  114,   31,  115,  295,  116,  117,  153,  154,
+      112,  118,  119,  122,   31,  123,  112,  241,  124,  127,
+      128,  125,  129,  274,  164,  674,  165,  130,  131,  132,
+
+      267,   28,  138,  133,  277,  134,  127,  128,  166,  129,
+      125,  150,  139,  293,  130,  131,  132,  140,  142,  143,
+      133,  662,  134,  142,  143,  274,  144,  260,  261,  176,
+      177,  144,  441,  179,  881,  262,  277,  176,  177,  285,
+      166,  179,  125,  176,  177,  120,  442,  179,  176,  177,
+      427,  180,  179,  181,  184,  679,  120,  314,  182,  176,
+      177,  183,  185,  179,  153,  154,  153,  154,  186,  412,
+      145,  195,  135,  298,  136,  145,  176,  177,  187,  258,
+      179,  188,  427,  180,  189,  181,  184,  190,  299,  135,
+      182,  136,  662,  183,  185,  269,  270,  304,  271,  304,
+
+      186,  176,  305,  195,  200,  291,  292,  176,  177,  176,
+      187,  179,  581,  188,  266,  176,  189,  196,  191,  190,
       176,  178,  192,  176,  177,  197,  193,  179,  176,  177,
-      244,  176,  179,  856,  198,  194,  200,  199,  207,  201,
-      308,  237,  153,  154,  295,  154,  208,  266,  176,  196,
-      191,  210,  209,  178,  192,  309,  257,  197,  193,  211,
-      176,  177,  178,  266,  179,  212,  198,  194,  570,  199,
-      207,  201,  213,  237,  418,  178,  445,  163,  208,  176,
-      214,  176,  177,  210,  209,  179,  215,  302,  221,  166,
-      446,  211,  216,  661,  178,  176,  178,  212,  414,  166,
-
-      176,  176,  177,  452,  213,  179,  452,  178,  427,  428,
-      176,  177,  214,  564,  179,  202,  658,  203,  215,  554,
-      221,  166,  217,  266,  216,  204,  218,  558,  178,  205,
+      677,  176,  179,  163,  198,  194,  200,  199,  207,  201,
+      423,  237,  238,  153,  154,  166,  208,  267,  176,  196,
+      191,  210,  209,  178,  192,  296,  154,  197,  193,  211,
+      176,  177,  178,  267,  179,  212,  198,  194,  575,  199,
+      207,  201,  213,  237,  238,  178,  674,  166,  208,  176,
+      214,  176,  177,  210,  209,  179,  215,  303,  221,  267,
+      245,  211,  216,  881,  178,  176,  178,  212,  257,  166,
+
+      176,  176,  177,  569,  213,  179,  419,  178,  432,  433,
+      176,  177,  214,  450,  179,  202,  566,  203,  215,  565,
+      221,  556,  217,  556,  216,  204,  218,  451,  178,  205,
       206,  166,  176,  176,  177,  231,  219,  179,  220,  232,
-      176,  177,  257,  178,  179,  268,  269,  202,  419,  203,
-      175,  554,  233,  176,  217,  223,  175,  204,  218,  176,
-      177,  205,  206,  179,  222,  234,  555,  231,  219,  545,
-      220,  232,  545,  176,  407,  178,  164,  656,  165,  176,
-      177,  302,  176,  179,  233,  427,  428,  223,  176,  177,
-      166,  646,  179,  166,  176,  177,  222,  266,  179,  570,
-
-      176,  177,  721,  235,  179,  176,  556,  428,  236,  656,
-      407,  238,  176,  224,  317,  225,  180,  226,  181,  245,
-      767,  227,  166,  182,  245,  166,  183,  228,  454,  312,
-      313,  176,  229,  230,  721,  235,  568,  178,  800,  448,
-      236,  176,  314,  238,  176,  224,  317,  225,  180,  226,
-      181,  176,  767,  227,  566,  182,  446,  250,  183,  228,
-      176,  248,  250,  564,  229,  230,  176,  448,  245,  178,
-      800,  444,  176,  245,  245,  562,  439,  560,  245,  437,
-      255,  558,  439,  435,  555,  255,  245,  266,  257,  545,
-      245,  264,  245,  249,  245,  407,  264,  176,  177,  253,
-
-      455,  179,  454,  444,  176,  177,  250,  306,  179,  306,
-      304,  250,  250,  176,  176,  177,  250,  318,  179,  304,
-      435,  147,  262,  240,  250,  319,  432,  316,  250,  255,
-      250,  254,  250,  271,  255,  255,  432,  856,  283,  255,
-      264,  425,  424,  321,  423,  264,  264,  255,  267,  318,
-      264,  255,  267,  255,  263,  255,  258,  319,  264,  316,
-      258,  251,  264,  246,  264,  272,  264,  297,  240,  176,
-      312,  170,  170,  306,  301,  321,  176,  293,  147,  176,
-      314,  293,  298,  179,  176,  177,  176,  146,  179,  299,
-      299,  299,  299,  299,  299,  299,  299,  299,  299,  299,
-
-      299,  299,  299,  299,  299,  299,  299,  299,  299,  299,
-      299,  299,  299,  299,  299,  288,  343,  287,  287,  300,
-      285,  300,  300,  300,  300,  300,  300,  300,  300,  300,
+      176,  177,  258,  178,  179,  269,  270,  202,  424,  203,
+      258,  565,  233,  176,  217,  223,  412,  204,  218,  176,
+      177,  205,  206,  179,  222,  234,  175,  231,  219,  662,
+      220,  232,  175,  176,  581,  178,  164,  672,  165,  176,
+      177,  303,  176,  179,  233,  432,  433,  223,  176,  177,
+      166,  412,  179,  166,  176,  177,  222,  267,  179,  459,
+
+      176,  177,  704,  235,  179,  176,  567,  433,  236,  672,
+      313,  239,  176,  224,  318,  225,  180,  226,  181,  246,
+      579,  227,  166,  182,  246,  166,  183,  228,  453,  577,
+      314,  176,  229,  230,  704,  235,  451,  178,  575,  509,
+      236,  176,  315,  239,  176,  224,  318,  225,  180,  226,
+      181,  176,  309,  227,  453,  182,  741,  251,  183,  228,
+      176,  249,  251,  760,  229,  230,  176,  310,  246,  178,
+      623,  790,  176,  246,  246,  803,  457,  825,  246,  457,
+      256,  449,  573,  444,  571,  256,  246,  442,  741,  569,
+      246,  265,  246,  250,  246,  760,  265,  176,  177,  254,
+
+      444,  179,  623,  790,  176,  177,  251,  803,  179,  825,
+      440,  251,  251,  176,  176,  177,  251,  319,  179,  566,
+      267,  258,  263,  556,  251,  320,  412,  317,  251,  256,
+      251,  255,  251,  272,  256,  256,  460,  459,  449,  256,
+      265,  307,  307,  322,  305,  265,  265,  256,  305,  319,
+      265,  256,  440,  256,  264,  256,  147,  320,  265,  317,
+      241,  437,  265,  437,  265,  273,  265,  298,  881,  176,
+      284,  430,  429,  428,  268,  322,  176,  268,  259,  176,
+      315,  259,  299,  179,  176,  177,  176,  252,  179,  300,
+      300,  300,  300,  300,  300,  300,  300,  300,  300,  300,
+
       300,  300,  300,  300,  300,  300,  300,  300,  300,  300,
-      300,  300,  300,  300,  300,  300,  300,  308,  343,  455,
-      283,  176,  281,  280,  278,  278,  176,  147,  146,  275,
-      176,  244,  309,  176,  274,  147,  146,  147,  146,  310,
-      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
-      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
-      310,  310,  310,  310,  310,  267,  267,  258,  258,  311,
-
-      252,  311,  311,  311,  311,  311,  311,  311,  311,  311,
+      300,  300,  300,  300,  300,  247,  346,  241,  313,  301,
+      170,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+      301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+      301,  301,  301,  301,  301,  301,  301,  309,  346,  460,
+      170,  176,  307,  302,  294,  147,  176,  294,  146,  289,
+      176,  245,  310,  176,  288,  288,  286,  284,  282,  311,
       311,  311,  311,  311,  311,  311,  311,  311,  311,  311,
-      311,  311,  311,  311,  311,  311,  311,  176,  177,  176,
-      177,  179,  176,  179,  176,  177,  176,  177,  179,  252,
-      179,  251,  176,  177,  320,  247,  179,  324,  247,  322,
-      246,  325,  243,  176,  177,  176,  177,  179,  663,  179,
-      176,  177,  239,  171,  179,  323,  326,  163,  328,  176,
-      244,  162,  176,  327,  176,  177,  320,  161,  179,  324,
-      160,  322,  158,  325,  148,  329,  147,  176,  177,  334,
-      330,  179,  147,  146,  856,  856,  331,  323,  326,  176,
-
-      328,  176,  332,  333,  856,  327,  176,  856,  176,  176,
-      177,  856,  335,  179,  176,  176,  177,  329,  856,  179,
-      856,  334,  330,  856,  856,  176,  856,  176,  331,  176,
-      177,  337,  176,  179,  332,  333,  856,  338,  856,  176,
-      177,  176,  336,  179,  335,  856,  176,  176,  177,  856,
-      856,  179,  176,  177,  259,  260,  179,  176,  177,  176,
-      856,  179,  415,  337,  339,  856,  856,  344,  341,  338,
-      856,  340,  176,  177,  336,  856,  179,  856,  856,  176,
-      177,  176,  342,  179,  856,  176,  177,  176,  856,  179,
-      856,  856,  856,  346,  856,  347,  339,  856,  345,  344,
-
-      341,  176,  856,  340,  350,  856,  257,  856,  348,  349,
-      856,  176,  176,  177,  342,  856,  179,  856,  856,  176,
-      856,  856,  176,  177,  176,  346,  179,  347,  856,  176,
-      345,  856,  856,  357,  856,  358,  350,  856,  856,  856,
-      348,  349,  359,  856,  176,  856,  356,  856,  856,  856,
-      856,  176,  176,  177,  856,  856,  179,  176,  176,  177,
-      176,  177,  179,  360,  179,  357,  856,  358,  856,  856,
-      351,  856,  176,  177,  359,  856,  179,  352,  356,  856,
-      353,  176,  177,  366,  176,  179,  354,  176,  177,  355,
-      856,  179,  856,  856,  176,  360,  364,  176,  177,  176,
-
-      177,  179,  351,  179,  176,  177,  176,  177,  179,  352,
-      179,  365,  353,  856,  856,  366,  856,  368,  354,  856,
-      361,  355,  371,  856,  176,  362,  367,  856,  364,  856,
-      176,  856,  176,  363,  176,  177,  176,  177,  179,  856,
-      179,  176,  177,  365,  176,  179,  176,  177,  856,  368,
-      179,  856,  361,  176,  371,  856,  369,  362,  367,  176,
-      373,  370,  856,  856,  856,  363,  372,  856,  856,  176,
-      856,  176,  856,  176,  177,  856,  176,  179,  176,  176,
-      177,  856,  856,  179,  375,  176,  177,  856,  369,  179,
-      856,  856,  373,  370,  374,  856,  856,  856,  372,  376,
-
-      176,  177,  377,  856,  179,  856,  176,  856,  176,  856,
-      176,  177,  856,  176,  179,  378,  375,  856,  176,  856,
-      176,  177,  856,  379,  179,  856,  374,  856,  856,  856,
-      856,  376,  176,  177,  377,  380,  179,  176,  177,  176,
-      177,  179,  381,  179,  856,  176,  856,  378,  382,  856,
-      856,  176,  856,  384,  383,  379,  856,  176,  856,  176,
-      177,  856,  856,  179,  856,  856,  856,  380,  385,  176,
-      177,  856,  176,  179,  381,  856,  856,  856,  856,  856,
-      382,  390,  176,  856,  386,  384,  383,  387,  856,  176,
-      177,  856,  176,  179,  176,  177,  856,  856,  179,  856,
-
-      385,  388,  856,  856,  176,  856,  176,  177,  856,  176,
-      179,  176,  389,  390,  176,  177,  386,  392,  179,  387,
-      176,  177,  856,  856,  179,  856,  176,  177,  391,  856,
-      179,  176,  856,  388,  176,  177,  406,  393,  179,  403,
-      856,  176,  856,  856,  389,  404,  856,  176,  177,  392,
-      856,  179,  176,  177,  176,  177,  179,  856,  179,  856,
-      391,  176,  405,  856,  856,  856,  176,  458,  406,  393,
-      856,  403,  856,  856,  856,  856,  856,  404,  176,  394,
-      395,  396,  397,  245,  856,  398,  176,  856,  245,  399,
-      400,  401,  176,  856,  405,  402,  178,  856,  176,  458,
-
-      176,  177,  856,  856,  179,  856,  176,  856,  856,  856,
-      856,  394,  395,  396,  397,  856,  856,  398,  856,  176,
-      856,  399,  400,  401,  176,  248,  176,  402,  178,  856,
-      176,  177,  245,  856,  179,  410,  856,  245,  245,  856,
-      856,  463,  245,  410,  410,  410,  410,  410,  410,  856,
-      245,  411,  856,  856,  245,  856,  245,  249,  245,  411,
-      411,  411,  411,  411,  411,  250,  856,  856,  856,  856,
-      250,  856,  176,  463,  856,  410,  410,  410,  410,  410,
-      410,  856,  176,  177,  176,  177,  179,  856,  179,  856,
-      856,  411,  411,  411,  411,  411,  411,  176,  177,  459,
-
-      856,  179,  176,  856,  856,  478,  856,  253,  176,  177,
-      856,  856,  179,  856,  250,  856,  856,  412,  856,  250,
-      250,  461,  856,  460,  250,  412,  412,  412,  412,  412,
-      412,  459,  250,  413,  856,  856,  250,  478,  250,  254,
-      250,  413,  413,  413,  413,  413,  413,  255,  856,  856,
-      856,  856,  255,  461,  176,  460,  176,  412,  412,  412,
-      412,  412,  412,  176,  177,  856,  856,  179,  856,  176,
-      856,  856,  856,  413,  413,  413,  413,  413,  413,  856,
-      176,  176,  177,  856,  856,  179,  856,  856,  856,  262,
-      176,  177,  856,  856,  179,  856,  255,  856,  856,  416,
-
-      856,  255,  255,  856,  856,  465,  255,  416,  416,  416,
-      416,  416,  416,  856,  255,  417,  856,  856,  255,  462,
-      255,  263,  255,  417,  417,  417,  417,  417,  417,  264,
-      856,  856,  856,  856,  264,  176,  856,  465,  856,  416,
-      416,  416,  416,  416,  416,  856,  176,  177,  176,  177,
-      179,  462,  179,  176,  856,  417,  417,  417,  417,  417,
-      417,  856,  176,  470,  176,  177,  856,  856,  179,  856,
-      856,  271,  176,  177,  856,  856,  179,  856,  264,  471,
-      856,  420,  856,  264,  264,  856,  856,  856,  264,  420,
-      420,  420,  420,  420,  420,  470,  264,  421,  856,  856,
-
-      264,  464,  264,  272,  264,  421,  421,  421,  421,  421,
-      421,  471,  176,  177,  856,  856,  179,  856,  176,  856,
-      176,  420,  420,  420,  420,  420,  420,  856,  856,  856,
-      856,  856,  856,  464,  856,  856,  176,  421,  421,  421,
-      421,  421,  421,  439,  176,  440,  441,  856,  856,  856,
-      856,  856,  856,  442,  442,  442,  442,  442,  442,  442,
-      442,  442,  442,  442,  442,  442,  442,  442,  442,  442,
-      442,  442,  442,  442,  442,  442,  442,  442,  442,  856,
-      856,  856,  856,  440,  176,  440,  440,  440,  440,  440,
-      440,  440,  440,  440,  440,  440,  440,  440,  440,  440,
-
-      440,  440,  440,  440,  440,  440,  440,  440,  440,  440,
-      440,  856,  856,  176,  177,  856,  856,  179,  440,  440,
-      440,  440,  440,  440,  440,  440,  440,  440,  440,  440,
-      440,  440,  440,  440,  440,  440,  440,  440,  440,  440,
-      440,  440,  440,  440,  448,  856,  449,  450,  856,  856,
-      856,  856,  856,  856,  451,  451,  451,  451,  451,  451,
-      451,  451,  451,  451,  451,  451,  451,  451,  451,  451,
-      451,  451,  451,  451,  451,  451,  451,  451,  451,  451,
-      856,  856,  856,  856,  449,  176,  449,  449,  449,  449,
-      449,  449,  449,  449,  449,  449,  449,  449,  449,  449,
-
-      449,  449,  449,  449,  449,  449,  449,  449,  449,  449,
-      449,  449,  856,  176,  177,  856,  856,  179,  856,  449,
-      449,  449,  449,  449,  449,  449,  449,  449,  449,  449,
-      449,  449,  449,  449,  449,  449,  449,  449,  449,  449,
-      449,  449,  449,  449,  449,  176,  177,  176,  177,  179,
-      856,  179,  856,  176,  177,  856,  466,  179,  467,  176,
-      177,  176,  177,  179,  468,  179,  176,  177,  856,  856,
-      179,  856,  469,  856,  472,  176,  177,  856,  856,  179,
-      176,  177,  176,  177,  179,  176,  179,  856,  466,  473,
-      467,  856,  474,  856,  176,  177,  468,  475,  179,  176,
-
-      177,  176,  177,  179,  469,  179,  472,  479,  856,  476,
-      176,  177,  477,  856,  179,  856,  856,  176,  856,  176,
-      856,  473,  176,  177,  474,  176,  179,  480,  856,  475,
-      481,  176,  856,  176,  856,  487,  176,  177,  176,  479,
-      179,  476,  856,  856,  477,  856,  483,  176,  856,  176,
-      177,  856,  176,  179,  176,  482,  856,  176,  177,  480,
-      856,  179,  481,  856,  484,  856,  176,  487,  856,  856,
-      856,  176,  485,  176,  856,  176,  177,  856,  483,  179,
-      176,  177,  176,  856,  179,  176,  177,  482,  856,  179,
-      486,  176,  177,  856,  176,  179,  484,  176,  177,  176,
-
-      177,  179,  488,  179,  485,  176,  177,  856,  176,  179,
-      490,  856,  491,  489,  856,  176,  177,  856,  856,  179,
-      856,  176,  486,  856,  495,  856,  856,  492,  856,  176,
-      856,  856,  493,  856,  488,  176,  177,  176,  177,  179,
-      856,  179,  490,  856,  491,  489,  856,  176,  856,  856,
-      494,  497,  176,  856,  176,  177,  495,  176,  179,  492,
-      856,  176,  177,  176,  493,  179,  176,  177,  856,  176,
-      179,  176,  856,  499,  176,  177,  496,  176,  179,  856,
-      856,  498,  494,  497,  176,  177,  856,  176,  179,  500,
-      176,  177,  856,  856,  179,  176,  177,  856,  856,  179,
-
-      176,  177,  856,  856,  179,  499,  856,  176,  496,  176,
-      502,  856,  501,  498,  176,  177,  176,  177,  179,  505,
-      179,  500,  856,  176,  177,  856,  176,  179,  503,  506,
-      856,  176,  177,  176,  856,  179,  856,  507,  176,  508,
-      856,  856,  502,  856,  501,  504,  176,  856,  176,  177,
-      856,  505,  179,  856,  176,  177,  176,  856,  179,  514,
-      503,  506,  176,  856,  856,  856,  856,  176,  509,  507,
-      856,  508,  176,  856,  176,  177,  856,  504,  179,  510,
-      856,  176,  177,  176,  177,  179,  176,  179,  176,  511,
-      856,  514,  176,  177,  856,  176,  179,  856,  513,  856,
-
-      509,  176,  177,  176,  856,  179,  856,  515,  856,  176,
-      177,  510,  512,  179,  856,  176,  177,  856,  856,  179,
-      176,  511,  856,  856,  517,  856,  176,  856,  856,  856,
-      513,  176,  177,  516,  856,  179,  176,  177,  856,  515,
-      179,  856,  856,  856,  512,  518,  176,  176,  177,  856,
-      856,  179,  856,  176,  856,  176,  517,  176,  177,  519,
-      856,  179,  856,  856,  176,  516,  176,  177,  176,  177,
-      179,  856,  179,  176,  856,  520,  856,  518,  856,  521,
-      856,  176,  856,  856,  176,  177,  522,  176,  179,  856,
-      523,  519,  176,  177,  176,  177,  179,  856,  179,  856,
-
-      176,  177,  856,  176,  179,  856,  856,  520,  176,  526,
-      856,  521,  856,  856,  524,  856,  525,  856,  522,  176,
-      176,  177,  523,  856,  179,  856,  856,  176,  177,  176,
-      856,  179,  856,  176,  177,  527,  856,  179,  176,  528,
-      176,  526,  856,  176,  177,  856,  524,  179,  525,  856,
-      856,  529,  531,  176,  177,  856,  176,  179,  856,  176,
-      177,  530,  856,  179,  176,  856,  176,  527,  535,  856,
-      533,  528,  176,  856,  856,  176,  177,  532,  534,  179,
-      856,  176,  177,  529,  531,  179,  176,  177,  856,  856,
-      179,  856,  176,  530,  176,  177,  856,  856,  179,  176,
-
-      535,  856,  533,  856,  537,  176,  536,  176,  177,  532,
-      534,  179,  856,  176,  177,  176,  538,  179,  856,  539,
-      856,  856,  856,  856,  856,  176,  856,  856,  856,  176,
-      571,  176,  546,  179,  856,  541,  537,  540,  536,  856,
-      546,  546,  546,  546,  546,  546,  856,  176,  538,  856,
-      856,  539,  547,  176,  856,  176,  314,  856,  176,  179,
-      547,  547,  547,  547,  547,  547,  176,  541,  856,  540,
-      856,  856,  546,  546,  546,  546,  546,  546,  548,  176,
-      176,  177,  856,  856,  179,  176,  548,  548,  548,  548,
-      548,  548,  547,  547,  547,  547,  547,  547,  549,  176,
-
-      177,  176,  856,  179,  550,  856,  549,  549,  549,  549,
-      549,  549,  550,  550,  550,  550,  550,  550,  548,  548,
-      548,  548,  548,  548,  551,  176,  177,  176,  856,  179,
-      856,  856,  551,  551,  551,  551,  551,  551,  549,  549,
-      549,  549,  549,  549,  550,  550,  550,  550,  550,  550,
-      552,  856,  176,  573,  856,  856,  856,  856,  552,  552,
-      552,  552,  552,  552,  551,  551,  551,  551,  551,  551,
-      553,  176,  856,  856,  856,  856,  856,  856,  553,  553,
-      553,  553,  553,  553,  856,  573,  856,  856,  856,  856,
-      552,  552,  552,  552,  552,  552,  856,  176,  856,  856,
-
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      553,  553,  553,  553,  553,  553,  439,  856,  856,  441,
-      856,  176,  177,  856,  856,  179,  442,  442,  442,  442,
-      442,  442,  442,  442,  442,  442,  442,  442,  442,  442,
-      442,  442,  442,  442,  442,  442,  442,  442,  442,  442,
-      442,  442,  448,  856,  856,  450,  856,  856,  856,  856,
-      856,  856,  451,  451,  451,  451,  451,  451,  451,  451,
-      451,  451,  451,  451,  451,  451,  451,  451,  451,  451,
-      451,  451,  451,  451,  451,  451,  451,  451,  176,  177,
-      176,  177,  179,  176,  179,  176,  177,  856,  856,  179,
-
-      856,  574,  856,  856,  575,  856,  176,  177,  176,  177,
-      179,  856,  179,  176,  177,  176,  177,  179,  856,  179,
-      856,  176,  177,  856,  576,  179,  176,  177,  176,  177,
-      179,  856,  179,  574,  577,  856,  575,  856,  578,  856,
-      176,  177,  856,  579,  179,  580,  176,  177,  856,  856,
-      179,  581,  583,  856,  176,  177,  576,  582,  179,  856,
-      176,  856,  176,  856,  176,  177,  577,  176,  179,  856,
-      578,  588,  856,  856,  856,  579,  584,  580,  176,  589,
-      176,  856,  586,  581,  583,  176,  856,  176,  856,  582,
-      176,  177,  856,  176,  179,  176,  177,  856,  176,  179,
-
-      176,  176,  177,  588,  856,  179,  585,  856,  584,  856,
-      590,  589,  176,  856,  586,  176,  177,  856,  176,  179,
-      587,  176,  177,  176,  177,  179,  176,  179,  856,  176,
-      177,  176,  177,  179,  856,  179,  176,  856,  585,  592,
-      176,  177,  590,  856,  179,  591,  176,  177,  856,  593,
-      179,  856,  587,  594,  176,  177,  176,  177,  179,  856,
-      179,  856,  176,  856,  856,  596,  856,  176,  176,  177,
-      595,  592,  179,  176,  597,  856,  856,  591,  856,  599,
-      856,  593,  598,  856,  856,  594,  856,  176,  176,  177,
-      176,  177,  179,  176,  179,  176,  856,  596,  856,  856,
-
-      856,  176,  595,  176,  176,  177,  597,  600,  179,  176,
-      177,  599,  176,  179,  598,  176,  177,  856,  176,  179,
-      601,  856,  856,  603,  856,  602,  176,  856,  176,  176,
-      177,  176,  177,  179,  856,  179,  856,  856,  604,  600,
-      176,  856,  176,  177,  176,  177,  179,  856,  179,  176,
-      177,  856,  601,  179,  856,  603,  856,  602,  856,  856,
-      176,  605,  176,  176,  177,  176,  177,  179,  856,  179,
-      604,  856,  606,  856,  176,  177,  176,  856,  179,  607,
-      856,  176,  176,  177,  856,  856,  179,  176,  608,  856,
-      176,  177,  856,  605,  179,  609,  176,  177,  176,  177,
-
-      179,  176,  179,  176,  606,  176,  177,  610,  856,  179,
-      856,  607,  856,  611,  176,  612,  176,  856,  856,  856,
-      608,  176,  176,  177,  176,  177,  179,  609,  179,  856,
-      176,  177,  856,  613,  179,  176,  856,  176,  856,  610,
-      856,  614,  856,  615,  856,  611,  176,  612,  176,  177,
-      856,  856,  179,  856,  176,  176,  177,  856,  856,  179,
-      856,  616,  176,  176,  177,  613,  856,  179,  176,  856,
-      176,  856,  856,  614,  856,  615,  856,  176,  176,  177,
-      856,  856,  179,  176,  177,  856,  856,  179,  856,  617,
-      856,  618,  856,  616,  176,  856,  176,  856,  621,  176,
-
-      177,  856,  176,  179,  856,  176,  177,  856,  619,  179,
-      176,  177,  622,  856,  179,  856,  856,  856,  856,  620,
-      176,  617,  856,  618,  623,  176,  177,  176,  856,  179,
-      621,  856,  176,  177,  624,  176,  179,  856,  176,  177,
-      619,  856,  179,  626,  622,  176,  177,  856,  856,  179,
-      176,  625,  856,  176,  177,  176,  623,  179,  176,  177,
-      176,  177,  179,  856,  179,  856,  624,  627,  628,  856,
-      856,  176,  856,  629,  856,  626,  856,  176,  856,  856,
-      176,  177,  176,  625,  179,  176,  177,  856,  856,  179,
-      176,  177,  176,  177,  179,  856,  179,  176,  856,  627,
-
-      628,  856,  856,  631,  176,  629,  634,  856,  856,  630,
-      176,  176,  177,  856,  856,  179,  856,  176,  176,  177,
-      176,  177,  179,  856,  179,  176,  856,  176,  177,  856,
-      176,  179,  176,  856,  856,  631,  856,  635,  634,  632,
-      633,  630,  856,  856,  636,  176,  177,  856,  856,  179,
-      176,  177,  176,  856,  179,  176,  177,  176,  856,  179,
-      856,  856,  176,  856,  176,  856,  176,  177,  856,  635,
-      179,  632,  633,  856,  638,  856,  636,  176,  177,  637,
-      856,  179,  856,  176,  856,  176,  177,  856,  856,  179,
-      176,  641,  176,  856,  176,  177,  639,  856,  179,  176,
-
-      642,  856,  856,  856,  176,  177,  638,  640,  179,  176,
-      177,  637,  856,  179,  856,  856,  856,  176,  643,  856,
-      856,  644,  176,  641,  645,  856,  856,  176,  856,  856,
-      856,  856,  642,  176,  571,  856,  856,  179,  176,  640,
-      856,  176,  177,  856,  856,  179,  856,  856,  856,  176,
-      643,  648,  856,  644,  176,  177,  645,  176,  179,  648,
-      648,  648,  648,  648,  648,  856,  176,  856,  856,  176,
-      177,  176,  177,  179,  649,  179,  176,  856,  856,  856,
-      856,  176,  649,  649,  649,  649,  649,  649,  856,  650,
-      856,  648,  648,  648,  648,  648,  648,  650,  650,  650,
-
-      650,  650,  650,  856,  856,  176,  856,  176,  177,  856,
-      856,  179,  651,  176,  649,  649,  649,  649,  649,  649,
-      651,  651,  651,  651,  651,  651,  176,  652,  856,  650,
-      650,  650,  650,  650,  650,  652,  652,  652,  652,  652,
-      652,  176,  856,  176,  856,  176,  177,  856,  856,  179,
-      653,  856,  651,  651,  651,  651,  651,  651,  653,  653,
-      653,  653,  653,  653,  856,  654,  856,  652,  652,  652,
-      652,  652,  652,  654,  654,  654,  654,  654,  654,  176,
-      856,  176,  177,  176,  177,  179,  856,  179,  655,  856,
-      653,  653,  653,  653,  653,  653,  655,  655,  655,  655,
-
-      655,  655,  856,  856,  856,  654,  654,  654,  654,  654,
-      654,  665,  176,  177,  856,  856,  179,  176,  668,  176,
-      177,  856,  856,  179,  856,  856,  856,  856,  655,  655,
-      655,  655,  655,  655,  667,  176,  177,  856,  856,  179,
-      666,  176,  177,  665,  856,  179,  856,  176,  177,  856,
-      668,  179,  856,  176,  856,  176,  670,  669,  856,  176,
-      177,  856,  671,  179,  856,  856,  667,  176,  177,  176,
-      177,  179,  666,  179,  856,  176,  177,  856,  672,  179,
-      856,  176,  177,  856,  176,  179,  176,  177,  670,  669,
-      179,  176,  856,  673,  671,  856,  674,  176,  177,  856,
-
-      676,  179,  176,  177,  176,  177,  179,  176,  179,  856,
-      672,  176,  177,  176,  675,  179,  176,  177,  856,  176,
-      179,  856,  856,  678,  856,  673,  856,  856,  674,  856,
-      856,  176,  676,  677,  176,  177,  176,  177,  179,  176,
-      179,  176,  856,  856,  176,  177,  675,  176,  179,  679,
-      176,  177,  856,  176,  179,  678,  176,  177,  176,  856,
-      179,  856,  856,  176,  177,  677,  680,  179,  681,  176,
-      856,  682,  856,  856,  176,  856,  176,  856,  176,  177,
-      856,  679,  179,  176,  856,  856,  176,  177,  176,  856,
-      179,  176,  177,  856,  856,  179,  856,  683,  680,  856,
-
-      681,  176,  177,  682,  856,  179,  176,  856,  176,  856,
-      176,  177,  684,  856,  179,  856,  176,  176,  177,  176,
-      177,  179,  176,  179,  856,  856,  856,  856,  176,  683,
-      176,  177,  176,  177,  179,  176,  179,  176,  177,  176,
-      177,  179,  856,  179,  684,  685,  856,  176,  177,  686,
-      176,  179,  176,  177,  687,  856,  179,  856,  176,  856,
-      690,  689,  688,  176,  176,  177,  856,  692,  179,  856,
-      176,  177,  856,  176,  179,  856,  856,  685,  856,  176,
-      177,  686,  176,  179,  176,  177,  687,  856,  179,  176,
-      856,  176,  690,  689,  688,  695,  176,  177,  691,  692,
-
-      179,  856,  176,  693,  176,  856,  176,  177,  856,  176,
-      179,  176,  856,  176,  177,  856,  856,  179,  856,  176,
-      856,  694,  856,  856,  176,  176,  177,  695,  856,  179,
-      691,  856,  856,  856,  856,  693,  176,  696,  698,  856,
-      856,  856,  176,  697,  176,  177,  176,  177,  179,  856,
-      179,  176,  856,  694,  176,  177,  176,  856,  179,  856,
-      856,  700,  176,  177,  856,  856,  179,  856,  176,  856,
-      698,  701,  856,  702,  699,  697,  176,  177,  176,  856,
-      179,  856,  176,  177,  856,  176,  179,  856,  856,  703,
-      176,  177,  856,  700,  179,  176,  177,  176,  856,  179,
-
-      176,  177,  856,  701,  179,  702,  699,  176,  177,  705,
-      856,  179,  856,  856,  856,  707,  176,  706,  176,  856,
-      856,  703,  856,  704,  176,  177,  176,  856,  179,  176,
-      177,  176,  177,  179,  176,  179,  856,  708,  856,  176,
-      177,  705,  711,  179,  856,  856,  856,  707,  176,  706,
-      856,  176,  177,  856,  176,  179,  856,  856,  710,  856,
-      176,  177,  176,  856,  179,  709,  856,  176,  856,  708,
-      856,  856,  176,  712,  711,  856,  176,  177,  856,  176,
-      179,  856,  176,  177,  856,  713,  179,  176,  177,  856,
-      710,  179,  856,  176,  177,  856,  176,  179,  176,  177,
-
-      856,  176,  179,  176,  856,  712,  856,  856,  176,  177,
-      714,  176,  179,  715,  856,  856,  856,  713,  856,  856,
-      856,  856,  856,  176,  856,  176,  244,  176,  177,  179,
-      856,  179,  176,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  714,  176,  177,  715,  725,  179,  176,  856,
-      856,  856,  856,  856,  176,  856,  856,  176,  177,  176,
-      856,  179,  856,  717,  856,  176,  856,  856,  856,  856,
-      176,  717,  717,  717,  717,  717,  717,  245,  725,  856,
-      176,  856,  856,  718,  856,  245,  245,  245,  245,  245,
-      245,  718,  718,  718,  718,  718,  718,  176,  856,  176,
-
-      856,  250,  856,  717,  717,  717,  717,  717,  717,  250,
-      250,  250,  250,  250,  250,  176,  856,  245,  245,  245,
-      245,  245,  245,  718,  718,  718,  718,  718,  718,  176,
-      856,  856,  856,  856,  176,  177,  856,  856,  179,  719,
-      856,  250,  250,  250,  250,  250,  250,  719,  719,  719,
-      719,  719,  719,  255,  176,  177,  856,  856,  179,  720,
-      727,  255,  255,  255,  255,  255,  255,  720,  720,  720,
-      720,  720,  720,  856,  176,  177,  856,  264,  179,  719,
-      719,  719,  719,  719,  719,  264,  264,  264,  264,  264,
-      264,  856,  727,  255,  255,  255,  255,  255,  255,  720,
-
-      720,  720,  720,  720,  720,  726,  176,  856,  176,  177,
-      176,  177,  179,  856,  179,  856,  856,  264,  264,  264,
-      264,  264,  264,  176,  177,  856,  176,  179,  176,  177,
-      176,  177,  179,  856,  179,  729,  856,  726,  728,  176,
-      177,  730,  856,  179,  176,  177,  176,  856,  179,  731,
-      176,  177,  176,  177,  179,  856,  179,  176,  177,  176,
-      177,  179,  856,  179,  732,  856,  733,  729,  176,  177,
-      728,  856,  179,  730,  176,  177,  734,  856,  179,  856,
-      176,  731,  176,  856,  176,  177,  856,  736,  179,  735,
-      176,  177,  856,  856,  179,  176,  732,  856,  733,  856,
-
-      176,  856,  176,  856,  737,  856,  738,  856,  734,  176,
-      177,  176,  856,  179,  176,  177,  176,  856,  179,  736,
-      856,  735,  176,  856,  176,  856,  176,  177,  739,  176,
-      179,  176,  856,  176,  177,  856,  737,  179,  738,  856,
-      176,  176,  177,  856,  740,  179,  176,  176,  177,  176,
-      177,  179,  741,  179,  176,  177,  176,  856,  179,  856,
-      739,  856,  176,  742,  176,  177,  856,  856,  179,  856,
-      176,  177,  856,  856,  179,  856,  740,  856,  176,  177,
-      856,  176,  179,  743,  741,  856,  176,  176,  177,  856,
-      856,  179,  744,  176,  177,  742,  856,  179,  176,  745,
-
-      746,  856,  176,  177,  856,  176,  179,  856,  747,  856,
-      176,  177,  856,  176,  179,  743,  176,  177,  856,  176,
-      179,  176,  856,  856,  744,  856,  176,  856,  856,  176,
-      177,  745,  746,  179,  176,  177,  176,  856,  179,  856,
-      747,  856,  176,  856,  748,  749,  856,  176,  177,  856,
-      176,  179,  856,  176,  177,  856,  856,  179,  856,  176,
-      856,  856,  856,  856,  750,  176,  176,  177,  856,  856,
-      179,  856,  751,  856,  176,  856,  748,  749,  856,  856,
-      856,  753,  176,  752,  856,  176,  177,  856,  176,  179,
-      176,  177,  856,  856,  179,  856,  750,  856,  754,  176,
-
-      177,  176,  856,  179,  751,  856,  176,  176,  177,  755,
-      856,  179,  856,  753,  856,  752,  856,  856,  856,  176,
-      176,  177,  856,  756,  179,  176,  856,  856,  856,  757,
-      754,  176,  177,  856,  856,  179,  176,  177,  176,  856,
-      179,  755,  758,  176,  177,  176,  177,  179,  856,  179,
-      856,  856,  856,  856,  856,  756,  856,  176,  856,  176,
-      244,  757,  176,  179,  760,  856,  759,  856,  176,  177,
-      856,  176,  179,  761,  758,  856,  856,  856,  763,  176,
-      856,  176,  177,  856,  856,  179,  763,  763,  763,  763,
-      763,  763,  176,  856,  856,  856,  760,  856,  759,  856,
-
-      856,  764,  856,  176,  856,  761,  768,  856,  176,  764,
-      764,  764,  764,  764,  764,  176,  765,  176,  763,  763,
-      763,  763,  763,  763,  765,  765,  765,  765,  765,  765,
-      856,  176,  176,  177,  856,  856,  179,  856,  768,  766,
-      176,  764,  764,  764,  764,  764,  764,  766,  766,  766,
-      766,  766,  766,  176,  856,  856,  765,  765,  765,  765,
-      765,  765,  176,  177,  176,  177,  179,  856,  179,  856,
-      176,  177,  176,  177,  179,  769,  179,  856,  856,  766,
-      766,  766,  766,  766,  766,  770,  856,  771,  176,  177,
-      856,  856,  179,  856,  772,  176,  177,  176,  177,  179,
-
-      856,  179,  176,  177,  176,  856,  179,  769,  856,  856,
-      856,  856,  176,  177,  775,  776,  179,  770,  856,  771,
-      773,  774,  856,  777,  856,  856,  772,  176,  177,  176,
-      177,  179,  856,  179,  176,  856,  176,  176,  177,  856,
-      778,  179,  176,  856,  176,  856,  775,  776,  856,  856,
-      176,  177,  773,  774,  179,  777,  856,  176,  177,  856,
-      176,  179,  176,  177,  176,  177,  179,  176,  179,  176,
-      856,  856,  778,  856,  176,  856,  856,  176,  177,  779,
-      780,  179,  176,  177,  176,  856,  179,  176,  177,  176,
-      177,  179,  856,  179,  176,  177,  856,  856,  179,  176,
-
-      781,  176,  856,  856,  176,  177,  783,  856,  179,  176,
-      856,  779,  780,  176,  177,  176,  177,  179,  856,  179,
-      176,  177,  176,  782,  179,  856,  856,  176,  177,  176,
-      856,  179,  781,  784,  176,  856,  176,  856,  783,  786,
-      856,  785,  176,  177,  176,  177,  179,  856,  179,  176,
-      856,  176,  177,  856,  176,  179,  787,  856,  856,  176,
-      856,  176,  856,  176,  177,  784,  176,  179,  789,  856,
-      856,  786,  788,  785,  176,  177,  176,  794,  179,  856,
-      791,  856,  176,  177,  856,  176,  179,  176,  787,  176,
-      177,  856,  176,  179,  856,  793,  790,  176,  177,  176,
-
-      789,  179,  176,  177,  788,  856,  179,  856,  856,  794,
-      856,  856,  791,  856,  176,  856,  176,  795,  856,  856,
-      856,  801,  856,  176,  856,  176,  177,  793,  790,  179,
-      792,  856,  856,  856,  856,  176,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  176,  796,  856,  795,
-      856,  856,  856,  801,  176,  796,  796,  796,  796,  796,
-      796,  176,  856,  856,  856,  856,  856,  797,  856,  176,
-      856,  856,  856,  798,  176,  797,  797,  797,  797,  797,
-      797,  798,  798,  798,  798,  798,  798,  796,  796,  796,
-      796,  796,  796,  799,  176,  177,  856,  176,  179,  856,
-
-      856,  799,  799,  799,  799,  799,  799,  797,  797,  797,
-      797,  797,  797,  798,  798,  798,  798,  798,  798,  176,
-      177,  176,  177,  179,  802,  179,  176,  177,  176,  177,
-      179,  856,  179,  799,  799,  799,  799,  799,  799,  176,
-      177,  803,  856,  179,  856,  176,  177,  176,  177,  179,
-      856,  179,  856,  856,  804,  856,  802,  176,  177,  856,
-      805,  179,  856,  176,  177,  856,  176,  179,  856,  806,
-      176,  177,  856,  803,  179,  807,  856,  176,  177,  176,
-      177,  179,  856,  179,  856,  856,  804,  856,  856,  856,
-      856,  176,  805,  176,  808,  176,  177,  856,  176,  179,
-
-      176,  806,  176,  177,  176,  177,  179,  807,  179,  176,
-      177,  176,  856,  179,  176,  177,  856,  176,  179,  176,
-      809,  810,  856,  856,  811,  812,  808,  176,  177,  176,
-      856,  179,  176,  177,  813,  176,  179,  856,  856,  176,
-      177,  814,  176,  179,  856,  817,  816,  856,  856,  176,
-      818,  176,  809,  810,  856,  815,  811,  812,  176,  177,
-      176,  177,  179,  856,  179,  856,  813,  176,  176,  177,
-      856,  819,  179,  814,  176,  856,  176,  817,  816,  176,
-      177,  176,  818,  179,  176,  177,  176,  856,  179,  856,
-      820,  856,  176,  177,  821,  856,  179,  856,  856,  176,
-
-      856,  856,  856,  819,  176,  176,  177,  856,  856,  179,
-      856,  176,  856,  822,  176,  177,  176,  177,  179,  856,
-      179,  856,  820,  856,  856,  823,  821,  856,  856,  856,
-      176,  856,  176,  823,  823,  823,  823,  823,  823,  856,
-      176,  856,  176,  177,  856,  822,  179,  856,  856,  824,
-      856,  176,  856,  856,  856,  856,  176,  824,  824,  824,
-      824,  824,  824,  825,  176,  823,  823,  823,  823,  823,
-      823,  825,  825,  825,  825,  825,  825,  176,  176,  177,
-      176,  177,  179,  856,  179,  856,  176,  826,  176,  824,
-      824,  824,  824,  824,  824,  826,  826,  826,  826,  826,
-
-      826,  856,  856,  825,  825,  825,  825,  825,  825,  176,
-      177,  176,  177,  179,  176,  179,  176,  177,  176,  177,
-      179,  856,  179,  827,  856,  856,  828,  826,  826,  826,
-      826,  826,  826,  856,  176,  177,  856,  856,  179,  176,
-      177,  176,  177,  179,  856,  179,  856,  176,  177,  856,
-      176,  179,  176,  830,  832,  827,  856,  856,  828,  829,
-      831,  856,  856,  856,  176,  177,  176,  177,  179,  856,
-      179,  856,  833,  856,  176,  177,  176,  177,  179,  856,
-      179,  176,  856,  176,  856,  830,  832,  856,  176,  834,
-      176,  836,  831,  176,  177,  856,  835,  179,  176,  177,
-
-      856,  856,  179,  856,  833,  837,  176,  856,  838,  856,
-      856,  176,  856,  176,  176,  177,  176,  177,  179,  176,
-      179,  834,  856,  836,  856,  856,  839,  856,  835,  856,
-      856,  176,  177,  856,  856,  179,  176,  837,  176,  856,
-      838,  856,  856,  856,  840,  856,  176,  856,  176,  176,
-      177,  245,  856,  179,  856,  856,  856,  856,  839,  245,
-      245,  245,  245,  245,  245,  176,  856,  856,  856,  250,
-      176,  176,  177,  856,  842,  179,  840,  250,  250,  250,
-      250,  250,  250,  176,  177,  856,  176,  179,  176,  255,
-      856,  245,  245,  245,  245,  245,  245,  255,  255,  255,
-
-      255,  255,  255,  176,  856,  856,  842,  264,  844,  250,
-      250,  250,  250,  250,  250,  264,  264,  264,  264,  264,
-      264,  176,  176,  177,  176,  177,  179,  856,  179,  255,
-      255,  255,  255,  255,  255,  176,  177,  176,  177,  179,
-      844,  179,  856,  176,  856,  856,  845,  264,  264,  264,
-      264,  264,  264,  841,  856,  176,  176,  177,  176,  177,
-      179,  846,  179,  176,  177,  843,  856,  179,  176,  177,
-      176,  177,  179,  856,  179,  176,  177,  856,  845,  179,
-      176,  177,  176,  177,  179,  841,  179,  176,  177,  856,
-      856,  179,  847,  846,  176,  856,  176,  843,  856,  176,
-
-      177,  856,  856,  179,  176,  177,  856,  176,  179,  176,
-      856,  848,  176,  177,  856,  856,  179,  856,  176,  177,
-      856,  856,  179,  849,  847,  856,  850,  856,  176,  856,
-      176,  856,  176,  177,  856,  176,  179,  176,  177,  856,
-      176,  179,  176,  851,  176,  177,  856,  176,  179,  176,
-      177,  856,  176,  179,  176,  849,  176,  177,  850,  176,
-      179,  853,  176,  177,  176,  177,  179,  856,  179,  856,
-      856,  176,  856,  856,  856,  851,  176,  856,  854,  852,
-      856,  856,  856,  856,  176,  856,  856,  856,  856,  856,
-      176,  856,  856,  853,  856,  856,  856,  855,  856,  856,
-
-      856,  856,  856,  856,  176,  856,  856,  856,  856,  176,
-      854,  852,  856,  856,  856,  856,  176,  856,  856,  856,
-      856,  176,  856,  856,  856,  856,  856,  856,  176,  855,
-      856,  856,  856,  856,  176,  856,  176,   28,   28,   28,
+      311,  311,  311,  311,  311,  311,  311,  311,  311,  311,
+      311,  311,  311,  311,  311,  281,  279,  279,  147,  312,
+
+      146,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  176,  177,  176,
+      177,  179,  176,  179,  176,  177,  176,  177,  179,  276,
+      179,  275,  176,  177,  321,  147,  179,  326,  146,  323,
+      147,  327,  146,  324,  268,  176,  177,  176,  177,  179,
+      268,  179,  259,  259,  253,  325,  328,  176,  177,  253,
+      330,  179,  252,  329,  176,  177,  321,  248,  179,  326,
+      248,  323,  247,  327,  244,  324,  393,  331,  176,  177,
+      176,  177,  179,  240,  179,  171,  336,  325,  328,  176,
+
+      163,  176,  330,  162,  332,  329,  176,  161,  176,  160,
+      333,  158,  679,  148,  176,  337,  334,  335,  393,  331,
+      147,  176,  177,  176,  245,  179,  176,  176,  336,  176,
+      147,  176,  177,  146,  338,  179,  332,  176,  177,  176,
+      339,  179,  333,  881,  881,  881,  176,  337,  334,  335,
+      176,  177,  881,  340,  179,  881,  881,  176,  177,  341,
+      176,  179,  176,  176,  177,  881,  338,  179,  881,  176,
+      177,  881,  339,  179,  344,  342,  176,  177,  881,  881,
+      179,  343,  176,  177,  347,  340,  179,  881,  345,  881,
+      881,  341,  881,  176,  881,  176,  349,  881,  350,  881,
+
+      176,  177,  348,  176,  179,  881,  344,  342,  881,  176,
+      881,  351,  352,  343,  176,  177,  347,  881,  179,  353,
+      345,  881,  176,  260,  261,  881,  881,  881,  349,  176,
+      350,  420,  881,  881,  348,  176,  176,  177,  359,  881,
+      179,  176,  881,  351,  352,  881,  176,  177,  176,  881,
+      179,  353,  881,  881,  176,  881,  881,  360,  881,  361,
+      176,  177,  881,  881,  179,  881,  362,  881,  370,  881,
+      359,  363,  176,  176,  177,  258,  881,  179,  176,  177,
+      881,  881,  179,  176,  177,  354,  176,  179,  881,  360,
+      881,  361,  355,  881,  881,  356,  881,  368,  362,  881,
+
+      370,  357,  367,  363,  358,  176,  177,  881,  176,  179,
+      176,  177,  176,  177,  179,  881,  179,  354,  176,  176,
+      177,  176,  177,  179,  355,  179,  364,  356,  881,  368,
+      881,  365,  176,  357,  367,  369,  358,  374,  881,  366,
+      371,  372,  176,  177,  881,  176,  179,  881,  176,  177,
+      176,  881,  179,  881,  881,  176,  176,  177,  364,  881,
+      179,  881,  373,  365,  176,  177,  881,  369,  179,  374,
+      376,  366,  371,  372,  881,  881,  881,  176,  375,  377,
+      881,  881,  176,  881,  176,  881,  176,  177,  176,  177,
+      179,  176,  179,  176,  373,  176,  177,  378,  881,  179,
+
+      176,  177,  376,  881,  179,  881,  881,  881,  881,  379,
+      375,  377,  380,  383,  176,  176,  177,  176,  177,  179,
+      176,  179,  881,  382,  881,  381,  881,  881,  176,  378,
+      176,  177,  881,  881,  179,  881,  176,  384,  881,  386,
+      881,  379,  881,  385,  380,  383,  387,  881,  176,  177,
+      176,  177,  179,  881,  179,  382,  881,  381,  176,  881,
+      176,  388,  176,  177,  176,  177,  179,  176,  179,  384,
+      881,  386,  176,  389,  391,  385,  390,  881,  387,  881,
+      881,  881,  881,  408,  394,  392,  881,  176,  881,  176,
+      176,  177,  881,  388,  179,  176,  177,  881,  881,  179,
+
+      881,  395,  176,  881,  881,  389,  391,  406,  390,  176,
+      177,  881,  881,  179,  407,  408,  394,  392,  881,  881,
+      176,  396,  176,  881,  409,  881,  881,  176,  177,  881,
+      881,  179,  881,  395,  176,  881,  176,  176,  177,  406,
+      881,  179,  881,  176,  177,  881,  407,  179,  881,  881,
+      176,  177,  881,  396,  179,  881,  409,  410,  463,  411,
+      881,  881,  176,  397,  398,  399,  400,  176,  881,  401,
+      881,  246,  881,  402,  403,  404,  246,  881,  881,  405,
+      178,  176,  176,  177,  176,  177,  179,  881,  179,  410,
+      463,  411,  881,  881,  881,  397,  398,  399,  400,  176,
+
+      881,  401,  881,  881,  881,  402,  403,  404,  881,  176,
+      881,  405,  178,  249,  881,  176,  881,  176,  177,  881,
+      246,  179,  176,  415,  881,  246,  246,  881,  881,  881,
+      246,  415,  415,  415,  415,  415,  415,  881,  246,  416,
+      881,  881,  246,  881,  246,  250,  246,  416,  416,  416,
+      416,  416,  416,  251,  176,  881,  176,  881,  251,  881,
+      881,  881,  881,  415,  415,  415,  415,  415,  415,  881,
+      176,  177,  176,  177,  179,  881,  179,  881,  881,  416,
+      416,  416,  416,  416,  416,  881,  881,  464,  881,  176,
+      881,  881,  881,  485,  881,  254,  176,  177,  881,  881,
+
+      179,  881,  251,  881,  881,  417,  881,  251,  251,  881,
+      881,  465,  251,  417,  417,  417,  417,  417,  417,  464,
+      251,  418,  881,  881,  251,  485,  251,  255,  251,  418,
+      418,  418,  418,  418,  418,  256,  881,  881,  881,  881,
+      256,  881,  176,  465,  176,  417,  417,  417,  417,  417,
+      417,  176,  177,  881,  881,  179,  881,  881,  881,  881,
+      881,  418,  418,  418,  418,  418,  418,  881,  176,  176,
+      177,  881,  881,  179,  881,  467,  881,  263,  176,  177,
+      881,  881,  179,  881,  256,  881,  881,  421,  881,  256,
+      256,  881,  466,  471,  256,  421,  421,  421,  421,  421,
+
+      421,  881,  256,  422,  881,  881,  256,  467,  256,  264,
+      256,  422,  422,  422,  422,  422,  422,  265,  881,  881,
+      881,  881,  265,  176,  466,  471,  881,  421,  421,  421,
+      421,  421,  421,  881,  176,  177,  176,  177,  179,  881,
+      179,  176,  881,  422,  422,  422,  422,  422,  422,  881,
+      176,  476,  176,  177,  881,  881,  179,  881,  881,  272,
+      176,  177,  881,  881,  179,  881,  265,  477,  881,  425,
+      881,  265,  265,  881,  881,  881,  265,  425,  425,  425,
+      425,  425,  425,  476,  265,  426,  881,  881,  265,  468,
+      265,  273,  265,  426,  426,  426,  426,  426,  426,  477,
+
+      176,  177,  881,  881,  179,  881,  176,  881,  176,  425,
+      425,  425,  425,  425,  425,  881,  881,  881,  881,  881,
+      881,  468,  881,  881,  176,  426,  426,  426,  426,  426,
+      426,  444,  176,  445,  446,  881,  881,  881,  881,  881,
+      881,  447,  447,  447,  447,  447,  447,  447,  447,  447,
+      447,  447,  447,  447,  447,  447,  447,  447,  447,  447,
+      447,  447,  447,  447,  447,  447,  447,  881,  881,  881,
+      881,  445,  176,  445,  445,  445,  445,  445,  445,  445,
+      445,  445,  445,  445,  445,  445,  445,  445,  445,  445,
+      445,  445,  445,  445,  445,  445,  445,  445,  445,  881,
+
+      881,  176,  177,  881,  881,  179,  445,  445,  445,  445,
+      445,  445,  445,  445,  445,  445,  445,  445,  445,  445,
+      445,  445,  445,  445,  445,  445,  445,  445,  445,  445,
+      445,  445,  453,  881,  454,  455,  881,  881,  881,  881,
+      881,  881,  456,  456,  456,  456,  456,  456,  456,  456,
+      456,  456,  456,  456,  456,  456,  456,  456,  456,  456,
+      456,  456,  456,  456,  456,  456,  456,  456,  881,  881,
+      881,  881,  454,  176,  454,  454,  454,  454,  454,  454,
+      454,  454,  454,  454,  454,  454,  454,  454,  454,  454,
+      454,  454,  454,  454,  454,  454,  454,  454,  454,  454,
+
+      881,  881,  881,  881,  881,  881,  881,  454,  454,  454,
+      454,  454,  454,  454,  454,  454,  454,  454,  454,  454,
+      454,  454,  454,  454,  454,  454,  454,  454,  454,  454,
+      454,  454,  454,  176,  177,  176,  177,  179,  881,  179,
+      881,  176,  177,  881,  469,  179,  176,  177,  881,  881,
+      179,  881,  472,  881,  881,  176,  177,  473,  881,  179,
+      881,  176,  177,  881,  470,  179,  474,  176,  177,  176,
+      177,  179,  881,  179,  475,  881,  469,  176,  177,  881,
+      478,  179,  176,  177,  472,  881,  179,  881,  881,  473,
+      881,  479,  881,  176,  177,  881,  470,  179,  474,  484,
+
+      881,  881,  881,  480,  481,  176,  475,  176,  881,  881,
+      881,  881,  478,  176,  881,  176,  177,  881,  176,  179,
+      881,  176,  177,  479,  488,  179,  881,  176,  881,  881,
+      881,  484,  881,  176,  881,  480,  481,  881,  881,  176,
+      881,  176,  176,  177,  482,  881,  179,  176,  177,  176,
+      483,  179,  881,  881,  176,  881,  488,  881,  176,  177,
+      486,  881,  179,  881,  881,  176,  176,  177,  487,  881,
+      179,  176,  177,  881,  881,  179,  482,  489,  881,  176,
+      177,  881,  483,  179,  176,  177,  491,  176,  179,  881,
+      490,  881,  486,  176,  492,  881,  881,  176,  177,  493,
+
+      487,  179,  176,  177,  881,  881,  179,  176,  177,  489,
+      881,  179,  881,  881,  176,  881,  176,  177,  491,  176,
+      179,  881,  490,  881,  881,  496,  492,  494,  881,  495,
+      176,  493,  881,  176,  177,  497,  881,  179,  176,  881,
+      176,  177,  881,  176,  179,  176,  177,  881,  498,  179,
+      881,  176,  881,  881,  176,  177,  176,  496,  179,  494,
+      881,  495,  500,  881,  881,  881,  881,  497,  499,  176,
+      881,  176,  177,  881,  176,  179,  881,  176,  177,  176,
+      498,  179,  881,  176,  177,  881,  501,  179,  176,  176,
+      177,  176,  177,  179,  500,  179,  502,  881,  503,  881,
+
+      499,  881,  881,  504,  881,  176,  505,  176,  177,  176,
+      177,  179,  176,  179,  881,  176,  177,  176,  501,  179,
+      176,  177,  508,  881,  179,  881,  176,  881,  502,  509,
+      503,  881,  176,  177,  507,  504,  179,  881,  505,  881,
+      506,  881,  881,  176,  176,  177,  176,  177,  179,  176,
+      179,  514,  176,  177,  508,  176,  179,  881,  176,  177,
+      881,  176,  179,  176,  881,  881,  507,  511,  510,  881,
+      881,  881,  506,  176,  177,  881,  881,  179,  881,  176,
+      881,  176,  881,  514,  881,  512,  881,  176,  881,  519,
+      176,  177,  176,  881,  179,  881,  881,  176,  177,  511,
+
+      510,  179,  513,  881,  176,  515,  176,  177,  176,  177,
+      179,  518,  179,  881,  881,  881,  176,  512,  176,  881,
+      516,  519,  517,  520,  176,  176,  177,  176,  177,  179,
+      176,  179,  176,  177,  513,  881,  179,  515,  881,  881,
+      176,  177,  522,  518,  179,  176,  176,  177,  881,  881,
+      179,  881,  516,  881,  517,  520,  521,  881,  881,  881,
+      523,  524,  176,  176,  177,  881,  881,  179,  881,  176,
+      527,  881,  176,  177,  522,  881,  179,  881,  176,  881,
+      176,  176,  177,  881,  881,  179,  881,  526,  521,  881,
+      176,  177,  523,  524,  179,  525,  881,  176,  881,  176,
+
+      881,  881,  527,  881,  176,  881,  176,  177,  881,  528,
+      179,  881,  176,  176,  177,  881,  881,  179,  176,  526,
+      176,  177,  881,  881,  179,  881,  530,  525,  176,  177,
+      881,  881,  179,  531,  529,  176,  881,  881,  881,  176,
+      177,  528,  881,  179,  176,  176,  177,  176,  177,  179,
+      532,  179,  881,  176,  881,  176,  177,  881,  530,  179,
+      176,  177,  176,  881,  179,  531,  529,  881,  881,  533,
+      535,  534,  176,  177,  881,  881,  179,  881,  176,  881,
+      536,  881,  532,  881,  538,  176,  176,  177,  881,  881,
+      179,  537,  176,  881,  539,  176,  177,  881,  881,  179,
+
+      176,  533,  535,  534,  881,  540,  176,  177,  881,  881,
+      179,  176,  536,  881,  176,  177,  538,  176,  179,  176,
+      544,  881,  881,  537,  881,  542,  539,  176,  881,  881,
+      541,  881,  176,  543,  881,  176,  177,  540,  881,  179,
+      881,  176,  177,  881,  176,  179,  881,  176,  177,  176,
+      177,  179,  544,  179,  881,  881,  881,  542,  176,  546,
+      176,  177,  541,  881,  179,  543,  545,  176,  881,  176,
+      177,  547,  548,  179,  549,  176,  177,  881,  176,  179,
+      881,  176,  177,  881,  550,  179,  176,  881,  881,  881,
+      881,  546,  881,  552,  881,  881,  881,  551,  545,  881,
+
+      881,  176,  582,  547,  548,  179,  549,  176,  881,  881,
+      881,  881,  881,  176,  881,  881,  550,  881,  881,  176,
+      881,  176,  881,  881,  881,  552,  557,  176,  315,  551,
+      881,  179,  176,  881,  557,  557,  557,  557,  557,  557,
+      881,  176,  881,  881,  881,  881,  558,  176,  881,  881,
+      881,  881,  559,  176,  558,  558,  558,  558,  558,  558,
+      559,  559,  559,  559,  559,  559,  557,  557,  557,  557,
+      557,  557,  560,  176,  176,  177,  881,  881,  179,  881,
+      560,  560,  560,  560,  560,  560,  558,  558,  558,  558,
+      558,  558,  559,  559,  559,  559,  559,  559,  561,  176,
+
+      176,  177,  881,  881,  179,  881,  561,  561,  561,  561,
+      561,  561,  560,  560,  560,  560,  560,  560,  562,  176,
+      177,  881,  881,  179,  563,  881,  562,  562,  562,  562,
+      562,  562,  563,  563,  563,  563,  563,  563,  561,  561,
+      561,  561,  561,  561,  564,  881,  176,  584,  881,  881,
+      881,  881,  564,  564,  564,  564,  564,  564,  562,  562,
+      562,  562,  562,  562,  563,  563,  563,  563,  563,  563,
+      881,  881,  176,  881,  881,  881,  881,  881,  881,  584,
+      881,  881,  881,  881,  564,  564,  564,  564,  564,  564,
+      444,  176,  881,  446,  881,  176,  177,  881,  881,  179,
+
+      447,  447,  447,  447,  447,  447,  447,  447,  447,  447,
+      447,  447,  447,  447,  447,  447,  447,  447,  447,  447,
+      447,  447,  447,  447,  447,  447,  453,  881,  881,  455,
+      881,  881,  881,  881,  881,  881,  456,  456,  456,  456,
+      456,  456,  456,  456,  456,  456,  456,  456,  456,  456,
+      456,  456,  456,  456,  456,  456,  456,  456,  456,  456,
+      456,  456,  176,  177,  176,  177,  179,  176,  179,  881,
+      176,  177,  176,  177,  179,  585,  179,  176,  177,  881,
+      881,  179,  881,  586,  587,  881,  881,  881,  176,  177,
+      176,  177,  179,  881,  179,  176,  177,  881,  881,  179,
+
+      881,  588,  176,  177,  881,  589,  179,  585,  176,  177,
+      176,  177,  179,  881,  179,  586,  587,  881,  590,  881,
+      591,  881,  176,  177,  881,  592,  179,  176,  177,  881,
+      881,  179,  593,  588,  176,  881,  176,  589,  881,  594,
+      596,  881,  176,  597,  176,  881,  595,  176,  177,  176,
+      590,  179,  591,  881,  881,  176,  177,  592,  881,  179,
+      176,  881,  176,  881,  593,  881,  599,  176,  881,  176,
+      177,  594,  596,  179,  176,  597,  881,  881,  595,  881,
+      176,  881,  176,  598,  176,  177,  176,  177,  179,  881,
+      179,  176,  177,  881,  176,  179,  881,  881,  599,  176,
+
+      600,  602,  881,  881,  176,  177,  603,  881,  179,  881,
+      881,  881,  176,  177,  601,  598,  179,  176,  177,  176,
+      881,  179,  176,  177,  176,  177,  179,  176,  179,  881,
+      605,  881,  600,  602,  604,  176,  177,  881,  603,  179,
+      881,  176,  881,  606,  881,  881,  601,  881,  607,  176,
+      177,  176,  177,  179,  881,  179,  176,  881,  176,  881,
+      176,  177,  605,  176,  179,  608,  604,  176,  177,  881,
+      881,  179,  881,  176,  177,  606,  176,  179,  612,  610,
+      607,  176,  177,  609,  176,  179,  176,  177,  611,  176,
+      179,  881,  613,  881,  176,  881,  176,  608,  176,  177,
+
+      176,  177,  179,  881,  179,  176,  177,  176,  881,  179,
+      612,  610,  881,  881,  615,  609,  614,  881,  881,  616,
+      611,  176,  881,  176,  613,  176,  177,  881,  617,  179,
+      881,  881,  176,  176,  177,  881,  881,  179,  881,  176,
+      176,  177,  881,  881,  179,  176,  615,  881,  614,  881,
+      881,  616,  881,  176,  881,  618,  881,  881,  176,  881,
+      617,  619,  176,  177,  881,  881,  179,  176,  177,  881,
+      176,  179,  176,  881,  176,  177,  881,  176,  179,  881,
+      176,  177,  176,  177,  179,  881,  179,  618,  176,  177,
+      621,  881,  179,  619,  622,  881,  620,  176,  176,  177,
+
+      881,  624,  179,  176,  177,  176,  881,  179,  881,  625,
+      176,  177,  176,  881,  179,  881,  176,  177,  626,  881,
+      179,  881,  621,  176,  177,  881,  622,  179,  620,  881,
+      881,  881,  881,  624,  176,  627,  176,  177,  881,  176,
+      179,  625,  629,  881,  628,  881,  176,  176,  177,  881,
+      626,  179,  176,  881,  176,  630,  881,  881,  176,  177,
+      176,  881,  179,  881,  881,  176,  177,  627,  881,  179,
+      176,  631,  881,  881,  629,  176,  628,  176,  177,  176,
+      177,  179,  176,  179,  881,  176,  177,  630,  176,  179,
+      881,  881,  636,  176,  177,  176,  881,  179,  881,  632,
+
+      881,  176,  177,  631,  881,  179,  637,  633,  176,  881,
+      176,  177,  176,  177,  179,  634,  179,  176,  177,  176,
+      638,  179,  881,  881,  636,  881,  635,  881,  641,  881,
+      176,  632,  176,  177,  639,  881,  179,  176,  637,  633,
+      176,  177,  176,  177,  179,  640,  179,  634,  881,  176,
+      881,  176,  638,  881,  176,  177,  881,  176,  179,  881,
+      641,  881,  642,  176,  177,  176,  639,  179,  881,  643,
+      176,  177,  881,  176,  179,  176,  177,  640,  644,  179,
+      881,  881,  176,  881,  176,  881,  881,  176,  177,  176,
+      881,  179,  176,  177,  642,  881,  179,  881,  881,  645,
+
+      646,  643,  176,  177,  176,  881,  179,  176,  177,  881,
+      644,  179,  176,  881,  176,  881,  649,  881,  176,  177,
+      647,  648,  179,  881,  176,  177,  176,  881,  179,  176,
+      177,  645,  646,  179,  881,  176,  881,  650,  881,  176,
+      177,  881,  176,  179,  657,  176,  177,  176,  649,  179,
+      176,  177,  647,  648,  179,  881,  176,  177,  881,  176,
+      179,  881,  881,  651,  176,  654,  176,  177,  881,  650,
+      179,  881,  881,  881,  176,  655,  657,  176,  177,  176,
+      653,  179,  881,  881,  652,  176,  177,  881,  881,  179,
+      176,  656,  881,  176,  177,  651,  176,  179,  176,  177,
+
+      881,  176,  179,  881,  881,  881,  881,  655,  658,  659,
+      660,  176,  653,  661,  176,  177,  652,  176,  179,  881,
+      881,  881,  176,  656,  881,  881,  881,  881,  176,  881,
+      176,  582,  881,  881,  179,  881,  881,  881,  176,  881,
+      658,  659,  660,  881,  881,  661,  881,  881,  881,  176,
+      664,  881,  176,  177,  881,  881,  179,  176,  664,  664,
+      664,  664,  664,  664,  665,  176,  881,  881,  881,  881,
+      176,  666,  665,  665,  665,  665,  665,  665,  881,  666,
+      666,  666,  666,  666,  666,  881,  176,  881,  667,  881,
+      664,  664,  664,  664,  664,  664,  667,  667,  667,  667,
+
+      667,  667,  176,  881,  665,  665,  665,  665,  665,  665,
+      668,  666,  666,  666,  666,  666,  666,  881,  668,  668,
+      668,  668,  668,  668,  176,  881,  669,  881,  667,  667,
+      667,  667,  667,  667,  669,  669,  669,  669,  669,  669,
+      881,  176,  177,  176,  177,  179,  881,  179,  670,  881,
+      668,  668,  668,  668,  668,  668,  670,  670,  670,  670,
+      670,  670,  881,  881,  671,  682,  669,  669,  669,  669,
+      669,  669,  671,  671,  671,  671,  671,  671,  176,  177,
+      176,  177,  179,  881,  179,  881,  881,  881,  670,  670,
+      670,  670,  670,  670,  176,  177,  881,  682,  179,  176,
+
+      177,  881,  881,  179,  671,  671,  671,  671,  671,  671,
+      681,  881,  881,  176,  881,  176,  176,  177,  176,  177,
+      179,  881,  179,  881,  881,  176,  177,  683,  881,  179,
+      881,  176,  177,  684,  881,  179,  176,  177,  881,  881,
+      179,  881,  681,  176,  177,  176,  177,  179,  881,  179,
+      176,  687,  176,  686,  176,  177,  881,  881,  179,  683,
+      685,  881,  881,  881,  689,  684,  176,  881,  881,  688,
+      881,  176,  881,  881,  176,  177,  176,  177,  179,  881,
+      179,  881,  881,  687,  881,  686,  881,  881,  176,  881,
+      176,  881,  685,  881,  881,  881,  689,  176,  690,  881,
+
+      881,  688,  881,  176,  881,  691,  176,  177,  176,  881,
+      179,  881,  176,  177,  881,  176,  179,  176,  881,  176,
+      177,  176,  177,  179,  881,  179,  176,  176,  177,  881,
+      690,  179,  176,  177,  881,  692,  179,  691,  176,  177,
+      694,  881,  179,  881,  881,  881,  176,  693,  176,  176,
+      177,  881,  881,  179,  881,  695,  176,  177,  176,  177,
+      179,  881,  179,  881,  881,  176,  177,  692,  696,  179,
+      176,  177,  694,  697,  179,  881,  176,  177,  176,  693,
+      179,  881,  176,  177,  176,  881,  179,  695,  176,  177,
+      881,  176,  179,  176,  699,  698,  881,  700,  881,  176,
+
+      696,  881,  176,  177,  176,  697,  179,  176,  177,  881,
+      176,  179,  176,  177,  881,  881,  179,  881,  701,  176,
+      177,  176,  881,  179,  881,  881,  699,  698,  176,  700,
+      176,  881,  176,  177,  176,  177,  179,  176,  179,  881,
+      176,  177,  176,  702,  179,  176,  177,  881,  176,  179,
+      701,  176,  177,  881,  176,  179,  881,  881,  176,  177,
+      176,  881,  179,  176,  177,  881,  881,  179,  881,  703,
+      881,  881,  176,  177,  176,  702,  179,  881,  881,  176,
+      881,  705,  706,  881,  176,  881,  176,  177,  176,  177,
+      179,  176,  179,  707,  176,  177,  708,  881,  179,  709,
+
+      881,  703,  881,  881,  176,  881,  176,  176,  177,  711,
+      881,  179,  176,  705,  706,  176,  177,  176,  881,  179,
+      176,  177,  710,  176,  179,  707,  881,  881,  708,  881,
+      176,  709,  881,  176,  177,  176,  881,  179,  881,  712,
+      881,  711,  176,  177,  176,  881,  179,  881,  713,  881,
+      881,  176,  177,  714,  710,  179,  881,  881,  176,  881,
+      176,  715,  881,  176,  177,  881,  176,  179,  176,  177,
+      881,  712,  179,  176,  177,  881,  717,  179,  881,  176,
+      713,  716,  176,  177,  881,  714,  179,  176,  719,  176,
+      177,  881,  176,  179,  881,  881,  881,  881,  718,  720,
+
+      721,  881,  176,  177,  881,  176,  179,  881,  717,  881,
+      881,  881,  881,  716,  176,  722,  881,  176,  177,  881,
+      719,  179,  881,  176,  176,  177,  881,  881,  179,  881,
+      718,  720,  721,  176,  177,  176,  881,  179,  176,  177,
+      176,  881,  179,  724,  881,  176,  881,  722,  176,  177,
+      881,  881,  179,  726,  176,  725,  176,  177,  723,  881,
+      179,  176,  176,  177,  881,  881,  179,  881,  176,  177,
+      881,  881,  179,  881,  176,  724,  881,  729,  881,  730,
+      176,  177,  881,  881,  179,  726,  727,  725,  881,  176,
+      176,  177,  881,  881,  179,  881,  176,  881,  176,  177,
+
+      176,  177,  179,  728,  179,  176,  881,  881,  881,  729,
+      176,  730,  881,  731,  881,  176,  177,  881,  727,  179,
+      176,  881,  176,  177,  881,  732,  179,  881,  176,  176,
+      177,  176,  177,  179,  176,  179,  881,  176,  177,  881,
+      176,  179,  881,  733,  881,  731,  176,  177,  734,  881,
+      179,  881,  176,  735,  881,  737,  881,  732,  881,  881,
+      881,  881,  176,  737,  737,  737,  737,  737,  737,  881,
+      176,  881,  176,  881,  881,  733,  881,  881,  881,  881,
+      734,  881,  176,  245,  881,  735,  179,  176,  881,  881,
+      881,  881,  881,  881,  176,  737,  737,  737,  737,  737,
+
+      737,  176,  246,  176,  176,  177,  881,  881,  179,  176,
+      246,  246,  246,  246,  246,  246,  738,  881,  176,  881,
+      881,  881,  251,  745,  738,  738,  738,  738,  738,  738,
+      251,  251,  251,  251,  251,  251,  881,  881,  881,  881,
+      739,  881,  246,  246,  246,  246,  246,  246,  739,  739,
+      739,  739,  739,  739,  176,  745,  738,  738,  738,  738,
+      738,  738,  251,  251,  251,  251,  251,  251,  881,  881,
+      881,  881,  881,  176,  177,  881,  176,  179,  256,  881,
+      739,  739,  739,  739,  739,  739,  256,  256,  256,  256,
+      256,  256,  740,  176,  177,  176,  177,  179,  265,  179,
+
+      740,  740,  740,  740,  740,  740,  265,  265,  265,  265,
+      265,  265,  746,  176,  177,  881,  881,  179,  256,  256,
+      256,  256,  256,  256,  747,  176,  177,  176,  177,  179,
+      881,  179,  740,  740,  740,  740,  740,  740,  265,  265,
+      265,  265,  265,  265,  746,  176,  176,  177,  176,  177,
+      179,  748,  179,  881,  881,  881,  747,  749,  176,  177,
+      750,  881,  179,  881,  881,  176,  881,  176,  176,  177,
+      881,  751,  179,  176,  177,  176,  177,  179,  881,  179,
+      176,  177,  881,  748,  179,  176,  881,  752,  881,  749,
+      176,  177,  750,  881,  179,  881,  881,  176,  881,  176,
+
+      176,  177,  881,  751,  179,  753,  881,  176,  177,  176,
+      177,  179,  881,  179,  881,  881,  754,  881,  176,  752,
+      176,  176,  177,  176,  177,  179,  881,  179,  176,  177,
+      176,  755,  179,  881,  176,  177,  881,  753,  179,  881,
+      176,  881,  756,  881,  881,  176,  881,  176,  754,  176,
+      177,  757,  176,  179,  881,  881,  759,  881,  758,  881,
+      176,  177,  176,  755,  179,  881,  176,  177,  881,  881,
+      179,  881,  176,  881,  756,  881,  881,  881,  881,  176,
+      761,  176,  881,  757,  881,  176,  177,  881,  759,  179,
+      758,  881,  881,  176,  881,  176,  881,  176,  177,  881,
+
+      176,  179,  881,  176,  177,  881,  176,  179,  762,  176,
+      177,  881,  761,  179,  763,  176,  177,  881,  881,  179,
+      881,  176,  176,  177,  176,  177,  179,  881,  179,  764,
+      176,  177,  176,  881,  179,  176,  177,  881,  176,  179,
+      762,  176,  177,  176,  177,  179,  763,  179,  881,  176,
+      177,  765,  766,  179,  881,  881,  881,  176,  769,  767,
+      881,  764,  881,  768,  176,  177,  881,  881,  179,  176,
+      176,  177,  176,  177,  179,  176,  179,  881,  176,  177,
+      881,  176,  179,  765,  766,  770,  881,  176,  176,  177,
+      769,  767,  179,  881,  176,  768,  176,  881,  881,  176,
+
+      177,  771,  176,  179,  881,  176,  177,  176,  772,  179,
+      176,  177,  881,  176,  179,  176,  881,  770,  176,  177,
+      881,  176,  179,  781,  773,  775,  176,  177,  176,  177,
+      179,  776,  179,  771,  881,  774,  176,  176,  177,  881,
+      772,  179,  176,  881,  176,  176,  177,  777,  780,  179,
+      176,  881,  881,  778,  881,  781,  773,  775,  176,  177,
+      176,  881,  179,  776,  176,  177,  881,  774,  179,  176,
+      177,  176,  881,  179,  881,  779,  881,  176,  881,  777,
+      780,  881,  176,  176,  177,  778,  782,  179,  881,  881,
+      176,  881,  881,  881,  783,  881,  881,  784,  176,  881,
+
+      176,  881,  786,  881,  176,  245,  881,  779,  179,  176,
+      786,  786,  786,  786,  786,  786,  881,  176,  782,  881,
+      176,  177,  881,  881,  179,  881,  783,  881,  881,  784,
+      176,  881,  881,  881,  176,  177,  176,  881,  179,  881,
+      787,  176,  786,  786,  786,  786,  786,  786,  787,  787,
+      787,  787,  787,  787,  788,  176,  881,  176,  177,  791,
+      789,  179,  788,  788,  788,  788,  788,  788,  789,  789,
+      789,  789,  789,  789,  176,  177,  176,  881,  179,  881,
+      787,  787,  787,  787,  787,  787,  792,  793,  881,  176,
+      177,  791,  176,  179,  788,  788,  788,  788,  788,  788,
+
+      789,  789,  789,  789,  789,  789,  176,  176,  177,  176,
+      177,  179,  881,  179,  881,  881,  176,  177,  792,  793,
+      179,  797,  794,  881,  795,  881,  881,  176,  177,  176,
+      881,  179,  176,  177,  881,  881,  179,  176,  177,  881,
+      798,  179,  881,  176,  177,  881,  176,  179,  176,  177,
+      800,  799,  179,  797,  794,  881,  795,  796,  881,  801,
+      881,  176,  176,  177,  176,  177,  179,  881,  179,  176,
+      177,  881,  798,  179,  881,  802,  176,  177,  881,  176,
+      179,  176,  800,  799,  881,  881,  176,  177,  176,  796,
+      179,  801,  176,  177,  881,  881,  179,  881,  804,  176,
+
+      881,  176,  177,  881,  176,  179,  881,  802,  881,  176,
+      176,  177,  176,  177,  179,  176,  179,  176,  177,  881,
+      176,  179,  805,  176,  177,  176,  177,  179,  881,  179,
+      804,  176,  177,  806,  176,  179,  176,  881,  881,  176,
+      177,  176,  808,  179,  881,  881,  176,  177,  176,  881,
+      179,  176,  177,  807,  805,  179,  881,  881,  176,  881,
+      809,  881,  881,  881,  176,  806,  881,  176,  177,  881,
+      811,  179,  810,  176,  808,  176,  177,  176,  177,  179,
+      881,  179,  176,  881,  176,  881,  176,  177,  881,  176,
+      179,  881,  809,  881,  881,  176,  812,  176,  881,  881,
+
+      881,  814,  811,  176,  810,  813,  176,  177,  815,  881,
+      179,  176,  176,  177,  881,  881,  179,  881,  176,  881,
+      881,  176,  177,  176,  881,  179,  176,  177,  812,  881,
+      179,  881,  881,  814,  818,  816,  881,  813,  881,  176,
+      815,  176,  177,  881,  881,  179,  881,  176,  881,  176,
+      176,  177,  881,  817,  179,  819,  881,  881,  176,  881,
+      821,  881,  881,  881,  881,  820,  818,  816,  821,  821,
+      821,  821,  821,  821,  881,  881,  881,  881,  176,  881,
+      881,  176,  177,  881,  176,  179,  881,  819,  881,  881,
+      881,  881,  881,  176,  881,  881,  881,  820,  176,  822,
+
+      821,  821,  821,  821,  821,  821,  823,  822,  822,  822,
+      822,  822,  822,  176,  823,  823,  823,  823,  823,  823,
+      824,  881,  176,  176,  177,  881,  881,  179,  824,  824,
+      824,  824,  824,  824,  176,  177,  881,  881,  179,  822,
+      822,  822,  822,  822,  822,  881,  823,  823,  823,  823,
+      823,  823,  881,  176,  881,  176,  177,  881,  826,  179,
+      824,  824,  824,  824,  824,  824,  176,  177,  176,  177,
+      179,  881,  179,  176,  177,  176,  177,  179,  881,  179,
+      176,  177,  176,  177,  179,  827,  179,  881,  828,  881,
+      826,  881,  176,  177,  881,  176,  179,  829,  881,  881,
+
+      176,  177,  831,  881,  179,  881,  176,  830,  176,  177,
+      176,  177,  179,  881,  179,  176,  177,  827,  832,  179,
+      828,  881,  176,  177,  881,  833,  179,  176,  881,  829,
+      881,  881,  176,  177,  831,  881,  179,  881,  176,  830,
+      176,  881,  176,  177,  881,  176,  179,  176,  881,  881,
+      832,  841,  176,  881,  176,  176,  177,  833,  881,  179,
+      881,  176,  177,  881,  176,  179,  881,  834,  835,  881,
+      881,  836,  176,  176,  177,  176,  177,  179,  837,  179,
+      176,  881,  176,  841,  176,  177,  881,  176,  179,  176,
+      177,  838,  881,  179,  176,  881,  881,  842,  881,  834,
+
+      835,  881,  881,  836,  176,  839,  881,  176,  177,  881,
+      837,  179,  881,  881,  176,  881,  840,  881,  843,  881,
+      176,  177,  881,  838,  179,  881,  881,  176,  881,  842,
+      881,  844,  881,  176,  881,  176,  177,  839,  881,  179,
+      176,  177,  176,  177,  179,  176,  179,  176,  881,  881,
+      843,  881,  881,  881,  881,  846,  176,  845,  881,  881,
+      881,  176,  881,  844,  881,  176,  177,  881,  881,  179,
+      881,  847,  176,  177,  881,  881,  179,  881,  881,  176,
+      881,  881,  881,  881,  881,  848,  881,  846,  881,  845,
+      881,  881,  176,  848,  848,  848,  848,  848,  848,  881,
+
+      176,  177,  881,  847,  179,  176,  177,  176,  849,  179,
+      881,  881,  176,  881,  176,  881,  849,  849,  849,  849,
+      849,  849,  881,  850,  881,  848,  848,  848,  848,  848,
+      848,  850,  850,  850,  850,  850,  850,  176,  176,  177,
+      881,  881,  179,  881,  176,  881,  851,  881,  849,  849,
+      849,  849,  849,  849,  851,  851,  851,  851,  851,  851,
+      881,  881,  881,  850,  850,  850,  850,  850,  850,  176,
+      177,  881,  176,  179,  881,  881,  881,  176,  176,  177,
+      176,  177,  179,  852,  179,  881,  851,  851,  851,  851,
+      851,  851,  881,  853,  176,  177,  176,  177,  179,  881,
+
+      179,  176,  177,  176,  177,  179,  881,  179,  176,  177,
+      176,  881,  179,  176,  177,  852,  881,  179,  881,  176,
+      177,  881,  855,  179,  881,  853,  881,  856,  857,  881,
+      176,  177,  176,  177,  179,  881,  179,  881,  881,  176,
+      177,  176,  854,  179,  858,  176,  177,  176,  177,  179,
+      176,  179,  176,  881,  855,  859,  861,  176,  177,  856,
+      857,  179,  860,  176,  177,  881,  176,  179,  176,  881,
+      881,  881,  881,  176,  862,  176,  858,  865,  863,  881,
+      176,  881,  881,  881,  881,  176,  881,  859,  861,  881,
+      881,  176,  176,  177,  860,  881,  179,  881,  881,  881,
+
+      881,  881,  176,  881,  176,  881,  862,  881,  881,  865,
+      863,  176,  881,  246,  881,  881,  881,  176,  881,  176,
+      864,  246,  246,  246,  246,  246,  246,  881,  251,  176,
+      881,  881,  881,  881,  256,  176,  251,  251,  251,  251,
+      251,  251,  256,  256,  256,  256,  256,  256,  881,  881,
+      881,  881,  864,  246,  246,  246,  246,  246,  246,  176,
+      177,  176,  177,  179,  176,  179,  881,  881,  251,  251,
+      251,  251,  251,  251,  256,  256,  256,  256,  256,  256,
+      265,  176,  177,  881,  867,  179,  869,  881,  265,  265,
+      265,  265,  265,  265,  176,  177,  176,  177,  179,  881,
+
+      179,  881,  881,  176,  177,  176,  177,  179,  881,  179,
+      866,  176,  177,  176,  177,  179,  867,  179,  869,  881,
+      265,  265,  265,  265,  265,  265,  868,  870,  881,  871,
+      881,  176,  881,  176,  176,  177,  176,  177,  179,  881,
+      179,  881,  866,  176,  177,  176,  177,  179,  881,  179,
+      176,  177,  881,  176,  179,  881,  176,  177,  868,  870,
+      179,  871,  881,  176,  177,  872,  176,  179,  176,  176,
+      177,  881,  881,  179,  881,  176,  881,  176,  176,  177,
+      176,  177,  179,  176,  179,  176,  873,  176,  177,  881,
+      881,  179,  881,  874,  176,  177,  881,  872,  179,  881,
+
+      875,  176,  177,  176,  177,  179,  176,  179,  176,  176,
+      177,  881,  881,  179,  881,  176,  881,  176,  881,  876,
+      176,  177,  176,  881,  179,  874,  176,  177,  176,  881,
+      179,  881,  875,  878,  881,  176,  176,  177,  877,  881,
+      179,  176,  176,  177,  881,  881,  179,  881,  879,  881,
+      176,  876,  176,  881,  881,  881,  881,  881,  881,  176,
+      881,  881,  881,  881,  881,  878,  176,  881,  881,  881,
+      877,  880,  881,  176,  881,  176,  881,  881,  881,  881,
+      879,  176,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  176,  881,  881,  881,  881,  881,  176,  881,
+
+      881,  881,  881,  880,  881,  881,  881,  881,  176,  881,
+      881,  881,  881,  881,  176,   28,   28,   28,   28,   28,
        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
-       28,   28,   28,   28,   28,   87,   87,   87,   87,   87,
+       28,   28,   28,   87,   87,   87,   87,   87,   87,   87,
        87,   87,   87,   87,   87,   87,   87,   87,   87,   87,
-       87,   87,   87,   92,   92,   92,   92,   92,   92,   92,
-       92,   92,   92,   92,   92,   92,   92,   92,   92,   92,
-       92,   97,   97,   97,   97,   97,   97,   97,   97,   97,
-
-       97,   97,   97,   97,   97,   97,   97,   97,   97,  102,
+       87,   92,   92,   92,   92,   92,   92,   92,   92,   92,
+       92,   92,   92,   92,   92,   92,   92,   92,   92,   97,
+       97,   97,   97,   97,   97,   97,   97,   97,   97,   97,
+       97,   97,   97,   97,   97,   97,   97,  102,  102,  102,
       102,  102,  102,  102,  102,  102,  102,  102,  102,  102,
-      102,  102,  102,  102,  102,  102,  102,  107,  107,  107,
+
+      102,  102,  102,  102,  102,  107,  107,  107,  107,  107,
       107,  107,  107,  107,  107,  107,  107,  107,  107,  107,
-      107,  107,  107,  107,  107,  113,  113,  113,  113,  113,
+      107,  107,  107,  113,  113,  113,  113,  113,  113,  113,
       113,  113,  113,  113,  113,  113,  113,  113,  113,  113,
-      113,  113,  113,  121,  121,  121,  121,  121,  121,  121,
-      121,  121,  121,  121,  121,  121,  121,  121,  121,  121,
-      121,  126,  126,  126,  126,  126,  126,  126,  126,  126,
-      126,  126,  126,  126,  126,  126,  126,  126,  126,  137,
-
+      113,  121,  121,  121,  121,  121,  121,  121,  121,  121,
+      121,  121,  121,  121,  121,  121,  121,  121,  121,  126,
+      126,  126,  126,  126,  126,  126,  126,  126,  126,  126,
+      126,  126,  126,  126,  126,  126,  126,  137,  137,  137,
       137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
-      137,  137,  137,  137,  137,  137,  137,  141,  141,  141,
+      137,  137,  137,  137,  137,  141,  141,  141,  141,  141,
+
       141,  141,  141,  141,  141,  141,  141,  141,  141,  141,
-      141,  141,  141,  141,  141,  149,  856,  149,  149,  149,
-      149,  149,  149,  149,  149,  149,  149,  149,  149,  856,
-      149,  149,  149,  152,  152,  152,  152,  152,  152,  152,
-      152,  152,  152,  152,  152,  152,  152,  152,  152,  152,
-      152,  155,  155,  155,  155,  856,  155,  159,  856,  159,
+      141,  141,  141,  149,  881,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  881,  149,  149,
+      149,  152,  152,  152,  152,  152,  152,  152,  152,  152,
+      152,  152,  152,  152,  152,  152,  152,  152,  152,  155,
+      155,  155,  155,  881,  155,  159,  881,  159,  159,  159,
+      159,  159,  159,  159,  159,  159,  159,  159,  159,  881,
+      159,  159,  159,  167,  881,  881,  167,  881,  167,  881,
+      167,  168,  881,  168,  168,  168,  168,  168,  168,  168,
+      168,  168,  881,  168,  881,  168,  172,  172,  172,  172,
+
+      881,  172,  178,  178,  881,  178,  178,  881,  178,  881,
+      178,  881,  178,  242,  881,  242,  242,  881,  242,  881,
+      242,  176,  176,  881,  176,  176,  881,  176,  881,  176,
+      881,  176,  246,  881,  881,  246,  246,  881,  246,  246,
+      246,  246,  246,  246,  246,  246,  246,  246,  246,  246,
+      251,  881,  881,  251,  881,  251,  251,  251,  251,  251,
+      251,  251,  251,  251,  251,  251,  251,  251,  256,  881,
+      881,  256,  256,  256,  256,  256,  256,  256,  256,  256,
+      256,  256,  256,  256,  256,  256,  265,  881,  881,  265,
+      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,
+
+      265,  265,  265,  265,  278,  278,  278,  278,  881,  881,
+      881,  881,  278,  881,  278,  278,  278,  278,  278,  278,
+      881,  278,  280,  881,  881,  280,  881,  280,  280,  280,
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  280,
+      283,  881,  881,  283,  283,  283,  283,  283,  283,  881,
+      283,  283,  283,  283,  283,  283,  283,  283,  287,  881,
+      881,  287,  287,  881,  287,  287,  287,  287,  287,  287,
+      287,  287,  881,  287,  287,  287,  290,  290,  290,  290,
+      290,  290,  290,  290,  290,  290,  290,  290,  290,  290,
+      290,  290,  290,  290,  149,  881,  149,  149,  149,  149,
+
+      149,  149,  149,  149,  149,  149,  149,  149,  881,  149,
+      149,  149,  150,  881,  150,  150,  150,  150,  150,  150,
+      150,  150,  150,  150,  150,  150,  881,  150,  150,  150,
+      297,  881,  881,  297,  881,  297,  881,  297,  159,  881,
       159,  159,  159,  159,  159,  159,  159,  159,  159,  159,
-      159,  856,  159,  159,  159,  167,  856,  856,  167,  856,
-
-      167,  856,  167,  168,  856,  168,  168,  168,  168,  168,
-      168,  168,  168,  168,  856,  168,  856,  168,  172,  172,
-      172,  172,  856,  172,  178,  178,  856,  178,  178,  856,
-      178,  856,  178,  856,  178,  241,  856,  241,  241,  856,
-      241,  856,  241,  176,  176,  856,  176,  176,  856,  176,
-      856,  176,  856,  176,  245,  856,  856,  245,  245,  856,
-      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
-      245,  245,  250,  856,  856,  250,  856,  250,  250,  250,
-      250,  250,  250,  250,  250,  250,  250,  250,  250,  250,
-      255,  856,  856,  255,  255,  255,  255,  255,  255,  255,
-
-      255,  255,  255,  255,  255,  255,  255,  255,  264,  856,
-      856,  264,  264,  264,  264,  264,  264,  264,  264,  264,
-      264,  264,  264,  264,  264,  264,  277,  277,  277,  277,
-      856,  856,  856,  856,  277,  856,  277,  277,  277,  277,
-      277,  277,  856,  277,  279,  856,  856,  279,  856,  279,
-      279,  279,  279,  279,  279,  279,  279,  279,  279,  279,
-      279,  279,  282,  856,  856,  282,  282,  282,  282,  282,
-      282,  856,  282,  282,  282,  282,  282,  282,  282,  282,
-      286,  856,  856,  286,  286,  856,  286,  286,  286,  286,
-      286,  286,  286,  286,  856,  286,  286,  286,  289,  289,
-
-      289,  289,  289,  289,  289,  289,  289,  289,  289,  289,
-      289,  289,  289,  289,  289,  289,  149,  856,  149,  149,
-      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
-      856,  149,  149,  149,  150,  856,  150,  150,  150,  150,
-      150,  150,  150,  150,  150,  150,  150,  150,  856,  150,
-      150,  150,  296,  856,  856,  296,  856,  296,  856,  296,
-      159,  856,  159,  159,  159,  159,  159,  159,  159,  159,
-      159,  159,  159,  159,  856,  159,  159,  159,  305,  305,
-      856,  305,  856,  856,  305,  856,  305,  856,  305,  168,
-      856,  168,  168,  168,  168,  168,  168,  168,  168,  168,
-
-      856,  168,  856,  168,  307,  856,  856,  307,  856,  307,
-      856,  307,  315,  856,  856,  315,  315,  856,  315,  856,
-      856,  315,  856,  315,  856,  315,  178,  178,  856,  178,
-      178,  856,  178,  856,  178,  856,  178,  167,  856,  856,
-      167,  856,  167,  856,  167,  408,  856,  856,  856,  408,
-      856,  856,  856,  856,  408,  856,  408,  241,  856,  241,
-      856,  856,  241,  856,  241,  409,  856,  856,  409,  856,
-      409,  856,  409,  245,  856,  856,  245,  245,  856,  245,
-      245,  245,  245,  245,  245,  245,  245,  245,  245,  245,
-      245,  250,  856,  856,  250,  856,  250,  250,  250,  250,
-
-      250,  250,  250,  250,  250,  250,  250,  250,  250,  255,
-      856,  856,  255,  255,  255,  255,  255,  255,  255,  255,
-      255,  255,  255,  255,  255,  255,  255,  264,  856,  856,
-      264,  264,  264,  264,  264,  264,  264,  264,  264,  264,
-      264,  264,  264,  264,  264,  277,  277,  277,  277,  856,
-      856,  856,  856,  277,  856,  277,  277,  277,  277,  277,
-      277,  856,  277,  279,  856,  856,  279,  279,  279,  279,
-      279,  279,  279,  279,  279,  279,  279,  279,  279,  279,
-      279,  426,  426,  426,  426,  426,  426,  426,  426,  426,
-      426,  426,  426,  426,  426,  426,  426,  426,  426,  282,
-
-      856,  856,  282,  282,  282,  282,  282,  282,  856,  282,
-      282,  282,  282,  282,  282,  282,  282,  286,  856,  856,
-      286,  286,  856,  286,  286,  286,  286,  286,  286,  286,
-      286,  856,  286,  286,  286,  429,  856,  856,  429,  429,
-      856,  429,  429,  429,  429,  429,  429,  429,  429,  856,
-      429,  429,  429,  430,  856,  856,  430,  430,  856,  430,
-      430,  430,  430,  430,  430,  430,  430,  856,  430,  430,
-      430,  431,  856,  431,  431,  431,  856,  431,  431,  431,
-      431,  431,  431,  431,  431,  856,  431,  431,  431,  433,
-      433,  856,  433,  433,  856,  433,  433,  433,  433,  433,
-
-      433,  433,  433,  856,  433,  433,  433,  296,  856,  856,
-      296,  856,  296,  856,  296,  434,  856,  856,  434,  434,
-      434,  434,  434,  434,  434,  434,  434,  434,  434,  856,
-      434,  434,  434,  438,  856,  856,  856,  856,  856,  438,
-      856,  856,  438,  856,  438,  305,  305,  856,  305,  856,
-      856,  305,  856,  305,  856,  305,  307,  856,  856,  307,
-      856,  307,  856,  307,  443,  856,  856,  443,  443,  443,
-      443,  443,  443,  443,  443,  443,  443,  443,  856,  443,
-      443,  443,  447,  856,  856,  856,  856,  856,  447,  856,
-      856,  447,  856,  447,  453,  856,  856,  453,  453,  453,
-
-      453,  453,  453,  453,  453,  453,  453,  453,  856,  453,
-      453,  453,  456,  856,  856,  456,  456,  856,  456,  856,
-      856,  456,  856,  456,  856,  456,  457,  457,  856,  457,
-      457,  856,  457,  856,  457,  856,  457,  178,  178,  856,
-      178,  178,  856,  178,  856,  178,  856,  178,  542,  856,
-      856,  856,  856,  856,  856,  856,  856,  542,  856,  542,
-      543,  856,  543,  856,  856,  543,  856,  543,  544,  544,
-      856,  544,  856,  856,  544,  856,  544,  856,  544,  255,
-      856,  856,  255,  255,  856,  255,  255,  255,  255,  255,
-      255,  255,  255,  255,  255,  255,  255,  264,  856,  856,
-
-      264,  856,  264,  264,  264,  264,  264,  264,  264,  264,
-      264,  264,  264,  264,  264,  426,  426,  426,  426,  426,
-      426,  426,  426,  426,  426,  426,  426,  426,  426,  426,
-      426,  426,  426,  429,  856,  856,  429,  429,  856,  429,
-      429,  429,  429,  429,  429,  429,  429,  856,  429,  429,
-      429,  430,  856,  856,  430,  430,  856,  430,  430,  430,
-      430,  430,  430,  430,  430,  856,  430,  430,  430,  431,
-      856,  856,  431,  431,  856,  431,  431,  431,  431,  431,
-      431,  431,  431,  856,  431,  431,  431,  433,  856,  856,
-      433,  433,  856,  433,  433,  433,  433,  433,  433,  433,
-
-      433,  856,  433,  433,  433,  434,  856,  856,  434,  434,
-      434,  434,  434,  434,  434,  434,  434,  434,  434,  856,
-      434,  434,  434,  557,  856,  856,  557,  557,  557,  557,
-      557,  557,  557,  557,  557,  557,  557,  856,  557,  557,
-      557,  559,  856,  856,  559,  856,  559,  561,  856,  856,
-      856,  856,  856,  856,  856,  856,  561,  856,  561,  440,
-      856,  440,  856,  856,  440,  856,  440,  443,  856,  856,
-      443,  443,  443,  443,  443,  443,  443,  443,  443,  443,
-      443,  856,  443,  443,  443,  563,  856,  856,  563,  563,
-      563,  563,  563,  563,  563,  563,  563,  563,  563,  856,
-
-      563,  563,  563,  565,  856,  856,  565,  856,  565,  567,
-      856,  856,  856,  856,  856,  856,  856,  856,  567,  856,
-      567,  449,  856,  449,  856,  856,  449,  856,  449,  452,
-      856,  856,  452,  856,  856,  452,  453,  856,  856,  453,
-      453,  453,  453,  453,  453,  453,  453,  453,  453,  453,
-      856,  453,  453,  453,  569,  856,  856,  569,  569,  569,
-      569,  569,  569,  569,  569,  569,  569,  569,  856,  569,
-      569,  569,  572,  572,  856,  572,  572,  856,  572,  856,
-      572,  856,  572,  457,  457,  856,  457,  457,  856,  457,
-      856,  457,  856,  457,  178,  178,  856,  178,  178,  856,
-
-      178,  856,  178,  856,  178,  647,  856,  647,  856,  856,
-      647,  856,  647,  543,  856,  543,  856,  856,  543,  856,
-      543,  544,  544,  856,  544,  856,  856,  544,  856,  544,
-      856,  544,  657,  856,  856,  657,  657,  657,  657,  657,
-      657,  657,  657,  657,  657,  657,  856,  657,  657,  657,
-      659,  856,  856,  659,  856,  659,  300,  856,  856,  856,
-      856,  856,  856,  300,  856,  300,  856,  300,  660,  856,
-      856,  660,  660,  660,  660,  660,  660,  660,  660,  660,
-      660,  660,  856,  660,  660,  660,  662,  856,  856,  662,
-      856,  662,  311,  856,  856,  856,  856,  856,  856,  311,
-
-      856,  311,  856,  311,  664,  856,  856,  664,  664,  856,
-      664,  856,  856,  664,  856,  664,  856,  664,  716,  856,
-      856,  856,  856,  856,  856,  856,  856,  716,  856,  716,
-      722,  856,  856,  722,  722,  722,  722,  722,  722,  722,
-      722,  722,  722,  722,  856,  722,  722,  722,  724,  724,
-      856,  724,  724,  856,  724,  856,  724,  856,  724,  762,
-      856,  856,  762,  856,  762,   27,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856
+      159,  159,  881,  159,  159,  159,  306,  306,  881,  306,
+      881,  881,  306,  881,  306,  881,  306,  168,  881,  168,
+      168,  168,  168,  168,  168,  168,  168,  168,  881,  168,
+      881,  168,  308,  881,  881,  308,  881,  308,  881,  308,
+      316,  881,  881,  316,  316,  881,  316,  881,  881,  316,
+
+      881,  316,  881,  316,  178,  178,  881,  178,  178,  881,
+      178,  881,  178,  881,  178,  167,  881,  881,  167,  881,
+      167,  881,  167,  413,  881,  881,  881,  413,  881,  881,
+      881,  881,  413,  881,  413,  242,  881,  242,  881,  881,
+      242,  881,  242,  414,  881,  881,  414,  881,  414,  881,
+      414,  246,  881,  881,  246,  246,  881,  246,  246,  246,
+      246,  246,  246,  246,  246,  246,  246,  246,  246,  251,
+      881,  881,  251,  881,  251,  251,  251,  251,  251,  251,
+      251,  251,  251,  251,  251,  251,  251,  256,  881,  881,
+      256,  256,  256,  256,  256,  256,  256,  256,  256,  256,
+
+      256,  256,  256,  256,  256,  265,  881,  881,  265,  265,
+      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,
+      265,  265,  265,  278,  278,  278,  278,  881,  881,  881,
+      881,  278,  881,  278,  278,  278,  278,  278,  278,  881,
+      278,  280,  881,  881,  280,  280,  280,  280,  280,  280,
+      280,  280,  280,  280,  280,  280,  280,  280,  280,  431,
+      431,  431,  431,  431,  431,  431,  431,  431,  431,  431,
+      431,  431,  431,  431,  431,  431,  431,  283,  881,  881,
+      283,  283,  283,  283,  283,  283,  881,  283,  283,  283,
+      283,  283,  283,  283,  283,  287,  881,  881,  287,  287,
+
+      881,  287,  287,  287,  287,  287,  287,  287,  287,  881,
+      287,  287,  287,  434,  881,  881,  434,  434,  881,  434,
+      434,  434,  434,  434,  434,  434,  434,  881,  434,  434,
+      434,  435,  881,  881,  435,  435,  881,  435,  435,  435,
+      435,  435,  435,  435,  435,  881,  435,  435,  435,  436,
+      881,  436,  436,  436,  881,  436,  436,  436,  436,  436,
+      436,  436,  436,  881,  436,  436,  436,  438,  438,  881,
+      438,  438,  881,  438,  438,  438,  438,  438,  438,  438,
+      438,  881,  438,  438,  438,  297,  881,  881,  297,  881,
+      297,  881,  297,  439,  881,  881,  439,  439,  439,  439,
+
+      439,  439,  439,  439,  439,  439,  439,  881,  439,  439,
+      439,  443,  881,  881,  881,  881,  881,  443,  881,  881,
+      443,  881,  443,  306,  306,  881,  306,  881,  881,  306,
+      881,  306,  881,  306,  308,  881,  881,  308,  881,  308,
+      881,  308,  448,  881,  881,  448,  448,  448,  448,  448,
+      448,  448,  448,  448,  448,  448,  881,  448,  448,  448,
+      452,  881,  881,  881,  881,  881,  452,  881,  881,  452,
+      881,  452,  458,  881,  881,  458,  458,  458,  458,  458,
+      458,  458,  458,  458,  458,  458,  881,  458,  458,  458,
+      461,  881,  881,  461,  461,  881,  461,  881,  881,  461,
+
+      881,  461,  881,  461,  462,  462,  881,  462,  462,  881,
+      462,  881,  462,  881,  462,  178,  178,  881,  178,  178,
+      881,  178,  881,  178,  881,  178,  553,  881,  881,  881,
+      881,  881,  881,  881,  881,  553,  881,  553,  554,  881,
+      554,  881,  881,  554,  881,  554,  555,  555,  881,  555,
+      881,  881,  555,  881,  555,  881,  555,  256,  881,  881,
+      256,  256,  881,  256,  256,  256,  256,  256,  256,  256,
+      256,  256,  256,  256,  256,  265,  881,  881,  265,  881,
+      265,  265,  265,  265,  265,  265,  265,  265,  265,  265,
+      265,  265,  265,  431,  431,  431,  431,  431,  431,  431,
+
+      431,  431,  431,  431,  431,  431,  431,  431,  431,  431,
+      431,  434,  881,  881,  434,  434,  881,  434,  434,  434,
+      434,  434,  434,  434,  434,  881,  434,  434,  434,  435,
+      881,  881,  435,  435,  881,  435,  435,  435,  435,  435,
+      435,  435,  435,  881,  435,  435,  435,  436,  881,  881,
+      436,  436,  881,  436,  436,  436,  436,  436,  436,  436,
+      436,  881,  436,  436,  436,  438,  881,  881,  438,  438,
+      881,  438,  438,  438,  438,  438,  438,  438,  438,  881,
+      438,  438,  438,  439,  881,  881,  439,  439,  439,  439,
+      439,  439,  439,  439,  439,  439,  439,  881,  439,  439,
+
+      439,  568,  881,  881,  568,  568,  568,  568,  568,  568,
+      568,  568,  568,  568,  568,  881,  568,  568,  568,  570,
+      881,  881,  570,  881,  570,  572,  881,  881,  881,  881,
+      881,  881,  881,  881,  572,  881,  572,  445,  881,  445,
+      881,  881,  445,  881,  445,  448,  881,  881,  448,  448,
+      448,  448,  448,  448,  448,  448,  448,  448,  448,  881,
+      448,  448,  448,  574,  881,  881,  574,  574,  574,  574,
+      574,  574,  574,  574,  574,  574,  574,  881,  574,  574,
+      574,  576,  881,  881,  576,  881,  576,  578,  881,  881,
+      881,  881,  881,  881,  881,  881,  578,  881,  578,  454,
+
+      881,  454,  881,  881,  454,  881,  454,  457,  881,  881,
+      457,  881,  881,  457,  458,  881,  881,  458,  458,  458,
+      458,  458,  458,  458,  458,  458,  458,  458,  881,  458,
+      458,  458,  580,  881,  881,  580,  580,  580,  580,  580,
+      580,  580,  580,  580,  580,  580,  881,  580,  580,  580,
+      583,  583,  881,  583,  583,  881,  583,  881,  583,  881,
+      583,  462,  462,  881,  462,  462,  881,  462,  881,  462,
+      881,  462,  178,  178,  881,  178,  178,  881,  178,  881,
+      178,  881,  178,  663,  881,  663,  881,  881,  663,  881,
+      663,  554,  881,  554,  881,  881,  554,  881,  554,  555,
+
+      555,  881,  555,  881,  881,  555,  881,  555,  881,  555,
+      673,  881,  881,  673,  673,  673,  673,  673,  673,  673,
+      673,  673,  673,  673,  881,  673,  673,  673,  675,  881,
+      881,  675,  881,  675,  301,  881,  881,  881,  881,  881,
+      881,  301,  881,  301,  881,  301,  676,  881,  881,  676,
+      676,  676,  676,  676,  676,  676,  676,  676,  676,  676,
+      881,  676,  676,  676,  678,  881,  881,  678,  881,  678,
+      312,  881,  881,  881,  881,  881,  881,  312,  881,  312,
+      881,  312,  680,  881,  881,  680,  680,  881,  680,  881,
+      881,  680,  881,  680,  881,  680,  736,  881,  881,  881,
+
+      881,  881,  881,  881,  881,  736,  881,  736,  742,  881,
+      881,  742,  742,  742,  742,  742,  742,  742,  742,  742,
+      742,  742,  881,  742,  742,  742,  744,  744,  881,  744,
+      744,  881,  744,  881,  744,  881,  744,  785,  881,  881,
+      785,  881,  785,   27,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881
     } ;
 
-static yyconst flex_int16_t yy_chk[7456] =
+static yyconst flex_int16_t yy_chk[7634] =
     {   0,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
@@ -1590,814 +1621,834 @@ static yyconst flex_int16_t yy_chk[7456] =
         5,    6,    6,    7,    7,   80,    7,    5,   80,    6,
 
         8,    8,   97,    8,    9,    9,   10,   10,   11,   11,
-       86,   11,    9,   86,   10,   12,   12,  875,   12,   13,
+       86,   11,    9,   86,   10,   12,   12,  900,   12,   13,
        13,   13,   35,   35,   13,   14,   14,   14,  176,   13,
        14,  176,   17,   17,   17,   14,   34,   17,   34,   21,
        21,    5,   36,    6,   53,    7,   97,   36,   13,   53,
-       21,  102,    8,  722,   14,   21,    9,  663,   10,   17,
-       11,   15,   15,   15,  660,   15,   15,   12,   50,   50,
+       21,  102,    8,  742,   14,   21,    9,  679,   10,   17,
+       11,   15,   15,   15,  676,   15,   15,   12,   50,   50,
        15,   15,   16,   16,   16,  151,   16,   16,  110,  110,
        13,   16,   16,   18,   18,   18,   14,  151,   18,   19,
-       19,   17,   19,  112,   47,  657,   47,   19,   19,   19,
+       19,   17,   19,  112,   47,  673,   47,   19,   19,   19,
 
       102,   22,   22,   19,  125,   19,   20,   20,   47,   20,
        18,  149,   22,  149,   20,   20,   20,   22,   23,   23,
-       20,  647,   20,   24,   24,  112,   23,  100,  100,   55,
-       55,   24,  298,   55,  139,  100,  125,   59,   59,  139,
-       47,   59,   18,   56,   56,   15,  298,   56,   64,   64,
-      273,   55,   64,   55,   56,  646,   16,  240,   55,   57,
-       57,   55,   56,   57,  117,  117,  124,  124,   56,  240,
-       23,   59,   19,  562,   19,   24,   61,   61,   56,  100,
-       61,   57,  273,   55,   57,   55,   56,   57,  562,   20,
-       55,   20,  570,   55,   56,  105,  105,  166,  105,  166,
+       20,  663,   20,   24,   24,  112,   23,  100,  100,   55,
+       55,   24,  299,   55,  139,  100,  125,   59,   59,  139,
+       47,   59,   18,   56,   56,   15,  299,   56,   64,   64,
+      274,   55,   64,   55,   56,  662,   16,  241,   55,   57,
+       57,   55,   56,   57,  117,  117,  124,  124,   56,  241,
+       23,   59,   19,  573,   19,   24,   61,   61,   56,  100,
+       61,   57,  274,   55,   57,   55,   56,   57,  573,   20,
+       55,   20,  581,   55,   56,  105,  105,  166,  105,  166,
 
        56,   55,  166,   59,   61,  145,  145,   58,   58,   59,
-       56,   58,  255,   57,  264,   56,   57,   60,   58,   57,
+       56,   58,  580,   57,  265,   56,   57,   60,   58,   57,
        64,   60,   58,   75,   75,   60,   58,   75,   62,   62,
-      244,   57,   62,  244,   60,   58,   61,   60,   65,   62,
-      568,   75,  152,  152,  154,  154,   65,  105,   61,   60,
-       58,   66,   65,   60,   58,  568,  255,   60,   58,   66,
-       69,   69,   65,  264,   69,   66,   60,   58,  569,   60,
-       65,   62,   67,   75,  265,   66,  309,  163,   65,   58,
-       67,  178,  178,   66,   65,  178,   67,  164,   69,  163,
-      309,   66,   67,  566,   65,   75,   67,   66,  256,  164,
-
-       62,   63,   63,  922,   67,   63,  922,   66,  280,  280,
-       68,   68,   67,  563,   68,   63,  560,   63,   67,  422,
-       69,  163,   68,  265,   67,   63,   68,  557,   67,   63,
+      577,   57,   62,  163,   60,   58,   61,   60,   65,   62,
+      266,   75,   75,  152,  152,  163,   65,  105,   61,   60,
+       58,   66,   65,   60,   58,  154,  154,   60,   58,   66,
+       69,   69,   65,  265,   69,   66,   60,   58,  574,   60,
+       65,   62,   67,   75,   75,   66,  571,  163,   65,   58,
+       67,  178,  178,   66,   65,  178,   67,  164,   69,  266,
+      245,   66,   67,  245,   65,   75,   67,   66,  256,  164,
+
+       62,   63,   63,  568,   67,   63,  257,   66,  281,  281,
+       68,   68,   67,  310,   68,   63,  567,   63,   67,  427,
+       69,  556,   68,  555,   67,   63,   68,  310,   67,   63,
        63,  164,   69,   70,   70,   73,   68,   70,   68,   73,
-       71,   71,  256,   73,   71,  270,  270,   63,  270,   63,
-      895,  422,   73,  178,   68,   71,  895,   63,   68,  187,
-      187,   63,   63,  187,   70,   73,  556,   73,   68,  545,
-       68,   73,  544,   63,  543,   73,  165,  554,  165,   74,
-       74,  302,   68,   74,   73,  426,  426,   71,   76,   76,
-      165,  542,   76,  302,   82,   82,   70,  270,   82,  455,
-
-      181,  181,  656,   74,  181,   70,  428,  428,   74,  554,
-      454,   76,   71,   72,  181,   72,   82,   72,   82,   91,
-      721,   72,  165,   82,   91,  302,   82,   72,  453,  452,
-      177,  187,   72,   72,  656,   74,  450,   72,  767,  449,
+       71,   71,  256,   73,   71,  271,  271,   63,  271,   63,
+      257,  427,   73,  178,   68,   71,  554,   63,   68,  187,
+      187,   63,   63,  187,   70,   73,  920,   73,   68,  553,
+       68,   73,  920,   63,  460,   73,  165,  565,  165,   74,
+       74,  303,   68,   74,   73,  431,  431,   71,   76,   76,
+      165,  459,   76,  303,   82,   82,   70,  271,   82,  458,
+
+      181,  181,  623,   74,  181,   70,  433,  433,   74,  565,
+      457,   76,   71,   72,  181,   72,   82,   72,   82,   91,
+      455,   72,  165,   82,   91,  303,   82,   72,  454,  453,
+      177,  187,   72,   72,  623,   74,  451,   72,  450,  509,
        74,  177,  177,   76,  177,   72,  181,   72,   82,   72,
-       82,   74,  721,   72,  448,   82,  446,   96,   82,   72,
-       76,   91,   96,  445,   72,   72,   82,  444,   91,   72,
-      767,  443,  181,   91,   91,  441,  440,  439,   91,  437,
-      101,  436,  435,  434,  427,  101,   91,  418,  414,  409,
-       91,  106,   91,   91,   91,  408,  106,  180,  180,   96,
-
-      407,  180,  313,  308,  182,  182,   96,  306,  182,  305,
-      304,   96,   96,  177,  184,  184,   96,  182,  184,  303,
-      297,  295,  101,  292,   96,  182,  291,  180,   96,  101,
-       96,   96,   96,  106,  101,  101,  290,  283,  282,  101,
-      106,  279,  275,  184,  274,  106,  106,  101,  269,  182,
-      106,  101,  268,  101,  101,  101,  260,  182,  106,  180,
-      259,  250,  106,  245,  106,  106,  106,  156,  241,  180,
-      175,  169,  168,  167,  160,  184,  182,  159,  153,  315,
-      315,  150,  156,  315,  201,  201,  184,  146,  201,  156,
+       82,   74,  579,   72,  449,   82,  672,   96,   82,   72,
+       76,   91,   96,  704,   72,   72,   82,  579,   91,   72,
+      509,  741,  181,   91,   91,  760,  947,  790,   91,  947,
+      101,  448,  446,  445,  444,  101,   91,  442,  672,  441,
+       91,  106,   91,   91,   91,  704,  106,  180,  180,   96,
+
+      440,  180,  509,  741,  182,  182,   96,  760,  182,  790,
+      439,   96,   96,  177,  184,  184,   96,  182,  184,  432,
+      423,  419,  101,  414,   96,  182,  413,  180,   96,  101,
+       96,   96,   96,  106,  101,  101,  412,  314,  309,  101,
+      106,  307,  306,  184,  305,  106,  106,  101,  304,  182,
+      106,  101,  298,  101,  101,  101,  296,  182,  106,  180,
+      293,  292,  106,  291,  106,  106,  106,  156,  284,  180,
+      283,  280,  276,  275,  270,  184,  182,  269,  261,  316,
+      316,  260,  156,  316,  201,  201,  184,  251,  201,  156,
       156,  156,  156,  156,  156,  156,  156,  156,  156,  156,
 
       156,  156,  156,  156,  156,  156,  156,  156,  156,  156,
-      156,  156,  156,  156,  156,  144,  201,  143,  142,  156,
-      140,  156,  156,  156,  156,  156,  156,  156,  156,  156,
+      156,  156,  156,  156,  156,  246,  201,  242,  175,  156,
+      169,  156,  156,  156,  156,  156,  156,  156,  156,  156,
       156,  156,  156,  156,  156,  156,  156,  156,  156,  156,
-      156,  156,  156,  156,  156,  156,  156,  173,  201,  314,
-      137,  315,  134,  133,  128,  127,  201,  123,  122,  118,
-      314,  314,  173,  314,  116,  115,  114,  109,  108,  173,
+      156,  156,  156,  156,  156,  156,  156,  173,  201,  315,
+      168,  316,  167,  160,  159,  153,  201,  150,  146,  144,
+      315,  315,  173,  315,  143,  142,  140,  137,  134,  173,
       173,  173,  173,  173,  173,  173,  173,  173,  173,  173,
       173,  173,  173,  173,  173,  173,  173,  173,  173,  173,
-      173,  173,  173,  173,  173,  104,  103,   99,   98,  173,
+      173,  173,  173,  173,  173,  133,  128,  127,  123,  173,
 
-       94,  173,  173,  173,  173,  173,  173,  173,  173,  173,
+      122,  173,  173,  173,  173,  173,  173,  173,  173,  173,
       173,  173,  173,  173,  173,  173,  173,  173,  173,  173,
       173,  173,  173,  173,  173,  173,  173,  183,  183,  185,
-      185,  183,  314,  185,  186,  186,  188,  188,  186,   93,
-      188,   92,  189,  189,  183,   89,  189,  188,   88,  185,
-       87,  188,   84,  190,  190,  191,  191,  190,  571,  191,
-      193,  193,   79,   52,  193,  186,  189,   45,  190,  571,
-      571,   42,  571,  189,  192,  192,  183,   41,  192,  188,
-       38,  185,   37,  188,   33,  191,   32,  194,  194,  193,
-      192,  194,   31,   30,   27,    0,  192,  186,  189,  183,
-
-      190,  185,  192,  192,    0,  189,  186,    0,  188,  196,
-      196,    0,  194,  196,  189,  197,  197,  191,    0,  197,
-        0,  193,  192,    0,    0,  190,    0,  191,  192,  195,
-      195,  196,  193,  195,  192,  192,    0,  197,    0,  198,
-      198,  571,  195,  198,  194,    0,  192,  199,  199,    0,
-        0,  199,  202,  202,  261,  261,  202,  200,  200,  194,
-        0,  200,  261,  196,  198,    0,    0,  202,  200,  197,
-        0,  199,  203,  203,  195,    0,  203,    0,    0,  204,
-      204,  196,  200,  204,    0,  205,  205,  197,    0,  205,
-        0,    0,    0,  204,    0,  204,  198,    0,  203,  202,
-
-      200,  195,    0,  199,  205,    0,  261,    0,  204,  204,
-        0,  198,  208,  208,  200,    0,  208,    0,    0,  199,
-        0,    0,  207,  207,  202,  204,  207,  204,    0,  200,
-      203,    0,    0,  208,    0,  208,  205,    0,    0,    0,
-      204,  204,  208,    0,  203,    0,  207,    0,    0,    0,
-        0,  204,  209,  209,    0,    0,  209,  205,  206,  206,
-      213,  213,  206,  209,  213,  208,    0,  208,    0,    0,
-      206,    0,  211,  211,  208,    0,  211,  206,  207,    0,
-      206,  317,  317,  213,  208,  317,  206,  215,  215,  206,
-        0,  215,    0,    0,  207,  209,  211,  212,  212,  210,
-
-      210,  212,  206,  210,  214,  214,  218,  218,  214,  206,
-      218,  212,  206,    0,    0,  213,    0,  215,  206,    0,
-      210,  206,  218,    0,  209,  210,  214,    0,  211,    0,
-      206,    0,  213,  210,  216,  216,  219,  219,  216,    0,
-      219,  217,  217,  212,  211,  217,  220,  220,    0,  215,
-      220,    0,  210,  317,  218,    0,  216,  210,  214,  215,
-      220,  217,    0,    0,    0,  210,  219,    0,    0,  212,
-        0,  210,    0,  222,  222,    0,  214,  222,  218,  221,
-      221,    0,    0,  221,  222,  223,  223,    0,  216,  223,
-        0,    0,  220,  217,  221,    0,    0,    0,  219,  223,
-
-      224,  224,  223,    0,  224,    0,  216,    0,  219,    0,
-      225,  225,    0,  217,  225,  223,  222,    0,  220,    0,
-      226,  226,    0,  224,  226,    0,  221,    0,    0,    0,
-        0,  223,  227,  227,  223,  225,  227,  228,  228,  318,
-      318,  228,  226,  318,    0,  222,    0,  223,  226,    0,
-        0,  221,    0,  228,  227,  224,    0,  223,    0,  229,
-      229,    0,    0,  229,    0,    0,    0,  225,  228,  231,
-      231,    0,  224,  231,  226,    0,    0,    0,    0,    0,
-      226,  231,  225,    0,  229,  228,  227,  229,    0,  230,
-      230,    0,  226,  230,  232,  232,    0,    0,  232,    0,
-
-      228,  230,    0,    0,  227,    0,  233,  233,    0,  228,
-      233,  318,  230,  231,  238,  238,  229,  233,  238,  229,
-      235,  235,    0,    0,  235,    0,  236,  236,  232,    0,
-      236,  229,    0,  230,  319,  319,  238,  233,  319,  235,
-        0,  231,    0,    0,  230,  236,    0,  237,  237,  233,
-        0,  237,  316,  316,  320,  320,  316,    0,  320,    0,
-      232,  230,  237,    0,    0,    0,  232,  316,  238,  233,
-        0,  235,    0,    0,    0,    0,    0,  236,  233,  234,
-      234,  234,  234,  246,    0,  234,  238,    0,  246,  234,
-      234,  234,  235,    0,  237,  234,  234,    0,  236,  316,
-
-      345,  345,    0,    0,  345,    0,  319,    0,    0,    0,
-        0,  234,  234,  234,  234,    0,    0,  234,    0,  237,
-        0,  234,  234,  234,  316,  246,  320,  234,  234,    0,
-      325,  325,  246,    0,  325,  248,    0,  246,  246,    0,
-        0,  325,  246,  248,  248,  248,  248,  248,  248,    0,
-      246,  249,    0,    0,  246,    0,  246,  246,  246,  249,
-      249,  249,  249,  249,  249,  251,    0,    0,    0,    0,
-      251,    0,  345,  325,    0,  248,  248,  248,  248,  248,
-      248,    0,  339,  339,  321,  321,  339,    0,  321,    0,
-        0,  249,  249,  249,  249,  249,  249,  323,  323,  321,
-
-        0,  323,  325,    0,    0,  339,    0,  251,  322,  322,
-        0,    0,  322,    0,  251,    0,    0,  253,    0,  251,
-      251,  323,    0,  322,  251,  253,  253,  253,  253,  253,
-      253,  321,  251,  254,    0,    0,  251,  339,  251,  251,
-      251,  254,  254,  254,  254,  254,  254,  257,    0,    0,
-        0,    0,  257,  323,  339,  322,  321,  253,  253,  253,
-      253,  253,  253,  350,  350,    0,    0,  350,    0,  323,
-        0,    0,    0,  254,  254,  254,  254,  254,  254,    0,
-      322,  327,  327,    0,    0,  327,    0,    0,    0,  257,
-      324,  324,    0,    0,  324,    0,  257,    0,    0,  262,
-
-        0,  257,  257,    0,    0,  327,  257,  262,  262,  262,
-      262,  262,  262,    0,  257,  263,    0,    0,  257,  324,
-      257,  257,  257,  263,  263,  263,  263,  263,  263,  266,
-        0,    0,    0,    0,  266,  350,    0,  327,    0,  262,
-      262,  262,  262,  262,  262,    0,  362,  362,  331,  331,
-      362,  324,  331,  327,    0,  263,  263,  263,  263,  263,
-      263,    0,  324,  331,  332,  332,    0,    0,  332,    0,
-        0,  266,  326,  326,    0,    0,  326,    0,  266,  332,
-        0,  271,    0,  266,  266,    0,    0,    0,  266,  271,
-      271,  271,  271,  271,  271,  331,  266,  272,    0,    0,
-
-      266,  326,  266,  266,  266,  272,  272,  272,  272,  272,
-      272,  332,  363,  363,    0,    0,  363,    0,  362,    0,
-      331,  271,  271,  271,  271,  271,  271,    0,    0,    0,
-        0,    0,    0,  326,    0,    0,  332,  272,  272,  272,
-      272,  272,  272,  299,  326,  299,  299,    0,    0,    0,
-        0,    0,    0,  299,  299,  299,  299,  299,  299,  299,
-      299,  299,  299,  299,  299,  299,  299,  299,  299,  299,
-      299,  299,  299,  299,  299,  299,  299,  299,  299,    0,
-        0,    0,    0,  299,  363,  299,  299,  299,  299,  299,
-      299,  299,  299,  299,  299,  299,  299,  299,  299,  299,
-
-      299,  299,  299,  299,  299,  299,  299,  299,  299,  299,
-      299,  300,    0,  364,  364,    0,    0,  364,  300,  300,
+      185,  183,  315,  185,  186,  186,  188,  188,  186,  118,
+      188,  116,  189,  189,  183,  115,  189,  188,  114,  185,
+      109,  188,  108,  185,  104,  190,  190,  191,  191,  190,
+      103,  191,   99,   98,   94,  186,  189,  193,  193,   93,
+      190,  193,   92,  189,  231,  231,  183,   89,  231,  188,
+       88,  185,   87,  188,   84,  185,  231,  191,  192,  192,
+      194,  194,  192,   79,  194,   52,  193,  186,  189,  183,
+
+       45,  185,  190,   42,  192,  189,  186,   41,  188,   38,
+      192,   37,  582,   33,  189,  194,  192,  192,  231,  191,
+       32,  195,  195,  582,  582,  195,  582,  190,  193,  191,
+       31,  196,  196,   30,  195,  196,  192,  197,  197,  193,
+      195,  197,  192,   27,    0,    0,  231,  194,  192,  192,
+      198,  198,    0,  196,  198,    0,    0,  199,  199,  197,
+      192,  199,  194,  200,  200,    0,  195,  200,    0,  202,
+      202,    0,  195,  202,  200,  198,  203,  203,    0,    0,
+      203,  199,  204,  204,  202,  196,  204,    0,  200,    0,
+        0,  197,    0,  195,    0,  582,  204,    0,  204,    0,
+
+      205,  205,  203,  196,  205,    0,  200,  198,    0,  197,
+        0,  204,  204,  199,  207,  207,  202,    0,  207,  205,
+      200,    0,  198,  262,  262,    0,    0,    0,  204,  199,
+      204,  262,    0,    0,  203,  200,  208,  208,  207,    0,
+      208,  202,    0,  204,  204,    0,  214,  214,  203,    0,
+      214,  205,    0,    0,  204,    0,    0,  208,    0,  208,
+      209,  209,    0,    0,  209,    0,  208,    0,  214,    0,
+      207,  209,  205,  206,  206,  262,    0,  206,  211,  211,
+        0,    0,  211,  212,  212,  206,  207,  212,    0,  208,
+        0,  208,  206,    0,    0,  206,    0,  212,  208,    0,
+
+      214,  206,  211,  209,  206,  210,  210,    0,  208,  210,
+      215,  215,  213,  213,  215,    0,  213,  206,  214,  216,
+      216,  218,  218,  216,  206,  218,  210,  206,    0,  212,
+        0,  210,  209,  206,  211,  213,  206,  218,    0,  210,
+      215,  216,  217,  217,    0,  206,  217,    0,  219,  219,
+      211,    0,  219,    0,    0,  212,  220,  220,  210,    0,
+      220,    0,  217,  210,  221,  221,    0,  213,  221,  218,
+      220,  210,  215,  216,    0,    0,    0,  210,  219,  221,
+        0,    0,  215,    0,  213,    0,  222,  222,  225,  225,
+      222,  216,  225,  218,  217,  223,  223,  222,    0,  223,
+
+      224,  224,  220,    0,  224,    0,    0,    0,    0,  223,
+      219,  221,  223,  225,  217,  226,  226,  227,  227,  226,
+      219,  227,    0,  224,    0,  223,    0,    0,  220,  222,
+      228,  228,    0,    0,  228,    0,  221,  226,    0,  227,
+        0,  223,    0,  226,  223,  225,  228,    0,  229,  229,
+      232,  232,  229,    0,  232,  224,    0,  223,  222,    0,
+      225,  228,  230,  230,  236,  236,  230,  223,  236,  226,
+        0,  227,  224,  229,  230,  226,  229,    0,  228,    0,
+        0,    0,    0,  236,  232,  230,    0,  226,    0,  227,
+      233,  233,    0,  228,  233,  235,  235,    0,    0,  235,
+
+        0,  233,  228,    0,    0,  229,  230,  235,  229,  237,
+      237,    0,    0,  237,  235,  236,  232,  230,    0,    0,
+      229,  233,  232,    0,  237,    0,    0,  238,  238,    0,
+        0,  238,    0,  233,  230,    0,  236,  239,  239,  235,
+        0,  239,    0,  317,  317,    0,  235,  317,    0,    0,
+      318,  318,    0,  233,  318,    0,  237,  238,  317,  239,
+        0,    0,  233,  234,  234,  234,  234,  235,    0,  234,
+        0,  247,    0,  234,  234,  234,  247,    0,    0,  234,
+      234,  237,  319,  319,  320,  320,  319,    0,  320,  238,
+      317,  239,    0,    0,    0,  234,  234,  234,  234,  238,
+
+        0,  234,    0,    0,    0,  234,  234,  234,    0,  239,
+        0,  234,  234,  247,    0,  317,    0,  321,  321,    0,
+      247,  321,  318,  249,    0,  247,  247,    0,    0,    0,
+      247,  249,  249,  249,  249,  249,  249,    0,  247,  250,
+        0,    0,  247,    0,  247,  247,  247,  250,  250,  250,
+      250,  250,  250,  252,  319,    0,  320,    0,  252,    0,
+        0,    0,    0,  249,  249,  249,  249,  249,  249,    0,
+      342,  342,  322,  322,  342,    0,  322,    0,    0,  250,
+      250,  250,  250,  250,  250,    0,    0,  322,    0,  321,
+        0,    0,    0,  342,    0,  252,  323,  323,    0,    0,
+
+      323,    0,  252,    0,    0,  254,    0,  252,  252,    0,
+        0,  323,  252,  254,  254,  254,  254,  254,  254,  322,
+      252,  255,    0,    0,  252,  342,  252,  252,  252,  255,
+      255,  255,  255,  255,  255,  258,    0,    0,    0,    0,
+      258,    0,  342,  323,  322,  254,  254,  254,  254,  254,
+      254,  325,  325,    0,    0,  325,    0,    0,    0,    0,
+        0,  255,  255,  255,  255,  255,  255,    0,  323,  329,
+      329,    0,    0,  329,    0,  325,    0,  258,  324,  324,
+        0,    0,  324,    0,  258,    0,    0,  263,    0,  258,
+      258,    0,  324,  329,  258,  263,  263,  263,  263,  263,
+
+      263,    0,  258,  264,    0,    0,  258,  325,  258,  258,
+      258,  264,  264,  264,  264,  264,  264,  267,    0,    0,
+        0,    0,  267,  325,  324,  329,    0,  263,  263,  263,
+      263,  263,  263,    0,  348,  348,  333,  333,  348,    0,
+      333,  329,    0,  264,  264,  264,  264,  264,  264,    0,
+      324,  333,  334,  334,    0,    0,  334,    0,    0,  267,
+      326,  326,    0,    0,  326,    0,  267,  334,    0,  272,
+        0,  267,  267,    0,    0,    0,  267,  272,  272,  272,
+      272,  272,  272,  333,  267,  273,    0,    0,  267,  326,
+      267,  267,  267,  273,  273,  273,  273,  273,  273,  334,
+
+      353,  353,    0,    0,  353,    0,  348,    0,  333,  272,
+      272,  272,  272,  272,  272,    0,    0,    0,    0,    0,
+        0,  326,    0,    0,  334,  273,  273,  273,  273,  273,
+      273,  300,  326,  300,  300,    0,    0,    0,    0,    0,
+        0,  300,  300,  300,  300,  300,  300,  300,  300,  300,
       300,  300,  300,  300,  300,  300,  300,  300,  300,  300,
+      300,  300,  300,  300,  300,  300,  300,    0,    0,    0,
+        0,  300,  353,  300,  300,  300,  300,  300,  300,  300,
       300,  300,  300,  300,  300,  300,  300,  300,  300,  300,
-      300,  300,  300,  300,  310,    0,  310,  310,    0,    0,
-        0,    0,    0,    0,  310,  310,  310,  310,  310,  310,
-      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
-      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
-        0,    0,    0,    0,  310,  364,  310,  310,  310,  310,
-      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
-
-      310,  310,  310,  310,  310,  310,  310,  310,  310,  310,
-      310,  310,  311,  367,  367,    0,    0,  367,    0,  311,
+      300,  300,  300,  300,  300,  300,  300,  300,  300,  301,
+
+        0,  365,  365,    0,    0,  365,  301,  301,  301,  301,
+      301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+      301,  301,  301,  301,  301,  301,  301,  301,  301,  301,
+      301,  301,  311,    0,  311,  311,    0,    0,    0,    0,
+        0,    0,  311,  311,  311,  311,  311,  311,  311,  311,
+      311,  311,  311,  311,  311,  311,  311,  311,  311,  311,
+      311,  311,  311,  311,  311,  311,  311,  311,    0,    0,
+        0,    0,  311,  365,  311,  311,  311,  311,  311,  311,
       311,  311,  311,  311,  311,  311,  311,  311,  311,  311,
       311,  311,  311,  311,  311,  311,  311,  311,  311,  311,
-      311,  311,  311,  311,  311,  328,  328,  329,  329,  328,
-        0,  329,    0,  330,  330,    0,  328,  330,  329,  334,
-      334,  333,  333,  334,  330,  333,  335,  335,    0,    0,
-      335,    0,  330,    0,  333,  336,  336,    0,    0,  336,
-      337,  337,  338,  338,  337,  367,  338,    0,  328,  334,
-      329,    0,  335,    0,  340,  340,  330,  336,  340,  342,
-
-      342,  341,  341,  342,  330,  341,  333,  340,    0,  337,
-      349,  349,  338,    0,  349,    0,    0,  328,    0,  329,
-        0,  334,  344,  344,  335,  330,  344,  341,    0,  336,
-      342,  334,    0,  333,    0,  349,  343,  343,  335,  340,
-      343,  337,    0,    0,  338,    0,  344,  336,    0,  346,
-      346,    0,  337,  346,  338,  343,    0,  347,  347,  341,
-        0,  347,  342,    0,  346,    0,  340,  349,    0,    0,
-        0,  342,  347,  341,    0,  348,  348,    0,  344,  348,
-      351,  351,  349,    0,  351,  352,  352,  343,    0,  352,
-      348,  353,  353,    0,  344,  353,  346,  354,  354,  355,
-
-      355,  354,  351,  355,  347,  358,  358,    0,  343,  358,
-      353,    0,  354,  352,    0,  356,  356,    0,    0,  356,
-        0,  346,  348,    0,  358,    0,    0,  355,    0,  347,
-        0,    0,  356,    0,  351,  357,  357,  360,  360,  357,
-        0,  360,  353,    0,  354,  352,    0,  348,    0,    0,
-      357,  360,  351,    0,  365,  365,  358,  352,  365,  355,
-        0,  359,  359,  353,  356,  359,  361,  361,    0,  354,
-      361,  355,    0,  365,  366,  366,  359,  358,  366,    0,
-        0,  361,  357,  360,  368,  368,    0,  356,  368,  366,
-      369,  369,    0,    0,  369,  370,  370,    0,    0,  370,
-
-      372,  372,    0,    0,  372,  365,    0,  357,  359,  360,
-      370,    0,  369,  361,  373,  373,  371,  371,  373,  372,
-      371,  366,    0,  374,  374,    0,  365,  374,  371,  373,
-        0,  380,  380,  359,    0,  380,    0,  374,  361,  374,
-        0,    0,  370,    0,  369,  371,  366,    0,  376,  376,
-        0,  372,  376,    0,  375,  375,  368,    0,  375,  380,
-      371,  373,  369,    0,    0,    0,    0,  370,  375,  374,
-        0,  374,  372,    0,  377,  377,    0,  371,  377,  376,
-        0,  378,  378,  379,  379,  378,  373,  379,  371,  377,
-        0,  380,  381,  381,    0,  374,  381,    0,  379,    0,
-
-      375,  382,  382,  380,    0,  382,    0,  381,    0,  383,
-      383,  376,  378,  383,    0,  384,  384,    0,    0,  384,
-      376,  377,    0,    0,  383,    0,  375,    0,    0,    0,
-      379,  385,  385,  382,    0,  385,  387,  387,    0,  381,
-      387,    0,    0,    0,  378,  384,  377,  386,  386,    0,
-        0,  386,    0,  378,    0,  379,  383,  389,  389,  385,
-        0,  389,    0,    0,  381,  382,  388,  388,  390,  390,
-      388,    0,  390,  382,    0,  386,    0,  384,    0,  388,
-        0,  383,    0,    0,  391,  391,  388,  384,  391,    0,
-      390,  385,  392,  392,  393,  393,  392,    0,  393,    0,
-
-      394,  394,    0,  385,  394,    0,    0,  386,  387,  393,
-        0,  388,    0,    0,  391,    0,  392,    0,  388,  386,
-      395,  395,  390,    0,  395,    0,    0,  396,  396,  389,
-        0,  396,    0,  397,  397,  394,    0,  397,  388,  395,
-      390,  393,    0,  400,  400,    0,  391,  400,  392,    0,
-        0,  396,  397,  398,  398,    0,  391,  398,    0,  399,
-      399,  396,    0,  399,  392,    0,  393,  394,  400,    0,
-      399,  395,  394,    0,    0,  401,  401,  398,  399,  401,
-        0,  406,  406,  396,  397,  406,  402,  402,    0,    0,
-      402,    0,  395,  396,  403,  403,    0,    0,  403,  396,
-
-      400,    0,  399,    0,  402,  397,  401,  405,  405,  398,
-      399,  405,    0,  404,  404,  400,  402,  404,    0,  403,
-        0,    0,    0,    0,    0,  398,    0,    0,    0,  456,
-      456,  399,  410,  456,    0,  405,  402,  404,  401,    0,
-      410,  410,  410,  410,  410,  410,    0,  401,  402,    0,
-        0,  403,  411,  406,    0,  457,  457,    0,  402,  457,
-      411,  411,  411,  411,  411,  411,  403,  405,    0,  404,
-        0,    0,  410,  410,  410,  410,  410,  410,  412,  405,
-      459,  459,    0,    0,  459,  404,  412,  412,  412,  412,
-      412,  412,  411,  411,  411,  411,  411,  411,  413,  474,
-
-      474,  456,    0,  474,  416,    0,  413,  413,  413,  413,
-      413,  413,  416,  416,  416,  416,  416,  416,  412,  412,
-      412,  412,  412,  412,  417,  458,  458,  457,    0,  458,
-        0,    0,  417,  417,  417,  417,  417,  417,  413,  413,
-      413,  413,  413,  413,  416,  416,  416,  416,  416,  416,
-      420,    0,  459,  458,    0,    0,    0,    0,  420,  420,
-      420,  420,  420,  420,  417,  417,  417,  417,  417,  417,
-      421,  474,    0,    0,    0,    0,    0,    0,  421,  421,
-      421,  421,  421,  421,    0,  458,    0,    0,    0,    0,
-      420,  420,  420,  420,  420,  420,    0,  458,    0,    0,
-
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-      421,  421,  421,  421,  421,  421,  442,    0,    0,  442,
-        0,  478,  478,    0,    0,  478,  442,  442,  442,  442,
-      442,  442,  442,  442,  442,  442,  442,  442,  442,  442,
-      442,  442,  442,  442,  442,  442,  442,  442,  442,  442,
-      442,  442,  451,    0,    0,  451,    0,    0,    0,    0,
-        0,    0,  451,  451,  451,  451,  451,  451,  451,  451,
-      451,  451,  451,  451,  451,  451,  451,  451,  451,  451,
-      451,  451,  451,  451,  451,  451,  451,  451,  460,  460,
-      461,  461,  460,  478,  461,  462,  462,    0,    0,  462,
-
-        0,  460,    0,    0,  461,    0,  463,  463,  464,  464,
-      463,    0,  464,  465,  465,  466,  466,  465,    0,  466,
-        0,  467,  467,    0,  462,  467,  468,  468,  469,  469,
-      468,    0,  469,  460,  463,    0,  461,    0,  464,    0,
-      475,  475,    0,  465,  475,  466,  470,  470,    0,    0,
-      470,  467,  469,    0,  472,  472,  462,  468,  472,    0,
-      460,    0,  461,    0,  476,  476,  463,  462,  476,    0,
-      464,  475,    0,    0,    0,  465,  470,  466,  463,  476,
-      464,    0,  472,  467,  469,  465,    0,  466,    0,  468,
-      471,  471,    0,  467,  471,  477,  477,    0,  468,  477,
-
-      469,  473,  473,  475,    0,  473,  471,    0,  470,    0,
-      477,  476,  475,    0,  472,  479,  479,    0,  470,  479,
-      473,  480,  480,  481,  481,  480,  472,  481,    0,  482,
-      482,  484,  484,  482,    0,  484,  476,    0,  471,  480,
-      483,  483,  477,    0,  483,  479,  485,  485,    0,  481,
-      485,    0,  473,  482,  486,  486,  487,  487,  486,    0,
-      487,    0,  471,    0,    0,  484,    0,  477,  488,  488,
-      483,  480,  488,  473,  485,    0,    0,  479,    0,  488,
-        0,  481,  486,    0,    0,  482,    0,  479,  489,  489,
-      490,  490,  489,  480,  490,  481,    0,  484,    0,    0,
-
-        0,  482,  483,  484,  492,  492,  485,  489,  492,  491,
-      491,  488,  483,  491,  486,  493,  493,    0,  485,  493,
-      490,    0,    0,  492,    0,  491,  486,    0,  487,  494,
-      494,  495,  495,  494,    0,  495,    0,    0,  493,  489,
-      488,    0,  497,  497,  496,  496,  497,    0,  496,  498,
-      498,    0,  490,  498,    0,  492,    0,  491,    0,    0,
-      489,  495,  490,  499,  499,  501,  501,  499,    0,  501,
-      493,    0,  496,    0,  500,  500,  492,    0,  500,  499,
-        0,  491,  502,  502,    0,    0,  502,  493,  500,    0,
-      505,  505,    0,  495,  505,  502,  503,  503,  504,  504,
-
-      503,  494,  504,  495,  496,  506,  506,  503,    0,  506,
-        0,  499,    0,  504,  497,  505,  496,    0,    0,    0,
-      500,  498,  507,  507,  508,  508,  507,  502,  508,    0,
-      509,  509,    0,  506,  509,  499,    0,  501,    0,  503,
-        0,  507,    0,  508,    0,  504,  500,  505,  510,  510,
-        0,    0,  510,    0,  502,  511,  511,    0,    0,  511,
-        0,  510,  505,  512,  512,  506,    0,  512,  503,    0,
-      504,    0,    0,  507,    0,  508,    0,  506,  513,  513,
-        0,    0,  513,  514,  514,    0,    0,  514,    0,  511,
-        0,  512,    0,  510,  507,    0,  508,    0,  514,  515,
-
-      515,    0,  509,  515,    0,  516,  516,    0,  513,  516,
-      517,  517,  515,    0,  517,    0,    0,    0,    0,  513,
-      510,  511,    0,  512,  516,  518,  518,  511,    0,  518,
-      514,    0,  520,  520,  517,  512,  520,    0,  519,  519,
-      513,    0,  519,  520,  515,  521,  521,    0,    0,  521,
-      513,  519,    0,  522,  522,  514,  516,  522,  523,  523,
-      524,  524,  523,    0,  524,    0,  517,  521,  522,    0,
-        0,  515,    0,  523,    0,  520,    0,  516,    0,    0,
-      525,  525,  517,  519,  525,  526,  526,    0,    0,  526,
-      527,  527,  529,  529,  527,    0,  529,  518,    0,  521,
-
-      522,    0,    0,  527,  520,  523,  529,    0,    0,  525,
-      519,  528,  528,    0,    0,  528,    0,  521,  530,  530,
-      531,  531,  530,    0,  531,  522,    0,  532,  532,    0,
-      523,  532,  524,    0,    0,  527,    0,  530,  529,  528,
-      528,  525,    0,    0,  531,  533,  533,    0,    0,  533,
-      534,  534,  525,    0,  534,  535,  535,  526,    0,  535,
-        0,    0,  527,    0,  529,    0,  537,  537,    0,  530,
-      537,  528,  528,    0,  534,    0,  531,  536,  536,  533,
-        0,  536,    0,  528,    0,  538,  538,    0,    0,  538,
-      530,  537,  531,    0,  539,  539,  535,    0,  539,  532,
-
-      538,    0,    0,    0,  540,  540,  534,  536,  540,  541,
-      541,  533,    0,  541,    0,    0,    0,  533,  539,    0,
-        0,  540,  534,  537,  541,    0,    0,  535,    0,    0,
-        0,    0,  538,  572,  572,    0,    0,  572,  537,  536,
-        0,  573,  573,    0,    0,  573,    0,    0,    0,  536,
-      539,  546,    0,  540,  575,  575,  541,  538,  575,  546,
-      546,  546,  546,  546,  546,    0,  539,    0,    0,  576,
-      576,  577,  577,  576,  547,  577,  540,    0,    0,    0,
-        0,  541,  547,  547,  547,  547,  547,  547,    0,  548,
-        0,  546,  546,  546,  546,  546,  546,  548,  548,  548,
-
-      548,  548,  548,    0,    0,  572,    0,  579,  579,    0,
-        0,  579,  549,  573,  547,  547,  547,  547,  547,  547,
-      549,  549,  549,  549,  549,  549,  575,  550,    0,  548,
-      548,  548,  548,  548,  548,  550,  550,  550,  550,  550,
-      550,  576,    0,  577,    0,  585,  585,    0,    0,  585,
-      551,    0,  549,  549,  549,  549,  549,  549,  551,  551,
-      551,  551,  551,  551,    0,  552,    0,  550,  550,  550,
-      550,  550,  550,  552,  552,  552,  552,  552,  552,  579,
-        0,  574,  574,  581,  581,  574,    0,  581,  553,    0,
-      551,  551,  551,  551,  551,  551,  553,  553,  553,  553,
-
-      553,  553,    0,    0,    0,  552,  552,  552,  552,  552,
-      552,  574,  578,  578,    0,    0,  578,  585,  581,  580,
-      580,    0,    0,  580,    0,    0,    0,    0,  553,  553,
-      553,  553,  553,  553,  580,  582,  582,    0,    0,  582,
-      578,  583,  583,  574,    0,  583,    0,  584,  584,    0,
-      581,  584,    0,  574,    0,  581,  583,  582,    0,  586,
-      586,    0,  584,  586,    0,    0,  580,  588,  588,  587,
-      587,  588,  578,  587,    0,  589,  589,    0,  586,  589,
-        0,  591,  591,    0,  578,  591,  590,  590,  583,  582,
-      590,  580,    0,  587,  584,    0,  588,  592,  592,    0,
-
-      591,  592,  593,  593,  595,  595,  593,  582,  595,    0,
-      586,  596,  596,  583,  590,  596,  594,  594,    0,  584,
-      594,    0,    0,  595,    0,  587,    0,    0,  588,    0,
-        0,  586,  591,  594,  597,  597,  598,  598,  597,  588,
-      598,  587,    0,    0,  599,  599,  590,  589,  599,  597,
-      600,  600,    0,  591,  600,  595,  601,  601,  590,    0,
-      601,    0,    0,  602,  602,  594,  598,  602,  599,  592,
-        0,  601,    0,    0,  593,    0,  595,    0,  603,  603,
-        0,  597,  603,  596,    0,    0,  604,  604,  594,    0,
-      604,  605,  605,    0,    0,  605,    0,  604,  598,    0,
-
-      599,  606,  606,  601,    0,  606,  597,    0,  598,    0,
-      607,  607,  606,    0,  607,    0,  599,  608,  608,  609,
-      609,  608,  600,  609,    0,    0,    0,    0,  601,  604,
-      610,  610,  611,  611,  610,  602,  611,  612,  612,  613,
-      613,  612,    0,  613,  606,  607,    0,  614,  614,  609,
-      603,  614,  616,  616,  610,    0,  616,    0,  604,    0,
-      614,  612,  611,  605,  615,  615,    0,  616,  615,    0,
-      617,  617,    0,  606,  617,    0,    0,  607,    0,  618,
-      618,  609,  607,  618,  620,  620,  610,    0,  620,  608,
-        0,  609,  614,  612,  611,  620,  621,  621,  615,  616,
-
-      621,    0,  610,  618,  611,    0,  619,  619,    0,  612,
-      619,  613,    0,  622,  622,    0,    0,  622,    0,  614,
-        0,  619,    0,    0,  616,  623,  623,  620,    0,  623,
-      615,    0,    0,    0,    0,  618,  615,  621,  623,    0,
-        0,    0,  617,  622,  624,  624,  625,  625,  624,    0,
-      625,  618,    0,  619,  626,  626,  620,    0,  626,    0,
-        0,  625,  627,  627,    0,    0,  627,    0,  621,    0,
-      623,  626,    0,  627,  624,  622,  628,  628,  619,    0,
-      628,    0,  629,  629,    0,  622,  629,    0,    0,  628,
-      630,  630,    0,  625,  630,  631,  631,  623,    0,  631,
-
-      632,  632,    0,  626,  632,  627,  624,  633,  633,  630,
-        0,  633,    0,    0,    0,  632,  624,  631,  625,    0,
-        0,  628,    0,  629,  634,  634,  626,    0,  634,  635,
-      635,  636,  636,  635,  627,  636,    0,  633,    0,  637,
-      637,  630,  636,  637,    0,    0,    0,  632,  628,  631,
-        0,  638,  638,    0,  629,  638,    0,    0,  635,    0,
-      639,  639,  630,    0,  639,  634,    0,  631,    0,  633,
-        0,    0,  632,  639,  636,    0,  640,  640,    0,  633,
-      640,    0,  641,  641,    0,  639,  641,  642,  642,    0,
-      635,  642,    0,  643,  643,    0,  634,  643,  644,  644,
-
-        0,  635,  644,  636,    0,  639,    0,    0,  645,  645,
-      641,  637,  645,  642,    0,    0,    0,  639,    0,    0,
-        0,    0,    0,  638,    0,  664,  664,  665,  665,  664,
-        0,  665,  639,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,  641,  667,  667,  642,  665,  667,  640,    0,
-        0,    0,    0,    0,  641,    0,    0,  670,  670,  642,
-        0,  670,    0,  648,    0,  643,    0,    0,    0,    0,
-      644,  648,  648,  648,  648,  648,  648,  649,  665,    0,
-      645,    0,    0,  650,    0,  649,  649,  649,  649,  649,
-      649,  650,  650,  650,  650,  650,  650,  664,    0,  665,
-
-        0,  651,    0,  648,  648,  648,  648,  648,  648,  651,
-      651,  651,  651,  651,  651,  667,    0,  649,  649,  649,
-      649,  649,  649,  650,  650,  650,  650,  650,  650,  670,
-        0,    0,    0,    0,  668,  668,    0,    0,  668,  652,
-        0,  651,  651,  651,  651,  651,  651,  652,  652,  652,
-      652,  652,  652,  653,  671,  671,    0,    0,  671,  654,
-      668,  653,  653,  653,  653,  653,  653,  654,  654,  654,
-      654,  654,  654,    0,  666,  666,    0,  655,  666,  652,
-      652,  652,  652,  652,  652,  655,  655,  655,  655,  655,
-      655,    0,  668,  653,  653,  653,  653,  653,  653,  654,
-
-      654,  654,  654,  654,  654,  666,  668,    0,  669,  669,
-      675,  675,  669,    0,  675,    0,    0,  655,  655,  655,
-      655,  655,  655,  672,  672,    0,  671,  672,  673,  673,
-      674,  674,  673,    0,  674,  672,    0,  666,  669,  676,
-      676,  673,    0,  676,  677,  677,  666,    0,  677,  674,
-      678,  678,  679,  679,  678,    0,  679,  680,  680,  682,
-      682,  680,    0,  682,  676,    0,  678,  672,  681,  681,
-      669,    0,  681,  673,  683,  683,  679,    0,  683,    0,
-      669,  674,  675,    0,  684,  684,    0,  682,  684,  681,
-      685,  685,    0,    0,  685,  672,  676,    0,  678,    0,
-
-      673,    0,  674,    0,  683,    0,  684,    0,  679,  686,
-      686,  676,    0,  686,  687,  687,  677,    0,  687,  682,
-        0,  681,  678,    0,  679,    0,  688,  688,  687,  680,
-      688,  682,    0,  689,  689,    0,  683,  689,  684,    0,
-      681,  690,  690,    0,  689,  690,  683,  691,  691,  692,
-      692,  691,  690,  692,  693,  693,  684,    0,  693,    0,
-      687,    0,  685,  692,  694,  694,    0,    0,  694,    0,
-      695,  695,    0,    0,  695,    0,  689,    0,  696,  696,
-        0,  686,  696,  693,  690,    0,  687,  697,  697,    0,
-        0,  697,  694,  698,  698,  692,    0,  698,  688,  695,
-
-      696,    0,  699,  699,    0,  689,  699,    0,  698,    0,
-      700,  700,    0,  690,  700,  693,  702,  702,    0,  691,
-      702,  692,    0,    0,  694,    0,  693,    0,    0,  701,
-      701,  695,  696,  701,  703,  703,  694,    0,  703,    0,
-      698,    0,  695,    0,  701,  702,    0,  704,  704,    0,
-      696,  704,    0,  705,  705,    0,    0,  705,    0,  697,
-        0,    0,    0,    0,  703,  698,  706,  706,    0,    0,
-      706,    0,  704,    0,  699,    0,  701,  702,    0,    0,
-        0,  706,  700,  705,    0,  707,  707,    0,  702,  707,
-      708,  708,    0,    0,  708,    0,  703,    0,  707,  710,
-
-      710,  701,    0,  710,  704,    0,  703,  709,  709,  708,
-        0,  709,    0,  706,    0,  705,    0,    0,    0,  704,
-      711,  711,    0,  709,  711,  705,    0,    0,    0,  710,
-      707,  712,  712,    0,    0,  712,  713,  713,  706,    0,
-      713,  708,  711,  714,  714,  715,  715,  714,    0,  715,
-        0,    0,    0,    0,    0,  709,    0,  707,    0,  724,
-      724,  710,  708,  724,  713,    0,  712,    0,  728,  728,
-        0,  710,  728,  714,  711,    0,    0,    0,  717,  709,
-        0,  725,  725,    0,    0,  725,  717,  717,  717,  717,
-      717,  717,  711,    0,    0,    0,  713,    0,  712,    0,
-
-        0,  718,    0,  712,    0,  714,  725,    0,  713,  718,
-      718,  718,  718,  718,  718,  714,  719,  715,  717,  717,
-      717,  717,  717,  717,  719,  719,  719,  719,  719,  719,
-        0,  724,  735,  735,    0,    0,  735,    0,  725,  720,
-      728,  718,  718,  718,  718,  718,  718,  720,  720,  720,
-      720,  720,  720,  725,    0,    0,  719,  719,  719,  719,
-      719,  719,  726,  726,  730,  730,  726,    0,  730,    0,
-      727,  727,  729,  729,  727,  726,  729,    0,    0,  720,
-      720,  720,  720,  720,  720,  727,    0,  729,  731,  731,
-        0,    0,  731,    0,  730,  733,  733,  732,  732,  733,
-
-        0,  732,  734,  734,  735,    0,  734,  726,    0,    0,
-        0,    0,  736,  736,  733,  734,  736,  727,    0,  729,
-      731,  732,    0,  736,    0,    0,  730,  737,  737,  738,
-      738,  737,    0,  738,  726,    0,  730,  739,  739,    0,
-      737,  739,  727,    0,  729,    0,  733,  734,    0,    0,
-      741,  741,  731,  732,  741,  736,    0,  740,  740,    0,
-      731,  740,  742,  742,  743,  743,  742,  733,  743,  732,
-        0,    0,  737,    0,  734,    0,    0,  744,  744,  740,
-      741,  744,  745,  745,  736,    0,  745,  746,  746,  747,
-      747,  746,    0,  747,  748,  748,    0,    0,  748,  737,
-
-      744,  738,    0,    0,  749,  749,  746,    0,  749,  739,
-        0,  740,  741,  750,  750,  751,  751,  750,    0,  751,
-      752,  752,  741,  745,  752,    0,    0,  753,  753,  740,
-        0,  753,  744,  749,  742,    0,  743,    0,  746,  752,
-        0,  751,  754,  754,  755,  755,  754,    0,  755,  744,
-        0,  757,  757,    0,  745,  757,  753,    0,    0,  746,
-        0,  747,    0,  760,  760,  749,  748,  760,  755,    0,
-        0,  752,  754,  751,  756,  756,  749,  760,  756,    0,
-      757,    0,  759,  759,    0,  750,  759,  751,  753,  758,
-      758,    0,  752,  758,    0,  759,  756,  768,  768,  753,
-
-      755,  768,  761,  761,  754,    0,  761,    0,    0,  760,
-        0,    0,  757,    0,  754,    0,  755,  761,    0,    0,
-        0,  768,    0,  757,    0,  770,  770,  759,  756,  770,
-      758,    0,    0,    0,    0,  760,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,  756,  763,    0,  761,
-        0,    0,    0,  768,  759,  763,  763,  763,  763,  763,
-      763,  758,    0,    0,    0,    0,    0,  764,    0,  768,
-        0,    0,    0,  765,  761,  764,  764,  764,  764,  764,
-      764,  765,  765,  765,  765,  765,  765,  763,  763,  763,
-      763,  763,  763,  766,  769,  769,    0,  770,  769,    0,
-
-        0,  766,  766,  766,  766,  766,  766,  764,  764,  764,
-      764,  764,  764,  765,  765,  765,  765,  765,  765,  771,
-      771,  772,  772,  771,  769,  772,  773,  773,  774,  774,
-      773,    0,  774,  766,  766,  766,  766,  766,  766,  775,
-      775,  773,    0,  775,    0,  776,  776,  777,  777,  776,
-        0,  777,    0,    0,  775,    0,  769,  778,  778,    0,
-      776,  778,    0,  779,  779,    0,  769,  779,    0,  777,
-      781,  781,    0,  773,  781,  778,    0,  784,  784,  780,
-      780,  784,    0,  780,    0,    0,  775,    0,    0,    0,
-        0,  771,  776,  772,  780,  782,  782,    0,  773,  782,
-
-      774,  777,  783,  783,  785,  785,  783,  778,  785,  786,
-      786,  775,    0,  786,  787,  787,    0,  776,  787,  777,
-      782,  782,    0,    0,  782,  783,  780,  788,  788,  778,
-        0,  788,  789,  789,  785,  779,  789,    0,    0,  790,
-      790,  786,  781,  790,    0,  789,  788,    0,    0,  784,
-      790,  780,  782,  782,    0,  787,  782,  783,  791,  791,
-      792,  792,  791,    0,  792,    0,  785,  782,  793,  793,
-        0,  792,  793,  786,  783,    0,  785,  789,  788,  794,
-      794,  786,  790,  794,  795,  795,  787,    0,  795,    0,
-      793,    0,  801,  801,  794,    0,  801,    0,    0,  788,
-
-        0,    0,    0,  792,  789,  802,  802,    0,    0,  802,
-        0,  790,    0,  795,  803,  803,  805,  805,  803,    0,
-      805,    0,  793,    0,    0,  796,  794,    0,    0,    0,
-      791,    0,  792,  796,  796,  796,  796,  796,  796,    0,
-      793,    0,  806,  806,    0,  795,  806,    0,    0,  797,
-        0,  794,    0,    0,    0,    0,  795,  797,  797,  797,
-      797,  797,  797,  798,  801,  796,  796,  796,  796,  796,
-      796,  798,  798,  798,  798,  798,  798,  802,  808,  808,
-      809,  809,  808,    0,  809,    0,  803,  799,  805,  797,
-      797,  797,  797,  797,  797,  799,  799,  799,  799,  799,
-
-      799,    0,    0,  798,  798,  798,  798,  798,  798,  804,
-      804,  807,  807,  804,  806,  807,  810,  810,  811,  811,
-      810,    0,  811,  804,    0,    0,  807,  799,  799,  799,
-      799,  799,  799,    0,  812,  812,    0,    0,  812,  814,
-      814,  813,  813,  814,    0,  813,    0,  815,  815,    0,
-      808,  815,  809,  812,  814,  804,    0,    0,  807,  811,
-      813,    0,    0,    0,  816,  816,  817,  817,  816,    0,
-      817,    0,  815,    0,  818,  818,  819,  819,  818,    0,
-      819,  804,    0,  807,    0,  812,  814,    0,  810,  816,
-      811,  818,  813,  820,  820,    0,  817,  820,  821,  821,
-
-        0,    0,  821,    0,  815,  819,  812,    0,  820,    0,
-        0,  814,    0,  813,  822,  822,  827,  827,  822,  815,
-      827,  816,    0,  818,    0,    0,  821,    0,  817,    0,
-        0,  832,  832,    0,    0,  832,  816,  819,  817,    0,
-      820,    0,    0,    0,  822,    0,  818,    0,  819,  829,
-      829,  823,    0,  829,    0,    0,    0,    0,  821,  823,
-      823,  823,  823,  823,  823,  820,    0,    0,    0,  824,
-      821,  835,  835,    0,  829,  835,  822,  824,  824,  824,
-      824,  824,  824,  831,  831,    0,  822,  831,  827,  825,
-        0,  823,  823,  823,  823,  823,  823,  825,  825,  825,
-
-      825,  825,  825,  832,    0,    0,  829,  826,  831,  824,
-      824,  824,  824,  824,  824,  826,  826,  826,  826,  826,
-      826,  829,  833,  833,  828,  828,  833,    0,  828,  825,
-      825,  825,  825,  825,  825,  830,  830,  834,  834,  830,
-      831,  834,    0,  835,    0,    0,  833,  826,  826,  826,
-      826,  826,  826,  828,    0,  831,  836,  836,  837,  837,
-      836,  834,  837,  838,  838,  830,    0,  838,  839,  839,
-      840,  840,  839,    0,  840,  841,  841,    0,  833,  841,
-      842,  842,  843,  843,  842,  828,  843,  846,  846,    0,
-        0,  846,  838,  834,  833,    0,  828,  830,    0,  844,
-
-      844,    0,    0,  844,  845,  845,    0,  830,  845,  834,
-        0,  840,  847,  847,    0,    0,  847,    0,  848,  848,
-        0,    0,  848,  844,  838,    0,  845,    0,  836,    0,
-      837,    0,  849,  849,    0,  838,  849,  851,  851,    0,
-      839,  851,  840,  848,  850,  850,    0,  841,  850,  852,
-      852,    0,  842,  852,  843,  844,  853,  853,  845,  846,
-      853,  851,  854,  854,  855,  855,  854,    0,  855,    0,
-        0,  844,    0,    0,    0,  848,  845,    0,  853,  850,
-        0,    0,    0,    0,  847,    0,    0,    0,    0,    0,
-      848,    0,    0,  851,    0,    0,    0,  854,    0,    0,
-
-        0,    0,    0,    0,  849,    0,    0,    0,    0,  851,
-      853,  850,    0,    0,    0,    0,  850,    0,    0,    0,
-        0,  852,    0,    0,    0,    0,    0,    0,  853,  854,
-        0,    0,    0,    0,  854,    0,  855,  857,  857,  857,
-      857,  857,  857,  857,  857,  857,  857,  857,  857,  857,
-      857,  857,  857,  857,  857,  858,  858,  858,  858,  858,
-      858,  858,  858,  858,  858,  858,  858,  858,  858,  858,
-      858,  858,  858,  859,  859,  859,  859,  859,  859,  859,
-      859,  859,  859,  859,  859,  859,  859,  859,  859,  859,
-      859,  860,  860,  860,  860,  860,  860,  860,  860,  860,
-
-      860,  860,  860,  860,  860,  860,  860,  860,  860,  861,
-      861,  861,  861,  861,  861,  861,  861,  861,  861,  861,
-      861,  861,  861,  861,  861,  861,  861,  862,  862,  862,
-      862,  862,  862,  862,  862,  862,  862,  862,  862,  862,
-      862,  862,  862,  862,  862,  863,  863,  863,  863,  863,
-      863,  863,  863,  863,  863,  863,  863,  863,  863,  863,
-      863,  863,  863,  864,  864,  864,  864,  864,  864,  864,
-      864,  864,  864,  864,  864,  864,  864,  864,  864,  864,
-      864,  865,  865,  865,  865,  865,  865,  865,  865,  865,
-      865,  865,  865,  865,  865,  865,  865,  865,  865,  866,
-
-      866,  866,  866,  866,  866,  866,  866,  866,  866,  866,
-      866,  866,  866,  866,  866,  866,  866,  867,  867,  867,
-      867,  867,  867,  867,  867,  867,  867,  867,  867,  867,
-      867,  867,  867,  867,  867,  868,    0,  868,  868,  868,
-      868,  868,  868,  868,  868,  868,  868,  868,  868,    0,
-      868,  868,  868,  869,  869,  869,  869,  869,  869,  869,
-      869,  869,  869,  869,  869,  869,  869,  869,  869,  869,
-      869,  870,  870,  870,  870,    0,  870,  871,    0,  871,
-      871,  871,  871,  871,  871,  871,  871,  871,  871,  871,
-      871,    0,  871,  871,  871,  872,    0,    0,  872,    0,
-
-      872,    0,  872,  873,    0,  873,  873,  873,  873,  873,
-      873,  873,  873,  873,    0,  873,    0,  873,  874,  874,
-      874,  874,    0,  874,  876,  876,    0,  876,  876,    0,
-      876,    0,  876,    0,  876,  877,    0,  877,  877,    0,
-      877,    0,  877,  878,  878,    0,  878,  878,    0,  878,
-        0,  878,    0,  878,  879,    0,    0,  879,  879,    0,
-      879,  879,  879,  879,  879,  879,  879,  879,  879,  879,
-      879,  879,  880,    0,    0,  880,    0,  880,  880,  880,
-      880,  880,  880,  880,  880,  880,  880,  880,  880,  880,
-      881,    0,    0,  881,  881,  881,  881,  881,  881,  881,
-
-      881,  881,  881,  881,  881,  881,  881,  881,  882,    0,
-        0,  882,  882,  882,  882,  882,  882,  882,  882,  882,
-      882,  882,  882,  882,  882,  882,  883,  883,  883,  883,
-        0,    0,    0,    0,  883,    0,  883,  883,  883,  883,
-      883,  883,    0,  883,  884,    0,    0,  884,    0,  884,
-      884,  884,  884,  884,  884,  884,  884,  884,  884,  884,
-      884,  884,  885,    0,    0,  885,  885,  885,  885,  885,
-      885,    0,  885,  885,  885,  885,  885,  885,  885,  885,
-      886,    0,    0,  886,  886,    0,  886,  886,  886,  886,
-      886,  886,  886,  886,    0,  886,  886,  886,  887,  887,
 
+      312,    0,    0,    0,    0,    0,    0,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  327,  327,  328,  328,  327,    0,  328,
+        0,  330,  330,    0,  327,  330,  331,  331,    0,    0,
+      331,    0,  330,    0,    0,  332,  332,  331,    0,  332,
+        0,  336,  336,    0,  328,  336,  332,  335,  335,  341,
+      341,  335,    0,  341,  332,    0,  327,  337,  337,    0,
+      335,  337,  338,  338,  330,    0,  338,    0,    0,  331,
+        0,  336,    0,  345,  345,    0,  328,  345,  332,  341,
+
+        0,    0,    0,  337,  338,  327,  332,  328,    0,    0,
+        0,    0,  335,  330,    0,  339,  339,    0,  331,  339,
+        0,  340,  340,  336,  345,  340,    0,  332,    0,    0,
+        0,  341,    0,  336,    0,  337,  338,    0,    0,  335,
+        0,  341,  344,  344,  339,    0,  344,  343,  343,  337,
+      340,  343,    0,    0,  338,    0,  345,    0,  346,  346,
+      343,    0,  346,    0,    0,  345,  347,  347,  344,    0,
+      347,  349,  349,    0,    0,  349,  339,  346,    0,  350,
+      350,    0,  340,  350,  351,  351,  349,  339,  351,    0,
+      347,    0,  343,  340,  350,    0,    0,  355,  355,  351,
+
+      344,  355,  352,  352,    0,    0,  352,  354,  354,  346,
+        0,  354,    0,    0,  344,    0,  356,  356,  349,  343,
+      356,    0,  347,    0,    0,  355,  350,  352,    0,  354,
+      346,  351,    0,  357,  357,  356,    0,  357,  347,    0,
+      358,  358,    0,  349,  358,  359,  359,    0,  357,  359,
+        0,  350,    0,    0,  366,  366,  351,  355,  366,  352,
+        0,  354,  359,    0,    0,    0,    0,  356,  358,  355,
+        0,  360,  360,    0,  352,  360,    0,  361,  361,  354,
+      357,  361,    0,  362,  362,    0,  360,  362,  356,  363,
+      363,  364,  364,  363,  359,  364,  361,    0,  362,    0,
+
+      358,    0,    0,  363,    0,  357,  364,  369,  369,  367,
+      367,  369,  358,  367,    0,  368,  368,  359,  360,  368,
+      370,  370,  369,    0,  370,    0,  366,    0,  361,  371,
+      362,    0,  375,  375,  368,  363,  375,    0,  364,    0,
+      367,    0,    0,  360,  371,  371,  372,  372,  371,  361,
+      372,  375,  373,  373,  369,  362,  373,    0,  379,  379,
+        0,  363,  379,  364,    0,    0,  368,  373,  372,    0,
+        0,    0,  367,  374,  374,    0,    0,  374,    0,  369,
+        0,  367,    0,  375,    0,  374,    0,  368,    0,  379,
+      376,  376,  370,    0,  376,    0,    0,  378,  378,  373,
+
+      372,  378,  374,    0,  375,  376,  377,  377,  380,  380,
+      377,  378,  380,    0,    0,    0,  371,  374,  372,    0,
+      377,  379,  377,  380,  373,  381,  381,  382,  382,  381,
+      379,  382,  383,  383,  374,    0,  383,  376,    0,    0,
+      387,  387,  382,  378,  387,  374,  384,  384,    0,    0,
+      384,    0,  377,    0,  377,  380,  381,    0,    0,    0,
+      383,  384,  376,  385,  385,    0,    0,  385,    0,  378,
+      387,    0,  386,  386,  382,    0,  386,    0,  377,    0,
+      380,  388,  388,    0,    0,  388,    0,  386,  381,    0,
+      390,  390,  383,  384,  390,  385,    0,  381,    0,  382,
+
+        0,    0,  387,    0,  383,    0,  389,  389,    0,  388,
+      389,    0,  387,  391,  391,    0,    0,  391,  384,  386,
+      392,  392,    0,    0,  392,    0,  391,  385,  393,  393,
+        0,    0,  393,  391,  389,  385,    0,    0,    0,  394,
+      394,  388,    0,  394,  386,  397,  397,  395,  395,  397,
+      393,  395,    0,  388,    0,  396,  396,    0,  391,  396,
+      399,  399,  390,    0,  399,  391,  389,    0,    0,  394,
+      396,  395,  398,  398,    0,    0,  398,    0,  389,    0,
+      397,    0,  393,    0,  399,  391,  400,  400,    0,    0,
+      400,  398,  392,    0,  399,  403,  403,    0,    0,  403,
+
+      393,  394,  396,  395,    0,  400,  401,  401,    0,    0,
+      401,  394,  397,    0,  402,  402,  399,  397,  402,  395,
+      403,    0,    0,  398,    0,  402,  399,  396,    0,    0,
+      401,    0,  399,  402,    0,  404,  404,  400,    0,  404,
+        0,  405,  405,    0,  398,  405,    0,  406,  406,  407,
+      407,  406,  403,  407,    0,    0,    0,  402,  400,  405,
+      408,  408,  401,    0,  408,  402,  404,  403,    0,  409,
+      409,  405,  406,  409,  407,  410,  410,    0,  401,  410,
+        0,  411,  411,    0,  408,  411,  402,    0,    0,    0,
+        0,  405,    0,  410,    0,    0,    0,  409,  404,    0,
+
+        0,  461,  461,  405,  406,  461,  407,  404,    0,    0,
+        0,    0,    0,  405,    0,    0,  408,    0,    0,  406,
+        0,  407,    0,    0,    0,  410,  415,  462,  462,  409,
+        0,  462,  408,    0,  415,  415,  415,  415,  415,  415,
+        0,  409,    0,    0,    0,    0,  416,  410,    0,    0,
+        0,    0,  417,  411,  416,  416,  416,  416,  416,  416,
+      417,  417,  417,  417,  417,  417,  415,  415,  415,  415,
+      415,  415,  418,  461,  464,  464,    0,    0,  464,    0,
+      418,  418,  418,  418,  418,  418,  416,  416,  416,  416,
+      416,  416,  417,  417,  417,  417,  417,  417,  421,  462,
+
+      480,  480,    0,    0,  480,    0,  421,  421,  421,  421,
+      421,  421,  418,  418,  418,  418,  418,  418,  422,  463,
+      463,    0,    0,  463,  425,    0,  422,  422,  422,  422,
+      422,  422,  425,  425,  425,  425,  425,  425,  421,  421,
+      421,  421,  421,  421,  426,    0,  464,  463,    0,    0,
+        0,    0,  426,  426,  426,  426,  426,  426,  422,  422,
+      422,  422,  422,  422,  425,  425,  425,  425,  425,  425,
+        0,    0,  480,    0,    0,    0,    0,    0,    0,  463,
+        0,    0,    0,    0,  426,  426,  426,  426,  426,  426,
+      447,  463,    0,  447,    0,  485,  485,    0,    0,  485,
+
+      447,  447,  447,  447,  447,  447,  447,  447,  447,  447,
+      447,  447,  447,  447,  447,  447,  447,  447,  447,  447,
+      447,  447,  447,  447,  447,  447,  456,    0,    0,  456,
+        0,    0,    0,    0,    0,    0,  456,  456,  456,  456,
+      456,  456,  456,  456,  456,  456,  456,  456,  456,  456,
+      456,  456,  456,  456,  456,  456,  456,  456,  456,  456,
+      456,  456,  465,  465,  466,  466,  465,  485,  466,    0,
+      467,  467,  468,  468,  467,  465,  468,  469,  469,    0,
+        0,  469,    0,  466,  467,    0,    0,    0,  470,  470,
+      471,  471,  470,    0,  471,  472,  472,    0,    0,  472,
+
+        0,  468,  473,  473,    0,  469,  473,  465,  474,  474,
+      476,  476,  474,    0,  476,  466,  467,    0,  470,    0,
+      471,    0,  475,  475,    0,  472,  475,  477,  477,    0,
+        0,  477,  473,  468,  465,    0,  466,  469,    0,  474,
+      476,    0,  467,  477,  468,    0,  475,  479,  479,  469,
+      470,  479,  471,    0,    0,  478,  478,  472,    0,  478,
+      470,    0,  471,    0,  473,    0,  479,  472,    0,  481,
+      481,  474,  476,  481,  473,  477,    0,    0,  475,    0,
+      474,    0,  476,  478,  482,  482,  483,  483,  482,    0,
+      483,  484,  484,    0,  475,  484,    0,    0,  479,  477,
+
+      481,  483,    0,    0,  486,  486,  484,    0,  486,    0,
+        0,    0,  487,  487,  482,  478,  487,  488,  488,  479,
+        0,  488,  494,  494,  489,  489,  494,  478,  489,    0,
+      487,    0,  481,  483,  486,  490,  490,    0,  484,  490,
+        0,  481,    0,  488,    0,    0,  482,    0,  489,  491,
+      491,  492,  492,  491,    0,  492,  482,    0,  483,    0,
+      493,  493,  487,  484,  493,  490,  486,  495,  495,    0,
+        0,  495,    0,  496,  496,  488,  486,  496,  495,  492,
+      489,  501,  501,  491,  487,  501,  497,  497,  493,  488,
+      497,    0,  496,    0,  494,    0,  489,  490,  498,  498,
+
+      499,  499,  498,    0,  499,  500,  500,  490,    0,  500,
+      495,  492,    0,    0,  498,  491,  497,    0,    0,  499,
+      493,  491,    0,  492,  496,  502,  502,    0,  500,  502,
+        0,    0,  493,  503,  503,    0,    0,  503,    0,  495,
+      504,  504,    0,    0,  504,  496,  498,    0,  497,    0,
+        0,  499,    0,  501,    0,  502,    0,    0,  497,    0,
+      500,  503,  505,  505,    0,    0,  505,  506,  506,    0,
+      498,  506,  499,    0,  507,  507,    0,  500,  507,    0,
+      508,  508,  510,  510,  508,    0,  510,  502,  511,  511,
+      507,    0,  511,  503,  508,    0,  506,  502,  512,  512,
+
+        0,  511,  512,  513,  513,  503,    0,  513,    0,  512,
+      514,  514,  504,    0,  514,    0,  515,  515,  513,    0,
+      515,    0,  507,  516,  516,    0,  508,  516,  506,    0,
+        0,    0,    0,  511,  505,  514,  517,  517,    0,  506,
+      517,  512,  516,    0,  515,    0,  507,  518,  518,    0,
+      513,  518,  508,    0,  510,  517,    0,    0,  519,  519,
+      511,    0,  519,    0,    0,  520,  520,  514,    0,  520,
+      512,  519,    0,    0,  516,  513,  515,  523,  523,  521,
+      521,  523,  514,  521,    0,  522,  522,  517,  515,  522,
+        0,    0,  523,  524,  524,  516,    0,  524,    0,  520,
+
+        0,  525,  525,  519,    0,  525,  524,  521,  517,    0,
+      526,  526,  527,  527,  526,  522,  527,  529,  529,  518,
+      525,  529,    0,    0,  523,    0,  522,    0,  529,    0,
+      519,  520,  528,  528,  526,    0,  528,  520,  524,  521,
+      530,  530,  533,  533,  530,  528,  533,  522,    0,  523,
+        0,  521,  525,    0,  531,  531,    0,  522,  531,    0,
+      529,    0,  530,  532,  532,  524,  526,  532,    0,  531,
+      534,  534,    0,  525,  534,  535,  535,  528,  532,  535,
+        0,    0,  526,    0,  527,    0,    0,  536,  536,  529,
+        0,  536,  537,  537,  530,    0,  537,    0,    0,  534,
+
+      536,  531,  538,  538,  528,    0,  538,  541,  541,    0,
+      532,  541,  530,    0,  533,    0,  538,    0,  539,  539,
+      537,  537,  539,    0,  544,  544,  531,    0,  544,  547,
+      547,  534,  536,  547,    0,  532,    0,  539,    0,  540,
+      540,    0,  534,  540,  547,  545,  545,  535,  538,  545,
+      542,  542,  537,  537,  542,    0,  543,  543,    0,  536,
+      543,    0,    0,  540,  537,  544,  546,  546,    0,  539,
+      546,    0,    0,    0,  538,  545,  547,  548,  548,  541,
+      543,  548,    0,    0,  542,  549,  549,    0,    0,  549,
+      539,  546,    0,  550,  550,  540,  544,  550,  551,  551,
+
+        0,  547,  551,    0,    0,    0,    0,  545,  548,  549,
+      550,  540,  543,  551,  552,  552,  542,  545,  552,    0,
+        0,    0,  542,  546,    0,    0,    0,    0,  543,    0,
+      583,  583,    0,    0,  583,    0,    0,    0,  546,    0,
+      548,  549,  550,    0,    0,  551,    0,    0,    0,  548,
+      557,    0,  584,  584,    0,    0,  584,  549,  557,  557,
+      557,  557,  557,  557,  558,  550,    0,    0,    0,    0,
+      551,  559,  558,  558,  558,  558,  558,  558,    0,  559,
+      559,  559,  559,  559,  559,    0,  552,    0,  560,    0,
+      557,  557,  557,  557,  557,  557,  560,  560,  560,  560,
+
+      560,  560,  583,    0,  558,  558,  558,  558,  558,  558,
+      561,  559,  559,  559,  559,  559,  559,    0,  561,  561,
+      561,  561,  561,  561,  584,    0,  562,    0,  560,  560,
+      560,  560,  560,  560,  562,  562,  562,  562,  562,  562,
+        0,  586,  586,  587,  587,  586,    0,  587,  563,    0,
+      561,  561,  561,  561,  561,  561,  563,  563,  563,  563,
+      563,  563,    0,    0,  564,  586,  562,  562,  562,  562,
+      562,  562,  564,  564,  564,  564,  564,  564,  588,  588,
+      585,  585,  588,    0,  585,    0,    0,    0,  563,  563,
+      563,  563,  563,  563,  589,  589,    0,  586,  589,  590,
+
+      590,    0,    0,  590,  564,  564,  564,  564,  564,  564,
+      585,    0,    0,  586,    0,  587,  591,  591,  592,  592,
+      591,    0,  592,    0,    0,  593,  593,  590,    0,  593,
+        0,  594,  594,  592,    0,  594,  595,  595,    0,    0,
+      595,    0,  585,  597,  597,  598,  598,  597,    0,  598,
+      588,  595,  585,  594,  596,  596,    0,    0,  596,  590,
+      593,    0,    0,    0,  598,  592,  589,    0,    0,  596,
+        0,  590,    0,    0,  599,  599,  600,  600,  599,    0,
+      600,    0,    0,  595,    0,  594,    0,    0,  591,    0,
+      592,    0,  593,    0,    0,    0,  598,  593,  599,    0,
+
+        0,  596,    0,  594,    0,  600,  601,  601,  595,    0,
+      601,    0,  602,  602,    0,  597,  602,  598,    0,  603,
+      603,  604,  604,  603,    0,  604,  596,  605,  605,    0,
+      599,  605,  606,  606,    0,  601,  606,  600,  607,  607,
+      604,    0,  607,    0,    0,    0,  599,  603,  600,  608,
+      608,    0,    0,  608,    0,  607,  609,  609,  610,  610,
+      609,    0,  610,    0,    0,  611,  611,  601,  608,  611,
+      612,  612,  604,  610,  612,    0,  613,  613,  601,  603,
+      613,    0,  614,  614,  602,    0,  614,  607,  615,  615,
+        0,  603,  615,  604,  612,  611,    0,  614,    0,  605,
+
+      608,    0,  616,  616,  606,  610,  616,  617,  617,    0,
+      607,  617,  618,  618,    0,    0,  618,    0,  617,  620,
+      620,  608,    0,  620,    0,    0,  612,  611,  609,  614,
+      610,    0,  619,  619,  621,  621,  619,  611,  621,    0,
+      622,  622,  612,  619,  622,  628,  628,    0,  613,  628,
+      617,  624,  624,    0,  614,  624,    0,    0,  625,  625,
+      615,    0,  625,  626,  626,    0,    0,  626,    0,  621,
+        0,    0,  627,  627,  616,  619,  627,    0,    0,  617,
+        0,  624,  625,    0,  618,    0,  629,  629,  630,  630,
+      629,  620,  630,  626,  631,  631,  627,    0,  631,  629,
+
+        0,  621,    0,    0,  619,    0,  621,  632,  632,  631,
+        0,  632,  622,  624,  625,  633,  633,  628,    0,  633,
+      636,  636,  630,  624,  636,  626,    0,    0,  627,    0,
+      625,  629,    0,  634,  634,  626,    0,  634,    0,  633,
+        0,  631,  635,  635,  627,    0,  635,    0,  634,    0,
+        0,  637,  637,  635,  630,  637,    0,    0,  629,    0,
+      630,  636,    0,  638,  638,    0,  631,  638,  639,  639,
+        0,  633,  639,  640,  640,    0,  638,  640,    0,  632,
+      634,  637,  641,  641,    0,  635,  641,  633,  640,  642,
+      642,    0,  636,  642,    0,    0,    0,    0,  639,  641,
+
+      642,    0,  643,  643,    0,  634,  643,    0,  638,    0,
+        0,    0,    0,  637,  635,  643,    0,  644,  644,    0,
+      640,  644,    0,  637,  645,  645,    0,    0,  645,    0,
+      639,  641,  642,  646,  646,  638,    0,  646,  647,  647,
+      639,    0,  647,  645,    0,  640,    0,  643,  650,  650,
+        0,    0,  650,  647,  641,  646,  648,  648,  644,    0,
+      648,  642,  649,  649,    0,    0,  649,    0,  651,  651,
+        0,    0,  651,    0,  643,  645,    0,  650,    0,  651,
+      652,  652,    0,    0,  652,  647,  648,  646,    0,  644,
+      653,  653,    0,    0,  653,    0,  645,    0,  655,  655,
+
+      654,  654,  655,  649,  654,  646,    0,    0,    0,  650,
+      647,  651,    0,  654,    0,  656,  656,    0,  648,  656,
+      650,    0,  657,  657,    0,  654,  657,    0,  648,  658,
+      658,  659,  659,  658,  649,  659,    0,  660,  660,    0,
+      651,  660,    0,  656,    0,  654,  661,  661,  657,    0,
+      661,    0,  652,  658,    0,  664,    0,  654,    0,    0,
+        0,    0,  653,  664,  664,  664,  664,  664,  664,    0,
+      655,    0,  654,    0,    0,  656,    0,    0,    0,    0,
+      657,    0,  680,  680,    0,  658,  680,  656,    0,    0,
+        0,    0,    0,    0,  657,  664,  664,  664,  664,  664,
+
+      664,  658,  665,  659,  681,  681,    0,    0,  681,  660,
+      665,  665,  665,  665,  665,  665,  666,    0,  661,    0,
+        0,    0,  667,  681,  666,  666,  666,  666,  666,  666,
+      667,  667,  667,  667,  667,  667,    0,    0,    0,    0,
+      668,    0,  665,  665,  665,  665,  665,  665,  668,  668,
+      668,  668,  668,  668,  680,  681,  666,  666,  666,  666,
+      666,  666,  667,  667,  667,  667,  667,  667,    0,    0,
+        0,    0,    0,  684,  684,    0,  681,  684,  669,    0,
+      668,  668,  668,  668,  668,  668,  669,  669,  669,  669,
+      669,  669,  670,  683,  683,  682,  682,  683,  671,  682,
+
+      670,  670,  670,  670,  670,  670,  671,  671,  671,  671,
+      671,  671,  682,  687,  687,    0,    0,  687,  669,  669,
+      669,  669,  669,  669,  683,  685,  685,  686,  686,  685,
+        0,  686,  670,  670,  670,  670,  670,  670,  671,  671,
+      671,  671,  671,  671,  682,  684,  688,  688,  689,  689,
+      688,  685,  689,    0,    0,    0,  683,  686,  690,  690,
+      689,    0,  690,    0,    0,  683,    0,  682,  691,  691,
+        0,  690,  691,  692,  692,  693,  693,  692,    0,  693,
+      694,  694,    0,  685,  694,  687,    0,  691,    0,  686,
+      695,  695,  689,    0,  695,    0,    0,  685,    0,  686,
+
+      696,  696,    0,  690,  696,  694,    0,  697,  697,  698,
+      698,  697,    0,  698,    0,    0,  696,    0,  688,  691,
+      689,  699,  699,  700,  700,  699,    0,  700,  701,  701,
+      690,  697,  701,    0,  702,  702,    0,  694,  702,    0,
+      691,    0,  699,    0,    0,  692,    0,  693,  696,  703,
+      703,  700,  694,  703,    0,    0,  702,    0,  701,    0,
+      705,  705,  695,  697,  705,    0,  706,  706,    0,    0,
+      706,    0,  696,    0,  699,    0,    0,    0,    0,  697,
+      706,  698,    0,  700,    0,  707,  707,    0,  702,  707,
+      701,    0,    0,  699,    0,  700,    0,  708,  708,    0,
+
+      701,  708,    0,  709,  709,    0,  702,  709,  708,  710,
+      710,    0,  706,  710,  709,  711,  711,    0,    0,  711,
+        0,  703,  712,  712,  713,  713,  712,    0,  713,  711,
+      714,  714,  705,    0,  714,  716,  716,    0,  706,  716,
+      708,  715,  715,  717,  717,  715,  709,  717,    0,  718,
+      718,  712,  713,  718,    0,    0,    0,  707,  717,  714,
+        0,  711,    0,  715,  719,  719,    0,    0,  719,  708,
+      720,  720,  721,  721,  720,  709,  721,    0,  722,  722,
+        0,  710,  722,  712,  713,  720,    0,  711,  731,  731,
+      717,  714,  731,    0,  712,  715,  713,    0,    0,  723,
+
+      723,  721,  714,  723,    0,  724,  724,  716,  722,  724,
+      725,  725,    0,  715,  725,  717,    0,  720,  726,  726,
+        0,  718,  726,  731,  723,  725,  730,  730,  727,  727,
+      730,  726,  727,  721,    0,  724,  719,  728,  728,    0,
+      722,  728,  720,    0,  721,  729,  729,  727,  730,  729,
+      722,    0,    0,  728,    0,  731,  723,  725,  732,  732,
+      731,    0,  732,  726,  733,  733,    0,  724,  733,  734,
+      734,  723,    0,  734,    0,  729,    0,  724,    0,  727,
+      730,    0,  725,  735,  735,  728,  732,  735,    0,    0,
+      726,    0,    0,    0,  733,    0,    0,  735,  730,    0,
+
+      727,    0,  737,    0,  744,  744,    0,  729,  744,  728,
+      737,  737,  737,  737,  737,  737,    0,  729,  732,    0,
+      749,  749,    0,    0,  749,    0,  733,    0,    0,  735,
+      732,    0,    0,    0,  745,  745,  733,    0,  745,    0,
+      738,  734,  737,  737,  737,  737,  737,  737,  738,  738,
+      738,  738,  738,  738,  739,  735,    0,  746,  746,  745,
+      740,  746,  739,  739,  739,  739,  739,  739,  740,  740,
+      740,  740,  740,  740,  747,  747,  744,    0,  747,    0,
+      738,  738,  738,  738,  738,  738,  746,  747,    0,  752,
+      752,  745,  749,  752,  739,  739,  739,  739,  739,  739,
+
+      740,  740,  740,  740,  740,  740,  745,  748,  748,  750,
+      750,  748,    0,  750,    0,    0,  753,  753,  746,  747,
+      753,  752,  748,    0,  750,    0,    0,  751,  751,  746,
+        0,  751,  754,  754,    0,    0,  754,  755,  755,    0,
+      753,  755,    0,  756,  756,    0,  747,  756,  757,  757,
+      755,  754,  757,  752,  748,    0,  750,  751,    0,  757,
+        0,  752,  758,  758,  759,  759,  758,    0,  759,  761,
+      761,    0,  753,  761,    0,  758,  762,  762,    0,  748,
+      762,  750,  755,  754,    0,    0,  764,  764,  753,  751,
+      764,  757,  763,  763,    0,    0,  763,    0,  762,  751,
+
+        0,  765,  765,    0,  754,  765,    0,  758,    0,  755,
+      766,  766,  767,  767,  766,  756,  767,  769,  769,    0,
+      757,  769,  763,  768,  768,  770,  770,  768,    0,  770,
+      762,  771,  771,  766,  758,  771,  759,    0,    0,  772,
+      772,  761,  768,  772,    0,    0,  773,  773,  762,    0,
+      773,  774,  774,  767,  763,  774,    0,    0,  764,    0,
+      771,    0,    0,    0,  763,  766,    0,  775,  775,    0,
+      774,  775,  773,  765,  768,  776,  776,  777,  777,  776,
+        0,  777,  766,    0,  767,    0,  778,  778,    0,  769,
+      778,    0,  771,    0,    0,  768,  775,  770,    0,    0,
+
+        0,  777,  774,  771,  773,  776,  779,  779,  778,    0,
+      779,  772,  780,  780,    0,    0,  780,    0,  773,    0,
+        0,  781,  781,  774,    0,  781,  784,  784,  775,    0,
+      784,    0,    0,  777,  781,  779,    0,  776,    0,  775,
+      778,  782,  782,    0,    0,  782,    0,  776,    0,  777,
+      783,  783,    0,  780,  783,  782,    0,    0,  778,    0,
+      786,    0,    0,    0,    0,  783,  781,  779,  786,  786,
+      786,  786,  786,  786,    0,    0,    0,    0,  779,    0,
+        0,  792,  792,    0,  780,  792,    0,  782,    0,    0,
+        0,    0,    0,  781,    0,    0,    0,  783,  784,  787,
+
+      786,  786,  786,  786,  786,  786,  788,  787,  787,  787,
+      787,  787,  787,  782,  788,  788,  788,  788,  788,  788,
+      789,    0,  783,  794,  794,    0,    0,  794,  789,  789,
+      789,  789,  789,  789,  791,  791,    0,    0,  791,  787,
+      787,  787,  787,  787,  787,    0,  788,  788,  788,  788,
+      788,  788,    0,  792,    0,  793,  793,    0,  791,  793,
+      789,  789,  789,  789,  789,  789,  795,  795,  796,  796,
+      795,    0,  796,  797,  797,  798,  798,  797,    0,  798,
+      801,  801,  799,  799,  801,  793,  799,    0,  797,    0,
+      791,    0,  800,  800,    0,  794,  800,  799,    0,    0,
+
+      802,  802,  801,    0,  802,    0,  791,  800,  804,  804,
+      805,  805,  804,    0,  805,  806,  806,  793,  802,  806,
+      797,    0,  809,  809,    0,  805,  809,  793,    0,  799,
+        0,    0,  813,  813,  801,    0,  813,    0,  795,  800,
+      796,    0,  807,  807,    0,  797,  807,  798,    0,    0,
+      802,  813,  801,    0,  799,  808,  808,  805,    0,  808,
+        0,  810,  810,    0,  800,  810,    0,  807,  807,    0,
+        0,  807,  802,  811,  811,  812,  812,  811,  808,  812,
+      804,    0,  805,  813,  814,  814,    0,  806,  814,  816,
+      816,  810,    0,  816,  809,    0,    0,  814,    0,  807,
+
+      807,    0,    0,  807,  813,  811,    0,  815,  815,    0,
+      808,  815,    0,    0,  807,    0,  812,    0,  815,    0,
+      817,  817,    0,  810,  817,    0,    0,  808,    0,  814,
+        0,  817,    0,  810,    0,  818,  818,  811,    0,  818,
+      819,  819,  820,  820,  819,  811,  820,  812,    0,    0,
+      815,    0,    0,    0,    0,  819,  814,  818,    0,    0,
+        0,  816,    0,  817,    0,  826,  826,    0,    0,  826,
+        0,  820,  827,  827,    0,    0,  827,    0,    0,  815,
+        0,    0,    0,    0,    0,  821,    0,  819,    0,  818,
+        0,    0,  817,  821,  821,  821,  821,  821,  821,    0,
+
+      828,  828,    0,  820,  828,  830,  830,  818,  822,  830,
+        0,    0,  819,    0,  820,    0,  822,  822,  822,  822,
+      822,  822,    0,  823,    0,  821,  821,  821,  821,  821,
+      821,  823,  823,  823,  823,  823,  823,  826,  831,  831,
+        0,    0,  831,    0,  827,    0,  824,    0,  822,  822,
+      822,  822,  822,  822,  824,  824,  824,  824,  824,  824,
+        0,    0,    0,  823,  823,  823,  823,  823,  823,  829,
+      829,    0,  828,  829,    0,    0,    0,  830,  832,  832,
+      833,  833,  832,  829,  833,    0,  824,  824,  824,  824,
+      824,  824,    0,  832,  834,  834,  835,  835,  834,    0,
+
+      835,  836,  836,  837,  837,  836,    0,  837,  838,  838,
+      831,    0,  838,  839,  839,  829,    0,  839,    0,  840,
+      840,    0,  837,  840,    0,  832,    0,  838,  839,    0,
+      841,  841,  842,  842,  841,    0,  842,    0,    0,  843,
+      843,  829,  836,  843,  840,  844,  844,  847,  847,  844,
+      832,  847,  833,    0,  837,  841,  843,  852,  852,  838,
+      839,  852,  842,  845,  845,    0,  834,  845,  835,    0,
+        0,    0,    0,  836,  844,  837,  840,  847,  845,    0,
+      838,    0,    0,    0,    0,  839,    0,  841,  843,    0,
+        0,  840,  846,  846,  842,    0,  846,    0,    0,    0,
+
+        0,    0,  841,    0,  842,    0,  844,    0,    0,  847,
+      845,  843,    0,  848,    0,    0,    0,  844,    0,  847,
+      846,  848,  848,  848,  848,  848,  848,    0,  849,  852,
+        0,    0,    0,    0,  850,  845,  849,  849,  849,  849,
+      849,  849,  850,  850,  850,  850,  850,  850,    0,    0,
+        0,    0,  846,  848,  848,  848,  848,  848,  848,  854,
+      854,  856,  856,  854,  846,  856,    0,    0,  849,  849,
+      849,  849,  849,  849,  850,  850,  850,  850,  850,  850,
+      851,  853,  853,    0,  854,  853,  856,    0,  851,  851,
+      851,  851,  851,  851,  857,  857,  855,  855,  857,    0,
+
+      855,    0,    0,  858,  858,  859,  859,  858,    0,  859,
+      853,  860,  860,  861,  861,  860,  854,  861,  856,    0,
+      851,  851,  851,  851,  851,  851,  855,  858,    0,  859,
+        0,  854,    0,  856,  862,  862,  863,  863,  862,    0,
+      863,    0,  853,  864,  864,  865,  865,  864,    0,  865,
+      866,  866,    0,  853,  866,    0,  867,  867,  855,  858,
+      867,  859,    0,  868,  868,  863,  857,  868,  855,  869,
+      869,    0,    0,  869,    0,  858,    0,  859,  870,  870,
+      871,  871,  870,  860,  871,  861,  865,  872,  872,    0,
+        0,  872,    0,  869,  873,  873,    0,  863,  873,    0,
+
+      870,  874,  874,  875,  875,  874,  862,  875,  863,  876,
+      876,    0,    0,  876,    0,  864,    0,  865,    0,  873,
+      877,  877,  866,    0,  877,  869,  878,  878,  867,    0,
+      878,    0,  870,  876,    0,  868,  879,  879,  875,    0,
+      879,  869,  880,  880,    0,    0,  880,    0,  878,    0,
+      870,  873,  871,    0,    0,    0,    0,    0,    0,  872,
+        0,    0,    0,    0,    0,  876,  873,    0,    0,    0,
+      875,  879,    0,  874,    0,  875,    0,    0,    0,    0,
+      878,  876,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,  877,    0,    0,    0,    0,    0,  878,    0,
+
+        0,    0,    0,  879,    0,    0,    0,    0,  879,    0,
+        0,    0,    0,    0,  880,  882,  882,  882,  882,  882,
+      882,  882,  882,  882,  882,  882,  882,  882,  882,  882,
+      882,  882,  882,  883,  883,  883,  883,  883,  883,  883,
+      883,  883,  883,  883,  883,  883,  883,  883,  883,  883,
+      883,  884,  884,  884,  884,  884,  884,  884,  884,  884,
+      884,  884,  884,  884,  884,  884,  884,  884,  884,  885,
+      885,  885,  885,  885,  885,  885,  885,  885,  885,  885,
+      885,  885,  885,  885,  885,  885,  885,  886,  886,  886,
+      886,  886,  886,  886,  886,  886,  886,  886,  886,  886,
+
+      886,  886,  886,  886,  886,  887,  887,  887,  887,  887,
       887,  887,  887,  887,  887,  887,  887,  887,  887,  887,
-      887,  887,  887,  887,  887,  887,  888,    0,  888,  888,
+      887,  887,  887,  888,  888,  888,  888,  888,  888,  888,
       888,  888,  888,  888,  888,  888,  888,  888,  888,  888,
-        0,  888,  888,  888,  889,    0,  889,  889,  889,  889,
-      889,  889,  889,  889,  889,  889,  889,  889,    0,  889,
-      889,  889,  890,    0,    0,  890,    0,  890,    0,  890,
-      891,    0,  891,  891,  891,  891,  891,  891,  891,  891,
-      891,  891,  891,  891,    0,  891,  891,  891,  892,  892,
-        0,  892,    0,    0,  892,    0,  892,    0,  892,  893,
-        0,  893,  893,  893,  893,  893,  893,  893,  893,  893,
-
-        0,  893,    0,  893,  894,    0,    0,  894,    0,  894,
-        0,  894,  896,    0,    0,  896,  896,    0,  896,    0,
-        0,  896,    0,  896,    0,  896,  897,  897,    0,  897,
-      897,    0,  897,    0,  897,    0,  897,  898,    0,    0,
-      898,    0,  898,    0,  898,  899,    0,    0,    0,  899,
-        0,    0,    0,    0,  899,    0,  899,  900,    0,  900,
-        0,    0,  900,    0,  900,  901,    0,    0,  901,    0,
-      901,    0,  901,  902,    0,    0,  902,  902,    0,  902,
-      902,  902,  902,  902,  902,  902,  902,  902,  902,  902,
-      902,  903,    0,    0,  903,    0,  903,  903,  903,  903,
-
-      903,  903,  903,  903,  903,  903,  903,  903,  903,  904,
-        0,    0,  904,  904,  904,  904,  904,  904,  904,  904,
-      904,  904,  904,  904,  904,  904,  904,  905,    0,    0,
-      905,  905,  905,  905,  905,  905,  905,  905,  905,  905,
-      905,  905,  905,  905,  905,  906,  906,  906,  906,    0,
-        0,    0,    0,  906,    0,  906,  906,  906,  906,  906,
-      906,    0,  906,  907,    0,    0,  907,  907,  907,  907,
+      888,  889,  889,  889,  889,  889,  889,  889,  889,  889,
+      889,  889,  889,  889,  889,  889,  889,  889,  889,  890,
+      890,  890,  890,  890,  890,  890,  890,  890,  890,  890,
+      890,  890,  890,  890,  890,  890,  890,  891,  891,  891,
+      891,  891,  891,  891,  891,  891,  891,  891,  891,  891,
+      891,  891,  891,  891,  891,  892,  892,  892,  892,  892,
+
+      892,  892,  892,  892,  892,  892,  892,  892,  892,  892,
+      892,  892,  892,  893,    0,  893,  893,  893,  893,  893,
+      893,  893,  893,  893,  893,  893,  893,    0,  893,  893,
+      893,  894,  894,  894,  894,  894,  894,  894,  894,  894,
+      894,  894,  894,  894,  894,  894,  894,  894,  894,  895,
+      895,  895,  895,    0,  895,  896,    0,  896,  896,  896,
+      896,  896,  896,  896,  896,  896,  896,  896,  896,    0,
+      896,  896,  896,  897,    0,    0,  897,    0,  897,    0,
+      897,  898,    0,  898,  898,  898,  898,  898,  898,  898,
+      898,  898,    0,  898,    0,  898,  899,  899,  899,  899,
+
+        0,  899,  901,  901,    0,  901,  901,    0,  901,    0,
+      901,    0,  901,  902,    0,  902,  902,    0,  902,    0,
+      902,  903,  903,    0,  903,  903,    0,  903,    0,  903,
+        0,  903,  904,    0,    0,  904,  904,    0,  904,  904,
+      904,  904,  904,  904,  904,  904,  904,  904,  904,  904,
+      905,    0,    0,  905,    0,  905,  905,  905,  905,  905,
+      905,  905,  905,  905,  905,  905,  905,  905,  906,    0,
+        0,  906,  906,  906,  906,  906,  906,  906,  906,  906,
+      906,  906,  906,  906,  906,  906,  907,    0,    0,  907,
       907,  907,  907,  907,  907,  907,  907,  907,  907,  907,
-      907,  908,  908,  908,  908,  908,  908,  908,  908,  908,
-      908,  908,  908,  908,  908,  908,  908,  908,  908,  909,
-
-        0,    0,  909,  909,  909,  909,  909,  909,    0,  909,
-      909,  909,  909,  909,  909,  909,  909,  910,    0,    0,
-      910,  910,    0,  910,  910,  910,  910,  910,  910,  910,
-      910,    0,  910,  910,  910,  911,    0,    0,  911,  911,
-        0,  911,  911,  911,  911,  911,  911,  911,  911,    0,
-      911,  911,  911,  912,    0,    0,  912,  912,    0,  912,
-      912,  912,  912,  912,  912,  912,  912,    0,  912,  912,
-      912,  913,    0,  913,  913,  913,    0,  913,  913,  913,
-      913,  913,  913,  913,  913,    0,  913,  913,  913,  914,
-      914,    0,  914,  914,    0,  914,  914,  914,  914,  914,
-
-      914,  914,  914,    0,  914,  914,  914,  915,    0,    0,
-      915,    0,  915,    0,  915,  916,    0,    0,  916,  916,
-      916,  916,  916,  916,  916,  916,  916,  916,  916,    0,
-      916,  916,  916,  917,    0,    0,    0,    0,    0,  917,
-        0,    0,  917,    0,  917,  918,  918,    0,  918,    0,
-        0,  918,    0,  918,    0,  918,  919,    0,    0,  919,
-        0,  919,    0,  919,  920,    0,    0,  920,  920,  920,
-      920,  920,  920,  920,  920,  920,  920,  920,    0,  920,
-      920,  920,  921,    0,    0,    0,    0,    0,  921,    0,
-        0,  921,    0,  921,  923,    0,    0,  923,  923,  923,
-
-      923,  923,  923,  923,  923,  923,  923,  923,    0,  923,
-      923,  923,  924,    0,    0,  924,  924,    0,  924,    0,
-        0,  924,    0,  924,    0,  924,  925,  925,    0,  925,
-      925,    0,  925,    0,  925,    0,  925,  926,  926,    0,
-      926,  926,    0,  926,    0,  926,    0,  926,  927,    0,
-        0,    0,    0,    0,    0,    0,    0,  927,    0,  927,
-      928,    0,  928,    0,    0,  928,    0,  928,  929,  929,
-        0,  929,    0,    0,  929,    0,  929,    0,  929,  930,
-        0,    0,  930,  930,    0,  930,  930,  930,  930,  930,
-      930,  930,  930,  930,  930,  930,  930,  931,    0,    0,
-
-      931,    0,  931,  931,  931,  931,  931,  931,  931,  931,
-      931,  931,  931,  931,  931,  932,  932,  932,  932,  932,
-      932,  932,  932,  932,  932,  932,  932,  932,  932,  932,
-      932,  932,  932,  933,    0,    0,  933,  933,    0,  933,
-      933,  933,  933,  933,  933,  933,  933,    0,  933,  933,
-      933,  934,    0,    0,  934,  934,    0,  934,  934,  934,
-      934,  934,  934,  934,  934,    0,  934,  934,  934,  935,
-        0,    0,  935,  935,    0,  935,  935,  935,  935,  935,
-      935,  935,  935,    0,  935,  935,  935,  936,    0,    0,
-      936,  936,    0,  936,  936,  936,  936,  936,  936,  936,
-
-      936,    0,  936,  936,  936,  937,    0,    0,  937,  937,
-      937,  937,  937,  937,  937,  937,  937,  937,  937,    0,
-      937,  937,  937,  938,    0,    0,  938,  938,  938,  938,
-      938,  938,  938,  938,  938,  938,  938,    0,  938,  938,
-      938,  939,    0,    0,  939,    0,  939,  940,    0,    0,
-        0,    0,    0,    0,    0,    0,  940,    0,  940,  941,
-        0,  941,    0,    0,  941,    0,  941,  942,    0,    0,
-      942,  942,  942,  942,  942,  942,  942,  942,  942,  942,
-      942,    0,  942,  942,  942,  943,    0,    0,  943,  943,
-      943,  943,  943,  943,  943,  943,  943,  943,  943,    0,
-
-      943,  943,  943,  944,    0,    0,  944,    0,  944,  945,
-        0,    0,    0,    0,    0,    0,    0,    0,  945,    0,
-      945,  946,    0,  946,    0,    0,  946,    0,  946,  947,
-        0,    0,  947,    0,    0,  947,  948,    0,    0,  948,
-      948,  948,  948,  948,  948,  948,  948,  948,  948,  948,
-        0,  948,  948,  948,  949,    0,    0,  949,  949,  949,
-      949,  949,  949,  949,  949,  949,  949,  949,    0,  949,
-      949,  949,  950,  950,    0,  950,  950,    0,  950,    0,
-      950,    0,  950,  951,  951,    0,  951,  951,    0,  951,
-        0,  951,    0,  951,  952,  952,    0,  952,  952,    0,
-
-      952,    0,  952,    0,  952,  953,    0,  953,    0,    0,
-      953,    0,  953,  954,    0,  954,    0,    0,  954,    0,
-      954,  955,  955,    0,  955,    0,    0,  955,    0,  955,
-        0,  955,  956,    0,    0,  956,  956,  956,  956,  956,
-      956,  956,  956,  956,  956,  956,    0,  956,  956,  956,
-      957,    0,    0,  957,    0,  957,  958,    0,    0,    0,
-        0,    0,    0,  958,    0,  958,    0,  958,  959,    0,
-        0,  959,  959,  959,  959,  959,  959,  959,  959,  959,
-      959,  959,    0,  959,  959,  959,  960,    0,    0,  960,
-        0,  960,  961,    0,    0,    0,    0,    0,    0,  961,
-
-        0,  961,    0,  961,  962,    0,    0,  962,  962,    0,
-      962,    0,    0,  962,    0,  962,    0,  962,  963,    0,
-        0,    0,    0,    0,    0,    0,    0,  963,    0,  963,
-      964,    0,    0,  964,  964,  964,  964,  964,  964,  964,
-      964,  964,  964,  964,    0,  964,  964,  964,  965,  965,
-        0,  965,  965,    0,  965,    0,  965,    0,  965,  966,
-        0,    0,  966,    0,  966,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856,  856,  856,  856,  856,  856,
-      856,  856,  856,  856,  856
+
+      907,  907,  907,  907,  908,  908,  908,  908,    0,    0,
+        0,    0,  908,    0,  908,  908,  908,  908,  908,  908,
+        0,  908,  909,    0,    0,  909,    0,  909,  909,  909,
+      909,  909,  909,  909,  909,  909,  909,  909,  909,  909,
+      910,    0,    0,  910,  910,  910,  910,  910,  910,    0,
+      910,  910,  910,  910,  910,  910,  910,  910,  911,    0,
+        0,  911,  911,    0,  911,  911,  911,  911,  911,  911,
+      911,  911,    0,  911,  911,  911,  912,  912,  912,  912,
+      912,  912,  912,  912,  912,  912,  912,  912,  912,  912,
+      912,  912,  912,  912,  913,    0,  913,  913,  913,  913,
+
+      913,  913,  913,  913,  913,  913,  913,  913,    0,  913,
+      913,  913,  914,    0,  914,  914,  914,  914,  914,  914,
+      914,  914,  914,  914,  914,  914,    0,  914,  914,  914,
+      915,    0,    0,  915,    0,  915,    0,  915,  916,    0,
+      916,  916,  916,  916,  916,  916,  916,  916,  916,  916,
+      916,  916,    0,  916,  916,  916,  917,  917,    0,  917,
+        0,    0,  917,    0,  917,    0,  917,  918,    0,  918,
+      918,  918,  918,  918,  918,  918,  918,  918,    0,  918,
+        0,  918,  919,    0,    0,  919,    0,  919,    0,  919,
+      921,    0,    0,  921,  921,    0,  921,    0,    0,  921,
+
+        0,  921,    0,  921,  922,  922,    0,  922,  922,    0,
+      922,    0,  922,    0,  922,  923,    0,    0,  923,    0,
+      923,    0,  923,  924,    0,    0,    0,  924,    0,    0,
+        0,    0,  924,    0,  924,  925,    0,  925,    0,    0,
+      925,    0,  925,  926,    0,    0,  926,    0,  926,    0,
+      926,  927,    0,    0,  927,  927,    0,  927,  927,  927,
+      927,  927,  927,  927,  927,  927,  927,  927,  927,  928,
+        0,    0,  928,    0,  928,  928,  928,  928,  928,  928,
+      928,  928,  928,  928,  928,  928,  928,  929,    0,    0,
+      929,  929,  929,  929,  929,  929,  929,  929,  929,  929,
+
+      929,  929,  929,  929,  929,  930,    0,    0,  930,  930,
+      930,  930,  930,  930,  930,  930,  930,  930,  930,  930,
+      930,  930,  930,  931,  931,  931,  931,    0,    0,    0,
+        0,  931,    0,  931,  931,  931,  931,  931,  931,    0,
+      931,  932,    0,    0,  932,  932,  932,  932,  932,  932,
+      932,  932,  932,  932,  932,  932,  932,  932,  932,  933,
+      933,  933,  933,  933,  933,  933,  933,  933,  933,  933,
+      933,  933,  933,  933,  933,  933,  933,  934,    0,    0,
+      934,  934,  934,  934,  934,  934,    0,  934,  934,  934,
+      934,  934,  934,  934,  934,  935,    0,    0,  935,  935,
+
+        0,  935,  935,  935,  935,  935,  935,  935,  935,    0,
+      935,  935,  935,  936,    0,    0,  936,  936,    0,  936,
+      936,  936,  936,  936,  936,  936,  936,    0,  936,  936,
+      936,  937,    0,    0,  937,  937,    0,  937,  937,  937,
+      937,  937,  937,  937,  937,    0,  937,  937,  937,  938,
+        0,  938,  938,  938,    0,  938,  938,  938,  938,  938,
+      938,  938,  938,    0,  938,  938,  938,  939,  939,    0,
+      939,  939,    0,  939,  939,  939,  939,  939,  939,  939,
+      939,    0,  939,  939,  939,  940,    0,    0,  940,    0,
+      940,    0,  940,  941,    0,    0,  941,  941,  941,  941,
+
+      941,  941,  941,  941,  941,  941,  941,    0,  941,  941,
+      941,  942,    0,    0,    0,    0,    0,  942,    0,    0,
+      942,    0,  942,  943,  943,    0,  943,    0,    0,  943,
+        0,  943,    0,  943,  944,    0,    0,  944,    0,  944,
+        0,  944,  945,    0,    0,  945,  945,  945,  945,  945,
+      945,  945,  945,  945,  945,  945,    0,  945,  945,  945,
+      946,    0,    0,    0,    0,    0,  946,    0,    0,  946,
+        0,  946,  948,    0,    0,  948,  948,  948,  948,  948,
+      948,  948,  948,  948,  948,  948,    0,  948,  948,  948,
+      949,    0,    0,  949,  949,    0,  949,    0,    0,  949,
+
+        0,  949,    0,  949,  950,  950,    0,  950,  950,    0,
+      950,    0,  950,    0,  950,  951,  951,    0,  951,  951,
+        0,  951,    0,  951,    0,  951,  952,    0,    0,    0,
+        0,    0,    0,    0,    0,  952,    0,  952,  953,    0,
+      953,    0,    0,  953,    0,  953,  954,  954,    0,  954,
+        0,    0,  954,    0,  954,    0,  954,  955,    0,    0,
+      955,  955,    0,  955,  955,  955,  955,  955,  955,  955,
+      955,  955,  955,  955,  955,  956,    0,    0,  956,    0,
+      956,  956,  956,  956,  956,  956,  956,  956,  956,  956,
+      956,  956,  956,  957,  957,  957,  957,  957,  957,  957,
+
+      957,  957,  957,  957,  957,  957,  957,  957,  957,  957,
+      957,  958,    0,    0,  958,  958,    0,  958,  958,  958,
+      958,  958,  958,  958,  958,    0,  958,  958,  958,  959,
+        0,    0,  959,  959,    0,  959,  959,  959,  959,  959,
+      959,  959,  959,    0,  959,  959,  959,  960,    0,    0,
+      960,  960,    0,  960,  960,  960,  960,  960,  960,  960,
+      960,    0,  960,  960,  960,  961,    0,    0,  961,  961,
+        0,  961,  961,  961,  961,  961,  961,  961,  961,    0,
+      961,  961,  961,  962,    0,    0,  962,  962,  962,  962,
+      962,  962,  962,  962,  962,  962,  962,    0,  962,  962,
+
+      962,  963,    0,    0,  963,  963,  963,  963,  963,  963,
+      963,  963,  963,  963,  963,    0,  963,  963,  963,  964,
+        0,    0,  964,    0,  964,  965,    0,    0,    0,    0,
+        0,    0,    0,    0,  965,    0,  965,  966,    0,  966,
+        0,    0,  966,    0,  966,  967,    0,    0,  967,  967,
+      967,  967,  967,  967,  967,  967,  967,  967,  967,    0,
+      967,  967,  967,  968,    0,    0,  968,  968,  968,  968,
+      968,  968,  968,  968,  968,  968,  968,    0,  968,  968,
+      968,  969,    0,    0,  969,    0,  969,  970,    0,    0,
+        0,    0,    0,    0,    0,    0,  970,    0,  970,  971,
+
+        0,  971,    0,    0,  971,    0,  971,  972,    0,    0,
+      972,    0,    0,  972,  973,    0,    0,  973,  973,  973,
+      973,  973,  973,  973,  973,  973,  973,  973,    0,  973,
+      973,  973,  974,    0,    0,  974,  974,  974,  974,  974,
+      974,  974,  974,  974,  974,  974,    0,  974,  974,  974,
+      975,  975,    0,  975,  975,    0,  975,    0,  975,    0,
+      975,  976,  976,    0,  976,  976,    0,  976,    0,  976,
+        0,  976,  977,  977,    0,  977,  977,    0,  977,    0,
+      977,    0,  977,  978,    0,  978,    0,    0,  978,    0,
+      978,  979,    0,  979,    0,    0,  979,    0,  979,  980,
+
+      980,    0,  980,    0,    0,  980,    0,  980,    0,  980,
+      981,    0,    0,  981,  981,  981,  981,  981,  981,  981,
+      981,  981,  981,  981,    0,  981,  981,  981,  982,    0,
+        0,  982,    0,  982,  983,    0,    0,    0,    0,    0,
+        0,  983,    0,  983,    0,  983,  984,    0,    0,  984,
+      984,  984,  984,  984,  984,  984,  984,  984,  984,  984,
+        0,  984,  984,  984,  985,    0,    0,  985,    0,  985,
+      986,    0,    0,    0,    0,    0,    0,  986,    0,  986,
+        0,  986,  987,    0,    0,  987,  987,    0,  987,    0,
+        0,  987,    0,  987,    0,  987,  988,    0,    0,    0,
+
+        0,    0,    0,    0,    0,  988,    0,  988,  989,    0,
+        0,  989,  989,  989,  989,  989,  989,  989,  989,  989,
+      989,  989,    0,  989,  989,  989,  990,  990,    0,  990,
+      990,    0,  990,    0,  990,    0,  990,  991,    0,    0,
+      991,    0,  991,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881,  881,  881,  881,  881,  881,  881,  881,
+      881,  881,  881
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -2418,7 +2469,7 @@ static int yy_more_len = 0;
 char *sparyytext;
 #line 1 "./sparql_l.l"
 /*
- *  $Id: sparql_l.l,v 1.37.2.12 2010/03/22 11:54:10 source Exp $
+ *  $Id: sparql_l.l,v 1.37.2.15 2011/01/03 10:21:01 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -2721,7 +2772,7 @@ static int sparscn_NUMBER_double (void *yylval, sparp_t *sparp)
 
 /* Special unreacheable state to fill the first item of sparp->sparp_lexstates */
 
-#line 2725 "sparql_l.c"
+#line 2776 "sparql_l.c"
 
 #define INITIAL 0
 #define SPARQL 1
@@ -2820,7 +2871,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( sparyytext, sparyyleng, 1, sparyyout )
+#define ECHO do { if (fwrite( sparyytext, sparyyleng, 1, sparyyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -2918,7 +2969,7 @@ YY_DECL
 
 	/* Plain non-keyword punctuators */
 
-#line 2922 "sparql_l.c"
+#line 2973 "sparql_l.c"
 
 	if ( !(yy_init) )
 		{
@@ -2977,13 +3028,13 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 857 )
+				if ( yy_current_state >= 882 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_current_state != 856 );
+		while ( yy_current_state != 881 );
 		yy_cp = (yy_last_accepting_cpos);
 		yy_current_state = (yy_last_accepting_state);
 
@@ -3142,639 +3193,669 @@ YY_RULE_SETUP
 case 28:
 YY_RULE_SETUP
 #line 407 "./sparql_l.l"
-{ return BIJECTION_L	; }
+{ return BINDINGS_L	; }
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
 #line 408 "./sparql_l.l"
-{ return BOUND_L	; }
+{ return BIJECTION_L	; }
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
 #line 409 "./sparql_l.l"
-{ return BY_L		; }
+{ return BOUND_L	; }
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
 #line 410 "./sparql_l.l"
-{ return CLASS_L	; }
+{ return BY_L		; }
 	YY_BREAK
 case 32:
 YY_RULE_SETUP
 #line 411 "./sparql_l.l"
-{ return CLEAR_L	; }
+{ return CLASS_L	; }
 	YY_BREAK
 case 33:
 YY_RULE_SETUP
 #line 412 "./sparql_l.l"
-{ return CONSTRUCT_L	; }
+{ return CLEAR_L	; }
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
 #line 413 "./sparql_l.l"
-{ BEGIN SPARQL_AFTER_COUNT; }
+{ return CONSTRUCT_L	; }
 	YY_BREAK
 case 35:
 YY_RULE_SETUP
 #line 414 "./sparql_l.l"
-{ return CREATE_L	; }
+{ BEGIN SPARQL_AFTER_COUNT; }
 	YY_BREAK
 case 36:
 YY_RULE_SETUP
 #line 415 "./sparql_l.l"
-{ return DATA_L		; }
+{ return CREATE_L	; }
 	YY_BREAK
 case 37:
 YY_RULE_SETUP
 #line 416 "./sparql_l.l"
-{ return DATATYPE_L	; }
+{ return DATA_L		; }
 	YY_BREAK
 case 38:
 YY_RULE_SETUP
 #line 417 "./sparql_l.l"
-{ return DEFAULT_L	; }
+{ return DATATYPE_L	; }
 	YY_BREAK
 case 39:
 YY_RULE_SETUP
 #line 418 "./sparql_l.l"
-{ return DEFINE_L	; }
+{ return DEFAULT_L	; }
 	YY_BREAK
 case 40:
 YY_RULE_SETUP
 #line 419 "./sparql_l.l"
-{ return DELETE_L	; }
+{ return DEFINE_L	; }
 	YY_BREAK
 case 41:
 YY_RULE_SETUP
 #line 420 "./sparql_l.l"
-{ return DEREF_L	; }
+{ return DELETE_L	; }
 	YY_BREAK
 case 42:
 YY_RULE_SETUP
 #line 421 "./sparql_l.l"
-{ return DESC_L		; }
+{ return DEREF_L	; }
 	YY_BREAK
 case 43:
 YY_RULE_SETUP
 #line 422 "./sparql_l.l"
-{ return DESCRIBE_L	; }
+{ return DESC_L		; }
 	YY_BREAK
 case 44:
 YY_RULE_SETUP
 #line 423 "./sparql_l.l"
-{ return DISTINCT_L	; }
+{ return DESCRIBE_L	; }
 	YY_BREAK
 case 45:
 YY_RULE_SETUP
 #line 424 "./sparql_l.l"
-{ return DROP_L		; }
+{ return DISTINCT_L	; }
 	YY_BREAK
 case 46:
 YY_RULE_SETUP
 #line 425 "./sparql_l.l"
-{ return EXCLUSIVE_L	; }
+{ return DROP_L		; }
 	YY_BREAK
 case 47:
 YY_RULE_SETUP
 #line 426 "./sparql_l.l"
-{ return false_L	; }
+{ return EXCLUSIVE_L	; }
 	YY_BREAK
 case 48:
 YY_RULE_SETUP
 #line 427 "./sparql_l.l"
-{ return FILTER_L	; }
+{ return EXISTS_L	; }
 	YY_BREAK
 case 49:
 YY_RULE_SETUP
 #line 428 "./sparql_l.l"
-{ return FROM_L		; }
+{ return false_L	; }
 	YY_BREAK
 case 50:
 YY_RULE_SETUP
 #line 429 "./sparql_l.l"
-{ return FUNCTION_L	; }
+{ return FILTER_L	; }
 	YY_BREAK
 case 51:
 YY_RULE_SETUP
 #line 430 "./sparql_l.l"
-{ return GRAPH_L	; }
+{ return FROM_L		; }
 	YY_BREAK
 case 52:
 YY_RULE_SETUP
 #line 431 "./sparql_l.l"
-{ return GROUP_L	; }
+{ return FUNCTION_L	; }
 	YY_BREAK
 case 53:
 YY_RULE_SETUP
 #line 432 "./sparql_l.l"
-{ return HAVING_L	; }
+{ return GRAPH_L	; }
 	YY_BREAK
 case 54:
 YY_RULE_SETUP
 #line 433 "./sparql_l.l"
-{ return IFP_L		; }
+{ return GROUP_L	; }
 	YY_BREAK
 case 55:
 YY_RULE_SETUP
 #line 434 "./sparql_l.l"
-{ return IN_L		; }
+{ return HAVING_L	; }
 	YY_BREAK
 case 56:
 YY_RULE_SETUP
 #line 435 "./sparql_l.l"
-{ return INDEX_L	; }
+{ return IFP_L		; }
 	YY_BREAK
 case 57:
 YY_RULE_SETUP
 #line 436 "./sparql_l.l"
-{ return INFERENCE_L	; }
+{ return IN_L		; }
 	YY_BREAK
 case 58:
 YY_RULE_SETUP
 #line 437 "./sparql_l.l"
-{ return INSERT_L	; }
+{ return INDEX_L	; }
 	YY_BREAK
 case 59:
 YY_RULE_SETUP
 #line 438 "./sparql_l.l"
-{ return INTO_L		; }
+{ return INFERENCE_L	; }
 	YY_BREAK
 case 60:
 YY_RULE_SETUP
 #line 439 "./sparql_l.l"
-{ return IRI_L		; }
+{ return INSERT_L	; }
 	YY_BREAK
 case 61:
 YY_RULE_SETUP
 #line 440 "./sparql_l.l"
-{ return isBLANK_L	; }
+{ return INTO_L		; }
 	YY_BREAK
 case 62:
 YY_RULE_SETUP
 #line 441 "./sparql_l.l"
-{ return isIRI_L	; }
+{ return IRI_L		; }
 	YY_BREAK
 case 63:
 YY_RULE_SETUP
 #line 442 "./sparql_l.l"
-{ return isLITERAL_L	; }
+{ return isBLANK_L	; }
 	YY_BREAK
 case 64:
 YY_RULE_SETUP
 #line 443 "./sparql_l.l"
-{ return isREF_L	; }
+{ return isIRI_L	; }
 	YY_BREAK
 case 65:
 YY_RULE_SETUP
 #line 444 "./sparql_l.l"
-{ return isURI_L	; }
+{ return isLITERAL_L	; }
 	YY_BREAK
 case 66:
 YY_RULE_SETUP
 #line 445 "./sparql_l.l"
-{ return LANG_L		; }
+{ return isREF_L	; }
 	YY_BREAK
 case 67:
 YY_RULE_SETUP
 #line 446 "./sparql_l.l"
-{ return LANGMATCHES_L		; }
+{ return isURI_L	; }
 	YY_BREAK
 case 68:
 YY_RULE_SETUP
 #line 447 "./sparql_l.l"
-{ return LIKE_L		; }
+{ return LANG_L		; }
 	YY_BREAK
 case 69:
 YY_RULE_SETUP
 #line 448 "./sparql_l.l"
-{ return LIMIT_L	; }
+{ return LANGMATCHES_L		; }
 	YY_BREAK
 case 70:
 YY_RULE_SETUP
 #line 449 "./sparql_l.l"
-{ return LITERAL_L	; }
+{ return LIKE_L		; }
 	YY_BREAK
 case 71:
 YY_RULE_SETUP
 #line 450 "./sparql_l.l"
-{ return LOAD_L		; }
+{ return LIMIT_L	; }
 	YY_BREAK
 case 72:
 YY_RULE_SETUP
 #line 451 "./sparql_l.l"
-{ return MAKE_L		; }
+{ return LITERAL_L	; }
 	YY_BREAK
 case 73:
 YY_RULE_SETUP
 #line 452 "./sparql_l.l"
-{ return MAP_L		; }
+{ return LOAD_L		; }
 	YY_BREAK
 case 74:
 YY_RULE_SETUP
 #line 453 "./sparql_l.l"
-{ return MAX_L		; }
+{ return MAKE_L		; }
 	YY_BREAK
 case 75:
 YY_RULE_SETUP
 #line 454 "./sparql_l.l"
-{ return MIN_L		; }
+{ return MAP_L		; }
 	YY_BREAK
 case 76:
 YY_RULE_SETUP
 #line 455 "./sparql_l.l"
-{ return MODIFY_L	; }
+{ return MAX_L		; }
 	YY_BREAK
 case 77:
 YY_RULE_SETUP
 #line 456 "./sparql_l.l"
-{ return NAMED_L	; }
+{ return MIN_L		; }
 	YY_BREAK
 case 78:
 YY_RULE_SETUP
 #line 457 "./sparql_l.l"
-{ return NIL_L		; }
+{ return MINUS_L	; }
 	YY_BREAK
 case 79:
 YY_RULE_SETUP
 #line 458 "./sparql_l.l"
-{ return NOT_L		; }
+{ return MODIFY_L	; }
 	YY_BREAK
 case 80:
 YY_RULE_SETUP
 #line 459 "./sparql_l.l"
-{ return NULL_L		; }
+{ return NAMED_L	; }
 	YY_BREAK
 case 81:
 YY_RULE_SETUP
 #line 460 "./sparql_l.l"
-{ return OBJECT_L	; }
+{ return NIL_L		; }
 	YY_BREAK
 case 82:
 YY_RULE_SETUP
 #line 461 "./sparql_l.l"
-{ return OF_L		; }
+{ return NOT_L		; }
 	YY_BREAK
 case 83:
 YY_RULE_SETUP
 #line 462 "./sparql_l.l"
-{ return OFFBAND_L	; }
+{ return NOT_FROM_L	; }
 	YY_BREAK
 case 84:
 YY_RULE_SETUP
 #line 463 "./sparql_l.l"
-{ return OFFSET_L	; }
+{ return NULL_L		; }
 	YY_BREAK
 case 85:
 YY_RULE_SETUP
 #line 464 "./sparql_l.l"
-{ return OPTIONAL_L	; }
+{ return OBJECT_L	; }
 	YY_BREAK
 case 86:
 YY_RULE_SETUP
 #line 465 "./sparql_l.l"
-{ return OPTION_L	; }
+{ return OF_L		; }
 	YY_BREAK
 case 87:
 YY_RULE_SETUP
 #line 466 "./sparql_l.l"
-{ return ORDER_L	; }
+{ return OFFBAND_L	; }
 	YY_BREAK
 case 88:
 YY_RULE_SETUP
 #line 467 "./sparql_l.l"
-{ return PREDICATE_L	; }
+{ return OFFSET_L	; }
 	YY_BREAK
 case 89:
 YY_RULE_SETUP
 #line 468 "./sparql_l.l"
-{ return PREFIX_L	; }
+{ return OPTIONAL_L	; }
 	YY_BREAK
 case 90:
 YY_RULE_SETUP
 #line 469 "./sparql_l.l"
-{ return QUAD_L		; }
+{ return OPTION_L	; }
 	YY_BREAK
 case 91:
 YY_RULE_SETUP
 #line 470 "./sparql_l.l"
-{ return REGEX_L	; }
+{ return ORDER_L	; }
 	YY_BREAK
 case 92:
 YY_RULE_SETUP
 #line 471 "./sparql_l.l"
-{ return REDUCED_L	; }
+{ return PREDICATE_L	; }
 	YY_BREAK
 case 93:
 YY_RULE_SETUP
 #line 472 "./sparql_l.l"
-{ return RETURNS_L	; }
+{ return PREFIX_L	; }
 	YY_BREAK
 case 94:
 YY_RULE_SETUP
 #line 473 "./sparql_l.l"
-{ return SCORE_L	; }
+{ return QUAD_L		; }
 	YY_BREAK
 case 95:
 YY_RULE_SETUP
 #line 474 "./sparql_l.l"
-{ return SCORE_LIMIT_L	; }
+{ return REGEX_L	; }
 	YY_BREAK
 case 96:
 YY_RULE_SETUP
 #line 475 "./sparql_l.l"
-{ return SAME_AS_L	; }
+{ return REDUCED_L	; }
 	YY_BREAK
 case 97:
 YY_RULE_SETUP
 #line 476 "./sparql_l.l"
-{ return SAME_AS_O_L	; }
+{ return RETURNS_L	; }
 	YY_BREAK
 case 98:
 YY_RULE_SETUP
 #line 477 "./sparql_l.l"
-{ return SAME_AS_P_L	; }
+{ return SCORE_L	; }
 	YY_BREAK
 case 99:
 YY_RULE_SETUP
 #line 478 "./sparql_l.l"
-{ return SAME_AS_S_L	; }
+{ return SCORE_LIMIT_L	; }
 	YY_BREAK
 case 100:
 YY_RULE_SETUP
 #line 479 "./sparql_l.l"
-{ return SAME_AS_S_O_L	; }
+{ return SAME_AS_L	; }
 	YY_BREAK
 case 101:
 YY_RULE_SETUP
 #line 480 "./sparql_l.l"
-{ return SAMETERM_L	; }
+{ return SAME_AS_O_L	; }
 	YY_BREAK
 case 102:
 YY_RULE_SETUP
 #line 481 "./sparql_l.l"
-{ return SELECT_L	; }
+{ return SAME_AS_P_L	; }
 	YY_BREAK
 case 103:
 YY_RULE_SETUP
 #line 482 "./sparql_l.l"
-{ return SERVICE_L	; }
+{ return SAME_AS_S_L	; }
 	YY_BREAK
 case 104:
 YY_RULE_SETUP
 #line 483 "./sparql_l.l"
-{ return SILENT_L	; }
+{ return SAME_AS_S_O_L	; }
 	YY_BREAK
 case 105:
 YY_RULE_SETUP
 #line 484 "./sparql_l.l"
-{ return SOFT_L		; }
+{ return SAMETERM_L	; }
 	YY_BREAK
 case 106:
 YY_RULE_SETUP
 #line 485 "./sparql_l.l"
-{ return STORAGE_L	; }
+{ return SELECT_L	; }
 	YY_BREAK
 case 107:
 YY_RULE_SETUP
 #line 486 "./sparql_l.l"
-{ return STR_L		; }
+{ return SERVICE_L	; }
 	YY_BREAK
 case 108:
 YY_RULE_SETUP
 #line 487 "./sparql_l.l"
-{ return SUBCLASS_L	; }
+{ return SILENT_L	; }
 	YY_BREAK
 case 109:
 YY_RULE_SETUP
 #line 488 "./sparql_l.l"
-{ return SUBJECT_L	; }
+{ return SOFT_L		; }
 	YY_BREAK
 case 110:
 YY_RULE_SETUP
 #line 489 "./sparql_l.l"
-{ return SUM_L		; }
+{ return STORAGE_L	; }
 	YY_BREAK
 case 111:
 YY_RULE_SETUP
 #line 490 "./sparql_l.l"
-{ return TABLE_OPTION_L	; }
+{ return STR_L		; }
 	YY_BREAK
 case 112:
 YY_RULE_SETUP
 #line 491 "./sparql_l.l"
-{ return T_CYCLES_ONLY_L	; }
+{ return SUBCLASS_L	; }
 	YY_BREAK
 case 113:
 YY_RULE_SETUP
 #line 492 "./sparql_l.l"
-{ return T_DIRECTION_L	; }
+{ return SUBJECT_L	; }
 	YY_BREAK
 case 114:
 YY_RULE_SETUP
 #line 493 "./sparql_l.l"
-{ return T_DISTINCT_L	; }
+{ return SUM_L		; }
 	YY_BREAK
 case 115:
 YY_RULE_SETUP
 #line 494 "./sparql_l.l"
-{ return T_END_FLAG_L	; }
+{ return TABLE_OPTION_L	; }
 	YY_BREAK
 case 116:
 YY_RULE_SETUP
 #line 495 "./sparql_l.l"
-{ return T_EXISTS_L	; }
+{ return T_CYCLES_ONLY_L	; }
 	YY_BREAK
 case 117:
 YY_RULE_SETUP
 #line 496 "./sparql_l.l"
-{ return T_FINAL_AS_L	; }
+{ return T_DIRECTION_L	; }
 	YY_BREAK
 case 118:
 YY_RULE_SETUP
 #line 497 "./sparql_l.l"
-{ return T_IN_L		; }
+{ return T_DISTINCT_L	; }
 	YY_BREAK
 case 119:
 YY_RULE_SETUP
 #line 498 "./sparql_l.l"
-{ return T_MAX_L	; }
+{ return T_END_FLAG_L	; }
 	YY_BREAK
 case 120:
 YY_RULE_SETUP
 #line 499 "./sparql_l.l"
-{ return T_MIN_L	; }
+{ return T_EXISTS_L	; }
 	YY_BREAK
 case 121:
 YY_RULE_SETUP
 #line 500 "./sparql_l.l"
-{ return T_OUT_L	; }
+{ return T_FINAL_AS_L	; }
 	YY_BREAK
 case 122:
 YY_RULE_SETUP
 #line 501 "./sparql_l.l"
-{ return T_NO_CYCLES_L	; }
+{ return T_IN_L		; }
 	YY_BREAK
 case 123:
 YY_RULE_SETUP
 #line 502 "./sparql_l.l"
-{ return T_NO_ORDER_L	; }
+{ return T_MAX_L	; }
 	YY_BREAK
 case 124:
 YY_RULE_SETUP
 #line 503 "./sparql_l.l"
-{ return T_SHORTEST_ONLY_L	; }
+{ return T_MIN_L	; }
 	YY_BREAK
 case 125:
 YY_RULE_SETUP
 #line 504 "./sparql_l.l"
-{ return T_STEP_L	; }
+{ return T_OUT_L	; }
 	YY_BREAK
 case 126:
 YY_RULE_SETUP
 #line 505 "./sparql_l.l"
-{ return TRANSITIVE_L	; }
+{ return T_NO_CYCLES_L	; }
 	YY_BREAK
 case 127:
 YY_RULE_SETUP
 #line 506 "./sparql_l.l"
-{ return true_L		; }
+{ return T_NO_ORDER_L	; }
 	YY_BREAK
 case 128:
 YY_RULE_SETUP
 #line 507 "./sparql_l.l"
-{ return UNION_L	; }
+{ return T_SHORTEST_ONLY_L	; }
 	YY_BREAK
 case 129:
 YY_RULE_SETUP
 #line 508 "./sparql_l.l"
-{ return USING_L	; }
+{ return T_STEP_L	; }
 	YY_BREAK
 case 130:
 YY_RULE_SETUP
-#line 510 "./sparql_l.l"
-{ sparyylval.box = t_box_dv_short_nchars (sparyytext, sparyyleng); return TEXT_BL	; }
+#line 509 "./sparql_l.l"
+{ return TRANSITIVE_L	; }
 	YY_BREAK
 case 131:
 YY_RULE_SETUP
-#line 511 "./sparql_l.l"
-{ sparyylval.box = t_box_dv_short_nchars (sparyytext, sparyyleng); return XML_BL	; }
+#line 510 "./sparql_l.l"
+{ return true_L		; }
 	YY_BREAK
 case 132:
 YY_RULE_SETUP
-#line 513 "./sparql_l.l"
-{ BEGIN SPARQL_AFTER_IDENTIFIED; return IDENTIFIED_L	; }
+#line 511 "./sparql_l.l"
+{ return UNBOUND_L	; }
 	YY_BREAK
 case 133:
 YY_RULE_SETUP
-#line 514 "./sparql_l.l"
-{ BEGIN SPARQL_AFTER_WHERE; return WHERE_L	; }
+#line 512 "./sparql_l.l"
+{ return UNION_L	; }
 	YY_BREAK
-/* Keyword punctuators of the SPARQL described in first drafts of W3C spec */
 case 134:
 YY_RULE_SETUP
-#line 518 "./sparql_l.l"
-{ return GRAPH_L	; }
+#line 513 "./sparql_l.l"
+{ return USING_L	; }
 	YY_BREAK
 case 135:
 YY_RULE_SETUP
-#line 519 "./sparql_l.l"
-{ return _AMP_AMP; }
+#line 514 "./sparql_l.l"
+{ return WITH_L		; }
 	YY_BREAK
 case 136:
 YY_RULE_SETUP
-#line 520 "./sparql_l.l"
-{ return _BAR_BAR; }
+#line 516 "./sparql_l.l"
+{ sparyylval.box = t_box_dv_short_nchars (sparyytext, sparyyleng); return TEXT_BL	; }
 	YY_BREAK
-/* Grouping non-keyword punctuators */
 case 137:
 YY_RULE_SETUP
-#line 524 "./sparql_l.l"
-TOKPAR_OPEN (_LPAR,')', GET_CURRENT_BEGIN)
+#line 517 "./sparql_l.l"
+{ sparyylval.box = t_box_dv_short_nchars (sparyytext, sparyyleng); return XML_BL	; }
 	YY_BREAK
 case 138:
 YY_RULE_SETUP
-#line 525 "./sparql_l.l"
-TOKPAR_CLOSE (_RPAR,')')
+#line 519 "./sparql_l.l"
+{ BEGIN SPARQL_AFTER_IDENTIFIED; return IDENTIFIED_L	; }
 	YY_BREAK
 case 139:
 YY_RULE_SETUP
-#line 526 "./sparql_l.l"
-TOKPAR_OPEN (_LBRA,'}', GET_CURRENT_BEGIN)
+#line 520 "./sparql_l.l"
+{ BEGIN SPARQL_AFTER_WHERE; return WHERE_L	; }
 	YY_BREAK
+/* Keyword punctuators of the SPARQL described in first drafts of W3C spec */
 case 140:
 YY_RULE_SETUP
-#line 527 "./sparql_l.l"
-TOKPAR_CLOSE (_RBRA,'}')
+#line 524 "./sparql_l.l"
+{ return GRAPH_L	; }
 	YY_BREAK
 case 141:
 YY_RULE_SETUP
-#line 528 "./sparql_l.l"
-TOKPAR_OPEN (_LSQBRA,']', GET_CURRENT_BEGIN)
+#line 525 "./sparql_l.l"
+{ return _AMP_AMP; }
 	YY_BREAK
 case 142:
 YY_RULE_SETUP
-#line 529 "./sparql_l.l"
-TOKPAR_CLOSE (_RSQBRA,']')
+#line 526 "./sparql_l.l"
+{ return _BAR_BAR; }
 	YY_BREAK
-/* Name lexems */
+/* Grouping non-keyword punctuators */
 case 143:
 YY_RULE_SETUP
+#line 530 "./sparql_l.l"
+TOKPAR_OPEN (_LPAR,')', GET_CURRENT_BEGIN)
+	YY_BREAK
+case 144:
+YY_RULE_SETUP
+#line 531 "./sparql_l.l"
+TOKPAR_CLOSE (_RPAR,')')
+	YY_BREAK
+case 145:
+YY_RULE_SETUP
+#line 532 "./sparql_l.l"
+TOKPAR_OPEN (_LBRA,'}', GET_CURRENT_BEGIN)
+	YY_BREAK
+case 146:
+YY_RULE_SETUP
 #line 533 "./sparql_l.l"
+TOKPAR_CLOSE (_RBRA,'}')
+	YY_BREAK
+case 147:
+YY_RULE_SETUP
+#line 534 "./sparql_l.l"
+TOKPAR_OPEN (_LSQBRA,']', GET_CURRENT_BEGIN)
+	YY_BREAK
+case 148:
+YY_RULE_SETUP
+#line 535 "./sparql_l.l"
+TOKPAR_CLOSE (_RSQBRA,']')
+	YY_BREAK
+/* Name lexems */
+case 149:
+YY_RULE_SETUP
+#line 539 "./sparql_l.l"
 {
     sparyylval.box = t_box_dv_uname_nchars (sparyytext + 1, sparyyleng - 2);
     return Q_IRI_REF;
   }
 	YY_BREAK
-case 144:
+case 150:
 YY_RULE_SETUP
-#line 538 "./sparql_l.l"
+#line 544 "./sparql_l.l"
 { TOKBOX_Q(0,QNAME,"qualified URI"); }
 	YY_BREAK
-case 145:
+case 151:
 YY_RULE_SETUP
-#line 539 "./sparql_l.l"
+#line 545 "./sparql_l.l"
 { TOKBOX_Q(0,QNAME_NS,"namespace"); }
 	YY_BREAK
-case 146:
+case 152:
 YY_RULE_SETUP
-#line 540 "./sparql_l.l"
+#line 546 "./sparql_l.l"
 { TOKBOX_Q(0,BLANK_NODE_LABEL,"blank node label"); }
 	YY_BREAK
-case 147:
+case 153:
 YY_RULE_SETUP
-#line 542 "./sparql_l.l"
+#line 548 "./sparql_l.l"
 {
     sparyylval.box = t_box_dv_uname_nchars (sparyytext + 1, sparyyleng - 1);
     return QUEST_VARNAME;
   }
 	YY_BREAK
-case 148:
+case 154:
 YY_RULE_SETUP
-#line 547 "./sparql_l.l"
+#line 553 "./sparql_l.l"
 {
     sparyylval.box = t_box_dv_uname_nchars (sparyytext + 1, sparyyleng - 1);
     return DOLLAR_VARNAME;
   }
 	YY_BREAK
-case 149:
+case 155:
 YY_RULE_SETUP
-#line 552 "./sparql_l.l"
+#line 558 "./sparql_l.l"
 {
     sparyylval.box = t_box_dv_uname_nchars (sparyytext + 1, sparyyleng - 1);
     return QUEST_COLON_PARAMNAME;
   }
 	YY_BREAK
-case 150:
+case 156:
 YY_RULE_SETUP
-#line 557 "./sparql_l.l"
+#line 563 "./sparql_l.l"
 {
     sparyylval.box = t_box_dv_uname_nchars (sparyytext + 1, sparyyleng - 1);
     return DOLLAR_COLON_PARAMNAME;
   }
 	YY_BREAK
-case 151:
+case 157:
 YY_RULE_SETUP
-#line 562 "./sparql_l.l"
+#line 568 "./sparql_l.l"
 {
     char buf[20]; sprintf (buf, ":%d", sparp->sparp_sparqre->sparqre_param_ctr[0]);
     sparp->sparp_sparqre->sparqre_param_ctr[0] += 1;
@@ -3782,9 +3863,9 @@ YY_RULE_SETUP
     return QUEST_COLON_PARAMNUM;
   }
 	YY_BREAK
-case 152:
+case 158:
 YY_RULE_SETUP
-#line 569 "./sparql_l.l"
+#line 575 "./sparql_l.l"
 {
     char buf[20]; sprintf (buf, ":%d", sparp->sparp_sparqre->sparqre_param_ctr[0]);
     sparp->sparp_sparqre->sparqre_param_ctr[0] += 1;
@@ -3792,273 +3873,273 @@ YY_RULE_SETUP
     return DOLLAR_COLON_PARAMNUM;
   }
 	YY_BREAK
-case 153:
+case 159:
 YY_RULE_SETUP
-#line 576 "./sparql_l.l"
+#line 582 "./sparql_l.l"
 {
     sparyylval.box = t_box_dv_uname_nchars (sparyytext + 1, sparyyleng - 1);
     return LANGTAG;
   }
 	YY_BREAK
-case 154:
+case 160:
 YY_RULE_SETUP
-#line 581 "./sparql_l.l"
+#line 587 "./sparql_l.l"
 { sparyylval.box = t_box_dv_short_nchars (sparyytext, sparyyleng); return SPARQL_PLAIN_ID; }
 	YY_BREAK
-case 155:
+case 161:
 YY_RULE_SETUP
-#line 582 "./sparql_l.l"
+#line 588 "./sparql_l.l"
 { sparyylval.box = t_box_dv_short_nchars (sparyytext, sparyyleng); return SPARQL_SQL_ALIASCOLNAME; }
 	YY_BREAK
-case 156:
+case 162:
 YY_RULE_SETUP
-#line 583 "./sparql_l.l"
+#line 589 "./sparql_l.l"
 { sparyylval.box = t_box_dv_short_nchars (sparyytext, sparyyleng); return SPARQL_SQL_QTABLENAME; }
 	YY_BREAK
-case 157:
+case 163:
 YY_RULE_SETUP
-#line 584 "./sparql_l.l"
+#line 590 "./sparql_l.l"
 { sparyylval.box = t_box_dv_short_nchars (sparyytext, sparyyleng); return SPARQL_SQL_QTABLECOLNAME; }
 	YY_BREAK
 /* Numeric lexems */
-case 158:
+case 164:
 YY_RULE_SETUP
-#line 588 "./sparql_l.l"
+#line 594 "./sparql_l.l"
 { return sparscn_NUMBER_int (yylval, sparp); }
 	YY_BREAK
-case 159:
+case 165:
 YY_RULE_SETUP
-#line 589 "./sparql_l.l"
+#line 595 "./sparql_l.l"
 { return sparscn_NUMBER_decimal (yylval, sparp); }
 	YY_BREAK
-case 160:
+case 166:
 YY_RULE_SETUP
-#line 590 "./sparql_l.l"
+#line 596 "./sparql_l.l"
 { return sparscn_NUMBER_double (yylval, sparp); }
 	YY_BREAK
 /* String lexems */
-case 161:
+case 167:
 YY_RULE_SETUP
-#line 594 "./sparql_l.l"
+#line 600 "./sparql_l.l"
 {
     sparyylval.box = t_box_dv_short_nchars (sparyytext+1, sparyyleng - 2);
     return SPARQL_STRING;
   }
 	YY_BREAK
-case 162:
+case 168:
 YY_RULE_SETUP
-#line 599 "./sparql_l.l"
+#line 605 "./sparql_l.l"
 { yymore(); SET_INNER_BEGIN(SPARQL_SSSQ); BEGIN_INNER; }
 	YY_BREAK
-case 163:
+case 169:
 YY_RULE_SETUP
-#line 600 "./sparql_l.l"
+#line 606 "./sparql_l.l"
 { yymore(); SET_INNER_BEGIN(SPARQL_DDDQ); BEGIN_INNER; }
 	YY_BREAK
-case 164:
+case 170:
 YY_RULE_SETUP
-#line 601 "./sparql_l.l"
+#line 607 "./sparql_l.l"
 { sparyylval.box = spar_strliteral (sparp, sparyytext, 1, 0); BEGIN_OUTER; return SPARQL_STRING; }
 	YY_BREAK
-case 165:
+case 171:
 YY_RULE_SETUP
-#line 602 "./sparql_l.l"
+#line 608 "./sparql_l.l"
 { sparyylval.box = spar_strliteral (sparp, sparyytext, 1, 0); BEGIN_OUTER; return SPARQL_STRING; }
 	YY_BREAK
-case 166:
-/* rule 166 can match eol */
+case 172:
+/* rule 172 can match eol */
 YY_RULE_SETUP
-#line 603 "./sparql_l.l"
+#line 609 "./sparql_l.l"
 { sparp->sparp_lexlineno++; yymore(); }
 	YY_BREAK
-case 167:
-/* rule 167 can match eol */
+case 173:
+/* rule 173 can match eol */
 YY_RULE_SETUP
-#line 604 "./sparql_l.l"
+#line 610 "./sparql_l.l"
 { sparp->sparp_lexlineno++; yymore(); }
 	YY_BREAK
-case 168:
+case 174:
 YY_RULE_SETUP
-#line 605 "./sparql_l.l"
+#line 611 "./sparql_l.l"
 { yymore(); }
 	YY_BREAK
-case 169:
+case 175:
 YY_RULE_SETUP
-#line 606 "./sparql_l.l"
+#line 612 "./sparql_l.l"
 { yymore(); }
 	YY_BREAK
-case 170:
+case 176:
 YY_RULE_SETUP
-#line 607 "./sparql_l.l"
+#line 613 "./sparql_l.l"
 { sparyyerror ("Bad escape sequence in a long single-quoted string"); }
 	YY_BREAK
-case 171:
+case 177:
 YY_RULE_SETUP
-#line 608 "./sparql_l.l"
+#line 614 "./sparql_l.l"
 { sparyyerror ("Bad escape sequence in a long double-quoted string"); }
 	YY_BREAK
-case 172:
+case 178:
 YY_RULE_SETUP
-#line 609 "./sparql_l.l"
+#line 615 "./sparql_l.l"
 { sparyyerror ("Bad character in a long single-quoted string"); }
 	YY_BREAK
-case 173:
+case 179:
 YY_RULE_SETUP
-#line 610 "./sparql_l.l"
+#line 616 "./sparql_l.l"
 { sparyyerror ("Bad character in a long double-quoted string"); }
 	YY_BREAK
 case YY_STATE_EOF(SPARQL_SSSQ):
-#line 611 "./sparql_l.l"
+#line 617 "./sparql_l.l"
 { sparyyerror ("Unterminated long single-quoted string"); }
 	YY_BREAK
 case YY_STATE_EOF(SPARQL_DDDQ):
-#line 612 "./sparql_l.l"
+#line 618 "./sparql_l.l"
 { sparyyerror ("Unterminated long double-quoted string"); }
 	YY_BREAK
-case 174:
+case 180:
 YY_RULE_SETUP
-#line 615 "./sparql_l.l"
+#line 621 "./sparql_l.l"
 { yymore(); SET_INNER_BEGIN(SPARQL_SQ); BEGIN_INNER; }
 	YY_BREAK
-case 175:
+case 181:
 YY_RULE_SETUP
-#line 616 "./sparql_l.l"
+#line 622 "./sparql_l.l"
 { yymore(); SET_INNER_BEGIN(SPARQL_DQ); BEGIN_INNER; }
 	YY_BREAK
-case 176:
+case 182:
 YY_RULE_SETUP
-#line 617 "./sparql_l.l"
+#line 623 "./sparql_l.l"
 { sparyylval.box = spar_strliteral (sparp, sparyytext, 0, 0); BEGIN_OUTER; return SPARQL_STRING; }
 	YY_BREAK
-case 177:
+case 183:
 YY_RULE_SETUP
-#line 618 "./sparql_l.l"
+#line 624 "./sparql_l.l"
 { sparyylval.box = spar_strliteral (sparp, sparyytext, 0, 0); BEGIN_OUTER; return SPARQL_STRING; }
 	YY_BREAK
-case 178:
-/* rule 178 can match eol */
+case 184:
+/* rule 184 can match eol */
 YY_RULE_SETUP
-#line 619 "./sparql_l.l"
+#line 625 "./sparql_l.l"
 { sparyyerror ("End-of-line in a short single-quoted string"); yymore(); }
 	YY_BREAK
-case 179:
-/* rule 179 can match eol */
+case 185:
+/* rule 185 can match eol */
 YY_RULE_SETUP
-#line 620 "./sparql_l.l"
+#line 626 "./sparql_l.l"
 { sparyyerror ("End-of-line in a short double-quoted string"); yymore(); }
 	YY_BREAK
-case 180:
+case 186:
 YY_RULE_SETUP
-#line 621 "./sparql_l.l"
+#line 627 "./sparql_l.l"
 { yymore(); }
 	YY_BREAK
-case 181:
+case 187:
 YY_RULE_SETUP
-#line 622 "./sparql_l.l"
+#line 628 "./sparql_l.l"
 { yymore(); }
 	YY_BREAK
-case 182:
+case 188:
 YY_RULE_SETUP
-#line 623 "./sparql_l.l"
+#line 629 "./sparql_l.l"
 { sparyyerror ("Bad escape sequence in a short single-quoted string"); }
 	YY_BREAK
-case 183:
+case 189:
 YY_RULE_SETUP
-#line 624 "./sparql_l.l"
+#line 630 "./sparql_l.l"
 { sparyyerror ("Bad escape sequence in a short double-quoted string"); }
 	YY_BREAK
 case YY_STATE_EOF(SPARQL_SQ):
-#line 625 "./sparql_l.l"
+#line 631 "./sparql_l.l"
 { sparyyerror ("Unterminated short single-quoted string"); }
 	YY_BREAK
 case YY_STATE_EOF(SPARQL_DQ):
-#line 626 "./sparql_l.l"
+#line 632 "./sparql_l.l"
 { sparyyerror ("Unterminated short double-quoted string"); }
 	YY_BREAK
 /* Whitespace after COUNT keyword */
-case 184:
+case 190:
 YY_RULE_SETUP
-#line 630 "./sparql_l.l"
+#line 636 "./sparql_l.l"
 { BEGIN SPARQL; TOKPAR_OPEN (COUNT_LPAR, ')', GET_CURRENT_BEGIN) }
 	YY_BREAK
-case 185:
+case 191:
 YY_RULE_SETUP
-#line 631 "./sparql_l.l"
+#line 637 "./sparql_l.l"
 { BEGIN SPARQL; return COUNT_DISTINCT_L; }
 	YY_BREAK
 case YY_STATE_EOF(SPARQL_AFTER_COUNT):
-#line 632 "./sparql_l.l"
+#line 638 "./sparql_l.l"
 { sparyyerror ("Unexpected end of SPARQL expression after IDENTIFIED keyword"); }
 	YY_BREAK
 /* Whitespace after IDENTIFIED keyword */
-case 186:
+case 192:
 YY_RULE_SETUP
-#line 636 "./sparql_l.l"
+#line 642 "./sparql_l.l"
 { BEGIN SPARQL; return BY_L; }
 	YY_BREAK
 case YY_STATE_EOF(SPARQL_AFTER_IDENTIFIED):
-#line 637 "./sparql_l.l"
+#line 643 "./sparql_l.l"
 { sparyyerror ("Unexpected end of SPARQL expression after IDENTIFIED keyword"); }
 	YY_BREAK
 /* SQL fragments */
-case 187:
+case 193:
 YY_RULE_SETUP
-#line 641 "./sparql_l.l"
+#line 647 "./sparql_l.l"
 { BEGIN SPARQL; TOKPAR_OPEN (_LBRA, '}', GET_CURRENT_BEGIN) }
 	YY_BREAK
-case 188:
+case 194:
 YY_RULE_SETUP
-#line 642 "./sparql_l.l"
+#line 648 "./sparql_l.l"
 { BEGIN SPARQL; TOKPAR_OPEN (_LPAR, ')', SPARQL_SQL_FRAGMENT) }
 	YY_BREAK
-case 189:
+case 195:
 YY_RULE_SETUP
-#line 643 "./sparql_l.l"
+#line 649 "./sparql_l.l"
 { SET_INNER_BEGIN(SPARQL_SSSQ); BEGIN_INNER; }
 	YY_BREAK
-case 190:
+case 196:
 YY_RULE_SETUP
-#line 644 "./sparql_l.l"
+#line 650 "./sparql_l.l"
 { SET_INNER_BEGIN(SPARQL_DDDQ); BEGIN_INNER; }
 	YY_BREAK
-case 191:
+case 197:
 YY_RULE_SETUP
-#line 645 "./sparql_l.l"
+#line 651 "./sparql_l.l"
 { SET_INNER_BEGIN(SPARQL_SQ); BEGIN_INNER; }
 	YY_BREAK
-case 192:
+case 198:
 YY_RULE_SETUP
-#line 646 "./sparql_l.l"
+#line 652 "./sparql_l.l"
 { SET_INNER_BEGIN(SPARQL_DQ); BEGIN_INNER; }
 	YY_BREAK
 case YY_STATE_EOF(SPARQL_AFTER_WHERE):
-#line 647 "./sparql_l.l"
+#line 653 "./sparql_l.l"
 { sparyyerror ("Unexpected end of SPARQL expression after WHERE keyword"); }
 	YY_BREAK
-case 193:
-/* rule 193 can match eol */
+case 199:
+/* rule 199 can match eol */
 YY_RULE_SETUP
-#line 649 "./sparql_l.l"
+#line 655 "./sparql_l.l"
 { yymore(); }
 	YY_BREAK
-case 194:
+case 200:
 YY_RULE_SETUP
-#line 651 "./sparql_l.l"
+#line 657 "./sparql_l.l"
 { TOKPAR_FAKE_OPEN('}', SPARQL_SQL_FRAGMENT); yymore(); }
 	YY_BREAK
-case 195:
+case 201:
 YY_RULE_SETUP
-#line 652 "./sparql_l.l"
+#line 658 "./sparql_l.l"
 { TOKPAR_FAKE_CLOSE('}'); yymore(); }
 	YY_BREAK
-case 196:
+case 202:
 YY_RULE_SETUP
-#line 653 "./sparql_l.l"
+#line 659 "./sparql_l.l"
 { TOKPAR_FAKE_OPEN(')', SPARQL_SQL_FRAGMENT); yymore(); }
 	YY_BREAK
-case 197:
+case 203:
 YY_RULE_SETUP
-#line 654 "./sparql_l.l"
+#line 660 "./sparql_l.l"
 {
     TOKPAR_FAKE_CLOSE(')');
     if (SPARQL == GET_CURRENT_BEGIN)
@@ -4070,141 +4151,141 @@ YY_RULE_SETUP
       yymore();
   }
 	YY_BREAK
-case 198:
-/* rule 198 can match eol */
+case 204:
+/* rule 204 can match eol */
 YY_RULE_SETUP
-#line 665 "./sparql_l.l"
+#line 671 "./sparql_l.l"
 { sparp->sparp_lexlineno++; yymore(); }
 	YY_BREAK
-case 199:
+case 205:
 YY_RULE_SETUP
-#line 666 "./sparql_l.l"
+#line 672 "./sparql_l.l"
 { sparyyerror ("Unterminated comment in SQL fragment after WHERE keyword"); }
 	YY_BREAK
-case 200:
+case 206:
 YY_RULE_SETUP
-#line 667 "./sparql_l.l"
+#line 673 "./sparql_l.l"
 { yymore(); }
 	YY_BREAK
-case 201:
+case 207:
 YY_RULE_SETUP
-#line 668 "./sparql_l.l"
+#line 674 "./sparql_l.l"
 { BEGIN SPARQL_SQL_SQSTRING; yymore(); }
 	YY_BREAK
-case 202:
+case 208:
 YY_RULE_SETUP
-#line 669 "./sparql_l.l"
+#line 675 "./sparql_l.l"
 { yymore(); }
 	YY_BREAK
-case 203:
+case 209:
 YY_RULE_SETUP
-#line 670 "./sparql_l.l"
+#line 676 "./sparql_l.l"
 { sparyyerror ("Unterminated double-quoted identifier in SQL fragment after WHERE keyword"); }
 	YY_BREAK
-case 204:
+case 210:
 YY_RULE_SETUP
-#line 672 "./sparql_l.l"
+#line 678 "./sparql_l.l"
 { BEGIN SPARQL_SQL_FRAGMENT; yymore(); }
 	YY_BREAK
-case 205:
-/* rule 205 can match eol */
+case 211:
+/* rule 211 can match eol */
 YY_RULE_SETUP
-#line 673 "./sparql_l.l"
+#line 679 "./sparql_l.l"
 { sparp->sparp_lexlineno++; yymore(); }
 	YY_BREAK
-case 206:
-/* rule 206 can match eol */
+case 212:
+/* rule 212 can match eol */
 YY_RULE_SETUP
-#line 674 "./sparql_l.l"
+#line 680 "./sparql_l.l"
 { sparp->sparp_lexlineno++; yymore(); }
 	YY_BREAK
-case 207:
+case 213:
 YY_RULE_SETUP
-#line 675 "./sparql_l.l"
+#line 681 "./sparql_l.l"
 { yymore(); }
 	YY_BREAK
-case 208:
+case 214:
 YY_RULE_SETUP
-#line 676 "./sparql_l.l"
+#line 682 "./sparql_l.l"
 { yymore(); }
 	YY_BREAK
-case 209:
+case 215:
 YY_RULE_SETUP
-#line 677 "./sparql_l.l"
+#line 683 "./sparql_l.l"
 { yymore(); }
 	YY_BREAK
 case YY_STATE_EOF(SPARQL_SQL_SQSTRING):
-#line 678 "./sparql_l.l"
+#line 684 "./sparql_l.l"
 { sparyyerror ("Unterminated single-quoted string in SQL fragment after WHERE keyword"); }
 	YY_BREAK
 /* Whitespace and comments */
-case 210:
-/* rule 210 can match eol */
+case 216:
+/* rule 216 can match eol */
 YY_RULE_SETUP
-#line 682 "./sparql_l.l"
+#line 688 "./sparql_l.l"
 { sparp->sparp_lexlineno++; }
 	YY_BREAK
-case 211:
+case 217:
 YY_RULE_SETUP
-#line 683 "./sparql_l.l"
+#line 689 "./sparql_l.l"
 { }
 	YY_BREAK
-case 212:
+case 218:
 YY_RULE_SETUP
-#line 684 "./sparql_l.l"
+#line 690 "./sparql_l.l"
 { }
 	YY_BREAK
-case 213:
+case 219:
 YY_RULE_SETUP
-#line 686 "./sparql_l.l"
+#line 692 "./sparql_l.l"
 { BEGIN (SPARQL_SQL_COMMENT); yymore(); }
 	YY_BREAK
 case YY_STATE_EOF(SPARQL_SQL_FRAGMENT):
-#line 687 "./sparql_l.l"
+#line 693 "./sparql_l.l"
 { sparyyerror ("Unterminated SQL fragment after WHERE keyword"); }
 	YY_BREAK
-case 214:
+case 220:
 YY_RULE_SETUP
-#line 689 "./sparql_l.l"
+#line 695 "./sparql_l.l"
 { sparyyerror ("Nested C style comments not supported"); }
 	YY_BREAK
-case 215:
+case 221:
 YY_RULE_SETUP
-#line 690 "./sparql_l.l"
+#line 696 "./sparql_l.l"
 { BEGIN (SPARQL_SQL_FRAGMENT); yymore(); }
 	YY_BREAK
-case 216:
+case 222:
 YY_RULE_SETUP
-#line 691 "./sparql_l.l"
+#line 697 "./sparql_l.l"
 { yymore(); }
 	YY_BREAK
 /* Traps; these rules should be latest rules in the file. */
-case 217:
+case 223:
 YY_RULE_SETUP
-#line 695 "./sparql_l.l"
+#line 701 "./sparql_l.l"
 { sparyyerror ("Only '(' and 'DISTINCT' are allowed after COUNT keyword in SPARQL expression"); }
 	YY_BREAK
-case 218:
+case 224:
 YY_RULE_SETUP
-#line 696 "./sparql_l.l"
+#line 702 "./sparql_l.l"
 { sparyyerror ("Ill formed IDENTIFIED BY term"); }
 	YY_BREAK
-case 219:
+case 225:
 YY_RULE_SETUP
-#line 697 "./sparql_l.l"
+#line 703 "./sparql_l.l"
 { sparyyerror ("Only '{', '(' and a string literal are allowed after WHERE keyword in SPARQL expression"); }
 	YY_BREAK
-case 220:
+case 226:
 YY_RULE_SETUP
-#line 698 "./sparql_l.l"
+#line 704 "./sparql_l.l"
 { sparyyerror ("Invalid character in SPARQL expression"); }
 	YY_BREAK
-case 221:
+case 227:
 YY_RULE_SETUP
-#line 700 "./sparql_l.l"
+#line 706 "./sparql_l.l"
 ECHO;
 	YY_BREAK
-#line 4208 "sparql_l.c"
+#line 4289 "sparql_l.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(SPARQL):
 case YY_STATE_EOF(SPARQL_SQL_COMMENT):
@@ -4500,7 +4581,7 @@ static int yy_get_next_buffer (void)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 857 )
+			if ( yy_current_state >= 882 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -4528,11 +4609,11 @@ static int yy_get_next_buffer (void)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 857 )
+		if ( yy_current_state >= 882 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 856);
+	yy_is_jam = (yy_current_state == 881);
 
 	return yy_is_jam ? 0 : yy_current_state;
 }
@@ -5165,7 +5246,7 @@ void sparyyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 700 "./sparql_l.l"
+#line 706 "./sparql_l.l"
 
 
 
diff --git a/libsrc/Wi/sparql_l.l b/libsrc/Wi/sparql_l.l
index 4928a38..81f5363 100644
--- a/libsrc/Wi/sparql_l.l
+++ b/libsrc/Wi/sparql_l.l
@@ -1,5 +1,5 @@
 /*
- *  $Id: sparql_l.l,v 1.37.2.12 2010/03/22 11:54:10 source Exp $
+ *  $Id: sparql_l.l,v 1.37.2.15 2011/01/03 10:21:01 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -404,6 +404,7 @@ SPAR_PARAMNAME	(([A-Z]+"::")?(({SPAR_SQLNAME}("."{SPAR_SQLNAME})?)|(":"{SPAR_SQL
 <SPARQL>{A}{S}{K}			{ return ASK_L		; }
 <SPARQL>{A}{V}{G}			{ return AVG_L		; }
 <SPARQL>{B}{A}{S}{E}			{ return BASE_L		; }
+<SPARQL>{B}{I}{N}{D}{I}{N}{G}{S}	{ return BINDINGS_L	; }
 <SPARQL>{B}{I}{J}{E}{C}{T}{I}{O}{N}	{ return BIJECTION_L	; }
 <SPARQL>{B}{O}{U}{N}{D}			{ return BOUND_L	; }
 <SPARQL>{B}{Y}				{ return BY_L		; }
@@ -423,6 +424,7 @@ SPAR_PARAMNAME	(([A-Z]+"::")?(({SPAR_SQLNAME}("."{SPAR_SQLNAME})?)|(":"{SPAR_SQL
 <SPARQL>{D}{I}{S}{T}{I}{N}{C}{T}	{ return DISTINCT_L	; }
 <SPARQL>{D}{R}{O}{P}			{ return DROP_L		; }
 <SPARQL>{E}{X}{C}{L}{U}{S}{I}{V}{E}	{ return EXCLUSIVE_L	; }
+<SPARQL>{E}{X}{I}{S}{T}{S}		{ return EXISTS_L	; }
 <SPARQL>{F}{A}{L}{S}{E}			{ return false_L	; }
 <SPARQL>{F}{I}{L}{T}{E}{R}		{ return FILTER_L	; }
 <SPARQL>{F}{R}{O}{M}			{ return FROM_L		; }
@@ -452,10 +454,12 @@ SPAR_PARAMNAME	(([A-Z]+"::")?(({SPAR_SQLNAME}("."{SPAR_SQLNAME})?)|(":"{SPAR_SQL
 <SPARQL>{M}{A}{P}			{ return MAP_L		; }
 <SPARQL>{M}{A}{X}			{ return MAX_L		; }
 <SPARQL>{M}{I}{N}			{ return MIN_L		; }
+<SPARQL>{M}{I}{N}{U}{S}			{ return MINUS_L	; }
 <SPARQL>{M}{O}{D}{I}{F}{Y}		{ return MODIFY_L	; }
 <SPARQL>{N}{A}{M}{E}{D}			{ return NAMED_L	; }
 <SPARQL>{N}{I}{L}			{ return NIL_L		; }
 <SPARQL>{N}{O}{T}			{ return NOT_L		; }
+<SPARQL>{N}{O}{T}[ \t]+{F}{R}{O}{M}	{ return NOT_FROM_L	; }
 <SPARQL>{N}{U}{L}{L}			{ return NULL_L		; }
 <SPARQL>{O}{B}{J}{E}{C}{T}		{ return OBJECT_L	; }
 <SPARQL>{O}{F}				{ return OF_L		; }
@@ -504,8 +508,10 @@ SPAR_PARAMNAME	(([A-Z]+"::")?(({SPAR_SQLNAME}("."{SPAR_SQLNAME})?)|(":"{SPAR_SQL
 <SPARQL>{T}_{S}{T}{E}{P}		{ return T_STEP_L	; }
 <SPARQL>{T}{R}{A}{N}{S}{I}{T}{I}{V}{E}	{ return TRANSITIVE_L	; }
 <SPARQL>{T}{R}{U}{E}			{ return true_L		; }
+<SPARQL>{U}{N}{B}{O}{U}{N}{D}		{ return UNBOUND_L	; }
 <SPARQL>{U}{N}{I}{O}{N}			{ return UNION_L	; }
 <SPARQL>{U}{S}{I}{N}{G}			{ return USING_L	; }
+<SPARQL>{W}{I}{T}{H}			{ return WITH_L		; }
 
 <SPARQL>{T}{E}{X}{T}			{ sparyylval.box = t_box_dv_short_nchars (sparyytext, sparyyleng); return TEXT_BL	; }
 <SPARQL>{X}{M}{L}			{ sparyylval.box = t_box_dv_short_nchars (sparyytext, sparyyleng); return XML_BL	; }
diff --git a/libsrc/Wi/sparql_p.c b/libsrc/Wi/sparql_p.c
index 37af1cb..d617ced 100644
--- a/libsrc/Wi/sparql_p.c
+++ b/libsrc/Wi/sparql_p.c
@@ -76,7 +76,7 @@
 /* Copy the first part of user declarations.  */
 
 /* Line 189 of yacc.c  */
-#line 42 "./sparql_p.y"
+#line 41 "./sparql_p.y"
 
 
 #define YYPARSE_PARAM sparp_as_void
@@ -195,143 +195,149 @@ int sparyylex_from_sparp_bufs (caddr_t *yylval, sparp_t *sparp)
      AVG_L = 290,
      BASE_L = 291,
      BIJECTION_L = 292,
-     BOUND_L = 293,
-     BY_L = 294,
-     CLASS_L = 295,
-     CLEAR_L = 296,
-     CREATE_L = 297,
-     CONSTRUCT_L = 298,
-     COUNT_LPAR = 299,
-     COUNT_DISTINCT_L = 300,
-     DATA_L = 301,
-     DATATYPE_L = 302,
-     DEFAULT_L = 303,
-     DEFINE_L = 304,
-     DELETE_L = 305,
-     DEREF_L = 306,
-     DESC_L = 307,
-     DESCRIBE_L = 308,
-     DISTINCT_L = 309,
-     DROP_L = 310,
-     EXCLUSIVE_L = 311,
-     false_L = 312,
-     FILTER_L = 313,
-     FROM_L = 314,
-     FUNCTION_L = 315,
-     GRAPH_L = 316,
-     GROUP_L = 317,
-     HAVING_L = 318,
-     IDENTIFIED_L = 319,
-     IFP_L = 320,
-     IN_L = 321,
-     INDEX_L = 322,
-     INFERENCE_L = 323,
-     INSERT_L = 324,
-     INTO_L = 325,
-     IRI_L = 326,
-     isBLANK_L = 327,
-     isIRI_L = 328,
-     isLITERAL_L = 329,
-     isREF_L = 330,
-     isURI_L = 331,
-     LANG_L = 332,
-     LANGMATCHES_L = 333,
-     LIKE_L = 334,
-     LIMIT_L = 335,
-     LITERAL_L = 336,
-     LOAD_L = 337,
-     MAKE_L = 338,
-     MAP_L = 339,
-     MAX_L = 340,
-     MIN_L = 341,
-     MODIFY_L = 342,
-     NAMED_L = 343,
-     NIL_L = 344,
-     NOT_L = 345,
-     NULL_L = 346,
-     OBJECT_L = 347,
-     OF_L = 348,
-     OFFBAND_L = 349,
-     OFFSET_L = 350,
-     OPTIONAL_L = 351,
-     OPTION_L = 352,
-     ORDER_L = 353,
-     PREDICATE_L = 354,
-     PREFIX_L = 355,
-     QUAD_L = 356,
-     REGEX_L = 357,
-     REDUCED_L = 358,
-     RETURNS_L = 359,
-     SAME_AS_L = 360,
-     SAME_AS_O_L = 361,
-     SAME_AS_P_L = 362,
-     SAME_AS_S_L = 363,
-     SAME_AS_S_O_L = 364,
-     SAMETERM_L = 365,
-     SCORE_L = 366,
-     SCORE_LIMIT_L = 367,
-     SELECT_L = 368,
-     SERVICE_L = 369,
-     SILENT_L = 370,
-     SOFT_L = 371,
-     STORAGE_L = 372,
-     STR_L = 373,
-     SUBCLASS_L = 374,
-     SUBJECT_L = 375,
-     SUM_L = 376,
-     TABLE_OPTION_L = 377,
-     T_CYCLES_ONLY_L = 378,
-     T_DIRECTION_L = 379,
-     T_DISTINCT_L = 380,
-     T_END_FLAG_L = 381,
-     T_EXISTS_L = 382,
-     T_FINAL_AS_L = 383,
-     T_IN_L = 384,
-     T_MAX_L = 385,
-     T_MIN_L = 386,
-     T_OUT_L = 387,
-     T_NO_CYCLES_L = 388,
-     T_NO_ORDER_L = 389,
-     T_SHORTEST_ONLY_L = 390,
-     T_STEP_L = 391,
-     TRANSITIVE_L = 392,
-     true_L = 393,
-     UNION_L = 394,
-     USING_L = 395,
-     WHERE_L = 396,
-     __SPAR_PUNCT_END = 397,
-     START_OF_SPARQL_TEXT = 398,
-     END_OF_SPARQL_TEXT = 399,
-     SPARUL_RUN_SUBTYPE = 400,
-     SPARUL_INSERT_DATA = 401,
-     SPARUL_DELETE_DATA = 402,
-     __SPAR_NONPUNCT_START = 403,
-     TEXT_BL = 404,
-     XML_BL = 405,
-     SPARQL_INTEGER = 406,
-     SPARQL_DECIMAL = 407,
-     SPARQL_DOUBLE = 408,
-     SPARQL_STRING = 409,
-     SPARQL_CONDITION_AFTER_WHERE_LPAR = 410,
-     LANGTAG = 411,
-     QNAME = 412,
-     QNAME_NS = 413,
-     BLANK_NODE_LABEL = 414,
-     Q_IRI_REF = 415,
-     QUEST_VARNAME = 416,
-     DOLLAR_VARNAME = 417,
-     QUEST_COLON_PARAMNAME = 418,
-     DOLLAR_COLON_PARAMNAME = 419,
-     QUEST_COLON_PARAMNUM = 420,
-     DOLLAR_COLON_PARAMNUM = 421,
-     SPARQL_PLAIN_ID = 422,
-     SPARQL_SQL_ALIASCOLNAME = 423,
-     SPARQL_SQL_QTABLENAME = 424,
-     SPARQL_SQL_QTABLECOLNAME = 425,
-     __SPAR_NONPUNCT_END = 426,
-     _COLON = 427,
-     UMINUS = 428,
-     UPLUS = 429
+     BINDINGS_L = 293,
+     BOUND_L = 294,
+     BY_L = 295,
+     CLASS_L = 296,
+     CLEAR_L = 297,
+     CREATE_L = 298,
+     CONSTRUCT_L = 299,
+     COUNT_LPAR = 300,
+     COUNT_DISTINCT_L = 301,
+     DATA_L = 302,
+     DATATYPE_L = 303,
+     DEFAULT_L = 304,
+     DEFINE_L = 305,
+     DELETE_L = 306,
+     DEREF_L = 307,
+     DESC_L = 308,
+     DESCRIBE_L = 309,
+     DISTINCT_L = 310,
+     DROP_L = 311,
+     EXCLUSIVE_L = 312,
+     EXISTS_L = 313,
+     false_L = 314,
+     FILTER_L = 315,
+     FROM_L = 316,
+     FUNCTION_L = 317,
+     GRAPH_L = 318,
+     GROUP_L = 319,
+     HAVING_L = 320,
+     IDENTIFIED_L = 321,
+     IFP_L = 322,
+     IN_L = 323,
+     INDEX_L = 324,
+     INFERENCE_L = 325,
+     INSERT_L = 326,
+     INTO_L = 327,
+     IRI_L = 328,
+     isBLANK_L = 329,
+     isIRI_L = 330,
+     isLITERAL_L = 331,
+     isREF_L = 332,
+     isURI_L = 333,
+     LANG_L = 334,
+     LANGMATCHES_L = 335,
+     LIKE_L = 336,
+     LIMIT_L = 337,
+     LITERAL_L = 338,
+     LOAD_L = 339,
+     MAKE_L = 340,
+     MAP_L = 341,
+     MAX_L = 342,
+     MIN_L = 343,
+     MINUS_L = 344,
+     MODIFY_L = 345,
+     NAMED_L = 346,
+     NIL_L = 347,
+     NOT_L = 348,
+     NOT_FROM_L = 349,
+     NULL_L = 350,
+     OBJECT_L = 351,
+     OF_L = 352,
+     OFFBAND_L = 353,
+     OFFSET_L = 354,
+     OPTIONAL_L = 355,
+     OPTION_L = 356,
+     ORDER_L = 357,
+     PREDICATE_L = 358,
+     PREFIX_L = 359,
+     QUAD_L = 360,
+     REGEX_L = 361,
+     REDUCED_L = 362,
+     RETURNS_L = 363,
+     SAME_AS_L = 364,
+     SAME_AS_O_L = 365,
+     SAME_AS_P_L = 366,
+     SAME_AS_S_L = 367,
+     SAME_AS_S_O_L = 368,
+     SAMETERM_L = 369,
+     SCORE_L = 370,
+     SCORE_LIMIT_L = 371,
+     SELECT_L = 372,
+     SERVICE_L = 373,
+     SILENT_L = 374,
+     SOFT_L = 375,
+     STORAGE_L = 376,
+     STR_L = 377,
+     SUBCLASS_L = 378,
+     SUBJECT_L = 379,
+     SUM_L = 380,
+     TABLE_OPTION_L = 381,
+     T_CYCLES_ONLY_L = 382,
+     T_DIRECTION_L = 383,
+     T_DISTINCT_L = 384,
+     T_END_FLAG_L = 385,
+     T_EXISTS_L = 386,
+     T_FINAL_AS_L = 387,
+     T_IN_L = 388,
+     T_MAX_L = 389,
+     T_MIN_L = 390,
+     T_OUT_L = 391,
+     T_NO_CYCLES_L = 392,
+     T_NO_ORDER_L = 393,
+     T_SHORTEST_ONLY_L = 394,
+     T_STEP_L = 395,
+     TRANSITIVE_L = 396,
+     true_L = 397,
+     UNBOUND_L = 398,
+     UNION_L = 399,
+     USING_L = 400,
+     WHERE_L = 401,
+     WITH_L = 402,
+     __SPAR_PUNCT_END = 403,
+     START_OF_SPARQL_TEXT = 404,
+     END_OF_SPARQL_TEXT = 405,
+     SPARUL_RUN_SUBTYPE = 406,
+     SPARUL_INSERT_DATA = 407,
+     SPARUL_DELETE_DATA = 408,
+     __SPAR_NONPUNCT_START = 409,
+     TEXT_BL = 410,
+     XML_BL = 411,
+     SPARQL_INTEGER = 412,
+     SPARQL_DECIMAL = 413,
+     SPARQL_DOUBLE = 414,
+     SPARQL_STRING = 415,
+     SPARQL_CONDITION_AFTER_WHERE_LPAR = 416,
+     LANGTAG = 417,
+     QNAME = 418,
+     QNAME_NS = 419,
+     BLANK_NODE_LABEL = 420,
+     Q_IRI_REF = 421,
+     QUEST_VARNAME = 422,
+     DOLLAR_VARNAME = 423,
+     QUEST_COLON_PARAMNAME = 424,
+     DOLLAR_COLON_PARAMNAME = 425,
+     QUEST_COLON_PARAMNUM = 426,
+     DOLLAR_COLON_PARAMNUM = 427,
+     SPARQL_PLAIN_ID = 428,
+     SPARQL_SQL_ALIASCOLNAME = 429,
+     SPARQL_SQL_QTABLENAME = 430,
+     SPARQL_SQL_QTABLECOLNAME = 431,
+     __SPAR_NONPUNCT_END = 432,
+     _COLON = 433,
+     UMINUS = 434,
+     UPLUS = 435
    };
 #endif
 /* Tokens.  */
@@ -370,143 +376,149 @@ int sparyylex_from_sparp_bufs (caddr_t *yylval, sparp_t *sparp)
 #define AVG_L 290
 #define BASE_L 291
 #define BIJECTION_L 292
-#define BOUND_L 293
-#define BY_L 294
-#define CLASS_L 295
-#define CLEAR_L 296
-#define CREATE_L 297
-#define CONSTRUCT_L 298
-#define COUNT_LPAR 299
-#define COUNT_DISTINCT_L 300
-#define DATA_L 301
-#define DATATYPE_L 302
-#define DEFAULT_L 303
-#define DEFINE_L 304
-#define DELETE_L 305
-#define DEREF_L 306
-#define DESC_L 307
-#define DESCRIBE_L 308
-#define DISTINCT_L 309
-#define DROP_L 310
-#define EXCLUSIVE_L 311
-#define false_L 312
-#define FILTER_L 313
-#define FROM_L 314
-#define FUNCTION_L 315
-#define GRAPH_L 316
-#define GROUP_L 317
-#define HAVING_L 318
-#define IDENTIFIED_L 319
-#define IFP_L 320
-#define IN_L 321
-#define INDEX_L 322
-#define INFERENCE_L 323
-#define INSERT_L 324
-#define INTO_L 325
-#define IRI_L 326
-#define isBLANK_L 327
-#define isIRI_L 328
-#define isLITERAL_L 329
-#define isREF_L 330
-#define isURI_L 331
-#define LANG_L 332
-#define LANGMATCHES_L 333
-#define LIKE_L 334
-#define LIMIT_L 335
-#define LITERAL_L 336
-#define LOAD_L 337
-#define MAKE_L 338
-#define MAP_L 339
-#define MAX_L 340
-#define MIN_L 341
-#define MODIFY_L 342
-#define NAMED_L 343
-#define NIL_L 344
-#define NOT_L 345
-#define NULL_L 346
-#define OBJECT_L 347
-#define OF_L 348
-#define OFFBAND_L 349
-#define OFFSET_L 350
-#define OPTIONAL_L 351
-#define OPTION_L 352
-#define ORDER_L 353
-#define PREDICATE_L 354
-#define PREFIX_L 355
-#define QUAD_L 356
-#define REGEX_L 357
-#define REDUCED_L 358
-#define RETURNS_L 359
-#define SAME_AS_L 360
-#define SAME_AS_O_L 361
-#define SAME_AS_P_L 362
-#define SAME_AS_S_L 363
-#define SAME_AS_S_O_L 364
-#define SAMETERM_L 365
-#define SCORE_L 366
-#define SCORE_LIMIT_L 367
-#define SELECT_L 368
-#define SERVICE_L 369
-#define SILENT_L 370
-#define SOFT_L 371
-#define STORAGE_L 372
-#define STR_L 373
-#define SUBCLASS_L 374
-#define SUBJECT_L 375
-#define SUM_L 376
-#define TABLE_OPTION_L 377
-#define T_CYCLES_ONLY_L 378
-#define T_DIRECTION_L 379
-#define T_DISTINCT_L 380
-#define T_END_FLAG_L 381
-#define T_EXISTS_L 382
-#define T_FINAL_AS_L 383
-#define T_IN_L 384
-#define T_MAX_L 385
-#define T_MIN_L 386
-#define T_OUT_L 387
-#define T_NO_CYCLES_L 388
-#define T_NO_ORDER_L 389
-#define T_SHORTEST_ONLY_L 390
-#define T_STEP_L 391
-#define TRANSITIVE_L 392
-#define true_L 393
-#define UNION_L 394
-#define USING_L 395
-#define WHERE_L 396
-#define __SPAR_PUNCT_END 397
-#define START_OF_SPARQL_TEXT 398
-#define END_OF_SPARQL_TEXT 399
-#define SPARUL_RUN_SUBTYPE 400
-#define SPARUL_INSERT_DATA 401
-#define SPARUL_DELETE_DATA 402
-#define __SPAR_NONPUNCT_START 403
-#define TEXT_BL 404
-#define XML_BL 405
-#define SPARQL_INTEGER 406
-#define SPARQL_DECIMAL 407
-#define SPARQL_DOUBLE 408
-#define SPARQL_STRING 409
-#define SPARQL_CONDITION_AFTER_WHERE_LPAR 410
-#define LANGTAG 411
-#define QNAME 412
-#define QNAME_NS 413
-#define BLANK_NODE_LABEL 414
-#define Q_IRI_REF 415
-#define QUEST_VARNAME 416
-#define DOLLAR_VARNAME 417
-#define QUEST_COLON_PARAMNAME 418
-#define DOLLAR_COLON_PARAMNAME 419
-#define QUEST_COLON_PARAMNUM 420
-#define DOLLAR_COLON_PARAMNUM 421
-#define SPARQL_PLAIN_ID 422
-#define SPARQL_SQL_ALIASCOLNAME 423
-#define SPARQL_SQL_QTABLENAME 424
-#define SPARQL_SQL_QTABLECOLNAME 425
-#define __SPAR_NONPUNCT_END 426
-#define _COLON 427
-#define UMINUS 428
-#define UPLUS 429
+#define BINDINGS_L 293
+#define BOUND_L 294
+#define BY_L 295
+#define CLASS_L 296
+#define CLEAR_L 297
+#define CREATE_L 298
+#define CONSTRUCT_L 299
+#define COUNT_LPAR 300
+#define COUNT_DISTINCT_L 301
+#define DATA_L 302
+#define DATATYPE_L 303
+#define DEFAULT_L 304
+#define DEFINE_L 305
+#define DELETE_L 306
+#define DEREF_L 307
+#define DESC_L 308
+#define DESCRIBE_L 309
+#define DISTINCT_L 310
+#define DROP_L 311
+#define EXCLUSIVE_L 312
+#define EXISTS_L 313
+#define false_L 314
+#define FILTER_L 315
+#define FROM_L 316
+#define FUNCTION_L 317
+#define GRAPH_L 318
+#define GROUP_L 319
+#define HAVING_L 320
+#define IDENTIFIED_L 321
+#define IFP_L 322
+#define IN_L 323
+#define INDEX_L 324
+#define INFERENCE_L 325
+#define INSERT_L 326
+#define INTO_L 327
+#define IRI_L 328
+#define isBLANK_L 329
+#define isIRI_L 330
+#define isLITERAL_L 331
+#define isREF_L 332
+#define isURI_L 333
+#define LANG_L 334
+#define LANGMATCHES_L 335
+#define LIKE_L 336
+#define LIMIT_L 337
+#define LITERAL_L 338
+#define LOAD_L 339
+#define MAKE_L 340
+#define MAP_L 341
+#define MAX_L 342
+#define MIN_L 343
+#define MINUS_L 344
+#define MODIFY_L 345
+#define NAMED_L 346
+#define NIL_L 347
+#define NOT_L 348
+#define NOT_FROM_L 349
+#define NULL_L 350
+#define OBJECT_L 351
+#define OF_L 352
+#define OFFBAND_L 353
+#define OFFSET_L 354
+#define OPTIONAL_L 355
+#define OPTION_L 356
+#define ORDER_L 357
+#define PREDICATE_L 358
+#define PREFIX_L 359
+#define QUAD_L 360
+#define REGEX_L 361
+#define REDUCED_L 362
+#define RETURNS_L 363
+#define SAME_AS_L 364
+#define SAME_AS_O_L 365
+#define SAME_AS_P_L 366
+#define SAME_AS_S_L 367
+#define SAME_AS_S_O_L 368
+#define SAMETERM_L 369
+#define SCORE_L 370
+#define SCORE_LIMIT_L 371
+#define SELECT_L 372
+#define SERVICE_L 373
+#define SILENT_L 374
+#define SOFT_L 375
+#define STORAGE_L 376
+#define STR_L 377
+#define SUBCLASS_L 378
+#define SUBJECT_L 379
+#define SUM_L 380
+#define TABLE_OPTION_L 381
+#define T_CYCLES_ONLY_L 382
+#define T_DIRECTION_L 383
+#define T_DISTINCT_L 384
+#define T_END_FLAG_L 385
+#define T_EXISTS_L 386
+#define T_FINAL_AS_L 387
+#define T_IN_L 388
+#define T_MAX_L 389
+#define T_MIN_L 390
+#define T_OUT_L 391
+#define T_NO_CYCLES_L 392
+#define T_NO_ORDER_L 393
+#define T_SHORTEST_ONLY_L 394
+#define T_STEP_L 395
+#define TRANSITIVE_L 396
+#define true_L 397
+#define UNBOUND_L 398
+#define UNION_L 399
+#define USING_L 400
+#define WHERE_L 401
+#define WITH_L 402
+#define __SPAR_PUNCT_END 403
+#define START_OF_SPARQL_TEXT 404
+#define END_OF_SPARQL_TEXT 405
+#define SPARUL_RUN_SUBTYPE 406
+#define SPARUL_INSERT_DATA 407
+#define SPARUL_DELETE_DATA 408
+#define __SPAR_NONPUNCT_START 409
+#define TEXT_BL 410
+#define XML_BL 411
+#define SPARQL_INTEGER 412
+#define SPARQL_DECIMAL 413
+#define SPARQL_DOUBLE 414
+#define SPARQL_STRING 415
+#define SPARQL_CONDITION_AFTER_WHERE_LPAR 416
+#define LANGTAG 417
+#define QNAME 418
+#define QNAME_NS 419
+#define BLANK_NODE_LABEL 420
+#define Q_IRI_REF 421
+#define QUEST_VARNAME 422
+#define DOLLAR_VARNAME 423
+#define QUEST_COLON_PARAMNAME 424
+#define DOLLAR_COLON_PARAMNAME 425
+#define QUEST_COLON_PARAMNUM 426
+#define DOLLAR_COLON_PARAMNUM 427
+#define SPARQL_PLAIN_ID 428
+#define SPARQL_SQL_ALIASCOLNAME 429
+#define SPARQL_SQL_QTABLENAME 430
+#define SPARQL_SQL_QTABLECOLNAME 431
+#define __SPAR_NONPUNCT_END 432
+#define _COLON 433
+#define UMINUS 434
+#define UPLUS 435
 
 
 
@@ -516,7 +528,7 @@ typedef union YYSTYPE
 {
 
 /* Line 214 of yacc.c  */
-#line 98 "./sparql_p.y"
+#line 97 "./sparql_p.y"
 
   caddr_t box;
   caddr_t *boxes;
@@ -531,7 +543,7 @@ typedef union YYSTYPE
 
 
 /* Line 214 of yacc.c  */
-#line 535 "sparql_p.c"
+#line 547 "sparql_p.c"
 } YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -543,7 +555,7 @@ typedef union YYSTYPE
 
 
 /* Line 264 of yacc.c  */
-#line 547 "sparql_p.c"
+#line 559 "sparql_p.c"
 
 #ifdef short
 # undef short
@@ -758,20 +770,20 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  7
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   3311
+#define YYLAST   3668
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  175
+#define YYNTOKENS  181
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  258
+#define YYNNTS  274
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  586
+#define YYNRULES  624
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  991
+#define YYNSTATES  1038
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   429
+#define YYMAXUTOK   435
 
 #define YYTRANSLATE(YYX)						\
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -821,7 +833,8 @@ static const yytype_uint8 yytranslate[] =
      135,   136,   137,   138,   139,   140,   141,   142,   143,   144,
      145,   146,   147,   148,   149,   150,   151,   152,   153,   154,
      155,   156,   157,   158,   159,   160,   161,   162,   163,   164,
-     165,   166,   167,   168,   169,   170,   171,   172,   173,   174
+     165,   166,   167,   168,   169,   170,   171,   172,   173,   174,
+     175,   176,   177,   178,   179,   180
 };
 
 #if YYDEBUG
@@ -833,305 +846,322 @@ static const yytype_uint16 yyprhs[] =
       29,    31,    35,    36,    39,    40,    45,    47,    51,    53,
       55,    57,    59,    61,    62,    65,    68,    69,    72,    76,
       79,    82,    83,    90,    92,    95,    98,   101,   102,   105,
-     107,   109,   111,   112,   119,   120,   127,   129,   131,   132,
-     137,   138,   141,   145,   147,   150,   153,   157,   158,   159,
-     164,   166,   169,   172,   177,   178,   181,   182,   184,   185,
-     191,   192,   197,   201,   207,   213,   214,   215,   220,   222,
-     225,   229,   233,   235,   237,   239,   240,   241,   245,   246,
-     247,   252,   254,   257,   262,   267,   270,   272,   274,   276,
-     277,   279,   281,   282,   284,   287,   288,   290,   293,   297,
-     298,   307,   309,   313,   318,   320,   322,   324,   326,   328,
-     330,   331,   336,   339,   340,   341,   342,   351,   352,   353,
-     360,   361,   365,   366,   372,   377,   380,   383,   384,   385,
-     386,   396,   397,   401,   404,   408,   411,   415,   420,   424,
-     425,   430,   431,   433,   436,   438,   442,   443,   445,   447,
-     451,   452,   456,   457,   461,   462,   464,   467,   468,   472,
-     473,   479,   483,   485,   487,   491,   495,   497,   500,   501,
-     502,   508,   510,   514,   516,   519,   522,   525,   528,   531,
-     534,   537,   540,   542,   545,   547,   550,   552,   555,   560,
-     563,   566,   568,   570,   575,   577,   584,   591,   593,   598,
-     600,   602,   606,   608,   610,   612,   614,   616,   618,   620,
-     621,   626,   627,   632,   635,   637,   640,   642,   645,   647,
-     649,   651,   653,   655,   658,   660,   662,   664,   668,   670,
-     672,   674,   676,   678,   680,   682,   686,   690,   692,   695,
-     699,   703,   708,   710,   712,   715,   718,   721,   724,   726,
-     728,   730,   733,   735,   737,   739,   741,   743,   745,   747,
-     749,   752,   755,   757,   759,   761,   763,   764,   769,   773,
-     777,   781,   785,   789,   793,   794,   799,   800,   807,   811,
-     815,   819,   823,   827,   831,   835,   839,   842,   845,   848,
-     851,   855,   856,   864,   865,   875,   877,   879,   882,   884,
-     886,   888,   890,   892,   897,   902,   909,   914,   919,   926,
-     931,   936,   941,   946,   948,   949,   955,   956,   962,   969,
-     978,   981,   982,   984,   986,   990,   992,   996,  1000,  1003,
-    1005,  1007,  1009,  1011,  1014,  1018,  1020,  1022,  1024,  1026,
-    1028,  1030,  1032,  1035,  1038,  1041,  1044,  1046,  1048,  1050,
-    1052,  1054,  1057,  1059,  1062,  1064,  1066,  1068,  1070,  1072,
-    1074,  1076,  1078,  1080,  1081,  1087,  1088,  1094,  1095,  1101,
-    1102,  1108,  1109,  1118,  1121,  1124,  1130,  1135,  1140,  1141,
-    1145,  1146,  1150,  1151,  1155,  1156,  1159,  1161,  1163,  1164,
-    1166,  1168,  1169,  1174,  1176,  1178,  1180,  1182,  1184,  1186,
-    1188,  1190,  1192,  1194,  1202,  1210,  1218,  1224,  1230,  1238,
-    1244,  1245,  1249,  1254,  1256,  1260,  1262,  1264,  1267,  1269,
-    1273,  1274,  1278,  1283,  1285,  1289,  1292,  1295,  1298,  1300,
-    1302,  1305,  1306,  1307,  1317,  1318,  1319,  1329,  1335,  1341,
-    1348,  1352,  1357,  1358,  1359,  1367,  1368,  1376,  1379,  1380,
-    1383,  1390,  1391,  1393,  1394,  1399,  1400,  1405,  1407,  1411,
-    1413,  1416,  1418,  1421,  1425,  1427,  1428,  1433,  1435,  1437,
-    1439,  1441,  1444,  1448,  1450,  1451,  1456,  1457,  1463,  1470,
-    1478,  1479,  1485,  1487,  1489,  1490,  1496,  1500,  1501,  1505,
-    1507,  1510,  1513,  1516,  1519,  1520,  1521,  1528,  1530,  1531,
-    1536,  1537,  1541,  1543,  1546,  1547,  1553,  1554,  1555,  1556,
-    1557,  1567,  1569,  1570,  1573,  1574,  1577,  1583,  1586,  1587,
-    1590,  1593,  1595,  1598,  1600,  1602,  1605,  1607,  1609,  1611,
-    1616,  1618,  1619,  1621,  1623,  1626,  1630,  1633,  1634,  1638,
-    1643,  1645,  1649,  1652,  1654,  1657,  1660,  1661,  1663,  1665,
-    1669,  1671,  1675,  1681,  1685,  1686,  1688,  1690,  1694,  1698,
-    1700,  1704,  1706,  1708,  1710,  1712,  1714,  1716,  1718,  1720,
-    1722,  1727,  1728,  1730,  1732,  1736,  1738
+     107,   109,   111,   112,   120,   121,   129,   131,   133,   134,
+     139,   140,   143,   147,   149,   152,   155,   159,   161,   164,
+     165,   166,   171,   173,   176,   179,   184,   185,   188,   189,
+     191,   192,   199,   200,   205,   208,   209,   211,   212,   213,
+     221,   223,   226,   228,   230,   232,   233,   235,   237,   240,
+     244,   246,   249,   251,   253,   255,   257,   259,   261,   265,
+     271,   277,   278,   279,   284,   286,   289,   293,   297,   299,
+     301,   303,   304,   305,   309,   310,   311,   316,   318,   321,
+     326,   331,   334,   336,   338,   340,   341,   343,   345,   346,
+     348,   351,   352,   354,   357,   361,   362,   371,   373,   377,
+     382,   384,   386,   388,   390,   392,   394,   395,   400,   403,
+     404,   405,   406,   415,   416,   417,   424,   425,   429,   430,
+     436,   441,   444,   447,   451,   454,   456,   459,   460,   465,
+     466,   467,   468,   478,   479,   483,   485,   488,   491,   495,
+     498,   501,   502,   507,   508,   510,   513,   515,   519,   520,
+     522,   524,   528,   529,   533,   534,   538,   539,   541,   544,
+     548,   549,   553,   554,   560,   564,   568,   570,   572,   576,
+     580,   584,   588,   590,   593,   594,   595,   601,   603,   607,
+     609,   612,   615,   618,   621,   624,   627,   630,   633,   635,
+     638,   640,   643,   645,   648,   653,   656,   659,   661,   663,
+     668,   670,   677,   684,   686,   691,   693,   695,   699,   701,
+     703,   705,   707,   709,   711,   713,   715,   716,   721,   722,
+     727,   730,   732,   735,   737,   740,   742,   744,   746,   748,
+     750,   753,   755,   757,   759,   763,   765,   767,   769,   771,
+     773,   775,   777,   781,   785,   787,   790,   794,   798,   803,
+     805,   807,   810,   813,   816,   819,   821,   823,   825,   828,
+     830,   832,   834,   836,   838,   840,   842,   844,   847,   850,
+     852,   854,   856,   858,   859,   864,   868,   872,   876,   880,
+     884,   888,   889,   894,   895,   902,   906,   910,   914,   918,
+     922,   926,   930,   934,   937,   940,   943,   946,   950,   951,
+     959,   960,   970,   972,   974,   977,   979,   981,   983,   985,
+     987,   992,   997,  1004,  1009,  1014,  1021,  1026,  1031,  1036,
+    1041,  1043,  1044,  1050,  1051,  1057,  1064,  1073,  1076,  1077,
+    1079,  1081,  1084,  1088,  1090,  1094,  1098,  1101,  1103,  1105,
+    1107,  1109,  1112,  1116,  1118,  1120,  1122,  1124,  1126,  1128,
+    1130,  1133,  1136,  1139,  1142,  1144,  1146,  1148,  1150,  1152,
+    1155,  1157,  1160,  1162,  1164,  1166,  1168,  1170,  1172,  1174,
+    1176,  1178,  1179,  1185,  1186,  1192,  1193,  1199,  1200,  1206,
+    1207,  1216,  1219,  1222,  1228,  1233,  1238,  1239,  1244,  1245,
+    1249,  1250,  1254,  1255,  1258,  1260,  1262,  1263,  1265,  1267,
+    1268,  1273,  1275,  1277,  1279,  1281,  1283,  1285,  1287,  1289,
+    1291,  1293,  1301,  1309,  1317,  1323,  1329,  1337,  1343,  1344,
+    1348,  1353,  1355,  1359,  1361,  1363,  1366,  1368,  1372,  1373,
+    1377,  1382,  1384,  1388,  1391,  1394,  1397,  1399,  1401,  1404,
+    1405,  1406,  1416,  1417,  1418,  1428,  1434,  1440,  1447,  1451,
+    1456,  1457,  1458,  1466,  1467,  1475,  1478,  1479,  1482,  1489,
+    1490,  1492,  1493,  1498,  1499,  1504,  1506,  1510,  1512,  1515,
+    1517,  1520,  1524,  1526,  1527,  1532,  1534,  1536,  1538,  1540,
+    1543,  1547,  1549,  1550,  1555,  1556,  1562,  1569,  1577,  1578,
+    1584,  1586,  1588,  1589,  1595,  1599,  1600,  1604,  1606,  1609,
+    1612,  1615,  1618,  1619,  1620,  1627,  1629,  1630,  1635,  1636,
+    1640,  1642,  1645,  1646,  1652,  1653,  1654,  1655,  1656,  1666,
+    1668,  1669,  1672,  1673,  1676,  1682,  1685,  1686,  1689,  1692,
+    1694,  1697,  1699,  1701,  1704,  1706,  1708,  1710,  1715,  1717,
+    1718,  1720,  1722,  1725,  1729,  1732,  1733,  1737,  1742,  1744,
+    1748,  1751,  1753,  1756,  1759,  1760,  1762,  1764,  1768,  1770,
+    1774,  1780,  1784,  1785,  1787,  1789,  1793,  1797,  1799,  1803,
+    1805,  1807,  1809,  1811,  1813,  1815,  1817,  1819,  1821,  1826,
+    1827,  1829,  1831,  1835,  1837
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int16 yyrhs[] =
 {
-     176,     0,    -1,   143,   178,   177,   144,    -1,   143,   178,
-     318,   144,    -1,   143,   144,    -1,   143,   178,   340,   432,
-      -1,     1,    -1,   187,    -1,   193,    -1,   195,    -1,   198,
-      -1,   179,   184,   185,    -1,    -1,   179,   180,    -1,    -1,
-      49,   181,   157,   182,    -1,   183,    -1,   182,     9,   183,
-      -1,   157,    -1,   160,    -1,   154,    -1,   151,    -1,   291,
-      -1,    -1,    36,   160,    -1,    36,     1,    -1,    -1,   185,
-     186,    -1,   100,   158,   160,    -1,   100,   158,    -1,   100,
-       1,    -1,    -1,   189,   188,   190,   200,   210,   213,    -1,
-     113,    -1,   113,   103,    -1,   113,    54,    -1,   113,    45,
-      -1,    -1,   191,   192,    -1,    28,    -1,   286,    -1,   285,
-      -1,    -1,    43,   194,   252,   200,   210,   213,    -1,    -1,
-      53,   196,   197,   200,   209,   213,    -1,    28,    -1,   281,
-      -1,    -1,    34,   199,   200,   210,    -1,    -1,   200,   201,
-      -1,   202,   315,   203,    -1,    59,    -1,    59,    88,    -1,
-      90,    59,    -1,    90,    59,    88,    -1,    -1,    -1,    97,
-      16,   204,   205,    -1,    24,    -1,   206,    24,    -1,   157,
-     207,    -1,   206,     9,   157,   207,    -1,    -1,   208,   296,
-      -1,    -1,   210,    -1,    -1,   141,    14,   211,   231,    23,
-      -1,    -1,    14,   212,   231,    23,    -1,   214,   218,   220,
-      -1,   214,   218,   220,   226,   227,    -1,   214,   218,   220,
-     228,   225,    -1,    -1,    -1,    62,    39,   215,   216,    -1,
-     217,    -1,   216,   217,    -1,    16,   296,    24,    -1,    17,
-     296,    25,    -1,   301,    -1,   305,    -1,   290,    -1,    -1,
-      -1,    63,   219,   296,    -1,    -1,    -1,    98,    39,   221,
-     222,    -1,   223,    -1,   222,   223,    -1,   224,    16,   296,
-      24,    -1,   224,    17,   296,    25,    -1,   224,   151,    -1,
-     301,    -1,   305,    -1,   290,    -1,    -1,    33,    -1,    52,
-      -1,    -1,   226,    -1,    80,   207,    -1,    -1,   228,    -1,
-      95,   207,    -1,   231,    23,   267,    -1,    -1,   189,   230,
-     190,   200,   210,   213,    23,   267,    -1,   256,    -1,   256,
-     232,   231,    -1,   256,   232,    10,   231,    -1,   235,    -1,
-     233,    -1,   242,    -1,   239,    -1,   246,    -1,   245,    -1,
-      -1,    96,    14,   234,   229,    -1,    96,     1,    -1,    -1,
-      -1,    -1,   101,    84,   236,   312,   237,    14,   238,   229,
-      -1,    -1,    -1,    61,   284,   240,    14,   241,   229,    -1,
-      -1,    14,   243,   229,    -1,    -1,   242,   139,    14,   244,
-     229,    -1,    58,    16,   296,    24,    -1,    58,   301,    -1,
-      58,   305,    -1,    -1,    -1,    -1,   114,   429,   247,   250,
-     248,   200,    14,   249,   229,    -1,    -1,    16,   251,    24,
-      -1,   157,   182,    -1,    49,   157,   182,    -1,    66,   271,
-      -1,   251,   157,   182,    -1,   251,    49,   157,   182,    -1,
-     251,    66,   271,    -1,    -1,    14,   253,   254,    23,    -1,
-      -1,   255,    -1,   255,    10,    -1,   258,    -1,   255,    10,
-     258,    -1,    -1,   257,    -1,   258,    -1,   258,    10,   256,
-      -1,    -1,   280,   259,   262,    -1,    -1,   274,   260,   261,
-      -1,    -1,   262,    -1,   262,    26,    -1,    -1,   273,   263,
-     265,    -1,    -1,   262,    26,   273,   264,   265,    -1,   262,
-      26,     1,    -1,     1,    -1,   266,    -1,   265,     9,   266,
-      -1,   265,     9,     1,    -1,     1,    -1,   279,   267,    -1,
-      -1,    -1,    97,    16,   268,   269,    24,    -1,   270,    -1,
-     269,     9,   270,    -1,    65,    -1,    68,   167,    -1,    68,
-     157,    -1,    68,   160,    -1,    68,   154,    -1,    94,   290,
-      -1,   111,   290,    -1,   112,   296,    -1,   122,   154,    -1,
-     123,    -1,   124,   151,    -1,   125,    -1,   126,   151,    -1,
-     127,    -1,   128,   290,    -1,   129,    16,   271,    24,    -1,
-     131,   296,    -1,   130,   296,    -1,   133,    -1,   134,    -1,
-     132,    16,   271,    24,    -1,   135,    -1,   136,    16,   290,
-      24,    32,   290,    -1,   136,    16,   154,    24,    32,   290,
-      -1,   137,    -1,   272,    16,   308,    24,    -1,   272,    -1,
-     290,    -1,   271,     9,   290,    -1,   105,    -1,   106,    -1,
-     107,    -1,   108,    -1,   109,    -1,   283,    -1,    30,    -1,
-      -1,    17,   275,   262,   277,    -1,    -1,    16,   276,   278,
-      24,    -1,    16,    24,    -1,    25,    -1,    26,    25,    -1,
-     279,    -1,   278,   279,    -1,   280,    -1,   274,    -1,   290,
-      -1,   293,    -1,   282,    -1,   281,   282,    -1,   290,    -1,
-     315,    -1,   294,    -1,    16,   296,    24,    -1,   290,    -1,
-     315,    -1,   294,    -1,   290,    -1,   317,    -1,   315,    -1,
-     294,    -1,   296,     9,   296,    -1,   285,     9,   296,    -1,
-     296,    -1,   286,   296,    -1,   288,   296,    24,    -1,   288,
-      28,    24,    -1,   288,    54,   296,    24,    -1,   289,    -1,
-      44,    -1,    35,    16,    -1,    86,    16,    -1,    85,    16,
-      -1,   121,    16,    -1,   161,    -1,   162,    -1,   291,    -1,
-     290,   314,    -1,   292,    -1,   163,    -1,   164,    -1,   165,
-      -1,   166,    -1,   315,    -1,   310,    -1,   309,    -1,    21,
-     309,    -1,    19,   309,    -1,   311,    -1,   317,    -1,    89,
-      -1,   294,    -1,    -1,     5,   295,   296,     5,    -1,   296,
-      32,   161,    -1,   296,    32,   162,    -1,   296,     7,   296,
-      -1,   296,     4,   296,    -1,   296,    11,   296,    -1,   296,
-      20,   296,    -1,    -1,   296,    79,   297,   296,    -1,    -1,
-     296,    66,   298,    16,   308,    24,    -1,   296,    18,   296,
-      -1,   296,    13,   296,    -1,   296,    15,   296,    -1,   296,
-      12,   296,    -1,   296,    21,   296,    -1,   296,    19,   296,
-      -1,   296,    28,   296,    -1,   296,    27,   296,    -1,     6,
-     296,    -1,    90,   296,    -1,    21,   296,    -1,    19,   296,
-      -1,    16,   296,    24,    -1,    -1,    16,    34,   299,   200,
-     210,    24,   267,    -1,    -1,    16,   189,   300,   190,   200,
-     210,   213,    24,   267,    -1,   287,    -1,   301,    -1,   315,
-     306,    -1,   310,    -1,   309,    -1,   311,    -1,   317,    -1,
-     290,    -1,   118,    16,   296,    24,    -1,    77,    16,   296,
-      24,    -1,    78,    16,   296,     9,   296,    24,    -1,    47,
-      16,   296,    24,    -1,    38,    16,   290,    24,    -1,   110,
-      16,   296,     9,   296,    24,    -1,    73,    16,   296,    24,
-      -1,    76,    16,   296,    24,    -1,    72,    16,   296,    24,
-      -1,    74,    16,   296,    24,    -1,   304,    -1,    -1,    71,
-     302,    16,   296,    24,    -1,    -1,    75,   303,    16,   296,
-      24,    -1,   102,    16,   296,     9,   296,    24,    -1,   102,
-      16,   296,     9,   296,     9,   296,    24,    -1,   315,   307,
-      -1,    -1,   307,    -1,    89,    -1,    16,   308,    24,    -1,
-     296,    -1,   308,     9,   296,    -1,   308,     9,     1,    -1,
-     308,     1,    -1,   151,    -1,   152,    -1,   153,    -1,   154,
-      -1,   154,   156,    -1,   154,     8,   315,    -1,   138,    -1,
-      57,    -1,   315,    -1,    28,    -1,    48,    -1,    22,    -1,
-      29,    -1,   313,   160,    -1,   313,   157,    -1,   313,   158,
-      -1,   313,     1,    -1,   160,    -1,   316,    -1,   157,    -1,
-     158,    -1,   159,    -1,    17,    25,    -1,   319,    -1,   318,
-     319,    -1,   320,    -1,   322,    -1,   324,    -1,   326,    -1,
-     328,    -1,   330,    -1,   331,    -1,   332,    -1,   333,    -1,
-      -1,    69,   335,   321,   252,   334,    -1,    -1,    69,    46,
-     335,   323,   252,    -1,    -1,    50,   336,   325,   252,   334,
-      -1,    -1,    50,    46,   336,   327,   252,    -1,    -1,    87,
-     337,   329,    50,   252,    69,   252,   334,    -1,    41,   337,
-      -1,    82,   207,    -1,    82,   207,   338,   430,   207,    -1,
-      42,   339,   431,   207,    -1,    55,   339,   431,   207,    -1,
-      -1,   200,   210,   213,    -1,    -1,   338,   430,   207,    -1,
-      -1,    59,   430,   207,    -1,    -1,   430,   207,    -1,    66,
-      -1,    70,    -1,    -1,   115,    -1,   342,    -1,    -1,   340,
-      10,   341,   342,    -1,   343,    -1,   356,    -1,   359,    -1,
-     344,    -1,   345,    -1,   346,    -1,   347,    -1,   348,    -1,
-     362,    -1,   363,    -1,    42,    71,    40,   429,   154,   421,
-     349,    -1,    42,    71,    40,   429,   140,   419,   349,    -1,
-      42,    81,    40,   429,   140,   419,   353,    -1,    55,   339,
-      71,    40,   429,    -1,    55,   339,    81,    40,   429,    -1,
-      83,    71,    40,   429,   119,    93,   429,    -1,    83,   429,
-     119,    93,   429,    -1,    -1,    97,    16,    24,    -1,    97,
-      16,   350,    24,    -1,   351,    -1,   350,     9,   351,    -1,
-      37,    -1,    51,    -1,   104,   352,    -1,   154,    -1,   352,
-     139,   154,    -1,    -1,    97,    16,    24,    -1,    97,    16,
-     354,    24,    -1,   355,    -1,   354,     9,   355,    -1,    47,
-     429,    -1,    77,   154,    -1,    77,   428,    -1,    37,    -1,
-      51,    -1,   104,   352,    -1,    -1,    -1,    42,   101,   117,
-     429,   357,   365,    14,   358,   375,    -1,    -1,    -1,    31,
-     101,   117,   429,   360,   365,    14,   361,   375,    -1,    55,
-     339,   101,   117,   429,    -1,    55,   339,   101,    84,   429,
-      -1,    55,   339,   101,    84,   431,   429,    -1,    55,   339,
-     429,    -1,    55,   339,   431,   429,    -1,    -1,    -1,   365,
-      59,   169,    32,   167,   366,   368,    -1,    -1,   365,    59,
-     167,    32,   167,   367,   368,    -1,   365,   413,    -1,    -1,
-     368,   369,    -1,   149,   370,    81,   427,   371,   372,    -1,
-      -1,   150,    -1,    -1,    93,    16,   418,    24,    -1,    -1,
-      97,    16,   373,    24,    -1,   374,    -1,   373,     9,   374,
-      -1,   167,    -1,   167,   154,    -1,    23,    -1,   376,    23,
-      -1,   376,    10,    23,    -1,   378,    -1,    -1,   376,    10,
-     377,   378,    -1,   382,    -1,   364,    -1,   363,    -1,    23,
-      -1,   380,    23,    -1,   380,    10,    23,    -1,   382,    -1,
-      -1,   380,    10,   381,   382,    -1,    -1,    42,   429,    32,
-     383,   385,    -1,    42,   429,   140,   117,   429,   414,    -1,
-      42,   431,   429,   140,   117,   429,   414,    -1,    -1,   390,
-     414,    14,   384,   379,    -1,   388,    -1,   387,    -1,    -1,
-     390,   414,    14,   386,   379,    -1,   409,   408,   400,    -1,
-      -1,   409,   389,   394,    -1,   391,    -1,   390,   391,    -1,
-      61,   410,    -1,   120,   410,    -1,    99,   410,    -1,    -1,
-      -1,    92,   410,   392,   406,   393,   407,    -1,   396,    -1,
-      -1,   394,    26,   395,   396,    -1,    -1,   408,   397,   398,
-      -1,     1,    -1,   400,   405,    -1,    -1,   398,     9,   399,
-     400,   405,    -1,    -1,    -1,    -1,    -1,   409,   401,   406,
-     402,   407,   403,   411,   404,   414,    -1,     1,    -1,    -1,
-      32,   429,    -1,    -1,    47,   315,    -1,    47,    71,    16,
-     154,    24,    -1,    47,   427,    -1,    -1,    77,   154,    -1,
-      77,   427,    -1,   410,    -1,    17,    25,    -1,    30,    -1,
-     410,    -1,    17,    25,    -1,   429,    -1,   309,    -1,   310,
-      -1,   429,    16,   417,    24,    -1,   427,    -1,    -1,   412,
-      -1,   413,    -1,   412,   413,    -1,   141,    16,   155,    -1,
-     141,   154,    -1,    -1,    97,    16,    24,    -1,    97,    16,
-     415,    24,    -1,   416,    -1,   415,     9,   416,    -1,   116,
-      56,    -1,    56,    -1,    98,   151,    -1,   140,   167,    -1,
-      -1,   418,    -1,   427,    -1,   418,     9,   427,    -1,   420,
-      -1,   419,     9,   420,    -1,    60,   169,   421,   104,   425,
-      -1,    16,   422,    24,    -1,    -1,   423,    -1,   424,    -1,
-     423,     9,   424,    -1,   426,   428,   425,    -1,   428,    -1,
-     428,    90,    91,    -1,    66,    -1,   428,    -1,   428,    -1,
-     168,    -1,   170,    -1,   167,    -1,   149,    -1,   150,    -1,
-     315,    -1,    71,    16,   154,    24,    -1,    -1,   431,    -1,
-      61,    -1,    61,    64,    39,    -1,   144,    -1,    10,   144,
-      -1
+     182,     0,    -1,   149,   184,   183,   150,    -1,   149,   184,
+     340,   150,    -1,   149,   150,    -1,   149,   184,   362,   454,
+      -1,     1,    -1,   193,    -1,   199,    -1,   201,    -1,   204,
+      -1,   185,   190,   191,    -1,    -1,   185,   186,    -1,    -1,
+      50,   187,   163,   188,    -1,   189,    -1,   188,     9,   189,
+      -1,   163,    -1,   166,    -1,   160,    -1,   157,    -1,   313,
+      -1,    -1,    36,   166,    -1,    36,     1,    -1,    -1,   191,
+     192,    -1,   104,   164,   166,    -1,   104,   164,    -1,   104,
+       1,    -1,    -1,   195,   194,   196,   206,   216,   231,    -1,
+     117,    -1,   117,   107,    -1,   117,    55,    -1,   117,    46,
+      -1,    -1,   197,   198,    -1,    28,    -1,   308,    -1,   307,
+      -1,    -1,    44,   200,   274,   206,   219,   231,   220,    -1,
+      -1,    54,   202,   203,   206,   215,   231,   220,    -1,    28,
+      -1,   303,    -1,    -1,    34,   205,   206,   219,    -1,    -1,
+     206,   207,    -1,   208,   337,   209,    -1,    61,    -1,    61,
+      91,    -1,    93,    61,    -1,    93,    61,    91,    -1,    94,
+      -1,    94,    91,    -1,    -1,    -1,   101,    16,   210,   211,
+      -1,    24,    -1,   212,    24,    -1,   163,   213,    -1,   212,
+       9,   163,   213,    -1,    -1,   214,   318,    -1,    -1,   219,
+      -1,    -1,   146,    14,   217,   249,    23,   220,    -1,    -1,
+      14,   218,   249,    23,    -1,   216,   220,    -1,    -1,   221,
+      -1,    -1,    -1,    38,   222,   224,    14,   223,   226,    23,
+      -1,   225,    -1,   224,   225,    -1,   167,    -1,   168,    -1,
+     313,    -1,    -1,   227,    -1,   228,    -1,   227,   228,    -1,
+      16,   229,    24,    -1,   230,    -1,   229,   230,    -1,   337,
+      -1,   331,    -1,   332,    -1,   333,    -1,   339,    -1,   143,
+      -1,   232,   236,   238,    -1,   232,   236,   238,   244,   245,
+      -1,   232,   236,   238,   246,   243,    -1,    -1,    -1,    64,
+      40,   233,   234,    -1,   235,    -1,   234,   235,    -1,    16,
+     318,    24,    -1,    17,   318,    25,    -1,   323,    -1,   327,
+      -1,   312,    -1,    -1,    -1,    65,   237,   318,    -1,    -1,
+      -1,   102,    40,   239,   240,    -1,   241,    -1,   240,   241,
+      -1,   242,    16,   318,    24,    -1,   242,    17,   318,    25,
+      -1,   242,   157,    -1,   323,    -1,   327,    -1,   312,    -1,
+      -1,    33,    -1,    53,    -1,    -1,   244,    -1,    82,   213,
+      -1,    -1,   246,    -1,    99,   213,    -1,   249,    23,   289,
+      -1,    -1,   195,   248,   196,   206,   216,   231,    23,   289,
+      -1,   278,    -1,   278,   250,   249,    -1,   278,   250,    10,
+     249,    -1,   253,    -1,   251,    -1,   260,    -1,   257,    -1,
+     267,    -1,   263,    -1,    -1,   100,    14,   252,   247,    -1,
+     100,     1,    -1,    -1,    -1,    -1,   105,    86,   254,   334,
+     255,    14,   256,   247,    -1,    -1,    -1,    63,   306,   258,
+      14,   259,   247,    -1,    -1,    14,   261,   247,    -1,    -1,
+     260,   144,    14,   262,   247,    -1,    60,    16,   318,    24,
+      -1,    60,   323,    -1,    60,   327,    -1,    60,   264,   265,
+      -1,    89,   265,    -1,    58,    -1,    93,    58,    -1,    -1,
+     266,   206,   219,   289,    -1,    -1,    -1,    -1,   118,   451,
+     268,   271,   269,   206,    14,   270,   247,    -1,    -1,    16,
+     272,    24,    -1,   273,    -1,   272,   273,    -1,   163,   188,
+      -1,    50,   163,   188,    -1,    68,   293,    -1,    68,    28,
+      -1,    -1,    14,   275,   276,    23,    -1,    -1,   277,    -1,
+     277,    10,    -1,   280,    -1,   277,    10,   280,    -1,    -1,
+     279,    -1,   280,    -1,   280,    10,   278,    -1,    -1,   302,
+     281,   284,    -1,    -1,   296,   282,   283,    -1,    -1,   284,
+      -1,   284,    26,    -1,   284,    26,    10,    -1,    -1,   295,
+     285,   287,    -1,    -1,   284,    26,   295,   286,   287,    -1,
+     284,    26,    10,    -1,   284,    26,     1,    -1,     1,    -1,
+     288,    -1,   287,     9,   288,    -1,   287,     9,    26,    -1,
+     287,     9,    10,    -1,   287,     9,     1,    -1,     1,    -1,
+     301,   289,    -1,    -1,    -1,   101,    16,   290,   291,    24,
+      -1,   292,    -1,   291,     9,   292,    -1,    67,    -1,    70,
+     173,    -1,    70,   163,    -1,    70,   166,    -1,    70,   160,
+      -1,    98,   312,    -1,   115,   312,    -1,   116,   318,    -1,
+     126,   160,    -1,   127,    -1,   128,   157,    -1,   129,    -1,
+     130,   157,    -1,   131,    -1,   132,   312,    -1,   133,    16,
+     293,    24,    -1,   135,   318,    -1,   134,   318,    -1,   137,
+      -1,   138,    -1,   136,    16,   293,    24,    -1,   139,    -1,
+     140,    16,   312,    24,    32,   312,    -1,   140,    16,   160,
+      24,    32,   312,    -1,   141,    -1,   294,    16,   330,    24,
+      -1,   294,    -1,   312,    -1,   293,     9,   312,    -1,   109,
+      -1,   110,    -1,   111,    -1,   112,    -1,   113,    -1,   305,
+      -1,    30,    -1,     1,    -1,    -1,    17,   297,   284,   299,
+      -1,    -1,    16,   298,   300,    24,    -1,    16,    24,    -1,
+      25,    -1,    26,    25,    -1,   301,    -1,   300,   301,    -1,
+     302,    -1,   296,    -1,   312,    -1,   315,    -1,   304,    -1,
+     303,   304,    -1,   312,    -1,   337,    -1,   316,    -1,    16,
+     318,    24,    -1,   312,    -1,   337,    -1,   316,    -1,   312,
+      -1,   339,    -1,   337,    -1,   316,    -1,   318,     9,   318,
+      -1,   307,     9,   318,    -1,   318,    -1,   308,   318,    -1,
+     310,   318,    24,    -1,   310,    28,    24,    -1,   310,    55,
+     318,    24,    -1,   311,    -1,    45,    -1,    35,    16,    -1,
+      88,    16,    -1,    87,    16,    -1,   125,    16,    -1,   167,
+      -1,   168,    -1,   313,    -1,   312,   336,    -1,   314,    -1,
+     169,    -1,   170,    -1,   171,    -1,   172,    -1,   337,    -1,
+     332,    -1,   331,    -1,    21,   331,    -1,    19,   331,    -1,
+     333,    -1,   339,    -1,    92,    -1,   316,    -1,    -1,     5,
+     317,   318,     5,    -1,   318,    32,   167,    -1,   318,    32,
+     168,    -1,   318,     7,   318,    -1,   318,     4,   318,    -1,
+     318,    11,   318,    -1,   318,    20,   318,    -1,    -1,   318,
+      81,   319,   318,    -1,    -1,   318,    68,   320,    16,   330,
+      24,    -1,   318,    18,   318,    -1,   318,    13,   318,    -1,
+     318,    15,   318,    -1,   318,    12,   318,    -1,   318,    21,
+     318,    -1,   318,    19,   318,    -1,   318,    28,   318,    -1,
+     318,    27,   318,    -1,     6,   318,    -1,    93,   318,    -1,
+      21,   318,    -1,    19,   318,    -1,    16,   318,    24,    -1,
+      -1,    16,    34,   321,   206,   219,    24,   289,    -1,    -1,
+      16,   195,   322,   196,   206,   216,   231,    24,   289,    -1,
+     309,    -1,   323,    -1,   337,   328,    -1,   332,    -1,   331,
+      -1,   333,    -1,   339,    -1,   312,    -1,   122,    16,   318,
+      24,    -1,    79,    16,   318,    24,    -1,    80,    16,   318,
+       9,   318,    24,    -1,    48,    16,   318,    24,    -1,    39,
+      16,   312,    24,    -1,   114,    16,   318,     9,   318,    24,
+      -1,    75,    16,   318,    24,    -1,    78,    16,   318,    24,
+      -1,    74,    16,   318,    24,    -1,    76,    16,   318,    24,
+      -1,   326,    -1,    -1,    73,   324,    16,   318,    24,    -1,
+      -1,    77,   325,    16,   318,    24,    -1,   106,    16,   318,
+       9,   318,    24,    -1,   106,    16,   318,     9,   318,     9,
+     318,    24,    -1,   337,   329,    -1,    -1,   329,    -1,    92,
+      -1,    16,    24,    -1,    16,   330,    24,    -1,   318,    -1,
+     330,     9,   318,    -1,   330,     9,     1,    -1,   330,     1,
+      -1,   157,    -1,   158,    -1,   159,    -1,   160,    -1,   160,
+     162,    -1,   160,     8,   337,    -1,   142,    -1,    59,    -1,
+     337,    -1,    28,    -1,    49,    -1,    22,    -1,    29,    -1,
+     335,   166,    -1,   335,   163,    -1,   335,   164,    -1,   335,
+       1,    -1,   166,    -1,   338,    -1,   163,    -1,   164,    -1,
+     165,    -1,    17,    25,    -1,   341,    -1,   340,   341,    -1,
+     342,    -1,   344,    -1,   346,    -1,   348,    -1,   350,    -1,
+     352,    -1,   353,    -1,   354,    -1,   355,    -1,    -1,    71,
+     357,   343,   274,   356,    -1,    -1,    71,    47,   357,   345,
+     274,    -1,    -1,    51,   358,   347,   274,   356,    -1,    -1,
+      51,    47,   358,   349,   274,    -1,    -1,    90,   359,   351,
+      51,   274,    71,   274,   356,    -1,    42,   359,    -1,    84,
+     213,    -1,    84,   213,   360,   452,   213,    -1,    43,   361,
+     453,   213,    -1,    56,   361,   453,   213,    -1,    -1,   206,
+     219,   231,   220,    -1,    -1,   360,   452,   213,    -1,    -1,
+      61,   452,   213,    -1,    -1,   452,   213,    -1,    68,    -1,
+      72,    -1,    -1,   119,    -1,   364,    -1,    -1,   362,    10,
+     363,   364,    -1,   365,    -1,   378,    -1,   381,    -1,   366,
+      -1,   367,    -1,   368,    -1,   369,    -1,   370,    -1,   384,
+      -1,   385,    -1,    43,    73,    41,   451,   160,   443,   371,
+      -1,    43,    73,    41,   451,   145,   441,   371,    -1,    43,
+      83,    41,   451,   145,   441,   375,    -1,    56,   361,    73,
+      41,   451,    -1,    56,   361,    83,    41,   451,    -1,    85,
+      73,    41,   451,   123,    97,   451,    -1,    85,   451,   123,
+      97,   451,    -1,    -1,   101,    16,    24,    -1,   101,    16,
+     372,    24,    -1,   373,    -1,   372,     9,   373,    -1,    37,
+      -1,    52,    -1,   108,   374,    -1,   160,    -1,   374,   144,
+     160,    -1,    -1,   101,    16,    24,    -1,   101,    16,   376,
+      24,    -1,   377,    -1,   376,     9,   377,    -1,    48,   451,
+      -1,    79,   160,    -1,    79,   450,    -1,    37,    -1,    52,
+      -1,   108,   374,    -1,    -1,    -1,    43,   105,   121,   451,
+     379,   387,    14,   380,   397,    -1,    -1,    -1,    31,   105,
+     121,   451,   382,   387,    14,   383,   397,    -1,    56,   361,
+     105,   121,   451,    -1,    56,   361,   105,    86,   451,    -1,
+      56,   361,   105,    86,   453,   451,    -1,    56,   361,   451,
+      -1,    56,   361,   453,   451,    -1,    -1,    -1,   387,    61,
+     175,    32,   173,   388,   390,    -1,    -1,   387,    61,   173,
+      32,   173,   389,   390,    -1,   387,   435,    -1,    -1,   390,
+     391,    -1,   155,   392,    83,   449,   393,   394,    -1,    -1,
+     156,    -1,    -1,    97,    16,   440,    24,    -1,    -1,   101,
+      16,   395,    24,    -1,   396,    -1,   395,     9,   396,    -1,
+     173,    -1,   173,   160,    -1,    23,    -1,   398,    23,    -1,
+     398,    10,    23,    -1,   400,    -1,    -1,   398,    10,   399,
+     400,    -1,   404,    -1,   386,    -1,   385,    -1,    23,    -1,
+     402,    23,    -1,   402,    10,    23,    -1,   404,    -1,    -1,
+     402,    10,   403,   404,    -1,    -1,    43,   451,    32,   405,
+     407,    -1,    43,   451,   145,   121,   451,   436,    -1,    43,
+     453,   451,   145,   121,   451,   436,    -1,    -1,   412,   436,
+      14,   406,   401,    -1,   410,    -1,   409,    -1,    -1,   412,
+     436,    14,   408,   401,    -1,   431,   430,   422,    -1,    -1,
+     431,   411,   416,    -1,   413,    -1,   412,   413,    -1,    63,
+     432,    -1,   124,   432,    -1,   103,   432,    -1,    -1,    -1,
+      96,   432,   414,   428,   415,   429,    -1,   418,    -1,    -1,
+     416,    26,   417,   418,    -1,    -1,   430,   419,   420,    -1,
+       1,    -1,   422,   427,    -1,    -1,   420,     9,   421,   422,
+     427,    -1,    -1,    -1,    -1,    -1,   431,   423,   428,   424,
+     429,   425,   433,   426,   436,    -1,     1,    -1,    -1,    32,
+     451,    -1,    -1,    48,   337,    -1,    48,    73,    16,   160,
+      24,    -1,    48,   449,    -1,    -1,    79,   160,    -1,    79,
+     449,    -1,   432,    -1,    17,    25,    -1,    30,    -1,   432,
+      -1,    17,    25,    -1,   451,    -1,   331,    -1,   332,    -1,
+     451,    16,   439,    24,    -1,   449,    -1,    -1,   434,    -1,
+     435,    -1,   434,   435,    -1,   146,    16,   161,    -1,   146,
+     160,    -1,    -1,   101,    16,    24,    -1,   101,    16,   437,
+      24,    -1,   438,    -1,   437,     9,   438,    -1,   120,    57,
+      -1,    57,    -1,   102,   157,    -1,   145,   173,    -1,    -1,
+     440,    -1,   449,    -1,   440,     9,   449,    -1,   442,    -1,
+     441,     9,   442,    -1,    62,   175,   443,   108,   447,    -1,
+      16,   444,    24,    -1,    -1,   445,    -1,   446,    -1,   445,
+       9,   446,    -1,   448,   450,   447,    -1,   450,    -1,   450,
+      93,    95,    -1,    68,    -1,   450,    -1,   450,    -1,   174,
+      -1,   176,    -1,   173,    -1,   155,    -1,   156,    -1,   337,
+      -1,    73,    16,   160,    24,    -1,    -1,   453,    -1,    63,
+      -1,    63,    66,    40,    -1,   150,    -1,    10,   150,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   502,   502,   508,   511,   514,   517,   523,   524,   525,
-     526,   530,   534,   535,   539,   539,   549,   550,   554,   555,
-     556,   557,   558,   562,   563,   567,   571,   572,   576,   581,
-     582,   587,   587,   603,   604,   605,   606,   610,   610,   615,
-     617,   618,   624,   624,   642,   642,   658,   659,   663,   663,
-     674,   675,   683,   688,   689,   690,   691,   695,   696,   696,
-     701,   702,   706,   708,   713,   713,   719,   722,   726,   726,
-     730,   730,   738,   739,   740,   744,   745,   745,   754,   755,
-     760,   761,   762,   763,   764,   768,   769,   769,   778,   779,
-     779,   788,   789,   794,   795,   796,   797,   798,   799,   803,
-     804,   805,   809,   810,   814,   818,   819,   823,   827,   830,
-     830,   855,   856,   857,   861,   862,   863,   864,   865,   866,
-     870,   870,   871,   875,   876,   877,   875,   884,   885,   883,
-     892,   892,   893,   893,   904,   905,   906,   910,   913,   917,
-     910,   939,   940,   944,   945,   946,   947,   948,   949,   953,
-     953,   958,   959,   960,   964,   965,   969,   970,   974,   975,
-     979,   979,   981,   981,   986,   987,   988,   992,   992,   995,
-     994,   997,   998,  1002,  1003,  1004,  1005,  1009,  1014,  1015,
-    1015,  1020,  1021,  1025,  1026,  1031,  1033,  1034,  1035,  1036,
-    1037,  1038,  1039,  1040,  1041,  1042,  1043,  1044,  1045,  1046,
-    1047,  1048,  1049,  1050,  1051,  1052,  1053,  1054,  1055,  1056,
-    1060,  1061,  1065,  1066,  1067,  1068,  1069,  1073,  1074,  1078,
-    1078,  1083,  1083,  1095,  1099,  1100,  1104,  1108,  1121,  1122,
-    1126,  1127,  1131,  1132,  1136,  1137,  1138,  1139,  1143,  1144,
-    1145,  1149,  1150,  1151,  1152,  1156,  1157,  1161,  1162,  1166,
-    1167,  1168,  1172,  1176,  1177,  1178,  1179,  1180,  1184,  1185,
-    1186,  1187,  1191,  1196,  1197,  1198,  1199,  1204,  1205,  1206,
-    1207,  1208,  1209,  1210,  1211,  1212,  1216,  1216,  1236,  1237,
-    1238,  1240,  1243,  1247,  1248,  1248,  1251,  1251,  1265,  1266,
-    1267,  1268,  1269,  1273,  1277,  1279,  1280,  1282,  1284,  1287,
-    1310,  1313,  1313,  1329,  1329,  1352,  1358,  1359,  1369,  1370,
-    1371,  1372,  1373,  1377,  1379,  1381,  1383,  1385,  1387,  1389,
-    1391,  1393,  1395,  1397,  1399,  1398,  1403,  1402,  1409,  1411,
-    1416,  1424,  1425,  1429,  1430,  1434,  1435,  1436,  1437,  1441,
-    1442,  1443,  1447,  1448,  1449,  1453,  1454,  1458,  1459,  1460,
-    1464,  1465,  1469,  1473,  1477,  1481,  1485,  1486,  1490,  1491,
-    1495,  1496,  1502,  1503,  1510,  1511,  1512,  1513,  1514,  1515,
-    1516,  1517,  1518,  1524,  1524,  1536,  1536,  1551,  1551,  1563,
-    1563,  1579,  1579,  1590,  1595,  1597,  1602,  1607,  1612,  1613,
-    1620,  1621,  1625,  1626,  1630,  1631,  1635,  1636,  1640,  1641,
-    1647,  1648,  1648,  1654,  1655,  1656,  1662,  1663,  1664,  1665,
-    1666,  1667,  1668,  1674,  1682,  1694,  1705,  1715,  1725,  1729,
-    1736,  1737,  1738,  1742,  1746,  1753,  1755,  1757,  1763,  1764,
-    1768,  1769,  1770,  1774,  1778,  1785,  1787,  1789,  1791,  1793,
-    1795,  1801,  1815,  1801,  1826,  1833,  1826,  1844,  1855,  1861,
-    1870,  1876,  1885,  1886,  1886,  1891,  1891,  1896,  1901,  1902,
-    1906,  1913,  1914,  1918,  1919,  1923,  1924,  1928,  1932,  1939,
-    1940,  1944,  1945,  1946,  1950,  1951,  1951,  1958,  1959,  1961,
-    1966,  1967,  1968,  1972,  1973,  1973,  1981,  1980,  1983,  1990,
-    1998,  1997,  2007,  2011,  2013,  2012,  2027,  2041,  2041,  2046,
-    2047,  2051,  2052,  2053,  2054,  2055,  2054,  2063,  2064,  2064,
-    2070,  2070,  2075,  2079,  2082,  2082,  2090,  2094,  2096,  2098,
-    2090,  2101,  2105,  2106,  2110,  2111,  2112,  2113,  2117,  2118,
-    2119,  2123,  2124,  2125,  2129,  2130,  2134,  2135,  2136,  2137,
-    2140,  2145,  2146,  2150,  2151,  2155,  2156,  2160,  2161,  2162,
-    2166,  2170,  2177,  2178,  2179,  2180,  2184,  2185,  2189,  2190,
-    2194,  2195,  2199,  2205,  2209,  2210,  2214,  2215,  2219,  2225,
-    2226,  2230,  2231,  2235,  2236,  2237,  2241,  2242,  2243,  2248,
-    2249,  2254,  2255,  2259,  2260,  2264,  2265
+       0,   520,   520,   526,   529,   532,   535,   541,   542,   543,
+     544,   548,   552,   553,   557,   557,   567,   568,   572,   573,
+     574,   575,   576,   580,   581,   585,   589,   590,   594,   599,
+     600,   605,   605,   621,   622,   623,   624,   628,   628,   633,
+     635,   636,   642,   642,   660,   660,   676,   677,   681,   681,
+     692,   693,   701,   706,   707,   708,   709,   710,   711,   715,
+     716,   716,   721,   722,   726,   728,   733,   733,   739,   742,
+     746,   746,   750,   750,   757,   761,   762,   766,   770,   766,
+     782,   783,   787,   788,   789,   793,   794,   798,   799,   803,
+     810,   811,   815,   816,   817,   818,   819,   820,   825,   826,
+     827,   831,   832,   832,   841,   842,   847,   848,   849,   850,
+     851,   855,   856,   856,   865,   866,   866,   875,   876,   881,
+     882,   883,   884,   885,   886,   890,   891,   892,   896,   897,
+     901,   905,   906,   910,   914,   917,   917,   945,   946,   947,
+     951,   952,   953,   954,   955,   956,   960,   960,   961,   965,
+     966,   967,   965,   974,   975,   973,   982,   982,   983,   983,
+     994,   995,   996,   997,  1002,  1008,  1009,  1013,  1013,  1034,
+    1039,  1043,  1034,  1062,  1063,  1067,  1068,  1072,  1073,  1083,
+    1084,  1088,  1088,  1093,  1094,  1095,  1099,  1100,  1104,  1105,
+    1109,  1110,  1114,  1114,  1116,  1116,  1121,  1122,  1123,  1124,
+    1128,  1128,  1131,  1130,  1133,  1134,  1135,  1139,  1140,  1141,
+    1142,  1143,  1144,  1148,  1153,  1154,  1154,  1162,  1163,  1167,
+    1168,  1173,  1175,  1176,  1177,  1178,  1179,  1180,  1181,  1182,
+    1183,  1184,  1185,  1186,  1187,  1188,  1189,  1190,  1191,  1192,
+    1193,  1194,  1195,  1196,  1197,  1198,  1202,  1203,  1207,  1208,
+    1209,  1210,  1211,  1215,  1216,  1217,  1221,  1221,  1226,  1226,
+    1238,  1242,  1243,  1247,  1251,  1264,  1265,  1269,  1270,  1274,
+    1275,  1279,  1280,  1281,  1282,  1286,  1287,  1288,  1292,  1293,
+    1294,  1295,  1299,  1300,  1304,  1305,  1309,  1310,  1311,  1315,
+    1319,  1320,  1321,  1322,  1323,  1327,  1328,  1329,  1330,  1334,
+    1339,  1340,  1341,  1342,  1347,  1348,  1349,  1350,  1351,  1352,
+    1353,  1354,  1355,  1359,  1359,  1379,  1380,  1381,  1383,  1386,
+    1390,  1391,  1391,  1394,  1394,  1408,  1409,  1410,  1411,  1412,
+    1416,  1420,  1422,  1423,  1425,  1427,  1430,  1453,  1456,  1456,
+    1474,  1474,  1499,  1505,  1506,  1516,  1517,  1518,  1519,  1520,
+    1524,  1526,  1528,  1530,  1532,  1534,  1536,  1538,  1540,  1542,
+    1544,  1546,  1545,  1550,  1549,  1556,  1558,  1563,  1571,  1572,
+    1576,  1577,  1578,  1582,  1583,  1584,  1585,  1589,  1590,  1591,
+    1595,  1596,  1597,  1601,  1602,  1606,  1607,  1608,  1612,  1613,
+    1617,  1621,  1625,  1629,  1633,  1634,  1638,  1639,  1643,  1644,
+    1650,  1651,  1658,  1659,  1660,  1661,  1662,  1663,  1664,  1665,
+    1666,  1672,  1672,  1684,  1684,  1699,  1699,  1711,  1711,  1727,
+    1727,  1738,  1743,  1745,  1750,  1755,  1760,  1761,  1768,  1769,
+    1773,  1774,  1778,  1779,  1783,  1784,  1788,  1789,  1795,  1796,
+    1796,  1802,  1803,  1804,  1810,  1811,  1812,  1813,  1814,  1815,
+    1816,  1822,  1830,  1842,  1853,  1863,  1873,  1877,  1884,  1885,
+    1886,  1890,  1894,  1901,  1903,  1905,  1911,  1912,  1916,  1917,
+    1918,  1922,  1926,  1933,  1935,  1937,  1939,  1941,  1943,  1949,
+    1963,  1949,  1974,  1981,  1974,  1992,  2003,  2009,  2018,  2024,
+    2033,  2034,  2034,  2039,  2039,  2044,  2049,  2050,  2054,  2061,
+    2062,  2066,  2067,  2071,  2072,  2076,  2080,  2087,  2088,  2092,
+    2093,  2094,  2098,  2099,  2099,  2106,  2107,  2109,  2114,  2115,
+    2116,  2120,  2121,  2121,  2129,  2128,  2131,  2138,  2146,  2145,
+    2155,  2159,  2161,  2160,  2175,  2189,  2189,  2194,  2195,  2199,
+    2200,  2201,  2202,  2203,  2202,  2211,  2212,  2212,  2218,  2218,
+    2223,  2227,  2230,  2230,  2238,  2242,  2244,  2246,  2238,  2249,
+    2253,  2254,  2258,  2259,  2260,  2261,  2265,  2266,  2267,  2271,
+    2272,  2273,  2277,  2278,  2282,  2283,  2284,  2285,  2288,  2293,
+    2294,  2298,  2299,  2303,  2304,  2308,  2309,  2310,  2314,  2318,
+    2325,  2326,  2327,  2328,  2332,  2333,  2337,  2338,  2342,  2343,
+    2347,  2353,  2357,  2358,  2362,  2363,  2367,  2373,  2374,  2378,
+    2379,  2383,  2384,  2385,  2389,  2390,  2391,  2396,  2397,  2402,
+    2403,  2407,  2408,  2412,  2413
 };
 #endif
 
@@ -1145,32 +1175,33 @@ static const char *const yytname[] =
   "_EQ", "_GE", "_GT", "_LBRA", "_LE", "_LPAR", "_LSQBRA", "_LT", "_MINUS",
   "_NOT_EQ", "_PLUS", "_PLUS_GT", "_RBRA", "_RPAR", "_RSQBRA", "_SEMI",
   "_SLASH", "_STAR", "_STAR_GT", "a_L", "ALTER_L", "AS_L", "ASC_L",
-  "ASK_L", "AVG_L", "BASE_L", "BIJECTION_L", "BOUND_L", "BY_L", "CLASS_L",
-  "CLEAR_L", "CREATE_L", "CONSTRUCT_L", "COUNT_LPAR", "COUNT_DISTINCT_L",
-  "DATA_L", "DATATYPE_L", "DEFAULT_L", "DEFINE_L", "DELETE_L", "DEREF_L",
-  "DESC_L", "DESCRIBE_L", "DISTINCT_L", "DROP_L", "EXCLUSIVE_L", "false_L",
-  "FILTER_L", "FROM_L", "FUNCTION_L", "GRAPH_L", "GROUP_L", "HAVING_L",
-  "IDENTIFIED_L", "IFP_L", "IN_L", "INDEX_L", "INFERENCE_L", "INSERT_L",
-  "INTO_L", "IRI_L", "isBLANK_L", "isIRI_L", "isLITERAL_L", "isREF_L",
-  "isURI_L", "LANG_L", "LANGMATCHES_L", "LIKE_L", "LIMIT_L", "LITERAL_L",
-  "LOAD_L", "MAKE_L", "MAP_L", "MAX_L", "MIN_L", "MODIFY_L", "NAMED_L",
-  "NIL_L", "NOT_L", "NULL_L", "OBJECT_L", "OF_L", "OFFBAND_L", "OFFSET_L",
-  "OPTIONAL_L", "OPTION_L", "ORDER_L", "PREDICATE_L", "PREFIX_L", "QUAD_L",
-  "REGEX_L", "REDUCED_L", "RETURNS_L", "SAME_AS_L", "SAME_AS_O_L",
-  "SAME_AS_P_L", "SAME_AS_S_L", "SAME_AS_S_O_L", "SAMETERM_L", "SCORE_L",
-  "SCORE_LIMIT_L", "SELECT_L", "SERVICE_L", "SILENT_L", "SOFT_L",
-  "STORAGE_L", "STR_L", "SUBCLASS_L", "SUBJECT_L", "SUM_L",
-  "TABLE_OPTION_L", "T_CYCLES_ONLY_L", "T_DIRECTION_L", "T_DISTINCT_L",
-  "T_END_FLAG_L", "T_EXISTS_L", "T_FINAL_AS_L", "T_IN_L", "T_MAX_L",
-  "T_MIN_L", "T_OUT_L", "T_NO_CYCLES_L", "T_NO_ORDER_L",
-  "T_SHORTEST_ONLY_L", "T_STEP_L", "TRANSITIVE_L", "true_L", "UNION_L",
-  "USING_L", "WHERE_L", "__SPAR_PUNCT_END", "START_OF_SPARQL_TEXT",
-  "END_OF_SPARQL_TEXT", "SPARUL_RUN_SUBTYPE", "SPARUL_INSERT_DATA",
-  "SPARUL_DELETE_DATA", "__SPAR_NONPUNCT_START", "TEXT_BL", "XML_BL",
-  "SPARQL_INTEGER", "SPARQL_DECIMAL", "SPARQL_DOUBLE", "SPARQL_STRING",
-  "SPARQL_CONDITION_AFTER_WHERE_LPAR", "LANGTAG", "QNAME", "QNAME_NS",
-  "BLANK_NODE_LABEL", "Q_IRI_REF", "QUEST_VARNAME", "DOLLAR_VARNAME",
-  "QUEST_COLON_PARAMNAME", "DOLLAR_COLON_PARAMNAME",
+  "ASK_L", "AVG_L", "BASE_L", "BIJECTION_L", "BINDINGS_L", "BOUND_L",
+  "BY_L", "CLASS_L", "CLEAR_L", "CREATE_L", "CONSTRUCT_L", "COUNT_LPAR",
+  "COUNT_DISTINCT_L", "DATA_L", "DATATYPE_L", "DEFAULT_L", "DEFINE_L",
+  "DELETE_L", "DEREF_L", "DESC_L", "DESCRIBE_L", "DISTINCT_L", "DROP_L",
+  "EXCLUSIVE_L", "EXISTS_L", "false_L", "FILTER_L", "FROM_L", "FUNCTION_L",
+  "GRAPH_L", "GROUP_L", "HAVING_L", "IDENTIFIED_L", "IFP_L", "IN_L",
+  "INDEX_L", "INFERENCE_L", "INSERT_L", "INTO_L", "IRI_L", "isBLANK_L",
+  "isIRI_L", "isLITERAL_L", "isREF_L", "isURI_L", "LANG_L",
+  "LANGMATCHES_L", "LIKE_L", "LIMIT_L", "LITERAL_L", "LOAD_L", "MAKE_L",
+  "MAP_L", "MAX_L", "MIN_L", "MINUS_L", "MODIFY_L", "NAMED_L", "NIL_L",
+  "NOT_L", "NOT_FROM_L", "NULL_L", "OBJECT_L", "OF_L", "OFFBAND_L",
+  "OFFSET_L", "OPTIONAL_L", "OPTION_L", "ORDER_L", "PREDICATE_L",
+  "PREFIX_L", "QUAD_L", "REGEX_L", "REDUCED_L", "RETURNS_L", "SAME_AS_L",
+  "SAME_AS_O_L", "SAME_AS_P_L", "SAME_AS_S_L", "SAME_AS_S_O_L",
+  "SAMETERM_L", "SCORE_L", "SCORE_LIMIT_L", "SELECT_L", "SERVICE_L",
+  "SILENT_L", "SOFT_L", "STORAGE_L", "STR_L", "SUBCLASS_L", "SUBJECT_L",
+  "SUM_L", "TABLE_OPTION_L", "T_CYCLES_ONLY_L", "T_DIRECTION_L",
+  "T_DISTINCT_L", "T_END_FLAG_L", "T_EXISTS_L", "T_FINAL_AS_L", "T_IN_L",
+  "T_MAX_L", "T_MIN_L", "T_OUT_L", "T_NO_CYCLES_L", "T_NO_ORDER_L",
+  "T_SHORTEST_ONLY_L", "T_STEP_L", "TRANSITIVE_L", "true_L", "UNBOUND_L",
+  "UNION_L", "USING_L", "WHERE_L", "WITH_L", "__SPAR_PUNCT_END",
+  "START_OF_SPARQL_TEXT", "END_OF_SPARQL_TEXT", "SPARUL_RUN_SUBTYPE",
+  "SPARUL_INSERT_DATA", "SPARUL_DELETE_DATA", "__SPAR_NONPUNCT_START",
+  "TEXT_BL", "XML_BL", "SPARQL_INTEGER", "SPARQL_DECIMAL", "SPARQL_DOUBLE",
+  "SPARQL_STRING", "SPARQL_CONDITION_AFTER_WHERE_LPAR", "LANGTAG", "QNAME",
+  "QNAME_NS", "BLANK_NODE_LABEL", "Q_IRI_REF", "QUEST_VARNAME",
+  "DOLLAR_VARNAME", "QUEST_COLON_PARAMNAME", "DOLLAR_COLON_PARAMNAME",
   "QUEST_COLON_PARAMNUM", "DOLLAR_COLON_PARAMNUM", "SPARQL_PLAIN_ID",
   "SPARQL_SQL_ALIASCOLNAME", "SPARQL_SQL_QTABLENAME",
   "SPARQL_SQL_QTABLECOLNAME", "__SPAR_NONPUNCT_END", "_COLON", "UMINUS",
@@ -1184,45 +1215,51 @@ static const char *const yytname[] =
   "spar_dataset_clause", "spar_dataset_clause_subtype",
   "spar_sponge_optionlist_opt", "$@7",
   "spar_sponge_option_commalist_opt_rpar", "spar_sponge_option_commalist",
-  "spar_precode_expn", "$@8", "spar_where_clause_opt", "spar_where_clause",
-  "$@9", "$@10", "spar_solution_modifier", "spar_group_clause_opt", "$@11",
-  "spar_group_expns", "spar_group_expn", "spar_having_clause_opt", "$@12",
-  "spar_order_clause_opt", "$@13", "spar_order_conditions",
+  "spar_precode_expn", "$@8", "spar_wherebindings_clause_opt",
+  "spar_where_clause", "$@9", "$@10", "spar_wherebindings_clause",
+  "spar_bindings_clause_opt", "spar_bindings_clause", "$@11", "$@12",
+  "spar_bindings_vars", "spar_bindings_var", "spar_bindings_opt",
+  "spar_bindings", "spar_binding", "spar_bindvals", "spar_bindval",
+  "spar_solution_modifier", "spar_group_clause_opt", "$@13",
+  "spar_group_expns", "spar_group_expn", "spar_having_clause_opt", "$@14",
+  "spar_order_clause_opt", "$@15", "spar_order_conditions",
   "spar_order_condition", "spar_asc_or_desc_opt", "spar_limit_clause_opt",
   "spar_limit_clause", "spar_offset_clause_opt", "spar_offset_clause",
-  "spar_group_gp", "$@14", "spar_gp", "spar_gp_not_triples",
-  "spar_optional_gp", "$@15", "spar_quad_map_gp", "$@16", "$@17", "$@18",
-  "spar_graph_gp", "$@19", "$@20", "spar_group_or_union_gp", "$@21",
-  "$@22", "spar_constraint", "spar_service_req", "@23", "@24", "$@25",
-  "spar_service_options_list_opt", "spar_service_options",
-  "spar_ctor_template", "$@26", "spar_ctor_triples_opt",
-  "spar_ctor_triples", "spar_triples_opt", "spar_triples", "spar_triples1",
-  "$@27", "$@28", "spar_props_opt", "spar_props", "$@29", "$@30",
-  "spar_objects", "spar_ograph_node", "spar_triple_optionlist_opt", "$@31",
-  "spar_triple_option_commalist", "spar_triple_option",
-  "spar_triple_option_var_commalist", "spar_same_as_option", "spar_verb",
-  "spar_triples_node", "$@32", "$@33", "spar_triples_opt_semi_rsqbra",
-  "spar_cons_collection", "spar_graph_node", "spar_var_or_term",
+  "spar_group_gp", "$@16", "spar_gp", "spar_gp_not_triples",
+  "spar_optional_gp", "$@17", "spar_quad_map_gp", "$@18", "$@19", "$@20",
+  "spar_graph_gp", "$@21", "$@22", "spar_group_or_union_gp", "$@23",
+  "$@24", "spar_constraint", "spar_exists_or_not_exists",
+  "spar_constraint_exists_int", "$@25", "spar_service_req", "@26", "@27",
+  "$@28", "spar_service_options_list_opt", "spar_service_options",
+  "spar_service_option", "spar_ctor_template", "$@29",
+  "spar_ctor_triples_opt", "spar_ctor_triples", "spar_triples_opt",
+  "spar_triples", "spar_triples1", "$@30", "$@31", "spar_props_opt",
+  "spar_props", "$@32", "$@33", "spar_objects", "spar_ograph_node",
+  "spar_triple_optionlist_opt", "$@34", "spar_triple_option_commalist",
+  "spar_triple_option", "spar_triple_option_var_commalist",
+  "spar_same_as_option", "spar_verb", "spar_triples_node", "$@35", "$@36",
+  "spar_triples_opt_semi_rsqbra", "spar_cons_collection",
+  "spar_graph_node", "spar_var_or_term",
   "spar_var_or_iriref_or_pexpn_or_backquoteds",
   "spar_var_or_iriref_or_pexpn_or_backquoted",
   "spar_var_or_iriref_or_backquoted",
   "spar_var_or_blank_node_or_iriref_or_backquoted",
   "spar_retcol_commalist", "spar_retcols", "spar_ret_agg_call",
   "spar_agg_name", "spar_agg_name_int", "spar_var", "spar_global_var",
-  "spar_global_var_int", "spar_graph_term", "spar_backquoted", "$@34",
-  "spar_expn", "$@35", "$@36", "$@37", "$@38", "spar_built_in_call",
-  "$@39", "$@40", "spar_built_in_regex", "spar_function_call",
+  "spar_global_var_int", "spar_graph_term", "spar_backquoted", "$@37",
+  "spar_expn", "$@38", "$@39", "$@40", "$@41", "spar_built_in_call",
+  "$@42", "$@43", "spar_built_in_regex", "spar_function_call",
   "spar_arg_list_opt", "spar_arg_list", "spar_expns",
   "spar_numeric_literal", "spar_rdf_literal", "spar_boolean_literal",
   "spar_iriref_or_star_or_default", "spar_arrow", "spar_arrow_iriref",
   "spar_iriref", "spar_qname", "spar_blank_node", "spar_sparul_actions",
-  "spar_sparul_action", "spar_sparul_insert", "$@41",
-  "spar_sparul_insertdata", "$@42", "spar_sparul_delete", "$@43",
-  "spar_sparul_deletedata", "$@44", "spar_sparul_modify", "$@45",
+  "spar_sparul_action", "spar_sparul_insert", "$@44",
+  "spar_sparul_insertdata", "$@45", "spar_sparul_delete", "$@46",
+  "spar_sparul_deletedata", "$@47", "spar_sparul_modify", "$@48",
   "spar_sparul_clear", "spar_sparul_load", "spar_sparul_create",
   "spar_sparul_drop", "spar_action_solution", "spar_in_graph_precode_opt",
   "spar_from_graph_precode_opt", "spar_graph_precode_opt",
-  "spar_in_or_into", "spar_silent_opt", "spar_qm_stmts", "$@46",
+  "spar_in_or_into", "spar_silent_opt", "spar_qm_stmts", "$@49",
   "spar_qm_stmt", "spar_qm_simple_stmt", "spar_qm_create_iri_class",
   "spar_qm_create_literal_class", "spar_qm_drop_iri_class",
   "spar_qm_drop_literal_class", "spar_qm_create_iri_subclass",
@@ -1230,20 +1267,20 @@ static const char *const yytname[] =
   "spar_qm_iri_class_option", "spar_qm_sprintff_list",
   "spar_qm_literal_class_optionlist_opt",
   "spar_qm_literal_class_option_commalist", "spar_qm_literal_class_option",
-  "spar_qm_create_quad_storage", "$@47", "$@48",
-  "spar_qm_alter_quad_storage", "$@49", "$@50",
+  "spar_qm_create_quad_storage", "$@50", "$@51",
+  "spar_qm_alter_quad_storage", "$@52", "$@53",
   "spar_qm_drop_quad_storage", "spar_qm_drop_quad_map_mapping",
-  "spar_qm_drop_mapping", "spar_qm_from_where_list_opt", "$@51", "$@52",
+  "spar_qm_drop_mapping", "spar_qm_from_where_list_opt", "$@54", "$@55",
   "spar_qm_text_literal_list_opt", "spar_qm_text_literal_decl",
   "spar_xml_opt", "spar_of_sqlcol_opt", "spar_qm_text_literal_options_opt",
   "spar_qm_text_literal_option_commalist", "spar_qm_text_literal_option",
-  "spar_qm_map_top_group", "spar_qm_map_top_dotlist", "$@53",
-  "spar_qm_map_top_op", "spar_qm_map_group", "spar_qm_map_dotlist", "$@54",
-  "spar_qm_map_op", "$@55", "$@56", "spar_qm_map_iddef", "$@57",
-  "spar_qm_map_single", "spar_qm_triples1", "$@58", "spar_qm_named_fields",
-  "spar_qm_named_field", "$@59", "$@60", "spar_qm_props", "$@61",
-  "spar_qm_prop", "$@62", "spar_qm_obj_field_commalist", "$@63",
-  "spar_qm_obj_field", "$@64", "$@65", "$@66", "$@67", "spar_qm_as_id_opt",
+  "spar_qm_map_top_group", "spar_qm_map_top_dotlist", "$@56",
+  "spar_qm_map_top_op", "spar_qm_map_group", "spar_qm_map_dotlist", "$@57",
+  "spar_qm_map_op", "$@58", "$@59", "spar_qm_map_iddef", "$@60",
+  "spar_qm_map_single", "spar_qm_triples1", "$@61", "spar_qm_named_fields",
+  "spar_qm_named_field", "$@62", "$@63", "spar_qm_props", "$@64",
+  "spar_qm_prop", "$@65", "spar_qm_obj_field_commalist", "$@66",
+  "spar_qm_obj_field", "$@67", "$@68", "$@69", "$@70", "spar_qm_as_id_opt",
   "spar_qm_obj_datatype_opt", "spar_qm_obj_language_opt", "spar_qm_verb",
   "spar_qm_field_or_blank", "spar_qm_field", "spar_qm_where_list_opt",
   "spar_qm_where_list", "spar_qm_where", "spar_qm_options_opt",
@@ -1281,72 +1318,77 @@ static const yytype_uint16 yytoknum[] =
      395,   396,   397,   398,   399,   400,   401,   402,   403,   404,
      405,   406,   407,   408,   409,   410,   411,   412,   413,   414,
      415,   416,   417,   418,   419,   420,   421,   422,   423,   424,
-     425,   426,   427,   428,   429
+     425,   426,   427,   428,   429,   430,   431,   432,   433,   434,
+     435
 };
 # endif
 
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint16 yyr1[] =
 {
-       0,   175,   176,   176,   176,   176,   176,   177,   177,   177,
-     177,   178,   179,   179,   181,   180,   182,   182,   183,   183,
-     183,   183,   183,   184,   184,   184,   185,   185,   186,   186,
-     186,   188,   187,   189,   189,   189,   189,   191,   190,   192,
-     192,   192,   194,   193,   196,   195,   197,   197,   199,   198,
-     200,   200,   201,   202,   202,   202,   202,   203,   204,   203,
-     205,   205,   206,   206,   208,   207,   209,   209,   211,   210,
-     212,   210,   213,   213,   213,   214,   215,   214,   216,   216,
-     217,   217,   217,   217,   217,   218,   219,   218,   220,   221,
-     220,   222,   222,   223,   223,   223,   223,   223,   223,   224,
-     224,   224,   225,   225,   226,   227,   227,   228,   229,   230,
-     229,   231,   231,   231,   232,   232,   232,   232,   232,   232,
-     234,   233,   233,   236,   237,   238,   235,   240,   241,   239,
-     243,   242,   244,   242,   245,   245,   245,   247,   248,   249,
-     246,   250,   250,   251,   251,   251,   251,   251,   251,   253,
-     252,   254,   254,   254,   255,   255,   256,   256,   257,   257,
-     259,   258,   260,   258,   261,   261,   261,   263,   262,   264,
-     262,   262,   262,   265,   265,   265,   265,   266,   267,   268,
-     267,   269,   269,   270,   270,   270,   270,   270,   270,   270,
-     270,   270,   270,   270,   270,   270,   270,   270,   270,   270,
-     270,   270,   270,   270,   270,   270,   270,   270,   270,   270,
-     271,   271,   272,   272,   272,   272,   272,   273,   273,   275,
-     274,   276,   274,   274,   277,   277,   278,   278,   279,   279,
-     280,   280,   281,   281,   282,   282,   282,   282,   283,   283,
-     283,   284,   284,   284,   284,   285,   285,   286,   286,   287,
-     287,   287,   288,   289,   289,   289,   289,   289,   290,   290,
-     290,   290,   291,   292,   292,   292,   292,   293,   293,   293,
-     293,   293,   293,   293,   293,   293,   295,   294,   296,   296,
-     296,   296,   296,   296,   297,   296,   298,   296,   296,   296,
-     296,   296,   296,   296,   296,   296,   296,   296,   296,   296,
-     296,   299,   296,   300,   296,   296,   296,   296,   296,   296,
-     296,   296,   296,   301,   301,   301,   301,   301,   301,   301,
-     301,   301,   301,   301,   302,   301,   303,   301,   304,   304,
-     305,   306,   306,   307,   307,   308,   308,   308,   308,   309,
-     309,   309,   310,   310,   310,   311,   311,   312,   312,   312,
-     313,   313,   314,   314,   314,   314,   315,   315,   316,   316,
-     317,   317,   318,   318,   319,   319,   319,   319,   319,   319,
-     319,   319,   319,   321,   320,   323,   322,   325,   324,   327,
-     326,   329,   328,   330,   331,   331,   332,   333,   334,   334,
-     335,   335,   336,   336,   337,   337,   338,   338,   339,   339,
-     340,   341,   340,   342,   342,   342,   343,   343,   343,   343,
-     343,   343,   343,   344,   344,   345,   346,   347,   348,   348,
-     349,   349,   349,   350,   350,   351,   351,   351,   352,   352,
-     353,   353,   353,   354,   354,   355,   355,   355,   355,   355,
-     355,   357,   358,   356,   360,   361,   359,   362,   363,   363,
-     364,   364,   365,   366,   365,   367,   365,   365,   368,   368,
-     369,   370,   370,   371,   371,   372,   372,   373,   373,   374,
-     374,   375,   375,   375,   376,   377,   376,   378,   378,   378,
-     379,   379,   379,   380,   381,   380,   383,   382,   382,   382,
-     384,   382,   382,   385,   386,   385,   387,   389,   388,   390,
-     390,   391,   391,   391,   392,   393,   391,   394,   395,   394,
-     397,   396,   396,   398,   399,   398,   401,   402,   403,   404,
-     400,   400,   405,   405,   406,   406,   406,   406,   407,   407,
-     407,   408,   408,   408,   409,   409,   410,   410,   410,   410,
-     410,   411,   411,   412,   412,   413,   413,   414,   414,   414,
-     415,   415,   416,   416,   416,   416,   417,   417,   418,   418,
-     419,   419,   420,   421,   422,   422,   423,   423,   424,   425,
-     425,   426,   426,   427,   427,   427,   428,   428,   428,   429,
-     429,   430,   430,   431,   431,   432,   432
+       0,   181,   182,   182,   182,   182,   182,   183,   183,   183,
+     183,   184,   185,   185,   187,   186,   188,   188,   189,   189,
+     189,   189,   189,   190,   190,   190,   191,   191,   192,   192,
+     192,   194,   193,   195,   195,   195,   195,   197,   196,   198,
+     198,   198,   200,   199,   202,   201,   203,   203,   205,   204,
+     206,   206,   207,   208,   208,   208,   208,   208,   208,   209,
+     210,   209,   211,   211,   212,   212,   214,   213,   215,   215,
+     217,   216,   218,   216,   219,   220,   220,   222,   223,   221,
+     224,   224,   225,   225,   225,   226,   226,   227,   227,   228,
+     229,   229,   230,   230,   230,   230,   230,   230,   231,   231,
+     231,   232,   233,   232,   234,   234,   235,   235,   235,   235,
+     235,   236,   237,   236,   238,   239,   238,   240,   240,   241,
+     241,   241,   241,   241,   241,   242,   242,   242,   243,   243,
+     244,   245,   245,   246,   247,   248,   247,   249,   249,   249,
+     250,   250,   250,   250,   250,   250,   252,   251,   251,   254,
+     255,   256,   253,   258,   259,   257,   261,   260,   262,   260,
+     263,   263,   263,   263,   263,   264,   264,   266,   265,   268,
+     269,   270,   267,   271,   271,   272,   272,   273,   273,   273,
+     273,   275,   274,   276,   276,   276,   277,   277,   278,   278,
+     279,   279,   281,   280,   282,   280,   283,   283,   283,   283,
+     285,   284,   286,   284,   284,   284,   284,   287,   287,   287,
+     287,   287,   287,   288,   289,   290,   289,   291,   291,   292,
+     292,   292,   292,   292,   292,   292,   292,   292,   292,   292,
+     292,   292,   292,   292,   292,   292,   292,   292,   292,   292,
+     292,   292,   292,   292,   292,   292,   293,   293,   294,   294,
+     294,   294,   294,   295,   295,   295,   297,   296,   298,   296,
+     296,   299,   299,   300,   300,   301,   301,   302,   302,   303,
+     303,   304,   304,   304,   304,   305,   305,   305,   306,   306,
+     306,   306,   307,   307,   308,   308,   309,   309,   309,   310,
+     311,   311,   311,   311,   311,   312,   312,   312,   312,   313,
+     314,   314,   314,   314,   315,   315,   315,   315,   315,   315,
+     315,   315,   315,   317,   316,   318,   318,   318,   318,   318,
+     318,   319,   318,   320,   318,   318,   318,   318,   318,   318,
+     318,   318,   318,   318,   318,   318,   318,   318,   321,   318,
+     322,   318,   318,   318,   318,   318,   318,   318,   318,   318,
+     323,   323,   323,   323,   323,   323,   323,   323,   323,   323,
+     323,   324,   323,   325,   323,   326,   326,   327,   328,   328,
+     329,   329,   329,   330,   330,   330,   330,   331,   331,   331,
+     332,   332,   332,   333,   333,   334,   334,   334,   335,   335,
+     336,   336,   336,   336,   337,   337,   338,   338,   339,   339,
+     340,   340,   341,   341,   341,   341,   341,   341,   341,   341,
+     341,   343,   342,   345,   344,   347,   346,   349,   348,   351,
+     350,   352,   353,   353,   354,   355,   356,   356,   357,   357,
+     358,   358,   359,   359,   360,   360,   361,   361,   362,   363,
+     362,   364,   364,   364,   365,   365,   365,   365,   365,   365,
+     365,   366,   366,   367,   368,   369,   370,   370,   371,   371,
+     371,   372,   372,   373,   373,   373,   374,   374,   375,   375,
+     375,   376,   376,   377,   377,   377,   377,   377,   377,   379,
+     380,   378,   382,   383,   381,   384,   385,   385,   386,   386,
+     387,   388,   387,   389,   387,   387,   390,   390,   391,   392,
+     392,   393,   393,   394,   394,   395,   395,   396,   396,   397,
+     397,   397,   398,   399,   398,   400,   400,   400,   401,   401,
+     401,   402,   403,   402,   405,   404,   404,   404,   406,   404,
+     404,   407,   408,   407,   409,   411,   410,   412,   412,   413,
+     413,   413,   414,   415,   413,   416,   417,   416,   419,   418,
+     418,   420,   421,   420,   423,   424,   425,   426,   422,   422,
+     427,   427,   428,   428,   428,   428,   429,   429,   429,   430,
+     430,   430,   431,   431,   432,   432,   432,   432,   432,   433,
+     433,   434,   434,   435,   435,   436,   436,   436,   437,   437,
+     438,   438,   438,   438,   439,   439,   440,   440,   441,   441,
+     442,   443,   444,   444,   445,   445,   446,   447,   447,   448,
+     448,   449,   449,   449,   450,   450,   450,   451,   451,   452,
+     452,   453,   453,   454,   454
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
@@ -1356,61 +1398,65 @@ static const yytype_uint8 yyr2[] =
        1,     3,     0,     2,     0,     4,     1,     3,     1,     1,
        1,     1,     1,     0,     2,     2,     0,     2,     3,     2,
        2,     0,     6,     1,     2,     2,     2,     0,     2,     1,
-       1,     1,     0,     6,     0,     6,     1,     1,     0,     4,
-       0,     2,     3,     1,     2,     2,     3,     0,     0,     4,
-       1,     2,     2,     4,     0,     2,     0,     1,     0,     5,
-       0,     4,     3,     5,     5,     0,     0,     4,     1,     2,
-       3,     3,     1,     1,     1,     0,     0,     3,     0,     0,
-       4,     1,     2,     4,     4,     2,     1,     1,     1,     0,
-       1,     1,     0,     1,     2,     0,     1,     2,     3,     0,
-       8,     1,     3,     4,     1,     1,     1,     1,     1,     1,
-       0,     4,     2,     0,     0,     0,     8,     0,     0,     6,
-       0,     3,     0,     5,     4,     2,     2,     0,     0,     0,
-       9,     0,     3,     2,     3,     2,     3,     4,     3,     0,
-       4,     0,     1,     2,     1,     3,     0,     1,     1,     3,
-       0,     3,     0,     3,     0,     1,     2,     0,     3,     0,
-       5,     3,     1,     1,     3,     3,     1,     2,     0,     0,
-       5,     1,     3,     1,     2,     2,     2,     2,     2,     2,
-       2,     2,     1,     2,     1,     2,     1,     2,     4,     2,
-       2,     1,     1,     4,     1,     6,     6,     1,     4,     1,
-       1,     3,     1,     1,     1,     1,     1,     1,     1,     0,
-       4,     0,     4,     2,     1,     2,     1,     2,     1,     1,
-       1,     1,     1,     2,     1,     1,     1,     3,     1,     1,
-       1,     1,     1,     1,     1,     3,     3,     1,     2,     3,
-       3,     4,     1,     1,     2,     2,     2,     2,     1,     1,
+       1,     1,     0,     7,     0,     7,     1,     1,     0,     4,
+       0,     2,     3,     1,     2,     2,     3,     1,     2,     0,
+       0,     4,     1,     2,     2,     4,     0,     2,     0,     1,
+       0,     6,     0,     4,     2,     0,     1,     0,     0,     7,
+       1,     2,     1,     1,     1,     0,     1,     1,     2,     3,
+       1,     2,     1,     1,     1,     1,     1,     1,     3,     5,
+       5,     0,     0,     4,     1,     2,     3,     3,     1,     1,
+       1,     0,     0,     3,     0,     0,     4,     1,     2,     4,
+       4,     2,     1,     1,     1,     0,     1,     1,     0,     1,
+       2,     0,     1,     2,     3,     0,     8,     1,     3,     4,
+       1,     1,     1,     1,     1,     1,     0,     4,     2,     0,
+       0,     0,     8,     0,     0,     6,     0,     3,     0,     5,
+       4,     2,     2,     3,     2,     1,     2,     0,     4,     0,
+       0,     0,     9,     0,     3,     1,     2,     2,     3,     2,
+       2,     0,     4,     0,     1,     2,     1,     3,     0,     1,
+       1,     3,     0,     3,     0,     3,     0,     1,     2,     3,
+       0,     3,     0,     5,     3,     3,     1,     1,     3,     3,
+       3,     3,     1,     2,     0,     0,     5,     1,     3,     1,
+       2,     2,     2,     2,     2,     2,     2,     2,     1,     2,
+       1,     2,     1,     2,     4,     2,     2,     1,     1,     4,
+       1,     6,     6,     1,     4,     1,     1,     3,     1,     1,
+       1,     1,     1,     1,     1,     1,     0,     4,     0,     4,
+       2,     1,     2,     1,     2,     1,     1,     1,     1,     1,
+       2,     1,     1,     1,     3,     1,     1,     1,     1,     1,
+       1,     1,     3,     3,     1,     2,     3,     3,     4,     1,
+       1,     2,     2,     2,     2,     1,     1,     1,     2,     1,
+       1,     1,     1,     1,     1,     1,     1,     2,     2,     1,
+       1,     1,     1,     0,     4,     3,     3,     3,     3,     3,
+       3,     0,     4,     0,     6,     3,     3,     3,     3,     3,
+       3,     3,     3,     2,     2,     2,     2,     3,     0,     7,
+       0,     9,     1,     1,     2,     1,     1,     1,     1,     1,
+       4,     4,     6,     4,     4,     6,     4,     4,     4,     4,
+       1,     0,     5,     0,     5,     6,     8,     2,     0,     1,
+       1,     2,     3,     1,     3,     3,     2,     1,     1,     1,
+       1,     2,     3,     1,     1,     1,     1,     1,     1,     1,
+       2,     2,     2,     2,     1,     1,     1,     1,     1,     2,
        1,     2,     1,     1,     1,     1,     1,     1,     1,     1,
-       2,     2,     1,     1,     1,     1,     0,     4,     3,     3,
-       3,     3,     3,     3,     0,     4,     0,     6,     3,     3,
-       3,     3,     3,     3,     3,     3,     2,     2,     2,     2,
-       3,     0,     7,     0,     9,     1,     1,     2,     1,     1,
-       1,     1,     1,     4,     4,     6,     4,     4,     6,     4,
-       4,     4,     4,     1,     0,     5,     0,     5,     6,     8,
-       2,     0,     1,     1,     3,     1,     3,     3,     2,     1,
-       1,     1,     1,     2,     3,     1,     1,     1,     1,     1,
-       1,     1,     2,     2,     2,     2,     1,     1,     1,     1,
-       1,     2,     1,     2,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     0,     5,     0,     5,     0,     5,     0,
-       5,     0,     8,     2,     2,     5,     4,     4,     0,     3,
-       0,     3,     0,     3,     0,     2,     1,     1,     0,     1,
-       1,     0,     4,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     7,     7,     7,     5,     5,     7,     5,
-       0,     3,     4,     1,     3,     1,     1,     2,     1,     3,
-       0,     3,     4,     1,     3,     2,     2,     2,     1,     1,
-       2,     0,     0,     9,     0,     0,     9,     5,     5,     6,
-       3,     4,     0,     0,     7,     0,     7,     2,     0,     2,
-       6,     0,     1,     0,     4,     0,     4,     1,     3,     1,
-       2,     1,     2,     3,     1,     0,     4,     1,     1,     1,
-       1,     2,     3,     1,     0,     4,     0,     5,     6,     7,
-       0,     5,     1,     1,     0,     5,     3,     0,     3,     1,
-       2,     2,     2,     2,     0,     0,     6,     1,     0,     4,
-       0,     3,     1,     2,     0,     5,     0,     0,     0,     0,
-       9,     1,     0,     2,     0,     2,     5,     2,     0,     2,
-       2,     1,     2,     1,     1,     2,     1,     1,     1,     4,
-       1,     0,     1,     1,     2,     3,     2,     0,     3,     4,
-       1,     3,     2,     1,     2,     2,     0,     1,     1,     3,
-       1,     3,     5,     3,     0,     1,     1,     3,     3,     1,
-       3,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       4,     0,     1,     1,     3,     1,     2
+       1,     0,     5,     0,     5,     0,     5,     0,     5,     0,
+       8,     2,     2,     5,     4,     4,     0,     4,     0,     3,
+       0,     3,     0,     2,     1,     1,     0,     1,     1,     0,
+       4,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     7,     7,     7,     5,     5,     7,     5,     0,     3,
+       4,     1,     3,     1,     1,     2,     1,     3,     0,     3,
+       4,     1,     3,     2,     2,     2,     1,     1,     2,     0,
+       0,     9,     0,     0,     9,     5,     5,     6,     3,     4,
+       0,     0,     7,     0,     7,     2,     0,     2,     6,     0,
+       1,     0,     4,     0,     4,     1,     3,     1,     2,     1,
+       2,     3,     1,     0,     4,     1,     1,     1,     1,     2,
+       3,     1,     0,     4,     0,     5,     6,     7,     0,     5,
+       1,     1,     0,     5,     3,     0,     3,     1,     2,     2,
+       2,     2,     0,     0,     6,     1,     0,     4,     0,     3,
+       1,     2,     0,     5,     0,     0,     0,     0,     9,     1,
+       0,     2,     0,     2,     5,     2,     0,     2,     2,     1,
+       2,     1,     1,     2,     1,     1,     1,     4,     1,     0,
+       1,     1,     2,     3,     2,     0,     3,     4,     1,     3,
+       2,     1,     2,     2,     0,     1,     1,     3,     1,     3,
+       5,     3,     0,     1,     1,     3,     3,     1,     3,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     4,     0,
+       1,     1,     3,     1,     2
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -1419,1057 +1465,1143 @@ static const yytype_uint8 yyr2[] =
 static const yytype_uint16 yydefact[] =
 {
        0,     6,    12,     0,     4,     0,    23,     1,     0,    48,
-     581,   398,    42,   392,    44,   398,   390,    64,     0,   581,
-      33,     0,     7,    31,     8,     9,    10,     0,   362,   364,
-     365,   366,   367,   368,   369,   370,   371,   372,     0,   400,
-     403,   406,   407,   408,   409,   410,   404,   405,   411,   412,
-       0,    14,    13,    26,     0,    50,   583,   383,    64,   582,
-       0,     0,     0,   399,     0,     0,   392,   581,   377,     0,
-       0,   390,   396,   397,   373,   581,   384,     0,     0,   358,
-     359,   356,   579,   357,     0,   381,    36,    35,    34,     2,
-      37,   398,   398,     3,   363,   401,   585,     5,    25,    24,
-       0,    11,     0,     0,     0,   395,     0,     0,     0,    64,
-     149,    50,   379,    64,     0,   276,     0,    46,   258,   259,
-     263,   264,   265,   266,    50,    47,   232,   234,   260,   262,
-     236,   235,     0,     0,     0,    64,   375,     0,    64,   581,
-       0,     0,     0,     0,     0,     0,     0,   253,     0,   346,
-     324,     0,     0,     0,   326,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,   345,   339,   340,   341,   342,
-     360,   305,     0,   252,   312,    65,   306,   323,   309,   308,
-     310,   331,   311,     0,     0,     0,     0,    50,     0,     0,
-     586,     0,     0,     0,    27,     0,   444,    70,    53,     0,
-       0,    51,     0,    49,   584,     0,     0,   441,   386,   151,
-       0,     0,   393,   388,     0,     0,    66,   233,   350,   351,
-       0,   261,     0,     0,     0,     0,   387,     0,   388,   391,
-      64,   296,   301,   303,     0,   361,   299,   298,   254,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,   256,
-     255,   297,     0,     0,     0,   257,     0,   343,     0,     0,
+     619,   436,    42,   430,    44,   436,   428,    66,     0,   619,
+      33,     0,     7,    31,     8,     9,    10,     0,   400,   402,
+     403,   404,   405,   406,   407,   408,   409,   410,     0,   438,
+     441,   444,   445,   446,   447,   448,   442,   443,   449,   450,
+       0,    14,    13,    26,     0,    50,   621,   421,    66,   620,
+       0,     0,     0,   437,     0,     0,   430,   619,   415,     0,
+       0,   428,   434,   435,   411,   619,   422,     0,     0,   396,
+     397,   394,   617,   395,     0,   419,    36,    35,    34,     2,
+      37,   436,   436,     3,   401,   439,   623,     5,    25,    24,
+       0,    11,     0,     0,     0,   433,     0,     0,     0,    66,
+     181,    50,   417,    66,     0,   313,     0,    46,   295,   296,
+     300,   301,   302,   303,    50,    47,   269,   271,   297,   299,
+     273,   272,     0,     0,     0,    66,   413,     0,    66,   619,
+       0,     0,     0,     0,     0,     0,     0,   290,     0,   384,
+     361,     0,     0,     0,   363,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   383,   377,   378,   379,   380,
+     398,   342,     0,   289,   349,    67,   343,   360,   346,   345,
+     347,   368,   348,     0,     0,     0,     0,    50,     0,     0,
+     624,     0,     0,     0,    27,     0,   482,    72,    53,     0,
+      57,     0,    51,     0,    75,    49,   622,     0,     0,   479,
+     424,   183,     0,     0,   431,   426,     0,     0,    68,   270,
+     388,   389,     0,   298,     0,     0,     0,     0,   425,     0,
+     426,   429,    66,   333,   338,   340,     0,   399,   336,   335,
+     291,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   293,   292,   334,     0,     0,     0,   294,     0,   381,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,   286,   284,     0,   333,   307,   332,
-       0,     0,     0,     0,     0,    39,    38,    41,    40,   247,
-       0,   398,   402,    21,    20,    18,    19,    15,    16,    22,
-      30,    29,   452,   156,    54,    55,    68,    57,     0,     0,
-       0,   452,   221,   219,     0,     0,   274,     0,   152,   154,
-     162,   160,   230,   231,   275,   269,   268,   272,   267,   273,
-      75,   380,     0,   378,     0,   237,    75,    67,   355,   353,
-     354,   352,   416,   417,   448,     0,   447,   376,   374,   385,
-      50,    37,   300,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   344,   250,     0,   249,
-     281,   280,   282,   291,   289,   290,   288,   293,   283,   292,
-     295,   294,   278,   279,     0,     0,   335,     0,   580,     0,
-     419,     0,    75,     0,   248,     0,     0,     0,    28,     0,
-       0,   111,   157,   158,    56,   156,     0,    52,     0,   420,
-     560,   564,   420,   430,     0,   223,     0,     0,   271,   270,
-     150,   153,     0,     0,     0,    43,    85,    75,   277,    45,
-     449,     0,    50,   317,   316,     0,   321,   319,   322,     0,
-     320,   314,     0,     0,     0,   313,   251,     0,   285,   338,
-       0,   334,     0,     0,    32,   246,   245,    17,   445,     0,
-       0,   457,    71,   130,     0,     0,     0,     0,     0,   156,
-     115,   114,   117,   116,   119,   118,   156,     0,    58,     0,
-       0,     0,   414,   571,   577,   578,   576,     0,   565,   566,
-       0,   572,   413,     0,   415,   442,   229,     0,   226,   228,
-     172,   218,     0,   167,   217,   238,   240,   239,   155,   163,
-     165,   161,    76,    86,    88,   389,     0,     0,   325,   327,
-       0,     0,     0,     0,   337,   336,   418,   388,     0,     0,
-       0,     0,   546,   156,     0,   135,   136,     0,   127,   241,
-     244,   243,   242,   122,   120,   123,   137,   156,   112,     0,
-     159,    69,     0,     0,   561,     0,   563,     0,     0,     0,
-       0,   222,   227,   224,     0,   220,     0,     0,     0,     0,
-       0,     0,    72,   178,    75,   315,     0,   328,   318,   287,
-     382,     0,   471,     0,   398,     0,     0,     0,     0,   574,
-     575,   537,   538,   479,   478,   446,     0,   474,   477,   492,
-     547,   499,   497,   534,   540,   573,   536,     0,     0,   545,
-     109,   131,     0,     0,   330,     0,   156,     0,   141,   113,
-     132,    60,    64,    59,     0,     0,   421,   425,   426,     0,
-       0,   423,   567,   568,   569,   431,   438,     0,   439,     0,
-       0,     0,   433,   443,   171,   225,   169,   176,   168,   173,
-     178,     0,     0,    77,    78,    84,    82,    83,    87,    89,
-      64,    64,   105,   102,     0,   302,     0,     0,   535,     0,
-       0,     0,   501,   504,   503,   502,   475,   472,     0,   500,
-       0,     0,   556,   455,   453,    37,   178,   134,   128,   121,
-     348,   349,   124,   347,     0,   138,   156,    62,     0,    61,
-     562,   428,   427,     0,   422,     0,   435,   436,   437,   440,
-       0,   432,     0,     0,   177,     0,     0,    79,    99,   104,
-     107,    73,   106,    74,   103,   179,   178,   329,   486,     0,
-       0,     0,   450,     0,   524,   473,     0,     0,   490,   512,
-       0,   533,   498,   507,   510,   531,     0,   557,   558,   458,
-     458,    50,   108,   156,     0,     0,     0,     0,     0,    50,
-     133,    64,     0,   424,   570,   434,   170,   175,   174,    80,
-      81,   100,   101,    90,    91,     0,    98,    96,    97,     0,
-     304,     0,     0,     0,   451,     0,   505,   476,   548,   553,
-       0,     0,     0,     0,   550,     0,   532,   508,     0,   539,
-       0,   456,   454,     0,   129,   125,     0,   145,   210,   143,
-     142,     0,     0,     0,     0,    63,   429,    92,     0,     0,
-      95,   183,     0,     0,   212,   213,   214,   215,   216,     0,
-       0,     0,   192,     0,   194,     0,   196,     0,     0,     0,
-       0,     0,   201,   202,   204,     0,   207,     0,   181,   209,
-     487,   493,   547,     0,   547,     0,     0,   525,   527,   528,
-     554,   552,   555,     0,   549,   480,   491,     0,   483,     0,
-     521,   511,   522,   516,   559,   461,   459,    75,   156,   144,
-       0,     0,   148,   146,   139,     0,     0,   187,   185,   186,
-     184,   188,   189,   190,   191,   193,   195,   197,     0,   200,
-     199,     0,     0,     0,   180,     0,     0,     0,   488,   547,
-       0,     0,   506,   551,   484,   481,   509,   514,     0,   513,
-     524,   462,     0,     0,   126,   211,   147,   156,    93,    94,
-       0,     0,     0,     0,   182,     0,   494,   496,   489,     0,
-     529,   530,   482,     0,     0,   523,   517,     0,   178,   140,
-     198,   203,     0,     0,   208,     0,   526,   485,   522,   528,
-     463,   110,     0,     0,   495,   515,   518,     0,   465,   206,
-     205,   541,     0,     0,   460,   519,   542,   543,     0,     0,
-     547,   544,   464,   469,     0,   467,   520,   470,     0,   466,
-     468
+       0,     0,     0,     0,     0,     0,   323,   321,     0,   370,
+     344,   369,     0,     0,     0,     0,     0,    39,    38,    41,
+      40,   284,     0,   436,   440,    21,    20,    18,    19,    15,
+      16,    22,    30,    29,   490,   188,    54,    55,    58,    70,
+      59,    77,    74,    76,     0,     0,     0,   490,   258,   256,
+       0,     0,   311,     0,   184,   186,   194,   192,   267,   268,
+     312,   306,   305,   309,   304,   310,   101,   418,     0,   416,
+       0,   274,   101,    69,   393,   391,   392,   390,   454,   455,
+     486,     0,   485,   414,   412,   423,    50,    37,   337,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,   382,   287,     0,   286,   318,   317,   319,   328,
+     326,   327,   325,   330,   320,   329,   332,   331,   315,   316,
+       0,     0,   371,   373,     0,   618,     0,   457,     0,   101,
+       0,   285,     0,     0,     0,    28,     0,     0,   137,   189,
+     190,    56,   188,     0,    52,     0,     0,   458,   598,   602,
+     458,   468,     0,   260,     0,     0,   308,   307,   182,   185,
+       0,     0,     0,    75,   111,   101,   314,    75,   487,     0,
+      50,   354,   353,     0,   358,   356,   359,     0,   357,   351,
+       0,     0,     0,   350,   288,     0,   322,   376,     0,   372,
+       0,     0,    32,   283,   282,    17,   483,     0,     0,   495,
+      73,   156,     0,     0,   167,     0,     0,     0,   188,   141,
+     140,   143,   142,   145,   144,   188,     0,    60,    82,    83,
+       0,    80,    84,     0,     0,     0,   452,   609,   615,   616,
+     614,     0,   603,   604,     0,   610,   451,     0,   453,   480,
+     266,     0,   263,   265,   255,   254,     0,   200,   253,   275,
+     277,   276,   187,   195,   197,   193,   102,    43,   112,   114,
+      75,    45,     0,     0,   362,   364,     0,     0,     0,     0,
+     375,   374,   456,   426,     0,     0,     0,     0,   584,   188,
+       0,   165,     0,   167,   161,   162,     0,   153,   278,   281,
+     280,   279,   164,    50,   148,   146,   149,   169,   188,   138,
+       0,   191,    75,     0,    78,    81,     0,   599,     0,   601,
+       0,     0,     0,     0,   259,   264,   261,     0,   257,     0,
+       0,     0,     0,     0,     0,    98,   427,   214,   101,   352,
+       0,   365,   355,   324,   420,     0,   509,     0,   436,     0,
+       0,     0,     0,   612,   613,   575,   576,   517,   516,   484,
+       0,   512,   515,   530,   585,   537,   535,   572,   578,   611,
+     574,     0,     0,   583,   135,   157,     0,     0,   166,   163,
+     367,     0,     0,   188,     0,   173,   139,   158,    71,    62,
+      66,    61,     0,    85,     0,   459,   463,   464,     0,     0,
+     461,   605,   606,   607,   469,   476,     0,   477,     0,     0,
+       0,   471,   481,   255,   204,   262,   202,   212,   201,   207,
+     214,   199,     0,     0,   103,   104,   110,   108,   109,   113,
+     115,    66,    66,   131,   128,     0,   339,     0,     0,   573,
+       0,     0,     0,   539,   542,   541,   540,   513,   510,     0,
+     538,     0,     0,   594,   493,   491,    37,   214,   160,   154,
+     214,   147,   386,   387,   150,   385,     0,   170,   188,    64,
+       0,    63,     0,     0,    86,    87,   600,   466,   465,     0,
+     460,     0,   473,   474,   475,   478,     0,   470,     0,     0,
+     213,     0,     0,   105,   125,   130,   133,    99,   132,   100,
+     129,   215,   214,   366,   524,     0,     0,     0,   488,     0,
+     562,   511,     0,     0,   528,   550,     0,   571,   536,   545,
+     548,   569,     0,   595,   596,   496,   496,    50,   134,   188,
+     168,     0,     0,     0,     0,     0,   175,    50,   159,    66,
+      97,     0,    90,    93,    94,    95,    92,    96,    79,    88,
+       0,   462,   608,   472,   203,   211,   210,   209,   208,   106,
+     107,   126,   127,   116,   117,     0,   124,   122,   123,     0,
+     341,     0,     0,     0,   489,     0,   543,   514,   586,   591,
+       0,     0,     0,     0,   588,     0,   570,   546,     0,   577,
+       0,   494,   492,     0,   155,   151,     0,   180,   179,   246,
+     177,   174,   176,     0,    65,    89,    91,   467,   118,     0,
+       0,   121,   219,     0,     0,   248,   249,   250,   251,   252,
+       0,     0,     0,   228,     0,   230,     0,   232,     0,     0,
+       0,     0,     0,   237,   238,   240,     0,   243,     0,   217,
+     245,   525,   531,   585,     0,   585,     0,     0,   563,   565,
+     566,   592,   590,   593,     0,   587,   518,   529,     0,   521,
+       0,   559,   549,   560,   554,   597,   499,   497,   101,   188,
+     178,     0,   171,     0,     0,   223,   221,   222,   220,   224,
+     225,   226,   227,   229,   231,   233,     0,   236,   235,     0,
+       0,     0,   216,     0,     0,     0,   526,   585,     0,     0,
+     544,   589,   522,   519,   547,   552,     0,   551,   562,   500,
+       0,     0,   152,   247,   188,   119,   120,     0,     0,     0,
+       0,   218,     0,   532,   534,   527,     0,   567,   568,   520,
+       0,     0,   561,   555,     0,   214,   172,   234,   239,     0,
+       0,   244,     0,   564,   523,   560,   566,   501,   136,     0,
+       0,   533,   553,   556,     0,   503,   242,   241,   579,     0,
+       0,   498,   557,   580,   581,     0,     0,   585,   582,   502,
+     507,     0,   505,   558,   508,     0,   504,   506
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
-      -1,     3,    21,     5,     6,    52,   100,   297,   298,    53,
-     101,   194,    22,    90,   610,   187,   188,   286,    24,    65,
-      25,    69,   124,    26,    55,   332,   201,   202,   407,   552,
-     623,   624,    76,    77,   336,   203,   405,   303,   425,   426,
-     569,   653,   654,   514,   570,   572,   718,   773,   774,   775,
-     723,   662,   721,   663,   611,   685,   612,   469,   470,   616,
-     471,   617,   754,   878,   472,   615,   753,   473,   533,   696,
-     474,   475,   618,   759,   927,   695,   758,   111,   209,   317,
-     318,   401,   402,   403,   423,   422,   509,   502,   566,   712,
-     648,   649,   665,   779,   847,   848,   807,   849,   503,   320,
-     417,   416,   565,   497,   650,   321,   125,   126,   504,   538,
-     287,   288,   171,   172,   173,   174,   128,   129,   323,   324,
-     214,   386,   385,   384,   350,   351,   176,   241,   245,   177,
-     657,   278,   279,   387,   178,   179,   180,   692,   220,   221,
-     181,    83,   182,    27,    28,    29,   137,    30,   227,    31,
-     114,    32,   211,    33,   186,    34,    35,    36,    37,   333,
-      74,    68,    57,    75,    64,    38,   191,    39,    40,    41,
-      42,    43,    44,    45,   482,   630,   631,   702,   494,   641,
-     642,    46,   311,   560,    47,   302,   528,    48,   593,   594,
-     399,   750,   749,   801,   876,   922,   968,   974,   984,   985,
-     595,   596,   736,   597,   866,   867,   943,   598,   781,   795,
-     850,   955,   851,   599,   681,   600,   601,   734,   859,   742,
-     869,   743,   798,   871,   944,   872,   920,   959,   971,   980,
-     919,   786,   912,   744,   602,   603,   975,   976,   461,   680,
-     793,   794,   746,   747,   409,   410,   412,   487,   488,   489,
-     633,   490,   604,   605,   606,    58,    59,    97
+      -1,     3,    21,     5,     6,    52,   100,   299,   300,    53,
+     101,   194,    22,    90,   634,   187,   188,   288,    24,    65,
+      25,    69,   124,    26,    55,   338,   202,   203,   414,   573,
+     651,   652,    76,    77,   342,   204,   412,   305,   205,   312,
+     313,   415,   653,   490,   491,   733,   734,   735,   801,   802,
+     433,   434,   592,   684,   685,   529,   593,   595,   754,   823,
+     824,   825,   759,   693,   757,   694,   635,   716,   636,   478,
+     479,   643,   480,   644,   791,   929,   481,   641,   789,   482,
+     549,   728,   483,   553,   562,   563,   484,   645,   797,   974,
+     727,   795,   796,   111,   211,   323,   324,   408,   409,   410,
+     431,   430,   523,   516,   589,   748,   678,   679,   696,   829,
+     898,   899,   858,   900,   517,   326,   425,   424,   588,   511,
+     680,   327,   125,   126,   518,   557,   289,   290,   171,   172,
+     173,   174,   128,   129,   329,   330,   216,   393,   391,   390,
+     356,   357,   176,   243,   247,   177,   688,   280,   281,   394,
+     178,   179,   180,   724,   222,   223,   181,    83,   182,    27,
+      28,    29,   137,    30,   229,    31,   114,    32,   213,    33,
+     186,    34,    35,    36,    37,   339,    74,    68,    57,    75,
+      64,    38,   191,    39,    40,    41,    42,    43,    44,    45,
+     496,   659,   660,   738,   508,   670,   671,    46,   317,   583,
+      47,   304,   544,    48,   617,   618,   406,   786,   785,   851,
+     927,   970,  1015,  1021,  1031,  1032,   619,   620,   772,   621,
+     917,   918,   990,   622,   831,   845,   901,  1002,   902,   623,
+     712,   624,   625,   770,   910,   778,   920,   779,   848,   922,
+     991,   923,   968,  1006,  1018,  1027,   967,   836,   960,   780,
+     626,   627,  1022,  1023,   469,   711,   843,   844,   782,   783,
+     417,   418,   420,   501,   502,   503,   662,   504,   628,   629,
+     630,    58,    59,    97
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -892
+#define YYPACT_NINF -888
 static const yytype_int16 yypact[] =
 {
-      29,  -892,   -68,   120,  -892,  1646,   188,  -892,    66,  -892,
-     720,   270,  -892,   296,  -892,    10,   350,  -892,   146,    87,
-      91,    59,  -892,  -892,  -892,  -892,  -892,   836,  -892,  -892,
-    -892,  -892,  -892,  -892,  -892,  -892,  -892,  -892,    37,  -892,
-    -892,  -892,  -892,  -892,  -892,  -892,  -892,  -892,  -892,  -892,
-      33,  -892,  -892,  -892,   112,  -892,   155,  -892,  -892,  -892,
-     195,   229,   176,  -892,   235,   299,   260,   235,  -892,    94,
-     307,     3,  -892,  -892,  -892,   235,     3,  1992,   207,  -892,
-    -892,  -892,  -892,  -892,   225,  -892,  -892,  -892,  -892,  -892,
-    -892,    10,    10,  -892,  -892,   208,  -892,  -892,  -892,  -892,
-     197,   272,   209,    22,   321,  -892,   209,   209,   209,  -892,
-    -892,  -892,  -892,  -892,   299,  -892,  1992,  -892,  -892,  -892,
-    -892,  -892,  -892,  -892,  -892,   449,  -892,    48,  -892,  -892,
-    -892,  -892,   343,   357,    27,  -892,  -892,   299,  -892,   235,
-    1992,  1635,   377,  1992,  1992,   407,   433,  -892,   437,  -892,
-    -892,   444,   447,   472,  -892,   475,   493,   497,   498,   523,
-    1992,   529,   537,   545,   557,  -892,  -892,  -892,  -892,    19,
-    -892,  -892,  1796,  -892,    48,  3209,  -892,  -892,  -892,  -892,
-    -892,    52,  -892,   290,   209,   439,   531,  -892,  1894,   235,
-    -892,   185,   852,    24,  -892,   563,  -892,  -892,   495,   536,
-     582,  -892,   249,  -892,  -892,   -80,   460,  -892,  -892,  1474,
-      22,   299,  -892,   102,  1992,  1750,    22,  -892,  -892,  -892,
-      40,  -892,   209,   209,   304,   209,  -892,   299,   102,  -892,
-    -892,  1079,  -892,  -892,  2538,  -892,  -892,  -892,  -892,   547,
-    1992,   585,  1992,  1992,  1992,   586,  1992,  1992,  1992,  -892,
-    -892,  1079,  1992,  1992,  1992,  -892,   249,  -892,   579,  1992,
-    2594,  1992,  1992,  1992,  1992,  1992,  1992,  1992,  1992,  1992,
-    1992,  1992,  1992,   319,  -892,  -892,  1992,  -892,  -892,  -892,
-     599,   505,   209,   299,    22,  -892,  -892,   623,  1992,  2616,
-     216,    10,  -892,  -892,  -892,  -892,  -892,   624,  -892,  -892,
-    -892,   491,  -892,  1474,  -892,   548,  -892,   558,   594,   640,
-     594,  -892,   634,   377,     7,     7,  -892,   638,   647,  -892,
-    -892,  -892,    48,  -892,  -892,  -892,  -892,  -892,  -892,  -892,
-     607,  -892,    22,  -892,  2634,  -892,   607,  -892,  -892,  -892,
-    -892,  -892,  -892,  -892,  -892,   209,  -892,  -892,  -892,  -892,
-    -892,  -892,  -892,   371,  2665,  1992,  2697,  2715,  2741,  1992,
-    2771,  2797,  2827,  2853,  2883,  2909,  -892,  -892,  2927,  -892,
-    1079,  2236,  1602,   827,   827,   827,   827,   458,  1602,   458,
-    -892,  -892,  -892,  -892,   654,  1992,  3209,   424,  -892,   580,
-    -892,   603,   607,  1992,  3209,  1992,   247,   852,  -892,    79,
-     651,   187,  -892,   665,  -892,  1474,   660,  -892,   510,    49,
-    -892,   -10,   583,    56,    84,  -892,  1474,   332,  -892,  -892,
-    -892,  1474,   894,   332,   642,  -892,   619,   607,  -892,  -892,
-    -892,    22,  -892,  -892,  -892,  2953,  -892,  -892,  -892,  2983,
-    -892,  -892,  1992,  1992,  1992,  -892,  -892,  1992,  1103,  -892,
-    1066,  -892,   209,   299,  -892,  3209,  3209,  -892,  -892,   143,
-      26,  -892,  -892,  -892,  1817,   482,   376,   605,   209,  1362,
-    -892,  -892,  -892,   544,  -892,  -892,  1474,   667,  -892,   640,
-     594,   676,  -892,  -892,  -892,  -892,  -892,   672,   693,  -892,
-     123,  -892,  -892,   687,  -892,  -892,  -892,  1428,  -892,  -892,
-    -892,  -892,   476,  -892,  -892,    48,  -892,  -892,  -892,  -892,
-     690,   700,  -892,  -892,   629,  -892,   704,    22,  -892,  -892,
-    3009,  2520,  3027,   431,  -892,  3209,  -892,   102,  2020,   701,
-     702,   577,  -892,  1445,  1992,  -892,  -892,    52,  -892,    48,
-    -892,  -892,  -892,  -892,  -892,  -892,  -892,  1474,  -892,   737,
-    -892,  -892,    42,   648,  -892,   257,  -892,   -10,   123,   487,
-    2020,  -892,  -892,  -892,   310,  -892,  1192,  1274,   663,  2348,
-    1992,   714,    90,   657,   607,  -892,  1992,  -892,  -892,  -892,
-    -892,   733,  -892,   304,    10,  1386,  1386,  1386,  1386,  -892,
-    -892,  -892,  -892,  -892,  -892,  -892,   420,  -892,  -892,  -892,
-     325,  -892,  -892,  -892,  -892,  -892,   743,   593,   601,  -892,
-    -892,  -892,   746,  3053,  -892,   752,  1445,    76,   756,  -892,
-    -892,  -892,  -892,  -892,   237,   123,  -892,  -892,  -892,   622,
-     418,  -892,  -892,  -892,   688,  -892,  -892,   209,  -892,   196,
-     622,   428,  -892,  -892,  -892,  -892,  -892,  -892,   783,  -892,
-     657,  1992,  1992,  2348,  -892,    48,  -892,  -892,  3209,  -892,
-    -892,  -892,   699,   715,   780,  -892,   773,  3083,  -892,    16,
-     209,   278,  -892,  -892,  -892,  -892,   775,  -892,   789,  -892,
-     792,   261,   410,  -892,  -892,  -892,   657,  -892,  -892,  -892,
-    -892,  -892,  -892,  -892,    -3,  -892,  1445,  -892,   652,  -892,
-    -892,  -892,   669,    64,  -892,   719,  -892,  -892,  -892,   669,
-     470,  -892,  1192,  1252,  -892,  3109,  3127,  -892,  2418,  -892,
-    -892,  -892,  -892,  -892,  -892,  -892,   657,  -892,  -892,   694,
-     673,   728,  -892,   209,   768,  -892,  2076,    31,  -892,  -892,
-     791,  -892,   793,  -892,  -892,  -892,   794,   813,  -892,  -892,
-    -892,  -892,  -892,  1445,   816,   674,   547,   852,    51,  -892,
-    -892,  -892,   679,  -892,  -892,  -892,   783,  -892,  -892,  -892,
-    -892,  -892,  -892,  2283,  -892,    28,    48,  -892,  -892,  3174,
-    -892,  2220,   209,   721,  -892,   224,  -892,  -892,  -892,  -892,
-     692,   785,   680,   496,  -892,  2118,  -892,  -892,   633,  -892,
-     410,   707,   707,    22,  -892,  -892,   852,   840,    48,   624,
-    -892,   696,   547,   852,   151,  -892,  -892,  -892,  1992,  1992,
-    -892,  -892,   430,   547,  -892,  -892,  -892,  -892,  -892,   547,
-    1992,   703,  -892,   710,  -892,   712,  -892,   547,   834,  1992,
-    1992,   849,  -892,  -892,  -892,   850,  -892,   503,  -892,   851,
-    -892,  -892,   325,   876,   771,   209,   855,  -892,  -892,   798,
-    -892,  -892,  -892,   186,  -892,  -892,  -892,   446,  -892,   261,
-    -892,   867,   847,  -892,  -892,   731,  -892,   607,  1445,   624,
-     547,   852,   840,   624,  -892,  3153,  3183,  -892,  -892,  -892,
-    -892,    48,    48,  3209,  -892,  -892,  -892,    48,   547,  3209,
-    3209,   547,   811,  3174,  -892,  1992,   868,   633,  -892,   771,
-     729,   517,  -892,  -892,   862,  -892,  -892,  -892,   209,  -892,
-     768,  -892,   806,   865,  -892,    48,   624,  1445,  -892,  -892,
-     509,   516,   870,   533,  -892,   507,  -892,  -892,  -892,   872,
-    -892,  -892,  -892,  2174,   633,  -892,  -892,   410,   657,  -892,
-    -892,  -892,   860,   869,  -892,  2118,  -892,  -892,   847,   798,
-     804,  -892,   547,   547,  -892,  -892,  -892,   886,   815,    48,
-      48,   762,   410,   897,  -892,  -892,   762,  -892,   532,   747,
-     771,  -892,  -892,   761,   562,  -892,  -892,  -892,   747,  -892,
-    -892
+      26,  -888,   -91,    75,  -888,   718,   121,  -888,    -2,  -888,
+     346,   256,  -888,   185,  -888,   -36,   190,  -888,    13,   389,
+     189,   -39,  -888,  -888,  -888,  -888,  -888,   330,  -888,  -888,
+    -888,  -888,  -888,  -888,  -888,  -888,  -888,  -888,    30,  -888,
+    -888,  -888,  -888,  -888,  -888,  -888,  -888,  -888,  -888,  -888,
+      35,  -888,  -888,  -888,    42,  -888,   115,  -888,  -888,  -888,
+     112,   171,    98,  -888,   173,   231,   194,   173,  -888,   763,
+     527,   246,  -888,  -888,  -888,   173,   246,  2260,   114,  -888,
+    -888,  -888,  -888,  -888,   149,  -888,  -888,  -888,  -888,  -888,
+    -888,   -36,   -36,  -888,  -888,   136,  -888,  -888,  -888,  -888,
+     186,   267,   168,   228,   350,  -888,   168,   168,   168,  -888,
+    -888,  -888,  -888,  -888,   231,  -888,  2260,  -888,  -888,  -888,
+    -888,  -888,  -888,  -888,  -888,   901,  -888,   429,  -888,  -888,
+    -888,  -888,   341,   383,    -8,  -888,  -888,   231,  -888,   173,
+    2260,  1787,   404,  2260,  2260,   431,   434,  -888,   445,  -888,
+    -888,   474,   485,   491,  -888,   496,   516,   532,   536,   538,
+    2260,   540,   542,   545,   565,  -888,  -888,  -888,  -888,    49,
+    -888,  -888,  1954,  -888,   429,  3564,  -888,  -888,  -888,  -888,
+    -888,    77,  -888,   266,   168,   480,   548,  -888,  2056,   173,
+    -888,   413,   753,    38,  -888,   567,  -888,  -888,   518,   551,
+     544,   610,  -888,   455,   591,  -888,  -888,   -22,   502,  -888,
+    -888,  1620,   228,   231,  -888,   276,  2260,  2740,   228,  -888,
+    -888,  -888,    34,  -888,   168,   168,   422,   168,  -888,   231,
+     276,  -888,  -888,  1662,  -888,  -888,  2890,  -888,  -888,  -888,
+    -888,   493,  2260,   665,  2260,  2260,  2260,   669,  2260,  2260,
+    2260,  -888,  -888,  1662,  2260,  2260,  2260,  -888,   455,  -888,
+     680,  2260,  2908,  2260,  2260,  2260,  2260,  2260,  2260,  2260,
+    2260,  2260,  2260,  2260,  2260,   447,  -888,  -888,  2158,  -888,
+    -888,  -888,   681,   577,   168,   231,   228,  -888,  -888,   698,
+    2260,  2966,   348,   -36,  -888,  -888,  -888,  -888,  -888,   700,
+    -888,  -888,  -888,   546,  -888,  1620,  -888,   620,  -888,  -888,
+     612,  -888,  -888,  -888,   653,   706,   653,  -888,   699,   404,
+     530,   530,  -888,   705,   719,  -888,  -888,  -888,   429,  -888,
+    -888,  -888,  -888,  -888,  -888,  -888,   668,  -888,   228,  -888,
+    2992,  -888,   668,  -888,  -888,  -888,  -888,  -888,  -888,  -888,
+    -888,   168,  -888,  -888,  -888,  -888,  -888,  -888,  -888,    32,
+    3018,  2260,  3044,  3070,  3096,  2260,  3122,  3148,  3174,  3200,
+    3226,  3252,  -888,  -888,  3278,  -888,  1662,  1829,  2025,   769,
+     769,   769,   769,   629,  2025,   629,  -888,  -888,  -888,  -888,
+     717,  2260,  -888,  3564,   292,  -888,   641,  -888,   670,   668,
+    2260,  3564,  2260,   352,   753,  -888,    59,   716,    56,  -888,
+     732,  -888,  1620,   729,  -888,   676,   571,    43,  -888,    74,
+     652,    46,    87,  -888,  1620,   939,  -888,  -888,  -888,  1620,
+    1257,   939,   715,   591,   692,   668,  -888,   591,  -888,   228,
+    -888,  -888,  -888,  3304,  -888,  -888,  -888,  3330,  -888,  -888,
+    2260,  2260,  2260,  -888,  -888,  2260,   618,  -888,  1326,  -888,
+     168,   231,  -888,  3564,  3564,  -888,  -888,   342,    12,  -888,
+    -888,  -888,  2723,   187,  -888,   251,   673,   168,  1143,  -888,
+    -888,  -888,   619,  -888,  -888,  1620,   741,  -888,  -888,  -888,
+      55,  -888,  -888,   706,   653,   749,  -888,  -888,  -888,  -888,
+    -888,   743,   761,  -888,   -34,  -888,  -888,   757,  -888,  -888,
+    -888,  1534,  -888,  -888,  1624,  -888,   654,  -888,  -888,   429,
+    -888,  -888,  -888,  -888,   750,   752,  -888,  -888,  -888,   678,
+     591,  -888,   751,   228,  -888,  -888,  3356,  1904,  3382,   409,
+    -888,  3564,  -888,   276,  2337,   754,   760,   624,  -888,  1568,
+    2260,  -888,   736,  -888,  -888,  -888,    77,  -888,   429,  -888,
+    -888,  -888,  -888,  -888,  -888,  -888,  -888,  -888,  1620,  -888,
+     781,  -888,   591,    20,  -888,  -888,   690,  -888,   391,  -888,
+      74,   -34,   487,  2337,  -888,  -888,  -888,   504,  -888,  1498,
+    1449,   696,  2643,  2260,   759,   -17,  -888,   703,   668,  -888,
+    2260,  -888,  -888,  -888,  -888,   775,  -888,   422,   -36,  1726,
+    1726,  1726,  1726,  -888,  -888,  -888,  -888,  -888,  -888,  -888,
+     313,  -888,  -888,  -888,   401,  -888,  -888,  -888,  -888,  -888,
+     790,   634,   636,  -888,  -888,  -888,   788,  3408,  -888,  -888,
+    -888,   798,   228,  1568,    97,   799,  -888,  -888,  -888,  -888,
+    -888,  -888,   103,   800,   -34,  -888,  -888,  -888,   659,   270,
+    -888,  -888,  -888,   727,  -888,  -888,   168,  -888,   151,   659,
+     289,  -888,  -888,  1734,  -888,  -888,  -888,  -888,   813,  -888,
+     703,   797,  2260,  2260,  2643,  -888,   429,  -888,  -888,  3564,
+    -888,  -888,  -888,   725,   744,   809,  -888,   805,  3434,  -888,
+      14,   168,   416,  -888,  -888,  -888,  -888,   808,  -888,   816,
+    -888,   819,   318,   522,  -888,  -888,  -888,   703,  -888,  -888,
+     703,  -888,  -888,  -888,  -888,  -888,    -1,  -888,  1568,  -888,
+     674,  -888,  1029,   817,   800,  -888,  -888,  -888,   695,   340,
+    -888,   746,  -888,  -888,  -888,   695,   505,  -888,  1498,  1040,
+    -888,  3460,  3486,  -888,  2785,  -888,  -888,  -888,  -888,  -888,
+    -888,  -888,   703,  -888,  -888,   730,   691,   764,  -888,   168,
+     804,  -888,  2378,   343,  -888,  -888,   830,  -888,   831,  -888,
+    -888,  -888,   832,   849,  -888,  -888,  -888,  -888,  -888,  1568,
+    -888,   847,   707,   113,   753,    86,  -888,  -888,  -888,  -888,
+    -888,   111,  -888,  -888,  -888,  -888,  -888,  -888,  -888,  -888,
+     709,  -888,  -888,  -888,   813,  -888,  -888,  -888,  -888,  -888,
+    -888,  -888,  -888,  2619,  -888,    31,   429,  -888,  -888,  3527,
+    -888,  2490,   168,   758,  -888,   364,  -888,  -888,  -888,  -888,
+     714,   815,   702,   301,  -888,  2425,  -888,  -888,   561,  -888,
+     522,   723,   723,   228,  -888,  -888,   753,  -888,   871,   429,
+     700,  -888,  -888,    57,  -888,  -888,  -888,  -888,  -888,  2260,
+    2260,  -888,  -888,   438,   493,  -888,  -888,  -888,  -888,  -888,
+     493,  2260,   721,  -888,   734,  -888,   735,  -888,   493,   866,
+    2260,  2260,   868,  -888,  -888,  -888,   873,  -888,   410,  -888,
+     874,  -888,  -888,   401,  1066,   786,   168,   878,  -888,  -888,
+     818,  -888,  -888,  -888,   260,  -888,  -888,  -888,   513,  -888,
+     318,  -888,   887,   867,  -888,  -888,   742,  -888,   668,  1568,
+     700,   493,  -888,  3512,  3538,  -888,  -888,  -888,  -888,   429,
+     429,  3564,  -888,  -888,  -888,   429,   493,  3564,  3564,   493,
+     482,  3527,  -888,  2260,   893,   561,  -888,   786,   748,   467,
+    -888,  -888,   886,  -888,  -888,  -888,   168,  -888,   804,  -888,
+     835,   891,  -888,   429,  1568,  -888,  -888,   414,   459,   877,
+     484,  -888,   509,  -888,  -888,  -888,   896,  -888,  -888,  -888,
+    2466,   561,  -888,  -888,   522,   703,  -888,  -888,  -888,   883,
+     904,  -888,  2425,  -888,  -888,   867,   818,   841,  -888,   493,
+     493,  -888,  -888,  -888,   923,   840,   429,   429,   796,   522,
+     927,  -888,  -888,   796,  -888,   462,   773,   786,  -888,  -888,
+     787,   463,  -888,  -888,  -888,   773,  -888,  -888
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -892,  -892,  -892,  -892,  -892,  -892,  -892,  -651,   513,  -892,
-    -892,  -892,  -892,  -892,    47,  -347,  -892,  -892,  -892,  -892,
-    -892,  -892,  -892,  -892,  -892,   -52,  -892,  -892,  -892,  -892,
-    -892,  -892,   -56,  -892,  -892,  -181,  -892,  -892,  -325,  -892,
-    -892,  -892,   275,  -892,  -892,  -892,  -892,  -892,   158,  -892,
-    -892,   269,  -892,   271,  -604,  -892,  -282,  -892,  -892,  -892,
-    -892,  -892,  -892,  -892,  -892,  -892,  -892,  -892,  -892,  -892,
-    -892,  -892,  -892,  -892,  -892,  -892,  -892,  -106,  -892,  -892,
-    -892,   459,  -892,  -189,  -892,  -892,  -892,   121,  -892,  -892,
-     222,   223,  -632,  -892,  -892,    35,  -680,  -892,    21,  -388,
-    -892,  -892,  -892,  -892,  -366,  -383,  -892,   817,  -892,  -892,
-    -892,  -892,  -892,  -892,  -892,    61,  -175,  -892,  -892,   -64,
-    -892,   477,  -892,  -892,  -892,  -892,  -451,  -892,  -892,  -892,
-    -442,  -892,   403,  -446,   383,   453,  -177,  -892,  -892,  -892,
-     -18,  -892,  -190,  -892,   917,  -892,  -892,  -892,  -892,  -892,
-    -892,  -892,  -892,  -892,  -892,  -892,  -892,  -892,  -892,  -218,
-     874,   880,   929,   875,    -9,  -892,  -892,   763,  -892,  -892,
-    -892,  -892,  -892,  -892,   541,  -892,   253,   317,  -892,  -892,
-     248,  -892,  -892,  -892,  -892,  -892,  -892,  -892,    18,  -892,
-     649,  -892,  -892,   211,  -892,  -892,  -892,  -892,  -892,   -24,
-     406,  -892,  -892,   231,    23,  -892,  -892,  -779,  -892,  -892,
-    -892,  -892,  -892,  -892,  -892,   198,  -586,  -892,  -892,  -892,
-    -892,   113,  -892,  -892,  -892,  -836,  -892,  -892,  -892,  -892,
-      25,    65,    30,   131,  -755,  -548,  -892,  -892,  -891,  -790,
-    -892,   124,  -892,    20,   681,   514,   518,  -892,  -892,   436,
-     373,  -892,  -658,  -362,   -11,    11,   -55,  -892
+    -888,  -888,  -888,  -888,  -888,  -888,  -888,  -741,   547,  -888,
+    -888,  -888,  -888,  -888,    45,  -353,  -888,  -888,  -888,  -888,
+    -888,  -888,  -888,  -888,  -888,   -47,  -888,  -888,  -888,  -888,
+    -888,  -888,   -33,  -888,  -888,  -283,  -888,  -888,  -201,  -352,
+    -888,  -888,  -888,  -888,   460,  -888,  -888,   218,  -888,   152,
+    -341,  -888,  -888,  -888,   274,  -888,  -888,  -888,  -888,  -888,
+     131,  -888,  -888,   265,  -888,   268,  -629,  -888,  -260,  -888,
+    -888,  -888,  -888,  -888,  -888,  -888,  -888,  -888,  -888,  -888,
+    -888,  -888,  -888,  -888,   407,  -888,  -888,  -888,  -888,  -888,
+    -888,  -888,   170,   -96,  -888,  -888,  -888,   481,  -888,  -195,
+    -888,  -888,  -888,   262,  -888,  -888,   219,   221,  -654,  -888,
+    -888,    17,  -550,  -888,    15,  -405,  -888,  -888,  -888,  -888,
+    -362,  -402,  -888,   846,  -888,  -888,  -888,  -888,  -888,  -888,
+    -888,   -46,  -187,  -888,  -888,   -27,  -888,   733,  -888,  -888,
+    -888,  -888,  -463,  -888,  -888,  -888,  -459,  -888,   418,  -453,
+     533,   607,  -173,  -888,  -888,  -888,   -18,  -888,  -181,  -888,
+     949,  -888,  -888,  -888,  -888,  -888,  -888,  -888,  -888,  -888,
+    -888,  -888,  -888,  -888,  -888,  -215,   909,   919,   967,   914,
+      -5,  -888,  -888,   801,  -888,  -888,  -888,  -888,  -888,  -888,
+     573,  -888,   252,   326,  -888,  -888,   263,  -888,  -888,  -888,
+    -888,  -888,  -888,  -888,    19,  -888,   693,  -888,  -888,   222,
+    -888,  -888,  -888,  -888,  -888,   -23,   430,  -888,  -888,   242,
+      18,  -888,  -888,  -808,  -888,  -888,  -888,  -888,  -888,  -888,
+    -888,   184,  -604,  -888,  -888,  -888,  -888,    96,  -888,  -888,
+    -888,  -887,  -888,  -888,  -888,  -888,    16,    54,    11,   120,
+    -788,  -578,  -888,  -888,  -703,  -831,  -888,   116,  -888,     6,
+     710,   534,   539,  -888,  -888,   449,   373,  -888,  -692,  -390,
+     -11,    25,   -58,  -888
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
    number is the opposite.  If zero, do what YYDEFACT says.
    If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -395
+#define YYTABLE_NINF -433
 static const yytype_int16 yytable[] =
 {
-      82,   523,   105,   103,   432,   130,    70,    84,   213,   109,
-     348,   429,   689,   535,   679,   135,   868,   299,   714,   329,
-     319,   400,   536,    49,   748,   300,   853,   256,   496,   330,
-       1,   228,   327,   499,    98,   337,   197,   672,   673,   674,
-     675,   338,   531,   873,   818,   819,   755,    95,   728,   491,
-     498,   131,    23,   208,   752,   788,   483,   212,   480,   210,
-     308,   130,   906,   756,   908,   480,   621,   454,   276,    72,
-     218,   937,   216,    73,   309,   810,     4,   219,   113,   226,
-     977,   198,   229,   189,    82,   981,   138,   789,    82,    82,
-      82,   196,   760,   458,   780,   205,   206,   207,   495,   115,
-     811,   627,   515,   392,   690,   331,   809,   131,   958,   496,
-     116,   224,   199,   329,   499,   628,   -50,   812,   656,   938,
-       7,   347,   117,   477,   691,    63,   327,   858,   558,   790,
-     127,   562,   882,   745,   135,   284,    86,  -394,   459,   484,
-     485,   277,   874,   459,   225,    87,   481,   791,    56,   804,
-     230,   427,   873,   493,   757,   879,   729,   486,   166,   167,
-     168,   -50,   883,   200,   957,   884,    82,    54,   629,   345,
-     660,   792,     2,   281,   349,   257,   868,   391,   496,   820,
-     532,    96,   301,   499,   307,   661,   127,   548,   233,   873,
-     986,   328,   -50,    99,    88,   491,   634,   339,   340,   622,
-     341,   463,   656,    89,    82,    82,    82,    82,   813,    49,
-     198,   342,   343,   344,   346,   329,     8,    78,   930,   104,
-     460,   931,   299,   183,    50,   460,   329,   290,   327,   102,
-     926,   329,   508,    79,    80,   106,    81,    51,   366,   327,
-     291,   199,   789,   -50,   327,   464,   698,   184,   465,   666,
-     516,    79,    80,   941,    81,   118,   119,   120,   121,   122,
-     123,   699,   739,   634,    82,   619,   679,   777,    18,   107,
-     322,   390,   484,   485,   924,   542,   778,   708,   740,   329,
-     195,   626,   396,   466,   790,   328,   329,    60,   467,   960,
-     486,   741,   327,   108,   627,   856,    56,    61,   431,   327,
-     353,   468,   791,    79,    80,   745,    81,   329,   628,   580,
-     529,   644,   530,   110,   748,   115,   961,    62,   132,    67,
-     327,   745,   777,   949,   496,   496,   792,    82,   133,   499,
-     499,   778,   195,   500,   430,   645,   574,   115,   751,    56,
-     501,    60,    66,   329,   185,   484,   485,   527,   134,   195,
-     707,    61,   190,   506,   192,    67,   327,   329,   506,   506,
-     204,   629,   501,   486,   322,    56,    79,    80,    56,    81,
-     327,    62,   193,   484,   485,   195,   329,   543,   132,   731,
-     517,    79,    80,   222,    81,    63,   585,   328,   133,   327,
-     544,   486,   589,   218,   590,   433,    71,   223,   328,   507,
-     219,   540,   235,   328,   507,   507,    79,    80,   134,    81,
-     484,   485,   166,   167,   168,   169,    72,   586,    79,    80,
-      73,    81,   678,   238,   587,   449,   329,   703,   486,   589,
-     676,   590,   449,   450,    82,    79,    80,   710,    81,   327,
-     450,   526,   704,   677,   280,   588,   537,   541,   451,   239,
-      82,   328,   711,   240,   115,   579,   914,   546,   328,   935,
-     242,    79,    80,   243,    81,   116,   322,    79,    80,   915,
-      81,   118,   119,   120,   121,   122,   123,   322,   505,   328,
-     382,   383,   322,   505,   505,   271,   272,   115,   244,    79,
-      80,   246,    81,   118,   119,   120,   121,   122,   123,   142,
-     506,   563,   564,   506,   506,   863,   329,   636,   449,   247,
-      82,   635,   903,   248,   249,   328,   450,   637,   880,   327,
-     864,   638,   329,   329,   636,   880,   539,   904,   670,   328,
-     322,   954,   282,   950,   637,   327,   327,   322,   638,   250,
-     951,   800,    82,   510,   511,   252,   507,   639,   328,   507,
-     507,   537,   923,   253,   175,   218,   982,   953,   322,   484,
-     485,   254,   219,   329,   639,    82,   697,    82,    82,    82,
-      82,   988,   669,   255,   640,   671,   327,   486,   589,   183,
-     590,   283,   299,   304,   887,   646,   989,   888,   646,   646,
-     889,   640,   325,   215,   322,   305,   306,   890,   328,   693,
-     310,   355,   359,   367,   719,   720,    79,    80,   322,    81,
-     118,   119,   120,   121,   122,   123,   733,   231,   234,    82,
-     236,   237,   877,   388,   389,   505,   706,   322,   505,   505,
-     655,   299,   393,   397,   870,   537,   404,   251,   299,    79,
-      80,   170,    81,   118,   119,   120,   121,   122,   123,   260,
-     581,   398,    82,    82,   408,   406,   411,   421,   415,   730,
-     732,   420,   326,    82,   644,   289,   484,   485,   115,   424,
-     447,   940,   453,   452,   462,   476,   478,   322,   328,   479,
-     481,   512,   513,   549,   486,   589,   325,   590,   329,   545,
-     551,   334,   555,   501,   328,   328,   556,   418,   419,   803,
-     537,   327,   557,   559,   195,   815,   299,   814,   118,   119,
-     120,   121,   122,   123,   655,    82,   567,   354,    82,   356,
-     357,   358,   784,   360,   361,   362,   568,   571,   573,   363,
-     364,   365,   609,   607,   608,   328,   368,   329,   370,   371,
-     372,   373,   374,   375,   376,   377,   378,   379,   380,   381,
-     327,   620,   625,   659,   664,   537,   326,   322,   668,   682,
-     683,  -394,  -394,    82,    82,   394,   688,   857,   684,   686,
-    -394,   854,   694,   322,   322,  -394,   701,    82,   705,   776,
-      82,    56,   484,   485,   166,   167,   168,   169,   325,  -394,
-      79,    80,   713,    81,   661,   660,   725,   726,   735,   325,
-     486,   589,  -394,   590,   325,   737,   738,  -394,   762,   761,
-     764,   782,   224,   783,   322,   785,   796,   808,   799,   797,
-      79,    80,   800,    81,   118,   119,   120,   121,   122,   123,
-     805,   806,   435,   816,   776,    82,   439,    82,   855,  -395,
-    -395,   861,  -395,   860,   909,  -395,   268,   862,   270,   880,
-     898,    82,   325,   881,   271,   272,   875,   894,   326,   325,
-     328,   895,   448,   896,  -394,   901,   902,   905,   678,   326,
-     455,   910,   456,   808,   326,   911,   917,    10,    91,   918,
-     325,   921,   936,   939,   891,   942,    13,   947,   948,    82,
-     892,    92,   962,   740,   952,   500,   956,   967,   897,   115,
-      82,   963,   972,   460,  -164,    16,   741,   945,  -164,   328,
-     457,   591,   973,   979,   983,   987,   325,  -164,    17,   520,
-     521,   522,   326,    19,   501,    82,    82,   525,   717,   326,
-     325,   817,   724,   722,   766,   550,   768,    82,   934,   322,
-     614,   925,   217,   591,    94,   136,   112,   195,    85,   325,
-     326,   139,  -164,   492,   292,  -164,   763,   709,   765,   808,
-     414,   802,   808,   933,   990,   932,   643,   787,   591,   591,
-     591,   591,   118,   119,   120,   121,   122,   123,   964,   852,
-      93,   592,   916,   965,   907,   946,   326,   913,   322,   966,
-    -164,   413,   978,   632,   554,  -164,     0,   553,   700,   325,
-     326,     0,     0,   293,     0,     0,   294,     0,  -164,   295,
-       0,   613,   296,   592,     0,   120,   121,   122,   123,   326,
-       0,     0,     0,   969,   970,   484,   485,   166,   167,   168,
-     169,     0,     0,    79,    80,     0,    81,     0,   592,   592,
-     592,   592,     0,   486,   589,     0,   590,   658,     0,     0,
-       0,    79,    80,   667,    81,   118,   119,   120,   121,   122,
-     123,     0,     0,     0,   591,     0,     0,   524,     0,   326,
-       0,     0,   140,     0,     0,     0,     0,     0,     0,   325,
-       0,     0,   141,   142,     0,   143,     0,   144,     0,     0,
-     263,   264,   265,     0,   266,   325,   325,   267,   268,   269,
-     270,   145,     0,     0,   146,     0,   271,   272,     0,     0,
-     147,     0,     0,   148,     0,   264,   265,     0,   266,   591,
-       0,   267,   268,   149,   270,     0,     0,     0,   715,   716,
-     271,   272,     0,     0,   592,     0,   325,   150,   151,   152,
-     153,   154,   155,   156,   157,   274,     0,     0,     0,   326,
-       0,   158,   159,     0,     0,     0,   160,     0,   275,     0,
-       0,     0,     0,     0,   591,   326,   326,     0,   161,  -395,
-       0,     0,     0,     0,     0,     0,   162,     0,   591,     0,
-       0,   591,  -395,     0,   163,     0,     0,   164,     0,   592,
-       0,     0,     0,   647,     0,     0,     0,   115,     0,     0,
-       0,     0,     0,     0,   165,     0,   326,     0,   312,   313,
-       0,   314,     0,   315,     0,     0,     0,   166,   167,   168,
+      82,   437,   539,   399,   440,   301,   109,    84,   103,   554,
+      70,   336,   135,   555,   721,   354,   325,   343,   215,   510,
+     710,   784,   513,   127,    49,   105,   750,     1,   547,   505,
+     335,   703,   704,   705,   706,   344,    98,   919,   333,   302,
+      95,   230,   130,   904,   649,   407,   764,   869,   870,   792,
+      23,   131,   494,   860,   220,   494,   441,   258,   462,     4,
+     924,   221,   512,   788,   212,   691,   790,   793,   984,   574,
+     471,   932,   954,   466,   956,     7,   210,   218,   226,   127,
+     214,   527,   692,    63,    82,   531,    78,   189,    82,    82,
+      82,   196,   113,   278,   530,   207,   208,   209,   130,   798,
+     138,   509,   228,    54,  1005,   231,   510,   131,   830,   513,
+     861,    89,   730,   227,   581,   930,   472,   337,   198,   473,
+     467,   498,   499,   314,   335,   722,   985,   731,   142,   687,
+     183,   135,   333,   353,   781,   865,   792,   435,   315,   500,
+     286,   857,   497,   909,   495,   474,   723,   507,   467,   585,
+     199,   200,   486,   106,   793,   184,   475,    50,   925,   765,
+     854,   476,   794,   102,   232,   328,    82,   924,   351,   279,
+     149,    51,   548,   283,   477,     2,    79,    80,   596,    81,
+      96,   104,  1004,   650,   510,   310,   235,   513,   871,   398,
+     505,   663,   115,   334,   919,   359,  1033,   345,   346,   355,
+     347,    99,   303,   924,   142,   468,    82,    82,    82,    82,
+      49,   259,   107,   348,   349,   350,   352,   301,   569,   108,
+     648,   687,   488,   489,   120,   121,   122,   123,   492,   498,
+     499,   335,    66,   468,   522,    86,    56,    71,   532,   333,
+     372,   195,   197,   335,    87,   110,    67,   500,   335,   794,
+     598,   333,   564,   165,   800,    67,   333,   697,    72,   328,
+      79,    80,    73,    81,   663,   565,    82,   988,   166,   167,
+     168,   169,   185,   397,    79,    80,   170,    81,   744,   739,
+     118,   119,   120,   121,   122,   123,   190,   334,   403,   198,
+     -50,   827,   561,   457,   740,   828,    88,   335,   746,   710,
+     972,   458,  1007,   492,   335,   333,   498,   499,   646,   439,
+     914,   743,   333,   747,    72,  1024,   459,   839,    73,   775,
+    1028,   199,   200,   707,   500,   915,   781,   784,   604,    60,
+     335,    79,    80,    82,    81,   776,   708,   -50,   333,    61,
+     438,  1008,   781,   510,   510,   996,   513,   513,   777,   192,
+      79,    80,   170,    81,   118,   119,   120,   121,   122,   123,
+     827,    62,   840,   787,   828,   543,   328,   838,   335,   -50,
+     -50,   193,    10,    91,   201,    63,   333,   656,   328,   519,
+     841,    13,   224,   328,   519,   519,    92,   335,  -432,  -432,
+     206,   195,   657,   533,   334,   333,   977,  -432,   520,   978,
+     839,    16,  -432,   520,   520,   842,   334,   521,   335,    56,
+     457,   334,   521,   521,    17,   655,   333,  -432,   458,   951,
+      19,    60,   -50,   931,   225,   132,   282,   558,   656,   237,
+    -432,    61,   328,   603,   952,   133,  -432,   907,   997,   328,
+    -432,   720,    82,   657,     8,   840,   559,   240,   658,   542,
+     241,   220,    56,    62,   556,   560,   292,   134,   221,    82,
+     334,   242,   335,   841,   609,   328,   567,   334,   931,   293,
+     333,   850,  1035,   498,   499,   166,   167,   168,   169,    56,
+      93,    79,    80,   998,    81,    56,  1029,  1036,   842,   195,
+     244,   500,   613,   334,   614,   195,  -432,   610,    18,   658,
+     982,   245,   709,   328,   611,   673,   220,   246,  1000,   115,
+     457,   664,   248,   221,   674,   545,   642,   546,   458,   498,
+     499,   767,   328,   962,   665,   612,    82,    79,    80,   675,
+      81,   334,   249,  1001,   515,   666,   963,   500,   613,   667,
+     614,   519,   665,   328,   519,   519,   686,   335,   250,   701,
+     334,   807,   251,   666,   252,   333,   254,   667,   255,   805,
+     520,   256,   921,   520,   520,    82,   668,   335,   335,   521,
+     928,   334,   521,   521,   556,   333,   333,   284,   605,    79,
+      80,   257,    81,   183,   668,    79,    80,   971,    81,    82,
+      56,    82,    82,    82,    82,   669,   700,   328,   935,   285,
+     132,   936,   676,   702,   937,   676,   676,   301,   335,   306,
+     133,   938,   307,   669,   388,   389,   333,   729,    79,    80,
+     807,    81,   498,   499,   309,   334,   725,   987,   805,   311,
+     266,   267,   134,   268,   195,   308,   269,   270,   686,   272,
+     500,   613,   979,   614,   769,   273,   274,   316,    82,   118,
+     119,   120,   121,   122,   123,   742,   273,   274,   755,   756,
+     118,   119,   120,   121,   122,   123,   556,    79,    80,   301,
+      81,   118,   119,   120,   121,   122,   123,   498,   499,   586,
+     587,   361,   328,    82,    82,   365,  -433,   166,   167,   168,
+     766,   768,   524,   525,    82,   500,   613,   673,   614,  -433,
+     396,   115,   328,   328,   373,   395,   674,   400,   826,   404,
+     334,   411,   405,   413,   806,   416,   498,   499,   166,   167,
+     168,   169,   419,   423,    79,    80,   515,    81,   428,   429,
+     334,   334,   432,   455,   500,   613,   556,   614,   460,   470,
+     853,   461,   485,   328,   331,   487,   493,   859,   335,     8,
+     863,    82,     9,   495,    82,   526,   333,   528,   834,   566,
+      10,    11,    12,   570,   572,   578,   864,   579,   115,    13,
+     580,   334,    14,   582,    15,   597,   590,   826,   591,   116,
+     594,  -433,  -433,   806,  -433,   633,   631,  -433,   270,    16,
+     272,   117,   632,   335,   638,   647,   273,   274,   654,   690,
+     699,   333,    17,    18,   695,   556,   713,   714,    19,   715,
+     175,   717,   719,    82,    82,   726,   732,   908,   332,   737,
+     741,   905,   749,  -204,   692,   761,   691,    82,   939,   762,
+      82,   771,   773,   774,   940,    20,   833,   799,   331,   810,
+     808,   812,   945,   488,   489,   120,   121,   122,   123,   217,
+     226,   832,   835,   426,   427,   846,   849,   847,   850,    79,
+      80,   855,    81,   118,   119,   120,   121,   122,   123,   867,
+     856,   911,   912,   233,   236,   913,   238,   239,   926,   906,
+     931,   942,   946,   328,   949,   973,    82,   709,    82,   950,
+     953,   943,   944,   253,   958,   957,   965,   959,   969,   966,
+     859,   999,    82,   859,   980,   262,   115,   983,   986,   989,
+     295,   334,   332,   296,   995,  1009,   297,   116,   994,   298,
+    1003,   291,   120,   121,   122,   123,    79,    80,   328,    81,
+     118,   119,   120,   121,   122,   123,  1010,    82,  1014,  1019,
+     514,  1020,   468,  1026,   115,   331,  1030,  1034,    82,   340,
+     575,   465,   809,   866,   868,   992,   334,   331,   753,   760,
+     639,   758,   331,  1016,  1017,   862,   571,   814,   981,   515,
+     818,   219,    82,    82,   640,   360,    94,   362,   363,   364,
+     136,   366,   367,   368,    82,   112,    85,   369,   370,   371,
+     139,   811,   294,   506,   374,   745,   376,   377,   378,   379,
+     380,   381,   382,   383,   384,   385,   386,   387,   852,   813,
+     422,   331,  1037,   672,   837,   903,   964,  1013,   331,   332,
+    1011,  1012,   993,   401,   955,  1025,   421,   736,   577,   661,
+     961,   332,   576,     0,     0,     0,   332,     0,     0,     0,
+       0,   815,     0,     0,   331,   115,   142,     0,     0,     0,
+     816,     0,     0,     0,     0,     0,   318,   319,     0,   320,
+       0,   321,     0,     0,    79,    80,   817,    81,   118,   119,
+     120,   121,   122,   123,     0,     0,     0,   615,     0,     0,
+       0,     0,   331,   776,     0,   332,     0,     0,   149,     0,
+       0,     0,   332,     0,   443,     0,   777,     0,   447,   149,
+       0,   331,    79,    80,     0,    81,   118,   119,   120,   121,
+     122,   123,     0,     0,     0,     0,   615,     0,   332,     0,
+       0,     0,   331,     0,   456,     0,     0,     0,     0,     0,
+       0,     0,   322,   463,     0,   464,     0,     0,     0,   195,
+       0,     0,   615,   615,   615,   615,     0,     0,   115,     0,
+       0,   616,     0,   568,     0,     0,   332,     0,     0,   318,
+     319,     0,   320,     0,   321,     0,     0,     0,     0,     0,
+       0,   165,   800,     0,     0,   332,   331,     0,     0,     0,
+       0,     0,   165,   536,   537,   538,   166,   167,   168,   169,
+     616,   541,    79,    80,   170,    81,   332,   166,   167,   168,
+     169,     0,   149,    79,    80,   170,    81,   118,   119,   120,
+     121,   122,   123,     0,     0,     0,   616,   616,   616,   616,
+       0,   498,   499,   166,   167,   168,   169,     0,     0,    79,
+      80,     0,    81,     0,     0,   322,     0,     0,     0,   500,
+     613,     0,   614,     0,     0,   615,     0,     0,     0,     0,
+     332,     0,     0,     0,     0,     0,     0,     0,   514,     0,
+       0,   331,   115,     0,     0,   803,     0,  -196,     0,     0,
+       0,  -196,     0,     0,     0,     0,     0,     0,     0,     0,
+    -196,   331,   331,   637,     0,   165,     0,   515,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     166,   167,   168,   169,     0,   615,    79,    80,   170,    81,
+     118,   119,   120,   121,   122,   123,     0,  -196,     0,   616,
+    -196,     0,   331,     0,     0,     0,   689,   540,     0,     0,
+       0,     0,   140,   698,   803,   332,     0,     0,     0,   804,
+       0,     0,   141,   142,     0,   143,  -196,   144,     0,     0,
+       0,     0,     0,     0,     0,   332,   332,  -196,     0,     0,
+       0,   145,  -196,     0,   615,   146,     0,     0,     0,     0,
+       0,   147,     0,     0,   148,  -196,     0,     0,   615,   616,
+       0,   615,     0,     0,     0,   149,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,   332,     0,     0,   150,
+     151,   152,   153,   154,   155,   156,   157,     0,   804,     0,
+       0,     0,     0,   158,   159,   751,   752,     0,     0,   160,
+      79,    80,     0,    81,   118,   119,   120,   121,   122,   123,
+       0,     0,   161,     0,     0,     0,     0,   615,   616,     0,
+     162,     0,     0,     0,     0,     0,     0,     0,   163,     0,
+     673,   164,   616,   615,   115,   616,     0,     0,     0,   681,
+       0,     0,   331,  -198,     0,     0,     0,     0,   165,     0,
+       0,     0,  -198,     0,     0,     0,     0,     0,     0,   515,
+       0,     0,     0,   166,   167,   168,   169,     0,   615,    79,
+      80,   170,    81,   118,   119,   120,   121,   122,   123,   677,
+       0,     0,     0,   115,     0,     0,     0,   331,     0,  -198,
+       0,   616,  -198,     0,   318,   319,     0,   320,     0,   321,
+       0,     0,     0,   615,   615,     0,     0,   616,     0,     0,
+       0,     0,     0,     0,     0,   615,   332,     0,  -198,   115,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,  -198,
+     318,   319,     0,   320,  -198,   321,     0,   149,   584,     0,
+       0,     0,   616,     0,     0,     0,     0,  -198,     0,     0,
+       0,     0,     0,   115,     0,     0,     0,     0,     0,     0,
+       0,   332,     0,     0,   318,   319,     0,   320,     0,   321,
+     322,     0,     0,   149,     0,     0,     0,   616,   616,     0,
+       0,     0,   933,   934,     0,     0,     0,     0,     0,   616,
+       0,     0,    79,    80,   941,    81,   118,   119,   120,   121,
+     122,   123,     0,   947,   948,   115,   322,   149,     0,     0,
+       0,     0,     0,     0,  -206,     0,   318,   319,  -206,   320,
+     165,   321,     0,     0,     0,     0,     0,  -206,     0,  -206,
+    -206,     0,     0,     0,     0,   166,   167,   168,   169,     0,
+     322,    79,    80,   170,    81,   118,   119,   120,   121,   122,
+     123,     0,     0,   265,   266,   267,   165,   268,     0,   149,
+     269,   270,   271,   272,  -206,    20,     0,  -206,     0,   273,
+     274,   166,   167,   168,   169,     0,     0,    79,    80,   170,
+      81,   118,   119,   120,   121,   122,   123,     0,     0,     0,
+     165,     0,   322,  -206,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,  -206,   166,   167,   168,   169,  -206,
+     276,    79,    80,   170,    81,   118,   119,   120,   121,   122,
+     123,     0,  -206,   277,  -205,     0,     0,     0,  -205,     0,
+       0,     0,     0,     0,     0,     0,     0,  -205,     0,  -205,
+    -205,     0,   165,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   166,   167,   168,
      169,     0,     0,    79,    80,   170,    81,   118,   119,   120,
-     121,   122,   123,     0,   592,     0,   591,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,   592,   149,
-       0,   592,   591,   767,     0,     0,     0,   115,     0,     0,
-       0,   325,     0,     0,     0,     0,     0,     0,   312,   313,
-       0,   314,     0,   315,     0,   644,     0,     0,     0,   115,
-       0,   316,     0,     0,  -166,     0,     0,     0,  -166,     0,
-     591,     0,     0,     0,     0,   885,   886,  -166,     0,     0,
-       0,     0,     0,     0,   501,     0,   592,   893,     0,   149,
-     325,     0,     0,     0,     0,     0,   899,   900,     0,     0,
-       0,     0,   592,     0,     0,     0,   591,   591,     0,     0,
-     165,   326,  -166,     0,     0,  -166,     0,     0,   591,     0,
-       0,   316,     0,   166,   167,   168,   169,     0,     0,    79,
-      80,   170,    81,   118,   119,   120,   121,   122,   123,     0,
-     592,     0,     0,     0,     0,     0,     0,   115,     0,     0,
-    -166,     0,   547,     0,     0,  -166,     0,     0,   312,   313,
-     326,   314,     0,   315,     0,     0,     0,     0,  -166,     0,
-     165,     0,     0,     0,     0,     0,   592,   592,     0,     0,
-       0,     0,     0,   166,   167,   168,   169,     0,   592,    79,
-      80,   170,    81,   118,   119,   120,   121,   122,   123,   149,
+     121,   122,   123,   140,  -205,     0,     0,  -205,     0,   195,
+       0,     0,     0,   141,   142,     0,   143,     0,   144,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   234,   145,  -205,     0,     0,   146,     0,     0,     0,
+       0,     0,   147,   263,  -205,   148,     0,     0,     0,  -205,
+     265,   266,   267,     0,   268,     0,   149,   269,   270,   271,
+     272,     0,  -205,     0,     0,     0,   273,   274,     0,     0,
+     150,   151,   152,   153,   154,   155,   156,   157,     0,     0,
+       0,     0,     0,     0,   158,   159,     0,     0,     0,     0,
+     160,   498,   499,   166,   167,   168,   169,     0,     0,    79,
+      80,     0,    81,   161,     0,     0,     0,   276,     0,   500,
+     613,   162,   614,     0,    20,     0,     0,     0,   263,   163,
+     277,   264,   164,   600,     0,   265,   266,   267,     0,   268,
+       0,     0,   269,   270,   271,   272,     0,     0,   601,   165,
+       0,   273,   274,     0,     0,     0,   275,     0,     0,     0,
+       0,     0,     0,     0,   166,   167,   168,   169,     0,     0,
+      79,    80,   170,    81,   118,   119,   120,   121,   122,   123,
+     140,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     141,   142,   276,   143,     0,   144,     0,     0,     0,     0,
+       0,     0,   260,     0,     0,   277,     0,     0,     0,   145,
+       0,     0,     0,   146,     0,     0,     0,     0,     0,   147,
+       0,     0,   148,     0,     0,     0,     0,     0,     0,   261,
+       0,     0,     0,   149,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   150,   151,   152,
+     153,   154,   155,   156,   157,     0,  -433,   266,   267,     0,
+     268,   158,   159,   269,   270,  -433,   272,   160,     0,     0,
+       0,     0,   273,   274,     0,     0,     0,     0,     0,     0,
+     161,     0,   140,     0,     0,     0,     0,     0,   162,     0,
+       0,     0,   141,   142,     0,   143,   163,   144,     0,   164,
+       0,     0,     0,     0,   287,     0,     0,     0,     0,     0,
+       0,   145,     0,   276,     0,   146,   165,     0,     0,     0,
+       0,   147,     0,     0,   148,     0,   277,     0,     0,     0,
+       0,   166,   167,   168,   169,   149,     0,    79,    80,   170,
+      81,   118,   119,   120,   121,   122,   123,     0,     0,   150,
+     151,   152,   153,   154,   155,   156,   157,     0,     0,     0,
+       0,     0,     0,   158,   159,     0,     0,     0,     0,   160,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    79,    80,   115,    81,   118,   119,   120,   121,   122,
-     123,     0,     0,     0,   312,   313,     0,   314,     0,   315,
-     115,   316,   561,     0,     0,     0,     0,   195,     0,     0,
-       0,   312,   313,     0,   314,     0,   315,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,   115,
-       0,     0,     0,     0,     0,   149,     0,     0,     0,     0,
-     312,   313,     0,   314,     0,   315,     0,     0,     0,     0,
-     165,     0,   149,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,   166,   167,   168,   169,   316,     0,    79,
+       0,     0,   161,     0,   140,     0,     0,     0,     0,     0,
+     162,     0,     0,     0,   141,   142,     0,   143,   163,   144,
+       0,   164,   392,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,   145,     0,     0,     0,   146,   165,     0,
+       0,     0,     0,   147,     0,     0,   148,     0,     0,     0,
+       0,     0,     0,   166,   167,   168,   169,   149,     0,    79,
       80,   170,    81,   118,   119,   120,   121,   122,   123,     0,
-       0,   149,     0,     0,   316,   484,   485,   166,   167,   168,
-     169,     0,     0,    79,    80,     0,    81,     0,     0,     0,
-       0,     0,     0,   486,   589,     0,   590,     0,    20,     0,
-       0,     0,     0,   316,     0,     0,   165,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,   166,
-     167,   168,   169,   165,     0,    79,    80,   170,    81,   118,
-     119,   120,   121,   122,   123,     0,   166,   167,   168,   169,
-       0,     0,    79,    80,   170,    81,   118,   119,   120,   121,
-     122,   123,   165,  -395,   264,   265,     0,   266,     0,     0,
-     267,   268,  -395,   270,     0,   166,   167,   168,   169,   271,
-     272,    79,    80,   170,    81,   118,   119,   120,   121,   122,
-     123,   140,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,   141,   142,     0,   143,     0,   144,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,   274,   232,
-     145,     0,     0,   146,     0,     0,     0,     8,     0,   147,
-       9,   275,   148,     0,     0,     0,     0,    10,    11,    12,
-       0,     0,   149,     0,     0,     0,    13,     0,     0,    14,
-       0,    15,     0,     0,     0,     0,   150,   151,   152,   153,
-     154,   155,   156,   157,     0,    16,     0,     0,     0,     0,
-     158,   159,     0,     0,     0,   160,     0,     0,    17,    18,
-       0,     0,     0,    19,     0,     0,     0,   161,     0,     0,
-       0,     0,     0,     0,     0,   162,     0,     0,    20,     0,
-       0,     0,     0,   163,   261,     0,   164,   262,     0,    20,
-       0,   263,   264,   265,     0,   266,     0,     0,   267,   268,
-     269,   270,     0,   165,   335,     0,     0,   271,   272,     0,
-       0,     0,   273,     0,     0,     0,   166,   167,   168,   169,
-       0,     0,    79,    80,   170,    81,   118,   119,   120,   121,
-     122,   123,   140,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,   141,   142,     0,   143,   274,   144,     0,     0,
-       0,     0,     0,     0,   258,     0,     0,     0,     0,   275,
-       0,   145,     0,   534,   146,     0,     0,     0,     0,     0,
-     147,     0,     0,   148,     0,     0,     0,     0,     0,     0,
-     259,     0,     0,   149,     0,   146,     0,     0,     0,     0,
-       0,     0,     0,     0,   148,     0,     0,   150,   151,   152,
-     153,   154,   155,   156,   157,     0,     0,     0,     0,     0,
-       0,   158,   159,     0,     0,     0,   160,     0,   150,   151,
-     152,   153,   154,   155,   156,   157,     0,     0,   161,     0,
-     140,     0,     0,     0,     0,     0,   162,     0,     0,     0,
-     141,   142,     0,   143,   163,   144,     0,   164,     0,   161,
-       0,     0,   285,     0,     0,     0,     0,   162,     0,   145,
-       0,     0,   146,     0,   165,   163,     0,     0,   147,     0,
-       0,   148,     0,     0,     0,     0,     0,   166,   167,   168,
-     169,   149,     0,    79,    80,   170,    81,   118,   119,   120,
-     121,   122,   123,     0,     0,   150,   151,   152,   153,   154,
-     155,   156,   157,     0,    79,    80,     0,    81,     0,   158,
-     159,     0,     0,     0,   160,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   161,     0,   140,     0,
-       0,     0,     0,     0,   162,     0,     0,     0,   141,   142,
-       0,   143,   163,   144,     0,   164,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,   145,     0,     0,
-     146,     0,   165,     0,     0,     0,   147,   581,     0,   148,
-       0,     0,     0,   582,     0,   166,   167,   168,   169,   149,
+       0,   150,   151,   152,   153,   154,   155,   156,   157,     0,
+       0,     0,     0,     0,     0,   158,   159,     0,     0,     0,
+       0,   160,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,   161,     0,   140,     0,     0,     0,
+       0,     0,   162,     0,     0,     0,   141,   142,     0,   143,
+     163,   144,     0,   164,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   145,     0,     0,     0,   146,
+     165,     0,     0,     0,     0,   147,     0,     0,   148,     0,
+       0,     0,     0,     0,     0,   166,   167,   168,   169,   149,
        0,    79,    80,   170,    81,   118,   119,   120,   121,   122,
-     123,     0,   583,   150,   151,   152,   153,   154,   155,   156,
-     157,     0,     0,     0,     0,   584,     0,   158,   159,     0,
-       0,   585,   160,     0,     0,     0,     0,     0,     0,     0,
-       0,   195,     0,   581,   161,     0,     0,     0,     0,     0,
-       0,     0,   162,     0,     0,     0,     0,     0,     0,     0,
-     163,     0,   586,   164,     0,     0,     0,     0,   583,   587,
+     123,     0,     0,   150,   151,   152,   153,   154,   155,   156,
+     157,     0,     0,     0,     0,     0,     0,   158,   159,     0,
+       0,     0,     0,   160,   605,     0,     0,     0,     0,     0,
+     606,     0,     0,     0,     0,     0,   161,     0,     0,     0,
+       0,     0,     0,     0,   162,     0,     0,     0,     0,     0,
+     607,     0,   163,     0,     0,   164,     0,     0,     0,     0,
+       0,     0,     0,   608,     0,   605,     0,     0,     0,     0,
+     609,     0,   165,     0,     0,     0,     0,     0,     0,     0,
+     195,     0,     0,     0,     0,     0,     0,   166,   167,   168,
+     169,   607,     0,    79,    80,   170,    81,   118,   119,   120,
+     121,   122,   123,   610,   608,     0,     0,     0,     0,     0,
+     611,   609,   605,     0,     0,     0,     0,     0,   916,     0,
+       0,   195,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   612,     0,     0,     0,     0,     0,     0,   607,     0,
+       0,     0,     0,     0,   610,     0,     0,     0,     0,     0,
+       0,   611,     0,   605,     0,     0,     0,     0,   609,     0,
+       0,     0,   498,   499,   166,   167,   168,   169,   195,     0,
+      79,    80,   612,    81,     0,     0,     0,   605,     0,   607,
+     500,   613,     0,   614,     0,     0,     0,     0,     0,     0,
+       0,   610,     0,     0,     0,     0,     0,     0,   611,   609,
+       0,     0,     0,   498,   499,   166,   167,   168,   169,   195,
+       0,    79,    80,     0,    81,     0,     0,     0,     0,   612,
+       0,   500,   613,   609,   614,     0,     0,     0,     0,     0,
+       0,     0,   610,   195,     0,     0,     0,     0,     0,   611,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     165,   584,     0,     0,     0,   581,     0,   585,     0,     0,
-     588,   865,     0,   166,   167,   168,   169,   195,     0,    79,
-      80,   170,    81,   118,   119,   120,   121,   122,   123,     0,
-     583,     0,     0,     0,     0,     0,     0,     0,   586,   484,
-     485,   166,   167,   168,   169,   587,     0,    79,    80,   585,
-      81,     0,     0,     0,     0,     0,     0,   486,   589,   195,
-     590,   581,     0,     0,     0,     0,   588,     0,     0,     0,
+     498,   499,   166,   167,   168,   169,   610,     0,    79,    80,
+     612,    81,     0,   611,     0,     0,     0,     0,   500,   613,
+       0,   614,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,   612,     0,     0,     0,     0,     0,
+       0,   498,   499,   166,   167,   168,   169,     0,     0,    79,
+      80,     0,    81,     0,     0,  -125,  -125,     0,     0,   500,
+     613,     0,   614,     0,     0,   498,   499,   166,   167,   168,
+     169,     0,   821,    79,    80,     0,    81,     0,   146,   682,
+     683,     0,     0,   500,   613,     0,   614,   148,     0,     0,
+       0,     0,   822,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,   146,     0,     0,     0,     0,     0,     0,     0,
+       0,   148,   150,   151,   152,   153,   154,   155,   156,   157,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     586,     0,     0,     0,     0,     0,   583,   587,     0,     0,
-       0,     0,     0,     0,     0,   484,   485,   166,   167,   168,
-     169,     0,     0,    79,    80,   585,    81,   581,   588,     0,
-     261,     0,     0,   486,   589,   195,   590,   263,   264,   265,
-       0,   266,     0,     0,   267,   268,   269,   270,     0,     0,
-       0,     0,     0,   271,   272,     0,   586,   484,   485,   166,
-     167,   168,   169,   587,     0,    79,    80,     0,    81,     0,
-       0,   585,     0,     0,     0,   486,   589,     0,   590,     0,
-       0,   195,     0,     0,   588,     0,     0,     0,     0,   -99,
-     -99,     0,   274,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,   586,     0,     0,   275,   771,     0,     0,   587,
-       0,   146,     0,   484,   485,   166,   167,   168,   169,     0,
-     148,    79,    80,     0,    81,   772,     0,     0,     0,     0,
-     588,   486,   589,     0,   590,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,   150,   151,   152,   153,   154,   155,
-     156,   157,     0,     0,   651,   652,     0,     0,     0,   484,
-     485,   166,   167,   168,   169,     0,     0,    79,    80,     0,
-      81,     0,     0,     0,     0,   161,   146,   486,   589,     0,
-     590,     0,     0,   162,     0,   148,     0,     0,     0,     0,
-       0,   163,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,   150,
-     151,   152,   153,   154,   155,   156,   157,     0,     0,     0,
-       0,     0,     0,     0,   -99,     0,     0,     0,     0,     0,
-      79,    80,     0,    81,   118,   119,   120,   121,   122,   123,
-     161,   771,     0,     0,     0,     0,   146,     0,   162,     0,
-       0,     0,     0,     0,     0,   148,   163,     0,     0,     0,
-     772,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,   150,
-     151,   152,   153,   154,   155,   156,   157,     0,     0,     0,
-       0,     0,     0,     0,     0,    79,    80,     0,    81,   118,
-     119,   120,   121,   122,   123,     0,     0,     0,     0,     0,
-     161,     0,     0,     0,   261,     0,     0,   262,   162,   576,
-       0,   263,   264,   265,     0,   266,   163,     0,   267,   268,
-     269,   270,   261,     0,   577,   262,     0,   271,   272,   263,
-     264,   265,   273,   266,     0,     0,   267,   268,   269,   270,
-       0,     0,   352,     0,     0,   271,   272,     0,     0,     0,
-     273,     0,     0,     0,     0,    79,    80,     0,    81,   118,
-     119,   120,   121,   122,   123,     0,   274,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,   261,   275,
-       0,   262,     0,     0,   274,   263,   264,   265,     0,   266,
-       0,     0,   267,   268,   269,   270,     0,   275,   369,     0,
-     261,   271,   272,   262,     0,   395,   273,   263,   264,   265,
-       0,   266,     0,     0,   267,   268,   269,   270,   261,   428,
-       0,   262,     0,   271,   272,   263,   264,   265,   273,   266,
-       0,     0,   267,   268,   269,   270,     0,     0,     0,     0,
-     274,   271,   272,     0,     0,     0,   273,     0,     0,   261,
-       0,     0,   262,   275,     0,     0,   263,   264,   265,     0,
-     266,     0,   274,   267,   268,   269,   270,     0,     0,   434,
-       0,     0,   271,   272,     0,   275,     0,   273,     0,     0,
-     274,   261,     0,     0,   262,     0,     0,     0,   263,   264,
-     265,     0,   266,   275,     0,   267,   268,   269,   270,   261,
-       0,   436,   262,     0,   271,   272,   263,   264,   265,   273,
-     266,   274,     0,   267,   268,   269,   270,     0,     0,   437,
-       0,     0,   271,   272,   275,   261,     0,   273,   262,     0,
-       0,     0,   263,   264,   265,     0,   266,     0,     0,   267,
-     268,   269,   270,   274,     0,   438,     0,     0,   271,   272,
-       0,     0,     0,   273,     0,   261,   275,     0,   262,     0,
-       0,   274,   263,   264,   265,     0,   266,     0,     0,   267,
-     268,   269,   270,     0,   275,   440,     0,     0,   271,   272,
-       0,   261,     0,   273,   262,     0,     0,   274,   263,   264,
-     265,     0,   266,     0,     0,   267,   268,   269,   270,     0,
-     275,   441,     0,     0,   271,   272,     0,     0,     0,   273,
-       0,   261,     0,     0,   262,     0,   442,   274,   263,   264,
-     265,     0,   266,     0,     0,   267,   268,   269,   270,     0,
-     275,     0,     0,     0,   271,   272,     0,   261,     0,   273,
-     262,     0,   443,   274,   263,   264,   265,     0,   266,     0,
-       0,   267,   268,   269,   270,     0,   275,     0,     0,     0,
-     271,   272,     0,     0,     0,   273,     0,   261,     0,     0,
-     262,     0,   444,   274,   263,   264,   265,     0,   266,     0,
-       0,   267,   268,   269,   270,     0,   275,     0,     0,     0,
-     271,   272,     0,   261,     0,   273,   262,     0,     0,   274,
-     263,   264,   265,     0,   266,     0,     0,   267,   268,   269,
-     270,   261,   275,   445,   262,     0,   271,   272,   263,   264,
-     265,   273,   266,     0,     0,   267,   268,   269,   270,   274,
-       0,   446,     0,     0,   271,   272,     0,   261,     0,   273,
-     262,     0,   275,     0,   263,   264,   265,     0,   266,     0,
-       0,   267,   268,   269,   270,   274,     0,   518,     0,     0,
-     271,   272,     0,     0,     0,   273,     0,   261,   275,     0,
-     262,     0,     0,   274,   263,   264,   265,     0,   266,     0,
-       0,   267,   268,   269,   270,     0,   275,   519,     0,     0,
-     271,   272,     0,   261,     0,   273,   262,     0,     0,   274,
-     263,   264,   265,     0,   266,     0,     0,   267,   268,   269,
-     270,   261,   275,   575,   262,     0,   271,   272,   263,   264,
-     265,   273,   266,     0,     0,   267,   268,   269,   270,   274,
-       0,   578,     0,     0,   271,   272,     0,   261,     0,   273,
-     262,     0,   275,     0,   263,   264,   265,     0,   266,     0,
-       0,   267,   268,   269,   270,   274,     0,   687,     0,     0,
-     271,   272,     0,     0,     0,   273,     0,   261,   275,     0,
-     262,     0,     0,   274,   263,   264,   265,     0,   266,     0,
-       0,   267,   268,   269,   270,     0,   275,   727,     0,     0,
-     271,   272,     0,   261,     0,   273,   262,     0,     0,   274,
-     263,   264,   265,     0,   266,     0,     0,   267,   268,   269,
-     270,   261,   275,   769,   262,     0,   271,   272,   263,   264,
-     265,   273,   266,     0,     0,   267,   268,   269,   270,   274,
-       0,     0,   770,     0,   271,   272,     0,   261,     0,   273,
-     262,     0,   275,     0,   263,   264,   265,     0,   266,     0,
-       0,   267,   268,   269,   270,   274,     0,   928,     0,     0,
-     271,   272,     0,     0,     0,   273,     0,   261,   275,     0,
-     262,     0,     0,   274,   263,   264,   265,     0,   266,     0,
-       0,   267,   268,   269,   270,     0,   275,     0,   929,     0,
-     271,   272,     0,   261,     0,   273,   262,     0,     0,   274,
-     263,   264,   265,     0,   266,     0,     0,   267,   268,   269,
-     270,     0,   275,     0,     0,     0,   271,   272,     0,   821,
-       0,   273,   822,     0,     0,     0,     0,     0,     0,   274,
+       0,     0,     0,     0,     0,     0,   150,   151,   152,   153,
+     154,   155,   156,   157,     0,   161,     0,     0,     0,     0,
+       0,     0,     0,   162,     0,     0,     0,     0,     0,   550,
+       0,   163,     0,     0,   263,     0,     0,   264,     0,   161,
+       0,   265,   266,   267,     0,   268,     0,   162,   269,   270,
+     271,   272,   146,     0,   341,   163,     0,   273,   274,     0,
+       0,   148,   275,     0,     0,     0,  -125,     0,     0,     0,
+       0,   551,    79,    80,     0,    81,   118,   119,   120,   121,
+     122,   123,     0,     0,     0,     0,   150,   151,   152,   153,
+     154,   155,   156,   157,     0,     0,    79,    80,   276,    81,
+     118,   119,   120,   121,   122,   123,   552,     0,   821,     0,
+       0,   277,     0,     0,   146,     0,     0,     0,     0,   161,
+       0,     0,     0,   148,     0,     0,     0,   162,   822,     0,
+       0,     0,     0,     0,     0,   163,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,   150,   151,
+     152,   153,   154,   155,   156,   157,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,   275,     0,     0,     0,     0,     0,   823,     0,
-       0,     0,     0,     0,     0,   274,     0,     0,     0,   824,
-     825,   826,   827,   828,     0,   829,   830,     0,   275,     0,
-       0,     0,     0,     0,     0,     0,   831,   832,   833,   834,
-     835,   836,   837,   838,   839,   840,   841,   842,   843,   844,
-     845,   846
+       0,     0,     0,     0,     0,     0,    79,    80,     0,    81,
+       0,   161,     0,     0,   263,     0,     0,   264,     0,   162,
+       0,   265,   266,   267,     0,   268,     0,   163,   269,   270,
+     271,   272,   263,     0,   358,   264,     0,   273,   274,   265,
+     266,   267,   275,   268,     0,     0,   269,   270,   271,   272,
+       0,     0,   375,     0,     0,   273,   274,     0,     0,     0,
+     275,     0,     0,     0,     0,     0,     0,     0,    79,    80,
+       0,    81,   118,   119,   120,   121,   122,   123,   276,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     263,   277,     0,   264,     0,   402,   276,   265,   266,   267,
+       0,   268,     0,     0,   269,   270,   271,   272,     0,   277,
+       0,     0,     0,   273,   274,     0,   263,   436,   275,   264,
+       0,     0,     0,   265,   266,   267,     0,   268,     0,     0,
+     269,   270,   271,   272,     0,     0,     0,     0,     0,   273,
+     274,     0,   263,     0,   275,   264,     0,     0,     0,   265,
+     266,   267,     0,   268,   276,     0,   269,   270,   271,   272,
+       0,     0,   442,     0,     0,   273,   274,   277,   263,     0,
+     275,   264,     0,     0,     0,   265,   266,   267,     0,   268,
+     276,     0,   269,   270,   271,   272,     0,     0,   444,     0,
+       0,   273,   274,   277,   263,     0,   275,   264,     0,     0,
+       0,   265,   266,   267,     0,   268,   276,     0,   269,   270,
+     271,   272,     0,     0,   445,     0,     0,   273,   274,   277,
+     263,     0,   275,   264,     0,     0,     0,   265,   266,   267,
+       0,   268,   276,     0,   269,   270,   271,   272,     0,     0,
+     446,     0,     0,   273,   274,   277,   263,     0,   275,   264,
+       0,     0,     0,   265,   266,   267,     0,   268,   276,     0,
+     269,   270,   271,   272,     0,     0,   448,     0,     0,   273,
+     274,   277,   263,     0,   275,   264,     0,     0,     0,   265,
+     266,   267,     0,   268,   276,     0,   269,   270,   271,   272,
+       0,     0,   449,     0,     0,   273,   274,   277,   263,     0,
+     275,   264,     0,   450,     0,   265,   266,   267,     0,   268,
+     276,     0,   269,   270,   271,   272,     0,     0,     0,     0,
+       0,   273,   274,   277,   263,     0,   275,   264,     0,   451,
+       0,   265,   266,   267,     0,   268,   276,     0,   269,   270,
+     271,   272,     0,     0,     0,     0,     0,   273,   274,   277,
+     263,     0,   275,   264,     0,   452,     0,   265,   266,   267,
+       0,   268,   276,     0,   269,   270,   271,   272,     0,     0,
+       0,     0,     0,   273,   274,   277,   263,     0,   275,   264,
+       0,     0,     0,   265,   266,   267,     0,   268,   276,     0,
+     269,   270,   271,   272,     0,     0,   453,     0,     0,   273,
+     274,   277,   263,     0,   275,   264,     0,     0,     0,   265,
+     266,   267,     0,   268,   276,     0,   269,   270,   271,   272,
+       0,     0,   454,     0,     0,   273,   274,   277,   263,     0,
+     275,   264,     0,     0,     0,   265,   266,   267,     0,   268,
+     276,     0,   269,   270,   271,   272,     0,     0,   534,     0,
+       0,   273,   274,   277,   263,     0,   275,   264,     0,     0,
+       0,   265,   266,   267,     0,   268,   276,     0,   269,   270,
+     271,   272,     0,     0,   535,     0,     0,   273,   274,   277,
+     263,     0,   275,   264,     0,     0,     0,   265,   266,   267,
+       0,   268,   276,     0,   269,   270,   271,   272,     0,     0,
+     599,     0,     0,   273,   274,   277,   263,     0,   275,   264,
+       0,     0,     0,   265,   266,   267,     0,   268,   276,     0,
+     269,   270,   271,   272,     0,     0,   602,     0,     0,   273,
+     274,   277,   263,     0,   275,   264,     0,     0,     0,   265,
+     266,   267,     0,   268,   276,     0,   269,   270,   271,   272,
+       0,     0,   718,     0,     0,   273,   274,   277,   263,     0,
+     275,   264,     0,     0,     0,   265,   266,   267,     0,   268,
+     276,     0,   269,   270,   271,   272,     0,     0,   763,     0,
+       0,   273,   274,   277,   263,     0,   275,   264,     0,     0,
+       0,   265,   266,   267,     0,   268,   276,     0,   269,   270,
+     271,   272,     0,     0,   819,     0,     0,   273,   274,   277,
+     263,     0,   275,   264,     0,     0,     0,   265,   266,   267,
+       0,   268,   276,     0,   269,   270,   271,   272,     0,     0,
+       0,   820,     0,   273,   274,   277,   263,     0,   275,   264,
+       0,     0,     0,   265,   266,   267,     0,   268,   276,     0,
+     269,   270,   271,   272,     0,     0,   975,     0,     0,   273,
+     274,   277,   263,     0,   275,   264,     0,     0,     0,   265,
+     266,   267,     0,   268,   276,     0,   269,   270,   271,   272,
+       0,     0,     0,   976,     0,   273,   274,   277,   263,     0,
+     275,   264,     0,     0,     0,   265,   266,   267,     0,   268,
+     276,     0,   269,   270,   271,   272,     0,     0,     0,     0,
+       0,   273,   274,   277,   872,     0,   275,   873,     0,     0,
+       0,     0,     0,     0,     0,     0,   276,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   277,
+       0,     0,     0,     0,     0,   874,     0,     0,     0,     0,
+       0,     0,   276,     0,     0,     0,   875,   876,   877,   878,
+     879,     0,   880,   881,     0,   277,     0,     0,     0,     0,
+       0,     0,     0,   882,   883,   884,   885,   886,   887,   888,
+     889,   890,   891,   892,   893,   894,   895,   896,   897
 };
 
 static const yytype_int16 yycheck[] =
 {
-      18,   447,    58,    55,   351,    69,    15,    18,   114,    64,
-     228,   336,   616,   464,   600,    70,   795,   192,   650,   209,
-     209,   303,   464,     5,   682,     1,   781,     8,   416,   210,
-       1,   137,   209,   416,     1,   216,    14,   585,   586,   587,
-     588,     1,    16,   798,    16,    17,    49,    10,    32,   411,
-     416,    69,     5,   109,   686,    24,    66,   113,     9,   111,
-     140,   125,   852,    66,   854,     9,    24,   392,    16,    66,
-      22,   907,   124,    70,   154,    24,   144,    29,    67,   135,
-     971,    59,   138,    92,   102,   976,    75,    56,   106,   107,
-     108,   102,   696,    14,   726,   106,   107,   108,    14,     5,
-      49,    37,   427,   284,    28,   211,   757,   125,   944,   497,
-      16,    84,    90,   303,   497,    51,    14,    66,   569,   909,
-       0,   227,    28,   405,    48,   115,   303,   785,   490,    98,
-      69,   497,   812,   681,   189,   187,    45,    50,    59,   149,
-     150,    89,   800,    59,   117,    54,    97,   116,    61,   753,
-     139,   332,   907,    97,   157,   806,   140,   167,   151,   152,
-     153,    59,   813,   141,   943,    14,   184,   101,   104,   224,
-      80,   140,   143,   184,   230,   156,   955,   283,   566,   151,
-     154,   144,   158,   566,   202,    95,   125,   469,   141,   944,
-     980,   209,    90,   160,   103,   557,   558,   157,   158,   157,
-     160,    14,   653,   144,   222,   223,   224,   225,   157,   191,
-      59,   222,   223,   224,   225,   405,    31,    71,   898,    64,
-     141,   901,   397,    16,    36,   141,   416,    42,   405,   117,
-     881,   421,   421,   157,   158,    40,   160,    49,   256,   416,
-      55,    90,    56,   141,   421,    58,     9,    40,    61,   574,
-     431,   157,   158,   911,   160,   161,   162,   163,   164,   165,
-     166,    24,     1,   625,   282,   547,   852,   718,    83,    40,
-     209,   282,   149,   150,   878,   465,   718,   639,    17,   469,
-      71,    24,   291,    96,    98,   303,   476,    71,   101,   947,
-     167,    30,   469,   117,    37,    71,    61,    81,   350,   476,
-     239,   114,   116,   157,   158,   853,   160,   497,    51,   527,
-     167,     1,   169,    14,   972,     5,   948,   101,    71,    59,
-     497,   869,   773,   927,   712,   713,   140,   345,    81,   712,
-     713,   773,    71,     1,   345,    25,   517,     5,   685,    61,
-      30,    71,    46,   533,   119,   149,   150,   453,   101,    71,
-     154,    81,   144,   417,   157,    59,   533,   547,   422,   423,
-      39,   104,    30,   167,   303,    61,   157,   158,    61,   160,
-     547,   101,   100,   149,   150,    71,   566,     1,    71,   101,
-     432,   157,   158,    40,   160,   115,    61,   405,    81,   566,
-      14,   167,   168,    22,   170,    24,    46,    40,   416,   417,
-      29,   465,    25,   421,   422,   423,   157,   158,   101,   160,
-     149,   150,   151,   152,   153,   154,    66,    92,   157,   158,
-      70,   160,    97,    16,    99,     1,   616,     9,   167,   168,
-      10,   170,     1,     9,   452,   157,   158,     9,   160,   616,
-       9,   452,    24,    23,   154,   120,   464,   465,    24,    16,
-     468,   469,    24,    16,     5,    24,    10,   468,   476,   905,
-      16,   157,   158,    16,   160,    16,   405,   157,   158,    23,
-     160,   161,   162,   163,   164,   165,   166,   416,   417,   497,
-     161,   162,   421,   422,   423,    27,    28,     5,    16,   157,
-     158,    16,   160,   161,   162,   163,   164,   165,   166,    17,
-     564,    25,    26,   567,   568,     9,   696,    37,     1,    16,
-     528,    24,     9,    16,    16,   533,     9,    47,     9,   696,
-      24,    51,   712,   713,    37,     9,   465,    24,   583,   547,
-     469,    24,    93,    24,    47,   712,   713,   476,    51,    16,
-      24,     9,   560,   422,   423,    16,   564,    77,   566,   567,
-     568,   569,   877,    16,    77,    22,    24,    24,   497,   149,
-     150,    16,    29,   753,    77,   583,   622,   585,   586,   587,
-     588,     9,   583,    16,   104,   584,   753,   167,   168,    16,
-     170,    50,   757,    88,   154,   564,    24,   157,   567,   568,
-     160,   104,   209,   116,   533,    59,    14,   167,   616,   617,
-     140,    16,    16,    24,   660,   661,   157,   158,   547,   160,
-     161,   162,   163,   164,   165,   166,   671,   140,   141,   637,
-     143,   144,   803,    24,   119,   564,   637,   566,   567,   568,
-     569,   806,     9,     9,     1,   653,    88,   160,   813,   157,
-     158,   159,   160,   161,   162,   163,   164,   165,   166,   172,
-      17,   160,   670,   671,    60,    97,    16,    10,    24,   670,
-     671,    23,   209,   681,     1,   188,   149,   150,     5,    62,
-      16,   154,    69,    93,    23,    10,    16,   616,   696,   169,
-      97,    39,    63,   139,   167,   168,   303,   170,   878,    84,
-      23,   214,    16,    30,   712,   713,    24,   314,   315,   751,
-     718,   878,     9,    16,    71,   761,   881,   759,   161,   162,
-     163,   164,   165,   166,   653,   733,    26,   240,   736,   242,
-     243,   244,   733,   246,   247,   248,    26,    98,    24,   252,
-     253,   254,   155,    32,    32,   753,   259,   927,   261,   262,
-     263,   264,   265,   266,   267,   268,   269,   270,   271,   272,
-     927,    14,   104,    39,    97,   773,   303,   696,    25,    16,
-     167,    41,    42,   781,   782,   288,    14,   785,   167,    23,
-      50,   782,    16,   712,   713,    55,   154,   795,    90,   718,
-     798,    61,   149,   150,   151,   152,   153,   154,   405,    69,
-     157,   158,     9,   160,    95,    80,    16,    24,    23,   416,
-     167,   168,    82,   170,   421,    16,    14,    87,   139,   157,
-      91,   117,    84,   140,   753,    47,    25,   756,    24,    26,
-     157,   158,     9,   160,   161,   162,   163,   164,   165,   166,
-      14,   157,   355,   154,   773,   853,   359,   855,   117,    12,
-      13,    56,    15,   151,   855,    18,    19,   167,    21,     9,
-      16,   869,   469,   157,    27,    28,   149,   154,   405,   476,
-     878,   151,   385,   151,   144,    16,    16,    16,    97,   416,
-     393,    16,   395,   812,   421,    77,     9,    41,    42,    32,
-     497,   150,    14,   154,   823,    23,    50,    81,    23,   907,
-     829,    55,    32,    17,    24,     1,    24,    93,   837,     5,
-     918,    32,    16,   141,    10,    69,    30,   918,    14,   927,
-     397,   528,    97,    16,   167,   154,   533,    23,    82,   442,
-     443,   444,   469,    87,    30,   943,   944,   450,   653,   476,
-     547,   773,   663,   662,   712,   476,   713,   955,   903,   878,
-     537,   880,   125,   560,    27,    71,    66,    71,    19,   566,
-     497,    76,    58,   412,   191,    61,   703,   640,   710,   898,
-     311,   750,   901,   902,   988,   154,   560,   736,   585,   586,
-     587,   588,   161,   162,   163,   164,   165,   166,   955,   781,
-     144,   528,   869,   958,   853,   920,   533,   863,   927,   959,
-      96,   310,   972,   557,   480,   101,    -1,   479,   625,   616,
-     547,    -1,    -1,   151,    -1,    -1,   154,    -1,   114,   157,
-      -1,   534,   160,   560,    -1,   163,   164,   165,   166,   566,
-      -1,    -1,    -1,   962,   963,   149,   150,   151,   152,   153,
-     154,    -1,    -1,   157,   158,    -1,   160,    -1,   585,   586,
-     587,   588,    -1,   167,   168,    -1,   170,   570,    -1,    -1,
-      -1,   157,   158,   576,   160,   161,   162,   163,   164,   165,
-     166,    -1,    -1,    -1,   681,    -1,    -1,     1,    -1,   616,
-      -1,    -1,     6,    -1,    -1,    -1,    -1,    -1,    -1,   696,
-      -1,    -1,    16,    17,    -1,    19,    -1,    21,    -1,    -1,
-      11,    12,    13,    -1,    15,   712,   713,    18,    19,    20,
-      21,    35,    -1,    -1,    38,    -1,    27,    28,    -1,    -1,
-      44,    -1,    -1,    47,    -1,    12,    13,    -1,    15,   736,
-      -1,    18,    19,    57,    21,    -1,    -1,    -1,   651,   652,
-      27,    28,    -1,    -1,   681,    -1,   753,    71,    72,    73,
-      74,    75,    76,    77,    78,    66,    -1,    -1,    -1,   696,
-      -1,    85,    86,    -1,    -1,    -1,    90,    -1,    79,    -1,
-      -1,    -1,    -1,    -1,   781,   712,   713,    -1,   102,    66,
-      -1,    -1,    -1,    -1,    -1,    -1,   110,    -1,   795,    -1,
-      -1,   798,    79,    -1,   118,    -1,    -1,   121,    -1,   736,
-      -1,    -1,    -1,     1,    -1,    -1,    -1,     5,    -1,    -1,
-      -1,    -1,    -1,    -1,   138,    -1,   753,    -1,    16,    17,
-      -1,    19,    -1,    21,    -1,    -1,    -1,   151,   152,   153,
-     154,    -1,    -1,   157,   158,   159,   160,   161,   162,   163,
-     164,   165,   166,    -1,   781,    -1,   853,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   795,    57,
-      -1,   798,   869,     1,    -1,    -1,    -1,     5,    -1,    -1,
-      -1,   878,    -1,    -1,    -1,    -1,    -1,    -1,    16,    17,
-      -1,    19,    -1,    21,    -1,     1,    -1,    -1,    -1,     5,
-      -1,    89,    -1,    -1,    10,    -1,    -1,    -1,    14,    -1,
-     907,    -1,    -1,    -1,    -1,   818,   819,    23,    -1,    -1,
-      -1,    -1,    -1,    -1,    30,    -1,   853,   830,    -1,    57,
-     927,    -1,    -1,    -1,    -1,    -1,   839,   840,    -1,    -1,
-      -1,    -1,   869,    -1,    -1,    -1,   943,   944,    -1,    -1,
-     138,   878,    58,    -1,    -1,    61,    -1,    -1,   955,    -1,
-      -1,    89,    -1,   151,   152,   153,   154,    -1,    -1,   157,
-     158,   159,   160,   161,   162,   163,   164,   165,   166,    -1,
-     907,    -1,    -1,    -1,    -1,    -1,    -1,     5,    -1,    -1,
-      96,    -1,    10,    -1,    -1,   101,    -1,    -1,    16,    17,
-     927,    19,    -1,    21,    -1,    -1,    -1,    -1,   114,    -1,
-     138,    -1,    -1,    -1,    -1,    -1,   943,   944,    -1,    -1,
-      -1,    -1,    -1,   151,   152,   153,   154,    -1,   955,   157,
-     158,   159,   160,   161,   162,   163,   164,   165,   166,    57,
+      18,   342,   455,   286,   357,   192,    64,    18,    55,   472,
+      15,   212,    70,   472,   643,   230,   211,   218,   114,   424,
+     624,   713,   424,    69,     5,    58,   680,     1,    16,   419,
+     211,   609,   610,   611,   612,     1,     1,   845,   211,     1,
+      10,   137,    69,   831,    24,   305,    32,    16,    17,    50,
+       5,    69,     9,   794,    22,     9,    24,     8,   399,   150,
+     848,    29,   424,   717,   111,    82,   720,    68,   955,    14,
+      14,    14,   903,    14,   905,     0,   109,   124,    86,   125,
+     113,   433,    99,   119,   102,   437,    73,    92,   106,   107,
+     108,   102,    67,    16,   435,   106,   107,   108,   125,   728,
+      75,    14,   135,   105,   991,   138,   511,   125,   762,   511,
+      24,   150,     9,   121,   504,   856,    60,   213,    61,    63,
+      61,   155,   156,   145,   305,    28,   957,    24,    17,   592,
+      16,   189,   305,   229,   712,    24,    50,   338,   160,   173,
+     187,    28,    68,   835,   101,    89,    49,   101,    61,   511,
+      93,    94,   412,    41,    68,    41,   100,    36,   850,   145,
+     789,   105,   163,   121,   139,   211,   184,   955,   226,    92,
+      59,    50,   160,   184,   118,   149,   163,   164,   530,   166,
+     150,    66,   990,   163,   589,   203,   141,   589,   157,   285,
+     580,   581,     5,   211,  1002,   241,  1027,   163,   164,   232,
+     166,   166,   164,   991,    17,   146,   224,   225,   226,   227,
+     191,   162,    41,   224,   225,   226,   227,   404,   478,   121,
+     572,   684,   167,   168,   169,   170,   171,   172,   415,   155,
+     156,   412,    47,   146,   429,    46,    63,    47,   439,   412,
+     258,    73,    14,   424,    55,    14,    61,   173,   429,   163,
+     533,   424,     1,   142,   143,    61,   429,   598,    68,   305,
+     163,   164,    72,   166,   654,    14,   284,   959,   157,   158,
+     159,   160,   123,   284,   163,   164,   165,   166,   668,     9,
+     167,   168,   169,   170,   171,   172,   150,   305,   293,    61,
+      14,   754,   473,     1,    24,   754,   107,   478,     9,   903,
+     929,     9,   994,   490,   485,   478,   155,   156,   568,   356,
+       9,   160,   485,    24,    68,  1018,    24,    57,    72,     1,
+    1023,    93,    94,    10,   173,    24,   904,  1019,   543,    73,
+     511,   163,   164,   351,   166,    17,    23,    61,   511,    83,
+     351,   995,   920,   748,   749,   974,   748,   749,    30,   163,
+     163,   164,   165,   166,   167,   168,   169,   170,   171,   172,
+     823,   105,   102,   716,   823,   461,   412,    24,   549,    93,
+      94,   104,    42,    43,   146,   119,   549,    37,   424,   425,
+     120,    51,    41,   429,   430,   431,    56,   568,    42,    43,
+      40,    73,    52,   440,   412,   568,   946,    51,   425,   949,
+      57,    71,    56,   430,   431,   145,   424,   425,   589,    63,
+       1,   429,   430,   431,    84,    24,   589,    71,     9,     9,
+      90,    73,   146,     9,    41,    73,   160,   473,    37,    25,
+      84,    83,   478,    24,    24,    83,    90,    73,    24,   485,
+      51,   642,   460,    52,    31,   102,   473,    16,   108,   460,
+      16,    22,    63,   105,   472,   473,    43,   105,    29,   477,
+     478,    16,   643,   120,    63,   511,   477,   485,     9,    56,
+     643,     9,     9,   155,   156,   157,   158,   159,   160,    63,
+     150,   163,   164,    24,   166,    63,    24,    24,   145,    73,
+      16,   173,   174,   511,   176,    73,   150,    96,    85,   108,
+     953,    16,   101,   549,   103,     1,    22,    16,    24,     5,
+       1,    24,    16,    29,    10,   173,   563,   175,     9,   155,
+     156,   105,   568,    10,    37,   124,   544,   163,   164,    25,
+     166,   549,    16,    24,    30,    48,    23,   173,   174,    52,
+     176,   587,    37,   589,   590,   591,   592,   728,    16,   607,
+     568,   732,    16,    48,    16,   728,    16,    52,    16,   732,
+     587,    16,     1,   590,   591,   583,    79,   748,   749,   587,
+     853,   589,   590,   591,   592,   748,   749,    97,    17,   163,
+     164,    16,   166,    16,    79,   163,   164,   928,   166,   607,
+      63,   609,   610,   611,   612,   108,   607,   643,   160,    51,
+      73,   163,   587,   608,   166,   590,   591,   794,   789,    91,
+      83,   173,    61,   108,   167,   168,   789,   650,   163,   164,
+     801,   166,   155,   156,    14,   643,   644,   160,   801,    38,
+      12,    13,   105,    15,    73,    91,    18,    19,   684,    21,
+     173,   174,   160,   176,   702,    27,    28,   145,   666,   167,
+     168,   169,   170,   171,   172,   666,    27,    28,   691,   692,
+     167,   168,   169,   170,   171,   172,   684,   163,   164,   856,
+     166,   167,   168,   169,   170,   171,   172,   155,   156,    25,
+      26,    16,   728,   701,   702,    16,    68,   157,   158,   159,
+     701,   702,   430,   431,   712,   173,   174,     1,   176,    81,
+     123,     5,   748,   749,    24,    24,    10,     9,   754,     9,
+     728,    91,   166,   101,   732,    62,   155,   156,   157,   158,
+     159,   160,    16,    24,   163,   164,    30,   166,    23,    10,
+     748,   749,    64,    16,   173,   174,   754,   176,    97,    23,
+     787,    71,    10,   789,   211,    16,   175,   793,   929,    31,
+     797,   769,    34,   101,   772,    40,   929,    65,   769,    86,
+      42,    43,    44,   144,    23,    16,   799,    24,     5,    51,
+       9,   789,    54,    16,    56,    24,    26,   823,    26,    16,
+     102,    12,    13,   801,    15,   161,    32,    18,    19,    71,
+      21,    28,    32,   974,    58,    14,    27,    28,   108,    40,
+      25,   974,    84,    85,   101,   823,    16,   173,    90,   173,
+      77,    23,    14,   831,   832,    16,    16,   835,   211,   160,
+      93,   832,     9,    26,    99,    16,    82,   845,   874,    24,
+     848,    23,    16,    14,   880,   117,   145,   163,   305,   144,
+      23,    95,   888,   167,   168,   169,   170,   171,   172,   116,
+      86,   121,    48,   320,   321,    25,    24,    26,     9,   163,
+     164,    14,   166,   167,   168,   169,   170,   171,   172,   160,
+     163,   157,    57,   140,   141,   173,   143,   144,   155,   121,
+       9,   160,    16,   929,    16,   931,   904,   101,   906,    16,
+      16,   157,   157,   160,    16,   906,     9,    79,   156,    32,
+     946,    24,   920,   949,   950,   172,     5,    14,   160,    23,
+     157,   929,   305,   160,    23,    32,   163,    16,    83,   166,
+      24,   188,   169,   170,   171,   172,   163,   164,   974,   166,
+     167,   168,   169,   170,   171,   172,    32,   955,    97,    16,
+       1,   101,   146,    16,     5,   412,   173,   160,   966,   216,
+     490,   404,   734,   801,   823,   966,   974,   424,   684,   694,
+     553,   693,   429,  1009,  1010,   795,   485,   748,   951,    30,
+     749,   125,   990,   991,   556,   242,    27,   244,   245,   246,
+      71,   248,   249,   250,  1002,    66,    19,   254,   255,   256,
+      76,   739,   191,   420,   261,   669,   263,   264,   265,   266,
+     267,   268,   269,   270,   271,   272,   273,   274,   786,   746,
+     317,   478,  1035,   583,   772,   831,   920,  1006,   485,   412,
+    1002,  1005,   968,   290,   904,  1019,   316,   654,   494,   580,
+     914,   424,   493,    -1,    -1,    -1,   429,    -1,    -1,    -1,
+      -1,     1,    -1,    -1,   511,     5,    17,    -1,    -1,    -1,
+      10,    -1,    -1,    -1,    -1,    -1,    16,    17,    -1,    19,
+      -1,    21,    -1,    -1,   163,   164,    26,   166,   167,   168,
+     169,   170,   171,   172,    -1,    -1,    -1,   544,    -1,    -1,
+      -1,    -1,   549,    17,    -1,   478,    -1,    -1,    59,    -1,
+      -1,    -1,   485,    -1,   361,    -1,    30,    -1,   365,    59,
+      -1,   568,   163,   164,    -1,   166,   167,   168,   169,   170,
+     171,   172,    -1,    -1,    -1,    -1,   583,    -1,   511,    -1,
+      -1,    -1,   589,    -1,   391,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    92,   400,    -1,   402,    -1,    -1,    -1,    73,
+      -1,    -1,   609,   610,   611,   612,    -1,    -1,     5,    -1,
+      -1,   544,    -1,    10,    -1,    -1,   549,    -1,    -1,    16,
+      17,    -1,    19,    -1,    21,    -1,    -1,    -1,    -1,    -1,
+      -1,   142,   143,    -1,    -1,   568,   643,    -1,    -1,    -1,
+      -1,    -1,   142,   450,   451,   452,   157,   158,   159,   160,
+     583,   458,   163,   164,   165,   166,   589,   157,   158,   159,
+     160,    -1,    59,   163,   164,   165,   166,   167,   168,   169,
+     170,   171,   172,    -1,    -1,    -1,   609,   610,   611,   612,
+      -1,   155,   156,   157,   158,   159,   160,    -1,    -1,   163,
+     164,    -1,   166,    -1,    -1,    92,    -1,    -1,    -1,   173,
+     174,    -1,   176,    -1,    -1,   712,    -1,    -1,    -1,    -1,
+     643,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     1,    -1,
+      -1,   728,     5,    -1,    -1,   732,    -1,    10,    -1,    -1,
+      -1,    14,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      23,   748,   749,   550,    -1,   142,    -1,    30,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     157,   158,   159,   160,    -1,   772,   163,   164,   165,   166,
+     167,   168,   169,   170,   171,   172,    -1,    60,    -1,   712,
+      63,    -1,   789,    -1,    -1,    -1,   593,     1,    -1,    -1,
+      -1,    -1,     6,   600,   801,   728,    -1,    -1,    -1,   732,
+      -1,    -1,    16,    17,    -1,    19,    89,    21,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   748,   749,   100,    -1,    -1,
+      -1,    35,   105,    -1,   831,    39,    -1,    -1,    -1,    -1,
+      -1,    45,    -1,    -1,    48,   118,    -1,    -1,   845,   772,
+      -1,   848,    -1,    -1,    -1,    59,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,   789,    -1,    -1,    73,
+      74,    75,    76,    77,    78,    79,    80,    -1,   801,    -1,
+      -1,    -1,    -1,    87,    88,   682,   683,    -1,    -1,    93,
+     163,   164,    -1,   166,   167,   168,   169,   170,   171,   172,
+      -1,    -1,   106,    -1,    -1,    -1,    -1,   904,   831,    -1,
+     114,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   122,    -1,
+       1,   125,   845,   920,     5,   848,    -1,    -1,    -1,    10,
+      -1,    -1,   929,    14,    -1,    -1,    -1,    -1,   142,    -1,
+      -1,    -1,    23,    -1,    -1,    -1,    -1,    -1,    -1,    30,
+      -1,    -1,    -1,   157,   158,   159,   160,    -1,   955,   163,
+     164,   165,   166,   167,   168,   169,   170,   171,   172,     1,
+      -1,    -1,    -1,     5,    -1,    -1,    -1,   974,    -1,    60,
+      -1,   904,    63,    -1,    16,    17,    -1,    19,    -1,    21,
+      -1,    -1,    -1,   990,   991,    -1,    -1,   920,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,  1002,   929,    -1,    89,     5,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   100,
+      16,    17,    -1,    19,   105,    21,    -1,    59,    24,    -1,
+      -1,    -1,   955,    -1,    -1,    -1,    -1,   118,    -1,    -1,
+      -1,    -1,    -1,     5,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,   974,    -1,    -1,    16,    17,    -1,    19,    -1,    21,
+      92,    -1,    -1,    59,    -1,    -1,    -1,   990,   991,    -1,
+      -1,    -1,   869,   870,    -1,    -1,    -1,    -1,    -1,  1002,
+      -1,    -1,   163,   164,   881,   166,   167,   168,   169,   170,
+     171,   172,    -1,   890,   891,     5,    92,    59,    -1,    -1,
+      -1,    -1,    -1,    -1,    10,    -1,    16,    17,    14,    19,
+     142,    21,    -1,    -1,    -1,    -1,    -1,    23,    -1,    25,
+      26,    -1,    -1,    -1,    -1,   157,   158,   159,   160,    -1,
+      92,   163,   164,   165,   166,   167,   168,   169,   170,   171,
+     172,    -1,    -1,    11,    12,    13,   142,    15,    -1,    59,
+      18,    19,    20,    21,    60,   117,    -1,    63,    -1,    27,
+      28,   157,   158,   159,   160,    -1,    -1,   163,   164,   165,
+     166,   167,   168,   169,   170,   171,   172,    -1,    -1,    -1,
+     142,    -1,    92,    89,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   100,   157,   158,   159,   160,   105,
+      68,   163,   164,   165,   166,   167,   168,   169,   170,   171,
+     172,    -1,   118,    81,    10,    -1,    -1,    -1,    14,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    23,    -1,    25,
+      26,    -1,   142,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   157,   158,   159,
+     160,    -1,    -1,   163,   164,   165,   166,   167,   168,   169,
+     170,   171,   172,     6,    60,    -1,    -1,    63,    -1,    73,
+      -1,    -1,    -1,    16,    17,    -1,    19,    -1,    21,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    34,    35,    89,    -1,    -1,    39,    -1,    -1,    -1,
+      -1,    -1,    45,     4,   100,    48,    -1,    -1,    -1,   105,
+      11,    12,    13,    -1,    15,    -1,    59,    18,    19,    20,
+      21,    -1,   118,    -1,    -1,    -1,    27,    28,    -1,    -1,
+      73,    74,    75,    76,    77,    78,    79,    80,    -1,    -1,
+      -1,    -1,    -1,    -1,    87,    88,    -1,    -1,    -1,    -1,
+      93,   155,   156,   157,   158,   159,   160,    -1,    -1,   163,
+     164,    -1,   166,   106,    -1,    -1,    -1,    68,    -1,   173,
+     174,   114,   176,    -1,   117,    -1,    -1,    -1,     4,   122,
+      81,     7,   125,     9,    -1,    11,    12,    13,    -1,    15,
+      -1,    -1,    18,    19,    20,    21,    -1,    -1,    24,   142,
+      -1,    27,    28,    -1,    -1,    -1,    32,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   157,   158,   159,   160,    -1,    -1,
+     163,   164,   165,   166,   167,   168,   169,   170,   171,   172,
+       6,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      16,    17,    68,    19,    -1,    21,    -1,    -1,    -1,    -1,
+      -1,    -1,    28,    -1,    -1,    81,    -1,    -1,    -1,    35,
+      -1,    -1,    -1,    39,    -1,    -1,    -1,    -1,    -1,    45,
+      -1,    -1,    48,    -1,    -1,    -1,    -1,    -1,    -1,    55,
+      -1,    -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    73,    74,    75,
+      76,    77,    78,    79,    80,    -1,    11,    12,    13,    -1,
+      15,    87,    88,    18,    19,    20,    21,    93,    -1,    -1,
+      -1,    -1,    27,    28,    -1,    -1,    -1,    -1,    -1,    -1,
+     106,    -1,     6,    -1,    -1,    -1,    -1,    -1,   114,    -1,
+      -1,    -1,    16,    17,    -1,    19,   122,    21,    -1,   125,
+      -1,    -1,    -1,    -1,    28,    -1,    -1,    -1,    -1,    -1,
+      -1,    35,    -1,    68,    -1,    39,   142,    -1,    -1,    -1,
+      -1,    45,    -1,    -1,    48,    -1,    81,    -1,    -1,    -1,
+      -1,   157,   158,   159,   160,    59,    -1,   163,   164,   165,
+     166,   167,   168,   169,   170,   171,   172,    -1,    -1,    73,
+      74,    75,    76,    77,    78,    79,    80,    -1,    -1,    -1,
+      -1,    -1,    -1,    87,    88,    -1,    -1,    -1,    -1,    93,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,   106,    -1,     6,    -1,    -1,    -1,    -1,    -1,
+     114,    -1,    -1,    -1,    16,    17,    -1,    19,   122,    21,
+      -1,   125,    24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    35,    -1,    -1,    -1,    39,   142,    -1,
+      -1,    -1,    -1,    45,    -1,    -1,    48,    -1,    -1,    -1,
+      -1,    -1,    -1,   157,   158,   159,   160,    59,    -1,   163,
+     164,   165,   166,   167,   168,   169,   170,   171,   172,    -1,
+      -1,    73,    74,    75,    76,    77,    78,    79,    80,    -1,
+      -1,    -1,    -1,    -1,    -1,    87,    88,    -1,    -1,    -1,
+      -1,    93,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   106,    -1,     6,    -1,    -1,    -1,
+      -1,    -1,   114,    -1,    -1,    -1,    16,    17,    -1,    19,
+     122,    21,    -1,   125,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    35,    -1,    -1,    -1,    39,
+     142,    -1,    -1,    -1,    -1,    45,    -1,    -1,    48,    -1,
+      -1,    -1,    -1,    -1,    -1,   157,   158,   159,   160,    59,
+      -1,   163,   164,   165,   166,   167,   168,   169,   170,   171,
+     172,    -1,    -1,    73,    74,    75,    76,    77,    78,    79,
+      80,    -1,    -1,    -1,    -1,    -1,    -1,    87,    88,    -1,
+      -1,    -1,    -1,    93,    17,    -1,    -1,    -1,    -1,    -1,
+      23,    -1,    -1,    -1,    -1,    -1,   106,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   114,    -1,    -1,    -1,    -1,    -1,
+      43,    -1,   122,    -1,    -1,   125,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    56,    -1,    17,    -1,    -1,    -1,    -1,
+      63,    -1,   142,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      73,    -1,    -1,    -1,    -1,    -1,    -1,   157,   158,   159,
+     160,    43,    -1,   163,   164,   165,   166,   167,   168,   169,
+     170,   171,   172,    96,    56,    -1,    -1,    -1,    -1,    -1,
+     103,    63,    17,    -1,    -1,    -1,    -1,    -1,    23,    -1,
+      -1,    73,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,   124,    -1,    -1,    -1,    -1,    -1,    -1,    43,    -1,
+      -1,    -1,    -1,    -1,    96,    -1,    -1,    -1,    -1,    -1,
+      -1,   103,    -1,    17,    -1,    -1,    -1,    -1,    63,    -1,
+      -1,    -1,   155,   156,   157,   158,   159,   160,    73,    -1,
+     163,   164,   124,   166,    -1,    -1,    -1,    17,    -1,    43,
+     173,   174,    -1,   176,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    96,    -1,    -1,    -1,    -1,    -1,    -1,   103,    63,
+      -1,    -1,    -1,   155,   156,   157,   158,   159,   160,    73,
+      -1,   163,   164,    -1,   166,    -1,    -1,    -1,    -1,   124,
+      -1,   173,   174,    63,   176,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    96,    73,    -1,    -1,    -1,    -1,    -1,   103,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,   157,   158,     5,   160,   161,   162,   163,   164,   165,
-     166,    -1,    -1,    -1,    16,    17,    -1,    19,    -1,    21,
-       5,    89,    24,    -1,    -1,    -1,    -1,    71,    -1,    -1,
-      -1,    16,    17,    -1,    19,    -1,    21,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     5,
-      -1,    -1,    -1,    -1,    -1,    57,    -1,    -1,    -1,    -1,
-      16,    17,    -1,    19,    -1,    21,    -1,    -1,    -1,    -1,
-     138,    -1,    57,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,   151,   152,   153,   154,    89,    -1,   157,
-     158,   159,   160,   161,   162,   163,   164,   165,   166,    -1,
-      -1,    57,    -1,    -1,    89,   149,   150,   151,   152,   153,
-     154,    -1,    -1,   157,   158,    -1,   160,    -1,    -1,    -1,
-      -1,    -1,    -1,   167,   168,    -1,   170,    -1,   113,    -1,
-      -1,    -1,    -1,    89,    -1,    -1,   138,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   151,
-     152,   153,   154,   138,    -1,   157,   158,   159,   160,   161,
-     162,   163,   164,   165,   166,    -1,   151,   152,   153,   154,
-      -1,    -1,   157,   158,   159,   160,   161,   162,   163,   164,
-     165,   166,   138,    11,    12,    13,    -1,    15,    -1,    -1,
-      18,    19,    20,    21,    -1,   151,   152,   153,   154,    27,
-      28,   157,   158,   159,   160,   161,   162,   163,   164,   165,
-     166,     6,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    16,    17,    -1,    19,    -1,    21,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    66,    34,
-      35,    -1,    -1,    38,    -1,    -1,    -1,    31,    -1,    44,
-      34,    79,    47,    -1,    -1,    -1,    -1,    41,    42,    43,
-      -1,    -1,    57,    -1,    -1,    -1,    50,    -1,    -1,    53,
-      -1,    55,    -1,    -1,    -1,    -1,    71,    72,    73,    74,
-      75,    76,    77,    78,    -1,    69,    -1,    -1,    -1,    -1,
-      85,    86,    -1,    -1,    -1,    90,    -1,    -1,    82,    83,
-      -1,    -1,    -1,    87,    -1,    -1,    -1,   102,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,   110,    -1,    -1,   113,    -1,
-      -1,    -1,    -1,   118,     4,    -1,   121,     7,    -1,   113,
-      -1,    11,    12,    13,    -1,    15,    -1,    -1,    18,    19,
-      20,    21,    -1,   138,    24,    -1,    -1,    27,    28,    -1,
-      -1,    -1,    32,    -1,    -1,    -1,   151,   152,   153,   154,
-      -1,    -1,   157,   158,   159,   160,   161,   162,   163,   164,
-     165,   166,     6,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    16,    17,    -1,    19,    66,    21,    -1,    -1,
-      -1,    -1,    -1,    -1,    28,    -1,    -1,    -1,    -1,    79,
-      -1,    35,    -1,    16,    38,    -1,    -1,    -1,    -1,    -1,
-      44,    -1,    -1,    47,    -1,    -1,    -1,    -1,    -1,    -1,
-      54,    -1,    -1,    57,    -1,    38,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    47,    -1,    -1,    71,    72,    73,
-      74,    75,    76,    77,    78,    -1,    -1,    -1,    -1,    -1,
-      -1,    85,    86,    -1,    -1,    -1,    90,    -1,    71,    72,
-      73,    74,    75,    76,    77,    78,    -1,    -1,   102,    -1,
-       6,    -1,    -1,    -1,    -1,    -1,   110,    -1,    -1,    -1,
-      16,    17,    -1,    19,   118,    21,    -1,   121,    -1,   102,
-      -1,    -1,    28,    -1,    -1,    -1,    -1,   110,    -1,    35,
-      -1,    -1,    38,    -1,   138,   118,    -1,    -1,    44,    -1,
-      -1,    47,    -1,    -1,    -1,    -1,    -1,   151,   152,   153,
-     154,    57,    -1,   157,   158,   159,   160,   161,   162,   163,
-     164,   165,   166,    -1,    -1,    71,    72,    73,    74,    75,
-      76,    77,    78,    -1,   157,   158,    -1,   160,    -1,    85,
-      86,    -1,    -1,    -1,    90,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,   102,    -1,     6,    -1,
-      -1,    -1,    -1,    -1,   110,    -1,    -1,    -1,    16,    17,
-      -1,    19,   118,    21,    -1,   121,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    35,    -1,    -1,
-      38,    -1,   138,    -1,    -1,    -1,    44,    17,    -1,    47,
-      -1,    -1,    -1,    23,    -1,   151,   152,   153,   154,    57,
-      -1,   157,   158,   159,   160,   161,   162,   163,   164,   165,
-     166,    -1,    42,    71,    72,    73,    74,    75,    76,    77,
-      78,    -1,    -1,    -1,    -1,    55,    -1,    85,    86,    -1,
-      -1,    61,    90,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    71,    -1,    17,   102,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,   110,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     118,    -1,    92,   121,    -1,    -1,    -1,    -1,    42,    99,
+     155,   156,   157,   158,   159,   160,    96,    -1,   163,   164,
+     124,   166,    -1,   103,    -1,    -1,    -1,    -1,   173,   174,
+      -1,   176,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   124,    -1,    -1,    -1,    -1,    -1,
+      -1,   155,   156,   157,   158,   159,   160,    -1,    -1,   163,
+     164,    -1,   166,    -1,    -1,    16,    17,    -1,    -1,   173,
+     174,    -1,   176,    -1,    -1,   155,   156,   157,   158,   159,
+     160,    -1,    33,   163,   164,    -1,   166,    -1,    39,    16,
+      17,    -1,    -1,   173,   174,    -1,   176,    48,    -1,    -1,
+      -1,    -1,    53,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    39,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    48,    73,    74,    75,    76,    77,    78,    79,    80,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     138,    55,    -1,    -1,    -1,    17,    -1,    61,    -1,    -1,
-     120,    23,    -1,   151,   152,   153,   154,    71,    -1,   157,
-     158,   159,   160,   161,   162,   163,   164,   165,   166,    -1,
-      42,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    92,   149,
-     150,   151,   152,   153,   154,    99,    -1,   157,   158,    61,
-     160,    -1,    -1,    -1,    -1,    -1,    -1,   167,   168,    71,
-     170,    17,    -1,    -1,    -1,    -1,   120,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    73,    74,    75,    76,
+      77,    78,    79,    80,    -1,   106,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,   114,    -1,    -1,    -1,    -1,    -1,    16,
+      -1,   122,    -1,    -1,     4,    -1,    -1,     7,    -1,   106,
+      -1,    11,    12,    13,    -1,    15,    -1,   114,    18,    19,
+      20,    21,    39,    -1,    24,   122,    -1,    27,    28,    -1,
+      -1,    48,    32,    -1,    -1,    -1,   157,    -1,    -1,    -1,
+      -1,    58,   163,   164,    -1,   166,   167,   168,   169,   170,
+     171,   172,    -1,    -1,    -1,    -1,    73,    74,    75,    76,
+      77,    78,    79,    80,    -1,    -1,   163,   164,    68,   166,
+     167,   168,   169,   170,   171,   172,    93,    -1,    33,    -1,
+      -1,    81,    -1,    -1,    39,    -1,    -1,    -1,    -1,   106,
+      -1,    -1,    -1,    48,    -1,    -1,    -1,   114,    53,    -1,
+      -1,    -1,    -1,    -1,    -1,   122,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    73,    74,
+      75,    76,    77,    78,    79,    80,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      92,    -1,    -1,    -1,    -1,    -1,    42,    99,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,   149,   150,   151,   152,   153,
-     154,    -1,    -1,   157,   158,    61,   160,    17,   120,    -1,
-       4,    -1,    -1,   167,   168,    71,   170,    11,    12,    13,
-      -1,    15,    -1,    -1,    18,    19,    20,    21,    -1,    -1,
-      -1,    -1,    -1,    27,    28,    -1,    92,   149,   150,   151,
-     152,   153,   154,    99,    -1,   157,   158,    -1,   160,    -1,
-      -1,    61,    -1,    -1,    -1,   167,   168,    -1,   170,    -1,
-      -1,    71,    -1,    -1,   120,    -1,    -1,    -1,    -1,    16,
-      17,    -1,    66,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    92,    -1,    -1,    79,    33,    -1,    -1,    99,
-      -1,    38,    -1,   149,   150,   151,   152,   153,   154,    -1,
-      47,   157,   158,    -1,   160,    52,    -1,    -1,    -1,    -1,
-     120,   167,   168,    -1,   170,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    71,    72,    73,    74,    75,    76,
-      77,    78,    -1,    -1,    16,    17,    -1,    -1,    -1,   149,
-     150,   151,   152,   153,   154,    -1,    -1,   157,   158,    -1,
-     160,    -1,    -1,    -1,    -1,   102,    38,   167,   168,    -1,
-     170,    -1,    -1,   110,    -1,    47,    -1,    -1,    -1,    -1,
-      -1,   118,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    71,
-      72,    73,    74,    75,    76,    77,    78,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,   151,    -1,    -1,    -1,    -1,    -1,
-     157,   158,    -1,   160,   161,   162,   163,   164,   165,   166,
-     102,    33,    -1,    -1,    -1,    -1,    38,    -1,   110,    -1,
-      -1,    -1,    -1,    -1,    -1,    47,   118,    -1,    -1,    -1,
-      52,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    71,
-      72,    73,    74,    75,    76,    77,    78,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,   157,   158,    -1,   160,   161,
-     162,   163,   164,   165,   166,    -1,    -1,    -1,    -1,    -1,
-     102,    -1,    -1,    -1,     4,    -1,    -1,     7,   110,     9,
-      -1,    11,    12,    13,    -1,    15,   118,    -1,    18,    19,
+      -1,    -1,    -1,    -1,    -1,    -1,   163,   164,    -1,   166,
+      -1,   106,    -1,    -1,     4,    -1,    -1,     7,    -1,   114,
+      -1,    11,    12,    13,    -1,    15,    -1,   122,    18,    19,
       20,    21,     4,    -1,    24,     7,    -1,    27,    28,    11,
       12,    13,    32,    15,    -1,    -1,    18,    19,    20,    21,
       -1,    -1,    24,    -1,    -1,    27,    28,    -1,    -1,    -1,
-      32,    -1,    -1,    -1,    -1,   157,   158,    -1,   160,   161,
-     162,   163,   164,   165,   166,    -1,    66,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     4,    79,
-      -1,     7,    -1,    -1,    66,    11,    12,    13,    -1,    15,
-      -1,    -1,    18,    19,    20,    21,    -1,    79,    24,    -1,
-       4,    27,    28,     7,    -1,     9,    32,    11,    12,    13,
-      -1,    15,    -1,    -1,    18,    19,    20,    21,     4,     5,
-      -1,     7,    -1,    27,    28,    11,    12,    13,    32,    15,
-      -1,    -1,    18,    19,    20,    21,    -1,    -1,    -1,    -1,
-      66,    27,    28,    -1,    -1,    -1,    32,    -1,    -1,     4,
-      -1,    -1,     7,    79,    -1,    -1,    11,    12,    13,    -1,
-      15,    -1,    66,    18,    19,    20,    21,    -1,    -1,    24,
-      -1,    -1,    27,    28,    -1,    79,    -1,    32,    -1,    -1,
-      66,     4,    -1,    -1,     7,    -1,    -1,    -1,    11,    12,
-      13,    -1,    15,    79,    -1,    18,    19,    20,    21,     4,
-      -1,    24,     7,    -1,    27,    28,    11,    12,    13,    32,
-      15,    66,    -1,    18,    19,    20,    21,    -1,    -1,    24,
-      -1,    -1,    27,    28,    79,     4,    -1,    32,     7,    -1,
-      -1,    -1,    11,    12,    13,    -1,    15,    -1,    -1,    18,
-      19,    20,    21,    66,    -1,    24,    -1,    -1,    27,    28,
-      -1,    -1,    -1,    32,    -1,     4,    79,    -1,     7,    -1,
-      -1,    66,    11,    12,    13,    -1,    15,    -1,    -1,    18,
-      19,    20,    21,    -1,    79,    24,    -1,    -1,    27,    28,
-      -1,     4,    -1,    32,     7,    -1,    -1,    66,    11,    12,
-      13,    -1,    15,    -1,    -1,    18,    19,    20,    21,    -1,
-      79,    24,    -1,    -1,    27,    28,    -1,    -1,    -1,    32,
-      -1,     4,    -1,    -1,     7,    -1,     9,    66,    11,    12,
-      13,    -1,    15,    -1,    -1,    18,    19,    20,    21,    -1,
-      79,    -1,    -1,    -1,    27,    28,    -1,     4,    -1,    32,
-       7,    -1,     9,    66,    11,    12,    13,    -1,    15,    -1,
-      -1,    18,    19,    20,    21,    -1,    79,    -1,    -1,    -1,
-      27,    28,    -1,    -1,    -1,    32,    -1,     4,    -1,    -1,
-       7,    -1,     9,    66,    11,    12,    13,    -1,    15,    -1,
-      -1,    18,    19,    20,    21,    -1,    79,    -1,    -1,    -1,
-      27,    28,    -1,     4,    -1,    32,     7,    -1,    -1,    66,
-      11,    12,    13,    -1,    15,    -1,    -1,    18,    19,    20,
-      21,     4,    79,    24,     7,    -1,    27,    28,    11,    12,
-      13,    32,    15,    -1,    -1,    18,    19,    20,    21,    66,
-      -1,    24,    -1,    -1,    27,    28,    -1,     4,    -1,    32,
-       7,    -1,    79,    -1,    11,    12,    13,    -1,    15,    -1,
-      -1,    18,    19,    20,    21,    66,    -1,    24,    -1,    -1,
-      27,    28,    -1,    -1,    -1,    32,    -1,     4,    79,    -1,
-       7,    -1,    -1,    66,    11,    12,    13,    -1,    15,    -1,
-      -1,    18,    19,    20,    21,    -1,    79,    24,    -1,    -1,
-      27,    28,    -1,     4,    -1,    32,     7,    -1,    -1,    66,
-      11,    12,    13,    -1,    15,    -1,    -1,    18,    19,    20,
-      21,     4,    79,    24,     7,    -1,    27,    28,    11,    12,
-      13,    32,    15,    -1,    -1,    18,    19,    20,    21,    66,
-      -1,    24,    -1,    -1,    27,    28,    -1,     4,    -1,    32,
-       7,    -1,    79,    -1,    11,    12,    13,    -1,    15,    -1,
-      -1,    18,    19,    20,    21,    66,    -1,    24,    -1,    -1,
-      27,    28,    -1,    -1,    -1,    32,    -1,     4,    79,    -1,
-       7,    -1,    -1,    66,    11,    12,    13,    -1,    15,    -1,
-      -1,    18,    19,    20,    21,    -1,    79,    24,    -1,    -1,
-      27,    28,    -1,     4,    -1,    32,     7,    -1,    -1,    66,
-      11,    12,    13,    -1,    15,    -1,    -1,    18,    19,    20,
-      21,     4,    79,    24,     7,    -1,    27,    28,    11,    12,
-      13,    32,    15,    -1,    -1,    18,    19,    20,    21,    66,
-      -1,    -1,    25,    -1,    27,    28,    -1,     4,    -1,    32,
-       7,    -1,    79,    -1,    11,    12,    13,    -1,    15,    -1,
-      -1,    18,    19,    20,    21,    66,    -1,    24,    -1,    -1,
-      27,    28,    -1,    -1,    -1,    32,    -1,     4,    79,    -1,
-       7,    -1,    -1,    66,    11,    12,    13,    -1,    15,    -1,
-      -1,    18,    19,    20,    21,    -1,    79,    -1,    25,    -1,
-      27,    28,    -1,     4,    -1,    32,     7,    -1,    -1,    66,
-      11,    12,    13,    -1,    15,    -1,    -1,    18,    19,    20,
-      21,    -1,    79,    -1,    -1,    -1,    27,    28,    -1,    65,
-      -1,    32,    68,    -1,    -1,    -1,    -1,    -1,    -1,    66,
+      32,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   163,   164,
+      -1,   166,   167,   168,   169,   170,   171,   172,    68,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    79,    -1,    -1,    -1,    -1,    -1,    94,    -1,
-      -1,    -1,    -1,    -1,    -1,    66,    -1,    -1,    -1,   105,
-     106,   107,   108,   109,    -1,   111,   112,    -1,    79,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,   122,   123,   124,   125,
-     126,   127,   128,   129,   130,   131,   132,   133,   134,   135,
-     136,   137
+       4,    81,    -1,     7,    -1,     9,    68,    11,    12,    13,
+      -1,    15,    -1,    -1,    18,    19,    20,    21,    -1,    81,
+      -1,    -1,    -1,    27,    28,    -1,     4,     5,    32,     7,
+      -1,    -1,    -1,    11,    12,    13,    -1,    15,    -1,    -1,
+      18,    19,    20,    21,    -1,    -1,    -1,    -1,    -1,    27,
+      28,    -1,     4,    -1,    32,     7,    -1,    -1,    -1,    11,
+      12,    13,    -1,    15,    68,    -1,    18,    19,    20,    21,
+      -1,    -1,    24,    -1,    -1,    27,    28,    81,     4,    -1,
+      32,     7,    -1,    -1,    -1,    11,    12,    13,    -1,    15,
+      68,    -1,    18,    19,    20,    21,    -1,    -1,    24,    -1,
+      -1,    27,    28,    81,     4,    -1,    32,     7,    -1,    -1,
+      -1,    11,    12,    13,    -1,    15,    68,    -1,    18,    19,
+      20,    21,    -1,    -1,    24,    -1,    -1,    27,    28,    81,
+       4,    -1,    32,     7,    -1,    -1,    -1,    11,    12,    13,
+      -1,    15,    68,    -1,    18,    19,    20,    21,    -1,    -1,
+      24,    -1,    -1,    27,    28,    81,     4,    -1,    32,     7,
+      -1,    -1,    -1,    11,    12,    13,    -1,    15,    68,    -1,
+      18,    19,    20,    21,    -1,    -1,    24,    -1,    -1,    27,
+      28,    81,     4,    -1,    32,     7,    -1,    -1,    -1,    11,
+      12,    13,    -1,    15,    68,    -1,    18,    19,    20,    21,
+      -1,    -1,    24,    -1,    -1,    27,    28,    81,     4,    -1,
+      32,     7,    -1,     9,    -1,    11,    12,    13,    -1,    15,
+      68,    -1,    18,    19,    20,    21,    -1,    -1,    -1,    -1,
+      -1,    27,    28,    81,     4,    -1,    32,     7,    -1,     9,
+      -1,    11,    12,    13,    -1,    15,    68,    -1,    18,    19,
+      20,    21,    -1,    -1,    -1,    -1,    -1,    27,    28,    81,
+       4,    -1,    32,     7,    -1,     9,    -1,    11,    12,    13,
+      -1,    15,    68,    -1,    18,    19,    20,    21,    -1,    -1,
+      -1,    -1,    -1,    27,    28,    81,     4,    -1,    32,     7,
+      -1,    -1,    -1,    11,    12,    13,    -1,    15,    68,    -1,
+      18,    19,    20,    21,    -1,    -1,    24,    -1,    -1,    27,
+      28,    81,     4,    -1,    32,     7,    -1,    -1,    -1,    11,
+      12,    13,    -1,    15,    68,    -1,    18,    19,    20,    21,
+      -1,    -1,    24,    -1,    -1,    27,    28,    81,     4,    -1,
+      32,     7,    -1,    -1,    -1,    11,    12,    13,    -1,    15,
+      68,    -1,    18,    19,    20,    21,    -1,    -1,    24,    -1,
+      -1,    27,    28,    81,     4,    -1,    32,     7,    -1,    -1,
+      -1,    11,    12,    13,    -1,    15,    68,    -1,    18,    19,
+      20,    21,    -1,    -1,    24,    -1,    -1,    27,    28,    81,
+       4,    -1,    32,     7,    -1,    -1,    -1,    11,    12,    13,
+      -1,    15,    68,    -1,    18,    19,    20,    21,    -1,    -1,
+      24,    -1,    -1,    27,    28,    81,     4,    -1,    32,     7,
+      -1,    -1,    -1,    11,    12,    13,    -1,    15,    68,    -1,
+      18,    19,    20,    21,    -1,    -1,    24,    -1,    -1,    27,
+      28,    81,     4,    -1,    32,     7,    -1,    -1,    -1,    11,
+      12,    13,    -1,    15,    68,    -1,    18,    19,    20,    21,
+      -1,    -1,    24,    -1,    -1,    27,    28,    81,     4,    -1,
+      32,     7,    -1,    -1,    -1,    11,    12,    13,    -1,    15,
+      68,    -1,    18,    19,    20,    21,    -1,    -1,    24,    -1,
+      -1,    27,    28,    81,     4,    -1,    32,     7,    -1,    -1,
+      -1,    11,    12,    13,    -1,    15,    68,    -1,    18,    19,
+      20,    21,    -1,    -1,    24,    -1,    -1,    27,    28,    81,
+       4,    -1,    32,     7,    -1,    -1,    -1,    11,    12,    13,
+      -1,    15,    68,    -1,    18,    19,    20,    21,    -1,    -1,
+      -1,    25,    -1,    27,    28,    81,     4,    -1,    32,     7,
+      -1,    -1,    -1,    11,    12,    13,    -1,    15,    68,    -1,
+      18,    19,    20,    21,    -1,    -1,    24,    -1,    -1,    27,
+      28,    81,     4,    -1,    32,     7,    -1,    -1,    -1,    11,
+      12,    13,    -1,    15,    68,    -1,    18,    19,    20,    21,
+      -1,    -1,    -1,    25,    -1,    27,    28,    81,     4,    -1,
+      32,     7,    -1,    -1,    -1,    11,    12,    13,    -1,    15,
+      68,    -1,    18,    19,    20,    21,    -1,    -1,    -1,    -1,
+      -1,    27,    28,    81,    67,    -1,    32,    70,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    68,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    81,
+      -1,    -1,    -1,    -1,    -1,    98,    -1,    -1,    -1,    -1,
+      -1,    -1,    68,    -1,    -1,    -1,   109,   110,   111,   112,
+     113,    -1,   115,   116,    -1,    81,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,   126,   127,   128,   129,   130,   131,   132,
+     133,   134,   135,   136,   137,   138,   139,   140,   141
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const yytype_uint16 yystos[] =
 {
-       0,     1,   143,   176,   144,   178,   179,     0,    31,    34,
-      41,    42,    43,    50,    53,    55,    69,    82,    83,    87,
-     113,   177,   187,   189,   193,   195,   198,   318,   319,   320,
-     322,   324,   326,   328,   330,   331,   332,   333,   340,   342,
-     343,   344,   345,   346,   347,   348,   356,   359,   362,   363,
-      36,    49,   180,   184,   101,   199,    61,   337,   430,   431,
-      71,    81,   101,   115,   339,   194,    46,    59,   336,   196,
-     339,    46,    66,    70,   335,   338,   207,   208,    71,   157,
-     158,   160,   315,   316,   429,   337,    45,    54,   103,   144,
-     188,    42,    55,   144,   319,    10,   144,   432,     1,   160,
-     181,   185,   117,   200,    64,   207,    40,    40,   117,   431,
-      14,   252,   336,   430,   325,     5,    16,    28,   161,   162,
-     163,   164,   165,   166,   197,   281,   282,   290,   291,   292,
-     294,   315,    71,    81,   101,   431,   335,   321,   430,   338,
-       6,    16,    17,    19,    21,    35,    38,    44,    47,    57,
-      71,    72,    73,    74,    75,    76,    77,    78,    85,    86,
-      90,   102,   110,   118,   121,   138,   151,   152,   153,   154,
-     159,   287,   288,   289,   290,   296,   301,   304,   309,   310,
-     311,   315,   317,    16,    40,   119,   329,   190,   191,   339,
-     144,   341,   157,   100,   186,    71,   429,    14,    59,    90,
-     141,   201,   202,   210,    39,   429,   429,   429,   207,   253,
-     200,   327,   207,   252,   295,   296,   200,   282,    22,    29,
-     313,   314,    40,    40,    84,   117,   207,   323,   252,   207,
-     430,   296,    34,   189,   296,    25,   296,   296,    16,    16,
-      16,   302,    16,    16,    16,   303,    16,    16,    16,    16,
-      16,   296,    16,    16,    16,    16,     8,   156,    28,    54,
-     296,     4,     7,    11,    12,    13,    15,    18,    19,    20,
-      21,    27,    28,    32,    66,    79,    16,    89,   306,   307,
-     154,   429,    93,    50,   200,    28,   192,   285,   286,   296,
-      42,    55,   342,   151,   154,   157,   160,   182,   183,   291,
-       1,   158,   360,   212,    88,    59,    14,   315,   140,   154,
-     140,   357,    16,    17,    19,    21,    89,   254,   255,   258,
-     274,   280,   290,   293,   294,   309,   310,   311,   315,   317,
-     210,   252,   200,   334,   296,    24,   209,   210,     1,   157,
-     158,   160,   429,   429,   429,   431,   429,   252,   334,   207,
-     299,   300,    24,   290,   296,    16,   296,   296,   296,    16,
-     296,   296,   296,   296,   296,   296,   315,    24,   296,    24,
-     296,   296,   296,   296,   296,   296,   296,   296,   296,   296,
-     296,   296,   161,   162,   298,   297,   296,   308,    24,   119,
-     429,   252,   210,     9,   296,     9,   339,     9,   160,   365,
-     231,   256,   257,   258,    88,   211,    97,   203,    60,   419,
-     420,    16,   421,   419,   365,    24,   276,   275,   309,   309,
-      23,    10,   260,   259,    62,   213,   214,   210,     5,   213,
-     429,   200,   190,    24,    24,   296,    24,    24,    24,   296,
-      24,    24,     9,     9,     9,    24,    24,    16,   296,     1,
-       9,    24,    93,    69,   213,   296,   296,   183,    14,    59,
-     141,   413,    23,    14,    58,    61,    96,   101,   114,   232,
-     233,   235,   239,   242,   245,   246,    10,   231,    16,   169,
-       9,    97,   349,    66,   149,   150,   167,   422,   423,   424,
-     426,   428,   349,    97,   353,    14,   274,   278,   279,   280,
-       1,    30,   262,   273,   283,   290,   294,   315,   258,   261,
-     262,   262,    39,    63,   218,   213,   210,   200,    24,    24,
-     296,   296,   296,   308,     1,   296,   429,   252,   361,   167,
-     169,    16,   154,   243,    16,   301,   305,   315,   284,   290,
-     294,   315,   317,     1,    14,    84,   429,    10,   231,   139,
-     256,    23,   204,   421,   420,    16,    24,     9,   428,    16,
-     358,    24,   279,    25,    26,   277,   263,    26,    26,   215,
-     219,    98,   220,    24,   210,    24,     9,    24,    24,    24,
-     334,    17,    23,    42,    55,    61,    92,    99,   120,   168,
-     170,   309,   310,   363,   364,   375,   376,   378,   382,   388,
-     390,   391,   409,   410,   427,   428,   429,    32,    32,   155,
-     189,   229,   231,   296,   307,   240,   234,   236,   247,   231,
-      14,    24,   157,   205,   206,   104,    24,    37,    51,   104,
-     350,   351,   424,   425,   428,    24,    37,    47,    51,    77,
-     104,   354,   355,   375,     1,    25,   273,     1,   265,   266,
-     279,    16,    17,   216,   217,   290,   301,   305,   296,    39,
-      80,    95,   226,   228,    97,   267,   213,   296,    25,   429,
-     431,   339,   410,   410,   410,   410,    10,    23,    97,   391,
-     414,   389,    16,   167,   167,   230,    23,    24,    14,   229,
-      28,    48,   312,   315,    16,   250,   244,   207,     9,    24,
-     425,   154,   352,     9,    24,    90,   429,   154,   428,   352,
-       9,    24,   264,     9,   267,   296,   296,   217,   221,   207,
-     207,   227,   228,   225,   226,    16,    24,    24,    32,   140,
-     429,   101,   429,   431,   392,    23,   377,    16,    14,     1,
-      17,    30,   394,   396,   408,   410,   417,   418,   427,   367,
-     366,   190,   267,   241,   237,    49,    66,   157,   251,   248,
-     229,   157,   139,   351,    91,   355,   265,     1,   266,    24,
-      25,    33,    52,   222,   223,   224,   290,   301,   305,   268,
-     267,   383,   117,   140,   429,    47,   406,   378,    24,    56,
-      98,   116,   140,   415,   416,   384,    25,    26,   397,    24,
-       9,   368,   368,   200,   229,    14,   157,   271,   290,   182,
-      24,    49,    66,   157,   200,   207,   154,   223,    16,    17,
-     151,    65,    68,    94,   105,   106,   107,   108,   109,   111,
-     112,   122,   123,   124,   125,   126,   127,   128,   129,   130,
-     131,   132,   133,   134,   135,   136,   137,   269,   270,   272,
-     385,   387,   390,   409,   429,   117,    71,   315,   427,   393,
-     151,    56,   167,     9,    24,    23,   379,   380,   382,   395,
-       1,   398,   400,   409,   427,   149,   369,   210,   238,   182,
-       9,   157,   271,   182,    14,   296,   296,   154,   157,   160,
-     167,   290,   290,   296,   154,   151,   151,   290,    16,   296,
-     296,    16,    16,     9,    24,    16,   414,   408,   414,   429,
-      16,    77,   407,   416,    10,    23,   396,     9,    32,   405,
-     401,   150,   370,   213,   229,   290,   182,   249,    24,    25,
-     271,   271,   154,   290,   270,   308,    14,   400,   414,   154,
-     154,   427,    23,   381,   399,   429,   406,    81,    23,   229,
-      24,    24,    24,    24,    24,   386,    24,   382,   400,   402,
-     427,   267,    32,    32,   379,   405,   407,    93,   371,   290,
-     290,   403,    16,    97,   372,   411,   412,   413,   418,    16,
-     404,   413,    24,   167,   373,   374,   414,   154,     9,    24,
-     374
+       0,     1,   149,   182,   150,   184,   185,     0,    31,    34,
+      42,    43,    44,    51,    54,    56,    71,    84,    85,    90,
+     117,   183,   193,   195,   199,   201,   204,   340,   341,   342,
+     344,   346,   348,   350,   352,   353,   354,   355,   362,   364,
+     365,   366,   367,   368,   369,   370,   378,   381,   384,   385,
+      36,    50,   186,   190,   105,   205,    63,   359,   452,   453,
+      73,    83,   105,   119,   361,   200,    47,    61,   358,   202,
+     361,    47,    68,    72,   357,   360,   213,   214,    73,   163,
+     164,   166,   337,   338,   451,   359,    46,    55,   107,   150,
+     194,    43,    56,   150,   341,    10,   150,   454,     1,   166,
+     187,   191,   121,   206,    66,   213,    41,    41,   121,   453,
+      14,   274,   358,   452,   347,     5,    16,    28,   167,   168,
+     169,   170,   171,   172,   203,   303,   304,   312,   313,   314,
+     316,   337,    73,    83,   105,   453,   357,   343,   452,   360,
+       6,    16,    17,    19,    21,    35,    39,    45,    48,    59,
+      73,    74,    75,    76,    77,    78,    79,    80,    87,    88,
+      93,   106,   114,   122,   125,   142,   157,   158,   159,   160,
+     165,   309,   310,   311,   312,   318,   323,   326,   331,   332,
+     333,   337,   339,    16,    41,   123,   351,   196,   197,   361,
+     150,   363,   163,   104,   192,    73,   451,    14,    61,    93,
+      94,   146,   207,   208,   216,   219,    40,   451,   451,   451,
+     213,   275,   206,   349,   213,   274,   317,   318,   206,   304,
+      22,    29,   335,   336,    41,    41,    86,   121,   213,   345,
+     274,   213,   452,   318,    34,   195,   318,    25,   318,   318,
+      16,    16,    16,   324,    16,    16,    16,   325,    16,    16,
+      16,    16,    16,   318,    16,    16,    16,    16,     8,   162,
+      28,    55,   318,     4,     7,    11,    12,    13,    15,    18,
+      19,    20,    21,    27,    28,    32,    68,    81,    16,    92,
+     328,   329,   160,   451,    97,    51,   206,    28,   198,   307,
+     308,   318,    43,    56,   364,   157,   160,   163,   166,   188,
+     189,   313,     1,   164,   382,   218,    91,    61,    91,    14,
+     337,    38,   220,   221,   145,   160,   145,   379,    16,    17,
+      19,    21,    92,   276,   277,   280,   296,   302,   312,   315,
+     316,   331,   332,   333,   337,   339,   219,   274,   206,   356,
+     318,    24,   215,   219,     1,   163,   164,   166,   451,   451,
+     451,   453,   451,   274,   356,   213,   321,   322,    24,   312,
+     318,    16,   318,   318,   318,    16,   318,   318,   318,   318,
+     318,   318,   337,    24,   318,    24,   318,   318,   318,   318,
+     318,   318,   318,   318,   318,   318,   318,   318,   167,   168,
+     320,   319,    24,   318,   330,    24,   123,   451,   274,   216,
+       9,   318,     9,   361,     9,   166,   387,   249,   278,   279,
+     280,    91,   217,   101,   209,   222,    62,   441,   442,    16,
+     443,   441,   387,    24,   298,   297,   331,   331,    23,    10,
+     282,   281,    64,   231,   232,   219,     5,   231,   451,   206,
+     196,    24,    24,   318,    24,    24,    24,   318,    24,    24,
+       9,     9,     9,    24,    24,    16,   318,     1,     9,    24,
+      97,    71,   231,   318,   318,   189,    14,    61,   146,   435,
+      23,    14,    60,    63,    89,   100,   105,   118,   250,   251,
+     253,   257,   260,   263,   267,    10,   249,    16,   167,   168,
+     224,   225,   313,   175,     9,   101,   371,    68,   155,   156,
+     173,   444,   445,   446,   448,   450,   371,   101,   375,    14,
+     296,   300,   301,   302,     1,    30,   284,   295,   305,   312,
+     316,   337,   280,   283,   284,   284,    40,   220,    65,   236,
+     231,   220,   219,   206,    24,    24,   318,   318,   318,   330,
+       1,   318,   451,   274,   383,   173,   175,    16,   160,   261,
+      16,    58,    93,   264,   323,   327,   337,   306,   312,   316,
+     337,   339,   265,   266,     1,    14,    86,   451,    10,   249,
+     144,   278,    23,   210,    14,   225,   443,   442,    16,    24,
+       9,   450,    16,   380,    24,   301,    25,    26,   299,   285,
+      26,    26,   233,   237,   102,   238,   220,    24,   216,    24,
+       9,    24,    24,    24,   356,    17,    23,    43,    56,    63,
+      96,   103,   124,   174,   176,   331,   332,   385,   386,   397,
+     398,   400,   404,   410,   412,   413,   431,   432,   449,   450,
+     451,    32,    32,   161,   195,   247,   249,   318,    58,   265,
+     329,   258,   206,   252,   254,   268,   249,    14,   220,    24,
+     163,   211,   212,   223,   108,    24,    37,    52,   108,   372,
+     373,   446,   447,   450,    24,    37,    48,    52,    79,   108,
+     376,   377,   397,     1,    10,    25,   295,     1,   287,   288,
+     301,    10,    16,    17,   234,   235,   312,   323,   327,   318,
+      40,    82,    99,   244,   246,   101,   289,   231,   318,    25,
+     451,   453,   361,   432,   432,   432,   432,    10,    23,   101,
+     413,   436,   411,    16,   173,   173,   248,    23,    24,    14,
+     219,   247,    28,    49,   334,   337,    16,   271,   262,   213,
+       9,    24,    16,   226,   227,   228,   447,   160,   374,     9,
+      24,    93,   451,   160,   450,   374,     9,    24,   286,     9,
+     289,   318,   318,   235,   239,   213,   213,   245,   246,   243,
+     244,    16,    24,    24,    32,   145,   451,   105,   451,   453,
+     414,    23,   399,    16,    14,     1,    17,    30,   416,   418,
+     430,   432,   439,   440,   449,   389,   388,   196,   289,   259,
+     289,   255,    50,    68,   163,   272,   273,   269,   247,   163,
+     143,   229,   230,   331,   332,   333,   337,   339,    23,   228,
+     144,   373,    95,   377,   287,     1,    10,    26,   288,    24,
+      25,    33,    53,   240,   241,   242,   312,   323,   327,   290,
+     289,   405,   121,   145,   451,    48,   428,   400,    24,    57,
+     102,   120,   145,   437,   438,   406,    25,    26,   419,    24,
+       9,   390,   390,   206,   247,    14,   163,    28,   293,   312,
+     188,    24,   273,   206,   213,    24,   230,   160,   241,    16,
+      17,   157,    67,    70,    98,   109,   110,   111,   112,   113,
+     115,   116,   126,   127,   128,   129,   130,   131,   132,   133,
+     134,   135,   136,   137,   138,   139,   140,   141,   291,   292,
+     294,   407,   409,   412,   431,   451,   121,    73,   337,   449,
+     415,   157,    57,   173,     9,    24,    23,   401,   402,   404,
+     417,     1,   420,   422,   431,   449,   155,   391,   216,   256,
+     188,     9,    14,   318,   318,   160,   163,   166,   173,   312,
+     312,   318,   160,   157,   157,   312,    16,   318,   318,    16,
+      16,     9,    24,    16,   436,   430,   436,   451,    16,    79,
+     429,   438,    10,    23,   418,     9,    32,   427,   423,   156,
+     392,   231,   247,   312,   270,    24,    25,   293,   293,   160,
+     312,   292,   330,    14,   422,   436,   160,   160,   449,    23,
+     403,   421,   451,   428,    83,    23,   247,    24,    24,    24,
+      24,    24,   408,    24,   404,   422,   424,   449,   289,    32,
+      32,   401,   427,   429,    97,   393,   312,   312,   425,    16,
+     101,   394,   433,   434,   435,   440,    16,   426,   435,    24,
+     173,   395,   396,   436,   160,     9,    24,   396
 };
 
 #define yyerrok		(yyerrstatus = 0)
@@ -3282,14 +3414,14 @@ yyreduce:
         case 2:
 
 /* Line 1455 of yacc.c  */
-#line 507 "./sparql_p.y"
+#line 525 "./sparql_p.y"
     { sparp_arg->sparp_expr = (yyval.tree) = (yyvsp[(3) - (4)].tree); }
     break;
 
   case 3:
 
 /* Line 1455 of yacc.c  */
-#line 508 "./sparql_p.y"
+#line 526 "./sparql_p.y"
     {
 		sparp_arg->sparp_expr = (yyval.tree) = spar_make_topmost_sparul_sql (sparp_arg,
 		  (SPART **)t_revlist_to_array ((yyvsp[(3) - (4)].backstack)) ); }
@@ -3298,7 +3430,7 @@ yyreduce:
   case 4:
 
 /* Line 1455 of yacc.c  */
-#line 511 "./sparql_p.y"
+#line 529 "./sparql_p.y"
     {
 		sparp_arg->sparp_expr = (yyval.tree) = spar_make_topmost_sparul_sql (sparp_arg,
 		  (SPART **)t_list (0) ); }
@@ -3307,7 +3439,7 @@ yyreduce:
   case 5:
 
 /* Line 1455 of yacc.c  */
-#line 514 "./sparql_p.y"
+#line 532 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_topmost_qm_sql (sparp_arg);
 		sparp_arg->sparp_expr = (yyval.tree); }
@@ -3316,35 +3448,35 @@ yyreduce:
   case 6:
 
 /* Line 1455 of yacc.c  */
-#line 517 "./sparql_p.y"
+#line 535 "./sparql_p.y"
     { sparyyerror ("(internal SPARQL processing error) SPARQL mark expected"); }
     break;
 
   case 12:
 
 /* Line 1455 of yacc.c  */
-#line 534 "./sparql_p.y"
+#line 552 "./sparql_p.y"
     { ; }
     break;
 
   case 13:
 
 /* Line 1455 of yacc.c  */
-#line 535 "./sparql_p.y"
+#line 553 "./sparql_p.y"
     { ; }
     break;
 
   case 14:
 
 /* Line 1455 of yacc.c  */
-#line 539 "./sparql_p.y"
+#line 557 "./sparql_p.y"
     { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_VIRTSPECIFIC, "DEFINE"); }
     break;
 
   case 15:
 
 /* Line 1455 of yacc.c  */
-#line 540 "./sparql_p.y"
+#line 558 "./sparql_p.y"
     {
 		dk_set_t vals = (yyvsp[(4) - (4)].backstack);
 		while (NULL != vals) {
@@ -3356,63 +3488,63 @@ yyreduce:
   case 16:
 
 /* Line 1455 of yacc.c  */
-#line 549 "./sparql_p.y"
+#line 567 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
     break;
 
   case 17:
 
 /* Line 1455 of yacc.c  */
-#line 550 "./sparql_p.y"
+#line 568 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (3)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].tree)); }
     break;
 
   case 18:
 
 /* Line 1455 of yacc.c  */
-#line 554 "./sparql_p.y"
+#line 572 "./sparql_p.y"
     { (yyval.tree) = (SPART *)t_list (2, QNAME, (yyvsp[(1) - (1)].box)); }
     break;
 
   case 19:
 
 /* Line 1455 of yacc.c  */
-#line 555 "./sparql_p.y"
+#line 573 "./sparql_p.y"
     { (yyval.tree) = (SPART *)t_list (2, Q_IRI_REF, (yyvsp[(1) - (1)].box)); }
     break;
 
   case 20:
 
 /* Line 1455 of yacc.c  */
-#line 556 "./sparql_p.y"
+#line 574 "./sparql_p.y"
     { (yyval.tree) = (SPART *)t_list (2, SPARQL_STRING, (yyvsp[(1) - (1)].box)); }
     break;
 
   case 21:
 
 /* Line 1455 of yacc.c  */
-#line 557 "./sparql_p.y"
+#line 575 "./sparql_p.y"
     { (yyval.tree) = (SPART *)t_list (2, SPARQL_INTEGER, (yyvsp[(1) - (1)].box)); }
     break;
 
   case 22:
 
 /* Line 1455 of yacc.c  */
-#line 558 "./sparql_p.y"
+#line 576 "./sparql_p.y"
     { (yyval.tree) = (SPART *)t_list (2, SPAR_VARIABLE, (caddr_t)(yyvsp[(1) - (1)].tree)); }
     break;
 
   case 23:
 
 /* Line 1455 of yacc.c  */
-#line 562 "./sparql_p.y"
+#line 580 "./sparql_p.y"
     { ; }
     break;
 
   case 24:
 
 /* Line 1455 of yacc.c  */
-#line 563 "./sparql_p.y"
+#line 581 "./sparql_p.y"
     {
 		if (NULL != sparp_env()->spare_base_uri)
 		  sparyyerror ("Only one base declaration is allowed");
@@ -3422,30 +3554,30 @@ yyreduce:
   case 25:
 
 /* Line 1455 of yacc.c  */
-#line 567 "./sparql_p.y"
+#line 585 "./sparql_p.y"
     { sparyyerror ("Missing <iri-string> after BASE keyword"); }
     break;
 
   case 26:
 
 /* Line 1455 of yacc.c  */
-#line 571 "./sparql_p.y"
+#line 589 "./sparql_p.y"
     { ; }
     break;
 
   case 27:
 
 /* Line 1455 of yacc.c  */
-#line 572 "./sparql_p.y"
+#line 590 "./sparql_p.y"
     { ; }
     break;
 
   case 28:
 
 /* Line 1455 of yacc.c  */
-#line 576 "./sparql_p.y"
+#line 594 "./sparql_p.y"
     {
-                if (!strcmp ("sql:", (yyvsp[(2) - (3)].box)) || !strcmp ("bif:", (yyvsp[(2) - (3)].box)))
+		if ((!strcmp ("sql:", (yyvsp[(2) - (3)].box)) && strcmp ("sql:", (yyvsp[(3) - (3)].box))) || (!strcmp ("bif:", (yyvsp[(2) - (3)].box)) && strcmp ("bif:", (yyvsp[(3) - (3)].box))))
 		  sparyyerror ("Prefixes 'sql:' and 'bif:' are reserved for SQL names");
 		t_set_push (&(sparp_env()->spare_namespace_prefixes), sparp_expand_q_iri_ref (sparp_arg, (yyvsp[(3) - (3)].box)));
 		t_set_push (&(sparp_env()->spare_namespace_prefixes), t_box_dv_short_nchars ((yyvsp[(2) - (3)].box), box_length ((yyvsp[(2) - (3)].box))-2)); }
@@ -3454,31 +3586,31 @@ yyreduce:
   case 29:
 
 /* Line 1455 of yacc.c  */
-#line 581 "./sparql_p.y"
+#line 599 "./sparql_p.y"
     { sparyyerror ("Missing <namespace-iri-string> in PREFIX declaration"); }
     break;
 
   case 30:
 
 /* Line 1455 of yacc.c  */
-#line 582 "./sparql_p.y"
+#line 600 "./sparql_p.y"
     { sparyyerror ("Missing namespace prefix after PREFIX keyword"); }
     break;
 
   case 31:
 
 /* Line 1455 of yacc.c  */
-#line 587 "./sparql_p.y"
+#line 605 "./sparql_p.y"
     {
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
                 t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
-		sparp_arg->sparp_allow_aggregates_in_expn++; }
+		sparp_arg->sparp_allow_aggregates_in_expn |= 1; }
     break;
 
   case 32:
 
 /* Line 1455 of yacc.c  */
-#line 592 "./sparql_p.y"
+#line 610 "./sparql_p.y"
     {
 		SPART *where_gp = spar_gp_finalize (sparp_arg, NULL);
 		SPART *wm = (yyvsp[(6) - (6)].tree);
@@ -3492,63 +3624,63 @@ yyreduce:
   case 33:
 
 /* Line 1455 of yacc.c  */
-#line 603 "./sparql_p.y"
+#line 621 "./sparql_p.y"
     { (yyval.token_type) = SELECT_L; }
     break;
 
   case 34:
 
 /* Line 1455 of yacc.c  */
-#line 604 "./sparql_p.y"
+#line 622 "./sparql_p.y"
     { (yyval.token_type) = SELECT_L; }
     break;
 
   case 35:
 
 /* Line 1455 of yacc.c  */
-#line 605 "./sparql_p.y"
+#line 623 "./sparql_p.y"
     { (yyval.token_type) = DISTINCT_L; }
     break;
 
   case 36:
 
 /* Line 1455 of yacc.c  */
-#line 606 "./sparql_p.y"
+#line 624 "./sparql_p.y"
     { (yyval.token_type) = COUNT_DISTINCT_L; }
     break;
 
   case 37:
 
 /* Line 1455 of yacc.c  */
-#line 610 "./sparql_p.y"
+#line 628 "./sparql_p.y"
     { (yyval.token_type) = sparp_arg->sparp_rset_lexdepth_plus_1; sparp_arg->sparp_rset_lexdepth_plus_1 = sparp_arg->sparp_lexdepth + 1; }
     break;
 
   case 38:
 
 /* Line 1455 of yacc.c  */
-#line 611 "./sparql_p.y"
+#line 629 "./sparql_p.y"
     { sparp_arg->sparp_rset_lexdepth_plus_1 = (yyvsp[(1) - (2)].token_type); (yyval.trees) = (yyvsp[(2) - (2)].trees); }
     break;
 
   case 39:
 
 /* Line 1455 of yacc.c  */
-#line 615 "./sparql_p.y"
+#line 633 "./sparql_p.y"
     { (yyval.trees) = (SPART **) _STAR; }
     break;
 
   case 40:
 
 /* Line 1455 of yacc.c  */
-#line 617 "./sparql_p.y"
+#line 635 "./sparql_p.y"
     { (yyval.trees) = (SPART **) t_revlist_to_array ((yyvsp[(1) - (1)].backstack)); }
     break;
 
   case 41:
 
 /* Line 1455 of yacc.c  */
-#line 618 "./sparql_p.y"
+#line 636 "./sparql_p.y"
     {
 		SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_VIRTSPECIFIC, "comma-delimited list of result set expressions");
 		(yyval.trees) = (SPART **) t_revlist_to_array ((yyvsp[(1) - (1)].backstack)); }
@@ -3557,7 +3689,7 @@ yyreduce:
   case 42:
 
 /* Line 1455 of yacc.c  */
-#line 624 "./sparql_p.y"
+#line 642 "./sparql_p.y"
     {
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
                 t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); }
@@ -3566,23 +3698,23 @@ yyreduce:
   case 43:
 
 /* Line 1455 of yacc.c  */
-#line 628 "./sparql_p.y"
+#line 646 "./sparql_p.y"
     {
                 const char *formatter, *agg_formatter, *agg_mdata;
 		SPART *where_gp = spar_gp_finalize (sparp_arg, NULL);
-		SPART *wm = (yyvsp[(6) - (6)].tree);
+		SPART *wm = (yyvsp[(6) - (7)].tree);
 		caddr_t retselid = spar_selid_pop (sparp_arg);
 		wm->_.wm.where_gp = where_gp;
 		(yyval.tree) = spar_make_top_or_special_case_from_wm (sparp_arg, CONSTRUCT_L, NULL,
                   retselid, wm );
                 ssg_find_formatter_by_name_and_subtype ((yyval.tree)->_.req_top.formatmode_name, CONSTRUCT_L, &formatter, &agg_formatter, &agg_mdata);
-                spar_compose_retvals_of_construct (sparp_arg, (yyval.tree), (yyvsp[(3) - (6)].tree), formatter, agg_formatter, agg_mdata); }
+                spar_compose_retvals_of_construct (sparp_arg, (yyval.tree), (yyvsp[(3) - (7)].tree), formatter, agg_formatter, agg_mdata); }
     break;
 
   case 44:
 
 /* Line 1455 of yacc.c  */
-#line 642 "./sparql_p.y"
+#line 660 "./sparql_p.y"
     {
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
                 t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); }
@@ -3591,36 +3723,36 @@ yyreduce:
   case 45:
 
 /* Line 1455 of yacc.c  */
-#line 646 "./sparql_p.y"
+#line 664 "./sparql_p.y"
     {
 		SPART * where_gp = spar_gp_finalize (sparp_arg, NULL);
-		SPART *wm = (yyvsp[(6) - (6)].tree);
+		SPART *wm = (yyvsp[(6) - (7)].tree);
 		caddr_t retselid = spar_selid_pop (sparp_arg);
 		wm->_.wm.where_gp = where_gp;
-		(yyval.tree) = spar_make_top_or_special_case_from_wm (sparp_arg, DESCRIBE_L, (yyvsp[(3) - (6)].trees),
+		(yyval.tree) = spar_make_top_or_special_case_from_wm (sparp_arg, DESCRIBE_L, (yyvsp[(3) - (7)].trees),
                   retselid, wm );
-		if (((SPART **)_STAR == (yyvsp[(3) - (6)].trees)) && (SPAR_REQ_TOP == (yyval.tree)->type))
+		if (((SPART **)_STAR == (yyvsp[(3) - (7)].trees)) && (SPAR_REQ_TOP == (yyval.tree)->type))
 		  sparp_expand_top_retvals (sparp_arg, (yyval.tree), 0 /* never cloned, hence 0 == safely_copy_all_vars */); }
     break;
 
   case 46:
 
 /* Line 1455 of yacc.c  */
-#line 658 "./sparql_p.y"
+#line 676 "./sparql_p.y"
     { (yyval.trees) = (SPART **) _STAR; }
     break;
 
   case 47:
 
 /* Line 1455 of yacc.c  */
-#line 659 "./sparql_p.y"
+#line 677 "./sparql_p.y"
     { (yyval.trees) = (SPART **) t_list_to_array ((yyvsp[(1) - (1)].backstack)); }
     break;
 
   case 48:
 
 /* Line 1455 of yacc.c  */
-#line 663 "./sparql_p.y"
+#line 681 "./sparql_p.y"
     {
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
                 t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); }
@@ -3629,7 +3761,7 @@ yyreduce:
   case 49:
 
 /* Line 1455 of yacc.c  */
-#line 667 "./sparql_p.y"
+#line 685 "./sparql_p.y"
     {
 		SPART * where_gp = spar_gp_finalize (sparp_arg, NULL);
 		(yyval.tree) = spar_make_top (sparp_arg, ASK_L, (SPART **)t_list(0), spar_selid_pop (sparp_arg),
@@ -3639,21 +3771,21 @@ yyreduce:
   case 50:
 
 /* Line 1455 of yacc.c  */
-#line 674 "./sparql_p.y"
+#line 692 "./sparql_p.y"
     { }
     break;
 
   case 51:
 
 /* Line 1455 of yacc.c  */
-#line 675 "./sparql_p.y"
+#line 693 "./sparql_p.y"
     { }
     break;
 
   case 52:
 
 /* Line 1455 of yacc.c  */
-#line 683 "./sparql_p.y"
+#line 701 "./sparql_p.y"
     {
 		sparp_make_and_push_new_graph_source (sparp_arg, (yyvsp[(1) - (3)].token_type), (yyvsp[(2) - (3)].tree), (yyvsp[(3) - (3)].trees)); }
     break;
@@ -3661,568 +3793,731 @@ yyreduce:
   case 53:
 
 /* Line 1455 of yacc.c  */
-#line 688 "./sparql_p.y"
+#line 706 "./sparql_p.y"
     { (yyval.token_type) = SPART_GRAPH_FROM; }
     break;
 
   case 54:
 
 /* Line 1455 of yacc.c  */
-#line 689 "./sparql_p.y"
+#line 707 "./sparql_p.y"
     { (yyval.token_type) = SPART_GRAPH_NAMED; }
     break;
 
   case 55:
 
 /* Line 1455 of yacc.c  */
-#line 690 "./sparql_p.y"
+#line 708 "./sparql_p.y"
     { (yyval.token_type) = SPART_GRAPH_NOT_FROM; }
     break;
 
   case 56:
 
 /* Line 1455 of yacc.c  */
-#line 691 "./sparql_p.y"
+#line 709 "./sparql_p.y"
     { (yyval.token_type) = SPART_GRAPH_NOT_NAMED; }
     break;
 
   case 57:
 
 /* Line 1455 of yacc.c  */
-#line 695 "./sparql_p.y"
-    { (yyval.trees) = NULL; }
+#line 710 "./sparql_p.y"
+    { (yyval.token_type) = SPART_GRAPH_NOT_FROM; }
     break;
 
   case 58:
 
 /* Line 1455 of yacc.c  */
-#line 696 "./sparql_p.y"
-    { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_OPTION, "OPTION () sponge configuration"); }
+#line 711 "./sparql_p.y"
+    { (yyval.token_type) = SPART_GRAPH_NOT_NAMED; }
     break;
 
   case 59:
 
 /* Line 1455 of yacc.c  */
-#line 697 "./sparql_p.y"
-    { (yyval.trees) = (yyvsp[(4) - (4)].trees); }
+#line 715 "./sparql_p.y"
+    { (yyval.trees) = NULL; }
     break;
 
   case 60:
 
 /* Line 1455 of yacc.c  */
-#line 701 "./sparql_p.y"
-    { (yyval.trees) = (SPART **)t_list (0); }
+#line 716 "./sparql_p.y"
+    { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_OPTION, "OPTION () sponge configuration"); }
     break;
 
   case 61:
 
 /* Line 1455 of yacc.c  */
-#line 702 "./sparql_p.y"
-    { (yyval.trees) = (SPART **)t_revlist_to_array ((yyvsp[(1) - (2)].backstack)); }
+#line 717 "./sparql_p.y"
+    { (yyval.trees) = (yyvsp[(4) - (4)].trees); }
     break;
 
   case 62:
 
 /* Line 1455 of yacc.c  */
-#line 706 "./sparql_p.y"
-    {	/* [Virt]	SpongeOption	 ::=  QNAME PrecodeExpn */
-		(yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (2)].box)); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].tree)); }
+#line 721 "./sparql_p.y"
+    { (yyval.trees) = (SPART **)t_list (0); }
     break;
 
   case 63:
 
 /* Line 1455 of yacc.c  */
-#line 708 "./sparql_p.y"
-    {
-		(yyval.backstack) = (yyvsp[(1) - (4)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(3) - (4)].box)); t_set_push (&((yyval.backstack)), (yyvsp[(4) - (4)].tree)); }
+#line 722 "./sparql_p.y"
+    { (yyval.trees) = (SPART **)t_revlist_to_array ((yyvsp[(1) - (2)].backstack)); }
     break;
 
   case 64:
 
 /* Line 1455 of yacc.c  */
-#line 713 "./sparql_p.y"
-    { sparp_arg->sparp_in_precode_expn = 1; }
+#line 726 "./sparql_p.y"
+    {	/* [Virt]	SpongeOption	 ::=  QNAME PrecodeExpn */
+		(yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (2)].box)); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].tree)); }
     break;
 
   case 65:
 
 /* Line 1455 of yacc.c  */
-#line 715 "./sparql_p.y"
-    { sparp_arg->sparp_in_precode_expn = 0; (yyval.tree) = (yyvsp[(2) - (2)].tree); }
+#line 728 "./sparql_p.y"
+    {
+		(yyval.backstack) = (yyvsp[(1) - (4)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(3) - (4)].box)); t_set_push (&((yyval.backstack)), (yyvsp[(4) - (4)].tree)); }
     break;
 
   case 66:
 
 /* Line 1455 of yacc.c  */
-#line 719 "./sparql_p.y"
-    {
-		sparp_arg->sparp_allow_aggregates_in_expn--;
-		spar_gp_init (sparp_arg, WHERE_L); }
+#line 733 "./sparql_p.y"
+    { sparp_arg->sparp_in_precode_expn = 1; }
     break;
 
   case 67:
 
 /* Line 1455 of yacc.c  */
-#line 722 "./sparql_p.y"
-    {;}
+#line 735 "./sparql_p.y"
+    { sparp_arg->sparp_in_precode_expn = 0; (yyval.tree) = (yyvsp[(2) - (2)].tree); }
     break;
 
   case 68:
 
 /* Line 1455 of yacc.c  */
-#line 726 "./sparql_p.y"
+#line 739 "./sparql_p.y"
     {
-		sparp_arg->sparp_allow_aggregates_in_expn--;
+		sparp_arg->sparp_allow_aggregates_in_expn &= ~1;
 		spar_gp_init (sparp_arg, WHERE_L); }
     break;
 
   case 69:
 
 /* Line 1455 of yacc.c  */
-#line 729 "./sparql_p.y"
+#line 742 "./sparql_p.y"
     {;}
     break;
 
   case 70:
 
 /* Line 1455 of yacc.c  */
-#line 730 "./sparql_p.y"
+#line 746 "./sparql_p.y"
     {
-		sparp_arg->sparp_allow_aggregates_in_expn--;
+		sparp_arg->sparp_allow_aggregates_in_expn &= ~1;
 		spar_gp_init (sparp_arg, WHERE_L); }
     break;
 
   case 71:
 
 /* Line 1455 of yacc.c  */
-#line 733 "./sparql_p.y"
+#line 749 "./sparql_p.y"
     {;}
     break;
 
   case 72:
 
 /* Line 1455 of yacc.c  */
-#line 738 "./sparql_p.y"
-    { (yyval.tree) = spar_make_wm (sparp_arg, NULL, (SPART **)t_revlist_to_array ((yyvsp[(1) - (3)].backstack)), (yyvsp[(2) - (3)].tree), (SPART **)t_revlist_to_array ((yyvsp[(3) - (3)].backstack)), (SPART *)t_box_num (SPARP_MAXLIMIT), (SPART *)t_box_num (0)); }
+#line 750 "./sparql_p.y"
+    {
+		sparp_arg->sparp_allow_aggregates_in_expn &= ~1;
+		spar_gp_init (sparp_arg, WHERE_L); }
     break;
 
   case 73:
 
 /* Line 1455 of yacc.c  */
-#line 739 "./sparql_p.y"
-    { (yyval.tree) = spar_make_wm (sparp_arg, NULL, (SPART **)t_revlist_to_array ((yyvsp[(1) - (5)].backstack)), (yyvsp[(2) - (5)].tree), (SPART **)t_revlist_to_array ((yyvsp[(3) - (5)].backstack)), (yyvsp[(4) - (5)].tree), (yyvsp[(5) - (5)].tree)); }
+#line 753 "./sparql_p.y"
+    {;}
     break;
 
   case 74:
 
 /* Line 1455 of yacc.c  */
-#line 740 "./sparql_p.y"
-    { (yyval.tree) = spar_make_wm (sparp_arg, NULL, (SPART **)t_revlist_to_array ((yyvsp[(1) - (5)].backstack)), (yyvsp[(2) - (5)].tree), (SPART **)t_revlist_to_array ((yyvsp[(3) - (5)].backstack)), (yyvsp[(5) - (5)].tree), (yyvsp[(4) - (5)].tree)); }
+#line 757 "./sparql_p.y"
+    {;}
     break;
 
   case 75:
 
 /* Line 1455 of yacc.c  */
-#line 744 "./sparql_p.y"
-    { (yyval.backstack) = NULL; }
+#line 761 "./sparql_p.y"
+    { (yyval.tree) = NULL; }
     break;
 
   case 76:
 
 /* Line 1455 of yacc.c  */
-#line 745 "./sparql_p.y"
-    {
-		spar_selid_push_reused (sparp_arg, sparp_arg->sparp_env->spare_top_retval_selid);
-		sparp_arg->sparp_allow_aggregates_in_expn++; }
+#line 762 "./sparql_p.y"
+    { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
   case 77:
 
 /* Line 1455 of yacc.c  */
-#line 748 "./sparql_p.y"
+#line 766 "./sparql_p.y"
     {
-		spar_selid_pop (sparp_arg); (yyval.backstack) = (yyvsp[(4) - (4)].backstack);
-		sparp_arg->sparp_allow_aggregates_in_expn--; }
+		if (NULL != sparp_arg->sparp_env->spare_bindings_vars)
+		  sparyyerror ("Only one BINDINGS clause per query is allowed");
+		spar_selid_push (sparp_arg); }
     break;
 
   case 78:
 
 /* Line 1455 of yacc.c  */
-#line 754 "./sparql_p.y"
-    { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
+#line 770 "./sparql_p.y"
+    {
+		spar_selid_pop (sparp_arg);
+		sparp_arg->sparp_env->spare_bindings_vars = (SPART **)t_revlist_to_array ((yyvsp[(3) - (4)].backstack)); }
     break;
 
   case 79:
 
 /* Line 1455 of yacc.c  */
-#line 755 "./sparql_p.y"
-    { (yyval.backstack) = (yyvsp[(1) - (2)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].tree)); }
+#line 773 "./sparql_p.y"
+    {
+		sparp_arg->sparp_env->spare_bindings_rowset = (SPART ***)t_revlist_to_array ((yyvsp[(6) - (7)].backstack));
+		(yyval.tree) = spartlist (sparp_arg, 4, SPAR_BINDINGS_INV, 0,
+			sparp_arg->sparp_env->spare_bindings_vars,
+			sparp_arg->sparp_env->spare_bindings_rowset );
+		spar_alloc_fake_equivs_for_bindings_inv (sparp_arg, (yyval.tree)); }
     break;
 
   case 80:
 
 /* Line 1455 of yacc.c  */
-#line 760 "./sparql_p.y"
-    { (yyval.tree) = (yyvsp[(2) - (3)].tree); }
+#line 782 "./sparql_p.y"
+    { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), spar_make_variable (sparp_arg, (yyvsp[(1) - (1)].tree))); }
     break;
 
   case 81:
 
 /* Line 1455 of yacc.c  */
-#line 761 "./sparql_p.y"
-    { (yyval.tree) = (yyvsp[(2) - (3)].tree); }
+#line 783 "./sparql_p.y"
+    { (yyval.backstack) = (yyvsp[(1) - (2)].backstack); t_set_push (&((yyval.backstack)), spar_make_variable (sparp_arg, (yyvsp[(2) - (2)].tree))); }
     break;
 
-  case 85:
+  case 82:
 
 /* Line 1455 of yacc.c  */
-#line 768 "./sparql_p.y"
-    { (yyval.tree) = NULL; }
+#line 787 "./sparql_p.y"
+    { ; }
     break;
 
-  case 86:
+  case 83:
 
 /* Line 1455 of yacc.c  */
-#line 769 "./sparql_p.y"
-    {
-		spar_selid_push_reused (sparp_arg, sparp_arg->sparp_env->spare_top_retval_selid);
-		sparp_arg->sparp_allow_aggregates_in_expn++; }
+#line 788 "./sparql_p.y"
+    { ; }
     break;
 
-  case 87:
+  case 84:
 
 /* Line 1455 of yacc.c  */
-#line 772 "./sparql_p.y"
-    {
-		spar_selid_pop (sparp_arg); (yyval.tree) = (yyvsp[(3) - (3)].tree);
-		sparp_arg->sparp_allow_aggregates_in_expn--; }
+#line 789 "./sparql_p.y"
+    { sparyyerror ("Global variable can not be used in the header of BINDINGS"); }
     break;
 
-  case 88:
+  case 85:
 
 /* Line 1455 of yacc.c  */
-#line 778 "./sparql_p.y"
+#line 793 "./sparql_p.y"
     { (yyval.backstack) = NULL; }
     break;
 
-  case 89:
-
-/* Line 1455 of yacc.c  */
-#line 779 "./sparql_p.y"
-    {
-		spar_selid_push_reused (sparp_arg, sparp_arg->sparp_env->spare_top_retval_selid);
-		sparp_arg->sparp_allow_aggregates_in_expn++; }
-    break;
-
-  case 90:
-
-/* Line 1455 of yacc.c  */
-#line 782 "./sparql_p.y"
-    {
-		spar_selid_pop (sparp_arg); (yyval.backstack) = (yyvsp[(4) - (4)].backstack);
-		sparp_arg->sparp_allow_aggregates_in_expn--; }
-    break;
-
-  case 91:
+  case 86:
 
 /* Line 1455 of yacc.c  */
-#line 788 "./sparql_p.y"
-    { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
+#line 794 "./sparql_p.y"
+    { (yyval.backstack) = (yyvsp[(1) - (1)].backstack); }
     break;
 
-  case 92:
+  case 87:
 
 /* Line 1455 of yacc.c  */
-#line 789 "./sparql_p.y"
-    { (yyval.backstack) = (yyvsp[(1) - (2)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].tree)); }
+#line 798 "./sparql_p.y"
+    { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].trees)); }
     break;
 
-  case 93:
+  case 88:
 
 /* Line 1455 of yacc.c  */
-#line 794 "./sparql_p.y"
-    { (yyval.tree) = spartlist (sparp_arg, 3, ORDER_L, (ptrlong)(yyvsp[(1) - (4)].token_type), (yyvsp[(3) - (4)].tree)); }
+#line 799 "./sparql_p.y"
+    { (yyval.backstack) = (yyvsp[(1) - (2)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].trees)); }
     break;
 
-  case 94:
+  case 89:
 
 /* Line 1455 of yacc.c  */
-#line 795 "./sparql_p.y"
-    { (yyval.tree) = spartlist (sparp_arg, 3, ORDER_L, (ptrlong)(yyvsp[(1) - (4)].token_type), (yyvsp[(3) - (4)].tree)); }
+#line 803 "./sparql_p.y"
+    {
+		(yyval.trees) = t_revlist_to_array ((yyvsp[(2) - (3)].backstack));
+		if (BOX_ELEMENTS ((yyval.trees)) != BOX_ELEMENTS (sparp_arg->sparp_env->spare_bindings_vars))
+		  sparyyerror ("Number of values in a binding does not match number of variables to bind"); }
     break;
 
-  case 95:
+  case 90:
 
 /* Line 1455 of yacc.c  */
-#line 796 "./sparql_p.y"
-    { (yyval.tree) = spartlist (sparp_arg, 3, ORDER_L, (ptrlong)(yyvsp[(1) - (2)].token_type), (yyvsp[(2) - (2)].box)); }
+#line 810 "./sparql_p.y"
+    {(yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 96:
+  case 91:
 
 /* Line 1455 of yacc.c  */
-#line 797 "./sparql_p.y"
-    { (yyval.tree) = spartlist (sparp_arg, 3, ORDER_L, (ptrlong)ASC_L, (yyvsp[(1) - (1)].tree)); }
+#line 811 "./sparql_p.y"
+    {(yyval.backstack) = (yyvsp[(1) - (2)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].tree)); }
     break;
 
   case 97:
 
 /* Line 1455 of yacc.c  */
-#line 798 "./sparql_p.y"
-    { (yyval.tree) = spartlist (sparp_arg, 3, ORDER_L, (ptrlong)ASC_L, (yyvsp[(1) - (1)].tree)); }
+#line 820 "./sparql_p.y"
+    {(yyval.tree) = NULL; }
     break;
 
   case 98:
 
 /* Line 1455 of yacc.c  */
-#line 799 "./sparql_p.y"
-    { (yyval.tree) = spartlist (sparp_arg, 3, ORDER_L, (ptrlong)ASC_L, (yyvsp[(1) - (1)].tree)); }
+#line 825 "./sparql_p.y"
+    { (yyval.tree) = spar_make_wm (sparp_arg, NULL, (SPART **)t_revlist_to_array ((yyvsp[(1) - (3)].backstack)), (yyvsp[(2) - (3)].tree), (SPART **)t_revlist_to_array ((yyvsp[(3) - (3)].backstack)), (SPART *)t_box_num (SPARP_MAXLIMIT), (SPART *)t_box_num (0)); }
     break;
 
   case 99:
 
 /* Line 1455 of yacc.c  */
-#line 803 "./sparql_p.y"
-    { (yyval.token_type) = ASC_L; }
+#line 826 "./sparql_p.y"
+    { (yyval.tree) = spar_make_wm (sparp_arg, NULL, (SPART **)t_revlist_to_array ((yyvsp[(1) - (5)].backstack)), (yyvsp[(2) - (5)].tree), (SPART **)t_revlist_to_array ((yyvsp[(3) - (5)].backstack)), (yyvsp[(4) - (5)].tree), (yyvsp[(5) - (5)].tree)); }
     break;
 
   case 100:
 
 /* Line 1455 of yacc.c  */
-#line 804 "./sparql_p.y"
-    { (yyval.token_type) = ASC_L; }
+#line 827 "./sparql_p.y"
+    { (yyval.tree) = spar_make_wm (sparp_arg, NULL, (SPART **)t_revlist_to_array ((yyvsp[(1) - (5)].backstack)), (yyvsp[(2) - (5)].tree), (SPART **)t_revlist_to_array ((yyvsp[(3) - (5)].backstack)), (yyvsp[(5) - (5)].tree), (yyvsp[(4) - (5)].tree)); }
     break;
 
   case 101:
 
 /* Line 1455 of yacc.c  */
-#line 805 "./sparql_p.y"
-    { (yyval.token_type) = DESC_L; }
+#line 831 "./sparql_p.y"
+    { (yyval.backstack) = NULL; }
     break;
 
   case 102:
 
 /* Line 1455 of yacc.c  */
-#line 809 "./sparql_p.y"
-    { (yyval.tree) = (SPART *)t_box_num (SPARP_MAXLIMIT); }
-    break;
-
-  case 104:
-
-/* Line 1455 of yacc.c  */
-#line 814 "./sparql_p.y"
-    { (yyval.tree) = (yyvsp[(2) - (2)].tree); }
+#line 832 "./sparql_p.y"
+    {
+		spar_selid_push_reused (sparp_arg, sparp_arg->sparp_env->spare_top_retval_selid);
+		sparp_arg->sparp_allow_aggregates_in_expn |= 1; }
     break;
 
-  case 105:
+  case 103:
 
 /* Line 1455 of yacc.c  */
-#line 818 "./sparql_p.y"
-    { (yyval.tree) = (SPART *)t_box_num (0); }
+#line 835 "./sparql_p.y"
+    {
+		spar_selid_pop (sparp_arg); (yyval.backstack) = (yyvsp[(4) - (4)].backstack);
+		sparp_arg->sparp_allow_aggregates_in_expn &= ~1; }
     break;
 
-  case 107:
+  case 104:
 
 /* Line 1455 of yacc.c  */
-#line 823 "./sparql_p.y"
-    { (yyval.tree) = (yyvsp[(2) - (2)].tree); }
+#line 841 "./sparql_p.y"
+    { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 108:
+  case 105:
 
 /* Line 1455 of yacc.c  */
-#line 827 "./sparql_p.y"
-    {
-		(yyval.tree) = spar_gp_finalize (sparp_arg, (yyvsp[(3) - (3)].trees));
-		sparp_validate_options_of_tree (sparp_arg, (yyval.tree), (yyval.tree)->_.gp.options); }
+#line 842 "./sparql_p.y"
+    { (yyval.backstack) = (yyvsp[(1) - (2)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 109:
+  case 106:
 
 /* Line 1455 of yacc.c  */
-#line 830 "./sparql_p.y"
-    {
-		SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "subquery");
-		spar_env_push (sparp_arg);
-		spar_selid_push (sparp_arg);
-                t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
-		sparp_arg->sparp_allow_aggregates_in_expn++; }
+#line 847 "./sparql_p.y"
+    { (yyval.tree) = (yyvsp[(2) - (3)].tree); }
     break;
 
-  case 110:
+  case 107:
 
 /* Line 1455 of yacc.c  */
-#line 838 "./sparql_p.y"
-    {
-		SPART *subselect_top;
-		SPART *where_gp;
-	        caddr_t retselid;
-		SPART *wm = (yyvsp[(6) - (8)].tree);
-		where_gp = spar_gp_finalize (sparp_arg, NULL);
-		retselid = spar_selid_pop (sparp_arg);
-		wm->_.wm.where_gp = where_gp;
-		subselect_top = spar_make_top_or_special_case_from_wm (sparp_arg,
-		  (yyvsp[(1) - (8)].token_type), (yyvsp[(3) - (8)].trees), retselid, wm );
-		if (SPAR_REQ_TOP == subselect_top->type)
-		  sparp_expand_top_retvals (sparp_arg, subselect_top, 1 /* safely_copy_all_vars */);
-		spar_env_pop (sparp_arg);
-		(yyval.tree) = spar_gp_finalize_with_subquery (sparp_arg, (yyvsp[(8) - (8)].trees), subselect_top); }
+#line 848 "./sparql_p.y"
+    { (yyval.tree) = (yyvsp[(2) - (3)].tree); }
     break;
 
   case 111:
 
 /* Line 1455 of yacc.c  */
 #line 855 "./sparql_p.y"
-    { }
+    { (yyval.tree) = NULL; }
     break;
 
   case 112:
 
 /* Line 1455 of yacc.c  */
 #line 856 "./sparql_p.y"
-    { }
+    {
+		spar_selid_push_reused (sparp_arg, sparp_arg->sparp_env->spare_top_retval_selid);
+		sparp_arg->sparp_allow_aggregates_in_expn |= 1; }
     break;
 
   case 113:
 
 /* Line 1455 of yacc.c  */
-#line 857 "./sparql_p.y"
-    { }
+#line 859 "./sparql_p.y"
+    {
+		spar_selid_pop (sparp_arg); (yyval.tree) = (yyvsp[(3) - (3)].tree);
+		sparp_arg->sparp_allow_aggregates_in_expn &= ~1; }
     break;
 
   case 114:
 
 /* Line 1455 of yacc.c  */
-#line 861 "./sparql_p.y"
-    { spar_gp_add_member (sparp_arg, (yyvsp[(1) - (1)].tree)); }
+#line 865 "./sparql_p.y"
+    { (yyval.backstack) = NULL; }
     break;
 
   case 115:
 
 /* Line 1455 of yacc.c  */
-#line 862 "./sparql_p.y"
-    { spar_gp_add_member (sparp_arg, (yyvsp[(1) - (1)].tree)); }
+#line 866 "./sparql_p.y"
+    {
+		spar_selid_push_reused (sparp_arg, sparp_arg->sparp_env->spare_top_retval_selid);
+		sparp_arg->sparp_allow_aggregates_in_expn |= 1; }
     break;
 
   case 116:
 
 /* Line 1455 of yacc.c  */
-#line 863 "./sparql_p.y"
-    { spar_gp_add_member (sparp_arg, (yyvsp[(1) - (1)].tree)); }
+#line 869 "./sparql_p.y"
+    {
+		spar_selid_pop (sparp_arg); (yyval.backstack) = (yyvsp[(4) - (4)].backstack);
+		sparp_arg->sparp_allow_aggregates_in_expn &= ~1; }
     break;
 
   case 117:
 
 /* Line 1455 of yacc.c  */
-#line 864 "./sparql_p.y"
-    { spar_gp_add_member (sparp_arg, (yyvsp[(1) - (1)].tree)); }
+#line 875 "./sparql_p.y"
+    { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
     break;
 
   case 118:
 
 /* Line 1455 of yacc.c  */
-#line 865 "./sparql_p.y"
-    { spar_gp_add_member (sparp_arg, (yyvsp[(1) - (1)].tree)); }
+#line 876 "./sparql_p.y"
+    { (yyval.backstack) = (yyvsp[(1) - (2)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].tree)); }
     break;
 
   case 119:
 
 /* Line 1455 of yacc.c  */
-#line 866 "./sparql_p.y"
-    { spar_gp_add_filter (sparp_arg, (yyvsp[(1) - (1)].tree)); }
+#line 881 "./sparql_p.y"
+    { (yyval.tree) = spartlist (sparp_arg, 3, ORDER_L, (ptrlong)(yyvsp[(1) - (4)].token_type), (yyvsp[(3) - (4)].tree)); }
     break;
 
   case 120:
 
 /* Line 1455 of yacc.c  */
-#line 870 "./sparql_p.y"
-    { spar_gp_init (sparp_arg, OPTIONAL_L); }
+#line 882 "./sparql_p.y"
+    { (yyval.tree) = spartlist (sparp_arg, 3, ORDER_L, (ptrlong)(yyvsp[(1) - (4)].token_type), (yyvsp[(3) - (4)].tree)); }
     break;
 
   case 121:
 
 /* Line 1455 of yacc.c  */
-#line 870 "./sparql_p.y"
-    { (yyval.tree) = (yyvsp[(4) - (4)].tree); }
+#line 883 "./sparql_p.y"
+    { (yyval.tree) = spartlist (sparp_arg, 3, ORDER_L, (ptrlong)(yyvsp[(1) - (2)].token_type), (yyvsp[(2) - (2)].box)); }
     break;
 
   case 122:
 
 /* Line 1455 of yacc.c  */
-#line 871 "./sparql_p.y"
-    { sparyyerror ("Missing '{' after OPTIONAL keyword"); }
+#line 884 "./sparql_p.y"
+    { (yyval.tree) = spartlist (sparp_arg, 3, ORDER_L, (ptrlong)ASC_L, (yyvsp[(1) - (1)].tree)); }
     break;
 
   case 123:
 
 /* Line 1455 of yacc.c  */
-#line 875 "./sparql_p.y"
-    { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_QUAD_MAP, "QUAD MAP { ... } group pattern"); }
+#line 885 "./sparql_p.y"
+    { (yyval.tree) = spartlist (sparp_arg, 3, ORDER_L, (ptrlong)ASC_L, (yyvsp[(1) - (1)].tree)); }
     break;
 
   case 124:
 
 /* Line 1455 of yacc.c  */
-#line 876 "./sparql_p.y"
-    { t_set_push (&(sparp_env()->spare_context_qms), (yyvsp[(4) - (4)].tree)); }
+#line 886 "./sparql_p.y"
+    { (yyval.tree) = spartlist (sparp_arg, 3, ORDER_L, (ptrlong)ASC_L, (yyvsp[(1) - (1)].tree)); }
     break;
 
   case 125:
 
 /* Line 1455 of yacc.c  */
-#line 877 "./sparql_p.y"
+#line 890 "./sparql_p.y"
+    { (yyval.token_type) = ASC_L; }
+    break;
+
+  case 126:
+
+/* Line 1455 of yacc.c  */
+#line 891 "./sparql_p.y"
+    { (yyval.token_type) = ASC_L; }
+    break;
+
+  case 127:
+
+/* Line 1455 of yacc.c  */
+#line 892 "./sparql_p.y"
+    { (yyval.token_type) = DESC_L; }
+    break;
+
+  case 128:
+
+/* Line 1455 of yacc.c  */
+#line 896 "./sparql_p.y"
+    { (yyval.tree) = (SPART *)t_box_num (SPARP_MAXLIMIT); }
+    break;
+
+  case 130:
+
+/* Line 1455 of yacc.c  */
+#line 901 "./sparql_p.y"
+    { (yyval.tree) = (yyvsp[(2) - (2)].tree); }
+    break;
+
+  case 131:
+
+/* Line 1455 of yacc.c  */
+#line 905 "./sparql_p.y"
+    { (yyval.tree) = (SPART *)t_box_num (0); }
+    break;
+
+  case 133:
+
+/* Line 1455 of yacc.c  */
+#line 910 "./sparql_p.y"
+    { (yyval.tree) = (yyvsp[(2) - (2)].tree); }
+    break;
+
+  case 134:
+
+/* Line 1455 of yacc.c  */
+#line 914 "./sparql_p.y"
+    {
+		(yyval.tree) = spar_gp_finalize (sparp_arg, (yyvsp[(3) - (3)].trees));
+		sparp_validate_options_of_tree (sparp_arg, (yyval.tree), (yyval.tree)->_.gp.options); }
+    break;
+
+  case 135:
+
+/* Line 1455 of yacc.c  */
+#line 917 "./sparql_p.y"
+    {
+		if (NULL == sparp_env()->spare_context_sinvs) { /* There's an exception related to codegen-time optimization SERVICE { SELECT {x}} like it is SERVICE {x}, so no error right here. */
+		    SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "subquery"); }
+		spar_env_push (sparp_arg);
+		spar_selid_push (sparp_arg);
+                t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
+		sparp_arg->sparp_allow_aggregates_in_expn <<= 1;
+		sparp_arg->sparp_allow_aggregates_in_expn |= 1; }
+    break;
+
+  case 136:
+
+/* Line 1455 of yacc.c  */
+#line 927 "./sparql_p.y"
+    {
+		SPART *subselect_top;
+		SPART *where_gp;
+	        caddr_t retselid;
+		SPART *wm = (yyvsp[(6) - (8)].tree);
+		where_gp = spar_gp_finalize (sparp_arg, NULL);
+		retselid = spar_selid_pop (sparp_arg);
+		wm->_.wm.where_gp = where_gp;
+		subselect_top = spar_make_top_or_special_case_from_wm (sparp_arg,
+		  (yyvsp[(1) - (8)].token_type), (yyvsp[(3) - (8)].trees), retselid, wm );
+		if (SPAR_REQ_TOP == subselect_top->type)
+		  sparp_expand_top_retvals (sparp_arg, subselect_top, 1 /* safely_copy_all_vars */);
+		spar_env_pop (sparp_arg);
+		(yyval.tree) = spar_gp_finalize_with_subquery (sparp_arg, (yyvsp[(8) - (8)].trees), subselect_top);
+		sparp_arg->sparp_allow_aggregates_in_expn >>= 1; }
+    break;
+
+  case 137:
+
+/* Line 1455 of yacc.c  */
+#line 945 "./sparql_p.y"
+    { }
+    break;
+
+  case 138:
+
+/* Line 1455 of yacc.c  */
+#line 946 "./sparql_p.y"
+    { }
+    break;
+
+  case 139:
+
+/* Line 1455 of yacc.c  */
+#line 947 "./sparql_p.y"
+    { }
+    break;
+
+  case 140:
+
+/* Line 1455 of yacc.c  */
+#line 951 "./sparql_p.y"
+    { spar_gp_add_member (sparp_arg, (yyvsp[(1) - (1)].tree)); }
+    break;
+
+  case 141:
+
+/* Line 1455 of yacc.c  */
+#line 952 "./sparql_p.y"
+    { spar_gp_add_member (sparp_arg, (yyvsp[(1) - (1)].tree)); }
+    break;
+
+  case 142:
+
+/* Line 1455 of yacc.c  */
+#line 953 "./sparql_p.y"
+    { spar_gp_add_member (sparp_arg, (yyvsp[(1) - (1)].tree)); }
+    break;
+
+  case 143:
+
+/* Line 1455 of yacc.c  */
+#line 954 "./sparql_p.y"
+    { spar_gp_add_member (sparp_arg, (yyvsp[(1) - (1)].tree)); }
+    break;
+
+  case 144:
+
+/* Line 1455 of yacc.c  */
+#line 955 "./sparql_p.y"
+    { spar_gp_add_member (sparp_arg, (yyvsp[(1) - (1)].tree)); }
+    break;
+
+  case 145:
+
+/* Line 1455 of yacc.c  */
+#line 956 "./sparql_p.y"
+    { spar_gp_add_filter (sparp_arg, (yyvsp[(1) - (1)].tree)); }
+    break;
+
+  case 146:
+
+/* Line 1455 of yacc.c  */
+#line 960 "./sparql_p.y"
+    { spar_gp_init (sparp_arg, OPTIONAL_L); }
+    break;
+
+  case 147:
+
+/* Line 1455 of yacc.c  */
+#line 960 "./sparql_p.y"
+    { (yyval.tree) = (yyvsp[(4) - (4)].tree); }
+    break;
+
+  case 148:
+
+/* Line 1455 of yacc.c  */
+#line 961 "./sparql_p.y"
+    { sparyyerror ("Missing '{' after OPTIONAL keyword"); }
+    break;
+
+  case 149:
+
+/* Line 1455 of yacc.c  */
+#line 965 "./sparql_p.y"
+    { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_QUAD_MAP, "QUAD MAP { ... } group pattern"); }
+    break;
+
+  case 150:
+
+/* Line 1455 of yacc.c  */
+#line 966 "./sparql_p.y"
+    { t_set_push (&(sparp_env()->spare_context_qms), (yyvsp[(4) - (4)].tree)); }
+    break;
+
+  case 151:
+
+/* Line 1455 of yacc.c  */
+#line 967 "./sparql_p.y"
     {
 		spar_gp_init (sparp_arg, 0); }
     break;
 
-  case 126:
+  case 152:
 
 /* Line 1455 of yacc.c  */
-#line 879 "./sparql_p.y"
+#line 969 "./sparql_p.y"
     { t_set_pop (&(sparp_env()->spare_context_qms)); (yyval.tree) = (yyvsp[(8) - (8)].tree); }
     break;
 
-  case 127:
+  case 153:
 
 /* Line 1455 of yacc.c  */
-#line 884 "./sparql_p.y"
+#line 974 "./sparql_p.y"
     { t_set_push (&(sparp_env()->spare_context_graphs), (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 128:
+  case 154:
 
 /* Line 1455 of yacc.c  */
-#line 885 "./sparql_p.y"
+#line 975 "./sparql_p.y"
     {
 		spar_gp_init (sparp_arg, 0);
 		spar_gp_add_filters_for_named_graph (sparp_arg); }
     break;
 
-  case 129:
+  case 155:
 
 /* Line 1455 of yacc.c  */
-#line 888 "./sparql_p.y"
+#line 978 "./sparql_p.y"
     { t_set_pop (&(sparp_env()->spare_context_graphs)); (yyval.tree) = (yyvsp[(6) - (6)].tree); }
     break;
 
-  case 130:
+  case 156:
 
 /* Line 1455 of yacc.c  */
-#line 892 "./sparql_p.y"
+#line 982 "./sparql_p.y"
     { spar_gp_init (sparp_arg, 0); }
     break;
 
-  case 131:
+  case 157:
 
 /* Line 1455 of yacc.c  */
-#line 892 "./sparql_p.y"
+#line 982 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(3) - (3)].tree); }
     break;
 
-  case 132:
+  case 158:
 
 /* Line 1455 of yacc.c  */
-#line 893 "./sparql_p.y"
+#line 983 "./sparql_p.y"
     {
                 sparp_env()->spare_good_graph_varnames = sparp_env()->spare_good_graph_bmk;
 		spar_gp_init (sparp_arg, UNION_L);
@@ -4230,78 +4525,139 @@ yyreduce:
 		spar_gp_init (sparp_arg, 0); }
     break;
 
-  case 133:
+  case 159:
 
 /* Line 1455 of yacc.c  */
-#line 898 "./sparql_p.y"
+#line 988 "./sparql_p.y"
     {
 		spar_gp_add_member (sparp_arg, (yyvsp[(5) - (5)].tree));
 		(yyval.tree) = spar_gp_finalize (sparp_arg, NULL); }
     break;
 
-  case 134:
+  case 160:
 
 /* Line 1455 of yacc.c  */
-#line 904 "./sparql_p.y"
+#line 994 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(3) - (4)].tree); }
     break;
 
-  case 135:
+  case 161:
 
 /* Line 1455 of yacc.c  */
-#line 905 "./sparql_p.y"
+#line 995 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(2) - (2)].tree); }
     break;
 
-  case 136:
+  case 162:
 
 /* Line 1455 of yacc.c  */
-#line 906 "./sparql_p.y"
+#line 996 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(2) - (2)].tree); }
     break;
 
-  case 137:
+  case 163:
 
 /* Line 1455 of yacc.c  */
-#line 910 "./sparql_p.y"
+#line 997 "./sparql_p.y"
+    {		/*... | 'NOT'? 'EXISTS' DatasetClause* WhereClause */
+		if ((yyvsp[(2) - (3)].token_type))
+		  (yyval.tree) = (yyvsp[(3) - (3)].tree);
+		else
+		  SPAR_BIN_OP ((yyval.tree), BOP_NOT, (yyvsp[(3) - (3)].tree), NULL); }
+    break;
+
+  case 164:
+
+/* Line 1455 of yacc.c  */
+#line 1002 "./sparql_p.y"
+    {		/*... | 'NOT'? 'EXISTS' DatasetClause* WhereClause */
+		/*!!! Dirty hack! Works wrong if MINUS is at the middle of the GP (before smth or not a 2-nd item) */
+		  SPAR_BIN_OP ((yyval.tree), BOP_NOT, (yyvsp[(2) - (2)].tree), NULL); }
+    break;
+
+  case 165:
+
+/* Line 1455 of yacc.c  */
+#line 1008 "./sparql_p.y"
+    { (yyval.token_type) = 1; }
+    break;
+
+  case 166:
+
+/* Line 1455 of yacc.c  */
+#line 1009 "./sparql_p.y"
+    { (yyval.token_type) = 0; }
+    break;
+
+  case 167:
+
+/* Line 1455 of yacc.c  */
+#line 1013 "./sparql_p.y"
+    {
+		SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_SPARQL11, "SPARQL 1.1 FILTER EXISTS / FILTER NOT EXISTS test");
+		spar_gp_init (sparp_arg, SELECT_L);
+		spar_env_push (sparp_arg);
+		spar_selid_push (sparp_arg);
+		t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
+		sparp_arg->sparp_allow_aggregates_in_expn <<= 1; }
+    break;
+
+  case 168:
+
+/* Line 1455 of yacc.c  */
+#line 1022 "./sparql_p.y"
+    {
+		SPART *subselect_top;
+		SPART *where_gp;
+		where_gp = spar_gp_finalize (sparp_arg, NULL);
+		subselect_top = spar_make_top (sparp_arg, ASK_L, (SPART **)t_list(0), spar_selid_pop (sparp_arg),
+		  where_gp, NULL, NULL, NULL, (SPART *)t_box_num(1), (SPART *)t_box_num(0) );
+		spar_env_pop (sparp_arg);
+		(yyval.tree) = spar_gp_finalize_with_subquery (sparp_arg, (yyvsp[(4) - (4)].trees), subselect_top);
+		sparp_arg->sparp_allow_aggregates_in_expn >>= 1; }
+    break;
+
+  case 169:
+
+/* Line 1455 of yacc.c  */
+#line 1034 "./sparql_p.y"
     {
 		sparp_arg->sparp_query_uses_sinvs++;
-		(yyval.token_type) = sparp_arg->sparp_permitted_syntax; }
+		(yyval.token_type) = sparp_arg->sparp_permitted_syntax;
+		sparp_arg->sparp_permitted_syntax = SSG_SD_GLOBALS; /*!!! TBD config */
+		}
     break;
 
-  case 138:
+  case 170:
 
 /* Line 1455 of yacc.c  */
-#line 913 "./sparql_p.y"
+#line 1039 "./sparql_p.y"
     {
 		(yyval.box) = t_alloc (sizeof (sparp_sources_t));
 		memcpy ((yyval.box), &(sparp_arg->sparp_env->spare_src), sizeof (sparp_sources_t));
 		memset (&(sparp_arg->sparp_env->spare_src), 0, sizeof (sparp_sources_t)); }
     break;
 
-  case 139:
+  case 171:
 
 /* Line 1455 of yacc.c  */
-#line 917 "./sparql_p.y"
+#line 1043 "./sparql_p.y"
     {
 		SPART **sources;
 		caddr_t sinv_storage_uri = uname_virtrdf_ns_uri_DefaultServiceStorage /*!!! TBD config */;
-		ptrlong sinv_syntax;
 		SPART *sinv;
 		if ((NULL == sparp_arg->sparp_env->spare_default_graphs) && (NULL == sparp_arg->sparp_env->spare_named_graphs))
 		  memcpy (&(sparp_arg->sparp_env->spare_src), (yyvsp[(5) - (7)].box), sizeof (sparp_sources_t));
-		sinv_syntax = SSG_SD_GLOBALS; /*!!! TBD config */
-		sparp_arg->sparp_permitted_syntax = sinv_syntax;
 		sources = spar_make_sources_like_top (sparp_arg);
-		sinv = spar_make_service_inv (sparp_arg, (yyvsp[(2) - (7)].box), (yyvsp[(4) - (7)].backstack), sinv_syntax, sources, sinv_storage_uri);
+		sinv = spar_make_service_inv (sparp_arg, (yyvsp[(2) - (7)].box), (yyvsp[(4) - (7)].backstack), sparp_arg->sparp_permitted_syntax, sources, sinv_storage_uri);
 		t_set_push (&(sparp_env()->spare_context_sinvs), sinv);
 		spar_gp_init (sparp_arg, SERVICE_L); }
     break;
 
-  case 140:
+  case 172:
 
 /* Line 1455 of yacc.c  */
-#line 930 "./sparql_p.y"
+#line 1053 "./sparql_p.y"
     {
 		sparp_arg->sparp_permitted_syntax = (yyvsp[(3) - (9)].token_type);
 		(yyvsp[(9) - (9)].tree)->_.gp.options = (SPART **)t_list_concat_tail (
@@ -4311,312 +4667,352 @@ yyreduce:
 		(yyval.tree) = (yyvsp[(9) - (9)].tree); }
     break;
 
-  case 141:
+  case 173:
 
 /* Line 1455 of yacc.c  */
-#line 939 "./sparql_p.y"
-    { (yyval.backstack) = NULL; }
+#line 1062 "./sparql_p.y"
+    { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (SPART *)((ptrlong)IN_L)); t_set_push (&((yyval.backstack)), (SPART *)((ptrlong)_STAR)); }
     break;
 
-  case 142:
+  case 174:
 
 /* Line 1455 of yacc.c  */
-#line 940 "./sparql_p.y"
+#line 1063 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(2) - (3)].backstack); }
     break;
 
-  case 143:
+  case 175:
 
 /* Line 1455 of yacc.c  */
-#line 944 "./sparql_p.y"
-    { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (2)].box)); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].backstack)); }
+#line 1067 "./sparql_p.y"
+    { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].trees)[0]); t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].trees)[1]); }
     break;
 
-  case 144:
+  case 176:
 
 /* Line 1455 of yacc.c  */
-#line 945 "./sparql_p.y"
-    { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (SPART *)((ptrlong)DEFINE_L)); t_set_push (&((yyval.backstack)), t_list (2, (yyvsp[(2) - (3)].box), t_revlist_to_array((yyvsp[(3) - (3)].backstack)))); }
+#line 1068 "./sparql_p.y"
+    { (yyval.backstack) = (yyvsp[(1) - (2)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].trees)[0]); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].trees)[1]); }
     break;
 
-  case 145:
+  case 177:
 
 /* Line 1455 of yacc.c  */
-#line 946 "./sparql_p.y"
-    { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (SPART *)((ptrlong)IN_L)); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].backstack)); }
+#line 1072 "./sparql_p.y"
+    { (yyval.trees) = (SPART **)t_list (2, (yyvsp[(1) - (2)].box), (yyvsp[(2) - (2)].backstack)); }
     break;
 
-  case 146:
+  case 178:
 
 /* Line 1455 of yacc.c  */
-#line 947 "./sparql_p.y"
-    { (yyval.backstack) = (yyvsp[(1) - (3)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (3)].box)); t_set_push (&((yyval.backstack)), t_revlist_to_array((yyvsp[(3) - (3)].backstack))); }
+#line 1073 "./sparql_p.y"
+    {
+		caddr_t defname = (yyvsp[(2) - (3)].box);
+		dk_set_t defvals = (yyvsp[(3) - (3)].backstack);
+		if (!strcmp (defname, "lang:dialect"))
+		  {
+		    if ((NULL == defvals) || (NULL != defvals->next) || (SPARQL_INTEGER != ((ptrlong *)(defvals->data))[0]))
+		      sparyyerror ("define lang:dialect needs an integer");
+		    sparp_arg->sparp_permitted_syntax = unbox (((caddr_t *)(defvals->data))[1]) | SSG_SD_GLOBALS;
+		  }
+		(yyval.trees) = (SPART **)t_list (2, (SPART *)((ptrlong)DEFINE_L), t_list (2, defname, t_revlist_to_array(defvals))); }
     break;
 
-  case 147:
+  case 179:
 
 /* Line 1455 of yacc.c  */
-#line 948 "./sparql_p.y"
-    { (yyval.backstack) = (yyvsp[(1) - (4)].backstack); t_set_push (&((yyval.backstack)), (SPART *)((ptrlong)DEFINE_L)); t_set_push (&((yyval.backstack)), t_list (2, (yyvsp[(3) - (4)].box), t_revlist_to_array((yyvsp[(4) - (4)].backstack)))); }
+#line 1083 "./sparql_p.y"
+    { (yyval.trees) = (SPART **)t_list (2, (SPART *)((ptrlong)IN_L), (yyvsp[(2) - (2)].backstack)); }
     break;
 
-  case 148:
+  case 180:
 
 /* Line 1455 of yacc.c  */
-#line 949 "./sparql_p.y"
-    { (yyval.backstack) = (yyvsp[(1) - (3)].backstack); t_set_push (&((yyval.backstack)), (SPART *)((ptrlong)IN_L)); t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].backstack)); }
+#line 1084 "./sparql_p.y"
+    { (yyval.trees) = (SPART **)t_list (2, (SPART *)((ptrlong)IN_L), (SPART *)((ptrlong)_STAR)); }
     break;
 
-  case 149:
+  case 181:
 
 /* Line 1455 of yacc.c  */
-#line 953 "./sparql_p.y"
+#line 1088 "./sparql_p.y"
     { spar_gp_init (sparp_arg, CONSTRUCT_L); }
     break;
 
-  case 150:
+  case 182:
 
 /* Line 1455 of yacc.c  */
-#line 954 "./sparql_p.y"
+#line 1089 "./sparql_p.y"
     { (yyval.tree) = spar_gp_finalize (sparp_arg, NULL); }
     break;
 
-  case 151:
+  case 183:
 
 /* Line 1455 of yacc.c  */
-#line 958 "./sparql_p.y"
+#line 1093 "./sparql_p.y"
     { }
     break;
 
-  case 152:
+  case 184:
 
 /* Line 1455 of yacc.c  */
-#line 959 "./sparql_p.y"
+#line 1094 "./sparql_p.y"
     { }
     break;
 
-  case 153:
+  case 185:
 
 /* Line 1455 of yacc.c  */
-#line 960 "./sparql_p.y"
+#line 1095 "./sparql_p.y"
     { }
     break;
 
-  case 154:
+  case 186:
 
 /* Line 1455 of yacc.c  */
-#line 964 "./sparql_p.y"
+#line 1099 "./sparql_p.y"
     { }
     break;
 
-  case 155:
+  case 187:
 
 /* Line 1455 of yacc.c  */
-#line 965 "./sparql_p.y"
+#line 1100 "./sparql_p.y"
     { }
     break;
 
-  case 156:
+  case 188:
 
 /* Line 1455 of yacc.c  */
-#line 969 "./sparql_p.y"
+#line 1104 "./sparql_p.y"
     { }
     break;
 
-  case 157:
+  case 189:
 
 /* Line 1455 of yacc.c  */
-#line 970 "./sparql_p.y"
+#line 1105 "./sparql_p.y"
     { }
     break;
 
-  case 158:
+  case 190:
 
 /* Line 1455 of yacc.c  */
-#line 974 "./sparql_p.y"
+#line 1109 "./sparql_p.y"
     { }
     break;
 
-  case 159:
+  case 191:
 
 /* Line 1455 of yacc.c  */
-#line 975 "./sparql_p.y"
+#line 1110 "./sparql_p.y"
     { }
     break;
 
-  case 160:
+  case 192:
 
 /* Line 1455 of yacc.c  */
-#line 979 "./sparql_p.y"
+#line 1114 "./sparql_p.y"
     { t_set_push (&(sparp_env()->spare_context_subjects), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 161:
+  case 193:
 
 /* Line 1455 of yacc.c  */
-#line 980 "./sparql_p.y"
+#line 1115 "./sparql_p.y"
     { t_set_pop (&(sparp_env()->spare_context_subjects)); (yyval.nothing) = (yyvsp[(3) - (3)].nothing); }
     break;
 
-  case 162:
+  case 194:
 
 /* Line 1455 of yacc.c  */
-#line 981 "./sparql_p.y"
+#line 1116 "./sparql_p.y"
     { t_set_push (&(sparp_env()->spare_context_subjects), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 163:
+  case 195:
 
 /* Line 1455 of yacc.c  */
-#line 982 "./sparql_p.y"
+#line 1117 "./sparql_p.y"
     { t_set_pop (&(sparp_env()->spare_context_subjects)); }
     break;
 
-  case 164:
+  case 196:
 
 /* Line 1455 of yacc.c  */
-#line 986 "./sparql_p.y"
+#line 1121 "./sparql_p.y"
     { }
     break;
 
-  case 165:
+  case 197:
 
 /* Line 1455 of yacc.c  */
-#line 987 "./sparql_p.y"
+#line 1122 "./sparql_p.y"
     { }
     break;
 
-  case 166:
+  case 198:
 
 /* Line 1455 of yacc.c  */
-#line 988 "./sparql_p.y"
+#line 1123 "./sparql_p.y"
     { }
     break;
 
-  case 167:
+  case 199:
+
+/* Line 1455 of yacc.c  */
+#line 1124 "./sparql_p.y"
+    { sparyyerror ("Dot immediately after semicolon is permitted in pure SPARQL but not in SPARQL-BI"); }
+    break;
+
+  case 200:
 
 /* Line 1455 of yacc.c  */
-#line 992 "./sparql_p.y"
+#line 1128 "./sparql_p.y"
     { t_set_push (&(sparp_env()->spare_context_predicates), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 168:
+  case 201:
 
 /* Line 1455 of yacc.c  */
-#line 993 "./sparql_p.y"
+#line 1129 "./sparql_p.y"
     { t_set_pop (&(sparp_env()->spare_context_predicates)); }
     break;
 
-  case 169:
+  case 202:
 
 /* Line 1455 of yacc.c  */
-#line 995 "./sparql_p.y"
+#line 1131 "./sparql_p.y"
     { t_set_push (&(sparp_env()->spare_context_predicates), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 170:
+  case 203:
 
 /* Line 1455 of yacc.c  */
-#line 996 "./sparql_p.y"
+#line 1132 "./sparql_p.y"
     { t_set_pop (&(sparp_env()->spare_context_predicates)); }
     break;
 
-  case 171:
+  case 204:
 
 /* Line 1455 of yacc.c  */
-#line 997 "./sparql_p.y"
+#line 1133 "./sparql_p.y"
+    { sparyyerror ("Dot immediately after semicolon is permitted in pure SPARQL but not in SPARQL-BI"); }
+    break;
+
+  case 205:
+
+/* Line 1455 of yacc.c  */
+#line 1134 "./sparql_p.y"
     { sparyyerror ("Predicate expected after semicolon"); }
     break;
 
-  case 172:
+  case 206:
 
 /* Line 1455 of yacc.c  */
-#line 998 "./sparql_p.y"
+#line 1135 "./sparql_p.y"
     { sparyyerror ("Predicate expected"); }
     break;
 
-  case 173:
+  case 207:
 
 /* Line 1455 of yacc.c  */
-#line 1002 "./sparql_p.y"
+#line 1139 "./sparql_p.y"
     { }
     break;
 
-  case 174:
+  case 208:
 
 /* Line 1455 of yacc.c  */
-#line 1003 "./sparql_p.y"
+#line 1140 "./sparql_p.y"
     { }
     break;
 
-  case 175:
+  case 209:
+
+/* Line 1455 of yacc.c  */
+#line 1141 "./sparql_p.y"
+    { sparyyerror ("Semicolon immediately after colon is permitted in pure SPARQL but not in SPARQL-BI"); }
+    break;
+
+  case 210:
 
 /* Line 1455 of yacc.c  */
-#line 1004 "./sparql_p.y"
+#line 1142 "./sparql_p.y"
+    { sparyyerror ("Dot immediately after colon is permitted in pure SPARQL but not in SPARQL-BI"); }
+    break;
+
+  case 211:
+
+/* Line 1455 of yacc.c  */
+#line 1143 "./sparql_p.y"
     { sparyyerror ("Object expected after comma"); }
     break;
 
-  case 176:
+  case 212:
 
 /* Line 1455 of yacc.c  */
-#line 1005 "./sparql_p.y"
+#line 1144 "./sparql_p.y"
     { sparyyerror ("Object expected"); }
     break;
 
-  case 177:
+  case 213:
 
 /* Line 1455 of yacc.c  */
-#line 1009 "./sparql_p.y"
+#line 1148 "./sparql_p.y"
     {
 		spar_gp_add_triple_or_special_filter (sparp_arg, NULL, NULL, NULL, (yyvsp[(1) - (2)].tree), NULL, (yyvsp[(2) - (2)].trees), 0x0); }
     break;
 
-  case 178:
+  case 214:
 
 /* Line 1455 of yacc.c  */
-#line 1014 "./sparql_p.y"
+#line 1153 "./sparql_p.y"
     { (yyval.trees) = NULL; }
     break;
 
-  case 179:
+  case 215:
 
 /* Line 1455 of yacc.c  */
-#line 1015 "./sparql_p.y"
-    { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_OPTION, "OPTION () triple matching configuration"); }
+#line 1154 "./sparql_p.y"
+    {
+		if (CONSTRUCT_L == SPARP_ENV_CONTEXT_GP_SUBTYPE(sparp_arg))
+		  sparyyerror ("Triple options are not allowed in contructor template");
+		SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_OPTION, "OPTION () triple matching configuration"); }
     break;
 
-  case 180:
+  case 216:
 
 /* Line 1455 of yacc.c  */
-#line 1016 "./sparql_p.y"
+#line 1158 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_revlist_to_array ((yyvsp[(4) - (5)].backstack)); }
     break;
 
-  case 181:
+  case 217:
 
 /* Line 1455 of yacc.c  */
-#line 1020 "./sparql_p.y"
+#line 1162 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), ((SPART **)((yyvsp[(1) - (1)].trees)))[0]); t_set_push (&((yyval.backstack)), ((SPART **)((yyvsp[(1) - (1)].trees)))[1]); }
     break;
 
-  case 182:
+  case 218:
 
 /* Line 1455 of yacc.c  */
-#line 1021 "./sparql_p.y"
+#line 1163 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (3)].backstack);  t_set_push (&((yyval.backstack)), ((SPART **)((yyvsp[(3) - (3)].trees)))[0]); t_set_push (&((yyval.backstack)), ((SPART **)((yyvsp[(3) - (3)].trees)))[1]); }
     break;
 
-  case 183:
+  case 219:
 
 /* Line 1455 of yacc.c  */
-#line 1025 "./sparql_p.y"
+#line 1167 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)IFP_L, (ptrlong)1); }
     break;
 
-  case 184:
+  case 220:
 
 /* Line 1455 of yacc.c  */
-#line 1026 "./sparql_p.y"
+#line 1168 "./sparql_p.y"
     {
 		if (strcasecmp ((yyvsp[(2) - (2)].box), "none"))
 		  (yyval.trees) = (SPART **)t_list (2, (ptrlong)INFERENCE_L, (yyvsp[(2) - (2)].box));
@@ -4624,269 +5020,276 @@ yyreduce:
 		  (yyval.trees) = (SPART **)t_list (2, (ptrlong)INFERENCE_L, (ptrlong)1); }
     break;
 
-  case 185:
+  case 221:
 
 /* Line 1455 of yacc.c  */
-#line 1031 "./sparql_p.y"
+#line 1173 "./sparql_p.y"
     {
 		  (yyval.trees) = (SPART **)t_list (2, (ptrlong)INFERENCE_L, sparp_expand_qname_prefix (sparp_arg, (yyvsp[(2) - (2)].box))); }
     break;
 
-  case 186:
+  case 222:
 
 /* Line 1455 of yacc.c  */
-#line 1033 "./sparql_p.y"
+#line 1175 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)INFERENCE_L, sparp_expand_q_iri_ref (sparp_arg, (yyvsp[(2) - (2)].box))); }
     break;
 
-  case 187:
+  case 223:
 
 /* Line 1455 of yacc.c  */
-#line 1034 "./sparql_p.y"
+#line 1176 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)INFERENCE_L, (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 188:
+  case 224:
 
 /* Line 1455 of yacc.c  */
-#line 1035 "./sparql_p.y"
+#line 1177 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)OFFBAND_L, (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 189:
+  case 225:
 
 /* Line 1455 of yacc.c  */
-#line 1036 "./sparql_p.y"
+#line 1178 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)SCORE_L, (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 190:
+  case 226:
 
 /* Line 1455 of yacc.c  */
-#line 1037 "./sparql_p.y"
+#line 1179 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)SCORE_LIMIT_L, (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 191:
+  case 227:
 
 /* Line 1455 of yacc.c  */
-#line 1038 "./sparql_p.y"
+#line 1180 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)TABLE_OPTION_L, (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 192:
+  case 228:
 
 /* Line 1455 of yacc.c  */
-#line 1039 "./sparql_p.y"
+#line 1181 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_CYCLES_ONLY_L, (ptrlong)1); }
     break;
 
-  case 193:
+  case 229:
 
 /* Line 1455 of yacc.c  */
-#line 1040 "./sparql_p.y"
+#line 1182 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_DIRECTION_L, (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 194:
+  case 230:
 
 /* Line 1455 of yacc.c  */
-#line 1041 "./sparql_p.y"
+#line 1183 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_DISTINCT_L, (ptrlong)1); }
     break;
 
-  case 195:
+  case 231:
 
 /* Line 1455 of yacc.c  */
-#line 1042 "./sparql_p.y"
+#line 1184 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_END_FLAG_L, (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 196:
+  case 232:
 
 /* Line 1455 of yacc.c  */
-#line 1043 "./sparql_p.y"
+#line 1185 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_EXISTS_L, (ptrlong)1); }
     break;
 
-  case 197:
+  case 233:
 
 /* Line 1455 of yacc.c  */
-#line 1044 "./sparql_p.y"
+#line 1186 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_FINAL_AS_L, (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 198:
+  case 234:
 
 /* Line 1455 of yacc.c  */
-#line 1045 "./sparql_p.y"
+#line 1187 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_IN_L, spartlist (sparp_arg, 2, SPAR_LIST, t_revlist_to_array ((yyvsp[(3) - (4)].backstack)))); }
     break;
 
-  case 199:
+  case 235:
 
 /* Line 1455 of yacc.c  */
-#line 1046 "./sparql_p.y"
+#line 1188 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_MIN_L, (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 200:
+  case 236:
 
 /* Line 1455 of yacc.c  */
-#line 1047 "./sparql_p.y"
+#line 1189 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_MAX_L, (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 201:
+  case 237:
 
 /* Line 1455 of yacc.c  */
-#line 1048 "./sparql_p.y"
+#line 1190 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_NO_CYCLES_L, (ptrlong)1); }
     break;
 
-  case 202:
+  case 238:
 
 /* Line 1455 of yacc.c  */
-#line 1049 "./sparql_p.y"
+#line 1191 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_NO_ORDER_L, (ptrlong)1); }
     break;
 
-  case 203:
+  case 239:
 
 /* Line 1455 of yacc.c  */
-#line 1050 "./sparql_p.y"
+#line 1192 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_OUT_L, spartlist (sparp_arg, 2, SPAR_LIST, t_revlist_to_array ((yyvsp[(3) - (4)].backstack)))); }
     break;
 
-  case 204:
+  case 240:
 
 /* Line 1455 of yacc.c  */
-#line 1051 "./sparql_p.y"
+#line 1193 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_SHORTEST_ONLY_L, (ptrlong)1); }
     break;
 
-  case 205:
+  case 241:
 
 /* Line 1455 of yacc.c  */
-#line 1052 "./sparql_p.y"
+#line 1194 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_STEP_L, spartlist (sparp_arg, 4, SPAR_ALIAS, (yyvsp[(3) - (6)].tree), (yyvsp[(6) - (6)].tree)->_.var.vname, SSG_VALMODE_AUTO)); }
     break;
 
-  case 206:
+  case 242:
 
 /* Line 1455 of yacc.c  */
-#line 1053 "./sparql_p.y"
+#line 1195 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)T_STEP_L, spartlist (sparp_arg, 4, SPAR_ALIAS, (yyvsp[(3) - (6)].box), (yyvsp[(6) - (6)].tree)->_.var.vname, SSG_VALMODE_AUTO)); }
     break;
 
-  case 207:
+  case 243:
 
 /* Line 1455 of yacc.c  */
-#line 1054 "./sparql_p.y"
+#line 1196 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (ptrlong)TRANSITIVE_L, (ptrlong)1); }
     break;
 
-  case 208:
+  case 244:
 
 /* Line 1455 of yacc.c  */
-#line 1055 "./sparql_p.y"
+#line 1197 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (yyvsp[(1) - (4)].token_type), spartlist (sparp_arg, 2, SPAR_LIST, t_revlist_to_array ((yyvsp[(3) - (4)].backstack)))); }
     break;
 
-  case 209:
+  case 245:
 
 /* Line 1455 of yacc.c  */
-#line 1056 "./sparql_p.y"
+#line 1198 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, (yyvsp[(1) - (1)].token_type), (ptrlong)1); }
     break;
 
-  case 210:
+  case 246:
 
 /* Line 1455 of yacc.c  */
-#line 1060 "./sparql_p.y"
+#line 1202 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 211:
+  case 247:
 
 /* Line 1455 of yacc.c  */
-#line 1061 "./sparql_p.y"
+#line 1203 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (3)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 212:
+  case 248:
 
 /* Line 1455 of yacc.c  */
-#line 1065 "./sparql_p.y"
+#line 1207 "./sparql_p.y"
     { (yyval.token_type) = SAME_AS_L; }
     break;
 
-  case 213:
+  case 249:
 
 /* Line 1455 of yacc.c  */
-#line 1066 "./sparql_p.y"
+#line 1208 "./sparql_p.y"
     { (yyval.token_type) = SAME_AS_O_L; }
     break;
 
-  case 214:
+  case 250:
 
 /* Line 1455 of yacc.c  */
-#line 1067 "./sparql_p.y"
+#line 1209 "./sparql_p.y"
     { (yyval.token_type) = SAME_AS_P_L; }
     break;
 
-  case 215:
+  case 251:
 
 /* Line 1455 of yacc.c  */
-#line 1068 "./sparql_p.y"
+#line 1210 "./sparql_p.y"
     { (yyval.token_type) = SAME_AS_S_L; }
     break;
 
-  case 216:
+  case 252:
 
 /* Line 1455 of yacc.c  */
-#line 1069 "./sparql_p.y"
+#line 1211 "./sparql_p.y"
     { (yyval.token_type) = SAME_AS_S_O_L; }
     break;
 
-  case 218:
+  case 254:
 
 /* Line 1455 of yacc.c  */
-#line 1074 "./sparql_p.y"
+#line 1216 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 2, SPAR_QNAME, uname_rdf_ns_uri_type); }
     break;
 
-  case 219:
+  case 255:
+
+/* Line 1455 of yacc.c  */
+#line 1217 "./sparql_p.y"
+    { sparyyerror ("Predicate expected (i.e., variable or IRI ref or a backquoted expn or 'a' keyword)"); }
+    break;
+
+  case 256:
 
 /* Line 1455 of yacc.c  */
-#line 1078 "./sparql_p.y"
+#line 1221 "./sparql_p.y"
     {	/* [35]	BlankNodePropertyList	 ::=  '[' PropertyListNotEmpty ']'	*/
 		SPART *bn = spar_make_blank_node (sparp_arg, spar_mkid (sparp_arg, "_:lsqbra"), 1);
 		t_set_push (&(sparp_env()->spare_context_subjects), bn); }
     break;
 
-  case 220:
+  case 257:
 
 /* Line 1455 of yacc.c  */
-#line 1081 "./sparql_p.y"
+#line 1224 "./sparql_p.y"
     {
 		(yyval.tree) = t_set_pop (&(sparp_env()->spare_context_subjects)); }
     break;
 
-  case 221:
+  case 258:
 
 /* Line 1455 of yacc.c  */
-#line 1083 "./sparql_p.y"
+#line 1226 "./sparql_p.y"
     {	/* [36]	Collection	 ::=  '(' GraphNode* ')'	*/
 		SPART *bn = spar_make_blank_node (sparp_arg, spar_mkid (sparp_arg, "_:topcons"), 1);
 		t_set_push (&(sparp_env()->spare_context_subjects), bn);
 		t_set_push (&(sparp_env()->spare_context_subjects), bn); }
     break;
 
-  case 222:
+  case 259:
 
 /* Line 1455 of yacc.c  */
-#line 1087 "./sparql_p.y"
+#line 1230 "./sparql_p.y"
     {
 		spar_gp_add_triple_or_special_filter (sparp_arg,
 		  NULL, NULL,
@@ -4897,41 +5300,41 @@ yyreduce:
 		(yyval.tree) = t_set_pop (&(sparp_env()->spare_context_subjects)); }
     break;
 
-  case 223:
+  case 260:
 
 /* Line 1455 of yacc.c  */
-#line 1095 "./sparql_p.y"
+#line 1238 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 2, SPAR_QNAME, uname_rdf_ns_uri_nil); }
     break;
 
-  case 224:
+  case 261:
 
 /* Line 1455 of yacc.c  */
-#line 1099 "./sparql_p.y"
+#line 1242 "./sparql_p.y"
     {}
     break;
 
-  case 225:
+  case 262:
 
 /* Line 1455 of yacc.c  */
-#line 1100 "./sparql_p.y"
+#line 1243 "./sparql_p.y"
     {}
     break;
 
-  case 226:
+  case 263:
 
 /* Line 1455 of yacc.c  */
-#line 1104 "./sparql_p.y"
+#line 1247 "./sparql_p.y"
     {
 		spar_gp_add_triple_or_special_filter (sparp_arg, NULL, NULL,
 		  spartlist (sparp_arg, 2, SPAR_QNAME, uname_rdf_ns_uri_first),
 		  (yyvsp[(1) - (1)].tree), NULL, NULL, 0x0 ); }
     break;
 
-  case 227:
+  case 264:
 
 /* Line 1455 of yacc.c  */
-#line 1108 "./sparql_p.y"
+#line 1251 "./sparql_p.y"
     {
 		SPART *bn = spar_make_blank_node (sparp_arg, spar_mkid (sparp_arg, "_:cons"), 1);
 		spar_gp_add_triple_or_special_filter (sparp_arg,
@@ -4944,251 +5347,251 @@ yyreduce:
 		  (yyvsp[(2) - (2)].tree), NULL, NULL, 0x0 ); }
     break;
 
-  case 232:
+  case 269:
 
 /* Line 1455 of yacc.c  */
-#line 1131 "./sparql_p.y"
+#line 1274 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 233:
+  case 270:
 
 /* Line 1455 of yacc.c  */
-#line 1132 "./sparql_p.y"
+#line 1275 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (2)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 237:
+  case 274:
 
 /* Line 1455 of yacc.c  */
-#line 1139 "./sparql_p.y"
+#line 1282 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(2) - (3)].tree); }
     break;
 
-  case 245:
+  case 282:
 
 /* Line 1455 of yacc.c  */
-#line 1156 "./sparql_p.y"
+#line 1299 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (3)].tree)); t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 246:
+  case 283:
 
 /* Line 1455 of yacc.c  */
-#line 1157 "./sparql_p.y"
+#line 1300 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (3)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 247:
+  case 284:
 
 /* Line 1455 of yacc.c  */
-#line 1161 "./sparql_p.y"
+#line 1304 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 248:
+  case 285:
 
 /* Line 1455 of yacc.c  */
-#line 1162 "./sparql_p.y"
+#line 1305 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (2)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 249:
+  case 286:
 
 /* Line 1455 of yacc.c  */
-#line 1166 "./sparql_p.y"
+#line 1309 "./sparql_p.y"
     { (yyval.tree) = spar_make_funcall (sparp_arg, 1, (yyvsp[(1) - (3)].box), (SPART **)t_list (1, (yyvsp[(2) - (3)].tree))); }
     break;
 
-  case 250:
+  case 287:
 
 /* Line 1455 of yacc.c  */
-#line 1167 "./sparql_p.y"
+#line 1310 "./sparql_p.y"
     { (yyval.tree) = spar_make_funcall (sparp_arg, 1, (yyvsp[(1) - (3)].box), (SPART **)t_list (1, (ptrlong)1)); }
     break;
 
-  case 251:
+  case 288:
 
 /* Line 1455 of yacc.c  */
-#line 1168 "./sparql_p.y"
+#line 1311 "./sparql_p.y"
     { (yyval.tree) = spar_make_funcall (sparp_arg, DISTINCT_L, (yyvsp[(1) - (4)].box), (SPART **)t_list (1, (yyvsp[(3) - (4)].tree))); }
     break;
 
-  case 252:
+  case 289:
 
 /* Line 1455 of yacc.c  */
-#line 1172 "./sparql_p.y"
+#line 1315 "./sparql_p.y"
     { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "aggregate function call"); (yyval.box) = (yyvsp[(1) - (1)].box); }
     break;
 
-  case 253:
+  case 290:
 
 /* Line 1455 of yacc.c  */
-#line 1176 "./sparql_p.y"
+#line 1319 "./sparql_p.y"
     { (yyval.box) = t_box_dv_uname_string ("SPECIAL::bif:COUNT"); }
     break;
 
-  case 254:
+  case 291:
 
 /* Line 1455 of yacc.c  */
-#line 1177 "./sparql_p.y"
+#line 1320 "./sparql_p.y"
     { (yyval.box) = t_box_dv_uname_string ("bif:AVG"); }
     break;
 
-  case 255:
+  case 292:
 
 /* Line 1455 of yacc.c  */
-#line 1178 "./sparql_p.y"
+#line 1321 "./sparql_p.y"
     { (yyval.box) = t_box_dv_uname_string ("bif:MIN"); }
     break;
 
-  case 256:
+  case 293:
 
 /* Line 1455 of yacc.c  */
-#line 1179 "./sparql_p.y"
+#line 1322 "./sparql_p.y"
     { (yyval.box) = t_box_dv_uname_string ("bif:MAX"); }
     break;
 
-  case 257:
+  case 294:
 
 /* Line 1455 of yacc.c  */
-#line 1180 "./sparql_p.y"
+#line 1323 "./sparql_p.y"
     { (yyval.box) = t_box_dv_uname_string ("bif:SUM"); }
     break;
 
-  case 258:
+  case 295:
 
 /* Line 1455 of yacc.c  */
-#line 1184 "./sparql_p.y"
+#line 1327 "./sparql_p.y"
     { (yyval.tree) = spar_make_param_or_variable (sparp_arg, (yyvsp[(1) - (1)].box)); }
     break;
 
-  case 259:
+  case 296:
 
 /* Line 1455 of yacc.c  */
-#line 1185 "./sparql_p.y"
+#line 1328 "./sparql_p.y"
     { (yyval.tree) = spar_make_param_or_variable (sparp_arg, (yyvsp[(1) - (1)].box)); }
     break;
 
-  case 260:
+  case 297:
 
 /* Line 1455 of yacc.c  */
-#line 1186 "./sparql_p.y"
+#line 1329 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 261:
+  case 298:
 
 /* Line 1455 of yacc.c  */
-#line 1187 "./sparql_p.y"
+#line 1330 "./sparql_p.y"
     { (yyval.tree) = spar_add_propvariable (sparp_arg, (yyvsp[(1) - (2)].tree), (ptrlong)((yyvsp[(2) - (2)].trees)[0]), (yyvsp[(2) - (2)].trees)[1], (ptrlong)((yyvsp[(2) - (2)].trees)[2]), (caddr_t)((yyvsp[(2) - (2)].trees)[3]) ); }
     break;
 
-  case 262:
+  case 299:
 
 /* Line 1455 of yacc.c  */
-#line 1191 "./sparql_p.y"
+#line 1334 "./sparql_p.y"
     { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_GLOBALS, "global variable"); (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 263:
+  case 300:
 
 /* Line 1455 of yacc.c  */
-#line 1196 "./sparql_p.y"
+#line 1339 "./sparql_p.y"
     { (yyval.tree) = spar_make_variable (sparp_arg, (yyvsp[(1) - (1)].box)); }
     break;
 
-  case 264:
+  case 301:
 
 /* Line 1455 of yacc.c  */
-#line 1197 "./sparql_p.y"
+#line 1340 "./sparql_p.y"
     { (yyval.tree) = spar_make_variable (sparp_arg, (yyvsp[(1) - (1)].box)); }
     break;
 
-  case 265:
+  case 302:
 
 /* Line 1455 of yacc.c  */
-#line 1198 "./sparql_p.y"
+#line 1341 "./sparql_p.y"
     { (yyval.tree) = spar_make_variable (sparp_arg, (yyvsp[(1) - (1)].box)); }
     break;
 
-  case 266:
+  case 303:
 
 /* Line 1455 of yacc.c  */
-#line 1199 "./sparql_p.y"
+#line 1342 "./sparql_p.y"
     { (yyval.tree) = spar_make_variable (sparp_arg, (yyvsp[(1) - (1)].box)); }
     break;
 
-  case 267:
+  case 304:
 
 /* Line 1455 of yacc.c  */
-#line 1204 "./sparql_p.y"
+#line 1347 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 268:
+  case 305:
 
 /* Line 1455 of yacc.c  */
-#line 1205 "./sparql_p.y"
+#line 1348 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 269:
+  case 306:
 
 /* Line 1455 of yacc.c  */
-#line 1206 "./sparql_p.y"
+#line 1349 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 270:
+  case 307:
 
 /* Line 1455 of yacc.c  */
-#line 1207 "./sparql_p.y"
+#line 1350 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(2) - (2)].tree); }
     break;
 
-  case 271:
+  case 308:
 
 /* Line 1455 of yacc.c  */
-#line 1208 "./sparql_p.y"
+#line 1351 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(2) - (2)].tree); spar_change_sign (&((yyvsp[(2) - (2)].tree)->_.lit.val)); }
     break;
 
-  case 272:
+  case 309:
 
 /* Line 1455 of yacc.c  */
-#line 1209 "./sparql_p.y"
+#line 1352 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 273:
+  case 310:
 
 /* Line 1455 of yacc.c  */
-#line 1210 "./sparql_p.y"
+#line 1353 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 274:
+  case 311:
 
 /* Line 1455 of yacc.c  */
-#line 1211 "./sparql_p.y"
+#line 1354 "./sparql_p.y"
     { (yyval.tree) = (SPART *)t_box_dv_uname_string ("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"); }
     break;
 
-  case 276:
+  case 313:
 
 /* Line 1455 of yacc.c  */
-#line 1216 "./sparql_p.y"
+#line 1359 "./sparql_p.y"
     {
 		SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "backquoted expression");
 		if (2 & sparp_arg->sparp_in_precode_expn)
 		  spar_error (sparp_arg, "Backquoted expressions are not allowed in constant clauses"); }
     break;
 
-  case 277:
+  case 314:
 
 /* Line 1455 of yacc.c  */
-#line 1220 "./sparql_p.y"
+#line 1363 "./sparql_p.y"
     {
 		  dk_set_t gp_st = sparp_env()->spare_context_gp_subtypes;
                   if ((NULL == gp_st) || (CONSTRUCT_L == (ptrlong)(gp_st->data)))
@@ -5204,80 +5607,80 @@ yyreduce:
 		}
     break;
 
-  case 278:
+  case 315:
 
 /* Line 1455 of yacc.c  */
-#line 1236 "./sparql_p.y"
+#line 1379 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 4, SPAR_ALIAS, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].box), SSG_VALMODE_AUTO); }
     break;
 
-  case 279:
+  case 316:
 
 /* Line 1455 of yacc.c  */
-#line 1237 "./sparql_p.y"
+#line 1380 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 4, SPAR_ALIAS, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].box), SSG_VALMODE_AUTO); }
     break;
 
-  case 280:
+  case 317:
 
 /* Line 1455 of yacc.c  */
-#line 1238 "./sparql_p.y"
+#line 1381 "./sparql_p.y"
     { /* [44]	ConditionalOrExpn	 ::=  ConditionalAndExpn ( '||' ConditionalAndExpn )*	*/
 		  SPAR_BIN_OP ((yyval.tree), BOP_OR, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 281:
+  case 318:
 
 /* Line 1455 of yacc.c  */
-#line 1240 "./sparql_p.y"
+#line 1383 "./sparql_p.y"
     { /* [45]	ConditionalAndExpn	 ::=  ValueLogical ( '&&' ValueLogical )*	*/
 					/* [46]	ValueLogical	 ::=  RelationalExpn	*/
 		  SPAR_BIN_OP ((yyval.tree), BOP_AND, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 282:
+  case 319:
 
 /* Line 1455 of yacc.c  */
-#line 1243 "./sparql_p.y"
+#line 1386 "./sparql_p.y"
     {	/* [47]*	RelationalExpn	 ::=  NumericExpn	*/
 					/*... ( ( ('='|'!='|'<'|'>'|'<='|'>='|'LIKE') NumericExpn ) */
 					/*...   | ( 'IN' '(' Expns ')' ) )?	*/
 		  SPAR_BIN_OP ((yyval.tree), BOP_EQ, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 283:
+  case 320:
 
 /* Line 1455 of yacc.c  */
-#line 1247 "./sparql_p.y"
+#line 1390 "./sparql_p.y"
     { SPAR_BIN_OP ((yyval.tree), BOP_NEQ, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 284:
+  case 321:
 
 /* Line 1455 of yacc.c  */
-#line 1248 "./sparql_p.y"
+#line 1391 "./sparql_p.y"
     { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_LIKE, "LIKE operator"); }
     break;
 
-  case 285:
+  case 322:
 
 /* Line 1455 of yacc.c  */
-#line 1249 "./sparql_p.y"
+#line 1392 "./sparql_p.y"
     {	/* Virtuoso-specific extension of [47] */
 		(yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)LIKE_L, t_list (2, (yyvsp[(1) - (4)].tree), (yyvsp[(4) - (4)].tree))); }
     break;
 
-  case 286:
+  case 323:
 
 /* Line 1455 of yacc.c  */
-#line 1251 "./sparql_p.y"
+#line 1394 "./sparql_p.y"
     { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_IN, "IN operator"); }
     break;
 
-  case 287:
+  case 324:
 
 /* Line 1455 of yacc.c  */
-#line 1252 "./sparql_p.y"
+#line 1395 "./sparql_p.y"
     {	/* Virtuoso-specific extension of [47] */
 		  dk_set_t args = (yyvsp[(5) - (6)].backstack);
                   if (1 == dk_set_length (args))
@@ -5293,98 +5696,98 @@ yyreduce:
 		}
     break;
 
-  case 288:
+  case 325:
 
 /* Line 1455 of yacc.c  */
-#line 1265 "./sparql_p.y"
+#line 1408 "./sparql_p.y"
     { SPAR_BIN_OP ((yyval.tree), BOP_LT, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 289:
+  case 326:
 
 /* Line 1455 of yacc.c  */
-#line 1266 "./sparql_p.y"
+#line 1409 "./sparql_p.y"
     { SPAR_BIN_OP ((yyval.tree), BOP_LT, (yyvsp[(3) - (3)].tree), (yyvsp[(1) - (3)].tree)); }
     break;
 
-  case 290:
+  case 327:
 
 /* Line 1455 of yacc.c  */
-#line 1267 "./sparql_p.y"
+#line 1410 "./sparql_p.y"
     { SPAR_BIN_OP ((yyval.tree), BOP_LTE, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 291:
+  case 328:
 
 /* Line 1455 of yacc.c  */
-#line 1268 "./sparql_p.y"
+#line 1411 "./sparql_p.y"
     { SPAR_BIN_OP ((yyval.tree), BOP_LTE, (yyvsp[(3) - (3)].tree), (yyvsp[(1) - (3)].tree)); }
     break;
 
-  case 292:
+  case 329:
 
 /* Line 1455 of yacc.c  */
-#line 1269 "./sparql_p.y"
+#line 1412 "./sparql_p.y"
     {	/* [49]	AdditiveExpn	 ::=  MultiplicativeExpn ( ('+'|'-') MultiplicativeExpn )*	*/
 		if (sparp_arg->sparp_rset_lexdepth_plus_1 == (yyvsp[(2) - (3)].token_type) + 1)
 		  sparyyerror ("Ambiguous (unary or binary) plus operator in result list, please add \"(\" and \")\"");
 		  SPAR_BIN_OP ((yyval.tree), BOP_PLUS, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 293:
+  case 330:
 
 /* Line 1455 of yacc.c  */
-#line 1273 "./sparql_p.y"
+#line 1416 "./sparql_p.y"
     {
 		if (sparp_arg->sparp_rset_lexdepth_plus_1 == (yyvsp[(2) - (3)].token_type) + 1)
 		  sparyyerror ("Ambiguous (unary or binary) minus operator in result list, please add \"(\" and \")\"");
 		SPAR_BIN_OP ((yyval.tree), BOP_MINUS, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 294:
+  case 331:
 
 /* Line 1455 of yacc.c  */
-#line 1277 "./sparql_p.y"
+#line 1420 "./sparql_p.y"
     {	/* [50]	MultiplicativeExpn	 ::=  UnaryExpn ( ('*'|'/') UnaryExpn )*	*/
 		  SPAR_BIN_OP ((yyval.tree), BOP_TIMES, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 295:
+  case 332:
 
 /* Line 1455 of yacc.c  */
-#line 1279 "./sparql_p.y"
+#line 1422 "./sparql_p.y"
     { SPAR_BIN_OP ((yyval.tree), BOP_DIV, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 296:
+  case 333:
 
 /* Line 1455 of yacc.c  */
-#line 1280 "./sparql_p.y"
+#line 1423 "./sparql_p.y"
     {		/* [51]*	UnaryExpn	 ::=   ('!'|'NOT'|'+'|'-')? PrimaryExpn */
 		SPAR_BIN_OP ((yyval.tree), BOP_NOT, (yyvsp[(2) - (2)].tree), NULL); }
     break;
 
-  case 297:
+  case 334:
 
 /* Line 1455 of yacc.c  */
-#line 1282 "./sparql_p.y"
+#line 1425 "./sparql_p.y"
     {
 		SPAR_BIN_OP ((yyval.tree), BOP_NOT, (yyvsp[(2) - (2)].tree), NULL); }
     break;
 
-  case 298:
+  case 335:
 
 /* Line 1455 of yacc.c  */
-#line 1284 "./sparql_p.y"
+#line 1427 "./sparql_p.y"
     {
 		SPAR_BIN_OP ((yyval.tree), BOP_PLUS,
 		  spartlist (sparp_arg, 4, SPAR_LIT, (SPART *) t_box_num_nonull(0), uname_xmlschema_ns_uri_hash_integer, NULL), (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 299:
+  case 336:
 
 /* Line 1455 of yacc.c  */
-#line 1287 "./sparql_p.y"
+#line 1430 "./sparql_p.y"
     {
 		caddr_t *val_ptr = NULL;
 		if (DV_ARRAY_OF_POINTER == DV_TYPE_OF ((yyvsp[(2) - (2)].tree))) {
@@ -5410,29 +5813,30 @@ yyreduce:
 		  (yyval.tree) = (yyvsp[(2) - (2)].tree); }
     break;
 
-  case 300:
+  case 337:
 
 /* Line 1455 of yacc.c  */
-#line 1310 "./sparql_p.y"
+#line 1453 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(2) - (3)].tree); }
     break;
 
-  case 301:
+  case 338:
 
 /* Line 1455 of yacc.c  */
-#line 1313 "./sparql_p.y"
+#line 1456 "./sparql_p.y"
     {
 		SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "scalar ASK subquery");
                 spar_gp_init (sparp_arg, SELECT_L);
 		spar_env_push (sparp_arg);
 		spar_selid_push (sparp_arg);
-                t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); }
+		t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
+		sparp_arg->sparp_allow_aggregates_in_expn <<= 1; }
     break;
 
-  case 302:
+  case 339:
 
 /* Line 1455 of yacc.c  */
-#line 1321 "./sparql_p.y"
+#line 1465 "./sparql_p.y"
     {
 		SPART *subselect_top;
 		SPART *where_gp;
@@ -5440,26 +5844,28 @@ yyreduce:
 		subselect_top = spar_make_top (sparp_arg, ASK_L, (SPART **)t_list(0), spar_selid_pop (sparp_arg),
 		  where_gp, NULL, NULL, NULL, (SPART *)t_box_num(1), (SPART *)t_box_num(0) );
 		spar_env_pop (sparp_arg);
-		(yyval.tree) = spar_gp_finalize_with_subquery (sparp_arg, (yyvsp[(7) - (7)].trees), subselect_top); }
+		(yyval.tree) = spar_gp_finalize_with_subquery (sparp_arg, (yyvsp[(7) - (7)].trees), subselect_top);
+		sparp_arg->sparp_allow_aggregates_in_expn >>= 1; }
     break;
 
-  case 303:
+  case 340:
 
 /* Line 1455 of yacc.c  */
-#line 1329 "./sparql_p.y"
+#line 1474 "./sparql_p.y"
     {
 		SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "scalar subquery");
                 spar_gp_init (sparp_arg, SELECT_L);
 		spar_env_push (sparp_arg);
 		spar_selid_push (sparp_arg);
                 t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
-		sparp_arg->sparp_allow_aggregates_in_expn++; }
+		sparp_arg->sparp_allow_aggregates_in_expn <<= 1;
+		sparp_arg->sparp_allow_aggregates_in_expn |= 1; }
     break;
 
-  case 304:
+  case 341:
 
 /* Line 1455 of yacc.c  */
-#line 1338 "./sparql_p.y"
+#line 1484 "./sparql_p.y"
     {
 		SPART *subselect_top;
 		SPART *where_gp;
@@ -5473,25 +5879,26 @@ yyreduce:
 		if (SPAR_REQ_TOP == subselect_top->type)
 		  sparp_expand_top_retvals (sparp_arg, subselect_top, 1 /* safely_copy_all_vars */);
 		spar_env_pop (sparp_arg);
-		(yyval.tree) = spar_gp_finalize_with_subquery (sparp_arg, (yyvsp[(9) - (9)].trees), subselect_top); }
+		(yyval.tree) = spar_gp_finalize_with_subquery (sparp_arg, (yyvsp[(9) - (9)].trees), subselect_top);
+		sparp_arg->sparp_allow_aggregates_in_expn >>= 1; }
     break;
 
-  case 305:
+  case 342:
 
 /* Line 1455 of yacc.c  */
-#line 1352 "./sparql_p.y"
+#line 1499 "./sparql_p.y"
     {
 		(yyval.tree) = (yyvsp[(1) - (1)].tree);
 		if (sparp_arg->sparp_in_precode_expn)
 		  sparyyerror ("Aggregates are not allowed in 'precode' expressions that should be calculated before the result-set of the query");
-		if (!sparp_arg->sparp_allow_aggregates_in_expn)
+		if (!(sparp_arg->sparp_allow_aggregates_in_expn & 1))
 		  sparyyerror ("Aggregates are allowed only in result sets"); }
     break;
 
-  case 307:
+  case 344:
 
 /* Line 1455 of yacc.c  */
-#line 1359 "./sparql_p.y"
+#line 1506 "./sparql_p.y"
     {	/* [55]	IRIrefOrFunction	 ::=  IRIref ArgList? */
                   if (NULL == (yyvsp[(2) - (2)].backstack))
 		    (yyval.tree) = (yyvsp[(1) - (2)].tree);
@@ -5504,143 +5911,143 @@ yyreduce:
 		    } }
     break;
 
-  case 308:
+  case 345:
 
 /* Line 1455 of yacc.c  */
-#line 1369 "./sparql_p.y"
+#line 1516 "./sparql_p.y"
     { (yyval.tree) = (SPART *)((yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 309:
+  case 346:
 
 /* Line 1455 of yacc.c  */
-#line 1370 "./sparql_p.y"
+#line 1517 "./sparql_p.y"
     { (yyval.tree) = (SPART *)((yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 310:
+  case 347:
 
 /* Line 1455 of yacc.c  */
-#line 1371 "./sparql_p.y"
+#line 1518 "./sparql_p.y"
     { (yyval.tree) = (SPART *)((yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 313:
+  case 350:
 
 /* Line 1455 of yacc.c  */
-#line 1378 "./sparql_p.y"
+#line 1525 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)STR_L, t_list (1, (yyvsp[(3) - (4)].tree))); }
     break;
 
-  case 314:
+  case 351:
 
 /* Line 1455 of yacc.c  */
-#line 1380 "./sparql_p.y"
+#line 1527 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)LANG_L, t_list (1, (yyvsp[(3) - (4)].tree))); }
     break;
 
-  case 315:
+  case 352:
 
 /* Line 1455 of yacc.c  */
-#line 1382 "./sparql_p.y"
+#line 1529 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)LANGMATCHES_L, t_list (2, (yyvsp[(3) - (6)].tree), (yyvsp[(5) - (6)].tree))); }
     break;
 
-  case 316:
+  case 353:
 
 /* Line 1455 of yacc.c  */
-#line 1384 "./sparql_p.y"
+#line 1531 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)DATATYPE_L, t_list (1, (yyvsp[(3) - (4)].tree))); }
     break;
 
-  case 317:
+  case 354:
 
 /* Line 1455 of yacc.c  */
-#line 1386 "./sparql_p.y"
+#line 1533 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)BOUND_L, t_list (1, (yyvsp[(3) - (4)].tree))); }
     break;
 
-  case 318:
+  case 355:
 
 /* Line 1455 of yacc.c  */
-#line 1388 "./sparql_p.y"
+#line 1535 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)SAMETERM_L, t_list (2, (yyvsp[(3) - (6)].tree), (yyvsp[(5) - (6)].tree))); }
     break;
 
-  case 319:
+  case 356:
 
 /* Line 1455 of yacc.c  */
-#line 1390 "./sparql_p.y"
+#line 1537 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)isIRI_L, t_list (1, (yyvsp[(3) - (4)].tree))); }
     break;
 
-  case 320:
+  case 357:
 
 /* Line 1455 of yacc.c  */
-#line 1392 "./sparql_p.y"
+#line 1539 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)isURI_L, t_list (1, (yyvsp[(3) - (4)].tree))); }
     break;
 
-  case 321:
+  case 358:
 
 /* Line 1455 of yacc.c  */
-#line 1394 "./sparql_p.y"
+#line 1541 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)isBLANK_L, t_list (1, (yyvsp[(3) - (4)].tree))); }
     break;
 
-  case 322:
+  case 359:
 
 /* Line 1455 of yacc.c  */
-#line 1396 "./sparql_p.y"
+#line 1543 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)isLITERAL_L, t_list (1, (yyvsp[(3) - (4)].tree))); }
     break;
 
-  case 324:
+  case 361:
 
 /* Line 1455 of yacc.c  */
-#line 1399 "./sparql_p.y"
+#line 1546 "./sparql_p.y"
     { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "IRI (built-in call)"); }
     break;
 
-  case 325:
+  case 362:
 
 /* Line 1455 of yacc.c  */
-#line 1401 "./sparql_p.y"
+#line 1548 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)IRI_L, t_list (1, (yyvsp[(4) - (5)].tree))); }
     break;
 
-  case 326:
+  case 363:
 
 /* Line 1455 of yacc.c  */
-#line 1403 "./sparql_p.y"
+#line 1550 "./sparql_p.y"
     { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "isREF (built-in call)"); }
     break;
 
-  case 327:
+  case 364:
 
 /* Line 1455 of yacc.c  */
-#line 1405 "./sparql_p.y"
+#line 1552 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)isREF_L, t_list (1, (yyvsp[(4) - (5)].tree))); }
     break;
 
-  case 328:
+  case 365:
 
 /* Line 1455 of yacc.c  */
-#line 1410 "./sparql_p.y"
+#line 1557 "./sparql_p.y"
     { (yyval.tree) = spar_make_regex_or_like_or_eq (sparp_arg, (yyvsp[(3) - (6)].tree), (yyvsp[(5) - (6)].tree)); }
     break;
 
-  case 329:
+  case 366:
 
 /* Line 1455 of yacc.c  */
-#line 1412 "./sparql_p.y"
+#line 1559 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 3, SPAR_BUILT_IN_CALL, (ptrlong)REGEX_L, t_list (3, (yyvsp[(3) - (8)].tree), (yyvsp[(5) - (8)].tree), (yyvsp[(7) - (8)].tree))); }
     break;
 
-  case 330:
+  case 367:
 
 /* Line 1455 of yacc.c  */
-#line 1416 "./sparql_p.y"
+#line 1563 "./sparql_p.y"
     {
                   SPART **args = (SPART **)(((dk_set_t)NIL_L == (yyvsp[(2) - (2)].backstack)) ? NULL : t_revlist_to_array ((yyvsp[(2) - (2)].backstack)));
                   caddr_t fname = (yyvsp[(1) - (2)].tree)->_.lit.val;
@@ -5648,279 +6055,286 @@ yyreduce:
 		  (yyval.tree) = spar_make_funcall (sparp_arg, 0, fname, args); }
     break;
 
-  case 331:
+  case 368:
 
 /* Line 1455 of yacc.c  */
-#line 1424 "./sparql_p.y"
+#line 1571 "./sparql_p.y"
     { (yyval.backstack) = NULL; }
     break;
 
-  case 332:
+  case 369:
 
 /* Line 1455 of yacc.c  */
-#line 1425 "./sparql_p.y"
+#line 1572 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (1)].backstack); }
     break;
 
-  case 333:
+  case 370:
 
 /* Line 1455 of yacc.c  */
-#line 1429 "./sparql_p.y"
+#line 1576 "./sparql_p.y"
     { (yyval.backstack) = (dk_set_t)NIL_L; }
     break;
 
-  case 334:
+  case 371:
 
 /* Line 1455 of yacc.c  */
-#line 1430 "./sparql_p.y"
+#line 1577 "./sparql_p.y"
+    { (yyval.backstack) = (dk_set_t)NIL_L; }
+    break;
+
+  case 372:
+
+/* Line 1455 of yacc.c  */
+#line 1578 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(2) - (3)].backstack); }
     break;
 
-  case 335:
+  case 373:
 
 /* Line 1455 of yacc.c  */
-#line 1434 "./sparql_p.y"
+#line 1582 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 336:
+  case 374:
 
 /* Line 1455 of yacc.c  */
-#line 1435 "./sparql_p.y"
+#line 1583 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (3)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 337:
+  case 375:
 
 /* Line 1455 of yacc.c  */
-#line 1436 "./sparql_p.y"
+#line 1584 "./sparql_p.y"
     { sparyyerror ("Argument expected after comma"); }
     break;
 
-  case 338:
+  case 376:
 
 /* Line 1455 of yacc.c  */
-#line 1437 "./sparql_p.y"
+#line 1585 "./sparql_p.y"
     { sparyyerror ("Comma or ')' expected after function argument"); }
     break;
 
-  case 339:
+  case 377:
 
 /* Line 1455 of yacc.c  */
-#line 1441 "./sparql_p.y"
+#line 1589 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 4, SPAR_LIT, (yyvsp[(1) - (1)].box), uname_xmlschema_ns_uri_hash_integer, NULL); }
     break;
 
-  case 340:
+  case 378:
 
 /* Line 1455 of yacc.c  */
-#line 1442 "./sparql_p.y"
+#line 1590 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 4, SPAR_LIT, (yyvsp[(1) - (1)].box), uname_xmlschema_ns_uri_hash_decimal, NULL); }
     break;
 
-  case 341:
+  case 379:
 
 /* Line 1455 of yacc.c  */
-#line 1443 "./sparql_p.y"
+#line 1591 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 4, SPAR_LIT, (yyvsp[(1) - (1)].box), uname_xmlschema_ns_uri_hash_double, NULL); }
     break;
 
-  case 342:
+  case 380:
 
 /* Line 1455 of yacc.c  */
-#line 1447 "./sparql_p.y"
+#line 1595 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 4, SPAR_LIT, (yyvsp[(1) - (1)].box), NULL, NULL); }
     break;
 
-  case 343:
+  case 381:
 
 /* Line 1455 of yacc.c  */
-#line 1448 "./sparql_p.y"
+#line 1596 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 4, SPAR_LIT, (yyvsp[(1) - (2)].box), NULL, (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 344:
+  case 382:
 
 /* Line 1455 of yacc.c  */
-#line 1449 "./sparql_p.y"
+#line 1597 "./sparql_p.y"
     { (yyval.tree) = spar_make_typed_literal (sparp_arg, (yyvsp[(1) - (3)].box), (yyvsp[(3) - (3)].tree)->_.lit.val, NULL); }
     break;
 
-  case 345:
+  case 383:
 
 /* Line 1455 of yacc.c  */
-#line 1453 "./sparql_p.y"
+#line 1601 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 4, SPAR_LIT, (ptrlong)1, uname_xmlschema_ns_uri_hash_boolean, NULL); }
     break;
 
-  case 346:
+  case 384:
 
 /* Line 1455 of yacc.c  */
-#line 1454 "./sparql_p.y"
+#line 1602 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 4, SPAR_LIT, (ptrlong)0, uname_xmlschema_ns_uri_hash_boolean, NULL); }
     break;
 
-  case 347:
+  case 385:
 
 /* Line 1455 of yacc.c  */
-#line 1458 "./sparql_p.y"
+#line 1606 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 348:
+  case 386:
 
 /* Line 1455 of yacc.c  */
-#line 1459 "./sparql_p.y"
+#line 1607 "./sparql_p.y"
     { (yyval.tree) = (SPART *)((ptrlong)_STAR); }
     break;
 
-  case 349:
+  case 387:
 
 /* Line 1455 of yacc.c  */
-#line 1460 "./sparql_p.y"
+#line 1608 "./sparql_p.y"
     { (yyval.tree) = (SPART *)((ptrlong)DEFAULT_L); }
     break;
 
-  case 350:
+  case 388:
 
 /* Line 1455 of yacc.c  */
-#line 1464 "./sparql_p.y"
+#line 1612 "./sparql_p.y"
     { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "\"variable+>property\""); (yyval.token_type) = _PLUS_GT; }
     break;
 
-  case 351:
+  case 389:
 
 /* Line 1455 of yacc.c  */
-#line 1465 "./sparql_p.y"
+#line 1613 "./sparql_p.y"
     { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "\"variable*>property\""); (yyval.token_type) = _STAR_GT; }
     break;
 
-  case 352:
+  case 390:
 
 /* Line 1455 of yacc.c  */
-#line 1469 "./sparql_p.y"
+#line 1617 "./sparql_p.y"
     {
 		(yyval.trees) = (SPART **) t_list ( 4, (yyvsp[(1) - (2)].token_type),
 		  spartlist (sparp_arg, 2, SPAR_QNAME, sparp_expand_q_iri_ref (sparp_arg, (yyvsp[(2) - (2)].box))),
 		  Q_IRI_REF, (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 353:
+  case 391:
 
 /* Line 1455 of yacc.c  */
-#line 1473 "./sparql_p.y"
+#line 1621 "./sparql_p.y"
     {
 		(yyval.trees) = (SPART **) t_list ( 4, (yyvsp[(1) - (2)].token_type),
 		  spartlist (sparp_arg, 2, SPAR_QNAME, sparp_expand_qname_prefix (sparp_arg, (yyvsp[(2) - (2)].box))),
 		  QNAME, (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 354:
+  case 392:
 
 /* Line 1455 of yacc.c  */
-#line 1477 "./sparql_p.y"
+#line 1625 "./sparql_p.y"
     {
 		(yyval.trees) = (SPART **) t_list ( 4, (yyvsp[(1) - (2)].token_type),
 		  spartlist (sparp_arg, 2, SPAR_QNAME, sparp_expand_qname_prefix (sparp_arg, (yyvsp[(2) - (2)].box))),
 		  QNAME_NS, (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 355:
+  case 393:
 
 /* Line 1455 of yacc.c  */
-#line 1481 "./sparql_p.y"
+#line 1629 "./sparql_p.y"
     { sparyyerror ("IRI reference expected after *> or +> operator"); }
     break;
 
-  case 356:
+  case 394:
 
 /* Line 1455 of yacc.c  */
-#line 1485 "./sparql_p.y"
+#line 1633 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 2, SPAR_QNAME, sparp_expand_q_iri_ref (sparp_arg, (yyvsp[(1) - (1)].box))); }
     break;
 
-  case 357:
+  case 395:
 
 /* Line 1455 of yacc.c  */
-#line 1486 "./sparql_p.y"
+#line 1634 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 358:
+  case 396:
 
 /* Line 1455 of yacc.c  */
-#line 1490 "./sparql_p.y"
+#line 1638 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 2, SPAR_QNAME, sparp_expand_qname_prefix (sparp_arg, (yyvsp[(1) - (1)].box))); }
     break;
 
-  case 359:
+  case 397:
 
 /* Line 1455 of yacc.c  */
-#line 1491 "./sparql_p.y"
+#line 1639 "./sparql_p.y"
     { (yyval.tree) = spartlist (sparp_arg, 2, SPAR_QNAME/*_NS*/, sparp_expand_qname_prefix (sparp_arg, (yyvsp[(1) - (1)].box))); }
     break;
 
-  case 360:
+  case 398:
 
 /* Line 1455 of yacc.c  */
-#line 1495 "./sparql_p.y"
+#line 1643 "./sparql_p.y"
     { (yyval.tree) = spar_make_blank_node (sparp_arg, (yyvsp[(1) - (1)].box), 0); }
     break;
 
-  case 361:
+  case 399:
 
 /* Line 1455 of yacc.c  */
-#line 1496 "./sparql_p.y"
+#line 1644 "./sparql_p.y"
     { (yyval.tree) = spar_make_blank_node (sparp_arg, spar_mkid (sparp_arg, "_:anon"), 1); }
     break;
 
-  case 362:
+  case 400:
 
 /* Line 1455 of yacc.c  */
-#line 1502 "./sparql_p.y"
+#line 1650 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 363:
+  case 401:
 
 /* Line 1455 of yacc.c  */
-#line 1503 "./sparql_p.y"
+#line 1651 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (2)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 373:
+  case 411:
 
 /* Line 1455 of yacc.c  */
-#line 1524 "./sparql_p.y"
+#line 1672 "./sparql_p.y"
     {
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
 		t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); }
     break;
 
-  case 374:
+  case 412:
 
 /* Line 1455 of yacc.c  */
-#line 1527 "./sparql_p.y"
+#line 1675 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_top_or_special_case_from_wm (sparp_arg, INSERT_L, NULL,
                   spar_selid_pop (sparp_arg), (yyvsp[(5) - (5)].tree) );
                 spar_compose_retvals_of_insert_or_delete (sparp_arg, (yyval.tree), (yyvsp[(2) - (5)].tree), (yyvsp[(4) - (5)].tree)); }
     break;
 
-  case 375:
+  case 413:
 
 /* Line 1455 of yacc.c  */
-#line 1536 "./sparql_p.y"
+#line 1684 "./sparql_p.y"
     {
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
 		t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
 		sparp_arg->sparp_in_precode_expn = 2; }
     break;
 
-  case 376:
+  case 414:
 
 /* Line 1455 of yacc.c  */
-#line 1540 "./sparql_p.y"
+#line 1688 "./sparql_p.y"
     {
                 SPART *fake = spar_make_fake_action_solution (sparp_arg);
 		sparp_arg->sparp_in_precode_expn = 0;
@@ -5929,39 +6343,39 @@ yyreduce:
                 spar_compose_retvals_of_insert_or_delete (sparp_arg, (yyval.tree), (yyvsp[(3) - (5)].tree), (yyvsp[(5) - (5)].tree)); }
     break;
 
-  case 377:
+  case 415:
 
 /* Line 1455 of yacc.c  */
-#line 1551 "./sparql_p.y"
+#line 1699 "./sparql_p.y"
     {
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
 		t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); }
     break;
 
-  case 378:
+  case 416:
 
 /* Line 1455 of yacc.c  */
-#line 1554 "./sparql_p.y"
+#line 1702 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_top_or_special_case_from_wm (sparp_arg, DELETE_L, NULL,
                   spar_selid_pop (sparp_arg), (yyvsp[(5) - (5)].tree) );
                 spar_compose_retvals_of_insert_or_delete (sparp_arg, (yyval.tree), (yyvsp[(2) - (5)].tree), (yyvsp[(4) - (5)].tree)); }
     break;
 
-  case 379:
+  case 417:
 
 /* Line 1455 of yacc.c  */
-#line 1563 "./sparql_p.y"
+#line 1711 "./sparql_p.y"
     {
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
 		t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
 		sparp_arg->sparp_in_precode_expn = 2; }
     break;
 
-  case 380:
+  case 418:
 
 /* Line 1455 of yacc.c  */
-#line 1567 "./sparql_p.y"
+#line 1715 "./sparql_p.y"
     {
                 SPART *fake = spar_make_fake_action_solution (sparp_arg);
 		sparp_arg->sparp_in_precode_expn = 0;
@@ -5970,170 +6384,170 @@ yyreduce:
                 spar_compose_retvals_of_insert_or_delete (sparp_arg, (yyval.tree), (yyvsp[(3) - (5)].tree), (yyvsp[(5) - (5)].tree)); }
     break;
 
-  case 381:
+  case 419:
 
 /* Line 1455 of yacc.c  */
-#line 1579 "./sparql_p.y"
+#line 1727 "./sparql_p.y"
     {
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
 		t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); }
     break;
 
-  case 382:
+  case 420:
 
 /* Line 1455 of yacc.c  */
-#line 1583 "./sparql_p.y"
+#line 1731 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_top_or_special_case_from_wm (sparp_arg, MODIFY_L, NULL,
                   spar_selid_pop (sparp_arg), (yyvsp[(8) - (8)].tree) );
                 spar_compose_retvals_of_modify (sparp_arg, (yyval.tree), (yyvsp[(2) - (8)].tree), (yyvsp[(5) - (8)].tree), (yyvsp[(7) - (8)].tree)); }
     break;
 
-  case 383:
+  case 421:
 
 /* Line 1455 of yacc.c  */
-#line 1590 "./sparql_p.y"
+#line 1738 "./sparql_p.y"
     { (yyval.tree) = spar_make_sparul_clear (sparp_arg, (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 384:
+  case 422:
 
 /* Line 1455 of yacc.c  */
-#line 1595 "./sparql_p.y"
+#line 1743 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_sparul_load (sparp_arg, (yyvsp[(2) - (2)].tree), (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 385:
+  case 423:
 
 /* Line 1455 of yacc.c  */
-#line 1597 "./sparql_p.y"
+#line 1745 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_sparul_load (sparp_arg, (yyvsp[(5) - (5)].tree), (yyvsp[(2) - (5)].tree) /* yes, $2 after $3 */); }
     break;
 
-  case 386:
+  case 424:
 
 /* Line 1455 of yacc.c  */
-#line 1602 "./sparql_p.y"
+#line 1750 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_sparul_create (sparp_arg, (yyvsp[(4) - (4)].tree), (yyvsp[(2) - (4)].token_type) /* yes, $2 after $4 */); }
     break;
 
-  case 387:
+  case 425:
 
 /* Line 1455 of yacc.c  */
-#line 1607 "./sparql_p.y"
+#line 1755 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_sparul_drop (sparp_arg, (yyvsp[(4) - (4)].tree), (yyvsp[(2) - (4)].token_type) /* yes, $2 after $4 */); }
     break;
 
-  case 388:
+  case 426:
 
 /* Line 1455 of yacc.c  */
-#line 1612 "./sparql_p.y"
+#line 1760 "./sparql_p.y"
     { (yyval.tree) = spar_make_fake_action_solution (sparp_arg); }
     break;
 
-  case 389:
+  case 427:
 
 /* Line 1455 of yacc.c  */
-#line 1613 "./sparql_p.y"
+#line 1761 "./sparql_p.y"
     {
 		SPART *where_gp = spar_gp_finalize (sparp_arg, NULL);
-		(yyval.tree) = (yyvsp[(3) - (3)].tree);
-		(yyvsp[(3) - (3)].tree)->_.wm.where_gp = where_gp; }
+		(yyval.tree) = (yyvsp[(3) - (4)].tree);
+		(yyvsp[(3) - (4)].tree)->_.wm.where_gp = where_gp; }
     break;
 
-  case 390:
+  case 428:
 
 /* Line 1455 of yacc.c  */
-#line 1620 "./sparql_p.y"
+#line 1768 "./sparql_p.y"
     { (yyval.tree) = spar_default_sparul_target (sparp_arg, "INTO GRAPH IDENTIFIED BY clause"); }
     break;
 
-  case 391:
+  case 429:
 
 /* Line 1455 of yacc.c  */
-#line 1621 "./sparql_p.y"
+#line 1769 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(3) - (3)].tree); }
     break;
 
-  case 392:
+  case 430:
 
 /* Line 1455 of yacc.c  */
-#line 1625 "./sparql_p.y"
+#line 1773 "./sparql_p.y"
     { (yyval.tree) = spar_default_sparul_target (sparp_arg, "FROM GRAPH IDENTIFIED BY clause"); }
     break;
 
-  case 393:
+  case 431:
 
 /* Line 1455 of yacc.c  */
-#line 1626 "./sparql_p.y"
+#line 1774 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(3) - (3)].tree); }
     break;
 
-  case 394:
+  case 432:
 
 /* Line 1455 of yacc.c  */
-#line 1630 "./sparql_p.y"
+#line 1778 "./sparql_p.y"
     { (yyval.tree) = spar_default_sparul_target (sparp_arg, "GRAPH IDENTIFIED BY clause"); }
     break;
 
-  case 395:
+  case 433:
 
 /* Line 1455 of yacc.c  */
-#line 1631 "./sparql_p.y"
+#line 1779 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(2) - (2)].tree); }
     break;
 
-  case 396:
+  case 434:
 
 /* Line 1455 of yacc.c  */
-#line 1635 "./sparql_p.y"
+#line 1783 "./sparql_p.y"
     {}
     break;
 
-  case 397:
+  case 435:
 
 /* Line 1455 of yacc.c  */
-#line 1636 "./sparql_p.y"
+#line 1784 "./sparql_p.y"
     {}
     break;
 
-  case 398:
+  case 436:
 
 /* Line 1455 of yacc.c  */
-#line 1640 "./sparql_p.y"
+#line 1788 "./sparql_p.y"
     { (yyval.token_type) = 0; }
     break;
 
-  case 399:
+  case 437:
 
 /* Line 1455 of yacc.c  */
-#line 1641 "./sparql_p.y"
+#line 1789 "./sparql_p.y"
     { (yyval.token_type) = 1; }
     break;
 
-  case 401:
+  case 439:
 
 /* Line 1455 of yacc.c  */
-#line 1648 "./sparql_p.y"
+#line 1796 "./sparql_p.y"
     {
 		sparp_env()->spare_qm_default_table = NULL; }
     break;
 
-  case 403:
+  case 441:
 
 /* Line 1455 of yacc.c  */
-#line 1654 "./sparql_p.y"
+#line 1802 "./sparql_p.y"
     { t_set_push (&(sparp_env()->spare_acc_qm_sqls), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 413:
+  case 451:
 
 /* Line 1455 of yacc.c  */
-#line 1674 "./sparql_p.y"
+#line 1822 "./sparql_p.y"
     {
 		if (dk_set_get_keyword (sparp_arg->sparp_created_jsos, (yyvsp[(4) - (7)].box), NULL))
 		  spar_error (sparp_arg, "The identifier of IRI class %.100s is already used in the previous part of the statement", (yyvsp[(4) - (7)].box));
@@ -6144,10 +6558,10 @@ yyreduce:
                 sparp_jso_push_affected (sparp_arg, uname_virtrdf_ns_uri_QuadStorage); }
     break;
 
-  case 414:
+  case 452:
 
 /* Line 1455 of yacc.c  */
-#line 1682 "./sparql_p.y"
+#line 1830 "./sparql_p.y"
     {
 		if (dk_set_get_keyword (sparp_arg->sparp_created_jsos, (yyvsp[(4) - (7)].box), NULL))
 		  spar_error (sparp_arg, "The identifier of IRI class %.100s is already used in the previous part of the statement", (yyvsp[(4) - (7)].box));
@@ -6158,10 +6572,10 @@ yyreduce:
                 sparp_jso_push_affected (sparp_arg, uname_virtrdf_ns_uri_QuadStorage); }
     break;
 
-  case 415:
+  case 453:
 
 /* Line 1455 of yacc.c  */
-#line 1694 "./sparql_p.y"
+#line 1842 "./sparql_p.y"
     {
 		if (dk_set_get_keyword (sparp_arg->sparp_created_jsos, (yyvsp[(4) - (7)].box), NULL))
 		  spar_error (sparp_arg, "The identifier of literal class %.100s is already used in the previous part of the statement", (yyvsp[(4) - (7)].box));
@@ -6172,10 +6586,10 @@ yyreduce:
                 sparp_jso_push_affected (sparp_arg, uname_virtrdf_ns_uri_QuadStorage); }
     break;
 
-  case 416:
+  case 454:
 
 /* Line 1455 of yacc.c  */
-#line 1705 "./sparql_p.y"
+#line 1853 "./sparql_p.y"
     {
 		if (dk_set_get_keyword (sparp_arg->sparp_created_jsos, (yyvsp[(5) - (5)].box), NULL))
 		  spar_error (sparp_arg, "The identifier of IRI class %.100s is already used in the previous part of the statement", (yyvsp[(5) - (5)].box));
@@ -6185,10 +6599,10 @@ yyreduce:
                 sparp_jso_push_affected (sparp_arg, uname_virtrdf_ns_uri_QuadStorage); }
     break;
 
-  case 417:
+  case 455:
 
 /* Line 1455 of yacc.c  */
-#line 1715 "./sparql_p.y"
+#line 1863 "./sparql_p.y"
     {
 		if (dk_set_get_keyword (sparp_arg->sparp_created_jsos, (yyvsp[(5) - (5)].box), NULL))
 		  spar_error (sparp_arg, "The identifier of literal class %.100s is already used in the previous part of the statement", (yyvsp[(5) - (5)].box));
@@ -6198,200 +6612,200 @@ yyreduce:
                 sparp_jso_push_affected (sparp_arg, uname_virtrdf_ns_uri_QuadStorage); }
     break;
 
-  case 418:
+  case 456:
 
 /* Line 1455 of yacc.c  */
-#line 1725 "./sparql_p.y"
+#line 1873 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_qm_sql (sparp_arg, "DB.DBA.RDF_QM_DEFINE_SUBCLASS",
 		  (SPART **)t_list (2, (yyvsp[(4) - (7)].box), (yyvsp[(7) - (7)].box)), NULL );
 		sparp_jso_push_affected (sparp_arg, uname_virtrdf_ns_uri_QuadStorage); }
     break;
 
-  case 419:
+  case 457:
 
 /* Line 1455 of yacc.c  */
-#line 1729 "./sparql_p.y"
+#line 1877 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_qm_sql (sparp_arg, "DB.DBA.RDF_QM_DEFINE_SUBCLASS",
 		  (SPART **)t_list (2, (yyvsp[(2) - (5)].box), (yyvsp[(5) - (5)].box)), NULL );
 		sparp_jso_push_affected (sparp_arg, uname_virtrdf_ns_uri_QuadStorage); }
     break;
 
-  case 420:
+  case 458:
 
 /* Line 1455 of yacc.c  */
-#line 1736 "./sparql_p.y"
+#line 1884 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (0); }
     break;
 
-  case 421:
+  case 459:
 
 /* Line 1455 of yacc.c  */
-#line 1737 "./sparql_p.y"
+#line 1885 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (0); }
     break;
 
-  case 422:
+  case 460:
 
 /* Line 1455 of yacc.c  */
-#line 1738 "./sparql_p.y"
+#line 1886 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_revlist_to_array ((yyvsp[(3) - (4)].backstack)); }
     break;
 
-  case 423:
+  case 461:
 
 /* Line 1455 of yacc.c  */
-#line 1742 "./sparql_p.y"
+#line 1890 "./sparql_p.y"
     {
 		(yyval.backstack) = NULL;
 		t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].trees)[0]);
 		t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].trees)[1]); }
     break;
 
-  case 424:
+  case 462:
 
 /* Line 1455 of yacc.c  */
-#line 1746 "./sparql_p.y"
+#line 1894 "./sparql_p.y"
     {
 		(yyval.backstack) = (yyvsp[(1) - (3)].backstack);
 		t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].trees)[0]);
 		t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].trees)[1]); }
     break;
 
-  case 425:
+  case 463:
 
 /* Line 1455 of yacc.c  */
-#line 1753 "./sparql_p.y"
+#line 1901 "./sparql_p.y"
     {			/*... 'BIJECTION'	*/
 		(yyval.trees) = (SPART **)t_list (2, t_box_dv_uname_string ("BIJECTION"), (ptrlong)1); }
     break;
 
-  case 426:
+  case 464:
 
 /* Line 1455 of yacc.c  */
-#line 1755 "./sparql_p.y"
+#line 1903 "./sparql_p.y"
     {			/*... | 'DEREF'	*/
 		(yyval.trees) = (SPART **)t_list (2, t_box_dv_uname_string ("DEREF"), (ptrlong)1); }
     break;
 
-  case 427:
+  case 465:
 
 /* Line 1455 of yacc.c  */
-#line 1757 "./sparql_p.y"
+#line 1905 "./sparql_p.y"
     {			/*... | 'RETURNS' STRING ('UNION' STRING)*	*/
 		(yyval.trees) = (SPART **)t_list (2, t_box_dv_uname_string ("RETURNS"),
 		    spar_make_vector_qm_sql (sparp_arg, (SPART **)t_revlist_to_array ((yyvsp[(2) - (2)].backstack))) ); }
     break;
 
-  case 428:
+  case 466:
 
 /* Line 1455 of yacc.c  */
-#line 1763 "./sparql_p.y"
+#line 1911 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].box)); }
     break;
 
-  case 429:
+  case 467:
 
 /* Line 1455 of yacc.c  */
-#line 1764 "./sparql_p.y"
+#line 1912 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (3)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].box)); }
     break;
 
-  case 430:
+  case 468:
 
 /* Line 1455 of yacc.c  */
-#line 1768 "./sparql_p.y"
+#line 1916 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (0); }
     break;
 
-  case 431:
+  case 469:
 
 /* Line 1455 of yacc.c  */
-#line 1769 "./sparql_p.y"
+#line 1917 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (0); }
     break;
 
-  case 432:
+  case 470:
 
 /* Line 1455 of yacc.c  */
-#line 1770 "./sparql_p.y"
+#line 1918 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_revlist_to_array ((yyvsp[(3) - (4)].backstack)); }
     break;
 
-  case 433:
+  case 471:
 
 /* Line 1455 of yacc.c  */
-#line 1774 "./sparql_p.y"
+#line 1922 "./sparql_p.y"
     {
 		(yyval.backstack) = NULL;
 		t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].boxes)[0]);
 		t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].boxes)[1]); }
     break;
 
-  case 434:
+  case 472:
 
 /* Line 1455 of yacc.c  */
-#line 1778 "./sparql_p.y"
+#line 1926 "./sparql_p.y"
     {
 		(yyval.backstack) = (yyvsp[(1) - (3)].backstack);
 		t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].boxes)[0]);
 		t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].boxes)[1]); }
     break;
 
-  case 435:
+  case 473:
 
 /* Line 1455 of yacc.c  */
-#line 1785 "./sparql_p.y"
+#line 1933 "./sparql_p.y"
     {	/*... ( 'DATATYPE' QmIRIrefConst )	*/
 		(yyval.boxes) = t_list (2, t_box_dv_uname_string ("DATATYPE"), t_box_dv_uname_string ((yyvsp[(2) - (2)].box))); }
     break;
 
-  case 436:
+  case 474:
 
 /* Line 1455 of yacc.c  */
-#line 1787 "./sparql_p.y"
+#line 1935 "./sparql_p.y"
     {			/*... | ( 'LANG' STRING )	*/
 		(yyval.boxes) = t_list (2, t_box_dv_uname_string ("LANG"), t_box_dv_uname_string ((yyvsp[(2) - (2)].box))); }
     break;
 
-  case 437:
+  case 475:
 
 /* Line 1455 of yacc.c  */
-#line 1789 "./sparql_p.y"
+#line 1937 "./sparql_p.y"
     {			/*... | ( 'LANG' STRING )	*/
 		(yyval.boxes) = t_list (2, t_box_dv_uname_string ("LANG"), t_box_dv_uname_string ((yyvsp[(2) - (2)].box))); }
     break;
 
-  case 438:
+  case 476:
 
 /* Line 1455 of yacc.c  */
-#line 1791 "./sparql_p.y"
+#line 1939 "./sparql_p.y"
     {			/*... | 'BIJECTION'	*/
 		(yyval.boxes) = t_list (2, t_box_dv_uname_string ("BIJECTION"), (ptrlong)1); }
     break;
 
-  case 439:
+  case 477:
 
 /* Line 1455 of yacc.c  */
-#line 1793 "./sparql_p.y"
+#line 1941 "./sparql_p.y"
     {			/*... | 'DEREF'	*/
 		(yyval.boxes) = t_list (2, t_box_dv_uname_string ("DEREF"), (ptrlong)1); }
     break;
 
-  case 440:
+  case 478:
 
 /* Line 1455 of yacc.c  */
-#line 1795 "./sparql_p.y"
+#line 1943 "./sparql_p.y"
     {			/*... | 'RETURNS' STRING ('UNION' STRING)*	*/
 		(yyval.boxes) = t_list (2, t_box_dv_uname_string ("RETURNS"),
 		    spar_make_vector_qm_sql (sparp_arg, (SPART **)t_revlist_to_array ((yyvsp[(2) - (2)].backstack))) ); }
     break;
 
-  case 441:
+  case 479:
 
 /* Line 1455 of yacc.c  */
-#line 1801 "./sparql_p.y"
+#line 1949 "./sparql_p.y"
     {
 		sparp_env()->spare_storage_name = (yyvsp[(4) - (4)].box);
 		if (dk_set_get_keyword (sparp_arg->sparp_created_jsos, (yyvsp[(4) - (4)].box), NULL))
@@ -6407,18 +6821,18 @@ yyreduce:
                 sparp_jso_push_affected (sparp_arg, (yyvsp[(4) - (4)].box)); }
     break;
 
-  case 442:
+  case 480:
 
 /* Line 1455 of yacc.c  */
-#line 1815 "./sparql_p.y"
+#line 1963 "./sparql_p.y"
     {
 		spar_qm_push_bookmark (sparp_arg); }
     break;
 
-  case 443:
+  case 481:
 
 /* Line 1455 of yacc.c  */
-#line 1817 "./sparql_p.y"
+#line 1965 "./sparql_p.y"
     {
 		t_set_push (&(sparp_env()->spare_acc_qm_sqls),
 		  spar_make_qm_sql (sparp_arg, "DB.DBA.RDF_QM_END_ALTER_QUAD_STORAGE",
@@ -6427,10 +6841,10 @@ yyreduce:
 		sparp_env()->spare_storage_name = NULL; }
     break;
 
-  case 444:
+  case 482:
 
 /* Line 1455 of yacc.c  */
-#line 1826 "./sparql_p.y"
+#line 1974 "./sparql_p.y"
     {
 		sparp_env()->spare_storage_name = (yyvsp[(4) - (4)].box);
 		t_set_push (&(sparp_env()->spare_acc_qm_sqls),
@@ -6439,18 +6853,18 @@ yyreduce:
                 sparp_jso_push_affected (sparp_arg, (yyvsp[(4) - (4)].box)); }
     break;
 
-  case 445:
+  case 483:
 
 /* Line 1455 of yacc.c  */
-#line 1833 "./sparql_p.y"
+#line 1981 "./sparql_p.y"
     {
 		spar_qm_push_bookmark (sparp_arg); }
     break;
 
-  case 446:
+  case 484:
 
 /* Line 1455 of yacc.c  */
-#line 1835 "./sparql_p.y"
+#line 1983 "./sparql_p.y"
     {
 		t_set_push (&(sparp_env()->spare_acc_qm_sqls),
 		  spar_make_qm_sql (sparp_arg, "DB.DBA.RDF_QM_END_ALTER_QUAD_STORAGE",
@@ -6459,10 +6873,10 @@ yyreduce:
 		sparp_env()->spare_storage_name = NULL; }
     break;
 
-  case 447:
+  case 485:
 
 /* Line 1455 of yacc.c  */
-#line 1844 "./sparql_p.y"
+#line 1992 "./sparql_p.y"
     {
 		if (dk_set_get_keyword (sparp_arg->sparp_created_jsos, (yyvsp[(5) - (5)].box), NULL))
 		  spar_error (sparp_arg, "The identifier of Quad Storage %.100s is already used in the previous part of the statement", (yyvsp[(5) - (5)].box));
@@ -6473,10 +6887,10 @@ yyreduce:
                 sparp_jso_push_affected (sparp_arg, (yyvsp[(5) - (5)].box)); }
     break;
 
-  case 448:
+  case 486:
 
 /* Line 1455 of yacc.c  */
-#line 1855 "./sparql_p.y"
+#line 2003 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_qm_sql (sparp_arg, "DB.DBA.RDF_QM_DROP_MAPPING",
                   (SPART **)t_list (1, t_box_copy (sparp_env()->spare_storage_name)),
@@ -6485,10 +6899,10 @@ yyreduce:
                   sparp_jso_push_affected (sparp_arg, uname_virtrdf_ns_uri_QuadStorage); }
     break;
 
-  case 449:
+  case 487:
 
 /* Line 1455 of yacc.c  */
-#line 1861 "./sparql_p.y"
+#line 2009 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_qm_sql (sparp_arg, "DB.DBA.RDF_QM_DROP_MAPPING",
                     (SPART **)t_list (1, t_box_copy (sparp_env()->spare_storage_name)),
@@ -6497,10 +6911,10 @@ yyreduce:
                   sparp_jso_push_affected (sparp_arg, uname_virtrdf_ns_uri_QuadStorage); }
     break;
 
-  case 450:
+  case 488:
 
 /* Line 1455 of yacc.c  */
-#line 1870 "./sparql_p.y"
+#line 2018 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_qm_sql (sparp_arg, "DB.DBA.RDF_QM_DROP_MAPPING",
                   (SPART **)t_list (1, t_box_copy (sparp_env()->spare_storage_name)),
@@ -6509,10 +6923,10 @@ yyreduce:
                   sparp_jso_push_affected (sparp_arg, uname_virtrdf_ns_uri_QuadStorage); }
     break;
 
-  case 451:
+  case 489:
 
 /* Line 1455 of yacc.c  */
-#line 1876 "./sparql_p.y"
+#line 2024 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_qm_sql (sparp_arg, "DB.DBA.RDF_QM_DROP_MAPPING",
                     (SPART **)t_list (1, t_box_copy (sparp_env()->spare_storage_name)),
@@ -6521,256 +6935,256 @@ yyreduce:
                   sparp_jso_push_affected (sparp_arg, uname_virtrdf_ns_uri_QuadStorage); }
     break;
 
-  case 452:
+  case 490:
 
 /* Line 1455 of yacc.c  */
-#line 1885 "./sparql_p.y"
+#line 2033 "./sparql_p.y"
     {}
     break;
 
-  case 453:
+  case 491:
 
 /* Line 1455 of yacc.c  */
-#line 1886 "./sparql_p.y"
+#line 2034 "./sparql_p.y"
     {	/*... ( 'FROM' QTABLE 'AS' PLAIN_ID QmTextLiteral* )	*/
 		spar_qm_add_aliased_table (sparp_arg, (yyvsp[(3) - (5)].box), (yyvsp[(5) - (5)].box));
 		sparp_env()->spare_qm_current_table_alias = (yyvsp[(5) - (5)].box); }
     break;
 
-  case 454:
+  case 492:
 
 /* Line 1455 of yacc.c  */
-#line 1889 "./sparql_p.y"
+#line 2037 "./sparql_p.y"
     {
 		sparp_env()->spare_qm_current_table_alias = NULL; }
     break;
 
-  case 455:
+  case 493:
 
 /* Line 1455 of yacc.c  */
-#line 1891 "./sparql_p.y"
+#line 2039 "./sparql_p.y"
     {		/*... | ( 'FROM' PLAIN_ID 'AS' PLAIN_ID QmTextLiteral* )	*/
 		spar_qm_add_aliased_alias (sparp_arg, (yyvsp[(3) - (5)].box), (yyvsp[(5) - (5)].box));
 		sparp_env()->spare_qm_current_table_alias = (yyvsp[(5) - (5)].box); }
     break;
 
-  case 456:
+  case 494:
 
 /* Line 1455 of yacc.c  */
-#line 1894 "./sparql_p.y"
+#line 2042 "./sparql_p.y"
     {
 		sparp_env()->spare_qm_current_table_alias = NULL; }
     break;
 
-  case 457:
+  case 495:
 
 /* Line 1455 of yacc.c  */
-#line 1896 "./sparql_p.y"
+#line 2044 "./sparql_p.y"
     {						/*... | QmCondition	*/
 		spar_qm_add_table_filter (sparp_arg, (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 458:
+  case 496:
 
 /* Line 1455 of yacc.c  */
-#line 1901 "./sparql_p.y"
+#line 2049 "./sparql_p.y"
     {}
     break;
 
-  case 460:
+  case 498:
 
 /* Line 1455 of yacc.c  */
-#line 1906 "./sparql_p.y"
+#line 2054 "./sparql_p.y"
     {
 		spar_qm_add_text_literal (sparp_arg,
 		  sparp_env()->spare_qm_current_table_alias,
 		  (yyvsp[(2) - (6)].box), (yyvsp[(4) - (6)].tree), (yyvsp[(5) - (6)].trees), (yyvsp[(6) - (6)].trees) ); }
     break;
 
-  case 461:
+  case 499:
 
 /* Line 1455 of yacc.c  */
-#line 1913 "./sparql_p.y"
+#line 2061 "./sparql_p.y"
     { (yyval.box) = NULL; }
     break;
 
-  case 462:
+  case 500:
 
 /* Line 1455 of yacc.c  */
-#line 1914 "./sparql_p.y"
+#line 2062 "./sparql_p.y"
     { (yyval.box) = (yyvsp[(1) - (1)].box); }
     break;
 
-  case 463:
+  case 501:
 
 /* Line 1455 of yacc.c  */
-#line 1918 "./sparql_p.y"
+#line 2066 "./sparql_p.y"
     { (yyval.trees) = NULL; }
     break;
 
-  case 464:
+  case 502:
 
 /* Line 1455 of yacc.c  */
-#line 1919 "./sparql_p.y"
+#line 2067 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_revlist_to_array ((yyvsp[(3) - (4)].backstack)); }
     break;
 
-  case 465:
+  case 503:
 
 /* Line 1455 of yacc.c  */
-#line 1923 "./sparql_p.y"
+#line 2071 "./sparql_p.y"
     { (yyval.trees) = NULL; }
     break;
 
-  case 466:
+  case 504:
 
 /* Line 1455 of yacc.c  */
-#line 1924 "./sparql_p.y"
+#line 2072 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_revlist_to_array ((yyvsp[(3) - (4)].backstack)); }
     break;
 
-  case 467:
+  case 505:
 
 /* Line 1455 of yacc.c  */
-#line 1928 "./sparql_p.y"
+#line 2076 "./sparql_p.y"
     {
 		(yyval.backstack) = NULL;
 		t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].trees)[1]);
 		t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].trees)[0]); }
     break;
 
-  case 468:
+  case 506:
 
 /* Line 1455 of yacc.c  */
-#line 1932 "./sparql_p.y"
+#line 2080 "./sparql_p.y"
     {
 		(yyval.backstack) = (yyvsp[(1) - (3)].backstack);
 		t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].trees)[1]);
 		t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].trees)[0]); }
     break;
 
-  case 469:
+  case 507:
 
 /* Line 1455 of yacc.c  */
-#line 1939 "./sparql_p.y"
+#line 2087 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, t_box_dv_uname_string ((yyvsp[(1) - (1)].box)), NULL); }
     break;
 
-  case 470:
+  case 508:
 
 /* Line 1455 of yacc.c  */
-#line 1940 "./sparql_p.y"
+#line 2088 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, t_box_dv_uname_string ((yyvsp[(1) - (2)].box)), (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 471:
+  case 509:
 
 /* Line 1455 of yacc.c  */
-#line 1944 "./sparql_p.y"
+#line 2092 "./sparql_p.y"
     {}
     break;
 
-  case 472:
+  case 510:
 
 /* Line 1455 of yacc.c  */
-#line 1945 "./sparql_p.y"
+#line 2093 "./sparql_p.y"
     {}
     break;
 
-  case 473:
+  case 511:
 
 /* Line 1455 of yacc.c  */
-#line 1946 "./sparql_p.y"
+#line 2094 "./sparql_p.y"
     {}
     break;
 
-  case 474:
+  case 512:
 
 /* Line 1455 of yacc.c  */
-#line 1950 "./sparql_p.y"
+#line 2098 "./sparql_p.y"
     {}
     break;
 
-  case 475:
+  case 513:
 
 /* Line 1455 of yacc.c  */
-#line 1951 "./sparql_p.y"
+#line 2099 "./sparql_p.y"
     {
 		spar_qm_clean_locals (sparp_arg);
 		sparp_env()->spare_qm_default_table = NULL; }
     break;
 
-  case 476:
+  case 514:
 
 /* Line 1455 of yacc.c  */
-#line 1954 "./sparql_p.y"
+#line 2102 "./sparql_p.y"
     {}
     break;
 
-  case 478:
+  case 516:
 
 /* Line 1455 of yacc.c  */
-#line 1959 "./sparql_p.y"
+#line 2107 "./sparql_p.y"
     {
 		t_set_push (&(sparp_env()->spare_acc_qm_sqls), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 479:
+  case 517:
 
 /* Line 1455 of yacc.c  */
-#line 1961 "./sparql_p.y"
+#line 2109 "./sparql_p.y"
     {
 		t_set_push (&(sparp_env()->spare_acc_qm_sqls), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 480:
+  case 518:
 
 /* Line 1455 of yacc.c  */
-#line 1966 "./sparql_p.y"
+#line 2114 "./sparql_p.y"
     {}
     break;
 
-  case 481:
+  case 519:
 
 /* Line 1455 of yacc.c  */
-#line 1967 "./sparql_p.y"
+#line 2115 "./sparql_p.y"
     {}
     break;
 
-  case 482:
+  case 520:
 
 /* Line 1455 of yacc.c  */
-#line 1968 "./sparql_p.y"
+#line 2116 "./sparql_p.y"
     {}
     break;
 
-  case 484:
+  case 522:
 
 /* Line 1455 of yacc.c  */
-#line 1973 "./sparql_p.y"
+#line 2121 "./sparql_p.y"
     {
 		spar_qm_clean_locals (sparp_arg);
 		sparp_env()->spare_qm_default_table = NULL; }
     break;
 
-  case 486:
+  case 524:
 
 /* Line 1455 of yacc.c  */
-#line 1981 "./sparql_p.y"
+#line 2129 "./sparql_p.y"
     { spar_qm_push_local (sparp_arg, CREATE_L, (SPART *)((yyvsp[(2) - (3)].box)), 1); }
     break;
 
-  case 487:
+  case 525:
 
 /* Line 1455 of yacc.c  */
-#line 1982 "./sparql_p.y"
+#line 2130 "./sparql_p.y"
     {;}
     break;
 
-  case 488:
+  case 526:
 
 /* Line 1455 of yacc.c  */
-#line 1984 "./sparql_p.y"
+#line 2132 "./sparql_p.y"
     {
 		spar_qm_push_local (sparp_arg, CREATE_L, (SPART *)((yyvsp[(2) - (6)].box)), 1);
 		t_set_push (&(sparp_env()->spare_acc_qm_sqls),
@@ -6779,10 +7193,10 @@ yyreduce:
 		    (SPART **)t_list_concat ((caddr_t)(yyvsp[(6) - (6)].trees), (caddr_t)t_list (2, t_box_dv_uname_string ("ID"), (yyvsp[(2) - (6)].box))) ) ); }
     break;
 
-  case 489:
+  case 527:
 
 /* Line 1455 of yacc.c  */
-#line 1991 "./sparql_p.y"
+#line 2139 "./sparql_p.y"
     {
 		spar_qm_push_local (sparp_arg, GRAPH_L, (SPART *)((yyvsp[(3) - (7)].box)), 1);
 		t_set_push (&(sparp_env()->spare_acc_qm_sqls),
@@ -6791,10 +7205,10 @@ yyreduce:
 		    (SPART **)t_list_concat ((caddr_t)(yyvsp[(7) - (7)].trees), (caddr_t)t_list (2, t_box_dv_uname_string ("GRAPH"), (yyvsp[(3) - (7)].box))) ) ); }
     break;
 
-  case 490:
+  case 528:
 
 /* Line 1455 of yacc.c  */
-#line 1998 "./sparql_p.y"
+#line 2146 "./sparql_p.y"
     {
 		t_set_push (&(sparp_env()->spare_acc_qm_sqls),
 		  spar_qm_make_empty_mapping (sparp_arg, NULL, (yyvsp[(2) - (3)].trees)) );
@@ -6804,25 +7218,25 @@ yyreduce:
 		spar_qm_push_bookmark (sparp_arg); }
     break;
 
-  case 491:
+  case 529:
 
 /* Line 1455 of yacc.c  */
-#line 2005 "./sparql_p.y"
+#line 2153 "./sparql_p.y"
     {
 		spar_qm_pop_bookmark (sparp_arg); }
     break;
 
-  case 493:
+  case 531:
 
 /* Line 1455 of yacc.c  */
-#line 2011 "./sparql_p.y"
+#line 2159 "./sparql_p.y"
     {;}
     break;
 
-  case 494:
+  case 532:
 
 /* Line 1455 of yacc.c  */
-#line 2013 "./sparql_p.y"
+#line 2161 "./sparql_p.y"
     {
 		t_set_push (&(sparp_env()->spare_acc_qm_sqls),
 		  spar_qm_make_empty_mapping (sparp_arg,
@@ -6834,18 +7248,18 @@ yyreduce:
 		spar_qm_push_bookmark (sparp_arg); }
     break;
 
-  case 495:
+  case 533:
 
 /* Line 1455 of yacc.c  */
-#line 2022 "./sparql_p.y"
+#line 2170 "./sparql_p.y"
     {
 		spar_qm_pop_bookmark (sparp_arg); }
     break;
 
-  case 496:
+  case 534:
 
 /* Line 1455 of yacc.c  */
-#line 2027 "./sparql_p.y"
+#line 2175 "./sparql_p.y"
     {
 		spar_qm_push_local (sparp_arg, SUBJECT_L,
 		  ((NULL != (yyvsp[(1) - (3)].tree)) ? ((SPART *)((yyvsp[(1) - (3)].tree))) : spar_qm_get_local (sparp_arg, SUBJECT_L, 1)),
@@ -6859,649 +7273,649 @@ yyreduce:
 		    (yyvsp[(3) - (3)].trees) ) ); }
     break;
 
-  case 497:
+  case 535:
 
 /* Line 1455 of yacc.c  */
-#line 2041 "./sparql_p.y"
+#line 2189 "./sparql_p.y"
     { spar_qm_push_local (sparp_arg, SUBJECT_L, (yyvsp[(1) - (1)].tree), 0); }
     break;
 
-  case 498:
+  case 536:
 
 /* Line 1455 of yacc.c  */
-#line 2042 "./sparql_p.y"
+#line 2190 "./sparql_p.y"
     {}
     break;
 
-  case 501:
+  case 539:
 
 /* Line 1455 of yacc.c  */
-#line 2051 "./sparql_p.y"
+#line 2199 "./sparql_p.y"
     { spar_qm_push_local (sparp_arg, GRAPH_L, (yyvsp[(2) - (2)].tree), 0); }
     break;
 
-  case 502:
+  case 540:
 
 /* Line 1455 of yacc.c  */
-#line 2052 "./sparql_p.y"
+#line 2200 "./sparql_p.y"
     { spar_qm_push_local (sparp_arg, SUBJECT_L, (yyvsp[(2) - (2)].tree), 0); }
     break;
 
-  case 503:
+  case 541:
 
 /* Line 1455 of yacc.c  */
-#line 2053 "./sparql_p.y"
+#line 2201 "./sparql_p.y"
     { spar_qm_push_local (sparp_arg, PREDICATE_L, (yyvsp[(2) - (2)].tree), 0); }
     break;
 
-  case 504:
+  case 542:
 
 /* Line 1455 of yacc.c  */
-#line 2054 "./sparql_p.y"
+#line 2202 "./sparql_p.y"
     { spar_qm_push_local (sparp_arg, OBJECT_L, (yyvsp[(2) - (2)].tree), 0); }
     break;
 
-  case 505:
+  case 543:
 
 /* Line 1455 of yacc.c  */
-#line 2055 "./sparql_p.y"
+#line 2203 "./sparql_p.y"
     {
 		spar_qm_push_local (sparp_arg, DATATYPE_L, (SPART *)((yyvsp[(4) - (4)].tree)), 0); }
     break;
 
-  case 506:
+  case 544:
 
 /* Line 1455 of yacc.c  */
-#line 2057 "./sparql_p.y"
+#line 2205 "./sparql_p.y"
     {
 		spar_qm_push_local (sparp_arg, LANG_L, (SPART *)((yyvsp[(6) - (6)].tree)), 0); }
     break;
 
-  case 507:
+  case 545:
 
 /* Line 1455 of yacc.c  */
-#line 2063 "./sparql_p.y"
+#line 2211 "./sparql_p.y"
     {}
     break;
 
-  case 508:
+  case 546:
 
 /* Line 1455 of yacc.c  */
-#line 2064 "./sparql_p.y"
+#line 2212 "./sparql_p.y"
     {
 		spar_qm_pop_key (sparp_arg, PREDICATE_L); }
     break;
 
-  case 510:
+  case 548:
 
 /* Line 1455 of yacc.c  */
-#line 2070 "./sparql_p.y"
+#line 2218 "./sparql_p.y"
     {
 		spar_qm_push_local (sparp_arg, PREDICATE_L,
 		  ((NULL != (yyvsp[(1) - (1)].tree)) ? ((SPART *)((yyvsp[(1) - (1)].tree))) : spar_qm_get_local (sparp_arg, PREDICATE_L, 1)),
 		  0 ); }
     break;
 
-  case 511:
+  case 549:
 
 /* Line 1455 of yacc.c  */
-#line 2074 "./sparql_p.y"
+#line 2222 "./sparql_p.y"
     {}
     break;
 
-  case 512:
+  case 550:
 
 /* Line 1455 of yacc.c  */
-#line 2075 "./sparql_p.y"
+#line 2223 "./sparql_p.y"
     { sparyyerror ("Description of predicate field is expected here"); }
     break;
 
-  case 513:
+  case 551:
 
 /* Line 1455 of yacc.c  */
-#line 2079 "./sparql_p.y"
+#line 2227 "./sparql_p.y"
     {
 		t_set_push (&(sparp_env()->spare_acc_qm_sqls),
 		  spar_qm_make_real_mapping (sparp_arg, (yyvsp[(2) - (2)].box), (yyvsp[(1) - (2)].trees)) ); }
     break;
 
-  case 514:
+  case 552:
 
 /* Line 1455 of yacc.c  */
-#line 2082 "./sparql_p.y"
+#line 2230 "./sparql_p.y"
     {
 		spar_qm_pop_key (sparp_arg, OBJECT_L); }
     break;
 
-  case 515:
+  case 553:
 
 /* Line 1455 of yacc.c  */
-#line 2084 "./sparql_p.y"
+#line 2232 "./sparql_p.y"
     {
 		t_set_push (&(sparp_env()->spare_acc_qm_sqls),
 		  spar_qm_make_real_mapping (sparp_arg, (yyvsp[(5) - (5)].box), (yyvsp[(4) - (5)].trees)) ); }
     break;
 
-  case 516:
+  case 554:
 
 /* Line 1455 of yacc.c  */
-#line 2090 "./sparql_p.y"
+#line 2238 "./sparql_p.y"
     {
 		spar_qm_push_local (sparp_arg, OBJECT_L,
 		  ((NULL != (yyvsp[(1) - (1)].tree)) ? ((SPART *)((yyvsp[(1) - (1)].tree))) : spar_qm_get_local (sparp_arg, OBJECT_L, 1)),
 		  0 ); }
     break;
 
-  case 517:
+  case 555:
 
 /* Line 1455 of yacc.c  */
-#line 2094 "./sparql_p.y"
+#line 2242 "./sparql_p.y"
     {
 		spar_qm_push_local (sparp_arg, DATATYPE_L, (SPART *)((yyvsp[(3) - (3)].tree)), 0); }
     break;
 
-  case 518:
+  case 556:
 
 /* Line 1455 of yacc.c  */
-#line 2096 "./sparql_p.y"
+#line 2244 "./sparql_p.y"
     {
 		spar_qm_push_local (sparp_arg, LANG_L, (SPART *)((yyvsp[(5) - (5)].tree)), 0); }
     break;
 
-  case 519:
+  case 557:
 
 /* Line 1455 of yacc.c  */
-#line 2098 "./sparql_p.y"
+#line 2246 "./sparql_p.y"
     {
 		spar_qm_push_local (sparp_arg, WHERE_L, (SPART *)t_revlist_to_array ((yyvsp[(7) - (7)].backstack)), 0); }
     break;
 
-  case 520:
+  case 558:
 
 /* Line 1455 of yacc.c  */
-#line 2100 "./sparql_p.y"
+#line 2248 "./sparql_p.y"
     { (yyval.trees) = (yyvsp[(9) - (9)].trees); }
     break;
 
-  case 521:
+  case 559:
 
 /* Line 1455 of yacc.c  */
-#line 2101 "./sparql_p.y"
+#line 2249 "./sparql_p.y"
     { sparyyerror ("Description of object field is expected here"); }
     break;
 
-  case 522:
+  case 560:
 
 /* Line 1455 of yacc.c  */
-#line 2105 "./sparql_p.y"
+#line 2253 "./sparql_p.y"
     { (yyval.box) = NULL; }
     break;
 
-  case 523:
+  case 561:
 
 /* Line 1455 of yacc.c  */
-#line 2106 "./sparql_p.y"
+#line 2254 "./sparql_p.y"
     { (yyval.box) = (yyvsp[(2) - (2)].box); }
     break;
 
-  case 524:
+  case 562:
 
 /* Line 1455 of yacc.c  */
-#line 2110 "./sparql_p.y"
+#line 2258 "./sparql_p.y"
     { (yyval.tree) = NULL; }
     break;
 
-  case 525:
+  case 563:
 
 /* Line 1455 of yacc.c  */
-#line 2111 "./sparql_p.y"
+#line 2259 "./sparql_p.y"
     { (yyval.tree) = (SPART *)(yyvsp[(2) - (2)].tree)->_.lit.val; }
     break;
 
-  case 526:
+  case 564:
 
 /* Line 1455 of yacc.c  */
-#line 2112 "./sparql_p.y"
+#line 2260 "./sparql_p.y"
     { sparyyerror ("Datatype of object field should be either constant IRI or table field, not template IRI (string)"); }
     break;
 
-  case 527:
+  case 565:
 
 /* Line 1455 of yacc.c  */
-#line 2113 "./sparql_p.y"
+#line 2261 "./sparql_p.y"
     { (yyval.tree) = spar_make_qm_col_desc (sparp_arg, (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 528:
+  case 566:
 
 /* Line 1455 of yacc.c  */
-#line 2117 "./sparql_p.y"
+#line 2265 "./sparql_p.y"
     { (yyval.tree) = NULL; }
     break;
 
-  case 529:
+  case 567:
 
 /* Line 1455 of yacc.c  */
-#line 2118 "./sparql_p.y"
+#line 2266 "./sparql_p.y"
     { (yyval.tree) = (SPART *)(yyvsp[(2) - (2)].box); }
     break;
 
-  case 530:
+  case 568:
 
 /* Line 1455 of yacc.c  */
-#line 2119 "./sparql_p.y"
+#line 2267 "./sparql_p.y"
     { (yyval.tree) = spar_make_qm_col_desc (sparp_arg, (yyvsp[(2) - (2)].tree)); }
     break;
 
-  case 531:
+  case 569:
 
 /* Line 1455 of yacc.c  */
-#line 2123 "./sparql_p.y"
+#line 2271 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 532:
+  case 570:
 
 /* Line 1455 of yacc.c  */
-#line 2124 "./sparql_p.y"
+#line 2272 "./sparql_p.y"
     { (yyval.tree) = NULL; }
     break;
 
-  case 533:
+  case 571:
 
 /* Line 1455 of yacc.c  */
-#line 2125 "./sparql_p.y"
+#line 2273 "./sparql_p.y"
     { (yyval.tree) = (SPART *)uname_rdf_ns_uri_type; }
     break;
 
-  case 534:
+  case 572:
 
 /* Line 1455 of yacc.c  */
-#line 2129 "./sparql_p.y"
+#line 2277 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 535:
+  case 573:
 
 /* Line 1455 of yacc.c  */
-#line 2130 "./sparql_p.y"
+#line 2278 "./sparql_p.y"
     { (yyval.tree) = NULL; }
     break;
 
-  case 536:
+  case 574:
 
 /* Line 1455 of yacc.c  */
-#line 2134 "./sparql_p.y"
+#line 2282 "./sparql_p.y"
     { (yyval.tree) = (SPART *)(yyvsp[(1) - (1)].box); }
     break;
 
-  case 537:
+  case 575:
 
 /* Line 1455 of yacc.c  */
-#line 2135 "./sparql_p.y"
+#line 2283 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 538:
+  case 576:
 
 /* Line 1455 of yacc.c  */
-#line 2136 "./sparql_p.y"
+#line 2284 "./sparql_p.y"
     { (yyval.tree) = (yyvsp[(1) - (1)].tree); }
     break;
 
-  case 539:
+  case 577:
 
 /* Line 1455 of yacc.c  */
-#line 2138 "./sparql_p.y"
+#line 2286 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_qm_value (sparp_arg, (yyvsp[(1) - (4)].box), (SPART **)t_revlist_to_array ((yyvsp[(3) - (4)].backstack))); }
     break;
 
-  case 540:
+  case 578:
 
 /* Line 1455 of yacc.c  */
-#line 2140 "./sparql_p.y"
+#line 2288 "./sparql_p.y"
     {			/*... | QmSqlCol	*/
 		(yyval.tree) = spar_make_qm_value (sparp_arg, box_dv_uname_string ("literal"), (SPART **)t_list (1, (yyvsp[(1) - (1)].tree))); }
     break;
 
-  case 541:
+  case 579:
 
 /* Line 1455 of yacc.c  */
-#line 2145 "./sparql_p.y"
+#line 2293 "./sparql_p.y"
     { (yyval.backstack) = NULL; }
     break;
 
-  case 542:
+  case 580:
 
 /* Line 1455 of yacc.c  */
-#line 2146 "./sparql_p.y"
+#line 2294 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (1)].backstack); }
     break;
 
-  case 543:
+  case 581:
 
 /* Line 1455 of yacc.c  */
-#line 2150 "./sparql_p.y"
+#line 2298 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].box)); }
     break;
 
-  case 544:
+  case 582:
 
 /* Line 1455 of yacc.c  */
-#line 2151 "./sparql_p.y"
+#line 2299 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (2)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 545:
+  case 583:
 
 /* Line 1455 of yacc.c  */
-#line 2155 "./sparql_p.y"
+#line 2303 "./sparql_p.y"
     { (yyval.box) = (yyvsp[(3) - (3)].box); }
     break;
 
-  case 546:
+  case 584:
 
 /* Line 1455 of yacc.c  */
-#line 2156 "./sparql_p.y"
+#line 2304 "./sparql_p.y"
     { (yyval.box) = (yyvsp[(2) - (2)].box); }
     break;
 
-  case 547:
+  case 585:
 
 /* Line 1455 of yacc.c  */
-#line 2160 "./sparql_p.y"
+#line 2308 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (0); }
     break;
 
-  case 548:
+  case 586:
 
 /* Line 1455 of yacc.c  */
-#line 2161 "./sparql_p.y"
+#line 2309 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (0); }
     break;
 
-  case 549:
+  case 587:
 
 /* Line 1455 of yacc.c  */
-#line 2162 "./sparql_p.y"
+#line 2310 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_revlist_to_array ((yyvsp[(3) - (4)].backstack)); }
     break;
 
-  case 550:
+  case 588:
 
 /* Line 1455 of yacc.c  */
-#line 2166 "./sparql_p.y"
+#line 2314 "./sparql_p.y"
     {
 		(yyval.backstack) = NULL;
 		t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].trees)[0]);
 		t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].trees)[1]); }
     break;
 
-  case 551:
+  case 589:
 
 /* Line 1455 of yacc.c  */
-#line 2170 "./sparql_p.y"
+#line 2318 "./sparql_p.y"
     {
 		(yyval.backstack) = (yyvsp[(1) - (3)].backstack);
 		t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].trees)[0]);
 		t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].trees)[1]); }
     break;
 
-  case 552:
+  case 590:
 
 /* Line 1455 of yacc.c  */
-#line 2177 "./sparql_p.y"
+#line 2325 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, t_box_dv_uname_string ("SOFT_EXCLUSIVE"), (ptrlong)1); }
     break;
 
-  case 553:
+  case 591:
 
 /* Line 1455 of yacc.c  */
-#line 2178 "./sparql_p.y"
+#line 2326 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, t_box_dv_uname_string ("EXCLUSIVE"), (ptrlong)1); }
     break;
 
-  case 554:
+  case 592:
 
 /* Line 1455 of yacc.c  */
-#line 2179 "./sparql_p.y"
+#line 2327 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, t_box_dv_uname_string ("ORDER"), (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 555:
+  case 593:
 
 /* Line 1455 of yacc.c  */
-#line 2180 "./sparql_p.y"
+#line 2328 "./sparql_p.y"
     { (yyval.trees) = (SPART **)t_list (2, t_box_dv_uname_string ("USING"), (yyvsp[(2) - (2)].box)); }
     break;
 
-  case 556:
+  case 594:
 
 /* Line 1455 of yacc.c  */
-#line 2184 "./sparql_p.y"
+#line 2332 "./sparql_p.y"
     { (yyval.backstack) = NULL; }
     break;
 
-  case 557:
+  case 595:
 
 /* Line 1455 of yacc.c  */
-#line 2185 "./sparql_p.y"
+#line 2333 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (1)].backstack); }
     break;
 
-  case 558:
+  case 596:
 
 /* Line 1455 of yacc.c  */
-#line 2189 "./sparql_p.y"
+#line 2337 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 559:
+  case 597:
 
 /* Line 1455 of yacc.c  */
-#line 2190 "./sparql_p.y"
+#line 2338 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (3)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 560:
+  case 598:
 
 /* Line 1455 of yacc.c  */
-#line 2194 "./sparql_p.y"
+#line 2342 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 561:
+  case 599:
 
 /* Line 1455 of yacc.c  */
-#line 2195 "./sparql_p.y"
+#line 2343 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (3)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 562:
+  case 600:
 
 /* Line 1455 of yacc.c  */
-#line 2199 "./sparql_p.y"
+#line 2347 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_vector_qm_sql (sparp_arg,
 		  (SPART **)t_list (4, (yyvsp[(2) - (5)].box), (yyvsp[(3) - (5)].tree), (yyvsp[(5) - (5)].boxes)[0], (yyvsp[(5) - (5)].boxes)[1]) ); }
     break;
 
-  case 563:
+  case 601:
 
 /* Line 1455 of yacc.c  */
-#line 2205 "./sparql_p.y"
+#line 2353 "./sparql_p.y"
     { (yyval.tree) = spar_make_vector_qm_sql (sparp_arg, (SPART **)t_revlist_to_array ((yyvsp[(2) - (3)].backstack))); }
     break;
 
-  case 564:
+  case 602:
 
 /* Line 1455 of yacc.c  */
-#line 2209 "./sparql_p.y"
+#line 2357 "./sparql_p.y"
     { (yyval.backstack) = NULL; }
     break;
 
-  case 565:
+  case 603:
 
 /* Line 1455 of yacc.c  */
-#line 2210 "./sparql_p.y"
+#line 2358 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (1)].backstack); }
     break;
 
-  case 566:
+  case 604:
 
 /* Line 1455 of yacc.c  */
-#line 2214 "./sparql_p.y"
+#line 2362 "./sparql_p.y"
     { (yyval.backstack) = NULL; t_set_push (&((yyval.backstack)), (yyvsp[(1) - (1)].tree)); }
     break;
 
-  case 567:
+  case 605:
 
 /* Line 1455 of yacc.c  */
-#line 2215 "./sparql_p.y"
+#line 2363 "./sparql_p.y"
     { (yyval.backstack) = (yyvsp[(1) - (3)].backstack); t_set_push (&((yyval.backstack)), (yyvsp[(3) - (3)].tree)); }
     break;
 
-  case 568:
+  case 606:
 
 /* Line 1455 of yacc.c  */
-#line 2219 "./sparql_p.y"
+#line 2367 "./sparql_p.y"
     {
 		(yyval.tree) = spar_make_vector_qm_sql (sparp_arg,
 		  (SPART **)t_list (4, (yyvsp[(1) - (3)].box), (yyvsp[(2) - (3)].box), (yyvsp[(3) - (3)].boxes)[0], (yyvsp[(3) - (3)].boxes)[1]) ); }
     break;
 
-  case 569:
+  case 607:
 
 /* Line 1455 of yacc.c  */
-#line 2225 "./sparql_p.y"
+#line 2373 "./sparql_p.y"
     { (yyval.boxes) = t_list (2, (yyvsp[(1) - (1)].box), (ptrlong)0); }
     break;
 
-  case 570:
+  case 608:
 
 /* Line 1455 of yacc.c  */
-#line 2226 "./sparql_p.y"
+#line 2374 "./sparql_p.y"
     { (yyval.boxes) = t_list (2, (yyvsp[(1) - (3)].box), (ptrlong)1); }
     break;
 
-  case 571:
+  case 609:
 
 /* Line 1455 of yacc.c  */
-#line 2230 "./sparql_p.y"
+#line 2378 "./sparql_p.y"
     { (yyval.box) = t_box_dv_uname_string ("in"); }
     break;
 
-  case 572:
+  case 610:
 
 /* Line 1455 of yacc.c  */
-#line 2231 "./sparql_p.y"
+#line 2379 "./sparql_p.y"
     { (yyval.box) = t_box_dv_uname_string ((yyvsp[(1) - (1)].box)); }
     break;
 
-  case 573:
+  case 611:
 
 /* Line 1455 of yacc.c  */
-#line 2235 "./sparql_p.y"
+#line 2383 "./sparql_p.y"
     { (yyval.tree) = sparp_make_qm_sqlcol (sparp_arg, SPARQL_PLAIN_ID, (yyvsp[(1) - (1)].box)); }
     break;
 
-  case 574:
+  case 612:
 
 /* Line 1455 of yacc.c  */
-#line 2236 "./sparql_p.y"
+#line 2384 "./sparql_p.y"
     { (yyval.tree) = sparp_make_qm_sqlcol (sparp_arg, SPARQL_SQL_ALIASCOLNAME, (yyvsp[(1) - (1)].box)); }
     break;
 
-  case 575:
+  case 613:
 
 /* Line 1455 of yacc.c  */
-#line 2237 "./sparql_p.y"
+#line 2385 "./sparql_p.y"
     { (yyval.tree) = sparp_make_qm_sqlcol (sparp_arg, SPARQL_SQL_QTABLECOLNAME, (yyvsp[(1) - (1)].box)); }
     break;
 
-  case 576:
+  case 614:
 
 /* Line 1455 of yacc.c  */
-#line 2241 "./sparql_p.y"
+#line 2389 "./sparql_p.y"
     { (yyval.box) = (yyvsp[(1) - (1)].box); }
     break;
 
-  case 577:
+  case 615:
 
 /* Line 1455 of yacc.c  */
-#line 2242 "./sparql_p.y"
+#line 2390 "./sparql_p.y"
     { (yyval.box) = (yyvsp[(1) - (1)].box); }
     break;
 
-  case 578:
+  case 616:
 
 /* Line 1455 of yacc.c  */
-#line 2243 "./sparql_p.y"
+#line 2391 "./sparql_p.y"
     { (yyval.box) = (yyvsp[(1) - (1)].box); }
     break;
 
-  case 579:
+  case 617:
 
 /* Line 1455 of yacc.c  */
-#line 2248 "./sparql_p.y"
+#line 2396 "./sparql_p.y"
     { (yyval.box) = (yyvsp[(1) - (1)].tree)->_.lit.val; }
     break;
 
-  case 580:
+  case 618:
 
 /* Line 1455 of yacc.c  */
-#line 2249 "./sparql_p.y"
+#line 2397 "./sparql_p.y"
     {
 		(yyval.box) = spar_make_iri_from_template (sparp_arg, (yyvsp[(3) - (4)].box)); }
     break;
 
-  case 581:
+  case 619:
 
 /* Line 1455 of yacc.c  */
-#line 2254 "./sparql_p.y"
+#line 2402 "./sparql_p.y"
     {}
     break;
 
-  case 582:
+  case 620:
 
 /* Line 1455 of yacc.c  */
-#line 2255 "./sparql_p.y"
+#line 2403 "./sparql_p.y"
     {}
     break;
 
-  case 583:
+  case 621:
 
 /* Line 1455 of yacc.c  */
-#line 2259 "./sparql_p.y"
+#line 2407 "./sparql_p.y"
     {}
     break;
 
-  case 584:
+  case 622:
 
 /* Line 1455 of yacc.c  */
-#line 2260 "./sparql_p.y"
+#line 2408 "./sparql_p.y"
     {}
     break;
 
-  case 585:
+  case 623:
 
 /* Line 1455 of yacc.c  */
-#line 2264 "./sparql_p.y"
+#line 2412 "./sparql_p.y"
     {}
     break;
 
-  case 586:
+  case 624:
 
 /* Line 1455 of yacc.c  */
-#line 2265 "./sparql_p.y"
+#line 2413 "./sparql_p.y"
     {}
     break;
 
 
 
 /* Line 1455 of yacc.c  */
-#line 7505 "sparql_p.c"
+#line 7919 "sparql_p.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/libsrc/Wi/sparql_p.h b/libsrc/Wi/sparql_p.h
index 0d06a21..947a33d 100644
--- a/libsrc/Wi/sparql_p.h
+++ b/libsrc/Wi/sparql_p.h
@@ -74,143 +74,149 @@
      AVG_L = 290,
      BASE_L = 291,
      BIJECTION_L = 292,
-     BOUND_L = 293,
-     BY_L = 294,
-     CLASS_L = 295,
-     CLEAR_L = 296,
-     CREATE_L = 297,
-     CONSTRUCT_L = 298,
-     COUNT_LPAR = 299,
-     COUNT_DISTINCT_L = 300,
-     DATA_L = 301,
-     DATATYPE_L = 302,
-     DEFAULT_L = 303,
-     DEFINE_L = 304,
-     DELETE_L = 305,
-     DEREF_L = 306,
-     DESC_L = 307,
-     DESCRIBE_L = 308,
-     DISTINCT_L = 309,
-     DROP_L = 310,
-     EXCLUSIVE_L = 311,
-     false_L = 312,
-     FILTER_L = 313,
-     FROM_L = 314,
-     FUNCTION_L = 315,
-     GRAPH_L = 316,
-     GROUP_L = 317,
-     HAVING_L = 318,
-     IDENTIFIED_L = 319,
-     IFP_L = 320,
-     IN_L = 321,
-     INDEX_L = 322,
-     INFERENCE_L = 323,
-     INSERT_L = 324,
-     INTO_L = 325,
-     IRI_L = 326,
-     isBLANK_L = 327,
-     isIRI_L = 328,
-     isLITERAL_L = 329,
-     isREF_L = 330,
-     isURI_L = 331,
-     LANG_L = 332,
-     LANGMATCHES_L = 333,
-     LIKE_L = 334,
-     LIMIT_L = 335,
-     LITERAL_L = 336,
-     LOAD_L = 337,
-     MAKE_L = 338,
-     MAP_L = 339,
-     MAX_L = 340,
-     MIN_L = 341,
-     MODIFY_L = 342,
-     NAMED_L = 343,
-     NIL_L = 344,
-     NOT_L = 345,
-     NULL_L = 346,
-     OBJECT_L = 347,
-     OF_L = 348,
-     OFFBAND_L = 349,
-     OFFSET_L = 350,
-     OPTIONAL_L = 351,
-     OPTION_L = 352,
-     ORDER_L = 353,
-     PREDICATE_L = 354,
-     PREFIX_L = 355,
-     QUAD_L = 356,
-     REGEX_L = 357,
-     REDUCED_L = 358,
-     RETURNS_L = 359,
-     SAME_AS_L = 360,
-     SAME_AS_O_L = 361,
-     SAME_AS_P_L = 362,
-     SAME_AS_S_L = 363,
-     SAME_AS_S_O_L = 364,
-     SAMETERM_L = 365,
-     SCORE_L = 366,
-     SCORE_LIMIT_L = 367,
-     SELECT_L = 368,
-     SERVICE_L = 369,
-     SILENT_L = 370,
-     SOFT_L = 371,
-     STORAGE_L = 372,
-     STR_L = 373,
-     SUBCLASS_L = 374,
-     SUBJECT_L = 375,
-     SUM_L = 376,
-     TABLE_OPTION_L = 377,
-     T_CYCLES_ONLY_L = 378,
-     T_DIRECTION_L = 379,
-     T_DISTINCT_L = 380,
-     T_END_FLAG_L = 381,
-     T_EXISTS_L = 382,
-     T_FINAL_AS_L = 383,
-     T_IN_L = 384,
-     T_MAX_L = 385,
-     T_MIN_L = 386,
-     T_OUT_L = 387,
-     T_NO_CYCLES_L = 388,
-     T_NO_ORDER_L = 389,
-     T_SHORTEST_ONLY_L = 390,
-     T_STEP_L = 391,
-     TRANSITIVE_L = 392,
-     true_L = 393,
-     UNION_L = 394,
-     USING_L = 395,
-     WHERE_L = 396,
-     __SPAR_PUNCT_END = 397,
-     START_OF_SPARQL_TEXT = 398,
-     END_OF_SPARQL_TEXT = 399,
-     SPARUL_RUN_SUBTYPE = 400,
-     SPARUL_INSERT_DATA = 401,
-     SPARUL_DELETE_DATA = 402,
-     __SPAR_NONPUNCT_START = 403,
-     TEXT_BL = 404,
-     XML_BL = 405,
-     SPARQL_INTEGER = 406,
-     SPARQL_DECIMAL = 407,
-     SPARQL_DOUBLE = 408,
-     SPARQL_STRING = 409,
-     SPARQL_CONDITION_AFTER_WHERE_LPAR = 410,
-     LANGTAG = 411,
-     QNAME = 412,
-     QNAME_NS = 413,
-     BLANK_NODE_LABEL = 414,
-     Q_IRI_REF = 415,
-     QUEST_VARNAME = 416,
-     DOLLAR_VARNAME = 417,
-     QUEST_COLON_PARAMNAME = 418,
-     DOLLAR_COLON_PARAMNAME = 419,
-     QUEST_COLON_PARAMNUM = 420,
-     DOLLAR_COLON_PARAMNUM = 421,
-     SPARQL_PLAIN_ID = 422,
-     SPARQL_SQL_ALIASCOLNAME = 423,
-     SPARQL_SQL_QTABLENAME = 424,
-     SPARQL_SQL_QTABLECOLNAME = 425,
-     __SPAR_NONPUNCT_END = 426,
-     _COLON = 427,
-     UMINUS = 428,
-     UPLUS = 429
+     BINDINGS_L = 293,
+     BOUND_L = 294,
+     BY_L = 295,
+     CLASS_L = 296,
+     CLEAR_L = 297,
+     CREATE_L = 298,
+     CONSTRUCT_L = 299,
+     COUNT_LPAR = 300,
+     COUNT_DISTINCT_L = 301,
+     DATA_L = 302,
+     DATATYPE_L = 303,
+     DEFAULT_L = 304,
+     DEFINE_L = 305,
+     DELETE_L = 306,
+     DEREF_L = 307,
+     DESC_L = 308,
+     DESCRIBE_L = 309,
+     DISTINCT_L = 310,
+     DROP_L = 311,
+     EXCLUSIVE_L = 312,
+     EXISTS_L = 313,
+     false_L = 314,
+     FILTER_L = 315,
+     FROM_L = 316,
+     FUNCTION_L = 317,
+     GRAPH_L = 318,
+     GROUP_L = 319,
+     HAVING_L = 320,
+     IDENTIFIED_L = 321,
+     IFP_L = 322,
+     IN_L = 323,
+     INDEX_L = 324,
+     INFERENCE_L = 325,
+     INSERT_L = 326,
+     INTO_L = 327,
+     IRI_L = 328,
+     isBLANK_L = 329,
+     isIRI_L = 330,
+     isLITERAL_L = 331,
+     isREF_L = 332,
+     isURI_L = 333,
+     LANG_L = 334,
+     LANGMATCHES_L = 335,
+     LIKE_L = 336,
+     LIMIT_L = 337,
+     LITERAL_L = 338,
+     LOAD_L = 339,
+     MAKE_L = 340,
+     MAP_L = 341,
+     MAX_L = 342,
+     MIN_L = 343,
+     MINUS_L = 344,
+     MODIFY_L = 345,
+     NAMED_L = 346,
+     NIL_L = 347,
+     NOT_L = 348,
+     NOT_FROM_L = 349,
+     NULL_L = 350,
+     OBJECT_L = 351,
+     OF_L = 352,
+     OFFBAND_L = 353,
+     OFFSET_L = 354,
+     OPTIONAL_L = 355,
+     OPTION_L = 356,
+     ORDER_L = 357,
+     PREDICATE_L = 358,
+     PREFIX_L = 359,
+     QUAD_L = 360,
+     REGEX_L = 361,
+     REDUCED_L = 362,
+     RETURNS_L = 363,
+     SAME_AS_L = 364,
+     SAME_AS_O_L = 365,
+     SAME_AS_P_L = 366,
+     SAME_AS_S_L = 367,
+     SAME_AS_S_O_L = 368,
+     SAMETERM_L = 369,
+     SCORE_L = 370,
+     SCORE_LIMIT_L = 371,
+     SELECT_L = 372,
+     SERVICE_L = 373,
+     SILENT_L = 374,
+     SOFT_L = 375,
+     STORAGE_L = 376,
+     STR_L = 377,
+     SUBCLASS_L = 378,
+     SUBJECT_L = 379,
+     SUM_L = 380,
+     TABLE_OPTION_L = 381,
+     T_CYCLES_ONLY_L = 382,
+     T_DIRECTION_L = 383,
+     T_DISTINCT_L = 384,
+     T_END_FLAG_L = 385,
+     T_EXISTS_L = 386,
+     T_FINAL_AS_L = 387,
+     T_IN_L = 388,
+     T_MAX_L = 389,
+     T_MIN_L = 390,
+     T_OUT_L = 391,
+     T_NO_CYCLES_L = 392,
+     T_NO_ORDER_L = 393,
+     T_SHORTEST_ONLY_L = 394,
+     T_STEP_L = 395,
+     TRANSITIVE_L = 396,
+     true_L = 397,
+     UNBOUND_L = 398,
+     UNION_L = 399,
+     USING_L = 400,
+     WHERE_L = 401,
+     WITH_L = 402,
+     __SPAR_PUNCT_END = 403,
+     START_OF_SPARQL_TEXT = 404,
+     END_OF_SPARQL_TEXT = 405,
+     SPARUL_RUN_SUBTYPE = 406,
+     SPARUL_INSERT_DATA = 407,
+     SPARUL_DELETE_DATA = 408,
+     __SPAR_NONPUNCT_START = 409,
+     TEXT_BL = 410,
+     XML_BL = 411,
+     SPARQL_INTEGER = 412,
+     SPARQL_DECIMAL = 413,
+     SPARQL_DOUBLE = 414,
+     SPARQL_STRING = 415,
+     SPARQL_CONDITION_AFTER_WHERE_LPAR = 416,
+     LANGTAG = 417,
+     QNAME = 418,
+     QNAME_NS = 419,
+     BLANK_NODE_LABEL = 420,
+     Q_IRI_REF = 421,
+     QUEST_VARNAME = 422,
+     DOLLAR_VARNAME = 423,
+     QUEST_COLON_PARAMNAME = 424,
+     DOLLAR_COLON_PARAMNAME = 425,
+     QUEST_COLON_PARAMNUM = 426,
+     DOLLAR_COLON_PARAMNUM = 427,
+     SPARQL_PLAIN_ID = 428,
+     SPARQL_SQL_ALIASCOLNAME = 429,
+     SPARQL_SQL_QTABLENAME = 430,
+     SPARQL_SQL_QTABLECOLNAME = 431,
+     __SPAR_NONPUNCT_END = 432,
+     _COLON = 433,
+     UMINUS = 434,
+     UPLUS = 435
    };
 #endif
 /* Tokens.  */
@@ -249,143 +255,149 @@
 #define AVG_L 290
 #define BASE_L 291
 #define BIJECTION_L 292
-#define BOUND_L 293
-#define BY_L 294
-#define CLASS_L 295
-#define CLEAR_L 296
-#define CREATE_L 297
-#define CONSTRUCT_L 298
-#define COUNT_LPAR 299
-#define COUNT_DISTINCT_L 300
-#define DATA_L 301
-#define DATATYPE_L 302
-#define DEFAULT_L 303
-#define DEFINE_L 304
-#define DELETE_L 305
-#define DEREF_L 306
-#define DESC_L 307
-#define DESCRIBE_L 308
-#define DISTINCT_L 309
-#define DROP_L 310
-#define EXCLUSIVE_L 311
-#define false_L 312
-#define FILTER_L 313
-#define FROM_L 314
-#define FUNCTION_L 315
-#define GRAPH_L 316
-#define GROUP_L 317
-#define HAVING_L 318
-#define IDENTIFIED_L 319
-#define IFP_L 320
-#define IN_L 321
-#define INDEX_L 322
-#define INFERENCE_L 323
-#define INSERT_L 324
-#define INTO_L 325
-#define IRI_L 326
-#define isBLANK_L 327
-#define isIRI_L 328
-#define isLITERAL_L 329
-#define isREF_L 330
-#define isURI_L 331
-#define LANG_L 332
-#define LANGMATCHES_L 333
-#define LIKE_L 334
-#define LIMIT_L 335
-#define LITERAL_L 336
-#define LOAD_L 337
-#define MAKE_L 338
-#define MAP_L 339
-#define MAX_L 340
-#define MIN_L 341
-#define MODIFY_L 342
-#define NAMED_L 343
-#define NIL_L 344
-#define NOT_L 345
-#define NULL_L 346
-#define OBJECT_L 347
-#define OF_L 348
-#define OFFBAND_L 349
-#define OFFSET_L 350
-#define OPTIONAL_L 351
-#define OPTION_L 352
-#define ORDER_L 353
-#define PREDICATE_L 354
-#define PREFIX_L 355
-#define QUAD_L 356
-#define REGEX_L 357
-#define REDUCED_L 358
-#define RETURNS_L 359
-#define SAME_AS_L 360
-#define SAME_AS_O_L 361
-#define SAME_AS_P_L 362
-#define SAME_AS_S_L 363
-#define SAME_AS_S_O_L 364
-#define SAMETERM_L 365
-#define SCORE_L 366
-#define SCORE_LIMIT_L 367
-#define SELECT_L 368
-#define SERVICE_L 369
-#define SILENT_L 370
-#define SOFT_L 371
-#define STORAGE_L 372
-#define STR_L 373
-#define SUBCLASS_L 374
-#define SUBJECT_L 375
-#define SUM_L 376
-#define TABLE_OPTION_L 377
-#define T_CYCLES_ONLY_L 378
-#define T_DIRECTION_L 379
-#define T_DISTINCT_L 380
-#define T_END_FLAG_L 381
-#define T_EXISTS_L 382
-#define T_FINAL_AS_L 383
-#define T_IN_L 384
-#define T_MAX_L 385
-#define T_MIN_L 386
-#define T_OUT_L 387
-#define T_NO_CYCLES_L 388
-#define T_NO_ORDER_L 389
-#define T_SHORTEST_ONLY_L 390
-#define T_STEP_L 391
-#define TRANSITIVE_L 392
-#define true_L 393
-#define UNION_L 394
-#define USING_L 395
-#define WHERE_L 396
-#define __SPAR_PUNCT_END 397
-#define START_OF_SPARQL_TEXT 398
-#define END_OF_SPARQL_TEXT 399
-#define SPARUL_RUN_SUBTYPE 400
-#define SPARUL_INSERT_DATA 401
-#define SPARUL_DELETE_DATA 402
-#define __SPAR_NONPUNCT_START 403
-#define TEXT_BL 404
-#define XML_BL 405
-#define SPARQL_INTEGER 406
-#define SPARQL_DECIMAL 407
-#define SPARQL_DOUBLE 408
-#define SPARQL_STRING 409
-#define SPARQL_CONDITION_AFTER_WHERE_LPAR 410
-#define LANGTAG 411
-#define QNAME 412
-#define QNAME_NS 413
-#define BLANK_NODE_LABEL 414
-#define Q_IRI_REF 415
-#define QUEST_VARNAME 416
-#define DOLLAR_VARNAME 417
-#define QUEST_COLON_PARAMNAME 418
-#define DOLLAR_COLON_PARAMNAME 419
-#define QUEST_COLON_PARAMNUM 420
-#define DOLLAR_COLON_PARAMNUM 421
-#define SPARQL_PLAIN_ID 422
-#define SPARQL_SQL_ALIASCOLNAME 423
-#define SPARQL_SQL_QTABLENAME 424
-#define SPARQL_SQL_QTABLECOLNAME 425
-#define __SPAR_NONPUNCT_END 426
-#define _COLON 427
-#define UMINUS 428
-#define UPLUS 429
+#define BINDINGS_L 293
+#define BOUND_L 294
+#define BY_L 295
+#define CLASS_L 296
+#define CLEAR_L 297
+#define CREATE_L 298
+#define CONSTRUCT_L 299
+#define COUNT_LPAR 300
+#define COUNT_DISTINCT_L 301
+#define DATA_L 302
+#define DATATYPE_L 303
+#define DEFAULT_L 304
+#define DEFINE_L 305
+#define DELETE_L 306
+#define DEREF_L 307
+#define DESC_L 308
+#define DESCRIBE_L 309
+#define DISTINCT_L 310
+#define DROP_L 311
+#define EXCLUSIVE_L 312
+#define EXISTS_L 313
+#define false_L 314
+#define FILTER_L 315
+#define FROM_L 316
+#define FUNCTION_L 317
+#define GRAPH_L 318
+#define GROUP_L 319
+#define HAVING_L 320
+#define IDENTIFIED_L 321
+#define IFP_L 322
+#define IN_L 323
+#define INDEX_L 324
+#define INFERENCE_L 325
+#define INSERT_L 326
+#define INTO_L 327
+#define IRI_L 328
+#define isBLANK_L 329
+#define isIRI_L 330
+#define isLITERAL_L 331
+#define isREF_L 332
+#define isURI_L 333
+#define LANG_L 334
+#define LANGMATCHES_L 335
+#define LIKE_L 336
+#define LIMIT_L 337
+#define LITERAL_L 338
+#define LOAD_L 339
+#define MAKE_L 340
+#define MAP_L 341
+#define MAX_L 342
+#define MIN_L 343
+#define MINUS_L 344
+#define MODIFY_L 345
+#define NAMED_L 346
+#define NIL_L 347
+#define NOT_L 348
+#define NOT_FROM_L 349
+#define NULL_L 350
+#define OBJECT_L 351
+#define OF_L 352
+#define OFFBAND_L 353
+#define OFFSET_L 354
+#define OPTIONAL_L 355
+#define OPTION_L 356
+#define ORDER_L 357
+#define PREDICATE_L 358
+#define PREFIX_L 359
+#define QUAD_L 360
+#define REGEX_L 361
+#define REDUCED_L 362
+#define RETURNS_L 363
+#define SAME_AS_L 364
+#define SAME_AS_O_L 365
+#define SAME_AS_P_L 366
+#define SAME_AS_S_L 367
+#define SAME_AS_S_O_L 368
+#define SAMETERM_L 369
+#define SCORE_L 370
+#define SCORE_LIMIT_L 371
+#define SELECT_L 372
+#define SERVICE_L 373
+#define SILENT_L 374
+#define SOFT_L 375
+#define STORAGE_L 376
+#define STR_L 377
+#define SUBCLASS_L 378
+#define SUBJECT_L 379
+#define SUM_L 380
+#define TABLE_OPTION_L 381
+#define T_CYCLES_ONLY_L 382
+#define T_DIRECTION_L 383
+#define T_DISTINCT_L 384
+#define T_END_FLAG_L 385
+#define T_EXISTS_L 386
+#define T_FINAL_AS_L 387
+#define T_IN_L 388
+#define T_MAX_L 389
+#define T_MIN_L 390
+#define T_OUT_L 391
+#define T_NO_CYCLES_L 392
+#define T_NO_ORDER_L 393
+#define T_SHORTEST_ONLY_L 394
+#define T_STEP_L 395
+#define TRANSITIVE_L 396
+#define true_L 397
+#define UNBOUND_L 398
+#define UNION_L 399
+#define USING_L 400
+#define WHERE_L 401
+#define WITH_L 402
+#define __SPAR_PUNCT_END 403
+#define START_OF_SPARQL_TEXT 404
+#define END_OF_SPARQL_TEXT 405
+#define SPARUL_RUN_SUBTYPE 406
+#define SPARUL_INSERT_DATA 407
+#define SPARUL_DELETE_DATA 408
+#define __SPAR_NONPUNCT_START 409
+#define TEXT_BL 410
+#define XML_BL 411
+#define SPARQL_INTEGER 412
+#define SPARQL_DECIMAL 413
+#define SPARQL_DOUBLE 414
+#define SPARQL_STRING 415
+#define SPARQL_CONDITION_AFTER_WHERE_LPAR 416
+#define LANGTAG 417
+#define QNAME 418
+#define QNAME_NS 419
+#define BLANK_NODE_LABEL 420
+#define Q_IRI_REF 421
+#define QUEST_VARNAME 422
+#define DOLLAR_VARNAME 423
+#define QUEST_COLON_PARAMNAME 424
+#define DOLLAR_COLON_PARAMNAME 425
+#define QUEST_COLON_PARAMNUM 426
+#define DOLLAR_COLON_PARAMNUM 427
+#define SPARQL_PLAIN_ID 428
+#define SPARQL_SQL_ALIASCOLNAME 429
+#define SPARQL_SQL_QTABLENAME 430
+#define SPARQL_SQL_QTABLECOLNAME 431
+#define __SPAR_NONPUNCT_END 432
+#define _COLON 433
+#define UMINUS 434
+#define UPLUS 435
 
 
 
@@ -395,7 +407,7 @@ typedef union YYSTYPE
 {
 
 /* Line 1676 of yacc.c  */
-#line 98 "./sparql_p.y"
+#line 97 "./sparql_p.y"
 
   caddr_t box;
   caddr_t *boxes;
@@ -410,7 +422,7 @@ typedef union YYSTYPE
 
 
 /* Line 1676 of yacc.c  */
-#line 414 "sparql_p.h"
+#line 426 "sparql_p.h"
 } YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
diff --git a/libsrc/Wi/sparql_p.y b/libsrc/Wi/sparql_p.y
index 82a4c3b..96f0342 100644
--- a/libsrc/Wi/sparql_p.y
+++ b/libsrc/Wi/sparql_p.y
@@ -1,5 +1,5 @@
 /*
- *  $Id: sparql_p.y,v 1.66.2.17 2010/03/22 11:54:10 source Exp $
+ *  $Id: sparql_p.y,v 1.66.2.25 2011/01/03 10:21:01 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -31,8 +31,7 @@ Two tabs before C code in the rule.
 Inside the line:
 Some number of tabs before the beginning of an BNF comment.
 One tab between syntax ref number and BNF rule name.
-One tab and one space between BNF rule name and "::="
-One tab and one space between BNF rule name and "::="
+One tab and one space between BNF rule name and "::=".
 One tab before end of single-line BNF comment.
 
 Whitespaces in all other places, including two whitespaces after "::=" in BNF comments */
@@ -144,6 +143,7 @@ int sparyylex_from_sparp_bufs (caddr_t *yylval, sparp_t *sparp)
 %token AVG_L		/*:: PUNCT_SPAR_LAST("AVG") ::*/
 %token BASE_L		/*:: PUNCT_SPAR_LAST("BASE") ::*/
 %token BIJECTION_L	/*:: PUNCT_SPAR_LAST("BIJECTION") ::*/
+%token BINDINGS_L	/*:: PUNCT_SPAR_LAST("BINDINGS") ::*/
 %token BOUND_L		/*:: PUNCT_SPAR_LAST("BOUND") ::*/
 %token BY_L		/*:: PUNCT("BY"), SPAR, LAST("BY"), LAST("IDENTIFIED BY") ::*/
 %token CLASS_L		/*:: PUNCT_SPAR_LAST("CLASS") ::*/
@@ -163,6 +163,7 @@ int sparyylex_from_sparp_bufs (caddr_t *yylval, sparp_t *sparp)
 %token DISTINCT_L	/*:: PUNCT_SPAR_LAST("DISTINCT") ::*/
 %token DROP_L		/*:: PUNCT_SPAR_LAST("DROP") ::*/
 %token EXCLUSIVE_L	/*:: PUNCT_SPAR_LAST("EXCLUSIVE") ::*/
+%token EXISTS_L		/*:: PUNCT_SPAR_LAST("EXISTS") ::*/
 %token false_L		/*:: PUNCT_SPAR_LAST("false") ::*/
 %token FILTER_L		/*:: PUNCT_SPAR_LAST("FILTER") ::*/
 %token FROM_L		/*:: PUNCT_SPAR_LAST("FROM") ::*/
@@ -193,10 +194,12 @@ int sparyylex_from_sparp_bufs (caddr_t *yylval, sparp_t *sparp)
 %token MAP_L		/*:: PUNCT_SPAR_LAST("MAP") ::*/
 %token MAX_L		/*:: PUNCT_SPAR_LAST("MAX") ::*/
 %token MIN_L		/*:: PUNCT_SPAR_LAST("MIN") ::*/
+%token MINUS_L		/*:: PUNCT_SPAR_LAST("MINUS") ::*/
 %token MODIFY_L		/*:: PUNCT_SPAR_LAST("MODIFY") ::*/
 %token NAMED_L		/*:: PUNCT_SPAR_LAST("NAMED") ::*/
 %token NIL_L		/*:: PUNCT_SPAR_LAST("NIL") ::*/
 %token NOT_L		/*:: PUNCT_SPAR_LAST("NOT") ::*/
+%token NOT_FROM_L	/*:: PUNCT_SPAR_LAST("NOT FROM") ::*/
 %token NULL_L		/*:: PUNCT_SPAR_LAST("NULL") ::*/
 %token OBJECT_L		/*:: PUNCT_SPAR_LAST("OBJECT") ::*/
 %token OF_L		/*:: PUNCT_SPAR_LAST("OF") ::*/
@@ -245,9 +248,11 @@ int sparyylex_from_sparp_bufs (caddr_t *yylval, sparp_t *sparp)
 %token T_STEP_L		/*:: PUNCT_SPAR_LAST("T_STEP") ::*/
 %token TRANSITIVE_L	/*:: PUNCT_SPAR_LAST("TRANSITIVE") ::*/
 %token true_L		/*:: PUNCT_SPAR_LAST("true") ::*/
+%token UNBOUND_L	/*:: PUNCT_SPAR_LAST("UNBOUND") ::*/
 %token UNION_L		/*:: PUNCT_SPAR_LAST("UNION") ::*/
 %token USING_L		/*:: PUNCT_SPAR_LAST("USING") ::*/
 %token WHERE_L		/*:: PUNCT("WHERE"), SPAR, LAST1("WHERE {"), LAST1("WHERE ("), LAST1("WHERE #cmt\n{"), LAST1("WHERE\r\n("), ERR("WHERE"), ERR("WHERE bad") ::*/
+%token WITH_L		/*:: PUNCT_SPAR_LAST("WITH") ::*/
 %token __SPAR_PUNCT_END	/* Delimiting value for syntax highlighting */
 
 %token START_OF_SPARQL_TEXT	/*:: FAKE("the beginning of SPARQL text"), SPAR, NULL ::*/
@@ -314,8 +319,18 @@ int sparyylex_from_sparp_bufs (caddr_t *yylval, sparp_t *sparp)
 %type <trees> spar_sponge_option_commalist_opt_rpar
 %type <backstack> spar_sponge_option_commalist
 %type <tree> spar_precode_expn
-%type <nothing> spar_where_clause_opt
 %type <nothing> spar_where_clause
+%type <nothing> spar_wherebindings_clause_opt
+%type <nothing> spar_wherebindings_clause
+%type <tree> spar_bindings_clause_opt
+%type <tree> spar_bindings_clause
+%type <backstack> spar_bindings_vars
+%type <tree> spar_bindings_var
+%type <backstack> spar_bindings_opt
+%type <backstack> spar_bindings
+%type <trees> spar_binding
+%type <backstack> spar_bindvals
+%type <tree> spar_bindval
 %type <tree> spar_solution_modifier
 %type <backstack> spar_group_clause_opt
 %type <backstack> spar_group_expns
@@ -337,9 +352,12 @@ int sparyylex_from_sparp_bufs (caddr_t *yylval, sparp_t *sparp)
 %type <tree> spar_quad_map_gp
 %type <tree> spar_group_or_union_gp
 %type <tree> spar_constraint
+%type <tree> spar_constraint_exists_int
+%type <token_type> spar_exists_or_not_exists
 %type <tree> spar_service_req
 %type <backstack> spar_service_options_list_opt
 %type <backstack> spar_service_options
+%type <trees> spar_service_option
 %type <tree> spar_ctor_template
 %type <nothing> spar_ctor_triples
 %type <nothing> spar_triples_opt
@@ -574,7 +592,7 @@ spar_prefix_decls_opt	/* ::=  PrefixDecl*	*/
 
 spar_prefix_decl	/* [4]	PrefixDecl	 ::=  'PREFIX' QNAME_NS Q_IRI_REF	*/
 	: PREFIX_L QNAME_NS Q_IRI_REF	{
-                if (!strcmp ("sql:", $2) || !strcmp ("bif:", $2))
+		if ((!strcmp ("sql:", $2) && strcmp ("sql:", $3)) || (!strcmp ("bif:", $2) && strcmp ("bif:", $3)))
 		  sparyyerror ("Prefixes 'sql:' and 'bif:' are reserved for SQL names");
 		t_set_push (&(sparp_env()->spare_namespace_prefixes), sparp_expand_q_iri_ref (sparp_arg, $3));
 		t_set_push (&(sparp_env()->spare_namespace_prefixes), t_box_dv_short_nchars ($2, box_length ($2)-2)); }
@@ -587,7 +605,7 @@ spar_select_query	/* [5]*	SelectQuery	 ::=  'SELECT' ( 'DISTINCT' | 'REDUCED' )?
 	: spar_select_query_mode {
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
                 t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
-		sparp_arg->sparp_allow_aggregates_in_expn++; }
+		sparp_arg->sparp_allow_aggregates_in_expn |= 1; }
 	    spar_select_rset spar_dataset_clauses_opt
             spar_where_clause spar_solution_modifier {
 		SPART *where_gp = spar_gp_finalize (sparp_arg, NULL);
@@ -625,7 +643,7 @@ spar_construct_query	/* [6]	ConstructQuery	 ::=  'CONSTRUCT' ConstructTemplate D
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
                 t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); }
             spar_ctor_template spar_dataset_clauses_opt
-            spar_where_clause spar_solution_modifier {
+	    spar_wherebindings_clause spar_solution_modifier spar_bindings_clause_opt {
                 const char *formatter, *agg_formatter, *agg_mdata;
 		SPART *where_gp = spar_gp_finalize (sparp_arg, NULL);
 		SPART *wm = $6;
@@ -643,7 +661,7 @@ spar_describe_query	/* [7]*	DescribeQuery	 ::=  'DESCRIBE' ( ( Var | IRIref | Ba
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
                 t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); }
             spar_describe_rset spar_dataset_clauses_opt
-	    spar_where_clause_opt spar_solution_modifier {
+	    spar_wherebindings_clause_opt spar_solution_modifier spar_bindings_clause_opt {
 		SPART * where_gp = spar_gp_finalize (sparp_arg, NULL);
 		SPART *wm = $6;
 		caddr_t retselid = spar_selid_pop (sparp_arg);
@@ -664,7 +682,7 @@ spar_ask_query		/* [8]	AskQuery	 ::=  'ASK' DatasetClause* WhereClause	*/
 		sparp_arg->sparp_env->spare_top_retval_selid = spar_selid_push (sparp_arg);
                 t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); }
             spar_dataset_clauses_opt
-	    spar_where_clause {
+	    spar_wherebindings_clause {
 		SPART * where_gp = spar_gp_finalize (sparp_arg, NULL);
 		$$ = spar_make_top (sparp_arg, ASK_L, (SPART **)t_list(0), spar_selid_pop (sparp_arg),
 		  where_gp, NULL, NULL, NULL, (SPART *)t_box_num(1), (SPART *)t_box_num(0) ); }
@@ -689,6 +707,8 @@ spar_dataset_clause_subtype
 	| FROM_L NAMED_L	{ $$ = SPART_GRAPH_NAMED; }
 	| NOT_L FROM_L		{ $$ = SPART_GRAPH_NOT_FROM; }
 	| NOT_L FROM_L NAMED_L	{ $$ = SPART_GRAPH_NOT_NAMED; }
+	| NOT_FROM_L		{ $$ = SPART_GRAPH_NOT_FROM; }
+	| NOT_FROM_L NAMED_L	{ $$ = SPART_GRAPH_NOT_NAMED; }
 	;
 
 spar_sponge_optionlist_opt	/* [Virt]	SpongeOptionList	 ::=  'OPTION' '(' ( SpongeOption ( ',' SpongeOption )* )? ')'	*/
@@ -715,24 +735,91 @@ spar_precode_expn	/* [Virt]	PrecodeExpn	 ::=  Expn	(* Only global variables can
 	  { sparp_arg->sparp_in_precode_expn = 0; $$ = $2; }
 	;
 
-spar_where_clause_opt	/* ::=  WhereClause?	*/
+spar_wherebindings_clause_opt	/* ::=  (WhereClause BindingsClause?)?	*/
 	: /* nothing */ {
-		sparp_arg->sparp_allow_aggregates_in_expn--;
+		sparp_arg->sparp_allow_aggregates_in_expn &= ~1;
 		spar_gp_init (sparp_arg, WHERE_L); }
-	| spar_where_clause {;}
+	| spar_wherebindings_clause {;}
 	;
 
-spar_where_clause	/* [13]	WhereClause	 ::=  'WHERE'? GroupGraphPattern	*/
+spar_where_clause	/* [13*]	WhereClause	 ::=  'WHERE'? GroupGraphPattern	*/
 	: WHERE_L _LBRA	{
-		sparp_arg->sparp_allow_aggregates_in_expn--;
+		sparp_arg->sparp_allow_aggregates_in_expn &= ~1;
 		spar_gp_init (sparp_arg, WHERE_L); }
-	    spar_gp _RBRA {;}
+	    spar_gp _RBRA spar_bindings_clause_opt {;}
 	| _LBRA {
-		sparp_arg->sparp_allow_aggregates_in_expn--;
+		sparp_arg->sparp_allow_aggregates_in_expn &= ~1;
 		spar_gp_init (sparp_arg, WHERE_L); }
 	    spar_gp _RBRA {;}
 	;
 
+spar_wherebindings_clause	/* [13*]	WhereBindingsClause	 ::=  'WHERE'? GroupGraphPattern BindingsClause?	*/
+	: spar_where_clause spar_bindings_clause_opt {;}
+	;
+
+spar_bindings_clause_opt
+	: /* nothing */		{ $$ = NULL; }
+	| spar_bindings_clause	{ $$ = $1; }
+	;
+
+spar_bindings_clause		/* [Sparql1.1*]	BindingsClause	 ::=  'BINDINGS' BindingsVar+ '{' Binding* '}'	*/
+	: BINDINGS_L	{
+		if (NULL != sparp_arg->sparp_env->spare_bindings_vars)
+		  sparyyerror ("Only one BINDINGS clause per query is allowed");
+		spar_selid_push (sparp_arg); }
+	    spar_bindings_vars _LBRA	{
+		spar_selid_pop (sparp_arg);
+		sparp_arg->sparp_env->spare_bindings_vars = (SPART **)t_revlist_to_array ($3); }
+	    spar_bindings_opt _RBRA	{
+		sparp_arg->sparp_env->spare_bindings_rowset = (SPART ***)t_revlist_to_array ($6);
+		$$ = spartlist (sparp_arg, 4, SPAR_BINDINGS_INV, 0,
+			sparp_arg->sparp_env->spare_bindings_vars,
+			sparp_arg->sparp_env->spare_bindings_rowset );
+		spar_alloc_fake_equivs_for_bindings_inv (sparp_arg, $$); }
+	;
+
+spar_bindings_vars
+	: spar_bindings_var			{ $$ = NULL; t_set_push (&($$), spar_make_variable (sparp_arg, $1)); }
+	| spar_bindings_vars spar_bindings_var	{ $$ = $1; t_set_push (&($$), spar_make_variable (sparp_arg, $2)); }
+	;
+
+spar_bindings_var		/* [Sparql1.1*]	BindingsVar	 ::=  VAR1 | VAR2 | GlobalVar	*/
+	: QUEST_VARNAME		{ ; }
+	| DOLLAR_VARNAME	{ ; }
+	| spar_global_var	{ sparyyerror ("Global variable can not be used in the header of BINDINGS"); }
+	;
+
+spar_bindings_opt
+	: /* nothing */		{ $$ = NULL; }
+	| spar_bindings		{ $$ = $1; }
+	;
+
+spar_bindings
+	: spar_binding			{ $$ = NULL; t_set_push (&($$), $1); }
+	| spar_bindings spar_binding	{ $$ = $1; t_set_push (&($$), $2); }
+	;
+
+spar_binding			/* [Sparql1.1]	Binding	 ::=  '(' ( IRIref | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | 'UNBOUND' )+ ')'	*/
+	: _LPAR spar_bindvals _RPAR {
+		$$ = t_revlist_to_array ($2);
+		if (BOX_ELEMENTS ($$) != BOX_ELEMENTS (sparp_arg->sparp_env->spare_bindings_vars))
+		  sparyyerror ("Number of values in a binding does not match number of variables to bind"); }
+	;
+
+spar_bindvals
+	: spar_bindval		{$$ = NULL; t_set_push (&($$), $1); }
+	| spar_bindvals spar_bindval	{$$ = $1; t_set_push (&($$), $2); }
+	;
+
+spar_bindval
+	: spar_iriref
+	| spar_numeric_literal
+	| spar_rdf_literal
+	| spar_boolean_literal
+	| spar_blank_node
+	| UNBOUND_L		{$$ = NULL; }
+	;
+
 spar_solution_modifier	/* [14]*	SolutionModifier	 ::=  GroupClause? HavingClause? OrderClause? */
 			/*... ((LimitClause OffsetClause?) | (OffsetClause LimitClause?))?	*/
 	: spar_group_clause_opt spar_having_clause_opt spar_order_clause_opt						{ $$ = spar_make_wm (sparp_arg, NULL, (SPART **)t_revlist_to_array ($1), $2, (SPART **)t_revlist_to_array ($3), (SPART *)t_box_num (SPARP_MAXLIMIT), (SPART *)t_box_num (0)); }
@@ -744,10 +831,10 @@ spar_group_clause_opt	/* [Virt]	GroupClause	 ::=  'GROUP' 'BY' GroupExpn+	*/
 	: /* empty */				{ $$ = NULL; }
 	| GROUP_L BY_L {
 		spar_selid_push_reused (sparp_arg, sparp_arg->sparp_env->spare_top_retval_selid);
-		sparp_arg->sparp_allow_aggregates_in_expn++; }
+		sparp_arg->sparp_allow_aggregates_in_expn |= 1; }
 	    spar_group_expns	{
 		spar_selid_pop (sparp_arg); $$ = $4;
-		sparp_arg->sparp_allow_aggregates_in_expn--; }
+		sparp_arg->sparp_allow_aggregates_in_expn &= ~1; }
 	;
 
 spar_group_expns	/* ::=  GroupExpn+	*/
@@ -768,20 +855,20 @@ spar_having_clause_opt	/* [Virt]	HavingClause	 ::= 'HAVING' Expn */
 	: /* empty */	{ $$ = NULL; }
 	| HAVING_L {
 		spar_selid_push_reused (sparp_arg, sparp_arg->sparp_env->spare_top_retval_selid);
-		sparp_arg->sparp_allow_aggregates_in_expn++; }
+		sparp_arg->sparp_allow_aggregates_in_expn |= 1; }
 	    spar_expn {
 		spar_selid_pop (sparp_arg); $$ = $3;
-		sparp_arg->sparp_allow_aggregates_in_expn--; }
+		sparp_arg->sparp_allow_aggregates_in_expn &= ~1; }
 	;
 
 spar_order_clause_opt	/* [15]	OrderClause	 ::=  'ORDER' 'BY' OrderCondition+	*/
 	: /* empty */				{ $$ = NULL; }
 	| ORDER_L BY_L {
 		spar_selid_push_reused (sparp_arg, sparp_arg->sparp_env->spare_top_retval_selid);
-		sparp_arg->sparp_allow_aggregates_in_expn++; }
+		sparp_arg->sparp_allow_aggregates_in_expn |= 1; }
 	    spar_order_conditions	{
 		spar_selid_pop (sparp_arg); $$ = $4;
-		sparp_arg->sparp_allow_aggregates_in_expn--; }
+		sparp_arg->sparp_allow_aggregates_in_expn &= ~1; }
 	;
 
 spar_order_conditions	/* ::=  OrderCondition+	*/
@@ -828,11 +915,13 @@ spar_group_gp		/* [19]*	GroupGraphPattern	 ::=  '{' ( GraphPattern | SelectQuery
 		$$ = spar_gp_finalize (sparp_arg, $3);
 		sparp_validate_options_of_tree (sparp_arg, $$, $$->_.gp.options); }
 	| spar_select_query_mode {
-		SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "subquery");
+		if (NULL == sparp_env()->spare_context_sinvs) { /* There's an exception related to codegen-time optimization SERVICE { SELECT {x}} like it is SERVICE {x}, so no error right here. */
+		    SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "subquery"); }
 		spar_env_push (sparp_arg);
 		spar_selid_push (sparp_arg);
                 t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
-		sparp_arg->sparp_allow_aggregates_in_expn++; }
+		sparp_arg->sparp_allow_aggregates_in_expn <<= 1;
+		sparp_arg->sparp_allow_aggregates_in_expn |= 1; }
 	    spar_select_rset spar_dataset_clauses_opt
             spar_where_clause spar_solution_modifier
 	    _RBRA spar_triple_optionlist_opt {
@@ -848,7 +937,8 @@ spar_group_gp		/* [19]*	GroupGraphPattern	 ::=  '{' ( GraphPattern | SelectQuery
 		if (SPAR_REQ_TOP == subselect_top->type)
 		  sparp_expand_top_retvals (sparp_arg, subselect_top, 1 /* safely_copy_all_vars */);
 		spar_env_pop (sparp_arg);
-		$$ = spar_gp_finalize_with_subquery (sparp_arg, $8, subselect_top); }
+		$$ = spar_gp_finalize_with_subquery (sparp_arg, $8, subselect_top);
+		sparp_arg->sparp_allow_aggregates_in_expn >>= 1; }
 	;
 
 spar_gp			/* [20]	GraphPattern	 ::=  Triples? ( GraphPatternNotTriples '.'? GraphPattern )?	*/
@@ -904,12 +994,48 @@ spar_constraint		/* [25]*	Constraint	 ::=  'FILTER' ( ( '(' Expn ')' ) | BuiltIn
 	: FILTER_L _LPAR spar_expn _RPAR	{ $$ = $3; }
 	| FILTER_L spar_built_in_call	{ $$ = $2; }
 	| FILTER_L spar_function_call	{ $$ = $2; }
+	| FILTER_L spar_exists_or_not_exists spar_constraint_exists_int {		/*... | 'NOT'? 'EXISTS' DatasetClause* WhereClause */
+		if ($2)
+		  $$ = $3;
+		else
+		  SPAR_BIN_OP ($$, BOP_NOT, $3, NULL); }
+	| MINUS_L spar_constraint_exists_int {		/*... | 'NOT'? 'EXISTS' DatasetClause* WhereClause */
+		/*!!! Dirty hack! Works wrong if MINUS is at the middle of the GP (before smth or not a 2-nd item) */
+		  SPAR_BIN_OP ($$, BOP_NOT, $2, NULL); }
+	;
+
+spar_exists_or_not_exists
+	: EXISTS_L		{ $$ = 1; }
+	| NOT_L EXISTS_L	{ $$ = 0; }
+	;
+
+spar_constraint_exists_int
+	: {
+		SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_SPARQL11, "SPARQL 1.1 FILTER EXISTS / FILTER NOT EXISTS test");
+		spar_gp_init (sparp_arg, SELECT_L);
+		spar_env_push (sparp_arg);
+		spar_selid_push (sparp_arg);
+		t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
+		sparp_arg->sparp_allow_aggregates_in_expn <<= 1; }
+	    spar_dataset_clauses_opt
+	    spar_wherebindings_clause
+	    spar_triple_optionlist_opt {
+		SPART *subselect_top;
+		SPART *where_gp;
+		where_gp = spar_gp_finalize (sparp_arg, NULL);
+		subselect_top = spar_make_top (sparp_arg, ASK_L, (SPART **)t_list(0), spar_selid_pop (sparp_arg),
+		  where_gp, NULL, NULL, NULL, (SPART *)t_box_num(1), (SPART *)t_box_num(0) );
+		spar_env_pop (sparp_arg);
+		$$ = spar_gp_finalize_with_subquery (sparp_arg, $4, subselect_top);
+		sparp_arg->sparp_allow_aggregates_in_expn >>= 1; }
 	;
 
 spar_service_req	/* [Virt]	ServiceRequest ::=  'SERVICE' IRIref ServiceOptionList? GroupGraphPattern	*/
 	: SERVICE_L spar_qm_iriref_const_expn {
 		sparp_arg->sparp_query_uses_sinvs++;
-		$<token_type>$ = sparp_arg->sparp_permitted_syntax; }
+		$<token_type>$ = sparp_arg->sparp_permitted_syntax;
+		sparp_arg->sparp_permitted_syntax = SSG_SD_GLOBALS; /*!!! TBD config */
+		}
 	    spar_service_options_list_opt {
 		$<box>$ = t_alloc (sizeof (sparp_sources_t));
 		memcpy ($<box>$, &(sparp_arg->sparp_env->spare_src), sizeof (sparp_sources_t));
@@ -917,14 +1043,11 @@ spar_service_req	/* [Virt]	ServiceRequest ::=  'SERVICE' IRIref ServiceOptionLis
 	    spar_dataset_clauses_opt _LBRA {
 		SPART **sources;
 		caddr_t sinv_storage_uri = uname_virtrdf_ns_uri_DefaultServiceStorage /*!!! TBD config */;
-		ptrlong sinv_syntax;
 		SPART *sinv;
 		if ((NULL == sparp_arg->sparp_env->spare_default_graphs) && (NULL == sparp_arg->sparp_env->spare_named_graphs))
 		  memcpy (&(sparp_arg->sparp_env->spare_src), $<box>5, sizeof (sparp_sources_t));
-		sinv_syntax = SSG_SD_GLOBALS; /*!!! TBD config */
-		sparp_arg->sparp_permitted_syntax = sinv_syntax;
 		sources = spar_make_sources_like_top (sparp_arg);
-		sinv = spar_make_service_inv (sparp_arg, $2, $4, sinv_syntax, sources, sinv_storage_uri);
+		sinv = spar_make_service_inv (sparp_arg, $2, $4, sparp_arg->sparp_permitted_syntax, sources, sinv_storage_uri);
 		t_set_push (&(sparp_env()->spare_context_sinvs), sinv);
 		spar_gp_init (sparp_arg, SERVICE_L); }
 	    spar_group_gp {
@@ -936,17 +1059,29 @@ spar_service_req	/* [Virt]	ServiceRequest ::=  'SERVICE' IRIref ServiceOptionLis
 		$$ = $9; }
 
 spar_service_options_list_opt	/* [Virt]	ServiceOptionList ::=  '(' ( 'DEFINE'? IRIref DefValue ( ',' DefValue )* )+ ')'	*/
-	: /* empty */				{ $$ = NULL; }
+	: /* empty */				{ $$ = NULL; t_set_push (&($$), (SPART *)((ptrlong)IN_L)); t_set_push (&($$), (SPART *)((ptrlong)_STAR)); }
 	| _LPAR spar_service_options _RPAR	{ $$ = $2; }
 	;
 
 spar_service_options
-	: QNAME spar_define_val_commalist		{ $$ = NULL; t_set_push (&($$), $1); t_set_push (&($$), $2); }
-	| DEFINE_L QNAME spar_define_val_commalist		{ $$ = NULL; t_set_push (&($$), (SPART *)((ptrlong)DEFINE_L)); t_set_push (&($$), t_list (2, $2, t_revlist_to_array($3))); }
-	| IN_L spar_triple_option_var_commalist		{ $$ = NULL; t_set_push (&($$), (SPART *)((ptrlong)IN_L)); t_set_push (&($$), $2); }
-	| spar_service_options QNAME spar_define_val_commalist	{ $$ = $1; t_set_push (&($$), $2); t_set_push (&($$), t_revlist_to_array($3)); }
-	| spar_service_options DEFINE_L QNAME spar_define_val_commalist	{ $$ = $1; t_set_push (&($$), (SPART *)((ptrlong)DEFINE_L)); t_set_push (&($$), t_list (2, $3, t_revlist_to_array($4))); }
-	| spar_service_options IN_L spar_triple_option_var_commalist	{ $$ = $1; t_set_push (&($$), (SPART *)((ptrlong)IN_L)); t_set_push (&($$), $3); }
+	: spar_service_option		{ $$ = NULL; t_set_push (&($$), $1[0]); t_set_push (&($$), $1[1]); }
+	| spar_service_options spar_service_option	{ $$ = $1; t_set_push (&($$), $2[0]); t_set_push (&($$), $2[1]); }
+	;
+
+spar_service_option
+	: QNAME spar_define_val_commalist		{ $$ = (SPART **)t_list (2, $1, $2); }
+	| DEFINE_L QNAME spar_define_val_commalist	{
+		caddr_t defname = $2;
+		dk_set_t defvals = $3;
+		if (!strcmp (defname, "lang:dialect"))
+		  {
+		    if ((NULL == defvals) || (NULL != defvals->next) || (SPARQL_INTEGER != ((ptrlong *)(defvals->data))[0]))
+		      sparyyerror ("define lang:dialect needs an integer");
+		    sparp_arg->sparp_permitted_syntax = unbox (((caddr_t *)(defvals->data))[1]) | SSG_SD_GLOBALS;
+		  }
+		$$ = (SPART **)t_list (2, (SPART *)((ptrlong)DEFINE_L), t_list (2, defname, t_revlist_to_array(defvals))); }
+	| IN_L spar_triple_option_var_commalist		{ $$ = (SPART **)t_list (2, (SPART *)((ptrlong)IN_L), $2); }
+	| IN_L _STAR					{ $$ = (SPART **)t_list (2, (SPART *)((ptrlong)IN_L), (SPART *)((ptrlong)_STAR)); }
 	;
 
 spar_ctor_template	/* [26]*	ConstructTemplate	 ::=  '{' ConstructTriples '}'	*/
@@ -986,6 +1121,7 @@ spar_props_opt		/* [30]	PropertyList	 ::=  PropertyListNotEmpty?	*/
 	: /* empty */	{ }
 	| spar_props	{ }
 	| spar_props _SEMI	{ }
+	| spar_props _SEMI _DOT	{ sparyyerror ("Dot immediately after semicolon is permitted in pure SPARQL but not in SPARQL-BI"); }
 	;
 
 spar_props		/* [31]	PropertyListNotEmpty	 ::=  Verb ObjectList ( ';' PropertyList )?	*/
@@ -994,6 +1130,7 @@ spar_props		/* [31]	PropertyListNotEmpty	 ::=  Verb ObjectList ( ';' PropertyLis
 	| spar_props _SEMI
 	    spar_verb { t_set_push (&(sparp_env()->spare_context_predicates), $3); }
 	    spar_objects { t_set_pop (&(sparp_env()->spare_context_predicates)); }
+	| spar_props _SEMI _DOT	{ sparyyerror ("Dot immediately after semicolon is permitted in pure SPARQL but not in SPARQL-BI"); }
 	| spar_props _SEMI error { sparyyerror ("Predicate expected after semicolon"); }
 	| error { sparyyerror ("Predicate expected"); }
 	;
@@ -1001,6 +1138,8 @@ spar_props		/* [31]	PropertyListNotEmpty	 ::=  Verb ObjectList ( ';' PropertyLis
 spar_objects		/* [32]*	ObjectList	 ::=  ObjGraphNode ( ',' ObjectList )?	*/
 	: spar_ograph_node { }
 	| spar_objects _COMMA spar_ograph_node { }
+	| spar_objects _COMMA _SEMI { sparyyerror ("Semicolon immediately after colon is permitted in pure SPARQL but not in SPARQL-BI"); }
+	| spar_objects _COMMA _DOT { sparyyerror ("Dot immediately after colon is permitted in pure SPARQL but not in SPARQL-BI"); }
 	| spar_objects _COMMA error { sparyyerror ("Object expected after comma"); }
 	| error { sparyyerror ("Object expected"); }
 	;
@@ -1012,7 +1151,10 @@ spar_ograph_node	/* [Virt]	ObjGraphNode	 ::=  GraphNode TripleOptions?	*/
 
 spar_triple_optionlist_opt	/* [Virt]	TripleOptions	 ::=  'OPTION' '(' TripleOption ( ',' TripleOption )? ')'	*/
 	: /* empty */	{ $$ = NULL; }
-	| OPTION_L _LPAR { SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_OPTION, "OPTION () triple matching configuration"); }
+	| OPTION_L _LPAR {
+		if (CONSTRUCT_L == SPARP_ENV_CONTEXT_GP_SUBTYPE(sparp_arg))
+		  sparyyerror ("Triple options are not allowed in contructor template");
+		SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_OPTION, "OPTION () triple matching configuration"); }
 	    spar_triple_option_commalist _RPAR { $$ = (SPART **)t_revlist_to_array ($4); }
 	;
 
@@ -1072,6 +1214,7 @@ spar_same_as_option
 spar_verb		/* [33]	Verb		 ::=  VarOrBlankNodeOrIRIref | 'a'	*/
 	: spar_var_or_iriref_or_backquoted
 	| a_L { $$ = spartlist (sparp_arg, 2, SPAR_QNAME, uname_rdf_ns_uri_type); }
+	| error { sparyyerror ("Predicate expected (i.e., variable or IRI ref or a backquoted expn or 'a' keyword)"); }
 	;
 
 spar_triples_node	/* [34]	TriplesNode	 ::=  Collection | BlankNodePropertyList	*/
@@ -1315,9 +1458,10 @@ spar_expn		/* [43]	Expn		 ::=  ConditionalOrExpn	( 'AS' ( VAR1 | VAR2 ) ) */
                 spar_gp_init (sparp_arg, SELECT_L);
 		spar_env_push (sparp_arg);
 		spar_selid_push (sparp_arg);
-                t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL); }
+		t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
+		sparp_arg->sparp_allow_aggregates_in_expn <<= 1; }
             spar_dataset_clauses_opt
-	    spar_where_clause
+	    spar_wherebindings_clause
 	    _RPAR spar_triple_optionlist_opt {
 		SPART *subselect_top;
 		SPART *where_gp;
@@ -1325,14 +1469,16 @@ spar_expn		/* [43]	Expn		 ::=  ConditionalOrExpn	( 'AS' ( VAR1 | VAR2 ) ) */
 		subselect_top = spar_make_top (sparp_arg, ASK_L, (SPART **)t_list(0), spar_selid_pop (sparp_arg),
 		  where_gp, NULL, NULL, NULL, (SPART *)t_box_num(1), (SPART *)t_box_num(0) );
 		spar_env_pop (sparp_arg);
-		$$ = spar_gp_finalize_with_subquery (sparp_arg, $7, subselect_top); }
+		$$ = spar_gp_finalize_with_subquery (sparp_arg, $7, subselect_top);
+		sparp_arg->sparp_allow_aggregates_in_expn >>= 1; }
 	| _LPAR spar_select_query_mode {
 		SPAR_ERROR_IF_UNSUPPORTED_SYNTAX (SSG_SD_BI, "scalar subquery");
                 spar_gp_init (sparp_arg, SELECT_L);
 		spar_env_push (sparp_arg);
 		spar_selid_push (sparp_arg);
                 t_set_push (&(sparp_arg->sparp_env->spare_propvar_sets), NULL);
-		sparp_arg->sparp_allow_aggregates_in_expn++; }
+		sparp_arg->sparp_allow_aggregates_in_expn <<= 1;
+		sparp_arg->sparp_allow_aggregates_in_expn |= 1; }
 	    spar_select_rset spar_dataset_clauses_opt
             spar_where_clause spar_solution_modifier
 	    _RPAR spar_triple_optionlist_opt {
@@ -1348,12 +1494,13 @@ spar_expn		/* [43]	Expn		 ::=  ConditionalOrExpn	( 'AS' ( VAR1 | VAR2 ) ) */
 		if (SPAR_REQ_TOP == subselect_top->type)
 		  sparp_expand_top_retvals (sparp_arg, subselect_top, 1 /* safely_copy_all_vars */);
 		spar_env_pop (sparp_arg);
-		$$ = spar_gp_finalize_with_subquery (sparp_arg, $9, subselect_top); }
+		$$ = spar_gp_finalize_with_subquery (sparp_arg, $9, subselect_top);
+		sparp_arg->sparp_allow_aggregates_in_expn >>= 1; }
 	| spar_ret_agg_call {
 		$$ = $1;
 		if (sparp_arg->sparp_in_precode_expn)
 		  sparyyerror ("Aggregates are not allowed in 'precode' expressions that should be calculated before the result-set of the query");
-		if (!sparp_arg->sparp_allow_aggregates_in_expn)
+		if (!(sparp_arg->sparp_allow_aggregates_in_expn & 1))
 		  sparyyerror ("Aggregates are allowed only in result sets"); }
 	| spar_built_in_call
 	| spar_iriref spar_arg_list_opt {	/* [55]	IRIrefOrFunction	 ::=  IRIref ArgList? */
@@ -1427,6 +1574,7 @@ spar_arg_list_opt	/* ::=  ArgList?	*/
 
 spar_arg_list		/* [56]*	ArgList	 ::=  ( NIL | '(' Expns ')' )	*/
 	: NIL_L				{ $$ = (dk_set_t)NIL_L; }
+	| _LPAR _RPAR			{ $$ = (dk_set_t)NIL_L; }
 	| _LPAR spar_expns _RPAR	{ $$ = $2; }
 	;
 
@@ -1610,7 +1758,7 @@ spar_sparul_drop	/* [DML]*	DropAction	 ::=  'DROP' 'SILENT'? 'GRAPH' ( 'IDENTIFI
 
 spar_action_solution
 	: /* empty */ { $$ = spar_make_fake_action_solution (sparp_arg); }
-	| spar_dataset_clauses_opt spar_where_clause spar_solution_modifier {
+	| spar_dataset_clauses_opt spar_wherebindings_clause spar_solution_modifier spar_bindings_clause_opt {
 		SPART *where_gp = spar_gp_finalize (sparp_arg, NULL);
 		$$ = $3;
 		$3->_.wm.where_gp = where_gp; }
diff --git a/libsrc/Wi/sparql_rdb2rdf.c b/libsrc/Wi/sparql_rdb2rdf.c
new file mode 100644
index 0000000..22448c1
--- /dev/null
+++ b/libsrc/Wi/sparql_rdb2rdf.c
@@ -0,0 +1,1343 @@
+/*
+ *  $Id: sparql_rdb2rdf.c,v 1.1.2.2 2010/11/23 19:28:25 source Exp $
+ *
+ *  Code genration for triggers that update native RDF data on changes in relational sources
+ *
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *
+ *  Copyright (C) 1998-2010 OpenLink Software
+ *
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "libutil.h"
+#include "sqlnode.h"
+#include "sqlbif.h"
+#include "sqlparext.h"
+#include "bif_text.h"
+#include "xmlparser.h"
+#include "xmltree.h"
+#include "numeric.h"
+#include "rdf_core.h"
+#include "security.h"
+#include "sqlcmps.h"
+#include "sparql.h"
+#include "sparql2sql.h"
+#include "xml_ecm.h" /* for sorted dict, ECM_MEM_NOT_FOUND etc. */
+#include "arith.h" /* for cmp_boxes() */
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "sparql_p.h"
+#ifdef __cplusplus
+}
+#endif
+
+extern int adler32_of_buffer (unsigned char *data, size_t len);
+
+/*! Description of blocker that become conditional wrapper of form "if (field <> inverse_qmf (const)) { rdb2rdf actions }".
+ Some quad map pattern may correspond to a given table and given field values when used standalone but be shadowed by EXCLUSIVE patterns before.
+This structure is to keep one such blocking pattern, as one value per item of blocking pattern.
+Field value is NULL if quad map value is not specified in the corresponding position, or qm_value if the value is a constant.
+If quad map value is specified but not a constant then there's no need to remember it: it's enough to interrupt scan of branch of quad map tree after such an "match-all" exclusive (no more processing -- no need for data for that processing).
+*/
+
+typedef struct rdb2rdf_blocker_s {
+    struct rdb2rdf_blocker_s *rrb_next;			/*!< Next item in list */
+    ccaddr_t rrb_const_vals[SPART_TRIPLE_FIELDS_COUNT];	/*!< Field values */
+    int rrb_total_eclipse;				/*!< Nonzero if total eclipse so no further scan required. For debugging, bits 0x1-0x8 indicate positions of non-constant quad map values */
+  } rdb2rdf_blocker_t;
+
+#define RDB2RDF_MAX_ALIASES_OF_MAIN_TABLE	7 /*!< Maximim allowed number of aliases of the main table in the quad map pattern. More than enough, I guess. 8*4=32, so uint32 type is sufficient for control bitmasks */
+
+typedef struct rdb2rdf_optree_s {
+    quad_map_t *rro_qm;			/*!< Pointer to map that is root of qm subtree in question */
+    struct rdb2rdf_optree_s *rro_parent;	/*!< Pointer to a parent node, it may contain exclusive blockers that */
+    struct rdb2rdf_optree_s *rro_breakup_begin;	/*!< Pointer to a node that will be first in the breakup containing the given leaf, NULL for non-leafs */
+    struct rdb2rdf_optree_s **rro_subtrees;	/*!< optrees corresponding to sub quad maps */
+    rdb2rdf_blocker_t	*rro_blockers_before;	/*!< All "strictly previous" blockers of this and above levels (for codegen of this qm). From previous siblings, previous siblings of parent and so on */
+    rdb2rdf_blocker_t	*rro_blockers_before_next;	/*!< rro_blockers_before, extended. If a local blocker exists, it is added to the list of brokers. If optrees are not created for few next sibling quad maps but these quad maps are exclusive then their brokers are added too. This is to fill in next sibling optrees. */
+    int			rro_is_leaf;		/*!< This optree has no descendants and create an SQL DML statement in the trigger */
+    dk_set_t rro_aliases_of_main_table;		/*!< Aliases used for main table, alias_no is a zero-based position in this set */
+    uint32 rro_bits_of_fields_here;		/*!< Bitmask that indicates which fields are calculated by alias only or fixed at this level, not at parent, (0x1 << alias_no*4) for graph, (0x2 << alias_no*4) for S, (0x4 << alias_no*4) for P and (0x8 << alias_no*4) for O */
+    uint32 rro_bits_of_fields_here_and_above;	/*!< Bitwize OR of \c rro_bits_of_fields_here of this optree and all its ancestors */
+    int			rro_own_serial;		/*!< Serial number of optree in the whole tree */
+    int			rro_qm_index;		/*!< Position of rro_qm in \c rrc_all_qms of codegen context */
+    boxint		rro_rule_id;		/*!< Value for RULE_ID field of RDF_QUAD_DELETE_QUEUE */
+    int			rro_self_multi;		/*!< Flags if multiple database rows may create one quad via \c rro_qm alone. */
+    int			rro_sample_of_rule;	/*!< Value for RULE_ID field of RDF_QUAD_DELETE_QUEUE */
+  } rdb2rdf_optree_t;
+
+/*! State of variables g_val, s_val, p_val and o_val */
+typedef struct rdb2rdf_vals_state_s {
+    struct rdb2rdf_vals_state_s *rrvs_next;		/*!< Pointer to next state in enclosing branch */
+    ccaddr_t rrvs_jsos[SPART_TRIPLE_FIELDS_COUNT];		/*!< Pointers to source qmvs or consts that are now values of variables. NULL means that the variable is uninitialized or unknown after branching on if(){} . */
+  } rdb2rdf_vals_state_t;
+
+typedef struct rdb2rdf_ctx_s {
+    rdb2rdf_optree_t		rrc_root_rro;	/*!< Root optree, an fake one that corresponds to the whole storage (user's quad maps are its subtrees) */
+    rdb2rdf_vals_state_t *	rrc_rrvs_stack;	/*!< Stack of states of variables */
+    int			rrc_all_qm_count;	/*!< Count of all quad maps in the storage */
+    dk_set_t			rrc_qm_revlist;	/*!< Accumulator to build \c rrc_all_qms */
+    quad_map_t **		rrc_all_qms;	/*!< List of all quad maps of the storage (first */
+    char **		rrc_conflicts_of_qms;	/*!< Matrix of RDB2RDF_QMQM_xxx values, one row per quad map (same order as in \c rrc_all_qms), one item per qm-to-qm relation */
+    int			rrc_rule_id_seed;	/*!< Value for RULE_ID field of RDF_QUAD_DELETE_QUEUE */
+    int				rrc_rule_count;	/*!< Count of rules, if zero then "after delete" code is not needed. */
+    sparp_t			rrc_sparp_stub;	/*!< Stub for use its auto-initializable fields in sparp_rvr_intersect_sprintffs() and the like */
+  } rdb2rdf_ctx_t;
+
+
+#define RDB2RDF_CODEGEN_EXPLAIN			0
+#define RDB2RDF_CODEGEN_INITIAL			1
+#define RDB2RDF_CODEGEN_AFTER_INSERT		2
+#define RDB2RDF_CODEGEN_AFTER_UPDATE		3
+#define RDB2RDF_CODEGEN_BEFORE_DELETE		4
+#define COUNTOF__RDB2RDF_CODEGEN		5
+#define RDB2RDF_CODEGEN_BEFORE_UPDATE		13
+#define RDB2RDF_CODEGEN_AFTER_DELETE		14
+
+#define RDB2RDF_CODEGEN_INITIAL_SUB_SINGLE	1
+#define RDB2RDF_CODEGEN_INITIAL_SUB_MULTI	2
+#define RDB2RDF_CODEGEN_SUB_INS			3
+#define RDB2RDF_CODEGEN_SUB_BEFORE_DEL		4
+#define RDB2RDF_CODEGEN_SUB_AFTER_DEL		5
+
+#define RDB2RDF_QMQM_NOT_PROVEN		'?'	/*!< The cell is not yet filled with RDB2RDF_QMQM_DISJOIN or RDB2RDF_QMQM_INTERSECT */
+#define RDB2RDF_QMQM_DISJOIN		'.'	/*!< Qm is proven to be disjoint with the main qm */
+#define RDB2RDF_QMQM_INTERSECT		'I'	/*!< Qm is proven to be intersecting with the main qm */
+#define RDB2RDF_QMQM_SELF		's'	/*!< Qm is equal to the main qm (on "main diagonal" of rrc_conflicts_of_qms) */
+#define RDB2RDF_QMQM_WEIRD_SELF		'w'	/*!< Qm is equal to the main qm but not on "main diagonal", so onw qm is found in the storage _twice_ */
+#define RDB2RDF_QMQM_GROUPING		'g'	/*!< Grouping qms are excluded from processing */
+#define RDB2RDF_QMQM_SHADOWED_BY_MAIN	'>'	/*!< Qm is shadowed by the main qm that is declared as an "exclusive" or "soft exclusive" */
+#define RDB2RDF_QMQM_SHADOWED_BY_THIRD	'}'	/*!< Qm is shadowed not by by the main qm but by some third party */
+#define RDB2RDF_QMQM_SHADOWS_MAIN	'<'	/*!< Qm shadows the main one, internal error if the cell is probed. */
+
+#define RDB2RDF_INTERNAL_ERROR sqlr_new_error ("22023", "SR635", "rdb2rdf internal codegen error, line %d", __LINE__);
+
+
+void
+rdb2rdf_reset_rrvs_stack (rdb2rdf_ctx_t *rrc)
+{
+  rrc->rrc_rrvs_stack = (rdb2rdf_vals_state_t *)t_alloc_box (sizeof (rdb2rdf_vals_state_t), DV_ARRAY_OF_LONG);
+}
+
+void
+rdb2rdf_push_rrvs_stack (rdb2rdf_ctx_t *rrc)
+{
+  rdb2rdf_vals_state_t *new_top = (rdb2rdf_vals_state_t *)t_box_copy ((caddr_t)(rrc->rrc_rrvs_stack));
+  new_top->rrvs_next = rrc->rrc_rrvs_stack;
+  rrc->rrc_rrvs_stack = new_top;
+}
+
+void
+rdb2rdf_pop_rrvs_stack (rdb2rdf_ctx_t *rrc, int expects_empty_after)
+{
+  rdb2rdf_vals_state_t *curr = rrc->rrc_rrvs_stack;
+  rdb2rdf_vals_state_t *next;
+  if (NULL == curr)
+    RDB2RDF_INTERNAL_ERROR;
+  next = curr->rrvs_next;
+  if (expects_empty_after)
+    {
+      if (NULL != next)
+        RDB2RDF_INTERNAL_ERROR;
+    }
+  else
+    {
+      int fld_ctr;
+      if (NULL == next)
+        RDB2RDF_INTERNAL_ERROR;
+      for (fld_ctr = SPART_TRIPLE_FIELDS_COUNT; fld_ctr--; /* no step */)
+        {
+          ccaddr_t curr_jso = curr->rrvs_jsos[fld_ctr];
+          ccaddr_t next_jso = next->rrvs_jsos[fld_ctr];
+          dtp_t curr_dtp;
+          if ((curr_jso == next_jso) || (NULL == next_jso))
+            continue;
+          if (NULL == curr_jso)
+            {
+              next->rrvs_jsos[fld_ctr] = NULL;
+              continue;
+            }
+          curr_dtp = DV_TYPE_OF (curr_jso);
+          if ((DV_ARRAY_OF_POINTER == curr_dtp) || (DV_TYPE_OF (next_jso) != curr_dtp) ||
+            (DVC_MATCH != cmp_boxes (curr_jso, next_jso, NULL, NULL)) )
+          next->rrvs_jsos[fld_ctr] = NULL;
+        }
+      rrc->rrc_rrvs_stack = next;
+   }
+}
+
+int
+rdb2rdf_qm_is_self_multi (quad_map_t *qm, ccaddr_t table_name)
+{
+  int atbl_ctr, keyrefd_ctr, found = 0;
+  for (atbl_ctr = qm->qmAllATableUseCount; atbl_ctr--; /* no step */)
+    {
+      qm_atable_use_t *qmatu = ((qm_atable_use_t *)(qm->qmAllATableUses))+atbl_ctr;
+      if (strcmp (table_name, qmatu->qmatu_tablename))
+        continue;
+      DO_BOX_FAST_REV (caddr_t, a, keyrefd_ctr, qm->qmAliasesKeyrefdByQuad)
+        {
+          if (strcmp (a, qmatu->qmatu_alias)) continue;
+          found = 1;
+          break;
+        }
+      END_DO_BOX_FAST_REV;
+      if (!found)
+        return 1;
+    }
+  return 0;
+}
+
+rdb2rdf_optree_t *
+rdb2rdf_create_optree (rdb2rdf_ctx_t *rrc, rdb2rdf_optree_t *parent, rdb2rdf_optree_t *prev_sibling, quad_map_t *qm, ccaddr_t table_name)
+{
+  rdb2rdf_optree_t tmpres;
+  int table_aliases_count = 0;
+  if (NULL == qm->qmAliasesKeyrefdByQuad)
+    sqlr_new_error ("22023", "SR636", "Some quad maps for table %.500s needs upgrade before generating RDB2RDF code, please call DB.DBA.RDF_UPGRADE_METADATA()", table_name ? table_name : "UNKNOWN" );
+  memset (&tmpres, 0, sizeof (rdb2rdf_optree_t));
+  tmpres.rro_is_leaf = (NULL == qm->qmUserSubMaps);
+  tmpres.rro_qm = qm;
+  tmpres.rro_parent = parent;
+  tmpres.rro_blockers_before = ((NULL != prev_sibling) ? prev_sibling->rro_blockers_before_next : parent->rro_blockers_before);
+  tmpres.rro_qm_index = (rrc->rrc_all_qm_count)++;
+  t_set_push (&(rrc->rrc_qm_revlist), qm);
+  if ((!tmpres.rro_is_leaf) && (SPART_QM_EXCLUSIVE & qm->qmMatchingFlags)) /* i.e. there's a blocker and there's a need in its calculation */
+    {
+      int fld_ctr;
+      rdb2rdf_blocker_t *local_rrb = (rdb2rdf_blocker_t *)t_alloc (sizeof (rdb2rdf_blocker_t));
+      for (fld_ctr = SPART_TRIPLE_FIELDS_COUNT; fld_ctr--; /*no step*/)
+        {
+          qm_value_t *fld_qmv = SPARP_FIELD_QMV_OF_QM(qm,fld_ctr);
+          ccaddr_t fld_const = SPARP_FIELD_CONST_OF_QM(qm,fld_ctr);
+          if (NULL != fld_const)
+            local_rrb->rrb_const_vals[fld_ctr] = fld_const;
+          else if (NULL != fld_qmv)
+            local_rrb->rrb_total_eclipse |= 1 << fld_ctr;
+        }
+      local_rrb->rrb_next = tmpres.rro_blockers_before;
+      tmpres.rro_blockers_before_next = local_rrb;
+    }
+  else
+    tmpres.rro_blockers_before_next = tmpres.rro_blockers_before;
+  if (tmpres.rro_is_leaf && (NULL == qm->qmAllConds))
+    sparp_collect_all_conds (NULL, qm);
+  if (tmpres.rro_is_leaf && (NULL != table_name))
+    {
+      int qm_atbl_ctr;
+      if (NULL == qm->qmAllATableUses)
+        sparp_collect_all_atable_uses (NULL, qm);
+      for (qm_atbl_ctr = qm->qmAllATableUseCount; qm_atbl_ctr--; /* no step */)
+        {
+          qm_atable_use_t *qmatu = ((qm_atable_use_t *)(qm->qmAllATableUses))+qm_atbl_ctr;
+          if (strcmp (qmatu->qmatu_tablename, table_name))
+            continue;
+          t_set_push (&(tmpres.rro_aliases_of_main_table), (caddr_t)(qmatu->qmatu_alias));
+          table_aliases_count++;
+        }
+      if ((0 == qm->qmAllATableUseCount) && (NULL != qm->qmTableName) && !strcmp (qm->qmTableName, table_name)) /* Prehistoric declaration of the quad map */
+        {
+          t_set_push (&(tmpres.rro_aliases_of_main_table), uname___empty);
+          table_aliases_count = 1;
+        }
+    }
+  if (table_aliases_count)
+    {
+      int fld_ctr;
+      if (8 < table_aliases_count)
+        sqlr_new_error ("22023", "SR637", "Overcomplicated quad map contains more than 8 aliases for table \"%.200s\"", table_name ? table_name : "UNKNOWN" );
+      for (fld_ctr = SPART_TRIPLE_FIELDS_COUNT; fld_ctr--; /*no step*/)
+        {
+          qm_value_t *fld_qmv = SPARP_FIELD_QMV_OF_QM(qm,fld_ctr);
+          ccaddr_t fld_const = SPARP_FIELD_CONST_OF_QM(qm,fld_ctr);
+          if (NULL != fld_const)
+            tmpres.rro_bits_of_fields_here |= (0x11111111 << fld_ctr);
+          else if (NULL != fld_qmv->qmvATables)
+            {
+              if ((1 == BOX_ELEMENTS (fld_qmv->qmvATables)) && !strcmp (fld_qmv->qmvATables[0]->qmvaTableName, table_name))
+                {
+                  int pass = dk_set_position_of_string (tmpres.rro_aliases_of_main_table, fld_qmv->qmvATables[0]->qmvaAlias);
+                  if (0 > pass)
+#ifndef NDEBUG
+                    GPF_T1 ("rdb2rdf_" "create_optree(): weird collection of aliases");
+#else
+                    continue;
+#endif
+                  tmpres.rro_bits_of_fields_here |= (0x1 << (fld_ctr + 4*pass));
+                }
+            }
+          else if (NULL != fld_qmv->qmvTableName)
+            {
+              if (!strcmp (fld_qmv->qmvTableName, table_name))
+                tmpres.rro_bits_of_fields_here |= (0x1 << fld_ctr);
+            }
+          else if (NULL != qm->qmTableName)
+            {
+              if (!strcmp (qm->qmTableName, table_name))
+                tmpres.rro_bits_of_fields_here |= (0x1 << fld_ctr);
+            }
+        }
+      tmpres.rro_self_multi = rdb2rdf_qm_is_self_multi (qm, table_name);
+    }
+  tmpres.rro_bits_of_fields_here_and_above = tmpres.rro_bits_of_fields_here;
+  if (NULL != parent)
+    tmpres.rro_bits_of_fields_here_and_above |= parent->rro_bits_of_fields_here_and_above;
+  if (NULL != qm->qmUserSubMaps)
+    {
+      dk_set_t subtrees = NULL;
+      int sub_qm_ctr;
+      rdb2rdf_optree_t *prev_sub_qm_rro = NULL;
+      DO_BOX_FAST (quad_map_t *, sub_qm, sub_qm_ctr, qm->qmUserSubMaps)
+        {
+          rdb2rdf_optree_t *sub_qm_rro = rdb2rdf_create_optree (rrc, &tmpres, prev_sub_qm_rro, sub_qm, table_name);
+          if (NULL == sub_qm_rro)
+            continue;
+          t_set_push (&subtrees, sub_qm_rro);
+          prev_sub_qm_rro = sub_qm_rro;
+          if ((NULL != sub_qm_rro->rro_blockers_before_next) && sub_qm_rro->rro_blockers_before_next->rrb_total_eclipse)
+            break;
+        }
+      END_DO_BOX_FAST;
+      if (NULL != subtrees)
+        tmpres.rro_subtrees = (rdb2rdf_optree_t **)t_revlist_to_array (subtrees);
+    }
+  if (tmpres.rro_is_leaf ? ((0 != table_aliases_count) || (NULL == table_name)) : (NULL != tmpres.rro_subtrees))
+    {
+      int sub_qm_rro_ctr;
+      rdb2rdf_optree_t *res = (rdb2rdf_optree_t *)t_alloc (sizeof (rdb2rdf_optree_t));
+      tmpres.rro_own_serial = 1 + ((NULL != prev_sibling) ? prev_sibling->rro_own_serial : parent->rro_own_serial);
+      memcpy (res, &tmpres, sizeof (rdb2rdf_optree_t));
+      DO_BOX_FAST (rdb2rdf_optree_t *, sub_qm_rro, sub_qm_rro_ctr, tmpres.rro_subtrees)
+        {
+          sub_qm_rro->rro_parent = res;
+        }
+      END_DO_BOX_FAST;
+      return res;
+    }
+  if (NULL != prev_sibling)
+    prev_sibling->rro_blockers_before_next = tmpres.rro_blockers_before_next;
+  return NULL; /* The qm is totally useless for triggers on \c table_name */
+}
+
+void
+rdb2rdf_list_tables (rdb2rdf_optree_t *rro, dk_set_t *tables_ret)
+{
+  int sub_qm_rro_ctr;
+  quad_map_t *qm = rro->rro_qm;
+  if (NULL != qm)
+    {
+      int ctr;
+      if (NULL == qm->qmAllATableUses)
+        sparp_collect_all_atable_uses (NULL, qm);
+      for (ctr = qm->qmAllATableUseCount; ctr--; /* no step */)
+        {
+          qm_atable_use_t *qmatu = ((qm_atable_use_t *)(qm->qmAllATableUses)) + ctr;
+          ccaddr_t tblname = qmatu->qmatu_tablename;
+          if (0 > dk_set_position_of_string (tables_ret[0], tblname))
+            dk_set_push (tables_ret, box_copy_tree (tblname));
+        }
+    }
+  DO_BOX_FAST (rdb2rdf_optree_t *, sub_qm_rro, sub_qm_rro_ctr, rro->rro_subtrees)
+    rdb2rdf_list_tables (sub_qm_rro, tables_ret);
+  END_DO_BOX_FAST;
+}
+
+void
+rdb2rdf_set_rvr_by_const_or_qmv (rdb2rdf_ctx_t *rrc, rdf_val_range_t *rvr, ccaddr_t fld_const, qm_value_t *fld_qmv)
+{
+  if (NULL != fld_const)
+    sparp_rvr_set_by_constant (NULL, rvr, NULL, (SPART *)fld_const);
+  else
+    {
+      rdf_val_range_t *qmv_or_fmt_rvr = NULL;
+      if ((SPART_VARR_SPRINTFF | SPART_VARR_FIXED) & fld_qmv->qmvRange.rvrRestrictions)
+        qmv_or_fmt_rvr = &(fld_qmv->qmvRange);
+      else if ((NULL != fld_qmv->qmvFormat) && ((SPART_VARR_SPRINTFF | SPART_VARR_FIXED) & fld_qmv->qmvFormat->qmfValRange.rvrRestrictions))
+        qmv_or_fmt_rvr = &(fld_qmv->qmvFormat->qmfValRange);
+      else
+        qmv_or_fmt_rvr = &(fld_qmv->qmvRange);
+      sparp_rvr_copy (&(rrc->rrc_sparp_stub), rvr, qmv_or_fmt_rvr);
+    }
+}
+
+void
+rdb2rdf_calculate_qmqm (rdb2rdf_ctx_t *rrc, rdb2rdf_optree_t *main_optree, int other_qm_idx)
+{
+  int main_qm_idx = main_optree->rro_qm_index;
+  quad_map_t *main_qm, *other_qm;
+  int fld_ctr;
+  if (RDB2RDF_QMQM_NOT_PROVEN != rrc->rrc_conflicts_of_qms[main_qm_idx][other_qm_idx])
+    return;
+  main_qm = rrc->rrc_all_qms [main_qm_idx];
+  other_qm = rrc->rrc_all_qms [other_qm_idx];
+/* Optimistic loop */
+  for (fld_ctr = 0; fld_ctr < SPART_TRIPLE_FIELDS_COUNT; fld_ctr++)
+    {
+      ccaddr_t main_fld_const = SPARP_FIELD_CONST_OF_QM(main_qm,fld_ctr);
+      ccaddr_t other_fld_const = SPARP_FIELD_CONST_OF_QM(other_qm,fld_ctr);
+      if ((NULL != main_fld_const) && (NULL != other_fld_const))
+        {
+          if ((DV_TYPE_OF (main_fld_const) != DV_TYPE_OF (other_fld_const)) ||
+            (DVC_MATCH != cmp_boxes (main_fld_const, other_fld_const, NULL, NULL)) )
+              goto disjoin; /* see below */
+        }
+    }
+/* Pessimistic loop */
+  for (fld_ctr = 0; fld_ctr < SPART_TRIPLE_FIELDS_COUNT; fld_ctr++)
+    {
+      ccaddr_t main_fld_const = SPARP_FIELD_CONST_OF_QM(main_qm,fld_ctr);
+      ccaddr_t other_fld_const = SPARP_FIELD_CONST_OF_QM(other_qm,fld_ctr);
+      qm_value_t *main_fld_qmv;
+      qm_value_t *other_fld_qmv;
+      rdf_val_range_t main_rvr, other_rvr;
+      if ((NULL != main_fld_const) && (NULL != other_fld_const))
+        continue; /* consts are compared in the optimistic loop, so either disjoin is found or there's no need to compare equal values again */
+      main_fld_qmv = SPARP_FIELD_QMV_OF_QM(main_qm,fld_ctr);
+      other_fld_qmv = SPARP_FIELD_QMV_OF_QM(other_qm,fld_ctr);
+      rdb2rdf_set_rvr_by_const_or_qmv (rrc, &main_rvr, main_fld_const, main_fld_qmv);
+      rdb2rdf_set_rvr_by_const_or_qmv (rrc, &other_rvr, other_fld_const, other_fld_qmv);
+      sparp_rvr_audit(&(rrc->rrc_sparp_stub), &main_rvr);
+      sparp_rvr_audit(&(rrc->rrc_sparp_stub), &other_rvr);
+      sparp_rvr_tighten (&(rrc->rrc_sparp_stub), &main_rvr, &other_rvr, ~0);
+      if (SPART_VARR_CONFLICT & main_rvr.rvrRestrictions)
+        goto disjoin; /* see below */
+    }
+/* Intersect is by default */
+  rrc->rrc_conflicts_of_qms[main_qm_idx][other_qm_idx] = RDB2RDF_QMQM_INTERSECT;
+  rrc->rrc_conflicts_of_qms[other_qm_idx][main_qm_idx] = RDB2RDF_QMQM_INTERSECT;
+  return;
+
+disjoin:
+  rrc->rrc_conflicts_of_qms[main_qm_idx][other_qm_idx] = RDB2RDF_QMQM_DISJOIN;
+  rrc->rrc_conflicts_of_qms[other_qm_idx][main_qm_idx] = RDB2RDF_QMQM_DISJOIN;
+  return;
+}
+
+void
+ses_print_ruler_10 (dk_session_t *ses, int len, const char *head1, const char *tail1, const char *head2, const char *tail2)
+{
+  char buf[32+1];
+  int ctr;
+  SES_PRINT (ses, head1);
+  for (ctr = 0; ctr < len; ctr += 10)
+    {
+      int rest = (len - ctr);
+      if (rest > 10)
+        {
+          sprintf (buf, "%d          ", ctr / 10);
+          buf [10] = '\0';
+        }
+      else sprintf (buf, "%d", ctr / 10);
+      SES_PRINT (ses, buf);
+    }
+  SES_PRINT (ses, tail1);
+  SES_PRINT (ses, "\n");
+  SES_PRINT (ses, head2);
+  for (ctr = 0; ctr < len; ctr += 10)
+    {
+      int n = (len - ctr);
+      if (n > 10)
+        n = 10;
+      session_buffered_write (ses, "0123456789", n);
+    }
+  SES_PRINT (ses, tail2);
+  SES_PRINT (ses, "\n");
+}
+
+void
+rdb2rdf_ctx_dump (rdb2rdf_ctx_t *rrc, dk_session_t *ses)
+{
+  char buf[20];
+  int main_qm_ctr;
+  ses_print_ruler_10 (ses, rrc->rrc_all_qm_count, "      ", "", "      ", "");
+  for (main_qm_ctr = 0; main_qm_ctr < rrc->rrc_all_qm_count; main_qm_ctr++)
+    {
+#if 0
+      int other_qm_ctr;
+      for (other_qm_ctr = rrc->rrc_all_qm_count; other_qm_ctr--; /* no step */)
+        {
+          if (RDB2RDF_QMQM_NOT_PROVEN == rrc->rrc_conflicts_of_qms [main_qm_index][other_qm_ctr])
+            rdb2rdf_calculate_qmqm (rrc, rro, other_qm_ctr);
+        }
+#endif
+      sprintf (buf, "%.05d ", main_qm_ctr);
+      SES_PRINT (ses, buf); SES_PRINT (ses, rrc->rrc_conflicts_of_qms [main_qm_ctr]); SES_PRINT (ses, "\n");
+    }
+  ses_print_ruler_10 (ses, rrc->rrc_all_qm_count, "      ", "", "      ", "");
+  SES_PRINT (ses, "\n");
+}
+
+void
+rdb2rdf_optree_dump (rdb2rdf_ctx_t *rrc, rdb2rdf_optree_t *rro, dk_session_t *ses)
+{
+  char buf[5000];
+  char buf2[32+1];
+  int sub_qm_rro_ctr;
+  int ctr;
+  rdb2rdf_blocker_t *blockers_tail;
+  sprintf (buf, "-----\n%s optree %d from qm %d, subtree of %d, breakup starts at %d\n",
+    (rro->rro_is_leaf ? "LEAF" : "grouping"),
+    rro->rro_own_serial, rro->rro_qm_index,
+    ((NULL != rro->rro_parent) ? rro->rro_parent->rro_own_serial : -1),
+    ((NULL != rro->rro_breakup_begin) ? rro->rro_breakup_begin->rro_own_serial : -1) );
+  SES_PRINT (ses, buf);
+  if (NULL != rro->rro_qm)
+    {
+      SES_PRINT (ses, "Quad: ");
+      for (ctr = 0; ctr < SPART_TRIPLE_FIELDS_COUNT; ctr++)
+        {
+          ccaddr_t fld_const = SPARP_FIELD_CONST_OF_QM(rro->rro_qm, ctr);
+          if (NULL != fld_const)
+            {
+              switch (DV_TYPE_OF (fld_const))
+                {
+                case DV_UNAME: sprintf (buf, " <%s>", fld_const); SES_PRINT (ses, buf); break;
+                case DV_STRING: sprintf (buf, " '''%s'''", fld_const); SES_PRINT (ses, buf); break;
+                case DV_LONG_INT: sprintf (buf, " " BOXINT_FMT, (boxint)fld_const); SES_PRINT (ses, buf); break;
+                default: SES_PRINT (ses, " const"); break;
+                }
+            }
+          else
+            {
+              sprintf (buf, " ?%c", "GSPO"[ctr]); SES_PRINT (ses, buf);
+            }
+        }
+      SES_PRINT (ses, "\n");
+    }
+  if (rro->rro_is_leaf)
+    {
+      int other_qm_ctr;
+      for (other_qm_ctr = rrc->rrc_all_qm_count; other_qm_ctr--; /* no step */)
+        {
+          if (RDB2RDF_QMQM_NOT_PROVEN == rrc->rrc_conflicts_of_qms [rro->rro_qm_index][other_qm_ctr])
+            rdb2rdf_calculate_qmqm (rrc, rro, other_qm_ctr);
+        }
+      ses_print_ruler_10 (ses, rrc->rrc_all_qm_count, "      ", "", "      ", "");
+      SES_PRINT (ses, "QMQM: "); SES_PRINT (ses, rrc->rrc_conflicts_of_qms [rro->rro_qm_index]); SES_PRINT (ses, "\n");
+    }
+  /*  quad_map_t *rro_qm; */
+  for (blockers_tail = rro->rro_blockers_before_next; (blockers_tail != NULL) && (blockers_tail != rro->rro_blockers_before); blockers_tail = blockers_tail->rrb_next)
+    {
+      int ctr;
+      SES_PRINT (ses, "Adds a breakup");
+      for (ctr = 0; ctr < SPART_TRIPLE_FIELDS_COUNT; ctr++)
+        {
+          ccaddr_t cv = blockers_tail->rrb_const_vals[ctr];
+          if (NULL == cv)
+            continue;
+          sprintf (buf, "  %c = ", "GSPO"[ctr]); SES_PRINT (ses, buf);
+          switch (DV_TYPE_OF (cv))
+            {
+              case DV_STRING: sprintf (buf, "'''%.200s'''", cv); break;
+              case DV_UNAME: sprintf (buf, "<%.200s>", cv); break;
+              case DV_LONG_INT: sprintf (buf, "%ld", (long)(unbox(cv))); break;
+              default: sprintf (buf, "const with tag %d", DV_TYPE_OF (cv)); break;
+            }
+          SES_PRINT (ses, buf);
+        }
+      SES_PRINT (ses, "\n");
+    }
+  SES_PRINT (ses, "Aliases:");
+  DO_SET (caddr_t, a, &rro->rro_aliases_of_main_table)
+    {
+      sprintf (buf, " <%.200s>", a); SES_PRINT (ses, buf);
+    }
+  END_DO_SET()
+  SES_PRINT (ses, "\n");
+  if (NULL != rro->rro_qm)
+    {
+      SES_PRINT (ses, "Keyrefd:");
+      DO_BOX_FAST (ccaddr_t, a, ctr, rro->rro_qm->qmAliasesKeyrefdByQuad)
+        {
+          sprintf (buf, " <%.200s>", a); SES_PRINT (ses, buf);
+        }
+      END_DO_BOX_FAST;
+      SES_PRINT (ses, "\n");
+    }
+  for (ctr = 0; ctr < 32; ctr++)
+    {
+      buf2[ctr] = ((rro->rro_bits_of_fields_here & (1 << ctr)) ?
+        "GSPOGSPOGSPOGSPOGSPOGSPOGSPOGSPO"[ctr] :
+        ((rro->rro_bits_of_fields_here_and_above & (1 << ctr)) ?
+          "gspogspogspogspogspogspogspogspo"[ctr] :
+          "{--}{--}{--}{--}{--}{--}{--}{--}"[ctr] ) );
+    }
+  buf2[4 * (dk_set_length (rro->rro_aliases_of_main_table)+1)] = '\0';
+  sprintf (buf, "Fields here: %s\n", buf2); SES_PRINT (ses, buf);
+  /*  uint32 rro_bits_of_fields_here_and_above; */
+  DO_BOX_FAST (rdb2rdf_optree_t *, sub_qm_rro, sub_qm_rro_ctr, rro->rro_subtrees)
+    rdb2rdf_optree_dump (rrc, sub_qm_rro, ses);
+  END_DO_BOX_FAST;
+}
+
+void
+rdb2rdf_print_fld_expn (rdb2rdf_optree_t *rro, int cast_to_obj, int alias_no, quad_map_t *qm, qm_value_t *fld_qmv, const char *prefix, spar_sqlgen_t *ssg)
+{
+  qm_format_t *fmt = fld_qmv->qmvFormat;
+/*  if (fmt->qmfValRange.rvrRestrictions & SPART_VARR_IS_REF)
+    ssg_puts ("__i2id (");
+  else */ if (cast_to_obj && !(fmt->qmfValRange.rvrRestrictions & SPART_VARR_LONG_EQ_SQL))
+    ssg_puts ("DB.DBA.RDF_OBJ_OF_LONG (");
+  ssg_print_tmpl (ssg, fmt, fmt->qmfLongOfShortTmpl, prefix, fld_qmv, NULL, NULL_ASNAME);
+/*  if (fmt->qmfValRange.rvrRestrictions & SPART_VARR_IS_REF)
+    ssg_putchar (')');
+  else */ if (cast_to_obj && !(fmt->qmfValRange.rvrRestrictions & SPART_VARR_LONG_EQ_SQL))
+    ssg_putchar (')');
+}
+
+void
+rdb2rdf_print_const (rdb2rdf_ctx_t *rrc, ccaddr_t fld_const, spar_sqlgen_t *ssg)
+{
+  if (DV_UNAME == DV_TYPE_OF (fld_const))
+    {
+      ssg_puts ("__i2id (");
+      ssg_print_box_as_sql_atom (ssg, fld_const, SQL_ATOM_UTF8_ONLY);
+      ssg_putchar (')');
+    }
+  else
+    ssg_print_scalar_expn (ssg, (SPART *)fld_const, qm_format_default, NULL);
+}
+
+int
+rdb2rdf_is_delete_conflicting (rdb2rdf_ctx_t *rrc, rdb2rdf_optree_t *rro, ccaddr_t alias)
+{
+  int ctr, found = 0;
+  char *qm_conflicts;
+  int other_qm_ctr;
+  if (NULL != alias)
+    {
+      quad_map_t *qm = rro->rro_qm;
+      DO_BOX_FAST_REV (caddr_t, a, ctr, qm->qmAliasesKeyrefdByQuad)
+        {
+          if (strcmp (a, alias)) continue;
+          found = 1;
+          break;
+        }
+      END_DO_BOX_FAST_REV;
+      if (!found)
+        return 1;
+    }
+  qm_conflicts = rrc->rrc_conflicts_of_qms[rro->rro_qm_index];
+  for (other_qm_ctr = rrc->rrc_all_qm_count; other_qm_ctr--; /* no step */)
+    {
+      if (RDB2RDF_QMQM_INTERSECT == qm_conflicts[other_qm_ctr])
+        return 1;
+    }
+  for (other_qm_ctr = rrc->rrc_all_qm_count; other_qm_ctr--; /* no step */)
+    {
+      if (RDB2RDF_QMQM_NOT_PROVEN == rrc->rrc_conflicts_of_qms [rro->rro_qm_index][other_qm_ctr])
+        rdb2rdf_calculate_qmqm (rrc, rro, other_qm_ctr);
+      if (RDB2RDF_QMQM_INTERSECT == qm_conflicts[other_qm_ctr])
+        return 1;
+    }
+  return 0;
+}
+
+void
+rdb2rdf_calculate_rule_id (rdb2rdf_ctx_t *rrc, rdb2rdf_optree_t *rro)
+{
+  int needs_rule_id = rro->rro_self_multi;
+  int other_qm_ctr;
+  char *qm_conflicts = rrc->rrc_conflicts_of_qms[rro->rro_qm_index];
+  for (other_qm_ctr = rrc->rrc_all_qm_count; other_qm_ctr--; /* no step */)
+    {
+      if (RDB2RDF_QMQM_NOT_PROVEN == rrc->rrc_conflicts_of_qms [rro->rro_qm_index][other_qm_ctr])
+        rdb2rdf_calculate_qmqm (rrc, rro, other_qm_ctr);
+    }
+  if (!needs_rule_id)
+    {
+      for (other_qm_ctr = rrc->rrc_all_qm_count; other_qm_ctr--; /* no step */)
+        {
+          if (RDB2RDF_QMQM_INTERSECT != qm_conflicts[other_qm_ctr])
+            continue;
+          needs_rule_id = 1;
+          break;
+        }
+    }
+  if (!needs_rule_id)
+    {
+      rro->rro_rule_id = -1;
+      return;
+    }
+  rrc->rrc_rule_count++;
+  rro->rro_rule_id = (boxint)((unsigned)(rrc->rrc_rule_id_seed)) * 100000 + rro->rro_qm_index;
+  rro->rro_sample_of_rule = 1;
+  return;
+}
+
+void
+rdb2rdf_qm_after_del_codegen (rdb2rdf_ctx_t *rrc, rdb2rdf_optree_t *rro, ccaddr_t table_name, int opcode, spar_sqlgen_t *ssg)
+{
+  char buf[300];
+  char *qm_conflicts;
+  int need_union = 0;
+  int other_qm_ctr;
+  if (0 == rro->rro_rule_id)
+    rdb2rdf_calculate_rule_id (rrc, rro);
+  if (!rro->rro_sample_of_rule)
+    return;
+  ssg_newline (0);
+  sprintf (buf,
+    "for (select * from DB.DBA.RDF_QUAD_DELETE_QUEUE q where q.EVENT_ID=query_instance_id(1) and RULE_ID=" BOXINT_FMT " and not exists (",
+    rro->rro_rule_id );
+  ssg_puts (buf);
+  ssg->ssg_indent += 2;
+  qm_conflicts = rrc->rrc_conflicts_of_qms[rro->rro_qm_index];
+  ssg_puts ("sparql define input:storage virtrdf:SyncToQuads ask where {");
+  ssg->ssg_indent += 2;
+  for (other_qm_ctr = rrc->rrc_all_qm_count; other_qm_ctr--; /* no step */)
+    {
+      quad_map_t *other_qm = rrc->rrc_all_qms[other_qm_ctr];
+      jso_rtti_t *other_qm_rtti;
+      if ((RDB2RDF_QMQM_INTERSECT != qm_conflicts[other_qm_ctr]) &&
+        !(rro->rro_self_multi && other_qm_ctr == rro->rro_qm_index) )
+        continue;
+      other_qm_rtti = gethash (other_qm, jso_rttis_of_structs);
+      if ((NULL == other_qm_rtti) || (other_qm != other_qm_rtti->jrtti_self))
+        sqlr_new_error ("22023", "SR638", "Some quad maps of quad store virtrdf:SyncToQuads are not loaded or corrupted or being edited during SQL code generation");
+      ssg_newline (0);
+      if (need_union++)
+        ssg_puts ("UNION ");
+      ssg_puts (" { QUAD MAP <");
+      ssg_puts (other_qm_rtti->jrtti_inst_iri);
+      ssg_puts ("> { graph ?:LONG::QG { ?:LONG::QS ?:LONG::QP ?:LONG::QO }}} ");
+    }
+  ssg_puts ("}");
+  ssg->ssg_indent -= 2;
+  ssg_newline (0);
+  ssg_puts (") ) do {\n");
+  ssg_puts ("    if (not __rdf_graph_is_in_enabled_repl (QG))\n");
+  ssg_puts ("      delete from DB.DBA.RDF_QUAD where G=QG and S=QS and P=QP and O=QO option (QUIETCAST);\n"),
+  ssg_puts ("    else if (exists (select top 1 1 from DB.DBA.RDF_QUAD where G=QG and S=QS and P=QP and O=QO option (QUIETCAST)))\n");
+  ssg_puts ("      {\n");
+  ssg_puts ("        declare triples any;\n");
+  ssg_puts ("        triples := vector (vector (QS, QP, QO));\n");
+  ssg_puts ("        DB.DBA.RDF_REPL_DELETE_TRIPLES (id_to_iri (QG), triples);\n");
+  ssg_puts ("        delete from DB.DBA.RDF_QUAD where G=QG and S=QS and P=QP and O=QO option (QUIETCAST);\n"),
+  ssg_puts ("      }\n");
+  ssg_puts ("  }\n");
+  ssg->ssg_indent -= 2;
+  ssg_newline (0);
+  sprintf (buf,
+    "delete from DB.DBA.RDF_QUAD_DELETE_QUEUE q where q.EVENT_ID=query_instance_id(1) and RULE_ID=" BOXINT_FMT ";",
+    rro->rro_rule_id );
+  ssg_puts (buf);
+}
+
+
+void
+rdb2rdf_qm_codegen (rdb2rdf_ctx_t *rrc, rdb2rdf_optree_t *rro, caddr_t table_name, int opcode, int subopcode, const char *prefix, ccaddr_t alias, int alias_no, spar_sqlgen_t *ssg)
+{
+  int fld_ctr, cond_ctr;
+  int need_comma, alias_ctr;
+  int out_of_loop_ifs_for_blockers = 0;
+  unsigned int bits_of_fields_here;
+  unsigned int bits_of_fields_above;
+  boxint two_phase_delete = 0;
+  quad_map_t *qm = rro->rro_qm;
+  char buf[300];
+  static const char *x_vals[4] = {"g_val", "s_val", "p_val", "o_val"};
+  static const char *x_locals[4] = {"g_local", "s_local", "p_local", "o_local"};
+#ifndef NDEBUG
+  if (RDB2RDF_CODEGEN_SUB_AFTER_DEL == subopcode)
+    GPF_T;
+#endif
+  bits_of_fields_here = ((rro->rro_bits_of_fields_here >> (alias_no * 4)) & 0xF);
+  bits_of_fields_above = (NULL == rro->rro_parent) ? 0 : ((rro->rro_parent->rro_bits_of_fields_here_and_above >> (alias_no * 4)) & 0xF);
+  ssg->ssg_alias_to_search = alias;
+  ssg->ssg_alias_to_replace = prefix;
+  if (RDB2RDF_CODEGEN_SUB_BEFORE_DEL == subopcode)
+    {
+      two_phase_delete = rdb2rdf_is_delete_conflicting (rrc, rro, alias);
+      if (two_phase_delete)
+        {
+          if (0 == rro->rro_rule_id)
+            rdb2rdf_calculate_rule_id (rrc, rro);
+          if (0 > rro->rro_rule_id)
+            RDB2RDF_INTERNAL_ERROR;
+        }
+    }
+/* First of all we set "variable" fields because they can add IFs for blockers */
+  for (fld_ctr = SPART_TRIPLE_FIELDS_COUNT; fld_ctr--; /* no step*/)
+    {
+      qm_value_t *fld_qmv = SPARP_FIELD_QMV_OF_QM(qm,fld_ctr);
+      ccaddr_t fld_const = SPARP_FIELD_CONST_OF_QM(qm,fld_ctr);
+      ccaddr_t *rvvs_jso_ptr = rrc->rrc_rrvs_stack->rrvs_jsos + fld_ctr;
+      rdb2rdf_blocker_t *rrb_iter;
+      if (!(bits_of_fields_here & (1 << fld_ctr)))
+        continue;
+      if (bits_of_fields_above & (1 << fld_ctr))
+        continue;
+      if (NULL != fld_const)
+        continue;
+      if (rvvs_jso_ptr[0] == (void *)fld_qmv)
+        continue;
+      ssg_newline (0);
+      ssg_putchar ("gspo"[fld_ctr]); ssg_puts ("_val := ");
+      rdb2rdf_print_fld_expn (rro, (RDB2RDF_CODEGEN_SUB_BEFORE_DEL == subopcode), alias_no, qm, fld_qmv, prefix, ssg);
+      ssg_putchar (';');
+      rvvs_jso_ptr[0] = (void *)fld_qmv;
+      for (rrb_iter = rro->rro_blockers_before_next; rrb_iter != rro->rro_blockers_before ; rrb_iter = rrb_iter->rrb_next)
+        {
+          ccaddr_t rrb_c = rrb_iter->rrb_const_vals [fld_ctr];
+          if (NULL == rrb_c)
+            continue;
+          ssg_newline (0);
+          ssg_puts ("if ("); ssg_putchar ("gspo"[fld_ctr]); ssg_puts ("_val != ");
+          rdb2rdf_print_const (rrc, rrb_c, ssg);
+          ssg_puts (") {");
+          ssg->ssg_indent++;
+          rdb2rdf_push_rrvs_stack (rrc);
+          out_of_loop_ifs_for_blockers++;
+        }
+    }
+/* Now a similar loop deals with consts. Blockers are not checked here hecause they've inspected when optree is composed. */
+  for (fld_ctr = SPART_TRIPLE_FIELDS_COUNT; fld_ctr--; /* no step*/)
+    {
+      ccaddr_t fld_const = SPARP_FIELD_CONST_OF_QM(qm,fld_ctr);
+      ccaddr_t *rvvs_jso_ptr = rrc->rrc_rrvs_stack->rrvs_jsos + fld_ctr;
+      if (!(bits_of_fields_here & (1 << fld_ctr)))
+        continue;
+      if (bits_of_fields_above & (1 << fld_ctr))
+        continue;
+      if (NULL == fld_const)
+        continue;
+      if ((0 != alias_no) && (RDB2RDF_MAX_ALIASES_OF_MAIN_TABLE != alias_no))
+        continue;
+      if ((NULL != rvvs_jso_ptr[0]) && (DV_ARRAY_OF_POINTER != DV_TYPE_OF (rvvs_jso_ptr[0])) &&
+        (DVC_MATCH == cmp_boxes (rvvs_jso_ptr[0], fld_const, NULL, NULL)) )
+      continue;
+      ssg_newline (0);
+      ssg_putchar ("gspo"[fld_ctr]); ssg_puts ("_val := ");
+      rdb2rdf_print_const (rrc, fld_const, ssg);
+      ssg_putchar (';');
+      rvvs_jso_ptr[0] = fld_const;
+    }
+  if ((1 == dk_set_length (rro->rro_aliases_of_main_table)) &&
+    (1 == rro->rro_qm->qmAllATableUseCount) &&
+    (0xF == bits_of_fields_here) ) /* i.e. all fields are set, no inner loop */
+    {
+      int cond_ctr = 0;
+      ssg_newline (0);
+      ssg->ssg_where_l_printed = 0;
+      ssg->ssg_where_l_text = "if (";
+      for (fld_ctr = SPART_TRIPLE_FIELDS_COUNT; fld_ctr--; /* no step*/)
+        {
+          qm_value_t *fld_qmv = SPARP_FIELD_QMV_OF_QM(qm,fld_ctr);
+          if (NULL == fld_qmv)
+            continue;
+          if (SPART_VARR_NOT_NULL & fld_qmv->qmvRange.rvrRestrictions)
+            continue;
+          ssg_print_where_or_and (ssg, "nullable col check");
+          ssg_putchar ("gspo"[fld_ctr]); ssg_puts ("_val is not null");
+        }
+      for (cond_ctr = 0; cond_ctr < qm->qmAllCondCount; cond_ctr++)
+        {
+          ccaddr_t cond = qm->qmAllConds[cond_ctr];
+          ssg_print_where_or_and (ssg, "filter of quad map");
+          ssg_print_tmpl (ssg, NULL, cond, prefix, NULL, NULL, NULL_ASNAME);
+        }
+      if (ssg->ssg_where_l_printed)
+        {
+          ssg_puts (") ");
+          ssg->ssg_indent++;
+          ssg_newline (0);
+        }
+      if (two_phase_delete)
+        {
+          char buf[300];
+          if (RDB2RDF_CODEGEN_SUB_BEFORE_DEL != subopcode)
+            GPF_T;
+          sprintf (buf,
+            "insert soft DB.DBA.RDF_QUAD_DELETE_QUEUE (EVENT_ID,RULE_ID,QG,QS,QP,QO) values (query_instance_id(1), " BOXINT_FMT ", g_val, s_val, p_val, o_val);",
+            rro->rro_rule_id );
+          ssg_puts (buf);
+        }
+      else if (RDB2RDF_CODEGEN_SUB_BEFORE_DEL == subopcode)
+        {
+#if 0
+          ssg_puts ("delete from DB.DBA.RDF_QUAD where G=g_val and S=s_val and P=p_val and O=o_val;");
+#else
+          ssg_puts ("    if (not __rdf_graph_is_in_enabled_repl (g_val))\n");
+          ssg_puts ("      delete from DB.DBA.RDF_QUAD where G=g_val and S=s_val and P=p_val and O=o_val option (QUIETCAST);\n"),
+          ssg_puts ("    else if (exists (select top 1 1 from DB.DBA.RDF_QUAD where G=g_val and S=s_val and P=p_val and O=o_val option (QUIETCAST)))\n");
+          ssg_puts ("      {\n");
+          ssg_puts ("        declare triples any;\n");
+          ssg_puts ("        triples := vector (vector (s_val, p_val, o_val));\n");
+          ssg_puts ("        DB.DBA.RDF_REPL_DELETE_TRIPLES (id_to_iri (g_val), triples);\n");
+          ssg_puts ("        delete from DB.DBA.RDF_QUAD where G=g_val and S=s_val and P=p_val and O=o_val option (QUIETCAST);\n"),
+          ssg_puts ("      }\n");
+#endif
+        }
+      else
+#if 0
+        ssg_puts ("insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_val, s_val, p_val, o_val);");
+#else
+        ssg_puts ("DB.DBA.RDF_QUAD_L_RDB2RDF (g_val, s_val, p_val, o_val, old_g_iid, ro_id_dict);");
+#endif
+      if (ssg->ssg_where_l_printed)
+        ssg->ssg_indent--;
+      goto close_out_of_loop_ifs_for_blockers; /* see below */
+    }
+  ssg_newline (0);
+  ssg_puts ("for (select ");
+  ssg->ssg_indent++;
+  need_comma = 0;
+  for (fld_ctr = SPART_TRIPLE_FIELDS_COUNT; fld_ctr--; /* no step*/)
+    {
+      qm_value_t *fld_qmv = SPARP_FIELD_QMV_OF_QM(qm,fld_ctr);
+      if (NULL == fld_qmv)
+        continue;
+      if (bits_of_fields_here & (1 << fld_ctr))
+        continue;
+      if (need_comma++)
+        ssg_putchar (',');
+      ssg_newline (0);
+      rdb2rdf_print_fld_expn (rro, (RDB2RDF_CODEGEN_SUB_BEFORE_DEL == subopcode), alias_no, qm, fld_qmv, prefix, ssg);
+      ssg_puts (" as "); ssg_putchar ("gspo"[fld_ctr]); ssg_puts ("_local");
+    }
+  if (need_comma)
+    ssg_newline (0);
+  else
+    ssg_puts (" TOP 1 1 as RDB2RDF_STUB ");
+  ssg_puts ("FROM ");
+  need_comma = 0;
+  for (alias_ctr = 0; alias_ctr < qm->qmAllATableUseCount; alias_ctr++)
+    {
+      qm_atable_use_t *qmatu = ((qm_atable_use_t *)qm->qmAllATableUses) + alias_ctr;
+      ccaddr_t tblalias = qmatu->qmatu_alias;
+      if (!strcmp (((NULL == tblalias) ? "" : tblalias), ((NULL == alias) ? "" : alias)))
+        continue;
+      if (need_comma++)
+        ssg_putchar (',');
+      ssg_puts (qmatu->qmatu_tablename);
+      ssg_puts (" AS ");
+      ssg_prin_subalias (ssg, prefix, tblalias, 0);
+    }
+  ssg_newline (0);
+  ssg->ssg_where_l_printed = 0;
+  ssg->ssg_where_l_text = " WHERE ";
+  for (cond_ctr = 0; cond_ctr < qm->qmAllCondCount; cond_ctr++)
+    {
+      ccaddr_t cond = qm->qmAllConds[cond_ctr];
+      ssg_print_where_or_and (ssg, "inter-alias join cond or fitler");
+      ssg_print_tmpl (ssg, NULL, cond, prefix, NULL, NULL, NULL_ASNAME);
+    }
+  for (fld_ctr = SPART_TRIPLE_FIELDS_COUNT; fld_ctr--; /* no step*/)
+    {
+      qm_value_t *fld_qmv = SPARP_FIELD_QMV_OF_QM(qm,fld_ctr);
+      if (NULL == fld_qmv)
+        continue;
+      if (SPART_VARR_NOT_NULL & fld_qmv->qmvRange.rvrRestrictions)
+        continue;
+      ssg_print_where_or_and (ssg, "non-null cond");
+      if (bits_of_fields_here & (1 << fld_ctr))
+        {
+          ssg_putchar ("gspo"[fld_ctr]); ssg_puts ("_val is not null");
+        }
+      else
+        {
+          ssg_putchar ('(');
+          ssg->ssg_indent++;
+          rdb2rdf_print_fld_expn (rro, (RDB2RDF_CODEGEN_SUB_BEFORE_DEL == subopcode), alias_no, qm, fld_qmv, prefix, ssg);
+          ssg_putchar (')');
+          ssg->ssg_indent--;
+          ssg_puts (" is not null");
+        }
+    }
+  ssg_puts (") do");
+  ssg_newline (0);
+  ssg_putchar ('{');
+  ssg->ssg_indent++;
+  ssg_newline (0);
+#define NTH_FLD(n) ((bits_of_fields_here & (1 << (n))) ? x_vals[n] : x_locals[n])
+  if (two_phase_delete)
+    {
+      if (RDB2RDF_CODEGEN_SUB_BEFORE_DEL != subopcode)
+        GPF_T;
+      sprintf (buf,
+        "insert soft DB.DBA.RDF_QUAD_DELETE_QUEUE (EVENT_ID,RULE_ID,QG,QS,QP,QO) values (query_instance_id(1), " BOXINT_FMT ", %s, %s, %s, %s);",
+        rro->rro_rule_id, NTH_FLD(0), NTH_FLD(1), NTH_FLD(2), NTH_FLD(3) );
+      ssg_puts (buf);
+    }
+  else if (RDB2RDF_CODEGEN_SUB_BEFORE_DEL == subopcode)
+    {
+#if 0
+      ssg_puts ("delete from DB.DBA.RDF_QUAD where ");
+      for (fld_ctr = 0; fld_ctr < SPART_TRIPLE_FIELDS_COUNT; fld_ctr++)
+        {
+          if (fld_ctr) ssg_puts (" and ");
+          ssg_putchar ("GSPO"[fld_ctr]);
+          ssg_puts (" = ");
+          ssg_putchar ("gspo"[fld_ctr]);
+          if (bits_of_fields_here & (1 << fld_ctr))
+            ssg_puts ("_val");
+          else
+            ssg_puts ("_local");
+        }
+      ssg_puts (";");
+#else
+      sprintf (buf, "    if (not __rdf_graph_is_in_enabled_repl (%s))\n", NTH_FLD(0));
+      ssg_puts (buf);
+      sprintf (buf, "      delete from DB.DBA.RDF_QUAD where G=%s and S=%s and P=%s and O=%s option (QUIETCAST);\n",
+        NTH_FLD(0), NTH_FLD(1), NTH_FLD(2), NTH_FLD(3) );
+      ssg_puts (buf);
+      sprintf (buf, "    else if (exists (select top 1 1 from DB.DBA.RDF_QUAD where G=%s and S=%s and P=%s and O=%s option (QUIETCAST)))\n",
+        NTH_FLD(0), NTH_FLD(1), NTH_FLD(2), NTH_FLD(3) );
+      ssg_puts (buf);
+      ssg_puts ("      {\n");
+      ssg_puts ("        declare triples any;\n");
+      sprintf (buf, "        triples := vector (vector (%s, %s, %s));\n", NTH_FLD(1), NTH_FLD(2), NTH_FLD(3)); ssg_puts (buf);
+      sprintf (buf, "        DB.DBA.RDF_REPL_DELETE_TRIPLES (id_to_iri (%s), triples);\n", NTH_FLD(0));
+      ssg_puts (buf);
+      sprintf (buf, "        delete from DB.DBA.RDF_QUAD where G=%s and S=%s and P=%s and O=%s option (QUIETCAST);\n",
+        NTH_FLD(0), NTH_FLD(1), NTH_FLD(2), NTH_FLD(3) ); ssg_puts (buf);
+      ssg_puts ("      }\n");
+#endif
+    }
+  else
+    {
+#if 0
+      ssg_puts ("insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (");
+#else
+      ssg_puts ("DB.DBA.RDF_QUAD_L_RDB2RDF (");
+#endif
+      for (fld_ctr = 0; fld_ctr < SPART_TRIPLE_FIELDS_COUNT; fld_ctr++)
+        {
+          if (fld_ctr) ssg_putchar (',');
+          ssg_putchar ("gspo"[fld_ctr]);
+          if (bits_of_fields_here & (1 << fld_ctr))
+            ssg_puts ("_val");
+          else
+            ssg_puts ("_local");
+        }
+#if 0
+      ssg_puts (");");
+#else
+      ssg_puts (", old_g_iid, ro_id_dict);");
+#endif
+    }
+  ssg->ssg_indent--;
+  ssg_newline (0);
+  ssg_putchar ('}');
+  ssg->ssg_indent--;
+
+close_out_of_loop_ifs_for_blockers:
+  while (out_of_loop_ifs_for_blockers--)
+    {
+      ssg->ssg_indent--;
+      ssg_newline(0);
+      ssg_putchar ('}');
+      rdb2rdf_pop_rrvs_stack (rrc, 0);
+    }
+}
+
+void
+rdb2rdf_optree_codegen (rdb2rdf_ctx_t *rrc, rdb2rdf_optree_t *rro, caddr_t table_name, int opcode, int subopcode, const char *prefix, spar_sqlgen_t *ssg)
+{
+  int alias_no, sub_qm_rro_ctr;
+  int single_use_of_single_main;
+  if (!rro->rro_is_leaf)
+    goto do_subtrees; /* see below */
+  single_use_of_single_main = ((1 == dk_set_length (rro->rro_aliases_of_main_table)) && (1 == rro->rro_qm->qmAllATableUseCount));
+  switch (subopcode)
+    {
+    case RDB2RDF_CODEGEN_INITIAL_SUB_SINGLE:
+      if (single_use_of_single_main)
+        rdb2rdf_qm_codegen (rrc, rro, table_name, opcode, subopcode, prefix, rro->rro_aliases_of_main_table->data, 0, ssg);
+      break;
+    case RDB2RDF_CODEGEN_INITIAL_SUB_MULTI:
+      if (!single_use_of_single_main)
+        rdb2rdf_qm_codegen (rrc, rro, table_name, opcode, subopcode, prefix, "-no-such-", RDB2RDF_MAX_ALIASES_OF_MAIN_TABLE, ssg);
+      break;
+    case RDB2RDF_CODEGEN_SUB_AFTER_DEL:
+      rdb2rdf_qm_after_del_codegen (rrc, rro, table_name, opcode, ssg);
+      break;
+    default:
+      alias_no = 0;
+      DO_SET (ccaddr_t, alias, &(rro->rro_aliases_of_main_table))
+        {
+          rdb2rdf_qm_codegen (rrc, rro, table_name, opcode, subopcode, prefix, alias, alias_no, ssg);
+          alias_no++;
+        }
+      END_DO_SET()
+      break;
+    }
+do_subtrees:
+  DO_BOX_FAST (rdb2rdf_optree_t *, sub_qm_rro, sub_qm_rro_ctr, rro->rro_subtrees)
+    rdb2rdf_optree_codegen (rrc, sub_qm_rro, table_name, opcode, subopcode, prefix, ssg);
+  END_DO_BOX_FAST;
+}
+
+void
+rdb2rdf_print_body_begin (spar_sqlgen_t *ssg, int inserts_are_possible)
+{
+  ssg_puts ("{\n");
+  ssg->ssg_indent = 1;
+  ssg_puts ("  declare g_val, s_val, p_val, o_val any;\n");
+  if (inserts_are_possible)
+    ssg_puts ("  declare old_g_iid, ro_id_dict any;\n");
+  ssg_puts ("  declare exit handler for sqlstate '*' {\n");
+  ssg_puts ("      dbg_obj_princ ('RDB2RDF trigger fail: ', __SQL_STATE, ': ', __SQL_MESSAGE);\n");
+  if (inserts_are_possible)
+    ssg_puts ("      if (dict_size (ro_id_dict)) DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH (old_g_iid, ro_id_dict);\n");
+  ssg_puts ("      resignal;\n };\n");
+  ssg_puts ("  declare exit handler for sqlstate '*' { dbg_obj_princ ('RDB2RDF trigger fail: ', __SQL_STATE, ': ', __SQL_MESSAGE); resignal; };\n");
+  if (inserts_are_possible)
+    {
+      ssg_puts ("  old_g_iid := #i0;\n");
+      ssg_puts ("  ro_id_dict := null;\n");
+    }
+}
+
+void
+rdb2rdf_print_body_end (spar_sqlgen_t *ssg, int inserts_are_possible)
+{
+  ssg_puts ("\n");
+  if (inserts_are_possible)
+    ssg_puts ("  if (dict_size (ro_id_dict)) DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH (old_g_iid, ro_id_dict);\n");
+  ssg_puts ("}\n");
+}
+
+int
+rdb2rdf_codegen (rdb2rdf_ctx_t *rrc, caddr_t table_name, int opcode, dk_session_t *ses)
+{
+  spar_sqlgen_t ssg_place;
+  spar_sqlgen_t *ssg = &ssg_place;
+  caddr_t table_name_for_proc;
+  caddr_t table_name_in_quotes;
+  char *tail;
+  int second_opcode = 0;
+  int table_name_contains_quotes = 0;
+  memset (ssg, 0, sizeof (spar_sqlgen_t));
+  ssg->ssg_out = ses;
+  rdb2rdf_reset_rrvs_stack (rrc);
+  table_name_for_proc = t_box_copy (table_name);
+  for (tail = table_name_for_proc; '\0' != tail[0]; tail++)
+    {
+      switch (tail[0])
+        {
+        case '.': tail[0] = '~'; continue;
+        case '"': tail[0] = '`'; table_name_contains_quotes++; continue;
+        }
+    }
+  if (table_name_contains_quotes)
+    table_name_in_quotes = table_name;
+  else
+    table_name_in_quotes = t_box_sprintf (3 + strlen (table_name), "\"%s\"", table_name);
+  switch (opcode)
+    {
+    case RDB2RDF_CODEGEN_INITIAL:
+      ssg_puts ("create procedure DB.DBA.\"RDB2RDF_FILL__"); ssg_puts (table_name_for_proc); ssg_puts ("\" ()\n");
+      rdb2rdf_print_body_begin (ssg, 1);
+      ssg_puts ("  for (select * from "); ssg_puts (table_name); ssg_puts (") do\n");
+      ssg_puts ("    {\n");
+      ssg->ssg_indent = 3;
+      rdb2rdf_push_rrvs_stack (rrc);
+      rdb2rdf_optree_codegen (rrc, &(rrc->rrc_root_rro), table_name, opcode, RDB2RDF_CODEGEN_INITIAL_SUB_SINGLE, NULL, ssg);
+      ssg_puts ("\n      ;\n");
+      ssg_puts ("\n    }\n");
+      ssg->ssg_indent = 1;
+      rdb2rdf_pop_rrvs_stack (rrc, 0);
+      rdb2rdf_optree_codegen (rrc, &(rrc->rrc_root_rro), table_name, opcode, RDB2RDF_CODEGEN_INITIAL_SUB_MULTI, NULL, ssg);
+      rdb2rdf_print_body_end (ssg, 1);
+      break;
+    case RDB2RDF_CODEGEN_AFTER_INSERT:
+      ssg_puts ("create trigger \"RDB2RDF_AI__"); ssg_puts (table_name_for_proc); ssg_puts ("\" after insert on "); ssg_puts (table_name_in_quotes); ssg_puts (" referencing new as \"RDF2RDB_N\"\n");
+      rdb2rdf_print_body_begin (ssg, 1);
+      rdb2rdf_optree_codegen (rrc, &(rrc->rrc_root_rro), table_name, opcode, RDB2RDF_CODEGEN_SUB_INS, "RDF2RDB_N", ssg);
+      rdb2rdf_print_body_end (ssg, 1);
+      break;
+    case RDB2RDF_CODEGEN_BEFORE_UPDATE:
+      ssg_puts ("create trigger \"RDB2RDF_BU__"); ssg_puts (table_name_for_proc); ssg_puts ("\" before update on "); ssg_puts (table_name_in_quotes); ssg_puts (" referencing new as \"RDF2RDB_N\", old as \"RDF2RDB_O\"\n");
+      rdb2rdf_print_body_begin (ssg, 0);
+      rdb2rdf_optree_codegen (rrc, &(rrc->rrc_root_rro), table_name, opcode, RDB2RDF_CODEGEN_SUB_BEFORE_DEL, "RDF2RDB_O", ssg);
+      rdb2rdf_print_body_end (ssg, 0);
+      break;
+    case RDB2RDF_CODEGEN_AFTER_UPDATE:
+      ssg_puts ("create trigger \"RDB2RDF_AU__"); ssg_puts (table_name_for_proc); ssg_puts ("\" after update on "); ssg_puts (table_name_in_quotes); ssg_puts (" referencing new as \"RDF2RDB_N\", old as \"RDF2RDB_O\"\n");
+      rdb2rdf_print_body_begin (ssg, 1);
+      rdb2rdf_optree_codegen (rrc, &(rrc->rrc_root_rro), table_name, opcode, RDB2RDF_CODEGEN_SUB_AFTER_DEL, "RDF2RDB_O", ssg);
+      rdb2rdf_optree_codegen (rrc, &(rrc->rrc_root_rro), table_name, opcode, RDB2RDF_CODEGEN_SUB_INS, "RDF2RDB_N", ssg);
+      rdb2rdf_print_body_end (ssg, 1);
+      second_opcode = RDB2RDF_CODEGEN_BEFORE_UPDATE;
+      break;
+    case RDB2RDF_CODEGEN_BEFORE_DELETE:
+      ssg_puts ("create trigger \"RDB2RDF_BD__"); ssg_puts (table_name_for_proc); ssg_puts ("\" before delete on "); ssg_puts (table_name_in_quotes); ssg_puts (" referencing old as \"RDF2RDB_O\"\n");
+      rdb2rdf_print_body_begin (ssg, 0);
+      rdb2rdf_optree_codegen (rrc, &(rrc->rrc_root_rro), table_name, opcode, RDB2RDF_CODEGEN_SUB_BEFORE_DEL, "RDF2RDB_O", ssg);
+      rdb2rdf_print_body_end (ssg, 0);
+      if (rrc->rrc_rule_count)
+        second_opcode = RDB2RDF_CODEGEN_AFTER_DELETE;
+      break;
+    case RDB2RDF_CODEGEN_AFTER_DELETE:
+      ssg_puts ("create trigger \"RDB2RDF_AD__"); ssg_puts (table_name_for_proc); ssg_puts ("\" after delete on "); ssg_puts (table_name_in_quotes); ssg_puts (" referencing old as \"RDF2RDB_O\"\n");
+      rdb2rdf_print_body_begin (ssg, 0);
+      rdb2rdf_optree_codegen (rrc, &(rrc->rrc_root_rro), table_name, opcode, RDB2RDF_CODEGEN_SUB_AFTER_DEL, "RDF2RDB_O", ssg);
+      rdb2rdf_print_body_end (ssg, 0);
+      break;
+    }
+  rdb2rdf_pop_rrvs_stack (rrc, 1);
+  return second_opcode;
+}
+
+void
+rdb2rdf_init_conflicts (rdb2rdf_ctx_t *rrc)
+{
+  int main_qm_ctr, other_qm_ctr, fld_ctr;
+  rrc->rrc_all_qms = (quad_map_t **)t_revlist_to_array (rrc->rrc_qm_revlist);
+  rrc->rrc_conflicts_of_qms = (char **)t_alloc_box (rrc->rrc_all_qm_count * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
+  for (main_qm_ctr = rrc->rrc_all_qm_count; main_qm_ctr--; /* no step */)
+    {
+      rrc->rrc_conflicts_of_qms[main_qm_ctr] = t_alloc_box (rrc->rrc_all_qm_count + 1, DV_ARRAY_OF_POINTER);
+      memset (rrc->rrc_conflicts_of_qms[main_qm_ctr], RDB2RDF_QMQM_NOT_PROVEN, rrc->rrc_all_qm_count);
+      rrc->rrc_conflicts_of_qms[main_qm_ctr][rrc->rrc_all_qm_count] = '\0';
+      rrc->rrc_conflicts_of_qms[main_qm_ctr][main_qm_ctr] = RDB2RDF_QMQM_SELF;
+    }
+  for (main_qm_ctr = rrc->rrc_all_qm_count; main_qm_ctr--; /* no step */)
+    {
+      quad_map_t *qm = rrc->rrc_all_qms[main_qm_ctr];
+      char *main_qm_conflicts = rrc->rrc_conflicts_of_qms[main_qm_ctr];
+      for (fld_ctr = 0; fld_ctr < SPART_TRIPLE_FIELDS_COUNT; fld_ctr++)
+        {
+          qm_value_t *fld_qmv = SPARP_FIELD_QMV_OF_QM(qm,fld_ctr);
+          ccaddr_t fld_const = SPARP_FIELD_CONST_OF_QM(qm,fld_ctr);
+          if ((NULL == fld_qmv) && (NULL == fld_const))
+            {
+              memset (main_qm_conflicts, RDB2RDF_QMQM_GROUPING, rrc->rrc_all_qm_count);
+              for (other_qm_ctr = rrc->rrc_all_qm_count; other_qm_ctr--; /* no step */)
+                rrc->rrc_conflicts_of_qms[other_qm_ctr][main_qm_ctr] = RDB2RDF_QMQM_GROUPING;
+              goto next_qm; /* see below */
+            }
+        }
+      for (other_qm_ctr = main_qm_ctr; other_qm_ctr--; /* no step */)
+        {
+          if (qm != rrc->rrc_all_qms[other_qm_ctr])
+          continue;
+          main_qm_conflicts[other_qm_ctr] = RDB2RDF_QMQM_WEIRD_SELF;
+          rrc->rrc_conflicts_of_qms[other_qm_ctr][main_qm_ctr] = RDB2RDF_QMQM_WEIRD_SELF;
+        }
+next_qm: ;
+    }
+}
+
+caddr_t
+bif_sparql_rdb2rdf_impl (caddr_t * qst, caddr_t table_name, int opcode, int rule_id_seed, int only_list_tables)
+{
+  caddr_t storage_name = uname_virtrdf_ns_uri_SyncToQuads;
+  quad_storage_t *storage = sparp_find_storage_by_name (storage_name);
+  caddr_t result = NULL;
+  dk_session_t *ses1 = NULL;
+  dk_session_t *ses2 = NULL;
+
+  if (NULL == storage)
+    sqlr_new_error ("22023", "SR639", "Quad storage <%.500s> does not exist or unusable", storage_name);
+  MP_START ();
+  QR_RESET_CTX
+    {
+      dk_set_t subtrees = NULL;
+      int qm_ctr;
+      rdb2rdf_ctx_t rrc;
+      rdb2rdf_optree_t *prev_top_rro = NULL;
+      memset (&rrc, 0, sizeof (rdb2rdf_ctx_t));
+      rrc.rrc_rule_id_seed = rule_id_seed;
+      DO_BOX_FAST (quad_map_t *, qm, qm_ctr, storage->qsUserMaps)
+        {
+          rdb2rdf_optree_t *qm_rro = rdb2rdf_create_optree (&rrc, &(rrc.rrc_root_rro), prev_top_rro, qm, table_name);
+          if (NULL == qm_rro)
+            continue;
+          t_set_push (&subtrees, qm_rro);
+          prev_top_rro = qm_rro;
+          if ((NULL != qm_rro->rro_blockers_before_next) && qm_rro->rro_blockers_before_next->rrb_total_eclipse)
+            break;
+        }
+      END_DO_BOX_FAST;
+      rrc.rrc_root_rro.rro_subtrees = (rdb2rdf_optree_t **)t_revlist_to_array (subtrees);
+      if (only_list_tables)
+        {
+          dk_set_t tables = NULL;
+          rdb2rdf_list_tables (&(rrc.rrc_root_rro), &tables);
+          result = revlist_to_array (tables);
+        }
+      else
+        {
+          if (RDB2RDF_CODEGEN_AFTER_INSERT != opcode)
+            rdb2rdf_init_conflicts (&rrc);
+          ses1 = strses_allocate ();
+          switch (opcode)
+            {
+            case RDB2RDF_CODEGEN_EXPLAIN:
+              rdb2rdf_optree_dump (&rrc, &(rrc.rrc_root_rro), ses1);
+              rdb2rdf_ctx_dump (&rrc, ses1); /* After optree dump to fill in qmqm_conflicts */
+              result = (caddr_t)ses1;
+              ses1 = NULL;
+              break;
+            default:
+              {
+                int second_opcode = rdb2rdf_codegen (&rrc, table_name, opcode, ses1);
+                if (second_opcode)
+                  {
+                    ses2 = strses_allocate ();
+                    rdb2rdf_codegen (&rrc, table_name, second_opcode, ses2);
+                    result = list (2, ses1, ses2);
+                    ses2 = NULL;
+                  }
+                else
+                  {
+                    result = (caddr_t)ses1;
+                  }
+                ses1 = NULL;
+                break;
+              }
+            }
+        }
+    }
+  QR_RESET_CODE
+    {
+      du_thread_t *self = THREAD_CURRENT_THREAD;
+      caddr_t err = thr_get_error_code (self);
+      thr_set_error_code (self, NULL);
+      POP_QR_RESET;
+      MP_DONE ();
+      dk_free_box ((caddr_t)ses1);
+      dk_free_box ((caddr_t)ses2);
+      dk_free_box (result);
+      sqlr_resignal (err);
+    }
+  END_QR_RESET
+  MP_DONE ();
+  return result;
+}
+
+caddr_t
+bif_sparql_rdb2rdf_codegen (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args, const char *fname)
+{
+  caddr_t table_name = bif_string_arg (qst, args, 0, "sparql_rdb2rdf_codegen");
+  int opcode = bif_long_range_arg (qst, args, 1, "sparql_rdb2rdf_codegen", RDB2RDF_CODEGEN_EXPLAIN, COUNTOF__RDB2RDF_CODEGEN);
+  int rule_id_seed = (3 <= BOX_ELEMENTS (args)) ?
+    bif_long_arg (qst, args, 2, "sparql_rdb2rdf_codegen") :
+    (adler32_of_buffer (table_name, box_length (table_name)-1) ^ opcode);
+  return bif_sparql_rdb2rdf_impl (qst, table_name, opcode, rule_id_seed, 0);
+}
+
+caddr_t
+bif_sparql_rdb2rdf_list_tables (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args, const char *fname)
+{
+  int opcode = bif_long_range_arg (qst, args, 0, "sparql_rdb2rdf_list_tables", RDB2RDF_CODEGEN_EXPLAIN, COUNTOF__RDB2RDF_CODEGEN);
+  return bif_sparql_rdb2rdf_impl (qst, NULL, opcode, 0 /*fake*/, 1);
+}
diff --git a/libsrc/Wi/sparql_sff.c b/libsrc/Wi/sparql_sff.c
index 6d01029..fdec2e1 100644
--- a/libsrc/Wi/sparql_sff.c
+++ b/libsrc/Wi/sparql_sff.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: sparql_sff.c,v 1.19.2.2 2009/08/20 18:01:00 source Exp $
+ *  $Id: sparql_sff.c,v 1.19.2.4 2011/02/04 15:36:04 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -60,7 +60,7 @@ sprintff_is_proven_bijection (const char *f)
       if ('{' == tail[1])
         {
           tail += 2;
-          while (isalnum (tail[0]) || ('_' == tail[0])) tail++;
+          while (isalnum ((unsigned char) (tail[0])) || ('_' == tail[0])) tail++;
           if ('}' != tail[0])
             return 0; /* Syntax error in placeholder for connection variable so the bijection is not proven */
           if (NULL == strchr ("Us", tail[1]))
@@ -127,7 +127,7 @@ sprintff_is_proven_unparseable (const char *f)
       if ('{' == tail[1])
         {
           tail += 2;
-          while (isalnum (tail[0]) || ('_' == tail[0])) tail++;
+          while (isalnum ((unsigned char) (tail[0])) || ('_' == tail[0])) tail++;
           if ('}' != tail[0])
             return 1; /* Syntax error in placeholder for connection variable so it's proven to be unparseable */
           if (NULL == strchr ("Us", tail[1]))
@@ -434,7 +434,7 @@ again:
       if ('{' == f1_tail[0])
         {
           f1_tail++;
-          while (isalnum (f1_tail[0]) || ('_' == f1_tail[0])) f1_tail++;
+          while (isalnum ((unsigned char) (f1_tail[0])) || ('_' == f1_tail[0])) f1_tail++;
           if ('}' != f1_tail[0])
             goto generic_tails; /* Syntax error -- no '}' after "%{connvar" */
           f1_tail++;
@@ -462,7 +462,7 @@ again:
           else if ('{' == f2[1])
             {
               f2_tail = f2 + 2;
-              while (isalnum (f2_tail[0]) || ('_' == f2_tail[0])) f2_tail++;
+              while (isalnum ((unsigned char) (f2_tail[0])) || ('_' == f2_tail[0])) f2_tail++;
               if ('}' != f2_tail[0])
                 goto generic_tails; /* Syntax error -- no '}' after "%{connvar" */
               f2_tail++;
@@ -837,7 +837,7 @@ again:
   if ('{' == f2_tail[0])
     {
       f2_tail++;
-      while (isalnum (f2_tail[0]) || ('_' == f2_tail[0])) f2_tail++;
+      while (isalnum ((unsigned char) (f2_tail[0])) || ('_' == f2_tail[0])) f2_tail++;
       if ('}' != f2_tail[0])
         goto generic_tails; /* Syntax error -- no '}' after "%{connvar" */
       f2_tail++;
@@ -1072,6 +1072,8 @@ sparp_rvr_intersect_sprintffs (sparp_t *sparp, rdf_val_range_t *rvr, ccaddr_t *i
     {
       int newsize = res_buf_len ? res_buf_len : 1;
       do newsize *= 2; while (newsize < max_reslen);
+      if (newsize >= MAX_BOX_ELEMENTS)
+	spar_internal_error (sparp, "The maximum number of elements in array too long");
       res = sparp->sparp_sprintff_isect_buf = (ccaddr_t *)t_alloc_box (newsize * sizeof (caddr_t), DV_ARRAY_OF_LONG);
       res_buf_len = newsize;
     }
diff --git a/libsrc/Wi/sparql_tree.c b/libsrc/Wi/sparql_tree.c
index 670f06f..bc1d93b 100644
--- a/libsrc/Wi/sparql_tree.c
+++ b/libsrc/Wi/sparql_tree.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: sparql_tree.c,v 1.21.2.15 2010/03/01 21:05:27 source Exp $
+ *  $Id: sparql_tree.c,v 1.21.2.21 2011/03/21 10:44:30 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -445,6 +445,8 @@ sparp_down_to_sub (sparp_t *sparp, SPART *subq_gp_wrapper)
   if ((SPAR_GP != SPART_TYPE (subq_gp_wrapper)) || (SELECT_L != subq_gp_wrapper->_.gp.subtype))
     GPF_T1("sparp_" "down_to_sub (): bad subq_gp_wrapper");
   subq = subq_gp_wrapper->_.gp.subquery;
+  if (SPAR_REQ_TOP != SPART_TYPE (subq))
+    spar_internal_error (sparp, "sparp_" "down_to_sub() gets strange subquery");
   sparp_gp_trav_suspend (sparp);
   sub_sparp = (sparp_t *)t_box_copy ((caddr_t)sparp);
   sub_sparp->sparp_expr = subq;
@@ -690,9 +692,6 @@ sparp_equiv_get_ro (sparp_equiv_t **equivs, ptrlong equiv_count, SPART *haystack
   int eqctr, eqcount;
   int varctr, varcount;
   int varnamectr, varnamecount;
-
-  eqcount = haystack_gp->_.gp.equiv_count;
-  eq_idxs = haystack_gp->_.gp.equiv_indexes;
 #ifdef DEBUG
   if (THR_IS_STACK_OVERFLOW (THREAD_CURRENT_THREAD, &equivs, 1000))
     spar_internal_error (NULL, "sparp_equiv_get_ro(): stack overflow");
@@ -716,6 +715,18 @@ sparp_equiv_get_ro (sparp_equiv_t **equivs, ptrlong equiv_count, SPART *haystack
   needle_var_name = (
     ((DV_STRING == DV_TYPE_OF (needle_var)) || (DV_UNAME == DV_TYPE_OF (needle_var))) ?
     ((caddr_t)(needle_var)) : needle_var->_.var.vname );
+  if (SPAR_BINDINGS_INV == haystack_gp->type)
+    {
+      DO_BOX_FAST_REV (SPART *, var, eqctr, haystack_gp->_.binv.vars)
+        {
+          if (!strcmp (var->_.var.vname, needle_var_name))
+            return equivs[var->_.var.equiv_idx];
+        }
+      END_DO_BOX_FAST_REV;
+      goto retnull;
+    }
+  eqcount = haystack_gp->_.gp.equiv_count;
+  eq_idxs = haystack_gp->_.gp.equiv_indexes;
 #ifdef DEBUG
   if (BOX_ELEMENTS_INT_0 (eq_idxs) < eqcount)
     spar_internal_error (NULL, "sparp_equiv_get_ro(): gp.equivs overflow");
@@ -1532,7 +1543,7 @@ dbg_sparp_rvr_audit (const char *file, int line, sparp_t *sparp, const rdf_val_r
     }
   if (DV_ARRAY_OF_POINTER == DV_TYPE_OF (rvr->rvrFixedValue))
     {
-      if (!SPAR_LIT_OR_QNAME_VAL (rvr->rvrFixedValue))
+      if (!SPAR_LIT_OR_QNAME_VAL ((SPART *)(rvr->rvrFixedValue)))
         GOTO_RVR_ERR("weird non-NULL rvrFixedValue");
     }
   return;
@@ -3114,11 +3125,14 @@ sparp_find_triple_of_var_or_retval (sparp_t *sparp, SPART *gp, SPART *var, int n
   return NULL;
 }
 
-qm_value_t *sparp_find_qmv_of_var_or_retval (sparp_t *sparp, SPART *var_triple, SPART *gp, SPART *var)
+qm_value_t *
+sparp_find_qmv_of_var_or_retval (sparp_t *sparp, SPART *var_triple, SPART *gp, SPART *var)
 {
   int tr_idx = var->_.var.tr_idx;
   quad_map_t *qm;
   qm_value_t *qmv;
+  if (SPAR_BINDINGS_INV == gp->type)
+    spar_internal_error (sparp, "sparp_" "find_qmv_of_var_or_retval(): call for binding invocation");
   if (tr_idx >= SPART_TRIPLE_FIELDS_COUNT)
     spar_internal_error (sparp, "sparp_" "find_qmv_of_var_or_retval(): side effect var passed");
   if (NULL == var_triple)
@@ -3218,10 +3232,11 @@ sparp_find_quad_map_by_name (ccaddr_t name)
 }
 
 SPART *
-sparp_find_origin_of_external_var (sparp_t *sparp, SPART *var)
+sparp_find_origin_of_external_var (sparp_t *sparp, SPART *var, int find_exact_specimen)
 {
-  sparp_equiv_t *eq, *esrc;
+  sparp_equiv_t *eq, *esrc, *esub_res_eq = NULL;
   SPART *esub_res_gp = NULL, *esub_res = NULL;
+  SPART *rv;
   int vctr, subv_ctr;
 #ifdef DEBUG
   if (!(SPART_VARR_EXTERNAL & var->_.var.rvr.rvrRestrictions))
@@ -3236,6 +3251,14 @@ sparp_find_origin_of_external_var (sparp_t *sparp, SPART *var)
       sparp_equiv_t *merged_esrc = SPARP_EQUIV(sparp, esrc->e_merge_dest_idx);
       esrc = merged_esrc;
     }
+  if (SPAR_BINDINGS_INV == esrc->e_gp->type) /* An external variable may come from bindings invocation instead of a GP. Binding var is the only choice then. */
+    return esrc->e_vars[0];
+  if (UNION_L == esrc->e_gp->type) /* No one specimen from (one branch of) union can reliably represent all cases a union can produce. */
+    {
+      esub_res_eq = esrc;
+      esub_res_gp = esrc->e_gp;
+      goto make_rv; /* see below */
+    }
 /* The best origin is triple pattern right in the GP because this increases the chance that SQL optimizer will find a good place for some condition on variable from subquery */
   for (vctr = esrc->e_var_count; vctr--; /*no step*/)
      {
@@ -3269,15 +3292,20 @@ sparp_find_origin_of_external_var (sparp_t *sparp, SPART *var)
            SPART *source = esub_eq->e_vars[vctr];
            if (strcmp (source->_.var.vname, var->_.var.vname))
              continue;
-           if ((NULL == source->_.var.tabid) && (NULL != esub_res->_.var.tabid))
+           if ((NULL == source->_.var.tabid) && (NULL != esub_res) && (NULL != esub_res->_.var.tabid))
              continue;
+           esub_res_eq = esub_eq;
            esub_res_gp = esub_gp;
            esub_res = source;
         }
     }
   END_DO_BOX_FAST;
   if (NULL != esub_res)
+    {
+      if (find_exact_specimen)
     return esub_res;
+      goto make_rv; /* see below */
+    }
   DO_BOX_FAST (ptrlong, subeq_idx, subv_ctr, esrc->e_subvalue_idxs)
     {
       sparp_equiv_t *esub_eq = SPARP_EQUIV (sparp, subeq_idx);
@@ -3285,17 +3313,20 @@ sparp_find_origin_of_external_var (sparp_t *sparp, SPART *var)
       SPART *rv;
       if (SELECT_L != esub_gp->_.gp.subtype)
         continue;
-      rv = (SPART *)t_alloc_box (sizeof (SPART), DV_ARRAY_OF_POINTER);
-      rv->_.retval.equiv_idx = esub_eq->e_own_idx;
-      rv->_.retval.gp = esub_gp;
-      memcpy (&(rv->_.retval.rvr), &(esub_eq->e_rvr), sizeof (rdf_val_range_t));
-      rv->_.retval.selid = esub_gp->_.gp.selid;
-      rv->_.retval.vname = var->_.var.vname;
-      return rv;
+      esub_res_eq = esub_eq;
+      esub_res_gp = esub_gp;
+      goto make_rv; /* see below */
     }
   END_DO_BOX_FAST;
   spar_internal_error (sparp, "sparp_" "find_origin_of_external_var(): external source equiv is found, external source var is not");
-  return NULL;
+make_rv:
+  rv = (SPART *)t_alloc_box (sizeof (SPART), DV_ARRAY_OF_POINTER);
+  rv->_.retval.equiv_idx = esub_res_eq->e_own_idx;
+  rv->_.retval.gp = esub_res_gp;
+  memcpy (&(rv->_.retval.rvr), &(esub_res_eq->e_rvr), sizeof (rdf_val_range_t));
+  rv->_.retval.selid = esub_res_gp->_.gp.selid;
+  rv->_.retval.vname = var->_.var.vname;
+  return rv;
 }
 
 SPART *
@@ -3901,19 +3932,23 @@ spart_dump (void *tree_arg, dk_session_t *ses, int indent, const char *title, in
       for (ctr = indent; ctr--; /*no step*/ )
         session_buffered_write_char (' ', ses);
     }
+  else
+    {
+      session_buffered_write_char ('\t', ses);
+      indent = -indent;
+    }
   if (title)
     {
       SES_PRINT (ses, title);
       SES_PRINT (ses, ": ");
     }
+  if (DV_ARRAY_OF_POINTER != DV_TYPE_OF (tree))
+    {
+      hint = 0;
+    }
   if ((-1 == hint) && IS_BOX_POINTER(tree))
     {
-      if (DV_ARRAY_OF_POINTER != DV_TYPE_OF (tree))
-        {
-          SES_PRINT (ses, "special: ");
-          hint = 0;
-        }
-      else if ((SPART_HEAD >= BOX_ELEMENTS(tree)) || IS_BOX_POINTER (tree->type))
+      if ((SPART_HEAD >= BOX_ELEMENTS(tree)) || IS_BOX_POINTER (tree->type))
         {
           SES_PRINT (ses, "special: ");
           hint = -2;
@@ -3952,9 +3987,9 @@ spart_dump (void *tree_arg, dk_session_t *ses, int indent, const char *title, in
 	    {
 	      sprintf (buf, "BLANK NODE:");
 	      SES_PRINT (ses, buf);
-	      spart_dump (tree->_.var.vname, ses, indent+2, "NAME", 0);
-	      spart_dump (tree->_.var.selid, ses, indent+2, "SELECT ID", 0);
-	      spart_dump (tree->_.var.tabid, ses, indent+2, "TABLE ID", 0);
+	      spart_dump (tree->_.var.vname, ses, -(indent+2), "NAME", 0);
+	      spart_dump (tree->_.var.selid, ses, -(indent+2), "SELECT ID", 0);
+	      spart_dump (tree->_.var.tabid, ses, -(indent+2), "TABLE ID", 0);
 	      break;
 	    }
 	  case SPAR_BUILT_IN_CALL:
@@ -4069,9 +4104,9 @@ spart_dump (void *tree_arg, dk_session_t *ses, int indent, const char *title, in
                     spart_dump_opname (tr_idx, 0);
                 }
 	      spart_dump (tree->_.var.vname, ses, indent+2, "NAME", 0);
-	      spart_dump (tree->_.var.selid, ses, indent+2, "SELECT ID", 0);
-	      spart_dump (tree->_.var.tabid, ses, indent+2, "TABLE ID", 0);
-	      spart_dump ((void*)(tree->_.var.equiv_idx), ses, indent+2, "EQUIV", 0);
+	      spart_dump (tree->_.var.selid, ses, -(indent+2), "SELECT ID", 0);
+	      spart_dump (tree->_.var.tabid, ses, -(indent+2), "TABLE ID", 0);
+	      spart_dump ((void*)(tree->_.var.equiv_idx), ses, -(indent+2), "EQUIV", 0);
 	      break;
 	    }
 	  case SPAR_TRIPLE:
diff --git a/libsrc/Wi/sparqld.c b/libsrc/Wi/sparqld.c
index 3b507d6..ad309ac 100644
--- a/libsrc/Wi/sparqld.c
+++ b/libsrc/Wi/sparqld.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: sparqld.c,v 1.8.2.13 2010/03/24 01:03:30 source Exp $
+ *  $Id: sparqld.c,v 1.8.2.18 2011/01/28 13:34:04 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -263,7 +263,7 @@ ssg_sdprin_varname (spar_sqlgen_t *ssg, ccaddr_t vname)
           char buf[20];
           if (strcmp (vname, param_vname))
             continue;
-          if (SSG_SD_BI & ssg->ssg_sd_flags)
+          if (SSG_SD_GLOBALS & ssg->ssg_sd_flags)
             {
               sprintf (buf, "?:%d", paramctr+1);
               ssg_puts (buf);
@@ -531,16 +531,11 @@ void ssg_sdprint_tree (spar_sqlgen_t *ssg, SPART *tree)
         int argcount = BOX_ELEMENTS (tree->_.funcall.argtrees);
         ssg_putchar (' ');
         ssg_sdprin_qname (ssg, (SPART *)(tree->_.funcall.qname));
-        if (0 != argcount)
-          {
             ssg_putchar ('(');
             ssg->ssg_indent++;
             ssg_sdprint_tree_list (ssg, tree->_.funcall.argtrees, ',');
             ssg_putchar (')');
             ssg->ssg_indent--;
-          }
-        else
-          ssg_puts (" NIL");
         return;
       }
     case SPAR_GP:
@@ -622,10 +617,19 @@ void ssg_sdprint_tree (spar_sqlgen_t *ssg, SPART *tree)
               count = BOX_ELEMENTS_0 (sinv->_.sinv.defines);
               for (ctr = 0; ctr < count; ctr += 2)
                 {
+                  caddr_t name = (caddr_t)(sinv->_.sinv.defines[ctr]);
+                  SPART ***vals = (SPART ***)(sinv->_.sinv.defines[ctr+1]);
+                  int valctr;
+                  if (!strcmp (name, "lang:dialect"))
+                    continue;
                   ssg_puts (" DEFINE ");
-                  ssg_puts ((caddr_t)(sinv->_.sinv.defines[ctr]));
-                  ssg_putchar (' ');
-                  ssg_sdprint_tree (ssg, sinv->_.sinv.defines[ctr+1]);
+                  ssg_puts (name);
+                  DO_BOX_FAST (SPART **, val, valctr, vals)
+                    {
+                      if (valctr) ssg_putchar (',');
+                      ssg_sdprint_tree (ssg, val[1]);
+                    }
+                  END_DO_BOX_FAST;
                 }
               ssg_puts (") ");
               break;
@@ -785,6 +789,8 @@ void ssg_sdprint_tree (spar_sqlgen_t *ssg, SPART *tree)
           {
             SPART *lim = tree->_.req_top.limit;
             SPART *ofs = tree->_.req_top.offset;
+            int has_lim = ((NULL != lim) && ((DV_LONG_INT != DV_TYPE_OF (lim)) || (SPARP_MAXLIMIT != unbox ((caddr_t)(lim)))));
+            int has_ofs = ((NULL != ofs) && ((DV_LONG_INT != DV_TYPE_OF (ofs)) || (0 != unbox ((caddr_t)(ofs)))));
             if (0 != BOX_ELEMENTS_0 (tree->_.req_top.groupings))
               {
                 ssg_newline (0);
@@ -797,13 +803,13 @@ void ssg_sdprint_tree (spar_sqlgen_t *ssg, SPART *tree)
                 ssg_puts ("HAVING ");
                 ssg_sdprint_tree (ssg, tree->_.req_top.having);
               }
-            if (0 != BOX_ELEMENTS_0 (tree->_.req_top.order))
+            if (0 != BOX_ELEMENTS_0 (tree->_.req_top.order) && ((SELECT_L == tree->_.req_top.subtype) || (DISTINCT_L == tree->_.req_top.subtype) || has_lim || has_ofs))
               {
                 ssg_newline (0);
                 ssg_puts ("ORDER BY ");
                 ssg_sdprint_tree_list (ssg, tree->_.req_top.order, ' ');
               }
-            if ((NULL != lim) && ((DV_LONG_INT != DV_TYPE_OF (lim)) || (SPARP_MAXLIMIT != unbox ((caddr_t)(lim)))))
+            if (has_lim)
               {
                 if ((DV_LONG_INT != DV_TYPE_OF (lim)) && !(SSG_SD_BI & ssg->ssg_sd_flags))
                   spar_error (ssg->ssg_sparp, "%.100s does not support SPARQL-BI extensions (like expression in LIMIT clause) so SPARQL query can not be composed", ssg->ssg_sd_service_name);
@@ -811,7 +817,7 @@ void ssg_sdprint_tree (spar_sqlgen_t *ssg, SPART *tree)
                 ssg_puts ("LIMIT ");
                 ssg_sdprint_tree (ssg, lim);
               }
-            if ((NULL != ofs) && ((DV_LONG_INT != DV_TYPE_OF (ofs)) || (0 != unbox ((caddr_t)(ofs)))))
+            if (has_ofs)
               {
                 if ((DV_LONG_INT != DV_TYPE_OF (ofs)) && !(SSG_SD_BI & ssg->ssg_sd_flags))
                   spar_error (ssg->ssg_sparp, "%.100s does not support SPARQL-BI extensions (like expression in OFFSET clause) so SPARQL query can not be composed", ssg->ssg_sd_service_name);
@@ -829,13 +835,13 @@ void ssg_sdprint_tree (spar_sqlgen_t *ssg, SPART *tree)
         SPART *curr_graph = tree->_.triple.tr_graph;
         int new_g_is_dflt = 0;
         int should_close_graph, need_new_graph, place_qm;
-        int option_ctr, option_count;
+        int option_count;
         if (ssg->ssg_sd_graph_gp_nesting <= ssg->ssg_sd_forgotten_graph)
           {
             switch (SPART_TYPE (curr_graph))
               {
               case SPAR_BLANK_NODE_LABEL:
-                if (!strncmp (curr_graph->_.var.vname, "_::default", 10))
+                if (curr_graph->_.bnode.bracketed & 0x2)
                   new_g_is_dflt = 1;
                 break;
               case SPAR_QNAME:
diff --git a/libsrc/Wi/sparul2sql.c b/libsrc/Wi/sparul2sql.c
index 3987520..5bc92ca 100644
--- a/libsrc/Wi/sparul2sql.c
+++ b/libsrc/Wi/sparul2sql.c
@@ -1,5 +1,5 @@
 /*
- *  $Id: sparul2sql.c,v 1.20.2.10 2010/05/12 12:17:48 source Exp $
+ *  $Id: sparul2sql.c,v 1.20.2.12 2011/01/28 13:34:04 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -469,6 +469,30 @@ spar_simplify_graph_to_patch (sparp_t *sparp, SPART *g)
   return g->_.graph.expn;
 }
 
+int
+spar_find_sc_for_big_ssl_const (sparp_t *sparp, sql_comp_t **sc_ret)
+{
+  if (sparp->sparp_disable_big_const)
+    {
+      sc_ret[0] = NULL;
+      return 0;
+    }
+  sc_ret[0] = sparp->sparp_sparqre->sparqre_super_sc;
+  if (NULL == sc_ret[0])
+    {
+#ifdef NDEBUG
+      spar_error (sparp, "The query can be compiled and executed but not translated to an accurate SQL text");
+#endif
+      return 0;
+    }
+  else
+    {
+      while (NULL != sc_ret[0]->sc_super)
+        sc_ret[0]->sc_super = sc_ret[0]->sc_super;
+    }
+  return 1;
+}
+
 void
 spar_compose_retvals_of_insert_or_delete (sparp_t *sparp, SPART *top, SPART *graph_to_patch, SPART *ctor_gp)
 {
@@ -493,21 +517,7 @@ spar_compose_retvals_of_insert_or_delete (sparp_t *sparp, SPART *top, SPART *gra
       cve.cve_limofs_var_alias = t_box_dv_short_string ("ctor-1");
     }
   if (big_ssl_const_mode)
-    {
-      sc_for_big_ssl_const = sparp->sparp_sparqre->sparqre_super_sc;
-      if (NULL == sc_for_big_ssl_const)
-        {
-          big_ssl_const_mode = 0;
-#ifdef NDEBUG
-          spar_error (sparp, "The query can be compiled and executed but not translated to an accurate SQL text");
-#endif
-        }
-      else
-        {
-          while (NULL != sc_for_big_ssl_const->sc_super)
-            sc_for_big_ssl_const->sc_super = sc_for_big_ssl_const->sc_super;
-        }
-    }
+    big_ssl_const_mode = spar_find_sc_for_big_ssl_const (sparp, &sc_for_big_ssl_const);
   if ((INSERT_L != top->_.req_top.subtype) && (SPARUL_INSERT_DATA != top->_.req_top.subtype))
     cve.cve_bnodes_are_prohibited = 1;
   spar_compose_retvals_of_ctor (sparp, ctor_gp, "sql:SPARQL_CONSTRUCT", sc_for_big_ssl_const, NULL, NULL,
@@ -606,8 +616,8 @@ spar_emulate_ctor_field (sparp_t *sparp, SPART *opcode, SPART *oparg, SPART **va
       {
         if (NULL == bnode_emulation)
 #ifdef DEBUG
-          bnode_emulation = box_copy_tree (spartlist (sparp, 6 + (sizeof (rdf_val_range_t) / sizeof (caddr_t)), SPAR_BLANK_NODE_LABEL,
-            NULL, NULL, NULL, NULL, NULL, SPART_RVR_LIST_OF_NULLS ) );
+          bnode_emulation = box_copy_tree (spartlist (sparp, 7 + (sizeof (rdf_val_range_t) / sizeof (caddr_t)), SPAR_BLANK_NODE_LABEL,
+            NULL, NULL, NULL, NULL, NULL, SPART_RVR_LIST_OF_NULLS, NULL ) );
 #else
           bnode_emulation = box_copy_tree (spartlist (sparp, 1, SPAR_BLANK_NODE_LABEL));
 #endif
diff --git a/libsrc/Wi/sql3.c b/libsrc/Wi/sql3.c
index 0f36658..2c99c4a 100644
--- a/libsrc/Wi/sql3.c
+++ b/libsrc/Wi/sql3.c
@@ -12327,7 +12327,7 @@ yyreduce:
 #line 2364 "./sql3.y"
     {
 		  ST *in = NULL;
-		  in = SUBQ_PRED (SOME_PRED, (yyvsp[(1) - (4)].tree), (yyvsp[(4) - (4)].tree), BOP_EQ, NULL);
+		  in = SUBQ_PRED (SOME_PRED, (yyvsp[(1) - (4)].tree), sqlp_wpar_nonselect ((yyvsp[(4) - (4)].tree)), BOP_EQ, NULL);
 		  NEGATE ((yyval.tree), in);
 		}
     break;
@@ -12337,7 +12337,7 @@ yyreduce:
 /* Line 1455 of yacc.c  */
 #line 2370 "./sql3.y"
     {
-		  (yyval.tree) = SUBQ_PRED (SOME_PRED, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree), BOP_EQ, NULL); }
+		  (yyval.tree) = SUBQ_PRED (SOME_PRED, (yyvsp[(1) - (3)].tree), sqlp_wpar_nonselect ((yyvsp[(3) - (3)].tree)), BOP_EQ, NULL); }
     break;
 
   case 578:
@@ -12360,7 +12360,7 @@ yyreduce:
 
 /* Line 1455 of yacc.c  */
 #line 2389 "./sql3.y"
-    { (yyval.tree) = SUBQ_PRED ((yyvsp[(3) - (4)].intval), (yyvsp[(1) - (4)].tree), (yyvsp[(4) - (4)].tree), (yyvsp[(2) - (4)].subtok), NULL); }
+    { (yyval.tree) = SUBQ_PRED ((yyvsp[(3) - (4)].intval), (yyvsp[(1) - (4)].tree), sqlp_wpar_nonselect ((yyvsp[(4) - (4)].tree)), (yyvsp[(2) - (4)].subtok), NULL); }
     break;
 
   case 581:
@@ -12456,8 +12456,8 @@ yyreduce:
 
 /* Line 1455 of yacc.c  */
 #line 2431 "./sql3.y"
-    { if (sqlp_is_num_lit ((yyvsp[(2) - (2)].tree))) (yyval.tree) = sqlp_minus ((yyvsp[(2) - (2)].tree));
-				      else BIN_OP ((yyval.tree), BOP_MINUS, (ST*) t_box_num (0), (yyvsp[(2) - (2)].tree)) }
+    { if (sqlp_is_num_lit ((caddr_t)((yyvsp[(2) - (2)].tree)))) (yyval.tree) = sqlp_minus ((caddr_t)((yyvsp[(2) - (2)].tree)));
+				          else BIN_OP ((yyval.tree), BOP_MINUS, (ST*) t_box_num (0), (yyvsp[(2) - (2)].tree)) }
     break;
 
   case 596:
diff --git a/libsrc/Wi/sql3.y b/libsrc/Wi/sql3.y
index aabbac4..2a6f0ab 100644
--- a/libsrc/Wi/sql3.y
+++ b/libsrc/Wi/sql3.y
@@ -1,7 +1,7 @@
 /*
  *  sql3.y
  *
- *  $Id: sql3.y,v 1.29.2.7 2010/02/09 15:11:05 source Exp $
+ *  $Id: sql3.y,v 1.29.2.10 2011/01/28 13:28:30 source Exp $
  *
  *  SQL Parser
  *
@@ -933,7 +933,7 @@ identity_opt
 	;
 
 compression_spec
-: NO_L COMPRESS { $$ = t_listst (2, CO_COMPRESS, (ptrlong)CC_NONE); }
+	: NO_L COMPRESS { $$ = t_listst (2, CO_COMPRESS, (ptrlong)CC_NONE); }
 	| COMPRESS ANY { $$ = t_listst (2, CO_COMPRESS, (ptrlong)CC_OFFSET); }
 	| COMPRESS TEXT_L { $$ = t_listst (2, CO_COMPRESS, (ptrlong)CC_PREFIX); }
 	;
@@ -991,7 +991,7 @@ table_constraint_def
 		  t_listst (5, UNIQUE_DEF, $1, NULL,
 		      sqlp_string_col_list ((caddr_t *) t_list_to_array ($4)),
 		      (ST *) t_list (1, t_box_string ("unique"))); }
-| opt_constraint_name GROUP opt_index_option_list '(' index_column_commalist ')' { $$ = t_listst (4, COLUMN_GROUP, $1, $3, sqlp_string_col_list (t_list_to_array ($5))); }
+	| opt_constraint_name GROUP opt_index_option_list '(' index_column_commalist ')' { $$ = t_listst (4, COLUMN_GROUP, $1, $3, sqlp_string_col_list (t_list_to_array ($5))); }
 	;
 
 opt_constraint_name
@@ -1808,12 +1808,12 @@ selectinto_statement
 
 
 colnum_commalist_2
-: INTNUM { $$ = t_CONS (sqlp_col_num ($1), NULL); }
-| colnum_commalist_2 ',' INTNUM { $$ = t_NCONC ($1, t_CONS (sqlp_col_num ($3), NULL)); }
+	: INTNUM { $$ = t_CONS (sqlp_col_num ($1), NULL); }
+	| colnum_commalist_2 ',' INTNUM { $$ = t_NCONC ($1, t_CONS (sqlp_col_num ($3), NULL)); }
 	;
 
 colnum_commalist
-: INTNUM { $$ = t_listbox (1, sqlp_col_num ($1)); }
+	: INTNUM { $$ = t_listbox (1, sqlp_col_num ($1)); }
 	| '(' colnum_commalist_2 ')' { $$ = t_list_to_array_box ($2); }
 	;
 
@@ -1829,7 +1829,7 @@ trans_opt
 	| T_SHORTEST_ONLY { global_trans->_.trans.shortest_only = 1; }
 	| T_IN colnum_commalist { global_trans->_.trans.in = (ptrlong*) $2; }
  	| T_OUT colnum_commalist { global_trans->_.trans.out = (ptrlong*) $2; }
-| T_END_FLAG  INTNUM { global_trans->_.trans.end_flag = (ptrlong)sqlp_col_num ($2); }
+	| T_END_FLAG  INTNUM { global_trans->_.trans.end_flag = (ptrlong)sqlp_col_num ($2); }
 	| T_FINAL_AS NAME { global_trans->_.trans.final_as = $2; }
 	| T_DIRECTION INTNUM { global_trans->_.trans.direction = unbox ($2); }
 	;
@@ -2031,7 +2031,7 @@ query_no_from_spec
 
 
 breakup_term
-: '(' select_scalar_exp_commalist  ')' { $$ = dk_set_conc ($2, t_CONS (t_list (5, BOP_AS, (ptrlong) 1, NULL, t_box_string ("__brkup_cond"), NULL), NULL)); }
+	: '(' select_scalar_exp_commalist  ')' { $$ = dk_set_conc ($2, t_CONS (t_list (5, BOP_AS, (ptrlong) 1, NULL, t_box_string ("__brkup_cond"), NULL), NULL)); }
 	| '(' select_scalar_exp_commalist WHERE search_condition ')' {
 	  ST * cond = (ST*) t_list (5, BOP_AS, t_list (2, SEARCHED_CASE, t_list (4, $4, (caddr_t)1,  t_list (2, QUOTE, NULL), 0)), NULL, t_box_string ("__brkup_cond"), NULL);
 	  $$ = dk_set_conc ($2, t_CONS (cond, NULL)); }
@@ -2044,7 +2044,7 @@ breakup_list
 
 selection
 	: select_scalar_exp_commalist	{ $$ = (ST *) t_list_to_array ($1); }
-| BREAKUP breakup_list { $$ = (ST *) t_list_to_array (t_CONS (t_list (1, SELECT_BREAKUP), $2)); }
+	| BREAKUP breakup_list { $$ = (ST *) t_list_to_array (t_CONS (t_list (1, SELECT_BREAKUP), $2)); }
 	;
 
 non_final_table_exp
@@ -2363,12 +2363,12 @@ in_predicate
 	: scalar_exp NOT IN_L subquery
 		{
 		  ST *in = NULL;
-		  in = SUBQ_PRED (SOME_PRED, $1, $4, BOP_EQ, NULL);
+		  in = SUBQ_PRED (SOME_PRED, $1, sqlp_wpar_nonselect ($4), BOP_EQ, NULL);
 		  NEGATE ($$, in);
 		}
 	| scalar_exp IN_L subquery
 		{
-		  $$ = SUBQ_PRED (SOME_PRED, $1, $3, BOP_EQ, NULL); }
+		  $$ = SUBQ_PRED (SOME_PRED, $1, sqlp_wpar_nonselect ($3), BOP_EQ, NULL); }
 	| scalar_exp NOT IN_L '(' scalar_exp_commalist ')'
  		{ $$ = sqlp_in_exp ($1, $5, 1);
 		}
@@ -2386,7 +2386,7 @@ atom_commalist
 
 all_or_any_predicate
 	: scalar_exp COMPARISON any_all_some subquery
-		{ $$ = SUBQ_PRED ($3, $1, $4, $2, NULL); }
+		{ $$ = SUBQ_PRED ($3, $1, sqlp_wpar_nonselect ($4), $2, NULL); }
 	;
 
 any_all_some
@@ -2428,8 +2428,8 @@ scalar_exp
 	| scalar_exp '*' scalar_exp	{ BIN_OP ($$, BOP_TIMES, $1, $3) }
 	| scalar_exp '/' scalar_exp	{ BIN_OP ($$, BOP_DIV, $1, $3) }
 	| '+' scalar_exp %prec UMINUS	{ $$ = $2; }
-	| '-' scalar_exp %prec UMINUS	{ if (sqlp_is_num_lit ($2)) $$ = sqlp_minus ($2);
-				      else BIN_OP ($$, BOP_MINUS, (ST*) t_box_num (0), $2) }
+	| '-' scalar_exp %prec UMINUS	{ if (sqlp_is_num_lit ((caddr_t)($2))) $$ = sqlp_minus ((caddr_t)($2));
+				          else BIN_OP ($$, BOP_MINUS, (ST*) t_box_num (0), $2) }
 	| assignment_statement
 	| string_concatenation_operator
 	| column_ref			{ $$ = (sql_tree_t *) $1; }
@@ -3388,7 +3388,7 @@ cost_number
 	;
 
 cost_number_list
-: cost_number { $$ = t_CONS ($1, NULL); }
+	: cost_number { $$ = t_CONS ($1, NULL); }
 	| cost_number_list ',' cost_number { $$ = t_NCONC ($1, t_CONS ($3, NULL)); }
 	;
 
@@ -4434,7 +4434,7 @@ host
 
 host_list
 	: host { $$ = t_CONS ($1, NULL); }
-| host_list ',' host { $$ = t_NCONC ($1, t_CONS ($3, NULL)); }
+	| host_list ',' host { $$ = t_NCONC ($1, t_CONS ($3, NULL)); }
 	;
 
 range
@@ -4443,7 +4443,7 @@ range
 
 range_list
 	: range { $$ = t_CONS ($1, NULL); }
-| range_list ',' range { $$ = t_NCONC ($1, t_CONS ($3, NULL)); }
+	| range_list ',' range { $$ = t_NCONC ($1, t_CONS ($3, NULL)); }
 	;
 
 
@@ -4455,7 +4455,7 @@ host_group
 
 host_group_list
 	: host_group { $$ = t_CONS ($1, NULL); }
-| host_group_list ',' host_group { $$ = t_NCONC ($1, t_CONS ($3, NULL)); }
+	| host_group_list ',' host_group { $$ = t_NCONC ($1, t_CONS ($3, NULL)); }
 	;
 
 opt_modulo
@@ -4469,7 +4469,7 @@ cluster_def
 	;
 
 col_part_commalist
-: NAME col_partition { $$ = t_CONS ($2, NULL); $2->_.col_part.col = $1; }
+	: NAME col_partition { $$ = t_CONS ($2, NULL); $2->_.col_part.col = $1; }
 	| col_part_list ',' NAME col_partition { $4->_.col_part.col = $3; $$ = t_NCONC ($1, $4);}
 	;
 
diff --git a/libsrc/Wi/sql_code.c b/libsrc/Wi/sql_code.c
index 75117d5..db6e3a0 100644
--- a/libsrc/Wi/sql_code.c
+++ b/libsrc/Wi/sql_code.c
@@ -26,6 +26,7 @@ static const char *tbl1 =
 ")\n";
 
 static const char *proc0 = 
+"#line 43 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.SYS_CACHED_RESOURCE_ADD (\n"
 "in _uri varchar, in _public_id varchar,\n"
 "in _content varchar, in _loading_date datetime, in _comment varchar)\n"
@@ -42,25 +43,28 @@ static const char *proc0 =
 "values (_uri, _public_id, _content, _loading_date, _comment);\n"
 "commit work;\n"
 "}\n"
-"--src system.sql:42\n";
+"--src system.sql:41\n";
 
 static const char *proc1 = 
+"#line 71 \"[executable]/system.sql\"\n"
 " create procedure WS.WS.PARSE_URI (in uri varchar)\n"
 "{\n"
 "return rfc1808_parse_uri (uri);\n"
 "}\n"
-"--src system.sql:70\n";
+"--src system.sql:69\n";
 
 static const char *proc2 = 
+"#line 79 \"[executable]/system.sql\"\n"
 " create function WS.WS.EXPAND_URL (in base varchar, in rel varchar, in output_charset varchar := null) returns any\n"
 "{\n"
 "\n"
 "\n"
 "return rfc1808_expand_uri (base, rel, output_charset);\n"
 "}\n"
-"--src system.sql:78\n";
+"--src system.sql:77\n";
 
 static const char *proc3 = 
+"#line 87 \"[executable]/system.sql\"\n"
 "create procedure repl_undot_name (in id varchar)\n"
 "{\n"
 "declare last_dot_inx integer;\n"
@@ -70,9 +74,10 @@ static const char *proc3 =
 "else\n"
 "return id;\n"
 "}\n"
-"--src system.sql:86\n";
+"--src system.sql:85\n";
 
 static const char *proc4 = 
+"#line 98 \"[executable]/system.sql\"\n"
 "create procedure REPL_FQNAME (in _tbl varchar)\n"
 "{\n"
 "declare _parts any;\n"
@@ -90,9 +95,10 @@ static const char *proc4 =
 "}\n"
 "return concat (_parts[0], \'.\', _parts[1], \'.\', _parts[2]);\n"
 "}\n"
-"--src system.sql:97\n";
+"--src system.sql:96\n";
 
 static const char *proc5 = 
+"#line 117 \"[executable]/system.sql\"\n"
 "create procedure REPL_COLTYPE_PS (\n"
 "in _coltype varchar,\n"
 "in _col_dtp integer, in _col_prec integer, in _col_scale integer)\n"
@@ -126,9 +132,10 @@ static const char *proc5 =
 "}\n"
 "return _coltype;\n"
 "}\n"
-"--src system.sql:116\n";
+"--src system.sql:115\n";
 
 static const char *proc6 = 
+"#line 152 \"[executable]/system.sql\"\n"
 "create procedure REPL_COLTYPE (in _col any) returns varchar\n"
 "{\n"
 "declare _col_dtp, _col_prec, _col_scale integer;\n"
@@ -146,9 +153,10 @@ static const char *proc6 =
 "return REPL_COLTYPE_PS (\n"
 "dv_type_title(_col_dtp), _col_dtp, _col_prec, _col_scale);\n"
 "}\n"
-"--src system.sql:151\n";
+"--src system.sql:150\n";
 
 static const char *proc7 = 
+"#line 171 \"[executable]/system.sql\"\n"
 "create procedure WS.WS.HEX_DIGIT (in i integer)\n"
 "{\n"
 "if ( i >= 0 and i < 10)\n"
@@ -157,9 +165,10 @@ static const char *proc7 =
 "return i + ascii (\'A\') - 10;\n"
 "return ascii (\'0\');\n"
 "}\n"
-"--src system.sql:170\n";
+"--src system.sql:169\n";
 
 static const char *proc8 = 
+"#line 182 \"[executable]/system.sql\"\n"
 "create procedure WS.WS.STR_SQL_APOS (in str varchar)\n"
 "{\n"
 "declare tmp varchar;\n"
@@ -205,9 +214,10 @@ static const char *proc8 =
 "\n"
 "return trim(tmp);\n"
 "}\n"
-"--src system.sql:181\n";
+"--src system.sql:180\n";
 
 static const char *proc9 = 
+"#line 229 \"[executable]/system.sql\"\n"
 "create procedure WS.WS.STR_FT_QUOT (in str varchar)\n"
 "{\n"
 "declare tmp varchar;\n"
@@ -242,9 +252,10 @@ static const char *proc9 =
 "aset(tmp, inx1, ascii(\'\"\'));\n"
 "return trim(tmp);\n"
 "}\n"
-"--src system.sql:228\n";
+"--src system.sql:227\n";
 
 static const char *proc10 = 
+"#line 266 \"[executable]/system.sql\"\n"
 " create procedure SQL_PROCEDURE_COLUMNS (\n"
 "in qual varchar,\n"
 "in owner varchar,\n"
@@ -328,9 +339,10 @@ static const char *proc10 =
 "}\n"
 "}\n"
 "}\n"
-"--src system.sql:265\n";
+"--src system.sql:264\n";
 
 static const char *proc11 = 
+"#line 352 \"[executable]/system.sql\"\n"
 " create procedure XML_URI_RESOLVE_LIKE_GET (in base_uri varchar, in rel_uri varchar, in output_charset varchar := null) returns any\n"
 "{\n"
 "declare res any;\n"
@@ -348,9 +360,10 @@ static const char *proc11 =
 "\n"
 "return res;\n"
 "}\n"
-"--src system.sql:351\n";
+"--src system.sql:350\n";
 
 static const char *proc12 = 
+"#line 371 \"[executable]/system.sql\"\n"
 "create function XML_URI_GET_AND_CACHE (in absolute_uri varchar)\n"
 "{\n"
 "declare head, content any;\n"
@@ -372,9 +385,10 @@ static const char *proc12 =
 "(absolute_uri, content, now());\n"
 "return content;\n"
 "}\n"
-"--src system.sql:370\n";
+"--src system.sql:369\n";
 
 static const char *proc13 = 
+"#line 396 \"[executable]/system.sql\"\n"
 " create procedure XML_URI_PARSE_VIRT (in base_uri varchar, inout table_name varchar, inout datacol_name varchar, inout pathcol_name varchar, inout path varchar)\n"
 "{\n"
 "declare table_start, col_start, path_start integer;\n"
@@ -406,9 +420,10 @@ static const char *proc13 =
 "pathcol_name := subseq (table_name, col_start + 1);\n"
 "table_name := subseq (table_name, 0, col_start);\n"
 "}\n"
-"--src system.sql:395\n";
+"--src system.sql:394\n";
 
 static const char *proc14 = 
+"#line 431 \"[executable]/system.sql\"\n"
 "create procedure XML_URI_GET (in base_uri varchar, in rel_uri varchar)\n"
 "{\n"
 "declare head, str, proto varchar;\n"
@@ -463,10 +478,10 @@ static const char *proc14 =
 "}\n"
 "else if (proto = \'https\' or (length (hcli_uid) and length (hcli_pwd)) or (timeout is not null and timeout > 0))\n"
 "{\n"
-"str := http_client_ext (url=>base_uri, uid=>hcli_uid, pwd=>hcli_pwd, headers=>head, timeout=>timeout);\n"
+"str := http_client_ext (url=>base_uri, uid=>hcli_uid, pwd=>hcli_pwd, headers=>head, timeout=>timeout, n_redirects=>15);\n"
 "}\n"
 "else\n"
-"str := http_get (base_uri, head);\n"
+"str := http_client_ext (url=>base_uri, headers=>head, n_redirects=>15);\n"
 "if (aref (head, 0) not like \'% 200%\')\n"
 "signal (\'H0001\', concat (\'HTTP request failed: \', aref (head, 0), \'for URI \', base_uri));\n"
 "}\n"
@@ -598,9 +613,10 @@ static const char *proc14 =
 "}\n"
 "return str;\n"
 "}\n"
-"--src system.sql:430\n";
+"--src system.sql:429\n";
 
 static const char *proc15 = 
+"#line 622 \"[executable]/system.sql\"\n"
 "create procedure XML_URI_GET_STRING (in base_uri varchar, in rel_uri varchar)\n"
 "{\n"
 "declare _res any;\n"
@@ -609,9 +625,10 @@ static const char *proc15 =
 "return _res;\n"
 "return cast (_res as varchar);\n"
 "}\n"
-"--src system.sql:621\n";
+"--src system.sql:620\n";
 
 static const char *proc16 = 
+"#line 632 \"[executable]/system.sql\"\n"
 "create procedure XML_URI_GET_STRING_OR_ENT (in base_uri varchar, in rel_uri varchar)\n"
 "{\n"
 "declare _res any;\n"
@@ -620,9 +637,10 @@ static const char *proc16 =
 "return _res;\n"
 "return cast (_res as varchar);\n"
 "}\n"
-"--src system.sql:631\n";
+"--src system.sql:630\n";
 
 static const char *proc17 = 
+"#line 643 \"[executable]/system.sql\"\n"
 "create procedure XML_COLLECTION_DIR_LIST_LOCAL (in collection_uri varchar, in dav_path varchar, inout res any, in recursive int)\n"
 "{\n"
 "declare dir_list any;\n"
@@ -655,9 +673,10 @@ static const char *proc17 =
 "foreach (varchar r_path in r_list) do\n"
 "xq_sequencebld_acc (res, subseq (collection_uri, 0, 22) || subseq (r_path, 5));\n"
 "}\n"
-"--src system.sql:642\n";
+"--src system.sql:641\n";
 
 static const char *proc18 = 
+"#line 677 \"[executable]/system.sql\"\n"
 "create procedure XML_COLLECTION_DIR_LIST_TABLE (in collection_uri varchar, inout res any, in recursive int)\n"
 "{\n"
 "declare datacol_name, path, table_name, pathcol_name varchar;\n"
@@ -692,9 +711,10 @@ static const char *proc18 =
 "xq_sequencebld_acc (res, concat (\'virt://\', table_name, \'.\', pathcol_name, \'.\', datacol_name, \':\', cast (aref (_id, 0) as varchar)));\n"
 "}\n"
 "}\n"
-"--src system.sql:676\n";
+"--src system.sql:675\n";
 
 static const char *proc19 = 
+"#line 714 \"[executable]/system.sql\"\n"
 "create procedure HTTP_GET_AUTH_INFO (in base_uri varchar)\n"
 "{\n"
 "declare _auth_get, hcli_uid, hcli_pwd varchar;\n"
@@ -718,9 +738,10 @@ static const char *proc19 =
 "}\n"
 "return null;\n"
 "}\n"
-"--src system.sql:713\n";
+"--src system.sql:712\n";
 
 static const char *proc20 = 
+"#line 740 \"[executable]/system.sql\"\n"
 "create procedure XML_COLLECTION_DIR_LIST_REMOTE (in host_part varchar, in auth_digest varchar, in dav_path varchar, inout res any, in recursive int)\n"
 "{\n"
 "declare r any;\n"
@@ -781,9 +802,10 @@ static const char *proc20 =
 "}\n"
 "\n"
 "}\n"
-"--src system.sql:739\n";
+"--src system.sql:738\n";
 
 static const char *proc21 = 
+"#line 802 \"[executable]/system.sql\"\n"
 "create procedure XML_COLLECTION_DIR_LIST (in collection_uri any, in recursive int)\n"
 "{\n"
 "declare res, uri_dict any;\n"
@@ -844,11 +866,12 @@ static const char *proc21 =
 "return res;\n"
 "}\n"
 "}\n"
-"--src system.sql:801\n";
+"--src system.sql:800\n";
 
 static const char *other0 = 
 "grant execute on XML_COLLECTION_DIR_LIST to public\n";
 static const char *proc22 = 
+"#line 868 \"[executable]/system.sql\"\n"
 "create procedure SYS_ALFANUM_NAME (in name varchar)\n"
 "{\n"
 "declare inx, c integer;\n"
@@ -864,9 +887,10 @@ static const char *proc22 =
 "}\n"
 "return name;\n"
 "}\n"
-"--src system.sql:867\n";
+"--src system.sql:866\n";
 
 static const char *proc23 = 
+"#line 907 \"[executable]/system.sql\"\n"
 " create procedure SYS_COPY_TABLE (in source_tbl varchar, in dest_tbl varchar)\n"
 "{\n"
 "declare src_meta, dest_meta any;\n"
@@ -918,9 +942,10 @@ static const char *proc23 =
 "}\n"
 "exec (sprintf (\'insert into \"%I\" (%s) select %s from \"%I\"\', dest_tbl, col_list, col_list, source_tbl));\n"
 "}\n"
-"--src system.sql:906\n";
+"--src system.sql:905\n";
 
 static const char *proc24 = 
+"#line 964 \"[executable]/system.sql\"\n"
 " create procedure ddl_pk_fill_pk_parts (in pk_id integer, in k_id integer, in n_k_parts integer)\n"
 "{\n"
 "declare n_pk integer;\n"
@@ -934,9 +959,10 @@ static const char *proc24 =
 "}\n"
 "}\n"
 "}\n"
-"--src system.sql:963\n";
+"--src system.sql:962\n";
 
 static const char *proc25 = 
+"#line 981 \"[executable]/system.sql\"\n"
 " create procedure ddl_pk_copy_inx (in tb varchar, in ntb varchar, in nk_id integer)\n"
 "{\n"
 "\n"
@@ -968,9 +994,10 @@ static const char *proc25 =
 "where KEY_ID = k_id;\n"
 "}\n"
 "}\n"
-"--src system.sql:980\n";
+"--src system.sql:979\n";
 
 static const char *proc26 = 
+"#line 1016 \"[executable]/system.sql\"\n"
 " create procedure ddl_pk_change_1 (in tb varchar, in cols any)\n"
 "{\n"
 "declare pk_id, nk_id, inx, cid integer;\n"
@@ -1032,9 +1059,10 @@ static const char *proc26 =
 "__ddl_changed (tname);\n"
 "DB.DBA.SYS_COPY_TABLE (tb, tname);\n"
 "}\n"
-"--src system.sql:1015\n";
+"--src system.sql:1014\n";
 
 static const char *proc27 = 
+"#line 1081 \"[executable]/system.sql\"\n"
 " create procedure ddl_pk_change_final (in tb varchar, in cols any)\n"
 "{\n"
 "declare st, msg, tname, tname_esc, tb_esc varchar;\n"
@@ -1052,9 +1080,10 @@ static const char *proc27 =
 "commit work;\n"
 "\n"
 "}\n"
-"--src system.sql:1080\n";
+"--src system.sql:1079\n";
 
 static const char *proc28 = 
+"#line 1102 \"[executable]/system.sql\"\n"
 " create procedure ddl_pk_modify_check (in tb varchar, in cols any)\n"
 "{\n"
 "declare inx integer;\n"
@@ -1075,9 +1104,10 @@ static const char *proc28 =
 "inx := inx + 1;\n"
 "}\n"
 "}\n"
-"--src system.sql:1101\n";
+"--src system.sql:1100\n";
 
 static const char *proc29 = 
+"#line 1126 \"[executable]/system.sql\"\n"
 " create procedure ddl_pk_is_changed (in tb varchar, in cols any) returns integer\n"
 "{\n"
 "declare inx integer;\n"
@@ -1106,9 +1136,10 @@ static const char *proc29 =
 "else\n"
 "return 0;\n"
 "}\n"
-"--src system.sql:1125\n";
+"--src system.sql:1124\n";
 
 static const char *proc30 = 
+"#line 1158 \"[executable]/system.sql\"\n"
 " create procedure ddl_pk_modify (in tb varchar, in cols any)\n"
 "{\n"
 "\n"
@@ -1149,9 +1180,10 @@ static const char *proc30 =
 "commit work;\n"
 "__atomic (0);\n"
 "}\n"
-"--src system.sql:1157\n";
+"--src system.sql:1156\n";
 
 static const char *proc31 = 
+"#line 1200 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.fk_check_input_values (in mod integer)\n"
 "{\n"
 "declare ret, ret1 any;\n"
@@ -1174,11 +1206,12 @@ static const char *proc31 =
 "signal (\'22023\', \'function fk_check_input_values expect -1, 0 or 1 as first parameter\', \'SR293\');\n"
 "return ret;\n"
 "}\n"
-"--src system.sql:1199\n";
+"--src system.sql:1198\n";
 
 static const char *other1 = 
 "DB.DBA.fk_check_input_values (-1)\n";
 static const char *proc32 = 
+"#line 1228 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.ddl_check_constraint (in pk_table varchar, in decl any)\n"
 "{\n"
 "declare inx, n_pc, n_pkc integer;\n"
@@ -1264,9 +1297,10 @@ static const char *proc32 =
 "inx := inx + 1;\n"
 "}\n"
 "}\n"
-"--src system.sql:1227\n";
+"--src system.sql:1226\n";
 
 static const char *proc33 = 
+"#line 1316 \"[executable]/system.sql\"\n"
 "create procedure ddl_fk_modify (in tb varchar, in op integer, in decl any)\n"
 "{\n"
 "declare pkt varchar;\n"
@@ -1360,9 +1394,10 @@ static const char *proc33 =
 "else\n"
 "signal (\'42S11\', \'To modify a foreign key first drop the old and then add the new\', \'SR300\');\n"
 "}\n"
-"--src system.sql:1315\n";
+"--src system.sql:1314\n";
 
 static const char *proc34 = 
+"#line 1412 \"[executable]/system.sql\"\n"
 " create procedure ddl_alter_constr (in tb varchar, in op integer, in decl any)\n"
 "{\n"
 "declare type integer;\n"
@@ -1415,9 +1450,10 @@ static const char *proc34 =
 "if (not sys_stat (\'st_lite_mode\'))\n"
 "__REPL_DDL_FK_MODIFY_PROPAGATE (tb, op, decl, orig_pkt);\n"
 "}\n"
-"--src system.sql:1411\n";
+"--src system.sql:1410\n";
 
 static const char *proc35 = 
+"#line 1466 \"[executable]/system.sql\"\n"
 "create procedure ddl_unq_modify (in tb varchar, in op integer, in decl any)\n"
 "{\n"
 "declare nconstr, txt, cols_txt, stat, msg varchar;\n"
@@ -1493,9 +1529,10 @@ static const char *proc35 =
 "else\n"
 "signal (\'37000\', \'To modify a unique constraint first drop the old and then add the new\', \'SR302\');\n"
 "}\n"
-"--src system.sql:1465\n";
+"--src system.sql:1464\n";
 
 static const char *proc36 = 
+"#line 1543 \"[executable]/system.sql\"\n"
 "create procedure ddl_check_modify (in tb varchar, in op integer, in decl any)\n"
 "{\n"
 "declare constr_name varchar;\n"
@@ -1562,9 +1599,10 @@ static const char *proc36 =
 "}\n"
 "__ddl_read_constraints (tb);\n"
 "}\n"
-"--src system.sql:1542\n";
+"--src system.sql:1541\n";
 
 static const char *proc37 = 
+"#line 1611 \"[executable]/system.sql\"\n"
 "create procedure __HTTP_XSLT (inout _XML any, inout DOC_URI varchar, inout XSLT_URI varchar, inout PARAMS any, inout MEDIATYPE varchar, inout ENC varchar)\n"
 "{\n"
 "declare result any;\n"
@@ -1582,9 +1620,10 @@ static const char *proc37 =
 "ENC := xml_tree_doc_encoding (result);\n"
 "http_value (result);\n"
 "}\n"
-"--src system.sql:1610\n";
+"--src system.sql:1609\n";
 
 static const char *proc38 = 
+"#line 1632 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.ddl_fk_rules (in pktb varchar, in drop_tb varchar, in drop_col varchar)\n"
 "{\n"
 "declare stmt, set_cl, whe_cl, updst, delst, thetb, pkcols, pkvars, trig_pref, skip_on_this varchar;\n"
@@ -1793,9 +1832,10 @@ static const char *proc38 =
 "DB.DBA.execstr (stmt);\n"
 "}\n"
 "}\n"
-"--src system.sql:1631\n";
+"--src system.sql:1630\n";
 
 static const char *proc39 = 
+"#line 1843 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.ddl_pk_check_input (in pktb varchar, in drop_tb varchar, in drop_col varchar)\n"
 "{\n"
 "declare uniq, trig_pref, vars, whe, uwhe, stmt, ins, upd, fktb, skip_on_this, pku varchar;\n"
@@ -1909,9 +1949,10 @@ static const char *proc39 =
 "DB.DBA.execstr (stmt);\n"
 "}\n"
 "}\n"
-"--src system.sql:1842\n";
+"--src system.sql:1841\n";
 
 static const char *proc40 = 
+"#line 1959 \"[executable]/system.sql\"\n"
 "create procedure execstr1 (in str varchar)\n"
 "{\n"
 "declare st, msg varchar;\n"
@@ -1925,9 +1966,10 @@ static const char *proc40 =
 "signal (st, msg);\n"
 "}\n"
 "}\n"
-"--src system.sql:1958\n";
+"--src system.sql:1957\n";
 
 static const char *proc41 = 
+"#line 1977 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.ddl_fk_check_input (in fktb varchar, in to_drop integer)\n"
 "{\n"
 "declare uniq, trig_pref, vars, whe, uwhe, stmt, ins, upd, pktb, nself, uself varchar;\n"
@@ -2011,9 +2053,10 @@ static const char *proc41 =
 "name_part (fktb, 0), name_part (fktb, 1), name_part (fktb,2)), upd, \'\\n}\\n\');\n"
 "DB.DBA.execstr1 (stmt);\n"
 "}\n"
-"--src system.sql:1976\n";
+"--src system.sql:1975\n";
 
 static const char *proc42 = 
+"#line 2090 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.col_check (in tb varchar, in col varchar)\n"
 "{\n"
 "if (not isstring (tb) or not isstring (col))\n"
@@ -2030,9 +2073,10 @@ static const char *proc42 =
 "close c;\n"
 "signal (\'42S22\', sprintf (\'The column \"%s\" is not defined in the given table\', col), \'SR084\');\n"
 "}\n"
-"--src system.sql:2089\n";
+"--src system.sql:2088\n";
 
 static const char *proc43 = 
+"#line 2108 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.col_of_type (in tb varchar, in col varchar, in type_needed int)\n"
 "{\n"
 "if (not isstring (tb) or not isstring (col))\n"
@@ -2050,7 +2094,7 @@ static const char *proc43 =
 "close c;\n"
 "return ret;\n"
 "}\n"
-"--src system.sql:2107\n";
+"--src system.sql:2106\n";
 
 static const char *other2 = 
 "charset_define (\'MIK\', N\'\\x1\\x2\\x3\\x4\\x5\\x6\\x7\\x8\\x9\\xA\\xB\\xC\\xD\\xE\\xF\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1A\\x1B\\x1C\\x1D\\x1E\\x1F\\x20\\x21\\x22\\x23\\x24\\x25\\x26\\x27\\x28\\x29\\x2A\\x2B\\x2C\\x2D\\x2E\\x2F\\x30\\x31\\x32\\x33\\x34\\x35\\x36\\x37\\x38\\x39\\x3A\\x3B\\x3C\\x3D\\x3E\\x3F\\x40\\x41\\x42\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4A\\x4B\\x4C\\x4D\\x4E\\x4F\\x50\\x51\\x52\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5A\\x5B\\x5C\\x5D\\x5E\\x5F\\x60\\x61\\x62\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6A\\x6B\\x6C\\x6D\\x6E\\x6F\\x70\\x71\\x72\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7A\\x7B\\x7C\\x7D\\x7E\\x7F\\x410\\x411\\x412\\x413\\x414\\x415\\x416\\x417\\x418\\x419\\x41A\\x41B\\x41C\\x41D\\x41E\\x41F\\x420\\x421\\x422\\x423\\x424\\x425\\x426\\x427\\x428\\x429\\x42A\\x42B\\x42C\\x42D\\x42E\\x42F\\x430\\x431\\x432\\x433\\x434\\x435\\x436\\x437\\x438\\x439\\x43A\\x43B\\x43C\\x43D\\x43E\\x43F\\x440\\x441\\x442\\x443\\x444\\x445\\x446\\x447\\x448\\x449\\x44A\\x44B\\x44C\\x44D\\x44E\\x44F\\x2514\\x2534\\x252C\\x251C\\x2500\\x253C\\x2563\\x2551\\x255A\\x2554\\x2569\\x2566\\x2560\\x2550\\x256C\\x2510\\x2591\\x2592\\x2593\\x2502\\x2524\\x2116\\xA7\\x2557\\x255D\\x2518\\x250C\\x2588\\x2584\\x258C\\x2590\\x2580\\x3B1\\x3B2\\x393\\x3C0\\x3A3\\x3C3\\x3BC\\x3C4\\x3A6\\x398\\x3A9\\x3B4\\x221E\\x2205\\x2208\\x2229\\x2261\\xB1\\x2265\\x2264\\x2320\\x2321\\xF7\\x2248\\xB0\\x2219\\xB7\\x221A\\x207F\\xB2\\x25A0\\xA0\', vector (\'999\', \'CP999\'))\n";
@@ -2123,6 +2167,7 @@ static const char *other35 =
 static const char *other36 = 
 "charset_define (\'MAC-UKRAINIAN\', N\'\\x1\\x2\\x3\\x4\\x5\\x6\\x7\\x8\\x9\\xA\\xB\\xC\\xD\\xE\\xF\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1A\\x1B\\x1C\\x1D\\x1E\\x1F\\x20\\x21\\x22\\x23\\x24\\x25\\x26\\x27\\x28\\x29\\x2A\\x2B\\x2C\\x2D\\x2E\\x2F\\x30\\x31\\x32\\x33\\x34\\x35\\x36\\x37\\x38\\x39\\x3A\\x3B\\x3C\\x3D\\x3E\\x3F\\x40\\x41\\x42\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4A\\x4B\\x4C\\x4D\\x4E\\x4F\\x50\\x51\\x52\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5A\\x5B\\x5C\\x5D\\x5E\\x5F\\x60\\x61\\x62\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6A\\x6B\\x6C\\x6D\\x6E\\x6F\\x70\\x71\\x72\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7A\\x7B\\x7C\\x7D\\x7E\\x7F\\x410\\x411\\x412\\x413\\x414\\x415\\x416\\x417\\x418\\x419\\x41A\\x41B\\x41C\\x41D\\x41E\\x41F\\x420\\x421\\x422\\x423\\x424\\x425\\x426\\x427\\x428\\x429\\x42A\\x42B\\x42C\\x42D\\x42E\\x42F\\x2020\\xB0\\x490\\xA3\\xA7\\x2022\\xB6\\x406\\xAE\\xA9\\x2122\\x402\\x452\\x2260\\x403\\x453\\x221E\\xB1\\x2264\\x2265\\x456\\xB5\\x491\\x408\\x404\\x454\\x407\\x457\\x409\\x459\\x40A\\x45A\\x458\\x405\\xAC\\x221A\\x192\\x2248\\x2206\\xAB\\xBB\\x2026\\xA0\\x40B\\x45B\\x40C\\x45C\\x455\\x2013\\x2014\\x201C\\x201D\\x2018\\x2019\\xF7\\x201E\\x40E\\x45E\\x40F\\x45F\\x2116\\x401\\x451\\x44F\\x430\\x431\\x432\\x433\\x434\\x435\\x436\\x437\\x438\\x439\\x43A\\x43B\\x43C\\x43D\\x43E\\x43F\\x440\\x441\\x442\\x443\\x444\\x445\\x446\\x447\\x448\\x449\\x44A\\x44B\\x44C\\x44D\\x44E\\xA4\', NULL)\n";
 static const char *proc44 = 
+"#line 2258 \"[executable]/system.sql\"\n"
 "create procedure\n"
 "scheduler_init ()\n"
 "{\n"
@@ -2131,11 +2176,12 @@ static const char *proc44 =
 "else\n"
 "registry_set (\'__scheduler_do_now__\', \'0\');\n"
 "}\n"
-"--src system.sql:2257\n";
+"--src system.sql:2256\n";
 
 static const char *other37 = 
 "scheduler_init ()\n";
 static const char *proc45 = 
+"#line 2272 \"[executable]/system.sql\"\n"
 " create procedure SYS_GENERATE_ALL_OPS (in col_name varchar, in col_dtp integer := 193)\n"
 "{\n"
 "declare func, args varchar;\n"
@@ -2163,9 +2209,10 @@ static const char *proc45 =
 "col_name,\n"
 "col_name);\n"
 "}\n"
-"--src system.sql:2271\n";
+"--src system.sql:2270\n";
 
 static const char *proc46 = 
+"#line 2303 \"[executable]/system.sql\"\n"
 " create procedure SYS_GENERATE_ALL_VARS (in col_name varchar, in rate varchar:=null, in n_dist_rate varchar:=null )\n"
 "{\n"
 "if (rate is null)\n"
@@ -2184,7 +2231,7 @@ static const char *proc46 =
 "}\n"
 "}\n"
 "}\n"
-"--src system.sql:2302\n";
+"--src system.sql:2301\n";
 
 static const char *tbl2 = 
 "create table SYS_STAT_VDB_MAPPERS (\n"
@@ -2217,6 +2264,7 @@ static const char *other39 =
 "\'%VIRTUOSO%\',\n"
 "\'%\')\n";
 static const char *proc47 = 
+"#line 2357 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.__ORACLE_SYS_COL_STAT (in DSN varchar, in RT_NAME varchar, in RT_REMOTE_NAME varchar)\n"
 "returns ANY\n"
 "{\n"
@@ -2244,9 +2292,10 @@ static const char *proc47 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src system.sql:2356\n";
+"--src system.sql:2355\n";
 
 static const char *proc48 = 
+"#line 2386 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.__VIRTUOSO_SYS_COL_STAT (in DSN varchar, in RT_NAME varchar, in RT_REMOTE_NAME varchar)\n"
 "returns ANY\n"
 "{\n"
@@ -2277,7 +2326,7 @@ static const char *proc48 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src system.sql:2385\n";
+"--src system.sql:2384\n";
 
 static const char *other40 = 
 " insert soft SYS_STAT_VDB_MAPPERS\n"
@@ -2291,6 +2340,7 @@ static const char *other40 =
 "\'%INFORMIX%\',\n"
 "\'%\')\n";
 static const char *proc49 = 
+"#line 2432 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.__INFORMIX_SYS_COL_STAT (in DSN varchar, in RT_NAME varchar, in RT_REMOTE_NAME varchar)\n"
 "{\n"
 "declare _meta, _res any;\n"
@@ -2373,9 +2423,10 @@ static const char *proc49 =
 "}\n"
 "return null;\n"
 "}\n"
-"--src system.sql:2431\n";
+"--src system.sql:2430\n";
 
 static const char *proc50 = 
+"#line 2516 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.__DB2_SYS_COL_STAT (in DSN varchar, in RT_NAME varchar, in RT_REMOTE_NAME varchar)\n"
 "returns ANY\n"
 "{\n"
@@ -2403,7 +2454,7 @@ static const char *proc50 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src system.sql:2515\n";
+"--src system.sql:2514\n";
 
 static const char *other41 = 
 " insert soft SYS_STAT_VDB_MAPPERS\n"
@@ -2417,6 +2468,7 @@ static const char *other41 =
 "\'%DB2%\',\n"
 "\'%\')\n";
 static const char *proc51 = 
+"#line 2558 \"[executable]/system.sql\"\n"
 "create procedure SYS_STAT_VDB_SYNC ()\n"
 "{\n"
 "declare _ds_conn_str any;\n"
@@ -2434,9 +2486,10 @@ static const char *proc51 =
 "}\n"
 "}\n"
 "}\n"
-"--src system.sql:2557\n";
+"--src system.sql:2556\n";
 
 static const char *proc52 = 
+"#line 2579 \"[executable]/system.sql\"\n"
 " create procedure SYS_STAT_ANALYZE_VDB (\n"
 "in _ds_dsn varchar,\n"
 "in _rt_remote_name varchar,\n"
@@ -2558,9 +2611,10 @@ static const char *proc52 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src system.sql:2578\n";
+"--src system.sql:2577\n";
 
 static const char *proc53 = 
+"#line 2704 \"[executable]/system.sql\"\n"
 " create procedure SYS_STAT_ANALYZE (in tb_name varchar, in pcnt integer:=5, in ignore_vdb integer:=1)\n"
 "{\n"
 "declare stmt, proc_name varchar;\n"
@@ -2765,9 +2819,10 @@ static const char *proc53 =
 "exec (sprintf (\'%s ()\', proc_name), NULL, NULL);\n"
 "exec (sprintf (\'drop procedure %s\', proc_name), NULL, NULL);\n"
 "}\n"
-"--src system.sql:2703\n";
+"--src system.sql:2702\n";
 
 static const char *proc54 = 
+"#line 2912 \"[executable]/system.sql\"\n"
 " create procedure SYS_DB_STAT (in pcnt integer:=null, in ignore_vdb integer:=1)\n"
 "{\n"
 "declare cnt integer;\n"
@@ -2785,9 +2840,10 @@ static const char *proc54 =
 "}\n"
 "return cnt;\n"
 "}\n"
-"--src system.sql:2911\n";
+"--src system.sql:2910\n";
 
 static const char *proc55 = 
+"#line 2932 \"[executable]/system.sql\"\n"
 " create procedure SYS_STAT_HISTOGRAM (in tb_name varchar, in col_name varchar,\n"
 "in n_buckets integer, in prec integer := 1)\n"
 "{\n"
@@ -2869,7 +2925,7 @@ static const char *proc55 =
 "if (is_analyzed = 0)\n"
 "DB..SYS_STAT_ANALYZE (tb_name, prec);\n"
 "}\n"
-"--src system.sql:2931\n";
+"--src system.sql:2930\n";
 
 static const char *tbl3 = 
 "create table\n"
@@ -2882,6 +2938,7 @@ static const char *tbl3 =
 "alter index SYS_SOAP_DATATYPES on DB.DBA.SYS_SOAP_DATATYPES partition cluster replicated\n";
 
 static const char *proc56 = 
+"#line 3049 \"[executable]/system.sql\"\n"
 "create procedure\n"
 "soap_dt_define (in name varchar, in sch varchar, in udt_name varchar := null)\n"
 "{\n"
@@ -2934,9 +2991,10 @@ static const char *proc56 =
 "__soap_dt_define (name, xt, xte, is_elem, udt_name);\n"
 "return name;\n"
 "}\n"
-"--src system.sql:3048\n";
+"--src system.sql:3047\n";
 
 static const char *proc57 = 
+"#line 3106 \"[executable]/system.sql\"\n"
 " create procedure SET_IDENTITY_COLUMN (in tbl_name varchar, in col_name varchar, in num integer)\n"
 "{\n"
 "if (not exists (select 1 from DB.DBA.SYS_COLS where \"TABLE\" = tbl_name and \"COLUMN\" = col_name))\n"
@@ -2949,9 +3007,10 @@ static const char *proc57 =
 "return sequence_set (concat (name_part (tbl_name, 0, \'DB\'), \'.\',\n"
 "name_part (tbl_name, 1, user), \'.\', tbl_name, \'.\', col_name), num, 0);\n"
 "}\n"
-"--src system.sql:3105\n";
+"--src system.sql:3104\n";
 
 static const char *proc58 = 
+"#line 3121 \"[executable]/system.sql\"\n"
 " create procedure GET_IDENTITY_COLUMN (in tbl_name varchar, in col_name varchar, in no_check int := 0)\n"
 "{\n"
 "if (no_check = 0 and not exists (select 1 from DB.DBA.SYS_COLS where \"TABLE\" = tbl_name and \"COLUMN\" = col_name))\n"
@@ -2964,11 +3023,12 @@ static const char *proc58 =
 "return sequence_set (concat (name_part (tbl_name, 0, \'DB\'), \'.\',\n"
 "name_part (tbl_name, 1, user), \'.\', tbl_name, \'.\', col_name), 0, 2);\n"
 "}\n"
-"--src system.sql:3120\n";
+"--src system.sql:3119\n";
 
 static const char *other42 = 
 "xml_add_system_path(\'file://system/\')\n";
 static const char *proc59 = 
+"#line 3139 \"[executable]/system.sql\"\n"
 "create procedure\n"
 "DAV_USER_SET_PASSWORD (in name varchar, in passwd varchar)\n"
 "{\n"
@@ -2984,9 +3044,10 @@ static const char *proc59 =
 "\n"
 "\n"
 "}\n"
-"--src system.sql:3138\n";
+"--src system.sql:3137\n";
 
 static const char *proc60 = 
+"#line 3157 \"[executable]/system.sql\"\n"
 " create procedure DB.DBA.HTTP_CLIENT (\n"
 "in url varchar,\n"
 "in uid varchar := null,\n"
@@ -3014,9 +3075,10 @@ static const char *proc60 =
 "}\n"
 "return http_client_internal (url, uid, pwd, http_method, http_headers, body, cert_file, cert_pwd, null, timeout, proxy, ca_certs, insecure, n_redirects);\n"
 "}\n"
-"--src system.sql:3156\n";
+"--src system.sql:3155\n";
 
 static const char *proc61 = 
+"#line 3187 \"[executable]/system.sql\"\n"
 " create procedure DB.DBA.HTTP_CLIENT_EXT (\n"
 "in url varchar,\n"
 "in uid varchar := null,\n"
@@ -3045,9 +3107,10 @@ static const char *proc61 =
 "}\n"
 "return http_client_internal (url, uid, pwd, http_method, http_headers, body, cert_file, cert_pwd, headers, timeout, proxy, ca_certs, insecure, n_redirects);\n"
 "}\n"
-"--src system.sql:3186\n";
+"--src system.sql:3185\n";
 
 static const char *proc62 = 
+"#line 3219 \"[executable]/system.sql\"\n"
 " create procedure SQL_PROCEDURE_COLUMNSW (\n"
 "in qual varchar,\n"
 "in owner varchar,\n"
@@ -3135,9 +3198,10 @@ static const char *proc62 =
 "}\n"
 "}\n"
 "}\n"
-"--src system.sql:3218\n";
+"--src system.sql:3217\n";
 
 static const char *proc63 = 
+"#line 3310 \"[executable]/system.sql\"\n"
 "create procedure\n"
 "DB.DBA.__XML_TEMPLATE (in path any, in params any, in lines any, in enc any := null)\n"
 "{\n"
@@ -3188,9 +3252,10 @@ static const char *proc63 =
 "}\n"
 "__pop_user_id ();\n"
 "}\n"
-"--src system.sql:3309\n";
+"--src system.sql:3308\n";
 
 static const char *proc64 = 
+"#line 3543 \"[executable]/system.sql\"\n"
 " create procedure\n"
 "DB.DBA.XQ_TEMPLATE (inout q varchar, inout ctx varchar, inout ses any, inout map_schema any)\n"
 "{\n"
@@ -3220,9 +3285,10 @@ static const char *proc64 =
 "i := i + 1;\n"
 "}\n"
 "}\n"
-"--src system.sql:3542\n";
+"--src system.sql:3541\n";
 
 static const char *proc65 = 
+"#line 3575 \"[executable]/system.sql\"\n"
 " create procedure\n"
 "DB.DBA.SQLX_OR_SPARQL_TEMPLATE (inout q varchar, inout params any, inout ses any, inout q_type any)\n"
 "{\n"
@@ -3272,7 +3338,7 @@ static const char *proc65 =
 "params := 0;\n"
 "return;\n"
 "}\n"
-"--src system.sql:3574\n";
+"--src system.sql:3573\n";
 
 static const char *other43 = 
 "xslt_sheet (\'__xml_template_default\', xml_tree_doc (xml_tree(\n"
@@ -3309,6 +3375,7 @@ static const char *other43 =
 "</xsl:stylesheet>\'))\n"
 ")\n";
 static const char *proc66 = 
+"#line 3665 \"[executable]/system.sql\"\n"
 "create procedure\n"
 "cov_store (in f varchar, in add_line integer := 0)\n"
 "{\n"
@@ -3364,9 +3431,10 @@ static const char *proc66 =
 "http (\'</pl_stats>\', ses);\n"
 "string_to_file (f, ses, -2);\n"
 "}\n"
-"--src system.sql:3664\n";
+"--src system.sql:3663\n";
 
 static const char *proc67 = 
+"#line 3723 \"[executable]/system.sql\"\n"
 "create procedure\n"
 "cov_load (in f varchar)\n"
 "{\n"
@@ -3422,9 +3490,10 @@ static const char *proc67 =
 "i := i + 1;\n"
 "}\n"
 "}\n"
-"--src system.sql:3722\n";
+"--src system.sql:3721\n";
 
 static const char *proc68 = 
+"#line 3781 \"[executable]/system.sql\"\n"
 "create procedure\n"
 "cov_report (in f varchar, in odir varchar)\n"
 "{\n"
@@ -3469,9 +3538,10 @@ static const char *proc68 =
 "http_value (r, null, s);\n"
 "string_to_file (concat(odir,\'profile\',\'.prof\'), s, -2);\n"
 "}\n"
-"--src system.sql:3780\n";
+"--src system.sql:3779\n";
 
 static const char *proc69 = 
+"#line 3829 \"[executable]/system.sql\"\n"
 "create procedure\n"
 "vd_remote_proc_wrapper (in _dsn varchar, in pro varchar, in dest varchar, in meta any, out state varchar, out msg varchar, in make_rset integer := 0, in descr varchar := \'\')\n"
 "{\n"
@@ -3618,11 +3688,12 @@ static const char *proc69 =
 "state := \'00000\';\n"
 "exec (stmt1, state, msg);\n"
 "}\n"
-"--src system.sql:3828\n";
+"--src system.sql:3827\n";
 
 static const char *other44 = 
 "update SYS_COLS set COL_PREC = 2147483647 where COL_DTP = 125 and COL_PREC < 2147483647\n";
 static const char *proc70 = 
+"#line 3981 \"[executable]/system.sql\"\n"
 "create procedure EXEC_STMT (in stmt_text varchar, in mode integer)\n"
 "{\n"
 "declare state, msg varchar;\n"
@@ -3633,9 +3704,10 @@ static const char *proc70 =
 "\n"
 "exec (stmt_text, state, msg, vector (), 100, meta, res);\n"
 "}\n"
-"--src system.sql:3980\n";
+"--src system.sql:3979\n";
 
 static const char *proc71 = 
+"#line 3993 \"[executable]/system.sql\"\n"
 "create procedure EXEC_AS (in stmt_text varchar, in uname varchar, in mode integer := 0)\n"
 "{\n"
 "declare state, msg varchar;\n"
@@ -3648,9 +3720,10 @@ static const char *proc71 =
 "\n"
 "exec (stmt_text, state, msg, vector (), 100, meta, res);\n"
 "}\n"
-"--src system.sql:3992\n";
+"--src system.sql:3991\n";
 
 static const char *proc72 = 
+"#line 4009 \"[executable]/system.sql\"\n"
 " create procedure RSTMTEXEC (in dsn varchar, in stmt varchar, in max_rows integer := 0, in params_array any := null)\n"
 "{\n"
 "declare stmt_compilation, cursor_handle, curr_row any;\n"
@@ -3678,9 +3751,10 @@ static const char *proc72 =
 "done:\n"
 "rclose (cursor_handle);\n"
 "}\n"
-"--src system.sql:4008\n";
+"--src system.sql:4007\n";
 
 static const char *proc73 = 
+"#line 4039 \"[executable]/system.sql\"\n"
 "create procedure FTI_MAKE_SEARCH_STRING_INNER (in exp varchar, inout words any)\n"
 "{\n"
 "declare exp1 varchar;\n"
@@ -3765,15 +3839,16 @@ static const char *proc73 =
 "end_parse:\n"
 "return exp1;\n"
 "}\n"
-"--src system.sql:4038\n";
+"--src system.sql:4037\n";
 
 static const char *proc74 = 
+"#line 4125 \"[executable]/system.sql\"\n"
 "create procedure FTI_MAKE_SEARCH_STRING (in exp varchar)\n"
 "{\n"
 "declare words any;\n"
 "return FTI_MAKE_SEARCH_STRING_INNER (exp, words);\n"
 "}\n"
-"--src system.sql:4124\n";
+"--src system.sql:4123\n";
 
 static const char *tbl4 = 
 "create table DB.DBA.CLR_VAC (\n"
@@ -3791,12 +3866,13 @@ static const char *tbl4 =
 static const char *other45 = 
 " exec_quiet (\'create type __ANY as (__any any)\')\n";
 static const char *proc75 = 
+"#line 4151 \"[executable]/system.sql\"\n"
 "create procedure exec_quiet (in expn varchar)\n"
 "{\n"
 "declare sta, msg varchar;\n"
 "exec (expn, sta, msg);\n"
 "}\n"
-"--src system.sql:4150\n";
+"--src system.sql:4149\n";
 
 static const char *other46 = 
 "exec_quiet (\'create type __ANY as (__any any)\')\n";
@@ -4152,17 +4228,19 @@ static const char *other76 =
 "}\n";
 
 static const char *proc76 = 
+"#line 4551 \"[executable]/system.sql\"\n"
 " create function createXML (in _src any, in _schema varchar := null, in _validated integer := 0, in _wellformed integer := 0) returns XMLType\n"
 "{\n"
 "declare _res XMLType;\n"
 "_res := XMLType (_src, _schema, _validated, _wellformed);\n"
 "return _res;\n"
 "}\n"
-"--src system.sql:4550\n";
+"--src system.sql:4549\n";
 
 static const char *other77 = 
 "grant execute on XMLType to public\n";
 static const char *proc77 = 
+"#line 4563 \"[executable]/system.sql\"\n"
 " create procedure DB.DBA.SYS_CREATE_XML_SCHEMA (in _txt varchar)\n"
 "{\n"
 "declare _log varchar;\n"
@@ -4187,9 +4265,10 @@ static const char *proc77 =
 "insert into SYS_CACHED_RESOURCES (CRES_URI, CRES_CONTENT)\n"
 "values (_cres_uri, _txt);\n"
 "}\n"
-"--src system.sql:4562\n";
+"--src system.sql:4561\n";
 
 static const char *proc78 = 
+"#line 4590 \"[executable]/system.sql\"\n"
 " create procedure DB.DBA.XML_COLUMN_SCHEMA_VALIDATE (\n"
 "in _table varchar, in _column varchar, in _xml any,\n"
 "in _xsd_uri varchar, in _top_name varchar, in _dtd_cfg varchar)\n"
@@ -4208,9 +4287,10 @@ static const char *proc78 =
 "\n"
 "return null;\n"
 "}\n"
-"--src system.sql:4589\n";
+"--src system.sql:4588\n";
 
 static const char *proc79 = 
+"#line 4611 \"[executable]/system.sql\"\n"
 " create function SYS_TREE_OF_ARRAYS_CONTAINS (in _haystack any, in _needle any)\n"
 "{\n"
 "declare _ctr integer;\n"
@@ -4227,9 +4307,10 @@ static const char *proc79 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src system.sql:4610\n";
+"--src system.sql:4609\n";
 
 static const char *proc80 = 
+"#line 4630 \"[executable]/system.sql\"\n"
 " create procedure DB.DBA.SYS_DROP_XML_SCHEMA (in _target_ns varchar)\n"
 "{\n"
 "declare _log varchar;\n"
@@ -4245,9 +4326,10 @@ static const char *proc80 =
 "signal (\'XSD01\', sprintf (\'Can not DROP XML SCHEMA \"%s\" because the schema is in use in constraint of table %s\', _target_ns, C_TABLE));\n"
 "delete from SYS_CACHED_RESOURCES where CRES_URI =_cres_uri;\n"
 "}\n"
-"--src system.sql:4629\n";
+"--src system.sql:4628\n";
 
 static const char *proc81 = 
+"#line 4648 \"[executable]/system.sql\"\n"
 " create procedure REGEXP_LIKE (in source_string any, in pattern any, in match_parameter integer := null)\n"
 "returns integer\n"
 "{\n"
@@ -4264,9 +4346,10 @@ static const char *proc81 =
 "}\n"
 "return either (isnull (regexp_match (pattern, source_string)), 0, 1);\n"
 "}\n"
-"--src system.sql:4647\n";
+"--src system.sql:4646\n";
 
 static const char *proc82 = 
+"#line 4668 \"[executable]/system.sql\"\n"
 " create procedure REGEXP_REPLACE (in source_string any, in pattern any,\n"
 "in replace_string varchar := \'\', in position integer := 1,\n"
 "in occurrence any := 1, in match_parameter integer := null)\n"
@@ -4362,9 +4445,10 @@ static const char *proc82 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src system.sql:4667\n";
+"--src system.sql:4666\n";
 
 static const char *proc83 = 
+"#line 4767 \"[executable]/system.sql\"\n"
 " create procedure REGEXP_INSTR (in source_string varchar, in pattern varchar,\n"
 "in start_position integer := 1, in occurrence integer := 1, in return_option integer := 0,\n"
 "in match_parameter integer := null)\n"
@@ -4418,9 +4502,10 @@ static const char *proc83 =
 "\n"
 "return null;\n"
 "}\n"
-"--src system.sql:4766\n";
+"--src system.sql:4765\n";
 
 static const char *proc84 = 
+"#line 4823 \"[executable]/system.sql\"\n"
 " create procedure HTTP_REQUESTED_URL ()\n"
 "{\n"
 "declare hf, pat, proto, meth, so, eo, lines any;\n"
@@ -4436,18 +4521,20 @@ static const char *proc84 =
 "hf := rfc1808_parse_uri (pat);\n"
 "return WS.WS.EXPAND_URL(soap_current_url (), hf[2]);\n"
 "}\n"
-"--src system.sql:4822\n";
+"--src system.sql:4821\n";
 
 static const char *proc85 = 
+"#line 4841 \"[executable]/system.sql\"\n"
 " create procedure HTTP_URL_HANDLER ()\n"
 "{\n"
 "if (not is_http_ctx())\n"
 "signal (\'22023\', \'http_url_handler function outside of http context\', \'HT068\');\n"
 "return WS.WS.EXPAND_URL(soap_current_url (), http_path());\n"
 "}\n"
-"--src system.sql:4840\n";
+"--src system.sql:4839\n";
 
 static const char *proc86 = 
+"#line 4851 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.SCHEDULER_NOTIFY ()\n"
 "{\n"
 "declare arr, err_text, current_rec, mime_parts, hdrs, hostname any;\n"
@@ -4511,9 +4598,10 @@ static const char *proc86 =
 "smtp_send (null, current_rec, current_rec, concat (hdrs, DB.DBA.MIME_BODY (mime_parts)));\n"
 "}\n"
 "}\n"
-"--src system.sql:4850\n";
+"--src system.sql:4849\n";
 
 static const char *proc87 = 
+"#line 4917 \"[executable]/system.sql\"\n"
 "create procedure\n"
 "SYS_CHECK_OLD_BLOG ()\n"
 "{\n"
@@ -4530,11 +4618,12 @@ static const char *proc87 =
 "log_message (\'Detected old blog instance. Please update it with latest blog.vad\');\n"
 "}\n"
 "}\n"
-"--src system.sql:4916\n";
+"--src system.sql:4915\n";
 
 static const char *other78 = 
 "SYS_CHECK_OLD_BLOG ()\n";
 static const char *proc88 = 
+"#line 4940 \"[executable]/system.sql\"\n"
 " create procedure\n"
 "HTTP_GET_HOST ()\n"
 "{\n"
@@ -4552,25 +4641,28 @@ static const char *proc88 =
 "ret := sys_stat (\'st_host_name\')||\':\'||server_http_port ();\n"
 "return ret;\n"
 "}\n"
-"--src system.sql:4939\n";
+"--src system.sql:4938\n";
 
 static const char *proc89 = 
+"#line 4960 \"[executable]/system.sql\"\n"
 " create procedure\n"
 "date_rfc1123 (in dt datetime)\n"
 "{\n"
 "return soap_print_box (dt, \'\', 1);\n"
 "}\n"
-"--src system.sql:4959\n";
+"--src system.sql:4958\n";
 
 static const char *proc90 = 
+"#line 4968 \"[executable]/system.sql\"\n"
 " create procedure\n"
 "date_iso8601 (in dt datetime)\n"
 "{\n"
 "return soap_print_box (dt, \'\', 0);\n"
 "}\n"
-"--src system.sql:4967\n";
+"--src system.sql:4966\n";
 
 static const char *proc91 = 
+"#line 4975 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.INSTALLER_VAD (in _pak_name varchar)\n"
 "{\n"
 "declare state, msg, m_dta, res any;\n"
@@ -4605,9 +4697,10 @@ static const char *proc91 =
 "string_to_file (\'../vad/install.res\', out_message, -2);\n"
 "return;\n"
 "}\n"
-"--src system.sql:4974\n";
+"--src system.sql:4973\n";
 
 static const char *proc92 = 
+"#line 5011 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.VACUUM (in table_name varchar := \'%\', in index_name varchar := \'%\')\n"
 "{\n"
 "declare stmt, stat, msg varchar;\n"
@@ -4630,9 +4723,10 @@ static const char *proc92 =
 "}\n"
 "}\n"
 "}\n"
-"--src system.sql:5010\n";
+"--src system.sql:5009\n";
 
 static const char *proc93 = 
+"#line 5037 \"[executable]/system.sql\"\n"
 "create procedure tc_result (in n varchar, in is_cl int := 0)\n"
 "{\n"
 "declare r int;\n"
@@ -4647,9 +4741,10 @@ static const char *proc93 =
 "return;\n"
 "result (r, n);\n"
 "}\n"
-"--src system.sql:5036\n";
+"--src system.sql:5035\n";
 
 static const char *proc94 = 
+"#line 5053 \"[executable]/system.sql\"\n"
 "create procedure tc_stat (in is_cl int := 0)\n"
 "{\n"
 "declare cond varchar (60);\n"
@@ -4750,9 +4845,10 @@ static const char *proc94 =
 "tc_result (\'tc_cl_kill_1pc\', is_cl);\n"
 "tc_result (\'tc_cl_kill_2pc\', is_cl);\n"
 "}\n"
-"--src system.sql:5052\n";
+"--src system.sql:5051\n";
 
 static const char *proc95 = 
+"#line 5155 \"[executable]/system.sql\"\n"
 "create procedure cl_exec_srv (in str varchar, in params any)\n"
 "{\n"
 "declare st, msg varchar;\n"
@@ -4760,9 +4856,10 @@ static const char *proc95 =
 "exec (str, st, msg, params);\n"
 "if (st <> \'00000\') signal (st, msg);\n"
 "}\n"
-"--src system.sql:5154\n";
+"--src system.sql:5153\n";
 
 static const char *proc96 = 
+"#line 5165 \"[executable]/system.sql\"\n"
 "create procedure daq_results (in daq any)\n"
 "{\n"
 "declare r any;\n"
@@ -4781,9 +4878,10 @@ static const char *proc96 =
 "}\n"
 "}\n"
 "}\n"
-"--src system.sql:5164\n";
+"--src system.sql:5163\n";
 
 static const char *proc97 = 
+"#line 5186 \"[executable]/system.sql\"\n"
 "create procedure cl_all_hosts ()\n"
 "{\n"
 "declare map, inx, hosts any;\n"
@@ -4796,9 +4894,10 @@ static const char *proc97 =
 "}\n"
 "return hosts;\n"
 "}\n"
-"--src system.sql:5185\n";
+"--src system.sql:5184\n";
 
 static const char *proc98 = 
+"#line 5200 \"[executable]/system.sql\"\n"
 "create procedure cl_exec (in str varchar, in params any := null, in txn int := 0, in hosts any := null, in delay float := null, in best_effort int := 0,\n"
 "in control int := 0, in as_read int := 0)\n"
 "{\n"
@@ -4838,18 +4937,20 @@ static const char *proc98 =
 "daq_call (d, \'__ALL\', hosts, \'DB.DBA.CL_EXEC_SRV\', vector (str, params), flags);\n"
 "daq_results (d);\n"
 "}\n"
-"--src system.sql:5199\n";
+"--src system.sql:5198\n";
 
 static const char *proc99 = 
+"#line 5241 \"[executable]/system.sql\"\n"
 "create procedure CL_STAT_SRV (in x varchar, in k varchar, in fl varchar)\n"
 "{\n"
 "if (k is not null)\n"
 "return key_stat (x, k, fl);\n"
 "return sys_stat (x);\n"
 "}\n"
-"--src system.sql:5240\n";
+"--src system.sql:5239\n";
 
 static const char *proc100 = 
+"#line 5250 \"[executable]/system.sql\"\n"
 "create procedure daq_next_or_error (in daq any)\n"
 "{\n"
 "declare r, err any;\n"
@@ -4866,9 +4967,10 @@ static const char *proc100 =
 "\n"
 "return r[2][1];\n"
 "}\n"
-"--src system.sql:5249\n";
+"--src system.sql:5248\n";
 
 static const char *proc101 = 
+"#line 5268 \"[executable]/system.sql\"\n"
 "create procedure cl_sys_stat (in x varchar, in  k varchar := null, in fl varchar := null)\n"
 "{\n"
 "declare daq, r any;\n"
@@ -4895,34 +4997,38 @@ static const char *proc101 =
 "}\n"
 "return s;\n"
 "}\n"
-"--src system.sql:5267\n";
+"--src system.sql:5266\n";
 
 static const char *proc102 = 
+"#line 5296 \"[executable]/system.sql\"\n"
 "create procedure IF_CLUSTER (in str varchar)\n"
 "{\n"
 "if (sys_stat (\'cl_run_local_only\') <> 2) return;\n"
 "str := trim (str, \';\');\n"
 "exec (str);\n"
 "}\n"
-"--src system.sql:5295\n";
+"--src system.sql:5294\n";
 
 static const char *proc103 = 
+"#line 5304 \"[executable]/system.sql\"\n"
 "create procedure IF_NO_CLUSTER (in str varchar)\n"
 "{\n"
 "if (sys_stat (\'cl_run_local_only\') = 2) return;\n"
 "str := trim (str, \';\');\n"
 "exec (str);\n"
 "}\n"
-"--src system.sql:5303\n";
+"--src system.sql:5302\n";
 
 static const char *proc104 = 
+"#line 5313 \"[executable]/system.sql\"\n"
 "create procedure CL_START_SRV ()\n"
 "{\n"
 "return sys_stat (\'db_exists\');\n"
 "}\n"
-"--src system.sql:5312\n";
+"--src system.sql:5311\n";
 
 static const char *proc105 = 
+"#line 5319 \"[executable]/system.sql\"\n"
 "create procedure cl_init_seqs ()\n"
 "{\n"
 "\n"
@@ -4944,9 +5050,10 @@ static const char *proc105 =
 "}\n"
 "commit work;\n"
 "}\n"
-"--src system.sql:5318\n";
+"--src system.sql:5317\n";
 
 static const char *proc106 = 
+"#line 5343 \"[executable]/system.sql\"\n"
 "create procedure cl_reset_seqs ()\n"
 "{\n"
 "\n"
@@ -4963,9 +5070,10 @@ static const char *proc106 =
 "}\n"
 "rdf_seq_init_srv ();\n"
 "}\n"
-"--src system.sql:5342\n";
+"--src system.sql:5341\n";
 
 static const char *proc107 = 
+"#line 5361 \"[executable]/system.sql\"\n"
 "create procedure cl_new_db ()\n"
 "{\n"
 "cl_init_seqs ();\n"
@@ -4978,9 +5086,10 @@ static const char *proc107 =
 "WS.WS.SYS_DAV_INIT ();\n"
 "cl_exec (\'checkpoint\');\n"
 "}\n"
-"--src system.sql:5360\n";
+"--src system.sql:5359\n";
 
 static const char *proc108 = 
+"#line 5376 \"[executable]/system.sql\"\n"
 "create procedure cl_node_started ()\n"
 "{\n"
 "if (sys_stat (\'cl_run_local_only\') = 1)\n"
@@ -5002,9 +5111,10 @@ static const char *proc108 =
 "}\n"
 "}\n"
 "}\n"
-"--src system.sql:5375\n";
+"--src system.sql:5374\n";
 
 static const char *proc109 = 
+"#line 5400 \"[executable]/system.sql\"\n"
 "create procedure ddl_ren_k_new_name (in kn varchar, in o varchar, in n varchar)\n"
 "{\n"
 "if (name_part (kn, 2) = name_part (o, 2))\n"
@@ -5012,17 +5122,19 @@ static const char *proc109 =
 "else\n"
 "return kn;\n"
 "}\n"
-"--src system.sql:5399\n";
+"--src system.sql:5398\n";
 
 static const char *proc110 = 
+"#line 5410 \"[executable]/system.sql\"\n"
 "create procedure DB.DBA.DDL_TABLE_RENAMED (in o varchar, in n varchar)\n"
 "{\n"
 "__ddl_table_renamed (o, n);\n"
 "log_text (\'__ddl_table_renamed (?, ?)\', o, n);\n"
 "}\n"
-"--src system.sql:5409\n";
+"--src system.sql:5408\n";
 
 static const char *proc111 = 
+"#line 5418 \"[executable]/system.sql\"\n"
 "create procedure rename_table (in n varchar, in o varchar)\n"
 "{\n"
 "if (exists (select 1 from SYS_KEYS where KEY_TABLE = n)) {\n"
@@ -5053,9 +5165,10 @@ static const char *proc111 =
 "where PART_TABLE = o;\n"
 "cl_exec (\'DB.DBA.ddl_table_renamed (?, ?)\', vector (o, n), txn => 1);\n"
 "}\n"
-"--src system.sql:5417\n";
+"--src system.sql:5416\n";
 
 static const char *proc112 = 
+"#line 5451 \"[executable]/system.sql\"\n"
 "create procedure VT_GET_CLUSTER (in tablename varchar, in k varchar)\n"
 "{\n"
 "declare ret any;\n"
@@ -5067,9 +5180,10 @@ static const char *proc112 =
 "return \'\';\n"
 "return \' cluster \' || ret;\n"
 "}\n"
-"--src system.sql:5450\n";
+"--src system.sql:5449\n";
 
 static const char *proc113 = 
+"#line 5464 \"[executable]/system.sql\"\n"
 "create procedure VT_GET_CLUSTER_COL_OPTS (in tablename varchar, in k varchar, in col varchar)\n"
 "{\n"
 "declare opts, ret any;\n"
@@ -5102,9 +5216,10 @@ static const char *proc113 =
 "}\n"
 "return ret;\n"
 "}\n"
-"--src system.sql:5463\n";
+"--src system.sql:5462\n";
 
 static const char *proc114 = 
+"#line 5498 \"[executable]/system.sql\"\n"
 "create procedure\n"
 "DB.DBA.SYS_SQL_VECTOR_PRINT (in in_vector any)\n"
 "{\n"
@@ -5127,9 +5242,10 @@ static const char *proc114 =
 "}\n"
 "return (res);\n"
 "}\n"
-"--src system.sql:5497\n";
+"--src system.sql:5496\n";
 
 static const char *proc115 = 
+"#line 5522 \"[executable]/system.sql\"\n"
 "create procedure\n"
 "DB.DBA.SYS_SQL_VAL_PRINT (in v any)\n"
 "{\n"
@@ -5151,9 +5267,10 @@ static const char *proc115 =
 "else\n"
 "signal (\'22023\', sprintf(\'Unsupported type %d\', __tag (v)));\n"
 "}\n"
-"--src system.sql:5521\n";
+"--src system.sql:5520\n";
 
 static const char *proc116 = 
+"#line 5548 \"[executable]/system.sql\"\n"
 "create procedure view_from_tbl (in _dir varchar, in _tbls any)\n"
 "{\n"
 "declare create_class_stmt, create_view_stmt, prefix, ns, uriqa_str, ret any;\n"
@@ -5187,9 +5304,10 @@ static const char *proc116 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src system.sql:5547\n";
+"--src system.sql:5546\n";
 
 static const char *proc117 = 
+"#line 5584 \"[executable]/system.sql\"\n"
 "create procedure view_create_view (in _tbls any, in _dir varchar)\n"
 "{\n"
 "declare ret, qual, qual_l, tbl_name, tbl_name_l, pks, pk_text, uriqa_str any;\n"
@@ -5277,27 +5395,30 @@ static const char *proc117 =
 "return ret;\n"
 "\n"
 "}\n"
-"--src system.sql:5583\n";
+"--src system.sql:5582\n";
 
 static const char *proc118 = 
+"#line 5673 \"[executable]/system.sql\"\n"
 "create procedure view_dv_to_printf_str_type (in _dv varchar)\n"
 "{\n"
 "if (_dv = 189 or _dv = 188) return \'%d\';\n"
 "if (_dv = 182) return \'%U\';\n"
 "signal (\'XXXXX\', sprintf (\'Unknown DV %i in view_dv_to_printf_str_type\', _dv));\n"
 "}\n"
-"--src system.sql:5672\n";
+"--src system.sql:5671\n";
 
 static const char *proc119 = 
+"#line 5681 \"[executable]/system.sql\"\n"
 "create procedure view_dv_to_sql_str_type (in _dv varchar)\n"
 "{\n"
 "if (_dv = 189 or _dv = 188) return \'integer\';\n"
 "if (_dv = 182) return \'varchar\';\n"
 "signal (\'XXXXX\', sprintf (\'Unknown DV %i\', _dv));\n"
 "}\n"
-"--src system.sql:5680\n";
+"--src system.sql:5679\n";
 
 static const char *proc120 = 
+"#line 5689 \"[executable]/system.sql\"\n"
 "create procedure view_create_class (in _tbl varchar, in _host varchar, in _f varchar)\n"
 "{\n"
 "declare ret, qual, tbl_name, tbl_name_l, pks, pk_text, sk_len any;\n"
@@ -5329,23 +5450,26 @@ static const char *proc120 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src system.sql:5688\n";
+"--src system.sql:5687\n";
 
 static const char *proc121 = 
+"#line 5722 \"[executable]/system.sql\"\n"
 "create procedure view_get_primary_key (in _tbl varchar)\n"
 "{\n"
 "return DB.DBA.REPL_PK_COLS (_tbl);\n"
 "}\n"
-"--src system.sql:5721\n";
+"--src system.sql:5720\n";
 
 static const char *proc122 = 
+"#line 5728 \"[executable]/system.sql\"\n"
 "create procedure view_get_pk (in _tbl varchar)\n"
 "{\n"
 "return DB.DBA.REPL_PK_COLS (_tbl)[0][0];\n"
 "}\n"
-"--src system.sql:5727\n";
+"--src system.sql:5726\n";
 
 static const char *proc123 = 
+"#line 5734 \"[executable]/system.sql\"\n"
 "create procedure view_get_where_from_foreign_key (in _tbls varchar, in _suff varchar)\n"
 "{\n"
 "declare ret, tbl any;\n"
@@ -5372,9 +5496,10 @@ static const char *proc123 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src system.sql:5733\n";
+"--src system.sql:5732\n";
 
 static const char *proc124 = 
+"#line 5765 \"[executable]/system.sql\"\n"
 "create procedure text_est_text (in tb varchar)\n"
 "{\n"
 "declare temp, ic, tc varchar;\n"
@@ -5407,9 +5532,10 @@ static const char *proc124 =
 "nf:\n"
 "signal (\'22023\', \'The table has no text index.\');\n"
 "}\n"
-"--src system.sql:5764\n";
+"--src system.sql:5763\n";
 
 static const char *proc125 = 
+"#line 5802 \"[executable]/system.sql\"\n"
 "create procedure CL_RANGE_WORDS_SRV (in l varchar, in h varchar, in mask varchar, in tb varchar)\n"
 "{\n"
 "declare md, res, msg, st any;\n"
@@ -5419,9 +5545,10 @@ static const char *proc125 =
 "if (st <> \'00000\') signal (st, msg);\n"
 "return res;\n"
 "}\n"
-"--src system.sql:5801\n";
+"--src system.sql:5800\n";
 
 static const char *proc126 = 
+"#line 5813 \"[executable]/system.sql\"\n"
 "create procedure cl_range_words (in tb varchar, in l varchar, in h varchar, in mask varchar)\n"
 "{\n"
 "declare daq, r, d any;\n"
@@ -5442,7 +5569,7 @@ static const char *proc126 =
 "}\n"
 "return dict_list_keys (d, 2);\n"
 "}\n"
-"--src system.sql:5812\n";
+"--src system.sql:5811\n";
 
 static const char *tbl5 = 
 "create table SYS_HTTP_CLIENT_CACHE (\n"
@@ -5472,20 +5599,22 @@ static const char *view0 =
 static const char *other79 = 
 "grant select on DB.DBA.TABLE_COLS to public\n";
 static const char *proc127 = 
+"#line 5863 \"[executable]/system.sql\"\n"
 "create procedure csv_load_file (in f varchar, in _from int := 0, in _to int := null, in tb varchar := null, in log_mode int := 2, in opts any := null)\n"
 "{\n"
 "declare s any;\n"
 "s := file_open (f);\n"
 "return csv_load (s, _from, _to, tb, log_mode, opts);\n"
 "}\n"
-"--src system.sql:5862\n";
+"--src system.sql:5861\n";
 
 static const char *proc128 = 
+"#line 5871 \"[executable]/system.sql\"\n"
 "create procedure csv_load (in s any, in _from int := 0, in _to int := null, in tb varchar := null, in log_mode int := 2, in opts any := null)\n"
 "{\n"
 "declare r, log_ses any;\n"
 "declare stmt, enc varchar;\n"
-"declare inx, old_mode, num_cols, nrows, mode, log_error int;\n"
+"declare inx, old_mode, num_cols, nrows, mode, log_error, import_first_n_cols int;\n"
 "declare delim, quot char;\n"
 "\n"
 "delim := quot := enc := mode := null;\n"
@@ -5497,6 +5626,7 @@ static const char *proc128 =
 "enc := get_keyword (\'encoding\', opts);\n"
 "mode := get_keyword (\'mode\', opts);\n"
 "log_error := get_keyword (\'log\', opts, 0);\n"
+"import_first_n_cols := get_keyword (\'lax\', opts, 0);\n"
 "}\n"
 "\n"
 "stmt := csv_ins_stmt (tb, num_cols);\n"
@@ -5508,6 +5638,8 @@ static const char *proc128 =
 "{\n"
 "if (inx >= _from)\n"
 "{\n"
+"if (import_first_n_cols and length (r) > num_cols)\n"
+"r := subseq (r, 0, num_cols);\n"
 "if (length (r) = num_cols)\n"
 "{\n"
 "declare stat, message varchar;\n"
@@ -5546,9 +5678,10 @@ static const char *proc128 =
 "return vector (nrows, log_ses);\n"
 "return nrows;\n"
 "}\n"
-"--src system.sql:5870\n";
+"--src system.sql:5869\n";
 
 static const char *proc129 = 
+"#line 5941 \"[executable]/system.sql\"\n"
 "create procedure csv_parse (in s any, in cb varchar, inout cbd any, in _from int := 0, in _to int := null, in opts any := null)\n"
 "{\n"
 "declare r any;\n"
@@ -5576,9 +5709,10 @@ static const char *proc129 =
 "end_loop:;\n"
 "return inx;\n"
 "}\n"
-"--src system.sql:5937\n";
+"--src system.sql:5939\n";
 
 static const char *proc130 = 
+"#line 5970 \"[executable]/system.sql\"\n"
 "create procedure csv_ins_stmt (in tb varchar, out num_cols int)\n"
 "{\n"
 "declare ss any;\n"
@@ -5615,9 +5749,10 @@ static const char *proc130 =
 "num_cols := length (cols);\n"
 "return string_output_string (ss);\n"
 "}\n"
-"--src system.sql:5966\n";
+"--src system.sql:5968\n";
 
 static const char *proc131 = 
+"#line 6008 \"[executable]/system.sql\"\n"
 "create procedure csv_file_header_check (in f any, in num_to_check int := 10)\n"
 "{\n"
 "declare h, r, s, i any;\n"
@@ -5633,9 +5768,10 @@ static const char *proc131 =
 "}\n"
 "return h;\n"
 "}\n"
-"--src system.sql:6004\n";
+"--src system.sql:6006\n";
 
 static const char *proc132 = 
+"#line 6025 \"[executable]/system.sql\"\n"
 "create procedure csv_table_def (in f varchar)\n"
 "{\n"
 "declare head any;\n"
@@ -5659,9 +5795,10 @@ static const char *proc132 =
 "http (\')\', ss);\n"
 "return string_output_string (ss);\n"
 "}\n"
-"--src system.sql:6021\n";
+"--src system.sql:6023\n";
 
 static const char *proc133 = 
+"#line 6050 \"[executable]/system.sql\"\n"
 "create procedure csv_cols_def (in f varchar)\n"
 "{\n"
 "declare head any;\n"
@@ -5681,11 +5818,12 @@ static const char *proc133 =
 "}\n"
 "return vec;\n"
 "}\n"
-"--src system.sql:6046\n";
+"--src system.sql:6048\n";
 
 /* system2.sql */
 
 static const char *proc134 = 
+"#line 23 \"[executable]/system2.sql\"\n"
 "create procedure DB.DBA.SYS_INDEX_SPACE_STATS_PROC ()\n"
 "{\n"
 "declare ISS_KEY_ID, ISS_NROWS, ISS_ROW_BYTES, ISS_BLOB_PAGES, ISS_ROW_PAGES integer;\n"
@@ -5711,7 +5849,7 @@ static const char *proc134 =
 "}\n"
 "}\n"
 "}\n"
-"--src system2.sql:22\n";
+"--src system2.sql:21\n";
 
 static const char *view1 = 
 "create view DB.DBA.SYS_INDEX_SPACE_STATS as\n"
@@ -5736,6 +5874,7 @@ static const char *view1 =
 "ISS_KEY_ID = KEY_ID\n";
 
 static const char *proc135 = 
+"#line 73 \"[executable]/system2.sql\"\n"
 " create procedure DB.DBA.__VD_GET_SQLSTATS_COUNT (in _ds_dsn varchar, in _remote_name varchar)\n"
 "{\n"
 "declare exit handler for sqlstate \'*\' { return NULL; };\n"
@@ -5767,9 +5906,10 @@ static const char *proc135 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src system2.sql:72\n";
+"--src system2.sql:71\n";
 
 static const char *proc136 = 
+"#line 107 \"[executable]/system2.sql\"\n"
 " create procedure DB.DBA.VD_STATISTICS (in _dsn varchar := \'%\', in vd_table_mask varchar := \'%\')\n"
 "{\n"
 "declare _ds_dsn, _ds_conn_str any;\n"
@@ -5849,9 +5989,10 @@ static const char *proc136 =
 "inx := inx + 1;\n"
 "}\n"
 "}\n"
-"--src system2.sql:106\n";
+"--src system2.sql:105\n";
 
 static const char *proc137 = 
+"#line 190 \"[executable]/system2.sql\"\n"
 " create procedure DB.DBA.TABLE_SET_POLICY (in _tb varchar, in _proc varchar, in _type varchar := \'IDUS\')\n"
 "{\n"
 "declare tb_name, proc_name varchar;\n"
@@ -5909,9 +6050,10 @@ static const char *proc137 =
 "\n"
 "__ddl_changed (tb_name);\n"
 "}\n"
-"--src system2.sql:189\n";
+"--src system2.sql:188\n";
 
 static const char *proc138 = 
+"#line 250 \"[executable]/system2.sql\"\n"
 " create procedure DB.DBA.TABLE_DROP_POLICY (in _tb varchar, in _type varchar := \'IUDS\')\n"
 "{\n"
 "declare tb_name varchar;\n"
@@ -5932,7 +6074,7 @@ static const char *proc138 =
 "if (row_count () > 0)\n"
 "__ddl_changed (tb_name);\n"
 "}\n"
-"--src system2.sql:249\n";
+"--src system2.sql:248\n";
 
 static const char *view2 = 
 "create view ALL_COL_STAT as\n"
@@ -5959,6 +6101,7 @@ static const char *view5 =
 static const char *other83 = 
 "grant select on USER_COL_HIST to public\n";
 static const char *proc139 = 
+"#line 300 \"[executable]/system2.sql\"\n"
 "create procedure SINV_CREATE_INVERSE (in _SINVM_NAME_IN varchar, in _SINV_INVERSE any, in _SINVM_FLAGS integer)\n"
 "{\n"
 "declare _SINVM_NAME varchar;\n"
@@ -6011,9 +6154,10 @@ static const char *proc139 =
 "sinv_read_invers_sys (_inverse);\n"
 "}\n"
 "}\n"
-"--src system2.sql:299\n";
+"--src system2.sql:298\n";
 
 static const char *proc140 = 
+"#line 354 \"[executable]/system2.sql\"\n"
 "create procedure SINV_DROP_INVERSE (in _SINVM_NAME_IN varchar)\n"
 "{\n"
 "declare _SINVM_NAME varchar;\n"
@@ -6030,9 +6174,10 @@ static const char *proc140 =
 "delete from SYS_SQL_INVERSE where SINV_FUNCTION = _SINVM_NAME;\n"
 "sinv_read_invers_sys (_SINVM_NAME);\n"
 "}\n"
-"--src system2.sql:353\n";
+"--src system2.sql:352\n";
 
 static const char *proc141 = 
+"#line 372 \"[executable]/system2.sql\"\n"
 "create procedure SINV_CREATE_KEY_MAPPING (in map_name varchar,  in part_defs any, in do_drops integer := 1)\n"
 "{\n"
 "declare inx, len_of_part_defs integer;\n"
@@ -6177,9 +6322,10 @@ static const char *proc141 =
 "\'\\nDB.DBA.SINV_CREATE_INVERSE (\'\'%s\'\', vector (%s), 0)\\n\',\n"
 "map_name, inv_vector));\n"
 "}\n"
-"--src system2.sql:371\n";
+"--src system2.sql:370\n";
 
 static const char *proc142 = 
+"#line 518 \"[executable]/system2.sql\"\n"
 "create procedure SYS_CREATE_TABLE_AS (\n"
 "in tb_name varchar, in _parse_tree any, in with_data integer,\n"
 "in exec_it integer := 1)\n"
@@ -6268,9 +6414,10 @@ static const char *proc142 =
 "else\n"
 "return _stmt;\n"
 "}\n"
-"--src system2.sql:517\n";
+"--src system2.sql:516\n";
 
 static const char *proc143 = 
+"#line 609 \"[executable]/system2.sql\"\n"
 " create procedure\n"
 "encode_b32_num (in i integer) returns varchar\n"
 "{\n"
@@ -6292,9 +6439,10 @@ static const char *proc143 =
 "done:\n"
 "return s;\n"
 "}\n"
-"--src system2.sql:608\n";
+"--src system2.sql:607\n";
 
 static const char *proc144 = 
+"#line 633 \"[executable]/system2.sql\"\n"
 " create procedure\n"
 "decode_b32_num (in s varchar) returns integer\n"
 "{\n"
@@ -6330,7 +6478,7 @@ static const char *proc144 =
 "}\n"
 "return x;\n"
 "}\n"
-"--src system2.sql:632\n";
+"--src system2.sql:631\n";
 
 static const char *other84 = 
 "add_protected_sequence (\'/!URIQA/\')\n";
@@ -6430,9 +6578,87 @@ static const char *other131 =
 "add_protected_sequence (\'vad_tmp\')\n";
 static const char *other132 = 
 "add_protected_sequence (\'vdd_init\')\n";
-/* odbccat.sql */
+static const char *tbl6 = 
+"create table SYS_X509_CERTIFICATES (\n"
+"C_U_ID	int,\n"
+"C_ID varchar,\n"
+"C_DATA long varchar,\n"
+"C_KIND integer,\n"
+"C_NAME varchar,\n"
+"primary key (C_U_ID, C_KIND, C_ID))\n";
 
 static const char *proc145 = 
+"#line 781 \"[executable]/system2.sql\"\n"
+"create procedure X509_CERTIFICATES_ADD (in certs varchar, in kind int := 1)\n"
+"{\n"
+"declare ki varchar;\n"
+"declare name, subj varchar;\n"
+"declare arr any;\n"
+"declare user_id int;\n"
+"\n"
+"arr := pem_certificates_to_array (certs);\n"
+"user_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = user);\n"
+"if (user_id <> 0 and kind = 1)\n"
+"signal (\'39000\', \'Only DBA can install CA roots\');\n"
+"foreach (varchar cert in arr) do\n"
+"{\n"
+"ki := get_certificate_info (6, cert, 0, \'\');\n"
+"if (ki is null)\n"
+"signal (\'22023\', \'Can not get certificate id\');\n"
+"subj := get_certificate_info (2, cert, 0, \'\');\n"
+"name := regexp_match (\'/CN=[^/]+/?\', subj);\n"
+"if (name is null or name like \'/CN=http:%\')\n"
+"name := regexp_match (\'/O=[^/]+/?\', subj);\n"
+"if (name is not null)\n"
+"{\n"
+"declare pos int;\n"
+"name := trim (name, \'/\');\n"
+"pos := strchr (name, \'=\');\n"
+"name := subseq (name, pos + 1);\n"
+"name := split_and_decode (replace (name, \'\\\\x\', \'%\'))[0];\n"
+"}\n"
+"insert soft SYS_X509_CERTIFICATES (C_U_ID, C_ID, C_DATA, C_KIND, C_NAME) values (user_id, ki, cert, kind, name);\n"
+"}\n"
+"}\n"
+"--src system2.sql:779\n";
+
+static const char *proc146 = 
+"#line 814 \"[executable]/system2.sql\"\n"
+"create procedure X509_CERTIFICATES_DEL (in certs varchar, in kind int := 1)\n"
+"{\n"
+"declare ki varchar;\n"
+"declare name, subj varchar;\n"
+"declare arr any;\n"
+"declare user_id int;\n"
+"\n"
+"arr := pem_certificates_to_array (certs);\n"
+"user_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = user);\n"
+"if (user_id <> 0 and kind = 1)\n"
+"signal (\'39000\', \'Only DBA can install CA roots\');\n"
+"foreach (varchar cert in arr) do\n"
+"{\n"
+"ki := get_certificate_info (6, cert, 0, \'\');\n"
+"if (ki is null)\n"
+"signal (\'22023\', \'Can not get certificate id\');\n"
+"delete from SYS_X509_CERTIFICATES where C_U_ID = user_id and C_KIND = kind and C_ID = ki;\n"
+"}\n"
+"}\n"
+"--src system2.sql:812\n";
+
+static const char *proc147 = 
+"#line 835 \"[executable]/system2.sql\"\n"
+"create procedure X509_ROOT_CA_CERTS ()\n"
+"{\n"
+"declare ret any;\n"
+"ret := (select vector_agg (C_DATA) from SYS_X509_CERTIFICATES where C_U_ID = 0 and C_KIND = 1);\n"
+"return ret;\n"
+"}\n"
+"--src system2.sql:833\n";
+
+/* odbccat.sql */
+
+static const char *proc148 = 
+"#line 23 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_normalize_qon (in dsn varchar, inout infos any, inout qual varchar, inout owner varchar, inout name varchar)\n"
 "{\n"
@@ -6445,9 +6671,10 @@ static const char *proc145 =
 "\n"
 "return;\n"
 "}\n"
-"--src odbccat.sql:22\n";
+"--src odbccat.sql:21\n";
 
-static const char *proc146 = 
+static const char *proc149 = 
+"#line 37 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_filter_qon (inout infos any, inout result any, in qual varchar, in owner varchar, in name varchar)\n"
 "{\n"
@@ -6498,9 +6725,10 @@ static const char *proc146 =
 "result := result_out;\n"
 "}\n"
 "}\n"
-"--src odbccat.sql:36\n";
+"--src odbccat.sql:35\n";
 
-static const char *proc147 = 
+static const char *proc150 = 
+"#line 89 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_columns (in dsn varchar, in qual varchar, in owner varchar, in name varchar, in col varchar)\n"
 "{\n"
@@ -6531,9 +6759,10 @@ static const char *proc147 =
 "nf:\n"
 "signal (\'HZ000\', \'Bad DSN in sql_columns\', \'VD073\');\n"
 "}\n"
-"--src odbccat.sql:88\n";
+"--src odbccat.sql:87\n";
 
-static const char *proc148 = 
+static const char *proc151 = 
+"#line 122 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_tables (in dsn varchar, in qual varchar, in owner varchar, in name varchar, in typ varchar)\n"
 "{\n"
@@ -6569,9 +6798,10 @@ static const char *proc148 =
 "nf:\n"
 "signal (\'HZ000\', \'Bad DSN in sql_tables\', \'VD074\');\n"
 "}\n"
-"--src odbccat.sql:121\n";
+"--src odbccat.sql:120\n";
 
-static const char *proc149 = 
+static const char *proc152 = 
+"#line 160 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_primary_keys (in dsn varchar, in qual varchar, in owner varchar, in name varchar)\n"
 "{\n"
@@ -6597,9 +6827,10 @@ static const char *proc149 =
 "nf:\n"
 "signal (\'HZ000\', \'Bad DSN in sql_primary_keys\', \'VD075\');\n"
 "}\n"
-"--src odbccat.sql:159\n";
+"--src odbccat.sql:158\n";
 
-static const char *proc150 = 
+static const char *proc153 = 
+"#line 188 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_statistics (in dsn varchar, in qual varchar, in owner varchar, in name varchar, in uniqu integer, in acc integer)\n"
 "{\n"
@@ -6628,9 +6859,10 @@ static const char *proc150 =
 "nf:\n"
 "signal (\'HZ000\', \'Bad DSN in sql_statistics\', \'VD076\');\n"
 "}\n"
-"--src odbccat.sql:187\n";
+"--src odbccat.sql:186\n";
 
-static const char *proc151 = 
+static const char *proc154 = 
+"#line 219 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_procedures (in dsn varchar, in qual varchar, in owner varchar, in name varchar)\n"
 "{\n"
@@ -6658,9 +6890,10 @@ static const char *proc151 =
 "nf:\n"
 "signal (\'HZ000\', \'Bad DSN in sql_procedures\', \'VD077\');\n"
 "}\n"
-"--src odbccat.sql:218\n";
+"--src odbccat.sql:217\n";
 
-static const char *proc152 = 
+static const char *proc155 = 
+"#line 249 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_procedure_cols (in dsn varchar, in qual any, in owner any, in name varchar, in col varchar)\n"
 "{\n"
@@ -6689,9 +6922,10 @@ static const char *proc152 =
 "nf:\n"
 "signal (\'HZ000\', \'Bad DSN in sql_procedures\', \'VD077\');\n"
 "}\n"
-"--src odbccat.sql:248\n";
+"--src odbccat.sql:247\n";
 
-static const char *proc153 = 
+static const char *proc156 = 
+"#line 280 \"[executable]/odbccat.sql\"\n"
 " create procedure\n"
 "sql_foreign_keys (in dsn varchar, in qual varchar, in owner varchar, in name varchar, in qual2 varchar, in owner2 varchar, in name2 varchar)\n"
 "{\n"
@@ -6714,9 +6948,10 @@ static const char *proc153 =
 "nf:\n"
 "signal (\'HZ000\', \'Invalid DSN in sql_foreign_keys\', \'VD075\');\n"
 "}\n"
-"--src odbccat.sql:279\n";
+"--src odbccat.sql:278\n";
 
-static const char *proc154 = 
+static const char *proc157 = 
+"#line 310 \"[executable]/odbccat.sql\"\n"
 "create procedure __virt_sql_qon_is_oracle_oracle (inout infos any,\n"
 "inout qual varchar, inout owner varchar, inout name varchar)\n"
 "{\n"
@@ -6765,9 +7000,10 @@ static const char *proc154 =
 "return 1;\n"
 "return 0;\n"
 "}\n"
-"--src odbccat.sql:309\n";
+"--src odbccat.sql:308\n";
 
-static const char *proc155 = 
+static const char *proc158 = 
+"#line 360 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_normalize_qon_oracle_oracle (in dsn varchar, inout infos any, inout qual varchar, inout owner varchar, inout name varchar)\n"
 "{\n"
@@ -6783,9 +7019,10 @@ static const char *proc155 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src odbccat.sql:359\n";
+"--src odbccat.sql:358\n";
 
-static const char *proc156 = 
+static const char *proc159 = 
+"#line 377 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_filter_qon_oracle_oracle (inout infos any, inout filter any, in qual varchar, in owner varchar, in name varchar)\n"
 "{\n"
@@ -6798,9 +7035,10 @@ static const char *proc156 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src odbccat.sql:376\n";
+"--src odbccat.sql:375\n";
 
-static const char *proc157 = 
+static const char *proc160 = 
+"#line 394 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_normalize_qon_oracle_msora (in dsn varchar, inout infos any, inout qual varchar, inout owner varchar, inout name varchar)\n"
 "{\n"
@@ -6818,9 +7056,10 @@ static const char *proc157 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src odbccat.sql:393\n";
+"--src odbccat.sql:392\n";
 
-static const char *proc158 = 
+static const char *proc161 = 
+"#line 420 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_normalize_qon_infohub_dcsyb30 (in dsn varchar, inout infos any, inout qual varchar, inout owner varchar, inout name varchar)\n"
 "{\n"
@@ -6836,9 +7075,10 @@ static const char *proc158 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src odbccat.sql:419\n";
+"--src odbccat.sql:418\n";
 
-static const char *proc159 = 
+static const char *proc162 = 
+"#line 437 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_tables_pre_infohub_dcsyb30 (inout infos any, inout typ varchar)\n"
 "{\n"
@@ -6854,9 +7094,10 @@ static const char *proc159 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src odbccat.sql:436\n";
+"--src odbccat.sql:435\n";
 
-static const char *proc160 = 
+static const char *proc163 = 
+"#line 455 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_tables_post_infohub_dcsyb30 (inout infos any, inout result any, inout typ varchar)\n"
 "{\n"
@@ -6910,9 +7151,10 @@ static const char *proc160 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src odbccat.sql:454\n";
+"--src odbccat.sql:453\n";
 
-static const char *proc161 = 
+static const char *proc164 = 
+"#line 515 \"[executable]/odbccat.sql\"\n"
 "create procedure sql_columns_post_oracle_openlink (inout infos any, inout result any)\n"
 "{\n"
 "declare dbms_name, driver_name varchar;\n"
@@ -6944,9 +7186,10 @@ static const char *proc161 =
 "\n"
 "}\n"
 "}\n"
-"--src odbccat.sql:514\n";
+"--src odbccat.sql:513\n";
 
-static const char *proc162 = 
+static const char *proc165 = 
+"#line 552 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_tables_post_progress_win_openlink (inout infos any, inout result any, inout typ varchar)\n"
 "{\n"
@@ -7000,9 +7243,10 @@ static const char *proc162 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src odbccat.sql:551\n";
+"--src odbccat.sql:550\n";
 
-static const char *proc163 = 
+static const char *proc166 = 
+"#line 612 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_tables_post_excel_drv (in dsn varchar, inout infos any, inout result any, inout typ varchar)\n"
 "{\n"
@@ -7061,9 +7305,10 @@ static const char *proc163 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src odbccat.sql:611\n";
+"--src odbccat.sql:610\n";
 
-static const char *proc164 = 
+static const char *proc167 = 
+"#line 673 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_tables_pre_excel_drv (inout infos any, inout typ varchar)\n"
 "{\n"
@@ -7079,9 +7324,10 @@ static const char *proc164 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src odbccat.sql:672\n";
+"--src odbccat.sql:671\n";
 
-static const char *proc165 = 
+static const char *proc168 = 
+"#line 695 \"[executable]/odbccat.sql\"\n"
 "create procedure\n"
 "sql_normalize_qon_viaserv_opl (in dsn varchar, inout infos any, inout qual varchar, inout owner varchar, inout name varchar)\n"
 "{\n"
@@ -7113,39 +7359,44 @@ static const char *proc165 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src odbccat.sql:694\n";
+"--src odbccat.sql:693\n";
 
 /* useraggr.sql */
 
-static const char *proc166 = 
+static const char *proc169 = 
+"#line 24 \"[executable]/useraggr.sql\"\n"
 " create procedure STD_COUNT (in _env varchar)\n"
 "{\n"
 "return aref (deserialize(_env), 0);\n"
 "}\n"
-"--src useraggr.sql:23\n";
+"--src useraggr.sql:22\n";
 
-static const char *proc167 = 
+static const char *proc170 = 
+"#line 31 \"[executable]/useraggr.sql\"\n"
 " create procedure STD11_INIT (inout _env varchar)\n"
 "{\n"
 "_env := serialize (vector (0, 0.0));\n"
 "}\n"
-"--src useraggr.sql:30\n";
+"--src useraggr.sql:29\n";
 
-static const char *proc168 = 
+static const char *proc171 = 
+"#line 38 \"[executable]/useraggr.sql\"\n"
 " create procedure STD12_INIT (inout _env varchar)\n"
 "{\n"
 "_env := serialize (vector (0, 0.0,0.0));\n"
 "}\n"
-"--src useraggr.sql:37\n";
+"--src useraggr.sql:36\n";
 
-static const char *proc169 = 
+static const char *proc172 = 
+"#line 45 \"[executable]/useraggr.sql\"\n"
 " create procedure STD13_INIT (inout _env varchar)\n"
 "{\n"
 "_env := serialize (vector (0, 0.0,0.0, 0.0));\n"
 "}\n"
-"--src useraggr.sql:44\n";
+"--src useraggr.sql:43\n";
 
-static const char *proc170 = 
+static const char *proc173 = 
+"#line 52 \"[executable]/useraggr.sql\"\n"
 " create procedure VAR_ACC (inout _env varchar, in val numeric)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7160,9 +7411,10 @@ static const char *proc170 =
 "aset( ctx, 0, aref (ctx, 0) + 1);\n"
 "_env := serialize (ctx);\n"
 "}\n"
-"--src useraggr.sql:51\n";
+"--src useraggr.sql:50\n";
 
-static const char *proc171 = 
+static const char *proc174 = 
+"#line 69 \"[executable]/useraggr.sql\"\n"
 " create procedure VAR_POP_FIN (inout _ctx varchar)\n"
 "{\n"
 "if (_ctx is null)\n"
@@ -7175,9 +7427,10 @@ static const char *proc171 =
 "return null;\n"
 "return  (aref (_env, 2) - aref (_env, 1) * aref (_env, 1) / c) / c;\n"
 "}\n"
-"--src useraggr.sql:68\n";
+"--src useraggr.sql:67\n";
 
-static const char *proc172 = 
+static const char *proc175 = 
+"#line 84 \"[executable]/useraggr.sql\"\n"
 " create procedure VAR_SAMP_FIN (inout _ctx varchar)\n"
 "{\n"
 "if (_ctx is null)\n"
@@ -7192,9 +7445,10 @@ static const char *proc172 =
 "return 0.0;\n"
 "return  (aref (_env, 2) - aref (_env, 1) * aref (_env, 1) / c) / (c - 1);\n"
 "}\n"
-"--src useraggr.sql:83\n";
+"--src useraggr.sql:82\n";
 
-static const char *proc173 = 
+static const char *proc176 = 
+"#line 101 \"[executable]/useraggr.sql\"\n"
 " create procedure VAR_FIN (inout _ctx varchar)\n"
 "{\n"
 "if (_ctx is null)\n"
@@ -7203,9 +7457,10 @@ static const char *proc173 =
 "return null;\n"
 "return VAR_SAMP_FIN (_ctx);\n"
 "}\n"
-"--src useraggr.sql:100\n";
+"--src useraggr.sql:99\n";
 
-static const char *proc174 = 
+static const char *proc177 = 
+"#line 112 \"[executable]/useraggr.sql\"\n"
 " create procedure STDDEV_POP_FIN (inout _ctx varchar)\n"
 "{\n"
 "if (_ctx is null)\n"
@@ -7219,9 +7474,10 @@ static const char *proc174 =
 "\n"
 "return  sqrt ((aref (_env, 2) - aref (_env, 1) * aref (_env, 1) / c) / c) ;\n"
 "}\n"
-"--src useraggr.sql:111\n";
+"--src useraggr.sql:110\n";
 
-static const char *proc175 = 
+static const char *proc178 = 
+"#line 128 \"[executable]/useraggr.sql\"\n"
 " create procedure STDDEV_SAMP_FIN (inout _ctx varchar)\n"
 "{\n"
 "if (_ctx is null)\n"
@@ -7236,9 +7492,10 @@ static const char *proc175 =
 "return 0.0;\n"
 "return  sqrt ((aref (_env, 2) - aref (_env, 1) * aref (_env, 1) / c) / ( c - 1));\n"
 "}\n"
-"--src useraggr.sql:127\n";
+"--src useraggr.sql:126\n";
 
-static const char *proc176 = 
+static const char *proc179 = 
+"#line 145 \"[executable]/useraggr.sql\"\n"
 " create procedure STDDEV_FIN (inout _ctx varchar)\n"
 "{\n"
 "if (_ctx is null)\n"
@@ -7247,9 +7504,10 @@ static const char *proc176 =
 "return null;\n"
 "return STDDEV_SAMP_FIN (_ctx);\n"
 "}\n"
-"--src useraggr.sql:144\n";
+"--src useraggr.sql:143\n";
 
-static const char *proc177 = 
+static const char *proc180 = 
+"#line 156 \"[executable]/useraggr.sql\"\n"
 " create procedure COVAR_ACC (inout _ctx any,\n"
 "in expr1 numeric,\n"
 "in expr2 numeric)\n"
@@ -7270,9 +7528,10 @@ static const char *proc177 =
 "\n"
 "_ctx := serialize (_env);\n"
 "}\n"
-"--src useraggr.sql:155\n";
+"--src useraggr.sql:154\n";
 
-static const char *proc178 = 
+static const char *proc181 = 
+"#line 179 \"[executable]/useraggr.sql\"\n"
 " create procedure COVAR_SAMP_FIN (inout _ctx any)\n"
 "{\n"
 "if (_ctx is null)\n"
@@ -7286,9 +7545,10 @@ static const char *proc178 =
 "\n"
 "return (aref (_env, 3) - aref(_env,2) * aref (_env,1) / aref (_env, 0)) / ( aref (_env, 0) - 1);\n"
 "}\n"
-"--src useraggr.sql:178\n";
+"--src useraggr.sql:177\n";
 
-static const char *proc179 = 
+static const char *proc182 = 
+"#line 195 \"[executable]/useraggr.sql\"\n"
 " create procedure COVAR_POP_FIN (inout _ctx any)\n"
 "{\n"
 "if (_ctx is null)\n"
@@ -7302,9 +7562,10 @@ static const char *proc179 =
 "\n"
 "return (aref (_env, 3) - aref(_env,2) * aref (_env,1) / aref (_env, 0))/ aref (_env,0);\n"
 "}\n"
-"--src useraggr.sql:194\n";
+"--src useraggr.sql:193\n";
 
-static const char *proc180 = 
+static const char *proc183 = 
+"#line 211 \"[executable]/useraggr.sql\"\n"
 " create procedure COVAR_FIN (inout _ctx varchar)\n"
 "{\n"
 "if (_ctx is null)\n"
@@ -7313,7 +7574,7 @@ static const char *proc180 =
 "return null;\n"
 "return COVAR_SAMP_FIN (_ctx);\n"
 "}\n"
-"--src useraggr.sql:210\n";
+"--src useraggr.sql:209\n";
 
 static const char *other133 = 
 "create aggregate DB.DBA.VAR_POP (in val numeric) returns numeric from\n"
@@ -7351,7 +7612,8 @@ static const char *other141 =
 "create aggregate DB.DBA.COVAR (in expr1 numeric, in expr2 numeric) returns numeric from\n"
 "STD13_INIT, COVAR_ACC, COVAR_FIN\n";
 
-static const char *proc181 = 
+static const char *proc184 = 
+"#line 250 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_SLOPE_INIT (inout _env varchar)\n"
 "{\n"
 "declare _ctx1 varchar;\n"
@@ -7362,9 +7624,10 @@ static const char *proc181 =
 "\n"
 "_env := serialize (vector (0, _ctx1, _ctx2));\n"
 "}\n"
-"--src useraggr.sql:249\n";
+"--src useraggr.sql:248\n";
 
-static const char *proc182 = 
+static const char *proc185 = 
+"#line 263 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_SLOPE_ACC (inout _env varchar, in expr1 numeric, in expr2 numeric)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7389,9 +7652,10 @@ static const char *proc182 =
 "\n"
 "_env := serialize (_ctx);\n"
 "}\n"
-"--src useraggr.sql:262\n";
+"--src useraggr.sql:261\n";
 
-static const char *proc183 = 
+static const char *proc186 = 
+"#line 290 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_SLOPE_FIN (inout _env varchar)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7423,12 +7687,13 @@ static const char *proc183 =
 "return null;\n"
 "return covar_pop_val / var_pop_val;\n"
 "}\n"
-"--src useraggr.sql:289\n";
+"--src useraggr.sql:288\n";
 
 static const char *other142 = 
 "create aggregate DB.DBA.REGR_SLOPE (in expr1 numeric, in expr2 numeric) returns numeric from REGR_SLOPE_INIT, REGR_SLOPE_ACC, REGR_SLOPE_FIN\n";
 
-static const char *proc184 = 
+static const char *proc187 = 
+"#line 327 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_INTERCEPT_INIT (inout _env varchar)\n"
 "{\n"
 "declare _ctx_regr_slope varchar;\n"
@@ -7436,9 +7701,10 @@ static const char *proc184 =
 "REGR_SLOPE_INIT (_ctx_regr_slope);\n"
 "_env := serialize (vector (0, 0.0, 0.0, _ctx_regr_slope));\n"
 "}\n"
-"--src useraggr.sql:326\n";
+"--src useraggr.sql:325\n";
 
-static const char *proc185 = 
+static const char *proc188 = 
+"#line 337 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_INTERCEPT_ACC (inout _env varchar, in expr1 numeric, in expr2 numeric)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7460,9 +7726,10 @@ static const char *proc185 =
 "\n"
 "_env := serialize (_ctx);\n"
 "}\n"
-"--src useraggr.sql:336\n";
+"--src useraggr.sql:335\n";
 
-static const char *proc186 = 
+static const char *proc189 = 
+"#line 361 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_INTERCEPT_FIN (inout _env varchar)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7476,45 +7743,50 @@ static const char *proc186 =
 "\n"
 "return aref (_ctx, 1) / c - REGR_SLOPE_FIN (aref (_ctx, 3)) * aref (_ctx, 2) / c;\n"
 "}\n"
-"--src useraggr.sql:360\n";
+"--src useraggr.sql:359\n";
 
 static const char *other143 = 
 "create aggregate DB.DBA.REGR_INTERCEPT (in expr1 numeric, in expr2 numeric) returns numeric from REGR_INTERCEPT_INIT, REGR_INTERCEPT_ACC, REGR_INTERCEPT_FIN\n";
 
-static const char *proc187 = 
+static const char *proc190 = 
+"#line 380 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_COUNT_INIT (inout _env integer)\n"
 "{\n"
 "_env := 0;\n"
 "}\n"
-"--src useraggr.sql:379\n";
+"--src useraggr.sql:378\n";
 
-static const char *proc188 = 
+static const char *proc191 = 
+"#line 387 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_COUNT_ACC (inout _env integer, in expr numeric, in expr2 numeric)\n"
 "{\n"
 "if ((_env is null) or (expr is null) or (expr2 is null))\n"
 "return;\n"
 "_env := _env + 1;\n"
 "}\n"
-"--src useraggr.sql:386\n";
+"--src useraggr.sql:385\n";
 
-static const char *proc189 = 
+static const char *proc192 = 
+"#line 396 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_COUNT_FIN (inout _env integer)\n"
 "{\n"
 "return _env;\n"
 "}\n"
-"--src useraggr.sql:395\n";
+"--src useraggr.sql:394\n";
 
-static const char *proc190 = 
+static const char *proc193 = 
+"#line 403 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_COUNT_MERGE (inout _e1 integer, inout _e2 integer)\n"
 "{\n"
 "_e1 := _e1 + _e2;\n"
 "}\n"
-"--src useraggr.sql:402\n";
+"--src useraggr.sql:401\n";
 
 static const char *other144 = 
 "create aggregate DB.DBA.REGR_COUNT (in expr1 numeric, in expr2 numeric) returns numeric from REGR_COUNT_INIT, REGR_COUNT_ACC, REGR_COUNT_FIN, REGR_COUNT_MERGE\n";
 
-static const char *proc191 = 
+static const char *proc194 = 
+"#line 413 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_AVG_ACC (inout _env varchar, in expr1 numeric, in expr2 numeric)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7531,9 +7803,10 @@ static const char *proc191 =
 "\n"
 "_env := serialize (_ctx);\n"
 "}\n"
-"--src useraggr.sql:412\n";
+"--src useraggr.sql:411\n";
 
-static const char *proc192 = 
+static const char *proc195 = 
+"#line 432 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_AVGX_FIN (inout _env varchar)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7544,9 +7817,10 @@ static const char *proc192 =
 "return null;\n"
 "return aref (_ctx, 1) / aref (_ctx,0);\n"
 "}\n"
-"--src useraggr.sql:431\n";
+"--src useraggr.sql:430\n";
 
-static const char *proc193 = 
+static const char *proc196 = 
+"#line 445 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_AVGY_FIN (inout _env varchar)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7557,7 +7831,7 @@ static const char *proc193 =
 "return null;\n"
 "return aref (_ctx, 2) / aref (_ctx,0);\n"
 "}\n"
-"--src useraggr.sql:444\n";
+"--src useraggr.sql:443\n";
 
 static const char *other145 = 
 "create aggregate DB.DBA.REGR_AVGX (in x numeric, in y numeric) returns numeric from\n"
@@ -7567,7 +7841,8 @@ static const char *other146 =
 "create aggregate DB.DBA.REGR_AVGY (in x numeric, in y numeric) returns numeric from\n"
 "STD12_INIT, REGR_AVG_ACC, REGR_AVGY_FIN\n";
 
-static const char *proc194 = 
+static const char *proc197 = 
+"#line 466 \"[executable]/useraggr.sql\"\n"
 " create procedure CORR_INIT (inout _env varchar)\n"
 "{\n"
 "declare _ctx_cov varchar;\n"
@@ -7580,9 +7855,10 @@ static const char *proc194 =
 "\n"
 "_env := serialize (vector (0, _ctx_cov, _ctx_stdev1, _ctx_stdev2));\n"
 "}\n"
-"--src useraggr.sql:465\n";
+"--src useraggr.sql:464\n";
 
-static const char *proc195 = 
+static const char *proc198 = 
+"#line 481 \"[executable]/useraggr.sql\"\n"
 " create procedure CORR_ACC (inout _env varchar, in e1 numeric, in e2 numeric)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7611,9 +7887,10 @@ static const char *proc195 =
 "\n"
 "_env := serialize (_ctx);\n"
 "}\n"
-"--src useraggr.sql:480\n";
+"--src useraggr.sql:479\n";
 
-static const char *proc196 = 
+static const char *proc199 = 
+"#line 512 \"[executable]/useraggr.sql\"\n"
 " create procedure CORR_FIN (inout _env varchar)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7638,13 +7915,14 @@ static const char *proc196 =
 "\n"
 "return _ctx_cov_val / _ctx_stdev1_val / _ctx_stdev2_val;\n"
 "}\n"
-"--src useraggr.sql:511\n";
+"--src useraggr.sql:510\n";
 
 static const char *other147 = 
 "create aggregate DB.DBA.CORR (in x numeric, in y numeric) returns numeric from\n"
 "CORR_INIT, CORR_ACC, CORR_FIN\n";
 
-static const char *proc197 = 
+static const char *proc200 = 
+"#line 543 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_R2_INIT (inout _env varchar)\n"
 "{\n"
 "declare _ctx_vp1 varchar;\n"
@@ -7657,9 +7935,10 @@ static const char *proc197 =
 "\n"
 "_env := serialize (vector (_ctx_vp1, _ctx_vp2, _ctx_corr));\n"
 "}\n"
-"--src useraggr.sql:542\n";
+"--src useraggr.sql:541\n";
 
-static const char *proc198 = 
+static const char *proc201 = 
+"#line 558 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_R2_ACC (inout _env varchar, in e1 numeric, in e2 numeric)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7688,9 +7967,10 @@ static const char *proc198 =
 "\n"
 "_env := serialize (_ctx);\n"
 "}\n"
-"--src useraggr.sql:557\n";
+"--src useraggr.sql:556\n";
 
-static const char *proc199 = 
+static const char *proc202 = 
+"#line 589 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_R2_FIN (inout _env varchar)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7712,13 +7992,14 @@ static const char *proc199 =
 "_corr := CORR_FIN (aref (_ctx, 2));\n"
 "return _corr * _corr;\n"
 "}\n"
-"--src useraggr.sql:588\n";
+"--src useraggr.sql:587\n";
 
 static const char *other148 = 
 "create aggregate DB.DBA.REGR_R2 (in e1 numeric, in e2 numeric) returns numeric from\n"
 "REGR_R2_INIT, REGR_R2_ACC, REGR_R2_FIN\n";
 
-static const char *proc200 = 
+static const char *proc203 = 
+"#line 617 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_SXX_ACC (inout _env varchar, in e1 numeric, in e2 numeric)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7728,9 +8009,10 @@ static const char *proc200 =
 "\n"
 "VAR_ACC (_env, e2);\n"
 "}\n"
-"--src useraggr.sql:616\n";
+"--src useraggr.sql:615\n";
 
-static const char *proc201 = 
+static const char *proc204 = 
+"#line 629 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_SYY_ACC (inout _env varchar, in e1 numeric, in e2 numeric)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7740,9 +8022,10 @@ static const char *proc201 =
 "\n"
 "VAR_ACC (_env, e1);\n"
 "}\n"
-"--src useraggr.sql:628\n";
+"--src useraggr.sql:627\n";
 
-static const char *proc202 = 
+static const char *proc205 = 
+"#line 641 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_SXY_ACC (inout _env varchar, in e1 numeric, in e2 numeric)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7752,9 +8035,10 @@ static const char *proc202 =
 "\n"
 "COVAR_ACC (_env, e1, e2);\n"
 "}\n"
-"--src useraggr.sql:640\n";
+"--src useraggr.sql:639\n";
 
-static const char *proc203 = 
+static const char *proc206 = 
+"#line 653 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_S___FIN (inout _env varchar)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7769,9 +8053,10 @@ static const char *proc203 =
 "return null;\n"
 "return aref (_ctx,0) * _var;\n"
 "}\n"
-"--src useraggr.sql:652\n";
+"--src useraggr.sql:651\n";
 
-static const char *proc204 = 
+static const char *proc207 = 
+"#line 670 \"[executable]/useraggr.sql\"\n"
 " create procedure REGR_SXY_FIN (inout _env varchar)\n"
 "{\n"
 "if (_env is null)\n"
@@ -7786,7 +8071,7 @@ static const char *proc204 =
 "return null;\n"
 "return aref (_ctx,0) * _var;\n"
 "}\n"
-"--src useraggr.sql:669\n";
+"--src useraggr.sql:668\n";
 
 static const char *other149 = 
 "create aggregate DB.DBA.REGR_SXX (in e1 numeric, in e2 numeric) returns numeric from\n"
@@ -7800,12 +8085,13 @@ static const char *other151 =
 "create aggregate DB.DBA.REGR_SXY (in e1 numeric, in e2 numeric) returns numeric from\n"
 "STD13_INIT, REGR_SXY_ACC, REGR_SXY_FIN\n";
 
-static const char *proc205 = 
+static const char *proc208 = 
+"#line 699 \"[executable]/useraggr.sql\"\n"
 " create procedure xte_nodebld_final_root (in acc any) returns any\n"
 "{\n"
 "return xte_nodebld_xmlagg_final (acc, xte_head (UNAME\' root\'));\n"
 "}\n"
-"--src useraggr.sql:698\n";
+"--src useraggr.sql:697\n";
 
 static const char *other152 = 
 "create aggregate DB.DBA.XMLAGG (in _child any) returns any\n"
@@ -7813,23 +8099,58 @@ static const char *other152 =
 
 static const char *other153 = 
 "create aggregate DB.DBA.VECTOR_AGG (in _child any) returns any\n"
-"from vectorbld_init, vectorbld_agg_acc, vectorbld_agg_final\n";
+"from vectorbld_init, vectorbld_agg_acc, vectorbld_agg_final\n"
+"order\n";
 
 static const char *other154 = 
-"create aggregate DB.DBA.BAG_AGG (in _child any) returns any\n"
-"from vectorbld_init, vectorbld_agg_acc, vectorbld_agg_final\n";
+"create aggregate DB.DBA.VECTOR_OF_NONNULLS_AGG (in _child any) returns any\n"
+"from vectorbld_init, vector_of_nonnulls_bld_agg_acc, vectorbld_agg_final\n"
+"order\n";
 
 static const char *other155 = 
-"create aggregate DB.DBA.VECTOR_CONCAT_AGG (in _child any) returns any\n"
-"from vectorbld_init, vectorbld_concat_agg_acc, vectorbld_agg_final\n";
+"create aggregate DB.DBA.VECTOR_OR_NULL_AGG (in _child any) returns any\n"
+"from vectorbld_init, vectorbld_agg_acc, vector_or_null_bld_agg_final\n"
+"order\n";
 
 static const char *other156 = 
+"create aggregate DB.DBA.VECTOR_OF_NONNULLS_OR_NULL_AGG (in _child any) returns any\n"
+"from vectorbld_init, vector_of_nonnulls_bld_agg_acc, vector_or_null_bld_agg_final\n"
+"order\n";
+
+static const char *other157 = 
+"create aggregate DB.DBA.VECTOR_CONCAT_AGG (in _child any) returns any\n"
+"from vectorbld_init, vectorbld_concat_agg_acc, vectorbld_agg_final\n"
+"order\n";
+
+static const char *other158 = 
 "create aggregate DB.DBA.XQ_SEQUENCE_AGG (in _child any) returns any\n"
-"from xq_sequencebld_init, xq_sequencebld_agg_acc, xq_sequencebld_agg_final\n";
+"from xq_sequencebld_init, xq_sequencebld_agg_acc, xq_sequencebld_agg_final\n"
+"order\n";
+
+static const char *other159 = 
+"create aggregate DB.DBA.BAG_AGG (in _child any) returns any\n"
+"from vectorbld_init, vectorbld_agg_acc, vectorbld_agg_final\n";
+
+static const char *other160 = 
+"create aggregate DB.DBA.BAG_OF_NONNULLS_AGG (in _child any) returns any\n"
+"from vectorbld_init, vector_of_nonnulls_bld_agg_acc, vectorbld_agg_final\n";
+
+static const char *other161 = 
+"create aggregate DB.DBA.BAG_OR_NULL_AGG (in _child any) returns any\n"
+"from vectorbld_init, vectorbld_agg_acc, vector_or_null_bld_agg_final\n";
+
+static const char *other162 = 
+"create aggregate DB.DBA.BAG_OF_NONNULLS_OR_NULL_AGG (in _child any) returns any\n"
+"from vectorbld_init, vector_of_nonnulls_bld_agg_acc, vector_or_null_bld_agg_final\n";
+
+static const char *other163 = 
+"create aggregate DB.DBA.BAG_CONCAT_AGG (in _child any) returns any\n"
+"from vectorbld_init, vectorbld_concat_agg_acc, vectorbld_agg_final\n";
 
 /* vt_text.sql */
 
-static const char *proc206 = 
+static const char *proc209 = 
+"#line 28 \"[executable]/vt_text.sql\"\n"
 "create procedure DB.DBA.execstmt (in stmt varchar, out stat varchar, out msg varchar)\n"
 "{\n"
 "stat := \'00000\';\n"
@@ -7840,9 +8161,10 @@ static const char *proc206 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src vt_text.sql:27\n";
+"--src vt_text.sql:26\n";
 
-static const char *proc207 = 
+static const char *proc210 = 
+"#line 40 \"[executable]/vt_text.sql\"\n"
 "create procedure DB.DBA.vt_create_ftt (in tb varchar, in id varchar, in dbcol varchar, in is_intr integer)\n"
 "{\n"
 "declare stmt, stat, msg, verr varchar;\n"
@@ -8228,9 +8550,10 @@ static const char *proc207 =
 "signal (stat, msg);\n"
 "}\n"
 "}\n"
-"--src vt_text.sql:39\n";
+"--src vt_text.sql:38\n";
 
-static const char *proc208 = 
+static const char *proc211 = 
+"#line 428 \"[executable]/vt_text.sql\"\n"
 "create procedure DB.DBA.vt_drop_ftt (in tb varchar, in dbcol varchar)\n"
 "{\n"
 "declare stmt, stat, msg varchar;\n"
@@ -8278,21 +8601,22 @@ static const char *proc208 =
 "delete from DB.DBA.SYS_SCHEDULED_EVENT where SE_NAME = sprintf (\'Notification for text hits on \"%s.%s.%s\"\', tbn0, tbn1, tbn2);\n"
 "return;\n"
 "}\n"
-"--src vt_text.sql:427\n";
+"--src vt_text.sql:426\n";
 
-static const char *other157 = 
+static const char *other164 = 
 "grant execute on DB.DBA.vt_create_text_index to public\n";
 /* phrasematch.sql */
 
-static const char *proc209 = 
+static const char *proc212 = 
+"#line 24 \"[executable]/phrasematch.sql\"\n"
 "create procedure AP_EXEC_NO_ERROR (in expr varchar)\n"
 "{\n"
 "declare state, message, meta, result any;\n"
 "exec(expr, state, message, vector(), 0, meta, result);\n"
 "}\n"
-"--src phrasematch.sql:23\n";
+"--src phrasematch.sql:22\n";
 
-static const char *tbl6 = 
+static const char *tbl7 = 
 "create table DB.DBA.SYS_ANN_PHRASE_CLASS\n"
 "(\n"
 "APC_ID integer not null primary key,\n"
@@ -8305,7 +8629,7 @@ static const char *tbl6 =
 "alter index SYS_ANN_PHRASE_CLASS on DB.DBA.SYS_ANN_PHRASE_CLASS partition cluster replicated\n"
 "create unique index SYS_ANN_PHRASE_CLASS_APC_NAME on DB.DBA.SYS_ANN_PHRASE_CLASS (APC_NAME) partition cluster replicated\n";
 
-static const char *tbl7 = 
+static const char *tbl8 = 
 "create table DB.DBA.SYS_ANN_PHRASE_SET\n"
 "(\n"
 "APS_ID integer not null primary key,\n"
@@ -8321,7 +8645,7 @@ static const char *tbl7 =
 "alter index SYS_ANN_PHRASE_SET on DB.DBA.SYS_ANN_PHRASE_SET partition cluster replicated\n"
 "create unique index SYS_ANN_PHRASE_SET_APS_NAME on DB.DBA.SYS_ANN_PHRASE_SET (APS_NAME) partition cluster replicated\n";
 
-static const char *tbl8 = 
+static const char *tbl9 = 
 "create table DB.DBA.SYS_ANN_PHRASE\n"
 "(\n"
 "AP_APS_ID integer not null,\n"
@@ -8333,7 +8657,7 @@ static const char *tbl8 =
 ")\n"
 "alter index SYS_ANN_PHRASE on DB.DBA.SYS_ANN_PHRASE partition cluster replicated\n";
 
-static const char *tbl9 = 
+static const char *tbl10 = 
 "create table DB.DBA.SYS_ANN_AD_ACCOUNT (\n"
 "AAA_ID integer not null primary key,\n"
 "AAA_NAME varchar(255),\n"
@@ -8345,7 +8669,7 @@ static const char *tbl9 =
 "alter index SYS_ANN_AD_ACCOUNT on DB.DBA.SYS_ANN_AD_ACCOUNT partition cluster replicated\n"
 "create unique index SYS_ANN_AD_ACCOUNT_AAA_NAME on DB.DBA.SYS_ANN_AD_ACCOUNT (AAA_NAME) partition cluster replicated\n";
 
-static const char *tbl10 = 
+static const char *tbl11 = 
 "create table DB.DBA.SYS_ANN_LINK (\n"
 "AL_ID integer primary key,\n"
 "AL_OWNER_UID integer,\n"
@@ -8358,7 +8682,7 @@ static const char *tbl10 =
 ")\n"
 "alter index SYS_ANN_LINK on DB.DBA.SYS_ANN_LINK partition cluster replicated\n";
 
-static const char *tbl11 = 
+static const char *tbl12 = 
 "create table DB.DBA.SYS_ANN_AD_RULE (\n"
 "AAR_AAA_ID integer not null,\n"
 "AAR_APS_ID integer not null,\n"
@@ -8371,50 +8695,57 @@ static const char *tbl11 =
 "alter index SYS_ANN_AD_RULE on DB.DBA.SYS_ANN_AD_RULE partition cluster replicated\n";
 
 static const char *trig0 = 
+"#line 149 \"[executable]/phrasematch.sql\"\n"
 "create trigger SYS_ANN_PHRASE_CLASS_I after insert on DB.DBA.SYS_ANN_PHRASE_CLASS referencing new as N\n"
 "{\n"
 "ap_class_status (N.APC_ID, 1, 1);\n"
 "}\n"
-"--src phrasematch.sql:148\n";
+"--src phrasematch.sql:147\n";
 
 static const char *trig1 = 
+"#line 155 \"[executable]/phrasematch.sql\"\n"
 "create trigger SYS_ANN_PHRASE_CLASS_U after update on DB.DBA.SYS_ANN_PHRASE_CLASS referencing new as N\n"
 "{\n"
 "ap_class_status (N.APC_ID, 1, 1);\n"
 "}\n"
-"--src phrasematch.sql:154\n";
+"--src phrasematch.sql:153\n";
 
 static const char *trig2 = 
+"#line 161 \"[executable]/phrasematch.sql\"\n"
 "create trigger SYS_ANN_PHRASE_CLASS_BD before delete on DB.DBA.SYS_ANN_PHRASE_CLASS referencing old as O\n"
 "{\n"
 "if (exists (select top 1 1 from DB.DBA.SYS_ANN_PHRASE_SET where APS_APC_ID = O.APC_ID))\n"
 "signal (\'42000\', sprintf (\'Integrity violation: can not delete annotation phrase class \"%s\" that is referenced by a phrase set\', O.APC_NAME));\n"
 "ap_class_status (O.APC_ID, 0);\n"
 "}\n"
-"--src phrasematch.sql:160\n";
+"--src phrasematch.sql:159\n";
 
 static const char *trig3 = 
+"#line 169 \"[executable]/phrasematch.sql\"\n"
 "create trigger SYS_ANN_PHRASE_SET_I after insert on DB.DBA.SYS_ANN_PHRASE_SET referencing new as N\n"
 "{\n"
 "ap_set_status (N.APS_ID, 1, 1);\n"
 "}\n"
-"--src phrasematch.sql:168\n";
+"--src phrasematch.sql:167\n";
 
 static const char *trig4 = 
+"#line 175 \"[executable]/phrasematch.sql\"\n"
 "create trigger SYS_ANN_PHRASE_SET_U after update on DB.DBA.SYS_ANN_PHRASE_SET referencing new as N\n"
 "{\n"
 "ap_set_status (N.APS_ID, 1, 1);\n"
 "}\n"
-"--src phrasematch.sql:174\n";
+"--src phrasematch.sql:173\n";
 
 static const char *trig5 = 
+"#line 181 \"[executable]/phrasematch.sql\"\n"
 "create trigger SYS_ANN_PHRASE_SET_BD before delete on DB.DBA.SYS_ANN_PHRASE_SET referencing old as O\n"
 "{\n"
 "ap_set_status (O.APS_ID, 0);\n"
 "}\n"
-"--src phrasematch.sql:180\n";
+"--src phrasematch.sql:179\n";
 
-static const char *proc210 = 
+static const char *proc213 = 
+"#line 187 \"[executable]/phrasematch.sql\"\n"
 "create procedure DB.DBA.ANN_BOOT()\n"
 "{\n"
 "ap_global_init ();\n"
@@ -8427,9 +8758,10 @@ static const char *proc210 =
 "ap_set_status (APS_ID, case (APS_LOAD_AT_BOOT) when 0 then 1 else 2 end, 0);\n"
 "}\n"
 "}\n"
-"--src phrasematch.sql:186\n";
+"--src phrasematch.sql:185\n";
 
-static const char *proc211 = 
+static const char *proc214 = 
+"#line 201 \"[executable]/phrasematch.sql\"\n"
 "create function ANN_AUTHENTICATE (in id any, in what char (1), in access char, in auth_uname any, in auth_pwd varchar, inout auth_uid integer := null) returns integer\n"
 "{\n"
 "declare uid, owner_uid, reader_gid, res_id integer;\n"
@@ -8506,9 +8838,10 @@ static const char *proc211 =
 "\n"
 "return -12;\n"
 "}\n"
-"--src phrasematch.sql:200\n";
+"--src phrasematch.sql:199\n";
 
-static const char *proc212 = 
+static const char *proc215 = 
+"#line 279 \"[executable]/phrasematch.sql\"\n"
 "create function ANN_GETID (in what varchar )\n"
 "{\n"
 "if (\'C\' = what)\n"
@@ -8541,9 +8874,10 @@ static const char *proc212 =
 "}\n"
 "return -14;\n"
 "}\n"
-"--src phrasematch.sql:278\n";
+"--src phrasematch.sql:277\n";
 
-static const char *proc213 = 
+static const char *proc216 = 
+"#line 314 \"[executable]/phrasematch.sql\"\n"
 " create function ANN_PHRASE_CLASS_ADD (in _name varchar, in _owner_uid integer, in _reader_gid integer, in _callback varchar, in _app_env any, in mode varchar, in auth_uname varchar, in auth_pwd varchar) returns integer\n"
 "{\n"
 "declare auth_uid, _id integer;\n"
@@ -8563,18 +8897,20 @@ static const char *proc213 =
 "}\n"
 "return ANN_PHRASE_CLASS_ADD_INT (_id, _name, _owner_uid, _reader_gid, _callback, _app_env);\n"
 "}\n"
-"--src phrasematch.sql:313\n";
+"--src phrasematch.sql:312\n";
 
-static const char *proc214 = 
+static const char *proc217 = 
+"#line 335 \"[executable]/phrasematch.sql\"\n"
 "create function ANN_PHRASE_CLASS_ADD_INT (in _id integer, in _name varchar, in _owner_uid integer, in _reader_gid integer, in _callback varchar, in _app_env any)\n"
 "{\n"
 "insert replacing DB.DBA.SYS_ANN_PHRASE_CLASS (APC_ID, APC_NAME, APC_OWNER_UID, APC_READER_GID, APC_CALLBACK, APC_APP_ENV)\n"
 "values (_id, _name, _owner_uid, _reader_gid, _callback, _app_env);\n"
 "return _id;\n"
 "}\n"
-"--src phrasematch.sql:334\n";
+"--src phrasematch.sql:333\n";
 
-static const char *proc215 = 
+static const char *proc218 = 
+"#line 344 \"[executable]/phrasematch.sql\"\n"
 " create function ANN_PHRASE_CLASS_DEL (in _name varchar, in auth_uname varchar, in auth_pwd varchar) returns integer\n"
 "{\n"
 "declare auth_uid, _id integer;\n"
@@ -8594,9 +8930,10 @@ static const char *proc215 =
 "delete from DB.DBA.SYS_ANN_PHRASE_CLASS where APC_ID = _id;\n"
 "return _id;\n"
 "}\n"
-"--src phrasematch.sql:343\n";
+"--src phrasematch.sql:342\n";
 
-static const char *proc216 = 
+static const char *proc219 = 
+"#line 366 \"[executable]/phrasematch.sql\"\n"
 " create function ANN_PHRASE_SET_ADD (in _name varchar, in _owner_uid integer, in _reader_gid integer, in _apc_name varchar, in _lang_name varchar, in _app_env any, in _size integer, in _load_at_boot integer, in mode varchar, in auth_uname varchar, in auth_pwd varchar) returns integer\n"
 "{\n"
 "declare auth_uid, _id, _apc_id integer;\n"
@@ -8623,18 +8960,20 @@ static const char *proc216 =
 "}\n"
 "return ANN_PHRASE_SET_ADD_INT (_id, _name, _owner_uid, _reader_gid, _apc_id, _lang_name, _app_env, _size, _load_at_boot);\n"
 "}\n"
-"--src phrasematch.sql:365\n";
+"--src phrasematch.sql:364\n";
 
-static const char *proc217 = 
+static const char *proc220 = 
+"#line 394 \"[executable]/phrasematch.sql\"\n"
 "create function ANN_PHRASE_SET_ADD_INT (in _id integer, in _name varchar, in _owner_uid integer, in _reader_gid integer, in _apc_id integer, in _lang_name varchar, in _app_env any, in _size integer, in _load_at_boot integer)\n"
 "{\n"
 "insert replacing DB.DBA.SYS_ANN_PHRASE_SET (APS_ID, APS_NAME, APS_OWNER_UID, APS_READER_GID, APS_APC_ID, APS_LANG_NAME, APS_APP_ENV, APS_SIZE, APS_LOAD_AT_BOOT)\n"
 "values (_id, _name, _owner_uid, _reader_gid, _apc_id, _lang_name, _app_env, _size, _load_at_boot);\n"
 "return _id;\n"
 "}\n"
-"--src phrasematch.sql:393\n";
+"--src phrasematch.sql:392\n";
 
-static const char *proc218 = 
+static const char *proc221 = 
+"#line 403 \"[executable]/phrasematch.sql\"\n"
 " create function ANN_PHRASE_SET_DEL (in _name varchar, in auth_uname varchar, in auth_pwd varchar) returns integer\n"
 "{\n"
 "declare auth_uid, _id integer;\n"
@@ -8655,9 +8994,10 @@ static const char *proc218 =
 "delete from DB.DBA.SYS_ANN_PHRASE_SET where APS_ID = _id;\n"
 "return _id;\n"
 "}\n"
-"--src phrasematch.sql:402\n";
+"--src phrasematch.sql:401\n";
 
-static const char *proc219 = 
+static const char *proc222 = 
+"#line 426 \"[executable]/phrasematch.sql\"\n"
 " create function ANN_LINK_ADD (in _owner_uid integer, in _uri varchar, in _text varchar, in _note varchar, in _tags any, in _callback varchar, in _app_env any) returns integer\n"
 "{\n"
 "declare _id integer;\n"
@@ -8666,9 +9006,10 @@ static const char *proc219 =
 "values (_id, _owner_uid, _uri, _text, _note, _tags, _callback, _app_env);\n"
 "return _id;\n"
 "}\n"
-"--src phrasematch.sql:425\n";
+"--src phrasematch.sql:424\n";
 
-static const char *proc220 = 
+static const char *proc223 = 
+"#line 437 \"[executable]/phrasematch.sql\"\n"
 " create function ANN_LINK_MODIFY (in _id integer, in _owner_uid integer, in _uri varchar, in _text varchar, in _note varchar, in _tags any, in _callback varchar, in _app_env any, in auth_uname varchar, in auth_pwd varchar) returns integer\n"
 "{\n"
 "declare _res integer;\n"
@@ -8681,9 +9022,10 @@ static const char *proc220 =
 "values (_id, _owner_uid, _uri, _text, _note, _tags, _callback, _app_env);\n"
 "return _id;\n"
 "}\n"
-"--src phrasematch.sql:436\n";
+"--src phrasematch.sql:435\n";
 
-static const char *proc221 = 
+static const char *proc224 = 
+"#line 452 \"[executable]/phrasematch.sql\"\n"
 " create function ANN_LINK_DEL (in _id integer, in auth_uname varchar, in auth_pwd varchar) returns integer\n"
 "{\n"
 "declare _res integer;\n"
@@ -8704,9 +9046,10 @@ static const char *proc221 =
 "delete from DB.DBA.SYS_ANN_LINK where AL_ID = _id;\n"
 "return _id;\n"
 "}\n"
-"--src phrasematch.sql:451\n";
+"--src phrasematch.sql:450\n";
 
-static const char *proc222 = 
+static const char *proc225 = 
+"#line 475 \"[executable]/phrasematch.sql\"\n"
 " create function ANN_AD_RULE_ADD (in aaa_name varchar, in aps_name varchar, in _text varchar, in _al_id integer, in _app_env any, in _lang_name varchar, in auth_uname varchar, in auth_pwd varchar) returns integer\n"
 "{\n"
 "declare _aaa_id, _aps_id, _ap_chksum integer;\n"
@@ -8753,9 +9096,10 @@ static const char *proc222 =
 "commit work;\n"
 "return 0;\n"
 "}\n"
-"--src phrasematch.sql:474\n";
+"--src phrasematch.sql:473\n";
 
-static const char *proc223 = 
+static const char *proc226 = 
+"#line 524 \"[executable]/phrasematch.sql\"\n"
 " create function ANN_AD_RULE_DEL (in aaa_name varchar, in aps_name varchar, in _text varchar, in _al_id integer, in _lang_name varchar, in auth_uname varchar, in auth_pwd varchar) returns integer\n"
 "{\n"
 "declare _aaa_id, _aps_id, _ap_chksum integer;\n"
@@ -8835,9 +9179,10 @@ static const char *proc223 =
 "commit work;\n"
 "return res;\n"
 "}\n"
-"--src phrasematch.sql:523\n";
+"--src phrasematch.sql:522\n";
 
-static const char *proc224 = 
+static const char *proc227 = 
+"#line 605 \"[executable]/phrasematch.sql\"\n"
 "create procedure DB.DBA.ANN_ZAP ()\n"
 "{\n"
 "declare _aps_id, _prev_aps_id integer;\n"
@@ -8863,13 +9208,14 @@ static const char *proc224 =
 "delete from DB.DBA.SYS_ANN_PHRASE_CLASS;\n"
 "commit work;\n"
 "}\n"
-"--src phrasematch.sql:604\n";
+"--src phrasematch.sql:603\n";
 
-static const char *other158 = 
+static const char *other165 = 
 "AP_EXEC_NO_ERROR (\'DB.DBA.ANN_BOOT()\')\n";
 /* hosting.sql */
 
-static const char *proc225 = 
+static const char *proc228 = 
+"#line 23 \"[executable]/hosting.sql\"\n"
 "create procedure WS.WS.GET_CGI_VARS_VECTOR (inout lines any) returns ANY\n"
 "{\n"
 "declare options any;\n"
@@ -8938,7 +9284,7 @@ static const char *proc225 =
 "}\n"
 "return options;\n"
 "}\n"
-"--src hosting.sql:22\n";
+"--src hosting.sql:21\n";
 
 static int
 sch_proc_def_exists (client_connection_t *cli, const char *proc_name)
@@ -9279,48 +9625,52 @@ sqls_define (void)
   ddl_ensure_table ("do this always", other130);
   ddl_ensure_table ("do this always", other131);
   ddl_ensure_table ("do this always", other132);
+  ddl_ensure_table ("DB.DBA.SYS_X509_CERTIFICATES", tbl6);
+  DEFINE_PROC ("X509_CERTIFICATES_ADD", proc145);
+  DEFINE_PROC ("X509_CERTIFICATES_DEL", proc146);
+  DEFINE_PROC ("X509_ROOT_CA_CERTS", proc147);
 
   /* odbccat.sql */
 
-  DEFINE_PROC ("sql_normalize_qon", proc145);
-  DEFINE_PROC ("sql_filter_qon", proc146);
-  DEFINE_PROC ("sql_columns", proc147);
-  DEFINE_PROC ("sql_tables", proc148);
-  DEFINE_PROC ("sql_primary_keys", proc149);
-  DEFINE_PROC ("sql_statistics", proc150);
-  DEFINE_PROC ("sql_procedures", proc151);
-  DEFINE_PROC ("sql_procedure_cols", proc152);/* AWK macro AWK PLBIF sql_foreign_keys*/
-  DEFINE_PUBLIC_PROC ("sql_foreign_keys", proc153);
-  DEFINE_PROC ("__virt_sql_qon_is_oracle_oracle", proc154);
-  DEFINE_PROC ("sql_normalize_qon_oracle_oracle", proc155);
-  DEFINE_PROC ("sql_filter_qon_oracle_oracle", proc156);
-  DEFINE_PROC ("sql_normalize_qon_oracle_msora", proc157);
-  DEFINE_PROC ("sql_normalize_qon_infohub_dcsyb30", proc158);
-  DEFINE_PROC ("sql_tables_pre_infohub_dcsyb30", proc159);
-  DEFINE_PROC ("sql_tables_post_infohub_dcsyb30", proc160);
-  DEFINE_PROC ("sql_columns_post_oracle_openlink", proc161);
-  DEFINE_PROC ("sql_tables_post_progress_win_openlink", proc162);
-  DEFINE_PROC ("sql_tables_post_excel_drv", proc163);
-  DEFINE_PROC ("sql_tables_pre_excel_drv", proc164);
-  DEFINE_PROC ("sql_normalize_qon_viaserv_opl", proc165);
+  DEFINE_PROC ("sql_normalize_qon", proc148);
+  DEFINE_PROC ("sql_filter_qon", proc149);
+  DEFINE_PROC ("sql_columns", proc150);
+  DEFINE_PROC ("sql_tables", proc151);
+  DEFINE_PROC ("sql_primary_keys", proc152);
+  DEFINE_PROC ("sql_statistics", proc153);
+  DEFINE_PROC ("sql_procedures", proc154);
+  DEFINE_PROC ("sql_procedure_cols", proc155);/* AWK macro AWK PLBIF sql_foreign_keys*/
+  DEFINE_PUBLIC_PROC ("sql_foreign_keys", proc156);
+  DEFINE_PROC ("__virt_sql_qon_is_oracle_oracle", proc157);
+  DEFINE_PROC ("sql_normalize_qon_oracle_oracle", proc158);
+  DEFINE_PROC ("sql_filter_qon_oracle_oracle", proc159);
+  DEFINE_PROC ("sql_normalize_qon_oracle_msora", proc160);
+  DEFINE_PROC ("sql_normalize_qon_infohub_dcsyb30", proc161);
+  DEFINE_PROC ("sql_tables_pre_infohub_dcsyb30", proc162);
+  DEFINE_PROC ("sql_tables_post_infohub_dcsyb30", proc163);
+  DEFINE_PROC ("sql_columns_post_oracle_openlink", proc164);
+  DEFINE_PROC ("sql_tables_post_progress_win_openlink", proc165);
+  DEFINE_PROC ("sql_tables_post_excel_drv", proc166);
+  DEFINE_PROC ("sql_tables_pre_excel_drv", proc167);
+  DEFINE_PROC ("sql_normalize_qon_viaserv_opl", proc168);
 
   /* useraggr.sql */
  
-  DEFINE_PUBLIC_PROC ("STD_COUNT", proc166); 
-  DEFINE_PUBLIC_PROC ("STD11_INIT", proc167); 
-  DEFINE_PUBLIC_PROC ("STD12_INIT", proc168); 
-  DEFINE_PUBLIC_PROC ("STD13_INIT", proc169); 
-  DEFINE_PUBLIC_PROC ("VAR_ACC", proc170); 
-  DEFINE_PUBLIC_PROC ("VAR_POP_FIN", proc171); 
-  DEFINE_PUBLIC_PROC ("VAR_SAMP_FIN", proc172); 
-  DEFINE_PUBLIC_PROC ("VAR_FIN", proc173); 
-  DEFINE_PUBLIC_PROC ("STDDEV_POP_FIN", proc174); 
-  DEFINE_PUBLIC_PROC ("STDDEV_SAMP_FIN", proc175); 
-  DEFINE_PUBLIC_PROC ("STDDEV_FIN", proc176); 
-  DEFINE_PUBLIC_PROC ("COVAR_ACC", proc177); 
-  DEFINE_PUBLIC_PROC ("COVAR_SAMP_FIN", proc178); 
-  DEFINE_PUBLIC_PROC ("COVAR_POP_FIN", proc179); 
-  DEFINE_PUBLIC_PROC ("COVAR_FIN", proc180);
+  DEFINE_PUBLIC_PROC ("STD_COUNT", proc169); 
+  DEFINE_PUBLIC_PROC ("STD11_INIT", proc170); 
+  DEFINE_PUBLIC_PROC ("STD12_INIT", proc171); 
+  DEFINE_PUBLIC_PROC ("STD13_INIT", proc172); 
+  DEFINE_PUBLIC_PROC ("VAR_ACC", proc173); 
+  DEFINE_PUBLIC_PROC ("VAR_POP_FIN", proc174); 
+  DEFINE_PUBLIC_PROC ("VAR_SAMP_FIN", proc175); 
+  DEFINE_PUBLIC_PROC ("VAR_FIN", proc176); 
+  DEFINE_PUBLIC_PROC ("STDDEV_POP_FIN", proc177); 
+  DEFINE_PUBLIC_PROC ("STDDEV_SAMP_FIN", proc178); 
+  DEFINE_PUBLIC_PROC ("STDDEV_FIN", proc179); 
+  DEFINE_PUBLIC_PROC ("COVAR_ACC", proc180); 
+  DEFINE_PUBLIC_PROC ("COVAR_SAMP_FIN", proc181); 
+  DEFINE_PUBLIC_PROC ("COVAR_POP_FIN", proc182); 
+  DEFINE_PUBLIC_PROC ("COVAR_FIN", proc183);
   ddl_ensure_table ("do this always", other133);
   ddl_ensure_table ("do this always", other134);
   ddl_ensure_table ("do this always", other135);
@@ -9330,89 +9680,96 @@ sqls_define (void)
   ddl_ensure_table ("do this always", other139);
   ddl_ensure_table ("do this always", other140);
   ddl_ensure_table ("do this always", other141); 
-  DEFINE_PUBLIC_PROC ("REGR_SLOPE_INIT", proc181); 
-  DEFINE_PUBLIC_PROC ("REGR_SLOPE_ACC", proc182); 
-  DEFINE_PUBLIC_PROC ("REGR_SLOPE_FIN", proc183);
+  DEFINE_PUBLIC_PROC ("REGR_SLOPE_INIT", proc184); 
+  DEFINE_PUBLIC_PROC ("REGR_SLOPE_ACC", proc185); 
+  DEFINE_PUBLIC_PROC ("REGR_SLOPE_FIN", proc186);
   ddl_ensure_table ("do this always", other142); 
-  DEFINE_PUBLIC_PROC ("REGR_INTERCEPT_INIT", proc184); 
-  DEFINE_PUBLIC_PROC ("REGR_INTERCEPT_ACC", proc185); 
-  DEFINE_PUBLIC_PROC ("REGR_INTERCEPT_FIN", proc186);
+  DEFINE_PUBLIC_PROC ("REGR_INTERCEPT_INIT", proc187); 
+  DEFINE_PUBLIC_PROC ("REGR_INTERCEPT_ACC", proc188); 
+  DEFINE_PUBLIC_PROC ("REGR_INTERCEPT_FIN", proc189);
   ddl_ensure_table ("do this always", other143); 
-  DEFINE_PUBLIC_PROC ("REGR_COUNT_INIT", proc187); 
-  DEFINE_PUBLIC_PROC ("REGR_COUNT_ACC", proc188); 
-  DEFINE_PUBLIC_PROC ("REGR_COUNT_FIN", proc189); 
-  DEFINE_PUBLIC_PROC ("REGR_COUNT_MERGE", proc190);
+  DEFINE_PUBLIC_PROC ("REGR_COUNT_INIT", proc190); 
+  DEFINE_PUBLIC_PROC ("REGR_COUNT_ACC", proc191); 
+  DEFINE_PUBLIC_PROC ("REGR_COUNT_FIN", proc192); 
+  DEFINE_PUBLIC_PROC ("REGR_COUNT_MERGE", proc193);
   ddl_ensure_table ("do this always", other144); 
-  DEFINE_PUBLIC_PROC ("REGR_AVG_ACC", proc191); 
-  DEFINE_PUBLIC_PROC ("REGR_AVGX_FIN", proc192); 
-  DEFINE_PUBLIC_PROC ("REGR_AVGY_FIN", proc193);
+  DEFINE_PUBLIC_PROC ("REGR_AVG_ACC", proc194); 
+  DEFINE_PUBLIC_PROC ("REGR_AVGX_FIN", proc195); 
+  DEFINE_PUBLIC_PROC ("REGR_AVGY_FIN", proc196);
   ddl_ensure_table ("do this always", other145);
   ddl_ensure_table ("do this always", other146); 
-  DEFINE_PUBLIC_PROC ("CORR_INIT", proc194); 
-  DEFINE_PUBLIC_PROC ("CORR_ACC", proc195); 
-  DEFINE_PUBLIC_PROC ("CORR_FIN", proc196);
+  DEFINE_PUBLIC_PROC ("CORR_INIT", proc197); 
+  DEFINE_PUBLIC_PROC ("CORR_ACC", proc198); 
+  DEFINE_PUBLIC_PROC ("CORR_FIN", proc199);
   ddl_ensure_table ("do this always", other147); 
-  DEFINE_PUBLIC_PROC ("REGR_R2_INIT", proc197); 
-  DEFINE_PUBLIC_PROC ("REGR_R2_ACC", proc198); 
-  DEFINE_PUBLIC_PROC ("REGR_R2_FIN", proc199);
+  DEFINE_PUBLIC_PROC ("REGR_R2_INIT", proc200); 
+  DEFINE_PUBLIC_PROC ("REGR_R2_ACC", proc201); 
+  DEFINE_PUBLIC_PROC ("REGR_R2_FIN", proc202);
   ddl_ensure_table ("do this always", other148); 
-  DEFINE_PUBLIC_PROC ("REGR_SXX_ACC", proc200); 
-  DEFINE_PUBLIC_PROC ("REGR_SYY_ACC", proc201); 
-  DEFINE_PUBLIC_PROC ("REGR_SXY_ACC", proc202); 
-  DEFINE_PUBLIC_PROC ("REGR_S___FIN", proc203); 
-  DEFINE_PUBLIC_PROC ("REGR_SXY_FIN", proc204);
+  DEFINE_PUBLIC_PROC ("REGR_SXX_ACC", proc203); 
+  DEFINE_PUBLIC_PROC ("REGR_SYY_ACC", proc204); 
+  DEFINE_PUBLIC_PROC ("REGR_SXY_ACC", proc205); 
+  DEFINE_PUBLIC_PROC ("REGR_S___FIN", proc206); 
+  DEFINE_PUBLIC_PROC ("REGR_SXY_FIN", proc207);
   ddl_ensure_table ("do this always", other149);
   ddl_ensure_table ("do this always", other150);
   ddl_ensure_table ("do this always", other151); 
-  DEFINE_PUBLIC_PROC ("xte_nodebld_final_root", proc205);
+  DEFINE_PUBLIC_PROC ("xte_nodebld_final_root", proc208);
   ddl_ensure_table ("do this always", other152);
   ddl_ensure_table ("do this always", other153);
   ddl_ensure_table ("do this always", other154);
   ddl_ensure_table ("do this always", other155);
   ddl_ensure_table ("do this always", other156);
+  ddl_ensure_table ("do this always", other157);
+  ddl_ensure_table ("do this always", other158);
+  ddl_ensure_table ("do this always", other159);
+  ddl_ensure_table ("do this always", other160);
+  ddl_ensure_table ("do this always", other161);
+  ddl_ensure_table ("do this always", other162);
+  ddl_ensure_table ("do this always", other163);
 
   /* vt_text.sql */
 
-  DEFINE_PROC ("DB.DBA.execstmt", proc206);
-  DEFINE_PROC ("DB.DBA.vt_create_ftt", proc207);
-  DEFINE_PROC ("DB.DBA.vt_drop_ftt", proc208);
-  ddl_ensure_table ("do this always", other157);
+  DEFINE_PROC ("DB.DBA.execstmt", proc209);
+  DEFINE_PROC ("DB.DBA.vt_create_ftt", proc210);
+  DEFINE_PROC ("DB.DBA.vt_drop_ftt", proc211);
+  ddl_ensure_table ("do this always", other164);
 
   /* phrasematch.sql */
 
-  DEFINE_PROC ("AP_EXEC_NO_ERROR", proc209);
-  ddl_ensure_table ("DB.DBA.SYS_ANN_PHRASE_CLASS", tbl6);
-  ddl_ensure_table ("DB.DBA.SYS_ANN_PHRASE_SET", tbl7);
-  ddl_ensure_table ("DB.DBA.SYS_ANN_PHRASE", tbl8);
-  ddl_ensure_table ("DB.DBA.SYS_ANN_AD_ACCOUNT", tbl9);
-  ddl_ensure_table ("DB.DBA.SYS_ANN_LINK", tbl10);
-  ddl_ensure_table ("DB.DBA.SYS_ANN_AD_RULE", tbl11);
+  DEFINE_PROC ("AP_EXEC_NO_ERROR", proc212);
+  ddl_ensure_table ("DB.DBA.SYS_ANN_PHRASE_CLASS", tbl7);
+  ddl_ensure_table ("DB.DBA.SYS_ANN_PHRASE_SET", tbl8);
+  ddl_ensure_table ("DB.DBA.SYS_ANN_PHRASE", tbl9);
+  ddl_ensure_table ("DB.DBA.SYS_ANN_AD_ACCOUNT", tbl10);
+  ddl_ensure_table ("DB.DBA.SYS_ANN_LINK", tbl11);
+  ddl_ensure_table ("DB.DBA.SYS_ANN_AD_RULE", tbl12);
   ddl_std_proc (trig0, 0x0);
   ddl_std_proc (trig1, 0x0);
   ddl_std_proc (trig2, 0x0);
   ddl_std_proc (trig3, 0x0);
   ddl_std_proc (trig4, 0x0);
   ddl_std_proc (trig5, 0x0);
-  DEFINE_PROC ("DB.DBA.ANN_BOOT", proc210);
-  DEFINE_PROC ("ANN_AUTHENTICATE", proc211);
-  DEFINE_PROC ("ANN_GETID", proc212); 
-  DEFINE_PUBLIC_PROC ("ANN_PHRASE_CLASS_ADD", proc213);
-  DEFINE_PROC ("ANN_PHRASE_CLASS_ADD_INT", proc214); 
-  DEFINE_PUBLIC_PROC ("ANN_PHRASE_CLASS_DEL", proc215); 
-  DEFINE_PUBLIC_PROC ("ANN_PHRASE_SET_ADD", proc216);
-  DEFINE_PROC ("ANN_PHRASE_SET_ADD_INT", proc217); 
-  DEFINE_PUBLIC_PROC ("ANN_PHRASE_SET_DEL", proc218); 
-  DEFINE_PUBLIC_PROC ("ANN_LINK_ADD", proc219); 
-  DEFINE_PUBLIC_PROC ("ANN_LINK_MODIFY", proc220); 
-  DEFINE_PUBLIC_PROC ("ANN_LINK_DEL", proc221); 
-  DEFINE_PUBLIC_PROC ("ANN_AD_RULE_ADD", proc222); 
-  DEFINE_PUBLIC_PROC ("ANN_AD_RULE_DEL", proc223);
-  DEFINE_PROC ("DB.DBA.ANN_ZAP", proc224);
-  ddl_ensure_table ("do this always", other158);
+  DEFINE_PROC ("DB.DBA.ANN_BOOT", proc213);
+  DEFINE_PROC ("ANN_AUTHENTICATE", proc214);
+  DEFINE_PROC ("ANN_GETID", proc215); 
+  DEFINE_PUBLIC_PROC ("ANN_PHRASE_CLASS_ADD", proc216);
+  DEFINE_PROC ("ANN_PHRASE_CLASS_ADD_INT", proc217); 
+  DEFINE_PUBLIC_PROC ("ANN_PHRASE_CLASS_DEL", proc218); 
+  DEFINE_PUBLIC_PROC ("ANN_PHRASE_SET_ADD", proc219);
+  DEFINE_PROC ("ANN_PHRASE_SET_ADD_INT", proc220); 
+  DEFINE_PUBLIC_PROC ("ANN_PHRASE_SET_DEL", proc221); 
+  DEFINE_PUBLIC_PROC ("ANN_LINK_ADD", proc222); 
+  DEFINE_PUBLIC_PROC ("ANN_LINK_MODIFY", proc223); 
+  DEFINE_PUBLIC_PROC ("ANN_LINK_DEL", proc224); 
+  DEFINE_PUBLIC_PROC ("ANN_AD_RULE_ADD", proc225); 
+  DEFINE_PUBLIC_PROC ("ANN_AD_RULE_DEL", proc226);
+  DEFINE_PROC ("DB.DBA.ANN_ZAP", proc227);
+  ddl_ensure_table ("do this always", other165);
 
   /* hosting.sql */
 
-  DEFINE_PROC ("WS.WS.GET_CGI_VARS_VECTOR", proc225);
+  DEFINE_PROC ("WS.WS.GET_CGI_VARS_VECTOR", proc228);
 }
 
 
diff --git a/libsrc/Wi/sql_code_1.c b/libsrc/Wi/sql_code_1.c
index 1649723..ffe440d 100644
--- a/libsrc/Wi/sql_code_1.c
+++ b/libsrc/Wi/sql_code_1.c
@@ -7,6 +7,7 @@
 /* oledb.sql */
 
 static const char *proc0 = 
+"#line 131 \"[executable]/oledb.sql\"\n"
 "create procedure oledb_get_types (in type integer, in best_match_restrict integer)\n"
 "{\n"
 "declare TYPE_NAME NVARCHAR(32);\n"
@@ -92,9 +93,10 @@ static const char *proc0 =
 "\n"
 "return;\n"
 "}\n"
-"--src oledb.sql:130\n";
+"--src oledb.sql:129\n";
 
 static const char *proc1 = 
+"#line 218 \"[executable]/oledb.sql\"\n"
 "create function oledb_dbtype(in dv integer) returns smallint\n"
 "{\n"
 "if (dv = 188)\n"
@@ -136,9 +138,10 @@ static const char *proc1 =
 "\n"
 "return 129;\n"
 "}\n"
-"--src oledb.sql:217\n";
+"--src oledb.sql:216\n";
 
 static const char *proc2 = 
+"#line 261 \"[executable]/oledb.sql\"\n"
 "create function oledb_dbflags(in dv integer, in nullable integer) returns integer\n"
 "{\n"
 "declare flags integer;\n"
@@ -165,9 +168,10 @@ static const char *proc2 =
 "\n"
 "return flags;\n"
 "}\n"
-"--src oledb.sql:260\n";
+"--src oledb.sql:259\n";
 
 static const char *proc3 = 
+"#line 289 \"[executable]/oledb.sql\"\n"
 "create function oledb_char_max_len(in dv integer, in prec integer) returns integer\n"
 "{\n"
 "if (dv = 188 or dv = 189 or dv = 190 or\n"
@@ -182,9 +186,10 @@ static const char *proc3 =
 "}\n"
 "return prec;\n"
 "}\n"
-"--src oledb.sql:288\n";
+"--src oledb.sql:287\n";
 
 static const char *proc4 = 
+"#line 305 \"[executable]/oledb.sql\"\n"
 "create function oledb_char_oct_len(in dv integer, in prec integer) returns integer\n"
 "{\n"
 "if (dv = 188 or dv = 189 or dv = 190 or\n"
@@ -199,9 +204,10 @@ static const char *proc4 =
 "}\n"
 "return prec;\n"
 "}\n"
-"--src oledb.sql:304\n";
+"--src oledb.sql:303\n";
 
 static const char *proc5 = 
+"#line 321 \"[executable]/oledb.sql\"\n"
 "create function oledb_num_prec(in dv integer, in prec integer) returns smallint\n"
 "{\n"
 "if (dv = 188)\n"
@@ -220,27 +226,30 @@ static const char *proc5 =
 "}\n"
 "return null;\n"
 "}\n"
-"--src oledb.sql:320\n";
+"--src oledb.sql:319\n";
 
 static const char *proc6 = 
+"#line 341 \"[executable]/oledb.sql\"\n"
 "create function oledb_num_scale(in dv integer, in scale integer) returns smallint\n"
 "{\n"
 "if (dv = 219)\n"
 "return scale;\n"
 "return null;\n"
 "}\n"
-"--src oledb.sql:340\n";
+"--src oledb.sql:339\n";
 
 static const char *proc7 = 
+"#line 349 \"[executable]/oledb.sql\"\n"
 "create function oledb_datetime_prec(in dv integer, in prec integer) returns smallint\n"
 "{\n"
 "if (dv = 211)\n"
 "return 6;\n"
 "return null;\n"
 "}\n"
-"--src oledb.sql:348\n";
+"--src oledb.sql:347\n";
 
 static const char *proc8 = 
+"#line 357 \"[executable]/oledb.sql\"\n"
 "create procedure oledb_procedure_parameters(\n"
 "in cat nvarchar, in sch nvarchar, in proc nvarchar, in param nvarchar\n"
 ")\n"
@@ -313,9 +322,10 @@ static const char *proc8 =
 "}\n"
 "}\n"
 "}\n"
-"--src oledb.sql:356\n";
+"--src oledb.sql:355\n";
 
 static const char *proc9 = 
+"#line 431 \"[executable]/oledb.sql\"\n"
 "create function oledb_procedure_definition(in name nvarchar) returns nvarchar\n"
 "{\n"
 "declare text varchar;\n"
@@ -330,7 +340,7 @@ static const char *proc9 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src oledb.sql:430\n";
+"--src oledb.sql:429\n";
 
 static const char *other0 = 
 "grant execute on oledb_get_types to public\n";
@@ -598,6 +608,7 @@ static const char *view5 =
 static const char *other15 = 
 "grant select on INFORMATION_SCHEMA.COLUMN_PRIVILEGES to public\n";
 static const char *proc10 = 
+"#line 303 \"[executable]/information_schema.sql\"\n"
 " create procedure column_privileges (in TableQualifier varchar,\n"
 "in TableOwner varchar,\n"
 "in TableName varchar,\n"
@@ -687,9 +698,10 @@ static const char *proc10 =
 "done:\n"
 "return privcount;\n"
 "}\n"
-"--src information_schema.sql:302\n";
+"--src information_schema.sql:301\n";
 
 static const char *proc11 = 
+"#line 395 \"[executable]/information_schema.sql\"\n"
 " create procedure column_privileges_utf8 (in TableQualifier varchar,\n"
 "in TableOwner varchar,\n"
 "in TableName varchar,\n"
@@ -779,7 +791,7 @@ static const char *proc11 =
 "done:\n"
 "return privcount;\n"
 "}\n"
-"--src information_schema.sql:394\n";
+"--src information_schema.sql:393\n";
 
 static const char *view6 = 
 "create view INFORMATION_SCHEMA.KEY_COLUMN_USAGE as\n"
@@ -825,6 +837,7 @@ static const char *view6 =
 static const char *other16 = 
 "grant select on INFORMATION_SCHEMA.KEY_COLUMN_USAGE to public\n";
 static const char *proc12 = 
+"#line 530 \"[executable]/information_schema.sql\"\n"
 "create procedure object_definition_or_null (in obj varchar, in text any)\n"
 "{\n"
 "declare owner varchar;\n"
@@ -833,7 +846,7 @@ static const char *proc12 =
 "return text;\n"
 "return NULL;\n"
 "}\n"
-"--src information_schema.sql:529\n";
+"--src information_schema.sql:528\n";
 
 static const char *other17 = 
 "grant execute on DB.DBA.object_definition_or_null to public\n";
diff --git a/libsrc/Wi/sql_code_2pc.c b/libsrc/Wi/sql_code_2pc.c
index b538973..23559c8 100644
--- a/libsrc/Wi/sql_code_2pc.c
+++ b/libsrc/Wi/sql_code_2pc.c
@@ -10,6 +10,7 @@ static const char *tbl0 =
 "create table _2PC.DBA.TRANSACTIONS (TRX_ID INTEGER, TRX_STATE VARCHAR)\n";
 
 static const char *proc0 = 
+"#line 27 \"[executable]/2pc.sql\"\n"
 "create procedure _2PC.DBA._FFFF_GET_SEQ_NEXT (IN seqobj VARCHAR, IN _min INTEGER, IN _max INTEGER)\n"
 "{\n"
 "DECLARE id INTEGER;\n"
@@ -21,9 +22,10 @@ static const char *proc0 =
 "}\n"
 "return sequence_next (seqobj);\n"
 "}\n"
-"--src 2pc.sql:26\n";
+"--src 2pc.sql:25\n";
 
 static const char *proc1 = 
+"#line 40 \"[executable]/2pc.sql\"\n"
 "create procedure\n"
 "_2PC.DBA._0001_ADD_ENTRY ()\n"
 "{\n"
@@ -46,9 +48,10 @@ static const char *proc1 =
 "VALUES (_trx_id, \'STARTED\');\n"
 "RETURN _trx_id;\n"
 "}\n"
-"--src 2pc.sql:39\n";
+"--src 2pc.sql:38\n";
 
 static const char *proc2 = 
+"#line 64 \"[executable]/2pc.sql\"\n"
 "create procedure _2PC.DBA._FFFF_CHECK_TRX_ID ( IN _trx_id INTEGER)\n"
 "{\n"
 "FOR SELECT TRX_ID FROM _2PC.DBA.TRANSACTIONS WHERE TRX_ID=_trx_id DO\n"
@@ -57,9 +60,10 @@ static const char *proc2 =
 "}\n"
 "signal (\'TP000\', sprintf (\'No such transaction id [%lx]\', _trx_id));\n"
 "}\n"
-"--src 2pc.sql:63\n";
+"--src 2pc.sql:62\n";
 
 static const char *proc3 = 
+"#line 75 \"[executable]/2pc.sql\"\n"
 "create procedure _2PC.DBA._0001_TRX_SSTATE ( IN _trx_id INTEGER, IN _state VARCHAR)\n"
 "{\n"
 "_2PC.DBA._FFFF_CHECK_TRX_ID (_trx_id);\n"
@@ -72,9 +76,10 @@ static const char *proc3 =
 "UPDATE _2PC.DBA.TRANSACTIONS SET TRX_STATE=_state WHERE TRX_ID=_trx_id;\n"
 "RETURN 0;\n"
 "}\n"
-"--src 2pc.sql:74\n";
+"--src 2pc.sql:73\n";
 
 static const char *proc4 = 
+"#line 89 \"[executable]/2pc.sql\"\n"
 "create procedure _2PC.DBA._0001_GET_TRX_STATE (IN _trx_id INTEGER)\n"
 "{\n"
 "_2PC.DBA._FFFF_CHECK_TRX_ID (_trx_id);\n"
@@ -90,16 +95,18 @@ static const char *proc4 =
 "RETURN;\n"
 "}\n"
 "}\n"
-"--src 2pc.sql:88\n";
+"--src 2pc.sql:87\n";
 
 static const char *proc5 = 
+"#line 106 \"[executable]/2pc.sql\"\n"
 "create procedure _2PC.DBA.virt_tp_enlist_branch (IN trx_cookie VARCHAR)\n"
 "{\n"
 "virt_tp_update_cli_001 (trx_cookie);\n"
 "}\n"
-"--src 2pc.sql:105\n";
+"--src 2pc.sql:104\n";
 
 static const char *proc6 = 
+"#line 112 \"[executable]/2pc.sql\"\n"
 "create procedure _2PC.DBA.XA_GET_ALL_XIDS_COUNT ()\n"
 "{\n"
 "DECLARE xid VARCHAR;\n"
@@ -117,9 +124,10 @@ static const char *proc6 =
 "get_rec_xid_end();\n"
 "RETURN c;\n"
 "}\n"
-"--src 2pc.sql:111\n";
+"--src 2pc.sql:110\n";
 
 static const char *proc7 = 
+"#line 131 \"[executable]/2pc.sql\"\n"
 "create procedure _2PC.DBA.OLD_XA_GET_ALL_XIDS ()\n"
 "{\n"
 "declare xid varchar;\n"
@@ -136,9 +144,10 @@ static const char *proc7 =
 "get_rec_xid_end();\n"
 "return NULL;\n"
 "}\n"
-"--src 2pc.sql:130\n";
+"--src 2pc.sql:129\n";
 
 static const char *proc8 = 
+"#line 149 \"[executable]/2pc.sql\"\n"
 "create procedure _2PC.DBA.XA_GET_ALL_XIDS ()\n"
 "{\n"
 "declare xid varchar;\n"
@@ -164,7 +173,7 @@ static const char *proc8 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src 2pc.sql:148\n";
+"--src 2pc.sql:147\n";
 
 static const char *other0 = 
 "grant execute on \"_2PC.DBA._0001_ADD_ENTRY\" to public\n";
diff --git a/libsrc/Wi/sql_code_adm.c b/libsrc/Wi/sql_code_adm.c
index 6afb99c..60e559d 100644
--- a/libsrc/Wi/sql_code_adm.c
+++ b/libsrc/Wi/sql_code_adm.c
@@ -7,6 +7,7 @@
 /* admin.sql */
 
 static const char *proc0 = 
+"#line 31 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "select_if (in sel varchar, in val varchar)\n"
 "{\n"
@@ -17,9 +18,10 @@ static const char *proc0 =
 "}\n"
 "return (\'\');\n"
 "}\n"
-"--src admin.sql:30\n";
+"--src admin.sql:29\n";
 
 static const char *proc1 = 
+"#line 44 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "check_if (in sel varchar, in val varchar)\n"
 "{\n"
@@ -30,9 +32,10 @@ static const char *proc1 =
 "}\n"
 "return (\'\');\n"
 "}\n"
-"--src admin.sql:43\n";
+"--src admin.sql:42\n";
 
 static const char *proc2 = 
+"#line 66 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_http_parm_concat (in name varchar, in delm varchar, inout params any)\n"
 "{\n"
@@ -66,9 +69,10 @@ static const char *proc2 =
 "result := concat (result, delm, tbl);\n"
 "}\n"
 "}\n"
-"--src admin.sql:65\n";
+"--src admin.sql:64\n";
 
 static const char *proc3 = 
+"#line 102 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_new_session (inout tree any)\n"
 "{\n"
@@ -89,17 +93,19 @@ static const char *proc3 =
 "\n"
 "return (sesid);\n"
 "}\n"
-"--src admin.sql:101\n";
+"--src admin.sql:100\n";
 
 static const char *proc4 = 
+"#line 125 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "ADMIN_EXPIRE_SESSIONS ()\n"
 "{\n"
 "delete from ADMIN_SESSION where datediff (\'hour\', ASES_LAST_ACCESS, now()) > 2;\n"
 "}\n"
-"--src admin.sql:124\n";
+"--src admin.sql:123\n";
 
 static const char *proc5 = 
+"#line 132 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_get_tree (in sesid varchar)\n"
 "{\n"
@@ -115,9 +121,10 @@ static const char *proc5 =
 "nf:\n"
 "return 0;\n"
 "}\n"
-"--src admin.sql:131\n";
+"--src admin.sql:130\n";
 
 static const char *proc6 = 
+"#line 150 \"[executable]/admin.sql\"\n"
 "create procedure adm_get_sesid (inout params any)\n"
 "{\n"
 "declare sesid varchar;\n"
@@ -135,10 +142,11 @@ static const char *proc6 =
 "}\n"
 "return sesid;\n"
 "}\n"
-"--src admin.sql:149\n";
+"--src admin.sql:148\n";
 
 
 static const char *proc7 = 
+"#line 171 \"[executable]/admin.sql\"\n"
 " create procedure\n"
 "adm_get_ses_var (in sesid varchar, in name varchar, in deflt any)\n"
 "{\n"
@@ -155,10 +163,11 @@ static const char *proc7 =
 "nf:\n"
 "return deflt;\n"
 "}\n"
-"--src admin.sql:170\n";
+"--src admin.sql:169\n";
 
 
 static const char *proc8 = 
+"#line 191 \"[executable]/admin.sql\"\n"
 " create procedure\n"
 "adm_set_ses_var (in sesid varchar, in name varchar, in value any)\n"
 "{\n"
@@ -193,9 +202,10 @@ static const char *proc8 =
 "nf:\n"
 "return NULL;\n"
 "}\n"
-"--src admin.sql:190\n";
+"--src admin.sql:189\n";
 
 static const char *proc9 = 
+"#line 228 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_dav_u_name (in _u_id integer)\n"
 "{\n"
@@ -209,9 +219,10 @@ static const char *proc9 =
 "nf:\n"
 "return (\'No user\');\n"
 "}\n"
-"--src admin.sql:227\n";
+"--src admin.sql:226\n";
 
 static const char *proc10 = 
+"#line 245 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_dav_g_name (in _g_id integer)\n"
 "{\n"
@@ -225,9 +236,10 @@ static const char *proc10 =
 "nf:\n"
 "return (\'No group\');\n"
 "}\n"
-"--src admin.sql:244\n";
+"--src admin.sql:243\n";
 
 static const char *proc11 = 
+"#line 262 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_unauth_response ()\n"
 "{\n"
@@ -238,9 +250,10 @@ static const char *proc11 =
 "\'</HEAD><BODY><H1>Unauthorized</H1>\',\n"
 "\'Access to page is forbidden.</BODY></HTML>\'));\n"
 "}\n"
-"--src admin.sql:261\n";
+"--src admin.sql:260\n";
 
 static const char *proc12 = 
+"#line 276 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_dav_check_auth (in lines any, in all_dav_acct integer := 0)\n"
 "{\n"
@@ -305,9 +318,10 @@ static const char *proc12 =
 "\'false\', lines, 1);\n"
 "return -1;\n"
 "}\n"
-"--src admin.sql:275\n";
+"--src admin.sql:274\n";
 
 static const char *proc13 = 
+"#line 342 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_tell_unauth_dav (in lines any)\n"
 "{\n"
@@ -323,9 +337,10 @@ static const char *proc13 =
 "\'</HEAD><BODY><H1>Unauthorized</H1>\',\n"
 "\'Access to page is forbidden.</BODY></HTML>\'));\n"
 "}\n"
-"--src admin.sql:341\n";
+"--src admin.sql:340\n";
 
 static const char *proc14 = 
+"#line 359 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_check_auth (in lines any)\n"
 "{\n"
@@ -398,9 +413,10 @@ static const char *proc14 =
 "\'false\', lines, 1);\n"
 "return 0;\n"
 "}\n"
-"--src admin.sql:358\n";
+"--src admin.sql:357\n";
 
 static const char *proc15 = 
+"#line 435 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_unqualify (in name varchar)\n"
 "{\n"
@@ -416,9 +432,10 @@ static const char *proc15 =
 "}\n"
 "return (subseq (name_str, coalesce (strrchr (name_str, \'.\') + 1, 0)));\n"
 "}\n"
-"--src admin.sql:434\n";
+"--src admin.sql:433\n";
 
 static const char *proc16 = 
+"#line 459 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_param_default (inout dest any, in p_name varchar,\n"
 "in p_vec any, in p_def varchar)\n"
@@ -429,9 +446,10 @@ static const char *proc16 =
 "dest := p_def;\n"
 "}\n"
 "}\n"
-"--src admin.sql:458\n";
+"--src admin.sql:457\n";
 
 static const char *proc17 = 
+"#line 478 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_get_param (inout dest varchar, in p_name varchar,\n"
 "in p_vec varchar, in err_sql_state varchar)\n"
@@ -444,9 +462,10 @@ static const char *proc17 =
 "concat (\'Empty or NULL parameter \', p_name));\n"
 "}\n"
 "}\n"
-"--src admin.sql:477\n";
+"--src admin.sql:476\n";
 
 static const char *proc18 = 
+"#line 499 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_date_fmt (in d datetime)\n"
 "{\n"
@@ -461,17 +480,19 @@ static const char *proc18 =
 "\n"
 "return (concat (day_str, \' \', time_str));\n"
 "}\n"
-"--src admin.sql:498\n";
+"--src admin.sql:497\n";
 
 static const char *proc19 = 
+"#line 518 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_make_date (in d_str varchar)\n"
 "{\n"
 "return (stringdate (d_str));\n"
 "}\n"
-"--src admin.sql:517\n";
+"--src admin.sql:516\n";
 
 static const char *proc20 = 
+"#line 537 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_result_tbl_hdrs (in m_dta any)\n"
 "{\n"
@@ -498,9 +519,10 @@ static const char *proc20 =
 "inx := inx + 1;\n"
 "}\n"
 "}\n"
-"--src admin.sql:536\n";
+"--src admin.sql:535\n";
 
 static const char *proc21 = 
+"#line 577 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_result_to_table (in result any, in m_dta any)\n"
 "{\n"
@@ -590,9 +612,10 @@ static const char *proc21 =
 "http (\'</table>\');\n"
 "\n"
 "}\n"
-"--src admin.sql:576\n";
+"--src admin.sql:575\n";
 
 static const char *proc22 = 
+"#line 674 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_evt_action (in params varchar)\n"
 "{\n"
@@ -652,9 +675,10 @@ static const char *proc22 =
 "return 0;\n"
 "}\n"
 "}\n"
-"--src admin.sql:673\n";
+"--src admin.sql:672\n";
 
 static const char *proc23 = 
+"#line 736 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_users_u_group (in grp integer)\n"
 "{\n"
@@ -667,9 +691,10 @@ static const char *proc23 =
 "\n"
 "http (sprintf (\'%s\', u_group_name));\n"
 "}\n"
-"--src admin.sql:735\n";
+"--src admin.sql:734\n";
 
 static const char *proc24 = 
+"#line 762 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_users_action (in params varchar)\n"
 "{\n"
@@ -805,9 +830,10 @@ static const char *proc24 =
 "}\n"
 "}\n"
 "}\n"
-"--src admin.sql:761\n";
+"--src admin.sql:760\n";
 
 static const char *proc25 = 
+"#line 900 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_u_group_options(in grp varchar)\n"
 "{\n"
@@ -820,9 +846,10 @@ static const char *proc25 =
 "http (sprintf (\'<option value=\"%d\" %s>%s</option>\', U_ID, select_if (U_ID, grp), U_NAME));\n"
 "}\n"
 "}\n"
-"--src admin.sql:899\n";
+"--src admin.sql:898\n";
 
 static const char *proc26 = 
+"#line 917 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_users_error_msg (in _res integer)\n"
 "{\n"
@@ -857,9 +884,10 @@ static const char *proc26 =
 "\n"
 "return (\' \');\n"
 "}\n"
-"--src admin.sql:916\n";
+"--src admin.sql:915\n";
 
 static const char *proc27 = 
+"#line 956 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_users_def_qual (in dta varchar)\n"
 "{\n"
@@ -872,9 +900,10 @@ static const char *proc27 =
 "dta := split_and_decode (dta, 0, \'   \');\n"
 "return (get_keyword (\'Q\', dta, \'\'));\n"
 "}\n"
-"--src admin.sql:955\n";
+"--src admin.sql:954\n";
 
 static const char *proc28 = 
+"#line 973 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_is_checked (in cb_name varchar, in params any)\n"
 "{\n"
@@ -887,9 +916,10 @@ static const char *proc28 =
 "return (0);\n"
 "}\n"
 "}\n"
-"--src admin.sql:972\n";
+"--src admin.sql:971\n";
 
 static const char *proc29 = 
+"#line 990 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_dav_users_get_perms (in params any)\n"
 "{\n"
@@ -910,9 +940,10 @@ static const char *proc29 =
 "return \"LEFT\"(result,9);\n"
 "\n"
 "}\n"
-"--src admin.sql:989\n";
+"--src admin.sql:988\n";
 
 static const char *proc30 = 
+"#line 1018 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_dav_format_perms (in p varchar)\n"
 "{\n"
@@ -939,10 +970,11 @@ static const char *proc30 =
 "}\n"
 "return (p_arr);\n"
 "}\n"
-"--src admin.sql:1017\n";
+"--src admin.sql:1016\n";
 
 
 static const char *proc31 = 
+"#line 1060 \"[executable]/admin.sql\"\n"
 " create procedure\n"
 "adm_dav_users_action (in params varchar)\n"
 "{\n"
@@ -1009,9 +1041,10 @@ static const char *proc31 =
 "delete from WS.WS.SYS_DAV_USER where U_ID = _del;\n"
 "}\n"
 "}\n"
-"--src admin.sql:1059\n";
+"--src admin.sql:1058\n";
 
 static const char *proc32 = 
+"#line 1129 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_dav_u_group_options (in grp varchar)\n"
 "{\n"
@@ -1023,9 +1056,10 @@ static const char *proc32 =
 "http (sprintf (\'<option value=\"%d\" %s>%s</option>\', G_ID, select_if (G_ID, grp), G_NAME));\n"
 "}\n"
 "}\n"
-"--src admin.sql:1128\n";
+"--src admin.sql:1127\n";
 
 static const char *proc33 = 
+"#line 1143 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_dav_res_error_msg (in _res integer)\n"
 "{\n"
@@ -1039,9 +1073,10 @@ static const char *proc33 =
 "}\n"
 "return (\' \');\n"
 "}\n"
-"--src admin.sql:1142\n";
+"--src admin.sql:1141\n";
 
 static const char *proc34 = 
+"#line 1158 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_dav_res_types_action (in params varchar)\n"
 "{\n"
@@ -1073,9 +1108,10 @@ static const char *proc34 =
 "delete from WS.WS.SYS_DAV_RES_TYPES where concat(T_TYPE, T_EXT) = _del;\n"
 "}\n"
 "}\n"
-"--src admin.sql:1157\n";
+"--src admin.sql:1156\n";
 
 static const char *proc35 = 
+"#line 1191 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lt_make_dsn_part (in dsn varchar)\n"
 "{\n"
@@ -1091,9 +1127,10 @@ static const char *proc35 =
 "}\n"
 "return dsn;\n"
 "}\n"
-"--src admin.sql:1190\n";
+"--src admin.sql:1189\n";
 
 static const char *proc36 = 
+"#line 1221 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_next_keyword (in keyw varchar, inout params varchar, inout spos integer)\n"
 "{\n"
@@ -1110,9 +1147,10 @@ static const char *proc36 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src admin.sql:1220\n";
+"--src admin.sql:1219\n";
 
 static const char *proc37 = 
+"#line 1242 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_next_checkbox (in keyw varchar, inout params varchar, inout spos integer)\n"
 "{\n"
@@ -1136,9 +1174,10 @@ static const char *proc37 =
 "spos := spos + 2;\n"
 "}\n"
 "}\n"
-"--src admin.sql:1241\n";
+"--src admin.sql:1240\n";
 
 static const char *proc38 = 
+"#line 1270 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lt_init (inout params any, out step any, out dsn varchar, out _user varchar,\n"
 "out pass varchar, out prev_sel varchar, inout two_views varchar, inout keys any,\n"
@@ -1326,9 +1365,10 @@ static const char *proc38 =
 "}\n"
 "}\n"
 "}\n"
-"--src admin.sql:1269\n";
+"--src admin.sql:1268\n";
 
 static const char *proc39 = 
+"#line 1461 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lt_rt_options ()\n"
 "{\n"
@@ -1343,9 +1383,10 @@ static const char *proc39 =
 "http (\'<option>-No External Tables Linked-</option>\');\n"
 "}\n"
 "}\n"
-"--src admin.sql:1460\n";
+"--src admin.sql:1459\n";
 
 static const char *proc40 = 
+"#line 1478 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lt_dsn_options (in dsn varchar)\n"
 "{\n"
@@ -1392,9 +1433,10 @@ static const char *proc40 =
 "}\n"
 "}\n"
 "}\n"
-"--src admin.sql:1477\n";
+"--src admin.sql:1476\n";
 
 static const char *proc41 = 
+"#line 1528 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_do_unlink (in tbl varchar)\n"
 "{\n"
@@ -1428,9 +1470,10 @@ static const char *proc41 =
 "http (\'</TABLE>\');\n"
 "}\n"
 "}\n"
-"--src admin.sql:1527\n";
+"--src admin.sql:1526\n";
 
 static const char *proc42 = 
+"#line 1564 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_unlink_table (inout params any)\n"
 "{\n"
@@ -1450,9 +1493,10 @@ static const char *proc42 =
 "adm_do_unlink (_tbl);\n"
 "}\n"
 "}\n"
-"--src admin.sql:1563\n";
+"--src admin.sql:1562\n";
 
 static const char *proc43 = 
+"#line 1586 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_link_table (in dsn varchar, inout params varchar, in keys any, in _ch_key any, in _type varchar)\n"
 "{\n"
@@ -1542,9 +1586,10 @@ static const char *proc43 =
 "\n"
 "}\n"
 "}\n"
-"--src admin.sql:1585\n";
+"--src admin.sql:1584\n";
 
 static const char *proc44 = 
+"#line 1686 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lt_wiz_link_tables (in tablelist varchar, in dsn varchar, in town varchar, in tqual varchar)\n"
 "{\n"
@@ -1589,9 +1634,10 @@ static const char *proc44 =
 "}\n"
 "}\n"
 "}\n"
-"--src admin.sql:1685\n";
+"--src admin.sql:1684\n";
 
 static const char *proc45 = 
+"#line 1733 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_new_menu_tree ()\n"
 "{\n"
@@ -1729,9 +1775,10 @@ static const char *proc45 =
 ")\n"
 ");\n"
 "}\n"
-"--src admin.sql:1732\n";
+"--src admin.sql:1731\n";
 
 static const char *proc46 = 
+"#line 1872 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lm_update_ses (in sesid varchar, inout tree varchar)\n"
 "{\n"
@@ -1739,9 +1786,10 @@ static const char *proc46 =
 "update ADMIN_SESSION set ASES_TREE = serialize (tree)\n"
 "where ASES_ID = sesid;\n"
 "}\n"
-"--src admin.sql:1871\n";
+"--src admin.sql:1870\n";
 
 static const char *proc47 = 
+"#line 1884 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_left_menu_init (inout params any, inout sesid varchar)\n"
 "{\n"
@@ -1774,9 +1822,10 @@ static const char *proc47 =
 "}\n"
 "return (tree);\n"
 "}\n"
-"--src admin.sql:1883\n";
+"--src admin.sql:1882\n";
 
 static const char *proc48 = 
+"#line 1921 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_make_qual_menus ()\n"
 "{\n"
@@ -1804,9 +1853,10 @@ static const char *proc48 =
 "}\n"
 "return (qual_dta);\n"
 "}\n"
-"--src admin.sql:1920\n";
+"--src admin.sql:1919\n";
 
 static const char *proc49 = 
+"#line 1951 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lm_toggle (inout tree any, in nodenum integer, inout curr_node integer, in vis integer)\n"
 "{\n"
@@ -1825,9 +1875,10 @@ static const char *proc49 =
 "}\n"
 "return tree;\n"
 "}\n"
-"--src admin.sql:1950\n";
+"--src admin.sql:1949\n";
 
 static const char *proc50 = 
+"#line 1974 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lm_toggle_node (in node any, in nodenum integer, inout curr_node integer, in vis integer)\n"
 "{\n"
@@ -1859,9 +1910,10 @@ static const char *proc50 =
 "\n"
 "return node;\n"
 "}\n"
-"--src admin.sql:1973\n";
+"--src admin.sql:1972\n";
 
 static const char *proc51 = 
+"#line 2008 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_table_pad (in d integer)\n"
 "{\n"
@@ -1871,9 +1923,10 @@ static const char *proc51 =
 "d := d - 1;\n"
 "}\n"
 "}\n"
-"--src admin.sql:2007\n";
+"--src admin.sql:2006\n";
 
 static const char *proc52 = 
+"#line 2020 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lm_show_node (inout node any, in  nodenum integer, inout sesid varchar)\n"
 "{\n"
@@ -1930,9 +1983,10 @@ static const char *proc52 =
 "url, parm, target, aref (node, 0)));\n"
 "}\n"
 "}\n"
-"--src admin.sql:2019\n";
+"--src admin.sql:2018\n";
 
 static const char *proc53 = 
+"#line 2081 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lm_show_tree (inout tree any, inout cnt integer, inout sesid varchar)\n"
 "{\n"
@@ -1953,9 +2007,10 @@ static const char *proc53 =
 "\n"
 "http(\'</table>\\n\');\n"
 "}\n"
-"--src admin.sql:2080\n";
+"--src admin.sql:2079\n";
 
 static const char *proc54 = 
+"#line 2105 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lm_show_tree_node (inout node any, inout cnt integer, inout sesid any)\n"
 "{\n"
@@ -1970,9 +2025,10 @@ static const char *proc54 =
 "http(\'</td></tr>\\n\');\n"
 "}\n"
 "}\n"
-"--src admin.sql:2104\n";
+"--src admin.sql:2103\n";
 
 static const char *proc55 = 
+"#line 2123 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "dbg_dump_menu_tree (inout tree any, in depth integer, inout cnt integer)\n"
 "{\n"
@@ -1989,9 +2045,10 @@ static const char *proc55 =
 "inx := inx + 1;\n"
 "}\n"
 "}\n"
-"--src admin.sql:2122\n";
+"--src admin.sql:2121\n";
 
 static const char *proc56 = 
+"#line 2142 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "dbg_dump_node (inout node any, in depth integer, inout cnt integer)\n"
 "{\n"
@@ -2007,9 +2064,10 @@ static const char *proc56 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src admin.sql:2141\n";
+"--src admin.sql:2140\n";
 
 static const char *proc57 = 
+"#line 2161 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_tbls_list (in qual varchar, in TabShCol varchar, in TabShColOwn varchar := \'\')\n"
 "{\n"
@@ -2049,9 +2107,10 @@ static const char *proc57 =
 "http (sprintf (\'<tr><td colspan=\"3\" CLASS=\"gendata\">No tables defined for %s, odd...</td></tr>\', qual));\n"
 "}\n"
 "}\n"
-"--src admin.sql:2160\n";
+"--src admin.sql:2159\n";
 
 static const char *proc58 = 
+"#line 2205 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_tbls_list_drop (in params any, inout _all varchar)\n"
 "{\n"
@@ -2069,9 +2128,10 @@ static const char *proc58 =
 "_all := concat (_all, \', \', tblname);\n"
 "}\n"
 "}\n"
-"--src admin.sql:2204\n";
+"--src admin.sql:2203\n";
 
 static const char *proc59 = 
+"#line 2227 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_tbls_action (in params any)\n"
 "{\n"
@@ -2119,9 +2179,10 @@ static const char *proc59 =
 "}\n"
 "return ret_msg;\n"
 "}\n"
-"--src admin.sql:2226\n";
+"--src admin.sql:2225\n";
 
 static const char *proc60 = 
+"#line 2277 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_trigs_list (in tbl varchar, in q varchar)\n"
 "{\n"
@@ -2144,9 +2205,10 @@ static const char *proc60 =
 "http (sprintf (\'<tr><td CLASS=\"gendata\">%s</td><td CLASS=\"gendesc\">%s</td><td CLASS=\"geninput\"><input type=\"checkbox\" name=\"CB_%s\"></td><td CLASS=\"gendata\"><a class=\"tablelistaction\" href=\"admin_triggers_edit.vsp?trg=%s&q=%s&tbl=%s\">Edit</a></td>\', _t_name, t_txt, _t_name, _t_name, q, tbl));\n"
 "}\n"
 "}\n"
-"--src admin.sql:2276\n";
+"--src admin.sql:2275\n";
 
 static const char *proc61 = 
+"#line 2304 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_trigs_list_drop (in params any, inout _all varchar)\n"
 "{\n"
@@ -2164,9 +2226,10 @@ static const char *proc61 =
 "_all := concat (_all, \', \', tblname);\n"
 "}\n"
 "}\n"
-"--src admin.sql:2303\n";
+"--src admin.sql:2302\n";
 
 static const char *proc62 = 
+"#line 2324 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_trigs_action (in params any, inout _state varchar, inout _msg varchar)\n"
 "{\n"
@@ -2233,9 +2296,10 @@ static const char *proc62 =
 "}\n"
 "}\n"
 "}\n"
-"--src admin.sql:2323\n";
+"--src admin.sql:2322\n";
 
 static const char *proc63 = 
+"#line 2392 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_get_trg_body (in t_text varchar)\n"
 "{\n"
@@ -2267,9 +2331,10 @@ static const char *proc63 =
 "return \"RIGHT\" (t_text, length (t_text) - b_start);\n"
 "}\n"
 "}\n"
-"--src admin.sql:2391\n";
+"--src admin.sql:2390\n";
 
 static const char *proc64 = 
+"#line 2426 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_views_list (in qual varchar)\n"
 "{\n"
@@ -2287,9 +2352,10 @@ static const char *proc64 =
 "http (sprintf (\'<tr><td colspan=\"3\" CLASS=\"gendata\">There are currently no views defined for %s</td></tr>\', qual));\n"
 "}\n"
 "}\n"
-"--src admin.sql:2425\n";
+"--src admin.sql:2424\n";
 
 static const char *proc65 = 
+"#line 2446 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_views_list_drop (in params any, inout _all varchar)\n"
 "{\n"
@@ -2307,9 +2373,10 @@ static const char *proc65 =
 "_all := concat (_all, \', \', vwname);\n"
 "}\n"
 "}\n"
-"--src admin.sql:2445\n";
+"--src admin.sql:2444\n";
 
 static const char *proc66 = 
+"#line 2466 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_views_action (in params any)\n"
 "{\n"
@@ -2412,9 +2479,10 @@ static const char *proc66 =
 "}\n"
 "return err_ret;\n"
 "}\n"
-"--src admin.sql:2465\n";
+"--src admin.sql:2464\n";
 
 static const char *proc67 = 
+"#line 2573 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_exec_stmt (inout _stmt varchar)\n"
 "{\n"
@@ -2428,9 +2496,10 @@ static const char *proc67 =
 "return -1;\n"
 "}\n"
 "}\n"
-"--src admin.sql:2572\n";
+"--src admin.sql:2571\n";
 
 static const char *proc68 = 
+"#line 2591 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_next_word (in str varchar, inout pos integer)\n"
 "{\n"
@@ -2450,9 +2519,10 @@ static const char *proc68 =
 "}\n"
 "return subseq (str, start, pos);\n"
 "}\n"
-"--src admin.sql:2590\n";
+"--src admin.sql:2589\n";
 
 static const char *proc69 = 
+"#line 2615 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_get_view_body (in v_text varchar)\n"
 "{\n"
@@ -2495,9 +2565,10 @@ static const char *proc69 =
 "else\n"
 "return -1;\n"
 "}\n"
-"--src admin.sql:2614\n";
+"--src admin.sql:2613\n";
 
 static const char *proc70 = 
+"#line 2661 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_proc_list (in q varchar)\n"
 "{\n"
@@ -2521,9 +2592,10 @@ static const char *proc70 =
 "http (sprintf (\'<tr><td colspan=\"4\" CLASS=\"gendata\">There are currently no stored procedures for %s</td></tr>\', q));\n"
 "}\n"
 "}\n"
-"--src admin.sql:2660\n";
+"--src admin.sql:2659\n";
 
 static const char *proc71 = 
+"#line 2687 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_proc_list_drop (in params any, inout _all varchar)\n"
 "{\n"
@@ -2541,9 +2613,10 @@ static const char *proc71 =
 "_all := concat (_all, \', \', proc);\n"
 "}\n"
 "}\n"
-"--src admin.sql:2686\n";
+"--src admin.sql:2685\n";
 
 static const char *proc72 = 
+"#line 2707 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_proc_action (in params any, inout _state varchar, inout _msg varchar)\n"
 "{\n"
@@ -2598,9 +2671,10 @@ static const char *proc72 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src admin.sql:2706\n";
+"--src admin.sql:2705\n";
 
 static const char *proc73 = 
+"#line 2764 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_e_string (inout xe any)\n"
 "{\n"
@@ -2609,9 +2683,10 @@ static const char *proc73 =
 "http_value (xe, NULL, st);\n"
 "return (string_output_string (st));\n"
 "}\n"
-"--src admin.sql:2763\n";
+"--src admin.sql:2762\n";
 
 static const char *proc74 = 
+"#line 2775 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_sql_columns(in table_name varchar)\n"
 "{\n"
@@ -2643,9 +2718,10 @@ static const char *proc74 =
 "}\n"
 "http(\'</TABLE>\');\n"
 "}\n"
-"--src admin.sql:2774\n";
+"--src admin.sql:2773\n";
 
 static const char *proc75 = 
+"#line 2809 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_tell_unauth (in lines any)\n"
 "{\n"
@@ -2656,9 +2732,10 @@ static const char *proc75 =
 "http_request_status (\'HTTP/1.1 401 Unauthorized\');\n"
 "http ( sprintf(\'<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\\n<HTML><HEAD><TITLE>401 Unauthorized</TITLE></HEAD>\\n<BODY><H1>Unauthorized</H1>\\n<P>User: %s - Access to page is forbidden.</P></BODY></HTML>\', coalesce(_user, \'unspecified\')));\n"
 "}\n"
-"--src admin.sql:2808\n";
+"--src admin.sql:2807\n";
 
 static const char *proc76 = 
+"#line 2821 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lt_table_r (in dsn varchar, in params varchar, inout len_dsn integer, inout two_views varchar,\n"
 "inout keys any, in step varchar, in user_ varchar, in pass varchar, inout keys_v any,\n"
@@ -2683,9 +2760,10 @@ static const char *proc76 =
 "len_dsn := len_dsn - 1;\n"
 "\n"
 "}\n"
-"--src admin.sql:2820\n";
+"--src admin.sql:2819\n";
 
 static const char *proc77 = 
+"#line 2847 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lt_getRPKeys (in dsn varchar, in tbl_qual varchar, in tbl_user varchar, in tbl_name varchar)\n"
 "{\n"
@@ -2762,9 +2840,10 @@ static const char *proc77 =
 "else\n"
 "return vector(my_pkeys);\n"
 "}\n"
-"--src admin.sql:2846\n";
+"--src admin.sql:2845\n";
 
 static const char *proc78 = 
+"#line 2926 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_save_state (in _params any)\n"
 "{\n"
@@ -2791,9 +2870,10 @@ static const char *proc78 =
 "idx := idx + 2;\n"
 "}\n"
 "}\n"
-"--src admin.sql:2925\n";
+"--src admin.sql:2924\n";
 
 static const char *proc79 = 
+"#line 2955 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_lt_table_draw (in dsn varchar,  in params varchar, inout len_dsn integer, in type varchar,\n"
 "inout keys any, in two_views varchar, in step varchar, in user_ varchar,\n"
@@ -3094,9 +3174,10 @@ static const char *proc79 =
 "idx := idx + 1;\n"
 "}\n"
 "}\n"
-"--src admin.sql:2954\n";
+"--src admin.sql:2953\n";
 
 static const char *proc80 = 
+"#line 3258 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_l_key_options (in left_v any)\n"
 "{\n"
@@ -3109,9 +3190,10 @@ static const char *proc80 =
 "if (0 = idx)\n"
 "http (\'<option>No keys</option>\');\n"
 "}\n"
-"--src admin.sql:3257\n";
+"--src admin.sql:3256\n";
 
 static const char *proc81 = 
+"#line 3272 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_key_init (inout params varchar, in dsn varchar,\n"
 "in tab_col varchar, inout left_v any, inout right_v any,\n"
@@ -3189,9 +3271,10 @@ static const char *proc81 =
 "right_v := \'\';\n"
 "\n"
 "}\n"
-"--src admin.sql:3271\n";
+"--src admin.sql:3270\n";
 
 static const char *proc82 = 
+"#line 3352 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "vector_delete (in in_vector any, in numbers any)\n"
 "{\n"
@@ -3219,9 +3302,10 @@ static const char *proc82 =
 "\n"
 "return(res);\n"
 "}\n"
-"--src admin.sql:3351\n";
+"--src admin.sql:3350\n";
 
 static const char *proc83 = 
+"#line 3381 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "vector_num (in in_vector any, in wanted any)\n"
 "{\n"
@@ -3238,9 +3322,10 @@ static const char *proc83 =
 "idx:=idx+1;\n"
 "}\n"
 "}\n"
-"--src admin.sql:3380\n";
+"--src admin.sql:3379\n";
 
 static const char *proc84 = 
+"#line 3399 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "vector_swap (in in_vector any, in pos integer, in des integer)\n"
 "{\n"
@@ -3271,9 +3356,10 @@ static const char *proc84 =
 "\n"
 "return (res);\n"
 "}\n"
-"--src admin.sql:3398\n";
+"--src admin.sql:3397\n";
 
 static const char *proc85 = 
+"#line 3431 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_link_view (in dsn varchar, in params any, in keys any)\n"
 "{\n"
@@ -3344,9 +3430,10 @@ static const char *proc85 =
 "}\n"
 "}\n"
 "}\n"
-"--src admin.sql:3430\n";
+"--src admin.sql:3429\n";
 
 static const char *proc86 = 
+"#line 3504 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "vector_print (in in_vector any)\n"
 "{\n"
@@ -3372,9 +3459,10 @@ static const char *proc86 =
 "}\n"
 "return (res);\n"
 "}\n"
-"--src admin.sql:3503\n";
+"--src admin.sql:3502\n";
 
 static const char *proc87 = 
+"#line 3531 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_dsn_list (in type varchar)\n"
 "{\n"
@@ -3441,9 +3529,10 @@ static const char *proc87 =
 "\n"
 "return (0);\n"
 "}\n"
-"--src admin.sql:3530\n";
+"--src admin.sql:3529\n";
 
 static const char *proc88 = 
+"#line 3600 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_dsn_update (in params any)\n"
 "{\n"
@@ -3505,9 +3594,10 @@ static const char *proc88 =
 "\n"
 "return (0);\n"
 "}\n"
-"--src admin.sql:3599\n";
+"--src admin.sql:3598\n";
 
 static const char *proc89 = 
+"#line 3664 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_edit_text (in params any)\n"
 "{\n"
@@ -3566,9 +3656,10 @@ static const char *proc89 =
 "\n"
 "return (0);\n"
 "}\n"
-"--src admin.sql:3663\n";
+"--src admin.sql:3662\n";
 
 static const char *proc90 = 
+"#line 3725 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "const_string_generic32 (in params any, in driver_end any)\n"
 "{\n"
@@ -3599,9 +3690,10 @@ static const char *proc90 =
 "\n"
 "return res;\n"
 "}\n"
-"--src admin.sql:3724\n";
+"--src admin.sql:3723\n";
 
 static const char *proc91 = 
+"#line 3758 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_edit_virt (in params any, inout _desc varchar, inout _server varchar, inout _port varchar,\n"
 "inout _user varchar, inout _pass varchar, inout _database varchar,\n"
@@ -3669,9 +3761,10 @@ static const char *proc91 =
 "\n"
 "return (0);\n"
 "}\n"
-"--src admin.sql:3757\n";
+"--src admin.sql:3756\n";
 
 static const char *proc92 = 
+"#line 3828 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "const_string_add_generic32 (in params any)\n"
 "{\n"
@@ -3756,9 +3849,10 @@ static const char *proc92 =
 "\n"
 "return (0);\n"
 "}\n"
-"--src admin.sql:3827\n";
+"--src admin.sql:3826\n";
 
 static const char *proc93 = 
+"#line 3915 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "const_from_params (inout str varchar, in control varchar, in text_to_ini varchar, in params any)\n"
 "{\n"
@@ -3768,9 +3862,10 @@ static const char *proc93 =
 "return (concat (str, text_to_ini, val, \';\'));\n"
 "return (str);\n"
 "}\n"
-"--src admin.sql:3914\n";
+"--src admin.sql:3913\n";
 
 static const char *proc94 = 
+"#line 3927 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "constru_string (in params any, in driver_end any)\n"
 "{\n"
@@ -3830,9 +3925,10 @@ static const char *proc94 =
 "\n"
 "return res;\n"
 "}\n"
-"--src admin.sql:3926\n";
+"--src admin.sql:3925\n";
 
 static const char *proc95 = 
+"#line 3989 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_dsn_exist (in type varchar, in drv_name varchar)\n"
 "{\n"
@@ -3855,9 +3951,10 @@ static const char *proc95 =
 "\n"
 "return (NULL);\n"
 "}\n"
-"--src admin.sql:3988\n";
+"--src admin.sql:3987\n";
 
 static const char *proc96 = 
+"#line 4014 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "convert_exist (in type varchar, in drv_name varchar, inout at_str any, inout at_def any)\n"
 "{\n"
@@ -3889,9 +3986,10 @@ static const char *proc96 =
 "\n"
 "return (1);\n"
 "}\n"
-"--src admin.sql:4013\n";
+"--src admin.sql:4012\n";
 
 static const char *proc97 = 
+"#line 4048 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_button_check (in keyw varchar, inout params varchar)\n"
 "{\n"
@@ -3912,9 +4010,10 @@ static const char *proc97 =
 "spos := spos + 2;\n"
 "}\n"
 "}\n"
-"--src admin.sql:4047\n";
+"--src admin.sql:4046\n";
 
 static const char *proc98 = 
+"#line 4071 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "date822_to_date (in in_date varchar)\n"
 "{\n"
@@ -3957,9 +4056,10 @@ static const char *proc98 =
 "\n"
 "return (cast (concat (mount,\'  \', day, \'  \', year) as date));\n"
 "}\n"
-"--src admin.sql:4070\n";
+"--src admin.sql:4069\n";
 
 static const char *proc99 = 
+"#line 4116 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "mail_to (in _from varchar)\n"
 "{\n"
@@ -3972,9 +4072,10 @@ static const char *proc99 =
 "\n"
 "return (_from);\n"
 "}\n"
-"--src admin.sql:4115\n";
+"--src admin.sql:4114\n";
 
 static const char *proc100 = 
+"#line 4131 \"[executable]/admin.sql\"\n"
 " create procedure\n"
 "adm_send_js_auth_page (in realm varchar, in nonce varchar,\n"
 "in path varchar, in _user varchar)\n"
@@ -4038,9 +4139,10 @@ static const char *proc100 =
 "http (\'</body>\\n\');\n"
 "http (\'</html>\\n\');\n"
 "}\n"
-"--src admin.sql:4130\n";
+"--src admin.sql:4129\n";
 
 static const char *proc101 = 
+"#line 4199 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_pre_page(inout lines any)\n"
 "{\n"
@@ -4077,9 +4179,10 @@ static const char *proc101 =
 "http_client_ip()\n"
 ");\n"
 "}\n"
-"--src admin.sql:4198\n";
+"--src admin.sql:4197\n";
 
 static const char *proc102 = 
+"#line 4237 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_what_css()\n"
 "{\n"
@@ -4089,9 +4192,10 @@ static const char *proc102 =
 "\n"
 "return \'/admin/admin_style.css\';\n"
 "}\n"
-"--src admin.sql:4236\n";
+"--src admin.sql:4235\n";
 
 static const char *proc103 = 
+"#line 4248 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_page_header(in heading varchar, in help_topic varchar)\n"
 "{\n"
@@ -4110,9 +4214,10 @@ static const char *proc103 =
 "}\n"
 "http(\'<TR CLASS=\"CtrlMain\"><TD COLSPAN=\"2\" ALIGN=\"middle\">\');\n"
 "}\n"
-"--src admin.sql:4247\n";
+"--src admin.sql:4246\n";
 
 static const char *proc104 = 
+"#line 4268 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_page_break()\n"
 "{\n"
@@ -4120,9 +4225,10 @@ static const char *proc104 =
 "http(\'<TR><TD CLASS=\"CtrlMain\" COLSPAN=\"2\" ALIGN=\"middle\"><IMG SRC=\"images/1x1.gif\" WIDTH=\"1\" HEIGHT=\"15\" ALT=\"\"></TD></TR>\');\n"
 "http(\'<TR><TD CLASS=\"CtrlMain\" COLSPAN=\"2\" ALIGN=\"middle\">\');\n"
 "}\n"
-"--src admin.sql:4267\n";
+"--src admin.sql:4266\n";
 
 static const char *proc105 = 
+"#line 4277 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_page_footer()\n"
 "{\n"
@@ -4131,12 +4237,13 @@ static const char *proc105 =
 "http(\'<TR><TD CLASS=\"CopyrightBorder\" COLSPAN=\"2\"><IMG SRC=\"/admin/images/1x1.gif\" WIDTH=\"1\" HEIGHT=\"2\" ALT=\"\"></TD></TR>\');\n"
 "http(\'<TR><TD ALIGN=\"right\" COLSPAN=\"2\"><P CLASS=\"Copyright\">Virtuoso Universal Server \');\n"
 "http(sys_stat(\'st_dbms_ver\'));\n"
-"http(\' - Copyright© 1998-2010 OpenLink Software.</P></TD></TR>\');\n"
+"http(\' - Copyright© 1998-2011 OpenLink Software.</P></TD></TR>\');\n"
 "http(\'</TABLE>\\n</BODY>\');\n"
 "}\n"
-"--src admin.sql:4276\n";
+"--src admin.sql:4275\n";
 
 static const char *proc106 = 
+"#line 4291 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_news_status(in STAT integer)\n"
 "{\n"
@@ -4147,9 +4254,10 @@ static const char *proc106 =
 "else if (STAT = 9) return \'<DIV CLASS=\"status_wip\">Updating...</DIV>\';\n"
 "else return \'<DIV CLASS=\"status_err\">Unsuccessful</DIV>\';\n"
 "}\n"
-"--src admin.sql:4290\n";
+"--src admin.sql:4289\n";
 
 static const char *proc107 = 
+"#line 4303 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_mailaddr_pretty(in email_addr varchar)\n"
 "{\n"
@@ -4166,9 +4274,10 @@ static const char *proc107 =
 "_name := coalesce(_name, _email);\n"
 "return sprintf(\'\\n<A HREF=\"mailto:%s\">%s</A>\\n\', _email, _name);\n"
 "}\n"
-"--src admin.sql:4302\n";
+"--src admin.sql:4301\n";
 
 static const char *proc108 = 
+"#line 4321 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_add_dsn_option (in _val varchar, in _sel varchar)\n"
 "{\n"
@@ -4182,9 +4291,10 @@ static const char *proc108 =
 "\n"
 "return;\n"
 "}\n"
-"--src admin.sql:4320\n";
+"--src admin.sql:4319\n";
 
 static const char *proc109 = 
+"#line 4337 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_get_file_dsn ()\n"
 "{\n"
@@ -4194,6 +4304,9 @@ static const char *proc109 =
 "declare _err_code, _err_message varchar;\n"
 "declare exit handler for sqlstate \'*\' { _err_code := __SQL_STATE; _err_message := __SQL_MESSAGE; goto error; };\n"
 "\n"
+"if (not sys_dir_is_allowed (\'.\'))\n"
+"goto error;\n"
+"\n"
 "_all := sys_dirlist (\'.\', 1);\n"
 "s_root := server_root ();\n"
 "\n"
@@ -4216,9 +4329,10 @@ static const char *proc109 =
 "error:\n"
 "return vector ();\n"
 "}\n"
-"--src admin.sql:4336\n";
+"--src admin.sql:4335\n";
 
 static const char *proc110 = 
+"#line 4375 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "getxmltype(in _id integer)\n"
 "{\n"
@@ -4235,9 +4349,10 @@ static const char *proc110 =
 "-1);\n"
 "return _type;\n"
 "}\n"
-"--src admin.sql:4371\n";
+"--src admin.sql:4373\n";
 
 static const char *proc111 = 
+"#line 4395 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "check_dav_perms(in _perms varchar)\n"
 "{\n"
@@ -4251,9 +4366,10 @@ static const char *proc111 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src admin.sql:4391\n";
+"--src admin.sql:4393\n";
 
 static const char *proc112 = 
+"#line 4412 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "create_dav_col (in _col varchar, in _own integer, in _grp integer, in _perms varchar)\n"
 "{\n"
@@ -4307,9 +4423,10 @@ static const char *proc112 =
 "if (_flg = 0) return 7;\n"
 "return 0;\n"
 "}\n"
-"--src admin.sql:4408\n";
+"--src admin.sql:4410\n";
 
 static const char *proc113 = 
+"#line 4469 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "create_dav_file (inout _file any, in _name varchar, in _own integer, in _grp integer,\n"
 "in _perms varchar, in _col integer, in _rpl integer, in mime_type varchar)\n"
@@ -4348,9 +4465,10 @@ static const char *proc113 =
 "values(_col, _file, now(), _full_name, _grp, WS.WS.GETID(\'R\'),\n"
 "now(), _name, _own, _perms, _res_type);\n"
 "}\n"
-"--src admin.sql:4465\n";
+"--src admin.sql:4467\n";
 
 static const char *proc114 = 
+"#line 4512 \"[executable]/admin.sql\"\n"
 "create procedure get_dav_path(in _col_id integer)\n"
 "{\n"
 "declare _pid, _min_id integer;\n"
@@ -4368,9 +4486,10 @@ static const char *proc114 =
 "endproc:\n"
 "return _path;\n"
 "}\n"
-"--src admin.sql:4508\n";
+"--src admin.sql:4510\n";
 
 static const char *proc115 = 
+"#line 4533 \"[executable]/admin.sql\"\n"
 "create procedure adm_get_init_name()\n"
 "{\n"
 "declare _all varchar;\n"
@@ -4391,9 +4510,10 @@ static const char *proc115 =
 "else\n"
 "return _all;\n"
 "}\n"
-"--src admin.sql:4529\n";
+"--src admin.sql:4531\n";
 
 static const char *proc116 = 
+"#line 4555 \"[executable]/admin.sql\"\n"
 "create procedure\n"
 "adm_make_option_list (in opts any, in name varchar, in val varchar, in spare integer)\n"
 "{\n"
@@ -4417,9 +4537,10 @@ static const char *proc116 =
 "}\n"
 "http (\'</select>\');\n"
 "}\n"
-"--src admin.sql:4551\n";
+"--src admin.sql:4553\n";
 
 static const char *proc117 = 
+"#line 4582 \"[executable]/admin.sql\"\n"
 "create procedure adm_is_hosted ()\n"
 "{\n"
 "declare ret integer;\n"
@@ -4431,9 +4552,10 @@ static const char *proc117 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src admin.sql:4578\n";
+"--src admin.sql:4580\n";
 
 static const char *proc118 = 
+"#line 4596 \"[executable]/admin.sql\"\n"
 "create procedure adm_hosted_file_filter ()\n"
 "{\n"
 "declare ret varchar;\n"
@@ -4448,9 +4570,10 @@ static const char *proc118 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src admin.sql:4592\n";
+"--src admin.sql:4594\n";
 
 static const char *proc119 = 
+"#line 4612 \"[executable]/admin.sql\"\n"
 "create procedure root_node_hosted_import (in path varchar)\n"
 "{\n"
 "declare idx_files, idx_types integer;\n"
@@ -4484,9 +4607,10 @@ static const char *proc119 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src admin.sql:4608\n";
+"--src admin.sql:4610\n";
 
 static const char *proc120 = 
+"#line 4647 \"[executable]/admin.sql\"\n"
 "create procedure get_result (in _in varchar)\n"
 "{\n"
 "\n"
@@ -4526,9 +4650,10 @@ static const char *proc120 =
 "idx := idx + 1;\n"
 "}\n"
 "}\n"
-"--src admin.sql:4643\n";
+"--src admin.sql:4645\n";
 
 static const char *proc121 = 
+"#line 4688 \"[executable]/admin.sql\"\n"
 "create procedure import_get_types_result (in file_name varchar)\n"
 "{\n"
 "declare _class varchar;\n"
@@ -4553,18 +4678,20 @@ static const char *proc121 =
 "idx := idx + 1;\n"
 "}\n"
 "}\n"
-"--src admin.sql:4684\n";
+"--src admin.sql:4686\n";
 
 static const char *proc122 = 
+"#line 4715 \"[executable]/admin.sql\"\n"
 "create procedure import_get_types (in sel_name varchar)\n"
 "{\n"
 "if (__proc_exists (\'DB.DBA.import_get_types_int\', 1) is NULL)\n"
 "return vector ();\n"
 "return DB.DBA.import_get_types_int (sel_name);\n"
 "}\n"
-"--src admin.sql:4711\n";
+"--src admin.sql:4713\n";
 
 static const char *proc123 = 
+"#line 4724 \"[executable]/admin.sql\"\n"
 "create procedure import_file (in mtd_name varchar, in assem_name varchar,\n"
 "in grants integer := 0, in restriction integer := 0, in output_sql integer := 0)\n"
 "{\n"
@@ -4641,9 +4768,10 @@ static const char *proc123 =
 "\n"
 "return \'Loaded\';\n"
 "}\n"
-"--src admin.sql:4720\n";
+"--src admin.sql:4722\n";
 
 static const char *proc124 = 
+"#line 4803 \"[executable]/admin.sql\"\n"
 "create procedure adm_import_get_selection_checkbox\n"
 "(in _what varchar, in _mask varchar, in _all any, inout _beg integer)\n"
 "{\n"
@@ -4664,9 +4792,10 @@ static const char *proc124 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src admin.sql:4799\n";
+"--src admin.sql:4801\n";
 
 static const char *proc125 = 
+"#line 4826 \"[executable]/admin.sql\"\n"
 "create procedure adm_import_get_values\n"
 "(in _all integer, inout grants integer,\n"
 "inout proxy integer, inout restricted integer)\n"
@@ -4678,7 +4807,7 @@ static const char *proc125 =
 "proxy := mod (_all, 2);\n"
 "_all := _all / 2;\n"
 "}\n"
-"--src admin.sql:4822\n";
+"--src admin.sql:4824\n";
 
 static const char *view0 = 
 "create procedure view DEFINED_TYPES as get_result (_in) (_type varchar, _class varchar)\n";
@@ -4687,6 +4816,7 @@ static const char *view1 =
 "create procedure view CLASS_LIST as import_get_types_result (_in) (_class varchar)\n";
 
 static const char *proc126 = 
+"#line 4847 \"[executable]/admin.sql\"\n"
 "create procedure adm_input_vec (in _name varchar, in _vec any)\n"
 "{\n"
 "declare _n integer;\n"
@@ -4700,9 +4830,10 @@ static const char *proc126 =
 "}\n"
 "http (\'</select>\');\n"
 "}\n"
-"--src admin.sql:4843\n";
+"--src admin.sql:4845\n";
 
 static const char *proc127 = 
+"#line 4862 \"[executable]/admin.sql\"\n"
 "create procedure adm_input_num (in _name varchar, in _from integer, in _to integer)\n"
 "{\n"
 "http (concat (\'<select name=\"\', _name, \'\">\'));\n"
@@ -4716,9 +4847,10 @@ static const char *proc127 =
 "}\n"
 "http (\'</select>\');\n"
 "}\n"
-"--src admin.sql:4858\n";
+"--src admin.sql:4860\n";
 
 static const char *proc128 = 
+"#line 4877 \"[executable]/admin.sql\"\n"
 "create procedure adm_input_time (in _prefix varchar)\n"
 "{\n"
 "http (\'<table border=\"0\"><tr><td>\');\n"
@@ -4727,9 +4859,10 @@ static const char *proc128 =
 "adm_input_num (concat (_prefix, \'_min\'), 0, 59);\n"
 "http (\'</td></table>\');\n"
 "}\n"
-"--src admin.sql:4873\n";
+"--src admin.sql:4875\n";
 
 static const char *proc129 = 
+"#line 4887 \"[executable]/admin.sql\"\n"
 "create procedure adm_config_purger_form (in _srv varchar, in _acct varchar)\n"
 "{\n"
 "declare _months any;\n"
@@ -4836,9 +4969,10 @@ static const char *proc129 =
 "\n"
 "http (\'</table>\');\n"
 "}\n"
-"--src admin.sql:4883\n";
+"--src admin.sql:4885\n";
 
 static const char *proc130 = 
+"#line 4995 \"[executable]/admin.sql\"\n"
 "create procedure adm_config_purger_actions (in _srv varchar, in _acct varchar,\n"
 "inout _params any)\n"
 "{\n"
@@ -4922,9 +5056,10 @@ static const char *proc130 =
 "repl_sched_purger (_srv, _acct);\n"
 "}\n"
 "}\n"
-"--src admin.sql:4991\n";
+"--src admin.sql:4993\n";
 
 static const char *proc131 = 
+"#line 5080 \"[executable]/admin.sql\"\n"
 "create procedure adm_lt_status_display (in _lts_type varchar, in params varchar, in _dsn varchar)\n"
 "{\n"
 "declare idx, pos integer;\n"
@@ -4961,9 +5096,10 @@ static const char *proc131 =
 "http (\'</TR>\');\n"
 "}\n"
 "}\n"
-"--src admin.sql:5076\n";
+"--src admin.sql:5078\n";
 
 static const char *proc132 = 
+"#line 5118 \"[executable]/admin.sql\"\n"
 "create procedure adm_opt_array_to_rs (in opt_array any)\n"
 "{\n"
 "declare inx integer;\n"
@@ -4983,13 +5119,14 @@ static const char *proc132 =
 "inx := inx + 2;\n"
 "}\n"
 "}\n"
-"--src admin.sql:5114\n";
+"--src admin.sql:5116\n";
 
 static const char *view2 = 
 "create procedure view ADM_OPT_ARRAY_TO_RS_PVIEW as\n"
 "adm_opt_array_to_rs (OPT_ARRAY) (OPT_NAME varchar, OPT_VALUE varchar)\n";
 
 static const char *proc133 = 
+"#line 5144 \"[executable]/admin.sql\"\n"
 "create procedure ADM_KEYWORD_VALUE_SET (inout _opt_array any, in _key varchar, in _new_val any)\n"
 "{\n"
 "declare inx integer;\n"
@@ -5010,9 +5147,10 @@ static const char *proc133 =
 "_opt_array := vector_concat (_opt_array, vector (_key, _new_val));\n"
 "return 0;\n"
 "}\n"
-"--src admin.sql:5140\n";
+"--src admin.sql:5142\n";
 
 static const char *proc134 = 
+"#line 5166 \"[executable]/admin.sql\"\n"
 "create procedure ADM_INDENT_XML (in _xml any) returns varchar\n"
 "{\n"
 "declare _ses, _res any;\n"
@@ -5084,9 +5222,10 @@ static const char *proc134 =
 "}\n"
 "return string_output_string(_res);\n"
 "}\n"
-"--src admin.sql:5162\n";
+"--src admin.sql:5164\n";
 
 static const char *proc135 = 
+"#line 5239 \"[executable]/admin.sql\"\n"
 "create procedure adm_xml_get_flag (in cont any)\n"
 "{\n"
 "declare lexems any;\n"
@@ -5117,9 +5256,10 @@ static const char *proc135 =
 "return flag;\n"
 "\n"
 "}\n"
-"--src admin.sql:5235\n";
+"--src admin.sql:5237\n";
 
 static const char *proc136 = 
+"#line 5272 \"[executable]/admin.sql\"\n"
 "create procedure adm_xml_make_xmlelement (in _stmt any, in r_node varchar)\n"
 "{\n"
 "declare err_sqlstate, err_msg, m_dta, sqlx_result, _rows, row_data, ses, st any;\n"
@@ -5173,9 +5313,10 @@ static const char *proc136 =
 "\n"
 "return vector (0, string_output_string(st));\n"
 "}\n"
-"--src admin.sql:5268\n";
+"--src admin.sql:5270\n";
 
 static const char *proc137 = 
+"#line 5328 \"[executable]/admin.sql\"\n"
 "create procedure adm_map_xml_build (in _stmt any, in r_node varchar, in _mxml varchar)\n"
 "{\n"
 "declare err_sqlstate, err_msg, m_dta, sqlx_result, _rows, row_data, ses, st any;\n"
@@ -5239,19 +5380,21 @@ static const char *proc137 =
 "\n"
 "return vector (0, string_output_string(st));\n"
 "}\n"
-"--src admin.sql:5324\n";
+"--src admin.sql:5326\n";
 
 /* admin_dav_browser.sql */
 
 static const char *proc138 = 
+"#line 25 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_dav_br_get_uid (in lines any)\n"
 "{\n"
 "return 0;\n"
 "}\n"
-"--src admin_dav_browser.sql:24\n";
+"--src admin_dav_browser.sql:23\n";
 
 static const char *proc139 = 
+"#line 34 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_dav_user_can_read_col_p (in uid integer, in col_id integer)\n"
 "{\n"
@@ -5259,9 +5402,10 @@ static const char *proc139 =
 "\n"
 "return col_id;\n"
 "}\n"
-"--src admin_dav_browser.sql:33\n";
+"--src admin_dav_browser.sql:32\n";
 
 static const char *proc140 = 
+"#line 45 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_dav_user_can_read_res_p (in uid integer, in res_id integer)\n"
 "{\n"
@@ -5269,9 +5413,10 @@ static const char *proc140 =
 "\n"
 "return res_id;\n"
 "}\n"
-"--src admin_dav_browser.sql:44\n";
+"--src admin_dav_browser.sql:43\n";
 
 static const char *proc141 = 
+"#line 54 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_dav_br_uid_to_user (in uid integer)\n"
 "{\n"
@@ -5299,9 +5444,10 @@ static const char *proc141 =
 "\n"
 "return _u_name;\n"
 "}\n"
-"--src admin_dav_browser.sql:53\n";
+"--src admin_dav_browser.sql:52\n";
 
 static const char *proc142 = 
+"#line 83 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_dav_br_uid_to_group (in uid integer)\n"
 "{\n"
@@ -5329,9 +5475,10 @@ static const char *proc142 =
 "\n"
 "return _u_name;\n"
 "}\n"
-"--src admin_dav_browser.sql:82\n";
+"--src admin_dav_browser.sql:81\n";
 
 static const char *proc143 = 
+"#line 112 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_dav_br_fmt_perm (in obj_perm varchar)\n"
 "{\n"
@@ -5339,9 +5486,10 @@ static const char *proc143 =
 "\n"
 "return (obj_perm);\n"
 "}\n"
-"--src admin_dav_browser.sql:111\n";
+"--src admin_dav_browser.sql:110\n";
 
 static const char *proc144 = 
+"#line 121 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_dav_br_list_error (in message varchar,\n"
 "in cur_col integer,\n"
@@ -5351,9 +5499,10 @@ static const char *proc144 =
 "http (\'\');\n"
 "http (\'Error: te\');\n"
 "}\n"
-"--src admin_dav_browser.sql:120\n";
+"--src admin_dav_browser.sql:119\n";
 
 static const char *proc145 = 
+"#line 134 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_dav_br_map_icon (in type varchar)\n"
 "{\n"
@@ -5378,9 +5527,10 @@ static const char *proc145 =
 "\n"
 "return (\'images/16x16/generic_file.gif\');\n"
 "}\n"
-"--src admin_dav_browser.sql:133\n";
+"--src admin_dav_browser.sql:132\n";
 
 static const char *proc146 = 
+"#line 164 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_dav_br_fmt_col (in obj_name varchar,\n"
 "in col_id any,\n"
@@ -5471,9 +5621,10 @@ static const char *proc146 =
 "\'</td>\\n\');\n"
 "}\n"
 "}\n"
-"--src admin_dav_browser.sql:163\n";
+"--src admin_dav_browser.sql:162\n";
 
 static const char *proc147 = 
+"#line 260 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_dav_br_fmt_res (in res_type varchar,\n"
 "in res_name varchar,\n"
@@ -5551,9 +5702,10 @@ static const char *proc147 =
 "\'</td>\\n\');\n"
 "}\n"
 "}\n"
-"--src admin_dav_browser.sql:259\n";
+"--src admin_dav_browser.sql:258\n";
 
 static const char *proc148 = 
+"#line 339 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_path_normalize (in path varchar)\n"
 "{\n"
@@ -5580,9 +5732,10 @@ static const char *proc148 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src admin_dav_browser.sql:338\n";
+"--src admin_dav_browser.sql:337\n";
 
 static const char *proc149 = 
+"#line 367 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_file_like (in name varchar, in pat varchar)\n"
 "{\n"
@@ -5599,9 +5752,10 @@ static const char *proc149 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src admin_dav_browser.sql:366\n";
+"--src admin_dav_browser.sql:365\n";
 
 static const char *proc150 = 
+"#line 385 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_os_br_gen_col_c_listing (in cur_path varchar,\n"
 "in uid integer,\n"
@@ -5691,9 +5845,10 @@ static const char *proc150 =
 "http (\'</table>\\n\');\n"
 "\n"
 "}\n"
-"--src admin_dav_browser.sql:384\n";
+"--src admin_dav_browser.sql:383\n";
 
 static const char *proc151 = 
+"#line 476 \"[executable]/admin_dav_browser.sql\"\n"
 "create procedure\n"
 "adm_dav_br_gen_col_c_listing (in cur_col integer,\n"
 "in new_col integer,\n"
@@ -5775,7 +5930,7 @@ static const char *proc151 =
 "http (\'</table>\\n\');\n"
 "\n"
 "}\n"
-"--src admin_dav_browser.sql:475\n";
+"--src admin_dav_browser.sql:474\n";
 
 static int
 sch_proc_def_exists (client_connection_t *cli, const char *proc_name)
diff --git a/libsrc/Wi/sql_code_auto.c b/libsrc/Wi/sql_code_auto.c
index 56486f6..c912805 100644
--- a/libsrc/Wi/sql_code_auto.c
+++ b/libsrc/Wi/sql_code_auto.c
@@ -7,6 +7,7 @@
 /* autoexec.sql */
 
 static const char *proc0 = 
+"#line 23 \"[executable]/autoexec.sql\"\n"
 "create procedure DB.DBA.ddl_load_script (in _filename varchar)\n"
 "{\n"
 "declare cnt, parts, errors any;\n"
@@ -28,9 +29,10 @@ static const char *proc0 =
 "}\n"
 "}\n"
 "}\n"
-"--src autoexec.sql:22\n";
+"--src autoexec.sql:21\n";
 
 static const char *proc1 = 
+"#line 46 \"[executable]/autoexec.sql\"\n"
 "create procedure DB.DBA.ddl_load_script_safe (in _filename varchar)\n"
 "{\n"
 "declare _status, _message varchar;\n"
@@ -45,9 +47,10 @@ static const char *proc1 =
 "dbg_printf (\'Status returned: %s %s\', _status, _message);\n"
 "}\n"
 "}\n"
-"--src autoexec.sql:45\n";
+"--src autoexec.sql:44\n";
 
 static const char *proc2 = 
+"#line 62 \"[executable]/autoexec.sql\"\n"
 "create procedure ddl_autoexec (in _filename varchar)\n"
 "{\n"
 "if (_filename = \'\')\n"
@@ -55,16 +58,17 @@ static const char *proc2 =
 "\n"
 "DB.DBA.ddl_load_script_safe (_filename);\n"
 "}\n"
-"--src autoexec.sql:61\n";
+"--src autoexec.sql:60\n";
 
 static const char *proc3 = 
+"#line 71 \"[executable]/autoexec.sql\"\n"
 "create procedure ddl_dav_replicate_rdf_quad ()\n"
 "{\n"
 "if (1 <> sys_stat (\'cl_run_local_only\'))\n"
 "return;\n"
 "DB.DBA.DAV_AUTO_REPLICATE_TO_RDF_QUAD ();\n"
 "}\n"
-"--src autoexec.sql:70\n";
+"--src autoexec.sql:69\n";
 
 
 static const char *other0 = 
diff --git a/libsrc/Wi/sql_code_dav.c b/libsrc/Wi/sql_code_dav.c
index 1a7ca70..be43f44 100644
--- a/libsrc/Wi/sql_code_dav.c
+++ b/libsrc/Wi/sql_code_dav.c
@@ -7,6 +7,7 @@
 /* dav.sql */
 
 static const char *proc0 = 
+"#line 26 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.\"OPTIONS\" (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "declare headers, ctype any;\n"
@@ -20,9 +21,10 @@ static const char *proc0 =
 "\'DAV: 1,2,<http://www.openlinksw.com/virtuoso/webdav/1.0>\\r\\n\',\n"
 "\'MS-Author-Via: DAV\\r\\n\'));\n"
 "}\n"
-"--src dav.sql:25\n";
+"--src dav.sql:24\n";
 
 static const char *proc1 = 
+"#line 41 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.PROPFIND (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "declare _mod_time datetime;\n"
@@ -129,9 +131,10 @@ static const char *proc1 =
 "}\n"
 "http (\'</D:multistatus>\\n\');\n"
 "}\n"
-"--src dav.sql:40\n";
+"--src dav.sql:39\n";
 
 static const char *proc2 = 
+"#line 152 \"[executable]/dav.sql\"\n"
 "create function WS.WS.PROPFIND_RESPONSE (in lpath varchar,\n"
 "in ppath varchar,\n"
 "in depth integer,\n"
@@ -240,9 +243,10 @@ static const char *proc2 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src dav.sql:151\n";
+"--src dav.sql:150\n";
 
 static const char *proc3 = 
+"#line 263 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.PROPFIND_RESPONSE_FORMAT (in lpath varchar,\n"
 "in dirlist any,\n"
 "in append_name_to_href integer,\n"
@@ -546,9 +550,10 @@ static const char *proc3 =
 "goto next_response;\n"
 "\n"
 "}\n"
-"--src dav.sql:262\n";
+"--src dav.sql:261\n";
 
 static const char *proc4 = 
+"#line 568 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.PROPNAMES (in _body varchar)\n"
 "{\n"
 "declare prop, propname, allprop, tree, tmp, ret any;\n"
@@ -596,9 +601,10 @@ static const char *proc4 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src dav.sql:567\n";
+"--src dav.sql:566\n";
 
 static const char *proc5 = 
+"#line 617 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.CUSTOM_PROP (in lpath any, in prop any, in depth integer, in st char (1))\n"
 "{\n"
 "declare _name, _lmask, _prop, _ltype, _lscope, _lown, _ltoken, _tp, _pname varchar;\n"
@@ -670,9 +676,10 @@ static const char *proc5 =
 "http (\'</D:response>\\n\');\n"
 "http (\'</D:multistatus>\\n\');\n"
 "}\n"
-"--src dav.sql:616\n";
+"--src dav.sql:615\n";
 
 static const char *proc6 = 
+"#line 690 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.PROPPATCH (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "declare _u_id, _g_id, _slen, _len, _ix, id, _pid, _ix1 integer;\n"
@@ -847,9 +854,10 @@ static const char *proc6 =
 "http_header (\'Content-Type: text/xml\\r\\n\');\n"
 "http (string_output_string (rc));\n"
 "}\n"
-"--src dav.sql:689\n";
+"--src dav.sql:688\n";
 
 static const char *proc7 = 
+"#line 866 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.FINDPARAM (inout params varchar, in pkey varchar)\n"
 "{\n"
 "declare ret any;\n"
@@ -867,9 +875,10 @@ static const char *proc7 =
 "}\n"
 "return \'\';\n"
 "}\n"
-"--src dav.sql:865\n";
+"--src dav.sql:864\n";
 
 static const char *proc8 = 
+"#line 885 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.MKCOL (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "declare _parent_name varchar;\n"
@@ -929,9 +938,10 @@ static const char *proc8 =
 "}\n"
 "http_request_status (\'HTTP/1.1 405 Method Not Allowed\');\n"
 "}\n"
-"--src dav.sql:884\n";
+"--src dav.sql:883\n";
 
 static const char *proc9 = 
+"#line 947 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.FINDCOL (in path any, out col integer)\n"
 "{\n"
 "declare inx integer;\n"
@@ -953,9 +963,10 @@ static const char *proc9 =
 "not_found:\n"
 "return inx;\n"
 "}\n"
-"--src dav.sql:946\n";
+"--src dav.sql:945\n";
 
 static const char *proc10 = 
+"#line 971 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.FINDRES (in path varchar,out _col integer, out _name varchar)\n"
 "{\n"
 "declare depth integer;\n"
@@ -991,9 +1002,10 @@ static const char *proc10 =
 "not_found:\n"
 "return rc;\n"
 "}\n"
-"--src dav.sql:970\n";
+"--src dav.sql:969\n";
 
 static const char *proc11 = 
+"#line 1009 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.DELCHILDREN (in id integer, in lines varchar)\n"
 "{\n"
 "declare col, res, r_id, n_locks, rc integer;\n"
@@ -1073,9 +1085,10 @@ static const char *proc11 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src dav.sql:1008\n";
+"--src dav.sql:1007\n";
 
 static const char *proc12 = 
+"#line 1091 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.\"DELETE\" (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "declare depth,len integer;\n"
@@ -1138,9 +1151,10 @@ static const char *proc12 =
 "http_request_status (\'HTTP/1.1 500 Internal Server Error\');\n"
 "return;\n"
 "}\n"
-"--src dav.sql:1090\n";
+"--src dav.sql:1089\n";
 
 static const char *proc13 = 
+"#line 1157 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.ISCOL (in path varchar)\n"
 "{\n"
 "declare depth, len, col integer;\n"
@@ -1151,9 +1165,10 @@ static const char *proc13 =
 "else\n"
 "return 0;\n"
 "}\n"
-"--src dav.sql:1156\n";
+"--src dav.sql:1155\n";
 
 static const char *proc14 = 
+"#line 1171 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.ISRES (in path varchar)\n"
 "{\n"
 "declare col, rc integer;\n"
@@ -1163,9 +1178,10 @@ static const char *proc14 =
 "rc := 0;\n"
 "return (rc);\n"
 "}\n"
-"--src dav.sql:1170\n";
+"--src dav.sql:1169\n";
 
 static const char *proc15 = 
+"#line 1183 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.ETAG (in name varchar, in col integer)\n"
 "{\n"
 "declare etag, full_path varchar;\n"
@@ -1181,18 +1197,20 @@ static const char *proc15 =
 "etag := md5 (etag);\n"
 "return etag;\n"
 "}\n"
-"--src dav.sql:1182\n";
+"--src dav.sql:1181\n";
 
 static const char *proc16 = 
+"#line 1201 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.HEAD (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "\n"
 "WS.WS.GET (path, params, lines);\n"
 "return;\n"
 "}\n"
-"--src dav.sql:1200\n";
+"--src dav.sql:1199\n";
 
 static const char *proc17 = 
+"#line 1210 \"[executable]/dav.sql\"\n"
 "create procedure DAV_SET_HTTP_REQUEST_STATUS (in rc integer)\n"
 "{\n"
 "if (rc = -1)	{ http_request_status (\'HTTP/1.1 409 Invalid path\');	return; }\n"
@@ -1210,9 +1228,10 @@ static const char *proc17 =
 "http_request_status (\'HTTP/1.1 405 Method Not Allowed\');\n"
 "return;\n"
 "}\n"
-"--src dav.sql:1209\n";
+"--src dav.sql:1208\n";
 
 static const char *proc18 = 
+"#line 1232 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.PUT (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "declare _col_parent_id integer;\n"
@@ -1315,9 +1334,10 @@ static const char *proc18 =
 "http_body_read ();\n"
 "DAV_SET_HTTP_REQUEST_STATUS (rc);\n"
 "}\n"
-"--src dav.sql:1231\n";
+"--src dav.sql:1230\n";
 
 static const char *proc19 = 
+"#line 1336 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.HEX_TO_DEC (in c char)\n"
 "{\n"
 "if (c >= \'0\' and c <= \'9\')\n"
@@ -1328,9 +1348,10 @@ static const char *proc19 =
 "return (10 + ascii(c) - ascii(\'A\'));\n"
 "return 0;\n"
 "}\n"
-"--src dav.sql:1335\n";
+"--src dav.sql:1334\n";
 
 static const char *proc20 = 
+"#line 1348 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.STR_TO_URI (in str varchar)\n"
 "{\n"
 "declare tmp varchar;\n"
@@ -1362,9 +1383,10 @@ static const char *proc20 =
 "}\n"
 "return trim(tmp);\n"
 "}\n"
-"--src dav.sql:1347\n";
+"--src dav.sql:1346\n";
 
 static const char *proc21 = 
+"#line 1381 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.PATHREF (in path varchar, in elem integer, in host varchar, out name_len integer)\n"
 "{\n"
 "declare inx, len, pos, inx1 integer;\n"
@@ -1434,9 +1456,10 @@ static const char *proc21 =
 "}\n"
 "return name;\n"
 "}\n"
-"--src dav.sql:1380\n";
+"--src dav.sql:1379\n";
 
 static const char *proc22 = 
+"#line 1452 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.IS_ACTIVE_CONTENT (in f varchar)\n"
 "{\n"
 "declare dot integer;\n"
@@ -1452,9 +1475,10 @@ static const char *proc22 =
 "return 1;\n"
 "return 0;\n"
 "}\n"
-"--src dav.sql:1451\n";
+"--src dav.sql:1450\n";
 
 static const char *proc23 = 
+"#line 1469 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.GET_DAV_DEFAULT_PAGE (inout path any)\n"
 "{\n"
 "declare _list, path1 any;\n"
@@ -1501,9 +1525,10 @@ static const char *proc23 =
 "\n"
 "return \'\';\n"
 "}\n"
-"--src dav.sql:1468\n";
+"--src dav.sql:1467\n";
 
 static const char *proc24 = 
+"#line 1518 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.GET_DAV_CHUNKED_QUOTA () returns integer\n"
 "{\n"
 "declare dav_chunked_quota integer;\n"
@@ -1516,9 +1541,10 @@ static const char *proc24 =
 "dav_chunked_quota := 1000000;\n"
 "return dav_chunked_quota;\n"
 "}\n"
-"--src dav.sql:1517\n";
+"--src dav.sql:1516\n";
 
 static const char *proc25 = 
+"#line 1534 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.GET (in path any, inout params any, in lines any)\n"
 "{\n"
 "declare col_depth, path_len integer;\n"
@@ -2139,9 +2165,10 @@ static const char *proc25 =
 "err_end:\n"
 "return;\n"
 "}\n"
-"--src dav.sql:1533\n";
+"--src dav.sql:1532\n";
 
 static const char *proc26 = 
+"#line 2157 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.POST (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "declare _content_type any;\n"
@@ -2163,9 +2190,10 @@ static const char *proc26 =
 "WS.WS.GET (path, params, lines);\n"
 "}\n"
 "}\n"
-"--src dav.sql:2156\n";
+"--src dav.sql:2155\n";
 
 static const char *proc27 = 
+"#line 2180 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.SPARQL_QUERY_POST (in path varchar, inout ses varchar)\n"
 "{\n"
 "declare def_gr, full_qr, qr, cname any;\n"
@@ -2203,18 +2231,20 @@ static const char *proc27 =
 "}\n"
 "ses := sprintf (\'CONSTRUCT { ?s ?p ?o } FROM <%s> WHERE { ?s ?p ?o }\', def_gr);\n"
 "}\n"
-"--src dav.sql:2179\n";
+"--src dav.sql:2178\n";
 
 static const char *proc28 = 
+"#line 2219 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.SPARQL_QUERY_GET (in content any, in path any, inout lines any)\n"
 "{\n"
 "declare pars any;\n"
 "pars := vector (\'query\', string_output_string (content));\n"
 "WS.WS.\"/!sparql/\" (path, pars, lines);\n"
 "}\n"
-"--src dav.sql:2218\n";
+"--src dav.sql:2217\n";
 
 static const char *proc29 = 
+"#line 2230 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.\"LOCK\" (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "declare len, tleft, tright integer;\n"
@@ -2332,9 +2362,10 @@ static const char *proc29 =
 "\'</D:lockdiscovery>\',\n"
 "\'</D:prop>\'));\n"
 "}\n"
-"--src dav.sql:2229\n";
+"--src dav.sql:2228\n";
 
 static const char *proc30 = 
+"#line 2349 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.\"UNLOCK\" (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "declare uname, upwd, _perms, token, name, cur_token, location varchar;\n"
@@ -2384,9 +2415,10 @@ static const char *proc30 =
 "http_request_status (\'HTTP/1.1 204 No Content\');\n"
 "return;\n"
 "}\n"
-"--src dav.sql:2348\n";
+"--src dav.sql:2347\n";
 
 static const char *proc31 = 
+"#line 2402 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.OPLOCKTOKEN ()\n"
 "{\n"
 "\n"
@@ -2397,9 +2429,10 @@ static const char *proc31 =
 "\n"
 "\n"
 "}\n"
-"--src dav.sql:2401\n";
+"--src dav.sql:2400\n";
 
 static const char *proc32 = 
+"#line 2414 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.PARENT_PATH (in path varchar)\n"
 "{\n"
 "declare tmp any;\n"
@@ -2418,9 +2451,10 @@ static const char *proc32 =
 "}\n"
 "return tmp;\n"
 "}\n"
-"--src dav.sql:2413\n";
+"--src dav.sql:2412\n";
 
 static const char *proc33 = 
+"#line 2434 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.HREF_TO_ARRAY (in path varchar,in host varchar)\n"
 "{\n"
 "declare arr, res any;\n"
@@ -2439,9 +2473,10 @@ static const char *proc33 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src dav.sql:2433\n";
+"--src dav.sql:2432\n";
 
 static const char *proc34 = 
+"#line 2454 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.HREF_TO_PATH_ARRAY (in path varchar)\n"
 "{\n"
 "declare arr, res any;\n"
@@ -2465,9 +2500,10 @@ static const char *proc34 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src dav.sql:2453\n";
+"--src dav.sql:2452\n";
 
 static const char *proc35 = 
+"#line 2480 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.DSTIS (in path varchar, in host varchar, out rcol integer, out rname varchar)\n"
 "{\n"
 "declare inx, col, res, id, name_len, depth, cols integer;\n"
@@ -2527,23 +2563,26 @@ static const char *proc35 =
 "\n"
 "return rc;\n"
 "}\n"
-"--src dav.sql:2479\n";
+"--src dav.sql:2478\n";
 
 static const char *proc36 = 
+"#line 2542 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.MOVE (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "WS.WS.COPY_OR_MOVE (path, params, lines, 0);\n"
 "}\n"
-"--src dav.sql:2541\n";
+"--src dav.sql:2540\n";
 
 static const char *proc37 = 
+"#line 2548 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.COPY (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "WS.WS.COPY_OR_MOVE (path, params, lines, 1);\n"
 "}\n"
-"--src dav.sql:2547\n";
+"--src dav.sql:2546\n";
 
 static const char *proc38 = 
+"#line 2554 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.COPY_OR_MOVE (in path varchar, inout params varchar, in lines varchar, in is_copy integer)\n"
 "{\n"
 "declare _src_name, st, _dst_name varchar;\n"
@@ -2689,9 +2728,10 @@ static const char *proc38 =
 "if (rc = -3)	{ http_request_status (\'HTTP/1.1 412 Precondition Failed\');	return; }\n"
 "DAV_SET_HTTP_REQUEST_STATUS (rc);\n"
 "}\n"
-"--src dav.sql:2553\n";
+"--src dav.sql:2552\n";
 
 static const char *proc39 = 
+"#line 2703 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.ISLOCKED (in path any, in lines varchar, in _u_id integer)\n"
 "{\n"
 "declare name, token, if_token varchar;\n"
@@ -2744,9 +2784,10 @@ static const char *proc39 =
 "close l_cur;\n"
 "return rc;\n"
 "}\n"
-"--src dav.sql:2702\n";
+"--src dav.sql:2701\n";
 
 static const char *proc40 = 
+"#line 2757 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.CHECK_AUTH (in lines any)\n"
 "{\n"
 "declare _u_group, _u_id integer;\n"
@@ -2754,9 +2795,10 @@ static const char *proc40 =
 "_u_id := WS.WS.GET_AUTH (lines, _u_group, _perms);\n"
 "return _u_id;\n"
 "}\n"
-"--src dav.sql:2756\n";
+"--src dav.sql:2755\n";
 
 static const char *proc41 = 
+"#line 2767 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.GET_IF_AUTH (in lines any, out _u_group integer, out _perms varchar)\n"
 "{\n"
 "declare _u_id integer;\n"
@@ -2775,9 +2817,10 @@ static const char *proc41 =
 "}\n"
 "return _u_id;\n"
 "}\n"
-"--src dav.sql:2766\n";
+"--src dav.sql:2765\n";
 
 static const char *proc42 = 
+"#line 2787 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.GET_DAV_AUTH (in lines any, in allow_anon integer, in can_write_http integer,\n"
 "out _u_name varchar, out _u_password varchar, out _uid integer, out _gid integer, out _perms varchar) returns integer\n"
 "{\n"
@@ -2862,6 +2905,11 @@ static const char *proc42 =
 "}\n"
 "\n"
 "request_auth:\n"
+"_u_name := null;\n"
+"_u_password := null;\n"
+"_uid := null;\n"
+"_gid := null;\n"
+"_perms := null;\n"
 "if (allow_anon)\n"
 "{\n"
 "_uid := http_nobody_uid ();\n"
@@ -2885,9 +2933,10 @@ static const char *proc42 =
 "\'Access to page is forbidden.</BODY></HTML>\'));\n"
 "return -24;\n"
 "}\n"
-"--src dav.sql:2786\n";
+"--src dav.sql:2785\n";
 
 static const char *proc43 = 
+"#line 2901 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.PERM_COMP (in perm varchar, in mask varchar)\n"
 "{\n"
 "declare inx integer;\n"
@@ -2905,9 +2954,10 @@ static const char *proc43 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src dav.sql:2895\n";
+"--src dav.sql:2899\n";
 
 static const char *proc44 = 
+"#line 2921 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.CHECKPERM ( in path varchar, in _u_id integer, in action varchar)\n"
 "{\n"
 "declare g_id, _user, _group integer;\n"
@@ -2985,9 +3035,10 @@ static const char *proc44 =
 "}\n"
 "return rc;\n"
 "}\n"
-"--src dav.sql:2915\n";
+"--src dav.sql:2919\n";
 
 static const char *proc45 = 
+"#line 3000 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.ISPUBLIC (in path varchar, in ask varchar)\n"
 "{\n"
 "declare perms, name, given varchar;\n"
@@ -3012,9 +3063,10 @@ static const char *proc45 =
 "nf:\n"
 "return 0;\n"
 "}\n"
-"--src dav.sql:2994\n";
+"--src dav.sql:2998\n";
 
 static const char *proc46 = 
+"#line 3026 \"[executable]/dav.sql\"\n"
 "create procedure\n"
 "WS.WS.DAV_VSP_DEF_REMOVE (in path varchar)\n"
 "{\n"
@@ -3029,9 +3081,10 @@ static const char *proc46 =
 "}\n"
 "}\n"
 "}\n"
-"--src dav.sql:3020\n";
+"--src dav.sql:3024\n";
 
 static const char *proc47 = 
+"#line 3042 \"[executable]/dav.sql\"\n"
 "create function DAV_PERMS_SET_CHAR (in perms varchar, in ch any, in pos integer) returns varchar\n"
 "{\n"
 "declare l integer;\n"
@@ -3044,9 +3097,10 @@ static const char *proc47 =
 "perms[pos] := ch[0];\n"
 "return perms;\n"
 "}\n"
-"--src dav.sql:3036\n";
+"--src dav.sql:3040\n";
 
 static const char *proc48 = 
+"#line 3056 \"[executable]/dav.sql\"\n"
 "create procedure DAV_PERMS_FIX (inout perms varchar, in full_perms varchar)\n"
 "{\n"
 "declare l integer;\n"
@@ -3058,9 +3112,10 @@ static const char *proc48 =
 "if (ascii(\'-\') = perms [10])\n"
 "perms[10] := full_perms[10];\n"
 "}\n"
-"--src dav.sql:3050\n";
+"--src dav.sql:3054\n";
 
 static const char *proc49 = 
+"#line 3069 \"[executable]/dav.sql\"\n"
 "create procedure DAV_PERMS_INHERIT (inout perms varchar, in parent_perms varchar, in force_parent integer := 0)\n"
 "{\n"
 "declare l integer;\n"
@@ -3072,9 +3127,10 @@ static const char *proc49 =
 "if ((ascii(\'-\') = perms [10]) or (force_parent and (ascii(\'M\') <> parent_perms [10])))\n"
 "perms[10] := parent_perms[10];\n"
 "}\n"
-"--src dav.sql:3063\n";
+"--src dav.sql:3067\n";
 
 static const char *trig0 = 
+"#line 3083 \"[executable]/dav.sql\"\n"
 "create trigger SYS_DAV_RES_FULL_PATH_I after insert on WS.WS.SYS_DAV_RES order 0 referencing new as N\n"
 "{\n"
 "declare full_path, name, _pflags, _rflags, _inh varchar;\n"
@@ -3139,9 +3195,10 @@ static const char *trig0 =
 "xslt_stale (concat (\'virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:\', N.RES_FULL_PATH));\n"
 "\n"
 "}\n"
-"--src dav.sql:3077\n";
+"--src dav.sql:3081\n";
 
 static const char *trig1 = 
+"#line 3149 \"[executable]/dav.sql\"\n"
 "create trigger SYS_DAV_RES_FULL_PATH_BU before update on WS.WS.SYS_DAV_RES referencing old as O, new as N\n"
 "{\n"
 "declare _pflags, _rflags, _inh varchar;\n"
@@ -3166,9 +3223,10 @@ static const char *trig1 =
 "}\n"
 "\n"
 "}\n"
-"--src dav.sql:3143\n";
+"--src dav.sql:3147\n";
 
 static const char *trig2 = 
+"#line 3175 \"[executable]/dav.sql\"\n"
 "create trigger SYS_DAV_RES_FULL_PATH_U after update on WS.WS.SYS_DAV_RES referencing old as O, new as N\n"
 "{\n"
 "declare full_path, name varchar;\n"
@@ -3200,8 +3258,7 @@ static const char *trig2 =
 "\n"
 "if (O.RES_FULL_PATH <> full_path)\n"
 "{\n"
-"update WS.WS.VFS_URL set VU_ETAG = \'\' where concat (\'/DAV/\', VU_ROOT, VU_URL) = O.RES_FULL_PATH;\n"
-"\n"
+"update WS.WS.VFS_URL set VU_ETAG = \'\' where VU_RES_ID = O.RES_ID;\n"
 "}\n"
 "\n"
 "WS.WS.DAV_VSP_DEF_REMOVE (O.RES_FULL_PATH);\n"
@@ -3239,9 +3296,10 @@ static const char *trig2 =
 "xslt_stale (concat (\'virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:\', N.RES_FULL_PATH));\n"
 "\n"
 "}\n"
-"--src dav.sql:3169\n";
+"--src dav.sql:3173\n";
 
 static const char *trig3 = 
+"#line 3246 \"[executable]/dav.sql\"\n"
 "create trigger SYS_DAV_COL_U after update on WS.WS.SYS_DAV_COL referencing old as O, new as N\n"
 "{\n"
 "declare full_path, name, _pflags, _cflags varchar;\n"
@@ -3360,8 +3418,6 @@ static const char *trig3 =
 "repl_text (pub, \'\"DB.DBA.DAV_COL_D\" (?, 1)\', old_col_path);\n"
 "}\n"
 "\n"
-"\n"
-"update WS.WS.VFS_URL set VU_ETAG = \'\' where substring (concat (\'/DAV/\', VU_ROOT, VU_URL), 1, length (old_col_path)) = old_col_path;\n"
 "WS.WS.UPDCHILD (res, full_path, _pflags, repl);\n"
 "set triggers on;\n"
 "if (ascii(\'R\') = _pflags[9])\n"
@@ -3380,9 +3436,10 @@ static const char *trig3 =
 "where RES_COL = res and (case (lt (length (RES_PERMS), 11)) when 1 then 0 else RES_PERMS[10] end) <> _pflags[10];\n"
 "\n"
 "}\n"
-"--src dav.sql:3241\n";
+"--src dav.sql:3244\n";
 
 static const char *proc50 = 
+"#line 3384 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.UPDCHILD (in col integer, in root_path varchar, in _pflags varchar, in repl varchar)\n"
 "{\n"
 "declare name, new_path, str varchar;\n"
@@ -3390,8 +3447,12 @@ static const char *proc50 =
 "declare c_cur cursor for select COL_ID, COL_NAME, COL_MOD_TIME, COL_PERMS, COL_OWNER, COL_GROUP\n"
 "from WS.WS.SYS_DAV_COL where COL_PARENT = col;\n"
 "\n"
-"for select RES_FULL_PATH from WS.WS.SYS_DAV_RES where RES_COL = col and RES_NAME like \'%.vsp\' do\n"
+"for select RES_ID, RES_NAME, RES_FULL_PATH from WS.WS.SYS_DAV_RES where RES_COL = col do\n"
 "{\n"
+"\n"
+"update WS.WS.VFS_URL set VU_ETAG = \'\' where VU_RES_ID = RES_ID;\n"
+"\n"
+"if (RES_NAME like \'%.vsp\')\n"
 "WS.WS.DAV_VSP_DEF_REMOVE (RES_FULL_PATH);\n"
 "}\n"
 "\n"
@@ -3460,9 +3521,10 @@ static const char *proc50 =
 "not_col:\n"
 "close c_cur;\n"
 "}\n"
-"--src dav.sql:3381\n";
+"--src dav.sql:3382\n";
 
 static const char *trig4 = 
+"#line 3467 \"[executable]/dav.sql\"\n"
 "create trigger SYS_DAV_COL_I after insert on WS.WS.SYS_DAV_COL referencing new as N\n"
 "{\n"
 "declare _pflags, _cflags, col_path, _inh varchar;\n"
@@ -3513,9 +3575,10 @@ static const char *trig4 =
 "\n"
 "\n"
 "}\n"
-"--src dav.sql:3460\n";
+"--src dav.sql:3465\n";
 
 static const char *proc51 = 
+"#line 3519 \"[executable]/dav.sql\"\n"
 "create procedure\n"
 "WS.WS.DAV_VSP_INCLUDES_CHANGED (in full_path varchar, in own varchar)\n"
 "{\n"
@@ -3541,9 +3604,10 @@ static const char *proc51 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src dav.sql:3512\n";
+"--src dav.sql:3517\n";
 
 static const char *proc52 = 
+"#line 3547 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.EXPAND_INCLUDES (in path varchar, inout stream varchar, in level integer,\n"
 "in ct integer, in content varchar, inout st any := null)\n"
 "{\n"
@@ -3624,9 +3688,10 @@ static const char *proc52 =
 "if (length (curr_file) > 0)\n"
 "http (curr_file, stream);\n"
 "}\n"
-"--src dav.sql:3540\n";
+"--src dav.sql:3545\n";
 
 static const char *trig5 = 
+"#line 3629 \"[executable]/dav.sql\"\n"
 "create trigger SYS_DAV_RES_FULL_PATH_D after delete on WS.WS.SYS_DAV_RES\n"
 "{\n"
 "set triggers off;\n"
@@ -3647,15 +3712,7 @@ static const char *trig5 =
 "}\n"
 "\n"
 "\n"
-"update WS.WS.VFS_URL set VU_ETAG = \'\' where concat (\'/DAV/\', VU_ROOT, VU_URL) = RES_FULL_PATH;\n"
-"delete from WS.WS.VFS_QUEUE where concat (\'/DAV/\', VQ_ROOT, VQ_URL) = RES_FULL_PATH;\n"
-"if (RES_NAME = \'index.html\')\n"
-"{\n"
-"delete from WS.WS.VFS_URL  where concat (\'/DAV/\', VU_ROOT, VU_URL) = WS.WS.COL_PATH (RES_COL);\n"
-"if (not exists (select 1 from WS.WS.VFS_SITE where\n"
-"concat (\'/DAV/\', VS_ROOT, VS_URL) = WS.WS.COL_PATH (RES_COL)))\n"
-"delete from WS.WS.VFS_QUEUE where concat (\'/DAV/\', VQ_ROOT, VQ_URL) = WS.WS.COL_PATH (RES_COL);\n"
-"}\n"
+"update WS.WS.VFS_URL set VU_ETAG = \'\' where VU_RES_ID = RES_ID;\n"
 "if (RES_TYPE = \'text/xsl\')\n"
 "xslt_stale (concat (\'virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:\', RES_FULL_PATH));\n"
 "\n"
@@ -3664,9 +3721,10 @@ static const char *trig5 =
 "delete from WS.WS.SYS_DAV_TAG where DT_RES_ID = RES_ID;\n"
 "\n"
 "}\n"
-"--src dav.sql:3622\n";
+"--src dav.sql:3627\n";
 
 static const char *trig6 = 
+"#line 3660 \"[executable]/dav.sql\"\n"
 "create trigger SYS_DAV_COL_D before delete on WS.WS.SYS_DAV_COL order 100\n"
 "{\n"
 "declare pub, col_path varchar;\n"
@@ -3681,22 +3739,14 @@ static const char *trig6 =
 "repl_text (pub, \'\"DB.DBA.DAV_COL_D\" (?, 0)\', col_path);\n"
 "}\n"
 "\n"
-"if (COL_PARENT = 1)\n"
-"{\n"
-"update WS.WS.VFS_URL set VU_ETAG = \'\'  where VU_ROOT = COL_NAME;\n"
-"delete from WS.WS.VFS_QUEUE where VQ_ROOT = COL_NAME\n"
-"and VQ_URL <> (select VS_URL from WS.WS.VFS_SITE where VS_ROOT = COL_NAME);\n"
-"delete from DB.DBA.SYS_SCHEDULED_EVENT\n"
-"where \"RIGHT\"(SE_NAME, length (COL_NAME) + 2) = concat (\'/\', COL_NAME, \')\');\n"
-"}\n"
-"\n"
 "delete from WS.WS.SYS_DAV_PROP where PROP_TYPE = \'C\' and PROP_PARENT_ID = COL_ID;\n"
 "delete from WS.WS.SYS_DAV_LOCK where LOCK_PARENT_TYPE = \'C\' and LOCK_PARENT_ID = COL_ID;\n"
 "\n"
 "}\n"
-"--src dav.sql:3661\n";
+"--src dav.sql:3658\n";
 
 static const char *proc53 = 
+"#line 3682 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.XML_VIEW_HEADER\n"
 "(\n"
 "in view_name varchar,\n"
@@ -3757,9 +3807,10 @@ static const char *proc53 =
 "}\n"
 "signal (\'22023\', \'Unsupported type of metadata\', \'DA006\');\n"
 "}\n"
-"--src dav.sql:3692\n";
+"--src dav.sql:3680\n";
 
 static const char *proc54 = 
+"#line 3745 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.XML_VIEW_EXTERNAL_META\n"
 "(\n"
 "in view_name varchar,\n"
@@ -3789,9 +3840,10 @@ static const char *proc54 =
 "meta_path_suffix := \'\';\n"
 "mime_type := \'\';\n"
 "}\n"
-"--src dav.sql:3755\n";
+"--src dav.sql:3743\n";
 
 static const char *proc55 = 
+"#line 3776 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.XML_VIEW_UPDATE (in _view varchar, in _res_id integer, in path varchar, in meta_mode integer, in meta_data varchar)\n"
 "{\n"
 "declare _body any;\n"
@@ -3806,9 +3858,10 @@ static const char *proc55 =
 "_body := string_output_string (_body);\n"
 "update WS.WS.SYS_DAV_RES set RES_CONTENT = _body, RES_MOD_TIME = now () where RES_ID = _res_id;\n"
 "}\n"
-"--src dav.sql:3786\n";
+"--src dav.sql:3774\n";
 
 static const char *proc56 = 
+"#line 3792 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.FIXPATH (in path any)\n"
 "{\n"
 "declare inx, len, cp, sl integer;\n"
@@ -3887,9 +3940,10 @@ static const char *proc56 =
 "ret := \'\';\n"
 "return ret;\n"
 "}\n"
-"--src dav.sql:3802\n";
+"--src dav.sql:3790\n";
 
 static const char *proc57 = 
+"#line 3873 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.ISPUBL (in __path varchar)\n"
 "{\n"
 "declare _srv, _path varchar;\n"
@@ -3931,9 +3985,10 @@ static const char *proc57 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src dav.sql:3883\n";
+"--src dav.sql:3871\n";
 
 static const char *proc58 = 
+"#line 3916 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.BODY_ARR (inout __ses any, in __pcs integer)\n"
 "{\n"
 "declare _res, _ses any;\n"
@@ -3983,9 +4038,10 @@ static const char *proc58 =
 "\n"
 "return _res;\n"
 "}\n"
-"--src dav.sql:3926\n";
+"--src dav.sql:3914\n";
 
 static const char *proc59 = 
+"#line 3971 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.XML_AUTO_SCHED (in _path varchar)\n"
 "{\n"
 "declare _stmt, ses, _root, _sch, _dtd, _dtd_body, _comments varchar;\n"
@@ -4015,9 +4071,10 @@ static const char *proc59 =
 "WS.WS.XMLSQL_TO_STRSES (_stmt, _root, _sch, _dtd, _comments, ses);\n"
 "update WS.WS.SYS_DAV_RES set RES_CONTENT = ses, RES_MOD_TIME = now () where RES_ID = _res_id;\n"
 "}\n"
-"--src dav.sql:3981\n";
+"--src dav.sql:3969\n";
 
 static const char *proc60 = 
+"#line 4003 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.DAV_LOGIN (in path any,\n"
 "in lines any,\n"
 "in __access varchar,\n"
@@ -4063,9 +4120,10 @@ static const char *proc60 =
 "\n"
 "return (1);\n"
 "}\n"
-"--src dav.sql:4013\n";
+"--src dav.sql:4001\n";
 
 static const char *proc61 = 
+"#line 4050 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.HTTP_RESP (in hdr any, out descr varchar)\n"
 "{\n"
 "declare line, code varchar;\n"
@@ -4091,9 +4149,10 @@ static const char *proc61 =
 "code := substring (code, 1, 3);\n"
 "return atoi (code);\n"
 "}\n"
-"--src dav.sql:4060\n";
+"--src dav.sql:4048\n";
 
 static const char *proc62 = 
+"#line 4078 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.COPY_TO_OTHER (in path varchar,\n"
 "inout params varchar,\n"
 "in lines varchar,\n"
@@ -4209,9 +4268,10 @@ static const char *proc62 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src dav.sql:4088\n";
+"--src dav.sql:4076\n";
 
 static const char *proc63 = 
+"#line 4195 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.CHECK_READ_ACCESS (in _u_id integer, in doc_id integer)\n"
 "{\n"
 "declare _perms varchar;\n"
@@ -4233,9 +4293,10 @@ static const char *proc63 =
 "exit_p:;\n"
 "return rc;\n"
 "}\n"
-"--src dav.sql:4205\n";
+"--src dav.sql:4193\n";
 
 static const char *proc64 = 
+"#line 4218 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.IS_REDIRECT_REF (inout path any, in lines any, inout location varchar)\n"
 "{\n"
 "declare fpath, fpath1, _ref, lpath, ppath varchar;\n"
@@ -4263,9 +4324,10 @@ static const char *proc64 =
 "set isolation=\'repeatable\';\n"
 "return rc;\n"
 "}\n"
-"--src dav.sql:4228\n";
+"--src dav.sql:4216\n";
 
 static const char *proc65 = 
+"#line 4248 \"[executable]/dav.sql\"\n"
 "create function WS.WS.DAV_DIR_LIST (in full_path varchar, in logical_root_path varchar, in col integer, in auth_uname varchar, in auth_pwd varchar, in auth_uid integer) returns integer\n"
 "{\n"
 "declare _dir, _xml, _modify, fsize, _html, _b_opt, _xml_sheet any;\n"
@@ -4370,9 +4432,10 @@ static const char *proc65 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src dav.sql:4258\n";
+"--src dav.sql:4246\n";
 
 static const char *proc66 = 
+"#line 4374 \"[executable]/dav.sql\"\n"
 "create function\n"
 "WS.WS.DAV_CHECK_ASMX (in path any, out patched_path any) returns integer\n"
 "{\n"
@@ -4399,9 +4462,10 @@ static const char *proc66 =
 "patched_path := path;\n"
 "return 0;\n"
 "}\n"
-"--src dav.sql:4384\n";
+"--src dav.sql:4372\n";
 
 static const char *proc67 = 
+"#line 4403 \"[executable]/dav.sql\"\n"
 "create procedure\n"
 "WS.WS.DAV_REMOVE_ASMX (in path any)\n"
 "{\n"
@@ -4414,9 +4478,10 @@ static const char *proc67 =
 "else\n"
 "return path;\n"
 "}\n"
-"--src dav.sql:4413\n";
+"--src dav.sql:4401\n";
 
 static const char *proc68 = 
+"#line 4418 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.XMLSQL_TO_STRSES (\n"
 "in _q varchar,\n"
 "in _root varchar,\n"
@@ -4462,9 +4527,10 @@ static const char *proc68 =
 "\n"
 "return;\n"
 "}\n"
-"--src dav.sql:4428\n";
+"--src dav.sql:4416\n";
 
 static const char *proc69 = 
+"#line 4465 \"[executable]/dav.sql\"\n"
 "create procedure WS.WS.\"TRACE\" (in path varchar, inout params varchar, in lines varchar)\n"
 "{\n"
 "http_header (\'Content-Type: message/http\\r\\n\');\n"
@@ -4474,11 +4540,12 @@ static const char *proc69 =
 "http (l);\n"
 "}\n"
 "}\n"
-"--src dav.sql:4475\n";
+"--src dav.sql:4463\n";
 
 /* dav_api.sql */
 
 static const char *proc70 = 
+"#line 51 \"[executable]/dav_api.sql\"\n"
 "create function DAV_PERROR (in x any)\n"
 "{\n"
 "declare errlist any;\n"
@@ -4535,9 +4602,10 @@ static const char *proc70 =
 ");\n"
 "return errlist [-(x+1)];\n"
 "}\n"
-"--src dav_api.sql:50\n";
+"--src dav_api.sql:49\n";
 
 static const char *proc71 = 
+"#line 110 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_ADD_USER_INT (in uid varchar,\n"
 "in pwd varchar,\n"
@@ -4584,9 +4652,10 @@ static const char *proc71 =
 "}\n"
 "return id;\n"
 "}\n"
-"--src dav_api.sql:109\n";
+"--src dav_api.sql:108\n";
 
 static const char *proc72 = 
+"#line 159 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_ADD_USER (in uid varchar, in pwd varchar, in gid varchar,\n"
 "in perms varchar, in disable integer,\n"
@@ -4622,9 +4691,10 @@ static const char *proc72 =
 "}\n"
 "return rc;\n"
 "}\n"
-"--src dav_api.sql:158\n";
+"--src dav_api.sql:157\n";
 
 static const char *proc73 = 
+"#line 197 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_DELETE_USER (in uid varchar, in auth_uname varchar := NULL, in auth_pwd varchar := NULL)\n"
 "{\n"
@@ -4639,21 +4709,24 @@ static const char *proc73 =
 "delete from WS.WS.SYS_DAV_USER where U_NAME = uid;\n"
 "return 0;\n"
 "}\n"
-"--src dav_api.sql:196\n";
+"--src dav_api.sql:195\n";
 
 static const char *proc74 = 
+"#line 214 \"[executable]/dav_api.sql\"\n"
 " create function DAV_REGEXP_PATTERN_FOR_PERM () returns varchar {\n"
 "return \'^[01][01][01][01][01][01][01][01][01]([NTR-]([NMR-])?)?\\044\';\n"
 "}\n"
-"--src dav_api.sql:213\n";
+"--src dav_api.sql:212\n";
 
 static const char *proc75 = 
+"#line 219 \"[executable]/dav_api.sql\"\n"
 "create function DAV_REGEXP_PATTERN_FOR_UNIX_PERM () returns varchar {\n"
 "return \'^[r\\\\-][w\\\\-][x\\\\-][r\\\\-][w\\\\-][x\\\\-][r\\\\-][w\\\\-][x\\\\-]([NTR-]([NMR-])?)?\\044\';\n"
 "}\n"
-"--src dav_api.sql:218\n";
+"--src dav_api.sql:217\n";
 
 static const char *proc76 = 
+"#line 225 \"[executable]/dav_api.sql\"\n"
 " create function\n"
 "DAV_PERM_D2U (in perms varchar)\n"
 "{\n"
@@ -4671,9 +4744,10 @@ static const char *proc76 =
 "}\n"
 "return lower(res);\n"
 "}\n"
-"--src dav_api.sql:224\n";
+"--src dav_api.sql:223\n";
 
 static const char *proc77 = 
+"#line 245 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_PERM_U2D (in perms varchar)\n"
 "{\n"
@@ -4694,9 +4768,10 @@ static const char *proc77 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src dav_api.sql:244\n";
+"--src dav_api.sql:243\n";
 
 static const char *proc78 = 
+"#line 267 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_CHECK_AUTH (in auth_uname varchar := NULL, in auth_pwd varchar := NULL, in adm integer := 0) returns integer\n"
 "{\n"
@@ -4728,9 +4803,10 @@ static const char *proc78 =
 "\n"
 "return -12;\n"
 "}\n"
-"--src dav_api.sql:266\n";
+"--src dav_api.sql:265\n";
 
 static const char *proc79 = 
+"#line 301 \"[executable]/dav_api.sql\"\n"
 " create function\n"
 "DAV_HOME_DIR (in uid varchar) returns any\n"
 "{\n"
@@ -4741,9 +4817,10 @@ static const char *proc79 =
 "er:\n"
 "return -18;\n"
 "}\n"
-"--src dav_api.sql:300\n";
+"--src dav_api.sql:299\n";
 
 static const char *proc80 = 
+"#line 313 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_HOME_DIR_CREATE (in uid varchar) returns any\n"
 "{\n"
@@ -4782,9 +4859,10 @@ static const char *proc80 =
 "_end:;\n"
 "return rc;\n"
 "}\n"
-"--src dav_api.sql:312\n";
+"--src dav_api.sql:311\n";
 
 static const char *proc81 = 
+"#line 353 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_ADD_GROUP_INT (in gid varchar)\n"
 "{\n"
@@ -4796,9 +4874,10 @@ static const char *proc81 =
 "}\n"
 "return gd;\n"
 "}\n"
-"--src dav_api.sql:352\n";
+"--src dav_api.sql:351\n";
 
 static const char *proc82 = 
+"#line 367 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_ADD_GROUP (in gid varchar, in auth_uname varchar := NULL, in auth_pwd varchar := NULL)\n"
 "{\n"
@@ -4806,9 +4885,10 @@ static const char *proc82 =
 "return -12;\n"
 "return DAV_ADD_GROUP_INT (gid);\n"
 "}\n"
-"--src dav_api.sql:366\n";
+"--src dav_api.sql:365\n";
 
 static const char *proc83 = 
+"#line 377 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_DELETE_GROUP (in gid varchar, in auth_uname varchar := NULL, in auth_pwd varchar := NULL)\n"
 "{\n"
@@ -4821,9 +4901,10 @@ static const char *proc83 =
 "delete from WS.WS.SYS_DAV_GROUP where G_NAME = gid;\n"
 "return 0;\n"
 "}\n"
-"--src dav_api.sql:376\n";
+"--src dav_api.sql:375\n";
 
 static const char *proc84 = 
+"#line 393 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_DIR_LIST (in path varchar := \'/DAV/\', in recursive integer, in auth_uname varchar, in auth_pwd varchar) returns any\n"
 "{\n"
@@ -4834,9 +4915,10 @@ static const char *proc84 =
 "\n"
 "return DAV_DIR_LIST_INT (path, recursive, \'%\', auth_uname, auth_pwd, auth_uid);\n"
 "}\n"
-"--src dav_api.sql:392\n";
+"--src dav_api.sql:391\n";
 
 static const char *proc85 = 
+"#line 406 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_DIR_FILTER (in path varchar := \'/DAV/\', in recursive integer := 0, inout filter any, in auth_uname varchar, in auth_pwd varchar) returns any\n"
 "{\n"
@@ -4850,9 +4932,10 @@ static const char *proc85 =
 "\n"
 "return DAV_DIR_FILTER_INT (path, recursive, compilation, auth_uname, auth_pwd, auth_uid);\n"
 "}\n"
-"--src dav_api.sql:405\n";
+"--src dav_api.sql:404\n";
 
 static const char *proc86 = 
+"#line 422 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_GET_PARENT (in id any, in st char(1), in path varchar) returns any\n"
 "{\n"
@@ -4867,9 +4950,10 @@ static const char *proc86 =
 "}\n"
 "return call (cast (id[0] as varchar) || \'_DAV_GET_PARENT\') (id, st, path);\n"
 "}\n"
-"--src dav_api.sql:421\n";
+"--src dav_api.sql:420\n";
 
 static const char *proc87 = 
+"#line 439 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_DIR_SINGLE_INT (in did any, in st char (0), in path varchar, in auth_uname varchar := null, in auth_pwd varchar := null, in auth_uid integer := null) returns any\n"
 "{\n"
@@ -4912,9 +4996,10 @@ static const char *proc87 =
 "where COL_ID = did ));\n"
 "}\n"
 "}\n"
-"--src dav_api.sql:438\n";
+"--src dav_api.sql:437\n";
 
 static const char *proc88 = 
+"#line 484 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_DIR_LIST_INT (in path varchar := \'/DAV/\', in rec_depth integer := 0, in name_mask varchar, in auth_uname varchar := null, in auth_pwd varchar := null, inout auth_uid integer := null) returns any\n"
 "{\n"
@@ -5034,9 +5119,10 @@ static const char *proc88 =
 "vectorbld_final (res);\n"
 "return res;\n"
 "}\n"
-"--src dav_api.sql:483\n";
+"--src dav_api.sql:482\n";
 
 static const char *proc89 = 
+"#line 606 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_DIR_FILTER_INT (in path varchar := \'/DAV/\', in rec_depth integer := 0, in compilation any, in auth_uname varchar := null, in auth_pwd varchar := null, in auth_uid integer := null) returns any\n"
 "{\n"
@@ -5185,9 +5271,10 @@ static const char *proc89 =
 "vectorbld_final (res);\n"
 "return res;\n"
 "}\n"
-"--src dav_api.sql:605\n";
+"--src dav_api.sql:604\n";
 
 static const char *proc90 = 
+"#line 758 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_SEARCH_PATH (in id any, in what char (1)) returns any\n"
 "{\n"
@@ -5219,9 +5306,10 @@ static const char *proc90 =
 "en:\n"
 "return -23;\n"
 "}\n"
-"--src dav_api.sql:757\n";
+"--src dav_api.sql:756\n";
 
 static const char *proc91 = 
+"#line 793 \"[executable]/dav_api.sql\"\n"
 " create function\n"
 "DAV_SEARCH_ID (in path any, in what char (1)) returns any\n"
 "{\n"
@@ -5307,9 +5395,10 @@ static const char *proc91 =
 "}\n"
 "return id;\n"
 "}\n"
-"--src dav_api.sql:792\n";
+"--src dav_api.sql:791\n";
 
 static const char *proc92 = 
+"#line 881 \"[executable]/dav_api.sql\"\n"
 " create function\n"
 "DAV_SEARCH_SOME_ID (in path any, out what char (1)) returns any\n"
 "{\n"
@@ -5348,9 +5437,10 @@ static const char *proc92 =
 "}\n"
 "return id;\n"
 "}\n"
-"--src dav_api.sql:880\n";
+"--src dav_api.sql:879\n";
 
 static const char *proc93 = 
+"#line 922 \"[executable]/dav_api.sql\"\n"
 " create function\n"
 "DAV_HIDE_ERROR (in res any, in dflt any := null) returns any\n"
 "{\n"
@@ -5360,9 +5450,10 @@ static const char *proc93 =
 "return res;\n"
 "return dflt;\n"
 "}\n"
-"--src dav_api.sql:921\n";
+"--src dav_api.sql:920\n";
 
 static const char *proc94 = 
+"#line 935 \"[executable]/dav_api.sql\"\n"
 " create function\n"
 "DAV_HIDE_ERROR_OR_DET (in res any, in dflt_err any := null, in dflt_det any := -33) returns any\n"
 "{\n"
@@ -5372,9 +5463,10 @@ static const char *proc94 =
 "return res;\n"
 "return dflt_err;\n"
 "}\n"
-"--src dav_api.sql:934\n";
+"--src dav_api.sql:933\n";
 
 static const char *proc95 = 
+"#line 948 \"[executable]/dav_api.sql\"\n"
 " create function DAV_CONCAT_PATH (in parts1 any, in parts2 any)\n"
 "{\n"
 "declare strg1, strg2 varchar;\n"
@@ -5434,9 +5526,10 @@ static const char *proc95 =
 "else\n"
 "return strg1 || \'/\' || strg2;\n"
 "}\n"
-"--src dav_api.sql:947\n";
+"--src dav_api.sql:946\n";
 
 static const char *proc96 = 
+"#line 1010 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_SEARCH_SOME_ID_OR_DET (inout path any, out what char (1), out det_ret varchar, out detcol_id integer, out detcol_path_parts any, out unreached_path_parts any) returns integer\n"
 "{\n"
@@ -5460,9 +5553,10 @@ static const char *proc96 =
 "unreached_path_parts := null;\n"
 "return -1;\n"
 "}\n"
-"--src dav_api.sql:1009\n";
+"--src dav_api.sql:1008\n";
 
 static const char *proc97 = 
+"#line 1035 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_SEARCH_ID_OR_DET (in path any, in what char (1), out det_ret varchar, out detcol_id integer, out detcol_path_parts any, out unreached_path_parts any) returns integer\n"
 "{\n"
@@ -5585,9 +5679,10 @@ static const char *proc97 =
 "unreached_path_parts := null;\n"
 "return -1;\n"
 "}\n"
-"--src dav_api.sql:1034\n";
+"--src dav_api.sql:1033\n";
 
 static const char *proc98 = 
+"#line 1160 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_OWNER_ID (in uid any, in gid any, out _uid integer, out _gid integer)\n"
 "{\n"
@@ -5614,9 +5709,10 @@ static const char *proc98 =
 "\n"
 "\n"
 "}\n"
-"--src dav_api.sql:1159\n";
+"--src dav_api.sql:1158\n";
 
 static const char *proc99 = 
+"#line 1189 \"[executable]/dav_api.sql\"\n"
 "create procedure DAV_IS_LOCKED_INT (inout id any, inout type char, in owned_tokens varchar := \'\')\n"
 "{\n"
 "declare pid, npid, res integer;\n"
@@ -5680,9 +5776,10 @@ static const char *proc99 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src dav_api.sql:1188\n";
+"--src dav_api.sql:1187\n";
 
 static const char *proc100 = 
+"#line 1256 \"[executable]/dav_api.sql\"\n"
 " create function DAV_IS_LOCKED (in id any, in type char, in owned_tokens any := 1) returns integer\n"
 "{\n"
 "declare res integer;\n"
@@ -5694,16 +5791,18 @@ static const char *proc100 =
 "return -8;\n"
 "return res;\n"
 "}\n"
-"--src dav_api.sql:1255\n";
+"--src dav_api.sql:1254\n";
 
 static const char *proc101 = 
+"#line 1270 \"[executable]/dav_api.sql\"\n"
 " create function DAV_LIST_LOCKS (in id any, in type char) returns any\n"
 "{\n"
 "return DAV_LIST_LOCKS_INT (id, type);\n"
 "}\n"
-"--src dav_api.sql:1269\n";
+"--src dav_api.sql:1268\n";
 
 static const char *proc102 = 
+"#line 1276 \"[executable]/dav_api.sql\"\n"
 "create function DAV_LIST_LOCKS_INT (in id any, in type char) returns any\n"
 "{\n"
 "declare res any;\n"
@@ -5724,9 +5823,10 @@ static const char *proc102 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src dav_api.sql:1275\n";
+"--src dav_api.sql:1274\n";
 
 static const char *proc103 = 
+"#line 1298 \"[executable]/dav_api.sql\"\n"
 "create function DAV_LOCK (in path any, in locktype varchar, in scope varchar, in token varchar, in owner_name varchar, in owned_tokens varchar, in depth varchar, in timeout_sec integer, in auth_uid varchar, in auth_pwd varchar) returns any\n"
 "{\n"
 "declare id any;\n"
@@ -5736,9 +5836,10 @@ static const char *proc103 =
 "st := null;\n"
 "return DAV_LOCK_INT (path, id, st, locktype, scope, token, owner_name, owned_tokens, depth, timeout_sec, auth_uid, auth_pwd, NULL);\n"
 "}\n"
-"--src dav_api.sql:1297\n";
+"--src dav_api.sql:1296\n";
 
 static const char *proc104 = 
+"#line 1309 \"[executable]/dav_api.sql\"\n"
 "create function DAV_LOCK_INT (in path any, inout id any, inout st char(1), inout locktype varchar, inout scope varchar, in token varchar, inout owner_name varchar, inout owned_tokens varchar, in depth varchar, in timeout_sec integer, in auth_uname varchar, in auth_pwd varchar, in auth_uid integer) returns any\n"
 "{\n"
 "declare p_id any;\n"
@@ -5893,9 +5994,10 @@ static const char *proc104 =
 "return -8;\n"
 "return -35;\n"
 "}\n"
-"--src dav_api.sql:1308\n";
+"--src dav_api.sql:1307\n";
 
 static const char *proc105 = 
+"#line 1465 \"[executable]/dav_api.sql\"\n"
 "create function DAV_UNLOCK (in path varchar, in token varchar, in auth_uname varchar, in auth_pwd varchar) returns any\n"
 "{\n"
 "declare id any;\n"
@@ -5905,9 +6007,10 @@ static const char *proc105 =
 "return -1;\n"
 "return DAV_UNLOCK_INT (id, st, token, auth_uname, auth_pwd, null);\n"
 "}\n"
-"--src dav_api.sql:1464\n";
+"--src dav_api.sql:1463\n";
 
 static const char *proc106 = 
+"#line 1477 \"[executable]/dav_api.sql\"\n"
 "create function DAV_UNLOCK_INT (in id any, in st char(1), in token varchar, in auth_uname varchar, in auth_pwd varchar, in auth_uid integer) returns any\n"
 "{\n"
 "declare rc, _left, _right integer;\n"
@@ -5944,17 +6047,19 @@ static const char *proc106 =
 "close l_cur;\n"
 "return -27;\n"
 "}\n"
-"--src dav_api.sql:1476\n";
+"--src dav_api.sql:1475\n";
 
 static const char *proc107 = 
+"#line 1516 \"[executable]/dav_api.sql\"\n"
 " create function\n"
 "DAV_REQ_CHARS_TO_BITMASK (in req varchar) returns integer\n"
 "{\n"
 "return 4 * equ (req[0], 49) + 2 * equ (req[1], 49) + equ (req[2], 49);\n"
 "}\n"
-"--src dav_api.sql:1515\n";
+"--src dav_api.sql:1514\n";
 
 static const char *proc108 = 
+"#line 1525 \"[executable]/dav_api.sql\"\n"
 " create function\n"
 "DAV_AUTHENTICATE (in id any, in what char(1), in req varchar, in a_uname varchar, in a_pwd varchar, in a_uid integer := null) returns integer\n"
 "{\n"
@@ -5971,7 +6076,7 @@ static const char *proc108 =
 "\n"
 "if (a_uid < 0)\n"
 "{\n"
-"if (DAV_AUTHENTICATE_SSL_CONDITION (id, what))\n"
+"if (DAV_AUTHENTICATE_SSL_CONDITION ())\n"
 "goto _check_ssl;\n"
 "\n"
 "return a_uid;\n"
@@ -6042,20 +6147,12 @@ static const char *proc108 =
 "\n"
 "return a_uid;\n"
 "}\n"
-"if (DAV_AUTHENTICATE_SSL_CONDITION (id, what))\n"
+"if (DAV_AUTHENTICATE_SSL_CONDITION ())\n"
 "{\n"
 "_check_ssl:\n"
-"declare _perms, _res_full_path varchar;\n"
-"declare a_gid, _res_id int;\n"
+"declare _perms, a_gid any;\n"
 "\n"
-"_res_id := id;\n"
-"_res_full_path := DAV_SEARCH_PATH (_res_id, what);\n"
-"if (isstring (_res_full_path) and _res_full_path like \'%,acl\')\n"
-"{\n"
-"_res_full_path := regexp_replace (_res_full_path, \',acl\\x24\', \'\');\n"
-"_res_id := DAV_SEARCH_ID (_res_full_path, what);\n"
-"}\n"
-"if (DAV_AUTHENTICATE_SSL (_res_id, what, _res_full_path, req, a_uid, a_gid, _perms))\n"
+"if (DAV_AUTHENTICATE_SSL (id, what, null, req, a_uid, a_gid, _perms))\n"
 "return a_uid;\n"
 "}\n"
 "\n"
@@ -6066,9 +6163,10 @@ static const char *proc108 =
 "\n"
 "return -1;\n"
 "}\n"
-"--src dav_api.sql:1524\n";
+"--src dav_api.sql:1523\n";
 
 static const char *proc109 = 
+"#line 1630 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_AUTHENTICATE_HTTP (in id any, in what char(1), in req varchar, in can_write_http integer, inout a_lines any, inout a_uname varchar, inout a_pwd varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer\n"
 "{\n"
@@ -6077,6 +6175,7 @@ static const char *proc109 =
 "declare u_password, pperms, resName, resPath varchar;\n"
 "declare allow_anon integer;\n"
 "declare pacl varbinary;\n"
+"\n"
 "what := upper (what);\n"
 "\n"
 "\n"
@@ -6125,21 +6224,10 @@ static const char *proc109 =
 "rc := WS.WS.GET_DAV_AUTH (a_lines, allow_anon, can_write_http, a_uname, u_password, a_uid, a_gid, _perms);\n"
 "if (rc < 0)\n"
 "{\n"
-"declare _res_full_path varchar;\n"
-"declare _res_id int;\n"
-"\n"
-"if (isstring (resPath) and resPath like \'%,acl\')\n"
-"{\n"
-"_res_full_path := regexp_replace (resPath, \',acl\\x24\', \'\');\n"
-"_res_id := DAV_SEARCH_ID (_res_full_path, what);\n"
-"}\n"
-"else\n"
-"{\n"
-"_res_full_path := resPath;\n"
-"_res_id := id;\n"
-"}\n"
-"if (DAV_AUTHENTICATE_SSL (_res_id, what, _res_full_path, req, a_uid, a_gid, _perms))\n"
+"if (DAV_AUTHENTICATE_SSL (id, what, null, req, a_uid, a_gid, _perms))\n"
 "return a_uid;\n"
+"\n"
+"return rc;	\n"
 "}\n"
 "}\n"
 "}\n"
@@ -6190,35 +6278,56 @@ static const char *proc109 =
 "\n"
 "return -1;\n"
 "}\n"
-"--src dav_api.sql:1637\n";
+"--src dav_api.sql:1628\n";
 
 static const char *proc110 = 
+"#line 1743 \"[executable]/dav_api.sql\"\n"
 "create function\n"
-"DAV_AUTHENTICATE_SSL_CONDITION (in id any, in what char(1)) returns integer\n"
+"DAV_AUTHENTICATE_SSL_ITEM (\n"
+"inout id any,\n"
+"inout what char(1),\n"
+"inout path varchar) returns integer\n"
 "{\n"
-"if (is_https_ctx () and what = \'R\' and\n"
-"__proc_exists (fix_identifier_case (\'sioc.DBA.dav_res_iri\')) is not null and\n"
-"exists (select 1 from WS.WS.SYS_DAV_PROP where PROP_PARENT_ID = id and PROP_TYPE = what and PROP_NAME = \'virt:aci_meta_n3\'))\n"
+"declare pos integer;\n"
+"\n"
+"if (isnull (path))\n"
+"path := DAV_SEARCH_PATH (id, what);\n"
+"\n"
+"if (isstring (path) and path like \'%,acl\')\n"
 "{\n"
-"return 1;\n"
+"path := regexp_replace (path, \',acl\\x24\', \'\');\n"
+"pos := strrchr (path, \'/\');\n"
+"if (not isnull (pos))\n"
+"what := \'C\';\n"
+"id := DAV_SEARCH_ID (path, what);\n"
 "}\n"
-"return 0;\n"
 "}\n"
-"--src dav_api.sql:1760\n";
+"--src dav_api.sql:1741\n";
 
 static const char *proc111 = 
+"#line 1765 \"[executable]/dav_api.sql\"\n"
 "create function\n"
-"DAV_AUTHENTICATE_SSL (in id any, in what char(1), in path varchar, in req varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer\n"
+"DAV_AUTHENTICATE_SSL_CONDITION () returns integer\n"
 "{\n"
-"declare rc integer;\n"
-"\n"
-"rc := 0;\n"
-"if (not DAV_AUTHENTICATE_SSL_CONDITION (id, what))\n"
-"goto _exit;\n"
+"if (is_https_ctx () and (__proc_exists (\'SIOC.DBA.get_graph\') is not null))\n"
+"return 1;\n"
 "\n"
-"declare graph, foafIRI, foafGraph, loadIRI, localIRI any;\n"
+"return 0;\n"
+"}\n"
+"--src dav_api.sql:1763\n";
+
+static const char *proc112 = 
+"#line 1775 \"[executable]/dav_api.sql\"\n"
+"create function\n"
+"DAV_AUTHENTICATE_SSL_WEBID ()\n"
+"{\n"
+"declare retIRI varchar;\n"
+"declare graph, baseGraph, foafIRI, foafGraph, loadIRI, localIRI any;\n"
 "declare S, V, info, st, msg, data, meta any;\n"
 "\n"
+"retIRI := null;\n"
+"\n"
+"set_user_id (\'dba\');\n"
 "foafIRI := trim (get_certificate_info (7, null, null, null, \'2.5.29.17\'));\n"
 "V := regexp_replace (foafIRI, \',[ ]*\', \',\', 1, null);\n"
 "V := split_and_decode (V, 0, \'\\0\\0,:\');\n"
@@ -6226,10 +6335,21 @@ static const char *proc111 =
 "V := vector ();\n"
 "foafIRI := get_keyword (\'URI\', V);\n"
 "if (isnull (foafIRI))\n"
+"{\n"
+"if (__proc_exists (\'DB.DBA.FOAF_SSL_WEBFINGER\') is not null)\n"
+"{\n"
+"retIRI := DB.DBA.FOAF_SSL_WEBFINGER ();\n"
+"if (not isnull (retIRI))\n"
 "goto _exit;\n"
-"\n"
-"set_user_id (\'dba\');\n"
-"\n"
+"}\n"
+"if (__proc_exists (\'ODS.DBA.FINGERPOINT_WEBID_GET\') is not null)\n"
+"{\n"
+"retIRI := ODS.DBA.FINGERPOINT_WEBID_GET ();\n"
+"if (not isnull (retIRI))\n"
+"goto _exit;\n"
+"}\n"
+"} else {\n"
+"foafGraph := \'http://local.virt/FOAF/\' || cast (rnd (1000) as varchar);\n"
 "localIRI := foafIRI;\n"
 "V := rfc1808_parse_uri (localIRI);\n"
 "if (is_https_ctx () and\n"
@@ -6243,14 +6363,11 @@ static const char *proc111 =
 "V := rfc1808_parse_uri (foafIRI);\n"
 "V[5] := \'\';\n"
 "loadIRI := DB.DBA.vspx_uri_compose (V);\n"
-"foafGraph := \'http://local.virt/FOAF/\' || cast (rnd (1000) as varchar);\n"
 "S := sprintf (\'sparql load <%s> into graph <%s>\', loadIRI, foafGraph);\n"
 "st := \'00000\';\n"
 "exec (S, st, msg, vector (), 0);\n"
-"if (st <> \'00000\')\n"
-"goto _exit;\n"
-"\n"
-"info := get_certificate_info (9);\n"
+"if (st = \'00000\')\n"
+"{\n"
 "S := sprintf (\' sparql define input:storage \"\" \' ||\n"
 "\' prefix cert: <http://www.w3.org/ns/auth/cert#> \' ||\n"
 "\' prefix rsa: <http://www.w3.org/ns/auth/rsa#> \' ||\n"
@@ -6267,87 +6384,176 @@ static const char *proc111 =
 "foafGraph,\n"
 "localIRI);\n"
 "exec (S, st, msg, vector (), 0, meta, data);\n"
-"if (st <> \'00000\' or length (data) = 0)\n"
-"goto _exit;\n"
-"\n"
+"if (st = \'00000\')\n"
+"{\n"
+"info := get_certificate_info (9);\n"
 "foreach (any _row in data) do\n"
 "{\n"
 "if (_row[0] = cast (info[1] as varchar) and\n"
 "lower (regexp_replace (_row[1], \'[^A-Z0-9a-f]\', \'\', 1, null)) = bin2hex (info[2]))\n"
 "{\n"
-"declare resMode varchar;\n"
-"\n"
-"graph := SIOC.DBA.dav_res_iri (path);\n"
-"\n"
-"resMode := \'\';\n"
-"if (req[2] = ascii (\'1\'))\n"
-"resMode := \'Control\';\n"
-"else if (req[1] = ascii (\'1\'))\n"
-"resMode := \'Write\';\n"
-"else if (req[0] = ascii (\'1\'))\n"
-"resMode := \'Read\';\n"
-"\n"
-"S := sprintf (\' sparql \\n\' ||\n"
-"\' define input:storage \"\" \\n\' ||\n"
-"\' prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \\n\' ||\n"
-"\' prefix foaf: <http://xmlns.com/foaf/0.1/> \\n\' ||\n"
-"\' prefix acl: <http://www.w3.org/ns/auth/acl#> \\n\' ||\n"
-"\' select * \\n\' ||\n"
-"\'   from <%s> \\n\' ||\n"
-"\'  where { \\n\' ||\n"
-"\'          { \\n\' ||\n"
-"\'            ?rule rdf:type acl:Authorization ; \\n\' ||\n"
-"\'                  acl:accessTo <%s> ; \\n\' ||\n"
-"\'                  acl:mode acl:%s ; \\n\' ||\n"
-"\'                  acl:agent <%s>. \\n\' ||\n"
-"\'          } \\n\' ||\n"
-"\'          union \\n\' ||\n"
-"\'          { \\n\' ||\n"
-"\'            ?rule rdf:type acl:Authorization ; \\n\' ||\n"
-"\'                  acl:accessTo <%s> ; \\n\' ||\n"
-"\'                  acl:mode acl:%s ; \\n\' ||\n"
-"\'                  acl:agentClass foaf:Agent. \\n\' ||\n"
-"\'          } \\n\' ||\n"
-"\'          union \\n\' ||\n"
-"\'          { \\n\' ||\n"
-"\'            ?rule rdf:type acl:Authorization ; \\n\' ||\n"
-"\'                  acl:accessTo <%s> ; \\n\' ||\n"
-"\'                  acl:mode acl:%s ; \\n\' ||\n"
-"\'                  acl:agentClass ?group. \\n\' ||\n"
-"\'                  ?group rdf:type foaf:Group ; \\n\' ||\n"
-"\'                  foaf:member <%s>. \\n\' ||\n"
-"\'          } \\n\' ||\n"
-"\'        }\\n\',\n"
-"graph,\n"
-"graph,\n"
-"resMode,\n"
-"foafIRI,\n"
-"graph,\n"
-"resMode,\n"
-"graph,\n"
-"resMode,\n"
-"foafIRI);\n"
-"commit work;\n"
-"exec (S, st, msg, vector (), 0, meta, data);\n"
-"if (st = \'00000\' and length (data))\n"
+"retIRI := foafIRI;\n"
+"goto _break;\n"
+"}\n"
+"}\n"
+"}\n"
+"}\n"
+"_break:;\n"
+"exec (sprintf (\'SPARQL clear graph <%s>\', foafGraph), st, msg, vector (), 0);\n"
+"}\n"
+"_exit:\n"
+"return retIRI;\n"
+"}\n"
+"--src dav_api.sql:1773\n";
+
+static const char *proc113 = 
+"#line 1863 \"[executable]/dav_api.sql\"\n"
+"create function\n"
+"DAV_AUTHENTICATE_SSL (\n"
+"in id any,\n"
+"in what char(1),\n"
+"in path varchar,\n"
+"in req varchar,\n"
+"inout a_uid integer,\n"
+"inout a_gid integer,\n"
+"inout _perms varchar) returns integer\n"
+"{\n"
+"declare rc, M, N, L, I integer;\n"
+"declare graph, grpGraph, foafIRI, reqMode, realMode, IRIs any;\n"
+"declare tmp, T, V, S, st, msg, meta, row, rows any;\n"
+"\n"
+"rc := 0;\n"
+"req := replace (req, \'_\', \'0\');\n"
+"reqMode := vector (req[0]-48, req[1]-48, req[2]-48);\n"
+"realMode := vector (0, 0, 0);\n"
+"IRIs := vector (vector(), vector(), vector());\n"
+"DAV_AUTHENTICATE_SSL_ITEM (id, what, path);\n"
+"if (not DAV_AUTHENTICATE_SSL_CONDITION ())\n"
+"goto _exit;\n"
+"\n"
+"set_user_id (\'dba\');\n"
+"foafIRI := DAV_AUTHENTICATE_SSL_WEBID ();\n"
+"if (isnull (foafIRI))\n"
+"goto _exit;\n"
+"\n"
+"tmp := \'/\';\n"
+"V := vector ();\n"
+"T := split_and_decode (trim (path, \'/\'), 0, \'\\0\\0/\');\n"
+"for (N := 0; N < length (T)-1; N := N + 1)\n"
+"{\n"
+"tmp := tmp || T[N] || \'/\';\n"
+"V := vector_concat (vector (tmp), V);\n"
+"}\n"
+"V := vector_concat (vector (path), V);\n"
+"grpGraph := SIOC.DBA.get_graph () || \'/private/%\';\n"
+"for (N := 0; N < length (V); N := N + 1)\n"
+"{\n"
+"if (N <> 0)\n"
+"{\n"
+"what := \'C\';\n"
+"id := DAV_SEARCH_ID (V[N], what);\n"
+"}\n"
+"if (exists (select 1 from WS.WS.SYS_DAV_PROP where PROP_PARENT_ID = id and PROP_TYPE = what and PROP_NAME = \'virt:aci_meta_n3\'))\n"
+"{\n"
+"tmp := null;\n"
+"graph := WS.WS.DAV_IRI (V[N]);\n"
+"for (\n"
+"sparql\n"
+"define input:storage \"\"\n"
+"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
+"prefix foaf: <http://xmlns.com/foaf/0.1/>\n"
+"prefix acl: <http://www.w3.org/ns/auth/acl#>\n"
+"select ?p1 ?p2 ?p3 ?mode\n"
+"where {\n"
+"{\n"
+"graph `iri(?:graph)`\n"
+"{\n"
+"?rule rdf:type acl:Authorization ;\n"
+"acl:accessTo `iri(?:graph)` ;\n"
+"acl:mode ?mode ;\n"
+"acl:agent `iri(?:foafIRI)` ;\n"
+"acl:agent ?p1 .\n"
+"}\n"
+"}\n"
+"union\n"
+"{\n"
+"graph `iri(?:graph)`\n"
+"{\n"
+"?rule rdf:type acl:Authorization ;\n"
+"acl:accessTo `iri(?:graph)` ;\n"
+"acl:mode ?mode ;\n"
+"acl:agentClass foaf:Agent ;\n"
+"acl:agentClass ?p2 .\n"
+"}\n"
+"}\n"
+"union\n"
+"{\n"
+"graph `iri(?:graph)`\n"
+"{\n"
+"?rule rdf:type acl:Authorization ;\n"
+"acl:accessTo `iri(?:graph)` ;\n"
+"acl:mode ?mode ;\n"
+"acl:agentClass ?p3 .\n"
+"}\n"
+"graph ?g\n"
+"{\n"
+"?p3 rdf:type foaf:Group ;\n"
+"foaf:member `iri(?:foafIRI)` .\n"
+"filter (?g like (?:grpGraph)) .\n"
+"}\n"
+"}\n"
+"}\n"
+"order by ?p3 ?p2 ?p1 ?mode) do\n"
+"{\n"
+"if      (not isnull (p1))\n"
+"I := 0;\n"
+"else if (not isnull (p2))\n"
+"I := 1;\n"
+"else if (not isnull (p3))\n"
+"I := 2;\n"
+"else\n"
+"goto _skip;\n"
+"\n"
+"if (tmp <> coalesce (p1, coalesce (p2, p3)))\n"
+"{\n"
+"tmp := coalesce (p1, coalesce (p2, p3));\n"
+"for (M := 0; M < length (IRIs[I]); M := M + 1)\n"
+"{\n"
+"if (tmp = IRIs[I][M])\n"
+"goto _skip;\n"
+"}\n"
+"}\n"
+"\n"
+"if      (mode like \'%#Read\')\n"
+"realMode[0] := 1;\n"
+"else if (mode like \'%#Write\')\n"
+"realMode[1] := 1;\n"
+"else if (mode like \'%#Control\')\n"
+"realMode[2] := 1;\n"
+"\n"
+"if ((reqMode[0] <= realMode[0]) and (reqMode[1] <= realMode[1]) and (reqMode[2] <= realMode[2]))\n"
 "{\n"
 "a_uid := http_nobody_uid ();\n"
 "a_gid := http_nogroup_gid ();\n"
-"_perms := req || req || \'--\';\n"
 "rc := 1;\n"
-"goto _break;\n"
+"goto _exit;\n"
+"}\n"
+"IRIs[I] := vector_concat (IRIs[I], vector (tmp));\n"
+"\n"
+"_skip:;\n"
 "}\n"
 "}\n"
 "}\n"
-"_break:;\n"
-"exec (sprintf (\'SPARQL clear graph <%s>\', foafGraph), st, msg, vector (), 0);\n"
 "\n"
 "_exit:;\n"
+"_perms := replace (sprintf (\'%d%d%d\', realMode[0], realMode[1], realMode[2]), \'0\', \'_\');\n"
+"\n"
 "return rc;\n"
 "}\n"
-"--src dav_api.sql:1773\n";
+"--src dav_api.sql:1861\n";
 
-static const char *proc112 = 
+static const char *proc114 = 
+"#line 2009 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_COL_CREATE (\n"
 "in path varchar,\n"
@@ -6360,9 +6566,10 @@ static const char *proc112 =
 "return DAV_COL_CREATE_INT (\n"
 "path, permissions, uid, gid, auth_uid, auth_pwd, 1, 1, 1, null, null);\n"
 "}\n"
-"--src dav_api.sql:1915\n";
+"--src dav_api.sql:2007\n";
 
-static const char *proc113 = 
+static const char *proc115 = 
+"#line 2024 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_COL_CREATE_INT (\n"
 "in path varchar,\n"
@@ -6450,9 +6657,10 @@ static const char *proc113 =
 "}\n"
 "return rc;\n"
 "}\n"
-"--src dav_api.sql:1930\n";
+"--src dav_api.sql:2022\n";
 
-static const char *proc114 = 
+static const char *proc116 = 
+"#line 2114 \"[executable]/dav_api.sql\"\n"
 "create procedure DB.DBA.IS_REDIRECT_REF (inout path any)\n"
 "{\n"
 "for (select blob_to_string (PROP_VALUE) redirectRef\n"
@@ -6469,9 +6677,10 @@ static const char *proc114 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src dav_api.sql:2020\n";
+"--src dav_api.sql:2112\n";
 
-static const char *proc115 = 
+static const char *proc117 = 
+"#line 2134 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_RES_UPLOAD (\n"
 "in path varchar,\n"
@@ -6486,9 +6695,10 @@ static const char *proc115 =
 "check_locks := 1;\n"
 "return (DAV_RES_UPLOAD_STRSES_INT (path, content, type, permissions, uid, gid, auth_uid, auth_pwd, 1, null, null, null, null, null, check_locks));\n"
 "}\n"
-"--src dav_api.sql:2040\n";
+"--src dav_api.sql:2132\n";
 
-static const char *proc116 = 
+static const char *proc118 = 
+"#line 2151 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_RES_UPLOAD_STRSES (\n"
 "in path varchar,\n"
@@ -6503,9 +6713,10 @@ static const char *proc116 =
 "check_locks := 1;\n"
 "return (DAV_RES_UPLOAD_STRSES_INT (path, content, type, permissions, uid, gid, auth_uid, auth_pwd, 1, null, null, null, null, null, check_locks));\n"
 "}\n"
-"--src dav_api.sql:2057\n";
+"--src dav_api.sql:2149\n";
 
-static const char *proc117 = 
+static const char *proc119 = 
+"#line 2168 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_RES_UPLOAD_STRSES_INT (\n"
 "in path varchar,\n"
@@ -6525,6 +6736,38 @@ static const char *proc117 =
 "in check_locks any := 1\n"
 ")\n"
 "{\n"
+"declare rc, old_log_mode, new_log_mode any;\n"
+"old_log_mode := log_enable (null);\n"
+"\n"
+"new_log_mode := bit_and (old_log_mode, 1);\n"
+"old_log_mode := log_enable (bit_or (new_log_mode, 4), 1);\n"
+"rc := DAV_RES_UPLOAD_STRSES_INT_INNER (path, content, type, permissions, uid, gid, auth_uname, auth_pwd, extern, cr_time, mod_time, _rowguid, ouid, ogid, check_locks);\n"
+"log_enable (bit_or (old_log_mode, 4), 1);\n"
+"return rc;\n"
+"}\n"
+"--src dav_api.sql:2166\n";
+
+static const char *proc120 = 
+"#line 2198 \"[executable]/dav_api.sql\"\n"
+"create procedure\n"
+"DAV_RES_UPLOAD_STRSES_INT_INNER (\n"
+"in path varchar,\n"
+"inout content any,\n"
+"in type varchar := \'\',\n"
+"in permissions varchar := \'110100000RR\',\n"
+"in uid any := \'dav\',\n"
+"in gid any := \'administrators\',\n"
+"in auth_uname varchar := null,\n"
+"in auth_pwd varchar := null,\n"
+"in extern integer := 1,\n"
+"in cr_time datetime := null,\n"
+"in mod_time datetime := null,\n"
+"in _rowguid varchar := null,\n"
+"in ouid integer := null,\n"
+"in ogid integer := null,\n"
+"in check_locks any := 1\n"
+")\n"
+"{\n"
 "declare auth_uid, pid, puid, pgid, rc, id integer;\n"
 "declare pperms, name varchar;\n"
 "declare par any;\n"
@@ -6840,9 +7083,10 @@ static const char *proc117 =
 "return -43;\n"
 "return -29;\n"
 "}\n"
-"--src dav_api.sql:2074\n";
+"--src dav_api.sql:2196\n";
 
-static const char *proc118 = 
+static const char *proc121 = 
+"#line 2534 \"[executable]/dav_api.sql\"\n"
 "create procedure RDF_SINK_UPLOAD (\n"
 "inout content any,\n"
 "inout type varchar,\n"
@@ -6925,9 +7169,10 @@ static const char *proc118 =
 "SPARQL insert in graph ?:rdf_graph { ?s ?p ?o } where { graph `iri(?:rdf_graph2)` { ?s ?p ?o } };\n"
 "return 1;\n"
 "}\n"
-"--src dav_api.sql:2410\n";
+"--src dav_api.sql:2532\n";
 
-static const char *proc119 = 
+static const char *proc122 = 
+"#line 2618 \"[executable]/dav_api.sql\"\n"
 "create procedure RDF_SINK_DELETE (\n"
 "in path2 any)\n"
 "{\n"
@@ -6959,9 +7204,10 @@ static const char *proc119 =
 "\n"
 "SPARQL clear graph ?:rdf_graph2;\n"
 "}\n"
-"--src dav_api.sql:2494\n";
+"--src dav_api.sql:2616\n";
 
-static const char *proc120 = 
+static const char *proc123 = 
+"#line 2652 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_DELETE (\n"
 "in path varchar,\n"
@@ -6972,9 +7218,10 @@ static const char *proc120 =
 "{\n"
 "return DAV_DELETE_INT (path, silent, auth_uname, auth_pwd);\n"
 "}\n"
-"--src dav_api.sql:2528\n";
+"--src dav_api.sql:2650\n";
 
-static const char *proc121 = 
+static const char *proc124 = 
+"#line 2664 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_DELETE_INT (\n"
 "in path varchar,\n"
@@ -7058,9 +7305,10 @@ static const char *proc121 =
 "disabled_home:\n"
 "return -43;\n"
 "}\n"
-"--src dav_api.sql:2540\n";
+"--src dav_api.sql:2662\n";
 
-static const char *proc122 = 
+static const char *proc125 = 
+"#line 2750 \"[executable]/dav_api.sql\"\n"
 "create function DAV_TAG_LIST (in id any, in st char (1), in uid_list any) returns any\n"
 "{\n"
 "if (isarray (id))\n"
@@ -7077,9 +7325,10 @@ static const char *proc122 =
 "else\n"
 "return (select VECTOR_AGG (vector (DT_U_ID, DT_TAGS)) from Ws.WS.SYS_DAV_TAG where DT_RES_ID = id and position (DT_U_ID, uid_list));\n"
 "}\n"
-"--src dav_api.sql:2626\n";
+"--src dav_api.sql:2748\n";
 
-static const char *proc123 = 
+static const char *proc126 = 
+"#line 2768 \"[executable]/dav_api.sql\"\n"
 "create function DAV_TAG_SET (in id any, in st char (1), in uid integer, in tags varchar) returns integer\n"
 "{\n"
 "if (not exists (select 1 from WS.WS.SYS_DAV_USER where U_ID = uid))\n"
@@ -7097,9 +7346,10 @@ static const char *proc123 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src dav_api.sql:2644\n";
+"--src dav_api.sql:2766\n";
 
-static const char *proc124 = 
+static const char *proc127 = 
+"#line 2789 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_COPY (in path varchar,\n"
 "in destination varchar,\n"
@@ -7112,9 +7362,10 @@ static const char *proc124 =
 "{\n"
 "return DAV_COPY_INT (path, destination, overwrite, permissions, uid, gid, auth_uname, auth_pwd, 1);\n"
 "}\n"
-"--src dav_api.sql:2665\n";
+"--src dav_api.sql:2787\n";
 
-static const char *proc125 = 
+static const char *proc128 = 
+"#line 2804 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_COPY_INT (in path varchar,\n"
 "in destination varchar,\n"
@@ -7377,9 +7628,10 @@ static const char *proc125 =
 "disabled_home:\n"
 "return -43;\n"
 "}\n"
-"--src dav_api.sql:2680\n";
+"--src dav_api.sql:2802\n";
 
-static const char *proc126 = 
+static const char *proc129 = 
+"#line 3070 \"[executable]/dav_api.sql\"\n"
 "create function DAV_COPY_SUBTREE (in src any, in dst any, in sar any,\n"
 "in dar any, in overwrite integer,\n"
 "in ouid integer := null, in ogid integer := null,\n"
@@ -7439,9 +7691,10 @@ static const char *proc126 =
 "vectorbld_final (ret);\n"
 "return ret;\n"
 "}\n"
-"--src dav_api.sql:2946\n";
+"--src dav_api.sql:3068\n";
 
-static const char *proc127 = 
+static const char *proc130 = 
+"#line 3133 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_MOVE (in path varchar,\n"
 "in destination varchar,\n"
@@ -7451,9 +7704,10 @@ static const char *proc127 =
 "{\n"
 "return DAV_MOVE_INT (path, destination, overwrite, auth_uname, auth_pwd, 1);\n"
 "}\n"
-"--src dav_api.sql:3009\n";
+"--src dav_api.sql:3131\n";
 
-static const char *proc128 = 
+static const char *proc131 = 
+"#line 3145 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_MOVE_INT (in path varchar,\n"
 "in destination varchar,\n"
@@ -7698,9 +7952,10 @@ static const char *proc128 =
 "disabled_home:\n"
 "return -43;\n"
 "}\n"
-"--src dav_api.sql:3021\n";
+"--src dav_api.sql:3143\n";
 
-static const char *proc129 = 
+static const char *proc132 = 
+"#line 3392 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_GET_OWNER (in id any, in st char(1)) returns integer\n"
 "{\n"
@@ -7718,9 +7973,10 @@ static const char *proc129 =
 "return coalesce ((select RES_OWNER from WS.WS.SYS_DAV_RES where RES_ID = id), -1);\n"
 "return -14;\n"
 "}\n"
-"--src dav_api.sql:3268\n";
+"--src dav_api.sql:3390\n";
 
-static const char *proc130 = 
+static const char *proc133 = 
+"#line 3412 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_PREPARE_PROP_WRITE (\n"
 "in path varchar,\n"
@@ -7799,9 +8055,10 @@ static const char *proc130 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src dav_api.sql:3288\n";
+"--src dav_api.sql:3410\n";
 
-static const char *proc131 = 
+static const char *proc134 = 
+"#line 3494 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_PROP_SET (\n"
 "in path varchar,\n"
@@ -7813,9 +8070,10 @@ static const char *proc131 =
 "{\n"
 "return DAV_PROP_SET_INT (path, propname, propvalue, auth_uname, auth_pwd, 1, 1, overwrite);\n"
 "}\n"
-"--src dav_api.sql:3370\n";
+"--src dav_api.sql:3492\n";
 
-static const char *proc132 = 
+static const char *proc135 = 
+"#line 3507 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_PROP_SET_INT (\n"
 "in path varchar,\n"
@@ -7845,9 +8103,10 @@ static const char *proc132 =
 "}\n"
 "return DAV_PROP_SET_RAW (id, st, propname, propvalue, overwrite, auth_uid, locked, auto_version);\n"
 "}\n"
-"--src dav_api.sql:3383\n";
+"--src dav_api.sql:3505\n";
 
-static const char *proc133 = 
+static const char *proc136 = 
+"#line 3539 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_PROP_SET_RAW (\n"
 "inout id integer,\n"
@@ -7860,6 +8119,31 @@ static const char *proc133 =
 "in auto_version varchar:=NULL\n"
 ") returns integer\n"
 "{\n"
+"declare rc, old_log_mode, new_log_mode any;\n"
+"old_log_mode := log_enable (null);\n"
+"\n"
+"new_log_mode := bit_and (old_log_mode, 1);\n"
+"old_log_mode := log_enable (bit_or (new_log_mode, 4), 1);\n"
+"rc := DAV_PROP_SET_RAW_INNER (id, st, propname, propvalue, overwrite, auth_uid, locked, auto_version);\n"
+"log_enable (bit_or (old_log_mode, 4), 1);\n"
+"return rc;\n"
+"}\n"
+"--src dav_api.sql:3537\n";
+
+static const char *proc137 = 
+"#line 3562 \"[executable]/dav_api.sql\"\n"
+"create function\n"
+"DAV_PROP_SET_RAW_INNER (\n"
+"inout id integer,\n"
+"in st char(0),\n"
+"inout propname varchar,\n"
+"inout propvalue any,\n"
+"in overwrite integer,\n"
+"in auth_uid integer,\n"
+"in locked int:=0,\n"
+"in auto_version varchar:=NULL\n"
+") returns integer\n"
+"{\n"
 "declare pid integer;\n"
 "declare resv any;\n"
 "declare can_patch_access integer;\n"
@@ -8053,9 +8337,10 @@ static const char *proc133 =
 "}\n"
 "return pid;\n"
 "}\n"
-"--src dav_api.sql:3415\n";
+"--src dav_api.sql:3560\n";
 
-static const char *proc134 = 
+static const char *proc138 = 
+"#line 3771 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_PROP_REMOVE (\n"
 "in path varchar,\n"
@@ -8065,9 +8350,10 @@ static const char *proc134 =
 "{\n"
 "return DAV_PROP_REMOVE_INT (path, propname, auth_uname, auth_pwd);\n"
 "}\n"
-"--src dav_api.sql:3624\n";
+"--src dav_api.sql:3769\n";
 
-static const char *proc135 = 
+static const char *proc139 = 
+"#line 3783 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_PROP_REMOVE_INT (\n"
 "in path varchar,\n"
@@ -8096,9 +8382,10 @@ static const char *proc135 =
 "}\n"
 "return DAV_PROP_REMOVE_RAW (id, st, propname, ignore_if_missing, auth_uid, locked, auto_version);\n"
 "}\n"
-"--src dav_api.sql:3636\n";
+"--src dav_api.sql:3781\n";
 
-static const char *proc136 = 
+static const char *proc140 = 
+"#line 3814 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_PROP_REMOVE_RAW (\n"
 "inout id integer,\n"
@@ -8186,9 +8473,10 @@ static const char *proc136 =
 "else\n"
 "return -11;\n"
 "}\n"
-"--src dav_api.sql:3667\n";
+"--src dav_api.sql:3812\n";
 
-static const char *proc137 = 
+static const char *proc141 = 
+"#line 3905 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_PROP_GET (\n"
 "in path varchar,\n"
@@ -8203,9 +8491,10 @@ static const char *proc137 =
 "st := \'R\';\n"
 "return DAV_PROP_GET_INT (DAV_SEARCH_ID (path, st), st, propname, 1, auth_uname, auth_pwd);\n"
 "}\n"
-"--src dav_api.sql:3758\n";
+"--src dav_api.sql:3903\n";
 
-static const char *proc138 = 
+static const char *proc142 = 
+"#line 3922 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_PROP_GET_INT (\n"
 "in id any,\n"
@@ -8408,9 +8697,10 @@ static const char *proc138 =
 "no_prop:\n"
 "return -11;\n"
 "}\n"
-"--src dav_api.sql:3775\n";
+"--src dav_api.sql:3920\n";
 
-static const char *proc139 = 
+static const char *proc143 = 
+"#line 4128 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_PROP_LIST (\n"
 "in path varchar,\n"
@@ -8425,9 +8715,10 @@ static const char *proc139 =
 "st := \'R\';\n"
 "return DAV_PROP_LIST_INT (DAV_SEARCH_ID (path, st), st, propmask, 1, auth_uname, auth_pwd);\n"
 "}\n"
-"--src dav_api.sql:3981\n";
+"--src dav_api.sql:4126\n";
 
-static const char *proc140 = 
+static const char *proc144 = 
+"#line 4144 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_PROP_LIST_INT (\n"
 "in id any,\n"
@@ -8464,9 +8755,10 @@ static const char *proc140 =
 "}\n"
 "return ret;\n"
 "}\n"
-"--src dav_api.sql:3997\n";
+"--src dav_api.sql:4142\n";
 
-static const char *proc141 = 
+static const char *proc145 = 
+"#line 4183 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_MAKE_DIR (in path any, in own integer, in grp integer, in perms varchar)\n"
 "{\n"
@@ -8503,9 +8795,10 @@ static const char *proc141 =
 "}\n"
 "return col;\n"
 "}\n"
-"--src dav_api.sql:4036\n";
+"--src dav_api.sql:4181\n";
 
-static const char *proc142 = 
+static const char *proc146 = 
+"#line 4221 \"[executable]/dav_api.sql\"\n"
 "create procedure DAV_CHECK_PERM (in perm varchar, in req varchar, in oid integer,\n"
 "in ogid integer, in pgid integer, in puid integer)\n"
 "{\n"
@@ -8523,9 +8816,10 @@ static const char *proc142 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src dav_api.sql:4074\n";
+"--src dav_api.sql:4219\n";
 
-static const char *proc143 = 
+static const char *proc147 = 
+"#line 4242 \"[executable]/dav_api.sql\"\n"
 " create procedure DAV_CHECK_USER (in uname varchar, in pwd any := null)\n"
 "{\n"
 "declare rc int;\n"
@@ -8545,9 +8839,10 @@ static const char *proc143 =
 "}\n"
 "return rc;\n"
 "}\n"
-"--src dav_api.sql:4095\n";
+"--src dav_api.sql:4240\n";
 
-static const char *proc144 = 
+static const char *proc148 = 
+"#line 4265 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_RES_CONTENT (\n"
 "in path varchar,\n"
@@ -8557,9 +8852,10 @@ static const char *proc144 =
 "{\n"
 "return DAV_RES_CONTENT_INT (DAV_SEARCH_ID (path, \'R\'), content, type, 0, 1, auth_uname, auth_pwd);\n"
 "}\n"
-"--src dav_api.sql:4118\n";
+"--src dav_api.sql:4263\n";
 
-static const char *proc145 = 
+static const char *proc149 = 
+"#line 4278 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_RES_CONTENT_STRSES (\n"
 "in path varchar,\n"
@@ -8569,9 +8865,10 @@ static const char *proc145 =
 "{\n"
 "return DAV_RES_CONTENT_INT (DAV_SEARCH_ID (path, \'R\'), content, type, 1, 1, auth_uname, auth_pwd);\n"
 "}\n"
-"--src dav_api.sql:4131\n";
+"--src dav_api.sql:4276\n";
 
-static const char *proc146 = 
+static const char *proc150 = 
+"#line 4289 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_RES_CONTENT_INT (\n"
 "in id any,\n"
@@ -8621,9 +8918,10 @@ static const char *proc146 =
 "}\n"
 "return rc;\n"
 "}\n"
-"--src dav_api.sql:4142\n";
+"--src dav_api.sql:4287\n";
 
-static const char *proc147 = 
+static const char *proc151 = 
+"#line 4340 \"[executable]/dav_api.sql\"\n"
 "create function DAV_COL_IS_ANCESTOR_OF (in a_id integer, in d_id integer) returns integer\n"
 "{\n"
 "declare p_id integer;\n"
@@ -8639,9 +8937,10 @@ static const char *proc147 =
 "d_id := p_id;\n"
 "goto again;\n"
 "}\n"
-"--src dav_api.sql:4193\n";
+"--src dav_api.sql:4338\n";
 
-static const char *proc148 = 
+static const char *proc152 = 
+"#line 4357 \"[executable]/dav_api.sql\"\n"
 "create function DAV_COL_PATH_BOUNDARY (in path varchar) returns varchar\n"
 "{\n"
 "declare res varchar;\n"
@@ -8653,19 +8952,62 @@ static const char *proc148 =
 "res := res || \'\\377\\377\\377\\377\';\n"
 "return res;\n"
 "}\n"
-"--src dav_api.sql:4210\n";
+"--src dav_api.sql:4355\n";
 
 static const char *trig7 = 
-"create trigger SYS_DAV_RES_WAC_U after update on WS.WS.SYS_DAV_RES order 100 referencing new as N, old as O\n"
+"#line 4372 \"[executable]/dav_api.sql\"\n"
+"create trigger SYS_DAV_COL_WAC_U after update on WS.WS.SYS_DAV_COL order 100 referencing new as N, old as O\n"
 "{\n"
 "declare aciContent, oldPath, newPath, update_acl any;\n"
 "\n"
 "if (connection_get (\'dav_acl_sync\') = 1)\n"
 "return;\n"
-"if (N.RES_NAME like \'%,acl\')\n"
-"{\n"
-"declare rid int;\n"
-"oldPath := WS.WS.COL_PATH (O.RES_COL) || O.RES_NAME;\n"
+"\n"
+"if ((O.COL_NAME = N.COL_NAME) and (O.COL_PARENT = N.COL_PARENT))\n"
+"return;\n"
+"\n"
+"aciContent := (select PROP_VALUE from WS.WS.SYS_DAV_PROP where PROP_PARENT_ID = N.COL_ID and PROP_TYPE = \'C\' and PROP_NAME = \'virt:aci_meta_n3\');\n"
+"if (aciContent is null)\n"
+"return;\n"
+"\n"
+"oldPath := WS.WS.COL_PATH (O.COL_PARENT) || O.COL_NAME || \'/\';\n"
+"newPath := WS.WS.COL_PATH (N.COL_PARENT) || N.COL_NAME || \'/\';\n"
+"update_acl := 1;\n"
+"\n"
+"WS.WS.WAC_DELETE (oldPath, update_acl);\n"
+"WS.WS.WAC_INSERT (newPath, aciContent, N.COL_OWNER, N.COL_GROUP, update_acl);\n"
+"}\n"
+"--src dav_api.sql:4370\n";
+
+static const char *trig8 = 
+"#line 4395 \"[executable]/dav_api.sql\"\n"
+"create trigger SYS_DAV_COL_WAC_D after delete on WS.WS.SYS_DAV_COL order 100 referencing old as O\n"
+"{\n"
+"declare update_acl integer;\n"
+"declare path varchar;\n"
+"\n"
+"if (connection_get (\'dav_acl_sync\') = 1)\n"
+"return;\n"
+"\n"
+"path := WS.WS.COL_PATH (O.COL_ID);\n"
+"update_acl := 1;\n"
+"\n"
+"WS.WS.WAC_DELETE (path, update_acl);\n"
+"}\n"
+"--src dav_api.sql:4393\n";
+
+static const char *trig9 = 
+"#line 4410 \"[executable]/dav_api.sql\"\n"
+"create trigger SYS_DAV_RES_WAC_U after update on WS.WS.SYS_DAV_RES order 100 referencing new as N, old as O\n"
+"{\n"
+"declare aciContent, oldPath, newPath, update_acl any;\n"
+"\n"
+"if (connection_get (\'dav_acl_sync\') = 1)\n"
+"return;\n"
+"if (N.RES_NAME like \'%,acl\')\n"
+"{\n"
+"declare rid int;\n"
+"oldPath := WS.WS.COL_PATH (O.RES_COL) || O.RES_NAME;\n"
 "newPath := WS.WS.COL_PATH (N.RES_COL) || N.RES_NAME;\n"
 "oldPath := regexp_replace (oldPath, \',acl\\x24\', \'\');\n"
 "newPath := regexp_replace (newPath, \',acl\\x24\', \'\');\n"
@@ -8690,9 +9032,10 @@ static const char *trig7 =
 "WS.WS.WAC_DELETE (oldPath, update_acl);\n"
 "WS.WS.WAC_INSERT (newPath, aciContent, N.RES_OWNER, N.RES_GROUP, update_acl);\n"
 "}\n"
-"--src dav_api.sql:4225\n";
+"--src dav_api.sql:4408\n";
 
-static const char *trig8 = 
+static const char *trig10 = 
+"#line 4446 \"[executable]/dav_api.sql\"\n"
 "create trigger SYS_DAV_RES_WAC_D after delete on WS.WS.SYS_DAV_RES order 100 referencing old as O\n"
 "{\n"
 "declare update_acl int;\n"
@@ -8711,361 +9054,382 @@ static const char *trig8 =
 "}\n"
 "WS.WS.WAC_DELETE (path, update_acl);\n"
 "}\n"
-"--src dav_api.sql:4261\n";
+"--src dav_api.sql:4444\n";
 
-static const char *trig9 = 
+static const char *trig11 = 
+"#line 4466 \"[executable]/dav_api.sql\"\n"
 "create trigger SYS_DAV_PROP_WAC_I after insert on WS.WS.SYS_DAV_PROP order 100 referencing new as N\n"
 "{\n"
-"if ((N.PROP_TYPE <> \'R\') or (N.PROP_NAME <> \'virt:aci_meta_n3\'))\n"
+"if (N.PROP_NAME <> \'virt:aci_meta_n3\')\n"
 "return;\n"
 "\n"
-"declare resPath any;\n"
-"for select RES_FULL_PATH, RES_OWNER, RES_GROUP from WS.WS.SYS_DAV_RES where RES_ID = N.PROP_PARENT_ID do\n"
-"WS.WS.WAC_INSERT (RES_FULL_PATH, N.PROP_VALUE, RES_OWNER, RES_GROUP, 1);\n"
+"declare _path, _owner, _group any;\n"
+"declare exit handler for not found { return; };\n"
+"\n"
+"if (N.PROP_TYPE = \'R\')\n"
+"{\n"
+"select RES_FULL_PATH, RES_OWNER, RES_GROUP\n"
+"into _path, _owner, _group\n"
+"from WS.WS.SYS_DAV_RES\n"
+"where RES_ID = N.PROP_PARENT_ID;\n"
+"} else {\n"
+"select DAV_SEARCH_PATH (COL_ID, N.PROP_TYPE), COL_OWNER, COL_GROUP\n"
+"into _path, _owner, _group\n"
+"from WS.WS.SYS_DAV_COL\n"
+"where COL_ID = N.PROP_PARENT_ID;\n"
 "}\n"
-"--src dav_api.sql:4281\n";
+"WS.WS.WAC_INSERT (_path, N.PROP_VALUE, _owner, _group, 1);\n"
+"}\n"
+"--src dav_api.sql:4464\n";
 
-static const char *trig10 = 
-"create trigger SYS_DAV_PROP_WAC_U after update on WS.WS.SYS_DAV_PROP order 100 referencing new as N, old as O\n"
+static const char *trig12 = 
+"#line 4490 \"[executable]/dav_api.sql\"\n"
+"create trigger SYS_DAV_PROP_WAC_U after update (PROP_NAME, PROP_VALUE) on WS.WS.SYS_DAV_PROP order 100 referencing new as N, old as O\n"
 "{\n"
-"if ((N.PROP_TYPE <> \'R\') or (N.PROP_NAME <> \'virt:aci_meta_n3\'))\n"
+"if (N.PROP_NAME <> \'virt:aci_meta_n3\')\n"
 "return;\n"
 "\n"
-"declare resPath any;\n"
-"for select RES_FULL_PATH, RES_OWNER, RES_GROUP from WS.WS.SYS_DAV_RES where RES_ID = N.PROP_PARENT_ID do\n"
+"declare _path, _owner, _group any;\n"
+"declare exit handler for not found { return; };\n"
+"\n"
+"if (N.PROP_TYPE = \'R\')\n"
 "{\n"
-"WS.WS.WAC_DELETE (RES_FULL_PATH, 1);\n"
-"WS.WS.WAC_INSERT (RES_FULL_PATH, N.PROP_VALUE, RES_OWNER, RES_GROUP, 1);\n"
+"select RES_FULL_PATH, RES_OWNER, RES_GROUP\n"
+"into _path, _owner, _group\n"
+"from WS.WS.SYS_DAV_RES\n"
+"where RES_ID = N.PROP_PARENT_ID;\n"
+"} else {\n"
+"select DAV_SEARCH_PATH (COL_ID, N.PROP_TYPE), COL_OWNER, COL_GROUP\n"
+"into _path, _owner, _group\n"
+"from WS.WS.SYS_DAV_COL\n"
+"where COL_ID = N.PROP_PARENT_ID;\n"
 "}\n"
+"WS.WS.WAC_DELETE (_path, 1);\n"
+"WS.WS.WAC_INSERT (_path, N.PROP_VALUE, _owner, _group, 1);\n"
 "}\n"
-"--src dav_api.sql:4292\n";
+"--src dav_api.sql:4488\n";
 
-static const char *trig11 = 
+static const char *trig13 = 
+"#line 4515 \"[executable]/dav_api.sql\"\n"
 "create trigger SYS_DAV_PROP_WAC_D after delete on WS.WS.SYS_DAV_PROP order 100 referencing old as O\n"
 "{\n"
-"if ((O.PROP_TYPE <> \'R\') or (O.PROP_NAME <> \'virt:aci_meta_n3\'))\n"
+"if (O.PROP_NAME <> \'virt:aci_meta_n3\')\n"
 "return;\n"
 "\n"
-"declare resPath any;\n"
-"for select RES_FULL_PATH from WS.WS.SYS_DAV_RES where RES_ID = O.PROP_PARENT_ID do\n"
-"WS.WS.WAC_DELETE (RES_FULL_PATH, 1);\n"
+"declare _path any;\n"
+"declare exit handler for not found { return; };\n"
+"\n"
+"if (O.PROP_TYPE = \'R\')\n"
+"{\n"
+"select RES_FULL_PATH\n"
+"into _path\n"
+"from WS.WS.SYS_DAV_RES\n"
+"where RES_ID = O.PROP_PARENT_ID;\n"
+"} else {\n"
+"select DAV_SEARCH_PATH (COL_ID, O.PROP_TYPE)\n"
+"into _path\n"
+"from WS.WS.SYS_DAV_COL\n"
+"where COL_ID = O.PROP_PARENT_ID;\n"
 "}\n"
-"--src dav_api.sql:4306\n";
+"WS.WS.WAC_DELETE (_path, 1);\n"
+"}\n"
+"--src dav_api.sql:4513\n";
 
-static const char *proc149 = 
-"create procedure WS.WS.WAC_INSERT (in resPath varchar, in aciContent any, in uid int, in gid int, in update_acl int)\n"
+static const char *proc153 = 
+"#line 4539 \"[executable]/dav_api.sql\"\n"
+"create procedure WS.WS.WAC_INSERT (\n"
+"in path varchar,\n"
+"in aciContent any,\n"
+"in uid integer,\n"
+"in gid integer,\n"
+"in update_acl integer)\n"
 "{\n"
-"declare graph, waGraph varchar;\n"
 "\n"
-"if (\n"
-"length (aciContent) = 0 or\n"
-"__proc_exists (fix_identifier_case (\'sioc.DBA.dav_res_iri\')) is null or\n"
-"__proc_exists (fix_identifier_case (\'sioc.DBA.waGraph\')) is null\n"
-")\n"
-"return;\n"
+"declare graph varchar;\n"
 "\n"
-"graph := SIOC.DBA.dav_res_iri (resPath);\n"
-"waGraph := sprintf (\'http://%s/webdav/webaccess\', SIOC.DBA.get_cname ());\n"
-"{\n"
-"declare continue handler for SQLSTATE \'*\'\n"
-"{\n"
-"dbg_obj_print(\'\', __SQL_STATE, __SQL_MESSAGE);\n"
-"return;\n"
-"};\n"
+"graph := WS.WS.DAV_IRI (path);\n"
 "aciContent := cast (blob_to_string (aciContent) as varchar);\n"
 "if (update_acl)\n"
 "{\n"
 "connection_set (\'dav_acl_sync\', 1);\n"
-"DAV_RES_UPLOAD_STRSES_INT (resPath || \',acl\', aciContent, \'text/n3\', \'110100000RR\', uid, gid, null, null, 0);\n"
+"DAV_RES_UPLOAD_STRSES_INT (rtrim (path, \'/\') || \',acl\', aciContent, \'text/n3\', \'110100000RR\', uid, gid, null, null, 0);\n"
 "connection_set (\'dav_acl_sync\', null);\n"
 "}\n"
 "DB.DBA.TTLP (aciContent, graph, graph);\n"
-"DB.DBA.RDF_GRAPH_GROUP_CREATE (waGraph, 1);\n"
-"DB.DBA.RDF_GRAPH_GROUP_INS (waGraph, graph);\n"
-"}\n"
 "}\n"
-"--src dav_api.sql:4317\n";
+"--src dav_api.sql:4537\n";
 
-static const char *proc150 = 
-"create procedure WS.WS.WAC_DELETE (in resPath varchar, in update_acl int)\n"
+static const char *proc154 = 
+"#line 4561 \"[executable]/dav_api.sql\"\n"
+"create procedure WS.WS.WAC_DELETE (\n"
+"in path varchar,\n"
+"in update_acl integer)\n"
 "{\n"
-"declare graph, waGraph, st, msg varchar;\n"
 "\n"
-"if (__proc_exists (fix_identifier_case (\'sioc.DBA.dav_res_iri\')) is null or\n"
-"__proc_exists (fix_identifier_case (\'sioc.DBA.waGraph\')) is null\n"
-")\n"
-"return;\n"
+"declare graph, st, msg varchar;\n"
 "\n"
+"graph := WS.WS.DAV_IRI (path);\n"
 "if (update_acl)\n"
 "{\n"
 "connection_set (\'dav_acl_sync\', 1);\n"
-"DAV_DELETE_INT (resPath || \',acl\', 1, null, null, 0, 0);\n"
+"DAV_DELETE_INT (rtrim (path, \'/\') || \',acl\', 1, null, null, 0, 0);\n"
 "connection_set (\'dav_acl_sync\', null);\n"
 "}\n"
-"graph := SIOC.DBA.dav_res_iri (resPath);\n"
-"waGraph := sprintf (\'http://%s/webdav/webaccess\', SIOC.DBA.get_cname ());\n"
-"exec (sprintf (\'sparql clear graph <%S>\', graph), st, msg);\n"
-"DB.DBA.RDF_GRAPH_GROUP_DEL (waGraph, graph);\n"
+"exec (sprintf (\'sparql clear graph <%s>\', graph), st, msg);\n"
 "}\n"
-"--src dav_api.sql:4350\n";
+"--src dav_api.sql:4559\n";
 
-static const char *trig12 = 
-"create trigger SYS_DAV_COL_ACL_I after insert on WS.WS.SYS_DAV_COL order 10 referencing new as NC\n"
+static const char *proc155 = 
+"#line 4579 \"[executable]/dav_api.sql\"\n"
+"create procedure WS.WS.DAV_IRI (\n"
+"in path varchar)\n"
 "{\n"
-"declare\n"
-"N,\n"
-"colID,\n"
-"parentID integer;\n"
-"declare\n"
-"aAcl,\n"
-"aParentAcl any;\n"
+"declare S, host any;\n"
 "\n"
-"aAcl := WS.WS.ACL_PARSE(NC.COL_ACL, \'01\', 0);\n"
-"N := 0;\n"
-"while (N < length(aAcl))\n"
+"S := string_output ();\n"
+"http_dav_url (path, null, S);\n"
+"S := string_output_string (S);\n"
+"\n"
+"host := cfg_item_value (virtuoso_ini_path (), \'URIQA\', \'DefaultHost\');\n"
+"if (host is null)\n"
 "{\n"
-"insert replacing\n"
-"WS.WS.SYS_DAV_ACL_INVERSE(AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)\n"
-"values(either(equ(aAcl[N][1],0), \'R\', \'G\'), NC.COL_ID, \'C\', aAcl[N][0]);\n"
+"host := sys_stat (\'st_host_name\');\n"
+"if (server_http_port () <> \'80\')\n"
+"host := host ||\':\'|| server_http_port ();\n"
+"}\n"
 "\n"
-"N := N + 1;\n"
+"return sprintf (\'http://%s%s\', host, S);\n"
 "}\n"
+"--src dav_api.sql:4577\n";
+
+static const char *trig14 = 
+"#line 4601 \"[executable]/dav_api.sql\"\n"
+"create trigger SYS_DAV_COL_ACL_I after insert on WS.WS.SYS_DAV_COL order 9 referencing new as NC\n"
+"{\n"
+"declare N, colID, parentID integer;\n"
+"declare aAcl, aParentAcl any;\n"
 "\n"
-"colID := NC.COL_ID;\n"
-"parentID := NC.COL_PARENT;\n"
-"aAcl := WS.WS.ACL_PARSE(NC.COL_ACL, \'012\', 0);\n"
-"aParentAcl := (select WS.WS.ACL_PARSE(COL_ACL, \'123\', 0) from WS.WS.SYS_DAV_COL c where c.COL_ID = parentID);\n"
-"if (not isnull(aParentAcl))\n"
+"\n"
+"aAcl := WS.WS.ACL_PARSE(NC.COL_ACL, \'01\', 0);\n"
+"foreach (any acl in aAcl) do\n"
 "{\n"
-"set triggers off;\n"
-"update\n"
-"WS.WS.SYS_DAV_COL c\n"
-"set\n"
-"COL_ACL = WS.WS.ACL_COMPOSE(vector_concat(aAcl, WS.WS.ACL_MAKE_INHERITED(aParentAcl)))\n"
-"where\n"
-"c.COL_ID = colID;\n"
+"insert replacing WS.WS.SYS_DAV_ACL_INVERSE (AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)\n"
+"values (either(equ(acl[1],0), \'R\', \'G\'), NC.COL_ID, \'C\', acl[0]);\n"
 "}\n"
 "\n"
+"aParentAcl := (select WS.WS.ACL_PARSE (COL_ACL, \'123\', 0) from WS.WS.SYS_DAV_COL c where c.COL_ID = NC.COL_PARENT);\n"
+"if (isnull(aParentAcl))\n"
+"return;\n"
+"\n"
+"aAcl := WS.WS.ACL_PARSE(NC.COL_ACL, \'012\', 0);\n"
+"set triggers off;\n"
+"update WS.WS.SYS_DAV_COL\n"
+"set COL_ACL = WS.WS.ACL_COMPOSE (vector_concat (aAcl, WS.WS.ACL_MAKE_INHERITED(aParentAcl)))\n"
+"where COL_ID = NC.COL_ID;\n"
+"\n"
 "}\n"
-"--src dav_api.sql:4373\n";
+"--src dav_api.sql:4599\n";
 
-static const char *proc151 = 
-"create function WS.WS.ACL_CONTAINS_GRANTEE_AND_FLAG (inout acl any, in grantee integer, in flag char(1)) returns integer\n"
+static const char *proc156 = 
+"#line 4627 \"[executable]/dav_api.sql\"\n"
+"create function WS.WS.ACL_CONTAINS_GRANTEE_AND_FLAG (inout aAcl any, in grantee integer, in flag char(1)) returns integer\n"
 "{\n"
-"declare N integer;\n"
-"N := length (acl);\n"
-"while (N > 0)\n"
+"foreach (any acl in aAcl) do\n"
 "{\n"
-"N := N - 1;\n"
-"if ((grantee = acl[N][0]) and (flag = either(equ(acl[N][1],0), \'R\', \'G\')))\n"
+"if ((grantee = acl[0]) and (flag = either(equ(acl[1],0), \'R\', \'G\')))\n"
 "return 1;\n"
 "}\n"
 "return 0;\n"
 "}\n"
-"--src dav_api.sql:4412\n";
+"--src dav_api.sql:4625\n";
 
-static const char *trig13 = 
-"create trigger SYS_DAV_COL_ACL_U after update on WS.WS.SYS_DAV_COL order 10 referencing new as NC\n"
+static const char *trig15 = 
+"#line 4638 \"[executable]/dav_api.sql\"\n"
+"create trigger SYS_DAV_COL_ACL_U after update (COL_ACL) on WS.WS.SYS_DAV_COL order 9 referencing new as N, old as O\n"
 "{\n"
-"declare\n"
-"N,\n"
-"aiGrantee integer;\n"
-"declare\n"
-"aiFlag varchar;\n"
-"declare\n"
-"aAcl any;\n"
+"declare aAcl, aLog any;\n"
 "\n"
-"aAcl := WS.WS.ACL_PARSE(NC.COL_ACL, \'01\', 0);\n"
 "\n"
-"delete from WS.WS.SYS_DAV_ACL_INVERSE\n"
-"where AI_PARENT_ID = NC.COL_ID\n"
+"aAcl := WS.WS.ACL_PARSE (O.COL_ACL, \'01\', 0);\n"
+"delete\n"
+"from WS.WS.SYS_DAV_ACL_INVERSE\n"
+"where AI_PARENT_ID = O.COL_ID\n"
 "and AI_PARENT_TYPE = \'C\'\n"
 "and not WS.WS.ACL_CONTAINS_GRANTEE_AND_FLAG (aAcl, AI_GRANTEE_ID, AI_FLAG);\n"
 "\n"
-"N := 0;\n"
-"while (N < length(aAcl))\n"
+"aAcl := WS.WS.ACL_PARSE (N.COL_ACL, \'01\', 0);\n"
+"foreach (any acl in aAcl) do\n"
 "{\n"
-"insert replacing\n"
-"WS.WS.SYS_DAV_ACL_INVERSE(AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)\n"
-"values(either(equ(aAcl[N][1],0), \'R\', \'G\'), NC.COL_ID, \'C\', aAcl[N][0]);\n"
-"N := N + 1;\n"
+"insert replacing WS.WS.SYS_DAV_ACL_INVERSE (AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)\n"
+"values (either (equ (acl[1], 0), \'R\', \'G\'), N.COL_ID, \'C\', acl[0]);\n"
 "}\n"
 "\n"
+"declare exit handler for sqlstate \'*\'\n"
+"{\n"
+"log_enable (aLog, 1);\n"
+"resignal;\n"
+"};\n"
+"\n"
 "set triggers off;\n"
-"WS.WS.ACL_UPDATE (COL_ID, WS.WS.ACL_PARSE(NC.COL_ACL, \'123\', 0));\n"
 "\n"
+"aLog := log_enable (0, 1);\n"
+"WS.WS.ACL_UPDATE (N.COL_ID, WS.WS.ACL_PARSE (N.COL_ACL, \'123\', 0));\n"
+"log_enable (aLog, 1);\n"
+"log_text (\'WS.WS.ACL_UPDATE (?, ?)\', N.COL_ID, WS.WS.ACL_PARSE (N.COL_ACL, \'123\', 0));\n"
 "}\n"
-"--src dav_api.sql:4426\n";
+"--src dav_api.sql:4636\n";
 
-static const char *trig14 = 
-"create trigger SYS_DAV_COL_ACL_D after delete on WS.WS.SYS_DAV_COL order 10\n"
+static const char *trig16 = 
+"#line 4672 \"[executable]/dav_api.sql\"\n"
+"create trigger SYS_DAV_COL_ACL_D after delete on WS.WS.SYS_DAV_COL order 9 referencing old as O\n"
 "{\n"
 "\n"
-"delete from WS.WS.SYS_DAV_ACL_INVERSE where AI_PARENT_TYPE = \'C\' and AI_PARENT_ID = COL_ID;\n"
+"delete\n"
+"from WS.WS.SYS_DAV_ACL_INVERSE\n"
+"where AI_PARENT_TYPE = \'C\'\n"
+"and AI_PARENT_ID = O.COL_ID;\n"
 "\n"
 "}\n"
-"--src dav_api.sql:4458\n";
+"--src dav_api.sql:4670\n";
 
-static const char *trig15 = 
-"create trigger SYS_DAV_RES_ACL_I after insert on WS.WS.SYS_DAV_RES order 10 referencing new as NR\n"
+static const char *trig17 = 
+"#line 4685 \"[executable]/dav_api.sql\"\n"
+"create trigger SYS_DAV_RES_ACL_I after insert on WS.WS.SYS_DAV_RES order 9 referencing new as N\n"
 "{\n"
-"declare\n"
-"N,\n"
-"resID integer;\n"
-"declare\n"
-"aAcl any;\n"
-"declare\n"
-"aParentAcl varbinary;\n"
+"declare aAcl any;\n"
+"declare aParentAcl varbinary;\n"
 "\n"
 "\n"
-"aAcl := WS.WS.ACL_PARSE(NR.RES_ACL, \'0\', 0);\n"
-"N := 0;\n"
-"while (N < length(aAcl))\n"
+"aAcl := WS.WS.ACL_PARSE (N.RES_ACL, \'0\', 0);\n"
+"foreach (any acl in aAcl) do\n"
 "{\n"
-"insert replacing\n"
-"WS.WS.SYS_DAV_ACL_INVERSE(AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)\n"
-"values(either(equ(aAcl[N][1],0), \'R\', \'G\'), NR.RES_ID, \'R\', aAcl[N][0]);\n"
-"\n"
-"N := N + 1;\n"
+"insert replacing WS.WS.SYS_DAV_ACL_INVERSE (AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)\n"
+"values (either(equ(acl[1],0), \'R\', \'G\'), N.RES_ID, \'R\', acl[0]);\n"
 "}\n"
 "\n"
-"resID := NR.RES_ID;\n"
-"aParentAcl := (select WS.WS.ACL_PARSE(COL_ACL, \'123\', 0) from WS.WS.SYS_DAV_COL where COL_ID = NR.RES_COL);\n"
+"aParentAcl := (select WS.WS.ACL_PARSE (COL_ACL, \'123\', 0) from WS.WS.SYS_DAV_COL where COL_ID = N.RES_COL);\n"
 "if (not isnull(aParentAcl))\n"
 "{\n"
 "set triggers off;\n"
-"update\n"
-"WS.WS.SYS_DAV_RES\n"
-"set\n"
-"RES_ACL = WS.WS.ACL_COMPOSE(vector_concat(aAcl, WS.WS.ACL_MAKE_INHERITED(aParentAcl)))\n"
-"where\n"
-"RES_ID = resID;\n"
+"update WS.WS.SYS_DAV_RES\n"
+"set RES_ACL = WS.WS.ACL_COMPOSE (vector_concat(aAcl, WS.WS.ACL_MAKE_INHERITED(aParentAcl)))\n"
+"where RES_ID = N.RES_ID;\n"
 "}\n"
 "\n"
 "}\n"
-"--src dav_api.sql:4469\n";
+"--src dav_api.sql:4683\n";
 
-static const char *trig16 = 
-"create trigger SYS_DAV_RES_ACL_U after update on WS.WS.SYS_DAV_RES order 10 referencing new as NR\n"
+static const char *trig18 = 
+"#line 4710 \"[executable]/dav_api.sql\"\n"
+"create trigger SYS_DAV_RES_ACL_U after update (RES_ACL) on WS.WS.SYS_DAV_RES order 9 referencing new as N, old as O\n"
 "{\n"
-"declare\n"
-"N,\n"
-"aiGrantee integer;\n"
-"declare\n"
-"aiFlag varchar;\n"
-"declare\n"
-"aAcl any;\n"
-"\n"
+"declare aAcl any;\n"
 "\n"
-"aAcl := WS.WS.ACL_PARSE(NR.RES_ACL, \'0\', 0);\n"
 "\n"
-"delete from WS.WS.SYS_DAV_ACL_INVERSE\n"
-"where\n"
-"AI_PARENT_ID = NR.RES_ID\n"
+"aAcl := WS.WS.ACL_PARSE (O.RES_ACL, \'0\', 0);\n"
+"delete\n"
+"from WS.WS.SYS_DAV_ACL_INVERSE\n"
+"where AI_PARENT_ID = O.RES_ID\n"
 "and AI_PARENT_TYPE = \'R\'\n"
 "and not WS.WS.ACL_CONTAINS_GRANTEE_AND_FLAG (aAcl, AI_GRANTEE_ID, AI_FLAG);\n"
 "\n"
-"N := 0;\n"
-"while (N < length(aAcl))\n"
+"aAcl := WS.WS.ACL_PARSE (N.RES_ACL, \'0\', 0);\n"
+"foreach (any acl in aAcl) do\n"
 "{\n"
-"insert replacing\n"
-"WS.WS.SYS_DAV_ACL_INVERSE(AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)\n"
-"values(either(equ(aAcl[N][1],0), \'R\', \'G\'), NR.RES_ID, \'R\', aAcl[N][0]);\n"
-"\n"
-"N := N + 1;\n"
+"insert replacing WS.WS.SYS_DAV_ACL_INVERSE (AI_FLAG, AI_PARENT_ID, AI_PARENT_TYPE, AI_GRANTEE_ID)\n"
+"values (either (equ (acl[1],0), \'R\', \'G\'), N.RES_ID, \'R\', acl[0]);\n"
 "}\n"
 "\n"
 "}\n"
-"--src dav_api.sql:4507\n";
+"--src dav_api.sql:4708\n";
 
-static const char *trig17 = 
-"create trigger SYS_DAV_RES_ACL_D after delete on WS.WS.SYS_DAV_RES order 10\n"
+static const char *trig19 = 
+"#line 4732 \"[executable]/dav_api.sql\"\n"
+"create trigger SYS_DAV_RES_ACL_D after delete on WS.WS.SYS_DAV_RES order 9 referencing old as O\n"
 "{\n"
 "\n"
-"delete from WS.WS.SYS_DAV_ACL_INVERSE where AI_PARENT_TYPE = \'R\' and AI_PARENT_ID = RES_ID;\n"
+"delete\n"
+"from WS.WS.SYS_DAV_ACL_INVERSE\n"
+"where AI_PARENT_TYPE = \'R\'\n"
+"and AI_PARENT_ID = O.RES_ID;\n"
 "\n"
 "}\n"
-"--src dav_api.sql:4539\n";
+"--src dav_api.sql:4730\n";
 
-static const char *proc152 = 
-"create procedure WS.WS.ACL_UPDATE (in pId integer, in pParentAcl any)\n"
+static const char *proc157 = 
+"#line 4743 \"[executable]/dav_api.sql\"\n"
+"create procedure WS.WS.ACL_UPDATE (in id integer, in parentAcl any)\n"
 "{\n"
-"declare\n"
-"aNew any;\n"
+"declare nAcl any;\n"
 "\n"
-"WS.WS.ACL_MAKE_INHERITED(pParentAcl);\n"
 "\n"
-"for select RES_ID as iResID, WS.WS.ACL_PARSE(RES_ACL, \'0\', 0) as aAcl from WS.WS.SYS_DAV_RES where RES_COL = pId do\n"
+"WS.WS.ACL_MAKE_INHERITED (parentAcl);\n"
+"for select RES_ID as resID, RES_ACL as aAcl from WS.WS.SYS_DAV_RES where RES_COL = id do\n"
 "{\n"
-"update\n"
-"WS.WS.SYS_DAV_RES\n"
-"set\n"
-"RES_ACL = WS.WS.ACL_COMPOSE(vector_concat(aAcl, pParentAcl))\n"
-"where\n"
-"RES_ID = iResID;\n"
+"nAcl := WS.WS.ACL_COMPOSE (vector_concat (WS.WS.ACL_PARSE (aAcl, \'0\', 0), parentAcl));\n"
+"if (not ((nAcl = aAcl) or (isnull (nAcl) and isnull (aAcl))))\n"
+"{\n"
+"update WS.WS.SYS_DAV_RES\n"
+"set RES_ACL = nAcl\n"
+"where RES_ID = resID;\n"
 "}\n"
-"\n"
-"for select COL_ID as iColID, WS.WS.ACL_COMPOSE(vector_concat(WS.WS.ACL_PARSE(COL_ACL, \'012\', 0), pParentAcl)) as aAcl from WS.WS.SYS_DAV_COL where COL_PARENT = pId do\n"
+"}\n"
+"for select COL_ID as colID, COL_ACL as aAcl from WS.WS.SYS_DAV_COL where COL_PARENT = id do\n"
 "{\n"
-"update\n"
-"WS.WS.SYS_DAV_COL\n"
-"set\n"
-"COL_ACL = aAcl\n"
-"where\n"
-"COL_ID = iColID;\n"
-"WS.WS.ACL_UPDATE(iColID, WS.WS.ACL_PARSE(aAcl, \'123\', 0));\n"
+"nAcl := WS.WS.ACL_COMPOSE (vector_concat (WS.WS.ACL_PARSE (aAcl, \'012\', 0), parentAcl));\n"
+"if (not ((nAcl = aAcl) or (isnull (nAcl) and isnull (aAcl))))\n"
+"{\n"
+"update WS.WS.SYS_DAV_COL\n"
+"set COL_ACL = nAcl\n"
+"where COL_ID = colID;\n"
+"WS.WS.ACL_UPDATE(colID, WS.WS.ACL_PARSE (nAcl, \'123\', 0));\n"
 "}\n"
 "}\n"
-"--src dav_api.sql:4547\n";
+"}\n"
+"--src dav_api.sql:4741\n";
 
-static const char *proc153 = 
-"create procedure WS.WS.ACL_MAKE_INHERITED (inout pAcl any)\n"
+static const char *proc158 = 
+"#line 4773 \"[executable]/dav_api.sql\"\n"
+"create procedure WS.WS.ACL_MAKE_INHERITED (\n"
+"inout aAcl any)\n"
 "{\n"
-"declare\n"
-"aTmp any;\n"
-"declare\n"
-"N integer;\n"
+"declare tmp any;\n"
+"declare N integer;\n"
 "\n"
-"N := 0;\n"
-"while (N < length(pAcl))\n"
+"for (N := 0; N < length (aAcl); N := N + 1)\n"
 "{\n"
-"aTmp := pAcl[N];\n"
-"aset(aTmp, 2, 3);\n"
-"aset(pAcl, N, aTmp);\n"
-"N := N + 1;\n"
+"tmp := aAcl[N];\n"
+"aset (tmp, 2, 3);\n"
+"aset (aAcl, N, tmp);\n"
 "}\n"
-"return pAcl;\n"
+"return aAcl;\n"
 "}\n"
-"--src dav_api.sql:4577\n";
+"--src dav_api.sql:4771\n";
 
-static const char *proc154 = 
-"create procedure WS.WS.ACL_DBG(in vb varbinary) returns varchar\n"
+static const char *proc159 = 
+"#line 4790 \"[executable]/dav_api.sql\"\n"
+"create procedure WS.WS.ACL_DBG (\n"
+"in vb varbinary) returns varchar\n"
 "{\n"
-"declare\n"
-"N integer;\n"
-"declare\n"
-"aResult varchar;\n"
+"declare N integer;\n"
+"declare aResult varchar;\n"
 "\n"
 "aResult := \'\';\n"
 "vb := cast(vb as varchar);\n"
-"\n"
-"N := 0;\n"
-"while (N < length(vb))\n"
+"for (N := 0; N < length (vb); N := N + 1)\n"
 "{\n"
-"aResult := concat(aResult, cast(vb[N] as varchar), \', \');\n"
-"N := N + 1;\n"
+"aResult := aResult || cast (vb[N] as varchar) || \', \';\n"
 "}\n"
 "return aResult;\n"
 "}\n"
-"--src dav_api.sql:4597\n";
+"--src dav_api.sql:4788\n";
 
-static const char *proc155 = 
+static const char *proc160 = 
+"#line 4808 \"[executable]/dav_api.sql\"\n"
 "create procedure WS.WS.ACL_SERIALIZE_INT(in I integer) returns varbinary\n"
 "{\n"
-"declare\n"
-"N integer;\n"
-"declare\n"
-"aResult varchar;\n"
+"declare N integer;\n"
+"declare aResult varchar;\n"
 "\n"
 "aResult:=repeat(\'\\0\',4);\n"
 "\n"
@@ -9087,48 +9451,49 @@ static const char *proc155 =
 "\n"
 "return cast(aResult as varbinary);\n"
 "}\n"
-"--src dav_api.sql:4619\n";
+"--src dav_api.sql:4806\n";
 
-static const char *proc156 = 
+static const char *proc161 = 
+"#line 4837 \"[executable]/dav_api.sql\"\n"
 "create procedure WS.WS.ACL_DESERIALIZE_INT(in vb varbinary) returns integer\n"
 "{\n"
-"declare\n"
-"vc varchar;\n"
+"declare vc varchar;\n"
 "\n"
 "vc := cast(vb as varchar);\n"
-"\n"
 "return bit_or(bit_or(bit_or(bit_shift(aref(vc, 0), 24), bit_shift(aref(vc, 1), 16)), bit_shift(aref(vc, 2), 8)), aref(vc, 3));\n"
 "}\n"
-"--src dav_api.sql:4650\n";
+"--src dav_api.sql:4835\n";
 
-static const char *proc157 = 
+static const char *proc162 = 
+"#line 4848 \"[executable]/dav_api.sql\"\n"
 "create procedure WS.WS.ACL_GET_ACLLENGTH(in acl varbinary) returns integer\n"
 "{\n"
 "return WS.WS.ACL_DESERIALIZE_INT(cast(substring(cast(acl as varchar), 1, 4) as varbinary));\n"
 "}\n"
-"--src dav_api.sql:4663\n";
+"--src dav_api.sql:4846\n";
 
-static const char *proc158 = 
+static const char *proc163 = 
+"#line 4856 \"[executable]/dav_api.sql\"\n"
 "create procedure WS.WS.ACL_GET_ACESIZE(in acl varbinary) returns integer\n"
 "{\n"
 "return WS.WS.ACL_DESERIALIZE_INT(cast(substring(cast(acl as varchar), 5, 4) as varbinary));\n"
 "}\n"
-"--src dav_api.sql:4671\n";
+"--src dav_api.sql:4854\n";
 
-static const char *proc159 = 
+static const char *proc164 = 
+"#line 4867 \"[executable]/dav_api.sql\"\n"
 "create procedure WS.WS.ACL_CREATE() returns varbinary\n"
 "{\n"
 "return cast(concat(cast(WS.WS.ACL_SERIALIZE_INT(8) as varchar),\n"
 "cast(WS.WS.ACL_SERIALIZE_INT(0) as varchar)) as varbinary);\n"
 "}\n"
-"--src dav_api.sql:4682\n";
+"--src dav_api.sql:4865\n";
 
-static const char *proc160 = 
+static const char *proc165 = 
+"#line 4879 \"[executable]/dav_api.sql\"\n"
 "create procedure WS.WS.ACL_IS_VALID (in acl varbinary) returns integer\n"
 "{\n"
-"declare\n"
-"iAclLength,\n"
-"iAceSize integer;\n"
+"declare iAclLength, iAceSize integer;\n"
 "\n"
 "\n"
 "if (internal_type_name(internal_type(acl)) <> \'VARBINARY\')\n"
@@ -9153,22 +9518,19 @@ static const char *proc160 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src dav_api.sql:4694\n";
+"--src dav_api.sql:4877\n";
 
-static const char *proc161 = 
+static const char *proc166 = 
+"#line 4914 \"[executable]/dav_api.sql\"\n"
 "create procedure WS.WS.ACL_ADD_ENTRY(inout acl varbinary, in uid integer, in bitmask integer, in is_grant integer, in inheritance integer := 0) returns varbinary\n"
 "{\n"
-"declare\n"
-"N,\n"
-"bFound integer;\n"
-"declare\n"
-"aAcl any;\n"
+"declare N, bFound integer;\n"
+"declare aAcl any;\n"
 "\n"
 "aAcl := WS.WS.ACL_PARSE(acl);\n"
 "\n"
 "bFound := 0;\n"
-"N := 0;\n"
-"while (N < length(aAcl))\n"
+"for (N := 0; N < length (aAcl); N := N + 1)\n"
 "{\n"
 "if ((aAcl[N][0] = uid) and (aAcl[N][2] = inheritance))\n"
 "{\n"
@@ -9182,8 +9544,7 @@ static const char *proc161 =
 "aset(aAcl, N, vector(aAcl[N][0], aAcl[N][1], aAcl[N][2], bit_and(aAcl[N][3], bit_not(bitmask))));\n"
 "}\n"
 "}\n"
-"N := N + 1;\n"
-"};\n"
+"}\n"
 "\n"
 "if (not bFound)\n"
 "aAcl := vector_concat(aAcl, vector(vector(uid, is_grant, inheritance, bitmask)));\n"
@@ -9192,20 +9553,17 @@ static const char *proc161 =
 "\n"
 "return acl;\n"
 "}\n"
-"--src dav_api.sql:4731\n";
+"--src dav_api.sql:4912\n";
 
-static const char *proc162 = 
+static const char *proc167 = 
+"#line 4954 \"[executable]/dav_api.sql\"\n"
 "create procedure WS.WS.ACL_REMOVE_ENTRY(inout acl varbinary, in uid integer, in bitmask integer, in inheritance integer := 0) returns varbinary\n"
 "{\n"
-"declare\n"
-"N integer;\n"
-"declare\n"
-"aAcl any;\n"
+"declare N integer;\n"
+"declare aAcl any;\n"
 "\n"
 "aAcl := WS.WS.ACL_PARSE(acl);\n"
-"\n"
-"N := 0;\n"
-"while (N < length(aAcl))\n"
+"for (N := 0; N < length(aAcl); N := N + 1)\n"
 "{\n"
 "if ((aAcl[N][0] = uid) and (aAcl[N][2] = inheritance))\n"
 "{\n"
@@ -9218,24 +9576,21 @@ static const char *proc162 =
 "aset(aAcl, N, vector(aAcl[N][0], aAcl[N][1], aAcl[N][2], bit_and(aAcl[N][3], bitmask)));\n"
 "}\n"
 "}\n"
-"N := N + 1;\n"
 "}\n"
 "acl := WS.WS.ACL_COMPOSE(aAcl);\n"
 "\n"
 "return acl;\n"
 "}\n"
-"--src dav_api.sql:4776\n";
+"--src dav_api.sql:4952\n";
 
-static const char *proc163 = 
+static const char *proc168 = 
+"#line 4985 \"[executable]/dav_api.sql\"\n"
 "create procedure WS.WS.ACL_IS_GRANTED(in acl varbinary, in uid integer, in bitmask integer) returns integer\n"
 "{\n"
-"declare\n"
-"N, lenAcl integer;\n"
-"declare\n"
-"aAcl any;\n"
+"declare N, lenAcl integer;\n"
+"declare aAcl any;\n"
 "declare ids any;\n"
-"declare\n"
-"or_acc integer;\n"
+"declare or_acc integer;\n"
 "\n"
 "if (isnull(acl))\n"
 "return 0;\n"
@@ -9269,34 +9624,34 @@ static const char *proc163 =
 "return or_acc;\n"
 "return 0;\n"
 "}\n"
-"--src dav_api.sql:4812\n";
+"--src dav_api.sql:4983\n";
 
-static const char *proc164 = 
+static const char *proc169 = 
+"#line 5031 \"[executable]/dav_api.sql\"\n"
 "create procedure WS.WS.ACL_SET_OWNER(inout acl varbinary, in uid integer)\n"
 "{\n"
 "return;\n"
 "}\n"
-"--src dav_api.sql:4861\n";
+"--src dav_api.sql:5029\n";
 
-static const char *proc165 = 
+static const char *proc170 = 
+"#line 5042 \"[executable]/dav_api.sql\"\n"
 "create procedure WS.WS.ACL_OWNER(in acl varbinary) returns integer\n"
 "{\n"
 "return;\n"
 "}\n"
-"--src dav_api.sql:4872\n";
+"--src dav_api.sql:5040\n";
 
-static const char *proc166 = 
-"create procedure WS.WS.ACL_PARSE(in acl varbinary, in inheritance varchar := \'0123\', in error integer := 1) returns any\n"
+static const char *proc171 = 
+"#line 5053 \"[executable]/dav_api.sql\"\n"
+"create procedure WS.WS.ACL_PARSE (\n"
+"in acl varbinary,\n"
+"in inheritance varchar := \'0123\',\n"
+"in error integer := 1) returns any\n"
 "{\n"
-"declare\n"
-"sAcl varchar;\n"
-"declare\n"
-"N,\n"
-"I,\n"
-"T,\n"
-"iAceSize integer;\n"
-"declare\n"
-"aAcl any;\n"
+"declare sAcl varchar;\n"
+"declare N, I, T, aclSize integer;\n"
+"declare aAcl any;\n"
 "\n"
 "if (acl is null)\n"
 "return vector ();\n"
@@ -9312,54 +9667,47 @@ static const char *proc166 =
 "return vector ();\n"
 "}\n"
 "\n"
-"iAceSize := WS.WS.ACL_GET_ACESIZE(acl);\n"
+"aclSize := WS.WS.ACL_GET_ACESIZE (acl);\n"
 "sAcl := cast(acl as varchar);\n"
 "\n"
-"aAcl := vector ();\n"
-"N := 1;\n"
-"while (N <= iAceSize)\n"
+"vectorbld_init (aAcl);\n"
+"for (N := 1; N <= aclSize; N := N + 1)\n"
 "{\n"
 "T := WS.WS.ACL_DESERIALIZE_INT(cast (substring(sAcl, 8*N+5, 4) as varbinary));\n"
 "I := abs(bit_and(bit_shift(T, -29), 3));\n"
 "if (not isnull(strchr(inheritance, cast(I as varchar))))\n"
-"aAcl := vector_concat(aAcl,\n"
-"vector(vector(WS.WS.ACL_DESERIALIZE_INT(cast (substring(sAcl, 8*N+1, 4) as varbinary)),\n"
+"vectorbld_acc (aAcl, vector (WS.WS.ACL_DESERIALIZE_INT (cast (substring (sAcl, 8*N+1, 4) as varbinary)),\n"
 "abs(bit_shift(T, -31)),\n"
 "I,\n"
-"abs(bit_and(T, 536870911)))));\n"
-"N := N + 1;\n"
+"abs (bit_and (T, 536870911))));\n"
 "}\n"
-"\n"
+"vectorbld_final (aAcl);\n"
 "return aAcl;\n"
 "}\n"
-"--src dav_api.sql:4883\n";
+"--src dav_api.sql:5051\n";
 
-static const char *proc167 = 
-"create procedure WS.WS.ACL_COMPOSE(in aAcl vector) returns varbinary\n"
+static const char *proc172 = 
+"#line 5100 \"[executable]/dav_api.sql\"\n"
+"create procedure WS.WS.ACL_COMPOSE (\n"
+"in aAcl vector) returns varbinary\n"
 "{\n"
 "declare sAcl varchar;\n"
 "declare bAcl varbinary;\n"
 "declare N, I, J integer;\n"
 "\n"
 "sAcl := \'\';\n"
-"I := 1;\n"
-"while (I < 4)\n"
+"for (I := 1; I < 4; I := I + 1)\n"
 "{\n"
-"J := 0;\n"
-"while (J < 2)\n"
+"for (J := 0; J < 2; J := J + 1)\n"
 "{\n"
-"N := 0;\n"
-"while (N < length(aAcl))\n"
+"foreach (any acl in aAcl) do\n"
 "{\n"
-"if ((aAcl[N][1]=J) and ((aAcl[N][2]=I) or ((aAcl[N][2]=0) and (I=1))) and aAcl[N][3])\n"
+"if ((acl[1]=J) and ((acl[2]=I) or ((acl[2]=0) and (I=1))) and acl[3])\n"
 "sAcl := concat(sAcl,\n"
-"cast(WS.WS.ACL_SERIALIZE_INT(aAcl[N][0]) as varchar),\n"
-"cast(WS.WS.ACL_SERIALIZE_INT(bit_shift(aAcl[N][1],31)+bit_shift(aAcl[N][2],29)+aAcl[N][3]) as varchar));\n"
-"N := N + 1;\n"
+"cast(WS.WS.ACL_SERIALIZE_INT(acl[0]) as varchar),\n"
+"cast(WS.WS.ACL_SERIALIZE_INT(bit_shift(acl[1],31)+bit_shift(acl[2],29)+acl[3]) as varchar));\n"
 "}\n"
-"J := J + 1;\n"
 "}\n"
-"I := I + 1;\n"
 "}\n"
 "\n"
 "bAcl := cast(concat(cast(WS.WS.ACL_SERIALIZE_INT(length(sAcl)+8) as varchar),\n"
@@ -9368,9 +9716,10 @@ static const char *proc167 =
 "\n"
 "return bAcl;\n"
 "}\n"
-"--src dav_api.sql:4936\n";
+"--src dav_api.sql:5098\n";
 
-static const char *proc168 = 
+static const char *proc173 = 
+"#line 5134 \"[executable]/dav_api.sql\"\n"
 "create function DAV_CAST_STRING_TO_INTEGER (in val varchar) returns integer\n"
 "{\n"
 "if (val is null) return null;\n"
@@ -9379,9 +9728,10 @@ static const char *proc168 =
 "ret_null:\n"
 "return null;\n"
 "}\n"
-"--src dav_api.sql:4975\n";
+"--src dav_api.sql:5132\n";
 
-static const char *proc169 = 
+static const char *proc174 = 
+"#line 5144 \"[executable]/dav_api.sql\"\n"
 "create function DAV_CAST_STRING_TO_DATETIME (in val varchar) returns datetime\n"
 "{\n"
 "if (val is null) return null;\n"
@@ -9390,9 +9740,10 @@ static const char *proc169 =
 "ret_null:\n"
 "return null;\n"
 "}\n"
-"--src dav_api.sql:4985\n";
+"--src dav_api.sql:5142\n";
 
-static const char *proc170 = 
+static const char *proc175 = 
+"#line 5154 \"[executable]/dav_api.sql\"\n"
 "create function DAV_CAST_TEXT_TO_VARCHAR (in val varchar) returns varchar\n"
 "{\n"
 "if (val is null) return null;\n"
@@ -9401,9 +9752,10 @@ static const char *proc170 =
 "ret_null:\n"
 "return null;\n"
 "}\n"
-"--src dav_api.sql:4995\n";
+"--src dav_api.sql:5152\n";
 
-static const char *proc171 = 
+static const char *proc176 = 
+"#line 5164 \"[executable]/dav_api.sql\"\n"
 "create function DAV_CAST_TEXT_TO_INTEGER (in val varchar) returns integer\n"
 "{\n"
 "if (val is null) return null;\n"
@@ -9412,9 +9764,10 @@ static const char *proc171 =
 "ret_null:\n"
 "return null;\n"
 "}\n"
-"--src dav_api.sql:5005\n";
+"--src dav_api.sql:5162\n";
 
-static const char *proc172 = 
+static const char *proc177 = 
+"#line 5174 \"[executable]/dav_api.sql\"\n"
 "create function DAV_CAST_TEXT_TO_DATETIME (in val varchar) returns datetime\n"
 "{\n"
 "if (val is null) return null;\n"
@@ -9423,9 +9776,10 @@ static const char *proc172 =
 "ret_null:\n"
 "return null;\n"
 "}\n"
-"--src dav_api.sql:5015\n";
+"--src dav_api.sql:5172\n";
 
-static const char *proc173 = 
+static const char *proc178 = 
+"#line 5184 \"[executable]/dav_api.sql\"\n"
 "create function DAV_FC_CONST_AS_SQL (inout val any)\n"
 "{\n"
 "if (193 = __tag (val))\n"
@@ -9444,9 +9798,10 @@ static const char *proc173 =
 "return sprintf (\'cast (\'\'%s\'\' as datetime)\', cast (val as varchar));\n"
 "signal (\'.....\', \'Internal error in DAV_DIR_FILTER: DAV_FC_CONST_AS_SQL has got bad value\');\n"
 "}\n"
-"--src dav_api.sql:5025\n";
+"--src dav_api.sql:5182\n";
 
-static const char *proc174 = 
+static const char *proc179 = 
+"#line 5210 \"[executable]/dav_api.sql\"\n"
 "create procedure DAV_FC_PRED_METAS (inout pred_metas any)\n"
 "{\n"
 "pred_metas := vector (\n"
@@ -9476,9 +9831,10 @@ static const char *proc174 =
 "\'RDF_OBJ_VALUE\',            vector (\'SYS_DAV_PROP\'  , 3, \'XML\'      , NULL  )\n"
 ");\n"
 "}\n"
-"--src dav_api.sql:5051\n";
+"--src dav_api.sql:5208\n";
 
-static const char *proc175 = 
+static const char *proc180 = 
+"#line 5248 \"[executable]/dav_api.sql\"\n"
 "create procedure DAV_FC_CMP_METAS (inout cmp_metas any)\n"
 "{\n"
 "cmp_metas := vector (\n"
@@ -9511,9 +9867,10 @@ static const char *proc175 =
 "\'xcontains\',                vector (\'scalar\', \'XML\'         , NULL, NULL, \'[^{pattern}^]\' )\n"
 ");\n"
 "}\n"
-"--src dav_api.sql:5089\n";
+"--src dav_api.sql:5246\n";
 
-static const char *proc176 = 
+static const char *proc181 = 
+"#line 5282 \"[executable]/dav_api.sql\"\n"
 "create procedure DAV_FC_TABLE_METAS (inout table_metas any)\n"
 "{\n"
 "table_metas := vector (\n"
@@ -9543,9 +9900,10 @@ static const char *proc176 =
 "\'DT_TAGS\'       , \'DT_TAGS\'     , NULL  )\n"
 ");\n"
 "}\n"
-"--src dav_api.sql:5123\n";
+"--src dav_api.sql:5280\n";
 
-static const char *proc177 = 
+static const char *proc182 = 
+"#line 5314 \"[executable]/dav_api.sql\"\n"
 "create function DAV_FC_PRINT_COMPARISON (inout pred any, inout pred_metas any, inout cmp_metas any, in varname varchar, in nonsql integer) returns varchar\n"
 "{\n"
 "declare pred_meta any;\n"
@@ -9678,9 +10036,10 @@ static const char *proc177 =
 "type_mismatch:\n"
 "signal (\'.....\', sprintf (\'Can not compile comparison \'\'%s %s %s\'\' due to type mismatch in predicate \'\'%s\'\' in filter of DAV_DIR_FILTER, \', pred_meta[2], pred[1], pattern_type, pred[0]));\n"
 "}\n"
-"--src dav_api.sql:5155\n";
+"--src dav_api.sql:5312\n";
 
-static const char *proc178 = 
+static const char *proc183 = 
+"#line 5449 \"[executable]/dav_api.sql\"\n"
 "create function DAV_FC_PRINT_WHERE (inout filter any, in param_uid integer) returns varchar\n"
 "{\n"
 "declare pred_metas, cmp_metas, table_metas any;\n"
@@ -9692,9 +10051,10 @@ static const char *proc178 =
 "used_tables := vector (\'SYS_DAV_RES\', vector (\'SYS_DAV_RES\', \'_top\', null, vector (), vector (), vector ()));\n"
 "return DAV_FC_PRINT_WHERE_INT (filter, pred_metas, cmp_metas, table_metas, used_tables, param_uid);\n"
 "}\n"
-"--src dav_api.sql:5290\n";
+"--src dav_api.sql:5447\n";
 
-static const char *proc179 = 
+static const char *proc184 = 
+"#line 5462 \"[executable]/dav_api.sql\"\n"
 "create function DAV_FC_PRINT_WHERE_INT (in filter any, inout pred_metas any, inout cmp_metas any, inout table_metas any, inout used_tables any, in param_uid integer) returns varchar\n"
 "{\n"
 "\n"
@@ -10033,9 +10393,10 @@ static const char *proc179 =
 "res_strg := replace (res_strg, \'^{nobodyuid}^\', cast (http_nobody_uid() as varchar));\n"
 "return res_strg;\n"
 "}\n"
-"--src dav_api.sql:5303\n";
+"--src dav_api.sql:5460\n";
 
-static const char *proc180 = 
+static const char *proc185 = 
+"#line 5806 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_REGISTER_RDF_SCHEMA (in schema_uri varchar, in location varchar, in local_addon varchar, in mode varchar)\n"
 "{\n"
@@ -10055,9 +10416,10 @@ static const char *proc180 =
 "values (schema_uri, location, local_addon, 0);\n"
 "DAV_GET_RDF_SCHEMA_N3 (schema_uri);\n"
 "}\n"
-"--src dav_api.sql:5647\n";
+"--src dav_api.sql:5804\n";
 
-static const char *proc181 = 
+static const char *proc186 = 
+"#line 5829 \"[executable]/dav_api.sql\"\n"
 " create function DAV_RDF_SCHEMA_N3_LIST_PROPERTIES (inout schema_n3 any, in classname varchar)\n"
 "{\n"
 "if (classname is null)\n"
@@ -10091,9 +10453,10 @@ static const char *proc181 =
 "/@N3S )\',\n"
 "schema_n3, 1, vector (\'classname\', classname) );\n"
 "}\n"
-"--src dav_api.sql:5670\n";
+"--src dav_api.sql:5827\n";
 
-static const char *proc182 = 
+static const char *proc187 = 
+"#line 5865 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_CROP_URI_TO_CATNAME (in uri varchar)\n"
 "{\n"
@@ -10116,9 +10479,10 @@ static const char *proc182 =
 "return subseq (uri, slash + 1);\n"
 "return uri;\n"
 "}\n"
-"--src dav_api.sql:5706\n";
+"--src dav_api.sql:5863\n";
 
-static const char *proc183 = 
+static const char *proc188 = 
+"#line 5891 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_GET_RDF_SCHEMA_N3 (in schema_uri varchar)\n"
 "{\n"
@@ -10216,9 +10580,10 @@ static const char *proc183 =
 "\n"
 "return xtree_doc (\'<stub/>\');\n"
 "}\n"
-"--src dav_api.sql:5732\n";
+"--src dav_api.sql:5889\n";
 
-static const char *proc184 = 
+static const char *proc189 = 
+"#line 5991 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_DEPRECATE_RDF_SCHEMA (in schema_uri varchar)\n"
 "{\n"
@@ -10231,9 +10596,10 @@ static const char *proc184 =
 "\n"
 "delete from WS.WS.SYS_RDF_SCHEMAS where RS_URI = schema_uri and RS_LOCAL_ADDONS is null;\n"
 "}\n"
-"--src dav_api.sql:5832\n";
+"--src dav_api.sql:5989\n";
 
-static const char *proc185 = 
+static const char *proc190 = 
+"#line 6005 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_REGISTER_MIME_TYPE (in m_ident varchar, in descr varchar, in dflt_ext varchar, in badmagic varchar, in mode varchar)\n"
 "{\n"
@@ -10255,26 +10621,29 @@ static const char *proc185 =
 "values (m_ident, descr, dflt_ext, badmagic);\n"
 "insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (m_ident, dflt_ext);\n"
 "}\n"
-"--src dav_api.sql:5846\n";
+"--src dav_api.sql:6003\n";
 
-static const char *proc186 = 
+static const char *proc191 = 
+"#line 6028 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_REGISTER_MIME_RDF (in m_ident varchar, in schema_uri varchar)\n"
 "{\n"
 "insert replacing WS.WS.SYS_MIME_RDFS (MR_MIME_IDENT, MR_RDF_URI, MR_DEPRECATED)\n"
 "values (m_ident, schema_uri, 0);\n"
 "}\n"
-"--src dav_api.sql:5869\n";
+"--src dav_api.sql:6026\n";
 
-static const char *proc187 = 
+static const char *proc192 = 
+"#line 6036 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_DEPRECATE_MIME_RDF (in m_ident varchar, in schema_uri varchar)\n"
 "{\n"
 "update WS.WS.SYS_MIME_RDFS set MR_DEPRECATED = 1 where MR_MIME_IDENT = m_ident and MR_RDF_URI = schema_uri;\n"
 "}\n"
-"--src dav_api.sql:5877\n";
+"--src dav_api.sql:6034\n";
 
-static const char *proc188 = 
+static const char *proc193 = 
+"#line 6044 \"[executable]/dav_api.sql\"\n"
 " create function\n"
 "DAV_RDF_PROP_SET (\n"
 "in path varchar,\n"
@@ -10285,9 +10654,10 @@ static const char *proc188 =
 "{\n"
 "return DAV_RDF_PROP_SET_INT (path, single_schema, rdf, auth_uname, auth_pwd);\n"
 "}\n"
-"--src dav_api.sql:5885\n";
+"--src dav_api.sql:6042\n";
 
-static const char *proc189 = 
+static const char *proc194 = 
+"#line 6058 \"[executable]/dav_api.sql\"\n"
 " create procedure\n"
 "DAV_RDF_PROP_GET (\n"
 "in path varchar,\n"
@@ -10302,9 +10672,10 @@ static const char *proc189 =
 "st := \'R\';\n"
 "return DAV_RDF_PROP_GET_INT (DAV_SEARCH_ID (path, st), st, single_schema, 1, auth_uname, auth_pwd);\n"
 "}\n"
-"--src dav_api.sql:5899\n";
+"--src dav_api.sql:6056\n";
 
-static const char *proc190 = 
+static const char *proc195 = 
+"#line 6075 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_RDF_PREPROCESS_RDFXML_SUB (inout n3_subj_dict any, in main_res nvarchar, in mode integer, inout firsttime_subj_list any) returns any\n"
 "{\n"
@@ -10371,9 +10742,10 @@ static const char *proc190 =
 "xte_nodebld_final (top_acc, top_head);\n"
 "return top_acc;\n"
 "}\n"
-"--src dav_api.sql:5916\n";
+"--src dav_api.sql:6073\n";
 
-static const char *proc191 = 
+static const char *proc196 = 
+"#line 6144 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_RDF_PREPROCESS_RDFXML (in rdfxml any, in main_res nvarchar, in already_n3 integer := 0)\n"
 "{\n"
@@ -10419,9 +10791,10 @@ static const char *proc191 =
 "xte_nodebld_final (rdf_acc, xte_head (UNAME\'virt:rdf\'));\n"
 "return rdf_acc;\n"
 "}\n"
-"--src dav_api.sql:5985\n";
+"--src dav_api.sql:6142\n";
 
-static const char *proc192 = 
+static const char *proc197 = 
+"#line 6192 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_RDF_PROP_SET_INT (\n"
 "in path varchar,\n"
@@ -10448,9 +10821,10 @@ static const char *proc192 =
 "davtree := DAV_RDF_PREPROCESS_RDFXML (n3xml, top_subj, 1);\n"
 "return DAV_PROP_SET_INT (path, single_schema, davtree, auth_uname, auth_pwd, extern, check_locks, overwrite, auth_uid);\n"
 "}\n"
-"--src dav_api.sql:6033\n";
+"--src dav_api.sql:6190\n";
 
-static const char *proc193 = 
+static const char *proc198 = 
+"#line 6221 \"[executable]/dav_api.sql\"\n"
 "create procedure\n"
 "DAV_RDF_PROP_GET_INT (\n"
 "in id any,\n"
@@ -10470,9 +10844,10 @@ static const char *proc193 =
 "davtree := xml_tree_doc (deserialize (davtree));\n"
 "return davtree;\n"
 "}\n"
-"--src dav_api.sql:6062\n";
+"--src dav_api.sql:6219\n";
 
-static const char *proc194 = 
+static const char *proc199 = 
+"#line 6243 \"[executable]/dav_api.sql\"\n"
 "create function DAV_RDF_MERGE (\n"
 "in old_n3 any,\n"
 "in patch_n3 any,\n"
@@ -10558,9 +10933,10 @@ static const char *proc194 =
 "xte_nodebld_final (merge_acc, xte_head (UNAME\' root\'));\n"
 "return xml_tree_doc (merge_acc);\n"
 "}\n"
-"--src dav_api.sql:6084\n";
+"--src dav_api.sql:6241\n";
 
-static const char *proc195 = 
+static const char *proc200 = 
+"#line 6331 \"[executable]/dav_api.sql\"\n"
 "create function DAV_RDF_SUBTRACT (\n"
 "in old_n3 any,\n"
 "in sub_n3 any\n"
@@ -10607,9 +10983,10 @@ static const char *proc195 =
 "xte_nodebld_final (res_acc, xte_head (UNAME\' root\'));\n"
 "return xml_tree_doc (res_acc);\n"
 "}\n"
-"--src dav_api.sql:6172\n";
+"--src dav_api.sql:6329\n";
 
-static const char *trig18 = 
+static const char *trig20 = 
+"#line 6380 \"[executable]/dav_api.sql\"\n"
 "create trigger SYS_DAV_RES_CONTENT_EXTRACT_RDF_I after insert on WS.WS.SYS_DAV_RES order 20 referencing new as NEWR\n"
 "{\n"
 "whenever sqlstate \'*\' goto no_op;\n"
@@ -10623,9 +11000,10 @@ static const char *trig18 =
 "\n"
 " ;\n"
 "}\n"
-"--src dav_api.sql:6221\n";
+"--src dav_api.sql:6378\n";
 
-static const char *trig19 = 
+static const char *trig21 = 
+"#line 6395 \"[executable]/dav_api.sql\"\n"
 "create trigger SYS_DAV_RES_CONTENT_EXTRACT_RDF_U1 after update (RES_ID, RES_NAME, RES_TYPE, RES_PERMS) on WS.WS.SYS_DAV_RES order 20 referencing new as NEWR, old as OLDR\n"
 "{\n"
 "\n"
@@ -10646,9 +11024,10 @@ static const char *trig19 =
 "\n"
 " ;\n"
 "}\n"
-"--src dav_api.sql:6236\n";
+"--src dav_api.sql:6393\n";
 
-static const char *trig20 = 
+static const char *trig22 = 
+"#line 6417 \"[executable]/dav_api.sql\"\n"
 "create trigger SYS_DAV_RES_CONTENT_EXTRACT_RDF_U2 after update (RES_ID, RES_NAME, RES_TYPE, RES_CONTENT) on WS.WS.SYS_DAV_RES order 21 referencing new as NEWR, old as OLDR\n"
 "{\n"
 "\n"
@@ -10668,9 +11047,10 @@ static const char *trig20 =
 "\n"
 " ;\n"
 "}\n"
-"--src dav_api.sql:6258\n";
+"--src dav_api.sql:6415\n";
 
-static const char *proc196 = 
+static const char *proc201 = 
+"#line 6438 \"[executable]/dav_api.sql\"\n"
 "create procedure DAV_EXTRACT_AND_SAVE_RDF (in resid integer)\n"
 "{\n"
 "declare resname, restype varchar;\n"
@@ -10680,9 +11060,10 @@ static const char *proc196 =
 "DAV_EXTRACT_AND_SAVE_RDF_INT (resid, resname, restype, rescontent);\n"
 "\n"
 "}\n"
-"--src dav_api.sql:6279\n";
+"--src dav_api.sql:6436\n";
 
-static const char *proc197 = 
+static const char *proc202 = 
+"#line 6449 \"[executable]/dav_api.sql\"\n"
 "create procedure DAV_GET_RES_TYPE_URI_BY_MIME_TYPE(in mime_type varchar) returns varchar\n"
 "{\n"
 "if (mime_type = \'application/bpel+xml\')\n"
@@ -10746,9 +11127,10 @@ static const char *proc197 =
 "if (mime_type = \'text/wiki\')\n"
 "return \'http://www.openlinksw.com/schemas/Wiki#\';\n"
 "}\n"
-"--src dav_api.sql:6290\n";
+"--src dav_api.sql:6447\n";
 
-static const char *proc198 = 
+static const char *proc203 = 
+"#line 6515 \"[executable]/dav_api.sql\"\n"
 "create procedure DAV_EXTRACT_AND_SAVE_RDF_INT (inout resid integer, inout resname varchar, in restype varchar, inout _rescontent any)\n"
 "{\n"
 "declare resttype, res_type_uri, full_name varchar;\n"
@@ -10829,9 +11211,10 @@ static const char *proc198 =
 "\n"
 " ;\n"
 "}\n"
-"--src dav_api.sql:6356\n";
+"--src dav_api.sql:6513\n";
 
-static const char *proc199 = 
+static const char *proc204 = 
+"#line 6597 \"[executable]/dav_api.sql\"\n"
 "create function\n"
 "DAV_HOME_DIR_UPDATE ()\n"
 "{\n"
@@ -10841,14 +11224,15 @@ static const char *proc199 =
 "DAV_HOME_DIR_CREATE (U_NAME);\n"
 "registry_set (\'DAV_HOME_DIR_UPDATE\', \'done\');\n"
 "}\n"
-"--src dav_api.sql:6438\n";
+"--src dav_api.sql:6595\n";
 
 
 static const char *other0 = 
 " DAV_HOME_DIR_UPDATE ()\n";
 /* dav_meta.sql */
 
-static const char *proc200 = 
+static const char *proc205 = 
+"#line 23 \"[executable]/dav_meta.sql\"\n"
 "create function DAV_GUESS_MIME_TYPE_BY_NAME (in orig_res_name varchar) returns varchar\n"
 "{\n"
 "declare dot_pos integer;\n"
@@ -10958,9 +11342,10 @@ static const char *proc200 =
 "return \'text/rdf+n3\';\n"
 "return coalesce ((select T_TYPE from WS.WS.SYS_DAV_RES_TYPES where T_EXT = lower (subseq (orig_res_ext, 1))));\n"
 "}\n"
-"--src dav_meta.sql:22\n";
+"--src dav_meta.sql:21\n";
 
-static const char *proc201 = 
+static const char *proc206 = 
+"#line 134 \"[executable]/dav_meta.sql\"\n"
 "create function DAV_GUESS_MIME_TYPE (in orig_res_name varchar, inout content any, inout html_start any) returns varchar\n"
 "{\n"
 "declare content_len integer;\n"
@@ -11088,9 +11473,10 @@ static const char *proc201 =
 "no_op:\n"
 "return dflt_ret;\n"
 "}\n"
-"--src dav_meta.sql:133\n";
+"--src dav_meta.sql:132\n";
 
-static const char *proc202 = 
+static const char *proc207 = 
+"#line 263 \"[executable]/dav_meta.sql\"\n"
 "create procedure file_space_fmt (in d integer) returns varchar\n"
 "{\n"
 "declare ret float;\n"
@@ -11109,9 +11495,10 @@ static const char *proc202 =
 "else\n"
 "return sprintf(\'%d B\', d);\n"
 "}\n"
-"--src dav_meta.sql:262\n";
+"--src dav_meta.sql:261\n";
 
-static const char *proc203 = 
+static const char *proc208 = 
+"#line 283 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/x-openlink-license\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, res, content any;\n"
@@ -11135,9 +11522,10 @@ static const char *proc203 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:282\n";
+"--src dav_meta.sql:281\n";
 
-static const char *proc204 = 
+static const char *proc209 = 
+"#line 308 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_opendocument\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras, res any;\n"
@@ -11174,65 +11562,74 @@ static const char *proc204 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:307\n";
+"--src dav_meta.sql:306\n";
 
-static const char *proc205 = 
+static const char *proc210 = 
+"#line 346 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.text\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_opendocument\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:345\n";
+"--src dav_meta.sql:344\n";
 
-static const char *proc206 = 
+static const char *proc211 = 
+"#line 352 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.database\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_opendocument\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:351\n";
+"--src dav_meta.sql:350\n";
 
-static const char *proc207 = 
+static const char *proc212 = 
+"#line 358 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.graphics\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_opendocument\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:357\n";
+"--src dav_meta.sql:356\n";
 
-static const char *proc208 = 
+static const char *proc213 = 
+"#line 364 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.presentation\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_opendocument\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:363\n";
+"--src dav_meta.sql:362\n";
 
-static const char *proc209 = 
+static const char *proc214 = 
+"#line 369 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.spreadsheet\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_opendocument\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:368\n";
+"--src dav_meta.sql:367\n";
 
-static const char *proc210 = 
+static const char *proc215 = 
+"#line 374 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.chart\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_opendocument\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:373\n";
+"--src dav_meta.sql:372\n";
 
-static const char *proc211 = 
+static const char *proc216 = 
+"#line 379 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.formula\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_opendocument\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:378\n";
+"--src dav_meta.sql:377\n";
 
-static const char *proc212 = 
+static const char *proc217 = 
+"#line 384 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.image\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_opendocument\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:383\n";
+"--src dav_meta.sql:382\n";
 
-static const char *proc213 = 
+static const char *proc218 = 
+"#line 390 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/x-openlink-image\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, res, content any;\n"
@@ -11268,9 +11665,10 @@ static const char *proc213 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:389\n";
+"--src dav_meta.sql:388\n";
 
-static const char *proc214 = 
+static const char *proc219 = 
+"#line 427 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/x-openlink-photo\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, res, content any;\n"
@@ -11305,60 +11703,68 @@ static const char *proc214 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:426\n";
+"--src dav_meta.sql:425\n";
 
-static const char *proc215 = 
+static const char *proc220 = 
+"#line 463 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/audio\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "declare content any;\n"
 "content := blob_to_string (content1);\n"
 "return xml_tree_doc (audio_to_xml (content, length (content), 1));\n"
 "}\n"
-"--src dav_meta.sql:462\n";
+"--src dav_meta.sql:461\n";
 
-static const char *proc216 = 
+static const char *proc221 = 
+"#line 471 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_audio/mpeg\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/audio\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:470\n";
+"--src dav_meta.sql:469\n";
 
-static const char *proc217 = 
+static const char *proc222 = 
+"#line 477 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_audio/x-flac\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/audio\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:476\n";
+"--src dav_meta.sql:475\n";
 
-static const char *proc218 = 
+static const char *proc223 = 
+"#line 483 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_audio/x-mp3\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/audio\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:482\n";
+"--src dav_meta.sql:481\n";
 
-static const char *proc219 = 
+static const char *proc224 = 
+"#line 489 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_audio/x-m4a\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/audio\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:488\n";
+"--src dav_meta.sql:487\n";
 
-static const char *proc220 = 
+static const char *proc225 = 
+"#line 495 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_audio/x-m4p\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/audio\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:494\n";
+"--src dav_meta.sql:493\n";
 
-static const char *proc221 = 
+static const char *proc226 = 
+"#line 501 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/ogg\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/audio\" (orig_res_name, content1, html_start);\n"
 "}\n"
-"--src dav_meta.sql:500\n";
+"--src dav_meta.sql:499\n";
 
-static const char *proc222 = 
+static const char *proc227 = 
+"#line 507 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/msoffice+xml\" (in type_descr varchar, in orig_res_name varchar, inout content any, inout html_start any, inout docprops any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11386,9 +11792,10 @@ static const char *proc222 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:506\n";
+"--src dav_meta.sql:505\n";
 
-static const char *proc223 = 
+static const char *proc228 = 
+"#line 537 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/msexcel\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11398,9 +11805,10 @@ static const char *proc223 =
 "\'http://www.openlinksw.com/schemas/Office#TypeDescr\'    ,  \'MS Excel spreadsheet\' );\n"
 "return \"DAV_EXTRACT_RDF_BY_METAS\" (doc, metas, extras);\n"
 "}\n"
-"--src dav_meta.sql:536\n";
+"--src dav_meta.sql:535\n";
 
-static const char *proc224 = 
+static const char *proc229 = 
+"#line 548 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/msaccess\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11410,9 +11818,10 @@ static const char *proc224 =
 "\'http://www.openlinksw.com/schemas/Office#TypeDescr\'    ,  \'MS Access database\' );\n"
 "return \"DAV_EXTRACT_RDF_BY_METAS\" (doc, metas, extras);\n"
 "}\n"
-"--src dav_meta.sql:547\n";
+"--src dav_meta.sql:546\n";
 
-static const char *proc225 = 
+static const char *proc230 = 
+"#line 559 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/msproject\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11422,9 +11831,10 @@ static const char *proc225 =
 "\'http://www.openlinksw.com/schemas/Office#TypeDescr\'    ,  \'MS Project document\' );\n"
 "return \"DAV_EXTRACT_RDF_BY_METAS\" (doc, metas, extras);\n"
 "}\n"
-"--src dav_meta.sql:558\n";
+"--src dav_meta.sql:557\n";
 
-static const char *proc226 = 
+static const char *proc231 = 
+"#line 571 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/mspowerpoint\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11434,9 +11844,10 @@ static const char *proc226 =
 "\'http://www.openlinksw.com/schemas/Office#TypeDescr\'    ,  \'MS PowerPoint presentation\' );\n"
 "return \"DAV_EXTRACT_RDF_BY_METAS\" (doc, metas, extras);\n"
 "}\n"
-"--src dav_meta.sql:570\n";
+"--src dav_meta.sql:569\n";
 
-static const char *proc227 = 
+static const char *proc232 = 
+"#line 583 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/msword\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11446,9 +11857,10 @@ static const char *proc227 =
 "\'http://www.openlinksw.com/schemas/Office#TypeDescr\'    ,  \'MS Word document\' );\n"
 "return \"DAV_EXTRACT_RDF_BY_METAS\" (doc, metas, extras);\n"
 "}\n"
-"--src dav_meta.sql:582\n";
+"--src dav_meta.sql:581\n";
 
-static const char *proc228 = 
+static const char *proc233 = 
+"#line 595 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/pdf\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11458,9 +11870,10 @@ static const char *proc228 =
 "\'http://www.openlinksw.com/schemas/Office#TypeDescr\'    ,  \'PDF (Acrobat)\' );\n"
 "return \"DAV_EXTRACT_RDF_BY_METAS\" (doc, metas, extras);\n"
 "}\n"
-"--src dav_meta.sql:594\n";
+"--src dav_meta.sql:593\n";
 
-static const char *proc229 = 
+static const char *proc234 = 
+"#line 607 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/xbrl+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11476,9 +11889,10 @@ static const char *proc229 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:606\n";
+"--src dav_meta.sql:605\n";
 
-static const char *proc230 = 
+static const char *proc235 = 
+"#line 624 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/doap+rdf\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11495,9 +11909,10 @@ static const char *proc230 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:623\n";
+"--src dav_meta.sql:622\n";
 
-static const char *proc231 = 
+static const char *proc236 = 
+"#line 642 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/xddl+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11518,9 +11933,10 @@ static const char *proc231 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:641\n";
+"--src dav_meta.sql:640\n";
 
-static const char *proc232 = 
+static const char *proc237 = 
+"#line 664 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/archive\" (in type_descr varchar, in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11533,150 +11949,170 @@ static const char *proc232 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:663\n";
+"--src dav_meta.sql:662\n";
 
-static const char *proc233 = 
+static const char *proc238 = 
+"#line 678 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/tar\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'TAR archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:677\n";
+"--src dav_meta.sql:676\n";
 
-static const char *proc234 = 
+static const char *proc239 = 
+"#line 684 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/taz\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'TAZ archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:683\n";
+"--src dav_meta.sql:682\n";
 
-static const char *proc235 = 
+static const char *proc240 = 
+"#line 690 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/gz\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'Gzip archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:689\n";
+"--src dav_meta.sql:688\n";
 
-static const char *proc236 = 
+static const char *proc241 = 
+"#line 696 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/msi\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'Microsoft installer\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:695\n";
+"--src dav_meta.sql:694\n";
 
-static const char *proc237 = 
+static const char *proc242 = 
+"#line 702 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/dmg\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'DMG install package\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:701\n";
+"--src dav_meta.sql:700\n";
 
-static const char *proc238 = 
+static const char *proc243 = 
+"#line 708 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/arj\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'ARJ archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:707\n";
+"--src dav_meta.sql:706\n";
 
-static const char *proc239 = 
+static const char *proc244 = 
+"#line 714 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/bz\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'BZ archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:713\n";
+"--src dav_meta.sql:712\n";
 
-static const char *proc240 = 
+static const char *proc245 = 
+"#line 720 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/bz2\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'BZ2 archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:719\n";
+"--src dav_meta.sql:718\n";
 
-static const char *proc241 = 
+static const char *proc246 = 
+"#line 726 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/tgz\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'TGZ archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:725\n";
+"--src dav_meta.sql:724\n";
 
-static const char *proc242 = 
+static const char *proc247 = 
+"#line 732 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/rar\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'RAR archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:731\n";
+"--src dav_meta.sql:730\n";
 
-static const char *proc243 = 
+static const char *proc248 = 
+"#line 738 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/zip\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'ZIP archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:737\n";
+"--src dav_meta.sql:736\n";
 
-static const char *proc244 = 
+static const char *proc249 = 
+"#line 744 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/cab\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'CAB archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:743\n";
+"--src dav_meta.sql:742\n";
 
-static const char *proc245 = 
+static const char *proc250 = 
+"#line 750 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/lzh\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'LZH archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:749\n";
+"--src dav_meta.sql:748\n";
 
-static const char *proc246 = 
+static const char *proc251 = 
+"#line 756 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/ace\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'ACE archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:755\n";
+"--src dav_meta.sql:754\n";
 
-static const char *proc247 = 
+static const char *proc252 = 
+"#line 762 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/iso\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "return \"DAV_EXTRACT_RDF_application/archive\" (\'ISO image archive\', orig_res_name, content, html_start);\n"
 "}\n"
-"--src dav_meta.sql:761\n";
+"--src dav_meta.sql:760\n";
 
-static const char *proc248 = 
+static const char *proc253 = 
+"#line 768 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/msword+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare docprops any;\n"
 "docprops := null;\n"
 "return \"DAV_EXTRACT_RDF_application/msoffice+xml\" (\'Word Document\', orig_res_name, content, html_start, docprops);\n"
 "}\n"
-"--src dav_meta.sql:767\n";
+"--src dav_meta.sql:766\n";
 
-static const char *proc249 = 
+static const char *proc254 = 
+"#line 776 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/msexcel+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare docprops any;\n"
 "docprops := null;\n"
 "return \"DAV_EXTRACT_RDF_application/msoffice+xml\" (\'Excel Spreadsheet\', orig_res_name, content, html_start, docprops);\n"
 "}\n"
-"--src dav_meta.sql:775\n";
+"--src dav_meta.sql:774\n";
 
-static const char *proc250 = 
+static const char *proc255 = 
+"#line 784 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/msproject+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare docprops any;\n"
 "docprops := null;\n"
 "return \"DAV_EXTRACT_RDF_application/msoffice+xml\" (\'Project\', orig_res_name, content, html_start, docprops);\n"
 "}\n"
-"--src dav_meta.sql:783\n";
+"--src dav_meta.sql:782\n";
 
-static const char *proc251 = 
+static const char *proc256 = 
+"#line 792 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/msvisio+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare docprops any;\n"
 "docprops := null;\n"
 "return \"DAV_EXTRACT_RDF_application/msoffice+xml\" (\'Visio\', orig_res_name, content, html_start, docprops);\n"
 "}\n"
-"--src dav_meta.sql:791\n";
+"--src dav_meta.sql:790\n";
 
-static const char *proc252 = 
+static const char *proc257 = 
+"#line 801 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/rss+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, res any;\n"
@@ -11726,9 +12162,10 @@ static const char *proc252 =
 "xte_nodebld_final (res, xte_head (UNAME\' root\'));\n"
 "return xml_tree_doc (res);\n"
 "}\n"
-"--src dav_meta.sql:800\n";
+"--src dav_meta.sql:799\n";
 
-static const char *proc253 = 
+static const char *proc258 = 
+"#line 853 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/atom+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11766,9 +12203,10 @@ static const char *proc253 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:852\n";
+"--src dav_meta.sql:851\n";
 
-static const char *proc254 = 
+static const char *proc259 = 
+"#line 892 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_text/eml\" (in orig_res_name varchar, inout content1 any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, res, content any;\n"
@@ -11804,9 +12242,10 @@ static const char *proc254 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:891\n";
+"--src dav_meta.sql:890\n";
 
-static const char *proc255 = 
+static const char *proc260 = 
+"#line 929 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/xbel+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11830,9 +12269,10 @@ static const char *proc255 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:928\n";
+"--src dav_meta.sql:927\n";
 
-static const char *proc256 = 
+static const char *proc261 = 
+"#line 954 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/rdf+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11848,9 +12288,10 @@ static const char *proc256 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:953\n";
+"--src dav_meta.sql:952\n";
 
-static const char *proc257 = 
+static const char *proc262 = 
+"#line 971 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_text/rdf+ttl\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11861,9 +12302,10 @@ static const char *proc257 =
 "\'http://www.openlinksw.com/schemas/RDF#format\', \'TURTLE\' );\n"
 "return \"DAV_EXTRACT_RDF_BY_METAS\" (doc, metas, extras);\n"
 "}\n"
-"--src dav_meta.sql:970\n";
+"--src dav_meta.sql:969\n";
 
-static const char *proc258 = 
+static const char *proc263 = 
+"#line 983 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_text/rdf+n3\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11874,9 +12316,10 @@ static const char *proc258 =
 "\'http://www.openlinksw.com/schemas/RDF#format\', \'N3\' );\n"
 "return \"DAV_EXTRACT_RDF_BY_METAS\" (doc, metas, extras);\n"
 "}\n"
-"--src dav_meta.sql:982\n";
+"--src dav_meta.sql:981\n";
 
-static const char *proc259 = 
+static const char *proc264 = 
+"#line 995 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/foaf+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, res any;\n"
@@ -11937,9 +12380,10 @@ static const char *proc259 =
 "xte_nodebld_final (res, xte_head (UNAME\' root\'));\n"
 "return xml_tree_doc (res);\n"
 "}\n"
-"--src dav_meta.sql:994\n";
+"--src dav_meta.sql:993\n";
 
-static const char *proc260 = 
+static const char *proc265 = 
+"#line 1058 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/mods+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -11968,9 +12412,10 @@ static const char *proc260 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:1057\n";
+"--src dav_meta.sql:1056\n";
 
-static const char *proc261 = 
+static const char *proc266 = 
+"#line 1089 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/opml+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras, result, vals, outlines any;\n"
@@ -12021,9 +12466,10 @@ static const char *proc261 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:1088\n";
+"--src dav_meta.sql:1087\n";
 
-static const char *proc262 = 
+static const char *proc267 = 
+"#line 1141 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/ocs+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -12043,9 +12489,10 @@ static const char *proc262 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:1140\n";
+"--src dav_meta.sql:1139\n";
 
-static const char *proc263 = 
+static const char *proc268 = 
+"#line 1162 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_text/html\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare metas, extras any;\n"
@@ -12070,9 +12517,10 @@ static const char *proc263 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:1161\n";
+"--src dav_meta.sql:1160\n";
 
-static const char *proc264 = 
+static const char *proc269 = 
+"#line 1189 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/x-openlinksw-vsp\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare metas, extras any;\n"
@@ -12096,9 +12544,10 @@ static const char *proc264 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:1188\n";
+"--src dav_meta.sql:1187\n";
 
-static const char *proc265 = 
+static const char *proc270 = 
+"#line 1215 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/x-openlinksw-vspx+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -12119,9 +12568,10 @@ static const char *proc265 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:1214\n";
+"--src dav_meta.sql:1213\n";
 
-static const char *proc266 = 
+static const char *proc271 = 
+"#line 1237 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/bpel+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -12139,9 +12589,10 @@ static const char *proc266 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:1236\n";
+"--src dav_meta.sql:1235\n";
 
-static const char *proc267 = 
+static const char *proc272 = 
+"#line 1256 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/annotea+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -12157,9 +12608,10 @@ static const char *proc267 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:1255\n";
+"--src dav_meta.sql:1254\n";
 
-static const char *proc268 = 
+static const char *proc273 = 
+"#line 1273 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/google-kinds+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -12177,9 +12629,10 @@ static const char *proc268 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:1272\n";
+"--src dav_meta.sql:1271\n";
 
-static const char *proc269 = 
+static const char *proc274 = 
+"#line 1292 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/wsdl+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -12197,9 +12650,10 @@ static const char *proc269 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:1291\n";
+"--src dav_meta.sql:1290\n";
 
-static const char *proc270 = 
+static const char *proc275 = 
+"#line 1311 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/google-base+xml\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras any;\n"
@@ -12370,9 +12824,10 @@ static const char *proc270 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:1310\n";
+"--src dav_meta.sql:1309\n";
 
-static const char *proc271 = 
+static const char *proc276 = 
+"#line 1483 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_application/x-openlinksw-vad\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, metas, extras, tree, cont any;\n"
@@ -12411,9 +12866,10 @@ static const char *proc271 =
 "errexit:\n"
 "return xml_tree_doc (xte_node (xte_head (UNAME\' root\')));\n"
 "}\n"
-"--src dav_meta.sql:1482\n";
+"--src dav_meta.sql:1481\n";
 
-static const char *proc272 = 
+static const char *proc277 = 
+"#line 1523 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_text/wiki\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "if (1)\n"
@@ -12478,9 +12934,10 @@ static const char *proc272 =
 "return \"DAV_EXTRACT_RDF_BY_METAS\" (_res, metas, extras);\n"
 "}\n"
 "}\n"
-"--src dav_meta.sql:1522\n";
+"--src dav_meta.sql:1521\n";
 
-static const char *proc273 = 
+static const char *proc278 = 
+"#line 1591 \"[executable]/dav_meta.sql\"\n"
 "create function IMC_TO_XML (in _src varchar)\n"
 "{\n"
 "declare stack any;\n"
@@ -12511,6 +12968,11 @@ static const char *proc273 =
 "while (line_idx < lines_count)\n"
 "{\n"
 "line := lines [line_idx];\n"
+"while ((line_idx+1 < lines_count) and (chr (lines [line_idx+1][0]) = \' \' or chr (lines [line_idx+1][0]) = \'\\t\'))\n"
+"{\n"
+"line := line || subseq (lines [line_idx+1], 1);\n"
+"line_idx := line_idx + 1;\n"
+"}\n"
 "if (line = \'\')\n"
 "goto next_line;\n"
 "if (regexp_match (\'^([A-Za-z0-9-]+[.])?((BEGIN)|(begin)):([A-Z]+)\\044\', line) is not null)\n"
@@ -12653,9 +13115,10 @@ static const char *proc273 =
 "xte_nodebld_final (curr_IMC, xte_head (UNAME\' root\'));\n"
 "return curr_IMC;\n"
 "}\n"
-"--src dav_meta.sql:1590\n";
+"--src dav_meta.sql:1589\n";
 
-static const char *proc274 = 
+static const char *proc279 = 
+"#line 1771 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_text/directory\" (in orig_res_name varchar, inout content any, inout html_start any)\n"
 "{\n"
 "declare doc, diritems, res, metas, extras any;\n"
@@ -12779,9 +13242,10 @@ static const char *proc274 =
 "\n"
 "return xml_tree_doc (res);\n"
 "}\n"
-"--src dav_meta.sql:1765\n";
+"--src dav_meta.sql:1769\n";
 
-static const char *proc275 = 
+static const char *proc280 = 
+"#line 1897 \"[executable]/dav_meta.sql\"\n"
 "create function \"DAV_EXTRACT_RDF_BY_METAS\" (inout doc any, inout metas any, inout extras any)\n"
 "{\n"
 "declare res any;\n"
@@ -12825,9 +13289,10 @@ static const char *proc275 =
 "xte_nodebld_final (res, xte_head (UNAME\' root\'));\n"
 "return xml_tree_doc (res);\n"
 "}\n"
-"--src dav_meta.sql:1891\n";
+"--src dav_meta.sql:1895\n";
 
-static const char *proc276 = 
+static const char *proc281 = 
+"#line 1948 \"[executable]/dav_meta.sql\"\n"
 "create function DB.DBA.UNIX_DATETIME_PARSER (in strg varchar, in trap_error integer := 0, in output_mode integer := 0)\n"
 "{\n"
 "declare m integer;\n"
@@ -12924,13 +13389,14 @@ static const char *proc276 =
 "return null;\n"
 "return \'?\' || strg;\n"
 "}\n"
-"--src dav_meta.sql:1942\n";
+"--src dav_meta.sql:1946\n";
 
 static const char *other1 = 
 "grant execute on DB.DBA.UNIX_DATETIME_PARSER to public\n";
 static const char *other2 = 
 "xpf_extension (\'http://www.openlinksw.com/virtuoso/bpel:unix-datetime-parser\', fix_identifier_case (\'DB.DBA.UNIX_DATETIME_PARSER\'), 0)\n";
-static const char *proc277 = 
+static const char *proc282 = 
+"#line 2057 \"[executable]/dav_meta.sql\"\n"
 "create function DB.DBA.UNIX_DATE_PARSER (in strg varchar, in trap_error integer := 0, in output_mode integer := 0)\n"
 "{\n"
 "declare m integer;\n"
@@ -13017,13 +13483,14 @@ static const char *proc277 =
 "return null;\n"
 "return \'?\' || strg;\n"
 "}\n"
-"--src dav_meta.sql:2051\n";
+"--src dav_meta.sql:2055\n";
 
 static const char *other3 = 
 "grant execute on DB.DBA.UNIX_DATE_PARSER to public\n";
 static const char *other4 = 
 "xpf_extension (\'http://www.openlinksw.com/virtuoso/bpel:unix-date-parser\', fix_identifier_case (\'DB.DBA.UNIX_DATE_PARSER\'), 0)\n";
-static const char *proc278 = 
+static const char *proc283 = 
+"#line 2157 \"[executable]/dav_meta.sql\"\n"
 "create function DB.DBA.BPEL_SPLIT_LIST (in strg varchar)\n"
 "{\n"
 "declare parts, res any;\n"
@@ -13047,13 +13514,14 @@ static const char *proc278 =
 "xq_sequencebld_final (res);\n"
 "return res;\n"
 "}\n"
-"--src dav_meta.sql:2151\n";
+"--src dav_meta.sql:2155\n";
 
 static const char *other5 = 
 "grant execute on DB.DBA.BPEL_SPLIT_LIST to public\n";
 static const char *other6 = 
 "xpf_extension (\'http://www.openlinksw.com/virtuoso/bpel:split-list\', fix_identifier_case (\'DB.DBA.BPEL_SPLIT_LIST\'), 0)\n";
-static const char *proc279 = 
+static const char *proc284 = 
+"#line 2189 \"[executable]/dav_meta.sql\"\n"
 "create function DAV_EXTRACT_SPOTLIGHT (in resname varchar, inout rescontent any) returns any\n"
 "{\n"
 "declare temp_name varchar;\n"
@@ -13090,9 +13558,10 @@ static const char *proc279 =
 "\n"
 "return virt_metas;\n"
 "}\n"
-"--src dav_meta.sql:2183\n";
+"--src dav_meta.sql:2187\n";
 
-static const char *proc280 = 
+static const char *proc285 = 
+"#line 2228 \"[executable]/dav_meta.sql\"\n"
 "create function DAV_CONVERT_SPOTLIGHT_TO_VIRTUOSO (in sp_data any) returns any\n"
 "{\n"
 "declare loop_names, len, v_meta, ret, ctr, res, added integer;\n"
@@ -13135,9 +13604,10 @@ static const char *proc280 =
 "\n"
 "return null;\n"
 "}\n"
-"--src dav_meta.sql:2222\n";
+"--src dav_meta.sql:2226\n";
 
-static const char *proc281 = 
+static const char *proc286 = 
+"#line 2273 \"[executable]/dav_meta.sql\"\n"
 "create procedure DAV_SPOTLIGHT_ADD (inout res any, in name varchar, inout val any)\n"
 "{\n"
 "xte_nodebld_acc (res,\n"
@@ -13146,9 +13616,10 @@ static const char *proc281 =
 "\'http://www.apple.com/metadata#\' || name),\n"
 "cast (val as nvarchar) ) );\n"
 "}\n"
-"--src dav_meta.sql:2267\n";
+"--src dav_meta.sql:2271\n";
 
-static const char *proc282 = 
+static const char *proc287 = 
+"#line 2284 \"[executable]/dav_meta.sql\"\n"
 " create procedure DB.DBA.XML_UNIX_DATE_TO_ISO (in unixdt integer)\n"
 "{\n"
 "declare ts any;\n"
@@ -13158,14 +13629,15 @@ static const char *proc282 =
 "ts := dt_set_tz (ts, 0);\n"
 "return soap_print_box (ts, \'\', 0);\n"
 "}\n"
-"--src dav_meta.sql:2278\n";
+"--src dav_meta.sql:2282\n";
 
 static const char *other7 = 
 "insert soft DB.DBA.SYS_XPF_EXTENSIONS (XPE_NAME, XPE_PNAME)\n"
 "VALUES (\'http://www.openlinksw.com/xsltext/:unixTime2ISO\', \'DB.DBA.XML_UNIX_DATE_TO_ISO\')\n";
 static const char *other8 = 
 "xpf_extension (\'http://www.openlinksw.com/xsltext/:unixTime2ISO\', \'DB.DBA.XML_UNIX_DATE_TO_ISO\', 0)\n";
-static const char *proc283 = 
+static const char *proc288 = 
+"#line 2302 \"[executable]/dav_meta.sql\"\n"
 "create procedure DAV_EXTRACT_META_AS_RDF_XML (in resname varchar, in rescontent any := null)\n"
 "{\n"
 "declare res_type_uri, restype varchar;\n"
@@ -13214,11 +13686,12 @@ static const char *proc283 =
 "no_op:\n"
 "return NULL;\n"
 "}\n"
-"--src dav_meta.sql:2296\n";
+"--src dav_meta.sql:2300\n";
 
 /* dav_acct.sql */
 
-static const char *proc284 = 
+static const char *proc289 = 
+"#line 23 \"[executable]/dav_acct.sql\"\n"
 "create function DAV_SPACE_QUOTA_PARENT (in res_path varchar, out _u_id integer, out _above_hy datetime, out _dav_use numeric, out _total_use numeric, out _quota numeric) returns varchar\n"
 "{\n"
 "declare head, tail, _home_path varchar;\n"
@@ -13255,9 +13728,10 @@ static const char *proc284 =
 "\n"
 "return _home_path;\n"
 "}\n"
-"--src dav_acct.sql:22\n";
+"--src dav_acct.sql:21\n";
 
-static const char *proc285 = 
+static const char *proc290 = 
+"#line 61 \"[executable]/dav_acct.sql\"\n"
 "create function DAV_ADD_SPACE_QUOTA (in _home_path varchar, in _u_id integer, in _quota numeric) returns integer\n"
 "{\n"
 "declare home_id any;\n"
@@ -13345,9 +13819,10 @@ static const char *proc285 =
 "}\n"
 "return home_id;\n"
 "}\n"
-"--src dav_acct.sql:60\n";
+"--src dav_acct.sql:59\n";
 
-static const char *proc286 = 
+static const char *proc291 = 
+"#line 150 \"[executable]/dav_acct.sql\"\n"
 "create function DAV_DEL_SPACE_QUOTA (in _home_path varchar) returns integer\n"
 "{\n"
 "declare old_u_id integer;\n"
@@ -13363,9 +13838,10 @@ static const char *proc286 =
 "nf:\n"
 "return -1;\n"
 "}\n"
-"--src dav_acct.sql:149\n";
+"--src dav_acct.sql:148\n";
 
-static const char *proc287 = 
+static const char *proc292 = 
+"#line 167 \"[executable]/dav_acct.sql\"\n"
 "create procedure DAV_SPACE_QUOTA_YELLOW_TRACK (in _home_path varchar, in _u_id integer, in old_above_hy datetime, in total_use numeric, in _quota numeric)\n"
 "{\n"
 "\n"
@@ -13397,9 +13873,10 @@ static const char *proc287 =
 "}\n"
 "}\n"
 "}\n"
-"--src dav_acct.sql:166\n";
+"--src dav_acct.sql:165\n";
 
-static const char *proc288 = 
+static const char *proc293 = 
+"#line 200 \"[executable]/dav_acct.sql\"\n"
 "create procedure DAV_SPACE_QUOTA_SIGNAL (in res_path varchar, in home_path varchar, in _u_id integer, in _total_use numeric, in _quota numeric)\n"
 "{\n"
 "declare u_descr, msg varchar;\n"
@@ -13424,9 +13901,10 @@ static const char *proc288 =
 "\n"
 "signal (\'HT507\', msg);\n"
 "}\n"
-"--src dav_acct.sql:199\n";
+"--src dav_acct.sql:198\n";
 
-static const char *proc289 = 
+static const char *proc294 = 
+"#line 226 \"[executable]/dav_acct.sql\"\n"
 "create procedure DAV_OWNER_DISABLED_SIGNAL (in res_path varchar, in _u_id integer)\n"
 "{\n"
 "declare u_descr, msg varchar;\n"
@@ -13442,9 +13920,10 @@ static const char *proc289 =
 "\n"
 "signal (\'HT508\', msg);\n"
 "}\n"
-"--src dav_acct.sql:225\n";
+"--src dav_acct.sql:224\n";
 
-static const char *proc290 = 
+static const char *proc295 = 
+"#line 243 \"[executable]/dav_acct.sql\"\n"
 "create procedure DAV_HOME_DISABLED_SIGNAL (in res_path varchar, in home_path varchar, in _u_id integer)\n"
 "{\n"
 "declare u_descr, msg varchar;\n"
@@ -13458,9 +13937,10 @@ static const char *proc290 =
 "\n"
 "signal (\'HT509\', msg);\n"
 "}\n"
-"--src dav_acct.sql:242\n";
+"--src dav_acct.sql:241\n";
 
-static const char *proc291 = 
+static const char *proc296 = 
+"#line 258 \"[executable]/dav_acct.sql\"\n"
 "create procedure DAV_SPACE_QUOTA_RES_INSERT (in newr_path varchar, in newr_len integer)\n"
 "{\n"
 "declare parent_path varchar;\n"
@@ -13494,9 +13974,10 @@ static const char *proc291 =
 "\n"
 " ;\n"
 "}\n"
-"--src dav_acct.sql:257\n";
+"--src dav_acct.sql:256\n";
 
-static const char *proc292 = 
+static const char *proc297 = 
+"#line 293 \"[executable]/dav_acct.sql\"\n"
 "create procedure DAV_SPACE_QUOTA_RES_DELETE (in oldr_path varchar, in oldr_len integer)\n"
 "{\n"
 "declare parent_path varchar;\n"
@@ -13536,9 +14017,10 @@ static const char *proc292 =
 "\n"
 " ;\n"
 "}\n"
-"--src dav_acct.sql:292\n";
+"--src dav_acct.sql:291\n";
 
-static const char *proc293 = 
+static const char *proc298 = 
+"#line 334 \"[executable]/dav_acct.sql\"\n"
 "create procedure DAV_SPACE_QUOTA_RES_UPDATE (in oldr_path varchar, in oldr_len integer, in newr_path varchar, in newr_len integer)\n"
 "{\n"
 "declare src_path, tgt_path varchar;\n"
@@ -13631,18 +14113,20 @@ static const char *proc293 =
 "\n"
 " ;\n"
 "}\n"
-"--src dav_acct.sql:333\n";
+"--src dav_acct.sql:332\n";
 
 /* dav_rdf_quad.sql */
 
-static const char *proc294 = 
+static const char *proc299 = 
+"#line 23 \"[executable]/dav_rdf_quad.sql\"\n"
 "create procedure DB.DBA.RDF_DELETE_ENTIRE_GRAPH (in new_dav_graph varchar, in param integer)\n"
 "{\n"
 "delete from DB.DBA.RDF_QUAD where G = DB.DBA.RDF_MAKE_IID_OF_QNAME (new_dav_graph);\n"
 "}\n"
-"--src dav_rdf_quad.sql:22\n";
+"--src dav_rdf_quad.sql:21\n";
 
-static const char *proc295 = 
+static const char *proc300 = 
+"#line 29 \"[executable]/dav_rdf_quad.sql\"\n"
 "create function DB.DBA.DAV_FULL_PATH_TO_IRI (in dav_iri varchar, in _str varchar) returns varchar\n"
 "{\n"
 "declare _ses any;\n"
@@ -13651,9 +14135,10 @@ static const char *proc295 =
 "http_escape (subseq (_str, 4), 7, _ses, 0, 1);\n"
 "return string_output_string(_ses);\n"
 "}\n"
-"--src dav_rdf_quad.sql:28\n";
+"--src dav_rdf_quad.sql:27\n";
 
-static const char *proc296 = 
+static const char *proc301 = 
+"#line 39 \"[executable]/dav_rdf_quad.sql\"\n"
 "create procedure DB.DBA.DAV_AUTO_REPLICATE_TO_RDF_QUAD ()\n"
 "{\n"
 "declare uriqa_default_host, old_dav_graph, new_dav_graph varchar;\n"
@@ -13664,9 +14149,10 @@ static const char *proc296 =
 "return;\n"
 "DB.DBA.DAV_REPLICATE_ALL_TO_RDF_QUAD (1);\n"
 "}\n"
-"--src dav_rdf_quad.sql:38\n";
+"--src dav_rdf_quad.sql:37\n";
 
-static const char *proc297 = 
+static const char *proc302 = 
+"#line 51 \"[executable]/dav_rdf_quad.sql\"\n"
 "create procedure DB.DBA.DAV_REPLICATE_ALL_TO_RDF_QUAD (in enable integer)\n"
 "{\n"
 "declare uriqa_default_host, old_dav_graph, new_dav_graph varchar;\n"
@@ -13674,8 +14160,10 @@ static const char *proc297 =
 "uriqa_default_host := cfg_item_value (virtuoso_ini_path (), \'URIQA\',\'DefaultHost\');\n"
 "if (uriqa_default_host is null or uriqa_default_host = \'\')\n"
 "signal (\'OBLOM\', \'No uriqa_default_host!\');\n"
-"\n"
+"if (cfg_item_value (virtuoso_ini_path (), \'URIQA\', \'DynamicLocal\') = \'1\')\n"
 "new_dav_graph := \'local:/DAV\';\n"
+"else\n"
+"new_dav_graph := sprintf (\'http://%s/DAV\', uriqa_default_host);\n"
 "exec (\'checkpoint\');\n"
 "__atomic (1);\n"
 "DB.DBA.RDF_DELETE_ENTIRE_GRAPH (new_dav_graph, 1);\n"
@@ -13728,9 +14216,10 @@ static const char *proc297 =
 "exec (\'checkpoint\');\n"
 "return;\n"
 "}\n"
-"--src dav_rdf_quad.sql:50\n";
+"--src dav_rdf_quad.sql:49\n";
 
-static const char *proc298 = 
+static const char *proc303 = 
+"#line 116 \"[executable]/dav_rdf_quad.sql\"\n"
 "create procedure DB.DBA.RDF_CBD_DELETE (inout triple_list any, in graph_id any, in local_dav_uri any)\n"
 "{\n"
 "declare not_deleteable, candidates any;\n"
@@ -13803,9 +14292,10 @@ static const char *proc298 =
 "if (0 <> length (triple_list))\n"
 "goto again;\n"
 "}\n"
-"--src dav_rdf_quad.sql:113\n";
+"--src dav_rdf_quad.sql:114\n";
 
-static const char *proc299 = 
+static const char *proc304 = 
+"#line 190 \"[executable]/dav_rdf_quad.sql\"\n"
 "create procedure DB.DBA.DAV_RDF_URI_RESOLVE (in dav_rdf_graph_uri varchar, in iri any, in fullpath varchar, in res_type varchar) returns varchar\n"
 "{\n"
 "declare abs_uri varchar;\n"
@@ -13830,9 +14320,10 @@ static const char *proc299 =
 "}\n"
 "return abs_uri;\n"
 "}\n"
-"--src dav_rdf_quad.sql:187\n";
+"--src dav_rdf_quad.sql:188\n";
 
-static const char *proc300 = 
+static const char *proc305 = 
+"#line 216 \"[executable]/dav_rdf_quad.sql\"\n"
 "create procedure DB.DBA.DAV_RDF_REPLICATE_INT (in res_id integer, in restype varchar, in fullpath varchar)\n"
 "{\n"
 "declare n3v, n3_list, dav_rdf_graph_iid any;\n"
@@ -13871,9 +14362,10 @@ static const char *proc300 =
 "}\n"
 "no_op:;\n"
 "}\n"
-"--src dav_rdf_quad.sql:213\n";
+"--src dav_rdf_quad.sql:214\n";
 
-static const char *proc301 = 
+static const char *proc306 = 
+"#line 256 \"[executable]/dav_rdf_quad.sql\"\n"
 "create procedure DB.DBA.DAV_RDF_CBD_DELETE_PROP (in n3v any, in fullpath varchar, in restype varchar, in dav_rdf_graph_iid IRI_ID, in dav_rdf_graph_uri varchar)\n"
 "{\n"
 "declare n3_list, triple_list any;\n"
@@ -13912,9 +14404,10 @@ static const char *proc301 =
 "vectorbld_final (triple_list);\n"
 "DB.DBA.RDF_CBD_DELETE (triple_list, dav_rdf_graph_iid, dav_rdf_graph_uri);\n"
 "}\n"
-"--src dav_rdf_quad.sql:253\n";
+"--src dav_rdf_quad.sql:254\n";
 
-static const char *proc302 = 
+static const char *proc307 = 
+"#line 296 \"[executable]/dav_rdf_quad.sql\"\n"
 "create function DB.DBA.DAV_MAKE_USER_IRI (in userid integer)\n"
 "{\n"
 "declare email varchar;\n"
@@ -13934,9 +14427,10 @@ static const char *proc302 =
 "}\n"
 "return email;\n"
 "}\n"
-"--src dav_rdf_quad.sql:293\n";
+"--src dav_rdf_quad.sql:294\n";
 
-static const char *proc303 = 
+static const char *proc308 = 
+"#line 317 \"[executable]/dav_rdf_quad.sql\"\n"
 "create procedure DB.DBA.DAV_REPLICATE_RES_TO_RDF_QUAD (in res_id2 integer, in fullpath varchar)\n"
 "{\n"
 "declare dav_rdf_graph_uri, new_uri, tags, email varchar;\n"
@@ -13967,9 +14461,10 @@ static const char *proc303 =
 "update WS.WS.SYS_DAV_RES set RES_IID=new_iid where RES_ID = res_id2;\n"
 "set triggers on;\n"
 "}\n"
-"--src dav_rdf_quad.sql:314\n";
+"--src dav_rdf_quad.sql:315\n";
 
-static const char *proc304 = 
+static const char *proc309 = 
+"#line 349 \"[executable]/dav_rdf_quad.sql\"\n"
 "create procedure DB.DBA.DAV_REPLICATE_COL_TO_RDF_QUAD (in col_id2 integer)\n"
 "{\n"
 "declare dav_rdf_graph_uri, fullpath, new_uri varchar;\n"
@@ -13996,9 +14491,10 @@ static const char *proc304 =
 "update WS.WS.SYS_DAV_COL set COL_IID=new_iid where COL_ID = col_id2;\n"
 "set triggers on;\n"
 "}\n"
-"--src dav_rdf_quad.sql:346\n";
+"--src dav_rdf_quad.sql:347\n";
 
-static const char *trig21 = 
+static const char *trig23 = 
+"#line 377 \"[executable]/dav_rdf_quad.sql\"\n"
 "create trigger SYS_DAV_PROP_AFTER_INSERT_PROP after insert on WS.WS.SYS_DAV_PROP referencing new as N\n"
 "{\n"
 "declare perms varchar;\n"
@@ -14021,9 +14517,10 @@ static const char *trig21 =
 "}\n"
 "no_op: ;\n"
 "}\n"
-"--src dav_rdf_quad.sql:374\n";
+"--src dav_rdf_quad.sql:375\n";
 
-static const char *trig22 = 
+static const char *trig24 = 
+"#line 401 \"[executable]/dav_rdf_quad.sql\"\n"
 "create trigger SYS_DAV_PROP_RDF_QUAD_BEFORE_DELETE before delete on WS.WS.SYS_DAV_PROP referencing old as O\n"
 "{\n"
 "declare fullpath, perms varchar;\n"
@@ -14044,9 +14541,10 @@ static const char *trig22 =
 "DB.DBA.DAV_RDF_CBD_DELETE_PROP (n3_tmp_list, fullpath, O.PROP_TYPE, dav_rdf_graph_iid, dav_rdf_graph_uri);\n"
 "}\n"
 "}\n"
-"--src dav_rdf_quad.sql:398\n";
+"--src dav_rdf_quad.sql:399\n";
 
-static const char *trig23 = 
+static const char *trig25 = 
+"#line 423 \"[executable]/dav_rdf_quad.sql\"\n"
 "create trigger SYS_DAV_PROP_RDF_QUAD_AFTER_UPDATE after update on WS.WS.SYS_DAV_PROP referencing new as N, old as O\n"
 "{\n"
 "declare fullpath, perms varchar;\n"
@@ -14086,9 +14584,10 @@ static const char *trig23 =
 "}\n"
 "}\n"
 "}\n"
-"--src dav_rdf_quad.sql:420\n";
+"--src dav_rdf_quad.sql:421\n";
 
-static const char *trig24 = 
+static const char *trig26 = 
+"#line 465 \"[executable]/dav_rdf_quad.sql\"\n"
 "create trigger SYS_DAV_TAG_RDF_QUAD_AFTER_INSERT after insert on WS.WS.SYS_DAV_TAG referencing new as NT\n"
 "{\n"
 "declare tag_list any;\n"
@@ -14106,9 +14605,10 @@ static const char *trig24 =
 "DB.DBA.RDF_QUAD_URI_L (dav_rdf_graph_uri, new_uri, \'http://www.openlinksw.com/schemas/DAV#tag\', tag);\n"
 "nf: ;\n"
 "}\n"
-"--src dav_rdf_quad.sql:462\n";
+"--src dav_rdf_quad.sql:463\n";
 
-static const char *trig25 = 
+static const char *trig27 = 
+"#line 485 \"[executable]/dav_rdf_quad.sql\"\n"
 "create trigger SYS_DAV_TAG_RDF_QUAD_AFTER_UPDATE after update on WS.WS.SYS_DAV_TAG referencing new as NT\n"
 "{\n"
 "declare tag_list, dav_rdf_graph_iid, new_iid, p_iid any;\n"
@@ -14130,9 +14630,10 @@ static const char *trig25 =
 "DB.DBA.RDF_QUAD_URI_L (dav_rdf_graph_uri, new_uri, \'http://www.openlinksw.com/schemas/DAV#tag\', tag);\n"
 "nf: ;\n"
 "}\n"
-"--src dav_rdf_quad.sql:482\n";
+"--src dav_rdf_quad.sql:483\n";
 
-static const char *trig26 = 
+static const char *trig28 = 
+"#line 509 \"[executable]/dav_rdf_quad.sql\"\n"
 "create trigger SYS_DAV_TAG_RDF_QUAD_BEFORE_DELETE before delete on WS.WS.SYS_DAV_TAG referencing old as OT\n"
 "{\n"
 "declare tag_list, dav_rdf_graph_iid, old_iid, p_iid any;\n"
@@ -14149,17 +14650,19 @@ static const char *trig26 =
 "delete from DB.DBA.RDF_QUAD where P = p_iid and G = dav_rdf_graph_iid and S = old_iid;\n"
 "nf: ;\n"
 "}\n"
-"--src dav_rdf_quad.sql:506\n";
+"--src dav_rdf_quad.sql:507\n";
 
-static const char *trig27 = 
+static const char *trig29 = 
+"#line 528 \"[executable]/dav_rdf_quad.sql\"\n"
 "create trigger SYS_DAV_RES_RDF_QUAD_AFTER_INSERT after insert on WS.WS.SYS_DAV_RES order 30 referencing new as N\n"
 "{\n"
 "if (N.RES_PERMS[6] = 49)\n"
 "DB.DBA.DAV_REPLICATE_RES_TO_RDF_QUAD (N.RES_ID, N.RES_FULL_PATH);\n"
 "}\n"
-"--src dav_rdf_quad.sql:525\n";
+"--src dav_rdf_quad.sql:526\n";
 
-static const char *trig28 = 
+static const char *trig30 = 
+"#line 535 \"[executable]/dav_rdf_quad.sql\"\n"
 "create trigger SYS_DAV_RES_RDF_QUAD_AFTER_UPDATE after update (RES_COL, RES_NAME, RES_FULL_PATH, RES_PERMS, RES_OWNER, RES_CONTENT, RES_CR_TIME, RES_MOD_TIME) on WS.WS.SYS_DAV_RES order 30 referencing new as NC, old as OC\n"
 "{\n"
 "declare new_iid, dav_rdf_graph_iid, p_iid any;\n"
@@ -14233,9 +14736,10 @@ static const char *trig28 =
 "DB.DBA.RDF_QUAD_URI_L (dav_rdf_graph_uri, new_uri, \'http://purl.org/dc/terms/modified\', NC.RES_MOD_TIME);\n"
 "}\n"
 "}\n"
-"--src dav_rdf_quad.sql:532\n";
+"--src dav_rdf_quad.sql:533\n";
 
-static const char *trig29 = 
+static const char *trig31 = 
+"#line 611 \"[executable]/dav_rdf_quad.sql\"\n"
 "create trigger SYS_DAV_RES_RDF_QUAD_BEFORE_DELETE before delete on WS.WS.SYS_DAV_RES order 30 referencing old as OC\n"
 "{\n"
 "declare spo, dav_rdf_graph_uri, dav_rdf_graph_iid any;\n"
@@ -14249,17 +14753,19 @@ static const char *trig29 =
 "RDF_CBD_DELETE (spo, dav_rdf_graph_iid, dav_rdf_graph_uri);\n"
 "}\n"
 "}\n"
-"--src dav_rdf_quad.sql:608\n";
+"--src dav_rdf_quad.sql:609\n";
 
-static const char *trig30 = 
+static const char *trig32 = 
+"#line 627 \"[executable]/dav_rdf_quad.sql\"\n"
 "create trigger SYS_DAV_COL_RDF_QUAD_AFTER_CREATE after insert on WS.WS.SYS_DAV_COL order 30 referencing new as NC\n"
 "{\n"
 "if (NC.COL_PERMS[6] = 49)\n"
 "DB.DBA.DAV_REPLICATE_COL_TO_RDF_QUAD (NC.COL_ID);\n"
 "}\n"
-"--src dav_rdf_quad.sql:624\n";
+"--src dav_rdf_quad.sql:625\n";
 
-static const char *proc305 = 
+static const char *proc310 = 
+"#line 635 \"[executable]/dav_rdf_quad.sql\"\n"
 "create procedure DB.DBA.DAV_RDF_PROPAGATE_COL_PATH_CHANGE (\n"
 "in dav_rdf_graph_uri varchar, in dav_rdf_graph_iid IRI_ID,\n"
 "in colid integer, in colispublic integer,\n"
@@ -14317,9 +14823,10 @@ static const char *proc305 =
 "}\n"
 "}\n"
 "}\n"
-"--src dav_rdf_quad.sql:632\n";
+"--src dav_rdf_quad.sql:633\n";
 
-static const char *trig31 = 
+static const char *trig33 = 
+"#line 695 \"[executable]/dav_rdf_quad.sql\"\n"
 "create trigger SYS_DAV_COL_RDF_QUAD_AFTER_UPDATE after update (COL_NAME, COL_PARENT, COL_PERMS, COL_OWNER, COL_CR_TIME, COL_MOD_TIME) on WS.WS.SYS_DAV_COL order 30 referencing new as NC, old as OC\n"
 "{\n"
 "declare new_iid, dav_rdf_graph_iid, p_iid any;\n"
@@ -14392,9 +14899,10 @@ static const char *trig31 =
 "DB.DBA.RDF_QUAD_URI_L (dav_rdf_graph_uri, new_uri, \'http://purl.org/dc/terms/modified\', NC.COL_MOD_TIME);\n"
 "}\n"
 "}\n"
-"--src dav_rdf_quad.sql:692\n";
+"--src dav_rdf_quad.sql:693\n";
 
-static const char *trig32 = 
+static const char *trig34 = 
+"#line 770 \"[executable]/dav_rdf_quad.sql\"\n"
 "create trigger SYS_DAV_COL_RDF_QUAD_BEFORE_DELETE before delete on WS.WS.SYS_DAV_COL order 30 referencing old as OC\n"
 "{\n"
 "declare spo, dav_rdf_graph_uri, dav_rdf_graph_iid any;\n"
@@ -14408,11 +14916,12 @@ static const char *trig32 =
 "RDF_CBD_DELETE (spo, dav_rdf_graph_iid, dav_rdf_graph_uri);\n"
 "}\n"
 "}\n"
-"--src dav_rdf_quad.sql:767\n";
+"--src dav_rdf_quad.sql:768\n";
 
 /* vfs.sql */
 
-static const char *proc306 = 
+static const char *proc311 = 
+"#line 31 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.COPY_PAGE (in _host varchar, in _urls any, in _root varchar, in _upd integer, in _dbg integer)\n"
 "{\n"
 "\n"
@@ -14439,9 +14948,10 @@ static const char *proc306 =
 "};\n"
 "return WS.WS.COPY_PAGE_1 (_host, _urls, _root, _upd, _dbg); \n"
 "}\n"
-"--src vfs.sql:30\n";
+"--src vfs.sql:29\n";
 
-static const char *proc307 = 
+static const char *proc312 = 
+"#line 59 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.VFS_HTTP_RESP_CODE (inout _resp any)\n"
 "{\n"
 "declare _tmp varchar;\n"
@@ -14450,9 +14960,10 @@ static const char *proc307 =
 "_tmp := subseq (_tmp, 0, strchr (_tmp, \' \'));\n"
 "return _tmp;\n"
 "}\n"
-"--src vfs.sql:58\n";
+"--src vfs.sql:57\n";
 
-static const char *proc308 = 
+static const char *proc313 = 
+"#line 69 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.VFS_ENSURE_NEW_SITE (in _host varchar, in _root varchar, in _new_host varchar, in _new_url varchar)\n"
 "{\n"
 "if (not exists (select 1 from VFS_SITE where VS_HOST = _new_host and VS_ROOT = _new_host))\n"
@@ -14462,21 +14973,23 @@ static const char *proc308 =
 "from VFS_SITE where VS_HOST = _host and VS_ROOT = _root;\n"
 "}\n"
 "}\n"
-"--src vfs.sql:68\n";
+"--src vfs.sql:67\n";
 
-static const char *proc309 = 
+static const char *proc314 = 
+"#line 80 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.COPY_PAGE_1 (in _host varchar, in _urls any, in _root varchar,\n"
 "in _upd integer, in _dbg integer)\n"
 "{\n"
 "declare _header, _etag, _http_resp_code, _start_url varchar;\n"
 "declare _del, _desc, _t_urls, _opts, _c_type varchar;\n"
 "declare _dav_method, _d_imgs, _opage varchar;\n"
-"declare _dav_enabled, _other varchar;\n"
+"declare _dav_enabled, _other, ua varchar;\n"
 "declare dt, redir_flag, store_flag, try_to_get_rdf integer;\n"
 "declare _since datetime;\n"
-"declare _udata, ext_hook, store_hook, _header_arr, _resps any;\n"
-"declare n_urls int;\n"
+"declare _udata, ext_hook, store_hook, _header_arr, _resps, xp_exp any;\n"
+"declare n_urls, conv_html, is_sitemap, accept_rdf int;\n"
 "\n"
+"conv_html := 1;\n"
 "n_urls := position (0, _urls) - 1;\n"
 "if (n_urls < 0)\n"
 "n_urls := length (_urls);\n"
@@ -14484,10 +14997,12 @@ static const char *proc309 =
 "whenever not found goto nf_opt;\n"
 "select VS_NEWER, VS_OPTIONS, coalesce (VS_METHOD, \'\'), VS_URL, VS_SRC, coalesce (VS_OPAGE, \'\'),\n"
 "coalesce (VS_REDIRECT, 1), coalesce (VS_STORE, 1), coalesce (VS_DLOAD_META, 0), \n"
-"deserialize (VS_UDATA), VS_EXTRACT_FN, VS_STORE_FN, coalesce (VS_DEL, \'\'), coalesce (VS_OTHER, \'\')\n"
+"deserialize (VS_UDATA), VS_EXTRACT_FN, VS_STORE_FN, coalesce (VS_DEL, \'\'), coalesce (VS_OTHER, \'\'), \n"
+"VS_CONVERT_HTML, VS_IS_SITEMAP, VS_XPATH, VS_ACCEPT_RDF\n"
 "into _since, _opts, _dav_method, _start_url, _d_imgs, _opage, \n"
 "redir_flag, store_flag, try_to_get_rdf, \n"
-"_udata, ext_hook, store_hook, _del, _other\n"
+"_udata, ext_hook, store_hook, _del, _other, \n"
+"conv_html, is_sitemap, xp_exp, accept_rdf\n"
 "from VFS_SITE where VS_HOST = _host and VS_ROOT = _root;\n"
 "nf_opt:\n"
 "\n"
@@ -14498,8 +15013,15 @@ static const char *proc309 =
 "if (_upd = 1 and _since is not null)\n"
 "_header := concat (_header, \'If-Modified-Since: \', soap_print_box (_since, \'\', 1), \'\\r\\n\');\n"
 "\n"
-"if (try_to_get_rdf)\n"
-"_header := _header || \'Accept: application/rdf+xml, text/rdf+n3, */*\\r\\n\';\n"
+"if (accept_rdf)\n"
+"_header := _header || \'Accept: application/rdf+xml, text/n3, text/rdf+n3, */*\\r\\n\';\n"
+"\n"
+"ua := registry_get (\'vfs_ua\');\n"
+"if (isstring (ua) and length (ua))\n"
+"{\n"
+"ua := trim (ua, \' \\r\\n\');\n"
+"_header := _header || \'User-Agent: \' || ua || \'\\r\\n\';\n"
+"}\n"
 "\n"
 "if (_upd = 1)  \n"
 "{\n"
@@ -14540,7 +15062,7 @@ static const char *proc309 =
 "}\n"
 "dav_urls := WS.WS.DAV_PROP (WS.WS.MAKE_URL (_host, _url), _d_imgs, _header);\n"
 "lev := coalesce ((select VQ_LEVEL from VFS_QUEUE where VQ_HOST = _host and VQ_ROOT = _root and VQ_URL = _url), 0);\n"
-"WS.WS.GET_URLS (_host, _url, _root, dav_urls, lev + 1);\n"
+"WS.WS.GET_URLS (_host, _url, _root, dav_urls, lev + 1, null);\n"
 "}\n"
 "\n"
 "html_mode:\n"
@@ -14580,6 +15102,14 @@ static const char *proc309 =
 "{\n"
 "declare _resp, _content any;\n"
 "_content := http_get (_t_urls[0], _resp, \'GET\', case when _upd = 1 then _header_arr[0] else _header_arr end);\n"
+"\n"
+"if (isarray(_resp) and length (_resp) and not isstring (_resp [0]))\n"
+"{\n"
+"if (retr <= 0)\n"
+"signal (\'2E000\', \'Bad header received\');\n"
+"else\n"
+"goto get_again;\n"
+"}\n"
 "_resps := vector (vector (_content, _resp));\n"
 "}\n"
 "else\n"
@@ -14617,24 +15147,10 @@ static const char *proc309 =
 "new_host := ht[1];\n"
 "ht[0] := \'\'; ht[1] := \'\'; \n"
 "new_url := VFS_URI_COMPOSE (ht);\n"
-"if (_host = new_host)\n"
-"{\n"
+"if (_host <> new_host)\n"
+"new_url := new_loc;\n"
 "insert soft VFS_QUEUE (VQ_HOST, VQ_ROOT, VQ_URL, VQ_STAT, VQ_TS, VQ_LEVEL) \n"
 "values (_host, _root, new_url, \'waiting\', now (), lev + 1);\n"
-"}\n"
-"else if (_other = \'checked\')\n"
-"{\n"
-"if (ext_hook is not null and __proc_exists (ext_hook))\n"
-"{\n"
-"WS.WS.SITEMAP_ENSURE_NEW_SITE (_host, _root, new_host, new_url); \n"
-"}\n"
-"else\n"
-"{\n"
-"WS.WS.VFS_ENSURE_NEW_SITE (_host, _root, new_host, new_url);\n"
-"}\n"
-"insert soft VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_OTHER, VQ_LEVEL)\n"
-"values (new_host, now (), new_url, \'waiting\', new_host, \'other\', lev + 1);\n"
-"}\n"
 "goto end_crawl;\n"
 "}\n"
 "\n"
@@ -14645,14 +15161,15 @@ static const char *proc309 =
 "{\n"
 "if (ext_hook is not null and __proc_exists (ext_hook))\n"
 "call (ext_hook) (_host, _url, _root, _content, _c_type, lev + 1);\n"
-"else if ((_url like \'%.htm%\' or _url like \'%/\' or _c_type like \'text/html%\') and _dav_method <> \'checked\' and _opage <> \'checked\')\n"
-"WS.WS.GET_URLS (_host, _url, _root, _content, lev + 1);\n"
+"else if ((_url like \'%.htm%\' or _url like \'%/\' or _c_type like \'text/html%\' or _c_type like \'application/%xml\' or _c_type = \'text/xml\' or _url like \'%.xml\' or _url like \'%.xml.gz\') \n"
+"and _dav_method <> \'checked\' and _opage <> \'checked\')\n"
+"WS.WS.GET_URLS (_host, _url, _root, _content, lev + 1, _c_type);\n"
 "\n"
 "if (store_hook is not null and __proc_exists (store_hook))\n"
 "call (store_hook) (_host, _url, _root, _content, _etag, _c_type, store_flag, _udata, lev + 1);\n"
 "else \n"
 "{\n"
-"WS.WS.LOCAL_STORE (_host, _url, _root, _content, _etag, _c_type, store_flag);\n"
+"WS.WS.LOCAL_STORE (_host, _url, _root, _content, _etag, _c_type, store_flag, conv_html);\n"
 "if (try_to_get_rdf)\n"
 "WS.WS.VFS_EXTRACT_RDF (_host, _root, _start_url, _udata, _url, _content, _c_type, _header, _resp);\n"
 "}\n"
@@ -14674,24 +15191,61 @@ static const char *proc309 =
 "commit work;\n"
 "return;\n"
 "}\n"
-"--src vfs.sql:79\n";
+"--src vfs.sql:78\n";
 
-static const char *proc310 = 
+static const char *proc315 = 
+"#line 297 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.DELETE_LOCAL_COPY (in _host varchar, in _url varchar, in _root varchar)\n"
 "{\n"
 "delete from VFS_URL where VU_HOST = _host and VU_URL = _url and VU_ROOT = _root;\n"
 "delete from SYS_DAV_RES where RES_FULL_PATH = concat (\'/DAV/\', _root, _url);\n"
 "}\n"
-"--src vfs.sql:291\n";
+"--src vfs.sql:295\n";
 
-static const char *proc311 = 
+static const char *proc316 = 
+"#line 304 \"[executable]/vfs.sql\"\n"
+"create procedure WS.WS.VFS_RUN (in url varchar, in threads int := null, in batch_size int := 1, in fn varchar := null, in dta any := null)\n"
+"{\n"
+"declare h, host, s_url, root_collection  any;\n"
+"h := rfc1808_parse_uri (url);\n"
+"host := h[1];\n"
+"s_url := h[2];\n"
+"root_collection := (select top 1 VS_ROOT from WS.WS.VFS_SITE where VS_HOST = host and VS_URL = s_url);\n"
+"WS.WS.SERV_QUEUE_TOP (host, root_collection, 0, 0, fn, dta, threads, batch_size);\n"
+"}\n"
+"--src vfs.sql:302\n";
+
+static const char *proc317 = 
+"#line 315 \"[executable]/vfs.sql\"\n"
+"create procedure WS.WS.VFS_STATUS_GET (in _tgt varchar, in _root varchar)\n"
+"{\n"
+"declare rc any;\n"
+"rc := registry_get (sprintf (\'__VFS_%s_%s\', _tgt, _root));\n"
+"if (not isstring (rc))\n"
+"rc := \'not started\';\n"
+"return rc;  \n"
+"}\n"
+"--src vfs.sql:313\n";
+
+static const char *proc318 = 
+"#line 325 \"[executable]/vfs.sql\"\n"
+"create procedure WS.WS.VFS_STATUS_SET (in _tgt varchar, in _root varchar, in _stat varchar)\n"
+"{\n"
+"return registry_set (sprintf (\'__VFS_%s_%s\', _tgt, _root), _stat);\n"
+"}\n"
+"--src vfs.sql:323\n";
+
+static const char *proc319 = 
+"#line 332 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.SERV_QUEUE_TOP (in _tgt varchar, in _root varchar, in _upd integer,\n"
-"in _dbg integer, in _fn varchar, in _clnt_data any, in threads int := 1, in batch_size int := 1)\n"
+"in _dbg integer, in _fn varchar, in _clnt_data any, in threads int := null, in batch_size int := 1)\n"
 "{\n"
 "declare _msg, _stat, oq varchar;\n"
 "do_again:\n"
 "_stat := \'00000\';\n"
 "_msg := \'\';\n"
+"WS.WS.VFS_STATUS_SET (_tgt, _root, \'running\');\n"
+"commit work;\n"
 "exec (\'WS.WS.SERV_QUEUE (?, ?, ?, ?, ?, ?, ?, ?)\', _stat, _msg,\n"
 "vector (_tgt, _root, _upd, _dbg, _fn, _clnt_data, threads, batch_size));\n"
 "if (_stat = \'40001\')\n"
@@ -14699,63 +15253,55 @@ static const char *proc311 =
 "rollback work;\n"
 "goto do_again;\n"
 "}\n"
-"commit work;\n"
-"oq := (select DB.DBA.VECTOR_AGG (vector (HOST, ROOT)) from (select distinct VQ_HOST as HOST, VQ_ROOT as ROOT \n"
-"from VFS_QUEUE where VQ_STAT = \'waiting\' and VQ_OTHER = \'other\') x);\n"
-"commit work;\n"
-"do_again1:  \n"
-"foreach (any elm in oq) do\n"
-"{\n"
-"_stat := \'00000\';\n"
-"_msg := \'\';\n"
-"exec (\'WS.WS.SERV_QUEUE (?, ?, ?, ?, ?, ?, ?, ?)\', _stat, _msg,\n"
-"vector (elm[0], elm[1], _upd, _dbg, _fn, _clnt_data, threads, batch_size));\n"
-"if (_stat = \'40001\')\n"
+"if (_stat <> \'00000\')\n"
 "{\n"
-"rollback work;\n"
-"goto do_again1;\n"
+"WS.WS.VFS_STATUS_SET (_tgt, _root, \'error\');\n"
+"signal (_stat, _msg);\n"
 "}\n"
 "commit work;\n"
-"}\n"
-"oq := (select DB.DBA.VECTOR_AGG (vector (HOST, ROOT)) from (select distinct VQ_HOST as HOST, VQ_ROOT as ROOT \n"
-"from VFS_QUEUE where VQ_STAT = \'waiting\' and VQ_OTHER = \'other\') x);\n"
-"if (length (oq) > 0)\n"
-"{\n"
-"commit work;\n"
-"goto do_again1;\n"
-"}    \n"
+"if (WS.WS.VFS_STATUS_GET (_tgt, _root) = \'running\' and \n"
+"not exists (select 1 from WS.WS.VFS_QUEUE where VQ_STAT = \'waiting\' and VQ_HOST = _tgt and VQ_ROOT = _root))\n"
+"WS.WS.VFS_STATUS_SET (_tgt, _root, \'done\');\n"
 "\n"
 "}\n"
-"--src vfs.sql:300\n";
+"--src vfs.sql:330\n";
 
-static const char *proc312 = 
-"create procedure WS.WS.SERV_QUEUE (in __tgt varchar, in __root varchar, in _upd integer,\n"
-"in _dbg integer, in _fn varchar, in _clnt_data any, in nthreads int := 1, in batch_size int := 1)\n"
+static const char *proc320 = 
+"#line 366 \"[executable]/vfs.sql\"\n"
+"create procedure WS.WS.SERV_QUEUE (in _tgt varchar, in _root varchar, in _upd integer,\n"
+"in _dbg integer, in _fn varchar, in _clnt_data any, in nthreads int := null, in batch_size int := 1)\n"
 "{\n"
 "declare _total, active_thread integer;\n"
 "declare _rc integer;\n"
 "declare _tgt_url varchar;\n"
 "declare url_fn varchar;\n"
 "declare _last_shut integer;\n"
-"declare _tgt, _root varchar;\n"
 "declare _next_url varchar;\n"
 "declare _dav_method varchar;\n"
 "declare aq_list, aq, url_batch any;\n"
 "declare err any;\n"
-"declare pid int;\n"
+"declare pid, thr_conf, care_bot int;\n"
 "\n"
 "_total := 0;\n"
-"_tgt := __tgt;\n"
-"_root := __root;\n"
 "registry_set (\'WEB_COPY\', \'X __sequence_set (\'\'WEB_COPY_SSHUT\'\', datediff (\'\'second\'\', stringdate (\'\'1980-01-01\'\'), now ()), 0)\');\n"
-"_last_shut := coalesce (sequence_set (\'WEB_COPY_SSHUT\', 0, 2), 0);\n"
 "\n"
-"update WS.WS.VFS_QUEUE set VQ_STAT = \'waiting\'\n"
-"where VQ_STAT = \'pending\' and (VQ_TS is null or datediff (\'second\', stringdate (\'1980-01-01\'), VQ_TS) < _last_shut);\n"
+"\n"
+"\n"
+"\n"
+"WS.WS.VFS_RECOVER_QUEUE_STAT (_tgt, _root);\n"
 "commit work;\n"
 "\n"
 "whenever not found goto n_site;\n"
-"select VS_URL, VS_METHOD into _tgt_url, _dav_method from VFS_SITE where VS_HOST = _tgt and VS_ROOT = _root;\n"
+"select VS_URL, VS_METHOD, VS_THREADS, VS_BOT \n"
+"into _tgt_url, _dav_method, thr_conf, care_bot \n"
+"from VFS_SITE where VS_HOST = _tgt and VS_ROOT = _root with (exclusive);\n"
+"if (thr_conf is not null and thr_conf > 0)\n"
+"nthreads := thr_conf;\n"
+"if (nthreads is null or nthreads < 0)\n"
+"nthreads := 1;\n"
+"if (care_bot)  \n"
+"VFS_ROBOTS_GET (_tgt, _root);\n"
+"commit work;\n"
 "\n"
 "if (_upd = 1)\n"
 "{\n"
@@ -14801,6 +15347,8 @@ static const char *proc312 =
 "goto fn_end;\n"
 "};\n"
 "found_one := 0; ndone := 0;\n"
+"if (WS.WS.VFS_STATUS_GET (_tgt, _root) = \'stopped\')\n"
+"goto fn_end;\n"
 "for (declare i int, i := 0; i < batch_size; i := i + 1)\n"
 "{\n"
 "_rc := call (url_fn) (_tgt, _root, _next_url, _clnt_data);\n"
@@ -14856,9 +15404,10 @@ static const char *proc312 =
 "n_site:;\n"
 "return _total;\n"
 "}\n"
-"--src vfs.sql:348\n";
+"--src vfs.sql:364\n";
 
-static const char *proc313 = 
+static const char *proc321 = 
+"#line 504 \"[executable]/vfs.sql\"\n"
 "create procedure ERR_MAIL_SEND (in _tgt varchar, in _urls varchar, in _root varchar, in  _stat varchar, in _msg varchar)\n"
 "{\n"
 "declare n_urls int;\n"
@@ -14877,14 +15426,15 @@ static const char *proc313 =
 "msg := msg || sprintf (\'http://%s%s -> %s\\r\\n\', _tgt, _urls[i], _root); \n"
 "DB.DBA.NEW_MAIL (\'dav\', msg);\n"
 "}\n"
-"--src vfs.sql:477\n";
+"--src vfs.sql:502\n";
 
-static const char *proc314 = 
+static const char *proc322 = 
+"#line 524 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.LOCAL_STORE (in _host varchar, in _url varchar, in _root varchar,\n"
 "inout _content varchar, in _s_etag varchar, in _c_type varchar,\n"
-"in store_flag int := 1)\n"
+"in store_flag int := 1, in conv_html int := 1)\n"
 "{\n"
-"declare _name, _perms, _etag, _idx, _type, _e_etag, _sl, _opage varchar;\n"
+"declare _name, _perms, _etag, _idx, _type, _e_etag, _sl, _opage, _path_str varchar;\n"
 "declare _own, _col_id, _grp, _res_id integer;\n"
 "declare _path any;\n"
 "\n"
@@ -14902,10 +15452,13 @@ static const char *proc314 =
 "_sl := \'\';\n"
 "else\n"
 "_sl := \'/\';\n"
-"if (aref (_url, length (_url) - 1) = ascii(\'/\'))\n"
-"_path := WS.WS.HREF_TO_ARRAY (concat(_sl, _root, _url,\'index.html\'),\'\');\n"
-"else\n"
-"_path := WS.WS.HREF_TO_ARRAY (concat(_sl, _root, _url),\'\');\n"
+"_path_str := _url;\n"
+"if (_path_str like \'%/\')\n"
+"_path_str := _path_str || \'index.html\';\n"
+"if (_path_str like \'http://%\')\n"
+"_path_str := subseq (_path_str, 5);  \n"
+"_path_str := _sl || _root || _path_str;  \n"
+"_path := WS.WS.HREF_TO_ARRAY (_path_str, \'\');\n"
 "_path := WS.WS.FIXPATH (_path);\n"
 "if (_own is not null and _own > 0)\n"
 "{\n"
@@ -14936,22 +15489,23 @@ static const char *proc314 =
 "not_res:\n"
 "if (_res_id is null or _res_id = 0)\n"
 "{\n"
+"_res_id := GETID (\'R\');\n"
 "if (__tag (_content) = 185)\n"
 "{\n"
 "insert into SYS_DAV_RES (RES_ID, RES_NAME, RES_CONTENT, RES_TYPE,\n"
 "RES_PERMS, RES_OWNER, RES_GROUP, RES_CR_TIME, RES_MOD_TIME, RES_COL)\n"
-"values (getid (\'R\'), _name, _content, _type, _perms, _own, _grp, now (), now (), _col_id);\n"
+"values (_res_id, _name, _content, _type, _perms, _own, _grp, now (), now (), _col_id);\n"
 "}\n"
 "else\n"
 "{\n"
 "insert into SYS_DAV_RES (RES_ID, RES_NAME, RES_CONTENT, RES_TYPE,\n"
 "RES_PERMS, RES_OWNER, RES_GROUP, RES_CR_TIME, RES_MOD_TIME, RES_COL)\n"
-"values (getid (\'R\'), _name, WS.WS.REPLACE_HREF (_host, _url, _root, _content, _type),\n"
+"values (_res_id, _name, WS.WS.REPLACE_HREF (_host, _url, _root, _content, _type, conv_html),\n"
 "_type, _perms, _own, _grp, now (), now (), _col_id);\n"
 "}\n"
 "\n"
-"insert replacing VFS_URL (VU_HOST, VU_URL, VU_CHKSUM, VU_CPTIME, VU_ETAG, VU_ROOT)\n"
-"values (_host, _url, md5 (_content), now (), _s_etag, _root);\n"
+"insert replacing VFS_URL (VU_HOST, VU_URL, VU_CHKSUM, VU_CPTIME, VU_ETAG, VU_ROOT, VU_RES_ID)\n"
+"values (_host, _url, md5 (_content), now (), _s_etag, _root, _res_id);\n"
 "}\n"
 "else if (_res_id > 0)\n"
 "{\n"
@@ -14967,7 +15521,7 @@ static const char *proc314 =
 "}\n"
 "else\n"
 "{\n"
-"update SYS_DAV_RES set RES_CONTENT = WS.WS.REPLACE_HREF (_host, _url, _root, _content, _type),\n"
+"update SYS_DAV_RES set RES_CONTENT = WS.WS.REPLACE_HREF (_host, _url, _root, _content, _type, conv_html),\n"
 "RES_MOD_TIME = now () where RES_ID = _res_id;\n"
 "}\n"
 "\n"
@@ -14975,105 +15529,160 @@ static const char *proc314 =
 "update VFS_URL set VU_CHKSUM = md5 (_content), VU_CPTIME = now (), VU_ETAG = _s_etag\n"
 "where VU_HOST = _host and VU_URL = _url and VU_ROOT = _root;\n"
 "else\n"
-"insert replacing VFS_URL (VU_HOST, VU_URL, VU_CHKSUM, VU_CPTIME, VU_ETAG, VU_ROOT)\n"
-"values (_host, _url, md5 (_content), now (), _s_etag, _root);\n"
+"insert replacing VFS_URL (VU_HOST, VU_URL, VU_CHKSUM, VU_CPTIME, VU_ETAG, VU_ROOT, VU_RES_ID)\n"
+"values (_host, _url, md5 (_content), now (), _s_etag, _root, _res_id);\n"
 "}\n"
 "}\n"
 "}\n"
 "err_end:\n"
 "return 0;\n"
 "}\n"
-"--src vfs.sql:497\n";
+"--src vfs.sql:522\n";
 
-static const char *proc315 = 
-"create procedure WS.WS.GET_URLS (in _host varchar, in _url varchar, in _root varchar, inout _content varchar, in lev int)\n"
+static const char *proc323 = 
+"#line 634 \"[executable]/vfs.sql\"\n"
+"create procedure WS.WS.GET_URLS (in _host varchar, in _url varchar, in _root varchar, inout _content varchar, in lev int, in ctype varchar)\n"
 "{\n"
-"declare _stag, _etag, _len, _inx, _htag, _sltag, _count, _t_tag1, _t_tag2, _uri_len integer;\n"
-"declare _cut_pos integer;\n"
-"declare _tmp, _tmp_host, _tmp_url, _t_len, _d_imgs, _other varchar;\n"
-"declare _uri any;\n"
-"declare _flw, _nflw, _method, _delete varchar;\n"
+"declare _stag, _etag, _len, _inx, _htag, _sltag, _count, _t_tag1, _t_tag2, _urls_arr_len, depth integer;\n"
+"declare _tmp, _tmp_host, _tmp_url, _t_len, _d_imgs, _other, _start_url varchar;\n"
+"declare _flw, _nflw, _method, _delete, xp_exp, base, robots, care_of_bot varchar;\n"
 "declare _newer datetime;\n"
 "declare _own integer;\n"
-"declare frames any;\n"
+"declare frames, _urls_arr any;\n"
+"\n"
+"if (WS.WS.SITEMAP_PROCESS (_host, _url, _root, _content, ctype, lev))\n"
+"return;\n"
 "\n"
-"whenever not found goto nf_img;\n"
-"select VS_SRC, VS_OTHER, VS_OWN, VS_METHOD, VS_FOLLOW, VS_NFOLLOW, VS_DEL, VS_NEWER\n"
-"into _d_imgs, _other, _own, _method, _flw, _nflw, _delete, _newer\n"
+"whenever not found goto no_site_rec;\n"
+"select VS_SRC, VS_OTHER, VS_OWN, VS_METHOD, VS_FOLLOW, VS_NFOLLOW, VS_DEL, VS_NEWER, VS_XPATH, VS_DEPTH, VS_URL, VS_ROBOTS, VS_BOT\n"
+"into _d_imgs, _other, _own, _method, _flw, _nflw, _delete, _newer, xp_exp, depth, _start_url, robots, care_of_bot\n"
 "from VFS_SITE where VS_HOST = _host and VS_ROOT = _root;\n"
 "\n"
-"nf_img:\n"
+"if (depth is not null and depth >= 0 and lev > depth)\n"
+"return;\n"
 "frames := vector ();\n"
-"if (isstring (_content))\n"
-"_uri := WS.WS.FIND_URI (_content, _d_imgs, _host, _url, frames);\n"
-"else if (__tag (_content) = 193)\n"
-"_uri := _content;\n"
-"if (__tag (_uri) = 193 )\n"
-"{\n"
-"_uri_len := length (_uri);\n"
-"}\n"
+"if (__tag (_content) = 193)\n"
+"_urls_arr := _content;\n"
+"else\n"
+"_urls_arr := WS.WS.FIND_URI (_content, _d_imgs, _host, _url, xp_exp, frames, ctype);\n"
+"\n"
+"if (__tag (_urls_arr) = 193)\n"
+"_urls_arr_len := length (_urls_arr);\n"
 "else\n"
 "return;\n"
 "\n"
+"if (care_of_bot)\n"
+"_nflw := cast (robots as varchar) || _nflw;\n"
 "if ((isstring (_flw) and length (_flw) > 0) or (isstring (_nflw) and length (_nflw) > 0))\n"
 "frames := vector ();\n"
 "\n"
 "_inx := 0;\n"
-"while (_inx < _uri_len)\n"
+"base := WS.WS.VFS_URI_COMPOSE (vector (\'http\', _host, _url, \'\', \'\', \'\'));\n"
+"while (_inx < _urls_arr_len)\n"
 "{\n"
-"_tmp := aref (_uri, _inx);\n"
-"if (_tmp is not null)\n"
+"declare hi, sch any;\n"
+"_tmp := _urls_arr[_inx];\n"
+"\n"
+"if (length (_tmp) = 0)\n"
+"goto next_url;\n"
+"\n"
+"_tmp := rfc1808_expand_uri (base, _tmp);\n"
+"hi := rfc1808_parse_uri (_tmp);\n"
+"sch := lower (hi[0]); \n"
+"if (sch = \'\') sch := \'http\';\n"
+"\n"
+"hi[5] := \'\';\n"
+"_tmp := WS.WS.VFS_URI_COMPOSE (hi);\n"
+"\n"
+"if (sch = \'http\')\n"
 "{\n"
-"_cut_pos := strstr (_tmp, \'#\');\n"
-"if (_cut_pos is not null)\n"
+"_tmp_host := hi[1];\n"
+"hi[0] := \'\'; hi[1] := \'\';\n"
+"_tmp_url := WS.WS.VFS_URI_COMPOSE (hi);\n"
+"if (_tmp_host <> _host)\n"
+"_tmp_url := _tmp;\n"
+"\n"
+"if ((get_keyword (_tmp_url, frames) is not null or WS.WS.FOLLOW (_host, _root, _tmp_url, _flw, _nflw, _start_url, _d_imgs)))\n"
 "{\n"
-"if (0 <> _cut_pos)\n"
-"_tmp := subseq (_tmp, 0, _cut_pos);\n"
-"else\n"
-"_tmp := \'./\';\n"
+"insert soft VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_LEVEL)\n"
+"values (_host, now (), _tmp_url, \'waiting\', _root, lev);\n"
+"}\n"
+"}\n"
+"next_url:\n"
+"_inx := _inx + 1;\n"
+"}\n"
+"no_site_rec:  \n"
+"return;\n"
 "}\n"
-"_cut_pos := strstr (_tmp, \'?\');\n"
-"if (_cut_pos is not null)\n"
-"_tmp := subseq (_tmp, 0, _cut_pos);\n"
-"if (strcasestr (_tmp, \'ftp://\') is null and strcasestr (_tmp, \'mailto:\') is null\n"
-"and strcasestr (_tmp, \'news:\') is null and strcasestr (_tmp, \'telnet://\') is null\n"
-"and strcasestr (_tmp, \'https://\') is null and _tmp <> \'http://\')\n"
+"--src vfs.sql:632\n";
+
+static const char *proc324 = 
+"#line 710 \"[executable]/vfs.sql\"\n"
+"create procedure WS.WS.SITEMAP_PROCESS (in _host varchar, in _url varchar, in _root varchar, inout _content varchar, in _c_type varchar, in lev int)\n"
 "{\n"
-"WS.WS.SPLIT_URL (_host, _url, _tmp, _tmp_host, _tmp_url);\n"
-"\n"
-"if ((get_keyword (_tmp_url, frames) is not null or WS.WS.FOLLOW (_host, _root, _tmp_url))\n"
-"and _tmp_host = _host)\n"
+"declare xt, xp any;\n"
+"xt := null;\n"
+"declare exit handler for sqlstate \'*\'\n"
+"{\n"
+"rollback work;\n"
+"return 0;\n"
+"};\n"
+"if (_url like \'%.xml.gz\')\n"
+"{\n"
+"if (length (_content) > 2)\n"
+"{\n"
+"declare magic varchar;\n"
+"magic := subseq (_content, 0, 2);\n"
+"if (magic[0] = 0hex1f and magic[1] = 0hex8b) \n"
+"_content := gzip_uncompress (_content);\n"
+"}\n"
+"}\n"
+"if (_url like \'%.xml\' or _url like \'%.xml.gz\' or _c_type = \'text/xml\' or _c_type = \'application/xml\')\n"
+"{\n"
+"xt := xtree_doc (_content);\n"
+"if (xpath_eval (\'/urlset/dataset\', xt) is not null)\n"
 "{\n"
-"select count (*) into _count from VFS_URL where\n"
-"VU_HOST = _tmp_host and VU_URL = _tmp_url and VU_ROOT = _root for update;\n"
-"if (_count is null or _count = 0)\n"
+"declare ts any;\n"
+"xp := xpath_eval (\'/urlset/dataset/dataDumpLocation/text()\', xt, 0);\n"
+"ts := xpath_eval (\'/urlset/dataset/lastmod/text()\', xt);\n"
+"if (ts is not null)\n"
 "{\n"
-"select count (*) into _count from VFS_QUEUE where\n"
-"VQ_HOST = _tmp_host and VQ_URL = _tmp_url and VQ_ROOT = _root for update;\n"
-"if (_count is null or _count = 0)\n"
+"declare ar any;\n"
+"declare i int;\n"
+"i := 0;\n"
+"ts := cast (cast (ts as varchar) as datetime);\n"
+"ar := make_array (length (xp), \'any\');\n"
+"foreach (any x in xp) do\n"
 "{\n"
-"insert into VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_LEVEL)\n"
-"values (_tmp_host, now (), _tmp_url, \'waiting\', _root, lev);\n"
+"ar[i] := vector (cast (x as varchar), ts);\n"
+"i := i + 1;\n"
 "}\n"
+"xp := ar;\n"
 "}\n"
+"WS.WS.SITEMAP_URLS_REGISTER (_host, _root, xp, lev, 0);\n"
+"return 1;\n"
 "}\n"
-"else if (WS.WS.FOLLOW (_host, _root, _tmp_url) and _tmp_host <> _host and _other = \'checked\')\n"
+"else if (xpath_eval (\'/sitemapindex/sitemap/loc\', xt) is not null)\n"
 "{\n"
 "\n"
-"WS.WS.VFS_ENSURE_NEW_SITE (_host, _root, _tmp_host, _tmp_url);\n"
-"\n"
-"insert soft VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_OTHER, VQ_LEVEL)\n"
-"values (_tmp_host, now (), _tmp_url, \'waiting\', _tmp_host, \'other\', lev);\n"
-"}\n"
+"xp := WS.WS.SITEMAP_GET_LOC (xt, \'/sitemapindex/sitemap\', \'./loc/text()\', \'./lastmod/text()\');\n"
+"WS.WS.SITEMAP_URLS_REGISTER (_host, _root, xp, lev, 0);\n"
+"return 1;\n"
 "}\n"
+"else if (xpath_eval (\'/urlset/url/loc\', xt) is not null)\n"
+"{\n"
+"\n"
+"xp := WS.WS.SITEMAP_GET_LOC (xt, \'/urlset/url\', \'./loc/text()\', \'./lastmod/text()\');\n"
+"WS.WS.SITEMAP_URLS_REGISTER (_host, _root, xp, lev, 1);\n"
+"return 1;\n"
 "}\n"
-"_inx := _inx + 1;\n"
 "}\n"
-"return;\n"
+"return 0;\n"
 "}\n"
-"--src vfs.sql:603\n";
+"--src vfs.sql:708\n";
 
-static const char *proc316 = 
+static const char *proc325 = 
+"#line 773 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.MAKE_URL (in _host varchar, in _url varchar)\n"
 "{\n"
 "declare hf, _res any;\n"
@@ -15085,9 +15694,10 @@ static const char *proc316 =
 "_res := WS.WS.VFS_URI_COMPOSE (hf);  \n"
 "return _res;\n"
 "}\n"
-"--src vfs.sql:692\n";
+"--src vfs.sql:771\n";
 
-static const char *proc317 = 
+static const char *proc326 = 
+"#line 787 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.SPLIT_URL (in _host varchar, in _url varchar, in _parent_url varchar,\n"
 "out _o_host varchar, out _o_url varchar)\n"
 "{\n"
@@ -15140,9 +15750,10 @@ static const char *proc317 =
 "_o_url := WS.WS.EXPAND_URL (_url, _parent_url);\n"
 "}\n"
 "}\n"
-"--src vfs.sql:706\n";
+"--src vfs.sql:785\n";
 
-static const char *proc318 = 
+static const char *proc327 = 
+"#line 842 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.EXPAND_URL_OLD (in _url varchar, in _c_url varchar)\n"
 "{\n"
 "declare _tmp varchar;\n"
@@ -15201,9 +15812,10 @@ static const char *proc318 =
 "end_loop:\n"
 "return _tmp;\n"
 "}\n"
-"--src vfs.sql:761\n";
+"--src vfs.sql:840\n";
 
-static const char *proc319 = 
+static const char *proc328 = 
+"#line 903 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.MKPATH (in _path any, in _own integer, in _grp integer, in _perms varchar)\n"
 "{\n"
 "declare _col, _len, _inx, _t_col integer;\n"
@@ -15235,34 +15847,31 @@ static const char *proc319 =
 "}\n"
 "return _col;\n"
 "}\n"
-"--src vfs.sql:822\n";
+"--src vfs.sql:901\n";
 
-static const char *proc320 = 
-"create procedure WS.WS.FOLLOW (in _host varchar, in _root varchar, in _t_url varchar)\n"
+static const char *proc329 = 
+"#line 937 \"[executable]/vfs.sql\"\n"
+"create procedure WS.WS.FOLLOW (in _host varchar, in _root varchar, in _t_url varchar, in _flw_s varchar, in _nflw_s varchar, in _url varchar, in _img varchar)\n"
 "{\n"
 "declare _flw, _nflw any;\n"
 "declare _inx, _rc, _len integer;\n"
-"declare _flw_s, _nflw_s, _cond, _url, _img varchar;\n"
+"declare _cond varchar;\n"
 "\n"
-"_img := null;\n"
-"whenever not found goto not_ini;\n"
-"select VS_FOLLOW, VS_NFOLLOW, VS_URL, VS_SRC into _flw_s, _nflw_s, _url, _img\n"
-"from VFS_SITE where VS_HOST = _host and VS_ROOT = _root;\n"
 "\n"
 "if (_t_url = _url)\n"
 "return 1;\n"
-"not_ini:\n"
 "\n"
-"if (_img is not null and substring (http_mime_type (_t_url), 1, 6) = \'image/\')\n"
+"if (_img is not null and substring (http_mime_type (_t_url), 1, 6) = \'image/\' and _t_url not like \'http://%\')\n"
 "return 1;\n"
 "else if (0 = length (_nflw_s) and 0 = length (_img) and substring (http_mime_type (_t_url), 1, 6) = \'image/\')\n"
 "return 0;\n"
 "\n"
-"if (_flw_s is null or _flw_s = \'\')\n"
+"if (length (_flw_s) = 0)\n"
 "_flw_s := \'/%\';\n"
 "\n"
-"if (_nflw_s is null or _nflw_s = \'\')\n"
+"if (length (_nflw_s) = 0)\n"
 "_nflw_s := (\'\');\n"
+"\n"
 "_rc := 0;\n"
 "_flw := split_and_decode (_flw_s, 0, \';=;\');\n"
 "if (_flw is null)\n"
@@ -15305,16 +15914,17 @@ static const char *proc320 =
 "end_step:\n"
 "return _rc;\n"
 "}\n"
-"--src vfs.sql:856\n";
+"--src vfs.sql:935\n";
 
-static const char *proc321 = 
+static const char *proc330 = 
+"#line 1003 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.REPLACE_HREF (in _host varchar, in _url varchar, in _root varchar,\n"
-"in _content varchar, in _c_type varchar)\n"
+"in _content varchar, in _c_type varchar, in conv_html int := 1)\n"
 "{\n"
 "declare _str, _tree, _tree_doc any;\n"
 "declare _tmp, _nhost, _nurl, _dav, _url_p varchar;\n"
 "declare _lp, _rp, _len, _tp, _break, _inx integer;\n"
-"if (_c_type not like \'text/html%\' or not isstring (_content))\n"
+"if (_c_type not like \'text/html%\' or not isstring (_content) or conv_html = 0)\n"
 "return _content;\n"
 "\n"
 "_str := string_output ();\n"
@@ -15337,31 +15947,51 @@ static const char *proc321 =
 "_tmp := string_output_string (_str);\n"
 "return _tmp;\n"
 "}\n"
-"--src vfs.sql:926\n";
+"--src vfs.sql:1001\n";
 
-static const char *proc322 = 
+static const char *proc331 = 
+"#line 1035 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.FIND_URI (in _content varchar, in _d_imgs varchar,\n"
-"in _host varchar, in _url varchar, out frames any)\n"
+"in _host varchar, in _url varchar, in xp_exp varchar, out frames any, in ctype varchar)\n"
 "{\n"
 "declare _len, _inx integer;\n"
 "declare xe, arr, arr1, ha, sa, ia, fr, ifr, sty, js any;\n"
-"declare elm, _tmp_host, _tmp_url varchar;\n"
+"declare elm, _tmp_host, _tmp_url, base varchar;\n"
 "declare _xml_tree any;\n"
 "\n"
 "frames := vector ();\n"
 "\n"
-"\n"
-"\n"
-"\n"
-"if (not isstring (_content))\n"
+"if (not isstring (_content) and __tag (_content) <> 185)\n"
 "return vector ();\n"
 "\n"
+"if (tidy_external () and ctype like \'text/html\')\n"
+"_content := tidy_html (_content, \'output-xhtml:yes\\r\\ntidy-mark:no\');\n"
+"if (ctype like \'application/%+xml\' or ctype = \'text/xml\')\n"
+"_xml_tree := xml_tree (_content, 0);\n"
+"else  \n"
 "_xml_tree := xml_tree (_content, 2);\n"
 "if (__tag (_xml_tree) <> 193)\n"
 "return WS.WS.GET_HREF_IN_ARRAY (_content, _d_imgs);\n"
 "\n"
 "xe := xml_tree_doc (_xml_tree);\n"
 "\n"
+"if (length (xp_exp))\n"
+"{\n"
+"arr := xpath_eval (xp_exp, xe, 0);\n"
+"_inx := 0; _len := length (arr);\n"
+"vectorbld_init (arr1);\n"
+"while (_inx < _len)\n"
+"{\n"
+"elm := cast (arr[_inx] as varchar);\n"
+"if (isstring (elm) and strstr (http_mime_type (elm), \'image/\') is null or _d_imgs is not null)\n"
+"vectorbld_acc (arr1, elm);\n"
+"_inx := _inx + 1;\n"
+"}\n"
+"vectorbld_final (arr1);\n"
+"}\n"
+"else\n"
+"{\n"
+"arr1 := vector ();\n"
 "ha := xpath_eval (\'//@href\', xe, 0);\n"
 "sa := xpath_eval (\'//@src\', xe, 0);\n"
 "ia := xpath_eval (\'//@background\', xe, 0);\n"
@@ -15375,8 +16005,6 @@ static const char *proc322 =
 "\n"
 "_inx := 0; _len := length (arr);\n"
 "\n"
-"arr1 := vector ();\n"
-"\n"
 "while (_inx < _len)\n"
 "{\n"
 "elm := cast (arr[_inx] as varchar);\n"
@@ -15400,19 +16028,28 @@ static const char *proc322 =
 "\n"
 "fr := vector_concat (fr, ifr, sty, js);\n"
 "_inx := 0; _len := length (fr);\n"
+"if (_len > 0)\n"
+"base := WS.WS.VFS_URI_COMPOSE (vector (\'http\', _host, _url, \'\', \'\', \'\'));\n"
 "while (_inx < _len)\n"
 "{\n"
+"declare hi any;\n"
 "elm := cast (fr[_inx] as varchar);\n"
-"WS.WS.SPLIT_URL (_host, _url, elm, _tmp_host, _tmp_url);\n"
+"elm := rfc1808_expand_uri (base, elm);\n"
+"hi := rfc1808_parse_uri (elm);\n"
+"_tmp_host := hi[1];\n"
+"hi[0] := \'\'; hi[1] := \'\';\n"
+"_tmp_url := WS.WS.VFS_URI_COMPOSE (hi);\n"
 "if (_host = _tmp_host)\n"
 "frames := vector_concat (frames, vector (_tmp_url, \'\'));\n"
 "_inx := _inx + 1;\n"
 "}\n"
+"}\n"
 "return arr1;\n"
 "}\n"
-"--src vfs.sql:958\n";
+"--src vfs.sql:1033\n";
 
-static const char *proc323 = 
+static const char *proc332 = 
+"#line 1133 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.LFS_EXP (in _host varchar, in _url varchar, in _root varchar, in _i_dst varchar)\n"
 "{\n"
 "declare _path, _name, _content, _dest, _tmp, _dst, _err varchar;\n"
@@ -15485,9 +16122,10 @@ static const char *proc323 =
 "close c;\n"
 "return;\n"
 "}\n"
-"--src vfs.sql:1031\n";
+"--src vfs.sql:1131\n";
 
-static const char *proc324 = 
+static const char *proc333 = 
+"#line 1209 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.FIND_KEYWORD (inout params varchar, in _pkey varchar)\n"
 "{\n"
 "declare inx integer;\n"
@@ -15524,9 +16162,10 @@ static const char *proc324 =
 "end_find:\n"
 "return result;\n"
 "}\n"
-"--src vfs.sql:1107\n";
+"--src vfs.sql:1207\n";
 
-static const char *proc325 = 
+static const char *proc334 = 
+"#line 1249 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.GET_HREF_IN_ARRAY (in _content varchar, in _d_imgs varchar)\n"
 "{\n"
 "declare _stag, _etag, _len, _inx, _htag, _sltag, _count, _t_tag1, _t_tag2, _uri_len integer;\n"
@@ -15534,6 +16173,8 @@ static const char *proc325 =
 "declare _uri, _res any;\n"
 "declare _href_c integer;\n"
 "\n"
+"if (not isstring (_content))\n"
+"return vector ();\n"
 "_len := length (_content);\n"
 "_href_c := 0;\n"
 "_stag := 0;\n"
@@ -15617,9 +16258,10 @@ static const char *proc325 =
 "end_find:\n"
 "return _res;\n"
 "}\n"
-"--src vfs.sql:1147\n";
+"--src vfs.sql:1247\n";
 
-static const char *proc326 = 
+static const char *proc335 = 
+"#line 1344 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.DAV_EXP (in _host varchar, in _url varchar, in _root varchar, in _i_dst varchar)\n"
 "{\n"
 "declare _path, _name, _content, _dest, _tmp, _etag, _dst varchar;\n"
@@ -15725,9 +16367,10 @@ static const char *proc326 =
 "close c;\n"
 "return 0;\n"
 "}\n"
-"--src vfs.sql:1240\n";
+"--src vfs.sql:1342\n";
 
-static const char *proc327 = 
+static const char *proc336 = 
+"#line 1452 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.DAV_HEAD (inout _url varchar)\n"
 "{\n"
 "declare _res any;\n"
@@ -15744,9 +16387,10 @@ static const char *proc327 =
 "else\n"
 "return _err;\n"
 "}\n"
-"--src vfs.sql:1348\n";
+"--src vfs.sql:1450\n";
 
-static const char *proc328 = 
+static const char *proc337 = 
+"#line 1471 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.DAV_MKCOL (inout _url varchar)\n"
 "{\n"
 "declare _res any;\n"
@@ -15763,9 +16407,10 @@ static const char *proc328 =
 "else\n"
 "return _err;\n"
 "}\n"
-"--src vfs.sql:1367\n";
+"--src vfs.sql:1469\n";
 
-static const char *proc329 = 
+static const char *proc338 = 
+"#line 1490 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.DAV_PUT (inout _url varchar,in _content varchar)\n"
 "{\n"
 "declare _res any;\n"
@@ -15780,9 +16425,10 @@ static const char *proc329 =
 "else\n"
 "return -1;\n"
 "}\n"
-"--src vfs.sql:1386\n";
+"--src vfs.sql:1488\n";
 
-static const char *proc330 = 
+static const char *proc339 = 
+"#line 1507 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.DAV_PROP (inout _url varchar, in _d_imgs varchar, in _auth varchar)\n"
 "{\n"
 "declare _res , _tree, _dav, _href, _responce any;\n"
@@ -15803,9 +16449,10 @@ static const char *proc330 =
 "_res := WS.WS.GET_HREF_FROM_XML (_body, _d_imgs);\n"
 "return _res;\n"
 "}\n"
-"--src vfs.sql:1403\n";
+"--src vfs.sql:1505\n";
 
-static const char *proc331 = 
+static const char *proc340 = 
+"#line 1531 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.GET_HREF_FROM_XML (in _content varchar, in _d_imgs varchar)\n"
 "{\n"
 "declare _stag, _etag, _len, _inx, _htag, _sltag, _count, _t_tag1, _t_tag2, _uri_len integer;\n"
@@ -15908,9 +16555,10 @@ static const char *proc331 =
 "end_find:\n"
 "return _res;\n"
 "}\n"
-"--src vfs.sql:1427\n";
+"--src vfs.sql:1529\n";
 
-static const char *proc332 = 
+static const char *proc341 = 
+"#line 1636 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.ISEMPTY (in x any)\n"
 "{\n"
 "if (\'\' = x or x is null or x = 0)\n"
@@ -15922,9 +16570,10 @@ static const char *proc332 =
 "return 0;\n"
 "}\n"
 "}\n"
-"--src vfs.sql:1532\n";
+"--src vfs.sql:1634\n";
 
-static const char *proc333 = 
+static const char *proc342 = 
+"#line 1658 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.URL_BY_DATE (in host varchar, in coll varchar, out url varchar, in _clnt_data any)\n"
 "{\n"
 "declare next_url varchar;\n"
@@ -15942,9 +16591,34 @@ static const char *proc333 =
 "close cr;\n"
 "return 0;\n"
 "}\n"
-"--src vfs.sql:1554\n";
+"--src vfs.sql:1656\n";
 
-static const char *proc334 = 
+static const char *proc343 = 
+"#line 1677 \"[executable]/vfs.sql\"\n"
+"create procedure WS.WS.VFS_RECOVER_QUEUE_STAT (in host varchar, in coll varchar)\n"
+"{\n"
+"declare next_url varchar;\n"
+"declare last_ts datetime;\n"
+"declare secs_last int;\n"
+"\n"
+"secs_last := coalesce (sequence_set (\'WEB_COPY_SSHUT\', 0, 2), 0);\n"
+"last_ts := dateadd (\'second\', secs_last, stringdate (\'1980-01-01\'));\n"
+"\n"
+"whenever not found goto done;\n"
+"declare cr cursor for select VQ_URL from WS.WS.VFS_QUEUE where VQ_HOST = host and VQ_ROOT = coll and VQ_STAT = \'pending\' and VQ_TS < last_ts for update;\n"
+"open cr;\n"
+"while (1)\n"
+"{\n"
+"fetch cr into next_url;\n"
+"update WS.WS.VFS_QUEUE set VQ_STAT = \'waiting\' where VQ_HOST = host and VQ_ROOT = coll and VQ_URL = next_url;\n"
+"}\n"
+"done:\n"
+"close cr;\n"
+"}\n"
+"--src vfs.sql:1675\n";
+
+static const char *proc344 = 
+"#line 1704 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.VFS_MAKE_ENTRY (\n"
 "in url varchar,\n"
 "in follow varchar := \'/*\',\n"
@@ -15966,18 +16640,20 @@ static const char *proc334 =
 "select hi[1], hi[1], RM_PID, RM_ID from DB.DBA.SYS_RDF_MAPPERS;\n"
 "}\n"
 "}\n"
-"--src vfs.sql:1578\n";
+"--src vfs.sql:1702\n";
 
-static const char *proc335 = 
+static const char *proc345 = 
+"#line 1727 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.VFS_GO (in url varchar)\n"
 "{\n"
 "declare hi any;\n"
 "hi := rfc1808_parse_uri (url);\n"
 "WS.WS.SERV_QUEUE_TOP (hi[1], hi[1], 0, 0, NULL, NULL);\n"
 "}\n"
-"--src vfs.sql:1601\n";
+"--src vfs.sql:1725\n";
 
-static const char *proc336 = 
+static const char *proc346 = 
+"#line 1736 \"[executable]/vfs.sql\"\n"
 "create procedure\n"
 "WS.WS.VFS_URI_COMPOSE (in res any)\n"
 "{\n"
@@ -16013,9 +16689,10 @@ static const char *proc336 =
 "\n"
 "return _full_path;\n"
 "}\n"
-"--src vfs.sql:1610\n";
+"--src vfs.sql:1734\n";
 
-static const char *proc337 = 
+static const char *proc347 = 
+"#line 1774 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.VFS_EXTRACT_RDF (in _host varchar, in _root varchar, in _start_path varchar, in opts any, in url varchar, inout content any, in ctype varchar, inout outhdr any, inout inhdr any)\n"
 "{\n"
 "declare mime_type, _graph, _base, out_arr, tmp varchar;\n"
@@ -16024,6 +16701,8 @@ static const char *proc337 =
 "\n"
 "html_start := null;\n"
 "\n"
+"_graph := get_keyword (\'rdf-graph\', opts);\n"
+"if (length (_graph) = 0)\n"
 "_graph := WS.WS.MAKE_URL (_host, _start_path);\n"
 "_base := WS.WS.MAKE_URL (_host, url);\n"
 "\n"
@@ -16032,14 +16711,23 @@ static const char *proc337 =
 "return;\n"
 "};\n"
 "\n"
+"if (url like \'*.gz\')\n"
+"{\n"
+"if (length (content) > 2)\n"
+"{\n"
+"declare magic varchar;\n"
+"magic := subseq (content, 0, 2);\n"
+"if (magic[0] = 0hex1f and magic[1] = 0hex8b) \n"
+"content := gzip_uncompress (content);\n"
+"}\n"
+"}\n"
 "\n"
 "mime_type := DB.DBA.RDF_SPONGE_GUESS_CONTENT_TYPE (url, ctype, content);\n"
 "\n"
 "\n"
-"if (1 and (get_keyword (\'meta_rdf\', opts, 0) = 1))\n"
 "{\n"
 "if (strstr (mime_type, \'application/rdf+xml\') is not null)\n"
-"DB.DBA.RDF_LOAD_RDFXML (content, url, _graph);\n"
+"DB.DBA.RDF_LOAD_RDFXML (content, _base, _graph);\n"
 "else if (\n"
 "strstr (mime_type, \'text/rdf+n3\') is not null or\n"
 "strstr (mime_type, \'text/rdf+ttl\') is not null or\n"
@@ -16048,12 +16736,12 @@ static const char *proc337 =
 "strstr (mime_type, \'application/turtle\') is not null or\n"
 "strstr (mime_type, \'application/x-turtle\') is not null\n"
 ")\n"
-"DB.DBA.TTLP (content, url, _graph);\n"
+"DB.DBA.TTLP (content, _base, _graph);\n"
 "}\n"
 "\n"
 "\n"
 "for select RM_PATTERN, RM_TYPE, RM_HOOK, RM_KEY, RM_OPTIONS from DB.DBA.SYS_RDF_MAPPERS, WS.WS.VFS_SITE_RDF_MAP\n"
-"where RM_ENABLED = 1 and VM_RDF_MAP = RM_PID and VM_HOST = _host and VM_ROOT = _root\n"
+"where VM_RDF_MAP = RM_PID and VM_HOST = _host and VM_ROOT = _root\n"
 "order by VM_SEQ\n"
 "do\n"
 "{\n"
@@ -16064,7 +16752,7 @@ static const char *proc337 =
 "}\n"
 "else if (RM_TYPE = \'URL\' or RM_TYPE = \'HTTP\')\n"
 "{\n"
-"val_match := url;\n"
+"val_match := _base;\n"
 "}\n"
 "else\n"
 "val_match := null;\n"
@@ -16080,18 +16768,16 @@ static const char *proc337 =
 "goto try_next_mapper;\n"
 "};\n"
 "\n"
-"new_opts := RM_OPTIONS;\n"
+"new_opts := vector_concat (RM_OPTIONS, vector (\'disable-clean\', \'Y\'));\n"
 "if (RM_TYPE <> \'HTTP\')\n"
 "{\n"
-"rc := call (RM_HOOK) (_graph, url, null, content, aq, aq, RM_KEY, new_opts);\n"
+"rc := call (RM_HOOK) (_graph, _base, null, content, aq, aq, RM_KEY, new_opts);\n"
 "}\n"
 "else\n"
 "{\n"
 "declare hf any;\n"
 "hf := rfc1808_parse_uri (url);\n"
-"hf[0] := \'\';\n"
-"hf[1] := \'\';\n"
-"hf[5] := \'\';\n"
+"hf[0] := \'\'; hf[1] := \'\'; hf[5] := \'\';\n"
 "tmp := \'GET \'||WS.WS.VFS_URI_COMPOSE (hf)||\' HTTP/1.1\\r\\nHost: \' || _host || \'\\r\\n\' || outhdr;\n"
 "tmp := replace (tmp, \'\\r\', \'\\n\');\n"
 "tmp := replace (tmp, \'\\n\\n\', \'\\n\');\n"
@@ -16106,9 +16792,10 @@ static const char *proc337 =
 "}\n"
 "\n"
 "}\n"
-"--src vfs.sql:1647\n";
+"--src vfs.sql:1772\n";
 
-static const char *proc338 = 
+static const char *proc348 = 
+"#line 1877 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.SITEMAP_ENSURE_NEW_SITE (in _host varchar, in _root varchar, in _new_host varchar, in _new_url varchar)\n"
 "{\n"
 "if (not exists (select 1 from WS.WS.VFS_SITE where VS_HOST = _new_host and VS_ROOT = _root))\n"
@@ -16120,14 +16807,19 @@ static const char *proc338 =
 "from WS.WS.VFS_SITE where VS_HOST = _host and VS_ROOT = _root;\n"
 "}    \n"
 "}\n"
-"--src vfs.sql:1741\n";
+"--src vfs.sql:1875\n";
 
-static const char *proc339 = 
+static const char *proc349 = 
+"#line 1891 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.SITEMAP_URLS_REGISTER (in _host varchar, in _root varchar, inout xp any, in lev int := 0, in sm int := 0)\n"
 "{\n"
+"declare _flw_s, _nflw_s, _url, _img varchar;\n"
+"whenever not found goto no_ini;\n"
+"select VS_FOLLOW, VS_NFOLLOW, VS_URL, VS_SRC into _flw_s, _nflw_s, _url, _img\n"
+"from VFS_SITE where VS_HOST = _host and VS_ROOT = _root;\n"
 "foreach (any u in xp) do\n"
 "{\n"
-"declare hf, host, url varchar;\n"
+"declare hf, host, url, abs_url varchar;\n"
 "declare ts datetime;\n"
 "\n"
 "ts := null;\n"
@@ -16139,31 +16831,35 @@ static const char *proc339 =
 "}\n"
 "else\n"
 "u := cast (u as varchar);\n"
+"abs_url := u;\n"
 "hf := WS.WS.PARSE_URI (u);\n"
 "host := hf[1];\n"
 "hf [0] := \'\';\n"
 "hf [1] := \'\';\n"
 "hf [5] := \'\'; \n"
 "url := WS.WS.VFS_URI_COMPOSE (hf);\n"
-"if (WS.WS.FOLLOW (_host, _root, url))\n"
-"{\n"
-"WS.WS.SITEMAP_ENSURE_NEW_SITE (_host, _root, host, url);\n"
-"if (not exists (select 1 from WS.WS.VFS_QUEUE where VQ_HOST = host and VQ_ROOT = _root and VQ_URL = url))\n"
+"if (host <> _host)\n"
+"url := abs_url;\n"
+"if (WS.WS.FOLLOW (_host, _root, url, _flw_s, _nflw_s, _url, _img))\n"
 "{\n"
-"insert soft WS.WS.VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_OTHER, VQ_LEVEL, VQ_VIA_SITEMAP) \n"
-"values (host, now (), url, \'waiting\', _root, \'other\', lev, sm); \n"
-"}\n"
-"else\n"
+"insert soft WS.WS.VFS_QUEUE (VQ_HOST, VQ_TS, VQ_URL, VQ_STAT, VQ_ROOT, VQ_LEVEL, VQ_VIA_SITEMAP) \n"
+"values (_host, now (), url, \'waiting\', _root, lev, sm); \n"
+"if (row_count () = 0)\n"
 "{\n"
-"update WS.WS.VFS_QUEUE set VQ_STAT = \'waiting\' where VQ_HOST = host and VQ_ROOT = _root and VQ_URL = url and VQ_TS < ts;\n"
+"update WS.WS.VFS_QUEUE set VQ_STAT = \'waiting\' where VQ_HOST = _host and VQ_ROOT = _root and VQ_URL = url and VQ_TS < ts;\n"
 "}\n"
 "}\n"
 "}\n"
+"if (length (xp))\n"
+"update WS.WS.VFS_SITE set VS_IS_SITEMAP = 1 where VS_HOST = _host and VS_ROOT = _root and VS_IS_SITEMAP = 0;\n"
 "commit work;\n"
+"no_ini:\n"
+"return;\n"
 "}\n"
-"--src vfs.sql:1755\n";
+"--src vfs.sql:1889\n";
 
-static const char *proc340 = 
+static const char *proc350 = 
+"#line 1938 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.SITEMAP_GET_LOC (inout xt any, in qr varchar, in loc varchar, in ts varchar)\n"
 "{\n"
 "declare xp, res any;\n"
@@ -16184,9 +16880,10 @@ static const char *proc340 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src vfs.sql:1795\n";
+"--src vfs.sql:1936\n";
 
-static const char *proc341 = 
+static const char *proc351 = 
+"#line 1960 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.SITEMAP_XML_PARSE (in _host varchar, in _url varchar, in _root varchar, inout _content varchar, \n"
 "in _c_type varchar := null, in lev int := 0)\n"
 "{\n"
@@ -16199,8 +16896,14 @@ static const char *proc341 =
 "};\n"
 "if (_url like \'%.xml.gz\')\n"
 "{\n"
+"if (length (_content) > 2)\n"
+"{\n"
+"declare magic varchar;\n"
+"magic := subseq (_content, 0, 2);\n"
+"if (magic[0] = 0hex1f and magic[1] = 0hex8b) \n"
 "_content := gzip_uncompress (_content); \n"
 "}\n"
+"}\n"
 "if (_url like \'%.xml\' or _url like \'%.xml.gz\' or _c_type = \'text/xml\' or _c_type = \'application/xml\' or _c_type = \'application/sparql-results+xml\')\n"
 "{\n"
 "xt := xtree_doc (_content);\n"
@@ -16249,14 +16952,15 @@ static const char *proc341 =
 "}\n"
 "}\n"
 "}\n"
-"--src vfs.sql:1817\n";
+"--src vfs.sql:1958\n";
 
-static const char *proc342 = 
+static const char *proc352 = 
+"#line 2030 \"[executable]/vfs.sql\"\n"
 "create procedure WS.WS.SITEMAP_RDF_STORE (in _host varchar, in _url varchar, in _root varchar,\n"
 "inout _content varchar, in _s_etag varchar, in _c_type varchar,\n"
 "in store_flag int := 1, in udata any := null, in lev int := 0)\n"
 "{\n"
-"declare graph, url_ck, base varchar;\n"
+"declare graph, use_tidy, url_ck, base varchar;\n"
 "graph := null;\n"
 "declare exit handler for sqlstate \'*\'\n"
 "{\n"
@@ -16269,6 +16973,9 @@ static const char *proc342 =
 "\n"
 "if (isvector (udata) and isstring (get_keyword (\'rdf-graph\', udata)))\n"
 "graph := get_keyword (\'rdf-graph\', udata, \'\');\n"
+"use_tidy := \'N\';\n"
+"if (isvector (udata) and isstring (get_keyword (\'use-tidy\', udata)))\n"
+"use_tidy := get_keyword (\'use-tidy\', udata, \'N\');\n"
 "base := WS.WS.VFS_URI_COMPOSE (vector (\'http\', _host, _url, \'\', \'\', \'\'));\n"
 "if (not length (graph))  \n"
 "graph := base;\n"
@@ -16294,6 +17001,8 @@ static const char *proc342 =
 "}\n"
 "else if (_c_type = \'text/html\')\n"
 "{\n"
+"if (tidy_external () and use_tidy = \'Y\')\n"
+"_content := tidy_html (_content, \'output-xhtml:yes\\r\\ntidy-mark:no\');\n"
 "DB.DBA.RDF_LOAD_RDFA (_content, base, graph, 2);\n"
 "}\n"
 "if (isvector (udata) and isvector (get_keyword (\'follow-property\', udata)))\n"
@@ -16322,7 +17031,82 @@ static const char *proc342 =
 "VU_HOST = _host and VU_URL = _url and VU_ROOT = _root;\n"
 "commit work;\n"
 "}\n"
-"--src vfs.sql:1881\n";
+"--src vfs.sql:2028\n";
+
+static const char *proc353 = 
+"#line 2107 \"[executable]/vfs.sql\"\n"
+"create procedure VFS_ROBOTS_PARSE (in txt varchar, in ua varchar)\n"
+"{\n"
+"declare s any;\n"
+"declare v1 any;\n"
+"declare match, exact_match, fill int;\n"
+"s := string_output ();\n"
+"http (txt, s);\n"
+"v1 := \'\';\n"
+"while (1)\n"
+"{\n"
+"declare l, arr any;\n"
+"next:	\n"
+"l := ses_read_line (s, 0, 0, 1);\n"
+"if (l = 0)\n"
+"goto ex;\n"
+"l := trim (l, \'\\r\\n \');\n"
+"arr := split_and_decode (l, 0, \'\\0\\0:\');\n"
+"if (arr is null)\n"
+"goto next;\n"
+"if (lower (arr[0]) = \'user-agent\')\n"
+"{\n"
+"declare u any;\n"
+"u := trim (arr[1]);\n"
+"fill := 0;\n"
+"if (match = 0 and exact_match = 0 and u = \'*\')\n"
+"{\n"
+"match := 1;\n"
+"fill := 1;\n"
+"}\n"
+"if (exact_match = 0 and u <> \'*\' and ua like u)\n"
+"{\n"
+"exact_match := 1;\n"
+"v1 := \'\';\n"
+"fill := 1;\n"
+"}\n"
+"}\n"
+"else if (fill and lower (arr[0]) = \'disallow\')\n"
+"{\n"
+"v1 := v1 || trim (arr[1]) || \'%;\';\n"
+"}\n"
+"}\n"
+"ex:\n"
+"v1 := trim (v1);\n"
+"if (length (v1) = 0)\n"
+"v1 := null;\n"
+"return v1;\n"
+"}\n"
+"--src vfs.sql:2105\n";
+
+static const char *proc354 = 
+"#line 2156 \"[executable]/vfs.sql\"\n"
+"create procedure VFS_ROBOTS_GET (in _host varchar, in _root varchar)\n"
+"{\n"
+"declare url, ret, head, me, robots any;\n"
+"url := vector (\'http\', _host, \'/robots.txt\', \'\', \'\', \'\');\n"
+"url := vfs_uri_compose (url);\n"
+"robots := null;\n"
+"declare exit handler for sqlstate \'*\' \n"
+"{\n"
+"goto en;\n"
+"};\n"
+"ret := DB.DBA.HTTP_CLIENT_EXT (url=>url, headers=>head, n_redirects=>5);\n"
+"if (not isvector (head) or length (head) = 0 or head[0] not like \'HTTP/1._ 200 %\')\n"
+"goto en;\n"
+"me := coalesce (cfg_item_value (virtuoso_ini_path (), \'HTTPServer\', \'ClientIdString\'), \n"
+"\'Mozilla/4.0 (compatible; OpenLink Virtuoso)\');\n"
+"robots := vfs_robots_parse (ret, me);\n"
+"en:\n"
+"update VFS_SITE set VS_ROBOTS = robots where VS_HOST = _host and VS_ROOT = _root;\n"
+"return robots;\n"
+"}\n"
+"--src vfs.sql:2154\n";
 
 /* davxml2rdfxml.xsl */
 
@@ -16897,7 +17681,8 @@ static const char *tbl0 =
 ")\n"
 "create index URIQA_HANDLER_ORDER_NAME on WS.WS.URIQA_HANDLER (UH_ORDER, UH_NAME)\n";
 
-static const char *proc343 = 
+static const char *proc355 = 
+"#line 44 \"[executable]/uriqa.sql\"\n"
 "create function WS.WS.URIQA_CFG_ITEM_VALUE (in param_name varchar, in is_list integer, in dflt_value varchar)\n"
 "{\n"
 "declare ini_path varchar;\n"
@@ -16936,9 +17721,10 @@ static const char *proc343 =
 "return deserialize (string_val);\n"
 "return string_val;\n"
 "}\n"
-"--src uriqa.sql:43\n";
+"--src uriqa.sql:42\n";
 
-static const char *proc344 = 
+static const char *proc356 = 
+"#line 84 \"[executable]/uriqa.sql\"\n"
 "create procedure WS.WS.URIQA_LOAD_FROM_INI ()\n"
 "{\n"
 "declare default_host, local_host_names, local_host_masks, our_fingerprint varchar;\n"
@@ -16986,11 +17772,12 @@ static const char *proc344 =
 "values\n"
 "( 100	, 999		, \'redir\'		, \'schema =\'	, \'http\'			, \'NATIVE_HTTP\'	, null			);\n"
 "}\n"
-"--src uriqa.sql:83\n";
+"--src uriqa.sql:82\n";
 
 static const char *other9 = 
 "WS.WS.URIQA_LOAD_FROM_INI ()\n";
-static const char *proc345 = 
+static const char *proc357 = 
+"#line 136 \"[executable]/uriqa.sql\"\n"
 "create function WS.WS.URIQA_FULL_URI (inout path varchar, inout params varchar, inout lines varchar, in parse_params integer, in trim_prefix integer) returns varchar\n"
 "{\n"
 "declare explicit_uri, host, head_uri, res varchar;\n"
@@ -17027,9 +17814,10 @@ static const char *proc345 =
 "\n"
 "return res;\n"
 "}\n"
-"--src uriqa.sql:135\n";
+"--src uriqa.sql:134\n";
 
-static const char *proc346 = 
+static const char *proc358 = 
+"#line 174 \"[executable]/uriqa.sql\"\n"
 "create function WS.WS.URIQA_APPLY_TRIGGERS (in op varchar, inout uri varchar, inout body any, inout params varchar, inout lines varchar) returns any\n"
 "{\n"
 "declare split, err_ret any;\n"
@@ -17086,9 +17874,10 @@ static const char *proc346 =
 "}\n"
 "return vector (\'URIQA\', 0, \'404\', sprintf (\'URIQA server has no way to access resource \"%s\"\', uri));\n"
 "}\n"
-"--src uriqa.sql:173\n";
+"--src uriqa.sql:172\n";
 
-static const char *proc347 = 
+static const char *proc359 = 
+"#line 232 \"[executable]/uriqa.sql\"\n"
 "create function WS.WS.URIQA_N3_DIR_LIST (inout split any, in a_uid integer)\n"
 "{\n"
 "declare diritems any;\n"
@@ -17124,9 +17913,10 @@ static const char *proc347 =
 "xte_nodebld_final (acc, xte_head (UNAME\' root\'));\n"
 "return xml_tree_doc (acc);\n"
 "}\n"
-"--src uriqa.sql:231\n";
+"--src uriqa.sql:230\n";
 
-static const char *proc348 = 
+static const char *proc360 = 
+"#line 269 \"[executable]/uriqa.sql\"\n"
 "create function DB.DBA.\"DAV_EXTRACT_DYN_RDF_application/xbel+xml\" (in id any, inout split any, inout old_prop any, in a_uid integer) returns any\n"
 "{\n"
 "declare ses, tree, label, roots any;\n"
@@ -17215,9 +18005,10 @@ static const char *proc348 =
 "return acc;\n"
 "\n"
 "}\n"
-"--src uriqa.sql:268\n";
+"--src uriqa.sql:267\n";
 
-static const char *proc349 = 
+static const char *proc361 = 
+"#line 359 \"[executable]/uriqa.sql\"\n"
 "create function WS.WS.URIQA_HANDLER_LOCALDAV (inout op varchar, inout uri varchar, inout split any, inout body any, inout params varchar, inout lines varchar, inout app_env any, inout is_final integer) returns any\n"
 "{\n"
 "declare id, old_prop, old_descr, rc any;\n"
@@ -17426,9 +18217,10 @@ static const char *proc349 =
 "is_final := 1;\n"
 "return vector (\'URIQA\', 0, \'500\', sprintf (\'Virtuoso DAV does not support URIQA operation \"%s\"\', op));\n"
 "}\n"
-"--src uriqa.sql:358\n";
+"--src uriqa.sql:357\n";
 
-static const char *proc350 = 
+static const char *proc362 = 
+"#line 569 \"[executable]/uriqa.sql\"\n"
 "create function WS.WS.URIQA_HANDLER_NATIVE_HTTP (inout op varchar, inout uri varchar, inout split any, inout body any, inout params varchar, inout lines varchar, inout app_env any, inout is_final integer) returns any\n"
 "{\n"
 "declare req_uri, req_header, resp_page, resp_header any;\n"
@@ -17495,9 +18287,10 @@ static const char *proc350 =
 "return vector (\'URIQA\', 0, \'500\', \'The remote URIQA server returned an empty header\');\n"
 "\n"
 "}\n"
-"--src uriqa.sql:568\n";
+"--src uriqa.sql:567\n";
 
-static const char *proc351 = 
+static const char *proc363 = 
+"#line 637 \"[executable]/uriqa.sql\"\n"
 "create procedure WS.WS.URIQA_STATUS (in err_ret any, in signal_errors integer)\n"
 "{\n"
 "\n"
@@ -17521,9 +18314,10 @@ static const char *proc351 =
 "else\n"
 "http_request_status (sprintf (\'HTTP/1.1 %s %s\', err_ret[2], split_and_decode (err_ret[3], 0, \'\\0\\0\\n\')[0]));\n"
 "}\n"
-"--src uriqa.sql:636\n";
+"--src uriqa.sql:635\n";
 
-static const char *proc352 = 
+static const char *proc364 = 
+"#line 665 \"[executable]/uriqa.sql\"\n"
 "create procedure WS.WS.\"MPUT\" (inout path varchar, inout params varchar, inout lines varchar)\n"
 "{\n"
 "declare b, err_ret any;\n"
@@ -17538,9 +18332,10 @@ static const char *proc352 =
 "err_ret := WS.WS.URIQA_APPLY_TRIGGERS (\'MPUT\', s_uri, b, params, lines);\n"
 "WS.WS.URIQA_STATUS (err_ret, 0);\n"
 "}\n"
-"--src uriqa.sql:664\n";
+"--src uriqa.sql:663\n";
 
-static const char *proc353 = 
+static const char *proc365 = 
+"#line 681 \"[executable]/uriqa.sql\"\n"
 "create procedure WS.WS.\"MGET\" (inout path varchar, inout params any, inout lines any)\n"
 "{\n"
 "declare b any;\n"
@@ -17557,9 +18352,10 @@ static const char *proc353 =
 "err_ret := WS.WS.URIQA_APPLY_TRIGGERS (\'MGET\', s_uri, b, params, lines);\n"
 "WS.WS.URIQA_STATUS (err_ret, 0);\n"
 "}\n"
-"--src uriqa.sql:680\n";
+"--src uriqa.sql:679\n";
 
-static const char *proc354 = 
+static const char *proc366 = 
+"#line 699 \"[executable]/uriqa.sql\"\n"
 "create procedure WS.WS.\"MDELETE\" (inout path varchar, inout params any, inout lines any)\n"
 "{\n"
 "declare b any;\n"
@@ -17574,9 +18370,10 @@ static const char *proc354 =
 "err_ret := WS.WS.URIQA_APPLY_TRIGGERS (\'MDELETE\', s_uri, b, params, lines);\n"
 "WS.WS.URIQA_STATUS (err_ret, 0);\n"
 "}\n"
-"--src uriqa.sql:698\n";
+"--src uriqa.sql:697\n";
 
-static const char *proc355 = 
+static const char *proc367 = 
+"#line 715 \"[executable]/uriqa.sql\"\n"
 "create procedure WS.WS.\"/!URIQA/\" (inout path varchar, inout params any, inout lines any)\n"
 "{\n"
 "declare exit handler for sqlstate \'*\' {\n"
@@ -17618,9 +18415,10 @@ static const char *proc355 =
 "err_ret := WS.WS.URIQA_APPLY_TRIGGERS (get_keyword (\'method\', params, \'MGET\'), s_uri, b, params, lines);\n"
 "WS.WS.URIQA_STATUS (err_ret, 0);\n"
 "}\n"
-"--src uriqa.sql:714\n";
+"--src uriqa.sql:713\n";
 
-static const char *proc356 = 
+static const char *proc368 = 
+"#line 758 \"[executable]/uriqa.sql\"\n"
 "create procedure WS.WS.URIQA_VHOST_RESET()\n"
 "{\n"
 "registry_set (\'/!URIQA/\', \'no_vsp_recompile\');\n"
@@ -17631,11 +18429,12 @@ static const char *proc356 =
 "DB.DBA.VHOST_DEFINE (lpath=>\'/URIQA/\', ppath=>\'/!URIQA/\', is_dav=>1, vsp_user=>\'dba\', opts=>vector(\'noinherit\', 1));\n"
 "DB.DBA.VHOST_DEFINE (lpath=>\'/uriqa/\', ppath=>\'/!URIQA/\', is_dav=>1, vsp_user=>\'dba\', opts=>vector(\'noinherit\', 1));\n"
 "}\n"
-"--src uriqa.sql:757\n";
+"--src uriqa.sql:756\n";
 
 /* DET_CatFilter.sql */
 
-static const char *proc357 = 
+static const char *proc369 = 
+"#line 32 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_AUTHENTICATE\" (in id any, in what char(1), in req varchar, in auth_uname varchar, in auth_pwd varchar, in auth_uid integer)\n"
 "{\n"
 "declare cfc_id integer;\n"
@@ -17678,9 +18477,10 @@ static const char *proc357 =
 "}\n"
 "return -14;\n"
 "}\n"
-"--src DET_CatFilter.sql:31\n";
+"--src DET_CatFilter.sql:30\n";
 
-static const char *proc358 = 
+static const char *proc370 = 
+"#line 77 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_GET_CONDITION\" (in detcol_id integer, out cfc_id integer, out rfc_spath varchar, out rfc_list_cond any, out rfc_del_action any)\n"
 "{\n"
 "\n"
@@ -17695,9 +18495,10 @@ static const char *proc358 =
 "nf:\n"
 "return -1;\n"
 "}\n"
-"--src DET_CatFilter.sql:76\n";
+"--src DET_CatFilter.sql:75\n";
 
-static const char *proc359 = 
+static const char *proc371 = 
+"#line 94 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_ENCODE_CATVALUE\" (in val varchar) returns varchar\n"
 "{\n"
 "declare ses any;\n"
@@ -17732,9 +18533,10 @@ static const char *proc359 =
 "}\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src DET_CatFilter.sql:93\n";
+"--src DET_CatFilter.sql:92\n";
 
-static const char *proc360 = 
+static const char *proc372 = 
+"#line 131 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DECODE_CATVALUE\" (in catval varchar, out crop integer)\n"
 "{\n"
 "declare val varchar;\n"
@@ -17768,9 +18570,10 @@ static const char *proc360 =
 "val := split_and_decode (catval, 0, \'^\');\n"
 "return val;\n"
 "}\n"
-"--src DET_CatFilter.sql:130\n";
+"--src DET_CatFilter.sql:129\n";
 
-static const char *proc361 = 
+static const char *proc373 = 
+"#line 167 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_PATH_PARTS_TO_FILTER\" (inout path_parts any, out schema_uri varchar, out filter_data any) returns integer\n"
 "{\n"
 "declare prop_catnames varchar;\n"
@@ -17822,9 +18625,10 @@ static const char *proc361 =
 "\n"
 "return -1;\n"
 "}\n"
-"--src DET_CatFilter.sql:166\n";
+"--src DET_CatFilter.sql:165\n";
 
-static const char *proc362 = 
+static const char *proc374 = 
+"#line 221 \"[executable]/DET_CatFilter.sql\"\n"
 "create procedure \"CatFilter_ACC_FILTER_DATA\" (inout filter any, inout filter_data any)\n"
 "{\n"
 "declare ctr, len integer;\n"
@@ -17845,9 +18649,10 @@ static const char *proc362 =
 "vectorbld_acc (filter, pred);\n"
 "}\n"
 "}\n"
-"--src DET_CatFilter.sql:220\n";
+"--src DET_CatFilter.sql:219\n";
 
-static const char *proc363 = 
+static const char *proc375 = 
+"#line 244 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_SEARCH_ID_IMPL\" (in detcol_id any, in path_parts any, in what char(1), inout cfc_id integer, inout rfc_spath varchar, inout rfc_list_cond any, inout rfc_del_action any, inout filter_data any) returns any\n"
 "{\n"
 "declare schema_catname, schema_uri, res_name, colpath, orig_fnameext varchar;\n"
@@ -17937,9 +18742,10 @@ static const char *proc363 =
 "return -1;\n"
 "return vector (UNAME\'CatFilter\', detcol_id, execrows[0][0], schema_uri, case (length (filter_data)) when 0 then null else filter_data end);\n"
 "}\n"
-"--src DET_CatFilter.sql:243\n";
+"--src DET_CatFilter.sql:242\n";
 
-static const char *proc364 = 
+static const char *proc376 = 
+"#line 336 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_AUTHENTICATE_HTTP\" (in id any, in what char(1), in req varchar, in can_write_http integer, inout a_lines any, inout a_uname varchar, inout a_pwd varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer\n"
 "{\n"
 "declare cfc_id integer;\n"
@@ -17989,9 +18795,10 @@ static const char *proc364 =
 "}\n"
 "return -14;\n"
 "}\n"
-"--src DET_CatFilter.sql:335\n";
+"--src DET_CatFilter.sql:334\n";
 
-static const char *proc365 = 
+static const char *proc377 = 
+"#line 388 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_GET_PARENT\" (in id any, in st char(1), in path varchar) returns any\n"
 "{\n"
 "\n"
@@ -18011,33 +18818,37 @@ static const char *proc365 =
 "}\n"
 "return -20;\n"
 "}\n"
-"--src DET_CatFilter.sql:387\n";
+"--src DET_CatFilter.sql:386\n";
 
-static const char *proc366 = 
+static const char *proc378 = 
+"#line 410 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_COL_CREATE\" (in detcol_id any, in path_parts any, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_CatFilter.sql:409\n";
+"--src DET_CatFilter.sql:408\n";
 
-static const char *proc367 = 
+static const char *proc379 = 
+"#line 418 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_COL_MOUNT\" (in detcol_id any, in path_parts any, in full_mount_path varchar, in mount_det varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_CatFilter.sql:417\n";
+"--src DET_CatFilter.sql:416\n";
 
-static const char *proc368 = 
+static const char *proc380 = 
+"#line 426 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_COL_MOUNT_HERE\" (in parent_id any, in full_mount_path varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_CatFilter.sql:425\n";
+"--src DET_CatFilter.sql:424\n";
 
-static const char *proc369 = 
+static const char *proc381 = 
+"#line 434 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_DELETE\" (in detcol_id any, in path_parts any, in what char(1), in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "declare rc integer;\n"
@@ -18086,9 +18897,10 @@ static const char *proc369 =
 "update WS.WS.SYS_DAV_PROP set prop_value = serialize (new_rdf) where PROP_NAME = \'http://local.virt/DAV-RDF\' and PROP_TYPE = \'R\' and PROP_PARENT_ID = orig_id [2];\n"
 "return 0;\n"
 "}\n"
-"--src DET_CatFilter.sql:433\n";
+"--src DET_CatFilter.sql:432\n";
 
-static const char *proc370 = 
+static const char *proc382 = 
+"#line 485 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_FILTER_TO_CONDITION\" (inout schema_uri varchar, inout filter_data any, inout cond any) returns integer\n"
 "{\n"
 "declare ctr, len integer;\n"
@@ -18114,9 +18926,10 @@ static const char *proc370 =
 "vectorbld_final (cond);\n"
 "return 0;\n"
 "}\n"
-"--src DET_CatFilter.sql:484\n";
+"--src DET_CatFilter.sql:483\n";
 
-static const char *proc371 = 
+static const char *proc383 = 
+"#line 512 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_RES_UPLOAD\" (in detcol_id any, in path_parts any, inout content any, in type varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare rc integer;\n"
@@ -18165,9 +18978,10 @@ static const char *proc371 =
 "\"ResFilter_FIT_INTO_CONDITION\" (orig_id, \'R\', fit_cond, auth_uid);\n"
 "return vector (UNAME\'CatFilter\', detcol_id, orig_id, schema_uri, filter_data);\n"
 "}\n"
-"--src DET_CatFilter.sql:511\n";
+"--src DET_CatFilter.sql:510\n";
 
-static const char *proc372 = 
+static const char *proc384 = 
+"#line 562 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_PROP_REMOVE\" (in id any, in st char(0), in propname varchar, in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "\n"
@@ -18178,9 +18992,10 @@ static const char *proc372 =
 "return call (cast (id[0] as varchar) || \'_DAV_PROP_REMOVE\') (id, st, propname, silent, auth_uid);\n"
 "return DAV_PROP_REMOVE_RAW (id, st, propname, silent, auth_uid);\n"
 "}\n"
-"--src DET_CatFilter.sql:561\n";
+"--src DET_CatFilter.sql:560\n";
 
-static const char *proc373 = 
+static const char *proc385 = 
+"#line 575 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_PROP_SET\" (in id any, in st char(0), in propname varchar, in propvalue any, in overwrite integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare pid integer;\n"
@@ -18193,9 +19008,10 @@ static const char *proc373 =
 "return call (cast (id[0] as varchar) || \'_DAV_PROP_SET\') (id, st, propname, propvalue, overwrite, auth_uid);\n"
 "return DAV_PROP_SET_RAW (id, st, propname, propvalue, overwrite, auth_uid);\n"
 "}\n"
-"--src DET_CatFilter.sql:574\n";
+"--src DET_CatFilter.sql:573\n";
 
-static const char *proc374 = 
+static const char *proc386 = 
+"#line 590 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_PROP_GET\" (in id any, in what char(0), in propname varchar, in auth_uid integer)\n"
 "{\n"
 "declare ret varchar;\n"
@@ -18212,9 +19028,10 @@ static const char *proc374 =
 "no_prop:\n"
 "return -11;\n"
 "}\n"
-"--src DET_CatFilter.sql:589\n";
+"--src DET_CatFilter.sql:588\n";
 
-static const char *proc375 = 
+static const char *proc387 = 
+"#line 609 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_PROP_LIST\" (in id any, in what char(0), in propmask varchar, in auth_uid integer)\n"
 "{\n"
 "declare ret any;\n"
@@ -18229,9 +19046,10 @@ static const char *proc375 =
 "vectorbld_final (ret);\n"
 "return ret;\n"
 "}\n"
-"--src DET_CatFilter.sql:608\n";
+"--src DET_CatFilter.sql:607\n";
 
-static const char *proc376 = 
+static const char *proc388 = 
+"#line 626 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_DIR_SINGLE\" (in id any, in what char(0), in path any, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
@@ -18325,16 +19143,18 @@ static const char *proc376 =
 "}\n"
 "return -1;\n"
 "}\n"
-"--src DET_CatFilter.sql:625\n";
+"--src DET_CatFilter.sql:624\n";
 
-static const char *proc377 = 
+static const char *proc389 = 
+"#line 722 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_LIST_SCHEMAS\" (in rfc_spath varchar, inout rfc_list_cond any, in auth_uid integer) returns any\n"
 "{\n"
 "return (select VECTOR_AGG (vector (RS_URI, RS_CATNAME)) from WS.WS.SYS_RDF_SCHEMAS);\n"
 "}\n"
-"--src DET_CatFilter.sql:721\n";
+"--src DET_CatFilter.sql:720\n";
 
-static const char *proc378 = 
+static const char *proc390 = 
+"#line 728 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_LIST_SCHEMA_PROPS\" (in rfc_spath varchar, inout rfc_list_cond any, inout schema_uri varchar, inout filter_data any, in auth_uid integer) returns any\n"
 "{\n"
 "declare prop_catnames, res any;\n"
@@ -18362,9 +19182,10 @@ static const char *proc378 =
 "}\n"
 "return vector();\n"
 "}\n"
-"--src DET_CatFilter.sql:727\n";
+"--src DET_CatFilter.sql:726\n";
 
-static const char *proc379 = 
+static const char *proc391 = 
+"#line 758 \"[executable]/DET_CatFilter.sql\"\n"
 "create procedure \"CatFilter_GET_RDF_INVERSE_HITS_DISTVALS\" (in cfc_id integer, inout filter_data any, inout distval_dict any, in auth_uid integer)\n"
 "{\n"
 "declare filter_length, p0_id, p1_id, p2_id, p3_id, p4_id, res0_id, res1_id, res2_id, res3_id, res4_id, res_last_id, res_id_max integer;\n"
@@ -18577,9 +19398,10 @@ static const char *proc379 =
 "nf_c_last2:\n"
 "close c_last2;\n"
 "}\n"
-"--src DET_CatFilter.sql:757\n";
+"--src DET_CatFilter.sql:756\n";
 
-static const char *proc380 = 
+static const char *proc392 = 
+"#line 973 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_GET_RDF_INVERSE_HITS_RES_IDS\" (in cfc_id integer, inout filter_data any, in auth_uid integer) returns any\n"
 "{\n"
 "declare filter_length, p0_id, p1_id, p2_id, p3_id, p4_id, res0_id, res1_id, res2_id, res3_id, res4_id, res_id_max integer;\n"
@@ -18745,9 +19567,10 @@ static const char *proc380 =
 "\n"
 "return acc;\n"
 "}\n"
-"--src DET_CatFilter.sql:972\n";
+"--src DET_CatFilter.sql:971\n";
 
-static const char *proc381 = 
+static const char *proc393 = 
+"#line 1141 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_LIST_PROP_DISTVALS_AUX\" (inout dict any, inout rfp varchar, inout vals any)\n"
 "{\n"
 "\n"
@@ -18758,9 +19581,10 @@ static const char *proc381 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src DET_CatFilter.sql:1140\n";
+"--src DET_CatFilter.sql:1139\n";
 
-static const char *proc382 = 
+static const char *proc394 = 
+"#line 1153 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_LIST_PROP_DISTVALS\" (in detcol_id integer, in cfc_id integer, in rfc_spath varchar, inout rfc_list_cond any, inout schema_uri varchar, inout filter_data any, in auth_uid integer) returns any\n"
 "{\n"
 "declare prop_catnames, filter, res any;\n"
@@ -18830,9 +19654,10 @@ static const char *proc382 =
 "}\n"
 "return dict_list_keys (dict, 1);\n"
 "}\n"
-"--src DET_CatFilter.sql:1152\n";
+"--src DET_CatFilter.sql:1151\n";
 
-static const char *proc383 = 
+static const char *proc395 = 
+"#line 1224 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_DIR_LIST\" (in detcol_id any, in path_parts any, in detcol_path varchar, in name_mask varchar, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare cfc_id integer;\n"
@@ -19075,9 +19900,10 @@ static const char *proc383 =
 "\n"
 "return res;\n"
 "}\n"
-"--src DET_CatFilter.sql:1223\n";
+"--src DET_CatFilter.sql:1222\n";
 
-static const char *proc384 = 
+static const char *proc396 = 
+"#line 1469 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_DIR_FILTER\" (in detcol_id any, in path_parts any, in detcol_path varchar, inout compilation any, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare cfc_id integer;\n"
@@ -19130,9 +19956,10 @@ static const char *proc384 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src DET_CatFilter.sql:1468\n";
+"--src DET_CatFilter.sql:1467\n";
 
-static const char *proc385 = 
+static const char *proc397 = 
+"#line 1524 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_SEARCH_ID\" (in detcol_id any, in path_parts any, in what char(1)) returns any\n"
 "{\n"
 "declare cfc_id integer;\n"
@@ -19144,9 +19971,10 @@ static const char *proc385 =
 "orig_id := \"CatFilter_DAV_SEARCH_ID_IMPL\" (detcol_id, path_parts, what, cfc_id, rfc_spath, rfc_list_cond, rfc_del_action, filter_data);\n"
 "return orig_id;\n"
 "}\n"
-"--src DET_CatFilter.sql:1523\n";
+"--src DET_CatFilter.sql:1522\n";
 
-static const char *proc386 = 
+static const char *proc398 = 
+"#line 1538 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_SEARCH_PATH\" (in id any, in what char(1)) returns any\n"
 "{\n"
 "\n"
@@ -19171,9 +19999,10 @@ static const char *proc386 =
 "\n"
 "return -14;\n"
 "}\n"
-"--src DET_CatFilter.sql:1537\n";
+"--src DET_CatFilter.sql:1536\n";
 
-static const char *proc387 = 
+static const char *proc399 = 
+"#line 1565 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_RES_UPLOAD_COPY\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare cfc_id integer;\n"
@@ -19227,9 +20056,10 @@ static const char *proc387 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src DET_CatFilter.sql:1564\n";
+"--src DET_CatFilter.sql:1563\n";
 
-static const char *proc388 = 
+static const char *proc400 = 
+"#line 1621 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_RES_UPLOAD_MOVE\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare cfc_id integer;\n"
@@ -19280,9 +20110,10 @@ static const char *proc388 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src DET_CatFilter.sql:1620\n";
+"--src DET_CatFilter.sql:1619\n";
 
-static const char *proc389 = 
+static const char *proc401 = 
+"#line 1674 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_RES_CONTENT\" (in id any, inout content any, out type varchar, in content_mode integer) returns integer\n"
 "{\n"
 "\n"
@@ -19295,17 +20126,19 @@ static const char *proc389 =
 "select http (RES_CONTENT), RES_TYPE into cont, type from WS.WS.SYS_DAV_RES where RES_ID = id[2];\n"
 "return id[2];\n"
 "}\n"
-"--src DET_CatFilter.sql:1673\n";
+"--src DET_CatFilter.sql:1672\n";
 
-static const char *proc390 = 
+static const char *proc402 = 
+"#line 1689 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_SYMLINK\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_CatFilter.sql:1688\n";
+"--src DET_CatFilter.sql:1687\n";
 
-static const char *proc391 = 
+static const char *proc403 = 
+"#line 1697 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_LOCK\" (in path any, inout id any, in type char(1), inout locktype varchar, inout scope varchar, in token varchar, inout owner_name varchar, inout owned_tokens varchar, in depth varchar, in timeout_sec integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare rc, u_token, new_token varchar;\n"
@@ -19318,9 +20151,10 @@ static const char *proc391 =
 "return DAV_LOCK_INT (path, id[2], type, locktype, scope, token, owner_name, owned_tokens, depth, timeout_sec, null, null, auth_uid);\n"
 "return -20;\n"
 "}\n"
-"--src DET_CatFilter.sql:1696\n";
+"--src DET_CatFilter.sql:1695\n";
 
-static const char *proc392 = 
+static const char *proc404 = 
+"#line 1712 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_UNLOCK\" (in id any, in type char(1), in token varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
@@ -19328,9 +20162,10 @@ static const char *proc392 =
 "id := id [2];\n"
 "return DAV_UNLOCK_INT (id, type, token, null, null, auth_uid);\n"
 "}\n"
-"--src DET_CatFilter.sql:1711\n";
+"--src DET_CatFilter.sql:1710\n";
 
-static const char *proc393 = 
+static const char *proc405 = 
+"#line 1722 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_IS_LOCKED\" (inout id any, inout type char(1), in owned_tokens varchar) returns integer\n"
 "{\n"
 "declare rc integer;\n"
@@ -19352,9 +20187,10 @@ static const char *proc393 =
 "type := orig_type;\n"
 "return 0;\n"
 "}\n"
-"--src DET_CatFilter.sql:1721\n";
+"--src DET_CatFilter.sql:1720\n";
 
-static const char *proc394 = 
+static const char *proc406 = 
+"#line 1746 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_DAV_LIST_LOCKS\" (in id any, in type char(1), in recursive integer) returns any\n"
 "{\n"
 "declare res any;\n"
@@ -19369,9 +20205,10 @@ static const char *proc394 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src DET_CatFilter.sql:1745\n";
+"--src DET_CatFilter.sql:1744\n";
 
-static const char *proc395 = 
+static const char *proc407 = 
+"#line 1763 \"[executable]/DET_CatFilter.sql\"\n"
 "create function \"CatFilter_CONFIGURE\" (in col any, in search_path varchar, in filter any, in auth_uname varchar := \'dav\', in auth_upwd varchar := \'dav\', in auth_uid integer := null) returns integer\n"
 "{\n"
 "declare cfid, rc, ctr integer;\n"
@@ -19442,9 +20279,10 @@ static const char *proc395 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src DET_CatFilter.sql:1762\n";
+"--src DET_CatFilter.sql:1761\n";
 
-static const char *proc396 = 
+static const char *proc408 = 
+"#line 1836 \"[executable]/DET_CatFilter.sql\"\n"
 "create procedure \"CatFilter_FEED_DAV_RDF_INVERSE\" (inout propval any, inout propparent integer, in is_del integer := 0, in cfid integer := null)\n"
 "{\n"
 "declare resfullpath, path_head, pv varchar;\n"
@@ -19524,9 +20362,10 @@ static const char *proc396 =
 "}\n"
 "goto next_cfid;\n"
 "}\n"
-"--src DET_CatFilter.sql:1835\n";
+"--src DET_CatFilter.sql:1834\n";
 
-static const char *trig33 = 
+static const char *trig35 = 
+"#line 1918 \"[executable]/DET_CatFilter.sql\"\n"
 "create trigger SYS_DAV_PROP_VALUE_RDF_I after insert on WS.WS.SYS_DAV_PROP order 10 referencing new as NP\n"
 "{\n"
 "if (NP.PROP_NAME <> \'http://local.virt/DAV-RDF\')\n"
@@ -19535,9 +20374,10 @@ static const char *trig33 =
 "return;\n"
 "\"CatFilter_FEED_DAV_RDF_INVERSE\" (NP.PROP_VALUE, NP.PROP_PARENT_ID);\n"
 "}\n"
-"--src DET_CatFilter.sql:1917\n";
+"--src DET_CatFilter.sql:1916\n";
 
-static const char *trig34 = 
+static const char *trig36 = 
+"#line 1929 \"[executable]/DET_CatFilter.sql\"\n"
 "create trigger SYS_DAV_PROP_VALUE_RDF_D before delete on WS.WS.SYS_DAV_PROP order 10 referencing old as OP\n"
 "{\n"
 "declare pv varchar;\n"
@@ -19548,9 +20388,10 @@ static const char *trig34 =
 "return;\n"
 "\"CatFilter_FEED_DAV_RDF_INVERSE\" (OP.PROP_VALUE, OP.PROP_PARENT_ID, 1);\n"
 "}\n"
-"--src DET_CatFilter.sql:1928\n";
+"--src DET_CatFilter.sql:1927\n";
 
-static const char *trig35 = 
+static const char *trig37 = 
+"#line 1942 \"[executable]/DET_CatFilter.sql\"\n"
 "create trigger SYS_DAV_PROP_VALUE_RDF_U after update on WS.WS.SYS_DAV_PROP order 10 referencing old as OP, new as NP\n"
 "{\n"
 "declare pv varchar;\n"
@@ -19568,9 +20409,10 @@ static const char *trig35 =
 "return;\n"
 "\"CatFilter_FEED_DAV_RDF_INVERSE\" (NP.PROP_VALUE, NP.PROP_PARENT_ID);\n"
 "}\n"
-"--src DET_CatFilter.sql:1941\n";
+"--src DET_CatFilter.sql:1940\n";
 
-static const char *proc397 = 
+static const char *proc409 = 
+"#line 1962 \"[executable]/DET_CatFilter.sql\"\n"
 "create procedure \"CatFilter_INIT_SYS_DAV_RDF_INVERSE\" (in run_if_once integer)\n"
 "{\n"
 "declare ctr integer;\n"
@@ -19596,7 +20438,7 @@ static const char *proc397 =
 "commit work;\n"
 "}\n"
 "}\n"
-"--src DET_CatFilter.sql:1961\n";
+"--src DET_CatFilter.sql:1960\n";
 
 /* DET_HostFs.sql */
 
@@ -19672,7 +20514,8 @@ static const char *tbl5 =
 "primary key (HRI_TOPCOL_ID, HRI_PROP_CATID, HRI_CATVALUE, HRI_RES_ID)\n"
 ")\n";
 
-static const char *proc398 = 
+static const char *proc410 = 
+"#line 98 \"[executable]/DET_HostFs.sql\"\n"
 "create procedure WS.WS.HOSTFS_FEED_RDF_INVERSE (inout propval any, in r_id integer, in is_del integer, in topcol_id integer)\n"
 "{\n"
 "declare resfullpath, path_head, pv varchar;\n"
@@ -19705,25 +20548,28 @@ static const char *proc398 =
 "r_id );\n"
 "}\n"
 "}\n"
-"--src DET_HostFs.sql:97\n";
+"--src DET_HostFs.sql:96\n";
 
-static const char *trig36 = 
+static const char *trig38 = 
+"#line 133 \"[executable]/DET_HostFs.sql\"\n"
 "create trigger HOSTFS_RES_META_I after insert on WS.WS.HOSTFS_RES_META referencing new as NP\n"
 "{\n"
 "if (NP.RESM_DATA is not null)\n"
 "WS.WS.HOSTFS_FEED_RDF_INVERSE (NP.RESM_DATA, NP.RESM_ID, 0, NP.RESM_TOPCOL_ID);\n"
 "}\n"
-"--src DET_HostFs.sql:132\n";
+"--src DET_HostFs.sql:131\n";
 
-static const char *trig37 = 
+static const char *trig39 = 
+"#line 141 \"[executable]/DET_HostFs.sql\"\n"
 "create trigger HOSTFS_RES_META_D before delete on WS.WS.HOSTFS_RES_META referencing old as OP\n"
 "{\n"
 "if (OP.RESM_DATA is not null)\n"
 "WS.WS.HOSTFS_FEED_RDF_INVERSE (OP.RESM_DATA, OP.RESM_ID, 1, OP.RESM_TOPCOL_ID);\n"
 "}\n"
-"--src DET_HostFs.sql:140\n";
+"--src DET_HostFs.sql:139\n";
 
-static const char *trig38 = 
+static const char *trig40 = 
+"#line 149 \"[executable]/DET_HostFs.sql\"\n"
 "create trigger HOSTFS_RES_META_U after update on WS.WS.HOSTFS_RES_META referencing old as OP, new as NP\n"
 "{\n"
 "if (OP.RESM_DATA is not null)\n"
@@ -19731,13 +20577,14 @@ static const char *trig38 =
 "if (NP.RESM_DATA is not null)\n"
 "WS.WS.HOSTFS_FEED_RDF_INVERSE (NP.RESM_DATA, NP.RESM_ID, 0, NP.RESM_TOPCOL_ID);\n"
 "}\n"
-"--src DET_HostFs.sql:148\n";
+"--src DET_HostFs.sql:147\n";
 
 static const char *other10 = 
 "DB.DBA.vt_create_text_index (fix_identifier_case (\'WS.WS.HOSTFS_RES_META\'), fix_identifier_case (\'RESM_DATA\'), fix_identifier_case (\'RESM_ID\'), 2, 0, NULL, 0, \'*ini*\', \'*ini*\')\n";
 static const char *other11 = 
 "DB.DBA.vt_batch_update (fix_identifier_case (\'WS.WS.HOSTFS_RES_META\'), \'ON\', 1)\n";
-static const char *proc399 = 
+static const char *proc411 = 
+"#line 171 \"[executable]/DET_HostFs.sql\"\n"
 "create function WS.WS.HOSTFS_RES_TOPCOL_ID (in r_id integer) returns integer\n"
 "{\n"
 "declare res, parent integer;\n"
@@ -19752,9 +20599,10 @@ static const char *proc399 =
 "nf:\n"
 "return 0;\n"
 "}\n"
-"--src DET_HostFs.sql:170\n";
+"--src DET_HostFs.sql:169\n";
 
-static const char *proc400 = 
+static const char *proc412 = 
+"#line 187 \"[executable]/DET_HostFs.sql\"\n"
 "create procedure WS.WS.HOSTFS_EXTRACT_AND_SAVE_RDF (in resid integer, in resname varchar, in restype varchar, inout rescontent any, in topcol_id integer)\n"
 "{\n"
 "declare resttype varchar;\n"
@@ -19781,9 +20629,10 @@ static const char *proc400 =
 "no_op:\n"
 " ;\n"
 "}\n"
-"--src DET_HostFs.sql:186\n";
+"--src DET_HostFs.sql:185\n";
 
-static const char *proc401 = 
+static const char *proc413 = 
+"#line 215 \"[executable]/DET_HostFs.sql\"\n"
 "create procedure WS.WS.HOSTFS_TEST_RDF (in d_id integer)\n"
 "{\n"
 "\n"
@@ -19816,9 +20665,10 @@ static const char *proc401 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src DET_HostFs.sql:214\n";
+"--src DET_HostFs.sql:213\n";
 
-static const char *proc402 = 
+static const char *proc414 = 
+"#line 249 \"[executable]/DET_HostFs.sql\"\n"
 "create function\n"
 "WS.WS.HOSTFS_RES_CACHE_RESC_DATA_INDEX_HOOK (inout vtb any, inout d_id integer) returns integer\n"
 "{\n"
@@ -19858,9 +20708,10 @@ static const char *proc402 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src DET_HostFs.sql:248\n";
+"--src DET_HostFs.sql:247\n";
 
-static const char *proc403 = 
+static const char *proc415 = 
+"#line 290 \"[executable]/DET_HostFs.sql\"\n"
 "create function\n"
 "WS.WS.HOSTFS_RES_CACHE_RESC_DATA_UNINDEX_HOOK (inout vtb any, inout d_id integer) returns integer\n"
 "{\n"
@@ -19882,13 +20733,14 @@ static const char *proc403 =
 "done:\n"
 "return 1;\n"
 "}\n"
-"--src DET_HostFs.sql:289\n";
+"--src DET_HostFs.sql:288\n";
 
 static const char *other12 = 
 "DB.DBA.vt_create_text_index (fix_identifier_case (\'WS.WS.HOSTFS_RES_CACHE\'), fix_identifier_case (\'RESC_DATA\'), fix_identifier_case (\'RESC_ID\'), 2, 0, NULL, 1, \'*ini*\', \'*ini*\')\n";
 static const char *other13 = 
 "DB.DBA.vt_batch_update (fix_identifier_case (\'WS.WS.HOSTFS_RES_CACHE\'), \'ON\', 5)\n";
-static const char *proc404 = 
+static const char *proc416 = 
+"#line 325 \"[executable]/DET_HostFs.sql\"\n"
 "create function\n"
 "WS.WS.HOSTFS_FIND_COL (in full_path varchar) returns integer\n"
 "{\n"
@@ -19925,9 +20777,10 @@ static const char *proc404 =
 "(res	, full_path || \'/\'	, parent	, cr_time	, cr_time	, NULL		, now ()		, cname		);\n"
 "return res;\n"
 "}\n"
-"--src DET_HostFs.sql:324\n";
+"--src DET_HostFs.sql:323\n";
 
-static const char *proc405 = 
+static const char *proc417 = 
+"#line 363 \"[executable]/DET_HostFs.sql\"\n"
 "create procedure\n"
 "WS.WS.HOSTFS_COL_DISAPPEARS (in full_path varchar)\n"
 "{\n"
@@ -19946,9 +20799,10 @@ static const char *proc405 =
 "}\n"
 "delete from WS.WS.HOSTFS_COL where COL_FULL_PATH between full_path || \'/\' and full_path || \'0\';\n"
 "}\n"
-"--src DET_HostFs.sql:362\n";
+"--src DET_HostFs.sql:361\n";
 
-static const char *proc406 = 
+static const char *proc418 = 
+"#line 383 \"[executable]/DET_HostFs.sql\"\n"
 "create procedure\n"
 "WS.WS.HOSTFS_HANDLE_RES_SCAN (in full_path varchar, in c_id integer, in flen integer, in cr_time datetime, in mod_time datetime, in mimetype varchar, in ft_mode varchar)\n"
 "{\n"
@@ -19995,9 +20849,10 @@ static const char *proc406 =
 "}\n"
 "}\n"
 "}\n"
-"--src DET_HostFs.sql:382\n";
+"--src DET_HostFs.sql:381\n";
 
-static const char *proc407 = 
+static const char *proc419 = 
+"#line 431 \"[executable]/DET_HostFs.sql\"\n"
 "create procedure\n"
 "WS.WS.HOSTFS_RES_DISAPPEARS (in full_path varchar)\n"
 "{\n"
@@ -20017,9 +20872,10 @@ static const char *proc407 =
 "delete from WS.WS.HOSTFS_RES where RES_ID = r_id;\n"
 "update WS.WS.HOSTFS_COL set COL_MOD_TIME = now() where COL_ID = c_id and COL_MOD_TIME < now();\n"
 "}\n"
-"--src DET_HostFs.sql:430\n";
+"--src DET_HostFs.sql:429\n";
 
-static const char *proc408 = 
+static const char *proc420 = 
+"#line 452 \"[executable]/DET_HostFs.sql\"\n"
 "create function\n"
 "WS.WS.HOSTFS_TOUCH_RES (in ospath varchar) returns integer\n"
 "{\n"
@@ -20037,9 +20893,10 @@ static const char *proc408 =
 "WS.WS.HOSTFS_HANDLE_RES_SCAN (ospath, null, flen, cr_time, mod_time, mimetype, ft_mode);\n"
 "return 0;\n"
 "}\n"
-"--src DET_HostFs.sql:451\n";
+"--src DET_HostFs.sql:450\n";
 
-static const char *proc409 = 
+static const char *proc421 = 
+"#line 471 \"[executable]/DET_HostFs.sql\"\n"
 "create procedure\n"
 "WS.WS.HOSTFS_GLOBAL_RESET ()\n"
 "{\n"
@@ -20051,9 +20908,10 @@ static const char *proc409 =
 "sequence_set (\'WS.WS.HOSTFS_COL_ID\', 0, 0);\n"
 "sequence_set (\'WS.WS.HOSTFS_RES_ID\', 0, 0);\n"
 "}\n"
-"--src DET_HostFs.sql:470\n";
+"--src DET_HostFs.sql:469\n";
 
-static const char *proc410 = 
+static const char *proc422 = 
+"#line 484 \"[executable]/DET_HostFs.sql\"\n"
 "create function\n"
 "WS.WS.HOSTFS_PATH_STAT (in full_path varchar, out flen integer, out cr_time datetime, out mod_time datetime) returns integer\n"
 "{\n"
@@ -20065,9 +20923,10 @@ static const char *proc410 =
 "flen := cast (file_stat (full_path, 1) as integer);\n"
 "return 0;\n"
 "}\n"
-"--src DET_HostFs.sql:483\n";
+"--src DET_HostFs.sql:482\n";
 
-static const char *proc411 = 
+static const char *proc423 = 
+"#line 497 \"[executable]/DET_HostFs.sql\"\n"
 "create procedure\n"
 "WS.WS.HOSTFS_READ_TYPEINFO (in full_path varchar, out mimetype varchar, out ft_mode varchar)\n"
 "{\n"
@@ -20087,9 +20946,10 @@ static const char *proc411 =
 "else\n"
 "ft_mode := \'N\';\n"
 "}\n"
-"--src DET_HostFs.sql:496\n";
+"--src DET_HostFs.sql:495\n";
 
-static const char *proc412 = 
+static const char *proc424 = 
+"#line 519 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_AUTHENTICATE\" (in id any, in what char(1), in req varchar, in auth_uname varchar, in auth_pwd varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
@@ -20109,9 +20969,10 @@ static const char *proc412 =
 "return auth_uid;\n"
 "return -13;\n"
 "}\n"
-"--src DET_HostFs.sql:518\n";
+"--src DET_HostFs.sql:517\n";
 
-static const char *proc413 = 
+static const char *proc425 = 
+"#line 540 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_AUTHENTICATE_HTTP\" (in id any, in what char(1), in req varchar, in can_write_http integer, inout a_lines any, inout a_uname varchar, inout a_pwd varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer\n"
 "{\n"
 "declare rc integer;\n"
@@ -20155,17 +21016,19 @@ static const char *proc413 =
 "nf_col_or_res:\n"
 "return -1;\n"
 "}\n"
-"--src DET_HostFs.sql:539\n";
+"--src DET_HostFs.sql:538\n";
 
-static const char *proc414 = 
+static const char *proc426 = 
+"#line 585 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_GET_PARENT\" (in id any, in st char(1), in path varchar) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_HostFs.sql:584\n";
+"--src DET_HostFs.sql:583\n";
 
-static const char *proc415 = 
+static const char *proc427 = 
+"#line 592 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_COL_CREATE\" (in detcol_id any, in path_parts any, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare ospath varchar;\n"
@@ -20176,25 +21039,28 @@ static const char *proc415 =
 "WS.WS.HOSTFS_FIND_COL (ospath);\n"
 "return vector (UNAME\'HostFs\', detcol_id, ospath);\n"
 "}\n"
-"--src DET_HostFs.sql:591\n";
+"--src DET_HostFs.sql:590\n";
 
-static const char *proc416 = 
+static const char *proc428 = 
+"#line 604 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_COL_MOUNT\" (in detcol_id any, in path_parts any, in full_mount_path varchar, in mount_det varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_HostFs.sql:603\n";
+"--src DET_HostFs.sql:602\n";
 
-static const char *proc417 = 
+static const char *proc429 = 
+"#line 611 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_COL_MOUNT_HERE\" (in parent_id any, in full_mount_path varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_HostFs.sql:610\n";
+"--src DET_HostFs.sql:609\n";
 
-static const char *proc418 = 
+static const char *proc430 = 
+"#line 618 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_DELETE\" (in detcol_id any, in path_parts any, in what char(1), in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "declare ospath varchar;\n"
@@ -20204,12 +21070,13 @@ static const char *proc418 =
 "system (sprintf (\'rm -rf \'\'%s\'\'\', ospath));\n"
 "return 1;\n"
 "}\n"
-"--src DET_HostFs.sql:617\n";
+"--src DET_HostFs.sql:616\n";
 
 static const char *tbl6 = 
 "create table \"HostFs_DAV_RES_UPLOAD\" (ID varchar primary key, DT datetime, CNT long varchar)\n";
 
-static const char *proc419 = 
+static const char *proc431 = 
+"#line 632 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_RES_UPLOAD\" (in detcol_id any, in path_parts any, inout content any, in type varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare ospath varchar;\n"
@@ -20231,17 +21098,19 @@ static const char *proc419 =
 "return -28;\n"
 "return vector (UNAME\'HostFs\', detcol_id, ospath);\n"
 "}\n"
-"--src DET_HostFs.sql:631\n";
+"--src DET_HostFs.sql:630\n";
 
-static const char *proc420 = 
+static const char *proc432 = 
+"#line 655 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_PROP_REMOVE\" (in id any, in what char(0), in propname varchar, in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_HostFs.sql:654\n";
+"--src DET_HostFs.sql:653\n";
 
-static const char *proc421 = 
+static const char *proc433 = 
+"#line 662 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_PROP_SET\" (in id any, in what char(0), in propname varchar, in propvalue any, in overwrite integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
@@ -20251,9 +21120,10 @@ static const char *proc421 =
 "}\n"
 "return -20;\n"
 "}\n"
-"--src DET_HostFs.sql:661\n";
+"--src DET_HostFs.sql:660\n";
 
-static const char *proc422 = 
+static const char *proc434 = 
+"#line 673 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_PROP_GET\" (in id any, in what char(0), in propname varchar, in auth_uid integer)\n"
 "{\n"
 "declare ospath varchar;\n"
@@ -20267,9 +21137,10 @@ static const char *proc422 =
 "}\n"
 "return -11;\n"
 "}\n"
-"--src DET_HostFs.sql:672\n";
+"--src DET_HostFs.sql:671\n";
 
-static const char *proc423 = 
+static const char *proc435 = 
+"#line 688 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_PROP_LIST\" (in id any, in what char(0), in propmask varchar, in auth_uid integer)\n"
 "{\n"
 "declare ospath varchar;\n"
@@ -20283,9 +21154,10 @@ static const char *proc423 =
 "}\n"
 "return vector ();\n"
 "}\n"
-"--src DET_HostFs.sql:687\n";
+"--src DET_HostFs.sql:686\n";
 
-static const char *proc424 = 
+static const char *proc436 = 
+"#line 703 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_ID_TO_OSPATH\" (in col any)\n"
 "{\n"
 "declare res varchar;\n"
@@ -20294,9 +21166,10 @@ static const char *proc424 =
 "return coalesce ((select COL_NAME from WS.WS.SYS_DAV_COL where COL_ID = col), \' no such \');\n"
 "return col[2];\n"
 "}\n"
-"--src DET_HostFs.sql:702\n";
+"--src DET_HostFs.sql:701\n";
 
-static const char *proc425 = 
+static const char *proc437 = 
+"#line 713 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_DIR_SINGLE\" (in id any, in what char(0), in path any, in auth_uid integer) returns any\n"
 "{\n"
 "declare fullname, name, tmp, mimetype, ft_mode varchar;\n"
@@ -20333,9 +21206,10 @@ static const char *proc425 =
 "}\n"
 "return -20;\n"
 "}\n"
-"--src DET_HostFs.sql:712\n";
+"--src DET_HostFs.sql:711\n";
 
-static const char *proc426 = 
+static const char *proc438 = 
+"#line 751 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_DIR_LIST\" (in detcol_id any, in path_parts any, in detcol_path varchar, in name_mask varchar, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare ospath, name, fullname, top_davpath varchar;\n"
@@ -20450,17 +21324,19 @@ static const char *proc426 =
 "WS.WS.HOSTFS_COL_DISAPPEARS (ospath);\n"
 "return vector();\n"
 "}\n"
-"--src DET_HostFs.sql:750\n";
+"--src DET_HostFs.sql:749\n";
 
-static const char *proc427 = 
+static const char *proc439 = 
+"#line 868 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_DIR_FILTER\" (in detcol_id any, in path_parts any, in detcol_path varchar, in compilation varchar, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return vector ();\n"
 "}\n"
-"--src DET_HostFs.sql:867\n";
+"--src DET_HostFs.sql:866\n";
 
-static const char *proc428 = 
+static const char *proc440 = 
+"#line 876 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_SEARCH_ID\" (in detcol_id any, in path_parts any, in what char(1)) returns any\n"
 "{\n"
 "declare ospath, stat varchar;\n"
@@ -20495,9 +21371,10 @@ static const char *proc428 =
 "\n"
 "return vector (UNAME\'HostFs\', detcol_id, ospath);\n"
 "}\n"
-"--src DET_HostFs.sql:875\n";
+"--src DET_HostFs.sql:874\n";
 
-static const char *proc429 = 
+static const char *proc441 = 
+"#line 912 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_SEARCH_PATH\" (in id any, in what char(1)) returns any\n"
 "{\n"
 "declare ospath varchar;\n"
@@ -20516,9 +21393,10 @@ static const char *proc429 =
 "}\n"
 "return detcol_fullpath || subseq (ospath, slash_pos + 1);\n"
 "}\n"
-"--src DET_HostFs.sql:911\n";
+"--src DET_HostFs.sql:910\n";
 
-static const char *proc430 = 
+static const char *proc442 = 
+"#line 932 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_RES_UPLOAD_COPY\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare ospath varchar;\n"
@@ -20543,9 +21421,10 @@ static const char *proc430 =
 "}\n"
 "return -20;\n"
 "}\n"
-"--src DET_HostFs.sql:931\n";
+"--src DET_HostFs.sql:930\n";
 
-static const char *proc431 = 
+static const char *proc443 = 
+"#line 958 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_RES_UPLOAD_MOVE\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare ospath, src_path varchar;\n"
@@ -20573,9 +21452,10 @@ static const char *proc431 =
 "}\n"
 "return -20;\n"
 "}\n"
-"--src DET_HostFs.sql:957\n";
+"--src DET_HostFs.sql:956\n";
 
-static const char *proc432 = 
+static const char *proc444 = 
+"#line 987 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_RES_CONTENT\" (in id any, inout content any, out type varchar, in content_mode integer) returns integer\n"
 "{\n"
 "\n"
@@ -20595,33 +21475,37 @@ static const char *proc432 =
 "WS.WS.HOSTFS_RES_DISAPPEARS (id[2]);\n"
 "return -1;\n"
 "}\n"
-"--src DET_HostFs.sql:986\n";
+"--src DET_HostFs.sql:985\n";
 
-static const char *proc433 = 
+static const char *proc445 = 
+"#line 1008 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_SYMLINK\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_HostFs.sql:1007\n";
+"--src DET_HostFs.sql:1006\n";
 
-static const char *proc434 = 
+static const char *proc446 = 
+"#line 1015 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_LOCK\" (in path any, in id any, in type char(1), inout locktype varchar, inout scope varchar, in token varchar, inout owner_name varchar, inout owned_tokens varchar, in depth varchar, in timeout_sec integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_HostFs.sql:1014\n";
+"--src DET_HostFs.sql:1013\n";
 
-static const char *proc435 = 
+static const char *proc447 = 
+"#line 1022 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_UNLOCK\" (in id any, in type char(1), in token varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
 "return -27;\n"
 "}\n"
-"--src DET_HostFs.sql:1021\n";
+"--src DET_HostFs.sql:1020\n";
 
-static const char *proc436 = 
+static const char *proc448 = 
+"#line 1029 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_IS_LOCKED\" (inout id any, inout type char(1), in owned_tokens varchar) returns integer\n"
 "{\n"
 "declare rc integer;\n"
@@ -20639,17 +21523,19 @@ static const char *proc436 =
 "type := orig_type;\n"
 "return 0;\n"
 "}\n"
-"--src DET_HostFs.sql:1028\n";
+"--src DET_HostFs.sql:1027\n";
 
-static const char *proc437 = 
+static const char *proc449 = 
+"#line 1048 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_DAV_LIST_LOCKS\" (in id any, in type char(1), in recursive integer) returns any\n"
 "{\n"
 "\n"
 "return vector ();\n"
 "}\n"
-"--src DET_HostFs.sql:1047\n";
+"--src DET_HostFs.sql:1046\n";
 
-static const char *proc438 = 
+static const char *proc450 = 
+"#line 1055 \"[executable]/DET_HostFs.sql\"\n"
 "create procedure \"HostFs_CF_LIST_PROP_DISTVALS\" (in detcol_id integer, in cfc_id integer, in rfc_spath varchar, inout rfc_list_cond any, in schema_uri varchar, inout filter_data any, inout distval_dict any, in auth_uid integer)\n"
 "{\n"
 "declare topcol_name varchar;\n"
@@ -20876,9 +21762,10 @@ static const char *proc438 =
 "nf_c_last2:\n"
 "close c_last2;\n"
 "}\n"
-"--src DET_HostFs.sql:1054\n";
+"--src DET_HostFs.sql:1053\n";
 
-static const char *proc439 = 
+static const char *proc451 = 
+"#line 1284 \"[executable]/DET_HostFs.sql\"\n"
 "create function \"HostFs_CF_GET_RDF_HITS\" (in detcol_id integer, in cfc_id integer, in rfc_spath varchar, inout rfc_list_cond any, in schema_uri varchar, inout filter_data any, in detcol_path varchar, in make_diritems integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare topcol_name varchar;\n"
@@ -21094,9 +21981,10 @@ static const char *proc439 =
 "\n"
 "return acc;\n"
 "}\n"
-"--src DET_HostFs.sql:1283\n";
+"--src DET_HostFs.sql:1282\n";
 
-static const char *proc440 = 
+static const char *proc452 = 
+"#line 1502 \"[executable]/DET_HostFs.sql\"\n"
 "create procedure \"HostFs_RF_ID2SUFFIX\" (in id any, in what char(1))\n"
 "{\n"
 "if (what=\'C\')\n"
@@ -21129,9 +22017,10 @@ static const char *proc440 =
 "}\n"
 "signal (\'OBLOM\', \'Invalid arguments for HostFs_RF_ID2SUFFIX\');\n"
 "}\n"
-"--src DET_HostFs.sql:1501\n";
+"--src DET_HostFs.sql:1500\n";
 
-static const char *proc441 = 
+static const char *proc453 = 
+"#line 1536 \"[executable]/DET_HostFs.sql\"\n"
 "create procedure \"HostFile_RF_SUFFIX2ID\" (in suffix varchar, in what char(1))\n"
 "{\n"
 "declare pairs any;\n"
@@ -21154,9 +22043,10 @@ static const char *proc441 =
 "oblom:\n"
 "return null;\n"
 "}\n"
-"--src DET_HostFs.sql:1535\n";
+"--src DET_HostFs.sql:1534\n";
 
-static const char *proc442 = 
+static const char *proc454 = 
+"#line 1560 \"[executable]/DET_HostFs.sql\"\n"
 "create procedure \"HostDir_RF_SUFFIX2ID\" (in suffix varchar, in what char(1))\n"
 "{\n"
 "declare pairs any;\n"
@@ -21178,11 +22068,12 @@ static const char *proc442 =
 "oblom:\n"
 "return NULL;\n"
 "}\n"
-"--src DET_HostFs.sql:1559\n";
+"--src DET_HostFs.sql:1558\n";
 
 /* DET_ResFilter.sql */
 
-static const char *proc443 = 
+static const char *proc455 = 
+"#line 26 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_AUTHENTICATE\" (in id any, in what char(1), in req varchar, in auth_uname varchar, in auth_pwd varchar, in auth_uid integer)\n"
 "{\n"
 "declare rfc_spath varchar;\n"
@@ -21205,9 +22096,10 @@ static const char *proc443 =
 "}\n"
 "return -14;\n"
 "}\n"
-"--src DET_ResFilter.sql:25\n";
+"--src DET_ResFilter.sql:24\n";
 
-static const char *proc444 = 
+static const char *proc456 = 
+"#line 51 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_NORM\" (in value any) returns varchar\n"
 "{\n"
 "value := blob_to_string (value);\n"
@@ -21218,9 +22110,10 @@ static const char *proc444 =
 "return value;\n"
 "return cast (xml_tree_doc(value) as varchar);\n"
 "}\n"
-"--src DET_ResFilter.sql:50\n";
+"--src DET_ResFilter.sql:49\n";
 
-static const char *proc445 = 
+static const char *proc457 = 
+"#line 64 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_ENCODE_FILTER\" (in filt any) returns varchar\n"
 "{\n"
 "if (193 <> __tag (filt))\n"
@@ -21229,9 +22122,10 @@ static const char *proc445 =
 "filt[0] := 2;\n"
 "return filt;\n"
 "}\n"
-"--src DET_ResFilter.sql:63\n";
+"--src DET_ResFilter.sql:62\n";
 
-static const char *proc446 = 
+static const char *proc458 = 
+"#line 75 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DECODE_FILTER\" (in value any) returns any\n"
 "{\n"
 "value := blob_to_string (value);\n"
@@ -21240,9 +22134,10 @@ static const char *proc446 =
 "value [0] := 193;\n"
 "return deserialize (value);\n"
 "}\n"
-"--src DET_ResFilter.sql:74\n";
+"--src DET_ResFilter.sql:73\n";
 
-static const char *proc447 = 
+static const char *proc459 = 
+"#line 86 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_GET_CONDITION\" (in detcol_id integer, out rfc_spath varchar, out rfc_list_cond any, out rfc_del_action any)\n"
 "{\n"
 "\n"
@@ -21256,9 +22151,10 @@ static const char *proc447 =
 "nf:\n"
 "return -1;\n"
 "}\n"
-"--src DET_ResFilter.sql:85\n";
+"--src DET_ResFilter.sql:84\n";
 
-static const char *proc448 = 
+static const char *proc460 = 
+"#line 102 \"[executable]/DET_ResFilter.sql\"\n"
 "create procedure \"ResFilter_FIT_INTO_CONDITION\" (in id any, in what char (1), inout rfc_list_cond any, in auth_uid integer)\n"
 "{\n"
 "\n"
@@ -21410,9 +22306,10 @@ static const char *proc448 =
 "update WS.WS.SYS_DAV_PROP set PROP_VALUE = serialize (new_davxml) where PROP_ID = propid;\n"
 "}\n"
 "}\n"
-"--src DET_ResFilter.sql:101\n";
+"--src DET_ResFilter.sql:100\n";
 
-static const char *proc449 = 
+static const char *proc461 = 
+"#line 256 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_MAKE_DEL_ACTION_FROM_CONDITION\" (inout rfc_list_cond any) returns any\n"
 "{\n"
 "\n"
@@ -21445,17 +22342,19 @@ static const char *proc449 =
 "}\n"
 "return vector (\'\', res);\n"
 "}\n"
-"--src DET_ResFilter.sql:255\n";
+"--src DET_ResFilter.sql:254\n";
 
-static const char *proc450 = 
+static const char *proc462 = 
+"#line 291 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_LEAVE_CONDITION\" (in id integer, in what char (1), in rfc_del_action any, in auth_uid integer) returns integer\n"
 "{\n"
 "\"ResFilter_FIT_INTO_CONDITION\" (id, what, rfc_del_action, auth_uid);\n"
 "return 0;\n"
 "}\n"
-"--src DET_ResFilter.sql:290\n";
+"--src DET_ResFilter.sql:289\n";
 
-static const char *proc451 = 
+static const char *proc463 = 
+"#line 299 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_FNMERGE\" (in path any, in id any) returns varchar\n"
 "{\n"
 "declare pairs any;\n"
@@ -21473,9 +22372,10 @@ static const char *proc451 =
 "\n"
 "return res;\n"
 "}\n"
-"--src DET_ResFilter.sql:298\n";
+"--src DET_ResFilter.sql:297\n";
 
-static const char *proc452 = 
+static const char *proc464 = 
+"#line 319 \"[executable]/DET_ResFilter.sql\"\n"
 "create procedure \"ResFilter_FNSPLIT\" (in path any, out colpath varchar, out orig_fnameext varchar, out id any)\n"
 "{\n"
 "declare pairs any;\n"
@@ -21510,9 +22410,10 @@ static const char *proc452 =
 "id := null;\n"
 "\n"
 "}\n"
-"--src DET_ResFilter.sql:318\n";
+"--src DET_ResFilter.sql:317\n";
 
-static const char *proc453 = 
+static const char *proc465 = 
+"#line 356 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_SEARCH_ID_IMPL\" (in detcol_id any, in path_parts any, in what char(1), inout rfc_spath varchar, inout rfc_list_cond any, inout rfc_del_action any) returns any\n"
 "{\n"
 "declare colpath, orig_fnameext varchar;\n"
@@ -21556,9 +22457,10 @@ static const char *proc453 =
 "return -1;\n"
 "return hitlist[0][4];\n"
 "}\n"
-"--src DET_ResFilter.sql:355\n";
+"--src DET_ResFilter.sql:354\n";
 
-static const char *proc454 = 
+static const char *proc466 = 
+"#line 402 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_AUTHENTICATE_HTTP\" (in id any, in what char(1), in req varchar, in can_write_http integer, inout a_lines any, inout a_uname varchar, inout a_pwd varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer\n"
 "{\n"
 "declare rc integer;\n"
@@ -21609,9 +22511,10 @@ static const char *proc454 =
 "nf_col_or_res:\n"
 "return -1;\n"
 "}\n"
-"--src DET_ResFilter.sql:401\n";
+"--src DET_ResFilter.sql:400\n";
 
-static const char *proc455 = 
+static const char *proc467 = 
+"#line 455 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_GET_PARENT\" (in id any, in st char(1), in path varchar) returns any\n"
 "{\n"
 "\n"
@@ -21619,33 +22522,37 @@ static const char *proc455 =
 "return id [1];\n"
 "return -20;\n"
 "}\n"
-"--src DET_ResFilter.sql:454\n";
+"--src DET_ResFilter.sql:453\n";
 
-static const char *proc456 = 
+static const char *proc468 = 
+"#line 465 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_COL_CREATE\" (in detcol_id any, in path_parts any, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_ResFilter.sql:464\n";
+"--src DET_ResFilter.sql:463\n";
 
-static const char *proc457 = 
+static const char *proc469 = 
+"#line 473 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_COL_MOUNT\" (in detcol_id any, in path_parts any, in full_mount_path varchar, in mount_det varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_ResFilter.sql:472\n";
+"--src DET_ResFilter.sql:471\n";
 
-static const char *proc458 = 
+static const char *proc470 = 
+"#line 481 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_COL_MOUNT_HERE\" (in parent_id any, in full_mount_path varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_ResFilter.sql:480\n";
+"--src DET_ResFilter.sql:479\n";
 
-static const char *proc459 = 
+static const char *proc471 = 
+"#line 489 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_DELETE\" (in detcol_id any, in path_parts any, in what char(1), in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "declare rc, orig_id integer;\n"
@@ -21660,17 +22567,19 @@ static const char *proc459 =
 "return -20;\n"
 "return \"ResFilter_LEAVE_CONDITION\" (orig_id, what, rfc_del_action, auth_uid);\n"
 "}\n"
-"--src DET_ResFilter.sql:488\n";
+"--src DET_ResFilter.sql:487\n";
 
-static const char *proc460 = 
+static const char *proc472 = 
+"#line 505 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_RES_UPLOAD\" (in detcol_id any, in path_parts any, inout content any, in type varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_ResFilter.sql:504\n";
+"--src DET_ResFilter.sql:503\n";
 
-static const char *proc461 = 
+static const char *proc473 = 
+"#line 513 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_PROP_REMOVE\" (in id any, in st char(0), in propname varchar, in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "\n"
@@ -21681,9 +22590,10 @@ static const char *proc461 =
 "return call (cast (id[0] as varchar) || \'_DAV_PROP_REMOVE\') (id, st, propname, silent, auth_uid);\n"
 "return DAV_PROP_REMOVE_RAW (id, st, propname, silent, auth_uid);\n"
 "}\n"
-"--src DET_ResFilter.sql:512\n";
+"--src DET_ResFilter.sql:511\n";
 
-static const char *proc462 = 
+static const char *proc474 = 
+"#line 526 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_PROP_SET\" (in id any, in st char(0), in propname varchar, in propvalue any, in overwrite integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare pid integer;\n"
@@ -21696,9 +22606,10 @@ static const char *proc462 =
 "return call (cast (id[0] as varchar) || \'_DAV_PROP_SET\') (id, st, propname, propvalue, overwrite, auth_uid);\n"
 "return DAV_PROP_SET_RAW (id, st, propname, propvalue, overwrite, auth_uid);\n"
 "}\n"
-"--src DET_ResFilter.sql:525\n";
+"--src DET_ResFilter.sql:524\n";
 
-static const char *proc463 = 
+static const char *proc475 = 
+"#line 541 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_PROP_GET\" (in id any, in what char(0), in propname varchar, in auth_uid integer)\n"
 "{\n"
 "declare ret varchar;\n"
@@ -21715,9 +22626,10 @@ static const char *proc463 =
 "no_prop:\n"
 "return -11;\n"
 "}\n"
-"--src DET_ResFilter.sql:540\n";
+"--src DET_ResFilter.sql:539\n";
 
-static const char *proc464 = 
+static const char *proc476 = 
+"#line 560 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_PROP_LIST\" (in id any, in what char(0), in propmask varchar, in auth_uid integer)\n"
 "{\n"
 "declare ret any;\n"
@@ -21730,9 +22642,10 @@ static const char *proc464 =
 "vectorbld_final (ret);\n"
 "return ret;\n"
 "}\n"
-"--src DET_ResFilter.sql:559\n";
+"--src DET_ResFilter.sql:558\n";
 
-static const char *proc465 = 
+static const char *proc477 = 
+"#line 575 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_DIR_SINGLE\" (in id any, in what char(0), in path any, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
@@ -21781,9 +22694,10 @@ static const char *proc465 =
 "}\n"
 "return -1;\n"
 "}\n"
-"--src DET_ResFilter.sql:574\n";
+"--src DET_ResFilter.sql:573\n";
 
-static const char *proc466 = 
+static const char *proc478 = 
+"#line 626 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_DIR_LIST\" (in detcol_id any, in path_parts any, in detcol_path varchar, in name_mask varchar, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare rfc_spath varchar;\n"
@@ -21840,9 +22754,10 @@ static const char *proc466 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src DET_ResFilter.sql:625\n";
+"--src DET_ResFilter.sql:624\n";
 
-static const char *proc467 = 
+static const char *proc479 = 
+"#line 685 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_DIR_FILTER\" (in detcol_id any, in path_parts any, in detcol_path varchar, inout compilation any, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare rfc_spath varchar;\n"
@@ -21899,9 +22814,10 @@ static const char *proc467 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src DET_ResFilter.sql:684\n";
+"--src DET_ResFilter.sql:683\n";
 
-static const char *proc468 = 
+static const char *proc480 = 
+"#line 744 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_SEARCH_ID\" (in detcol_id any, in path_parts any, in what char(1)) returns any\n"
 "{\n"
 "declare rfc_spath varchar;\n"
@@ -21914,17 +22830,19 @@ static const char *proc468 =
 "return orig_id;\n"
 "return vector (UNAME\'ResFilter\', detcol_id, orig_id);\n"
 "}\n"
-"--src DET_ResFilter.sql:743\n";
+"--src DET_ResFilter.sql:742\n";
 
-static const char *proc469 = 
+static const char *proc481 = 
+"#line 759 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_SEARCH_PATH\" (in id any, in what char(1)) returns any\n"
 "{\n"
 "\n"
 "return coalesce ((select RES_FULL_PATH from WS.WS.SYS_DAV_RES where RES_ID = id[2]), null);\n"
 "}\n"
-"--src DET_ResFilter.sql:758\n";
+"--src DET_ResFilter.sql:757\n";
 
-static const char *proc470 = 
+static const char *proc482 = 
+"#line 767 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_RES_UPLOAD_COPY\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare rfc_spath varchar;\n"
@@ -21967,9 +22885,10 @@ static const char *proc470 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src DET_ResFilter.sql:766\n";
+"--src DET_ResFilter.sql:765\n";
 
-static const char *proc471 = 
+static const char *proc483 = 
+"#line 812 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_RES_UPLOAD_MOVE\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare rfc_spath varchar;\n"
@@ -22009,9 +22928,10 @@ static const char *proc471 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src DET_ResFilter.sql:811\n";
+"--src DET_ResFilter.sql:810\n";
 
-static const char *proc472 = 
+static const char *proc484 = 
+"#line 854 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_RES_CONTENT\" (in id any, inout content any, out type varchar, in content_mode integer) returns integer\n"
 "{\n"
 "\n"
@@ -22024,17 +22944,19 @@ static const char *proc472 =
 "select http (RES_CONTENT), RES_TYPE into cont, type from WS.WS.SYS_DAV_RES where RES_ID = id[2];\n"
 "return id[2];\n"
 "}\n"
-"--src DET_ResFilter.sql:853\n";
+"--src DET_ResFilter.sql:852\n";
 
-static const char *proc473 = 
+static const char *proc485 = 
+"#line 869 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_SYMLINK\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_ResFilter.sql:868\n";
+"--src DET_ResFilter.sql:867\n";
 
-static const char *proc474 = 
+static const char *proc486 = 
+"#line 877 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_LOCK\" (in path any, in id any, in type char(1), inout locktype varchar, inout scope varchar, in token varchar, inout owner_name varchar, inout owned_tokens varchar, in depth varchar, in timeout_sec integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare rc, u_token, new_token varchar;\n"
@@ -22047,9 +22969,10 @@ static const char *proc474 =
 "return DAV_LOCK_INT (path, id[2], type, locktype, scope, token, owner_name, owned_tokens, depth, timeout_sec, null, null, auth_uid);\n"
 "return -20;\n"
 "}\n"
-"--src DET_ResFilter.sql:876\n";
+"--src DET_ResFilter.sql:875\n";
 
-static const char *proc475 = 
+static const char *proc487 = 
+"#line 892 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_UNLOCK\" (in id any, in type char(1), in token varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
@@ -22057,9 +22980,10 @@ static const char *proc475 =
 "id := id [2];\n"
 "return DAV_UNLOCK_INT (id, type, token, null, null, auth_uid);\n"
 "}\n"
-"--src DET_ResFilter.sql:891\n";
+"--src DET_ResFilter.sql:890\n";
 
-static const char *proc476 = 
+static const char *proc488 = 
+"#line 902 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_IS_LOCKED\" (inout id any, inout type char(1), in owned_tokens varchar) returns integer\n"
 "{\n"
 "declare rc integer;\n"
@@ -22081,9 +23005,10 @@ static const char *proc476 =
 "type := orig_type;\n"
 "return 0;\n"
 "}\n"
-"--src DET_ResFilter.sql:901\n";
+"--src DET_ResFilter.sql:900\n";
 
-static const char *proc477 = 
+static const char *proc489 = 
+"#line 926 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_DAV_LIST_LOCKS\" (in id any, in type char(1), in recursive integer) returns any\n"
 "{\n"
 "declare res any;\n"
@@ -22098,9 +23023,10 @@ static const char *proc477 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src DET_ResFilter.sql:925\n";
+"--src DET_ResFilter.sql:924\n";
 
-static const char *proc478 = 
+static const char *proc490 = 
+"#line 943 \"[executable]/DET_ResFilter.sql\"\n"
 "create function \"ResFilter_CONFIGURE\" (in col any, in search_path varchar, in filter any) returns integer\n"
 "{\n"
 "declare rc integer;\n"
@@ -22136,11 +23062,12 @@ static const char *proc478 =
 "update WS.WS.SYS_DAV_COL set COL_DET=\'ResFilter\' where COL_ID=col;\n"
 "return 0;\n"
 "}\n"
-"--src DET_ResFilter.sql:942\n";
+"--src DET_ResFilter.sql:941\n";
 
 /* DET_PropFilter.sql */
 
-static const char *proc479 = 
+static const char *proc491 = 
+"#line 26 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_AUTHENTICATE\" (in id any, in what char(1), in req varchar, in auth_uname varchar, in auth_pwd varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
@@ -22148,9 +23075,10 @@ static const char *proc479 =
 "return auth_uid;\n"
 "return -12;\n"
 "}\n"
-"--src DET_PropFilter.sql:25\n";
+"--src DET_PropFilter.sql:24\n";
 
-static const char *proc480 = 
+static const char *proc492 = 
+"#line 36 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_NORM\" (in value any) returns varchar\n"
 "{\n"
 "value := blob_to_string (value);\n"
@@ -22161,9 +23089,10 @@ static const char *proc480 =
 "return value;\n"
 "return cast (xml_tree_doc(value) as varchar);\n"
 "}\n"
-"--src DET_PropFilter.sql:35\n";
+"--src DET_PropFilter.sql:34\n";
 
-static const char *proc481 = 
+static const char *proc493 = 
+"#line 49 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_GET_CONDITION\" (in detcol_id integer, out pfc_spath varchar, out pfc_name varchar, out pfc_value varchar)\n"
 "{\n"
 "\n"
@@ -22177,9 +23106,10 @@ static const char *proc481 =
 "nf:\n"
 "return -1;\n"
 "}\n"
-"--src DET_PropFilter.sql:48\n";
+"--src DET_PropFilter.sql:47\n";
 
-static const char *proc482 = 
+static const char *proc494 = 
+"#line 65 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_FIT_INTO_CONDITION\" (in id integer, in what char (1), in pfc_name varchar, in pfc_value varchar)\n"
 "{\n"
 "declare old_value varchar;\n"
@@ -22200,17 +23130,19 @@ static const char *proc482 =
 "values (propid, pfc_name, pfc_value, id, what);\n"
 "return propid;\n"
 "}\n"
-"--src DET_PropFilter.sql:64\n";
+"--src DET_PropFilter.sql:63\n";
 
-static const char *proc483 = 
+static const char *proc495 = 
+"#line 88 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_LEAVE_CONDITION\" (in id integer, in what char (1), in pfc_name varchar, in pfc_value varchar) returns integer\n"
 "{\n"
 "delete from WS.WS.SYS_DAV_PROP where PROP_NAME = pfc_name and PROP_PARENT_ID = id and PROP_TYPE = what and \"PropFilter_NORM\" (PROP_VALUE) = pfc_value;\n"
 "return 0;\n"
 "}\n"
-"--src DET_PropFilter.sql:87\n";
+"--src DET_PropFilter.sql:86\n";
 
-static const char *proc484 = 
+static const char *proc496 = 
+"#line 96 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_FNMERGE\" (in path any, in id integer) returns varchar\n"
 "{\n"
 "declare pairs any;\n"
@@ -22219,9 +23151,10 @@ static const char *proc484 =
 "signal (\'.....\', sprintf (\'Internal error: failed \"PropFilter_FNMERGE\" (%s, %d)\', path, id));\n"
 "return sprintf (\'%s-PfId%d%s\', subseq (path, 0, pairs[5]), id, subseq (path, pairs[6]));\n"
 "}\n"
-"--src DET_PropFilter.sql:95\n";
+"--src DET_PropFilter.sql:94\n";
 
-static const char *proc485 = 
+static const char *proc497 = 
+"#line 107 \"[executable]/DET_PropFilter.sql\"\n"
 "create procedure \"PropFilter_FNSPLIT\" (in path any, out colpath varchar, out orig_fnameext varchar, out id integer)\n"
 "{\n"
 "declare pairs any;\n"
@@ -22245,9 +23178,10 @@ static const char *proc485 =
 "id := cast (subseq (fname, pairs[4], pairs[5]) as integer);\n"
 "}\n"
 "}\n"
-"--src DET_PropFilter.sql:106\n";
+"--src DET_PropFilter.sql:105\n";
 
-static const char *proc486 = 
+static const char *proc498 = 
+"#line 133 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_SEARCH_ID_IMPL\" (in detcol_id any, in path_parts any, in what char(1), inout pfc_spath varchar, inout pfc_name varchar, inout pfc_value varchar) returns any\n"
 "{\n"
 "declare colpath, orig_fnameext varchar;\n"
@@ -22299,9 +23233,10 @@ static const char *proc486 =
 "return -1;\n"
 "return hitlist[0];\n"
 "}\n"
-"--src DET_PropFilter.sql:132\n";
+"--src DET_PropFilter.sql:131\n";
 
-static const char *proc487 = 
+static const char *proc499 = 
+"#line 187 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_AUTHENTICATE_HTTP\" (in id any, in what char(1), in req varchar, in can_write_http integer, inout a_lines any, inout a_uname varchar, inout a_pwd varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer\n"
 "{\n"
 "declare rc integer;\n"
@@ -22352,9 +23287,10 @@ static const char *proc487 =
 "nf_col_or_res:\n"
 "return -1;\n"
 "}\n"
-"--src DET_PropFilter.sql:186\n";
+"--src DET_PropFilter.sql:185\n";
 
-static const char *proc488 = 
+static const char *proc500 = 
+"#line 240 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_GET_PARENT\" (in id any, in st char(1), in path varchar) returns any\n"
 "{\n"
 "\n"
@@ -22362,33 +23298,37 @@ static const char *proc488 =
 "return id [1];\n"
 "return -20;\n"
 "}\n"
-"--src DET_PropFilter.sql:239\n";
+"--src DET_PropFilter.sql:238\n";
 
-static const char *proc489 = 
+static const char *proc501 = 
+"#line 250 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_COL_CREATE\" (in detcol_id any, in path_parts any, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_PropFilter.sql:249\n";
+"--src DET_PropFilter.sql:248\n";
 
-static const char *proc490 = 
+static const char *proc502 = 
+"#line 258 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_COL_MOUNT\" (in detcol_id any, in path_parts any, in full_mount_path varchar, in mount_det varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_PropFilter.sql:257\n";
+"--src DET_PropFilter.sql:256\n";
 
-static const char *proc491 = 
+static const char *proc503 = 
+"#line 266 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_COL_MOUNT_HERE\" (in parent_id any, in full_mount_path varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_PropFilter.sql:265\n";
+"--src DET_PropFilter.sql:264\n";
 
-static const char *proc492 = 
+static const char *proc504 = 
+"#line 274 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_DELETE\" (in detcol_id any, in path_parts any, in what char(1), in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "declare rc, orig_id integer;\n"
@@ -22400,17 +23340,19 @@ static const char *proc492 =
 "return orig_id;\n"
 "return \"PropFilter_LEAVE_CONDITION\" (orig_id, what, pfc_name, pfc_value);\n"
 "}\n"
-"--src DET_PropFilter.sql:273\n";
+"--src DET_PropFilter.sql:272\n";
 
-static const char *proc493 = 
+static const char *proc505 = 
+"#line 288 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_RES_UPLOAD\" (in detcol_id any, in path_parts any, inout content any, in type varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_PropFilter.sql:287\n";
+"--src DET_PropFilter.sql:286\n";
 
-static const char *proc494 = 
+static const char *proc506 = 
+"#line 296 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_PROP_REMOVE\" (in id any, in st char(0), in propname varchar, in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "\n"
@@ -22421,9 +23363,10 @@ static const char *proc494 =
 "return call (cast (id[0] as varchar) || \'_DAV_PROP_REMOVE\') (id, st, propname, silent, auth_uid);\n"
 "return DAV_PROP_REMOVE_RAW (id, st, propname, silent, auth_uid);\n"
 "}\n"
-"--src DET_PropFilter.sql:295\n";
+"--src DET_PropFilter.sql:294\n";
 
-static const char *proc495 = 
+static const char *proc507 = 
+"#line 309 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_PROP_SET\" (in id any, in st char(0), in propname varchar, in propvalue any, in overwrite integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare pid integer;\n"
@@ -22436,9 +23379,10 @@ static const char *proc495 =
 "return call (cast (id[0] as varchar) || \'_DAV_PROP_SET\') (id, st, propname, propvalue, overwrite, auth_uid);\n"
 "return DAV_PROP_SET_RAW (id, st, propname, propvalue, overwrite, auth_uid);\n"
 "}\n"
-"--src DET_PropFilter.sql:308\n";
+"--src DET_PropFilter.sql:307\n";
 
-static const char *proc496 = 
+static const char *proc508 = 
+"#line 324 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_PROP_GET\" (in id any, in what char(0), in propname varchar, in auth_uid integer)\n"
 "{\n"
 "declare ret varchar;\n"
@@ -22455,9 +23399,10 @@ static const char *proc496 =
 "no_prop:\n"
 "return -11;\n"
 "}\n"
-"--src DET_PropFilter.sql:323\n";
+"--src DET_PropFilter.sql:322\n";
 
-static const char *proc497 = 
+static const char *proc509 = 
+"#line 343 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_PROP_LIST\" (in id any, in what char(0), in propmask varchar, in auth_uid integer)\n"
 "{\n"
 "declare ret any;\n"
@@ -22469,9 +23414,10 @@ static const char *proc497 =
 "}\n"
 "return ret;\n"
 "}\n"
-"--src DET_PropFilter.sql:342\n";
+"--src DET_PropFilter.sql:341\n";
 
-static const char *proc498 = 
+static const char *proc510 = 
+"#line 357 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_DIR_SINGLE\" (in id any, in what char(0), in path any, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
@@ -22516,9 +23462,10 @@ static const char *proc498 =
 "}\n"
 "return -1;\n"
 "}\n"
-"--src DET_PropFilter.sql:356\n";
+"--src DET_PropFilter.sql:355\n";
 
-static const char *proc499 = 
+static const char *proc511 = 
+"#line 404 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_DIR_LIST\" (in detcol_id any, in path_parts any, in detcol_path varchar, in name_mask varchar, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare pfc_spath, pfc_name, pfc_value varchar;\n"
@@ -22586,9 +23533,10 @@ static const char *proc499 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src DET_PropFilter.sql:403\n";
+"--src DET_PropFilter.sql:402\n";
 
-static const char *proc500 = 
+static const char *proc512 = 
+"#line 474 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_DIR_FILTER\" (in detcol_id any, in path_parts any, in detcol_path varchar, inout compilation any, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare pfc_spath, pfc_name, pfc_value varchar;\n"
@@ -22668,9 +23616,10 @@ static const char *proc500 =
 "\n"
 "return execrows;\n"
 "}\n"
-"--src DET_PropFilter.sql:473\n";
+"--src DET_PropFilter.sql:472\n";
 
-static const char *proc501 = 
+static const char *proc513 = 
+"#line 556 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_SEARCH_ID\" (in detcol_id any, in path_parts any, in what char(1)) returns any\n"
 "{\n"
 "declare pfc_spath, pfc_name, pfc_value varchar;\n"
@@ -22682,17 +23631,19 @@ static const char *proc501 =
 "return orig_id;\n"
 "return vector (UNAME\'PropFilter\', detcol_id, orig_id);\n"
 "}\n"
-"--src DET_PropFilter.sql:555\n";
+"--src DET_PropFilter.sql:554\n";
 
-static const char *proc502 = 
+static const char *proc514 = 
+"#line 570 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_SEARCH_PATH\" (in id any, in what char(1)) returns any\n"
 "{\n"
 "\n"
 "return coalesce ((select RES_FULL_PATH from WS.WS.SYS_DAV_RES where RES_ID = id[2]), null);\n"
 "}\n"
-"--src DET_PropFilter.sql:569\n";
+"--src DET_PropFilter.sql:568\n";
 
-static const char *proc503 = 
+static const char *proc515 = 
+"#line 578 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_RES_UPLOAD_COPY\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare pfc_spath, pfc_name, pfc_value varchar;\n"
@@ -22732,9 +23683,10 @@ static const char *proc503 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src DET_PropFilter.sql:577\n";
+"--src DET_PropFilter.sql:576\n";
 
-static const char *proc504 = 
+static const char *proc516 = 
+"#line 620 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_RES_UPLOAD_MOVE\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare pfc_spath, pfc_name, pfc_value varchar;\n"
@@ -22771,9 +23723,10 @@ static const char *proc504 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src DET_PropFilter.sql:619\n";
+"--src DET_PropFilter.sql:618\n";
 
-static const char *proc505 = 
+static const char *proc517 = 
+"#line 659 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_RES_CONTENT\" (in id any, inout content any, out type varchar, in content_mode integer) returns integer\n"
 "{\n"
 "\n"
@@ -22786,17 +23739,19 @@ static const char *proc505 =
 "select http (RES_CONTENT), RES_TYPE into cont, type from WS.WS.SYS_DAV_RES where RES_ID = id[2];\n"
 "return id[2];\n"
 "}\n"
-"--src DET_PropFilter.sql:658\n";
+"--src DET_PropFilter.sql:657\n";
 
-static const char *proc506 = 
+static const char *proc518 = 
+"#line 674 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_SYMLINK\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_PropFilter.sql:673\n";
+"--src DET_PropFilter.sql:672\n";
 
-static const char *proc507 = 
+static const char *proc519 = 
+"#line 682 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_LOCK\" (in path any, inout id any, in type char(1), inout locktype varchar, inout scope varchar, in token varchar, inout owner_name varchar, inout owned_tokens varchar, in depth varchar, in timeout_sec integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare rc, u_token, new_token varchar;\n"
@@ -22809,9 +23764,10 @@ static const char *proc507 =
 "return DAV_LOCK_INT (path, id[2], type, locktype, scope, token, owner_name, owned_tokens, depth, timeout_sec, null, null, auth_uid);\n"
 "return -20;\n"
 "}\n"
-"--src DET_PropFilter.sql:681\n";
+"--src DET_PropFilter.sql:680\n";
 
-static const char *proc508 = 
+static const char *proc520 = 
+"#line 697 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_UNLOCK\" (in id any, in type char(1), in token varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
@@ -22819,9 +23775,10 @@ static const char *proc508 =
 "id := id [2];\n"
 "return DAV_UNLOCK_INT (id, type, token, null, null, auth_uid);\n"
 "}\n"
-"--src DET_PropFilter.sql:696\n";
+"--src DET_PropFilter.sql:695\n";
 
-static const char *proc509 = 
+static const char *proc521 = 
+"#line 707 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_IS_LOCKED\" (inout id any, inout type char(1), in owned_tokens varchar) returns integer\n"
 "{\n"
 "declare rc integer;\n"
@@ -22843,9 +23800,10 @@ static const char *proc509 =
 "type := orig_type;\n"
 "return 0;\n"
 "}\n"
-"--src DET_PropFilter.sql:706\n";
+"--src DET_PropFilter.sql:705\n";
 
-static const char *proc510 = 
+static const char *proc522 = 
+"#line 731 \"[executable]/DET_PropFilter.sql\"\n"
 "create function \"PropFilter_DAV_LIST_LOCKS\" (in id any, in type char(1), in recursive integer) returns any\n"
 "{\n"
 "declare res any;\n"
@@ -22860,19 +23818,21 @@ static const char *proc510 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src DET_PropFilter.sql:730\n";
+"--src DET_PropFilter.sql:729\n";
 
 /* DET_RDFData.sql */
 
-static const char *proc511 = 
+static const char *proc523 = 
+"#line 26 \"[executable]/DET_RDFData.sql\"\n"
 "create procedure DB.DBA.RDFData_log_message (in x varchar)\n"
 "{\n"
 "if (0)\n"
 "log_message (cast (x as varchar));\n"
 "}\n"
-"--src DET_RDFData.sql:25\n";
+"--src DET_RDFData.sql:24\n";
 
-static const char *proc512 = 
+static const char *proc524 = 
+"#line 33 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_AUTHENTICATE\" (in id any, in what char(1), in req varchar, in auth_uname varchar, in auth_pwd varchar, in auth_uid integer)\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
@@ -22894,9 +23854,10 @@ static const char *proc512 =
 "return auth_uid;\n"
 "return -12;\n"
 "}\n"
-"--src DET_RDFData.sql:32\n";
+"--src DET_RDFData.sql:31\n";
 
-static const char *proc513 = 
+static const char *proc525 = 
+"#line 56 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_AUTHENTICATE_HTTP\" (in id any, in what char(1), in req varchar, in can_write_http integer, inout a_lines any, inout a_uname varchar, inout a_pwd varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
@@ -22942,65 +23903,73 @@ static const char *proc513 =
 "nf_col_or_res:\n"
 "return -1;\n"
 "}\n"
-"--src DET_RDFData.sql:55\n";
+"--src DET_RDFData.sql:54\n";
 
-static const char *proc514 = 
+static const char *proc526 = 
+"#line 104 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_GET_PARENT\" (in id any, in st char(1), in path varchar) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:103\n";
+"--src DET_RDFData.sql:102\n";
 
-static const char *proc515 = 
+static const char *proc527 = 
+"#line 111 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_COL_CREATE\" (in detcol_id any, in path_parts any, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:110\n";
+"--src DET_RDFData.sql:109\n";
 
-static const char *proc516 = 
+static const char *proc528 = 
+"#line 118 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_COL_MOUNT\" (in detcol_id any, in path_parts any, in full_mount_path varchar, in mount_det varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:117\n";
+"--src DET_RDFData.sql:116\n";
 
-static const char *proc517 = 
+static const char *proc529 = 
+"#line 125 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_COL_MOUNT_HERE\" (in parent_id any, in full_mount_path varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:124\n";
+"--src DET_RDFData.sql:123\n";
 
-static const char *proc518 = 
+static const char *proc530 = 
+"#line 133 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_DELETE\" (in detcol_id any, in path_parts any, in what char(1), in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:132\n";
+"--src DET_RDFData.sql:131\n";
 
-static const char *proc519 = 
+static const char *proc531 = 
+"#line 140 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_RES_UPLOAD\" (in detcol_id any, in path_parts any, inout content any, in type varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:139\n";
+"--src DET_RDFData.sql:138\n";
 
-static const char *proc520 = 
+static const char *proc532 = 
+"#line 148 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_PROP_REMOVE\" (in id any, in what char(0), in propname varchar, in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:147\n";
+"--src DET_RDFData.sql:146\n";
 
-static const char *proc521 = 
+static const char *proc533 = 
+"#line 155 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_PROP_SET\" (in id any, in what char(0), in propname varchar, in propvalue any, in overwrite integer, in auth_uid integer) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
@@ -23010,25 +23979,28 @@ static const char *proc521 =
 "}\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:154\n";
+"--src DET_RDFData.sql:153\n";
 
-static const char *proc522 = 
+static const char *proc534 = 
+"#line 166 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_PROP_GET\" (in id any, in what char(0), in propname varchar, in auth_uid integer)\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -11;\n"
 "}\n"
-"--src DET_RDFData.sql:165\n";
+"--src DET_RDFData.sql:164\n";
 
-static const char *proc523 = 
+static const char *proc535 = 
+"#line 174 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_PROP_LIST\" (in id any, in what char(0), in propmask varchar, in auth_uid integer)\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return vector ();\n"
 "}\n"
-"--src DET_RDFData.sql:173\n";
+"--src DET_RDFData.sql:172\n";
 
-static const char *proc524 = 
+static const char *proc536 = 
+"#line 181 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_ACCESS_PARAMS\" (in detcol_id any, out access varchar, out gid integer, out uid integer)\n"
 "{\n"
 "declare access_tmp varchar;\n"
@@ -23045,9 +24017,10 @@ static const char *proc524 =
 "ret:\n"
 " ;\n"
 "}\n"
-"--src DET_RDFData.sql:180\n";
+"--src DET_RDFData.sql:179\n";
 
-static const char *proc525 = 
+static const char *proc537 = 
+"#line 199 \"[executable]/DET_RDFData.sql\"\n"
 "create procedure DB.DBA.RDFData_cast_dt_silent (in d any)\n"
 "{\n"
 "if (__tag (d) = 211)\n"
@@ -23061,9 +24034,10 @@ static const char *proc525 =
 "return cast (d as datetime);\n"
 "}\n"
 "}\n"
-"--src DET_RDFData.sql:198\n";
+"--src DET_RDFData.sql:197\n";
 
-static const char *proc526 = 
+static const char *proc538 = 
+"#line 214 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_DIR_SINGLE\" (in id any, in what char(0), in path any, in auth_uid integer) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
@@ -23091,9 +24065,10 @@ static const char *proc526 =
 "}\n"
 "return vector (DAV_CONCAT_PATH (path, \'\'), \'R\', 0, now (), id, access, ownergid, owner_uid, now (), mime, path_parts [len - 1]);\n"
 "}\n"
-"--src DET_RDFData.sql:213\n";
+"--src DET_RDFData.sql:212\n";
 
-static const char *proc527 = 
+static const char *proc539 = 
+"#line 244 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_DIR_LIST\" (in detcol_id any, in path_parts any, in detcol_path varchar, in name_mask varchar, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
@@ -23312,9 +24287,10 @@ static const char *proc527 =
 "vectorbld_final (res);\n"
 "return res;\n"
 "}\n"
-"--src DET_RDFData.sql:243\n";
+"--src DET_RDFData.sql:242\n";
 
-static const char *proc528 = 
+static const char *proc540 = 
+"#line 465 \"[executable]/DET_RDFData.sql\"\n"
 "create function RDFData_std_pref (in iri varchar, in rev int := 0)\n"
 "{\n"
 "declare v any;\n"
@@ -23355,18 +24331,20 @@ static const char *proc528 =
 "else\n"
 "return get_keyword (iri, v, null);\n"
 "}\n"
-"--src DET_RDFData.sql:464\n";
+"--src DET_RDFData.sql:463\n";
 
-static const char *proc529 = 
+static const char *proc541 = 
+"#line 507 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_DIR_FILTER\" (in detcol_id any, in path_parts any, in detcol_path varchar, inout compilation any, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "\n"
 "return vector();\n"
 "}\n"
-"--src DET_RDFData.sql:506\n";
+"--src DET_RDFData.sql:505\n";
 
-static const char *proc530 = 
+static const char *proc542 = 
+"#line 515 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_SEARCH_ID\" (in detcol_id any, in path_parts any, in what char(1)) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
@@ -23416,9 +24394,10 @@ static const char *proc530 =
 "}\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:514\n";
+"--src DET_RDFData.sql:513\n";
 
-static const char *proc531 = 
+static const char *proc543 = 
+"#line 566 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_SEARCH_PATH\" (in id any, in what char(1)) returns any\n"
 "{\n"
 "declare col_path varchar;\n"
@@ -23430,25 +24409,28 @@ static const char *proc531 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src DET_RDFData.sql:565\n";
+"--src DET_RDFData.sql:564\n";
 
-static const char *proc532 = 
+static const char *proc544 = 
+"#line 579 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_RES_UPLOAD_COPY\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite_flags integer, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:578\n";
+"--src DET_RDFData.sql:577\n";
 
-static const char *proc533 = 
+static const char *proc545 = 
+"#line 586 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_RES_UPLOAD_MOVE\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite_flags integer, in auth_uid integer) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:585\n";
+"--src DET_RDFData.sql:584\n";
 
-static const char *proc534 = 
+static const char *proc546 = 
+"#line 593 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_RES_CONTENT\" (in id any, inout content any, out type varchar, in content_mode integer) returns integer\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
@@ -23544,64 +24526,72 @@ static const char *proc534 =
 "content := string_output_string (ses);\n"
 "return 0;\n"
 "}\n"
-"--src DET_RDFData.sql:592\n";
+"--src DET_RDFData.sql:591\n";
 
-static const char *proc535 = 
+static const char *proc547 = 
+"#line 690 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_SYMLINK\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:689\n";
+"--src DET_RDFData.sql:688\n";
 
-static const char *proc536 = 
+static const char *proc548 = 
+"#line 697 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_DEREFERENCE_LIST\" (in detcol_id any, inout report_array any) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:696\n";
+"--src DET_RDFData.sql:695\n";
 
-static const char *proc537 = 
+static const char *proc549 = 
+"#line 704 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_RESOLVE_PATH\" (in detcol_id any, inout reference_item any, inout old_base varchar, inout new_base varchar) returns any\n"
 "{\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:703\n";
+"--src DET_RDFData.sql:702\n";
 
-static const char *proc538 = 
+static const char *proc550 = 
+"#line 710 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_LOCK\" (in path any, in id any, in type char(1), inout locktype varchar, inout scope varchar, in token varchar, inout owner_name varchar, inout owned_tokens varchar, in depth varchar, in timeout_sec integer, in auth_uid integer) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -20;\n"
 "}\n"
-"--src DET_RDFData.sql:709\n";
+"--src DET_RDFData.sql:708\n";
 
-static const char *proc539 = 
+static const char *proc551 = 
+"#line 718 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_UNLOCK\" (in id any, in type char(1), in token varchar, in auth_uid integer)\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return -27;\n"
 "}\n"
-"--src DET_RDFData.sql:717\n";
+"--src DET_RDFData.sql:716\n";
 
-static const char *proc540 = 
+static const char *proc552 = 
+"#line 725 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_IS_LOCKED\" (inout id any, inout type char(1), in owned_tokens varchar) returns integer\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return 0;\n"
 "}\n"
-"--src DET_RDFData.sql:724\n";
+"--src DET_RDFData.sql:723\n";
 
-static const char *proc541 = 
+static const char *proc553 = 
+"#line 733 \"[executable]/DET_RDFData.sql\"\n"
 "create function DB.DBA.\"RDFData_DAV_LIST_LOCKS\" (in id any, in type char(1), in recursive integer) returns any\n"
 "{\n"
 "RDFData_log_message (current_proc_name ());\n"
 "return vector ();\n"
 "}\n"
-"--src DET_RDFData.sql:732\n";
+"--src DET_RDFData.sql:731\n";
 
-static const char *proc542 = 
+static const char *proc554 = 
+"#line 740 \"[executable]/DET_RDFData.sql\"\n"
 "create procedure DB.DBA.\"RDFData_MAKE_DET_COL\" (in path varchar, in gr varchar := null, in lg varchar := null)\n"
 "{\n"
 "declare colid int;\n"
@@ -23614,11 +24604,12 @@ static const char *proc542 =
 "if (lg is not null)\n"
 "DAV_PROP_SET_INT (path, \'virt:rdfdata_lang\', lg, null, null, 0, 0, 1, http_dav_uid ());\n"
 "}\n"
-"--src DET_RDFData.sql:739\n";
+"--src DET_RDFData.sql:738\n";
 
 /* DET_S3.sql */
 
-static const char *proc543 = 
+static const char *proc555 = 
+"#line 25 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__encode (\n"
 "in S varchar)\n"
 "{\n"
@@ -23627,9 +24618,10 @@ static const char *proc543 =
 "S := replace(S, \'%2F\', \'/\');\n"
 "return S;\n"
 "}\n"
-"--src DET_S3.sql:24\n";
+"--src DET_S3.sql:23\n";
 
-static const char *proc544 = 
+static const char *proc556 = 
+"#line 37 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__params (\n"
 "in colID integer,\n"
 "out bucket varchar,\n"
@@ -23640,9 +24632,10 @@ static const char *proc544 =
 "accessCode := DB.DBA.DAV_PROP_GET_INT (colID, \'C\', \'virt:S3-AccessKeyID\', 0);\n"
 "secretKey := DB.DBA.DAV_PROP_GET_INT (colID, \'C\', \'virt:S3-SecretKey\', 0);\n"
 "}\n"
-"--src DET_S3.sql:36\n";
+"--src DET_S3.sql:35\n";
 
-static const char *proc545 = 
+static const char *proc557 = 
+"#line 51 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__parts2path (\n"
 "in bucket varchar,\n"
 "in pathParts any,\n"
@@ -23660,9 +24653,10 @@ static const char *proc545 =
 "path := rtrim (path, \'/\') || case when (what = \'C\') then \'/\' end;\n"
 "return path;\n"
 "}\n"
-"--src DET_S3.sql:50\n";
+"--src DET_S3.sql:49\n";
 
-static const char *proc546 = 
+static const char *proc558 = 
+"#line 72 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__item2entry (\n"
 "in detcolID integer,\n"
 "in detcolPath varchar,\n"
@@ -23709,9 +24703,10 @@ static const char *proc546 =
 "get_keyword (\'name\', item)\n"
 ");\n"
 "}\n"
-"--src DET_S3.sql:71\n";
+"--src DET_S3.sql:70\n";
 
-static const char *proc547 = 
+static const char *proc559 = 
+"#line 121 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__headers2item (\n"
 "in headers varchat,\n"
 "in s3Path varchar,\n"
@@ -23729,9 +24724,10 @@ static const char *proc547 =
 ");\n"
 "return item;\n"
 "}\n"
-"--src DET_S3.sql:120\n";
+"--src DET_S3.sql:119\n";
 
-static const char *proc548 = 
+static const char *proc560 = 
+"#line 143 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__makeHostUrl (\n"
 "in path varchar,\n"
 "in isSecure integer := 1)\n"
@@ -23762,9 +24758,10 @@ static const char *proc548 =
 "}\n"
 "return hostUrl;\n"
 "}\n"
-"--src DET_S3.sql:142\n";
+"--src DET_S3.sql:141\n";
 
-static const char *proc549 = 
+static const char *proc561 = 
+"#line 177 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__getBucketFromUrl (\n"
 "in url varchar)\n"
 "{\n"
@@ -23775,9 +24772,10 @@ static const char *proc549 =
 "return parts[0];\n"
 "return \'\';\n"
 "}\n"
-"--src DET_S3.sql:176\n";
+"--src DET_S3.sql:175\n";
 
-static const char *proc550 = 
+static const char *proc562 = 
+"#line 191 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__getNameFromUrl (\n"
 "in url varchar)\n"
 "{\n"
@@ -23788,9 +24786,10 @@ static const char *proc550 =
 "return parts[length (parts) - 1];\n"
 "return \'\';\n"
 "}\n"
-"--src DET_S3.sql:190\n";
+"--src DET_S3.sql:189\n";
 
-static const char *proc551 = 
+static const char *proc563 = 
+"#line 205 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__getPathFromUrl (\n"
 "in url varchar)\n"
 "{\n"
@@ -23801,9 +24800,10 @@ static const char *proc551 =
 "return \'\';\n"
 "return ltrim (subseq (url, length (bucket)+1), \'/\');\n"
 "}\n"
-"--src DET_S3.sql:204\n";
+"--src DET_S3.sql:203\n";
 
-static const char *proc552 = 
+static const char *proc564 = 
+"#line 219 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__makeAWSHeader (\n"
 "in accessCode varchar,\n"
 "in secretKey varchar,\n"
@@ -23821,9 +24821,10 @@ static const char *proc552 =
 "\n"
 "return T;\n"
 "}\n"
-"--src DET_S3.sql:218\n";
+"--src DET_S3.sql:217\n";
 
-static const char *proc553 = 
+static const char *proc565 = 
+"#line 240 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__getBuckets (\n"
 "in accessCode varchar,\n"
 "in secretKey varchar,\n"
@@ -23874,9 +24875,10 @@ static const char *proc553 =
 "}\n"
 "return buckets;\n"
 "}\n"
-"--src DET_S3.sql:239\n";
+"--src DET_S3.sql:238\n";
 
-static const char *proc554 = 
+static const char *proc566 = 
+"#line 296 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__getBucket (\n"
 "in accessCode varchar,\n"
 "in secretKey varchar,\n"
@@ -23938,9 +24940,10 @@ static const char *proc554 =
 "}\n"
 "return buckets;\n"
 "}\n"
-"--src DET_S3.sql:295\n";
+"--src DET_S3.sql:294\n";
 
-static const char *proc555 = 
+static const char *proc567 = 
+"#line 361 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__putObject (\n"
 "in accessCode varchar,\n"
 "in secretKey varchar,\n"
@@ -23978,9 +24981,10 @@ static const char *proc555 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src DET_S3.sql:360\n";
+"--src DET_S3.sql:359\n";
 
-static const char *proc556 = 
+static const char *proc568 = 
+"#line 402 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__headObject (\n"
 "in accessCode varchar,\n"
 "in secretKey varchar,\n"
@@ -24029,9 +25033,10 @@ static const char *proc556 =
 "return 1;\n"
 "return item;\n"
 "}\n"
-"--src DET_S3.sql:401\n";
+"--src DET_S3.sql:400\n";
 
-static const char *proc557 = 
+static const char *proc569 = 
+"#line 454 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__getObject (\n"
 "in accessCode varchar,\n"
 "in secretKey varchar,\n"
@@ -24063,9 +25068,10 @@ static const char *proc557 =
 "item := vector_concat (vector (\'content\', xt), DB.DBA.S3__headers2item (resHdr, s3Path, what));\n"
 "return item;\n"
 "}\n"
-"--src DET_S3.sql:453\n";
+"--src DET_S3.sql:452\n";
 
-static const char *proc558 = 
+static const char *proc570 = 
+"#line 489 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.S3__deleteObject (\n"
 "in accessCode varchar,\n"
 "in secretKey varchar,\n"
@@ -24106,9 +25112,10 @@ static const char *proc558 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src DET_S3.sql:488\n";
+"--src DET_S3.sql:487\n";
 
-static const char *proc559 = 
+static const char *proc571 = 
+"#line 533 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_AUTHENTICATE\" (in id any, in what char(1), in req varchar, in auth_uname varchar, in auth_pwd varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
@@ -24116,9 +25123,10 @@ static const char *proc559 =
 "return auth_uid;\n"
 "return -12;\n"
 "}\n"
-"--src DET_S3.sql:532\n";
+"--src DET_S3.sql:531\n";
 
-static const char *proc560 = 
+static const char *proc572 = 
+"#line 547 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_AUTHENTICATE_HTTP\" (in id any, in what char(1), in req varchar, in can_write_http integer, inout a_lines any, inout a_uname varchar, inout a_pwd varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer\n"
 "{\n"
 "\n"
@@ -24170,17 +25178,19 @@ static const char *proc560 =
 "nf_col_or_res:\n"
 "return -1;\n"
 "}\n"
-"--src DET_S3.sql:546\n";
+"--src DET_S3.sql:545\n";
 
-static const char *proc561 = 
+static const char *proc573 = 
+"#line 603 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_GET_PARENT\" (in id any, in st char(1), in path varchar) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_S3.sql:602\n";
+"--src DET_S3.sql:601\n";
 
-static const char *proc562 = 
+static const char *proc574 = 
+"#line 612 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_COL_CREATE\" (in detcolID any, in pathParts any, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
@@ -24194,9 +25204,10 @@ static const char *proc562 =
 "return -1;\n"
 "return vector (UNAME\'S3\', detcolID, s3Path);\n"
 "}\n"
-"--src DET_S3.sql:611\n";
+"--src DET_S3.sql:610\n";
 
-static const char *proc563 = 
+static const char *proc575 = 
+"#line 628 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_DELETE\" (\n"
 "in detcolID any,\n"
 "in pathParts any,\n"
@@ -24211,25 +25222,28 @@ static const char *proc563 =
 "s3Path := DB.DBA.S3__parts2path (bucket, pathParts, what);\n"
 "return DB.DBA.S3__deleteObject (accessCode, secretKey, s3Path);\n"
 "}\n"
-"--src DET_S3.sql:627\n";
+"--src DET_S3.sql:626\n";
 
-static const char *proc564 = 
+static const char *proc576 = 
+"#line 648 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_RES_UPLOAD\" (in detcolID any, in pathParts any, inout content any, in type varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_S3.sql:647\n";
+"--src DET_S3.sql:646\n";
 
-static const char *proc565 = 
+static const char *proc577 = 
+"#line 658 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_PROP_REMOVE\" (in id any, in what char(0), in propname varchar, in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_S3.sql:657\n";
+"--src DET_S3.sql:656\n";
 
-static const char *proc566 = 
+static const char *proc578 = 
+"#line 667 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_PROP_SET\" (in id any, in what char(0), in propname varchar, in propvalue any, in overwrite integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
@@ -24238,25 +25252,28 @@ static const char *proc566 =
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_S3.sql:666\n";
+"--src DET_S3.sql:665\n";
 
-static const char *proc567 = 
+static const char *proc579 = 
+"#line 678 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_PROP_GET\" (in id any, in what char(0), in propname varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
 "return -11;\n"
 "}\n"
-"--src DET_S3.sql:677\n";
+"--src DET_S3.sql:676\n";
 
-static const char *proc568 = 
+static const char *proc580 = 
+"#line 687 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_PROP_LIST\" (in id any, in what char(0), in propmask varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
 "return vector ();\n"
 "}\n"
-"--src DET_S3.sql:686\n";
+"--src DET_S3.sql:685\n";
 
-static const char *proc569 = 
+static const char *proc581 = 
+"#line 695 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_DIR_SINGLE\" (\n"
 "in id any,\n"
 "in what char(0),\n"
@@ -24277,9 +25294,10 @@ static const char *proc569 =
 "detcolPath := DB.DBA.DAV_SEARCH_PATH (detcolID, \'C\');\n"
 "return DB.DBA.S3__item2entry (detcolID, detcolPath, bucket, s3Object);\n"
 "}\n"
-"--src DET_S3.sql:694\n";
+"--src DET_S3.sql:693\n";
 
-static const char *proc570 = 
+static const char *proc582 = 
+"#line 718 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_DIR_LIST\" (\n"
 "in detcolID any,\n"
 "in pathParts any,\n"
@@ -24313,17 +25331,19 @@ static const char *proc570 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src DET_S3.sql:717\n";
+"--src DET_S3.sql:716\n";
 
-static const char *proc571 = 
+static const char *proc583 = 
+"#line 754 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_DIR_FILTER\" (in detcolID any, in pathParts any, in detcol_path varchar, inout compilation any, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return vector();\n"
 "}\n"
-"--src DET_S3.sql:753\n";
+"--src DET_S3.sql:752\n";
 
-static const char *proc572 = 
+static const char *proc584 = 
+"#line 762 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_SEARCH_ID\" (\n"
 "in detcolID any,\n"
 "in pathParts any,\n"
@@ -24340,9 +25360,10 @@ static const char *proc572 =
 "return -1;\n"
 "return vector (UNAME\'S3\', detcolID, s3Path);\n"
 "}\n"
-"--src DET_S3.sql:761\n";
+"--src DET_S3.sql:760\n";
 
-static const char *proc573 = 
+static const char *proc585 = 
+"#line 781 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_SEARCH_PATH\" (\n"
 "in id any,\n"
 "in what char(1)) returns any\n"
@@ -24363,9 +25384,10 @@ static const char *proc573 =
 "return -23;\n"
 "return rtrim (detcolPath, \'/\') || get_keyword (\'path\', s3Object);\n"
 "}\n"
-"--src DET_S3.sql:780\n";
+"--src DET_S3.sql:779\n";
 
-static const char *proc574 = 
+static const char *proc586 = 
+"#line 803 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_RES_UPLOAD\" (\n"
 "in detcolID any,\n"
 "in pathParts any,\n"
@@ -24385,9 +25407,10 @@ static const char *proc574 =
 "return -1;\n"
 "return vector (UNAME\'S3\', detcolID, s3Path);\n"
 "}\n"
-"--src DET_S3.sql:802\n";
+"--src DET_S3.sql:801\n";
 
-static const char *proc575 = 
+static const char *proc587 = 
+"#line 825 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_RES_UPLOAD_COPY\" (in detcolID any, in pathParts any, in sourceID any, in what char(1), in overwrite_flags integer, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
@@ -24413,9 +25436,10 @@ static const char *proc575 =
 "}\n"
 "return -20;\n"
 "}\n"
-"--src DET_S3.sql:824\n";
+"--src DET_S3.sql:823\n";
 
-static const char *proc576 = 
+static const char *proc588 = 
+"#line 853 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_RES_UPLOAD_MOVE\" (in detcolID any, in pathParts any, in sourceID any, in what char(1), in overwrite_flags integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
@@ -24444,9 +25468,10 @@ static const char *proc576 =
 "}\n"
 "return -20;\n"
 "}\n"
-"--src DET_S3.sql:852\n";
+"--src DET_S3.sql:851\n";
 
-static const char *proc577 = 
+static const char *proc589 = 
+"#line 885 \"[executable]/DET_S3.sql\"\n"
 "create function DB.DBA.\"S3_DAV_RES_CONTENT\" (\n"
 "in id any,\n"
 "inout content any,\n"
@@ -24466,95 +25491,991 @@ static const char *proc577 =
 "if (isnull (s3Object))\n"
 "return -1;\n"
 "\n"
-"s3Content := get_keyword (\'content\', s3Object);\n"
-"type := get_keyword (\'mimeType\', s3Object);\n"
+"s3Content := get_keyword (\'content\', s3Object);\n"
+"type := get_keyword (\'mimeType\', s3Object);\n"
+"if ((content_mode = 0) or (content_mode = 2))\n"
+"content := s3Content;\n"
+"else if (content_mode = 1)\n"
+"http (s3Content, content);\n"
+"else if (content_mode = 3)\n"
+"http (s3Content);\n"
+"\n"
+"return 0;\n"
+"}\n"
+"--src DET_S3.sql:883\n";
+
+static const char *proc590 = 
+"#line 918 \"[executable]/DET_S3.sql\"\n"
+"create function DB.DBA.\"S3_DAV_SYMLINK\" (in detcolID any, in pathParts any, in sourceID any, in what char(1), in overwrite integer, in uid integer, in gid integer, in auth_uid integer) returns any\n"
+"{\n"
+"\n"
+"return -20;\n"
+"}\n"
+"--src DET_S3.sql:916\n";
+
+static const char *proc591 = 
+"#line 926 \"[executable]/DET_S3.sql\"\n"
+"create function DB.DBA.\"S3_DAV_DEREFERENCE_LIST\" (in detcolID any, inout report_array any) returns any\n"
+"{\n"
+"\n"
+"return -20;\n"
+"}\n"
+"--src DET_S3.sql:924\n";
+
+static const char *proc592 = 
+"#line 934 \"[executable]/DET_S3.sql\"\n"
+"create function DB.DBA.\"S3_DAV_RESOLVE_PATH\" (in detcolID any, inout reference_item any, inout old_base varchar, inout new_base varchar) returns any\n"
+"{\n"
+"\n"
+"return -20;\n"
+"}\n"
+"--src DET_S3.sql:932\n";
+
+static const char *proc593 = 
+"#line 942 \"[executable]/DET_S3.sql\"\n"
+"create function DB.DBA.\"S3_DAV_LOCK\" (in path any, in id any, in type char(1), inout locktype varchar, inout scope varchar, in token varchar, inout owner_name varchar, inout owned_tokens varchar, in depth varchar, in timeout_sec integer, in auth_uid integer) returns any\n"
+"{\n"
+"\n"
+"return -20;\n"
+"}\n"
+"--src DET_S3.sql:940\n";
+
+static const char *proc594 = 
+"#line 950 \"[executable]/DET_S3.sql\"\n"
+"create function DB.DBA.\"S3_DAV_UNLOCK\" (in id any, in type char(1), in token varchar, in auth_uid integer)\n"
+"{\n"
+"\n"
+"return -27;\n"
+"}\n"
+"--src DET_S3.sql:948\n";
+
+static const char *proc595 = 
+"#line 959 \"[executable]/DET_S3.sql\"\n"
+"create function DB.DBA.\"S3_DAV_IS_LOCKED\" (inout id any, inout Type char(1), in owned_tokens varchar) returns integer\n"
+"{\n"
+"\n"
+"declare rc integer;\n"
+"declare orig_id any;\n"
+"declare orig_type char(1);\n"
+"\n"
+"\n"
+"orig_id := id;\n"
+"orig_type := type;\n"
+"\n"
+"ID := orig_id[1];\n"
+"Type := \'C\';\n"
+"rc := DB.DBA.DAV_IS_LOCKED_INT (id, type, owned_tokens);\n"
+"\n"
+"\n"
+"id := orig_id;\n"
+"Type := orig_type;\n"
+"if (rc <> 0)\n"
+"return rc;\n"
+"return 0;\n"
+"}\n"
+"--src DET_S3.sql:957\n";
+
+static const char *proc596 = 
+"#line 985 \"[executable]/DET_S3.sql\"\n"
+"create function DB.DBA.\"S3_DAV_LIST_LOCKS\" (in id any, in type char(1), in recursive integer) returns any\n"
+"{\n"
+"\n"
+"return vector ();\n"
+"}\n"
+"--src DET_S3.sql:983\n";
+
+/* DET_DynaRes.sql */
+
+static const char *tbl7 = 
+"create table WS.WS.DYNA_RES (\n"
+"DR_RES_ID integer not null primary key,\n"
+"DR_DETCOL_ID integer not null,\n"
+"DR_NAME varchar not null,\n"
+"DR_PERMS varchar not null,\n"
+"DR_OWNER_UID integer not null,\n"
+"DR_OWNER_GID integer not null,\n"
+"DR_CREATED_DT datetime not null,\n"
+"DR_MODIFIED_DT datetime,\n"
+"DR_REFRESH_DT datetime,\n"
+"DR_DELETE_DT datetime,\n"
+"DR_REFRESH_SECONDS integer,\n"
+"DR_MIME varchar not null,\n"
+"DR_EXEC_STMT varchar,\n"
+"DR_EXEC_PARAMS long varchar,\n"
+"DR_EXEC_UNAME varchar,\n"
+"DR_LAST_LENGTH integer,\n"
+"DR_CONTENT long varchar )\n"
+"create unique index DYNA_RES_DETCOL_NAME on WS.WS.DYNA_RES (DR_DETCOL_ID, DR_NAME)\n"
+"create index DYNA_RES_REFRESH_DT on WS.WS.DYNA_RES (DR_REFRESH_DT)\n"
+"create index DYNA_RES_DELETE_DT on WS.WS.DYNA_RES (DR_DELETE_DT)\n";
+
+static const char *proc597 = 
+"#line 51 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_ACCESS_PARAMS\" (in detcol_id any, out access varchar, out gid integer, out uid integer)\n"
+"{\n"
+"declare access_tmp varchar;\n"
+"whenever not found goto ret;\n"
+"access := \'000000000N\';\n"
+"gid := http_nogroup_gid ();\n"
+"uid := http_nobody_uid ();\n"
+"if (isinteger (detcol_id))\n"
+"{\n"
+"select COL_PERMS, COL_GROUP, COL_OWNER into access_tmp, gid, uid from WS.WS.SYS_DAV_COL where COL_ID = detcol_id;\n"
+"}\n"
+"access[0] := access_tmp[0];\n"
+"access[1] := access_tmp[1];\n"
+"\n"
+"ret:\n"
+" ;\n"
+"}\n"
+"--src DET_DynaRes.sql:49\n";
+
+static const char *proc598 = 
+"#line 72 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_AUTHENTICATE\" (in id any, in what char(1), in req varchar, in auth_uname varchar, in auth_pwd varchar, in auth_uid integer)\n"
+"{\n"
+"declare pgid, puid integer;\n"
+"declare pperms varchar;\n"
+"\n"
+"if (auth_uid < 0)\n"
+"return -12;\n"
+"whenever not found goto nf_col_or_res;\n"
+"select DR_PERMS, DR_OWNER_UID, DR_OWNER_GID into pperms, puid, pgid from WS.WS.DYNA_RES where DR_DETCOL_ID = id[1] and DR_RES_ID = id[3];\n"
+"if (not (\'110\' like req))\n"
+"return -13;\n"
+"if (DAV_CHECK_PERM (pperms, req, auth_uid, http_nogroup_gid(), pgid, puid))\n"
+"{\n"
+"\n"
+"return auth_uid;\n"
+"}\n"
+"return -13;\n"
+"nf_col_or_res:\n"
+"return -1;\n"
+"}\n"
+"--src DET_DynaRes.sql:70\n";
+
+static const char *proc599 = 
+"#line 99 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_AUTHENTICATE_HTTP\" (in id any, in what char(1), in req varchar, in can_write_http integer, inout a_lines any, inout a_uname varchar, inout a_pwd varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer\n"
+"{\n"
+"declare rc integer;\n"
+"declare puid, pgid integer;\n"
+"declare u_password, pperms varchar;\n"
+"declare allow_anon integer;\n"
+"\n"
+"if (length (req) <> 3)\n"
+"return -15;\n"
+"whenever not found goto nf_col_or_res;\n"
+"select DR_PERMS, DR_OWNER_UID, DR_OWNER_GID into pperms, puid, pgid from WS.WS.DYNA_RES where DR_DETCOL_ID = id[1] and DR_RES_ID = id[3];\n"
+"if (pperms is null)\n"
+"return -1;\n"
+"if ((what <> \'R\') and (what <> \'C\'))\n"
+"return -14;\n"
+"allow_anon := WS.WS.PERM_COMP (substring (cast (pperms as varchar), 7, 3), req);\n"
+"if (a_uid is null)\n"
+"{\n"
+"if ((not allow_anon) or (\'\' <> WS.WS.FINDPARAM (a_lines, \'Authorization:\')))\n"
+"rc := WS.WS.GET_DAV_AUTH (a_lines, allow_anon, can_write_http, a_uname, u_password, a_uid, a_gid, _perms);\n"
+"if (rc < 0)\n"
+"return rc;\n"
+"}\n"
+"if (isinteger (a_uid))\n"
+"{\n"
+"if (a_uid < 0)\n"
+"return a_uid;\n"
+"if (a_uid = 1)\n"
+"{\n"
+"a_uid := 0;\n"
+"a_gid := 0;\n"
+"}\n"
+"}\n"
+"if (DAV_CHECK_PERM (pperms, req, a_uid, a_gid, pgid, puid))\n"
+"{\n"
+"\n"
+"return a_uid;\n"
+"}\n"
+"return -13;\n"
+"\n"
+"nf_col_or_res:\n"
+"return -1;\n"
+"}\n"
+"--src DET_DynaRes.sql:97\n";
+
+static const char *proc600 = 
+"#line 146 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_GET_PARENT\" (in id any, in st char(1), in path varchar) returns any\n"
+"{\n"
+"\n"
+"if (\'R\' <> st)\n"
+"return -1;\n"
+"return id[1];\n"
+"}\n"
+"--src DET_DynaRes.sql:144\n";
+
+static const char *proc601 = 
+"#line 157 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_COL_CREATE\" (in detcol_id any, in path_parts any, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
+"{\n"
+"\n"
+"return -20;\n"
+"}\n"
+"--src DET_DynaRes.sql:155\n";
+
+static const char *proc602 = 
+"#line 165 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_COL_MOUNT\" (in detcol_id any, in path_parts any, in full_mount_path varchar, in mount_det varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
+"{\n"
+"\n"
+"return -20;\n"
+"}\n"
+"--src DET_DynaRes.sql:163\n";
+
+static const char *proc603 = 
+"#line 173 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_COL_MOUNT_HERE\" (in parent_id any, in full_mount_path varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
+"{\n"
+"\n"
+"return -20;\n"
+"}\n"
+"--src DET_DynaRes.sql:171\n";
+
+static const char *proc604 = 
+"#line 182 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_DELETE\" (in detcol_id any, in path_parts any, in what char(1), in silent integer, in auth_uid integer) returns integer\n"
+"{\n"
+"declare id any;\n"
+"\n"
+"if (\'R\' <> what)\n"
+"return -20;\n"
+"id := \"DynaRes_DAV_SEARCH_ID\" (detcol_id, path_parts, what);\n"
+"if (DAV_HIDE_ERROR (id) is null)\n"
+"return id;\n"
+"delete from WS.WS.DYNA_RES where DR_RES_ID = id[3] and DR_DETCOL_ID = id[1];\n"
+"return 0;\n"
+"}\n"
+"--src DET_DynaRes.sql:180\n";
+
+static const char *proc605 = 
+"#line 200 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_RES_UPLOAD\" (in detcol_id any, in path_parts any, inout content any, in type varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
+"{\n"
+"\n"
+"declare res_depth, rc int;\n"
+"return -20;\n"
+"}\n"
+"--src DET_DynaRes.sql:198\n";
+
+static const char *proc606 = 
+"#line 211 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_PROP_REMOVE\" (in id any, in what char(0), in propname varchar, in silent integer, in auth_uid integer) returns integer\n"
+"{\n"
+"\n"
+"return -20;\n"
+"}\n"
+"--src DET_DynaRes.sql:209\n";
+
+static const char *proc607 = 
+"#line 220 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_PROP_SET\" (in id any, in what char(0), in propname varchar, in propvalue any, in overwrite integer, in auth_uid integer) returns any\n"
+"{\n"
+"\n"
+"if (propname[0] = 58)\n"
+"{\n"
+"return -16;\n"
+"}\n"
+"return -20;\n"
+"}\n"
+"--src DET_DynaRes.sql:218\n";
+
+static const char *proc608 = 
+"#line 232 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_PROP_GET\" (in id any, in what char(0), in propname varchar, in auth_uid integer)\n"
+"{\n"
+"\n"
+"return -11;\n"
+"}\n"
+"--src DET_DynaRes.sql:230\n";
+
+static const char *proc609 = 
+"#line 241 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_PROP_LIST\" (in id any, in what char(0), in propmask varchar, in auth_uid integer)\n"
+"{\n"
+"\n"
+"return vector ();\n"
+"}\n"
+"--src DET_DynaRes.sql:239\n";
+
+static const char *proc610 = 
+"#line 249 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_DIR_SINGLE\" (in id any, in what char(0), in path any, in auth_uid integer) returns any\n"
+"{\n"
+"\n"
+"declare fullpath, rightcol, resname varchar;\n"
+"declare access varchar;\n"
+"declare ownergid, owner_uid integer;\n"
+"fullpath := \'\';\n"
+"\"DynaRes_ACCESS_PARAMS\" (id[1], access, ownergid, owner_uid);\n"
+"resname := coalesce ((select DR_NAME from WS.WS.DYNA_RES where DR_RES_ID = id[3] and DR_DETCOL_ID = id[1]));\n"
+"if (resname is null)\n"
+"return -1;\n"
+"fullpath := concat(DAV_SEARCH_PATH (id[1], \'C\'), resname);\n"
+"if (\'C\' = what)\n"
+"{\n"
+"declare maxrcvdate datetime;\n"
+"return vector (fullpath, \'C\', 0, now(),\n"
+"id,\n"
+"\n"
+"\'100000000NN\',\n"
+"ownergid, owner_uid, now(), \'dav/unix-directory\', resname);\n"
+"}\n"
+"\n"
+"for (select DR_NAME, DR_LAST_LENGTH, DR_CREATED_DT, DR_PERMS, DR_OWNER_UID, DR_OWNER_GID, DR_MODIFIED_DT, DR_MIME\n"
+"from WS.WS.DYNA_RES where DR_RES_ID = id[3] and DR_DETCOL_ID = id[1]) do\n"
+"{\n"
+"return vector (fullpath || DR_NAME, \'R\', coalesce (DR_LAST_LENGTH, 1024), DR_CREATED_DT,\n"
+"id, DR_PERMS, DR_OWNER_GID, DR_OWNER_UID, DR_MODIFIED_DT, DR_MIME, DR_NAME );\n"
+"}\n"
+"return -1;\n"
+"}\n"
+"--src DET_DynaRes.sql:247\n";
+
+static const char *proc611 = 
+"#line 282 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_DIR_LIST\" (in detcol_id any, in path_parts any, in detcol_path varchar, in name_mask varchar, in recursive integer, in auth_uid integer) returns any\n"
+"{\n"
+"\n"
+"declare top_davpath varchar;\n"
+"declare res any;\n"
+"declare top_id any;\n"
+"declare what char (1);\n"
+"declare access varchar;\n"
+"declare ownergid, owner_uid integer;\n"
+"vectorbld_init (res);\n"
+"\"DynaRes_ACCESS_PARAMS\" (detcol_id, access, ownergid, owner_uid);\n"
+"if ((0 = length (path_parts)) or (\'\' = path_parts[length (path_parts) - 1]))\n"
+"what := \'C\';\n"
+"else\n"
+"what := \'R\';\n"
+"if (\'C\' = what and 1 = length(path_parts))\n"
+"top_id := vector (UNAME\'DynaRes\', detcol_id, null);\n"
+"else\n"
+"top_id := \"DynaRes_DAV_SEARCH_ID\" (detcol_id, path_parts, what);\n"
+"if (DAV_HIDE_ERROR (top_id) is null)\n"
+"{\n"
+"return vector();\n"
+"}\n"
+"top_davpath := DAV_CONCAT_PATH (detcol_path, path_parts);\n"
+"if (\'R\' = what)\n"
+"{\n"
+"return vector (\"DynaRes_DAV_DIR_SINGLE\" (top_id, what, top_davpath, auth_uid));\n"
+"}\n"
+"if (top_id[2] is null)\n"
+"{\n"
+"for (select DR_RES_ID, DR_NAME, DR_LAST_LENGTH, DR_CREATED_DT, DR_PERMS, DR_OWNER_UID, DR_OWNER_GID, DR_MODIFIED_DT, DR_MIME\n"
+"from WS.WS.DYNA_RES where DR_DETCOL_ID = detcol_id) do\n"
+"{\n"
+"vectorbld_acc (res, vector (top_davpath || DR_NAME, \'R\', coalesce (DR_LAST_LENGTH, 1024), DR_CREATED_DT,\n"
+"vector (UNAME\'DynaRes\', detcol_id, null, DR_RES_ID), DR_PERMS, DR_OWNER_GID, DR_OWNER_UID, DR_MODIFIED_DT, DR_MIME, DR_NAME ) );\n"
+"}\n"
+"goto finalize_res;\n"
+"}\n"
+"finalize_res:\n"
+"vectorbld_final (res);\n"
+"return res;\n"
+"}\n"
+"--src DET_DynaRes.sql:280\n";
+
+static const char *proc612 = 
+"#line 327 \"[executable]/DET_DynaRes.sql\"\n"
+"create procedure \"DynaRes_DAV_FC_PRED_METAS\" (inout pred_metas any)\n"
+"{\n"
+"pred_metas := vector (\n"
+"\'RES_ID\',		vector (\'DYNA_RES\'	, 0, \'any\'	, \'vector (UNAME\'\'DynaRes\'\', DR_DETCOL_ID, null, DR_RES_ID)\'	),\n"
+"\'RES_ID_SERIALIZED\',vector (\'DYNA_RES\'	, 0, \'varchar\'	, \'serialize (vector (UNAME\'\'DynaRes\'\', DR_DETCOL_ID, null, DR_RES_ID))\' ),\n"
+"\'RES_NAME\',		vector (\'DYNA_RES\'		, 0, \'varchar\'	, \'DR_NAME\'	),\n"
+"\'RES_FULL_PATH\',	vector (\'DYNA_RES\'	, 0, \'varchar\'	, \'concat (DAV_CONCAT_PATH (_param.detcolpath, null), DR_NAME)\'	),\n"
+"\'RES_TYPE\',		vector (\'DYNA_RES\'	, 0, \'varchar\'	, \'DR_MIME\'	),\n"
+"\'RES_OWNER_ID\',	vector (\'DYNA_RES\'	, 0, \'integer\'	, \'DR_OWNER_UID\'	),\n"
+"\'RES_OWNER_NAME\',	vector (\'DYNA_RES\'	, 0, \'varchar\'	, \'(select U_NAME from DB.DBA.SYS_USERS where U_ID=DR_OWNER_UID)\'	),\n"
+"\'RES_GROUP_ID\',	vector (\'DYNA_RES\'	, 0, \'integer\'	, \'DR_OWNER_GID\'	),\n"
+"\'RES_GROUP_NAME\',	vector (\'DYNA_RES\'	, 0, \'varchar\'	, \'(select U_NAME from DB.DBA.SYS_USERS where U_ID=DR_OWNER_GID)\'	),\n"
+"\'RES_COL_FULL_PATH\',vector (\'DYNA_RES\'	, 0, \'varchar\'	, \'(_param.detcolpath\'	),\n"
+"\'RES_COL_NAME\',	vector (\'DYNA_RES\'	, 0, \'varchar\'	, \'null\'	),\n"
+"\n"
+"\'RES_CR_TIME\',	vector (\'DYNA_RES\'	, 0, \'datetime\' , \'DR_CREATED_DT\'	),\n"
+"\'RES_MOD_TIME\',	vector (\'DYNA_RES\'	, 0, \'datetime\' , \'DR_MODIFIED_DT\'	),\n"
+"\'RES_PERMS\',	vector (\'DYNA_RES\'	, 0, \'varchar\'	, \'DR_PERMS\'	),\n"
+"\'RES_CONTENT\',	vector (\'DYNA_RES\'	, 0, \'text\'	, \'coalesce (DR_CONTENT, \'\'(dynamic)\'\')\'	),\n"
+"\'PROP_NAME\',	vector (\'DYNA_RES\'	, 0, \'varchar\'	, \'(\'\'Content\'\')\'	),\n"
+"\'PROP_VALUE\',	vector (\'DYNA_RES\'	, 1, \'text\'	, \'coalesce (DR_CONTENT, \'\'(dynamic)\'\')\'	),\n"
+"\'RES_TAGS\',		vector (\'DYNA_RES\'	, 0, \'varchar\'	, \'(\'\'\'\')\'	),\n"
+"\'RES_PUBLIC_TAGS\',	vector (\'DYNA_RES\'	, 0, \'varchar\'	, \'(\'\'\'\')\'	),\n"
+"\'RES_PRIVATE_TAGS\',	vector (\'DYNA_RES\'	, 0, \'varchar\'	, \'(\'\'\'\')\'	),\n"
+"\'RDF_PROP\',		vector (\'DYNA_RES\'	, 1, \'varchar\'	, NULL	),\n"
+"\'RDF_VALUE\',	vector (\'DYNA_RES\'	, 2, \'XML\'	, NULL	),\n"
+"\'RDF_OBJ_VALUE\',	vector (\'DYNA_RES\'	, 3, \'XML\'	, NULL	)\n"
+");\n"
+"}\n"
+"--src DET_DynaRes.sql:325\n";
+
+static const char *proc613 = 
+"#line 358 \"[executable]/DET_DynaRes.sql\"\n"
+"create procedure \"DynaRes_DAV_FC_TABLE_METAS\" (inout table_metas any)\n"
+"{\n"
+"table_metas := vector (\n"
+"\'DYNA_RES\'	 , vector (	\'\\n	inner join WS.WS.DYNA_RES as ^{alias}^ on ((^{alias}^.DR_RES_ID = _top.DR_RES_ID)^{andpredicates}^)\'	,\n"
+"\'DR_CONTENT\'	, \'DR_CONTENT\'	, \'[__quiet] /\' )\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+");\n"
+"}\n"
+"--src DET_DynaRes.sql:356\n";
+
+static const char *proc614 = 
+"#line 390 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_FC_PRINT_WHERE\" (inout filter any, in param_uid integer) returns varchar\n"
+"{\n"
+"declare pred_metas, cmp_metas, table_metas any;\n"
+"declare used_tables any;\n"
+"\n"
+"\"DynaRes_POST_DAV_FC_PRED_METAS\" (pred_metas);\n"
+"DAV_FC_CMP_METAS (cmp_metas);\n"
+"\"DynaRes_POST_DAV_FC_TABLE_METAS\" (table_metas);\n"
+"used_tables := vector (\n"
+"\'DYNA_RES\', vector (\'DYNA_RES\', \'_top\', null, vector (), vector (), vector ())\n"
+");\n"
+"return DAV_FC_PRINT_WHERE_INT (filter, pred_metas, cmp_metas, table_metas, used_tables, param_uid);\n"
+"}\n"
+"--src DET_DynaRes.sql:388\n";
+
+static const char *proc615 = 
+"#line 406 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_DIR_FILTER\" (in detcol_id any, in path_parts any, in detcol_path any, inout compilation any, in recursive integer, in auth_uid integer) returns any\n"
+"{\n"
+"declare st, access, qry_text, execstate, execmessage varchar;\n"
+"declare res any;\n"
+"declare cond_list, execmeta, execrows any;\n"
+"declare condtext, cond_key varchar;\n"
+"declare ownergid, owner_uid integer;\n"
+"\n"
+"\"DynaRes_ACCESS_PARAMS\" (detcol_id, access, ownergid, owner_uid);\n"
+"vectorbld_init (res);\n"
+"cond_list := get_keyword (\'\', compilation);\n"
+"\n"
+"condtext := \"DynaRes_POST_DAV_FC_PRINT_WHERE\" (cond_list, auth_uid);\n"
+"\n"
+"compilation := vector_concat (compilation, vector (cond_key, condtext));\n"
+"\n"
+"execstate := \'00000\';\n"
+"qry_text := \'select DAV_CONCAT_PATH (?, _top.DR_NAME),\n"
+"\'\'R\'\', _top.DR_LAST_LENGTH, coalesce (_top.DR_MODIFIED_DT, now ()),\n"
+"vector (UNAME\'\'DynaRes\'\', _top.DR_DETCOL_ID, null, _top.DR_RES_ID),\n"
+"_top.DR_PERMS, _top.DR_OWNER_GID, _top.DR_OWNER_UID, _top.DR_CREATED_DT, \'\'text/plain\'\', _top.DR_NAME\n"
+"from WS.WS.DYNA_RES as _top where _top.DR_DETCOL_ID = ? \' || condtext;\n"
+"\n"
+"exec (qry_text, execstate, execmessage,\n"
+"vector (detcol_path, detcol_id),\n"
+"100000000, execmeta, execrows );\n"
+"\n"
+"if (\'00000\' <> execstate)\n"
+"signal (execstate, execmessage || \' in \' || qry_text);\n"
+"vectorbld_concat_acc (res, execrows);\n"
+"\n"
+"finalize:\n"
+"vectorbld_final (res);\n"
+"return res;\n"
+"}\n"
+"--src DET_DynaRes.sql:404\n";
+
+static const char *proc616 = 
+"#line 444 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_SEARCH_ID\" (in detcol_id any, in path_parts any, in what char(1)) returns any\n"
+"{\n"
+"\n"
+"if (path_parts[0] = \'\' or path_parts[0] is null)\n"
+"return -1;\n"
+"declare colpath, c_name varchar;\n"
+"declare c_res_id, len integer;\n"
+"declare access varchar;\n"
+"declare ownergid, owner_uid integer;\n"
+"\"DynaRes_ACCESS_PARAMS\" (detcol_id, access, ownergid, owner_uid);\n"
+"len := length (path_parts);\n"
+"if (0 = len)\n"
+"{\n"
+"if (\'C\' <> what)\n"
+"{\n"
+"\n"
+"return -1;\n"
+"}\n"
+"return vector (UNAME\'DynaRes\', detcol_id, null, null);\n"
+"}\n"
+"if (\'\' = path_parts[len - 1])\n"
+"{\n"
+"if (\'C\' <> what)\n"
+"{\n"
+"\n"
+"return -1;\n"
+"}\n"
+"}\n"
+"else\n"
+"{\n"
+"if (\'R\' <> what)\n"
+"{\n"
+"\n"
+"return -1;\n"
+"}\n"
+"}\n"
+"c_res_id := coalesce ((select DR_RES_ID\n"
+"from WS.WS.DYNA_RES where DR_DETCOL_ID = detcol_id and DR_NAME = path_parts[len - 1]));\n"
+"if (c_res_id is null)\n"
+"return -1;\n"
+"return vector (UNAME\'DynaRes\', detcol_id, null, c_res_id);\n"
+"}\n"
+"--src DET_DynaRes.sql:442\n";
+
+static const char *proc617 = 
+"#line 489 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_SEARCH_PATH\" (in id any, in what char(1)) returns any\n"
+"{\n"
+"\n"
+"return NULL;\n"
+"}\n"
+"--src DET_DynaRes.sql:487\n";
+
+static const char *proc618 = 
+"#line 497 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_RES_UPLOAD_COPY\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite_flags integer, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
+"{\n"
+"\n"
+"return -20;\n"
+"}\n"
+"--src DET_DynaRes.sql:495\n";
+
+static const char *proc619 = 
+"#line 505 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_RES_UPLOAD_MOVE\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite_flags integer, in auth_uid integer) returns any\n"
+"{\n"
+"\n"
+"return -20;\n"
+"}\n"
+"--src DET_DynaRes.sql:503\n";
+
+static const char *proc620 = 
+"#line 514 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_RES_CONTENT\" (in id any, inout content any, out type varchar, in content_mode integer) returns integer\n"
+"{\n"
+"\n"
+"declare c cursor for select\n"
+"DR_NAME, DR_PERMS, DR_OWNER_UID, DR_OWNER_GID, DR_CREATED_DT, DR_MODIFIED_DT, DR_REFRESH_DT, DR_DELETE_DT,\n"
+"DR_REFRESH_SECONDS, DR_MIME, DR_EXEC_STMT, deserialize (DR_EXEC_PARAMS), DR_EXEC_UNAME, DR_CONTENT\n"
+"from WS.WS.DYNA_RES where DR_RES_ID = id[3] and DR_DETCOL_ID = id[1] for update;\n"
+"declare c_name, c_perms varchar;\n"
+"declare c_owner_uid, c_owner_gid integer;\n"
+"declare c_created_dt, c_modified_dt, c_refresh_dt, c_delete_dt datetime;\n"
+"declare c_refresh_seconds integer;\n"
+"declare c_mime, c_exec_stmt varchar;\n"
+"declare c_exec_params any;\n"
+"declare c_exec_uname varchar;\n"
+"declare c_last_length integer;\n"
+"declare c_content any;\n"
+"declare stat, msg varchar;\n"
+"declare mdta, rset any;\n"
+"set isolation = \'committed\';\n"
+"for (select DR_MIME, DR_CONTENT from WS.WS.DYNA_RES\n"
+"where DR_RES_ID = id[3] and DR_DETCOL_ID = id[1] and DR_MODIFIED_DT is not null\n"
+"and (DR_REFRESH_DT is null or DR_REFRESH_DT > now())\n"
+"and (DR_DELETE_DT is null or DR_DELETE_DT > now()) ) do\n"
+"{\n"
+"type := DR_MIME;\n"
+"if ((content_mode = 0) or (content_mode = 2))\n"
+"content := DR_CONTENT;\n"
+"else if (content_mode = 1)\n"
+"http (DR_CONTENT, content);\n"
+"else if (content_mode = 3)\n"
+"http (DR_CONTENT);\n"
+"return 0;\n"
+"}\n"
+"set isolation = \'serializable\';\n"
+"whenever not found goto nf;\n"
+"open c;\n"
+"fetch c into c_name, c_perms, c_owner_uid, c_owner_gid, c_created_dt, c_modified_dt, c_refresh_dt, c_delete_dt,\n"
+"c_refresh_seconds, c_mime, c_exec_stmt, c_exec_params, c_exec_uname, c_content;\n"
+"if (c_modified_dt is not null\n"
+"and (c_refresh_dt is null or c_refresh_dt > now())\n"
+"and (c_delete_dt is null or c_delete_dt > now()) )\n"
+"{\n"
+"\n"
+"type := c_mime;\n"
+"close c;\n"
+"goto content_ready;\n"
+"}\n"
+"if (c_delete_dt is not null and c_delete_dt <= now())\n"
+"{\n"
+"\n"
+"delete from WS.WS.DYNA_RES where current of c;\n"
+"return -1;\n"
+"}\n"
+"update WS.WS.DYNA_RES set DR_MODIFIED_DT = null where current of c;\n"
+"set_user_id (c_exec_uname, 1);\n"
+"stat := \'00000\';\n"
+"\n"
+"exec (c_exec_stmt, stat, msg, c_exec_params, 1, mdta, rset);\n"
+"if (stat <> \'00000\')\n"
+"{\n"
+"update WS.WS.DYNA_RES set DR_MODIFIED_DT = c_modified_dt where current of c;\n"
+"commit work;\n"
+"signal (stat, msg);\n"
+"}\n"
+"c_content := rset[0][0];\n"
+"update WS.WS.DYNA_RES set DR_MODIFIED_DT = now(), DR_REFRESH_DT = dateadd (\'second\', c_refresh_seconds, now()),\n"
+"DR_LAST_LENGTH=length (c_content), DR_CONTENT=c_content\n"
+"where current of c;\n"
+"commit work;\n"
+"type := c_mime;\n"
+"close c;\n"
+"\n"
+"content_ready:\n"
 "if ((content_mode = 0) or (content_mode = 2))\n"
-"content := s3Content;\n"
+"content := c_content;\n"
 "else if (content_mode = 1)\n"
-"http (s3Content, content);\n"
+"http (c_content, content);\n"
 "else if (content_mode = 3)\n"
-"http (s3Content);\n"
-"\n"
+"http (c_content);\n"
 "return 0;\n"
+"\n"
+"nf:\n"
+"return -1;\n"
 "}\n"
-"--src DET_S3.sql:884\n";
+"--src DET_DynaRes.sql:512\n";
 
-static const char *proc578 = 
-"create function DB.DBA.\"S3_DAV_SYMLINK\" (in detcolID any, in pathParts any, in sourceID any, in what char(1), in overwrite integer, in uid integer, in gid integer, in auth_uid integer) returns any\n"
+static const char *proc621 = 
+"#line 601 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_SYMLINK\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_S3.sql:917\n";
+"--src DET_DynaRes.sql:599\n";
 
-static const char *proc579 = 
-"create function DB.DBA.\"S3_DAV_DEREFERENCE_LIST\" (in detcolID any, inout report_array any) returns any\n"
+static const char *proc622 = 
+"#line 609 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_DEREFERENCE_LIST\" (in detcol_id any, inout report_array any) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_S3.sql:925\n";
+"--src DET_DynaRes.sql:607\n";
 
-static const char *proc580 = 
-"create function DB.DBA.\"S3_DAV_RESOLVE_PATH\" (in detcolID any, inout reference_item any, inout old_base varchar, inout new_base varchar) returns any\n"
+static const char *proc623 = 
+"#line 617 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_RESOLVE_PATH\" (in detcol_id any, inout reference_item any, inout old_base varchar, inout new_base varchar) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_S3.sql:933\n";
+"--src DET_DynaRes.sql:615\n";
 
-static const char *proc581 = 
-"create function DB.DBA.\"S3_DAV_LOCK\" (in path any, in id any, in type char(1), inout locktype varchar, inout scope varchar, in token varchar, inout owner_name varchar, inout owned_tokens varchar, in depth varchar, in timeout_sec integer, in auth_uid integer) returns any\n"
+static const char *proc624 = 
+"#line 625 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_LOCK\" (in path any, in id any, in type char(1), inout locktype varchar, inout scope varchar, in token varchar, inout owner_name varchar, inout owned_tokens varchar, in depth varchar, in timeout_sec integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_S3.sql:941\n";
+"--src DET_DynaRes.sql:623\n";
 
-static const char *proc582 = 
-"create function DB.DBA.\"S3_DAV_UNLOCK\" (in id any, in type char(1), in token varchar, in auth_uid integer)\n"
+static const char *proc625 = 
+"#line 634 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_UNLOCK\" (in id any, in type char(1), in token varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
 "return -27;\n"
 "}\n"
-"--src DET_S3.sql:949\n";
+"--src DET_DynaRes.sql:632\n";
 
-static const char *proc583 = 
-"create function DB.DBA.\"S3_DAV_IS_LOCKED\" (inout id any, inout Type char(1), in owned_tokens varchar) returns integer\n"
+static const char *proc626 = 
+"#line 643 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_IS_LOCKED\" (inout id any, inout type char(1), in owned_tokens varchar) returns integer\n"
 "{\n"
 "\n"
-"declare rc integer;\n"
-"declare orig_id any;\n"
-"declare orig_type char(1);\n"
+"return 0;\n"
+"}\n"
+"--src DET_DynaRes.sql:641\n";
+
+static const char *proc627 = 
+"#line 653 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_DAV_LIST_LOCKS\" (in id any, in type char(1), in recursive integer) returns any\n"
+"{\n"
+"\n"
+"return vector ();\n"
+"}\n"
+"--src DET_DynaRes.sql:651\n";
+
+static const char *proc628 = 
+"#line 661 \"[executable]/DET_DynaRes.sql\"\n"
+"create procedure \"DynaRes_CF_PROPNAME_TO_COLNAME\" (in prop varchar)\n"
+"{\n"
+"return NULL;\n"
+"\n"
 "\n"
 "\n"
-"orig_id := id;\n"
-"orig_type := type;\n"
 "\n"
-"ID := orig_id[1];\n"
-"Type := \'C\';\n"
-"rc := DB.DBA.DAV_IS_LOCKED_INT (id, type, owned_tokens);\n"
 "\n"
 "\n"
-"id := orig_id;\n"
-"Type := orig_type;\n"
-"if (rc <> 0)\n"
-"return rc;\n"
-"return 0;\n"
 "}\n"
-"--src DET_S3.sql:958\n";
+"--src DET_DynaRes.sql:659\n";
 
-static const char *proc584 = 
-"create function DB.DBA.\"S3_DAV_LIST_LOCKS\" (in id any, in type char(1), in recursive integer) returns any\n"
+static const char *proc629 = 
+"#line 673 \"[executable]/DET_DynaRes.sql\"\n"
+"create procedure \"DynaRes_CF_FEED_FROM_AND_WHERE\" (in detcol_id integer, in cfc_id integer, inout rfc_list_cond any, inout filter_data any, in distexpn varchar, in auth_uid integer)\n"
 "{\n"
+"declare where_clause, from_clause varchar;\n"
+"declare access varchar;\n"
+"declare ownergid, owner_uid, proppos, filter_len, filter_idx integer;\n"
 "\n"
-"return vector ();\n"
+"\"DynaRes_ACCESS_PARAMS\" (detcol_id, access, ownergid, owner_uid);\n"
+"\n"
+"from_clause := \'\n"
+"from\n"
+"WS.WS.DYNA_RES as DR\n"
+"\';\n"
+"where_clause := \'DR.DETCOL_ID = \' || cast (detcol_id as varchar);\n"
+"filter_len := length (filter_data);\n"
+"for (filter_idx := 0; filter_idx < (filter_len - 3); filter_idx := filter_idx + 4)\n"
+"{\n"
+"declare mode integer;\n"
+"declare cmp_col, cmp_val varchar;\n"
+"cmp_col := \"DynaRes_CF_PROPNAME_TO_COLNAME\" (filter_data [filter_idx]);\n"
+"cmp_val := filter_data [filter_idx + 2];\n"
+"\n"
+"if (cmp_col is null)\n"
+"{\n"
+"if (\'\' <> cmp_val)\n"
+"{\n"
+"where_clause := \'1 = 2\';\n"
+"goto where_clause_complete;\n"
+"}\n"
+"goto where_oper_complete;\n"
+"}\n"
+"if (where_clause <> \'\')\n"
+"where_clause := where_clause || \' and \';\n"
+"mode := filter_data [filter_idx + 3];\n"
+"if (mode = 0)\n"
+"where_clause := where_clause || sprintf (\'(%s = %s)\', cmp_col, WS.WS.STR_SQL_APOS (cmp_val));\n"
+"else if (mode = 4)\n"
+"where_clause := where_clause || sprintf (\'(%s is null)\', cmp_col);\n"
+"else\n"
+"where_clause := where_clause || sprintf (\'(%s between %s and %s)\', cmp_col, WS.WS.STR_SQL_APOS (cmp_val), WS.WS.STR_SQL_APOS (cmp_val || \'\\377\\377\\377\\377\'));\n"
+"where_oper_complete:\n"
+" ;\n"
+"}\n"
+"where_clause_complete:\n"
+"if (where_clause <> \'\')\n"
+"return from_clause || \' where \' || where_clause;\n"
+"return from_clause;\n"
+"}\n"
+"--src DET_DynaRes.sql:671\n";
+
+static const char *proc630 = 
+"#line 723 \"[executable]/DET_DynaRes.sql\"\n"
+"create procedure \"DynaRes_CF_LIST_PROP_DISTVALS\" (in detcol_id integer, in cfc_id integer, in rfc_spath varchar, inout rfc_list_cond any, in schema_uri varchar, inout filter_data any, inout distval_dict any, in auth_uid integer)\n"
+"{\n"
+"declare distprop, distexpn varchar;\n"
+"declare from_and_where_text, qry_text varchar;\n"
+"declare execstate, execmessage varchar;\n"
+"declare execmeta, execrows any;\n"
+"\n"
+"if (schema_uri = \'http://purl.org/rss/1.0/\')\n"
+"{\n"
+"distprop := filter_data[length (filter_data) - 2];\n"
+"distexpn := \"DynaRes_CF_PROPNAME_TO_COLNAME\" (distprop);\n"
+"if (distexpn is null)\n"
+"{\n"
+"dict_put (distval_dict, \'! empty property value !\', 1);\n"
+"return;\n"
+"}\n"
+"from_and_where_text := Blog_CF_FEED_FROM_AND_WHERE (detcol_id, cfc_id, rfc_list_cond, filter_data, distexpn, auth_uid);\n"
+"qry_text := \'select distinct \' || distexpn || from_and_where_text;\n"
+"execstate := \'00000\';\n"
+"execmessage := \'OK\';\n"
+"\n"
+"exec (qry_text,\n"
+"execstate, execmessage,\n"
+"vector (), 100000000, execmeta, execrows );\n"
+"\n"
+"if (isarray (execrows))\n"
+"foreach (any execrow in execrows) do\n"
+"{\n"
+"dict_put (distval_dict, \"CatFilter_ENCODE_CATVALUE\" (execrow[0]), 1);\n"
+"}\n"
+"return;\n"
+"}\n"
+"}\n"
+"--src DET_DynaRes.sql:721\n";
+
+static const char *proc631 = 
+"#line 758 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_CF_GET_RDF_HITS\" (in detcol_id integer, in cfc_id integer, in rfc_spath varchar, inout rfc_list_cond any, in schema_uri varchar, inout filter_data any, in detcol_path varchar, in make_diritems integer, in auth_uid integer) returns any\n"
+"{\n"
+"declare from_and_where_text, qry_text varchar;\n"
+"declare execstate, execmessage varchar;\n"
+"declare acc_len, acc_ctr integer;\n"
+"declare execmeta, acc any;\n"
+"declare access varchar;\n"
+"declare ownergid, owner_uid integer;\n"
+"\n"
+"acc := vector ();\n"
+"acc_len := 0;\n"
+"if (schema_uri = \'http://purl.org/rss/1.0/\')\n"
+"{\n"
+"\"DynaRes_ACCESS_PARAMS\" (detcol_id, access, ownergid, owner_uid);\n"
+"from_and_where_text := Blog_CF_FEED_FROM_AND_WHERE (detcol_id, cfc_id, rfc_list_cond, filter_data, \'DR.DR_NAME\', auth_uid);\n"
+"qry_text := \'select DR.DR_NAME\' || from_and_where_text;\n"
+"execstate := \'00000\';\n"
+"execmessage := \'OK\';\n"
+"\n"
+"exec (qry_text,\n"
+"execstate, execmessage,\n"
+"vector (), 100000000, execmeta, acc );\n"
+"\n"
+"acc_len := length (acc);\n"
+"acc_ctr := 0;\n"
+"while (acc_ctr < acc_len)\n"
+"{\n"
+"declare r_id integer;\n"
+"declare fullname varchar;\n"
+"declare full_id, diritm any;\n"
+"r_id := acc[acc_ctr][0];\n"
+"full_id := vector (UNAME\'DynaRes\', detcol_id, r_id, owner_uid, null, null);\n"
+"if (make_diritems = 1)\n"
+"{\n"
+"diritm := \"DynaRes_DAV_DIR_SINGLE\" (full_id, \'R\', \'(fake path)\', auth_uid);\n"
+"if (DAV_HIDE_ERROR (diritm) is not null)\n"
+"{\n"
+"diritm [0] := DAV_CONCAT_PATH (detcol_path, diritm[10]);\n"
+"acc [acc_ctr] := diritm;\n"
+"acc_ctr := acc_ctr + 1;\n"
+"}\n"
+"else\n"
+"{\n"
+"if (acc_len > 1)\n"
+"{\n"
+"acc [acc_ctr] := acc [acc_len - 1];\n"
+"acc_len := acc_len - 1;\n"
+"\n"
+"}\n"
+"}\n"
+"}\n"
+"else\n"
+"{\n"
+"acc [acc_ctr] := full_id;\n"
+"acc_ctr := acc_ctr + 1;\n"
+"}\n"
+"}\n"
+"}\n"
+"if (acc_len < length (acc))\n"
+"{\n"
+"acc := subseq (acc, 0, acc_len);\n"
+"}\n"
+"\n"
+"return acc;\n"
 "}\n"
-"--src DET_S3.sql:984\n";
+"--src DET_DynaRes.sql:756\n";
+
+static const char *proc632 = 
+"#line 825 \"[executable]/DET_DynaRes.sql\"\n"
+"create function \"DynaRes_INSERT_RESOURCE\" (in detcol_id integer, inout content any, in fname varchar := null,\n"
+"in perms varchar := null, in owner_uid integer := null, in owner_gid integer := null,\n"
+"in refresh_seconds integer := null, in ttl_seconds integer := 172800, in mime varchar := null,\n"
+"in exec_stmt varchar := null, in exec_params any := null, in exec_uname varchar := \'nobody\')\n"
+"{\n"
+"if (refresh_seconds is not null and exec_stmt is null)\n"
+"signal (\'DR001\', \'Can not refresh a resource without some statement specified to execute\');\n"
+"if ((exec_uname <> USER) and (USER <> \'dba\'))\n"
+"signal (\'DR002\', \'Only dba can set UID of other user for refreshing statement of a dynamic resource\');\n"
+"if (refresh_seconds is not null and refresh_seconds < 5)\n"
+"signal (\'DR003\', \'The refresh interfal should be not less than 5 seconds\');\n"
+"if (ttl_seconds is not null and ttl_seconds < 180)\n"
+"signal (\'DR004\', \'The time to live interfal should be not less than 180 seconds\');\n"
+"if (exec_stmt is null and content is null)\n"
+"signal (\'DR005\', \'No content and no statement to execute, so nothing to create\');\n"
+"if (not exists (select top 1 1 from WS.WS.SYS_DAV_COL where COL_ID = detcol_id and COL_DET=\'DynaRes\'))\n"
+"signal (\'DR006\', \'The DET collection ID is not valid\');\n"
+"if (fname is not null and exists (select top 1 1 from WS.WS.DYNA_RES where DR_NAME = fname and DR_DETCOL_ID = detcol_id))\n"
+"signal (\'DR007\', sprintf (\'The dynamic resource \"%.500s\" already exists\', fname));\n"
+"if (content is null)\n"
+"{\n"
+"declare stat, msg varchar;\n"
+"declare mdta, rset any;\n"
+"stat := \'00000\';\n"
+"exec (exec_stmt, stat, msg, exec_params, 1, mdta, rset);\n"
+"if (stat <> \'00000\')\n"
+"signal (stat, msg);\n"
+"content := rset[0][0];\n"
+"if (content is null)\n"
+"signal (\'DR007\', \'No content and the statement returns NULL, so nothing to create\');\n"
+"}\n"
+"insert replacing WS.WS.DYNA_RES (\n"
+"DR_RES_ID,\n"
+"DR_DETCOL_ID,\n"
+"DR_NAME,\n"
+"DR_PERMS,\n"
+"DR_OWNER_UID,\n"
+"DR_OWNER_GID,\n"
+"DR_CREATED_DT,\n"
+"DR_MODIFIED_DT,\n"
+"DR_REFRESH_DT,\n"
+"DR_DELETE_DT,\n"
+"DR_REFRESH_SECONDS,\n"
+"DR_MIME,\n"
+"DR_EXEC_STMT,\n"
+"DR_EXEC_PARAMS,\n"
+"DR_EXEC_UNAME,\n"
+"DR_LAST_LENGTH,\n"
+"DR_CONTENT)\n"
+"values (\n"
+"sequence_next (\'WS.WS.DYNA_RES_ID\'),\n"
+"detcol_id,\n"
+"coalesce (fname, sprintf (\'%.100s - untitled resource - made by %.100s\', cast (now() as varchar), USER)),\n"
+"coalesce (perms, \'110000000N\'),\n"
+"coalesce (owner_uid, http_dav_uid()),\n"
+"coalesce (owner_gid, http_nogroup_gid()),\n"
+"now(),\n"
+"now(),\n"
+"case when (refresh_seconds is null) then null else dateadd (\'second\', refresh_seconds, now()) end,\n"
+"case when (ttl_seconds is null) then null else dateadd (\'second\', ttl_seconds, now()) end,\n"
+"refresh_seconds,\n"
+"coalesce (mime, \'text/plain\'),\n"
+"exec_stmt,\n"
+"serialize (exec_params),\n"
+"exec_uname,\n"
+"length (content),\n"
+"content );\n"
+"}\n"
+"--src DET_DynaRes.sql:823\n";
 
 /* DET_Versioning.sql */
 
-static const char *tbl7 = 
+static const char *tbl8 = 
 "CREATE TABLE WS.WS.SYS_DAV_RES_VERSION (\n"
 "RV_RES_ID INTEGER NOT NULL,\n"
 "RV_ID INTEGER NOT NULL,\n"
@@ -24570,7 +26491,7 @@ static const char *tbl7 =
 ")\n"
 "alter index SYS_DAV_RES_VERSION on WS.WS.SYS_DAV_RES_VERSION partition (RV_RES_ID int)\n";
 
-static const char *tbl8 = 
+static const char *tbl9 = 
 "CREATE TABLE WS.WS.SYS_DAV_RES_DIFF (\n"
 "RD_RES_ID       INTEGER NOT NULL,\n"
 "RD_TO_ID        INTEGER NOT NULL,\n"
@@ -24583,7 +26504,7 @@ static const char *tbl8 =
 ")\n"
 "alter index SYS_DAV_RES_DIFF on WS.WS.SYS_DAV_RES_DIFF partition (RD_RES_ID int)\n";
 
-static const char *tbl9 = 
+static const char *tbl10 = 
 "CREATE TABLE WS.WS.SYS_DAV_RES_MERGE (\n"
 "RM_RES_ID INTEGER NOT NULL,\n"
 "RM_ID INTEGER NOT NULL,\n"
@@ -24593,7 +26514,7 @@ static const char *tbl9 =
 ")\n"
 "alter index SYS_DAV_RES_MERGE on WS.WS.SYS_DAV_RES_MERGE partition (RM_RES_ID int)\n";
 
-static const char *tbl10 = 
+static const char *tbl11 = 
 "CREATE TABLE WS.WS.SYS_DAV_ACTIVITY (\n"
 "ACT_ID        INTEGER NOT NULL,\n"
 "ACT_NAME      VARCHAR(256) NOT NULL,\n"
@@ -24603,7 +26524,7 @@ static const char *tbl10 =
 ")\n"
 "alter index SYS_DAV_ACTIVITY on WS.WS.SYS_DAV_ACTIVITY partition (ACT_ID int)\n";
 
-static const char *tbl11 = 
+static const char *tbl12 = 
 "CREATE TABLE WS.WS.SYS_DAV_WORKSPACE (\n"
 "WS_COL_ID  INTEGER NOT NULL,\n"
 "WS_NAME    VARCHAR(256) NOT NULL,\n"
@@ -24613,7 +26534,7 @@ static const char *tbl11 =
 ")\n"
 "alter index SYS_DAV_WORKSPACE on WS.WS.SYS_DAV_WORKSPACE partition (WS_COL_ID int)\n";
 
-static const char *tbl12 = 
+static const char *tbl13 = 
 "CREATE TABLE WS.WS.SYS_DAV_CONFOBJ (\n"
 "CONFO_ID INTEGER NOT NULL,\n"
 "CONFO_NAME VARCHAR(256) NOT NULL,\n"
@@ -24623,7 +26544,7 @@ static const char *tbl12 =
 ")\n"
 "alter index SYS_DAV_CONFOBJ on WS.WS.SYS_DAV_CONFOBJ partition (CONFO_ID int)\n";
 
-static const char *tbl13 = 
+static const char *tbl14 = 
 "CREATE TABLE WS.WS.SYS_DAV_BASELINE (\n"
 "BL_CONFO_ID INTEGER NOT NULL UNIQUE,\n"
 "BL_ID      INTEGER NOT NULL UNIQUE,\n"
@@ -24634,7 +26555,7 @@ static const char *tbl13 =
 ")\n"
 "alter index SYS_DAV_BASELINE on WS.WS.SYS_DAV_BASELINE partition (BL_CONFO_ID int)\n";
 
-static const char *tbl14 = 
+static const char *tbl15 = 
 "CREATE TABLE WS.WS.SYS_DAV_BASELINE_RES (\n"
 "BR_CONFO_ID     INTEGER NOT NULL,\n"
 "BR_BL_ID      INTEGER NOT NULL,\n"
@@ -24644,7 +26565,8 @@ static const char *tbl14 =
 ")\n"
 "alter index SYS_DAV_BASELINE_RES on WS.WS.SYS_DAV_BASELINE_RES partition (BR_RES_ID int)\n";
 
-static const char *trig39 = 
+static const char *trig41 = 
+"#line 148 \"[executable]/DET_Versioning.sql\"\n"
 "CREATE TRIGGER \"Versioning_DAV_DELETE\" BEFORE DELETE ON WS.WS.SYS_DAV_RES REFERENCING OLD AS O\n"
 "{\n"
 "\n"
@@ -24654,17 +26576,19 @@ static const char *trig39 =
 "delete from WS.WS.SYS_DAV_RES_VERSION where RV_RES_ID = O.RES_ID;\n"
 "delete from WS.WS.SYS_DAV_RES_DIFF where RD_RES_ID = O.RES_ID;\n"
 "}\n"
-"--src DET_Versioning.sql:147\n";
+"--src DET_Versioning.sql:146\n";
 
-static const char *trig40 = 
+static const char *trig42 = 
+"#line 159 \"[executable]/DET_Versioning.sql\"\n"
 "CREATE TRIGGER \"Versioning_DAV_DELETE_AFT\" AFTER DELETE ON WS.WS.SYS_DAV_RES REFERENCING OLD AS O\n"
 "{\n"
 "\n"
 "connection_set (\'Versioning REM PROP\', NULL);\n"
 "}\n"
-"--src DET_Versioning.sql:158\n";
+"--src DET_Versioning.sql:157\n";
 
-static const char *trig41 = 
+static const char *trig43 = 
+"#line 167 \"[executable]/DET_Versioning.sql\"\n"
 "CREATE TRIGGER \"Versioning_PROP_DELETE\" BEFORE DELETE ON WS.WS.SYS_DAV_PROP REFERENCING OLD AS O\n"
 "{\n"
 "declare exit handler for sqlstate \'*\' {\n"
@@ -24678,9 +26602,10 @@ static const char *trig41 =
 "if (connection_get (\'Versioning REM PROP\') is null and O.PROP_NAME in (\'DAV:checked-in\', \'DAV:checked-out\', \'DAV:version-history\', \'DAV:author\'))\n"
 "signal (\'VR004\', O.PROP_NAME || \' property belongs to Versioning control and it is read-only\');\n"
 "}\n"
-"--src DET_Versioning.sql:166\n";
+"--src DET_Versioning.sql:165\n";
 
-static const char *proc585 = 
+static const char *proc633 = 
+"#line 182 \"[executable]/DET_Versioning.sql\"\n"
 "create procedure \"Versioning_ADD_NEW_DIFF\" (in _res_id int,\n"
 "in version_id int,\n"
 "in version_prev_id int,\n"
@@ -24738,9 +26663,10 @@ static const char *proc585 =
 "( _res_id, _ver_id, 0, _props, _curr_content, \'c\');\n"
 "\n"
 "}\n"
-"--src DET_Versioning.sql:181\n";
+"--src DET_Versioning.sql:180\n";
 
-static const char *trig42 = 
+static const char *trig44 = 
+"#line 241 \"[executable]/DET_Versioning.sql\"\n"
 "CREATE TRIGGER \"Versioning_DAV_RES_INSERT\" AFTER INSERT ON WS.WS.SYS_DAV_RES ORDER 10 REFERENCING NEW AS N\n"
 "{\n"
 "declare exit handler for sqlstate \'*\' {\n"
@@ -24795,9 +26721,10 @@ static const char *trig42 =
 "\n"
 "}\n"
 "}\n"
-"--src DET_Versioning.sql:240\n";
+"--src DET_Versioning.sql:239\n";
 
-static const char *trig43 = 
+static const char *trig45 = 
+"#line 297 \"[executable]/DET_Versioning.sql\"\n"
 "CREATE TRIGGER \"Versioning_DAV_RES_UPDATE\" AFTER UPDATE ON WS.WS.SYS_DAV_RES ORDER 10 REFERENCING NEW AS N, OLD AS O\n"
 "{\n"
 "declare _diff, _diff_type varchar;\n"
@@ -24870,9 +26797,10 @@ static const char *trig43 =
 "else if (DAV_HIDE_ERROR(DAV_PROP_GET_INT (N.RES_ID, \'R\', \'DAV:checked-in\', 0)) is not null)\n"
 "signal (\'VR003\', \'Resource can not be updated when it has been checked-in\');\n"
 "}\n"
-"--src DET_Versioning.sql:296\n";
+"--src DET_Versioning.sql:295\n";
 
-static const char *proc586 = 
+static const char *proc634 = 
+"#line 371 \"[executable]/DET_Versioning.sql\"\n"
 "create function DAV_GET_VERSION_CONTENT (in res_id integer, in ver integer, inout content any, out type varchar, inout mode any)\n"
 "{\n"
 "declare ver_path any;\n"
@@ -24944,9 +26872,10 @@ static const char *proc586 =
 "report_invalid_version_number:\n"
 "return -1;\n"
 "}\n"
-"--src DET_Versioning.sql:370\n";
+"--src DET_Versioning.sql:369\n";
 
-static const char *proc587 = 
+static const char *proc635 = 
+"#line 445 \"[executable]/DET_Versioning.sql\"\n"
 "create function DAV_RES_RESTORE (in VVCfolder varchar, in file varchar, in auth varchar, in pwd varchar)\n"
 "{\n"
 "declare _attic, _base varchar;\n"
@@ -24985,9 +26914,10 @@ static const char *proc587 =
 "}\n"
 "return -1;\n"
 "}\n"
-"--src DET_Versioning.sql:444\n";
+"--src DET_Versioning.sql:443\n";
 
-static const char *proc588 = 
+static const char *proc636 = 
+"#line 489 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_AUTHENTICATE\" (in id any, in what char(1), in req varchar, in auth_uname varchar, in auth_pwd varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
@@ -24995,9 +26925,10 @@ static const char *proc588 =
 "return auth_uid;\n"
 "return -12;\n"
 "}\n"
-"--src DET_Versioning.sql:488\n";
+"--src DET_Versioning.sql:487\n";
 
-static const char *proc589 = 
+static const char *proc637 = 
+"#line 503 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_AUTHENTICATE_HTTP\" (in id any, in what char(1), in req varchar, in can_write_http integer, inout a_lines any, inout a_uname varchar, inout a_pwd varchar, inout a_uid integer, inout a_gid integer, inout _perms varchar) returns integer\n"
 "{\n"
 "declare rc integer;\n"
@@ -25043,9 +26974,10 @@ static const char *proc589 =
 "nf_col_or_res:\n"
 "return -1;\n"
 "}\n"
-"--src DET_Versioning.sql:502\n";
+"--src DET_Versioning.sql:501\n";
 
-static const char *proc590 = 
+static const char *proc638 = 
+"#line 552 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_GET_PARENT\" (in id any, in st char(1), in path varchar) returns any\n"
 "{\n"
 "\n"
@@ -25053,33 +26985,37 @@ static const char *proc590 =
 "return subseq (id, 0, length (id) - 1);\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:551\n";
+"--src DET_Versioning.sql:550\n";
 
-static const char *proc591 = 
+static const char *proc639 = 
+"#line 563 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_COL_CREATE\" (in detcol_id any, in path_parts any, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:562\n";
+"--src DET_Versioning.sql:561\n";
 
-static const char *proc592 = 
+static const char *proc640 = 
+"#line 571 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_COL_MOUNT\" (in detcol_id any, in path_parts any, in full_mount_path varchar, in mount_det varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:570\n";
+"--src DET_Versioning.sql:569\n";
 
-static const char *proc593 = 
+static const char *proc641 = 
+"#line 579 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_COL_MOUNT_HERE\" (in parent_id any, in full_mount_path varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:578\n";
+"--src DET_Versioning.sql:577\n";
 
-static const char *proc594 = 
+static const char *proc642 = 
+"#line 588 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_DELETE\" (in detcol_id any, in path_parts any, in what char(1), in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "\n"
@@ -25145,25 +27081,28 @@ static const char *proc594 =
 "}\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:587\n";
+"--src DET_Versioning.sql:586\n";
 
-static const char *proc595 = 
+static const char *proc643 = 
+"#line 659 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_RES_UPLOAD\" (in detcol_id any, in path_parts any, inout content any, in type varchar, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:658\n";
+"--src DET_Versioning.sql:657\n";
 
-static const char *proc596 = 
+static const char *proc644 = 
+"#line 669 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_PROP_REMOVE\" (in id any, in what char(0), in propname varchar, in silent integer, in auth_uid integer) returns integer\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:668\n";
+"--src DET_Versioning.sql:667\n";
 
-static const char *proc597 = 
+static const char *proc645 = 
+"#line 678 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_PROP_SET\" (in id any, in what char(0), in propname varchar, in propvalue any, in overwrite integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
@@ -25172,9 +27111,10 @@ static const char *proc597 =
 "}\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:677\n";
+"--src DET_Versioning.sql:676\n";
 
-static const char *proc598 = 
+static const char *proc646 = 
+"#line 689 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_PROP_GET\" (in id any, in what char(0), in propname varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
@@ -25227,9 +27167,10 @@ static const char *proc598 =
 "}\n"
 "return -11;\n"
 "}\n"
-"--src DET_Versioning.sql:688\n";
+"--src DET_Versioning.sql:687\n";
 
-static const char *proc599 = 
+static const char *proc647 = 
+"#line 743 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_root_version\" (in _res_id int, in _hist_col varchar)\n"
 "{\n"
 "declare ss any;\n"
@@ -25241,9 +27182,10 @@ static const char *proc599 =
 "\n"
 "return string_output_string (ss);\n"
 "}\n"
-"--src DET_Versioning.sql:742\n";
+"--src DET_Versioning.sql:741\n";
 
-static const char *proc600 = 
+static const char *proc648 = 
+"#line 756 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_version_set\" (in _res_id int, in _hist_col varchar)\n"
 "{\n"
 "declare ss any;\n"
@@ -25260,9 +27202,10 @@ static const char *proc600 =
 "http (\'</D:version-set>\',ss);\n"
 "return string_output_string (ss);\n"
 "}\n"
-"--src DET_Versioning.sql:755\n";
+"--src DET_Versioning.sql:754\n";
 
-static const char *proc601 = 
+static const char *proc649 = 
+"#line 776 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_PROP_LIST\" (in id any, in what char(0), in propmask varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
@@ -25275,9 +27218,10 @@ static const char *proc601 =
 "}\n"
 "return vector ();\n"
 "}\n"
-"--src DET_Versioning.sql:775\n";
+"--src DET_Versioning.sql:774\n";
 
-static const char *proc602 = 
+static const char *proc650 = 
+"#line 791 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_DIR_SINGLE\" (in id any, in what char(0), in path any, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
@@ -25375,23 +27319,26 @@ static const char *proc602 =
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:790\n";
+"--src DET_Versioning.sql:789\n";
 
-static const char *proc603 = 
+static const char *proc651 = 
+"#line 890 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_GET_BASE_PATH\" (in detcol_id int)\n"
 "{\n"
 "return (select PROP_VALUE from WS.WS.SYS_DAV_PROP where PROP_NAME = \'virt:Versioning-Collection\' and PROP_PARENT_ID = detcol_id and PROP_TYPE = \'C\');\n"
 "}\n"
-"--src DET_Versioning.sql:889\n";
+"--src DET_Versioning.sql:888\n";
 
-static const char *proc604 = 
+static const char *proc652 = 
+"#line 896 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_GET_ATTIC_PATH\" (in detcol_id int)\n"
 "{\n"
 "return (select PROP_VALUE from WS.WS.SYS_DAV_PROP where PROP_NAME = \'virt:Versioning-Attic\' and PROP_PARENT_ID = detcol_id and PROP_TYPE = \'C\');\n"
 "}\n"
-"--src DET_Versioning.sql:895\n";
+"--src DET_Versioning.sql:894\n";
 
-static const char *proc605 = 
+static const char *proc653 = 
+"#line 904 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_SET_LIST\" (in detcol_id int, in _res_id int, in virt_base_path varchar, inout res any)\n"
 "{\n"
 "declare max_ver int;\n"
@@ -25426,9 +27373,10 @@ static const char *proc605 =
 "}\n"
 "return max_ver;\n"
 "}\n"
-"--src DET_Versioning.sql:903\n";
+"--src DET_Versioning.sql:902\n";
 
-static const char *proc606 = 
+static const char *proc654 = 
+"#line 943 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_DIR_LIST\" (in detcol_id any, in path_parts any, in detcol_path varchar, in name_mask varchar, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "declare base_path, virt_base_path varchar;\n"
@@ -25510,17 +27458,19 @@ static const char *proc606 =
 "\n"
 "return res;\n"
 "}\n"
-"--src DET_Versioning.sql:942\n";
+"--src DET_Versioning.sql:941\n";
 
-static const char *proc607 = 
+static const char *proc655 = 
+"#line 1027 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_DIR_FILTER\" (in detcol_id any, in path_parts any, in detcol_path varchar, inout compilation any, in recursive integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return vector();\n"
 "}\n"
-"--src DET_Versioning.sql:1026\n";
+"--src DET_Versioning.sql:1025\n";
 
-static const char *proc608 = 
+static const char *proc656 = 
+"#line 1035 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_SEARCH_ID\" (in detcol_id any, in path_parts any, in what char(1)) returns any\n"
 "{\n"
 "declare base_path varchar;\n"
@@ -25577,9 +27527,10 @@ static const char *proc608 =
 "else\n"
 "return -1;\n"
 "}\n"
-"--src DET_Versioning.sql:1034\n";
+"--src DET_Versioning.sql:1033\n";
 
-static const char *proc609 = 
+static const char *proc657 = 
+"#line 1094 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_SEARCH_PATH\" (in id any, in what char(1)) returns any\n"
 "{\n"
 "\n"
@@ -25592,17 +27543,19 @@ static const char *proc609 =
 "}\n"
 "return -1;\n"
 "}\n"
-"--src DET_Versioning.sql:1093\n";
+"--src DET_Versioning.sql:1092\n";
 
-static const char *proc610 = 
+static const char *proc658 = 
+"#line 1109 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_RES_UPLOAD_COPY\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite_flags integer, in permissions varchar, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:1108\n";
+"--src DET_Versioning.sql:1107\n";
 
-static const char *proc611 = 
+static const char *proc659 = 
+"#line 1117 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_RES_UPLOAD_MOVE\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite_flags integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
@@ -25667,9 +27620,10 @@ static const char *proc611 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src DET_Versioning.sql:1116\n";
+"--src DET_Versioning.sql:1115\n";
 
-static const char *proc612 = 
+static const char *proc660 = 
+"#line 1185 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_RES_CONTENT\" (in id any, inout content any, out type varchar, in content_mode integer) returns integer\n"
 "{\n"
 "\n"
@@ -25715,65 +27669,73 @@ static const char *proc612 =
 "}\n"
 "return -1;\n"
 "}\n"
-"--src DET_Versioning.sql:1184\n";
+"--src DET_Versioning.sql:1183\n";
 
-static const char *proc613 = 
+static const char *proc661 = 
+"#line 1233 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_SYMLINK\" (in detcol_id any, in path_parts any, in source_id any, in what char(1), in overwrite integer, in uid integer, in gid integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:1232\n";
+"--src DET_Versioning.sql:1231\n";
 
-static const char *proc614 = 
+static const char *proc662 = 
+"#line 1241 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_DEREFERENCE_LIST\" (in detcol_id any, inout report_array any) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:1240\n";
+"--src DET_Versioning.sql:1239\n";
 
-static const char *proc615 = 
+static const char *proc663 = 
+"#line 1249 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_RESOLVE_PATH\" (in detcol_id any, inout reference_item any, inout old_base varchar, inout new_base varchar) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:1248\n";
+"--src DET_Versioning.sql:1247\n";
 
-static const char *proc616 = 
+static const char *proc664 = 
+"#line 1257 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_LOCK\" (in path any, in id any, in type char(1), inout locktype varchar, inout scope varchar, in token varchar, inout owner_name varchar, inout owned_tokens varchar, in depth varchar, in timeout_sec integer, in auth_uid integer) returns any\n"
 "{\n"
 "\n"
 "return -20;\n"
 "}\n"
-"--src DET_Versioning.sql:1256\n";
+"--src DET_Versioning.sql:1255\n";
 
-static const char *proc617 = 
+static const char *proc665 = 
+"#line 1266 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_UNLOCK\" (in id any, in type char(1), in token varchar, in auth_uid integer)\n"
 "{\n"
 "\n"
 "return -27;\n"
 "}\n"
-"--src DET_Versioning.sql:1265\n";
+"--src DET_Versioning.sql:1264\n";
 
-static const char *proc618 = 
+static const char *proc666 = 
+"#line 1275 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_IS_LOCKED\" (inout id any, inout type char(1), in owned_tokens varchar) returns integer\n"
 "{\n"
 "\n"
 "return 0;\n"
 "}\n"
-"--src DET_Versioning.sql:1274\n";
+"--src DET_Versioning.sql:1273\n";
 
-static const char *proc619 = 
+static const char *proc667 = 
+"#line 1285 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_DAV_LIST_LOCKS\" (in id any, in type char(1), in recursive integer) returns any\n"
 "{\n"
 "\n"
 "return vector ();\n"
 "}\n"
-"--src DET_Versioning.sql:1284\n";
+"--src DET_Versioning.sql:1283\n";
 
-static const char *proc620 = 
+static const char *proc668 = 
+"#line 1292 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_AUTO_VERSION_PROP\" (in _auto_version varchar)\n"
 "{\n"
 "if (_auto_version = \'A\')\n"
@@ -25788,9 +27750,10 @@ static const char *proc620 =
 "return null;\n"
 "return -1;\n"
 "}\n"
-"--src DET_Versioning.sql:1291\n";
+"--src DET_Versioning.sql:1290\n";
 
-static const char *proc621 = 
+static const char *proc669 = 
+"#line 1310 \"[executable]/DET_Versioning.sql\"\n"
 "create procedure DAV_SET_VERSIONING_PROPERTIES (in path varchar, in props any)\n"
 "{\n"
 "declare idx, res int;\n"
@@ -25805,9 +27768,10 @@ static const char *proc621 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src DET_Versioning.sql:1309\n";
+"--src DET_Versioning.sql:1308\n";
 
-static const char *proc622 = 
+static const char *proc670 = 
+"#line 1326 \"[executable]/DET_Versioning.sql\"\n"
 "create procedure \"Versioning_REMOVE_V_PROPERTIES\" (in _path varchar)\n"
 "{\n"
 "connection_set (\'Versioning REM PROP\', 1);\n"
@@ -25817,9 +27781,10 @@ static const char *proc622 =
 "DAV_PROP_REMOVE_INT (_PATH, \'DAV:auto-version\', null, null, 0);\n"
 "connection_set (\'Versioning REM PROP\', NULL);\n"
 "}\n"
-"--src DET_Versioning.sql:1325\n";
+"--src DET_Versioning.sql:1324\n";
 
-static const char *proc623 = 
+static const char *proc671 = 
+"#line 1338 \"[executable]/DET_Versioning.sql\"\n"
 "create function DAV_REMOVE_VERSIONING_CONTROL_INT (in _main varchar, in _auth varchar, in _pwd varchar) returns integer\n"
 "{\n"
 "declare _vvc any;\n"
@@ -25841,9 +27806,10 @@ static const char *proc623 =
 "connection_set (\'Versioning REM PROP\', NULL);\n"
 "return 1;\n"
 "}\n"
-"--src DET_Versioning.sql:1337\n";
+"--src DET_Versioning.sql:1336\n";
 
-static const char *proc624 = 
+static const char *proc672 = 
+"#line 1361 \"[executable]/DET_Versioning.sql\"\n"
 "create function \"Versioning_SETPROP\" (in _resource varchar, in _propname varchar, in _value varchar,\n"
 "in _auth varchar,\n"
 "in _pwd varchar)\n"
@@ -25856,9 +27822,10 @@ static const char *proc624 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src DET_Versioning.sql:1360\n";
+"--src DET_Versioning.sql:1359\n";
 
-static const char *proc625 = 
+static const char *proc673 = 
+"#line 1376 \"[executable]/DET_Versioning.sql\"\n"
 "create function DAV_SET_VERSIONING_CONTROL (in _main varchar, in _vvc varchar, in _auto_version varchar, in _auth varchar, in _pwd varchar)\n"
 "{\n"
 "if (_vvc is null)\n"
@@ -25918,9 +27885,10 @@ static const char *proc625 =
 "\n"
 "return res;\n"
 "}\n"
-"--src DET_Versioning.sql:1375\n";
+"--src DET_Versioning.sql:1374\n";
 
-static const char *proc626 = 
+static const char *proc674 = 
+"#line 1439 \"[executable]/DET_Versioning.sql\"\n"
 "create procedure DAV_MKWORKSPACE (in path varchar)\n"
 "{\n"
 "declare _id any;\n"
@@ -25963,16 +27931,18 @@ static const char *proc626 =
 "else\n"
 "return -11;\n"
 "}\n"
-"--src DET_Versioning.sql:1438\n";
+"--src DET_Versioning.sql:1437\n";
 
-static const char *proc627 = 
+static const char *proc675 = 
+"#line 1483 \"[executable]/DET_Versioning.sql\"\n"
 "create procedure DAV_CHECKOUT (in path varchar, in auth varchar, in pwd varchar)\n"
 "{\n"
 "return DAV_CHECKOUT_INT (path, auth, pwd);\n"
 "}\n"
-"--src DET_Versioning.sql:1482\n";
+"--src DET_Versioning.sql:1481\n";
 
-static const char *proc628 = 
+static const char *proc676 = 
+"#line 1489 \"[executable]/DET_Versioning.sql\"\n"
 "create procedure DAV_CHECKOUT_INT (in path_or_id any, in auth varchar, in pwd varchar, in extern int := 0)\n"
 "{\n"
 "declare _id int;\n"
@@ -26019,16 +27989,18 @@ static const char *proc628 =
 "connection_set (\'Versioning REM PROP\', NULL);\n"
 "return _id;\n"
 "}\n"
-"--src DET_Versioning.sql:1488\n";
+"--src DET_Versioning.sql:1487\n";
 
-static const char *proc629 = 
+static const char *proc677 = 
+"#line 1537 \"[executable]/DET_Versioning.sql\"\n"
 "create procedure DAV_CHECKIN (in path varchar, in auth varchar, in pwd varchar)\n"
 "{\n"
 "return DAV_CHECKIN_INT (path, auth, pwd);\n"
 "}\n"
-"--src DET_Versioning.sql:1536\n";
+"--src DET_Versioning.sql:1535\n";
 
-static const char *proc630 = 
+static const char *proc678 = 
+"#line 1543 \"[executable]/DET_Versioning.sql\"\n"
 "create procedure DAV_CHECKIN_INT (in path varchar, in auth varchar, in pwd varchar, in extern int:=1)\n"
 "{\n"
 "\n"
@@ -26122,9 +28094,10 @@ static const char *proc630 =
 "\n"
 "return -1;\n"
 "}\n"
-"--src DET_Versioning.sql:1542\n";
+"--src DET_Versioning.sql:1541\n";
 
-static const char *proc631 = 
+static const char *proc679 = 
+"#line 1638 \"[executable]/DET_Versioning.sql\"\n"
 "create procedure \"Versioning_CHECKOUT_INT\" (\n"
 "in _id int,\n"
 "in _content any,\n"
@@ -26147,9 +28120,10 @@ static const char *proc631 =
 "return _res;\n"
 "return _id;\n"
 "}\n"
-"--src DET_Versioning.sql:1637\n";
+"--src DET_Versioning.sql:1636\n";
 
-static const char *trig44 = 
+static const char *trig46 = 
+"#line 1662 \"[executable]/DET_Versioning.sql\"\n"
 "CREATE TRIGGER \"Versioning_UNLOCK\" BEFORE DELETE ON WS.WS.SYS_DAV_LOCK REFERENCING OLD AS O\n"
 "{\n"
 "declare exit handler for sqlstate \'*\' {\n"
@@ -26169,9 +28143,10 @@ static const char *trig44 =
 "_rc := DAV_CHECKIN_INT ( DAV_SEARCH_PATH (O.LOCK_PARENT_ID, \'R\'), null, null, 0 );\n"
 "\n"
 "}\n"
-"--src DET_Versioning.sql:1661\n";
+"--src DET_Versioning.sql:1660\n";
 
-static const char *proc632 = 
+static const char *proc680 = 
+"#line 1685 \"[executable]/DET_Versioning.sql\"\n"
 "create function DAV_VERSION_CONTROL (in path varchar, in auth varchar, in pwd varchar)\n"
 "{\n"
 "\n"
@@ -26264,9 +28239,10 @@ static const char *proc632 =
 "\n"
 "return _id;\n"
 "}\n"
-"--src DET_Versioning.sql:1684\n";
+"--src DET_Versioning.sql:1683\n";
 
-static const char *proc633 = 
+static const char *proc681 = 
+"#line 1780 \"[executable]/DET_Versioning.sql\"\n"
 "create function DAV_UNCHECKOUT (in path varchar, in auth varchar, in pwd varchar)\n"
 "{\n"
 "\n"
@@ -26338,9 +28314,10 @@ static const char *proc633 =
 "\n"
 "return -1;\n"
 "}\n"
-"--src DET_Versioning.sql:1779\n";
+"--src DET_Versioning.sql:1778\n";
 
-static const char *proc634 = 
+static const char *proc682 = 
+"#line 1854 \"[executable]/DET_Versioning.sql\"\n"
 "create procedure \"Versioning_Attic\" (in _resource varchar)\n"
 "{\n"
 "declare _col int;\n"
@@ -26356,17 +28333,19 @@ static const char *proc634 =
 "return NULL;\n"
 "return DAV_HIDE_ERROR (DAV_PROP_GET_INT (_hist_col, \'C\', \'virt:Versioning-Attic\', 0));\n"
 "}\n"
-"--src DET_Versioning.sql:1853\n";
+"--src DET_Versioning.sql:1852\n";
 
-static const char *proc635 = 
+static const char *proc683 = 
+"#line 1871 \"[executable]/DET_Versioning.sql\"\n"
 "create procedure \"Versioning_OTHER_FILES_IN_VVC\" (in _res varchar)\n"
 "{\n"
 "\n"
 "return 1;\n"
 "}\n"
-"--src DET_Versioning.sql:1870\n";
+"--src DET_Versioning.sql:1869\n";
 
-static const char *proc636 = 
+static const char *proc684 = 
+"#line 1879 \"[executable]/DET_Versioning.sql\"\n"
 " create procedure DAV_REMOVE_VERSION_CONTROL (in _resource varchar, in auth varchar, in pwd varchar, in tokens any := 1)\n"
 "{\n"
 "declare _err int;\n"
@@ -26419,9 +28398,10 @@ static const char *proc636 =
 "return -37;\n"
 "}\n"
 "}\n"
-"--src DET_Versioning.sql:1878\n";
+"--src DET_Versioning.sql:1877\n";
 
-static const char *proc637 = 
+static const char *proc685 = 
+"#line 1935 \"[executable]/DET_Versioning.sql\"\n"
 " create procedure DAV_VERSION_FOLD_INT (in path varchar, in target_version int, in auth varchar)\n"
 "{\n"
 "if (target_version <= 0)\n"
@@ -26484,9 +28464,10 @@ static const char *proc637 =
 "return id;\n"
 "}\n"
 "}\n"
-"--src DET_Versioning.sql:1934\n";
+"--src DET_Versioning.sql:1933\n";
 
-static const char *trig45 = 
+static const char *trig47 = 
+"#line 1999 \"[executable]/DET_Versioning.sql\"\n"
 "CREATE TRIGGER \"Versioning_DELETE_COL_B\" BEFORE DELETE ON WS.WS.SYS_DAV_COL ORDER 50 REFERENCING OLD AS O\n"
 "{\n"
 "\n"
@@ -26512,11 +28493,12 @@ static const char *trig45 =
 "DAV_DELETE_INT (_attic, 0, null, null, 0);\n"
 "}\n"
 "}\n"
-"--src DET_Versioning.sql:1998\n";
+"--src DET_Versioning.sql:1997\n";
 
 /* xml_view.sql */
 
-static const char *proc638 = 
+static const char *proc686 = 
+"#line 32 \"[executable]/xml_view.sql\"\n"
 "create procedure XML_VIEW_PUBLISH\n"
 "(\n"
 "in view_name varchar,\n"
@@ -26736,9 +28718,10 @@ static const char *proc638 =
 "where RES_COL = _col_id and RES_NAME = _r_name;\n"
 "}\n"
 "}\n"
-"--src xml_view.sql:31\n";
+"--src xml_view.sql:30\n";
 
-static const char *proc639 = 
+static const char *proc687 = 
+"#line 253 \"[executable]/xml_view.sql\"\n"
 "create procedure XML_VIEW_DROP (in view_name varchar)\n"
 "{\n"
 "declare _p_name varchar;\n"
@@ -26772,7 +28755,7 @@ static const char *proc639 =
 "xmls_viewremove (view_name);\n"
 "xmls_viewremove (concat (_procprefix, name_part (view_name, 2)));\n"
 "}\n"
-"--src xml_view.sql:252\n";
+"--src xml_view.sql:251\n";
 
 static const char * xslt_define = "xslt_sheet (?, xtree_doc (?, 128, ?, 'LATIN-1', 'x-any', 'BuildStandalone=ENABLE'))";
 static query_t *xslt_define_qr;
@@ -26965,234 +28948,239 @@ sqls_define_dav (void)
   DEFINE_PUBLIC_PROC ("DAV_REQ_CHARS_TO_BITMASK", proc107); 
   DEFINE_PUBLIC_PROC ("DAV_AUTHENTICATE", proc108);
   DEFINE_PROC ("DAV_AUTHENTICATE_HTTP", proc109);
-  DEFINE_PROC ("DAV_AUTHENTICATE_SSL_CONDITION", proc110);
-  DEFINE_PROC ("DAV_AUTHENTICATE_SSL", proc111); 
-  DEFINE_PUBLIC_PROC ("DAV_COL_CREATE", proc112);
-  DEFINE_PROC ("DAV_COL_CREATE_INT", proc113);
-  DEFINE_PROC ("DB.DBA.IS_REDIRECT_REF", proc114); 
-  DEFINE_PUBLIC_PROC ("DAV_RES_UPLOAD", proc115); 
-  DEFINE_PUBLIC_PROC ("DAV_RES_UPLOAD_STRSES", proc116);
-  DEFINE_PROC ("DAV_RES_UPLOAD_STRSES_INT", proc117);
-  DEFINE_PROC ("RDF_SINK_UPLOAD", proc118);
-  DEFINE_PROC ("RDF_SINK_DELETE", proc119); 
-  DEFINE_PUBLIC_PROC ("DAV_DELETE", proc120);
-  DEFINE_PROC ("DAV_DELETE_INT", proc121);
-  DEFINE_PROC ("DAV_TAG_LIST", proc122);
-  DEFINE_PROC ("DAV_TAG_SET", proc123); 
-  DEFINE_PUBLIC_PROC ("DAV_COPY", proc124);
-  DEFINE_PROC ("DAV_COPY_INT", proc125);
-  DEFINE_PROC ("DAV_COPY_SUBTREE", proc126); 
-  DEFINE_PUBLIC_PROC ("DAV_MOVE", proc127);
-  DEFINE_PROC ("DAV_MOVE_INT", proc128);
-  DEFINE_PROC ("DAV_GET_OWNER", proc129);
-  DEFINE_PROC ("DAV_PREPARE_PROP_WRITE", proc130); 
-  DEFINE_PUBLIC_PROC ("DAV_PROP_SET", proc131);
-  DEFINE_PROC ("DAV_PROP_SET_INT", proc132);
-  DEFINE_PROC ("DAV_PROP_SET_RAW", proc133); 
-  DEFINE_PUBLIC_PROC ("DAV_PROP_REMOVE", proc134);
-  DEFINE_PROC ("DAV_PROP_REMOVE_INT", proc135);
-  DEFINE_PROC ("DAV_PROP_REMOVE_RAW", proc136); 
-  DEFINE_PUBLIC_PROC ("DAV_PROP_GET", proc137);
-  DEFINE_PROC ("DAV_PROP_GET_INT", proc138); 
-  DEFINE_PUBLIC_PROC ("DAV_PROP_LIST", proc139);
-  DEFINE_PROC ("DAV_PROP_LIST_INT", proc140);
-  DEFINE_PROC ("DAV_MAKE_DIR", proc141);
-  DEFINE_PROC ("DAV_CHECK_PERM", proc142); 
-  DEFINE_PUBLIC_PROC ("DAV_CHECK_USER", proc143); 
-  DEFINE_PUBLIC_PROC ("DAV_RES_CONTENT", proc144); 
-  DEFINE_PUBLIC_PROC ("DAV_RES_CONTENT_STRSES", proc145);
-  DEFINE_PROC ("DAV_RES_CONTENT_INT", proc146);
-  DEFINE_PROC ("DAV_COL_IS_ANCESTOR_OF", proc147);
-  DEFINE_PROC ("DAV_COL_PATH_BOUNDARY", proc148);
+  DEFINE_PROC ("DAV_AUTHENTICATE_SSL_ITEM", proc110);
+  DEFINE_PROC ("DAV_AUTHENTICATE_SSL_CONDITION", proc111);
+  DEFINE_PROC ("DAV_AUTHENTICATE_SSL_WEBID", proc112);
+  DEFINE_PROC ("DAV_AUTHENTICATE_SSL", proc113); 
+  DEFINE_PUBLIC_PROC ("DAV_COL_CREATE", proc114);
+  DEFINE_PROC ("DAV_COL_CREATE_INT", proc115);
+  DEFINE_PROC ("DB.DBA.IS_REDIRECT_REF", proc116); 
+  DEFINE_PUBLIC_PROC ("DAV_RES_UPLOAD", proc117); 
+  DEFINE_PUBLIC_PROC ("DAV_RES_UPLOAD_STRSES", proc118);
+  DEFINE_PROC ("DAV_RES_UPLOAD_STRSES_INT", proc119);
+  DEFINE_PROC ("DAV_RES_UPLOAD_STRSES_INT_INNER", proc120);
+  DEFINE_PROC ("RDF_SINK_UPLOAD", proc121);
+  DEFINE_PROC ("RDF_SINK_DELETE", proc122); 
+  DEFINE_PUBLIC_PROC ("DAV_DELETE", proc123);
+  DEFINE_PROC ("DAV_DELETE_INT", proc124);
+  DEFINE_PROC ("DAV_TAG_LIST", proc125);
+  DEFINE_PROC ("DAV_TAG_SET", proc126); 
+  DEFINE_PUBLIC_PROC ("DAV_COPY", proc127);
+  DEFINE_PROC ("DAV_COPY_INT", proc128);
+  DEFINE_PROC ("DAV_COPY_SUBTREE", proc129); 
+  DEFINE_PUBLIC_PROC ("DAV_MOVE", proc130);
+  DEFINE_PROC ("DAV_MOVE_INT", proc131);
+  DEFINE_PROC ("DAV_GET_OWNER", proc132);
+  DEFINE_PROC ("DAV_PREPARE_PROP_WRITE", proc133); 
+  DEFINE_PUBLIC_PROC ("DAV_PROP_SET", proc134);
+  DEFINE_PROC ("DAV_PROP_SET_INT", proc135);
+  DEFINE_PROC ("DAV_PROP_SET_RAW", proc136);
+  DEFINE_PROC ("DAV_PROP_SET_RAW_INNER", proc137); 
+  DEFINE_PUBLIC_PROC ("DAV_PROP_REMOVE", proc138);
+  DEFINE_PROC ("DAV_PROP_REMOVE_INT", proc139);
+  DEFINE_PROC ("DAV_PROP_REMOVE_RAW", proc140); 
+  DEFINE_PUBLIC_PROC ("DAV_PROP_GET", proc141);
+  DEFINE_PROC ("DAV_PROP_GET_INT", proc142); 
+  DEFINE_PUBLIC_PROC ("DAV_PROP_LIST", proc143);
+  DEFINE_PROC ("DAV_PROP_LIST_INT", proc144);
+  DEFINE_PROC ("DAV_MAKE_DIR", proc145);
+  DEFINE_PROC ("DAV_CHECK_PERM", proc146); 
+  DEFINE_PUBLIC_PROC ("DAV_CHECK_USER", proc147); 
+  DEFINE_PUBLIC_PROC ("DAV_RES_CONTENT", proc148); 
+  DEFINE_PUBLIC_PROC ("DAV_RES_CONTENT_STRSES", proc149);
+  DEFINE_PROC ("DAV_RES_CONTENT_INT", proc150);
+  DEFINE_PROC ("DAV_COL_IS_ANCESTOR_OF", proc151);
+  DEFINE_PROC ("DAV_COL_PATH_BOUNDARY", proc152);
   ddl_std_proc (trig7, 0x0);
   ddl_std_proc (trig8, 0x0);
   ddl_std_proc (trig9, 0x0);
   ddl_std_proc (trig10, 0x0);
   ddl_std_proc (trig11, 0x0);
-  DEFINE_PROC ("WS.WS.WAC_INSERT", proc149);
-  DEFINE_PROC ("WS.WS.WAC_DELETE", proc150);
   ddl_std_proc (trig12, 0x0);
-  DEFINE_PROC ("WS.WS.ACL_CONTAINS_GRANTEE_AND_FLAG", proc151);
   ddl_std_proc (trig13, 0x0);
+  DEFINE_PROC ("WS.WS.WAC_INSERT", proc153);
+  DEFINE_PROC ("WS.WS.WAC_DELETE", proc154);
+  DEFINE_PROC ("WS.WS.DAV_IRI", proc155);
   ddl_std_proc (trig14, 0x0);
+  DEFINE_PROC ("WS.WS.ACL_CONTAINS_GRANTEE_AND_FLAG", proc156);
   ddl_std_proc (trig15, 0x0);
   ddl_std_proc (trig16, 0x0);
   ddl_std_proc (trig17, 0x0);
-  DEFINE_PROC ("WS.WS.ACL_UPDATE", proc152);
-  DEFINE_PROC ("WS.WS.ACL_MAKE_INHERITED", proc153);
-  DEFINE_PROC ("WS.WS.ACL_DBG", proc154);
-  DEFINE_PROC ("WS.WS.ACL_SERIALIZE_INT", proc155);
-  DEFINE_PROC ("WS.WS.ACL_DESERIALIZE_INT", proc156);
-  DEFINE_PROC ("WS.WS.ACL_GET_ACLLENGTH", proc157);
-  DEFINE_PROC ("WS.WS.ACL_GET_ACESIZE", proc158);
-  DEFINE_PROC ("WS.WS.ACL_CREATE", proc159);
-  DEFINE_PROC ("WS.WS.ACL_IS_VALID", proc160);
-  DEFINE_PROC ("WS.WS.ACL_ADD_ENTRY", proc161);
-  DEFINE_PROC ("WS.WS.ACL_REMOVE_ENTRY", proc162);
-  DEFINE_PROC ("WS.WS.ACL_IS_GRANTED", proc163);
-  DEFINE_PROC ("WS.WS.ACL_SET_OWNER", proc164);
-  DEFINE_PROC ("WS.WS.ACL_OWNER", proc165);
-  DEFINE_PROC ("WS.WS.ACL_PARSE", proc166);
-  DEFINE_PROC ("WS.WS.ACL_COMPOSE", proc167);
-  DEFINE_PROC ("DAV_CAST_STRING_TO_INTEGER", proc168);
-  DEFINE_PROC ("DAV_CAST_STRING_TO_DATETIME", proc169);
-  DEFINE_PROC ("DAV_CAST_TEXT_TO_VARCHAR", proc170);
-  DEFINE_PROC ("DAV_CAST_TEXT_TO_INTEGER", proc171);
-  DEFINE_PROC ("DAV_CAST_TEXT_TO_DATETIME", proc172);
-  DEFINE_PROC ("DAV_FC_CONST_AS_SQL", proc173);
-  DEFINE_PROC ("DAV_FC_PRED_METAS", proc174);
-  DEFINE_PROC ("DAV_FC_CMP_METAS", proc175);
-  DEFINE_PROC ("DAV_FC_TABLE_METAS", proc176);
-  DEFINE_PROC ("DAV_FC_PRINT_COMPARISON", proc177);
-  DEFINE_PROC ("DAV_FC_PRINT_WHERE", proc178);
-  DEFINE_PROC ("DAV_FC_PRINT_WHERE_INT", proc179);
-  DEFINE_PROC ("DAV_REGISTER_RDF_SCHEMA", proc180); 
-  DEFINE_PUBLIC_PROC ("DAV_RDF_SCHEMA_N3_LIST_PROPERTIES", proc181);
-  DEFINE_PROC ("DAV_CROP_URI_TO_CATNAME", proc182); 
-  DEFINE_PUBLIC_PROC ("DAV_GET_RDF_SCHEMA_N3", proc183);
-  DEFINE_PROC ("DAV_DEPRECATE_RDF_SCHEMA", proc184);
-  DEFINE_PROC ("DAV_REGISTER_MIME_TYPE", proc185);
-  DEFINE_PROC ("DAV_REGISTER_MIME_RDF", proc186);
-  DEFINE_PROC ("DAV_DEPRECATE_MIME_RDF", proc187); 
-  DEFINE_PUBLIC_PROC ("DAV_RDF_PROP_SET", proc188); 
-  DEFINE_PUBLIC_PROC ("DAV_RDF_PROP_GET", proc189);
-  DEFINE_PROC ("DAV_RDF_PREPROCESS_RDFXML_SUB", proc190);
-  DEFINE_PROC ("DAV_RDF_PREPROCESS_RDFXML", proc191);
-  DEFINE_PROC ("DAV_RDF_PROP_SET_INT", proc192);
-  DEFINE_PROC ("DAV_RDF_PROP_GET_INT", proc193);
-  DEFINE_PROC ("DAV_RDF_MERGE", proc194);
-  DEFINE_PROC ("DAV_RDF_SUBTRACT", proc195);
   ddl_std_proc (trig18, 0x0);
   ddl_std_proc (trig19, 0x0);
+  DEFINE_PROC ("WS.WS.ACL_UPDATE", proc157);
+  DEFINE_PROC ("WS.WS.ACL_MAKE_INHERITED", proc158);
+  DEFINE_PROC ("WS.WS.ACL_DBG", proc159);
+  DEFINE_PROC ("WS.WS.ACL_SERIALIZE_INT", proc160);
+  DEFINE_PROC ("WS.WS.ACL_DESERIALIZE_INT", proc161);
+  DEFINE_PROC ("WS.WS.ACL_GET_ACLLENGTH", proc162);
+  DEFINE_PROC ("WS.WS.ACL_GET_ACESIZE", proc163);
+  DEFINE_PROC ("WS.WS.ACL_CREATE", proc164);
+  DEFINE_PROC ("WS.WS.ACL_IS_VALID", proc165);
+  DEFINE_PROC ("WS.WS.ACL_ADD_ENTRY", proc166);
+  DEFINE_PROC ("WS.WS.ACL_REMOVE_ENTRY", proc167);
+  DEFINE_PROC ("WS.WS.ACL_IS_GRANTED", proc168);
+  DEFINE_PROC ("WS.WS.ACL_SET_OWNER", proc169);
+  DEFINE_PROC ("WS.WS.ACL_OWNER", proc170);
+  DEFINE_PROC ("WS.WS.ACL_PARSE", proc171);
+  DEFINE_PROC ("WS.WS.ACL_COMPOSE", proc172);
+  DEFINE_PROC ("DAV_CAST_STRING_TO_INTEGER", proc173);
+  DEFINE_PROC ("DAV_CAST_STRING_TO_DATETIME", proc174);
+  DEFINE_PROC ("DAV_CAST_TEXT_TO_VARCHAR", proc175);
+  DEFINE_PROC ("DAV_CAST_TEXT_TO_INTEGER", proc176);
+  DEFINE_PROC ("DAV_CAST_TEXT_TO_DATETIME", proc177);
+  DEFINE_PROC ("DAV_FC_CONST_AS_SQL", proc178);
+  DEFINE_PROC ("DAV_FC_PRED_METAS", proc179);
+  DEFINE_PROC ("DAV_FC_CMP_METAS", proc180);
+  DEFINE_PROC ("DAV_FC_TABLE_METAS", proc181);
+  DEFINE_PROC ("DAV_FC_PRINT_COMPARISON", proc182);
+  DEFINE_PROC ("DAV_FC_PRINT_WHERE", proc183);
+  DEFINE_PROC ("DAV_FC_PRINT_WHERE_INT", proc184);
+  DEFINE_PROC ("DAV_REGISTER_RDF_SCHEMA", proc185); 
+  DEFINE_PUBLIC_PROC ("DAV_RDF_SCHEMA_N3_LIST_PROPERTIES", proc186);
+  DEFINE_PROC ("DAV_CROP_URI_TO_CATNAME", proc187); 
+  DEFINE_PUBLIC_PROC ("DAV_GET_RDF_SCHEMA_N3", proc188);
+  DEFINE_PROC ("DAV_DEPRECATE_RDF_SCHEMA", proc189);
+  DEFINE_PROC ("DAV_REGISTER_MIME_TYPE", proc190);
+  DEFINE_PROC ("DAV_REGISTER_MIME_RDF", proc191);
+  DEFINE_PROC ("DAV_DEPRECATE_MIME_RDF", proc192); 
+  DEFINE_PUBLIC_PROC ("DAV_RDF_PROP_SET", proc193); 
+  DEFINE_PUBLIC_PROC ("DAV_RDF_PROP_GET", proc194);
+  DEFINE_PROC ("DAV_RDF_PREPROCESS_RDFXML_SUB", proc195);
+  DEFINE_PROC ("DAV_RDF_PREPROCESS_RDFXML", proc196);
+  DEFINE_PROC ("DAV_RDF_PROP_SET_INT", proc197);
+  DEFINE_PROC ("DAV_RDF_PROP_GET_INT", proc198);
+  DEFINE_PROC ("DAV_RDF_MERGE", proc199);
+  DEFINE_PROC ("DAV_RDF_SUBTRACT", proc200);
   ddl_std_proc (trig20, 0x0);
-  DEFINE_PROC ("DAV_EXTRACT_AND_SAVE_RDF", proc196);
-  DEFINE_PROC ("DAV_GET_RES_TYPE_URI_BY_MIME_TYPE", proc197);
-  DEFINE_PROC ("DAV_EXTRACT_AND_SAVE_RDF_INT", proc198);
-  DEFINE_PROC ("DAV_HOME_DIR_UPDATE", proc199);
+  ddl_std_proc (trig21, 0x0);
+  ddl_std_proc (trig22, 0x0);
+  DEFINE_PROC ("DAV_EXTRACT_AND_SAVE_RDF", proc201);
+  DEFINE_PROC ("DAV_GET_RES_TYPE_URI_BY_MIME_TYPE", proc202);
+  DEFINE_PROC ("DAV_EXTRACT_AND_SAVE_RDF_INT", proc203);
+  DEFINE_PROC ("DAV_HOME_DIR_UPDATE", proc204);
 
   /* dav_meta.sql */
 
-  DEFINE_PROC ("DAV_GUESS_MIME_TYPE_BY_NAME", proc200);
-  DEFINE_PROC ("DAV_GUESS_MIME_TYPE", proc201);
-  DEFINE_PROC ("file_space_fmt", proc202);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/x-openlink-license", proc203);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_opendocument", proc204);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.text", proc205);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.database", proc206);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.graphics", proc207);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.presentation", proc208);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.spreadsheet", proc209);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.chart", proc210);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.formula", proc211);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.image", proc212);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/x-openlink-image", proc213);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/x-openlink-photo", proc214);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/audio", proc215);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_audio/mpeg", proc216);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_audio/x-flac", proc217);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_audio/x-mp3", proc218);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_audio/x-m4a", proc219);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_audio/x-m4p", proc220);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/ogg", proc221);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msoffice+xml", proc222);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msexcel", proc223);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msaccess", proc224);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msproject", proc225);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/mspowerpoint", proc226);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msword", proc227);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/pdf", proc228);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/xbrl+xml", proc229);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/doap+rdf", proc230);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/xddl+xml", proc231);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/archive", proc232);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/tar", proc233);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/taz", proc234);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/gz", proc235);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msi", proc236);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/dmg", proc237);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/arj", proc238);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/bz", proc239);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/bz2", proc240);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/tgz", proc241);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/rar", proc242);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/zip", proc243);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/cab", proc244);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/lzh", proc245);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/ace", proc246);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/iso", proc247);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msword+xml", proc248);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msexcel+xml", proc249);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msproject+xml", proc250);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msvisio+xml", proc251);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/rss+xml", proc252);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/atom+xml", proc253);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_text/eml", proc254);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/xbel+xml", proc255);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/rdf+xml", proc256);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_text/rdf+ttl", proc257);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_text/rdf+n3", proc258);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/foaf+xml", proc259);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/mods+xml", proc260);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/opml+xml", proc261);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/ocs+xml", proc262);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_text/html", proc263);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/x-openlinksw-vsp", proc264);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/x-openlinksw-vspx+xml", proc265);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/bpel+xml", proc266);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/annotea+xml", proc267);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/google-kinds+xml", proc268);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/wsdl+xml", proc269);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/google-base+xml", proc270);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_application/x-openlinksw-vad", proc271);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_text/wiki", proc272);
-  DEFINE_PROC ("IMC_TO_XML", proc273);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_text/directory", proc274);
-  DEFINE_PROC ("DAV_EXTRACT_RDF_BY_METAS", proc275);
-  DEFINE_PROC ("DB.DBA.UNIX_DATETIME_PARSER", proc276);
+  DEFINE_PROC ("DAV_GUESS_MIME_TYPE_BY_NAME", proc205);
+  DEFINE_PROC ("DAV_GUESS_MIME_TYPE", proc206);
+  DEFINE_PROC ("file_space_fmt", proc207);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/x-openlink-license", proc208);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_opendocument", proc209);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.text", proc210);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.database", proc211);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.graphics", proc212);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.presentation", proc213);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.spreadsheet", proc214);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.chart", proc215);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.formula", proc216);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/vnd.oasis.opendocument.image", proc217);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/x-openlink-image", proc218);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/x-openlink-photo", proc219);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/audio", proc220);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_audio/mpeg", proc221);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_audio/x-flac", proc222);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_audio/x-mp3", proc223);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_audio/x-m4a", proc224);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_audio/x-m4p", proc225);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/ogg", proc226);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msoffice+xml", proc227);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msexcel", proc228);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msaccess", proc229);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msproject", proc230);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/mspowerpoint", proc231);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msword", proc232);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/pdf", proc233);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/xbrl+xml", proc234);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/doap+rdf", proc235);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/xddl+xml", proc236);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/archive", proc237);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/tar", proc238);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/taz", proc239);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/gz", proc240);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msi", proc241);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/dmg", proc242);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/arj", proc243);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/bz", proc244);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/bz2", proc245);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/tgz", proc246);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/rar", proc247);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/zip", proc248);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/cab", proc249);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/lzh", proc250);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/ace", proc251);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/iso", proc252);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msword+xml", proc253);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msexcel+xml", proc254);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msproject+xml", proc255);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/msvisio+xml", proc256);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/rss+xml", proc257);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/atom+xml", proc258);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_text/eml", proc259);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/xbel+xml", proc260);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/rdf+xml", proc261);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_text/rdf+ttl", proc262);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_text/rdf+n3", proc263);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/foaf+xml", proc264);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/mods+xml", proc265);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/opml+xml", proc266);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/ocs+xml", proc267);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_text/html", proc268);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/x-openlinksw-vsp", proc269);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/x-openlinksw-vspx+xml", proc270);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/bpel+xml", proc271);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/annotea+xml", proc272);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/google-kinds+xml", proc273);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/wsdl+xml", proc274);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/google-base+xml", proc275);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_application/x-openlinksw-vad", proc276);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_text/wiki", proc277);
+  DEFINE_PROC ("IMC_TO_XML", proc278);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_text/directory", proc279);
+  DEFINE_PROC ("DAV_EXTRACT_RDF_BY_METAS", proc280);
+  DEFINE_PROC ("DB.DBA.UNIX_DATETIME_PARSER", proc281);
   ddl_ensure_table ("do this always", other1);
   ddl_ensure_table ("do this always", other2);
-  DEFINE_PROC ("DB.DBA.UNIX_DATE_PARSER", proc277);
+  DEFINE_PROC ("DB.DBA.UNIX_DATE_PARSER", proc282);
   ddl_ensure_table ("do this always", other3);
   ddl_ensure_table ("do this always", other4);
-  DEFINE_PROC ("DB.DBA.BPEL_SPLIT_LIST", proc278);
+  DEFINE_PROC ("DB.DBA.BPEL_SPLIT_LIST", proc283);
   ddl_ensure_table ("do this always", other5);
   ddl_ensure_table ("do this always", other6);
-  DEFINE_PROC ("DAV_EXTRACT_SPOTLIGHT", proc279);
-  DEFINE_PROC ("DAV_CONVERT_SPOTLIGHT_TO_VIRTUOSO", proc280);
-  DEFINE_PROC ("DAV_SPOTLIGHT_ADD", proc281); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.XML_UNIX_DATE_TO_ISO", proc282);
+  DEFINE_PROC ("DAV_EXTRACT_SPOTLIGHT", proc284);
+  DEFINE_PROC ("DAV_CONVERT_SPOTLIGHT_TO_VIRTUOSO", proc285);
+  DEFINE_PROC ("DAV_SPOTLIGHT_ADD", proc286); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.XML_UNIX_DATE_TO_ISO", proc287);
   ddl_ensure_table ("do this always", other7);
   ddl_ensure_table ("do this always", other8);
-  DEFINE_PROC ("DAV_EXTRACT_META_AS_RDF_XML", proc283);
+  DEFINE_PROC ("DAV_EXTRACT_META_AS_RDF_XML", proc288);
 
   /* dav_acct.sql */
 
-  DEFINE_PROC ("DAV_SPACE_QUOTA_PARENT", proc284);
-  DEFINE_PROC ("DAV_ADD_SPACE_QUOTA", proc285);
-  DEFINE_PROC ("DAV_DEL_SPACE_QUOTA", proc286);
-  DEFINE_PROC ("DAV_SPACE_QUOTA_YELLOW_TRACK", proc287);
-  DEFINE_PROC ("DAV_SPACE_QUOTA_SIGNAL", proc288);
-  DEFINE_PROC ("DAV_OWNER_DISABLED_SIGNAL", proc289);
-  DEFINE_PROC ("DAV_HOME_DISABLED_SIGNAL", proc290);
-  DEFINE_PROC ("DAV_SPACE_QUOTA_RES_INSERT", proc291);
-  DEFINE_PROC ("DAV_SPACE_QUOTA_RES_DELETE", proc292);
-  DEFINE_PROC ("DAV_SPACE_QUOTA_RES_UPDATE", proc293);
+  DEFINE_PROC ("DAV_SPACE_QUOTA_PARENT", proc289);
+  DEFINE_PROC ("DAV_ADD_SPACE_QUOTA", proc290);
+  DEFINE_PROC ("DAV_DEL_SPACE_QUOTA", proc291);
+  DEFINE_PROC ("DAV_SPACE_QUOTA_YELLOW_TRACK", proc292);
+  DEFINE_PROC ("DAV_SPACE_QUOTA_SIGNAL", proc293);
+  DEFINE_PROC ("DAV_OWNER_DISABLED_SIGNAL", proc294);
+  DEFINE_PROC ("DAV_HOME_DISABLED_SIGNAL", proc295);
+  DEFINE_PROC ("DAV_SPACE_QUOTA_RES_INSERT", proc296);
+  DEFINE_PROC ("DAV_SPACE_QUOTA_RES_DELETE", proc297);
+  DEFINE_PROC ("DAV_SPACE_QUOTA_RES_UPDATE", proc298);
 
   /* dav_rdf_quad.sql */
 
-  DEFINE_PROC ("DB.DBA.RDF_DELETE_ENTIRE_GRAPH", proc294);
-  DEFINE_PROC ("DB.DBA.DAV_FULL_PATH_TO_IRI", proc295);
-  DEFINE_PROC ("DB.DBA.DAV_AUTO_REPLICATE_TO_RDF_QUAD", proc296);
-  DEFINE_PROC ("DB.DBA.DAV_REPLICATE_ALL_TO_RDF_QUAD", proc297);
-  DEFINE_PROC ("DB.DBA.RDF_CBD_DELETE", proc298);
-  DEFINE_PROC ("DB.DBA.DAV_RDF_URI_RESOLVE", proc299);
-  DEFINE_PROC ("DB.DBA.DAV_RDF_REPLICATE_INT", proc300);
-  DEFINE_PROC ("DB.DBA.DAV_RDF_CBD_DELETE_PROP", proc301);
-  DEFINE_PROC ("DB.DBA.DAV_MAKE_USER_IRI", proc302);
-  DEFINE_PROC ("DB.DBA.DAV_REPLICATE_RES_TO_RDF_QUAD", proc303);
-  DEFINE_PROC ("DB.DBA.DAV_REPLICATE_COL_TO_RDF_QUAD", proc304);
-  ddl_std_proc (trig21, 0x0);
-  ddl_std_proc (trig22, 0x0);
+  DEFINE_PROC ("DB.DBA.RDF_DELETE_ENTIRE_GRAPH", proc299);
+  DEFINE_PROC ("DB.DBA.DAV_FULL_PATH_TO_IRI", proc300);
+  DEFINE_PROC ("DB.DBA.DAV_AUTO_REPLICATE_TO_RDF_QUAD", proc301);
+  DEFINE_PROC ("DB.DBA.DAV_REPLICATE_ALL_TO_RDF_QUAD", proc302);
+  DEFINE_PROC ("DB.DBA.RDF_CBD_DELETE", proc303);
+  DEFINE_PROC ("DB.DBA.DAV_RDF_URI_RESOLVE", proc304);
+  DEFINE_PROC ("DB.DBA.DAV_RDF_REPLICATE_INT", proc305);
+  DEFINE_PROC ("DB.DBA.DAV_RDF_CBD_DELETE_PROP", proc306);
+  DEFINE_PROC ("DB.DBA.DAV_MAKE_USER_IRI", proc307);
+  DEFINE_PROC ("DB.DBA.DAV_REPLICATE_RES_TO_RDF_QUAD", proc308);
+  DEFINE_PROC ("DB.DBA.DAV_REPLICATE_COL_TO_RDF_QUAD", proc309);
   ddl_std_proc (trig23, 0x0);
   ddl_std_proc (trig24, 0x0);
   ddl_std_proc (trig25, 0x0);
@@ -27201,50 +29189,59 @@ sqls_define_dav (void)
   ddl_std_proc (trig28, 0x0);
   ddl_std_proc (trig29, 0x0);
   ddl_std_proc (trig30, 0x0);
-  DEFINE_PROC ("DB.DBA.DAV_RDF_PROPAGATE_COL_PATH_CHANGE", proc305);
   ddl_std_proc (trig31, 0x0);
   ddl_std_proc (trig32, 0x0);
+  DEFINE_PROC ("DB.DBA.DAV_RDF_PROPAGATE_COL_PATH_CHANGE", proc310);
+  ddl_std_proc (trig33, 0x0);
+  ddl_std_proc (trig34, 0x0);
 
   /* vfs.sql */
   bootstrap_cli->cli_qualifier = box_string ("WS");
 
-  DEFINE_PROC ("WS.WS.COPY_PAGE", proc306);
-  DEFINE_PROC ("WS.WS.VFS_HTTP_RESP_CODE", proc307);
-  DEFINE_PROC ("WS.WS.VFS_ENSURE_NEW_SITE", proc308);
-  DEFINE_PROC ("WS.WS.COPY_PAGE_1", proc309);
-  DEFINE_PROC ("WS.WS.DELETE_LOCAL_COPY", proc310);
-  DEFINE_PROC ("WS.WS.SERV_QUEUE_TOP", proc311);
-  DEFINE_PROC ("WS.WS.SERV_QUEUE", proc312);
-  DEFINE_PROC ("ERR_MAIL_SEND", proc313);
-  DEFINE_PROC ("WS.WS.LOCAL_STORE", proc314);
-  DEFINE_PROC ("WS.WS.GET_URLS", proc315);
-  DEFINE_PROC ("WS.WS.MAKE_URL", proc316);
-  DEFINE_PROC ("WS.WS.SPLIT_URL", proc317);
-  DEFINE_PROC ("WS.WS.EXPAND_URL_OLD", proc318);
-  DEFINE_PROC ("WS.WS.MKPATH", proc319);
-  DEFINE_PROC ("WS.WS.FOLLOW", proc320);
-  DEFINE_PROC ("WS.WS.REPLACE_HREF", proc321);
-  DEFINE_PROC ("WS.WS.FIND_URI", proc322);
-  DEFINE_PROC ("WS.WS.LFS_EXP", proc323);
-  DEFINE_PROC ("WS.WS.FIND_KEYWORD", proc324);
-  DEFINE_PROC ("WS.WS.GET_HREF_IN_ARRAY", proc325);
-  DEFINE_PROC ("WS.WS.DAV_EXP", proc326);
-  DEFINE_PROC ("WS.WS.DAV_HEAD", proc327);
-  DEFINE_PROC ("WS.WS.DAV_MKCOL", proc328);
-  DEFINE_PROC ("WS.WS.DAV_PUT", proc329);
-  DEFINE_PROC ("WS.WS.DAV_PROP", proc330);
-  DEFINE_PROC ("WS.WS.GET_HREF_FROM_XML", proc331);
-  DEFINE_PROC ("WS.WS.ISEMPTY", proc332);
-  DEFINE_PROC ("WS.WS.URL_BY_DATE", proc333);
-  DEFINE_PROC ("WS.WS.VFS_MAKE_ENTRY", proc334);
-  DEFINE_PROC ("WS.WS.VFS_GO", proc335);
-  DEFINE_PROC ("WS.WS.VFS_URI_COMPOSE", proc336);
-  DEFINE_PROC ("WS.WS.VFS_EXTRACT_RDF", proc337);
-  DEFINE_PROC ("WS.WS.SITEMAP_ENSURE_NEW_SITE", proc338);
-  DEFINE_PROC ("WS.WS.SITEMAP_URLS_REGISTER", proc339);
-  DEFINE_PROC ("WS.WS.SITEMAP_GET_LOC", proc340);
-  DEFINE_PROC ("WS.WS.SITEMAP_XML_PARSE", proc341);
-  DEFINE_PROC ("WS.WS.SITEMAP_RDF_STORE", proc342);
+  DEFINE_PROC ("WS.WS.COPY_PAGE", proc311);
+  DEFINE_PROC ("WS.WS.VFS_HTTP_RESP_CODE", proc312);
+  DEFINE_PROC ("WS.WS.VFS_ENSURE_NEW_SITE", proc313);
+  DEFINE_PROC ("WS.WS.COPY_PAGE_1", proc314);
+  DEFINE_PROC ("WS.WS.DELETE_LOCAL_COPY", proc315);
+  DEFINE_PROC ("WS.WS.VFS_RUN", proc316);
+  DEFINE_PROC ("WS.WS.VFS_STATUS_GET", proc317);
+  DEFINE_PROC ("WS.WS.VFS_STATUS_SET", proc318);
+  DEFINE_PROC ("WS.WS.SERV_QUEUE_TOP", proc319);
+  DEFINE_PROC ("WS.WS.SERV_QUEUE", proc320);
+  DEFINE_PROC ("ERR_MAIL_SEND", proc321);
+  DEFINE_PROC ("WS.WS.LOCAL_STORE", proc322);
+  DEFINE_PROC ("WS.WS.GET_URLS", proc323);
+  DEFINE_PROC ("WS.WS.SITEMAP_PROCESS", proc324);
+  DEFINE_PROC ("WS.WS.MAKE_URL", proc325);
+  DEFINE_PROC ("WS.WS.SPLIT_URL", proc326);
+  DEFINE_PROC ("WS.WS.EXPAND_URL_OLD", proc327);
+  DEFINE_PROC ("WS.WS.MKPATH", proc328);
+  DEFINE_PROC ("WS.WS.FOLLOW", proc329);
+  DEFINE_PROC ("WS.WS.REPLACE_HREF", proc330);
+  DEFINE_PROC ("WS.WS.FIND_URI", proc331);
+  DEFINE_PROC ("WS.WS.LFS_EXP", proc332);
+  DEFINE_PROC ("WS.WS.FIND_KEYWORD", proc333);
+  DEFINE_PROC ("WS.WS.GET_HREF_IN_ARRAY", proc334);
+  DEFINE_PROC ("WS.WS.DAV_EXP", proc335);
+  DEFINE_PROC ("WS.WS.DAV_HEAD", proc336);
+  DEFINE_PROC ("WS.WS.DAV_MKCOL", proc337);
+  DEFINE_PROC ("WS.WS.DAV_PUT", proc338);
+  DEFINE_PROC ("WS.WS.DAV_PROP", proc339);
+  DEFINE_PROC ("WS.WS.GET_HREF_FROM_XML", proc340);
+  DEFINE_PROC ("WS.WS.ISEMPTY", proc341);
+  DEFINE_PROC ("WS.WS.URL_BY_DATE", proc342);
+  DEFINE_PROC ("WS.WS.VFS_RECOVER_QUEUE_STAT", proc343);
+  DEFINE_PROC ("WS.WS.VFS_MAKE_ENTRY", proc344);
+  DEFINE_PROC ("WS.WS.VFS_GO", proc345);
+  DEFINE_PROC ("WS.WS.VFS_URI_COMPOSE", proc346);
+  DEFINE_PROC ("WS.WS.VFS_EXTRACT_RDF", proc347);
+  DEFINE_PROC ("WS.WS.SITEMAP_ENSURE_NEW_SITE", proc348);
+  DEFINE_PROC ("WS.WS.SITEMAP_URLS_REGISTER", proc349);
+  DEFINE_PROC ("WS.WS.SITEMAP_GET_LOC", proc350);
+  DEFINE_PROC ("WS.WS.SITEMAP_XML_PARSE", proc351);
+  DEFINE_PROC ("WS.WS.SITEMAP_RDF_STORE", proc352);
+  DEFINE_PROC ("VFS_ROBOTS_PARSE", proc353);
+  DEFINE_PROC ("VFS_ROBOTS_GET", proc354);
 
   dk_free_box (bootstrap_cli->cli_qualifier);
   bootstrap_cli->cli_qualifier =  saved_qualifier;
@@ -27268,68 +29265,68 @@ sqls_define_dav (void)
   /* uriqa.sql */
 
   ddl_ensure_table ("WS.WS.URIQA_HANDLER", tbl0);
-  DEFINE_PROC ("WS.WS.URIQA_CFG_ITEM_VALUE", proc343);
-  DEFINE_PROC ("WS.WS.URIQA_LOAD_FROM_INI", proc344);
+  DEFINE_PROC ("WS.WS.URIQA_CFG_ITEM_VALUE", proc355);
+  DEFINE_PROC ("WS.WS.URIQA_LOAD_FROM_INI", proc356);
   ddl_ensure_table ("do this always", other9);
-  DEFINE_PROC ("WS.WS.URIQA_FULL_URI", proc345);
-  DEFINE_PROC ("WS.WS.URIQA_APPLY_TRIGGERS", proc346);
-  DEFINE_PROC ("WS.WS.URIQA_N3_DIR_LIST", proc347);
-  DEFINE_PROC ("DB.DBA.DAV_EXTRACT_DYN_RDF_application/xbel+xml", proc348);
-  DEFINE_PROC ("WS.WS.URIQA_HANDLER_LOCALDAV", proc349);
-  DEFINE_PROC ("WS.WS.URIQA_HANDLER_NATIVE_HTTP", proc350);
-  DEFINE_PROC ("WS.WS.URIQA_STATUS", proc351);
-  DEFINE_PROC ("WS.WS.MPUT", proc352);
-  DEFINE_PROC ("WS.WS.MGET", proc353);
-  DEFINE_PROC ("WS.WS.MDELETE", proc354);
-  DEFINE_PROC ("WS.WS./!URIQA/", proc355);
-  DEFINE_PROC ("WS.WS.URIQA_VHOST_RESET", proc356);
+  DEFINE_PROC ("WS.WS.URIQA_FULL_URI", proc357);
+  DEFINE_PROC ("WS.WS.URIQA_APPLY_TRIGGERS", proc358);
+  DEFINE_PROC ("WS.WS.URIQA_N3_DIR_LIST", proc359);
+  DEFINE_PROC ("DB.DBA.DAV_EXTRACT_DYN_RDF_application/xbel+xml", proc360);
+  DEFINE_PROC ("WS.WS.URIQA_HANDLER_LOCALDAV", proc361);
+  DEFINE_PROC ("WS.WS.URIQA_HANDLER_NATIVE_HTTP", proc362);
+  DEFINE_PROC ("WS.WS.URIQA_STATUS", proc363);
+  DEFINE_PROC ("WS.WS.MPUT", proc364);
+  DEFINE_PROC ("WS.WS.MGET", proc365);
+  DEFINE_PROC ("WS.WS.MDELETE", proc366);
+  DEFINE_PROC ("WS.WS./!URIQA/", proc367);
+  DEFINE_PROC ("WS.WS.URIQA_VHOST_RESET", proc368);
 
   /* DET_CatFilter.sql */
 
-  DEFINE_PROC ("CatFilter_DAV_AUTHENTICATE", proc357);
-  DEFINE_PROC ("CatFilter_GET_CONDITION", proc358);
-  DEFINE_PROC ("CatFilter_ENCODE_CATVALUE", proc359);
-  DEFINE_PROC ("CatFilter_DECODE_CATVALUE", proc360);
-  DEFINE_PROC ("CatFilter_PATH_PARTS_TO_FILTER", proc361);
-  DEFINE_PROC ("CatFilter_ACC_FILTER_DATA", proc362);
-  DEFINE_PROC ("CatFilter_DAV_SEARCH_ID_IMPL", proc363);
-  DEFINE_PROC ("CatFilter_DAV_AUTHENTICATE_HTTP", proc364);
-  DEFINE_PROC ("CatFilter_DAV_GET_PARENT", proc365);
-  DEFINE_PROC ("CatFilter_DAV_COL_CREATE", proc366);
-  DEFINE_PROC ("CatFilter_DAV_COL_MOUNT", proc367);
-  DEFINE_PROC ("CatFilter_DAV_COL_MOUNT_HERE", proc368);
-  DEFINE_PROC ("CatFilter_DAV_DELETE", proc369);
-  DEFINE_PROC ("CatFilter_FILTER_TO_CONDITION", proc370);
-  DEFINE_PROC ("CatFilter_DAV_RES_UPLOAD", proc371);
-  DEFINE_PROC ("CatFilter_DAV_PROP_REMOVE", proc372);
-  DEFINE_PROC ("CatFilter_DAV_PROP_SET", proc373);
-  DEFINE_PROC ("CatFilter_DAV_PROP_GET", proc374);
-  DEFINE_PROC ("CatFilter_DAV_PROP_LIST", proc375);
-  DEFINE_PROC ("CatFilter_DAV_DIR_SINGLE", proc376);
-  DEFINE_PROC ("CatFilter_LIST_SCHEMAS", proc377);
-  DEFINE_PROC ("CatFilter_LIST_SCHEMA_PROPS", proc378);
-  DEFINE_PROC ("CatFilter_GET_RDF_INVERSE_HITS_DISTVALS", proc379);
-  DEFINE_PROC ("CatFilter_GET_RDF_INVERSE_HITS_RES_IDS", proc380);
-  DEFINE_PROC ("CatFilter_LIST_PROP_DISTVALS_AUX", proc381);
-  DEFINE_PROC ("CatFilter_LIST_PROP_DISTVALS", proc382);
-  DEFINE_PROC ("CatFilter_DAV_DIR_LIST", proc383);
-  DEFINE_PROC ("CatFilter_DAV_DIR_FILTER", proc384);
-  DEFINE_PROC ("CatFilter_DAV_SEARCH_ID", proc385);
-  DEFINE_PROC ("CatFilter_DAV_SEARCH_PATH", proc386);
-  DEFINE_PROC ("CatFilter_DAV_RES_UPLOAD_COPY", proc387);
-  DEFINE_PROC ("CatFilter_DAV_RES_UPLOAD_MOVE", proc388);
-  DEFINE_PROC ("CatFilter_DAV_RES_CONTENT", proc389);
-  DEFINE_PROC ("CatFilter_DAV_SYMLINK", proc390);
-  DEFINE_PROC ("CatFilter_DAV_LOCK", proc391);
-  DEFINE_PROC ("CatFilter_DAV_UNLOCK", proc392);
-  DEFINE_PROC ("CatFilter_DAV_IS_LOCKED", proc393);
-  DEFINE_PROC ("CatFilter_DAV_LIST_LOCKS", proc394);
-  DEFINE_PROC ("CatFilter_CONFIGURE", proc395);
-  DEFINE_PROC ("CatFilter_FEED_DAV_RDF_INVERSE", proc396);
-  ddl_std_proc (trig33, 0x0);
-  ddl_std_proc (trig34, 0x0);
+  DEFINE_PROC ("CatFilter_DAV_AUTHENTICATE", proc369);
+  DEFINE_PROC ("CatFilter_GET_CONDITION", proc370);
+  DEFINE_PROC ("CatFilter_ENCODE_CATVALUE", proc371);
+  DEFINE_PROC ("CatFilter_DECODE_CATVALUE", proc372);
+  DEFINE_PROC ("CatFilter_PATH_PARTS_TO_FILTER", proc373);
+  DEFINE_PROC ("CatFilter_ACC_FILTER_DATA", proc374);
+  DEFINE_PROC ("CatFilter_DAV_SEARCH_ID_IMPL", proc375);
+  DEFINE_PROC ("CatFilter_DAV_AUTHENTICATE_HTTP", proc376);
+  DEFINE_PROC ("CatFilter_DAV_GET_PARENT", proc377);
+  DEFINE_PROC ("CatFilter_DAV_COL_CREATE", proc378);
+  DEFINE_PROC ("CatFilter_DAV_COL_MOUNT", proc379);
+  DEFINE_PROC ("CatFilter_DAV_COL_MOUNT_HERE", proc380);
+  DEFINE_PROC ("CatFilter_DAV_DELETE", proc381);
+  DEFINE_PROC ("CatFilter_FILTER_TO_CONDITION", proc382);
+  DEFINE_PROC ("CatFilter_DAV_RES_UPLOAD", proc383);
+  DEFINE_PROC ("CatFilter_DAV_PROP_REMOVE", proc384);
+  DEFINE_PROC ("CatFilter_DAV_PROP_SET", proc385);
+  DEFINE_PROC ("CatFilter_DAV_PROP_GET", proc386);
+  DEFINE_PROC ("CatFilter_DAV_PROP_LIST", proc387);
+  DEFINE_PROC ("CatFilter_DAV_DIR_SINGLE", proc388);
+  DEFINE_PROC ("CatFilter_LIST_SCHEMAS", proc389);
+  DEFINE_PROC ("CatFilter_LIST_SCHEMA_PROPS", proc390);
+  DEFINE_PROC ("CatFilter_GET_RDF_INVERSE_HITS_DISTVALS", proc391);
+  DEFINE_PROC ("CatFilter_GET_RDF_INVERSE_HITS_RES_IDS", proc392);
+  DEFINE_PROC ("CatFilter_LIST_PROP_DISTVALS_AUX", proc393);
+  DEFINE_PROC ("CatFilter_LIST_PROP_DISTVALS", proc394);
+  DEFINE_PROC ("CatFilter_DAV_DIR_LIST", proc395);
+  DEFINE_PROC ("CatFilter_DAV_DIR_FILTER", proc396);
+  DEFINE_PROC ("CatFilter_DAV_SEARCH_ID", proc397);
+  DEFINE_PROC ("CatFilter_DAV_SEARCH_PATH", proc398);
+  DEFINE_PROC ("CatFilter_DAV_RES_UPLOAD_COPY", proc399);
+  DEFINE_PROC ("CatFilter_DAV_RES_UPLOAD_MOVE", proc400);
+  DEFINE_PROC ("CatFilter_DAV_RES_CONTENT", proc401);
+  DEFINE_PROC ("CatFilter_DAV_SYMLINK", proc402);
+  DEFINE_PROC ("CatFilter_DAV_LOCK", proc403);
+  DEFINE_PROC ("CatFilter_DAV_UNLOCK", proc404);
+  DEFINE_PROC ("CatFilter_DAV_IS_LOCKED", proc405);
+  DEFINE_PROC ("CatFilter_DAV_LIST_LOCKS", proc406);
+  DEFINE_PROC ("CatFilter_CONFIGURE", proc407);
+  DEFINE_PROC ("CatFilter_FEED_DAV_RDF_INVERSE", proc408);
   ddl_std_proc (trig35, 0x0);
-  DEFINE_PROC ("CatFilter_INIT_SYS_DAV_RDF_INVERSE", proc397);
+  ddl_std_proc (trig36, 0x0);
+  ddl_std_proc (trig37, 0x0);
+  DEFINE_PROC ("CatFilter_INIT_SYS_DAV_RDF_INVERSE", proc409);
 
   /* DET_HostFs.sql */
 
@@ -27341,289 +29338,329 @@ sqls_define_dav (void)
   ddl_ensure_table ("WS.WS.HOSTFS_RES_META", tbl4);
   ddl_ensure_column ("WS.WS.HOSTFS_RES_META", "RESM_TOPCOL_ID", alter2, 0);
   ddl_ensure_table ("WS.WS.HOSTFS_RDF_INVERSE", tbl5);
-  DEFINE_PROC ("WS.WS.HOSTFS_FEED_RDF_INVERSE", proc398);
-  ddl_std_proc (trig36, 0x0);
-  ddl_std_proc (trig37, 0x0);
+  DEFINE_PROC ("WS.WS.HOSTFS_FEED_RDF_INVERSE", proc410);
   ddl_std_proc (trig38, 0x0);
+  ddl_std_proc (trig39, 0x0);
+  ddl_std_proc (trig40, 0x0);
   ddl_ensure_table ("do this always", other10);
   ddl_ensure_table ("do this always", other11);
-  DEFINE_PROC ("WS.WS.HOSTFS_RES_TOPCOL_ID", proc399);
-  DEFINE_PROC ("WS.WS.HOSTFS_EXTRACT_AND_SAVE_RDF", proc400);
-  DEFINE_PROC ("WS.WS.HOSTFS_TEST_RDF", proc401);
-  DEFINE_PROC ("WS.WS.HOSTFS_RES_CACHE_RESC_DATA_INDEX_HOOK", proc402);
-  DEFINE_PROC ("WS.WS.HOSTFS_RES_CACHE_RESC_DATA_UNINDEX_HOOK", proc403);
+  DEFINE_PROC ("WS.WS.HOSTFS_RES_TOPCOL_ID", proc411);
+  DEFINE_PROC ("WS.WS.HOSTFS_EXTRACT_AND_SAVE_RDF", proc412);
+  DEFINE_PROC ("WS.WS.HOSTFS_TEST_RDF", proc413);
+  DEFINE_PROC ("WS.WS.HOSTFS_RES_CACHE_RESC_DATA_INDEX_HOOK", proc414);
+  DEFINE_PROC ("WS.WS.HOSTFS_RES_CACHE_RESC_DATA_UNINDEX_HOOK", proc415);
   ddl_ensure_table ("do this always", other12);
   ddl_ensure_table ("do this always", other13);
-  DEFINE_PROC ("WS.WS.HOSTFS_FIND_COL", proc404);
-  DEFINE_PROC ("WS.WS.HOSTFS_COL_DISAPPEARS", proc405);
-  DEFINE_PROC ("WS.WS.HOSTFS_HANDLE_RES_SCAN", proc406);
-  DEFINE_PROC ("WS.WS.HOSTFS_RES_DISAPPEARS", proc407);
-  DEFINE_PROC ("WS.WS.HOSTFS_TOUCH_RES", proc408);
-  DEFINE_PROC ("WS.WS.HOSTFS_GLOBAL_RESET", proc409);
-  DEFINE_PROC ("WS.WS.HOSTFS_PATH_STAT", proc410);
-  DEFINE_PROC ("WS.WS.HOSTFS_READ_TYPEINFO", proc411);
-  DEFINE_PROC ("HostFs_DAV_AUTHENTICATE", proc412);
-  DEFINE_PROC ("HostFs_DAV_AUTHENTICATE_HTTP", proc413);
-  DEFINE_PROC ("HostFs_DAV_GET_PARENT", proc414);
-  DEFINE_PROC ("HostFs_DAV_COL_CREATE", proc415);
-  DEFINE_PROC ("HostFs_DAV_COL_MOUNT", proc416);
-  DEFINE_PROC ("HostFs_DAV_COL_MOUNT_HERE", proc417);
-  DEFINE_PROC ("HostFs_DAV_DELETE", proc418);
+  DEFINE_PROC ("WS.WS.HOSTFS_FIND_COL", proc416);
+  DEFINE_PROC ("WS.WS.HOSTFS_COL_DISAPPEARS", proc417);
+  DEFINE_PROC ("WS.WS.HOSTFS_HANDLE_RES_SCAN", proc418);
+  DEFINE_PROC ("WS.WS.HOSTFS_RES_DISAPPEARS", proc419);
+  DEFINE_PROC ("WS.WS.HOSTFS_TOUCH_RES", proc420);
+  DEFINE_PROC ("WS.WS.HOSTFS_GLOBAL_RESET", proc421);
+  DEFINE_PROC ("WS.WS.HOSTFS_PATH_STAT", proc422);
+  DEFINE_PROC ("WS.WS.HOSTFS_READ_TYPEINFO", proc423);
+  DEFINE_PROC ("HostFs_DAV_AUTHENTICATE", proc424);
+  DEFINE_PROC ("HostFs_DAV_AUTHENTICATE_HTTP", proc425);
+  DEFINE_PROC ("HostFs_DAV_GET_PARENT", proc426);
+  DEFINE_PROC ("HostFs_DAV_COL_CREATE", proc427);
+  DEFINE_PROC ("HostFs_DAV_COL_MOUNT", proc428);
+  DEFINE_PROC ("HostFs_DAV_COL_MOUNT_HERE", proc429);
+  DEFINE_PROC ("HostFs_DAV_DELETE", proc430);
   ddl_ensure_table ("DB.DBA.HostFs_DAV_RES_UPLOAD", tbl6);
-  DEFINE_PROC ("HostFs_DAV_RES_UPLOAD", proc419);
-  DEFINE_PROC ("HostFs_DAV_PROP_REMOVE", proc420);
-  DEFINE_PROC ("HostFs_DAV_PROP_SET", proc421);
-  DEFINE_PROC ("HostFs_DAV_PROP_GET", proc422);
-  DEFINE_PROC ("HostFs_DAV_PROP_LIST", proc423);
-  DEFINE_PROC ("HostFs_ID_TO_OSPATH", proc424);
-  DEFINE_PROC ("HostFs_DAV_DIR_SINGLE", proc425);
-  DEFINE_PROC ("HostFs_DAV_DIR_LIST", proc426);
-  DEFINE_PROC ("HostFs_DAV_DIR_FILTER", proc427);
-  DEFINE_PROC ("HostFs_DAV_SEARCH_ID", proc428);
-  DEFINE_PROC ("HostFs_DAV_SEARCH_PATH", proc429);
-  DEFINE_PROC ("HostFs_DAV_RES_UPLOAD_COPY", proc430);
-  DEFINE_PROC ("HostFs_DAV_RES_UPLOAD_MOVE", proc431);
-  DEFINE_PROC ("HostFs_DAV_RES_CONTENT", proc432);
-  DEFINE_PROC ("HostFs_DAV_SYMLINK", proc433);
-  DEFINE_PROC ("HostFs_DAV_LOCK", proc434);
-  DEFINE_PROC ("HostFs_DAV_UNLOCK", proc435);
-  DEFINE_PROC ("HostFs_DAV_IS_LOCKED", proc436);
-  DEFINE_PROC ("HostFs_DAV_LIST_LOCKS", proc437);
-  DEFINE_PROC ("HostFs_CF_LIST_PROP_DISTVALS", proc438);
-  DEFINE_PROC ("HostFs_CF_GET_RDF_HITS", proc439);
-  DEFINE_PROC ("HostFs_RF_ID2SUFFIX", proc440);
-  DEFINE_PROC ("HostFile_RF_SUFFIX2ID", proc441);
-  DEFINE_PROC ("HostDir_RF_SUFFIX2ID", proc442);
+  DEFINE_PROC ("HostFs_DAV_RES_UPLOAD", proc431);
+  DEFINE_PROC ("HostFs_DAV_PROP_REMOVE", proc432);
+  DEFINE_PROC ("HostFs_DAV_PROP_SET", proc433);
+  DEFINE_PROC ("HostFs_DAV_PROP_GET", proc434);
+  DEFINE_PROC ("HostFs_DAV_PROP_LIST", proc435);
+  DEFINE_PROC ("HostFs_ID_TO_OSPATH", proc436);
+  DEFINE_PROC ("HostFs_DAV_DIR_SINGLE", proc437);
+  DEFINE_PROC ("HostFs_DAV_DIR_LIST", proc438);
+  DEFINE_PROC ("HostFs_DAV_DIR_FILTER", proc439);
+  DEFINE_PROC ("HostFs_DAV_SEARCH_ID", proc440);
+  DEFINE_PROC ("HostFs_DAV_SEARCH_PATH", proc441);
+  DEFINE_PROC ("HostFs_DAV_RES_UPLOAD_COPY", proc442);
+  DEFINE_PROC ("HostFs_DAV_RES_UPLOAD_MOVE", proc443);
+  DEFINE_PROC ("HostFs_DAV_RES_CONTENT", proc444);
+  DEFINE_PROC ("HostFs_DAV_SYMLINK", proc445);
+  DEFINE_PROC ("HostFs_DAV_LOCK", proc446);
+  DEFINE_PROC ("HostFs_DAV_UNLOCK", proc447);
+  DEFINE_PROC ("HostFs_DAV_IS_LOCKED", proc448);
+  DEFINE_PROC ("HostFs_DAV_LIST_LOCKS", proc449);
+  DEFINE_PROC ("HostFs_CF_LIST_PROP_DISTVALS", proc450);
+  DEFINE_PROC ("HostFs_CF_GET_RDF_HITS", proc451);
+  DEFINE_PROC ("HostFs_RF_ID2SUFFIX", proc452);
+  DEFINE_PROC ("HostFile_RF_SUFFIX2ID", proc453);
+  DEFINE_PROC ("HostDir_RF_SUFFIX2ID", proc454);
 
   /* DET_ResFilter.sql */
 
-  DEFINE_PROC ("ResFilter_DAV_AUTHENTICATE", proc443);
-  DEFINE_PROC ("ResFilter_NORM", proc444);
-  DEFINE_PROC ("ResFilter_ENCODE_FILTER", proc445);
-  DEFINE_PROC ("ResFilter_DECODE_FILTER", proc446);
-  DEFINE_PROC ("ResFilter_GET_CONDITION", proc447);
-  DEFINE_PROC ("ResFilter_FIT_INTO_CONDITION", proc448);
-  DEFINE_PROC ("ResFilter_MAKE_DEL_ACTION_FROM_CONDITION", proc449);
-  DEFINE_PROC ("ResFilter_LEAVE_CONDITION", proc450);
-  DEFINE_PROC ("ResFilter_FNMERGE", proc451);
-  DEFINE_PROC ("ResFilter_FNSPLIT", proc452);
-  DEFINE_PROC ("ResFilter_DAV_SEARCH_ID_IMPL", proc453);
-  DEFINE_PROC ("ResFilter_DAV_AUTHENTICATE_HTTP", proc454);
-  DEFINE_PROC ("ResFilter_DAV_GET_PARENT", proc455);
-  DEFINE_PROC ("ResFilter_DAV_COL_CREATE", proc456);
-  DEFINE_PROC ("ResFilter_DAV_COL_MOUNT", proc457);
-  DEFINE_PROC ("ResFilter_DAV_COL_MOUNT_HERE", proc458);
-  DEFINE_PROC ("ResFilter_DAV_DELETE", proc459);
-  DEFINE_PROC ("ResFilter_DAV_RES_UPLOAD", proc460);
-  DEFINE_PROC ("ResFilter_DAV_PROP_REMOVE", proc461);
-  DEFINE_PROC ("ResFilter_DAV_PROP_SET", proc462);
-  DEFINE_PROC ("ResFilter_DAV_PROP_GET", proc463);
-  DEFINE_PROC ("ResFilter_DAV_PROP_LIST", proc464);
-  DEFINE_PROC ("ResFilter_DAV_DIR_SINGLE", proc465);
-  DEFINE_PROC ("ResFilter_DAV_DIR_LIST", proc466);
-  DEFINE_PROC ("ResFilter_DAV_DIR_FILTER", proc467);
-  DEFINE_PROC ("ResFilter_DAV_SEARCH_ID", proc468);
-  DEFINE_PROC ("ResFilter_DAV_SEARCH_PATH", proc469);
-  DEFINE_PROC ("ResFilter_DAV_RES_UPLOAD_COPY", proc470);
-  DEFINE_PROC ("ResFilter_DAV_RES_UPLOAD_MOVE", proc471);
-  DEFINE_PROC ("ResFilter_DAV_RES_CONTENT", proc472);
-  DEFINE_PROC ("ResFilter_DAV_SYMLINK", proc473);
-  DEFINE_PROC ("ResFilter_DAV_LOCK", proc474);
-  DEFINE_PROC ("ResFilter_DAV_UNLOCK", proc475);
-  DEFINE_PROC ("ResFilter_DAV_IS_LOCKED", proc476);
-  DEFINE_PROC ("ResFilter_DAV_LIST_LOCKS", proc477);
-  DEFINE_PROC ("ResFilter_CONFIGURE", proc478);
+  DEFINE_PROC ("ResFilter_DAV_AUTHENTICATE", proc455);
+  DEFINE_PROC ("ResFilter_NORM", proc456);
+  DEFINE_PROC ("ResFilter_ENCODE_FILTER", proc457);
+  DEFINE_PROC ("ResFilter_DECODE_FILTER", proc458);
+  DEFINE_PROC ("ResFilter_GET_CONDITION", proc459);
+  DEFINE_PROC ("ResFilter_FIT_INTO_CONDITION", proc460);
+  DEFINE_PROC ("ResFilter_MAKE_DEL_ACTION_FROM_CONDITION", proc461);
+  DEFINE_PROC ("ResFilter_LEAVE_CONDITION", proc462);
+  DEFINE_PROC ("ResFilter_FNMERGE", proc463);
+  DEFINE_PROC ("ResFilter_FNSPLIT", proc464);
+  DEFINE_PROC ("ResFilter_DAV_SEARCH_ID_IMPL", proc465);
+  DEFINE_PROC ("ResFilter_DAV_AUTHENTICATE_HTTP", proc466);
+  DEFINE_PROC ("ResFilter_DAV_GET_PARENT", proc467);
+  DEFINE_PROC ("ResFilter_DAV_COL_CREATE", proc468);
+  DEFINE_PROC ("ResFilter_DAV_COL_MOUNT", proc469);
+  DEFINE_PROC ("ResFilter_DAV_COL_MOUNT_HERE", proc470);
+  DEFINE_PROC ("ResFilter_DAV_DELETE", proc471);
+  DEFINE_PROC ("ResFilter_DAV_RES_UPLOAD", proc472);
+  DEFINE_PROC ("ResFilter_DAV_PROP_REMOVE", proc473);
+  DEFINE_PROC ("ResFilter_DAV_PROP_SET", proc474);
+  DEFINE_PROC ("ResFilter_DAV_PROP_GET", proc475);
+  DEFINE_PROC ("ResFilter_DAV_PROP_LIST", proc476);
+  DEFINE_PROC ("ResFilter_DAV_DIR_SINGLE", proc477);
+  DEFINE_PROC ("ResFilter_DAV_DIR_LIST", proc478);
+  DEFINE_PROC ("ResFilter_DAV_DIR_FILTER", proc479);
+  DEFINE_PROC ("ResFilter_DAV_SEARCH_ID", proc480);
+  DEFINE_PROC ("ResFilter_DAV_SEARCH_PATH", proc481);
+  DEFINE_PROC ("ResFilter_DAV_RES_UPLOAD_COPY", proc482);
+  DEFINE_PROC ("ResFilter_DAV_RES_UPLOAD_MOVE", proc483);
+  DEFINE_PROC ("ResFilter_DAV_RES_CONTENT", proc484);
+  DEFINE_PROC ("ResFilter_DAV_SYMLINK", proc485);
+  DEFINE_PROC ("ResFilter_DAV_LOCK", proc486);
+  DEFINE_PROC ("ResFilter_DAV_UNLOCK", proc487);
+  DEFINE_PROC ("ResFilter_DAV_IS_LOCKED", proc488);
+  DEFINE_PROC ("ResFilter_DAV_LIST_LOCKS", proc489);
+  DEFINE_PROC ("ResFilter_CONFIGURE", proc490);
 
   /* DET_PropFilter.sql */
 
-  DEFINE_PROC ("PropFilter_DAV_AUTHENTICATE", proc479);
-  DEFINE_PROC ("PropFilter_NORM", proc480);
-  DEFINE_PROC ("PropFilter_GET_CONDITION", proc481);
-  DEFINE_PROC ("PropFilter_FIT_INTO_CONDITION", proc482);
-  DEFINE_PROC ("PropFilter_LEAVE_CONDITION", proc483);
-  DEFINE_PROC ("PropFilter_FNMERGE", proc484);
-  DEFINE_PROC ("PropFilter_FNSPLIT", proc485);
-  DEFINE_PROC ("PropFilter_DAV_SEARCH_ID_IMPL", proc486);
-  DEFINE_PROC ("PropFilter_DAV_AUTHENTICATE_HTTP", proc487);
-  DEFINE_PROC ("PropFilter_DAV_GET_PARENT", proc488);
-  DEFINE_PROC ("PropFilter_DAV_COL_CREATE", proc489);
-  DEFINE_PROC ("PropFilter_DAV_COL_MOUNT", proc490);
-  DEFINE_PROC ("PropFilter_DAV_COL_MOUNT_HERE", proc491);
-  DEFINE_PROC ("PropFilter_DAV_DELETE", proc492);
-  DEFINE_PROC ("PropFilter_DAV_RES_UPLOAD", proc493);
-  DEFINE_PROC ("PropFilter_DAV_PROP_REMOVE", proc494);
-  DEFINE_PROC ("PropFilter_DAV_PROP_SET", proc495);
-  DEFINE_PROC ("PropFilter_DAV_PROP_GET", proc496);
-  DEFINE_PROC ("PropFilter_DAV_PROP_LIST", proc497);
-  DEFINE_PROC ("PropFilter_DAV_DIR_SINGLE", proc498);
-  DEFINE_PROC ("PropFilter_DAV_DIR_LIST", proc499);
-  DEFINE_PROC ("PropFilter_DAV_DIR_FILTER", proc500);
-  DEFINE_PROC ("PropFilter_DAV_SEARCH_ID", proc501);
-  DEFINE_PROC ("PropFilter_DAV_SEARCH_PATH", proc502);
-  DEFINE_PROC ("PropFilter_DAV_RES_UPLOAD_COPY", proc503);
-  DEFINE_PROC ("PropFilter_DAV_RES_UPLOAD_MOVE", proc504);
-  DEFINE_PROC ("PropFilter_DAV_RES_CONTENT", proc505);
-  DEFINE_PROC ("PropFilter_DAV_SYMLINK", proc506);
-  DEFINE_PROC ("PropFilter_DAV_LOCK", proc507);
-  DEFINE_PROC ("PropFilter_DAV_UNLOCK", proc508);
-  DEFINE_PROC ("PropFilter_DAV_IS_LOCKED", proc509);
-  DEFINE_PROC ("PropFilter_DAV_LIST_LOCKS", proc510);
+  DEFINE_PROC ("PropFilter_DAV_AUTHENTICATE", proc491);
+  DEFINE_PROC ("PropFilter_NORM", proc492);
+  DEFINE_PROC ("PropFilter_GET_CONDITION", proc493);
+  DEFINE_PROC ("PropFilter_FIT_INTO_CONDITION", proc494);
+  DEFINE_PROC ("PropFilter_LEAVE_CONDITION", proc495);
+  DEFINE_PROC ("PropFilter_FNMERGE", proc496);
+  DEFINE_PROC ("PropFilter_FNSPLIT", proc497);
+  DEFINE_PROC ("PropFilter_DAV_SEARCH_ID_IMPL", proc498);
+  DEFINE_PROC ("PropFilter_DAV_AUTHENTICATE_HTTP", proc499);
+  DEFINE_PROC ("PropFilter_DAV_GET_PARENT", proc500);
+  DEFINE_PROC ("PropFilter_DAV_COL_CREATE", proc501);
+  DEFINE_PROC ("PropFilter_DAV_COL_MOUNT", proc502);
+  DEFINE_PROC ("PropFilter_DAV_COL_MOUNT_HERE", proc503);
+  DEFINE_PROC ("PropFilter_DAV_DELETE", proc504);
+  DEFINE_PROC ("PropFilter_DAV_RES_UPLOAD", proc505);
+  DEFINE_PROC ("PropFilter_DAV_PROP_REMOVE", proc506);
+  DEFINE_PROC ("PropFilter_DAV_PROP_SET", proc507);
+  DEFINE_PROC ("PropFilter_DAV_PROP_GET", proc508);
+  DEFINE_PROC ("PropFilter_DAV_PROP_LIST", proc509);
+  DEFINE_PROC ("PropFilter_DAV_DIR_SINGLE", proc510);
+  DEFINE_PROC ("PropFilter_DAV_DIR_LIST", proc511);
+  DEFINE_PROC ("PropFilter_DAV_DIR_FILTER", proc512);
+  DEFINE_PROC ("PropFilter_DAV_SEARCH_ID", proc513);
+  DEFINE_PROC ("PropFilter_DAV_SEARCH_PATH", proc514);
+  DEFINE_PROC ("PropFilter_DAV_RES_UPLOAD_COPY", proc515);
+  DEFINE_PROC ("PropFilter_DAV_RES_UPLOAD_MOVE", proc516);
+  DEFINE_PROC ("PropFilter_DAV_RES_CONTENT", proc517);
+  DEFINE_PROC ("PropFilter_DAV_SYMLINK", proc518);
+  DEFINE_PROC ("PropFilter_DAV_LOCK", proc519);
+  DEFINE_PROC ("PropFilter_DAV_UNLOCK", proc520);
+  DEFINE_PROC ("PropFilter_DAV_IS_LOCKED", proc521);
+  DEFINE_PROC ("PropFilter_DAV_LIST_LOCKS", proc522);
 
   /* DET_RDFData.sql */
 
-  DEFINE_PROC ("DB.DBA.RDFData_log_message", proc511);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_AUTHENTICATE", proc512);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_AUTHENTICATE_HTTP", proc513);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_GET_PARENT", proc514);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_COL_CREATE", proc515);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_COL_MOUNT", proc516);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_COL_MOUNT_HERE", proc517);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_DELETE", proc518);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_RES_UPLOAD", proc519);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_PROP_REMOVE", proc520);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_PROP_SET", proc521);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_PROP_GET", proc522);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_PROP_LIST", proc523);
-  DEFINE_PROC ("DB.DBA.RDFData_ACCESS_PARAMS", proc524);
-  DEFINE_PROC ("DB.DBA.RDFData_cast_dt_silent", proc525);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_DIR_SINGLE", proc526);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_DIR_LIST", proc527);
-  DEFINE_PROC ("RDFData_std_pref", proc528);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_DIR_FILTER", proc529);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_SEARCH_ID", proc530);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_SEARCH_PATH", proc531);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_RES_UPLOAD_COPY", proc532);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_RES_UPLOAD_MOVE", proc533);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_RES_CONTENT", proc534);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_SYMLINK", proc535);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_DEREFERENCE_LIST", proc536);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_RESOLVE_PATH", proc537);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_LOCK", proc538);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_UNLOCK", proc539);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_IS_LOCKED", proc540);
-  DEFINE_PROC ("DB.DBA.RDFData_DAV_LIST_LOCKS", proc541);
-  DEFINE_PROC ("DB.DBA.RDFData_MAKE_DET_COL", proc542);
+  DEFINE_PROC ("DB.DBA.RDFData_log_message", proc523);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_AUTHENTICATE", proc524);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_AUTHENTICATE_HTTP", proc525);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_GET_PARENT", proc526);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_COL_CREATE", proc527);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_COL_MOUNT", proc528);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_COL_MOUNT_HERE", proc529);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_DELETE", proc530);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_RES_UPLOAD", proc531);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_PROP_REMOVE", proc532);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_PROP_SET", proc533);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_PROP_GET", proc534);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_PROP_LIST", proc535);
+  DEFINE_PROC ("DB.DBA.RDFData_ACCESS_PARAMS", proc536);
+  DEFINE_PROC ("DB.DBA.RDFData_cast_dt_silent", proc537);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_DIR_SINGLE", proc538);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_DIR_LIST", proc539);
+  DEFINE_PROC ("RDFData_std_pref", proc540);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_DIR_FILTER", proc541);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_SEARCH_ID", proc542);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_SEARCH_PATH", proc543);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_RES_UPLOAD_COPY", proc544);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_RES_UPLOAD_MOVE", proc545);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_RES_CONTENT", proc546);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_SYMLINK", proc547);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_DEREFERENCE_LIST", proc548);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_RESOLVE_PATH", proc549);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_LOCK", proc550);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_UNLOCK", proc551);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_IS_LOCKED", proc552);
+  DEFINE_PROC ("DB.DBA.RDFData_DAV_LIST_LOCKS", proc553);
+  DEFINE_PROC ("DB.DBA.RDFData_MAKE_DET_COL", proc554);
 
   /* DET_S3.sql */
 
-  DEFINE_PROC ("DB.DBA.S3__encode", proc543);
-  DEFINE_PROC ("DB.DBA.S3__params", proc544);
-  DEFINE_PROC ("DB.DBA.S3__parts2path", proc545);
-  DEFINE_PROC ("DB.DBA.S3__item2entry", proc546);
-  DEFINE_PROC ("DB.DBA.S3__headers2item", proc547);
-  DEFINE_PROC ("DB.DBA.S3__makeHostUrl", proc548);
-  DEFINE_PROC ("DB.DBA.S3__getBucketFromUrl", proc549);
-  DEFINE_PROC ("DB.DBA.S3__getNameFromUrl", proc550);
-  DEFINE_PROC ("DB.DBA.S3__getPathFromUrl", proc551);
-  DEFINE_PROC ("DB.DBA.S3__makeAWSHeader", proc552);
-  DEFINE_PROC ("DB.DBA.S3__getBuckets", proc553);
-  DEFINE_PROC ("DB.DBA.S3__getBucket", proc554);
-  DEFINE_PROC ("DB.DBA.S3__putObject", proc555);
-  DEFINE_PROC ("DB.DBA.S3__headObject", proc556);
-  DEFINE_PROC ("DB.DBA.S3__getObject", proc557);
-  DEFINE_PROC ("DB.DBA.S3__deleteObject", proc558);
-  DEFINE_PROC ("DB.DBA.S3_DAV_AUTHENTICATE", proc559);
-  DEFINE_PROC ("DB.DBA.S3_DAV_AUTHENTICATE_HTTP", proc560);
-  DEFINE_PROC ("DB.DBA.S3_DAV_GET_PARENT", proc561);
-  DEFINE_PROC ("DB.DBA.S3_DAV_COL_CREATE", proc562);
-  DEFINE_PROC ("DB.DBA.S3_DAV_DELETE", proc563);
-  DEFINE_PROC ("DB.DBA.S3_DAV_RES_UPLOAD", proc564);
-  DEFINE_PROC ("DB.DBA.S3_DAV_PROP_REMOVE", proc565);
-  DEFINE_PROC ("DB.DBA.S3_DAV_PROP_SET", proc566);
-  DEFINE_PROC ("DB.DBA.S3_DAV_PROP_GET", proc567);
-  DEFINE_PROC ("DB.DBA.S3_DAV_PROP_LIST", proc568);
-  DEFINE_PROC ("DB.DBA.S3_DAV_DIR_SINGLE", proc569);
-  DEFINE_PROC ("DB.DBA.S3_DAV_DIR_LIST", proc570);
-  DEFINE_PROC ("DB.DBA.S3_DAV_DIR_FILTER", proc571);
-  DEFINE_PROC ("DB.DBA.S3_DAV_SEARCH_ID", proc572);
-  DEFINE_PROC ("DB.DBA.S3_DAV_SEARCH_PATH", proc573);
-  DEFINE_PROC ("DB.DBA.S3_DAV_RES_UPLOAD", proc574);
-  DEFINE_PROC ("DB.DBA.S3_DAV_RES_UPLOAD_COPY", proc575);
-  DEFINE_PROC ("DB.DBA.S3_DAV_RES_UPLOAD_MOVE", proc576);
-  DEFINE_PROC ("DB.DBA.S3_DAV_RES_CONTENT", proc577);
-  DEFINE_PROC ("DB.DBA.S3_DAV_SYMLINK", proc578);
-  DEFINE_PROC ("DB.DBA.S3_DAV_DEREFERENCE_LIST", proc579);
-  DEFINE_PROC ("DB.DBA.S3_DAV_RESOLVE_PATH", proc580);
-  DEFINE_PROC ("DB.DBA.S3_DAV_LOCK", proc581);
-  DEFINE_PROC ("DB.DBA.S3_DAV_UNLOCK", proc582);
-  DEFINE_PROC ("DB.DBA.S3_DAV_IS_LOCKED", proc583);
-  DEFINE_PROC ("DB.DBA.S3_DAV_LIST_LOCKS", proc584);
+  DEFINE_PROC ("DB.DBA.S3__encode", proc555);
+  DEFINE_PROC ("DB.DBA.S3__params", proc556);
+  DEFINE_PROC ("DB.DBA.S3__parts2path", proc557);
+  DEFINE_PROC ("DB.DBA.S3__item2entry", proc558);
+  DEFINE_PROC ("DB.DBA.S3__headers2item", proc559);
+  DEFINE_PROC ("DB.DBA.S3__makeHostUrl", proc560);
+  DEFINE_PROC ("DB.DBA.S3__getBucketFromUrl", proc561);
+  DEFINE_PROC ("DB.DBA.S3__getNameFromUrl", proc562);
+  DEFINE_PROC ("DB.DBA.S3__getPathFromUrl", proc563);
+  DEFINE_PROC ("DB.DBA.S3__makeAWSHeader", proc564);
+  DEFINE_PROC ("DB.DBA.S3__getBuckets", proc565);
+  DEFINE_PROC ("DB.DBA.S3__getBucket", proc566);
+  DEFINE_PROC ("DB.DBA.S3__putObject", proc567);
+  DEFINE_PROC ("DB.DBA.S3__headObject", proc568);
+  DEFINE_PROC ("DB.DBA.S3__getObject", proc569);
+  DEFINE_PROC ("DB.DBA.S3__deleteObject", proc570);
+  DEFINE_PROC ("DB.DBA.S3_DAV_AUTHENTICATE", proc571);
+  DEFINE_PROC ("DB.DBA.S3_DAV_AUTHENTICATE_HTTP", proc572);
+  DEFINE_PROC ("DB.DBA.S3_DAV_GET_PARENT", proc573);
+  DEFINE_PROC ("DB.DBA.S3_DAV_COL_CREATE", proc574);
+  DEFINE_PROC ("DB.DBA.S3_DAV_DELETE", proc575);
+  DEFINE_PROC ("DB.DBA.S3_DAV_RES_UPLOAD", proc576);
+  DEFINE_PROC ("DB.DBA.S3_DAV_PROP_REMOVE", proc577);
+  DEFINE_PROC ("DB.DBA.S3_DAV_PROP_SET", proc578);
+  DEFINE_PROC ("DB.DBA.S3_DAV_PROP_GET", proc579);
+  DEFINE_PROC ("DB.DBA.S3_DAV_PROP_LIST", proc580);
+  DEFINE_PROC ("DB.DBA.S3_DAV_DIR_SINGLE", proc581);
+  DEFINE_PROC ("DB.DBA.S3_DAV_DIR_LIST", proc582);
+  DEFINE_PROC ("DB.DBA.S3_DAV_DIR_FILTER", proc583);
+  DEFINE_PROC ("DB.DBA.S3_DAV_SEARCH_ID", proc584);
+  DEFINE_PROC ("DB.DBA.S3_DAV_SEARCH_PATH", proc585);
+  DEFINE_PROC ("DB.DBA.S3_DAV_RES_UPLOAD", proc586);
+  DEFINE_PROC ("DB.DBA.S3_DAV_RES_UPLOAD_COPY", proc587);
+  DEFINE_PROC ("DB.DBA.S3_DAV_RES_UPLOAD_MOVE", proc588);
+  DEFINE_PROC ("DB.DBA.S3_DAV_RES_CONTENT", proc589);
+  DEFINE_PROC ("DB.DBA.S3_DAV_SYMLINK", proc590);
+  DEFINE_PROC ("DB.DBA.S3_DAV_DEREFERENCE_LIST", proc591);
+  DEFINE_PROC ("DB.DBA.S3_DAV_RESOLVE_PATH", proc592);
+  DEFINE_PROC ("DB.DBA.S3_DAV_LOCK", proc593);
+  DEFINE_PROC ("DB.DBA.S3_DAV_UNLOCK", proc594);
+  DEFINE_PROC ("DB.DBA.S3_DAV_IS_LOCKED", proc595);
+  DEFINE_PROC ("DB.DBA.S3_DAV_LIST_LOCKS", proc596);
+
+  /* DET_DynaRes.sql */
+
+  ddl_ensure_table ("WS.WS.DYNA_RES", tbl7);
+  DEFINE_PROC ("DynaRes_ACCESS_PARAMS", proc597);
+  DEFINE_PROC ("DynaRes_DAV_AUTHENTICATE", proc598);
+  DEFINE_PROC ("DynaRes_DAV_AUTHENTICATE_HTTP", proc599);
+  DEFINE_PROC ("DynaRes_DAV_GET_PARENT", proc600);
+  DEFINE_PROC ("DynaRes_DAV_COL_CREATE", proc601);
+  DEFINE_PROC ("DynaRes_DAV_COL_MOUNT", proc602);
+  DEFINE_PROC ("DynaRes_DAV_COL_MOUNT_HERE", proc603);
+  DEFINE_PROC ("DynaRes_DAV_DELETE", proc604);
+  DEFINE_PROC ("DynaRes_DAV_RES_UPLOAD", proc605);
+  DEFINE_PROC ("DynaRes_DAV_PROP_REMOVE", proc606);
+  DEFINE_PROC ("DynaRes_DAV_PROP_SET", proc607);
+  DEFINE_PROC ("DynaRes_DAV_PROP_GET", proc608);
+  DEFINE_PROC ("DynaRes_DAV_PROP_LIST", proc609);
+  DEFINE_PROC ("DynaRes_DAV_DIR_SINGLE", proc610);
+  DEFINE_PROC ("DynaRes_DAV_DIR_LIST", proc611);
+  DEFINE_PROC ("DynaRes_DAV_FC_PRED_METAS", proc612);
+  DEFINE_PROC ("DynaRes_DAV_FC_TABLE_METAS", proc613);
+  DEFINE_PROC ("DynaRes_DAV_FC_PRINT_WHERE", proc614);
+  DEFINE_PROC ("DynaRes_DAV_DIR_FILTER", proc615);
+  DEFINE_PROC ("DynaRes_DAV_SEARCH_ID", proc616);
+  DEFINE_PROC ("DynaRes_DAV_SEARCH_PATH", proc617);
+  DEFINE_PROC ("DynaRes_DAV_RES_UPLOAD_COPY", proc618);
+  DEFINE_PROC ("DynaRes_DAV_RES_UPLOAD_MOVE", proc619);
+  DEFINE_PROC ("DynaRes_DAV_RES_CONTENT", proc620);
+  DEFINE_PROC ("DynaRes_DAV_SYMLINK", proc621);
+  DEFINE_PROC ("DynaRes_DAV_DEREFERENCE_LIST", proc622);
+  DEFINE_PROC ("DynaRes_DAV_RESOLVE_PATH", proc623);
+  DEFINE_PROC ("DynaRes_DAV_LOCK", proc624);
+  DEFINE_PROC ("DynaRes_DAV_UNLOCK", proc625);
+  DEFINE_PROC ("DynaRes_DAV_IS_LOCKED", proc626);
+  DEFINE_PROC ("DynaRes_DAV_LIST_LOCKS", proc627);
+  DEFINE_PROC ("DynaRes_CF_PROPNAME_TO_COLNAME", proc628);
+  DEFINE_PROC ("DynaRes_CF_FEED_FROM_AND_WHERE", proc629);
+  DEFINE_PROC ("DynaRes_CF_LIST_PROP_DISTVALS", proc630);
+  DEFINE_PROC ("DynaRes_CF_GET_RDF_HITS", proc631);
+  DEFINE_PROC ("DynaRes_INSERT_RESOURCE", proc632);
 
   /* DET_Versioning.sql */
 
-  ddl_ensure_table ("WS.WS.SYS_DAV_RES_VERSION", tbl7);
-  ddl_ensure_table ("WS.WS.SYS_DAV_RES_DIFF", tbl8);
-  ddl_ensure_table ("WS.WS.SYS_DAV_RES_MERGE", tbl9);
-  ddl_ensure_table ("WS.WS.SYS_DAV_ACTIVITY", tbl10);
-  ddl_ensure_table ("WS.WS.SYS_DAV_WORKSPACE", tbl11);
-  ddl_ensure_table ("WS.WS.SYS_DAV_CONFOBJ", tbl12);
-  ddl_ensure_table ("WS.WS.SYS_DAV_BASELINE", tbl13);
-  ddl_ensure_table ("WS.WS.SYS_DAV_BASELINE_RES", tbl14);
-  ddl_std_proc (trig39, 0x0);
-  ddl_std_proc (trig40, 0x0);
+  ddl_ensure_table ("WS.WS.SYS_DAV_RES_VERSION", tbl8);
+  ddl_ensure_table ("WS.WS.SYS_DAV_RES_DIFF", tbl9);
+  ddl_ensure_table ("WS.WS.SYS_DAV_RES_MERGE", tbl10);
+  ddl_ensure_table ("WS.WS.SYS_DAV_ACTIVITY", tbl11);
+  ddl_ensure_table ("WS.WS.SYS_DAV_WORKSPACE", tbl12);
+  ddl_ensure_table ("WS.WS.SYS_DAV_CONFOBJ", tbl13);
+  ddl_ensure_table ("WS.WS.SYS_DAV_BASELINE", tbl14);
+  ddl_ensure_table ("WS.WS.SYS_DAV_BASELINE_RES", tbl15);
   ddl_std_proc (trig41, 0x0);
-  DEFINE_PROC ("Versioning_ADD_NEW_DIFF", proc585);
   ddl_std_proc (trig42, 0x0);
   ddl_std_proc (trig43, 0x0);
-  DEFINE_PROC ("DAV_GET_VERSION_CONTENT", proc586);
-  DEFINE_PROC ("DAV_RES_RESTORE", proc587);
-  DEFINE_PROC ("Versioning_DAV_AUTHENTICATE", proc588);
-  DEFINE_PROC ("Versioning_DAV_AUTHENTICATE_HTTP", proc589);
-  DEFINE_PROC ("Versioning_DAV_GET_PARENT", proc590);
-  DEFINE_PROC ("Versioning_DAV_COL_CREATE", proc591);
-  DEFINE_PROC ("Versioning_DAV_COL_MOUNT", proc592);
-  DEFINE_PROC ("Versioning_DAV_COL_MOUNT_HERE", proc593);
-  DEFINE_PROC ("Versioning_DAV_DELETE", proc594);
-  DEFINE_PROC ("Versioning_DAV_RES_UPLOAD", proc595);
-  DEFINE_PROC ("Versioning_DAV_PROP_REMOVE", proc596);
-  DEFINE_PROC ("Versioning_DAV_PROP_SET", proc597);
-  DEFINE_PROC ("Versioning_DAV_PROP_GET", proc598);
-  DEFINE_PROC ("Versioning_root_version", proc599);
-  DEFINE_PROC ("Versioning_version_set", proc600);
-  DEFINE_PROC ("Versioning_DAV_PROP_LIST", proc601);
-  DEFINE_PROC ("Versioning_DAV_DIR_SINGLE", proc602);
-  DEFINE_PROC ("Versioning_GET_BASE_PATH", proc603);
-  DEFINE_PROC ("Versioning_GET_ATTIC_PATH", proc604);
-  DEFINE_PROC ("Versioning_SET_LIST", proc605);
-  DEFINE_PROC ("Versioning_DAV_DIR_LIST", proc606);
-  DEFINE_PROC ("Versioning_DAV_DIR_FILTER", proc607);
-  DEFINE_PROC ("Versioning_DAV_SEARCH_ID", proc608);
-  DEFINE_PROC ("Versioning_DAV_SEARCH_PATH", proc609);
-  DEFINE_PROC ("Versioning_DAV_RES_UPLOAD_COPY", proc610);
-  DEFINE_PROC ("Versioning_DAV_RES_UPLOAD_MOVE", proc611);
-  DEFINE_PROC ("Versioning_DAV_RES_CONTENT", proc612);
-  DEFINE_PROC ("Versioning_DAV_SYMLINK", proc613);
-  DEFINE_PROC ("Versioning_DAV_DEREFERENCE_LIST", proc614);
-  DEFINE_PROC ("Versioning_DAV_RESOLVE_PATH", proc615);
-  DEFINE_PROC ("Versioning_DAV_LOCK", proc616);
-  DEFINE_PROC ("Versioning_DAV_UNLOCK", proc617);
-  DEFINE_PROC ("Versioning_DAV_IS_LOCKED", proc618);
-  DEFINE_PROC ("Versioning_DAV_LIST_LOCKS", proc619);
-  DEFINE_PROC ("Versioning_AUTO_VERSION_PROP", proc620);
-  DEFINE_PROC ("DAV_SET_VERSIONING_PROPERTIES", proc621);
-  DEFINE_PROC ("Versioning_REMOVE_V_PROPERTIES", proc622);
-  DEFINE_PROC ("DAV_REMOVE_VERSIONING_CONTROL_INT", proc623);
-  DEFINE_PROC ("Versioning_SETPROP", proc624);
-  DEFINE_PROC ("DAV_SET_VERSIONING_CONTROL", proc625);
-  DEFINE_PROC ("DAV_MKWORKSPACE", proc626);
-  DEFINE_PROC ("DAV_CHECKOUT", proc627);
-  DEFINE_PROC ("DAV_CHECKOUT_INT", proc628);
-  DEFINE_PROC ("DAV_CHECKIN", proc629);
-  DEFINE_PROC ("DAV_CHECKIN_INT", proc630);
-  DEFINE_PROC ("Versioning_CHECKOUT_INT", proc631);
+  DEFINE_PROC ("Versioning_ADD_NEW_DIFF", proc633);
   ddl_std_proc (trig44, 0x0);
-  DEFINE_PROC ("DAV_VERSION_CONTROL", proc632);
-  DEFINE_PROC ("DAV_UNCHECKOUT", proc633);
-  DEFINE_PROC ("Versioning_Attic", proc634);
-  DEFINE_PROC ("Versioning_OTHER_FILES_IN_VVC", proc635); 
-  DEFINE_PUBLIC_PROC ("DAV_REMOVE_VERSION_CONTROL", proc636); 
-  DEFINE_PUBLIC_PROC ("DAV_VERSION_FOLD_INT", proc637);
   ddl_std_proc (trig45, 0x0);
+  DEFINE_PROC ("DAV_GET_VERSION_CONTENT", proc634);
+  DEFINE_PROC ("DAV_RES_RESTORE", proc635);
+  DEFINE_PROC ("Versioning_DAV_AUTHENTICATE", proc636);
+  DEFINE_PROC ("Versioning_DAV_AUTHENTICATE_HTTP", proc637);
+  DEFINE_PROC ("Versioning_DAV_GET_PARENT", proc638);
+  DEFINE_PROC ("Versioning_DAV_COL_CREATE", proc639);
+  DEFINE_PROC ("Versioning_DAV_COL_MOUNT", proc640);
+  DEFINE_PROC ("Versioning_DAV_COL_MOUNT_HERE", proc641);
+  DEFINE_PROC ("Versioning_DAV_DELETE", proc642);
+  DEFINE_PROC ("Versioning_DAV_RES_UPLOAD", proc643);
+  DEFINE_PROC ("Versioning_DAV_PROP_REMOVE", proc644);
+  DEFINE_PROC ("Versioning_DAV_PROP_SET", proc645);
+  DEFINE_PROC ("Versioning_DAV_PROP_GET", proc646);
+  DEFINE_PROC ("Versioning_root_version", proc647);
+  DEFINE_PROC ("Versioning_version_set", proc648);
+  DEFINE_PROC ("Versioning_DAV_PROP_LIST", proc649);
+  DEFINE_PROC ("Versioning_DAV_DIR_SINGLE", proc650);
+  DEFINE_PROC ("Versioning_GET_BASE_PATH", proc651);
+  DEFINE_PROC ("Versioning_GET_ATTIC_PATH", proc652);
+  DEFINE_PROC ("Versioning_SET_LIST", proc653);
+  DEFINE_PROC ("Versioning_DAV_DIR_LIST", proc654);
+  DEFINE_PROC ("Versioning_DAV_DIR_FILTER", proc655);
+  DEFINE_PROC ("Versioning_DAV_SEARCH_ID", proc656);
+  DEFINE_PROC ("Versioning_DAV_SEARCH_PATH", proc657);
+  DEFINE_PROC ("Versioning_DAV_RES_UPLOAD_COPY", proc658);
+  DEFINE_PROC ("Versioning_DAV_RES_UPLOAD_MOVE", proc659);
+  DEFINE_PROC ("Versioning_DAV_RES_CONTENT", proc660);
+  DEFINE_PROC ("Versioning_DAV_SYMLINK", proc661);
+  DEFINE_PROC ("Versioning_DAV_DEREFERENCE_LIST", proc662);
+  DEFINE_PROC ("Versioning_DAV_RESOLVE_PATH", proc663);
+  DEFINE_PROC ("Versioning_DAV_LOCK", proc664);
+  DEFINE_PROC ("Versioning_DAV_UNLOCK", proc665);
+  DEFINE_PROC ("Versioning_DAV_IS_LOCKED", proc666);
+  DEFINE_PROC ("Versioning_DAV_LIST_LOCKS", proc667);
+  DEFINE_PROC ("Versioning_AUTO_VERSION_PROP", proc668);
+  DEFINE_PROC ("DAV_SET_VERSIONING_PROPERTIES", proc669);
+  DEFINE_PROC ("Versioning_REMOVE_V_PROPERTIES", proc670);
+  DEFINE_PROC ("DAV_REMOVE_VERSIONING_CONTROL_INT", proc671);
+  DEFINE_PROC ("Versioning_SETPROP", proc672);
+  DEFINE_PROC ("DAV_SET_VERSIONING_CONTROL", proc673);
+  DEFINE_PROC ("DAV_MKWORKSPACE", proc674);
+  DEFINE_PROC ("DAV_CHECKOUT", proc675);
+  DEFINE_PROC ("DAV_CHECKOUT_INT", proc676);
+  DEFINE_PROC ("DAV_CHECKIN", proc677);
+  DEFINE_PROC ("DAV_CHECKIN_INT", proc678);
+  DEFINE_PROC ("Versioning_CHECKOUT_INT", proc679);
+  ddl_std_proc (trig46, 0x0);
+  DEFINE_PROC ("DAV_VERSION_CONTROL", proc680);
+  DEFINE_PROC ("DAV_UNCHECKOUT", proc681);
+  DEFINE_PROC ("Versioning_Attic", proc682);
+  DEFINE_PROC ("Versioning_OTHER_FILES_IN_VVC", proc683); 
+  DEFINE_PUBLIC_PROC ("DAV_REMOVE_VERSION_CONTROL", proc684); 
+  DEFINE_PUBLIC_PROC ("DAV_VERSION_FOLD_INT", proc685);
+  ddl_std_proc (trig47, 0x0);
 
   /* xml_view.sql */
 
-  DEFINE_PROC ("XML_VIEW_PUBLISH", proc638);
-  DEFINE_PROC ("XML_VIEW_DROP", proc639);
+  DEFINE_PROC ("XML_VIEW_PUBLISH", proc686);
+  DEFINE_PROC ("XML_VIEW_DROP", proc687);
 }
 
 
diff --git a/libsrc/Wi/sql_code_dbp.c b/libsrc/Wi/sql_code_dbp.c
index 31d0438..af936f3 100644
--- a/libsrc/Wi/sql_code_dbp.c
+++ b/libsrc/Wi/sql_code_dbp.c
@@ -20,6 +20,7 @@ static const char *tbl0 =
 ")\n";
 
 static const char *proc0 = 
+"#line 70 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"__CHECK_TITLE\" ( in sname varchar )\n"
 "{\n"
 "declare shelp any;\n"
@@ -40,18 +41,20 @@ static const char *proc0 =
 "fin:\n"
 "close cr;\n"
 "}\n"
-"--src dbpump_root.sql:69\n";
+"--src dbpump_root.sql:68\n";
 
 static const char *proc1 = 
+"#line 93 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"__GET_KEYWORD\" ( in name varchar, in arr any, in def varchar )\n"
 "{\n"
 "if (arr is not null)\n"
 "return get_keyword(name,arr,def);\n"
 "return \'\';\n"
 "}\n"
-"--src dbpump_root.sql:92\n";
+"--src dbpump_root.sql:91\n";
 
 static const char *proc2 = 
+"#line 102 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"__GET_DUMP_NAME\" ( out pars any )\n"
 "{\n"
 "declare s varchar;\n"
@@ -61,9 +64,10 @@ static const char *proc2 =
 "\n"
 "return s;\n"
 "}\n"
-"--src dbpump_root.sql:101\n";
+"--src dbpump_root.sql:100\n";
 
 static const char *proc3 = 
+"#line 115 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"__CHECK_HELP\" ( in sname varchar , in text varchar )\n"
 "{\n"
 "declare lhelp any;\n"
@@ -94,9 +98,10 @@ static const char *proc3 =
 "if (fnd = 0)\n"
 "\"PUMP\".\"DBA\".\"HTML_STR_OUT\" (text);\n"
 "}\n"
-"--src dbpump_root.sql:114\n";
+"--src dbpump_root.sql:113\n";
 
 static const char *proc4 = 
+"#line 149 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_SMTH_OUT\" ( in attr varchar, in val varchar)\n"
 "{\n"
 "if (val is not null and length(val)>0)\n"
@@ -106,17 +111,19 @@ static const char *proc4 =
 "http(\'\" \');\n"
 "}\n"
 "}\n"
-"--src dbpump_root.sql:148\n";
+"--src dbpump_root.sql:147\n";
 
 static const char *proc5 = 
+"#line 161 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_STR_OUT\" (in val varchar)\n"
 "{\n"
 "if (val is not null and length(val)>0)\n"
 "http(\"PUMP\".\"DBA\".\"PROTECT_STRING\" (val));\n"
 "}\n"
-"--src dbpump_root.sql:160\n";
+"--src dbpump_root.sql:159\n";
 
 static const char *proc6 = 
+"#line 169 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_STR_ENCODE_OUT\" (in val varchar)\n"
 "{\n"
 "declare i,n,c integer;\n"
@@ -136,9 +143,10 @@ static const char *proc6 =
 "}\n"
 "}\n"
 "}\n"
-"--src dbpump_root.sql:168\n";
+"--src dbpump_root.sql:167\n";
 
 static const char *proc7 = 
+"#line 192 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"URLIFY_STRING\" (in val varchar)\n"
 "{\n"
 "declare i,n,c integer;\n"
@@ -169,9 +177,10 @@ static const char *proc7 =
 "\n"
 "return s;\n"
 "}\n"
-"--src dbpump_root.sql:191\n";
+"--src dbpump_root.sql:190\n";
 
 static const char *proc8 = 
+"#line 225 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"PROTECT_STRING\" (in val varchar)\n"
 "{\n"
 "declare i,n,c,l integer;\n"
@@ -199,9 +208,10 @@ static const char *proc8 =
 "}\n"
 "return s;\n"
 "}\n"
-"--src dbpump_root.sql:224\n";
+"--src dbpump_root.sql:223\n";
 
 static const char *proc9 = 
+"#line 255 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"EXTRACT_HOST_FROM_LINES\" ( in pars any )\n"
 "{\n"
 "declare host varchar;\n"
@@ -219,9 +229,10 @@ static const char *proc9 =
 "i:=i+1;\n"
 "}\n"
 "}\n"
-"--src dbpump_root.sql:254\n";
+"--src dbpump_root.sql:253\n";
 
 static const char *proc10 = 
+"#line 277 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"EXTRACT_PORT_FROM_INI\" ( )\n"
 "{\n"
 "declare sect, item, item_value varchar;\n"
@@ -240,9 +251,10 @@ static const char *proc10 =
 "}\n"
 "return \'1111\';\n"
 "}\n"
-"--src dbpump_root.sql:276\n";
+"--src dbpump_root.sql:275\n";
 
 static const char *proc11 = 
+"#line 298 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"CHANGE_VAL\" ( out pars any, in name varchar, in val varchar )\n"
 "{\n"
 "declare i,n integer;\n"
@@ -263,9 +275,10 @@ static const char *proc11 =
 "pars := vector_concat (pars, vector (name, val));\n"
 "return;\n"
 "}\n"
-"--src dbpump_root.sql:297\n";
+"--src dbpump_root.sql:296\n";
 
 static const char *proc12 = 
+"#line 321 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"CHANGE_VAL_IF_NOT_SET\" ( out pars any, in name varchar, in val varchar )\n"
 "{\n"
 "declare i,n integer;\n"
@@ -289,9 +302,10 @@ static const char *proc12 =
 "vector_concat (pars, vector (name, val));\n"
 "return val;\n"
 "}\n"
-"--src dbpump_root.sql:320\n";
+"--src dbpump_root.sql:319\n";
 
 static const char *proc13 = 
+"#line 346 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"OBTAIN_DSN\" ( out pars any, in lines any )\n"
 "{\n"
 "declare port varchar;\n"
@@ -311,9 +325,10 @@ static const char *proc13 =
 "\"PUMP\".\"DBA\".\"CHANGE_VAL\" (pars, \'user\', _user);\n"
 "\n"
 "}\n"
-"--src dbpump_root.sql:345\n";
+"--src dbpump_root.sql:344\n";
 
 static const char *proc14 = 
+"#line 369 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"__RETRIEVE_HTTP_PARS\" ( in afrom any, out ato any, in name varchar, in dflt varchar )\n"
 "{\n"
 "declare s varchar;\n"
@@ -324,9 +339,10 @@ static const char *proc14 =
 "s2 := vector (name, s);\n"
 "ato := vector_concat (ato, s2);\n"
 "}\n"
-"--src dbpump_root.sql:368\n";
+"--src dbpump_root.sql:367\n";
 
 static const char *proc15 = 
+"#line 381 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"OUT_HIDDEN_PARS\" ( in arr any, in req varchar )\n"
 "{\n"
 "declare vreq, treq any;\n"
@@ -355,9 +371,10 @@ static const char *proc15 =
 "}\n"
 "\n"
 "}\n"
-"--src dbpump_root.sql:380\n";
+"--src dbpump_root.sql:379\n";
 
 static const char *proc16 = 
+"#line 411 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"OUT_CHK_DFLT_PARS\" ( in req varchar )\n"
 "{\n"
 "declare vreq, treq any;\n"
@@ -387,9 +404,10 @@ static const char *proc16 =
 "http (\'return 1;\\n}</script>\\n\');\n"
 "return 0;\n"
 "}\n"
-"--src dbpump_root.sql:410\n";
+"--src dbpump_root.sql:409\n";
 
 static const char *proc17 = 
+"#line 443 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"RESTORE_DEFAULT_PARS\" ( in req varchar )\n"
 "{\n"
 "declare vreq, treq any;\n"
@@ -417,9 +435,10 @@ static const char *proc17 =
 "http (\'return 1;\\n}</script>\\n\');\n"
 "return 0;\n"
 "}\n"
-"--src dbpump_root.sql:442\n";
+"--src dbpump_root.sql:441\n";
 
 static const char *proc18 = 
+"#line 474 \"[executable]/dbpump_root.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HIDDEN_VAL_OUT\" (	inout arr any,  in name varchar )\n"
 "{\n"
 "declare s varchar;\n"
@@ -428,7 +447,7 @@ static const char *proc18 =
 "http (sprintf (\'document.forms[0].%s.value=\"%s\";\', name, s));\n"
 "http (\'</script>\\n\');\n"
 "}\n"
-"--src dbpump_root.sql:473\n";
+"--src dbpump_root.sql:472\n";
 
 /* oper_pars.sql */
 
@@ -787,13 +806,15 @@ static const char *other89 =
 /* components.sql */
 
 static const char *proc19 = 
+"#line 27 \"[executable]/components.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"__GET_TEMPORARY\" (  )\n"
 "{\n"
 "return  sprintf(\'./tmp/dbpump%d.tmp\', sequence_next(\'dbpump_temp\'));\n"
 "}\n"
-"--src components.sql:26\n";
+"--src components.sql:25\n";
 
 static const char *proc20 = 
+"#line 33 \"[executable]/components.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"DBPUMP_START_COMPONENT\" ( 	in pars any,\n"
 "in name varchar,\n"
 "in arg varchar )\n"
@@ -829,9 +850,10 @@ static const char *proc20 =
 "run_executable (\'dbpump\', 1, str);\n"
 "return str;\n"
 "}\n"
-"--src components.sql:32\n";
+"--src components.sql:31\n";
 
 static const char *proc21 = 
+"#line 73 \"[executable]/components.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"DBPUMP_RUN_COMPONENT\" ( 	inout pars any,\n"
 "in name varchar,\n"
 "in arg varchar,\n"
@@ -887,11 +909,12 @@ static const char *proc21 =
 "else\n"
 "return \'\';\n"
 "}\n"
-"--src components.sql:72\n";
+"--src components.sql:71\n";
 
 /* comp_html.sql */
 
 static const char *proc22 = 
+"#line 30 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_A_OUT\" ( 	in arr any,\n"
 "in href varchar,\n"
 "in text varchar,\n"
@@ -913,9 +936,10 @@ static const char *proc22 =
 "\"PUMP\".\"DBA\".\"HTML_STR_OUT\" (text);\n"
 "http(\'</a>\\n\');\n"
 "}\n"
-"--src comp_html.sql:29\n";
+"--src comp_html.sql:28\n";
 
 static const char *proc23 = 
+"#line 56 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_BUTTON_OUT\" ( in arr any,\n"
 "in name varchar,\n"
 "in val varchar,\n"
@@ -933,9 +957,10 @@ static const char *proc23 =
 "http(\'>\\n\');\n"
 "\n"
 "}\n"
-"--src comp_html.sql:55\n";
+"--src comp_html.sql:54\n";
 
 static const char *proc24 = 
+"#line 99 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_LINK_OUT\" (	in arr any,\n"
 "in href varchar,\n"
 "in text varchar,\n"
@@ -961,18 +986,20 @@ static const char *proc24 =
 "\"PUMP\".\"DBA\".\"HTML_BUTTON_OUT\" ( arr, NULL, text, \'document.forms[0].submit();\', class, s);\n"
 "}\n"
 "}\n"
-"--src comp_html.sql:98\n";
+"--src comp_html.sql:97\n";
 
 static const char *proc25 = 
+"#line 127 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"TEST_CONNECTED\" ( in flag integer , in val integer )\n"
 "{\n"
 "if (flag)\n"
 "return val;\n"
 "return 50;\n"
 "}\n"
-"--src comp_html.sql:126\n";
+"--src comp_html.sql:125\n";
 
 static const char *proc26 = 
+"#line 136 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_HEADER_OUT\" ( in arr any,  in text varchar, in mask varchar)\n"
 "{\n"
 "http(\'<BODY>\\n\');\n"
@@ -1010,9 +1037,10 @@ static const char *proc26 =
 "\n"
 "\n"
 "}\n"
-"--src comp_html.sql:135\n";
+"--src comp_html.sql:134\n";
 
 static const char *proc27 = 
+"#line 176 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"DUMP_DEBUG_INFO\" ( in arr any )\n"
 "{\n"
 "declare i,n integer;\n"
@@ -1035,9 +1063,10 @@ static const char *proc27 =
 "}\n"
 "http(\'</table>\');\n"
 "}\n"
-"--src comp_html.sql:175\n";
+"--src comp_html.sql:174\n";
 
 static const char *proc28 = 
+"#line 201 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_FOOTER_OUT\" ( inout arr any )\n"
 "{\n"
 "http(\'</form></td></tr>\');\n"
@@ -1063,12 +1092,13 @@ static const char *proc28 =
 "http (\'<TR><TD CLASS=\"CopyrightBorder\" COLSPAN=\"2\"><IMG SRC=\"/admin/images/1x1.gif\" WIDTH=\"1\" HEIGHT=\"2\" ALT=\"\"></TD></TR>\');\n"
 "http (\'<TR><TD ALIGN=\"right\" COLSPAN=\"2\"><P CLASS=\"Copyright\">Virtuoso Server \');\n"
 "http (sys_stat(\'st_dbms_ver\'));\n"
-"http (\' DBPUMP Interface - Copyright© 1998-2010 OpenLink Software.</P></TD></TR>\');\n"
+"http (\' DBPUMP Interface - Copyright© 1998-2011 OpenLink Software.</P></TD></TR>\');\n"
 "http (\'</TABLE>\\n</BODY>\');\n"
 "}\n"
-"--src comp_html.sql:200\n";
+"--src comp_html.sql:199\n";
 
 static const char *proc29 = 
+"#line 232 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_RESET_OUT\" ( in arr any,\n"
 "in name varchar,\n"
 "in val varchar,\n"
@@ -1086,9 +1116,10 @@ static const char *proc29 =
 "http(\'>\\n\');\n"
 "\n"
 "}\n"
-"--src comp_html.sql:231\n";
+"--src comp_html.sql:230\n";
 
 static const char *proc30 = 
+"#line 252 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_SUBMIT_OUT\" ( 	in arr any,\n"
 "in name varchar,\n"
 "in val varchar,\n"
@@ -1106,9 +1137,10 @@ static const char *proc30 =
 "http(\'>\\n\');\n"
 "\n"
 "}\n"
-"--src comp_html.sql:251\n";
+"--src comp_html.sql:250\n";
 
 static const char *proc31 = 
+"#line 272 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_EDIT_OUT\" ( in arr any,\n"
 "in name varchar,\n"
 "in text varchar,\n"
@@ -1127,9 +1159,10 @@ static const char *proc31 =
 "\"PUMP\".\"DBA\".\"__CHECK_TITLE\" (name);\n"
 "http(\'>\\n\');\n"
 "}\n"
-"--src comp_html.sql:271\n";
+"--src comp_html.sql:270\n";
 
 static const char *proc32 = 
+"#line 293 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_EDIT_ROW_OUT\" ( 	in arr any,\n"
 "in name varchar,\n"
 "in text varchar,\n"
@@ -1151,9 +1184,10 @@ static const char *proc32 =
 "http(\'>\');\n"
 "http (\'</td><tr>\\n\');\n"
 "}\n"
-"--src comp_html.sql:292\n";
+"--src comp_html.sql:291\n";
 
 static const char *proc33 = 
+"#line 317 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_HIDDEN_OUT\" (  	in arr any,\n"
 "in name varchar,\n"
 "in val varchar,\n"
@@ -1165,9 +1199,10 @@ static const char *proc33 =
 "\"PUMP\".\"DBA\".\"HTML_STR_OUT\" (dop);\n"
 "http(\'>\\n\');\n"
 "}\n"
-"--src comp_html.sql:316\n";
+"--src comp_html.sql:315\n";
 
 static const char *proc34 = 
+"#line 331 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_PASSWORD_OUT\" ( 	in arr any,\n"
 "in name varchar,\n"
 "in text varchar,\n"
@@ -1185,9 +1220,10 @@ static const char *proc34 =
 "\"PUMP\".\"DBA\".\"__CHECK_TITLE\" (name);\n"
 "http(\'>\\n\');\n"
 "}\n"
-"--src comp_html.sql:330\n";
+"--src comp_html.sql:329\n";
 
 static const char *proc35 = 
+"#line 351 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_PASSWORD_ROW_OUT\" (	in arr any,\n"
 "in name varchar,\n"
 "in text varchar,\n"
@@ -1209,9 +1245,10 @@ static const char *proc35 =
 "http(\'>\');\n"
 "http (\'</td><tr>\\n\');\n"
 "}\n"
-"--src comp_html.sql:350\n";
+"--src comp_html.sql:349\n";
 
 static const char *proc36 = 
+"#line 375 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_TEXTAREA_OUT\" ( 	in arr any,\n"
 "in name varchar,\n"
 "in text varchar,\n"
@@ -1239,9 +1276,10 @@ static const char *proc36 =
 "if (text is not null)\n"
 "http (\'</td></tr></table>\');\n"
 "}\n"
-"--src comp_html.sql:374\n";
+"--src comp_html.sql:373\n";
 
 static const char *proc37 = 
+"#line 406 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_LARGETEXT_OUT\" ( 	in arr any,\n"
 "in name varchar,\n"
 "in text varchar,\n"
@@ -1265,9 +1303,10 @@ static const char *proc37 =
 "\"PUMP\".\"DBA\".\"HTML_STR_OUT\" (s);\n"
 "http(\'</pre></td></tr></table>\');\n"
 "}\n"
-"--src comp_html.sql:405\n";
+"--src comp_html.sql:404\n";
 
 static const char *proc38 = 
+"#line 433 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_CHECKBOX_OUT\" (  	in arr any,\n"
 "in name varchar,\n"
 "in text varchar,\n"
@@ -1298,9 +1337,10 @@ static const char *proc38 =
 "http(\'</input>\\n\');\n"
 "\"PUMP\".\"DBA\".\"HTML_HIDDEN_OUT\" (arr, name, v, NULL);\n"
 "}\n"
-"--src comp_html.sql:432\n";
+"--src comp_html.sql:431\n";
 
 static const char *proc39 = 
+"#line 466 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_RADIO_OUT\" ( 	in arr any,\n"
 "in name varchar,\n"
 "in val varchar,\n"
@@ -1340,9 +1380,10 @@ static const char *proc39 =
 "\"PUMP\".\"DBA\".\"HTML_HIDDEN_OUT\" (arr, name, v, NULL);\n"
 "\n"
 "}\n"
-"--src comp_html.sql:465\n";
+"--src comp_html.sql:464\n";
 
 static const char *proc40 = 
+"#line 508 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_IMAGE_OUT\" ( in arr any,\n"
 "in name varchar,\n"
 "in val varchar,\n"
@@ -1362,9 +1403,10 @@ static const char *proc40 =
 "http(\'>\\n\');\n"
 "\n"
 "}\n"
-"--src comp_html.sql:507\n";
+"--src comp_html.sql:506\n";
 
 static const char *proc41 = 
+"#line 530 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_FILE_OUT\" (	in arr any,\n"
 "in name varchar,\n"
 "in text varchar,\n"
@@ -1382,9 +1424,10 @@ static const char *proc41 =
 "\"PUMP\".\"DBA\".\"__CHECK_TITLE\" (name);\n"
 "http(\'>\\n\');\n"
 "}\n"
-"--src comp_html.sql:529\n";
+"--src comp_html.sql:528\n";
 
 static const char *proc42 = 
+"#line 550 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_SELECT_OUT\" ( 	in arr any,\n"
 "in name varchar,\n"
 "in text varchar,\n"
@@ -1481,9 +1524,10 @@ static const char *proc42 =
 "http (\'</script>\');\n"
 "\"PUMP\".\"DBA\".\"HTML_HIDDEN_OUT\" (arr, name, testval, NULL);\n"
 "}\n"
-"--src comp_html.sql:549\n";
+"--src comp_html.sql:548\n";
 
 static const char *proc43 = 
+"#line 649 \"[executable]/comp_html.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"OUT_DUMP_TYPE\" ( 	in arr any )\n"
 "{\n"
 "\n"
@@ -1545,11 +1589,12 @@ static const char *proc43 =
 "}\n"
 "\');\n"
 "}\n"
-"--src comp_html.sql:648\n";
+"--src comp_html.sql:647\n";
 
 /* comp_misc.sql */
 
 static const char *proc44 = 
+"#line 29 \"[executable]/comp_misc.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_SELECT_TYPE_OUT\" (	in arr any,\n"
 "in name varchar,\n"
 "in class varchar ,\n"
@@ -1557,9 +1602,10 @@ static const char *proc44 =
 "{\n"
 "\"PUMP\".\"DBA\".\"HTML_SELECT_OUT\" (arr, name, \'\', \'0=-&1=CHAR&2=NUMERIC&3=DECIMAL&4=INTEGER&5=SMALLINT&6=FLOAT&7=REAL&8=DOUBLE PRECISION&9=DATE&10=TIME&11=TIMESTAMP&12=VARCHAR&13=BIT&14=BIT VARYING&15=LONG VARCHAR&16=BINARY&17=VARBINARY&18=LONG VARBINARY&19=BIGINT&20=TINYINT\', class, dop, NULL);\n"
 "}\n"
-"--src comp_misc.sql:28\n";
+"--src comp_misc.sql:27\n";
 
 static const char *proc45 = 
+"#line 39 \"[executable]/comp_misc.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_SELECT_DATASOURCES_OUT\" ( inout arr any,\n"
 "in class varchar ,\n"
 "in dop varchar )\n"
@@ -1581,9 +1627,10 @@ static const char *proc45 =
 "}\n"
 "http (\'</td></tr></table>\');\n"
 "}\n"
-"--src comp_misc.sql:38\n";
+"--src comp_misc.sql:37\n";
 
 static const char *proc46 = 
+"#line 63 \"[executable]/comp_misc.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"OPER_PARS_RETRIEVE\" ( inout pars any,\n"
 "in names varchar )\n"
 "{\n"
@@ -1602,9 +1649,10 @@ static const char *proc46 =
 "\n"
 "return outarr;\n"
 "}\n"
-"--src comp_misc.sql:62\n";
+"--src comp_misc.sql:61\n";
 
 static const char *proc47 = 
+"#line 83 \"[executable]/comp_misc.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"TRY_CONNECT_AND_PARS_RETRIEVE\" ( inout pars any )\n"
 "{\n"
 "declare n integer;\n"
@@ -1622,11 +1670,12 @@ static const char *proc47 =
 "\n"
 "return outarr;\n"
 "}\n"
-"--src comp_misc.sql:82\n";
+"--src comp_misc.sql:81\n";
 
 /* comp_rpath.sql */
 
 static const char *proc48 = 
+"#line 28 \"[executable]/comp_rpath.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_CHOICE_RPATH\" (	inout arr any )\n"
 "{\n"
 "declare str varchar;\n"
@@ -1635,9 +1684,10 @@ static const char *proc48 =
 "return \'\';\n"
 "return str;\n"
 "}\n"
-"--src comp_rpath.sql:27\n";
+"--src comp_rpath.sql:26\n";
 
 static const char *proc49 = 
+"#line 39 \"[executable]/comp_rpath.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_CHOICE_RDIR\" (	inout arr any )\n"
 "{\n"
 "declare str varchar;\n"
@@ -1648,9 +1698,10 @@ static const char *proc49 =
 "return \'\';\n"
 "return str;\n"
 "}\n"
-"--src comp_rpath.sql:38\n";
+"--src comp_rpath.sql:37\n";
 
 static const char *proc50 = 
+"#line 51 \"[executable]/comp_rpath.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_CHOICE_RSCHEMA\" (	inout arr any )\n"
 "{\n"
 "declare str varchar;\n"
@@ -1660,9 +1711,10 @@ static const char *proc50 =
 "return \'\';\n"
 "return str;\n"
 "}\n"
-"--src comp_rpath.sql:50\n";
+"--src comp_rpath.sql:49\n";
 
 static const char *proc51 = 
+"#line 65 \"[executable]/comp_rpath.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"RPATH_FOR_DUMP_SCHEMA_OUT\" (inout arr any,\n"
 "in class varchar ,\n"
 "in dop varchar )\n"
@@ -1673,9 +1725,10 @@ static const char *proc51 =
 "\"PUMP\".\"DBA\".\"HTML_EDIT_OUT\"(arr, \'dump_name\', \'Dump Name:\', \'./backup\', NULL, NULL);\n"
 "http(\'</td></tr></table>\');\n"
 "}\n"
-"--src comp_rpath.sql:64\n";
+"--src comp_rpath.sql:63\n";
 
 static const char *proc52 = 
+"#line 79 \"[executable]/comp_rpath.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"RPATH_FOR_DUMP_TABLES_OUT\" (inout arr any,\n"
 "in class varchar ,\n"
 "in dop varchar )\n"
@@ -1690,9 +1743,10 @@ static const char *proc52 =
 "\"PUMP\".\"DBA\".\"HTML_EDIT_OUT\" (arr, \'dump_name\', \'Current Folder:\', \'./backup\', NULL, NULL);\n"
 "http(\'</font></td></tr></table>\');\n"
 "}\n"
-"--src comp_rpath.sql:78\n";
+"--src comp_rpath.sql:77\n";
 
 static const char *proc53 = 
+"#line 96 \"[executable]/comp_rpath.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"RPATH_FOR_RESTORE_TABLES_OUT\" (	inout arr any,\n"
 "in class varchar ,\n"
 "in dop varchar )\n"
@@ -1707,9 +1761,10 @@ static const char *proc53 =
 "\"PUMP\".\"DBA\".\"HTML_EDIT_OUT\" (arr, \'dump_name\', \'Current Folder:\', \'./backup\', NULL, NULL);\n"
 "http(\'</font></td></tr></table>\');\n"
 "}\n"
-"--src comp_rpath.sql:95\n";
+"--src comp_rpath.sql:94\n";
 
 static const char *proc54 = 
+"#line 113 \"[executable]/comp_rpath.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"GET_SCHEMA_COMMENT_AND_PARS_RETRIEVE\" ( inout arr any )\n"
 "{\n"
 "declare n integer;\n"
@@ -1728,9 +1783,10 @@ static const char *proc54 =
 "\n"
 "return outarr;\n"
 "}\n"
-"--src comp_rpath.sql:112\n";
+"--src comp_rpath.sql:111\n";
 
 static const char *proc55 = 
+"#line 134 \"[executable]/comp_rpath.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"GET_SCHEMA_COMMENT\" ( inout arr any )\n"
 "{\n"
 "declare n integer;\n"
@@ -1743,9 +1799,10 @@ static const char *proc55 =
 "\n"
 "return outarr;\n"
 "}\n"
-"--src comp_rpath.sql:133\n";
+"--src comp_rpath.sql:132\n";
 
 static const char *proc56 = 
+"#line 148 \"[executable]/comp_rpath.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"COMMON_RPATH_FOR_DUMP_OUT\" (	inout arr any,\n"
 "in class varchar ,\n"
 "in dop varchar )\n"
@@ -1806,9 +1863,10 @@ static const char *proc56 =
 "http (\'</td></tr></table>\');\n"
 "\n"
 "}\n"
-"--src comp_rpath.sql:147\n";
+"--src comp_rpath.sql:146\n";
 
 static const char *proc57 = 
+"#line 210 \"[executable]/comp_rpath.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"MANIFEST_OUT\" (	in arr any, in xst varchar )\n"
 "{\n"
 "declare str, r varchar;\n"
@@ -1829,11 +1887,12 @@ static const char *proc57 =
 "s := string_output_string (ses);\n"
 "http (s);\n"
 "}\n"
-"--src comp_rpath.sql:209\n";
+"--src comp_rpath.sql:208\n";
 
 /* comp_tables.sql */
 
 static const char *proc58 = 
+"#line 28 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_RETRIEVE_TABLES\" (	inout arr any )\n"
 "{\n"
 "declare str varchar;\n"
@@ -1842,9 +1901,10 @@ static const char *proc58 =
 "return \'\';\n"
 "return str;\n"
 "}\n"
-"--src comp_tables.sql:27\n";
+"--src comp_tables.sql:26\n";
 
 static const char *proc59 = 
+"#line 39 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_RETRIEVE_QUALIFIERS_VIA_PLSQL\" ( in arr any )\n"
 "{\n"
 "declare str, s varchar;\n"
@@ -1859,9 +1919,10 @@ static const char *proc59 =
 "\n"
 "return str;\n"
 "}\n"
-"--src comp_tables.sql:38\n";
+"--src comp_tables.sql:37\n";
 
 static const char *proc60 = 
+"#line 56 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_RETRIEVE_TABLES_VIA_PLSQL\" ( in arr any, in out_type integer := 1 )\n"
 "{\n"
 "\n"
@@ -1946,9 +2007,10 @@ static const char *proc60 =
 "fin:\n"
 "return str;\n"
 "}\n"
-"--src comp_tables.sql:55\n";
+"--src comp_tables.sql:54\n";
 
 static const char *proc61 = 
+"#line 142 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_SELECT_LOCAL_TABLES_OUT\" (  in arr any )\n"
 "{\n"
 "http(\'<table CLASS=\"statdata\" border=0 rules=none><tr>\');\n"
@@ -2003,9 +2065,10 @@ static const char *proc61 =
 "http (\'select_all_local_tables ();\');\n"
 "http (\'</script>\');\n"
 "}\n"
-"--src comp_tables.sql:141\n";
+"--src comp_tables.sql:140\n";
 
 static const char *proc62 = 
+"#line 199 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_SELECT_QUALIFIER_FILTER_OUT\" (  in arr any )\n"
 "{\n"
 "http(\'<table class=\"genlist\" border=\"0\" cellpadding=\"0\">\');\n"
@@ -2027,9 +2090,10 @@ static const char *proc62 =
 "http(\'</tr>\');\n"
 "http(\'</table>\\n\');\n"
 "}\n"
-"--src comp_tables.sql:198\n";
+"--src comp_tables.sql:197\n";
 
 static const char *proc63 = 
+"#line 223 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_SELECT_DUMP_TYPE_OUT\" (  in arr any )\n"
 "{\n"
 "http(\'<table class=\"genlist\" border=\"0\" cellpadding=\"0\">\');\n"
@@ -2040,9 +2104,10 @@ static const char *proc63 =
 "\"PUMP\".\"DBA\".\"HTML_RADIO_OUT\" (arr, \'text_flag\', \'SQL=SQL&Binary=Binary\', NULL, NULL, NULL); \n"
 "http(\'</td></tr></table>\');\n"
 "}\n"
-"--src comp_tables.sql:222\n";
+"--src comp_tables.sql:221\n";
 
 static const char *proc64 = 
+"#line 236 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_CHOICE_TABLES\" (	inout arr any )\n"
 "{\n"
 "declare str varchar;\n"
@@ -2052,9 +2117,10 @@ static const char *proc64 =
 "\n"
 "return str;\n"
 "}\n"
-"--src comp_tables.sql:235\n";
+"--src comp_tables.sql:234\n";
 
 static const char *proc65 = 
+"#line 248 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"HTML_SELECT_TABLES_OUT\" (  in arr any )\n"
 "{\n"
 "\n"
@@ -2158,9 +2224,10 @@ static const char *proc65 =
 "http(\'</tr>\');\n"
 "http(\'</table>\\n\');\n"
 "}\n"
-"--src comp_tables.sql:247\n";
+"--src comp_tables.sql:246\n";
 
 static const char *proc66 = 
+"#line 354 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"DUMP_TABLES_AND_PARS_RETRIEVE\" ( inout pars any )\n"
 "{\n"
 "declare n integer;\n"
@@ -2175,9 +2242,10 @@ static const char *proc66 =
 "\n"
 "return outarr;\n"
 "}\n"
-"--src comp_tables.sql:353\n";
+"--src comp_tables.sql:352\n";
 
 static const char *proc67 = 
+"#line 371 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"DUMP_SCHEMA_AND_PARS_RETRIEVE\" ( inout pars any )\n"
 "{\n"
 "declare n integer;\n"
@@ -2192,9 +2260,10 @@ static const char *proc67 =
 "\n"
 "return outarr;\n"
 "}\n"
-"--src comp_tables.sql:370\n";
+"--src comp_tables.sql:369\n";
 
 static const char *proc68 = 
+"#line 389 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"RESTORE_TABLES_AND_PARS_RETRIEVE\" ( inout pars any )\n"
 "{\n"
 "declare n integer;\n"
@@ -2209,9 +2278,10 @@ static const char *proc68 =
 "\n"
 "return outarr;\n"
 "}\n"
-"--src comp_tables.sql:388\n";
+"--src comp_tables.sql:387\n";
 
 static const char *proc69 = 
+"#line 407 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"RESTORE_SCHEMA_AND_PARS_RETRIEVE\" ( inout pars any )\n"
 "{\n"
 "declare n integer;\n"
@@ -2226,9 +2296,10 @@ static const char *proc69 =
 "\n"
 "return outarr;\n"
 "}\n"
-"--src comp_tables.sql:406\n";
+"--src comp_tables.sql:405\n";
 
 static const char *proc70 = 
+"#line 424 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"CHK_ST_VALUE\" ( inout arr any, in pars any )\n"
 "{\n"
 "declare s any ;\n"
@@ -2250,9 +2321,10 @@ static const char *proc70 =
 "}\n"
 "\"PUMP\".\"DBA\".\"CHANGE_VAL\" (arr, \'choice_sav\', string_output_string(s));\n"
 "}\n"
-"--src comp_tables.sql:423\n";
+"--src comp_tables.sql:422\n";
 
 static const char *proc71 = 
+"#line 447 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"BACKUP_ALL_VIA_DBPUMP\" (	\n"
 "in username varchar,\n"
 "in passwd varchar,\n"
@@ -2290,9 +2362,10 @@ static const char *proc71 =
 "res := \"PUMP\".\"DBA\".\"DUMP_TABLES_AND_PARS_RETRIEVE\" (pars);\n"
 "return get_keyword (\'result_txt\', res, \'\');\n"
 "}\n"
-"--src comp_tables.sql:446\n";
+"--src comp_tables.sql:445\n";
 
 static const char *proc72 = 
+"#line 487 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"BACKUP_SCHEMA_VIA_DBPUMP\" (\n"
 "in username varchar,\n"
 "in passwd varchar,\n"
@@ -2326,9 +2399,10 @@ static const char *proc72 =
 "res := \"PUMP\".\"DBA\".\"DUMP_TABLES_AND_PARS_RETRIEVE\" (pars);\n"
 "return get_keyword (\'result_txt\', res, \'\');\n"
 "}\n"
-"--src comp_tables.sql:486\n";
+"--src comp_tables.sql:485\n";
 
 static const char *proc73 = 
+"#line 523 \"[executable]/comp_tables.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"RESTORE_DBPUMP\'S_FOLDER\" (\n"
 "in username varchar,\n"
 "in passwd varchar,\n"
@@ -2348,11 +2422,12 @@ static const char *proc73 =
 "res := \"PUMP\".\"DBA\".\"RESTORE_TABLES_AND_PARS_RETRIEVE\" (pars);\n"
 "return get_keyword (\'result_txt\', res, \'\');\n"
 "}\n"
-"--src comp_tables.sql:522\n";
+"--src comp_tables.sql:521\n";
 
 /* pars_init.sql */
 
 static const char *proc74 = 
+"#line 24 \"[executable]/pars_init.sql\"\n"
 "create procedure \"PUMP\".\"DBA\".\"RETRIEVE_HTTP_PARS\" ( in afrom any )\n"
 "{\n"
 "declare ato any;\n"
@@ -2448,7 +2523,7 @@ static const char *proc74 =
 "return ato;\n"
 "\n"
 "}\n"
-"--src pars_init.sql:23\n";
+"--src pars_init.sql:22\n";
 
 static int
 sch_proc_def_exists (client_connection_t *cli, const char *proc_name)
diff --git a/libsrc/Wi/sql_code_ddk.c b/libsrc/Wi/sql_code_ddk.c
index a2483dc..879bff7 100644
--- a/libsrc/Wi/sql_code_ddk.c
+++ b/libsrc/Wi/sql_code_ddk.c
@@ -103,20 +103,22 @@ static const char *tbl4 =
 "create index SYS_DAV_RES_IID on WS.WS.SYS_DAV_RES (RES_IID) partition (RES_IID int (0hexffff00))\n";
 
 static const char *proc0 = 
+"#line 113 \"[executable]/davddk.sql\"\n"
 "create procedure\n"
 "WS.WS.SYS_DAV_RES_RES_CONTENT_INDEX_HOOK (inout vtb any, inout d_id integer)\n"
 "{\n"
 "return 0;\n"
 "}\n"
-"--src davddk.sql:112\n";
+"--src davddk.sql:111\n";
 
 static const char *proc1 = 
+"#line 120 \"[executable]/davddk.sql\"\n"
 "create procedure\n"
 "WS.WS.SYS_DAV_RES_RES_CONTENT_UNINDEX_HOOK (inout vtb any, inout d_id integer)\n"
 "{\n"
 "return 0;\n"
 "}\n"
-"--src davddk.sql:119\n";
+"--src davddk.sql:118\n";
 
 static const char *other3 = 
 "DB.DBA.vt_create_text_index (\'WS.WS.SYS_DAV_RES\', \'RES_CONTENT\', \'RES_ID\', 2, 0, vector (\'RES_FULL_PATH\', \'RES_OWNER\', \'RES_MOD_TIME\', \'RES_TYPE\'), 1, \'*ini*\', \'*ini*\')\n";
@@ -298,6 +300,7 @@ static const char *tbl17 =
 "create index SYS_DAV_TAG_U_ID on WS.WS.SYS_DAV_TAG (DT_U_ID) partition (DT_U_ID int)\n";
 
 static const char *proc2 = 
+"#line 363 \"[executable]/davddk.sql\"\n"
 " create function WS.WS.DAV_TAG_NORMALIZE (in strg varchar) returns varchar\n"
 "{\n"
 "declare words any;\n"
@@ -330,9 +333,10 @@ static const char *proc2 =
 "}\n"
 "return norm;\n"
 "}\n"
-"--src davddk.sql:362\n";
+"--src davddk.sql:361\n";
 
 static const char *proc3 = 
+"#line 397 \"[executable]/davddk.sql\"\n"
 "create procedure\n"
 "WS.WS.SYS_DAV_TAG_DT_TAGS_INDEX_HOOK (inout vtb any, inout d_id integer)\n"
 "{\n"
@@ -344,9 +348,10 @@ static const char *proc3 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src davddk.sql:396\n";
+"--src davddk.sql:395\n";
 
 static const char *proc4 = 
+"#line 410 \"[executable]/davddk.sql\"\n"
 "create procedure\n"
 "WS.WS.SYS_DAV_TAG_DT_TAGS_UNINDEX_HOOK (inout vtb any, inout d_id integer)\n"
 "{\n"
@@ -358,11 +363,12 @@ static const char *proc4 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src davddk.sql:409\n";
+"--src davddk.sql:408\n";
 
 static const char *other5 = 
 "DB.DBA.vt_create_text_index (\'WS.WS.SYS_DAV_TAG\', \'DT_TAGS\', \'DT_FT_ID\', 2, 0, vector (\'DT_U_ID\', \'DT_RES_ID\'), 1, \'x-ViDoc\', \'*ini*\')\n";
 static const char *proc5 = 
+"#line 430 \"[executable]/davddk.sql\"\n"
 "create procedure WS.WS.GETID (in type varchar)\n"
 "{\n"
 "declare id, nid integer;\n"
@@ -471,9 +477,10 @@ static const char *proc5 =
 "return_id:\n"
 "return id;\n"
 "}\n"
-"--src davddk.sql:429\n";
+"--src davddk.sql:428\n";
 
 static const char *proc6 = 
+"#line 541 \"[executable]/davddk.sql\"\n"
 "create procedure WS.WS.COL_PATH (in _id any)\n"
 "{\n"
 "declare _path, _name varchar;\n"
@@ -492,9 +499,10 @@ static const char *proc6 =
 "nf:\n"
 "return NULL;\n"
 "}\n"
-"--src davddk.sql:540\n";
+"--src davddk.sql:539\n";
 
 static const char *proc7 = 
+"#line 562 \"[executable]/davddk.sql\"\n"
 "create function DB.DBA.DAV_CHANGED_FUNCTIONS () returns any\n"
 "{\n"
 "return vector (\n"
@@ -932,9 +940,10 @@ static const char *proc7 =
 "\'WS.WS.SYS_DAV_COL_INIT\'\n"
 ");\n"
 "}\n"
-"--src davddk.sql:561\n";
+"--src davddk.sql:560\n";
 
 static const char *proc8 = 
+"#line 1003 \"[executable]/davddk.sql\"\n"
 "create procedure WS.WS.SYS_DAV_INIT ()\n"
 "{\n"
 "declare dav_status varchar;\n"
@@ -1067,20 +1076,22 @@ static const char *proc8 =
 "__atomic (0);\n"
 "return;\n"
 "}\n"
-"--src davddk.sql:1002\n";
+"--src davddk.sql:1001\n";
 
 static const char *proc9 = 
+"#line 1137 \"[executable]/davddk.sql\"\n"
 "create procedure WS.WS.SYS_DAV_INIT_1 ()\n"
 "{\n"
 "if (sys_stat (\'cl_run_local_only\') <> 1)\n"
 "return;\n"
 "WS.WS.SYS_DAV_INIT ();\n"
 "}\n"
-"--src davddk.sql:1136\n";
+"--src davddk.sql:1135\n";
 
 static const char *other6 = 
 "WS.WS.SYS_DAV_INIT_1 ()\n";
 static const char *proc10 = 
+"#line 1148 \"[executable]/davddk.sql\"\n"
 "create procedure\n"
 "WS.WS.SYS_DAV_PROP_PROP_VALUE_INDEX_HOOK (inout vtb any, inout d_id integer)\n"
 "{\n"
@@ -1105,9 +1116,10 @@ static const char *proc10 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src davddk.sql:1147\n";
+"--src davddk.sql:1146\n";
 
 static const char *proc11 = 
+"#line 1174 \"[executable]/davddk.sql\"\n"
 "create procedure\n"
 "WS.WS.SYS_DAV_PROP_PROP_VALUE_UNINDEX_HOOK (inout vtb any, inout d_id integer)\n"
 "{\n"
@@ -1132,7 +1144,7 @@ static const char *proc11 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src davddk.sql:1173\n";
+"--src davddk.sql:1172\n";
 
 static const char *other7 = 
 "DB.DBA.vt_create_text_index (\'WS.WS.SYS_DAV_PROP\', \'PROP_VALUE\', \'PROP_ID\', 2, 0, vector (), 1, \'*ini*\', \'*ini*\')\n";
@@ -1199,288 +1211,1650 @@ static const char *other37 =
 static const char *other38 = 
 "insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/rdf+xml\',\'rdf\')\n";
 static const char *other39 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/annotea+xml\',\'annotea\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/rdf+xml\',\'owl\')\n";
 static const char *other40 = 
-"update WS.WS.SYS_DAV_RES_TYPES set T_TYPE=\'application/rdf+xml\' where T_TYPE <> \'application/rdf+xml\' and T_EXT = \'rdf\'\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/annotea+xml\',\'annotea\')\n";
 static const char *other41 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pdf\',\'pdf\')\n";
+"update WS.WS.SYS_DAV_RES_TYPES set T_TYPE=\'application/rdf+xml\' where T_TYPE <> \'application/rdf+xml\' and T_EXT = \'rdf\'\n";
 static const char *other42 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/postscript\',\'ai\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pdf\',\'pdf\')\n";
 static const char *other43 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/postscript\',\'eps\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/postscript\',\'ai\')\n";
 static const char *other44 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/postscript\',\'ps\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/postscript\',\'eps\')\n";
 static const char *other45 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/rss+xml\',\'rss\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/postscript\',\'ps\')\n";
 static const char *other46 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/smil\',\'smil\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/rss+xml\',\'rss\')\n";
 static const char *other47 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/smil\',\'smi\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/smil\',\'smil\')\n";
 static const char *other48 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/wsdl+xml\',\'wsdl\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/smil\',\'smi\')\n";
 static const char *other49 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xbel+xml\',\'xbel\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/wsdl+xml\',\'wsdl\')\n";
 static const char *other50 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-bcpio\',\'bcpio\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xbel+xml\',\'xbel\')\n";
 static const char *other51 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-cdlink\',\'vcd\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-bcpio\',\'bcpio\')\n";
 static const char *other52 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-chess-pgn\',\'pgn\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-cdlink\',\'vcd\')\n";
 static const char *other53 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-cpio\',\'cpio\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-chess-pgn\',\'pgn\')\n";
 static const char *other54 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-csh\',\'csh\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-cpio\',\'cpio\')\n";
 static const char *other55 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-director\',\'dcr\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-csh\',\'csh\')\n";
 static const char *other56 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-director\',\'dir\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-director\',\'dcr\')\n";
 static const char *other57 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-director\',\'dxr\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-director\',\'dir\')\n";
 static const char *other58 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-dvi\',\'dvi\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-director\',\'dxr\')\n";
 static const char *other59 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-futuresplash\',\'spl\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-dvi\',\'dvi\')\n";
 static const char *other60 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-gtar\',\'gtar\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-futuresplash\',\'spl\')\n";
 static const char *other61 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-hdf\',\'hdf\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-gtar\',\'gtar\')\n";
 static const char *other62 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-javascript\',\'js\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-hdf\',\'hdf\')\n";
 static const char *other63 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-koan\',\'skp\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-javascript\',\'js\')\n";
 static const char *other64 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-koan\',\'skd\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-koan\',\'skp\')\n";
 static const char *other65 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-koan\',\'skt\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-koan\',\'skd\')\n";
 static const char *other66 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-koan\',\'skm\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-koan\',\'skt\')\n";
 static const char *other67 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-latex\',\'latex\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-koan\',\'skm\')\n";
 static const char *other68 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-netcdf\',\'cdf\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-latex\',\'latex\')\n";
 static const char *other69 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-netcdf\',\'nc\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-netcdf\',\'cdf\')\n";
 static const char *other70 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-openlinksw-vspx+xml\',\'vspx\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-netcdf\',\'nc\')\n";
 static const char *other71 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-rpm\',\'rpm\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-openlinksw-vspx+xml\',\'vspx\')\n";
 static const char *other72 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-sh\',\'sh\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-rpm\',\'rpm\')\n";
 static const char *other73 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-shar\',\'shar\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-sh\',\'sh\')\n";
 static const char *other74 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-shockwave-flash\',\'swf\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-shar\',\'shar\')\n";
 static const char *other75 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-stuffit\',\'sit\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-shockwave-flash\',\'swf\')\n";
 static const char *other76 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-sv4cpio\',\'sv4cpio\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-stuffit\',\'sit\')\n";
 static const char *other77 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-sv4crc\',\'sv4crc\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-sv4cpio\',\'sv4cpio\')\n";
 static const char *other78 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-tar\',\'tar\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-sv4crc\',\'sv4crc\')\n";
 static const char *other79 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-tcl\',\'tcl\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-tar\',\'tar\')\n";
 static const char *other80 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-tex\',\'tex\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-tcl\',\'tcl\')\n";
 static const char *other81 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-texinfo\',\'texinfo\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-tex\',\'tex\')\n";
 static const char *other82 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-texinfo\',\'texi\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-texinfo\',\'texinfo\')\n";
 static const char *other83 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-troff\',\'t\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-texinfo\',\'texi\')\n";
 static const char *other84 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-troff\',\'tr\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-troff\',\'t\')\n";
 static const char *other85 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-troff\',\'roff\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-troff\',\'tr\')\n";
 static const char *other86 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-troff-man\',\'man\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-troff\',\'roff\')\n";
 static const char *other87 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-troff-me\',\'me\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-troff-man\',\'man\')\n";
 static const char *other88 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-troff-ms\',\'ms\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-troff-me\',\'me\')\n";
 static const char *other89 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-ustar\',\'ustar\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-troff-ms\',\'ms\')\n";
 static const char *other90 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-wais-source\',\'src\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-ustar\',\'ustar\')\n";
 static const char *other91 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/zip\',\'zip\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-wais-source\',\'src\')\n";
 static const char *other92 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/basic\',\'au\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/zip\',\'zip\')\n";
 static const char *other93 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/basic\',\'snd\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/basic\',\'au\')\n";
 static const char *other94 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/midi\',\'mid\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/basic\',\'snd\')\n";
 static const char *other95 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/midi\',\'kar\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/midi\',\'mid\')\n";
 static const char *other96 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/midi\',\'midi\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/midi\',\'kar\')\n";
 static const char *other97 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/mpeg\',\'mpga\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/midi\',\'midi\')\n";
 static const char *other98 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/mpeg\',\'mp2\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/mpeg\',\'mpga\')\n";
 static const char *other99 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/mpeg\',\'mp3\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/mpeg\',\'mp2\')\n";
 static const char *other100 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-aiff\',\'aif\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/mpeg\',\'mp3\')\n";
 static const char *other101 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-aiff\',\'aiff\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-aiff\',\'aif\')\n";
 static const char *other102 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-aiff\',\'aifc\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-aiff\',\'aiff\')\n";
 static const char *other103 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-flac\',\'flac\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-aiff\',\'aifc\')\n";
 static const char *other104 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-mp3\',\'mp3\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-flac\',\'flac\')\n";
 static const char *other105 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-m4a\',\'m4a\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-mp3\',\'mp3\')\n";
 static const char *other106 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-m4p\',\'m4p\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-m4a\',\'m4a\')\n";
 static const char *other107 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-pn-realaudio\',\'ram\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-m4p\',\'m4p\')\n";
 static const char *other108 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-pn-realaudio\',\'rm\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-pn-realaudio\',\'ram\')\n";
 static const char *other109 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-realaudio\',\'ra\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-pn-realaudio\',\'rm\')\n";
 static const char *other110 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-wav\',\'wav\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-realaudio\',\'ra\')\n";
 static const char *other111 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'chemical/x-pdb\',\'pdb\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-wav\',\'wav\')\n";
 static const char *other112 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'chemical/x-pdb\',\'xyz\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'chemical/x-pdb\',\'pdb\')\n";
 static const char *other113 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/gif\',\'gif\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'chemical/x-pdb\',\'xyz\')\n";
 static const char *other114 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/ief\',\'ief\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/gif\',\'gif\')\n";
 static const char *other115 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/jpeg\',\'jpeg\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/ief\',\'ief\')\n";
 static const char *other116 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/jpeg\',\'jpg\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/jpeg\',\'jpeg\')\n";
 static const char *other117 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/jpeg\',\'jpe\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/jpeg\',\'jpg\')\n";
 static const char *other118 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/png\',\'png\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/jpeg\',\'jpe\')\n";
 static const char *other119 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/svg+xml\',\'svg\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/png\',\'png\')\n";
 static const char *other120 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/tiff\',\'tif\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/svg+xml\',\'svg\')\n";
 static const char *other121 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/tiff\',\'tiff\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/tiff\',\'tif\')\n";
 static const char *other122 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-cmu-raster\',\'ras\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/tiff\',\'tiff\')\n";
 static const char *other123 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-portable-anymap\',\'pnm\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-cmu-raster\',\'ras\')\n";
 static const char *other124 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-portable-bitmap\',\'pbm\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-portable-anymap\',\'pnm\')\n";
 static const char *other125 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-portable-graymap\',\'pgm\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-portable-bitmap\',\'pbm\')\n";
 static const char *other126 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-portable-pixmap\',\'ppm\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-portable-graymap\',\'pgm\')\n";
 static const char *other127 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-rgb\',\'rgb\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-portable-pixmap\',\'ppm\')\n";
 static const char *other128 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-xbitmap\',\'xbm\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-rgb\',\'rgb\')\n";
 static const char *other129 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-xpixmap\',\'xpm\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-xbitmap\',\'xbm\')\n";
 static const char *other130 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-xwindowdump\',\'xwd\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-xpixmap\',\'xpm\')\n";
 static const char *other131 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/iges\',\'iges\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-xwindowdump\',\'xwd\')\n";
 static const char *other132 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/iges\',\'igs\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/iges\',\'iges\')\n";
 static const char *other133 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/mesh\',\'silo\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/iges\',\'igs\')\n";
 static const char *other134 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/mesh\',\'mesh\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/mesh\',\'silo\')\n";
 static const char *other135 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/mesh\',\'msh\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/mesh\',\'mesh\')\n";
 static const char *other136 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/vrml\',\'vrml\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/mesh\',\'msh\')\n";
 static const char *other137 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/vrml\',\'wrl\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/vrml\',\'vrml\')\n";
 static const char *other138 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/directory\',\'ical\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/vrml\',\'wrl\')\n";
 static const char *other139 = 
-"insert replacing WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/calendar\',\'ics\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/directory\',\'ical\')\n";
 static const char *other140 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/directory\',\'vcard\')\n";
+"insert replacing WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/calendar\',\'ics\')\n";
 static const char *other141 = 
-"insert replacing WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-vCard\',\'vcf\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/directory\',\'vcard\')\n";
 static const char *other142 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/css\',\'css\')\n";
+"insert replacing WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-vCard\',\'vcf\')\n";
 static const char *other143 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/plain\',\'txt\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/css\',\'css\')\n";
 static const char *other144 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/plain\',\'asc\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/plain\',\'txt\')\n";
 static const char *other145 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/richtext\',\'rtx\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/plain\',\'asc\')\n";
 static const char *other146 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/rtf\',\'rtf\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/richtext\',\'rtx\')\n";
 static const char *other147 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/sgml\',\'sgm\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/rtf\',\'rtf\')\n";
 static const char *other148 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/sgml\',\'sgml\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/sgml\',\'sgm\')\n";
 static const char *other149 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/tab-separated-values\',\'tsv\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/sgml\',\'sgml\')\n";
 static const char *other150 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-setext\',\'etx\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/tab-separated-values\',\'tsv\')\n";
 static const char *other151 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/xml\',\'xml\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-setext\',\'etx\')\n";
 static const char *other152 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/xml\',\'xmltxt\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/xml\',\'xml\')\n";
 static const char *other153 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mpeg\',\'mpe\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/xml\',\'xmltxt\')\n";
 static const char *other154 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mpeg\',\'mpeg\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mpeg\',\'mpe\')\n";
 static const char *other155 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mpeg\',\'mpg\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mpeg\',\'mpeg\')\n";
 static const char *other156 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/quicktime\',\'mov\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mpeg\',\'mpg\')\n";
 static const char *other157 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/quicktime\',\'qt\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/quicktime\',\'mov\')\n";
 static const char *other158 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-msvideo\',\'avi\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/quicktime\',\'qt\')\n";
 static const char *other159 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-sgi-movie\',\'movie\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-msvideo\',\'avi\')\n";
 static const char *other160 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'x-conference/x-cooltalk\',\'ice\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-sgi-movie\',\'movie\')\n";
 static const char *other161 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/html\',\'htm\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'x-conference/x-cooltalk\',\'ice\')\n";
 static const char *other162 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/html\',\'html\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/html\',\'htm\')\n";
 static const char *other163 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/xsl\',\'xsl\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/html\',\'html\')\n";
 static const char *other164 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/html\',\'asp\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/xsl\',\'xsl\')\n";
 static const char *other165 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/html\',\'php\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/html\',\'asp\')\n";
 static const char *other166 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/html\',\'php3\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/html\',\'php\')\n";
 static const char *other167 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/plain\',\'sql\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/html\',\'php3\')\n";
 static const char *other168 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/xml\',\'xsd\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/plain\',\'sql\')\n";
 static const char *other169 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/xml\',\'dtd\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/xml\',\'xsd\')\n";
 static const char *other170 = 
-"insert replacing WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/ocs+xml\',\'ocs\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/xml\',\'dtd\')\n";
 static const char *other171 = 
-"insert replacing WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/opml+xml\',\'opml\')\n";
+"insert replacing WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/ocs+xml\',\'ocs\')\n";
 static const char *other172 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/xml\',\'rss\')\n";
+"insert replacing WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/opml+xml\',\'opml\')\n";
 static const char *other173 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/bmp\',\'bmp\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/xml\',\'rss\')\n";
 static const char *other174 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mp4\',\'mp4\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/bmp\',\'bmp\')\n";
 static const char *other175 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/3gpp\',\'3gp\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mp4\',\'mp4\')\n";
 static const char *other176 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/amr\',\'amr\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/3gpp\',\'3gp\')\n";
 static const char *other177 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/rdf+ttl\',\'ttl\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/amr\',\'amr\')\n";
 static const char *other178 = 
-"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/rdf+n3\',\'n3\')\n";
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/rdf+ttl\',\'ttl\')\n";
 static const char *other179 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/rdf+n3\',\'n3\')\n";
+static const char *other180 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-ms-application\',\'application\')\n";
+static const char *other181 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-ms-manifest\',\'manifest\')\n";
+static const char *other182 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'deploy\')\n";
+static const char *other183 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'msp\')\n";
+static const char *other184 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'msu\')\n";
+static const char *other185 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-ms-vsto\',\'vsto\')\n";
+static const char *other186 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xaml+xml\',\'xaml\')\n";
+static const char *other187 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-ms-xbap\',\'xbap\')\n";
+static const char *other188 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/applixware\',\'aw\')\n";
+static const char *other189 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/atomcat+xml\',\'atomcat\')\n";
+static const char *other190 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/atomsvc+xml\',\'atomsvc\')\n";
+static const char *other191 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/atom+xml\',\'atom\')\n";
+static const char *other192 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/ccxml+xml\',\'ccxml\')\n";
+static const char *other193 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/cu-seeme\',\'cu\')\n";
+static const char *other194 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/davmount+xml\',\'davmount\')\n";
+static const char *other195 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/dssc+der\',\'dssc\')\n";
+static const char *other196 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/dssc+xml\',\'xdssc\')\n";
+static const char *other197 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/ecmascript\',\'ecma\')\n";
+static const char *other198 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/emma+xml\',\'emma\')\n";
+static const char *other199 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/epub+zip\',\'epub\')\n";
+static const char *other200 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/font-tdpfr\',\'pfr\')\n";
+static const char *other201 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/hyperstudio\',\'stk\')\n";
+static const char *other202 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/ipfix\',\'ipfix\')\n";
+static const char *other203 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/java-archive\',\'jar\')\n";
+static const char *other204 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/java-serialized-object\',\'ser\')\n";
+static const char *other205 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/json\',\'json\')\n";
+static const char *other206 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/lost+xml\',\'lostxml\')\n";
+static const char *other207 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/marc\',\'mrc\')\n";
+static const char *other208 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/mathematica\',\'ma\')\n";
+static const char *other209 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/mathematica\',\'nb\')\n";
+static const char *other210 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/mathematica\',\'mb\')\n";
+static const char *other211 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/mathml+xml\',\'mathml\')\n";
+static const char *other212 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/mbox\',\'mbox\')\n";
+static const char *other213 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/mediaservercontrol+xml\',\'mscml\')\n";
+static const char *other214 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/mp4\',\'mp4s\')\n";
+static const char *other215 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/msword\',\'dot\')\n";
+static const char *other216 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/mxf\',\'mxf\')\n";
+static const char *other217 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'lrf\')\n";
+static const char *other218 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'so\')\n";
+static const char *other219 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'iso\')\n";
+static const char *other220 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'dmg\')\n";
+static const char *other221 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'dist\')\n";
+static const char *other222 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'distz\')\n";
+static const char *other223 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'pkg\')\n";
+static const char *other224 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'bpk\')\n";
+static const char *other225 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'dump\')\n";
+static const char *other226 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/octet-stream\',\'elc\')\n";
+static const char *other227 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/oebps-package+xml\',\'opf\')\n";
+static const char *other228 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/ogg\',\'ogx\')\n";
+static const char *other229 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/onenote\',\'onetoc\')\n";
+static const char *other230 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/onenote\',\'onetoc2\')\n";
+static const char *other231 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/onenote\',\'onetmp\')\n";
+static const char *other232 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/onenote\',\'onepkg\')\n";
+static const char *other233 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/patch-ops-error+xml\',\'xer\')\n";
+static const char *other234 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pgp-encrypted\',\'pgp\')\n";
+static const char *other235 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pgp-signature\',\'sig\')\n";
+static const char *other236 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pics-rules\',\'prf\')\n";
+static const char *other237 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pkcs10\',\'p10\')\n";
+static const char *other238 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pkcs7-mime\',\'p7m\')\n";
+static const char *other239 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pkcs7-mime\',\'p7c\')\n";
+static const char *other240 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pkcs7-signature\',\'p7s\')\n";
+static const char *other241 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pkix-cert\',\'cer\')\n";
+static const char *other242 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pkixcmp\',\'pki\')\n";
+static const char *other243 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pkix-crl\',\'crl\')\n";
+static const char *other244 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pkix-pkipath\',\'pkipath\')\n";
+static const char *other245 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/pls+xml\',\'pls\')\n";
+static const char *other246 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/prs.cww\',\'cww\')\n";
+static const char *other247 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/reginfo+xml\',\'rif\')\n";
+static const char *other248 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/relax-ng-compact-syntax\',\'rnc\')\n";
+static const char *other249 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/resource-lists-diff+xml\',\'rld\')\n";
+static const char *other250 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/resource-lists+xml\',\'rl\')\n";
+static const char *other251 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/rls-services+xml\',\'rs\')\n";
+static const char *other252 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/rsd+xml\',\'rsd\')\n";
+static const char *other253 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/sbml+xml\',\'sbml\')\n";
+static const char *other254 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/scvp-cv-request\',\'scq\')\n";
+static const char *other255 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/scvp-cv-response\',\'scs\')\n";
+static const char *other256 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/scvp-vp-request\',\'spq\')\n";
+static const char *other257 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/scvp-vp-response\',\'spp\')\n";
+static const char *other258 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/sdp\',\'sdp\')\n";
+static const char *other259 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/set-payment-initiation\',\'setpay\')\n";
+static const char *other260 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/set-registration-initiation\',\'setreg\')\n";
+static const char *other261 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/shf+xml\',\'shf\')\n";
+static const char *other262 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/sparql-query\',\'rq\')\n";
+static const char *other263 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/sparql-results+xml\',\'srx\')\n";
+static const char *other264 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/srgs\',\'gram\')\n";
+static const char *other265 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/srgs+xml\',\'grxml\')\n";
+static const char *other266 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/ssml+xml\',\'ssml\')\n";
+static const char *other267 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.3gpp2.tcap\',\'tcap\')\n";
+static const char *other268 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.3gpp.pic-bw-large\',\'plb\')\n";
+static const char *other269 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.3gpp.pic-bw-small\',\'psb\')\n";
+static const char *other270 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.3gpp.pic-bw-var\',\'pvb\')\n";
+static const char *other271 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.3m.post-it-notes\',\'pwn\')\n";
+static const char *other272 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.accpac.simply.aso\',\'aso\')\n";
+static const char *other273 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.accpac.simply.imp\',\'imp\')\n";
+static const char *other274 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.acucobol\',\'acu\')\n";
+static const char *other275 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.acucorp\',\'atc\')\n";
+static const char *other276 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.acucorp\',\'acutc\')\n";
+static const char *other277 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.adobe.air-application-installer-package+zip\',\'air\')\n";
+static const char *other278 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.adobe.xdp+xml\',\'xdp\')\n";
+static const char *other279 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.adobe.xfdf\',\'xfdf\')\n";
+static const char *other280 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.airzip.filesecure.azf\',\'azf\')\n";
+static const char *other281 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.airzip.filesecure.azs\',\'azs\')\n";
+static const char *other282 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.amazon.ebook\',\'azw\')\n";
+static const char *other283 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.americandynamics.acc\',\'acc\')\n";
+static const char *other284 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.amiga.ami\',\'ami\')\n";
+static const char *other285 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.android.package-archive\',\'apk\')\n";
+static const char *other286 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.anser-web-certificate-issue-initiation\',\'cii\')\n";
+static const char *other287 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.anser-web-funds-transfer-initiation\',\'fti\')\n";
+static const char *other288 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.antix.game-component\',\'atx\')\n";
+static const char *other289 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.apple.installer+xml\',\'mpkg\')\n";
+static const char *other290 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.apple.mpegurl\',\'m3u8\')\n";
+static const char *other291 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.aristanetworks.swi\',\'swi\')\n";
+static const char *other292 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.audiograph\',\'aep\')\n";
+static const char *other293 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.blueice.multipass\',\'mpm\')\n";
+static const char *other294 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.bmi\',\'bmi\')\n";
+static const char *other295 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.businessobjects\',\'rep\')\n";
+static const char *other296 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.chemdraw+xml\',\'cdxml\')\n";
+static const char *other297 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.chipnuts.karaoke-mmd\',\'mmd\')\n";
+static const char *other298 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.cinderella\',\'cdy\')\n";
+static const char *other299 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.claymore\',\'cla\')\n";
+static const char *other300 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.cloanto.rp9\',\'rp9\')\n";
+static const char *other301 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.clonk.c4group\',\'c4g\')\n";
+static const char *other302 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.clonk.c4group\',\'c4d\')\n";
+static const char *other303 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.clonk.c4group\',\'c4f\')\n";
+static const char *other304 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.clonk.c4group\',\'c4p\')\n";
+static const char *other305 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.clonk.c4group\',\'c4u\')\n";
+static const char *other306 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.commonspace\',\'csp\')\n";
+static const char *other307 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.contact.cmsg\',\'cdbcmsg\')\n";
+static const char *other308 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.cosmocaller\',\'cmc\')\n";
+static const char *other309 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.crick.clicker\',\'clkx\')\n";
+static const char *other310 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.crick.clicker.keyboard\',\'clkk\')\n";
+static const char *other311 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.crick.clicker.palette\',\'clkp\')\n";
+static const char *other312 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.crick.clicker.template\',\'clkt\')\n";
+static const char *other313 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.crick.clicker.wordbank\',\'clkw\')\n";
+static const char *other314 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.criticaltools.wbs+xml\',\'wbs\')\n";
+static const char *other315 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ctc-posml\',\'pml\')\n";
+static const char *other316 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.cups-ppd\',\'ppd\')\n";
+static const char *other317 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.curl.car\',\'car\')\n";
+static const char *other318 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.curl.pcurl\',\'pcurl\')\n";
+static const char *other319 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.data-vision.rdz\',\'rdz\')\n";
+static const char *other320 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.denovo.fcselayout-link\',\'fe_launch\')\n";
+static const char *other321 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.dna\',\'dna\')\n";
+static const char *other322 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.dolby.mlp\',\'mlp\')\n";
+static const char *other323 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.dpgraph\',\'dpg\')\n";
+static const char *other324 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.dreamfactory\',\'dfac\')\n";
+static const char *other325 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.dynageo\',\'geo\')\n";
+static const char *other326 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ecowin.chart\',\'mag\')\n";
+static const char *other327 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.enliven\',\'nml\')\n";
+static const char *other328 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.epson.esf\',\'esf\')\n";
+static const char *other329 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.epson.msf\',\'msf\')\n";
+static const char *other330 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.epson.quickanime\',\'qam\')\n";
+static const char *other331 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.epson.salt\',\'slt\')\n";
+static const char *other332 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.epson.ssf\',\'ssf\')\n";
+static const char *other333 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.eszigno3+xml\',\'es3\')\n";
+static const char *other334 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.eszigno3+xml\',\'et3\')\n";
+static const char *other335 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ezpix-album\',\'ez2\')\n";
+static const char *other336 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ezpix-package\',\'ez3\')\n";
+static const char *other337 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fdf\',\'fdf\')\n";
+static const char *other338 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fdsn.mseed\',\'mseed\')\n";
+static const char *other339 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fdsn.seed\',\'seed\')\n";
+static const char *other340 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fdsn.seed\',\'dataless\')\n";
+static const char *other341 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.flographit\',\'gph\')\n";
+static const char *other342 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fluxtime.clip\',\'ftc\')\n";
+static const char *other343 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.framemaker\',\'fm\')\n";
+static const char *other344 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.framemaker\',\'frame\')\n";
+static const char *other345 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.framemaker\',\'maker\')\n";
+static const char *other346 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.framemaker\',\'book\')\n";
+static const char *other347 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.frogans.fnc\',\'fnc\')\n";
+static const char *other348 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.frogans.ltf\',\'ltf\')\n";
+static const char *other349 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fsc.weblaunch\',\'fsc\')\n";
+static const char *other350 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fujitsu.oasys\',\'oas\')\n";
+static const char *other351 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fujitsu.oasys2\',\'oa2\')\n";
+static const char *other352 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fujitsu.oasys3\',\'oa3\')\n";
+static const char *other353 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fujitsu.oasysgp\',\'fg5\')\n";
+static const char *other354 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fujitsu.oasysprs\',\'bh2\')\n";
+static const char *other355 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fujixerox.ddd\',\'ddd\')\n";
+static const char *other356 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fujixerox.docuworks\',\'xdw\')\n";
+static const char *other357 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fujixerox.docuworks.binder\',\'xbd\')\n";
+static const char *other358 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.fuzzysheet\',\'fzs\')\n";
+static const char *other359 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.genomatix.tuxedo\',\'txd\')\n";
+static const char *other360 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.geogebra.file\',\'ggb\')\n";
+static const char *other361 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.geogebra.tool\',\'ggt\')\n";
+static const char *other362 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.geometry-explorer\',\'gex\')\n";
+static const char *other363 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.geometry-explorer\',\'gre\')\n";
+static const char *other364 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.geonext\',\'gxt\')\n";
+static const char *other365 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.geoplan\',\'g2w\')\n";
+static const char *other366 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.geospace\',\'g3w\')\n";
+static const char *other367 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.gmx\',\'gmx\')\n";
+static const char *other368 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.google-earth.kml+xml\',\'kml\')\n";
+static const char *other369 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.google-earth.kmz\',\'kmz\')\n";
+static const char *other370 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.grafeq\',\'gqf\')\n";
+static const char *other371 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.grafeq\',\'gqs\')\n";
+static const char *other372 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.groove-account\',\'gac\')\n";
+static const char *other373 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.groove-help\',\'ghf\')\n";
+static const char *other374 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.groove-identity-message\',\'gim\')\n";
+static const char *other375 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.groove-injector\',\'grv\')\n";
+static const char *other376 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.groove-tool-message\',\'gtm\')\n";
+static const char *other377 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.groove-tool-template\',\'tpl\')\n";
+static const char *other378 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.groove-vcard\',\'vcg\')\n";
+static const char *other379 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.handheld-entertainment+xml\',\'zmm\')\n";
+static const char *other380 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.hbci\',\'hbci\')\n";
+static const char *other381 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.hhe.lesson-player\',\'les\')\n";
+static const char *other382 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.hp-hpgl\',\'hpgl\')\n";
+static const char *other383 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.hp-hpid\',\'hpid\')\n";
+static const char *other384 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.hp-hps\',\'hps\')\n";
+static const char *other385 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.hp-jlyt\',\'jlt\')\n";
+static const char *other386 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.hp-pcl\',\'pcl\')\n";
+static const char *other387 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.hp-pclxl\',\'pclxl\')\n";
+static const char *other388 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.hydrostatix.sof-data\',\'sfd-hdstx\')\n";
+static const char *other389 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.hzn-3d-crossword\',\'x3d\')\n";
+static const char *other390 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ibm.minipay\',\'mpy\')\n";
+static const char *other391 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ibm.modcap\',\'afp\')\n";
+static const char *other392 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ibm.modcap\',\'listafp\')\n";
+static const char *other393 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ibm.modcap\',\'list3820\')\n";
+static const char *other394 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ibm.rights-management\',\'irm\')\n";
+static const char *other395 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ibm.secure-container\',\'sc\')\n";
+static const char *other396 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.iccprofile\',\'icc\')\n";
+static const char *other397 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.iccprofile\',\'icm\')\n";
+static const char *other398 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.igloader\',\'igl\')\n";
+static const char *other399 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.immervision-ivp\',\'ivp\')\n";
+static const char *other400 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.immervision-ivu\',\'ivu\')\n";
+static const char *other401 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.intercon.formnet\',\'xpw\')\n";
+static const char *other402 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.intercon.formnet\',\'xpx\')\n";
+static const char *other403 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.intu.qbo\',\'qbo\')\n";
+static const char *other404 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.intu.qfx\',\'qfx\')\n";
+static const char *other405 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ipunplugged.rcprofile\',\'rcprofile\')\n";
+static const char *other406 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.irepository.package+xml\',\'irp\')\n";
+static const char *other407 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.is-xpr\',\'xpr\')\n";
+static const char *other408 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.jam\',\'jam\')\n";
+static const char *other409 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.jcp.javame.midlet-rms\',\'rms\')\n";
+static const char *other410 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.jisp\',\'jisp\')\n";
+static const char *other411 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.joost.joda-archive\',\'joda\')\n";
+static const char *other412 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kahootz\',\'ktz\')\n";
+static const char *other413 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kahootz\',\'ktr\')\n";
+static const char *other414 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kde.karbon\',\'karbon\')\n";
+static const char *other415 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kde.kchart\',\'chrt\')\n";
+static const char *other416 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kde.kformula\',\'kfo\')\n";
+static const char *other417 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kde.kivio\',\'flw\')\n";
+static const char *other418 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kde.kontour\',\'kon\')\n";
+static const char *other419 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kde.kpresenter\',\'kpr\')\n";
+static const char *other420 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kde.kpresenter\',\'kpt\')\n";
+static const char *other421 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kde.kspread\',\'ksp\')\n";
+static const char *other422 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kde.kword\',\'kwd\')\n";
+static const char *other423 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kde.kword\',\'kwt\')\n";
+static const char *other424 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kenameaapp\',\'htke\')\n";
+static const char *other425 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kidspiration\',\'kia\')\n";
+static const char *other426 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kinar\',\'kne\')\n";
+static const char *other427 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kinar\',\'knp\')\n";
+static const char *other428 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.kodak-descriptor\',\'sse\')\n";
+static const char *other429 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.llamagraphics.life-balance.desktop\',\'lbd\')\n";
+static const char *other430 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.llamagraphics.life-balance.exchange+xml\',\'lbe\')\n";
+static const char *other431 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.lotus-1-2-3\',\'123\')\n";
+static const char *other432 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.lotus-approach\',\'apr\')\n";
+static const char *other433 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.lotus-freelance\',\'pre\')\n";
+static const char *other434 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.lotus-notes\',\'nsf\')\n";
+static const char *other435 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.lotus-organizer\',\'org\')\n";
+static const char *other436 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.lotus-screencam\',\'scm\')\n";
+static const char *other437 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.lotus-wordpro\',\'lwp\')\n";
+static const char *other438 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.macports.portpkg\',\'portpkg\')\n";
+static const char *other439 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mcd\',\'mcd\')\n";
+static const char *other440 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.medcalcdata\',\'mc1\')\n";
+static const char *other441 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mediastation.cdkey\',\'cdkey\')\n";
+static const char *other442 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mfer\',\'mwf\')\n";
+static const char *other443 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mfmp\',\'mfm\')\n";
+static const char *other444 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.micrografx.flo\',\'flo\')\n";
+static const char *other445 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.micrografx.igx\',\'igx\')\n";
+static const char *other446 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mif\',\'mif\')\n";
+static const char *other447 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mobius.daf\',\'daf\')\n";
+static const char *other448 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mobius.dis\',\'dis\')\n";
+static const char *other449 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mobius.mbk\',\'mbk\')\n";
+static const char *other450 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mobius.mqy\',\'mqy\')\n";
+static const char *other451 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mobius.msl\',\'msl\')\n";
+static const char *other452 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mobius.plc\',\'plc\')\n";
+static const char *other453 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mobius.txf\',\'txf\')\n";
+static const char *other454 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mophun.application\',\'mpn\')\n";
+static const char *other455 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mophun.certificate\',\'mpc\')\n";
+static const char *other456 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mozilla.xul+xml\',\'xul\')\n";
+static const char *other457 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-artgalry\',\'cil\')\n";
+static const char *other458 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-cab-compressed\',\'cab\')\n";
+static const char *other459 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.mseq\',\'mseq\')\n";
+static const char *other460 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-excel\',\'xlm\')\n";
+static const char *other461 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-excel\',\'xla\')\n";
+static const char *other462 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-excel\',\'xlc\')\n";
+static const char *other463 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-excel\',\'xlt\')\n";
+static const char *other464 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-excel\',\'xlw\')\n";
+static const char *other465 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-excel.addin.macroenabled.12\',\'xlam\')\n";
+static const char *other466 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-excel.sheet.binary.macroenabled.12\',\'xlsb\')\n";
+static const char *other467 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-excel.sheet.macroenabled.12\',\'xlsm\')\n";
+static const char *other468 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-excel.template.macroenabled.12\',\'xltm\')\n";
+static const char *other469 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-fontobject\',\'eot\')\n";
+static const char *other470 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-htmlhelp\',\'chm\')\n";
+static const char *other471 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-ims\',\'ims\')\n";
+static const char *other472 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-lrm\',\'lrm\')\n";
+static const char *other473 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-pki.seccat\',\'cat\')\n";
+static const char *other474 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-pki.stl\',\'stl\')\n";
+static const char *other475 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-powerpoint\',\'pps\')\n";
+static const char *other476 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-powerpoint\',\'pot\')\n";
+static const char *other477 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-powerpoint.addin.macroenabled.12\',\'ppam\')\n";
+static const char *other478 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-powerpoint.presentation.macroenabled.12\',\'pptm\')\n";
+static const char *other479 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-powerpoint.slide.macroenabled.12\',\'sldm\')\n";
+static const char *other480 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-powerpoint.slideshow.macroenabled.12\',\'ppsm\')\n";
+static const char *other481 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-powerpoint.template.macroenabled.12\',\'potm\')\n";
+static const char *other482 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-project\',\'mpt\')\n";
+static const char *other483 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-word.document.macroenabled.12\',\'docm\')\n";
+static const char *other484 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-word.template.macroenabled.12\',\'dotm\')\n";
+static const char *other485 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-works\',\'wps\')\n";
+static const char *other486 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-works\',\'wks\')\n";
+static const char *other487 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-works\',\'wcm\')\n";
+static const char *other488 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-works\',\'wdb\')\n";
+static const char *other489 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-wpl\',\'wpl\')\n";
+static const char *other490 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ms-xpsdocument\',\'xps\')\n";
+static const char *other491 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.musician\',\'mus\')\n";
+static const char *other492 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.muvee.style\',\'msty\')\n";
+static const char *other493 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.neurolanguage.nlu\',\'nlu\')\n";
+static const char *other494 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.noblenet-directory\',\'nnd\')\n";
+static const char *other495 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.noblenet-sealer\',\'nns\')\n";
+static const char *other496 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.noblenet-web\',\'nnw\')\n";
+static const char *other497 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.nokia.n-gage.data\',\'ngdat\')\n";
+static const char *other498 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.nokia.n-gage.symbian.install\',\'n-gage\')\n";
+static const char *other499 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.nokia.radio-preset\',\'rpst\')\n";
+static const char *other500 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.nokia.radio-presets\',\'rpss\')\n";
+static const char *other501 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.novadigm.edm\',\'edm\')\n";
+static const char *other502 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.novadigm.edx\',\'edx\')\n";
+static const char *other503 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.novadigm.ext\',\'ext\')\n";
+static const char *other504 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.oasis.opendocument.chart-template\',\'otc\')\n";
+static const char *other505 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.oasis.opendocument.formula-template\',\'odft\')\n";
+static const char *other506 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.oasis.opendocument.graphics-template\',\'otg\')\n";
+static const char *other507 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.oasis.opendocument.image-template\',\'oti\')\n";
+static const char *other508 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.oasis.opendocument.presentation-template\',\'otp\')\n";
+static const char *other509 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.oasis.opendocument.spreadsheet-template\',\'ots\')\n";
+static const char *other510 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.oasis.opendocument.text-master\',\'otm\')\n";
+static const char *other511 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.oasis.opendocument.text-template\',\'ott\')\n";
+static const char *other512 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.oasis.opendocument.text-web\',\'oth\')\n";
+static const char *other513 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.olpc-sugar\',\'xo\')\n";
+static const char *other514 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.oma.dd2+xml\',\'dd2\')\n";
+static const char *other515 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.openofficeorg.extension\',\'oxt\')\n";
+static const char *other516 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.openxmlformats-officedocument.presentationml.presentation\',\'pptx\')\n";
+static const char *other517 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.openxmlformats-officedocument.presentationml.slide\',\'sldx\')\n";
+static const char *other518 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.openxmlformats-officedocument.presentationml.slideshow\',\'ppsx\')\n";
+static const char *other519 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.openxmlformats-officedocument.presentationml.template\',\'potx\')\n";
+static const char *other520 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\',\'xlsx\')\n";
+static const char *other521 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.openxmlformats-officedocument.spreadsheetml.template\',\'xltx\')\n";
+static const char *other522 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.openxmlformats-officedocument.wordprocessingml.document\',\'docx\')\n";
+static const char *other523 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.openxmlformats-officedocument.wordprocessingml.template\',\'dotx\')\n";
+static const char *other524 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.osgi.dp\',\'dp\')\n";
+static const char *other525 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.palm\',\'pqa\')\n";
+static const char *other526 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.palm\',\'oprc\')\n";
+static const char *other527 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.pawaafile\',\'paw\')\n";
+static const char *other528 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.pg.format\',\'str\')\n";
+static const char *other529 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.pg.osasli\',\'ei6\')\n";
+static const char *other530 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.picsel\',\'efif\')\n";
+static const char *other531 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.pmi.widget\',\'wg\')\n";
+static const char *other532 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.pocketlearn\',\'plf\')\n";
+static const char *other533 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.powerbuilder6\',\'pbd\')\n";
+static const char *other534 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.previewsystems.box\',\'box\')\n";
+static const char *other535 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.proteus.magazine\',\'mgz\')\n";
+static const char *other536 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.publishare-delta-tree\',\'qps\')\n";
+static const char *other537 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.pvi.ptid1\',\'ptid\')\n";
+static const char *other538 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.quark.quarkxpress\',\'qxd\')\n";
+static const char *other539 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.quark.quarkxpress\',\'qxt\')\n";
+static const char *other540 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.quark.quarkxpress\',\'qwd\')\n";
+static const char *other541 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.quark.quarkxpress\',\'qwt\')\n";
+static const char *other542 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.quark.quarkxpress\',\'qxl\')\n";
+static const char *other543 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.quark.quarkxpress\',\'qxb\')\n";
+static const char *other544 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.realvnc.bed\',\'bed\')\n";
+static const char *other545 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.recordare.musicxml\',\'mxl\')\n";
+static const char *other546 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.recordare.musicxml+xml\',\'musicxml\')\n";
+static const char *other547 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.rim.cod\',\'cod\')\n";
+static const char *other548 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.route66.link66+xml\',\'link66\')\n";
+static const char *other549 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sailingtracker.track\',\'st\')\n";
+static const char *other550 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.seemail\',\'see\')\n";
+static const char *other551 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sema\',\'sema\')\n";
+static const char *other552 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.semd\',\'semd\')\n";
+static const char *other553 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.semf\',\'semf\')\n";
+static const char *other554 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.shana.informed.formdata\',\'ifm\')\n";
+static const char *other555 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.shana.informed.formtemplate\',\'itp\')\n";
+static const char *other556 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.shana.informed.interchange\',\'iif\')\n";
+static const char *other557 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.shana.informed.package\',\'ipk\')\n";
+static const char *other558 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.simtech-mindmapper\',\'twd\')\n";
+static const char *other559 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.simtech-mindmapper\',\'twds\')\n";
+static const char *other560 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.smaf\',\'mmf\')\n";
+static const char *other561 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.smart.teacher\',\'teacher\')\n";
+static const char *other562 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.solent.sdkm+xml\',\'sdkm\')\n";
+static const char *other563 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.solent.sdkm+xml\',\'sdkd\')\n";
+static const char *other564 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.spotfire.dxp\',\'dxp\')\n";
+static const char *other565 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.spotfire.sfs\',\'sfs\')\n";
+static const char *other566 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.stardivision.calc\',\'sdc\')\n";
+static const char *other567 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.stardivision.draw\',\'sda\')\n";
+static const char *other568 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.stardivision.impress\',\'sdd\')\n";
+static const char *other569 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.stardivision.math\',\'smf\')\n";
+static const char *other570 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.stardivision.writer\',\'sdw\')\n";
+static const char *other571 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.stardivision.writer\',\'vor\')\n";
+static const char *other572 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.stardivision.writer-global\',\'sgl\')\n";
+static const char *other573 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sun.xml.calc\',\'sxc\')\n";
+static const char *other574 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sun.xml.calc.template\',\'stc\')\n";
+static const char *other575 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sun.xml.draw\',\'sxd\')\n";
+static const char *other576 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sun.xml.draw.template\',\'std\')\n";
+static const char *other577 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sun.xml.impress\',\'sxi\')\n";
+static const char *other578 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sun.xml.impress.template\',\'sti\')\n";
+static const char *other579 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sun.xml.math\',\'sxm\')\n";
+static const char *other580 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sun.xml.writer\',\'sxw\')\n";
+static const char *other581 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sun.xml.writer.global\',\'sxg\')\n";
+static const char *other582 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sun.xml.writer.template\',\'stw\')\n";
+static const char *other583 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sus-calendar\',\'sus\')\n";
+static const char *other584 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.sus-calendar\',\'susp\')\n";
+static const char *other585 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.svd\',\'svd\')\n";
+static const char *other586 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.symbian.install\',\'sis\')\n";
+static const char *other587 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.symbian.install\',\'sisx\')\n";
+static const char *other588 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.syncml.dm+wbxml\',\'bdm\')\n";
+static const char *other589 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.syncml.dm+xml\',\'xdm\')\n";
+static const char *other590 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.syncml+xml\',\'xsm\')\n";
+static const char *other591 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.tao.intent-module-archive\',\'tao\')\n";
+static const char *other592 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.tmobile-livetv\',\'tmo\')\n";
+static const char *other593 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.trid.tpt\',\'tpt\')\n";
+static const char *other594 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.triscape.mxs\',\'mxs\')\n";
+static const char *other595 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.trueapp\',\'tra\')\n";
+static const char *other596 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ufdl\',\'ufd\')\n";
+static const char *other597 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.ufdl\',\'ufdl\')\n";
+static const char *other598 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.uiq.theme\',\'utz\')\n";
+static const char *other599 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.umajin\',\'umj\')\n";
+static const char *other600 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.unity\',\'unityweb\')\n";
+static const char *other601 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.uoml+xml\',\'uoml\')\n";
+static const char *other602 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.vcx\',\'vcx\')\n";
+static const char *other603 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.visio\',\'vsd\')\n";
+static const char *other604 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.visio\',\'vst\')\n";
+static const char *other605 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.visio\',\'vss\')\n";
+static const char *other606 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.visio\',\'vsw\')\n";
+static const char *other607 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.visionary\',\'vis\')\n";
+static const char *other608 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.vsf\',\'vsf\')\n";
+static const char *other609 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.wap.wbxml\',\'wbxml\')\n";
+static const char *other610 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.wap.wmlc\',\'wmlc\')\n";
+static const char *other611 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.wap.wmlscriptc\',\'wmlsc\')\n";
+static const char *other612 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.webturbo\',\'wtb\')\n";
+static const char *other613 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.wolfram.player\',\'nbp\')\n";
+static const char *other614 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.wordperfect\',\'wpd\')\n";
+static const char *other615 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.wqd\',\'wqd\')\n";
+static const char *other616 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.wt.stf\',\'stf\')\n";
+static const char *other617 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.xara\',\'xar\')\n";
+static const char *other618 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.xfdl\',\'xfdl\')\n";
+static const char *other619 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.yamaha.hv-dic\',\'hvd\')\n";
+static const char *other620 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.yamaha.hv-script\',\'hvs\')\n";
+static const char *other621 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.yamaha.hv-voice\',\'hvp\')\n";
+static const char *other622 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.yamaha.openscoreformat\',\'osf\')\n";
+static const char *other623 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.yamaha.openscoreformat.osfpvg+xml\',\'osfpvg\')\n";
+static const char *other624 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.yamaha.smaf-audio\',\'saf\')\n";
+static const char *other625 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.yamaha.smaf-phrase\',\'spf\')\n";
+static const char *other626 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.yellowriver-custom-menu\',\'cmp\')\n";
+static const char *other627 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.zul\',\'zir\')\n";
+static const char *other628 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.zul\',\'zirz\')\n";
+static const char *other629 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/vnd.zzazz.deck+xml\',\'zaz\')\n";
+static const char *other630 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/voicexml+xml\',\'vxml\')\n";
+static const char *other631 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/winhlp\',\'hlp\')\n";
+static const char *other632 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/wspolicy+xml\',\'wspolicy\')\n";
+static const char *other633 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-abiword\',\'abw\')\n";
+static const char *other634 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-ace-compressed\',\'ace\')\n";
+static const char *other635 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-authorware-bin\',\'aab\')\n";
+static const char *other636 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-authorware-bin\',\'x32\')\n";
+static const char *other637 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-authorware-bin\',\'u32\')\n";
+static const char *other638 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-authorware-bin\',\'vox\')\n";
+static const char *other639 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-authorware-map\',\'aam\')\n";
+static const char *other640 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-authorware-seg\',\'aas\')\n";
+static const char *other641 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-bittorrent\',\'torrent\')\n";
+static const char *other642 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-bzip\',\'bz\')\n";
+static const char *other643 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-bzip2\',\'bz2\')\n";
+static const char *other644 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-bzip2\',\'boz\')\n";
+static const char *other645 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-chat\',\'chat\')\n";
+static const char *other646 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-debian-package\',\'deb\')\n";
+static const char *other647 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-debian-package\',\'udeb\')\n";
+static const char *other648 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-director\',\'cst\')\n";
+static const char *other649 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-director\',\'cct\')\n";
+static const char *other650 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-director\',\'cxt\')\n";
+static const char *other651 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-director\',\'w3d\')\n";
+static const char *other652 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-director\',\'fgd\')\n";
+static const char *other653 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-director\',\'swa\')\n";
+static const char *other654 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-doom\',\'wad\')\n";
+static const char *other655 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-dtbncx+xml\',\'ncx\')\n";
+static const char *other656 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-dtbook+xml\',\'dtb\')\n";
+static const char *other657 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-dtbresource+xml\',\'res\')\n";
+static const char *other658 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xenc+xml\',\'xenc\')\n";
+static const char *other659 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-font-bdf\',\'bdf\')\n";
+static const char *other660 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-font-ghostscript\',\'gsf\')\n";
+static const char *other661 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-font-linux-psf\',\'psf\')\n";
+static const char *other662 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-font-otf\',\'otf\')\n";
+static const char *other663 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-font-pcf\',\'pcf\')\n";
+static const char *other664 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-font-snf\',\'snf\')\n";
+static const char *other665 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-font-ttf\',\'ttf\')\n";
+static const char *other666 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-font-ttf\',\'ttc\')\n";
+static const char *other667 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-font-type1\',\'pfa\')\n";
+static const char *other668 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-font-type1\',\'pfb\')\n";
+static const char *other669 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-font-type1\',\'pfm\')\n";
+static const char *other670 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-font-type1\',\'afm\')\n";
+static const char *other671 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-gnumeric\',\'gnumeric\')\n";
+static const char *other672 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xhtml+xml\',\'xhtml\')\n";
+static const char *other673 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xhtml+xml\',\'xht\')\n";
+static const char *other674 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-java-jnlp-file\',\'jnlp\')\n";
+static const char *other675 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-mobipocket-ebook\',\'prc\')\n";
+static const char *other676 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-mobipocket-ebook\',\'mobi\')\n";
+static const char *other677 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msbinder\',\'obd\')\n";
+static const char *other678 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-mscardfile\',\'crd\')\n";
+static const char *other679 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msclip\',\'clp\')\n";
+static const char *other680 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msdownload\',\'dll\')\n";
+static const char *other681 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msdownload\',\'com\')\n";
+static const char *other682 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msdownload\',\'bat\')\n";
+static const char *other683 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msdownload\',\'msi\')\n";
+static const char *other684 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msmediaview\',\'mvb\')\n";
+static const char *other685 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msmediaview\',\'m13\')\n";
+static const char *other686 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msmediaview\',\'m14\')\n";
+static const char *other687 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msmetafile\',\'wmf\')\n";
+static const char *other688 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msmoney\',\'mny\')\n";
+static const char *other689 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-mspublisher\',\'pub\')\n";
+static const char *other690 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msschedule\',\'scd\')\n";
+static const char *other691 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-msterminal\',\'trm\')\n";
+static const char *other692 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-ms-wmd\',\'wmd\')\n";
+static const char *other693 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-ms-wmz\',\'wmz\')\n";
+static const char *other694 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-mswrite\',\'wri\')\n";
+static const char *other695 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xop+xml\',\'xop\')\n";
+static const char *other696 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-pkcs12\',\'p12\')\n";
+static const char *other697 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-pkcs12\',\'pfx\')\n";
+static const char *other698 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-pkcs7-certificates\',\'p7b\')\n";
+static const char *other699 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-pkcs7-certificates\',\'spc\')\n";
+static const char *other700 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-pkcs7-certreqresp\',\'p7r\')\n";
+static const char *other701 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-rar-compressed\',\'rar\')\n";
+static const char *other702 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-silverlight-app\',\'xap\')\n";
+static const char *other703 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xslt+xml\',\'xslt\')\n";
+static const char *other704 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xspf+xml\',\'xspf\')\n";
+static const char *other705 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-stuffitx\',\'sitx\')\n";
+static const char *other706 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-tex-tfm\',\'tfm\')\n";
+static const char *other707 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xv+xml\',\'mxml\')\n";
+static const char *other708 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xv+xml\',\'xhvml\')\n";
+static const char *other709 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xv+xml\',\'xvml\')\n";
+static const char *other710 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/xv+xml\',\'xvm\')\n";
+static const char *other711 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-x509-ca-cert\',\'der\')\n";
+static const char *other712 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-x509-ca-cert\',\'crt\')\n";
+static const char *other713 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-xfig\',\'fig\')\n";
+static const char *other714 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'application/x-xpinstall\',\'xpi\')\n";
+static const char *other715 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/adpcm\',\'adp\')\n";
+static const char *other716 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/midi\',\'rmi\')\n";
+static const char *other717 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/mp4\',\'mp4a\')\n";
+static const char *other718 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/mpeg\',\'mp2a\')\n";
+static const char *other719 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/mpeg\',\'m2a\')\n";
+static const char *other720 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/mpeg\',\'m3a\')\n";
+static const char *other721 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/ogg\',\'oga\')\n";
+static const char *other722 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/ogg\',\'spx\')\n";
+static const char *other723 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/vnd.digital-winds\',\'eol\')\n";
+static const char *other724 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/vnd.dra\',\'dra\')\n";
+static const char *other725 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/vnd.dts\',\'dts\')\n";
+static const char *other726 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/vnd.dts.hd\',\'dtshd\')\n";
+static const char *other727 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/vnd.lucent.voice\',\'lvp\')\n";
+static const char *other728 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/vnd.ms-playready.media.pya\',\'pya\')\n";
+static const char *other729 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/vnd.nuera.ecelp4800\',\'ecelp4800\')\n";
+static const char *other730 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/vnd.nuera.ecelp7470\',\'ecelp7470\')\n";
+static const char *other731 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/vnd.nuera.ecelp9600\',\'ecelp9600\')\n";
+static const char *other732 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-aac\',\'aac\')\n";
+static const char *other733 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-mpegurl\',\'m3u\')\n";
+static const char *other734 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-ms-wax\',\'wax\')\n";
+static const char *other735 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-ms-wma\',\'wma\')\n";
+static const char *other736 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'audio/x-pn-realaudio-plugin\',\'rmp\')\n";
+static const char *other737 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'chemical/x-cdx\',\'cdx\')\n";
+static const char *other738 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'chemical/x-cif\',\'cif\')\n";
+static const char *other739 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'chemical/x-cmdf\',\'cmdf\')\n";
+static const char *other740 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'chemical/x-cml\',\'cml\')\n";
+static const char *other741 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'chemical/x-csml\',\'csml\')\n";
+static const char *other742 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/cgm\',\'cgm\')\n";
+static const char *other743 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/g3fax\',\'g3\')\n";
+static const char *other744 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/prs.btif\',\'btif\')\n";
+static const char *other745 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/svg+xml\',\'svgz\')\n";
+static const char *other746 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.adobe.photoshop\',\'psd\')\n";
+static const char *other747 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.djvu\',\'djvu\')\n";
+static const char *other748 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.djvu\',\'djv\')\n";
+static const char *other749 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.dwg\',\'dwg\')\n";
+static const char *other750 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.dxf\',\'dxf\')\n";
+static const char *other751 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.fastbidsheet\',\'fbs\')\n";
+static const char *other752 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.fpx\',\'fpx\')\n";
+static const char *other753 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.fst\',\'fst\')\n";
+static const char *other754 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.fujixerox.edmics-mmr\',\'mmr\')\n";
+static const char *other755 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.fujixerox.edmics-rlc\',\'rlc\')\n";
+static const char *other756 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.ms-modi\',\'mdi\')\n";
+static const char *other757 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.net-fpx\',\'npx\')\n";
+static const char *other758 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.wap.wbmp\',\'wbmp\')\n";
+static const char *other759 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/vnd.xiff\',\'xif\')\n";
+static const char *other760 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-cmx\',\'cmx\')\n";
+static const char *other761 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-freehand\',\'fh\')\n";
+static const char *other762 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-freehand\',\'fhc\')\n";
+static const char *other763 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-freehand\',\'fh4\')\n";
+static const char *other764 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-freehand\',\'fh5\')\n";
+static const char *other765 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-freehand\',\'fh7\')\n";
+static const char *other766 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-icon\',\'ico\')\n";
+static const char *other767 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-pcx\',\'pcx\')\n";
+static const char *other768 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-pict\',\'pic\')\n";
+static const char *other769 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'image/x-pict\',\'pct\')\n";
+static const char *other770 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'message/rfc822\',\'eml\')\n";
+static const char *other771 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'message/rfc822\',\'mime\')\n";
+static const char *other772 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/vnd.dwf\',\'dwf\')\n";
+static const char *other773 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/vnd.gdl\',\'gdl\')\n";
+static const char *other774 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/vnd.gtw\',\'gtw\')\n";
+static const char *other775 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/vnd.mts\',\'mts\')\n";
+static const char *other776 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'model/vnd.vtu\',\'vtu\')\n";
+static const char *other777 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/calendar\',\'ifb\')\n";
+static const char *other778 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/plain\',\'text\')\n";
+static const char *other779 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/plain\',\'conf\')\n";
+static const char *other780 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/plain\',\'def\')\n";
+static const char *other781 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/plain\',\'list\')\n";
+static const char *other782 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/plain\',\'log\')\n";
+static const char *other783 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/plain\',\'in\')\n";
+static const char *other784 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/prs.lines.tag\',\'dsc\')\n";
+static const char *other785 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/uri-list\',\'uri\')\n";
+static const char *other786 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/uri-list\',\'uris\')\n";
+static const char *other787 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/uri-list\',\'urls\')\n";
+static const char *other788 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/vnd.curl\',\'curl\')\n";
+static const char *other789 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/vnd.curl.dcurl\',\'dcurl\')\n";
+static const char *other790 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/vnd.curl.mcurl\',\'mcurl\')\n";
+static const char *other791 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/vnd.curl.scurl\',\'scurl\')\n";
+static const char *other792 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/vnd.fly\',\'fly\')\n";
+static const char *other793 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/vnd.fmi.flexstor\',\'flx\')\n";
+static const char *other794 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/vnd.graphviz\',\'gv\')\n";
+static const char *other795 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/vnd.in3d.3dml\',\'3dml\')\n";
+static const char *other796 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/vnd.in3d.spot\',\'spot\')\n";
+static const char *other797 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/vnd.sun.j2me.app-descriptor\',\'jad\')\n";
+static const char *other798 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/vnd.wap.wml\',\'wml\')\n";
+static const char *other799 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/vnd.wap.wmlscript\',\'wmls\')\n";
+static const char *other800 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-asm\',\'s\')\n";
+static const char *other801 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-asm\',\'asm\')\n";
+static const char *other802 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-c\',\'c\')\n";
+static const char *other803 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-c\',\'cc\')\n";
+static const char *other804 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-c\',\'cxx\')\n";
+static const char *other805 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-c\',\'cpp\')\n";
+static const char *other806 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-c\',\'h\')\n";
+static const char *other807 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-c\',\'hh\')\n";
+static const char *other808 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-c\',\'dic\')\n";
+static const char *other809 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-fortran\',\'f\')\n";
+static const char *other810 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-fortran\',\'for\')\n";
+static const char *other811 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-fortran\',\'f77\')\n";
+static const char *other812 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-fortran\',\'f90\')\n";
+static const char *other813 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-java-source\',\'java\')\n";
+static const char *other814 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-pascal\',\'p\')\n";
+static const char *other815 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-pascal\',\'pas\')\n";
+static const char *other816 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-uuencode\',\'uu\')\n";
+static const char *other817 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'text/x-vcalendar\',\'vcs\')\n";
+static const char *other818 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/3gpp2\',\'3g2\')\n";
+static const char *other819 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/h261\',\'h261\')\n";
+static const char *other820 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/h263\',\'h263\')\n";
+static const char *other821 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/h264\',\'h264\')\n";
+static const char *other822 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/jpeg\',\'jpgv\')\n";
+static const char *other823 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/jpm\',\'jpm\')\n";
+static const char *other824 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/jpm\',\'jpgm\')\n";
+static const char *other825 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mj2\',\'mj2\')\n";
+static const char *other826 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mj2\',\'mjp2\')\n";
+static const char *other827 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mp4\',\'mp4v\')\n";
+static const char *other828 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mp4\',\'mpg4\')\n";
+static const char *other829 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mpeg\',\'m1v\')\n";
+static const char *other830 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/mpeg\',\'m2v\')\n";
+static const char *other831 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/ogg\',\'ogv\')\n";
+static const char *other832 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/vnd.fvt\',\'fvt\')\n";
+static const char *other833 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/vnd.mpegurl\',\'mxu\')\n";
+static const char *other834 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/vnd.mpegurl\',\'m4u\')\n";
+static const char *other835 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/vnd.ms-playready.media.pyv\',\'pyv\')\n";
+static const char *other836 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/vnd.vivo\',\'viv\')\n";
+static const char *other837 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-f4v\',\'f4v\')\n";
+static const char *other838 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-fli\',\'fli\')\n";
+static const char *other839 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-flv\',\'flv\')\n";
+static const char *other840 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-m4v\',\'m4v\')\n";
+static const char *other841 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-ms-asf\',\'asf\')\n";
+static const char *other842 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-ms-asf\',\'asx\')\n";
+static const char *other843 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-ms-wm\',\'wm\')\n";
+static const char *other844 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-ms-wmv\',\'wmv\')\n";
+static const char *other845 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-ms-wmx\',\'wmx\')\n";
+static const char *other846 = 
+"insert soft WS.WS.SYS_DAV_RES_TYPES (T_TYPE,T_EXT) values (\'video/x-ms-wvx\',\'wvx\')\n";
+static const char *other847 = 
 "select count(*) from WS.WS.SYS_DAV_RES_TYPES where http_mime_type_add (T_EXT, T_TYPE)\n";
+static const char *trig0 = 
+"#line 2889 \"[executable]/davddk.sql\"\n"
+"create trigger SYS_DAV_RES_TYPES_I after insert on WS.WS.SYS_DAV_RES_TYPES referencing new as N\n"
+"{\n"
+"http_mime_type_add (N.T_EXT, N.T_TYPE);\n"
+"}\n"
+"--src davddk.sql:2887\n";
+
+static const char *trig1 = 
+"#line 2895 \"[executable]/davddk.sql\"\n"
+"create trigger SYS_DAV_RES_TYPES_U after update on WS.WS.SYS_DAV_RES_TYPES referencing old as O, new as N\n"
+"{\n"
+"http_mime_type_add (N.T_EXT, N.T_TYPE);\n"
+"http_mime_type_add (O.T_EXT, null);\n"
+"}\n"
+"--src davddk.sql:2893\n";
+
+static const char *trig2 = 
+"#line 2902 \"[executable]/davddk.sql\"\n"
+"create trigger SYS_DAV_RES_TYPES_D after delete on WS.WS.SYS_DAV_RES_TYPES referencing old as O\n"
+"{\n"
+"http_mime_type_add (O.T_EXT, null);\n"
+"}\n"
+"--src davddk.sql:2900\n";
+
 static const char *proc12 = 
+"#line 2908 \"[executable]/davddk.sql\"\n"
 "create procedure\n"
 "DB.DBA.DAV_PLAIN_SUBCOLS_P (in root_id integer, in root_path varchar := null, in recursive integer := 1, in subcol_auth_uid varchar, in subcol_auth_pwd varchar)\n"
 "{\n"
@@ -1507,9 +2881,10 @@ static const char *proc12 =
 "}\n"
 "}\n"
 "}\n"
-"--src davddk.sql:1552\n";
+"--src davddk.sql:2906\n";
 
 static const char *proc13 = 
+"#line 2936 \"[executable]/davddk.sql\"\n"
 "create procedure\n"
 "DB.DBA.DAV_PLAIN_SUBCOLS_P_INT (in root_id integer, in root_path varchar, in depth integer, in subcol_auth_uid varchar, in subcol_auth_pwd varchar)\n"
 "{\n"
@@ -1520,12 +2895,13 @@ static const char *proc13 =
 "DB.DBA.DAV_PLAIN_SUBCOLS_P_INT (COL_ID, full_path, depth + 1, subcol_auth_uid, subcol_auth_pwd);\n"
 "}\n"
 "}\n"
-"--src davddk.sql:1580\n";
+"--src davddk.sql:2934\n";
 
 static const char *view6 = 
 "create procedure view DB.DBA.DAV_PLAIN_SUBCOLS as DB.DBA.DAV_PLAIN_SUBCOLS_P (root_id,root_path,recursive,subcol_auth_uid,subcol_auth_pwd) (SUBCOL_FULL_PATH varchar, SUBCOL_NAME varchar, SUBCOL_PARENT integer, SUBCOL_ID integer, SUBCOL_DEPTH integer, SUBCOL_DET varchar)\n";
 
 static const char *proc14 = 
+"#line 2953 \"[executable]/davddk.sql\"\n"
 "create procedure\n"
 "DB.DBA.DAV_PLAIN_SUBMOUNTS_P (in root_id integer, in root_path varchar := null, in recursive integer := 1, in subcol_auth_uid varchar, in subcol_auth_pwd varchar)\n"
 "{\n"
@@ -1552,9 +2928,10 @@ static const char *proc14 =
 "}\n"
 "}\n"
 "}\n"
-"--src davddk.sql:1597\n";
+"--src davddk.sql:2951\n";
 
 static const char *proc15 = 
+"#line 2981 \"[executable]/davddk.sql\"\n"
 "create procedure\n"
 "DB.DBA.DAV_PLAIN_SUBMOUNTS_P_INT (in root_id integer, in root_path varchar, in depth integer, in subcol_auth_uid varchar, in subcol_auth_pwd varchar)\n"
 "{\n"
@@ -1566,12 +2943,13 @@ static const char *proc15 =
 "DB.DBA.DAV_PLAIN_SUBMOUNTS_P_INT (COL_ID, full_path, depth + 1, subcol_auth_uid, subcol_auth_pwd);\n"
 "}\n"
 "}\n"
-"--src davddk.sql:1625\n";
+"--src davddk.sql:2979\n";
 
 static const char *view7 = 
 "create procedure view DB.DBA.DAV_PLAIN_SUBMOUNTS as DB.DBA.DAV_PLAIN_SUBMOUNTS_P (root_id,root_path,recursive,subcol_auth_uid,subcol_auth_pwd) (SUBCOL_FULL_PATH varchar, SUBCOL_NAME varchar, SUBCOL_PARENT integer, SUBCOL_ID integer, SUBCOL_DEPTH integer, SUBCOL_DET varchar)\n";
 
 static const char *proc16 = 
+"#line 3000 \"[executable]/davddk.sql\"\n"
 " create procedure\n"
 "DB.DBA.DAV_DIR_P (in path varchar := \'/DAV/\', in recursive integer := 0, in auth_uid varchar, in auth_pwd varchar)\n"
 "{\n"
@@ -1600,12 +2978,12 @@ static const char *proc16 =
 "i := i + 1;\n"
 "}\n"
 "}\n"
-"--src davddk.sql:1644\n";
+"--src davddk.sql:2998\n";
 
 static const char *view8 = 
 "create procedure view DB.DBA.DAV_DIR as DB.DBA.DAV_DIR_P (path,recursive,auth_uid,auth_pwd) (FULL_PATH varchar, TYPE varchar, RLENGTH integer, MOD_TIME datetime, ID integer, PERMS varchar, GRP integer, OWNER integer, CR_TIME datetime, MIME_TYPE varchar, NAME varchar)\n";
 
-static const char *other180 = 
+static const char *other848 = 
 "exec (\'grant select on DB.DBA.DAV_DIR to PUBLIC\')\n";
 /* mail_cli.sql */
 
@@ -1643,30 +3021,34 @@ static const char *tbl19 =
 "primary key (MA_M_OWN, MA_M_FLD, MA_M_ID, MA_ID)\n"
 ")\n";
 
-static const char *trig0 = 
+static const char *trig3 = 
+"#line 99 \"[executable]/mail_cli.sql\"\n"
 "create trigger MAIL_MESSAGE_I after insert on DB.DBA.MAIL_MESSAGE\n"
 "{\n"
 "if (__proc_exists (\'BLOG.DBA.BLOG_MOBLOG_PROCESS_MSG\'))\n"
 "BLOG.DBA.BLOG_MOBLOG_PROCESS_MSG (MM_OWN, MM_ID, MM_FLD, MM_BODY, MM_MOBLOG);\n"
 "}\n"
-"--src mail_cli.sql:98\n";
+"--src mail_cli.sql:97\n";
 
-static const char *trig1 = 
+static const char *trig4 = 
+"#line 109 \"[executable]/mail_cli.sql\"\n"
 "create trigger MAIL_MESSAGE_U after update on DB.DBA.MAIL_MESSAGE referencing old as O, new as N\n"
 "{\n"
 "if (__proc_exists (\'BLOG.DBA.BLOG_MOBLOG_PROCESS_MSG\'))\n"
 "BLOG.DBA.BLOG_MOBLOG_PROCESS_MSG (N.MM_OWN, N.MM_ID, N.MM_FLD, N.MM_BODY, N.MM_MOBLOG);\n"
 "}\n"
-"--src mail_cli.sql:108\n";
+"--src mail_cli.sql:107\n";
 
-static const char *trig2 = 
+static const char *trig5 = 
+"#line 116 \"[executable]/mail_cli.sql\"\n"
 "create trigger MAIL_MESSAGE_D after delete on DB.DBA.MAIL_MESSAGE\n"
 "{\n"
 "delete from MAIL_ATTACHMENT where MA_M_ID = MM_ID and MA_M_OWN = MM_OWN and MA_M_FLD = MM_FLD;\n"
 "}\n"
-"--src mail_cli.sql:115\n";
+"--src mail_cli.sql:114\n";
 
 static const char *proc17 = 
+"#line 123 \"[executable]/mail_cli.sql\"\n"
 "create procedure DB.DBA.MAIL_MESSAGE_MM_BODY_INDEX_HOOK (inout vtb any, inout d_id integer)\n"
 "{\n"
 "declare data, own, offset any;\n"
@@ -1703,9 +3085,10 @@ static const char *proc17 =
 "close cr;\n"
 "return 0;\n"
 "}\n"
-"--src mail_cli.sql:122\n";
+"--src mail_cli.sql:121\n";
 
 static const char *proc18 = 
+"#line 161 \"[executable]/mail_cli.sql\"\n"
 "create procedure DB.DBA.MAIL_MESSAGE_MM_BODY_UNINDEX_HOOK (inout vtb any, inout d_id integer)\n"
 "{\n"
 "declare data, own, offset any;\n"
@@ -1739,9 +3122,10 @@ static const char *proc18 =
 "close cr;\n"
 "return 0;\n"
 "}\n"
-"--src mail_cli.sql:160\n";
+"--src mail_cli.sql:159\n";
 
 static const char *proc19 = 
+"#line 196 \"[executable]/mail_cli.sql\"\n"
 "create procedure\n"
 "MM_FEED_PART (inout vb any, inout mb any, inout body varchar, inout id integer, in flag int)\n"
 "{\n"
@@ -1771,11 +3155,11 @@ static const char *proc19 =
 "i := i + 1;\n"
 "}\n"
 "}\n"
-"--src mail_cli.sql:195\n";
+"--src mail_cli.sql:194\n";
 
-static const char *other181 = 
+static const char *other849 = 
 "DB.DBA.vt_create_text_index (\'DB.DBA.MAIL_MESSAGE\', \'MM_BODY\', \'MM_BODY_ID\', 2, 0, null, 1, \'*ini*\', \'*ini*\')\n";
-static const char *other182 = 
+static const char *other850 = 
 "DB.DBA.vt_create_ftt (\'DB.DBA.MAIL_MESSAGE\', null, null, 2)\n";
 static const char *tbl20 = 
 "create table MAIL_PARTS (\n"
@@ -1787,6 +3171,7 @@ static const char *tbl20 =
 ")\n";
 
 static const char *proc20 = 
+"#line 253 \"[executable]/mail_cli.sql\"\n"
 " create procedure MIME_PART (in _cont_type varchar, in _content_disp varchar,\n"
 "in _transfer_enc varchar, in _data varchar)\n"
 "{\n"
@@ -1817,9 +3202,10 @@ static const char *proc20 =
 "aset (_result, 1, _body);\n"
 "return (_result);\n"
 "}\n"
-"--src mail_cli.sql:252\n";
+"--src mail_cli.sql:251\n";
 
 static const char *proc21 = 
+"#line 287 \"[executable]/mail_cli.sql\"\n"
 " create procedure MIME_BODY (in _parts any)\n"
 "{\n"
 "declare _inx, _len integer;\n"
@@ -1867,9 +3253,10 @@ static const char *proc21 =
 "}\n"
 "return _res;\n"
 "}\n"
-"--src mail_cli.sql:286\n";
+"--src mail_cli.sql:285\n";
 
 static const char *proc22 = 
+"#line 339 \"[executable]/mail_cli.sql\"\n"
 "create procedure NEW_MAIL (in _uid varchar, in __msg any)\n"
 "{\n"
 "declare _id, dummy integer;\n"
@@ -1917,9 +3304,10 @@ static const char *proc22 =
 "close m;\n"
 "return NULL;\n"
 "}\n"
-"--src mail_cli.sql:338\n";
+"--src mail_cli.sql:337\n";
 
 static const char *proc23 = 
+"#line 388 \"[executable]/mail_cli.sql\"\n"
 "create procedure MAIL_GET_NEXT_ID (in str varchar, inout offset integer)\n"
 "{\n"
 "while (1 = 1)\n"
@@ -1974,9 +3362,10 @@ static const char *proc23 =
 "return NULL;\n"
 "}\n"
 "}\n"
-"--src mail_cli.sql:387\n";
+"--src mail_cli.sql:386\n";
 
 static const char *proc24 = 
+"#line 444 \"[executable]/mail_cli.sql\"\n"
 "create procedure BARE_NEW_MAIL (in _uid varchar,\n"
 "in _subj varchar, in _cc varchar, in _bcc varchar, in _sent varchar,\n"
 "in _to varchar, in _from varchar, in __msg any)\n"
@@ -2062,9 +3451,10 @@ static const char *proc24 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src mail_cli.sql:443\n";
+"--src mail_cli.sql:442\n";
 
 static const char *proc25 = 
+"#line 532 \"[executable]/mail_cli.sql\"\n"
 "create procedure display_mime (inout doc varchar, inout ses varchar, inout parsed_message varchar, in msg varchar, in path varchar, in call_page varchar, in _type varchar)\n"
 "{\n"
 "\n"
@@ -2197,7 +3587,7 @@ static const char *proc25 =
 "}\n"
 "}\n"
 "}\n"
-"--src mail_cli.sql:531\n";
+"--src mail_cli.sql:530\n";
 
 /* admin_ddl.sql */
 
@@ -2240,8 +3630,10 @@ static const char *tbl23 =
 "VU_ETAG	varchar,\n"
 "VU_CPTIME	datetime,\n"
 "VU_OTHER	varchar,\n"
+"VU_RES_ID   int,\n"
 "primary key (VU_HOST, VU_URL, VU_ROOT))\n"
-"create index VU_HOST_ROOT on WS.WS.VFS_URL (VU_HOST, VU_ROOT)\n";
+"create index VU_HOST_ROOT on WS.WS.VFS_URL (VU_HOST, VU_ROOT)\n"
+"create index VFS_URL_RES_ID on WS.WS.VFS_URL (VU_RES_ID)    \n";
 
 static const char *tbl24 = 
 "create table WS.WS.VFS_QUEUE (\n"
@@ -2254,6 +3646,7 @@ static const char *tbl24 =
 "VQ_ERROR	long varchar,\n"
 "VQ_LEVEL	int default 0,\n"
 "VQ_VIA_SITEMAP int default 0,\n"
+"VQ_DT	timestamp,\n"
 "primary key (VQ_HOST, VQ_URL, VQ_ROOT))\n"
 "create index VQ_HOST_ROOT on WS.WS.VFS_QUEUE (VQ_HOST, VQ_ROOT)\n"
 "create index VQ_HOST_TIME on WS.WS.VFS_QUEUE (VQ_HOST, VQ_ROOT, VQ_STAT, VQ_TS, VQ_URL)\n"
@@ -2284,6 +3677,13 @@ static const char *tbl25 =
 "VS_EXTRACT_FN  varchar,\n"
 "VS_STORE_FN  varchar,\n"
 "VS_DEPTH	int default null,\n"
+"VS_CONVERT_HTML	int default 1,\n"
+"VS_XPATH    long varchar,\n"
+"VS_BOT	int default 1,\n"
+"VS_IS_SITEMAP int default 0,\n"
+"VS_ACCEPT_RDF int default 0,\n"
+"VS_THREADS  int default 1,\n"
+"VS_ROBOTS long varchar default null,\n"
 "primary key (VS_HOST, VS_ROOT))\n"
 "create index VS_HOST_ROOT on WS.WS.VFS_SITE (VS_HOST, VS_URL, VS_ROOT)\n";
 
@@ -2300,11 +3700,38 @@ static const char *alter0 =
 "alter table WS.WS.VFS_SITE add VS_DEPTH int default null\n";
 
 static const char *alter1 = 
-"alter table WS.WS.VFS_QUEUE add VQ_LEVEL int default 0\n";
+"alter table WS.WS.VFS_SITE add VS_CONVERT_HTML int default 1\n";
 
 static const char *alter2 = 
+"alter table WS.WS.VFS_SITE add VS_XPATH long varchar\n";
+
+static const char *alter3 = 
+"alter table WS.WS.VFS_SITE add VS_BOT int default 1\n";
+
+static const char *alter4 = 
+"alter table WS.WS.VFS_SITE add VS_IS_SITEMAP int default 0\n";
+
+static const char *alter5 = 
+"alter table WS.WS.VFS_SITE add VS_ACCEPT_RDF int default 0\n";
+
+static const char *alter6 = 
+"alter table WS.WS.VFS_SITE add VS_THREADS int default 1\n";
+
+static const char *alter7 = 
+"alter table WS.WS.VFS_SITE add VS_ROBOTS long varchar default null\n";
+
+static const char *alter8 = 
+"alter table WS.WS.VFS_QUEUE add VQ_LEVEL int default 0\n";
+
+static const char *alter9 = 
 "alter table WS.WS.VFS_QUEUE add VQ_VIA_SITEMAP int default 0\n";
 
+static const char *alter10 = 
+"alter table WS.WS.VFS_QUEUE add VQ_DT timestamp\n";
+
+static const char *alter11 = 
+"alter table WS.WS.VFS_URL add VU_RES_ID int\n";
+
 /* virtual_dir.sql */
 
 static const char *tbl27 = 
@@ -2343,10 +3770,11 @@ static const char *tbl28 =
 "HA_LIMIT  integer default 0,\n"
 "PRIMARY KEY (HA_LIST, HA_ORDER, HA_CLIENT_IP, HA_FLAG))\n";
 
-static const char *alter3 = 
+static const char *alter12 = 
 "alter table HTTP_ACL add HA_LIMIT integer default 0\n";
 
-static const char *trig3 = 
+static const char *trig6 = 
+"#line 96 \"[executable]/virtual_dir.sql\"\n"
 "create trigger HTTP_ACL_I after insert on DB.DBA.HTTP_ACL\n"
 "{\n"
 "declare def_rate int;\n"
@@ -2356,23 +3784,25 @@ static const char *trig3 =
 "def_rate := 1;\n"
 "http_acl_set (HA_LIST, HA_ORDER, HA_CLIENT_IP, HA_FLAG, HA_DEST_IP, HA_OBJECT, HA_RW, coalesce (HA_RATE, def_rate), HA_LIMIT);\n"
 "}\n"
-"--src virtual_dir.sql:95\n";
+"--src virtual_dir.sql:94\n";
 
-static const char *trig4 = 
+static const char *trig7 = 
+"#line 111 \"[executable]/virtual_dir.sql\"\n"
 "create trigger HTTP_ACL_U after update on DB.DBA.HTTP_ACL referencing old as O, new as N\n"
 "{\n"
 "http_acl_remove (O.HA_LIST, O.HA_ORDER, O.HA_CLIENT_IP, O.HA_FLAG);\n"
 "http_acl_set (N.HA_LIST, N.HA_ORDER, N.HA_CLIENT_IP, N.HA_FLAG, N.HA_DEST_IP, N.HA_OBJECT, N.HA_RW,\n"
 "coalesce (N.HA_RATE, 0), N.HA_LIMIT);\n"
 "}\n"
-"--src virtual_dir.sql:110\n";
+"--src virtual_dir.sql:109\n";
 
-static const char *trig5 = 
+static const char *trig8 = 
+"#line 119 \"[executable]/virtual_dir.sql\"\n"
 "create trigger HTTP_ACL_D after delete on DB.DBA.HTTP_ACL referencing old as O\n"
 "{\n"
 "http_acl_remove (O.HA_LIST, O.HA_ORDER, O.HA_CLIENT_IP, O.HA_FLAG);\n"
 "}\n"
-"--src virtual_dir.sql:118\n";
+"--src virtual_dir.sql:117\n";
 
 static const char *view10 = 
 "create view HTTP_PROXY_ACL (HP_SRC, HP_DEST, HP_FLAG)\n"
@@ -2384,98 +3814,98 @@ static const char *view11 =
 "as select HA_OBJECT, HA_CLIENT_IP, HA_FLAG, HA_RW from DB.DBA.HTTP_ACL\n"
 "where upper (HA_LIST) = \'NEWS\'\n";
 
-static const char *other183 = 
+static const char *other851 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*ini*\', \'*ini*\', \'/DAV\', \'/DAV/\', 1, 1, NULL, NULL, NULL, NULL, NULL, \'dba\', NULL, 0\n"
 ")\n";
-static const char *other184 = 
+static const char *other852 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*sslini*\', \'*sslini*\', \'/DAV\', \'/DAV/\', 1, 1, NULL, NULL, NULL, NULL, NULL, \'dba\', NULL, 0\n"
 ")\n";
-static const char *other185 = 
+static const char *other853 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*ini*\', \'*ini*\', \'/admin\', \'/admin/\', 0, 0, \'admin_main.vsp\', NULL, NULL, NULL, NULL, \'dba\', NULL, 0\n"
 ")\n";
-static const char *other186 = 
+static const char *other854 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*ini*\', \'*ini*\', \'/install\', \'/install/\', 0, 0, \'install.vspx\', NULL, NULL, NULL, NULL, \'dba\', NULL, 0\n"
 ")\n";
-static const char *other187 = 
+static const char *other855 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*sslini*\', \'*sslini*\', \'/admin\', \'/admin/\', 0, 0, \'admin_main.vsp\', NULL, NULL, NULL, NULL, \'dba\', NULL, 0\n"
 ")\n";
-static const char *other188 = 
+static const char *other856 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*ini*\', \'*ini*\', \'/mime\', \'/mime/\', 0, 0, NULL, NULL, NULL, NULL, NULL, \'dba\', NULL, 0\n"
 ")\n";
-static const char *other189 = 
+static const char *other857 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*ini*\', \'*ini*\', \'/images\', \'/images/\', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0\n"
 ")\n";
-static const char *other190 = 
+static const char *other858 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*sslini*\', \'*sslini*\', \'/mime\', \'/mime/\', 0, 0, NULL, NULL, NULL, NULL, NULL, \'dba\', NULL, 0\n"
 ")\n";
-static const char *other191 = 
+static const char *other859 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*ini*\', \'*ini*\', \'/doc\', \'/doc/\', 0, 0, NULL, NULL, NULL, NULL, NULL, \'dba\', NULL, 0\n"
 ")\n";
-static const char *other192 = 
+static const char *other860 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*sslini*\', \'*sslini*\', \'/doc\', \'/doc/\', 0, 0, NULL, NULL, NULL, NULL, NULL, \'dba\', NULL, 0\n"
 ")\n";
-static const char *other193 = 
+static const char *other861 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*ini*\', \'*ini*\', \'/SOAP\', \'/SOAP/\', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, \'SOAP\', 0\n"
 ")\n";
-static const char *other194 = 
+static const char *other862 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*sslini*\', \'*sslini*\', \'/SOAP\', \'/SOAP/\', 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, \'SOAP\', 0\n"
 ")\n";
-static const char *other195 = 
+static const char *other863 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
 "HP_SECURITY, HP_REALM, HP_AUTH_FUNC, HP_POSTPROCESS_FUNC, HP_RUN_VSP_AS, HP_RUN_SOAP_AS, HP_PERSIST_SES_VARS)\n"
 "values ( \'*ini*\', \'*ini*\', \'/vsmx\', \'/vsmx/\', 0, 0, \'vsmx.vspx\', NULL, NULL, NULL, NULL, \'dba\', NULL, 0\n"
 ")\n";
-static const char *other196 = 
+static const char *other864 = 
 "insert soft DB.DBA.HTTP_PATH\n"
 "(\n"
 "HP_HOST, HP_LISTEN_HOST, HP_LPATH, HP_PPATH, HP_STORE_AS_DAV, HP_DIR_BROWSEABLE, HP_DEFAULT,\n"
@@ -2483,6 +3913,7 @@ static const char *other196 =
 "values ( \'*sslini*\', \'*sslini*\', \'/vsmx\', \'/vsmx/\', 0, 0, \'vsmx.vspx\', NULL, NULL, NULL, NULL, \'dba\', NULL, 0\n"
 ")\n";
 static const char *proc26 = 
+"#line 302 \"[executable]/virtual_dir.sql\"\n"
 "create procedure HTTP_SET_DBA_ADMIN (in realm varchar)\n"
 "{\n"
 "declare auth, _user varchar;\n"
@@ -2499,9 +3930,10 @@ static const char *proc26 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src virtual_dir.sql:301\n";
+"--src virtual_dir.sql:300\n";
 
 static const char *proc27 = 
+"#line 321 \"[executable]/virtual_dir.sql\"\n"
 "create procedure\n"
 "DB.DBA.IS_EMPTY_OR_NULL (in x any)\n"
 "{\n"
@@ -2509,9 +3941,10 @@ static const char *proc27 =
 "return 1;\n"
 "return 0;\n"
 "}\n"
-"--src virtual_dir.sql:320\n";
+"--src virtual_dir.sql:319\n";
 
 static const char *proc28 = 
+"#line 332 \"[executable]/virtual_dir.sql\"\n"
 "create procedure INS_VIRTUAL_DIR (in lpath varchar, in ppath varchar)\n"
 "{\n"
 "declare is_dav integer;\n"
@@ -2529,9 +3962,10 @@ static const char *proc28 =
 "values (lpath, ppath, \'*ini*\', \'*ini*\', is_dav, 0, 0);\n"
 "return http_map_table (lpath, ppath, \'*ini*\', \'*ini*\', is_dav);\n"
 "}\n"
-"--src virtual_dir.sql:331\n";
+"--src virtual_dir.sql:330\n";
 
 static const char *proc29 = 
+"#line 352 \"[executable]/virtual_dir.sql\"\n"
 "create procedure DEL_VIRTUAL_DIR (in lpath varchar)\n"
 "{\n"
 "if (DB.DBA.IS_EMPTY_OR_NULL (lpath))\n"
@@ -2539,9 +3973,10 @@ static const char *proc29 =
 "delete from DB.DBA.HTTP_PATH where HP_LPATH = lpath and HP_HOST = \'*ini*\' and HP_LISTEN_HOST = \'*ini*\';\n"
 "return http_map_del (lpath, \'*ini*\', \'*ini*\');\n"
 "}\n"
-"--src virtual_dir.sql:351\n";
+"--src virtual_dir.sql:350\n";
 
 static const char *proc30 = 
+"#line 365 \"[executable]/virtual_dir.sql\"\n"
 "create procedure VHOST_DEFINE (in vhost varchar := \'*ini*\',\n"
 "in lhost varchar := \'*ini*\',\n"
 "in lpath varchar,\n"
@@ -2674,9 +4109,10 @@ static const char *proc30 =
 "}\n"
 "\n"
 "}\n"
-"--src virtual_dir.sql:364\n";
+"--src virtual_dir.sql:363\n";
 
 static const char *proc31 = 
+"#line 499 \"[executable]/virtual_dir.sql\"\n"
 "create procedure VHOST_MAP_RELOAD (in vhost varchar := \'*ini*\', in lhost varchar := \'*ini*\', in lpath varchar)\n"
 "{\n"
 "declare ssl_port, varr varchar;\n"
@@ -2732,9 +4168,10 @@ static const char *proc31 =
 "}\n"
 "return ret;\n"
 "}\n"
-"--src virtual_dir.sql:498\n";
+"--src virtual_dir.sql:497\n";
 
 static const char *proc32 = 
+"#line 557 \"[executable]/virtual_dir.sql\"\n"
 "create procedure VHOST_REMOVE (in vhost varchar := \'*ini*\',\n"
 "in lhost varchar := \'*ini*\',\n"
 "in lpath varchar,\n"
@@ -2810,15 +4247,16 @@ static const char *proc32 =
 "err_exit:\n"
 "close cr;\n"
 "}\n"
-"--src virtual_dir.sql:556\n";
+"--src virtual_dir.sql:555\n";
 
 
-static const char *other197 = 
+static const char *other865 = 
 " WS.WS.URIQA_VHOST_RESET()\n";
 
-static const char *other198 = 
+static const char *other866 = 
 " WS.WS.SPARQL_VHOST_RESET()\n";
 static const char *proc33 = 
+"#line 644 \"[executable]/virtual_dir.sql\"\n"
 "create procedure\n"
 "HTTP_PROXY_ACCESS (in dst varchar)\n"
 "returns integer\n"
@@ -2847,7 +4285,7 @@ static const char *proc33 =
 "\n"
 "return rc;\n"
 "}\n"
-"--src virtual_dir.sql:643\n";
+"--src virtual_dir.sql:642\n";
 
 static const char *tbl29 = 
 "create table WS.WS.SYS_RC_CACHE\n"
@@ -2864,29 +4302,33 @@ static const char *tbl29 =
 static const char *tbl30 = 
 "create table WS.WS.SYS_CACHEABLE (CA_URI varchar, CA_CHECK varchar, primary key (CA_URI))\n";
 
-static const char *trig6 = 
+static const char *trig9 = 
+"#line 708 \"[executable]/virtual_dir.sql\"\n"
 "create trigger SYS_CACHEABLE_I after insert on WS.WS.SYS_CACHEABLE\n"
 "{\n"
 "http_url_cache_set (CA_URI, CA_CHECK);\n"
 "}\n"
-"--src virtual_dir.sql:707\n";
+"--src virtual_dir.sql:706\n";
 
-static const char *trig7 = 
+static const char *trig10 = 
+"#line 714 \"[executable]/virtual_dir.sql\"\n"
 "create trigger SYS_CACHEABLE_U after update on WS.WS.SYS_CACHEABLE referencing old as O, new as N\n"
 "{\n"
 "http_url_cache_set (N.CA_URI, N.CA_CHECK);\n"
 "}\n"
-"--src virtual_dir.sql:713\n";
+"--src virtual_dir.sql:712\n";
 
-static const char *trig8 = 
+static const char *trig11 = 
+"#line 720 \"[executable]/virtual_dir.sql\"\n"
 "create trigger SYS_CACHEABLE_D after delete on WS.WS.SYS_CACHEABLE\n"
 "{\n"
 "http_url_cache_remove (CA_URI);\n"
 "delete from WS.WS.SYS_RC_CACHE where RC_URI = CA_URI;\n"
 "}\n"
-"--src virtual_dir.sql:719\n";
+"--src virtual_dir.sql:718\n";
 
 static const char *proc34 = 
+"#line 727 \"[executable]/virtual_dir.sql\"\n"
 "create procedure WS.WS.HTTP_CACHE_CHECK (inout path any, inout lines any, inout check_fn any)\n"
 "{\n"
 "declare inv, rc, cnt, tag, charset, url, qstr, sch any;\n"
@@ -2947,9 +4389,10 @@ static const char *proc34 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src virtual_dir.sql:726\n";
+"--src virtual_dir.sql:725\n";
 
 static const char *proc35 = 
+"#line 789 \"[executable]/virtual_dir.sql\"\n"
 "create procedure WS.WS.HTTP_CACHE_STORE (inout path any, inout store int)\n"
 "{\n"
 "declare tag, cnt any;\n"
@@ -2985,9 +4428,10 @@ static const char *proc35 =
 "http_header (concat (http_header_get (), \'ETag: \"\', tag, \'\"\\r\\n\'));\n"
 "}\n"
 "}\n"
-"--src virtual_dir.sql:788\n";
+"--src virtual_dir.sql:787\n";
 
 static const char *proc36 = 
+"#line 827 \"[executable]/virtual_dir.sql\"\n"
 "create procedure virt_proxy_init ()\n"
 "{\n"
 "if (not exists (select 1 from \"DB\".\"DBA\".\"SYS_USERS\" where U_NAME = \'PROXY\'))\n"
@@ -3003,9 +4447,10 @@ static const char *proc36 =
 "opts=>vector(\'url_rewrite\', \'ext_http_proxy_rule_list1\'));\n"
 "registry_set (\'DB.DBA.virt_proxy_init_state\', \'1.1\');\n"
 "}\n"
-"--src virtual_dir.sql:826\n";
+"--src virtual_dir.sql:825\n";
 
 static const char *proc37 = 
+"#line 844 \"[executable]/virtual_dir.sql\"\n"
 "create procedure\n"
 "proxy_sp_html_error_page (in title varchar, in hd varchar, in message varchar)\n"
 "{\n"
@@ -3022,9 +4467,10 @@ static const char *proc37 =
 "http (\'</body>\');\n"
 "http (\'</html>\');\n"
 "}\n"
-"--src virtual_dir.sql:843\n";
+"--src virtual_dir.sql:842\n";
 
 static const char *proc38 = 
+"#line 868 \"[executable]/virtual_dir.sql\"\n"
 "create procedure\n"
 "str_fmt (in fmt_str varchar, in parm_arr any)\n"
 "{\n"
@@ -3062,7 +4508,7 @@ static const char *proc38 =
 "st := p + 1;\n"
 "}\n"
 "}\n"
-"--src virtual_dir.sql:867\n";
+"--src virtual_dir.sql:866\n";
 
 static const char *tbl31 = 
 "create table DB.DBA.PROXY_SP_QRY (\n"
@@ -3077,6 +4523,7 @@ static const char *tbl31 =
 ")\n";
 
 static const char *proc39 = 
+"#line 922 \"[executable]/virtual_dir.sql\"\n"
 "create procedure\n"
 "ext_http_proxy_exec_qry (in exec varchar, in params any)\n"
 "{\n"
@@ -3122,7 +4569,8 @@ static const char *proc39 =
 "http_request_status (\'HTTP/1.1 400 Bad request\');\n"
 "proxy_sp_html_error_page (\'Error: insufficient no of params\',\n"
 "\'Insufficient number of parameters\',\n"
-"\'This query takes exactly \' || _n_parms || \'parameters\');\n"
+"\'This query takes exactly \' || cast (_n_parms as varchar) || \' parameters\');\n"
+"return;\n"
 "}\n"
 "\n"
 "declare xec_str varchar;\n"
@@ -3144,9 +4592,10 @@ static const char *proc39 =
 "\n"
 "http (ses);\n"
 "}\n"
-"--src virtual_dir.sql:921\n";
+"--src virtual_dir.sql:920\n";
 
 static const char *proc40 = 
+"#line 994 \"[executable]/virtual_dir.sql\"\n"
 "create procedure\n"
 "ext_http_proxy (in url varchar := null,\n"
 "in exec varchar := null,\n"
@@ -3183,6 +4632,16 @@ static const char *proc40 =
 "if (header is not null)\n"
 "req_hdr := header;\n"
 "\n"
+"if (0 = length (url))\n"
+"{\n"
+"http_rewrite();\n"
+"http_request_status (\'HTTP/1.1 400 Bad request\');\n"
+"proxy_sp_html_error_page (\'Error: insufficient no of params\',\n"
+"\'Insufficient number of parameters\',\n"
+"\'This service expects \"url\" input argument which is not supplied.\');\n"
+"return \'\';\n"
+"}\n"
+"\n"
 "arr := rfc1808_parse_uri (url);\n"
 "arr[5] := \'\';\n"
 "\n"
@@ -3366,6 +4825,7 @@ static const char *proc40 =
 "--src virtual_dir.sql:992\n";
 
 static const char *proc41 = 
+"#line 1222 \"[executable]/virtual_dir.sql\"\n"
 "create procedure\n"
 "DB.DBA.VHOST_DUMP_SQL (in lpath varchar, in vhost varchar := \'*ini*\', in lhost varchar := \'*ini*\')\n"
 "{\n"
@@ -3429,9 +4889,10 @@ static const char *proc41 =
 "}\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src virtual_dir.sql:1210\n";
+"--src virtual_dir.sql:1220\n";
 
 static const char *proc42 = 
+"#line 1288 \"[executable]/virtual_dir.sql\"\n"
 "create procedure DB.DBA.HTTP_RDF_GET_ACCEPT_BY_Q (in accept varchar)\n"
 "{\n"
 "declare format, itm varchar;\n"
@@ -3466,9 +4927,10 @@ static const char *proc42 =
 "}\n"
 "return format;\n"
 "}\n"
-"--src virtual_dir.sql:1276\n";
+"--src virtual_dir.sql:1286\n";
 
 static const char *proc43 = 
+"#line 1324 \"[executable]/virtual_dir.sql\"\n"
 "create procedure DB.DBA.HTTP_RDF_ACCEPT (in path varchar, in virtual_dir varchar, in lines any, in graph_mode int)\n"
 "{\n"
 "declare host, stat, msg, qry, data, meta, accept, format, graph, url, ssl varchar;\n"
@@ -3515,9 +4977,10 @@ static const char *proc43 =
 "signal (stat, msg);\n"
 "return 0;\n"
 "}\n"
-"--src virtual_dir.sql:1312\n";
+"--src virtual_dir.sql:1322\n";
 
 static const char *proc44 = 
+"#line 1372 \"[executable]/virtual_dir.sql\"\n"
 "create procedure WS.WS.DIR_INDEX_MAKE_XML (inout _sheet varchar, in curdir varchar := null, in start_from varchar := null)\n"
 "{\n"
 "declare dirarr, filearr, fsize, xte_path, xte_list, xte_entry any;\n"
@@ -3554,7 +5017,7 @@ static const char *proc44 =
 "else\n"
 "modt := now();\n"
 "if (dirname <> \'.\')\n"
-"xte_nodebld_acc (xte_list, xte_node (xte_head (\'SUBDIR\', \'name\', dirname,\n"
+"xte_nodebld_acc (xte_list, xte_node (xte_head (\'SUBDIR\', \'name\', sprintf(\'%U\',dirname),\n"
 "\'modify\', soap_print_box (modt, \'\', 2) ) ) );\n"
 "ix := ix + 1;\n"
 "}\n"
@@ -3578,7 +5041,7 @@ static const char *proc44 =
 "mult := mult + 1;\n"
 "flen := flen / 1000;\n"
 "}\n"
-"xte_nodebld_acc (xte_list, xte_node (xte_head (\'FILE\', \'name\', dirname,\n"
+"xte_nodebld_acc (xte_list, xte_node (xte_head (\'FILE\', \'name\', sprintf(\'%U\',dirname),\n"
 "\'modify\', soap_print_box (modt, \'\', 2), \'rs\', rflen,\n"
 "\'hs\', sprintf (\'%d %s\', flen, aref (fsize, mult)) ) ) );\n"
 "ix := ix + 1;\n"
@@ -3588,9 +5051,9 @@ static const char *proc44 =
 "xte_nodebld_final (xte_path, xte_head (\'PATH\'));\n"
 "return xml_tree_doc (xte_path);\n"
 "}\n"
-"--src virtual_dir.sql:1360\n";
+"--src virtual_dir.sql:1370\n";
 
-static const char *other199 = 
+static const char *other867 = 
 "xslt_sheet (\'http://local.virt/dir_output\', xml_tree_doc (\'\n"
 "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">\n"
 "<xsl:output method=\"text\" encoding=\"UTF-8\" />\n"
@@ -3641,6 +5104,7 @@ static const char *other199 =
 "\n"
 "</xsl:stylesheet>\'))\n";
 static const char *proc45 = 
+"#line 1497 \"[executable]/virtual_dir.sql\"\n"
 "create procedure WS.WS.DIR_INDEX_XML (in path any, in params any, in lines any)\n"
 "{\n"
 "declare _html, _xml, _sheet varchar;\n"
@@ -3675,11 +5139,13 @@ static const char *proc45 =
 "xslt_sheet (ssheet_name, xtree_doc (ssheet_text));\n"
 "else\n"
 "ssheet_name := \'http://local.virt/dir_output\';\n"
+"set http_charset=\'UTF-8\';\n"
 "return http_value (xslt (ssheet_name, _xml));\n"
 "}\n"
-"--src virtual_dir.sql:1485\n";
+"--src virtual_dir.sql:1495\n";
 
 static const char *proc46 = 
+"#line 1536 \"[executable]/virtual_dir.sql\"\n"
 "create procedure DB.DBA.SERVICES_WSIL (in path any, in params any, in lines any)\n"
 "{\n"
 "declare host, intf, requrl, proto, rhost varchar;\n"
@@ -3713,18 +5179,129 @@ static const char *proc46 =
 "}\n"
 "http(\'</inspection>\');\n"
 "}\n"
-"--src virtual_dir.sql:1523\n";
+"--src virtual_dir.sql:1534\n";
+
+static const char *tbl32 = 
+"create table WS.WS.HTTP_HOST_META (\n"
+"HM_APP 	varchar primary key,\n"
+"HM_META	long varchar\n"
+")\n";
+
+static const char *proc47 = 
+"#line 1579 \"[executable]/virtual_dir.sql\"\n"
+"create procedure WS.WS.host_meta_add (in app varchar, in meta varchar)\n"
+"{\n"
+"\n"
+"xtree_doc (meta);\n"
+"insert replacing WS.WS.HTTP_HOST_META (HM_APP, HM_META)\n"
+"values (app, meta);\n"
+"}\n"
+"--src virtual_dir.sql:1577\n";
+
+static const char *proc48 = 
+"#line 1588 \"[executable]/virtual_dir.sql\"\n"
+"create procedure WS.WS.host_meta_del (in app varchar)\n"
+"{\n"
+"delete from WS.WS.HTTP_HOST_META where HM_APP = app;\n"
+"}\n"
+"--src virtual_dir.sql:1586\n";
+
+static const char *proc49 = 
+"#line 1595 \"[executable]/virtual_dir.sql\"\n"
+"create procedure WS.WS.\"host-meta\" (in format varchar := \'xml\') __SOAP_HTTP \'application/xrd+xml\'\n"
+"{\n"
+"declare ses, lines any;\n"
+"declare ret, accept varchar;\n"
+"ses := string_output ();\n"
+"http (\'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n\', ses);\n"
+"http (\'<XRD xmlns=\"http://docs.oasis-open.org/ns/xri/xrd-1.0\" xmlns:hm=\"http://host-meta.net/xrd/1.0\" Id=\"host-meta\">\\n\', ses);\n"
+"http (sprintf (\'  <hm:Host>%{WSHost}s</hm:Host>\\n\'), ses);\n"
+"for select * from WS.WS.HTTP_HOST_META do\n"
+"{\n"
+"HM_META := sprintf (blob_to_string (HM_META));\n"
+"http (\'  \', ses);\n"
+"http (HM_META, ses);\n"
+"http (\'\\n\', ses);\n"
+"}\n"
+"http (\'</XRD>\\n\', ses);\n"
+"ret := string_output_string (ses);\n"
+"if (xenc_key_exists (\'id_rsa\') and __proc_exists (\'xml_sign\', 2) is not null)\n"
+"{\n"
+"ret := xml_sign (ret, WS.WS.host_meta_dss (), \'http://docs.oasis-open.org/ns/xri/xrd-1.0:XRD\');\n"
+"}\n"
+"lines := http_request_header ();\n"
+"accept := DB.DBA.HTTP_RDF_GET_ACCEPT_BY_Q (http_request_header_full (lines, \'Accept\', \'*/*\'));\n"
+"if (format = \'json\' or accept = \'application/json\')\n"
+"{\n"
+"http_header (\'Content-Type: applicaition/json\\r\\n\');\n"
+"http_xslt (\'http://local.virt/xrd2json\');\n"
+"}\n"
+"return ret;\n"
+"}\n"
+"--src virtual_dir.sql:1593\n";
+
+static const char *proc50 = 
+"#line 1627 \"[executable]/virtual_dir.sql\"\n"
+"create procedure WS.WS.host_meta_init ()\n"
+"{\n"
+"if (not exists (select 1 from \"DB\".\"DBA\".\"SYS_USERS\" where U_NAME = \'WebMeta\'))\n"
+"{\n"
+"DB.DBA.USER_CREATE (\'WebMeta\', uuid(), vector (\'DISABLED\', 1));\n"
+"EXEC_STMT (\'grant execute on WS.WS.\"host-meta\" to WebMeta\', 0);\n"
+"}\n"
+"\n"
+"DB.DBA.VHOST_REMOVE (lpath=>\'/.well-known\');\n"
+"DB.DBA.VHOST_DEFINE (lpath=>\'/.well-known\', ppath=>\'/SOAP/Http\', soap_user=>\'WebMeta\');\n"
+"}\n"
+"--src virtual_dir.sql:1625\n";
+
+static const char *other868 = 
+"WS.WS.host_meta_init ()\n";
+static const char *proc51 = 
+"#line 1643 \"[executable]/virtual_dir.sql\"\n"
+"create procedure WS.WS.host_meta_dss ()\n"
+"{\n"
+"declare ses any;\n"
+"ses := string_output ();\n"
+"http (\'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n\', ses);\n"
+"http (\'<Signature \\n\', ses);\n"
+"http (\'    xmlns=\"http://www.w3.org/2000/09/xmldsig#\" \\n\', ses);\n"
+"http (\'    xmlns:hm=\"http://host-meta.net/xrd/1.0\"\\n\', ses);\n"
+"http (\'    xmlns:xr=\"http://docs.oasis-open.org/ns/xri/xrd-1.0\"\\n\', ses);\n"
+"http (\'    >\\n\', ses);\n"
+"http (\'    <SignedInfo>\\n\', ses);\n"
+"http (\'	<CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" />\\n\', ses);\n"
+"http (\'	<SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" />\\n\', ses);\n"
+"http (\'	<Reference URI=\"#host-meta\">\\n\', ses);\n"
+"http (\'	    <Transforms>\\n\', ses);\n"
+"http (\'		<Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" />\\n\', ses);\n"
+"http (\'	    </Transforms>\\n\', ses);\n"
+"http (\'	    <DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" />\\n\', ses);\n"
+"http (\'	    <DigestValue></DigestValue>\\n\', ses);\n"
+"http (\'	</Reference>\\n\', ses);\n"
+"http (\'    </SignedInfo>\\n\', ses);\n"
+"http (\'    <SignatureValue></SignatureValue>\\n\', ses);\n"
+"http (\'    <KeyInfo>\\n\', ses);\n"
+"http (\'	<KeyName>id_rsa</KeyName>\\n\', ses);\n"
+"http (\'	<KeyValue>\\n\', ses);\n"
+"http (\'	    <X509Data></X509Data>\\n\', ses);\n"
+"http (\'	</KeyValue>\\n\', ses);\n"
+"http (\'    </KeyInfo>\\n\', ses);\n"
+"http (\'</Signature>\\n\', ses);\n"
+"return string_output_string (ses);\n"
+"}\n"
+"--src virtual_dir.sql:1641\n";
 
 /* url_rewrite.sql */
 
-static const char *tbl32 = 
+static const char *tbl33 = 
 "create table DB.DBA.URL_REWRITE_RULE_LIST (\n"
 "URRL_LIST     varchar not null,\n"
 "URRL_INX      integer not null,\n"
 "URRL_MEMBER   varchar not null,\n"
 "primary key (URRL_LIST, URRL_INX) )\n";
 
-static const char *tbl33 = 
+static const char *tbl34 = 
 "create table DB.DBA.URL_REWRITE_RULE (\n"
 "URR_RULE      varchar not null,\n"
 "URR_RULE_TYPE integer not null,\n"
@@ -3740,7 +5317,7 @@ static const char *tbl33 =
 "URR_HTTP_HEADERS	varchar,\n"
 "primary key (URR_RULE) )\n";
 
-static const char *tbl34 = 
+static const char *tbl35 = 
 "create table DB.DBA.HTTP_VARIANT_MAP (\n"
 "VM_ID		integer identity,\n"
 "VM_RULELIST		varchar,\n"
@@ -3756,7 +5333,8 @@ static const char *tbl34 =
 "primary key (VM_RULELIST, VM_URI, VM_VARIANT_URI))\n"
 "create unique index HTTP_VARIANT_MAP_ID on DB.DBA.HTTP_VARIANT_MAP (VM_ID)\n";
 
-static const char *proc47 = 
+static const char *proc52 = 
+"#line 87 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.URLREWRITE_CREATE_RULE (\n"
 "in rule_type int,\n"
 "in rule_iri varchar,\n"
@@ -3799,9 +5377,10 @@ static const char *proc47 =
 "insert replacing DB.DBA.URL_REWRITE_RULE (URR_RULE, URR_RULE_TYPE, URR_NICE_FORMAT, URR_NICE_PARAMS, URR_NICE_MIN_PARAMS, URR_TARGET_FORMAT, URR_TARGET_PARAMS, URR_TARGET_EXPR, URR_ACCEPT_PATTERN, URR_NO_CONTINUATION, URR_HTTP_REDIRECT, URR_HTTP_HEADERS)\n"
 "values (rule_iri, rule_type, nice_format, serialize (nice_params), nice_min_params, target_format, serialize (target_params), target_expn, accept_pattern, dont_continue, http_redirect, http_headers);\n"
 "}\n"
-"--src url_rewrite.sql:86\n";
+"--src url_rewrite.sql:85\n";
 
-static const char *proc48 = 
+static const char *proc53 = 
+"#line 131 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.URLREWRITE_CREATE_SPRINTF_RULE (\n"
 "in rule_iri varchar,\n"
 "in allow_update integer,\n"
@@ -3818,9 +5397,10 @@ static const char *proc48 =
 "{\n"
 "DB.DBA.URLREWRITE_CREATE_RULE (0, rule_iri, allow_update, nice_format, nice_params, nice_min_params, target_format, target_params, target_expn, accept_pattern, dont_continue, http_redirect, http_headers);\n"
 "}\n"
-"--src url_rewrite.sql:130\n";
+"--src url_rewrite.sql:129\n";
 
-static const char *proc49 = 
+static const char *proc54 = 
+"#line 149 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.URLREWRITE_CREATE_REGEX_RULE (\n"
 "in rule_iri varchar,\n"
 "in allow_update integer,\n"
@@ -3837,9 +5417,10 @@ static const char *proc49 =
 "{\n"
 "DB.DBA.URLREWRITE_CREATE_RULE (1, rule_iri, allow_update, nice_format, nice_params, nice_min_params, target_format, target_params, target_expn, accept_pattern, dont_continue, http_redirect, http_headers);\n"
 "}\n"
-"--src url_rewrite.sql:148\n";
+"--src url_rewrite.sql:147\n";
 
-static const char *proc50 = 
+static const char *proc55 = 
+"#line 167 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.URLREWRITE_DROP_RULE (\n"
 "in rule_iri varchar,\n"
 "in force integer := 0)\n"
@@ -3860,9 +5441,10 @@ static const char *proc50 =
 "delete from DB.DBA.URL_REWRITE_RULE where URR_RULE = rule_iri;\n"
 "return 1;\n"
 "}\n"
-"--src url_rewrite.sql:166\n";
+"--src url_rewrite.sql:165\n";
 
-static const char *proc51 = 
+static const char *proc56 = 
+"#line 189 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.URLREWRITE_CREATE_RULELIST (\n"
 "in rulelist_iri varchar,\n"
 "in allow_update integer,\n"
@@ -3888,9 +5470,10 @@ static const char *proc51 =
 "insert replacing DB.DBA.URL_REWRITE_RULE_LIST (URRL_LIST, URRL_INX, URRL_MEMBER) values (rulelist_iri, cur, vector_of_rule_iris[cur]);\n"
 "}\n"
 "}\n"
-"--src url_rewrite.sql:188\n";
+"--src url_rewrite.sql:187\n";
 
-static const char *proc52 = 
+static const char *proc57 = 
+"#line 216 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.URLREWRITE_DROP_RULELIST (\n"
 "in rulelist_iri varchar,\n"
 "in force integer := 0)\n"
@@ -3940,9 +5523,10 @@ static const char *proc52 =
 "}\n"
 "delete from DB.DBA.URL_REWRITE_RULE_LIST where URRL_LIST = rulelist_iri;\n"
 "}\n"
-"--src url_rewrite.sql:215\n";
+"--src url_rewrite.sql:214\n";
 
-static const char *proc53 = 
+static const char *proc58 = 
+"#line 267 \"[executable]/url_rewrite.sql\"\n"
 "create function DB.DBA.URLREWRITE_ENUMERATE_RULES (\n"
 "in like_pattern_for_rule_iris varchar,\n"
 "in dump_details integer := 0)\n"
@@ -3960,9 +5544,10 @@ static const char *proc53 =
 "}\n"
 "return iri_list;\n"
 "}\n"
-"--src url_rewrite.sql:266\n";
+"--src url_rewrite.sql:265\n";
 
-static const char *proc54 = 
+static const char *proc59 = 
+"#line 286 \"[executable]/url_rewrite.sql\"\n"
 "create function DB.DBA.URLREWRITE_ENUMERATE_RULELISTS (\n"
 "in like_pattern_for_rulelist_iris varchar,\n"
 "in dump_details integer := 0)\n"
@@ -3981,9 +5566,10 @@ static const char *proc54 =
 "}\n"
 "return iri_list;\n"
 "}\n"
-"--src url_rewrite.sql:285\n";
+"--src url_rewrite.sql:284\n";
 
-static const char *proc55 = 
+static const char *proc60 = 
+"#line 306 \"[executable]/url_rewrite.sql\"\n"
 "create function DB.DBA.URLREWRITE_VPRINTF (\n"
 "in format varchar,\n"
 "in params any,\n"
@@ -4019,9 +5605,10 @@ static const char *proc55 =
 "\n"
 "return long_path;\n"
 "}\n"
-"--src url_rewrite.sql:305\n";
+"--src url_rewrite.sql:304\n";
 
-static const char *proc56 = 
+static const char *proc61 = 
+"#line 343 \"[executable]/url_rewrite.sql\"\n"
 "create function DB.DBA.URLREWRITE_SPRINTF_RESULTS (\n"
 "in nice_params any,\n"
 "in nice_parts any,\n"
@@ -4110,17 +5697,16 @@ static const char *proc56 =
 "long_path := replace (long_path, \'^{URIQADefaultHost}^\', host);\n"
 "if (strstr (long_path, \'^{DynamicLocalFormat}^\') is not null)\n"
 "{\n"
-"if (strchr (host, \':\') is not null)\n"
-"long_path := replace (long_path, \'^{DynamicLocalFormat}^\', sprintf (\'http://%{WSHostName}U:%{WSHostPort}U\'));\n"
-"else\n"
-"long_path := replace (long_path, \'^{DynamicLocalFormat}^\', sprintf (\'http://%{WSHost}U\'));\n"
+"long_path := replace (long_path, \'^{DynamicLocalFormat}^\', \n"
+"sprintf (\'%s://%{WSHost}s\', case when is_https_ctx () then \'https\' else \'http\' end));\n"
 "}\n"
 "}\n"
 "return long_path;\n"
 "}\n"
-"--src url_rewrite.sql:342\n";
+"--src url_rewrite.sql:341\n";
 
-static const char *proc57 = 
+static const char *proc62 = 
+"#line 440 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.URLREWRITE_APPLY_RECURSIVE (\n"
 "in rulelist_iri varchar,\n"
 "in nice_host varchar,\n"
@@ -4240,9 +5826,10 @@ static const char *proc57 =
 "}\n"
 "}\n"
 "}\n"
-"--src url_rewrite.sql:441\n";
+"--src url_rewrite.sql:438\n";
 
-static const char *proc58 = 
+static const char *proc63 = 
+"#line 561 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.URLREWRITE_APPLY (\n"
 "in nice_url varchar,\n"
 "in post_params any,\n"
@@ -4321,9 +5908,10 @@ static const char *proc58 =
 "http_headers,\n"
 "lines);\n"
 "}\n"
-"--src url_rewrite.sql:562\n";
+"--src url_rewrite.sql:559\n";
 
-static const char *proc59 = 
+static const char *proc64 = 
+"#line 641 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.URLREWRITE_TRY_INVERSE (\n"
 "in rule_iri varchar,\n"
 "in long_path varchar,\n"
@@ -4525,9 +6113,10 @@ static const char *proc59 =
 "nice_path := null;\n"
 "error_report := \'The rule \' || rule_iri || \' is not found\';\n"
 "}\n"
-"--src url_rewrite.sql:642\n";
+"--src url_rewrite.sql:639\n";
 
-static const char *proc60 = 
+static const char *proc65 = 
+"#line 844 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.HTTP_VARIANT_ADD (in rulelist_uri varchar,\n"
 "in uri varchar, in variant_uri varchar, in mime varchar,\n"
 "in qs float := 1.0, in _desc varchar := null,\n"
@@ -4567,18 +6156,20 @@ static const char *proc60 =
 "VM_LANG,VM_ENC,VM_DESCRIPTION,VM_ALGO, VM_CONTENT_LOCATION_HOOK)\n"
 "values (rulelist_uri, uri, variant_uri, qs, mime, lang, enc, _desc, algo, location_hook);\n"
 "}\n"
-"--src url_rewrite.sql:845\n";
+"--src url_rewrite.sql:842\n";
 
-static const char *proc61 = 
+static const char *proc66 = 
+"#line 885 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.HTTP_VARIANT_REMOVE (in rulelist_uri varchar, in uri varchar, in variant_uri varchar := \'%\')\n"
 "{\n"
 "if (not exists (select 1 from DB.DBA.URL_REWRITE_RULE_LIST where URRL_LIST = rulelist_uri))\n"
 "signal (\'42000\', \'Rule IRI \' || rulelist_uri || \' does not exist.\');\n"
 "delete from DB.DBA.HTTP_VARIANT_MAP where VM_RULELIST = rulelist_uri and VM_URI like uri and VM_VARIANT_URI like variant_uri;\n"
 "}\n"
-"--src url_rewrite.sql:886\n";
+"--src url_rewrite.sql:883\n";
 
-static const char *proc62 = 
+static const char *proc67 = 
+"#line 893 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.URLREWRITE_CALC_QS (in accept varchar, in s_accept varchar)\n"
 "{\n"
 "declare arr, tmp any;\n"
@@ -4619,9 +6210,10 @@ static const char *proc62 =
 "}\n"
 "return best_q;\n"
 "}\n"
-"--src url_rewrite.sql:894\n";
+"--src url_rewrite.sql:891\n";
 
-static const char *proc63 = 
+static const char *proc68 = 
+"#line 935 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.HTTP_URLREWRITE_TCN_LIST (inout li any)\n"
 "{\n"
 "http (\'<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\\n\');\n"
@@ -4634,9 +6226,10 @@ static const char *proc63 =
 "http (li);\n"
 "http (\'</ul>\\n</body></html>\');\n"
 "}\n"
-"--src url_rewrite.sql:936\n";
+"--src url_rewrite.sql:933\n";
 
-static const char *proc64 = 
+static const char *proc69 = 
+"#line 949 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.HTTP_URLREWRITE_APPLY_PATTERN (in pattern varchar, in str varchar, in format varchar)\n"
 "{\n"
 "declare arr, pars, ret, tmp any;\n"
@@ -4690,17 +6283,15 @@ static const char *proc64 =
 "ret := replace (ret, \'^{URIQADefaultHost}^\', host);\n"
 "if (strstr (ret, \'^{DynamicLocalFormat}^\') is not null)\n"
 "{\n"
-"if (strchr (host, \':\') is not null)\n"
-"ret := replace (ret, \'^{DynamicLocalFormat}^\', sprintf (\'http://%{WSHostName}U:%{WSHostPort}U\'));\n"
-"else\n"
-"ret := replace (ret, \'^{DynamicLocalFormat}^\', sprintf (\'http://%{WSHost}U\'));\n"
+"ret := replace (ret, \'^{DynamicLocalFormat}^\', sprintf (\'%s://%{WSHost}s\', case when is_https_ctx () then \'https\' else \'http\' end));\n"
 "}\n"
 "}\n"
 "return ret;\n"
 "}\n"
-"--src url_rewrite.sql:950\n";
+"--src url_rewrite.sql:947\n";
 
-static const char *proc65 = 
+static const char *proc70 = 
+"#line 1010 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.HTTP_LOC_NEW_URL (in url any)\n"
 "{\n"
 "declare ret, host any;\n"
@@ -4725,9 +6316,10 @@ static const char *proc65 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src url_rewrite.sql:1014\n";
+"--src url_rewrite.sql:1008\n";
 
-static const char *proc66 = 
+static const char *proc71 = 
+"#line 1037 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.URLREWRITE_APPLY_TCN (in rulelist_uri varchar, inout path varchar, inout lines any,\n"
 "out http_code any, out http_headers any)\n"
 "{\n"
@@ -4883,9 +6475,10 @@ static const char *proc66 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src url_rewrite.sql:1041\n";
+"--src url_rewrite.sql:1035\n";
 
-static const char *proc67 = 
+static const char *proc72 = 
+"#line 1194 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.HTTP_URLREWRITE (in path varchar, in rule_list varchar, in post_params any := null) returns any\n"
 "{\n"
 "declare long_url varchar;\n"
@@ -4978,6 +6571,11 @@ static const char *proc67 =
 "http_headers := replace (http_headers, tmp, repl);\n"
 "tmp := regexp_match (\'\\\\^{sql:[^}]*}\\\\^\', http_headers);\n"
 "}\n"
+"if (strstr (http_headers, \'^{DynamicLocalFormat}^\') is not null)\n"
+"{\n"
+"http_headers := replace (http_headers, \'^{DynamicLocalFormat}^\',\n"
+"sprintf (\'%s://%{WSHost}s\', case when is_https_ctx () then \'https\' else \'http\' end));\n"
+"}\n"
 "\n"
 "http_headers := rtrim (http_headers, \'\\r\\n\');\n"
 "if (length (http_headers))\n"
@@ -5019,9 +6617,10 @@ static const char *proc67 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src url_rewrite.sql:1198\n";
+"--src url_rewrite.sql:1192\n";
 
-static const char *proc68 = 
+static const char *proc73 = 
+"#line 1334 \"[executable]/url_rewrite.sql\"\n"
 "create procedure DB.DBA.URLREWRITE_DUMP_RULELIST_SQL (in rulelist_iri varchar)\n"
 "{\n"
 "declare ses, rules any;\n"
@@ -5090,11 +6689,11 @@ static const char *proc68 =
 "\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src url_rewrite.sql:1333\n";
+"--src url_rewrite.sql:1332\n";
 
-static const char *other200 = 
+static const char *other869 = 
 "virt_proxy_init ()\n";
-static const char *other201 = 
+static const char *other870 = 
 "grant execute on ext_http_proxy to PROXY\n";
 static int
 sch_proc_def_exists (client_connection_t *cli, const char *proc_name)
@@ -5348,6 +6947,677 @@ sqls_define_ddk (void)
   ddl_ensure_table ("do this always", other177);
   ddl_ensure_table ("do this always", other178);
   ddl_ensure_table ("do this always", other179);
+  ddl_ensure_table ("do this always", other180);
+  ddl_ensure_table ("do this always", other181);
+  ddl_ensure_table ("do this always", other182);
+  ddl_ensure_table ("do this always", other183);
+  ddl_ensure_table ("do this always", other184);
+  ddl_ensure_table ("do this always", other185);
+  ddl_ensure_table ("do this always", other186);
+  ddl_ensure_table ("do this always", other187);
+  ddl_ensure_table ("do this always", other188);
+  ddl_ensure_table ("do this always", other189);
+  ddl_ensure_table ("do this always", other190);
+  ddl_ensure_table ("do this always", other191);
+  ddl_ensure_table ("do this always", other192);
+  ddl_ensure_table ("do this always", other193);
+  ddl_ensure_table ("do this always", other194);
+  ddl_ensure_table ("do this always", other195);
+  ddl_ensure_table ("do this always", other196);
+  ddl_ensure_table ("do this always", other197);
+  ddl_ensure_table ("do this always", other198);
+  ddl_ensure_table ("do this always", other199);
+  ddl_ensure_table ("do this always", other200);
+  ddl_ensure_table ("do this always", other201);
+  ddl_ensure_table ("do this always", other202);
+  ddl_ensure_table ("do this always", other203);
+  ddl_ensure_table ("do this always", other204);
+  ddl_ensure_table ("do this always", other205);
+  ddl_ensure_table ("do this always", other206);
+  ddl_ensure_table ("do this always", other207);
+  ddl_ensure_table ("do this always", other208);
+  ddl_ensure_table ("do this always", other209);
+  ddl_ensure_table ("do this always", other210);
+  ddl_ensure_table ("do this always", other211);
+  ddl_ensure_table ("do this always", other212);
+  ddl_ensure_table ("do this always", other213);
+  ddl_ensure_table ("do this always", other214);
+  ddl_ensure_table ("do this always", other215);
+  ddl_ensure_table ("do this always", other216);
+  ddl_ensure_table ("do this always", other217);
+  ddl_ensure_table ("do this always", other218);
+  ddl_ensure_table ("do this always", other219);
+  ddl_ensure_table ("do this always", other220);
+  ddl_ensure_table ("do this always", other221);
+  ddl_ensure_table ("do this always", other222);
+  ddl_ensure_table ("do this always", other223);
+  ddl_ensure_table ("do this always", other224);
+  ddl_ensure_table ("do this always", other225);
+  ddl_ensure_table ("do this always", other226);
+  ddl_ensure_table ("do this always", other227);
+  ddl_ensure_table ("do this always", other228);
+  ddl_ensure_table ("do this always", other229);
+  ddl_ensure_table ("do this always", other230);
+  ddl_ensure_table ("do this always", other231);
+  ddl_ensure_table ("do this always", other232);
+  ddl_ensure_table ("do this always", other233);
+  ddl_ensure_table ("do this always", other234);
+  ddl_ensure_table ("do this always", other235);
+  ddl_ensure_table ("do this always", other236);
+  ddl_ensure_table ("do this always", other237);
+  ddl_ensure_table ("do this always", other238);
+  ddl_ensure_table ("do this always", other239);
+  ddl_ensure_table ("do this always", other240);
+  ddl_ensure_table ("do this always", other241);
+  ddl_ensure_table ("do this always", other242);
+  ddl_ensure_table ("do this always", other243);
+  ddl_ensure_table ("do this always", other244);
+  ddl_ensure_table ("do this always", other245);
+  ddl_ensure_table ("do this always", other246);
+  ddl_ensure_table ("do this always", other247);
+  ddl_ensure_table ("do this always", other248);
+  ddl_ensure_table ("do this always", other249);
+  ddl_ensure_table ("do this always", other250);
+  ddl_ensure_table ("do this always", other251);
+  ddl_ensure_table ("do this always", other252);
+  ddl_ensure_table ("do this always", other253);
+  ddl_ensure_table ("do this always", other254);
+  ddl_ensure_table ("do this always", other255);
+  ddl_ensure_table ("do this always", other256);
+  ddl_ensure_table ("do this always", other257);
+  ddl_ensure_table ("do this always", other258);
+  ddl_ensure_table ("do this always", other259);
+  ddl_ensure_table ("do this always", other260);
+  ddl_ensure_table ("do this always", other261);
+  ddl_ensure_table ("do this always", other262);
+  ddl_ensure_table ("do this always", other263);
+  ddl_ensure_table ("do this always", other264);
+  ddl_ensure_table ("do this always", other265);
+  ddl_ensure_table ("do this always", other266);
+  ddl_ensure_table ("do this always", other267);
+  ddl_ensure_table ("do this always", other268);
+  ddl_ensure_table ("do this always", other269);
+  ddl_ensure_table ("do this always", other270);
+  ddl_ensure_table ("do this always", other271);
+  ddl_ensure_table ("do this always", other272);
+  ddl_ensure_table ("do this always", other273);
+  ddl_ensure_table ("do this always", other274);
+  ddl_ensure_table ("do this always", other275);
+  ddl_ensure_table ("do this always", other276);
+  ddl_ensure_table ("do this always", other277);
+  ddl_ensure_table ("do this always", other278);
+  ddl_ensure_table ("do this always", other279);
+  ddl_ensure_table ("do this always", other280);
+  ddl_ensure_table ("do this always", other281);
+  ddl_ensure_table ("do this always", other282);
+  ddl_ensure_table ("do this always", other283);
+  ddl_ensure_table ("do this always", other284);
+  ddl_ensure_table ("do this always", other285);
+  ddl_ensure_table ("do this always", other286);
+  ddl_ensure_table ("do this always", other287);
+  ddl_ensure_table ("do this always", other288);
+  ddl_ensure_table ("do this always", other289);
+  ddl_ensure_table ("do this always", other290);
+  ddl_ensure_table ("do this always", other291);
+  ddl_ensure_table ("do this always", other292);
+  ddl_ensure_table ("do this always", other293);
+  ddl_ensure_table ("do this always", other294);
+  ddl_ensure_table ("do this always", other295);
+  ddl_ensure_table ("do this always", other296);
+  ddl_ensure_table ("do this always", other297);
+  ddl_ensure_table ("do this always", other298);
+  ddl_ensure_table ("do this always", other299);
+  ddl_ensure_table ("do this always", other300);
+  ddl_ensure_table ("do this always", other301);
+  ddl_ensure_table ("do this always", other302);
+  ddl_ensure_table ("do this always", other303);
+  ddl_ensure_table ("do this always", other304);
+  ddl_ensure_table ("do this always", other305);
+  ddl_ensure_table ("do this always", other306);
+  ddl_ensure_table ("do this always", other307);
+  ddl_ensure_table ("do this always", other308);
+  ddl_ensure_table ("do this always", other309);
+  ddl_ensure_table ("do this always", other310);
+  ddl_ensure_table ("do this always", other311);
+  ddl_ensure_table ("do this always", other312);
+  ddl_ensure_table ("do this always", other313);
+  ddl_ensure_table ("do this always", other314);
+  ddl_ensure_table ("do this always", other315);
+  ddl_ensure_table ("do this always", other316);
+  ddl_ensure_table ("do this always", other317);
+  ddl_ensure_table ("do this always", other318);
+  ddl_ensure_table ("do this always", other319);
+  ddl_ensure_table ("do this always", other320);
+  ddl_ensure_table ("do this always", other321);
+  ddl_ensure_table ("do this always", other322);
+  ddl_ensure_table ("do this always", other323);
+  ddl_ensure_table ("do this always", other324);
+  ddl_ensure_table ("do this always", other325);
+  ddl_ensure_table ("do this always", other326);
+  ddl_ensure_table ("do this always", other327);
+  ddl_ensure_table ("do this always", other328);
+  ddl_ensure_table ("do this always", other329);
+  ddl_ensure_table ("do this always", other330);
+  ddl_ensure_table ("do this always", other331);
+  ddl_ensure_table ("do this always", other332);
+  ddl_ensure_table ("do this always", other333);
+  ddl_ensure_table ("do this always", other334);
+  ddl_ensure_table ("do this always", other335);
+  ddl_ensure_table ("do this always", other336);
+  ddl_ensure_table ("do this always", other337);
+  ddl_ensure_table ("do this always", other338);
+  ddl_ensure_table ("do this always", other339);
+  ddl_ensure_table ("do this always", other340);
+  ddl_ensure_table ("do this always", other341);
+  ddl_ensure_table ("do this always", other342);
+  ddl_ensure_table ("do this always", other343);
+  ddl_ensure_table ("do this always", other344);
+  ddl_ensure_table ("do this always", other345);
+  ddl_ensure_table ("do this always", other346);
+  ddl_ensure_table ("do this always", other347);
+  ddl_ensure_table ("do this always", other348);
+  ddl_ensure_table ("do this always", other349);
+  ddl_ensure_table ("do this always", other350);
+  ddl_ensure_table ("do this always", other351);
+  ddl_ensure_table ("do this always", other352);
+  ddl_ensure_table ("do this always", other353);
+  ddl_ensure_table ("do this always", other354);
+  ddl_ensure_table ("do this always", other355);
+  ddl_ensure_table ("do this always", other356);
+  ddl_ensure_table ("do this always", other357);
+  ddl_ensure_table ("do this always", other358);
+  ddl_ensure_table ("do this always", other359);
+  ddl_ensure_table ("do this always", other360);
+  ddl_ensure_table ("do this always", other361);
+  ddl_ensure_table ("do this always", other362);
+  ddl_ensure_table ("do this always", other363);
+  ddl_ensure_table ("do this always", other364);
+  ddl_ensure_table ("do this always", other365);
+  ddl_ensure_table ("do this always", other366);
+  ddl_ensure_table ("do this always", other367);
+  ddl_ensure_table ("do this always", other368);
+  ddl_ensure_table ("do this always", other369);
+  ddl_ensure_table ("do this always", other370);
+  ddl_ensure_table ("do this always", other371);
+  ddl_ensure_table ("do this always", other372);
+  ddl_ensure_table ("do this always", other373);
+  ddl_ensure_table ("do this always", other374);
+  ddl_ensure_table ("do this always", other375);
+  ddl_ensure_table ("do this always", other376);
+  ddl_ensure_table ("do this always", other377);
+  ddl_ensure_table ("do this always", other378);
+  ddl_ensure_table ("do this always", other379);
+  ddl_ensure_table ("do this always", other380);
+  ddl_ensure_table ("do this always", other381);
+  ddl_ensure_table ("do this always", other382);
+  ddl_ensure_table ("do this always", other383);
+  ddl_ensure_table ("do this always", other384);
+  ddl_ensure_table ("do this always", other385);
+  ddl_ensure_table ("do this always", other386);
+  ddl_ensure_table ("do this always", other387);
+  ddl_ensure_table ("do this always", other388);
+  ddl_ensure_table ("do this always", other389);
+  ddl_ensure_table ("do this always", other390);
+  ddl_ensure_table ("do this always", other391);
+  ddl_ensure_table ("do this always", other392);
+  ddl_ensure_table ("do this always", other393);
+  ddl_ensure_table ("do this always", other394);
+  ddl_ensure_table ("do this always", other395);
+  ddl_ensure_table ("do this always", other396);
+  ddl_ensure_table ("do this always", other397);
+  ddl_ensure_table ("do this always", other398);
+  ddl_ensure_table ("do this always", other399);
+  ddl_ensure_table ("do this always", other400);
+  ddl_ensure_table ("do this always", other401);
+  ddl_ensure_table ("do this always", other402);
+  ddl_ensure_table ("do this always", other403);
+  ddl_ensure_table ("do this always", other404);
+  ddl_ensure_table ("do this always", other405);
+  ddl_ensure_table ("do this always", other406);
+  ddl_ensure_table ("do this always", other407);
+  ddl_ensure_table ("do this always", other408);
+  ddl_ensure_table ("do this always", other409);
+  ddl_ensure_table ("do this always", other410);
+  ddl_ensure_table ("do this always", other411);
+  ddl_ensure_table ("do this always", other412);
+  ddl_ensure_table ("do this always", other413);
+  ddl_ensure_table ("do this always", other414);
+  ddl_ensure_table ("do this always", other415);
+  ddl_ensure_table ("do this always", other416);
+  ddl_ensure_table ("do this always", other417);
+  ddl_ensure_table ("do this always", other418);
+  ddl_ensure_table ("do this always", other419);
+  ddl_ensure_table ("do this always", other420);
+  ddl_ensure_table ("do this always", other421);
+  ddl_ensure_table ("do this always", other422);
+  ddl_ensure_table ("do this always", other423);
+  ddl_ensure_table ("do this always", other424);
+  ddl_ensure_table ("do this always", other425);
+  ddl_ensure_table ("do this always", other426);
+  ddl_ensure_table ("do this always", other427);
+  ddl_ensure_table ("do this always", other428);
+  ddl_ensure_table ("do this always", other429);
+  ddl_ensure_table ("do this always", other430);
+  ddl_ensure_table ("do this always", other431);
+  ddl_ensure_table ("do this always", other432);
+  ddl_ensure_table ("do this always", other433);
+  ddl_ensure_table ("do this always", other434);
+  ddl_ensure_table ("do this always", other435);
+  ddl_ensure_table ("do this always", other436);
+  ddl_ensure_table ("do this always", other437);
+  ddl_ensure_table ("do this always", other438);
+  ddl_ensure_table ("do this always", other439);
+  ddl_ensure_table ("do this always", other440);
+  ddl_ensure_table ("do this always", other441);
+  ddl_ensure_table ("do this always", other442);
+  ddl_ensure_table ("do this always", other443);
+  ddl_ensure_table ("do this always", other444);
+  ddl_ensure_table ("do this always", other445);
+  ddl_ensure_table ("do this always", other446);
+  ddl_ensure_table ("do this always", other447);
+  ddl_ensure_table ("do this always", other448);
+  ddl_ensure_table ("do this always", other449);
+  ddl_ensure_table ("do this always", other450);
+  ddl_ensure_table ("do this always", other451);
+  ddl_ensure_table ("do this always", other452);
+  ddl_ensure_table ("do this always", other453);
+  ddl_ensure_table ("do this always", other454);
+  ddl_ensure_table ("do this always", other455);
+  ddl_ensure_table ("do this always", other456);
+  ddl_ensure_table ("do this always", other457);
+  ddl_ensure_table ("do this always", other458);
+  ddl_ensure_table ("do this always", other459);
+  ddl_ensure_table ("do this always", other460);
+  ddl_ensure_table ("do this always", other461);
+  ddl_ensure_table ("do this always", other462);
+  ddl_ensure_table ("do this always", other463);
+  ddl_ensure_table ("do this always", other464);
+  ddl_ensure_table ("do this always", other465);
+  ddl_ensure_table ("do this always", other466);
+  ddl_ensure_table ("do this always", other467);
+  ddl_ensure_table ("do this always", other468);
+  ddl_ensure_table ("do this always", other469);
+  ddl_ensure_table ("do this always", other470);
+  ddl_ensure_table ("do this always", other471);
+  ddl_ensure_table ("do this always", other472);
+  ddl_ensure_table ("do this always", other473);
+  ddl_ensure_table ("do this always", other474);
+  ddl_ensure_table ("do this always", other475);
+  ddl_ensure_table ("do this always", other476);
+  ddl_ensure_table ("do this always", other477);
+  ddl_ensure_table ("do this always", other478);
+  ddl_ensure_table ("do this always", other479);
+  ddl_ensure_table ("do this always", other480);
+  ddl_ensure_table ("do this always", other481);
+  ddl_ensure_table ("do this always", other482);
+  ddl_ensure_table ("do this always", other483);
+  ddl_ensure_table ("do this always", other484);
+  ddl_ensure_table ("do this always", other485);
+  ddl_ensure_table ("do this always", other486);
+  ddl_ensure_table ("do this always", other487);
+  ddl_ensure_table ("do this always", other488);
+  ddl_ensure_table ("do this always", other489);
+  ddl_ensure_table ("do this always", other490);
+  ddl_ensure_table ("do this always", other491);
+  ddl_ensure_table ("do this always", other492);
+  ddl_ensure_table ("do this always", other493);
+  ddl_ensure_table ("do this always", other494);
+  ddl_ensure_table ("do this always", other495);
+  ddl_ensure_table ("do this always", other496);
+  ddl_ensure_table ("do this always", other497);
+  ddl_ensure_table ("do this always", other498);
+  ddl_ensure_table ("do this always", other499);
+  ddl_ensure_table ("do this always", other500);
+  ddl_ensure_table ("do this always", other501);
+  ddl_ensure_table ("do this always", other502);
+  ddl_ensure_table ("do this always", other503);
+  ddl_ensure_table ("do this always", other504);
+  ddl_ensure_table ("do this always", other505);
+  ddl_ensure_table ("do this always", other506);
+  ddl_ensure_table ("do this always", other507);
+  ddl_ensure_table ("do this always", other508);
+  ddl_ensure_table ("do this always", other509);
+  ddl_ensure_table ("do this always", other510);
+  ddl_ensure_table ("do this always", other511);
+  ddl_ensure_table ("do this always", other512);
+  ddl_ensure_table ("do this always", other513);
+  ddl_ensure_table ("do this always", other514);
+  ddl_ensure_table ("do this always", other515);
+  ddl_ensure_table ("do this always", other516);
+  ddl_ensure_table ("do this always", other517);
+  ddl_ensure_table ("do this always", other518);
+  ddl_ensure_table ("do this always", other519);
+  ddl_ensure_table ("do this always", other520);
+  ddl_ensure_table ("do this always", other521);
+  ddl_ensure_table ("do this always", other522);
+  ddl_ensure_table ("do this always", other523);
+  ddl_ensure_table ("do this always", other524);
+  ddl_ensure_table ("do this always", other525);
+  ddl_ensure_table ("do this always", other526);
+  ddl_ensure_table ("do this always", other527);
+  ddl_ensure_table ("do this always", other528);
+  ddl_ensure_table ("do this always", other529);
+  ddl_ensure_table ("do this always", other530);
+  ddl_ensure_table ("do this always", other531);
+  ddl_ensure_table ("do this always", other532);
+  ddl_ensure_table ("do this always", other533);
+  ddl_ensure_table ("do this always", other534);
+  ddl_ensure_table ("do this always", other535);
+  ddl_ensure_table ("do this always", other536);
+  ddl_ensure_table ("do this always", other537);
+  ddl_ensure_table ("do this always", other538);
+  ddl_ensure_table ("do this always", other539);
+  ddl_ensure_table ("do this always", other540);
+  ddl_ensure_table ("do this always", other541);
+  ddl_ensure_table ("do this always", other542);
+  ddl_ensure_table ("do this always", other543);
+  ddl_ensure_table ("do this always", other544);
+  ddl_ensure_table ("do this always", other545);
+  ddl_ensure_table ("do this always", other546);
+  ddl_ensure_table ("do this always", other547);
+  ddl_ensure_table ("do this always", other548);
+  ddl_ensure_table ("do this always", other549);
+  ddl_ensure_table ("do this always", other550);
+  ddl_ensure_table ("do this always", other551);
+  ddl_ensure_table ("do this always", other552);
+  ddl_ensure_table ("do this always", other553);
+  ddl_ensure_table ("do this always", other554);
+  ddl_ensure_table ("do this always", other555);
+  ddl_ensure_table ("do this always", other556);
+  ddl_ensure_table ("do this always", other557);
+  ddl_ensure_table ("do this always", other558);
+  ddl_ensure_table ("do this always", other559);
+  ddl_ensure_table ("do this always", other560);
+  ddl_ensure_table ("do this always", other561);
+  ddl_ensure_table ("do this always", other562);
+  ddl_ensure_table ("do this always", other563);
+  ddl_ensure_table ("do this always", other564);
+  ddl_ensure_table ("do this always", other565);
+  ddl_ensure_table ("do this always", other566);
+  ddl_ensure_table ("do this always", other567);
+  ddl_ensure_table ("do this always", other568);
+  ddl_ensure_table ("do this always", other569);
+  ddl_ensure_table ("do this always", other570);
+  ddl_ensure_table ("do this always", other571);
+  ddl_ensure_table ("do this always", other572);
+  ddl_ensure_table ("do this always", other573);
+  ddl_ensure_table ("do this always", other574);
+  ddl_ensure_table ("do this always", other575);
+  ddl_ensure_table ("do this always", other576);
+  ddl_ensure_table ("do this always", other577);
+  ddl_ensure_table ("do this always", other578);
+  ddl_ensure_table ("do this always", other579);
+  ddl_ensure_table ("do this always", other580);
+  ddl_ensure_table ("do this always", other581);
+  ddl_ensure_table ("do this always", other582);
+  ddl_ensure_table ("do this always", other583);
+  ddl_ensure_table ("do this always", other584);
+  ddl_ensure_table ("do this always", other585);
+  ddl_ensure_table ("do this always", other586);
+  ddl_ensure_table ("do this always", other587);
+  ddl_ensure_table ("do this always", other588);
+  ddl_ensure_table ("do this always", other589);
+  ddl_ensure_table ("do this always", other590);
+  ddl_ensure_table ("do this always", other591);
+  ddl_ensure_table ("do this always", other592);
+  ddl_ensure_table ("do this always", other593);
+  ddl_ensure_table ("do this always", other594);
+  ddl_ensure_table ("do this always", other595);
+  ddl_ensure_table ("do this always", other596);
+  ddl_ensure_table ("do this always", other597);
+  ddl_ensure_table ("do this always", other598);
+  ddl_ensure_table ("do this always", other599);
+  ddl_ensure_table ("do this always", other600);
+  ddl_ensure_table ("do this always", other601);
+  ddl_ensure_table ("do this always", other602);
+  ddl_ensure_table ("do this always", other603);
+  ddl_ensure_table ("do this always", other604);
+  ddl_ensure_table ("do this always", other605);
+  ddl_ensure_table ("do this always", other606);
+  ddl_ensure_table ("do this always", other607);
+  ddl_ensure_table ("do this always", other608);
+  ddl_ensure_table ("do this always", other609);
+  ddl_ensure_table ("do this always", other610);
+  ddl_ensure_table ("do this always", other611);
+  ddl_ensure_table ("do this always", other612);
+  ddl_ensure_table ("do this always", other613);
+  ddl_ensure_table ("do this always", other614);
+  ddl_ensure_table ("do this always", other615);
+  ddl_ensure_table ("do this always", other616);
+  ddl_ensure_table ("do this always", other617);
+  ddl_ensure_table ("do this always", other618);
+  ddl_ensure_table ("do this always", other619);
+  ddl_ensure_table ("do this always", other620);
+  ddl_ensure_table ("do this always", other621);
+  ddl_ensure_table ("do this always", other622);
+  ddl_ensure_table ("do this always", other623);
+  ddl_ensure_table ("do this always", other624);
+  ddl_ensure_table ("do this always", other625);
+  ddl_ensure_table ("do this always", other626);
+  ddl_ensure_table ("do this always", other627);
+  ddl_ensure_table ("do this always", other628);
+  ddl_ensure_table ("do this always", other629);
+  ddl_ensure_table ("do this always", other630);
+  ddl_ensure_table ("do this always", other631);
+  ddl_ensure_table ("do this always", other632);
+  ddl_ensure_table ("do this always", other633);
+  ddl_ensure_table ("do this always", other634);
+  ddl_ensure_table ("do this always", other635);
+  ddl_ensure_table ("do this always", other636);
+  ddl_ensure_table ("do this always", other637);
+  ddl_ensure_table ("do this always", other638);
+  ddl_ensure_table ("do this always", other639);
+  ddl_ensure_table ("do this always", other640);
+  ddl_ensure_table ("do this always", other641);
+  ddl_ensure_table ("do this always", other642);
+  ddl_ensure_table ("do this always", other643);
+  ddl_ensure_table ("do this always", other644);
+  ddl_ensure_table ("do this always", other645);
+  ddl_ensure_table ("do this always", other646);
+  ddl_ensure_table ("do this always", other647);
+  ddl_ensure_table ("do this always", other648);
+  ddl_ensure_table ("do this always", other649);
+  ddl_ensure_table ("do this always", other650);
+  ddl_ensure_table ("do this always", other651);
+  ddl_ensure_table ("do this always", other652);
+  ddl_ensure_table ("do this always", other653);
+  ddl_ensure_table ("do this always", other654);
+  ddl_ensure_table ("do this always", other655);
+  ddl_ensure_table ("do this always", other656);
+  ddl_ensure_table ("do this always", other657);
+  ddl_ensure_table ("do this always", other658);
+  ddl_ensure_table ("do this always", other659);
+  ddl_ensure_table ("do this always", other660);
+  ddl_ensure_table ("do this always", other661);
+  ddl_ensure_table ("do this always", other662);
+  ddl_ensure_table ("do this always", other663);
+  ddl_ensure_table ("do this always", other664);
+  ddl_ensure_table ("do this always", other665);
+  ddl_ensure_table ("do this always", other666);
+  ddl_ensure_table ("do this always", other667);
+  ddl_ensure_table ("do this always", other668);
+  ddl_ensure_table ("do this always", other669);
+  ddl_ensure_table ("do this always", other670);
+  ddl_ensure_table ("do this always", other671);
+  ddl_ensure_table ("do this always", other672);
+  ddl_ensure_table ("do this always", other673);
+  ddl_ensure_table ("do this always", other674);
+  ddl_ensure_table ("do this always", other675);
+  ddl_ensure_table ("do this always", other676);
+  ddl_ensure_table ("do this always", other677);
+  ddl_ensure_table ("do this always", other678);
+  ddl_ensure_table ("do this always", other679);
+  ddl_ensure_table ("do this always", other680);
+  ddl_ensure_table ("do this always", other681);
+  ddl_ensure_table ("do this always", other682);
+  ddl_ensure_table ("do this always", other683);
+  ddl_ensure_table ("do this always", other684);
+  ddl_ensure_table ("do this always", other685);
+  ddl_ensure_table ("do this always", other686);
+  ddl_ensure_table ("do this always", other687);
+  ddl_ensure_table ("do this always", other688);
+  ddl_ensure_table ("do this always", other689);
+  ddl_ensure_table ("do this always", other690);
+  ddl_ensure_table ("do this always", other691);
+  ddl_ensure_table ("do this always", other692);
+  ddl_ensure_table ("do this always", other693);
+  ddl_ensure_table ("do this always", other694);
+  ddl_ensure_table ("do this always", other695);
+  ddl_ensure_table ("do this always", other696);
+  ddl_ensure_table ("do this always", other697);
+  ddl_ensure_table ("do this always", other698);
+  ddl_ensure_table ("do this always", other699);
+  ddl_ensure_table ("do this always", other700);
+  ddl_ensure_table ("do this always", other701);
+  ddl_ensure_table ("do this always", other702);
+  ddl_ensure_table ("do this always", other703);
+  ddl_ensure_table ("do this always", other704);
+  ddl_ensure_table ("do this always", other705);
+  ddl_ensure_table ("do this always", other706);
+  ddl_ensure_table ("do this always", other707);
+  ddl_ensure_table ("do this always", other708);
+  ddl_ensure_table ("do this always", other709);
+  ddl_ensure_table ("do this always", other710);
+  ddl_ensure_table ("do this always", other711);
+  ddl_ensure_table ("do this always", other712);
+  ddl_ensure_table ("do this always", other713);
+  ddl_ensure_table ("do this always", other714);
+  ddl_ensure_table ("do this always", other715);
+  ddl_ensure_table ("do this always", other716);
+  ddl_ensure_table ("do this always", other717);
+  ddl_ensure_table ("do this always", other718);
+  ddl_ensure_table ("do this always", other719);
+  ddl_ensure_table ("do this always", other720);
+  ddl_ensure_table ("do this always", other721);
+  ddl_ensure_table ("do this always", other722);
+  ddl_ensure_table ("do this always", other723);
+  ddl_ensure_table ("do this always", other724);
+  ddl_ensure_table ("do this always", other725);
+  ddl_ensure_table ("do this always", other726);
+  ddl_ensure_table ("do this always", other727);
+  ddl_ensure_table ("do this always", other728);
+  ddl_ensure_table ("do this always", other729);
+  ddl_ensure_table ("do this always", other730);
+  ddl_ensure_table ("do this always", other731);
+  ddl_ensure_table ("do this always", other732);
+  ddl_ensure_table ("do this always", other733);
+  ddl_ensure_table ("do this always", other734);
+  ddl_ensure_table ("do this always", other735);
+  ddl_ensure_table ("do this always", other736);
+  ddl_ensure_table ("do this always", other737);
+  ddl_ensure_table ("do this always", other738);
+  ddl_ensure_table ("do this always", other739);
+  ddl_ensure_table ("do this always", other740);
+  ddl_ensure_table ("do this always", other741);
+  ddl_ensure_table ("do this always", other742);
+  ddl_ensure_table ("do this always", other743);
+  ddl_ensure_table ("do this always", other744);
+  ddl_ensure_table ("do this always", other745);
+  ddl_ensure_table ("do this always", other746);
+  ddl_ensure_table ("do this always", other747);
+  ddl_ensure_table ("do this always", other748);
+  ddl_ensure_table ("do this always", other749);
+  ddl_ensure_table ("do this always", other750);
+  ddl_ensure_table ("do this always", other751);
+  ddl_ensure_table ("do this always", other752);
+  ddl_ensure_table ("do this always", other753);
+  ddl_ensure_table ("do this always", other754);
+  ddl_ensure_table ("do this always", other755);
+  ddl_ensure_table ("do this always", other756);
+  ddl_ensure_table ("do this always", other757);
+  ddl_ensure_table ("do this always", other758);
+  ddl_ensure_table ("do this always", other759);
+  ddl_ensure_table ("do this always", other760);
+  ddl_ensure_table ("do this always", other761);
+  ddl_ensure_table ("do this always", other762);
+  ddl_ensure_table ("do this always", other763);
+  ddl_ensure_table ("do this always", other764);
+  ddl_ensure_table ("do this always", other765);
+  ddl_ensure_table ("do this always", other766);
+  ddl_ensure_table ("do this always", other767);
+  ddl_ensure_table ("do this always", other768);
+  ddl_ensure_table ("do this always", other769);
+  ddl_ensure_table ("do this always", other770);
+  ddl_ensure_table ("do this always", other771);
+  ddl_ensure_table ("do this always", other772);
+  ddl_ensure_table ("do this always", other773);
+  ddl_ensure_table ("do this always", other774);
+  ddl_ensure_table ("do this always", other775);
+  ddl_ensure_table ("do this always", other776);
+  ddl_ensure_table ("do this always", other777);
+  ddl_ensure_table ("do this always", other778);
+  ddl_ensure_table ("do this always", other779);
+  ddl_ensure_table ("do this always", other780);
+  ddl_ensure_table ("do this always", other781);
+  ddl_ensure_table ("do this always", other782);
+  ddl_ensure_table ("do this always", other783);
+  ddl_ensure_table ("do this always", other784);
+  ddl_ensure_table ("do this always", other785);
+  ddl_ensure_table ("do this always", other786);
+  ddl_ensure_table ("do this always", other787);
+  ddl_ensure_table ("do this always", other788);
+  ddl_ensure_table ("do this always", other789);
+  ddl_ensure_table ("do this always", other790);
+  ddl_ensure_table ("do this always", other791);
+  ddl_ensure_table ("do this always", other792);
+  ddl_ensure_table ("do this always", other793);
+  ddl_ensure_table ("do this always", other794);
+  ddl_ensure_table ("do this always", other795);
+  ddl_ensure_table ("do this always", other796);
+  ddl_ensure_table ("do this always", other797);
+  ddl_ensure_table ("do this always", other798);
+  ddl_ensure_table ("do this always", other799);
+  ddl_ensure_table ("do this always", other800);
+  ddl_ensure_table ("do this always", other801);
+  ddl_ensure_table ("do this always", other802);
+  ddl_ensure_table ("do this always", other803);
+  ddl_ensure_table ("do this always", other804);
+  ddl_ensure_table ("do this always", other805);
+  ddl_ensure_table ("do this always", other806);
+  ddl_ensure_table ("do this always", other807);
+  ddl_ensure_table ("do this always", other808);
+  ddl_ensure_table ("do this always", other809);
+  ddl_ensure_table ("do this always", other810);
+  ddl_ensure_table ("do this always", other811);
+  ddl_ensure_table ("do this always", other812);
+  ddl_ensure_table ("do this always", other813);
+  ddl_ensure_table ("do this always", other814);
+  ddl_ensure_table ("do this always", other815);
+  ddl_ensure_table ("do this always", other816);
+  ddl_ensure_table ("do this always", other817);
+  ddl_ensure_table ("do this always", other818);
+  ddl_ensure_table ("do this always", other819);
+  ddl_ensure_table ("do this always", other820);
+  ddl_ensure_table ("do this always", other821);
+  ddl_ensure_table ("do this always", other822);
+  ddl_ensure_table ("do this always", other823);
+  ddl_ensure_table ("do this always", other824);
+  ddl_ensure_table ("do this always", other825);
+  ddl_ensure_table ("do this always", other826);
+  ddl_ensure_table ("do this always", other827);
+  ddl_ensure_table ("do this always", other828);
+  ddl_ensure_table ("do this always", other829);
+  ddl_ensure_table ("do this always", other830);
+  ddl_ensure_table ("do this always", other831);
+  ddl_ensure_table ("do this always", other832);
+  ddl_ensure_table ("do this always", other833);
+  ddl_ensure_table ("do this always", other834);
+  ddl_ensure_table ("do this always", other835);
+  ddl_ensure_table ("do this always", other836);
+  ddl_ensure_table ("do this always", other837);
+  ddl_ensure_table ("do this always", other838);
+  ddl_ensure_table ("do this always", other839);
+  ddl_ensure_table ("do this always", other840);
+  ddl_ensure_table ("do this always", other841);
+  ddl_ensure_table ("do this always", other842);
+  ddl_ensure_table ("do this always", other843);
+  ddl_ensure_table ("do this always", other844);
+  ddl_ensure_table ("do this always", other845);
+  ddl_ensure_table ("do this always", other846);
+  ddl_ensure_table ("do this always", other847);
+  ddl_std_proc (trig0, 0x0);
+  ddl_std_proc (trig1, 0x0);
+  ddl_std_proc (trig2, 0x0);
   DEFINE_PROC ("DB.DBA.DAV_PLAIN_SUBCOLS_P", proc12);
   DEFINE_PROC ("DB.DBA.DAV_PLAIN_SUBCOLS_P_INT", proc13);
   ddl_ensure_table ("DB.DBA.DAV_PLAIN_SUBCOLS", view6);
@@ -5356,7 +7626,7 @@ sqls_define_ddk (void)
   ddl_ensure_table ("DB.DBA.DAV_PLAIN_SUBMOUNTS", view7); 
   DEFINE_PUBLIC_PROC ("DB.DBA.DAV_DIR_P", proc16);
   ddl_ensure_table ("DB.DBA.DAV_DIR", view8);
-  ddl_ensure_table ("do this always", other180);
+  ddl_ensure_table ("do this always", other848);
 
   dk_free_box (bootstrap_cli->cli_qualifier);
   bootstrap_cli->cli_qualifier =  saved_qualifier;
@@ -5365,14 +7635,14 @@ sqls_define_ddk (void)
 
   ddl_ensure_table ("DB.DBA.MAIL_MESSAGE", tbl18);
   ddl_ensure_table ("DB.DBA.MAIL_ATTACHMENT", tbl19);
-  ddl_std_proc (trig0, 0x0);
-  ddl_std_proc (trig1, 0x0);
-  ddl_std_proc (trig2, 0x0);
+  ddl_std_proc (trig3, 0x0);
+  ddl_std_proc (trig4, 0x0);
+  ddl_std_proc (trig5, 0x0);
   DEFINE_PROC ("DB.DBA.MAIL_MESSAGE_MM_BODY_INDEX_HOOK", proc17);
   DEFINE_PROC ("DB.DBA.MAIL_MESSAGE_MM_BODY_UNINDEX_HOOK", proc18);
   DEFINE_PROC ("MM_FEED_PART", proc19);
-  ddl_ensure_table ("do this always", other181);
-  ddl_ensure_table ("do this always", other182);
+  ddl_ensure_table ("do this always", other849);
+  ddl_ensure_table ("do this always", other850);
   ddl_ensure_table ("DB.DBA.MAIL_PARTS", tbl20); 
   DEFINE_PUBLIC_PROC ("MIME_PART", proc20); 
   DEFINE_PUBLIC_PROC ("MIME_BODY", proc21);
@@ -5395,8 +7665,17 @@ sqls_define_ddk (void)
   ddl_ensure_table ("WS.WS.VFS_SITE", tbl25);
   ddl_ensure_table ("WS.WS.VFS_SITE_RDF_MAP", tbl26);
   ddl_ensure_column ("WS.WS.VFS_SITE", "VS_DEPTH", alter0, 0);
-  ddl_ensure_column ("WS.WS.VFS_QUEUE", "VQ_LEVEL", alter1, 0);
-  ddl_ensure_column ("WS.WS.VFS_QUEUE", "VQ_VIA_SITEMAP", alter2, 0);
+  ddl_ensure_column ("WS.WS.VFS_SITE", "VS_CONVERT_HTML", alter1, 0);
+  ddl_ensure_column ("WS.WS.VFS_SITE", "VS_XPATH", alter2, 0);
+  ddl_ensure_column ("WS.WS.VFS_SITE", "VS_BOT", alter3, 0);
+  ddl_ensure_column ("WS.WS.VFS_SITE", "VS_IS_SITEMAP", alter4, 0);
+  ddl_ensure_column ("WS.WS.VFS_SITE", "VS_ACCEPT_RDF", alter5, 0);
+  ddl_ensure_column ("WS.WS.VFS_SITE", "VS_THREADS", alter6, 0);
+  ddl_ensure_column ("WS.WS.VFS_SITE", "VS_ROBOTS", alter7, 0);
+  ddl_ensure_column ("WS.WS.VFS_QUEUE", "VQ_LEVEL", alter8, 0);
+  ddl_ensure_column ("WS.WS.VFS_QUEUE", "VQ_VIA_SITEMAP", alter9, 0);
+  ddl_ensure_column ("WS.WS.VFS_QUEUE", "VQ_DT", alter10, 0);
+  ddl_ensure_column ("WS.WS.VFS_URL", "VU_RES_ID", alter11, 0);
 
   dk_free_box (bootstrap_cli->cli_qualifier);
   bootstrap_cli->cli_qualifier =  saved_qualifier;
@@ -5405,26 +7684,26 @@ sqls_define_ddk (void)
 
   ddl_ensure_table ("DB.DBA.HTTP_PATH", tbl27);
   ddl_ensure_table ("DB.DBA.HTTP_ACL", tbl28);
-  ddl_ensure_column ("HTTP_ACL", "HA_LIMIT", alter3, 0);
-  ddl_std_proc (trig3, 0x0);
-  ddl_std_proc (trig4, 0x0);
-  ddl_std_proc (trig5, 0x0);
+  ddl_ensure_column ("HTTP_ACL", "HA_LIMIT", alter12, 0);
+  ddl_std_proc (trig6, 0x0);
+  ddl_std_proc (trig7, 0x0);
+  ddl_std_proc (trig8, 0x0);
   ddl_ensure_table ("DB.DBA.HTTP_PROXY_ACL", view10);
   ddl_ensure_table ("DB.DBA.NEWS_ACL", view11);
-  ddl_ensure_table ("do this always", other183);
-  ddl_ensure_table ("do this always", other184);
-  ddl_ensure_table ("do this always", other185);
-  ddl_ensure_table ("do this always", other186);
-  ddl_ensure_table ("do this always", other187);
-  ddl_ensure_table ("do this always", other188);
-  ddl_ensure_table ("do this always", other189);
-  ddl_ensure_table ("do this always", other190);
-  ddl_ensure_table ("do this always", other191);
-  ddl_ensure_table ("do this always", other192);
-  ddl_ensure_table ("do this always", other193);
-  ddl_ensure_table ("do this always", other194);
-  ddl_ensure_table ("do this always", other195);
-  ddl_ensure_table ("do this always", other196);
+  ddl_ensure_table ("do this always", other851);
+  ddl_ensure_table ("do this always", other852);
+  ddl_ensure_table ("do this always", other853);
+  ddl_ensure_table ("do this always", other854);
+  ddl_ensure_table ("do this always", other855);
+  ddl_ensure_table ("do this always", other856);
+  ddl_ensure_table ("do this always", other857);
+  ddl_ensure_table ("do this always", other858);
+  ddl_ensure_table ("do this always", other859);
+  ddl_ensure_table ("do this always", other860);
+  ddl_ensure_table ("do this always", other861);
+  ddl_ensure_table ("do this always", other862);
+  ddl_ensure_table ("do this always", other863);
+  ddl_ensure_table ("do this always", other864);
   DEFINE_PROC ("HTTP_SET_DBA_ADMIN", proc26);
   DEFINE_PROC ("DB.DBA.IS_EMPTY_OR_NULL", proc27);
   DEFINE_PROC ("INS_VIRTUAL_DIR", proc28);
@@ -5435,9 +7714,9 @@ sqls_define_ddk (void)
   DEFINE_PROC ("HTTP_PROXY_ACCESS", proc33);
   ddl_ensure_table ("WS.WS.SYS_RC_CACHE", tbl29);
   ddl_ensure_table ("WS.WS.SYS_CACHEABLE", tbl30);
-  ddl_std_proc (trig6, 0x0);
-  ddl_std_proc (trig7, 0x0);
-  ddl_std_proc (trig8, 0x0);
+  ddl_std_proc (trig9, 0x0);
+  ddl_std_proc (trig10, 0x0);
+  ddl_std_proc (trig11, 0x0);
   DEFINE_PROC ("WS.WS.HTTP_CACHE_CHECK", proc34);
   DEFINE_PROC ("WS.WS.HTTP_CACHE_STORE", proc35);
   DEFINE_PROC ("virt_proxy_init", proc36);
@@ -5450,39 +7729,46 @@ sqls_define_ddk (void)
   DEFINE_PROC ("DB.DBA.HTTP_RDF_GET_ACCEPT_BY_Q", proc42);
   DEFINE_PROC ("DB.DBA.HTTP_RDF_ACCEPT", proc43);
   DEFINE_PROC ("WS.WS.DIR_INDEX_MAKE_XML", proc44);
-  ddl_ensure_table ("do this always", other199);
+  ddl_ensure_table ("do this always", other867);
   DEFINE_PROC ("WS.WS.DIR_INDEX_XML", proc45);
   DEFINE_PROC ("DB.DBA.SERVICES_WSIL", proc46);
+  ddl_ensure_table ("WS.WS.HTTP_HOST_META", tbl32);
+  DEFINE_PROC ("WS.WS.host_meta_add", proc47);
+  DEFINE_PROC ("WS.WS.host_meta_del", proc48);
+  DEFINE_PROC ("WS.WS.host-meta", proc49);
+  DEFINE_PROC ("WS.WS.host_meta_init", proc50);
+  ddl_ensure_table ("do this always", other868);
+  DEFINE_PROC ("WS.WS.host_meta_dss", proc51);
 
   /* url_rewrite.sql */
 
-  ddl_ensure_table ("DB.DBA.URL_REWRITE_RULE_LIST", tbl32);
-  ddl_ensure_table ("DB.DBA.URL_REWRITE_RULE", tbl33);
-  ddl_ensure_table ("DB.DBA.HTTP_VARIANT_MAP", tbl34);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_CREATE_RULE", proc47);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_CREATE_SPRINTF_RULE", proc48);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_CREATE_REGEX_RULE", proc49);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_DROP_RULE", proc50);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_CREATE_RULELIST", proc51);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_DROP_RULELIST", proc52);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_ENUMERATE_RULES", proc53);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_ENUMERATE_RULELISTS", proc54);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_VPRINTF", proc55);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_SPRINTF_RESULTS", proc56);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_APPLY_RECURSIVE", proc57);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_APPLY", proc58);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_TRY_INVERSE", proc59);
-  DEFINE_PROC ("DB.DBA.HTTP_VARIANT_ADD", proc60);
-  DEFINE_PROC ("DB.DBA.HTTP_VARIANT_REMOVE", proc61);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_CALC_QS", proc62);
-  DEFINE_PROC ("DB.DBA.HTTP_URLREWRITE_TCN_LIST", proc63);
-  DEFINE_PROC ("DB.DBA.HTTP_URLREWRITE_APPLY_PATTERN", proc64);
-  DEFINE_PROC ("DB.DBA.HTTP_LOC_NEW_URL", proc65);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_APPLY_TCN", proc66);
-  DEFINE_PROC ("DB.DBA.HTTP_URLREWRITE", proc67);
-  DEFINE_PROC ("DB.DBA.URLREWRITE_DUMP_RULELIST_SQL", proc68);
-  ddl_ensure_table ("do this always", other200);
-  ddl_ensure_table ("do this always", other201);
+  ddl_ensure_table ("DB.DBA.URL_REWRITE_RULE_LIST", tbl33);
+  ddl_ensure_table ("DB.DBA.URL_REWRITE_RULE", tbl34);
+  ddl_ensure_table ("DB.DBA.HTTP_VARIANT_MAP", tbl35);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_CREATE_RULE", proc52);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_CREATE_SPRINTF_RULE", proc53);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_CREATE_REGEX_RULE", proc54);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_DROP_RULE", proc55);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_CREATE_RULELIST", proc56);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_DROP_RULELIST", proc57);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_ENUMERATE_RULES", proc58);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_ENUMERATE_RULELISTS", proc59);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_VPRINTF", proc60);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_SPRINTF_RESULTS", proc61);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_APPLY_RECURSIVE", proc62);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_APPLY", proc63);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_TRY_INVERSE", proc64);
+  DEFINE_PROC ("DB.DBA.HTTP_VARIANT_ADD", proc65);
+  DEFINE_PROC ("DB.DBA.HTTP_VARIANT_REMOVE", proc66);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_CALC_QS", proc67);
+  DEFINE_PROC ("DB.DBA.HTTP_URLREWRITE_TCN_LIST", proc68);
+  DEFINE_PROC ("DB.DBA.HTTP_URLREWRITE_APPLY_PATTERN", proc69);
+  DEFINE_PROC ("DB.DBA.HTTP_LOC_NEW_URL", proc70);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_APPLY_TCN", proc71);
+  DEFINE_PROC ("DB.DBA.HTTP_URLREWRITE", proc72);
+  DEFINE_PROC ("DB.DBA.URLREWRITE_DUMP_RULELIST_SQL", proc73);
+  ddl_ensure_table ("do this always", other869);
+  ddl_ensure_table ("do this always", other870);
 }
 
 
@@ -5491,7 +7777,7 @@ sqls_arfw_define_ddk (void)
 {
   /* virtual_dir.sql */
 
-  ddl_ensure_table ("do this always", other197);
-  ddl_ensure_table ("do this always", other198);
+  ddl_ensure_table ("do this always", other865);
+  ddl_ensure_table ("do this always", other866);
 
 }
diff --git a/libsrc/Wi/sql_code_imsg.c b/libsrc/Wi/sql_code_imsg.c
index a55f925..2fbacbc 100644
--- a/libsrc/Wi/sql_code_imsg.c
+++ b/libsrc/Wi/sql_code_imsg.c
@@ -7,6 +7,7 @@
 /* pop3_svr.sql */
 
 static const char *proc0 = 
+"#line 23 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "WS.WS.POP3_SRV (in path any, in params any, in lines any)\n"
 "{\n"
@@ -89,9 +90,10 @@ static const char *proc0 =
 "\n"
 "return NULL;\n"
 "}\n"
-"--src pop3_svr.sql:22\n";
+"--src pop3_svr.sql:21\n";
 
 static const char *proc1 = 
+"#line 108 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_if_command (inout _in varchar, in valid any, inout mode integer, in _get_user varchar, inout _stat any)\n"
 "{\n"
@@ -160,9 +162,10 @@ static const char *proc1 =
 "\n"
 "return 5;\n"
 "}\n"
-"--src pop3_svr.sql:107\n";
+"--src pop3_svr.sql:106\n";
 
 static const char *proc2 = 
+"#line 179 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_get_command (in _in_s varchar)\n"
 "{\n"
@@ -173,9 +176,10 @@ static const char *proc2 =
 "else\n"
 "return (subseq (_in_s, 0, pos));\n"
 "}\n"
-"--src pop3_svr.sql:178\n";
+"--src pop3_svr.sql:177\n";
 
 static const char *proc3 = 
+"#line 192 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_init (in _user varchar)\n"
 "{\n"
@@ -213,9 +217,10 @@ static const char *proc3 =
 "\n"
 "return res;\n"
 "}\n"
-"--src pop3_svr.sql:191\n";
+"--src pop3_svr.sql:190\n";
 
 static const char *proc4 = 
+"#line 231 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_write (in _in_str varchar)\n"
 "{\n"
@@ -224,25 +229,28 @@ static const char *proc4 =
 "else\n"
 "signal (\'24000\', _in_str, \'ERR:\');\n"
 "}\n"
-"--src pop3_svr.sql:230\n";
+"--src pop3_svr.sql:229\n";
 
 static const char *proc5 = 
+"#line 242 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_write_ok (in _in_str varchar)\n"
 "{\n"
 "pop_write (concat (\'+OK \', _in_str));\n"
 "}\n"
-"--src pop3_svr.sql:241\n";
+"--src pop3_svr.sql:240\n";
 
 static const char *proc6 = 
+"#line 250 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_write_err (in _in_str varchar)\n"
 "{\n"
 "pop_write (concat (\'-ERR \', _in_str));\n"
 "}\n"
-"--src pop3_svr.sql:249\n";
+"--src pop3_svr.sql:248\n";
 
 static const char *proc7 = 
+"#line 258 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_is_deleted (in num integer, inout _stat any)\n"
 "{\n"
@@ -250,9 +258,10 @@ static const char *proc7 =
 "return 1;\n"
 "return NULL;\n"
 "}\n"
-"--src pop3_svr.sql:257\n";
+"--src pop3_svr.sql:256\n";
 
 static const char *proc8 = 
+"#line 268 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_is_ok_ (in num any, inout _stat any)\n"
 "{\n"
@@ -274,9 +283,10 @@ static const char *proc8 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src pop3_svr.sql:267\n";
+"--src pop3_svr.sql:266\n";
 
 static const char *proc9 = 
+"#line 292 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_change_stat (in num integer, inout _stat any)\n"
 "{\n"
@@ -286,17 +296,19 @@ static const char *proc9 =
 "aset (temp, 1, -aref (temp, 1));\n"
 "aset (_stat, num, temp);\n"
 "}\n"
-"--src pop3_svr.sql:291\n";
+"--src pop3_svr.sql:290\n";
 
 static const char *proc10 = 
+"#line 304 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_messages (in _user varchar)\n"
 "{\n"
 "return (select count (*) from DB.DBA.MAIL_MESSAGE where MM_OWN = _user);\n"
 "}\n"
-"--src pop3_svr.sql:303\n";
+"--src pop3_svr.sql:302\n";
 
 static const char *proc11 = 
+"#line 312 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_mess_len (in _user varchar)\n"
 "{\n"
@@ -309,9 +321,10 @@ static const char *proc11 =
 "\n"
 "return mail_len;\n"
 "}\n"
-"--src pop3_svr.sql:311\n";
+"--src pop3_svr.sql:310\n";
 
 static const char *proc12 = 
+"#line 333 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_quit (inout mode integer, inout _stat any, in get_user varchar)\n"
 "{\n"
@@ -332,17 +345,19 @@ static const char *proc12 =
 "commit work;\n"
 "pop_write_ok (\'Virtuoso POP3 server signing off\');\n"
 "}\n"
-"--src pop3_svr.sql:332\n";
+"--src pop3_svr.sql:331\n";
 
 static const char *proc13 = 
+"#line 356 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_apop ()\n"
 "{\n"
 "pop_write_err (\'not supported from this version\');\n"
 "}\n"
-"--src pop3_svr.sql:355\n";
+"--src pop3_svr.sql:354\n";
 
 static const char *proc14 = 
+"#line 364 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_user (inout arg varchar, inout mode integer)\n"
 "{\n"
@@ -359,25 +374,28 @@ static const char *proc14 =
 "}\n"
 "}\n"
 "}\n"
-"--src pop3_svr.sql:363\n";
+"--src pop3_svr.sql:362\n";
 
 static const char *proc15 = 
+"#line 383 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_pass (inout arg varchar, inout mode integer)\n"
 "{\n"
 "mode := 3;\n"
 "}\n"
-"--src pop3_svr.sql:382\n";
+"--src pop3_svr.sql:381\n";
 
 static const char *proc16 = 
+"#line 391 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_noop ()\n"
 "{\n"
 "pop_write_ok (\'\');\n"
 "}\n"
-"--src pop3_svr.sql:390\n";
+"--src pop3_svr.sql:389\n";
 
 static const char *proc17 = 
+"#line 399 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_list (inout arg varchar, inout _stat any)\n"
 "{\n"
@@ -416,9 +434,10 @@ static const char *proc17 =
 "if (pop_is_ok_ (arg, _stat))\n"
 "pop_write_ok (sprintf (\'%d %d\', arg_int, aref (aref (_stat, arg_int), 1)));\n"
 "}\n"
-"--src pop3_svr.sql:398\n";
+"--src pop3_svr.sql:397\n";
 
 static const char *proc18 = 
+"#line 440 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_dele (inout arg varchar, inout _stat any)\n"
 "{\n"
@@ -438,9 +457,10 @@ static const char *proc18 =
 "pop_write_ok (sprintf (\'Message %i has been deleted\', mail_idx));\n"
 "}\n"
 "}\n"
-"--src pop3_svr.sql:439\n";
+"--src pop3_svr.sql:438\n";
 
 static const char *proc19 = 
+"#line 462 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_rset (inout arg varchar, inout _stat any)\n"
 "{\n"
@@ -464,9 +484,10 @@ static const char *proc19 =
 "pop_write_ok (sprintf (\'Maildrop has %i messages (%i octets)\', mail_all - 1, mail_len));\n"
 "}\n"
 "}\n"
-"--src pop3_svr.sql:461\n";
+"--src pop3_svr.sql:460\n";
 
 static const char *proc20 = 
+"#line 488 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_uidl (inout arg varchar, inout _stat any)\n"
 "{\n"
@@ -491,9 +512,10 @@ static const char *proc20 =
 "if (pop_is_ok_ (arg, _stat))\n"
 "pop_write_ok (sprintf (\'%i %s\', arg_int, aref (aref (_stat, arg_int), 3)));\n"
 "}\n"
-"--src pop3_svr.sql:487\n";
+"--src pop3_svr.sql:486\n";
 
 static const char *proc21 = 
+"#line 515 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_stat (inout arg varchar, inout _stat any)\n"
 "{\n"
@@ -519,9 +541,10 @@ static const char *proc21 =
 "pop_write_ok (sprintf (\'%i %i\', _idx2, mail_len));\n"
 "}\n"
 "}\n"
-"--src pop3_svr.sql:514\n";
+"--src pop3_svr.sql:513\n";
 
 static const char *proc22 = 
+"#line 543 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_retr (inout arg varchar, inout _stat any, in get_user varchar)\n"
 "{\n"
@@ -559,9 +582,10 @@ static const char *proc22 =
 "}\n"
 "}\n"
 "}\n"
-"--src pop3_svr.sql:542\n";
+"--src pop3_svr.sql:541\n";
 
 static const char *proc23 = 
+"#line 582 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_atoi (in arg varchar)\n"
 "{\n"
@@ -570,9 +594,10 @@ static const char *proc23 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src pop3_svr.sql:581\n";
+"--src pop3_svr.sql:580\n";
 
 static const char *proc24 = 
+"#line 598 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "pop_spam_filter_init ()\n"
 "{\n"
@@ -585,7 +610,7 @@ static const char *proc24 =
 "else\n"
 "registry_set (\'__spam_filtering\', \'1\');\n"
 "}\n"
-"--src pop3_svr.sql:597\n";
+"--src pop3_svr.sql:596\n";
 
 static const char *other0 = 
 "pop_spam_filter_init ()\n";
@@ -605,6 +630,7 @@ static const char *tbl1 =
 "PRIMARY KEY (MS_USER))\n";
 
 static const char *proc25 = 
+"#line 634 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_mw_word_stream (inout msg any, inout vtb any)\n"
 "{\n"
@@ -614,9 +640,10 @@ static const char *proc25 =
 "vt_batch_feed (vtb, msg, 0);\n"
 "vtb := vt_batch_strings_array (vtb);\n"
 "}\n"
-"--src pop3_svr.sql:633\n";
+"--src pop3_svr.sql:632\n";
 
 static const char *proc26 = 
+"#line 646 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "filter_add_message (in _message any, in _uid any, in _is_spam integer)\n"
 "{\n"
@@ -648,9 +675,10 @@ static const char *proc26 =
 "else\n"
 "update DB.DBA.MSG_SPAMS_COUNT set MS_HAM = MS_HAM + 1 where MS_USER = _uid;\n"
 "}\n"
-"--src pop3_svr.sql:645\n";
+"--src pop3_svr.sql:644\n";
 
 static const char *proc27 = 
+"#line 680 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_add_headers (inout _msg any, in _uid integer, in _is_spam integer)\n"
 "{\n"
@@ -675,9 +703,10 @@ static const char *proc27 =
 "else\n"
 "spam_add_word (\'text/plain\', _uid, _is_spam, 0);\n"
 "}\n"
-"--src pop3_svr.sql:679\n";
+"--src pop3_svr.sql:678\n";
 
 static const char *proc28 = 
+"#line 707 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_add_word (in _word any, in _uid integer, in _is_spam integer, in _check_len integer)\n"
 "{\n"
@@ -717,9 +746,10 @@ static const char *proc28 =
 "\n"
 "return;\n"
 "}\n"
-"--src pop3_svr.sql:706\n";
+"--src pop3_svr.sql:705\n";
 
 static const char *proc29 = 
+"#line 749 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_remove_headers (inout _msg any, in _uid integer, in _is_spam integer)\n"
 "{\n"
@@ -744,9 +774,10 @@ static const char *proc29 =
 "else\n"
 "spam_remove_word (\'text/plain\', _uid, _is_spam);\n"
 "}\n"
-"--src pop3_svr.sql:748\n";
+"--src pop3_svr.sql:747\n";
 
 static const char *proc30 = 
+"#line 776 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "filter_remove_message (in _message any, in _uid any, in _is_spam integer)\n"
 "{\n"
@@ -775,9 +806,10 @@ static const char *proc30 =
 "else\n"
 "update DB.DBA.MSG_SPAMS_COUNT set MS_HAM = MS_HAM - 1 where MS_USER = _uid;\n"
 "}\n"
-"--src pop3_svr.sql:775\n";
+"--src pop3_svr.sql:774\n";
 
 static const char *proc31 = 
+"#line 807 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_remove_word (in _word any, in _uid integer, in _is_spam integer)\n"
 "{\n"
@@ -809,9 +841,10 @@ static const char *proc31 =
 "close cr;\n"
 "return;\n"
 "}\n"
-"--src pop3_svr.sql:806\n";
+"--src pop3_svr.sql:805\n";
 
 static const char *proc32 = 
+"#line 841 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_get_word (in _word any, in _uid integer, inout _spam integer, inout _ham integer)\n"
 "{\n"
@@ -833,9 +866,10 @@ static const char *proc32 =
 "close cr;\n"
 "return;\n"
 "}\n"
-"--src pop3_svr.sql:840\n";
+"--src pop3_svr.sql:839\n";
 
 static const char *proc33 = 
+"#line 865 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_min (in _a any, in _b any)\n"
 "{\n"
@@ -844,9 +878,10 @@ static const char *proc33 =
 "else\n"
 "return _b;\n"
 "}\n"
-"--src pop3_svr.sql:864\n";
+"--src pop3_svr.sql:863\n";
 
 static const char *proc34 = 
+"#line 876 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_probability (in _word varchar, in _uid integer)\n"
 "{\n"
@@ -903,9 +938,10 @@ static const char *proc34 =
 "\n"
 "return prob;\n"
 "}\n"
-"--src pop3_svr.sql:875\n";
+"--src pop3_svr.sql:874\n";
 
 static const char *proc35 = 
+"#line 935 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_filter_message (in _message any, in _uid varchar)\n"
 "{\n"
@@ -923,9 +959,10 @@ static const char *proc35 =
 "return gary_spamprob (vtb, _message, _uid);\n"
 "\n"
 "}\n"
-"--src pop3_svr.sql:934\n";
+"--src pop3_svr.sql:933\n";
 
 static const char *proc36 = 
+"#line 955 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_chi2_spamprob (inout _word_stream any, inout _message any, in _uid integer)\n"
 "{\n"
@@ -987,9 +1024,10 @@ static const char *proc36 =
 "\n"
 "return \"LEFT\" (cast (prob as varchar), 4);\n"
 "}\n"
-"--src pop3_svr.sql:954\n";
+"--src pop3_svr.sql:953\n";
 
 static const char *proc37 = 
+"#line 1019 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_chi2q (in x2 double precision, in v integer)\n"
 "{\n"
@@ -1012,9 +1050,10 @@ static const char *proc37 =
 "\n"
 "return spam_min (_sum, cast (1.0 as double precision));\n"
 "}\n"
-"--src pop3_svr.sql:1018\n";
+"--src pop3_svr.sql:1017\n";
 
 static const char *proc38 = 
+"#line 1044 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_getclues (inout _word_stream any, inout _msg any, in _uid integer)\n"
 "{\n"
@@ -1082,9 +1121,10 @@ static const char *proc38 =
 "return res;\n"
 "\n"
 "}\n"
-"--src pop3_svr.sql:1043\n";
+"--src pop3_svr.sql:1042\n";
 
 static const char *proc39 = 
+"#line 1114 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_classify_mail_box (in _uid any)\n"
 "{\n"
@@ -1109,9 +1149,10 @@ static const char *proc39 =
 "\n"
 "return idx;\n"
 "}\n"
-"--src pop3_svr.sql:1113\n";
+"--src pop3_svr.sql:1112\n";
 
 static const char *proc40 = 
+"#line 1141 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "filter_classify_message (in _msg_id integer)\n"
 "{\n"
@@ -1135,9 +1176,10 @@ static const char *proc40 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src pop3_svr.sql:1140\n";
+"--src pop3_svr.sql:1139\n";
 
 static const char *proc41 = 
+"#line 1167 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_change_header (inout _msg any, in _uid any)\n"
 "{\n"
@@ -1171,9 +1213,10 @@ static const char *proc41 =
 "return 1;\n"
 "}\n"
 "}\n"
-"--src pop3_svr.sql:1166\n";
+"--src pop3_svr.sql:1165\n";
 
 static const char *proc42 = 
+"#line 1203 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_remove_old_header (inout _msg any)\n"
 "{\n"
@@ -1183,9 +1226,10 @@ static const char *proc42 =
 "_old := concat (spam_make_new_header (_old, 1), \'\\r\\n\');\n"
 "_msg := replace (_msg, _old, \'\');\n"
 "}\n"
-"--src pop3_svr.sql:1202\n";
+"--src pop3_svr.sql:1201\n";
 
 static const char *proc43 = 
+"#line 1215 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_classify_from_score (in _score any)\n"
 "{\n"
@@ -1196,9 +1240,10 @@ static const char *proc43 =
 "\n"
 "return \'unsure\';\n"
 "}\n"
-"--src pop3_svr.sql:1214\n";
+"--src pop3_svr.sql:1213\n";
 
 static const char *proc44 = 
+"#line 1228 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_make_new_header (in _score any, in _mode integer)\n"
 "{\n"
@@ -1207,17 +1252,19 @@ static const char *proc44 =
 "else\n"
 "return concat (virt_spam_header (), \':\', \' \', spam_classify_from_score (_score), \' (\', _score, \')\');\n"
 "}\n"
-"--src pop3_svr.sql:1227\n";
+"--src pop3_svr.sql:1226\n";
 
 static const char *proc45 = 
+"#line 1239 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "virt_spam_header ()\n"
 "{\n"
 "return \'X-VirtuosoSPAMFilter\';\n"
 "}\n"
-"--src pop3_svr.sql:1238\n";
+"--src pop3_svr.sql:1237\n";
 
 static const char *proc46 = 
+"#line 1247 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_get_score (in _score any)\n"
 "{\n"
@@ -1232,9 +1279,10 @@ static const char *proc46 =
 "\n"
 "return _score;\n"
 "}\n"
-"--src pop3_svr.sql:1246\n";
+"--src pop3_svr.sql:1245\n";
 
 static const char *proc47 = 
+"#line 1264 \"[executable]/pop3_svr.sql\"\n"
 "create procedure\n"
 "spam_message_from_id (inout _message any, inout _uid any, inout _own any)\n"
 "{\n"
@@ -1251,11 +1299,12 @@ static const char *proc47 =
 "\n"
 "commit work;\n"
 "}\n"
-"--src pop3_svr.sql:1263\n";
+"--src pop3_svr.sql:1262\n";
 
 /* ftp.sql */
 
 static const char *proc48 = 
+"#line 31 \"[executable]/ftp.sql\"\n"
 "create procedure WS.WS.FTP_SRV (in path any, in params any, in lines any)\n"
 "{\n"
 "declare ftp_mode, in_str, ftp_user, ftp_pass, dav_pass, command, argument varchar;\n"
@@ -1405,23 +1454,26 @@ static const char *proc48 =
 "\n"
 "\n"
 "}\n"
-"--src ftp.sql:30\n";
+"--src ftp.sql:29\n";
 
 static const char *proc49 = 
+"#line 182 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_QUIT (in in_srt varchar, in usr varchar)\n"
 "{\n"
 "FTP_WRITE (usr, \'211 Virtuoso FTP server signing off.\', in_srt);\n"
 "}\n"
-"--src ftp.sql:181\n";
+"--src ftp.sql:180\n";
 
 static const char *proc50 = 
+"#line 188 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_ABOR (in in_srt varchar, in usr varchar)\n"
 "{\n"
 "FTP_WRITE (usr, \'226 ABOR command was successfully processed.\', in_srt);\n"
 "}\n"
-"--src ftp.sql:187\n";
+"--src ftp.sql:186\n";
 
 static const char *proc51 = 
+"#line 194 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_GET_COMMAND (in _in varchar, inout command varchar, inout argument varchar)\n"
 "{\n"
 "declare len integer;\n"
@@ -1434,9 +1486,10 @@ static const char *proc51 =
 "else\n"
 "argument := \'\';\n"
 "}\n"
-"--src ftp.sql:193\n";
+"--src ftp.sql:192\n";
 
 static const char *proc52 = 
+"#line 208 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_ANONYMOUS_CHECK (in _user varchar)\n"
 "{\n"
 "if (upper (_user) = \'ANONYMOUS\' and\n"
@@ -1445,9 +1498,10 @@ static const char *proc52 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src ftp.sql:207\n";
+"--src ftp.sql:206\n";
 
 static const char *proc53 = 
+"#line 218 \"[executable]/ftp.sql\"\n"
 "create function\n"
 "FTP_AUTHENTICATE (in id any, in what char(1), in req varchar, in a_uname varchar, in a_pwd varchar, in a_uid integer := null) returns integer\n"
 "{\n"
@@ -1463,23 +1517,26 @@ static const char *proc53 =
 "}\n"
 "return DAV_AUTHENTICATE (id, what, req, a_uname, a_pwd, a_uid);\n"
 "}\n"
-"--src ftp.sql:217\n";
+"--src ftp.sql:216\n";
 
 static const char *proc54 = 
+"#line 236 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_PWD (in home varchar)\n"
 "{\n"
 "pop_write (\'257 \"\' || home || \'\" is current directory.\');\n"
 "}\n"
-"--src ftp.sql:235\n";
+"--src ftp.sql:234\n";
 
 static const char *proc55 = 
+"#line 243 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_NOOP ()\n"
 "{\n"
 "pop_write (\'200 OK\');\n"
 "}\n"
-"--src ftp.sql:242\n";
+"--src ftp.sql:241\n";
 
 static const char *proc56 = 
+"#line 250 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_PASV (in in_str varchar, in usr varchar, inout listen any)\n"
 "{\n"
 "declare _port integer;\n"
@@ -1488,9 +1545,10 @@ static const char *proc56 =
 "\n"
 "FTP_WRITE (usr, FTP_MAKE_PORT_COMMAND (_port, 0), in_str);\n"
 "}\n"
-"--src ftp.sql:249\n";
+"--src ftp.sql:248\n";
 
 static const char *proc57 = 
+"#line 261 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_RNTO (in in_str varchar, in _user varchar, in _pass varchar, in cur_dir varchar,\n"
 "in old_name varchar, in new_name varchar)\n"
 "{\n"
@@ -1552,40 +1610,45 @@ static const char *proc57 =
 "else\n"
 "FTP_WRITE (_user, \'550 RNTO command failed.\', in_str);\n"
 "}\n"
-"--src ftp.sql:260\n";
+"--src ftp.sql:259\n";
 
 static const char *proc58 = 
+"#line 325 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_REST (in in_str varchar, in usr varchar, in arg varchar, inout pos integer)\n"
 "{\n"
 "pos := atoi (arg);\n"
 "FTP_WRITE (usr, \'350 Restart position accepted (\' || arg || \').\', in_str);\n"
 "}\n"
-"--src ftp.sql:324\n";
+"--src ftp.sql:323\n";
 
 static const char *proc59 = 
+"#line 333 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_CLNT (in in_str varchar, in usr varchar, inout c_name varchar, in arg varchar)\n"
 "{\n"
 "c_name := arg;\n"
 "FTP_WRITE (usr, \'250 OK\', in_str);\n"
 "}\n"
-"--src ftp.sql:332\n";
+"--src ftp.sql:331\n";
 
 static const char *proc60 = 
+"#line 341 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_RNFR (in in_str varchar, in usr varchar, in new_name varchar)\n"
 "{\n"
 "FTP_WRITE (usr, \'350 OK\', in_str);\n"
 "return new_name;\n"
 "}\n"
-"--src ftp.sql:340\n";
+"--src ftp.sql:339\n";
 
 static const char *proc61 = 
+"#line 349 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_SYST ()\n"
 "{\n"
 "pop_write (\'215 UNIX \' || sys_stat(\'st_build_opsys_id\') || \' Ver. \' || sys_stat(\'st_dbms_ver\'));\n"
 "}\n"
-"--src ftp.sql:348\n";
+"--src ftp.sql:347\n";
 
 static const char *proc62 = 
+"#line 356 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_MKD (in in_str varchar,in _new varchar, in _home varchar, in _user varchar, in _pass varchar)\n"
 "{\n"
 "declare res integer;\n"
@@ -1602,9 +1665,10 @@ static const char *proc62 =
 "else\n"
 "FTP_WRITE (_user, \'550 MKD command failed.\', in_str);\n"
 "}\n"
-"--src ftp.sql:355\n";
+"--src ftp.sql:354\n";
 
 static const char *proc63 = 
+"#line 375 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_RMD (in in_str varchar, in _new varchar, in _home varchar, in _user varchar, in _pass varchar)\n"
 "{\n"
 "declare res integer;\n"
@@ -1618,9 +1682,10 @@ static const char *proc63 =
 "else\n"
 "FTP_WRITE (_user, \'550 RMD command failed.\', in_str);\n"
 "}\n"
-"--src ftp.sql:374\n";
+"--src ftp.sql:373\n";
 
 static const char *proc64 = 
+"#line 391 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_DELE (in in_str varchar, in f_name varchar, in _user varchar, in _pass varchar)\n"
 "{\n"
 "declare res integer;\n"
@@ -1638,9 +1703,10 @@ static const char *proc64 =
 "else\n"
 "FTP_WRITE (_user, \'550 RMD command failed.\', in_str);\n"
 "}\n"
-"--src ftp.sql:390\n";
+"--src ftp.sql:389\n";
 
 static const char *proc65 = 
+"#line 411 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_CWD (in in_str varchar, in command varchar, in arg varchar, inout _old varchar,\n"
 "in _home varchar, in _user varchar, in _pass varchar, inout rn_name varchar)\n"
 "{\n"
@@ -1687,26 +1753,29 @@ static const char *proc65 =
 "}\n"
 "FTP_WRITE (_user, \'250 \' || command || \' command successful.\', in_str);\n"
 "}\n"
-"--src ftp.sql:410\n";
+"--src ftp.sql:409\n";
 
 static const char *proc66 = 
+"#line 459 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_TYPE (in mode varchar, inout new_mode varchar)\n"
 "{\n"
 "new_mode := mode;\n"
 "pop_write (\'200 Type set to \' || mode);\n"
 "}\n"
-"--src ftp.sql:458\n";
+"--src ftp.sql:457\n";
 
 static const char *proc67 = 
+"#line 467 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_PORT (in in_str varchar, in ftp_user varchar, in addr varchar)\n"
 "{\n"
 "addr := PARSE_ADR (addr, 0);\n"
 "FTP_WRITE (ftp_user, \'200 PORT command successful\', in_str);\n"
 "return addr;\n"
 "}\n"
-"--src ftp.sql:466\n";
+"--src ftp.sql:465\n";
 
 static const char *proc68 = 
+"#line 476 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_LIST (in in_str varchar, in d_addr varchar, in cur_dir varchar, in _user varchar,\n"
 "in _pass varchar, in _args varchar, inout data_ses any, in is_nlist integer)\n"
 "{\n"
@@ -1798,9 +1867,10 @@ static const char *proc68 =
 "FTP_WRITE (_user, \'226 Transfer complete.\', in_str, len=>lsize);\n"
 "\n"
 "}\n"
-"--src ftp.sql:475\n";
+"--src ftp.sql:474\n";
 
 static const char *proc69 = 
+"#line 570 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_HELP ()\n"
 "{\n"
 "pop_write (\'214-The following commands are recognized (* =>\'\'s unimplemented).\');\n"
@@ -1812,9 +1882,10 @@ static const char *proc69 =
 "pop_write (\'APPE*\');\n"
 "pop_write (\'214 \');\n"
 "}\n"
-"--src ftp.sql:569\n";
+"--src ftp.sql:568\n";
 
 static const char *proc70 = 
+"#line 584 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_FILE_PERM (in perm varchar, in _type varchar)\n"
 "{\n"
 "declare perms, allset varchar;\n"
@@ -1847,9 +1918,10 @@ static const char *proc70 =
 "}\n"
 "return perms;\n"
 "}\n"
-"--src ftp.sql:583\n";
+"--src ftp.sql:582\n";
 
 static const char *proc71 = 
+"#line 619 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_RETR (in in_str varchar, in d_addr varchar, in f_name varchar, in wanted_faile varchar,\n"
 "inout listen any, in auth_uid varchar, in auth_pwd varchar, inout r_pos integer)\n"
 "{\n"
@@ -1978,9 +2050,10 @@ static const char *proc71 =
 "ses_disconnect (data_ses);\n"
 "\n"
 "}\n"
-"--src ftp.sql:618\n";
+"--src ftp.sql:617\n";
 
 static const char *proc72 = 
+"#line 750 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_SIZE (in in_str varchar, in ftp_user varchar, in ftp_pass varchar, in f_name varchar, in wanted_faile varchar)\n"
 "{\n"
 "declare _len integer;\n"
@@ -2001,9 +2074,10 @@ static const char *proc72 =
 "}\n"
 "FTP_WRITE (ftp_user, \'550 \' || wanted_faile || \' size not retrieved: \' || DAV_PERROR (dir), in_str);\n"
 "}\n"
-"--src ftp.sql:749\n";
+"--src ftp.sql:748\n";
 
 static const char *proc73 = 
+"#line 773 \"[executable]/ftp.sql\"\n"
 "create function FTP_SITE_CHMOD_U2D (in unix_chmod varchar, in old_perms varchar)\n"
 "{\n"
 "\n"
@@ -2023,9 +2097,10 @@ static const char *proc73 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src ftp.sql:772\n";
+"--src ftp.sql:771\n";
 
 static const char *proc74 = 
+"#line 794 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_SITE (in in_str varchar, in argument varchar, in full_path varchar, in _user varchar, in _pass varchar)\n"
 "{\n"
 "declare spac integer;\n"
@@ -2080,9 +2155,10 @@ static const char *proc74 =
 "oblom:\n"
 "FTP_WRITE (_user, \'500 SITE command does not support this form of request: \"\' || argument || \'\"\', in_str);\n"
 "}\n"
-"--src ftp.sql:793\n";
+"--src ftp.sql:792\n";
 
 static const char *proc75 = 
+"#line 850 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_STOR (in in_str varchar, in d_addr varchar, in cur_dir varchar, in f_name varchar,\n"
 "in _user varchar, in _pass varchar, inout listen any, inout rest_pos integer)\n"
 "{\n"
@@ -2153,9 +2229,10 @@ static const char *proc75 =
 "else\n"
 "FTP_WRITE (_user, \'550 Internal server error:\' || DAV_PERROR (_upd_res), in_str);\n"
 "}\n"
-"--src ftp.sql:849\n";
+"--src ftp.sql:848\n";
 
 static const char *proc76 = 
+"#line 922 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_PATH (in dir varchar, inout f_name varchar)\n"
 "{\n"
 "declare safe_name varchar;\n"
@@ -2174,9 +2251,10 @@ static const char *proc76 =
 "f_name := NULL;\n"
 "return 0;\n"
 "}\n"
-"--src ftp.sql:921\n";
+"--src ftp.sql:920\n";
 
 static const char *proc77 = 
+"#line 943 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_MODE_MASK (in _all varchar, inout _mode varchar, inout _mask varchar)\n"
 "{\n"
 "declare pos integer;\n"
@@ -2215,9 +2293,10 @@ static const char *proc77 =
 "\n"
 "_mask := replace (_mask, \'*\', \'%\');\n"
 "}\n"
-"--src ftp.sql:942\n";
+"--src ftp.sql:941\n";
 
 static const char *proc78 = 
+"#line 984 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_GET_DIR_PART (in _all varchar, inout _dir varchar, inout _arg varchar)\n"
 "{\n"
 "declare temp any;\n"
@@ -2239,9 +2318,10 @@ static const char *proc78 =
 "_arg := \"RIGHT\" (_all, length (temp));\n"
 "\n"
 "}\n"
-"--src ftp.sql:983\n";
+"--src ftp.sql:982\n";
 
 static const char *proc79 = 
+"#line 1008 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_NOR_DIR (in dir1 varchar, inout dir2 varchar)\n"
 "{\n"
 "\n"
@@ -2254,9 +2334,10 @@ static const char *proc79 =
 "dir2 := replace (dir2, \'//\', \'/\');\n"
 "\n"
 "}\n"
-"--src ftp.sql:1007\n";
+"--src ftp.sql:1006\n";
 
 static const char *proc80 = 
+"#line 1027 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_GET (in _server varchar, in _user varchar, in _pass varchar,\n"
 "in _file varchar, in _local varchar, in is_pasv integer := 1,\n"
 "in dav_user varchar := NULL, in dav_pass varchar := NULL)\n"
@@ -2296,9 +2377,10 @@ static const char *proc80 =
 "\n"
 "return length (all_at);\n"
 "}\n"
-"--src ftp.sql:1026\n";
+"--src ftp.sql:1025\n";
 
 static const char *proc81 = 
+"#line 1068 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_PUT (in _server varchar, in _user varchar, in _pass varchar,\n"
 "in _file varchar, in _remote varchar, in is_pasv integer := 1,\n"
 "in dav_user varchar := NULL, in dav_pass varchar := NULL)\n"
@@ -2335,9 +2417,10 @@ static const char *proc81 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src ftp.sql:1067\n";
+"--src ftp.sql:1066\n";
 
 static const char *proc82 = 
+"#line 1107 \"[executable]/ftp.sql\"\n"
 "create procedure PARSE_ADR (in _in varchar, in mode integer)\n"
 "{\n"
 "declare t any;\n"
@@ -2349,9 +2432,10 @@ static const char *proc82 =
 "t := split_and_decode (_in, 0, \'\\0\\0,\');\n"
 "return concat (t[0], \'.\',t[1], \'.\', t[2], \'.\', t[3], \':\', cast ((atoi(t[4])*256+atoi(t[5])) as varchar));\n"
 "}\n"
-"--src ftp.sql:1106\n";
+"--src ftp.sql:1105\n";
 
 static const char *proc83 = 
+"#line 1121 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_LS (in _server varchar, in _user varchar, in _pass varchar,\n"
 "in _dir varchar, in is_pasv integer := 1)\n"
 "{\n"
@@ -2378,9 +2462,10 @@ static const char *proc83 =
 "ses_disconnect (ses);\n"
 "return readed;\n"
 "}\n"
-"--src ftp.sql:1120\n";
+"--src ftp.sql:1119\n";
 
 static const char *proc84 = 
+"#line 1151 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_COMMAND (inout ses any, in cmd varchar, in is_ok any)\n"
 "{\n"
 "declare code integer;\n"
@@ -2409,9 +2494,10 @@ static const char *proc84 =
 "}\n"
 "}\n"
 "}\n"
-"--src ftp.sql:1150\n";
+"--src ftp.sql:1149\n";
 
 static const char *proc85 = 
+"#line 1181 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_SES_GET (in new_addr varchar, inout all_at any, inout data_ses any)\n"
 "{\n"
 "declare _read any;\n"
@@ -2434,9 +2520,10 @@ static const char *proc85 =
 "http (_read, all_at);\n"
 "}\n"
 "}\n"
-"--src ftp.sql:1180\n";
+"--src ftp.sql:1179\n";
 
 static const char *proc86 = 
+"#line 1205 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_CONNECT (in _server varchar, in _user varchar, in _pass varchar,\n"
 "inout ses any, in pasv integer)\n"
 "{\n"
@@ -2462,9 +2549,10 @@ static const char *proc86 =
 "\n"
 "return NULL;\n"
 "}\n"
-"--src ftp.sql:1204\n";
+"--src ftp.sql:1203\n";
 
 static const char *proc87 = 
+"#line 1232 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_LIST_GET (in new_addr varchar, inout data_ses any)\n"
 "{\n"
 "declare all_at, _read any;\n"
@@ -2487,9 +2575,10 @@ static const char *proc87 =
 "ses_disconnect (data_ses);\n"
 "return all_at;\n"
 "}\n"
-"--src ftp.sql:1231\n";
+"--src ftp.sql:1230\n";
 
 static const char *proc88 = 
+"#line 1256 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_FILE_SES_GET (in new_addr varchar, in _file_name varchar, inout data_ses any,\n"
 "in dav_user varchar, in dav_pass varchar)\n"
 "{\n"
@@ -2500,9 +2589,10 @@ static const char *proc88 =
 "_all := file_to_string_output (_file_name);\n"
 "return _all;\n"
 "}\n"
-"--src ftp.sql:1255\n";
+"--src ftp.sql:1254\n";
 
 static const char *proc89 = 
+"#line 1268 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_SES_SEND (in new_addr varchar, inout _content any, inout data_ses any,\n"
 "in dav_user varchar, in dav_pass varchar)\n"
 "{\n"
@@ -2516,9 +2606,10 @@ static const char *proc89 =
 "ses_disconnect (data_ses);\n"
 "return _ret;\n"
 "}\n"
-"--src ftp.sql:1267\n";
+"--src ftp.sql:1266\n";
 
 static const char *proc90 = 
+"#line 1284 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_IF_CODE_OK (in code integer, in is_ok any)\n"
 "{\n"
 "declare idx integer;\n"
@@ -2535,9 +2626,10 @@ static const char *proc90 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src ftp.sql:1283\n";
+"--src ftp.sql:1282\n";
 
 static const char *proc91 = 
+"#line 1303 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_GET_DIR (in _all varchar)\n"
 "{\n"
 "declare idx, pos integer;\n"
@@ -2556,9 +2648,10 @@ static const char *proc91 =
 "_all := trim (subseq (_all, pos + 1), \' \');\n"
 "}\n"
 "}\n"
-"--src ftp.sql:1302\n";
+"--src ftp.sql:1301\n";
 
 static const char *proc92 = 
+"#line 1324 \"[executable]/ftp.sql\"\n"
 "create procedure GET_FREE_PORT ()\n"
 "{\n"
 "declare _last, _min, _max any;\n"
@@ -2582,9 +2675,10 @@ static const char *proc92 =
 "\n"
 "return _last;\n"
 "}\n"
-"--src ftp.sql:1323\n";
+"--src ftp.sql:1322\n";
 
 static const char *proc93 = 
+"#line 1350 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_MAKE_PORT_COMMAND (in _port integer, in mode integer)\n"
 "{\n"
 "declare _ip, _port1, _port2 varchar;\n"
@@ -2601,9 +2695,10 @@ static const char *proc93 =
 "else\n"
 "return \'227 (\' || _ip || \',\' || _port2 || \',\' || _port1 || \')\';\n"
 "}\n"
-"--src ftp.sql:1349\n";
+"--src ftp.sql:1348\n";
 
 static const char *proc94 = 
+"#line 1369 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_LISTEN (inout ses any, inout listen any)\n"
 "{\n"
 "declare _port integer;\n"
@@ -2612,9 +2707,10 @@ static const char *proc94 =
 "\n"
 "FTP_COMMAND (ses, FTP_MAKE_PORT_COMMAND (_port, 1), vector (200));\n"
 "}\n"
-"--src ftp.sql:1368\n";
+"--src ftp.sql:1367\n";
 
 static const char *proc95 = 
+"#line 1380 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_MAKE_LIST_CMD (in _dir varchar, inout ses any)\n"
 "{\n"
 "declare _list_cmd varchar;\n"
@@ -2627,18 +2723,20 @@ static const char *proc95 =
 "FTP_COMMAND (ses, _list_cmd, NULL);\n"
 "\n"
 "}\n"
-"--src ftp.sql:1379\n";
+"--src ftp.sql:1378\n";
 
 static const char *proc96 = 
+"#line 1395 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_SES_ACCEPT (inout ses1 any, inout ses2 any)\n"
 "{\n"
 "ses2 := ses_accept (ses1);\n"
 "ses_disconnect (ses1);\n"
 "ses1 := NULL;\n"
 "}\n"
-"--src ftp.sql:1394\n";
+"--src ftp.sql:1393\n";
 
 static const char *proc97 = 
+"#line 1404 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_SES_LISTEN (inout listen any)\n"
 "{\n"
 "declare _port, _retray integer;\n"
@@ -2663,9 +2761,10 @@ static const char *proc97 =
 "\n"
 "return _port;\n"
 "}\n"
-"--src ftp.sql:1403\n";
+"--src ftp.sql:1402\n";
 
 static const char *proc98 = 
+"#line 1431 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_WRITE (in l_user varchar, in w_str varchar, in command varchar, in len integer:=0)\n"
 "{\n"
 "declare log_file varchar;\n"
@@ -2685,9 +2784,10 @@ static const char *proc98 =
 "pop_write\n"
 "(w_str);\n"
 "}\n"
-"--src ftp.sql:1430\n";
+"--src ftp.sql:1429\n";
 
 static const char *proc99 = 
+"#line 1453 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_POP_WRITE\n"
 "(in str varchar)\n"
 "{\n"
@@ -2695,9 +2795,10 @@ static const char *proc99 =
 "pop_write\n"
 "(str);\n"
 "}\n"
-"--src ftp.sql:1452\n";
+"--src ftp.sql:1451\n";
 
 static const char *proc100 = 
+"#line 1462 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_LOG_FILE_NAME (in in_name varchar)\n"
 "{\n"
 "declare file_name varchar;\n"
@@ -2723,9 +2824,10 @@ static const char *proc100 =
 "\n"
 "return file_name;\n"
 "}\n"
-"--src ftp.sql:1461\n";
+"--src ftp.sql:1460\n";
 
 static const char *proc101 = 
+"#line 1490 \"[executable]/ftp.sql\"\n"
 "create procedure FTP_RES_UPLOAD_FROM_POSITION (in in_str varchar, in d_addr varchar, in cur_dir varchar,\n"
 "in f_name varchar, in _user varchar, in _pass varchar,\n"
 "inout listen any, inout rest_pos integer)\n"
@@ -2834,9 +2936,10 @@ static const char *proc101 =
 "else\n"
 "FTP_WRITE (_user, \'550 Internal server error: \' || DAV_PERROR (_upd_res), in_str);\n"
 "}\n"
-"--src ftp.sql:1489\n";
+"--src ftp.sql:1488\n";
 
 static const char *proc102 = 
+"#line 1601 \"[executable]/ftp.sql\"\n"
 "create procedure\n"
 "FTP_PUT_IN_DAV (in _local varchar, inout all_at any, in dav_user varchar, in dav_pass varchar)\n"
 "{\n"
@@ -2851,9 +2954,10 @@ static const char *proc102 =
 "\n"
 "return length (all_at);\n"
 "}\n"
-"--src ftp.sql:1600\n";
+"--src ftp.sql:1599\n";
 
 static const char *proc103 = 
+"#line 1618 \"[executable]/ftp.sql\"\n"
 "create function\n"
 "FTP_GET_FROM_DAV (in _local varchar, in dav_user varchar, in dav_pass varchar) returns any\n"
 "{\n"
@@ -2874,7 +2978,7 @@ static const char *proc103 =
 "signal (\'22023\', \'The path (target of operation) is not valid.\');\n"
 "signal (\'22023\', DAV_PERROR (res));\n"
 "}\n"
-"--src ftp.sql:1617\n";
+"--src ftp.sql:1616\n";
 
 /* nn_svr.sql */
 
@@ -2928,6 +3032,7 @@ static const char *view0 =
 "from NEWS_MSG_NNTP\n";
 
 static const char *trig0 = 
+"#line 95 \"[executable]/nn_svr.sql\"\n"
 "create trigger NEWS_MSG_I instead of insert on NEWS_MSG referencing new as N\n"
 "{\n"
 "declare p_name varchar;\n"
@@ -2951,9 +3056,10 @@ static const char *trig0 =
 "rc := row_count ();\n"
 "set_row_count (rc, 1);\n"
 "}\n"
-"--src nn_svr.sql:94\n";
+"--src nn_svr.sql:93\n";
 
 static const char *trig1 = 
+"#line 120 \"[executable]/nn_svr.sql\"\n"
 "create trigger NEWS_MSG_U instead of update on NEWS_MSG referencing old as O, new as N\n"
 "{\n"
 "declare p_name varchar;\n"
@@ -2984,9 +3090,10 @@ static const char *trig1 =
 "rc := row_count ();\n"
 "set_row_count (rc, 1);\n"
 "}\n"
-"--src nn_svr.sql:119\n";
+"--src nn_svr.sql:118\n";
 
 static const char *trig2 = 
+"#line 152 \"[executable]/nn_svr.sql\"\n"
 "create trigger NEWS_MSG_D instead of delete on NEWS_MSG referencing old as O\n"
 "{\n"
 "declare p_name varchar;\n"
@@ -3005,9 +3112,10 @@ static const char *trig2 =
 "rc := row_count ();\n"
 "set_row_count (rc, 1);\n"
 "}\n"
-"--src nn_svr.sql:151\n";
+"--src nn_svr.sql:150\n";
 
 static const char *proc104 = 
+"#line 190 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "NN_FEED_PART (inout vb any, inout mb any, inout body varchar, inout id integer)\n"
 "{\n"
@@ -3038,9 +3146,10 @@ static const char *proc104 =
 "i := i + 1;\n"
 "}\n"
 "}\n"
-"--src nn_svr.sql:189\n";
+"--src nn_svr.sql:188\n";
 
 static const char *proc105 = 
+"#line 223 \"[executable]/nn_svr.sql\"\n"
 "create procedure DB.DBA.NEWS_MSG_NNTP_NM_BODY_INDEX_HOOK (inout vtb any, inout d_id integer)\n"
 "{\n"
 "declare data, own, offset any;\n"
@@ -3076,9 +3185,10 @@ static const char *proc105 =
 "close cr;\n"
 "return 0;\n"
 "}\n"
-"--src nn_svr.sql:222\n";
+"--src nn_svr.sql:221\n";
 
 static const char *proc106 = 
+"#line 260 \"[executable]/nn_svr.sql\"\n"
 "create procedure DB.DBA.NEWS_MSG_NNTP_NM_BODY_UNINDEX_HOOK (inout vtb any, inout d_id integer)\n"
 "{\n"
 "declare data, offset any;\n"
@@ -3114,7 +3224,7 @@ static const char *proc106 =
 "close cr;\n"
 "return 0;\n"
 "}\n"
-"--src nn_svr.sql:259\n";
+"--src nn_svr.sql:258\n";
 
 static const char *other1 = 
 "DB.DBA.vt_create_text_index (\'DB.DBA.NEWS_MSG_NNTP\', \'NM_BODY\', \'NM_BODY_ID\', 2, 0, null, 1, \'*ini*\', \'*ini*\')\n";
@@ -3168,6 +3278,7 @@ static const char *view1 =
 "where NM_ID = NM_KEY_ID\n";
 
 static const char *proc107 = 
+"#line 375 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "WS.WS.NN_SRV (in path any, in params any, in lines any)\n"
 "{\n"
@@ -3272,9 +3383,10 @@ static const char *proc107 =
 "\n"
 "return NULL;\n"
 "}\n"
-"--src nn_svr.sql:374\n";
+"--src nn_svr.sql:373\n";
 
 static const char *proc108 = 
+"#line 482 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_valid (in arg varchar, inout _activ integer, inout _cur integer,\n"
 "inout _min integer, inout _max integer, in comm integer)\n"
@@ -3314,9 +3426,10 @@ static const char *proc108 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src nn_svr.sql:481\n";
+"--src nn_svr.sql:480\n";
 
 static const char *proc109 = 
+"#line 524 \"[executable]/nn_svr.sql\"\n"
 "create procedure ns_add_msg (in _in_art any, in _group integer, inout my_last integer)\n"
 "{\n"
 "\n"
@@ -3360,9 +3473,10 @@ static const char *proc109 =
 "return 0;\n"
 "\n"
 "}\n"
-"--src nn_svr.sql:523\n";
+"--src nn_svr.sql:522\n";
 
 static const char *proc110 = 
+"#line 573 \"[executable]/nn_svr.sql\"\n"
 "create procedure ns_mirror_news\n"
 "(in _server varchar, in _out_name varchar, in _group integer, inout my_last integer,\n"
 "in _end integer, in _begin integer, in _user varchar, in _pass varchar)\n"
@@ -3495,9 +3609,10 @@ static const char *proc110 =
 "my_last := num;\n"
 "return len;\n"
 "}\n"
-"--src nn_svr.sql:572\n";
+"--src nn_svr.sql:571\n";
 
 static const char *proc111 = 
+"#line 711 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "new_news (in _group_in any, in _scheduler_grop integer := 0)\n"
 "{\n"
@@ -3596,9 +3711,10 @@ static const char *proc111 =
 "\n"
 "return t_new;\n"
 "}\n"
-"--src nn_svr.sql:710\n";
+"--src nn_svr.sql:709\n";
 
 static const char *proc112 = 
+"#line 815 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_up_num (in gr_n integer)\n"
 "{\n"
@@ -3618,9 +3734,10 @@ static const char *proc112 =
 "\n"
 "commit work;\n"
 "}\n"
-"--src nn_svr.sql:814\n";
+"--src nn_svr.sql:813\n";
 
 static const char *proc113 = 
+"#line 837 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_date (in _in_str varchar)\n"
 "{\n"
@@ -3634,9 +3751,10 @@ static const char *proc113 =
 "\n"
 "return stringdate (res);\n"
 "}\n"
-"--src nn_svr.sql:836\n";
+"--src nn_svr.sql:835\n";
 
 static const char *proc114 = 
+"#line 853 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "news_auto_update_event ()\n"
 "{\n"
@@ -3650,9 +3768,10 @@ static const char *proc114 =
 "new_news (NG_GROUP);\n"
 "}\n"
 "}\n"
-"--src nn_svr.sql:852\n";
+"--src nn_svr.sql:851\n";
 
 static const char *proc115 = 
+"#line 869 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "news_update_admin_vsp ()\n"
 "{\n"
@@ -3678,18 +3797,20 @@ static const char *proc115 =
 "\n"
 "delete from DB.DBA.SYS_SCHEDULED_EVENT where SE_SQL = \'news_update_admin_vsp()\';\n"
 "}\n"
-"--src nn_svr.sql:868\n";
+"--src nn_svr.sql:867\n";
 
 static const char *proc116 = 
+"#line 903 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_quit (inout mode integer)\n"
 "{\n"
 "pop_write (\'205 Virtuoso News server signing off.\');\n"
 "mode := 2;\n"
 "}\n"
-"--src nn_svr.sql:902\n";
+"--src nn_svr.sql:901\n";
 
 static const char *proc117 = 
+"#line 912 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_help ()\n"
 "{\n"
@@ -3715,9 +3836,10 @@ static const char *proc117 =
 "\n"
 "pop_write (help_text);\n"
 "}\n"
-"--src nn_svr.sql:911\n";
+"--src nn_svr.sql:910\n";
 
 static const char *proc118 = 
+"#line 940 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_list (in arg varchar)\n"
 "{\n"
@@ -3740,9 +3862,10 @@ static const char *proc118 =
 "else\n"
 "pop_write (\'501 command syntax error.\');\n"
 "}\n"
-"--src nn_svr.sql:939\n";
+"--src nn_svr.sql:938\n";
 
 static const char *proc119 = 
+"#line 964 \"[executable]/nn_svr.sql\"\n"
 "create procedure ns_auth (in arg any)\n"
 "{\n"
 "declare uid, _user, tmp, data, tok any;\n"
@@ -3804,9 +3927,10 @@ static const char *proc119 =
 "pop_write (\'480 Authentication required\');\n"
 "}\n"
 "}\n"
-"--src nn_svr.sql:963\n";
+"--src nn_svr.sql:962\n";
 
 static const char *proc120 = 
+"#line 1027 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_group (in arg varchar, inout _activ integer, inout _cur integer, inout _min integer, inout _max integer, inout _grp_type varchar)\n"
 "{\n"
@@ -3829,9 +3953,10 @@ static const char *proc120 =
 "pop_write (sprintf (\'411 No such group %s\', arg));\n"
 "\n"
 "}\n"
-"--src nn_svr.sql:1026\n";
+"--src nn_svr.sql:1025\n";
 
 static const char *proc121 = 
+"#line 1052 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_next (in arg varchar, in _activ integer, inout _cur integer, in _min integer, in _max integer)\n"
 "{\n"
@@ -3850,9 +3975,10 @@ static const char *proc121 =
 "pop_write (sprintf (\'223 %i %s Article retrieved; request text separately.\', _cur, _id));\n"
 "\n"
 "}\n"
-"--src nn_svr.sql:1051\n";
+"--src nn_svr.sql:1050\n";
 
 static const char *proc122 = 
+"#line 1073 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_last (in arg varchar, in _activ integer, inout _cur integer, in _min integer, in _max integer)\n"
 "{\n"
@@ -3871,9 +3997,10 @@ static const char *proc122 =
 "pop_write (sprintf (\'223 %i %s Article retrieved; request text separately.\', _cur, _id));\n"
 "\n"
 "}\n"
-"--src nn_svr.sql:1072\n";
+"--src nn_svr.sql:1071\n";
 
 static const char *proc123 = 
+"#line 1094 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_head (in arg varchar, inout _activ integer, inout _cur integer, inout _grp_type varchar)\n"
 "{\n"
@@ -3911,9 +4038,10 @@ static const char *proc123 =
 "\n"
 "close cr;\n"
 "}\n"
-"--src nn_svr.sql:1093\n";
+"--src nn_svr.sql:1092\n";
 
 static const char *proc124 = 
+"#line 1134 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_body (in arg varchar, inout _activ integer, inout _cur integer, inout grp_type varchar)\n"
 "{\n"
@@ -3950,9 +4078,10 @@ static const char *proc124 =
 "pop_write (sprintf (\'221 %i %s body\', _cur, _id));\n"
 "ses_write (_body);\n"
 "}\n"
-"--src nn_svr.sql:1133\n";
+"--src nn_svr.sql:1132\n";
 
 static const char *proc125 = 
+"#line 1173 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_article (in arg varchar, inout _activ integer, inout _cur integer)\n"
 "{\n"
@@ -4023,9 +4152,10 @@ static const char *proc125 =
 "pop_write (sprintf (\'220 %i %s article\', _cur, _id));\n"
 "ses_write (_body);\n"
 "}\n"
-"--src nn_svr.sql:1172\n";
+"--src nn_svr.sql:1171\n";
 
 static const char *proc126 = 
+"#line 1246 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_xover (in arg varchar, in activ integer, in cur integer, in grp_type varchar)\n"
 "{\n"
@@ -4084,9 +4214,10 @@ static const char *proc126 =
 "\n"
 "return;\n"
 "}\n"
-"--src nn_svr.sql:1245\n";
+"--src nn_svr.sql:1244\n";
 
 static const char *proc127 = 
+"#line 1307 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_newgroups (in arg varchar)\n"
 "{\n"
@@ -4112,9 +4243,10 @@ static const char *proc127 =
 "}\n"
 "pop_write (\'.\');\n"
 "}\n"
-"--src nn_svr.sql:1306\n";
+"--src nn_svr.sql:1305\n";
 
 static const char *proc128 = 
+"#line 1335 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_stat (in arg varchar, inout _activ integer, inout _cur integer)\n"
 "{\n"
@@ -4134,9 +4266,10 @@ static const char *proc128 =
 "\n"
 "pop_write (sprintf (\'223 %i %s stat\', _cur, _id));\n"
 "}\n"
-"--src nn_svr.sql:1334\n";
+"--src nn_svr.sql:1333\n";
 
 static const char *proc129 = 
+"#line 1357 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_post_write_out (in _text varchar)\n"
 "{\n"
@@ -4145,9 +4278,10 @@ static const char *proc129 =
 "else\n"
 "pop_write (_text);\n"
 "}\n"
-"--src nn_svr.sql:1356\n";
+"--src nn_svr.sql:1355\n";
 
 static const char *proc130 = 
+"#line 1371 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_post (in _message any)\n"
 "{\n"
@@ -4354,9 +4488,10 @@ static const char *proc130 =
 "\n"
 "return _id;\n"
 "}\n"
-"--src nn_svr.sql:1370\n";
+"--src nn_svr.sql:1369\n";
 
 static const char *proc131 = 
+"#line 1580 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_post_out ()\n"
 "{\n"
@@ -4380,9 +4515,10 @@ static const char *proc131 =
 "\n"
 "return;\n"
 "}\n"
-"--src nn_svr.sql:1579\n";
+"--src nn_svr.sql:1578\n";
 
 static const char *proc132 = 
+"#line 1605 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_post_out_id (in _nm_id varchar)\n"
 "{\n"
@@ -4406,9 +4542,10 @@ static const char *proc132 =
 "\n"
 "return;\n"
 "}\n"
-"--src nn_svr.sql:1604\n";
+"--src nn_svr.sql:1603\n";
 
 static const char *proc133 = 
+"#line 1632 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_post_out_core (inout _nm_body any, inout _nm_id varchar, inout _group_in integer)\n"
 "{\n"
@@ -4436,9 +4573,10 @@ static const char *proc133 =
 "else\n"
 "update DB.DBA.NEWS_MSG set NM_TRY_POST = either (NM_TRY_POST - 1, NM_TRY_POST - 1, NULL) where NM_ID= _nm_id;\n"
 "}\n"
-"--src nn_svr.sql:1631\n";
+"--src nn_svr.sql:1630\n";
 
 static const char *proc134 = 
+"#line 1662 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_xover_group (in _group varchar)\n"
 "{\n"
@@ -4480,9 +4618,10 @@ static const char *proc134 =
 "\n"
 "return res;\n"
 "}\n"
-"--src nn_svr.sql:1661\n";
+"--src nn_svr.sql:1660\n";
 
 static const char *proc135 = 
+"#line 1706 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_make_index_content (inout _data any, in is_news_msg_body integer)\n"
 "{\n"
@@ -4520,9 +4659,10 @@ static const char *proc135 =
 "}\n"
 "return string_output_string (outp);\n"
 "}\n"
-"--src nn_svr.sql:1705\n";
+"--src nn_svr.sql:1704\n";
 
 static const char *proc136 = 
+"#line 1746 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_read_message ()\n"
 "{\n"
@@ -4542,9 +4682,10 @@ static const char *proc136 =
 "return string_output_string (data);\n"
 "}\n"
 "}\n"
-"--src nn_svr.sql:1745\n";
+"--src nn_svr.sql:1744\n";
 
 static const char *proc137 = 
+"#line 1768 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_delete_message (in id varchar, in del_out any := NULL)\n"
 "{\n"
@@ -4618,9 +4759,10 @@ static const char *proc137 =
 "delete from DB.DBA.NEWS_MSG where NM_ID = id;\n"
 "return;\n"
 "}\n"
-"--src nn_svr.sql:1767\n";
+"--src nn_svr.sql:1766\n";
 
 static const char *proc138 = 
+"#line 1844 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_clear_messages ()\n"
 "{\n"
@@ -4638,9 +4780,10 @@ static const char *proc138 =
 "}\n"
 "return;\n"
 "}\n"
-"--src nn_svr.sql:1843\n";
+"--src nn_svr.sql:1842\n";
 
 static const char *proc139 = 
+"#line 1864 \"[executable]/nn_svr.sql\"\n"
 "create procedure getMsgField(in fld varchar, in m_id varchar)\n"
 "{\n"
 "declare msg any;\n"
@@ -4649,9 +4792,10 @@ static const char *proc139 =
 "\n"
 "return (get_keyword(fld,aref(msg, 0), \' - \'));\n"
 "}\n"
-"--src nn_svr.sql:1863\n";
+"--src nn_svr.sql:1862\n";
 
 static const char *proc140 = 
+"#line 1875 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_rest (in gr_num integer, in _read integer)\n"
 "{\n"
@@ -4661,9 +4805,10 @@ static const char *proc140 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src nn_svr.sql:1874\n";
+"--src nn_svr.sql:1873\n";
 
 static const char *proc141 = 
+"#line 1887 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_rest_rate_read (in gr_num integer)\n"
 "{\n"
@@ -4676,17 +4821,19 @@ static const char *proc141 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src nn_svr.sql:1886\n";
+"--src nn_svr.sql:1885\n";
 
 static const char *proc142 = 
+"#line 1902 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_rest_rate (in gr_num integer, in rw integer := 0)\n"
 "{\n"
 "return http_acl_get (\'NEWS\', http_client_ip (), null, gr_num, rw, 1);\n"
 "}\n"
-"--src nn_svr.sql:1901\n";
+"--src nn_svr.sql:1900\n";
 
 static const char *trig3 = 
+"#line 1911 \"[executable]/nn_svr.sql\"\n"
 "create trigger scheduled_event_insert_new_newsgroup after insert on DB.DBA.NEWS_GROUPS\n"
 "{\n"
 "\n"
@@ -4695,9 +4842,10 @@ static const char *trig3 =
 "values (concat (\'UPDATE_NEWSGROUP_\', cast (NG_NAME as varchar), \'__\', cast (NG_GROUP as varchar)), now(),\n"
 "concat (\'new_news (\'\'\', cast (NG_NAME as varchar), \'\'\', \', cast (NG_GROUP as varchar), \')\'), NG_UP_INT);\n"
 "}\n"
-"--src nn_svr.sql:1910\n";
+"--src nn_svr.sql:1909\n";
 
 static const char *trig4 = 
+"#line 1922 \"[executable]/nn_svr.sql\"\n"
 "create trigger scheduled_event_update_new_newsgroup after\n"
 "update on DB.DBA.NEWS_GROUPS referencing old as O, new as N\n"
 "{\n"
@@ -4714,9 +4862,10 @@ static const char *trig4 =
 "cast (N.NG_GROUP as varchar), \')\'), N.NG_UP_INT);\n"
 "}\n"
 "}\n"
-"--src nn_svr.sql:1921\n";
+"--src nn_svr.sql:1920\n";
 
 static const char *trig5 = 
+"#line 1941 \"[executable]/nn_svr.sql\"\n"
 "create trigger scheduled_event_delete_new_newsgroup after delete on DB.DBA.NEWS_GROUPS\n"
 "{\n"
 "\n"
@@ -4725,9 +4874,10 @@ static const char *trig5 =
 "\n"
 "delete from DB.DBA.HTTP_ACL where upper (HA_LIST) = \'NEWS\' and HA_OBJECT = NG_GROUP;\n"
 "}\n"
-"--src nn_svr.sql:1940\n";
+"--src nn_svr.sql:1939\n";
 
 static const char *proc143 = 
+"#line 1954 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "news_acl_insert (in ng_group integer, in mask varchar, in allow integer, in _mode integer, in _rate double precision := 0)\n"
 "{\n"
@@ -4737,18 +4887,20 @@ static const char *proc143 =
 "insert into DB.DBA.HTTP_ACL (HA_LIST, HA_ORDER, HA_OBJECT, HA_CLIENT_IP, HA_FLAG, HA_RW, HA_RATE)\n"
 "values (\'NEWS\', acl_order, ng_group, mask, allow, _mode, _rate);\n"
 "}\n"
-"--src nn_svr.sql:1953\n";
+"--src nn_svr.sql:1952\n";
 
 static const char *proc144 = 
+"#line 1965 \"[executable]/nn_svr.sql\"\n"
 "create procedure nntp_update_message_path (inout _message any, in _ex_path varchar)\n"
 "{\n"
 "declare _new_path varchar;\n"
 "_new_path := registry_get (\'__nntp_from_header\') || \'!\' || _ex_path;\n"
 "_message := replace (_message, _ex_path, _new_path, 1);\n"
 "}\n"
-"--src nn_svr.sql:1964\n";
+"--src nn_svr.sql:1963\n";
 
 static const char *proc145 = 
+"#line 1973 \"[executable]/nn_svr.sql\"\n"
 "create procedure nntp_update_org_path_header ()\n"
 "{\n"
 "declare _org, _from varchar;\n"
@@ -4765,11 +4917,12 @@ static const char *proc145 =
 "registry_set (\'__nntp_from_header\', _from);\n"
 "registry_set (\'__nntp_organization_header\', _org);\n"
 "}\n"
-"--src nn_svr.sql:1972\n";
+"--src nn_svr.sql:1971\n";
 
 static const char *other3 = 
 "nntp_update_org_path_header ()\n";
 static const char *proc146 = 
+"#line 2019 \"[executable]/nn_svr.sql\"\n"
 "create procedure\n"
 "ns_cancel_message (in _id varchar, in _all any)\n"
 "{\n"
@@ -4777,11 +4930,12 @@ static const char *proc146 =
 "_id := trim (_id);\n"
 "ns_delete_message (_id, cast (_all as varchar));\n"
 "}\n"
-"--src nn_svr.sql:2018\n";
+"--src nn_svr.sql:2017\n";
 
 /* admin_news.sql */
 
 static const char *proc147 = 
+"#line 23 \"[executable]/admin_news.sql\"\n"
 "create procedure\n"
 "adm_news_status (in STAT integer)\n"
 "{\n"
@@ -4792,9 +4946,10 @@ static const char *proc147 =
 "else if (STAT = 9) return \'<DIV CLASS=\"status_wip\">Updating...</DIV>\';\n"
 "else return \'<DIV CLASS=\"status_err\">Unsuccessful</DIV>\';\n"
 "}\n"
-"--src admin_news.sql:22\n";
+"--src admin_news.sql:21\n";
 
 static const char *proc148 = 
+"#line 35 \"[executable]/admin_news.sql\"\n"
 "create procedure\n"
 "DB.DBA.adm_mailaddr_pretty (in email_addr varchar)\n"
 "{\n"
@@ -4807,7 +4962,7 @@ static const char *proc148 =
 "_name := coalesce(_name, _email);\n"
 "return sprintf(\'\\n<A HREF=\"mailto:%s\">%s</A>\\n\', _email, _name);\n"
 "}\n"
-"--src admin_news.sql:34\n";
+"--src admin_news.sql:33\n";
 
 static const char *tbl6 = 
 "CREATE TABLE \"DB\".\"DBA\".\"NEWS_GROUPS_AVAILABLE\" (\n"
@@ -4824,6 +4979,7 @@ static const char *tbl6 =
 "CREATE UNIQUE INDEX GROUPS_AVAILABLE ON DB.DBA.NEWS_GROUPS_AVAILABLE(NAME, NS_ID)\n";
 
 static const char *proc149 = 
+"#line 64 \"[executable]/admin_news.sql\"\n"
 "CREATE PROCEDURE DB.DBA.populate_groups_available (in _ns_id integer)\n"
 "{\n"
 "declare _list, _row any;\n"
@@ -4875,9 +5031,10 @@ static const char *proc149 =
 "UPDATE \"DB\".\"DBA\".\"NEWS_GROUPS_AVAILABLE\" SET \"UPDATED\" = \'R\' WHERE \"NS_ID\" = _ns_id AND \"UPDATED\" = \'N\';\n"
 "return len;\n"
 "}\n"
-"--src admin_news.sql:63\n";
+"--src admin_news.sql:62\n";
 
 static const char *trig6 = 
+"#line 117 \"[executable]/admin_news.sql\"\n"
 "CREATE TRIGGER GetGroups AFTER INSERT ON \"DB\".\"DBA\".\"NEWS_SERVERS\"\n"
 "{\n"
 "INSERT INTO \"DB\".\"DBA\".\"SYS_SCHEDULED_EVENT\"(SE_NAME, SE_START, SE_SQL, SE_INTERVAL)\n"
@@ -4885,16 +5042,17 @@ static const char *trig6 =
 "concat(\'\"DB\".\"DBA\".\"populate_groups_available\"(\', cast(\"NS_ID\" as varchar), \')\'), 100);\n"
 "\n"
 "}\n"
-"--src admin_news.sql:116\n";
+"--src admin_news.sql:115\n";
 
 static const char *trig7 = 
+"#line 126 \"[executable]/admin_news.sql\"\n"
 "CREATE TRIGGER GetGroupsStop AFTER DELETE ON \"DB\".\"DBA\".\"NEWS_SERVERS\"\n"
 "{\n"
 "delete from \"DB\".\"DBA\".\"SYS_SCHEDULED_EVENT\"\n"
 "where SE_NAME = concat(\'UPD_Avail_Grps_\', NS_SERVER);\n"
 "\n"
 "}\n"
-"--src admin_news.sql:125\n";
+"--src admin_news.sql:124\n";
 
 static int
 sch_proc_def_exists (client_connection_t *cli, const char *proc_name)
diff --git a/libsrc/Wi/sql_code_repl.c b/libsrc/Wi/sql_code_repl.c
index fd6aa32..c7f6c83 100644
--- a/libsrc/Wi/sql_code_repl.c
+++ b/libsrc/Wi/sql_code_repl.c
@@ -31,6 +31,7 @@ static const char *tbl1 =
 "create unique index SNL_RPLOG on DB.DBA.SYS_SNAPSHOT_LOG (SNL_RPLOG)\n";
 
 static const char *proc0 = 
+"#line 52 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure repl_undot_name (in id varchar)\n"
 "{\n"
 "declare last_dot_inx integer;\n"
@@ -40,9 +41,10 @@ static const char *proc0 =
 "else\n"
 "return id;\n"
 "}\n"
-"--src snapshot_repl.sql:51\n";
+"--src snapshot_repl.sql:50\n";
 
 static const char *proc1 = 
+"#line 64 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_OFFSET_TIME (\n"
 "in _last_ts datetime, in _reg_var varchar, in _default_offset integer)\n"
 "returns datetime\n"
@@ -61,9 +63,10 @@ static const char *proc1 =
 "\n"
 "return _starttime;\n"
 "}\n"
-"--src snapshot_repl.sql:63\n";
+"--src snapshot_repl.sql:62\n";
 
 static const char *proc2 = 
+"#line 86 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_FQNAME (in _tbl varchar)\n"
 "{\n"
 "declare _parts any;\n"
@@ -81,9 +84,10 @@ static const char *proc2 =
 "}\n"
 "return concat (_parts[0], \'.\', _parts[1], \'.\', _parts[2]);\n"
 "}\n"
-"--src snapshot_repl.sql:85\n";
+"--src snapshot_repl.sql:84\n";
 
 static const char *proc3 = 
+"#line 105 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_ORIGIN (in _rowguid varchar)\n"
 "{\n"
 "declare _delim_pos integer;\n"
@@ -93,9 +97,10 @@ static const char *proc3 =
 "return substring (_rowguid, 1, _delim_pos);\n"
 "return null;\n"
 "}\n"
-"--src snapshot_repl.sql:104\n";
+"--src snapshot_repl.sql:103\n";
 
 static const char *proc4 = 
+"#line 116 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_SET_ORIGIN (\n"
 "in _rowguid varchar, in _origin varchar := null)\n"
 "{\n"
@@ -108,7 +113,7 @@ static const char *proc4 =
 "_rowguid := subseq (_rowguid, _delim_pos + 1);\n"
 "return concat (_origin, \'@\', _rowguid);\n"
 "}\n"
-"--src snapshot_repl.sql:115\n";
+"--src snapshot_repl.sql:114\n";
 
 static const char *tbl2 = 
 "create table DB.DBA.SYS_SNAPSHOT_PUB (\n"
@@ -187,6 +192,7 @@ static const char *tbl6 =
 "create index SYS_REPL_POSTPONED_LOCKED_RES_ID on DB.DBA.SYS_REPL_POSTPONED_RES (LOCKED_RES_ID)\n";
 
 static const char *proc5 = 
+"#line 241 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_COLTYPE_PS (\n"
 "in _coltype varchar,\n"
 "in _col_dtp integer, in _col_prec integer, in _col_scale integer)\n"
@@ -220,9 +226,10 @@ static const char *proc5 =
 "}\n"
 "return _coltype;\n"
 "}\n"
-"--src snapshot_repl.sql:240\n";
+"--src snapshot_repl.sql:239\n";
 
 static const char *proc6 = 
+"#line 276 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_COLTYPE (in _col any) returns varchar\n"
 "{\n"
 "declare _col_dtp, _col_prec, _col_scale integer;\n"
@@ -240,9 +247,10 @@ static const char *proc6 =
 "return REPL_COLTYPE_PS (\n"
 "dv_type_title(_col_dtp), _col_dtp, _col_prec, _col_scale);\n"
 "}\n"
-"--src snapshot_repl.sql:275\n";
+"--src snapshot_repl.sql:274\n";
 
 static const char *proc7 = 
+"#line 299 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_REMOTE_TYPES_RAW (in _dsn varchar)\n"
 "returns any\n"
 "{\n"
@@ -266,9 +274,10 @@ static const char *proc7 =
 "}\n"
 "return _remote_types;\n"
 "}\n"
-"--src snapshot_repl.sql:298\n";
+"--src snapshot_repl.sql:297\n";
 
 static const char *proc8 = 
+"#line 350 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_REMOTE_TYPES (\n"
 "in _dsn varchar, in _dbms_name varchar := null)\n"
 "returns any\n"
@@ -315,9 +324,10 @@ static const char *proc8 =
 "}\n"
 "return _remote_types;\n"
 "}\n"
-"--src snapshot_repl.sql:349\n";
+"--src snapshot_repl.sql:348\n";
 
 static const char *proc9 = 
+"#line 399 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_PK_COLS (in _tbl varchar)\n"
 "{\n"
 "declare cr_pk cursor for\n"
@@ -358,9 +368,10 @@ static const char *proc9 =
 "close cr_pk;\n"
 "return _pk_cols;\n"
 "}\n"
-"--src snapshot_repl.sql:398\n";
+"--src snapshot_repl.sql:397\n";
 
 static const char *proc10 = 
+"#line 441 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_ALL_COLS (in _tbl varchar)\n"
 "{\n"
 "declare _stmt varchar;\n"
@@ -387,9 +398,10 @@ static const char *proc10 =
 "\n"
 "return _cols;\n"
 "}\n"
-"--src snapshot_repl.sql:440\n";
+"--src snapshot_repl.sql:439\n";
 
 static const char *proc11 = 
+"#line 469 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_TBL_COLS (in _tbl varchar)\n"
 "{\n"
 "declare _cols, _col any;\n"
@@ -412,9 +424,10 @@ static const char *proc11 =
 "}\n"
 "return _tbl_cols;\n"
 "}\n"
-"--src snapshot_repl.sql:468\n";
+"--src snapshot_repl.sql:467\n";
 
 static const char *proc12 = 
+"#line 495 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_COMPLETE_COLNAME (in _colname varchar)\n"
 "returns varchar\n"
 "{\n"
@@ -424,7 +437,7 @@ static const char *proc12 =
 "_colname := concat (_colname, \'/\');\n"
 "return _colname;\n"
 "}\n"
-"--src snapshot_repl.sql:494\n";
+"--src snapshot_repl.sql:493\n";
 
 static const char *tbl7 = 
 "create table WS.WS.RPLOG_SYS_DAV_RES (\n"
@@ -436,6 +449,7 @@ static const char *tbl7 =
 ")\n";
 
 static const char *proc13 = 
+"#line 532 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_DAV_STORE_RES_INT (\n"
 "in _res_colname varchar, in _res_name varchar, inout _res_content any,\n"
 "in _res_type varchar, in _res_perms varchar,\n"
@@ -619,9 +633,10 @@ static const char *proc13 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src snapshot_repl.sql:531\n";
+"--src snapshot_repl.sql:530\n";
 
 static const char *proc14 = 
+"#line 717 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_DAV_STORE_RES (\n"
 "in _res_colname varchar, in _res_name varchar, in _res_content any,\n"
 "in _res_type varchar, in _res_perms varchar,\n"
@@ -636,9 +651,10 @@ static const char *proc14 =
 "_res_uname, _res_gname, _res_cr_time, _res_mod_time, _rowguid,\n"
 "null, null, null, null, null, _backup_colid);\n"
 "}\n"
-"--src snapshot_repl.sql:716\n";
+"--src snapshot_repl.sql:715\n";
 
 static const char *trig0 = 
+"#line 733 \"[executable]/snapshot_repl.sql\"\n"
 "create trigger SYS_DAV_LOCK_PROCESS_POSTPONED\n"
 "after delete on WS.WS.SYS_DAV_LOCK order 200 referencing old as _O\n"
 "{\n"
@@ -690,9 +706,10 @@ static const char *trig0 =
 "nf:\n"
 "close cr;\n"
 "}\n"
-"--src snapshot_repl.sql:732\n";
+"--src snapshot_repl.sql:731\n";
 
 static const char *proc15 = 
+"#line 788 \"[executable]/snapshot_repl.sql\"\n"
 "create procedure REPL_DAV_SAVE_BACKUP (\n"
 "in _do_backup integer, in _do_notify integer,\n"
 "in _notify_email varchar, in _notify_text varchar,\n"
@@ -793,11 +810,12 @@ static const char *proc15 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src snapshot_repl.sql:787\n";
+"--src snapshot_repl.sql:786\n";
 
 /* repl.sql */
 
 static const char *proc16 = 
+"#line 28 \"[executable]/repl.sql\"\n"
 "create procedure REPL_PUB_REMOVE (in __pub varchar, in _item varchar, in _type integer, in _not_all varchar)\n"
 "{\n"
 "declare _is_updatable integer;\n"
@@ -872,10 +890,48 @@ static const char *proc16 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src repl.sql:27\n";
+"--src repl.sql:26\n";
 
 static const char *proc17 = 
-"create procedure REPL_SERVER (in name varchar, in addr varchar, in repl_addr varchar)\n"
+"#line 104 \"[executable]/repl.sql\"\n"
+"create procedure REPL_GET_ADDR_FROM_DSN (in dsn varchar)\n"
+"{\n"
+"declare arr, dsn_exists any;\n"
+"dsn_exists := 0;\n"
+"declare exit handler for sqlstate \'*\'\n"
+"{\n"
+"rollback work;\n"
+"signal (\'42000\', sprintf (\'Can not get host address from DSN \"%s\"\', dsn));\n"
+"};\n"
+"arr := sql_get_private_profile_string (dsn, \'user\');\n"
+"if (isvector (arr))\n"
+"{\n"
+"foreach (any x in arr) do\n"
+"{\n"
+"dsn_exists := 1;\n"
+"if (lower (x[0]) = \'address\' or lower (x[0]) = \'host\')\n"
+"return x[1];\n"
+"}\n"
+"}\n"
+"arr := sql_get_private_profile_string (dsn, \'system\');\n"
+"if (isvector (arr))\n"
+"{\n"
+"foreach (any x in arr) do\n"
+"{\n"
+"dsn_exists := 1;\n"
+"if (lower (x[0]) = \'address\' or lower (x[0]) = \'host\')\n"
+"return x[1];\n"
+"}\n"
+"}\n"
+"if (dsn_exists)\n"
+"return \'localhost:1111\';\n"
+"signal (\'22023\', sprintf (\'Can not find DSN \"%s\"\', dsn));\n"
+"}\n"
+"--src repl.sql:102\n";
+
+static const char *proc18 = 
+"#line 140 \"[executable]/repl.sql\"\n"
+"create procedure REPL_SERVER (in name varchar, in addr varchar, in repl_addr varchar := null)\n"
 "{\n"
 "if (not isstring (sys_stat (\'st_repl_server_enable\')))\n"
 "{\n"
@@ -886,14 +942,22 @@ static const char *proc17 =
 "}\n"
 "if (name = repl_this_server ())\n"
 "return;\n"
+"if (repl_addr is null)\n"
+"{\n"
+"if (__proc_exists (\'sql_get_private_profile_string\', 2) is not null)\n"
+"repl_addr := REPL_GET_ADDR_FROM_DSN (addr);\n"
+"else\n"
+"repl_addr := addr;\n"
+"}\n"
 "insert replacing DB.DBA.SYS_SERVERS (SERVER, DB_ADDRESS, REPL_ADDRESS)\n"
-"values (name, addr, coalesce (repl_addr, addr));\n"
+"values (name, addr, repl_addr);\n"
 "repl_changed ();\n"
 "log_text (\'repl_changed ()\');\n"
 "}\n"
-"--src repl.sql:104\n";
+"--src repl.sql:138\n";
 
-static const char *proc18 = 
+static const char *proc19 = 
+"#line 165 \"[executable]/repl.sql\"\n"
 "create procedure REPL_SYNC_USER (\n"
 "in _srv varchar, in _acct varchar, in _sync_user varchar)\n"
 "{\n"
@@ -903,9 +967,10 @@ static const char *proc18 =
 "where SERVER = _srv and ACCOUNT = _acct;\n"
 "repl_changed();\n"
 "}\n"
-"--src repl.sql:122\n";
+"--src repl.sql:163\n";
 
-static const char *proc19 = 
+static const char *proc20 = 
+"#line 176 \"[executable]/repl.sql\"\n"
 "create procedure REPL_PUBLISH (in _acct varchar, in log_path varchar, in _is_updatable integer := 0, in _sync_user varchar := null)\n"
 "{\n"
 "declare _nth integer;\n"
@@ -933,9 +998,10 @@ static const char *proc19 =
 "sequence_set (concat (\'repl_\', repl_this_server(), \'_\', acct), 0, 0);\n"
 "repl_new_log (repl_this_server(), acct, log_path);\n"
 "}\n"
-"--src repl.sql:133\n";
+"--src repl.sql:174\n";
 
-static const char *proc20 = 
+static const char *proc21 = 
+"#line 205 \"[executable]/repl.sql\"\n"
 "create procedure REPL_UNPUBLISH (in _pub varchar)\n"
 "{\n"
 "declare pub varchar;\n"
@@ -957,11 +1023,17 @@ static const char *proc20 =
 "REPL_REVOKE (pub, grnt);\n"
 "}\n"
 "delete from DB.DBA.SYS_REPL_ACCOUNTS  where SERVER = repl_this_server () and ACCOUNT = pub;\n"
+"delete from SYS_REPL_SUBSCRIBERS where RS_SERVER = repl_this_server () and RS_ACCOUNT = pub;\n"
+"sequence_remove (sprintf (\'repl_%s_%s\', repl_this_server (), pub));\n"
+"registry_remove (sprintf (\'repl_%s_%s\', repl_this_server (), pub));\n"
+"commit work;\n"
+"repl_account_remove (pub);\n"
 "repl_changed ();\n"
 "}\n"
-"--src repl.sql:162\n";
+"--src repl.sql:203\n";
 
-static const char *proc21 = 
+static const char *proc22 = 
+"#line 237 \"[executable]/repl.sql\"\n"
 "create procedure REPL_UNSUBSCRIBE (in serv varchar, in _pub varchar, in _item varchar)\n"
 "{\n"
 "declare _path any;\n"
@@ -1069,12 +1141,15 @@ static const char *proc21 =
 "}\n"
 "else\n"
 "delete from DB.DBA.SYS_TP_ITEM where TI_SERVER = serv and TI_ACCT = pub and TI_ITEM = _item;\n"
+"sequence_remove (sprintf (\'repl_%s_%s\', serv, pub));\n"
+"registry_remove (sprintf (\'repl_%s_%s\', serv, pub));\n"
 "repl_changed ();\n"
 "log_text (\'repl_changed ()\');\n"
 "}\n"
-"--src repl.sql:189\n";
+"--src repl.sql:235\n";
 
-static const char *proc22 = 
+static const char *proc23 = 
+"#line 351 \"[executable]/repl.sql\"\n"
 "create procedure DEL_CHILD_COLLS (in _id integer)\n"
 "{\n"
 "for select COL_ID as col from WS.WS.SYS_DAV_COL where COL_PARENT = _id do\n"
@@ -1084,9 +1159,10 @@ static const char *proc22 =
 "delete from WS.WS.SYS_DAV_COL where COL_PARENT = _id;\n"
 "return;\n"
 "}\n"
-"--src repl.sql:301\n";
+"--src repl.sql:349\n";
 
-static const char *proc23 = 
+static const char *proc24 = 
+"#line 363 \"[executable]/repl.sql\"\n"
 "create procedure REPL_SUBSCRIBE (in srv varchar, in _acct varchar,\n"
 "in usr varchar, in grp varchar, in _usr varchar, in pwd varchar,\n"
 "in _sync_user varchar := null)\n"
@@ -1205,17 +1281,19 @@ static const char *proc23 =
 "repl_new_log (srv, concat (\'!\', acct), \'\');\n"
 "}\n"
 "}\n"
-"--src repl.sql:313\n";
+"--src repl.sql:361\n";
 
-static const char *proc24 = 
+static const char *proc25 = 
+"#line 483 \"[executable]/repl.sql\"\n"
 "create procedure REPL_SCHED_INIT ()\n"
 "{\n"
 "insert replacing DB.DBA.SYS_SCHEDULED_EVENT (SE_NAME, SE_START, SE_INTERVAL, SE_SQL)\n"
 "values (\'SYNC_REPL\', now (), 1, \'SYNC_REPL ()\');\n"
 "}\n"
-"--src repl.sql:433\n";
+"--src repl.sql:481\n";
 
-static const char *proc25 = 
+static const char *proc26 = 
+"#line 490 \"[executable]/repl.sql\"\n"
 "create procedure SYNC_REPL ()\n"
 "{\n"
 "for select SERVER as sr, ACCOUNT as acct from DB.DBA.SYS_REPL_ACCOUNTS\n"
@@ -1233,9 +1311,10 @@ static const char *proc25 =
 " ;\n"
 "}\n"
 "}\n"
-"--src repl.sql:440\n";
+"--src repl.sql:488\n";
 
-static const char *proc26 = 
+static const char *proc27 = 
+"#line 509 \"[executable]/repl.sql\"\n"
 "create procedure SUB_SCHEDULE (in srv varchar, in _acct varchar, in intl integer)\n"
 "{\n"
 "declare acct varchar;\n"
@@ -1265,9 +1344,10 @@ static const char *proc26 =
 "signal (\'37000\', concat (\'Replication account \'\'\', acct, \'\'\' from \'\'\', srv,\'\'\' does not exist\', \'TR015\'));\n"
 "}\n"
 "}\n"
-"--src repl.sql:459\n";
+"--src repl.sql:507\n";
 
-static const char *proc27 = 
+static const char *proc28 = 
+"#line 540 \"[executable]/repl.sql\"\n"
 "create procedure REPL_STAT ()\n"
 "{\n"
 "declare status varchar;\n"
@@ -1283,9 +1363,10 @@ static const char *proc27 =
 "result (SERVER, ACCOUNT, level, aref (status, stat));\n"
 "}\n"
 "}\n"
-"--src repl.sql:490\n";
+"--src repl.sql:538\n";
 
-static const char *proc28 = 
+static const char *proc29 = 
+"#line 557 \"[executable]/repl.sql\"\n"
 "create procedure\n"
 "REPL_GET_DAV_UID_GID (in dav_u varchar, in dav_g varchar, out dav_ui integer, out dav_gi integer)\n"
 "{\n"
@@ -1293,9 +1374,10 @@ static const char *proc28 =
 "dav_gi := coalesce ((select G_ID from WS.WS.SYS_DAV_GROUP where G_NAME = dav_g), NULL);\n"
 "return;\n"
 "}\n"
-"--src repl.sql:507\n";
+"--src repl.sql:555\n";
 
-static const char *proc29 = 
+static const char *proc30 = 
+"#line 566 \"[executable]/repl.sql\"\n"
 "create procedure REPL_PUB_INIT_IMAGE (in __pub varchar, in _file varchar, in _bytes_per_file integer)\n"
 "{\n"
 "declare _name, _parent, _stat, _msg, _pub varchar;\n"
@@ -1513,9 +1595,10 @@ static const char *proc29 =
 "backup_close ();\n"
 "__atomic (0);\n"
 "}\n"
-"--src repl.sql:516\n";
+"--src repl.sql:564\n";
 
-static const char *proc30 = 
+static const char *proc31 = 
+"#line 785 \"[executable]/repl.sql\"\n"
 "create procedure BACKUP_CHILDREN_COL (in _c_id integer, in dav_u integer, in dav_g integer)\n"
 "{\n"
 "declare _id, _p_id, _n, _len, _x integer;\n"
@@ -1539,9 +1622,10 @@ static const char *proc30 =
 "backup_flush ();\n"
 "return;\n"
 "}\n"
-"--src repl.sql:735\n";
+"--src repl.sql:783\n";
 
-static const char *proc31 = 
+static const char *proc32 = 
+"#line 810 \"[executable]/repl.sql\"\n"
 "create procedure\n"
 "REPL_DAV_GET_USER_GROUP (in own varchar, in grp varchar,\n"
 "in __own varchar, in __grp varchar,\n"
@@ -1585,9 +1669,10 @@ static const char *proc31 =
 "end_get:\n"
 "return;\n"
 "}\n"
-"--src repl.sql:760\n";
+"--src repl.sql:808\n";
 
-static const char *proc32 = 
+static const char *proc33 = 
+"#line 857 \"[executable]/repl.sql\"\n"
 "create procedure DAV_COL_I (in _name varchar, in _path varchar, in _cr_time datetime,\n"
 "in __own varchar, in __grp varchar, in _perms varchar)\n"
 "{\n"
@@ -1620,9 +1705,10 @@ static const char *proc32 =
 "values (WS.WS.GETID (\'C\'), _name, _p_id, _own, _grp, _cr_time, _cr_time, _perms);\n"
 "return;\n"
 "}\n"
-"--src repl.sql:807\n";
+"--src repl.sql:855\n";
 
-static const char *proc33 = 
+static const char *proc34 = 
+"#line 892 \"[executable]/repl.sql\"\n"
 "create procedure DAV_COL_U (in _old_path varchar, in _new_path varchar, in _mod_time datetime,\n"
 "in __own varchar, in __grp varchar, in _perms varchar)\n"
 "{\n"
@@ -1662,9 +1748,10 @@ static const char *proc33 =
 "where COL_ID = _id;\n"
 "return;\n"
 "}\n"
-"--src repl.sql:842\n";
+"--src repl.sql:890\n";
 
-static const char *proc34 = 
+static const char *proc35 = 
+"#line 935 \"[executable]/repl.sql\"\n"
 "create procedure DAV_COL_D (in _ppath varchar, in _ch integer)\n"
 "{\n"
 "declare _id integer;\n"
@@ -1686,9 +1773,10 @@ static const char *proc34 =
 "delete from WS.WS.SYS_DAV_COL where COL_ID = _id;\n"
 "return;\n"
 "}\n"
-"--src repl.sql:885\n";
+"--src repl.sql:933\n";
 
-static const char *proc35 = 
+static const char *proc36 = 
+"#line 960 \"[executable]/repl.sql\"\n"
 "create procedure DAV_RES_I (in _ppath varchar, in _time datetime, in __own varchar, in __grp varchar,\n"
 "in _perms varchar, in _type varchar, in _content any)\n"
 "{\n"
@@ -1739,9 +1827,10 @@ static const char *proc35 =
 "values (WS.WS.GETID (\'R\'), _name, _time, _time, _own, _grp, _perms, _type, _ses, _ppath, _c_id);\n"
 "return;\n"
 "}\n"
-"--src repl.sql:910\n";
+"--src repl.sql:958\n";
 
-static const char *proc36 = 
+static const char *proc37 = 
+"#line 1014 \"[executable]/repl.sql\"\n"
 "create procedure DAV_RES_D (in _ppath varchar)\n"
 "{\n"
 "declare _id integer;\n"
@@ -1759,9 +1848,10 @@ static const char *proc36 =
 "delete from WS.WS.SYS_DAV_RES where RES_COL = _id and RES_NAME = _name;\n"
 "return;\n"
 "}\n"
-"--src repl.sql:964\n";
+"--src repl.sql:1012\n";
 
-static const char *proc37 = 
+static const char *proc38 = 
+"#line 1033 \"[executable]/repl.sql\"\n"
 "create procedure REPL_PUB_ADD_CHECK_PROC (in _P_NAME varchar, in _pub varchar)\n"
 "{\n"
 "declare pars any;\n"
@@ -1791,9 +1881,10 @@ static const char *proc37 =
 "_par_inx := _par_inx + 1;\n"
 "}\n"
 "}\n"
-"--src repl.sql:983\n";
+"--src repl.sql:1031\n";
 
-static const char *proc38 = 
+static const char *proc39 = 
+"#line 1066 \"[executable]/repl.sql\"\n"
 "create procedure REPL_PUB_ADD (in __pub varchar, in _item varchar, in _type integer,\n"
 "in _mode integer, in _opt integer)\n"
 "{\n"
@@ -1849,9 +1940,10 @@ static const char *proc38 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src repl.sql:1016\n";
+"--src repl.sql:1064\n";
 
-static const char *proc39 = 
+static const char *proc40 = 
+"#line 1123 \"[executable]/repl.sql\"\n"
 "create procedure REPL_PROC_MODE (in __acct varchar, in _item varchar, in _mode integer)\n"
 "{\n"
 "declare _mod integer;\n"
@@ -1901,9 +1993,10 @@ static const char *proc39 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src repl.sql:1073\n";
+"--src repl.sql:1121\n";
 
-static const char *proc40 = 
+static const char *proc41 = 
+"#line 1175 \"[executable]/repl.sql\"\n"
 "create procedure REPL_PUB_TBL (in _pub varchar, in tbl varchar, in _is_updatable integer)\n"
 "{\n"
 "declare state, message, stmt  varchar;\n"
@@ -2203,9 +2296,10 @@ static const char *proc40 =
 "}\n"
 "}\n"
 "}\n"
-"--src repl.sql:1125\n";
+"--src repl.sql:1173\n";
 
-static const char *proc41 = 
+static const char *proc42 = 
+"#line 1476 \"[executable]/repl.sql\"\n"
 "create procedure REPL_SUBSCR_TBL_FKS (in server varchar, in acct varchar, in dsn varchar, in tbl varchar)\n"
 "{\n"
 "declare fk_tables any;\n"
@@ -2279,9 +2373,10 @@ static const char *proc41 =
 "}\n"
 "}\n"
 "}\n"
-"--src repl.sql:1426\n";
+"--src repl.sql:1474\n";
 
-static const char *proc42 = 
+static const char *proc43 = 
+"#line 1552 \"[executable]/repl.sql\"\n"
 "create procedure REPL_PRINT_COL_DEF (inout _col any) returns varchar\n"
 "{\n"
 "declare stmt varchar;\n"
@@ -2310,9 +2405,10 @@ static const char *proc42 =
 "}\n"
 "return stmt;\n"
 "}\n"
-"--src repl.sql:1502\n";
+"--src repl.sql:1550\n";
 
-static const char *proc43 = 
+static const char *proc44 = 
+"#line 1583 \"[executable]/repl.sql\"\n"
 " create procedure __INT_REPL_ALTER_ADD_COL (in tb varchar, in col varchar,\n"
 "in dv integer, in scale integer, in prec integer, in ck varchar, in _action varchar := \'ADD\')\n"
 "{\n"
@@ -2333,9 +2429,10 @@ static const char *proc43 =
 "repl_text (_ti_acct, _stmt);\n"
 "}\n"
 "}\n"
-"--src repl.sql:1533\n";
+"--src repl.sql:1581\n";
 
-static const char *proc44 = 
+static const char *proc45 = 
+"#line 1606 \"[executable]/repl.sql\"\n"
 " create procedure __INT_REPL_ALTER_DROP_COL (in tb varchar, in col varchar,\n"
 "in dv integer, in scale integer, in prec integer, in ck varchar, in _action varchar := \'DROP\')\n"
 "{\n"
@@ -2353,9 +2450,10 @@ static const char *proc44 =
 "repl_text (_ti_acct, _stmt);\n"
 "}\n"
 "}\n"
-"--src repl.sql:1556\n";
+"--src repl.sql:1604\n";
 
-static const char *proc45 = 
+static const char *proc46 = 
+"#line 1625 \"[executable]/repl.sql\"\n"
 "create procedure __INT_REPL_ALTER_REDO_TRIGGERS (in tb varchar)\n"
 "{\n"
 "for (select\n"
@@ -2382,9 +2480,10 @@ static const char *proc45 =
 "_is_updatable);\n"
 "}\n"
 "}\n"
-"--src repl.sql:1575\n";
+"--src repl.sql:1623\n";
 
-static const char *proc46 = 
+static const char *proc47 = 
+"#line 1653 \"[executable]/repl.sql\"\n"
 "create procedure __REPL_DDL_FK_MODIFY_PROPAGATE (in tb varchar, in op integer, in decl any, in orig_pkt varchar)\n"
 "{\n"
 "for (select\n"
@@ -2420,9 +2519,10 @@ static const char *proc46 =
 "_next:;\n"
 "}\n"
 "}\n"
-"--src repl.sql:1603\n";
+"--src repl.sql:1651\n";
 
-static const char *proc47 = 
+static const char *proc48 = 
+"#line 1690 \"[executable]/repl.sql\"\n"
 "create procedure REPL_SUBSCR_TBL (in serv varchar, in _pub varchar, in tbl varchar, in _is_updatable integer)\n"
 "{\n"
 "declare state, message, stmt, stmtidx  varchar;\n"
@@ -2730,9 +2830,10 @@ static const char *proc47 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src repl.sql:1640\n";
+"--src repl.sql:1688\n";
 
-static const char *proc48 = 
+static const char *proc49 = 
+"#line 1999 \"[executable]/repl.sql\"\n"
 "create procedure __REPL_SUBSCR_TBL_TRIGGERS (\n"
 "in serv varchar,\n"
 "in _pub varchar,\n"
@@ -2895,9 +2996,10 @@ static const char *proc48 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src repl.sql:1949\n";
+"--src repl.sql:1997\n";
 
-static const char *proc49 = 
+static const char *proc50 = 
+"#line 2163 \"[executable]/repl.sql\"\n"
 "create procedure REPL_GRANT (in _acct varchar, in grantee varchar)\n"
 "{\n"
 "declare acct varchar;\n"
@@ -2913,9 +3015,10 @@ static const char *proc49 =
 "__repl_grant (acct, grantee);\n"
 "}\n"
 "}\n"
-"--src repl.sql:2113\n";
+"--src repl.sql:2161\n";
 
-static const char *proc50 = 
+static const char *proc51 = 
+"#line 2181 \"[executable]/repl.sql\"\n"
 "create procedure REPL_REVOKE (in _acct varchar, in grantee varchar)\n"
 "{\n"
 "declare acct varchar;\n"
@@ -2938,9 +3041,10 @@ static const char *proc50 =
 "else\n"
 "signal (\'37000\', concat (\'The grantee \'\'\', grantee, \'\'\' does not exist\'), \'TR051\');\n"
 "}\n"
-"--src repl.sql:2131\n";
+"--src repl.sql:2179\n";
 
-static const char *proc51 = 
+static const char *proc52 = 
+"#line 2205 \"[executable]/repl.sql\"\n"
 "create procedure REPL_DAV_PROC (in coltbl varchar, in restbl varchar, in dav_u any, in dav_g any)\n"
 "{\n"
 "declare str, stat, msg varchar;\n"
@@ -2993,9 +3097,10 @@ static const char *proc51 =
 "stat := \'00000\'; msg :=\'\';\n"
 "exec (str, stat, msg);\n"
 "}\n"
-"--src repl.sql:2155\n";
+"--src repl.sql:2203\n";
 
-static const char *proc52 = 
+static const char *proc53 = 
+"#line 2259 \"[executable]/repl.sql\"\n"
 "create procedure DAV_MKCOL (in pathstr varchar, in perms varchar, in dav_u integer, in dav_g integer)\n"
 "{\n"
 "declare _path, _np any;\n"
@@ -3026,9 +3131,10 @@ static const char *proc52 =
 "}\n"
 "return _id;\n"
 "}\n"
-"--src repl.sql:2209\n";
+"--src repl.sql:2257\n";
 
-static const char *proc53 = 
+static const char *proc54 = 
+"#line 2292 \"[executable]/repl.sql\"\n"
 "create procedure REPL_DAV_FILL (in _srv varchar, in _coll varchar, in dav_u integer, in dav_g integer)\n"
 "{\n"
 "declare _addr, _stat, _msg varchar;\n"
@@ -3065,9 +3171,10 @@ static const char *proc53 =
 "else\n"
 "return _msg;\n"
 "}\n"
-"--src repl.sql:2242\n";
+"--src repl.sql:2290\n";
 
-static const char *proc54 = 
+static const char *proc55 = 
+"#line 2330 \"[executable]/repl.sql\"\n"
 "create procedure REPL_INIT_COPY (in srv varchar, in _acct varchar, in ret_err integer := 0)\n"
 "{\n"
 "declare txt, sel, src_cols, src_table, _stat, _msg, server, acct varchar;\n"
@@ -3311,9 +3418,10 @@ static const char *proc54 =
 "_ret_err := NULL;\n"
 "return _ret_err;\n"
 "}\n"
-"--src repl.sql:2280\n";
+"--src repl.sql:2328\n";
 
-static const char *proc55 = 
+static const char *proc56 = 
+"#line 2576 \"[executable]/repl.sql\"\n"
 "create procedure REPL_SUB_ITEM (in srv varchar, in _acct varchar,\n"
 "in i varchar, in t integer, in opt varchar, in cm integer)\n"
 "{\n"
@@ -3473,9 +3581,10 @@ static const char *proc55 =
 "\n"
 "return;\n"
 "}\n"
-"--src repl.sql:2526\n";
+"--src repl.sql:2574\n";
 
-static const char *proc56 = 
+static const char *proc57 = 
+"#line 2737 \"[executable]/repl.sql\"\n"
 "create procedure REPL_SERVER_RENAME (in old_name varchar, in new_name varchar)\n"
 "{\n"
 "declare rc varchar;\n"
@@ -3505,16 +3614,18 @@ static const char *proc56 =
 "rollback work;\n"
 "signal (\'42000\', rc, \'TR058\');\n"
 "}\n"
-"--src repl.sql:2687\n";
+"--src repl.sql:2735\n";
 
-static const char *proc57 = 
+static const char *proc58 = 
+"#line 2769 \"[executable]/repl.sql\"\n"
 "create procedure REPL_SYNC_ALL ()\n"
 "{\n"
 "DB.DBA.SYNC_REPL();\n"
 "}\n"
-"--src repl.sql:2719\n";
+"--src repl.sql:2767\n";
 
-static const char *proc58 = 
+static const char *proc59 = 
+"#line 2775 \"[executable]/repl.sql\"\n"
 "create procedure REPL_ADD_CR (\n"
 "in _tbl varchar,\n"
 "\n"
@@ -3752,9 +3863,10 @@ static const char *proc58 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src repl.sql:2725\n";
+"--src repl.sql:2773\n";
 
-static const char *proc59 = 
+static const char *proc60 = 
+"#line 3014 \"[executable]/repl.sql\"\n"
 "create procedure REPL_IS_UPDATABLE (in _server varchar, in _account varchar)\n"
 "{\n"
 "declare _is_updatable integer;\n"
@@ -3776,9 +3888,10 @@ static const char *proc59 =
 "\n"
 "return _is_updatable;\n"
 "}\n"
-"--src repl.sql:2964\n";
+"--src repl.sql:3012\n";
 
-static const char *proc60 = 
+static const char *proc61 = 
+"#line 3037 \"[executable]/repl.sql\"\n"
 "create procedure REPL_DSN (in _server varchar)\n"
 "{\n"
 "declare _dsn varchar;\n"
@@ -3788,9 +3901,10 @@ static const char *proc60 =
 "nf:\n"
 "return _dsn;\n"
 "}\n"
-"--src repl.sql:2987\n";
+"--src repl.sql:3035\n";
 
-static const char *proc61 = 
+static const char *proc62 = 
+"#line 3048 \"[executable]/repl.sql\"\n"
 "create procedure REPL_ENSURE_RDS (\n"
 "in _dsn varchar, in _usr varchar, in _pwd varchar)\n"
 "{\n"
@@ -3803,9 +3917,10 @@ static const char *proc61 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src repl.sql:2998\n";
+"--src repl.sql:3046\n";
 
-static const char *proc62 = 
+static const char *proc63 = 
+"#line 3062 \"[executable]/repl.sql\"\n"
 "create procedure REPL_ENSURE_TABLE_ATTACHED (\n"
 "in _dsn varchar, in _tbl varchar, in _local_tbl varchar := null)\n"
 "returns varchar\n"
@@ -3824,9 +3939,10 @@ static const char *proc62 =
 "}\n"
 "return _local_tbl;\n"
 "}\n"
-"--src repl.sql:3012\n";
+"--src repl.sql:3060\n";
 
-static const char *proc63 = 
+static const char *proc64 = 
+"#line 3082 \"[executable]/repl.sql\"\n"
 "create procedure REPL_ENSURE_VIEW_ATTACHED (\n"
 "in _dsn varchar, in _tbl varchar, in _pklist any)\n"
 "returns varchar\n"
@@ -3845,9 +3961,10 @@ static const char *proc63 =
 "}\n"
 "return _local_tbl;\n"
 "}\n"
-"--src repl.sql:3032\n";
+"--src repl.sql:3080\n";
 
-static const char *proc64 = 
+static const char *proc65 = 
+"#line 3102 \"[executable]/repl.sql\"\n"
 "create procedure DB.DBA.REPL_TRX_CHECK ()\n"
 "{\n"
 "declare ini, cur varchar;\n"
@@ -3865,12 +3982,12 @@ static const char *proc64 =
 "log_message (\'or Conductor interface.\');\n"
 "raw_exit ();\n"
 "}\n"
-"else\n"
+"else if (isstring (ini))\n"
 "{\n"
 "registry_set (\'__repl_this_server\', ini);\n"
 "}\n"
 "}\n"
-"--src repl.sql:3052\n";
+"--src repl.sql:3100\n";
 
 
 static const char *other4 = 
@@ -3939,54 +4056,55 @@ sqls_define_repl (void)
   /* repl.sql */
 
   DEFINE_PROC ("REPL_PUB_REMOVE", proc16);
-  DEFINE_PROC ("REPL_SERVER", proc17);
-  DEFINE_PROC ("REPL_SYNC_USER", proc18);
-  DEFINE_PROC ("REPL_PUBLISH", proc19);
-  DEFINE_PROC ("REPL_UNPUBLISH", proc20);
-  DEFINE_PROC ("REPL_UNSUBSCRIBE", proc21);
-  DEFINE_PROC ("DEL_CHILD_COLLS", proc22);
-  DEFINE_PROC ("REPL_SUBSCRIBE", proc23);
-  DEFINE_PROC ("REPL_SCHED_INIT", proc24);
-  DEFINE_PROC ("SYNC_REPL", proc25);
-  DEFINE_PROC ("SUB_SCHEDULE", proc26);
-  DEFINE_PROC ("REPL_STAT", proc27);
-  DEFINE_PROC ("REPL_GET_DAV_UID_GID", proc28);
-  DEFINE_PROC ("REPL_PUB_INIT_IMAGE", proc29);
-  DEFINE_PROC ("BACKUP_CHILDREN_COL", proc30);
-  DEFINE_PROC ("REPL_DAV_GET_USER_GROUP", proc31);
-  DEFINE_PROC ("DAV_COL_I", proc32);
-  DEFINE_PROC ("DAV_COL_U", proc33);
-  DEFINE_PROC ("DAV_COL_D", proc34);
-  DEFINE_PROC ("DAV_RES_I", proc35);
-  DEFINE_PROC ("DAV_RES_D", proc36);
-  DEFINE_PROC ("REPL_PUB_ADD_CHECK_PROC", proc37);
-  DEFINE_PROC ("REPL_PUB_ADD", proc38);
-  DEFINE_PROC ("REPL_PROC_MODE", proc39);
-  DEFINE_PROC ("REPL_PUB_TBL", proc40);
-  DEFINE_PROC ("REPL_SUBSCR_TBL_FKS", proc41);
-  DEFINE_PROC ("REPL_PRINT_COL_DEF", proc42); 
-  DEFINE_OVERWRITE_PROC ("__INT_REPL_ALTER_ADD_COL", proc43); 
-  DEFINE_OVERWRITE_PROC ("__INT_REPL_ALTER_DROP_COL", proc44);
-  DEFINE_PROC ("__INT_REPL_ALTER_REDO_TRIGGERS", proc45);
-  DEFINE_PROC ("__REPL_DDL_FK_MODIFY_PROPAGATE", proc46);
-  DEFINE_PROC ("REPL_SUBSCR_TBL", proc47);
-  DEFINE_PROC ("__REPL_SUBSCR_TBL_TRIGGERS", proc48);
-  DEFINE_PROC ("REPL_GRANT", proc49);
-  DEFINE_PROC ("REPL_REVOKE", proc50);
-  DEFINE_PROC ("REPL_DAV_PROC", proc51);
-  DEFINE_PROC ("DAV_MKCOL", proc52);
-  DEFINE_PROC ("REPL_DAV_FILL", proc53);
-  DEFINE_PROC ("REPL_INIT_COPY", proc54);
-  DEFINE_PROC ("REPL_SUB_ITEM", proc55);
-  DEFINE_PROC ("REPL_SERVER_RENAME", proc56);
-  DEFINE_PROC ("REPL_SYNC_ALL", proc57);
-  DEFINE_PROC ("REPL_ADD_CR", proc58);
-  DEFINE_PROC ("REPL_IS_UPDATABLE", proc59);
-  DEFINE_PROC ("REPL_DSN", proc60);
-  DEFINE_PROC ("REPL_ENSURE_RDS", proc61);
-  DEFINE_PROC ("REPL_ENSURE_TABLE_ATTACHED", proc62);
-  DEFINE_PROC ("REPL_ENSURE_VIEW_ATTACHED", proc63);
-  DEFINE_PROC ("DB.DBA.REPL_TRX_CHECK", proc64);
+  DEFINE_PROC ("REPL_GET_ADDR_FROM_DSN", proc17);
+  DEFINE_PROC ("REPL_SERVER", proc18);
+  DEFINE_PROC ("REPL_SYNC_USER", proc19);
+  DEFINE_PROC ("REPL_PUBLISH", proc20);
+  DEFINE_PROC ("REPL_UNPUBLISH", proc21);
+  DEFINE_PROC ("REPL_UNSUBSCRIBE", proc22);
+  DEFINE_PROC ("DEL_CHILD_COLLS", proc23);
+  DEFINE_PROC ("REPL_SUBSCRIBE", proc24);
+  DEFINE_PROC ("REPL_SCHED_INIT", proc25);
+  DEFINE_PROC ("SYNC_REPL", proc26);
+  DEFINE_PROC ("SUB_SCHEDULE", proc27);
+  DEFINE_PROC ("REPL_STAT", proc28);
+  DEFINE_PROC ("REPL_GET_DAV_UID_GID", proc29);
+  DEFINE_PROC ("REPL_PUB_INIT_IMAGE", proc30);
+  DEFINE_PROC ("BACKUP_CHILDREN_COL", proc31);
+  DEFINE_PROC ("REPL_DAV_GET_USER_GROUP", proc32);
+  DEFINE_PROC ("DAV_COL_I", proc33);
+  DEFINE_PROC ("DAV_COL_U", proc34);
+  DEFINE_PROC ("DAV_COL_D", proc35);
+  DEFINE_PROC ("DAV_RES_I", proc36);
+  DEFINE_PROC ("DAV_RES_D", proc37);
+  DEFINE_PROC ("REPL_PUB_ADD_CHECK_PROC", proc38);
+  DEFINE_PROC ("REPL_PUB_ADD", proc39);
+  DEFINE_PROC ("REPL_PROC_MODE", proc40);
+  DEFINE_PROC ("REPL_PUB_TBL", proc41);
+  DEFINE_PROC ("REPL_SUBSCR_TBL_FKS", proc42);
+  DEFINE_PROC ("REPL_PRINT_COL_DEF", proc43); 
+  DEFINE_OVERWRITE_PROC ("__INT_REPL_ALTER_ADD_COL", proc44); 
+  DEFINE_OVERWRITE_PROC ("__INT_REPL_ALTER_DROP_COL", proc45);
+  DEFINE_PROC ("__INT_REPL_ALTER_REDO_TRIGGERS", proc46);
+  DEFINE_PROC ("__REPL_DDL_FK_MODIFY_PROPAGATE", proc47);
+  DEFINE_PROC ("REPL_SUBSCR_TBL", proc48);
+  DEFINE_PROC ("__REPL_SUBSCR_TBL_TRIGGERS", proc49);
+  DEFINE_PROC ("REPL_GRANT", proc50);
+  DEFINE_PROC ("REPL_REVOKE", proc51);
+  DEFINE_PROC ("REPL_DAV_PROC", proc52);
+  DEFINE_PROC ("DAV_MKCOL", proc53);
+  DEFINE_PROC ("REPL_DAV_FILL", proc54);
+  DEFINE_PROC ("REPL_INIT_COPY", proc55);
+  DEFINE_PROC ("REPL_SUB_ITEM", proc56);
+  DEFINE_PROC ("REPL_SERVER_RENAME", proc57);
+  DEFINE_PROC ("REPL_SYNC_ALL", proc58);
+  DEFINE_PROC ("REPL_ADD_CR", proc59);
+  DEFINE_PROC ("REPL_IS_UPDATABLE", proc60);
+  DEFINE_PROC ("REPL_DSN", proc61);
+  DEFINE_PROC ("REPL_ENSURE_RDS", proc62);
+  DEFINE_PROC ("REPL_ENSURE_TABLE_ATTACHED", proc63);
+  DEFINE_PROC ("REPL_ENSURE_VIEW_ATTACHED", proc64);
+  DEFINE_PROC ("DB.DBA.REPL_TRX_CHECK", proc65);
 }
 
 
diff --git a/libsrc/Wi/sql_code_sparql.c b/libsrc/Wi/sql_code_sparql.c
index 1d6bd8d..8196167 100644
--- a/libsrc/Wi/sql_code_sparql.c
+++ b/libsrc/Wi/sql_code_sparql.c
@@ -22,18 +22,20 @@ static const char *tbl0 =
 "create distinct no primary key ref index RDF_QUAD_OP on RDF_QUAD (O, P) partition (O varchar (-1, 0hexffff))\n";
 
 static const char *proc0 = 
+"#line 39 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE (in qname any) returns IRI_ID\n"
 "{\n"
 "return iri_to_id_nosignal (qname);\n"
 "}\n"
-"--src sparql.sql:38\n";
+"--src sparql.sql:37\n";
 
 static const char *proc1 = 
+"#line 45 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_IID_OF_QNAME_COMP (in qname any) returns IRI_ID\n"
 "{\n"
 "return iri_to_id_nosignal (qname, 0);\n"
 "}\n"
-"--src sparql.sql:44\n";
+"--src sparql.sql:43\n";
 
 
 static const char *other0 = 
@@ -42,11 +44,12 @@ static const char *other0 =
 static const char *other1 = 
 " DB.DBA.RDF_MAKE_IID_OF_QNAME_COMP (null)\n";
 static const char *proc2 = 
+"#line 59 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QNAME_OF_IID (in iid IRI_ID) returns varchar\n"
 "{\n"
 "return id_to_iri_nosignal (iid);\n"
 "}\n"
-"--src sparql.sql:58\n";
+"--src sparql.sql:57\n";
 
 
 static const char *other2 = 
@@ -131,15 +134,27 @@ static const char *tbl10 =
 
 static const char *tbl11 = 
 "create table DB.DBA.RDF_LABEL (RL_O any primary key, RL_RO_ID bigint, RL_TEXT varchar, RL_LANG int)\n"
-"alter index RDF_LABEL on RDF_LABEL partition (RL_O varchar (-1, 0hexffff))\n";
+"alter index RDF_LABEL on RDF_LABEL partition (RL_O varchar (-1, 0hexffff))\n"
+"create index RDF_LABEL_TEXT on RDF_LABEL (RL_TEXT, RL_O) partition (RL_TEXT varchar (6, 0hexffff))\n";
 
 static const char *tbl12 = 
+"create table DB.DBA.RDF_QUAD_DELETE_QUEUE (\n"
+"EVENT_ID bigint not null,\n"
+"RULE_ID bigint not null,\n"
+"QG IRI_ID not null,\n"
+"QS IRI_ID not null,\n"
+"QP IRI_ID not null,\n"
+"QO any not null,\n"
+"primary key (EVENT_ID, RULE_ID,  QG, QS, QP, QO)\n"
+")\n";
+
+static const char *tbl13 = 
 "create table DB.DBA.SYS_FAKE_0\n"
 "(\n"
 "ID integer not null primary key\n"
 ")\n";
 
-static const char *tbl13 = 
+static const char *tbl14 = 
 "create table DB.DBA.SYS_FAKE_1\n"
 "(\n"
 "ID integer not null primary key\n"
@@ -162,6 +177,7 @@ static const char *other9 =
 static const char *other10 = 
 "sequence_set (\'RDF_LANGUAGE_TWOBYTE\', 258, 1)\n";
 static const char *proc3 = 
+"#line 217 \"[executable]/sparql.sql\"\n"
 "create procedure RDF_GEO_INIT ()\n"
 "{\n"
 "if (not exists (select 1 from SYS_VT_INDEX where VI_COL = \'o\'))\n"
@@ -173,9 +189,10 @@ static const char *proc3 =
 "__ddl_changed (\'DB.DBA.RDF_QUAD\');\n"
 "}\n"
 "}\n"
-"--src sparql.sql:204\n";
+"--src sparql.sql:215\n";
 
 static const char *proc4 = 
+"#line 230 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_OBJ_RO_FLAGS_INDEX_HOOK (inout vtb any, inout d_id any)\n"
 "{\n"
 "for (select RO_LONG, RO_VAL, RO_FLAGS\n"
@@ -188,9 +205,10 @@ static const char *proc4 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src sparql.sql:217\n";
+"--src sparql.sql:228\n";
 
 static const char *proc5 = 
+"#line 244 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_OBJ_RO_FLAGS_UNINDEX_HOOK (inout vtb any, inout d_id any)\n"
 "{\n"
 "for (select RO_LONG, RO_VAL, RO_FLAGS\n"
@@ -203,15 +221,16 @@ static const char *proc5 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src sparql.sql:231\n";
+"--src sparql.sql:242\n";
 
 static const char *proc6 = 
+"#line 258 \"[executable]/sparql.sql\"\n"
 "create procedure sparql_exec_quiet (in expn varchar)\n"
 "{\n"
 "declare sta, msg varchar;\n"
 "exec (expn, sta, msg);\n"
 "}\n"
-"--src sparql.sql:245\n";
+"--src sparql.sql:256\n";
 
 static const char *other11 = 
 "sparql_exec_quiet (\'DB.DBA.vt_create_text_index (\n"
@@ -222,6 +241,7 @@ static const char *other11 =
 static const char *other12 = 
 "sparql_exec_quiet (\'DB.DBA.vt_batch_update (fix_identifier_case (\'\'DB.DBA.RDF_OBJ\'\'), \'\'ON\'\', 1)\')\n";
 static const char *proc7 = 
+"#line 279 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.XML_SET_NS_DECL (in prefix varchar, in url varchar, in persist integer := 1) returns integer\n"
 "{\n"
 "declare res integer;\n"
@@ -237,9 +257,10 @@ static const char *proc7 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:266\n";
+"--src sparql.sql:277\n";
 
 static const char *proc8 = 
+"#line 297 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.XML_REMOVE_NS_BY_PREFIX (in prefix varchar, in persist integer := 1)\n"
 "{\n"
 "declare res integer;\n"
@@ -252,9 +273,10 @@ static const char *proc8 =
 "commit work;\n"
 "}\n"
 "}\n"
-"--src sparql.sql:284\n";
+"--src sparql.sql:295\n";
 
 static const char *proc9 = 
+"#line 312 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.XML_CLEAR_ALL_NS_DECLS (in persist integer := 1)\n"
 "{\n"
 "declare res integer;\n"
@@ -267,9 +289,10 @@ static const char *proc9 =
 "commit work;\n"
 "}\n"
 "}\n"
-"--src sparql.sql:299\n";
+"--src sparql.sql:310\n";
 
 static const char *proc10 = 
+"#line 327 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.XML_SELECT_ALL_NS_DECLS (in persist integer := 3)\n"
 "{\n"
 "declare decls any;\n"
@@ -281,9 +304,10 @@ static const char *proc10 =
 "for (ctr := 0; ctr < len; ctr := ctr + 2)\n"
 "result (decls[ctr], decls[ctr+1]);\n"
 "}\n"
-"--src sparql.sql:314\n";
+"--src sparql.sql:325\n";
 
 static const char *proc11 = 
+"#line 340 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.XML_LOAD_ALL_NS_DECLS ()\n"
 "{\n"
 "for (select NS_PREFIX, NS_URL from DB.DBA.SYS_XML_PERSISTENT_NS_DECL) do\n"
@@ -297,6 +321,7 @@ static const char *proc11 =
 "DB.DBA.XML_SET_NS_DECL (	\'dc\'	, \'http://purl.org/dc/elements/1.1/\'		, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'go\'	, \'http://purl.org/obo/owl/GO#\'		, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'geo\'	, \'http://www.w3.org/2003/01/geo/wgs84_pos#\'		, 2);\n"
+"DB.DBA.XML_SET_NS_DECL (	\'fn\'	, \'http://www.w3.org/2005/xpath-functions/#\'	, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'foaf\'	, \'http://xmlns.com/foaf/0.1/\'		, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'obo\'	, \'http://www.geneontology.org/formats/oboInOwl#\'		, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'owl\'	, \'http://www.w3.org/2002/07/owl#\'		, 2);\n"
@@ -309,10 +334,13 @@ static const char *proc11 =
 "DB.DBA.XML_SET_NS_DECL (	\'rdfdf\'	, \'http://www.openlinksw.com/virtrdf-data-formats#\'	, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'rdfs\'	, \'http://www.w3.org/2000/01/rdf-schema#\'	, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'sc\'	, \'http://purl.org/science/owl/sciencecommons/\'		, 2);\n"
+"DB.DBA.XML_SET_NS_DECL (	\'sioc\'	, \'http://rdfs.org/sioc/ns#\'	, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'skos\'	, \'http://www.w3.org/2004/02/skos/core#\'	, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'sql\'	, \'sql:\'	, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'virtrdf\'	, \'http://www.openlinksw.com/schemas/virtrdf#\'	, 2);\n"
+"DB.DBA.XML_SET_NS_DECL (	\'virtcxml\'	, \'http://www.openlinksw.com/schemas/virtcxml#\'	, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'vcard\'	, \'http://www.w3.org/2001/vcard-rdf/3.0#\'	, 2);\n"
+"DB.DBA.XML_SET_NS_DECL (	\'vcard2006\'	, \'http://www.w3.org/2006/vcard/ns#\'	, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'xf\'	, \'http://www.w3.org/2004/07/xpath-functions\'	, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'xml\'	, \'http://www.w3.org/XML/1998/namespace\'	, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'xsd\'	, \'http://www.w3.org/2001/XMLSchema#\'	, 2);\n"
@@ -321,13 +349,14 @@ static const char *proc11 =
 "DB.DBA.XML_SET_NS_DECL (	\'xslwd\'	, \'http://www.w3.org/TR/WD-xsl\'	, 2);\n"
 "DB.DBA.XML_SET_NS_DECL (	\'yago\'	, \'http://dbpedia.org/class/yago/\'	, 2);\n"
 "}\n"
-"--src sparql.sql:327\n";
+"--src sparql.sql:338\n";
 
 static const char *other13 = 
 "DB.DBA.XML_LOAD_ALL_NS_DECLS ()\n";
 static const char *other14 = 
 "rdf_inf_const_init ()\n";
 static const char *proc12 = 
+"#line 389 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_LOAD_ALL_FT_RULES ()\n"
 "{\n"
 "whenever sqlstate \'*\' goto again;\n"
@@ -341,14 +370,178 @@ static const char *proc12 =
 "__rdf_obj_ft_rule_add (rule_g_iid, rule_p_iid, reason);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:372\n";
+"--src sparql.sql:387\n";
 
 static const char *other15 = 
 "DB.DBA.RDF_LOAD_ALL_FT_RULES ()\n";
-
 static const char *proc13 = 
+"#line 407 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_REPL_START (in quiet integer := 0)\n"
+"{\n"
+"if (repl_this_server () is null)\n"
+"return;\n"
+"if (isstring (registry_get (\'DB.DBA.RDF_REPL\')))\n"
+"{\n"
+"if (quiet)\n"
+"return;\n"
+"signal (\'RDF99\', \'RDF replication is already enabled\');\n"
+"}\n"
+"for (select RGGM_MEMBER_IID from DB.DBA.RDF_GRAPH_GROUP_MEMBER\n"
+"where RGGM_GROUP_IID = iri_to_id (UNAME\'http://www.openlinksw.com/schemas/virtrdf#rdf_repl_graph_group\')\n"
+"and not (bit_and (__rdf_graph_approx_perms (RGGM_MEMBER_IID, http_nobody_uid()), 1)) ) do\n"
+"{\n"
+"signal (\'RDF99\', \'RDF replication can not be enabled because it will violate security rules for public read access to graph <\' || id_to_iri(RGGM_MEMBER_IID) || \'>\');\n"
+"}\n"
+"repl_publish (\'__rdf_repl\', \'__rdf_repl.log\');\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue()\');\n"
+"DB.DBA.RDF_GRAPH_GROUP_CREATE (UNAME\'http://www.openlinksw.com/schemas/virtrdf#rdf_repl_graph_group\', 1);\n"
+"registry_set (\'DB.DBA.RDF_REPL\', cast (now() as varchar));\n"
+"exec (\'checkpoint\');\n"
+"}\n"
+"--src sparql.sql:405\n";
+
+static const char *proc14 = 
+"#line 431 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_REPL_STOP (in quiet integer := 0)\n"
+"{\n"
+"if (not isstring (registry_get (\'DB.DBA.RDF_REPL\')))\n"
+"{\n"
+"if (quiet)\n"
+"return;\n"
+"signal (\'RDF99\', \'RDF replication is not enabled\');\n"
+"}\n"
+"repl_unpublish (\'__rdf_repl\');\n"
+"registry_remove (\'DB.DBA.RDF_REPL\');\n"
+"}\n"
+"--src sparql.sql:429\n";
+
+static const char *proc15 = 
+"#line 444 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_REPL_GRAPH_INS (in memb_iri varchar)\n"
+"{\n"
+"declare memb_iid IRI_ID;\n"
+"memb_iid := iri_to_id (memb_iri);\n"
+"memb_iri := id_to_iri (memb_iid);\n"
+"if (memb_iri = DB.DBA.JSO_SYS_GRAPH())\n"
+"signal (\'RDF99\', \'Can not enable RDF replication of <\' || memb_iri || \'> (the system metadata graph)\');\n"
+"DB.DBA.RDF_GRAPH_GROUP_INS (UNAME\'http://www.openlinksw.com/schemas/virtrdf#rdf_repl_graph_group\', memb_iri);\n"
+"if (not (bit_and (__rdf_graph_approx_perms (memb_iid, http_nobody_uid()), 1)))\n"
+"signal (\'RDF99\', \'Can not enable RDF replication of graph <\' || memb_iri || \'> because it is not readable by public\');\n"
+"}\n"
+"--src sparql.sql:442\n";
+
+static const char *proc16 = 
+"#line 457 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_REPL_GRAPH_DEL (in memb_iri varchar)\n"
+"{\n"
+"declare memb_iid IRI_ID;\n"
+"DB.DBA.RDF_GRAPH_GROUP_DEL (UNAME\'http://www.openlinksw.com/schemas/virtrdf#rdf_repl_graph_group\', memb_iri);\n"
+"}\n"
+"--src sparql.sql:455\n";
+
+static const char *proc17 = 
+"#line 464 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_REPL_SYNC (in publisher varchar, in u varchar, in pwd varchar)\n"
+"{\n"
+"declare lvl, stat integer;\n"
+"if (repl_this_server () is null)\n"
+"return;\n"
+"commit work;\n"
+"retr:\n"
+"\n"
+"repl_sync (publisher, \'__rdf_repl\', u, pwd);\n"
+"again:\n"
+"repl_status (publisher, \'__rdf_repl\', lvl, stat);\n"
+"if (0 = stat)\n"
+"{\n"
+"__rdf_repl_flush_queue();\n"
+"return;\n"
+"}\n"
+"if (1 = stat)\n"
+"{\n"
+"delay (0.1);\n"
+"goto again;\n"
+"}\n"
+"if (2 = stat)\n"
+"{\n"
+"__rdf_repl_flush_queue();\n"
+"return;\n"
+"}\n"
+"goto retr;\n"
+"}\n"
+"--src sparql.sql:462\n";
+
+static const char *proc18 = 
+"#line 495 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_REPL_INSERT_TRIPLES (in graph_iri varchar, inout triples any)\n"
+"{\n"
+"declare ctr integer;\n"
+"for (ctr := length (triples) - 1; ctr >= 0; ctr := ctr - 1)\n"
+"{\n"
+"declare s_iri, p_iri, o_val, o_type, o_lang any;\n"
+"s_iri := iri_canonicalize (triples[ctr][0]);\n"
+"p_iri := iri_canonicalize (triples[ctr][1]);\n"
+"o_val := triples[ctr][2];\n"
+"if (isiri_id (o_val))\n"
+"__rdf_repl_quad (84, graph_iri, s_iri, p_iri, iri_canonicalize (o_val));\n"
+"else if (__tag of rdf_box <> __tag (o_val))\n"
+"__rdf_repl_quad (80, graph_iri, s_iri, p_iri, o_val);\n"
+"else\n"
+"{\n"
+"declare dt_twobyte, lang_twobyte integer;\n"
+"dt_twobyte := rdf_box_type (o_val);\n"
+"lang_twobyte := rdf_box_lang (o_val);\n"
+"if (257 <> dt_twobyte)\n"
+"__rdf_repl_quad (81, graph_iri, s_iri, p_iri, rdf_box_data (o_val), (select RDT_QNAME from DB.DBA.RDF_DATATYPE where RDT_TWOBYTE = dt_twobyte), NULL);\n"
+"else if (257 <> lang_twobyte)\n"
+"__rdf_repl_quad (82, graph_iri, s_iri, p_iri, rdf_box_data (o_val), NULL, (select RL_ID from DB.DBA.RDF_LANGUAGE where RL_TWOBYTE = lang_twobyte));\n"
+"else\n"
+"__rdf_repl_quad (80, graph_iri, s_iri, p_iri, rdf_box_data (o_val));\n"
+"}\n"
+"}\n"
+"}\n"
+"--src sparql.sql:493\n";
+
+static const char *proc19 = 
+"#line 524 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_REPL_DELETE_TRIPLES (in graph_iri varchar, inout triples any)\n"
+"{\n"
+"declare ctr integer;\n"
+"for (ctr := length (triples) - 1; ctr >= 0; ctr := ctr - 1)\n"
+"{\n"
+"declare s_iri, p_iri, o_val, o_type, o_lang any;\n"
+"s_iri := iri_canonicalize (triples[ctr][0]);\n"
+"p_iri := iri_canonicalize (triples[ctr][1]);\n"
+"o_val := triples[ctr][2];\n"
+"if (isiri_id (o_val))\n"
+"__rdf_repl_quad (164, graph_iri, s_iri, p_iri, iri_canonicalize (o_val));\n"
+"else if (__tag of rdf_box <> __tag (o_val))\n"
+"__rdf_repl_quad (160, graph_iri, s_iri, p_iri, o_val);\n"
+"else\n"
+"{\n"
+"declare dt_twobyte, lang_twobyte integer;\n"
+"dt_twobyte := rdf_box_type (o_val);\n"
+"lang_twobyte := rdf_box_lang (o_val);\n"
+"if (257 <> dt_twobyte)\n"
+"__rdf_repl_quad (161, graph_iri, s_iri, p_iri, rdf_box_data (o_val), (select RDT_QNAME from DB.DBA.RDF_DATATYPE where RDT_TWOBYTE = dt_twobyte), NULL);\n"
+"else if (257 <> lang_twobyte)\n"
+"__rdf_repl_quad (162, graph_iri, s_iri, p_iri, rdf_box_data (o_val), NULL, (select RL_ID from DB.DBA.RDF_LANGUAGE where RL_TWOBYTE = lang_twobyte));\n"
+"else\n"
+"__rdf_repl_quad (160, graph_iri, s_iri, p_iri, rdf_box_data (o_val));\n"
+"}\n"
+"}\n"
+"}\n"
+"--src sparql.sql:522\n";
+
+
+static const char *proc20 = 
+"#line 554 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_GLOBAL_RESET (in hard integer := 0)\n"
 "{\n"
+"if (isstring (registry_get (\'DB.DBA.RDF_REPL\')))\n"
+"{\n"
+"signal (\'42RDF\', \'Can not make DB.DBA.RDF_GLOBAL_RESET while an RDF replication is enabled\');\n"
+"}\n"
 "\n"
 "__atomic (1);\n"
 "iri_id_cache_flush ();\n"
@@ -429,6 +622,13 @@ static const char *proc13 =
 "virtrdf:qsMatchingFlags virtrdf:SPART_QS_NO_IMPLICIT_USER_QM .\n"
 "virtrdf:DefaultServiceStorage-UserMaps\n"
 "rdf:type virtrdf:array-of-QuadMap .\n"
+"\n"
+"virtrdf:SyncToQuads\n"
+"rdf:type virtrdf:QuadStorage ;\n"
+"virtrdf:qsUserMaps virtrdf:SyncToQuads-UserMaps .\n"
+"virtrdf:SyncToQuads-UserMaps\n"
+"rdf:type virtrdf:array-of-QuadMap .\n"
+"\n"
 "\', \'\', \'http://www.openlinksw.com/schemas/virtrdf#\' );\n"
 "delete from SYS_HTTP_SPONGE where HS_PARSER = \'DB.DBA.RDF_LOAD_HTTP_RESPONSE\';\n"
 "commit work;\n"
@@ -442,16 +642,18 @@ static const char *proc13 =
 "__atomic (0);\n"
 "exec (\'checkpoint\');\n"
 "}\n"
-"--src sparql.sql:391\n";
+"--src sparql.sql:552\n";
 
-static const char *proc14 = 
+static const char *proc21 = 
+"#line 666 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_IID_OF_QNAME (in qname varchar) returns IRI_ID\n"
 "{\n"
 "return iri_to_id (qname);\n"
 "}\n"
-"--src sparql.sql:492\n";
+"--src sparql.sql:664\n";
 
-static const char *proc15 = 
+static const char *proc22 = 
+"#line 673 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_IID_OF_LONG (in qname any) returns IRI_ID\n"
 "{\n"
 "if (isiri_id (qname))\n"
@@ -465,9 +667,10 @@ static const char *proc15 =
 "}\n"
 "return iri_to_id_nosignal (qname);\n"
 "}\n"
-"--src sparql.sql:499\n";
+"--src sparql.sql:671\n";
 
-static const char *proc16 = 
+static const char *proc23 = 
+"#line 688 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_GRAPH_IIDS_OF_QNAMES (in qnames any) returns any\n"
 "{\n"
 "if (__tag of vector <> __tag (qnames))\n"
@@ -486,10 +689,11 @@ static const char *proc16 =
 "vectorbld_final (res_acc);\n"
 "return res_acc;\n"
 "}\n"
-"--src sparql.sql:514\n";
+"--src sparql.sql:686\n";
 
-static const char *proc17 = 
-"create function DB.DBA.RDF_TWOBYTE_OF_DATATYPE (in iid IRI_ID) returns integer\n"
+static const char *proc24 = 
+"#line 711 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.RDF_TWOBYTE_OF_DATATYPE (in iid any) returns integer\n"
 "{\n"
 "declare res integer;\n"
 "declare qname varchar;\n"
@@ -545,9 +749,10 @@ static const char *proc17 =
 "log_text (\'rdf_cache_id (\\\'t\\\', ?, ?)\', qname, res);\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:537\n";
+"--src sparql.sql:709\n";
 
-static const char *proc18 = 
+static const char *proc25 = 
+"#line 769 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_TWOBYTE_OF_LANGUAGE (in id varchar) returns integer\n"
 "{\n"
 "declare res integer;\n"
@@ -590,30 +795,34 @@ static const char *proc18 =
 "log_text (\'rdf_cache_id (\\\'l\\\', ?, ?)\', id, res);\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:595\n";
+"--src sparql.sql:767\n";
 
-static const char *proc19 = 
+static const char *proc26 = 
+"#line 816 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RQ_LONG_OF_O (in o_col any) returns any\n"
 "{\n"
 "return __rdf_long_of_obj (o_col);\n"
 "}\n"
-"--src sparql.sql:642\n";
+"--src sparql.sql:814\n";
 
-static const char *proc20 = 
+static const char *proc27 = 
+"#line 822 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_BOX_COMPLETE (inout o_col any)\n"
 "{\n"
 "__rdf_box_make_complete (o_col);\n"
 "}\n"
-"--src sparql.sql:648\n";
+"--src sparql.sql:820\n";
 
-static const char *proc21 = 
+static const char *proc28 = 
+"#line 828 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RQ_SQLVAL_OF_O (in o_col any) returns any\n"
 "{\n"
 "return __rdf_sqlval_of_obj (o_col);\n"
 "}\n"
-"--src sparql.sql:654\n";
+"--src sparql.sql:826\n";
 
-static const char *proc22 = 
+static const char *proc29 = 
+"#line 834 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RQ_BOOL_OF_O (in o_col any) returns any\n"
 "{\n"
 "declare t, len integer;\n"
@@ -655,32 +864,36 @@ static const char *proc22 =
 "retnull:\n"
 "return null;\n"
 "}\n"
-"--src sparql.sql:660\n";
+"--src sparql.sql:832\n";
 
-static const char *proc23 = 
+static const char *proc30 = 
+"#line 877 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RQ_IID_OF_O (in shortobj any) returns IRI_ID\n"
 "{\n"
 "return id_to_iri_nosignal (shortobj);\n"
 "}\n"
-"--src sparql.sql:703\n";
+"--src sparql.sql:875\n";
 
-static const char *proc24 = 
+static const char *proc31 = 
+"#line 883 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RQ_O_IS_LIT (in shortobj any) returns integer\n"
 "{\n"
 "if (isiri_id (shortobj))\n"
 "return 0;\n"
 "return 1;\n"
 "}\n"
-"--src sparql.sql:709\n";
+"--src sparql.sql:881\n";
 
-static const char *proc25 = 
+static const char *proc32 = 
+"#line 896 \"[executable]/sparql.sql\"\n"
 "create procedure RDF_G_INS (in id int, in g any)\n"
 "{\n"
 "geo_insert (\'DB.DBA.RDF_GEO\', g, id);\n"
 "}\n"
-"--src sparql.sql:722\n";
+"--src sparql.sql:894\n";
 
-static const char *proc26 = 
+static const char *proc33 = 
+"#line 902 \"[executable]/sparql.sql\"\n"
 "create procedure cl_rdf_geo_insert (in id int, inout g any)\n"
 "{\n"
 "declare daq any;\n"
@@ -688,9 +901,10 @@ static const char *proc26 =
 "daq_call (daq, \'DB.DBA.RDF_OBJ\', \'RDF_OBJ\', \'DB.DBA.RDF_G_INS\', vector (id, g), 1);\n"
 "daq_results (daq);\n"
 "}\n"
-"--src sparql.sql:728\n";
+"--src sparql.sql:900\n";
 
-static const char *proc27 = 
+static const char *proc34 = 
+"#line 911 \"[executable]/sparql.sql\"\n"
 "create function rdf_geo_add (in v any)\n"
 "{\n"
 "declare id, h, ser, g any;\n"
@@ -732,9 +946,40 @@ static const char *proc27 =
 "rdf_box_set_ro_id (v, id);\n"
 "return v;\n"
 "}\n"
-"--src sparql.sql:737\n";
+"--src sparql.sql:909\n";
 
-static const char *proc28 = 
+static const char *proc35 = 
+"#line 954 \"[executable]/sparql.sql\"\n"
+"create function rdf_geo_set_id (inout v any)\n"
+"{\n"
+"declare id, h, ser, g any;\n"
+"if (rdf_box_ro_id (v))\n"
+"return v;\n"
+"g := rdf_box_data (v);\n"
+"if (not isgeometry (g))\n"
+"signal (\'22023\', \'RDFXX\', \'Must be geometry box if to be stored as geo object\');\n"
+"ser := serialize (g);\n"
+"if (length (ser) > 50)\n"
+"h := mdigest5 (ser);\n"
+"else\n"
+"{\n"
+"h := ser;\n"
+"ser := null;\n"
+"}\n"
+"set isolation = \'committed\';\n"
+"id := (select RO_ID from RDF_OBJ where RO_VAL = h and RO_DT_AND_LANG = 0hex1000101\n"
+"and case when RO_LONG is not null then eq (blob_to_string (RO_LONG),  ser) else 1 end );\n"
+"if (id is not null)\n"
+"{\n"
+"rdf_box_set_ro_id (v, id);\n"
+"return v;\n"
+"}\n"
+"return null;\n"
+"}\n"
+"--src sparql.sql:952\n";
+
+static const char *proc36 = 
+"#line 981 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_OBJ_ADD (in dt_twobyte integeR, in v varchar, in lang_twobyte integeR, in ro_id_dict any := null) returns varchar\n"
 "{\n"
 "declare llong, id, need_digest integer;\n"
@@ -989,9 +1234,10 @@ static const char *proc28 =
 "\n"
 "signal (\'FUNNY\', \'Debug code of DB.DBA.RDF_OBJ_ADD() is reached. This can not happen (I believe). Please report this error.\');\n"
 "}\n"
-"--src sparql.sql:780\n";
+"--src sparql.sql:979\n";
 
-static const char *proc29 = 
+static const char *proc37 = 
+"#line 1237 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_FIND_RO_DIGEST (in dt_twobyte integeR, in v varchar, in lang_twobyte integeR) returns varchar\n"
 "{\n"
 "declare llong, dt_and_lang int;\n"
@@ -1035,9 +1281,10 @@ static const char *proc29 =
 "and not (bit_and (RO_FLAGS, 2)) );\n"
 "}\n"
 "}\n"
-"--src sparql.sql:1036\n";
+"--src sparql.sql:1235\n";
 
-static const char *proc30 = 
+static const char *proc38 = 
+"#line 1282 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL (in v any) returns any\n"
 "{\n"
 "declare t int;\n"
@@ -1050,9 +1297,10 @@ static const char *proc30 =
 "v := cast (v as varchar);\n"
 "return DB.DBA.RDF_OBJ_ADD (257, v, 257);\n"
 "}\n"
-"--src sparql.sql:1081\n";
+"--src sparql.sql:1280\n";
 
-static const char *proc31 = 
+static const char *proc39 = 
+"#line 1296 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL_FT (in v any, in g_iid IRI_ID, in p_iid IRI_ID, in ro_id_dict any := null) returns any\n"
 "{\n"
 "declare t int;\n"
@@ -1078,9 +1326,10 @@ static const char *proc31 =
 "}\n"
 "return DB.DBA.RDF_OBJ_ADD (257, v, 257, ro_id_dict);\n"
 "}\n"
-"--src sparql.sql:1095\n";
+"--src sparql.sql:1294\n";
 
-static const char *proc32 = 
+static const char *proc40 = 
+"#line 1323 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL (in v any, in dt_iid IRI_ID, in lang varchar) returns any\n"
 "{\n"
 "declare t, dt_twobyte, lang_twobyte int;\n"
@@ -1110,9 +1359,10 @@ static const char *proc32 =
 "lang_twobyte := 257;\n"
 "return DB.DBA.RDF_OBJ_ADD (dt_twobyte, v, lang_twobyte);\n"
 "}\n"
-"--src sparql.sql:1122\n";
+"--src sparql.sql:1321\n";
 
-static const char *proc33 = 
+static const char *proc41 = 
+"#line 1354 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL_FT (in v any, in dt_iid IRI_ID, in lang varchar, in g_iid IRI_ID, in p_iid IRI_ID, in ro_id_dict any := null) returns any\n"
 "{\n"
 "declare t, dt_twobyte, lang_twobyte int;\n"
@@ -1156,9 +1406,10 @@ static const char *proc33 =
 "}\n"
 "return DB.DBA.RDF_OBJ_ADD (dt_twobyte, v, lang_twobyte, ro_id_dict);\n"
 "}\n"
-"--src sparql.sql:1153\n";
+"--src sparql.sql:1352\n";
 
-static const char *proc34 = 
+static const char *proc42 = 
+"#line 1399 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL_STRINGS (\n"
 "in o_val any, in o_type varchar, in o_lang varchar ) returns any\n"
 "{\n"
@@ -1196,16 +1447,18 @@ static const char *proc34 =
 "}\n"
 "return DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL (o_val);\n"
 "}\n"
-"--src sparql.sql:1198\n";
+"--src sparql.sql:1397\n";
 
-static const char *proc35 = 
+static const char *proc43 = 
+"#line 1438 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_LONG_OF_OBJ (in shortobj any) returns any\n"
 "{\n"
 "return __rdf_long_of_obj (shortobj);\n"
 "}\n"
-"--src sparql.sql:1237\n";
+"--src sparql.sql:1436\n";
 
-static const char *proc36 = 
+static const char *proc44 = 
+"#line 1444 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_DATATYPE_OF_OBJ (in shortobj any, in dflt varchar := \'http://www.w3.org/2001/XMLSchema#string\') returns any\n"
 "{\n"
 "declare twobyte integer;\n"
@@ -1214,6 +1467,8 @@ static const char *proc36 =
 "{\n"
 "if (isiri_id (shortobj))\n"
 "return null;\n"
+"if (isstring (shortobj) and bit_and (__box_flags (shortobj), 1))\n"
+"return null;\n"
 "return iri_to_id (__xsd_type (shortobj, dflt));\n"
 "}\n"
 "twobyte := rdf_box_type (shortobj);\n"
@@ -1227,15 +1482,22 @@ static const char *proc36 =
 "signal (\'RDFXX\', sprintf (\'Unknown datatype in DB.DBA.RQ_DATATYPE_OF_OBJ, bad type id %d, string value \"%s\"\',\n"
 "twobyte, cast (rdf_box_data (shortobj) as varchar) ) );\n"
 "}\n"
-"--src sparql.sql:1243\n";
+"--src sparql.sql:1442\n";
 
-static const char *proc37 = 
+static const char *proc45 = 
+"#line 1469 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_LANGUAGE_OF_OBJ (in shortobj any, in dflt varchar := \'\') returns any\n"
 "{\n"
 "declare twobyte integer;\n"
 "declare res varchar;\n"
 "if (__tag of rdf_box <> __tag (shortobj))\n"
-"return case (isiri_id (shortobj)) when 0 then dflt else null end;\n"
+"{\n"
+"if (isiri_id (shortobj))\n"
+"return null;\n"
+"if (isstring (shortobj) and bit_and (__box_flags (shortobj), 1))\n"
+"return null;\n"
+"return dflt;\n"
+"}\n"
 "twobyte := rdf_box_lang (shortobj);\n"
 "if (257 = twobyte)\n"
 "return dflt;\n"
@@ -1246,16 +1508,18 @@ static const char *proc37 =
 "badtype:\n"
 "signal (\'RDFXX\', sprintf (\'Unknown language in DB.DBA.RDF_LANGUAGE_OF_OBJ, bad string \"%s\"\', shortobj));\n"
 "}\n"
-"--src sparql.sql:1266\n";
+"--src sparql.sql:1467\n";
 
-static const char *proc38 = 
+static const char *proc46 = 
+"#line 1493 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_SQLVAL_OF_OBJ (in shortobj any) returns any\n"
 "{\n"
 "return __rdf_sqlval_of_obj (shortobj);\n"
 "}\n"
-"--src sparql.sql:1284\n";
+"--src sparql.sql:1491\n";
 
-static const char *proc39 = 
+static const char *proc47 = 
+"#line 1499 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_BOOL_OF_OBJ (in shortobj any) returns any\n"
 "{\n"
 "if (isiri_id (shortobj))\n"
@@ -1289,23 +1553,26 @@ static const char *proc39 =
 "signal (\'RDFXX\', sprintf (\'Unknown datatype in DB.DBA.RDF_BOOL_OF_OBJ, bad type id %d, string value \"%s\"\',\n"
 "twobyte, cast (rdf_box_data (shortobj) as varchar) ) );\n"
 "}\n"
-"--src sparql.sql:1290\n";
+"--src sparql.sql:1497\n";
 
-static const char *proc40 = 
+static const char *proc48 = 
+"#line 1534 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QNAME_OF_OBJ (in shortobj any) returns varchar\n"
 "{\n"
 "return id_to_iri_nosignal (shortobj);\n"
 "}\n"
-"--src sparql.sql:1325\n";
+"--src sparql.sql:1532\n";
 
-static const char *proc41 = 
+static const char *proc49 = 
+"#line 1540 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_STRSQLVAL_OF_OBJ (in shortobj any)\n"
 "{\n"
 "return __rdf_strsqlval (shortobj, 0);\n"
 "}\n"
-"--src sparql.sql:1331\n";
+"--src sparql.sql:1538\n";
 
-static const char *proc42 = 
+static const char *proc50 = 
+"#line 1546 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_OBJ_OF_LONG (in longobj any) returns any\n"
 "{\n"
 "declare t int;\n"
@@ -1326,9 +1593,34 @@ static const char *proc42 =
 "return longobj;\n"
 "return DB.DBA.RDF_OBJ_ADD (257, longobj, 257);\n"
 "}\n"
-"--src sparql.sql:1337\n";
+"--src sparql.sql:1544\n";
 
-static const char *proc43 = 
+static const char *proc51 = 
+"#line 1568 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.RDF_OBJ_OF_LONG (in longobj any, in g_iid IRI_ID, inout old_g_iid IRI_ID, in ro_id_dict any := null) returns any\n"
+"{\n"
+"declare t int;\n"
+"t := __tag (longobj);\n"
+"if (__tag of rdf_box <> t)\n"
+"{\n"
+"if (not (t in (__tag of varchar, 126, 217, __tag of nvarchar)))\n"
+"return longobj;\n"
+"if (__tag of nvarchar = t)\n"
+"longobj := charset_recode (longobj, \'_WIDE_\', \'UTF-8\');\n"
+"else if (t in (126, 217))\n"
+"longobj := cast (longobj as varchar);\n"
+"else if (bit_and (1, __box_flags (longobj)))\n"
+"return iri_to_id (longobj);\n"
+"return DB.DBA.RDF_OBJ_ADD (257, longobj, 257);\n"
+"}\n"
+"if (0 = rdf_box_needs_digest (longobj))\n"
+"return longobj;\n"
+"return DB.DBA.RDF_OBJ_ADD (257, longobj, 257);\n"
+"}\n"
+"--src sparql.sql:1566\n";
+
+static const char *proc52 = 
+"#line 1590 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_OBJ_OF_SQLVAL (in v any) returns any\n"
 "{\n"
 "declare t int;\n"
@@ -1347,9 +1639,10 @@ static const char *proc43 =
 "return iri_to_id (v);\n"
 "return DB.DBA.RDF_OBJ_ADD (257, v, 257);\n"
 "}\n"
-"--src sparql.sql:1359\n";
+"--src sparql.sql:1588\n";
 
-static const char *proc44 = 
+static const char *proc53 = 
+"#line 1613 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_LONG_OF_SQLVAL (in v any) returns any\n"
 "{\n"
 "declare t int;\n"
@@ -1366,9 +1659,10 @@ static const char *proc44 =
 "res := rdf_box (v, 257, 257, 0, 1);\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:1382\n";
+"--src sparql.sql:1611\n";
 
-static const char *proc45 = 
+static const char *proc54 = 
+"#line 1632 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL (in v any, in dt_iid IRI_ID, in lang varchar) returns any\n"
 "{\n"
 "declare t, dt_twobyte, lang_twobyte int;\n"
@@ -1403,9 +1697,10 @@ static const char *proc45 =
 "res := rdf_box (v, dt_twobyte, lang_twobyte, 0, 1);\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:1401\n";
+"--src sparql.sql:1630\n";
 
-static const char *proc46 = 
+static const char *proc55 = 
+"#line 1668 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL_STRINGS (\n"
 "in o_val any, in o_type varchar, in o_lang varchar ) returns any\n"
 "{\n"
@@ -1423,29 +1718,32 @@ static const char *proc46 =
 "return DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL (\n"
 "o_val,\n"
 "iri_to_id (o_type),\n"
-"o_lang );\n"
+"null );\n"
 "}\n"
 "if (__tag (o_lang) in (__tag of varchar, 217))\n"
 "return DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL (o_val, NULL, o_lang);\n"
 "return DB.DBA.RDF_MAKE_LONG_OF_SQLVAL (o_val);\n"
 "}\n"
-"--src sparql.sql:1437\n";
+"--src sparql.sql:1666\n";
 
-static const char *proc47 = 
+static const char *proc56 = 
+"#line 1693 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QNAME_OF_LONG_SAFE (in longobj any) returns varchar\n"
 "{\n"
 "return id_to_iri_nosignal (longobj);\n"
 "}\n"
-"--src sparql.sql:1462\n";
+"--src sparql.sql:1691\n";
 
-static const char *proc48 = 
+static const char *proc57 = 
+"#line 1699 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_SQLVAL_OF_LONG (in longobj any) returns any\n"
 "{\n"
 "return __rdf_sqlval_of_obj (longobj);\n"
 "}\n"
-"--src sparql.sql:1468\n";
+"--src sparql.sql:1697\n";
 
-static const char *proc49 = 
+static const char *proc58 = 
+"#line 1705 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_BOOL_OF_LONG (in longobj any) returns any\n"
 "{\n"
 "if (isiri_id (longobj))\n"
@@ -1476,15 +1774,16 @@ static const char *proc49 =
 "badtype:\n"
 "signal (\'RDFXX\', sprintf (\'Unknown datatype in DB.DBA.RDF_BOOL_OF_LONG (code %d)\', rdf_box_type(longobj)));\n"
 "}\n"
-"--src sparql.sql:1474\n";
+"--src sparql.sql:1703\n";
 
-static const char *proc50 = 
+static const char *proc59 = 
+"#line 1737 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_DATATYPE_OF_LONG (in longobj any, in dflt any := UNAME\'http://www.w3.org/2001/XMLSchema#string\') returns any\n"
 "{\n"
 "if (__tag of rdf_box = __tag (longobj))\n"
 "{\n"
 "declare twobyte integer;\n"
-"declare res varchar;\n"
+"declare res IRI_ID;\n"
 "twobyte := rdf_box_type (longobj);\n"
 "if (257 = twobyte)\n"
 "return case (rdf_box_lang (longobj)) when 257 then iri_to_id (dflt) else null end;\n"
@@ -1499,9 +1798,10 @@ static const char *proc50 =
 "return NULL;\n"
 "return iri_to_id (__xsd_type (longobj, dflt));\n"
 "}\n"
-"--src sparql.sql:1506\n";
+"--src sparql.sql:1735\n";
 
-static const char *proc51 = 
+static const char *proc60 = 
+"#line 1759 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_DATATYPE_IRI_OF_LONG (in longobj any, in dflt any := UNAME\'http://www.w3.org/2001/XMLSchema#string\') returns any\n"
 "{\n"
 "if (__tag of rdf_box = __tag (longobj))\n"
@@ -1522,9 +1822,10 @@ static const char *proc51 =
 "return NULL;\n"
 "return __xsd_type (longobj, dflt);\n"
 "}\n"
-"--src sparql.sql:1528\n";
+"--src sparql.sql:1757\n";
 
-static const char *proc52 = 
+static const char *proc61 = 
+"#line 1781 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_LANGUAGE_OF_LONG (in longobj any, in dflt varchar := \'\') returns any\n"
 "{\n"
 "if (__tag of rdf_box = __tag (longobj))\n"
@@ -1543,16 +1844,18 @@ static const char *proc52 =
 "}\n"
 "return case (isiri_id (longobj)) when 0 then dflt else null end;\n"
 "}\n"
-"--src sparql.sql:1550\n";
+"--src sparql.sql:1779\n";
 
-static const char *proc53 = 
+static const char *proc62 = 
+"#line 1801 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_STRSQLVAL_OF_LONG (in longobj any)\n"
 "{\n"
 "return __rdf_strsqlval (longobj, 0);\n"
 "}\n"
-"--src sparql.sql:1570\n";
+"--src sparql.sql:1799\n";
 
-static const char *proc54 = 
+static const char *proc63 = 
+"#line 1807 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_WIDESTRSQLVAL_OF_LONG (in longobj any)\n"
 "{\n"
 "declare t, len integer;\n"
@@ -1613,9 +1916,10 @@ static const char *proc54 =
 "}\n"
 "return cast (longobj as nvarchar);\n"
 "}\n"
-"--src sparql.sql:1576\n";
+"--src sparql.sql:1805\n";
 
-static const char *proc55 = 
+static const char *proc64 = 
+"#line 1870 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_DATATYPE_OF_SQLVAL (in v any,\n"
 "in strg_datatype any := UNAME\'http://www.w3.org/2001/XMLSchema#string\',\n"
 "in default_res any := NULL) returns any\n"
@@ -1623,7 +1927,7 @@ static const char *proc55 =
 "if (__tag of rdf_box = __tag (v))\n"
 "{\n"
 "declare twobyte integer;\n"
-"declare res varchar;\n"
+"declare res IRI_ID;\n"
 "twobyte := rdf_box_type (v);\n"
 "if (257 = twobyte)\n"
 "return case (rdf_box_lang (v)) when 257 then iri_to_id (strg_datatype) else null end;\n"
@@ -1636,9 +1940,10 @@ static const char *proc55 =
 "}\n"
 "return iri_to_id (__xsd_type (v, strg_datatype, default_res));\n"
 "}\n"
-"--src sparql.sql:1639\n";
+"--src sparql.sql:1868\n";
 
-static const char *proc56 = 
+static const char *proc65 = 
+"#line 1893 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_LONG_OF_SQLVAL (in v varchar) returns any\n"
 "{\n"
 "declare t int;\n"
@@ -1651,11 +1956,17 @@ static const char *proc56 =
 "v := cast (v as varchar);\n"
 "else if ((t = __tag of varchar) and (1 = __box_flags (v)))\n"
 "return iri_to_id (v);\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
 "return rdf_box (v, 257, 257, 0, 1);\n"
 "}\n"
-"--src sparql.sql:1661\n";
+"--src sparql.sql:1891\n";
 
-static const char *proc57 = 
+static const char *proc66 = 
+"#line 1918 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_STRSQLVAL_OF_SQLVAL (in sqlval any)\n"
 "{\n"
 "declare t, len integer;\n"
@@ -1681,9 +1992,10 @@ static const char *proc57 =
 "return charset_recode (sqlval, \'_WIDE_\', \'UTF-8\');\n"
 "return cast (sqlval as varchar);\n"
 "}\n"
-"--src sparql.sql:1681\n";
+"--src sparql.sql:1916\n";
 
-static const char *proc58 = 
+static const char *proc67 = 
+"#line 1946 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_LANGUAGE_OF_SQLVAL (in v any, in dflt varchar := \'\') returns any\n"
 "{\n"
 "declare t int;\n"
@@ -1705,9 +2017,10 @@ static const char *proc58 =
 "\n"
 "\n"
 "}\n"
-"--src sparql.sql:1709\n";
+"--src sparql.sql:1944\n";
 
-static const char *proc59 = 
+static const char *proc68 = 
+"#line 1970 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_IS_BLANK_REF (in v any) returns any\n"
 "{\n"
 "if ((__tag (v) = 217) or ((__tag (v) = __tag of varchar) and bit_and (1, __box_flags (v))))\n"
@@ -1718,15 +2031,16 @@ static const char *proc59 =
 "}\n"
 "if (__tag (v) = 243)\n"
 "{\n"
-"if (v < min_bnode_iri_id)\n"
+"if (v < min_bnode_iri_id ())\n"
 "return 0;\n"
 "return 1;\n"
 "}\n"
 "return 0;\n"
 "}\n"
-"--src sparql.sql:1733\n";
+"--src sparql.sql:1968\n";
 
-static const char *proc60 = 
+static const char *proc69 = 
+"#line 1989 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_IS_URI_REF (in v any) returns any\n"
 "{\n"
 "if ((__tag (v) = 217) or ((__tag (v) = __tag of varchar) and bit_and (1, __box_flags (v))))\n"
@@ -1737,15 +2051,16 @@ static const char *proc60 =
 "}\n"
 "if (__tag (v) = 243)\n"
 "{\n"
-"if (v < min_bnode_iri_id)\n"
+"if (v < min_bnode_iri_id ())\n"
 "return 1;\n"
 "return 0;\n"
 "}\n"
 "return 0;\n"
 "}\n"
-"--src sparql.sql:1752\n";
+"--src sparql.sql:1987\n";
 
-static const char *proc61 = 
+static const char *proc70 = 
+"#line 2008 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_IS_REF (in v any) returns any\n"
 "{\n"
 "if (__tag (v) in (217, 243))\n"
@@ -1754,9 +2069,10 @@ static const char *proc61 =
 "return 1;\n"
 "return 0;\n"
 "}\n"
-"--src sparql.sql:1771\n";
+"--src sparql.sql:2006\n";
 
-static const char *proc62 = 
+static const char *proc71 = 
+"#line 2019 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_IS_LITERAL (in v any) returns any\n"
 "{\n"
 "if (__tag (v) in (217, 243))\n"
@@ -1765,9 +2081,10 @@ static const char *proc62 =
 "return 0;\n"
 "return 1;\n"
 "}\n"
-"--src sparql.sql:1782\n";
+"--src sparql.sql:2017\n";
 
-static const char *proc63 = 
+static const char *proc72 = 
+"#line 2033 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.\"http://www.w3.org/2001/XMLSchema#boolean\" (in strg any) returns integer\n"
 "{\n"
 "if (isstring (strg))\n"
@@ -1781,9 +2098,10 @@ static const char *proc63 =
 "return case (strg) when 0 then 0 else 1 end;\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:1796\n";
+"--src sparql.sql:2031\n";
 
-static const char *proc64 = 
+static const char *proc73 = 
+"#line 2049 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.\"http://www.w3.org/2001/XMLSchema#date\" (in strg any) returns date\n"
 "{\n"
 "if (__tag of datetime = __tag (strg))\n"
@@ -1795,9 +2113,10 @@ static const char *proc64 =
 "ret_null:\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:1812\n";
+"--src sparql.sql:2047\n";
 
-static const char *proc65 = 
+static const char *proc74 = 
+"#line 2063 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.\"http://www.w3.org/2001/XMLSchema#dateTime\" (in strg any) returns datetime\n"
 "{\n"
 "if (__tag of datetime = __tag (strg))\n"
@@ -1809,9 +2128,10 @@ static const char *proc65 =
 "ret_null:\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:1826\n";
+"--src sparql.sql:2061\n";
 
-static const char *proc66 = 
+static const char *proc75 = 
+"#line 2077 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.\"http://www.w3.org/2001/XMLSchema#double\" (in strg varchar) returns double precision\n"
 "{\n"
 "whenever sqlstate \'*\' goto ret_null;\n"
@@ -1819,9 +2139,10 @@ static const char *proc66 =
 "ret_null:\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:1840\n";
+"--src sparql.sql:2075\n";
 
-static const char *proc67 = 
+static const char *proc76 = 
+"#line 2087 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.\"http://www.w3.org/2001/XMLSchema#float\" (in strg varchar) returns float\n"
 "{\n"
 "whenever sqlstate \'*\' goto ret_null;\n"
@@ -1829,9 +2150,10 @@ static const char *proc67 =
 "ret_null:\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:1850\n";
+"--src sparql.sql:2085\n";
 
-static const char *proc68 = 
+static const char *proc77 = 
+"#line 2097 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.\"http://www.w3.org/2001/XMLSchema#integer\" (in strg varchar) returns integer\n"
 "{\n"
 "whenever sqlstate \'*\' goto ret_null;\n"
@@ -1839,9 +2161,10 @@ static const char *proc68 =
 "ret_null:\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:1860\n";
+"--src sparql.sql:2095\n";
 
-static const char *proc69 = 
+static const char *proc78 = 
+"#line 2107 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.\"http://www.w3.org/2001/XMLSchema#int\" (in strg varchar) returns integer\n"
 "{\n"
 "whenever sqlstate \'*\' goto ret_null;\n"
@@ -1849,9 +2172,10 @@ static const char *proc69 =
 "ret_null:\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:1870\n";
+"--src sparql.sql:2105\n";
 
-static const char *proc70 = 
+static const char *proc79 = 
+"#line 2117 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.\"http://www.w3.org/2001/XMLSchema#time\" (in strg any) returns time\n"
 "{\n"
 "if (__tag of datetime = __tag (strg))\n"
@@ -1863,9 +2187,10 @@ static const char *proc70 =
 "ret_null:\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:1880\n";
+"--src sparql.sql:2115\n";
 
-static const char *proc71 = 
+static const char *proc80 = 
+"#line 2131 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.\"http://www.w3.org/2001/XMLSchema#string\" (in strg any) returns any\n"
 "{\n"
 "whenever sqlstate \'*\' goto ret_null;\n"
@@ -1882,126 +2207,194 @@ static const char *proc71 =
 "ret_null:\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:1894\n";
+"--src sparql.sql:2129\n";
 
-static const char *proc72 = 
+static const char *proc81 = 
+"#line 2153 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.__and (in e1 any, in e2 any) returns integer\n"
 "{\n"
 "if (e1 and e2)\n"
 "return 1;\n"
 "return 0;\n"
 "}\n"
-"--src sparql.sql:1916\n";
+"--src sparql.sql:2151\n";
 
-static const char *proc73 = 
+static const char *proc82 = 
+"#line 2162 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.__or (in e1 any, in e2 any) returns integer\n"
 "{\n"
 "if (e1 or e2)\n"
 "return 1;\n"
 "return 0;\n"
 "}\n"
-"--src sparql.sql:1925\n";
+"--src sparql.sql:2160\n";
 
-static const char *proc74 = 
+static const char *proc83 = 
+"#line 2171 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.__not (in e1 any) returns integer\n"
 "{\n"
 "if (e1)\n"
 "return 0;\n"
 "return 1;\n"
 "}\n"
-"--src sparql.sql:1934\n";
+"--src sparql.sql:2169\n";
 
-static const char *proc75 = 
+static const char *proc84 = 
+"#line 2183 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QUAD_URI (in g_uri varchar, in s_uri varchar, in p_uri varchar, in o_uri varchar)\n"
 "{\n"
+"declare g_iid IRI_ID;\n"
+"g_iid := iri_to_id (g_uri);\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
+"__rdf_repl_quad (84, iri_canonicalize (g_uri), iri_canonicalize (s_uri), iri_canonicalize (p_uri), iri_canonicalize (o_uri));\n"
 "insert soft DB.DBA.RDF_QUAD (G,S,P,O)\n"
 "values (\n"
-"iri_to_id (g_uri),\n"
+"g_iid,\n"
 "iri_to_id (s_uri),\n"
 "iri_to_id (p_uri),\n"
 "iri_to_id (o_uri) );\n"
 "}\n"
-"--src sparql.sql:1946\n";
+"--src sparql.sql:2181\n";
 
-static const char *proc76 = 
+static const char *proc85 = 
+"#line 2198 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QUAD_URI_L (in g_uri varchar, in s_uri varchar, in p_uri varchar, in o_lit any, in ro_id_dict any := null)\n"
 "{\n"
-"declare g_iid, p_iid IRI_ID;\n"
+"declare g_iid, s_iid, p_iid IRI_ID;\n"
+"declare o_obj any;\n"
 "g_iid := iri_to_id (g_uri);\n"
+"s_iid := iri_to_id (s_uri);\n"
 "p_iid := iri_to_id (p_uri);\n"
-"insert soft DB.DBA.RDF_QUAD (G,S,P,O)\n"
-"values (\n"
-"g_iid,\n"
-"iri_to_id (s_uri),\n"
-"p_iid,\n"
-"DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL_FT (o_lit, g_iid, p_iid, ro_id_dict) );\n"
+"o_obj := DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL_FT (o_lit, g_iid, p_iid, ro_id_dict);\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
+"{\n"
+"declare triples any;\n"
+"triples := vector (vector (s_iid, p_iid, o_obj));\n"
+"DB.DBA.RDF_REPL_INSERT_TRIPLES (id_to_iri (g_iid), triples);\n"
 "}\n"
-"--src sparql.sql:1957\n";
+"insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_iid, s_iid, p_iid, o_obj);\n"
+"}\n"
+"--src sparql.sql:2196\n";
 
-static const char *proc77 = 
+static const char *proc86 = 
+"#line 2216 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QUAD_URI_L_TYPED (in g_uri varchar, in s_uri varchar, in p_uri varchar, in o_lit any, in dt any, in lang varchar, in ro_id_dict any := null)\n"
 "{\n"
-"declare g_iid, p_iid IRI_ID;\n"
+"declare g_iid, s_iid, p_iid IRI_ID;\n"
+"declare o_obj any;\n"
 "g_iid := iri_to_id (g_uri);\n"
+"s_iid := iri_to_id (s_uri);\n"
 "p_iid := iri_to_id (p_uri);\n"
 "if (dt is null and lang is null)\n"
+"o_obj := DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL_FT (o_lit, g_iid, p_iid, ro_id_dict);\n"
+"else\n"
+"o_obj := DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL_FT (o_lit, iri_to_id (dt), lang, g_iid, p_iid, ro_id_dict);\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
 "{\n"
-"insert soft DB.DBA.RDF_QUAD (G,S,P,O)\n"
-"values (\n"
-"g_iid,\n"
-"iri_to_id (s_uri),\n"
-"p_iid,\n"
-"DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL_FT (o_lit, g_iid, p_iid, ro_id_dict) );\n"
-"return;\n"
+"declare triples any;\n"
+"triples := vector (vector (s_iid, p_iid, o_obj));\n"
+"DB.DBA.RDF_REPL_INSERT_TRIPLES (id_to_iri (g_iid), triples);\n"
 "}\n"
-"insert soft DB.DBA.RDF_QUAD (G,S,P,O)\n"
-"values (\n"
-"g_iid,\n"
-"iri_to_id (s_uri),\n"
-"p_iid,\n"
-"DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL_FT (\n"
-"o_lit, iri_to_id (dt), lang, g_iid, p_iid, ro_id_dict ) );\n"
+"insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_iid, s_iid, p_iid, o_obj);\n"
 "}\n"
-"--src sparql.sql:1971\n";
+"--src sparql.sql:2214\n";
 
-static const char *proc78 = 
+static const char *proc87 = 
+"#line 2237 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_QUAD_L_RDB2RDF (in g_iid varchar, in s_iid varchar, in p_iid varchar, inout o_val any, inout old_g_iid any, inout ro_id_dict any)\n"
+"{\n"
+"declare t int;\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
+"{\n"
+"declare triples any;\n"
+"triples := vector (vector (s_iid, p_iid, o_val));\n"
+"DB.DBA.RDF_REPL_INSERT_TRIPLES (id_to_iri (g_iid), triples);\n"
+"}\n"
+"t := __tag (o_val);\n"
+"if (__tag of rdf_box <> t)\n"
+"{\n"
+"if (not (t in (__tag of varchar, 126, 217, __tag of nvarchar)))\n"
+"{\n"
+"goto o_val_done;\n"
+"}\n"
+"if (__tag of nvarchar = t)\n"
+"o_val := charset_recode (o_val, \'_WIDE_\', \'UTF-8\');\n"
+"else if (t in (126, 217))\n"
+"o_val := cast (o_val as varchar);\n"
+"else if (bit_and (1, __box_flags (o_val)))\n"
+"{\n"
+"o_val := iri_to_id (o_val);\n"
+"goto o_val_done;\n"
+"}\n"
+"}\n"
+"if (__rdf_obj_ft_rule_check (g_iid, p_iid))\n"
+"{\n"
+"if (old_g_iid <> g_iid)\n"
+"{\n"
+"if (dict_size (ro_id_dict))\n"
+"DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH (old_g_iid, ro_id_dict);\n"
+"old_g_iid := g_iid;\n"
+"}\n"
+"if (ro_id_dict is null)\n"
+"ro_id_dict := dict_new ();\n"
+"o_val := DB.DBA.RDF_OBJ_ADD (257, o_val, 257, ro_id_dict);\n"
+"}\n"
+"else\n"
+"o_val := DB.DBA.RDF_OBJ_ADD (257, o_val, 257);\n"
+"\n"
+"o_val_done:\n"
+"insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_iid, s_iid, p_iid, o_val);\n"
+"}\n"
+"--src sparql.sql:2235\n";
+
+static const char *proc88 = 
+"#line 2283 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_NEW_GRAPH (inout g varchar, inout g_iid IRI_ID, inout app_env any) {\n"
 "\n"
 "if (__rdf_obj_ft_rule_count_in_graph (g_iid))\n"
 "app_env[1] := dict_new (app_env[2]);\n"
 "else\n"
 "app_env[1] := null;\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
+"app_env[3] := g;\n"
+"else\n"
+"app_env[3] := null;\n"
 "}\n"
-"--src sparql.sql:1996\n";
+"--src sparql.sql:2281\n";
 
-static const char *proc79 = 
+static const char *proc89 = 
+"#line 2296 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_NEW_BLANK (inout g_iid IRI_ID, inout app_env any, inout res IRI_ID) {\n"
 "res := iri_id_from_num (sequence_next (\'RDF_URL_IID_BLANK\'));\n"
 "\n"
 "}\n"
-"--src sparql.sql:2005\n";
+"--src sparql.sql:2294\n";
 
-static const char *proc80 = 
+static const char *proc90 = 
+"#line 2302 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_GET_IID (inout uri varchar, inout g_iid IRI_ID, inout app_env any, inout res IRI_ID) {\n"
 "\n"
 "res := iri_to_id (uri);\n"
 "\n"
 "}\n"
-"--src sparql.sql:2011\n";
+"--src sparql.sql:2300\n";
 
-static const char *proc81 = 
+static const char *proc91 = 
+"#line 2309 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_TRIPLE (\n"
 "inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
 "inout o_uri varchar,\n"
 "inout app_env any )\n"
 "{\n"
 "\n"
-"insert soft DB.DBA.RDF_QUAD (G,S,P,O)\n"
-"values (g_iid, iri_to_id (s_uri), iri_to_id (p_uri), iri_to_id (o_uri) );\n"
+"if (app_env[3] is not null)\n"
+"__rdf_repl_quad (84, app_env[3], iri_canonicalize (s_uri), iri_canonicalize (p_uri), iri_canonicalize (o_uri));\n"
+"insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_iid, iri_to_id (s_uri), iri_to_id (p_uri), iri_to_id (o_uri));\n"
 "}\n"
-"--src sparql.sql:2018\n";
+"--src sparql.sql:2307\n";
 
-static const char *proc82 = 
+static const char *proc92 = 
+"#line 2321 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_TRIPLE_L (\n"
 "inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
 "inout o_val any, inout o_type varchar, inout o_lang varchar,\n"
@@ -2011,6 +2404,15 @@ static const char *proc82 =
 "declare log_mode integer;\n"
 "declare p_iid IRI_ID;\n"
 "declare ro_id_dict any;\n"
+"if (app_env[3] is not null)\n"
+"{\n"
+"if (isstring (o_type))\n"
+"__rdf_repl_quad (81, app_env[3], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val, iri_canonicalize (o_type), NULL);\n"
+"else if (isstring (o_lang))\n"
+"__rdf_repl_quad (82, app_env[3], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val, null, o_lang);\n"
+"else\n"
+"__rdf_repl_quad (80, app_env[3], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val);\n"
+"}\n"
 "log_mode := app_env[0];\n"
 "ro_id_dict := app_env[1];\n"
 "p_iid := iri_to_id (p_uri);\n"
@@ -2070,9 +2472,10 @@ static const char *proc82 =
 "o_val );\n"
 "}\n"
 "}\n"
-"--src sparql.sql:2029\n";
+"--src sparql.sql:2319\n";
 
-static const char *proc83 = 
+static const char *proc93 = 
+"#line 2400 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_COMMIT (inout g varchar, inout app_env any) {\n"
 "\n"
 "declare log_mode integer;\n"
@@ -2082,9 +2485,10 @@ static const char *proc83 =
 "if (ro_id_dict is not null)\n"
 "DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH (iri_to_id (g), ro_id_dict);\n"
 "}\n"
-"--src sparql.sql:2099\n";
+"--src sparql.sql:2398\n";
 
-static const char *proc84 = 
+static const char *proc94 = 
+"#line 2411 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_REPORT_DEFAULT (\n"
 "inout msg_no integer, inout msg_type varchar,\n"
 "inout src varchar, inout base varchar, inout graph varchar,\n"
@@ -2095,9 +2499,10 @@ static const char *proc84 =
 "\n"
 " ;\n"
 "}\n"
-"--src sparql.sql:2110\n";
+"--src sparql.sql:2409\n";
 
-static const char *proc85 = 
+static const char *proc95 = 
+"#line 2423 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_TRIPLE_XLAT (\n"
 "inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
 "inout o_uri varchar,\n"
@@ -2106,15 +2511,16 @@ static const char *proc85 =
 "declare xlat_cbk, s_xlat, o_xlat varchar;\n"
 "declare xlat_env any;\n"
 "\n"
-"xlat_cbk := app_env[3];\n"
-"xlat_env := app_env[4];\n"
+"xlat_cbk := app_env[4];\n"
+"xlat_env := app_env[5];\n"
 "s_xlat := call(xlat_cbk)(s_uri, xlat_env);\n"
 "o_xlat := call(xlat_cbk)(o_uri, xlat_env);\n"
 "DB.DBA.TTLP_EV_TRIPLE (g_iid, s_xlat, p_uri, o_xlat, app_env);\n"
 "}\n"
-"--src sparql.sql:2122\n";
+"--src sparql.sql:2421\n";
 
-static const char *proc86 = 
+static const char *proc96 = 
+"#line 2439 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_TRIPLE_L_XLAT (\n"
 "inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
 "inout o_val any, inout o_type varchar, inout o_lang varchar,\n"
@@ -2123,14 +2529,15 @@ static const char *proc86 =
 "declare xlat_cbk, s_xlat varchar;\n"
 "declare xlat_env any;\n"
 "\n"
-"xlat_cbk := app_env[3];\n"
-"xlat_env := app_env[4];\n"
+"xlat_cbk := app_env[4];\n"
+"xlat_env := app_env[5];\n"
 "s_xlat := call(xlat_cbk)(s_uri, xlat_env);\n"
 "DB.DBA.TTLP_EV_TRIPLE_L (g_iid, s_xlat, p_uri, o_val, o_type, o_lang, app_env);\n"
 "}\n"
-"--src sparql.sql:2138\n";
+"--src sparql.sql:2437\n";
 
-static const char *proc87 = 
+static const char *proc97 = 
+"#line 2455 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.TTLP_XLAT_CONCAT (\n"
 "inout iri varchar, inout env any )\n"
 "{\n"
@@ -2140,14 +2547,16 @@ static const char *proc87 =
 "return concat (env, subseq (iri, 7));\n"
 "return iri;\n"
 "}\n"
-"--src sparql.sql:2154\n";
+"--src sparql.sql:2453\n";
 
-static const char *proc88 = 
+static const char *proc98 = 
+"#line 2466 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP (in strg varchar, in base varchar, in graph varchar := null, in flags integer := 0,\n"
 "in log_enable int := null, in transactional int := 0)\n"
 "{\n"
 "declare app_env any;\n"
 "declare old_log_mode int;\n"
+"declare ret any;\n"
 "if (graph = \'\')\n"
 "signal (\'22023\', \'Empty string is not a valid graph IRI in DB.DBA.TTLP()\');\n"
 "else if (graph is null)\n"
@@ -2173,8 +2582,8 @@ static const char *proc88 =
 "}\n"
 "if (126 = __tag (strg))\n"
 "strg := cast (strg as varchar);\n"
-"app_env := vector (flags, null, __max (length (strg) / 100, 100000));\n"
-"return rdf_load_turtle (strg, base, graph, flags,\n"
+"app_env := vector (flags, null, __max (length (strg) / 100, 100000), null);\n"
+"ret := rdf_load_turtle (strg, base, graph, flags,\n"
 "vector (\n"
 "\'DB.DBA.TTLP_EV_NEW_GRAPH\',\n"
 "\'DB.DBA.TTLP_EV_NEW_BLANK\',\n"
@@ -2184,10 +2593,14 @@ static const char *proc88 =
 "\'DB.DBA.TTLP_EV_COMMIT\',\n"
 "\'DB.DBA.TTLP_EV_REPORT_DEFAULT\' ),\n"
 "app_env);\n"
+"if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue ()\');\n"
+"return ret;\n"
 "}\n"
-"--src sparql.sql:2165\n";
+"--src sparql.sql:2464\n";
 
-static const char *proc89 = 
+static const char *proc99 = 
+"#line 2514 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_WITH_IRI_TRANSLATION (in strg varchar, in base varchar, in graph varchar, in flags integer,\n"
 "in log_enable integer, in transactional integer,\n"
 "in iri_xlate_cbk varchar, in iri_xlate_env any )\n"
@@ -2219,7 +2632,7 @@ static const char *proc89 =
 "}\n"
 "if (126 = __tag (strg))\n"
 "strg := cast (strg as varchar);\n"
-"app_env := vector (flags, null, __max (length (strg) / 100, 100000), iri_xlate_cbk, iri_xlate_env);\n"
+"app_env := vector (flags, null, __max (length (strg) / 100, 100000), null, iri_xlate_cbk, iri_xlate_env);\n"
 "return rdf_load_turtle (strg, base, graph, flags,\n"
 "vector (\n"
 "\'DB.DBA.TTLP_EV_NEW_GRAPH\',\n"
@@ -2231,9 +2644,10 @@ static const char *proc89 =
 "\'DB.DBA.TTLP_EV_REPORT_DEFAULT\' ),\n"
 "app_env);\n"
 "}\n"
-"--src sparql.sql:2209\n";
+"--src sparql.sql:2512\n";
 
-static const char *proc90 = 
+static const char *proc100 = 
+"#line 2559 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_VALIDATE (in strg varchar, in base varchar, in graph varchar := null, in flags integer := 0, in report_cbk varchar := \'\')\n"
 "{\n"
 "declare app_env any;\n"
@@ -2244,9 +2658,10 @@ static const char *proc90 =
 "vector (\'\', \'\', \'\', \'\', \'\', \'\', report_cbk),\n"
 "app_env);\n"
 "}\n"
-"--src sparql.sql:2254\n";
+"--src sparql.sql:2557\n";
 
-static const char *proc91 = 
+static const char *proc101 = 
+"#line 2571 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_VALIDATE_LOCAL_FILE (in strg varchar, in base varchar, in graph varchar := null, in flags integer := 0, in report_cbk varchar := \'\')\n"
 "{\n"
 "declare app_env any;\n"
@@ -2257,31 +2672,35 @@ static const char *proc91 =
 "vector (\'\', \'\', \'\', \'\', \'\', \'\', report_cbk),\n"
 "app_env);\n"
 "}\n"
-"--src sparql.sql:2266\n";
+"--src sparql.sql:2569\n";
 
-static const char *proc92 = 
+static const char *proc102 = 
+"#line 2583 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TTL2HASH_EXEC_NEW_GRAPH (inout g varchar, inout g_iid IRI_ID, inout app_env any) {\n"
 "\n"
 " ;\n"
 "}\n"
-"--src sparql.sql:2278\n";
+"--src sparql.sql:2581\n";
 
-static const char *proc93 = 
+static const char *proc103 = 
+"#line 2589 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TTL2HASH_EXEC_NEW_BLANK (inout g_iid IRI_ID, inout app_env any, inout res IRI_ID) {\n"
 "res := iri_id_from_num (sequence_next (\'RDF_URL_IID_BLANK\'));\n"
 "\n"
 "}\n"
-"--src sparql.sql:2284\n";
+"--src sparql.sql:2587\n";
 
-static const char *proc94 = 
+static const char *proc104 = 
+"#line 2595 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TTL2HASH_EXEC_GET_IID (inout uri varchar, inout g_iid IRI_ID, inout app_env any, inout res IRI_ID) {\n"
 "\n"
 "res := iri_to_id (uri);\n"
 "\n"
 "}\n"
-"--src sparql.sql:2290\n";
+"--src sparql.sql:2593\n";
 
-static const char *proc95 = 
+static const char *proc105 = 
+"#line 2602 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TTL2HASH_EXEC_TRIPLE (\n"
 "inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
 "inout o_uri varchar,\n"
@@ -2291,9 +2710,10 @@ static const char *proc95 =
 "vector (iri_to_id (s_uri), iri_to_id (p_uri), iri_to_id (o_uri)),\n"
 "0 );\n"
 "}\n"
-"--src sparql.sql:2297\n";
+"--src sparql.sql:2600\n";
 
-static const char *proc96 = 
+static const char *proc106 = 
+"#line 2613 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TTL2HASH_EXEC_TRIPLE_L (\n"
 "inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
 "inout o_val any, inout o_type varchar, inout o_lang varchar,\n"
@@ -2312,9 +2732,10 @@ static const char *proc96 =
 "case (isstring (o_lang)) when 0 then null else o_lang end) ),\n"
 "0 );\n"
 "}\n"
-"--src sparql.sql:2308\n";
+"--src sparql.sql:2611\n";
 
-static const char *proc97 = 
+static const char *proc107 = 
+"#line 2633 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_TTL2HASH (in strg varchar, in base varchar, in graph varchar := null, in flags integer := 0) returns any\n"
 "{\n"
 "declare res any;\n"
@@ -2334,17 +2755,19 @@ static const char *proc97 =
 "res);\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:2328\n";
+"--src sparql.sql:2631\n";
 
-static const char *proc98 = 
+static const char *proc108 = 
+"#line 2654 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TTL2SQLHASH_EXEC_GET_IID (inout uri varchar, inout g_iid IRI_ID, inout app_env any, inout res IRI_ID) {\n"
 "\n"
 "res := __bft (uri, 1);\n"
 "\n"
 "}\n"
-"--src sparql.sql:2349\n";
+"--src sparql.sql:2652\n";
 
-static const char *proc99 = 
+static const char *proc109 = 
+"#line 2661 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TTL2SQLHASH_EXEC_TRIPLE (\n"
 "inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
 "inout o_uri varchar,\n"
@@ -2357,9 +2780,10 @@ static const char *proc99 =
 "__bft (o_uri, 1) ),\n"
 "0 );\n"
 "}\n"
-"--src sparql.sql:2356\n";
+"--src sparql.sql:2659\n";
 
-static const char *proc100 = 
+static const char *proc110 = 
+"#line 2675 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TTL2SQLHASH_EXEC_TRIPLE_L (\n"
 "inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
 "inout o_val any, inout o_type varchar, inout o_lang varchar,\n"
@@ -2378,9 +2802,10 @@ static const char *proc100 =
 "case (isstring (o_lang)) when 0 then null else o_lang end) ),\n"
 "0 );\n"
 "}\n"
-"--src sparql.sql:2370\n";
+"--src sparql.sql:2673\n";
 
-static const char *proc101 = 
+static const char *proc111 = 
+"#line 2695 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_TTL2SQLHASH (in strg varchar, in base varchar, in graph varchar := null, in flags integer := 0) returns any\n"
 "{\n"
 "declare res any;\n"
@@ -2400,9 +2825,10 @@ static const char *proc101 =
 "res);\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:2390\n";
+"--src sparql.sql:2693\n";
 
-static const char *proc102 = 
+static const char *proc112 = 
+"#line 2716 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_LOAD_RDFXML (in strg varchar, in base varchar, in graph varchar,\n"
 "in log_enable int := null, in transactional int := 0)\n"
 "{\n"
@@ -2428,7 +2854,11 @@ static const char *proc102 =
 "}\n"
 "if (1 <> sys_stat (\'cl_run_local_only\'))\n"
 "return rdf_load_rdfxml_cl (strg, base, graph);\n"
-"app_env := vector (null, null, __max (length (strg) / 100, 100000));\n"
+"app_env := vector (\n"
+"null,\n"
+"null,\n"
+"__max (length (strg) / 100, 100000),\n"
+"null );\n"
 "rdf_load_rdfxml (strg, 0,\n"
 "graph,\n"
 "vector (\n"
@@ -2441,11 +2871,14 @@ static const char *proc102 =
 "\'DB.DBA.TTLP_EV_REPORT_DEFAULT\' ),\n"
 "app_env,\n"
 "base );\n"
+"if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue ()\');\n"
 "return graph;\n"
 "}\n"
-"--src sparql.sql:2411\n";
+"--src sparql.sql:2714\n";
 
-static const char *proc103 = 
+static const char *proc113 = 
+"#line 2764 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_RDFXML_TO_DICT (in strg varchar, in base varchar, in graph varchar := null)\n"
 "{\n"
 "declare res any;\n"
@@ -2464,9 +2897,10 @@ static const char *proc103 =
 "base );\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:2453\n";
+"--src sparql.sql:2762\n";
 
-static const char *proc104 = 
+static const char *proc114 = 
+"#line 2784 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_LOAD_RDFA (in strg varchar, in base varchar, in graph varchar := null, in xml_parse_mode integer := 0)\n"
 "{\n"
 "declare app_env any;\n"
@@ -2480,7 +2914,11 @@ static const char *proc104 =
 "}\n"
 "if (1 <> sys_stat (\'cl_run_local_only\'))\n"
 "return DB.DBA.RDF_LOAD_RDFA_CL (strg, base, graph, xml_parse_mode);\n"
-"app_env := vector (null, null, __max (length (strg) / 100, 100000));\n"
+"app_env := vector (\n"
+"null,\n"
+"null,\n"
+"__max (length (strg) / 100, 100000),\n"
+"null );\n"
 "rdf_load_rdfxml (strg, bit_or (2, bit_shift (xml_parse_mode, 8)),\n"
 "graph,\n"
 "vector (\n"
@@ -2493,11 +2931,14 @@ static const char *proc104 =
 "\'DB.DBA.TTLP_EV_REPORT_DEFAULT\' ),\n"
 "app_env,\n"
 "base );\n"
+"if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue ()\');\n"
 "return graph;\n"
 "}\n"
-"--src sparql.sql:2473\n";
+"--src sparql.sql:2782\n";
 
-static const char *proc105 = 
+static const char *proc115 = 
+"#line 2820 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_LOAD_RDFA_WITH_IRI_TRANSLATION (in strg varchar, in base varchar, in graph varchar, in xml_parse_mode integer,\n"
 "in iri_xlate_cbk varchar, in iri_xlate_env any )\n"
 "{\n"
@@ -2512,7 +2953,13 @@ static const char *proc105 =
 "}\n"
 "if (1 <> sys_stat (\'cl_run_local_only\'))\n"
 "return DB.DBA.RDF_LOAD_RDFA_WITH_IRI_TRANSLATION_CL (strg, base, graph, xml_parse_mode, iri_xlate_cbk, iri_xlate_env);\n"
-"app_env := vector (null, null, __max (length (strg) / 100, 100000), iri_xlate_cbk, iri_xlate_env);\n"
+"app_env := vector (\n"
+"null,\n"
+"null,\n"
+"__max (length (strg) / 100, 100000),\n"
+"null,\n"
+"iri_xlate_cbk,\n"
+"iri_xlate_env );\n"
 "rdf_load_rdfxml (strg, bit_or (2, bit_shift (xml_parse_mode, 8)),\n"
 "graph,\n"
 "vector (\n"
@@ -2525,11 +2972,14 @@ static const char *proc105 =
 "\'DB.DBA.TTLP_EV_REPORT_DEFAULT\' ),\n"
 "app_env,\n"
 "base );\n"
+"if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue ()\');\n"
 "return graph;\n"
 "}\n"
-"--src sparql.sql:2503\n";
+"--src sparql.sql:2818\n";
 
-static const char *proc106 = 
+static const char *proc116 = 
+"#line 2859 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_RDFA_TO_DICT (in strg varchar, in base varchar, in graph varchar := null)\n"
 "{\n"
 "declare res any;\n"
@@ -2548,9 +2998,10 @@ static const char *proc106 =
 "base );\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:2534\n";
+"--src sparql.sql:2857\n";
 
-static const char *proc107 = 
+static const char *proc117 = 
+"#line 2883 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_XML_IRI_TO_TTL (inout obj any, inout ses any)\n"
 "{\n"
 "declare res varchar;\n"
@@ -2594,9 +3045,10 @@ static const char *proc107 =
 "http (\'> \', ses);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:2558\n";
+"--src sparql.sql:2881\n";
 
-static const char *proc108 = 
+static const char *proc118 = 
+"#line 2929 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_XML_OBJ_TO_TTL (\n"
 "inout o_val any, inout o_type varchar, inout o_lang varchar,\n"
 "inout ses any)\n"
@@ -2640,16 +3092,18 @@ static const char *proc108 =
 "else\n"
 "http (\'\" \', ses);\n"
 "}\n"
-"--src sparql.sql:2604\n";
+"--src sparql.sql:2927\n";
 
-static const char *proc109 = 
+static const char *proc119 = 
+"#line 2975 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_CONVERT_RDFXML_TO_TTL_EV_NEW_BLANK (inout g_iid IRI_ID, inout app_env any, inout res IRI_ID)\n"
 "{\n"
 " ;\n"
 "}\n"
-"--src sparql.sql:2650\n";
+"--src sparql.sql:2973\n";
 
-static const char *proc110 = 
+static const char *proc120 = 
+"#line 2982 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_CONVERT_RDFXML_TO_TTL_EV_TRIPLE (\n"
 "inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
 "inout o_uri varchar,\n"
@@ -2660,9 +3114,10 @@ static const char *proc110 =
 "DB.DBA.RDF_XML_IRI_TO_TTL (o_uri, app_env);\n"
 "http (\'.\\n\', app_env);\n"
 "}\n"
-"--src sparql.sql:2657\n";
+"--src sparql.sql:2980\n";
 
-static const char *proc111 = 
+static const char *proc121 = 
+"#line 2995 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_CONVERT_RDFXML_TO_TTL_EV_TRIPLE_L (\n"
 "inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
 "inout o_val any, inout o_type varchar, inout o_lang varchar,\n"
@@ -2673,9 +3128,10 @@ static const char *proc111 =
 "DB.DBA.RDF_XML_OBJ_TO_TTL (o_val, o_type, o_lang, app_env);\n"
 "http (\'.\\n\', app_env);\n"
 "}\n"
-"--src sparql.sql:2670\n";
+"--src sparql.sql:2993\n";
 
-static const char *proc112 = 
+static const char *proc122 = 
+"#line 3008 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_CONVERT_RDFXML_TO_TTL (in strg varchar, in base varchar, inout ttl_ses any)\n"
 "{\n"
 "rdf_load_rdfxml (strg, 0,\n"
@@ -2691,9 +3147,10 @@ static const char *proc112 =
 "ttl_ses,\n"
 "base );\n"
 "}\n"
-"--src sparql.sql:2683\n";
+"--src sparql.sql:3006\n";
 
-static const char *proc113 = 
+static const char *proc123 = 
+"#line 3026 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_CONVERT_RDFXML_FILE_TO_TTL_FILE (in rdfxml_source_filename varchar, in base varchar, in ttl_target_filename varchar)\n"
 "{\n"
 "declare in_ses, out_ses any;\n"
@@ -2702,9 +3159,10 @@ static const char *proc113 =
 "DB.DBA.RDF_CONVERT_RDFXML_TO_TTL (in_ses, base, out_ses);\n"
 "string_to_file (ttl_target_filename, out_ses, -2);\n"
 "}\n"
-"--src sparql.sql:2701\n";
+"--src sparql.sql:3024\n";
 
-static const char *proc114 = 
+static const char *proc124 = 
+"#line 3039 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_LONG_TO_TTL (inout obj any, inout ses any)\n"
 "{\n"
 "declare res varchar;\n"
@@ -2806,9 +3264,10 @@ static const char *proc114 =
 "http (\'> \', ses);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:2714\n";
+"--src sparql.sql:3037\n";
 
-static const char *proc115 = 
+static const char *proc125 = 
+"#line 3143 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TRIPLES_TO_VERBOSE_TTL (inout triples any, inout ses any)\n"
 "{\n"
 "declare tcount, tctr integer;\n"
@@ -2938,9 +3397,10 @@ static const char *proc115 =
 "}\n"
 "http (\'.\\n\', ses);\n"
 "}\n"
-"--src sparql.sql:2818\n";
+"--src sparql.sql:3141\n";
 
-static const char *proc116 = 
+static const char *proc126 = 
+"#line 3274 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TRIPLES_TO_TTL (inout triples any, inout ses any)\n"
 "{\n"
 "declare env any;\n"
@@ -2967,9 +3427,10 @@ static const char *proc116 =
 "}\n"
 "http (\' .\', ses);\n"
 "}\n"
-"--src sparql.sql:2949\n";
+"--src sparql.sql:3272\n";
 
-static const char *proc117 = 
+static const char *proc127 = 
+"#line 3302 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TRIPLES_TO_NT (inout triples any, inout ses any)\n"
 "{\n"
 "declare env any;\n"
@@ -2987,9 +3448,10 @@ static const char *proc117 =
 "http_nt_triple (env, triples[tctr][0], triples[tctr][1], triples[tctr][2], ses);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:2977\n";
+"--src sparql.sql:3300\n";
 
-static const char *proc118 = 
+static const char *proc128 = 
+"#line 3321 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_GRAPH_TO_TTL (in graph_iri varchar, inout ses any)\n"
 "{\n"
 "declare tcount integer;\n"
@@ -2999,7 +3461,7 @@ static const char *proc118 =
 "tcount := 0;\n"
 "prev_s := null;\n"
 "prev_p := null;\n"
-"for (select S as subj, P as pred, O as obj from RDF_QUAD where G = iri_to_id (graph_iri)) do\n"
+"for (select S as subj, P as pred, O as obj from DB.DBA.RDF_QUAD where G = iri_to_id (graph_iri)) do\n"
 "{\n"
 "if (prev_s = subj)\n"
 "{\n"
@@ -3049,9 +3511,10 @@ static const char *proc118 =
 "else\n"
 "http (\'.\\n\', ses);\n"
 "}\n"
-"--src sparql.sql:2996\n";
+"--src sparql.sql:3319\n";
 
-static const char *proc119 = 
+static const char *proc129 = 
+"#line 3395 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TRIPLES_TO_RDF_XML_TEXT (inout triples any, in print_top_level integer, inout ses any)\n"
 "{\n"
 "declare tcount, tctr integer;\n"
@@ -3264,9 +3727,10 @@ static const char *proc119 =
 "http (\'\\n</rdf:RDF>\', ses);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:3070\n";
+"--src sparql.sql:3393\n";
 
-static const char *proc120 = 
+static const char *proc130 = 
+"#line 3622 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TRIPLES_TO_TALIS_JSON (inout triples any, inout ses any)\n"
 "{\n"
 "declare env any;\n"
@@ -3293,9 +3757,10 @@ static const char *proc120 =
 "http (\' ] }\\n\', ses);\n"
 "http (\'}\\n\', ses);\n"
 "}\n"
-"--src sparql.sql:3297\n";
+"--src sparql.sql:3620\n";
 
-static const char *proc121 = 
+static const char *proc131 = 
+"#line 3650 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TRIPLES_TO_JSON (inout triples any, inout ses any)\n"
 "{\n"
 "declare tcount, tctr, env integer;\n"
@@ -3314,9 +3779,33 @@ static const char *proc121 =
 "}\n"
 "http (\' ] } }\', ses);\n"
 "}\n"
-"--src sparql.sql:3325\n";
+"--src sparql.sql:3648\n";
 
-static const char *proc122 = 
+static const char *proc132 = 
+"#line 3670 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_TRIPLES_TO_CSV (inout triples any, inout ses any)\n"
+"{\n"
+"declare env any;\n"
+"declare tcount, tctr, status integer;\n"
+"http (\'\"subject\",\"predicate\",\"object\"\\n\', ses);\n"
+"tcount := length (triples);\n"
+"\n"
+"{ whenever sqlstate \'*\' goto p_done; rowvector_subj_sort (triples, 1, 1); p_done: ; }\n"
+"{ whenever sqlstate \'*\' goto s_done; rowvector_subj_sort (triples, 0, 1); s_done: ; }\n"
+"for (tctr := 0; tctr < tcount; tctr := tctr + 1)\n"
+"{\n"
+"DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (ses, triples[tctr][0]);\n"
+"http (\',\', ses);\n"
+"DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (ses, triples[tctr][1]);\n"
+"http (\',\', ses);\n"
+"DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (ses, triples[tctr][2]);\n"
+"http (\'\\n\', ses);\n"
+"}\n"
+"}\n"
+"--src sparql.sql:3668\n";
+
+static const char *proc133 = 
+"#line 3691 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TRIPLES_TO_RDFA_XHTML (inout triples any, inout ses any)\n"
 "{\n"
 "declare env, prev_subj, nsdict, nslist any;\n"
@@ -3508,9 +3997,10 @@ static const char *proc122 =
 "http (\'\\n</div>\', ses);\n"
 "http (\'\\n</body></html>\\n\', ses);\n"
 "}\n"
-"--src sparql.sql:3345\n";
+"--src sparql.sql:3689\n";
 
-static const char *proc123 = 
+static const char *proc134 = 
+"#line 3885 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_ATOM_XML (inout triples_dict any) returns long varchar\n"
 "{\n"
 "declare triples, ses any;\n"
@@ -3524,9 +4014,10 @@ static const char *proc123 =
 "DB.DBA.RDF_TRIPLES_TO_ATOM_XML_TEXT (triples, 1, ses);\n"
 "return ses;\n"
 "}\n"
-"--src sparql.sql:3539\n";
+"--src sparql.sql:3883\n";
 
-static const char *proc124 = 
+static const char *proc135 = 
+"#line 3900 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.ODATA_EDM_TYPE (in obj any)\n"
 "{\n"
 "if (__tag of int = __tag (obj))\n"
@@ -3551,9 +4042,10 @@ static const char *proc124 =
 "return \'Binary\';\n"
 "return null;\n"
 "}\n"
-"--src sparql.sql:3554\n";
+"--src sparql.sql:3898\n";
 
-static const char *proc125 = 
+static const char *proc136 = 
+"#line 3926 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_ODATA_JSON (inout triples_dict any) returns long varchar\n"
 "{\n"
 "declare triples, ses any;\n"
@@ -3567,9 +4059,10 @@ static const char *proc125 =
 "DB.DBA.RDF_TRIPLES_TO_ODATA_JSON (triples, ses);\n"
 "return ses;\n"
 "}\n"
-"--src sparql.sql:3580\n";
+"--src sparql.sql:3924\n";
 
-static const char *proc126 = 
+static const char *proc137 = 
+"#line 3941 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TRIPLES_TO_ODATA_JSON (inout triples any, inout ses any)\n"
 "{\n"
 "declare tcount, tctr, ns_ctr integer;\n"
@@ -3652,9 +4145,10 @@ static const char *proc126 =
 "}\n"
 "http (sprintf (\'\\n ], \"__count\": \"%d\"\\n } }\', tcount), ses);\n"
 "}\n"
-"--src sparql.sql:3595\n";
+"--src sparql.sql:3939\n";
 
-static const char *proc127 = 
+static const char *proc138 = 
+"#line 4025 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_TRIPLES_TO_ATOM_XML_TEXT (inout triples any, in print_top_level integer, inout ses any)\n"
 "{\n"
 "declare tcount, tctr, ns_ctr integer;\n"
@@ -3861,9 +4355,10 @@ static const char *proc127 =
 "http (\'</feed>\', ses);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:3679\n";
+"--src sparql.sql:4023\n";
 
-static const char *proc128 = 
+static const char *proc139 = 
+"#line 4238 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_INIT (inout _env any)\n"
 "{\n"
 "_env := string_output();\n"
@@ -3872,9 +4367,10 @@ static const char *proc128 =
 "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n"
 "[ rdf:type rs:results ;\', _env);\n"
 "}\n"
-"--src sparql.sql:3892\n";
+"--src sparql.sql:4236\n";
 
-static const char *proc129 = 
+static const char *proc140 = 
+"#line 4248 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_ACC (inout _env any, inout colvalues any, inout colnames any)\n"
 "{\n"
 "declare col_ctr, col_count integer;\n"
@@ -3920,9 +4416,10 @@ static const char *proc129 =
 "}\n"
 "http (\'\\n      ] ;\', _env);\n"
 "}\n"
-"--src sparql.sql:3902\n";
+"--src sparql.sql:4246\n";
 
-static const char *proc130 = 
+static const char *proc141 = 
+"#line 4295 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_FIN (inout _env any) returns long varchar\n"
 "{\n"
 "if (185 <> __tag(_env))\n"
@@ -3931,30 +4428,35 @@ static const char *proc130 =
 "http (\'\\n    ] .\', _env);\n"
 "return string_output_string (_env);\n"
 "}\n"
-"--src sparql.sql:3949\n";
+"--src sparql.sql:4293\n";
 
 static const char *other16 = 
 "create aggregate DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL (in colvalues any, in colnames any) returns long varchar\n"
-"from DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_FIN\n";
+"from DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_FIN\n"
+"order\n";
 
-static const char *proc131 = 
+static const char *proc142 = 
+"#line 4311 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_INIT (inout _env any)\n"
 "{\n"
-"_env := string_output();\n"
+"_env := vector (0, 0, string_output());\n"
 "http (\'@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
 "@prefix rs: <http://www.w3.org/2005/sparql-results#> .\n"
 "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n"
-"_:_ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2005/sparql-results#results> .\\n\', _env);\n"
+"_:_ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2005/sparql-results#results> .\\n\', _env[2]);\n"
 "}\n"
-"--src sparql.sql:3964\n";
+"--src sparql.sql:4309\n";
 
-static const char *proc132 = 
+static const char *proc143 = 
+"#line 4321 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_ACC (inout _env any, inout colvalues any, inout colnames any)\n"
 "{\n"
 "declare col_ctr, col_count integer;\n"
 "declare rowid varchar;\n"
 "declare blank_ids any;\n"
 "if (__tag of vector <> __tag(_env))\n"
+"DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_INIT (_env);\n"
+"if (isinteger (_env[1]))\n"
 "{\n"
 "declare col_buf any;\n"
 "col_count := length (colnames);\n"
@@ -3963,26 +4465,29 @@ static const char *proc132 =
 "col_buf := make_array (col_count * 7, \'any\');\n"
 "for (col_ctr := 0; col_ctr < col_count; col_ctr := col_ctr + 1)\n"
 "col_buf [col_ctr * 7] := colnames[col_ctr];\n"
-"_env := vector (0, col_buf, _env);\n"
+"_env[1] := col_buf;\n"
 "}\n"
 "sparql_rset_nt_write_row (0, _env, colvalues);\n"
 "}\n"
-"--src sparql.sql:3974\n";
+"--src sparql.sql:4319\n";
 
-static const char *proc133 = 
+static const char *proc144 = 
+"#line 4343 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_FIN (inout _env any) returns long varchar\n"
 "{\n"
-"if (185 <> __tag(_env))\n"
+"if (__tag of vector <> __tag(_env))\n"
 "DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_INIT (_env);\n"
-"return string_output_string (_env);\n"
+"return string_output_string (_env[2]);\n"
 "}\n"
-"--src sparql.sql:3994\n";
+"--src sparql.sql:4341\n";
 
 static const char *other17 = 
 "create aggregate DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT (in colvalues any, in colnames any) returns long varchar\n"
-"from DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_FIN\n";
+"from DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_FIN\n"
+"order\n";
 
-static const char *proc134 = 
+static const char *proc145 = 
+"#line 4356 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_INIT (inout _env any)\n"
 "{\n"
 "_env := string_output();\n"
@@ -3992,9 +4497,10 @@ static const char *proc134 =
 "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\" >\n"
 "<rs:results rdf:nodeID=\"rset\">\', _env);\n"
 "}\n"
-"--src sparql.sql:4006\n";
+"--src sparql.sql:4354\n";
 
-static const char *proc135 = 
+static const char *proc146 = 
+"#line 4367 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_ACC (inout _env any, inout colvalues any, inout colnames any)\n"
 "{\n"
 "declare sol_id varchar;\n"
@@ -4062,9 +4568,10 @@ static const char *proc135 =
 "}\n"
 "http (\'\\n  </rs:result>\', _env);\n"
 "}\n"
-"--src sparql.sql:4017\n";
+"--src sparql.sql:4365\n";
 
-static const char *proc136 = 
+static const char *proc147 = 
+"#line 4436 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_FIN (inout _env any) returns long varchar\n"
 "{\n"
 "if (185 <> __tag(_env))\n"
@@ -4073,20 +4580,23 @@ static const char *proc136 =
 "http (\'\\n </rs:results>\\n</rdf:RDF>\', _env);\n"
 "return string_output_string (_env);\n"
 "}\n"
-"--src sparql.sql:4086\n";
+"--src sparql.sql:4434\n";
 
 static const char *other18 = 
 "create aggregate DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML (in colvalues any, in colnames any) returns long varchar\n"
-"from DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_FIN\n";
+"from DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_FIN\n"
+"order\n";
 
-static const char *proc137 = 
+static const char *proc148 = 
+"#line 4451 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_INIT (inout _env any)\n"
 "{\n"
 "_env := 0;\n"
 "}\n"
-"--src sparql.sql:4100\n";
+"--src sparql.sql:4449\n";
 
-static const char *proc138 = 
+static const char *proc149 = 
+"#line 4457 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_ACC (inout _env any, inout colvalues any, inout colnames any)\n"
 "{\n"
 "declare sol_id varchar;\n"
@@ -4126,9 +4636,10 @@ static const char *proc138 =
 "}\n"
 "http(\'}\', _env);\n"
 "}\n"
-"--src sparql.sql:4106\n";
+"--src sparql.sql:4455\n";
 
-static const char *proc139 = 
+static const char *proc150 = 
+"#line 4498 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_FIN (inout _env any) returns long varchar\n"
 "{\n"
 "if (185 <> __tag(_env))\n"
@@ -4139,29 +4650,174 @@ static const char *proc139 =
 "http (\' ] } }\', _env);\n"
 "return string_output_string (_env);\n"
 "}\n"
-"--src sparql.sql:4147\n";
+"--src sparql.sql:4496\n";
 
 static const char *other19 = 
 "create aggregate DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON (in colvalues any, in colnames any) returns long varchar\n"
-"from DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_FIN\n";
+"from DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_FIN\n"
+"order\n";
 
-static const char *proc140 = 
-"create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TTL (inout triples_dict any) returns long varchar\n"
-"{\n"
-"declare triples, ses any;\n"
-"ses := string_output ();\n"
-"if (214 <> __tag (triples_dict))\n"
+static const char *proc151 = 
+"#line 4517 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_INIT (inout _env any)\n"
 "{\n"
-"triples := vector ();\n"
-"}\n"
-"else\n"
-"triples := dict_list_keys (triples_dict, 1);\n"
-"DB.DBA.RDF_TRIPLES_TO_TTL (triples, ses);\n"
-"return ses;\n"
+"_env := 0;\n"
 "}\n"
-"--src sparql.sql:4163\n";
+"--src sparql.sql:4515\n";
 
-static const char *proc141 = 
+static const char *proc152 = 
+"#line 4523 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (inout _env any, in val any)\n"
+"{\n"
+"declare t integer;\n"
+"t := __tag (val);\n"
+"if (t = __tag of rdf_box)\n"
+"{\n"
+"val := rdf_box_data (val);\n"
+"t := __tag (val);\n"
+"}\n"
+"if (t in (__tag of integer, __tag of numeric, __tag of double precision, __tag of float, __tag of date, __tag of time, __tag of datetime))\n"
+"{\n"
+"http_value (val, 0, _env);\n"
+"return;\n"
+"}\n"
+"if (t = __tag of IRI_ID)\n"
+"val := id_to_iri (val);\n"
+"http (\'\"\', _env);\n"
+"http (replace (cast (val as varchar), \'\"\', \'\"\"\"\'), _env);\n"
+"http (\'\"\', _env);\n"
+"}\n"
+"--src sparql.sql:4521\n";
+
+static const char *proc153 = 
+"#line 4545 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_ACC (inout _env any, inout colvalues any, inout colnames any)\n"
+"{\n"
+"declare sol_id varchar;\n"
+"declare col_ctr, col_count integer;\n"
+"declare blank_ids any;\n"
+"col_count := length (colnames);\n"
+"if (185 <> __tag(_env))\n"
+"{\n"
+"_env := string_output ();\n"
+"for (col_ctr := 0; col_ctr < col_count; col_ctr := col_ctr + 1)\n"
+"{\n"
+"if (col_ctr > 0)\n"
+"http(\',\', _env);\n"
+"DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (_env, colnames[col_ctr]);\n"
+"}\n"
+"http (\'\\n\', _env);\n"
+"}\n"
+"for (col_ctr := 0; col_ctr < col_count; col_ctr := col_ctr + 1)\n"
+"{\n"
+"declare val any;\n"
+"val := colvalues[col_ctr];\n"
+"if (col_ctr > 0)\n"
+"http(\',\', _env);\n"
+"if (val is not null)\n"
+"DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (_env, val);\n"
+"}\n"
+"http(\'\\n\', _env);\n"
+"}\n"
+"--src sparql.sql:4543\n";
+
+static const char *proc154 = 
+"#line 4575 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_FIN (inout _env any) returns long varchar\n"
+"{\n"
+"if (185 <> __tag(_env))\n"
+"return \'\';\n"
+"return string_output_string (_env);\n"
+"}\n"
+"--src sparql.sql:4573\n";
+
+static const char *other20 = 
+"create aggregate DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV (in colvalues any, in colnames any) returns long varchar\n"
+"from DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_FIN\n"
+"order\n";
+
+static const char *proc155 = 
+"#line 4588 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_INIT (inout _env any)\n"
+"{\n"
+"_env := 0;\n"
+"}\n"
+"--src sparql.sql:4586\n";
+
+static const char *proc156 = 
+"#line 4594 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_ACC (inout _env any, inout colvalues any, inout colnames any)\n"
+"{\n"
+"declare agg, colvalues_copy any;\n"
+"colvalues_copy := colvalues;\n"
+"if (isinteger (_env))\n"
+"{\n"
+"vectorbld_init (agg);\n"
+"_env := vector (0, colnames);\n"
+"}\n"
+"else\n"
+"{\n"
+"agg := aref_set_0 (_env, 0);\n"
+"}\n"
+"vectorbld_acc (agg, colvalues_copy);\n"
+"aset_zap_arg (_env, 0, agg);\n"
+"}\n"
+"--src sparql.sql:4592\n";
+
+static const char *proc157 = 
+"#line 4612 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_FIN (inout _env any) returns long varchar\n"
+"{\n"
+"declare ses, metas, rset any;\n"
+"declare accept varchar;\n"
+"declare add_http_headers integer;\n"
+"ses := string_output ();\n"
+"if (isinteger (_env))\n"
+"{\n"
+"metas := vector (vector (vector (\'s\')), 1);\n"
+"rset := vector ();\n"
+"DB.DBA.SPARQL_RESULTS_CXML_WRITE (ses, metas, rset, accept, add_http_headers);\n"
+"}\n"
+"else\n"
+"{\n"
+"declare cols any;\n"
+"declare colctr, colcount integer;\n"
+"rset := aref_set_0 (_env, 0);\n"
+"vectorbld_final (rset);\n"
+"cols := aref_set_0 (_env, 1);\n"
+"colcount := length (cols);\n"
+"for (colctr := 0; colctr < colcount; colctr := colctr + 1) cols[colctr] := vector (cols[colctr]);\n"
+"metas := vector (cols, vector ());\n"
+"DB.DBA.SPARQL_RESULTS_CXML_WRITE (ses, metas, rset, accept, add_http_headers);\n"
+"}\n"
+"return string_output_string (ses);\n"
+"}\n"
+"--src sparql.sql:4610\n";
+
+static const char *other21 = 
+"create aggregate DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML (in colvalues any, in colnames any) returns long varchar\n"
+"from DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_INIT, DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_ACC, DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_FIN\n"
+"order\n";
+
+static const char *proc158 = 
+"#line 4645 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TTL (inout triples_dict any) returns long varchar\n"
+"{\n"
+"declare triples, ses any;\n"
+"ses := string_output ();\n"
+"if (214 <> __tag (triples_dict))\n"
+"{\n"
+"triples := vector ();\n"
+"}\n"
+"else\n"
+"triples := dict_list_keys (triples_dict, 1);\n"
+"DB.DBA.RDF_TRIPLES_TO_TTL (triples, ses);\n"
+"return ses;\n"
+"}\n"
+"--src sparql.sql:4643\n";
+
+static const char *proc159 = 
+"#line 4660 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_NT (inout triples_dict any) returns long varchar\n"
 "{\n"
 "declare triples, ses any;\n"
@@ -4175,9 +4831,10 @@ static const char *proc141 =
 "DB.DBA.RDF_TRIPLES_TO_NT (triples, ses);\n"
 "return ses;\n"
 "}\n"
-"--src sparql.sql:4178\n";
+"--src sparql.sql:4658\n";
 
-static const char *proc142 = 
+static const char *proc160 = 
+"#line 4675 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_RDF_XML (inout triples_dict any) returns long varchar\n"
 "{\n"
 "declare triples, ses any;\n"
@@ -4191,9 +4848,10 @@ static const char *proc142 =
 "DB.DBA.RDF_TRIPLES_TO_RDF_XML_TEXT (triples, 1, ses);\n"
 "return ses;\n"
 "}\n"
-"--src sparql.sql:4193\n";
+"--src sparql.sql:4673\n";
 
-static const char *proc143 = 
+static const char *proc161 = 
+"#line 4690 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TALIS_JSON (inout triples_dict any) returns long varchar\n"
 "{\n"
 "declare triples, ses any;\n"
@@ -4207,9 +4865,27 @@ static const char *proc143 =
 "DB.DBA.RDF_TRIPLES_TO_TALIS_JSON (triples, ses);\n"
 "return ses;\n"
 "}\n"
-"--src sparql.sql:4208\n";
+"--src sparql.sql:4688\n";
 
-static const char *proc144 = 
+static const char *proc162 = 
+"#line 4705 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CSV (inout triples_dict any) returns long varchar\n"
+"{\n"
+"declare triples, ses any;\n"
+"ses := string_output ();\n"
+"if (214 <> __tag (triples_dict))\n"
+"{\n"
+"triples := vector ();\n"
+"}\n"
+"else\n"
+"triples := dict_list_keys (triples_dict, 1);\n"
+"DB.DBA.RDF_TRIPLES_TO_CSV (triples, ses);\n"
+"return ses;\n"
+"}\n"
+"--src sparql.sql:4703\n";
+
+static const char *proc163 = 
+"#line 4720 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_RDFA_XHTML (inout triples_dict any) returns long varchar\n"
 "{\n"
 "declare triples, ses any;\n"
@@ -4223,23 +4899,66 @@ static const char *proc144 =
 "DB.DBA.RDF_TRIPLES_TO_RDFA_XHTML (triples, ses);\n"
 "return ses;\n"
 "}\n"
-"--src sparql.sql:4223\n";
+"--src sparql.sql:4718\n";
 
-static const char *proc145 = 
+static const char *proc164 = 
+"#line 4735 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CXML (inout triples_dict any) returns long varchar\n"
+"{\n"
+"declare triples, ses any;\n"
+"declare accept varchar;\n"
+"declare add_http_headers integer;\n"
+"add_http_headers := 0;\n"
+"ses := string_output ();\n"
+"if (214 <> __tag (triples_dict))\n"
+"{\n"
+"triples := vector ();\n"
+"}\n"
+"else\n"
+"triples := dict_list_keys (triples_dict, 1);\n"
+"DB.DBA.RDF_TRIPLES_TO_CXML (triples, ses, accept, add_http_headers, 0);\n"
+"return ses;\n"
+"}\n"
+"--src sparql.sql:4733\n";
+
+static const char *proc165 = 
+"#line 4753 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CXML_QRCODE (inout triples_dict any) returns long varchar\n"
+"{\n"
+"declare triples, ses any;\n"
+"declare accept varchar;\n"
+"declare add_http_headers integer;\n"
+"add_http_headers := 0;\n"
+"ses := string_output ();\n"
+"if (214 <> __tag (triples_dict))\n"
+"{\n"
+"triples := vector ();\n"
+"}\n"
+"else\n"
+"triples := dict_list_keys (triples_dict, 1);\n"
+"DB.DBA.RDF_TRIPLES_TO_CXML (triples, ses, accept, add_http_headers, 1);\n"
+"return ses;\n"
+"}\n"
+"--src sparql.sql:4751\n";
+
+static const char *proc166 = 
+"#line 4772 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_INIT (inout _env any)\n"
 "{\n"
 "_env := 0;\n"
 "}\n"
-"--src sparql.sql:4239\n";
+"--src sparql.sql:4770\n";
 
-static const char *proc146 = 
+static const char *proc167 = 
+"#line 4779 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_ACC (inout _env any, inout one any)\n"
 "{\n"
 "_env := 1;\n"
 "}\n"
-"--src sparql.sql:4246\n";
+"--src sparql.sql:4777\n";
 
-static const char *proc147 = 
+static const char *proc168 = 
+"#line 4786 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_FIN (inout _env any) returns long varchar\n"
 "{\n"
 "declare ses any;\n"
@@ -4255,27 +4974,30 @@ static const char *proc147 =
 "</sparql>\', ses);\n"
 "return ses;\n"
 "}\n"
-"--src sparql.sql:4253\n";
+"--src sparql.sql:4784\n";
 
-static const char *other20 = 
+static const char *other22 = 
 "create aggregate DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML (inout one any) returns long varchar\n"
 "from DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_INIT, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_ACC, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_FIN\n";
 
-static const char *proc148 = 
+static const char *proc169 = 
+"#line 4808 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_INIT (inout _env any)\n"
 "{\n"
 "_env := 0;\n"
 "}\n"
-"--src sparql.sql:4275\n";
+"--src sparql.sql:4806\n";
 
-static const char *proc149 = 
+static const char *proc170 = 
+"#line 4815 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_ACC (inout _env any, inout one any)\n"
 "{\n"
 "_env := 1;\n"
 "}\n"
-"--src sparql.sql:4282\n";
+"--src sparql.sql:4813\n";
 
-static const char *proc150 = 
+static const char *proc171 = 
+"#line 4822 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_FIN (inout _env any) returns long varchar\n"
 "{\n"
 "declare ses any;\n"
@@ -4290,30 +5012,33 @@ static const char *proc150 =
 "xmlns:rs=\"http://www.w3.org/2005/sparql-results#\"\n"
 "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\" >\n"
 "<rs:results rdf:nodeID=\"rset\">\n"
-"<rs:boolean rdf:datatype=\"http://www.w3.org/2001/XMLSchema#boolean\">\' || ans || \'</rs:boolean></results></rdf:RDF>\', ses);\n"
+"<rs:boolean rdf:datatype=\"http://www.w3.org/2001/XMLSchema#boolean\">\' || ans || \'</rs:boolean></rs:results></rdf:RDF>\', ses);\n"
 "return ses;\n"
 "}\n"
-"--src sparql.sql:4289\n";
+"--src sparql.sql:4820\n";
 
-static const char *other21 = 
+static const char *other23 = 
 "create aggregate DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML (inout one any) returns long varchar\n"
 "from DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_INIT, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_ACC, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_FIN\n";
 
-static const char *proc151 = 
+static const char *proc172 = 
+"#line 4846 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_INIT (inout _env any)\n"
 "{\n"
 "_env := 0;\n"
 "}\n"
-"--src sparql.sql:4313\n";
+"--src sparql.sql:4844\n";
 
-static const char *proc152 = 
+static const char *proc173 = 
+"#line 4853 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_ACC (inout _env any, inout one any)\n"
 "{\n"
 "_env := 1;\n"
 "}\n"
-"--src sparql.sql:4320\n";
+"--src sparql.sql:4851\n";
 
-static const char *proc153 = 
+static const char *proc174 = 
+"#line 4860 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_FIN (inout _env any) returns long varchar\n"
 "{\n"
 "declare ses any;\n"
@@ -4328,13 +5053,14 @@ static const char *proc153 =
 "http (sprintf (\'[] rdf:type rs:results ; rs:boolean %s .\', ans), ses);\n"
 "return ses;\n"
 "}\n"
-"--src sparql.sql:4327\n";
+"--src sparql.sql:4858\n";
 
-static const char *other22 = 
+static const char *other24 = 
 "create aggregate DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL (inout one any) returns long varchar\n"
 "from DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_INIT, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_ACC, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_FIN\n";
 
-static const char *proc154 = 
+static const char *proc175 = 
+"#line 4881 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_FIN (inout _env any) returns long varchar\n"
 "{\n"
 "declare ses any;\n"
@@ -4347,13 +5073,38 @@ static const char *proc154 =
 "http (sprintf (\'_:_ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2005/sparql-results#results> .\\n_:_ <http://www.w3.org/2005/sparql-results#boolean> \"%s\"^^<http://www.w3.org/2001/XMLSchema#boolean> .\\n\', ans), ses);\n"
 "return ses;\n"
 "}\n"
-"--src sparql.sql:4348\n";
+"--src sparql.sql:4879\n";
 
-static const char *other23 = 
+static const char *other25 = 
 "create aggregate DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT (inout one any) returns long varchar\n"
-"from DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_INIT, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_ACC, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_FIN\n";
+"from DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_INIT,\n"
+"DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_ACC,\n"
+"DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_FIN\n";
 
-static const char *proc155 = 
+static const char *other26 = 
+"create aggregate DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL (inout one any) returns long varchar\n"
+"from DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_INIT, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_ACC, DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_FIN\n";
+
+static const char *proc176 = 
+"#line 4907 \"[executable]/sparql.sql\"\n"
+" create function DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_CSV_FIN (inout _env any) returns long varchar\n"
+"{\n"
+"declare ans varchar;\n"
+"if (isinteger (_env) and _env)\n"
+"return \'\"bool\"\\n1\\n\';\n"
+"else\n"
+"return \'\"bool\"\\n0\\n\';\n"
+"}\n"
+"--src sparql.sql:4905\n";
+
+static const char *other27 = 
+"create aggregate DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_CSV (inout one any) returns long varchar\n"
+"from DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_INIT,\n"
+"DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_ACC,\n"
+"DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_CSV_FIN\n";
+
+static const char *proc177 = 
+"#line 4926 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_INSERT_TRIPLES_CL (inout graph_iri any, inout triples any, in log_mode integer := null)\n"
 "{\n"
 "declare is_text, ctr, old_log_enable, l integer;\n"
@@ -4362,6 +5113,8 @@ static const char *proc155 =
 "is_text := 1;\n"
 "if (not isiri_id (graph_iri))\n"
 "graph_iri := iri_to_id (graph_iri);\n"
+"if (__rdf_graph_is_in_enabled_repl (graph_iri))\n"
+"DB.DBA.RDF_REPL_INSERT_TRIPLES (id_to_iri (graph_iri), triples);\n"
 "connection_set (\'g_iid\', graph_iri);\n"
 "ro_id_dict := dict_new ();\n"
 "connection_set (\'g_dict\', ro_id_dict);\n"
@@ -4408,9 +5161,10 @@ static const char *proc155 =
 "if (ro_id_dict is not null)\n"
 "DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH (graph_iri, ro_id_dict);\n"
 "}\n"
-"--src sparql.sql:4370\n";
+"--src sparql.sql:4924\n";
 
-static const char *proc156 = 
+static const char *proc178 = 
+"#line 4984 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_INSERT_TRIPLES (in graph_iri any, inout triples any, in log_mode integer := null)\n"
 "{\n"
 "declare ctr, old_log_enable integer;\n"
@@ -4419,6 +5173,8 @@ static const char *proc156 =
 "return RDF_INSERT_TRIPLES_CL (graph_iri, triples, log_mode);\n"
 "if (not isiri_id (graph_iri))\n"
 "graph_iri := iri_to_id (graph_iri);\n"
+"if (__rdf_graph_is_in_enabled_repl (graph_iri))\n"
+"DB.DBA.RDF_REPL_INSERT_TRIPLES (id_to_iri (graph_iri), triples);\n"
 "old_log_enable := log_enable (log_mode, 1);\n"
 "declare exit handler for sqlstate \'*\' { log_enable (old_log_enable, 1); resignal; };\n"
 "ro_id_dict := null;\n"
@@ -4461,14 +5217,17 @@ static const char *proc156 =
 "DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH (graph_iri, ro_id_dict);\n"
 "log_enable (old_log_enable, 1);\n"
 "}\n"
-"--src sparql.sql:4426\n";
+"--src sparql.sql:4982\n";
 
-static const char *proc157 = 
+static const char *proc179 = 
+"#line 5038 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_DELETE_TRIPLES (in graph_iri any, in triples any, in log_mode integer := null)\n"
 "{\n"
 "declare ctr, old_log_enable integer;\n"
 "if (not isiri_id (graph_iri))\n"
 "graph_iri := iri_to_id (graph_iri);\n"
+"if (__rdf_graph_is_in_enabled_repl (graph_iri))\n"
+"DB.DBA.RDF_REPL_DELETE_TRIPLES (id_to_iri (graph_iri), triples);\n"
 "old_log_enable := log_enable (log_mode, 1);\n"
 "declare exit handler for sqlstate \'*\' { log_enable (old_log_enable, 1); resignal; };\n"
 "for (ctr := length (triples) - 1; ctr >= 0; ctr := ctr - 1)\n"
@@ -4491,14 +5250,17 @@ static const char *proc157 =
 "}\n"
 "log_enable (old_log_enable, 1);\n"
 "}\n"
-"--src sparql.sql:4478\n";
+"--src sparql.sql:5036\n";
 
-static const char *proc158 = 
-"create procedure DB.DBA.RDF_DELETE_TRIPLES_AGG (in graph_iri any, inout triples any, in log_mode integer := null)\n"
+static const char *proc180 = 
+"#line 5070 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_DELETE_TRIPLES_AGG (in graph_iid any, inout triples any, in log_mode integer := null)\n"
 "{\n"
 "declare ctr, old_log_enable, l integer;\n"
-"if (not isiri_id (graph_iri))\n"
-"graph_iri := iri_to_id (graph_iri);\n"
+"if (not isiri_id (graph_iid))\n"
+"graph_iid := iri_to_id (graph_iid);\n"
+"if (__rdf_graph_is_in_enabled_repl (graph_iid))\n"
+"DB.DBA.RDF_REPL_DELETE_TRIPLES (id_to_iri (graph_iid), triples);\n"
 "old_log_enable := log_enable (log_mode, 1);\n"
 "declare exit handler for sqlstate \'*\' { log_enable (old_log_enable, 1); resignal; };\n"
 "if (0 = sys_stat (\'cl_run_local_only\'))\n"
@@ -4520,7 +5282,7 @@ static const char *proc158 =
 "log_enable (bit_and (coalesce (log_mode, old_log_enable), 1), 1);\n"
 "dp := dpipe (0, \'__I2IDN\', \'__I2IDN\', \'O_LOOKN\');\n"
 "dpipe_set_rdf_load (dp, 3);\n"
-"connection_set (\'g_iid\', graph_iri);\n"
+"connection_set (\'g_iid\', graph_iid);\n"
 "l := length (triples);\n"
 "for (ctr := 0; ctr < l; ctr := ctr + 1)\n"
 "{\n"
@@ -4547,30 +5309,34 @@ static const char *proc158 =
 "{\n"
 "declare o_short any;\n"
 "o_short := DB.DBA.RDF_OBJ_OF_LONG (triples[ctr][2]);\n"
+"\n"
 "delete from DB.DBA.RDF_QUAD\n"
-"where G = graph_iri and S = triples[ctr][0] and P = triples[ctr][1] and O = o_short;\n"
+"where G = graph_iid and S = triples[ctr][0] and P = triples[ctr][1] and O = o_short;\n"
 "}\n"
 "log_enable (old_log_enable, 1);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:4508\n";
+"--src sparql.sql:5068\n";
 
-static const char *proc159 = 
+static const char *proc181 = 
+"#line 5134 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_MODIFY_TRIPLES (in graph_iri any, in del_triples any, in ins_triples any, in log_mode integer := null)\n"
 "{\n"
 "DB.DBA.RDF_DELETE_TRIPLES (graph_iri, del_triples, log_mode);\n"
 "DB.DBA.RDF_INSERT_TRIPLES (graph_iri, ins_triples, log_mode);\n"
 "}\n"
-"--src sparql.sql:4569\n";
+"--src sparql.sql:5132\n";
 
-static const char *proc160 = 
+static const char *proc182 = 
+"#line 5142 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.SPARQL_INS_OR_DEL_OR_MODIFY_CTOR_INIT (inout _env any)\n"
 "{\n"
 "_env := 0;\n"
 "}\n"
-"--src sparql.sql:4577\n";
+"--src sparql.sql:5140\n";
 
-static const char *proc161 = 
+static const char *proc183 = 
+"#line 5149 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.SPARQL_INS_OR_DEL_CTOR_IMPL (inout _env any, in graph_iri any, in opcodes any, in vars any, in log_mode integer, in ctor_op integer)\n"
 "{\n"
 "declare triple_ctr integer;\n"
@@ -4578,6 +5344,7 @@ static const char *proc161 =
 "declare action_ctr integer;\n"
 "declare old_log_enable integer;\n"
 "old_log_enable := log_enable (log_mode, 1);\n"
+"\n"
 "declare exit handler for sqlstate \'*\' { log_enable (old_log_enable, 1); resignal; };\n"
 "blank_ids := 0;\n"
 "action_ctr := 0;\n"
@@ -4658,9 +5425,10 @@ static const char *proc161 =
 "_env[ctor_op] := _env[ctor_op] + action_ctr;\n"
 "log_enable (old_log_enable, 1);\n"
 "}\n"
-"--src sparql.sql:4584\n";
+"--src sparql.sql:5147\n";
 
-static const char *proc162 = 
+static const char *proc184 = 
+"#line 5240 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.SPARQL_DELETE_CTOR_ACC (inout _env any, in graph_iri any, in opcodes any, in vars any, in uid integer, in log_mode integer)\n"
 "{\n"
 "if (not (isarray (_env)))\n"
@@ -4669,9 +5437,10 @@ static const char *proc162 =
 "__rgs_assert_cbk (graph_iri, uid, 2, \'SPARUL DELETE\');\n"
 "DB.DBA.SPARQL_INS_OR_DEL_CTOR_IMPL (_env, graph_iri, opcodes, vars, log_mode, 1);\n"
 "}\n"
-"--src sparql.sql:4674\n";
+"--src sparql.sql:5238\n";
 
-static const char *proc163 = 
+static const char *proc185 = 
+"#line 5251 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.SPARQL_INSERT_CTOR_ACC (inout _env any, in graph_iri any, in opcodes any, in vars any, in uid integer, in log_mode integer)\n"
 "{\n"
 "\n"
@@ -4681,9 +5450,10 @@ static const char *proc163 =
 "__rgs_assert_cbk (graph_iri, uid, 2, \'SPARUL INSERT\');\n"
 "DB.DBA.SPARQL_INS_OR_DEL_CTOR_IMPL (_env, graph_iri, opcodes, vars, log_mode, 2);\n"
 "}\n"
-"--src sparql.sql:4685\n";
+"--src sparql.sql:5249\n";
 
-static const char *proc164 = 
+static const char *proc186 = 
+"#line 5263 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.SPARQL_MODIFY_CTOR_ACC (inout _env any, in graph_iri any, in del_opcodes any, in ins_opcodes any, in vars any, in uid integer, in log_mode integer)\n"
 "{\n"
 "if (not (isarray (_env)))\n"
@@ -4693,9 +5463,10 @@ static const char *proc164 =
 "DB.DBA.SPARQL_INS_OR_DEL_CTOR_IMPL (_env, graph_iri, del_opcodes, vars, log_mode, 1);\n"
 "DB.DBA.SPARQL_INS_OR_DEL_CTOR_IMPL (_env, graph_iri, ins_opcodes, vars, log_mode, 2);\n"
 "}\n"
-"--src sparql.sql:4697\n";
+"--src sparql.sql:5261\n";
 
-static const char *proc165 = 
+static const char *proc187 = 
+"#line 5275 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.SPARQL_INS_OR_DEL_OR_MODIFY_CTOR_FIN (inout _env any)\n"
 "{\n"
 "if (isarray (_env))\n"
@@ -4716,21 +5487,22 @@ static const char *proc165 =
 "}\n"
 "return _env;\n"
 "}\n"
-"--src sparql.sql:4709\n";
+"--src sparql.sql:5273\n";
 
-static const char *other24 = 
+static const char *other28 = 
 " create aggregate DB.DBA.SPARQL_DELETE_CTOR (in graph_iri any, in opcodes any, in vars any, in uid integer, in log_mode integer) returns any\n"
 "from DB.DBA.SPARQL_INS_OR_DEL_OR_MODIFY_CTOR_INIT, DB.DBA.SPARQL_DELETE_CTOR_ACC, DB.DBA.SPARQL_INS_OR_DEL_OR_MODIFY_CTOR_FIN\n";
 
-static const char *other25 = 
+static const char *other29 = 
 " create aggregate DB.DBA.SPARQL_INSERT_CTOR (in graph_iri any, in opcodes any, in vars any, in uid integer, in log_mode integer) returns any\n"
 "from DB.DBA.SPARQL_INS_OR_DEL_OR_MODIFY_CTOR_INIT, DB.DBA.SPARQL_INSERT_CTOR_ACC, DB.DBA.SPARQL_INS_OR_DEL_OR_MODIFY_CTOR_FIN\n";
 
-static const char *other26 = 
+static const char *other30 = 
 " create aggregate DB.DBA.SPARQL_MODIFY_CTOR (in graph_iri any, in del_opcodes any, in ins_opcodes any, in vars any, in uid integer, in log_mode integer) returns any\n"
 "from DB.DBA.SPARQL_INS_OR_DEL_OR_MODIFY_CTOR_INIT, DB.DBA.SPARQL_MODIFY_CTOR_ACC, DB.DBA.SPARQL_INS_OR_DEL_OR_MODIFY_CTOR_FIN\n";
 
-static const char *proc166 = 
+static const char *proc188 = 
+"#line 5312 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.SPARQL_INSERT_DICT_CONTENT (in graph_iri any, in triples_dict any, in uid integer, in log_mode integer := null, in compose_report integer := 0) returns any\n"
 "{\n"
 "declare triples any;\n"
@@ -4750,14 +5522,22 @@ static const char *proc166 =
 "}\n"
 "if (isiri_id (graph_iri))\n"
 "graph_iri := id_to_iri (graph_iri);\n"
+"if (graph_iri is not null and __rdf_graph_is_in_enabled_repl (iri_to_id (graph_iri)))\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue ()\');\n"
 "if (compose_report)\n"
-"return sprintf (\'Insert into <%s>, %d triples -- done\', graph_iri, ins_count);\n"
+"{\n"
+"if (ins_count)\n"
+"return sprintf (\'Insert into <%s>, %d (or less) triples -- done\', graph_iri, ins_count);\n"
+"else\n"
+"return sprintf (\'Insert into <%s>, 0 triples -- nothing to do\', graph_iri);\n"
+"}\n"
 "else\n"
 "return ins_count;\n"
 "}\n"
-"--src sparql.sql:4746\n";
+"--src sparql.sql:5310\n";
 
-static const char *proc167 = 
+static const char *proc189 = 
+"#line 5345 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.SPARQL_DELETE_DICT_CONTENT (in graph_iri any, in triples_dict any, in uid integer, in log_mode integer := null, in compose_report integer := 0) returns any\n"
 "{\n"
 "declare triples any;\n"
@@ -4777,14 +5557,22 @@ static const char *proc167 =
 "}\n"
 "if (isiri_id (graph_iri))\n"
 "graph_iri := id_to_iri (graph_iri);\n"
+"if (graph_iri is not null and __rdf_graph_is_in_enabled_repl (iri_to_id (graph_iri)))\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue ()\');\n"
 "if (compose_report)\n"
-"return sprintf (\'Delete from <%s>, %d triples -- done\', graph_iri, del_count);\n"
+"{\n"
+"if (del_count)\n"
+"return sprintf (\'Delete from <%s>, %d (or less) triples -- done\', graph_iri, del_count);\n"
+"else\n"
+"return sprintf (\'Delete from <%s>, 0 triples -- nothing to do\', graph_iri);\n"
+"}\n"
 "else\n"
 "return del_count;\n"
 "}\n"
-"--src sparql.sql:4772\n";
+"--src sparql.sql:5343\n";
 
-static const char *proc168 = 
+static const char *proc190 = 
+"#line 5378 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.SPARQL_MODIFY_BY_DICT_CONTENTS (in graph_iri any, in del_triples_dict any, in ins_triples_dict any, in uid integer, in log_mode integer := null, in compose_report integer := 0) returns any\n"
 "{\n"
 "declare del_count, ins_count integer;\n"
@@ -4809,46 +5597,127 @@ static const char *proc168 =
 "}\n"
 "if (isiri_id (graph_iri))\n"
 "graph_iri := id_to_iri (graph_iri);\n"
+"if (graph_iri is not null and __rdf_graph_is_in_enabled_repl (iri_to_id (graph_iri)))\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue ()\');\n"
 "if (compose_report)\n"
-"return sprintf (\'Modify <%s>, delete %d and insert %d triples -- done\', graph_iri, del_count, ins_count);\n"
+"return sprintf (\'Modify <%s>, delete %d (or less) and insert %d (or less) triples -- done\', graph_iri, del_count, ins_count);\n"
 "else\n"
 "return del_count + ins_count;\n"
 "}\n"
-"--src sparql.sql:4798\n";
+"--src sparql.sql:5376\n";
 
-static const char *proc169 = 
+static const char *proc191 = 
+"#line 5412 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_REPL_DEL (inout rquads any)\n"
+"{\n"
+"declare rquads_ctr, rquads_count, opcode integer;\n"
+"declare g_iri, prev_g_iri varchar;\n"
+"declare g_iid varchar;\n"
+"declare ro_id_dict, app_env any;\n"
+"rquads_count := length (rquads);\n"
+"prev_g_iri := \'\';\n"
+"for (rquads_ctr := 0; rquads_ctr < rquads_count; rquads_ctr := rquads_ctr + 1)\n"
+"{\n"
+"\n"
+"g_iri := rquads[rquads_ctr][1];\n"
+"if (g_iri <> prev_g_iri)\n"
+"{\n"
+"g_iid := iri_to_id (g_iri);\n"
+"\n"
+"prev_g_iri := g_iri;\n"
+"}\n"
+"opcode := rquads[rquads_ctr][0];\n"
+"if (0 = opcode)\n"
+"{\n"
+"delete from DB.DBA.RDF_QUAD\n"
+"where G = g_iid and S = iri_to_id_repl (rquads[rquads_ctr][2]) and P = iri_to_id_repl (rquads[rquads_ctr][3])\n"
+"and O = DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL (rquads[rquads_ctr][4]);\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
+"__rdf_repl_quad (160 + opcode, g_iri, rquads[rquads_ctr][2], rquads[rquads_ctr][3], rquads[rquads_ctr][4]);\n"
+"}\n"
+"else if (1 = opcode)\n"
+"{\n"
+"declare obj any;\n"
+"if (isgeometry (rquads[rquads_ctr][4]))\n"
+"{\n"
+"obj := rdf_box (rquads[rquads_ctr][4], 256, 257, 0, 1);\n"
+"rdf_geo_set_id (obj);\n"
+"}\n"
+"else\n"
+"obj := DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL (rquads[rquads_ctr][4], iri_to_id_repl (rquads[rquads_ctr][5]), null);\n"
+"delete from DB.DBA.RDF_QUAD\n"
+"where G = g_iid and S = iri_to_id_repl (rquads[rquads_ctr][2]) and P = iri_to_id_repl (rquads[rquads_ctr][3]) and O = obj;\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
+"__rdf_repl_quad (160 + opcode, g_iri, rquads[rquads_ctr][2], rquads[rquads_ctr][3], rquads[rquads_ctr][4], rquads[rquads_ctr][5], null);\n"
+"}\n"
+"else if (2 = opcode)\n"
+"{\n"
+"delete from DB.DBA.RDF_QUAD\n"
+"where G = g_iid and S = iri_to_id_repl (rquads[rquads_ctr][2]) and P = iri_to_id_repl (rquads[rquads_ctr][3])\n"
+"and O = DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL (rquads[rquads_ctr][4], null, rquads[rquads_ctr][5]);\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
+"__rdf_repl_quad (160 + opcode, g_iri, rquads[rquads_ctr][2], rquads[rquads_ctr][3], rquads[rquads_ctr][4], null, rquads[rquads_ctr][5]);\n"
+"}\n"
+"else if (4 = opcode)\n"
+"{\n"
+"delete from DB.DBA.RDF_QUAD\n"
+"where G = g_iid and S = iri_to_id_repl (rquads[rquads_ctr][2]) and P = iri_to_id_repl (rquads[rquads_ctr][3])\n"
+"and O = iri_to_id_repl (rquads[rquads_ctr][4]);\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
+"__rdf_repl_quad (160 + opcode, g_iri, rquads[rquads_ctr][2], rquads[rquads_ctr][3], rquads[rquads_ctr][4]);\n"
+"}\n"
+"\n"
+"\n"
+"}\n"
+"app_env := vector (1, null);\n"
+"DB.DBA.TTLP_EV_COMMIT (g_iri, app_env);\n"
+"\n"
+"\n"
+"connection_set (\'g_dict\', null);\n"
+"commit work;\n"
+"}\n"
+"--src sparql.sql:5410\n";
+
+static const char *proc192 = 
+"#line 5485 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.SPARUL_CLEAR (in graph_iri any, in inside_sponge integer, in uid integer := 0, in log_mode integer := null, in compose_report integer := 0) returns any\n"
 "{\n"
 "declare g any;\n"
+"declare g_iid IRI_ID;\n"
 "declare old_log_enable integer;\n"
 "g := graph_iri;\n"
 "if (isiri_id (g))\n"
 "g := id_to_iri (g);\n"
+"g_iid := iri_to_id (g);\n"
 "__rgs_assert_cbk (graph_iri, uid, 2, \'SPARUL CLEAR GRAPH\');\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
+"{\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue()\');\n"
+"repl_text (\'__rdf_repl\', \'sparql define input:storage \"\" clear graph iri ( ?? )\', g);\n"
+"}\n"
 "old_log_enable := log_enable (log_mode, 1);\n"
 "declare exit handler for sqlstate \'*\' { log_enable (old_log_enable, 1); resignal; };\n"
 "exec (sprintf (\'\n"
 "delete from DB.DBA.RDF_QUAD\n"
 "where G = __i2id (\'\'%S\'\') \', g));\n"
 "delete from DB.DBA.RDF_OBJ_RO_FLAGS_WORDS\n"
-"where VT_WORD = rdf_graph_keyword (iri_to_id (graph_iri));\n"
-"if (isiri_id (graph_iri))\n"
-"graph_iri := id_to_iri (graph_iri);\n"
+"where VT_WORD = rdf_graph_keyword (g_iid);\n"
 "if (not inside_sponge)\n"
 "{\n"
-"delete from DB.DBA.SYS_HTTP_SPONGE where HS_LOCAL_IRI = graph_iri;\n"
-"delete from DB.DBA.SYS_HTTP_SPONGE where HS_LOCAL_IRI like concat (\'destMD5=\', md5 (graph_iri), \'&graphMD5=%\');\n"
+"delete from DB.DBA.SYS_HTTP_SPONGE where HS_LOCAL_IRI = g;\n"
+"delete from DB.DBA.SYS_HTTP_SPONGE where HS_LOCAL_IRI like concat (\'destMD5=\', md5 (g), \'&graphMD5=%\');\n"
 "}\n"
 "/*091202 commit work; */\n"
 "log_enable (old_log_enable, 1);\n"
 "if (compose_report)\n"
-"return sprintf (\'Clear <%s> -- done\', graph_iri);\n"
+"return sprintf (\'Clear <%s> -- done\', g);\n"
 "else\n"
 "return 1;\n"
 "}\n"
-"--src sparql.sql:4832\n";
+"--src sparql.sql:5483\n";
 
-static const char *proc170 = 
+static const char *proc193 = 
+"#line 5521 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.SPARUL_LOAD (in graph_iri any, in resource varchar, in uid integer, in log_mode integer, in compose_report integer) returns any\n"
 "{\n"
 "declare old_log_enable integer;\n"
@@ -4888,14 +5757,19 @@ static const char *proc170 =
 "return 0;\n"
 "}\n"
 "}\n"
-"--src sparql.sql:4863\n";
+"--src sparql.sql:5519\n";
 
-static const char *proc171 = 
+static const char *proc194 = 
+"#line 5562 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.SPARUL_CREATE (in graph_iri any, in silent integer, in uid integer, in log_mode integer, in compose_report integer) returns any\n"
 "{\n"
+"declare g_iid IRI_ID;\n"
 "declare old_log_enable integer;\n"
 "__rgs_assert_cbk (graph_iri, uid, 2, \'SPARUL CREATE GRAPH\');\n"
-"if (exists (select top 1 1 from DB.DBA.RDF_EXPLICITLY_CREATED_GRAPH where REC_GRAPH_IID = iri_to_id (graph_iri)))\n"
+"g_iid := iri_to_id (graph_iri);\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
+"repl_text (\'__rdf_repl\', \'sparql define input:storage \"\" create graph iri ( ?? )\', graph_iri);\n"
+"if (exists (select top 1 1 from DB.DBA.RDF_EXPLICITLY_CREATED_GRAPH where REC_GRAPH_IID = g_iid))\n"
 "{\n"
 "if (silent)\n"
 "{\n"
@@ -4935,13 +5809,21 @@ static const char *proc171 =
 "else\n"
 "return 1;\n"
 "}\n"
-"--src sparql.sql:4904\n";
+"--src sparql.sql:5560\n";
 
-static const char *proc172 = 
+static const char *proc195 = 
+"#line 5612 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.SPARUL_DROP (in graph_iri any, in silent integer, in uid integer, in log_mode integer, in compose_report integer) returns any\n"
 "{\n"
+"declare g_iid IRI_ID;\n"
 "declare old_log_enable integer;\n"
 "__rgs_assert_cbk (graph_iri, uid, 2, \'SPARUL DROP GRAPH\');\n"
+"g_iid := iri_to_id (graph_iri);\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
+"{\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue()\');\n"
+"repl_text (\'__rdf_repl\', \'sparql define input:storage \"\" drop graph iri ( ?? )\', graph_iri);\n"
+"}\n"
 "old_log_enable := log_enable (log_mode, 1);\n"
 "declare exit handler for sqlstate \'*\' { log_enable (old_log_enable, 1); resignal; };\n"
 "if (not exists (select top 1 1 from DB.DBA.RDF_EXPLICITLY_CREATED_GRAPH where REC_GRAPH_IID = iri_to_id (graph_iri)))\n"
@@ -4989,9 +5871,10 @@ static const char *proc172 =
 "else\n"
 "return 1;\n"
 "}\n"
-"--src sparql.sql:4950\n";
+"--src sparql.sql:5610\n";
 
-static const char *proc173 = 
+static const char *proc196 = 
+"#line 5672 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.SPARUL_RUN (in results any, in compose_report integer := 0) returns any\n"
 "{\n"
 "\n"
@@ -5017,9 +5900,10 @@ static const char *proc173 =
 "return res;\n"
 "}\n"
 "}\n"
-"--src sparql.sql:5003\n";
+"--src sparql.sql:5670\n";
 
-static const char *proc174 = 
+static const char *proc197 = 
+"#line 5699 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS (in return_iris integer := 1, in lim integer := 2000000000)\n"
 "{\n"
 "declare specials, specials_vec any;\n"
@@ -5106,9 +5990,10 @@ static const char *proc174 =
 "else\n"
 "result (specials[ctr]);\n"
 "}\n"
-"--src sparql.sql:5030\n";
+"--src sparql.sql:5697\n";
 
-static const char *proc175 = 
+static const char *proc198 = 
+"#line 5791 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_REGEX (in s varchar, in p varchar, in coll varchar := null)\n"
 "{\n"
 "if (not iswidestring (s) and not isstring (s))\n"
@@ -5117,9 +6002,10 @@ static const char *proc175 =
 "return 1;\n"
 "return 0;\n"
 "}\n"
-"--src sparql.sql:5122\n";
+"--src sparql.sql:5789\n";
 
-static const char *proc176 = 
+static const char *proc199 = 
+"#line 5802 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_LANGMATCHES (in r varchar, in t varchar)\n"
 "{\n"
 "if ((t is null) or (r is null))\n"
@@ -5138,16 +6024,18 @@ static const char *proc176 =
 "return 1;\n"
 "return 0;\n"
 "}\n"
-"--src sparql.sql:5133\n";
+"--src sparql.sql:5800\n";
 
-static const char *proc177 = 
+static const char *proc200 = 
+"#line 5823 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.BEST_LANGMATCH_INIT (inout env any)\n"
 "{\n"
 "env := vector (0, -2);\n"
 "}\n"
-"--src sparql.sql:5154\n";
+"--src sparql.sql:5821\n";
 
-static const char *proc178 = 
+static const char *proc201 = 
+"#line 5830 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.BEST_LANGMATCH_ACC (inout env any, inout obj any, in range varchar, in dflt_lang varchar)\n"
 "{\n"
 "declare lang varchar;\n"
@@ -5184,31 +6072,34 @@ static const char *proc178 =
 "if (env[1] < pct)\n"
 "env := vector (obj, pct);\n"
 "}\n"
-"--src sparql.sql:5161\n";
+"--src sparql.sql:5828\n";
 
-static const char *proc179 = 
+static const char *proc202 = 
+"#line 5869 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.BEST_LANGMATCH_FINAL (inout env any) returns any\n"
 "{\n"
 "if (__tag (env) <> __tag of vector)\n"
 "return null;\n"
 "return env[0];\n"
 "}\n"
-"--src sparql.sql:5200\n";
+"--src sparql.sql:5867\n";
 
-static const char *other27 = 
+static const char *other31 = 
 " create aggregate DB.DBA.BEST_LANGMATCH (inout obj any, in range varchar, in dflt_lang varchar) from\n"
 "DB.DBA.BEST_LANGMATCH_INIT,\n"
 "DB.DBA.BEST_LANGMATCH_ACC,\n"
 "DB.DBA.BEST_LANGMATCH_FINAL\n";
 
-static const char *proc180 = 
+static const char *proc203 = 
+"#line 5885 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.SPARQL_CONSTRUCT_INIT (inout _env any)\n"
 "{\n"
 "_env := 0;\n"
 "}\n"
-"--src sparql.sql:5216\n";
+"--src sparql.sql:5883\n";
 
-static const char *proc181 = 
+static const char *proc204 = 
+"#line 5892 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.SPARQL_CONSTRUCT_ACC (inout _env any, in opcodes any, in vars any, in stats any, in use_dict_limit integer)\n"
 "{\n"
 "declare triple_ctr integer;\n"
@@ -5303,29 +6194,32 @@ static const char *proc181 =
 "end_of_adding_triple: ;\n"
 "}\n"
 "}\n"
-"--src sparql.sql:5223\n";
+"--src sparql.sql:5890\n";
 
-static const char *proc182 = 
+static const char *proc205 = 
+"#line 5989 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.SPARQL_CONSTRUCT_FIN (inout _env any)\n"
 "{\n"
 "if (214 <> __tag(_env))\n"
 "_env := dict_new ();\n"
 "return _env;\n"
 "}\n"
-"--src sparql.sql:5320\n";
+"--src sparql.sql:5987\n";
 
-static const char *other28 = 
+static const char *other32 = 
 " create aggregate DB.DBA.SPARQL_CONSTRUCT (in opcodes any, in vars any, in stats any, in use_dict_limit integer) returns any\n"
 "from DB.DBA.SPARQL_CONSTRUCT_INIT, DB.DBA.SPARQL_CONSTRUCT_ACC, DB.DBA.SPARQL_CONSTRUCT_FIN\n";
 
-static const char *proc183 = 
+static const char *proc206 = 
+"#line 6002 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.SPARQL_DESC_AGG_INIT (inout _env any)\n"
 "{\n"
 "_env := 0;\n"
 "}\n"
-"--src sparql.sql:5333\n";
+"--src sparql.sql:6000\n";
 
-static const char *proc184 = 
+static const char *proc207 = 
+"#line 6008 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.SPARQL_DESC_AGG_ACC (inout _env any, in vars any)\n"
 "{\n"
 "declare var_ctr integer;\n"
@@ -5342,9 +6236,10 @@ static const char *proc184 =
 "dict_put (_env, i, 0);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:5339\n";
+"--src sparql.sql:6006\n";
 
-static const char *proc185 = 
+static const char *proc208 = 
+"#line 6026 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.SPARQL_DESC_AGG_FIN (inout _env any)\n"
 "{\n"
 "declare subjects, options, res any;\n"
@@ -5353,23 +6248,25 @@ static const char *proc185 =
 "return dict_new ();\n"
 "return _env;\n"
 "}\n"
-"--src sparql.sql:5357\n";
+"--src sparql.sql:6024\n";
 
-static const char *other29 = 
+static const char *other33 = 
 "create aggregate DB.DBA.SPARQL_DESC_AGG (in vars any) returns any\n"
 "from DB.DBA.SPARQL_DESC_AGG_INIT, DB.DBA.SPARQL_DESC_AGG_ACC, DB.DBA.SPARQL_DESC_AGG_FIN\n";
 
-static const char *proc186 = 
+static const char *proc209 = 
+"#line 6040 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.SPARQL_DESC_DICT (in subj_dict any, in consts any, in good_graphs any, in bad_graphs any, in storage_name any, in options any)\n"
 "{\n"
 "declare all_subj_descs, phys_subjects, sorted_good_graphs, sorted_bad_graphs, g_dict, res any;\n"
 "declare uid, graphs_listed, g_ctr, good_g_count, bad_g_count, s_ctr, all_s_count, phys_s_count integer;\n"
-"declare gs_app_callback, gs_app_uid varchar;\n"
+"declare gs_app_callback, gs_app_uid, inf_ruleset varchar;\n"
 "declare rdf_type_iid IRI_ID;\n"
 "uid := get_keyword (\'uid\', options, http_nobody_uid());\n"
 "gs_app_callback := get_keyword (\'gs-app-callback\', options);\n"
 "if (gs_app_callback is not null)\n"
 "gs_app_uid := get_keyword (\'gs-app-uid\', options);\n"
+"inf_ruleset := get_keyword (\'inference\', options);\n"
 "rdf_type_iid := iri_to_id (UNAME\'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\');\n"
 "res := dict_new ();\n"
 "if (isinteger (consts))\n"
@@ -5413,7 +6310,7 @@ static const char *proc186 =
 "vectorbld_init (phys_subjects);\n"
 "if (isinteger (storage_name))\n"
 "storage_name := \'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage\';\n"
-"else if (\'\' = storage_name)\n"
+"else if ((\'\' = storage_name) and (inf_ruleset is null))\n"
 "{\n"
 "for (s_ctr := 0; s_ctr < all_s_count; s_ctr := s_ctr + 1)\n"
 "{\n"
@@ -5440,7 +6337,7 @@ static const char *proc186 =
 "maps := sparql_quad_maps_for_quad (NULL, s, NULL, NULL, storage_name, case (graphs_listed) when 0 then vector() else sorted_good_graphs end, sorted_bad_graphs);\n"
 "\n"
 "maps_len := length (maps);\n"
-"if ((maps_len > 0) and (maps[maps_len-1][0] = UNAME\'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadMap\'))\n"
+"if ((maps_len > 0) and (inf_ruleset is null) and (maps[maps_len-1][0] = UNAME\'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadMap\'))\n"
 "{\n"
 "if (isiri_id (s))\n"
 "{\n"
@@ -5475,12 +6372,12 @@ static const char *proc186 =
 "s := s_desc[0];\n"
 "maps := s_desc[1];\n"
 "maps_len := length (maps);\n"
-"fname := sprintf (\'SPARQL_DESC_DICT_QMV1_%U\', md5 (storage_name || cast (graphs_listed as varchar) || md5_box (maps) || md5_box (sorted_bad_graphs)));\n"
+"fname := sprintf (\'SPARQL_DESC_DICT_QMV1_%U\', md5 (storage_name || inf_ruleset || cast (graphs_listed as varchar) || md5_box (maps) || md5_box (sorted_bad_graphs)));\n"
 "if (not exists (select top 1 1 from Db.DBA.SYS_PROCEDURES where P_NAME = \'DB.DBA.\' || fname))\n"
 "{\n"
 "declare ses, txt, saved_user any;\n"
 "ses := string_output ();\n"
-"http (\'create procedure DB.DBA.\"\' || fname || \'\" (in subj any, inout res any\', ses);\n"
+"http (\'create procedure DB.DBA.\"\' || fname || \'\" (in subj any, in res any\', ses);\n"
 "if (graphs_listed)\n"
 "http (\', inout sorted_good_graphs any\', ses);\n"
 "http (\')\\n\', ses);\n"
@@ -5492,6 +6389,8 @@ static const char *proc186 =
 "{\n"
 "http (\'  define input:named-graph-exclude <\' || id_to_iri_nosignal (g) || \'>\\n\', ses);\n"
 "}\n"
+"if (inf_ruleset is not null)\n"
+"http (\'  define input:inference <\' || inf_ruleset || \'>\\n\', ses);\n"
 "http (\'select ?g1 ?p1 ?o1\\n\', ses);\n"
 "http (\'      where { graph ?g1 {\\n\', ses);\n"
 "for (map_ctr := 0; map_ctr < maps_len; map_ctr := map_ctr + 1)\n"
@@ -5499,7 +6398,7 @@ static const char *proc186 =
 "if (map_ctr > 0) http (\'              union\\n\', ses);\n"
 "http (\'              { quad map <\' || maps[map_ctr][0] || \'> { ?:subj_iri ?p1 ?o1 } }\\n\', ses);\n"
 "}\n"
-"http (\'            } } ) do { \', ses);\n"
+"http (\'            } } ) do {\\n\', ses);\n"
 "if (graphs_listed)\n"
 "http (\'      if (position (__i2idn (\"g1\"), sorted_good_graphs))\\n\', ses);\n"
 "http (\'      dict_put (res, vector (subj, \"p1\", \"o1\"), 1); } }\\n\', ses);\n"
@@ -5625,19 +6524,21 @@ static const char *proc186 =
 "\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:5371\n";
+"--src sparql.sql:6038\n";
 
-static const char *proc187 = 
+static const char *proc210 = 
+"#line 6310 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.SPARQL_DESC_DICT_SPO (in subj_dict any, in consts any, in good_graphs any, in bad_graphs any, in storage_name any, in options any)\n"
 "{\n"
 "declare all_subj_descs, phys_subjects, sorted_good_graphs, sorted_bad_graphs, res any;\n"
 "declare uid, graphs_listed, g_ctr, good_g_count, bad_g_count, s_ctr, all_s_count, phys_s_count integer;\n"
-"declare gs_app_callback, gs_app_uid varchar;\n"
+"declare gs_app_callback, gs_app_uid, inf_ruleset varchar;\n"
 "declare rdf_type_iid IRI_ID;\n"
 "uid := get_keyword (\'uid\', options, http_nobody_uid());\n"
 "gs_app_callback := get_keyword (\'gs-app-callback\', options);\n"
 "if (gs_app_callback is not null)\n"
 "gs_app_uid := get_keyword (\'gs-app-uid\', options);\n"
+"inf_ruleset := get_keyword (\'inference\', options);\n"
 "rdf_type_iid := iri_to_id (UNAME\'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\');\n"
 "res := dict_new ();\n"
 "if (isinteger (consts))\n"
@@ -5681,7 +6582,7 @@ static const char *proc187 =
 "vectorbld_init (phys_subjects);\n"
 "if (isinteger (storage_name))\n"
 "storage_name := \'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage\';\n"
-"else if (\'\' = storage_name)\n"
+"else if ((\'\' = storage_name) and (inf_ruleset is null))\n"
 "{\n"
 "for (s_ctr := 0; s_ctr < all_s_count; s_ctr := s_ctr + 1)\n"
 "{\n"
@@ -5708,7 +6609,7 @@ static const char *proc187 =
 "maps := sparql_quad_maps_for_quad (NULL, s, NULL, NULL, storage_name, case (graphs_listed) when 0 then vector() else sorted_good_graphs end, sorted_bad_graphs);\n"
 "\n"
 "maps_len := length (maps);\n"
-"if ((maps_len > 0) and (maps[maps_len-1][0] = UNAME\'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadMap\'))\n"
+"if ((maps_len > 0) and (inf_ruleset is null) and (maps[maps_len-1][0] = UNAME\'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadMap\'))\n"
 "{\n"
 "if (isiri_id (s))\n"
 "{\n"
@@ -5743,12 +6644,12 @@ static const char *proc187 =
 "s := s_desc[0];\n"
 "maps := s_desc[1];\n"
 "maps_len := length (maps);\n"
-"fname := sprintf (\'SPARQL_DESC_DICT_QMV1_%U\', md5 (storage_name || cast (graphs_listed as varchar) || md5_box (maps) || md5_box (sorted_bad_graphs)));\n"
+"fname := sprintf (\'SPARQL_DESC_DICT_QMV1_%U\', md5 (storage_name || inf_ruleset || cast (graphs_listed as varchar) || md5_box (maps) || md5_box (sorted_bad_graphs)));\n"
 "if (not exists (select top 1 1 from Db.DBA.SYS_PROCEDURES where P_NAME = \'DB.DBA.\' || fname))\n"
 "{\n"
 "declare ses, txt, saved_user any;\n"
 "ses := string_output ();\n"
-"http (\'create procedure DB.DBA.\"\' || fname || \'\" (in subj any, inout res any\', ses);\n"
+"http (\'create procedure DB.DBA.\"\' || fname || \'\" (in subj any, in res any\', ses);\n"
 "if (graphs_listed)\n"
 "http (\', inout sorted_good_graphs any\', ses);\n"
 "http (\')\\n\', ses);\n"
@@ -5760,6 +6661,8 @@ static const char *proc187 =
 "{\n"
 "http (\'  define input:named-graph-exclude <\' || id_to_iri_nosignal (g) || \'>\\n\', ses);\n"
 "}\n"
+"if (inf_ruleset is not null)\n"
+"http (\'  define input:inference <\' || inf_ruleset || \'>\\n\', ses);\n"
 "http (\'select ?g1 ?p1 ?o1\\n\', ses);\n"
 "http (\'      where { graph ?g1 {\\n\', ses);\n"
 "for (map_ctr := 0; map_ctr < maps_len; map_ctr := map_ctr + 1)\n"
@@ -5767,9 +6670,9 @@ static const char *proc187 =
 "if (map_ctr > 0) http (\'              union\\n\', ses);\n"
 "http (\'              { quad map <\' || maps[map_ctr][0] || \'> { ?:subj_iri ?p1 ?o1 } }\\n\', ses);\n"
 "}\n"
-"http (\'            } } ) do { \', ses);\n"
+"http (\'            } } ) do {\\n\', ses);\n"
 "if (graphs_listed)\n"
-"http (\'      if (position (\"g1\", sorted_good_graphs))\\n\', ses);\n"
+"http (\'      if (position (__i2idn (\"g1\"), sorted_good_graphs))\\n\', ses);\n"
 "http (\'      dict_put (res, vector (subj, \"p1\", \"o1\"), 1); } }\\n\', ses);\n"
 "txt := string_output_string (ses);\n"
 "\n"
@@ -5835,9 +6738,10 @@ static const char *proc187 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:5638\n";
+"--src sparql.sql:6308\n";
 
-static const char *proc188 = 
+static const char *proc211 = 
+"#line 6522 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.SPARQL_DESC_DICT_SPO_PHYSICAL (in subj_dict any, in consts any, in good_graphs any, in bad_graphs any, in storage_name any, in options any)\n"
 "{\n"
 "declare all_subj_descs, phys_subjects, sorted_good_graphs, sorted_bad_graphs, g_dict, res any;\n"
@@ -5997,19 +6901,21 @@ static const char *proc188 =
 "\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:5847\n";
+"--src sparql.sql:6520\n";
 
-static const char *proc189 = 
+static const char *proc212 = 
+"#line 6683 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.SPARQL_DESC_DICT_CBD (in subj_dict any, in consts any, in good_graphs any, in bad_graphs any, in storage_name any, in options any)\n"
 "{\n"
 "declare all_subjs, phys_subjects, sorted_good_graphs, sorted_bad_graphs, next_iter_subjs, res any;\n"
 "declare uid, graphs_listed, g_ctr, good_g_count, bad_g_count, s_ctr, all_s_count, phys_s_count integer;\n"
-"declare gs_app_callback, gs_app_uid varchar;\n"
+"declare gs_app_callback, gs_app_uid, inf_ruleset varchar;\n"
 "declare rdf_type_iid IRI_ID;\n"
 "uid := get_keyword (\'uid\', options, http_nobody_uid());\n"
 "gs_app_callback := get_keyword (\'gs-app-callback\', options);\n"
 "if (gs_app_callback is not null)\n"
 "gs_app_uid := get_keyword (\'gs-app-uid\', options);\n"
+"inf_ruleset := get_keyword (\'inference\', options);\n"
 "rdf_type_iid := iri_to_id (UNAME\'http://www.w3.org/1999/02/22-rdf-syntax-ns#type\');\n"
 "res := dict_new ();\n"
 "if (isinteger (consts))\n"
@@ -6058,7 +6964,7 @@ static const char *proc189 =
 "vectorbld_init (phys_subjects);\n"
 "if (isinteger (storage_name))\n"
 "storage_name := \'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage\';\n"
-"else if (\'\' = storage_name)\n"
+"else if ((\'\' = storage_name) and (inf_ruleset is null))\n"
 "{\n"
 "for (s_ctr := 0; s_ctr < all_s_count; s_ctr := s_ctr + 1)\n"
 "{\n"
@@ -6085,7 +6991,7 @@ static const char *proc189 =
 "maps := sparql_quad_maps_for_quad (NULL, s, NULL, NULL, storage_name, case (graphs_listed) when 0 then vector() else sorted_good_graphs end, sorted_bad_graphs);\n"
 "\n"
 "maps_len := length (maps);\n"
-"if ((maps_len > 0) and (maps[maps_len-1][0] = UNAME\'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadMap\'))\n"
+"if ((maps_len > 0) and (inf_ruleset is null) and (maps[maps_len-1][0] = UNAME\'http://www.openlinksw.com/schemas/virtrdf#DefaultQuadMap\'))\n"
 "{\n"
 "if (isiri_id (s))\n"
 "{\n"
@@ -6120,12 +7026,12 @@ static const char *proc189 =
 "s := s_desc[0];\n"
 "maps := s_desc[1];\n"
 "maps_len := length (maps);\n"
-"fname := sprintf (\'SPARQL_DESC_DICT_CBD_QMV1_%U\', md5 (storage_name || cast (graphs_listed as varchar) || md5_box (maps) || md5_box (sorted_bad_graphs)));\n"
+"fname := sprintf (\'SPARQL_DESC_DICT_CBD_QMV1_%U\', md5 (storage_name || inf_ruleset || cast (graphs_listed as varchar) || md5_box (maps) || md5_box (sorted_bad_graphs)));\n"
 "if (not exists (select top 1 1 from Db.DBA.SYS_PROCEDURES where P_NAME = \'DB.DBA.\' || fname))\n"
 "{\n"
 "declare ses, txt, saved_user any;\n"
 "ses := string_output ();\n"
-"http (\'create procedure DB.DBA.\"\' || fname || \'\" (in subj any, inout subj_dict any, inout next_iter_subjs any, inout res any\', ses);\n"
+"http (\'create procedure DB.DBA.\"\' || fname || \'\" (in subj any, in subj_dict any, in next_iter_subjs any, in res any\', ses);\n"
 "if (graphs_listed)\n"
 "http (\', inout sorted_good_graphs any\', ses);\n"
 "http (\')\\n\', ses);\n"
@@ -6137,6 +7043,8 @@ static const char *proc189 =
 "{\n"
 "http (\'  define input:named-graph-exclude <\' || id_to_iri_nosignal (g) || \'>\\n\', ses);\n"
 "}\n"
+"if (inf_ruleset is not null)\n"
+"http (\'  define input:inference <\' || inf_ruleset || \'>\\n\', ses);\n"
 "http (\'select ?g1 ?p1 ?o1 ?g2 ?st2\\n\', ses);\n"
 "http (\'      where { graph ?g1 {\\n\', ses);\n"
 "for (map_ctr := 0; map_ctr < maps_len; map_ctr := map_ctr + 1)\n"
@@ -6147,20 +7055,19 @@ static const char *proc189 =
 "http (\'            }\\n\', ses);\n"
 "http (\'          optional { graph ?g2 {\\n\', ses);\n"
 "http (\'                  ?st2 a rdf:Statement ; rdf:subject ?:subj_iri ; rdf:predicate ?p1 ; rdf:object ?o1 } }\\n\', ses);\n"
-"http (\' } ) do { \', ses);\n"
-"http (\'            } } ) do { \', ses);\n"
+"http (\'            } ) do {\\n\', ses);\n"
 "if (graphs_listed)\n"
-"http (\'      if (position (\"g1\", sorted_good_graphs)) {\\n\', ses);\n"
+"http (\'      if (position (__i2idn (\"g1\"), sorted_good_graphs)) {\\n\', ses);\n"
 "http (\'      dict_put (res, vector (subj, \"p1\", \"o1\"), 1);\\n\', ses);\n"
 "http (\'      if (isiri_id (\"o1\") and \"o1\" > min_bnode_iri_id() and dict_get (subj_dict, \"o1\") is null)\\n\', ses);\n"
 "http (\'        dict_put (next_iter_subjs, \"o1\", 1);\\n\', ses);\n"
 "if (graphs_listed)\n"
-"http (\'      if (position (\"g2\", sorted_good_graphs)) {\\n\', ses);\n"
+"http (\'      if (position (__i2idn (\"g2\"), sorted_good_graphs)) {\\n\', ses);\n"
 "http (\'      if (\"st2\" is not null and dict_get (subj_dict, \"st2\") is null)\\n\', ses);\n"
 "http (\'        dict_put (next_iter_subjs, \"o1\", 1);\\n\', ses);\n"
 "if (graphs_listed)\n"
 "http (\'        } }\\n\', ses);\n"
-"http (\'      } } }\\n\', ses);\n"
+"http (\'      } }\\n\', ses);\n"
 "txt := string_output_string (ses);\n"
 "\n"
 "saved_user := user;\n"
@@ -6212,7 +7119,7 @@ static const char *proc189 =
 "?st2 a rdf:Statement ; rdf:subject ?:subj ; rdf:predicate ?:p1 ; rdf:object ?:obj1 } } ) do\n"
 "{\n"
 "if (position (\"g2\", sorted_good_graphs) and dict_get (subj_dict, \"st2\") is null)\n"
-"dict_put (next_iter_subjs, st2, 1);\n"
+"dict_put (next_iter_subjs, \"st2\", 1);\n"
 "}\n"
 "}\n"
 "}\n"
@@ -6243,7 +7150,7 @@ static const char *proc189 =
 "dict_get (subj_dict, \"st2\") is null and\n"
 "__rgs_ack_cbk (\"g2\", uid, 1) and\n"
 "(gs_app_callback is null or bit_and (1, call (gs_app_callback) (\"g2\", gs_app_uid))) )\n"
-"dict_put (next_iter_subjs, st2, 1);\n"
+"dict_put (next_iter_subjs, \"st2\", 1);\n"
 "}\n"
 "}\n"
 "}\n"
@@ -6258,9 +7165,10 @@ static const char *proc189 =
 "foreach (IRI_ID s in all_subjs) do dict_put (subj_dict, s, 1);\n"
 "goto next_iteration;\n"
 "}\n"
-"--src sparql.sql:6008\n";
+"--src sparql.sql:6681\n";
 
-static const char *proc190 = 
+static const char *proc213 = 
+"#line 6945 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.SPARQL_DESC_DICT_CBD_PHYSICAL (in subj_dict any, in consts any, in good_graphs any, in bad_graphs any, in storage_name any, in options any)\n"
 "{\n"
 "declare all_subjs, sorted_good_graphs, sorted_bad_graphs, next_iter_subjs, res any;\n"
@@ -6344,7 +7252,7 @@ static const char *proc190 =
 "?st2 a rdf:Statement ; rdf:subject ?:subj ; rdf:predicate ?:p1 ; rdf:object ?:obj1 } } ) do\n"
 "{\n"
 "if (position (\"g2\", sorted_good_graphs) and dict_get (subj_dict, \"st2\") is null)\n"
-"dict_put (next_iter_subjs, st2, 1);\n"
+"dict_put (next_iter_subjs, \"st2\", 1);\n"
 "}\n"
 "}\n"
 "}\n"
@@ -6375,7 +7283,7 @@ static const char *proc190 =
 "dict_get (subj_dict, \"st2\") is null and\n"
 "__rgs_ack_cbk (\"g2\", uid, 1) and\n"
 "(gs_app_callback is null or bit_and (1, call (gs_app_callback) (\"g2\", gs_app_uid))) )\n"
-"dict_put (next_iter_subjs, st2, 1);\n"
+"dict_put (next_iter_subjs, \"st2\", 1);\n"
 "}\n"
 "}\n"
 "}\n"
@@ -6391,9 +7299,10 @@ static const char *proc190 =
 "foreach (IRI_ID s in all_subjs) do dict_put (subj_dict, s, 1);\n"
 "goto next_iteration;\n"
 "}\n"
-"--src sparql.sql:6268\n";
+"--src sparql.sql:6943\n";
 
-static const char *proc191 = 
+static const char *proc214 = 
+"#line 7078 \"[executable]/sparql.sql\"\n"
 " create procedure DB.DBA.RDF_DICT_OF_TRIPLES_TO_THREE_COLS (in dict any, in destructive integer := 0)\n"
 "{\n"
 "declare ctr, len integer;\n"
@@ -6429,9 +7338,10 @@ static const char *proc191 =
 ");\n"
 "}\n"
 "}\n"
-"--src sparql.sql:6401\n";
+"--src sparql.sql:7076\n";
 
-static const char *proc192 = 
+static const char *proc215 = 
+"#line 7119 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_TYPEMIN_OF_OBJ (in obj any) returns any\n"
 "{\n"
 "declare tag integer;\n"
@@ -6448,9 +7358,10 @@ static const char *proc192 =
 "return \'\';\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:6442\n";
+"--src sparql.sql:7117\n";
 
-static const char *proc193 = 
+static const char *proc216 = 
+"#line 7137 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_TYPEMAX_OF_OBJ (in obj any) returns any\n"
 "{\n"
 "declare tag integer;\n"
@@ -6467,16 +7378,18 @@ static const char *proc193 =
 "return \'\\377\\377\\377\\377\\377\\377\';\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:6460\n";
+"--src sparql.sql:7135\n";
 
-static const char *proc194 = 
+static const char *proc217 = 
+"#line 7155 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_IID_CMP (in obj1 any, in obj2 any) returns integer\n"
 "{\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:6478\n";
+"--src sparql.sql:7153\n";
 
-static const char *proc195 = 
+static const char *proc218 = 
+"#line 7161 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_OBJ_CMP (in obj1 any, in obj2 any) returns integer\n"
 "{\n"
 "declare tag1, tag2 integer;\n"
@@ -6550,9 +7463,10 @@ static const char *proc195 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:6484\n";
+"--src sparql.sql:7159\n";
 
-static const char *proc196 = 
+static const char *proc219 = 
+"#line 7236 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_LONG_CMP (in long1 any, in long2 any) returns integer\n"
 "{\n"
 "declare tag1, tag2 integer;\n"
@@ -6596,9 +7510,10 @@ static const char *proc196 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:6559\n";
+"--src sparql.sql:7234\n";
 
-static const char *proc197 = 
+static const char *proc220 = 
+"#line 7283 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_DIST_SER_LONG (in val any) returns any\n"
 "{\n"
 "if (not (isstring (val)))\n"
@@ -6617,9 +7532,10 @@ static const char *proc197 =
 "return val;\n"
 "return serialize (val);\n"
 "}\n"
-"--src sparql.sql:6606\n";
+"--src sparql.sql:7281\n";
 
-static const char *proc198 = 
+static const char *proc221 = 
+"#line 7304 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_DIST_DESER_LONG (in strg any) returns any\n"
 "{\n"
 "if (not (isstring (strg)))\n"
@@ -6634,13 +7550,14 @@ static const char *proc198 =
 "return res;\n"
 "return rdf_box (res[0], res[1], res[2], 0, res[3]);\n"
 "}\n"
-"--src sparql.sql:6627\n";
+"--src sparql.sql:7302\n";
 
-static const char *proc199 = 
-"create function JSO_MAKE_INHERITANCE (in jgraph varchar, in class varchar, in rootinst varchar, in destinst varchar, in dest_iid iri_id, inout noinherits any, inout inh_stack any)\n"
+static const char *proc222 = 
+"#line 7323 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.JSO_MAKE_INHERITANCE (in jgraph varchar, in class varchar, in rootinst varchar, in destinst varchar, in dest_iid iri_id, inout noinherits any, inout inh_stack any)\n"
 "{\n"
 "declare base_iid iri_id;\n"
-"declare baseinst, \"pred\" varchar;\n"
+"declare baseinst varchar;\n"
 "\n"
 "inh_stack := vector_concat (inh_stack, vector (destinst));\n"
 "baseinst := null;\n"
@@ -6694,23 +7611,22 @@ static const char *proc199 =
 "}\n"
 "if (position (baseinst, inh_stack))\n"
 "signal (\'22023\', \'JSO_MAKE_INHERITANCE has found that the object <\' || baseinst || \'> is recursively inherited from itself\');\n"
-"/* This fails. !!!TBD: fix sparql2sql.c to preserve data about equalities, fixed values and globals when triples are moved from gp to gp\n"
-"for (sparql\n"
-"define input:storage \"\"\n"
-"prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#>\n"
-"select ?pred\n"
-"where {\n"
-"graph ?:jgraph {\n"
-"{ {\n"
-"?destnode rdf:type `iri(?:class)` .\n"
-"filter (?destnode = iri(?:destinst)) }\n"
-"union\n"
-"{\n"
-"?destnode rdf:type `iri(?:class)` .\n"
-"?destnode rdf:name `iri(?:destinst)` } } .\n"
-"?destnode virtrdf:noInherit ?pred .\n"
-"} } ) do\n"
-"*/\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
 "for (sparql\n"
 "define input:storage \"\"\n"
 "prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#>\n"
@@ -6742,6 +7658,7 @@ static const char *proc199 =
 "ask where { graph ?:jgraph { ?:\"t00\".\"pred_id\" virtrdf:loadAs virtrdf:jsoTriple } } )\n"
 ") do\n"
 "{\n"
+"declare \"pred\" any;\n"
 "\"pred\" := id_to_iri (\"pred_id\");\n"
 "if (DB.DBA.RDF_LANGUAGE_OF_LONG (\"predval\", null) is not null)\n"
 "signal (\'22023\', \'JSO_MAKE_INHERITANCE does not support language marks on objects\');\n"
@@ -6759,12 +7676,13 @@ static const char *proc199 =
 "dict_put (noinherits, \"pred\", baseinst);\n"
 "}\n"
 "}\n"
-"JSO_MAKE_INHERITANCE (jgraph, class, rootinst, baseinst, base_iid, noinherits, inh_stack);\n"
+"DB.DBA.JSO_MAKE_INHERITANCE (jgraph, class, rootinst, baseinst, base_iid, noinherits, inh_stack);\n"
 "}\n"
-"--src sparql.sql:6646\n";
+"--src sparql.sql:7321\n";
 
-static const char *proc200 = 
-"create function JSO_LOAD_INSTANCE (in jgraph varchar, in jinst varchar, in delete_first integer, in make_new integer, in jsubj_iid iri_id := 0)\n"
+static const char *proc223 = 
+"#line 7449 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.JSO_LOAD_INSTANCE (in jgraph varchar, in jinst varchar, in delete_first integer, in make_new integer, in jsubj_iid iri_id := 0)\n"
 "{\n"
 "declare jinst_iid, jgraph_iid IRI_ID;\n"
 "declare jclass varchar;\n"
@@ -6844,12 +7762,13 @@ static const char *proc200 =
 "}\n"
 "}\n"
 "inh_stack := vector ();\n"
-"JSO_MAKE_INHERITANCE (jgraph, jclass, jinst, jinst, jsubj_iid, noinherits, inh_stack);\n"
+"DB.DBA.JSO_MAKE_INHERITANCE (jgraph, jclass, jinst, jinst, jsubj_iid, noinherits, inh_stack);\n"
 "}\n"
-"--src sparql.sql:6772\n";
+"--src sparql.sql:7447\n";
 
-static const char *proc201 = 
-"create procedure JSO_LIST_INSTANCES_OF_GRAPH (in jgraph varchar, out instances any)\n"
+static const char *proc224 = 
+"#line 7533 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.JSO_LIST_INSTANCES_OF_GRAPH (in jgraph varchar, out instances any)\n"
 "{\n"
 "declare md, res, st, msg any;\n"
 "st:= \'00000\';\n"
@@ -6877,16 +7796,17 @@ static const char *proc201 =
 "if (st <> \'00000\') signal (st, msg);\n"
 "instances := res[0][0];\n"
 "}\n"
-"--src sparql.sql:6856\n";
+"--src sparql.sql:7531\n";
 
-static const char *proc202 = 
-"create function JSO_LOAD_GRAPH (in jgraph varchar, in pin_now integer := 1)\n"
+static const char *proc225 = 
+"#line 7563 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.JSO_LOAD_GRAPH (in jgraph varchar, in pin_now integer := 1)\n"
 "{\n"
 "declare jgraph_iid IRI_ID;\n"
 "declare instances, chk any;\n"
 "\n"
 "jgraph_iid := iri_ensure (jgraph);\n"
-"JSO_LIST_INSTANCES_OF_GRAPH (jgraph, instances);\n"
+"DB.DBA.JSO_LIST_INSTANCES_OF_GRAPH (jgraph, instances);\n"
 "/* Pass 1. Deleting all obsolete instances. */\n"
 "foreach (any j in instances) do\n"
 "jso_delete (j[0], j[1], 1);\n"
@@ -6895,7 +7815,7 @@ static const char *proc202 =
 "jso_new (j[0], j[1]);\n"
 "/* Pass 3. Loading all instances, including loading inherited values. */\n"
 "foreach (any j in instances) do\n"
-"JSO_LOAD_INSTANCE (jgraph, j[1], 0, 0, j[2]);\n"
+"DB.DBA.JSO_LOAD_INSTANCE (jgraph, j[1], 0, 0, j[2]);\n"
 "/* Pass 4. Validation all instances. */\n"
 "foreach (any j in instances) do\n"
 "jso_validate (j[0], j[1], 1);\n"
@@ -6918,43 +7838,47 @@ static const char *proc202 =
 "if ((1 <> length (chk)) or (cast (chk[0] as varchar) <> \'http://www.openlinksw.com/schemas/virtrdf#jsoTriple\'))\n"
 "signal (\'22023\', \'JSO_LOAD_GRAPH has not found expected metadata in the graph\');\n"
 "}\n"
-"--src sparql.sql:6886\n";
+"--src sparql.sql:7561\n";
 
-static const char *proc203 = 
-"create function JSO_PIN_GRAPH (in jgraph varchar)\n"
+static const char *proc226 = 
+"#line 7603 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.JSO_PIN_GRAPH (in jgraph varchar)\n"
 "{\n"
 "declare instances any;\n"
-"JSO_LIST_INSTANCES_OF_GRAPH (jgraph, instances);\n"
+"DB.DBA.JSO_LIST_INSTANCES_OF_GRAPH (jgraph, instances);\n"
 "foreach (any j in instances) do\n"
 "jso_pin (j[0], j[1]);\n"
 "}\n"
-"--src sparql.sql:6926\n";
+"--src sparql.sql:7601\n";
 
-static const char *proc204 = 
-" create function JSO_SYS_GRAPH () returns varchar\n"
+static const char *proc227 = 
+"#line 7613 \"[executable]/sparql.sql\"\n"
+" create function DB.DBA.JSO_SYS_GRAPH () returns varchar\n"
 "{\n"
 "return \'http://www.openlinksw.com/schemas/virtrdf#\';\n"
 "}\n"
-"--src sparql.sql:6936\n";
+"--src sparql.sql:7611\n";
 
-static const char *proc205 = 
-"create procedure JSO_LOAD_AND_PIN_SYS_GRAPH_RO (in graphiri varchar := null)\n"
+static const char *proc228 = 
+"#line 7620 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.JSO_LOAD_AND_PIN_SYS_GRAPH_RO (in graphiri varchar := null)\n"
 "{\n"
 "if (graphiri is null)\n"
-"graphiri := JSO_SYS_GRAPH();\n"
-"JSO_LOAD_GRAPH (graphiri, 0);\n"
-"JSO_PIN_GRAPH (graphiri);\n"
+"graphiri := DB.DBA.JSO_SYS_GRAPH();\n"
+"DB.DBA.JSO_LOAD_GRAPH (graphiri, 0);\n"
+"DB.DBA.JSO_PIN_GRAPH (graphiri);\n"
 "}\n"
-"--src sparql.sql:6943\n";
+"--src sparql.sql:7618\n";
 
-static const char *proc206 = 
-"create procedure JSO_LOAD_AND_PIN_SYS_GRAPH (in graphiri varchar := null)\n"
+static const char *proc229 = 
+"#line 7629 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.JSO_LOAD_AND_PIN_SYS_GRAPH (in graphiri varchar := null)\n"
 "{\n"
 "if (graphiri is null)\n"
-"graphiri := JSO_SYS_GRAPH();\n"
+"graphiri := DB.DBA.JSO_SYS_GRAPH();\n"
 "commit work;\n"
-"JSO_LOAD_GRAPH (graphiri, 0);\n"
-"JSO_PIN_GRAPH (graphiri);\n"
+"DB.DBA.JSO_LOAD_GRAPH (graphiri, 0);\n"
+"DB.DBA.JSO_PIN_GRAPH (graphiri);\n"
 "for (select P_NAME from SYS_PROCEDURES\n"
 "where (\n"
 "(P_NAME like \'DB.DBA.SPARQL_DESC_DICT_QMV1_%\') or\n"
@@ -6965,10 +7889,11 @@ static const char *proc206 =
 "}\n"
 "commit work;\n"
 "}\n"
-"--src sparql.sql:6952\n";
+"--src sparql.sql:7627\n";
 
-static const char *proc207 = 
-"create function JSO_DUMP_IRI (in v varchar, inout ses any)\n"
+static const char *proc230 = 
+"#line 7648 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.JSO_DUMP_IRI (in v varchar, inout ses any)\n"
 "{\n"
 "\n"
 "\n"
@@ -6998,17 +7923,18 @@ static const char *proc207 =
 "http_escape (v, 12, ses, 1, 1);\n"
 "http (\'>\', ses);\n"
 "}\n"
-"--src sparql.sql:6971\n";
+"--src sparql.sql:7646\n";
 
-static const char *proc208 = 
-"create function JSO_DUMP_FLD (in v any, inout ses any)\n"
+static const char *proc231 = 
+"#line 7680 \"[executable]/sparql.sql\"\n"
+"create function DB.DBA.JSO_DUMP_FLD (in v any, inout ses any)\n"
 "{\n"
 "declare v_tag integer;\n"
 "v_tag := __tag(v);\n"
 "if (v_tag = 217)\n"
-"JSO_DUMP_IRI (cast (v as varchar), ses);\n"
+"DB.DBA.JSO_DUMP_IRI (cast (v as varchar), ses);\n"
 "else if (v_tag = 243)\n"
-"JSO_DUMP_IRI (id_to_iri (v), ses);\n"
+"DB.DBA.JSO_DUMP_IRI (id_to_iri (v), ses);\n"
 "else if (v_tag = 203)\n"
 "http (jso_dbg_dump_rtti (v), ses);\n"
 "else if (v_tag = __tag of varchar)\n"
@@ -7030,9 +7956,10 @@ static const char *proc208 =
 "http (\'>\', ses);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:7003\n";
+"--src sparql.sql:7678\n";
 
-static const char *proc209 = 
+static const char *proc232 = 
+"#line 7711 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.JSO_VECTOR_TO_TTL (inout proplist any) returns any\n"
 "{\n"
 "declare prev_obj, ses any;\n"
@@ -7064,20 +7991,21 @@ static const char *proc209 =
 "else\n"
 "http (\'.\\n\', ses);\n"
 "prev_obj := obj;\n"
-"JSO_DUMP_FLD (obj, ses);\n"
+"DB.DBA.JSO_DUMP_FLD (obj, ses);\n"
 "http (\'\\n  \', ses);\n"
 "}\n"
-"JSO_DUMP_FLD (p, ses);\n"
+"DB.DBA.JSO_DUMP_FLD (p, ses);\n"
 "http (\'\\t\', ses);\n"
-"JSO_DUMP_FLD (o, ses);\n"
+"DB.DBA.JSO_DUMP_FLD (o, ses);\n"
 "}\n"
 "if (prev_obj is not null)\n"
 "http (\'.\\n\', ses);\n"
 "return ses;\n"
 "}\n"
-"--src sparql.sql:7034\n";
+"--src sparql.sql:7709\n";
 
-static const char *proc210 = 
+static const char *proc233 = 
+"#line 7755 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.JSO_FILTERED_PROPLIST (in only_custom integer := 0, in loading_status integer := 1, in long_valmode integer := 1) returns any\n"
 "{\n"
 "declare proplist, res any;\n"
@@ -7154,18 +8082,20 @@ static const char *proc210 =
 "vectorbld_final (res);\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:7078\n";
+"--src sparql.sql:7753\n";
 
-static const char *proc211 = 
+static const char *proc234 = 
+"#line 7833 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.JSO_DUMP_ALL (in only_custom integer := 0, in loading_status integer := 1) returns any\n"
 "{\n"
 "declare proplist any;\n"
 "proplist := DB.DBA.JSO_FILTERED_PROPLIST (only_custom, loading_status, 0);\n"
 "return DB.DBA.JSO_VECTOR_TO_TTL (proplist);\n"
 "}\n"
-"--src sparql.sql:7156\n";
+"--src sparql.sql:7831\n";
 
-static const char *proc212 = 
+static const char *proc235 = 
+"#line 7844 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_BACKUP_METADATA (in save_to_file integer := 0, in backup_name varchar := null) returns varchar\n"
 "{\n"
 "declare proplist any;\n"
@@ -7198,9 +8128,10 @@ static const char *proc212 =
 "}\n"
 "return backup_name;\n"
 "}\n"
-"--src sparql.sql:7167\n";
+"--src sparql.sql:7842\n";
 
-static const char *proc213 = 
+static const char *proc236 = 
+"#line 7878 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_RESTORE_METADATA (in read_from_file integer, in backup_name varchar) returns any\n"
 "{\n"
 "declare graphiri_id IRI_ID;\n"
@@ -7241,9 +8172,10 @@ static const char *proc213 =
 "commit work;\n"
 "return backup_name;\n"
 "}\n"
-"--src sparql.sql:7201\n";
+"--src sparql.sql:7876\n";
 
-static const char *proc214 = 
+static const char *proc237 = 
+"#line 7920 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_AUDIT_METADATA (in fix_bugs integer := 0, in unlocker varchar := null, in graphiri varchar := null, in call_result_names integer := 1)\n"
 "{\n"
 "declare chksum varchar;\n"
@@ -7478,9 +8410,10 @@ static const char *proc214 =
 "result (\'42000\', \'The previous error can not be fixed automatically. Sorry.\');\n"
 "return;\n"
 "}\n"
-"--src sparql.sql:7243\n";
+"--src sparql.sql:7918\n";
 
-static const char *proc215 = 
+static const char *proc238 = 
+"#line 8159 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QM_CHANGE (in warninglist any)\n"
 "{\n"
 "declare STATE, MESSAGE varchar;\n"
@@ -7492,9 +8425,10 @@ static const char *proc215 =
 "}\n"
 "commit work;\n"
 "}\n"
-"--src sparql.sql:7482\n";
+"--src sparql.sql:8157\n";
 
-static const char *proc216 = 
+static const char *proc239 = 
+"#line 8172 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QM_CHANGE_OPT (in cmdlist any)\n"
 "{\n"
 "declare cmdctr, cmdcount integer;\n"
@@ -7548,9 +8482,10 @@ static const char *proc216 =
 "}\n"
 "result (\'00000\', sprintf (\'%d RDF metadata manipulation operations done\', cmdcount));\n"
 "}\n"
-"--src sparql.sql:7495\n";
+"--src sparql.sql:8170\n";
 
-static const char *proc217 = 
+static const char *proc240 = 
+"#line 8227 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_APPLY_CHANGES (in deleted any, in affected any) returns any\n"
 "{\n"
 "declare ctr, len integer;\n"
@@ -7564,9 +8499,10 @@ static const char *proc217 =
 "jso_mark_affected (affected [ctr]);\n"
 "return vector (vector (\'00000\', \'Transaction committed, SPARQL compiler re-configured\'));\n"
 "}\n"
-"--src sparql.sql:7550\n";
+"--src sparql.sql:8225\n";
 
-static const char *proc218 = 
+static const char *proc241 = 
+"#line 8242 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_ASSERT_JSO_TYPE (in inst varchar, in expected varchar, in allow_missing integer := 0) returns integer\n"
 "{\n"
 "declare actual varchar;\n"
@@ -7603,9 +8539,10 @@ static const char *proc218 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src sparql.sql:7565\n";
+"--src sparql.sql:8240\n";
 
-static const char *proc219 = 
+static const char *proc242 = 
+"#line 8280 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QM_ASSERT_STORAGE_FLAG (in storage varchar, in req_flag integer)\n"
 "{\n"
 "declare graphiri varchar;\n"
@@ -7626,9 +8563,10 @@ static const char *proc219 =
 "return;\n"
 "signal (\'22023\', \'The quad storage \"\' || storage || \'\" is not flagged as being edited, cannot change it\' );\n"
 "}\n"
-"--src sparql.sql:7603\n";
+"--src sparql.sql:8278\n";
 
-static const char *proc220 = 
+static const char *proc243 = 
+"#line 8302 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QM_ASSERT_STORAGE_CONTAINS_MAPPING (in storage varchar, in qmid varchar, in must_contain integer)\n"
 "{\n"
 "declare graphiri varchar;\n"
@@ -7650,17 +8588,19 @@ static const char *proc220 =
 "return;\n"
 "signal (\'22023\', \'The quad storage \"\' || storage || \'\" does not contains quad map \' || qmid );\n"
 "}\n"
-"--src sparql.sql:7625\n";
+"--src sparql.sql:8300\n";
 
-static const char *proc221 = 
+static const char *proc244 = 
+"#line 8325 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QM_ASSERT_STORAGE_IS_FLAGGED (in storage varchar)\n"
 "{\n"
 "if (not DB.DBA.RDF_QM_GET_STORAGE_FLAG (storage))\n"
 "signal (\'22023\', \'The quad storage \"\' || storage || \'\" is not flagged as being edited\' );\n"
 "}\n"
-"--src sparql.sql:7648\n";
+"--src sparql.sql:8323\n";
 
-static const char *proc222 = 
+static const char *proc245 = 
+"#line 8332 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_GC_SUBTREE (in seed any, in quick_gc_only integer := 0) returns integer\n"
 "{\n"
 "declare graphiri varchar;\n"
@@ -7794,9 +8734,10 @@ static const char *proc222 =
 "\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:7655\n";
+"--src sparql.sql:8330\n";
 
-static const char *proc223 = 
+static const char *proc246 = 
+"#line 8467 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_GC_MAPPING_SUBTREE (in mapname any, in quick_gc integer) returns any\n"
 "{\n"
 "declare gc_res, submaps any;\n"
@@ -7816,9 +8757,10 @@ static const char *proc223 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:7790\n";
+"--src sparql.sql:8465\n";
 
-static const char *proc224 = 
+static const char *proc247 = 
+"#line 8488 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_DROP_MAPPING (in storage varchar, in mapname any) returns any\n"
 "{\n"
 "declare graphiri varchar;\n"
@@ -7876,9 +8818,10 @@ static const char *proc224 =
 "return vector (vector (\'00000\', \'Quad map <\' || qmid || \'> is no longer used in storage <\' || storage || \'>\'));\n"
 "}\n"
 "}\n"
-"--src sparql.sql:7811\n";
+"--src sparql.sql:8486\n";
 
-static const char *proc225 = 
+static const char *proc248 = 
+"#line 8547 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_MACROEXPAND_TEMPLATE (in iritmpl varchar) returns varchar\n"
 "{\n"
 "declare pos integer;\n"
@@ -7917,9 +8860,10 @@ static const char *proc225 =
 "}\n"
 "return iritmpl;\n"
 "}\n"
-"--src sparql.sql:7870\n";
+"--src sparql.sql:8545\n";
 
-static const char *proc226 = 
+static const char *proc249 = 
+"#line 8587 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_CBD_OF_IRI_CLASS (in classiri varchar) returns any\n"
 "{\n"
 "declare descr any;\n"
@@ -7946,9 +8890,10 @@ static const char *proc226 =
 "rowvector_digit_sort (descr, 1, 1);\n"
 "return descr;\n"
 "}\n"
-"--src sparql.sql:7910\n";
+"--src sparql.sql:8585\n";
 
-static const char *proc227 = 
+static const char *proc250 = 
+"#line 8615 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_DEFINE_IRI_CLASS_FORMAT (in classiri varchar, in iritmpl varchar, in arglist any, in options any, in origclassiri varchar := null) returns any\n"
 "{\n"
 "declare graphiri varchar;\n"
@@ -8146,9 +9091,10 @@ static const char *proc227 =
 "}\n"
 "return vector_concat (res, vector_concat (res, vector (vector (\'00000\', \'IRI class <\' || classiri || \'> has been defined (inherited from rdfdf:\' || basetype || \')\'))));\n"
 "}\n"
-"--src sparql.sql:7938\n";
+"--src sparql.sql:8613\n";
 
-static const char *proc228 = 
+static const char *proc251 = 
+"#line 8814 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_DEFINE_IRI_CLASS_FUNCTIONS (in classiri varchar, in fheaders any, in options any, in origclassiri varchar := null) returns any\n"
 "{\n"
 "/*\n"
@@ -8308,9 +9254,10 @@ static const char *proc228 =
 "}\n"
 "return vector_concat (res, vector (vector (\'00000\', \'IRI class <\' || classiri || \'> has been defined (inherited from rdfdf:\' || basetype || \') using \' || uriprintname)));\n"
 "}\n"
-"--src sparql.sql:8137\n";
+"--src sparql.sql:8812\n";
 
-static const char *proc229 = 
+static const char *proc252 = 
+"#line 8975 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_DEFINE_LITERAL_CLASS_FUNCTIONS (in classiri varchar, in fheaders any, in options any, in origclassiri varchar := null) returns any\n"
 "{\n"
 "/*\n"
@@ -8426,16 +9373,18 @@ static const char *proc229 =
 "}\n"
 "return vector_concat (res, vector (vector (\'00000\', \'LITERAL class <\' || classiri || \'> has been defined (inherited from rdfdf:\' || basetype || \') using \' || uriprintname)));\n"
 "}\n"
-"--src sparql.sql:8298\n";
+"--src sparql.sql:8973\n";
 
-static const char *proc230 = 
+static const char *proc253 = 
+"#line 9093 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_BAD_CLASS_INV_FUNCTION (inout val any) returns any\n"
 "{\n"
 "return NULL;\n"
 "}\n"
-"--src sparql.sql:8416\n";
+"--src sparql.sql:9091\n";
 
-static const char *proc231 = 
+static const char *proc254 = 
+"#line 9100 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.SQLNAME_NOTATION_TO_NAME (in str varchar) returns varchar\n"
 "{\n"
 "if (\'\' = str)\n"
@@ -8444,9 +9393,10 @@ static const char *proc231 =
 "return subseq (str, 1, length (str) - 1);\n"
 "return fix_identifier_case (str);\n"
 "}\n"
-"--src sparql.sql:8423\n";
+"--src sparql.sql:9098\n";
 
-static const char *proc232 = 
+static const char *proc255 = 
+"#line 9111 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.SQLQNAME_NOTATION_TO_QNAME (in str varchar, in expected_part_count integer) returns varchar\n"
 "{\n"
 "declare part_ctr, dot_pos integer;\n"
@@ -8482,9 +9432,10 @@ static const char *proc232 =
 "return NULL;\n"
 "return res || name;\n"
 "}\n"
-"--src sparql.sql:8434\n";
+"--src sparql.sql:9109\n";
 
-static const char *proc233 = 
+static const char *proc256 = 
+"#line 9148 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QM_CHECK_CLASS_FUNCTION_HEADERS (inout fheaders any, in is_iri_decl integer, in only_one_arg integer, in pdesc varchar, in invdesc varchar, in bij integer, in deref integer)\n"
 "{\n"
 "declare uriprint any;\n"
@@ -8569,9 +9520,10 @@ static const char *proc233 =
 "signal (\'22023\', invdesc || \' function \' || uriparse[0] || \' should have nullable argument\');\n"
 "}\n"
 "}\n"
-"--src sparql.sql:8471\n";
+"--src sparql.sql:9146\n";
 
-static const char *proc234 = 
+static const char *proc257 = 
+"#line 9234 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_DEFINE_SUBCLASS (in subclassiri varchar, in superclassiri varchar) returns any\n"
 "{\n"
 "DB.DBA.RDF_QM_ASSERT_JSO_TYPE (subclassiri, \'http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat\');\n"
@@ -8582,9 +9534,10 @@ static const char *proc234 =
 "`iri(?:subclassiri)` virtrdf:isSubclassOf `iri(?:superclassiri)` };\n"
 "return vector (vector (\'00000\', \'IRI class <\' || subclassiri || \'> is now known as a subclass of <\' || superclassiri || \'>\'));\n"
 "}\n"
-"--src sparql.sql:8557\n";
+"--src sparql.sql:9232\n";
 
-static const char *proc235 = 
+static const char *proc258 = 
+"#line 9246 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_DROP_CLASS (in classiri varchar, in silent integer := 0) returns any\n"
 "{\n"
 "declare graphiri varchar;\n"
@@ -8604,9 +9557,10 @@ static const char *proc235 =
 "}\n"
 "return vector (vector (\'00000\', \'Previous definition of class <\' || classiri || \'> has been dropped\'));\n"
 "}\n"
-"--src sparql.sql:8569\n";
+"--src sparql.sql:9244\n";
 
-static const char *proc236 = 
+static const char *proc259 = 
+"#line 9267 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_DROP_QUAD_STORAGE (in storage varchar, in silent integer := 0) returns any\n"
 "{\n"
 "declare graphiri varchar;\n"
@@ -8627,9 +9581,10 @@ static const char *proc236 =
 "where { graph ?:graphiri { `iri(?:storage)` ?p ?o } };\n"
 "return vector (vector (\'00000\', \'Quad storage <\' || storage || \'> is removed from the quad mapping schema\'));\n"
 "}\n"
-"--src sparql.sql:8590\n";
+"--src sparql.sql:9265\n";
 
-static const char *proc237 = 
+static const char *proc260 = 
+"#line 9289 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_DEFINE_QUAD_STORAGE (in storage varchar) returns any\n"
 "{\n"
 "declare graphiri, qsusermaps varchar;\n"
@@ -8656,9 +9611,10 @@ static const char *proc237 =
 "rdf:type virtrdf:array-of-QuadMap };\n"
 "return vector (vector (\'00000\', \'A new empty quad storage <\' || storage || \'> is added to the quad mapping schema\'));\n"
 "}\n"
-"--src sparql.sql:8612\n";
+"--src sparql.sql:9287\n";
 
-static const char *proc238 = 
+static const char *proc261 = 
+"#line 9317 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_BEGIN_ALTER_QUAD_STORAGE (in storage varchar) returns any\n"
 "{\n"
 "declare graphiri varchar;\n"
@@ -8670,9 +9626,10 @@ static const char *proc238 =
 "`iri(?:storage)` virtrdf:qsAlterInProgress `bif:now NIL` };\n"
 "return vector (vector (\'00000\', \'Quad storage <\' || storage || \'> is flagged as being edited\'));\n"
 "}\n"
-"--src sparql.sql:8640\n";
+"--src sparql.sql:9315\n";
 
-static const char *proc239 = 
+static const char *proc262 = 
+"#line 9330 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_END_ALTER_QUAD_STORAGE (in storage varchar) returns any\n"
 "{\n"
 "declare graphiri varchar;\n"
@@ -8686,9 +9643,10 @@ static const char *proc239 =
 "`iri(?:storage)` virtrdf:qsAlterInProgress ?dtstart } };\n"
 "return vector (vector (\'00000\', \'Quad storage <\' || storage || \'> is unflagged and can be edited by other transactions\'));\n"
 "}\n"
-"--src sparql.sql:8653\n";
+"--src sparql.sql:9328\n";
 
-static const char *proc240 = 
+static const char *proc263 = 
+"#line 9345 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_STORE_ATABLES (in qmvid varchar, in atablesid varchar, inout atables any)\n"
 "{\n"
 "declare atablectr, atablecount integer;\n"
@@ -8717,9 +9675,10 @@ static const char *proc240 =
 "virtrdf:qmvaTableName ?:qtable };\n"
 "}\n"
 "}\n"
-"--src sparql.sql:8668\n";
+"--src sparql.sql:9343\n";
 
-static const char *proc241 = 
+static const char *proc264 = 
+"#line 9375 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_FT_USAGE (in ft_type varchar, in ft_alias varchar, in ft_aliased_col any, in sqlcols any, in conds any, in options any := null)\n"
 "{\n"
 "declare ft_tbl, ft_col, ftid, ftcondsid varchar;\n"
@@ -8783,9 +9742,10 @@ static const char *proc241 =
 "}\n"
 "return ftid;\n"
 "}\n"
-"--src sparql.sql:8698\n";
+"--src sparql.sql:9373\n";
 
-static const char *proc242 = 
+static const char *proc265 = 
+"#line 9440 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_CHECK_COLUMNS_FORM_KEY (in sqlcols any) returns integer\n"
 "{\n"
 "declare alias, tbl varchar;\n"
@@ -8823,9 +9783,10 @@ static const char *proc242 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src sparql.sql:8763\n";
+"--src sparql.sql:9438\n";
 
-static const char *proc243 = 
+static const char *proc266 = 
+"#line 9479 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_DEFINE_MAP_VALUE (in qmv any, in fldname varchar, inout tablename varchar, in o_dt any := null, in o_lang any := null) returns varchar\n"
 "{\n"
 "/* iqi qmv: vector ( UNAME\'http://www.openlinksw.com/schemas/oplsioc#user_iri\' ,\n"
@@ -9101,9 +10062,10 @@ static const char *proc243 =
 "}\n"
 "return qmvid;\n"
 "}\n"
-"--src sparql.sql:8802\n";
+"--src sparql.sql:9477\n";
 
-static const char *proc244 = 
+static const char *proc267 = 
+"#line 9756 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QM_NORMALIZE_QMV (\n"
 "inout qmv any, inout qmvfix any, inout qmvid any,\n"
 "in can_be_literal integer, in fldname varchar, inout tablename varchar, in o_dt any := null, in o_lang any := null )\n"
@@ -9124,9 +10086,10 @@ static const char *proc244 =
 "qmvfix := qmv;\n"
 "\n"
 "}\n"
-"--src sparql.sql:9079\n";
+"--src sparql.sql:9754\n";
 
-static const char *proc245 = 
+static const char *proc268 = 
+"#line 9778 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_DEFINE_MAPPING (in storage varchar,\n"
 "in qmrawid varchar, in qmid varchar, in qmparentid varchar,\n"
 "in qmv_g any, in qmv_s any, in qmv_p any, in qmv_o any, in o_dt any, in o_lang any,\n"
@@ -9193,7 +10156,7 @@ static const char *proc245 =
 "{\n"
 "tablename := \'DB.DBA.SYS_FAKE_1\';\n"
 "if (0 < length (conds))\n"
-"signal (\'22023\', \'Quad Mapping <\' || qmid || \'> has four constants and no one quad map value; it do not access tables so it can not have WHERE conditions\');\n"
+"signal (\'22023\', \'Quad Mapping <\' || qmid || \'> has four constants and no one quad map value; it does not access tables so it can not have WHERE conditions\');\n"
 "}\n"
 "}\n"
 "if (\'\' = tablename)\n"
@@ -9297,15 +10260,17 @@ static const char *proc245 =
 "`iri(?:qmcondsid)`\n"
 "`iri (bif:sprintf (\"%s%d\", str (rdf:_), ?:condctr+1))` ?:sqlcond };\n"
 "}\n"
+"DB.DBA.RDF_ADD_qmAliasesKeyrefdByQuad (qmid);\n"
 "if (qm_is_default is not null)\n"
 "DB.DBA.RDF_QM_SET_DEFAULT_MAPPING (storage, qmid);\n"
 "else\n"
 "DB.DBA.RDF_QM_ADD_MAPPING_TO_STORAGE (storage, qmparentid, qmid, qm_order);\n"
 "return vector (vector (\'00000\', \'Quad map <\' || qmid || \'> has been created and added to the <\' || storage || \'>\'));\n"
 "}\n"
-"--src sparql.sql:9101\n";
+"--src sparql.sql:9776\n";
 
-static const char *proc246 = 
+static const char *proc269 = 
+"#line 9957 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_QM_ATTACH_MAPPING (in storage varchar, in source varchar, in opts any) returns any\n"
 "{\n"
 "declare graphiri varchar;\n"
@@ -9347,9 +10312,10 @@ static const char *proc246 =
 "DB.DBA.RDF_QM_ADD_MAPPING_TO_STORAGE (storage, NULL, qmid, NULL /* !!!TBD: place real value instead of constant NULL */);\n"
 "return vector (vector (\'00000\', \'Quad map <\' || qmid || \'> is added to the storage <\' || storage || \'>\'));\n"
 "}\n"
-"--src sparql.sql:9279\n";
+"--src sparql.sql:9955\n";
 
-static const char *proc247 = 
+static const char *proc270 = 
+"#line 10000 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QM_ADD_MAPPING_TO_STORAGE (in storage varchar, in qmparent varchar, in qmid varchar, in qmorder integer)\n"
 "{\n"
 "declare graphiri, lstiri varchar;\n"
@@ -9439,9 +10405,10 @@ static const char *proc247 =
 "ctr := ctr + 1;\n"
 "}\n"
 "}\n"
-"--src sparql.sql:9322\n";
+"--src sparql.sql:9998\n";
 
-static const char *proc248 = 
+static const char *proc271 = 
+"#line 10091 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QM_DELETE_MAPPING_FROM_STORAGE (in storage varchar, in qmparent varchar, in qmid varchar)\n"
 "{\n"
 "declare graphiri, lstiri varchar;\n"
@@ -9516,9 +10483,10 @@ static const char *proc248 =
 "}\n"
 "}\n"
 "}\n"
-"--src sparql.sql:9413\n";
+"--src sparql.sql:10089\n";
 
-static const char *proc249 = 
+static const char *proc272 = 
+"#line 10167 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QM_SET_DEFAULT_MAPPING (in storage varchar, in qmid varchar)\n"
 "{\n"
 "declare graphiri, old_qmid varchar;\n"
@@ -9536,9 +10504,90 @@ static const char *proc249 =
 "sparql define input:storage \"\"\n"
 "insert in graph <http://www.openlinksw.com/schemas/virtrdf#> { `iri(?:storage)` virtrdf:qsDefaultMap `iri(?:qmid)` . };\n"
 "}\n"
-"--src sparql.sql:9489\n";
+"--src sparql.sql:10165\n";
 
-static const char *proc250 = 
+static const char *proc273 = 
+"#line 10186 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_ADD_qmAliasesKeyrefdByQuad (in qm_iri varchar)\n"
+"{\n"
+"declare kr_iri varchar;\n"
+"declare good_ctr, all_ctr integer;\n"
+"kr_iri := qm_iri || \'--qmAliasesKeyrefdByQuad\';\n"
+"sparql define input:storage \"\" delete from virtrdf: { `iri(?:kr_iri)` ?p ?o } from virtrdf: where { `iri(?:kr_iri)` ?p ?o };\n"
+"sparql define input:storage \"\" insert in virtrdf: { `iri(?:qm_iri)` virtrdf:qmAliasesKeyrefdByQuad `iri(?:kr_iri)` . `iri(?:kr_iri)` a virtrdf:array-of-string };\n"
+"good_ctr := 0;\n"
+"all_ctr := 0;\n"
+"for ( sparql define input:storage \"\"\n"
+"select ?alias ?tbl (sql:VECTOR_AGG (str(?col))) as ?cols\n"
+"from virtrdf:\n"
+"where {\n"
+"`iri(?:qm_iri)` a virtrdf:QuadMap ;\n"
+"?fld_p ?qmv .\n"
+"filter (?fld_p in (virtrdf:qmGraphMap , virtrdf:qmSubjectMap , virtrdf:qmPredicateMap , virtrdf:qmObjectMap))\n"
+"?qmv a virtrdf:QuadMapValue ;\n"
+"virtrdf:qmvATables [\n"
+"?qmvat_p [ a virtrdf:QuadMapATable ;\n"
+"virtrdf:qmvaAlias ?alias ;\n"
+"virtrdf:qmvaTableName ?tbl ] ] ;\n"
+"virtrdf:qmvColumns [\n"
+"?qmvc_p [ a virtrdf:QuadMapColumn ;\n"
+"virtrdf:qmvcAlias ?alias ;\n"
+"virtrdf:qmvcColumnName ?col ] ] ;\n"
+"virtrdf:qmvFormat [ a virtrdf:QuadMapFormat ;\n"
+"virtrdf:qmfIsBijection ?bij ] .\n"
+"filter (?bij != 0)\n"
+"} ) do\n"
+"{\n"
+"\n"
+"all_ctr := all_ctr + 1;\n"
+"for (select KEY_ID, KEY_N_SIGNIFICANT from DB.DBA.SYS_KEYS where KEY_TABLE = \"tbl\" and KEY_IS_UNIQUE) do\n"
+"{\n"
+"for (select \"COLUMN\" from DB.DBA.SYS_KEY_PARTS, DB.DBA.SYS_COLS\n"
+"where  KP_KEY_ID = KEY_ID and KP_NTH < KEY_N_SIGNIFICANT and COL_ID = KP_COL ) do\n"
+"{\n"
+"if (not position (\"COLUMN\", \"cols\"))\n"
+"{\n"
+"\n"
+"goto wrong_key;\n"
+"}\n"
+"}\n"
+"good_ctr := good_ctr + 1;\n"
+"\n"
+"sparql define input:storage \"\" insert in virtrdf: { `iri(?:kr_iri)` `iri(bif:sprintf(\"%s%d\", str(rdf:_), ?:good_ctr))` ?:\"alias\" };\n"
+"goto right_key;\n"
+"wrong_key: ;\n"
+"}\n"
+"right_key: ;\n"
+"}\n"
+"\n"
+"}\n"
+"--src sparql.sql:10184\n";
+
+static const char *proc274 = 
+"#line 10241 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_UPGRADE_QUAD_MAP (in qm_iri varchar)\n"
+"{\n"
+"declare keyrefd any;\n"
+"if (not exists (sparql define input:storage \"\" select (1) from virtrdf: where { `iri(?:qm_iri)` a virtrdf:QuadMap }))\n"
+"signal (\'RDFxx\', sprintf (\'Quad map <%s> does not exist, nothing to upgrade\', qm_iri));\n"
+"if (not exists (sparql define input:storage \"\" select (1) from virtrdf: where { `iri(?:qm_iri)` virtrdf:qmAliasesKeyrefdByQuad ?keyrefs }))\n"
+"DB.DBA.RDF_ADD_qmAliasesKeyrefdByQuad (qm_iri);\n"
+"}\n"
+"--src sparql.sql:10239\n";
+
+static const char *proc275 = 
+"#line 10251 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.RDF_UPGRADE_METADATA ()\n"
+"{\n"
+"for (sparql define input:storage \"\" select ?qm_iri from virtrdf: where { ?qm_iri a virtrdf:QuadMap }) do\n"
+"{\n"
+"DB.DBA.RDF_UPGRADE_QUAD_MAP (\"qm_iri\");\n"
+"}\n"
+"}\n"
+"--src sparql.sql:10249\n";
+
+static const char *proc276 = 
+"#line 10264 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_TRIPLE_W (\n"
 "in g_iid IRI_ID, in s_uri varchar, in p_uri varchar,\n"
 "in o_uri varchar, in env any )\n"
@@ -9547,6 +10596,9 @@ static const char *proc250 =
 "declare log_mode integer;\n"
 "declare s_iid, p_iid, o_iid IRI_ID;\n"
 "log_mode := env[0];\n"
+"if (isstring (registry_get (\'DB.DBA.RDF_REPL\')))\n"
+"repl_publish (\'__rdf_repl\', \'__rdf_repl.log\');\n"
+"\n"
 "if (log_mode = 1)\n"
 "{\n"
 "whenever sqlstate \'40001\' goto deadlock_1;\n"
@@ -9598,9 +10650,10 @@ static const char *proc250 =
 "rollback work;\n"
 "goto again_2;\n"
 "}\n"
-"--src sparql.sql:9513\n";
+"--src sparql.sql:10262\n";
 
-static const char *proc251 = 
+static const char *proc277 = 
+"#line 10329 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_TRIPLE_L_W (\n"
 "in g_iid IRI_ID, in s_uri varchar, in p_uri varchar,\n"
 "in o_val any, in o_type any, in o_lang any, in env any )\n"
@@ -9672,25 +10725,33 @@ static const char *proc251 =
 "rollback work;\n"
 "goto again;\n"
 "}\n"
-"--src sparql.sql:9575\n";
+"--src sparql.sql:10327\n";
 
-static const char *proc252 = 
+static const char *proc278 = 
+"#line 10402 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_NEW_GRAPH_A (inout g varchar, inout g_iid IRI_ID, inout app_env any) {\n"
 "\n"
 "if (__rdf_obj_ft_rule_count_in_graph (g_iid))\n"
 "app_env[2][1] := dict_new (app_env[3]);\n"
 "else\n"
 "app_env[2][1] := null;\n"
+"if (__rdf_graph_is_in_enabled_repl (g_iid))\n"
+"app_env[4] := g;\n"
+"else\n"
+"app_env[4] := null;\n"
 "}\n"
-"--src sparql.sql:9648\n";
+"--src sparql.sql:10400\n";
 
-static const char *proc253 = 
+static const char *proc279 = 
+"#line 10415 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_TRIPLE_A (\n"
 "inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
 "inout o_uri varchar,\n"
 "inout app_env any )\n"
 "{\n"
 "\n"
+"if (app_env[4] is not null)\n"
+"__rdf_repl_quad (84, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), iri_canonicalize (o_uri));\n"
 "app_env[1] := aq_request (\n"
 "app_env[0], \'DB.DBA.TTLP_EV_TRIPLE_W\',\n"
 "vector (g_iid, s_uri, p_uri, o_uri, app_env[2]) );\n"
@@ -9704,15 +10765,25 @@ static const char *proc253 =
 "aq_wait_all (app_env[0]);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:9657\n";
+"--src sparql.sql:10413\n";
 
-static const char *proc254 = 
+static const char *proc280 = 
+"#line 10438 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_TRIPLE_L_A (\n"
 "inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
 "inout o_val any, inout o_type varchar, inout o_lang varchar,\n"
 "inout app_env any )\n"
 "{\n"
 "\n"
+"if (app_env[4] is not null)\n"
+"{\n"
+"if (isstring (o_type))\n"
+"__rdf_repl_quad (81, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val, iri_canonicalize (o_type), NULL);\n"
+"else if (isstring (o_lang))\n"
+"__rdf_repl_quad (82, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val, null, o_lang);\n"
+"else\n"
+"__rdf_repl_quad (80, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val);\n"
+"}\n"
 "if (__tag of XML = __tag (o_val))\n"
 "{\n"
 "DB.DBA.TTLP_EV_TRIPLE_L_W (g_iid, s_uri, p_uri, o_val, o_type, o_lang, app_env[2]);\n"
@@ -9731,9 +10802,10 @@ static const char *proc254 =
 "aq_wait_all (app_env[0]);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:9678\n";
+"--src sparql.sql:10436\n";
 
-static const char *proc255 = 
+static const char *proc281 = 
+"#line 10473 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.TTLP_EV_COMMIT_A (\n"
 "inout graph_iri varchar, inout app_env any )\n"
 "{\n"
@@ -9742,11 +10814,80 @@ static const char *proc255 =
 "aq_wait_all (app_env[0]);\n"
 "commit work;\n"
 "DB.DBA.TTLP_EV_COMMIT (graph_iri, app_env[2]);\n"
-"commit work;\n"
+"commit work;\n"
+"}\n"
+"--src sparql.sql:10471\n";
+
+static const char *proc282 = 
+"#line 10486 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.TTLP_EV_TRIPLE_R (\n"
+"inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
+"inout o_uri varchar,\n"
+"inout app_env any )\n"
+"{\n"
+"\n"
+"if (app_env[4] is not null)\n"
+"__rdf_repl_quad (84, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), iri_canonicalize (o_uri));\n"
+"commit work;\n"
+"app_env[1] := coalesce (app_env[1], 0) + 1;\n"
+"DB.DBA.TTLP_EV_TRIPLE_W (g_iid, s_uri, p_uri, o_uri, app_env[2]);\n"
+"if (mod (app_env[1], 100000) = 0)\n"
+"{\n"
+"declare ro_id_dict any;\n"
+"ro_id_dict := app_env[2][1];\n"
+"if (ro_id_dict is not null)\n"
+"DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH (g_iid, ro_id_dict);\n"
+"}\n"
+"}\n"
+"--src sparql.sql:10484\n";
+
+static const char *proc283 = 
+"#line 10507 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.TTLP_EV_TRIPLE_L_R (\n"
+"inout g_iid IRI_ID, inout s_uri varchar, inout p_uri varchar,\n"
+"inout o_val any, inout o_type varchar, inout o_lang varchar,\n"
+"inout app_env any )\n"
+"{\n"
+"\n"
+"if (app_env[4] is not null)\n"
+"{\n"
+"if (isstring (o_type))\n"
+"__rdf_repl_quad (81, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val, iri_canonicalize (o_type), NULL);\n"
+"else if (isstring (o_lang))\n"
+"__rdf_repl_quad (82, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val, null, o_lang);\n"
+"else\n"
+"__rdf_repl_quad (80, app_env[4], iri_canonicalize (s_uri), iri_canonicalize (p_uri), o_val);\n"
+"}\n"
+"commit work;\n"
+"if (__tag of XML = __tag (o_val))\n"
+"{\n"
+"DB.DBA.TTLP_EV_TRIPLE_L_W (g_iid, s_uri, p_uri, o_val, o_type, o_lang, app_env[2]);\n"
+"return;\n"
+"}\n"
+"app_env[1] := coalesce (app_env[1], 0) + 1;\n"
+"DB.DBA.TTLP_EV_TRIPLE_L_W (g_iid, s_uri, p_uri, o_val, o_type, o_lang, app_env[2]);\n"
+"if (mod (app_env[1], 100000) = 0)\n"
+"{\n"
+"declare ro_id_dict any;\n"
+"ro_id_dict := app_env[2][1];\n"
+"if (ro_id_dict is not null)\n"
+"DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH (g_iid, ro_id_dict);\n"
+"}\n"
+"}\n"
+"--src sparql.sql:10505\n";
+
+static const char *proc284 = 
+"#line 10540 \"[executable]/sparql.sql\"\n"
+"create procedure DB.DBA.TTLP_EV_COMMIT_R (\n"
+"inout graph_iri varchar, inout app_env any )\n"
+"{\n"
+"\n"
+"DB.DBA.TTLP_EV_COMMIT (graph_iri, app_env[2]);\n"
 "}\n"
-"--src sparql.sql:9704\n";
+"--src sparql.sql:10538\n";
 
-static const char *proc256 = 
+static const char *proc285 = 
+"#line 10548 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.TTLP_MT (in strg varchar, in base varchar, in graph varchar := null, in flags integer := 0,\n"
 "in log_mode integer := 2, in threads integer := 3, in transactional int := 0)\n"
 "{\n"
@@ -9771,7 +10912,11 @@ static const char *proc256 =
 "}\n"
 "if (126 = __tag (strg))\n"
 "strg := cast (strg as varchar);\n"
-"app_env := vector (async_queue (threads), 0, vector (log_mode, null), __max (length (strg) / 100, 100000));\n"
+"app_env := vector ( async_queue (threads),\n"
+"0,\n"
+"vector (log_mode, null),\n"
+"__max (length (strg) / 100, 100000),\n"
+"null );\n"
 "rdf_load_turtle (strg, base, graph, flags,\n"
 "vector (\n"
 "\'DB.DBA.TTLP_EV_NEW_GRAPH_A\',\n"
@@ -9782,11 +10927,14 @@ static const char *proc256 =
 "\'DB.DBA.TTLP_EV_COMMIT_A\',\n"
 "\'DB.DBA.TTLP_EV_REPORT_DEFAULT\' ),\n"
 "app_env);\n"
+"if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue ()\');\n"
 "return graph;\n"
 "}\n"
-"--src sparql.sql:9716\n";
+"--src sparql.sql:10546\n";
 
-static const char *proc257 = 
+static const char *proc286 = 
+"#line 10593 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.TTLP_MT_LOCAL_FILE (in filename varchar, in base varchar, in graph varchar := null, in flags integer := 0,\n"
 "in log_mode integer := 2, in threads integer := 3, in transactional int := 0)\n"
 "{\n"
@@ -9809,7 +10957,12 @@ static const char *proc257 =
 "DB.DBA.TTLP_CL_LOCAL_FILE (filename, base, graph, flags);\n"
 "return;\n"
 "}\n"
-"app_env := vector (async_queue (threads), 0, vector (log_mode, null), 1000000);\n"
+"app_env := vector (\n"
+"async_queue (threads),\n"
+"0,\n"
+"vector (log_mode, null),\n"
+"1000000,\n"
+"null );\n"
 "rdf_load_turtle_local_file (filename, base, graph, flags,\n"
 "vector (\n"
 "\'DB.DBA.TTLP_EV_NEW_GRAPH_A\',\n"
@@ -9820,11 +10973,14 @@ static const char *proc257 =
 "\'DB.DBA.TTLP_EV_COMMIT_A\',\n"
 "\'DB.DBA.TTLP_EV_REPORT_DEFAULT\' ),\n"
 "app_env);\n"
+"if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue ()\');\n"
 "return graph;\n"
 "}\n"
-"--src sparql.sql:9755\n";
+"--src sparql.sql:10591\n";
 
-static const char *proc258 = 
+static const char *proc287 = 
+"#line 10637 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_LOAD_RDFXML_MT (in strg varchar, in base varchar, in graph varchar,\n"
 "in log_mode integer := 2, in threads integer := 3, in transactional int := 0)\n"
 "{\n"
@@ -9848,7 +11004,12 @@ static const char *proc258 =
 "ro_id_dict := dict_new ();\n"
 "else\n"
 "ro_id_dict := null;\n"
-"app_env := vector (async_queue (threads), 0, vector (log_mode, ro_id_dict), __max (length (strg) / 100, 100000));\n"
+"app_env := vector (\n"
+"async_queue (threads),\n"
+"0,\n"
+"vector (log_mode, ro_id_dict),\n"
+"__max (length (strg) / 100, 100000),\n"
+"null );\n"
 "rdf_load_rdfxml (strg, 0,\n"
 "graph,\n"
 "vector (\n"
@@ -9861,11 +11022,14 @@ static const char *proc258 =
 "\'DB.DBA.TTLP_EV_REPORT_DEFAULT\' ),\n"
 "app_env,\n"
 "base );\n"
+"if (__rdf_graph_is_in_enabled_repl (iri_to_id (graph)))\n"
+"repl_text (\'__rdf_repl\', \'__rdf_repl_flush_queue ()\');\n"
 "return graph;\n"
 "}\n"
-"--src sparql.sql:9792\n";
+"--src sparql.sql:10635\n";
 
-static const char *proc259 = 
+static const char *proc288 = 
+"#line 10688 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.VT_DECODE_KEYWORD_ITM (inout vtdata varchar, inout ofs integer)\n"
 "{\n"
 "declare res integer;\n"
@@ -9875,9 +11039,10 @@ static const char *proc259 =
 "ofs := ofs + 6;\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:9836\n";
+"--src sparql.sql:10686\n";
 
-static const char *proc260 = 
+static const char *proc289 = 
+"#line 10699 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.VT_ENCODE_KEYWORD_ITM (in id integer, inout ses any)\n"
 "{\n"
 "declare strg varchar;\n"
@@ -9890,9 +11055,10 @@ static const char *proc260 =
 "strg[0] := 5;\n"
 "http (strg, ses);\n"
 "}\n"
-"--src sparql.sql:9847\n";
+"--src sparql.sql:10697\n";
 
-static const char *proc261 = 
+static const char *proc290 = 
+"#line 10713 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.VT_COMPOSE_KEYWORD_INDEX_LINES (\n"
 "inout carry_d_id integer,\n"
 "inout carry_d_id_2 integer,\n"
@@ -9997,9 +11163,10 @@ static const char *proc261 =
 "\n"
 "return res_acc;\n"
 "}\n"
-"--src sparql.sql:9861\n";
+"--src sparql.sql:10711\n";
 
-static const char *proc262 = 
+static const char *proc291 = 
+"#line 10820 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_OBJ_PATCH_CONTAINS_BY_GRAPH (in phrase varchar, in graph_iri varchar)\n"
 "{\n"
 "declare graph_keyword any;\n"
@@ -10012,9 +11179,10 @@ static const char *proc262 =
 "err:\n"
 "return \'^\"#nosuch\"\';\n"
 "}\n"
-"--src sparql.sql:9968\n";
+"--src sparql.sql:10818\n";
 
-static const char *proc263 = 
+static const char *proc292 = 
+"#line 10835 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_OBJ_PATCH_CONTAINS_BY_MANY_GRAPHS (in phrase varchar, in graph_iris any)\n"
 "{\n"
 "declare isfirst, gctr, gcount integer;\n"
@@ -10043,9 +11211,10 @@ static const char *proc263 =
 "err:\n"
 "return \'^\"#nosuch\"\';\n"
 "}\n"
-"--src sparql.sql:9983\n";
+"--src sparql.sql:10833\n";
 
-static const char *proc264 = 
+static const char *proc293 = 
+"#line 10865 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH (in graph_iid IRI_ID, inout ro_id_dict any, in daq any := 0)\n"
 "{\n"
 "declare ro_id_offset, ro_ids_count integer;\n"
@@ -10099,9 +11268,10 @@ static const char *proc264 =
 "rollback work;\n"
 "goto again;\n"
 "}\n"
-"--src sparql.sql:10013\n";
+"--src sparql.sql:10863\n";
 
-static const char *proc265 = 
+static const char *proc294 = 
+"#line 10920 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH_OLD (in graph_iid IRI_ID, inout ro_id_dict any)\n"
 "{\n"
 "declare start_vt_d_id, aligned_start_vt_d_id, uncommited_ro_id_offset, ro_id_offset, ro_ids_count integer;\n"
@@ -10227,9 +11397,10 @@ static const char *proc265 =
 "rollback work;\n"
 "goto again;\n"
 "}\n"
-"--src sparql.sql:10068\n";
+"--src sparql.sql:10918\n";
 
-static const char *proc266 = 
+static const char *proc295 = 
+"#line 11047 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_OBJ_FT_RULE_ADD (in rule_g varchar, in rule_p varchar, in reason varchar) returns integer\n"
 "{\n"
 "declare rule_g_iid, rule_p_iid IRI_ID;\n"
@@ -10367,9 +11538,10 @@ static const char *proc266 =
 "__rdf_obj_ft_rule_add (rule_g_iid, rule_p_iid, reason);\n"
 "return 1;\n"
 "}\n"
-"--src sparql.sql:10195\n";
+"--src sparql.sql:11045\n";
 
-static const char *proc267 = 
+static const char *proc296 = 
+"#line 11186 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_OBJ_FT_RULE_DEL (in rule_g varchar, in rule_p varchar, in reason varchar) returns integer\n"
 "{\n"
 "declare rule_g_iid, rule_p_iid IRI_ID;\n"
@@ -10390,9 +11562,10 @@ static const char *proc267 =
 "__rdf_obj_ft_rule_del (rule_g_iid, rule_p_iid, reason);\n"
 "return 1;\n"
 "}\n"
-"--src sparql.sql:10334\n";
+"--src sparql.sql:11184\n";
 
-static const char *proc268 = 
+static const char *proc297 = 
+"#line 11208 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_OBJ_FT_RECOVER ()\n"
 "{\n"
 "declare stat, msg, STRG varchar;\n"
@@ -10423,9 +11596,9 @@ static const char *proc268 =
 "VT_INC_INDEX_DB_DBA_RDF_OBJ();\n"
 "result (\'... done\');\n"
 "}\n"
-"--src sparql.sql:10356\n";
+"--src sparql.sql:11206\n";
 
-static const char *tbl14 = 
+static const char *tbl15 = 
 "create table DB.DBA.RDF_GRAPH_GROUP (\n"
 "RGG_IID IRI_ID not null primary key,\n"
 "RGG_IRI varchar not null,\n"
@@ -10435,7 +11608,7 @@ static const char *tbl14 =
 "alter index RDF_GRAPH_GROUP on DB.DBA.RDF_GRAPH_GROUP partition cluster replicated\n"
 "create index RDF_GRAPH_GROUP_IRI on DB.DBA.RDF_GRAPH_GROUP (RGG_IRI) partition cluster replicated\n";
 
-static const char *tbl15 = 
+static const char *tbl16 = 
 "create table DB.DBA.RDF_GRAPH_GROUP_MEMBER (\n"
 "RGGM_GROUP_IID IRI_ID not null,\n"
 "RGGM_MEMBER_IID IRI_ID not null,\n"
@@ -10443,7 +11616,7 @@ static const char *tbl15 =
 ")\n"
 "alter index RDF_GRAPH_GROUP_MEMBER on DB.DBA.RDF_GRAPH_GROUP_MEMBER partition cluster replicated\n";
 
-static const char *tbl16 = 
+static const char *tbl17 = 
 "create table DB.DBA.RDF_GRAPH_USER (\n"
 "RGU_GRAPH_IID IRI_ID not null,\n"
 "RGU_USER_ID integer not null,\n"
@@ -10452,7 +11625,8 @@ static const char *tbl16 =
 ")\n"
 "alter index RDF_GRAPH_USER on DB.DBA.RDF_GRAPH_USER partition cluster replicated\n";
 
-static const char *proc269 = 
+static const char *proc298 = 
+"#line 11270 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_GRAPH_GROUP_CREATE_MEMONLY (in group_iri varchar, in group_iid IRI_ID)\n"
 "{\n"
 "group_iri := cast (group_iri as varchar);\n"
@@ -10461,9 +11635,10 @@ static const char *proc269 =
 "dict_put (__rdf_graph_group_dict(), group_iid, vector ());\n"
 "jso_mark_affected (group_iri);\n"
 "}\n"
-"--src sparql.sql:10418\n";
+"--src sparql.sql:11268\n";
 
-static const char *proc270 = 
+static const char *proc299 = 
+"#line 11280 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_GRAPH_GROUP_CREATE (in group_iri varchar, in quiet integer, in member_pattern varchar := null, in comment varchar := null)\n"
 "{\n"
 "declare group_iid IRI_ID;\n"
@@ -10484,9 +11659,10 @@ static const char *proc270 =
 "commit work;\n"
 "DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'DB.DBA.RDF_GRAPH_GROUP_CREATE_MEMONLY (?, ?)\', vector (group_iri, group_iid));\n"
 "}\n"
-"--src sparql.sql:10428\n";
+"--src sparql.sql:11278\n";
 
-static const char *proc271 = 
+static const char *proc300 = 
+"#line 11302 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_GRAPH_GROUP_DROP_MEMONLY (in group_iri varchar, in group_iid IRI_ID)\n"
 "{\n"
 "group_iri := cast (group_iri as varchar);\n"
@@ -10503,9 +11679,10 @@ static const char *proc271 =
 "jso_mark_affected (id_to_iri (iid));\n"
 "}\n"
 "}\n"
-"--src sparql.sql:10450\n";
+"--src sparql.sql:11300\n";
 
-static const char *proc272 = 
+static const char *proc301 = 
+"#line 11320 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_GRAPH_GROUP_DROP (in group_iri varchar, in quiet integer)\n"
 "{\n"
 "declare group_iid IRI_ID;\n"
@@ -10527,9 +11704,10 @@ static const char *proc272 =
 "commit work;\n"
 "DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'DB.DBA.RDF_GRAPH_GROUP_DROP_MEMONLY (?, ?)\', vector (group_iri, group_iid));\n"
 "}\n"
-"--src sparql.sql:10468\n";
+"--src sparql.sql:11318\n";
 
-static const char *proc273 = 
+static const char *proc302 = 
+"#line 11343 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_GRAPH_CHECK_VISIBILITY_CHANGE (in memb_iri varchar, in special_iid IRI_ID)\n"
 "{\n"
 "declare memb_iid IRI_ID;\n"
@@ -10556,9 +11734,10 @@ static const char *proc273 =
 "case (equ (special_iid, #i8192)) when 0 then \'removed from the \"private area\"\' else \'added to the \"private area\"\' end ) );\n"
 "}\n"
 "}\n"
-"--src sparql.sql:10491\n";
+"--src sparql.sql:11341\n";
 
-static const char *proc274 = 
+static const char *proc303 = 
+"#line 11371 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_GRAPH_GROUP_INS_MEMONLY (in group_iri varchar, in group_iid IRI_ID, in memb_iri varchar, in memb_iid IRI_ID)\n"
 "{\n"
 "group_iri := cast (group_iri as varchar);\n"
@@ -10578,9 +11757,10 @@ static const char *proc274 =
 "jso_mark_affected (memb_iri);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:10519\n";
+"--src sparql.sql:11369\n";
 
-static const char *proc275 = 
+static const char *proc304 = 
+"#line 11392 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_GRAPH_GROUP_INS (in group_iri varchar, in memb_iri varchar)\n"
 "{\n"
 "declare group_iid, memb_iid IRI_ID;\n"
@@ -10599,9 +11779,10 @@ static const char *proc275 =
 "commit work;\n"
 "DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'DB.DBA.RDF_GRAPH_GROUP_INS_MEMONLY (?, ?, ?, ?)\', vector (group_iri, group_iid, memb_iri, memb_iid));\n"
 "}\n"
-"--src sparql.sql:10540\n";
+"--src sparql.sql:11390\n";
 
-static const char *proc276 = 
+static const char *proc305 = 
+"#line 11412 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_GRAPH_GROUP_DEL_MEMONLY (in group_iri varchar, in group_iid IRI_ID, in memb_iri varchar, in memb_iid IRI_ID)\n"
 "{\n"
 "group_iri := cast (group_iri as varchar);\n"
@@ -10621,9 +11802,10 @@ static const char *proc276 =
 "jso_mark_affected (memb_iri);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:10560\n";
+"--src sparql.sql:11410\n";
 
-static const char *proc277 = 
+static const char *proc306 = 
+"#line 11433 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_GRAPH_GROUP_DEL (in group_iri varchar, in memb_iri varchar)\n"
 "{\n"
 "declare group_iid, memb_iid IRI_ID;\n"
@@ -10642,9 +11824,10 @@ static const char *proc277 =
 "commit work;\n"
 "DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'DB.DBA.RDF_GRAPH_GROUP_DEL_MEMONLY (?, ?, ?, ?)\', vector (group_iri, group_iid, memb_iri, memb_iid));\n"
 "}\n"
-"--src sparql.sql:10581\n";
+"--src sparql.sql:11431\n";
 
-static const char *proc278 = 
+static const char *proc307 = 
+"#line 11453 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_GRAPH_USER_PERMS_GET (in graph_iri varchar, in uid any) returns integer\n"
 "{\n"
 "declare graph_iid IRI_ID;\n"
@@ -10661,9 +11844,10 @@ static const char *proc278 =
 "__rdf_graph_approx_perms (graph_iid, uid) );\n"
 "return res;\n"
 "}\n"
-"--src sparql.sql:10601\n";
+"--src sparql.sql:11451\n";
 
-static const char *proc279 = 
+static const char *proc308 = 
+"#line 11471 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_GRAPH_USER_PERMS_ACK (in graph_iri any, in uid any, in req_perms integer) returns integer\n"
 "{\n"
 "declare app_cbk, app_uid varchar;\n"
@@ -10701,9 +11885,10 @@ static const char *proc279 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src sparql.sql:10619\n";
+"--src sparql.sql:11469\n";
 
-static const char *proc280 = 
+static const char *proc309 = 
+"#line 11511 \"[executable]/sparql.sql\"\n"
 " create function DB.DBA.RDF_GRAPH_USER_PERM_TITLE (in perms integer) returns varchar\n"
 "{\n"
 "if (bit_and (perms, 1))\n"
@@ -10716,9 +11901,10 @@ static const char *proc280 =
 "return \'get-group-list\';\n"
 "return sprintf (\'\"%d\"\', perms);\n"
 "}\n"
-"--src sparql.sql:10659\n";
+"--src sparql.sql:11509\n";
 
-static const char *proc281 = 
+static const char *proc310 = 
+"#line 11525 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_GRAPH_USER_PERMS_ASSERT (in graph_iri varchar, in uid any, in req_perms integer, in opname varchar) returns varchar\n"
 "{\n"
 "declare app_cbk, app_uid varchar;\n"
@@ -10764,9 +11950,10 @@ static const char *proc281 =
 "}\n"
 "return graph_iri;\n"
 "}\n"
-"--src sparql.sql:10673\n";
+"--src sparql.sql:11523\n";
 
-static const char *proc282 = 
+static const char *proc311 = 
+"#line 11572 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_DEFAULT_USER_PERMS_SET_MEMONLY (in uname varchar, in uid integer, in perms integer, in special_iid IRI_ID, in set_private integer, in affected_jso any)\n"
 "{\n"
 "dict_put (__rdf_graph_default_perms_of_user_dict (set_private), uid, perms);\n"
@@ -10775,9 +11962,10 @@ static const char *proc282 =
 "foreach (varchar jso_key in affected_jso) do\n"
 "jso_mark_affected (jso_key);\n"
 "}\n"
-"--src sparql.sql:10720\n";
+"--src sparql.sql:11570\n";
 
-static const char *proc283 = 
+static const char *proc312 = 
+"#line 11582 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_DEFAULT_USER_PERMS_SET (in uname varchar, in perms integer, in set_private integer := 0)\n"
 "{\n"
 "declare uid integer;\n"
@@ -10824,6 +12012,8 @@ static const char *proc283 =
 "\n"
 "\n"
 "\n"
+"if (isstring (registry_get (\'DB.DBA.RDF_REPL\')) and not (bit_and (perms, 1)))\n"
+"signal (\'RDF99\', \'Can not disable public read while RDF replication is enabled\');\n"
 "}\n"
 "if (uname <> \'dba\')\n"
 "{\n"
@@ -10849,9 +12039,10 @@ static const char *proc283 =
 "commit work;\n"
 "DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'DB.DBA.RDF_DEFAULT_USER_PERMS_SET_MEMONLY (?,?,?,?,?,?)\', vector (uname, uid, perms, special_iid, set_private, affected_jso));\n"
 "}\n"
-"--src sparql.sql:10730\n";
+"--src sparql.sql:11580\n";
 
-static const char *proc284 = 
+static const char *proc313 = 
+"#line 11657 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_GRAPH_USER_PERMS_SET_MEMONLY (in graph_iri varchar, in graph_iid IRI_ID, in uid integer, in perms integer)\n"
 "{\n"
 "graph_iri := cast (graph_iri as varchar);\n"
@@ -10863,9 +12054,10 @@ static const char *proc284 =
 "__rdf_graph_specific_perms_of_user (graph_iid, uid, perms);\n"
 "jso_mark_affected (graph_iri);\n"
 "}\n"
-"--src sparql.sql:10803\n";
+"--src sparql.sql:11655\n";
 
-static const char *proc285 = 
+static const char *proc314 = 
+"#line 11670 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_GRAPH_USER_PERMS_SET (in graph_iri varchar, in uname varchar, in perms integer)\n"
 "{\n"
 "declare graph_iid IRI_ID;\n"
@@ -10892,7 +12084,13 @@ static const char *proc285 =
 "if (bit_and (bit_not (perms), common_perms))\n"
 "signal (\'RDF99\', sprintf (\'Default permissions of user \"%s\" on RDF quad store are broader than new permissions on specific graph <%s>\', uname, graph_iri));\n"
 "if (uname = \'nobody\')\n"
+"{\n"
 "jso_mark_affected (graph_iri);\n"
+"if (isstring (registry_get (\'DB.DBA.RDF_REPL\')) and not (bit_and (perms, 1)) and\n"
+"exists (select top 1 1 from DB.DBA.RDF_GRAPH_GROUP_MEMBER\n"
+"where RGGM_GROUP_IID = iri_to_id (UNAME\'http://www.openlinksw.com/schemas/virtrdf#rdf_repl_graph_group\') and RGGM_MEMBER_IID = graph_iid) )\n"
+"signal (\'RDF99\', \'Can not disable public read access to <\' || id_to_iri (graph_iid) || \'> while it is included in RDF replication and the replication is enabled\');\n"
+"}\n"
 "else\n"
 "{\n"
 "common_perms := coalesce (\n"
@@ -10912,9 +12110,10 @@ static const char *proc285 =
 "commit work;\n"
 "DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'DB.DBA.RDF_GRAPH_USER_PERMS_SET_MEMONLY (?,?,?,?)\', vector (graph_iri, graph_iid, uid, perms));\n"
 "}\n"
-"--src sparql.sql:10816\n";
+"--src sparql.sql:11668\n";
 
-static const char *proc286 = 
+static const char *proc315 = 
+"#line 11724 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_GRAPH_GROUP_LIST_GET (in group_iri any, in extra_graphs any, in uid any, in gs_app_cbk varchar, in gs_app_uid varchar, in req_perms integer) returns any\n"
 "{\n"
 "declare group_iid IRI_ID;\n"
@@ -11033,14 +12232,15 @@ static const char *proc286 =
 "vectorbld_final (filtered_list);\n"
 "return filtered_list;\n"
 "}\n"
-"--src sparql.sql:10864\n";
+"--src sparql.sql:11722\n";
 
-static const char *proc287 = 
+static const char *proc316 = 
+"#line 11847 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.SPARQL_RELOAD_QM_GRAPH ()\n"
 "{\n"
 "declare ver varchar;\n"
 "declare inx int;\n"
-"ver := \'2010-03-22 0003v6g\';\n"
+"ver := \'2010-08-29 0001v6g\';\n"
 "if (USER <> \'dba\')\n"
 "signal (\'RDFXX\', \'Only DBA can reload quad map metadata\');\n"
 "if (not exists (sparql define input:storage \"\" ask where {\n"
@@ -11077,6 +12277,12 @@ static const char *proc287 =
 "virtrdf:qsMatchingFlags virtrdf:SPART_QS_NO_IMPLICIT_USER_QM .\n"
 "virtrdf:DefaultServiceStorage-UserMaps\n"
 "rdf:type virtrdf:array-of-QuadMap .\n"
+"\n"
+"virtrdf:SyncToQuads\n"
+"rdf:type virtrdf:QuadStorage ;\n"
+"virtrdf:qsUserMaps virtrdf:SyncToQuads-UserMaps .\n"
+"virtrdf:SyncToQuads-UserMaps\n"
+"rdf:type virtrdf:array-of-QuadMap .\n"
 "\';\n"
 "jso_sys_g_iid := iri_to_id (JSO_SYS_GRAPH ());\n"
 "dict1 := DB.DBA.RDF_TTL2HASH (txt1, \'\');\n"
@@ -11119,9 +12325,10 @@ static const char *proc287 =
 "sequence_set (\'RDF_PREF_SEQ\', 101, 1);\n"
 "sequence_set (\'RDF_RO_ID\', 1001, 1);\n"
 "}\n"
-"--src sparql.sql:10987\n";
+"--src sparql.sql:11845\n";
 
-static const char *proc288 = 
+static const char *proc317 = 
+"#line 11938 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_CREATE_SPARQL_ROLES ()\n"
 "{\n"
 "declare state, msg varchar;\n"
@@ -11222,6 +12429,7 @@ static const char *proc288 =
 "\'grant execute on DB.DBA.RDF_GRAPH_TO_TTL to SPARQL_SELECT\',\n"
 "\'grant execute on DB.DBA.RDF_TRIPLES_TO_RDF_XML_TEXT to SPARQL_SELECT\',\n"
 "\'grant execute on DB.DBA.RDF_TRIPLES_TO_TALIS_JSON to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_TRIPLES_TO_CSV to SPARQL_SELECT\',\n"
 "\'grant execute on DB.DBA.RDF_TRIPLES_TO_RDFA_XHTML to SPARQL_SELECT\',\n"
 "\'grant execute on DB.DBA.RDF_TRIPLES_TO_ATOM_XML_TEXT to SPARQL_SELECT\',\n"
 "\'grant execute on DB.DBA.RDF_TRIPLES_TO_ODATA_JSON to SPARQL_SELECT\',\n"
@@ -11237,9 +12445,22 @@ static const char *proc288 =
 "\'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_INIT to SPARQL_SELECT\',\n"
 "\'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_ACC to SPARQL_SELECT\',\n"
 "\'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_FIN to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_INIT to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_ACC to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_FIN to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_INIT to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_ACC to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_FIN to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_ATOM_XML to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_ODATA_JSON to SPARQL_SELECT\',\n"
 "\'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TTL to SPARQL_SELECT\',\n"
 "\'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_NT to SPARQL_SELECT\',\n"
 "\'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_RDF_XML to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TALIS_JSON to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CSV to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_RDFA_XHTML to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CXML to SPARQL_SELECT\',\n"
+"\'grant execute on DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CXML_QRCODE to SPARQL_SELECT\',\n"
 "\'grant execute on DB.DBA.RDF_INSERT_TRIPLES to SPARQL_UPDATE\',\n"
 "\'grant execute on DB.DBA.RDF_DELETE_TRIPLES to SPARQL_UPDATE\',\n"
 "\'grant execute on DB.DBA.RDF_DELETE_TRIPLES_AGG to SPARQL_UPDATE\',\n"
@@ -11276,6 +12497,7 @@ static const char *proc288 =
 "\'grant execute on DB.DBA.TTLP_EV_NEW_GRAPH_A to SPARQL_UPDATE\',\n"
 "\'grant execute on DB.DBA.TTLP_EV_TRIPLE_A to SPARQL_UPDATE\',\n"
 "\'grant execute on DB.DBA.TTLP_EV_TRIPLE_L_A to SPARQL_UPDATE\',\n"
+"\'grant execute on DB.DBA.TTLP_EV_REPORT_DEFAULT to SPARQL_UPDATE\',\n"
 "\'grant execute on DB.DBA.RDF_LOAD_RDFXML_MT to SPARQL_UPDATE\',\n"
 "\'grant execute on DB.DBA.RDF_LOAD_HTTP_RESPONSE to SPARQL_UPDATE\',\n"
 "\'grant execute on DB.DBA.RDF_FORGET_HTTP_RESPONSE to SPARQL_UPDATE\',\n"
@@ -11289,9 +12511,10 @@ static const char *proc288 =
 "exec (cmd, state, msg);\n"
 "}\n"
 "}\n"
-"--src sparql.sql:11072\n";
+"--src sparql.sql:11936\n";
 
-static const char *proc289 = 
+static const char *proc318 = 
+"#line 12122 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QUAD_AUDIT ()\n"
 "{\n"
 "declare stat, msg varchar;\n"
@@ -11362,9 +12585,10 @@ static const char *proc289 =
 "if (not isstring (registry_get (\'DB.DBA.RDF_QUAD_FT_UPGRADE\')))\n"
 "result (\'ERRft\', \'new layout but not isstring (registry_get (\'\'DB.DBA.RDF_QUAD_FT_UPGRADE\'\'))\');\n"
 "}\n"
-"--src sparql.sql:11241\n";
+"--src sparql.sql:12120\n";
 
-static const char *proc290 = 
+static const char *proc319 = 
+"#line 12194 \"[executable]/sparql.sql\"\n"
 "create procedure DB.DBA.RDF_QUAD_FT_UPGRADE ()\n"
 "{\n"
 "declare stat, msg varchar;\n"
@@ -11401,13 +12625,6 @@ static const char *proc290 =
 "from DB.DBA.RDF_GRAPH_USER where RGU_USER_ID = http_nobody_uid () );\n"
 "fake := (select count (__rdf_graph_specific_perms_of_user (RGU_GRAPH_IID, RGU_USER_ID, RGU_PERMISSIONS))\n"
 "from DB.DBA.RDF_GRAPH_USER where RGU_USER_ID <> http_nobody_uid () and not (RGU_GRAPH_IID in (#i0, #i8192)) );\n"
-"if (1 <> sys_stat (\'cl_run_local_only\'))\n"
-"goto final_qm_reload;\n"
-"if (244 = coalesce ((select COL_DTP from SYS_COLS where \"TABLE\" = \'DB.DBA.RDF_QUAD\' and \"COLUMN\"=\'G\'), 0))\n"
-"{\n"
-"__set_64bit_min_bnode_iri_id();\n"
-"sequence_set (\'RDF_URL_IID_BLANK\', iri_id_num (min_bnode_iri_id ()), 1);\n"
-"}\n"
 "if (coalesce (cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'RecoveryMode\'), \'0\') > \'0\')\n"
 "{\n"
 "log_message (\'Switching to RecoveryMode as set in [SPARQL] section of the configuration.\');\n"
@@ -11415,36 +12632,13 @@ static const char *proc290 =
 "exec (\'revoke \"SPARQL_UPDATE\" from \"SPARQL\"\', stat, msg);\n"
 "return;\n"
 "}\n"
-"if (not isstring (registry_get (\'DB.DBA.RDF_QUAD_FT_UPGRADE-tridgell32-2\')))\n"
-"{\n"
-"__atomic (1);\n"
-"{\n"
-"set isolation=\'uncommitted\';\n"
-"declare exit handler for sqlstate \'*\'\n"
-"{\n"
-"log_message (\'Error during upgrade of RDF_OBJ:\');\n"
-"log_message (__SQL_STATE || \': \' || \"LEFT\" (__SQL_MESSAGE, 1000));\n"
-"goto describe_recovery;\n"
-"};\n"
-"declare rolong_cur cursor for select RO_VAL, RO_LONG from DB.DBA.RDF_OBJ where RO_LONG is not null and length (RO_VAL) = 6 for update;\n"
-"whenever not found goto rolong_cur_end;\n"
-"open rolong_cur;\n"
-"while (1)\n"
+"if (1 <> sys_stat (\'cl_run_local_only\'))\n"
+"goto final_qm_reload;\n"
+"if (244 = coalesce ((select COL_DTP from SYS_COLS where \"TABLE\" = \'DB.DBA.RDF_QUAD\' and \"COLUMN\"=\'G\'), 0))\n"
 "{\n"
-"declare rl any;\n"
-"declare old_rv, new_rv varchar;\n"
-"fetch rolong_cur into old_rv, rl;\n"
-"new_rv := tridgell32 (blob_to_string (rl));\n"
-"if (new_rv <> old_rv)\n"
-"update DB.DBA.RDF_OBJ set RO_VAL = new_rv where current of rolong_cur;\n"
-"}\n"
-"rolong_cur_end: ;\n"
-"registry_set (\'DB.DBA.RDF_QUAD_FT_UPGRADE-tridgell32-2\', \'1\');\n"
-"}\n"
-"__atomic (0);\n"
-"exec (\'checkpoint\');\n"
+"__set_64bit_min_bnode_iri_id();\n"
+"sequence_set (\'RDF_URL_IID_BLANK\', iri_id_num (min_bnode_iri_id ()), 1);\n"
 "}\n"
-"tridgell_ok:\n"
 "\n"
 "if (exists (select top 1 1 from DB.DBA.SYS_COLS\n"
 "where \"TABLE\" = fix_identifier_case (\'DB.DBA.RDF_OBJ_RO_FLAGS_WORDS\')\n"
@@ -11461,125 +12655,6 @@ static const char *proc290 =
 "0, 0, vector (), 1, \'\'*ini*\'\', \'\'UTF-8-QR\'\')\', stat, msg);\n"
 "__vt_index (\'DB.DBA.RDF_QUAD\', \'RDF_QUAD_OP\', \'O\', \'O\', \'DB.DBA.RDF_OBJ_RO_FLAGS_WORDS\');\n"
 "exec (\'DB.DBA.vt_batch_update (fix_identifier_case (\'\'DB.DBA.RDF_OBJ\'\'), \'\'ON\'\', 1)\', stat, msg);\n"
-"if (isstring (registry_get (\'DB.DBA.RDF_QUAD_FT_UPGRADE\')))\n"
-"goto final_qm_reload;\n"
-"__atomic (1);\n"
-"{\n"
-"declare exit handler for sqlstate \'*\'\n"
-"{\n"
-"log_message (\'Error during upgrade of free-text index of RDF_QUAD:\');\n"
-"log_message (__SQL_STATE || \': \' || \"LEFT\" (__SQL_MESSAGE, 1000));\n"
-"goto describe_recovery;\n"
-"};\n"
-"\n"
-"log_enable (0);\n"
-"if (exists (select top 1 1 from DB.DBA.RDF_QUAD))\n"
-"log_message (\'Upgrading RDF indices.  Can be up to an hour per GB of RDF data.\');\n"
-"registry_set (\'DB.DBA.RDF_QUAD_FT_UPGRADE\', \'1\');\n"
-"if (exists (select top 1 1 from DB.DBA.SYS_COLS\n"
-"where \"TABLE\" = fix_identifier_case (\'DB.DBA.RDF_OBJ\')\n"
-"and \"COLUMN\" = fix_identifier_case (\'RO_DIGEST\')\n"
-"and COL_DTP = __tag of varchar ))\n"
-"{\n"
-"exec (\'drop index RO_DIGEST\', stat, msg);\n"
-"exec (\'alter table DB.DBA.RDF_OBJ drop RO_DIGEST\', stat, msg);\n"
-"\n"
-"exec (\'alter table DB.DBA.RDF_OBJ add RO_FLAGS smallint not null default 0\', stat, msg);\n"
-"exec (\'alter table DB.DBA.RDF_OBJ add RO_DT_AND_LANG integer not null default 16843009\', stat, msg);\n"
-"\n"
-"commit work;\n"
-"}\n"
-"set isolation=\'uncommitted\';\n"
-"{\n"
-"declare longtyped_cur cursor for select G,S,P,O\n"
-"from DB.DBA.RDF_QUAD\n"
-"where isstring (O) and length (O) = 29;\n"
-"declare g_old, s_old, p_old any;\n"
-"declare o_old varchar;\n"
-"declare val_len, o_id integeR;\n"
-"declare o_new any;\n"
-"whenever not found goto longtyped_cur_end;\n"
-"open longtyped_cur;\n"
-"while (1)\n"
-"{\n"
-"declare o_long any;\n"
-"declare o_strval varchar;\n"
-"fetch longtyped_cur into g_old, s_old, p_old, o_old;\n"
-"\n"
-"if (o_old [22] <> 0)\n"
-"{\n"
-"log_message (\'The function DB.DBA.RDF_QUAD_FT_UPGRADE() has found ill formed object literal in DB.DBA.RDF_QUAD\');\n"
-"log_message (\'This means that this version of Virtuoso server can not process RDF data stored in the database.\');\n"
-"log_message (\'To fix the problem, remove the transaction log and start previous version of Virtuoso.\');\n"
-"log_message (sprintf (\'The example of ill literal is |%U|, if escaped like URL\', o_old));\n"
-"goto describe_recovery;\n"
-"}\n"
-"o_long := jso_parse_digest (o_old);\n"
-"o_strval := (select case (isnull (RO_LONG)) when 0 then blob_to_string (RO_LONG) else RO_VAL end from DB.DBA.RDF_OBJ where RO_ID = o_long[3]);\n"
-"o_new := DB.DBA.RDF_OBJ_ADD (o_long[0], o_strval, o_long[2]);\n"
-"insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_old, s_old, p_old, o_new);\n"
-"}\n"
-"longtyped_cur_end: ;\n"
-"}\n"
-"delete from DB.DBA.RDF_QUAD where isstring (O) and length (O) = 29;\n"
-"\n"
-"{\n"
-"declare shortobj_cur cursor for select G,S,P,O from DB.DBA.RDF_QUAD where isstring (O) and length (O) < 29;\n"
-"declare g_old, s_old, p_old any;\n"
-"declare o_old varchar;\n"
-"declare val_len, o_id integeR;\n"
-"declare o_new any;\n"
-"whenever not found goto shortobj_cur_end;\n"
-"open shortobj_cur;\n"
-"while (1)\n"
-"{\n"
-"declare o_dt, o_lang integeR;\n"
-"fetch shortobj_cur into g_old, s_old, p_old, o_old;\n"
-"val_len := length (o_old) - 5;\n"
-"if (o_old [val_len+2] <> 0)\n"
-"{\n"
-"log_message (\'The function DB.DBA.RDF_QUAD_FT_UPGRADE() has found ill formed object literal in DB.DBA.RDF_QUAD\');\n"
-"log_message (\'This means that this version of Virtuoso server can not process RDF data stored in the database.\');\n"
-"log_message (\'To fix the problem, remove the transaction log and start previous version of Virtuoso.\');\n"
-"log_message (sprintf (\'The example of ill literal is |%U|, if escaped like URL\', o_old));\n"
-"goto describe_recovery;\n"
-"}\n"
-"o_dt := o_old[0] + o_old[1]*256;\n"
-"o_lang := o_old[val_len+3] + o_old[val_len+4]*256;\n"
-"o_new := DB.DBA.RDF_OBJ_ADD (o_dt, subseq (o_old, 2, val_len+2), o_lang);\n"
-"if (isstring (o_new))\n"
-"insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_old, s_old, p_old, o_new || \'012345678901234567890123456789\');\n"
-"else\n"
-"insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_old, s_old, p_old, o_new);\n"
-"commit work;\n"
-"}\n"
-"shortobj_cur_end: ;\n"
-"}\n"
-"delete from DB.DBA.RDF_QUAD where isstring (O) and length (O) < 29;\n"
-"\n"
-"{\n"
-"declare tmpval_cur cursor for select G,S,P,O\n"
-"from DB.DBA.RDF_QUAD\n"
-"where isstring (O) and length (O) > 29;\n"
-"declare g_old, s_old, p_old any;\n"
-"declare o_old varchar;\n"
-"whenever not found goto tmpval_cur_end;\n"
-"open tmpval_cur;\n"
-"while (1)\n"
-"{\n"
-"fetch tmpval_cur into g_old, s_old, p_old, o_old;\n"
-"\n"
-"insert soft DB.DBA.RDF_QUAD (G,S,P,O) values (g_old, s_old, p_old, subseq (o_old, 0, length (o_old) - 30));\n"
-"}\n"
-"tmpval_cur_end: ;\n"
-"}\n"
-"delete from DB.DBA.RDF_QUAD where isstring (O) and length (O) > 29;\n"
-"\n"
-"commit work;\n"
-"log_enable (1);\n"
-"}\n"
-"__atomic (0);\n"
-"exec (\'checkpoint\');\n"
 "\n"
 "final_qm_reload:\n"
 "DB.DBA.SPARQL_RELOAD_QM_GRAPH ();\n"
@@ -11587,33 +12662,25 @@ static const char *proc290 =
 "(iri_to_id (\'http://www.openlinksw.com/schemas/virtrdf#Geometry\'), 256, \'http://www.openlinksw.com/schemas/virtrdf#Geometry\');\n"
 "\n"
 "return;\n"
-"\n"
-"describe_recovery:\n"
-"log_message (\'Remove the transaction log and start previous version of Virtuoso.\');\n"
-"log_message (\'You may use the database with new version of Virtuoso server for\');\n"
-"log_message (\'diagnostics and error recovery; to make it possible, add parameter\');\n"
-"log_message (\'\"RecoveryMode=1\" to the [SPARQL] section of \' || virtuoso_ini_path ());\n"
-"log_message (\'and restart the server; remove the parameter and restart as soon as possible\');\n"
-"log_message (\'This error is critical. The server will now exit. Sorry.\');\n"
-"\n"
-"raw_exit ();\n"
 "}\n"
-"--src sparql.sql:11313\n";
+"--src sparql.sql:12192\n";
 
 
-static const char *other30 = 
+static const char *other34 = 
 " DB.DBA.RDF_QUAD_FT_UPGRADE ()\n";
-static const char *other31 = 
+static const char *other35 = 
 "DB.DBA.RDF_CREATE_SPARQL_ROLES ()\n";
-static const char *proc291 = 
+static const char *proc320 = 
+"#line 12283 \"[executable]/sparql.sql\"\n"
 "create procedure rdfs_pn (in is_class int)\n"
 "{\n"
 "return case when is_class = 1 then iri_to_id (\'http://www.w3.org/2000/01/rdf-schema#subClassOf\')\n"
 "else  iri_to_id (\'http://www.w3.org/2000/01/rdf-schema#subPropertyOf\') end;\n"
 "}\n"
-"--src sparql.sql:11561\n";
+"--src sparql.sql:12281\n";
 
-static const char *proc292 = 
+static const char *proc321 = 
+"#line 12291 \"[executable]/sparql.sql\"\n"
 "create procedure rdf_owl_sas_p (in gr iri_id, in name varchar, in super_c iri_id, in c iri_id, in visited any, inout supers any, in pos int)\n"
 "{\n"
 "declare txt varchar;\n"
@@ -11635,14 +12702,15 @@ static const char *proc292 =
 "}\n"
 "exec_close (cc);\n"
 "}\n"
-"--src sparql.sql:11569\n";
+"--src sparql.sql:12289\n";
 
-static const char *tbl17 = 
+static const char *tbl18 = 
 "create table DB.DBA.SYS_RDF_SCHEMA (RS_NAME VARCHAR , RS_URI VARCHAR, RS_G IRI_ID,\n"
 "PRIMARY KEY (RS_NAME, RS_URI))\n"
 "alter index SYS_RDF_SCHEMA on DB.DBA.SYS_RDF_SCHEMA partition cluster replicated\n";
 
-static const char *proc293 = 
+static const char *proc322 = 
+"#line 12320 \"[executable]/sparql.sql\"\n"
 "create function rdfs_load_schema (in ri_name varchar, in gn varchar := null) returns integer\n"
 "{\n"
 "declare gr iri_id;\n"
@@ -11655,7 +12723,9 @@ static const char *proc293 =
 "declare v any;\n"
 "declare inx int;\n"
 "declare from_text varchar;\n"
+"declare rules_count integer;\n"
 "from_text := \'\';\n"
+"res := 0;\n"
 "if (gn is null)\n"
 "{\n"
 "for (select rs_uri from sys_rdf_schema where rs_name=ri_name) do\n"
@@ -11686,9 +12756,13 @@ static const char *proc293 =
 "{\n"
 "rdf_inf_dir (ri_name, s, o, 2);\n"
 "rdf_inf_dir (ri_name, s, o, 3);\n"
+"rules_count := rules_count + 2;\n"
 "}\n"
 "else\n"
+"{\n"
 "rdf_inf_dir (ri_name, o, s, idx);\n"
+"rules_count := rules_count + 1;\n"
+"}\n"
 "}\n"
 "}\n"
 "exec_close (cc);\n"
@@ -11732,6 +12806,7 @@ static const char *proc293 =
 "\n"
 "gvector_digit_sort (v, 1, 0, 1);\n"
 "rdf_inf_set_ifp_list (ri_name, v);\n"
+"rules_count := rules_count + length (v);\n"
 "txt := sprintf (\'\n"
 "select vector_agg (sub.\"o\") from\n"
 "(sparql define output:valmode \"LONG\" define input:storage \"\"\n"
@@ -11774,6 +12849,7 @@ static const char *proc293 =
 "{\n"
 "gvector_sort (v, 2, 0, 1);\n"
 "rdf_inf_set_inverses (ri_name, v);\n"
+"rules_count := rules_count + length (v);\n"
 "}\n"
 "\n"
 "txt := sprintf (\'select DB.DBA.VECTOR_CONCAT_AGG (vector (sub.\"s\", 1)) from\n"
@@ -11786,33 +12862,39 @@ static const char *proc293 =
 "{\n"
 "gvector_sort (v, 2, 0, 1);\n"
 "rdf_inf_set_prop_props (ri_name, v);\n"
+"rules_count := rules_count + length (v);\n"
 "}\n"
-"return 1;\n"
+"jso_mark_affected (ri_name);\n"
+"return rules_count + 1;\n"
 "}\n"
-"--src sparql.sql:11598\n";
+"--src sparql.sql:12318\n";
 
-static const char *proc294 = 
+static const char *proc323 = 
+"#line 12479 \"[executable]/sparql.sql\"\n"
 "create procedure rdf_schema_ld ()\n"
 "{\n"
 "if (1 <> sys_stat (\'cl_run_local_only\'))\n"
 "return 0;\n"
 "return (select count (*) from (select distinct s.rs_name from sys_rdf_schema s) sub where 0 = rdfs_load_schema (sub.rs_name));\n"
 "}\n"
-"--src sparql.sql:11747\n";
+"--src sparql.sql:12477\n";
 
-static const char *other32 = 
+static const char *other36 = 
 "rdf_schema_ld ()\n";
-static const char *proc295 = 
-"create procedure CL_RDF_INF_CHANGED_SRV (in name varchar)\n"
+static const char *proc324 = 
+"#line 12491 \"[executable]/sparql.sql\"\n"
+"create function CL_RDF_INF_CHANGED_SRV (in name varchar) returns integer\n"
 "{\n"
+"declare res integer;\n"
 "set isolation = \'committed\';\n"
 "rdf_inf_clear (name);\n"
 "return case (rdfs_load_schema (name)) when 0 then 1 else 0 end;\n"
-"jso_mark_affected (name);\n"
+"return res;\n"
 "}\n"
-"--src sparql.sql:11759\n";
+"--src sparql.sql:12489\n";
 
-static const char *proc296 = 
+static const char *proc325 = 
+"#line 12501 \"[executable]/sparql.sql\"\n"
 "create procedure CL_RDF_INF_CHANGED (in name varchar)\n"
 "{\n"
 "declare aq any;\n"
@@ -11822,10 +12904,11 @@ static const char *proc296 =
 "aq_request (aq, \'DB.DBA.CL_RDF_INF_CHANGED_SRV\', vector (name));\n"
 "aq_wait_all (aq);\n"
 "}\n"
-"--src sparql.sql:11768\n";
+"--src sparql.sql:12499\n";
 
-static const char *proc297 = 
-"create procedure rdfs_rule_set (in name varchar, in gn varchar, in remove int := 0)\n"
+static const char *proc326 = 
+"#line 12512 \"[executable]/sparql.sql\"\n"
+"create function rdfs_rule_set (in name varchar, in gn varchar, in remove int := 0) returns integer\n"
 "{\n"
 "delete from sys_rdf_schema where rs_name = name and rs_uri = gn;\n"
 "if (not remove)\n"
@@ -11834,17 +12917,23 @@ static const char *proc297 =
 "}\n"
 "commit work;\n"
 "if (0 = sys_stat (\'cl_run_local_only\'))\n"
+"{\n"
 "DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'DB.DBA.CL_RDF_INF_CHANGED (?)\', vector (name));\n"
+"return 1;\n"
+"}\n"
 "else\n"
 "{\n"
+"declare res integer;\n"
 "rdf_inf_clear (name);\n"
-"rdfs_load_schema (name);\n"
+"res := rdfs_load_schema (name);\n"
 "log_text (\'db.dba.rdfs_load_schema (?)\', name);\n"
+"return res;\n"
 "}\n"
 "}\n"
-"--src sparql.sql:11779\n";
+"--src sparql.sql:12510\n";
 
-static const char *proc298 = 
+static const char *proc327 = 
+"#line 12536 \"[executable]/sparql.sql\"\n"
 "create function DB.DBA.RDF_IID_OF_QNAME (in qname varchar) returns IRI_ID\n"
 "{\n"
 "whenever sqlstate \'*\' goto retnull;\n"
@@ -11852,9 +12941,10 @@ static const char *proc298 =
 "retnull:\n"
 "return null;\n"
 "}\n"
-"--src sparql.sql:11798\n";
+"--src sparql.sql:12534\n";
 
-static const char *proc299 = 
+static const char *proc328 = 
+"#line 12545 \"[executable]/sparql.sql\"\n"
 "create procedure SPARQL_INI_PARAMS (inout metas any, inout dta any)\n"
 "{\n"
 "declare item_cnt int;\n"
@@ -11878,19 +12968,21 @@ static const char *proc299 =
 "metas := vector (vector (vector (\'res_dict\', 242, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0)), 1);\n"
 "dta := vector (vector (res_dict));\n"
 "}\n"
-"--src sparql.sql:11807\n";
+"--src sparql.sql:12543\n";
 
 /* sparql_io.sql */
 
-static const char *proc300 = 
+static const char *proc329 = 
+"#line 25 \"[executable]/sparql_io.sql\"\n"
 " create procedure DB.DBA.SPARQL_RSET_XML_WRITE_NS (inout ses any)\n"
 "{\n"
 "\n"
 "http (\'<sparql xmlns=\"http://www.w3.org/2005/sparql-results#\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.w3.org/2001/sw/DataAccess/rf1/result2.xsd\">\', ses);\n"
 "}\n"
-"--src sparql_io.sql:24\n";
+"--src sparql_io.sql:23\n";
 
-static const char *proc301 = 
+static const char *proc330 = 
+"#line 34 \"[executable]/sparql_io.sql\"\n"
 " create procedure DB.DBA.SPARQL_RSET_XML_WRITE_HEAD (inout ses any, in colnames any)\n"
 "{\n"
 "declare i, col_count integer;\n"
@@ -11903,13 +12995,15 @@ static const char *proc301 =
 "}\n"
 "http (\'\\n </head>\', ses);\n"
 "}\n"
-"--src sparql_io.sql:33\n";
+"--src sparql_io.sql:32\n";
 
-static const char *proc302 = 
+static const char *proc331 = 
+"#line 49 \"[executable]/sparql_io.sql\"\n"
 " create function DB.DBA.SPARQL_RSET_XML_HTTP_PRE (in colnames any, in accept varchar)\n"
 "{\n"
 "declare ses integer;\n"
 "ses := 0;\n"
+"\n"
 "if (strchr (accept, \' \') is not null)\n"
 "accept := subseq (accept, strchr (accept, \' \')+1);\n"
 "http_header (\'Content-Type: \' || accept || \'; charset=UTF-8\\r\\n\');\n"
@@ -11919,16 +13013,18 @@ static const char *proc302 =
 "http (\'\\n <results>\');\n"
 "return colnames;\n"
 "}\n"
-"--src sparql_io.sql:48\n";
+"--src sparql_io.sql:47\n";
 
-static const char *proc303 = 
+static const char *proc332 = 
+"#line 66 \"[executable]/sparql_io.sql\"\n"
 " create procedure DB.DBA.SPARQL_RSET_XML_HTTP_INIT (inout env any)\n"
 "{\n"
 "env := 0;\n"
 "}\n"
 "--src sparql_io.sql:64\n";
 
-static const char *proc304 = 
+static const char *proc333 = 
+"#line 73 \"[executable]/sparql_io.sql\"\n"
 " create function DB.DBA.SPARQL_RSET_XML_HTTP_FINAL (inout env any)\n"
 "{\n"
 "http (\'\\n </results>\');\n"
@@ -11936,16 +13032,19 @@ static const char *proc304 =
 "}\n"
 "--src sparql_io.sql:71\n";
 
-static const char *other33 = 
+static const char *other37 = 
 " create aggregate DB.DBA.SPARQL_RSET_XML_HTTP (inout colnames any, inout row any) from\n"
 "DB.DBA.SPARQL_RSET_XML_HTTP_INIT,\n"
 "sparql_rset_xml_write_row,\n"
-"DB.DBA.SPARQL_RSET_XML_HTTP_FINAL\n";
+"DB.DBA.SPARQL_RSET_XML_HTTP_FINAL\n"
+"order\n";
 
-static const char *proc305 = 
+static const char *proc334 = 
+"#line 90 \"[executable]/sparql_io.sql\"\n"
 " create function DB.DBA.SPARQL_DICT_XML_HTTP_PRE (in colnames any, in accept varchar)\n"
 "{\n"
 "declare ses integer;\n"
+"\n"
 "http_header (\'Content-Type: \' || accept || \'; charset=UTF-8\\r\\n\');\n"
 "http_flush (1);\n"
 "ses := 0;\n"
@@ -11954,24 +13053,26 @@ static const char *proc305 =
 "http (\'\\n <results distinct=\"false\" ordered=\"true\">\');\n"
 "return colnames;\n"
 "}\n"
-"--src sparql_io.sql:87\n";
+"--src sparql_io.sql:88\n";
 
-static const char *other34 = 
+static const char *other38 = 
 " create aggregate DB.DBA.SPARQL_DICT_XML_HTTP (inout colnames any, inout row any) from\n"
 "DB.DBA.SPARQL_RSET_XML_HTTP_INIT,\n"
 "sparql_dict_xml_write_row,\n"
 "DB.DBA.SPARQL_RSET_XML_HTTP_FINAL\n";
 
-static const char *proc306 = 
-" create procedure SPARQL_RSET_TTL_WRITE_NS (inout ses any)\n"
+static const char *proc335 = 
+"#line 113 \"[executable]/sparql_io.sql\"\n"
+" create procedure DB.DBA.SPARQL_RSET_TTL_WRITE_NS (inout ses any)\n"
 "{\n"
 "http (\'@prefix res: <http://www.w3.org/2005/sparql-results#> .\n"
 "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
 "_:_ a res:ResultSet .\\n\', ses);\n"
 "}\n"
-"--src sparql_io.sql:109\n";
+"--src sparql_io.sql:111\n";
 
-static const char *proc307 = 
+static const char *proc336 = 
+"#line 122 \"[executable]/sparql_io.sql\"\n"
 " create procedure DB.DBA.SPARQL_RSET_TTL_WRITE_HEAD (inout ses any, in colnames any)\n"
 "{\n"
 "declare i, col_count integer;\n"
@@ -11987,9 +13088,10 @@ static const char *proc307 =
 "}\n"
 "http (\'\" .\\n\', ses);\n"
 "}\n"
-"--src sparql_io.sql:118\n";
+"--src sparql_io.sql:120\n";
 
-static const char *proc308 = 
+static const char *proc337 = 
+"#line 140 \"[executable]/sparql_io.sql\"\n"
 " create function DB.DBA.SPARQL_RSET_TTL_HTTP_PRE (in colnames any, in accept varchar)\n"
 "{\n"
 "declare ses, colctr, colcount integer;\n"
@@ -12008,36 +13110,41 @@ static const char *proc308 =
 "}\n"
 "return vector (dict_new (16000), 0, \'\', \'\', \'\', 0, 0, res, 0);\n"
 "}\n"
-"--src sparql_io.sql:136\n";
+"--src sparql_io.sql:138\n";
 
-static const char *proc309 = 
+static const char *proc338 = 
+"#line 161 \"[executable]/sparql_io.sql\"\n"
 " create procedure DB.DBA.SPARQL_RSET_TTL_HTTP_INIT (inout env any)\n"
 "{\n"
 "env := 0;\n"
 "}\n"
-"--src sparql_io.sql:157\n";
+"--src sparql_io.sql:159\n";
 
-static const char *proc310 = 
+static const char *proc339 = 
+"#line 168 \"[executable]/sparql_io.sql\"\n"
 " create function DB.DBA.SPARQL_RSET_TTL_HTTP_FINAL (inout env any)\n"
 "{\n"
 " ;\n"
 "}\n"
-"--src sparql_io.sql:164\n";
+"--src sparql_io.sql:166\n";
 
-static const char *other35 = 
+static const char *other39 = 
 " create aggregate DB.DBA.SPARQL_RSET_TTL_HTTP (inout colnames any, inout row any) from\n"
 "DB.DBA.SPARQL_RSET_TTL_HTTP_INIT,\n"
 "sparql_rset_ttl_write_row,\n"
-"DB.DBA.SPARQL_RSET_TTL_HTTP_FINAL\n";
+"DB.DBA.SPARQL_RSET_TTL_HTTP_FINAL\n"
+"order\n";
 
-static const char *proc311 = 
+static const char *proc340 = 
+"#line 183 \"[executable]/sparql_io.sql\"\n"
 " create procedure DB.DBA.SPARQL_RSET_NT_WRITE_NS (inout ses any)\n"
 "{\n"
 "http (\'_:ResultSet2053 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#ResultSet> .\\n\', ses);\n"
 "}\n"
-"--src sparql_io.sql:178\n";
+"--src sparql_io.sql:181\n";
 
-static const char *proc312 = 
+static const char *proc341 = 
+"#line 190 \"[executable]/sparql_io.sql\"\n"
 " create procedure DB.DBA.SPARQL_RSET_NT_WRITE_HEAD (inout ses any, in colnames any)\n"
 "{\n"
 "declare i, col_count integer;\n"
@@ -12049,9 +13156,10 @@ static const char *proc312 =
 "http (\'\" .\\n\', ses);\n"
 "}\n"
 "}\n"
-"--src sparql_io.sql:185\n";
+"--src sparql_io.sql:188\n";
 
-static const char *proc313 = 
+static const char *proc342 = 
+"#line 204 \"[executable]/sparql_io.sql\"\n"
 " create function DB.DBA.SPARQL_RSET_NT_HTTP_PRE (in colnames any, in accept varchar)\n"
 "{\n"
 "declare ses, colctr, colcount integer;\n"
@@ -12070,15 +13178,17 @@ static const char *proc313 =
 "}\n"
 "return vector (0, res, 0);\n"
 "}\n"
-"--src sparql_io.sql:199\n";
+"--src sparql_io.sql:202\n";
 
-static const char *other36 = 
+static const char *other40 = 
 " create aggregate DB.DBA.SPARQL_RSET_NT_HTTP (inout colnames any, inout row any) from\n"
 "DB.DBA.SPARQL_RSET_TTL_HTTP_INIT,\n"
 "sparql_rset_nt_write_row,\n"
-"DB.DBA.SPARQL_RSET_TTL_HTTP_FINAL\n";
+"DB.DBA.SPARQL_RSET_TTL_HTTP_FINAL\n"
+"order\n";
 
-static const char *proc314 = 
+static const char *proc343 = 
+"#line 235 \"[executable]/sparql_io.sql\"\n"
 "create procedure DB.DBA.SPARQL_REXEC_INT (\n"
 "in res_mode integer,\n"
 "in res_make_obj integer,\n"
@@ -12089,12 +13199,22 @@ static const char *proc314 =
 "inout req_hdr any,\n"
 "in maxrows integer,\n"
 "inout metas any,\n"
-"inout bnode_dict any\n"
+"inout bnode_dict any,\n"
+"in expected_var_list any := null\n"
 ")\n"
 "{\n"
+"declare quest_pos integer;\n"
 "declare req_uri, req_method, req_body, local_req_hdr, ret_body, ret_hdr any;\n"
 "declare ret_content_type, ret_known_content_type, ret_format varchar;\n"
+"\n"
+"quest_pos := strchr (service, \'?\');\n"
 "req_body := string_output();\n"
+"if (quest_pos is not null)\n"
+"{\n"
+"http (subseq (service, quest_pos+1), req_body);\n"
+"http (\'&\', req_body);\n"
+"service := subseq (service, 0, quest_pos);\n"
+"}\n"
 "http (\'query=\', req_body);\n"
 "http_url (query, 0, req_body);\n"
 "if (dflt_graph is not null and dflt_graph <> \'\')\n"
@@ -12135,25 +13255,23 @@ static const char *proc314 =
 "\n"
 "ret_content_type := http_request_header (ret_hdr, \'Content-Type\', null, null);\n"
 "ret_known_content_type := http_sys_find_best_sparql_accept (ret_content_type, 0, ret_format);\n"
+"\n"
 "if (ret_format is null or not (ret_format in (\'XML\', \'RDFXML\', \'TTL\')))\n"
 "{\n"
 "declare ret_begin, ret_html any;\n"
 "ret_begin := \"LEFT\" (ret_body, 1024);\n"
 "ret_html := xtree_doc (ret_begin, 2);\n"
+"\n"
 "if (xpath_eval (\'/html|/xhtml\', ret_html) is not null)\n"
-"ret_content_type := \'text/html\';\n"
+"ret_format := \'HTML\';\n"
 "else if (xpath_eval (\'[xmlns:rset=\"http://www.w3.org/2005/sparql-results#\"] /rset:sparql\', ret_html) is not null\n"
 "or xpath_eval (\'[xmlns:rset2=\"http://www.w3.org/2001/sw/DataAccess/rf1/result2\"] /rset2:sparql\', ret_html) is not null)\n"
-"ret_content_type := \'application/sparql-results+xml\';\n"
+"ret_format := \'XML\';\n"
 "else if (xpath_eval (\'[xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"] /rdf:rdf\', ret_html) is not null)\n"
-"ret_content_type := \'application/rdf+xml\';\n"
+"ret_format := \'RDFXML\';\n"
 "else if (strstr (ret_begin, \'<html>\') is not null or\n"
 "strstr (ret_begin, \'<xhtml>\') is not null )\n"
-"ret_content_type := \'text/html\';\n"
-"else\n"
-"{\n"
-"ret_content_type := \'text/plain\';\n"
-"}\n"
+"ret_format := \'HTML\';\n"
 "}\n"
 "if (ret_format = \'XML\')\n"
 "{\n"
@@ -12164,7 +13282,7 @@ static const char *proc314 =
 "\n"
 "ret_xml := xtree_doc (ret_body, 0);\n"
 "var_list := xpath_eval (\'[xmlns:rset=\"http://www.w3.org/2005/sparql-results#\"] [xmlns:rset2=\"http://www.w3.org/2001/sw/DataAccess/rf1/result2\"]\n"
-"/rset:sparql/rset:head/rset:variable | /rset2:sparql/rset2:head/rset2:variable\', ret_xml, 0);\n"
+"/rset:sparql/rset:head/rset:variable/@name | /rset2:sparql/rset2:head/rset2:variable/@name\', ret_xml, 0);\n"
 "if (0 = length (var_list))\n"
 "{\n"
 "declare bool_ret any;\n"
@@ -12197,16 +13315,30 @@ static const char *proc314 =
 "return;\n"
 "}\n"
 "signal (\'RDFZZ\', sprintf (\n"
-"\'DB.DBA.SPARQL_REXEC(\'\'%.300s\'\', ...) has received result with no variables\',\n"
-"service ) );\n"
+"\'DB.DBA.SPARQL_REXEC(\'\'%.300s\'\', ...) has received result with no variables\',\n"
+"service ) );\n"
+"}\n"
+"var_count := length (var_list);\n"
+"if (expected_var_list is not null)\n"
+"{\n"
+"for (var_ctr := var_count - 1; var_ctr >= 0; var_ctr := var_ctr - 1)\n"
+"{\n"
+"declare var_name varchar;\n"
+"var_name := cast (var_list[var_ctr] as varchar);\n"
+"if (0 >= position (var_name, expected_var_list))\n"
+"signal (\'RDFZZ\', sprintf (\n"
+"\'DB.DBA.SPARQL_REXEC(\'\'%.300s\'\', ...) has received result with unexpected variable name \'\'%.300s\'\'\',\n"
+"service, var_name ) );\n"
 "}\n"
+"var_list := expected_var_list;\n"
 "var_count := length (var_list);\n"
+"}\n"
 "var_metas := make_array (var_count, \'any\');\n"
 "out_nulls := make_array (var_count, \'any\');\n"
 "for (var_ctr := var_count - 1; var_ctr >= 0; var_ctr := var_ctr - 1)\n"
 "{\n"
 "declare var_name varchar;\n"
-"var_name := cast (xpath_eval (\'@name\', var_list[var_ctr]) as varchar);\n"
+"var_name := cast (var_list[var_ctr] as varchar);\n"
 "var_list [var_ctr] := var_name;\n"
 "var_metas [var_ctr] := vector (var_name, 242, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0);\n"
 "out_nulls [var_ctr] := null;\n"
@@ -12342,15 +13474,16 @@ static const char *proc314 =
 "signal (\'RDFZZ\', sprintf (\n"
 "\'DB.DBA.SPARQL_REXEC(\'\'%.300s\'\', ...) returned Content-Type \'\'%.300s\'\' status \'\'%.300s\'\'\\n%.1000s\',\n"
 "service, ret_content_type, ret_hdr[0],\n"
-"cast (xtree_doc (ret_body, 2) as varchar) ) );\n"
+"\"LEFT\" (cast (xtree_doc (ret_body, 2) as varchar), 1024) ) );\n"
 "}\n"
 "signal (\'RDFZZ\', sprintf (\n"
 "\'DB.DBA.SPARQL_REXEC(\'\'%.300s\'\', ...) returned unsupported Content-Type \'\'%.300s\'\'\',\n"
 "service, ret_content_type ) );\n"
 "}\n"
-"--src sparql_io.sql:229\n";
+"--src sparql_io.sql:233\n";
 
-static const char *proc315 = 
+static const char *proc344 = 
+"#line 528 \"[executable]/sparql_io.sql\"\n"
 "create procedure DB.DBA.SPARQL_REXEC (\n"
 "in service varchar,\n"
 "in query varchar,\n"
@@ -12364,9 +13497,10 @@ static const char *proc315 =
 "declare metas any;\n"
 "DB.DBA.SPARQL_REXEC_INT (0, 0, service, query, dflt_graph, named_graphs, req_hdr, maxrows, metas, bnode_dict);\n"
 "}\n"
-"--src sparql_io.sql:500\n";
+"--src sparql_io.sql:526\n";
 
-static const char *proc316 = 
+static const char *proc345 = 
+"#line 543 \"[executable]/sparql_io.sql\"\n"
 "create function DB.DBA.SPARQL_REXEC_TO_ARRAY (\n"
 "in service varchar,\n"
 "in query varchar,\n"
@@ -12374,15 +13508,17 @@ static const char *proc316 =
 "in named_graphs any,\n"
 "in req_hdr any,\n"
 "in maxrows integer,\n"
-"in bnode_dict any\n"
+"in bnode_dict any,\n"
+"in expected_var_list any := null\n"
 ") returns any\n"
 "{\n"
 "declare metas any;\n"
-"return DB.DBA.SPARQL_REXEC_INT (1, 0, service, query, dflt_graph, named_graphs, req_hdr, maxrows, metas, bnode_dict);\n"
+"return DB.DBA.SPARQL_REXEC_INT (1, 0, service, query, dflt_graph, named_graphs, req_hdr, maxrows, metas, bnode_dict, expected_var_list);\n"
 "}\n"
-"--src sparql_io.sql:515\n";
+"--src sparql_io.sql:541\n";
 
-static const char *proc317 = 
+static const char *proc346 = 
+"#line 559 \"[executable]/sparql_io.sql\"\n"
 "create function DB.DBA.SPARQL_REXEC_TO_ARRAY_OF_OBJ (\n"
 "in service varchar,\n"
 "in query varchar,\n"
@@ -12390,15 +13526,17 @@ static const char *proc317 =
 "in named_graphs any,\n"
 "in req_hdr any,\n"
 "in maxrows integer,\n"
-"in bnode_dict any\n"
+"in bnode_dict any,\n"
+"in expected_var_list any := null\n"
 ") returns any\n"
 "{\n"
 "declare metas any;\n"
-"return DB.DBA.SPARQL_REXEC_INT (1, 1, service, query, dflt_graph, named_graphs, req_hdr, maxrows, metas, bnode_dict);\n"
+"return DB.DBA.SPARQL_REXEC_INT (1, 1, service, query, dflt_graph, named_graphs, req_hdr, maxrows, metas, bnode_dict, expected_var_list);\n"
 "}\n"
-"--src sparql_io.sql:530\n";
+"--src sparql_io.sql:557\n";
 
-static const char *proc318 = 
+static const char *proc347 = 
+"#line 575 \"[executable]/sparql_io.sql\"\n"
 "create procedure DB.DBA.SPARQL_REXEC_WITH_META (\n"
 "in service varchar,\n"
 "in query varchar,\n"
@@ -12414,10 +13552,11 @@ static const char *proc318 =
 "resultset := DB.DBA.SPARQL_REXEC_INT (1, 0, service, query, dflt_graph, named_graphs, req_hdr, maxrows, metadata, bnode_dict);\n"
 "\n"
 "}\n"
-"--src sparql_io.sql:545\n";
+"--src sparql_io.sql:573\n";
 
-static const char *proc319 = 
-"create procedure DB.DBA.SPARQL_SINV_IMP (in ws_endpoint varchar, in ws_params any, in qtext_template varchar, in qtext_posmap nvarchar, in param_row any)\n"
+static const char *proc348 = 
+"#line 593 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_SINV_IMP (in ws_endpoint varchar, in ws_params any, in qtext_template varchar, in qtext_posmap nvarchar, in param_row any, in expected_vars any)\n"
 "{\n"
 "declare RSET, retarray any;\n"
 "result_names (RSET);\n"
@@ -12425,15 +13564,16 @@ static const char *proc319 =
 "if (N\'\' <> qtext_posmap)\n"
 "{\n"
 "declare qtext_ses any;\n"
-"declare prev_pos, qctr integer;\n"
+"declare prev_pos, qctr, qcount integer;\n"
 "qtext_ses := string_output ();\n"
 "prev_pos := 0;\n"
-"for (qctr := length (qtext_posmap); qctr > 0; qctr := qctr-2)\n"
+"qcount := length (qtext_posmap)-1;\n"
+"for (qctr := 0; qctr < qcount; qctr := qctr+2)\n"
 "{\n"
 "declare qpos integer;\n"
-"qpos := qtext_posmap[qctr-2];\n"
+"qpos := qtext_posmap[qctr];\n"
 "http (subseq (qtext_template, prev_pos, qpos), qtext_ses);\n"
-"http_nt_object (param_row[qtext_posmap[qctr-1]-1], qtext_ses);\n"
+"http_nt_object (param_row[qtext_posmap[qctr+1]-1], qtext_ses);\n"
 "prev_pos := qpos+8;\n"
 "}\n"
 "http (subseq (qtext_template, prev_pos), qtext_ses);\n"
@@ -12446,20 +13586,21 @@ static const char *proc319 =
 "NULL,\n"
 "NULL,\n"
 "10000000,\n"
-"NULL\n"
-");\n"
+"NULL,\n"
+"expected_vars );\n"
 "foreach (any retrow in retarray) do\n"
 "{\n"
 "\n"
 "result (retrow);\n"
 "}\n"
 "}\n"
-"--src sparql_io.sql:563\n";
+"--src sparql_io.sql:591\n";
 
 static const char *view0 = 
-"create procedure view DB.DBA.SPARQL_SINV as DB.DBA.SPARQL_SINV_IMP (ws_endpoint, ws_params, qtext_template, qtext_posmap, param_row)(RSET any)\n";
+"create procedure view DB.DBA.SPARQL_SINV_2 as DB.DBA.SPARQL_SINV_IMP (ws_endpoint, ws_params, qtext_template, qtext_posmap, param_row, expected_vars)(RSET any)\n";
 
-static const char *proc320 = 
+static const char *proc349 = 
+"#line 639 \"[executable]/sparql_io.sql\"\n"
 "create procedure \"querySoap\"  (in  \"Command\" varchar\n"
 ", in  \"Properties\" any\n"
 ", out \"Error\" any __soap_fault \'__XML__\'\n"
@@ -12491,10 +13632,11 @@ static const char *proc320 =
 "res := xml_tree_doc (ses);\n"
 "return res;\n"
 "}\n"
-"--src sparql_io.sql:608\n";
+"--src sparql_io.sql:637\n";
 
-static const char *proc321 = 
-" create procedure SPARQL_WRITE_EXEC_STATUS (inout ses any, in line_format varchar, inout status any)\n"
+static const char *proc350 = 
+"#line 673 \"[executable]/sparql_io.sql\"\n"
+" create procedure DB.DBA.SPARQL_WRITE_EXEC_STATUS (inout ses any, in line_format varchar, inout status any)\n"
 "{\n"
 "declare lctr, lcount integer;\n"
 "declare lines any;\n"
@@ -12510,10 +13652,11 @@ static const char *proc321 =
 "http (sprintf (line_format, \'Exec Time\', cast (status[2] as varchar) || \' ms\'), ses);\n"
 "http (sprintf (line_format, \'DB Activity\', cast (status[3] as varchar)), ses);\n"
 "}\n"
-"--src sparql_io.sql:642\n";
+"--src sparql_io.sql:671\n";
 
-static const char *proc322 = 
-"create procedure SPARQL_RESULTS_XML_WRITE_HEAD (inout ses any, in mdta any)\n"
+static const char *proc351 = 
+"#line 692 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_XML_WRITE_HEAD (inout ses any, in mdta any)\n"
 "{\n"
 "declare i, col_count integer;\n"
 "\n"
@@ -12537,10 +13680,11 @@ static const char *proc322 =
 "\n"
 "http (\'\\n </head>\', ses);\n"
 "}\n"
-"--src sparql_io.sql:661\n";
+"--src sparql_io.sql:690\n";
 
-static const char *proc323 = 
-"create procedure SPARQL_RESULTS_XML_WRITE_RES (inout ses any, in mdta any, inout dta any)\n"
+static const char *proc352 = 
+"#line 718 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_XML_WRITE_RES (inout ses any, in mdta any, inout dta any)\n"
 "{\n"
 "http (\'\\n <results distinct=\"false\" ordered=\"true\">\', ses);\n"
 "\n"
@@ -12549,9 +13693,10 @@ static const char *proc323 =
 "\n"
 "http (\'\\n </results>\', ses);\n"
 "}\n"
-"--src sparql_io.sql:687\n";
+"--src sparql_io.sql:716\n";
 
-static const char *proc324 = 
+static const char *proc353 = 
+"#line 729 \"[executable]/sparql_io.sql\"\n"
 "create procedure DB.DBA.SPARQL_RESULTS_XML_WRITE_ROW (inout ses any, in mdta any, inout dta any)\n"
 "{\n"
 "\n"
@@ -12565,6 +13710,7 @@ static const char *proc324 =
 "_val := dta[x];\n"
 "if (_val is null)\n"
 "goto end_of_binding;\n"
+"\n"
 "if (isiri_id (_val))\n"
 "{\n"
 "if (_val >= min_bnode_iri_id ())\n"
@@ -12646,19 +13792,21 @@ static const char *proc324 =
 "\n"
 "http (\'\\n  </result>\', ses);\n"
 "}\n"
-"--src sparql_io.sql:698\n";
+"--src sparql_io.sql:727\n";
 
-static const char *proc325 = 
-"create procedure SPARQL_RESULTS_RDFXML_WRITE_NS (inout ses any)\n"
+static const char *proc354 = 
+"#line 826 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_RDFXML_WRITE_NS (inout ses any)\n"
 "{\n"
 "http (\'<rdf:RDF xmlns:res=\"http://www.w3.org/2005/sparql-results#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n"
 "<rdf:Description rdf:nodeID=\"rset\">\n"
 "<rdf:type rdf:resource=\"http://www.w3.org/2005/sparql-results#ResultSet\" />\', ses);\n"
 "}\n"
-"--src sparql_io.sql:794\n";
+"--src sparql_io.sql:824\n";
 
-static const char *proc326 = 
-"create procedure SPARQL_RESULTS_RDFXML_WRITE_HEAD (inout ses any, in mdta any)\n"
+static const char *proc355 = 
+"#line 834 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_RDFXML_WRITE_HEAD (inout ses any, in mdta any)\n"
 "{\n"
 "declare i, col_count integer;\n"
 "mdta := mdta[0];\n"
@@ -12677,10 +13825,11 @@ static const char *proc326 =
 "i := i + 1;\n"
 "}\n"
 "}\n"
-"--src sparql_io.sql:802\n";
+"--src sparql_io.sql:832\n";
 
-static const char *proc327 = 
-"create procedure SPARQL_RESULTS_RDFXML_WRITE_RES (inout ses any, in mdta any, inout dta any)\n"
+static const char *proc356 = 
+"#line 855 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_RDFXML_WRITE_RES (inout ses any, in mdta any, inout dta any)\n"
 "{\n"
 "for (declare ctr integer, ctr := 0; ctr < length (dta); ctr := ctr + 1)\n"
 "{\n"
@@ -12689,10 +13838,11 @@ static const char *proc327 =
 "http (\'\\n    </res:solution>\', ses);\n"
 "}\n"
 "}\n"
-"--src sparql_io.sql:823\n";
+"--src sparql_io.sql:853\n";
 
-static const char *proc328 = 
-"create procedure SPARQL_RESULTS_RDFXML_WRITE_ROW (inout ses any, in mdta any, inout dta any, in rowno integer)\n"
+static const char *proc357 = 
+"#line 866 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_RDFXML_WRITE_ROW (inout ses any, in mdta any, inout dta any, in rowno integer)\n"
 "{\n"
 "mdta := mdta[0];\n"
 "for (declare x any, x := 0; x < length (mdta); x := x + 1)\n"
@@ -12776,19 +13926,21 @@ static const char *proc328 =
 "end_of_binding: ;\n"
 "}\n"
 "}\n"
-"--src sparql_io.sql:834\n";
+"--src sparql_io.sql:864\n";
 
-static const char *proc329 = 
-"create procedure SPARQL_RESULTS_TTL_WRITE_NS (inout ses any)\n"
+static const char *proc358 = 
+"#line 952 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_TTL_WRITE_NS (inout ses any)\n"
 "{\n"
 "http (\'@prefix res: <http://www.w3.org/2005/sparql-results#> .\n"
 "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
 "_:_ a res:ResultSet .\\n\', ses);\n"
 "}\n"
-"--src sparql_io.sql:920\n";
+"--src sparql_io.sql:950\n";
 
-static const char *proc330 = 
-"create procedure SPARQL_RESULTS_TTL_WRITE_HEAD (inout ses any, in mdta any)\n"
+static const char *proc359 = 
+"#line 960 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_TTL_WRITE_HEAD (inout ses any, in mdta any)\n"
 "{\n"
 "declare i, col_count integer;\n"
 "mdta := mdta[0];\n"
@@ -12813,10 +13965,11 @@ static const char *proc330 =
 "}\n"
 "http (\'\" .\\n\', ses);\n"
 "}\n"
-"--src sparql_io.sql:928\n";
+"--src sparql_io.sql:958\n";
 
-static const char *proc331 = 
-"create procedure SPARQL_RESULTS_TTL_WRITE_RES (inout ses any, in mdta any, inout dta any)\n"
+static const char *proc360 = 
+"#line 987 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_TTL_WRITE_RES (inout ses any, in mdta any, inout dta any)\n"
 "{\n"
 "declare colctr, colcount, rowctr, len, fake_agg_ctx integer;\n"
 "declare cols, colbuf, env any;\n"
@@ -12839,17 +13992,19 @@ static const char *proc331 =
 "rowctr := rowctr + 1;\n"
 "}\n"
 "}\n"
-"--src sparql_io.sql:955\n";
+"--src sparql_io.sql:985\n";
 
-static const char *proc332 = 
-"create procedure SPARQL_RESULTS_NT_WRITE_NS (inout ses any)\n"
+static const char *proc361 = 
+"#line 1012 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_NT_WRITE_NS (inout ses any)\n"
 "{\n"
 "http (\'_:ResultSet2053 rdf:type <http://www.w3.org/1999/02/22-rdf-syntax-ns#res:ResultSet> .\\n\', ses);\n"
 "}\n"
-"--src sparql_io.sql:980\n";
+"--src sparql_io.sql:1010\n";
 
-static const char *proc333 = 
-"create procedure SPARQL_RESULTS_NT_WRITE_HEAD (inout ses any, in mdta any)\n"
+static const char *proc362 = 
+"#line 1018 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_NT_WRITE_HEAD (inout ses any, in mdta any)\n"
 "{\n"
 "declare i, col_count integer;\n"
 "mdta := mdta[0];\n"
@@ -12870,10 +14025,11 @@ static const char *proc333 =
 "i := i + 1;\n"
 "}\n"
 "}\n"
-"--src sparql_io.sql:986\n";
+"--src sparql_io.sql:1016\n";
 
-static const char *proc334 = 
-"create procedure SPARQL_RESULTS_NT_WRITE_RES (inout ses any, in mdta any, inout dta any)\n"
+static const char *proc363 = 
+"#line 1041 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_NT_WRITE_RES (inout ses any, in mdta any, inout dta any)\n"
 "{\n"
 "declare colctr, colcount, rowctr, len, fake_agg_ctx integer;\n"
 "declare cols, colbuf, env any;\n"
@@ -12896,10 +14052,11 @@ static const char *proc334 =
 "rowctr := rowctr + 1;\n"
 "}\n"
 "}\n"
-"--src sparql_io.sql:1009\n";
+"--src sparql_io.sql:1039\n";
 
-static const char *proc335 = 
-"create procedure SPARQL_RESULTS_JAVASCRIPT_HTML_WRITE (inout ses any, inout metas any, inout rset any, in is_js integer := 0, in esc_mode integer := 1)\n"
+static const char *proc364 = 
+"#line 1066 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_JAVASCRIPT_HTML_WRITE (inout ses any, inout metas any, inout rset any, in is_js integer := 0, in esc_mode integer := 1)\n"
 "{\n"
 "declare varctr, varcount, resctr, rescount integer;\n"
 "declare trnewline, newline varchar;\n"
@@ -12969,6 +14126,8 @@ static const char *proc335 =
 "\n"
 "\n"
 "}\n"
+"else if (__tag of rdf_box = __tag (val))\n"
+"http_rdf_object (val, ses, 1);\n"
 "else\n"
 "{\n"
 "http_escape (__rdf_strsqlval (val), esc_mode, ses, 1, 1);\n"
@@ -12980,10 +14139,11 @@ static const char *proc335 =
 "}\n"
 "http (trnewline || \'</table>\', ses);\n"
 "}\n"
-"--src sparql_io.sql:1034\n";
+"--src sparql_io.sql:1064\n";
 
-static const char *proc336 = 
-"create procedure SPARQL_RESULTS_JSON_WRITE_BINDING (inout ses any, in colname varchar, inout val any)\n"
+static const char *proc365 = 
+"#line 1151 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_JSON_WRITE_BINDING (inout ses any, in colname varchar, inout val any)\n"
 "{\n"
 "http(\' \"\', ses);\n"
 "http_escape (colname, 11, ses, 0, 1);\n"
@@ -13075,10 +14235,11 @@ static const char *proc336 =
 "}\n"
 "http (\'\" }\', ses);\n"
 "}\n"
-"--src sparql_io.sql:1117\n";
+"--src sparql_io.sql:1149\n";
 
-static const char *proc337 = 
-"create procedure SPARQL_RESULTS_JSON_WRITE (inout ses any, inout metas any, inout rset any)\n"
+static const char *proc366 = 
+"#line 1245 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_JSON_WRITE (inout ses any, inout metas any, inout rset any)\n"
 "{\n"
 "declare varctr, varcount, resctr, rescount integer;\n"
 "varcount := length (metas[0]);\n"
@@ -13119,9 +14280,40 @@ static const char *proc337 =
 "}\n"
 "http (\' ] } }\', ses);\n"
 "}\n"
-"--src sparql_io.sql:1211\n";
+"--src sparql_io.sql:1243\n";
 
-static const char *proc338 = 
+static const char *proc367 = 
+"#line 1288 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_RESULTS_CSV_WRITE (inout ses any, inout metas any, inout rset any)\n"
+"{\n"
+"declare varctr, varcount, resctr, rescount integer;\n"
+"varcount := length (metas[0]);\n"
+"rescount := length (rset);\n"
+"for (varctr := 0; varctr < varcount; varctr := varctr + 1)\n"
+"{\n"
+"if (varctr > 0)\n"
+"http(\',\', ses);\n"
+"DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (ses, metas[0][varctr][0]);\n"
+"}\n"
+"http (\'\\n\', ses);\n"
+"for (resctr := 0; resctr < rescount; resctr := resctr + 1)\n"
+"{\n"
+"for (varctr := 0; varctr < varcount; varctr := varctr + 1)\n"
+"{\n"
+"declare val any;\n"
+"val := rset[resctr][varctr];\n"
+"if (varctr > 0)\n"
+"http(\',\', ses);\n"
+"if (val is not null)\n"
+"DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE (ses, val);\n"
+"}\n"
+"http(\'\\n\', ses);\n"
+"}\n"
+"}\n"
+"--src sparql_io.sql:1286\n";
+
+static const char *proc368 = 
+"#line 1317 \"[executable]/sparql_io.sql\"\n"
 "create function DB.DBA.SPARQL_RESULTS_WRITE (inout ses any, inout metas any, inout rset any, in accept varchar, in add_http_headers integer, in status any := null) returns varchar\n"
 "{\n"
 "declare singlefield varchar;\n"
@@ -13165,6 +14357,10 @@ static const char *proc338 =
 "http (\'@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\\n at prefix rs: <http://www.w3.org/2005/sparql-results#> .\\n\', ses);\n"
 "http (sprintf (\'[] rdf:type rs:results ; rs:boolean %s .\', case (length (rset)) when 0 then \'false\' else \'true\' end), ses);\n"
 "}\n"
+"else if (ret_format = \'CSV\')\n"
+"{\n"
+"http (sprintf (\'\"bool\"\\n%d\\n\', case (length (rset)) when 0 then 0 else 1 end), ses);\n"
+"}\n"
 "else\n"
 "{\n"
 "ret_mime := \'text/html\';\n"
@@ -13199,6 +14395,12 @@ static const char *proc338 =
 "DB.DBA.RDF_TRIPLES_TO_ATOM_XML_TEXT (triples, 1, ses);\n"
 "else if (ret_format = \'JSON;ODATA\')\n"
 "DB.DBA.RDF_TRIPLES_TO_ODATA_JSON (triples, ses);\n"
+"else if (ret_format = \'CXML\')\n"
+"DB.DBA.RDF_TRIPLES_TO_CXML (triples, ses, accept, add_http_headers, 0, status);\n"
+"else if (ret_format = \'CXML;QRCODE\')\n"
+"DB.DBA.RDF_TRIPLES_TO_CXML (triples, ses, accept, add_http_headers, 1, status);\n"
+"else if (ret_format = \'CSV\')\n"
+"DB.DBA.RDF_TRIPLES_TO_CSV (triples, ses);\n"
 "else if (ret_format = \'SOAP\')\n"
 "{\n"
 "declare soap_ns, spt_ns varchar;\n"
@@ -13329,6 +14531,17 @@ static const char *proc338 =
 "http (\'\\n</rdf:RDF>\', ses);\n"
 "goto body_complete;\n"
 "}\n"
+"if ((ret_format = \'CXML\') or (ret_format = \'CXML;QRCODE\'))\n"
+"{\n"
+"DB.DBA.SPARQL_RESULTS_CXML_WRITE(ses, metas, rset, accept, add_http_headers, status);\n"
+"goto body_complete;\n"
+"}\n"
+"if (ret_format = \'CSV\')\n"
+"{\n"
+"ret_mime := \'text/csv\';\n"
+"DB.DBA.SPARQL_RESULTS_CSV_WRITE (ses, metas, rset);\n"
+"goto body_complete;\n"
+"}\n"
 "ret_mime := \'application/sparql-results+xml\';\n"
 "SPARQL_RSET_XML_WRITE_NS (ses);\n"
 "SPARQL_RESULTS_XML_WRITE_HEAD (ses, metas);\n"
@@ -13340,9 +14553,10 @@ static const char *proc338 =
 "http_header (coalesce (http_header_get (), \'\') || \'Content-Type: \' || ret_mime || \'; charset=UTF-8\\r\\n\');\n"
 "return ret_mime;\n"
 "}\n"
-"--src sparql_io.sql:1254\n";
+"--src sparql_io.sql:1315\n";
 
-static const char *proc339 = 
+static const char *proc369 = 
+"#line 1562 \"[executable]/sparql_io.sql\"\n"
 "create procedure WS.WS.SPARQL_VHOST_RESET ()\n"
 "{\n"
 "if (not exists (select 1 from \"DB\".\"DBA\".\"SYS_USERS\" where U_NAME = \'SPARQL\'))\n"
@@ -13370,9 +14584,10 @@ static const char *proc339 =
 "\n"
 "registry_set (\'__SPARQL_VHOST_RESET\', \'1\');\n"
 "}\n"
-"--src sparql_io.sql:1478\n";
+"--src sparql_io.sql:1560\n";
 
-static const char *proc340 = 
+static const char *proc370 = 
+"#line 1594 \"[executable]/sparql_io.sql\"\n"
 "create procedure DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (\n"
 "inout path varchar, inout params any, inout lines any,\n"
 "in httpcode varchar, in httpstatus varchar,\n"
@@ -13412,16 +14627,17 @@ static const char *proc340 =
 "}\n"
 "http_request_status (sprintf (\'HTTP/1.1 %s %s\', httpcode, httpstatus));\n"
 "http_header (\'Content-Type: text/plain\\r\\n\');\n"
-"http (concat (state, \' Error \', msg));\n"
+"http (concat (\'Virtuoso \', state, \' Error \', msg));\n"
 "if (query is not null)\n"
 "{\n"
 "http (\'\\n\\nSPARQL query:\\n\');\n"
 "http (query);\n"
 "}\n"
 "}\n"
-"--src sparql_io.sql:1510\n";
+"--src sparql_io.sql:1592\n";
 
-static const char *proc341 = 
+static const char *proc371 = 
+"#line 1642 \"[executable]/sparql_io.sql\"\n"
 "create procedure DB.DBA.SPARQL_WSDL11 (in lines any)\n"
 "{\n"
 "declare host any;\n"
@@ -13439,9 +14655,10 @@ static const char *proc341 =
 "</service>\n"
 "</definitions>\', host));\n"
 "}\n"
-"--src sparql_io.sql:1558\n";
+"--src sparql_io.sql:1640\n";
 
-static const char *proc342 = 
+static const char *proc372 = 
+"#line 1661 \"[executable]/sparql_io.sql\"\n"
 "create procedure DB.DBA.SPARQL_WSDL (in lines any)\n"
 "{\n"
 "declare host any;\n"
@@ -13456,9 +14673,10 @@ static const char *proc342 =
 "</service>\n"
 "</description>\', host));\n"
 "}\n"
-"--src sparql_io.sql:1577\n";
+"--src sparql_io.sql:1659\n";
 
-static const char *proc343 = 
+static const char *proc373 = 
+"#line 1677 \"[executable]/sparql_io.sql\"\n"
 "create procedure DB.DBA.SPARQL_SOAP_NS (in ver int)\n"
 "{\n"
 "if (ver = 11)\n"
@@ -13468,16 +14686,18 @@ static const char *proc343 =
 "else\n"
 "signal (\'42000\', \'Un-supported SOAP version\');\n"
 "}\n"
-"--src sparql_io.sql:1593\n";
+"--src sparql_io.sql:1675\n";
 
-static const char *proc344 = 
+static const char *proc374 = 
+"#line 1688 \"[executable]/sparql_io.sql\"\n"
 "create procedure DB.DBA.SPARQL_PT_NS ()\n"
 "{\n"
 "return \'http://www.w3.org/2005/09/sparql-protocol-types/#\';\n"
 "}\n"
-"--src sparql_io.sql:1604\n";
+"--src sparql_io.sql:1686\n";
 
-static const char *proc345 = 
+static const char *proc375 = 
+"#line 1695 \"[executable]/sparql_io.sql\"\n"
 " create function DB.DBA.PARSE_SPARQL_WS_PARAMS (in lst any) returns any\n"
 "{\n"
 "declare pval, parse, res any;\n"
@@ -13525,23 +14745,95 @@ static const char *proc345 =
 "vectorbld_final (res);\n"
 "return res;\n"
 "}\n"
-"--src sparql_io.sql:1611\n";
+"--src sparql_io.sql:1693\n";
 
-static const char *proc346 = 
+static const char *proc376 = 
+"#line 1744 \"[executable]/sparql_io.sql\"\n"
 "create procedure DB.DBA.rdf_find_str (in x any)\n"
 "{\n"
 "return cast (x as varchar);\n"
 "}\n"
-"--src sparql_io.sql:1660\n";
+"--src sparql_io.sql:1742\n";
 
-static const char *other37 = 
+static const char *other41 = 
 "grant execute on DB.DBA.rdf_find_str to public\n";
-static const char *proc347 = 
+static const char *proc377 = 
+"#line 1753 \"[executable]/sparql_io.sql\"\n"
+"create procedure WS.WS.sparql_enpoint_format_opts (in can_cxml varchar, in can_qrcode varchar, in params varchar, in qr varchar)\n"
+"{\n"
+"declare opts any;\n"
+"declare format varchar;\n"
+"format := get_keyword (\'format\', params, get_keyword (\'output\', params, \'\'));\n"
+"qr := lower (qr);\n"
+"if (format <> \'\')\n"
+"{\n"
+"format := (\n"
+"case lower(format)\n"
+"when \'json\' then \'application/sparql-results+json\'\n"
+"when \'js\' then \'application/javascript\'\n"
+"when \'html\' then \'text/html\'\n"
+"when \'sparql\' then \'application/sparql-results+xml\'\n"
+"when \'xml\' then \'application/sparql-results+xml\'\n"
+"when \'rdf\' then \'application/rdf+xml\'\n"
+"when \'n3\' then \'text/rdf+n3\'\n"
+"when \'cxml\' then \'text/cxml\'\n"
+"when \'cxml+qrcode\' then \'text/cxml+qrcode\'\n"
+"when \'csv\' then \'text/csv\'\n"
+"else format\n"
+"end);\n"
+"}\n"
+"if (\n"
+"regexp_match (\'\\\\bconstruct\\\\b\', qr) is not null\n"
+"or\n"
+"regexp_match (\'\\\\bdescribe\\\\b\', qr) is not null\n"
+")\n"
+"{\n"
+"opts := vector (\n"
+"vector (\'text/rdf+n3\', \'N3/Turtle\'),\n"
+"vector (\'application/rdf+json\', \'JSON\'),\n"
+"vector (\'application/rdf+xml\', \'RDF/XML\'),\n"
+"vector (\'text/plain\', \'NTriples\'),\n"
+"vector (\'application/xhtml+xml\', \'XHTML+RDFa\'),\n"
+"vector (\'application/atom+xml\', \'ATOM+XML\'),\n"
+"vector (\'application/odata+json\', \'ODATA/JSON\')\n"
+");\n"
+"}\n"
+"else\n"
+"{\n"
+"if (not length (format)) format := \'text/html\';\n"
+"opts := vector (\n"
+"vector (\'auto\', \'Auto\'),\n"
+"vector (\'text/html\', \'HTML\'),\n"
+"vector (\'application/vnd.ms-excel\', \'Spreadsheet\'),\n"
+"vector (\'application/sparql-results+xml\', \'XML\'),\n"
+"vector (\'application/sparql-results+json\', \'JSON\'),\n"
+"vector (\'application/javascript\', \'Javascript\'),\n"
+"vector (\'text/plain\', \'NTriples\'),\n"
+"vector (\'application/rdf+xml\', \'RDF/XML\')\n"
+");\n"
+"}\n"
+"foreach (any x in opts) do\n"
+"{\n"
+"http(sprintf (\'<option value=\"%V\" %s>%V</option>\\n\',\n"
+"x[0], case when format = x[0] then \'selected\' else \'\' end , x[1]));\n"
+"}\n"
+"http(\'			    <option value=\"text/csv\">CSV</option>\\n\');\n"
+"if (can_cxml)\n"
+"{\n"
+"http(\'			    <option value=\"text/cxml\">CXML (Pivot Collection)</option>\\n\');\n"
+"if (can_qrcode)\n"
+"http(\'			    <option value=\"text/cxml+qrcode\">CXML (Pivot Collection with QRcode)</option>\\n\');\n"
+"}\n"
+"}\n"
+"--src sparql_io.sql:1751\n";
+
+static const char *proc378 = 
+"#line 1823 \"[executable]/sparql_io.sql\"\n"
 "create procedure WS.WS.\"/!sparql/\" (inout path varchar, inout params any, inout lines any)\n"
 "{\n"
 "declare query, full_query, format, should_sponge, debug, def_qry varchar;\n"
 "declare dflt_graphs, named_graphs any;\n"
-"declare paramctr, paramcount, qry_params, maxrows, can_sponge, start_time integer;\n"
+"declare paramctr, paramcount, qry_params, maxrows, can_sponge, can_cxml, can_pivot, can_qrcode, start_time integer;\n"
 "declare ses, content any;\n"
 "declare def_max, add_http_headers, hard_timeout, timeout, client_supports_partial_res, sp_ini, soap_ver int;\n"
 "declare http_meth, content_type, ini_dflt_graph, get_user, jsonp_callback varchar;\n"
@@ -13549,9 +14841,26 @@ static const char *proc347 =
 "declare metas, rset any;\n"
 "declare accept, soap_action, user_id varchar;\n"
 "declare exec_time, exec_db_activity any;\n"
+"declare __debug_mode integer;\n"
+"declare qtxt, deadl integer;\n"
+"declare save_mode, save_dir, fname varchar;\n"
+"declare save_dir_id any;\n"
+"declare help_topic varchar;\n"
+"\n"
+"\n"
 "\n"
+"\n"
+"for (declare i int, i := 0; i < length (params); i := i + 2)\n"
+"{\n"
+"declare vn, vv varchar;\n"
+"vn := params[i];\n"
+"vv := params[i+1];\n"
+"if (not (isstring (vv)) or (vv <> \'\'))\n"
+"connection_set (\'SPARQL_\' || vn, vv);\n"
+"}\n"
 "if (registry_get (\'__sparql_endpoint_debug\') = \'1\')\n"
 "{\n"
+"__debug_mode := 1;\n"
 "for (declare i int, i := 0; i < length (params); i := i + 2)\n"
 "{\n"
 "if (isstring (params[i+1]))\n"
@@ -13575,17 +14884,42 @@ static const char *proc347 =
 "dflt_graphs := vector ();\n"
 "named_graphs := vector ();\n"
 "maxrows := 1024*1024;\n"
+"deadl := 0;\n"
 "http_meth := http_request_get (\'REQUEST_METHOD\');\n"
 "ini_dflt_graph := cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'DefaultGraph\');\n"
 "hard_timeout := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'MaxQueryExecutionTime\'), \'0\')) * 1000;\n"
 "timeout := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'ExecutionTimeout\'), \'0\')) * 1000;\n"
 "client_supports_partial_res := 0;\n"
-"def_qry := cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'DefaultQuery\');\n"
-"if (def_qry is null)\n"
-"def_qry := \'SELECT * WHERE {?s ?p ?o}\';\n"
+"user_id := connection_get (\'SPARQLUserId\', \'SPARQL\');\n"
+"help_topic := get_keyword (\'help\', params, null);\n"
+"if (help_topic is not null)\n"
+"goto brief_help;\n"
+"\n"
+"def_qry := get_keyword(\'qtxt\', params, \'\');\n"
+"\n"
+"if (\'\' <> def_qry)\n"
+"qtxt := 1;\n"
 "def_max := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'ResultSetMaxRows\'), \'-1\'));\n"
 "\n"
-"user_id := connection_get (\'SPARQLUserId\', \'SPARQL\');\n"
+"save_mode := get_keyword (\'save\', params, null);\n"
+"if (save_mode is not null and save_mode = \'display\')\n"
+"save_mode := null;\n"
+"else if (save_mode is not null)\n"
+"{\n"
+"save_dir := coalesce ((select U_HOME from DB.DBA.SYS_USERS where U_NAME = user_id and U_DAV_ENABLE));\n"
+"if (DAV_HIDE_ERROR (DAV_SEARCH_ID (save_dir, \'C\')) is null)\n"
+"save_dir := null;\n"
+"else\n"
+"{\n"
+"save_dir := save_dir || \'saved-sparql-results/\';\n"
+"save_dir_id := DAV_SEARCH_ID (save_dir, \'C\');\n"
+"if (DAV_HIDE_ERROR (save_dir_id) is null)\n"
+"save_dir := null;\n"
+"}\n"
+"}\n"
+"fname := trim (get_keyword (\'fname\', params, \'\'));\n"
+"if (fname = \'\')\n"
+"fname := null;\n"
 "get_user := \'\';\n"
 "soap_ver := 0;\n"
 "soap_action := http_request_header (lines, \'SOAPAction\', null, null);\n"
@@ -13597,11 +14931,6 @@ static const char *proc347 =
 "soap_ver := 11;\n"
 "\n"
 "content := null;\n"
-"can_sponge := coalesce ((select top 1 1\n"
-"from DB.DBA.SYS_USERS as sup\n"
-"join DB.DBA.SYS_ROLE_GRANTS as g on (sup.U_ID = g.GI_SUPER)\n"
-"join DB.DBA.SYS_USERS as sub on (g.GI_SUB = sub.U_ID)\n"
-"where sup.U_NAME = \'SPARQL\' and sub.U_NAME = \'SPARQL_SPONGE\' ), 0);\n"
 "declare exit handler for sqlstate \'*\' {\n"
 "DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (path, params, lines,\n"
 "\'500\', \'SPARQL Request Failed\',\n"
@@ -13624,8 +14953,22 @@ static const char *proc347 =
 "return;\n"
 "}\n"
 "\n"
+"if (__debug_mode) dbg_printf (\'%d\', soap_ver);\n"
+"\n"
+"can_sponge := coalesce ((select top 1 1\n"
+"from DB.DBA.SYS_USERS as sup\n"
+"join DB.DBA.SYS_ROLE_GRANTS as g on (sup.U_ID = g.GI_SUPER)\n"
+"join DB.DBA.SYS_USERS as sub on (g.GI_SUB = sub.U_ID)\n"
+"where sup.U_NAME = \'SPARQL\' and sub.U_NAME = \'SPARQL_SPONGE\' ), 0);\n"
+"can_cxml := case (isnull (DB.DBA.VAD_CHECK_VERSION (\'sparql_cxml\'))) when 0 then 1 else 0 end;\n"
+"can_pivot := case (isnull (DB.DBA.VAD_CHECK_VERSION (\'PivotViewer\'))) when 0 then 1 else 0 end;\n"
+"can_qrcode := isstring (__proc_exists (\'QRcode encodeString8bit\', 2));\n"
+"\n"
 "paramcount := length (params);\n"
-"if (((0 = paramcount) or ((2 = paramcount) and (\'Content\' = params[0]))) and soap_ver = 0)\n"
+"\n"
+"if ((0 = paramcount) or\n"
+"(((2 = paramcount) and (\'Content\' = params[0])) and soap_ver = 0) or\n"
+"qtxt = 1)\n"
 "{\n"
 "declare redir varchar;\n"
 "redir := registry_get (\'WS.WS.SPARQL_DEFAULT_REDIRECT\');\n"
@@ -13635,6 +14978,12 @@ static const char *proc347 =
 "http_header (sprintf (\'Location: %s\\r\\n\', redir));\n"
 "return;\n"
 "}\n"
+"if (not qtxt)\n"
+"{\n"
+"def_qry := cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'DefaultQuery\');\n"
+"if (def_qry is null)\n"
+"def_qry := \'SELECT * WHERE {?s ?p ?o}\';\n"
+"}\n"
 "http(\'<html xmlns=\"http://www.w3.org/1999/xhtml\">\\n\');\n"
 "http(\'	<head>\\n\');\n"
 "http(\'		<title>Virtuoso SPARQL Query Form</title>\\n\');\n"
@@ -13658,7 +15007,7 @@ static const char *proc347 =
 "http(\'  var query = query_obg.value; \\n\');\n"
 "http(\'  var format = query_obg.form.format;\\n\');\n"
 "http(\'\\n\');\n"
-"http(\'  if ((query.match(/construct/i) || query.match(/describe/i)) && last_format == 1) {\\n\');\n"
+"http(\'  if ((query.match(/\\\\bconstruct\\\\b/i) || query.match(/\\\\bdescribe\\\\b/i)) && last_format == 1) {\\n\');\n"
 "http(\'    for(var i = format.options.length; i > 0; i--)\\n\');\n"
 "http(\'      format.options[i] = null;\');\n"
 "http(\'    format.options[1] = new Option(\\\'N3/Turtle\\\',\\\'text/rdf+n3\\\');\\n\');\n"
@@ -13668,11 +15017,18 @@ static const char *proc347 =
 "http(\'    format.options[5] = new Option(\\\'XHTML+RDFa\\\',\\\'application/xhtml+xml\\\');\\n\');\n"
 "http(\'    format.options[6] = new Option(\\\'ATOM+XML\\\',\\\'application/atom+xml\\\');\\n\');\n"
 "http(\'    format.options[7] = new Option(\\\'ODATA/JSON\\\',\\\'application/odata+json\\\');\\n\');\n"
+"http(\'    format.options[8] = new Option(\\\'CSV\\\',\\\'text/csv\\\');\\n\');\n"
+"if (can_cxml)\n"
+"{\n"
+"http(\'    format.options[9] = new Option(\\\'CXML (Pivot Collection)\\\',\\\'text/cxml\\\');\\n\');\n"
+"if (can_qrcode)\n"
+"http(\'    format.options[10] = new Option(\\\'CXML (Pivot Collection with QRcodes)\\\',\\\'text/cxml+qrcode\\\');\\n\');\n"
+"}\n"
 "http(\'    format.selectedIndex = 1;\\n\');\n"
 "http(\'    last_format = 2;\\n\');\n"
 "http(\'  }\\n\');\n"
 "http(\'\\n\');\n"
-"http(\'  if (!(query.match(/construct/i) || query.match(/describe/i)) && last_format == 2) {\\n\');\n"
+"http(\'  if (!(query.match(/\\\\bconstruct\\\\b/i) || query.match(/\\\\bdescribe\\\\b/i)) && last_format == 2) {\\n\');\n"
 "http(\'    for(var i = format.options.length; i > 0; i--)\\n\');\n"
 "http(\'      format.options[i] = null;\\n\');\n"
 "http(\'    format.options[1] = new Option(\\\'HTML\\\',\\\'text/html\\\');\\n\');\n"
@@ -13683,6 +15039,9 @@ static const char *proc347 =
 "http(\'    format.options[6] = new Option(\\\'N3/Turtle\\\',\\\'text/rdf+n3\\\');\\n\');\n"
 "http(\'    format.options[7] = new Option(\\\'RDF/XML\\\',\\\'application/rdf+xml\\\');\\n\');\n"
 "http(\'    format.options[8] = new Option(\\\'NTriples\\\',\\\'text/plain\\\');\\n\');\n"
+"http(\'    format.options[9] = new Option(\\\'CSV\\\',\\\'text/csv\\\');\\n\');\n"
+"if (can_cxml)\n"
+"http(\'    format.options[10] = new Option(\\\'CXML (Pivot Collection)\\\',\\\'text/cxml\\\');\\n\');\n"
 "http(\'    format.selectedIndex = 1;\\n\');\n"
 "http(\'    last_format = 1;\\n\');\n"
 "http(\'  }\\n\');\n"
@@ -13735,37 +15094,10 @@ static const char *proc347 =
 "}\n"
 "else\n"
 "{\n"
-"declare host_ur varchar;\n"
-"host_ur := registry_get (\'URIQADefaultHost\');\n"
-"\n"
-"http(\'			  <i>Security restrictions of this server do not allow you to retrieve remote RDF data.\n"
-"DBA may wish to grant \"SPARQL_SPONGE\" privilege to \"SPARQL\" account to remove the restriction.\\n\');\n"
-"http(\'In order to do this, please perform the following steps:</i>\\n\');\n"
-"http(\'<br />\\n\');\n"
-"http(\'1. Go to the Virtuoso Administration Conductor i.e. \\n\');\n"
-"if (not isstring (host_ur))\n"
-"{\n"
-"http(\'http://host:port/conductor\\n\');\n"
+"http(\'			  <font size=\"-1\"><i>(Security restrictions of this server do not allow you to retrieve remote RDF data.\n"
+"Database administrator can change them, accodring to these <a href=\"/sparql?help=enable_sponge\">instructions</a>.)</i></font>\\n\');\n"
 "}\n"
-"else\n"
-"{\n"
-"http(sprintf(\'http://%s/conductor\\n\',host_ur));\n"
-"};\n"
-"\n"
-"http(\'<br />\\n\');\n"
-"http(\'2. Login as dba user\\n\');\n"
-"http(\'<br />\\n\');\n"
-"http(\'3. Go to System Admin->User Accounts->Roles\\n\');\n"
-"http(\'<br />\\n\');\n"
-"http(\'4. Click the link \"Edit\" for \"SPARQL_SPONGE\"\\n\');\n"
-"http(\'<br />\\n\');\n"
-"http(\'5. Select from the list of available user/groups \"SPARQL\" and click the \">>\" button so to add it to the right-positioned list.\\n\');\n"
-"http(\'<br />\\n\');\n"
-"http(\'6. Click the button \"Update\"\\n\');\n"
-"http(\'<br />\\n\');\n"
-"http(\'7. Access again the sparql endpoint in order to be able to retrieve remote data.\\n\');\n"
 "http(\'<br /><br />\\n\');\n"
-"}\n"
 "http(\'			  <label for=\"query\">Query text</label>\\n\');\n"
 "http(\'			  <br />\\n\');\n"
 "http(\'			  <textarea rows=\"10\" cols=\"80\" name=\"query\" id=\"query\" onchange=\"format_select(this)\" onkeyup=\"format_select(this)\">\'|| def_qry ||\'</textarea>\\n\');\n"
@@ -13774,24 +15106,61 @@ static const char *proc347 =
 "\n"
 "\n"
 "\n"
-"http(\'			  <label for=\"format\" class=\"n\">Display Results As:</label>\\n\');\n"
+"http(\'<label for=\"debug\" class=\"n\"><nobr>Rigorous check of the query:</nobr></label>\');\n"
+"http(\' <input name=\"debug\" type=\"checkbox\"\' || case (debug) when \'\' then \'\' else \' checked\' end || \'/>\');\n"
+"http(\'      \\n\');\n"
+"http(\'<label for=\"timeout\" class=\"n\"><nobr>Execution timeout, in milliseconds, values less than 1000 are ignored:</nobr></label>\');\n"
+"http(\' <input name=\"timeout\" type=\"text\"\' || case (isnull (timeout)) when 0 then cast (timeout as varchar) else \'\' end || \'/>\');\n"
+"http(\'      \\n\');\n"
+"http(\'			  <label for=\"format\" class=\"n\">Format Results As:</label>\\n\');\n"
 "http(\'			  <select name=\"format\">\\n\');\n"
-"http(\'			    <option value=\"auto\">Auto</option>\\n\');\n"
-"http(\'			    <option value=\"text/html\" selected=\"selected\">HTML</option>\\n\');\n"
-"http(\'			    <option value=\"application/vnd.ms-excel\">Spreadsheet</option>\\n\');\n"
-"http(\'			    <option value=\"application/sparql-results+xml\">XML</option>\\n\');\n"
-"http(\'			    <option value=\"application/sparql-results+json\">JSON</option>\\n\');\n"
-"http(\'			    <option value=\"application/javascript\">Javascript</option>\\n\');\n"
-"http(\'			    <option value=\"text/plain\">NTriples</option>\\n\');\n"
-"http(\'			    <option value=\"application/rdf+xml\">RDF/XML</option>\\n\');\n"
+"WS.WS.sparql_enpoint_format_opts (can_cxml, can_qrcode, params, def_qry);\n"
 "http(\'			  </select>\\n\');\n"
-"http(\'   \\n\');\n"
-"http(\'<input name=\"debug\" type=\"checkbox\"\' || case (debug) when \'\' then \'\' else \' checked\' end || \'/>\');\n"
-"http(\' <label for=\"debug\" class=\"n\"><nobr>Rigorous check of the query</nobr></label>\\n\');\n"
-"http(\'   \\n\');\n"
-"http(\'<input name=\"timeout\" type=\"text\"\' || case (isnull (timeout)) when 0 then cast (timeout as varchar) else \'\' end || \'/>\');\n"
-"http(\' <label for=\"timeout\" class=\"n\"><nobr>Execution timeout, in milliseconds, values less than 1000 are ignored</nobr></label>\\n\');\n"
-"http(\'   \\n\');\n"
+"if (can_cxml)\n"
+"{\n"
+"http(\'<div style=\"display:none\">\\n\');\n"
+"http(\'      \\n\');\n"
+"http(\'			  <label for=\"redir_for_subjs\" class=\"n\">Style for RDF subjects:</label>\\n\');\n"
+"http(\'			  <select name=\"CXML_redir_for_subjs\">\\n\');\n"
+"http(\'			    <option value=\"\" selected=\"selected\">Convert to string facets</option>\\n\');\n"
+"http(\'			    <option value=\"121\">Make Plain Links</option>\\n\');\n"
+"if (can_pivot is not null)\n"
+"http(\'			    <option value=\"LOCAL_PIVOT\">Make SPARQL DESCRIBE Pivot links</option>\\n\');\n"
+"http(\'			    <option value=\"LOCAL_TTL\">Make SPARQL DESCRIBE download links (TTL)</option>\\n\');\n"
+"http(\'			    <option value=\"LOCAL_CXML\">Make SPARQL DESCRIBE download links (CXML)</option>\\n\');\n"
+"http(\'			  </select>\\n\');\n"
+"http(\'</div>\\n\');\n"
+"http(\'      \\n\');\n"
+"\n"
+"http(\'			  <label for=\"redir_for_hrefs\" class=\"n\">CXML link behavior:</label>\\n\');\n"
+"http(\'			  <select name=\"CXML_redir_for_hrefs\">\\n\');\n"
+"http(\'			    <option value=\"\" selected=\"selected\">Local faceted navigation links</option>\\n\');\n"
+"http(\'			    <option value=\"121\">External resource links</option>\\n\');\n"
+"if (can_pivot is not null)\n"
+"http(\'			    <option value=\"LOCAL_PIVOT\">External faceted navigation links</option>\\n\');\n"
+"http(\'			    <option value=\"LOCAL_TTL\">External description resource (TTL)</option>\\n\');\n"
+"http(\'			    <option value=\"LOCAL_CXML\">External description resource (CXML)</option>\\n\');\n"
+"http(\'			  </select>\\n\');\n"
+"}\n"
+"if (not can_cxml)\n"
+"http(\' <font size=\"-1\"><i>(The CXML output is disabled, see <a href=\"/sparql?help=enable_cxml\">details</a>)</i></font>\\n\');\n"
+"else if (not can_qrcode)\n"
+"http(\' <font size=\"-1\"><i>(The QRcode output is disabled, no "qrcode" plugin found</a>)</i></font>\\n\');\n"
+"http(\'      \\n\');\n"
+"if (save_dir is not null)\n"
+"{\n"
+"\n"
+"http(\'			  <select name=\"save\">\\n\');\n"
+"http(\'			    <option value=\"display\" selected=\"selected\">Display the result and not save</option>\\n\');\n"
+"http(\'			    <option value=\"tmpstatic\">Save the result to the DAV as a temporary document with the specified name:</option>\\n\');\n"
+"http(\'			    <option value=\"dynamic\">Save the result to the DAV and refresh it periodically with the specified name:</option>\\n\');\n"
+"http(\'			  </select>\');\n"
+"http(\' <input name=\"fname\" type=\"text\" />\');\n"
+"http(\'      \\n\');\n"
+"}\n"
+"else\n"
+"http(\' <font size=\"-1\"><i>(The result can only be sent back to browser, but not saved on the server, see <a href=\"/sparql?help=enable_det\">details</a>)</i></font>\\n\');\n"
+"http(\'<br /><br />\\n\');\n"
 "http(\'			  <input type=\"submit\" value=\"Run Query\"/>\');\n"
 "http(\' <input type=\"reset\" value=\"Reset\"/>\\n\');\n"
 "http(\'			</fieldset>\\n\');\n"
@@ -13801,7 +15170,7 @@ static const char *proc347 =
 "http(\'		<div id=\"ft_b\">\\n\');\n"
 "http(\'<a href=\"http://www.openlinksw.com/virtuoso/\">OpenLink Virtuoso</a> version \'); http(sys_stat (\'st_dbms_ver\')); http(\', on \');\n"
 "http(sys_stat (\'st_build_opsys_id\')); http (sprintf (\' (%s), \', host_id ()));\n"
-"http(case when sys_stat (\'cl_run_local_only\') = 1 then \'Single\' else \'Cluster\' end); http (\' Edition \');\n"
+"http(case when sys_stat (\'cl_run_local_only\') = 1 then \'Single Server\' else \'Cluster\' end); http (\' Edition \');\n"
 "http(case when sys_stat (\'cl_run_local_only\') = 0 then sprintf (\'(%d server processes)\', sys_stat (\'cl_n_hosts\')) else \'\' end);\n"
 "http(\'		</div>\\n\');\n"
 "http(\'		</div>\\n\');\n"
@@ -13867,7 +15236,7 @@ static const char *proc347 =
 "{\n"
 "format := pvalue;\n"
 "}\n"
-"else if (\'timeout\' = pname)\n"
+"else if (\'timeout\' = pname and length (pvalue))\n"
 "{\n"
 "declare t integer;\n"
 "t := cast (pvalue as integer) * 1000;\n"
@@ -13952,6 +15321,9 @@ static const char *proc347 =
 "when \'xml\' then \'application/sparql-results+xml\'\n"
 "when \'rdf\' then \'application/rdf+xml\'\n"
 "when \'n3\' then \'text/rdf+n3\'\n"
+"when \'cxml\' then \'text/cxml\'\n"
+"when \'cxml+qrcode\' then \'text/cxml+qrcode\'\n"
+"when \'csv\' then \'text/csv\'\n"
 "else format\n"
 "end);\n"
 "}\n"
@@ -14076,31 +15448,13 @@ static const char *proc347 =
 "}\n"
 "else\n"
 "qry_params := vector ();\n"
-"state := \'00000\';\n"
-"metas := null;\n"
-"rset := null;\n"
-"if (registry_get (\'__sparql_endpoint_debug\') = \'1\')\n"
-"dbg_printf (\'query=[%s]\', full_query);\n"
+"if (save_mode is not null and save_mode <> \'display\')\n"
+"client_supports_partial_res := 0;\n"
 "\n"
-"declare sc_max int;\n"
-"declare sc decimal;\n"
-"sc_max := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'MaxQueryCostEstimationTime\'), \'-1\'));\n"
-"if (sc_max < 0)\n"
-"sc_max := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'MaxExecutionTime\'), \'-1\'));\n"
-"if (sc_max > 0)\n"
-"{\n"
-"state := \'00000\';\n"
-"sc := exec_score (concat (\'sparql \', full_query), state, msg);\n"
-"if ((sc/1000) > sc_max)\n"
+"if (format <> \'\')\n"
 "{\n"
-"signal (\'42000\', sprintf (\'The estimated execution time %d (sec) exceeds the limit of %d (sec).\', sc/1000, sc_max));\n"
+"full_query := \'\\n#output-format:\' || format || \'\\n\' || full_query;\n"
 "}\n"
-"}\n"
-"\n"
-"state := \'00000\';\n"
-"metas := null;\n"
-"rset := null;\n"
-"\n"
 "if (not client_supports_partial_res)\n"
 "{\n"
 "\n"
@@ -14147,6 +15501,35 @@ static const char *proc347 =
 "full_query := \'define sql:describe-mode \"CBD\" \' || full_query;\n"
 "}\n"
 "\n"
+"state := \'00000\';\n"
+"metas := null;\n"
+"rset := null;\n"
+"if (registry_get (\'__sparql_endpoint_debug\') = \'1\')\n"
+"dbg_printf (\'query=[%s]\', full_query);\n"
+"\n"
+"declare sc_max int;\n"
+"declare sc decimal;\n"
+"sc_max := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'MaxQueryCostEstimationTime\'), \'-1\'));\n"
+"if (sc_max < 0)\n"
+"sc_max := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'MaxExecutionTime\'), \'-1\'));\n"
+"if (sc_max > 0)\n"
+"{\n"
+"state := \'00000\';\n"
+"full_query := concat (\'define sql:big-data-const 0 \', full_query);\n"
+"sc := exec_score (concat (\'sparql \', full_query), state, msg);\n"
+"if ((sc/1000) > sc_max)\n"
+"{\n"
+"signal (\'42000\', sprintf (\'The estimated execution time %d (sec) exceeds the limit of %d (sec).\', sc/1000, sc_max));\n"
+"}\n"
+"}\n"
+"\n"
+"state := \'00000\';\n"
+"metas := null;\n"
+"rset := null;\n"
+"\n"
+"\n"
+"\n"
+"\n"
 "\n"
 "\n"
 "commit work;\n"
@@ -14160,7 +15543,9 @@ static const char *proc347 =
 "{\n"
 "set TRANSACTION_TIMEOUT=hard_timeout;\n"
 "}\n"
-"set_user_id (user_id);\n"
+"set_user_id (user_id, 1);\n"
+"again:\n"
+"state := \'00000\';\n"
 "start_time := msec_time();\n"
 "exec ( concat (\'sparql \', full_query), state, msg, qry_params, vector (\'max_rows\', maxrows, \'use_cache\', 1), metas, rset);\n"
 "commit work;\n"
@@ -14175,6 +15560,15 @@ static const char *proc347 =
 "\n"
 "\n"
 "}\n"
+"else if ((not http_is_flushed ()) and state = \'40001\' and deadl < 6)\n"
+"{\n"
+"declare dt int;\n"
+"rollback work;\n"
+"deadl := deadl + 1;\n"
+"dt := ((rnd (5) + 1) / 10.0) * (2 * deadl);\n"
+"delay (dt);\n"
+"goto again;\n"
+"}\n"
 "else\n"
 "{\n"
 "declare state2, msg2 varchar;\n"
@@ -14193,6 +15587,17 @@ static const char *proc347 =
 "return;\n"
 "}\n"
 "write_results:\n"
+"if (save_mode is not null)\n"
+"{\n"
+"declare status any;\n"
+"if ((1 = length (metas[0])) and (\'aggret-0\' = metas[0][0][0]))\n"
+"{\n"
+"DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (path, params, lines,\n"
+"\'500\', \'SPARQL Request Failed\',\n"
+"full_query, \'00000\', \'The result of the query can not be saved to a DAV resource\', format);\n"
+"return;\n"
+"}\n"
+"}\n"
 "if ((1 <> length (metas[0])) or (\'aggret-0\' <> metas[0][0][0]))\n"
 "{\n"
 "declare status any;\n"
@@ -14200,18 +15605,181 @@ static const char *proc347 =
 "status := NULL;\n"
 "else\n"
 "status := vector (state, msg, exec_time, exec_db_activity);\n"
+"if (save_mode is not null)\n"
+"{\n"
+"if ((not isinteger (save_dir_id)) or not exists (select top 1 1 from WS.WS.SYS_DAV_COL where COL_ID = save_dir_id and COL_DET=\'DynaRes\'))\n"
+"{\n"
+"DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (path, params, lines,\n"
+"\'500\', \'SPARQL Request Failed\',\n"
+"full_query, \'00000\', sprintf (\'To keep saved SPARQL results, the DAV directory \"%.200s\" should be of DAV extension type \"DynaRes\"\', save_dir), format);\n"
+"return;\n"
+"}\n"
+"if (fname is not null)\n"
+"{\n"
+"if (strchr (fname, \'/\') is not null)\n"
+"{\n"
+"DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (path, params, lines,\n"
+"\'500\', \'SPARQL Request Failed\',\n"
+"full_query, \'00000\', sprintf (\'The specified resource name \"%.200s\" contains illegal characters\', fname), format);\n"
+"return;\n"
+"}\n"
+"}\n"
+"ses := string_output ();\n"
+"add_http_headers := 0;\n"
+"}\n"
 "if (isstring (jsonp_callback))\n"
-"http (jsonp_callback || \'(\\n\');\n"
+"http (jsonp_callback || \'(\\n\', ses);\n"
 "DB.DBA.SPARQL_RESULTS_WRITE (ses, metas, rset, accept, add_http_headers, status);\n"
 "if (isstring (jsonp_callback))\n"
-"http (\')\');\n"
+"http (\')\', ses);\n"
+"if (save_mode is not null)\n"
+"{\n"
+"declare sparql_uid integer;\n"
+"declare refresh_sec, ttl_sec integer;\n"
+"declare full_uri varchar;\n"
+"sparql_uid := (SELECT U_ID from DB.DBA.SYS_USERS where U_NAME = user_id);\n"
+"if (fname is null)\n"
+"{\n"
+"if (save_mode = \'tmpstatic\')\n"
+"fname := sprintf (\'%.100s - SPARQL result - made by %.100s\', cast (now() as varchar), user_id);\n"
+"else\n"
+"fname := sprintf (\'%.100s - cached and renewable SPARQL result - made by %.100s\', cast (now() as varchar), user_id);\n"
+"}\n"
+"refresh_sec := case (save_mode) when \'tmpstatic\' then null else __max (600, coalesce (hard_timeout, 1000)/100) end;\n"
+"ttl_sec := 172800;\n"
+"full_uri := concat (\'http://\', registry_get (\'URIQADefaultHost\'), DAV_SEARCH_PATH (save_dir_id, \'C\'), fname);\n"
+"\"DynaRes_INSERT_RESOURCE\" (detcol_id => save_dir_id, fname => fname,\n"
+"owner_uid => sparql_uid,\n"
+"refresh_seconds => refresh_sec,\n"
+"ttl_seconds => ttl_sec,\n"
+"mime => accept,\n"
+"exec_stmt => \'DB.DBA.SPARQL_REFRESH_DYNARES_RESULTS (?, ?, ?, ?, ?, ?, ?)\',\n"
+"exec_params => vector (full_query, qry_params, maxrows, accept, user_id, hard_timeout, jsonp_callback),\n"
+"exec_uname => user_id, content => ses );\n"
+"http (\'<html><head><title>The SPARQL result is successfully saved</title></head><body>\');\n"
+"http (\'<h3>Done!</h3>\');\n"
+"http (\'<p>The SPARQL result is successfully saved in DAV storage as <a href=\"\');\n"
+"http_value (full_uri);\n"
+"http (\'\">\');\n"
+"http_value (full_uri);\n"
+"http (\'</a></p>\');\n"
+"if (refresh_sec is not null)\n"
+"http (sprintf (\'<p>The content of the linked resource will be re-calculated on demand, and the result will be cached for %d minutes.</p>\', refresh_sec/60));\n"
+"if (ttl_sec is not null)\n"
+"http (sprintf (\'<p>The link will stay valid for %d days. To preserve the referenced document for future use, copy it to some other location before expiration.</p>\', ttl_sec/(60*60*24)));\n"
+"if (accept <> \'text/html\')\n"
+"http (sprintf (\'<p>The resource MIME type is \"%s\". This type will be reported to the browser when you click on the link.\n"
+"If the browser is unable to open the link itself it can prompt for action like lauching an additional program.\n"
+"The program may let you to edit the loaded resource, in this case save the changed version should be saved to a different place, so use \"Save As\" command, not plain \"Save\".</p>\', accept));\n"
+"http (\'</body></html>\');\n"
+"}\n"
+"}\n"
+"else\n"
+"{\n"
+"if (save_mode is not null)\n"
+"{\n"
+"DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (path, params, lines,\n"
+"\'500\', \'SPARQL Request Failed\',\n"
+"full_query, \'00000\', \'The result of the query can not be saved to a DAV resource\', format);\n"
+"return;\n"
+"}\n"
+"}\n"
+"return;\n"
+"\n"
+"brief_help:\n"
+"http (\'<html><head><title>SPARQL Web Service Endpoint | Quick Help</title></head><body>\');\n"
+"if (help_topic=\'enable_sponge\')\n"
+"{\n"
+"declare host_ur varchar; host_ur := registry_get (\'URIQADefaultHost\');\n"
+"http(\'<h3>How To Enable Sponge?</h3>\n"
+"<p>When a new Virtuoso server is installed, default security restrictions do not allow SPARQL endpoint users to retrieve remote RDF data.\n"
+"To remove the restriction, DBA should grant \"SPARQL_SPONGE\" privilege to \"SPARQL\" account.\n"
+"If you are the administrator, you can perform the following steps:</p>\\n\');\n"
+"http(\'<ol>\\n\');\n"
+"http(\'<li>Go to the Virtuoso Administration Conductor i.e. \\n\');\n"
+"if (not isstring (host_ur))\n"
+"http(\'http://host:port/conductor .\');\n"
+"else\n"
+"http( sprintf(\'<a href=\"http://%s/conductor\">http://%s/conductor</a>.\', host_ur, host_ur));\n"
+"http(\'</li>\\n<li>Login as dba user.\');\n"
+"http(\'</li>\\n<li>Go to System Admin->User Accounts->Roles\\n\');\n"
+"http(\'</li>\\n<li>Click the link \"Edit\" for \"SPARQL_SPONGE\"\\n\');\n"
+"http(\'</li>\\n<li>Select from the list of available user/groups \"SPARQL\" and click the \">>\" button so to add it to the right-positioned list.\\n\');\n"
+"http(\'</li>\\n<li>Click the button \"Update\"\\n\');\n"
+"http(\'</li>\\n<li>Access again the sparql endpoint in order to be able to retrieve remote data.\\n\');\n"
+"http(\'</li></ol>\\n\');\n"
+"}\n"
+"else if (help_topic=\'enable_cxml\')\n"
+"{\n"
+"http(\'<h3>How To Enable CXML Support</h3>\');\n"
+"http(\'<p>CXML is data exchange format for so-called \"faceted view\". It can be displayed by programs like Microsoft Pivot.\n"
+"For best results, the result of the query should contain links to images associated with described data and follow some rules, described in the User's Guide.</p>\n"
+"<p>This feature is supported by combination of three components:</p>\\n\');\n"
+"http(\'<ol>\\n\');\n"
+"http(\'<li>Virtuoso Universal Server (Virtuoso Open Source does not contain some required functions)\\n\');\n"
+"http(\'</li>\\n<li>ImageMagick plugin of version 0.6 or newer\\n\');\n"
+"http(\'</li>\\n<li>sparql_cxml VAD package (it will in turn require "RDF mappers" package)\\n\');\n"
+"http(\'</li></ol>\\n\');\n"
+"http(\'<p>As soon as all components are installed, SPARQL web service endpoint will contain "CXML" option to the list of available formats.</p>\\n\');\n"
+"}\n"
+"else if (help_topic=\'enable_det\')\n"
+"{\n"
+"declare host_ur varchar; host_ur := registry_get (\'URIQADefaultHost\');\n"
+"http(\'<h3>How To Let the SPARQL Endpoint Save Results In DAV?</h3>\n"
+"<p>By default, SPARQL endpoint can only sent the result back to the client. That can be inconvenient if the result should be accessible for programs like file managers and archivers.</p>\n"
+"<p>The solution is to let the endpoint create "dynamic"resources in DAV storage of the Virtuoso server. A DAV client, e.g., the boilt-in client of Windows Explorer, can connect to that storage and access these resources as if they are plain local files.</p>\n"
+"<p>If you are the administrator and want to enable this feature, you can perform the following steps:</p>\\n\');\n"
+"http(\'<ol>\\n\');\n"
+"http( sprintf(\'<li>This web service endpoint runs under "%.100s" account. This user should have an access to DAV (U_DAV_ENABLE=1 in DB.DBA.SYS_USERS)\\n\', user_id));\n"
+"http( sprintf(\'</li>\\n<li>The DAV home directory (e.g., <a href=\"/DAV/home/%.100s/\">/DAV/home/%.100s/</a>) should be created and the path to it should be remembered in DB.DBA.SYS_USERS (U_HOME field; do not forget the leading and the trailing slash chars).\\n\', user_id, user_id));\n"
+"http( sprintf(\'</li>\\n<li>The home directory should contain a subdirectory named "saved-sparql-results", and the subdirectory should be of "DynaRes" DAV Extension Type.\'));\n"
+"http(\'</li></ol>\\n\');\n"
+"http(\'<p>As soon as the appropriated directory exists, SPARQL web service endpoint will show additional controls to choose how to save results.</p>\\n\');\n"
+"}\n"
+"else if (help_topic=\'enable_det\')\n"
+"{\n"
+"DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT (path, params, lines,\n"
+"\'500\', \'Request Failed\',\n"
+"\'Invalid help topic\', format);\n"
 "}\n"
+"http(\'<p><font size=\"-1\">To close this help, press the "back" button of the browser.</font></p>\\n\');\n"
 "}\n"
-"--src sparql_io.sql:1671\n";
+"--src sparql_io.sql:1821\n";
 
-static const char *other38 = 
+static const char *other42 = 
 "registry_set (\'/!sparql/\', \'no_vsp_recompile\')\n";
-static const char *proc348 = 
+static const char *proc379 = 
+"#line 2743 \"[executable]/sparql_io.sql\"\n"
+"create procedure DB.DBA.SPARQL_REFRESH_DYNARES_RESULTS (in full_query varchar, in qry_params any, in maxrows integer, in accept varchar, in user_id varchar, in hard_timeout integer, in jsonp_callback any)\n"
+"{\n"
+"\n"
+"declare state, msg varchar;\n"
+"declare metas, rset any;\n"
+"declare RES any;\n"
+"declare ses any;\n"
+"result_names (RES);\n"
+"set_user_id (user_id, 1);\n"
+"if (hard_timeout >= 1000)\n"
+"set TRANSACTION_TIMEOUT = hard_timeout;\n"
+"set_user_id (user_id);\n"
+"state := \'00000\';\n"
+"exec ( concat (\'sparql \', full_query), state, msg, qry_params, vector (\'max_rows\', maxrows, \'use_cache\', 1), metas, rset);\n"
+"commit work;\n"
+"\n"
+"if (state <> \'00000\')\n"
+"signal (state, msg);\n"
+"ses := string_output ();\n"
+"if (isstring (jsonp_callback))\n"
+"http (jsonp_callback || \'(\\n\', ses);\n"
+"DB.DBA.SPARQL_RESULTS_WRITE (ses, metas, rset, accept, 0, null);\n"
+"if (isstring (jsonp_callback))\n"
+"http (\')\', ses);\n"
+"result (ses);\n"
+"}\n"
+"--src sparql_io.sql:2741\n";
+
+static const char *proc380 = 
+"#line 2774 \"[executable]/sparql_io.sql\"\n"
 " create function DB.DBA.SPARQL_ROUTE_IF_DAV (in graph_iri varchar, in output_format_name varchar)\n"
 "{\n"
 "\n"
@@ -14220,9 +15788,10 @@ static const char *proc348 =
 "return subseq (graph_iri, 17);\n"
 "return NULL;\n"
 "}\n"
-"--src sparql_io.sql:2351\n";
+"--src sparql_io.sql:2772\n";
 
-static const char *proc349 = 
+static const char *proc381 = 
+"#line 2784 \"[executable]/sparql_io.sql\"\n"
 "create procedure DB.DBA.SPARQL_ROUTE_DICT_CONTENT_DAV (\n"
 "in graph_iri varchar,\n"
 "in opname varchar,\n"
@@ -14309,25 +15878,28 @@ static const char *proc349 =
 "if (not isinteger (final_res))\n"
 "return final_res;\n"
 "}\n"
-"--src sparql_io.sql:2361\n";
+"--src sparql_io.sql:2782\n";
 
-static const char *proc350 = 
+static const char *proc382 = 
+"#line 2873 \"[executable]/sparql_io.sql\"\n"
 "create procedure\n"
 "WS.WS.__http_handler_rq (in content any, in params any, in lines any, inout ipath_ostat any)\n"
 "{\n"
 "return DB.DBA.http_rq_file_handler(content, params, lines, ipath_ostat);\n"
 "}\n"
-"--src sparql_io.sql:2450\n";
+"--src sparql_io.sql:2871\n";
 
-static const char *proc351 = 
+static const char *proc383 = 
+"#line 2880 \"[executable]/sparql_io.sql\"\n"
 "create procedure\n"
 "WS.WS.__http_handler_head_rq (in content any, in params any, in lines any, inout ipath_ostat any)\n"
 "{\n"
 "return DB.DBA.http_rq_file_handler(content, params, lines, ipath_ostat);\n"
 "}\n"
-"--src sparql_io.sql:2457\n";
+"--src sparql_io.sql:2878\n";
 
-static const char *proc352 = 
+static const char *proc384 = 
+"#line 2887 \"[executable]/sparql_io.sql\"\n"
 "create procedure\n"
 "DB.DBA.http_rq_file_handler (in content any, in params any, in lines any, inout ipath_ostat any)\n"
 "{\n"
@@ -14349,6 +15921,9 @@ static const char *proc352 =
 "when \'xml\' then \'application/sparql-results+xml\'\n"
 "when \'rdf\' then \'application/rdf+xml\'\n"
 "when \'n3\' then \'text/rdf+n3\'\n"
+"when \'cxml\' then \'text/cxml\'\n"
+"when \'cxml+qrcode\' then \'text/cxml+qrcode\'\n"
+"when \'csv\' then \'text/csv\'\n"
 "else _format\n"
 "end);\n"
 "}\n"
@@ -14364,7 +15939,10 @@ static const char *proc352 =
 "strcasestr (accept, \'application/rdf+xml\') is not null or\n"
 "strcasestr (accept, \'application/javascript\') is not null or\n"
 "strcasestr (accept, \'application/soap+xml\') is not null or\n"
-"strcasestr (accept, \'application/rdf+turtle\') is not null\n"
+"strcasestr (accept, \'application/rdf+turtle\') is not null or\n"
+"strcasestr (accept, \'text/cxml\') is not null or\n"
+"strcasestr (accept, \'text/cxml+qrcode\') is not null or\n"
+"strcasestr (accept, \'text/csv\') is not null\n"
 ")\n"
 "{\n"
 "http_request_status (\'HTTP/1.1 303 See Other\');\n"
@@ -14378,9 +15956,10 @@ static const char *proc352 =
 "http (content);\n"
 "return \'\';\n"
 "}\n"
-"--src sparql_io.sql:2464\n";
+"--src sparql_io.sql:2885\n";
 
-static const char *proc353 = 
+static const char *proc385 = 
+"#line 2945 \"[executable]/sparql_io.sql\"\n"
 "create procedure DB.DBA.RDF_GRANT_SPARQL_IO ()\n"
 "{\n"
 "declare state, msg varchar;\n"
@@ -14390,20 +15969,24 @@ static const char *proc353 =
 "\'grant execute on DB.DBA.SPARQL_REXEC_TO_ARRAY to SPARQL_SELECT\',\n"
 "\'grant execute on DB.DBA.SPARQL_REXEC_WITH_META to SPARQL_SELECT\',\n"
 "\'grant execute on WS.WS.\"/!sparql/\" to \"SPARQL\"\',\n"
-"\'grant execute on DB.DBA.SPARQL_ROUTE_DICT_CONTENT_DAV to SPARQL_UPDATE\' );\n"
+"\'grant execute on DB.DBA.SPARQL_REFRESH_DYNARES_RESULTS to \"SPARQL\"\',\n"
+"\'grant execute on DB.DBA.SPARQL_ROUTE_DICT_CONTENT_DAV to SPARQL_UPDATE\',\n"
+"\'grant execute on DB.DBA.SPARQL_SINV_IMP to SPARQL_SPONGE\',\n"
+"\'grant select on DB.DBA.SPARQL_SINV_2 to SPARQL_SPONGE\' );\n"
 "foreach (varchar cmd in cmds) do\n"
 "{\n"
 "exec (cmd, state, msg);\n"
 "}\n"
 "}\n"
-"--src sparql_io.sql:2516\n";
+"--src sparql_io.sql:2943\n";
 
 
-static const char *other39 = 
+static const char *other43 = 
 " DB.DBA.RDF_GRANT_SPARQL_IO ()\n";
 /* rdf_sponge.sql */
 
-static const char *proc354 = 
+static const char *proc386 = 
+"#line 28 \"[executable]/rdf_sponge.sql\"\n"
 " create procedure DB.DBA.RDF_FT_INDEX_GRABBED (inout grabbed any, inout options any)\n"
 "{\n"
 "declare grabbed_list any;\n"
@@ -14436,9 +16019,10 @@ static const char *proc354 =
 "}\n"
 "\n"
 "}\n"
-"--src rdf_sponge.sql:27\n";
+"--src rdf_sponge.sql:26\n";
 
-static const char *proc355 = 
+static const char *proc387 = 
+"#line 62 \"[executable]/rdf_sponge.sql\"\n"
 "create function DB.DBA.RDF_GRAB_SINGLE (in val any, inout grabbed any, inout env any) returns integer\n"
 "{\n"
 "declare url, get_method, recov varchar;\n"
@@ -14469,7 +16053,8 @@ static const char *proc355 =
 "\'get:method\', get_method,\n"
 "\'get:destination\', final_dest,\n"
 "\'get:group-destination\', final_gdest,\n"
-"\'get:strategy\', get_keyword_ucase (\'get:strategy\', env)\n"
+"\'get:strategy\', get_keyword_ucase (\'get:strategy\', env),\n"
+"\'get:error-recovery\', get_keyword_ucase (\'get:error-recovery\', env)\n"
 ");\n"
 "dict_put (grabbed, url, 1);\n"
 "call (get_keyword (\'loader\', env))(url, opts);\n"
@@ -14490,11 +16075,14 @@ static const char *proc355 =
 "}\n"
 "end_of_sponge:\n"
 "commit work;\n"
+"\n"
 "recov := get_keyword_ucase (\'get:error-recovery\', env);\n"
 "if (recov is not null)\n"
 "{\n"
+"if (recov = \'signal\')\n"
+"signal (__SQL_STATE, __SQL_MESSAGE);\n"
 "whenever sqlstate \'*\' goto end_of_recov;\n"
-"call (recov) (__SQL_STATE, __SQL_MESSAGE);\n"
+"call (recov) (__SQL_STATE, __SQL_MESSAGE, val, grabbed, env);\n"
 "commit work;\n"
 "return 0;\n"
 "end_of_recov:\n"
@@ -14502,18 +16090,20 @@ static const char *proc355 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src rdf_sponge.sql:61\n";
+"--src rdf_sponge.sql:60\n";
 
-static const char *proc356 = 
+static const char *proc388 = 
+"#line 131 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure DB.DBA.RDF_GRAB_SINGLE_ASYNC (in val any, in grabbed any, in env any, in counter_limit integer := 1)\n"
 "{\n"
 "\n"
 "if (dict_size (grabbed) < counter_limit)\n"
 "DB.DBA.RDF_GRAB_SINGLE (val, grabbed, vector_concat (vector (\'refresh_free_text\', 0), env));\n"
 "}\n"
-"--src rdf_sponge.sql:126\n";
+"--src rdf_sponge.sql:129\n";
 
-static const char *proc357 = 
+static const char *proc389 = 
+"#line 139 \"[executable]/rdf_sponge.sql\"\n"
 "create function DB.DBA.RDF_GRAB_SEEALSO (in subj varchar, in opt_g varchar, inout env any) returns integer\n"
 "{\n"
 "declare grabbed, aq any;\n"
@@ -14529,6 +16119,26 @@ static const char *proc357 =
 "sa_preds := get_keyword (\'sa_preds\', env);\n"
 "sa_graphs := get_keyword (\'sa_graphs\', env);\n"
 "\n"
+"if (sa_graphs is null)\n"
+"{\n"
+"foreach (varchar pred in sa_preds) do\n"
+"{\n"
+"for (sparql define input:storage \"\" select ?val where { ?:subj ?:pred ?val . filter (isIRI(?val)) } ) do\n"
+"{\n"
+"\n"
+"if (\"val\" like \'http://%\')\n"
+"{\n"
+"\n"
+"\n"
+"aq_request (aq, \'DB.DBA.RDF_GRAB_SINGLE_ASYNC\', vector (\"val\", grabbed, env, doc_limit));\n"
+"if (dict_size (grabbed) > doc_limit)\n"
+"goto out_of_limit;\n"
+"}\n"
+"}\n"
+"}\n"
+"}\n"
+"else\n"
+"{\n"
 "foreach (varchar pred in sa_preds) do\n"
 "{\n"
 "foreach (varchar graph in sa_graphs) do\n"
@@ -14547,6 +16157,7 @@ static const char *proc357 =
 "}\n"
 "}\n"
 "}\n"
+"}\n"
 "if (opt_g is not null)\n"
 "{\n"
 "foreach (varchar pred in sa_preds) do\n"
@@ -14584,9 +16195,10 @@ static const char *proc357 =
 "return 4;\n"
 "return 2;\n"
 "}\n"
-"--src rdf_sponge.sql:134\n";
+"--src rdf_sponge.sql:137\n";
 
-static const char *proc358 = 
+static const char *proc390 = 
+"#line 232 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure\n"
 "DB.DBA.RDF_GRAB (\n"
 "in app_params any, in seed varchar, in iter varchar, in final varchar, in ret_limit integer,\n"
@@ -14597,7 +16209,7 @@ static const char *proc358 =
 "{\n"
 "declare rctr, rcount, colcount, iter_ctr integer;\n"
 "declare stat, msg varchar;\n"
-"declare grab_params, all_params any;\n"
+"declare grab_params, all_params, sa_params any;\n"
 "declare grabbed, metas, rset, aq any;\n"
 "\n"
 "grab_params := vector (\'sa_graphs\', sa_graphs, \'sa_preds\', sa_preds,\n"
@@ -14607,9 +16219,11 @@ static const char *proc358 =
 "\'resolver\', resolver, \'loader\', loader,\n"
 "\'refresh_free_text\', refresh_free_text,\n"
 "\'flags\', flags, \'grabbed\', dict_new() );\n"
-"all_params := vector_concat (vector (grab_params), app_params);\n"
+"all_params := vector_concat (grab_params, app_params);\n"
 "aq := async_queue (8);\n"
 "grabbed := dict_new ();\n"
+"if (sa_preds is not null)\n"
+"sa_params := vector_concat (all_params, vector (\'grabbed\', grabbed));\n"
 "foreach (any val in const_iris) do\n"
 "{\n"
 "\n"
@@ -14618,6 +16232,11 @@ static const char *proc358 =
 "\n"
 "\n"
 "aq_request (aq, \'DB.DBA.RDF_GRAB_SINGLE_ASYNC\', vector (val, grabbed, grab_params, doc_limit));\n"
+"if (sa_preds is not null)\n"
+"{\n"
+"\n"
+"DB.DBA.RDF_GRAB_SEEALSO (val, null, sa_params);\n"
+"}\n"
 "}\n"
 "}\n"
 "commit work;\n"
@@ -14645,6 +16264,8 @@ static const char *proc358 =
 "{\n"
 "declare val any;\n"
 "declare dest varchar;\n"
+"if (dict_size (grabbed) >= doc_limit)\n"
+"goto final_exec;\n"
 "val := rset[rctr][colctr];\n"
 "if (is_named_iri_id (val) and __rgs_ack_cbk (val, uid, 4))\n"
 "{\n"
@@ -14653,6 +16274,13 @@ static const char *proc358 =
 "aq_request (aq, \'DB.DBA.RDF_GRAB_SINGLE_ASYNC\', vector (val, grabbed, grab_params, doc_limit));\n"
 "if (dict_size (grabbed) >= doc_limit)\n"
 "goto final_exec;\n"
+"if (sa_preds is not null)\n"
+"{\n"
+"\n"
+"DB.DBA.RDF_GRAB_SEEALSO (val, null, sa_params);\n"
+"}\n"
+"if (dict_size (grabbed) >= doc_limit)\n"
+"goto final_exec;\n"
 "}\n"
 "}\n"
 "}\n"
@@ -14662,8 +16290,11 @@ static const char *proc358 =
 "DB.DBA.RDF_FT_INDEX_GRABBED (grabbed, grab_params);\n"
 "commit work;\n"
 "if (old_doc_count = dict_size (grabbed))\n"
+"{\n"
+"\n"
 "goto final_exec;\n"
 "}\n"
+"}\n"
 "\n"
 "final_exec:\n"
 "stat := \'00000\';\n"
@@ -14677,9 +16308,10 @@ static const char *proc358 =
 "for (rctr := 0; rctr < rcount; rctr := rctr + 1)\n"
 "result (rset[rctr]);\n"
 "}\n"
-"--src rdf_sponge.sql:206\n";
+"--src rdf_sponge.sql:230\n";
 
-static const char *proc359 = 
+static const char *proc391 = 
+"#line 343 \"[executable]/rdf_sponge.sql\"\n"
 "create function DB.DBA.RDF_GRAB_RESOLVER_DEFAULT (in base varchar, in rel_uri varchar, out abs_uri varchar, out dest_uri varchar, out get_method varchar)\n"
 "{\n"
 "declare rel_lattice_pos, base_lattice_pos integer;\n"
@@ -14718,9 +16350,10 @@ static const char *proc359 =
 "get_method := \'GET\';\n"
 "\n"
 "}\n"
-"--src rdf_sponge.sql:298\n";
+"--src rdf_sponge.sql:341\n";
 
-static const char *proc360 = 
+static const char *proc392 = 
+"#line 388 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure DB.DBA.SPARQL_EVAL_TO_ARRAY (in query varchar, in dflt_graph varchar, in maxrows integer)\n"
 "{\n"
 "declare state, msg varchar;\n"
@@ -14738,9 +16371,10 @@ static const char *proc360 =
 "signal (state, msg);\n"
 "return rset;\n"
 "}\n"
-"--src rdf_sponge.sql:343\n";
+"--src rdf_sponge.sql:386\n";
 
-static const char *proc361 = 
+static const char *proc393 = 
+"#line 407 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure DB.DBA.SPARQL_EVAL (in query varchar, in dflt_graph varchar, in maxrows integer)\n"
 "{\n"
 "declare sqltext, state, msg varchar;\n"
@@ -14762,9 +16396,9 @@ static const char *proc361 =
 "exec_result (row);\n"
 "}\n"
 "}\n"
-"--src rdf_sponge.sql:362\n";
+"--src rdf_sponge.sql:405\n";
 
-static const char *tbl18 = 
+static const char *tbl19 = 
 "create table DB.DBA.SYS_HTTP_SPONGE (\n"
 "HS_LOCAL_IRI varchar not null,\n"
 "HS_PARSER varchar not null,\n"
@@ -14789,7 +16423,8 @@ static const char *tbl18 =
 "create index SYS_HTTP_SPONGE_EXPIRATION on DB.DBA.SYS_HTTP_SPONGE (HS_EXPIRATION desc) partition (HS_LOCAL_IRI varchar)\n"
 "create index SYS_HTTP_SPONGE_FROM_IRI on DB.DBA.SYS_HTTP_SPONGE (HS_FROM_IRI, HS_PARSER) partition (HS_FROM_IRI varchar)\n";
 
-static const char *proc362 = 
+static const char *proc394 = 
+"#line 465 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure DB.DBA.SYS_HTTP_SPONGE_GET_CACHE_PARAMS\n"
 "(\n"
 "in explicit_refresh any,\n"
@@ -14822,25 +16457,33 @@ static const char *proc362 =
 "ret_dt_date := http_string_date (ret_date, NULL, NULL);\n"
 "ret_dt_expires := http_string_date (ret_expires, NULL, now());\n"
 "ret_dt_last_modified := http_string_date (ret_last_modif, NULL, now());\n"
+"\n"
 "if (http_request_header (ret_hdr, \'Pragma\', null, null) = \'no-cache\' or\n"
 "http_request_header (ret_hdr, \'Cache-Control\', null, null) like \'no-cache%\' )\n"
 "ret_dt_expires := now ();\n"
+"\n"
 "if (ret_304_not_modified and ret_dt_last_modified is null)\n"
 "ret_dt_last_modified := old_last_modified;\n"
+"\n"
 "if (ret_dt_date is not null)\n"
 "{\n"
+"\n"
 "if (ret_dt_expires is not null)\n"
 "ret_dt_expires := dateadd (\'second\', datediff (\'second\', ret_dt_date, now()), ret_dt_expires);\n"
+"\n"
 "if (ret_dt_last_modified is not null)\n"
 "ret_dt_last_modified := dateadd (\'second\', datediff (\'second\', ret_dt_date, now()), ret_dt_last_modified);\n"
 "}\n"
+"\n"
 "if (ret_dt_expires is not null and\n"
 "(ret_dt_expires < coalesce (ret_dt_date, ret_dt_last_modified, now ())) )\n"
 "ret_dt_expires := NULL;\n"
+"\n"
 "if (ret_dt_expires is not null)\n"
 "new_expiration := ret_dt_expires;\n"
 "else\n"
 "{\n"
+"\n"
 "if (ret_dt_date is not null and ret_dt_last_modified is not null and (ret_dt_date >= ret_dt_last_modified))\n"
 "new_expiration := dateadd (\'second\',\n"
 "__min (\n"
@@ -14851,16 +16494,19 @@ static const char *proc362 =
 "}\n"
 "if (ret_304_not_modified)\n"
 "{\n"
+"\n"
 "if (new_expiration is null and explicit_refresh is not null)\n"
 "new_expiration := dateadd (\'second\', 0.7 * explicit_refresh, now());\n"
 "\n"
+"\n"
 "if (ret_dt_expires is null and new_expiration is not null and explicit_refresh is not null)\n"
 "new_expiration := __min (new_expiration, dateadd (\'second\', explicit_refresh, now()));\n"
 "}\n"
 "}\n"
-"--src rdf_sponge.sql:420\n";
+"--src rdf_sponge.sql:463\n";
 
-static const char *proc363 = 
+static const char *proc395 = 
+"#line 548 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure DB.DBA.SYS_HTTP_SPONGE_DEP_URL_NOT_CHANGED (in local_iri varchar, in parser varchar, in explicit_refresh int)\n"
 "{\n"
 "\n"
@@ -14905,9 +16551,10 @@ static const char *proc363 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src rdf_sponge.sql:493\n";
+"--src rdf_sponge.sql:546\n";
 
-static const char *proc364 = 
+static const char *proc396 = 
+"#line 594 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure DB.DBA.RDF_HTTP_MAKE_HTTP_REQ (in url varchar, in meth varchar, in req varchar)\n"
 "{\n"
 "declare hf any;\n"
@@ -14920,9 +16567,10 @@ static const char *proc364 =
 "str := replace (str, \'\\n\\n\', \'\\n\');\n"
 "return split_and_decode (str, 0, \'\\0\\0\\n\');\n"
 "}\n"
-"--src rdf_sponge.sql:539\n";
+"--src rdf_sponge.sql:592\n";
 
-static const char *proc365 = 
+static const char *proc397 = 
+"#line 608 \"[executable]/rdf_sponge.sql\"\n"
 "create function DB.DBA.SYS_HTTP_SPONGE_UP (in local_iri varchar, in get_uri varchar, in parser varchar, in eraser varchar, in options any)\n"
 "{\n"
 "declare new_origin_uri, new_origin_login, new_last_etag varchar;\n"
@@ -14937,9 +16585,10 @@ static const char *proc365 =
 "declare req_hdr varchar;\n"
 "declare ret_body, ret_content_type, ret_etag, ret_last_modified, ret_date, ret_last_modif, ret_expires varchar;\n"
 "declare get_proxy varchar;\n"
-"declare ret_dt_date, ret_dt_last_modified, ret_dt_expires datetime;\n"
+"declare ret_dt_date, ret_dt_last_modified, ret_dt_expires, expiration, min_expiration datetime;\n"
 "declare ret_304_not_modified integer;\n"
 "declare parser_rc, max_refresh int;\n"
+"declare stat, msg varchar;\n"
 "\n"
 "\n"
 "new_origin_uri := cast (get_keyword_ucase (\'get:uri\', options, get_uri) as varchar);\n"
@@ -14957,6 +16606,9 @@ static const char *proc365 =
 "}\n"
 "else if (isstring (explicit_refresh))\n"
 "explicit_refresh := atoi (explicit_refresh);\n"
+"min_expiration := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'MinExpiration\'), \'-1\'));\n"
+"if (min_expiration < 0)\n"
+"min_expiration := null;\n"
 "set isolation=\'serializable\';\n"
 "whenever not found goto add_new_origin;\n"
 "select HS_ORIGIN_URI, HS_ORIGIN_LOGIN, HS_LAST_LOAD, HS_LAST_ETAG,\n"
@@ -15096,6 +16748,19 @@ static const char *proc365 =
 "ret_304_not_modified := 1;\n"
 "goto resp_received;\n"
 "}\n"
+"if (ret_hdr[0] like \'HTTP/1._ 5__ %\' or ret_hdr[0] like \'HTTP/1._ 4__ %\')\n"
+"{\n"
+"rollback work;\n"
+"update DB.DBA.SYS_HTTP_SPONGE\n"
+"set HS_SQL_STATE = \'RDFXX\',\n"
+"HS_SQL_MESSAGE = sprintf (\'Unable to retrieve RDF data from \"%.500s\": %.500s\', new_origin_uri, ret_hdr[0]),\n"
+"HS_EXPIRATION = now (),\n"
+"HS_EXP_IS_TRUE = 0\n"
+"where\n"
+"HS_LOCAL_IRI = local_iri and HS_PARSER = parser;\n"
+"commit work;\n"
+"signal (\'RDFXX\', sprintf (\'Unable to retrieve RDF data from \"%.500s\": %.500s\', new_origin_uri, ret_hdr[0]));\n"
+"}\n"
 "goto resp_received;\n"
 "}\n"
 "if (eraser is not null)\n"
@@ -15174,11 +16839,14 @@ static const char *proc365 =
 "new_expiration := dateadd (\'second\', load_end_msec - load_begin_msec, now());\n"
 "if (ret_dt_expires is null and explicit_refresh is not null)\n"
 "new_expiration := __min (new_expiration, dateadd (\'second\', 0.7 * explicit_refresh, now()));\n"
+"expiration := coalesce (ret_dt_expires, new_expiration, now());\n"
+"if (explicit_refresh is null and min_expiration is not null)\n"
+"expiration := __max (dateadd (\'second\', min_expiration, now()), expiration);\n"
 "commit work;\n"
 "update DB.DBA.SYS_HTTP_SPONGE\n"
 "set HS_LAST_LOAD = now(), HS_LAST_ETAG = new_last_etag, HS_LAST_READ = now(),\n"
 "HS_EXP_IS_TRUE = case (isnull (ret_dt_expires)) when 1 then 0 else 1 end,\n"
-"HS_EXPIRATION = coalesce (ret_dt_expires, new_expiration, now()),\n"
+"HS_EXPIRATION = expiration,\n"
 "HS_LAST_MODIFIED = ret_dt_last_modified,\n"
 "HS_DOWNLOAD_SIZE = new_download_size,\n"
 "HS_DOWNLOAD_MSEC_TIME = load_end_msec - load_begin_msec,\n"
@@ -15193,7 +16861,8 @@ static const char *proc365 =
 "error_during_load:\n"
 "rollback work;\n"
 "\n"
-"\n"
+"stat := __SQL_STATE;\n"
+"msg := __SQL_MESSAGE;\n"
 "load_end_msec := msec_time();\n"
 "if (new_expiration is null)\n"
 "new_expiration := dateadd (\'second\', load_end_msec - load_begin_msec, now());\n"
@@ -15201,18 +16870,22 @@ static const char *proc365 =
 "new_expiration := __min (new_expiration, dateadd (\'second\', 0.7 * explicit_refresh, now()));\n"
 "\n"
 "update DB.DBA.SYS_HTTP_SPONGE\n"
-"set HS_SQL_STATE = __SQL_STATE,\n"
-"HS_SQL_MESSAGE = __SQL_MESSAGE,\n"
+"set HS_SQL_STATE = stat,\n"
+"HS_SQL_MESSAGE = msg,\n"
 "HS_EXPIRATION = coalesce (ret_dt_expires, new_expiration, now()),\n"
 "HS_EXP_IS_TRUE = case (isnull (ret_dt_expires)) when 1 then 0 else 1 end\n"
 "where\n"
 "HS_LOCAL_IRI = local_iri and HS_PARSER = parser;\n"
 "commit work;\n"
+"\n"
+"if (get_keyword_ucase (\'get:error-recovery\', options) is not null)\n"
+"signal (stat, msg);\n"
 "return local_iri;\n"
 "}\n"
-"--src rdf_sponge.sql:553\n";
+"--src rdf_sponge.sql:606\n";
 
-static const char *proc366 = 
+static const char *proc398 = 
+"#line 923 \"[executable]/rdf_sponge.sql\"\n"
 "create function DB.DBA.SYS_FILE_SPONGE_UP (in local_iri varchar, in get_uri varchar, in parser varchar, in eraser varchar, in options any)\n"
 "{\n"
 "declare new_origin_uri, str, base_uri, mime_type, dummy, tmp any;\n"
@@ -15232,9 +16905,10 @@ static const char *proc366 =
 "DB.DBA.RDF_LOAD_HTTP_RESPONSE (local_iri, new_origin_uri, mime_type, tmp, str, options, dummy);\n"
 "return local_iri;\n"
 "}\n"
-"--src rdf_sponge.sql:844\n";
+"--src rdf_sponge.sql:921\n";
 
-static const char *proc367 = 
+static const char *proc399 = 
+"#line 945 \"[executable]/rdf_sponge.sql\"\n"
 "create function DB.DBA.RDF_SPONGE_GUESS_CONTENT_TYPE (in origin_uri varchar, in ret_content_type varchar, inout ret_body any) returns varchar\n"
 "{\n"
 "if (ret_content_type is not null)\n"
@@ -15254,7 +16928,7 @@ static const char *proc367 =
 "return \'text/rdf+n3\';\n"
 "}\n"
 "declare ret_begin, ret_html any;\n"
-"ret_begin := subseq (ret_body, 0, 1024);\n"
+"ret_begin := subseq (ret_body, 0, 4096);\n"
 "ret_html := xtree_doc (ret_begin, 2);\n"
 "if (xpath_eval (\'/html|/xhtml\', ret_html) is not null)\n"
 "return \'text/html\';\n"
@@ -15293,9 +16967,9 @@ static const char *proc367 =
 "}\n"
 "return ret_content_type;\n"
 "}\n"
-"--src rdf_sponge.sql:866\n";
+"--src rdf_sponge.sql:943\n";
 
-static const char *tbl19 = 
+static const char *tbl20 = 
 "create table DB.DBA.SYS_RDF_MAPPERS (\n"
 "RM_ID integer identity,\n"
 "RM_PATTERN varchar,\n"
@@ -15311,7 +16985,8 @@ static const char *tbl19 =
 "create index SYS_RDF_MAPPERS_I1 on DB.DBA.SYS_RDF_MAPPERS (RM_ID) partition cluster replicated\n"
 "create index SYS_RDF_MAPPERS_I2 on DB.DBA.SYS_RDF_MAPPERS (RM_PID) partition cluster replicated\n";
 
-static const char *proc368 = 
+static const char *proc400 = 
+"#line 1056 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure DB.DBA.RDF_HTTP_URL_GET (inout url any, in base any, inout hdr any,\n"
 "in meth any := \'GET\', in req_hdr varchar := null, in cnt any := null, in proxy any := null, in sig int := 1)\n"
 "{\n"
@@ -15360,9 +17035,10 @@ static const char *proc368 =
 "\n"
 "return content;\n"
 "}\n"
-"--src rdf_sponge.sql:977\n";
+"--src rdf_sponge.sql:1054\n";
 
-static const char *proc369 = 
+static const char *proc401 = 
+"#line 1107 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure DB.DBA.RDF_SW_PING (in endp varchar, in url varchar)\n"
 "{\n"
 "declare rc any;\n"
@@ -15402,20 +17078,22 @@ static const char *proc369 =
 "commit work;\n"
 "return;\n"
 "}\n"
-"--src rdf_sponge.sql:1028\n";
+"--src rdf_sponge.sql:1105\n";
 
-static const char *proc370 = 
+static const char *proc402 = 
+"#line 1148 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure DB.DBA.RDF_PROC_COLS (in pname varchar)\n"
 "{\n"
 "set_user_id (\'dba\', 1);\n"
 "return procedure_cols (pname);\n"
 "}\n"
-"--src rdf_sponge.sql:1069\n";
+"--src rdf_sponge.sql:1146\n";
 
-static const char *proc371 = 
+static const char *proc403 = 
+"#line 1156 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure DB.DBA.RDF_LOAD_HTTP_RESPONSE (in graph_iri varchar, in new_origin_uri varchar, inout ret_content_type varchar, inout ret_hdr any, inout ret_body any, inout options any, inout req_hdr_arr any)\n"
 "{\n"
-"declare dest, groupdest, cset varchar;\n"
+"declare dest, groupdest, cset, base, first_stat, first_msg varchar;\n"
 "declare rc any;\n"
 "declare aq, ps any;\n"
 "declare xd, xt any;\n"
@@ -15432,28 +17110,31 @@ static const char *proc371 =
 "\n"
 "dest := get_keyword_ucase (\'get:destination\', options);\n"
 "groupdest := get_keyword_ucase (\'get:group-destination\', options);\n"
+"base := get_keyword (\'http-redirect-to\', options, new_origin_uri);\n"
 "if (get_keyword_ucase (\'get:strategy\', options, \'default\') = \'rdfa-only\')\n"
 "only_rdfa := 1;\n"
 "else\n"
 "only_rdfa := 0;\n"
 "if (strstr (ret_content_type, \'application/sparql-results+xml\') is not null)\n"
 "signal (\'RDFXX\', sprintf (\'Unable to load RDF graph <%.500s> from <%.500s>: the sparql-results XML answer does not contain triples\', graph_iri, new_origin_uri));\n"
+"if (get_keyword (\'http-headers\', options) is null)\n"
+"options := vector_concat (options, vector (\'http-headers\', vector (req_hdr_arr, ret_hdr)));\n"
 "if (strstr (ret_content_type, \'application/rdf+xml\') is not null)\n"
 "{\n"
 "\n"
 "\n"
 "whenever sqlstate \'*\' goto load_grddl;\n"
-"log_enable (2, 1);\n"
+"\n"
 "xt := xtree_doc (ret_body);\n"
 "\n"
 "if (xpath_eval (\'[ xmlns:dv=\"http://www.w3.org/2003/g/data-view#\" ] /*[1]/@dv:transformation\', xt) is not null)\n"
 "goto load_grddl;\n"
-"DB.DBA.RDF_LOAD_RDFXML (ret_body, new_origin_uri, coalesce (dest, graph_iri));\n"
+"DB.DBA.RDF_LOAD_RDFXML (ret_body, base, coalesce (dest, graph_iri));\n"
 "if (groupdest is not null)\n"
-"DB.DBA.RDF_LOAD_RDFXML (ret_body, new_origin_uri, groupdest);\n"
+"DB.DBA.RDF_LOAD_RDFXML (ret_body, base, groupdest);\n"
 "if (__proc_exists (\'DB.DBA.RDF_LOAD_POST_PROCESS\') and only_rdfa = 0)\n"
 "call (\'DB.DBA.RDF_LOAD_POST_PROCESS\') (graph_iri, new_origin_uri, dest, ret_body, ret_content_type, options);\n"
-"log_enable (saved_log_mode, 1);\n"
+"\n"
 "if (aq is not null)\n"
 "aq_request (aq, \'DB.DBA.RDF_SW_PING\', vector (ps, new_origin_uri));\n"
 "return 1;\n"
@@ -15469,16 +17150,16 @@ static const char *proc371 =
 "strstr (ret_content_type, \'application/turtle\') is not null or\n"
 "strstr (ret_content_type, \'application/x-turtle\') is not null )\n"
 "{\n"
-"whenever sqlstate \'*\' goto load_grddl;\n"
-"log_enable (2, 1);\n"
+"whenever sqlstate \'*\' goto load_grddl_after_error;\n"
 "\n"
 "\n"
-"DB.DBA.TTLP (ret_body, new_origin_uri, coalesce (dest, graph_iri), 255);\n"
+"\n"
+"DB.DBA.TTLP (ret_body, base, coalesce (dest, graph_iri), 255);\n"
 "if (groupdest is not null)\n"
-"DB.DBA.TTLP (ret_body, new_origin_uri, groupdest);\n"
+"DB.DBA.TTLP (ret_body, base, groupdest);\n"
 "if (__proc_exists (\'DB.DBA.RDF_LOAD_POST_PROCESS\') and only_rdfa = 0)\n"
 "call (\'DB.DBA.RDF_LOAD_POST_PROCESS\') (graph_iri, new_origin_uri, dest, ret_body, ret_content_type, options);\n"
-"log_enable (saved_log_mode, 1);\n"
+"\n"
 "if (aq is not null)\n"
 "aq_request (aq, \'DB.DBA.RDF_SW_PING\', vector (ps, new_origin_uri));\n"
 "return 1;\n"
@@ -15486,11 +17167,11 @@ static const char *proc371 =
 "else if (only_rdfa = 1 and strstr (ret_content_type, \'text/html\') is not null)\n"
 "{\n"
 "whenever sqlstate \'*\' goto load_grddl;\n"
-"log_enable (2, 1);\n"
-"DB.DBA.RDF_LOAD_RDFA (ret_body, new_origin_uri, coalesce (dest, graph_iri), 2);\n"
+"\n"
+"DB.DBA.RDF_LOAD_RDFA (ret_body, base, coalesce (dest, graph_iri), 2);\n"
 "if (groupdest is not null and groupdest <> coalesce (dest, graph_iri))\n"
-"DB.DBA.RDF_LOAD_RDFA (ret_body, new_origin_uri, groupdest, 2);\n"
-"log_enable (saved_log_mode, 1);\n"
+"DB.DBA.RDF_LOAD_RDFA (ret_body, base, groupdest, 2);\n"
+"\n"
 "if (aq is not null)\n"
 "aq_request (aq, \'DB.DBA.RDF_SW_PING\', vector (ps, new_origin_uri));\n"
 "return 1;\n"
@@ -15587,39 +17268,70 @@ static const char *proc371 =
 "}\n"
 "if (strstr (ret_content_type, \'text/plain\') is not null)\n"
 "{\n"
+"\n"
 "signal (\'RDFXX\', sprintf (\n"
-"\'Unable to load RDF graph <%.500s> from <%.500s>: returned Content-Type \'\'%.300s\'\' status \'\'%.300s\'\'\\n%.500s\',\n"
-"graph_iri, new_origin_uri, ret_content_type, ret_hdr[0], subseq (ret_body, 0, 500) ) );\n"
+"\'Unable to load RDF graph <%.500s> from <%.500s>: returned Content-Type \'\'%.300s\'\' status \'\'%.300s\'\' body %.300s\',\n"
+"graph_iri, new_origin_uri, ret_content_type, ret_hdr[0], subseq (ret_body, 0, 300) ) );\n"
 "}\n"
 "if (strstr (ret_content_type, \'text/html\') is not null)\n"
 "{\n"
+"\n"
 "signal (\'RDFZZ\', sprintf (\n"
-"\'Unable to load RDF graph <%.500s> from <%.500s>: returned Content-Type \'\'%.300s\'\' status \'\'%.300s\'\'\\n%.500s\',\n"
+"\'Unable to load RDF graph <%.500s> from <%.500s>: returned Content-Type \'\'%.300s\'\' status \'\'%.300s\'\'\\n%.300s\',\n"
 "graph_iri, new_origin_uri, ret_content_type, ret_hdr[0],\n"
 "\n"
-"subseq (ret_body, 0, 500)\n"
-") );\n"
+"subseq (ret_body, 0, 300) ) );\n"
+"}\n"
+"if (isstring (first_stat))\n"
+"{\n"
+"\n"
+"signal (\'RDFZZ\', sprintf (\n"
+"\'Unable to load RDF graph <%.200s> from <%.200s> with Content-Type \'\'%.50s\'\': %.6s: %.1000s\',\n"
+"graph_iri, new_origin_uri, ret_content_type, first_stat, first_msg ) );\n"
 "}\n"
+"\n"
 "signal (\'RDFZZ\', sprintf (\n"
 "\'Unable to load RDF graph <%.500s> from <%.500s>: returned unsupported Content-Type \'\'%.300s\'\'\',\n"
 "graph_iri, new_origin_uri, ret_content_type ) );\n"
 "resignal_parse_error:\n"
-"log_enable (saved_log_mode, 1);\n"
+"\n"
+"\n"
 "resignal;\n"
+"\n"
+"load_grddl_after_error:\n"
+"first_stat := __SQL_STATE;\n"
+"first_msg := __SQL_MESSAGE;\n"
+"goto load_grddl;\n"
 "}\n"
-"--src rdf_sponge.sql:1077\n";
+"--src rdf_sponge.sql:1154\n";
 
-static const char *proc372 = 
+static const char *proc404 = 
+"#line 1370 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure DB.DBA.RDF_FORGET_HTTP_RESPONSE (in graph_iri varchar, in new_origin_uri varchar, inout options any)\n"
 "{\n"
 "declare dest varchar;\n"
+"declare deadl int;\n"
+"deadl := atoi (coalesce (cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'MaxDeadlockRetries\'), \'5\'));\n"
+"declare exit handler for sqlstate \'40001\'\n"
+"{\n"
+"deadl := deadl - 1;\n"
+"rollback work;\n"
+"if (deadl > 0)\n"
+"{\n"
+"delay (0.2);\n"
+"goto again;\n"
+"}\n"
+"resignal;\n"
+"};\n"
+"again:\n"
 "dest := get_keyword_ucase (\'get:destination\', options);\n"
 "if (dest is null)\n"
 "DB.DBA.SPARUL_CLEAR (graph_iri, 1, 0);\n"
 "}\n"
-"--src rdf_sponge.sql:1273\n";
+"--src rdf_sponge.sql:1368\n";
 
-static const char *proc373 = 
+static const char *proc405 = 
+"#line 1393 \"[executable]/rdf_sponge.sql\"\n"
 "create function DB.DBA.RDF_SPONGE_UP (in graph_iri varchar, in options any, in uid integer := -1)\n"
 "{\n"
 "declare aq, cookie varchar;\n"
@@ -15630,7 +17342,7 @@ static const char *proc373 =
 "return DB.DBA.RDF_SPONGE_UP_1 (graph_iri, options, uid);\n"
 "}\n"
 "commit work;\n"
-"set_user_id (\'dba\', 1);\n"
+"\n"
 "cookie := connection_get (\'__rdf_sponge_sid\');\n"
 "if (cookie is not null)\n"
 "options := vector_concat (options, vector (\'rdf_sponge_sid\', cookie));\n"
@@ -15638,6 +17350,7 @@ static const char *proc373 =
 "options := vector_concat (options, vector (\'rdf_sponge_debug\', connection_get (\'__rdf_sponge_debug\')));\n"
 "if (is_http_ctx ())\n"
 "options := vector_concat (options, vector (\'http_host\', http_request_header(http_request_header (), \'Host\', null, null)));\n"
+"options := vector_concat (options, vector (\'__rdf_sponge_log_mode\', log_enable (null, 1)));\n"
 "aq := async_queue (1);\n"
 "aq_request (aq, \'DB.DBA.RDF_SPONGE_UP_1\', vector (graph_iri, options, uid));\n"
 "commit work;\n"
@@ -15651,16 +17364,17 @@ static const char *proc373 =
 "local_iri := graph_iri;\n"
 "return local_iri;\n"
 "}\n"
-"--src rdf_sponge.sql:1282\n";
+"--src rdf_sponge.sql:1391\n";
 
-static const char *proc374 = 
+static const char *proc406 = 
+"#line 1427 \"[executable]/rdf_sponge.sql\"\n"
 "create function DB.DBA.RDF_SPONGE_UP_1 (in graph_iri varchar, in options any, in uid integer := -1)\n"
 "{\n"
 "declare dest, get_soft, local_iri, immg, res_graph_iri, cookie varchar;\n"
-"declare perms integer;\n"
+"declare perms, log_mode integer;\n"
 "\n"
 "graph_iri := cast (graph_iri as varchar);\n"
-"set_user_id (\'dba\', 1);\n"
+"\n"
 "dest := get_keyword_ucase (\'get:destination\', options);\n"
 "if (dest is not null)\n"
 "local_iri := \'destMD5=\' || md5(dest) || \'&graphMD5=\' || md5(graph_iri);\n"
@@ -15673,12 +17387,15 @@ static const char *proc374 =
 "connection_set (\'__rdf_sponge_debug\', get_keyword (\'rdf_sponge_debug\', options));\n"
 "if (get_keyword (\'http_host\', options) is not null)\n"
 "connection_set (\'__http_host\', get_keyword (\'http_host\', options));\n"
+"log_mode := get_keyword (\'__rdf_sponge_log_mode\', options);\n"
+"if (log_mode is not null)\n"
+"log_enable (log_mode, 1);\n"
 "\n"
 "perms := DB.DBA.RDF_GRAPH_USER_PERMS_GET (dest, case (uid) when -1 then http_nobody_uid() else uid end);\n"
 "get_soft := get_keyword_ucase (\'get:soft\', options);\n"
 "if (\'soft\' = get_soft)\n"
 "{\n"
-"if ((dest = graph_iri) and exists (select 1 from DB.DBA.RDF_QUAD where G = iri_to_id (graph_iri, 0) ) and\n"
+"if ((dest = graph_iri) and exists (select 1 from DB.DBA.RDF_QUAD table option (index RDF_QUAD_GS) where G = iri_to_id (graph_iri, 0) ) and\n"
 "not exists (select 1 from DB.DBA.SYS_HTTP_SPONGE\n"
 "where HS_LOCAL_IRI = local_iri and HS_PARSER = \'DB.DBA.RDF_LOAD_HTTP_RESPONSE\' and\n"
 "HS_EXPIRATION is not null))\n"
@@ -15712,7 +17429,7 @@ static const char *proc374 =
 "\n"
 "\n"
 "immg := cfg_item_value (virtuoso_ini_path (), \'SPARQL\', \'ImmutableGraphs\');\n"
-"if (immg is not null)\n"
+"if (immg is not null and user <> \'dba\')\n"
 "{\n"
 "immg := split_and_decode (immg, 0, \'\\0\\0,\');\n"
 "foreach (any imm in immg) do\n"
@@ -15724,9 +17441,22 @@ static const char *proc374 =
 "\n"
 "goto graph_is_ready;\n"
 "}\n"
+"if (imm = \'inference-graphs\' and exists (select 1 from DB.DBA.SYS_RDF_SCHEMA where RS_URI = dest))\n"
+"{\n"
+"res_graph_iri := dest;\n"
+"\n"
+"goto graph_is_ready;\n"
+"}\n"
+"\n"
+"if (dest like imm)\n"
+"{\n"
+"res_graph_iri := local_iri;\n"
+"goto graph_is_ready;\n"
+"}\n"
 "}\n"
 "}\n"
 "\n"
+"set_user_id (\'dba\', 1);\n"
 "if (lower (graph_iri) like \'file:%\')\n"
 "{\n"
 "res_graph_iri := DB.DBA.SYS_FILE_SPONGE_UP (local_iri, graph_iri, null, \'DB.DBA.RDF_FORGET_HTTP_RESPONSE\', options);\n"
@@ -15761,9 +17491,10 @@ static const char *proc374 =
 "VT_INC_INDEX_DB_DBA_RDF_OBJ();\n"
 "return res_graph_iri;\n"
 "}\n"
-"--src rdf_sponge.sql:1315\n";
+"--src rdf_sponge.sql:1425\n";
 
-static const char *proc375 = 
+static const char *proc407 = 
+"#line 1552 \"[executable]/rdf_sponge.sql\"\n"
 "create function DB.DBA.RDF_SPONGE_UP_LIST (in sources any)\n"
 "{\n"
 "declare need_reindex integer;\n"
@@ -15782,9 +17513,10 @@ static const char *proc375 =
 "VT_INC_INDEX_DB_DBA_RDF_OBJ();\n"
 "return 1;\n"
 "}\n"
-"--src rdf_sponge.sql:1424\n";
+"--src rdf_sponge.sql:1550\n";
 
-static const char *proc376 = 
+static const char *proc408 = 
+"#line 1573 \"[executable]/rdf_sponge.sql\"\n"
 "create procedure DB.DBA.RDF_GRANT_SPONGE ()\n"
 "{\n"
 "declare state, msg varchar;\n"
@@ -15807,14 +17539,15 @@ static const char *proc376 =
 "exec (cmd, state, msg);\n"
 "}\n"
 "}\n"
-"--src rdf_sponge.sql:1445\n";
+"--src rdf_sponge.sql:1571\n";
 
 
-static const char *other40 = 
+static const char *other44 = 
 " DB.DBA.RDF_GRANT_SPONGE ()\n";
 /* rdf_schema_objects.sql */
 
-static const char *proc377 = 
+static const char *proc409 = 
+"#line 31 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure rdf_view_tbl_opts (in tbls any, in cols any)\n"
 "{\n"
 "declare res any;\n"
@@ -15850,9 +17583,10 @@ static const char *proc377 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src rdf_schema_objects.sql:30\n";
+"--src rdf_schema_objects.sql:29\n";
 
-static const char *proc378 = 
+static const char *proc410 = 
+"#line 68 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure rdf_view_tbl_pk_cols (inout tbls any, out pkcols any)\n"
 "{\n"
 "declare i, l, mixed int;\n"
@@ -15907,9 +17641,10 @@ static const char *proc378 =
 "signal (\'22023\', sprintf (\'Non existing table %s\', t));\n"
 "}\n"
 "}\n"
-"--src rdf_schema_objects.sql:67\n";
+"--src rdf_schema_objects.sql:66\n";
 
-static const char *proc379 = 
+static const char *proc411 = 
+"#line 124 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure rdf_view_ns_get (in cols any, in f int)\n"
 "{\n"
 "declare ses, dict, nss any;\n"
@@ -15931,9 +17666,10 @@ static const char *proc379 =
 "}\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src rdf_schema_objects.sql:123\n";
+"--src rdf_schema_objects.sql:122\n";
 
-static const char *proc380 = 
+static const char *proc412 = 
+"#line 147 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure rdf_view_ns_get_1 (in cols any, inout dict any)\n"
 "{\n"
 "declare class any;\n"
@@ -15955,9 +17691,10 @@ static const char *proc380 =
 "dict_put (dict, ns, uri);\n"
 "}\n"
 "}\n"
-"--src rdf_schema_objects.sql:146\n";
+"--src rdf_schema_objects.sql:145\n";
 
-static const char *proc381 = 
+static const char *proc413 = 
+"#line 170 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "RDF_VIEW_DROP_STMT (in qualifier varchar)\n"
 "{\n"
@@ -15977,9 +17714,10 @@ static const char *proc381 =
 "}\n"
 "return drop_map;\n"
 "}\n"
-"--src rdf_schema_objects.sql:169\n";
+"--src rdf_schema_objects.sql:168\n";
 
-static const char *proc382 = 
+static const char *proc414 = 
+"#line 191 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "RDF_VIEW_FROM_TBL (in qualifier varchar, in _tbls any, in gen_stat int := 0, in cols any := null)\n"
 "{\n"
@@ -16073,17 +17811,19 @@ static const char *proc382 =
 "\n"
 "return create_class_stmt || \'\\n\\n\' || create_count_count || create_view_stmt;\n"
 "}\n"
-"--src rdf_schema_objects.sql:190\n";
+"--src rdf_schema_objects.sql:189\n";
 
-static const char *proc383 = 
+static const char *proc415 = 
+"#line 286 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_sp (in i int)\n"
 "{\n"
 "return repeat (\' \', i);\n"
 "}\n"
-"--src rdf_schema_objects.sql:285\n";
+"--src rdf_schema_objects.sql:284\n";
 
-static const char *proc384 = 
+static const char *proc416 = 
+"#line 293 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure rdf_view_sql_tb (in tb varchar)\n"
 "{\n"
 "declare q, o, n varchar;\n"
@@ -16092,9 +17832,10 @@ static const char *proc384 =
 "n := name_part (tb, 2);\n"
 "return sprintf (\'\"%I\".\"%I\".\"%I\"\', q, o, n);\n"
 "}\n"
-"--src rdf_schema_objects.sql:292\n";
+"--src rdf_schema_objects.sql:291\n";
 
-static const char *proc385 = 
+static const char *proc417 = 
+"#line 303 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure rdf_view_tb (in tb varchar)\n"
 "{\n"
 "declare r varchar;\n"
@@ -16102,16 +17843,18 @@ static const char *proc385 =
 "r := lower (r);\n"
 "return r;\n"
 "}\n"
-"--src rdf_schema_objects.sql:302\n";
+"--src rdf_schema_objects.sql:301\n";
 
-static const char *proc386 = 
+static const char *proc418 = 
+"#line 312 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure rdf_view_sql_col (in col varchar)\n"
 "{\n"
 "return sprintf (\'\"%I\"\', col);\n"
 "}\n"
-"--src rdf_schema_objects.sql:311\n";
+"--src rdf_schema_objects.sql:310\n";
 
-static const char *proc387 = 
+static const char *proc419 = 
+"#line 318 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure rdf_view_col (in col varchar)\n"
 "{\n"
 "declare r varchar;\n"
@@ -16119,17 +17862,19 @@ static const char *proc387 =
 "r := lower (r);\n"
 "return r;\n"
 "}\n"
-"--src rdf_schema_objects.sql:317\n";
+"--src rdf_schema_objects.sql:316\n";
 
-static const char *proc388 = 
+static const char *proc420 = 
+"#line 327 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure rdf_view_cls_name (in nam varchar)\n"
 "{\n"
 "\n"
 "return SYS_ALFANUM_NAME (nam);\n"
 "}\n"
-"--src rdf_schema_objects.sql:326\n";
+"--src rdf_schema_objects.sql:325\n";
 
-static const char *proc389 = 
+static const char *proc421 = 
+"#line 334 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure rdf_view_get_ns (in uri varchar, out uriSearch varchar)\n"
 "{\n"
 "declare delim integer;\n"
@@ -16171,9 +17916,10 @@ static const char *proc389 =
 "}\n"
 "return nsPrefix;\n"
 "}\n"
-"--src rdf_schema_objects.sql:333\n";
+"--src rdf_schema_objects.sql:332\n";
 
-static const char *proc390 = 
+static const char *proc422 = 
+"#line 377 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure rdf_view_uri_curie (in uri varchar)\n"
 "{\n"
 "declare delim integer;\n"
@@ -16202,9 +17948,10 @@ static const char *proc390 =
 "}\n"
 "return uri;\n"
 "}\n"
-"--src rdf_schema_objects.sql:376\n";
+"--src rdf_schema_objects.sql:375\n";
 
-static const char *proc391 = 
+static const char *proc423 = 
+"#line 407 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure rdf_view_col_type (in qual varchar, in col varchar, in opts any)\n"
 "{\n"
 "if (not length (opts))\n"
@@ -16212,9 +17959,10 @@ static const char *proc391 =
 "else\n"
 "return rdf_view_uri_curie (opts);\n"
 "}\n"
-"--src rdf_schema_objects.sql:406\n";
+"--src rdf_schema_objects.sql:405\n";
 
-static const char *proc392 = 
+static const char *proc424 = 
+"#line 416 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_create_view (in nth int, in qualifier varchar, in _tbls any, in gen_stat int := 0, in cols any, in pkcols any)\n"
 "{\n"
@@ -16303,9 +18051,10 @@ static const char *proc392 =
 "ret := ret || \'    }\\n }\\n\';\n"
 "return ret;\n"
 "}\n"
-"--src rdf_schema_objects.sql:415\n";
+"--src rdf_schema_objects.sql:414\n";
 
-static const char *proc393 = 
+static const char *proc425 = 
+"#line 506 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_create_void_view (in qualifier varchar, in _tbls any, in gen_stat int := 0, in cols any, in pkcols any)\n"
 "{\n"
@@ -16362,9 +18111,10 @@ static const char *proc393 =
 "ret := ret || \'    }\\n }\';\n"
 "return ret;\n"
 "}\n"
-"--src rdf_schema_objects.sql:505\n";
+"--src rdf_schema_objects.sql:504\n";
 
-static const char *proc394 = 
+static const char *proc426 = 
+"#line 564 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_get_pk_rel (in pref varchar, in suffix varchar, inout tbl varchar, in set_tb int, in  pkcols any)\n"
 "{\n"
@@ -16385,9 +18135,10 @@ static const char *proc394 =
 "tbl := tbl_name_l;\n"
 "return ret;\n"
 "}\n"
-"--src rdf_schema_objects.sql:563\n";
+"--src rdf_schema_objects.sql:562\n";
 
-static const char *proc395 = 
+static const char *proc427 = 
+"#line 586 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_get_bin_rel (in pref varchar, in suffix varchar, in tbl varchar, in col_name varchar, in pkcols any)\n"
 "{\n"
@@ -16406,9 +18157,10 @@ static const char *proc395 =
 "ret := sprintf (\'%s:%s_%s (%s) \', pref, rdf_view_tb (tbl_name_l), col_name, pk_text);\n"
 "return ret;\n"
 "}\n"
-"--src rdf_schema_objects.sql:585\n";
+"--src rdf_schema_objects.sql:584\n";
 
-static const char *proc396 = 
+static const char *proc428 = 
+"#line 606 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_get_fk_pk_rel (in pref varchar, in suffix varchar, in tbl varchar, in tbls any, in pkcols any)\n"
 "{\n"
@@ -16429,9 +18181,10 @@ static const char *proc396 =
 "}\n"
 "return string_output_string (ret);\n"
 "}\n"
-"--src rdf_schema_objects.sql:605\n";
+"--src rdf_schema_objects.sql:604\n";
 
-static const char *proc397 = 
+static const char *proc429 = 
+"#line 628 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_get_pk_fk_rel (in pref varchar, in suffix varchar, in tbl varchar, in tbls any, in pkcols any)\n"
 "{\n"
@@ -16452,9 +18205,10 @@ static const char *proc397 =
 "}\n"
 "return string_output_string (ret);\n"
 "}\n"
-"--src rdf_schema_objects.sql:627\n";
+"--src rdf_schema_objects.sql:626\n";
 
-static const char *proc398 = 
+static const char *proc430 = 
+"#line 650 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_dv_to_printf_str_type (in _dv varchar, in sc int)\n"
 "{\n"
@@ -16470,9 +18224,10 @@ static const char *proc398 =
 "else if (__tag of datetime = _dv or __tag of timestamp = _dv) return \'%1D\';\n"
 "signal (\'42000\', sprintf (\'The current implementation do no supports data type %s (%i) for IRI classes\', dv_type_title (_dv), _dv));\n"
 "}\n"
-"--src rdf_schema_objects.sql:649\n";
+"--src rdf_schema_objects.sql:648\n";
 
-static const char *proc399 = 
+static const char *proc431 = 
+"#line 667 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_dv_to_sql_str_type (in _dv varchar)\n"
 "{\n"
@@ -16488,9 +18243,10 @@ static const char *proc399 =
 "else if (__tag of nvarchar = _dv) return \'nvarchar\';\n"
 "signal (\'42000\', sprintf (\'The current implementation do no supports data type %s (%i) for IRI classes\', dv_type_title (_dv), _dv));\n"
 "}\n"
-"--src rdf_schema_objects.sql:666\n";
+"--src rdf_schema_objects.sql:665\n";
 
-static const char *proc400 = 
+static const char *proc432 = 
+"#line 684 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_dv_to_xsd_str_type (in _dv varchar)\n"
 "{\n"
@@ -16506,9 +18262,10 @@ static const char *proc400 =
 "else if (__tag of nvarchar = _dv) return \'string\';\n"
 "signal (\'42000\', sprintf (\'The current implementation do no supports data type %s (%i) for IRI classes\', dv_type_title (_dv), _dv));\n"
 "}\n"
-"--src rdf_schema_objects.sql:683\n";
+"--src rdf_schema_objects.sql:682\n";
 
-static const char *proc401 = 
+static const char *proc433 = 
+"#line 701 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_create_class (in decl varchar, in _tbl varchar, in _host varchar, in qualifier varchar, in cols any, in pkcols any)\n"
 "{\n"
@@ -16554,17 +18311,19 @@ static const char *proc401 =
 "}\n"
 "return ret;\n"
 "}\n"
-"--src rdf_schema_objects.sql:700\n";
+"--src rdf_schema_objects.sql:699\n";
 
-static const char *proc402 = 
+static const char *proc434 = 
+"#line 748 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_get_primary_key (in _tbl varchar)\n"
 "{\n"
 "return DB.DBA.REPL_PK_COLS (_tbl);\n"
 "}\n"
-"--src rdf_schema_objects.sql:747\n";
+"--src rdf_schema_objects.sql:746\n";
 
-static const char *proc403 = 
+static const char *proc435 = 
+"#line 755 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "rdf_view_get_relations (in _tbl varchar, in _tbls varchar, in _suff varchar)\n"
 "{\n"
@@ -16605,9 +18364,10 @@ static const char *proc403 =
 "}\n"
 "return ret;\n"
 "}\n"
-"--src rdf_schema_objects.sql:754\n";
+"--src rdf_schema_objects.sql:753\n";
 
-static const char *proc404 = 
+static const char *proc436 = 
+"#line 797 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure\n"
 "RDF_OWL_FROM_TBL (in qual varchar, in _tbls any, in cols any := null)\n"
 "{\n"
@@ -16700,12 +18460,14 @@ static const char *proc404 =
 "}\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src rdf_schema_objects.sql:796\n";
+"--src rdf_schema_objects.sql:795\n";
 
-static const char *proc405 = 
+static const char *proc437 = 
+"#line 891 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure RDF_VIEW_GEN_VD (in qual varchar)\n"
 "{\n"
 "declare ses, pref any;\n"
+"declare fct_installed int;\n"
 "ses := string_output ();\n"
 "pref := lower (qual);\n"
 "\n"
@@ -16720,6 +18482,9 @@ static const char *proc405 =
 "return \'\\n-- WARNING: there are already created virtual directory \"/\'||qual||\'\", skipping virtual directory generation\\n\'||\n"
 "\'-- WARNING: To avoid this message chose different base URL or drop existing virtual directory and its rewrite rules.\\n\';\n"
 "\n"
+"if (exists (select 1 from VAD.DBA.VAD_REGISTRY where R_KEY like \'/VAD/fct/%/resources/dav/%\'))\n"
+"fct_installed := 1;\n"
+"\n"
 "http (\n"
 "\'DB.DBA.URLREWRITE_CREATE_REGEX_RULE (\n"
 "\'\'<pref>_rule2\'\',\n"
@@ -16730,7 +18495,7 @@ static const char *proc405 =
 "\'\'/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%23this%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/<qual>%%23%%3E&format=%U\'\',\n"
 "vector(\'\'path\'\', \'\'*accept*\'\'),\n"
 "null,\n"
-"\'\'(text/rdf.n3)|(application/rdf.xml)\'\',\n"
+"\'\'(text/rdf.n3)|(application/rdf.xml)|(text/n3)|(application/json)\'\',\n"
 "2,\n"
 "null\n"
 ");\', ses);\n"
@@ -16747,7 +18512,7 @@ static const char *proc405 =
 "\'\'/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^/<qual>/stat%%23%%3E+%%3Fo+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/<qual>%%23%%3E+WHERE+{+%%3Chttp%%3A//^{URIQADefaultHost}^/<qual>/stat%%23%%3E+%%3Fp+%%3Fo+}&format=%U\'\',\n"
 "vector(\'\'*accept*\'\'),\n"
 "null,\n"
-"\'\'(text/rdf.n3)|(application/rdf.xml)\'\',\n"
+"\'\'(text/rdf.n3)|(application/rdf.xml)|(text/n3)|(application/json)\'\',\n"
 "2,\n"
 "null\n"
 ");\', ses);\n"
@@ -16763,26 +18528,56 @@ static const char *proc405 =
 "\'\'/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^/<qual>/objects/%U%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/<qual>%%23%%3E&format=%U\'\',\n"
 "vector(\'\'path\'\', \'\'*accept*\'\'),\n"
 "null,\n"
-"\'\'(text/rdf.n3)|(application/rdf.xml)\'\',\n"
+"\'\'(text/rdf.n3)|(application/rdf.xml)|(text/n3)|(application/json)\'\',\n"
 "2,\n"
 "null\n"
 ");\', ses);\n"
 "\n"
 "http (\'\\n\', ses);\n"
-"http (\n"
+"http (concat (\n"
 "\'DB.DBA.URLREWRITE_CREATE_REGEX_RULE (\n"
 "\'\'<pref>_rule1\'\',\n"
 "1,\n"
 "\'\'([^#]*)\'\',\n"
 "vector(\'\'path\'\'),\n"
+"1,\\n\',\n"
+"\n"
+"case when fct_installed\n"
+"then\n"
+"\'\'\'/describe/?url=http://^{URIQADefaultHost}^%U%%23this&graph=http%%3A//^{URIQADefaultHost}^/<qual>%%23\'\',\'\n"
+"else\n"
+"\'\'\'/about/html/http://^{URIQADefaultHost}^%s\'\',\'\n"
+"end\n"
+"\n"
+",\'\\nvector(\'\'path\'\'),\n"
+"null,\n"
+"null,\n"
+"2,\n"
+"303\n"
+");\'), ses);\n"
+"http (\'\\n\', ses);\n"
+"\n"
+"http (concat (\n"
+"\'DB.DBA.URLREWRITE_CREATE_REGEX_RULE (\n"
+"\'\'<pref>_rule7\'\',\n"
 "1,\n"
-"\'\'/about/html/http://^{URIQADefaultHost}^%s\'\',\n"
+"\'\'/<qual>/stat([^#]*)\'\',\n"
 "vector(\'\'path\'\'),\n"
+"1,\\n\',\n"
+"\n"
+"case when fct_installed\n"
+"then\n"
+"\'\'\'/describe/?url=http://^{URIQADefaultHost}^/<qual>/stat%%23&graph=http%%3A//^{URIQADefaultHost}^/<qual>%%23\'\',\'\n"
+"else\n"
+"\'\'\'/about/html/http://^{URIQADefaultHost}^/<qual>/stat%%01\'\',\'\n"
+"end\n"
+"\n"
+",\'\\nvector(\'\'path\'\'),\n"
 "null,\n"
 "null,\n"
 "2,\n"
 "303\n"
-");\', ses);\n"
+");\'), ses);\n"
 "http (\'\\n\', ses);\n"
 "\n"
 "http (\n"
@@ -16801,7 +18596,7 @@ static const char *proc405 =
 ");\', ses);\n"
 "\n"
 "http (\'\\n\', ses);\n"
-"http (\'DB.DBA.URLREWRITE_CREATE_RULELIST ( \'\'<pref>_rule_list1\'\', 1, vector ( \'\'<pref>_rule1\'\', \'\'<pref>_rule5\'\', \'\'<pref>_rule2\'\', \'\'<pref>_rule4\'\', \'\'<pref>_rule6\'\'));\', ses);\n"
+"http (\'DB.DBA.URLREWRITE_CREATE_RULELIST ( \'\'<pref>_rule_list1\'\', 1, vector ( \'\'<pref>_rule1\'\', \'\'<pref>_rule7\'\', \'\'<pref>_rule5\'\', \'\'<pref>_rule2\'\', \'\'<pref>_rule4\'\', \'\'<pref>_rule6\'\'));\', ses);\n"
 "\n"
 "http (\'\\n\', ses);\n"
 "http (\'DB.DBA.VHOST_REMOVE (lpath=>\'\'/<qual>\'\');\', ses);\n"
@@ -16814,11 +18609,13 @@ static const char *proc405 =
 "ses := replace (ses, \'<qual>\', qual);\n"
 "return ses;\n"
 "}\n"
-"--src rdf_schema_objects.sql:890\n";
+"--src rdf_schema_objects.sql:889\n";
 
-static const char *proc406 = 
+static const char *proc438 = 
+"#line 1038 \"[executable]/rdf_schema_objects.sql\"\n"
 "create procedure RDF_OWL_GEN_VD (in qual varchar)\n"
 "{\n"
+"declare fct_installed int;\n"
 "declare ses, pref any;\n"
 "ses := string_output ();\n"
 "pref := lower (qual);\n"
@@ -16832,6 +18629,9 @@ static const char *proc406 =
 "return \'\\n-- WARNING: there are already created virtual directory \"/schemas/\'||qual||\'\", skipping virtual directory generation\\n\'||\n"
 "\'-- WARNING: To avoid this message chose different base URL or drop existing virtual directory and its rewrite rules.\\n\';\n"
 "\n"
+"if (exists (select 1 from VAD.DBA.VAD_REGISTRY where R_KEY like \'/VAD/fct/%/resources/dav/%\'))\n"
+"fct_installed := 1;\n"
+"\n"
 "http (\n"
 "\'DB.DBA.URLREWRITE_CREATE_REGEX_RULE (\n"
 "\'\'<pref>_owl_rule2\'\',\n"
@@ -16842,26 +18642,32 @@ static const char *proc406 =
 "\'\'/sparql?query=DESCRIBE+%%3Chttp%%3A//^{URIQADefaultHost}^%U%%3E+FROM+%%3Chttp%%3A//^{URIQADefaultHost}^/schemas/<qual>%%23%%3E&format=%U\'\',\n"
 "vector(\'\'path\'\', \'\'*accept*\'\'),\n"
 "null,\n"
-"\'\'(text/rdf.n3)|(application/rdf.xml)\'\',\n"
+"\'\'(text/rdf.n3)|(application/rdf.xml)|(text/n3)|(application/json)\'\',\n"
 "2,\n"
 "null\n"
 ");\', ses);\n"
 "\n"
 "http (\'\\n\', ses);\n"
 "http (\n"
+"concat (\n"
 "\'DB.DBA.URLREWRITE_CREATE_REGEX_RULE (\n"
 "\'\'<pref>_owl_rule1\'\',\n"
 "1,\n"
 "\'\'([^#]*)\'\',\n"
 "vector(\'\'path\'\'),\n"
-"1,\n"
-"\'\'/about/html/http://^{URIQADefaultHost}^%s\'\',\n"
-"vector(\'\'path\'\'),\n"
+"1,\\n\',\n"
+"case when fct_installed\n"
+"then\n"
+"\'\'\'/describe/?url=http://^{URIQADefaultHost}^%U&graph=http%%3A//^{URIQADefaultHost}^/schemas/<qual>%%23\'\',\'\n"
+"else\n"
+"\'\'\'/about/html/http://^{URIQADefaultHost}^%s\'\',\'\n"
+"end,\n"
+"\'\\nvector(\'\'path\'\'),\n"
 "null,\n"
 "null,\n"
 "2,\n"
 "303\n"
-");\', ses);\n"
+");\'), ses);\n"
 "http (\'\\n\', ses);\n"
 "http (\'DB.DBA.URLREWRITE_CREATE_RULELIST ( \'\'<pref>_owl_rule_list1\'\', 1, vector ( \'\'<pref>_owl_rule1\'\', \'\'<pref>_owl_rule2\'\'));\', ses);\n"
 "\n"
@@ -16876,11 +18682,110 @@ static const char *proc406 =
 "ses := replace (ses, \'<qual>\', qual);\n"
 "return ses;\n"
 "}\n"
-"--src rdf_schema_objects.sql:1003\n";
+"--src rdf_schema_objects.sql:1036\n";
+
+static const char *proc439 = 
+"#line 1109 \"[executable]/rdf_schema_objects.sql\"\n"
+"create procedure\n"
+"RDF_VIEW_CHECK_SYNC_TB (in tb varchar)\n"
+"{\n"
+"declare tree, tbname any;\n"
+"tree := sql_parse (sprintf (\'SELECT 1 from %s\', tb));\n"
+"tbname := tree [4][1][0][1][1];\n"
+"tbname := complete_table_name (tbname, 1);\n"
+"if (exists (select 1 from SYS_VIEWS where V_NAME = tbname))\n"
+"return 0;\n"
+"return 1;\n"
+"}\n"
+"--src rdf_schema_objects.sql:1107\n";
+
+static const char *proc440 = 
+"#line 1122 \"[executable]/rdf_schema_objects.sql\"\n"
+"create procedure\n"
+"RDF_VIEW_DO_SYNC (in qualifier varchar, in load_data int := 0)\n"
+"{\n"
+"declare mask varchar;\n"
+"declare txt, tbls, err_ret any;\n"
+"declare stat, msg varchar;\n"
+"\n"
+"tbls := vector ();\n"
+"err_ret := vector ();\n"
+"mask := sprintf (\'http://%s/schemas/%s/qm-%%\', cfg_item_value(virtuoso_ini_path(), \'URIQA\',\'DefaultHost\'), qualifier);\n"
+"for select \"o\" from\n"
+"(sparql define input:storage \"\" select ?o from virtrdf:\n"
+"{\n"
+"virtrdf:DefaultQuadStorage-UserMaps ?p ?o .\n"
+"?o a virtrdf:QuadMap  .\n"
+"filter (?o like ?:mask)\n"
+"}\n"
+"order by asc (bif:sprintf_inverse (bif:concat (str(rdf:_), \"%d\"), str (?p), 1))) x do\n"
+"{\n"
+"declare qm varchar;\n"
+"if (\"o\" not like \'%/qm-VoidStatistics\')\n"
+"{\n"
+"exec (sprintf (\'sparql alter quad storage virtrdf:SyncToQuads { drop quad map <%s> }\', \"o\"), stat, msg);\n"
+"stat := \'00000\';\n"
+"exec (sprintf (\'sparql alter quad storage virtrdf:SyncToQuads { create <%s> using storage virtrdf:DefaultQuadStorage }\', \"o\"), stat, msg);\n"
+"if (stat <> \'00000\')\n"
+"err_ret := vector_concat (err_ret, vector (vector (stat, msg)));\n"
+"\n"
+"qm := \"o\";\n"
+"for select \"tb\" from (sparql define input:storage \"\"\n"
+"select distinct ?tb from virtrdf:\n"
+"{\n"
+"?:qm virtrdf:qmUserSubMaps ?sm .\n"
+"?sm ?inx ?q .\n"
+"?q virtrdf:qmTableName ?tb  .\n"
+"}) xx do\n"
+"{\n"
+"if (RDF_VIEW_CHECK_SYNC_TB (\"tb\"))\n"
+"tbls := vector_concat (tbls, vector (\"tb\"));\n"
+"else\n"
+"err_ret := vector_concat (err_ret, vector (vector (\'42000\', sprintf (\'Reference to VIEW %s cannot be added automatically\', \"tb\"))));\n"
+"}\n"
+"}\n"
+"}\n"
+"foreach (varchar tb in tbls) do\n"
+"{\n"
+"for (declare ctr int, ctr := 1; ctr <= 4; ctr := ctr + 1)\n"
+"{\n"
+"txt := sparql_rdb2rdf_codegen (tb, ctr);\n"
+"stat := \'00000\';\n"
+"if (isvector (txt))\n"
+"{\n"
+"exec (cast (txt[0] as varchar), stat, msg);\n"
+"if (stat <> \'00000\')\n"
+"{\n"
+"err_ret := vector_concat (err_ret, vector (vector (stat, msg)));\n"
+"stat := \'00000\';\n"
+"}\n"
+"exec (cast (txt[1] as varchar), stat, msg);\n"
+"if (stat <> \'00000\')\n"
+"err_ret := vector_concat (err_ret, vector (vector (stat, msg)));\n"
+"}\n"
+"else\n"
+"{\n"
+"exec (cast (txt as varchar), stat, msg);\n"
+"if (stat <> \'00000\')\n"
+"err_ret := vector_concat (err_ret, vector (vector (stat, msg)));\n"
+"}\n"
+"}\n"
+"if (load_data)\n"
+"{\n"
+"declare pname varchar;\n"
+"pname := sprintf (\'DB.DBA.\"RDB2RDF_FILL__%s\" ()\', replace (replace (tb, \'\"\', \'`\'), \'.\', \'~\'));\n"
+"stat := \'00000\';\n"
+"exec (pname, stat, msg);\n"
+"if (stat <> \'00000\') err_ret := vector_concat (err_ret, vector (sprintf (\'%s: %s\', stat, msg)));\n"
+"}\n"
+"}\n"
+"return err_ret;\n"
+"}\n"
+"--src rdf_schema_objects.sql:1120\n";
 
 /* rdf_void.sql */
 
-static const char *tbl20 = 
+static const char *tbl21 = 
 "create table DB.DBA.RDF_VOID_GRAPH (\n"
 "RVG_IID IRI_ID not null primary key,\n"
 "RVG_IRI varchar not null,\n"
@@ -16889,7 +18794,7 @@ static const char *tbl20 =
 "alter index RDF_VOID_GRAPH on DB.DBA.RDF_VOID_GRAPH partition cluster replicated\n"
 "create index RDF_VOID_GRAPH_IRI on DB.DBA.RDF_VOID_GRAPH (RVG_IRI) partition cluster replicated\n";
 
-static const char *tbl21 = 
+static const char *tbl22 = 
 "create table DB.DBA.RDF_VOID_GRAPH_MEMBER (\n"
 "RVGM_GROUP_IID IRI_ID not null,\n"
 "RVGM_MEMBER_IID IRI_ID not null,\n"
@@ -16897,7 +18802,8 @@ static const char *tbl21 =
 ")\n"
 "alter index RDF_VOID_GRAPH_MEMBER on DB.DBA.RDF_VOID_GRAPH_MEMBER partition cluster replicated\n";
 
-static const char *proc407 = 
+static const char *proc441 = 
+"#line 43 \"[executable]/rdf_void.sql\"\n"
 "create procedure RDF_VOID_INIT ()\n"
 "{\n"
 "XML_REMOVE_NS_BY_PREFIX (\'scovo\', 2);\n"
@@ -16905,11 +18811,12 @@ static const char *proc407 =
 "XML_SET_NS_DECL (\'scovo\', \'http://purl.org/NET/scovo#\', 2);\n"
 "XML_SET_NS_DECL (\'void\', \'http://rdfs.org/ns/void#\', 2);\n"
 "}\n"
-"--src rdf_void.sql:42\n";
+"--src rdf_void.sql:41\n";
 
-static const char *other41 = 
+static const char *other45 = 
 "RDF_VOID_INIT ()\n";
-static const char *proc408 = 
+static const char *proc442 = 
+"#line 55 \"[executable]/rdf_void.sql\"\n"
 "create procedure RDF_VOID_SPLIT_IRI (in rel varchar, out pref varchar, out name varchar)\n"
 "{\n"
 "declare delim1, delim2, delim3, pos int;\n"
@@ -16921,9 +18828,10 @@ static const char *proc408 =
 "name := subseq (rel, pos + 1);\n"
 "pref := subseq (rel, 0, pos);\n"
 "}\n"
-"--src rdf_void.sql:54\n";
+"--src rdf_void.sql:53\n";
 
-static const char *proc409 = 
+static const char *proc443 = 
+"#line 68 \"[executable]/rdf_void.sql\"\n"
 "create procedure RDF_VOID_STORE (in graph varchar, in to_graph_name varchar := null, in src varchar := null)\n"
 "{\n"
 "declare ses any;\n"
@@ -16943,9 +18851,10 @@ static const char *proc409 =
 "TTLP (ses, graph, to_graph_name, 185);\n"
 "return;\n"
 "}\n"
-"--src rdf_void.sql:67\n";
+"--src rdf_void.sql:66\n";
 
-static const char *proc410 = 
+static const char *proc444 = 
+"#line 89 \"[executable]/rdf_void.sql\"\n"
 "create procedure RDF_VOID_ALL_GEN (in target_graph varchar, in details int := 0)\n"
 "{\n"
 "declare total, subset, ns_ctr int;\n"
@@ -17007,9 +18916,10 @@ static const char *proc410 =
 "http (sprintf (\'\\n\'), ses);\n"
 "return ses;\n"
 "}\n"
-"--src rdf_void.sql:88\n";
+"--src rdf_void.sql:87\n";
 
-static const char *proc411 = 
+static const char *proc445 = 
+"#line 152 \"[executable]/rdf_void.sql\"\n"
 "create procedure RDF_VOID_NS (inout ses any)\n"
 "{\n"
 "http (\'@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\\n\', ses);\n"
@@ -17019,9 +18929,10 @@ static const char *proc411 =
 "http (\'@prefix scovo: <http://purl.org/NET/scovo#> .\\n\', ses);\n"
 "http (\'@prefix void: <http://rdfs.org/ns/void#> .\\n\', ses);\n"
 "}\n"
-"--src rdf_void.sql:151\n";
+"--src rdf_void.sql:150\n";
 
-static const char *proc412 = 
+static const char *proc446 = 
+"#line 163 \"[executable]/rdf_void.sql\"\n"
 "create procedure RDF_VOID_GEN (in graph varchar, in gr_name varchar := null)\n"
 "{\n"
 "declare ses any;\n"
@@ -17033,18 +18944,20 @@ static const char *proc412 =
 "RDF_VOID_GEN_1 (graph, gr_name, \'this\', \'\', ses, dummy, 1, 1);\n"
 "return ses;\n"
 "}\n"
-"--src rdf_void.sql:162\n";
+"--src rdf_void.sql:161\n";
 
-static const char *proc413 = 
+static const char *proc447 = 
+"#line 176 \"[executable]/rdf_void.sql\"\n"
 "create procedure RDF_VOID_DIST_O_SRV (in graph any)\n"
 "{\n"
 "declare cnt int;\n"
 "cnt := (select count(distinct O) from DB.DBA.RDF_QUAD table option (no cluster) where G = graph);\n"
 "return cnt;\n"
 "}\n"
-"--src rdf_void.sql:175\n";
+"--src rdf_void.sql:174\n";
 
-static const char *proc414 = 
+static const char *proc448 = 
+"#line 184 \"[executable]/rdf_void.sql\"\n"
 "create procedure RDF_VOID_DIST_O (in graph varchar)\n"
 "{\n"
 "declare daq, r any;\n"
@@ -17064,9 +18977,10 @@ static const char *proc414 =
 "}\n"
 "return s;\n"
 "}\n"
-"--src rdf_void.sql:183\n";
+"--src rdf_void.sql:182\n";
 
-static const char *proc415 = 
+static const char *proc449 = 
+"#line 205 \"[executable]/rdf_void.sql\"\n"
 "create procedure RDF_VOID_GEN_1 (in graph varchar, in gr_name varchar := null,\n"
 "in ns_pref varchar := \'this\', in this_ns varchar := \'\',\n"
 "inout ses any, inout total int, in ep int := 1, in details int := 1)\n"
@@ -17111,7 +19025,7 @@ static const char *proc415 =
 "declare exit handler for sqlstate \'*\' { goto end1; };\n"
 "_cnt_subj := (select count(distinct S) from DB.DBA.RDF_QUAD where G = iri_to_id (graph));\n"
 "http (sprintf (\'%s:DistinctSubjectsStat a scovo:Item ; \\n rdf:value %d ; \\n\', ns_pref, _cnt_subj), ses);\n"
-"http (sprintf (\' scovo:dimension void:numOfTriples . \\n\'), ses);\n"
+"http (sprintf (\' scovo:dimension void:numberOfDistinctSubjects . \\n\'), ses);\n"
 "end1:;\n"
 "}\n"
 "if (details)\n"
@@ -17126,7 +19040,7 @@ static const char *proc415 =
 "_cnt_obj  := (sparql define input:storage \"\" select count(distinct (?o)) where { graph `iri (?:graph)` { ?s ?p ?o . filter (isIRI (?o)) } });\n"
 "}\n"
 "http (sprintf (\'%s:DistinctObjectsStat a scovo:Item ; \\n rdf:value %d ; \\n\', ns_pref, _cnt_obj), ses);\n"
-"http (sprintf (\' scovo:dimension void:numOfTriples . \\n\'), ses);\n"
+"http (sprintf (\' scovo:dimension void:numberOfDistinctObjects . \\n\'), ses);\n"
 "end2:;\n"
 "}\n"
 "\n"
@@ -17200,7 +19114,383 @@ static const char *proc415 =
 "http (sprintf (\'%s:TypeOfLink rdfs:subClassOf scovo:Dimension . \\n\', ns_pref), ses);\n"
 "return ses;\n"
 "}\n"
-"--src rdf_void.sql:204\n";
+"--src rdf_void.sql:203\n";
+
+/* rdflddir2.sql */
+
+static const char *tbl23 = 
+"create table DB.DBA.LOAD_LIST (\n"
+"ll_file varchar,\n"
+"ll_graph varchar,\n"
+"ll_state int default 0,\n"
+"ll_started datetime,\n"
+"ll_done datetime,\n"
+"ll_host int,\n"
+"ll_work_time integer,\n"
+"ll_error varchar,\n"
+"primary key (ll_file))\n"
+"alter index LOAD_LIST on DB.DBA.LOAD_LIST partition (ll_file varchar)\n"
+"create index LL_STATE on DB.DBA.LOAD_LIST (ll_state, ll_file, ll_graph) partition (ll_state int)\n";
+
+static const char *tbl24 = 
+"create table LDLOCK (id int primary key)\n"
+"alter index LDLOCK on LDLOCK partition (id int)\n";
+
+static const char *other46 = 
+"insert soft DB.DBA.LDLOCK values (0)\n";
+static const char *proc450 = 
+"#line 47 \"[executable]/rdflddir2.sql\"\n"
+"create procedure\n"
+"ld_dir (in path varchar, in mask varchar, in graph varchar)\n"
+"{\n"
+"declare ls any;\n"
+"declare inx int;\n"
+"ls := sys_dirlist (path, 1);\n"
+"for (inx := 0; inx < length (ls); inx := inx + 1)\n"
+"{\n"
+"if (ls[inx] like mask)\n"
+"{\n"
+"set isolation = \'serializable\';\n"
+"\n"
+"if (not (exists (select 1 from DB.DBA.LOAD_LIST where LL_FILE = path || \'/\' || ls[inx] for update)))\n"
+"{\n"
+"declare gfile, cgfile, ngraph varchar;\n"
+"gfile := path || \'/\' || replace (ls[inx], \'.gz\', \'\') || \'.graph\';\n"
+"cgfile := path || \'/\' || regexp_replace (replace (ls[inx], \'.gz\', \'\'), \'\\\\-[0-9]+\\\\.n\', \'.n\') || \'.graph\';\n"
+"if (file_stat (gfile) <> 0)\n"
+"ngraph := trim (file_to_string (gfile), \' \\r\\n\');\n"
+"else if (file_stat (cgfile) <> 0)\n"
+"ngraph := trim (file_to_string (cgfile), \' \\r\\n\');\n"
+"else if (file_stat (path || \'/\' || \'global.graph\') <> 0)\n"
+"ngraph := trim (file_to_string (path || \'/\' || \'global.graph\'), \' \\r\\n\');\n"
+"else\n"
+"ngraph := graph;\n"
+"if (ngraph is not null)\n"
+"{\n"
+"insert into DB.DBA.LOAD_LIST (ll_file, ll_graph) values (path || \'/\' || ls[inx], ngraph);\n"
+"}\n"
+"}\n"
+"\n"
+"commit work;\n"
+"}\n"
+"}\n"
+"}\n"
+"--src rdflddir2.sql:45\n";
+
+static const char *proc451 = 
+"#line 85 \"[executable]/rdflddir2.sql\"\n"
+"create procedure\n"
+"rdf_read_dir (in path varchar, in mask varchar, in graph varchar)\n"
+"{\n"
+"ld_dir (path, mask, graph);\n"
+"}\n"
+"--src rdflddir2.sql:83\n";
+
+static const char *proc452 = 
+"#line 93 \"[executable]/rdflddir2.sql\"\n"
+"create procedure\n"
+"ld_dir_all (in path varchar, in mask varchar, in graph varchar)\n"
+"{\n"
+"declare ls, ngraph any;\n"
+"declare inx int;\n"
+"ls := sys_dirlist (path, 0);\n"
+"if (file_stat (path || \'/\' || \'global.graph\') <> 0)\n"
+"{\n"
+"ngraph := trim (file_to_string (path || \'/\' || \'global.graph\'), \' \\r\\n\');\n"
+"if (length (ngraph))\n"
+"graph := ngraph;\n"
+"}\n"
+"ld_dir (path, mask, graph);\n"
+"for (inx := 0; inx < length (ls); inx := inx + 1)\n"
+"{\n"
+"if (ls[inx] <> \'.\' and ls[inx] <> \'..\')\n"
+"{\n"
+"ld_dir_all (path||\'/\'||ls[inx], mask, graph);\n"
+"}\n"
+"}\n"
+"}\n"
+"--src rdflddir2.sql:91\n";
+
+static const char *proc453 = 
+"#line 116 \"[executable]/rdflddir2.sql\"\n"
+"create procedure\n"
+"ld_add (in _fname varchar, in _graph varchar)\n"
+"{\n"
+"\n"
+"\n"
+"set isolation = \'serializable\';\n"
+"\n"
+"if (not (exists (select 1 from DB.DBA.LOAD_LIST where LL_FILE = _fname for update)))\n"
+"{\n"
+"insert into DB.DBA.LOAD_LIST (LL_FILE, LL_GRAPH) values (_fname, _graph);\n"
+"}\n"
+"commit work;\n"
+"}\n"
+"--src rdflddir2.sql:114\n";
+
+static const char *proc454 = 
+"#line 131 \"[executable]/rdflddir2.sql\"\n"
+"create procedure ld_ttlp_flags (in fname varchar)\n"
+"{\n"
+"if (fname like \'%/btc-2009%\' or fname like \'%.nq%\' or fname like \'%.n4\')\n"
+"return 255 + 512;\n"
+"return 255;\n"
+"}\n"
+"--src rdflddir2.sql:129\n";
+
+static const char *proc455 = 
+"#line 139 \"[executable]/rdflddir2.sql\"\n"
+"create procedure\n"
+"ld_file (in f varchar, in graph varchar)\n"
+"{\n"
+"declare gzip_name varchar;\n"
+"declare exit handler for sqlstate \'*\' {\n"
+"rollback work;\n"
+"update DB.DBA.LOAD_LIST\n"
+"set LL_STATE = 2,\n"
+"LL_DONE = curdatetime (),\n"
+"LL_ERROR = __sql_state || \' \' || __sql_message\n"
+"where LL_FILE = f;\n"
+"commit work;\n"
+"\n"
+"log_message (sprintf (\' File %s error %s %s\', f, __sql_state, __sql_message));\n"
+"return;\n"
+"};\n"
+"\n"
+"if (graph like \'sql:%\')\n"
+"{\n"
+"exec (subseq (graph, 4), null, null, vector (f), vector (\'max_rows\', 0, \'use_cache\', 1));\n"
+"return;\n"
+"}\n"
+"\n"
+"if (f like \'%.grdf\' or f like \'%.grdf.gz\')\n"
+"{\n"
+"load_grdf (f);\n"
+"}\n"
+"else if (f like \'%.gz\')\n"
+"{\n"
+"gzip_name := regexp_replace (f, \'\\.gz\\x24\', \'\');\n"
+"if (gzip_name like \'%.xml\' or gzip_name like \'%.owl\' or gzip_name like \'%.rdf\')\n"
+"DB.DBA.RDF_LOAD_RDFXML (gz_file_open (f), graph, graph);\n"
+"else\n"
+"TTLP (gz_file_open (f), graph, graph, ld_ttlp_flags (gzip_name));\n"
+"}\n"
+"else\n"
+"{\n"
+"if (f like \'%.xml\' or f like \'%.owl\' or f like \'%.rdf\')\n"
+"DB.DBA.RDF_LOAD_RDFXML (file_open (f), graph, graph);\n"
+"else\n"
+"TTLP (file_open (f), graph, graph, ld_ttlp_flags (f));\n"
+"}\n"
+"\n"
+"\n"
+"}\n"
+"--src rdflddir2.sql:137\n";
+
+static const char *proc456 = 
+"#line 186 \"[executable]/rdflddir2.sql\"\n"
+"create procedure\n"
+"rdf_load_dir (in path varchar,\n"
+"in mask varchar := \'%.nt\',\n"
+"in graph varchar := \'http://dbpedia.org\')\n"
+"{\n"
+"\n"
+"delete from DB.DBA.LOAD_LIST where LL_FILE = \'##stop\';\n"
+"commit work;\n"
+"\n"
+"ld_dir (path, mask, graph);\n"
+"\n"
+"rdf_loader_run ();\n"
+"}\n"
+"--src rdflddir2.sql:184\n";
+
+static const char *proc457 = 
+"#line 202 \"[executable]/rdflddir2.sql\"\n"
+"create procedure ld_array ()\n"
+"{\n"
+"declare first, last, arr, len, local any;\n"
+"declare cr cursor for\n"
+"select top 100 LL_FILE, LL_GRAPH\n"
+"from DB.DBA.LOAD_LIST table option (index ll_state)\n"
+"where LL_STATE = 0\n"
+"for update;\n"
+"declare fill int;\n"
+"declare f, g varchar;\n"
+"declare r any;\n"
+"whenever not found goto done;\n"
+"first := 0;\n"
+"last := 0;\n"
+"arr := make_array (100, \'any\');\n"
+"fill := 0;\n"
+"open cr;\n"
+"len := 0;\n"
+"for (;;)\n"
+"{\n"
+"fetch cr into f, g;\n"
+"if (0 = first) first := f;\n"
+"last := f;\n"
+"arr[fill] := vector (f, g);\n"
+"len := len + cast (file_stat (f, 1) as int);\n"
+"fill := fill + 1;\n"
+"if (len > 2000000 or fill >= 100)\n"
+"goto done;\n"
+"}\n"
+"done:\n"
+"if (0 = first)\n"
+"return 0;\n"
+"if (1 <> sys_stat (\'cl_run_local_only\'))\n"
+"local := sys_stat (\'cl_this_host\');\n"
+"update load_list set ll_state = 1, ll_started = curdatetime (), LL_HOST = local\n"
+"where ll_file >= first and ll_file <= last;\n"
+"return arr;\n"
+"}\n"
+"--src rdflddir2.sql:200\n";
+
+static const char *proc458 = 
+"#line 242 \"[executable]/rdflddir2.sql\"\n"
+"create procedure\n"
+"rdf_loader_run (in max_files integer := null, in log_enable int := 2)\n"
+"{\n"
+"declare sec_delay float;\n"
+"declare _f, _graph varchar;\n"
+"declare arr any;\n"
+"declare xx, inx, tx_mode, ld_mode int;\n"
+"ld_mode := log_enable;\n"
+"if (0 = sys_stat (\'cl_run_local_only\'))\n"
+"{\n"
+"if (log_enable = 2 and cl_this_host () = 1)\n"
+"{\n"
+"cl_exec (\'checkpoint_interval (0)\');\n"
+"cl_exec (\'__dbf_set (\'\'cl_non_logged_write_mode\'\', 1)\');\n"
+"}\n"
+"if (cl_this_host () = 1)\n"
+"cl_exec(\'__dbf_set(\'\'cl_max_keep_alives_missed\'\',3000)\');\n"
+"}\n"
+"tx_mode := bit_and (1, log_enable);\n"
+"log_message (\'Loader started\');\n"
+"\n"
+"delete from DB.DBA.LOAD_LIST where LL_FILE = \'##stop\';\n"
+"commit work;\n"
+"\n"
+"while (1)\n"
+"{\n"
+"set isolation = \'repeatable\';\n"
+"declare exit handler for sqlstate \'40001\' {\n"
+"rollback work;\n"
+"sec_delay := rnd(1000)*0.001;\n"
+"log_message(sprintf(\'deadlock in loader, waiting %d milliseconds\', cast (sec_delay * 1000 as integer)));\n"
+"delay(sec_delay);\n"
+"goto again;\n"
+"};\n"
+"\n"
+"again:;\n"
+"\n"
+"if (exists (select 1 from DB.DBA.LOAD_LIST where LL_FILE = \'##stop\'))\n"
+"{\n"
+"log_message (\'File load stopped by rdf_load_stop.\');\n"
+"return;\n"
+"}\n"
+"\n"
+"log_enable (tx_mode, 1);\n"
+"\n"
+"if (max_files is not null and max_files <= 0)\n"
+"{\n"
+"commit work;\n"
+"log_message (\'Max_files reached. Finishing.\');\n"
+"return;\n"
+"}\n"
+"\n"
+"whenever not found goto looks_empty;\n"
+"\n"
+"\n"
+"set isolation = \'serializable\';\n"
+"select id into xx from ldlock where id = 0 for update;\n"
+"arr := ld_array ();\n"
+"commit work;\n"
+"if (0 = arr)\n"
+"goto looks_empty;\n"
+"log_enable (ld_mode, 1);\n"
+"\n"
+"for (inx := 0; inx < 100; inx := inx + 1)\n"
+"{\n"
+"if (0 = arr[inx])\n"
+"goto arr_done;\n"
+"ld_file (arr[inx][0], arr[inx][1]);\n"
+"update DB.DBA.LOAD_LIST set LL_STATE = 2, LL_DONE = curdatetime () where LL_FILE = arr[inx][0];\n"
+"}\n"
+"arr_done:\n"
+"log_enable (tx_mode, 1);\n"
+"\n"
+"\n"
+"if (max_files is not null) max_files := max_files - 100;\n"
+"\n"
+"commit work;\n"
+"}\n"
+"\n"
+"looks_empty:\n"
+"commit work;\n"
+"log_message (\'No more files to load. Loader has finished,\');\n"
+"return;\n"
+"\n"
+"}\n"
+"--src rdflddir2.sql:240\n";
+
+static const char *proc459 = 
+"#line 329 \"[executable]/rdflddir2.sql\"\n"
+"create procedure rdf_load_stop (in force int := 0)\n"
+"{\n"
+"insert into DB.DBA.LOAD_LIST (LL_FILE) values (\'##stop\');\n"
+"commit work;\n"
+"if (force)\n"
+"cl_exec (\'txn_killall (1)\');\n"
+"}\n"
+"--src rdflddir2.sql:327\n";
+
+static const char *proc460 = 
+"#line 339 \"[executable]/rdflddir2.sql\"\n"
+"create procedure RDF_LOADER_RUN_1 (in x int, in y int)\n"
+"{\n"
+"rdf_loader_run (x, y);\n"
+"}\n"
+"--src rdflddir2.sql:337\n";
+
+static const char *proc461 = 
+"#line 345 \"[executable]/rdflddir2.sql\"\n"
+"create procedure rdf_ld_srv (in log_enable int := 2)\n"
+"{\n"
+"declare aq any;\n"
+"aq := async_queue (1);\n"
+"aq_request (aq, \'DB.DBA.RDF_LOADER_RUN_1\', vector (null, log_enable));\n"
+"aq_wait_all (aq);\n"
+"}\n"
+"--src rdflddir2.sql:343\n";
+
+static const char *proc462 = 
+"#line 355 \"[executable]/rdflddir2.sql\"\n"
+"create procedure load_grdf (in f varchar)\n"
+"{\n"
+"declare line any;\n"
+"declare inx int;\n"
+"declare ses any;\n"
+"declare gr varchar;\n"
+"\n"
+"if (f like \'%.gz\')\n"
+"ses := gz_file_open (f);\n"
+"else\n"
+"ses := file_open (f);\n"
+"inx := 0;\n"
+"line := \'\';\n"
+"while (line <> 0)\n"
+"{\n"
+"gr := ses_read_line (ses, 0, 0, 1);\n"
+"if (gr = 0) return;\n"
+"line := ses_read_line (ses, 0, 0, 1);\n"
+"if (line = 0) return;\n"
+"DB.DBA.RDF_LOAD_RDFXML (line, gr, gr);\n"
+"inx := inx + 1;\n"
+"}\n"
+"}\n"
+"--src rdflddir2.sql:353\n";
 
 static int
 sch_proc_def_exists (client_connection_t *cli, const char *proc_name)
@@ -17247,8 +19537,9 @@ sqls_define_sparql (void)
   ddl_ensure_table ("DB.DBA.RDF_EXPLICITLY_CREATED_GRAPH", tbl9);
   ddl_ensure_table ("DB.DBA.RDF_GEO", tbl10);
   ddl_ensure_table ("DB.DBA.RDF_LABEL", tbl11);
-  ddl_ensure_table ("DB.DBA.SYS_FAKE_0", tbl12);
-  ddl_ensure_table ("DB.DBA.SYS_FAKE_1", tbl13);
+  ddl_ensure_table ("DB.DBA.RDF_QUAD_DELETE_QUEUE", tbl12);
+  ddl_ensure_table ("DB.DBA.SYS_FAKE_0", tbl13);
+  ddl_ensure_table ("DB.DBA.SYS_FAKE_1", tbl14);
   ddl_ensure_table ("do this always", other3);
   ddl_ensure_table ("do this always", other4);
   ddl_ensure_table ("do this always", other5);
@@ -17272,452 +19563,509 @@ sqls_define_sparql (void)
   ddl_ensure_table ("do this always", other14);
   DEFINE_PROC ("DB.DBA.RDF_LOAD_ALL_FT_RULES", proc12);
   ddl_ensure_table ("do this always", other15);
-  DEFINE_PROC ("DB.DBA.RDF_MAKE_IID_OF_QNAME", proc14);
-  DEFINE_PROC ("DB.DBA.RDF_MAKE_IID_OF_LONG", proc15);
-  DEFINE_PROC ("DB.DBA.RDF_MAKE_GRAPH_IIDS_OF_QNAMES", proc16);
-  DEFINE_PROC ("DB.DBA.RDF_TWOBYTE_OF_DATATYPE", proc17);
-  DEFINE_PROC ("DB.DBA.RDF_TWOBYTE_OF_LANGUAGE", proc18);
-  DEFINE_PROC ("DB.DBA.RQ_LONG_OF_O", proc19);
-  DEFINE_PROC ("DB.DBA.RDF_BOX_COMPLETE", proc20);
-  DEFINE_PROC ("DB.DBA.RQ_SQLVAL_OF_O", proc21);
-  DEFINE_PROC ("DB.DBA.RQ_BOOL_OF_O", proc22);
-  DEFINE_PROC ("DB.DBA.RQ_IID_OF_O", proc23);
-  DEFINE_PROC ("DB.DBA.RQ_O_IS_LIT", proc24);
-  DEFINE_PROC ("RDF_G_INS", proc25);
-  DEFINE_PROC ("cl_rdf_geo_insert", proc26);
-  DEFINE_PROC ("rdf_geo_add", proc27);
-  DEFINE_PROC ("DB.DBA.RDF_OBJ_ADD", proc28);
-  DEFINE_PROC ("DB.DBA.RDF_FIND_RO_DIGEST", proc29);
-  DEFINE_PROC ("DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL", proc30);
-  DEFINE_PROC ("DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL_FT", proc31);
-  DEFINE_PROC ("DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL", proc32);
-  DEFINE_PROC ("DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL_FT", proc33);
-  DEFINE_PROC ("DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL_STRINGS", proc34);
-  DEFINE_PROC ("DB.DBA.RDF_LONG_OF_OBJ", proc35);
-  DEFINE_PROC ("DB.DBA.RDF_DATATYPE_OF_OBJ", proc36);
-  DEFINE_PROC ("DB.DBA.RDF_LANGUAGE_OF_OBJ", proc37);
-  DEFINE_PROC ("DB.DBA.RDF_SQLVAL_OF_OBJ", proc38);
-  DEFINE_PROC ("DB.DBA.RDF_BOOL_OF_OBJ", proc39);
-  DEFINE_PROC ("DB.DBA.RDF_QNAME_OF_OBJ", proc40);
-  DEFINE_PROC ("DB.DBA.RDF_STRSQLVAL_OF_OBJ", proc41);
-  DEFINE_PROC ("DB.DBA.RDF_OBJ_OF_LONG", proc42);
-  DEFINE_PROC ("DB.DBA.RDF_OBJ_OF_SQLVAL", proc43);
-  DEFINE_PROC ("DB.DBA.RDF_MAKE_LONG_OF_SQLVAL", proc44);
-  DEFINE_PROC ("DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL", proc45);
-  DEFINE_PROC ("DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL_STRINGS", proc46);
-  DEFINE_PROC ("DB.DBA.RDF_QNAME_OF_LONG_SAFE", proc47);
-  DEFINE_PROC ("DB.DBA.RDF_SQLVAL_OF_LONG", proc48);
-  DEFINE_PROC ("DB.DBA.RDF_BOOL_OF_LONG", proc49);
-  DEFINE_PROC ("DB.DBA.RDF_DATATYPE_OF_LONG", proc50);
-  DEFINE_PROC ("DB.DBA.RDF_DATATYPE_IRI_OF_LONG", proc51);
-  DEFINE_PROC ("DB.DBA.RDF_LANGUAGE_OF_LONG", proc52);
-  DEFINE_PROC ("DB.DBA.RDF_STRSQLVAL_OF_LONG", proc53);
-  DEFINE_PROC ("DB.DBA.RDF_WIDESTRSQLVAL_OF_LONG", proc54); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_DATATYPE_OF_SQLVAL", proc55);
-  DEFINE_PROC ("DB.DBA.RDF_LONG_OF_SQLVAL", proc56); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_STRSQLVAL_OF_SQLVAL", proc57); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_LANGUAGE_OF_SQLVAL", proc58); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_IS_BLANK_REF", proc59); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_IS_URI_REF", proc60); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_IS_REF", proc61); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_IS_LITERAL", proc62); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#boolean", proc63); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#date", proc64); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#dateTime", proc65); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#double", proc66); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#float", proc67); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#integer", proc68); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#int", proc69); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#time", proc70); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#string", proc71); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.__and", proc72); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.__or", proc73); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.__not", proc74);
-  DEFINE_PROC ("DB.DBA.RDF_QUAD_URI", proc75);
-  DEFINE_PROC ("DB.DBA.RDF_QUAD_URI_L", proc76);
-  DEFINE_PROC ("DB.DBA.RDF_QUAD_URI_L_TYPED", proc77);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_NEW_GRAPH", proc78);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_NEW_BLANK", proc79);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_GET_IID", proc80);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE", proc81);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_L", proc82);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_COMMIT", proc83);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_REPORT_DEFAULT", proc84);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_XLAT", proc85);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_L_XLAT", proc86); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.TTLP_XLAT_CONCAT", proc87);
-  DEFINE_PROC ("DB.DBA.TTLP", proc88);
-  DEFINE_PROC ("DB.DBA.TTLP_WITH_IRI_TRANSLATION", proc89);
-  DEFINE_PROC ("DB.DBA.TTLP_VALIDATE", proc90);
-  DEFINE_PROC ("DB.DBA.TTLP_VALIDATE_LOCAL_FILE", proc91);
-  DEFINE_PROC ("DB.DBA.RDF_TTL2HASH_EXEC_NEW_GRAPH", proc92);
-  DEFINE_PROC ("DB.DBA.RDF_TTL2HASH_EXEC_NEW_BLANK", proc93);
-  DEFINE_PROC ("DB.DBA.RDF_TTL2HASH_EXEC_GET_IID", proc94);
-  DEFINE_PROC ("DB.DBA.RDF_TTL2HASH_EXEC_TRIPLE", proc95);
-  DEFINE_PROC ("DB.DBA.RDF_TTL2HASH_EXEC_TRIPLE_L", proc96);
-  DEFINE_PROC ("DB.DBA.RDF_TTL2HASH", proc97);
-  DEFINE_PROC ("DB.DBA.RDF_TTL2SQLHASH_EXEC_GET_IID", proc98);
-  DEFINE_PROC ("DB.DBA.RDF_TTL2SQLHASH_EXEC_TRIPLE", proc99);
-  DEFINE_PROC ("DB.DBA.RDF_TTL2SQLHASH_EXEC_TRIPLE_L", proc100);
-  DEFINE_PROC ("DB.DBA.RDF_TTL2SQLHASH", proc101);
-  DEFINE_PROC ("DB.DBA.RDF_LOAD_RDFXML", proc102);
-  DEFINE_PROC ("DB.DBA.RDF_RDFXML_TO_DICT", proc103);
-  DEFINE_PROC ("DB.DBA.RDF_LOAD_RDFA", proc104);
-  DEFINE_PROC ("DB.DBA.RDF_LOAD_RDFA_WITH_IRI_TRANSLATION", proc105);
-  DEFINE_PROC ("DB.DBA.RDF_RDFA_TO_DICT", proc106); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_XML_IRI_TO_TTL", proc107); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_XML_OBJ_TO_TTL", proc108); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_CONVERT_RDFXML_TO_TTL_EV_NEW_BLANK", proc109); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_CONVERT_RDFXML_TO_TTL_EV_TRIPLE", proc110); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_CONVERT_RDFXML_TO_TTL_EV_TRIPLE_L", proc111); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_CONVERT_RDFXML_TO_TTL", proc112); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_CONVERT_RDFXML_FILE_TO_TTL_FILE", proc113);
-  DEFINE_PROC ("DB.DBA.RDF_LONG_TO_TTL", proc114);
-  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_VERBOSE_TTL", proc115);
-  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_TTL", proc116);
-  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_NT", proc117);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_TO_TTL", proc118);
-  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_RDF_XML_TEXT", proc119);
-  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_TALIS_JSON", proc120);
-  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_JSON", proc121);
-  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_RDFA_XHTML", proc122);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_ATOM_XML", proc123);
-  DEFINE_PROC ("DB.DBA.ODATA_EDM_TYPE", proc124);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_ODATA_JSON", proc125);
-  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_ODATA_JSON", proc126);
-  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_ATOM_XML_TEXT", proc127);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_INIT", proc128);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_ACC", proc129);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_FIN", proc130);
+  DEFINE_PROC ("DB.DBA.RDF_REPL_START", proc13);
+  DEFINE_PROC ("DB.DBA.RDF_REPL_STOP", proc14);
+  DEFINE_PROC ("DB.DBA.RDF_REPL_GRAPH_INS", proc15);
+  DEFINE_PROC ("DB.DBA.RDF_REPL_GRAPH_DEL", proc16);
+  DEFINE_PROC ("DB.DBA.RDF_REPL_SYNC", proc17);
+  DEFINE_PROC ("DB.DBA.RDF_REPL_INSERT_TRIPLES", proc18);
+  DEFINE_PROC ("DB.DBA.RDF_REPL_DELETE_TRIPLES", proc19);
+  DEFINE_PROC ("DB.DBA.RDF_MAKE_IID_OF_QNAME", proc21);
+  DEFINE_PROC ("DB.DBA.RDF_MAKE_IID_OF_LONG", proc22);
+  DEFINE_PROC ("DB.DBA.RDF_MAKE_GRAPH_IIDS_OF_QNAMES", proc23);
+  DEFINE_PROC ("DB.DBA.RDF_TWOBYTE_OF_DATATYPE", proc24);
+  DEFINE_PROC ("DB.DBA.RDF_TWOBYTE_OF_LANGUAGE", proc25);
+  DEFINE_PROC ("DB.DBA.RQ_LONG_OF_O", proc26);
+  DEFINE_PROC ("DB.DBA.RDF_BOX_COMPLETE", proc27);
+  DEFINE_PROC ("DB.DBA.RQ_SQLVAL_OF_O", proc28);
+  DEFINE_PROC ("DB.DBA.RQ_BOOL_OF_O", proc29);
+  DEFINE_PROC ("DB.DBA.RQ_IID_OF_O", proc30);
+  DEFINE_PROC ("DB.DBA.RQ_O_IS_LIT", proc31);
+  DEFINE_PROC ("RDF_G_INS", proc32);
+  DEFINE_PROC ("cl_rdf_geo_insert", proc33);
+  DEFINE_PROC ("rdf_geo_add", proc34);
+  DEFINE_PROC ("rdf_geo_set_id", proc35);
+  DEFINE_PROC ("DB.DBA.RDF_OBJ_ADD", proc36);
+  DEFINE_PROC ("DB.DBA.RDF_FIND_RO_DIGEST", proc37);
+  DEFINE_PROC ("DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL", proc38);
+  DEFINE_PROC ("DB.DBA.RDF_MAKE_OBJ_OF_SQLVAL_FT", proc39);
+  DEFINE_PROC ("DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL", proc40);
+  DEFINE_PROC ("DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL_FT", proc41);
+  DEFINE_PROC ("DB.DBA.RDF_MAKE_OBJ_OF_TYPEDSQLVAL_STRINGS", proc42);
+  DEFINE_PROC ("DB.DBA.RDF_LONG_OF_OBJ", proc43);
+  DEFINE_PROC ("DB.DBA.RDF_DATATYPE_OF_OBJ", proc44);
+  DEFINE_PROC ("DB.DBA.RDF_LANGUAGE_OF_OBJ", proc45);
+  DEFINE_PROC ("DB.DBA.RDF_SQLVAL_OF_OBJ", proc46);
+  DEFINE_PROC ("DB.DBA.RDF_BOOL_OF_OBJ", proc47);
+  DEFINE_PROC ("DB.DBA.RDF_QNAME_OF_OBJ", proc48);
+  DEFINE_PROC ("DB.DBA.RDF_STRSQLVAL_OF_OBJ", proc49);
+  DEFINE_PROC ("DB.DBA.RDF_OBJ_OF_LONG", proc50);
+  DEFINE_PROC ("DB.DBA.RDF_OBJ_OF_LONG", proc51);
+  DEFINE_PROC ("DB.DBA.RDF_OBJ_OF_SQLVAL", proc52);
+  DEFINE_PROC ("DB.DBA.RDF_MAKE_LONG_OF_SQLVAL", proc53);
+  DEFINE_PROC ("DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL", proc54);
+  DEFINE_PROC ("DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL_STRINGS", proc55);
+  DEFINE_PROC ("DB.DBA.RDF_QNAME_OF_LONG_SAFE", proc56);
+  DEFINE_PROC ("DB.DBA.RDF_SQLVAL_OF_LONG", proc57);
+  DEFINE_PROC ("DB.DBA.RDF_BOOL_OF_LONG", proc58);
+  DEFINE_PROC ("DB.DBA.RDF_DATATYPE_OF_LONG", proc59);
+  DEFINE_PROC ("DB.DBA.RDF_DATATYPE_IRI_OF_LONG", proc60);
+  DEFINE_PROC ("DB.DBA.RDF_LANGUAGE_OF_LONG", proc61);
+  DEFINE_PROC ("DB.DBA.RDF_STRSQLVAL_OF_LONG", proc62);
+  DEFINE_PROC ("DB.DBA.RDF_WIDESTRSQLVAL_OF_LONG", proc63); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_DATATYPE_OF_SQLVAL", proc64);
+  DEFINE_PROC ("DB.DBA.RDF_LONG_OF_SQLVAL", proc65); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_STRSQLVAL_OF_SQLVAL", proc66); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_LANGUAGE_OF_SQLVAL", proc67); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_IS_BLANK_REF", proc68); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_IS_URI_REF", proc69); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_IS_REF", proc70); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_IS_LITERAL", proc71); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#boolean", proc72); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#date", proc73); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#dateTime", proc74); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#double", proc75); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#float", proc76); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#integer", proc77); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#int", proc78); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#time", proc79); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.http://www.w3.org/2001/XMLSchema#string", proc80); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.__and", proc81); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.__or", proc82); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.__not", proc83);
+  DEFINE_PROC ("DB.DBA.RDF_QUAD_URI", proc84);
+  DEFINE_PROC ("DB.DBA.RDF_QUAD_URI_L", proc85);
+  DEFINE_PROC ("DB.DBA.RDF_QUAD_URI_L_TYPED", proc86);
+  DEFINE_PROC ("DB.DBA.RDF_QUAD_L_RDB2RDF", proc87);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_NEW_GRAPH", proc88);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_NEW_BLANK", proc89);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_GET_IID", proc90);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE", proc91);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_L", proc92);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_COMMIT", proc93);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_REPORT_DEFAULT", proc94);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_XLAT", proc95);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_L_XLAT", proc96); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.TTLP_XLAT_CONCAT", proc97);
+  DEFINE_PROC ("DB.DBA.TTLP", proc98);
+  DEFINE_PROC ("DB.DBA.TTLP_WITH_IRI_TRANSLATION", proc99);
+  DEFINE_PROC ("DB.DBA.TTLP_VALIDATE", proc100);
+  DEFINE_PROC ("DB.DBA.TTLP_VALIDATE_LOCAL_FILE", proc101);
+  DEFINE_PROC ("DB.DBA.RDF_TTL2HASH_EXEC_NEW_GRAPH", proc102);
+  DEFINE_PROC ("DB.DBA.RDF_TTL2HASH_EXEC_NEW_BLANK", proc103);
+  DEFINE_PROC ("DB.DBA.RDF_TTL2HASH_EXEC_GET_IID", proc104);
+  DEFINE_PROC ("DB.DBA.RDF_TTL2HASH_EXEC_TRIPLE", proc105);
+  DEFINE_PROC ("DB.DBA.RDF_TTL2HASH_EXEC_TRIPLE_L", proc106);
+  DEFINE_PROC ("DB.DBA.RDF_TTL2HASH", proc107);
+  DEFINE_PROC ("DB.DBA.RDF_TTL2SQLHASH_EXEC_GET_IID", proc108);
+  DEFINE_PROC ("DB.DBA.RDF_TTL2SQLHASH_EXEC_TRIPLE", proc109);
+  DEFINE_PROC ("DB.DBA.RDF_TTL2SQLHASH_EXEC_TRIPLE_L", proc110);
+  DEFINE_PROC ("DB.DBA.RDF_TTL2SQLHASH", proc111);
+  DEFINE_PROC ("DB.DBA.RDF_LOAD_RDFXML", proc112);
+  DEFINE_PROC ("DB.DBA.RDF_RDFXML_TO_DICT", proc113);
+  DEFINE_PROC ("DB.DBA.RDF_LOAD_RDFA", proc114);
+  DEFINE_PROC ("DB.DBA.RDF_LOAD_RDFA_WITH_IRI_TRANSLATION", proc115);
+  DEFINE_PROC ("DB.DBA.RDF_RDFA_TO_DICT", proc116); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_XML_IRI_TO_TTL", proc117); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_XML_OBJ_TO_TTL", proc118); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_CONVERT_RDFXML_TO_TTL_EV_NEW_BLANK", proc119); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_CONVERT_RDFXML_TO_TTL_EV_TRIPLE", proc120); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_CONVERT_RDFXML_TO_TTL_EV_TRIPLE_L", proc121); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_CONVERT_RDFXML_TO_TTL", proc122); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_CONVERT_RDFXML_FILE_TO_TTL_FILE", proc123);
+  DEFINE_PROC ("DB.DBA.RDF_LONG_TO_TTL", proc124);
+  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_VERBOSE_TTL", proc125);
+  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_TTL", proc126);
+  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_NT", proc127);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_TO_TTL", proc128);
+  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_RDF_XML_TEXT", proc129);
+  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_TALIS_JSON", proc130);
+  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_JSON", proc131);
+  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_CSV", proc132);
+  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_RDFA_XHTML", proc133);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_ATOM_XML", proc134);
+  DEFINE_PROC ("DB.DBA.ODATA_EDM_TYPE", proc135);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_ODATA_JSON", proc136);
+  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_ODATA_JSON", proc137);
+  DEFINE_PROC ("DB.DBA.RDF_TRIPLES_TO_ATOM_XML_TEXT", proc138);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_INIT", proc139);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_ACC", proc140);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_TTL_FIN", proc141);
   ddl_ensure_table ("do this always", other16);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_INIT", proc131);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_ACC", proc132);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_FIN", proc133);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_INIT", proc142);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_ACC", proc143);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_NT_FIN", proc144);
   ddl_ensure_table ("do this always", other17);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_INIT", proc134);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_ACC", proc135);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_FIN", proc136);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_INIT", proc145);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_ACC", proc146);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_RDF_XML_FIN", proc147);
   ddl_ensure_table ("do this always", other18);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_INIT", proc137);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_ACC", proc138);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_FIN", proc139);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_INIT", proc148);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_ACC", proc149);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_FIN", proc150);
   ddl_ensure_table ("do this always", other19);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TTL", proc140);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_NT", proc141);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_RDF_XML", proc142);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TALIS_JSON", proc143);
-  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_RDFA_XHTML", proc144); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_INIT", proc145); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_ACC", proc146); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_FIN", proc147);
-  ddl_ensure_table ("do this always", other20); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_INIT", proc148); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_ACC", proc149); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_FIN", proc150);
-  ddl_ensure_table ("do this always", other21); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_INIT", proc151); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_ACC", proc152); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_FIN", proc153);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_INIT", proc151);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_CSV_WRITE_VALUE", proc152);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_ACC", proc153);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_CSV_FIN", proc154);
+  ddl_ensure_table ("do this always", other20);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_INIT", proc155);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_ACC", proc156);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_RESULT_SET_AS_CXML_FIN", proc157);
+  ddl_ensure_table ("do this always", other21);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TTL", proc158);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_NT", proc159);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_RDF_XML", proc160);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_TALIS_JSON", proc161);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CSV", proc162);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_RDFA_XHTML", proc163);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CXML", proc164);
+  DEFINE_PROC ("DB.DBA.RDF_FORMAT_TRIPLE_DICT_AS_CXML_QRCODE", proc165); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_INIT", proc166); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_ACC", proc167); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_XML_FIN", proc168);
   ddl_ensure_table ("do this always", other22); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_FIN", proc154);
-  ddl_ensure_table ("do this always", other23);
-  DEFINE_PROC ("DB.DBA.RDF_INSERT_TRIPLES_CL", proc155);
-  DEFINE_PROC ("DB.DBA.RDF_INSERT_TRIPLES", proc156);
-  DEFINE_PROC ("DB.DBA.RDF_DELETE_TRIPLES", proc157);
-  DEFINE_PROC ("DB.DBA.RDF_DELETE_TRIPLES_AGG", proc158);
-  DEFINE_PROC ("DB.DBA.RDF_MODIFY_TRIPLES", proc159); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_INS_OR_DEL_OR_MODIFY_CTOR_INIT", proc160); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_INS_OR_DEL_CTOR_IMPL", proc161); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_DELETE_CTOR_ACC", proc162); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_INSERT_CTOR_ACC", proc163); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_MODIFY_CTOR_ACC", proc164); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_INS_OR_DEL_OR_MODIFY_CTOR_FIN", proc165); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_INIT", proc169); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_ACC", proc170); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_RDF_XML_FIN", proc171);
+  ddl_ensure_table ("do this always", other23); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_INIT", proc172); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_ACC", proc173); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_TTL_FIN", proc174);
   ddl_ensure_table ("do this always", other24); 
-  ddl_ensure_table ("do this always", other25); 
-  ddl_ensure_table ("do this always", other26);
-  DEFINE_PROC ("DB.DBA.SPARQL_INSERT_DICT_CONTENT", proc166);
-  DEFINE_PROC ("DB.DBA.SPARQL_DELETE_DICT_CONTENT", proc167);
-  DEFINE_PROC ("DB.DBA.SPARQL_MODIFY_BY_DICT_CONTENTS", proc168);
-  DEFINE_PROC ("DB.DBA.SPARUL_CLEAR", proc169);
-  DEFINE_PROC ("DB.DBA.SPARUL_LOAD", proc170);
-  DEFINE_PROC ("DB.DBA.SPARUL_CREATE", proc171);
-  DEFINE_PROC ("DB.DBA.SPARUL_DROP", proc172);
-  DEFINE_PROC ("DB.DBA.SPARUL_RUN", proc173);
-  DEFINE_PROC ("DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS", proc174); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_REGEX", proc175); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_LANGMATCHES", proc176); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.BEST_LANGMATCH_INIT", proc177); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.BEST_LANGMATCH_ACC", proc178); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.BEST_LANGMATCH_FINAL", proc179); 
-  ddl_ensure_table ("do this always", other27); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_CONSTRUCT_INIT", proc180); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_CONSTRUCT_ACC", proc181); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_CONSTRUCT_FIN", proc182); 
-  ddl_ensure_table ("do this always", other28);
-  DEFINE_PROC ("DB.DBA.SPARQL_DESC_AGG_INIT", proc183);
-  DEFINE_PROC ("DB.DBA.SPARQL_DESC_AGG_ACC", proc184);
-  DEFINE_PROC ("DB.DBA.SPARQL_DESC_AGG_FIN", proc185);
-  ddl_ensure_table ("do this always", other29);
-  DEFINE_PROC ("DB.DBA.SPARQL_DESC_DICT", proc186);
-  DEFINE_PROC ("DB.DBA.SPARQL_DESC_DICT_SPO", proc187);
-  DEFINE_PROC ("DB.DBA.SPARQL_DESC_DICT_SPO_PHYSICAL", proc188);
-  DEFINE_PROC ("DB.DBA.SPARQL_DESC_DICT_CBD", proc189);
-  DEFINE_PROC ("DB.DBA.SPARQL_DESC_DICT_CBD_PHYSICAL", proc190); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_DICT_OF_TRIPLES_TO_THREE_COLS", proc191);
-  DEFINE_PROC ("DB.DBA.RDF_TYPEMIN_OF_OBJ", proc192);
-  DEFINE_PROC ("DB.DBA.RDF_TYPEMAX_OF_OBJ", proc193);
-  DEFINE_PROC ("DB.DBA.RDF_IID_CMP", proc194);
-  DEFINE_PROC ("DB.DBA.RDF_OBJ_CMP", proc195);
-  DEFINE_PROC ("DB.DBA.RDF_LONG_CMP", proc196); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_DIST_SER_LONG", proc197); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_DIST_DESER_LONG", proc198);
-  DEFINE_PROC ("JSO_MAKE_INHERITANCE", proc199);
-  DEFINE_PROC ("JSO_LOAD_INSTANCE", proc200);
-  DEFINE_PROC ("JSO_LIST_INSTANCES_OF_GRAPH", proc201);
-  DEFINE_PROC ("JSO_LOAD_GRAPH", proc202);
-  DEFINE_PROC ("JSO_PIN_GRAPH", proc203); 
-  DEFINE_PUBLIC_PROC ("JSO_SYS_GRAPH", proc204);
-  DEFINE_PROC ("JSO_LOAD_AND_PIN_SYS_GRAPH_RO", proc205);
-  DEFINE_PROC ("JSO_LOAD_AND_PIN_SYS_GRAPH", proc206);
-  DEFINE_PROC ("JSO_DUMP_IRI", proc207);
-  DEFINE_PROC ("JSO_DUMP_FLD", proc208);
-  DEFINE_PROC ("DB.DBA.JSO_VECTOR_TO_TTL", proc209);
-  DEFINE_PROC ("DB.DBA.JSO_FILTERED_PROPLIST", proc210);
-  DEFINE_PROC ("DB.DBA.JSO_DUMP_ALL", proc211);
-  DEFINE_PROC ("DB.DBA.RDF_BACKUP_METADATA", proc212);
-  DEFINE_PROC ("DB.DBA.RDF_RESTORE_METADATA", proc213);
-  DEFINE_PROC ("DB.DBA.RDF_AUDIT_METADATA", proc214);
-  DEFINE_PROC ("DB.DBA.RDF_QM_CHANGE", proc215);
-  DEFINE_PROC ("DB.DBA.RDF_QM_CHANGE_OPT", proc216);
-  DEFINE_PROC ("DB.DBA.RDF_QM_APPLY_CHANGES", proc217);
-  DEFINE_PROC ("DB.DBA.RDF_QM_ASSERT_JSO_TYPE", proc218);
-  DEFINE_PROC ("DB.DBA.RDF_QM_ASSERT_STORAGE_FLAG", proc219);
-  DEFINE_PROC ("DB.DBA.RDF_QM_ASSERT_STORAGE_CONTAINS_MAPPING", proc220);
-  DEFINE_PROC ("DB.DBA.RDF_QM_ASSERT_STORAGE_IS_FLAGGED", proc221);
-  DEFINE_PROC ("DB.DBA.RDF_QM_GC_SUBTREE", proc222);
-  DEFINE_PROC ("DB.DBA.RDF_QM_GC_MAPPING_SUBTREE", proc223);
-  DEFINE_PROC ("DB.DBA.RDF_QM_DROP_MAPPING", proc224);
-  DEFINE_PROC ("DB.DBA.RDF_QM_MACROEXPAND_TEMPLATE", proc225);
-  DEFINE_PROC ("DB.DBA.RDF_QM_CBD_OF_IRI_CLASS", proc226);
-  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_IRI_CLASS_FORMAT", proc227);
-  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_IRI_CLASS_FUNCTIONS", proc228);
-  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_LITERAL_CLASS_FUNCTIONS", proc229); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_BAD_CLASS_INV_FUNCTION", proc230); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SQLNAME_NOTATION_TO_NAME", proc231); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SQLQNAME_NOTATION_TO_QNAME", proc232);
-  DEFINE_PROC ("DB.DBA.RDF_QM_CHECK_CLASS_FUNCTION_HEADERS", proc233);
-  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_SUBCLASS", proc234);
-  DEFINE_PROC ("DB.DBA.RDF_QM_DROP_CLASS", proc235);
-  DEFINE_PROC ("DB.DBA.RDF_QM_DROP_QUAD_STORAGE", proc236);
-  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_QUAD_STORAGE", proc237);
-  DEFINE_PROC ("DB.DBA.RDF_QM_BEGIN_ALTER_QUAD_STORAGE", proc238);
-  DEFINE_PROC ("DB.DBA.RDF_QM_END_ALTER_QUAD_STORAGE", proc239);
-  DEFINE_PROC ("DB.DBA.RDF_QM_STORE_ATABLES", proc240);
-  DEFINE_PROC ("DB.DBA.RDF_QM_FT_USAGE", proc241);
-  DEFINE_PROC ("DB.DBA.RDF_QM_CHECK_COLUMNS_FORM_KEY", proc242);
-  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_MAP_VALUE", proc243);
-  DEFINE_PROC ("DB.DBA.RDF_QM_NORMALIZE_QMV", proc244);
-  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_MAPPING", proc245);
-  DEFINE_PROC ("DB.DBA.RDF_QM_ATTACH_MAPPING", proc246);
-  DEFINE_PROC ("DB.DBA.RDF_QM_ADD_MAPPING_TO_STORAGE", proc247);
-  DEFINE_PROC ("DB.DBA.RDF_QM_DELETE_MAPPING_FROM_STORAGE", proc248);
-  DEFINE_PROC ("DB.DBA.RDF_QM_SET_DEFAULT_MAPPING", proc249);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_W", proc250);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_L_W", proc251);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_NEW_GRAPH_A", proc252);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_A", proc253);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_L_A", proc254);
-  DEFINE_PROC ("DB.DBA.TTLP_EV_COMMIT_A", proc255);
-  DEFINE_PROC ("DB.DBA.TTLP_MT", proc256);
-  DEFINE_PROC ("DB.DBA.TTLP_MT_LOCAL_FILE", proc257);
-  DEFINE_PROC ("DB.DBA.RDF_LOAD_RDFXML_MT", proc258);
-  DEFINE_PROC ("DB.DBA.VT_DECODE_KEYWORD_ITM", proc259);
-  DEFINE_PROC ("DB.DBA.VT_ENCODE_KEYWORD_ITM", proc260);
-  DEFINE_PROC ("DB.DBA.VT_COMPOSE_KEYWORD_INDEX_LINES", proc261); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_OBJ_PATCH_CONTAINS_BY_GRAPH", proc262); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_OBJ_PATCH_CONTAINS_BY_MANY_GRAPHS", proc263);
-  DEFINE_PROC ("DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH", proc264);
-  DEFINE_PROC ("DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH_OLD", proc265);
-  DEFINE_PROC ("DB.DBA.RDF_OBJ_FT_RULE_ADD", proc266);
-  DEFINE_PROC ("DB.DBA.RDF_OBJ_FT_RULE_DEL", proc267);
-  DEFINE_PROC ("DB.DBA.RDF_OBJ_FT_RECOVER", proc268);
-  ddl_ensure_table ("DB.DBA.RDF_GRAPH_GROUP", tbl14);
-  ddl_ensure_table ("DB.DBA.RDF_GRAPH_GROUP_MEMBER", tbl15);
-  ddl_ensure_table ("DB.DBA.RDF_GRAPH_USER", tbl16);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_CREATE_MEMONLY", proc269);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_CREATE", proc270);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_DROP_MEMONLY", proc271);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_DROP", proc272);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_CHECK_VISIBILITY_CHANGE", proc273);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_INS_MEMONLY", proc274);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_INS", proc275);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_DEL_MEMONLY", proc276);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_DEL", proc277);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_USER_PERMS_GET", proc278);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_USER_PERMS_ACK", proc279); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_GRAPH_USER_PERM_TITLE", proc280);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_USER_PERMS_ASSERT", proc281);
-  DEFINE_PROC ("DB.DBA.RDF_DEFAULT_USER_PERMS_SET_MEMONLY", proc282);
-  DEFINE_PROC ("DB.DBA.RDF_DEFAULT_USER_PERMS_SET", proc283);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_USER_PERMS_SET_MEMONLY", proc284);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_USER_PERMS_SET", proc285);
-  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_LIST_GET", proc286);
-  DEFINE_PROC ("DB.DBA.SPARQL_RELOAD_QM_GRAPH", proc287);
-  DEFINE_PROC ("DB.DBA.RDF_CREATE_SPARQL_ROLES", proc288);
-  DEFINE_PROC ("DB.DBA.RDF_QUAD_AUDIT", proc289);
-  DEFINE_PROC ("DB.DBA.RDF_QUAD_FT_UPGRADE", proc290);
-  ddl_ensure_table ("do this always", other31);
-  DEFINE_PROC ("rdfs_pn", proc291);
-  DEFINE_PROC ("rdf_owl_sas_p", proc292);
-  ddl_ensure_table ("DB.DBA.SYS_RDF_SCHEMA", tbl17);
-  DEFINE_PROC ("rdfs_load_schema", proc293);
-  DEFINE_PROC ("rdf_schema_ld", proc294);
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_NT_FIN", proc175);
+  ddl_ensure_table ("do this always", other25);
+  ddl_ensure_table ("do this always", other26); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FORMAT_BOOL_RESULT_AS_CSV_FIN", proc176);
+  ddl_ensure_table ("do this always", other27);
+  DEFINE_PROC ("DB.DBA.RDF_INSERT_TRIPLES_CL", proc177);
+  DEFINE_PROC ("DB.DBA.RDF_INSERT_TRIPLES", proc178);
+  DEFINE_PROC ("DB.DBA.RDF_DELETE_TRIPLES", proc179);
+  DEFINE_PROC ("DB.DBA.RDF_DELETE_TRIPLES_AGG", proc180);
+  DEFINE_PROC ("DB.DBA.RDF_MODIFY_TRIPLES", proc181); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_INS_OR_DEL_OR_MODIFY_CTOR_INIT", proc182); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_INS_OR_DEL_CTOR_IMPL", proc183); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_DELETE_CTOR_ACC", proc184); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_INSERT_CTOR_ACC", proc185); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_MODIFY_CTOR_ACC", proc186); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_INS_OR_DEL_OR_MODIFY_CTOR_FIN", proc187); 
+  ddl_ensure_table ("do this always", other28); 
+  ddl_ensure_table ("do this always", other29); 
+  ddl_ensure_table ("do this always", other30);
+  DEFINE_PROC ("DB.DBA.SPARQL_INSERT_DICT_CONTENT", proc188);
+  DEFINE_PROC ("DB.DBA.SPARQL_DELETE_DICT_CONTENT", proc189);
+  DEFINE_PROC ("DB.DBA.SPARQL_MODIFY_BY_DICT_CONTENTS", proc190);
+  DEFINE_PROC ("DB.DBA.RDF_REPL_DEL", proc191);
+  DEFINE_PROC ("DB.DBA.SPARUL_CLEAR", proc192);
+  DEFINE_PROC ("DB.DBA.SPARUL_LOAD", proc193);
+  DEFINE_PROC ("DB.DBA.SPARUL_CREATE", proc194);
+  DEFINE_PROC ("DB.DBA.SPARUL_DROP", proc195);
+  DEFINE_PROC ("DB.DBA.SPARUL_RUN", proc196);
+  DEFINE_PROC ("DB.DBA.SPARQL_SELECT_KNOWN_GRAPHS", proc197); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_REGEX", proc198); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_LANGMATCHES", proc199); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.BEST_LANGMATCH_INIT", proc200); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.BEST_LANGMATCH_ACC", proc201); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.BEST_LANGMATCH_FINAL", proc202); 
+  ddl_ensure_table ("do this always", other31); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_CONSTRUCT_INIT", proc203); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_CONSTRUCT_ACC", proc204); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_CONSTRUCT_FIN", proc205); 
   ddl_ensure_table ("do this always", other32);
-  DEFINE_PROC ("CL_RDF_INF_CHANGED_SRV", proc295);
-  DEFINE_PROC ("CL_RDF_INF_CHANGED", proc296);
-  DEFINE_PROC ("rdfs_rule_set", proc297);
-  DEFINE_PROC ("DB.DBA.RDF_IID_OF_QNAME", proc298);
-  DEFINE_PROC ("SPARQL_INI_PARAMS", proc299);
+  DEFINE_PROC ("DB.DBA.SPARQL_DESC_AGG_INIT", proc206);
+  DEFINE_PROC ("DB.DBA.SPARQL_DESC_AGG_ACC", proc207);
+  DEFINE_PROC ("DB.DBA.SPARQL_DESC_AGG_FIN", proc208);
+  ddl_ensure_table ("do this always", other33);
+  DEFINE_PROC ("DB.DBA.SPARQL_DESC_DICT", proc209);
+  DEFINE_PROC ("DB.DBA.SPARQL_DESC_DICT_SPO", proc210);
+  DEFINE_PROC ("DB.DBA.SPARQL_DESC_DICT_SPO_PHYSICAL", proc211);
+  DEFINE_PROC ("DB.DBA.SPARQL_DESC_DICT_CBD", proc212);
+  DEFINE_PROC ("DB.DBA.SPARQL_DESC_DICT_CBD_PHYSICAL", proc213); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_DICT_OF_TRIPLES_TO_THREE_COLS", proc214);
+  DEFINE_PROC ("DB.DBA.RDF_TYPEMIN_OF_OBJ", proc215);
+  DEFINE_PROC ("DB.DBA.RDF_TYPEMAX_OF_OBJ", proc216);
+  DEFINE_PROC ("DB.DBA.RDF_IID_CMP", proc217);
+  DEFINE_PROC ("DB.DBA.RDF_OBJ_CMP", proc218);
+  DEFINE_PROC ("DB.DBA.RDF_LONG_CMP", proc219); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_DIST_SER_LONG", proc220); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_DIST_DESER_LONG", proc221);
+  DEFINE_PROC ("DB.DBA.JSO_MAKE_INHERITANCE", proc222);
+  DEFINE_PROC ("DB.DBA.JSO_LOAD_INSTANCE", proc223);
+  DEFINE_PROC ("DB.DBA.JSO_LIST_INSTANCES_OF_GRAPH", proc224);
+  DEFINE_PROC ("DB.DBA.JSO_LOAD_GRAPH", proc225);
+  DEFINE_PROC ("DB.DBA.JSO_PIN_GRAPH", proc226); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.JSO_SYS_GRAPH", proc227);
+  DEFINE_PROC ("DB.DBA.JSO_LOAD_AND_PIN_SYS_GRAPH_RO", proc228);
+  DEFINE_PROC ("DB.DBA.JSO_LOAD_AND_PIN_SYS_GRAPH", proc229);
+  DEFINE_PROC ("DB.DBA.JSO_DUMP_IRI", proc230);
+  DEFINE_PROC ("DB.DBA.JSO_DUMP_FLD", proc231);
+  DEFINE_PROC ("DB.DBA.JSO_VECTOR_TO_TTL", proc232);
+  DEFINE_PROC ("DB.DBA.JSO_FILTERED_PROPLIST", proc233);
+  DEFINE_PROC ("DB.DBA.JSO_DUMP_ALL", proc234);
+  DEFINE_PROC ("DB.DBA.RDF_BACKUP_METADATA", proc235);
+  DEFINE_PROC ("DB.DBA.RDF_RESTORE_METADATA", proc236);
+  DEFINE_PROC ("DB.DBA.RDF_AUDIT_METADATA", proc237);
+  DEFINE_PROC ("DB.DBA.RDF_QM_CHANGE", proc238);
+  DEFINE_PROC ("DB.DBA.RDF_QM_CHANGE_OPT", proc239);
+  DEFINE_PROC ("DB.DBA.RDF_QM_APPLY_CHANGES", proc240);
+  DEFINE_PROC ("DB.DBA.RDF_QM_ASSERT_JSO_TYPE", proc241);
+  DEFINE_PROC ("DB.DBA.RDF_QM_ASSERT_STORAGE_FLAG", proc242);
+  DEFINE_PROC ("DB.DBA.RDF_QM_ASSERT_STORAGE_CONTAINS_MAPPING", proc243);
+  DEFINE_PROC ("DB.DBA.RDF_QM_ASSERT_STORAGE_IS_FLAGGED", proc244);
+  DEFINE_PROC ("DB.DBA.RDF_QM_GC_SUBTREE", proc245);
+  DEFINE_PROC ("DB.DBA.RDF_QM_GC_MAPPING_SUBTREE", proc246);
+  DEFINE_PROC ("DB.DBA.RDF_QM_DROP_MAPPING", proc247);
+  DEFINE_PROC ("DB.DBA.RDF_QM_MACROEXPAND_TEMPLATE", proc248);
+  DEFINE_PROC ("DB.DBA.RDF_QM_CBD_OF_IRI_CLASS", proc249);
+  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_IRI_CLASS_FORMAT", proc250);
+  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_IRI_CLASS_FUNCTIONS", proc251);
+  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_LITERAL_CLASS_FUNCTIONS", proc252); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_BAD_CLASS_INV_FUNCTION", proc253); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SQLNAME_NOTATION_TO_NAME", proc254); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SQLQNAME_NOTATION_TO_QNAME", proc255);
+  DEFINE_PROC ("DB.DBA.RDF_QM_CHECK_CLASS_FUNCTION_HEADERS", proc256);
+  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_SUBCLASS", proc257);
+  DEFINE_PROC ("DB.DBA.RDF_QM_DROP_CLASS", proc258);
+  DEFINE_PROC ("DB.DBA.RDF_QM_DROP_QUAD_STORAGE", proc259);
+  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_QUAD_STORAGE", proc260);
+  DEFINE_PROC ("DB.DBA.RDF_QM_BEGIN_ALTER_QUAD_STORAGE", proc261);
+  DEFINE_PROC ("DB.DBA.RDF_QM_END_ALTER_QUAD_STORAGE", proc262);
+  DEFINE_PROC ("DB.DBA.RDF_QM_STORE_ATABLES", proc263);
+  DEFINE_PROC ("DB.DBA.RDF_QM_FT_USAGE", proc264);
+  DEFINE_PROC ("DB.DBA.RDF_QM_CHECK_COLUMNS_FORM_KEY", proc265);
+  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_MAP_VALUE", proc266);
+  DEFINE_PROC ("DB.DBA.RDF_QM_NORMALIZE_QMV", proc267);
+  DEFINE_PROC ("DB.DBA.RDF_QM_DEFINE_MAPPING", proc268);
+  DEFINE_PROC ("DB.DBA.RDF_QM_ATTACH_MAPPING", proc269);
+  DEFINE_PROC ("DB.DBA.RDF_QM_ADD_MAPPING_TO_STORAGE", proc270);
+  DEFINE_PROC ("DB.DBA.RDF_QM_DELETE_MAPPING_FROM_STORAGE", proc271);
+  DEFINE_PROC ("DB.DBA.RDF_QM_SET_DEFAULT_MAPPING", proc272);
+  DEFINE_PROC ("DB.DBA.RDF_ADD_qmAliasesKeyrefdByQuad", proc273);
+  DEFINE_PROC ("DB.DBA.RDF_UPGRADE_QUAD_MAP", proc274);
+  DEFINE_PROC ("DB.DBA.RDF_UPGRADE_METADATA", proc275);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_W", proc276);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_L_W", proc277);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_NEW_GRAPH_A", proc278);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_A", proc279);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_L_A", proc280);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_COMMIT_A", proc281);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_R", proc282);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_TRIPLE_L_R", proc283);
+  DEFINE_PROC ("DB.DBA.TTLP_EV_COMMIT_R", proc284);
+  DEFINE_PROC ("DB.DBA.TTLP_MT", proc285);
+  DEFINE_PROC ("DB.DBA.TTLP_MT_LOCAL_FILE", proc286);
+  DEFINE_PROC ("DB.DBA.RDF_LOAD_RDFXML_MT", proc287);
+  DEFINE_PROC ("DB.DBA.VT_DECODE_KEYWORD_ITM", proc288);
+  DEFINE_PROC ("DB.DBA.VT_ENCODE_KEYWORD_ITM", proc289);
+  DEFINE_PROC ("DB.DBA.VT_COMPOSE_KEYWORD_INDEX_LINES", proc290); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_OBJ_PATCH_CONTAINS_BY_GRAPH", proc291); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_OBJ_PATCH_CONTAINS_BY_MANY_GRAPHS", proc292);
+  DEFINE_PROC ("DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH", proc293);
+  DEFINE_PROC ("DB.DBA.RDF_OBJ_ADD_KEYWORD_FOR_GRAPH_OLD", proc294);
+  DEFINE_PROC ("DB.DBA.RDF_OBJ_FT_RULE_ADD", proc295);
+  DEFINE_PROC ("DB.DBA.RDF_OBJ_FT_RULE_DEL", proc296);
+  DEFINE_PROC ("DB.DBA.RDF_OBJ_FT_RECOVER", proc297);
+  ddl_ensure_table ("DB.DBA.RDF_GRAPH_GROUP", tbl15);
+  ddl_ensure_table ("DB.DBA.RDF_GRAPH_GROUP_MEMBER", tbl16);
+  ddl_ensure_table ("DB.DBA.RDF_GRAPH_USER", tbl17);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_CREATE_MEMONLY", proc298);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_CREATE", proc299);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_DROP_MEMONLY", proc300);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_DROP", proc301);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_CHECK_VISIBILITY_CHANGE", proc302);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_INS_MEMONLY", proc303);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_INS", proc304);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_DEL_MEMONLY", proc305);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_DEL", proc306);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_USER_PERMS_GET", proc307);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_USER_PERMS_ACK", proc308); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_GRAPH_USER_PERM_TITLE", proc309);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_USER_PERMS_ASSERT", proc310);
+  DEFINE_PROC ("DB.DBA.RDF_DEFAULT_USER_PERMS_SET_MEMONLY", proc311);
+  DEFINE_PROC ("DB.DBA.RDF_DEFAULT_USER_PERMS_SET", proc312);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_USER_PERMS_SET_MEMONLY", proc313);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_USER_PERMS_SET", proc314);
+  DEFINE_PROC ("DB.DBA.RDF_GRAPH_GROUP_LIST_GET", proc315);
+  DEFINE_PROC ("DB.DBA.SPARQL_RELOAD_QM_GRAPH", proc316);
+  DEFINE_PROC ("DB.DBA.RDF_CREATE_SPARQL_ROLES", proc317);
+  DEFINE_PROC ("DB.DBA.RDF_QUAD_AUDIT", proc318);
+  DEFINE_PROC ("DB.DBA.RDF_QUAD_FT_UPGRADE", proc319);
+  ddl_ensure_table ("do this always", other35);
+  DEFINE_PROC ("rdfs_pn", proc320);
+  DEFINE_PROC ("rdf_owl_sas_p", proc321);
+  ddl_ensure_table ("DB.DBA.SYS_RDF_SCHEMA", tbl18);
+  DEFINE_PROC ("rdfs_load_schema", proc322);
+  DEFINE_PROC ("rdf_schema_ld", proc323);
+  ddl_ensure_table ("do this always", other36);
+  DEFINE_PROC ("CL_RDF_INF_CHANGED_SRV", proc324);
+  DEFINE_PROC ("CL_RDF_INF_CHANGED", proc325);
+  DEFINE_PROC ("rdfs_rule_set", proc326);
+  DEFINE_PROC ("DB.DBA.RDF_IID_OF_QNAME", proc327);
+  DEFINE_PROC ("SPARQL_INI_PARAMS", proc328);
 
   /* sparql_io.sql */
  
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_XML_WRITE_NS", proc300); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_XML_WRITE_HEAD", proc301); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_XML_HTTP_PRE", proc302); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_XML_HTTP_INIT", proc303); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_XML_HTTP_FINAL", proc304); 
-  ddl_ensure_table ("do this always", other33); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_DICT_XML_HTTP_PRE", proc305); 
-  ddl_ensure_table ("do this always", other34); 
-  DEFINE_PUBLIC_PROC ("SPARQL_RSET_TTL_WRITE_NS", proc306); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_TTL_WRITE_HEAD", proc307); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_TTL_HTTP_PRE", proc308); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_TTL_HTTP_INIT", proc309); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_TTL_HTTP_FINAL", proc310); 
-  ddl_ensure_table ("do this always", other35); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_NT_WRITE_NS", proc311); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_NT_WRITE_HEAD", proc312); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_NT_HTTP_PRE", proc313); 
-  ddl_ensure_table ("do this always", other36);
-  DEFINE_PROC ("DB.DBA.SPARQL_REXEC_INT", proc314);
-  DEFINE_PROC ("DB.DBA.SPARQL_REXEC", proc315);
-  DEFINE_PROC ("DB.DBA.SPARQL_REXEC_TO_ARRAY", proc316);
-  DEFINE_PROC ("DB.DBA.SPARQL_REXEC_TO_ARRAY_OF_OBJ", proc317);
-  DEFINE_PROC ("DB.DBA.SPARQL_REXEC_WITH_META", proc318);
-  DEFINE_PROC ("DB.DBA.SPARQL_SINV_IMP", proc319);
-  ddl_ensure_table ("DB.DBA.SPARQL_SINV", view0);
-  DEFINE_PROC ("querySoap", proc320); 
-  DEFINE_PUBLIC_PROC ("SPARQL_WRITE_EXEC_STATUS", proc321);
-  DEFINE_PROC ("SPARQL_RESULTS_XML_WRITE_HEAD", proc322);
-  DEFINE_PROC ("SPARQL_RESULTS_XML_WRITE_RES", proc323);
-  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_XML_WRITE_ROW", proc324);
-  DEFINE_PROC ("SPARQL_RESULTS_RDFXML_WRITE_NS", proc325);
-  DEFINE_PROC ("SPARQL_RESULTS_RDFXML_WRITE_HEAD", proc326);
-  DEFINE_PROC ("SPARQL_RESULTS_RDFXML_WRITE_RES", proc327);
-  DEFINE_PROC ("SPARQL_RESULTS_RDFXML_WRITE_ROW", proc328);
-  DEFINE_PROC ("SPARQL_RESULTS_TTL_WRITE_NS", proc329);
-  DEFINE_PROC ("SPARQL_RESULTS_TTL_WRITE_HEAD", proc330);
-  DEFINE_PROC ("SPARQL_RESULTS_TTL_WRITE_RES", proc331);
-  DEFINE_PROC ("SPARQL_RESULTS_NT_WRITE_NS", proc332);
-  DEFINE_PROC ("SPARQL_RESULTS_NT_WRITE_HEAD", proc333);
-  DEFINE_PROC ("SPARQL_RESULTS_NT_WRITE_RES", proc334);
-  DEFINE_PROC ("SPARQL_RESULTS_JAVASCRIPT_HTML_WRITE", proc335);
-  DEFINE_PROC ("SPARQL_RESULTS_JSON_WRITE_BINDING", proc336);
-  DEFINE_PROC ("SPARQL_RESULTS_JSON_WRITE", proc337);
-  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_WRITE", proc338);
-  DEFINE_PROC ("WS.WS.SPARQL_VHOST_RESET", proc339);
-  DEFINE_PROC ("DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT", proc340);
-  DEFINE_PROC ("DB.DBA.SPARQL_WSDL11", proc341);
-  DEFINE_PROC ("DB.DBA.SPARQL_WSDL", proc342);
-  DEFINE_PROC ("DB.DBA.SPARQL_SOAP_NS", proc343);
-  DEFINE_PROC ("DB.DBA.SPARQL_PT_NS", proc344); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.PARSE_SPARQL_WS_PARAMS", proc345);
-  DEFINE_PROC ("DB.DBA.rdf_find_str", proc346);
-  ddl_ensure_table ("do this always", other37);
-  DEFINE_PROC ("WS.WS./!sparql/", proc347);
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_XML_WRITE_NS", proc329); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_XML_WRITE_HEAD", proc330); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_XML_HTTP_PRE", proc331); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_XML_HTTP_INIT", proc332); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_XML_HTTP_FINAL", proc333); 
+  ddl_ensure_table ("do this always", other37); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_DICT_XML_HTTP_PRE", proc334); 
   ddl_ensure_table ("do this always", other38); 
-  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_ROUTE_IF_DAV", proc348);
-  DEFINE_PROC ("DB.DBA.SPARQL_ROUTE_DICT_CONTENT_DAV", proc349);
-  DEFINE_PROC ("WS.WS.__http_handler_rq", proc350);
-  DEFINE_PROC ("WS.WS.__http_handler_head_rq", proc351);
-  DEFINE_PROC ("DB.DBA.http_rq_file_handler", proc352);
-  DEFINE_PROC ("DB.DBA.RDF_GRANT_SPARQL_IO", proc353);
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_TTL_WRITE_NS", proc335); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_TTL_WRITE_HEAD", proc336); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_TTL_HTTP_PRE", proc337); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_TTL_HTTP_INIT", proc338); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_TTL_HTTP_FINAL", proc339); 
+  ddl_ensure_table ("do this always", other39); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_NT_WRITE_NS", proc340); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_NT_WRITE_HEAD", proc341); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_RSET_NT_HTTP_PRE", proc342); 
+  ddl_ensure_table ("do this always", other40);
+  DEFINE_PROC ("DB.DBA.SPARQL_REXEC_INT", proc343);
+  DEFINE_PROC ("DB.DBA.SPARQL_REXEC", proc344);
+  DEFINE_PROC ("DB.DBA.SPARQL_REXEC_TO_ARRAY", proc345);
+  DEFINE_PROC ("DB.DBA.SPARQL_REXEC_TO_ARRAY_OF_OBJ", proc346);
+  DEFINE_PROC ("DB.DBA.SPARQL_REXEC_WITH_META", proc347);
+  DEFINE_PROC ("DB.DBA.SPARQL_SINV_IMP", proc348);
+  ddl_ensure_table ("DB.DBA.SPARQL_SINV_2", view0);
+  DEFINE_PROC ("querySoap", proc349); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_WRITE_EXEC_STATUS", proc350);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_XML_WRITE_HEAD", proc351);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_XML_WRITE_RES", proc352);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_XML_WRITE_ROW", proc353);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_RDFXML_WRITE_NS", proc354);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_RDFXML_WRITE_HEAD", proc355);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_RDFXML_WRITE_RES", proc356);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_RDFXML_WRITE_ROW", proc357);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_TTL_WRITE_NS", proc358);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_TTL_WRITE_HEAD", proc359);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_TTL_WRITE_RES", proc360);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_NT_WRITE_NS", proc361);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_NT_WRITE_HEAD", proc362);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_NT_WRITE_RES", proc363);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_JAVASCRIPT_HTML_WRITE", proc364);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_JSON_WRITE_BINDING", proc365);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_JSON_WRITE", proc366);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_CSV_WRITE", proc367);
+  DEFINE_PROC ("DB.DBA.SPARQL_RESULTS_WRITE", proc368);
+  DEFINE_PROC ("WS.WS.SPARQL_VHOST_RESET", proc369);
+  DEFINE_PROC ("DB.DBA.SPARQL_PROTOCOL_ERROR_REPORT", proc370);
+  DEFINE_PROC ("DB.DBA.SPARQL_WSDL11", proc371);
+  DEFINE_PROC ("DB.DBA.SPARQL_WSDL", proc372);
+  DEFINE_PROC ("DB.DBA.SPARQL_SOAP_NS", proc373);
+  DEFINE_PROC ("DB.DBA.SPARQL_PT_NS", proc374); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.PARSE_SPARQL_WS_PARAMS", proc375);
+  DEFINE_PROC ("DB.DBA.rdf_find_str", proc376);
+  ddl_ensure_table ("do this always", other41);
+  DEFINE_PROC ("WS.WS.sparql_enpoint_format_opts", proc377);
+  DEFINE_PROC ("WS.WS./!sparql/", proc378);
+  ddl_ensure_table ("do this always", other42);
+  DEFINE_PROC ("DB.DBA.SPARQL_REFRESH_DYNARES_RESULTS", proc379); 
+  DEFINE_PUBLIC_PROC ("DB.DBA.SPARQL_ROUTE_IF_DAV", proc380);
+  DEFINE_PROC ("DB.DBA.SPARQL_ROUTE_DICT_CONTENT_DAV", proc381);
+  DEFINE_PROC ("WS.WS.__http_handler_rq", proc382);
+  DEFINE_PROC ("WS.WS.__http_handler_head_rq", proc383);
+  DEFINE_PROC ("DB.DBA.http_rq_file_handler", proc384);
+  DEFINE_PROC ("DB.DBA.RDF_GRANT_SPARQL_IO", proc385);
 
   /* rdf_sponge.sql */
  
-  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FT_INDEX_GRABBED", proc354);
-  DEFINE_PROC ("DB.DBA.RDF_GRAB_SINGLE", proc355);
-  DEFINE_PROC ("DB.DBA.RDF_GRAB_SINGLE_ASYNC", proc356);
-  DEFINE_PROC ("DB.DBA.RDF_GRAB_SEEALSO", proc357);
-  DEFINE_PROC ("DB.DBA.RDF_GRAB", proc358);
-  DEFINE_PROC ("DB.DBA.RDF_GRAB_RESOLVER_DEFAULT", proc359);
-  DEFINE_PROC ("DB.DBA.SPARQL_EVAL_TO_ARRAY", proc360);
-  DEFINE_PROC ("DB.DBA.SPARQL_EVAL", proc361);
-  ddl_ensure_table ("DB.DBA.SYS_HTTP_SPONGE", tbl18);
-  DEFINE_PROC ("DB.DBA.SYS_HTTP_SPONGE_GET_CACHE_PARAMS", proc362);
-  DEFINE_PROC ("DB.DBA.SYS_HTTP_SPONGE_DEP_URL_NOT_CHANGED", proc363);
-  DEFINE_PROC ("DB.DBA.RDF_HTTP_MAKE_HTTP_REQ", proc364);
-  DEFINE_PROC ("DB.DBA.SYS_HTTP_SPONGE_UP", proc365);
-  DEFINE_PROC ("DB.DBA.SYS_FILE_SPONGE_UP", proc366);
-  DEFINE_PROC ("DB.DBA.RDF_SPONGE_GUESS_CONTENT_TYPE", proc367);
-  ddl_ensure_table ("DB.DBA.SYS_RDF_MAPPERS", tbl19);
-  DEFINE_PROC ("DB.DBA.RDF_HTTP_URL_GET", proc368);
-  DEFINE_PROC ("DB.DBA.RDF_SW_PING", proc369);
-  DEFINE_PROC ("DB.DBA.RDF_PROC_COLS", proc370);
-  DEFINE_PROC ("DB.DBA.RDF_LOAD_HTTP_RESPONSE", proc371);
-  DEFINE_PROC ("DB.DBA.RDF_FORGET_HTTP_RESPONSE", proc372);
-  DEFINE_PROC ("DB.DBA.RDF_SPONGE_UP", proc373);
-  DEFINE_PROC ("DB.DBA.RDF_SPONGE_UP_1", proc374);
-  DEFINE_PROC ("DB.DBA.RDF_SPONGE_UP_LIST", proc375);
-  DEFINE_PROC ("DB.DBA.RDF_GRANT_SPONGE", proc376);
+  DEFINE_PUBLIC_PROC ("DB.DBA.RDF_FT_INDEX_GRABBED", proc386);
+  DEFINE_PROC ("DB.DBA.RDF_GRAB_SINGLE", proc387);
+  DEFINE_PROC ("DB.DBA.RDF_GRAB_SINGLE_ASYNC", proc388);
+  DEFINE_PROC ("DB.DBA.RDF_GRAB_SEEALSO", proc389);
+  DEFINE_PROC ("DB.DBA.RDF_GRAB", proc390);
+  DEFINE_PROC ("DB.DBA.RDF_GRAB_RESOLVER_DEFAULT", proc391);
+  DEFINE_PROC ("DB.DBA.SPARQL_EVAL_TO_ARRAY", proc392);
+  DEFINE_PROC ("DB.DBA.SPARQL_EVAL", proc393);
+  ddl_ensure_table ("DB.DBA.SYS_HTTP_SPONGE", tbl19);
+  DEFINE_PROC ("DB.DBA.SYS_HTTP_SPONGE_GET_CACHE_PARAMS", proc394);
+  DEFINE_PROC ("DB.DBA.SYS_HTTP_SPONGE_DEP_URL_NOT_CHANGED", proc395);
+  DEFINE_PROC ("DB.DBA.RDF_HTTP_MAKE_HTTP_REQ", proc396);
+  DEFINE_PROC ("DB.DBA.SYS_HTTP_SPONGE_UP", proc397);
+  DEFINE_PROC ("DB.DBA.SYS_FILE_SPONGE_UP", proc398);
+  DEFINE_PROC ("DB.DBA.RDF_SPONGE_GUESS_CONTENT_TYPE", proc399);
+  ddl_ensure_table ("DB.DBA.SYS_RDF_MAPPERS", tbl20);
+  DEFINE_PROC ("DB.DBA.RDF_HTTP_URL_GET", proc400);
+  DEFINE_PROC ("DB.DBA.RDF_SW_PING", proc401);
+  DEFINE_PROC ("DB.DBA.RDF_PROC_COLS", proc402);
+  DEFINE_PROC ("DB.DBA.RDF_LOAD_HTTP_RESPONSE", proc403);
+  DEFINE_PROC ("DB.DBA.RDF_FORGET_HTTP_RESPONSE", proc404);
+  DEFINE_PROC ("DB.DBA.RDF_SPONGE_UP", proc405);
+  DEFINE_PROC ("DB.DBA.RDF_SPONGE_UP_1", proc406);
+  DEFINE_PROC ("DB.DBA.RDF_SPONGE_UP_LIST", proc407);
+  DEFINE_PROC ("DB.DBA.RDF_GRANT_SPONGE", proc408);
 
   /* rdf_schema_objects.sql */
 
-  DEFINE_PROC ("rdf_view_tbl_opts", proc377);
-  DEFINE_PROC ("rdf_view_tbl_pk_cols", proc378);
-  DEFINE_PROC ("rdf_view_ns_get", proc379);
-  DEFINE_PROC ("rdf_view_ns_get_1", proc380);
-  DEFINE_PROC ("RDF_VIEW_DROP_STMT", proc381);
-  DEFINE_PROC ("RDF_VIEW_FROM_TBL", proc382);
-  DEFINE_PROC ("rdf_view_sp", proc383);
-  DEFINE_PROC ("rdf_view_sql_tb", proc384);
-  DEFINE_PROC ("rdf_view_tb", proc385);
-  DEFINE_PROC ("rdf_view_sql_col", proc386);
-  DEFINE_PROC ("rdf_view_col", proc387);
-  DEFINE_PROC ("rdf_view_cls_name", proc388);
-  DEFINE_PROC ("rdf_view_get_ns", proc389);
-  DEFINE_PROC ("rdf_view_uri_curie", proc390);
-  DEFINE_PROC ("rdf_view_col_type", proc391);
-  DEFINE_PROC ("rdf_view_create_view", proc392);
-  DEFINE_PROC ("rdf_view_create_void_view", proc393);
-  DEFINE_PROC ("rdf_view_get_pk_rel", proc394);
-  DEFINE_PROC ("rdf_view_get_bin_rel", proc395);
-  DEFINE_PROC ("rdf_view_get_fk_pk_rel", proc396);
-  DEFINE_PROC ("rdf_view_get_pk_fk_rel", proc397);
-  DEFINE_PROC ("rdf_view_dv_to_printf_str_type", proc398);
-  DEFINE_PROC ("rdf_view_dv_to_sql_str_type", proc399);
-  DEFINE_PROC ("rdf_view_dv_to_xsd_str_type", proc400);
-  DEFINE_PROC ("rdf_view_create_class", proc401);
-  DEFINE_PROC ("rdf_view_get_primary_key", proc402);
-  DEFINE_PROC ("rdf_view_get_relations", proc403);
-  DEFINE_PROC ("RDF_OWL_FROM_TBL", proc404);
-  DEFINE_PROC ("RDF_VIEW_GEN_VD", proc405);
-  DEFINE_PROC ("RDF_OWL_GEN_VD", proc406);
+  DEFINE_PROC ("rdf_view_tbl_opts", proc409);
+  DEFINE_PROC ("rdf_view_tbl_pk_cols", proc410);
+  DEFINE_PROC ("rdf_view_ns_get", proc411);
+  DEFINE_PROC ("rdf_view_ns_get_1", proc412);
+  DEFINE_PROC ("RDF_VIEW_DROP_STMT", proc413);
+  DEFINE_PROC ("RDF_VIEW_FROM_TBL", proc414);
+  DEFINE_PROC ("rdf_view_sp", proc415);
+  DEFINE_PROC ("rdf_view_sql_tb", proc416);
+  DEFINE_PROC ("rdf_view_tb", proc417);
+  DEFINE_PROC ("rdf_view_sql_col", proc418);
+  DEFINE_PROC ("rdf_view_col", proc419);
+  DEFINE_PROC ("rdf_view_cls_name", proc420);
+  DEFINE_PROC ("rdf_view_get_ns", proc421);
+  DEFINE_PROC ("rdf_view_uri_curie", proc422);
+  DEFINE_PROC ("rdf_view_col_type", proc423);
+  DEFINE_PROC ("rdf_view_create_view", proc424);
+  DEFINE_PROC ("rdf_view_create_void_view", proc425);
+  DEFINE_PROC ("rdf_view_get_pk_rel", proc426);
+  DEFINE_PROC ("rdf_view_get_bin_rel", proc427);
+  DEFINE_PROC ("rdf_view_get_fk_pk_rel", proc428);
+  DEFINE_PROC ("rdf_view_get_pk_fk_rel", proc429);
+  DEFINE_PROC ("rdf_view_dv_to_printf_str_type", proc430);
+  DEFINE_PROC ("rdf_view_dv_to_sql_str_type", proc431);
+  DEFINE_PROC ("rdf_view_dv_to_xsd_str_type", proc432);
+  DEFINE_PROC ("rdf_view_create_class", proc433);
+  DEFINE_PROC ("rdf_view_get_primary_key", proc434);
+  DEFINE_PROC ("rdf_view_get_relations", proc435);
+  DEFINE_PROC ("RDF_OWL_FROM_TBL", proc436);
+  DEFINE_PROC ("RDF_VIEW_GEN_VD", proc437);
+  DEFINE_PROC ("RDF_OWL_GEN_VD", proc438);
+  DEFINE_PROC ("RDF_VIEW_CHECK_SYNC_TB", proc439);
+  DEFINE_PROC ("RDF_VIEW_DO_SYNC", proc440);
 
   /* rdf_void.sql */
 
-  ddl_ensure_table ("DB.DBA.RDF_VOID_GRAPH", tbl20);
-  ddl_ensure_table ("DB.DBA.RDF_VOID_GRAPH_MEMBER", tbl21);
-  DEFINE_PROC ("RDF_VOID_INIT", proc407);
-  ddl_ensure_table ("do this always", other41);
-  DEFINE_PROC ("RDF_VOID_SPLIT_IRI", proc408);
-  DEFINE_PROC ("RDF_VOID_STORE", proc409);
-  DEFINE_PROC ("RDF_VOID_ALL_GEN", proc410);
-  DEFINE_PROC ("RDF_VOID_NS", proc411);
-  DEFINE_PROC ("RDF_VOID_GEN", proc412);
-  DEFINE_PROC ("RDF_VOID_DIST_O_SRV", proc413);
-  DEFINE_PROC ("RDF_VOID_DIST_O", proc414);
-  DEFINE_PROC ("RDF_VOID_GEN_1", proc415);
+  ddl_ensure_table ("DB.DBA.RDF_VOID_GRAPH", tbl21);
+  ddl_ensure_table ("DB.DBA.RDF_VOID_GRAPH_MEMBER", tbl22);
+  DEFINE_PROC ("RDF_VOID_INIT", proc441);
+  ddl_ensure_table ("do this always", other45);
+  DEFINE_PROC ("RDF_VOID_SPLIT_IRI", proc442);
+  DEFINE_PROC ("RDF_VOID_STORE", proc443);
+  DEFINE_PROC ("RDF_VOID_ALL_GEN", proc444);
+  DEFINE_PROC ("RDF_VOID_NS", proc445);
+  DEFINE_PROC ("RDF_VOID_GEN", proc446);
+  DEFINE_PROC ("RDF_VOID_DIST_O_SRV", proc447);
+  DEFINE_PROC ("RDF_VOID_DIST_O", proc448);
+  DEFINE_PROC ("RDF_VOID_GEN_1", proc449);
+
+  /* rdflddir2.sql */
+
+  ddl_ensure_table ("DB.DBA.LOAD_LIST", tbl23);
+  ddl_ensure_table ("DB.DBA.LDLOCK", tbl24);
+  ddl_ensure_table ("do this always", other46);
+  DEFINE_PROC ("ld_dir", proc450);
+  DEFINE_PROC ("rdf_read_dir", proc451);
+  DEFINE_PROC ("ld_dir_all", proc452);
+  DEFINE_PROC ("ld_add", proc453);
+  DEFINE_PROC ("ld_ttlp_flags", proc454);
+  DEFINE_PROC ("ld_file", proc455);
+  DEFINE_PROC ("rdf_load_dir", proc456);
+  DEFINE_PROC ("ld_array", proc457);
+  DEFINE_PROC ("rdf_loader_run", proc458);
+  DEFINE_PROC ("rdf_load_stop", proc459);
+  DEFINE_PROC ("RDF_LOADER_RUN_1", proc460);
+  DEFINE_PROC ("rdf_ld_srv", proc461);
+  DEFINE_PROC ("load_grdf", proc462);
 }
 
 
@@ -17729,17 +20077,17 @@ sqls_arfw_define_sparql (void)
   ddl_ensure_table ("do this always", other0);
   ddl_ensure_table ("do this always", other1);
   ddl_ensure_table ("do this always", other2);
-  DEFINE_PROC ("DB.DBA.RDF_GLOBAL_RESET", proc13);
-  ddl_ensure_table ("do this always", other30);
+  DEFINE_PROC ("DB.DBA.RDF_GLOBAL_RESET", proc20);
+  ddl_ensure_table ("do this always", other34);
 
   /* sparql_io.sql */
 
  if (sch_proc_def_exists (bootstrap_cli, "DB.DBA.USER_CREATE"))
-  ddl_ensure_table ("do this always", other39);
+  ddl_ensure_table ("do this always", other43);
 
   /* rdf_sponge.sql */
 
  if (sch_proc_def_exists (bootstrap_cli, "DB.DBA.USER_CREATE"))
-  ddl_ensure_table ("do this always", other40);
+  ddl_ensure_table ("do this always", other44);
 
 }
diff --git a/libsrc/Wi/sql_code_sys.c b/libsrc/Wi/sql_code_sys.c
index c064422..3962e51 100644
--- a/libsrc/Wi/sql_code_sys.c
+++ b/libsrc/Wi/sql_code_sys.c
@@ -11,6 +11,7 @@ static const char *view0 =
 "from SYS_ROLE_GRANTS where GI_DIRECT = 1\n";
 
 static const char *trig0 = 
+"#line 42 \"[executable]/users.sql\"\n"
 "create trigger SYS_ROLE_GRANTS_REVOKE after delete on SYS_ROLE_GRANTS referencing old as O\n"
 "{\n"
 "declare super, sub, grantor integer;\n"
@@ -29,9 +30,10 @@ static const char *trig0 =
 "delete from SYS_ROLE_GRANTS where GI_GRANT = super and GI_SUB = sub;\n"
 "\n"
 "}\n"
-"--src users.sql:41\n";
+"--src users.sql:40\n";
 
 static const char *trig1 = 
+"#line 62 \"[executable]/users.sql\"\n"
 "create trigger SYS_ROLE_GRANTS_GRANT after insert on SYS_ROLE_GRANTS referencing new as N\n"
 "{\n"
 "\n"
@@ -47,9 +49,10 @@ static const char *trig1 =
 "sec_grant_user_role (GI_SUPER, N.GI_SUB);\n"
 "}\n"
 "}\n"
-"--src users.sql:61\n";
+"--src users.sql:60\n";
 
 static const char *trig2 = 
+"#line 80 \"[executable]/users.sql\"\n"
 "create trigger SYS_PRIMARY_GROUP_NULLIFY after delete on SYS_USERS referencing old as O\n"
 "{\n"
 "declare gid integer;\n"
@@ -78,9 +81,10 @@ static const char *trig2 =
 "i := i + 2;\n"
 "}\n"
 "}\n"
-"--src users.sql:79\n";
+"--src users.sql:78\n";
 
 static const char *proc0 = 
+"#line 143 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "GET_SEC_OBJECT_ID (in _name varchar, out id integer, out is_sql integer, out opts any)\n"
 "{\n"
@@ -127,17 +131,20 @@ static const char *proc0 =
 "nf:\n"
 "signal (\'42000\', sprintf (\'The object \"%s\" does not exist.\', _name), \'U0002\');\n"
 "}\n"
-"--src users.sql:142\n";
+"--src users.sql:141\n";
 
 static const char *proc1 = 
+"#line 191 \"[executable]/users.sql\"\n"
 "create procedure DB.DBA.SECURITY_CL_EXEC_AND_LOG (in txt varchar, in args any)\n"
 "{\n"
+"set_user_id (\'dba\');\n"
 "cl_exec (txt, args);\n"
 "cl_exec (\'log_text_array (?, ?)\', vector (txt, args), 1);\n"
 "}\n"
-"--src users.sql:190\n";
+"--src users.sql:189\n";
 
 static const char *proc2 = 
+"#line 199 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_CREATE (in _name varchar, in passwd varchar, in options any := NULL)\n"
 "{\n"
@@ -219,15 +226,15 @@ static const char *proc2 =
 "_pwd_mode, _pwd_mode_data, _get_pwd, _login_qual,\n"
 "_u_home, _u_perms);\n"
 "\n"
-"if (_sql_enable)\n"
+"if (not _sql_enable) /* pure web accounts must be disabled for odbc/sql login */\n"
 "{\n"
+"_disabled := 1;\n"
+"}\n"
 "DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'sec_set_user_struct (?,?,?,?,?,?,?)\', vector (\n"
 "_name, passwd, _u_id, _prim_group_id, concat (\'Q \', _login_qual), 0, _u_sys_name, _u_sys_pass ) );\n"
 "if (_disabled = 1)\n"
 "{\n"
-"DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'sec_user_enable (?, ?)\', vector (\n"
-"_name, 0 ) );\n"
-"}\n"
+"DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'sec_user_enable (?, ?)\', vector (_name, 0));\n"
 "}\n"
 "\n"
 "return _u_id;\n"
@@ -235,6 +242,7 @@ static const char *proc2 =
 "--src users.sql:197\n";
 
 static const char *proc3 = 
+"#line 296 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_ROLE_CREATE (in _name varchar, in is_dav integer := 0)\n"
 "{\n"
@@ -251,14 +259,13 @@ static const char *proc3 =
 "if (is_dav)\n"
 "_sql_enable := 0;\n"
 "insert into SYS_USERS (U_ID, U_NAME, U_GROUP, U_IS_ROLE, U_DAV_ENABLE, U_SQL_ENABLE) values (_g_id, _name, _g_id, 1, is_dav, _sql_enable);\n"
-"if (_sql_enable)\n"
-"DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'sec_set_user_struct (?,?,?,?,?,?)\',\n"
-"vector (_name, \'\', _g_id, _g_id, NULL, 1) );\n"
+"DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'sec_set_user_struct (?,?,?,?,?,?)\', vector (_name, \'\', _g_id, _g_id, NULL, 1) );\n"
 "return _g_id;\n"
 "}\n"
 "--src users.sql:294\n";
 
 static const char *proc4 = 
+"#line 317 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_ROLE_DROP (in _name varchar)\n"
 "{\n"
@@ -274,9 +281,10 @@ static const char *proc4 =
 "if (_u_is_sql)\n"
 "DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'sec_remove_user_struct(?)\', vector (_name));\n"
 "}\n"
-"--src users.sql:317\n";
+"--src users.sql:315\n";
 
 static const char *proc5 = 
+"#line 334 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_CHANGE_PASSWORD (in _name varchar, in old_pwd varchar, in new_pwd varchar)\n"
 "{\n"
@@ -294,9 +302,10 @@ static const char *proc5 =
 "else\n"
 "signal (\'37000\', concat (\'The user \'\'\', _name, \'\'\' does not exist\'), \'U0009\');\n"
 "}\n"
-"--src users.sql:334\n";
+"--src users.sql:332\n";
 
 static const char *proc6 = 
+"#line 353 \"[executable]/users.sql\"\n"
 "create procedure USER_PASSWORD_SET (in name varchar, in passwd varchar)\n"
 "{\n"
 "declare _u_id, _u_group integer;\n"
@@ -316,9 +325,10 @@ static const char *proc6 =
 "update DB.DBA.SYS_USERS set U_PASSWORD = pwd_magic_calc (name, passwd) where U_NAME = name;\n"
 "return 0;\n"
 "}\n"
-"--src users.sql:353\n";
+"--src users.sql:351\n";
 
 static const char *proc7 = 
+"#line 374 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_SET_QUALIFIER (in _name varchar, in qual varchar)\n"
 "{\n"
@@ -334,17 +344,19 @@ static const char *proc7 =
 "signal (\'37000\', concat (\'The user \'\'\', _name, \'\'\' does not exist\'), \'U0010\');\n"
 "}\n"
 "}\n"
-"--src users.sql:374\n";
+"--src users.sql:372\n";
 
 static const char *proc8 = 
+"#line 392 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_SET_ROLE (in _name varchar, in new_role varchar)\n"
 "{\n"
 "signal (\'42000\', \'Not implemented.\');\n"
 "}\n"
-"--src users.sql:392\n";
+"--src users.sql:390\n";
 
 static const char *proc9 = 
+"#line 399 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "GET_INHERITED_GRANTS (in g_id integer, in prim integer, inout inh any)\n"
 "{\n"
@@ -364,9 +376,10 @@ static const char *proc9 =
 "}\n"
 "}\n"
 "}\n"
-"--src users.sql:399\n";
+"--src users.sql:397\n";
 
 static const char *proc10 = 
+"#line 421 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_GRANT_ROLE (in _name varchar, in _role varchar, in grant_opt integer := 0)\n"
 "{\n"
@@ -427,9 +440,10 @@ static const char *proc10 =
 "}\n"
 "}\n"
 "}\n"
-"--src users.sql:421\n";
+"--src users.sql:419\n";
 
 static const char *proc11 = 
+"#line 483 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_REVOKE_ROLE (in _name varchar, in _role varchar)\n"
 "{\n"
@@ -464,9 +478,10 @@ static const char *proc11 =
 "\n"
 "\n"
 "}\n"
-"--src users.sql:483\n";
+"--src users.sql:481\n";
 
 static const char *proc12 = 
+"#line 520 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_DROP (in _name varchar, in _cascade integer := 0)\n"
 "{\n"
@@ -520,9 +535,10 @@ static const char *proc12 =
 "if (_u_is_sql)\n"
 "DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'sec_remove_user_struct(?)\', vector (_name));\n"
 "}\n"
-"--src users.sql:520\n";
+"--src users.sql:518\n";
 
 static const char *proc13 = 
+"#line 575 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_SET_OPTION (in _name varchar, in opt varchar, in value any)\n"
 "{\n"
@@ -596,29 +612,20 @@ static const char *proc13 =
 "U_ACCOUNT_DISABLED = _disabled\n"
 "where U_NAME = _name;\n"
 "\n"
-"if (_sql_enable)\n"
+"if (not _sql_enable) /* pure web accounts must be disabled for odbc/sql login */\n"
 "{\n"
+"_disabled := 1;\n"
+"}\n"
 "select pwd_magic_calc (U_NAME, U_PASSWORD, 1) into passwd from SYS_USERS where U_NAME = _name;\n"
 "DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'sec_set_user_struct (?,?,?,?,?)\',\n"
-"vector (\n"
-"_name, passwd, _u_id, _u_group_id,\n"
-"case when _login_qual is not null then concat (\'Q \', _login_qual) else NULL end ) );\n"
-"DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'sec_user_enable (?, ?)\',\n"
-"vector (_name, case when _disabled = 0 then 1 else 0 end) );\n"
-"}\n"
-"else\n"
-"{\n"
-"declare exit handler for sqlstate \'28000\'\n"
-"{\n"
-"goto done;\n"
-"};\n"
-"DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'sec_remove_user_struct(?)\', vector (_name));\n"
-"done:;\n"
-"}\n"
+"vector (_name, passwd, _u_id, _u_group_id,\n"
+"case when length (_login_qual) then concat (\'Q \', _login_qual) else NULL end));\n"
+"DB.DBA.SECURITY_CL_EXEC_AND_LOG (\'sec_user_enable (?, ?)\', vector (_name, case when _disabled = 0 then 1 else 0 end));\n"
 "}\n"
-"--src users.sql:575\n";
+"--src users.sql:573\n";
 
 static const char *proc14 = 
+"#line 661 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_GET_OPTION (in _name varchar, in opt varchar)\n"
 "{\n"
@@ -627,25 +634,28 @@ static const char *proc14 =
 "GET_SEC_OBJECT_ID (_name, _u_id, _u_is_sql, opts);\n"
 "return get_keyword_ucase (upper (opt), opts, NULL);\n"
 "}\n"
-"--src users.sql:671\n";
+"--src users.sql:659\n";
 
 static const char *proc15 = 
+"#line 672 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_MGR_SET_OPTION (in opt varchar, in val varchar)\n"
 "{\n"
 "signal (\'42000\', \'Not implemented.\');\n"
 "}\n"
-"--src users.sql:682\n";
+"--src users.sql:670\n";
 
 static const char *proc16 = 
+"#line 680 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_MGR_GET_OPTION (in opt varchar) returns varchar\n"
 "{\n"
 "signal (\'42000\', \'Not implemented.\');\n"
 "}\n"
-"--src users.sql:690\n";
+"--src users.sql:678\n";
 
 static const char *proc17 = 
+"#line 698 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "LIST_USER_ROLE_GRANTS ()\n"
 "{\n"
@@ -673,9 +683,10 @@ static const char *proc17 =
 "i := i + 2;\n"
 "}\n"
 "}\n"
-"--src users.sql:708\n";
+"--src users.sql:696\n";
 
 static const char *proc18 = 
+"#line 727 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_KEY_IS_FILE (in f varchar, out path varchar)\n"
 "{\n"
@@ -691,9 +702,10 @@ static const char *proc18 =
 "else\n"
 "return 0;\n"
 "}\n"
-"--src users.sql:737\n";
+"--src users.sql:725\n";
 
 static const char *proc19 = 
+"#line 745 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_KEY_STORE (in username varchar, in key_name varchar, in key_type varchar, in key_format varchar, in key_passwd varchar, in key_value varchar := NULL)\n"
 "{\n"
@@ -719,9 +731,10 @@ static const char *proc19 =
 "keys := vector_concat (keys, vector (key_name, vector (key_type, key_format, key_value, key_passwd)));\n"
 "USER_SET_OPTION (username, \'KEYS\', keys);\n"
 "}\n"
-"--src users.sql:755\n";
+"--src users.sql:743\n";
 
 static const char *proc20 = 
+"#line 773 \"[executable]/users.sql\"\n"
 " create procedure\n"
 "USER_KEY_DELETE (in username varchar, in key_name varchar)\n"
 "{\n"
@@ -739,9 +752,10 @@ static const char *proc20 =
 "USER_SET_OPTION (username, \'KEYS\', keys);\n"
 "}\n"
 "}\n"
-"--src users.sql:783\n";
+"--src users.sql:771\n";
 
 static const char *proc21 = 
+"#line 793 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_KEYS_INIT (in username varchar, in opts any)\n"
 "{\n"
@@ -824,9 +838,10 @@ static const char *proc21 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src users.sql:803\n";
+"--src users.sql:791\n";
 
 static const char *proc22 = 
+"#line 877 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "__USER_LOAD_KEY_BY_TYPE (inout key_name varchar, inout key_value any, inout key_type any, inout fmt int, inout key_pkey any, inout key_passwd any)\n"
 "{\n"
@@ -858,9 +873,10 @@ static const char *proc22 =
 "signal (\'22023\', \'Unknown key type\');\n"
 "}\n"
 "}\n"
-"--src users.sql:887\n";
+"--src users.sql:875\n";
 
 static const char *proc23 = 
+"#line 911 \"[executable]/users.sql\"\n"
 " create procedure\n"
 "USER_KEY_LOAD (\n"
 "in key_name varchar,\n"
@@ -890,9 +906,10 @@ static const char *proc23 =
 "__USER_LOAD_KEY_BY_TYPE (key_name, key_value, key_type, fmt, key_pkey, key_passwd);\n"
 "USER_KEY_STORE (user, key_name, key_type, fmt, case store_pwd when 1 then key_passwd else NULL end, cert);\n"
 "}\n"
-"--src users.sql:921\n";
+"--src users.sql:909\n";
 
 static const char *proc24 = 
+"#line 942 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_CERT_REGISTER (in username varchar, in cert varchar, in pwd varchar := \'\', in coding varchar := \'PKCS12\')\n"
 "{\n"
@@ -925,9 +942,10 @@ static const char *proc24 =
 "USER_SET_OPTION (username, \'LOGIN_CERTIFICATES\', certs);\n"
 "sec_set_user_cert (username, cfp);\n"
 "}\n"
-"--src users.sql:952\n";
+"--src users.sql:940\n";
 
 static const char *proc25 = 
+"#line 976 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USER_CERT_UNREGISTER (in username varchar, in cert varchar, in pwd varchar := \'\', in coding varchar := \'PKCS12\')\n"
 "{\n"
@@ -970,9 +988,10 @@ static const char *proc25 =
 "USER_SET_OPTION (username, \'LOGIN_CERTIFICATES\', new_certs);\n"
 "sec_remove_user_cert (username, cfp);\n"
 "}\n"
-"--src users.sql:986\n";
+"--src users.sql:974\n";
 
 static const char *proc26 = 
+"#line 1021 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "\"DB\".\"DBA\".\"USER_CERT_LOGIN\" (\n"
 "inout user_name varchar,\n"
@@ -1033,9 +1052,10 @@ static const char *proc26 =
 "}\n"
 "return rc;\n"
 "}\n"
-"--src users.sql:1031\n";
+"--src users.sql:1019\n";
 
 static const char *proc27 = 
+"#line 1083 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "SET_USER_OS_ACOUNT (in username varchar, in os_u_name varchar,\n"
 "in os_u_pass varchar, in only_check_sys_user integer := 0)\n"
@@ -1052,11 +1072,12 @@ static const char *proc27 =
 "concat (\'Can\'\'t login system user \', os_u_name, \'. Logon failure: unknown user name or bad password.\'),\n"
 "\'SR359\');\n"
 "}\n"
-"--src users.sql:1093\n";
+"--src users.sql:1081\n";
 
 static const char *other0 = 
 "grant execute on \"DB.DBA.SET_USER_OS_ACOUNT\" to public\n";
 static const char *proc28 = 
+"#line 1104 \"[executable]/users.sql\"\n"
 "create procedure DB.DBA.__DDL_TABLE_FIND_DEPS (in tb varchar, inout deps any)\n"
 "{\n"
 "declare tb_key_id integer;\n"
@@ -1115,9 +1136,10 @@ static const char *proc28 =
 "if (get_keyword (tb, deps, 0) = 0)\n"
 "deps := vector_concat (deps, vector (tb, 1));\n"
 "}\n"
-"--src users.sql:1114\n";
+"--src users.sql:1102\n";
 
 static const char *proc29 = 
+"#line 1165 \"[executable]/users.sql\"\n"
 "create procedure DB.DBA.__DDL_GET_DROP_USER_TABLES (in owner varchar)\n"
 "{\n"
 "declare deps any;\n"
@@ -1131,9 +1153,10 @@ static const char *proc29 =
 "\n"
 "return deps;\n"
 "}\n"
-"--src users.sql:1175\n";
+"--src users.sql:1163\n";
 
 static const char *proc30 = 
+"#line 1181 \"[executable]/users.sql\"\n"
 "create procedure DB.DBA.__UPDATE_SOAP_USERS_ACCESS ()\n"
 "{\n"
 "\n"
@@ -1162,7 +1185,7 @@ static const char *proc30 =
 "log_message (\'The user petshop is deleted.\');\n"
 "}\n"
 "}\n"
-"--src users.sql:1191\n";
+"--src users.sql:1179\n";
 
 static const char *other1 = 
 "DB.DBA.__UPDATE_SOAP_USERS_ACCESS ()\n";
@@ -1181,6 +1204,7 @@ static const char *tbl0 =
 ")\n";
 
 static const char *proc31 = 
+"#line 1231 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "DB.DBA.LDAP_LOGIN (inout user_name varchar, in digest varchar, in session_random varchar)\n"
 "{\n"
@@ -1258,7 +1282,7 @@ static const char *proc31 =
 "LDAP_VALIDATION_FAILURE:\n"
 "return 0;\n"
 "}\n"
-"--src users.sql:1241\n";
+"--src users.sql:1229\n";
 
 static const char *tbl1 = 
 "create table SYS_USER_WEBID (UW_U_NAME varchar, UW_WEBID varchar, primary key (UW_WEBID))\n"
@@ -1266,6 +1290,7 @@ static const char *tbl1 =
 "create index SYS_USER_WEBID_NAME on SYS_USER_WEBID (UW_U_NAME) partition cluster replicated\n";
 
 static const char *proc32 = 
+"#line 1316 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "DB.DBA.FOAF_SSL_LOGIN (inout user_name varchar, in digest varchar, in session_random varchar)\n"
 "{\n"
@@ -1342,9 +1367,10 @@ static const char *proc32 =
 "commit work;\n"
 "return rc;\n"
 "}\n"
-"--src users.sql:1326\n";
+"--src users.sql:1314\n";
 
 static const char *proc33 = 
+"#line 1394 \"[executable]/users.sql\"\n"
 "create procedure\n"
 "USERS_GET_DEF_QUAL (in dta varchar)\n"
 "{\n"
@@ -1355,7 +1381,7 @@ static const char *proc33 =
 "dta := split_and_decode (dta, 0, \'   \');\n"
 "return (get_keyword (\'Q\', dta, \'\'));\n"
 "}\n"
-"--src users.sql:1404\n";
+"--src users.sql:1392\n";
 
 static int
 sch_proc_def_exists (client_connection_t *cli, const char *proc_name)
diff --git a/libsrc/Wi/sql_code_uddi.c b/libsrc/Wi/sql_code_uddi.c
index 471922e..db05a2c 100644
--- a/libsrc/Wi/sql_code_uddi.c
+++ b/libsrc/Wi/sql_code_uddi.c
@@ -156,6 +156,7 @@ static const char *tbl13 =
 "create index IN_IDPARENT on INSTANCE_DETAIL (ID_BINDING_KEY, ID_TMODEL_KEY)\n";
 
 static const char *proc0 = 
+"#line 276 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "LOAD_UDDI_TAXONOMY ()\n"
 "{\n"
@@ -361,12 +362,13 @@ static const char *proc0 =
 "registry_set (\'UDDI_operator\', \'OpenLink Software\');\n"
 "\n"
 "}\n"
-"--src uddi.sql:275\n";
+"--src uddi.sql:274\n";
 
 
 static const char *other0 = 
 " LOAD_UDDI_TAXONOMY ()\n";
 static const char *proc1 = 
+"#line 489 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_BUSINESS_ENTITY (inout req any)\n"
 "{\n"
@@ -437,9 +439,10 @@ static const char *proc1 =
 "return bk;\n"
 "\n"
 "}\n"
-"--src uddi.sql:488\n";
+"--src uddi.sql:487\n";
 
 static const char *proc2 = 
+"#line 562 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_SAVE_BUSINESS (in uddi_req any)\n"
 "{\n"
@@ -484,9 +487,10 @@ static const char *proc2 =
 "return (string_output_string(ses));\n"
 "\n"
 "}\n"
-"--src uddi.sql:561\n";
+"--src uddi.sql:560\n";
 
 static const char *proc3 = 
+"#line 610 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_DESCRIPRIONS (in id any, in type varchar, inout desc_s any)\n"
 "{\n"
@@ -509,9 +513,10 @@ static const char *proc3 =
 "idx := idx + 1;\n"
 "}\n"
 "}\n"
-"--src uddi.sql:609\n";
+"--src uddi.sql:608\n";
 
 static const char *proc4 = 
+"#line 636 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_BUSINESS_SERVICES (in id varchar, in type varchar, inout services any, in owner integer)\n"
 "{\n"
@@ -533,9 +538,10 @@ static const char *proc4 =
 "idx := idx + 1;\n"
 "}\n"
 "}\n"
-"--src uddi.sql:635\n";
+"--src uddi.sql:634\n";
 
 static const char *proc5 = 
+"#line 661 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_BUSINESS_SERVICE (in id varchar, in type varchar, inout service any, in owner integer)\n"
 "{\n"
@@ -591,9 +597,10 @@ static const char *proc5 =
 "\n"
 "return sk;\n"
 "}\n"
-"--src uddi.sql:660\n";
+"--src uddi.sql:659\n";
 
 static const char *proc6 = 
+"#line 720 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_BINDING_TEMPLATES (in id varchar, in type varchar, inout templates any, in owner integer)\n"
 "{\n"
@@ -618,9 +625,10 @@ static const char *proc6 =
 "return res;\n"
 "\n"
 "}\n"
-"--src uddi.sql:719\n";
+"--src uddi.sql:718\n";
 
 static const char *proc7 = 
+"#line 748 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_BINDING_TEMPLATE (in id varchar, in type varchar, inout template any, in owner integer)\n"
 "{\n"
@@ -663,9 +671,10 @@ static const char *proc7 =
 "\n"
 "return bin_k;\n"
 "}\n"
-"--src uddi.sql:747\n";
+"--src uddi.sql:746\n";
 
 static const char *proc8 = 
+"#line 794 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_TMODEL_INSTANCE_DETAILS (in id varchar, in bin_k varchar, in type varchar, inout i_det any)\n"
 "{\n"
@@ -686,9 +695,10 @@ static const char *proc8 =
 "}\n"
 "\n"
 "}\n"
-"--src uddi.sql:793\n";
+"--src uddi.sql:792\n";
 
 static const char *proc9 = 
+"#line 817 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_TMODEL_INSTANCE_INFOS_1 (in id varchar, in bin_k varchar, in type varchar, inout i_det any)\n"
 "{\n"
@@ -717,9 +727,10 @@ static const char *proc9 =
 "SAVE_OVERVIEW_DOC (in_k, \'tModelInstanceInfo\', xpath_eval (\'instanceDetails/overviewDoc\', i_det, 1));\n"
 "\n"
 "}\n"
-"--src uddi.sql:816\n";
+"--src uddi.sql:815\n";
 
 static const char *proc10 = 
+"#line 849 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_IDENTIFIER_BAG (in id varchar, in type varchar, inout i_bag any)\n"
 "{\n"
@@ -753,9 +764,10 @@ static const char *proc10 =
 "idx := idx + 1;\n"
 "}\n"
 "}\n"
-"--src uddi.sql:848\n";
+"--src uddi.sql:847\n";
 
 static const char *proc11 = 
+"#line 886 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_CATEGORY_BAG (in id varchar, in type varchar, inout c_bag any)\n"
 "{\n"
@@ -792,9 +804,10 @@ static const char *proc11 =
 "}\n"
 "\n"
 "}\n"
-"--src uddi.sql:885\n";
+"--src uddi.sql:884\n";
 
 static const char *proc12 = 
+"#line 926 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_OVERVIEW_DOC (in id varchar, in type varchar, inout ov_doc any)\n"
 "{\n"
@@ -817,9 +830,10 @@ static const char *proc12 =
 "SAVE_DESCRIPRIONS (ov_key, \'overviewDoc\', xpath_eval (\'description\', ov_doc, 0));\n"
 "\n"
 "}\n"
-"--src uddi.sql:925\n";
+"--src uddi.sql:924\n";
 
 static const char *proc13 = 
+"#line 952 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_SAVE_TMODEL (in uddi_req any)\n"
 "{\n"
@@ -887,9 +901,10 @@ static const char *proc13 =
 "TMODEL_DETAIL (tm_keys, ses);\n"
 "return (string_output_string(ses));\n"
 "}\n"
-"--src uddi.sql:951\n";
+"--src uddi.sql:950\n";
 
 static const char *proc14 = 
+"#line 1023 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_DISCOVERY_URLS (in id varchar, in type varchar, inout urls any)\n"
 "{\n"
@@ -939,9 +954,10 @@ static const char *proc14 =
 "}\n"
 "}\n"
 "}\n"
-"--src uddi.sql:1022\n";
+"--src uddi.sql:1021\n";
 
 static const char *proc15 = 
+"#line 1076 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_CONTACTS (in id varchar, in type varchar, inout contacts any)\n"
 "{\n"
@@ -978,9 +994,10 @@ static const char *proc15 =
 "}\n"
 "\n"
 "}\n"
-"--src uddi.sql:1075\n";
+"--src uddi.sql:1074\n";
 
 static const char *proc16 = 
+"#line 1115 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_EMAILS (in id varchar, in c_k varchar, inout email_s any)\n"
 "{\n"
@@ -1004,9 +1021,10 @@ static const char *proc16 =
 "}\n"
 "\n"
 "}\n"
-"--src uddi.sql:1114\n";
+"--src uddi.sql:1113\n";
 
 static const char *proc17 = 
+"#line 1141 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_PHONES (in id varchar, in c_k varchar, inout phones_s any)\n"
 "{\n"
@@ -1031,9 +1049,10 @@ static const char *proc17 =
 "}\n"
 "\n"
 "}\n"
-"--src uddi.sql:1140\n";
+"--src uddi.sql:1139\n";
 
 static const char *proc18 = 
+"#line 1168 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_ADDRESS (in id varchar, in c_k varchar, inout address_s any)\n"
 "{\n"
@@ -1068,9 +1087,10 @@ static const char *proc18 =
 "idx_1 := idx_1 + 1;\n"
 "}\n"
 "}\n"
-"--src uddi.sql:1167\n";
+"--src uddi.sql:1166\n";
 
 static const char *proc19 = 
+"#line 1205 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "DELETE_BUSINESS_BK (in bk varchar)\n"
 "{\n"
@@ -1104,9 +1124,10 @@ static const char *proc19 =
 "signal (\'10050\', sprintf (\'Invalid Business KeyPassed %s\', bk));\n"
 "}\n"
 "}\n"
-"--src uddi.sql:1204\n";
+"--src uddi.sql:1203\n";
 
 static const char *proc20 = 
+"#line 1240 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_SAVE_SERVICE (in uddi_req any)\n"
 "{\n"
@@ -1134,9 +1155,10 @@ static const char *proc20 =
 "return (string_output_string(ses));\n"
 "\n"
 "}\n"
-"--src uddi.sql:1239\n";
+"--src uddi.sql:1238\n";
 
 static const char *proc21 = 
+"#line 1270 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "DELETE_SERVICE_SK (in sk varchar)\n"
 "{\n"
@@ -1159,9 +1181,10 @@ static const char *proc21 =
 "signal (\'10050\', sprintf (\'Invalid Service Key Passed %s\', sk));\n"
 "}\n"
 "}\n"
-"--src uddi.sql:1269\n";
+"--src uddi.sql:1268\n";
 
 static const char *proc22 = 
+"#line 1295 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "DELETE_BINDING_BK (in bin_k varchar)\n"
 "{\n"
@@ -1181,9 +1204,10 @@ static const char *proc22 =
 "signal (\'10050\', sprintf (\'Invalid Binding Key Passed %s\', bin_k));\n"
 "}\n"
 "}\n"
-"--src uddi.sql:1294\n";
+"--src uddi.sql:1293\n";
 
 static const char *proc23 = 
+"#line 1317 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "DELETE_TMODEL_TK (in tm_key varchar)\n"
 "{\n"
@@ -1203,9 +1227,10 @@ static const char *proc23 =
 "}\n"
 "\n"
 "}\n"
-"--src uddi.sql:1316\n";
+"--src uddi.sql:1315\n";
 
 static const char *proc24 = 
+"#line 1339 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_SAVE_BINDING (in uddi_req any)\n"
 "{\n"
@@ -1235,9 +1260,10 @@ static const char *proc24 =
 "return (string_output_string(ses));\n"
 "\n"
 "}\n"
-"--src uddi.sql:1338\n";
+"--src uddi.sql:1337\n";
 
 static const char *proc25 = 
+"#line 1370 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_DELETE_BUSINESS (in uddi_req any)\n"
 "{\n"
@@ -1273,9 +1299,10 @@ static const char *proc25 =
 "return OK_DISPOSITION_REPORT ();\n"
 "\n"
 "}\n"
-"--src uddi.sql:1369\n";
+"--src uddi.sql:1368\n";
 
 static const char *proc26 = 
+"#line 1408 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_DELETE_SERVICE (in uddi_req any)\n"
 "{\n"
@@ -1311,9 +1338,10 @@ static const char *proc26 =
 "return OK_DISPOSITION_REPORT ();\n"
 "\n"
 "}\n"
-"--src uddi.sql:1407\n";
+"--src uddi.sql:1406\n";
 
 static const char *proc27 = 
+"#line 1446 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_DELETE_BINDING (in uddi_req any)\n"
 "{\n"
@@ -1349,9 +1377,10 @@ static const char *proc27 =
 "return OK_DISPOSITION_REPORT ();\n"
 "\n"
 "}\n"
-"--src uddi.sql:1445\n";
+"--src uddi.sql:1444\n";
 
 static const char *proc28 = 
+"#line 1484 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_DELETE_TMODEL (in uddi_req any)\n"
 "{\n"
@@ -1382,9 +1411,10 @@ static const char *proc28 =
 "return OK_DISPOSITION_REPORT ();\n"
 "\n"
 "}\n"
-"--src uddi.sql:1483\n";
+"--src uddi.sql:1482\n";
 
 static const char *proc29 = 
+"#line 1517 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "GET_FROM_UPLOAD_REGISTER (in req any)\n"
 "{\n"
@@ -1419,9 +1449,10 @@ static const char *proc29 =
 "\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src uddi.sql:1516\n";
+"--src uddi.sql:1515\n";
 
 static const char *proc30 = 
+"#line 1554 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SAVE_BUSINESS_FROM_FILE (in file_name varchar)\n"
 "{\n"
@@ -1435,9 +1466,10 @@ static const char *proc30 =
 "\n"
 "return;\n"
 "}\n"
-"--src uddi.sql:1553\n";
+"--src uddi.sql:1552\n";
 
 static const char *proc31 = 
+"#line 1571 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_GET_AUTHTOKEN (in uddi_req any)\n"
 "{\n"
@@ -1470,9 +1502,10 @@ static const char *proc31 =
 "\n"
 "return (string_output_string(ses));\n"
 "}\n"
-"--src uddi.sql:1570\n";
+"--src uddi.sql:1569\n";
 
 static const char *proc32 = 
+"#line 1605 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_DISCARD_AUTHTOKEN (in uddi_req any)\n"
 "{\n"
@@ -1485,17 +1518,19 @@ static const char *proc32 =
 "delete from  WS.WS.SESSION where S_OPAQUE = token;\n"
 "return OK_DISPOSITION_REPORT ();\n"
 "}\n"
-"--src uddi.sql:1604\n";
+"--src uddi.sql:1603\n";
 
 static const char *proc33 = 
+"#line 1619 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "OK_DISPOSITION_REPORT ()\n"
 "{\n"
 "return (sprintf (\'<dispositionReport generic=\"1.0\" operator=\"%s\"  xmlns=\"urn:uddi-org:api\" ><result errno=\"0\" ><errInfo errCode=\"E_success\" /></result></dispositionReport>\', registry_get (\'UDDI_operator\')));\n"
 "}\n"
-"--src uddi.sql:1618\n";
+"--src uddi.sql:1617\n";
 
 static const char *proc34 = 
+"#line 1626 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_GET_REGISTEREDINFO (in uddi_req any)\n"
 "{\n"
@@ -1558,9 +1593,10 @@ static const char *proc34 =
 "http (\'</registeredInfo>\', ses);\n"
 "return (string_output_string(ses));\n"
 "}\n"
-"--src uddi.sql:1625\n";
+"--src uddi.sql:1624\n";
 
 static const char *proc35 = 
+"#line 1691 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "VERIFY_AUTH_INFO (in token varchar)\n"
 "{\n"
@@ -1574,17 +1610,19 @@ static const char *proc35 =
 "signal (\'10110\', \'The passed authentication token has been expired\');\n"
 "return own;\n"
 "}\n"
-"--src uddi.sql:1690\n";
+"--src uddi.sql:1689\n";
 
 static const char *proc36 = 
+"#line 1708 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_GET_BUSINESSDETAILEXT (in uddi_req any)\n"
 "{\n"
 "return get_businessDetail (uddi_req);\n"
 "}\n"
-"--src uddi.sql:1707\n";
+"--src uddi.sql:1706\n";
 
 static const char *proc37 = 
+"#line 1715 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_GET_BUSINESSDETAIL (in uddi_req any)\n"
 "{\n"
@@ -1601,9 +1639,10 @@ static const char *proc37 =
 "ses :=  string_output_string (ses);\n"
 "return (ses);\n"
 "}\n"
-"--src uddi.sql:1714\n";
+"--src uddi.sql:1713\n";
 
 static const char *proc38 = 
+"#line 1733 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "BUSINESS_DETAIL (in bk_arr any, inout ses any)\n"
 "{\n"
@@ -1645,9 +1684,10 @@ static const char *proc38 =
 "if (ix)\n"
 "http (\'</businessDetail>\', ses);\n"
 "}\n"
-"--src uddi.sql:1732\n";
+"--src uddi.sql:1731\n";
 
 static const char *proc39 = 
+"#line 1777 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_GET_BINDINGDETAIL (in uddi_req any)\n"
 "{\n"
@@ -1665,9 +1705,10 @@ static const char *proc39 =
 "\n"
 "return (ses);\n"
 "}\n"
-"--src uddi.sql:1776\n";
+"--src uddi.sql:1775\n";
 
 static const char *proc40 = 
+"#line 1797 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "BINDING_DETAIL (in bk_arr any, inout ses any)\n"
 "{\n"
@@ -1714,9 +1755,10 @@ static const char *proc40 =
 "if (ix)\n"
 "http (\'</bindingDetail>\', ses);\n"
 "}\n"
-"--src uddi.sql:1796\n";
+"--src uddi.sql:1795\n";
 
 static const char *proc41 = 
+"#line 1846 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_GET_TMODELDETAIL (in uddi_req any)\n"
 "{\n"
@@ -1735,9 +1777,10 @@ static const char *proc41 =
 "return (ses);\n"
 "\n"
 "}\n"
-"--src uddi.sql:1845\n";
+"--src uddi.sql:1844\n";
 
 static const char *proc42 = 
+"#line 1866 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "TMODEL_DETAIL (in bk_arr any, inout ses any)\n"
 "{\n"
@@ -1776,9 +1819,10 @@ static const char *proc42 =
 "if (ix)\n"
 "http (\'</tModelDetail>\', ses);\n"
 "}\n"
-"--src uddi.sql:1865\n";
+"--src uddi.sql:1864\n";
 
 static const char *proc43 = 
+"#line 1907 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_GET_SERVICEDETAIL (in uddi_req any)\n"
 "{\n"
@@ -1795,9 +1839,10 @@ static const char *proc43 =
 "ses :=  string_output_string (ses);\n"
 "return (ses);\n"
 "}\n"
-"--src uddi.sql:1906\n";
+"--src uddi.sql:1905\n";
 
 static const char *proc44 = 
+"#line 1925 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SERVICE_DETAIL (in bk_arr any, inout ses any)\n"
 "{\n"
@@ -1834,9 +1879,10 @@ static const char *proc44 =
 "if (ix)\n"
 "http (\'</serviceDetail>\', ses);\n"
 "}\n"
-"--src uddi.sql:1924\n";
+"--src uddi.sql:1923\n";
 
 static const char *proc45 = 
+"#line 1965 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "TMODEL_INSTANCE_DETAILS (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -1863,9 +1909,10 @@ static const char *proc45 =
 "else\n"
 "http (\'<tModelInstanceDetails/>\', ses);\n"
 "}\n"
-"--src uddi.sql:1964\n";
+"--src uddi.sql:1963\n";
 
 static const char *proc46 = 
+"#line 1994 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "OVERVIEW_DOC (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -1886,9 +1933,10 @@ static const char *proc46 =
 "http (\'</overviewDoc>\', ses);\n"
 "\n"
 "}\n"
-"--src uddi.sql:1993\n";
+"--src uddi.sql:1992\n";
 
 static const char *proc47 = 
+"#line 2018 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "DISCOVERY_URLS (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -1905,9 +1953,10 @@ static const char *proc47 =
 "if (ix)\n"
 "http (\'</discoveryURLs>\', ses);\n"
 "}\n"
-"--src uddi.sql:2017\n";
+"--src uddi.sql:2016\n";
 
 static const char *proc48 = 
+"#line 2037 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "BUSINESS_SERVICES (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -1929,9 +1978,10 @@ static const char *proc48 =
 "http (\'</businessServices>\', ses);\n"
 "\n"
 "}\n"
-"--src uddi.sql:2036\n";
+"--src uddi.sql:2035\n";
 
 static const char *proc49 = 
+"#line 2061 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "BINDING_TEMPLATES (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -1967,9 +2017,10 @@ static const char *proc49 =
 "http (\'<bindingTemplates/>\', ses);\n"
 "\n"
 "}\n"
-"--src uddi.sql:2060\n";
+"--src uddi.sql:2059\n";
 
 static const char *proc50 = 
+"#line 2099 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "CATEGORY_BAG (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -1986,9 +2037,10 @@ static const char *proc50 =
 "if (ix)\n"
 "http (\'</categoryBag>\', ses);\n"
 "}\n"
-"--src uddi.sql:2098\n";
+"--src uddi.sql:2097\n";
 
 static const char *proc51 = 
+"#line 2118 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "IDENTIFIER_BAG (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -2008,9 +2060,10 @@ static const char *proc51 =
 "if (ix)\n"
 "http (\'</identifierBag>\', ses);\n"
 "}\n"
-"--src uddi.sql:2117\n";
+"--src uddi.sql:2116\n";
 
 static const char *proc52 = 
+"#line 2141 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "DESCRIPTIONS (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -2023,9 +2076,10 @@ static const char *proc52 =
 "\n"
 "}\n"
 "}\n"
-"--src uddi.sql:2140\n";
+"--src uddi.sql:2139\n";
 
 static const char *proc53 = 
+"#line 2157 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "CONTACTS (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -2053,9 +2107,10 @@ static const char *proc53 =
 "http (\'</contacts>\', ses);\n"
 "\n"
 "}\n"
-"--src uddi.sql:2156\n";
+"--src uddi.sql:2155\n";
 
 static const char *proc54 = 
+"#line 2187 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "PHONE (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -2064,9 +2119,10 @@ static const char *proc54 =
 "http (sprintf (\'<phone useType=\"%s\">%s</phone>\', PH_USE_TYPE, PH_PHONE), ses);\n"
 "}\n"
 "}\n"
-"--src uddi.sql:2186\n";
+"--src uddi.sql:2185\n";
 
 static const char *proc55 = 
+"#line 2198 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "EMAIL (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -2075,9 +2131,10 @@ static const char *proc55 =
 "http (sprintf (\'<email useType=\"%s\">%s</email>\', EM_USE_TYPE, EM_ADDR), ses);\n"
 "}\n"
 "}\n"
-"--src uddi.sql:2197\n";
+"--src uddi.sql:2196\n";
 
 static const char *proc56 = 
+"#line 2210 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "ADDRESS (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -2089,9 +2146,10 @@ static const char *proc56 =
 "ADDRESS_2 (id, elm, ses, AL_USE_TYPE);\n"
 "}\n"
 "}\n"
-"--src uddi.sql:2209\n";
+"--src uddi.sql:2208\n";
 
 static const char *proc57 = 
+"#line 2224 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "ADDRESS_2 (in id varchar, in elm varchar, inout ses any, in _use varchar)\n"
 "{\n"
@@ -2117,9 +2175,10 @@ static const char *proc57 =
 "http (\'</address>\', ses);\n"
 "\n"
 "}\n"
-"--src uddi.sql:2223\n";
+"--src uddi.sql:2222\n";
 
 static const char *proc58 = 
+"#line 2252 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "QUAL_MATCH (in s1 varchar, in s2 varchar, in ex integer, in ca integer)\n"
 "{\n"
@@ -2137,9 +2196,10 @@ static const char *proc58 =
 "return 1;\n"
 "return 0;\n"
 "}\n"
-"--src uddi.sql:2251\n";
+"--src uddi.sql:2250\n";
 
 static const char *proc59 = 
+"#line 2272 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_FIND_BUSINESS (in uddi_req any)\n"
 "{\n"
@@ -2377,9 +2437,10 @@ static const char *proc59 =
 "ses :=  string_output_string (ses);\n"
 "return (ses);\n"
 "}\n"
-"--src uddi.sql:2271\n";
+"--src uddi.sql:2270\n";
 
 static const char *proc60 = 
+"#line 2512 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "SERVICE_INFOS (in id varchar, in elm varchar, inout ses any)\n"
 "{\n"
@@ -2400,9 +2461,10 @@ static const char *proc60 =
 "http (\'<serviceInfos/>\', ses);\n"
 "\n"
 "}\n"
-"--src uddi.sql:2511\n";
+"--src uddi.sql:2510\n";
 
 static const char *proc61 = 
+"#line 2536 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_FIND_BINDING (in uddi_req any)\n"
 "{\n"
@@ -2521,9 +2583,10 @@ static const char *proc61 =
 "ses :=  string_output_string (ses);\n"
 "return (ses);\n"
 "}\n"
-"--src uddi.sql:2535\n";
+"--src uddi.sql:2534\n";
 
 static const char *proc62 = 
+"#line 2657 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_FIND_SERVICE (in uddi_req any)\n"
 "{\n"
@@ -2717,9 +2780,10 @@ static const char *proc62 =
 "\n"
 "return (ses);\n"
 "}\n"
-"--src uddi.sql:2656\n";
+"--src uddi.sql:2655\n";
 
 static const char *proc63 = 
+"#line 2853 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_FIND_TMODEL (in uddi_req any)\n"
 "{\n"
@@ -2897,25 +2961,28 @@ static const char *proc63 =
 "\n"
 "return (ses);\n"
 "}\n"
-"--src uddi.sql:2852\n";
+"--src uddi.sql:2851\n";
 
 static const char *proc64 = 
+"#line 3036 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_STR_GET2 (in uri varchar, in req any)\n"
 "{\n"
 "return http_get(uri , NULL, \'POST\', \'Content-Type: text/xml\\r\\nSOAPAction: \"\"\', req);\n"
 "}\n"
-"--src uddi.sql:3035\n";
+"--src uddi.sql:3034\n";
 
 static const char *proc65 = 
+"#line 3044 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_ADD_ENVELOPE (in str varchar)\n"
 "{\n"
 "return concat (\'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\r\\n<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\">\\r\\n\\<Body>\', str, \'</Body>\\r\\n</Envelope>\');\n"
 "}\n"
-"--src uddi.sql:3043\n";
+"--src uddi.sql:3042\n";
 
 static const char *proc66 = 
+"#line 3052 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_STR_GET (in uri varchar, in req any)\n"
 "{\n"
@@ -2923,9 +2990,10 @@ static const char *proc66 =
 "signal (\'42000\', \'The UDDI_STR_GET needs a string as request not a null\');\n"
 "return http_get(uri , NULL, \'POST\', \'Content-Type: text/xml\\r\\nSOAPAction: \"\"\', UDDI_ADD_ENVELOPE (req));\n"
 "}\n"
-"--src uddi.sql:3051\n";
+"--src uddi.sql:3050\n";
 
 static const char *proc67 = 
+"#line 3062 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_REMOVE_ENVELOPE (in str varchar)\n"
 "{\n"
@@ -2938,18 +3006,20 @@ static const char *proc67 =
 "res := xpath_eval (concat (\'/Envelope/Body/\', next), res, 1);\n"
 "return res;\n"
 "}\n"
-"--src uddi.sql:3061\n";
+"--src uddi.sql:3060\n";
 
 static const char *proc68 = 
+"#line 3077 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_GET (in uri varchar, in req any)\n"
 "{\n"
 "return UDDI_REMOVE_ENVELOPE (http_get (uri , NULL, \'POST\', \'Content-Type: text/xml\\r\\nSOAPAction: \"\"\',\n"
 "UDDI_ADD_ENVELOPE (req)));\n"
 "}\n"
-"--src uddi.sql:3076\n";
+"--src uddi.sql:3075\n";
 
 static const char *proc69 = 
+"#line 3086 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "UDDI_LOCAL (in req_l any)\n"
 "{\n"
@@ -2981,9 +3051,10 @@ static const char *proc69 =
 "\n"
 "return msg;\n"
 "}\n"
-"--src uddi.sql:3085\n";
+"--src uddi.sql:3084\n";
 
 static const char *proc70 = 
+"#line 3119 \"[executable]/uddi.sql\"\n"
 "create procedure\n"
 "kluc (in to_kluc any)\n"
 "{\n"
@@ -2994,7 +3065,7 @@ static const char *proc70 =
 "\n"
 "return (xml_tree_doc (string_output_string (ses)));\n"
 "}\n"
-"--src uddi.sql:3118\n";
+"--src uddi.sql:3117\n";
 
 static int
 sch_proc_def_exists (client_connection_t *cli, const char *proc_name)
diff --git a/libsrc/Wi/sql_code_vad.c b/libsrc/Wi/sql_code_vad.c
index 0419f0b..6cc6e61 100644
--- a/libsrc/Wi/sql_code_vad.c
+++ b/libsrc/Wi/sql_code_vad.c
@@ -7,11 +7,12 @@
 /* vad_root.sql */
 
 static const char *proc0 = 
+"#line 23 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_VERSION\" () returns varchar\n"
 "{\n"
 "return \'1.0.010601A\';\n"
 "}\n"
-"--src vad_root.sql:22\n";
+"--src vad_root.sql:21\n";
 
 static const char *other0 = 
 "registry_set (\'VAD_atomic\', \'0\')\n";
@@ -29,6 +30,7 @@ static const char *tbl0 =
 "alter index VAD_REGISTRY on \"VAD\".\"DBA\".\"VAD_REGISTRY\" partition cluster replicated\n";
 
 static const char *proc1 = 
+"#line 58 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_READ_INI\" (inout parr any) returns any\n"
 "{\n"
 "declare name, type, val varchar;\n"
@@ -58,9 +60,10 @@ static const char *proc1 =
 "\"PUMP\".\"DBA\".\"CHANGE_VAL\" (parr, \'dav_root\', val);\n"
 "return aout;\n"
 "}\n"
-"--src vad_root.sql:57\n";
+"--src vad_root.sql:56\n";
 
 static const char *proc2 = 
+"#line 90 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_GET_ROOT\" ( in name varchar ) returns varchar\n"
 "{\n"
 "declare arr, arr2 any;\n"
@@ -72,9 +75,10 @@ static const char *proc2 =
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'Attempt to get unknown root path:%s\', name));\n"
 "return s;\n"
 "}\n"
-"--src vad_root.sql:89\n";
+"--src vad_root.sql:88\n";
 
 static const char *proc3 = 
+"#line 104 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_SET_ROOT\" ( in name varchar, in val varchar) returns integer\n"
 "{\n"
 "declare arr any;\n"
@@ -98,9 +102,10 @@ static const char *proc3 =
 "return \"VAD\".\"DBA\".\"VAD_MKNODE\" (arr, ini, name, \'STRING\', val);\n"
 "return \"VAD\".\"DBA\".\"VAD_UPDATE_NODE\" (ret, val, lval);\n"
 "}\n"
-"--src vad_root.sql:103\n";
+"--src vad_root.sql:102\n";
 
 static const char *proc4 = 
+"#line 129 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_MKDAV\" (inout id integer, inout gd integer, in path varchar, inout ini any, in istest integer := 0, in _usr varchar := NULL, in _pwd varchar := NULL) returns integer\n"
 "{\n"
 "declare parr any;\n"
@@ -142,9 +147,10 @@ static const char *proc4 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src vad_root.sql:128\n";
+"--src vad_root.sql:127\n";
 
 static const char *proc5 = 
+"#line 172 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_ATOMIC\" ( in mode integer )\n"
 "{\n"
 "if (sys_stat (\'cl_run_local_only\') <> 1)\n"
@@ -165,9 +171,10 @@ static const char *proc5 =
 "}\n"
 "}\n"
 "}\n"
-"--src vad_root.sql:171\n";
+"--src vad_root.sql:170\n";
 
 static const char *proc6 = 
+"#line 196 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" ( in msg varchar ) returns integer\n"
 "{\n"
 "rollback work;\n"
@@ -179,9 +186,10 @@ static const char *proc6 =
 "\n"
 "signal (\'42VAD\', msg);\n"
 "}\n"
-"--src vad_root.sql:195\n";
+"--src vad_root.sql:194\n";
 
 static const char *proc7 = 
+"#line 210 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_CHDIR\" (inout parr any, in curdir integer, in dirname varchar) returns integer\n"
 "{\n"
 "curdir := cast (curdir as integer);\n"
@@ -220,9 +228,10 @@ static const char *proc7 =
 "notfound:\n"
 "return 0;\n"
 "}\n"
-"--src vad_root.sql:209\n";
+"--src vad_root.sql:208\n";
 
 static const char *proc8 = 
+"#line 251 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_FIND_SMTH_BY_NAME\" (in curdir integer, in itemname varchar) returns integer\n"
 "{\n"
 "curdir := cast (curdir as integer);\n"
@@ -246,9 +255,10 @@ static const char *proc8 =
 "notfound:\n"
 "return 0;\n"
 "}\n"
-"--src vad_root.sql:250\n";
+"--src vad_root.sql:249\n";
 
 static const char *proc9 = 
+"#line 276 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_REGET_HANDLERS\" (inout arr any) returns integer\n"
 "{\n"
 "if (arr is null or length(arr) = 0)\n"
@@ -261,9 +271,10 @@ static const char *proc9 =
 "http (sprintf (\'\\n<script>document.forms[0].tree_ser.value=\"%s\";</script>\\n\',s));\n"
 "return 1;\n"
 "}\n"
-"--src vad_root.sql:275\n";
+"--src vad_root.sql:274\n";
 
 static const char *proc10 = 
+"#line 290 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_FULL_PATH\" (inout parr any, in curdir integer) returns varchar\n"
 "{\n"
 "curdir := cast (curdir as integer);\n"
@@ -306,9 +317,10 @@ static const char *proc10 =
 "\"VAD\".\"DBA\".\"VAD_REGET_HANDLERS\" (parr);\n"
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'Illegal handler:%d\', curdir));\n"
 "}\n"
-"--src vad_root.sql:289\n";
+"--src vad_root.sql:288\n";
 
 static const char *proc11 = 
+"#line 335 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_TEST_PARENT\" (inout parr any, in curdir integer, in name varchar, inout rid int)\n"
 "returns varchar\n"
 "{\n"
@@ -331,9 +343,10 @@ static const char *proc11 =
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'parent directory name mismatch:%s\', nname));\n"
 "return nname;\n"
 "}\n"
-"--src vad_root.sql:334\n";
+"--src vad_root.sql:333\n";
 
 static const char *proc12 = 
+"#line 360 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_TEST_NODE_TYPE\" (in type varchar) returns varchar\n"
 "{\n"
 "type := upper (type);\n"
@@ -347,9 +360,10 @@ static const char *proc12 =
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'illegal node type:%s\',cast (type as varchar)));\n"
 "return type;\n"
 "}\n"
-"--src vad_root.sql:359\n";
+"--src vad_root.sql:358\n";
 
 static const char *proc13 = 
+"#line 375 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_MKDIR\" (inout parr any, in curdir integer, in name varchar ) returns integer\n"
 "{\n"
 "curdir := cast (curdir as integer);\n"
@@ -366,9 +380,10 @@ static const char *proc13 =
 "\n"
 "return _id;\n"
 "}\n"
-"--src vad_root.sql:374\n";
+"--src vad_root.sql:373\n";
 
 static const char *proc14 = 
+"#line 394 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_MKCD\" (inout parr any, in curdir integer, in name varchar ) returns integer\n"
 "{\n"
 "curdir := cast (curdir as integer);\n"
@@ -379,9 +394,10 @@ static const char *proc14 =
 "else\n"
 "return \"VAD\".\"DBA\".\"VAD_MKDIR\" (parr, curdir, name);\n"
 "}\n"
-"--src vad_root.sql:393\n";
+"--src vad_root.sql:392\n";
 
 static const char *proc15 = 
+"#line 407 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_RMDIR\" (inout parr any, in curdir integer) returns integer\n"
 "{\n"
 "curdir := cast (curdir as integer);\n"
@@ -405,9 +421,10 @@ static const char *proc15 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src vad_root.sql:406\n";
+"--src vad_root.sql:405\n";
 
 static const char *proc16 = 
+"#line 433 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_RMNODE\" (in id integer) returns integer\n"
 "{\n"
 "id := cast (id as integer);\n"
@@ -429,9 +446,10 @@ static const char *proc16 =
 "err:\n"
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'Item been removed does not exist:%d\', id));\n"
 "}\n"
-"--src vad_root.sql:432\n";
+"--src vad_root.sql:431\n";
 
 static const char *proc17 = 
+"#line 457 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_MKNODE\" (inout parr any, in curdir integer, in name varchar, in type varchar, in val varchar ) returns integer\n"
 "{\n"
 "declare _id integer;\n"
@@ -451,9 +469,10 @@ static const char *proc17 =
 "\n"
 "return _id;\n"
 "}\n"
-"--src vad_root.sql:456\n";
+"--src vad_root.sql:455\n";
 
 static const char *proc18 = 
+"#line 479 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_UPDATE_NODE\" (in curid integer, in val varchar, in oldval varchar ) returns integer\n"
 "{\n"
 "curid := cast (curid as integer);\n"
@@ -476,9 +495,10 @@ static const char *proc18 =
 "err:\n"
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'Attempt of getting info for non-existent node %d\', curid));\n"
 "}\n"
-"--src vad_root.sql:478\n";
+"--src vad_root.sql:477\n";
 
 static const char *proc19 = 
+"#line 503 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_TEST_VALUE\" ( in type varchar, inout val varchar ) returns integer\n"
 "{\n"
 "if (equ (type, \'FOLDER\'))\n"
@@ -522,9 +542,10 @@ static const char *proc19 =
 "}\n"
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'illegal node type:%s\',cast (type as varchar)));\n"
 "}\n"
-"--src vad_root.sql:502\n";
+"--src vad_root.sql:501\n";
 
 static const char *proc20 = 
+"#line 549 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_NODE_INFO\" (in nodeid integer, inout name varchar, inout type varchar, inout val varchar ) returns integer\n"
 "{\n"
 "nodeid := cast (nodeid as integer);\n"
@@ -535,9 +556,10 @@ static const char *proc20 =
 "err:\n"
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'Attempt of getting info for inexistent node %d\', nodeid));\n"
 "}\n"
-"--src vad_root.sql:548\n";
+"--src vad_root.sql:547\n";
 
 static const char *proc21 = 
+"#line 562 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_NODE_INFO_BY_NAME\" (in curdir integer, in nodename varchar, inout name varchar, inout type varchar, inout val varchar, in ignite_error integer := 1 ) returns integer\n"
 "{\n"
 "declare iid integer;\n"
@@ -551,9 +573,10 @@ static const char *proc21 =
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'Attempt of getting info for inexistent node %d/%s\', curdir, nodename));\n"
 "return 0;\n"
 "}\n"
-"--src vad_root.sql:561\n";
+"--src vad_root.sql:560\n";
 
 static const char *proc22 = 
+"#line 578 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_NEW_PACKAGE\" (inout parr any, in name varchar, in version varchar ) returns integer\n"
 "{\n"
 "declare curdir, tid, ret integer;\n"
@@ -580,9 +603,10 @@ static const char *proc22 =
 "\"VAD\".\"DBA\".\"VAD_DAV_MKCOL\"(ini, s);\n"
 "return tid;\n"
 "}\n"
-"--src vad_root.sql:577\n";
+"--src vad_root.sql:576\n";
 
 static const char *proc23 = 
+"#line 606 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"__VAD_BUILD_TREE\" ( in curdir integer, in name varchar, in ltype varchar, in lkey varchar ) returns any\n"
 "{\n"
 "declare tname, ttype, tkey varchar;\n"
@@ -620,18 +644,20 @@ static const char *proc23 =
 "arr := vector_concat (arr, vector(NULL));\n"
 "return arr;\n"
 "}\n"
-"--src vad_root.sql:605\n";
+"--src vad_root.sql:604\n";
 
 static const char *proc24 = 
+"#line 646 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_BUILD_TREE\" (  ) returns any\n"
 "{\n"
 "declare arr any;\n"
 "arr := \"VAD\".\"DBA\".\"__VAD_BUILD_TREE\" (1, \'/\', \'FOLDER\', \'/\');\n"
 "return arr;\n"
 "}\n"
-"--src vad_root.sql:645\n";
+"--src vad_root.sql:644\n";
 
 static const char *proc25 = 
+"#line 655 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_GET_PACKAGES\" ( ) returns any\n"
 "{\n"
 "declare retarr, tmparr any;\n"
@@ -668,9 +694,10 @@ static const char *proc25 =
 "\n"
 "return retarr;\n"
 "}\n"
-"--src vad_root.sql:654\n";
+"--src vad_root.sql:653\n";
 
 static const char *proc26 = 
+"#line 693 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"__VAD_DEL_SUBTREE\"(in curdir integer) returns any\n"
 "{\n"
 "declare tname varchar;\n"
@@ -699,9 +726,10 @@ static const char *proc26 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src vad_root.sql:692\n";
+"--src vad_root.sql:691\n";
 
 static const char *proc27 = 
+"#line 724 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_DEL_SUBTREE\" ( in curdir integer ) returns any\n"
 "{\n"
 "curdir := cast (curdir as integer);\n"
@@ -713,9 +741,10 @@ static const char *proc27 =
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'You can\\\'t remove system subtree\'));\n"
 "return \"VAD\".\"DBA\".\"__VAD_DEL_SUBTREE\" (curdir);\n"
 "}\n"
-"--src vad_root.sql:723\n";
+"--src vad_root.sql:722\n";
 
 static const char *proc28 = 
+"#line 738 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_GET_PKG_ID\" (inout parr any, in name varchar, in version varchar ) returns integer\n"
 "{\n"
 "declare curdir, tid integer;\n"
@@ -729,9 +758,10 @@ static const char *proc28 =
 "else\n"
 "return curdir;\n"
 "}\n"
-"--src vad_root.sql:737\n";
+"--src vad_root.sql:736\n";
 
 static const char *proc29 = 
+"#line 754 \"[executable]/vad_root.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"__vad_init\"()\n"
 "{\n"
 "declare parr, ini any;\n"
@@ -759,7 +789,7 @@ static const char *proc29 =
 "\n"
 "}\n"
 "}\n"
-"--src vad_root.sql:753\n";
+"--src vad_root.sql:752\n";
 
 
 static const char *other1 = 
@@ -767,6 +797,7 @@ static const char *other1 =
 /* vad_misc.sql */
 
 static const char *proc30 = 
+"#line 28 \"[executable]/vad_misc.sql\"\n"
 " create procedure\n"
 "DB.DBA.DAV_RES_GET (in path varchar,\n"
 "inout data any,\n"
@@ -799,7 +830,7 @@ static const char *proc30 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src vad_misc.sql:27\n";
+"--src vad_misc.sql:26\n";
 
 static const char *tbl1 = 
 "create table \"VAD\".\"DBA\".\"VAD_HELP\" (\n"
@@ -811,6 +842,7 @@ static const char *tbl1 =
 ")\n";
 
 static const char *proc31 = 
+"#line 74 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"HTML_FOOTER_OUT\" ( in arr any )\n"
 "{\n"
 "http(\'</form></td></tr>\');\n"
@@ -826,12 +858,13 @@ static const char *proc31 =
 "http (\'<TR CLASS=\"CopyrightBorder\"><TD COLSPAN=\"2\"><IMG SRC=\"/admin/images/1x1.gif\" WIDTH=\"1\" HEIGHT=\"2\" ALT=\"\"></TD></TR>\');\n"
 "http (\'<TR><TD ALIGN=\"right\" COLSPAN=\"2\"><P CLASS=\"Copyright\">Virtuoso Server \');\n"
 "http (sys_stat(\'st_dbms_ver\'));\n"
-"http (sprintf (\' VAD Interface (%s) - Copyright© 1998-2010 OpenLink Software.</P></TD></TR>\',\"VAD\".\"DBA\".\"VAD_VERSION\" ()));\n"
+"http (sprintf (\' VAD Interface (%s) - Copyright© 1998-2011 OpenLink Software.</P></TD></TR>\',\"VAD\".\"DBA\".\"VAD_VERSION\" ()));\n"
 "http (\'</TABLE>\\n</BODY>\');\n"
 "}\n"
-"--src vad_misc.sql:73\n";
+"--src vad_misc.sql:72\n";
 
 static const char *proc32 = 
+"#line 94 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"OUT_CHK_DFLT_PARS\" ( in req varchar )\n"
 "{\n"
 "declare vreq, treq any;\n"
@@ -861,9 +894,10 @@ static const char *proc32 =
 "http (\'return 1;\\n}</script>\\n\');\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:93\n";
+"--src vad_misc.sql:92\n";
 
 static const char *proc33 = 
+"#line 125 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_STRIP_RN\" ( in str varchar )\n"
 "{\n"
 "declare ret any;\n"
@@ -885,9 +919,10 @@ static const char *proc33 =
 "}\n"
 "return string_output_string(ret);\n"
 "}\n"
-"--src vad_misc.sql:124\n";
+"--src vad_misc.sql:123\n";
 
 static const char *proc34 = 
+"#line 149 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"__VAD_TREE_OUT\" ( inout arr any, inout ses any, in level integer, in mask varchar, in islast integer, inout sz integer, in cd integer) returns any\n"
 "{\n"
 "declare nmask varchar;\n"
@@ -951,9 +986,10 @@ static const char *proc34 =
 "}\n"
 "return arr;\n"
 "}\n"
-"--src vad_misc.sql:148\n";
+"--src vad_misc.sql:147\n";
 
 static const char *proc35 = 
+"#line 215 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"__EXPAND_PATH\" ( inout arr any, in curdir integer, in clicked integer) returns integer\n"
 "{\n"
 "declare i, n, t, tt, flag integer;\n"
@@ -997,9 +1033,10 @@ static const char *proc35 =
 "t := 1;\n"
 "return t;\n"
 "}\n"
-"--src vad_misc.sql:214\n";
+"--src vad_misc.sql:213\n";
 
 static const char *proc36 = 
+"#line 261 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_TREE_OUT\" ( inout parr any, inout arr any, in clicked integer, inout sz integer ) returns varchar\n"
 "{\n"
 "declare ses any;\n"
@@ -1016,9 +1053,10 @@ static const char *proc36 =
 "\"VAD\".\"DBA\".\"__VAD_TREE_OUT\" (arr, ses, 0, \'\', 1, sz, cd);\n"
 "return string_output_string(ses);\n"
 "}\n"
-"--src vad_misc.sql:260\n";
+"--src vad_misc.sql:259\n";
 
 static const char *proc37 = 
+"#line 280 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_LIST_FOLDER\" (inout parr any, in id integer, in type varchar := \'file\' )\n"
 "{\n"
 "declare arr, tid integer;\n"
@@ -1038,9 +1076,10 @@ static const char *proc37 =
 "close cr;\n"
 "return arr;\n"
 "}\n"
-"--src vad_misc.sql:279\n";
+"--src vad_misc.sql:278\n";
 
 static const char *proc38 = 
+"#line 302 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_REG_DIR_OUT\" (  inout arr any,\n"
 "in sz integer )\n"
 "{\n"
@@ -1080,9 +1119,10 @@ static const char *proc38 =
 "\"PUMP\".\"DBA\".\"HTML_SELECT_OUT\" (arr, \'items_list\', sprintf (\'Current:%s\', s ), string_output_string (ses), NULL, sprintf(\' size=%d style=\\\'{width: 100%%}\\\'\', sz), NULL, 40);\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:301\n";
+"--src vad_misc.sql:300\n";
 
 static const char *proc39 = 
+"#line 344 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_REG_TREE_OUT\" ( inout arr any, in rebuild integer := 0 )\n"
 "{\n"
 "declare arr2, ses any;\n"
@@ -1111,9 +1151,10 @@ static const char *proc39 =
 "http (sprintf (\'\\n<script>document.forms[0].tree_ser.value=\"%s\";</script>\\n\',s));\n"
 "return sz;\n"
 "}\n"
-"--src vad_misc.sql:343\n";
+"--src vad_misc.sql:342\n";
 
 static const char *proc40 = 
+"#line 375 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_OUT_PACKAGES_LIST\" (inout arr any) returns integer\n"
 "{\n"
 "declare s varchar;\n"
@@ -1140,9 +1181,10 @@ static const char *proc40 =
 "\"PUMP\".\"DBA\".\"HTML_SELECT_OUT\" (arr, \'packages_list\', \'Available packages\', string_output_string (ses), NULL, \' size=10 style=\\\'{width: 100%}\\\'\', NULL, 50);\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:374\n";
+"--src vad_misc.sql:373\n";
 
 static const char *proc41 = 
+"#line 404 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_GEN_PACKAGES_LIST\" (inout arr any, in execstr varchar ) returns integer\n"
 "{\n"
 "declare s varchar;\n"
@@ -1187,9 +1229,10 @@ static const char *proc41 =
 "http (\'</table>\');\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:403\n";
+"--src vad_misc.sql:402\n";
 
 static const char *proc42 = 
+"#line 450 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_GEN_PACKAGE_DOCS\" (in pkgname varchar , in pkgver varchar) returns integer\n"
 "{\n"
 "declare tarr any;\n"
@@ -1217,9 +1260,10 @@ static const char *proc42 =
 "http (\'</table>\');\n"
 "http(\'<hr>\');\n"
 "}\n"
-"--src vad_misc.sql:449\n";
+"--src vad_misc.sql:448\n";
 
 static const char *proc43 = 
+"#line 480 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_GEN_PACKAGE_HTTP\" (in pkgname varchar , in pkgver varchar) returns integer\n"
 "{\n"
 "declare tarr any;\n"
@@ -1247,9 +1291,10 @@ static const char *proc43 =
 "http (\'</table>\');\n"
 "http(\'<hr>\');\n"
 "}\n"
-"--src vad_misc.sql:479\n";
+"--src vad_misc.sql:478\n";
 
 static const char *proc44 = 
+"#line 510 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_TEST_PACKAGE_EQ\" (inout parr any, in pkgname varchar , in pkgver varchar) returns integer\n"
 "{\n"
 "declare s varchar;\n"
@@ -1264,9 +1309,10 @@ static const char *proc44 =
 "return 1;\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:509\n";
+"--src vad_misc.sql:508\n";
 
 static const char *proc45 = 
+"#line 527 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_TEST_PACKAGE_LT\" (inout parr any, in pkgname varchar , in pkgver varchar) returns integer\n"
 "{\n"
 "declare s varchar;\n"
@@ -1283,9 +1329,10 @@ static const char *proc45 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:526\n";
+"--src vad_misc.sql:525\n";
 
 static const char *proc46 = 
+"#line 545 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_TEST_PACKAGE_GT\" (inout parr any, in pkgname varchar , in pkgver varchar) returns integer\n"
 "{\n"
 "declare s varchar;\n"
@@ -1300,9 +1347,10 @@ static const char *proc46 =
 "return 1;\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:544\n";
+"--src vad_misc.sql:543\n";
 
 static const char *proc47 = 
+"#line 561 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_TEST_PACKAGE_AND_REMOVE\" (inout parr any, in pkgname varchar , in pkgver varchar) returns integer\n"
 "{\n"
 "declare s varchar;\n"
@@ -1318,9 +1366,10 @@ static const char *proc47 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:560\n";
+"--src vad_misc.sql:559\n";
 
 static const char *proc48 = 
+"#line 578 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_EXEC\" (in prog varchar) returns integer\n"
 "{\n"
 "if (prog is null or length (prog) = 0)\n"
@@ -1335,9 +1384,10 @@ static const char *proc48 =
 "exec (sprintf (\'drop procedure %s\', pname));\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:577\n";
+"--src vad_misc.sql:576\n";
 
 static const char *proc49 = 
+"#line 594 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_LOAD_FILE\" (in fname varchar) returns integer\n"
 "{\n"
 "declare code varchar;\n"
@@ -1403,25 +1453,28 @@ static const char *proc49 =
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'Attempt to load inexistent file\\n%s\', __SQL_MESSAGE));\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:593\n";
+"--src vad_misc.sql:592\n";
 
 static const char *proc50 = 
+"#line 662 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_VHOST_DEFINE\" (in pkgname varchar, in pkgver varchar ) returns integer\n"
 "{\n"
 "DB.DBA.VHOST_DEFINE(lpath=>sprintf (\'/VAD/%s/%s/\', pkgname, pkgver),ppath=>sprintf (\'/%s/%s/%s/\',\"VAD\".\"DBA\".\"VAD_GET_ROOT\" (\'http\'), pkgname, pkgver),vsp_user=>\'DBA\');\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:661\n";
+"--src vad_misc.sql:660\n";
 
 static const char *proc51 = 
+"#line 669 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_VHOST_REMOVE\" (in pkgname varchar, in pkgver varchar ) returns integer\n"
 "{\n"
 "DB.DBA.VHOST_REMOVE(lpath=>sprintf (\'/VAD/%s/%s/\', pkgname, pkgver));\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:668\n";
+"--src vad_misc.sql:667\n";
 
 static const char *proc52 = 
+"#line 676 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_EXEC_RETRYING\" (in _expn varchar) returns varchar\n"
 "{\n"
 "declare _state, _message varchar;\n"
@@ -1438,17 +1491,19 @@ static const char *proc52 =
 "_retries := _retries+1;\n"
 "}\n"
 "}\n"
-"--src vad_misc.sql:675\n";
+"--src vad_misc.sql:674\n";
 
 static const char *proc53 = 
+"#line 694 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_ASSERT2\" (in _val integer, in _text varchar)\n"
 "{\n"
 "if (not _val)\n"
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (_text);\n"
 "}\n"
-"--src vad_misc.sql:693\n";
+"--src vad_misc.sql:692\n";
 
 static const char *proc54 = 
+"#line 701 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_ASSERT\" (in _expn varchar)\n"
 "{\n"
 "\"VAD\".\"DBA\".\"VAD_EXEC_RETRYING\" (\n"
@@ -1456,9 +1511,10 @@ static const char *proc54 =
 "\'\"DB\".\"DBA\".\"VAD_ASSERT2\"((\', _expn, \'), concat (\'\'Assertion failed: \'\', \',\n"
 "\"WS\".\"WS\".\"STR_SQL_APOS\"(_expn), \'))\' ) );\n"
 "}\n"
-"--src vad_misc.sql:700\n";
+"--src vad_misc.sql:699\n";
 
 static const char *proc55 = 
+"#line 710 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_SAFE_EXEC\" (in _expn varchar) returns integer\n"
 "{\n"
 "declare exit handler for sqlstate \'*\' { goto error_smth; };\n"
@@ -1469,9 +1525,10 @@ static const char *proc55 =
 "error_smth:;\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:709\n";
+"--src vad_misc.sql:708\n";
 
 static const char *proc56 = 
+"#line 722 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_GET_NAME_AND_VERSION\"(\n"
 "in name_and_version varchar,\n"
 "inout name varchar,\n"
@@ -1492,9 +1549,10 @@ static const char *proc56 =
 "else\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:721\n";
+"--src vad_misc.sql:720\n";
 
 static const char *proc57 = 
+"#line 744 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VERSION_COMPARE\"(in s1 varchar, in s2 varchar)\n"
 "{\n"
 "declare i, j any;\n"
@@ -1522,9 +1580,10 @@ static const char *proc57 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:743\n";
+"--src vad_misc.sql:742\n";
 
 static const char *proc58 = 
+"#line 773 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_CHECK_FOR_HIGH_VERSION\" (in name varchar) returns varchar\n"
 "{\n"
 "declare version, prod varchar;\n"
@@ -1550,9 +1609,10 @@ static const char *proc58 =
 "}\n"
 "return \'0\';\n"
 "}\n"
-"--src vad_misc.sql:772\n";
+"--src vad_misc.sql:771\n";
 
 static const char *proc59 = 
+"#line 800 \"[executable]/vad_misc.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_REMOVE_PREVIOUS_VERSION\" (in prod varchar, in version varchar) returns integer\n"
 "{\n"
 "declare dot_pos, ver1, ver2 integer;\n"
@@ -1646,7 +1706,7 @@ static const char *proc59 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src vad_misc.sql:799\n";
+"--src vad_misc.sql:798\n";
 
 /* oper_pars.sql */
 
@@ -1722,6 +1782,7 @@ static const char *other24 =
 /* pars_init.sql */
 
 static const char *proc60 = 
+"#line 24 \"[executable]/pars_init.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"RETRIEVE_HTTP_PARS\" ( in afrom any )\n"
 "{\n"
 "declare ato any;\n"
@@ -1752,11 +1813,12 @@ static const char *proc60 =
 "return ato;\n"
 "\n"
 "}\n"
-"--src pars_init.sql:23\n";
+"--src pars_init.sql:22\n";
 
 /* vad_make.sql */
 
 static const char *proc61 = 
+"#line 24 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"DAV_DELETE_VAD\" (\n"
 "in path varchar,\n"
 "in silent integer := 0,\n"
@@ -1804,9 +1866,10 @@ static const char *proc61 =
 "return -1;\n"
 "return 1;\n"
 "}\n"
-"--src vad_make.sql:23\n";
+"--src vad_make.sql:22\n";
 
 static const char *proc62 = 
+"#line 73 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"BLOB_2_STRING_OUTPUT\" (\n"
 "in fname varchar,\n"
 "in f1 integer,\n"
@@ -1854,9 +1917,10 @@ static const char *proc62 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src vad_make.sql:72\n";
+"--src vad_make.sql:71\n";
 
 static const char *proc63 = 
+"#line 122 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_DAV_MKCOL\" (\n"
 "inout ini any,\n"
 "in name varchar ) returns integer\n"
@@ -1872,9 +1936,10 @@ static const char *proc63 =
 "ret := \"DB\".\"DBA\".\"DAV_COL_CREATE\" (name, \'110100100N\', usr, NULL, usr, pwd);\n"
 "return ret;\n"
 "}\n"
-"--src vad_make.sql:121\n";
+"--src vad_make.sql:120\n";
 
 static const char *proc64 = 
+"#line 139 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_DAV_MOVE\" (\n"
 "in name varchar,\n"
 "in destination varchar,\n"
@@ -1887,9 +1952,10 @@ static const char *proc64 =
 "ret := \"DB\".\"DBA\".\"DAV_MOVE\" (name, destination, overwrite, usr, pwd);\n"
 "return ret;\n"
 "}\n"
-"--src vad_make.sql:138\n";
+"--src vad_make.sql:137\n";
 
 static const char *proc65 = 
+"#line 153 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_DAV_GET_RES\" (\n"
 "inout ini any,\n"
 "in name varchar,\n"
@@ -1906,9 +1972,10 @@ static const char *proc65 =
 "ret := \"DB\".\"DBA\".\"DAV_RES_GET\" (name, data, usr, pwd);\n"
 "return ret;\n"
 "}\n"
-"--src vad_make.sql:152\n";
+"--src vad_make.sql:151\n";
 
 static const char *proc66 = 
+"#line 171 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_DAV_UPLOAD_RES\" (\n"
 "inout ini any,\n"
 "in name varchar,\n"
@@ -1928,9 +1995,10 @@ static const char *proc66 =
 "ret := \"DB\".\"DBA\".\"DAV_RES_UPLOAD_STRSES\" (name, data, \'\', dav_perm, dav_owner, dav_grp, usr, pwd);\n"
 "return ret;\n"
 "}\n"
-"--src vad_make.sql:170\n";
+"--src vad_make.sql:169\n";
 
 static const char *proc67 = 
+"#line 192 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_DAV_DELETE\" (\n"
 "inout ini any,\n"
 "in name varchar ) returns integer\n"
@@ -1943,9 +2011,10 @@ static const char *proc67 =
 "ret := \"VAD\".\"DBA\".\"DAV_DELETE_VAD\" (name, 0);\n"
 "return ret;\n"
 "}\n"
-"--src vad_make.sql:191\n";
+"--src vad_make.sql:190\n";
 
 static const char *proc68 = 
+"#line 206 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_MD5_FILE\" (\n"
 "in fname varchar,\n"
 "in is_dav integer)\n"
@@ -1977,9 +2046,10 @@ static const char *proc68 =
 "ctx := md5_final (ctx);\n"
 "return ctx;\n"
 "}\n"
-"--src vad_make.sql:205\n";
+"--src vad_make.sql:204\n";
 
 static const char *proc69 = 
+"#line 239 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_SPLIT_PATH\" (\n"
 "in fpath varchar,\n"
 "inout path varchar,\n"
@@ -2007,9 +2077,10 @@ static const char *proc69 =
 "name := subseq (fpath, idx + 1, length (fpath));\n"
 "}\n"
 "}\n"
-"--src vad_make.sql:238\n";
+"--src vad_make.sql:237\n";
 
 static const char *proc70 = 
+"#line 268 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_OUT_CHAR\" (\n"
 "inout ses any,\n"
 "inout pos integer,\n"
@@ -2023,9 +2094,10 @@ static const char *proc70 =
 "ctx := md5_update (ctx, s);\n"
 "pos := pos + 1;\n"
 "}\n"
-"--src vad_make.sql:267\n";
+"--src vad_make.sql:266\n";
 
 static const char *proc71 = 
+"#line 283 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_GET_CHAR\" (\n"
 "inout ses any,\n"
 "inout pos integer)\n"
@@ -2040,9 +2112,10 @@ static const char *proc71 =
 "\n"
 "return c;\n"
 "}\n"
-"--src vad_make.sql:282\n";
+"--src vad_make.sql:281\n";
 
 static const char *proc72 = 
+"#line 299 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_OUT_LONG\" (\n"
 "inout ses any,\n"
 "inout pos integer,\n"
@@ -2071,9 +2144,10 @@ static const char *proc72 =
 "\"VAD\".\"DBA\".\"VAD_OUT_CHAR\" (ses, pos, v2, ctx);\n"
 "\"VAD\".\"DBA\".\"VAD_OUT_CHAR\" (ses, pos, v1, ctx);\n"
 "}\n"
-"--src vad_make.sql:298\n";
+"--src vad_make.sql:297\n";
 
 static const char *proc73 = 
+"#line 330 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_GET_LONG\" (\n"
 "inout ses any,\n"
 "inout pos integer)\n"
@@ -2091,9 +2165,10 @@ static const char *proc73 =
 "\n"
 "return v1 + 256 * ( v2 + 256 * ( v3 + 256 * ( v4 )));\n"
 "}\n"
-"--src vad_make.sql:329\n";
+"--src vad_make.sql:328\n";
 
 static const char *proc74 = 
+"#line 349 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_OUT_ROW\" (\n"
 "inout ses any,\n"
 "inout pos integer,\n"
@@ -2118,9 +2193,10 @@ static const char *proc74 =
 "ctx := md5_update (ctx, data);\n"
 "string_to_file (ses, data, -1);\n"
 "}\n"
-"--src vad_make.sql:348\n";
+"--src vad_make.sql:347\n";
 
 static const char *proc75 = 
+"#line 375 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_OUT_ROW_FILE\" (\n"
 "inout ses any,\n"
 "inout pos integer,\n"
@@ -2159,9 +2235,10 @@ static const char *proc75 =
 "i := i + 4096;\n"
 "}\n"
 "}\n"
-"--src vad_make.sql:374\n";
+"--src vad_make.sql:373\n";
 
 static const char *proc76 = 
+"#line 415 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_OUT_ROW_DAV\" (\n"
 "inout ses any,\n"
 "inout pos integer,\n"
@@ -2202,9 +2279,10 @@ static const char *proc76 =
 "ctx := md5_update (ctx, data);\n"
 "string_to_file (ses, data, -1);\n"
 "}\n"
-"--src vad_make.sql:414\n";
+"--src vad_make.sql:413\n";
 
 static const char *proc77 = 
+"#line 458 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_GET_ROW\" (\n"
 "inout ses any,\n"
 "inout pos integer,\n"
@@ -2236,9 +2314,10 @@ static const char *proc77 =
 "\n"
 "return 1;\n"
 "}\n"
-"--src vad_make.sql:457\n";
+"--src vad_make.sql:456\n";
 
 static const char *proc78 = 
+"#line 492 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_GET_ROW_FILE\" (\n"
 "inout ses any,\n"
 "inout pos integer,\n"
@@ -2429,9 +2508,10 @@ static const char *proc78 =
 "return 1;\n"
 "}\n"
 "}\n"
-"--src vad_make.sql:491\n";
+"--src vad_make.sql:490\n";
 
 static const char *proc79 = 
+"#line 684 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_TEST_CREATE\" (\n"
 "in arr any,\n"
 "in fname varchar,\n"
@@ -2477,6 +2557,7 @@ static const char *proc79 =
 "{\n"
 "s2 := cast (xpath_eval (\'@type\', aref (items, j)) as varchar);\n"
 "s6 := cast (xpath_eval (\'@source\', aref (items, j)) as varchar);\n"
+"s5 := cast (xpath_eval (\'@source_uri\', aref (items, j)) as varchar);\n"
 "s3 := cast (xpath_eval (\'@target_uri\', aref (items, j)) as varchar);\n"
 "s4 := get_keyword (s6, iniarr);\n"
 "if (s4 is null or length(s4)=0)\n"
@@ -2484,11 +2565,14 @@ static const char *proc79 =
 "_err_message := sprintf (\'Illegal resource type:%s for %s\', s2,s3);\n"
 "goto error_fin;\n"
 "}\n"
-"s4 := sprintf (\'%s/%s\', s4, s3);\n"
+"if (s5 is null or length(s5)=0)\n"
+"{\n"
+"s5 := sprintf (\'%s/%s\', s4, s3);\n"
+"}\n"
 "if (neq (s6, \'dav\'))\n"
-"\"VAD\".\"DBA\".\"VAD_OUT_ROW_FILE\" (fname, pos, s3, s4, ctx);\n"
+"\"VAD\".\"DBA\".\"VAD_OUT_ROW_FILE\" (fname, pos, s3, s5, ctx);\n"
 "else\n"
-"\"VAD\".\"DBA\".\"VAD_OUT_ROW_DAV\" (fname, pos, s3, s4, ctx, iniarr);\n"
+"\"VAD\".\"DBA\".\"VAD_OUT_ROW_DAV\" (fname, pos, s3, s5, ctx, iniarr);\n"
 "j := j + 1;\n"
 "}\n"
 "data := md5_final (ctx);\n"
@@ -2498,9 +2582,10 @@ static const char *proc79 =
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (_err_message);\n"
 "return 0;\n"
 "}\n"
-"--src vad_make.sql:683\n";
+"--src vad_make.sql:682\n";
 
 static const char *proc80 = 
+"#line 756 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_CHECK_INSTALLABILITY\" (\n"
 "in fname varchar,\n"
 "in is_dav integer) returns varchar\n"
@@ -2509,9 +2594,10 @@ static const char *proc80 =
 "\"VAD\".\"DBA\".\"VAD_TEST_READ\" (fname, name, vers, fullname, pkg_date, is_dav);\n"
 "return \'OK\';\n"
 "}\n"
-"--src vad_make.sql:751\n";
+"--src vad_make.sql:754\n";
 
 static const char *proc81 = 
+"#line 766 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_CHECK_STICKER_DETAILS\" (\n"
 "inout parr any,\n"
 "in doc any,\n"
@@ -2733,9 +2819,10 @@ static const char *proc81 =
 "\"VAD\".\"DBA\".\"VAD_EXEC\" (proc_install_check_code);\n"
 "return 1;\n"
 "}\n"
-"--src vad_make.sql:761\n";
+"--src vad_make.sql:764\n";
 
 static const char *proc82 = 
+"#line 989 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_GET_STICKER_DATA_LEN\" (\n"
 "in fname varchar,\n"
 "in is_dav integer )\n"
@@ -2782,9 +2869,10 @@ static const char *proc82 =
 "error_nofile:\n"
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'VAD file (%s) problems:\\n%s\', fname, __SQL_MESSAGE));\n"
 "}\n"
-"--src vad_make.sql:984\n";
+"--src vad_make.sql:987\n";
 
 static const char *proc83 = 
+"#line 1037 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_TEST_READ\" (\n"
 "in fname varchar,\n"
 "inout pkg_name varchar,\n"
@@ -2880,9 +2968,10 @@ static const char *proc83 =
 "error_nofile:\n"
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'VAD file (%s) problems:\\n%s\', fname, __SQL_MESSAGE));\n"
 "}\n"
-"--src vad_make.sql:1032\n";
+"--src vad_make.sql:1035\n";
 
 static const char *proc84 = 
+"#line 1134 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_INSTALL\" (\n"
 "in fname varchar,\n"
 "in is_dav integer := 0,\n"
@@ -3015,9 +3104,10 @@ static const char *proc84 =
 "registry_set (\'VAD_is_run\', \'0\');\n"
 "return \'ERROR\';\n"
 "}\n"
-"--src vad_make.sql:1129\n";
+"--src vad_make.sql:1132\n";
 
 static const char *proc85 = 
+"#line 1268 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_READ\" (\n"
 "inout parr any,\n"
 "in fname varchar,\n"
@@ -3334,9 +3424,10 @@ static const char *proc85 =
 "error_nofile:\n"
 "\"VAD\".\"DBA\".\"VAD_FAIL_CHECK\" (sprintf (\'VAD file (%s) problems:\\n%s\', fname, __SQL_MESSAGE));\n"
 "}\n"
-"--src vad_make.sql:1263\n";
+"--src vad_make.sql:1266\n";
 
 static const char *proc86 = 
+"#line 1586 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_PKG_UNINSTALL_CHECK\" (\n"
 "inout parr any,\n"
 "in pkgid integer )\n"
@@ -3353,9 +3444,10 @@ static const char *proc86 =
 "\"VAD\".\"DBA\".\"VAD_EXEC\" (lval);\n"
 "return 1;\n"
 "}\n"
-"--src vad_make.sql:1581\n";
+"--src vad_make.sql:1584\n";
 
 static const char *proc87 = 
+"#line 1604 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_UNINSTALL_LIST_FOLDER\" (\n"
 "inout parr any,\n"
 "in id integer,\n"
@@ -3378,9 +3470,10 @@ static const char *proc87 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src vad_make.sql:1599\n";
+"--src vad_make.sql:1602\n";
 
 static const char *proc88 = 
+"#line 1628 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_DO_UNINSTALL\" (\n"
 "inout parr any,\n"
 "in arr any )\n"
@@ -3419,9 +3512,10 @@ static const char *proc88 =
 "cont:;\n"
 "}\n"
 "}\n"
-"--src vad_make.sql:1623\n";
+"--src vad_make.sql:1626\n";
 
 static const char *proc89 = 
+"#line 1668 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_UNINSTALL_LIST\" (\n"
 "inout parr any,\n"
 "in pkgid integer )\n"
@@ -3450,9 +3544,10 @@ static const char *proc89 =
 "}\n"
 "return arr;\n"
 "}\n"
-"--src vad_make.sql:1663\n";
+"--src vad_make.sql:1666\n";
 
 static const char *proc90 = 
+"#line 1698 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_PKG_UNINSTALL\" (\n"
 "inout parr any,\n"
 "in pkgid integer,\n"
@@ -3484,9 +3579,10 @@ static const char *proc90 =
 "\"VAD\".\"DBA\".\"VAD_DEL_SUBTREE\"(pkgid);\n"
 "return 1;\n"
 "}\n"
-"--src vad_make.sql:1693\n";
+"--src vad_make.sql:1696\n";
 
 static const char *proc91 = 
+"#line 1732 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_CHECK_UNINSTALLABILITY_BY_NAME\"(\n"
 "in name varchar) returns varchar\n"
 "{\n"
@@ -3506,9 +3602,10 @@ static const char *proc91 =
 "\"VAD\".\"DBA\".\"VAD_PKG_UNINSTALL_CHECK\"(parr, curdir);\n"
 "return \'OK\';\n"
 "}\n"
-"--src vad_make.sql:1727\n";
+"--src vad_make.sql:1730\n";
 
 static const char *proc92 = 
+"#line 1754 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_CHECK_UNINSTALLABILITY\"(\n"
 "in name varchar) returns varchar\n"
 "{\n"
@@ -3532,9 +3629,10 @@ static const char *proc92 =
 "\"VAD\".\"DBA\".\"VAD_PKG_UNINSTALL_CHECK\"(parr, curdir);\n"
 "return \'OK\';\n"
 "}\n"
-"--src vad_make.sql:1749\n";
+"--src vad_make.sql:1752\n";
 
 static const char *proc93 = 
+"#line 1780 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_UNINSTALL_BY_NAME\"(\n"
 "in name varchar) returns varchar\n"
 "{\n"
@@ -3553,9 +3651,10 @@ static const char *proc93 =
 "\"VAD\".\"DBA\".\"VAD_PKG_UNINSTALL\"(parr, tid, lval);\n"
 "return \'OK\';\n"
 "}\n"
-"--src vad_make.sql:1775\n";
+"--src vad_make.sql:1778\n";
 
 static const char *proc94 = 
+"#line 1801 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_CHECK_VERSION\"(\n"
 "in name varchar) returns varchar\n"
 "{\n"
@@ -3574,9 +3673,10 @@ static const char *proc94 =
 "\n"
 "return lval;\n"
 "}\n"
-"--src vad_make.sql:1796\n";
+"--src vad_make.sql:1799\n";
 
 static const char *proc95 = 
+"#line 1821 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_CLEAN_OLD_VERSIONS\" (in name varchar)\n"
 "{\n"
 "declare parr any;\n"
@@ -3601,9 +3701,10 @@ static const char *proc95 =
 "}\n"
 "return lval;\n"
 "}\n"
-"--src vad_make.sql:1816\n";
+"--src vad_make.sql:1819\n";
 
 static const char *proc96 = 
+"#line 1847 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_RENAME\" (in name varchar, in new_name varchar)\n"
 "{\n"
 "declare old_pkey, docs, files, ddls, ver varchar;\n"
@@ -3677,9 +3778,10 @@ static const char *proc96 =
 "update VAD.DBA.VAD_REGISTRY set R_KEY = new_key, R_SHKEY = new_name where R_ID = rid;\n"
 "}\n"
 "}\n"
-"--src vad_make.sql:1842\n";
+"--src vad_make.sql:1845\n";
 
 static const char *proc97 = 
+"#line 1922 \"[executable]/vad_make.sql\"\n"
 "create procedure DB.DBA.VAD_LIST_PACKAGES ()\n"
 "{\n"
 "declare pkgs any;\n"
@@ -3693,9 +3795,10 @@ static const char *proc97 =
 "}\n"
 "\n"
 "}\n"
-"--src vad_make.sql:1917\n";
+"--src vad_make.sql:1920\n";
 
 static const char *proc98 = 
+"#line 1938 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_UNINSTALL\"(\n"
 "in name varchar) returns varchar\n"
 "{\n"
@@ -3718,9 +3821,10 @@ static const char *proc98 =
 "\"VAD\".\"DBA\".\"VAD_PKG_UNINSTALL\"(parr, tid, version);\n"
 "return \'OK\';\n"
 "}\n"
-"--src vad_make.sql:1933\n";
+"--src vad_make.sql:1936\n";
 
 static const char *proc99 = 
+"#line 1962 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_PKG_DIFF\" (\n"
 "inout parr any,\n"
 "in pkgid integer )\n"
@@ -3745,9 +3849,10 @@ static const char *proc99 =
 "\n"
 "return outarr;\n"
 "}\n"
-"--src vad_make.sql:1957\n";
+"--src vad_make.sql:1960\n";
 
 static const char *proc100 = 
+"#line 1989 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_CHECK_INSTALLED\" (\n"
 "in name varchar ) returns integer\n"
 "{\n"
@@ -3768,9 +3873,10 @@ static const char *proc100 =
 "return 0;\n"
 "return 1;\n"
 "}\n"
-"--src vad_make.sql:1984\n";
+"--src vad_make.sql:1987\n";
 
 static const char *proc101 = 
+"#line 2011 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_CHECK\" (\n"
 "in name varchar ) returns any\n"
 "{\n"
@@ -3792,9 +3898,10 @@ static const char *proc101 =
 "tid := \"VAD\".\"DBA\".\"VAD_CHDIR\"(parr, tid, version);\n"
 "return \"VAD\".\"DBA\".\"VAD_PKG_DIFF\" (parr, tid);\n"
 "}\n"
-"--src vad_make.sql:2006\n";
+"--src vad_make.sql:2009\n";
 
 static const char *proc102 = 
+"#line 2034 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_PACK\"(\n"
 "in sticker_uri varchar,\n"
 "in base_uri_of_resources varchar,\n"
@@ -3812,9 +3919,10 @@ static const char *proc102 =
 "\"VAD\".\"DBA\".\"VAD_TEST_CREATE\" (parr, package_uri, sticker);\n"
 "return \'OK\';\n"
 "}\n"
-"--src vad_make.sql:2029\n";
+"--src vad_make.sql:2032\n";
 
 static const char *proc103 = 
+"#line 2053 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_LOAD_SQL_FILE\" (\n"
 "in sql_file_name varchar,\n"
 "in _grouping integer,\n"
@@ -3916,9 +4024,10 @@ static const char *proc103 =
 "end_of_file:  \n"
 "exec (\'commit work\', commit_err_sqlstate, commit_err_msg);\n"
 "}\n"
-"--src vad_make.sql:2048\n";
+"--src vad_make.sql:2051\n";
 
 static const char *proc104 = 
+"#line 2156 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_REMOVE_FILE\"(\n"
 "in folder varchar )\n"
 "{\n"
@@ -3928,9 +4037,10 @@ static const char *proc104 =
 "folder := replace(folder, \'//\', \'/\');\n"
 "file_delete(folder, 1);\n"
 "}\n"
-"--src vad_make.sql:2151\n";
+"--src vad_make.sql:2154\n";
 
 static const char *proc105 = 
+"#line 2167 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_CREATE_INSTALL_FOLDER_TREE\" (\n"
 ")\n"
 "{\n"
@@ -3944,9 +4054,10 @@ static const char *proc105 =
 "file_mkdir(concat(http_root(), \'/vad/code\'));\n"
 "file_mkdir(concat(http_root(), \'/vad/data\'));\n"
 "}\n"
-"--src vad_make.sql:2162\n";
+"--src vad_make.sql:2165\n";
 
 static const char *proc106 = 
+"#line 2182 \"[executable]/vad_make.sql\"\n"
 "create procedure \"DB\".\"DBA\".\"VAD_CREATE_PATH\"(\n"
 "in full_path varchar )\n"
 "{\n"
@@ -3980,9 +4091,10 @@ static const char *proc106 =
 "i := i + 1;\n"
 "}\n"
 "}\n"
-"--src vad_make.sql:2177\n";
+"--src vad_make.sql:2180\n";
 
 static const char *proc107 = 
+"#line 2217 \"[executable]/vad_make.sql\"\n"
 "create procedure DB.DBA.VAD_DEPS_CHECK (in parr any, in name varchar, in version varchar)\n"
 "{\n"
 "declare pkgs, arr any;\n"
@@ -4026,9 +4138,10 @@ static const char *proc107 =
 "}\n"
 "\n"
 "}\n"
-"--src vad_make.sql:2212\n";
+"--src vad_make.sql:2215\n";
 
 static const char *proc108 = 
+"#line 2263 \"[executable]/vad_make.sql\"\n"
 "create procedure VAD.DBA.VER_LT (in x varchar, in y varchar)\n"
 "{\n"
 "declare xx, yy any;\n"
@@ -4054,9 +4167,10 @@ static const char *proc108 =
 "}\n"
 "return 0;\n"
 "}\n"
-"--src vad_make.sql:2258\n";
+"--src vad_make.sql:2261\n";
 
 static const char *proc109 = 
+"#line 2290 \"[executable]/vad_make.sql\"\n"
 "create procedure \"VAD\".\"DBA\".\"VAD_AUTO_UPGRADE\" ()\n"
 "{\n"
 "declare vads, name, ver, arr, isdav any;\n"
@@ -4119,7 +4233,7 @@ static const char *proc109 =
 "}\n"
 "}\n"
 "}\n"
-"--src vad_make.sql:2285\n";
+"--src vad_make.sql:2288\n";
 
 static int
 sch_proc_def_exists (client_connection_t *cli, const char *proc_name)
diff --git a/libsrc/Wi/sql_code_vdb.c b/libsrc/Wi/sql_code_vdb.c
index bb70df9..abc2703 100644
--- a/libsrc/Wi/sql_code_vdb.c
+++ b/libsrc/Wi/sql_code_vdb.c
@@ -7,6 +7,7 @@
 /* vdb.sql */
 
 static const char *proc0 = 
+"#line 26 \"[executable]/vdb.sql\"\n"
 "create procedure att_fill_non_pk_parts (in local_name varchar, in pk_id integer,\n"
 "in pk_n_parts integer)\n"
 "{\n"
@@ -34,7 +35,7 @@ static const char *proc0 =
 "done:\n"
 "return;\n"
 "}\n"
-"--src vdb.sql:25\n";
+"--src vdb.sql:24\n";
 
 static int
 sch_proc_def_exists (client_connection_t *cli, const char *proc_name)
diff --git a/libsrc/Wi/sql_code_ws.c b/libsrc/Wi/sql_code_ws.c
index e5e3191..1a95dc0 100644
--- a/libsrc/Wi/sql_code_ws.c
+++ b/libsrc/Wi/sql_code_ws.c
@@ -7,6 +7,7 @@
 /* vsp_auth.sql */
 
 static const char *proc0 = 
+"#line 48 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "islwsp (in ch integer)\n"
 "{\n"
@@ -19,9 +20,10 @@ static const char *proc0 =
 "return (0);\n"
 "}\n"
 "}\n"
-"--src vsp_auth.sql:47\n";
+"--src vsp_auth.sql:46\n";
 
 static const char *proc1 = 
+"#line 63 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "issep (in ch integer)\n"
 "{\n"
@@ -34,9 +36,10 @@ static const char *proc1 =
 "return (0);\n"
 "}\n"
 "}\n"
-"--src vsp_auth.sql:62\n";
+"--src vsp_auth.sql:61\n";
 
 static const char *proc2 = 
+"#line 78 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "skip_lwsp (in str varchar, in pos integer, in len integer)\n"
 "{\n"
@@ -50,9 +53,10 @@ static const char *proc2 =
 "}\n"
 "return (inx);\n"
 "}\n"
-"--src vsp_auth.sql:77\n";
+"--src vsp_auth.sql:76\n";
 
 static const char *proc3 = 
+"#line 94 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "skip_sep (in str varchar, in pos integer, in len integer)\n"
 "{\n"
@@ -68,9 +72,10 @@ static const char *proc3 =
 "\n"
 "return (inx);\n"
 "}\n"
-"--src vsp_auth.sql:93\n";
+"--src vsp_auth.sql:92\n";
 
 static const char *proc4 = 
+"#line 112 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "skip_quote (in str varchar, in pos integer, in len integer)\n"
 "{\n"
@@ -84,9 +89,10 @@ static const char *proc4 =
 "}\n"
 "return (inx + 1);\n"
 "}\n"
-"--src vsp_auth.sql:111\n";
+"--src vsp_auth.sql:110\n";
 
 static const char *proc5 = 
+"#line 136 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_auth_next_tok (in str varchar, inout pos integer, in len integer)\n"
 "{\n"
@@ -155,9 +161,10 @@ static const char *proc5 =
 "}\n"
 "return (null);\n"
 "}\n"
-"--src vsp_auth.sql:135\n";
+"--src vsp_auth.sql:134\n";
 
 static const char *proc6 = 
+"#line 207 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_auth_vec_compose (in str varchar, in meth varchar)\n"
 "{\n"
@@ -219,9 +226,10 @@ static const char *proc6 =
 "i := i + 1;\n"
 "}\n"
 "}\n"
-"--src vsp_auth.sql:206\n";
+"--src vsp_auth.sql:205\n";
 
 static const char *proc7 = 
+"#line 272 \"[executable]/vsp_auth.sql\"\n"
 " create procedure\n"
 "vsp_auth_vec (in lines varchar)\n"
 "{\n"
@@ -252,17 +260,19 @@ static const char *proc7 =
 "}\n"
 "return (0);\n"
 "}\n"
-"--src vsp_auth.sql:271\n";
+"--src vsp_auth.sql:270\n";
 
 static const char *proc8 = 
+"#line 304 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_ua_skip_lwsp (inout str varchar)\n"
 "{\n"
 "return (subseq (str, skip_lwsp (str, 0, length (str)), length (str)));\n"
 "}\n"
-"--src vsp_auth.sql:303\n";
+"--src vsp_auth.sql:302\n";
 
 static const char *proc9 = 
+"#line 312 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_ua_match_hdr (inout lines any, in match_str varchar)\n"
 "{\n"
@@ -281,23 +291,10 @@ static const char *proc9 =
 "}\n"
 "return \'\';\n"
 "}\n"
-"--src vsp_auth.sql:311\n";
+"--src vsp_auth.sql:310\n";
 
 static const char *proc10 = 
-"create procedure\n"
-"vsp_ua_prop_init ()\n"
-"{\n"
-"\n"
-"return (vector (\'has_basic_auth\', \'has_digest_auth\',\n"
-"\'is_msie\', \'has_frames\',\n"
-"\'has_tables\', \'has_css1\',\n"
-"\'has_css2\', \'has_xml\',\n"
-"\'browser_level\', \'ua_platform\',\n"
-"\'is_robot\', \'is_dav_client\'));\n"
-"}\n"
-"--src vsp_auth.sql:333\n";
-
-static const char *proc11 = 
+"#line 336 \"[executable]/vsp_auth.sql\"\n"
 " create procedure\n"
 "vsp_calculate_digest (in username varchar, in pass varchar, in auth_vec any)\n"
 "{\n"
@@ -329,9 +326,25 @@ static const char *proc11 =
 "}\n"
 "return gen_resp;\n"
 "}\n"
-"--src vsp_auth.sql:347\n";
+"--src vsp_auth.sql:334\n";
+
+static const char *proc11 = 
+"#line 369 \"[executable]/vsp_auth.sql\"\n"
+"create procedure\n"
+"vsp_ua_prop_init ()\n"
+"{\n"
+"\n"
+"return (vector (\'has_basic_auth\', \'has_digest_auth\',\n"
+"\'is_msie\', \'has_frames\',\n"
+"\'has_tables\', \'has_css1\',\n"
+"\'has_css2\', \'has_xml\',\n"
+"\'browser_level\', \'ua_platform\',\n"
+"\'is_robot\', \'is_dav_client\'));\n"
+"}\n"
+"--src vsp_auth.sql:367\n";
 
 static const char *proc12 = 
+"#line 382 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_ua_vec_init ()\n"
 "{\n"
@@ -372,14 +385,14 @@ static const char *proc12 =
 "2, \'Win32\',\n"
 "\'False\', \'False\'),\n"
 "\'Mozilla/4.*Windows*\',\n"
-"vector (\'True\', \'False\',\n"
+"vector (\'True\', \'True\',\n"
 "\'False\', \'True\',\n"
 "\'True\', \'True\',\n"
 "\'False\', \'False\',\n"
 "4, \'Win32\',\n"
 "\'False\', \'False\'),\n"
 "\'Mozilla/5.*Windows*\',\n"
-"vector (\'True\', \'False\',\n"
+"vector (\'True\', \'True\',\n"
 "\'False\', \'True\',\n"
 "\'True\', \'True\',\n"
 "\'False\', \'True\',\n"
@@ -392,8 +405,15 @@ static const char *proc12 =
 "\'False\', \'False\',\n"
 "4, \'Linux\',\n"
 "\'False\', \'False\'),\n"
+"\'Mozilla/5.*AppleWebKit/5*\',\n"
+"vector (\'True\', \'True\',\n"
+"\'False\', \'True\',\n"
+"\'True\', \'True\',\n"
+"\'True\', \'True\',\n"
+"5, \'NA\',\n"
+"\'False\', \'False\'),\n"
 "\'Mozilla/5.*Linux*\',\n"
-"vector (\'True\', \'False\',\n"
+"vector (\'True\', \'True\',\n"
 "\'False\', \'True\',\n"
 "\'True\', \'True\',\n"
 "\'False\', \'True\',\n"
@@ -407,7 +427,7 @@ static const char *proc12 =
 "4, \'Mac\',\n"
 "\'False\', \'False\'),\n"
 "\'Mozilla/5.*Macintosh*\',\n"
-"vector (\'True\', \'False\',\n"
+"vector (\'True\', \'True\',\n"
 "\'False\', \'True\',\n"
 "\'True\', \'True\',\n"
 "\'False\', \'True\',\n"
@@ -448,6 +468,13 @@ static const char *proc12 =
 "\'False\', \'False\',\n"
 "0, \'NA\',\n"
 "\'False\', \'False\'),\n"
+"\'WebDAVFS/*\',\n"
+"vector (\'True\', \'True\',\n"
+"\'False\', \'True\',\n"
+"\'True\',  \'True\',\n"
+"\'False\', \'False\',\n"
+"0, \'Mac\',\n"
+"\'False\', \'True\'),\n"
 "\'*\',\n"
 "vector (\'False\', \'False\',\n"
 "\'False\', \'False\',\n"
@@ -459,6 +486,7 @@ static const char *proc12 =
 "--src vsp_auth.sql:380\n";
 
 static const char *proc13 = 
+"#line 527 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_ua_get_prop (in prop_name varchar, inout ua_id varchar, inout prop_map any, inout ua_vec any)\n"
 "{\n"
@@ -478,17 +506,19 @@ static const char *proc13 =
 "\n"
 "return (aref (vsp_ua_get_prop_list (ua_id, prop_map, ua_vec), prop_idx));\n"
 "}\n"
-"--src vsp_auth.sql:511\n";
+"--src vsp_auth.sql:525\n";
 
 static const char *proc14 = 
+"#line 550 \"[executable]/vsp_auth.sql\"\n"
 " create procedure\n"
 "vsp_ua_get_props (in prop_name varchar, in lines any)\n"
 "{\n"
 "return vsp_ua_get_prop (prop_name, vsp_ua_id (lines), vsp_ua_prop_init (), vsp_ua_vec_init ());\n"
 "}\n"
-"--src vsp_auth.sql:534\n";
+"--src vsp_auth.sql:548\n";
 
 static const char *proc15 = 
+"#line 562 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_ua_get_prop_list (inout ua_id varchar, inout prop_map any, inout ua_vec any)\n"
 "{\n"
@@ -510,17 +540,19 @@ static const char *proc15 =
 "idx := idx + 2;\n"
 "}\n"
 "}\n"
-"--src vsp_auth.sql:546\n";
+"--src vsp_auth.sql:560\n";
 
 static const char *proc16 = 
+"#line 586 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "inc (inout i integer)\n"
 "{\n"
 "i := i + 1;\n"
 "}\n"
-"--src vsp_auth.sql:570\n";
+"--src vsp_auth.sql:584\n";
 
 static const char *proc17 = 
+"#line 594 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_ua_prop_tbl (inout prop_list any, inout prop_map any)\n"
 "{\n"
@@ -544,17 +576,19 @@ static const char *proc17 =
 "}\n"
 "http (\'</table>\');\n"
 "}\n"
-"--src vsp_auth.sql:578\n";
+"--src vsp_auth.sql:592\n";
 
 static const char *proc18 = 
+"#line 620 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_ua_id (in lines any)\n"
 "{\n"
 "return (vsp_ua_match_hdr (lines, \'%[Uu]ser-[Aa]gent: %\'));\n"
 "}\n"
-"--src vsp_auth.sql:604\n";
+"--src vsp_auth.sql:618\n";
 
 static const char *proc19 = 
+"#line 632 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_ua_match_hdr_1 (inout lines any, in match_str varchar)\n"
 "{\n"
@@ -581,34 +615,38 @@ static const char *proc19 =
 "}\n"
 "return (null);\n"
 "}\n"
-"--src vsp_auth.sql:616\n";
+"--src vsp_auth.sql:630\n";
 
 static const char *proc20 = 
+"#line 661 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_ua_get_cookie_str (in lines any)\n"
 "{\n"
 "return (vsp_ua_match_hdr_1 (lines, \'%[Cc]ookie:%\'));\n"
 "}\n"
-"--src vsp_auth.sql:645\n";
+"--src vsp_auth.sql:659\n";
 
 static const char *proc21 = 
+"#line 673 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_ua_next_cookie (in cook_str varchar, inout inx integer)\n"
 "{\n"
 "return vector();\n"
 "}\n"
-"--src vsp_auth.sql:657\n";
+"--src vsp_auth.sql:671\n";
 
 static const char *proc22 = 
+"#line 686 \"[executable]/vsp_auth.sql\"\n"
 " create procedure\n"
 "vsp_ua_set_cookie (in cook_str varchar)\n"
 "{\n"
 "http_header (concat (http_header_get (),\n"
 "cook_str));\n"
 "}\n"
-"--src vsp_auth.sql:670\n";
+"--src vsp_auth.sql:684\n";
 
 static const char *proc23 = 
+"#line 695 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_ua_app_cookie (in cook_str varchar,\n"
 "in name varchar,\n"
@@ -636,9 +674,10 @@ static const char *proc23 =
 "\n"
 "return (tmp);\n"
 "}\n"
-"--src vsp_auth.sql:679\n";
+"--src vsp_auth.sql:693\n";
 
 static const char *proc24 = 
+"#line 726 \"[executable]/vsp_auth.sql\"\n"
 " create procedure\n"
 "vsp_auth_get (in realm varchar, in domain varchar,\n"
 "in nonce varchar, in opaque varchar,\n"
@@ -678,9 +717,10 @@ static const char *proc24 =
 "http_header (concat (coalesce (http_header_get (), \'\'), hdr));\n"
 "return 0;\n"
 "}\n"
-"--src vsp_auth.sql:710\n";
+"--src vsp_auth.sql:724\n";
 
 static const char *proc25 = 
+"#line 773 \"[executable]/vsp_auth.sql\"\n"
 " create procedure\n"
 "vsp_auth_verify_pass (in auth_vec varchar,\n"
 "in username varchar,\n"
@@ -744,9 +784,10 @@ static const char *proc25 =
 "\n"
 "\n"
 "}\n"
-"--src vsp_auth.sql:757\n";
+"--src vsp_auth.sql:771\n";
 
 static const char *proc26 = 
+"#line 839 \"[executable]/vsp_auth.sql\"\n"
 "create procedure\n"
 "vsp_ua_next_tok (in str varchar, in sep varchar, inout inx integer)\n"
 "{\n"
@@ -771,9 +812,10 @@ static const char *proc26 =
 "}\n"
 "return subseq (str, tok_st, inx);\n"
 "}\n"
-"--src vsp_auth.sql:823\n";
+"--src vsp_auth.sql:837\n";
 
 static const char *proc27 = 
+"#line 867 \"[executable]/vsp_auth.sql\"\n"
 " create procedure\n"
 "vsp_ua_get_cookie_vec (in lines any)\n"
 "{\n"
@@ -806,9 +848,10 @@ static const char *proc27 =
 "return (vector ());\n"
 "return (cook_vec);\n"
 "}\n"
-"--src vsp_auth.sql:851\n";
+"--src vsp_auth.sql:865\n";
 
 static const char *proc28 = 
+"#line 902 \"[executable]/vsp_auth.sql\"\n"
 " create procedure\n"
 "vsp_ua_make_cookie (in name varchar,\n"
 "in value varchar,\n"
@@ -839,11 +882,12 @@ static const char *proc28 =
 "tmp := concat (tmp, \'\\r\\n\');\n"
 "return (tmp);\n"
 "}\n"
-"--src vsp_auth.sql:886\n";
+"--src vsp_auth.sql:900\n";
 
 /* soap.sql */
 
 static const char *proc29 = 
+"#line 24 \"[executable]/soap.sql\"\n"
 " create procedure\n"
 "SOAP_CLIENT (\n"
 "in url varchar,\n"
@@ -896,9 +940,10 @@ static const char *proc29 =
 ");\n"
 "return ret;\n"
 "}\n"
-"--src soap.sql:23\n";
+"--src soap.sql:22\n";
 
 static const char *proc30 = 
+"#line 79 \"[executable]/soap.sql\"\n"
 " create procedure\n"
 "SOAP_ASYNC_CLIENT\n"
 "(\n"
@@ -972,9 +1017,10 @@ static const char *proc30 =
 "\n"
 "return resp;\n"
 "}\n"
-"--src soap.sql:78\n";
+"--src soap.sql:77\n";
 
 static const char *proc31 = 
+"#line 154 \"[executable]/soap.sql\"\n"
 "create procedure WSSE_GET_NS_INFO (inout doc any, inout ns any)\n"
 "{\n"
 "declare wsse any;\n"
@@ -996,23 +1042,26 @@ static const char *proc31 =
 "}\n"
 "}\n"
 "}\n"
-"--src soap.sql:153\n";
+"--src soap.sql:152\n";
 
 static const char *proc32 = 
+"#line 178 \"[executable]/soap.sql\"\n"
 " create procedure WSSE_OASIS_URI () returns varchar\n"
 "{\n"
 "return \'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\';\n"
 "}\n"
-"--src soap.sql:177\n";
+"--src soap.sql:176\n";
 
 static const char *proc33 = 
+"#line 185 \"[executable]/soap.sql\"\n"
 " create procedure WSSU_OASIS_URI () returns varchar\n"
 "{\n"
 "return \'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\';\n"
 "}\n"
-"--src soap.sql:184\n";
+"--src soap.sql:183\n";
 
 static const char *proc34 = 
+"#line 191 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "SOAP_DEFAULT_XENC_TEMPLATE (in body varchar, in key_name varchar, in ns any)\n"
 "{\n"
@@ -1061,9 +1110,10 @@ static const char *proc34 =
 ");\n"
 "\n"
 "}\n"
-"--src soap.sql:190\n";
+"--src soap.sql:189\n";
 
 static const char *proc35 = 
+"#line 241 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "SOAP_CLIENT_WSS (INOUT BODY ANY, INOUT KEYI ANY, INOUT TEMPLATE VARCHAR, INOUT SIGN INT, INOUT NS ANY)\n"
 "{\n"
@@ -1106,9 +1156,10 @@ static const char *proc35 =
 "string_output_flush (BODY);\n"
 "http (resp, BODY);\n"
 "}\n"
-"--src soap.sql:240\n";
+"--src soap.sql:239\n";
 
 static const char *proc36 = 
+"#line 286 \"[executable]/soap.sql\"\n"
 " create procedure\n"
 "wsrp_error (in code integer, in reason varchar, in endpoint varchar, inout soap_xml any)\n"
 "{\n"
@@ -1119,9 +1170,10 @@ static const char *proc36 =
 "http_request_status (\'HTTP/1.1 500 Server Error\');\n"
 "signal (\'SOAP\', sprintf (\'%d %s\', code, reason));\n"
 "}\n"
-"--src soap.sql:285\n";
+"--src soap.sql:284\n";
 
 static const char *proc37 = 
+"#line 298 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "WS_SOAP_GET_KEYINFO (inout soap_xml any, inout lines any)\n"
 "{\n"
@@ -1213,9 +1265,10 @@ static const char *proc37 =
 "connection_set (\'wss-token-start\', stard);\n"
 "connection_set (\'wss-token-end\', endd);\n"
 "}\n"
-"--src soap.sql:297\n";
+"--src soap.sql:296\n";
 
 static const char *proc38 = 
+"#line 391 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "WS_SECURITY_CHECK (inout body varchar, inout soap_xml any, inout lines any, inout ns any)\n"
 "{\n"
@@ -1299,9 +1352,10 @@ static const char *proc38 =
 "}\n"
 "\n"
 "}\n"
-"--src soap.sql:390\n";
+"--src soap.sql:389\n";
 
 static const char *proc39 = 
+"#line 476 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "WS_SECURITY_ADD (inout body any, inout ns any)\n"
 "{\n"
@@ -1367,9 +1421,10 @@ static const char *proc39 =
 "return 0;\n"
 "return 1;\n"
 "}\n"
-"--src soap.sql:475\n";
+"--src soap.sql:474\n";
 
 static const char *proc40 = 
+"#line 544 \"[executable]/soap.sql\"\n"
 " create procedure\n"
 "WS_SOAP (in path any, in params any, in lines any)\n"
 "{\n"
@@ -1669,7 +1724,7 @@ static const char *proc40 =
 "else\n"
 "http_value (res);\n"
 "}\n"
-"--src soap.sql:543\n";
+"--src soap.sql:542\n";
 
 static const char *tbl0 = 
 "create table DB.DBA.WS_REFERRALS (\n"
@@ -1686,6 +1741,7 @@ static const char *alter0 =
 "alter table DB.DBA.WS_REFERRALS add R_STATIC varchar default NULL\n";
 
 static const char *proc41 = 
+"#line 859 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "DB.DBA.WS_SOAP_RF_HEADER (in soap_xml any, in lines any, in this_point varchar, in next_hop varchar)\n"
 "{\n"
@@ -1804,9 +1860,10 @@ static const char *proc41 =
 "return choice[1][0];\n"
 "return \'\';\n"
 "}\n"
-"--src soap.sql:858\n";
+"--src soap.sql:857\n";
 
 static const char *proc42 = 
+"#line 979 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "DB.DBA.WS_SOAP_RF_MESSAGE (in soap_xml any, in lines any, inout action varchar, inout this_url varchar)\n"
 "{\n"
@@ -1997,9 +2054,10 @@ static const char *proc42 =
 "\n"
 "return NULL;\n"
 "}\n"
-"--src soap.sql:978\n";
+"--src soap.sql:977\n";
 
 static const char *proc43 = 
+"#line 1171 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "SOAP_LOAD_SCH (in sch varchar, in udts any := null, in \"array\" int := 0, in do_result int := 1)\n"
 "{\n"
@@ -2060,9 +2118,10 @@ static const char *proc43 =
 "}\n"
 "return xarr;\n"
 "}\n"
-"--src soap.sql:1170\n";
+"--src soap.sql:1169\n";
 
 static const char *proc44 = 
+"#line 1234 \"[executable]/soap.sql\"\n"
 " create procedure\n"
 "DB.DBA.WSDL_SPLIT_NAME (in url varchar, in part int)\n"
 "{\n"
@@ -2086,7 +2145,7 @@ static const char *proc44 =
 "return url;\n"
 "return ret;\n"
 "}\n"
-"--src soap.sql:1233\n";
+"--src soap.sql:1232\n";
 
 static const char *other0 = 
 "insert soft DB.DBA.SYS_XPF_EXTENSIONS (XPE_NAME, XPE_PNAME) VALUES (\'http://www.openlinksw.com/wsdl/:split-name\',\n"
@@ -2094,6 +2153,7 @@ static const char *other0 =
 static const char *other1 = 
 "xpf_extension (\'http://www.openlinksw.com/wsdl/:split-name\', \'DB.DBA.WSDL_SPLIT_NAME\', 0)\n";
 static const char *proc45 = 
+"#line 1266 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "WSDL_IMPORT_TYPES (inout mid any)\n"
 "{\n"
@@ -2127,9 +2187,10 @@ static const char *proc45 =
 "i := i + 1;\n"
 "}\n"
 "}\n"
-"--src soap.sql:1265\n";
+"--src soap.sql:1264\n";
 
 static const char *proc46 = 
+"#line 1301 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "EXECUTE_SCRIPT (inout ses any)\n"
 "{\n"
@@ -2191,9 +2252,10 @@ static const char *proc46 =
 "}\n"
 "return NULL;\n"
 "}\n"
-"--src soap.sql:1300\n";
+"--src soap.sql:1299\n";
 
 static const char *proc47 = 
+"#line 1364 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "WSDL_IMPORT_UDT (in url varchar, in f varchar := null, in exec int := 0)\n"
 "{\n"
@@ -2223,9 +2285,10 @@ static const char *proc47 =
 "\n"
 "return src;\n"
 "}\n"
-"--src soap.sql:1363\n";
+"--src soap.sql:1362\n";
 
 static const char *proc48 = 
+"#line 1398 \"[executable]/soap.sql\"\n"
 " create procedure\n"
 "DB.DBA.XML_RPC_GET_PARAM_NAME (in proc varchar, in ordinal int)\n"
 "{\n"
@@ -2243,9 +2306,10 @@ static const char *proc48 =
 "elm := pars[ordinal - 1];\n"
 "return elm[3];\n"
 "}\n"
-"--src soap.sql:1397\n";
+"--src soap.sql:1396\n";
 
 static const char *proc49 = 
+"#line 1418 \"[executable]/soap.sql\"\n"
 " create procedure\n"
 "DB.DBA.XML_RPC_MAKE_ELT_NAME (in val varchar)\n"
 "{\n"
@@ -2256,7 +2320,7 @@ static const char *proc49 =
 "val := replace (val, \'%\', \'_x\');\n"
 "return val;\n"
 "}\n"
-"--src soap.sql:1417\n";
+"--src soap.sql:1416\n";
 
 static const char *other2 = 
 "insert soft DB.DBA.SYS_XPF_EXTENSIONS (XPE_NAME, XPE_PNAME)\n"
@@ -2269,6 +2333,7 @@ static const char *other4 =
 static const char *other5 = 
 "xpf_extension (\'http://www.openlinksw.com/xmlrpc/:makeElementName\', \'DB.DBA.XML_RPC_MAKE_ELT_NAME\', 0)\n";
 static const char *proc50 = 
+"#line 1448 \"[executable]/soap.sql\"\n"
 " create procedure DB.DBA.XML_RPC_DATE_CVT (in dt varchar)\n"
 "{\n"
 "declare ts any;\n"
@@ -2278,7 +2343,7 @@ static const char *proc50 =
 "ts := dt_set_tz (ts, 0);\n"
 "return soap_print_box (ts, \'\', 0);\n"
 "}\n"
-"--src soap.sql:1447\n";
+"--src soap.sql:1446\n";
 
 static const char *other6 = 
 "insert soft DB.DBA.SYS_XPF_EXTENSIONS (XPE_NAME, XPE_PNAME)\n"
@@ -2286,6 +2351,7 @@ static const char *other6 =
 static const char *other7 = 
 "xpf_extension (\'http://www.openlinksw.com/xmlrpc/:getGMTtime\', \'DB.DBA.XML_RPC_DATE_CVT\', 0)\n";
 static const char *proc51 = 
+"#line 1467 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "XMLRPC_MAKE_ERROR (in code varchar, in state varchar, in message varchar)\n"
 "{\n"
@@ -2310,9 +2376,10 @@ static const char *proc51 =
 "\'</fault>\\n\' ||\n"
 "\'</methodResponse>\' ;\n"
 "}\n"
-"--src soap.sql:1466\n";
+"--src soap.sql:1465\n";
 
 static const char *proc52 = 
+"#line 1496 \"[executable]/soap.sql\"\n"
 " create procedure\n"
 "XMLRPC_SERVER (in path any, in params any, in lines any)\n"
 "{\n"
@@ -2366,9 +2433,10 @@ static const char *proc52 =
 "dbg_obj_print (\'XML-RPC response:\', result);\n"
 "http_value (result);\n"
 "}\n"
-"--src soap.sql:1495\n";
+"--src soap.sql:1494\n";
 
 static const char *proc53 = 
+"#line 1553 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "XMLRPC2SOAP (INOUT BODY VARCHAR)\n"
 "{\n"
@@ -2387,9 +2455,10 @@ static const char *proc53 =
 "http_value (ret, null, ses);\n"
 "BODY := string_output_string (ses);\n"
 "}\n"
-"--src soap.sql:1552\n";
+"--src soap.sql:1551\n";
 
 static const char *proc54 = 
+"#line 1573 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "SOAP2XMLRPC (INOUT BODY VARCHAR)\n"
 "{\n"
@@ -2404,9 +2473,10 @@ static const char *proc54 =
 "string_output_flush (BODY);\n"
 "http_value (ret, null, BODY);\n"
 "}\n"
-"--src soap.sql:1572\n";
+"--src soap.sql:1571\n";
 
 static const char *proc55 = 
+"#line 1592 \"[executable]/soap.sql\"\n"
 " create procedure\n"
 "XMLRPC_CALL (in uri varchar, in meth varchar, in params any, in id any := null)\n"
 "{\n"
@@ -2426,9 +2496,10 @@ static const char *proc55 =
 "res := soap_call_new (hinfo[1], hinfo[2], null, meth, pars, 11, null, null, null, 32, null, null, 0, null, null, null, id);\n"
 "return res;\n"
 "}\n"
-"--src soap.sql:1591\n";
+"--src soap.sql:1590\n";
 
 static const char *proc56 = 
+"#line 1614 \"[executable]/soap.sql\"\n"
 " create procedure\n"
 "SOAP12_ROUTER (in uri varchar, in this_url varchar, in header any, in body any)\n"
 "{\n"
@@ -2456,9 +2527,10 @@ static const char *proc56 =
 "\n"
 "http_proxy (host, head, ss);\n"
 "}\n"
-"--src soap.sql:1613\n";
+"--src soap.sql:1612\n";
 
 static const char *proc57 = 
+"#line 1643 \"[executable]/soap.sql\"\n"
 "create procedure\n"
 "DB.DBA.SOAP_WS_TRUST_XENC_TEMPLATE (in body varchar)\n"
 "{\n"
@@ -2475,7 +2547,7 @@ static const char *proc57 =
 "\'http://schemas.xmlsoap.org/ws/2003/03/addressing\', \'From\',\n"
 "\'http://schemas.xmlsoap.org/ws/2003/03/addressing\', \'Action\');\n"
 "}\n"
-"--src soap.sql:1642\n";
+"--src soap.sql:1641\n";
 
 static const char *tbl1 = 
 "create table SYS_SOAP_UDT_PUB (SUP_CLASS varchar,\n"
@@ -2485,14 +2557,16 @@ static const char *tbl1 =
 "primary key (SUP_LHOST, SUP_HOST, SUP_END_POINT, SUP_CLASS))\n";
 
 static const char *trig0 = 
+"#line 1668 \"[executable]/soap.sql\"\n"
 "create trigger HTTP_PATH_D_UDT_PUB after delete on DB.DBA.HTTP_PATH\n"
 "{\n"
 "delete from SYS_SOAP_UDT_PUB where SUP_LHOST = HP_LISTEN_HOST and\n"
 "SUP_HOST = HP_HOST and SUP_END_POINT = HP_LPATH;\n"
 "}\n"
-"--src soap.sql:1667\n";
+"--src soap.sql:1666\n";
 
 static const char *trig1 = 
+"#line 1675 \"[executable]/soap.sql\"\n"
 "create trigger SOAP_UDT_PUB_I before insert on SYS_SOAP_UDT_PUB\n"
 "{\n"
 "if (not exists\n"
@@ -2502,24 +2576,27 @@ static const char *trig1 =
 "signal (\'22023\', \'No such virtual directory defined\');\n"
 "__soap_udt_publish (SUP_HOST, SUP_LHOST, SUP_END_POINT, SUP_CLASS);\n"
 "}\n"
-"--src soap.sql:1674\n";
+"--src soap.sql:1673\n";
 
 static const char *trig2 = 
+"#line 1687 \"[executable]/soap.sql\"\n"
 "create trigger SOAP_UDT_PUB_U before update on SYS_SOAP_UDT_PUB referencing old as O, new as N\n"
 "{\n"
 "__soap_udt_unpublish (O.SUP_HOST, O.SUP_LHOST, O.SUP_END_POINT, O.SUP_CLASS);\n"
 "__soap_udt_publish (O.SUP_HOST, O.SUP_LHOST, N.SUP_END_POINT, N.SUP_CLASS);\n"
 "}\n"
-"--src soap.sql:1686\n";
+"--src soap.sql:1685\n";
 
 static const char *trig3 = 
+"#line 1695 \"[executable]/soap.sql\"\n"
 "create trigger SOAP_UDT_PUB_D before delete on SYS_SOAP_UDT_PUB\n"
 "{\n"
 "__soap_udt_unpublish (SUP_HOST, SUP_LHOST, SUP_END_POINT, SUP_CLASS);\n"
 "}\n"
-"--src soap.sql:1694\n";
+"--src soap.sql:1693\n";
 
 static const char *proc58 = 
+"#line 1702 \"[executable]/soap.sql\"\n"
 " create procedure GET_XSD_EXTENSION (in nam varchar)\n"
 "{\n"
 "declare ext any;\n"
@@ -2528,7 +2605,7 @@ static const char *proc58 =
 "return xml_tree_doc (\'<fake/>\');\n"
 "return ext;\n"
 "}\n"
-"--src soap.sql:1701\n";
+"--src soap.sql:1700\n";
 
 static const char *other8 = 
 "insert soft DB.DBA.SYS_XPF_EXTENSIONS (XPE_NAME, XPE_PNAME) VALUES\n"
@@ -2536,6 +2613,7 @@ static const char *other8 =
 static const char *other9 = 
 "xpf_extension (\'http://www.openlinksw.com/virtuoso/soap:getExtension\', \'DB.DBA.GET_XSD_EXTENSION\', 0)\n";
 static const char *proc59 = 
+"#line 1721 \"[executable]/soap.sql\"\n"
 "create procedure DB.DBA.WS_MIME_ENV (in _all any, in call_mode integer)\n"
 "{\n"
 "declare _inx, _len integer;\n"
@@ -2591,34 +2669,38 @@ static const char *proc59 =
 "\n"
 "return vector (_res, hdr);\n"
 "}\n"
-"--src soap.sql:1720\n";
+"--src soap.sql:1719\n";
 
 static const char *proc60 = 
+"#line 1779 \"[executable]/soap.sql\"\n"
 "create procedure DB.DBA.WS_MIME_RESP_C (in _all any)\n"
 "{\n"
 "return DB.DBA.WS_MIME_ENV (_all, 0);\n"
 "}\n"
-"--src soap.sql:1778\n";
+"--src soap.sql:1777\n";
 
 static const char *proc61 = 
+"#line 1785 \"[executable]/soap.sql\"\n"
 "create procedure DB.DBA.WS_MIME_RESP (in _all any)\n"
 "{\n"
 "return DB.DBA.WS_MIME_ENV (_all, 1);\n"
 "}\n"
-"--src soap.sql:1784\n";
+"--src soap.sql:1783\n";
 
 static const char *other10 = 
 "grant execute on DB.DBA.WS_MIME_RESP to public\n";
 static const char *other11 = 
 "grant execute on DB.DBA.WS_MIME_RESP_C to public\n";
 static const char *proc62 = 
+"#line 1797 \"[executable]/soap.sql\"\n"
 "create procedure vsmx_user_check (in name varchar, in pass varchar)\n"
 "{\n"
 "return 1;\n"
 "}\n"
-"--src soap.sql:1796\n";
+"--src soap.sql:1795\n";
 
 static const char *proc63 = 
+"#line 1804 \"[executable]/soap.sql\"\n"
 " create procedure\n"
 "DB.DBA.SOAP_VSMX (in path any, in params any, in lines any)\n"
 "{ ?>\n"
@@ -3142,12 +3224,12 @@ static const char *proc63 =
 "?>\n"
 "</TD></TR></TABLE>\n"
 "</DIV>\n"
-"<DIV class=\"foot\"><SPAN class=\"foot\">Virtuoso Universal Server <?=sys_stat(\'st_dbms_ver\')?> - Copyright© 1998-2010 OpenLink Software.</SPAN></DIV>\n"
+"<DIV class=\"foot\"><SPAN class=\"foot\">Virtuoso Universal Server <?=sys_stat(\'st_dbms_ver\')?> - Copyright© 1998-2011 OpenLink Software.</SPAN></DIV>\n"
 "</BODY>\n"
 "</HTML>\n"
 "<?vsp\n"
 "}\n"
-"--src soap.sql:1803\n";
+"--src soap.sql:1802\n";
 
 
 static const char *other12 = 
@@ -3192,6 +3274,7 @@ static const char *other12 =
 "</xsl:stylesheet>\')\n"
 ")\n";
 static const char *proc64 = 
+"#line 2377 \"[executable]/soap.sql\"\n"
 "create procedure WSDL_EXPAND (in _base_url any, in rsv any, inout schem any, inout defs any, inout ret any)\n"
 "{\n"
 "declare idx, len, idx1, len1, use_cache integer;\n"
@@ -3235,9 +3318,10 @@ static const char *proc64 =
 "idx := idx + 1;\n"
 "}\n"
 "}\n"
-"--src soap.sql:2376\n";
+"--src soap.sql:2375\n";
 
 static const char *proc65 = 
+"#line 2424 \"[executable]/soap.sql\"\n"
 " create procedure\n"
 "DB.DBA.SOAP_WSDL_IMPORT (in url varchar, in mode_wsdl integer := 1, in wire_dump integer := 0, in drop_module integer := 0)\n"
 "{\n"
@@ -3524,9 +3608,10 @@ static const char *proc65 =
 "ret := NULL;\n"
 "return ret;\n"
 "}\n"
-"--src soap.sql:2423\n";
+"--src soap.sql:2422\n";
 
 static const char *proc66 = 
+"#line 2712 \"[executable]/soap.sql\"\n"
 "create procedure FIND_WSDL (in _all any, in _what varchar)\n"
 "{\n"
 "declare idx, len integer;\n"
@@ -3545,9 +3630,10 @@ static const char *proc66 =
 "\n"
 "return NULL;\n"
 "}\n"
-"--src soap.sql:2711\n";
+"--src soap.sql:2710\n";
 
 static const char *proc67 = 
+"#line 2733 \"[executable]/soap.sql\"\n"
 "create procedure WSDL_GET (in uri varchar, in _mode integer)\n"
 "{\n"
 "declare _hdr, _ret any;\n"
@@ -3557,7 +3643,7 @@ static const char *proc67 =
 "_ret := xml_tree_doc (_ret);\n"
 "return _ret;\n"
 "}\n"
-"--src soap.sql:2732\n";
+"--src soap.sql:2731\n";
 
 /* wsrp_ultim.xsl */
 
@@ -3962,7 +4048,7 @@ static const char *xsl7[]= {
 "<?xml version=\"1.0\"?>\n"
 "<!--\n"
 " -\n"
-" -  $Id: soap_sch.xsl,v 1.4 2009/04/09 13:22:13 source Exp $\n"
+" -  $Id: soap_sch.xsl,v 1.4.2.1 2010/11/05 10:56:48 source Exp $\n"
 " -\n"
 " -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)\n"
 " -  project.\n"
@@ -4199,9 +4285,8 @@ static const char *xsl7[]= {
 "    <xsl:choose>\n"
 "	<xsl:when test=\"not boolean ($udt_struct)\">\n"
 "	  <xsl:variable name=\"ext\" select=\"vs:getExtension (@base)\"/>\n"
-"	  <xsl:if test=\"not $ext//xs:element or not xs:sequence/xs:element\">\n"
-"             <extension error=\"The 'extension' element is not supported\"/>\n"
-"	 </xsl:if>\n"
+"	  <xsl:choose>\n"
+"	      <xsl:when test=\"$ext//xs:element or xs:sequence/xs:element\">\n"
 "	  <restriction base=\"enc:Struct\">\n"
 "	      <sequence>\n"
 "		  <xsl:apply-templates select=\"$ext//xs:element\">\n"
@@ -4211,6 +4296,20 @@ static const char *xsl7[]= {
 "	      </sequence>\n"
 "	  </restriction>\n"
 "      </xsl:when>\n"
+"	      <xsl:when test=\"$ext//xs:simpleContent\">\n"
+"		  <restriction base=\"enc:Struct\">\n"
+"		      <xsl:apply-templates select=\"$ext//xs:simpleContent/xs:attribute\"/>\n"
+"		      <xsl:apply-templates select=\"xs:attribute\"/>\n"
+"		  </restriction>\n"
+"	      </xsl:when>\n"
+"	      <xsl:otherwise>\n"
+"		  <xsl:message terminate=\"no\"><xsl:copy-of select=\"vs:getExtension (@base)\"/></xsl:message>\n"
+"		  <extension>\n"
+"		      <xsl:attribute name=\"error\">The 'extension' element [<xsl:value-of select=\"@base\"/>] can not be found when expanding <xsl:value-of select=\"ancestor::*[@name]/@name\"/></xsl:attribute>\n"
+"		  </extension>\n"
+"	      </xsl:otherwise>\n"
+"	  </xsl:choose>\n"
+"      </xsl:when>\n"
 "      <xsl:otherwise>\n"
 "        <xsl:copy>\n"
 "          <xsl:copy-of select=\"@*\"/>\n"
@@ -4474,7 +4573,7 @@ static const char *xsl9[]= {
 "<?xml version='1.0'?>\n"
 "<!--\n"
 " -\n"
-" -  $Id: wsdl_expand.xsl,v 1.4 2009/04/09 13:22:15 source Exp $\n"
+" -  $Id: wsdl_expand.xsl,v 1.4.2.1 2010/11/05 10:56:48 source Exp $\n"
 " -\n"
 " -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)\n"
 " -  project.\n"
@@ -4591,10 +4690,10 @@ static const char *xsl9[]= {
 "		<xsl:variable name=\"sch\" select=\"document(@schemaLocation)\"/>\n"
 "		<xsl:apply-templates select=\"$sch/*\" mode=\"xsd\"/>\n"
 "	    </xsl:when>\n"
-"	    <xsl:otherwise>\n"
+"	    <!--xsl:otherwise>\n"
 "		<xsl:variable name=\"lns\" select=\"@namespace\"/>\n"
 "		<xsl:apply-templates select=\"//xsd:schema[@targetNamespace = $lns]\" mode=\"xsd\"/>\n"
-"	    </xsl:otherwise>\n"
+"	    </xsl:otherwise-->\n"
 "	</xsl:choose>\n"
 "    </xsl:for-each>\n"
 "    <xsl:copy>\n"
@@ -4809,7 +4908,7 @@ static const char *xsl11[]= {
 "<?xml version='1.0'?>\n"
 "<!--\n"
 " -\n"
-" -  $Id: wsdl_import.xsl,v 1.5 2009/04/09 13:22:15 source Exp $\n"
+" -  $Id: wsdl_import.xsl,v 1.5.2.1 2010/11/05 10:56:49 source Exp $\n"
 " -\n"
 " -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)\n"
 " -  project.\n"
@@ -5020,10 +5119,10 @@ static const char *xsl11[]= {
 "<xsl:variable name=\"inhdr\" select=\"$oper/input/header/@message\"/>\n"
 "<xsl:variable name=\"outhdr\" select=\"$oper/output/header/@message\"/>\n"
 "<xsl:for-each select=\"/wsdl:definitions/wsdl:message[@name = $inmsg or @name = $outmsg or @name = $inhdr or @name = $outhdr]/part\" >\n"
+"    <xsl:variable name=\"myname\" select=\"@name\"/>\n"
 "<xsl:choose>\n"
 "<xsl:when test=\"parent::wsdl:message[@name = $inmsg or @name = $inhdr]\">\n"
 "    <xsl:variable name=\"partname\" select=\"''\"/>\n"
-"    <xsl:variable name=\"myname\" select=\"@name\"/>\n"
 "    <xsl:choose>\n"
 "	<xsl:when test=\"/wsdl:definitions/wsdl:message[@name = $outmsg or @name = $outhdr]/part[@name=$myname]\">\n"
 "    <xsl:variable name=\"partty\" select=\"'inout'\"/>\n"
@@ -5872,11 +5971,12 @@ static const char *tbl3 =
 ")\n";
 
 static const char *trig4 = 
+"#line 100 \"[executable]/wsrm_ddl.sql\"\n"
 "create trigger SYS_WSRM_IN_SEQUENCES_D after delete on SYS_WSRM_IN_SEQUENCES\n"
 "{\n"
 "delete from SYS_WSRM_IN_MESSAGE_LOG where IML_INDENTIFIER = WIS_IDENTIFIER;\n"
 "}\n"
-"--src wsrm_ddl.sql:99\n";
+"--src wsrm_ddl.sql:98\n";
 
 static const char *tbl4 = 
 "CREATE TABLE SYS_WSRM_OUT_MESSAGE_LOG (\n"
@@ -5906,11 +6006,12 @@ static const char *tbl5 =
 ")\n";
 
 static const char *trig5 = 
+"#line 141 \"[executable]/wsrm_ddl.sql\"\n"
 "create trigger SYS_WSRM_OUT_SEQUENCES_D after delete on SYS_WSRM_OUT_SEQUENCES\n"
 "{\n"
 "delete from SYS_WSRM_OUT_MESSAGE_LOG where OML_INDENTIFIER = WOS_IDENTIFIER;\n"
 "}\n"
-"--src wsrm_ddl.sql:140\n";
+"--src wsrm_ddl.sql:139\n";
 
 static const char *udt2 = 
 "create type soap_parameter as\n"
@@ -6163,6 +6264,7 @@ static const char *other34 =
 "}\n";
 
 static const char *proc68 = 
+"#line 404 \"[executable]/wsrm_ddl.sql\"\n"
 "create procedure WSRM_ENSURE_SCH ()\n"
 "{\n"
 "if (registry_get (\'__wsrm_version__\') = \'0.8\')\n"
@@ -6182,7 +6284,7 @@ static const char *proc68 =
 "\n"
 "registry_set (\'__wsrm_version__\', \'0.8\');\n"
 "}\n"
-"--src wsrm_ddl.sql:403\n";
+"--src wsrm_ddl.sql:402\n";
 
 
 static const char *other35 = 
@@ -6190,6 +6292,7 @@ static const char *other35 =
 /* wsrm_xsd.sql */
 
 static const char *proc69 = 
+"#line 8 \"[executable]/wsrm_xsd.sql\"\n"
 "CREATE PROCEDURE WSRM_WSRM_XSD ()\n"
 "{\n"
 "declare ses any;\n"
@@ -6357,9 +6460,10 @@ static const char *proc69 =
 "http (\'</xsd:schema>\\n\', ses);\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src wsrm_xsd.sql:7\n";
+"--src wsrm_xsd.sql:6\n";
 
 static const char *proc70 = 
+"#line 180 \"[executable]/wsrm_xsd.sql\"\n"
 "CREATE PROCEDURE WSRM_WSP_XSD ()\n"
 "{\n"
 "declare ses any;\n"
@@ -6437,9 +6541,10 @@ static const char *proc70 =
 "http (\'</xsd:schema>\\n\', ses);\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src wsrm_xsd.sql:179\n";
+"--src wsrm_xsd.sql:178\n";
 
 static const char *proc71 = 
+"#line 262 \"[executable]/wsrm_xsd.sql\"\n"
 "CREATE PROCEDURE WSRM_WSA_XSD ()\n"
 "{\n"
 "declare ses any;\n"
@@ -6513,9 +6618,10 @@ static const char *proc71 =
 "http (\'</xs:schema>\\n\', ses);\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src wsrm_xsd.sql:261\n";
+"--src wsrm_xsd.sql:260\n";
 
 static const char *proc72 = 
+"#line 340 \"[executable]/wsrm_xsd.sql\"\n"
 "CREATE PROCEDURE WSRM_UTILITY_XSD ()\n"
 "{\n"
 "declare ses any;\n"
@@ -6554,9 +6660,10 @@ static const char *proc72 =
 "http (\'</xsd:schema>\\n\', ses);\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src wsrm_xsd.sql:339\n";
+"--src wsrm_xsd.sql:338\n";
 
 static const char *proc73 = 
+"#line 383 \"[executable]/wsrm_xsd.sql\"\n"
 "CREATE PROCEDURE WSRM_UTILITY200306_XSD ()\n"
 "{\n"
 "declare ses any;\n"
@@ -6578,9 +6685,10 @@ static const char *proc73 =
 "http (\'</xsd:schema>\\n\', ses);\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src wsrm_xsd.sql:382\n";
+"--src wsrm_xsd.sql:381\n";
 
 static const char *proc74 = 
+"#line 409 \"[executable]/wsrm_xsd.sql\"\n"
 "CREATE PROCEDURE WSRM_WSS_XSD ()\n"
 "{\n"
 "declare ses any;\n"
@@ -6603,9 +6711,10 @@ static const char *proc74 =
 "http (\'</xsd:schema>\\n\', ses);\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src wsrm_xsd.sql:408\n";
+"--src wsrm_xsd.sql:407\n";
 
 static const char *proc75 = 
+"#line 436 \"[executable]/wsrm_xsd.sql\"\n"
 "CREATE PROCEDURE WSRM_WSS0212_XSD ()\n"
 "{\n"
 "declare ses any;\n"
@@ -7069,9 +7178,10 @@ static const char *proc75 =
 "http (\'</xsd:schema>\\n\', ses);\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src wsrm_xsd.sql:435\n";
+"--src wsrm_xsd.sql:434\n";
 
 static const char *proc76 = 
+"#line 904 \"[executable]/wsrm_xsd.sql\"\n"
 "CREATE PROCEDURE WSRM_WSA200403_XSD ()\n"
 "{\n"
 "declare ses any;\n"
@@ -7148,9 +7258,10 @@ static const char *proc76 =
 "http (\'</xs:schema>\\n\', ses);\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src wsrm_xsd.sql:903\n";
+"--src wsrm_xsd.sql:902\n";
 
 static const char *proc77 = 
+"#line 985 \"[executable]/wsrm_xsd.sql\"\n"
 "CREATE PROCEDURE WSRM_OASIS200401WSSUTILITY_XSD ()\n"
 "{\n"
 "declare ses any;\n"
@@ -7190,9 +7301,10 @@ static const char *proc77 =
 "http (\'</xsd:schema>\\n\', ses);\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src wsrm_xsd.sql:984\n";
+"--src wsrm_xsd.sql:983\n";
 
 static const char *proc78 = 
+"#line 1029 \"[executable]/wsrm_xsd.sql\"\n"
 "CREATE PROCEDURE WSRM_ORABPEL_XSD ()\n"
 "{\n"
 "declare ses any;\n"
@@ -7205,9 +7317,10 @@ static const char *proc78 =
 "http (\'</xsd:schema>\\n\', ses);\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src wsrm_xsd.sql:1028\n";
+"--src wsrm_xsd.sql:1027\n";
 
 static const char *proc79 = 
+"#line 1046 \"[executable]/wsrm_xsd.sql\"\n"
 "CREATE PROCEDURE WSRM_WSRM_2005_02_XSD ()\n"
 "{\n"
 "declare ses any;\n"
@@ -7336,9 +7449,10 @@ static const char *proc79 =
 "http (\'</xs:schema>\\n\', ses);\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src wsrm_xsd.sql:1045\n";
+"--src wsrm_xsd.sql:1044\n";
 
 static const char *proc80 = 
+"#line 1179 \"[executable]/wsrm_xsd.sql\"\n"
 "CREATE PROCEDURE WSRM_WSA200408_XSD ()\n"
 "{\n"
 "declare ses any;\n"
@@ -7431,7 +7545,7 @@ static const char *proc80 =
 "http (\'</xs:schema>\\n\', ses);\n"
 "return string_output_string (ses);\n"
 "}\n"
-"--src wsrm_xsd.sql:1178\n";
+"--src wsrm_xsd.sql:1177\n";
 
 /* wsrmcli.sql */
 
@@ -7681,6 +7795,7 @@ static const char *other46 =
 "}\n";
 
 static const char *proc81 = 
+"#line 283 \"[executable]/wsrmcli.sql\"\n"
 "create procedure WSRM_CLIENT_POLICY (inout state wsrm_cli)\n"
 "{\n"
 "declare policy, ind, ver, spec_v, del_ass, i_timeout, r_int, a_int soap_parameter;\n"
@@ -7731,9 +7846,10 @@ static const char *proc81 =
 "\n"
 "return policy;\n"
 "}\n"
-"--src wsrmcli.sql:282\n";
+"--src wsrmcli.sql:281\n";
 
 static const char *proc82 = 
+"#line 336 \"[executable]/wsrmcli.sql\"\n"
 "create procedure WSRM_CLIENT (in state wsrm_cli, in is_last integer, in req SOAP_CLIENT_REQ)\n"
 "{\n"
 "declare ret, wa, policy any;\n"
@@ -7832,9 +7948,10 @@ static const char *proc82 =
 "\n"
 "return 0;\n"
 "}\n"
-"--src wsrmcli.sql:335\n";
+"--src wsrmcli.sql:334\n";
 
 static const char *proc83 = 
+"#line 436 \"[executable]/wsrmcli.sql\"\n"
 "create procedure WSRM_CLIENT_ERROR (in err_vec any)\n"
 "{\n"
 "declare xt any;\n"
@@ -7851,9 +7968,10 @@ static const char *proc83 =
 "}\n"
 "}\n"
 "}\n"
-"--src wsrmcli.sql:435\n";
+"--src wsrmcli.sql:434\n";
 
 static const char *proc84 = 
+"#line 454 \"[executable]/wsrmcli.sql\"\n"
 "create procedure WSRM_RESENDER (in identifier varchar)\n"
 "{\n"
 "declare ret, list any;\n"
@@ -7891,9 +8009,10 @@ static const char *proc84 =
 "idx := idx + 1;\n"
 "}\n"
 "}\n"
-"--src wsrmcli.sql:453\n";
+"--src wsrmcli.sql:452\n";
 
 static const char *proc85 = 
+"#line 493 \"[executable]/wsrmcli.sql\"\n"
 "create procedure WSRM_ACKNOWLEDGEMENT_PROCESS (in state wsrm_cli, in identifier varchar, in stru any)\n"
 "{\n"
 "declare my_max, idx, idx2, len2 integer;\n"
@@ -7958,9 +8077,10 @@ static const char *proc85 =
 "close cr;\n"
 "return list;\n"
 "}\n"
-"--src wsrmcli.sql:492\n";
+"--src wsrmcli.sql:491\n";
 
 static const char *proc86 = 
+"#line 559 \"[executable]/wsrmcli.sql\"\n"
 "create procedure WSRM_UPDATE_CLIENT_TABLES (in response any, in state wsrm_cli)\n"
 "{\n"
 "declare xt any;\n"
@@ -7976,9 +8096,10 @@ static const char *proc86 =
 "\n"
 "return WSRM_ACKNOWLEDGEMENT_PROCESS (state, identifier, s.s);\n"
 "}\n"
-"--src wsrmcli.sql:558\n";
+"--src wsrmcli.sql:557\n";
 
 static const char *proc87 = 
+"#line 577 \"[executable]/wsrmcli.sql\"\n"
 "create procedure WSRM_CLIENT_ACKREQUESTED (in req wsrm_cli)\n"
 "{\n"
 "declare _headers, wa, ack any;\n"
@@ -7996,9 +8117,10 @@ static const char *proc87 =
 "return SOAP_CLIENT (url=>req.url, operation=>\'WSRMAckRequested\',\n"
 "style=>(128+64+1), headers=>_headers, direction=>0);\n"
 "}\n"
-"--src wsrmcli.sql:576\n";
+"--src wsrmcli.sql:575\n";
 
 static const char *proc88 = 
+"#line 598 \"[executable]/wsrmcli.sql\"\n"
 "create procedure WSRM_CLIENT_ACKTERMINATE (in req wsrm_cli)\n"
 "{\n"
 "declare _headers any;\n"
@@ -8012,12 +8134,13 @@ static const char *proc88 =
 "\n"
 "SOAP_CLIENT (url=>req.url, operation=>\'WSRMSequenceTerminate\', headers=>_headers, direction=>1);\n"
 "}\n"
-"--src wsrmcli.sql:597\n";
+"--src wsrmcli.sql:596\n";
 
 static const char *other47 = 
 "insert soft SYS_SCHEDULED_EVENT (SE_NAME, SE_START, SE_SQL, SE_INTERVAL)\n"
 "values (\'WSRM Client Scheduled Tasks\', now(), \'DB.DBA.WSRM_CLIENT_SCHEDULED_TASKS ()\', 100)\n";
 static const char *proc89 = 
+"#line 619 \"[executable]/wsrmcli.sql\"\n"
 "create procedure WSRM_CLIENT_SCHEDULED_TASKS ()\n"
 "{\n"
 "\n"
@@ -8045,9 +8168,10 @@ static const char *proc89 =
 "WSRM_RESENDER (OML_INDENTIFIER);\n"
 "}\n"
 "}\n"
-"--src wsrmcli.sql:618\n";
+"--src wsrmcli.sql:617\n";
 
 static const char *proc90 = 
+"#line 648 \"[executable]/wsrmcli.sql\"\n"
 "create procedure WSRM_GET_IDENTIFIER (in s any)\n"
 "{\n"
 "declare ret soap_parameter;\n"
@@ -8056,9 +8180,10 @@ static const char *proc90 =
 "ret.set_struct (s);\n"
 "return ret.get_value ();\n"
 "}\n"
-"--src wsrmcli.sql:647\n";
+"--src wsrmcli.sql:646\n";
 
 static const char *proc91 = 
+"#line 659 \"[executable]/wsrmcli.sql\"\n"
 "create procedure WSA_REQ (inout state wsrm_cli)\n"
 "{\n"
 "declare req, mid, mto, mac any;\n"
@@ -8116,22 +8241,24 @@ static const char *proc91 =
 "\n"
 "return req;\n"
 "}\n"
-"--src wsrmcli.sql:658\n";
+"--src wsrmcli.sql:657\n";
 
 /* wsrmsrv.sql */
 
 static const char *proc92 = 
+"#line 23 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure WSRM_INIT ()\n"
 "{\n"
 "if (not isstring (registry_get (\'WSRMServerID\')))\n"
 "registry_set (\'WSRMServerID\', uuid ());\n"
 "}\n"
-"--src wsrmsrv.sql:22\n";
+"--src wsrmsrv.sql:21\n";
 
 
 static const char *other48 = 
 " WSRM_INIT ()\n";
 static const char *proc93 = 
+"#line 35 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure WSRMSequence\n"
 "(\n"
 "in  Sequence any __soap_header \'http://schemas.xmlsoap.org/ws/2005/02/rm:Sequence\',\n"
@@ -8326,9 +8453,10 @@ static const char *proc93 =
 "flushit:;\n"
 "}\n"
 "}\n"
-"--src wsrmsrv.sql:34\n";
+"--src wsrmsrv.sql:33\n";
 
 static const char *proc94 = 
+"#line 232 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure\n"
 "WSRMSequenceTerminate\n"
 "(\n"
@@ -8353,9 +8481,10 @@ static const char *proc94 =
 "\n"
 "return;\n"
 "}\n"
-"--src wsrmsrv.sql:231\n";
+"--src wsrmsrv.sql:230\n";
 
 static const char *proc95 = 
+"#line 258 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure\n"
 "WSRMAckRequested\n"
 "(\n"
@@ -8382,9 +8511,10 @@ static const char *proc95 =
 "}\n"
 "return;\n"
 "}\n"
-"--src wsrmsrv.sql:257\n";
+"--src wsrmsrv.sql:256\n";
 
 static const char *proc96 = 
+"#line 286 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure WSRM_ACKNOWLEDGEMENT (in identifier varchar)\n"
 "{\n"
 "declare idx, max_exist, upper, lower, flag integer;\n"
@@ -8437,9 +8567,10 @@ static const char *proc96 =
 "\n"
 "return s.s;\n"
 "}\n"
-"--src wsrmsrv.sql:285\n";
+"--src wsrmsrv.sql:284\n";
 
 static const char *proc97 = 
+"#line 340 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure WSRM_SERVER_ERROR (in _state varchar, in identifier varchar)\n"
 "{\n"
 "declare f, ack soap_parameter;\n"
@@ -8465,9 +8596,10 @@ static const char *proc97 =
 "return f.s;\n"
 "\n"
 "}\n"
-"--src wsrmsrv.sql:339\n";
+"--src wsrmsrv.sql:338\n";
 
 static const char *proc98 = 
+"#line 367 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure WSRM_CHECK_POLICY (in identifier varchar)\n"
 "{\n"
 "if (exists (select 1 from SYS_WSRM_IN_MESSAGE_LOG where IML_INDENTIFIER = identifier and\n"
@@ -8493,9 +8625,10 @@ static const char *proc98 =
 "cast (identifier as varchar), \')\'));\n"
 "}\n"
 "}\n"
-"--src wsrmsrv.sql:366\n";
+"--src wsrmsrv.sql:365\n";
 
 static const char *proc99 = 
+"#line 394 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure WSRM_MAKE_RANGES (in arr any)\n"
 "{\n"
 "declare res, elm any;\n"
@@ -8522,9 +8655,10 @@ static const char *proc99 =
 "res := vector_concat (res, vector (elm));\n"
 "return res;\n"
 "}\n"
-"--src wsrmsrv.sql:393\n";
+"--src wsrmsrv.sql:392\n";
 
 static const char *proc100 = 
+"#line 422 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure WSRM_ASYNC_ACK_SEND (in seq varchar, in address varchar, in range any)\n"
 "{\n"
 "\n"
@@ -8581,9 +8715,10 @@ static const char *proc100 =
 "SOAP_CLIENT (url=>address, operation=>\'AcknowledgementRange\', style=>(128+64+1), direction=>1,\n"
 "headers=>vector_concat (wa, ack.get_call_param(\'\')), http_header=>null);\n"
 "}\n"
-"--src wsrmsrv.sql:421\n";
+"--src wsrmsrv.sql:420\n";
 
 static const char *proc101 = 
+"#line 481 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure WSRM_ASYNC_PROCESS (in seq varchar)\n"
 "{\n"
 "declare range varchar;\n"
@@ -8608,12 +8743,13 @@ static const char *proc101 =
 "update SYS_WSRM_IN_SEQUENCES set WIS_ACK_SENT = 1 where WIS_IDENTIFIER = seq;\n"
 "return;\n"
 "}\n"
-"--src wsrmsrv.sql:480\n";
+"--src wsrmsrv.sql:479\n";
 
 static const char *other49 = 
 "insert soft SYS_SCHEDULED_EVENT (SE_NAME, SE_START, SE_SQL, SE_INTERVAL)\n"
 "values (\'WSRM Server Scheduled Tasks\', now(), \'DB.DBA.WSRM_SERVER_SCHEDULED_TASKS ()\', 100)\n";
 static const char *proc102 = 
+"#line 512 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure WSRM_SERVER_SCHEDULED_TASKS ()\n"
 "{\n"
 "\n"
@@ -8656,9 +8792,10 @@ static const char *proc102 =
 "close cr2;\n"
 "\n"
 "}\n"
-"--src wsrmsrv.sql:511\n";
+"--src wsrmsrv.sql:510\n";
 
 static const char *proc103 = 
+"#line 557 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure WSRMSequenceAcknowledgement (\n"
 "in  SequenceAcknowledgement any __soap_header \'http://schemas.xmlsoap.org/ws/2005/02/rm:SequenceAcknowledgement\',\n"
 "in  MessageID any __soap_header \'http://schemas.xmlsoap.org/ws/2004/08/addressing:MessageID\',\n"
@@ -8693,9 +8830,10 @@ static const char *proc103 =
 "http_flush ();\n"
 "http_request_status (\'reply sent\');\n"
 "}\n"
-"--src wsrmsrv.sql:556\n";
+"--src wsrmsrv.sql:555\n";
 
 static const char *proc104 = 
+"#line 594 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure WSRMCreateSequence\n"
 "(\n"
 "in  CreateSequence any __soap_type \'http://schemas.xmlsoap.org/ws/2005/02/rm:CreateSequence\',\n"
@@ -8713,9 +8851,10 @@ static const char *proc104 =
 "insert soft SYS_WSRM_IN_SEQUENCES (WIS_IDENTIFIER) values (identifier);\n"
 "return soap_box_structure (\'Identifier\', vector (composite (), \'\', identifier));\n"
 "}\n"
-"--src wsrmsrv.sql:593\n";
+"--src wsrmsrv.sql:592\n";
 
 static const char *proc105 = 
+"#line 614 \"[executable]/wsrmsrv.sql\"\n"
 "create procedure TerminateSequence\n"
 "(\n"
 "in  TerminateSequence any __soap_type \'http://schemas.xmlsoap.org/ws/2005/02/rm:TerminateSequence\',\n"
@@ -8734,7 +8873,7 @@ static const char *proc105 =
 "http_request_status (\'reply sent\');\n"
 "return;\n"
 "}\n"
-"--src wsrmsrv.sql:613\n";
+"--src wsrmsrv.sql:612\n";
 
 /* wstr_ddl.sql */
 
@@ -8766,6 +8905,7 @@ static const char *tbl6 =
 /* wstrcli.sql */
 
 static const char *proc106 = 
+"#line 23 \"[executable]/wstrcli.sql\"\n"
 "create procedure WST_CLI (in req SOAP_CLIENT_REQ, in policy POLICY_STRUCT)\n"
 "{\n"
 "declare ret any;\n"
@@ -8781,9 +8921,10 @@ static const char *proc106 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src wstrcli.sql:22\n";
+"--src wstrcli.sql:21\n";
 
 static const char *proc107 = 
+"#line 40 \"[executable]/wstrcli.sql\"\n"
 "create procedure WST_GETRST (in req SOAP_CLIENT_REQ, in policy POLICY_STRUCT)\n"
 "{\n"
 "declare ret any;\n"
@@ -8858,9 +8999,10 @@ static const char *proc107 =
 "return cast(xpath_eval (\'/RequestSecurityTokenResponse/RequestedSecurityToken/BinarySecurityToken/text()\'\n"
 ", xml_tree_doc (ret)) as varchar);\n"
 "}\n"
-"--src wstrcli.sql:39\n";
+"--src wstrcli.sql:38\n";
 
 static const char *proc108 = 
+"#line 117 \"[executable]/wstrcli.sql\"\n"
 "create procedure WS_TRUST_REQ (in rst SOAP_CLIENT_REQ, in policy POLICY_STRUCT)\n"
 "{\n"
 "declare headers, ret, cli_cert_name any;\n"
@@ -8913,11 +9055,12 @@ static const char *proc108 =
 "return SOAP_CLIENT (url=>rst.url, operation=>rst.operation, headers=>headers, style=>style, security_type=>\'sign\',\n"
 "parameters=>rst.parameters, auth_type=>\'key\', template=>\'[\' || cli_cert_name || \']\');\n"
 "}\n"
-"--src wstrcli.sql:116\n";
+"--src wstrcli.sql:115\n";
 
 /* wstrsrv.sql */
 
 static const char *proc109 = 
+"#line 24 \"[executable]/wstrsrv.sql\"\n"
 "create procedure WS.SOAP.RequestSecurityToken\n"
 "(\n"
 "in  \"RequestSecurityToken\" any := null __soap_type \'http://schemas.xmlsoap.org/ws/2002/12/secext:RequestSecurityToken\',\n"
@@ -8988,11 +9131,12 @@ static const char *proc109 =
 "\"RelatesTo\" := releates_to.s;\n"
 "\"To\" := a_to.s;\n"
 "}\n"
-"--src wstrsrv.sql:23\n";
+"--src wstrsrv.sql:22\n";
 
 static const char *other50 = 
 "SOAP_LOAD_SCH (WSRM_WSS0212_XSD (), null, 0, 0)\n";
 static const char *proc110 = 
+"#line 99 \"[executable]/wstrsrv.sql\"\n"
 "create procedure  DB.DBA.WS_TRUST_TOKEN_GEN (in \"From\" any, in \"MessageID\" any, in \"RequestSecurityToken\" any,\n"
 "in \"Timestamp\" any, in \"To\" any)\n"
 "{\n"
@@ -9014,7 +9158,7 @@ static const char *proc110 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src wstrsrv.sql:98\n";
+"--src wstrsrv.sql:97\n";
 
 /* wsrmcall.xsl */
 
@@ -9094,15 +9238,17 @@ static const char *other51 =
 static const char *other52 = 
 "DB.DBA.VHOST_DEFINE (lpath=>\'/rdf_net\', ppath=>\'/rdf_net\')\n";
 static const char *proc111 = 
+"#line 36 \"[executable]/rdf_net.sql\"\n"
 "create procedure rdf_net ()  __SOAP_HTTP \'text/html\'\n"
 "{\n"
 " ;\n"
 "}\n"
-"--src rdf_net.sql:35\n";
+"--src rdf_net.sql:34\n";
 
 static const char *other53 = 
 "grant execute on DB.DBA.rdf_net to public\n";
 static const char *proc112 = 
+"#line 45 \"[executable]/rdf_net.sql\"\n"
 "create procedure DB.DBA.HTTP_RDF_NET (in _q any)\n"
 "{\n"
 "declare res, mdta, dta any;\n"
@@ -9123,9 +9269,10 @@ static const char *proc112 =
 "\n"
 "return mdta;\n"
 "}\n"
-"--src rdf_net.sql:44\n";
+"--src rdf_net.sql:43\n";
 
 static const char *proc113 = 
+"#line 68 \"[executable]/rdf_net.sql\"\n"
 "create procedure\n"
 "rdf_net_format_mdta (inout mdta any)\n"
 "{\n"
@@ -9144,9 +9291,10 @@ static const char *proc113 =
 "\n"
 "aset (mdta, 0, temp);\n"
 "}\n"
-"--src rdf_net.sql:67\n";
+"--src rdf_net.sql:66\n";
 
 static const char *proc114 = 
+"#line 90 \"[executable]/rdf_net.sql\"\n"
 "create procedure\n"
 "rdf_net_make_xml (inout dta any, inout mdta any)\n"
 "{\n"
@@ -9181,9 +9329,10 @@ static const char *proc114 =
 "mdta := xsd;\n"
 "return;\n"
 "}\n"
-"--src rdf_net.sql:89\n";
+"--src rdf_net.sql:88\n";
 
 static const char *proc115 = 
+"#line 127 \"[executable]/rdf_net.sql\"\n"
 "create procedure\n"
 "rdf_net_make_element (in mdta any, in dta any)\n"
 "{\n"
@@ -9204,9 +9353,10 @@ static const char *proc115 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src rdf_net.sql:126\n";
+"--src rdf_net.sql:125\n";
 
 static const char *proc116 = 
+"#line 150 \"[executable]/rdf_net.sql\"\n"
 "create procedure rdf_net_make_struct (inout mdta any, inout dta any)\n"
 "{\n"
 "declare res any;\n"
@@ -9222,13 +9372,14 @@ static const char *proc116 =
 "dta := res;\n"
 "rdf_net_make_xml (dta, mdta);\n"
 "}\n"
-"--src rdf_net.sql:149\n";
+"--src rdf_net.sql:148\n";
 
 static const char *other54 = 
 "grant execute on DB.DBA.HTTP_RDF_NET to public\n";
 /* simile.sql */
 
 static const char *proc117 = 
+"#line 26 \"[executable]/simile.sql\"\n"
 "create procedure\n"
 "DB.DBA.SIMILE_INIT ()\n"
 "{\n"
@@ -9236,7 +9387,7 @@ static const char *proc117 =
 "return;\n"
 "DB.DBA.USER_CREATE (\'SIMILE\', uuid(), vector (\'DISABLED\', 1, \'LOGIN_QUALIFIER\', \'SIMILE\'));\n"
 "}\n"
-"--src simile.sql:25\n";
+"--src simile.sql:24\n";
 
 
 static const char *other55 = 
@@ -9246,13 +9397,15 @@ static const char *other56 =
 static const char *other57 = 
 "DB.DBA.VHOST_DEFINE (lpath=>\'/bank\', ppath=>\'/SOAP/Http/simile\', soap_user=>\'SIMILE\')\n";
 static const char *proc118 = 
+"#line 48 \"[executable]/simile.sql\"\n"
 "create procedure simile_iri (in s varchar)\n"
 "{\n"
 "return concat (\'http://simile.org/piggybank/\', s);\n"
 "}\n"
-"--src simile.sql:47\n";
+"--src simile.sql:46\n";
 
 static const char *proc119 = 
+"#line 55 \"[executable]/simile.sql\"\n"
 "create procedure SIMILE.SIMILE.simile ()  __SOAP_HTTP \'text/html\'\n"
 "{\n"
 "declare lines, ppath, path, pars, command, _rdf, _user, graph_iri, iri any;\n"
@@ -9290,17 +9443,19 @@ static const char *proc119 =
 "\n"
 "\n"
 "}\n"
-"--src simile.sql:54\n";
+"--src simile.sql:53\n";
 
 static const char *proc120 = 
+"#line 94 \"[executable]/simile.sql\"\n"
 "create procedure SIMILE.SIMILE.upload (in _rdf any, in _user varchar)\n"
 "{\n"
 "set_user_id (\'dba\');\n"
 "DB.DBA.RDF_LOAD_RDFXML (_rdf, simile_iri (\'simile\'), simile_iri (_user));\n"
 "}\n"
-"--src simile.sql:93\n";
+"--src simile.sql:92\n";
 
 static const char *proc121 = 
+"#line 101 \"[executable]/simile.sql\"\n"
 "create procedure SIMILE.SIMILE.\"create_u\" (in _user varchar, in lines any)\n"
 "{\n"
 "declare _pass any;\n"
@@ -9312,27 +9467,58 @@ static const char *proc121 =
 "else\n"
 "http_request_status (\'HTTP/1.1 403 Forbidden\');\n"
 "}\n"
-"--src simile.sql:100\n";
+"--src simile.sql:99\n";
 
 static const char *proc122 = 
+"#line 114 \"[executable]/simile.sql\"\n"
 "create procedure SIMILE.SIMILE.\"remove_u\" (in _item varchar)\n"
 "{\n"
 "return;\n"
 "}\n"
-"--src simile.sql:113\n";
+"--src simile.sql:112\n";
 
 static const char *proc123 = 
+"#line 120 \"[executable]/simile.sql\"\n"
 "create procedure SIMILE.SIMILE.\"persist\" (in _obj_uri varchar)\n"
 "{\n"
 "return;\n"
 "}\n"
-"--src simile.sql:119\n";
+"--src simile.sql:118\n";
 
 static const char *other58 = 
 "grant execute on simile to public\n";
+/* xrd2json.xsl */
+
+static const char *xsl26[]= {
+"<?xml version=\"1.0\" ?>\n"
+"<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n"
+"    <xsl:output method=\"text\" media-type=\"application/json\"/>\n"
+"  <xsl:variable name=\"uc\">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>\n"
+"  <xsl:variable name=\"lc\">abcdefghijklmnopqrstuvwxyz</xsl:variable>\n"
+"    <xsl:template match=\"XRD\">\n"
+"{\n"
+"  <xsl:apply-templates select=\"Subject|Host|Alias\"/>\n"
+"  \"link\": \n"
+"    [\n"
+"      <xsl:for-each select=\"Link\">\n"
+"      {\n"
+"        <xsl:for-each select=\"@*\">\"<xsl:value-of select=\"local-name(.)\"/>\": \"<xsl:value-of select=\".\"/>\"<xsl:if test=\"position () != last ()\">,\n"
+"        </xsl:if></xsl:for-each>\n"
+"      }<xsl:if test=\"position () != last ()\">,</xsl:if>\n"
+"      </xsl:for-each>\n"
+"    ]\n"
+"}\n"
+"    </xsl:template>\n"
+"    <xsl:template match=\"Subject|Host|Alias\">\"<xsl:value-of select=\"translate (local-name(.), $uc, $lc)\"/>\": \"<xsl:value-of select=\".\"/>\",</xsl:template>\n"
+"</xsl:stylesheet>\n"
+"\n"
+,
+ NULL };
+
 /* http_auth.sql */
 
 static const char *proc124 = 
+"#line 26 \"[executable]/http_auth.sql\"\n"
 "create procedure\n"
 "DB.DBA.HP_AUTH_SQL_USER (in realm varchar)\n"
 "{\n"
@@ -9404,9 +9590,10 @@ static const char *proc124 =
 "\'false\', lines, allow_basic);\n"
 "return 0;\n"
 "}\n"
-"--src http_auth.sql:25\n";
+"--src http_auth.sql:24\n";
 
 static const char *proc125 = 
+"#line 101 \"[executable]/http_auth.sql\"\n"
 "create procedure\n"
 "DB.DBA.HP_AUTH_DAV_ADMIN (in realm varchar)\n"
 "{\n"
@@ -9479,9 +9666,10 @@ static const char *proc125 =
 "\'false\', lines, allow_basic);\n"
 "return 0;\n"
 "}\n"
-"--src http_auth.sql:100\n";
+"--src http_auth.sql:99\n";
 
 static const char *proc126 = 
+"#line 176 \"[executable]/http_auth.sql\"\n"
 "create procedure\n"
 "DB.DBA.HP_AUTH_DAV_PROTOCOL (in realm varchar)\n"
 "{\n"
@@ -9641,9 +9829,10 @@ static const char *proc126 =
 "\'false\', lines, allow_basic);\n"
 "return 0;\n"
 "}\n"
-"--src http_auth.sql:175\n";
+"--src http_auth.sql:174\n";
 
 static const char *proc127 = 
+"#line 338 \"[executable]/http_auth.sql\"\n"
 "create procedure\n"
 "DB.DBA.HP_SES_VARS_STORE ()\n"
 "{\n"
@@ -9658,11 +9847,12 @@ static const char *proc127 =
 "update DB.DBA.ADMIN_SESSION set ASES_VARS = serialize (vars) where ASES_ID = sid;\n"
 "}\n"
 "}\n"
-"--src http_auth.sql:337\n";
+"--src http_auth.sql:336\n";
 
 static const char *other59 = 
 "grant execute on DB.DBA.HP_SES_VARS_STORE to public\n";
 static const char *proc128 = 
+"#line 358 \"[executable]/http_auth.sql\"\n"
 "create procedure WS.WS.VSP_DEFINE (in path varchar, in _uid varchar)\n"
 "{\n"
 "declare x, y, stat, msg, st varchar;\n"
@@ -9688,7 +9878,7 @@ static const char *proc128 =
 "__pop_user_id ();\n"
 "return 1;\n"
 "}\n"
-"--src http_auth.sql:357\n";
+"--src http_auth.sql:356\n";
 
 static const char *tbl7 = 
 "CREATE TABLE WS.WS.SESSION (\n"
@@ -9709,6 +9899,7 @@ static const char *tbl7 =
 ")\n";
 
 static const char *proc129 = 
+"#line 411 \"[executable]/http_auth.sql\"\n"
 " CREATE PROCEDURE WS.WS.SESSION_SAVE ()\n"
 "{\n"
 "declare sid varchar;\n"
@@ -9728,9 +9919,10 @@ static const char *proc129 =
 "\n"
 "connection_vars_set (NULL);\n"
 "}\n"
-"--src http_auth.sql:410\n";
+"--src http_auth.sql:409\n";
 
 static const char *proc130 = 
+"#line 434 \"[executable]/http_auth.sql\"\n"
 " CREATE PROCEDURE WS.WS.SESSION_TERMINATE (in url varchar)\n"
 "{\n"
 "\n"
@@ -9739,9 +9931,10 @@ static const char *proc130 =
 "http_request_status (\'HTTP/1.1 302 Found\');\n"
 "http_header (sprintf (\'Location: %s\\r\\n\', url));\n"
 "}\n"
-"--src http_auth.sql:433\n";
+"--src http_auth.sql:432\n";
 
 static const char *proc131 = 
+"#line 448 \"[executable]/http_auth.sql\"\n"
 " CREATE PROCEDURE WS.WS.DIGEST_AUTH (in realm varchar)\n"
 "{\n"
 "declare auth_vec, lines, vars, server_nc any;\n"
@@ -9830,9 +10023,10 @@ static const char *proc131 =
 "http (\'<HTML><BODY><p>Authorization failed (401)</p></BODY></HTML>\');\n"
 "return 0;\n"
 "}\n"
-"--src http_auth.sql:447\n";
+"--src http_auth.sql:446\n";
 
 static const char *proc132 = 
+"#line 538 \"[executable]/http_auth.sql\"\n"
 "create procedure\n"
 "DB.DBA.HP_AUTH_SPARQL_USER (in realm varchar)\n"
 "{\n"
@@ -9890,7 +10084,7 @@ static const char *proc132 =
 "\'false\', lines, allow_basic);\n"
 "return 0;\n"
 "}\n"
-"--src http_auth.sql:537\n";
+"--src http_auth.sql:536\n";
 
 /* xmla.sql */
 
@@ -9974,6 +10168,7 @@ static const char *other63 =
 "}\n";
 
 static const char *proc133 = 
+"#line 114 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_get_property (inout properties any, in pname varchar, in deflt any)\n"
 "{\n"
@@ -10006,9 +10201,10 @@ static const char *proc133 =
 "}\n"
 "return deflt;\n"
 "}\n"
-"--src xmla.sql:113\n";
+"--src xmla.sql:112\n";
 
 static const char *proc134 = 
+"#line 149 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_result_xsd (in name varchar, in typ varchar, in typ_name varchar)\n"
 "{\n"
@@ -10018,9 +10214,10 @@ static const char *proc134 =
 "\' xmlns:tns=\"urn:schemas-microsoft-com:xml-analysis:rowset\" targetNamespace=\"urn:schemas-microsoft-com:xml-analysis\">\' ||\n"
 "\'<all><element name=\"\' || typ_name || \'\" type=\"tns:\' || typ || \'\" /></all></complexType>\'));\n"
 "}\n"
-"--src xmla.sql:148\n";
+"--src xmla.sql:147\n";
 
 static const char *proc135 = 
+"#line 160 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_session (in begin_session any, in end_session any, inout _session any, in properties any)\n"
 "{\n"
@@ -10060,9 +10257,10 @@ static const char *proc135 =
 "commit work;\n"
 "}\n"
 "}\n"
-"--src xmla.sql:159\n";
+"--src xmla.sql:158\n";
 
 static const char *proc136 = 
+"#line 201 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_make_codes (in code varchar) returns varchar\n"
 "{\n"
@@ -10080,9 +10278,10 @@ static const char *proc136 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src xmla.sql:200\n";
+"--src xmla.sql:199\n";
 
 static const char *proc137 = 
+"#line 220 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "\"Discover\" (in  \"RequestType\" varchar,\n"
 "in  \"Restrictions\" any := NULL\n"
@@ -10126,9 +10325,10 @@ static const char *proc137 =
 "\"ws_xmla_xsd\" := vector_concat (vector (xmla_result_xsd (\'return\', \'root\', \'root\')) , DB.DBA.SOAP_LOAD_SCH (mdta, NULL, 1));\n"
 "return soap_box_structure (\'root\', vector_concat (vector (discover.metadata), res));\n"
 "}\n"
-"--src xmla.sql:219\n";
+"--src xmla.sql:218\n";
 
 static const char *proc138 = 
+"#line 265 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "\"Execute\"  (in  \"Command\" varchar\n"
 "\n"
@@ -10148,8 +10348,9 @@ static const char *proc138 =
 ")\n"
 "{\n"
 "declare res, mdta, dta any;\n"
-"declare cat, fmt, axis_fmt, what, dsn, state, msg, stmt, tree, blob_limit any;\n"
+"declare cat, fmt, axis_fmt, what, dsn, state, msg, stmt, tree, blob_limit, stmt_is_ddl any;\n"
 "declare uname, passwd varchar;\n"
+"\n"
 "declare exit handler for sqlstate \'*\'\n"
 "{\n"
 "declare xcode int;\n"
@@ -10197,9 +10398,10 @@ static const char *proc138 =
 "set_user_id (uname, 1, passwd);\n"
 "set_qualifier (cat);\n"
 "\n"
+"dta := vector ();\n"
+"stmt_is_ddl := 0;\n"
 "if (not xmla_not_local_dsn (dsn))\n"
 "{\n"
-"dta := NULL;\n"
 "\n"
 "tree := sql_parse (stmt);\n"
 "if (tree [0] = 609)\n"
@@ -10208,27 +10410,29 @@ static const char *proc138 =
 "tree := sql_parse (stmt);\n"
 "}\n"
 "if (tree [0] <> 100)\n"
+"{\n"
+"if (registry_get (\'XMLA-DML\') = \'1\')\n"
+"{\n"
+"exec_metadata (\'select 1 as res\', null, null, mdta);\n"
+"stmt_is_ddl := 1;\n"
+"}\n"
+"else\n"
 "signal (\'00004\', \'Only select statements are supported via XML for Analysis provider\');\n"
-"\n"
-"if (dta is NULL)\n"
+"}\n"
 "res := exec (stmt, state, msg, vector (), 0, mdta, dta);\n"
-"\n"
-"\n"
+"if (isinteger (dta))\n"
+"dta := vector (vector (dta));\n"
 "\n"
 "\n"
 "blob_limit := atoi (xmla_get_property (\"Properties\", \'BLOBLimit\', \'0\'));\n"
-"\n"
 "if (blob_limit > 0)\n"
 "connection_set (\'SOAPBlobLimit\', blob_limit);\n"
 "}\n"
 "else\n"
 "{\n"
-"dta := NULL;\n"
 "\n"
 "dsn := xmla_get_dsn_name (dsn);\n"
-"\n"
-"if (dta is NULL)\n"
-"rexecute (dsn, stmt, state, msg, vector (), 0, mdta, dta);;\n"
+"rexecute (dsn, stmt, state, msg, vector (), 0, mdta, dta);\n"
 "}\n"
 "\n"
 "if (state <> \'00000\')\n"
@@ -10236,6 +10440,7 @@ static const char *proc138 =
 "\n"
 "\n"
 "xmla_format_mdta (mdta);\n"
+"if (not stmt_is_ddl)\n"
 "xmla_make_cursors_state (\"Properties\", dta, stmt);\n"
 "xmla_sparql_result (mdta, dta, stmt);\n"
 "xmla_make_struct (mdta, dta);\n"
@@ -10244,9 +10449,10 @@ static const char *proc138 =
 "when \'Schema\' then vector (mdta)\n"
 "else vector_concat (vector(mdta), dta) end);\n"
 "}\n"
-"--src xmla.sql:264\n";
+"--src xmla.sql:263\n";
 
 static const char *proc139 = 
+"#line 388 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_not_local_dsn (in dsn varchar)\n"
 "{\n"
@@ -10258,9 +10464,10 @@ static const char *proc139 =
 "return 0;\n"
 "return 1;\n"
 "}\n"
-"--src xmla.sql:382\n";
+"--src xmla.sql:386\n";
 
 static const char *proc140 = 
+"#line 401 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_make_meta (in dta any)\n"
 "{\n"
@@ -10286,7 +10493,7 @@ static const char *proc140 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src xmla.sql:395\n";
+"--src xmla.sql:399\n";
 
 static const char *other64 = 
 "create method\n"
@@ -10562,6 +10769,7 @@ static const char *other70 =
 "}\n";
 
 static const char *proc141 = 
+"#line 706 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_make_xsd (inout mdta any)\n"
 "{\n"
@@ -10616,9 +10824,10 @@ static const char *proc141 =
 "mdta := xml_tree_doc (xsd);\n"
 "return;\n"
 "}\n"
-"--src xmla.sql:700\n";
+"--src xmla.sql:704\n";
 
 static const char *proc142 = 
+"#line 762 \"[executable]/xmla.sql\"\n"
 "create procedure xmla_make_struct (inout mdta any, inout dta any)\n"
 "{\n"
 "declare res any;\n"
@@ -10634,9 +10843,10 @@ static const char *proc142 =
 "dta := res;\n"
 "xmla_make_xsd (mdta);\n"
 "}\n"
-"--src xmla.sql:756\n";
+"--src xmla.sql:760\n";
 
 static const char *proc143 = 
+"#line 779 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_make_element (in mdta any, in dta any)\n"
 "{\n"
@@ -10659,7 +10869,7 @@ static const char *proc143 =
 "}\n"
 "return res;\n"
 "}\n"
-"--src xmla.sql:773\n";
+"--src xmla.sql:777\n";
 
 static const char *other71 = 
 "create method xmla_dbschema_columns () for xmla_discover\n"
@@ -10974,6 +11184,7 @@ static const char *other76 =
 "}\n";
 
 static const char *proc144 = 
+"#line 1120 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_get_schs ()\n"
 "{\n"
@@ -11019,9 +11230,10 @@ static const char *proc144 =
 ",\'\')\n"
 ");\n"
 "}\n"
-"--src xmla.sql:1114\n";
+"--src xmla.sql:1118\n";
 
 static const char *proc145 = 
+"#line 1168 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_get_props (in _dsn varchar := NULL)\n"
 "{\n"
@@ -11062,18 +11274,20 @@ static const char *proc145 =
 "vector (\'UserName\'	, \'\', \'string\', \'R/W\', 0, \'\')\n"
 ");\n"
 "}\n"
-"--src xmla.sql:1162\n";
+"--src xmla.sql:1166\n";
 
 static const char *proc146 = 
+"#line 1210 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_get_dsn_name (in _dsn varchar)\n"
 "{\n"
 "return replace (_dsn, \'DSN=\', \'\');\n"
 "return _dsn;\n"
 "}\n"
-"--src xmla.sql:1204\n";
+"--src xmla.sql:1208\n";
 
 static const char *proc147 = 
+"#line 1218 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_is_local_service (in _dsn varchar)\n"
 "{\n"
@@ -11081,9 +11295,10 @@ static const char *proc147 =
 "return 0;\n"
 "return 1;\n"
 "}\n"
-"--src xmla.sql:1212\n";
+"--src xmla.sql:1216\n";
 
 static const char *proc148 = 
+"#line 1227 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_set_props (in properties any)\n"
 "{\n"
@@ -11105,9 +11320,10 @@ static const char *proc148 =
 "}\n"
 "return def_prop;\n"
 "}\n"
-"--src xmla.sql:1221\n";
+"--src xmla.sql:1225\n";
 
 static const char *proc149 = 
+"#line 1250 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_get_enums ()\n"
 "{\n"
@@ -11139,9 +11355,10 @@ static const char *proc149 =
 "vector(\'MDXSupportLevel\',\'\',\'string\',\'None\',\'\',25)\n"
 ");\n"
 "}\n"
-"--src xmla.sql:1244\n";
+"--src xmla.sql:1248\n";
 
 static const char *proc150 = 
+"#line 1283 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_get_literals ()\n"
 "{\n"
@@ -11165,17 +11382,19 @@ static const char *proc150 =
 "vector (\'DBLITERAL_QUOTE_SUFFIX\', \'\"\', \'\', \'\', 0)\n"
 ");\n"
 "}\n"
-"--src xmla.sql:1277\n";
+"--src xmla.sql:1281\n";
 
 static const char *proc151 = 
+"#line 1309 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_service_name ()\n"
 "{\n"
 "return \'Local_Instance\';\n"
 "}\n"
-"--src xmla.sql:1303\n";
+"--src xmla.sql:1307\n";
 
 static const char *proc152 = 
+"#line 1317 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_get_kwds ()\n"
 "{\n"
@@ -11212,9 +11431,10 @@ static const char *proc152 =
 "\'VARBINARY\', \'VARCHAR\', \'VARIABLE\', \'VIEW\', \'WHEN\', \'WHENEVER\', \'WHERE\', \'WHILE\', \'WITH\', \'WORK\', \'XML\', \'XPATH\'\n"
 ");\n"
 "}\n"
-"--src xmla.sql:1311\n";
+"--src xmla.sql:1315\n";
 
 static const char *proc153 = 
+"#line 1356 \"[executable]/xmla.sql\"\n"
 "create procedure DB.DBA.xmla_vdd_dbschema_tables_rpoc (in tb varchar, in cat varchar, in dsn varchar)\n"
 "{\n"
 "declare _all, temp any;\n"
@@ -11240,9 +11460,10 @@ static const char *proc153 =
 "}\n"
 "\n"
 "}\n"
-"--src xmla.sql:1350\n";
+"--src xmla.sql:1354\n";
 
 static const char *proc154 = 
+"#line 1383 \"[executable]/xmla.sql\"\n"
 "create procedure DB.DBA.xmla_vdd_dbschema_columns_rpoc (in tb varchar, in cat varchar, in col varchar, in dsn varchar)\n"
 "{\n"
 "declare _all any;\n"
@@ -11277,7 +11498,7 @@ static const char *proc154 =
 "cast (_line[11] as nvarchar));\n"
 "}\n"
 "}\n"
-"--src xmla.sql:1377\n";
+"--src xmla.sql:1381\n";
 
 static const char *view0 = 
 "create procedure view XMLA_VDD_DBSCHEMA_COLUMNS as DB.DBA.xmla_vdd_dbschema_columns_rpoc (cat, tb, col, dsn)\n"
@@ -11302,6 +11523,7 @@ static const char *view2 =
 "GUID varchar, TYPELIB varchar, VERSION varchar, IS_LONG int, BEST_MATCH int, IS_FIXEDLENGTH int)\n";
 
 static const char *proc155 = 
+"#line 1447 \"[executable]/xmla.sql\"\n"
 "create procedure xmla_vdd_dbschema_provider_types_rpoc (in tb int, in cat int, in dsn varchar)\n"
 "{\n"
 "declare _all any;\n"
@@ -11330,9 +11552,10 @@ static const char *proc155 =
 "NULL, NULL, NULL, NULL, NULL);\n"
 "}\n"
 "}\n"
-"--src xmla.sql:1441\n";
+"--src xmla.sql:1445\n";
 
 static const char *proc156 = 
+"#line 1478 \"[executable]/xmla.sql\"\n"
 "create procedure mxla_fk_pk_check (in dsn varchar, inout stmt varchar, inout mdta any, inout dta any)\n"
 "{\n"
 "declare state, msg any;\n"
@@ -11353,9 +11576,10 @@ static const char *proc156 =
 "\n"
 "exec (stmt, state, msg, vector (), 0, mdta, dta);\n"
 "}\n"
-"--src xmla.sql:1472\n";
+"--src xmla.sql:1476\n";
 
 static const char *proc157 = 
+"#line 1501 \"[executable]/xmla.sql\"\n"
 "create procedure mxla_fk_pk_check_local (inout stmt varchar, inout mdta any, inout dta any)\n"
 "{\n"
 "declare _new, l_name, _schema, _catalog, _name, idx, _line any;\n"
@@ -11412,7 +11636,7 @@ static const char *proc157 =
 "\n"
 "}\n"
 "}\n"
-"--src xmla.sql:1495\n";
+"--src xmla.sql:1499\n";
 
 static const char *view3 = 
 "create procedure view DB.DBA.SYS_FOREIGN_KEYS_VIEW as DB.DBA.\"XMLA_GET_FK\" (PK_TABLE, FK_TABLE, DSN)\n"
@@ -11432,6 +11656,7 @@ static const char *view4 =
 "(COLUMN_NAME VARCHAR)\n";
 
 static const char *proc158 = 
+"#line 1582 \"[executable]/xmla.sql\"\n"
 "create procedure DB.DBA.\"XMLA_GET_PK\" (in _pk_table varchar, in dsn varchar)\n"
 "{\n"
 "declare COLUMN_NAME VARCHAR;\n"
@@ -11455,9 +11680,10 @@ static const char *proc158 =
 "result (_pk_tables[3]);\n"
 "}\n"
 "}\n"
-"--src xmla.sql:1576\n";
+"--src xmla.sql:1580\n";
 
 static const char *proc159 = 
+"#line 1607 \"[executable]/xmla.sql\"\n"
 "create procedure DB.DBA.\"XMLA_GET_FK\" (in _pk_table varchar, in _fk_table varchar, in dsn varchar)\n"
 "{\n"
 "declare PK_TABLE_SCHEMA VARCHAR;\n"
@@ -11521,16 +11747,17 @@ static const char *proc159 =
 "_fk_tables[8], _fk_tables[9], _fk_tables[10], _fk_tables[11]);\n"
 "}\n"
 "}\n"
-"--src xmla.sql:1601\n";
+"--src xmla.sql:1605\n";
 
 static const char *proc160 = 
+"#line 1672 \"[executable]/xmla.sql\"\n"
 "create procedure XMLA_USER_INIT ()\n"
 "{\n"
 "if (exists (select 1 from \"DB\".\"DBA\".\"SYS_USERS\" where U_NAME = \'XMLA\'))\n"
 "return;\n"
 "DB.DBA.USER_CREATE (\'XMLA\', uuid(), vector (\'DISABLED\', 1, \'LOGIN_QUALIFIER\', \'XMLA\'));\n"
 "}\n"
-"--src xmla.sql:1666\n";
+"--src xmla.sql:1670\n";
 
 static const char *other77 = 
 "XMLA_USER_INIT ()\n";
@@ -11568,6 +11795,7 @@ static const char *other92 =
 static const char *other93 = 
 "grant all privileges on DB.DBA.\"SYS_PRIMARY_KEYS_VIEW\" to \"XMLA\"\n";
 static const char *proc161 = 
+"#line 1733 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_cursor_stmt_change (in _props any, inout _stmt varchar)\n"
 "{\n"
@@ -11618,9 +11846,10 @@ static const char *proc161 =
 "_stmt := replace (_stmt, _left_str, new_stmpt, 1);\n"
 "\n"
 "}\n"
-"--src xmla.sql:1727\n";
+"--src xmla.sql:1731\n";
 
 static const char *proc162 = 
+"#line 1785 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_make_cursors_state (in _props any, inout _dta any, in stmt any)\n"
 "{\n"
@@ -11703,9 +11932,10 @@ static const char *proc162 =
 "_dta := _new_dta;\n"
 "}\n"
 "}\n"
-"--src xmla.sql:1779\n";
+"--src xmla.sql:1783\n";
 
 static const char *proc163 = 
+"#line 1870 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_make_skip (in _skip any, in _add int, in _dir int)\n"
 "{\n"
@@ -11732,17 +11962,19 @@ static const char *proc163 =
 "\n"
 "return ret;\n"
 "}\n"
-"--src xmla.sql:1864\n";
+"--src xmla.sql:1868\n";
 
 static const char *proc164 = 
+"#line 1898 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_get_version ()\n"
 "{\n"
 "return \'1.01\';\n"
 "}\n"
-"--src xmla.sql:1892\n";
+"--src xmla.sql:1896\n";
 
 static const char *proc165 = 
+"#line 1906 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_format_mdta (inout mdta any)\n"
 "{\n"
@@ -11761,9 +11993,10 @@ static const char *proc165 =
 "\n"
 "aset (mdta, 0, temp);\n"
 "}\n"
-"--src xmla.sql:1900\n";
+"--src xmla.sql:1904\n";
 
 static const char *proc166 = 
+"#line 1927 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_get_rows_from_stmt (in stmt any)\n"
 "{\n"
@@ -11788,9 +12021,10 @@ static const char *proc166 =
 "\n"
 "return dta[0][0];\n"
 "}\n"
-"--src xmla.sql:1921\n";
+"--src xmla.sql:1925\n";
 
 static const char *proc167 = 
+"#line 1954 \"[executable]/xmla.sql\"\n"
 "create procedure\n"
 "xmla_sparql_result (inout mdta any, inout dta any, in stmt any)\n"
 "{\n"
@@ -11820,11 +12054,12 @@ static const char *proc167 =
 "}\n"
 "}\n"
 "}\n"
-"--src xmla.sql:1948\n";
+"--src xmla.sql:1952\n";
 
 /* openxml.sql */
 
 static const char *proc168 = 
+"#line 33 \"[executable]/openxml.sql\"\n"
 "create procedure\n"
 "DB.DBA.OPENXML_DEFINE (in vname varchar, in tb varchar, in data varchar, in xp varchar, in meta any)\n"
 "{\n"
@@ -11941,7 +12176,7 @@ static const char *proc168 =
 "if (stat <> \'00000\')\n"
 "signal (stat, msg);\n"
 "}\n"
-"--src openxml.sql:32\n";
+"--src openxml.sql:31\n";
 
 /* vspx.sql */
 
@@ -11962,6 +12197,7 @@ static const char *tbl9 =
 ")\n";
 
 static const char *trig6 = 
+"#line 55 \"[executable]/vspx.sql\"\n"
 "create trigger VSPX_SESSION_INSERT_AFTER after insert on DB.DBA.VSPX_SESSION {\n"
 "declare v_sql any;\n"
 "declare result, name, content, reg any;\n"
@@ -12004,7 +12240,7 @@ static const char *trig6 =
 "result := cast(DB.DBA.DAV_RES_UPLOAD(name, v_sql,\'text/html\',\'110110110R\',\'dav\',\'dav\',\'dav\', pwd) as INTEGER);\n"
 "}\n"
 "}\n"
-"--src vspx.sql:54\n";
+"--src vspx.sql:53\n";
 
 static const char *udt6 = 
 "create type vspx_event\n"
@@ -13712,14 +13948,16 @@ static const char *other145 =
 "}\n";
 
 static const char *proc169 = 
+"#line 1853 \"[executable]/vspx.sql\"\n"
 " create procedure vspx_state_serialize (inout state any)\n"
 "{\n"
 "return encode_base64 (serialize (state));\n"
 "\n"
 "}\n"
-"--src vspx.sql:1852\n";
+"--src vspx.sql:1851\n";
 
 static const char *proc170 = 
+"#line 1861 \"[executable]/vspx.sql\"\n"
 " create procedure vspx_state_deserialize (inout state any)\n"
 "{\n"
 "return deserialize (decode_base64 (state));\n"
@@ -13728,7 +13966,7 @@ static const char *proc170 =
 "\n"
 "\n"
 "}\n"
-"--src vspx.sql:1860\n";
+"--src vspx.sql:1859\n";
 
 static const char *other146 = 
 "create constructor method vspx_vscx (in name varchar, in parent vspx_control, in uri varchar)\n"
@@ -14030,6 +14268,7 @@ static const char *other155 =
 "}\n";
 
 static const char *proc171 = 
+"#line 2175 \"[executable]/vspx.sql\"\n"
 "create procedure\n"
 "vspx_unqualify (in name varchar)\n"
 "{\n"
@@ -14045,9 +14284,10 @@ static const char *proc171 =
 "}\n"
 "return (subseq (name_str, coalesce (strrchr (name_str, \'.\') + 1, 0)));\n"
 "}\n"
-"--src vspx.sql:2174\n";
+"--src vspx.sql:2173\n";
 
 static const char *proc172 = 
+"#line 2192 \"[executable]/vspx.sql\"\n"
 "create procedure\n"
 "vspx_result_tbl_hdrs (in m_dta any)\n"
 "{\n"
@@ -14077,9 +14317,10 @@ static const char *proc172 =
 "inx := inx + 1;\n"
 "}\n"
 "}\n"
-"--src vspx.sql:2191\n";
+"--src vspx.sql:2190\n";
 
 static const char *proc173 = 
+"#line 2224 \"[executable]/vspx.sql\"\n"
 "create procedure\n"
 "vspx_result_row_render (in result any, in m_dta any, in inx int := 0, in cset varchar := \'UTF-8\')\n"
 "{\n"
@@ -14112,6 +14353,7 @@ static const char *proc173 =
 "http (\'<td class=\"resdata\">  \');\n"
 "res_col := aref (res_row, jnx);\n"
 "col_type := aref (aref (dt_nfo, jnx), 1);\n"
+"again:\n"
 "if (__tag (res_col) = 193)\n"
 "http_value (concat (\'(\', vector_print (res_col), \')\'));\n"
 "else if (__tag (res_col) = 230 and res_col is not null)\n"
@@ -14121,6 +14363,13 @@ static const char *proc173 =
 "http_value (res_col, NULL, ses);\n"
 "http_value (string_output_string (ses));\n"
 "}\n"
+"else if (__tag (res_col) = 246 and res_col is not null)\n"
+"{\n"
+"declare dat any;\n"
+"dat := __rdf_sqlval_of_obj (res_col, 1);\n"
+"res_col := dat;\n"
+"goto again;\n"
+"}\n"
 "else\n"
 "{\n"
 "if (__tag (res_col) = 182 and cset is not null)\n"
@@ -14133,7 +14382,7 @@ static const char *proc173 =
 "}\n"
 "http (\'</tr>\\n\');\n"
 "}\n"
-"--src vspx.sql:2223\n";
+"--src vspx.sql:2222\n";
 
 static const char *other156 = 
 "create constructor method vspx_field_value (in name varchar, inout parent vspx_control) for vspx_field_value\n"
@@ -14697,6 +14946,7 @@ static const char *other187 =
 "}\n";
 
 static const char *proc174 = 
+"#line 2858 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_xtext_node (in val any)\n"
 "{\n"
 "if (val is null)\n"
@@ -14706,7 +14956,7 @@ static const char *proc174 =
 "else\n"
 "return cast (val as varchar);\n"
 "}\n"
-"--src vspx.sql:2849\n";
+"--src vspx.sql:2856\n";
 
 static const char *other188 = 
 "create method epilogue_render () for vspx_form\n"
@@ -14927,6 +15177,7 @@ static const char *other197 =
 "}\n";
 
 static const char *proc175 = 
+"#line 3095 \"[executable]/vspx.sql\"\n"
 " create procedure\n"
 "vspx_print_html_attrs (inout control vspx_control)\n"
 "{\n"
@@ -14944,7 +15195,7 @@ static const char *proc175 =
 "i := i + 1;\n"
 "}\n"
 "}\n"
-"--src vspx.sql:3086\n";
+"--src vspx.sql:3093\n";
 
 static const char *other198 = 
 "create method vc_render () for vspx_url\n"
@@ -15152,6 +15403,7 @@ static const char *other212 =
 "}\n";
 
 static const char *proc176 = 
+"#line 3321 \"[executable]/vspx.sql\"\n"
 "create function XMLS_VALUE_OF_SUBTREE (in _ent any, in _path varchar, in _params any, in _place varchar) returns any\n"
 "{\n"
 "\n"
@@ -15183,7 +15435,7 @@ static const char *proc176 =
 "}\n"
 "return cast (_ent as varchar);\n"
 "}\n"
-"--src vspx.sql:3312\n";
+"--src vspx.sql:3319\n";
 
 static const char *other213 = 
 "create method vc_get_from_element () for vspx_field_value\n"
@@ -16856,6 +17108,7 @@ static const char *udt51 =
 "as ( vc_stub any ) temporary self as ref\n";
 
 static const char *proc177 = 
+"#line 5035 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_get_compiler_signature () returns varchar\n"
 "{\n"
 "declare res varchar;\n"
@@ -16869,9 +17122,10 @@ static const char *proc177 =
 ");\n"
 "return res;\n"
 "}\n"
-"--src vspx.sql:5026\n";
+"--src vspx.sql:5033\n";
 
 static const char *proc178 = 
+"#line 5050 \"[executable]/vspx.sql\"\n"
 "create procedure\n"
 "vspx_make_temp_names (in resource_name varchar, inout vspxm_name varchar, inout sql_name varchar)\n"
 "returns int\n"
@@ -16903,9 +17157,10 @@ static const char *proc178 =
 "\n"
 "return is_temp;\n"
 "}\n"
-"--src vspx.sql:5041\n";
+"--src vspx.sql:5048\n";
 
 static const char *proc179 = 
+"#line 5084 \"[executable]/vspx.sql\"\n"
 "create function vspx_make_vspxm (\n"
 "in resource_name varchar,\n"
 "in resource_text varchar,\n"
@@ -17143,9 +17398,10 @@ static const char *proc179 =
 "xslt_stale (xslt_macro_sheet_name);\n"
 "return xe;\n"
 "}\n"
-"--src vspx.sql:5075\n";
+"--src vspx.sql:5082\n";
 
 static const char *proc180 = 
+"#line 5324 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_make_sql (\n"
 "in vspx_dbname varchar,\n"
 "in vspx_user varchar,\n"
@@ -17209,9 +17465,10 @@ static const char *proc180 =
 "vspx_src_store (sql_name, string_output_string (messages));\n"
 "return code_files;\n"
 "}\n"
-"--src vspx.sql:5315\n";
+"--src vspx.sql:5322\n";
 
 static const char *proc181 = 
+"#line 5390 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_load_sql (\n"
 "in vspx_dbname varchar,\n"
 "in vspx_user varchar,\n"
@@ -17291,9 +17548,10 @@ static const char *proc181 =
 "curline := curline + 1;\n"
 "}\n"
 "}\n"
-"--src vspx.sql:5381\n";
+"--src vspx.sql:5388\n";
 
 static const char *proc182 = 
+"#line 5471 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_src_get (in resource_name varchar, inout ses any, in try_temp int)\n"
 "{\n"
 "declare is_dav int;\n"
@@ -17325,9 +17583,10 @@ static const char *proc182 =
 "}\n"
 "return ret;\n"
 "}\n"
-"--src vspx.sql:5462\n";
+"--src vspx.sql:5469\n";
 
 static const char *proc183 = 
+"#line 5504 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_src_store (in resource_name varchar, inout ses any)\n"
 "{\n"
 "declare is_dav int;\n"
@@ -17355,9 +17614,10 @@ static const char *proc183 =
 "}\n"
 "return;\n"
 "}\n"
-"--src vspx.sql:5495\n";
+"--src vspx.sql:5502\n";
 
 static const char *proc184 = 
+"#line 5533 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_base_url (in f varchar)\n"
 "{\n"
 "if (http_map_get (\'is_dav\'))\n"
@@ -17365,9 +17625,10 @@ static const char *proc184 =
 "else\n"
 "return concat (\'file://\', f);\n"
 "}\n"
-"--src vspx.sql:5524\n";
+"--src vspx.sql:5531\n";
 
 static const char *proc185 = 
+"#line 5542 \"[executable]/vspx.sql\"\n"
 "create procedure vsxp_src_stat (in f varchar)\n"
 "{\n"
 "if (http_map_get (\'is_dav\'))\n"
@@ -17379,9 +17640,10 @@ static const char *proc185 =
 "else\n"
 "return file_stat (concat (http_root (), f));\n"
 "}\n"
-"--src vspx.sql:5533\n";
+"--src vspx.sql:5540\n";
 
 static const char *proc186 = 
+"#line 5555 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_url_stat (in base_uri varchar)\n"
 "{\n"
 "declare s_url any;\n"
@@ -17403,9 +17665,10 @@ static const char *proc186 =
 "else\n"
 "return 0;\n"
 "}\n"
-"--src vspx.sql:5546\n";
+"--src vspx.sql:5553\n";
 
 static const char *proc187 = 
+"#line 5578 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_make_stat_vector (in dep_files any)\n"
 "{\n"
 "declare inx integer;\n"
@@ -17426,9 +17689,10 @@ static const char *proc187 =
 "\n"
 "return dep_string;\n"
 "}\n"
-"--src vspx.sql:5569\n";
+"--src vspx.sql:5576\n";
 
 static const char *proc188 = 
+"#line 5600 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_check_file_deps (in resource_name varchar)\n"
 "{\n"
 "if (registry_get (\'vspx_production_mode\') <> \'1\')\n"
@@ -17463,9 +17727,10 @@ static const char *proc188 =
 "}\n"
 "return 1;\n"
 "}\n"
-"--src vspx.sql:5591\n";
+"--src vspx.sql:5598\n";
 
 static const char *proc189 = 
+"#line 5636 \"[executable]/vspx.sql\"\n"
 "create function\n"
 "vspx_get_subclass_name (in resource_name varchar, in class_name varchar) returns varchar\n"
 "{\n"
@@ -17479,9 +17744,10 @@ static const char *proc189 =
 "}\n"
 "return class_name;\n"
 "}\n"
-"--src vspx.sql:5627\n";
+"--src vspx.sql:5634\n";
 
 static const char *proc190 = 
+"#line 5651 \"[executable]/vspx.sql\"\n"
 "create function\n"
 "vspx_get_class_name (\n"
 "in resource_name varchar ) returns varchar\n"
@@ -17502,9 +17768,10 @@ static const char *proc190 =
 "class_name := concat (md5 (class_name), subseq (class_name, len-31));\n"
 "return fix_identifier_case (concat (\'page_\', class_name));\n"
 "}\n"
-"--src vspx.sql:5642\n";
+"--src vspx.sql:5649\n";
 
 static const char *proc191 = 
+"#line 5673 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_get_signature (in dbname varchar, in usr varchar, in res varchar)\n"
 "{\n"
 "declare signature varchar;\n"
@@ -17515,9 +17782,10 @@ static const char *proc191 =
 "vspx_get_compiler_signature() );\n"
 "return signature;\n"
 "}\n"
-"--src vspx.sql:5664\n";
+"--src vspx.sql:5671\n";
 
 static const char *proc192 = 
+"#line 5685 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_load_code (in vspx_dbname varchar, in vspx_user varchar,\n"
 "in resource_name varchar, in code_files any)\n"
 "{\n"
@@ -17540,9 +17808,10 @@ static const char *proc192 =
 "i := i + 1;\n"
 "}\n"
 "}\n"
-"--src vspx.sql:5676\n";
+"--src vspx.sql:5683\n";
 
 static const char *proc193 = 
+"#line 5709 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_report_debug_log (in page vspx_page)\n"
 "{\n"
 "declare sheet_name varchar;\n"
@@ -17553,9 +17822,10 @@ static const char *proc193 =
 "http (\']]>-\' || \'->]]></table></div></ins></del><hr>\');\n"
 "http_value (xslt (sheet_name, page.vc_get_debug_log(\'xmp\'), vector(\'tgt\',\'http\')));\n"
 "}\n"
-"--src vspx.sql:5700\n";
+"--src vspx.sql:5707\n";
 
 static const char *proc194 = 
+"#line 5721 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_get_user_info (inout vspx_dbname varchar, inout vspx_user varchar)\n"
 "{\n"
 "\n"
@@ -17563,9 +17833,10 @@ static const char *proc194 =
 "\n"
 "vspx_user := fix_identifier_case (http_map_get (\'vsp_uid\'));\n"
 "}\n"
-"--src vspx.sql:5712\n";
+"--src vspx.sql:5719\n";
 
 static const char *proc195 = 
+"#line 5731 \"[executable]/vspx.sql\"\n"
 "create procedure\n"
 "vspx_dispatch (in resource_name varchar, inout path any, inout params any, inout lines any, in class_name varchar := null, in compile_only int := 0, in vspx_dbname varchar := NULL, in vspx_user varchar := NULL)\n"
 "{\n"
@@ -17736,9 +18007,10 @@ static const char *proc195 =
 "vspx_report_debug_log (page);\n"
 "return page;\n"
 "}\n"
-"--src vspx.sql:5722\n";
+"--src vspx.sql:5729\n";
 
 static const char *proc196 = 
+"#line 5904 \"[executable]/vspx.sql\"\n"
 "create procedure\n"
 "vspx_verify_pass (in auth_vec any, in passwd varchar)\n"
 "{\n"
@@ -17752,9 +18024,10 @@ static const char *proc196 =
 "get_keyword (\'qop\', auth_vec, \'\'),\n"
 "passwd);\n"
 "}\n"
-"--src vspx.sql:5895\n";
+"--src vspx.sql:5902\n";
 
 static const char *proc197 = 
+"#line 5920 \"[executable]/vspx.sql\"\n"
 " create procedure\n"
 "vspx_get_cookie_vec (in lines any)\n"
 "{\n"
@@ -17780,9 +18053,10 @@ static const char *proc197 =
 "}\n"
 "return cookie_vec;\n"
 "}\n"
-"--src vspx.sql:5911\n";
+"--src vspx.sql:5918\n";
 
 static const char *proc198 = 
+"#line 5948 \"[executable]/vspx.sql\"\n"
 " create procedure\n"
 "vspx_do_compact (in arr any) returns any\n"
 "{\n"
@@ -17802,9 +18076,10 @@ static const char *proc198 =
 "}\n"
 "return ret;\n"
 "}\n"
-"--src vspx.sql:5939\n";
+"--src vspx.sql:5946\n";
 
 static const char *proc199 = 
+"#line 5973 \"[executable]/vspx.sql\"\n"
 " create procedure DB.DBA.VSPX_COLUMNS_META (in sql varchar)\n"
 "{\n"
 "declare mtd, res any;\n"
@@ -17825,11 +18100,12 @@ static const char *proc199 =
 "}\n"
 "return xml_tree_doc(string_output_string (res));\n"
 "}\n"
-"--src vspx.sql:5964\n";
+"--src vspx.sql:5971\n";
 
 static const char *other276 = 
 "grant execute on DB.DBA.VSPX_COLUMNS_META to public\n";
 static const char *proc200 = 
+"#line 5999 \"[executable]/vspx.sql\"\n"
 " create procedure VSPX_COLUMNS_META_TYPES (in col varchar, in tab varchar)\n"
 "{\n"
 "declare mtd, res, sql, ty any;\n"
@@ -17849,11 +18125,12 @@ static const char *proc200 =
 "else\n"
 "return \'varchar\';\n"
 "}\n"
-"--src vspx.sql:5990\n";
+"--src vspx.sql:5997\n";
 
 static const char *other277 = 
 "grant execute on DB.DBA.VSPX_COLUMNS_META_TYPES to public\n";
 static const char *proc201 = 
+"#line 6023 \"[executable]/vspx.sql\"\n"
 "create procedure VSPX_PK_COLUMNS (in tab varchar)\n"
 "{\n"
 "declare ses, ret any;\n"
@@ -17881,7 +18158,7 @@ static const char *proc201 =
 "ret := \'<void />\';\n"
 "return xml_tree_doc(ret);\n"
 "}\n"
-"--src vspx.sql:6014\n";
+"--src vspx.sql:6021\n";
 
 static const char *other278 = 
 "grant execute on VSPX_PK_COLUMNS to public\n";
@@ -17898,6 +18175,7 @@ static const char *other283 =
 static const char *other284 = 
 "xpf_extension (\'http://www.openlinksw.com/vspx/:pk_columns\', \'DB.DBA.VSPX_PK_COLUMNS\', 0)\n";
 static const char *proc202 = 
+"#line 6082 \"[executable]/vspx.sql\"\n"
 " create procedure\n"
 "dbg_vspx_control (in control vspx_control, in tab int default 0)\n"
 "{\n"
@@ -17948,9 +18226,10 @@ static const char *proc202 =
 "if (not tab)\n"
 "dbg_obj_print (\'=============END=============\');\n"
 "}\n"
-"--src vspx.sql:6073\n";
+"--src vspx.sql:6080\n";
 
 static const char *proc203 = 
+"#line 6135 \"[executable]/vspx.sql\"\n"
 " create procedure\n"
 "vspx_uri_compose (in res any)\n"
 "{\n"
@@ -17986,9 +18265,10 @@ static const char *proc203 =
 "\n"
 "return _full_path;\n"
 "}\n"
-"--src vspx.sql:6126\n";
+"--src vspx.sql:6133\n";
 
 static const char *proc204 = 
+"#line 6173 \"[executable]/vspx.sql\"\n"
 " create procedure\n"
 "vspx_uri_add_parameters (in uri varchar, in pars varchar)\n"
 "{\n"
@@ -18004,9 +18284,10 @@ static const char *proc204 =
 "aset (hinfo, 4, par_str);\n"
 "return vspx_uri_compose (hinfo);\n"
 "}\n"
-"--src vspx.sql:6164\n";
+"--src vspx.sql:6171\n";
 
 static const char *proc205 = 
+"#line 6192 \"[executable]/vspx.sql\"\n"
 " create procedure vspx_xforms_params_parse (inout cnt any)\n"
 "{\n"
 "declare xt, ret, ss any;\n"
@@ -18037,12 +18318,13 @@ static const char *proc205 =
 "ret := split_and_decode (xt, 0, \'\\0\\0&=\');\n"
 "return ret;\n"
 "}\n"
-"--src vspx.sql:6183\n";
+"--src vspx.sql:6190\n";
 
 static const char *other285 = 
 "insert soft \"DB\".\"DBA\".\"SYS_SCHEDULED_EVENT\" (SE_INTERVAL, SE_LAST_COMPLETED, SE_NAME, SE_SQL, SE_START)\n"
 "values (1440, NULL, \'VSPX_SESSION_EXPIRE\', \'VSPX_EXPIRE_SESSIONS ()\', now())\n";
 static const char *proc206 = 
+"#line 6231 \"[executable]/vspx.sql\"\n"
 "create procedure\n"
 "VSPX_EXPIRE_SESSIONS ()\n"
 "{\n"
@@ -18051,9 +18333,10 @@ static const char *proc206 =
 "\n"
 "\n"
 "}\n"
-"--src vspx.sql:6222\n";
+"--src vspx.sql:6229\n";
 
 static const char *proc207 = 
+"#line 6242 \"[executable]/vspx.sql\"\n"
 "create procedure DB.DBA.sys_xpath_localfile_eval(in content any, in expr any) {\n"
 "declare retval, result, pos, eval_result integer;\n"
 "declare pwd, dav_content any;\n"
@@ -18106,9 +18389,10 @@ static const char *proc207 =
 "result(eval_result);\n"
 "return retval;\n"
 "}\n"
-"--src vspx.sql:6233\n";
+"--src vspx.sql:6240\n";
 
 static const char *proc208 = 
+"#line 6296 \"[executable]/vspx.sql\"\n"
 "create procedure DB.DBA.sys_save_http_history(in vdir any, in vres any)\n"
 "{\n"
 "declare _ext, result, name, content, pwd, cnt any;\n"
@@ -18171,15 +18455,16 @@ static const char *proc208 =
 "}\n"
 "}\n"
 "}\n"
-"--src vspx.sql:6287\n";
+"--src vspx.sql:6294\n";
 
 static const char *proc209 = 
+"#line 6361 \"[executable]/vspx.sql\"\n"
 "create procedure\n"
 "cal_icell (inout control vspx_control, in inx int)\n"
 "{\n"
 "return (control.vc_parent as vspx_row_template).te_rowset[inx];\n"
 "}\n"
-"--src vspx.sql:6352\n";
+"--src vspx.sql:6359\n";
 
 static const char *other286 = 
 "grant execute on  vspx_event  to public\n";
@@ -18270,6 +18555,7 @@ static const char *tbl10 =
 ")\n";
 
 static const char *proc210 = 
+"#line 6497 \"[executable]/vspx.sql\"\n"
 " create procedure VSPX_CONTROL_EXISTS (in name varchar)\n"
 "{\n"
 "\n"
@@ -18278,22 +18564,24 @@ static const char *proc210 =
 "return 1;\n"
 "return null;\n"
 "}\n"
-"--src vspx.sql:6488\n";
+"--src vspx.sql:6495\n";
 
 static const char *other326 = 
 "grant execute on VSPX_CONTROL_EXISTS to public\n";
 static const char *proc211 = 
+"#line 6511 \"[executable]/vspx.sql\"\n"
 " create procedure VSPX_CUSTOM_CLASS_NAME (in name varchar)\n"
 "{\n"
 "declare class_name varchar;\n"
 "select VCC_CLASS into class_name from VSPX_CUSTOM_CONTROL where VCC_TAG_NAME = name;\n"
 "return class_name;\n"
 "}\n"
-"--src vspx.sql:6502\n";
+"--src vspx.sql:6509\n";
 
 static const char *other327 = 
 "grant execute on VSPX_CUSTOM_CLASS_NAME to public\n";
 static const char *proc212 = 
+"#line 6523 \"[executable]/vspx.sql\"\n"
 " create procedure VSPX_CLASS_PARSER (in name varchar, in tag any)\n"
 "{\n"
 "declare fn varchar;\n"
@@ -18303,7 +18591,7 @@ static const char *proc212 =
 "call (fn) (tag, ss);\n"
 "return string_output_string (ss);\n"
 "}\n"
-"--src vspx.sql:6514\n";
+"--src vspx.sql:6521\n";
 
 static const char *other328 = 
 "grant execute on VSPX_CLASS_PARSER to public\n";
@@ -18323,15 +18611,17 @@ static const char *other333 =
 static const char *other334 = 
 "xpf_extension (\'http://www.openlinksw.com/vspx/:vcc_class_name\', \'DB.DBA.VSPX_CUSTOM_CLASS_NAME\', 0)\n";
 static const char *proc213 = 
+"#line 6560 \"[executable]/vspx.sql\"\n"
 "create procedure\n"
 "VSPX_REGISTER_CONTROL (in tag varchar, in class_name varchar, in func varchar)\n"
 "{\n"
 "insert replacing VSPX_CUSTOM_CONTROL (VCC_TAG_NAME, VCC_CLASS, VCC_FUNCTION)\n"
 "values (tag, class_name, func);\n"
 "}\n"
-"--src vspx.sql:6551\n";
+"--src vspx.sql:6558\n";
 
 static const char *proc214 = 
+"#line 6570 \"[executable]/vspx.sql\"\n"
 " create procedure\n"
 "vspx_sid_generate ()\n"
 "{\n"
@@ -18344,9 +18634,10 @@ static const char *proc214 =
 "path := \'\';\n"
 "return md5 (concat (tim, ip, path));\n"
 "}\n"
-"--src vspx.sql:6561\n";
+"--src vspx.sql:6568\n";
 
 static const char *proc215 = 
+"#line 6585 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_label_render (in fmt varchar, in val any)\n"
 "{\n"
 "if (length (fmt))\n"
@@ -18354,9 +18645,10 @@ static const char *proc215 =
 "else\n"
 "http_value (val);\n"
 "}\n"
-"--src vspx.sql:6576\n";
+"--src vspx.sql:6583\n";
 
 static const char *proc216 = 
+"#line 6594 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_url_render (in fmt varchar, in val any, in url any, in sid any, in realm any, in is_local any)\n"
 "{\n"
 "if (length (sid))\n"
@@ -18373,9 +18665,10 @@ static const char *proc216 =
 "http_value (val);\n"
 "http (\'</a>\');\n"
 "}\n"
-"--src vspx.sql:6585\n";
+"--src vspx.sql:6592\n";
 
 static const char *proc217 = 
+"#line 6612 \"[executable]/vspx.sql\"\n"
 "create procedure vspx_url_render_ex (in fmt varchar, in val any, in url any, in sid any, in realm any, in is_local any, in attrs any)\n"
 "{\n"
 "declare i, l int;\n"
@@ -18406,9 +18699,10 @@ static const char *proc217 =
 "http_value (val);\n"
 "http (\'</a>\');\n"
 "}\n"
-"--src vspx.sql:6603\n";
+"--src vspx.sql:6610\n";
 
 static const char *proc218 = 
+"#line 6645 \"[executable]/vspx.sql\"\n"
 " create procedure VSPX_ONE_CONTROL_UP (in expn varchar)\n"
 "{\n"
 "declare idx integer;\n"
@@ -18432,7 +18726,7 @@ static const char *proc218 =
 "idx := aref (hit2, 4) + 7;\n"
 "goto again;\n"
 "}\n"
-"--src vspx.sql:6636\n";
+"--src vspx.sql:6643\n";
 
 static const char *other335 = 
 "grant execute on VSPX_ONE_CONTROL_UP to public\n";
@@ -18441,6 +18735,7 @@ static const char *other336 =
 static const char *other337 = 
 "xpf_extension (\'http://www.openlinksw.com/vspx/:one-control-up\', \'DB.DBA.VSPX_ONE_CONTROL_UP\', 0)\n";
 static const char *proc219 = 
+"#line 6679 \"[executable]/vspx.sql\"\n"
 "create procedure VSPX_USER_LOGIN (in realm varchar, in uname varchar, in pass varchar, in auth_function varchar)\n"
 "{\n"
 "declare rc int;\n"
@@ -18455,9 +18750,10 @@ static const char *proc219 =
 "}\n"
 "return sid;\n"
 "}\n"
-"--src vspx.sql:6670\n";
+"--src vspx.sql:6677\n";
 
 static const char *proc220 = 
+"#line 6695 \"[executable]/vspx.sql\"\n"
 "create procedure VSPX_SESSION_IS_VALID (in realm varchar, in sid varchar)\n"
 "{\n"
 "update VSPX_SESSION set VS_EXPIRY = now () where VS_SID = sid and VS_REALM = realm;\n"
@@ -18465,11 +18761,11 @@ static const char *proc220 =
 "return 0;\n"
 "return 1;\n"
 "}\n"
-"--src vspx.sql:6686\n";
+"--src vspx.sql:6693\n";
 
 /* vspx_add_locations.xsl */
 
-static const char *xsl30[]= {
+static const char *xsl31[]= {
 "<?xml version='1.0'?>\n"
 "<!--\n"
 " -  \n"
@@ -18531,7 +18827,7 @@ static const char *xsl30[]= {
 
 /* vspx_expand.xsl */
 
-static const char *xsl31[]= {
+static const char *xsl32[]= {
 "<?xml version='1.0'?>\n"
 "<!--\n"
 " -  \n"
@@ -19037,7 +19333,7 @@ static const char *xsl31[]= {
 
 /* vspx_pre_xsd.xsl */
 
-static const char *xsl32[]= {
+static const char *xsl33[]= {
 "<?xml version='1.0'?>\n"
 "<!--\n"
 " -  \n"
@@ -19143,7 +19439,7 @@ static const char *xsl32[]= {
 
 /* vspx_pre_sql.xsl */
 
-static const char *xsl33[]= {
+static const char *xsl34[]= {
 "<?xml version='1.0'?>\n"
 "<!--\n"
 " -  \n"
@@ -19359,7 +19655,7 @@ static const char *xsl33[]= {
 
 /* vspx_log_format.xsl */
 
-static const char *xsl34[]= {
+static const char *xsl35[]= {
 "<?xml version='1.0'?>\n"
 "<!--\n"
 " -  \n"
@@ -19470,7 +19766,7 @@ static const char *xsl34[]= {
 
 /* vspx.xsd */
 
-static const char *xsd35[]= {
+static const char *xsd36[]= {
 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
 "<!--\n"
 " -  \n"
@@ -22674,7 +22970,7 @@ static const char *xsd35[]= {
 
 /* vspx.xsl */
 
-static const char *xsl36[]= {
+static const char *xsl37[]= {
 "<?xml version='1.0'?>\n"
 "<!DOCTYPE xsl:stylesheet [\n"
 "  <!ENTITY LINE \"
#line <xsl:value-of select='xpath-debug-xslline()+1' /> "<xsl:value-of select='xpath-debug-xslfile()' />"\">\n"
@@ -28177,9 +28473,9 @@ sqls_define_ws (void)
   DEFINE_PROC ("vsp_auth_vec_compose", proc6); 
   DEFINE_PUBLIC_PROC ("vsp_auth_vec", proc7);
   DEFINE_PROC ("vsp_ua_skip_lwsp", proc8);
-  DEFINE_PROC ("vsp_ua_match_hdr", proc9);
-  DEFINE_PROC ("vsp_ua_prop_init", proc10); 
-  DEFINE_PUBLIC_PROC ("vsp_calculate_digest", proc11);
+  DEFINE_PROC ("vsp_ua_match_hdr", proc9); 
+  DEFINE_PUBLIC_PROC ("vsp_calculate_digest", proc10);
+  DEFINE_PROC ("vsp_ua_prop_init", proc11);
   DEFINE_PROC ("vsp_ua_vec_init", proc12);
   DEFINE_PROC ("vsp_ua_get_prop", proc13); 
   DEFINE_PUBLIC_PROC ("vsp_ua_get_props", proc14);
@@ -28457,6 +28753,10 @@ sqls_define_ws (void)
   dk_free_box (bootstrap_cli->cli_qualifier);
   bootstrap_cli->cli_qualifier =  saved_qualifier;
 
+  /* xrd2json.xsl */
+
+  XSLT_DEFINE ("http://local.virt/xrd2json", xsl26);
+
   /* http_auth.sql */
 
   DEFINE_PROC ("DB.DBA.HP_AUTH_SQL_USER", proc124);
@@ -28904,31 +29204,31 @@ sqls_define_ws (void)
 
   /* vspx_add_locations.xsl */
 
-  XSLT_DEFINE ("http://local.virt/vspx_add_locations", xsl30);
+  XSLT_DEFINE ("http://local.virt/vspx_add_locations", xsl31);
 
   /* vspx_expand.xsl */
 
-  XSLT_DEFINE ("http://local.virt/vspx_expand", xsl31);
+  XSLT_DEFINE ("http://local.virt/vspx_expand", xsl32);
 
   /* vspx_pre_xsd.xsl */
 
-  XSLT_DEFINE ("http://local.virt/vspx_pre_xsd", xsl32);
+  XSLT_DEFINE ("http://local.virt/vspx_pre_xsd", xsl33);
 
   /* vspx_pre_sql.xsl */
 
-  XSLT_DEFINE ("http://local.virt/vspx_pre_sql", xsl33);
+  XSLT_DEFINE ("http://local.virt/vspx_pre_sql", xsl34);
 
   /* vspx_log_format.xsl */
 
-  XSLT_DEFINE ("http://local.virt/vspx_log_format", xsl34);
+  XSLT_DEFINE ("http://local.virt/vspx_log_format", xsl35);
 
   /* vspx.xsd */
 
-  XSD_DEFINE ("http://local.virt/vspx.xsd", xsd35);
+  XSD_DEFINE ("http://local.virt/vspx.xsd", xsd36);
 
   /* vspx.xsl */
 
-  XSLT_DEFINE ("http://local.virt/vspx", xsl36);
+  XSLT_DEFINE ("http://local.virt/vspx", xsl37);
 }
 
 
diff --git a/libsrc/Wi/sql_to_c.awk b/libsrc/Wi/sql_to_c.awk
index eed3e94..5566306 100644
--- a/libsrc/Wi/sql_to_c.awk
+++ b/libsrc/Wi/sql_to_c.awk
@@ -1,5 +1,7 @@
 #
-#  $Id: sql_to_c.awk,v 1.6.2.4 2009/12/09 16:05:16 source Exp $
+# sql_to_c.awk
+#
+# $Id: sql_to_c.awk,v 1.6.2.5 2010/10/27 12:51:33 source Exp $
 #
 #  Embeds SQL code into a C file
 #
@@ -478,12 +480,12 @@ BEGIN   {
 		    if ((pieces[2] == "PROCEDURE" || pieces[2] == "FUNCTION") &&  three_part != "VIEW" )
 		      {
 			_defines1 = "\n  " define_proc_macro " (\"" pieces[3] "\", proc" nproc ");"
+			print "static const char *proc" nproc " = \n\"#line " line_begin_no+1 " \\\"[executable]/" end_name "\\\"\\n\"\n" fun
                         # Here is a debug comment code
 			if (pl_stats == "PLDBG")
-			  print "static const char *proc" nproc " = \n" fun "\n" "\"--src " end_name ":" line_begin_no "\\n\";\n"
+			  print "\"--src " end_name ":" line_begin_no-1 "\\n\";\n"
 			else
-			  print "static const char *proc" nproc " = \n" fun ";\n"
-
+			  print ";\n"
 			nproc = nproc + 1
 		      }
 	            else if (pieces[2] == "TYPE")
@@ -498,10 +500,11 @@ BEGIN   {
 		    else if (pieces[2] == "TRIGGER")
 		      {
 			_defines1 = "\n  ddl_std_proc (trig" ntriggers ", 0x0);"
+			print "static const char *trig" ntriggers " = \n\"#line " line_begin_no+1 " \\\"[executable]/" end_name "\\\"\\n\"\n" fun
 			if (pl_stats == "PLDBG")
-			  print "static const char *trig" ntriggers " = \n" fun "\n" "\"--src " end_name ":" line_begin_no "\\n\";\n"
+			  print "\"--src " end_name ":" line_begin_no-1 "\\n\";\n"
 			else
-			  print "static const char *trig" ntriggers " = \n" fun ";\n"
+			  print ";\n"
 			ntriggers = ntriggers + 1
 		      }
 		    else if (pieces[2] == "INDEX")
diff --git a/libsrc/Wi/sqlbif.c b/libsrc/Wi/sqlbif.c
index 361a72d..677942d 100644
--- a/libsrc/Wi/sqlbif.c
+++ b/libsrc/Wi/sqlbif.c
@@ -1,7 +1,7 @@
 /*
  *  sqlbif.c
  *
- *  $Id: sqlbif.c,v 1.122.2.41 2010/06/25 16:39:58 source Exp $
+ *  $Id: sqlbif.c,v 1.122.2.58 2011/03/03 11:56:44 source Exp $
  *
  *  SQL Built In Functions
  *
@@ -103,6 +103,7 @@ extern void bif_soap_init (void);
 extern void bif_http_client_init (void);
 extern void bif_smtp_init (void);
 extern void bif_pop3_init (void);
+extern void bif_imap_init (void);
 extern void bif_nntp_init (void);
 extern void bif_regexp_init(void);
 extern void bif_crypto_init(void);
@@ -906,7 +907,33 @@ bif_dbg_obj_princ (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   int inx;
   int prev_is_strg_const = 1;
-
+  dk_set_t iri_labels = NULL;
+  static dk_mutex_t *mtx = NULL;
+  static void *prev_thread = NULL;
+  void *curr_thread;
+  if (NULL == mtx) mtx = mutex_allocate ();
+  DO_BOX_FAST_REV (state_slot_t *, arg, inx, args)
+  {
+    caddr_t val = qst_get (qst, arg);
+    if (DV_IRI_ID == DV_TYPE_OF (val))
+      {
+	iri_id_t iid = unbox_iri_id (val);
+	if ((0L != iid) && ((min_bnode_iri_id () > iid) || (min_named_bnode_iri_id () < iid)))
+	  {
+	    caddr_t iri = key_id_to_iri ((query_instance_t *) qst, iid);
+	    dk_set_push (&iri_labels, iri);
+	  }
+      }
+  }
+  END_DO_BOX_FAST_REV;
+/* At this point any use if indexes is complete so the function can enter its own internal mutex w/o the risk of deadlock */
+  mutex_enter (mtx);
+  curr_thread = THREAD_CURRENT_THREAD;
+  if (curr_thread != prev_thread)
+    {
+      printf ("[THREAD %p]:\n", curr_thread);
+      prev_thread = curr_thread;
+    }
   DO_BOX (state_slot_t *, arg, inx, args)
   {
     caddr_t val = qst_get (qst, arg);
@@ -916,14 +943,36 @@ bif_dbg_obj_princ (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
     if (this_is_strg_const)
       printf ("%s", val);
     else
-      dbg_print_box (val, stdout);
+      {
+	dbg_print_box (val, stdout);
+	if (DV_IRI_ID == DV_TYPE_OF (val))
+	  {
+	    iri_id_t iid = unbox_iri_id (val);
+	    if (0L == iid)
+	      goto done_iid;	/* see below */
+	    if ((min_bnode_iri_id () <= iid) && (min_named_bnode_iri_id () > iid))
+	      {
+		caddr_t iri = BNODE_IID_TO_LABEL (iid);
+		printf ("=%s", iri);
+		dk_free_box (iri);
+	      }
+	    else
+	      {
+		caddr_t iri = dk_set_pop (&iri_labels);
+		if (!iri)
+		  goto done_iid;	/* see below */
+		printf ("=<%s>", iri);
+		dk_free_box (iri);
+	      }
+	  done_iid:;
+	  }
+      }
     prev_is_strg_const = this_is_strg_const;
   }
   END_DO_BOX;
-
-  printf ("\n");		/* Added by AK, 16-JAN-1997 for nicer output. */
+  printf ("\n");
   fflush (stdout);
-
+  mutex_leave (mtx);
   return NULL;
 }
 
@@ -3125,7 +3174,7 @@ bif_sprintf (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 
 	  ptr++;
 
-	  while (isalnum (ptr[0]) || ('_' == ptr[0]))
+	  while (isalnum ((unsigned char) (ptr[0])) || ('_' == ptr[0]))
 	    ptr++;
 
 	  if ('}' != ptr[0])
@@ -3689,7 +3738,7 @@ retry_unrdf:
 		  fmt_tail++;
 		  fmt_tail++;
 
-		  while (isalnum (fmt_tail[0]) || ('_' == fmt_tail[0]))
+		  while (isalnum ((unsigned char) (fmt_tail[0])) || ('_' == fmt_tail[0]))
 		    fmt_tail++;
 
 		  if ('}' != fmt_tail[0])
@@ -4289,7 +4338,7 @@ format_mismatch:
 caddr_t
 bif_strchr (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
-  caddr_t str = bif_string_or_wide_or_null_arg (qst, args, 0, "strchr");
+  caddr_t str = bif_string_or_uname_or_wide_or_null_arg (qst, args, 0, "strchr");
   unsigned long chr = (unsigned long) bif_long_or_char_arg (qst, args, 1, "strchr");
   char *inx;
   int sizeof_char;
@@ -4324,7 +4373,7 @@ bif_strchr (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 caddr_t
 bif_strrchr (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
-  caddr_t str = bif_string_or_wide_or_null_arg (qst, args, 0, "strrchr");
+  caddr_t str = bif_string_or_uname_or_wide_or_null_arg (qst, args, 0, "strrchr");
   unsigned long chr = (unsigned long) bif_long_or_char_arg (qst, args, 1, "strrchr");
   char *inx;
   int sizeof_char;
@@ -4363,8 +4412,8 @@ bif_strrchr (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 caddr_t
 bif_strstr_imp (caddr_t * qst, state_slot_t ** args, int opcode, const char *func_name)
 {
-  caddr_t str1 = bif_string_or_wide_or_null_arg (qst, args, 0, func_name);
-  caddr_t str2 = bif_string_or_wide_or_null_arg (qst, args, 1, func_name);
+  caddr_t str1 = bif_string_or_uname_or_wide_or_null_arg (qst, args, 0, func_name);
+  caddr_t str2 = bif_string_or_uname_or_wide_or_null_arg (qst, args, 1, func_name);
   char *inx = NULL;
   dtp_t dtp1 = DV_TYPE_OF (str1);
   dtp_t dtp2 = DV_TYPE_OF (str2);
@@ -4499,8 +4548,8 @@ bif_nc_strstr (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 static caddr_t
 bif_casemode_strcmp (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
-  caddr_t str1 = bif_string_arg (qst, args, 0, "casemode_strcmp");
-  caddr_t str2 = bif_string_arg (qst, args, 1, "casemode_strcmp");
+  caddr_t str1 = bif_string_or_uname_arg (qst, args, 0, "casemode_strcmp");
+  caddr_t str2 = bif_string_or_uname_arg (qst, args, 1, "casemode_strcmp");
   return box_num (CASEMODESTRCMP (str1, str2));
 }
 
@@ -4508,7 +4557,7 @@ bif_casemode_strcmp (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 static caddr_t
 bif_fix_identifier_case (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
-  caddr_t ident = bif_string_arg (qst, args, 0, "fix_identifier_case");
+  caddr_t ident = bif_string_or_uname_arg (qst, args, 0, "fix_identifier_case");
   caddr_t out = sqlp_box_id_upcase (ident);
   caddr_t out1 = box_dv_short_string (out);
   dk_free_box (out);
@@ -4537,8 +4586,8 @@ bif_locate (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   char *me = "locate";
   int n_args = BOX_ELEMENTS (args);
-  caddr_t str1 = bif_string_or_wide_or_null_arg (qst, args, 0, me);
-  caddr_t str2 = bif_string_or_wide_or_null_arg (qst, args, 1, me);
+  caddr_t str1 = bif_string_or_uname_or_wide_or_null_arg (qst, args, 0, me);
+  caddr_t str2 = bif_string_or_uname_or_wide_or_null_arg (qst, args, 1, me);
   long int start = (long int) ((n_args > 2) ? bif_long_arg (qst, args, 2, me) - 1 : 0);
   long int len1, len2;
   char *inx;
@@ -4595,8 +4644,8 @@ caddr_t
 bif_matches_like (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   int st = LIKE_ARG_CHAR, pt = LIKE_ARG_CHAR;
-  caddr_t str1 = bif_string_or_wide_or_null_arg (qst, args, 0, "matches_like");
-  caddr_t str2 = bif_string_or_wide_or_null_arg (qst, args, 1, "matches_like");
+  caddr_t str1 = bif_string_or_uname_or_wide_or_null_arg (qst, args, 0, "matches_like");
+  caddr_t str2 = bif_string_or_uname_or_wide_or_null_arg (qst, args, 1, "matches_like");
   dtp_t ltype = DV_TYPE_OF (str1);
   dtp_t rtype = DV_TYPE_OF (str2);
   long res1;
@@ -4645,8 +4694,6 @@ caddr_t
 bif_rdf_rng_min (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   /* 10 first chars if over 10 */
-  int len;
-  caddr_t res;
   caddr_t str_in = bif_arg_unrdf (qst, args, 0, "__like_min");
   if (!DV_STRINGP (str_in)
       || box_length (str_in) - 1 < 10)
@@ -4661,7 +4708,7 @@ bif_like_min (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   int len;
   caddr_t res;
   caddr_t str_in = bif_string_or_wide_or_null_arg (qst, args, 0, "__like_min");
-  caddr_t str;
+  caddr_t str = NULL;
   dtp_t dtp = DV_TYPE_OF (str_in);
   char esc = (char) (BOX_ELEMENTS (args) > 1 ? bif_long_arg (qst, args, 1, "__like_min") : 0);
   char * ctr = NULL;
@@ -4717,7 +4764,7 @@ bif_like_max (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   int len;
   caddr_t res;
   caddr_t str_in = bif_string_or_wide_or_null_arg (qst, args, 0, "__like_max");
-  caddr_t str;
+  caddr_t str = NULL;
   dtp_t dtp = DV_TYPE_OF (str_in);
   char esc = (char) (BOX_ELEMENTS (args) > 1 ? bif_long_arg (qst, args, 1, "__like_max") : 0);
   char * ctr;
@@ -7256,11 +7303,11 @@ cleanup:
   scn3split_pop_all_buffers ();
   MP_DONE();
   SCS_STATE_POP;
+  dk_free_box (scn3split_ses); /* must be released inside semaphore */
+  scn3split_ses = NULL;
   semaphore_leave (parse_sem);
   sc_free (&sc);
-  dk_free_box (scn3split_ses);
   dk_free_box (start_filename);
-  scn3split_ses = NULL;
   return revlist_to_array (res);
 }
 
@@ -8696,6 +8743,7 @@ num_check_prec (boxint val, int prec, char *title, caddr_t *err_ret)
 caddr_t
 box_cast (caddr_t * qst, caddr_t data, ST * dtp, dtp_t arg_dtp)
 {
+  caddr_t err;
   if (arg_dtp == DV_DB_NULL)
     return (dk_alloc_box (0, DV_DB_NULL));
   if (!ARRAYP (dtp) || 0 == BOX_ELEMENTS (dtp))
@@ -8711,7 +8759,7 @@ box_cast (caddr_t * qst, caddr_t data, ST * dtp, dtp_t arg_dtp)
         }
       if (0 == rb->rb_is_complete)
 #ifdef DEBUG
-        sqlr_new_error ("22023", ((NULL != qst) && (((query_instance_t *)qst)->qi_no_cast_error)) ? "sR066" : "SR066", "Unsupported case in CONVERT (incomplete RDF box -> %s)", dv_type_title((int) (dtp->type)));
+        sqlr_new_error ("22023", (IS_BOX_POINTER (qst) && (((query_instance_t *)qst)->qi_no_cast_error)) ? "sR066" : "SR066", "Unsupported case in CONVERT (incomplete RDF box -> %s)", dv_type_title((int) (dtp->type)));
 #else
         sqlr_new_error ("22023", "SR066", "Unsupported case in CONVERT (incomplete RDF box -> %s)", dv_type_title((int) (dtp->type)));
 #endif
@@ -8829,14 +8877,14 @@ do_long_string:
 		  ret = blob_to_string (qi->qi_trx, data);
 		  if (!DV_STRINGP (ret))
 		    {
-		      caddr_t err = NULL, ret1;
-
+		      caddr_t ret1;
+                      err = NULL;
 		      ret1 = box_cast_to (qst, ret, DV_TYPE_OF (ret), DV_SHORT_STRING,
 			  NUMERIC_MAX_PRECISION, NUMERIC_MAX_SCALE, &err);
 
 		      dk_free_box (ret);
 		      if (err)
-			sqlr_resignal (ret);
+			goto inner_error;
 		      ret = ret1;
 		    }
 		  return ret;
@@ -8855,6 +8903,7 @@ do_long_string:
 		  caddr_t *subresults = (caddr_t *)dk_alloc_box_zero(els * sizeof(caddr_t), DV_ARRAY_OF_POINTER);
 		  size_t res_len = 0, res_fill = 0;
 		  caddr_t res = NULL;
+                  err = NULL;
 		  QR_RESET_CTX
 		    {
 		      for (ctr = 0; ctr < els; ctr++)
@@ -8870,12 +8919,12 @@ do_long_string:
 		  QR_RESET_CODE
 		    {
 		      du_thread_t *self = THREAD_CURRENT_THREAD;
-		      caddr_t err = thr_get_error_code (self);
-		      POP_QR_RESET;
-		      dk_free_tree ((box_t) subresults);
-		      sqlr_resignal (err);
+		      err = thr_get_error_code (self);
+                      dk_free_tree (subresults);
 		    }
 		  END_QR_RESET;
+                  if (err)
+                    goto inner_error;
 		  res = dk_alloc_box (res_len+1, DV_SHORT_STRING);
 		  for (ctr = 0; ctr < els; ctr++)
 		    {
@@ -8916,6 +8965,8 @@ do_long_string:
                     snprintf (tmp, sizeof (tmp), "#i" BOXINT_FMT, (boxint)(iid) );
 		  break;
 		}
+	case DV_GEO:
+	  snprintf (tmp, sizeof (tmp), "<geometry>");
 	  default:
 	      goto cvt_error;
 	}
@@ -8926,6 +8977,7 @@ do_long_int:
     {
       int prec = BOX_ELEMENTS (dtp) > 1 ? (int) (unbox (((caddr_t *) dtp)[1])) : 0;
       boxint val;
+      err = NULL;
       switch (arg_dtp)
 	{
 	  case DV_LONG_INT:
@@ -8936,17 +8988,15 @@ do_long_int:
 	  case DV_DOUBLE_FLOAT:
 	      val = (boxint) unbox_double (data); break;
 	  case DV_STRING:
-	      val = safe_atoi (data, NULL); break;
+		val = safe_atoi (data, &err);
+                break;
 #ifdef BIF_XML
 	  case DV_XML_ENTITY:
 		{
 		  caddr_t tmp_res = NULL;
-		  caddr_t err = NULL;
 		  xe_sqlnarrow_string_value ((xml_entity_t *)(data), &tmp_res, DV_LONG_STRING);
 		  val = safe_atoi (tmp_res, &err);
 		  dk_free_box (tmp_res);
-		  if (NULL != err)
-		    sqlr_resignal (err);
 		  break;
 		}
 #endif
@@ -8962,12 +9012,14 @@ do_long_int:
 		{
 		  char narrow [512];
 		  box_wide_string_as_narrow (data, narrow, 512, qst ? QST_CHARSET (qst) : NULL);
-		  val = safe_atoi (narrow, NULL);
+		  val = safe_atoi (narrow, &err);
 		  break;
 		}
 	  default:
 	      goto cvt_error;
 	}
+      if (err)
+        goto inner_error;
       return box_num (num_check_prec (val, prec, "CONVERT", NULL));
     }
 
@@ -8983,7 +9035,14 @@ do_single_float:
 	  case DV_DOUBLE_FLOAT:
 	      return (box_float ((float) unbox_double (data)));
 	  case DV_STRING:
-	      return (box_float ((float) safe_atof (data, NULL)));
+            {
+	      double d;
+              err = NULL;
+              d = safe_atof (data, &err);
+              if (err)
+                goto inner_error;
+              return (box_float ((float)d));
+            }
 	  case DV_NUMERIC:
 		{
 		  double dt;
@@ -8994,8 +9053,13 @@ do_single_float:
 	  case DV_LONG_WIDE:
 		{
 		  char narrow [512];
+	      double d;
+              err = NULL;
 		  box_wide_string_as_narrow (data, narrow, 512, qst ? QST_CHARSET (qst) : NULL);
-		  return (box_float ((float) safe_atof (narrow, NULL)));
+              d = safe_atof (narrow, &err);
+              if (err)
+                goto inner_error;
+              return (box_float ((float)d));
 		}
 	  default:
 	      goto cvt_error;
@@ -9016,8 +9080,12 @@ do_double_float:
 	  case DV_LONG_STRING:
 		{
 		  double d = 0.0;
-		  sscanf (data, "%lf", &d);
+                  const char *start = numeric_from_string_is_ok (data);
+                  if (NULL == start)
+                    goto cvt_error;
+		  if (1 == sscanf (start, "%lf", &d))
 		  return (box_double (d));
+		  goto cvt_error;
 		}
 	  case DV_NUMERIC:
 		{
@@ -9029,8 +9097,16 @@ do_double_float:
 	  case DV_LONG_WIDE:
 		{
 		  char narrow [512];
+		  double d = 0.0;
+                  const char *start;
 		  box_wide_string_as_narrow (data, narrow, 512, qst ? QST_CHARSET (qst) : NULL);
-		  return (box_double (atof (narrow)));
+		  /* return (box_double (atof (narrow)));*/
+                  start = numeric_from_string_is_ok (narrow);
+                  if (NULL == start)
+                    goto cvt_error;
+		  if (1 == sscanf (start, "%lf", &d))
+		    return (box_double (d));
+		  goto cvt_error;
 		}
 	  default:
 	      goto cvt_error;
@@ -9040,12 +9116,11 @@ do_double_float:
 do_numeric:
     {
       numeric_t res = numeric_allocate ();
-      caddr_t err;
       err = numeric_from_x (res, data, (int) unbox (((caddr_t*)dtp)[1]), (int) unbox (((caddr_t*)dtp)[2]), "CAST", 0, NULL);
       if (err)
 	{
 	  numeric_free (res);
-	  sqlr_resignal (err);
+          goto inner_error;
 	}
       return ((caddr_t) res);
     }
@@ -9057,38 +9132,30 @@ do_datetime:
 	{
 	  case DV_STRING:
 	      res = string_to_dt_box (data);
-	      if (ST_P (dtp, DV_DATE))
-		{
-		  dt_date_round (res);
-		}
-	      else if (ST_P (dtp, DV_DATE) || ST_P (dtp, DV_TIME))
-		{
-		  DT_SET_FRACTION (res, 0);
-		}
-	      SET_DT_TYPE_BY_DTP (res, dtp->type);
-	      return res;
+          break;
 	  case DV_DATETIME:
 	  case DV_DATE:
 	  case DV_TIME:
 	      res = box_copy_tree (data);
-#ifdef DEBUG
-              DT_SET_DAY (res, DAY_ZERO+1);
-#endif
-	      SET_DT_TYPE_BY_DTP (res, dtp->type);
-	      return res;
+          break;
 	  case DV_BIN:
 	      if (dt_validate (data))
 		sqlr_new_error ("22003", "SR351",
 		    "Invalid data supplied in VARBINARY -> DATETIME conversion");
 	      res = box_copy (data);
 	      box_tag_modify (res, DV_DATETIME);
-	      return res;
+	  break;
 	  case DV_WIDE:
 	  case DV_LONG_WIDE:
 		{
 		  caddr_t narrow = box_wide_string_as_narrow (data, NULL, 0, qst ? QST_CHARSET (qst) : NULL);
 		  res = string_to_dt_box (narrow);
 		  dk_free_box (narrow);
+            break;
+	  }
+	default:
+	  goto cvt_error;
+	}
 		  if (ST_P (dtp, DV_DATE))
 		    {
 		      dt_date_round (res);
@@ -9101,11 +9168,6 @@ do_datetime:
 		  return res;
 		}
 
-	  default:
-	      goto cvt_error;
-	}
-    }
-
 do_time:
     {
       caddr_t res;
@@ -9206,17 +9268,15 @@ do_bin_again:
 do_wide:
     {
       char tmp[NUMERIC_MAX_STRING_BYTES + 100];
-      caddr_t err = NULL;
       caddr_t ret;
+      err = NULL;
       switch (arg_dtp)
 	{
 	  case DV_STRING:
-		{
 	          ret = box_narrow_string_as_wide ((unsigned char *) data, NULL, 0, qst ? QST_CHARSET (qst) : NULL, &err, 1);
 		  if (err)
-		    sqlr_resignal (err);
+            goto inner_error;
 		  return ret;
-		}
 	  case DV_UNAME:
             {
               unsigned char *utf8 = (unsigned char *) data;
@@ -9293,7 +9353,7 @@ do_wide:
 			  NULL, 0, qst ? QST_CHARSET (qst) : NULL, &err, 1);
 		      dk_free_box (ret);
 		      if (err)
-			sqlr_resignal (err);
+                        goto inner_error;
 		      return wide_ret;
 		    }
 		  return ret;
@@ -9307,11 +9367,20 @@ do_wide:
 	sqlr_resignal (err);
       return ret;
     }
+  goto cvt_error;
 
+inner_error:
+  if (!IS_BOX_POINTER (qst) || !(((query_instance_t *)qst)->qi_no_cast_error))
+    sqlr_resignal (err);
+  dk_free_tree (err);
+  return NEW_DB_NULL;
 
 cvt_error:
+  if (IS_BOX_POINTER (qst) && (((query_instance_t *)qst)->qi_no_cast_error))
+    return NEW_DB_NULL;
+signal_error:
 #ifdef DEBUG
-  sqlr_new_error ("22023", ((NULL != qst) && (((query_instance_t *)qst)->qi_no_cast_error)) ? "sR066" : "SR066", "Unsupported case in CONVERT (%s -> %s)", dv_type_title(arg_dtp), dv_type_title((int) (dtp->type)));
+  sqlr_new_error ("22023", (IS_BOX_POINTER (qst) && (((query_instance_t *)qst)->qi_no_cast_error)) ? "sR066" : "SR066", "Unsupported case in CONVERT (%s -> %s)", dv_type_title(arg_dtp), dv_type_title((int) (dtp->type)));
 #else
   sqlr_new_error ("22023", "SR066", "Unsupported case in CONVERT (%s -> %s)", dv_type_title(arg_dtp), dv_type_title((int) (dtp->type)));
 #endif
@@ -9830,7 +9899,7 @@ set_user_id (client_connection_t * cli, caddr_t name, caddr_t preserve_qual)
   user_t * user;
   user = sec_name_to_user (name);
 
-  if (!user || !user->usr_is_sql || user->usr_is_role)
+  if (!user || /* !user->usr_is_sql || */ user->usr_is_role)
     return 0;
 
   cli->cli_user = user;
@@ -9869,7 +9938,7 @@ bif_set_user_id (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   caddr_t pass = BOX_ELEMENTS (args) > 2 ? bif_string_arg (qst, args, 2, "__set_user_id") : NULL;
   user_t * user = sec_name_to_user (uname);
 
-  if (!user || !user->usr_is_sql || user->usr_is_role)
+  if (!user /*|| !user->usr_is_sql*/ || user->usr_is_role)
     sqlr_new_error ("22023", "HT042", "Not valid user id \"%s\"", uname);
 
   if (pass && (0 != strcmp (pass, user->usr_pass) || user->usr_disabled))
@@ -9987,7 +10056,7 @@ bif_set_qualifier (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   caddr_t *msg;
   query_instance_t *qi = (query_instance_t *)qst;
   caddr_t qual = bif_string_or_wide_or_null_arg (qst, args, 0, "set_qualifier");
-  caddr_t q;
+  caddr_t q = NULL;
   caddr_t cli_ws = (caddr_t) ((query_instance_t *)qst)->qi_client->cli_ws;
   client_connection_t * cli = (client_connection_t *) ((query_instance_t *)qst)->qi_client;
   dtp_t dtp = DV_TYPE_OF (qual);
@@ -10700,23 +10769,6 @@ bif_log_text (caddr_t * inst, caddr_t * err_ret, state_slot_t ** args)
 caddr_t
 bif_repl_text (caddr_t * inst, caddr_t * err_ret, state_slot_t ** args)
 {
-  query_instance_t *qi = (query_instance_t *) inst;
-  caddr_t acct = bif_string_arg (inst, args, 0, "repl_text");
-  int n_args = BOX_ELEMENTS (args) - 1;
-  caddr_t *arr;
-  int inx;
-
-  sec_check_dba (qi, "repl_text");
-
-  arr = (caddr_t *) dk_alloc_box (n_args * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
-
-  for (inx = 0; inx < n_args; inx++)
-    arr[inx] = bif_arg (inst, args, inx + 1, "repl_text");
-
-  log_repl_text_array (qi->qi_trx, NULL, acct, (caddr_t) arr);
-
-  dk_free_box ((caddr_t) arr);
-
   return 0;
 }
 
@@ -10724,23 +10776,6 @@ bif_repl_text (caddr_t * inst, caddr_t * err_ret, state_slot_t ** args)
 caddr_t
 bif_repl_text_pushback (caddr_t * inst, caddr_t * err_ret, state_slot_t ** args)
 {
-  query_instance_t *qi = (query_instance_t *) inst;
-  caddr_t srv = bif_string_arg (inst, args, 0, "repl_text_pushback");
-  caddr_t acct = bif_string_arg (inst, args, 1, "repl_text_pushback");
-  int n_args = BOX_ELEMENTS (args) - 2;
-  caddr_t *arr;
-  int inx;
-
-  sec_check_dba (qi, "repl_text_pushback");
-
-  arr = (caddr_t *) dk_alloc_box (n_args * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
-  for (inx = 0; inx < n_args; inx++)
-    arr[inx] = bif_arg (inst, args, inx + 2, "repl_text_pushback");
-
-  log_repl_text_array (qi->qi_trx, srv, acct, (caddr_t) arr);
-
-  dk_free_box ((caddr_t) arr);
-
   return 0;
 }
 
@@ -11449,10 +11484,6 @@ bif_proc_changed (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
       char *qual = lc_nth_col (lc, 2);
       user_t *owner_user = sec_name_to_user (owner);
       /* Procedure's calls published for replication */
-#ifdef REPLICATION_SUPPORT2
-      char *replic_acct = NULL;
-      char *procstmt = NULL;
-#endif
       int retry = 1;
       if (0 == strcmp (qual, "S")) qual = "DB";
 
@@ -11466,17 +11497,7 @@ bif_proc_changed (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 	}
       /* Procedure's calls published for replication */
 retry_compile:
-#ifdef REPLICATION_SUPPORT2
-      procstmt = text;
-      replic_acct = find_repl_account_in_src_text (&procstmt);
-      proc_qr = sql_compile (procstmt, cli, &err, SQLC_DO_NOT_STORE_PROC);
-      if (proc_qr && !err)
-	proc_qr->qr_proc_repl_acct = ((NULL != replic_acct) ? box_string (replic_acct) : NULL);
-      if (!err)
-	qr_proc_repl_check_valid (proc_qr, &err);
-#else
       proc_qr = sql_compile (text, cli, &err, SQLC_DO_NOT_STORE_PROC);
-#endif
 #if 1
       if (err &&  0 != retry && cl_run_local_only == CL_RUN_CLUSTER && 0 == server_lock.sl_count && strstr (((caddr_t*)err)[2], "RDFNI"))
 	{
@@ -11840,12 +11861,16 @@ bif_checkpoint_interval (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 
 
 caddr_t
-bif_exec_error (caddr_t * qst, state_slot_t ** args, caddr_t err, dk_set_t warnings)
+bif_exec_error (caddr_t * qst, state_slot_t ** args, caddr_t err, dk_set_t warnings, shcompo_t *shc, query_t *qr)
 {
   char buf[80];
   if ((BOX_ELEMENTS (args) < 3) || !ssl_is_settable (args[1]))
     {
       dk_free_tree (list_to_array (sql_warnings_save (warnings)));
+      if (NULL != shc)
+	shcompo_release (shc);
+      else
+	qr_free (qr);
       sqlr_resignal (err);
     }
   if (IS_POINTER (err))
@@ -12023,7 +12048,6 @@ bif_exec (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
       ptype = DV_TYPE_OF (params);
     }
 
-  PROC_SAVE_PARENT;
   if (n_args > 4)
     {
       dtp_t options_dtp;
@@ -12053,6 +12077,7 @@ bif_exec (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
             }
         }
     }
+  PROC_SAVE_PARENT;
   warnings = sql_warnings_save (NULL);
   if (n_args < 8 || !ssl_is_settable (args[7]))
     { /* no cursor for stored procedures */
@@ -12095,12 +12120,12 @@ qr_set:
 	dk_free_box (text);
       dk_free_tree (list_to_array (proc_resultset));
       dk_free_tree ((caddr_t) proc_comp);
-      res = bif_exec_error (qst, args, err, warnings);
+      res = bif_exec_error (qst, args, err, warnings, shc, qr);
       goto done;
     }
   if (text != _text)
     dk_free_box (text);
-  named_pars = qr_have_named_params (qr);
+  named_pars = IS_BOX_POINTER(params) && qr_have_named_params (qr);
   new_params = make_qr_exec_params(params, named_pars);
 
   err = qr_exec(qi->qi_client, qr, qi, NULL, NULL, &lc,
@@ -12116,7 +12141,7 @@ qr_set:
       PROC_RESTORE_SAVED;
       dk_free_tree ((caddr_t) proc_comp);
       dk_free_tree (list_to_array (proc_resultset));
-      res = bif_exec_error (qst, args, err, warnings);
+      res = bif_exec_error (qst, args, err, warnings, shc, qr);
       goto done;
     }
 
@@ -12162,7 +12187,7 @@ qr_set:
 	      if (DV_TYPE_OF (qst_get (qst, args[7])) != DV_DB_NULL)
 		{
 		  res = bif_exec_error (qst, args,
-		      srv_make_new_error ("22005", "SR078", "The cursor parameter is not settable"), warnings);
+		      srv_make_new_error ("22005", "SR078", "The cursor parameter is not settable"), warnings, shc, qr);
 		  goto done;
 		}
 	    }
@@ -12188,7 +12213,7 @@ qr_set:
 		  dk_free_tree (list_to_array (rlist));
 		  lc_free (lc);
 		  res = bif_exec_error (qst, args,
-		      srv_make_new_error ("22023", "SR078", "The result set is too long, must limit result for at most %lu rows", (unsigned long) MAX_BOX_ELEMENTS), warnings);
+		      srv_make_new_error ("22023", "SR078", "The result set is too long, must limit result for at most %lu rows", (unsigned long) MAX_BOX_ELEMENTS), warnings, shc, qr);
 		  goto done;
 		}
 	    }
@@ -12203,7 +12228,7 @@ qr_set:
       lc_free (lc);
       if (err)
 	{
-	  res = bif_exec_error (qst, args, err, warnings);
+	  res = bif_exec_error (qst, args, err, warnings, shc, qr);
 	  goto done;
 	}
     }
@@ -12246,7 +12271,7 @@ qr_set:
 	  lc_free (lc);
 	  if (err)
 	    {
-	      res = bif_exec_error (qst, args, err, warnings);
+	      res = bif_exec_error (qst, args, err, warnings, shc, qr);
 	      goto done;
 	    }
 	}
@@ -12314,7 +12339,7 @@ bif_exec_metadata (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 
   if (err)
     {
-      return (bif_exec_error (qst, args, err, NULL));
+      return (bif_exec_error (qst, args, err, NULL, NULL, NULL));
     }
 
   if (qr->qr_select_node)
@@ -12384,7 +12409,7 @@ bif_exec_score (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 
   if (err)
     {
-      return (bif_exec_error (qst, args, err, NULL));
+      return (bif_exec_error (qst, args, err, NULL, NULL, NULL));
     }
   return (box_float (score));
 }
@@ -12403,11 +12428,11 @@ bif_exec_next (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 
   if (n_args < 4)
   return bif_exec_error (qst, args,
-	srv_make_new_error ("22023", "SR079", "Too few arguments to exec_next(cursor, state, message, row)"), NULL);
+	srv_make_new_error ("22023", "SR079", "Too few arguments to exec_next(cursor, state, message, row)"), NULL, NULL, NULL);
 
   if (DV_TYPE_OF (handle) != DV_EXEC_CURSOR || BOX_ELEMENTS(handle) != 3)
   return bif_exec_error (qst, args,
-	srv_make_new_error ("22023", "SR080", "Parameter 4 is not a valid local exec handle"), NULL);
+	srv_make_new_error ("22023", "SR080", "Parameter 4 is not a valid local exec handle"), NULL, NULL, NULL);
 
   qr = (query_t *) handle[0];
   lc = (local_cursor_t *) handle[1];
@@ -12419,7 +12444,7 @@ bif_exec_next (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
     lc->lc_error = NULL;
     if (err)
   {
-	  return (bif_exec_error (qst, args, err, NULL));
+	  return (bif_exec_error (qst, args, err, NULL, NULL, NULL));
   }
     else
     return (box_num(SQL_NO_DATA_FOUND));
@@ -12450,7 +12475,7 @@ bif_exec_close (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 
   if (DV_TYPE_OF (handle) != DV_EXEC_CURSOR || BOX_ELEMENTS(handle) != 3)
   return bif_exec_error (qst, args,
-	srv_make_new_error ("22023", "SR081", "Parameter 1 is not a valid local exec handle"), NULL);
+	srv_make_new_error ("22023", "SR081", "Parameter 1 is not a valid local exec handle"), NULL, NULL, NULL);
 
   qr = (query_t *) handle[0];
   lc = (local_cursor_t *) handle[1];
@@ -14139,7 +14164,7 @@ sql_bif_init (void)
 /* For debugging */
   bif_define_typed ("dbg_printf", bif_dbg_printf, &bt_varchar);
   bif_define ("dbg_obj_print", bif_dbg_obj_print);
-  bif_define ("dbg_obj_princ", bif_dbg_obj_princ);
+  bif_define ("dbg_obj_princ", bif_dbg_obj_princ); bif_set_uses_index (bif_dbg_obj_princ);
   bif_define ("dbg_obj_prin1", bif_dbg_obj_princ);
   bif_define ("dbg_obj_print_vars", bif_dbg_obj_print_vars);
   bif_define ("__cache_check", bif_cache_check);
@@ -14591,6 +14616,7 @@ sql_bif_init (void)
 #endif
 #ifdef _IMSG
   bif_pop3_init ();
+  bif_imap_init ();
   bif_nntp_init ();
 #endif
 #ifdef VIRTTP
diff --git a/libsrc/Wi/sqlbif.h b/libsrc/Wi/sqlbif.h
index f05c230..46a1d1a 100644
--- a/libsrc/Wi/sqlbif.h
+++ b/libsrc/Wi/sqlbif.h
@@ -1,7 +1,7 @@
 /*
  *  sqlbif.h
  *
- *  $Id: sqlbif.h,v 1.29.2.9 2010/02/01 12:53:45 source Exp $
+ *  $Id: sqlbif.h,v 1.29.2.11 2011/01/11 13:18:43 source Exp $
  *
  *  SQL Built In Functions
  *
@@ -114,7 +114,7 @@ caddr_t bif_date_string (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 
 int bif_is_relocatable (bif_t bif);
 double bif_double_or_null_arg (caddr_t * qst, state_slot_t ** args, int nth, const char *func, int * isnull);
-caddr_t * bif_array_of_pointer_arg (caddr_t * qst, state_slot_t ** args, int nth, const char *func);
+EXE_EXPORT (caddr_t *, bif_array_of_pointer_arg, (caddr_t * qst, state_slot_t ** args, int nth, const char *func));
 
 
 extern bif_type_t bt_varchar;
@@ -171,6 +171,7 @@ caddr_t bif_curdatetime (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 long get_mime_part (int *rfc822, caddr_t szMessage, long message_size, long offset,
     char *szBoundry, char *szType, size_t max_szType,
     caddr_t ** _result, long to_add);
+caddr_t mime_parse_header (int *rfc822, caddr_t szMessage, long message_size, long offset);
 
 #define MIME_POST_LIMIT 10000000
 #define MIME_SESSION_LIMIT 5000000
diff --git a/libsrc/Wi/sqlbif2.c b/libsrc/Wi/sqlbif2.c
index fce1e34..c454aff 100644
--- a/libsrc/Wi/sqlbif2.c
+++ b/libsrc/Wi/sqlbif2.c
@@ -1,7 +1,7 @@
 /*
  *  sqlbif2.c
  *
- *  $Id: sqlbif2.c,v 1.31.2.9 2010/03/08 12:04:13 source Exp $
+ *  $Id: sqlbif2.c,v 1.31.2.14 2010/12/09 09:53:13 source Exp $
  *
  *  SQL Built In Functions. Part 2
  *
@@ -765,6 +765,16 @@ bif_client_attr (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return NULL;
 }
 
+static caddr_t
+bif_query_instance_id (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  query_instance_t * qi = (query_instance_t *) qst;
+  long depth = bif_long_range_arg (qst, args, 0, "query_instance_id", 0, 0xffff);
+  while ((depth-- > 0) && (NULL != qi)) qi = qi->qi_caller;
+  if (NULL == qi)
+    return NEW_DB_NULL;
+  return box_num ((ptrlong)qi);
+}
 
 static caddr_t
 bif_sql_warnings_resignal (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
@@ -894,7 +904,7 @@ rfc1808_parse_uri (const char *iri, rdf1808_split_t *split_ret)
       const char *scan = iri;
       while (scan <  delim)
         {
-          if (!isalnum (scan[0]) && (NULL == strchr ("+-.", scan[0])))
+          if (!isalnum ((unsigned char) (scan[0])) && (NULL == strchr ("+-.", scan[0])))
             goto schema_done;
           scan++;
         }
@@ -973,7 +983,7 @@ rfc1808_parse_wide_uri (const wchar_t *iri, rdf1808_split_t *split_ret)
         {
           if (scan[0] & ~0x7f)
             goto schema_done;
-          if (!isalnum (scan[0]) && (NULL == strchr ("+-.", ((char *)scan)[0])))
+          if (!isalnum ((unsigned char) (scan[0])) && (NULL == strchr ("+-.", ((char *)scan)[0])))
             goto schema_done;
           scan++;
         }
@@ -1396,6 +1406,157 @@ bif_rfc1808_expand_uri (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return box_copy (res);
 }
 
+static caddr_t
+bif_patch_restricted_xml_chars (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+#define o 0
+static char restricted_xml_chars[0x80] = {
+/*0 1 2 3 4 5 6 7 8 9 A B C D E F */
+  3,3,3,3,3,3,3,3,3,5,5,3,3,5,3,3,
+/*0 1 2 3 4 5 6 7 8 9 A B C D E F */
+  3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
+/*  ! " # $ % & ' ( ) * + , - . / */
+  o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,
+/*0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
+  o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,
+/*@ A B C D E F G H I J K L M N O */
+  o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,
+/*P Q R S T U V W X Y Z [ \ ] ^ _ */
+  o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,
+/*` a b c d e f g h i j k l m n o */
+  o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,
+/*p q r s t u v w x y z { | } ~   */
+  o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o };
+#undef o
+  caddr_t src = bif_string_or_uname_or_wide_or_null_arg (qst, args, 0, "patch_restricted_xml_chars");
+  int add_percents = bif_long_arg (qst, args, 1, "patch_restricted_xml_chars");
+  dtp_t src_dtp;
+  int src_box_length;
+  int weird_char_ctr = 0;
+  caddr_t dest_to_swap;
+  if (NULL == src)
+    return NULL;
+  src_dtp = DV_TYPE_OF (src);
+  src_box_length = box_length (src);
+  if (!SSL_IS_REFERENCEABLE (args[0]))
+    sqlr_new_error ("22023", "SR642", "The first argument of patch_restricted_xml_chars() should be a variable, not a constant or an expression");
+  if (DV_WIDE == src_dtp)
+    {
+      wchar_t *tail = (wchar_t *)src;
+      wchar_t *end = ((wchar_t *)(src + src_box_length)) - 1;
+      wchar_t *dest, *dest_tail;
+      if (add_percents)
+        {
+          for (;tail < end; tail++)
+            {
+              if (tail[0] & ~0x7F)
+                continue;
+              if (restricted_xml_chars[tail[0]])
+                weird_char_ctr++;
+            }
+          if (0 == weird_char_ctr)
+            return NULL;
+          dest = dest_tail = dk_alloc_box ((sizeof (wchar_t) * 2 * weird_char_ctr) + src_box_length, src_dtp);
+          dest_to_swap = (caddr_t) dest;
+          for (tail = (wchar_t *)src; tail < end; tail++)
+            {
+              if ((tail[0] & ~0x7F) || (0 == restricted_xml_chars[(unsigned)(tail[0])]))
+                (dest_tail++)[0] = tail[0];
+              else
+                {
+                  (dest_tail++)[0] = '%';
+                  (dest_tail++)[0] = "0123456789ABCDEF"[(tail[0] >> 4) & 0xf];
+                  (dest_tail++)[0] = "0123456789ABCDEF"[tail[0] & 0xf];
+                }
+            }
+          dest_tail[0] = 0;
+        }
+      else
+        {
+          for (;tail < end; tail++)
+            {
+              if (tail[0] & ~0x7F)
+                continue;
+              if (restricted_xml_chars[tail[0]] & 2)
+                tail[0] = ' ';
+            }
+          return NULL;
+        }
+    }
+  else
+    {
+      char *tail = src;
+      char *end = src + src_box_length - 1;
+      char *dest, *dest_tail;
+      int dest_box_len;
+      if (add_percents)
+        {
+          for (;tail < end; tail++)
+            {
+              if (tail[0] & ~0x7F)
+                continue;
+              if (restricted_xml_chars[(unsigned)(tail[0])])
+                weird_char_ctr++;
+            }
+          if (0 == weird_char_ctr)
+            return NULL;
+          dest_box_len = (2 * weird_char_ctr) + src_box_length;
+          dest_to_swap = dest = dest_tail = dk_alloc_box (dest_box_len, (DV_UNAME == src_dtp) ? DV_STRING : src_dtp);
+          for (tail = src; tail < end; tail++)
+            {
+              if ((tail[0] & ~0x7F) || (0 == restricted_xml_chars[(unsigned)(tail[0])]))
+                (dest_tail++)[0] = tail[0];
+              else
+                {
+                  (dest_tail++)[0] = '%';
+                  (dest_tail++)[0] = "0123456789ABCDEF"[(tail[0] >> 4) & 0xf];
+                  (dest_tail++)[0] = "0123456789ABCDEF"[tail[0] & 0xf];
+                }
+            }
+          dest_tail[0] = 0;
+          if (DV_UNAME == src_dtp)
+            {
+              dest_to_swap = box_dv_uname_nchars (dest, dest_box_len - 1);
+              dk_free_tree (dest);
+            }
+        }
+      else
+        {
+          if (DV_UNAME == src_dtp)
+            {
+              for (;tail < end; tail++)
+                {
+                  if (tail[0] & ~0x7F)
+                    continue;
+                  if (restricted_xml_chars[(unsigned)(tail[0])])
+                    weird_char_ctr++;
+                }
+              if (0 == weird_char_ctr)
+                return NULL;
+              tail = src = box_dv_short_nchars (src, src_box_length - 1);
+              end = src + src_box_length - 1;
+            }
+          for (;tail < end; tail++)
+            {
+              if (tail[0] & ~0x7F)
+                continue;
+              if (restricted_xml_chars[(unsigned)(tail[0])] & 2)
+                tail[0] = ' ';
+            }
+          if (DV_UNAME == src_dtp)
+            {
+              dest_to_swap = box_dv_uname_nchars (src, src_box_length - 1);
+              dk_free_tree (src);
+            }
+          else
+            return NULL;
+        }
+    }
+  qst_swap (qst, args[0], &dest_to_swap);
+  dk_free_tree (dest_to_swap);
+  return NULL;
+}
+
 
 
 /*
@@ -1434,6 +1595,14 @@ bif_format_number (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return res;
 }
 
+
+static caddr_t
+bif_this_server (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  return NEW_DB_NULL;
+}
+
+
 void
 sqlbif2_init (void)
 {
@@ -1452,6 +1621,7 @@ sqlbif2_init (void)
   bif_define_typed ("user_has_role", bif_user_has_role, &bt_integer);
   bif_define_typed ("user_is_dba", bif_user_is_dba, &bt_integer);
   bif_define_typed ("client_attr", bif_client_attr, &bt_integer);
+  bif_define_typed ("query_instance_id", bif_query_instance_id, &bt_integer);
   bif_define ("sql_warning", bif_sql_warning);
   bif_define ("sql_warnings_resignal", bif_sql_warnings_resignal);
   bif_define_typed ("__sec_uid_to_user", bif_sec_uid_to_user, &bt_varchar);
@@ -1459,8 +1629,10 @@ sqlbif2_init (void)
   bif_define ("zorder_index", bif_zorder_index);
   bif_define ("rfc1808_parse_uri", bif_rfc1808_parse_uri);
   bif_define ("rfc1808_expand_uri", bif_rfc1808_expand_uri);
+  bif_define ("patch_restricted_xml_chars", bif_patch_restricted_xml_chars);
   bif_define_typed ("format_number", bif_format_number, &bt_varchar);
   bif_define ("__stop_cpt", bif_stop_cpt);
+  bif_define ("repl_this_server", bif_this_server);
   /*sqls_bif_init ();*/
   sqls_bif_init ();
   sqlo_inv_bif_int ();
diff --git a/libsrc/Wi/sqlcmps.h b/libsrc/Wi/sqlcmps.h
index 0b0bcc2..7f14c1e 100644
--- a/libsrc/Wi/sqlcmps.h
+++ b/libsrc/Wi/sqlcmps.h
@@ -1,7 +1,7 @@
 /*
  *  sqlcmps.h
  *
- *  $Id: sqlcmps.h,v 1.14.2.10 2010/02/01 13:08:57 source Exp $
+ *  $Id: sqlcmps.h,v 1.14.2.11 2010/11/15 16:51:56 source Exp $
  *
  *  SQL Compiler Data Structures
  *
@@ -526,7 +526,7 @@ void sqlc_meta_data_hook (sql_comp_t * sc, ST * tree);
 void sqlc_proc_table_cols (sql_comp_t * sc, comp_table_t * ct);
 
 void sqlc_top_select_dt (sql_comp_t * sc, ST * tree);
-ST ** sqlc_selection_names (ST * tree);
+ST ** sqlc_selection_names (ST * tree, int only_edit_tree);
 
 #define P_NO_MATCH 0
 #define P_EXACT 1
diff --git a/libsrc/Wi/sqlcomp2.c b/libsrc/Wi/sqlcomp2.c
index 8b84f6e..67d210c 100644
--- a/libsrc/Wi/sqlcomp2.c
+++ b/libsrc/Wi/sqlcomp2.c
@@ -1,7 +1,7 @@
 /*
  *  sqlcomp2.c
  *
- *  $Id: sqlcomp2.c,v 1.21.2.7 2010/04/07 19:25:24 source Exp $
+ *  $Id: sqlcomp2.c,v 1.21.2.9 2010/10/29 14:12:27 source Exp $
  *
  *  Dynamic SQL Compiler, part 2
  *
@@ -1305,37 +1305,6 @@ sqlc_assign_unknown_dtps (query_t *qr)
 }
 
 
-int
-qr_proc_repl_check_valid (query_t *qr, caddr_t *err)
-{
-  if (qr->qr_proc_repl_acct)
-    { /* check and disable procedures with INOUT / OUT parameters */
-      int inx = 1;
-      DO_SET (state_slot_t *, ssl, &qr->qr_parms)
-	{
-	  if (ssl->ssl_type == SSL_REF_PARAMETER_OUT ||
-	      ssl->ssl_type == SSL_REF_PARAMETER)
-	    {
-	      if (err)
-		*err = srv_make_new_error ("42000", "SQ205",
-		    "Procedure %s cannot be published for transactional replication "
-		    "(in publication %s) because it has out/inout parameter %s (parameter number %d). "
-		    "Publishing the calls to the procedure is disabled. "
-		    "Please remove the procedure from the transactional publication.",
-		    qr->qr_proc_name,
-		    qr->qr_proc_repl_acct,
-		    ssl->ssl_name ? ssl->ssl_name : "",
-		    inx
-		    );
-	      qr->qr_proc_repl_acct = NULL;
-	      return 0;
-	    }
-	  inx = inx + 1;
-	}
-      END_DO_SET ();
-    }
-  return 1;
-}
 
 static int
 sql_is_ddl (sql_tree_t * tree)
@@ -1576,6 +1545,7 @@ DBG_NAME(sql_compile_1) (DBG_PARAMS const char *string2, client_connection_t * c
 	  {
 	    qr->qr_line_counts = hash_table_allocate (100);
 	    qr->qr_call_counts = id_str_hash_create (101);
+	    qr->qr_stats_mtx = mutex_allocate ();
 	  }
 #endif
       }
@@ -1653,11 +1623,6 @@ DBG_NAME(sql_compile_1) (DBG_PARAMS const char *string2, client_connection_t * c
 	      sch_proc_def (sc.sc_cc->cc_schema, qr->qr_proc_name);
       user_t * p_user = cli->cli_user;
 
-#ifdef REPLICATION_SUPPORT2
-      if (old_place)
-	qr->qr_proc_repl_acct = old_place->qr_proc_repl_acct;
-      qr_proc_repl_check_valid (qr, err);
-#endif
       /* Only DBA can create procedures with owner different than creator */
       if (p_user && !sec_user_has_group (0, p_user->usr_g_id))
 	{
diff --git a/libsrc/Wi/sqlcost.c b/libsrc/Wi/sqlcost.c
index 8a77520..7127eb6 100644
--- a/libsrc/Wi/sqlcost.c
+++ b/libsrc/Wi/sqlcost.c
@@ -1,7 +1,7 @@
 /*
  *  sqlcost.c
  *
- *  $Id: sqlcost.c,v 1.30.2.24 2010/04/06 14:43:57 source Exp $
+ *  $Id: sqlcost.c,v 1.30.2.30 2011/03/03 11:56:44 source Exp $
  *
  *  sql cost functions
  *
@@ -524,7 +524,7 @@ dfe_pred_body_cost (df_elt_t **body, float * unit_ret, float * arity_ret, float
   else if (IS_BOX_POINTER (body))
     {
       df_elt_t *pred = (df_elt_t *) body;
-      if (pred->dfe_type == DFE_BOP_PRED || pred->dfe_type == DFE_BOP)
+      if (pred->dfe_type == DFE_BOP_PRED || (pred->dfe_type == DFE_BOP && pred->_.bin.op >= BOP_EQ && pred->_.bin.op <= BOP_GTE))
 	sqlo_pred_unit (pred, NULL, unit_ret, arity_ret);
       else
 	dfe_unit_cost ((df_elt_t *) body, 1, unit_ret, arity_ret, overhead_ret);
@@ -901,6 +901,9 @@ sqlo_rdf_obj_const_value (ST * tree, caddr_t * val_ret, caddr_t *lang_ret)
       && DV_STRINGP (tree->_.call.name) && nc_strstr ((dtp_t*)tree->_.call.name, (dtp_t*)"obj_of_sqlval")
       && DV_ARRAY_OF_POINTER != DV_TYPE_OF (tree->_.call.params[0]))
     {
+      dtp_t dtp = DV_TYPE_OF (tree->_.call.params[0]);
+      if (DV_SYMBOL == dtp)
+	return 0;
       if (val_ret)
 	*val_ret = (caddr_t) tree->_.call.params[0];
       return RDF_UNTYPED;
@@ -909,6 +912,9 @@ sqlo_rdf_obj_const_value (ST * tree, caddr_t * val_ret, caddr_t *lang_ret)
       && DV_STRINGP (tree->_.call.name) && nc_strstr ((dtp_t*)tree->_.call.name, (dtp_t*)"RDF_MAKE_OBJ_OF_TYPEDSQLVAL")
       && DV_STRINGP (tree->_.call.params[0]))
     {
+      dtp_t dtp = DV_TYPE_OF (tree->_.call.params[0]);
+      if (DV_SYMBOL == dtp)
+	return 0;
       if (val_ret)
 	*val_ret = (caddr_t) tree->_.call.params[0];
       if (lang_ret)
@@ -1008,6 +1014,7 @@ sample_search_param_cast (it_cursor_t * itc, search_spec_t * sp, caddr_t data)
 	  if (err)
 	    {
 	      dk_free_tree (err);
+	      dk_free_box (data);
 	      return KS_CAST_UNDEF;
 	    }
 	  ITC_SEARCH_PARAM (itc, any_data);
@@ -1067,11 +1074,12 @@ sample_search_param_cast (it_cursor_t * itc, search_spec_t * sp, caddr_t data)
   DTP_NORMALIZE (target_dtp);
   if (IS_UDT_DTP (target_dtp))
     return KS_CAST_NULL;
-  else if (dtp == target_dtp)
+  if (dtp == target_dtp)
     {
       ITC_SEARCH_PARAM (itc, data);
+      return KS_CAST_OK;
     }
-  else if (DV_ANY == target_dtp)
+  if (DV_ANY == target_dtp)
     {
       data = box_to_any (data, &err);
       if (err)
@@ -1083,37 +1091,36 @@ sample_search_param_cast (it_cursor_t * itc, search_spec_t * sp, caddr_t data)
       ITC_OWNS_PARAM (itc, data);
       return KS_CAST_OK;
     }
-  else
-    {
       if (IS_BLOB_DTP (target_dtp))
 	return KS_CAST_NULL;
-
-      if (IS_NUM_DTP (dtp) && IS_NUM_DTP (target_dtp))
-	{
-	  /* compare different number types.  If col more precise than arg, cast to col here, otherwise the cast is in itc_col_check */
 	  switch (target_dtp)
 	    {
+/* compare different number types.  If col more precise than arg, cast to col here, otherwise the cast is in itc_col_check */
 	    case DV_LONG_INT:
+      if (!IS_NUM_DTP (dtp))
+        break;
 	      ITC_SEARCH_PARAM (itc, data); /* all are more precise, no cast down */
-	      return 0;
+      return KS_CAST_OK;
 	    case DV_SINGLE_FLOAT:
-	      if (DV_LONG_INT == dtp)
-		goto cast_param_up;
+      if ((DV_LONG_INT == dtp) || (!IS_NUM_DTP (dtp)))
+        break;
 	      ITC_SEARCH_PARAM (itc, data);
-	      return 0;
+      return KS_CAST_OK;
 	    case DV_DOUBLE_FLOAT:
-	      goto cast_param_up;
+      break;
 	    case DV_NUMERIC:
 	      if (DV_DOUBLE_FLOAT == dtp)
 		{
 		  ITC_SEARCH_PARAM (itc, data);
-		  return 0;
-		}
-	      goto cast_param_up;
+          return KS_CAST_OK;
 	    }
-	  return 0;
+      break;
+    case DV_DATE:
+      if (DV_DATETIME != dtp)
+        break;
+      ITC_SEARCH_PARAM (itc, data);
+      return KS_CAST_OK;
 	}
-    cast_param_up:
       data = box_cast_to (NULL, data, dtp, target_dtp,
 			  sp->sp_cl.cl_sqt.sqt_precision, sp->sp_cl.cl_sqt.sqt_scale, &err);
       if (err)
@@ -1123,7 +1130,6 @@ sample_search_param_cast (it_cursor_t * itc, search_spec_t * sp, caddr_t data)
 	}
       ITC_SEARCH_PARAM (itc, data);
       ITC_OWNS_PARAM (itc, data);
-    }
   return KS_CAST_OK;
 }
 
@@ -1230,8 +1236,10 @@ typedef struct sample_opt_s
   caddr_t *		sop_sc_key_ret;
   char			sop_is_cl;
   char			sop_res_from_ric_cache;
+  char			sop_use_sc_cache;
 } sample_opt_t;
 
+extern rdf_inf_ctx_t * empty_ric;
 
 #define SMPL_QUEUE 1
 #define SMPL_RESULT 2
@@ -1306,7 +1314,7 @@ sqlo_inx_sample_1 (dbe_key_t * key, df_elt_t ** lowers, df_elt_t ** uppers, int
   itc_free (itc);
   tb_count = dbe_key_count (key->key_table->tb_primary_key);
   res = MIN (tb_count, res);
-  if (!sop || !sop->sop_ric)
+  if (!sop || sop->sop_ric || sop->sop_use_sc_cache)
     {
       num = box_num (res);
       if (so->so_sc->sc_sample_cache)
@@ -1315,6 +1323,20 @@ sqlo_inx_sample_1 (dbe_key_t * key, df_elt_t ** lowers, df_elt_t ** uppers, int
   return res;
 }
 
+
+void
+ric_set_sample (rdf_inf_ctx_t * ctx, caddr_t sc_key, int64 est)
+{
+  text_count_t tc;
+  memset (&tc, 0, sizeof (tc));
+  tc.tc_estimate = est;
+  tc.tc_time = approx_msec_real_time ();
+  mutex_enter (ctx->ric_mtx);
+  id_hash_set (ctx->ric_samples, (caddr_t)&sc_key, (caddr_t)&tc);
+  mutex_leave (ctx->ric_mtx);
+}
+
+
 extern caddr_t rdfs_type;
 
 
@@ -1378,13 +1400,7 @@ ri_iterator_t * rit = ri_iterator (sub, ic->ic_inf_type, 1);
     {
       if (any_est)
 	{
-	  text_count_t tc;
-	  memset (&tc, 0, sizeof (tc));
-	  tc.tc_estimate = est;
-	  tc.tc_time = approx_msec_real_time ();
-	  mutex_enter (sop.sop_ric->ric_mtx);
-	  id_hash_set (ctx->ric_samples, (caddr_t)&sc_key, (caddr_t)&tc);
-	  mutex_leave (sop.sop_ric->ric_mtx);
+	  ric_set_sample (sop.sop_ric, sc_key, est);
 	}
       else
 	dk_free_tree (sc_key);
@@ -1435,7 +1451,10 @@ sqlo_non_leading_const_inf_cost (df_elt_t * tb_dfe, df_elt_t ** lowers, df_elt_t
       ST * org_o = NULL, * org_p = NULL;
       for (inx = 0; inx < ic->ic_leading_constants; inx++)
 	{
-	  dbe_column_t * left_col = cp_left_col (lowers[inx]);
+	  dbe_column_t * left_col;
+	  if (!lowers[inx])
+	    break;
+	  left_col = cp_left_col (lowers[inx]);
 	  switch (left_col->col_name[0])
 	    {
 	    case 'P': p_dfe = lowers[inx]->_.bin.right; org_p = p_dfe->dfe_tree; break;
@@ -1478,6 +1497,8 @@ sqlo_non_leading_const_inf_cost (df_elt_t * tb_dfe, df_elt_t ** lowers, df_elt_t
 	  ic->ic_inf_type = RI_SUBCLASS;
 	  ic->ic_inf_dfe = o_dfe_2;
 	  ic->ic_n_lookups = rs_sub_count (sub);
+	  dk_free_box (p_const);
+	  dk_free_box (o_const);
 	  return;
 	}
       if (p_const && (sub = ric_iri_to_sub (ctx, p_const, RI_SUBPROPERTY, 0))
@@ -1487,8 +1508,12 @@ sqlo_non_leading_const_inf_cost (df_elt_t * tb_dfe, df_elt_t ** lowers, df_elt_t
 	  ic->ic_inf_dfe = p_dfe_2;
 	  ic->ic_inf_type = RI_SUBPROPERTY;
 	  ic->ic_n_lookups = rs_sub_count (sub);
+	  dk_free_box (p_const);
+	  dk_free_box (o_const);
 	  return;
 	}
+      dk_free_box (p_const);
+      dk_free_box (o_const);
     }
   return;
 }
@@ -1546,13 +1571,30 @@ int64
 sqlo_inx_sample (df_elt_t * tb_dfe, dbe_key_t * key, df_elt_t ** lowers, df_elt_t ** uppers, int n_parts, index_choice_t * ic)
 {
   rdf_inf_ctx_t * ctx = ic->ic_ric;
-  if (ctx && 0 == stricmp ("DB.DBA.RDF_QUAD", tb_dfe->_.table.ot->ot_table->tb_name))
+  if (0 == stricmp ("DB.DBA.RDF_QUAD", tb_dfe->_.table.ot->ot_table->tb_name))
     {
       rdf_sub_t * sub;
       caddr_t p_const = NULL, o_const = NULL;
       int inx;
       df_elt_t * o_dfe = NULL, *p_dfe = NULL;
       ST * org_o = NULL, * org_p = NULL;
+      if (!ctx)
+	{
+	  int64 c;
+	  sample_opt_t sop;
+	  caddr_t sc_key = NULL;
+	  memset (&sop, 0, sizeof (sop));
+	  sop.sop_ric = empty_ric;
+	  sop.sop_sc_key_ret = &sc_key;
+	  c = sqlo_inx_sample_1 (key, lowers, uppers, n_parts, &sop);
+	  if (!sop.sop_res_from_ric_cache && c > 1000)
+	    {
+	      ric_set_sample (empty_ric, sc_key, c);
+	    }
+	  else
+	    dk_free_tree (sc_key);
+	  return c;
+	}
       for (inx = 0; inx < n_parts; inx++)
 	{
 	  dbe_column_t * left_col = cp_left_col (lowers[inx]);
@@ -1571,6 +1613,8 @@ sqlo_inx_sample (df_elt_t * tb_dfe, dbe_key_t * key, df_elt_t ** lowers, df_elt_
 	  /* the p is rdfstype and o given.  See about counts of subcs */
 	  ic->ic_inf_type = RI_SUBCLASS;
 	  ic->ic_inf_dfe = o_dfe;
+	  dk_free_box (p_const);
+	  dk_free_box (o_const);
 	  return sqlo_inx_inf_sample (tb_dfe, key, lowers, uppers, n_parts, ctx, sub, (caddr_t*)&o_dfe->dfe_tree, ic);
 	}
       if (p_const && (sub = ric_iri_to_sub (ctx, p_const, RI_SUBPROPERTY, 0))
@@ -1579,8 +1623,12 @@ sqlo_inx_sample (df_elt_t * tb_dfe, dbe_key_t * key, df_elt_t ** lowers, df_elt_
 	  /* the p is given and has subproperties */
 	  ic->ic_inf_dfe = p_dfe;
 	  ic->ic_inf_type = RI_SUBPROPERTY;
+	  dk_free_box (p_const);
+	  dk_free_box (o_const);
 	  return sqlo_inx_inf_sample (tb_dfe, key, lowers, uppers, n_parts, ctx, sub, (caddr_t*)&p_dfe->dfe_tree, ic);
 	}
+      dk_free_box (p_const);
+      dk_free_box (o_const);
     }
   ic->ic_n_lookups = 1;
   return sqlo_inx_sample_1 (key, lowers, uppers, n_parts, NULL);
@@ -1674,6 +1722,112 @@ sqlo_inx_intersect_cost (df_elt_t * tb_dfe, dk_set_t col_preds, dk_set_t group,
 }
 
 
+extern int enable_p_stat;
+
+caddr_t
+sqlo_const_iri (sqlo_t * so, df_elt_t * dfe)
+{
+  caddr_t name;
+  if ((name = sqlo_iri_constant_name (dfe->dfe_tree)))
+    {
+      return key_name_to_iri_id (NULL, name, 0);
+    }
+  return NULL;
+}
+
+
+void
+sqlo_rdf_col_card (sqlo_t * so, df_elt_t * tb_dfe, df_elt_t * dfe)
+{
+  int nth;
+  caddr_t p = NULL;
+  dbe_key_t * key = tb_dfe->_.table.key;
+  float * place;
+  if (!key || !key->key_p_stat)
+    return;
+  DO_SET (df_elt_t *, pred, &tb_dfe->_.table.col_preds)
+    {
+      dbe_column_t * left_col = DFE_BOP_PRED == pred->dfe_type && BOP_EQ == pred->_.bin.op
+	? (pred->_.bin.left->dfe_type == DFE_COLUMN ? pred->_.bin.left->_.col.col : NULL) : NULL;
+      if (!left_col || 'P'!= left_col->col_name[0])
+	continue;
+      p = sqlo_const_iri (so, pred->_.bin.right);
+      break;
+    }
+  END_DO_SET();
+  if (!p)
+    return;
+  mutex_enter (alt_ts_mtx);
+  place = (float*)id_hash_get (key->key_p_stat, (caddr_t)&((iri_id_t*)p)[0]);
+  dk_free_box (p);
+  if (!place)
+    {
+      mutex_leave (alt_ts_mtx);
+      return;
+    }
+  nth = 1;
+  DO_SET (dbe_column_t *, part, &key->key_parts->next)
+    {
+      if (part == dfe->_.col.col)
+	{
+	  dfe->_.col.card = place[nth];
+	  break;
+	}
+      nth++;
+    }
+  END_DO_SET();
+  mutex_leave (alt_ts_mtx);
+}
+
+
+
+int
+sqlo_use_p_stat (df_elt_t * dfe, df_elt_t ** lowers, int inx_const_fill, int64 est, float *inx_arity)
+{
+  /* if there is a sample with leading constant p and the rest variable, consult the key_p_stat for the p in question */
+  caddr_t p;
+  float * place;
+  dbe_key_t * key = dfe->_.table.key;
+  dbe_column_t * g_col;
+  df_elt_t * so_dfe, * g_dfe;
+  if (!enable_p_stat || 1 != inx_const_fill)
+    return 0;
+  if (!key->key_p_stat || 0 != strcmp (((dbe_column_t*)key->key_parts->data)->col_name, "P")
+      || !strstr (key->key_table->tb_name, "RDF_QUAD"))
+    return 0;
+  so_dfe = sqlo_key_part_best ((dbe_column_t*)key->key_parts->next->data, dfe->_.table.col_preds, 0);
+  g_dfe = NULL; /*sqlo_key_part_best (g_col,  dfe->_.table.col_preds, 0); */
+  if (!so_dfe || BOP_EQ != so_dfe->_.bin.op)
+    return 0;
+  p = dfe_iri_const (lowers[0]->_.bin.right);
+  if (!p)
+    return 0;
+  mutex_enter (alt_ts_mtx);
+  place = (float*)id_hash_get (key->key_p_stat, (caddr_t)&((iri_id_t*)p)[0]);
+  dk_free_box (p);
+  if (!place)
+    {
+      mutex_leave (alt_ts_mtx);
+      return 0;
+    }
+  *inx_arity = est / place[1];
+  mutex_leave (alt_ts_mtx);
+  if (key->key_parts->next->next)
+    {
+      dbe_column_t * p3 = (dbe_column_t*)key->key_parts->next->next->data;
+      df_elt_t * lower = sqlo_key_part_best (p3, dfe->_.table.col_preds, 0);
+      df_elt_t * upper = sqlo_key_part_best (p3, dfe->_.table.col_preds, 1);
+      float p_cost, p_arity;
+      if (lower || upper)
+	{
+	  sqlo_pred_unit (lower, upper, &p_cost, &p_arity);
+	  *inx_arity *= p_arity;
+	}
+    }
+  return 1;
+}
+
+
 int
 pred_const_rhs (df_elt_t * pred)
 {
@@ -1750,9 +1904,9 @@ dfe_table_cost_ic_1 (df_elt_t * dfe, index_choice_t * ic, int inx_only)
   float col_cost = (float) 0.12;
   float total_cost, total_arity;
   int is_indexed = 1;
-  df_elt_t * inx_uppers[5];
-  df_elt_t * inx_lowers[5];
-  int is_inx_const = 1, inx_const_fill = 0;
+  df_elt_t * inx_uppers[5] = {0,0,0,0,0};
+  df_elt_t * inx_lowers[5] = {0,0,0,0,0};
+  int is_inx_const = 1, inx_const_fill = 0, p_stat = 0;
   if (dfe->_.table.index_path)
     {
       dfe_table_ip_cost (dfe, ic);
@@ -1868,10 +2022,12 @@ dfe_table_cost_ic_1 (df_elt_t * dfe, index_choice_t * ic, int inx_only)
 	goto no_sample;
       else if (0 == inx_sample)
 	inx_arity = 0.01;
+      else if (sqlo_use_p_stat (dfe, inx_lowers, inx_const_fill, inx_sample, &inx_arity))
+	p_stat = 1;
       else
 	inx_arity = inx_sample * inx_arity / (inx_arity_guess_for_const_parts != -1 ? inx_arity_guess_for_const_parts : inx_arity);
       /* Consider if 2 first key parts are const and third is var.  Get the real arity for the const but do not forget the guess  for  the 3rd*/
-      ic->ic_leading_constants = dfe->_.table.is_arity_sure = inx_const_fill;
+      ic->ic_leading_constants = dfe->_.table.is_arity_sure = inx_const_fill * 2 + p_stat;
     no_sample: ;
     }
   if (unique && ic->ic_ric)
@@ -1922,7 +2078,6 @@ dfe_table_cost_ic_1 (df_elt_t * dfe, index_choice_t * ic, int inx_only)
 	}
       END_DO_SET();
     }
-  total_arity = arity_scale (total_arity);
   if (dfe->_.table.join_test)
     {
       dfe_pred_body_cost (dfe->_.table.join_test, &p_cost, &p_arity, overhead_ret);
@@ -1953,8 +2108,9 @@ dfe_table_cost_ic_1 (df_elt_t * dfe, index_choice_t * ic, int inx_only)
       *overhead_ret += fu1;
       total_cost = (float) HASH_LOOKUP_COST + HASH_ROW_COST * MAX (0,  total_arity - 1);
     }
-  total_cost += p_cost * total_arity;
+  total_cost += p_cost * arity_scale (total_arity);
   total_arity *= p_arity;
+  total_arity = arity_scale (total_arity);
   if (dfe->_.table.ot->ot_is_outer)
     total_arity = MAX (1, total_arity);
   /* the right of left outer has never cardinality < 1.  But the join tests etc are costed at cardinality that can be < 1. So adjust this as last.*/
@@ -2202,6 +2358,8 @@ dfe_exp_card (sqlo_t * so, df_elt_t * dfe)
   switch (dfe->dfe_type)
     {
     case DFE_COLUMN:
+      if (dfe->_.col.card)
+	return dfe->_.col.card;
       if (dfe->_.col.col)
 	return dfe->_.col.col->col_n_distinct;
       return 1000;
@@ -2307,12 +2465,15 @@ dfe_unit_cost (df_elt_t * dfe, float input_arity, float * u1, float * a1, float
 	}
       else
 	{
+	  dfe->_.setp.gb_card = dfe_group_by_card (dfe);
 	  if (dfe->_.setp.is_linear)
 	*u1 = 1;
+	  else if (dfe->_.setp.gb_card < 1000000 || input_arity < 1000000)
+	    *u1 = HASH_MEM_INS_COST;
       else
-	*u1 = (float) MAX (1, 1 + log (input_arity / *a1) / log (2));
-	  dfe->_.setp.gb_card = dfe_group_by_card (dfe);
-	  *a1 = dfe->_.setp.gb_card > input_arity ? 0.5 : dfe->_.setp.gb_card / input_arity;
+	    *u1 = (float) HASH_ROW_INS_COST;
+	  *a1 = input_arity < 1 ? 1
+	    : dfe->_.setp.gb_card > input_arity ? 0.5 : dfe->_.setp.gb_card / input_arity;
 	}
       break;
 
diff --git a/libsrc/Wi/sqlcr.c b/libsrc/Wi/sqlcr.c
index 31a861e..75d1e30 100644
--- a/libsrc/Wi/sqlcr.c
+++ b/libsrc/Wi/sqlcr.c
@@ -1,7 +1,7 @@
 /*
  *  sqlstmts.c
  *
- *  $Id: sqlcr.c,v 1.7.2.3 2010/02/18 10:57:16 source Exp $
+ *  $Id: sqlcr.c,v 1.7.2.4 2010/11/15 16:51:56 source Exp $
  *
  *  Dynamic SQL Statement Compilations
  *
@@ -596,7 +596,7 @@ sqlc_top_select_wrap_dt (sql_comp_t * sc, ST * tree)
   top = SEL_TOP (tree);
   if (top)
     {
-      ST * out_names = (ST *) sqlc_selection_names (tree);
+      ST * out_names = (ST *) sqlc_selection_names (tree, 0);
       ST ** oby = tree->_.select_stmt.table_exp->_.table_exp.order_by;
       if (oby)
 	{
diff --git a/libsrc/Wi/sqldf.c b/libsrc/Wi/sqldf.c
index e281966..0d528c7 100644
--- a/libsrc/Wi/sqldf.c
+++ b/libsrc/Wi/sqldf.c
@@ -1,7 +1,7 @@
 /*
  *  sqldf.c
  *
- *  $Id: sqldf.c,v 1.60.2.23 2010/03/24 01:00:09 source Exp $
+ *  $Id: sqldf.c,v 1.60.2.27 2011/02/14 11:48:50 source Exp $
  *
  *  sql expression dependencies and code layout
  *
@@ -1052,6 +1052,13 @@ sqlo_mark_oby_crossed (sqlo_t * so, df_elt_t * dfe)
 }
 
 
+void
+sqlo_dt_col_card (sqlo_t * so, df_elt_t * col_dfe, df_elt_t * exp)
+{
+  col_dfe->_.col.card += dfe_exp_card (so, exp);
+}
+
+
 df_elt_t *
 sqlo_dt_nth_col (sqlo_t * so, df_elt_t * super, df_elt_t * dt_dfe, int inx, df_elt_t * col_dfe, int is_qexp_term)
 {
@@ -1078,7 +1085,11 @@ sqlo_dt_nth_col (sqlo_t * so, df_elt_t * super, df_elt_t * dt_dfe, int inx, df_e
 	{
 	  df_elt_t * exp = sqlo_df (so, (ST*) dt_dfe->_.sub.ot->ot_dt->_.select_stmt.selection[inx]);
 	  if (exp)
+	    {
+	      if (!col_dfe->_.col.card)
+		sqlo_dt_col_card (so, col_dfe, exp);
 	    sqt_max_desc (&col_dfe->dfe_sqt, &exp->dfe_sqt);
+	    }
 	  col_dfe->dfe_locus = dt_dfe->dfe_locus;
 	  col_alias = ((ST**)(dt_dfe->_.sub.ot->ot_left_sel->_.select_stmt.selection))[inx]->_.as_exp.name;
 	  exp_alias = sqlo_df (so, (ST*) t_list (3, COL_DOTTED, dt_dfe->_.sub.ot->ot_new_prefix, col_alias));
@@ -1099,7 +1110,10 @@ sqlo_dt_nth_col (sqlo_t * so, df_elt_t * super, df_elt_t * dt_dfe, int inx, df_e
 	  sqlo_place_exp (so, dt_dfe, exp);
 	  sqlo_dfe_set_dt_exps_is_placed (so, dt_dfe->_.sub.ot, 0);
 	  if (exp)
+	    {
+	      sqlo_dt_col_card (so, col_dfe, exp);
 	    sqt_max_desc (&col_dfe->dfe_sqt, &exp->dfe_sqt);
+	    }
 	  if (so->so_place_code_forr_cond)
 	    sqlo_post_oby_ref (so, dt_dfe, exp, inx);
 
@@ -1181,8 +1195,11 @@ sqlo_place_col (sqlo_t * so, df_elt_t * super, df_elt_t * dfe)
     case DFE_TABLE:
       if (!dk_set_member (tb_dfe->_.table.out_cols, (void*) dfe))
 	{
+	  dfe->_.col.card = 0;
+	  dfe->_.col.is_fixed = 0;
 	  if (!dfe->_.col.vc)
 	    t_set_push (&tb_dfe->_.table.out_cols, (void*) dfe);
+	  sqlo_rdf_col_card (so, tb_dfe, dfe);
 	  if (HR_REF == tb_dfe->_.table.hash_role)
 	    {
 	      df_elt_t * old_pt = so->so_gen_pt;
@@ -3240,19 +3257,23 @@ sqlo_tb_place_contains_cols (sqlo_t *so, df_elt_t *tb_dfe, df_elt_t *pred)
 
 
 int
-is_call_only_dep_on (df_elt_t * dfe, op_table_t * ot)
+is_call_only_dep_on (df_elt_t * dfe, op_table_t * ot, int skip_first_n)
 {
-  int inx;
+  ST **args;
+  int argctr, argcount;
+#ifndef NDEBUG
   if (!ST_P (dfe->dfe_tree, CALL_STMT))
-    return 0;
+    GPF_T;
+#endif
   if (!(dfe->dfe_tables && !dfe->dfe_tables->next && dfe->dfe_tables->data == (void*) ot))
     return 0;
-  DO_BOX (ST *, arg, inx, dfe->dfe_tree->_.call.params)
+  args = dfe->dfe_tree->_.call.params;
+  argcount = BOX_ELEMENTS (args);
+  for (argctr = skip_first_n; argctr < argcount; argctr++)
     {
-      if (!ST_COLUMN (arg, COL_DOTTED))
+      if (!ST_COLUMN (args[argctr], COL_DOTTED))
 	return 0;
     }
-  END_DO_BOX;
   return  1;
 }
 
@@ -3291,32 +3312,113 @@ sqlo_make_inv_pred (sqlo_t * so, sinv_map_t * map, df_elt_t * left, df_elt_t * r
   *preds_ret = dk_set_conc (res, *preds_ret);
 }
 
+void
+sqlo_make_inv_sprintf (sqlo_t * so, const char *inv_name, df_elt_t * left, df_elt_t * right, dk_set_t * preds_ret)
+{
+  /* left is an invertible sprintf function call with columns as args, right is an exp. */
+  client_connection_t * cli = sqlc_client ();
+  dk_set_t res = NULL;
+  int inx_inv;
+  int col_ctr, col_count;
+  int old_top_and = so->so_is_top_and;
+  ST * left_tree = left->dfe_tree;
+  ST * right_tree = right->dfe_tree;
+  ST ** left_params = left_tree->_.call.params;
+  so->so_is_top_and = 0;
+  col_count = BOX_ELEMENTS (left_tree->_.call.params) - 1;
+  for (col_ctr = 0; col_ctr < col_count; col_ctr++)
+    {
+      ST *clause;
+      ST *new_left, *new_right;
+      new_left =
+	(ST *) t_box_copy_tree ((caddr_t)(left_params[col_ctr+1]));
+      new_right =
+	t_listst (3, CALL_STMT, t_sqlp_box_id_upcase ("aref"),
+	  t_listst (2,
+	    t_listst (3, CALL_STMT, t_sqlp_box_id_upcase (inv_name),
+	      t_list (3,
+		right_tree,
+		t_box_copy_tree ((caddr_t)(left_params[0])),
+		t_box_num (2) ) ),
+	    t_box_num_nonull (col_ctr) ) );
+      new_left = sinv_check_inverses (new_left, cli);
+      new_right = sinv_check_inverses (new_right, cli);
+      BIN_OP (clause, BOP_EQ, new_left, new_right);
+      clause = sinv_check_exp (so, clause);
+      t_set_push (&res, (void*) sqlo_df (so, clause));
+    }
+  so->so_is_top_and = old_top_and;
+  *preds_ret = dk_set_conc (res, *preds_ret);
+}
 
+int sprintff_is_proven_bijection (const char *f);
+
+static const char *
+sqlo_is_call_invertible_sprintf (ST *st)
+{
+  const char *ret = NULL;
+  caddr_t arg1;
+  if (casemode_strncmp (st->_.call.name, "__spf", 5))
+    return NULL;
+  if (!casemode_strcmp (st->_.call.name, "__spf"))
+    ret = "__spfinv";
+  else if (!casemode_strcmp (st->_.call.name, "__spfn"))
+    ret = "__spfinv";
+  else if (!casemode_strcmp (st->_.call.name, "__spfin"))
+    ret = "__spfinv";
+  if (NULL == ret)
+    return NULL;
+  if (2 > BOX_ELEMENTS (st->_.call.params))
+    return NULL;
+  arg1 = (caddr_t) st->_.call.params[0];
+  if (DV_STRING != DV_TYPE_OF (arg1))
+    return NULL;
+  if (!sprintff_is_proven_bijection (arg1))
+    return NULL;
+  return ret;
+}
+
+int
+sqlo_col_inverse_eq_1 (sqlo_t *so, df_elt_t * tb_dfe, df_elt_t *left, df_elt_t *right, dk_set_t * col_preds, dk_set_t * after_preds)
+{
+  sinv_map_t * map;
+  const char *inv;
+  if (is_call_only_dep_on (left, tb_dfe->_.table.ot, 0)
+      && !dk_set_member (right->dfe_tables, (void*) tb_dfe->_.table.ot)
+      && (map = sinv_call_map (left->dfe_tree, sqlc_client ())))
+    {
+      sqlo_make_inv_pred  (so, map, left, right, col_preds);
+      return 1;
+    }
+  inv = sqlo_is_call_invertible_sprintf (left->dfe_tree);
+  if ((NULL != inv) && is_call_only_dep_on (left, tb_dfe->_.table.ot, 1)
+      && !dk_set_member (right->dfe_tables, (void*) tb_dfe->_.table.ot) )
+    {
+      sqlo_make_inv_sprintf (so, inv, left, right, col_preds);
+      return 1;
+    }
+  return 0;
+}
 
 int
 sqlo_col_inverse  (sqlo_t *so, df_elt_t * tb_dfe, df_elt_t * pred, dk_set_t * col_preds, dk_set_t * after_preds)
 {
   /* if pred is f (c1,...cn) = exp independent of tb_dfe and inverse of f exists and c1...cn are cols of tb_dfe
   * then generate AND of inverses of f app,lied to exp, equated to each of c1...cn */
-  sinv_map_t * map;
   if (sqlo_solve (so, tb_dfe, pred, col_preds, after_preds))
     return 1;
   if (BOP_EQ != pred->_.bin.op)
     return 0;
 
   /* left if func of table and right is not of table ? */
-  if (is_call_only_dep_on (pred->_.bin.left, tb_dfe->_.table.ot)
-      && !dk_set_member (pred->_.bin.right->dfe_tables, (void*) tb_dfe->_.table.ot)
-      && (map = sinv_call_map (pred->_.bin.left->dfe_tree, sqlc_client ())))
+  if (ST_P (pred->_.bin.left->dfe_tree, CALL_STMT))
     {
-      sqlo_make_inv_pred  (so, map, pred->_.bin.left, pred->_.bin.right, col_preds);
+      if (sqlo_col_inverse_eq_1 (so, tb_dfe, pred->_.bin.left, pred->_.bin.right, col_preds, after_preds))
       return 1;
     }
-  else if (is_call_only_dep_on (pred->_.bin.left, tb_dfe->_.table.ot)
-      && !dk_set_member (pred->_.bin.right->dfe_tables, (void*) tb_dfe->_.table.ot)
-	   && (map = sinv_call_map (pred->_.bin.left->dfe_tree, sqlc_client ())))
+  if (ST_P (pred->_.bin.right->dfe_tree, CALL_STMT))
     {
-      sqlo_make_inv_pred  (so, map, pred->_.bin.right, pred->_.bin.left, col_preds);
+      if (sqlo_col_inverse_eq_1 (so, tb_dfe, pred->_.bin.right, pred->_.bin.left, col_preds, after_preds))
       return 1;
     }
   return 0;
diff --git a/libsrc/Wi/sqlexp.c b/libsrc/Wi/sqlexp.c
index 4d25175..c45ad1d 100644
--- a/libsrc/Wi/sqlexp.c
+++ b/libsrc/Wi/sqlexp.c
@@ -1,7 +1,7 @@
 /*
  *  sqlexp.c
  *
- *  $Id: sqlexp.c,v 1.16.2.21 2010/04/26 14:41:41 source Exp $
+ *  $Id: sqlexp.c,v 1.16.2.23 2011/02/15 14:45:35 source Exp $
  *
  *  Dynamic SQL Expression Generator
  *
@@ -375,6 +375,7 @@ sqlc_check_const_call (sql_comp_t * sc, ST * tree)
 	  dk_free_box (data);
 	  return ssl;
 	}
+      dk_free_box (data);
     }
   return NULL;
 }
@@ -481,7 +482,7 @@ sqlc_simple_case (sql_comp_t * sc, ST * tree, dk_set_t * code)
   int was_else = 0;
   jmp_label_t end = sqlc_new_label (sc);
   int n_exps = BOX_ELEMENTS (tree->_.comma_exp.exps);
-  state_slot_t *res = sqlc_new_temp (sc, "callret", DV_UNKNOWN);
+  state_slot_t *res = sqlc_new_temp (sc, "callretSimpleCASE", DV_UNKNOWN);
   state_slot_t *sel;
   int inx;
   ST **exps = tree->_.comma_exp.exps;
@@ -546,7 +547,7 @@ sqlc_searched_case (sql_comp_t * sc, ST * tree, dk_set_t * code)
   int was_else = 0;
   jmp_label_t end = sqlc_new_label (sc);
   int n_exps = BOX_ELEMENTS (tree->_.comma_exp.exps);
-  state_slot_t *res = sqlc_new_temp (sc, "callret", DV_UNKNOWN);
+  state_slot_t *res = sqlc_new_temp (sc, "callretSearchedCASE", DV_UNKNOWN);
   int inx;
   ST **exps = tree->_.comma_exp.exps;
   df_elt_t *dfe = sc->sc_so ? sqlo_df (sc->sc_so, tree) : NULL;
@@ -745,7 +746,10 @@ scalar_exp_generate (sql_comp_t * sc, ST * tree, dk_set_t * code)
 	state_slot_t *res = sqlc_check_const_call (sc, tree);
 	if (res)
 	  seg_return (res);
-	res = sqlc_new_temp (sc, "callret", DV_UNKNOWN);
+	if (NULL != tree->_.call.name)
+	  res = sqlc_new_temp (sc, tree->_.call.name, DV_UNKNOWN);
+	else
+	  res = sqlc_new_temp (sc, "callret", DV_UNKNOWN);
 	res->ssl_is_callret = 1;
 	tree = sqlo_udt_check_method_call (sc->sc_so, sc, tree);
 	sqlc_call_exp (sc, code, res, tree);
diff --git a/libsrc/Wi/sqlfn.h b/libsrc/Wi/sqlfn.h
index 7b59701..70545d8 100644
--- a/libsrc/Wi/sqlfn.h
+++ b/libsrc/Wi/sqlfn.h
@@ -1,7 +1,7 @@
 /*
  *  sqlfn.h
  *
- *  $Id: sqlfn.h,v 1.46.2.10 2010/02/10 11:03:59 source Exp $
+ *  $Id: sqlfn.h,v 1.46.2.13 2011/02/15 10:11:40 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -388,11 +388,12 @@ extern server_lock_t server_lock;
 
 void plh_free (placeholder_t * plh);
 
-caddr_t srv_make_new_error (const char *code, const char *virt_code, const char *msg,...)
+EXE_EXPORT (caddr_t, srv_make_new_error, (const char *code, const char *virt_code, const char *msg,...));
+#ifndef _USRDLL
 #ifdef __GNUC__
-__attribute__ ((format (printf, 3, 4)))
+caddr_t srv_make_new_error (const char *code, const char *virt_code, const char *msg,...) __attribute__ ((format (printf, 3, 4)));
+#endif
 #endif
-;
 void qi_enter (query_instance_t * qi);
 
 void qi_leave (query_instance_t * qi);
@@ -1072,23 +1073,23 @@ caddr_t bif_commit (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args);
     } \
   QR_RESET_CODE  \
     { \
-      caddr_t err = NULL, err_2 = NULL; \
+      caddr_t _err_1 = NULL, _err_2 = NULL; \
       POP_QR_RESET; \
-      vdb_leave_1 (_qi2, &err); \
-      err_2 = subq_handle_reset (_qi2, reset_code); \
-      if (err && err_2) \
+      vdb_leave_1 (_qi2, &_err_1); \
+      _err_2 = subq_handle_reset (_qi2, reset_code); \
+      if (_err_1 && _err_2) \
        	{ \
-	  dk_free_tree (err); \
-          err = err_2; \
+	  dk_free_tree (_err_1); \
+          _err_1 = _err_2; \
 	} \
-      else if (err_2) \
-	err = err_2; \
-      if (err) \
+      else if (_err_2) \
+	_err_1 = _err_2; \
+      if (_err_1) \
 	{ \
 	  if (err_ret) \
-	    *err_ret = err; \
+	    *err_ret = _err_1; \
 	  else \
-	    sqlr_resignal (err); \
+	    sqlr_resignal (_err_1); \
 	} \
     } \
   END_QR_RESET; \
@@ -1288,4 +1289,6 @@ void itc_assert_no_reg (it_cursor_t * itc);
 #define itc_assert_no_reg(itc)
 #endif
 
+caddr_t * itc_bm_array (it_cursor_t * itc, buffer_desc_t * buf);
+
 #endif /* _SQLFN_H */
diff --git a/libsrc/Wi/sqlgen.c b/libsrc/Wi/sqlgen.c
index 8e513ee..1ddbc23 100644
--- a/libsrc/Wi/sqlgen.c
+++ b/libsrc/Wi/sqlgen.c
@@ -1,7 +1,7 @@
 /*
  *  sqlgen.c
  *
- *  $Id: sqlgen.c,v 1.39.2.22 2010/04/09 14:43:06 source Exp $
+ *  $Id: sqlgen.c,v 1.39.2.26 2011/03/11 18:26:43 source Exp $
  *
  *  sql executable graph generation
  *
@@ -720,7 +720,7 @@ sqlg_inx_op_and_ks (sqlo_t * so, inx_op_t * and_iop, inx_op_t * iop,
   dk_set_t max_ssls = NULL;
   int nth = 0, nth_free = 0;
   int is_first = NULL == and_iop->iop_max;
-  int n_eqs;
+  int n_eqs = 0;
   nth = 0;
   sp = ks->ks_spec.ksp_spec_array;
   DO_SET (dbe_column_t *, col, &iop->iop_ks->ks_key->key_parts)
@@ -1583,6 +1583,7 @@ sqlg_make_trans_dt  (sqlo_t * so, df_elt_t * dt_dfe, ST **target_names, dk_set_t
   sc->sc_any_clb = 1;
   tn->clb.clb_itcl = ssl_new_variable (sc->sc_cc, "itcl", DV_ANY);
   tn->tn_state = cc_new_instance_slot (sc->sc_cc);
+  tn->tn_nth_cache_result = cc_new_instance_slot (sc->sc_cc);
   tn->tn_relation = ssl_new_variable (sc->sc_cc, "rel", DV_ANY);
   tn->tn_input_sets = cc_new_instance_slot (sc->sc_cc);
   tn->tn_to_fetch = ssl_new_variable (sc->sc_cc, "to_fetch", DV_ANY);
@@ -2219,6 +2220,14 @@ dfe_unit_gb_dependant (sqlo_t *so, df_elt_t * dfe,
       dfe_list_gb_dependant (so, (df_elt_t *) dfe->_.setp.after_test, terminal, super, res, out, term_found);
       if (*term_found)
 	return;
+      DO_BOX (ST *, spec, inx, dfe->_.setp.specs)
+	{
+	  df_elt_t * exp = sqlo_df (so, dfe->_.setp.is_distinct ? (ST*)spec : spec->_.o_spec.col);
+	  dfe_list_gb_dependant (so, exp, terminal, super, res, out, term_found);
+	  if (*term_found)
+	    return;
+	}
+      END_DO_BOX;
       break;
 
     default:
@@ -3615,6 +3624,8 @@ sqlg_select_node (sqlo_t * so, df_elt_t * dfe, data_source_t ** head,
 
   if (table_exp)
     sel->sel_lock_mode = (char) TEXP_LOCK (table_exp);
+  /* if already set as exclusive don't change it */
+  if (sc->sc_cc->cc_query->qr_lock_mode != PL_EXCLUSIVE)
   sc->sc_cc->cc_query->qr_lock_mode = sel->sel_lock_mode;
   sqlc_select_top (sc, sel, tree, &code);
 
diff --git a/libsrc/Wi/sqlhash.c b/libsrc/Wi/sqlhash.c
index 2d8cf6f..6d828f9 100644
--- a/libsrc/Wi/sqlhash.c
+++ b/libsrc/Wi/sqlhash.c
@@ -1,7 +1,7 @@
 /*
  *  sqlhash.c
  *
- *  $Id: sqlhash.c,v 1.5.2.5 2009/12/11 14:24:24 source Exp $
+ *  $Id: sqlhash.c,v 1.5.2.9 2010/10/29 14:11:04 source Exp $
  *
  *  Dynamic SQL Compiler, part 2
  *
@@ -46,7 +46,7 @@ int dtp_is_var (dtp_t dtp);
 
 
 void
-key_col_from_ssl (dbe_key_t * key, state_slot_t * ssl, int quietcast)
+key_col_from_ssl (dbe_key_t * key, state_slot_t * ssl, int quietcast, gb_op_t *gb_op)
 {
   NEW_VARZ (dbe_column_t, col);
   col->col_name = box_dv_short_string (SSL_HAS_NAME (ssl) ? ssl->ssl_name : "const");
@@ -67,6 +67,25 @@ key_col_from_ssl (dbe_key_t * key, state_slot_t * ssl, int quietcast)
   if (col->col_sqt.sqt_dtp == DV_LONG_STRING ||
       col->col_sqt.sqt_dtp == DV_ANY)
     col->col_sqt.sqt_precision = 0;
+  if (gb_op && col->col_sqt.sqt_dtp == DV_ANY)
+    {
+      switch (gb_op->go_op)
+	{
+	  case AMMSC_COUNT:
+	      col->col_sqt.sqt_dtp = DV_INT64;
+	      col->col_sqt.sqt_precision = DV_LONG_INT_PREC;
+	      break;
+	  case AMMSC_COUNTSUM:
+	  case AMMSC_SUM:
+	  case AMMSC_AVG:
+	      col->col_sqt.sqt_dtp = DV_NUMERIC;
+	      col->col_sqt.sqt_precision = NUMERIC_MAX_PRECISION;
+	      col->col_sqt.sqt_precision = NUMERIC_MAX_SCALE;
+	      break;
+	  default:
+	      break;
+	}
+    }
   col->col_id = dk_set_length (key->key_parts) + 1;
 
   col->col_options = (caddr_t *) box_copy_tree ((box_t) ssl->ssl_sqt.sqt_tree);
@@ -99,6 +118,7 @@ sqt_row_data_length (sql_type_t *sqt)
 dbe_key_t *
 setp_temp_key (setp_node_t * setp, long *row_len_ptr, int quietcast)
 {
+  int inx = 0;
   NEW_VARZ (dbe_key_t, key);
 
   key->key_n_significant = dk_set_length (setp->setp_keys);
@@ -110,14 +130,16 @@ setp_temp_key (setp_node_t * setp, long *row_len_ptr, int quietcast)
     {
       if (row_len_ptr)
 	*row_len_ptr += sqt_row_data_length (& ssl->ssl_sqt);
-      key_col_from_ssl (key, ssl, quietcast);
+      key_col_from_ssl (key, ssl, quietcast, NULL);
     }
   END_DO_SET();
   DO_SET (state_slot_t *, ssl, &setp->setp_dependent)
     {
+      gb_op_t *gb_op = dk_set_nth (setp->setp_gb_ops, inx);
       if (row_len_ptr)
 	*row_len_ptr += sqt_row_data_length (& ssl->ssl_sqt);
-      key_col_from_ssl (key, ssl, quietcast);
+      key_col_from_ssl (key, ssl, quietcast, gb_op);
+      inx ++;
     }
   END_DO_SET();
 
@@ -188,6 +210,43 @@ setp_distinct_hash (sql_comp_t * sc, setp_node_t * setp, long n_rows)
   ha->ha_slots = (state_slot_t **)
     list_to_array (dk_set_conc (dk_set_copy (setp->setp_keys),
 				dk_set_copy (setp->setp_dependent)));
+#if 1
+  if (ha->ha_memcache_only && setp->setp_gb_ops && setp->setp_gb_ops->data)
+    {
+      inx = n_keys;
+      DO_SET (gb_op_t *, op, &(setp->setp_gb_ops))
+	{
+	  state_slot_t * ssl = ha->ha_slots[inx];
+	  switch (op->go_op)
+	{
+	  case AMMSC_COUNT:
+	  case AMMSC_COUNTSUM:
+	  case AMMSC_SUM:
+	      case AMMSC_AVG:
+		  ha->ha_memcache_only = 0;
+		  break;
+	  case AMMSC_MIN:
+	  case AMMSC_MAX:
+		    {
+		      /* check dep part to be numeric type */
+		      if (IS_NUM_DTP (ssl->ssl_dtp))
+	      ha->ha_memcache_only = 0;
+		      else
+			{
+			  ha->ha_memcache_only = 1;
+			  goto check_done;
+			}
+	      break;
+		    }
+          default:
+	      break;
+	}
+	  inx++;
+	}
+      END_DO_SET ();
+check_done:;
+    }
+#endif
   ha->ha_allow_nulls = 1;
   ha->ha_op = HA_DISTINCT;
   if (setp->setp_any_user_aggregate_gos)
diff --git a/libsrc/Wi/sqlintrp.c b/libsrc/Wi/sqlintrp.c
index cf1ec10..bdf9b26 100644
--- a/libsrc/Wi/sqlintrp.c
+++ b/libsrc/Wi/sqlintrp.c
@@ -1,7 +1,7 @@
 /*
  *  sqlintrp.c
  *
- *  $Id: sqlintrp.c,v 1.21.2.10 2010/02/02 14:16:14 source Exp $
+ *  $Id: sqlintrp.c,v 1.21.2.13 2010/11/15 16:51:56 source Exp $
  *
  *  SQL interpreter
  *
@@ -72,113 +72,6 @@ unsigned char ins_lengths[INS_MAX + 1] = {
   ALIGN_INSTR(sizeof (dummy_ins_t._.bret))
 };
 
-#ifdef REPLICATION_SUPPORT2
-/* log call to replication */
-static void
-repl_proc_call (instruction_t * ins, caddr_t * qst, query_t *proc, caddr_t *pars)
-{
-  query_instance_t *qi = (query_instance_t *) QST_INSTANCE (qst);
-  char * replic_acct;
-  int nel = 0, skip_repl = 0;
-  int inx = 0;
-  query_instance_t *cb = NULL;
-
-  replic_acct = proc->qr_proc_repl_acct;
-  cb = qi->qi_caller;
-  /* First check inside replicated proc call */
-  if (IS_POINTER (qi->qi_query))
-    {
-      if (qi->qi_query->qr_proc_repl_acct && 0 == strcmp (replic_acct, qi->qi_query->qr_proc_repl_acct))
-	skip_repl = 1;
-    }
-  while (IS_POINTER (cb) && !skip_repl)
-    {
-      if (cb->qi_query)
-	{
-	  /* if (cb->qi_query->qr_proc_repl_acct)
-	     fprintf (stdout, "Caller: %s\n", cb->qi_query->qr_proc_repl_acct); */
-	  if (cb->qi_query->qr_proc_repl_acct && 0 == strcmp (replic_acct, cb->qi_query->qr_proc_repl_acct))
-	    {
-	      skip_repl = 1;
-	      break;
-	    }
-	  cb = cb->qi_caller;
-	}
-    }
-  /* Do replication log */
-  if (!skip_repl)
-    {
-      /*state_slot_t *aparm;*/
-      dk_session_t *ses = strses_allocate (); /* the procedure's quoted name can have many quotes */
-      caddr_t * arr = NULL;
-      caddr_t proc_call;
-      s_node_t * iter = proc->qr_parms;
-      /*caddr_t * kwds = ins->_.call.kwds;*/
-
-#if 0
-      if (kwds)
-	inx = BOX_ELEMENTS (kwds);
-      else
-#endif
-        inx = dk_set_length (proc->qr_parms);
-
-      arr = (caddr_t *) dk_alloc_box ((inx + 1) * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
-
-      session_buffered_write_char ('\"', ses);
-      sprintf_escaped_id (proc->qr_proc_name, NULL, ses);
-      session_buffered_write_char ('\"', ses);
-      session_buffered_write (ses, " (", 2);
-      for (nel = 0, iter = proc->qr_parms; nel < inx; nel++, iter = iter->next)
-	{
-	  state_slot_t *ssl = (state_slot_t *) iter->data;
-#if 0
-	  if (kwds)
-	    {
-	      session_buffered_write_char ('\"', ses);
-	      sprintf_escaped_id (kwds [nel], NULL, ses);
-	      session_buffered_write (ses, "\"=> ", 3);
-	    }
-#endif
-	  if (nel == inx-1)
-	    session_buffered_write (ses, "? ", 2);
-	  else
-	    session_buffered_write (ses, "?,", 2);
-	  if (ssl->ssl_type == SSL_REF_PARAMETER_OUT ||
-	      ssl->ssl_type == SSL_REF_PARAMETER)
-	    {
-		sqlr_new_error ("42000", "SQ206",
-		    "Procedure %s cannot be transactionally replicated "
-		    "(in publication %s) because it has out/inout parameter %s (parameter number %d). "
-		    "Publishing the calls to the procedure is disabled. "
-		    "Please remove the procedure from the transactional publication.",
-		    proc->qr_proc_name,
-		    proc->qr_proc_repl_acct,
-		    ssl->ssl_name ? ssl->ssl_name : "",
-		    nel + 1
-		    );
-	    }
-
-	}
-      session_buffered_write_char (')', ses);
-      proc_call = strses_string (ses);
-      strses_free (ses);
-      arr [0] = proc_call;
-#if 0
-      for (nel = 1; nel <= inx; nel++)
-	{
-	  aparm = ins->_.call.params[nel-1];
-          arr [nel] = qst_get (qst, aparm);
-	}
-#else
-      memcpy (&arr[1], pars, inx * sizeof (caddr_t));
-#endif
-      log_repl_text_array (qi->qi_trx, NULL, replic_acct, (caddr_t) arr);
-      dk_free_box ((caddr_t) arr);
-      dk_free_box (proc_call);
-    }
-}
-/* end replication log */
-#endif
 
 
 void
@@ -510,7 +403,7 @@ report_error:
 	eff_g_id = eff_u_id;
     }
   if (!sec_proc_check (proc, eff_g_id, eff_u_id))
-    sqlr_new_error ("42000", "SR186", "No permission to execute procedure %s.", proc_name);
+    sqlr_new_error ("42000", "SR186", "No permission to execute procedure %s with user ID %d, group ID %d", proc_name, (int)eff_g_id, (int)eff_u_id);
   if (1 || ins->_.call.kwds || 0 == param_len)
     {
       int formal_len = dk_set_length (proc->qr_parms);
@@ -551,10 +444,6 @@ report_error:
 #endif
   qi->qi_thread->thr_func_value = NULL;
   /* Procedure's call is published */
-#ifdef REPLICATION_SUPPORT2
-  if ((proc != NULL) && (proc->qr_proc_repl_acct != NULL))
-      repl_proc_call (ins, qst, proc, pars);
-#endif
   if (CV_CALL_PROC_TABLE == ins->_.call.ret)
     {
       PROC_SAVE_PARENT;
@@ -1151,6 +1040,7 @@ do_pl_stats (query_instance_t *qi, int32 lineno)
       qr_caller = caller->qi_query;
       caller_name = caller->qi_query->qr_proc_name;
     }
+  mutex_enter (qr->qr_stats_mtx);
   thisct = (int32) (ptrlong) gethash ((void *) (ptrlong) lineno, qr->qr_line_counts);
   sethash ((void *) (ptrlong) lineno,  qr->qr_line_counts, (void *) (ptrlong) (++thisct));
   if (!caller_name)
@@ -1168,6 +1058,7 @@ do_pl_stats (query_instance_t *qi, int32 lineno)
 	}
       qr->qr_calls++;
     }
+  mutex_leave (qr->qr_stats_mtx);
 }
 
 void pldbg_make_answer (client_connection_t * cli);
diff --git a/libsrc/Wi/sqlnode.h b/libsrc/Wi/sqlnode.h
index f6cab4d..b8b9912 100644
--- a/libsrc/Wi/sqlnode.h
+++ b/libsrc/Wi/sqlnode.h
@@ -1,7 +1,7 @@
 /*
  *  sqlnode.h
  *
- *  $Id: sqlnode.h,v 1.30.2.14 2010/03/08 12:04:13 source Exp $
+ *  $Id: sqlnode.h,v 1.30.2.16 2010/10/29 14:12:27 source Exp $
  *
  *  SQL query nodes
  *
@@ -304,9 +304,6 @@ struct query_s
     struct query_cursor_s *	qr_cursor;
     state_slot_t **	qr_xp_temp;
     dk_set_t		qr_unrefd_data;	/* garbage, free when freeing qr */
-#ifdef REPLICATION_SUPPORT2
-    caddr_t		qr_proc_repl_acct; /* transactional replication account name */
-#endif
     dk_set_t		qr_proc_result_cols; /* needed by SQLProcedureColumns */
     dk_set_t		qr_subq_queries;
 
@@ -321,6 +318,7 @@ struct query_s
     id_hash_t 		*qr_call_counts;  /* test coverage caller stats */
     long		qr_time_cumulative; /* test coverage cumulative time for execution */
     long 		qr_self_time;
+    dk_mutex_t		*qr_stats_mtx;	  /* for protection on stats hash tables see above */
 #endif
     caddr_t		*qr_udt_mtd_info; /* not null if CREATE METHOD */
     long 		qr_obsolete_msec;
diff --git a/libsrc/Wi/sqlo.c b/libsrc/Wi/sqlo.c
index b0ce0b3..8833b6f 100644
--- a/libsrc/Wi/sqlo.c
+++ b/libsrc/Wi/sqlo.c
@@ -1,7 +1,7 @@
 /*
  *  sqlo.c
  *
- *  $Id: sqlo.c,v 1.15.2.14 2010/05/18 09:08:13 source Exp $
+ *  $Id: sqlo.c,v 1.15.2.17 2011/03/17 13:55:20 source Exp $
  *
  *  sql scope inference
  *
@@ -1353,6 +1353,19 @@ sqlo_expand_dt (sqlo_t *so, ST *tree, ST ** from_ret, op_table_t *ot, int is_in_
     }
 }
 
+/* check after sqlo_dt_inlineable if right side selection list has expressions containing no columns of the table */
+static int
+sqlo_selection_all_cols (sqlo_t * so, caddr_t * tree, op_table_t * ot)
+{
+  int inx;
+  DO_BOX (ST *, s, inx, (ST**)tree)
+    {
+      if (!sqlo_has_col_ref (s))
+	return 0;
+    }
+  END_DO_BOX;
+  return 1;
+}
 
 int
 sqlo_inline_jt (sqlo_t * so, ST * tree, ST * exp, op_table_t * ot)
@@ -1371,7 +1384,8 @@ sqlo_inline_jt (sqlo_t * so, ST * tree, ST * exp, op_table_t * ot)
       else if (ST_P (exp->_.join.left, TABLE_REF) && ST_P (exp->_.join.left->_.table_ref.table, JOINED_TABLE))
 	any += sqlo_inline_jt (so, tree, exp->_.join.left->_.table_ref.table, ot);
       if (OJ_LEFT == exp->_.join.type
-	  && sqlo_dt_inlineable (so, tree, exp->_.join.right, ot, 1))
+	  && sqlo_dt_inlineable (so, tree, exp->_.join.right, ot, 1)
+	  && sqlo_selection_all_cols (so, exp->_.join.right->_.table_ref.table->_.select_stmt.selection, ot))
 	{
 	  /* left oj with single table dt to the right. */
 	  ST * texp = exp->_.join.right->_.table_ref.table->_.select_stmt.table_exp;
@@ -2013,23 +2027,23 @@ sqlo_opt_value (caddr_t * opts, int opt)
 }
 
 
-void
+int
 sqlo_expand_distinct_joins (sqlo_t * so, ST *tree, op_table_t *sel_ot, dk_set_t *res)
 {
-  int inx;
+  int inx, has_expand = 0;
   if (!tree->_.select_stmt.table_exp || !SEL_IS_DISTINCT (tree))
-    return;
+    return 0;
   _DO_BOX (inx, tree->_.select_stmt.table_exp->_.table_exp.from)
     {
       ST **tbp = & (tree->_.select_stmt.table_exp->_.table_exp.from[inx]);
-      if (ST_P (*tbp, TABLE_REF))
+      while (ST_P (*tbp, TABLE_REF))
 	tbp = & (*tbp)->_.table_ref.table;
 
       if (ST_P (*tbp, JOINED_TABLE) && ((*tbp)->_.join.type == OJ_LEFT || (*tbp)->_.join.type == OJ_FULL))
 	{
-	  ST *rtb = (*tbp)->_.join.right;
+	  ST *rtb = (*tbp)->_.join.right, *ltp;
 	  op_table_t *ot = NULL;
-	  if (ST_P (rtb, TABLE_REF))
+	  while (ST_P (rtb, TABLE_REF))
 	    rtb = rtb->_.table_ref.table;
 	  if (ST_P (rtb, TABLE_DOTTED))
 	    ot = sqlo_cname_ot (so, rtb->_.table.prefix);
@@ -2053,11 +2067,16 @@ sqlo_expand_distinct_joins (sqlo_t * so, ST *tree, op_table_t *sel_ot, dk_set_t
 	      t_set_delete (&so->so_scope->sco_tables, ot);
 	      t_set_delete (res, (*tbp)->_.join.cond);
 	      t_set_delete (&sel_ot->ot_from_ots, ot);
-	      *tbp = (*tbp)->_.join.left;
+	      ltp = (*tbp)->_.join.left;
+	      if (ST_P (tree->_.select_stmt.table_exp->_.table_exp.from[inx], TABLE_REF) && ST_P (ltp, TABLE_REF))
+		ltp = ltp->_.table_ref.table;
+	      *tbp = ltp;
+	      has_expand ++;
 	    }
 	}
     }
   END_DO_BOX;
+  return has_expand;
 }
 
 
@@ -2749,8 +2768,16 @@ sqlo_select_scope (sqlo_t * so, ST ** ptree)
     }
   /* end dt expansion */
 #endif
-  if (texp && SEL_IS_DISTINCT (tree))
-    sqlo_expand_distinct_joins (so, tree, ot, &res);
+  if (texp && SEL_IS_DISTINCT (tree) && sqlo_expand_distinct_joins (so, tree, ot, &res))
+    {
+      char old_rescope = so->so_is_rescope;
+      so->so_this_dt = old_dt;
+      so->so_is_rescope = 1;
+      so->so_scope = so->so_scope->sco_super;
+      sqlo_scope (so, ptree);
+      so->so_is_rescope = old_rescope;
+      return;
+    }
   DO_SET (ST *, jc, &res)
     {
       jc->_.join.cond = (ST *) STAR;
@@ -3074,6 +3101,7 @@ sqlo_scope (sqlo_t * so, ST ** ptree)
       {
 	int inx;
 	ST *res;
+	char * call_name = tree->_.call.name;
 	if (DV_ARRAY_OF_POINTER == DV_TYPE_OF (tree->_.call.name) && BOX_ELEMENTS (tree->_.call.name) == 1)
 	  {
 	    sqlo_scope (so, &(((ST **) tree->_.call.name)[0]));
@@ -3082,6 +3110,13 @@ sqlo_scope (sqlo_t * so, ST ** ptree)
 	  {
 	    CHECK_METHOD_CALL (ptree);
 	  }
+	/* mark qr to do lock if it is for SPARQL insert/delete triples */
+	if (DV_STRINGP (call_name) &&
+	    (!casemode_strcmp (call_name, "DB.DBA.SPARQL_INSERT_DICT_CONTENT") ||
+	     !casemode_strcmp (call_name, "DB.DBA.SPARQL_DELETE_DICT_CONTENT") ||
+	     !casemode_strcmp (call_name, "DB.DBA.SPARUL_LOAD") ||
+	     !casemode_strcmp (call_name, "DB.DBA.SPARUL_CLEAR")))
+	  so->so_sc->sc_cc->cc_query->qr_lock_mode = PL_EXCLUSIVE;
 	_DO_BOX (inx, tree->_.call.params)
 	  {
 	    sqlo_scope (so, &(tree->_.call.params[inx]));
diff --git a/libsrc/Wi/sqlo.h b/libsrc/Wi/sqlo.h
index 6d6a828..2fc7db2 100644
--- a/libsrc/Wi/sqlo.h
+++ b/libsrc/Wi/sqlo.h
@@ -1,7 +1,7 @@
 /*
  *  sqlo.h
  *
- *  $Id: sqlo.h,v 1.22.2.10 2010/02/18 10:57:17 source Exp $
+ *  $Id: sqlo.h,v 1.22.2.12 2011/02/14 11:48:50 source Exp $
  *
  *  sql opt graph
  *
@@ -281,6 +281,8 @@ struct df_elt_s
     struct {
       dbe_column_t *	col;
       op_virt_col_t *   vc;
+      float		card; /* if from rdf quad, card is given by p stats and is not the card of the dbe_column_t */
+      bitf_t		is_fixed:1; /* col eq to param or col imported from other dt, if all group cols fixed, gb can be dropped */
     } col;
     struct {
       int 	op;
@@ -742,6 +744,7 @@ void qn_ins_before (sql_comp_t * sc, data_source_t ** head, data_source_t * ins_
 #define NEXT_PAGE_COST 5
 #define INX_ROW_INS_COST 1 /* cost of itc_insert_dv into inx */
 #define HASH_ROW_INS_COST 1.6 /* cost of adding a row to hash */
+#define HASH_MEM_INS_COST 0.7
 #define HASH_LOOKUP_COST 0.9
 #define HASH_ROW_COST 0.3
 #define CV_INSTR_COST 0.1   /* avg cost of instruction in code_vec_run */
@@ -793,6 +796,10 @@ int dfe_is_eq_pred (df_elt_t * pred);
 float sqlo_index_path_cost (dk_set_t path, float * cost_ret, float * card_ret, char * sure_ret);
 data_source_t * sqlg_make_ts (sqlo_t * so, df_elt_t * tb_dfe);
 int dfe_is_o_ro2sq_range (df_elt_t * pred, df_elt_t * tb_dfe, df_elt_t ** o_col_dfe_ret, df_elt_t ** exp_dfe_ret, int * op_ret);
+int sqlo_has_col_ref (ST * tree);
+
+float dfe_exp_card (sqlo_t * so, df_elt_t * dfe);
+void sqlo_rdf_col_card (sqlo_t * so, df_elt_t * td_dfe, df_elt_t * dfe);
 
 
 #endif /* _SQLO_H */
diff --git a/libsrc/Wi/sqlovdb.c b/libsrc/Wi/sqlovdb.c
index 64d25d0..3b02914 100644
--- a/libsrc/Wi/sqlovdb.c
+++ b/libsrc/Wi/sqlovdb.c
@@ -1,7 +1,7 @@
 /*
  *  sqlovdb.c
  *
- *  $Id: sqlovdb.c,v 1.5.2.3 2009/08/17 23:42:59 source Exp $
+ *  $Id: sqlovdb.c,v 1.5.2.4 2010/09/17 16:50:59 source Exp $
  *
  *  SQL remote table layout and emote SQL generation
  *
@@ -37,6 +37,7 @@
 #include "security.h"
 #include "sqlintrp.h"
 #include "sqlo.h"
+#include "strlike.h"
 
 
 
diff --git a/libsrc/Wi/sqlpfn.c b/libsrc/Wi/sqlpfn.c
index f90bf72..b1427e7 100644
--- a/libsrc/Wi/sqlpfn.c
+++ b/libsrc/Wi/sqlpfn.c
@@ -1,7 +1,7 @@
 /*
  *  sqlpfn.c
  *
- *  $Id: sqlpfn.c,v 1.20.2.5 2010/02/18 10:57:17 source Exp $
+ *  $Id: sqlpfn.c,v 1.20.2.6 2010/11/15 16:51:56 source Exp $
  *
  *  Parser Functions
  *
@@ -1772,6 +1772,30 @@ sqlp_xml_select_flags (char * mode, char * elt)
   return v;
 }
 
+#if 0
+void
+sqlp_tweak_selection_names (ST * tree)
+{
+  ST ** sel;
+  int inx;
+  if (!ST_P (tree, SELECT_STMT))
+    return;
+  sel = (ST **)(tree->_.select_stmt.selection);
+  DO_BOX (ST *, exp, inx, sel)
+    {
+      int inx2;
+      if (!ST_P (exp, BOP_AS))
+        goto tweak; /* see below */
+      for (inx2 = inx; inx2--; /* no step */)
+        if (!strcmp (sel[inx2]->_.as_exp.name, exp->_.as_exp.name))
+          goto tweak; /* see below */
+    }
+  END_DO_BOX;
+  return;
+tweak:
+  sqlc_selection_names (tree, 1);
+}
+#endif
 
 ptrlong
 sqlp_bunion_flag (ST * l, ST * r, long f)
@@ -1781,6 +1805,23 @@ sqlp_bunion_flag (ST * l, ST * r, long f)
   return ((ptrlong) (f ||  lf || rf));
 }
 
+ST *
+sqlp_wpar_nonselect (ST *subq)
+{
+  ST *tbl_ref, *from_clause, *tbl_exp, **selection, *wrapped_subq;
+  char tname[100];
+  if (ST_P (subq, SELECT_STMT))
+    return subq;
+  snprintf (tname, sizeof (tname), "_subq_%ld", (long)((ptrlong)(subq)));
+  tbl_ref = t_listst (3, DERIVED_TABLE, sqlp_view_def (NULL, subq, 0), t_box_string (tname));
+  from_clause = t_listst (1, tbl_ref);
+  tbl_exp = sqlp_infoschema_redirect (t_listst (9, TABLE_EXP, from_clause, NULL, NULL, NULL, NULL, (ptrlong) 0, NULL, NULL));
+  selection = (ST **)t_list (1, t_listst (3, COL_DOTTED, (long) 0, STAR));
+  wrapped_subq = t_listst (5, SELECT_STMT, NULL,
+    sqlp_stars (sqlp_wrapper_sqlxml (selection), tbl_exp->_.table_exp.from) , NULL, tbl_exp);
+  sqlp_breakup (wrapped_subq);
+  return wrapped_subq;
+}
 
 ST *
 sqlp_inline_order_by (ST *tree, ST **oby)
diff --git a/libsrc/Wi/sqlpfn.h b/libsrc/Wi/sqlpfn.h
index e842816..60cbde4 100644
--- a/libsrc/Wi/sqlpfn.h
+++ b/libsrc/Wi/sqlpfn.h
@@ -1,7 +1,7 @@
 /*
  *  sqlpfn.h
  *
- *  $Id: sqlpfn.h,v 1.8.2.4 2010/01/31 12:43:58 source Exp $
+ *  $Id: sqlpfn.h,v 1.8.2.6 2010/11/15 16:51:57 source Exp $
  *
  *  SQL Parser Utility Functions
  *
@@ -35,7 +35,6 @@ caddr_t not_impl (char * text);
 
 int ammsc_to_code (char * op);
 
-caddr_t list (long n, ...);
 void list_extend (caddr_t *list_ptr, long n, ...);
 void list_nappend (caddr_t *list_ptr, caddr_t cont);
 caddr_t sc_list (long n, ...);
@@ -149,7 +148,9 @@ caddr_t * sqlp_string_col_list (caddr_t * lst);
 caddr_t sqlp_xml_col_name (ST * tree);
 extern int sqlp_xml_col_directive (char *id);
 long sqlp_xml_select_flags (char * mode, char * elt);
+extern void sqlp_tweak_selection_names (ST * tree);
 ptrlong sqlp_bunion_flag (ST * l, ST * r, long f);
+ST *sqlp_wpar_nonselect (ST *subq);
 ST * sqlp_inline_order_by (ST *tree, ST **oby);
 ST * sqlp_patch_call_if_special (ST * funcall_tree);
 ptrlong sqlp_cursor_name_to_type (caddr_t name);
diff --git a/libsrc/Wi/sqlprocc.c b/libsrc/Wi/sqlprocc.c
index 9b13a0b..1184079 100644
--- a/libsrc/Wi/sqlprocc.c
+++ b/libsrc/Wi/sqlprocc.c
@@ -1,7 +1,7 @@
 /*
  *  sqlprocc.c
  *
- *  $Id: sqlprocc.c,v 1.7.2.4 2009/08/11 09:08:46 source Exp $
+ *  $Id: sqlprocc.c,v 1.7.2.5 2010/10/29 14:12:27 source Exp $
  *
  *  SQL Procedure Compiler
  *
@@ -1091,6 +1091,7 @@ sqlc_module_decl (sql_comp_t * sc, ST * tree)
 	{ /* source & line are from qr_module */
 	  qr->qr_line_counts = hash_table_allocate (100);
 	  qr->qr_call_counts = id_str_hash_create (101);
+	  qr->qr_stats_mtx = mutex_allocate ();
 	}
 #endif
 
diff --git a/libsrc/Wi/sqlrcomp.c b/libsrc/Wi/sqlrcomp.c
index ca24e97..359a7bc 100644
--- a/libsrc/Wi/sqlrcomp.c
+++ b/libsrc/Wi/sqlrcomp.c
@@ -1,7 +1,7 @@
 /*
  *  sqlrcomp.c
  *
- *  $Id: sqlrcomp.c,v 1.7.2.6 2010/04/21 16:18:25 source Exp $
+ *  $Id: sqlrcomp.c,v 1.7.2.7 2011/01/11 22:41:31 source Exp $
  *
  *  SQL Compiler, VDB remote database access
  *
@@ -1193,8 +1193,8 @@ sqlc_exp_print (sql_comp_t * sc, comp_table_t * ct, ST * exp, char *text, size_t
 	case SEARCHED_CASE:
 	  {
 	    int inx;
-	    id_hash_t *old_private_elts;
-	    df_elt_t * case_dfe;
+	    id_hash_t *old_private_elts = NULL;
+	    df_elt_t * case_dfe = NULL;
 	    if (sc->sc_so)
 	      case_dfe = sqlo_df (sc->sc_so, tree);
 	    sprintf_more (text, tlen, fill, "CASE ");
diff --git a/libsrc/Wi/sqlrun.c b/libsrc/Wi/sqlrun.c
index cdec6ab..9a92539 100644
--- a/libsrc/Wi/sqlrun.c
+++ b/libsrc/Wi/sqlrun.c
@@ -1,7 +1,7 @@
 /*
  *  sqlrun.c
  *
- *  $Id: sqlrun.c,v 1.24.2.15 2010/03/08 12:04:13 source Exp $
+ *  $Id: sqlrun.c,v 1.24.2.21 2011/03/11 18:26:43 source Exp $
  *
  *  SQL query execution
  *
@@ -282,6 +282,8 @@ sel_out_free (state_slot_t ** out_slots, caddr_t * qst)
   DO_BOX (state_slot_t *, sl, inx, out_slots)
   {
     char sl_type = sl->ssl_type;
+    if (sl->ssl_is_alias)
+      goto next;
     if ((sl_type == SSL_PLACEHOLDER || sl_type == SSL_ITC))
       {
 	placeholder_t *pl = (placeholder_t *) qst[inx];
@@ -289,10 +291,6 @@ sel_out_free (state_slot_t ** out_slots, caddr_t * qst)
 	  plh_free (pl);
 	continue;
       }
-    if (sl->ssl_is_alias)
-      goto next;
-
-
     dt = qst[inx];
     if (dt)
       {
@@ -901,53 +899,54 @@ ks_search_param_cast (it_cursor_t * itc, search_spec_t * sp, caddr_t data)
   if (dtp == target_dtp)
     {
       ITC_COPY_PARAM (itc, data);
+      return KS_CAST_OK;
     }
-  else
+  switch (target_dtp)
     {
-      if (IS_BLOB_DTP (target_dtp))
+    case DV_BLOB: case DV_BLOB_BIN: case DV_BLOB_WIDE: case DV_BLOB_XPER:
+      if (dtp != DV_DB_NULL)
 	{
 	  char* cl_name = __get_column_name (sp->sp_cl.cl_col_id,
 	      itc->itc_insert_key ? itc->itc_insert_key : itc->itc_row_key);
-	  if (dtp != DV_DB_NULL)
 	    sqlr_new_error ("22023", "SR347",
 		"The long varchar, long varbinary and long nvarchar "
 		"data types cannot be used in the WHERE, HAVING, or ON clause, "
 		"except with the IS NULL predicate for column '%s'", cl_name);
 	}
-
-      if (IS_NUM_DTP (dtp) && IS_NUM_DTP (target_dtp))
-	{
+      break;
 	  /* compare different number types.  If col more precise than arg, cast to col here, otherwise the cast is in itc_col_check.
 	  * if param is more precise, disable any inlined compare funcs since they do not cast. */
-	  switch (target_dtp)
-	    {
 	    case DV_LONG_INT:
+      if (!IS_NUM_DTP (dtp))
+        break;
 	      ITC_COPY_PARAM (itc, data); /* all are more precise, no cast down */
 	      itc->itc_key_spec.ksp_key_cmp = NULL;
-	      return 0;
+      return KS_CAST_OK;
 	    case DV_SINGLE_FLOAT:
-	      if (DV_LONG_INT == dtp)
-		goto cast_param_up;
+      if ((DV_LONG_INT == dtp) || !IS_NUM_DTP (dtp))
+        break;
 	      ITC_COPY_PARAM (itc, data);
 	      itc->itc_key_spec.ksp_key_cmp = NULL;
-	      return 0;
+      return KS_CAST_OK;
 	    case DV_DOUBLE_FLOAT:
-	      goto cast_param_up;
+      break;
 	    case DV_NUMERIC:
-	      if (DV_DOUBLE_FLOAT == dtp)
-		{
+      if (DV_DOUBLE_FLOAT != dtp)
+        break;
 		  ITC_COPY_PARAM (itc, data);
 		  itc->itc_key_spec.ksp_key_cmp = NULL;
-		  return 0;
-		}
-	      goto cast_param_up;
-	    }
-	  return 0;
+      return KS_CAST_OK;
+/* same is for dates/datetime pair */
+    case DV_DATE:
+      if (DV_DATETIME != dtp)
+        break;
+      ITC_COPY_PARAM (itc, data);
+      itc->itc_key_spec.ksp_key_cmp = NULL;
+      return KS_CAST_OK;
 	}
-    cast_param_up:
       data = box_cast_to (itc->itc_out_state, data, dtp, target_dtp,
 			  sp->sp_cl.cl_sqt.sqt_precision, sp->sp_cl.cl_sqt.sqt_scale, &err);
-      if (err)
+      if (err || (DV_DB_NULL == DV_TYPE_OF (data)))
 	{
 	  query_instance_t * qi = (query_instance_t *) itc->itc_out_state;
 	  if (qi->qi_no_cast_error)
@@ -959,15 +958,16 @@ ks_search_param_cast (it_cursor_t * itc, search_spec_t * sp, caddr_t data)
 		dtp = DV_LONG_INT;
 	      if (IS_NUM_DTP (target_dtp))
 		target_dtp = DV_LONG_INT;
+              if (DV_DB_NULL == DV_TYPE_OF (data))
+                dk_free_box (data);
 	      return (dtp < target_dtp ? KS_CAST_DTP_LT : KS_CAST_DTP_GT);
 	    }
 	  else
 	    sqlr_resignal (err);
 	}
-
       ITC_SEARCH_PARAM (itc, data);
       ITC_OWNS_PARAM (itc, data);
-    }
+
   return KS_CAST_OK;
 }
 
@@ -1489,6 +1489,12 @@ table_source_input (table_source_t * ts, caddr_t * inst,
 	{
 	  if (order_buf)
 	    GPF_T;		/* TS loops back and order buf is set */
+	  if (!order_itc->itc_is_registered)
+	    {
+	      log_error ("cursor not continuable as it is unregistered");
+	      SRC_IN_STATE (ts, inst) = NULL;
+	      return;
+	    }
 	  ITC_FAIL (order_itc)
 	  {
 	    order_buf = page_reenter_excl (order_itc);
@@ -1556,6 +1562,11 @@ table_source_input (table_source_t * ts, caddr_t * inst,
 	  || code_vec_run (ts->src_gen.src_after_test, state))
 	{
 	  any_passed = 1;
+#ifndef NDEBUG
+	  /* if in state itc must be registered */
+	  if (SRC_IN_STATE (ts, inst) != NULL && !order_itc->itc_is_registered)
+	    GPF_T;
+#endif
 	  qn_ts_send_output ((data_source_t *) ts, state, ts->ts_after_join_test);
 	}
       state = NULL;
@@ -2342,7 +2353,7 @@ select_node_input (select_node_t * sel, caddr_t * inst, caddr_t * state)
 	    cli_send_row_count (qi->qi_client, 0, NULL, THREAD_CURRENT_THREAD);
 	}
     }
-  if (!sel->sel_set_no && !sel_top_count (sel, inst))
+  if (!sel_top_count (sel, inst))
     return;
   if (qi->qi_caller == CALLER_CLIENT)
     {
@@ -2384,8 +2395,6 @@ select_node_input (select_node_t * sel, caddr_t * inst, caddr_t * state)
 	}
       box[fill++] = out_copy;
       inst[sel->sel_out_fill] = (caddr_t) (ptrlong) fill;
-      if (sel->sel_set_no)
-	sel_top_count (sel, inst);
     }
   else
     {
@@ -2398,8 +2407,6 @@ select_node_input (select_node_t * sel, caddr_t * inst, caddr_t * state)
 	}
       box[fill++] = out_copy;
       inst[sel->sel_out_fill] = (caddr_t) (ptrlong) fill;
-      if (sel->sel_set_no)
-	sel_top_count (sel, inst);
     }
 
   if (quota != PREFETCH_ALL
@@ -3009,6 +3016,9 @@ qi_initial_enter_trx (query_instance_t * qi)
   return rc;
 }
 
+#define QI_SERIALIZABLE(qi,qr) \
+  if ((qi)->qi_no_cast_error && PL_EXCLUSIVE == (qr)->qr_lock_mode && !(qi)->qi_autocommit && !(qi)->qi_non_txn_insert) \
+    (qi)->qi_isolation = ISO_SERIALIZABLE
 
 caddr_t
 qr_exec (client_connection_t * cli, query_t * qr,
@@ -3069,7 +3079,7 @@ qr_exec (client_connection_t * cli, query_t * qr,
       qi->qi_no_triggers = caller->qi_no_triggers;
     }
   was_autocommit = qi->qi_autocommit;
-
+  QI_SERIALIZABLE (qi, qr);
   if (stmt)
     {
       is_timeout = qi_initial_enter_trx (qi);
@@ -3292,7 +3302,7 @@ qr_dml_array_exec (client_connection_t * cli, query_t * qr,
   else
     GPF_T1 ("array exec only from client");
   was_autocommit = qi->qi_autocommit;
-
+  QI_SERIALIZABLE (qi, qr);
   if (stmt)
     {
       is_timeout = qi_initial_enter_trx (qi);
@@ -3497,7 +3507,7 @@ qr_subq_exec (client_connection_t * cli, query_t * qr,
   qi->qi_no_triggers = caller->qi_no_triggers;
   qi->qi_isolation = caller->qi_isolation;
   qi->qi_lock_mode = caller->qi_lock_mode;
-
+  QI_SERIALIZABLE (qi, qr);
   if (lc)
     {
       memset (lc, 0, sizeof (local_cursor_t));
diff --git a/libsrc/Wi/sqlsrv.c b/libsrc/Wi/sqlsrv.c
index 6dc6786..263773e 100644
--- a/libsrc/Wi/sqlsrv.c
+++ b/libsrc/Wi/sqlsrv.c
@@ -1,7 +1,7 @@
 /*
  *  sqlsrv.c
  *
- *  $Id: sqlsrv.c,v 1.36.2.22 2010/04/15 14:03:57 source Exp $
+ *  $Id: sqlsrv.c,v 1.36.2.27 2011/01/05 12:51:53 source Exp $
  *
  *  SQL server functions
  *
@@ -58,6 +58,7 @@
 #include "shuric.h"
 #include "srvstat.h"
 #include "sqloinv.h"
+#include "uname_const_decl.h"
 
 #ifdef WIN32
 #include <windows.h>
@@ -2396,6 +2397,7 @@ CLI_WRAPPER (sf_sql_free_stmt, (caddr_t stmt_id, int op), (stmt_id, op))
 #define sf_sql_free_stmt sf_sql_free_stmt_w
 #endif
 
+/* in case of rollback don't report txn error as txn is already rolledback */
 caddr_t
 cli_transact (client_connection_t * cli, int op, caddr_t * replicate)
 {
@@ -2413,7 +2415,7 @@ cli_transact (client_connection_t * cli, int op, caddr_t * replicate)
   LEAVE_CLIENT (cli);
   rc = lt_close (lt, op);
   /* lt_close leaves the txn mtx */
-  if (rc == LTE_OK)
+  if (rc == LTE_OK || SQL_ROLLBACK == op)
     {
       res = SQL_SUCCESS;
     }
@@ -3045,8 +3047,7 @@ CLI_WRAPPER (sf_sql_get_data_ac,
 #define sf_sql_get_data_ac sf_sql_get_data_ac_w
 #endif
 
-SERVICE_1 (s_sql_no_threads, ssqlnth, "no_threads", DA_FUTURE_REQUEST,
-		DV_SEND_NO_ANSWER, DV_LONG_INT, 1)
+SERVICE_1 (s_sql_no_threads, ssqlnth, "no_threads", DA_FUTURE_REQUEST, DV_SEND_NO_ANSWER, DV_LONG_INT, 1);
 
 #define NO_THREADS_REPORT_PERIOD   10 * 60 /* 10 min */
 
@@ -3430,7 +3431,7 @@ sql_code_global_init ()
   ddl_sel_for_effect ("select count (*) from DB.DBA.SYS_XPF_EXTENSIONS where xpf_extension (XPE_NAME, XPE_PNAME, 0)");
 #ifdef _SSL
   /* do load of the persisted encryption keys */
-  ddl_sel_for_effect ("select count (*) from DB.DBA.SYS_USERS where U_IS_ROLE = 0 and U_SQL_ENABLE <> 0 and U_OPTS is not null and USER_KEYS_INIT (U_NAME, U_OPTS)");
+  ddl_sel_for_effect ("select count (*) from DB.DBA.SYS_USERS where U_IS_ROLE = 0 and U_OPTS is not null and USER_KEYS_INIT (U_NAME, U_OPTS)");
 #endif
 
   qr_dotnet_get_assembly_real = sql_compile ("SELECT VAC_REAL_NAME from DB.DBA.CLR_VAC where VAC_INTERNAL_NAME=?", bootstrap_cli, NULL, 0);
@@ -3762,7 +3763,7 @@ srv_global_init (char *mode)
  	}
       return;
     }
-
+  uname_const_decl_init ();
 #ifdef BIF_XML
   html_hash_init ();
 #endif
@@ -3900,13 +3901,6 @@ srv_global_init (char *mode)
       read_proc_tables (0);
       sec_read_grants (NULL, NULL, NULL, 1); /* call second time to do read of execute grants */
       ddl_standard_procs ();
-#if REPLICATION_SUPPORT
-      if (!lite_mode)
-	{
-	  repl_init ();
-	  repl_serv_init (0);
-	}
-#endif
     }
   ddl_obackup_init ();
 
diff --git a/libsrc/Wi/sqltype.c b/libsrc/Wi/sqltype.c
index 0662228..a22f1ba 100644
--- a/libsrc/Wi/sqltype.c
+++ b/libsrc/Wi/sqltype.c
@@ -1,7 +1,7 @@
 /*
  *  sqltype.c
  *
- *  $Id: sqltype.c,v 1.16.2.5 2010/03/08 12:04:13 source Exp $
+ *  $Id: sqltype.c,v 1.16.2.8 2010/11/15 16:51:57 source Exp $
  *
  *  User defined types routines
  *
@@ -2240,8 +2240,8 @@ udt_sql_method_call (caddr_t *qst, sql_class_t *udt, caddr_t udi,
 	}
       if (!sec_udt_check_qst (udt, qst, GR_EXECUTE) &&
 	  !sec_proc_check (proc, eff_g_id, eff_u_id))
-	sqlr_new_error ("42000", "SR186", "No permission to execute method %s of type %s.",
-	    mtd->scm_name, mtd->scm_class->scl_name);
+	sqlr_new_error ("42000", "SR186", "No permission to execute method %s of type %s with user ID %d, group ID %d",
+	    mtd->scm_name, mtd->scm_class->scl_name, (int)eff_g_id, (int)eff_u_id );
 
       BOX_AUTO (ptmp, pars_auto, param_len, DV_ARRAY_OF_POINTER);
       pars = (caddr_t *) ptmp;
@@ -3615,7 +3615,10 @@ static void *
 box_read_long_ref (dk_session_t *session, dtp_t dtp)
 {
   size_t length = (size_t) read_long (session);
-  char *ref = (char *) dk_alloc_box (length, DV_REFERENCE);
+  char *ref;
+  if (length >= MAX_BOX_LENGTH)
+    return box_read_error (session, dtp);
+  ref = (char *) dk_alloc_box (length, DV_REFERENCE);
   session_buffered_read (session, ref, (int) length);
   return (void *) ref;
 }
@@ -3623,7 +3626,11 @@ box_read_long_ref (dk_session_t *session, dtp_t dtp)
 caddr_t
 udt_mp_copy (mem_pool_t * mp, caddr_t box)
 {
-  caddr_t cp = xe_make_copy (box);
+  caddr_t cp = NULL;
+  if (UDT_I_CLASS (box) == XMLTYPE_CLASS)
+    cp = xe_make_copy (box);
+  else
+    cp = box_copy (box);
   dk_set_push (&mp->mp_trash, (void*)cp);
   return cp;
 }
diff --git a/libsrc/Wi/sqlver.h b/libsrc/Wi/sqlver.h
index f435010..11036c2 100644
--- a/libsrc/Wi/sqlver.h
+++ b/libsrc/Wi/sqlver.h
@@ -1,7 +1,7 @@
 /*
  *  sqlver.h
  *
- *  $Id: sqlver.h,v 1.49.2.14 2010/02/12 13:00:58 source Exp $
+ *  $Id: sqlver.h,v 1.49.2.15 2011/02/03 09:25:01 source Exp $
  *
  *  Build & Version information, license control
  *
@@ -25,7 +25,7 @@
  *
  */
 
-#define PRODUCT_COPYRIGHT	"Copyright (C) 1998-2010 OpenLink Software"
+#define PRODUCT_COPYRIGHT	"Copyright (C) 1998-2011 OpenLink Software"
 #define PRODUCT_NAME		"OpenLink Virtuoso"
 
 /* DBMS Server */
diff --git a/libsrc/Wi/sqlview.c b/libsrc/Wi/sqlview.c
index f29a54b..ee884fa 100644
--- a/libsrc/Wi/sqlview.c
+++ b/libsrc/Wi/sqlview.c
@@ -1,7 +1,7 @@
 /*
  *  sqlview.c
  *
- *  $Id: sqlview.c,v 1.7.2.3 2010/02/18 10:57:17 source Exp $
+ *  $Id: sqlview.c,v 1.7.2.4 2010/11/15 16:51:57 source Exp $
  *
  *  SQL Compiler, view, derived table, union
  *
@@ -856,14 +856,14 @@ sqlc_copy_union_as (ST * exp, ST * as, int inx)
   return copy;
 }
 
-
 ST **
-sqlc_selection_names (ST * tree)
+sqlc_selection_names (ST * tree, int only_edit_tree)
 {
   int inx;
-  ST ** sel = (ST **) t_box_copy ((caddr_t) tree->_.select_stmt.selection);
+  ST ** sel = (only_edit_tree ? (ST **)(tree->_.select_stmt.selection) : (ST **) t_box_copy ((caddr_t)(tree->_.select_stmt.selection)));
   dk_set_t double_set = NULL;
   dk_set_t names_set = NULL;
+
   /*if (SQLO_ENABLE (sqlc_client()))*/
     {
       DO_BOX (ST *, exp, inx, sel)
@@ -893,15 +893,14 @@ next:;
 	  if (dk_set_member (double_set, (caddr_t) (ptrlong) inx))
 	    {
 	      char tname[100];
-
 	      snprintf (tname, sizeof (tname), "computed%d", inx);
+	      if (!only_edit_tree)
 	      sel[inx] = sqlc_copy_union_as (
-		  (ST*) t_list (3, COL_DOTTED,
-				NULL, t_box_string (tname)),
+		  (ST*) t_list (3, COL_DOTTED, NULL, t_box_string (tname)),
 		  exp, inx);
 	      exp->_.as_exp.name = t_box_string (tname);
 	    }
-	  else
+	  else if (!only_edit_tree)
 	    {
 	      sel[inx] = sqlc_copy_union_as (
 		  (ST*) t_list (3, COL_DOTTED,
@@ -913,6 +912,7 @@ next:;
 	{
 	  tree->_.select_stmt.selection[inx] = (caddr_t) t_list (5,
 	      BOP_AS, exp, NULL, t_box_string (exp->_.col_ref.name), NULL);
+	  if (!only_edit_tree)
 	  sel[inx] = (ST*) t_list (3, COL_DOTTED, NULL, t_box_copy_tree (exp->_.col_ref.name));
 	}
       else
@@ -920,6 +920,7 @@ next:;
 	  char tname[100];
 	  snprintf (tname, sizeof (tname), "computed%d", inx);
 	  tree->_.select_stmt.selection[inx] = (caddr_t) t_list (5, BOP_AS, tree->_.select_stmt.selection[inx], NULL, t_box_string (tname), NULL);
+	  if (!only_edit_tree)
 	  sel[inx] = (ST*) t_list (3, COL_DOTTED, NULL, t_box_string (tname));
 	}
     }
@@ -943,7 +944,7 @@ sqlc_union_dt_wrap (ST * tree)
       texp = sqlp_infoschema_redirect (t_listst (9,
 	    TABLE_EXP, t_list (1, t_list (3, DERIVED_TABLE, tree, t_box_string ("__"))),
 		   NULL, NULL, NULL, order, flags,opts, NULL));
-      sel = (ST*) t_list (5, SELECT_STMT, NULL, sqlc_selection_names (left), NULL,
+      sel = (ST*) t_list (5, SELECT_STMT, NULL, sqlc_selection_names (left, 0), NULL,
 			texp);
       return sel;
     }
@@ -976,7 +977,7 @@ sqlc_top_select_dt (sql_comp_t * sc, ST * tree)
   top = SEL_TOP (tree);
   if (top)
     {
-      ST * out_names = (ST *) sqlc_selection_names (tree);
+      ST * out_names = (ST *) sqlc_selection_names (tree, 0);
       sel = (ST*) /*list*/ t_list (5, SELECT_STMT, top, tree->_.select_stmt.selection, NULL,
 			tree->_.select_stmt.table_exp);
       texp = (ST*) /*list*/ t_list (9, TABLE_EXP,
diff --git a/libsrc/Wi/sqlwords.h b/libsrc/Wi/sqlwords.h
index 16fd4bb..9422bbb 100644
--- a/libsrc/Wi/sqlwords.h
+++ b/libsrc/Wi/sqlwords.h
@@ -34,9 +34,9 @@ struct keyword { char *keiiyword; int token; };
 #define TOTAL_KEYWORDS 312
 #define MIN_WORD_LENGTH 1
 #define MAX_WORD_LENGTH 17
-#define MIN_HASH_VALUE 224
-#define MAX_HASH_VALUE 1733
-/* maximum key range = 1510, duplicates = 0 */
+#define MIN_HASH_VALUE 240
+#define MAX_HASH_VALUE 2466
+/* maximum key range = 2227, duplicates = 0 */
 
 #ifdef __GNUC__
 __inline
@@ -50,32 +50,32 @@ hash (register const char *str, register unsigned int len)
 {
   static const unsigned short asso_values[] =
     {
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734,   18, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734,  232,  290,  295,  124,  118,
-       484,   10,   92,  262,  160,   80,  326,  307,   46,  152,
-       383,  146,   35,   11,  300,  231,  216,  365,  168,  384,
-       132, 1734, 1734, 1734, 1734,  178, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734,
-      1734, 1734, 1734, 1734, 1734, 1734, 1734
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467,  259, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467,  232,   19,  361,   71,   43,
+       463,   89,   47,   56,  130,   77,  149,  443,  448,  446,
+       186,  375,  379,  113,  376,   92,  463,   41,  324,  333,
+       435, 2467, 2467, 2467, 2467,  118, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467, 2467,
+      2467, 2467, 2467, 2467, 2467, 2467, 2467
     };
   register int hval = len;
 
@@ -106,630 +106,630 @@ hash (register const char *str, register unsigned int len)
 
 static const struct keyword wordlist[] =
   {
-#line 217 "./sqlwords.gperf"
-    {"OR", OR},
-#line 214 "./sqlwords.gperf"
-    {"ON", ON},
-#line 50 "./sqlwords.gperf"
-    {"AS", AS},
+#line 333 "./sqlwords.gperf"
+    {"WITH", WITH},
+#line 58 "./sqlwords.gperf"
+    {"BEFORE", BEFORE},
+#line 332 "./sqlwords.gperf"
+    {"WHILE", WHILE},
 #line 176 "./sqlwords.gperf"
     {"IS", IS},
-#line 146 "./sqlwords.gperf"
-    {"GO", GO},
-#line 274 "./sqlwords.gperf"
-    {"SOME", SOME},
-#line 218 "./sqlwords.gperf"
-    {"ORDER", ORDER},
-#line 204 "./sqlwords.gperf"
-    {"NO", NO_L},
-#line 157 "./sqlwords.gperf"
-    {"IN", IN_L},
-#line 261 "./sqlwords.gperf"
-    {"SAFE", SAFE_L},
-#line 124 "./sqlwords.gperf"
-    {"END", ENDX},
+#line 125 "./sqlwords.gperf"
+    {"ESCAPE", ESCAPE},
+#line 186 "./sqlwords.gperf"
+    {"LEVEL", LEVEL_L},
+#line 188 "./sqlwords.gperf"
+    {"LIKE", LIKE},
+#line 317 "./sqlwords.gperf"
+    {"UPDATE", UPDATE},
+#line 40 "./sqlwords.gperf"
+    {"ADD", ADD},
+#line 27 "./sqlwords.gperf"
+    {"__TAG", __TAG_L},
 #line 320 "./sqlwords.gperf"
     {"USING", USING},
-#line 243 "./sqlwords.gperf"
-    {"REFERENCES", REFERENCES},
-#line 115 "./sqlwords.gperf"
-    {"DO", DO},
-#line 314 "./sqlwords.gperf"
-    {"UNDER", UNDER},
-#line 245 "./sqlwords.gperf"
-    {"REMOTE", REMOTE},
-#line 198 "./sqlwords.gperf"
-    {"NAME", NAME_L},
-#line 254 "./sqlwords.gperf"
-    {"RETURNS", RETURNS},
-#line 41 "./sqlwords.gperf"
-    {"ADMIN", ADMIN_L},
+#line 236 "./sqlwords.gperf"
+    {"PURGE", PURGE},
+#line 104 "./sqlwords.gperf"
+    {"DATE", DATE_L},
+#line 50 "./sqlwords.gperf"
+    {"AS", AS},
+#line 261 "./sqlwords.gperf"
+    {"SAFE", SAFE_L},
+#line 105 "./sqlwords.gperf"
+    {"DATETIME", DATETIME},
+#line 152 "./sqlwords.gperf"
+    {"HAVING", HAVING},
+#line 239 "./sqlwords.gperf"
+    {"READ", READ_L},
+#line 228 "./sqlwords.gperf"
+    {"PLI", PLI},
+#line 64 "./sqlwords.gperf"
+    {"BITMAP", BITMAPPED},
+#line 43 "./sqlwords.gperf"
+    {"AGGREGATE", AGGREGATE},
+#line 255 "./sqlwords.gperf"
+    {"REVOKE", REVOKE},
+#line 39 "./sqlwords.gperf"
+    {"ADA", ADA},
 #line 240 "./sqlwords.gperf"
     {"READS", READS},
-#line 129 "./sqlwords.gperf"
-    {"EXISTS", EXISTS},
-#line 273 "./sqlwords.gperf"
-    {"SOFT", SOFT},
-#line 253 "./sqlwords.gperf"
-    {"RETURN", RETURN},
-#line 315 "./sqlwords.gperf"
-    {"UNION", UNION},
-#line 125 "./sqlwords.gperf"
-    {"ESCAPE", ESCAPE},
-#line 238 "./sqlwords.gperf"
-    {"RDF_BOX", RDF_BOX_L},
-#line 164 "./sqlwords.gperf"
-    {"INNER", INNER},
-#line 181 "./sqlwords.gperf"
-    {"JOIN", JOIN},
-#line 46 "./sqlwords.gperf"
-    {"AND", AND},
-#line 270 "./sqlwords.gperf"
-    {"SHUTDOWN", SHUTDOWN},
-#line 107 "./sqlwords.gperf"
-    {"DECLARE", DECLARE},
-#line 327 "./sqlwords.gperf"
-    {"VECTOR", VECTOR_L},
-#line 94 "./sqlwords.gperf"
-    {"CORRESPONDING", CORRESPONDING},
-#line 262 "./sqlwords.gperf"
-    {"SAME_AS", SAME_AS},
-#line 246 "./sqlwords.gperf"
-    {"RENAME", RENAME},
-#line 147 "./sqlwords.gperf"
-    {"GOTO", GOTO},
 #line 59 "./sqlwords.gperf"
     {"BEGIN", BEGINX},
+#line 118 "./sqlwords.gperf"
+    {"DTD", DTD},
+#line 106 "./sqlwords.gperf"
+    {"DECIMAL", DECIMAL_L},
+#line 337 "./sqlwords.gperf"
+    {"XPATH", XPATH},
+#line 241 "./sqlwords.gperf"
+    {"REAL", REAL},
+#line 331 "./sqlwords.gperf"
+    {"WHERE", WHERE},
+#line 122 "./sqlwords.gperf"
+    {"ENABLE", ENABLE_L},
+#line 124 "./sqlwords.gperf"
+    {"END", ENDX},
+#line 107 "./sqlwords.gperf"
+    {"DECLARE", DECLARE},
+#line 120 "./sqlwords.gperf"
+    {"ELSE", ELSE},
+#line 276 "./sqlwords.gperf"
+    {"SPARQL", SPARQL_L},
+#line 269 "./sqlwords.gperf"
+    {"SET", SET},
+#line 103 "./sqlwords.gperf"
+    {"DATA", DATA},
+#line 180 "./sqlwords.gperf"
+    {"JAVA", JAVA},
+#line 127 "./sqlwords.gperf"
+    {"EXCLUSIVE", EXCLUSIVE},
+#line 109 "./sqlwords.gperf"
+    {"DELETE", DELETE_L},
+#line 133 "./sqlwords.gperf"
+    {"FETCH", FETCH},
+#line 61 "./sqlwords.gperf"
+    {"BETWEEN", BETWEEN},
+#line 185 "./sqlwords.gperf"
+    {"LEFT", LEFT},
+#line 334 "./sqlwords.gperf"
+    {"WITHOUT", WITHOUT_L},
+#line 335 "./sqlwords.gperf"
+    {"WORK", WORK},
+#line 66 "./sqlwords.gperf"
+    {"BY", BY},
+#line 57 "./sqlwords.gperf"
+    {"BACKUP", BACKUP},
+#line 112 "./sqlwords.gperf"
+    {"DISABLE", DISABLE_L},
+#line 268 "./sqlwords.gperf"
+    {"SERIALIZABLE", SERIALIZABLE_L},
+#line 153 "./sqlwords.gperf"
+    {"HASH", HASH},
 #line 244 "./sqlwords.gperf"
     {"REFERENCING", REFERENCING},
-#line 282 "./sqlwords.gperf"
-    {"SQLWARNING", SQLWARNING},
-#line 285 "./sqlwords.gperf"
-    {"STYLE", STYLE},
+#line 213 "./sqlwords.gperf"
+    {"OLD", OLD},
+#line 178 "./sqlwords.gperf"
+    {"IRI_ID", IRI_ID},
+#line 318 "./sqlwords.gperf"
+    {"USE", USE},
 #line 123 "./sqlwords.gperf"
     {"ENCODING", ENCODING},
-#line 239 "./sqlwords.gperf"
-    {"READ", READ_L},
-#line 296 "./sqlwords.gperf"
-    {"T_MIN", T_MIN},
-#line 190 "./sqlwords.gperf"
-    {"LOG", LOGX},
-#line 43 "./sqlwords.gperf"
-    {"AGGREGATE", AGGREGATE},
+#line 243 "./sqlwords.gperf"
+    {"REFERENCES", REFERENCES},
 #line 67 "./sqlwords.gperf"
     {"C", C},
+#line 193 "./sqlwords.gperf"
+    {"METHOD", METHOD},
+#line 129 "./sqlwords.gperf"
+    {"EXISTS", EXISTS},
+#line 190 "./sqlwords.gperf"
+    {"LOG", LOGX},
+#line 108 "./sqlwords.gperf"
+    {"DEFAULT", DEFAULT},
+#line 78 "./sqlwords.gperf"
+    {"CLOSE", CLOSE},
+#line 316 "./sqlwords.gperf"
+    {"UNIQUE", UNIQUE},
+#line 155 "./sqlwords.gperf"
+    {"IDENTIFIED", IDENTIFIED},
+#line 51 "./sqlwords.gperf"
+    {"ASC", ASC},
+#line 46 "./sqlwords.gperf"
+    {"AND", AND},
+#line 53 "./sqlwords.gperf"
+    {"ATTACH", ATTACH},
+#line 150 "./sqlwords.gperf"
+    {"GROUPING", GROUPING},
+#line 73 "./sqlwords.gperf"
+    {"CHAR", CHARACTER},
+#line 54 "./sqlwords.gperf"
+    {"ATTRIBUTE", ATTRIBUTE},
+#line 60 "./sqlwords.gperf"
+    {"BEST", BEST},
+#line 117 "./sqlwords.gperf"
+    {"DROP", DROP},
+#line 149 "./sqlwords.gperf"
+    {"GROUP", GROUP},
+#line 110 "./sqlwords.gperf"
+    {"DESC", DESC},
+#line 45 "./sqlwords.gperf"
+    {"ALTER", ALTER},
+#line 201 "./sqlwords.gperf"
+    {"NEW", NEW},
+#line 97 "./sqlwords.gperf"
+    {"CUBE", CUBE},
+#line 257 "./sqlwords.gperf"
+    {"RIGHT", RIGHT},
+#line 148 "./sqlwords.gperf"
+    {"GRANT", GRANT},
 #line 160 "./sqlwords.gperf"
     {"INDEX", INDEX},
-#line 197 "./sqlwords.gperf"
-    {"MUMPS", MUMPS},
-#line 40 "./sqlwords.gperf"
-    {"ADD", ADD},
-#line 27 "./sqlwords.gperf"
-    {"__TAG", __TAG_L},
-#line 308 "./sqlwords.gperf"
-    {"TO", TO},
+#line 132 "./sqlwords.gperf"
+    {"EXIT", EXIT},
+#line 326 "./sqlwords.gperf"
+    {"VARIABLE", VARIABLE},
+#line 62 "./sqlwords.gperf"
+    {"BIGINT", BIGINT},
+#line 284 "./sqlwords.gperf"
+    {"START", START_L},
+#line 182 "./sqlwords.gperf"
+    {"KEY", KEY},
+#line 256 "./sqlwords.gperf"
+    {"REXECUTE", REXECUTE},
 #line 179 "./sqlwords.gperf"
     {"IRI_ID_8", IRI_ID_8},
-#line 335 "./sqlwords.gperf"
-    {"WORK", WORK},
-#line 102 "./sqlwords.gperf"
-    {"CURSOR", CURSOR},
-#line 260 "./sqlwords.gperf"
-    {"ROLE", ROLE_L},
-#line 275 "./sqlwords.gperf"
-    {"SOURCE", SOURCE},
-#line 248 "./sqlwords.gperf"
-    {"REPLACING", REPLACING},
-#line 88 "./sqlwords.gperf"
-    {"COMPRESS", COMPRESS},
-#line 151 "./sqlwords.gperf"
-    {"HANDLER", HANDLER},
-#line 148 "./sqlwords.gperf"
-    {"GRANT", GRANT},
-#line 200 "./sqlwords.gperf"
-    {"NCHAR", NCHAR},
-#line 191 "./sqlwords.gperf"
-    {"LONG", LONG_L},
+#line 234 "./sqlwords.gperf"
+    {"PROCEDURE", PROCEDURE},
+#line 306 "./sqlwords.gperf"
+    {"TIME", TIME},
+#line 161 "./sqlwords.gperf"
+    {"INDEX_NO_FILL", INDEX_NO_FILL},
+#line 75 "./sqlwords.gperf"
+    {"CHECK", CHECK},
+#line 157 "./sqlwords.gperf"
+    {"IN", IN_L},
+#line 246 "./sqlwords.gperf"
+    {"RENAME", RENAME},
+#line 145 "./sqlwords.gperf"
+    {"GENERATED", GENERATED},
+#line 245 "./sqlwords.gperf"
+    {"REMOTE", REMOTE},
+#line 56 "./sqlwords.gperf"
+    {"AUTOREGISTER", AUTOREGISTER_L},
+#line 115 "./sqlwords.gperf"
+    {"DO", DO},
+#line 144 "./sqlwords.gperf"
+    {"GENERAL", GENERAL},
+#line 314 "./sqlwords.gperf"
+    {"UNDER", UNDER},
+#line 192 "./sqlwords.gperf"
+    {"LOOP", LOOP},
+#line 285 "./sqlwords.gperf"
+    {"STYLE", STYLE},
+#line 170 "./sqlwords.gperf"
+    {"INT", INTEGER},
+#line 44 "./sqlwords.gperf"
+    {"ALL", ALL},
 #line 242 "./sqlwords.gperf"
     {"REF", REF},
-#line 220 "./sqlwords.gperf"
-    {"OUTER", OUTER},
-#line 313 "./sqlwords.gperf"
-    {"TRIGGER", TRIGGER},
-#line 58 "./sqlwords.gperf"
-    {"BEFORE", BEFORE},
-#line 269 "./sqlwords.gperf"
-    {"SET", SET},
-#line 51 "./sqlwords.gperf"
-    {"ASC", ASC},
-#line 127 "./sqlwords.gperf"
-    {"EXCLUSIVE", EXCLUSIVE},
-#line 49 "./sqlwords.gperf"
-    {"ARRAY", ARRAY},
-#line 118 "./sqlwords.gperf"
-    {"DTD", DTD},
+#line 146 "./sqlwords.gperf"
+    {"GO", GO},
+#line 156 "./sqlwords.gperf"
+    {"IF", IF},
+#line 154 "./sqlwords.gperf"
+    {"IDENTITY", IDENTITY},
+#line 82 "./sqlwords.gperf"
+    {"COALESCE", COALESCE},
+#line 76 "./sqlwords.gperf"
+    {"CHECKED", CHECKED},
+#line 265 "./sqlwords.gperf"
+    {"SCHEMA", SCHEMA},
+#line 329 "./sqlwords.gperf"
+    {"WHEN", WHEN},
 #line 81 "./sqlwords.gperf"
     {"CLR", CLR},
-#line 316 "./sqlwords.gperf"
-    {"UNIQUE", UNIQUE},
-#line 136 "./sqlwords.gperf"
-    {"FOR", FOR},
-#line 209 "./sqlwords.gperf"
-    {"NVARCHAR", NVARCHAR},
-#line 294 "./sqlwords.gperf"
-    {"T_IN", T_IN},
-#line 257 "./sqlwords.gperf"
-    {"RIGHT", RIGHT},
-#line 175 "./sqlwords.gperf"
-    {"INTO", INTO},
-#line 122 "./sqlwords.gperf"
-    {"ENABLE", ENABLE_L},
-#line 295 "./sqlwords.gperf"
-    {"T_MAX", T_MAX},
+#line 219 "./sqlwords.gperf"
+    {"OUT", OUT_L},
+#line 233 "./sqlwords.gperf"
+    {"PRIVILEGES", PRIVILEGES},
+#line 272 "./sqlwords.gperf"
+    {"SNAPSHOT", SNAPSHOT},
+#line 305 "./sqlwords.gperf"
+    {"TIES", TIES},
+#line 220 "./sqlwords.gperf"
+    {"OUTER", OUTER},
+#line 271 "./sqlwords.gperf"
+    {"SMALLINT", SMALLINT},
+#line 71 "./sqlwords.gperf"
+    {"CASE", CASE},
+#line 301 "./sqlwords.gperf"
+    {"TABLE", TABLE},
+#line 196 "./sqlwords.gperf"
+    {"MODULE", MODULE},
 #line 171 "./sqlwords.gperf"
     {"INTEGER", INTEGER},
-#line 201 "./sqlwords.gperf"
-    {"NEW", NEW},
-#line 150 "./sqlwords.gperf"
-    {"GROUPING", GROUPING},
-#line 104 "./sqlwords.gperf"
-    {"DATE", DATE_L},
-#line 138 "./sqlwords.gperf"
-    {"FOREIGN", FOREIGN},
-#line 178 "./sqlwords.gperf"
-    {"IRI_ID", IRI_ID},
-#line 279 "./sqlwords.gperf"
-    {"SQLCODE", SQLCODE},
-#line 152 "./sqlwords.gperf"
-    {"HAVING", HAVING},
-#line 73 "./sqlwords.gperf"
-    {"CHAR", CHARACTER},
-#line 182 "./sqlwords.gperf"
-    {"KEY", KEY},
-#line 153 "./sqlwords.gperf"
-    {"HASH", HASH},
-#line 213 "./sqlwords.gperf"
-    {"OLD", OLD},
+#line 328 "./sqlwords.gperf"
+    {"VIEW", VIEW},
+#line 273 "./sqlwords.gperf"
+    {"SOFT", SOFT},
 #line 96 "./sqlwords.gperf"
     {"CROSS", CROSS},
-#line 306 "./sqlwords.gperf"
-    {"TIME", TIME},
-#line 203 "./sqlwords.gperf"
-    {"NOT", NOT},
-#line 325 "./sqlwords.gperf"
-    {"VARCHAR", VARCHAR},
-#line 116 "./sqlwords.gperf"
-    {"DOUBLE", DOUBLE_L},
-#line 163 "./sqlwords.gperf"
-    {"INDICATOR", INDICATOR},
-#line 332 "./sqlwords.gperf"
-    {"WHILE", WHILE},
-#line 272 "./sqlwords.gperf"
-    {"SNAPSHOT", SNAPSHOT},
-#line 236 "./sqlwords.gperf"
-    {"PURGE", PURGE},
-#line 132 "./sqlwords.gperf"
-    {"EXIT", EXIT},
-#line 185 "./sqlwords.gperf"
-    {"LEFT", LEFT},
-#line 166 "./sqlwords.gperf"
-    {"INPUT", INPUT},
-#line 255 "./sqlwords.gperf"
-    {"REVOKE", REVOKE},
+#line 175 "./sqlwords.gperf"
+    {"INTO", INTO},
 #line 319 "./sqlwords.gperf"
     {"USER", USER},
-#line 145 "./sqlwords.gperf"
-    {"GENERATED", GENERATED},
-#line 92 "./sqlwords.gperf"
-    {"CONTINUE", CONTINUE},
-#line 241 "./sqlwords.gperf"
-    {"REAL", REAL},
-#line 168 "./sqlwords.gperf"
-    {"INSTANCE", INSTANCE_L},
-#line 323 "./sqlwords.gperf"
-    {"VALUES", VALUES},
-#line 109 "./sqlwords.gperf"
-    {"DELETE", DELETE_L},
+#line 279 "./sqlwords.gperf"
+    {"SQLCODE", SQLCODE},
+#line 274 "./sqlwords.gperf"
+    {"SOME", SOME},
+#line 299 "./sqlwords.gperf"
+    {"T_OUT", T_OUT},
+#line 49 "./sqlwords.gperf"
+    {"ARRAY", ARRAY},
+#line 130 "./sqlwords.gperf"
+    {"EXTERNAL", EXTERNAL},
+#line 26 "./sqlwords.gperf"
+    {"__COST", __COST},
+#line 267 "./sqlwords.gperf"
+    {"SELF", SELF_L},
+#line 210 "./sqlwords.gperf"
+    {"OBJECT_ID", OBJECT_ID},
+#line 165 "./sqlwords.gperf"
+    {"INOUT", INOUT_L},
+#line 116 "./sqlwords.gperf"
+    {"DOUBLE", DOUBLE_L},
+#line 294 "./sqlwords.gperf"
+    {"T_IN", T_IN},
+#line 147 "./sqlwords.gperf"
+    {"GOTO", GOTO},
+#line 111 "./sqlwords.gperf"
+    {"DETERMINISTIC", DETERMINISTIC},
+#line 52 "./sqlwords.gperf"
+    {"ASSEMBLY", ASSEMBLY_L},
+#line 254 "./sqlwords.gperf"
+    {"RETURNS", RETURNS},
 #line 278 "./sqlwords.gperf"
     {"SQL", SQL_L},
-#line 189 "./sqlwords.gperf"
-    {"LOCATOR", LOCATOR},
-#line 47 "./sqlwords.gperf"
-    {"ANY", ANY},
-#line 61 "./sqlwords.gperf"
-    {"BETWEEN", BETWEEN},
-#line 258 "./sqlwords.gperf"
-    {"ROLLBACK", ROLLBACK},
-#line 149 "./sqlwords.gperf"
-    {"GROUP", GROUP},
-#line 196 "./sqlwords.gperf"
-    {"MODULE", MODULE},
-#line 281 "./sqlwords.gperf"
-    {"SQLSTATE", SQLSTATE_L},
-#line 103 "./sqlwords.gperf"
-    {"DATA", DATA},
-#line 268 "./sqlwords.gperf"
-    {"SERIALIZABLE", SERIALIZABLE_L},
-#line 45 "./sqlwords.gperf"
-    {"ALTER", ALTER},
-#line 250 "./sqlwords.gperf"
-    {"RESIGNAL", RESIGNAL},
-#line 99 "./sqlwords.gperf"
-    {"CURRENT_DATE", CURRENT_DATE},
-#line 110 "./sqlwords.gperf"
-    {"DESC", DESC},
-#line 170 "./sqlwords.gperf"
-    {"INT", INTEGER},
-#line 144 "./sqlwords.gperf"
-    {"GENERAL", GENERAL},
-#line 286 "./sqlwords.gperf"
-    {"SYNC", SYNC},
-#line 318 "./sqlwords.gperf"
-    {"USE", USE},
-#line 85 "./sqlwords.gperf"
-    {"COLUMN", COLUMN},
+#line 32 "./sqlwords.gperf"
+    {"__SOAP_NAME", __SOAP_NAME},
+#line 70 "./sqlwords.gperf"
+    {"CASCADE", CASCADE},
+#line 289 "./sqlwords.gperf"
+    {"T_DIRECTION", T_DIRECTION},
+#line 223 "./sqlwords.gperf"
+    {"PASCAL", PASCAL_L},
+#line 197 "./sqlwords.gperf"
+    {"MUMPS", MUMPS},
 #line 195 "./sqlwords.gperf"
     {"MODIFIES", MODIFIES},
-#line 216 "./sqlwords.gperf"
-    {"OPTION", OPTION},
-#line 225 "./sqlwords.gperf"
-    {"PERCENT", PERCENT},
-#line 120 "./sqlwords.gperf"
-    {"ELSE", ELSE},
-#line 56 "./sqlwords.gperf"
-    {"AUTOREGISTER", AUTOREGISTER_L},
+#line 184 "./sqlwords.gperf"
+    {"LANGUAGE", LANGUAGE},
+#line 38 "./sqlwords.gperf"
+    {"__SOAP_OPTIONS", __SOAP_OPTIONS},
+#line 275 "./sqlwords.gperf"
+    {"SOURCE", SOURCE},
+#line 134 "./sqlwords.gperf"
+    {"FINAL", FINAL_L},
 #line 48 "./sqlwords.gperf"
     {"ARE", ARE},
-#line 82 "./sqlwords.gperf"
-    {"COALESCE", COALESCE},
-#line 326 "./sqlwords.gperf"
-    {"VARIABLE", VARIABLE},
-#line 322 "./sqlwords.gperf"
-    {"VALUE", VALUE},
-#line 227 "./sqlwords.gperf"
-    {"PERSISTENT", PERSISTENT},
-#line 91 "./sqlwords.gperf"
-    {"CONTAINS", CONTAINS},
-#line 39 "./sqlwords.gperf"
-    {"ADA", ADA},
-#line 108 "./sqlwords.gperf"
-    {"DEFAULT", DEFAULT},
-#line 208 "./sqlwords.gperf"
-    {"NUMERIC", NUMERIC},
-#line 98 "./sqlwords.gperf"
-    {"CURRENT", CURRENT},
-#line 256 "./sqlwords.gperf"
-    {"REXECUTE", REXECUTE},
-#line 130 "./sqlwords.gperf"
-    {"EXTERNAL", EXTERNAL},
-#line 284 "./sqlwords.gperf"
-    {"START", START_L},
-#line 193 "./sqlwords.gperf"
-    {"METHOD", METHOD},
-#line 249 "./sqlwords.gperf"
-    {"REPLICATION", REPLICATION},
-#line 206 "./sqlwords.gperf"
-    {"NULL", NULLX},
-#line 219 "./sqlwords.gperf"
-    {"OUT", OUT_L},
-#line 173 "./sqlwords.gperf"
-    {"INTERNAL", INTERNAL},
-#line 267 "./sqlwords.gperf"
-    {"SELF", SELF_L},
-#line 304 "./sqlwords.gperf"
-    {"THEN", THEN},
-#line 117 "./sqlwords.gperf"
-    {"DROP", DROP},
-#line 133 "./sqlwords.gperf"
-    {"FETCH", FETCH},
-#line 106 "./sqlwords.gperf"
-    {"DECIMAL", DECIMAL_L},
-#line 139 "./sqlwords.gperf"
-    {"FORTRAN", FORTRAN},
-#line 183 "./sqlwords.gperf"
-    {"KEYSET", KEYSET},
-#line 337 "./sqlwords.gperf"
-    {"XPATH", XPATH},
-#line 93 "./sqlwords.gperf"
-    {"CONVERT", CONVERT},
-#line 97 "./sqlwords.gperf"
-    {"CUBE", CUBE},
-#line 298 "./sqlwords.gperf"
-    {"T_NO_ORDER", T_NO_ORDER},
-#line 71 "./sqlwords.gperf"
-    {"CASE", CASE},
-#line 301 "./sqlwords.gperf"
-    {"TABLE", TABLE},
+#line 315 "./sqlwords.gperf"
+    {"UNION", UNION},
 #line 310 "./sqlwords.gperf"
     {"TYPE", TYPE},
-#line 53 "./sqlwords.gperf"
-    {"ATTACH", ATTACH},
-#line 333 "./sqlwords.gperf"
-    {"WITH", WITH},
-#line 75 "./sqlwords.gperf"
-    {"CHECK", CHECK},
-#line 169 "./sqlwords.gperf"
-    {"INSTEAD", INSTEAD},
+#line 303 "./sqlwords.gperf"
+    {"TEXT", TEXT_L},
+#line 191 "./sqlwords.gperf"
+    {"LONG", LONG_L},
+#line 206 "./sqlwords.gperf"
+    {"NULL", NULLX},
+#line 99 "./sqlwords.gperf"
+    {"CURRENT_DATE", CURRENT_DATE},
+#line 262 "./sqlwords.gperf"
+    {"SAME_AS", SAME_AS},
+#line 65 "./sqlwords.gperf"
+    {"BREAKUP", BREAKUP},
+#line 142 "./sqlwords.gperf"
+    {"FULL", FULL},
+#line 151 "./sqlwords.gperf"
+    {"HANDLER", HANDLER},
+#line 162 "./sqlwords.gperf"
+    {"INDEX_ONLY", INDEX_ONLY},
+#line 181 "./sqlwords.gperf"
+    {"JOIN", JOIN},
+#line 199 "./sqlwords.gperf"
+    {"NATURAL", NATURAL},
+#line 80 "./sqlwords.gperf"
+    {"CLUSTERED", CLUSTERED},
 #line 293 "./sqlwords.gperf"
     {"T_FINAL_AS", T_FINAL_AS},
-#line 317 "./sqlwords.gperf"
-    {"UPDATE", UPDATE},
-#line 105 "./sqlwords.gperf"
-    {"DATETIME", DATETIME},
-#line 90 "./sqlwords.gperf"
-    {"CONSTRUCTOR", CONSTRUCTOR},
-#line 140 "./sqlwords.gperf"
-    {"FOUND", FOUND},
-#line 309 "./sqlwords.gperf"
-    {"TOP", TOP},
 #line 42 "./sqlwords.gperf"
     {"AFTER", AFTER},
-#line 226 "./sqlwords.gperf"
-    {"PERMISSION_SET", PERMISSION_SET},
-#line 89 "./sqlwords.gperf"
-    {"CONSTRAINT", CONSTRAINT},
-#line 329 "./sqlwords.gperf"
-    {"WHEN", WHEN},
+#line 225 "./sqlwords.gperf"
+    {"PERCENT", PERCENT},
+#line 198 "./sqlwords.gperf"
+    {"NAME", NAME_L},
+#line 288 "./sqlwords.gperf"
+    {"T_CYCLES_ONLY", T_CYCLES_ONLY},
+#line 135 "./sqlwords.gperf"
+    {"FLOAT", FLOAT_L},
+#line 69 "./sqlwords.gperf"
+    {"CALLED", CALLED},
+#line 33 "./sqlwords.gperf"
+    {"__SOAP_TYPE", __SOAP_TYPE},
+#line 322 "./sqlwords.gperf"
+    {"VALUE", VALUE},
+#line 68 "./sqlwords.gperf"
+    {"CALL", CALL},
+#line 169 "./sqlwords.gperf"
+    {"INSTEAD", INSTEAD},
 #line 292 "./sqlwords.gperf"
     {"T_EXISTS", T_EXISTS},
-#line 180 "./sqlwords.gperf"
-    {"JAVA", JAVA},
-#line 165 "./sqlwords.gperf"
-    {"INOUT", INOUT_L},
-#line 79 "./sqlwords.gperf"
-    {"CLUSTER", CLUSTER},
-#line 232 "./sqlwords.gperf"
-    {"PRIMARY", PRIMARY},
-#line 60 "./sqlwords.gperf"
-    {"BEST", BEST},
-#line 100 "./sqlwords.gperf"
-    {"CURRENT_TIME", CURRENT_TIME},
-#line 230 "./sqlwords.gperf"
-    {"PRECISION", PRECISION},
+#line 63 "./sqlwords.gperf"
+    {"BINARY", BINARY},
 #line 126 "./sqlwords.gperf"
     {"EXCEPT", EXCEPT},
-#line 264 "./sqlwords.gperf"
-    {"UNRESTRICTED", UNRESTRICTED_L},
-#line 55 "./sqlwords.gperf"
-    {"AUTHORIZATION", AUTHORIZATION},
+#line 173 "./sqlwords.gperf"
+    {"INTERNAL", INTERNAL},
+#line 131 "./sqlwords.gperf"
+    {"EXTRACT", EXTRACT},
+#line 41 "./sqlwords.gperf"
+    {"ADMIN", ADMIN_L},
+#line 217 "./sqlwords.gperf"
+    {"OR", OR},
+#line 281 "./sqlwords.gperf"
+    {"SQLSTATE", SQLSTATE_L},
+#line 174 "./sqlwords.gperf"
+    {"INTERVAL", INTERVAL},
+#line 36 "./sqlwords.gperf"
+    {"__SOAP_DIME_ENC", __SOAP_DIME_ENC},
+#line 30 "./sqlwords.gperf"
+    {"__SOAP_HEADER", __SOAP_HEADER},
+#line 283 "./sqlwords.gperf"
+    {"STATIC", STATIC_L},
 #line 251 "./sqlwords.gperf"
     {"RESTRICT", RESTRICT},
-#line 222 "./sqlwords.gperf"
-    {"PARTITION", PARTITION},
-#line 289 "./sqlwords.gperf"
-    {"T_DIRECTION", T_DIRECTION},
-#line 188 "./sqlwords.gperf"
-    {"LIKE", LIKE},
-#line 265 "./sqlwords.gperf"
-    {"SCHEMA", SCHEMA},
-#line 114 "./sqlwords.gperf"
-    {"DISTINCT", DISTINCT},
-#line 137 "./sqlwords.gperf"
-    {"FOREACH", FOREACH},
-#line 266 "./sqlwords.gperf"
-    {"SELECT", SELECT},
-#line 233 "./sqlwords.gperf"
-    {"PRIVILEGES", PRIVILEGES},
-#line 87 "./sqlwords.gperf"
-    {"COMMITTED", COMMITTED_L},
-#line 74 "./sqlwords.gperf"
-    {"CHARACTER", CHARACTER},
-#line 247 "./sqlwords.gperf"
-    {"REPEATABLE", REPEATABLE_L},
+#line 200 "./sqlwords.gperf"
+    {"NCHAR", NCHAR},
+#line 218 "./sqlwords.gperf"
+    {"ORDER", ORDER},
+#line 128 "./sqlwords.gperf"
+    {"EXECUTE", EXECUTE},
+#line 286 "./sqlwords.gperf"
+    {"SYNC", SYNC},
+#line 166 "./sqlwords.gperf"
+    {"INPUT", INPUT},
+#line 308 "./sqlwords.gperf"
+    {"TO", TO},
+#line 295 "./sqlwords.gperf"
+    {"T_MAX", T_MAX},
+#line 119 "./sqlwords.gperf"
+    {"DYNAMIC", DYNAMIC},
+#line 187 "./sqlwords.gperf"
+    {"LIBRARY", LIBRARY_L},
+#line 227 "./sqlwords.gperf"
+    {"PERSISTENT", PERSISTENT},
+#line 226 "./sqlwords.gperf"
+    {"PERMISSION_SET", PERMISSION_SET},
 #line 95 "./sqlwords.gperf"
     {"CREATE", CREATE},
-#line 177 "./sqlwords.gperf"
-    {"ISOLATION", ISOLATION_L},
-#line 252 "./sqlwords.gperf"
-    {"RESULT", RESULT},
-#line 66 "./sqlwords.gperf"
-    {"BY", BY},
-#line 305 "./sqlwords.gperf"
-    {"TIES", TIES},
-#line 331 "./sqlwords.gperf"
-    {"WHERE", WHERE},
-#line 184 "./sqlwords.gperf"
-    {"LANGUAGE", LANGUAGE},
-#line 215 "./sqlwords.gperf"
-    {"OPEN", OPEN},
+#line 29 "./sqlwords.gperf"
+    {"__SOAP_DOCW", __SOAP_DOCW},
+#line 34 "./sqlwords.gperf"
+    {"__SOAP_XML_TYPE", __SOAP_XML_TYPE},
+#line 37 "./sqlwords.gperf"
+    {"__SOAP_ENC_MIME", __SOAP_ENC_MIME},
+#line 183 "./sqlwords.gperf"
+    {"KEYSET", KEYSET},
+#line 313 "./sqlwords.gperf"
+    {"TRIGGER", TRIGGER},
+#line 260 "./sqlwords.gperf"
+    {"ROLE", ROLE_L},
+#line 238 "./sqlwords.gperf"
+    {"RDF_BOX", RDF_BOX_L},
+#line 224 "./sqlwords.gperf"
+    {"PASSWORD", PASSWORD},
 #line 83 "./sqlwords.gperf"
     {"COBOL", COBOL},
-#line 199 "./sqlwords.gperf"
-    {"NATURAL", NATURAL},
-#line 70 "./sqlwords.gperf"
-    {"CASCADE", CASCADE},
-#line 210 "./sqlwords.gperf"
-    {"OBJECT_ID", OBJECT_ID},
-#line 26 "./sqlwords.gperf"
-    {"__COST", __COST},
-#line 69 "./sqlwords.gperf"
-    {"CALLED", CALLED},
-#line 174 "./sqlwords.gperf"
-    {"INTERVAL", INTERVAL},
-#line 86 "./sqlwords.gperf"
-    {"COMMIT", COMMIT},
-#line 303 "./sqlwords.gperf"
-    {"TEXT", TEXT_L},
+#line 102 "./sqlwords.gperf"
+    {"CURSOR", CURSOR},
+#line 164 "./sqlwords.gperf"
+    {"INNER", INNER},
+#line 114 "./sqlwords.gperf"
+    {"DISTINCT", DISTINCT},
+#line 304 "./sqlwords.gperf"
+    {"THEN", THEN},
+#line 327 "./sqlwords.gperf"
+    {"VECTOR", VECTOR_L},
+#line 204 "./sqlwords.gperf"
+    {"NO", NO_L},
+#line 214 "./sqlwords.gperf"
+    {"ON", ON},
+#line 248 "./sqlwords.gperf"
+    {"REPLACING", REPLACING},
+#line 312 "./sqlwords.gperf"
+    {"TRANSITIVE", TRANSITIVE},
+#line 72 "./sqlwords.gperf"
+    {"CAST", CAST},
+#line 266 "./sqlwords.gperf"
+    {"SELECT", SELECT},
 #line 336 "./sqlwords.gperf"
     {"XML", XML},
-#line 321 "./sqlwords.gperf"
-    {"VALIDATE", VALIDATE_L},
-#line 280 "./sqlwords.gperf"
-    {"SQLEXCEPTION", SQLEXCEPTION},
-#line 131 "./sqlwords.gperf"
-    {"EXTRACT", EXTRACT},
-#line 76 "./sqlwords.gperf"
-    {"CHECKED", CHECKED},
-#line 161 "./sqlwords.gperf"
-    {"INDEX_NO_FILL", INDEX_NO_FILL},
+#line 209 "./sqlwords.gperf"
+    {"NVARCHAR", NVARCHAR},
+#line 203 "./sqlwords.gperf"
+    {"NOT", NOT},
+#line 235 "./sqlwords.gperf"
+    {"PUBLIC", PUBLIC},
+#line 323 "./sqlwords.gperf"
+    {"VALUES", VALUES},
+#line 31 "./sqlwords.gperf"
+    {"__SOAP_HTTP", __SOAP_HTTP},
 #line 211 "./sqlwords.gperf"
     {"OF", OF},
-#line 78 "./sqlwords.gperf"
-    {"CLOSE", CLOSE},
-#line 72 "./sqlwords.gperf"
-    {"CAST", CAST},
-#line 212 "./sqlwords.gperf"
-    {"OFF", OFF},
-#line 228 "./sqlwords.gperf"
-    {"PLI", PLI},
-#line 112 "./sqlwords.gperf"
-    {"DISABLE", DISABLE_L},
-#line 186 "./sqlwords.gperf"
-    {"LEVEL", LEVEL_L},
-#line 263 "./sqlwords.gperf"
-    {"UNCOMMITTED", UNCOMMITTED_L},
-#line 229 "./sqlwords.gperf"
-    {"POSITION", POSITION_L},
-#line 172 "./sqlwords.gperf"
-    {"INTERSECT", INTERSECT},
-#line 68 "./sqlwords.gperf"
-    {"CALL", CALL},
-#line 299 "./sqlwords.gperf"
-    {"T_OUT", T_OUT},
-#line 234 "./sqlwords.gperf"
-    {"PROCEDURE", PROCEDURE},
-#line 311 "./sqlwords.gperf"
-    {"TRANSACTION", TRANSACTION_L},
-#line 271 "./sqlwords.gperf"
-    {"SMALLINT", SMALLINT},
-#line 84 "./sqlwords.gperf"
-    {"COLLATE", COLLATE},
-#line 221 "./sqlwords.gperf"
-    {"OVERRIDING", OVERRIDING},
-#line 143 "./sqlwords.gperf"
-    {"FUNCTION", FUNCTION},
-#line 44 "./sqlwords.gperf"
-    {"ALL", ALL},
-#line 128 "./sqlwords.gperf"
-    {"EXECUTE", EXECUTE},
-#line 283 "./sqlwords.gperf"
-    {"STATIC", STATIC_L},
-#line 224 "./sqlwords.gperf"
-    {"PASSWORD", PASSWORD},
+#line 247 "./sqlwords.gperf"
+    {"REPEATABLE", REPEATABLE_L},
+#line 168 "./sqlwords.gperf"
+    {"INSTANCE", INSTANCE_L},
+#line 309 "./sqlwords.gperf"
+    {"TOP", TOP},
+#line 296 "./sqlwords.gperf"
+    {"T_MIN", T_MIN},
+#line 98 "./sqlwords.gperf"
+    {"CURRENT", CURRENT},
 #line 330 "./sqlwords.gperf"
     {"WHENEVER", WHENEVER},
-#line 30 "./sqlwords.gperf"
-    {"__SOAP_HEADER", __SOAP_HEADER},
-#line 80 "./sqlwords.gperf"
-    {"CLUSTERED", CLUSTERED},
-#line 141 "./sqlwords.gperf"
-    {"FROM", FROM},
-#line 167 "./sqlwords.gperf"
-    {"INSERT", INSERT},
-#line 37 "./sqlwords.gperf"
-    {"__SOAP_ENC_MIME", __SOAP_ENC_MIME},
-#line 300 "./sqlwords.gperf"
-    {"T_SHORTEST_ONLY", T_SHORTEST_ONLY},
-#line 119 "./sqlwords.gperf"
-    {"DYNAMIC", DYNAMIC},
-#line 52 "./sqlwords.gperf"
-    {"ASSEMBLY", ASSEMBLY_L},
-#line 134 "./sqlwords.gperf"
-    {"FINAL", FINAL_L},
-#line 312 "./sqlwords.gperf"
-    {"TRANSITIVE", TRANSITIVE},
-#line 156 "./sqlwords.gperf"
-    {"IF", IF},
-#line 192 "./sqlwords.gperf"
-    {"LOOP", LOOP},
-#line 62 "./sqlwords.gperf"
-    {"BIGINT", BIGINT},
+#line 79 "./sqlwords.gperf"
+    {"CLUSTER", CLUSTER},
+#line 250 "./sqlwords.gperf"
+    {"RESIGNAL", RESIGNAL},
+#line 136 "./sqlwords.gperf"
+    {"FOR", FOR},
+#line 291 "./sqlwords.gperf"
+    {"T_END_FLAG", T_END_FLAG},
+#line 208 "./sqlwords.gperf"
+    {"NUMERIC", NUMERIC},
+#line 232 "./sqlwords.gperf"
+    {"PRIMARY", PRIMARY},
+#line 253 "./sqlwords.gperf"
+    {"RETURN", RETURN},
+#line 35 "./sqlwords.gperf"
+    {"__SOAP_FAULT", __SOAP_FAULT},
+#line 88 "./sqlwords.gperf"
+    {"COMPRESS", COMPRESS},
 #line 205 "./sqlwords.gperf"
     {"NOVALIDATE", NOVALIDATE_L},
-#line 259 "./sqlwords.gperf"
-    {"ROLLUP", ROLLUP},
+#line 321 "./sqlwords.gperf"
+    {"VALIDATE", VALIDATE_L},
+#line 325 "./sqlwords.gperf"
+    {"VARCHAR", VARCHAR},
+#line 91 "./sqlwords.gperf"
+    {"CONTAINS", CONTAINS},
+#line 137 "./sqlwords.gperf"
+    {"FOREACH", FOREACH},
+#line 100 "./sqlwords.gperf"
+    {"CURRENT_TIME", CURRENT_TIME},
+#line 140 "./sqlwords.gperf"
+    {"FOUND", FOUND},
+#line 47 "./sqlwords.gperf"
+    {"ANY", ANY},
+#line 231 "./sqlwords.gperf"
+    {"PREFETCH", PREFETCH},
+#line 212 "./sqlwords.gperf"
+    {"OFF", OFF},
+#line 172 "./sqlwords.gperf"
+    {"INTERSECT", INTERSECT},
+#line 264 "./sqlwords.gperf"
+    {"UNRESTRICTED", UNRESTRICTED_L},
+#line 141 "./sqlwords.gperf"
+    {"FROM", FROM},
+#line 55 "./sqlwords.gperf"
+    {"AUTHORIZATION", AUTHORIZATION},
+#line 189 "./sqlwords.gperf"
+    {"LOCATOR", LOCATOR},
+#line 121 "./sqlwords.gperf"
+    {"ELSEIF", ELSEIF},
+#line 263 "./sqlwords.gperf"
+    {"UNCOMMITTED", UNCOMMITTED_L},
+#line 143 "./sqlwords.gperf"
+    {"FUNCTION", FUNCTION},
+#line 229 "./sqlwords.gperf"
+    {"POSITION", POSITION_L},
+#line 311 "./sqlwords.gperf"
+    {"TRANSACTION", TRANSACTION_L},
+#line 270 "./sqlwords.gperf"
+    {"SHUTDOWN", SHUTDOWN},
+#line 163 "./sqlwords.gperf"
+    {"INDICATOR", INDICATOR},
+#line 215 "./sqlwords.gperf"
+    {"OPEN", OPEN},
+#line 158 "./sqlwords.gperf"
+    {"INCREMENTAL", INCREMENTAL},
+#line 74 "./sqlwords.gperf"
+    {"CHARACTER", CHARACTER},
+#line 252 "./sqlwords.gperf"
+    {"RESULT", RESULT},
+#line 138 "./sqlwords.gperf"
+    {"FOREIGN", FOREIGN},
 #line 297 "./sqlwords.gperf"
     {"T_NO_CYCLES", T_NO_CYCLES},
-#line 302 "./sqlwords.gperf"
-    {"TEMPORARY", TEMPORARY},
-#line 324 "./sqlwords.gperf"
-    {"VARBINARY", VARBINARY},
+#line 94 "./sqlwords.gperf"
+    {"CORRESPONDING", CORRESPONDING},
+#line 258 "./sqlwords.gperf"
+    {"ROLLBACK", ROLLBACK},
 #line 101 "./sqlwords.gperf"
     {"CURRENT_TIMESTAMP", CURRENT_TIMESTAMP},
-#line 202 "./sqlwords.gperf"
-    {"NONINCREMENTAL", NONINCREMENTAL},
-#line 54 "./sqlwords.gperf"
-    {"ATTRIBUTE", ATTRIBUTE},
-#line 231 "./sqlwords.gperf"
-    {"PREFETCH", PREFETCH},
-#line 187 "./sqlwords.gperf"
-    {"LIBRARY", LIBRARY_L},
-#line 287 "./sqlwords.gperf"
-    {"SYSTEM", SYSTEM},
-#line 162 "./sqlwords.gperf"
-    {"INDEX_ONLY", INDEX_ONLY},
-#line 328 "./sqlwords.gperf"
-    {"VIEW", VIEW},
-#line 113 "./sqlwords.gperf"
-    {"DISCONNECT", DISCONNECT},
-#line 276 "./sqlwords.gperf"
-    {"SPARQL", SPARQL_L},
-#line 159 "./sqlwords.gperf"
-    {"INCREMENT", INCREMENT_L},
-#line 111 "./sqlwords.gperf"
-    {"DETERMINISTIC", DETERMINISTIC},
+#line 277 "./sqlwords.gperf"
+    {"SPECIFIC", SPECIFIC},
 #line 194 "./sqlwords.gperf"
     {"MODIFY", MODIFY},
-#line 142 "./sqlwords.gperf"
-    {"FULL", FULL},
-#line 158 "./sqlwords.gperf"
-    {"INCREMENTAL", INCREMENTAL},
-#line 155 "./sqlwords.gperf"
-    {"IDENTIFIED", IDENTIFIED},
-#line 291 "./sqlwords.gperf"
-    {"T_END_FLAG", T_END_FLAG},
-#line 334 "./sqlwords.gperf"
-    {"WITHOUT", WITHOUT_L},
-#line 32 "./sqlwords.gperf"
-    {"__SOAP_NAME", __SOAP_NAME},
-#line 57 "./sqlwords.gperf"
-    {"BACKUP", BACKUP},
-#line 65 "./sqlwords.gperf"
-    {"BREAKUP", BREAKUP},
-#line 237 "./sqlwords.gperf"
-    {"QUIETCAST", QUIETCAST_L},
-#line 38 "./sqlwords.gperf"
-    {"__SOAP_OPTIONS", __SOAP_OPTIONS},
-#line 63 "./sqlwords.gperf"
-    {"BINARY", BINARY},
-#line 34 "./sqlwords.gperf"
-    {"__SOAP_XML_TYPE", __SOAP_XML_TYPE},
 #line 28 "./sqlwords.gperf"
     {"__SOAP_DOC", __SOAP_DOC},
-#line 135 "./sqlwords.gperf"
-    {"FLOAT", FLOAT_L},
+#line 216 "./sqlwords.gperf"
+    {"OPTION", OPTION},
+#line 177 "./sqlwords.gperf"
+    {"ISOLATION", ISOLATION_L},
+#line 307 "./sqlwords.gperf"
+    {"TIMESTAMP", TIMESTAMP},
+#line 167 "./sqlwords.gperf"
+    {"INSERT", INSERT},
+#line 259 "./sqlwords.gperf"
+    {"ROLLUP", ROLLUP},
 #line 290 "./sqlwords.gperf"
     {"T_DISTINCT", T_DISTINCT},
-#line 288 "./sqlwords.gperf"
-    {"T_CYCLES_ONLY", T_CYCLES_ONLY},
-#line 235 "./sqlwords.gperf"
-    {"PUBLIC", PUBLIC},
-#line 154 "./sqlwords.gperf"
-    {"IDENTITY", IDENTITY},
-#line 33 "./sqlwords.gperf"
-    {"__SOAP_TYPE", __SOAP_TYPE},
-#line 64 "./sqlwords.gperf"
-    {"BITMAP", BITMAPPED},
-#line 207 "./sqlwords.gperf"
-    {"NULLIF", NULLIF},
-#line 29 "./sqlwords.gperf"
-    {"__SOAP_DOCW", __SOAP_DOCW},
-#line 223 "./sqlwords.gperf"
-    {"PASCAL", PASCAL_L},
-#line 35 "./sqlwords.gperf"
-    {"__SOAP_FAULT", __SOAP_FAULT},
+#line 249 "./sqlwords.gperf"
+    {"REPLICATION", REPLICATION},
+#line 84 "./sqlwords.gperf"
+    {"COLLATE", COLLATE},
+#line 113 "./sqlwords.gperf"
+    {"DISCONNECT", DISCONNECT},
+#line 139 "./sqlwords.gperf"
+    {"FORTRAN", FORTRAN},
+#line 300 "./sqlwords.gperf"
+    {"T_SHORTEST_ONLY", T_SHORTEST_ONLY},
+#line 287 "./sqlwords.gperf"
+    {"SYSTEM", SYSTEM},
+#line 237 "./sqlwords.gperf"
+    {"QUIETCAST", QUIETCAST_L},
+#line 92 "./sqlwords.gperf"
+    {"CONTINUE", CONTINUE},
+#line 159 "./sqlwords.gperf"
+    {"INCREMENT", INCREMENT_L},
+#line 87 "./sqlwords.gperf"
+    {"COMMITTED", COMMITTED_L},
+#line 222 "./sqlwords.gperf"
+    {"PARTITION", PARTITION},
+#line 298 "./sqlwords.gperf"
+    {"T_NO_ORDER", T_NO_ORDER},
+#line 282 "./sqlwords.gperf"
+    {"SQLWARNING", SQLWARNING},
 #line 77 "./sqlwords.gperf"
     {"CHECKPOINT", CHECKPOINT},
-#line 36 "./sqlwords.gperf"
-    {"__SOAP_DIME_ENC", __SOAP_DIME_ENC},
-#line 277 "./sqlwords.gperf"
-    {"SPECIFIC", SPECIFIC},
-#line 307 "./sqlwords.gperf"
-    {"TIMESTAMP", TIMESTAMP},
-#line 121 "./sqlwords.gperf"
-    {"ELSEIF", ELSEIF},
-#line 31 "./sqlwords.gperf"
-    {"__SOAP_HTTP", __SOAP_HTTP}
+#line 207 "./sqlwords.gperf"
+    {"NULLIF", NULLIF},
+#line 302 "./sqlwords.gperf"
+    {"TEMPORARY", TEMPORARY},
+#line 324 "./sqlwords.gperf"
+    {"VARBINARY", VARBINARY},
+#line 221 "./sqlwords.gperf"
+    {"OVERRIDING", OVERRIDING},
+#line 86 "./sqlwords.gperf"
+    {"COMMIT", COMMIT},
+#line 93 "./sqlwords.gperf"
+    {"CONVERT", CONVERT},
+#line 230 "./sqlwords.gperf"
+    {"PRECISION", PRECISION},
+#line 280 "./sqlwords.gperf"
+    {"SQLEXCEPTION", SQLEXCEPTION},
+#line 85 "./sqlwords.gperf"
+    {"COLUMN", COLUMN},
+#line 202 "./sqlwords.gperf"
+    {"NONINCREMENTAL", NONINCREMENTAL},
+#line 90 "./sqlwords.gperf"
+    {"CONSTRUCTOR", CONSTRUCTOR},
+#line 89 "./sqlwords.gperf"
+    {"CONSTRAINT", CONSTRAINT}
   };
 
 static const short lookup[] =
@@ -756,158 +756,231 @@ static const short lookup[] =
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,   0,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,   1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+      0,  -1,  -1,   1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,   2,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,   3,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   4,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,   5,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,   6,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,   7,  -1,  -1,  -1,  -1,  -1,  -1,
+      8,  -1,   9,  -1,  -1,  -1,  -1,  -1,  -1,  10,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  11,
+     -1,  -1,  12,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     13,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  14,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  15,  -1,  16,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  17,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  18,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  19,  -1,  -1,  -1,  -1,
+     -1,  -1,  20,  -1,  -1,  21,  -1,  22,  -1,  23,
+     -1,  -1,  24,  -1,  25,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  26,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  27,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  28,  -1,  -1,  -1,  -1,  29,
+     -1,  -1,  30,  -1,  -1,  -1,  -1,  -1,  31,  -1,
+     -1,  -1,  -1,  -1,  32,  33,  -1,  -1,  -1,  -1,
+     -1,  -1,  34,  -1,  -1,  -1,  -1,  35,  -1,  -1,
+     -1,  36,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  37,
+     -1,  -1,  -1,  -1,  -1,  -1,  38,  -1,  -1,  39,
+     40,  -1,  41,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  42,  -1,  -1,  43,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  44,  -1,  -1,  -1,  -1,  -1,  45,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     46,  -1,  47,  -1,  -1,  48,  49,  -1,  -1,  -1,
+     50,  -1,  51,  52,  53,  54,  -1,  -1,  -1,  -1,
+     55,  -1,  -1,  56,  -1,  -1,  57,  -1,  -1,  58,
+     -1,  -1,  -1,  -1,  59,  60,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  61,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  62,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     63,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     64,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  65,  -1,  -1,
+     66,  -1,  -1,  -1,  -1,  -1,  -1,  67,  -1,  -1,
+     68,  -1,  -1,  -1,  69,  -1,  -1,  -1,  70,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  71,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  72,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  73,  -1,  74,  -1,  75,
+     -1,  76,  -1,  77,  -1,  -1,  -1,  -1,  78,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  79,  80,  81,  -1,
+     82,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  83,
+     -1,  84,  -1,  -1,  -1,  -1,  -1,  -1,  85,  -1,
+     -1,  -1,  -1,  86,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  87,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  88,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  89,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  90,  91,  -1,  -1,  -1,  -1,  -1,
+     92,  93,  94,  95,  -1,  96,  97,  98,  -1,  -1,
+     -1,  99, 100,  -1,  -1, 101, 102, 103,  -1,  -1,
+     -1,  -1,  -1, 104, 105,  -1,  -1, 106,  -1,  -1,
+    107,  -1, 108,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+    109,  -1,  -1, 110,  -1, 111,  -1,  -1,  -1, 112,
+    113, 114, 115,  -1, 116, 117, 118, 119,  -1,  -1,
+     -1,  -1,  -1,  -1, 120, 121,  -1, 122, 123,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1, 124,  -1, 125,  -1,  -1,  -1,
+     -1, 126, 127,  -1, 128,  -1,  -1,  -1,  -1,  -1,
+     -1, 129, 130,  -1, 131, 132, 133,  -1,  -1, 134,
+     -1, 135, 136,  -1,  -1,  -1, 137, 138,  -1, 139,
+     -1, 140, 141, 142, 143,  -1,  -1,  -1,  -1,  -1,
+    144,  -1,  -1,  -1,  -1, 145,  -1,  -1, 146,  -1,
+     -1, 147,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 148,
+    149, 150,  -1,  -1, 151,  -1,  -1,  -1,  -1, 152,
+    153,  -1,  -1, 154,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1, 155, 156,  -1, 157,  -1, 158,  -1,  -1,  -1,
+    159,  -1,  -1,  -1,  -1, 160, 161,  -1,  -1,  -1,
+     -1, 162,  -1,  -1, 163,  -1,  -1, 164, 165,  -1,
+    166,  -1,  -1,  -1,  -1,  -1,  -1, 167,  -1,  -1,
+    168, 169,  -1, 170,  -1, 171,  -1,  -1, 172, 173,
+     -1,  -1,  -1,  -1, 174, 175, 176,  -1,  -1, 177,
+    178, 179,  -1, 180,  -1,  -1, 181,  -1,  -1,  -1,
+     -1, 182,  -1, 183, 184,  -1, 185,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1, 186,  -1, 187,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+    188,  -1,  -1, 189,  -1,  -1, 190,  -1, 191,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 192,
+     -1,  -1, 193,  -1,  -1,  -1, 194, 195,  -1,  -1,
+    196,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+    197, 198,  -1,  -1, 199,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1, 200,  -1,  -1,  -1, 201,
+     -1, 202,  -1,  -1,  -1, 203, 204,  -1,  -1, 205,
+     -1,  -1,  -1,  -1, 206,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1, 207, 208, 209, 210,  -1,  -1, 211,
+     -1,  -1, 212,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+    213,  -1,  -1,  -1, 214, 215,  -1,  -1, 216,  -1,
+     -1, 217, 218,  -1, 219, 220, 221,  -1,  -1, 222,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1, 223,  -1,  -1,
+     -1,  -1, 224,  -1, 225, 226,  -1, 227,  -1,  -1,
+    228, 229,  -1,  -1, 230, 231,  -1,  -1,  -1, 232,
+     -1,  -1,  -1,  -1,  -1,  -1, 233,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1, 234,  -1, 235,  -1,  -1,
+     -1, 236, 237, 238, 239,  -1, 240,  -1,  -1,  -1,
+     -1,  -1, 241,  -1, 242,  -1, 243,  -1, 244, 245,
+    246, 247,  -1,  -1,  -1,  -1, 248,  -1,  -1,  -1,
+    249,  -1,  -1,  -1,  -1,  -1,  -1, 250,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1, 251,  -1,  -1, 252,  -1,
+     -1, 253,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 254,
+     -1,  -1,  -1,  -1, 255,  -1,  -1,  -1,  -1,  -1,
+    256,  -1,  -1, 257,  -1, 258,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 259,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 260,  -1,
+    261,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1, 262, 263,  -1,  -1,  -1,  -1,  -1,  -1,
+    264, 265,  -1,  -1,  -1, 266,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1, 267, 268,  -1,  -1,
+     -1,  -1,  -1,  -1, 269, 270, 271,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1, 272,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1, 273,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1, 274,  -1, 275,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1, 276, 277,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1, 278,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1, 279,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1, 280,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1, 281, 282, 283,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1, 284,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+    285,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1, 286,  -1,  -1, 287,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,   3,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,   4,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,   5,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,   6,  -1,  -1,  -1,  -1,
-     -1,  -1,   7,  -1,  -1,  -1,   8,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,   9,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  10,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  11,  -1,  -1,
-     12,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     13,  -1,  -1,  -1,  -1,  14,  -1,  -1,  -1,  -1,
-     -1,  15,  -1,  -1,  -1,  -1,  16,  -1,  17,  -1,
-     -1,  -1,  -1,  18,  -1,  -1,  -1,  -1,  -1,  19,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  20,  -1,  -1,  21,  -1,  -1,
-     -1,  -1,  22,  -1,  -1,  -1,  -1,  -1,  23,  -1,
-     -1,  -1,  -1,  -1,  -1,  24,  25,  -1,  -1,  -1,
-     26,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  27,  28,  -1,  29,  30,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  31,  -1,  -1,  -1,  32,  33,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  34,  -1,  35,
-     -1,  36,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  37,  38,  39,  -1,  40,  -1,
-     -1,  41,  -1,  -1,  -1,  42,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  43,  -1,  -1,  -1,  -1,  -1,  44,
-     -1,  45,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  46,
-     47,  48,  49,  -1,  -1,  -1,  50,  51,  -1,  -1,
-     -1,  -1,  52,  53,  -1,  -1,  54,  -1,  -1,  -1,
-     -1,  55,  -1,  56,  -1,  -1,  -1,  -1,  -1,  -1,
-     57,  -1,  -1,  -1,  -1,  -1,  58,  -1,  -1,  -1,
-     59,  -1,  -1,  60,  61,  -1,  -1,  -1,  -1,  -1,
-     62,  -1,  -1,  -1,  63,  64,  -1,  -1,  -1,  -1,
-     65,  -1,  -1,  66,  -1,  67,  68,  69,  -1,  70,
-     71,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  72,
-     -1,  -1,  -1,  -1,  -1,  73,  -1,  74,  75,  -1,
-     -1,  -1,  -1,  -1,  76,  77,  78,  79,  -1,  80,
-     81,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  82,  83,
-     84,  85,  -1,  86,  -1,  87,  88,  89,  -1,  -1,
-     90,  -1,  -1,  91,  -1,  -1,  -1,  -1,  -1,  92,
-     93,  -1,  94,  95,  96,  -1,  -1,  97,  -1,  -1,
-     98,  -1,  -1,  -1,  -1,  -1,  -1,  99, 100,  -1,
-    101,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 102, 103,
-    104,  -1,  -1,  -1,  -1, 105,  -1,  -1,  -1, 106,
-     -1, 107,  -1, 108,  -1,  -1,  -1,  -1,  -1,  -1,
-    109,  -1,  -1, 110,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1, 111,  -1, 112,  -1,  -1, 113, 114,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-    115,  -1,  -1,  -1, 116,  -1, 117,  -1,  -1, 118,
-     -1,  -1, 119, 120,  -1,  -1,  -1,  -1, 121, 122,
-     -1,  -1,  -1, 123,  -1,  -1,  -1, 124,  -1,  -1,
-     -1, 125, 126,  -1,  -1, 127, 128, 129,  -1,  -1,
-     -1,  -1, 130,  -1,  -1,  -1,  -1,  -1, 131,  -1,
-     -1,  -1,  -1,  -1, 132, 133, 134,  -1,  -1,  -1,
-    135,  -1, 136,  -1, 137, 138,  -1,  -1, 139, 140,
-    141, 142,  -1,  -1,  -1, 143,  -1, 144,  -1,  -1,
-    145,  -1,  -1,  -1, 146,  -1,  -1, 147,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1, 148,  -1,  -1,  -1,
-    149,  -1,  -1, 150, 151,  -1,  -1, 152,  -1, 153,
-     -1,  -1,  -1,  -1, 154,  -1, 155,  -1,  -1, 156,
-    157, 158, 159,  -1,  -1,  -1, 160,  -1, 161,  -1,
-     -1, 162,  -1, 163,  -1, 164,  -1,  -1,  -1, 165,
-    166,  -1, 167, 168, 169,  -1, 170,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1, 171,  -1, 172, 173, 174,  -1,  -1,  -1,  -1,
-    175, 176,  -1,  -1, 177,  -1,  -1, 178,  -1, 179,
-    180, 181, 182, 183,  -1,  -1, 184, 185,  -1,  -1,
-     -1,  -1,  -1,  -1, 186,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1, 187, 188, 189,  -1, 190,  -1,  -1, 191,
-    192,  -1,  -1, 193,  -1,  -1,  -1, 194,  -1,  -1,
-     -1,  -1,  -1, 195,  -1,  -1, 196,  -1, 197,  -1,
-    198, 199, 200, 201,  -1,  -1,  -1,  -1,  -1,  -1,
-    202, 203,  -1, 204,  -1,  -1, 205, 206,  -1, 207,
-    208, 209,  -1,  -1, 210,  -1,  -1,  -1, 211, 212,
-     -1,  -1,  -1, 213, 214,  -1, 215,  -1,  -1, 216,
-     -1,  -1,  -1,  -1,  -1,  -1, 217,  -1, 218, 219,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 220,
-     -1,  -1,  -1,  -1,  -1,  -1, 221,  -1,  -1,  -1,
-     -1, 222,  -1, 223,  -1,  -1,  -1, 224,  -1, 225,
-    226, 227, 228,  -1,  -1,  -1,  -1, 229,  -1,  -1,
-     -1, 230,  -1, 231, 232,  -1,  -1, 233,  -1,  -1,
-    234,  -1,  -1, 235,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1, 236,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 237,
-     -1,  -1,  -1,  -1, 238,  -1, 239,  -1,  -1,  -1,
-    240,  -1,  -1,  -1,  -1,  -1, 241,  -1, 242, 243,
-    244,  -1,  -1, 245,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1, 246, 247,  -1, 248,  -1, 249,
-    250,  -1,  -1,  -1,  -1, 251,  -1,  -1,  -1,  -1,
-     -1,  -1, 252, 253, 254,  -1,  -1,  -1, 255,  -1,
-     -1,  -1,  -1, 256, 257, 258,  -1,  -1,  -1, 259,
-     -1, 260, 261,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 262,  -1,
-    263,  -1,  -1, 264,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1, 265,  -1,  -1,  -1,
-     -1,  -1,  -1, 266,  -1,  -1, 267,  -1,  -1,  -1,
-     -1,  -1, 268, 269,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1, 270,  -1,  -1,  -1,  -1,  -1, 271,  -1,
-     -1,  -1, 272,  -1,  -1,  -1,  -1,  -1,  -1, 273,
-     -1,  -1,  -1,  -1,  -1, 274,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1, 275,  -1,  -1,  -1,  -1,  -1,
-     -1, 276,  -1,  -1,  -1,  -1,  -1, 277,  -1,  -1,
-     -1,  -1, 278,  -1,  -1,  -1,  -1,  -1, 279,  -1,
-    280, 281, 282,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1, 283,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1, 284,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1, 285,  -1,  -1,  -1, 286,  -1,  -1,  -1,
-    287,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 288,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 289,
+    290,  -1,  -1,  -1, 291,  -1,  -1,  -1,  -1, 292,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1, 293,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 294,
+     -1,  -1, 295,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1, 296,  -1,  -1,  -1,  -1,  -1, 297,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1, 298,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-    289,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1, 290,  -1,  -1,  -1,  -1,  -1, 291,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 292, 293,
+     -1, 299,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1, 294,  -1, 295,  -1,
-     -1, 296,  -1, 297,  -1, 298,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1, 300,  -1,  -1,  -1,  -1,
+     -1, 301,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1, 302,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1, 299,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1, 300,  -1,  -1, 301,  -1,  -1, 302,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1, 303,  -1,  -1,
-     -1,  -1,  -1, 304,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1, 305,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1, 303,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-    306, 307,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1, 304,  -1, 305,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1, 306,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 307,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1, 308,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1, 309,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1, 308,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1, 309,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 310,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1, 311
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1, 311
   };
 
 #ifdef __GNUC__
diff --git a/libsrc/Wi/srvmultibyte.c b/libsrc/Wi/srvmultibyte.c
index 42e7847..d90924c 100644
--- a/libsrc/Wi/srvmultibyte.c
+++ b/libsrc/Wi/srvmultibyte.c
@@ -1,7 +1,7 @@
 /*
  *  srvmultibyte.c
  *
- *  $Id: srvmultibyte.c,v 1.12.2.2 2009/04/18 21:55:17 source Exp $
+ *  $Id: srvmultibyte.c,v 1.12.2.3 2010/12/13 11:17:56 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -907,6 +907,7 @@ box_utf8_string_as_narrow (ccaddr_t _str, caddr_t narrow, long max_len, wcharset
   return box;
 }
 
+/* this function take a string not a box as _str argument */
 caddr_t
 t_box_utf8_string_as_narrow (ccaddr_t _str, caddr_t narrow, long max_len, wcharset_t *charset)
 {
@@ -924,7 +925,7 @@ t_box_utf8_string_as_narrow (ccaddr_t _str, caddr_t narrow, long max_len, wchars
     charset = default_charset;
 
   memset (&state, 0, sizeof (virt_mbstate_t));
-  len = (long) virt_mbsnrtowcs (NULL, (unsigned char **) &src, box_length (str), 0, &state);
+  len = (long) virt_mbsnrtowcs (NULL, (unsigned char **) &src, strlen ((char *) str), 0, &state);
   if (max_len > 0 && len > max_len)
     len = max_len;
   if (len < 0) /* there was <= 0 - bug */
@@ -933,7 +934,7 @@ t_box_utf8_string_as_narrow (ccaddr_t _str, caddr_t narrow, long max_len, wchars
   for (inx = 0, src = str, memset (&state, 0, sizeof (virt_mbstate_t)); inx < len; inx++)
     {
       wchar_t wc;
-      long char_len = (long) virt_mbrtowc (&wc, src, (box_length (str)) - (long)((src - str)), &state);
+      long char_len = (long) virt_mbrtowc (&wc, src, (strlen ((char *) str)) - (long)((src - str)), &state);
       if (char_len <= 0)
 	{
 	  box[inx] = '?';
diff --git a/libsrc/Wi/srvstat.c b/libsrc/Wi/srvstat.c
index a6081a4..77ff8a1 100644
--- a/libsrc/Wi/srvstat.c
+++ b/libsrc/Wi/srvstat.c
@@ -1,7 +1,7 @@
 /*
  *  srvstat.c
  *
- *  $Id: srvstat.c,v 1.29.2.19 2010/05/12 12:16:36 source Exp $
+ *  $Id: srvstat.c,v 1.29.2.23 2011/03/03 17:12:05 source Exp $
  *
  *  Server Status Report
  *
@@ -181,8 +181,8 @@ extern long tc_kill_closing;
 extern long tc_get_buf_failed;
 extern long tc_unused_read_aside;
 extern long tc_read_aside;
-extern int em_ra_window;
-extern int em_ra_threshold;
+extern int32 em_ra_window;
+extern int32 em_ra_threshold;
 extern int enable_mem_hash_join;
 extern int enable_dfg;
 extern int enable_setp_partition;
@@ -312,11 +312,7 @@ long st_chkp_atomic_time;
 
 long st_cli_n_current_connections = 0;
 
-#if defined (REPLICATION_SUPPORT2)
-long fe_replication_support = 1;
-#else
 long fe_replication_support = 0;
-#endif
 
 long sparql_result_set_max_rows = 0;
 long sparql_max_mem_in_use = 0;
@@ -646,53 +642,6 @@ trx_status_report (lock_trx_t * lt)
 }
 
 
-#if REPLICATION_SUPPORT
-void
-repl_status (void)
-{
-  if (!db_name)
-    return;
-  rep_printf ("\n\nReplication Status: Server  %s.\n", db_name);
-  DO_SET (repl_acct_t *, ra, &repl_accounts)
-  {
-    char *sta = "";
-    switch (ra->ra_synced)
-      {
-      case RA_OFF:
-	sta = "OFF";
-	break;
-      case RA_SYNCING:
-	sta = "SYNCING";
-	break;
-      case RA_IN_SYNC:
-	sta = "IN SYNC";
-	break;
-      case RA_TO_DISCONNECT:
-	sta = "QUEUED FOR DISCONNECT";
-	break;
-      case RA_DISCONNECTED:
-	sta = "DISCONNECTED";
-	break;
-      case RA_REMOTE_DISCONNECTED:
-	sta = "REMOTE DISCONNECTED";
-	break;
-      }
-    if (RA_IS_PUSHBACK(ra->ra_account))
-      {
-        rep_printf ("   %-20s %-20s %10lu (%lu) %s.\n",
-	    ra->ra_server, ra->ra_account,
-            ra_trx_no (ra), ra_pub_trx_no(ra), sta);
-      }
-    else
-      {
-        rep_printf ("   %-20s %-20s %10lu %s.\n",
-	    ra->ra_server, ra->ra_account, ra_trx_no (ra), sta);
-      }
-  }
-  END_DO_SET ();
-  rep_printf ("\n\n");
-}
-#endif
 
 
 void
@@ -1145,10 +1094,6 @@ status_report (const char * mode, query_instance_t * qi)
       dk_set_free (set);
       set = NULL;
     }
-#if REPLICATION_SUPPORT
-  if (strchr (mode, 'r'))
-    repl_status ();
-#endif
   if (strchr (mode, 'k'))
     key_stats ();
   if (strchr (mode, 'h'))
@@ -1416,10 +1361,6 @@ stat_desc_t stat_descs [] =
     {"st_chkp_atomic_time", &st_chkp_atomic_time, NULL},
     {"st_chkp_autocheckpoint", (long *) &cfg_autocheckpoint, NULL},
     {"st_chkp_last_checkpointed", (long *) &checkpointed_last_time, NULL},
-#if REPLICATION_SUPPORT
-    {"st_repl_serv_name", NULL, &db_name},
-    {"st_repl_server_enable", NULL, &repl_server_enable},
-#endif
 
     {"st_started_since_year", &st_started_since_year, NULL},
     {"st_started_since_month", &st_started_since_month, NULL},
@@ -1664,11 +1605,7 @@ bif_identify_self (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 	box_dv_short_string (host),
 	box_dv_short_string (pid),
 	box_dv_short_string (ip_addr),
-#ifdef REPLICATION_SUPPORT2
-	box_dv_short_string (db_name)
-#else
 	box_dv_short_string ("")
-#endif
        ));
 }
 
@@ -2391,8 +2328,8 @@ dbg_print_box_aux (caddr_t object, FILE * out, dk_hash_t *known)
 	  fprintf (out, "#N%s", temp);
 	  break;
 	case DV_DATETIME:
-	  dt_to_string(object, temp, sizeof (temp));
-	  fprintf (out, "{ts %s}", temp);
+	  dbg_dt_to_string (object, temp, sizeof (temp));
+	  fprintf (out, "%s", temp);
 	  break;
 	case DV_WIDE:
 	case DV_LONG_WIDE:
@@ -2462,6 +2399,11 @@ dbg_print_box_aux (caddr_t object, FILE * out, dk_hash_t *known)
 	      fprintf (out, ")");
               break;
             }
+	case DV_DICT_ITERATOR:
+	    {
+	      fprintf (out, "<dictionary_reference>");
+	      break;
+	    }
 	default:
 	  {
 	    fprintf (out, "Wacky box tag = %d\n", (int) tag);
diff --git a/libsrc/Wi/strlike.h b/libsrc/Wi/strlike.h
index 6b70195..e242839 100644
--- a/libsrc/Wi/strlike.h
+++ b/libsrc/Wi/strlike.h
@@ -1,7 +1,7 @@
 /*
- *  arith.h
+ *  strlike.h
  *
- *  $Id: strlike.h,v 1.2.2.1 2009/04/18 21:55:17 source Exp $
+ *  $Id: strlike.h,v 1.2.2.2 2010/09/09 19:19:35 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
diff --git a/libsrc/Wi/system.sql b/libsrc/Wi/system.sql
index 447fc56..1e4a9a7 100644
--- a/libsrc/Wi/system.sql
+++ b/libsrc/Wi/system.sql
@@ -1,5 +1,5 @@
 --
---  $Id: system.sql,v 1.41.2.21 2010/06/25 16:41:24 source Exp $
+--  $Id: system.sql,v 1.41.2.23 2011/03/17 16:30:54 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -482,10 +482,10 @@ try_http_get:
 	}
       else if (proto = 'https' or (length (hcli_uid) and length (hcli_pwd)) or (timeout is not null and timeout > 0))
         {
-	  str := http_client_ext (url=>base_uri, uid=>hcli_uid, pwd=>hcli_pwd, headers=>head, timeout=>timeout);
+	  str := http_client_ext (url=>base_uri, uid=>hcli_uid, pwd=>hcli_pwd, headers=>head, timeout=>timeout, n_redirects=>15);
  	}
       else
-        str := http_get (base_uri, head);
+        str := http_client_ext (url=>base_uri, headers=>head, n_redirects=>15);
       if (aref (head, 0) not like '% 200%')
 	signal ('H0001', concat ('HTTP request failed: ', aref (head, 0), 'for URI ', base_uri));
     }
@@ -5872,7 +5872,7 @@ create procedure csv_load (in s any, in _from int := 0, in _to int := null, in t
 {
   declare r, log_ses any;
   declare stmt, enc varchar;
-  declare inx, old_mode, num_cols, nrows, mode, log_error int;
+  declare inx, old_mode, num_cols, nrows, mode, log_error, import_first_n_cols int;
   declare delim, quot char;
 
   delim := quot := enc := mode := null;
@@ -5884,6 +5884,7 @@ create procedure csv_load (in s any, in _from int := 0, in _to int := null, in t
       enc := get_keyword ('encoding', opts);
       mode := get_keyword ('mode', opts);
       log_error := get_keyword ('log', opts, 0);
+      import_first_n_cols := get_keyword ('lax', opts, 0);
     }
 
   stmt := csv_ins_stmt (tb, num_cols);
@@ -5895,6 +5896,8 @@ create procedure csv_load (in s any, in _from int := 0, in _to int := null, in t
     {
       if (inx >= _from)
 	{
+	  if (import_first_n_cols and length (r) > num_cols)
+            r := subseq (r, 0, num_cols);
 	  if (length (r) = num_cols)
 	    {
 	      declare stat, message varchar;
diff --git a/libsrc/Wi/system2.sql b/libsrc/Wi/system2.sql
index fc785af..2826df9 100644
--- a/libsrc/Wi/system2.sql
+++ b/libsrc/Wi/system2.sql
@@ -1,5 +1,5 @@
 --
---  $Id: system2.sql,v 1.5.2.4 2010/05/21 12:27:12 source Exp $
+--  $Id: system2.sql,v 1.5.2.5 2010/08/02 07:40:54 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -767,3 +767,75 @@ add_protected_sequence ('vad_tmp')
 ;
 add_protected_sequence ('vdd_init')
 ;
+
+create table SYS_X509_CERTIFICATES (
+    	C_U_ID	int,			-- user id
+    	C_ID varchar, 			-- key id
+	C_DATA long varchar, 		-- certificate (and possibly key) pem format
+	C_KIND integer, 		-- 1 : CA certificate, rest for future use
+	C_NAME varchar,
+	primary key (C_U_ID, C_KIND, C_ID))
+;
+
+
+create procedure X509_CERTIFICATES_ADD (in certs varchar, in kind int := 1)
+{
+  declare ki varchar;
+  declare name, subj varchar;
+  declare arr any;
+  declare user_id int;
+
+  arr := pem_certificates_to_array (certs);
+  user_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = user);
+  if (user_id <> 0 and kind = 1)
+    signal ('39000', 'Only DBA can install CA roots');
+  foreach (varchar cert in arr) do
+    {
+      ki := get_certificate_info (6, cert, 0, '');
+      if (ki is null)
+	signal ('22023', 'Can not get certificate id');
+      subj := get_certificate_info (2, cert, 0, '');
+      name := regexp_match ('/CN=[^/]+/?', subj);
+      if (name is null or name like '/CN=http:%')
+	name := regexp_match ('/O=[^/]+/?', subj);
+      if (name is not null)
+	{
+	  declare pos int;
+	  name := trim (name, '/');
+	  pos := strchr (name, '=');
+	  name := subseq (name, pos + 1);
+	  name := split_and_decode (replace (name, '\\x', '%'))[0];
+	}
+      insert soft SYS_X509_CERTIFICATES (C_U_ID, C_ID, C_DATA, C_KIND, C_NAME) values (user_id, ki, cert, kind, name);
+    }
+}
+;
+
+create procedure X509_CERTIFICATES_DEL (in certs varchar, in kind int := 1)
+{
+  declare ki varchar;
+  declare name, subj varchar;
+  declare arr any;
+  declare user_id int;
+
+  arr := pem_certificates_to_array (certs);
+  user_id := (select U_ID from DB.DBA.SYS_USERS where U_NAME = user);
+  if (user_id <> 0 and kind = 1)
+    signal ('39000', 'Only DBA can install CA roots');
+  foreach (varchar cert in arr) do
+    {
+      ki := get_certificate_info (6, cert, 0, '');
+      if (ki is null)
+	signal ('22023', 'Can not get certificate id');
+      delete from SYS_X509_CERTIFICATES where C_U_ID = user_id and C_KIND = kind and C_ID = ki;
+    }
+}
+;
+
+create procedure X509_ROOT_CA_CERTS ()
+{
+  declare ret any;
+  ret := (select vector_agg (C_DATA) from SYS_X509_CERTIFICATES where C_U_ID = 0 and C_KIND = 1);
+  return ret;
+}
+;
diff --git a/libsrc/Wi/trans.c b/libsrc/Wi/trans.c
index 37eea6c..74d48f8 100644
--- a/libsrc/Wi/trans.c
+++ b/libsrc/Wi/trans.c
@@ -1,7 +1,7 @@
 /*
  *  trans.c
  *
- *  $Id: trans.c,v 1.1.2.7 2010/06/30 14:29:58 source Exp $
+ *  $Id: trans.c,v 1.1.2.9 2011/02/03 13:30:10 source Exp $
  *
  *  Transitive Node
  *
@@ -1035,6 +1035,94 @@ tn_lowest_sas_result (trans_node_t * tn, caddr_t * inst, trans_set_t * ts)
   qn_send_output ((data_source_t*)tn, inst);
 }
 
+int32 tn_cache_enable = 0;
+
+void
+tn_cache_results (trans_node_t * tn, caddr_t * inst)
+{
+  int nth;
+  itc_cluster_t * itcl = ((cl_op_t*)qst_get (inst, tn->clb.clb_itcl))->_.itcl.itcl;
+  id_hash_t * ht = tn_hash_table_get (tn);
+  caddr_t key = qst_get (inst, tn->tn_input[0]), data;
+  dk_set_t set = NULL;
+  if (!ht || !tn_cache_enable || cl_run_local_only != CL_RUN_LOCAL)
+    return;
+  for (nth = 0; nth < QST_INT (inst, tn->clb.clb_fill); nth ++)
+    {
+      int inx;
+      caddr_t * arr = NULL;
+      trans_set_t * ts = (trans_set_t*) itcl->itcl_param_rows[nth][0];
+      if (ts->ts_result)
+	{
+	  DO_SET (trans_state_t *,  tst, &ts->ts_result)
+	    {
+	      arr = dk_alloc_box (BOX_ELEMENTS (tn->tn_output) * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
+	      DO_BOX (state_slot_t *, out, inx, tn->tn_output)
+		{
+		  caddr_t v = ((caddr_t*)tst->tst_value)[inx];
+		  arr[inx] = box_copy_tree (v);
+		}
+	      END_DO_BOX;
+	      dk_set_push (&set, (void *) arr);
+	    }
+	  END_DO_SET ();
+	}
+      else
+	{
+	  dk_set_push (&set, (void *) arr);
+	}
+    }
+  key = box_copy_tree (key);
+  data = list_to_array (dk_set_nreverse (set));
+  mutex_enter (tn_cache_mtx);
+  id_hash_set (ht, (caddr_t) &key, (caddr_t) &data);
+  mutex_leave (tn_cache_mtx);
+}
+
+long tn_n_cache_hits;
+
+int
+tn_cache_lookup (trans_node_t * tn, caddr_t * inst, caddr_t * state)
+{
+  int nth;
+  id_hash_t * ht = tn_hash_table_get (tn);
+  caddr_t key = qst_get (inst, tn->tn_input[0]);
+  caddr_t ** place;
+  if (!tn_cache_enable || !ht || cl_run_local_only != CL_RUN_LOCAL)
+    return 0;
+  mutex_enter (tn_cache_mtx);
+  place = (caddr_t **) id_hash_get (ht, (caddr_t) &key);
+  mutex_leave (tn_cache_mtx);
+  if (!place || !place[0])
+    return 0;
+  if (state && !SRC_IN_STATE ((data_source_t *)tn, inst))
+    {
+      /* init */
+      SRC_IN_STATE ((data_source_t*)tn, inst) = inst;
+      QST_INT (inst, tn->tn_nth_cache_result) = 0;
+    }
+  for (nth = QST_INT (inst, tn->tn_nth_cache_result); nth < BOX_ELEMENTS (place[0]); nth ++)
+    {
+      int inx;
+      caddr_t * row = (caddr_t *) (place[0][nth]);
+      if (!row)
+	{
+	  QST_INT (inst, tn->tn_nth_cache_result)++;
+	  continue;
+	}
+      DO_BOX (state_slot_t *, out, inx, tn->tn_output)
+	{
+	  qst_set_over (inst, out, row[inx]);
+	}
+      END_DO_BOX;
+      QST_INT (inst, tn->tn_nth_cache_result)++;
+      TC (tn_n_cache_hits);
+      if (QST_INT (inst, tn->tn_nth_cache_result) == BOX_ELEMENTS (place[0]))
+	SRC_IN_STATE ((data_source_t*)tn, inst) = NULL; /* not continuable */
+      qn_send_output ((data_source_t*) tn, inst);
+    }
+  return 1;
+}
 
 void
 tn_results (trans_node_t * tn, caddr_t * inst)
@@ -1052,6 +1140,7 @@ tn_results (trans_node_t * tn, caddr_t * inst)
       SET_THR_TMP_POOL (NULL);
       QST_INT (inst, tn->clb.clb_nth_set) = 0;
     }
+  tn_cache_results (tn, inst);
   /* find the ts corresponding to the set now going and send its content */
   for (;;)
     {
@@ -1125,6 +1214,7 @@ trans_node_start (trans_node_t * tn, caddr_t * inst, caddr_t * state)
       qst_set (inst, tn->tn_relation, (caddr_t)rel);
       SRC_IN_STATE ((data_source_t*)tn, inst) = inst;
       QST_INT (inst, tn->clb.clb_nth_set) = -1;
+      QST_INT (inst, tn->tn_nth_cache_result) = 0;
       nth = 0;
     }
   else
@@ -1223,6 +1313,8 @@ trans_node_input (trans_node_t * tn, caddr_t * inst, caddr_t * state)
 {
   if (THR_TMP_POOL)
     GPF_T1 ("not supposed to run trans node with tmp pool set on entry");
+  if (tn_cache_lookup (tn, inst, state))
+    return;
   if (state)
     trans_node_start (tn, inst, state);
   else
@@ -1255,6 +1347,7 @@ sqlg_trans_node (sql_comp_t * sc)
   tn->tn_max_memory = TN_DEFAULT_MAX_MEMORY;
   tn->clb.clb_itcl = ssl_new_variable (sc->sc_cc, "itcl", DV_ANY);
   tn->tn_state = cc_new_instance_slot (sc->sc_cc);
+  tn->tn_nth_cache_result = cc_new_instance_slot (sc->sc_cc);
   tn->tn_relation = ssl_new_variable (sc->sc_cc, "rel", DV_ANY);
   tn->tn_input_sets = cc_new_instance_slot (sc->sc_cc);
   tn->tn_to_fetch = ssl_new_variable (sc->sc_cc, "to_fetch", DV_ANY);
@@ -1427,6 +1520,7 @@ sqlg_distinct_same_as_1 (sqlo_t * so, data_source_t ** q_head,
       END_DO_SET();
 
       tn = sqlg_trans_node (so->so_sc);
+      sqlg_pre_code_dpipe (so, pre_code, (data_source_t *) tn);
       tn->tn_input = (state_slot_t **) list (1, scalar_exp_generate (so->so_sc, col_dfe->dfe_tree, pre_code));
       tn->tn_output = (state_slot_t**)list (1, tn->tn_input[0]);
       if (!g_dfe)
diff --git a/libsrc/Wi/turtle_l.c b/libsrc/Wi/turtle_l.c
index 2e450a8..1e08426 100644
--- a/libsrc/Wi/turtle_l.c
+++ b/libsrc/Wi/turtle_l.c
@@ -1121,7 +1121,7 @@ static yyconst flex_int16_t yy_chk[2398] =
 #define YY_RESTORE_YY_MORE_OFFSET
 #line 1 "./turtle_l.l"
 /*
- *  $Id: turtle_l.l,v 1.21.2.13 2010/06/25 16:42:03 source Exp $
+ *  $Id: turtle_l.l,v 1.21.2.15 2011/02/20 16:14:59 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -1356,6 +1356,10 @@ int ttlyyget_lineno (yyscan_t yyscanner );
 
 void ttlyyset_lineno (int line_number ,yyscan_t yyscanner );
 
+int ttlyyget_column  (yyscan_t yyscanner );
+
+void ttlyyset_column (int column_no ,yyscan_t yyscanner );
+
 YYSTYPE * ttlyyget_lval (yyscan_t yyscanner );
 
 void ttlyyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
@@ -1408,7 +1412,7 @@ static int input (yyscan_t yyscanner );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -1507,7 +1511,7 @@ YY_DECL
 #line 179 "./turtle_l.l"
 
 
-#line 1511 "turtle_l.c"
+#line 1515 "turtle_l.c"
 
     yylval = yylval_param;
 
@@ -2253,7 +2257,7 @@ YY_RULE_SETUP
 #line 413 "./turtle_l.l"
 ECHO;
 	YY_BREAK
-#line 2257 "turtle_l.c"
+#line 2261 "turtle_l.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(TURTLE_SKIP_TO_DOT_WS):
 case YY_STATE_EOF(UNREACHEABLE):
@@ -3594,7 +3598,7 @@ ttl_query_lex_analyze (caddr_t str, wcharset_t *query_charset)
         {
           caddr_t lex_value = NULL;
           int lexem;
-          lexem = ttlyylex (&lex_value, ttlp, scanner);
+          lexem = ttlyylex ((YYSTYPE *)(&lex_value), ttlp, scanner);
           if (0 == lexem)
             break;
           dk_set_push (&lexems, list (5,
@@ -3749,6 +3753,8 @@ iter_is_set:
     {
       ttlyylex_init (&scanner);
       ttlyyset_extra (ttlp, scanner);
+      if ((ttlp->ttlp_iter == file_read) && !lite_mode && (YY_BUF_SIZE < 0x10000))
+        ttlyypush_buffer_state (ttlyy_create_buffer (NULL, (YY_BUF_SIZE > 0x2000) ? (YY_BUF_SIZE * 8) : 0x10000, scanner), scanner);
 #ifdef MALLOC_DEBUG
       yy_push_state (INITIAL, scanner);
 #endif
diff --git a/libsrc/Wi/turtle_l.l b/libsrc/Wi/turtle_l.l
index d79a001..eec706d 100644
--- a/libsrc/Wi/turtle_l.l
+++ b/libsrc/Wi/turtle_l.l
@@ -1,5 +1,5 @@
 /*
- *  $Id: turtle_l.l,v 1.21.2.13 2010/06/25 16:42:03 source Exp $
+ *  $Id: turtle_l.l,v 1.21.2.15 2011/02/20 16:14:59 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -543,7 +543,7 @@ ttl_query_lex_analyze (caddr_t str, wcharset_t *query_charset)
         {
           caddr_t lex_value = NULL;
           int lexem;
-          lexem = ttlyylex (&lex_value, ttlp, scanner);
+          lexem = ttlyylex ((YYSTYPE *)(&lex_value), ttlp, scanner);
           if (0 == lexem)
             break;
           dk_set_push (&lexems, list (5,
@@ -698,6 +698,8 @@ iter_is_set:
     {
       ttlyylex_init (&scanner);
       ttlyyset_extra (ttlp, scanner);
+      if ((ttlp->ttlp_iter == file_read) && !lite_mode && (YY_BUF_SIZE < 0x10000))
+        ttlyypush_buffer_state (ttlyy_create_buffer (NULL, (YY_BUF_SIZE > 0x2000) ? (YY_BUF_SIZE * 8) : 0x10000, scanner), scanner);
 #ifdef MALLOC_DEBUG
       yy_push_state (INITIAL, scanner);
 #endif
diff --git a/libsrc/Wi/turtle_p.c b/libsrc/Wi/turtle_p.c
index 26943ed..68d54aa 100644
--- a/libsrc/Wi/turtle_p.c
+++ b/libsrc/Wi/turtle_p.c
@@ -606,22 +606,22 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   148,   148,   150,   154,   154,   155,   156,   159,   162,
-     162,   166,   167,   170,   172,   176,   177,   181,   182,   182,
-     192,   193,   197,   198,   202,   202,   206,   210,   210,   213,
-     213,   216,   216,   220,   220,   223,   227,   227,   230,   230,
-     233,   233,   237,   237,   240,   244,   245,   249,   250,   251,
-     252,   253,   254,   257,   259,   263,   265,   264,   271,   272,
-     273,   274,   278,   279,   280,   284,   285,   286,   287,   288,
-     292,   293,   294,   295,   296,   297,   301,   302,   303,   308,
-     307,   311,   310,   314,   314,   321,   322,   326,   327,   328,
-     329,   330,   331,   335,   336,   337,   338,   339,   340,   344,
-     353,   352,   357,   356,   363,   364,   365,   369,   370,   371,
-     372,   373,   374,   375,   376,   376,   382,   383,   387,   392,
-     396,   400,   402,   404,   408,   412,   416,   420,   426,   433,
-     434,   437,   440,   444,   451,   452,   453,   454,   459,   459,
-     469,   475,   484,   484,   518,   519,   538,   538,   558,   565,
-     573
+       0,   148,   148,   150,   154,   154,   155,   156,   175,   178,
+     178,   182,   183,   186,   188,   192,   193,   197,   198,   198,
+     208,   209,   213,   214,   218,   218,   222,   226,   226,   229,
+     229,   232,   232,   236,   236,   239,   243,   243,   246,   246,
+     249,   249,   253,   253,   256,   260,   261,   265,   266,   267,
+     268,   269,   270,   273,   275,   279,   281,   280,   287,   288,
+     289,   290,   294,   295,   296,   300,   301,   302,   303,   304,
+     308,   309,   310,   311,   312,   313,   317,   318,   319,   324,
+     323,   327,   326,   330,   330,   337,   338,   342,   343,   344,
+     345,   346,   347,   351,   352,   353,   354,   355,   356,   360,
+     369,   368,   373,   372,   379,   380,   381,   385,   386,   387,
+     388,   389,   390,   391,   392,   392,   398,   399,   403,   408,
+     412,   416,   418,   420,   424,   428,   432,   436,   442,   449,
+     450,   453,   456,   460,   467,   468,   469,   470,   475,   475,
+     485,   491,   500,   500,   534,   535,   554,   554,   574,   581,
+     589
 };
 #endif
 
@@ -1774,14 +1774,30 @@ yyreduce:
 /* Line 1455 of yacc.c  */
 #line 156 "./turtle_p.y"
     {
-		dk_set_push (&(ttlp_arg->ttlp_namespaces), (yyvsp[(3) - (4)].box));
-		dk_set_push (&(ttlp_arg->ttlp_namespaces), (yyvsp[(2) - (4)].box)); }
+		caddr_t *old_uri_ptr;
+		if (NULL != ttlp_arg->ttlp_namespaces_prefix2iri)
+		  old_uri_ptr = (caddr_t *)id_hash_get (ttlp_arg->ttlp_namespaces_prefix2iri, &((yyvsp[(2) - (4)].box)));
+		else
+		  {
+		    ttlp_arg->ttlp_namespaces_prefix2iri = (id_hash_t *)box_dv_dict_hashtable (31);
+		    old_uri_ptr = NULL;
+		  }
+		if (NULL != old_uri_ptr)
+		  {
+		    int err = strcmp (old_uri_ptr[0], (yyvsp[(3) - (4)].box));
+		    dk_free_box ((yyvsp[(2) - (4)].box));
+		    dk_free_box ((yyvsp[(3) - (4)].box));
+		    if (err)
+		      ttlyyerror_action ("Namespace prefix is re-used for a different namespace IRI");
+		  }
+		else
+		  id_hash_set (ttlp_arg->ttlp_namespaces_prefix2iri, &((yyvsp[(2) - (4)].box)), &((yyvsp[(3) - (4)].box))); }
     break;
 
   case 8:
 
 /* Line 1455 of yacc.c  */
-#line 159 "./turtle_p.y"
+#line 175 "./turtle_p.y"
     {
 		dk_free_box (ttlp_arg->ttlp_default_ns_uri);
 		ttlp_arg->ttlp_default_ns_uri = (yyvsp[(3) - (4)].box); }
@@ -1790,7 +1806,7 @@ yyreduce:
   case 9:
 
 /* Line 1455 of yacc.c  */
-#line 162 "./turtle_p.y"
+#line 178 "./turtle_p.y"
     { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = ttlp_arg->ttlp_last_complete_uri;
 		ttlp_arg->ttlp_last_complete_uri = NULL; }
@@ -1799,14 +1815,14 @@ yyreduce:
   case 12:
 
 /* Line 1455 of yacc.c  */
-#line 167 "./turtle_p.y"
+#line 183 "./turtle_p.y"
     { ttlyyerror_action ("Only a triple or a special clause (like prefix declaration) is allowed here"); }
     break;
 
   case 18:
 
 /* Line 1455 of yacc.c  */
-#line 182 "./turtle_p.y"
+#line 198 "./turtle_p.y"
     {
 		triple_feed_t *tf = ttlp_arg->ttlp_tf;
 		TTLYYERROR_ACTION_COND (TTLP_ALLOW_TRIG, "Left curly brace can appear here only if the source text is TriG");
@@ -1816,7 +1832,7 @@ yyreduce:
   case 19:
 
 /* Line 1455 of yacc.c  */
-#line 186 "./turtle_p.y"
+#line 202 "./turtle_p.y"
     {
 		triple_feed_t *tf = ttlp_arg->ttlp_tf;
 		TF_CHANGE_GRAPH_TO_DEFAULT (tf); }
@@ -1825,7 +1841,7 @@ yyreduce:
   case 24:
 
 /* Line 1455 of yacc.c  */
-#line 202 "./turtle_p.y"
+#line 218 "./turtle_p.y"
     { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = ttlp_arg->ttlp_last_complete_uri;
 		ttlp_arg->ttlp_last_complete_uri = NULL; }
@@ -1834,7 +1850,7 @@ yyreduce:
   case 27:
 
 /* Line 1455 of yacc.c  */
-#line 210 "./turtle_p.y"
+#line 226 "./turtle_p.y"
     { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = (yyvsp[(1) - (1)].box); }
     break;
@@ -1842,7 +1858,7 @@ yyreduce:
   case 29:
 
 /* Line 1455 of yacc.c  */
-#line 213 "./turtle_p.y"
+#line 229 "./turtle_p.y"
     { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = (yyvsp[(1) - (1)].box); }
     break;
@@ -1850,7 +1866,7 @@ yyreduce:
   case 31:
 
 /* Line 1455 of yacc.c  */
-#line 216 "./turtle_p.y"
+#line 232 "./turtle_p.y"
     {
 		TTLYYERROR_ACTION_COND (TTLP_SKIP_LITERAL_SUBJECTS, "Virtuoso does not support literal subjects");
 		dk_free_tree (ttlp_arg->ttlp_subj_uri); ttlp_arg->ttlp_subj_uri = NULL; }
@@ -1859,7 +1875,7 @@ yyreduce:
   case 33:
 
 /* Line 1455 of yacc.c  */
-#line 220 "./turtle_p.y"
+#line 236 "./turtle_p.y"
     { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = NULL; }
     break;
@@ -1867,7 +1883,7 @@ yyreduce:
   case 36:
 
 /* Line 1455 of yacc.c  */
-#line 227 "./turtle_p.y"
+#line 243 "./turtle_p.y"
     { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = (yyvsp[(1) - (1)].box); }
     break;
@@ -1875,7 +1891,7 @@ yyreduce:
   case 38:
 
 /* Line 1455 of yacc.c  */
-#line 230 "./turtle_p.y"
+#line 246 "./turtle_p.y"
     { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = (yyvsp[(1) - (1)].box); }
     break;
@@ -1883,7 +1899,7 @@ yyreduce:
   case 40:
 
 /* Line 1455 of yacc.c  */
-#line 233 "./turtle_p.y"
+#line 249 "./turtle_p.y"
     {
 		TTLYYERROR_ACTION_COND (TTLP_SKIP_LITERAL_SUBJECTS, "Virtuoso does not support literal subjects");
 		dk_free_tree (ttlp_arg->ttlp_subj_uri); ttlp_arg->ttlp_subj_uri = NULL; }
@@ -1892,7 +1908,7 @@ yyreduce:
   case 42:
 
 /* Line 1455 of yacc.c  */
-#line 237 "./turtle_p.y"
+#line 253 "./turtle_p.y"
     { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = NULL; }
     break;
@@ -1900,63 +1916,63 @@ yyreduce:
   case 45:
 
 /* Line 1455 of yacc.c  */
-#line 244 "./turtle_p.y"
+#line 260 "./turtle_p.y"
     { ttlp_arg->ttlp_special_qnames &= ~((yyvsp[(1) - (1)].token_type)); }
     break;
 
   case 46:
 
 /* Line 1455 of yacc.c  */
-#line 245 "./turtle_p.y"
+#line 261 "./turtle_p.y"
     { ttlp_arg->ttlp_special_qnames &= ~((yyvsp[(3) - (3)].token_type)); }
     break;
 
   case 47:
 
 /* Line 1455 of yacc.c  */
-#line 249 "./turtle_p.y"
+#line 265 "./turtle_p.y"
     { (yyval.token_type) = ttlp_bit_of_special_qname ((yyvsp[(1) - (1)].box)); }
     break;
 
   case 48:
 
 /* Line 1455 of yacc.c  */
-#line 250 "./turtle_p.y"
+#line 266 "./turtle_p.y"
     { (yyval.token_type) = TTLP_ALLOW_QNAME_A; }
     break;
 
   case 49:
 
 /* Line 1455 of yacc.c  */
-#line 251 "./turtle_p.y"
+#line 267 "./turtle_p.y"
     { (yyval.token_type) = TTLP_ALLOW_QNAME_HAS; }
     break;
 
   case 50:
 
 /* Line 1455 of yacc.c  */
-#line 252 "./turtle_p.y"
+#line 268 "./turtle_p.y"
     { (yyval.token_type) = TTLP_ALLOW_QNAME_IS; }
     break;
 
   case 51:
 
 /* Line 1455 of yacc.c  */
-#line 253 "./turtle_p.y"
+#line 269 "./turtle_p.y"
     { (yyval.token_type) = TTLP_ALLOW_QNAME_OF; }
     break;
 
   case 52:
 
 /* Line 1455 of yacc.c  */
-#line 254 "./turtle_p.y"
+#line 270 "./turtle_p.y"
     { (yyval.token_type) = TTLP_ALLOW_QNAME_THIS; }
     break;
 
   case 56:
 
 /* Line 1455 of yacc.c  */
-#line 265 "./turtle_p.y"
+#line 281 "./turtle_p.y"
     {
 		  TTLYYERROR_ACTION_COND (TTLP_VERB_MAY_BE_BLANK, "Sequence blank node (written as '{...}' formula) can not be used as a predicate"); }
     break;
@@ -1964,70 +1980,70 @@ yyreduce:
   case 60:
 
 /* Line 1455 of yacc.c  */
-#line 273 "./turtle_p.y"
+#line 289 "./turtle_p.y"
     { TTLYYERROR_ACTION_COND (TTLP_ACCEPT_DIRTY_SYNTAX, "Missing predicate and object between top-level blank node subject and a dot"); }
     break;
 
   case 67:
 
 /* Line 1455 of yacc.c  */
-#line 286 "./turtle_p.y"
+#line 302 "./turtle_p.y"
     { ttlyyerror_action ("Missing object between top-level blank node and a comma"); }
     break;
 
   case 68:
 
 /* Line 1455 of yacc.c  */
-#line 287 "./turtle_p.y"
+#line 303 "./turtle_p.y"
     { ttlyyerror_action ("Missing predicate and object between top-level blank node and a semicolon"); }
     break;
 
   case 69:
 
 /* Line 1455 of yacc.c  */
-#line 288 "./turtle_p.y"
+#line 304 "./turtle_p.y"
     { ttlyyerror_action ("Predicate expected after top-level blank node"); }
     break;
 
   case 72:
 
 /* Line 1455 of yacc.c  */
-#line 294 "./turtle_p.y"
+#line 310 "./turtle_p.y"
     { ttlyyerror_action ("Missing object before comma"); }
     break;
 
   case 73:
 
 /* Line 1455 of yacc.c  */
-#line 295 "./turtle_p.y"
+#line 311 "./turtle_p.y"
     { ttlyyerror_action ("Missing predicate and object before semicolon"); }
     break;
 
   case 74:
 
 /* Line 1455 of yacc.c  */
-#line 296 "./turtle_p.y"
+#line 312 "./turtle_p.y"
     { ttlyyerror_action ("Missing predicate and object before dot"); }
     break;
 
   case 75:
 
 /* Line 1455 of yacc.c  */
-#line 297 "./turtle_p.y"
+#line 313 "./turtle_p.y"
     { ttlyyerror_action ("Predicate expected"); }
     break;
 
   case 79:
 
 /* Line 1455 of yacc.c  */
-#line 308 "./turtle_p.y"
+#line 324 "./turtle_p.y"
     { dk_free_tree (ttlp_arg->ttlp_pred_uri); ttlp_arg->ttlp_pred_uri = (yyvsp[(1) - (1)].box); }
     break;
 
   case 81:
 
 /* Line 1455 of yacc.c  */
-#line 311 "./turtle_p.y"
+#line 327 "./turtle_p.y"
     { dk_free_tree (ttlp_arg->ttlp_pred_uri); ttlp_arg->ttlp_pred_uri = (yyvsp[(1) - (1)].box);
 		  ttlp_arg->ttlp_pred_is_reverse = 1; }
     break;
@@ -2035,14 +2051,14 @@ yyreduce:
   case 82:
 
 /* Line 1455 of yacc.c  */
-#line 313 "./turtle_p.y"
+#line 329 "./turtle_p.y"
     { ttlp_arg->ttlp_pred_is_reverse = 0; }
     break;
 
   case 83:
 
 /* Line 1455 of yacc.c  */
-#line 314 "./turtle_p.y"
+#line 330 "./turtle_p.y"
     {
 		  dk_free_tree (ttlp_arg->ttlp_pred_uri);
 		  ttlp_arg->ttlp_pred_uri = NULL; }
@@ -2051,84 +2067,84 @@ yyreduce:
   case 87:
 
 /* Line 1455 of yacc.c  */
-#line 326 "./turtle_p.y"
+#line 342 "./turtle_p.y"
     {; /* triple is made by object */ }
     break;
 
   case 88:
 
 /* Line 1455 of yacc.c  */
-#line 327 "./turtle_p.y"
+#line 343 "./turtle_p.y"
     {; /* triple is made by object */ }
     break;
 
   case 89:
 
 /* Line 1455 of yacc.c  */
-#line 328 "./turtle_p.y"
+#line 344 "./turtle_p.y"
     { ttlyyerror_action ("Missing object before comma"); }
     break;
 
   case 90:
 
 /* Line 1455 of yacc.c  */
-#line 329 "./turtle_p.y"
+#line 345 "./turtle_p.y"
     { ttlyyerror_action ("Missing object before semicolon"); }
     break;
 
   case 91:
 
 /* Line 1455 of yacc.c  */
-#line 330 "./turtle_p.y"
+#line 346 "./turtle_p.y"
     { ttlyyerror_action ("Missing object before dot"); }
     break;
 
   case 92:
 
 /* Line 1455 of yacc.c  */
-#line 331 "./turtle_p.y"
+#line 347 "./turtle_p.y"
     { ttlyyerror_action ("Object expected"); }
     break;
 
   case 93:
 
 /* Line 1455 of yacc.c  */
-#line 335 "./turtle_p.y"
+#line 351 "./turtle_p.y"
     { (yyval.box) = ttlp_arg->ttlp_last_complete_uri; ttlp_arg->ttlp_last_complete_uri = NULL; }
     break;
 
   case 94:
 
 /* Line 1455 of yacc.c  */
-#line 336 "./turtle_p.y"
+#line 352 "./turtle_p.y"
     { (yyval.box) = (yyvsp[(1) - (1)].box); }
     break;
 
   case 95:
 
 /* Line 1455 of yacc.c  */
-#line 337 "./turtle_p.y"
+#line 353 "./turtle_p.y"
     { (yyval.box) = uname_rdf_ns_uri_type; }
     break;
 
   case 96:
 
 /* Line 1455 of yacc.c  */
-#line 338 "./turtle_p.y"
+#line 354 "./turtle_p.y"
     { (yyval.box) = box_dv_uname_string ("http://www.w3.org/2002/07/owl#sameAs"); }
     break;
 
   case 97:
 
 /* Line 1455 of yacc.c  */
-#line 339 "./turtle_p.y"
+#line 355 "./turtle_p.y"
     { (yyval.box) = box_dv_uname_string ("http://www.w3.org/2000/10/swap/log#implies"); }
     break;
 
   case 98:
 
 /* Line 1455 of yacc.c  */
-#line 341 "./turtle_p.y"
+#line 357 "./turtle_p.y"
     {
 		  TTLYYERROR_ACTION_COND (TTLP_VERB_MAY_BE_BLANK, "Blank node (written as '[]') can not be used as a predicate");
 		  (yyval.box) = tf_bnode_iid (ttlp_arg->ttlp_tf, NULL); }
@@ -2137,7 +2153,7 @@ yyreduce:
   case 99:
 
 /* Line 1455 of yacc.c  */
-#line 345 "./turtle_p.y"
+#line 361 "./turtle_p.y"
     {
 		  TTLYYERROR_ACTION_COND (TTLP_VERB_MAY_BE_BLANK, "Blank node (written as '_:...' label) can not be used as a predicate");
                   if (ttlp_arg->ttlp_formula_iid)
@@ -2150,7 +2166,7 @@ yyreduce:
   case 100:
 
 /* Line 1455 of yacc.c  */
-#line 353 "./turtle_p.y"
+#line 369 "./turtle_p.y"
     {
 		  TTLYYERROR_ACTION_COND (TTLP_VERB_MAY_BE_BLANK, "Blank node (written as '[...]' block) can not be used as a predicate"); }
     break;
@@ -2158,14 +2174,14 @@ yyreduce:
   case 101:
 
 /* Line 1455 of yacc.c  */
-#line 355 "./turtle_p.y"
+#line 371 "./turtle_p.y"
     { (yyval.box) = (yyvsp[(3) - (3)].box); }
     break;
 
   case 102:
 
 /* Line 1455 of yacc.c  */
-#line 357 "./turtle_p.y"
+#line 373 "./turtle_p.y"
     {
 		  TTLYYERROR_ACTION_COND (TTLP_VERB_MAY_BE_BLANK, "Sequence blank node (written as list in parenthesis) can not be used as a predicate"); }
     break;
@@ -2173,77 +2189,77 @@ yyreduce:
   case 103:
 
 /* Line 1455 of yacc.c  */
-#line 359 "./turtle_p.y"
+#line 375 "./turtle_p.y"
     { (yyval.box) = (yyvsp[(3) - (3)].box); }
     break;
 
   case 104:
 
 /* Line 1455 of yacc.c  */
-#line 363 "./turtle_p.y"
+#line 379 "./turtle_p.y"
     { (yyval.box) = ttlp_arg->ttlp_last_complete_uri; ttlp_arg->ttlp_last_complete_uri = NULL; }
     break;
 
   case 105:
 
 /* Line 1455 of yacc.c  */
-#line 364 "./turtle_p.y"
+#line 380 "./turtle_p.y"
     { (yyval.box) = (yyvsp[(2) - (3)].box); }
     break;
 
   case 106:
 
 /* Line 1455 of yacc.c  */
-#line 365 "./turtle_p.y"
+#line 381 "./turtle_p.y"
     { (yyval.box) = box_dv_uname_string ("http://www.w3.org/2000/10/swap/log#implies"); /* Note this 'double reversed' meaning :) */ }
     break;
 
   case 109:
 
 /* Line 1455 of yacc.c  */
-#line 371 "./turtle_p.y"
+#line 387 "./turtle_p.y"
     { dk_free_tree ((yyvsp[(1) - (1)].box)); }
     break;
 
   case 110:
 
 /* Line 1455 of yacc.c  */
-#line 372 "./turtle_p.y"
+#line 388 "./turtle_p.y"
     { dk_free_tree ((yyvsp[(1) - (1)].box)); }
     break;
 
   case 111:
 
 /* Line 1455 of yacc.c  */
-#line 373 "./turtle_p.y"
+#line 389 "./turtle_p.y"
     { dk_free_tree ((yyvsp[(1) - (1)].box)); }
     break;
 
   case 112:
 
 /* Line 1455 of yacc.c  */
-#line 374 "./turtle_p.y"
+#line 390 "./turtle_p.y"
     { dk_free_tree ((yyvsp[(1) - (1)].box)); }
     break;
 
   case 113:
 
 /* Line 1455 of yacc.c  */
-#line 375 "./turtle_p.y"
+#line 391 "./turtle_p.y"
     { dk_free_tree ((yyvsp[(1) - (2)].box)); dk_free_tree ((yyvsp[(2) - (2)].box)); }
     break;
 
   case 114:
 
 /* Line 1455 of yacc.c  */
-#line 376 "./turtle_p.y"
+#line 392 "./turtle_p.y"
     { dk_free_tree ((yyvsp[(1) - (1)].box)); }
     break;
 
   case 115:
 
 /* Line 1455 of yacc.c  */
-#line 376 "./turtle_p.y"
+#line 392 "./turtle_p.y"
     {
 			dk_free_tree (ttlp_arg->ttlp_last_complete_uri);
 			ttlp_arg->ttlp_last_complete_uri = NULL; }
@@ -2252,7 +2268,7 @@ yyreduce:
   case 118:
 
 /* Line 1455 of yacc.c  */
-#line 387 "./turtle_p.y"
+#line 403 "./turtle_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = ttlp_arg->ttlp_last_complete_uri;
@@ -2263,7 +2279,7 @@ yyreduce:
   case 119:
 
 /* Line 1455 of yacc.c  */
-#line 392 "./turtle_p.y"
+#line 408 "./turtle_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (1)].box);
@@ -2273,7 +2289,7 @@ yyreduce:
   case 120:
 
 /* Line 1455 of yacc.c  */
-#line 396 "./turtle_p.y"
+#line 412 "./turtle_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (1)].box);
@@ -2283,7 +2299,7 @@ yyreduce:
   case 121:
 
 /* Line 1455 of yacc.c  */
-#line 400 "./turtle_p.y"
+#line 416 "./turtle_p.y"
     {
 		ttlp_triple_l_and_inf (ttlp_arg, (caddr_t)((ptrlong)1), uname_xmlschema_ns_uri_hash_boolean, NULL); }
     break;
@@ -2291,7 +2307,7 @@ yyreduce:
   case 122:
 
 /* Line 1455 of yacc.c  */
-#line 402 "./turtle_p.y"
+#line 418 "./turtle_p.y"
     {
 		ttlp_triple_l_and_inf (ttlp_arg, (caddr_t)((ptrlong)0), uname_xmlschema_ns_uri_hash_boolean, NULL); }
     break;
@@ -2299,7 +2315,7 @@ yyreduce:
   case 123:
 
 /* Line 1455 of yacc.c  */
-#line 404 "./turtle_p.y"
+#line 420 "./turtle_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (1)].box);
@@ -2309,7 +2325,7 @@ yyreduce:
   case 124:
 
 /* Line 1455 of yacc.c  */
-#line 408 "./turtle_p.y"
+#line 424 "./turtle_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (1)].box);
@@ -2319,7 +2335,7 @@ yyreduce:
   case 125:
 
 /* Line 1455 of yacc.c  */
-#line 412 "./turtle_p.y"
+#line 428 "./turtle_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (1)].box);
@@ -2329,7 +2345,7 @@ yyreduce:
   case 126:
 
 /* Line 1455 of yacc.c  */
-#line 416 "./turtle_p.y"
+#line 432 "./turtle_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (1)].box);
@@ -2339,7 +2355,7 @@ yyreduce:
   case 127:
 
 /* Line 1455 of yacc.c  */
-#line 420 "./turtle_p.y"
+#line 436 "./turtle_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (2)].box);
@@ -2351,7 +2367,7 @@ yyreduce:
   case 128:
 
 /* Line 1455 of yacc.c  */
-#line 426 "./turtle_p.y"
+#line 442 "./turtle_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (3)].box);
@@ -2364,14 +2380,14 @@ yyreduce:
   case 129:
 
 /* Line 1455 of yacc.c  */
-#line 433 "./turtle_p.y"
+#line 449 "./turtle_p.y"
     { }
     break;
 
   case 130:
 
 /* Line 1455 of yacc.c  */
-#line 434 "./turtle_p.y"
+#line 450 "./turtle_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_obj);
 		ttlp_arg->ttlp_obj = (yyvsp[(1) - (3)].box); }
@@ -2380,7 +2396,7 @@ yyreduce:
   case 131:
 
 /* Line 1455 of yacc.c  */
-#line 437 "./turtle_p.y"
+#line 453 "./turtle_p.y"
     {
 		dk_free_tree (ttlp_arg->ttlp_last_complete_uri);
 		ttlp_arg->ttlp_last_complete_uri = NULL; }
@@ -2389,14 +2405,14 @@ yyreduce:
   case 132:
 
 /* Line 1455 of yacc.c  */
-#line 440 "./turtle_p.y"
+#line 456 "./turtle_p.y"
     { }
     break;
 
   case 133:
 
 /* Line 1455 of yacc.c  */
-#line 445 "./turtle_p.y"
+#line 461 "./turtle_p.y"
     {
                   if (ttlp_arg->ttlp_formula_iid)
 		    (yyval.box) = tf_formula_bnode_iid (ttlp_arg, (yyvsp[(1) - (1)].box));
@@ -2408,35 +2424,35 @@ yyreduce:
   case 134:
 
 /* Line 1455 of yacc.c  */
-#line 451 "./turtle_p.y"
+#line 467 "./turtle_p.y"
     { (yyval.box) = tf_bnode_iid (ttlp_arg->ttlp_tf, NULL); }
     break;
 
   case 135:
 
 /* Line 1455 of yacc.c  */
-#line 452 "./turtle_p.y"
+#line 468 "./turtle_p.y"
     { (yyval.box) = (yyvsp[(2) - (2)].box); }
     break;
 
   case 136:
 
 /* Line 1455 of yacc.c  */
-#line 453 "./turtle_p.y"
+#line 469 "./turtle_p.y"
     { (yyval.box) = (yyvsp[(2) - (2)].box); }
     break;
 
   case 137:
 
 /* Line 1455 of yacc.c  */
-#line 454 "./turtle_p.y"
+#line 470 "./turtle_p.y"
     { (yyval.box) = (yyvsp[(2) - (2)].box); }
     break;
 
   case 138:
 
 /* Line 1455 of yacc.c  */
-#line 459 "./turtle_p.y"
+#line 475 "./turtle_p.y"
     { dk_set_push (&(ttlp_arg->ttlp_saved_uris), (void *)(ptrlong)ttlp_arg->ttlp_pred_is_reverse);
                   dk_set_push (&(ttlp_arg->ttlp_saved_uris), ttlp_arg->ttlp_subj_uri);
 		  dk_set_push (&(ttlp_arg->ttlp_saved_uris), ttlp_arg->ttlp_pred_uri);
@@ -2448,14 +2464,14 @@ yyreduce:
   case 139:
 
 /* Line 1455 of yacc.c  */
-#line 465 "./turtle_p.y"
+#line 481 "./turtle_p.y"
     { (yyval.box) = (yyvsp[(2) - (2)].box); }
     break;
 
   case 140:
 
 /* Line 1455 of yacc.c  */
-#line 470 "./turtle_p.y"
+#line 486 "./turtle_p.y"
     { (yyval.box) = ttlp_arg->ttlp_subj_uri;
 		  dk_free_tree (ttlp_arg->ttlp_pred_uri);
 		  ttlp_arg->ttlp_pred_uri = dk_set_pop (&(ttlp_arg->ttlp_saved_uris));
@@ -2466,7 +2482,7 @@ yyreduce:
   case 141:
 
 /* Line 1455 of yacc.c  */
-#line 476 "./turtle_p.y"
+#line 492 "./turtle_p.y"
     { (yyval.box) = ttlp_arg->ttlp_subj_uri;
 		  dk_free_tree (ttlp_arg->ttlp_pred_uri);
 		  ttlp_arg->ttlp_pred_uri = dk_set_pop (&(ttlp_arg->ttlp_saved_uris));
@@ -2477,7 +2493,7 @@ yyreduce:
   case 142:
 
 /* Line 1455 of yacc.c  */
-#line 484 "./turtle_p.y"
+#line 500 "./turtle_p.y"
     {
 		  dk_set_push (&(ttlp_arg->ttlp_saved_uris), (void *)(ptrlong)(ttlp_arg->ttlp_pred_is_reverse));
 		  dk_set_push (&(ttlp_arg->ttlp_saved_uris), ttlp_arg->ttlp_subj_uri);
@@ -2495,7 +2511,7 @@ yyreduce:
   case 143:
 
 /* Line 1455 of yacc.c  */
-#line 496 "./turtle_p.y"
+#line 512 "./turtle_p.y"
     {
 		  caddr_t first_node;
 		  dk_set_push (&(ttlp_arg->ttlp_unused_seq_bnodes), ttlp_arg->ttlp_subj_uri);
@@ -2520,14 +2536,14 @@ yyreduce:
   case 144:
 
 /* Line 1455 of yacc.c  */
-#line 518 "./turtle_p.y"
+#line 534 "./turtle_p.y"
     {}
     break;
 
   case 145:
 
 /* Line 1455 of yacc.c  */
-#line 519 "./turtle_p.y"
+#line 535 "./turtle_p.y"
     {
 		  caddr_t last_node = ttlp_arg->ttlp_subj_uri;
 		  ttlp_arg->ttlp_subj_uri = dk_set_pop (&(ttlp_arg->ttlp_saved_uris));
@@ -2548,7 +2564,7 @@ yyreduce:
   case 146:
 
 /* Line 1455 of yacc.c  */
-#line 538 "./turtle_p.y"
+#line 554 "./turtle_p.y"
     {
 		  dk_set_push (&(ttlp_arg->ttlp_saved_uris), ttlp_arg->ttlp_formula_iid);
 		  dk_set_push (&(ttlp_arg->ttlp_saved_uris), (void *)(ptrlong)ttlp_arg->ttlp_pred_is_reverse);
@@ -2563,7 +2579,7 @@ yyreduce:
   case 147:
 
 /* Line 1455 of yacc.c  */
-#line 548 "./turtle_p.y"
+#line 564 "./turtle_p.y"
     { (yyval.box) = ttlp_arg->ttlp_formula_iid;
 		  dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		  dk_free_tree (ttlp_arg->ttlp_pred_uri);
@@ -2576,7 +2592,7 @@ yyreduce:
   case 148:
 
 /* Line 1455 of yacc.c  */
-#line 559 "./turtle_p.y"
+#line 575 "./turtle_p.y"
     {
                   if (NULL != ttlp_arg->ttlp_last_complete_uri)
 		    ttlyyerror_action ("Internal error: proven memory leak");
@@ -2588,7 +2604,7 @@ yyreduce:
   case 149:
 
 /* Line 1455 of yacc.c  */
-#line 566 "./turtle_p.y"
+#line 582 "./turtle_p.y"
     {
                   if (NULL != ttlp_arg->ttlp_last_complete_uri)
 		    ttlyyerror_action ("Internal error: proven memory leak");
@@ -2601,7 +2617,7 @@ yyreduce:
   case 150:
 
 /* Line 1455 of yacc.c  */
-#line 574 "./turtle_p.y"
+#line 590 "./turtle_p.y"
     {
                   if (NULL != ttlp_arg->ttlp_last_complete_uri)
 		    ttlyyerror_action ("Internal error: proven memory leak");
@@ -2614,7 +2630,7 @@ yyreduce:
 
 
 /* Line 1455 of yacc.c  */
-#line 2618 "turtle_p.c"
+#line 2634 "turtle_p.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/libsrc/Wi/turtle_p.y b/libsrc/Wi/turtle_p.y
index 0f15a3d..c550019 100644
--- a/libsrc/Wi/turtle_p.y
+++ b/libsrc/Wi/turtle_p.y
@@ -1,5 +1,5 @@
 /*
- *  $Id: turtle_p.y,v 1.17.2.7 2009/11/25 22:05:52 source Exp $
+ *  $Id: turtle_p.y,v 1.17.2.8 2011/01/03 10:17:27 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -154,8 +154,24 @@ clause
         : _AT_keywords_L { ttlp_arg->ttlp_special_qnames = ~0; } keyword_list dot_opt
 	| _AT_base_L Q_IRI_REF dot_opt { dk_free_box (ttlp_arg->ttlp_tf->tf_base_uri); ttlp_arg->ttlp_tf->tf_base_uri = $2; }
         | _AT_prefix_L QNAME_NS Q_IRI_REF dot_opt {
-		dk_set_push (&(ttlp_arg->ttlp_namespaces), $3);
-		dk_set_push (&(ttlp_arg->ttlp_namespaces), $2); }
+		caddr_t *old_uri_ptr;
+		if (NULL != ttlp_arg->ttlp_namespaces_prefix2iri)
+		  old_uri_ptr = (caddr_t *)id_hash_get (ttlp_arg->ttlp_namespaces_prefix2iri, &($2));
+		else
+		  {
+		    ttlp_arg->ttlp_namespaces_prefix2iri = (id_hash_t *)box_dv_dict_hashtable (31);
+		    old_uri_ptr = NULL;
+		  }
+		if (NULL != old_uri_ptr)
+		  {
+		    int err = strcmp (old_uri_ptr[0], $3);
+		    dk_free_box ($2);
+		    dk_free_box ($3);
+		    if (err)
+		      ttlyyerror_action ("Namespace prefix is re-used for a different namespace IRI");
+		  }
+		else
+		  id_hash_set (ttlp_arg->ttlp_namespaces_prefix2iri, &($2), &($3)); }
 	| _AT_prefix_L _COLON Q_IRI_REF dot_opt	{
 		dk_free_box (ttlp_arg->ttlp_default_ns_uri);
 		ttlp_arg->ttlp_default_ns_uri = $3; }
diff --git a/libsrc/Wi/uname_const_decl.c b/libsrc/Wi/uname_const_decl.c
new file mode 100644
index 0000000..ad231a5
--- /dev/null
+++ b/libsrc/Wi/uname_const_decl.c
@@ -0,0 +1,280 @@
+/*
+ *  $Id: uname_const_decl.c,v 1.1.2.2 2011/03/22 23:50:55 source Exp $
+ *
+ *  Constant declarations of commonly used UNAMEs.
+ *
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *
+ *  Copyright (C) 1998-2010 OpenLink Software
+ *
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "Dk.h"
+#include "xmlparser.h" /* For XML_NS_URI etc. */
+#include "uname_const_decl.h"
+
+caddr_t uname__bang_cdata_section_elements;
+caddr_t uname__bang_exclude_result_prefixes;
+caddr_t uname__bang_file;
+caddr_t uname__bang_location;
+caddr_t uname__bang_name;
+caddr_t uname__bang_ns;
+caddr_t uname__bang_uri;
+caddr_t uname__bang_use_attribute_sets;
+caddr_t uname__bang_xmlns;
+caddr_t uname__attr;
+caddr_t uname__comment;
+caddr_t uname__disable_output_escaping;
+caddr_t uname__root;
+caddr_t uname__pi;
+caddr_t uname__ref;
+caddr_t uname__srcfile;
+caddr_t uname__srcline;
+caddr_t uname__txt;
+caddr_t uname__xslt;
+caddr_t uname_lang;
+caddr_t uname_nil;
+caddr_t uname_nodeID_ns;
+caddr_t uname_rdf_ns_uri;
+caddr_t uname_rdf_ns_uri_Description;
+caddr_t uname_rdf_ns_uri_ID;
+caddr_t uname_rdf_ns_uri_RDF;
+caddr_t uname_rdf_ns_uri_Seq;
+caddr_t uname_rdf_ns_uri_Statement;
+caddr_t uname_rdf_ns_uri_XMLLiteral;
+caddr_t uname_rdf_ns_uri_about;
+caddr_t uname_rdf_ns_uri_first;
+caddr_t uname_rdf_ns_uri_li;
+caddr_t uname_rdf_ns_uri_nil;
+caddr_t uname_rdf_ns_uri_nodeID;
+caddr_t uname_rdf_ns_uri_object;
+caddr_t uname_rdf_ns_uri_predicate;
+caddr_t uname_rdf_ns_uri_resource;
+caddr_t uname_rdf_ns_uri_rest;
+caddr_t uname_rdf_ns_uri_subject;
+caddr_t uname_rdf_ns_uri_type;
+caddr_t uname_rdf_ns_uri_datatype;
+caddr_t uname_rdf_ns_uri_parseType;
+caddr_t uname_rdf_ns_uri_value;
+caddr_t uname_space;
+caddr_t uname_swap_reify_ns_uri;
+caddr_t uname_swap_reify_ns_uri_statement;
+caddr_t uname_virtrdf_ns_uri;
+caddr_t uname_virtrdf_ns_uri_DefaultQuadMap;
+caddr_t uname_virtrdf_ns_uri_DefaultQuadStorage;
+caddr_t uname_virtrdf_ns_uri_DefaultServiceStorage;
+caddr_t uname_virtrdf_ns_uri_PrivateGraphs;
+caddr_t uname_virtrdf_ns_uri_QuadMap;
+caddr_t uname_virtrdf_ns_uri_QuadMapFormat;
+caddr_t uname_virtrdf_ns_uri_QuadStorage;
+caddr_t uname_virtrdf_ns_uri_SyncToQuads;
+caddr_t uname_virtrdf_ns_uri_array_of_any;
+caddr_t uname_virtrdf_ns_uri_array_of_string;
+caddr_t uname_virtrdf_ns_uri_bitmask;
+caddr_t uname_virtrdf_ns_uri_isSpecialPredicate;
+caddr_t uname_virtrdf_ns_uri_isSubclassOf;
+caddr_t uname_virtrdf_ns_uri_loadAs;
+caddr_t uname_virtrdf_ns_uri_rdf_repl_graph_group;
+caddr_t uname_virtrdf_ns_uri_rdf_repl_all;
+caddr_t uname_xhv_ns_uri;
+caddr_t uname_xhv_ns_uri_alternate;
+caddr_t uname_xhv_ns_uri_appendix;
+caddr_t uname_xhv_ns_uri_bookmark;
+caddr_t uname_xhv_ns_uri_chapter;
+caddr_t uname_xhv_ns_uri_cite;
+caddr_t uname_xhv_ns_uri_contents;
+caddr_t uname_xhv_ns_uri_copyright;
+caddr_t uname_xhv_ns_uri_first;
+caddr_t uname_xhv_ns_uri_glossary;
+caddr_t uname_xhv_ns_uri_help;
+caddr_t uname_xhv_ns_uri_icon;
+caddr_t uname_xhv_ns_uri_index;
+caddr_t uname_xhv_ns_uri_last;
+caddr_t uname_xhv_ns_uri_license;
+caddr_t uname_xhv_ns_uri_meta;
+caddr_t uname_xhv_ns_uri_next;
+caddr_t uname_xhv_ns_uri_p3pv1;
+caddr_t uname_xhv_ns_uri_prev;
+caddr_t uname_xhv_ns_uri_role;
+caddr_t uname_xhv_ns_uri_section;
+caddr_t uname_xhv_ns_uri_start;
+caddr_t uname_xhv_ns_uri_stylesheet;
+caddr_t uname_xhv_ns_uri_subsection;
+caddr_t uname_xhv_ns_uri_up;
+caddr_t uname_xml;
+caddr_t uname_xmlns;
+caddr_t uname_xml_colon_base;
+caddr_t uname_xml_colon_lang;
+caddr_t uname_xml_colon_space;
+caddr_t uname_xml_ns_uri;
+caddr_t uname_xml_ns_uri_colon_base;
+caddr_t uname_xml_ns_uri_colon_lang;
+caddr_t uname_xml_ns_uri_colon_space;
+caddr_t uname_xmlschema_ns_uri;
+caddr_t uname_xmlschema_ns_uri_hash;
+caddr_t uname_xmlschema_ns_uri_hash_any;
+caddr_t uname_xmlschema_ns_uri_hash_anyURI;
+caddr_t uname_xmlschema_ns_uri_hash_boolean;
+caddr_t uname_xmlschema_ns_uri_hash_bitmask;
+caddr_t uname_xmlschema_ns_uri_hash_date;
+caddr_t uname_xmlschema_ns_uri_hash_dateTime;
+caddr_t uname_xmlschema_ns_uri_hash_decimal;
+caddr_t uname_xmlschema_ns_uri_hash_double;
+caddr_t uname_xmlschema_ns_uri_hash_float;
+caddr_t uname_xmlschema_ns_uri_hash_integer;
+caddr_t uname_xmlschema_ns_uri_hash_string;
+caddr_t uname_xmlschema_ns_uri_hash_time;
+caddr_t unames_colon_number[20];
+
+typedef struct uname_const_decl_s
+{
+  caddr_t *var_ptr;
+  const char *text;
+} uname_const_decl_t;
+
+void
+uname_const_decl_init (void)
+{
+  int ctr;
+#define UNAME_IT(var,txt) var = box_dv_uname_string (txt); box_dv_uname_make_immortal (var)
+
+static uname_const_decl_t uname_const_decls[] = {
+  { &uname__bang_cdata_section_elements		, " !cdata-section-elements"	},
+  { &uname__bang_exclude_result_prefixes	, " !exclude_result_prefixes"	},
+  { &uname__bang_file				, " !file"			},
+  { &uname__bang_location			, " !location"			},
+  { &uname__bang_name				, " !name"			},
+  { &uname__bang_ns				, " !ns"			},
+  { &uname__bang_uri				, " !uri"			},
+  { &uname__bang_use_attribute_sets		, " !use-attribute-sets"	},
+  { &uname__bang_xmlns				, " !xmlns"			},
+  { &uname__attr				, " attr"			},
+  { &uname__comment				, " comment"			},
+  { &uname__disable_output_escaping		, " disable-output-escaping"	},
+  { &uname__root				, " root"			},
+  { &uname__pi					, " pi"				},
+  { &uname__ref					, " ref"			},
+  { &uname__srcfile				, " srcfile"			},
+  { &uname__srcline				, " srcline"			},
+  { &uname__txt					, " txt"			},
+  { &uname__xslt				, " xslt"			},
+  { &uname_lang					, "lang"			},
+  { &uname_nil					, "nil"				},
+  { &uname_nodeID_ns				, "nodeID://"			},
+  { &uname_rdf_ns_uri				, RDF_NS_URI			},
+  { &uname_rdf_ns_uri_Description		, RDF_NS_URI "Description"	},
+  { &uname_rdf_ns_uri_ID			, RDF_NS_URI "ID"		},
+  { &uname_rdf_ns_uri_RDF			, RDF_NS_URI "RDF"		},
+  { &uname_rdf_ns_uri_Seq			, RDF_NS_URI "Seq"		},
+  { &uname_rdf_ns_uri_Statement			, RDF_NS_URI "Statement"	},
+  { &uname_rdf_ns_uri_XMLLiteral		, RDF_NS_URI "XMLLiteral"	},
+  { &uname_rdf_ns_uri_about			, RDF_NS_URI "about"		},
+  { &uname_rdf_ns_uri_first			, RDF_NS_URI "first"		},
+  { &uname_rdf_ns_uri_li			, RDF_NS_URI "li"		},
+  { &uname_rdf_ns_uri_nil			, RDF_NS_URI "nil"		},
+  { &uname_rdf_ns_uri_nodeID			, RDF_NS_URI "nodeID"		},
+  { &uname_rdf_ns_uri_object			, RDF_NS_URI "object"		},
+  { &uname_rdf_ns_uri_predicate			, RDF_NS_URI "predicate"	},
+  { &uname_rdf_ns_uri_resource			, RDF_NS_URI "resource"		},
+  { &uname_rdf_ns_uri_subject			, RDF_NS_URI "subject"		},
+  { &uname_rdf_ns_uri_rest			, RDF_NS_URI "rest"		},
+  { &uname_rdf_ns_uri_type			, RDF_NS_URI "type"		},
+  { &uname_rdf_ns_uri_datatype			, RDF_NS_URI "datatype"		},
+  { &uname_rdf_ns_uri_parseType			, RDF_NS_URI "parseType"	},
+  { &uname_rdf_ns_uri_value			, RDF_NS_URI "value"		},
+  { &uname_space				, "space"			},
+  { &uname_swap_reify_ns_uri			, SWAP_REIFY_NS_URI		},
+  { &uname_swap_reify_ns_uri_statement		, SWAP_REIFY_NS_URI "#statement"	},
+  { &uname_virtrdf_ns_uri			, VIRTRDF_NS_URI		},
+  { &uname_virtrdf_ns_uri_DefaultQuadMap	, VIRTRDF_NS_URI "DefaultQuadMap"	},
+  { &uname_virtrdf_ns_uri_DefaultQuadStorage	, VIRTRDF_NS_URI "DefaultQuadStorage"	},
+  { &uname_virtrdf_ns_uri_DefaultServiceStorage	, VIRTRDF_NS_URI "DefaultServiceStorage"	},
+  { &uname_virtrdf_ns_uri_PrivateGraphs		, VIRTRDF_NS_URI "PrivateGraphs"	},
+  { &uname_virtrdf_ns_uri_QuadMap		, VIRTRDF_NS_URI "QuadMap"	},
+  { &uname_virtrdf_ns_uri_QuadMapFormat		, VIRTRDF_NS_URI "QuadMapFormat"	},
+  { &uname_virtrdf_ns_uri_QuadStorage		, VIRTRDF_NS_URI "QuadStorage"	},
+  { &uname_virtrdf_ns_uri_SyncToQuads		, VIRTRDF_NS_URI "SyncToQuads"	},
+  { &uname_virtrdf_ns_uri_array_of_any		, VIRTRDF_NS_URI "array-of-any"	},
+  { &uname_virtrdf_ns_uri_array_of_string	, VIRTRDF_NS_URI "array-of-string"	},
+  { &uname_virtrdf_ns_uri_bitmask		, VIRTRDF_NS_URI "bitmask"	},
+  { &uname_virtrdf_ns_uri_isSpecialPredicate	, VIRTRDF_NS_URI "isSpecialPredicate"	},
+  { &uname_virtrdf_ns_uri_isSubclassOf		, VIRTRDF_NS_URI "isSubclassOf"	},
+  { &uname_virtrdf_ns_uri_loadAs		, VIRTRDF_NS_URI "loadAs"	},
+  { &uname_virtrdf_ns_uri_rdf_repl_graph_group	, VIRTRDF_NS_URI "rdf_repl_graph_group"	},
+  { &uname_virtrdf_ns_uri_rdf_repl_all		, VIRTRDF_NS_URI "rdf_repl_all"	},
+  { &uname_xhv_ns_uri				, XHV_NS_URI			},
+  { &uname_xhv_ns_uri_alternate			, XHV_NS_URI "alternate"	},
+  { &uname_xhv_ns_uri_appendix			, XHV_NS_URI "appendix"		},
+  { &uname_xhv_ns_uri_bookmark			, XHV_NS_URI "bookmark"		},
+  { &uname_xhv_ns_uri_chapter			, XHV_NS_URI "chapter"		},
+  { &uname_xhv_ns_uri_cite			, XHV_NS_URI "cite"		},
+  { &uname_xhv_ns_uri_contents			, XHV_NS_URI "contents"		},
+  { &uname_xhv_ns_uri_copyright			, XHV_NS_URI "copyright"	},
+  { &uname_xhv_ns_uri_first			, XHV_NS_URI "first"		},
+  { &uname_xhv_ns_uri_glossary			, XHV_NS_URI "glossary"		},
+  { &uname_xhv_ns_uri_help			, XHV_NS_URI "help"		},
+  { &uname_xhv_ns_uri_icon			, XHV_NS_URI "icon"		},
+  { &uname_xhv_ns_uri_index			, XHV_NS_URI "index"		},
+  { &uname_xhv_ns_uri_last			, XHV_NS_URI "last"		},
+  { &uname_xhv_ns_uri_license			, XHV_NS_URI "license"		},
+  { &uname_xhv_ns_uri_meta			, XHV_NS_URI "meta"		},
+  { &uname_xhv_ns_uri_next			, XHV_NS_URI "next"		},
+  { &uname_xhv_ns_uri_p3pv1			, XHV_NS_URI "p3pv1"		},
+  { &uname_xhv_ns_uri_prev			, XHV_NS_URI "prev"		},
+  { &uname_xhv_ns_uri_role			, XHV_NS_URI "role"		},
+  { &uname_xhv_ns_uri_section			, XHV_NS_URI "section"		},
+  { &uname_xhv_ns_uri_start			, XHV_NS_URI "start"		},
+  { &uname_xhv_ns_uri_stylesheet		, XHV_NS_URI "stylesheet"	},
+  { &uname_xhv_ns_uri_subsection		, XHV_NS_URI "subsection"	},
+  { &uname_xhv_ns_uri_up			, XHV_NS_URI "up"		},
+  { &uname_xml					, "xml"				},
+  { &uname_xmlns				, "xmlns"			},
+  { &uname_xml_colon_base			, "xml:base"			},
+  { &uname_xml_colon_lang			, "xml:lang"			},
+  { &uname_xml_colon_space			, "xml:space"			},
+  { &uname_xml_ns_uri				, XML_NS_URI			},
+  { &uname_xml_ns_uri_colon_base		, XML_NS_URI ":base"		},
+  { &uname_xml_ns_uri_colon_lang		, XML_NS_URI ":lang"		},
+  { &uname_xml_ns_uri_colon_space		, XML_NS_URI ":space"		},
+  { &uname_xmlschema_ns_uri			, XMLSCHEMA_NS_URI		},
+  { &uname_xmlschema_ns_uri_hash		, XMLSCHEMA_NS_URI "#"		},
+  { &uname_xmlschema_ns_uri_hash_any		, XMLSCHEMA_NS_URI "#any"	},
+  { &uname_xmlschema_ns_uri_hash_anyURI		, XMLSCHEMA_NS_URI "#anyURI"	},
+  { &uname_xmlschema_ns_uri_hash_boolean	, XMLSCHEMA_NS_URI "#boolean"	},
+  { &uname_xmlschema_ns_uri_hash_date		, XMLSCHEMA_NS_URI "#date"	},
+  { &uname_xmlschema_ns_uri_hash_dateTime	, XMLSCHEMA_NS_URI "#dateTime"	},
+  { &uname_xmlschema_ns_uri_hash_decimal	, XMLSCHEMA_NS_URI "#decimal"	},
+  { &uname_xmlschema_ns_uri_hash_double		, XMLSCHEMA_NS_URI "#double"	},
+  { &uname_xmlschema_ns_uri_hash_float		, XMLSCHEMA_NS_URI "#float"	},
+  { &uname_xmlschema_ns_uri_hash_integer	, XMLSCHEMA_NS_URI "#integer"	},
+  { &uname_xmlschema_ns_uri_hash_string		, XMLSCHEMA_NS_URI "#string"	},
+  { &uname_xmlschema_ns_uri_hash_time		, XMLSCHEMA_NS_URI "#time"	},
+  { NULL, NULL } };
+
+  uname_const_decl_t *tail = uname_const_decls;
+  while (NULL != tail->var_ptr)
+    {
+      UNAME_IT (tail->var_ptr[0], tail->text);
+      tail++;
+    }
+  for (ctr = 0; ctr < (sizeof (unames_colon_number) / sizeof (caddr_t)); ctr++)
+    {
+      char tmp[15];
+      sprintf (tmp, ":%d", ctr);
+      UNAME_IT((unames_colon_number[ctr]), tmp);
+    }
+}
diff --git a/libsrc/Wi/uname_const_decl.h b/libsrc/Wi/uname_const_decl.h
new file mode 100644
index 0000000..14237c4
--- /dev/null
+++ b/libsrc/Wi/uname_const_decl.h
@@ -0,0 +1,160 @@
+/*
+ *  $Id: uname_const_decl.h,v 1.1.2.2 2011/03/22 23:50:55 source Exp $
+ *
+ *  Constant declarations of commonly used UNAMEs.
+ *
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *
+ *  Copyright (C) 1998-2010 OpenLink Software
+ *
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef UNAME_CONST_DECL_H
+#define UNAME_CONST_DECL_H
+#include "Dk.h"
+
+/*				 0         1         2         3        */
+/*				 01234567890123456789012345678901234567 */
+#define SWAP_REIFY_NS_URI	"http://www.w3.org/2000/10/swap/reify#"
+#define SWAP_REIFY_NS_URI_LEN	37
+
+/*				 0         1         2         3         4   */
+/*				 0123456789012345678901234567890123456789012 */
+#define VIRTRDF_NS_URI		"http://www.openlinksw.com/schemas/virtrdf#"
+#define VIRTRDF_NS_URI_LEN	42
+
+/*				 0         1         2         3      */
+/*				 012345678901234567890123456789012345 */
+#define XHV_NS_URI		"http://www.w3.org/1999/xhtml/vocab#"
+#define XHV_NS_URI_LEN		35
+
+extern void uname_const_decl_init (void);
+
+extern caddr_t uname___empty;
+extern caddr_t uname__bang_cdata_section_elements;
+extern caddr_t uname__bang_exclude_result_prefixes;
+extern caddr_t uname__bang_file;
+extern caddr_t uname__bang_location;
+extern caddr_t uname__bang_name;
+extern caddr_t uname__bang_ns;
+extern caddr_t uname__bang_uri;
+extern caddr_t uname__bang_use_attribute_sets;
+extern caddr_t uname__bang_xmlns;
+extern caddr_t uname__attr;
+extern caddr_t uname__comment;
+extern caddr_t uname__disable_output_escaping;
+extern caddr_t uname__root;
+extern caddr_t uname__pi;
+extern caddr_t uname__ref;
+extern caddr_t uname__srcfile;
+extern caddr_t uname__srcline;
+extern caddr_t uname__txt;
+extern caddr_t uname__xslt;
+extern caddr_t uname_lang;
+extern caddr_t uname_nil;
+extern caddr_t uname_nodeID_ns;
+extern caddr_t uname_rdf_ns_uri;
+extern caddr_t uname_rdf_ns_uri_Description;
+extern caddr_t uname_rdf_ns_uri_ID;
+extern caddr_t uname_rdf_ns_uri_RDF;
+extern caddr_t uname_rdf_ns_uri_Seq;
+extern caddr_t uname_rdf_ns_uri_Statement;
+extern caddr_t uname_rdf_ns_uri_XMLLiteral;
+extern caddr_t uname_rdf_ns_uri_about;
+extern caddr_t uname_rdf_ns_uri_first;
+extern caddr_t uname_rdf_ns_uri_li;
+extern caddr_t uname_rdf_ns_uri_nil;
+extern caddr_t uname_rdf_ns_uri_nodeID;
+extern caddr_t uname_rdf_ns_uri_object;
+extern caddr_t uname_rdf_ns_uri_predicate;
+extern caddr_t uname_rdf_ns_uri_resource;
+extern caddr_t uname_rdf_ns_uri_rest;
+extern caddr_t uname_rdf_ns_uri_subject;
+extern caddr_t uname_rdf_ns_uri_type;
+extern caddr_t uname_rdf_ns_uri_datatype;
+extern caddr_t uname_rdf_ns_uri_parseType;
+extern caddr_t uname_rdf_ns_uri_value;
+extern caddr_t uname_space;
+extern caddr_t uname_swap_reify_ns_uri;
+extern caddr_t uname_swap_reify_ns_uri_statement;
+extern caddr_t uname_virtrdf_ns_uri;
+extern caddr_t uname_virtrdf_ns_uri_DefaultQuadMap;
+extern caddr_t uname_virtrdf_ns_uri_DefaultQuadStorage;
+extern caddr_t uname_virtrdf_ns_uri_DefaultServiceStorage;
+extern caddr_t uname_virtrdf_ns_uri_PrivateGraphs;
+extern caddr_t uname_virtrdf_ns_uri_QuadMap;
+extern caddr_t uname_virtrdf_ns_uri_QuadMapFormat;
+extern caddr_t uname_virtrdf_ns_uri_QuadStorage;
+extern caddr_t uname_virtrdf_ns_uri_SyncToQuads;
+extern caddr_t uname_virtrdf_ns_uri_array_of_any;
+extern caddr_t uname_virtrdf_ns_uri_array_of_string;
+extern caddr_t uname_virtrdf_ns_uri_bitmask;
+extern caddr_t uname_virtrdf_ns_uri_isSpecialPredicate;
+extern caddr_t uname_virtrdf_ns_uri_isSubclassOf;
+extern caddr_t uname_virtrdf_ns_uri_loadAs;
+extern caddr_t uname_virtrdf_ns_uri_rdf_repl_graph_group;
+extern caddr_t uname_virtrdf_ns_uri_rdf_repl_all;
+extern caddr_t uname_xhv_ns_uri;
+extern caddr_t uname_xhv_ns_uri_alternate;
+extern caddr_t uname_xhv_ns_uri_appendix;
+extern caddr_t uname_xhv_ns_uri_bookmark;
+extern caddr_t uname_xhv_ns_uri_cite;
+extern caddr_t uname_xhv_ns_uri_chapter;
+extern caddr_t uname_xhv_ns_uri_contents;
+extern caddr_t uname_xhv_ns_uri_copyright;
+extern caddr_t uname_xhv_ns_uri_first;
+extern caddr_t uname_xhv_ns_uri_glossary;
+extern caddr_t uname_xhv_ns_uri_help;
+extern caddr_t uname_xhv_ns_uri_icon;
+extern caddr_t uname_xhv_ns_uri_index;
+extern caddr_t uname_xhv_ns_uri_last;
+extern caddr_t uname_xhv_ns_uri_license;
+extern caddr_t uname_xhv_ns_uri_meta;
+extern caddr_t uname_xhv_ns_uri_next;
+extern caddr_t uname_xhv_ns_uri_p3pv1;
+extern caddr_t uname_xhv_ns_uri_prev;
+extern caddr_t uname_xhv_ns_uri_role;
+extern caddr_t uname_xhv_ns_uri_section;
+extern caddr_t uname_xhv_ns_uri_stylesheet;
+extern caddr_t uname_xhv_ns_uri_subsection;
+extern caddr_t uname_xhv_ns_uri_start;
+extern caddr_t uname_xhv_ns_uri_up;
+extern caddr_t uname_xml;
+extern caddr_t uname_xmlns;
+extern caddr_t uname_xml_colon_base;
+extern caddr_t uname_xml_colon_lang;
+extern caddr_t uname_xml_colon_space;
+extern caddr_t uname_xml_ns_uri;
+extern caddr_t uname_xml_ns_uri_colon_base;
+extern caddr_t uname_xml_ns_uri_colon_lang;
+extern caddr_t uname_xml_ns_uri_colon_space;
+extern caddr_t uname_xmlschema_ns_uri;
+extern caddr_t uname_xmlschema_ns_uri_hash;
+extern caddr_t uname_xmlschema_ns_uri_hash_any;
+extern caddr_t uname_xmlschema_ns_uri_hash_anyURI;
+extern caddr_t uname_xmlschema_ns_uri_hash_boolean;
+extern caddr_t uname_xmlschema_ns_uri_hash_date;
+extern caddr_t uname_xmlschema_ns_uri_hash_dateTime;
+extern caddr_t uname_xmlschema_ns_uri_hash_decimal;
+extern caddr_t uname_xmlschema_ns_uri_hash_double;
+extern caddr_t uname_xmlschema_ns_uri_hash_float;
+extern caddr_t uname_xmlschema_ns_uri_hash_integer;
+extern caddr_t uname_xmlschema_ns_uri_hash_string;
+extern caddr_t uname_xmlschema_ns_uri_hash_time;
+extern caddr_t unames_colon_number[20];
+
+#endif
diff --git a/libsrc/Wi/update.c b/libsrc/Wi/update.c
index fb8e61e..f76bec1 100644
--- a/libsrc/Wi/update.c
+++ b/libsrc/Wi/update.c
@@ -1,7 +1,7 @@
 /*
  *  update.c
  *
- *  $Id: update.c,v 1.11.2.10 2010/03/08 12:04:13 source Exp $
+ *  $Id: update.c,v 1.11.2.11 2010/11/09 10:59:15 source Exp $
  *
  *  UPDATE statements
  *
@@ -614,7 +614,7 @@ update_node_run_1 (update_node_t * upd, caddr_t * inst,
        because conversion may read blob by blob_to_string() and its itc will enter map.
     */
     ITC_LEAVE_MAPS (main_itc);
-#ifdef MTX_DEBUG
+#ifdef PAGE_DEBUG
     if (main_buf->bd_writer != THREAD_CURRENT_THREAD)
       GPF_T1 ("Must have write on buffer to check it");
 #endif
diff --git a/libsrc/Wi/url_rewrite.sql b/libsrc/Wi/url_rewrite.sql
index 28f8501..07ec84a 100644
--- a/libsrc/Wi/url_rewrite.sql
+++ b/libsrc/Wi/url_rewrite.sql
@@ -1,5 +1,5 @@
 --
---  $Id: url_rewrite.sql,v 1.26.2.11 2010/06/18 11:08:14 source Exp $
+--  $Id: url_rewrite.sql,v 1.26.2.14 2010/09/01 10:15:57 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -428,10 +428,8 @@ end_scan:
       long_path := replace (long_path, '^{URIQADefaultHost}^', host);
       if (strstr (long_path, '^{DynamicLocalFormat}^') is not null)
         {
-          if (strchr (host, ':') is not null)
-            long_path := replace (long_path, '^{DynamicLocalFormat}^', sprintf ('http://%{WSHostName}U:%{WSHostPort}U'));
-          else
-            long_path := replace (long_path, '^{DynamicLocalFormat}^', sprintf ('http://%{WSHost}U'));
+	  long_path := replace (long_path, '^{DynamicLocalFormat}^', 
+	  	sprintf ('%s://%{WSHost}s', case when is_https_ctx () then 'https' else 'http' end));
         }
     }
   return long_path;
@@ -1001,10 +999,7 @@ create procedure DB.DBA.HTTP_URLREWRITE_APPLY_PATTERN (in pattern varchar, in st
       ret := replace (ret, '^{URIQADefaultHost}^', host);
       if (strstr (ret, '^{DynamicLocalFormat}^') is not null)
         {
-          if (strchr (host, ':') is not null)
-            ret := replace (ret, '^{DynamicLocalFormat}^', sprintf ('http://%{WSHostName}U:%{WSHostPort}U'));
-          else
-            ret := replace (ret, '^{DynamicLocalFormat}^', sprintf ('http://%{WSHost}U'));
+	  ret := replace (ret, '^{DynamicLocalFormat}^', sprintf ('%s://%{WSHost}s', case when is_https_ctx () then 'https' else 'http' end));
         }
     }
    return ret;
@@ -1288,6 +1283,11 @@ create procedure DB.DBA.HTTP_URLREWRITE (in path varchar, in rule_list varchar,
               http_headers := replace (http_headers, tmp, repl);
               tmp := regexp_match ('\\^{sql:[^}]*}\\^', http_headers);
 	    }
+	  if (strstr (http_headers, '^{DynamicLocalFormat}^') is not null)
+	    {
+	      http_headers := replace (http_headers, '^{DynamicLocalFormat}^',
+	         sprintf ('%s://%{WSHost}s', case when is_https_ctx () then 'https' else 'http' end));
+	    }
 
 	  http_headers := rtrim (http_headers, '\r\n');
 	  if (length (http_headers))
diff --git a/libsrc/Wi/useraggr.sql b/libsrc/Wi/useraggr.sql
index 10e9184..945a161 100644
--- a/libsrc/Wi/useraggr.sql
+++ b/libsrc/Wi/useraggr.sql
@@ -1,5 +1,5 @@
 --
---  $Id: useraggr.sql,v 1.3.2.2 2009/04/18 21:55:17 source Exp $
+--  $Id: useraggr.sql,v 1.3.2.4 2010/12/22 10:32:00 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -708,18 +708,52 @@ create aggregate DB.DBA.XMLAGG (in _child any) returns any
 
 create aggregate DB.DBA.VECTOR_AGG (in _child any) returns any
   from vectorbld_init, vectorbld_agg_acc, vectorbld_agg_final
+order
 ;
 
--- same as vector agg but does not force query to produce deterministic result order
-create aggregate DB.DBA.BAG_AGG (in _child any) returns any
-  from vectorbld_init, vectorbld_agg_acc, vectorbld_agg_final
+create aggregate DB.DBA.VECTOR_OF_NONNULLS_AGG (in _child any) returns any
+  from vectorbld_init, vector_of_nonnulls_bld_agg_acc, vectorbld_agg_final
+order
+;
+
+create aggregate DB.DBA.VECTOR_OR_NULL_AGG (in _child any) returns any
+  from vectorbld_init, vectorbld_agg_acc, vector_or_null_bld_agg_final
+order
+;
+
+create aggregate DB.DBA.VECTOR_OF_NONNULLS_OR_NULL_AGG (in _child any) returns any
+  from vectorbld_init, vector_of_nonnulls_bld_agg_acc, vector_or_null_bld_agg_final
+order
 ;
 
 create aggregate DB.DBA.VECTOR_CONCAT_AGG (in _child any) returns any
   from vectorbld_init, vectorbld_concat_agg_acc, vectorbld_agg_final
+order
 ;
 
 create aggregate DB.DBA.XQ_SEQUENCE_AGG (in _child any) returns any
   from xq_sequencebld_init, xq_sequencebld_agg_acc, xq_sequencebld_agg_final
+order
+;
+
+-- same as vector aggregates but they do not force query to produce deterministic result order
+create aggregate DB.DBA.BAG_AGG (in _child any) returns any
+  from vectorbld_init, vectorbld_agg_acc, vectorbld_agg_final
+;
+
+create aggregate DB.DBA.BAG_OF_NONNULLS_AGG (in _child any) returns any
+  from vectorbld_init, vector_of_nonnulls_bld_agg_acc, vectorbld_agg_final
+;
+
+create aggregate DB.DBA.BAG_OR_NULL_AGG (in _child any) returns any
+  from vectorbld_init, vectorbld_agg_acc, vector_or_null_bld_agg_final
+;
+
+create aggregate DB.DBA.BAG_OF_NONNULLS_OR_NULL_AGG (in _child any) returns any
+  from vectorbld_init, vector_of_nonnulls_bld_agg_acc, vector_or_null_bld_agg_final
+;
+
+create aggregate DB.DBA.BAG_CONCAT_AGG (in _child any) returns any
+  from vectorbld_init, vectorbld_concat_agg_acc, vectorbld_agg_final
 ;
 
diff --git a/libsrc/Wi/users.sql b/libsrc/Wi/users.sql
index 5ac0ace..e1ec9e5 100644
--- a/libsrc/Wi/users.sql
+++ b/libsrc/Wi/users.sql
@@ -1,7 +1,7 @@
 --
 --  users.sql
 --
---  $Id: users.sql,v 1.12.2.8 2010/07/05 13:23:05 source Exp $
+--  $Id: users.sql,v 1.12.2.9 2010/10/25 13:15:58 source Exp $
 --
 --  Unified user model
 --
@@ -190,6 +190,7 @@ nf:
 
 create procedure DB.DBA.SECURITY_CL_EXEC_AND_LOG (in txt varchar, in args any)
 {
+  set_user_id ('dba');
   cl_exec (txt, args);
   cl_exec ('log_text_array (?, ?)', vector (txt, args), 1);
 }
@@ -276,15 +277,15 @@ USER_CREATE (in _name varchar, in passwd varchar, in options any := NULL)
 		 _pwd_mode, _pwd_mode_data, _get_pwd, _login_qual,
 		 _u_home, _u_perms);
 
-  if (_sql_enable)
+  if (not _sql_enable) /* pure web accounts must be disabled for odbc/sql login */
     {
+      _disabled := 1;
+    }
       DB.DBA.SECURITY_CL_EXEC_AND_LOG ('sec_set_user_struct (?,?,?,?,?,?,?)', vector (
 	  _name, passwd, _u_id, _prim_group_id, concat ('Q ', _login_qual), 0, _u_sys_name, _u_sys_pass ) );
       if (_disabled = 1)
         {
-          DB.DBA.SECURITY_CL_EXEC_AND_LOG ('sec_user_enable (?, ?)', vector (
-            _name, 0 ) );
-        }
+      DB.DBA.SECURITY_CL_EXEC_AND_LOG ('sec_user_enable (?, ?)', vector (_name, 0));
     }
 
   return _u_id;
@@ -308,9 +309,7 @@ USER_ROLE_CREATE (in _name varchar, in is_dav integer := 0)
   if (is_dav)
     _sql_enable := 0;
   insert into SYS_USERS (U_ID, U_NAME, U_GROUP, U_IS_ROLE, U_DAV_ENABLE, U_SQL_ENABLE) values (_g_id, _name, _g_id, 1, is_dav, _sql_enable);
-  if (_sql_enable)
-    DB.DBA.SECURITY_CL_EXEC_AND_LOG ('sec_set_user_struct (?,?,?,?,?,?)',
-	  vector (_name, '', _g_id, _g_id, NULL, 1) );
+  DB.DBA.SECURITY_CL_EXEC_AND_LOG ('sec_set_user_struct (?,?,?,?,?,?)', vector (_name, '', _g_id, _g_id, NULL, 1) );
   return _g_id;
 }
 ;
@@ -646,25 +645,15 @@ USER_SET_OPTION (in _name varchar, in opt varchar, in value any)
       U_ACCOUNT_DISABLED = _disabled
       where U_NAME = _name;
 
-  if (_sql_enable)
+  if (not _sql_enable) /* pure web accounts must be disabled for odbc/sql login */
     {
+      _disabled := 1;
+    }
       select pwd_magic_calc (U_NAME, U_PASSWORD, 1) into passwd from SYS_USERS where U_NAME = _name;
       DB.DBA.SECURITY_CL_EXEC_AND_LOG ('sec_set_user_struct (?,?,?,?,?)',
-        vector (
-	  _name, passwd, _u_id, _u_group_id,
-	  case when _login_qual is not null then concat ('Q ', _login_qual) else NULL end ) );
-      DB.DBA.SECURITY_CL_EXEC_AND_LOG ('sec_user_enable (?, ?)',
-        vector (_name, case when _disabled = 0 then 1 else 0 end) );
-    }
-  else
-    {
-      declare exit handler for sqlstate '28000'
-	{
-	  goto done;
-	};
-      DB.DBA.SECURITY_CL_EXEC_AND_LOG ('sec_remove_user_struct(?)', vector (_name));
-      done:;
-    }
+      vector (_name, passwd, _u_id, _u_group_id,
+	case when length (_login_qual) then concat ('Q ', _login_qual) else NULL end));
+  DB.DBA.SECURITY_CL_EXEC_AND_LOG ('sec_user_enable (?, ?)', vector (_name, case when _disabled = 0 then 1 else 0 end));
 }
 ;
 
diff --git a/libsrc/Wi/virtual_dir.sql b/libsrc/Wi/virtual_dir.sql
index c34814c..d43f123 100644
--- a/libsrc/Wi/virtual_dir.sql
+++ b/libsrc/Wi/virtual_dir.sql
@@ -1,7 +1,7 @@
 --
 --  virtual_dir.sql
 --
---  $Id: virtual_dir.sql,v 1.39.2.17 2010/06/12 12:57:18 source Exp $
+--  $Id: virtual_dir.sql,v 1.39.2.25 2010/12/23 16:33:49 source Exp $
 --
 --  Virtual Web directories support.
 --
@@ -964,7 +964,8 @@ ext_http_proxy_exec_qry (in exec varchar, in params any)
       http_request_status ('HTTP/1.1 400 Bad request');
       proxy_sp_html_error_page ('Error: insufficient no of params',
         		        'Insufficient number of parameters',
-                                'This query takes exactly ' || _n_parms || 'parameters');
+                                'This query takes exactly ' || cast (_n_parms as varchar) || ' parameters');
+      return;
     }
 
   declare xec_str varchar;
@@ -1026,6 +1027,16 @@ ext_http_proxy (in url varchar := null,
   if (header is not null)
     req_hdr := header;
 
+  if (0 = length (url))
+    {
+      http_rewrite();
+      http_request_status ('HTTP/1.1 400 Bad request');
+      proxy_sp_html_error_page ('Error: insufficient no of params',
+        		        'Insufficient number of parameters',
+                                'This service expects "url" input argument which is not supplied.');
+      return '';
+    }
+
   arr := rfc1808_parse_uri (url);
   arr[5] := '';
 
@@ -1394,7 +1405,7 @@ create procedure WS.WS.DIR_INDEX_MAKE_XML (inout _sheet varchar, in curdir varch
        else
          modt := now();
        if (dirname <> '.')
-         xte_nodebld_acc (xte_list, xte_node (xte_head ('SUBDIR', 'name', dirname,
+         xte_nodebld_acc (xte_list, xte_node (xte_head ('SUBDIR', 'name', sprintf('%U',dirname),
                'modify', soap_print_box (modt, '', 2) ) ) );
        ix := ix + 1;
      }
@@ -1418,7 +1429,7 @@ create procedure WS.WS.DIR_INDEX_MAKE_XML (inout _sheet varchar, in curdir varch
 	   mult := mult + 1;
 	   flen := flen / 1000;
 	 }
-       xte_nodebld_acc (xte_list, xte_node (xte_head ('FILE', 'name', dirname,
+       xte_nodebld_acc (xte_list, xte_node (xte_head ('FILE', 'name', sprintf('%U',dirname),
              'modify', soap_print_box (modt, '', 2), 'rs', rflen,
              'hs', sprintf ('%d %s', flen, aref (fsize, mult)) ) ) );
        ix := ix + 1;
@@ -1517,6 +1528,7 @@ create procedure WS.WS.DIR_INDEX_XML (in path any, in params any, in lines any)
     xslt_sheet (ssheet_name, xtree_doc (ssheet_text));
   else
     ssheet_name := 'http://local.virt/dir_output';
+  set http_charset='UTF-8';
   return http_value (xslt (ssheet_name, _xml));
 }
 ;
@@ -1556,3 +1568,107 @@ create procedure DB.DBA.SERVICES_WSIL (in path any, in params any, in lines any)
 }
 ;
 
+-- /* host-meta */
+
+create table WS.WS.HTTP_HOST_META (
+    HM_APP 	varchar primary key,
+    HM_META	long varchar
+    )
+;
+
+create procedure WS.WS.host_meta_add (in app varchar, in meta varchar)
+{
+  -- check if it is valid xml
+  xtree_doc (meta);
+  insert replacing WS.WS.HTTP_HOST_META (HM_APP, HM_META)
+      values (app, meta);
+}
+;
+
+create procedure WS.WS.host_meta_del (in app varchar)
+{
+  delete from WS.WS.HTTP_HOST_META where HM_APP = app;
+}
+;
+
+
+create procedure WS.WS."host-meta" (in format varchar := 'xml') __SOAP_HTTP 'application/xrd+xml'
+{
+  declare ses, lines any;
+  declare ret, accept varchar;
+  ses := string_output ();
+  http ('<?xml version="1.0" encoding="UTF-8"?>\n', ses);
+  http ('<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/xrd/1.0" Id="host-meta">\n', ses);
+  http (sprintf ('  <hm:Host>%{WSHost}s</hm:Host>\n'), ses);
+  for select * from WS.WS.HTTP_HOST_META do
+    {
+      HM_META := sprintf (blob_to_string (HM_META));
+      http ('  ', ses);
+      http (HM_META, ses);
+      http ('\n', ses);
+    }
+  http ('</XRD>\n', ses);
+  ret := string_output_string (ses);
+  if (xenc_key_exists ('id_rsa') and __proc_exists ('xml_sign', 2) is not null)
+    {
+      ret := xml_sign (ret, WS.WS.host_meta_dss (), 'http://docs.oasis-open.org/ns/xri/xrd-1.0:XRD');
+    }
+  lines := http_request_header ();
+  accept := DB.DBA.HTTP_RDF_GET_ACCEPT_BY_Q (http_request_header_full (lines, 'Accept', '*/*'));
+  if (format = 'json' or accept = 'application/json')
+    {
+      http_header ('Content-Type: applicaition/json\r\n');
+    http_xslt ('http://local.virt/xrd2json');
+    }
+  return ret;
+}
+;
+
+create procedure WS.WS.host_meta_init ()
+{
+  if (not exists (select 1 from "DB"."DBA"."SYS_USERS" where U_NAME = 'WebMeta'))
+    {
+      DB.DBA.USER_CREATE ('WebMeta', uuid(), vector ('DISABLED', 1));
+      EXEC_STMT ('grant execute on WS.WS."host-meta" to WebMeta', 0);
+    }
+
+  DB.DBA.VHOST_REMOVE (lpath=>'/.well-known');
+  DB.DBA.VHOST_DEFINE (lpath=>'/.well-known', ppath=>'/SOAP/Http', soap_user=>'WebMeta');
+}
+;
+
+WS.WS.host_meta_init ()
+;
+
+create procedure WS.WS.host_meta_dss ()
+{
+  declare ses any;
+  ses := string_output ();
+  http ('<?xml version="1.0" encoding="UTF-8"?>\n', ses);
+  http ('<Signature \n', ses);
+  http ('    xmlns="http://www.w3.org/2000/09/xmldsig#" \n', ses);
+  http ('    xmlns:hm="http://host-meta.net/xrd/1.0"\n', ses);
+  http ('    xmlns:xr="http://docs.oasis-open.org/ns/xri/xrd-1.0"\n', ses);
+  http ('    >\n', ses);
+  http ('    <SignedInfo>\n', ses);
+  http ('	<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />\n', ses);
+  http ('	<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />\n', ses);
+  http ('	<Reference URI="#host-meta">\n', ses);
+  http ('	    <Transforms>\n', ses);
+  http ('		<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />\n', ses);
+  http ('	    </Transforms>\n', ses);
+  http ('	    <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />\n', ses);
+  http ('	    <DigestValue></DigestValue>\n', ses);
+  http ('	</Reference>\n', ses);
+  http ('    </SignedInfo>\n', ses);
+  http ('    <SignatureValue></SignatureValue>\n', ses);
+  http ('    <KeyInfo>\n', ses);
+  http ('	<KeyName>id_rsa</KeyName>\n', ses);
+  http ('	<KeyValue>\n', ses);
+  http ('	    <X509Data></X509Data>\n', ses);
+  http ('	</KeyValue>\n', ses);
+  http ('    </KeyInfo>\n', ses);
+  http ('</Signature>\n', ses);
+  return string_output_string (ses);
+}
+;
diff --git a/libsrc/Wi/wi.h b/libsrc/Wi/wi.h
index e87e1b1..8513d90 100644
--- a/libsrc/Wi/wi.h
+++ b/libsrc/Wi/wi.h
@@ -1,7 +1,7 @@
 /*
  *  wi.h
  *
- *  $Id: wi.h,v 1.23.2.11 2010/03/08 12:04:13 source Exp $
+ *  $Id: wi.h,v 1.23.2.21 2010/11/30 12:34:44 source Exp $
  *
  *  Data structures
  *
@@ -49,12 +49,6 @@
 #define bitf_t unsigned
 #endif
 
-#ifndef REPLICATION_SUPPORT2
-#define REPLICATION_SUPPORT2 1
-#endif
-#ifndef REPLICATION_SUPPORT
-#define REPLICATION_SUPPORT 1
-#endif
 #include "Dk.h"
 
 #undef log
@@ -62,10 +56,6 @@
 /*
  *  Global features
  */
-#ifndef REPLICATION_SUPPORT	/* Support for replication */
-# define REPLICATION_SUPPORT	1
-# define REPLICATION_SUPPORT2	1
-#endif
 typedef struct free_set_cache_s	free_set_cache_t;
 typedef struct index_tree_s	index_tree_t;
 typedef struct search_spec_s	search_spec_t;
@@ -614,6 +604,7 @@ struct it_cursor_s
     bitf_t		itc_cl_set_done:1;
     bitf_t		itc_cl_from_temp:1; /* last search param is the id of the qf with the setp and the temp data */
     bitf_t		itc_cl_qf_any_passed:1; /* in cluster query frag output itc, used to know if nulls hould be sent in oj */
+    bitf_t		itc_must_kill_trx:1;
     unsigned char	itc_search_par_fill;
     unsigned char	itc_owned_search_par_fill;
     unsigned char	itc_pars_from_end; /* no of places in search params used for temp cast search pars */
@@ -1059,18 +1050,27 @@ extern resource_t * pm_rc_4;
 #define bd_is_dirty bdf.r.is_dirty
 #define bd_is_ro_cache bdf.r.is_ro_cache
 
+#if defined (MTX_DEBUG) && !defined (PAGE_DEBUG)
+#define PAGE_DEBUG
+#endif
+
+#ifdef NDEBUG
+#undef PAGE_DEBUG
+#endif
+
 struct buffer_desc_s
 {
   /* Descriptor of a page buffer.  Read/write gate and other fields */
   union {
-    int32	flags; /* allow testing for all 0's with a single compare.  All zeros mens candidate for reuse. */
+    int64	flags; /* allow testing for all 0's with a single compare.  All zeros mens candidate for reuse. */
     struct {
       short readers; /* count of threads with read access */
-      bitf_t	is_write:1;  /* if any thread the exclusive owner of this */
-      bitf_t	being_read:1; /* is the buffer allocated for a page and awaiting the data coming from disk */
-      bitf_t	is_dirty:1; /* Content changed since last written to disk */
-      bitf_t			is_ro_cache:1;
-      bitf_t			is_read_aside;
+      /* the below flagss are chars and not bit fields.  If bit fields, there is a read+write for setting and cache coherence will not protect against a change of a bit between the read and the write.  So for cache coherency the flags must be individually settable so that you do not end up setting neighbor flags to their former values.  The write will hit an obsolete cache line and will reload the line but the other bits will still come from the read that was done before the change.  */
+      char	is_write;  /* if any thread the exclusive owner of this */
+      char	being_read; /* is the buffer allocated for a page and awaiting the data coming from disk */
+      char	is_dirty; /* Content changed since last written to disk */
+      char	is_ro_cache;
+      char	is_read_aside;
     } r;
   } bdf;
   bp_ts_t		bd_timestamp; /* Timestamp for estimating age for buffer reuse */
@@ -1094,7 +1094,7 @@ struct buffer_desc_s
   io_queue_t *	 bd_iq; /* iq, if buffer in queue for read(write */
   buffer_desc_t *	bd_iq_prev; /* next and prev in double linked list of io queue */
   buffer_desc_t *	bd_iq_next;
-#ifdef MTX_DEBUG
+#ifdef PAGE_DEBUG
   du_thread_t *	bd_writer; /* for debugging, the thread which has write access, if any */
   char * 		bd_enter_file;
   long 			bd_enter_line;
@@ -1103,6 +1103,7 @@ struct buffer_desc_s
   char 			bd_el_flag;	/* what operation was last: 1-enter, 2-leave */
   char *                bd_set_wr_file;
   long                  bd_set_wr_line;
+  thread_t *		bd_thr_el;
 #endif
 #ifdef PAGE_TRACE
   long		bd_trx_no;
@@ -1114,6 +1115,64 @@ struct buffer_desc_s
 
 #define BUF_ROW(buf, pos) ((buf)->bd_buffer + (buf)->bd_content_map->pm_entries[pos])
 
+#ifdef PAGE_DEBUG
+#define BUF_DBG_ENTER_1(buf, __file, __line) \
+    do { \
+      if (buf) { \
+	thread_t * __self = THREAD_CURRENT_THREAD; \
+	(buf)->bd_enter_file = __file; \
+	(buf)->bd_enter_line = __line; \
+	(buf)->bd_el_flag = 1; \
+	(buf)->bd_thr_el = __self; \
+	if (!__self->thr_pg_dbg) \
+	  __self->thr_pg_dbg = (void *) hash_table_allocate (31); \
+	sethash ((void *)(buf), (dk_hash_t *) __self->thr_pg_dbg, (void*)(ptrlong)(buf)->bd_page); \
+      } \
+    } while (0)
+#define BUF_DBG_LEAVE_1(buf, __file, __line) \
+    do { \
+      if (buf) { \
+	thread_t * __self = THREAD_CURRENT_THREAD; \
+	if (__self->thr_pg_dbg) { \
+	  remhash ((void*) (buf), (dk_hash_t *) __self->thr_pg_dbg); \
+	} else if ((buf)->bd_el_flag == 1) \
+	  log_error ("Page debug info missing at %s:%ld, entered at %s:%ld", __file, __line, (buf)->bd_enter_file, (buf)->bd_enter_line); \
+	(buf)->bd_leave_file = __file; \
+	(buf)->bd_leave_line = __line; \
+	(buf)->bd_el_flag = 2; \
+	(buf)->bd_thr_el = __self; \
+      } \
+    } while (0)
+#define BUF_DBG_LEAVE(buf) BUF_DBG_LEAVE_1((buf), file, line)
+#define BUF_DBG_LEAVE_INL(buf) BUF_DBG_LEAVE_1((buf), __FILE__, __LINE__)
+#define BUF_DBG_ENTER(buf) BUF_DBG_ENTER_1((buf), file, line)
+#define BUF_DBG_ENTER_INL(buf) BUF_DBG_ENTER_1((buf), __FILE__, __LINE__)
+
+#define THR_DBG_PAGE_CHECK \
+  do \
+  { \
+    thread_t * self = THREAD_CURRENT_THREAD; \
+    dk_hash_iterator_t hit; \
+    buffer_desc_t * buf; \
+    ptrlong page; \
+    dk_hash_iterator (&hit, (dk_hash_t *) self->thr_pg_dbg); \
+    while (NULL != self->thr_pg_dbg && dk_hit_next (&hit, (void**) &buf, (void**) &page)) \
+      { \
+	if (buf && buf->bd_tree && buf->bd_tree->it_key->key_id == KI_TEMP) continue; \
+	GPF_T1 ("Buffer left occupied after thread is done"); \
+      } \
+    if (NULL != self->thr_pg_dbg) clrhash ((dk_hash_t *) self->thr_pg_dbg); \
+  } \
+  while (0)
+
+#else
+#define BUF_DBG_ENTER(buf)
+#define BUF_DBG_ENTER_INL(buf)
+#define BUF_DBG_LEAVE(buf)
+#define BUF_DBG_LEAVE_INL(buf)
+#define THR_DBG_PAGE_CHECK
+#endif
+
 #define bd_registered bn.registered
 #define bd_next bn.next
 #define BUF_AGE(buf) (buf->bd_pool->bp_ts - buf->bd_timestamp)
@@ -1133,11 +1192,13 @@ struct buffer_desc_s
 #define BUF_NONE_WAITING(buf) \
 (!buf->bd_write_waiting && !buf->bd_read_waiting && !buf->bd_being_read)
 
-#ifdef MTX_DEBUG
+#ifdef PAGE_DEBUG
 #define BD_SET_IS_WRITE(bd, f) \
 { \
   (bd)->bd_is_write = f;			    \
   (bd)->bd_writer = f ? THREAD_CURRENT_THREAD : NULL;	\
+  (bd)->bd_set_wr_file = __FILE__; \
+  (bd)->bd_set_wr_line = __LINE__; \
 }
 #else
 #define BD_SET_IS_WRITE(bd, f) \
@@ -1349,7 +1410,7 @@ typedef struct ra_req_s
   } ra_req_t;
 
 
-extern int32 bdf_is_avail_mask; /* all bits on except read aside flag which does not affect reusability */
+extern int64 bdf_is_avail_mask; /* all bits on except read aside flag which does not affect reusability */
 
 #ifdef MTX_DEBUG
 #define BUF_NEEDS_DELTA(b) 1
@@ -1592,7 +1653,7 @@ extern long dbe_auto_sql_stats; /* from search.c */
 
 extern int in_crash_dump;
 
-#if defined (WITH_PTHREADS) && !defined (MTX_DEBUG) && !defined (MTX_METER)
+#if defined (WITH_PTHREADS) && !defined (MTX_DEBUG) && !defined (MTX_METER)  && !defined (IN_ODBC_CLIENT)
 #undef mutex_enter
 #undef mutex_leave
 #define mutex_enter(m)  pthread_mutex_lock (&((m)->mtx_mtx))
diff --git a/libsrc/Wi/widd.h b/libsrc/Wi/widd.h
index aff4b50..e39f9fd 100644
--- a/libsrc/Wi/widd.h
+++ b/libsrc/Wi/widd.h
@@ -1,7 +1,7 @@
 /*
  *  widd.h
  *
- *  $Id: widd.h,v 1.6.2.6 2010/02/01 12:53:46 source Exp $
+ *  $Id: widd.h,v 1.6.2.7 2011/02/14 11:48:50 source Exp $
  *
  *  Data Dictionary
  *
@@ -441,6 +441,9 @@ fragment instead of searching for the the fragment actually needed. */
   int		key_n_fragments;
   dbe_storage_t *	key_storage;
   caddr_t *	key_options;
+  uint32	key_segs_sampled;
+  uint32	key_rows_in_sampled_segs;
+  id_hash_t *	key_p_stat; /* for rdf inx starting with p, stats on the rest for a given p */
 };
 
 
diff --git a/libsrc/Wi/wifn.h b/libsrc/Wi/wifn.h
index 61dd545..0cbe542 100644
--- a/libsrc/Wi/wifn.h
+++ b/libsrc/Wi/wifn.h
@@ -1,7 +1,7 @@
 /*
  *  wifn.h
  *
- *  $Id: wifn.h,v 1.40.2.18 2010/06/09 12:30:04 source Exp $
+ *  $Id: wifn.h,v 1.40.2.24 2011/03/11 12:17:30 source Exp $
  *
  *  Internal Functions
  *
@@ -72,7 +72,6 @@ void itc_free_owned_params (it_cursor_t * itc);
   placeholder_t * v = (placeholder_t*) dk_alloc_box_zero (sizeof (placeholder_t), DV_ITC); \
   v->itc_type = ITC_PLACEHOLDER;
 placeholder_t * plh_allocate ();
-buffer_desc_t * itc_reset (it_cursor_t * itc);
 int dv_compare (db_buf_t dv1, db_buf_t dv2, collation_t *collation, unsigned short offset);
 int dv_compare_spec (db_buf_t db, search_spec_t * spec, it_cursor_t * it);
 dp_addr_t leaf_pointer (db_buf_t row, dbe_key_t * key);
@@ -84,9 +83,6 @@ int pg_skip_gap (db_buf_t page, int pos);
 void itc_skip_entry (it_cursor_t * it, buffer_desc_t * buf);
 void itc_prev_entry (it_cursor_t * it, buffer_desc_t * buf);
 
-void itc_down_transit (it_cursor_t * it, buffer_desc_t ** buf, dp_addr_t to);
-void itc_landed_down_transit (it_cursor_t * it, buffer_desc_t ** buf, dp_addr_t to);
-void itc_dive_transit (it_cursor_t * it, buffer_desc_t ** buf, dp_addr_t to);
 
 #define PS_LOCKS 0
 #define PS_NO_LOCKS 1
@@ -193,9 +189,36 @@ buffer_desc_t * page_fault (it_cursor_t * it, dp_addr_t dp);
 buffer_desc_t * page_fault_map_sem (it_cursor_t * it, dp_addr_t dp, int stay_inside);
 #define PF_STAY_ATOMIC 1
 
-int page_wait_access (it_cursor_t * itc, dp_addr_t dp_to,
+#if defined (MTX_DEBUG) && !defined (PAGE_DEBUG)
+#define PAGE_DEBUG
+#endif
+
+#ifdef PAGE_DEBUG
+#define DBGP_NAME(nm) 		dbg_##nm
+#define DBGP_PARAMS 		const char *file, int line,
+#define DBGP_ARGS 		file, line,
+#define DBGP_ARGS_0 		file, line
+#define page_wait_access(itc,dp_to,buf_from,buf_ret,mode,max_change) \
+	dbg_page_wait_access (__FILE__,__LINE__,itc,dp_to,buf_from,buf_ret,mode,max_change)
+#define page_leave_inner(buf) \
+        dbg_page_leave_inner (__FILE__,__LINE__,buf)
+#define itc_down_transit(it,buf,to) dbg_itc_down_transit (__FILE__,__LINE__,it, buf, to)
+#define itc_landed_down_transit(it,buf,to) dbg_itc_landed_down_transit (__FILE__,__LINE__,it, buf, to)
+#define itc_reset(itc) dbg_itc_reset (__FILE__,__LINE__, (itc))
+#else
+#define DBGP_NAME(nm) 		nm
+#define DBGP_PARAMS
+#define DBGP_ARGS
+#define DBGP_ARGS_0
+#endif
+buffer_desc_t * DBGP_NAME (itc_reset) (DBGP_PARAMS it_cursor_t * itc);
+void DBGP_NAME (itc_down_transit) (DBGP_PARAMS it_cursor_t * it, buffer_desc_t ** buf, dp_addr_t to);
+void DBGP_NAME (itc_landed_down_transit) (DBGP_PARAMS it_cursor_t * it, buffer_desc_t ** buf, dp_addr_t to);
+void itc_dive_transit (it_cursor_t * it, buffer_desc_t ** buf, dp_addr_t to);
+int DBGP_NAME (page_wait_access) (DBGP_PARAMS it_cursor_t * itc, dp_addr_t dp_to,
 		  buffer_desc_t * buf_from,
 		  buffer_desc_t ** buf_ret, int mode, int max_change);
+void DBGP_NAME (page_leave_inner) (DBGP_PARAMS buffer_desc_t * buf);
 void page_release_read (buffer_desc_t * buf);
 void page_read_queue_add (buffer_desc_t * buf, it_cursor_t * itc);
 void page_write_queue_add (buffer_desc_t * buf, it_cursor_t * itc);
@@ -205,7 +228,6 @@ buffer_desc_t * page_try_transit (it_cursor_t * it, buffer_desc_t * from,
 				  dp_addr_t dp, int mode);
 void it_wait_no_io_pending (void);
 
-void page_leave_inner (buffer_desc_t * buf);
 void page_leave_as_deleted (buffer_desc_t * buf);
 
 /* void itc_page_leave (it_cursor_t *, buffer_desc_t * buf); */
@@ -411,7 +433,7 @@ void pg_move_cursors (it_cursor_t ** temp_itc, int fill, buffer_desc_t * buf_fro
 index_tree_t * it_allocate (dbe_storage_t *);
 index_tree_t * it_temp_allocate (dbe_storage_t *);
 void it_temp_free (index_tree_t * it);
-void it_temp_tree (index_tree_t * it);
+int it_temp_tree (index_tree_t * it);
 #if !defined (__APPLE__)
 void it_not_in_any (du_thread_t * self, index_tree_t * except);
 #endif
@@ -1019,6 +1041,8 @@ void plugin_loader_init(void);
 
 /* rdfinf.c */
 void sas_ensure (void);
+/* trans.c */
+extern int32 tn_cache_enable;
 /*  rdfbox.c */
 void print_short (short s, dk_session_t * ses);
 
@@ -1200,4 +1224,10 @@ extern int32 dbs_check_extent_free_pages;
 #ifndef NDEBUG
 void ws_lt_trace (lock_trx_t * lt);
 #endif
+
+extern int32 em_ra_window;
+extern int32 em_ra_threshold;
+extern int32 em_ra_startup_window;
+extern int32 em_ra_startup_threshold;
+
 #endif /* _WIFN_H */
diff --git a/libsrc/Wi/wirpc.c b/libsrc/Wi/wirpc.c
index 5b387e8..12f4841 100644
--- a/libsrc/Wi/wirpc.c
+++ b/libsrc/Wi/wirpc.c
@@ -1,7 +1,7 @@
 /*
  *  wirpc.c
  *
- *  $Id: wirpc.c,v 1.2.2.1 2009/04/18 21:55:17 source Exp $
+ *  $Id: wirpc.c,v 1.2.2.2 2011/01/05 12:51:53 source Exp $
  *
  *  Global RPC call hooks
  *
@@ -32,14 +32,14 @@ SERVICE_4 (s_sql_login, _sqlc, "SCON", DA_FUTURE_REQUEST,
 	DV_C_STRING, 		1,
 	DV_SHORT_STRING, 	1,
 	DV_C_STRING, 		1,
-	DV_ARRAY_OF_POINTER, 	1)	/* params */
+	DV_ARRAY_OF_POINTER, 	1);	/* params */
 
 SERVICE_4 (s_sql_prepare, _sprep, "PREP", DA_FUTURE_REQUEST,
 	DV_SEND_NO_ANSWER,	/* return type */
 	DV_SHORT_STRING,	0,
 	DV_SHORT_STRING,	0,
 	DV_LONG_INT,		1,
-	DV_ARRAY_OF_LONG,	1)
+	DV_ARRAY_OF_LONG,	1);
 
 SERVICE_6 (s_sql_execute, _sexec, "EXEC", DA_FUTURE_REQUEST,
 	DV_SEND_NO_ANSWER,	/* return type */
@@ -48,22 +48,22 @@ SERVICE_6 (s_sql_execute, _sexec, "EXEC", DA_FUTURE_REQUEST,
 	DV_SHORT_STRING,	1,/* cursor name */
 	DV_ARRAY_OF_POINTER,	0,/* params */
 	DV_ARRAY_OF_POINTER,	1,/* current ofs */
-	DV_ARRAY_OF_LONG,	1)/* options */
+	DV_ARRAY_OF_LONG,	1);/* options */
 
 SERVICE_2 (s_sql_fetch, sftc, "FTCH", DA_FUTURE_REQUEST,
 	DV_SEND_NO_ANSWER,	/* return type */
 	DV_SHORT_STRING,	0,
-	DV_LONG_INT,		1)
+	DV_LONG_INT,		1);
 
 SERVICE_2 (s_sql_transact, _strx, "TRXC", DA_FUTURE_REQUEST,
 	DV_SEND_NO_ANSWER,	/* return type */
 	DV_LONG_INT,		1,
-	DV_LONG_INT,		1) /* currently not used */
+	DV_LONG_INT,		1); /* currently not used */
 
 SERVICE_2 (s_sql_free_stmt, _frst, "FRST", DA_FUTURE_REQUEST,
 	DV_LONG_INT,		/* return type */
 	DV_SHORT_STRING,	0,
-	DV_LONG_INT,		1)
+	DV_LONG_INT,		1);
 
 SERVICE_5 (s_get_data, _sgbt, "GETD", DA_FUTURE_REQUEST,
 	DV_SEND_NO_ANSWER,	/* return type */
@@ -71,7 +71,7 @@ SERVICE_5 (s_get_data, _sgbt, "GETD", DA_FUTURE_REQUEST,
 	DV_LONG_INT,		1,/* current_of */
 	DV_LONG_INT,		1,/* nth_col */
 	DV_LONG_INT,		1,/* how_much */
-	DV_LONG_INT,		1)/* from_byte */
+	DV_LONG_INT,		1);/* from_byte */
 
 SERVICE_9 (s_get_data_ac , _sgbt2, "GETDA", DA_FUTURE_REQUEST,
 	DV_SEND_NO_ANSWER,	/* return type */
@@ -83,7 +83,7 @@ SERVICE_9 (s_get_data_ac , _sgbt2, "GETDA", DA_FUTURE_REQUEST,
 	DV_LONG_INT,		1,/* page dir 1st page */
 	DV_LONG_STRING,		1,/* the array of page nos */
 	DV_LONG_INT,		1,/* is_wide? */
-	DV_LONG_INT,            1)/* blob timestamp */
+	DV_LONG_INT,            1);/* blob timestamp */
 
 
 /* Replication */
@@ -94,14 +94,14 @@ SERVICE_5 (s_resync_acct, _sra, "RSNC", DA_FUTURE_REQUEST,
 	DV_LONG_INT,		1,/* level */
 	DV_SHORT_STRING,	0,/* subscriber name */
 	DV_C_STRING,		0,/* uid, auth hash */
-	DV_SHORT_STRING,	0)
+	DV_SHORT_STRING,	0);
 
 SERVICE_4 (s_resync_replay, _srl, "RSRP", DA_FUTURE_REQUEST,
 	DV_LONG_INT,	        /* return type */
 	DV_SHORT_STRING,	0,/* account */
 	DV_SHORT_STRING,	0,/* subscriber name */
 	DV_SHORT_STRING,	0,/* uid, auth hash */
-	DV_SHORT_STRING,        0)
+	DV_SHORT_STRING,        0);
 
 SERVICE_6 (s_sql_extended_fetch, _extf, "EXTF", DA_FUTURE_REQUEST,
 	DV_SEND_NO_ANSWER,	/* return type */
@@ -110,15 +110,15 @@ SERVICE_6 (s_sql_extended_fetch, _extf, "EXTF", DA_FUTURE_REQUEST,
 	DV_LONG_INT,		1,
 	DV_LONG_INT,		1,
 	DV_LONG_INT,		1,
-	0,			1) /* bookmark - make it unknown as it's sometimes DV_ARRAY_OF_POINTER, sometimes DV_INT */
+	0,			1); /* bookmark - make it unknown as it's sometimes DV_ARRAY_OF_POINTER, sometimes DV_INT */
 SERVICE_2 (s_sql_tp_transact, _tp, "TPTRX", DA_FUTURE_REQUEST,
 	DV_SEND_NO_ANSWER,
 	DV_LONG_INT,		1,
-	DV_STRING,		1)
+	DV_STRING,		1);
 
 /* PL debugger */
 
 SERVICE_2 (s_pl_debug, _pld, "PLDBG", DA_FUTURE_REQUEST,
 	DV_LONG_INT,	/* return type */
 	DV_C_STRING,		1,
-	DV_C_STRING,		1)
+	DV_C_STRING,		1);
diff --git a/libsrc/Wi/wsdl_expand.xsl b/libsrc/Wi/wsdl_expand.xsl
index 0b4d2fa..8d9375b 100644
--- a/libsrc/Wi/wsdl_expand.xsl
+++ b/libsrc/Wi/wsdl_expand.xsl
@@ -1,7 +1,7 @@
 <?xml version='1.0'?>
 <!--
  -
- -  $Id: wsdl_expand.xsl,v 1.4 2009/04/09 13:22:15 source Exp $
+ -  $Id: wsdl_expand.xsl,v 1.4.2.1 2010/11/05 10:56:48 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -118,10 +118,10 @@
 		<xsl:variable name="sch" select="document(@schemaLocation)"/>
 		<xsl:apply-templates select="$sch/*" mode="xsd"/>
 	    </xsl:when>
-	    <xsl:otherwise>
+	    <!--xsl:otherwise>
 		<xsl:variable name="lns" select="@namespace"/>
 		<xsl:apply-templates select="//xsd:schema[@targetNamespace = $lns]" mode="xsd"/>
-	    </xsl:otherwise>
+	    </xsl:otherwise-->
 	</xsl:choose>
     </xsl:for-each>
     <xsl:copy>
diff --git a/libsrc/Wi/wsdl_import.xsl b/libsrc/Wi/wsdl_import.xsl
index fdaea8b..64938fc 100644
--- a/libsrc/Wi/wsdl_import.xsl
+++ b/libsrc/Wi/wsdl_import.xsl
@@ -1,7 +1,7 @@
 <?xml version='1.0'?>
 <!--
  -
- -  $Id: wsdl_import.xsl,v 1.5 2009/04/09 13:22:15 source Exp $
+ -  $Id: wsdl_import.xsl,v 1.5.2.1 2010/11/05 10:56:49 source Exp $
  -
  -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  -  project.
@@ -212,10 +212,10 @@ for "<xsl:value-of select="$class" />"
 <xsl:variable name="inhdr" select="$oper/input/header/@message"/>
 <xsl:variable name="outhdr" select="$oper/output/header/@message"/>
 <xsl:for-each select="/wsdl:definitions/wsdl:message[@name = $inmsg or @name = $outmsg or @name = $inhdr or @name = $outhdr]/part" >
+    <xsl:variable name="myname" select="@name"/>
 <xsl:choose>
 <xsl:when test="parent::wsdl:message[@name = $inmsg or @name = $inhdr]">
     <xsl:variable name="partname" select="''"/>
-    <xsl:variable name="myname" select="@name"/>
     <xsl:choose>
 	<xsl:when test="/wsdl:definitions/wsdl:message[@name = $outmsg or @name = $outhdr]/part[@name=$myname]">
     <xsl:variable name="partty" select="'inout'"/>
diff --git a/libsrc/Wi/xmla.sql b/libsrc/Wi/xmla.sql
index 890e181..4397d0f 100644
--- a/libsrc/Wi/xmla.sql
+++ b/libsrc/Wi/xmla.sql
@@ -1,5 +1,5 @@
 --
---  $Id: xmla.sql,v 1.14.2.1 2009/04/18 21:55:17 source Exp $
+--  $Id: xmla.sql,v 1.14.2.2 2010/08/31 12:12:00 source Exp $
 --
 --  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 --  project.
@@ -281,8 +281,9 @@ create procedure
 	       )
 {
   declare res, mdta, dta any;
-  declare cat, fmt, axis_fmt, what, dsn, state, msg, stmt, tree, blob_limit any;
+  declare cat, fmt, axis_fmt, what, dsn, state, msg, stmt, tree, blob_limit, stmt_is_ddl any;
   declare uname, passwd varchar;
+
   declare exit handler for sqlstate '*'
     {
       declare xcode int;
@@ -330,9 +331,10 @@ create procedure
   set_user_id (uname, 1, passwd);
   set_qualifier (cat);
 
+  dta := vector ();
+  stmt_is_ddl := 0;
   if (not xmla_not_local_dsn (dsn))
     {
-	dta := NULL;
 --	mxla_fk_pk_check_local (stmt, mdta, dta);
 	tree := sql_parse (stmt);
 	if (tree [0] = 609)
@@ -341,27 +343,29 @@ create procedure
 	    tree := sql_parse (stmt);
 	  }
 	if (tree [0] <> 100)
+	  {
+	    if (registry_get ('XMLA-DML') = '1')
+	      {
+		exec_metadata ('select 1 as res', null, null, mdta);
+		stmt_is_ddl := 1;
+	      }
+	    else
 	   signal ('00004', 'Only select statements are supported via XML for Analysis provider');
-
-	if (dta is NULL)
+	  }
 	   res := exec (stmt, state, msg, vector (), 0, mdta, dta);
-
+	if (isinteger (dta))
+	  dta := vector (vector (dta));
 --  	if (strstr (stmt, 'FROM DB.DBA.SYS_FOREIGN_KEYS'))
 --    	   xmla_add_quot_to_table (dta);
-
 	blob_limit := atoi (xmla_get_property ("Properties", 'BLOBLimit', '0'));
-
 	if (blob_limit > 0)
 	   connection_set ('SOAPBlobLimit', blob_limit);
      }
    else
      {
-	dta := NULL;
 --	mxla_fk_pk_check (dsn, stmt, mdta, dta);
 	dsn := xmla_get_dsn_name (dsn);
-
-	if (dta is NULL)
-	  rexecute (dsn, stmt, state, msg, vector (), 0, mdta, dta);;
+	rexecute (dsn, stmt, state, msg, vector (), 0, mdta, dta);
      }
 
   if (state <> '00000')
@@ -369,6 +373,7 @@ create procedure
 
   -- data needs to be re-organized
   xmla_format_mdta (mdta);
+  if (not stmt_is_ddl)
   xmla_make_cursors_state ("Properties", dta, stmt);
   xmla_sparql_result (mdta, dta, stmt);
   xmla_make_struct (mdta, dta);
diff --git a/libsrc/Wi/xmlenc-dec.c b/libsrc/Wi/xmlenc-dec.c
index bee50d3..1088799 100644
--- a/libsrc/Wi/xmlenc-dec.c
+++ b/libsrc/Wi/xmlenc-dec.c
@@ -3,7 +3,7 @@
  *
  *  XML Encryption spec part 2 - decryption
  *
- *  $Id: xmlenc-dec.c,v 1.5.2.2 2009/05/11 07:36:24 source Exp $
+ *  $Id: xmlenc-dec.c,v 1.5.2.4 2010/10/07 23:31:46 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -43,6 +43,7 @@
 #include "soap.h"
 #include "security.h"
 #include "date.h"
+#include "bif_text.h"
 
 #ifdef DEBUG
 #include "xmlenc_test.h"
@@ -321,8 +322,10 @@ void wsse_y_callback (char* uri, char * name, caddr_t * curr, wsse_ctx_t * ctx);
 void wsse_rsakeyvalue_callback (char* uri, char * name, caddr_t * curr, wsse_ctx_t * ctx);
 void wsse_modulus_callback (char* uri, char * name, caddr_t * curr, wsse_ctx_t * ctx);
 void wsse_exponent_callback (char* uri, char * name, caddr_t * curr, wsse_ctx_t * ctx);
+void wsse_x509data_callback (char* uri, char * name, caddr_t * curr, wsse_ctx_t * ctx);
+void wsse_x509certificate_callback (char* uri, char * name, caddr_t * curr, wsse_ctx_t * ctx);
 
-
+/* MUST keep this list in alphabetical order */
 static
 wsse_callback_item_t wsse_dsig_callbacks [] =
 {
@@ -346,6 +349,8 @@ wsse_callback_item_t wsse_dsig_callbacks [] =
   {"SignedInfo", wsse_signedinfo_callback},
   {"Transform", wsse_transform_callback},
   {"Transforms", wsse_transforms_callback},
+  {"X509Certificate", wsse_x509certificate_callback},
+  {"X509Data", wsse_x509data_callback},
   {"XPath", wsse_xpath_callback},
   {"Y", wsse_p_callback}
 };
@@ -741,6 +746,35 @@ void wsse_keyvalue_callback (char* uri, char * name, caddr_t * curr, wsse_ctx_t
 {
 }
 
+void wsse_x509data_callback (char* uri, char * name, caddr_t * curr, wsse_ctx_t * ctx)
+{
+  dsig_signature_t * dsig = ctx->wc_dsig;
+  WSSE_ASSERT (ctx->wc_dsig);
+  dsig->dss_key_value_type = XENC_T_X509_CERT;
+}
+
+void wsse_x509certificate_callback (char* uri, char * name, caddr_t * curr, wsse_ctx_t * ctx)
+{
+  caddr_t content = wsse_get_content_val (curr);
+  xenc_key_t * key;
+  if (!content)
+    wsse_report_error (ctx, WSSE_BINARYSECTOKEN_CODE, 100, "tag is empty");
+  key = certificate_decode (content, WSSE_OASIS_X509_VALUE_TYPE, WSSE_OASIS_BASE64_ENCODING_TYPE);
+  dk_free_box (content);
+  if (!key)
+    wsse_report_error (ctx, WSSE_BINARYSECTOKEN_CODE, 100, "could not decode certificate");
+  if (ctx->wc_object_type == XENC_T_DSIG)
+    {
+      WSSE_ASSERT (ctx->wc_dsig);
+      ctx->wc_dsig->dss_key = key;
+    }
+  else if (ctx->wc_object_type == XENC_T_ENCKEY)
+    {
+      WSSE_ASSERT (ctx->wc_curr_enckey);
+      ctx->wc_curr_enckey->xeke_super_key = box_dv_short_string (key->xek_name);
+    }
+}
+
 void wsse_cipherdata_c (char* uri, char * name, caddr_t * curr, wsse_ctx_t * ctx)
 {
   WSSE_ASSERT (ctx->wc_curr_enckey);
@@ -1277,11 +1311,12 @@ int dsig_verify_signature (dsig_signature_t * d, xml_tree_ent_t * xte, id_hash_t
       strses_free (ses_out);
       return 0;
     }
+  strses_free (ses_out);
   return 1;
 }
 
 xenc_err_code_t dsig_check_xml (query_instance_t * qi, dsig_signature_t * d, char * xml_text,
-	 long len, xenc_err_code_t * c, char ** err)
+	 long len, xenc_err_code_t * c, char ** err, int is_wsse)
 {
   dsig_signature_t * d_copy = dsig_copy_draft (d);
   xenc_err_code_t cc;
@@ -1305,6 +1340,9 @@ xenc_err_code_t dsig_check_xml (query_instance_t * qi, dsig_signature_t * d, cha
       strses_free (xml_doc);
       return cc;
     }
+  xml_doc->dks_in_buffer = NULL;
+  strses_free (xml_doc);
+  xml_doc = NULL;
 
   if (dsig_compare (d, d_copy, &cmp))
     {
@@ -1320,9 +1358,6 @@ xenc_err_code_t dsig_check_xml (query_instance_t * qi, dsig_signature_t * d, cha
 	  err[0] = box_dv_short_string (buf);
 	}
       dsig_free (d_copy);
-      xml_doc->dks_in_buffer = NULL;
-      strses_free (xml_doc);
-
       return cc;
     }
 
@@ -1332,7 +1367,7 @@ xenc_err_code_t dsig_check_xml (query_instance_t * qi, dsig_signature_t * d, cha
     id_hash_t * nss = 0;
     xml_tree_ent_t * xte = (xml_tree_ent_t *) xml_make_tree_with_ns (qi, xml_text,
 	0, "UTF-8", lh_get_handler ("x-any"), &nss, 0);
-    caddr_t * signature = xte ? xml_find_signedinfo (xte->xte_current) : 0;
+    caddr_t * signature = xte ? xml_find_signedinfo (xte->xte_current, is_wsse) : 0;
 
     if (!signature)
       {
@@ -1445,7 +1480,7 @@ caddr_t dsig_sign_signature_ (query_instance_t * qi, dsig_signature_t * dsig, ca
       if (!doc)
 	wsse_report_error (ctx, WSSE_XML_CODE, 0);
 
-      signature = xml_find_signature (doc->xte_current);
+      signature = xml_find_signature (doc->xte_current, 1);
 
       if (!signature)
 	wsse_report_error (ctx, WSSE_NO_TAG_CODE, strlen ("Signature"), "Signature");
@@ -1476,81 +1511,82 @@ caddr_t dsig_sign_signature_ (query_instance_t * qi, dsig_signature_t * dsig, ca
 caddr_t bif_dsig_validate (caddr_t *qst, caddr_t *err, state_slot_t ** args)
 {
   caddr_t xml_text = bif_string_arg (qst, args, 0, "dsig_validate");
-  caddr_t signature_xml_text = bif_string_arg (qst, args, 1, "dsig_validate");
-  caddr_t enc = bif_string_arg (qst, args, 2, "dsig_validate");
-  lang_handler_t *lh = lh_get_handler (bif_string_arg (qst, args, 3, "dsig_validate"));
+  caddr_t signature_xml_text = BOX_ELEMENTS (args) > 1 ? bif_string_or_null_arg (qst, args, 1, "dsig_validate") : NULL;
+  caddr_t enc = BOX_ELEMENTS (args) > 2 ? bif_string_arg (qst, args, 2, "dsig_validate") : "UTF-8";
+  lang_handler_t *lh = BOX_ELEMENTS (args) > 3 ? lh_get_handler (bif_string_arg (qst, args, 3, "dsig_validate")) : server_default_lh;
   wsse_ctx_t * ctx;
   dsig_signature_t * dsig;
-  caddr_t * signature_tag;
+  caddr_t * signature_tag, err_ret = NULL;
   caddr_t * xml_doc;
   xenc_err_code_t c;
-  char * errm;
+  caddr_t errm = NULL;
   id_hash_t * nss = 0;
-  xml_tree_ent_t * xte = (xml_tree_ent_t *) xml_make_tree_with_ns ((query_instance_t*) qst, signature_xml_text,
-	err, enc, lh, &nss, 0);
+  xml_tree_ent_t * xte;
+
+  if (!signature_xml_text)
+    signature_xml_text = xml_text;
+
+  xte = (xml_tree_ent_t *) xml_make_tree_with_ns ((query_instance_t*) qst, signature_xml_text, &err_ret, enc, lh, &nss, 0);
 
   if (!xte)
     {
-      sqlr_new_error ("42000", "XENC25", "Could not parse signature XML document, call xml_validate_dtd() to obtain errors list");
+      nss_free (nss);
+      if (!err_ret)
+	sqlr_new_error ("42000", "XENC25", "Could not parse signature XML document");
+      else
+	{
+	  *err = err_ret;
+	  return NULL;
+	}
     }
 
   xml_doc = xte->xte_current;
-
-  signature_tag = xml_find_child (xml_doc, "Signature", DSIG_URI, 0, 0);
+  signature_tag = xml_find_any_child (xml_doc, "Signature", DSIG_URI);
   if (!signature_tag)
     {
-      dk_free_tree ((box_t) xml_doc);
+      dk_free_box ((box_t) xte);
       nss_free (nss);
       sqlr_new_error ("42000", "XENC26", "XML document is not XML Signature");
     }
 
   xte->xte_current = signature_tag;
-
   ctx = wsse_ctx_allocate();
-
   XENC_TRY (&ctx->wc_tb)
     {
-      caddr_t signval;
       wsse_build_wsse_objects (signature_tag, wsse_get_callback (ctx, DSIG_URI , "Signature"), ctx);
-      signval = dsig_sign_signature (ctx->wc_dsig, xte, nss, ctx);
-
-      if (strcmp (signval, ctx->wc_dsig->dss_signature))
-	{
-	  dk_free_box (signval);
-	  wsse_report_error (ctx, WSSE_WRONG_SIGNVAL_CODE, 0);
-	}
-      dk_free_box (signval);
     }
   XENC_CATCH
     {
       char errbuf[1024];
-      dk_free_tree ((box_t) xml_doc);
+      dk_free_box ((box_t) xte);
       nss_free (nss);
       xenc_make_error (errbuf, 1024, ctx->wc_tb.xtb_err_code, ctx->wc_tb.xtb_err_buffer);
       wsse_ctx_free (ctx);
       sqlr_new_error ("42000", "XENC27", "dsig_validate function reports an error: %s", errbuf);
     }
   XENC_TRY_END(&ctx->wc_tb);
-  wsse_ctx_free (ctx);
-
-  dk_free_tree ((box_t) xml_doc);
-  nss_free (nss);
 
   dsig = ctx->wc_dsig;
+  dk_free_box ((box_t) xte);
+  nss_free (nss);
 
-  if (dsig_check_xml ((query_instance_t*) qst, dsig, xml_text, box_length (xml_text) - 1, &c, &errm))
+  if (dsig_check_xml ((query_instance_t*) qst, dsig, xml_text, box_length (xml_text) - 1, &c, &errm, 0))
     {
       char buf[1024];
       xenc_make_error (buf, 1024, c, errm);
+      dk_free_tree (errm);
+      wsse_ctx_free (ctx);
       sqlr_new_error ("42000", "XENC28", "error occurred when xml document was checked: %s", buf);
     }
-
+  wsse_ctx_free (ctx);
   return NEW_DB_NULL;
 }
 
-caddr_t * xml_find_signature (caddr_t * doc)
+caddr_t * xml_find_signature (caddr_t * doc, int is_wsse)
 {
   caddr_t * envelope;
+  if (!is_wsse)
+    return xml_find_any_child (doc, "Signature", DSIG_URI);
   envelope = xml_find_child (doc, "Envelope", WSS_SOAP_URI, 0, NULL);
   if (envelope)
     {
@@ -1566,9 +1602,9 @@ caddr_t * xml_find_signature (caddr_t * doc)
   return 0;
 }
 
-caddr_t * xml_find_signedinfo (caddr_t * doc)
+caddr_t * xml_find_signedinfo (caddr_t * doc, int is_wsse)
 {
-  caddr_t * signature = xml_find_signature (doc);
+  caddr_t * signature = xml_find_signature (doc, is_wsse);
   if (signature)
     {
       return xml_find_child (signature, "SignedInfo", DSIG_URI, 0, NULL);
@@ -1647,7 +1683,7 @@ xmlenc_decrypt_soap (caddr_t * qst, char * xml_text, long soap_version, long val
   int is_valid_secxml = 0, try_decode = (validate_sign & 4);
   char * decrypted_xml_text = NULL;
   dk_session_t *decrypted_xml;
-  wsse_ser_ctx_t sctx;
+  wsse_ser_ctx_t sctx, *pctx = &sctx;
 
   memset (&sctx, 0, sizeof (wsse_ser_ctx_t));
   doc = (caddr_t *) xml_make_tree ((query_instance_t*) qst, xml_text, err_ret, (char *) enc, lh, 0);
@@ -1697,7 +1733,7 @@ xmlenc_decrypt_soap (caddr_t * qst, char * xml_text, long soap_version, long val
 
   XENC_TRY (&ctx->wc_tb)
     {
-      wsse_build_wsse_objects (security, wsse_get_callback (ctx, WSSE_URI(&sctx) , "Security"), ctx);
+      wsse_build_wsse_objects (security, wsse_get_callback (ctx, WSSE_URI(pctx) , "Security"), ctx);
       wsse_resolve_encrypted_keys (envelope, ctx);
     }
   XENC_CATCH
@@ -1725,7 +1761,7 @@ xmlenc_decrypt_soap (caddr_t * qst, char * xml_text, long soap_version, long val
   decrypted_xml_text = strses_string (decrypted_xml);
 
   if (validate_sign != XENC_VALIDATE_NONE && signature)
-    if (dsig_check_xml ((query_instance_t*) qst, ctx->wc_dsig, xml_text, strlen (xml_text), &c, &errm))
+    if (dsig_check_xml ((query_instance_t*) qst, ctx->wc_dsig, xml_text, strlen (xml_text), &c, &errm, 1))
       {
 	char buf[1024];
 	wsse_ctx_free (ctx);
@@ -1829,7 +1865,7 @@ void wsse_report_error (struct wsse_ctx_s * ctx, char * code, int buflen, ...)
       code = WSSE_UNKNOWN_CODE;
       goto again;
     }
-#ifdef DEBUG
+#if 0
   if (xenc_test_processing())
     return;
 #endif
diff --git a/libsrc/Wi/xmlenc.c b/libsrc/Wi/xmlenc.c
index 30c622c..23a9f5f 100644
--- a/libsrc/Wi/xmlenc.c
+++ b/libsrc/Wi/xmlenc.c
@@ -1,7 +1,7 @@
 /*
  *  xmlenc.c
  *
- *  $Id: xmlenc.c,v 1.16.2.6 2009/08/18 18:20:46 source Exp $
+ *  $Id: xmlenc.c,v 1.16.2.14 2011/01/11 22:41:31 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -80,9 +80,7 @@ extern "C" {
 	name ? name : "temporary");
 
 
-
-
-
+static char WSSE_BASE64_ENCODING_TYPE[] = "wsse:Base64Binary";
 
 #define XENC_BUF_SZ 80
 
@@ -1374,9 +1372,15 @@ xenc_key_t * xenc_key_create_from_x509_cert (char * name, char * certificate, ch
 
   if (type == CERT_TYPE_PEM_FORMAT) /* PEM format */
     {
+#if OPENSSL_VERSION_NUMBER >= 0x00908000L
+      x509 = (X509 *)PEM_ASN1_read_bio ((d2i_of_void *)d2i_X509,
+					PEM_STRING_X509,
+					b, NULL, NULL, NULL);
+#else
       x509 = (X509 *)PEM_ASN1_read_bio ((char *(*)())d2i_X509,
 					PEM_STRING_X509,
 					b, NULL, NULL, NULL);
+#endif
     }
   else if (type == CERT_TYPE_PKCS12_FORMAT) /* PKCS12 format */
     {
@@ -1397,10 +1401,17 @@ xenc_key_t * xenc_key_create_from_x509_cert (char * name, char * certificate, ch
 
   if (b_priv)
     {
+#if OPENSSL_VERSION_NUMBER >= 0x00908000L
+      private_key = (EVP_PKEY*)PEM_ASN1_read_bio ((d2i_of_void *)d2i_PrivateKey,
+					     PEM_STRING_EVP_PKEY,
+					     b_priv,
+					     NULL, pass_cb, (void *) private_key_passwd);
+#else
       private_key = (EVP_PKEY*)PEM_ASN1_read_bio ((char *(*)())d2i_PrivateKey,
 					     PEM_STRING_EVP_PKEY,
 					     b_priv,
 					     NULL, pass_cb, (void *) private_key_passwd);
+#endif
       if (!private_key)
 	goto finish;
     }
@@ -2233,6 +2244,19 @@ bif_xenc_key_rsa_read (caddr_t * qst, caddr_t * err_r, state_slot_t ** args)
   r = d2i_RSAPrivateKey (NULL, (const unsigned char **) &key_base64, len);
   p = d2i_RSAPublicKey (NULL, (const unsigned char **) &key_base64, len);
 
+  if (!r && !p)
+    {
+      dk_free_box (key_base64);
+      sqlr_new_error ("42000", "XENC05", "Cannot import the supplied RSA key");
+    }
+
+  if (!p)
+    {
+      p = RSA_new ();
+      p->n = BN_dup (r->n);
+      p->e = BN_dup (r->e);
+    }
+
   mutex_enter (xenc_keys_mtx);
   k = xenc_key_create (name, XENC_RSA_ALGO, DSIG_RSA_SHA1_ALGO, 0);
   if (NULL == k)
@@ -2248,6 +2272,44 @@ bif_xenc_key_rsa_read (caddr_t * qst, caddr_t * err_r, state_slot_t ** args)
 }
 
 static caddr_t
+bif_xenc_key_rsa_construct (caddr_t * qst, caddr_t * err_r, state_slot_t ** args)
+{
+  static char * me = "xenc_key_RSA_construct";
+  caddr_t name = bif_key_name_arg (qst, args, 0, me);
+  caddr_t mod = bif_string_arg (qst, args, 1, me);
+  caddr_t exp = bif_string_arg (qst, args, 2, me);
+  caddr_t pexp = BOX_ELEMENTS (args) > 3 ? bif_string_arg (qst, args, 3, me) : 0;
+  BIGNUM *e, *n;
+  xenc_key_t * k;
+  RSA *p, *pk = NULL;
+
+  p = RSA_new ();
+  n = BN_bin2bn ((unsigned char *) mod, box_length (mod) - 1, NULL);
+  e = BN_bin2bn ((unsigned char *) exp, box_length (exp) - 1, NULL);
+  p->n = n;
+  p->e = e;
+  if (pexp)
+    {
+      pk = RSA_new ();
+      pk->d = BN_bin2bn ((unsigned char *) pexp, box_length (pexp) - 1, NULL);
+      pk->n = BN_dup (n);
+      pk->e = BN_dup (e);
+    }
+  mutex_enter (xenc_keys_mtx);
+  k = xenc_key_create (name, XENC_RSA_ALGO, DSIG_RSA_SHA1_ALGO, 0);
+  if (NULL == k)
+    {
+      mutex_leave (xenc_keys_mtx);
+      SQLR_NEW_KEY_EXIST_ERROR (name);
+    }
+  k->xek_private_rsa = pk;
+  k->xek_rsa = p;
+  k->ki.rsa.pad = RSA_PKCS1_PADDING;
+  mutex_leave (xenc_keys_mtx);
+  return box_dv_short_string (k->xek_name);
+}
+
+static caddr_t
 bif_xenc_key_dsa_read (caddr_t * qst, caddr_t * err_r, state_slot_t ** args)
 {
   caddr_t name = bif_key_name_arg (qst, args, 0, "xenc_key_DSA_read");
@@ -3300,10 +3362,16 @@ bif_xmlenc_encrypt (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 	  END_DO_BOX;
 	}
       else
-	dk_free_box ((box_t) security_tags);
+	{
+	  dk_free_box ((box_t) security_tags);
+	  security_tags = NULL;
+	}
     }
   else
-    dk_free_box ((box_t) security_tags);
+    {
+      dk_free_box ((box_t) security_tags);
+      security_tags = NULL;
+    }
 
   xenc_nss_add_namespace_prefix (_nss, security_tags, WSSE_URI(&sctx), "wsse");
   xenc_nss_add_namespace_prefix (_nss, security_tags, DSIG_URI, "ds");
@@ -3417,6 +3485,162 @@ bif_xmlenc_encrypt (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return ret_text;
 }
 
+caddr_t
+bif_xml_sign (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  id_hash_t * _nss = 0;
+  xml_tree_ent_t * doc = xenc_get_entity_arg ((query_instance_t*) qst, args, 0, "xml_sign", &_nss);
+  caddr_t text = bif_string_arg (qst, args, 0, "xml_sign");
+  caddr_t dsig_template_str = bif_string_arg (qst, args, 1, "xml_sign");
+  caddr_t top_elem = bif_string_arg (qst, args, 2, "xml_sign");
+  xml_doc_subst_t * xs;
+  caddr_t ret_text = 0;
+  query_instance_t * qi = (query_instance_t*) qst;
+  dsig_signature_t * dsig = 0;
+  xenc_try_block_t t;
+  xenc_err_code_t c;
+  char * c_err;
+  dk_session_t * doc_ses;
+  subst_item_t * subst_items = 0;
+  caddr_t *elem = 0, *signature = 0;
+  caddr_t signature_val = 0;
+  wsse_ctx_t * ctx;
+  char err_buf[1024];
+  int sign_err = 0;
+  wsse_ser_ctx_t sctx;
+  caddr_t * opts = NULL, *top, curr_nss, elem_copy = box_copy (top_elem), local;
+
+  memset (&sctx, 0, sizeof (wsse_ser_ctx_t));
+
+  XENC_TRY (&t)
+    {
+      dsig = dsig_template_ ((query_instance_t*) qst, dsig_template_str, &t, opts);
+    }
+  XENC_CATCH
+    {
+      char buf [1024];
+      xenc_make_error (buf, sizeof (buf), t.xtb_err_code, t.xtb_err_buffer);
+      dk_free_box (t.xtb_err_buffer);
+      dk_free_box ((box_t) doc);
+      nss_free (_nss);
+      sqlr_new_error ("42000", "XENC18", "could not create XML signature from template : %s", buf);
+    }
+  XENC_TRY_END (&t);
+
+  dsig->dss_signature_1 = box_dv_short_string ("uninitialized");
+
+  doc_ses = strses_allocate();
+  SES_PRINT (doc_ses, text);
+  if (dsig_initialize (qi, doc_ses, strses_length (doc_ses), dsig, &c, &c_err))
+    {
+      char buf [1024];
+      dk_free_box ((box_t) doc);
+      nss_free (_nss);
+      doc_ses->dks_in_buffer = NULL;
+      strses_free (doc_ses);
+      dsig_free (dsig);
+      strncpy (buf, c_err, 1024);
+      sqlr_new_error ("42000", "XENC19", "could not sign XML signature, %s", buf);
+    }
+  strses_free (doc_ses);
+
+  signature = (caddr_t *) signature_serialize_1 (dsig, &sctx);
+  if (!signature)
+    {
+      dsig->dss_signature_1 = 0;
+      goto finish2;
+    }
+
+  top = doc->xte_current;
+  /* must be configurable */
+  local = strrchr (elem_copy, ':');
+  if (local)
+    {
+      *local = 0;
+      local++;
+      elem = xml_find_child (top, elem, elem_copy, 0, NULL);
+    }
+  if (elem)
+    {
+      int inx;
+      caddr_t * new_elem = (caddr_t *) dk_alloc_box (box_length (elem) + sizeof (caddr_t), DV_ARRAY_OF_POINTER);
+      memcpy (new_elem, elem, box_length (elem));
+      memcpy (new_elem + BOX_ELEMENTS (elem), &signature, sizeof (caddr_t));
+      curr_nss = xenc_get_namespaces (elem, _nss);
+      DO_BOX (caddr_t *, child, inx, top)
+	{
+	  if (child == elem)
+	    {
+	      dk_free_box (child);
+	      ((caddr_t**)top)[inx] = new_elem;
+	    }
+	}
+      END_DO_BOX;
+      xenc_set_namespaces (new_elem, box_copy_tree (curr_nss), _nss);
+    }
+  else
+    {
+      sqlr_new_error (".....", ".....", "Can not find tag to sign");
+    }
+
+  xenc_nss_add_namespace_prefix (_nss, signature, DSIG_URI, "ds");
+  xenc_nss_add_namespace_prefix (_nss, signature, XENC_URI, "xenc");
+
+  ctx = wsse_ctx_allocate ();
+  XENC_TRY (&ctx->wc_tb)
+    {
+      doc->xte_current = signature;
+      signature_val = dsig_sign_signature (dsig, doc, _nss, ctx);
+    }
+  XENC_CATCH
+    {
+      xenc_make_error (err_buf, sizeof (err_buf), ctx->wc_tb.xtb_err_code, ctx->wc_tb.xtb_err_buffer);
+      wsse_ctx_free (ctx);
+      sign_err = 1;
+      dsig->dss_signature_1 = 0;
+      goto finish2;
+    }
+  XENC_TRY_END (&ctx->wc_tb);
+  wsse_ctx_free (ctx);
+
+  doc->xte_current = doc->xe_doc.xtd->xtd_tree;
+
+  if (signature_val)
+    {
+      subst_items = (subst_item_t *) dk_alloc_box (sizeof (subst_item_t), DV_ARRAY_OF_POINTER);
+      subst_items[0].orig = (caddr_t *)dsig->dss_signature_1;
+      dsig->dss_signature_1 = 0;
+      subst_items[0].copy = (caddr_t *)signature_val;
+      subst_items[0].type = XENCTypeElementIdx;
+    }
+
+  xs = (xml_doc_subst_t *) dk_alloc (sizeof (xml_doc_subst_t));
+  memset (xs, 0, sizeof (xml_doc_subst_t));
+
+  xs->xs_doc = doc;
+  xs->xs_subst_items = subst_items;
+  xs->xs_soap_version = 0;
+  xs->xs_sign = 1;
+  xs->xs_namespaces = _nss;
+
+  ret_text = xml_doc_subst (xs);
+  dk_free_box ((box_t) subst_items);
+  xml_doc_subst_free(xs);
+  doc->xte_current = top;
+
+ finish2:
+
+  if (dsig)
+    dsig_free (dsig);
+  dk_free_box ((box_t) doc);
+  nss_free (_nss);
+  dk_free_box (signature_val);
+  dk_free_box (elem_copy);
+  if (sign_err)
+    sqlr_new_error ("42000", "XENC34", "could not sign XML signed info: %s", err_buf);
+  return ret_text;
+}
+
 typedef struct dsig_fullname_s
 {
   caddr_t	uri;
@@ -3843,17 +4067,36 @@ caddr_t ** xenc_generate_ext_info (xenc_key_t * key)
   return array;
 }
 
-caddr_t * xenc_generate_key_tag (xenc_key_t * key, int extended_ver, xenc_id_t * ids, int pref_KI,
-    wsse_ser_ctx_t * sctx)
+caddr_t *
+xenc_generate_key_tag (xenc_key_t * key, int extended_ver, xenc_id_t * ids, int pref_KI, wsse_ser_ctx_t * sctx, int x509sertype)
 {
   caddr_t * ret;
   xenc_tag_t * keyi = xenc_tag_create(DSIG_URI, ":KeyInfo");
 
-  if (key->xek_x509_ref || key->xek_x509_KI || (key->xek_type == DSIG_KEY_KERBEROS))
+  if (XENC_T_X509_CERT == x509sertype && key->xek_x509)
+    {
+      caddr_t encoded_cert = 0;
+      xenc_tag_t * data = (xenc_tag_t *) xenc_tag_create (DSIG_URI, ":X509Data");
+      xenc_tag_t * cert = (xenc_tag_t *) xenc_tag_create (DSIG_URI, ":X509Certificate");
+      X509 * x509 = key->xek_x509;
+      BIO * b = BIO_new (BIO_s_mem());
+
+      if (i2d_X509_bio(b,x509))
+	{
+	  encoded_cert = certificate_encode (b, WSSE_BASE64_ENCODING_TYPE);
+	}
+      BIO_free (b);
+
+      xenc_tag_add_child (cert, (caddr_t *) encoded_cert); /* b64 encoded certificate */
+      xenc_tag_add_child (data, xenc_tag_finalize (cert));
+      xenc_tag_add_child (keyi, xenc_tag_finalize (data));
+      xenc_tag_free (data);
+      xenc_tag_free (cert);
+    }
+  else if (key->xek_x509_ref || key->xek_x509_KI || (key->xek_type == DSIG_KEY_KERBEROS))
     {
       xenc_tag_t * stokenref = (xenc_tag_t *) xenc_tag_create (WSSE_URI(sctx), ":SecurityTokenReference");
       xenc_tag_t * ref;
-#if 1
       if (pref_KI && (key->xek_x509_KI || key->xek_kerb_KI))
 	{
 	  ref = (xenc_tag_t *) xenc_tag_create (WSSE_URI(sctx), ":KeyIdentifier");
@@ -3872,7 +4115,6 @@ caddr_t * xenc_generate_key_tag (xenc_key_t * key, int extended_ver, xenc_id_t *
 	    }
 	}
       else
-#endif
 	{
 	  char buf[255];
 	  ref =  xenc_tag_create (WSSE_URI(sctx), ":Reference");
@@ -4008,7 +4250,6 @@ void xenc_serialize_key (query_instance_t * qi, xenc_key_t * key, dk_session_t *
 }
 #endif
 
-static char WSSE_BASE64_ENCODING_TYPE[] = "wsse:Base64Binary";
 
 caddr_t certificate_encode (BIO * b, const char * encoding_type)
 {
@@ -4035,8 +4276,11 @@ caddr_t certificate_encode (BIO * b, const char * encoding_type)
     return 0;
 }
 
-caddr_t decode_box (caddr_t encoded_cert, const char * encoding_type)
+caddr_t
+decode_box (caddr_t encoded_cert, const char * encoding_type)
 {
+  if (!encoded_cert)
+    return 0;
   if (!strcmp (encoding_type, WSSE_BASE64_ENCODING_TYPE)
       || !strcmp (encoding_type, WSSE_OASIS_BASE64_ENCODING_TYPE))
     {
@@ -4197,7 +4441,7 @@ caddr_t xenc_generate_encrypted_key_tag (query_instance_t * qi, xenc_key_inst_t
 
   xenc_tag_add_att (em, "Algorithm", super->xek_enc_algo->xea_ns);
   xenc_tag_add_child (ek, xenc_tag_finalize (em));
-  xenc_tag_add_child (ek, xenc_generate_key_tag (super, DSIG_SER_REST_V, 0, 1 /* KI when possible */, sctx));
+  xenc_tag_add_child (ek, xenc_generate_key_tag (super, DSIG_SER_REST_V, 0, 1 /* KI when possible */, sctx, 0));
 
 
   ses = strses_allocate ();
@@ -4341,7 +4585,8 @@ void xenc_generate_key_taglist (query_instance_t * qi, xenc_key_inst_t * xki, dk
 }
 
 
-caddr_t * xenc_generate_security_tags (query_instance_t* qi, xpath_keyinst_t ** arr,
+caddr_t *
+xenc_generate_security_tags (query_instance_t* qi, xpath_keyinst_t ** arr,
 				       dsig_signature_t * dsig, int generate_ref_list, caddr_t * err_ret,
 				       wsse_ser_ctx_t * sctx)
 {
@@ -4616,6 +4861,8 @@ void xenc_build_ids_hash (caddr_t * curr, id_hash_t ** id_hash, int only_encrypt
   if (!only_encrypted_data || !strcmp ((((caddr_t **)(curr))[0][0]), XENC_URI ":EncryptedData"))
     {
       char * Id = xml_find_attribute (curr, "Id", 0);
+      if (!Id)
+	Id = xml_find_attribute (curr, "id", 0);
       if (Id)
 	{
 	  char idbuf[128];
@@ -4938,7 +5185,7 @@ caddr_t * signature_serialize_1 (dsig_signature_t * dsig, wsse_ser_ctx_t * sctx)
   xenc_tag_add_child (sign_tag, signinfo_tag);
   xenc_tag_add_child (sign_tag, signval_tag);
   if (dsig->dss_key)
-    xenc_tag_add_child (sign_tag, xenc_generate_key_tag (dsig->dss_key, DSIG_SER_EXT_V, 0, 0 /* no KI */, sctx));
+    xenc_tag_add_child (sign_tag, xenc_generate_key_tag (dsig->dss_key, DSIG_SER_EXT_V, 0, 0 /* no KI */, sctx, dsig->dss_key_value_type));
 
   ret_tag = xenc_tag_finalize (sign_tag);
   xenc_tag_free (sign_tag);
@@ -5952,6 +6199,47 @@ bif_xenc_hmac_sha256_digest (caddr_t * qst, caddr_t * err_ret, state_slot_t ** a
 }
 #endif
 
+static caddr_t
+bif_xenc_dsig_signature (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  char * me = "xenc_dsig_signature";
+  caddr_t  text = bif_string_arg (qst, args, 0, me);
+  caddr_t name = bif_string_arg (qst, args, 1, me);
+  caddr_t signature_method = bif_string_arg (qst, args, 2, me);
+  xenc_key_t * key = xenc_get_key_by_name (name, 1);
+  dsig_sign_f sign_f = dsig_sign_f_get (signature_method, 0);
+  caddr_t signval;
+  dk_session_t * ses;
+  ses = strses_allocate ();
+  session_buffered_write (ses, text, box_length (text) - 1);
+  if (!sign_f || !(sign_f) (ses, strses_length(ses), key, &signval))
+    signval = NEW_DB_NULL;
+  dk_free_box (ses);
+  return signval;
+}
+
+static caddr_t
+bif_xenc_dsig_verify (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  char * me = "xenc_dsig_verify";
+  caddr_t  text = bif_string_arg (qst, args, 0, me);
+  caddr_t name = bif_string_arg (qst, args, 1, me);
+  caddr_t signature_method = bif_string_arg (qst, args, 2, me);
+  caddr_t signval = bif_string_arg (qst, args, 3, me);
+  xenc_key_t * key = xenc_get_key_by_name (name, 1);
+  dsig_verify_f verify_f = dsig_verify_f_get (signature_method, 0);
+  caddr_t rc;
+
+  dk_session_t * ses;
+  ses = strses_allocate ();
+  session_buffered_write (ses, text, box_length (text) - 1);
+  if (!verify_f || !(verify_f) (ses, strses_length(ses), key, signval))
+    rc = box_num (0);
+  else
+    rc = box_num (1);
+  dk_free_box (ses);
+  return rc;
+}
 
 static caddr_t
 bif_xenc_hmac_sha1_digest (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
@@ -5995,6 +6283,7 @@ bif_xenc_x509_generate (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   long days = bif_long_arg (qst, args, 3, "xenc_x509_generate");
   caddr_t * subj = (caddr_t *) bif_strict_array_or_null_arg (qst, args, 4, "xenc_x509_generate");
   caddr_t * exts = (caddr_t *) bif_strict_array_or_null_arg (qst, args, 5, "xenc_x509_generate");
+  float hours = BOX_ELEMENTS (args) > 6 ? (float) bif_float_arg (qst, args, 6, "xenc_x509_generate") : 0;
   xenc_key_t * ca_key = xenc_get_key_by_name (key_name, 1);
   xenc_key_t * cli_key = xenc_get_key_by_name (cli_pub_key, 1);
   X509 *x = NULL;
@@ -6075,7 +6364,7 @@ bif_xenc_x509_generate (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   X509_set_version (x,2);
   ASN1_INTEGER_set (X509_get_serialNumber (x), serial);
   X509_gmtime_adj (X509_get_notBefore (x), 0);
-  X509_gmtime_adj (X509_get_notAfter (x), (long) 60 * 60 * 24 * days);
+  X509_gmtime_adj (X509_get_notAfter (x), (long) (((days * 24) + hours) * 60 * 60));
   X509_set_pubkey (x, cli_pk);
   name = X509_get_subject_name(x);
 
@@ -6317,13 +6606,26 @@ bif_xenc_pem_export (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   int len;
   caddr_t ret = NULL;
 
-  if (!key || !key->xek_x509)
+  if (!key)
     goto err;
 
   b = BIO_new (BIO_s_mem());
+  if (key->xek_x509)
+    {
   PEM_write_bio_X509 (b, key->xek_x509);
   if (pkey && key->xek_evp_private_key)
     PEM_write_bio_PrivateKey (b, key->xek_evp_private_key, NULL, NULL, 0, NULL, NULL);
+    }
+  else if (key->xek_type == DSIG_KEY_RSA)
+    PEM_write_bio_RSAPrivateKey (b, key->xek_private_rsa, NULL, NULL, 0, NULL, NULL);
+  else if (key->xek_type == DSIG_KEY_DSA)
+    PEM_write_bio_DSAPrivateKey (b, key->xek_private_dsa, NULL, NULL, 0, NULL, NULL);
+  else
+    {
+      BIO_free (b);
+      goto err;
+    }
+
   len = BIO_get_mem_data (b, &data_ptr);
   if (len > 0 && data_ptr)
     {
@@ -6348,16 +6650,18 @@ bif_xenc_pubkey_pem_export (caddr_t * qst, caddr_t * err_ret, state_slot_t ** ar
   caddr_t ret = NULL;
   EVP_PKEY * k;
 
-  if (!key || !key->xek_x509)
+  if (!key)
     goto err;
 
   b = BIO_new (BIO_s_mem());
+  if (key->xek_x509)
+    {
   k = X509_get_pubkey (key->xek_x509);
 #ifdef EVP_PKEY_RSA
   if (k->type == EVP_PKEY_RSA)
     {
       RSA * x = k->pkey.rsa;
-      PEM_write_bio_RSAPublicKey (b, x);
+	  PEM_write_bio_RSA_PUBKEY (b, x);
     }
 #endif
 #ifdef EVP_PKEY_DSA
@@ -6368,6 +6672,16 @@ bif_xenc_pubkey_pem_export (caddr_t * qst, caddr_t * err_ret, state_slot_t ** ar
     }
 #endif
   EVP_PKEY_free (k);
+    }
+  else if (key->xek_type == DSIG_KEY_RSA)
+    PEM_write_bio_RSA_PUBKEY (b, key->xek_rsa);
+  else if (key->xek_type == DSIG_KEY_DSA)
+    PEM_write_bio_DSA_PUBKEY (b, key->xek_dsa);
+  else
+    {
+      BIO_free (b);
+      goto err;
+    }
   len = BIO_get_mem_data (b, &data_ptr);
   if (len > 0 && data_ptr)
     {
@@ -6382,6 +6696,87 @@ err:
 }
 
 static caddr_t
+BN2binbox (BIGNUM * x)
+{
+  size_t buf_len, n;
+  caddr_t buf;
+  buf_len = (size_t) BN_num_bytes (x);
+  buf = dk_alloc_box (buf_len, DV_BIN);
+  n = BN_bn2bin (x, (unsigned char *) buf);
+  if (n != buf_len)
+    GPF_T;
+  return buf;
+}
+
+/* encode BIN box to base64 and free the input box */
+static caddr_t
+xenc_encode_base64_binbox (caddr_t box, int free)
+{
+  caddr_t buf, ret;
+  int len = box_length (box);
+  if (!IS_BOX_POINTER (box))
+    return NULL;
+  buf = dk_alloc_box (len * 2, DV_BIN);
+  len = xenc_encode_base64 ((char *)box, buf, len);
+  ret = dk_alloc_box (len + 1, DV_STRING);
+  memcpy (ret, buf, len);
+  ret[len] = 0;
+  dk_free_box (buf);
+  if (free)
+    dk_free_box (box);
+  return ret;
+}
+
+static caddr_t
+xenc_rsa_pub_magic (RSA * x)
+{
+  caddr_t ret;
+  caddr_t n = BN2binbox (x->n); /* modulus */
+  caddr_t e = BN2binbox (x->e); /* public exponent */
+  n = xenc_encode_base64_binbox (n, 1);
+  e = xenc_encode_base64_binbox (e, 1);
+  ret = dk_alloc_box (box_length (n) + box_length (e) + 4 /* two dots - one trailing zero + RSA prefix */, DV_STRING);
+  snprintf (ret, box_length (ret), "RSA.%s.%s", n, e);
+  dk_free_box (n);
+  dk_free_box (e);
+  return ret;
+}
+
+static caddr_t
+bif_xenc_pubkey_magic_export (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  caddr_t key_name = bif_string_arg (qst, args, 0, "xenc_pubkey_magic_export");
+  xenc_key_t * key = xenc_get_key_by_name (key_name, 1);
+  caddr_t ret = NULL;
+  EVP_PKEY * k;
+
+  if (!key)
+    SQLR_NEW_KEY_ERROR (key_name);
+
+  if (key->xek_x509)
+    {
+      k = X509_get_pubkey (key->xek_x509);
+#ifdef EVP_PKEY_RSA
+      if (k->type == EVP_PKEY_RSA)
+	{
+	  RSA * x = k->pkey.rsa;
+	  ret = xenc_rsa_pub_magic (x);
+	}
+#endif
+      EVP_PKEY_free (k);
+    }
+  else if (key->xek_type == DSIG_KEY_RSA)
+    {
+       RSA * x = key->xek_rsa;
+       ret = xenc_rsa_pub_magic (x);
+    }
+  else
+    sqlr_new_error ("42000", "XENC..", "The key type is not supported for export.");
+
+  return ret;
+}
+
+static caddr_t
 bif_xenc_SPKI_read (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   caddr_t name = bif_key_name_arg (qst, args, 0, "xenc_SPKI_read");
@@ -6493,6 +6888,7 @@ void bif_xmlenc_init ()
 
 
   bif_define ("xenc_encrypt", bif_xmlenc_encrypt);
+  bif_define ("xml_sign", bif_xml_sign);
 
   bif_define ("xenc_key_inst_create", bif_xenc_key_inst_create);
   bif_define ("xenc_decrypt_soap", bif_xmlenc_decrypt_soap); /* decrypts & validates encrypted & signed SOAP message */
@@ -6518,6 +6914,7 @@ void bif_xmlenc_init ()
 
   bif_define ("xenc_key_3DES_read", bif_xenc_key_3des_read);
   bif_define ("xenc_key_RSA_read", bif_xenc_key_rsa_read);
+  bif_define ("xenc_key_RSA_construct", bif_xenc_key_rsa_construct);
   bif_define ("xenc_key_DSA_read", bif_xenc_key_dsa_read);
   bif_define ("xenc_key_RAW_read", bif_xenc_key_raw_read);
   bif_define ("xenc_key_RAW_rand_create", bif_xenc_key_raw_rand_create);
@@ -6533,6 +6930,7 @@ void bif_xmlenc_init ()
   bif_define ("xenc_pkcs12_export", bif_xenc_pkcs12_export);
   bif_define ("xenc_pem_export", bif_xenc_pem_export);
   bif_define ("xenc_pubkey_pem_export", bif_xenc_pubkey_pem_export);
+  bif_define ("xenc_pubkey_magic_export", bif_xenc_pubkey_magic_export);
   bif_define ("xenc_SPKI_read", bif_xenc_SPKI_read);
 
 #ifdef _KERBEROS
@@ -6562,6 +6960,8 @@ void bif_xmlenc_init ()
   bif_define ("xenc_DH_compute_key", bif_xenc_DH_compute_key);
   bif_define ("xenc_xor", bif_xenc_xor);
   bif_define ("xenc_bn2dec", bif_xenc_bn2dec);
+  bif_define ("xenc_dsig_sign", bif_xenc_dsig_signature);
+  bif_define ("xenc_dsig_verify", bif_xenc_dsig_verify);
 
   xenc_cert_X509_idx = ecm_find_name ("X.509", (void*)xenc_cert_types, xenc_cert_types_len,
 					 sizeof (xenc_cert_type_t));
diff --git a/libsrc/Wi/xmlenc.h b/libsrc/Wi/xmlenc.h
index d42901c..d44384f 100644
--- a/libsrc/Wi/xmlenc.h
+++ b/libsrc/Wi/xmlenc.h
@@ -1,7 +1,7 @@
 /*
  *  xmlenc.h
  *
- *  $Id: xmlenc.h,v 1.6.2.1 2009/04/18 21:55:18 source Exp $
+ *  $Id: xmlenc.h,v 1.6.2.4 2010/10/13 12:12:21 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -141,6 +141,7 @@ typedef enum {
 #define DSIG_SHA256_ALGO	"http://www.w3.org/2000/09/xmldsig#sha256"
 
 #define DSIG_RSA_SHA1_ALGO	"http://www.w3.org/2000/09/xmldsig#rsa-sha1"
+#define DSIG_RSA_SHA256_ALGO	"http://www.w3.org/2000/09/xmldsig#rsa-sha256"
 #define DSIG_DSA_SHA1_ALGO	"http://www.w3.org/2000/09/xmldsig#dsa-sha1"
 #define DSIG_DH_SHA1_ALGO	"http://www.w3.org/2000/09/xmldsig#dh-sha1"
 #define DSIG_DH_SHA256_ALGO	"http://www.w3.org/2000/09/xmldsig#dh-sha256"
@@ -429,6 +430,11 @@ typedef struct dsig_reference_s
   char *		dsr_text; /* result of reference */
 } dsig_reference_t;
 
+typedef enum {
+  XENC_T_DEFAULT = 0,
+  XENC_T_X509_CERT = 1
+} XENC_VALUE_TYPE_T;
+
 typedef struct dsig_signature_s
 {
   char *	dss_canon_method;
@@ -438,6 +444,7 @@ typedef struct dsig_signature_s
   char *	dss_signature_1;
 
   xenc_key_t *	dss_key;
+  XENC_VALUE_TYPE_T dss_key_value_type;
 } dsig_signature_t;
 
 typedef struct dsig_compare_s
@@ -605,8 +612,8 @@ int xenc_algorithms_create (const char * ns0, const char * name,
 			    xenc_encryptor_f enc,
 			    xenc_decryptor_f dect,
 			    DSIG_KEY_TYPE key_type);
-caddr_t * xml_find_signedinfo (caddr_t * root);
-caddr_t * xml_find_signature (caddr_t * root);
+caddr_t * xml_find_signedinfo (caddr_t * root, int is_wsse);
+caddr_t * xml_find_signature (caddr_t * root, int is_wsse);
 wsse_ctx_t * wsse_ctx_allocate (void);
 void wsse_ctx_free (wsse_ctx_t * ctx);
 caddr_t dsig_sign_signature (dsig_signature_t * dsig, xml_tree_ent_t * xte, id_hash_t * nss, wsse_ctx_t * ctx);
@@ -617,6 +624,8 @@ void xenc_set_serialization_ctx (caddr_t try_ns_spec, wsse_ser_ctx_t * sctx);
 caddr_t bif_xmlenc_decrypt_soap (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args);
 caddr_t bif_dsig_validate (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args);
 caddr_t xenc_get_option (caddr_t *options, const char * opt, char * def);
+caddr_t certificate_encode (BIO * b, const char * encoding_type);
+caddr_t * xml_find_any_child (caddr_t * curr, const char * name, const char * uri);
 
 extern dk_mutex_t * xenc_keys_mtx;
 
diff --git a/libsrc/Wi/xmlenc_algos.c b/libsrc/Wi/xmlenc_algos.c
index 061a713..3092b21 100644
--- a/libsrc/Wi/xmlenc_algos.c
+++ b/libsrc/Wi/xmlenc_algos.c
@@ -1,7 +1,7 @@
 /*
  *  xmlenc_algos.c
  *
- *  $Id: xmlenc_algos.c,v 1.8.2.1 2009/04/18 21:55:18 source Exp $
+ *  $Id: xmlenc_algos.c,v 1.8.2.3 2010/10/13 12:12:21 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -472,6 +472,8 @@ void xml_c_mark_as_busy (xml_c_stack exc_list, caddr_t * exc_ns, int inx)
   caddr_t * new_curr_ns;
   if (exc_ns == curr_ns) /* our namespace */
     {
+      if (exc_ns[inx] != XML_C_BUSY_NS)
+	dk_free_box (exc_ns[inx]);
       exc_ns[inx] = XML_C_BUSY_NS;
       return;
     }
@@ -678,6 +680,7 @@ id_hash_t * xml_c_nss_hash_create (caddr_t * select_tree, id_hash_t * nss,
       caddr_t * new_new_namespaces = 0;
       xml_c_fill_exc_list_up (&pexc_list, new_namespaces);
       new_new_namespaces = xml_c_namespaces_sort_2 (select_tree, &pexc_list, 0);
+      dk_free_box (new_namespaces);
       new_namespaces = new_new_namespaces;
       xml_c_namespaces_sort (new_namespaces); /* XXX: this needed as MS.WSE used sorted prefixes */
     }
@@ -876,6 +879,7 @@ int dsig_tr_enveloped_signature (query_instance_t * qi, dk_session_t * ses_in, l
 
  finish:
   dk_free_tree (err_ret);
+  dk_free_box ((box_t) xte);
   nss_free (nss);
   return ret;
 }
@@ -1026,6 +1030,7 @@ int dsig_tr_fake_uri (query_instance_t * qi, dk_session_t * ses_in, long len,
   dk_free_box (text);
   dk_free_tree (err_ret);
   dk_free_box (ret_text);
+  dk_free_box ((box_t) xte);
   if (xs)
     {
       dk_set_free (xs->xs_parent_link);
@@ -1478,6 +1483,105 @@ dsig_rsa_sha1_verify (dk_session_t * ses_in, long len, xenc_key_t * key, caddr_t
   return i;
 }
 
+#ifdef SHA256_ENABLE
+int
+dsig_rsa_sha256_digest (dk_session_t * ses_in, long len, xenc_key_t * key, caddr_t * sign_out)
+{
+  SHA256_CTX ctx;
+  unsigned char md[SHA256_DIGEST_LENGTH + 1];
+  unsigned char buf[1];
+  unsigned char sig[256 + 1];
+  unsigned int siglen;
+  int i;
+
+  if (NULL == key)
+    return 0;
+
+  if (key->xek_type != DSIG_KEY_RSA)
+    return 0;
+
+  if (!key->xek_private_rsa)
+    return 0;
+
+  memset (md, 0, sizeof (md));
+  SHA256_Init(&ctx);
+
+  CATCH_READ_FAIL (ses_in)
+    {
+      for (;;)
+	{
+          i = session_buffered_read (ses_in, (char *)buf, 1);
+	  if (i <= 0) break;
+	  SHA256_Update(&ctx,buf,(unsigned long)i);
+	}
+    }
+  FAILED
+    {
+    }
+  END_READ_FAIL (ses_in);
+
+  SHA256_Final(&(md[0]),&ctx);
+
+  RSA_sign (NID_sha256, md, SHA256_DIGEST_LENGTH, sig, &siglen, key->xek_private_rsa);
+  sig[siglen] = 0;
+
+  if (sign_out)
+    {
+      caddr_t encoded_out = dk_alloc_box_zero (siglen * 2 + 1, DV_STRING);
+      len = xenc_encode_base64 ((char *)sig, encoded_out, siglen);
+      sign_out[0] = dk_alloc_box_zero (len + 1, DV_STRING);
+      memcpy (sign_out[0], encoded_out, len);
+      dk_free_box (encoded_out);
+    }
+  return len;
+}
+
+int
+dsig_rsa_sha256_verify (dk_session_t * ses_in, long len, xenc_key_t * key, caddr_t digest_base64)
+{
+  SHA256_CTX ctx;
+  unsigned char md[SHA256_DIGEST_LENGTH + 1];
+  unsigned char buf[1];
+  int i;
+  unsigned char * sig;
+  unsigned int siglen;
+
+  if (NULL == key)
+    return 0;
+
+
+  siglen = box_length (digest_base64);
+  sig = (unsigned char *) dk_alloc_box_zero (siglen, DV_BIN);
+  memcpy (sig, digest_base64, siglen);
+  siglen = xenc_decode_base64 ((char *)sig, (char *)(sig + siglen));
+
+  memset (md, 0, sizeof (md));
+  SHA256_Init(&ctx);
+
+  CATCH_READ_FAIL (ses_in)
+    {
+      for (;;)
+	{
+          i = session_buffered_read (ses_in, (char *)buf, 1);
+	  if (i <= 0) break;
+	  SHA256_Update(&ctx,buf,(unsigned long)i);
+	}
+    }
+  FAILED
+    {
+    }
+  END_READ_FAIL (ses_in);
+
+  SHA256_Final(&(md[0]),&ctx);
+
+  i = RSA_verify (NID_sha256, md, SHA256_DIGEST_LENGTH, sig, siglen, key->xek_rsa);
+
+  dk_free_box ((box_t) sig);
+
+  return i;
+}
+#endif
+
 int
 dsig_hmac_sha1_digest (dk_session_t * ses_in, long len, xenc_key_t * key, caddr_t * sign_out)
 {
@@ -2940,6 +3044,8 @@ void dsig_sec_init ()
   dsig_verify_algo_create (DSIG_HMAC_SHA1_ALGO, dsig_hmac_sha1_verify);
 
 #ifdef SHA256_ENABLE
+  dsig_sign_algo_create (DSIG_RSA_SHA256_ALGO, dsig_rsa_sha256_digest);
+  dsig_verify_algo_create (DSIG_RSA_SHA256_ALGO, dsig_rsa_sha256_verify);
   dsig_digest_algo_create (DSIG_SHA256_ALGO, dsig_sha256_digest);
   dsig_sign_algo_create (DSIG_HMAC_SHA256_ALGO, dsig_hmac_sha256_digest);
   dsig_verify_algo_create (DSIG_HMAC_SHA256_ALGO, dsig_hmac_sha256_verify);
diff --git a/libsrc/Wi/xmlenc_algos.h b/libsrc/Wi/xmlenc_algos.h
index 90d1b93..8b0e6bc 100644
--- a/libsrc/Wi/xmlenc_algos.h
+++ b/libsrc/Wi/xmlenc_algos.h
@@ -1,7 +1,7 @@
 /*
  *  xmlenc_algos.h
  *
- *  $Id: xmlenc_algos.h,v 1.6.2.1 2009/04/18 21:55:18 source Exp $
+ *  $Id: xmlenc_algos.h,v 1.6.2.2 2010/10/13 12:12:21 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -53,6 +53,8 @@ int dsig_dh_sha1_digest (dk_session_t * ses_in, long len, xenc_key_t * key, cadd
 int dsig_dh_sha1_verify (dk_session_t * ses_in, long len, xenc_key_t * key, caddr_t digest);
 
 #ifdef SHA256_ENABLE
+int dsig_rsa_sha256_digest (dk_session_t * ses_in, long len, xenc_key_t * key, caddr_t * sign_out);
+int dsig_rsa_sha256_verify (dk_session_t * ses_in, long len, xenc_key_t * key, caddr_t digest);
 int dsig_sha256_digest (dk_session_t * ses_in, long len, caddr_t * digest_out);
 int dsig_hmac_sha256_digest (dk_session_t * ses_in, long len, xenc_key_t * key, caddr_t * sign_out);
 int dsig_dh_sha256_digest (dk_session_t * ses_in, long len, xenc_key_t * key, caddr_t * sign_out);
diff --git a/libsrc/Wi/xmllazy.c b/libsrc/Wi/xmllazy.c
old mode 100755
new mode 100644
index 65344c6..a624c67
--- a/libsrc/Wi/xmllazy.c
+++ b/libsrc/Wi/xmllazy.c
@@ -1,7 +1,7 @@
 /*
  *  xmllazy.c
  *
- *  $Id: xmllazy.c,v 1.3 2009/04/09 13:22:15 source Exp $
+ *  $Id: xmllazy.c,v 1.3.2.2 2010/10/06 09:35:04 source Exp $
  *
  *  A stub XML entity that is a container for data of lazy loader of XML trees
  *
@@ -132,6 +132,7 @@ loaded_xe_is_ready:
       memcpy (xlazye->xe_doc.xd, loaded_doc, sizeof (xper_doc_t));
       dk_free (loaded_doc, sizeof (xper_doc_t));
     }
+  xlazye->xe_doc.xd->xd_top_doc = xlazye->xe_doc.xd;
   loaded_xe->xe_doc.xd = xlazye->xe_doc.xd;
   while (NULL != all_lazy_entities)
     {
@@ -210,6 +211,10 @@ DBG_NAME(xlazye_string_value) (DBG_PARAMS xml_entity_t * xe, caddr_t * ret, dtp_
 { xlazye_make_actual_load (xe); xe->_->DBG_NAME(xe_string_value)(DBG_ARGS xe, ret, dtp); }
 
 int
+xlazye_string_value_is_nonempty (xml_entity_t * xe)
+{ xlazye_make_actual_load (xe); return xe->_->xe_string_value_is_nonempty (xe); }
+
+int
 xlazye_up (xml_entity_t * xe, XT * node, int up_flags)
 { xlazye_make_actual_load (xe); return xe->_->xe_up (xe, node, up_flags); }
 
@@ -365,6 +370,7 @@ xml_lazy_init (void)
   xec_lazy_xe.xe_attribute = xlazye_attribute;
   xec_lazy_xe.xe_string_value = (void (*) (xml_entity_t * xe, caddr_t * ret, dtp_t dtp)) xlazye_string_value;
 #endif
+  xec_lazy_xe.xe_string_value_is_nonempty = xlazye_string_value_is_nonempty;
   xec_lazy_xe.xe_first_child = xlazye_first_child;
   xec_lazy_xe.xe_last_child = xlazye_last_child;
   xec_lazy_xe.xe_get_child_count_any = xlazye_get_child_count_any;
diff --git a/libsrc/Wi/xmlsql.c b/libsrc/Wi/xmlsql.c
index 6a2bcd1..da3ca2e 100644
--- a/libsrc/Wi/xmlsql.c
+++ b/libsrc/Wi/xmlsql.c
@@ -1,7 +1,7 @@
 /*
  *  xmlsql.c
  *
- *  $Id: xmlsql.c,v 1.18.2.2 2010/02/18 10:57:17 source Exp $
+ *  $Id: xmlsql.c,v 1.18.2.3 2011/03/29 10:53:31 source Exp $
  *
  *  Dynamic SQL Compiler, part 2
  *
@@ -4874,7 +4874,13 @@ xml_template_get_sqlx_parms (client_connection_t * cli, const caddr_t text, id_h
       if (place)
 	{
 	  ret [inx+named_params] = box_cast_to (NULL, *place, DV_TYPE_OF (*place), ssl->ssl_dtp,
-	      NUMERIC_MAX_PRECISION, NUMERIC_MAX_SCALE, NULL);
+	      NUMERIC_MAX_PRECISION, NUMERIC_MAX_SCALE, err);
+	  if (*err)
+	    {
+	      dk_free_tree (ret);
+	      ret = NULL;
+	      goto err_end;
+	    }
 	}
       else
 	ret [inx+named_params] = NEW_DB_NULL;
diff --git a/libsrc/Wi/xmltree.c b/libsrc/Wi/xmltree.c
index 03ebb73..2eb494a 100644
--- a/libsrc/Wi/xmltree.c
+++ b/libsrc/Wi/xmltree.c
@@ -1,7 +1,7 @@
 /*
  *  xmltree.c
  *
- *  $Id: xmltree.c,v 1.43.2.15 2010/03/01 01:03:04 source Exp $
+ *  $Id: xmltree.c,v 1.43.2.21 2011/01/18 10:31:48 source Exp $
  *
  *  XPATH interpreter
  *
@@ -69,7 +69,7 @@ struct xe_class_s xec_tree_xe;
 static void xte_destroy (xml_entity_t * xe);
 char * xte_output_method (xml_tree_ent_t * xte);
 int xte_ent_name_test (xml_entity_t * xe, XT * node);
-
+int xte_string_value_of_tree_is_nonempty (caddr_t *current);
 
 dk_mutex_t * xqr_mtx;
 
@@ -695,6 +695,32 @@ xqi_raw_value (xp_instance_t * xqi, XT * tree)
   GPF_T; return NULL;
 }
 
+int
+xqi_truth_value_of_box (caddr_t val)
+{
+  switch (DV_TYPE_OF (val))
+    {
+    case DV_STRING: case DV_UNAME: return (1 < box_length (val));
+    case DV_WIDE: return (sizeof (wchar_t) < box_length (val));
+    case DV_LONG_INT: return unbox (val);
+    case DV_DOUBLE_FLOAT: return (0 != unbox_double (val));
+    case DV_SINGLE_FLOAT: return (0 != unbox_float (val));
+    case DV_NUMERIC: return !num_is_zero ((numeric_t)val);
+    case DV_XML_ENTITY:
+      {
+        xml_entity_t *xe = (xml_entity_t *)val;
+        return xe->_->xe_string_value_is_nonempty (xe);
+      }
+    case DV_ARRAY_OF_XQVAL:
+      if (0 == box_length (val))
+        return 0;
+      return xqi_truth_value_of_box (((caddr_t *)val)[0]);
+    case DV_ARRAY_OF_POINTER:
+      return xte_string_value_of_tree_is_nonempty ((caddr_t *)val);
+    default: return 1;
+    }
+}
+
 
 int
 xqi_truth_value (xp_instance_t * xqi, XT * tree)
@@ -720,8 +746,13 @@ xqi_truth_value (xp_instance_t * xqi, XT * tree)
       val = xqi_raw_value (xqi, tree);
       return (NULL != val);
     default:
+#if 1
+      val = xqi_raw_value (xqi, tree);
+      return xqi_truth_value_of_box (val);
+#else
       val = xqi_value (xqi, tree, DV_SHORT_STRING);
       return val && (box_length (val) > 1);
+#endif
     }
 }
 
@@ -5633,6 +5664,34 @@ DBG_NAME(xte_string_value) (DBG_PARAMS xml_tree_ent_t * xte, caddr_t * ret, dtp_
   DBG_NAME(xte_string_value_from_tree) (DBG_ARGS xte->xte_current, ret, dtp);
 }
 
+int
+xte_string_value_of_tree_is_nonempty (caddr_t *current)
+{
+  if (DV_ARRAY_OF_POINTER == DV_TYPE_OF (current))
+    {
+      int inx, len = BOX_ELEMENTS (current);
+      for (inx = 1; inx < len; inx++)
+        {
+          caddr_t child = current[inx];
+          if (DV_STRINGP (child))
+            {
+              if (1 < box_length (child))
+                return 1;
+            }
+          else if (xte_string_value_of_tree_is_nonempty ((caddr_t *)child))
+            return 1;
+        }
+      return 0;
+    }
+  return (1 < box_length (current));
+}
+
+
+int
+xte_string_value_is_nonempty (xml_tree_ent_t * xte)
+{
+  return xte_string_value_of_tree_is_nonempty (xte->xte_current);
+}
 
 #define XTE_IS_XSLT_OUTPUT(xte) \
   ((xte) && \
@@ -6520,7 +6579,6 @@ xte_word_range (xml_entity_t * xe, wpos_t * start, wpos_t * end)
   caddr_t * ent = xte->xte_current;
   xml_tree_doc_t * xtd = xte->xe_doc.xtd;
   xe_word_ranges_t *locals;
-  dbg_printf(("xte_word_range (%p)", (void *)xe));
   if (NULL == xtd->xtd_wrs)
     {
       char hider = '\0';
@@ -6537,7 +6595,12 @@ xte_word_range (xml_entity_t * xe, wpos_t * start, wpos_t * end)
       start[0] = locals->xewr_main_beg;
       end[0] = locals->xewr_main_end;
     }
-  dbg_printf(("=>(%lu,%lu)", (unsigned long)(start[0]), (unsigned long)(end[0])));
+  dbg_printf(("xte_word_range (%p:%s) => (%lu,%lu)\n",
+      (void *)xe,
+      ((DV_ARRAY_OF_POINTER == DV_TYPE_OF (ent)) ?
+        XTE_HEAD_NAME (XTE_HEAD (ent)) :
+        ((DV_STRING == DV_TYPE_OF (ent)) ? (caddr_t)ent : "<weird>") ),
+      (unsigned long)(start[0]), (unsigned long)(end[0]) ));
 }
 
 
@@ -7497,6 +7560,27 @@ bif_xml_tree_doc_encoding (caddr_t * qst, caddr_t * err_ret, state_slot_t ** arg
   return ret;
 }
 
+static caddr_t
+bif_xtree_doc_get_dtd (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  xml_entity_t * xe = bif_entity_arg (qst, args, 0, "xtree_doc_get_dtd");
+  long what = bif_long_arg (qst, args, 1, "xtree_doc_get_dtd");
+  xml_doc_t *xd = xe->xe_doc.xd;
+  caddr_t ret = NULL;
+  if (xd->xd_dtd)
+    {
+      switch (what)
+	{
+	  case 1:
+	      ret = xd->xd_dtd->ed_sysuri ? box_dv_short_string (xd->xd_dtd->ed_sysuri) : NULL;
+	      break;
+	  case 2:
+	      ret = xd->xd_dtd->ed_puburi ? box_dv_short_string (xd->xd_dtd->ed_puburi) : NULL;
+	      break;
+	}
+    }
+  return ret ? ret : NEW_DB_NULL;
+}
 
 int
 xe_destroy (caddr_t box)
@@ -9701,7 +9785,7 @@ again:
       return (ccaddr_t)((ptrlong)2);
     case DV_RDF:
       {
-        rdf_box_t *rb = (rdf_box_t *)rb;
+        rdf_box_t *rb = (rdf_box_t *)arg;
         if (RDF_BOX_DEFAULT_TYPE != rb->rb_type)
           {
             ccaddr_t res = rdf_type_twobyte_to_iri (rb->rb_type);
@@ -9811,6 +9895,47 @@ xe_compare_content (xml_entity_t *xe1, xml_entity_t *xe2, int compare_uris_and_d
   return (xte_subtrees_are_equal ((caddr_t *)(xte1->xte_current), (caddr_t *)(xte2->xte_current)) ? DVC_MATCH : DVC_NOORDER);
 }
 
+int32
+xml_ent_hash (caddr_t box)
+{
+  xml_entity_t *xe = (xml_entity_t *)box;
+  int32 chld_hash = 0;
+  if (XE_IS_TREE (xe))
+    chld_hash = (int32)(((xml_tree_ent_t *)(xe))->xte_stack_top->xteb_current);
+  else if (XE_IS_PERSISTENT (xe))
+    chld_hash = (int32)(((xper_entity_t *)(xe))->xper_pos);
+/* No need in "if (XE_IS_LAZY (xe))", because there's no position in not-yet-loaded doc */
+  return 17 * (ptrlong)(xe->_) +
+    13 * (ptrlong)(xe->xe_doc.xd) +
+    11 * (ptrlong)(xe->xe_nth_attr) +
+    9 * (ptrlong)(xe->xe_referer) +
+    chld_hash;
+}
+
+int
+xml_ent_hash_cmp (ccaddr_t a1, ccaddr_t a2)
+{
+  xml_entity_t *xe1 = (xml_entity_t *)a1;
+  xml_entity_t *xe2 = (xml_entity_t *)a2;
+  if (xe1->_ != xe2->_) return 0;
+  if (XE_IS_TREE (xe1))
+    {
+      if (((xml_tree_ent_t *)(xe1))->xte_stack_top->xteb_current != ((xml_tree_ent_t *)(xe2))->xte_stack_top->xteb_current)
+        return 0;
+    }
+  else if (XE_IS_PERSISTENT (xe1))
+    {
+      if (((xper_entity_t *)(xe1))->xper_pos != ((xper_entity_t *)(xe2))->xper_pos)
+        return 0;
+    }
+  if (xe1->xe_doc.xd != xe2->xe_doc.xd)
+    return 0;
+  if (xe1->xe_nth_attr != xe2->xe_nth_attr)
+    return 0;
+  if (xe1->xe_referer != xe2->xe_referer)
+    return 0;
+  return 1;
+}
 
 xml_ns_2dict_t *xml_global_ns_2dict = NULL;
 dk_mutex_t *xml_global_ns_2dict_mutex = NULL;
@@ -10113,236 +10238,13 @@ shuric_cache_t *xpath_eval_cache;
 
 caddr_t xmltype_class_name = NULL;
 
-caddr_t uname__bang_cdata_section_elements;
-caddr_t uname__bang_exclude_result_prefixes;
-caddr_t uname__bang_file;
-caddr_t uname__bang_location;
-caddr_t uname__bang_name;
-caddr_t uname__bang_ns;
-caddr_t uname__bang_uri;
-caddr_t uname__bang_use_attribute_sets;
-caddr_t uname__bang_xmlns;
-caddr_t uname__attr;
-caddr_t uname__comment;
-caddr_t uname__disable_output_escaping;
-caddr_t uname__root;
-caddr_t uname__pi;
-caddr_t uname__ref;
-caddr_t uname__srcfile;
-caddr_t uname__srcline;
-caddr_t uname__txt;
-caddr_t uname__xslt;
-caddr_t uname_lang;
-caddr_t uname_nil;
-caddr_t uname_nodeID_ns;
-caddr_t uname_rdf_ns_uri;
-caddr_t uname_rdf_ns_uri_Description;
-caddr_t uname_rdf_ns_uri_ID;
-caddr_t uname_rdf_ns_uri_RDF;
-caddr_t uname_rdf_ns_uri_Seq;
-caddr_t uname_rdf_ns_uri_Statement;
-caddr_t uname_rdf_ns_uri_XMLLiteral;
-caddr_t uname_rdf_ns_uri_about;
-caddr_t uname_rdf_ns_uri_first;
-caddr_t uname_rdf_ns_uri_li;
-caddr_t uname_rdf_ns_uri_nil;
-caddr_t uname_rdf_ns_uri_nodeID;
-caddr_t uname_rdf_ns_uri_object;
-caddr_t uname_rdf_ns_uri_predicate;
-caddr_t uname_rdf_ns_uri_resource;
-caddr_t uname_rdf_ns_uri_rest;
-caddr_t uname_rdf_ns_uri_subject;
-caddr_t uname_rdf_ns_uri_type;
-caddr_t uname_rdf_ns_uri_datatype;
-caddr_t uname_rdf_ns_uri_parseType;
-caddr_t uname_rdf_ns_uri_value;
-caddr_t uname_space;
-caddr_t uname_swap_reify_ns_uri;
-caddr_t uname_swap_reify_ns_uri_statement;
-caddr_t uname_virtrdf_ns_uri;
-caddr_t uname_virtrdf_ns_uri_DefaultQuadStorage;
-caddr_t uname_virtrdf_ns_uri_DefaultServiceStorage;
-caddr_t uname_virtrdf_ns_uri_PrivateGraphs;
-caddr_t uname_virtrdf_ns_uri_QuadMap;
-caddr_t uname_virtrdf_ns_uri_QuadMapFormat;
-caddr_t uname_virtrdf_ns_uri_QuadStorage;
-caddr_t uname_virtrdf_ns_uri_array_of_any;
-caddr_t uname_virtrdf_ns_uri_array_of_string;
-caddr_t uname_virtrdf_ns_uri_bitmask;
-caddr_t uname_virtrdf_ns_uri_isSpecialPredicate;
-caddr_t uname_virtrdf_ns_uri_isSubclassOf;
-caddr_t uname_virtrdf_ns_uri_loadAs;
-caddr_t uname_xhv_ns_uri;
-caddr_t uname_xhv_ns_uri_alternate;
-caddr_t uname_xhv_ns_uri_appendix;
-caddr_t uname_xhv_ns_uri_bookmark;
-caddr_t uname_xhv_ns_uri_chapter;
-caddr_t uname_xhv_ns_uri_cite;
-caddr_t uname_xhv_ns_uri_contents;
-caddr_t uname_xhv_ns_uri_copyright;
-caddr_t uname_xhv_ns_uri_first;
-caddr_t uname_xhv_ns_uri_glossary;
-caddr_t uname_xhv_ns_uri_help;
-caddr_t uname_xhv_ns_uri_icon;
-caddr_t uname_xhv_ns_uri_index;
-caddr_t uname_xhv_ns_uri_last;
-caddr_t uname_xhv_ns_uri_license;
-caddr_t uname_xhv_ns_uri_meta;
-caddr_t uname_xhv_ns_uri_next;
-caddr_t uname_xhv_ns_uri_p3pv1;
-caddr_t uname_xhv_ns_uri_prev;
-caddr_t uname_xhv_ns_uri_role;
-caddr_t uname_xhv_ns_uri_section;
-caddr_t uname_xhv_ns_uri_start;
-caddr_t uname_xhv_ns_uri_stylesheet;
-caddr_t uname_xhv_ns_uri_subsection;
-caddr_t uname_xhv_ns_uri_up;
-caddr_t uname_xml;
-caddr_t uname_xmlns;
-caddr_t uname_xml_colon_base;
-caddr_t uname_xml_colon_lang;
-caddr_t uname_xml_colon_space;
-caddr_t uname_xml_ns_uri;
-caddr_t uname_xml_ns_uri_colon_base;
-caddr_t uname_xml_ns_uri_colon_lang;
-caddr_t uname_xml_ns_uri_colon_space;
-caddr_t uname_xmlschema_ns_uri;
-caddr_t uname_xmlschema_ns_uri_hash;
-caddr_t uname_xmlschema_ns_uri_hash_any;
-caddr_t uname_xmlschema_ns_uri_hash_anyURI;
-caddr_t uname_xmlschema_ns_uri_hash_boolean;
-caddr_t uname_xmlschema_ns_uri_hash_bitmask;
-caddr_t uname_xmlschema_ns_uri_hash_date;
-caddr_t uname_xmlschema_ns_uri_hash_dateTime;
-caddr_t uname_xmlschema_ns_uri_hash_decimal;
-caddr_t uname_xmlschema_ns_uri_hash_double;
-caddr_t uname_xmlschema_ns_uri_hash_float;
-caddr_t uname_xmlschema_ns_uri_hash_integer;
-caddr_t uname_xmlschema_ns_uri_hash_string;
-caddr_t uname_xmlschema_ns_uri_hash_time;
-caddr_t unames_colon_number[20];
-
 bif_type_t bt_xml_entity = {NULL, DV_XML_ENTITY, 0, 0};
 
 void
 xml_tree_init (void)
 {
-  int ctr;
   macro_char_func *rt;
-#define UNAME_IT(var,txt) var = box_dv_uname_string (txt); box_dv_uname_make_immortal (var)
-  UNAME_IT(uname__bang_cdata_section_elements	, " !cdata-section-elements"	);
-  UNAME_IT(uname__bang_exclude_result_prefixes	, " !exclude_result_prefixes"	);
-  UNAME_IT(uname__bang_file			, " !file"			);
-  UNAME_IT(uname__bang_location			, " !location"			);
-  UNAME_IT(uname__bang_name			, " !name"			);
-  UNAME_IT(uname__bang_ns			, " !ns"			);
-  UNAME_IT(uname__bang_uri			, " !uri"			);
-  UNAME_IT(uname__bang_use_attribute_sets	, " !use-attribute-sets"	);
-  UNAME_IT(uname__bang_xmlns			, " !xmlns"			);
-  UNAME_IT(uname__attr				, " attr"			);
-  UNAME_IT(uname__comment			, " comment"			);
-  UNAME_IT(uname__disable_output_escaping	, " disable-output-escaping"	);
-  UNAME_IT(uname__root				, " root"			);
-  UNAME_IT(uname__pi				, " pi"				);
-  UNAME_IT(uname__ref				, " ref"			);
-  UNAME_IT(uname__srcfile			, " srcfile"			);
-  UNAME_IT(uname__srcline			, " srcline"			);
-  UNAME_IT(uname__txt				, " txt"			);
-  UNAME_IT(uname__xslt				, " xslt"			);
-  UNAME_IT(uname_lang				, "lang"			);
-  UNAME_IT(uname_nil				, "nil"				);
-  UNAME_IT(uname_nodeID_ns			, "nodeID://"			);
-  UNAME_IT(uname_rdf_ns_uri			, RDF_NS_URI			);
-  UNAME_IT(uname_rdf_ns_uri_Description		, RDF_NS_URI "Description"	);
-  UNAME_IT(uname_rdf_ns_uri_ID			, RDF_NS_URI "ID"		);
-  UNAME_IT(uname_rdf_ns_uri_RDF			, RDF_NS_URI "RDF"		);
-  UNAME_IT(uname_rdf_ns_uri_Seq			, RDF_NS_URI "Seq"		);
-  UNAME_IT(uname_rdf_ns_uri_Statement		, RDF_NS_URI "Statement"	);
-  UNAME_IT(uname_rdf_ns_uri_XMLLiteral		, RDF_NS_URI "XMLLiteral"	);
-  UNAME_IT(uname_rdf_ns_uri_about		, RDF_NS_URI "about"		);
-  UNAME_IT(uname_rdf_ns_uri_first		, RDF_NS_URI "first"		);
-  UNAME_IT(uname_rdf_ns_uri_li			, RDF_NS_URI "li"		);
-  UNAME_IT(uname_rdf_ns_uri_nil			, RDF_NS_URI "nil"		);
-  UNAME_IT(uname_rdf_ns_uri_nodeID		, RDF_NS_URI "nodeID"		);
-  UNAME_IT(uname_rdf_ns_uri_object		, RDF_NS_URI "object"		);
-  UNAME_IT(uname_rdf_ns_uri_predicate		, RDF_NS_URI "predicate"	);
-  UNAME_IT(uname_rdf_ns_uri_resource		, RDF_NS_URI "resource"		);
-  UNAME_IT(uname_rdf_ns_uri_subject		, RDF_NS_URI "subject"		);
-  UNAME_IT(uname_rdf_ns_uri_rest		, RDF_NS_URI "rest"		);
-  UNAME_IT(uname_rdf_ns_uri_type		, RDF_NS_URI "type"		);
-  UNAME_IT(uname_rdf_ns_uri_datatype		, RDF_NS_URI "datatype"		);
-  UNAME_IT(uname_rdf_ns_uri_parseType		, RDF_NS_URI "parseType"	);
-  UNAME_IT(uname_rdf_ns_uri_value		, RDF_NS_URI "value"		);
-  UNAME_IT(uname_space				, "space"			);
-  UNAME_IT(uname_swap_reify_ns_uri		, SWAP_REIFY_NS_URI		);
-  UNAME_IT(uname_swap_reify_ns_uri_statement	, SWAP_REIFY_NS_URI "#statement"	);
-  UNAME_IT(uname_virtrdf_ns_uri			, VIRTRDF_NS_URI		);
-  UNAME_IT(uname_virtrdf_ns_uri_DefaultQuadStorage	, VIRTRDF_NS_URI "DefaultQuadStorage"	);
-  UNAME_IT(uname_virtrdf_ns_uri_DefaultServiceStorage	, VIRTRDF_NS_URI "DefaultServiceStorage"	);
-  UNAME_IT(uname_virtrdf_ns_uri_PrivateGraphs	, VIRTRDF_NS_URI "PrivateGraphs"	);
-  UNAME_IT(uname_virtrdf_ns_uri_QuadMap		, VIRTRDF_NS_URI "QuadMap"	);
-  UNAME_IT(uname_virtrdf_ns_uri_QuadMapFormat	, VIRTRDF_NS_URI "QuadMapFormat"	);
-  UNAME_IT(uname_virtrdf_ns_uri_QuadStorage	, VIRTRDF_NS_URI "QuadStorage"	);
-  UNAME_IT(uname_virtrdf_ns_uri_array_of_any	, VIRTRDF_NS_URI "array-of-any"	);
-  UNAME_IT(uname_virtrdf_ns_uri_array_of_string	, VIRTRDF_NS_URI "array-of-string"	);
-  UNAME_IT(uname_virtrdf_ns_uri_bitmask		, VIRTRDF_NS_URI "bitmask"	);
-  UNAME_IT(uname_virtrdf_ns_uri_isSpecialPredicate	, VIRTRDF_NS_URI "isSpecialPredicate"	);
-  UNAME_IT(uname_virtrdf_ns_uri_isSubclassOf	, VIRTRDF_NS_URI "isSubclassOf"	);
-  UNAME_IT(uname_virtrdf_ns_uri_loadAs		, VIRTRDF_NS_URI "loadAs"	);
-  UNAME_IT(uname_xhv_ns_uri			, XHV_NS_URI			);
-  UNAME_IT(uname_xhv_ns_uri_alternate		, XHV_NS_URI "alternate"	);
-  UNAME_IT(uname_xhv_ns_uri_appendix		, XHV_NS_URI "appendix"		);
-  UNAME_IT(uname_xhv_ns_uri_bookmark		, XHV_NS_URI "bookmark"		);
-  UNAME_IT(uname_xhv_ns_uri_chapter		, XHV_NS_URI "chapter"		);
-  UNAME_IT(uname_xhv_ns_uri_cite		, XHV_NS_URI "cite"		);
-  UNAME_IT(uname_xhv_ns_uri_contents		, XHV_NS_URI "contents"		);
-  UNAME_IT(uname_xhv_ns_uri_copyright		, XHV_NS_URI "copyright"	);
-  UNAME_IT(uname_xhv_ns_uri_first		, XHV_NS_URI "first"		);
-  UNAME_IT(uname_xhv_ns_uri_glossary		, XHV_NS_URI "glossary"		);
-  UNAME_IT(uname_xhv_ns_uri_help		, XHV_NS_URI "help"		);
-  UNAME_IT(uname_xhv_ns_uri_icon		, XHV_NS_URI "icon"		);
-  UNAME_IT(uname_xhv_ns_uri_index		, XHV_NS_URI "index"		);
-  UNAME_IT(uname_xhv_ns_uri_last		, XHV_NS_URI "last"		);
-  UNAME_IT(uname_xhv_ns_uri_license		, XHV_NS_URI "license"		);
-  UNAME_IT(uname_xhv_ns_uri_meta		, XHV_NS_URI "meta"		);
-  UNAME_IT(uname_xhv_ns_uri_next		, XHV_NS_URI "next"		);
-  UNAME_IT(uname_xhv_ns_uri_p3pv1		, XHV_NS_URI "p3pv1"		);
-  UNAME_IT(uname_xhv_ns_uri_prev		, XHV_NS_URI "prev"		);
-  UNAME_IT(uname_xhv_ns_uri_role		, XHV_NS_URI "role"		);
-  UNAME_IT(uname_xhv_ns_uri_section		, XHV_NS_URI "section"		);
-  UNAME_IT(uname_xhv_ns_uri_start		, XHV_NS_URI "start"		);
-  UNAME_IT(uname_xhv_ns_uri_stylesheet		, XHV_NS_URI "stylesheet"	);
-  UNAME_IT(uname_xhv_ns_uri_subsection		, XHV_NS_URI "subsection"	);
-  UNAME_IT(uname_xhv_ns_uri_up			, XHV_NS_URI "up"		);
-  UNAME_IT(uname_xml				, "xml"				);
-  UNAME_IT(uname_xmlns				, "xmlns"			);
-  UNAME_IT(uname_xml_colon_base			, "xml:base"			);
-  UNAME_IT(uname_xml_colon_lang			, "xml:lang"			);
-  UNAME_IT(uname_xml_colon_space		, "xml:space"			);
-  UNAME_IT(uname_xml_ns_uri			, XML_NS_URI			);
-  UNAME_IT(uname_xml_ns_uri_colon_base		, XML_NS_URI ":base"		);
-  UNAME_IT(uname_xml_ns_uri_colon_lang		, XML_NS_URI ":lang"		);
-  UNAME_IT(uname_xml_ns_uri_colon_space		, XML_NS_URI ":space"		);
-  UNAME_IT(uname_xmlschema_ns_uri		, XMLSCHEMA_NS_URI		);
-  UNAME_IT(uname_xmlschema_ns_uri_hash		, XMLSCHEMA_NS_URI "#"		);
-  UNAME_IT(uname_xmlschema_ns_uri_hash_any	, XMLSCHEMA_NS_URI "#any"	);
-  UNAME_IT(uname_xmlschema_ns_uri_hash_anyURI	, XMLSCHEMA_NS_URI "#anyURI"	);
-  UNAME_IT(uname_xmlschema_ns_uri_hash_boolean	, XMLSCHEMA_NS_URI "#boolean"	);
-  UNAME_IT(uname_xmlschema_ns_uri_hash_date	, XMLSCHEMA_NS_URI "#date"	);
-  UNAME_IT(uname_xmlschema_ns_uri_hash_dateTime	, XMLSCHEMA_NS_URI "#dateTime"	);
-  UNAME_IT(uname_xmlschema_ns_uri_hash_decimal	, XMLSCHEMA_NS_URI "#decimal"	);
-  UNAME_IT(uname_xmlschema_ns_uri_hash_double	, XMLSCHEMA_NS_URI "#double"	);
-  UNAME_IT(uname_xmlschema_ns_uri_hash_float	, XMLSCHEMA_NS_URI "#float"	);
-  UNAME_IT(uname_xmlschema_ns_uri_hash_integer	, XMLSCHEMA_NS_URI "#integer"	);
-  UNAME_IT(uname_xmlschema_ns_uri_hash_string	, XMLSCHEMA_NS_URI "#string"	);
-  UNAME_IT(uname_xmlschema_ns_uri_hash_time	, XMLSCHEMA_NS_URI "#time"	);
-  for (ctr = 0; ctr < (sizeof (unames_colon_number) / sizeof (caddr_t)); ctr++)
-    {
-      char tmp[15];
-      sprintf (tmp, ":%d", ctr);
-      UNAME_IT((unames_colon_number[ctr]), tmp);
-    }
-
+  dk_dtp_register_hash (DV_XML_ENTITY, xml_ent_hash, xml_ent_hash_cmp);
 #ifdef MALLOC_DEBUG
   xec_tree_xe.dbg_xe_copy = dbg_xte_copy;
   xec_tree_xe.dbg_xe_cut = dbg_xte_cut;
@@ -10356,6 +10258,7 @@ xml_tree_init (void)
   xec_tree_xe.xe_attribute = xte_attribute;
   xec_tree_xe.xe_string_value = (void (*) (xml_entity_t * xe, caddr_t * ret, dtp_t dtp)) xte_string_value;
 #endif
+  xec_tree_xe.xe_string_value_is_nonempty = (int (*) (xml_entity_t * xe)) xte_string_value_is_nonempty;
   xec_tree_xe.xe_first_child = xte_first_child;
   xec_tree_xe.xe_last_child = xte_last_child;
   xec_tree_xe.xe_get_child_count_any = xte_get_child_count_any;
@@ -10410,6 +10313,7 @@ xml_tree_init (void)
   bif_define ("xml_tree_doc_set_output", bif_xml_tree_doc_set_output);
   bif_define ("xml_tree_doc_set_ns_output", bif_xml_tree_doc_set_ns_output);
   bif_define ("xml_namespace_scope", bif_xml_namespace_scope);
+  bif_define ("xtree_doc_get_dtd", bif_xtree_doc_get_dtd);
   bif_define ("xpath_eval", bif_xpath_eval);
   bif_set_uses_index (bif_xpath_eval);
   bif_define ("xquery_eval", bif_xquery_eval);
diff --git a/libsrc/Wi/xmltree.h b/libsrc/Wi/xmltree.h
index 2b4d057..4315e5c 100644
--- a/libsrc/Wi/xmltree.h
+++ b/libsrc/Wi/xmltree.h
@@ -1,7 +1,7 @@
 /*
  *  xmltree.h
  *
- *  $Id: xmltree.h,v 1.27.2.10 2010/03/19 10:08:40 source Exp $
+ *  $Id: xmltree.h,v 1.27.2.13 2010/10/20 16:04:01 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -26,6 +26,7 @@
 #ifndef _XMLTREE_H
 #define _XMLTREE_H
 
+#include "uname_const_decl.h"
 #include "xpath.h"
 #ifdef __cplusplus
 extern "C" {
@@ -42,23 +43,6 @@ extern "C" {
 #endif
 */
 
-/*				 0         1         2         3        */
-/*				 01234567890123456789012345678901234567 */
-
-#define SWAP_REIFY_NS_URI	"http://www.w3.org/2000/10/swap/reify#"
-#define SWAP_REIFY_NS_URI_LEN	37
-
-/*				 0         1         2         3         4   */
-/*				 0123456789012345678901234567890123456789012 */
-#define VIRTRDF_NS_URI		"http://www.openlinksw.com/schemas/virtrdf#"
-#define VIRTRDF_NS_URI_LEN	42
-
-/*				 0         1         2         3      */
-/*				 012345678901234567890123456789012345 */
-#define XHV_NS_URI		"http://www.w3.org/1999/xhtml/vocab#"
-#define XHV_NS_URI_LEN		35
-
-
 #define MAX_XML_LNAME_LENGTH 500				/* for local names, namespace prefixes and namespace URIs */
 #define MAX_XML_QNAME_LENGTH (2*MAX_XML_LNAME_LENGTH + 1)	/* for qualified names (that have semicolons) */
 
@@ -128,6 +112,7 @@ according to section 5 'Data Model' of XML Path Language (XPath) Version 1.0 W3C
 according to section 5 'Data Model' of XML Path Language (XPath) Version 1.0 W3C Recommendation 16 November 1999 */
     void (* xe_string_value) (xml_entity_t * xe, caddr_t * ret, dtp_t dtp);
 #endif
+    int (* xe_string_value_is_nonempty) (xml_entity_t * xe);
 /*! Tries to go up to parent and maybe through entity reference(s). */
     int (* xe_up) (xml_entity_t * xe, XT * node, int up_flags);
 /*! Tries to go down through entity reference(s). If down, tries to find first child of the root. If not down, tests given node. */
@@ -643,6 +628,7 @@ typedef struct xp_node_s
   caddr_t *	xn_attrs;
   dk_set_t	 xn_children;
   caddr_t *	xn_namespaces;
+  long 		xn_n_children;
   struct xparse_ctx_s * xn_xp;
 } xp_node_t;
 
@@ -905,6 +891,7 @@ extern void xp_comment (vxml_parser_t * parser, const char *text);
     caddr_t text = strses_string ((xp)->xp_strses); \
     strses_flush ((xp)->xp_strses); \
     dk_set_push (&((xp)->xp_current->xn_children), (void*) text); \
+    (xp)->xp_current->xn_n_children++; \
   }
 
 #define XP_STRSES_FLUSH(xp) \
@@ -915,6 +902,8 @@ extern void xp_comment (vxml_parser_t * parser, const char *text);
         if (xp_strses_length & ~0xffffff) \
           sqlr_new_error ("42000", "SR596", "Unable to place abnormally long string into XML tree, %ld bytes is above 16Mb limit", (long)xp_strses_length); \
         XP_STRSES_FLUSH_NOCHECK(xp); \
+	if ((xp)->xp_current->xn_n_children >= MAX_BOX_ELEMENTS) \
+          sqlr_new_error ("42000", "SR596", "Unable to place abnormally long XML tree, %ld elements are above %ld limit", (long)(xp)->xp_current->xn_n_children, MAX_BOX_ELEMENTS); \
       } \
     } while (0)
 
@@ -958,6 +947,7 @@ extern xml_entity_t * xte_copy (xml_entity_t * xe);
 extern void xslt_init (void);
 
 extern int xqi_truth_value (xp_instance_t * xqi, XT * tree);
+extern int xqi_truth_value_of_box (caddr_t val);
 extern int xqi_pred_truth_value (xp_instance_t * xqi, XT * tree);
 extern xp_instance_t *xqr_instance (xp_query_t * xqr, query_instance_t * qi);
 extern void xn_error (xp_node_t * xn, const char * msg);
@@ -1017,116 +1007,6 @@ extern void xslt_instantiate (xparse_ctx_t * xp, xslt_template_t * xst, xml_enti
 
 extern caddr_t xml_get_ns_uri (client_connection_t *cli, caddr_t pref, ptrlong persistent, int ret_in_mp_box);
 
-extern caddr_t uname___empty;
-extern caddr_t uname__bang_cdata_section_elements;
-extern caddr_t uname__bang_exclude_result_prefixes;
-extern caddr_t uname__bang_file;
-extern caddr_t uname__bang_location;
-extern caddr_t uname__bang_name;
-extern caddr_t uname__bang_ns;
-extern caddr_t uname__bang_uri;
-extern caddr_t uname__bang_use_attribute_sets;
-extern caddr_t uname__bang_xmlns;
-extern caddr_t uname__attr;
-extern caddr_t uname__comment;
-extern caddr_t uname__disable_output_escaping;
-extern caddr_t uname__root;
-extern caddr_t uname__pi;
-extern caddr_t uname__ref;
-extern caddr_t uname__srcfile;
-extern caddr_t uname__srcline;
-extern caddr_t uname__txt;
-extern caddr_t uname__xslt;
-extern caddr_t uname_lang;
-extern caddr_t uname_nil;
-extern caddr_t uname_nodeID_ns;
-extern caddr_t uname_rdf_ns_uri;
-extern caddr_t uname_rdf_ns_uri_Description;
-extern caddr_t uname_rdf_ns_uri_ID;
-extern caddr_t uname_rdf_ns_uri_RDF;
-extern caddr_t uname_rdf_ns_uri_Seq;
-extern caddr_t uname_rdf_ns_uri_Statement;
-extern caddr_t uname_rdf_ns_uri_XMLLiteral;
-extern caddr_t uname_rdf_ns_uri_about;
-extern caddr_t uname_rdf_ns_uri_first;
-extern caddr_t uname_rdf_ns_uri_li;
-extern caddr_t uname_rdf_ns_uri_nil;
-extern caddr_t uname_rdf_ns_uri_nodeID;
-extern caddr_t uname_rdf_ns_uri_object;
-extern caddr_t uname_rdf_ns_uri_predicate;
-extern caddr_t uname_rdf_ns_uri_resource;
-extern caddr_t uname_rdf_ns_uri_rest;
-extern caddr_t uname_rdf_ns_uri_subject;
-extern caddr_t uname_rdf_ns_uri_type;
-extern caddr_t uname_rdf_ns_uri_datatype;
-extern caddr_t uname_rdf_ns_uri_parseType;
-extern caddr_t uname_rdf_ns_uri_value;
-extern caddr_t uname_space;
-extern caddr_t uname_swap_reify_ns_uri;
-extern caddr_t uname_swap_reify_ns_uri_statement;
-extern caddr_t uname_virtrdf_ns_uri;
-extern caddr_t uname_virtrdf_ns_uri_DefaultQuadStorage;
-extern caddr_t uname_virtrdf_ns_uri_DefaultServiceStorage;
-extern caddr_t uname_virtrdf_ns_uri_PrivateGraphs;
-extern caddr_t uname_virtrdf_ns_uri_QuadMap;
-extern caddr_t uname_virtrdf_ns_uri_QuadMapFormat;
-extern caddr_t uname_virtrdf_ns_uri_QuadStorage;
-extern caddr_t uname_virtrdf_ns_uri_array_of_any;
-extern caddr_t uname_virtrdf_ns_uri_array_of_string;
-extern caddr_t uname_virtrdf_ns_uri_bitmask;
-extern caddr_t uname_virtrdf_ns_uri_isSpecialPredicate;
-extern caddr_t uname_virtrdf_ns_uri_isSubclassOf;
-extern caddr_t uname_virtrdf_ns_uri_loadAs;
-extern caddr_t uname_xhv_ns_uri;
-extern caddr_t uname_xhv_ns_uri_alternate;
-extern caddr_t uname_xhv_ns_uri_appendix;
-extern caddr_t uname_xhv_ns_uri_bookmark;
-extern caddr_t uname_xhv_ns_uri_cite;
-extern caddr_t uname_xhv_ns_uri_chapter;
-extern caddr_t uname_xhv_ns_uri_contents;
-extern caddr_t uname_xhv_ns_uri_copyright;
-extern caddr_t uname_xhv_ns_uri_first;
-extern caddr_t uname_xhv_ns_uri_glossary;
-extern caddr_t uname_xhv_ns_uri_help;
-extern caddr_t uname_xhv_ns_uri_icon;
-extern caddr_t uname_xhv_ns_uri_index;
-extern caddr_t uname_xhv_ns_uri_last;
-extern caddr_t uname_xhv_ns_uri_license;
-extern caddr_t uname_xhv_ns_uri_meta;
-extern caddr_t uname_xhv_ns_uri_next;
-extern caddr_t uname_xhv_ns_uri_p3pv1;
-extern caddr_t uname_xhv_ns_uri_prev;
-extern caddr_t uname_xhv_ns_uri_role;
-extern caddr_t uname_xhv_ns_uri_section;
-extern caddr_t uname_xhv_ns_uri_stylesheet;
-extern caddr_t uname_xhv_ns_uri_subsection;
-extern caddr_t uname_xhv_ns_uri_start;
-extern caddr_t uname_xhv_ns_uri_up;
-extern caddr_t uname_xml;
-extern caddr_t uname_xmlns;
-extern caddr_t uname_xml_colon_base;
-extern caddr_t uname_xml_colon_lang;
-extern caddr_t uname_xml_colon_space;
-extern caddr_t uname_xml_ns_uri;
-extern caddr_t uname_xml_ns_uri_colon_base;
-extern caddr_t uname_xml_ns_uri_colon_lang;
-extern caddr_t uname_xml_ns_uri_colon_space;
-extern caddr_t uname_xmlschema_ns_uri;
-extern caddr_t uname_xmlschema_ns_uri_hash;
-extern caddr_t uname_xmlschema_ns_uri_hash_any;
-extern caddr_t uname_xmlschema_ns_uri_hash_anyURI;
-extern caddr_t uname_xmlschema_ns_uri_hash_boolean;
-extern caddr_t uname_xmlschema_ns_uri_hash_date;
-extern caddr_t uname_xmlschema_ns_uri_hash_dateTime;
-extern caddr_t uname_xmlschema_ns_uri_hash_decimal;
-extern caddr_t uname_xmlschema_ns_uri_hash_double;
-extern caddr_t uname_xmlschema_ns_uri_hash_float;
-extern caddr_t uname_xmlschema_ns_uri_hash_integer;
-extern caddr_t uname_xmlschema_ns_uri_hash_string;
-extern caddr_t uname_xmlschema_ns_uri_hash_time;
-extern caddr_t unames_colon_number[20];
-
-
 extern void DBG_NAME(xte_string_value_from_tree) (DBG_PARAMS caddr_t * current, caddr_t * ret, dtp_t dtp);
 #ifdef MALLOC_DEBUG
 #define xte_string_value_from_tree(C,RET,DTP) dbg_xte_string_value_from_tree (__FILE__,__LINE__,(C),(RET),(DTP))
diff --git a/libsrc/Wi/xpath.c b/libsrc/Wi/xpath.c
index c62dc83..1d77ed8 100644
--- a/libsrc/Wi/xpath.c
+++ b/libsrc/Wi/xpath.c
@@ -1,7 +1,7 @@
 /*
  *  xpath.c
  *
- *  $Id: xpath.c,v 1.15.2.10 2010/02/18 10:57:17 source Exp $
+ *  $Id: xpath.c,v 1.15.2.13 2011/01/28 13:28:03 source Exp $
  *
  *  XPATH to SQL
  *
@@ -2327,6 +2327,8 @@ xv_label_tree (xpp_t *xpp, xv_join_elt_t * start, XT * tree, dk_set_t * paths)
 	    END_DO_SET();
 	    if (!next)
 	      dk_free_tree ((caddr_t) path);
+            else
+              dk_set_free (next);
 	  }
 	END_DO_SET();
 	dk_set_free (*paths);
@@ -2726,7 +2728,7 @@ static int charref_to_unichar (const char **src_tail_ptr, const char *src_end, c
     {
       if ('=' == src_tail[0])
 	break;
-      if (!isalnum (src_tail[0]) && !(src_tail[0] & 0x80) && (NULL == strchr ("-_%+", src_tail[0])))
+      if (!isalnum ((unsigned char) (src_tail[0])) && !(src_tail[0] & 0x80) && (NULL == strchr ("-_%+", src_tail[0])))
         {
           err_msg_ret[0] = "Syntax error in &...; character reference";
 	  return -1;
@@ -4860,6 +4862,54 @@ shuric_t *xqr_shuric_retrieve (query_instance_t *qi, caddr_t uri, caddr_t *err_r
   return res;
 }
 
+xp_query_t *
+xqr_stub_for_funcall (xpf_metadata_t *metas, int argcount)
+{
+  int argctr;
+  xp_env_t l_xe;
+  xpp_t l_xpp;
+  xp_query_t *xqr = (xp_query_t *) dk_alloc_box_zero (sizeof (xp_query_t), DV_XPATH_QUERY);
+  int n_slots, fill = 0;
+  ptrlong *map;
+  XT **arg_array = dk_alloc_box (argcount * sizeof (XT *), DV_ARRAY_OF_POINTER);
+  XT *var = NULL;
+  memset (&l_xe, 0, sizeof (xp_env_t));
+  memset (&l_xpp, 0, sizeof (xpp_t));
+  l_xpp.xpp_xp_env = &l_xe;
+  l_xe.xe_xqr = xqr;
+  l_xe.xe_xqst_ctr = (sizeof (xp_instance_t) / sizeof (caddr_t)) + 1;
+  l_xe.xe_for_interp = 1;
+  if (XPDV_NODESET == metas->xpfm_res_dtp)
+    var = xp_make_variable_ref (&l_xpp, "result of funcall");
+  for (argctr = argcount; argctr--; /* no step */)
+    {
+      char buf[20]; sprintf (buf, "arg%d", argctr);
+      arg_array[argctr] = xp_make_variable_ref (&l_xpp, buf);
+      arg_array[argctr]->type = XP_FAKE_VAR;
+    }
+  xqr->xqr_tree = xtlist_with_tail (&l_xpp, 8, (caddr_t)arg_array, CALL_STMT,
+    box_dv_uname_string (metas->xpfm_name),
+    box_num((ptrlong)(metas->xpfm_executable)),
+    (ptrlong)(metas->xpfm_res_dtp),
+    xe_new_xqst (&l_xpp, XQST_REF),
+    xe_new_xqst (&l_xpp, XQST_REF),
+    var );
+  xqr->xqr_instance_length = sizeof (caddr_t) * l_xe.xe_xqst_ctr;
+
+  n_slots = dk_set_length (xqr->xqr_state_map);
+  map = (ptrlong *) dk_alloc_box (sizeof (ptrlong) * n_slots, DV_SHORT_STRING);
+  DO_SET (ptrlong, pos, &xqr->xqr_state_map)
+    {
+      map[fill++] = (pos);
+    }
+  END_DO_SET();
+  xqr->xqr_slots = map;
+  xqr->xqr_n_slots = n_slots;
+  xqr->xqr_base_uri = uname___empty;
+  return xqr;
+}
+
+
 xp_query_t *xp_query_parse (query_instance_t * qi, char * str, ptrlong predicate_type, caddr_t * err_ret, xp_query_env_t *xqre)
 {
   if (NULL == str)
@@ -5240,7 +5290,6 @@ fine:
 caddr_t
 sqlr_make_new_error_xdl_base (const char *code, const char *virt_code, xp_debug_location_t *xdl, const char *string, va_list vlst)
 {
-  du_thread_t *self;
   char temp[2000];
   int n;
   caddr_t err;
@@ -5282,6 +5331,16 @@ sqlr_new_error_xdl (const char *code, const char *virt_code, xp_debug_location_t
   va_end (vlst);
 }
 
+caddr_t
+sqlr_make_new_error_xqi_xdl (const char *code, const char *virt_code, xp_instance_t * xqi, const char *string, ...)
+{
+  caddr_t err;
+  va_list vlst;
+  va_start (vlst, string);
+  err = sqlr_make_new_error_xdl_base (code, virt_code, &(xqi->xqi_xqr->xqr_xdl), string, vlst);
+  va_end (vlst);
+  return err;
+}
 
 void
 sqlr_new_error_xqi_xdl (const char *code, const char *virt_code, xp_instance_t * xqi, const char *string, ...)
diff --git a/libsrc/Wi/xpath.h b/libsrc/Wi/xpath.h
index 3a54214..0a7e3ba 100644
--- a/libsrc/Wi/xpath.h
+++ b/libsrc/Wi/xpath.h
@@ -1,7 +1,7 @@
 /*
  *  xpath.h
  *
- *  $Id: xpath.h,v 1.5.2.3 2009/10/26 20:46:46 source Exp $
+ *  $Id: xpath.h,v 1.5.2.5 2011/01/28 13:28:03 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -89,6 +89,7 @@ extern "C" {
 #define XP_STAR		(ptrlong) 1106	/*!< This is a wildcard for part of name, not a node test */
 #define XP_ELT		(ptrlong) 1107	/*!< This is a node test for any element but not a wildcard for part of name */
 #define XP_ELT_OR_ROOT	(ptrlong) 1108
+#define XP_FAKE_VAR	(ptrlong) 1109
 
 /*
 #define XP_HTTP		(ptrlong) 1200
@@ -521,6 +522,12 @@ extern void sqlr_new_error_xdl (const char *code, const char *virt_code, xp_debu
                 __attribute__ ((format (printf, 4, 5)))
 #endif
 ;
+extern caddr_t 
+sqlr_make_new_error_xqi_xdl (const char *code, const char *virt_code, xp_instance_t * xqi, const char *string, ...)
+#ifdef __GNUC__
+                __attribute__ ((format (printf, 4, 5)))
+#endif
+;
 extern void sqlr_new_error_xqi_xdl (const char *code, const char *virt_code, xp_instance_t * xqi, const char *string, ...)
 #ifdef __GNUC__
                 __attribute__ ((format (printf, 4, 5)))
diff --git a/libsrc/Wi/xpf.c b/libsrc/Wi/xpf.c
index 26cf88a..90fd994 100644
--- a/libsrc/Wi/xpf.c
+++ b/libsrc/Wi/xpf.c
@@ -1,7 +1,7 @@
 /*
  *  xpf.c
  *
- *  $Id: xpf.c,v 1.11.2.2 2010/02/10 16:03:28 source Exp $
+ *  $Id: xpf.c,v 1.11.2.3 2010/10/06 09:35:05 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -32,9 +32,11 @@
 #include "xpathp_impl.h"
 #include "xml_ecm.h"
 #include "bif_text.h"
+#include "rdf_core.h"
 #include "security.h" /* for sec_proc_check () */
 #include "sqltype.h" /* for XMLTYPE_TO_ENTITY */
 #include "srvstat.h"
+#include "shcompo.h"
 
 #include "xqf.h"
 
@@ -5126,6 +5128,193 @@ void xpf_filter (xp_instance_t * xqi, XT * tree, xml_entity_t * ctx_xe)
   xpf_create_filter_sequence( xqi, tree, ctx_xe, (int) nodes_length);
 }
 
+void xpf_sql_column_select (xp_instance_t * xqi, XT * tree, xml_entity_t * ctx_xe)
+{
+  sqlr_new_error_xqi_xdl ("XP001", "XPF14", xqi, "The special XQuery function sql_column_select() is used outside 'for ... in ...' statement.");
+}
+
+void xpf_sql_scalar_select (xp_instance_t * xqi, XT * tree, xml_entity_t * ctx_xe)
+{
+  int query_is_sparql = 0;
+  caddr_t query_raw_text, query_text, query_final_text;
+  int proc_parent_is_saved = 0;
+  query_instance_t *qi = xqi->xqi_qi;
+  client_connection_t *cli = qi->qi_client;
+  shcompo_t *query_shc = NULL;
+  query_t *qr = NULL;
+  caddr_t err = NULL;
+  dk_set_t warnings = NULL;
+  caddr_t *params = NULL;
+  int param_ofs;
+  stmt_compilation_t *comp = NULL, *proc_comp = NULL;
+  dk_set_t proc_resultset = NULL;
+  local_cursor_t *lc = NULL;
+  int cols_count;
+  PROC_SAVE_VARS;
+  query_raw_text = query_text = xpf_arg (xqi, tree, ctx_xe, DV_C_STRING, 0);
+  if (DV_STRING != DV_TYPE_OF (query_text))
+    {
+      if (DV_XML_ENTITY == DV_TYPE_OF (query_text))
+        {
+          xml_entity_t *xe = (xml_entity_t *)query_text;
+          caddr_t sval = NULL;
+          xe->_->xe_string_value (xe, &sval, DV_STRING);
+          query_text = sval;
+        }
+      else
+        sqlr_new_error_xqi_xdl ("XS370", "XPFXX", xqi, "sparql or sql query should be a string");
+    }
+  if (query_is_sparql)
+    {
+      caddr_t preamble = NULL;
+      caddr_t preamble_to_free = NULL;
+      xqi_binding_t *xb;
+      static caddr_t sparql_preamble_global_var_name = NULL;
+      if (NULL == sparql_preamble_global_var_name)
+        sparql_preamble_global_var_name = box_dv_uname_string ("__sparql_preamble");
+      for (xb = xqi->xqi_xp_globals; NULL != xb; xb = xb->xb_next)
+        {
+          if (!xb->xb_name)
+            break;
+          if (xb->xb_name == sparql_preamble_global_var_name)
+            preamble = xb->xb_value;
+        }
+      if (NULL == preamble)
+        {
+          dk_session_t *tmp_ses = strses_allocate ();
+          /*xml_ns_2dict_t *ns2d = &(xqi->xp->xp_sheet->xsh_ns_2dict);
+          int ns_ctr = ns2d->xn2_size;*/
+          SES_PRINT (tmp_ses, "sparql define output:valmode \"AUTO\" define sql:globals-mode \"XSLT\" ");
+          /*while (ns_ctr--)
+            {
+              SES_PRINT (tmp_ses, "prefix ");
+              SES_PRINT (tmp_ses, ns2d->xn2_prefix2uri[ns_ctr].xna_key);
+              SES_PRINT (tmp_ses, ": <");
+              SES_PRINT (tmp_ses, ns2d->xn2_prefix2uri[ns_ctr].xna_value);
+              SES_PRINT (tmp_ses, "> ");
+            }*/
+          preamble = preamble_to_free = strses_string (tmp_ses);
+          dk_free_box (tmp_ses);
+        }
+      query_final_text = box_dv_short_strconcat (preamble, query_text);
+      if (query_text != query_raw_text)
+        dk_free_box (query_text);
+      dk_free_tree (preamble_to_free);
+    }
+  else
+    query_final_text = (query_text != query_raw_text) ? query_text : box_copy (query_text);
+  PROC_SAVE_PARENT;
+  proc_parent_is_saved = 1;
+  warnings = sql_warnings_save (NULL);
+  cli->cli_resultset_max_rows = -1;
+  cli->cli_resultset_comp_ptr = (caddr_t *) &proc_comp;
+  cli->cli_resultset_data_ptr = &proc_resultset;
+  query_shc = shcompo_get_or_compile (&shcompo_vtable__qr, list (3, query_final_text, qi->qi_u_id, qi->qi_g_id), 0, qi, NULL, &err);
+  if (NULL == err)
+    {
+      shcompo_recompile_if_needed (&query_shc);
+      if (NULL != query_shc->shcompo_error)
+        err = box_copy_tree (query_shc->shcompo_error);
+    }
+  if (NULL != err)
+    goto err_generated;
+  qr = (query_t *)(query_shc->shcompo_data);
+  params = (caddr_t *)dk_alloc_box_zero (dk_set_length (qr->qr_parms) * 2 * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
+  XQI_SET (xqi, tree->_.xp_func.tmp, (caddr_t)params);
+  param_ofs = 0;
+  DO_SET (state_slot_t *, ssl, &qr->qr_parms)
+    {
+      char *name = ssl->ssl_name;
+      caddr_t val;
+      xqi_binding_t *xb;
+      if ((NULL == name) || (':' != name[0]) || alldigits (name+1))
+        {
+          err = sqlr_make_new_error_xqi_xdl ("XS370", "XP???", xqi, "%s parameter of the query can not be bound, only named parameters can be associated with XPATH/XSLT variables of the context", ((NULL!=name) ? name : "anonymous"));
+          goto err_generated; /* see below */
+        }
+      xb = xqi_find_binding (xqi, box_dv_uname_string (name+1));
+      if (NULL == xb)
+        {
+          err = sqlr_make_new_error_xqi_xdl ("XS370", "XP???", xqi, "%s%.100s parameter of the query can not be bound, there's no corresponding XSLT variable $%.100s",
+            query_is_sparql ? "$" : "", name, name+1 );
+          goto err_generated; /* see below */
+        }
+      params[param_ofs++] = box_copy (name);
+      val = xb->xb_value;
+      if (NULL == val)
+        val = NEW_DB_NULL;
+      else if (DV_ARRAY_OF_XQVAL == DV_TYPE_OF (val))
+        {
+          if (0 == BOX_ELEMENTS (val))
+            val = NEW_DB_NULL;
+          else
+            val = box_copy_tree (((caddr_t **)val)[0]);
+        }
+      else
+        val = box_copy_tree (val);
+      params[param_ofs++] = val;
+    }
+  END_DO_SET ()
+  err = qr_exec (cli, qr, qi, NULL, NULL, &lc,
+      params, NULL, 1);
+  memset (params, 0, param_ofs * sizeof (caddr_t));
+  XQI_SET (xqi, tree->_.xp_func.tmp, NULL);
+  params = NULL;
+  if (err)
+    goto err_generated; /* see below */
+  if ((NULL == lc) || !(qr->qr_select_node))
+    {
+      err = sqlr_make_new_error_xqi_xdl ("XS370", "XP???", xqi, "An SQL statement did not produce any (even empty) result-set");
+      goto err_generated; /* see below */
+    }
+  PROC_RESTORE_SAVED;
+  proc_parent_is_saved = 0;
+  if (proc_comp)
+    {
+      dk_free_tree ((caddr_t) proc_comp);
+      proc_comp = NULL;
+    }
+  if (proc_resultset)
+    {
+      dk_free_tree (list_to_array (proc_resultset));
+      proc_resultset = NULL;
+    }
+  comp = qr_describe (qr, NULL);
+  cols_count = BOX_ELEMENTS (comp->sc_columns);
+  if (1 != cols_count)
+    {
+      err = sqlr_make_new_error_xqi_xdl ("XS370", "XP???", xqi, "A scalar SQL statement should produce a result-set with only one column");
+      goto err_generated; /* see below */
+    }
+  if (lc_next (lc))
+    {
+      caddr_t new_val = lc_nth_col (lc, 0);
+      rb_cast_to_xpath_safe (qi, new_val, XQI_ADDRESS(xqi, tree->_.xp_func.res));
+    }
+  else if (1 < tree->_.xp_func.argcount)
+    XQI_SET (xqi, tree->_.xp_func.res, box_copy_tree (xpf_arg (xqi, tree, ctx_xe, DV_UNKNOWN, 1)));
+  else
+    XQI_SET (xqi, tree->_.xp_func.res, NULL);
+  err = lc->lc_error;
+  lc->lc_error = NULL;
+  lc_free (lc);
+  if (err)
+    goto err_generated; /* see below */
+
+  dk_free_tree (list_to_array (sql_warnings_save (warnings)));
+  return;
+err_generated:
+  if (lc)
+    lc_free (lc);
+  if (params)
+    XQI_SET (xqi, tree->_.xp_func.tmp, NULL);
+  if (NULL != query_shc)
+    shcompo_release (query_shc);
+  if (proc_parent_is_saved)
+    PROC_RESTORE_SAVED;
+  sqlr_resignal (err);
+
+}
 
 void xpf_xmlview (xp_instance_t * xqi, XT * tree, xml_entity_t * ctx_xe)
 {
@@ -5669,6 +5858,8 @@ void xpf_init(void)
   xpf_define_builtin ("round-half-to-even"	, xpf_round_half_to_even	/* XPath 2.0 */	, DV_NUMERIC	, 1	, xpfmalist(1, xpfma("num",DV_UNKNOWN,0))	, NULL	);
   xpf_define_builtin ("round-number"		, xpf_round_number		/* XPath 1.0 */	, DV_NUMERIC	, 1	, xpfmalist(1, xpfma("num",DV_UNKNOWN,0))	, NULL	);
   xpf_define_alias   ("round" , NULL, "round-number", NULL);
+  xpf_define_builtin ("sql-column-select"	, xpf_sql_column_select		/* Virt 6.2 */	, XPDV_NODESET	, 1	, NULL	, xpfmalist(1, xpfma(NULL,DV_UNKNOWN,0)));
+  xpf_define_builtin ("sql-scalar-select"	, xpf_sql_scalar_select		/* Virt 6.2 */	, DV_UNKNOWN	, 1	, NULL	, xpfmalist(1, xpfma(NULL,DV_UNKNOWN,0)));
   xpf_define_builtin ("serialize"		, xpf_serialize			/* Virt 3.0 */	, DV_STRING	, 0	, NULL	, xpfmalist(1, xpfma(NULL,DV_UNKNOWN,0)));
   xpf_define_builtin ("shallow"			, xpf_shallow			/* XQuery 1.0 */ , XPDV_NODESET , 1	, xpfmalist(1, xpfma(NULL,DV_XML_ENTITY,0))	, NULL);
   xpf_define_builtin ("some"			, xpf_some			/* Virt 3.0 */	, XPDV_BOOL	, 0	, NULL	, xpfmalist(1, xpfma(NULL,DV_UNKNOWN,0)));
diff --git a/libsrc/Wi/xpscn.c b/libsrc/Wi/xpscn.c
index d2340d8..1d3ee26 100644
--- a/libsrc/Wi/xpscn.c
+++ b/libsrc/Wi/xpscn.c
@@ -3623,7 +3623,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( xpyytext, xpyyleng, 1, xpyyout )
+#define ECHO do { if (fwrite( xpyytext, xpyyleng, 1, xpyyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
diff --git a/libsrc/Wi/xqf.c b/libsrc/Wi/xqf.c
index dbf0954..a46ac37 100644
--- a/libsrc/Wi/xqf.c
+++ b/libsrc/Wi/xqf.c
@@ -1,7 +1,7 @@
 /*
  *  xqf.c
  *
- *  $Id: xqf.c,v 1.21.2.5 2010/04/12 07:28:35 source Exp $
+ *  $Id: xqf.c,v 1.21.2.9 2011/03/03 11:56:45 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -154,6 +154,19 @@ __boolean_from_string (caddr_t *n, const char *str, int do_what)
 }
 
 
+static int
+__boolean_rcheck (caddr_t *n, int do_what)
+{
+  boxint old_val = unbox (n[0]);
+  if ((0 != old_val) && (1 != old_val))
+    {
+      dk_free_tree (n[0]);
+      n[0] = box_num (old_val ? 1 : 0);
+    }
+  return 1;
+}
+
+
 static void
 __numeric_from_string (caddr_t *n, const char *str, int do_what)
 {
@@ -287,6 +300,49 @@ __integer_from_string (caddr_t *n, const char *str, int do_what)
   };
 }
 
+static int
+__integer_rcheck (caddr_t *n, int do_what)
+{
+  static int bits[]     = {7, 15, 31, 63, 8, 16, 32, 64};
+  static int issigned[] = {1, 1, 1, 1, 0, 0, 0, 0};
+  boxint val;
+  int64 v64;
+  assert (do_what >= 0 && do_what < COUNTOF__XQ_INT_TYPE);
+  if (DV_NUMERIC == DV_TYPE_OF (n[0]))
+    {
+      numeric_t num = (numeric_t)(n[0]);
+      switch (do_what)
+        {
+        case XQ_UINT8: case XQ_UINT16: case XQ_UINT32: case XQ_UINT64:
+          if (num->n_neg) return 0;
+          break;
+        case XQ_NNINT:
+          return !(num->n_neg);
+        case XQ_NINT:
+          return num->n_neg;
+        case XQ_NPINT:
+          return (num->n_neg || num_is_zero(num));
+        case XQ_PINT:
+          return !(num->n_neg || num_is_zero(num));
+        }
+      if (!numeric_to_int64 (num, &v64))
+        return 0;
+      val = v64;
+    }
+  else
+    val = unbox (n[0]);
+  if (val < 0)
+    {
+      if (!issigned[do_what])
+        return 0;
+      val = 1 - val;
+    }
+  if (val >> bits[do_what])
+    return 0;
+  return 1;
+}
+
+
 static void
 xqf_byte (xp_instance_t * xqi, XT * tree, xml_entity_t * ctx_xe)
 {
@@ -548,6 +604,35 @@ __datetime_from_string (caddr_t *n, const char *str, int do_what)
   sqlr_resignal (err);
 }
 
+static int
+__datetime_rcheck (caddr_t *n, int do_what)
+{
+  caddr_t dt = n[0];
+  int dttype = DT_DT_TYPE (dt);
+  switch (do_what)
+    {
+    case XQ_DATETIME: return (DT_TYPE_DATETIME == dttype);
+    case XQ_DATE: if (DT_TYPE_TIME == dttype) return 0; break;
+    case XQ_TIME: if (DT_TYPE_DATE == dttype) return 0; break;
+    case XQ_YEARMONTH: case XQ_YEAR: case XQ_MONTHDAY: case XQ_MONTH: case XQ_DAY: if (DT_TYPE_TIME == dttype) return 0;
+    }
+  if (DT_TYPE_DATETIME == dttype)
+    {
+      if (XQ_TIME == do_what)
+        {
+          DT_SET_DAY (dt, DAY_ZERO);
+          DT_SET_FRACTION (dt, 0);
+          DT_SET_DT_TYPE (dt, DT_TYPE_TIME);
+        }
+      else
+        {
+          dt_date_round (dt);
+          DT_SET_DT_TYPE (dt, DT_TYPE_DATE);
+        }
+    }
+  return 1;
+}
+
 static void
 xqf_datetime (xp_instance_t * xqi, XT * tree, xml_entity_t * ctx_xe)
 {
@@ -621,7 +706,7 @@ xqf_currentDateTime (xp_instance_t * xqi, XT * tree, xml_entity_t * ctx_xe)
 static void
 __string_from_string (caddr_t *n, const char *str, int do_what, const char *where )
 {
-  dk_session_t *ses = strses_allocate ();
+  dk_session_t *ses = NULL;
   const char *p, *pp, *ppp;
   int val;
   char c;
@@ -631,6 +716,8 @@ __string_from_string (caddr_t *n, const char *str, int do_what, const char *wher
       pp = strchr(p, '&');
       if (NULL != pp)
 	{
+	  if (NULL == ses)
+            ses = strses_allocate ();
 	  ppp = strchr(pp, ';');
 	  if ('#' == pp[1] && 'x' == pp[2] && (isxdigit(pp[3])) && NULL != ppp)
 	    {
@@ -641,7 +728,11 @@ __string_from_string (caddr_t *n, const char *str, int do_what, const char *wher
 		case 0x9:
 		case 0xd:
 		  if (XQ_NORM_STRING == do_what || XQ_TOKEN == do_what)
+		    {
+		      strses_free (ses); /* the bellow will jump outside */
+		      ses = NULL;
 		    sqlr_new_error ("42001", "XPQ??", "Symbol '#x%x' is not allowed in %s constructor:\"%s\"", val, where, str);
+		    }
 		  break;
 		case 0xa:
 		  if (XQ_NORM_STRING == do_what)
@@ -656,12 +747,76 @@ __string_from_string (caddr_t *n, const char *str, int do_what, const char *wher
 	      continue;
 	    }
 	}
+      else
+        {
+          if (NULL == ses)
+            {
+              n[0] = box_dv_short_string (str);
+              return;
+            }
+        }
       session_buffered_write (ses, (char *)(p), strlen (p));
-      p = pp;
+      break; /* all is written */
     }
+  *n = strses_string (ses);
+  strses_free (ses);
+}
 
+static int
+__gen_string_rcheck (caddr_t *n, int do_what)
+{
+  dk_session_t *ses = NULL;
+  const char *p, *pp, *ppp;
+  int val;
+  char c;
+  for (p = n[0]; NULL != p;)
+    {
+      pp = strchr(p, '&');
+      if (NULL != pp)
+	{
+	  if (NULL == ses)
+            ses = strses_allocate ();
+	  ppp = strchr(pp, ';');
+	  if ('#' == pp[1] && 'x' == pp[2] && (isxdigit(pp[3])) && NULL != ppp)
+	    {
+	      session_buffered_write (ses, (char *)(p), pp-p);
+	      sscanf (pp + 3, "%x", (unsigned *)(&val));
+	      p = ppp + 1;
+	      switch (val) {
+		case 0x9:
+		case 0xd:
+		  if (XQ_NORM_STRING == do_what || XQ_TOKEN == do_what)
+		    {
+		      strses_free (ses); /* the bellow will jump outside */
+		      ses = NULL;
+		      return 0;
+		    }
+		  break;
+		case 0xa:
+		  if (XQ_NORM_STRING == do_what)
+		    continue;
+		  break;
+		case 0x20:
+		  ecm_isname (val);
+		  break;
+	      };
+	      c = (char)val;
+	      session_buffered_write (ses, &c, 1);
+	      continue;
+	    }
+	}
+      else
+        {
+          if (NULL == ses)
+            return 1;
+        }
+      session_buffered_write (ses, (char *)(p), strlen (p));
+      break; /* all is written */
+    }
+  dk_free_tree (n[0]);
   *n = strses_string (ses);
   strses_free (ses);
+  return 0;
 }
 
 
@@ -3181,40 +3336,40 @@ xqf_define_builtin (
 
 static xqf_str_parser_desc_t xqf_str_parser_descs[] = {
 /* Keep these strings sorted alphabetically by p_name! */
-/*	p_name			| p_proc			| p_opcode		| null	| box	| p_dest_dtp	| p_typed_bif_name */
-    {	"boolean"		, __boolean_from_string		, 0			, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_boolean"	},
-    {	"byte"			, __integer_from_string		, XQ_INT8		, 0	, 1	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-    {	"currentDateTime"	, __cur_datetime		, 0			, 0	, 0	, 0		, "__xqf_str_parse_datetime"	},
-    {	"date"			, __datetime_from_string	, XQ_DATE		, 0	, 0	, DV_DATETIME	, "__xqf_str_parse_date"	},
-    {	"dateTime"		, __datetime_from_string	, XQ_DATETIME		, 0	, 0	, DV_DATETIME	, "__xqf_str_parse_datetime"	},
-    {	"dayTimeDuration"	, __duration_from_string	, 0			, 0	, 1	, 0		, "__xqf_str_parse_datetime"	},
-    {	"decimal"		, __numeric_from_string		, 0			, 0	, 0	, DV_NUMERIC	, "__xqf_str_parse_numeric"	},
-    {	"double"		, __float_from_string		, XQ_DOUBLE		, 0	, 0	, DV_DOUBLE_FLOAT, "__xqf_str_parse_double"	},
-    {	"duration"		, __duration_from_string	, 0			, 0	, 1	, 0		, "__xqf_str_parse_datetime"	},
-    {	"float"			, __float_from_string		, XQ_FLOAT		, 0	, 0	, DV_SINGLE_FLOAT, "__xqf_str_parse_float"	},
-    {	"gDay"			, __datetime_from_string	, XQ_DAY		, 0	, 1	, 0		, "__xqf_str_parse_datetime"	},
-    {	"gMonth"		, __datetime_from_string	, XQ_MONTH		, 0	, 1	, 0		, "__xqf_str_parse_datetime"	},
-    {	"gMonthDay"		, __datetime_from_string	, XQ_MONTHDAY		, 0	, 1	, 0		, "__xqf_str_parse_datetime"	},
-    {	"gYear"			, __datetime_from_string	, XQ_YEAR		, 0	, 1	, 0		, "__xqf_str_parse_datetime"	},
-    {	"gYearMonth"		, __datetime_from_string	, XQ_YEARMONTH		, 0	, 1	, 0		, "__xqf_str_parse_datetime"	},
-    {	"int"			, __integer_from_string		, XQ_INT32		, 0	, 1	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-    {	"integer"		, __integer_from_string		, XQ_INT		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-    {	"long"			, __integer_from_string		, XQ_INT64		, 0	, 1	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-    {	"negativeInteger"	, __integer_from_string		, XQ_NINT		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-    {	"nonNegativeInteger"	, __integer_from_string		, XQ_NNINT		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-    {	"nonPositiveInteger"	, __integer_from_string		, XQ_NPINT		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-    {	"normalizedString"	, __gen_string_from_string	, XQ_NORM_STRING	, 0	, 1	, 0		, "__xqf_str_parse_nvarchar"	},
-    {	"positiveInteger"	, __integer_from_string		, XQ_PINT		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-    {	"precisionDecimal"	, __numeric_from_string		, 0			, 0	, 1	, DV_NUMERIC	, "__xqf_str_parse_numeric"	},
-    {	"short"			, __integer_from_string		, XQ_INT16		, 0	, 1	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-/*  {	"string"		, __gen_string_from_string	, XQ_STRING		, 0	, 0	, 0		, "__xqf_str_parse_nvarchar"	}, */
-    {	"time"			, __datetime_from_string	, XQ_TIME		, 0	, 0	, DV_DATETIME	, "__xqf_str_parse_time"	},
-    {	"token"			, __gen_string_from_string	, XQ_TOKEN		, 0	, 1	, 0		, "__xqf_str_parse_nvarchar"	},
-    {	"unsignedByte"		, __integer_from_string		, XQ_UINT8		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-    {	"unsignedInt"		, __integer_from_string		, XQ_UINT32		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-    {	"unsignedLong"		, __integer_from_string		, XQ_UINT64		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-    {	"unsignedShort"		, __integer_from_string		, XQ_UINT16		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	},
-    {	"yearMonthDuration"	, __duration_from_string	, 0			, 0	, 1	, 0		, "__xqf_str_parse_datetime"	} };
+/*	p_name			| p_proc			| p_rcheck		| p_opcode		| null	| box	| p_dest_dtp	| p_typed_bif_name		| p_sql_cast_type */
+    {	"boolean"		, __boolean_from_string		, __boolean_rcheck	, 0			, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_boolean"	, NULL			},
+    {	"byte"			, __integer_from_string		, __integer_rcheck	, XQ_INT8		, 0	, 1	, DV_LONG_INT	, "__xqf_str_parse_integer"	, NULL			},
+    {	"currentDateTime"	, __cur_datetime		, NULL			, 0			, 0	, 0	, 0		, "__xqf_str_parse_datetime"	, NULL			},
+    {	"date"			, __datetime_from_string	, __datetime_rcheck	, XQ_DATE		, 0	, 0	, DV_DATETIME	, "__xqf_str_parse_date"	, "DATE"		},
+    {	"dateTime"		, __datetime_from_string	, __datetime_rcheck	, XQ_DATETIME		, 0	, 0	, DV_DATETIME	, "__xqf_str_parse_datetime"	, "DATETIME"		},
+    {	"dayTimeDuration"	, __duration_from_string	, NULL /*???*/		, 0			, 0	, 1	, 0		, "__xqf_str_parse_datetime"	, NULL			},
+    {	"decimal"		, __numeric_from_string		, NULL			, 0			, 0	, 0	, DV_NUMERIC	, "__xqf_str_parse_numeric"	, "DECIMAL"		},
+    {	"double"		, __float_from_string		, NULL			, XQ_DOUBLE		, 0	, 0	, DV_DOUBLE_FLOAT, "__xqf_str_parse_double"	, "DOUBLE PRECISION"	},
+    {	"duration"		, __duration_from_string	, NULL /*???*/		, 0			, 0	, 1	, 0		, "__xqf_str_parse_datetime"	, NULL			},
+    {	"float"			, __float_from_string		, NULL			, XQ_FLOAT		, 0	, 0	, DV_SINGLE_FLOAT, "__xqf_str_parse_float"	, "REAL"		},
+    {	"gDay"			, __datetime_from_string	, __datetime_rcheck	, XQ_DAY		, 0	, 1	, 0		, "__xqf_str_parse_datetime"	, NULL			},
+    {	"gMonth"		, __datetime_from_string	, __datetime_rcheck	, XQ_MONTH		, 0	, 1	, 0		, "__xqf_str_parse_datetime"	, NULL			},
+    {	"gMonthDay"		, __datetime_from_string	, __datetime_rcheck	, XQ_MONTHDAY		, 0	, 1	, 0		, "__xqf_str_parse_datetime"	, NULL			},
+    {	"gYear"			, __datetime_from_string	, __datetime_rcheck	, XQ_YEAR		, 0	, 1	, 0		, "__xqf_str_parse_datetime"	, NULL			},
+    {	"gYearMonth"		, __datetime_from_string	, __datetime_rcheck	, XQ_YEARMONTH		, 0	, 1	, 0		, "__xqf_str_parse_datetime"	, NULL			},
+    {	"int"			, __integer_from_string		, __integer_rcheck	, XQ_INT32		, 0	, 1	, DV_LONG_INT	, "__xqf_str_parse_integer"	, NULL			},
+    {	"integer"		, __integer_from_string		, __integer_rcheck	, XQ_INT		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	, "INTEGER"		},
+    {	"long"			, __integer_from_string		, __integer_rcheck	, XQ_INT64		, 0	, 1	, DV_LONG_INT	, "__xqf_str_parse_integer"	, "INTEGER"		},
+    {	"negativeInteger"	, __integer_from_string		, __integer_rcheck	, XQ_NINT		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	, NULL			},
+    {	"nonNegativeInteger"	, __integer_from_string		, __integer_rcheck	, XQ_NNINT		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	, NULL			},
+    {	"nonPositiveInteger"	, __integer_from_string		, __integer_rcheck	, XQ_NPINT		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	, NULL			},
+    {	"normalizedString"	, __gen_string_from_string	, __gen_string_rcheck	, XQ_NORM_STRING	, 0	, 1	, 0		, "__xqf_str_parse_nvarchar"	, NULL			},
+    {	"positiveInteger"	, __integer_from_string		, __integer_rcheck	, XQ_PINT		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	, NULL			},
+    {	"precisionDecimal"	, __numeric_from_string		, NULL /*???*/		, 0			, 0	, 1	, DV_NUMERIC	, "__xqf_str_parse_numeric"	, NULL			},
+    {	"short"			, __integer_from_string		, __integer_rcheck	, XQ_INT16		, 0	, 1	, DV_LONG_INT	, "__xqf_str_parse_integer"	, NULL			},
+    {	"string"		, __gen_string_from_string	, __gen_string_rcheck	, XQ_STRING		, 0	, 1	, DV_STRING	, "__xqf_str_parse_nvarchar"	, "VARCHAR"		},
+    {	"time"			, __datetime_from_string	, __datetime_rcheck	, XQ_TIME		, 0	, 0	, DV_DATETIME	, "__xqf_str_parse_time"	, "DATETIME"		},
+    {	"token"			, __gen_string_from_string	, __gen_string_rcheck	, XQ_TOKEN		, 0	, 1	, 0		, "__xqf_str_parse_nvarchar"	, NULL			},
+    {	"unsignedByte"		, __integer_from_string		, __integer_rcheck	, XQ_UINT8		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	, NULL			},
+    {	"unsignedInt"		, __integer_from_string		, __integer_rcheck	, XQ_UINT32		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	, NULL			},
+    {	"unsignedLong"		, __integer_from_string		, __integer_rcheck	, XQ_UINT64		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	, NULL			},
+    {	"unsignedShort"		, __integer_from_string		, __integer_rcheck	, XQ_UINT16		, 0	, 0	, DV_LONG_INT	, "__xqf_str_parse_integer"	, NULL			},
+    {	"yearMonthDuration"	, __duration_from_string	, NULL /*???*/		, 0			, 0	, 1	, 0		, "__xqf_str_parse_datetime"	, NULL			} };
 
 /* No parsing or validation for
 hexBinary
@@ -3265,11 +3420,31 @@ bif_xqf_str_parse (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
       if (DV_STRING != arg_dtp)
         {
           if (desc->p_dest_dtp == arg_dtp)
-            return box_copy_tree (arg);
+            res = box_copy_tree (arg);
+          else
+            {
+              caddr_t err = NULL;
+              res = box_cast_to (qst, arg, arg_dtp, desc->p_dest_dtp, NUMERIC_MAX_PRECISION, NUMERIC_MAX_SCALE, &err);
+              if (err)
+                {
+                  dk_free_tree (err);
+                  goto cvt_error; /* see below */
+                }
+            }
+          if (NULL == desc->p_rcheck)
+            return res;
+          if (desc->p_rcheck (&res, desc->p_opcode))
+            return res;
+          if (flags & 1)
+            return NEW_DB_NULL;
+          sqlr_new_error ("22023", "SR487",
+            "Function xqf_str_parse() has failed to convert an arg of type %s (%d) by XQuery library function xsd:%.300s() because the result does not fit the XSD range restrictions",
+            dv_type_title (arg_dtp), arg_dtp, p_name );
+cvt_error:
           if (flags & 1)
             return NEW_DB_NULL;
           sqlr_new_error ("22023", "SR487",
-            "Function xqf_str_parse() can not use XQuery library function '%.300s' to process an arg of type %s (%d)",
+            "Function xqf_str_parse() can not use XQuery library function xsd:%.300s() to process an arg of type %s (%d)",
             p_name, dv_type_title (arg_dtp), arg_dtp);
         }
     }
diff --git a/libsrc/Wi/xqf.h b/libsrc/Wi/xqf.h
index cea1d92..cb80aad 100644
--- a/libsrc/Wi/xqf.h
+++ b/libsrc/Wi/xqf.h
@@ -1,7 +1,7 @@
 /*
  *  xqf.h
  *
- *  $Id: xqf.h,v 1.4.2.1 2009/04/18 21:55:19 source Exp $
+ *  $Id: xqf.h,v 1.4.2.3 2011/03/03 11:56:45 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -27,6 +27,7 @@
 #define _XQF_H
 
 typedef void (*qpq_ctr_callback)(caddr_t *n, const char *str, int do_what);
+typedef int (*qpq_rangecheck_callback)(caddr_t *n, int do_what);
 typedef void (*qpq_oper_callback)(caddr_t *n, const char *arg1, const char *arg2, int do_what);
 typedef void (*qpq_teroper_callback)(caddr_t *n, const char *arg1, const char *arg2, const char *arg3, int do_what);
 
@@ -34,11 +35,13 @@ typedef struct xqf_str_parser_desc_s
 {
   const char *p_name;
   qpq_ctr_callback p_proc;
+  qpq_rangecheck_callback p_rcheck;
   int p_opcode;
   dtp_t p_can_default;
   int p_rdf_boxed;
   dtp_t p_dest_dtp;
   const char *p_typed_bif_name;
+  const char *p_sql_cast_type;
 }
 xqf_str_parser_desc_t;
 
diff --git a/libsrc/Wi/xrd2json.xsl b/libsrc/Wi/xrd2json.xsl
new file mode 100644
index 0000000..05231fd
--- /dev/null
+++ b/libsrc/Wi/xrd2json.xsl
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text" media-type="application/json"/>
+  <xsl:variable name="uc">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
+  <xsl:variable name="lc">abcdefghijklmnopqrstuvwxyz</xsl:variable>
+    <xsl:template match="XRD">
+{
+  <xsl:apply-templates select="Subject|Host|Alias"/>
+  "link": 
+    [
+      <xsl:for-each select="Link">
+      {
+        <xsl:for-each select="@*">"<xsl:value-of select="local-name(.)"/>": "<xsl:value-of select="."/>"<xsl:if test="position () != last ()">,
+        </xsl:if></xsl:for-each>
+      }<xsl:if test="position () != last ()">,</xsl:if>
+      </xsl:for-each>
+    ]
+}
+    </xsl:template>
+    <xsl:template match="Subject|Host|Alias">"<xsl:value-of select="translate (local-name(.), $uc, $lc)"/>": "<xsl:value-of select="."/>",</xsl:template>
+</xsl:stylesheet>
diff --git a/libsrc/Wi/xslt.c b/libsrc/Wi/xslt.c
index 9e427e8..0dd3d84 100644
--- a/libsrc/Wi/xslt.c
+++ b/libsrc/Wi/xslt.c
@@ -1,7 +1,7 @@
 /*
  *  xslt.c
  *
- *  $Id: xslt.c,v 1.32.2.18 2010/05/17 08:21:40 source Exp $
+ *  $Id: xslt.c,v 1.32.2.26 2011/02/02 15:36:58 source Exp $
  *
  *  XSLT
  *
@@ -660,6 +660,71 @@ xp_dyn_attr (xparse_ctx_t * xp, char * name, caddr_t val)
 }
 
 caddr_t
+xslt_try_to_eval_var_fast (xparse_ctx_t * xp, xp_query_t * xqr, xml_entity_t * xe,
+	    int mode, dtp_t dtp )
+{
+  XT * tree = xqr->xqr_tree;
+  caddr_t name = tree->_.var.name;
+  xqi_binding_t *xb;
+  caddr_t val = NULL;
+  dtp_t val_dtp;
+  for (xb = xp->xp_locals; (NULL != xb) && (NULL != xb->xb_name); xb = xb->xb_next)
+    {
+      if (!strcmp (name, xb->xb_name))
+        {
+          val = xb->xb_value;
+          goto xb_found; /* see below */
+        }
+    }
+  for (xb = xp->xp_globals; NULL != xb; xb = xb->xb_next)
+    {
+      if (!strcmp (name, xb->xb_name))
+        {
+          val = xb->xb_value;
+          goto xb_found; /* see below */
+        }
+    }
+  switch (mode)
+    {
+    case XQ_TRUTH_VALUE:
+      return NULL;
+    case XQ_VALUE:
+      return box_dv_short_string ("");
+      break;
+    case XQ_NODE_SET:
+      return list_to_array_of_xqval (0);
+    }
+xb_found:
+  switch (mode)
+    {
+    case XQ_TRUTH_VALUE:
+      return (caddr_t) (ptrlong) xqi_truth_value_of_box (val);
+    case XQ_VALUE:
+      val_dtp = DV_TYPE_OF (val);
+      if (DV_ARRAY_OF_XQVAL == val_dtp)
+        {
+          if (0 == BOX_ELEMENTS (val))
+            return box_dv_short_string ("");
+          val = ((caddr_t *)val)[0];
+        }
+      if (NULL == val)
+        return box_dv_short_string ("");
+      if ((DV_UNKNOWN == dtp) || (val_dtp == dtp))
+        return box_copy_tree (val);
+      return BADBEEF_BOX;
+    case XQ_NODE_SET:
+      if (DV_ARRAY_OF_XQVAL != DV_TYPE_OF (val))
+        {
+          caddr_t res = list (1, box_copy_tree (val));
+          box_tag_modify (res, DV_ARRAY_OF_XQVAL);
+          return res;
+        }
+      return box_copy_tree (val);
+    }
+  return BADBEEF_BOX;
+}
+
+caddr_t
 xslt_eval_1 (xparse_ctx_t * xp, xp_query_t * xqr, xml_entity_t * xe,
 	    int mode, dtp_t dtp)
 {
@@ -667,7 +732,22 @@ xslt_eval_1 (xparse_ctx_t * xp, xp_query_t * xqr, xml_entity_t * xe,
   int first;
   XT * tree = xqr->xqr_tree;
   caddr_t volatile val;
-  xp_instance_t * volatile xqi = xqr_instance (xqr, xp->xp_qi);
+#ifndef NDEBUG
+  caddr_t volatile var_val = BADBEEF_BOX;
+#endif
+  xp_instance_t * volatile xqi;
+  if (XP_VARIABLE == tree->type)
+    { /* Fast code for popular case of an expression that is just a variable and no complicated cast of the value */
+#ifdef NDEBUG
+      caddr_t var_val;
+#endif
+      var_val = xslt_try_to_eval_var_fast (xp, xqr, xe, mode, dtp);
+#ifdef NDEBUG
+      if (BADBEEF_BOX != var_val)
+        return var_val;
+#endif
+    }
+  xqi = xqr_instance (xqr, xp->xp_qi);
   xqi->xqi_doc_cache = xp->xp_doc_cache;
   xqi->xqi_xp_locals = xp->xp_locals;
   xqi->xqi_xp_globals = xp->xp_globals;
@@ -723,6 +803,18 @@ xslt_eval_1 (xparse_ctx_t * xp, xp_query_t * xqr, xml_entity_t * xe,
     }
   END_QR_RESET;
   xqi_free (xqi);
+#ifndef NDEBUG
+  if (BADBEEF_BOX != var_val)
+    {
+      if (DV_TYPE_OF (var_val) != DV_TYPE_OF (val))
+        GPF_T1 ("xslt_eval_1(): failed fast branch for var: wrong type");
+      if (box_hash (var_val) != box_hash (val))
+        {
+          GPF_T1 ("xslt_eval_1(): failed fast branch for var: diff hash");
+        }
+      dk_free_tree (var_val);
+    }
+#endif
   return val;
 }
 
@@ -1660,34 +1752,7 @@ xb_found:
       for (col_ctr = 0; col_ctr < cols_count; col_ctr++)
         {
           caddr_t new_val = lc_nth_col (lc, col_ctr);
-          switch (DV_TYPE_OF (new_val))
-            {
-            case DV_DB_NULL:
-              new_val = NULL;
-              goto xb_set_new_val; /* see below */
-            case DV_IRI_ID:
-              dk_free_tree (xb->xb_value);
-              xb->xb_value = NULL;
-              xb->xb_value = key_id_to_iri (qi, ((iri_id_t*)new_val)[0]);
-              goto xb_done; /* see below */
-            default:
-              if (NULL == new_val)
-                {
-                  if ((DV_LONG_INT != DV_TYPE_OF (xb->xb_value)) || (0 != unbox (xb->xb_value)) || (NULL == xb->xb_value))
-                    {
-          dk_free_tree (xb->xb_value);
-                      xb->xb_value = box_num_nonull (0);
-                      goto xb_done; /* see below */
-                    }
-                }
-            }
-xb_set_new_val:
-          if (new_val != xb->xb_value)
-            {
-              dk_free_tree (xb->xb_value);
-              xb->xb_value = box_copy_tree (new_val);
-            }
-xb_done:
+          rb_cast_to_xpath_safe (qi, new_val, &(xb->xb_value));
           xb = xb->xb_next;
 	}
       xslt_instantiate_children (xp, xstree);
@@ -3328,7 +3393,7 @@ box_find_mt_unsafe_subtree (caddr_t box)
     {
     case DV_STRING: case DV_LONG_INT: case DV_SINGLE_FLOAT: case DV_DOUBLE_FLOAT:
     case DV_DB_NULL: case DV_UNAME: case DV_DATETIME: case DV_NUMERIC:
-    case DV_IRI_ID: case DV_ASYNC_QUEUE:
+    case DV_IRI_ID: case DV_ASYNC_QUEUE: case DV_WIDE:
       return NULL;
     case DV_DICT_ITERATOR:
       {
@@ -3372,7 +3437,7 @@ box_make_tree_mt_safe (caddr_t box)
     {
     case DV_STRING: case DV_LONG_INT: case DV_SINGLE_FLOAT: case DV_DOUBLE_FLOAT:
     case DV_DB_NULL: case DV_UNAME: case DV_DATETIME: case DV_NUMERIC:
-    case DV_IRI_ID: case DV_ASYNC_QUEUE:
+    case DV_IRI_ID: case DV_ASYNC_QUEUE: case DV_WIDE:
       return;
     case DV_DICT_ITERATOR:
       {
@@ -3593,6 +3658,22 @@ bif_dict_get (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 
 
 caddr_t
+bif_dict_contains_key (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  id_hash_iterator_t *hit = bif_dict_iterator_arg (qst, args, 0, "dict_contains_key", 0);
+  id_hash_t *ht = hit->hit_hash;
+  caddr_t key = bif_arg (qst, args, 1, "dict_contains_key");
+  caddr_t *valptr;
+  if (ht->ht_mutex)
+    mutex_enter (ht->ht_mutex);
+  valptr = (caddr_t *)id_hash_get (ht, (caddr_t)(&key));
+  if (ht->ht_mutex)
+    mutex_leave (ht->ht_mutex);
+  return (caddr_t)((ptrlong)((NULL != valptr) ? 1 : 0));
+}
+
+
+caddr_t
 bif_dict_remove (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
   id_hash_iterator_t *hit = bif_dict_iterator_arg (qst, args, 0, "dict_remove", 0);
@@ -3618,7 +3699,7 @@ bif_dict_remove (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
       dk_free_tree (old_val);
       id_hash_iterator (hit, ht);
       ht->ht_dict_version++;
-      if (hit->hit_chilum != old_key_ptr)
+      if (hit->hit_chilum != (char *)old_key_ptr)
         hit->hit_dict_version++;
       res = 1;
     }
@@ -3688,7 +3769,7 @@ bif_dict_dec_or_remove (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   caddr_t key = bif_arg (qst, args, 1, "dict_dec_or_remove");
   boxint dec_val = bif_long_range_arg (qst, args, 2, "dict_dec_or_remove", 0, 0xffff);
   caddr_t *old_key_ptr, *old_val_ptr;
-  boxint res;
+  boxint res = 0;
   if (ht->ht_mutex)
     mutex_enter (ht->ht_mutex);
   old_val_ptr = (caddr_t *)id_hash_get (ht, (caddr_t)(&key));
@@ -3723,7 +3804,7 @@ bif_dict_dec_or_remove (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
       dk_free_tree (old_val);
       id_hash_iterator (hit, ht);
       ht->ht_dict_version++;
-      if (hit->hit_chilum != old_key_ptr)
+      if (hit->hit_chilum != (char *)old_key_ptr)
         hit->hit_dict_version++;
       res = 0;
     }
@@ -3844,7 +3925,7 @@ bif_dict_destructive_list_rnd_keys (caddr_t * qst, caddr_t * err_ret, state_slot
     len = batch_size;
   if (0 == len)
     {
-      res = list (0);
+      res = (caddr_t *)list (0);
       goto res_done; /* see below */
     }
   res = (caddr_t *)dk_alloc_box (len * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
@@ -3878,12 +3959,20 @@ bif_dict_to_vector (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   boxint destructive = bif_long_arg (qst, args, 1, "dict_to_vector");
   id_hash_t *ht;
   caddr_t *res, *tail, *keyp, *valp;
+  size_t box_len;
   if (NULL == hit1)
     return list (0);
   ht = hit1->hit_hash;
   if (ht->ht_mutex)
     mutex_enter (ht->ht_mutex);
-  res = (caddr_t *)dk_alloc_box ((ht->ht_inserts - ht->ht_deletes) * 2 * sizeof (caddr_t), DV_ARRAY_OF_POINTER);
+  box_len = (ht->ht_inserts - ht->ht_deletes) * 2 * sizeof (caddr_t);
+  if (box_len >= MAX_BOX_LENGTH)
+    {
+      if (ht->ht_mutex)
+	mutex_leave (ht->ht_mutex);
+      sqlr_new_error ("22023", ".....", "The result array too large");
+    }
+  res = (caddr_t *)dk_alloc_box (box_len, DV_ARRAY_OF_POINTER);
   tail = res;
   id_hash_iterator (&hit, ht);
   if (1 != ht->ht_dict_refctr)
@@ -3946,7 +4035,7 @@ bif_dict_iter_next (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   if (hit->hit_dict_version == ht->ht_dict_version)
     {
       caddr_t *key, *data;
-      res = hit_next (hit, &key, &data);
+      res = hit_next (hit, (char **)(&key), (char **)(&data));
       if (res)
         {
           if ((SSL_VARIABLE == args[1]->ssl_type) || (IS_SSL_REF_PARAMETER (args[1]->ssl_type)))
@@ -3964,24 +4053,23 @@ bif_dict_iter_next (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
   return box_num (res);
 }
 
-/*#define GVECTOR_SORT_DEBUG*/
-#define MAX_VECTOR_BSORT_BLOCK 8
-
-typedef struct vector_sort_s
+caddr_t
+bif_dict_key_hash (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
 {
-  int vs_block_elts;
-  int vs_block_size;
-  int vs_key_ofs;
-  int vs_sort_asc;
-  int vs_whole_vector_elts;
-  caddr_t *vs_whole_vector;
-  caddr_t *vs_whole_tmp;
+  caddr_t key = bif_arg (qst, args, 0, "dict_key_hash");
+  return box_num (treehash ((char *)&key));
 }
-vector_sort_t;
 
+caddr_t
+bif_dict_key_eq (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args)
+{
+  caddr_t key1 = bif_arg (qst, args, 0, "dict_key_eq");
+  caddr_t key2 = bif_arg (qst, args, 1, "dict_key_eq");
+  return box_num (treehashcmp ((char *)(&key1), (char *)(&key2)));
+}
 
 int
-vector_sort_cmp (caddr_t * e1, caddr_t * e2, vector_sort_t * specs)
+gvector_sort_cmp (caddr_t * e1, caddr_t * e2, vector_sort_t * specs)
 {
   caddr_t key1 = e1 [specs->vs_key_ofs];
   caddr_t key2 = e2 [specs->vs_key_ofs];
@@ -4024,21 +4112,21 @@ cmp_done:
 }
 
 
-#ifdef GVECTOR_SORT_DEBUG
-#define GVECTOR_CHECK_BLOCK(blk,specs) do { \
+#ifdef VECTOR_SORT_DEBUG
+#define VECTOR_CHECK_BLOCK(blk,specs) do { \
     int ctr = specs->vs_block_elts; \
     while (ctr--) dk_check_tree ((blk)[ctr]); \
   } while (0)
 #else
-#define GVECTOR_CHECK_BLOCK(blk,specs)
+#define VECTOR_CHECK_BLOCK(blk,specs)
 #endif
 
 
-#define GVECTOR_SORT_SWAP(a,b,specs) do { \
+#define VECTOR_SORT_SWAP(a,b,specs) do { \
     caddr_t tmp[MAX_VECTOR_BSORT_BLOCK]; \
     int bsize = specs->vs_block_size; \
-    GVECTOR_CHECK_BLOCK(a,specs); \
-    GVECTOR_CHECK_BLOCK(b,specs); \
+    VECTOR_CHECK_BLOCK(a,specs); \
+    VECTOR_CHECK_BLOCK(b,specs); \
     memcpy (tmp, (a), bsize); \
     memcpy ((a), (b), bsize); \
     memcpy ((b), tmp, bsize); \
@@ -4046,7 +4134,7 @@ cmp_done:
 
 
 void
-gvector_bsort (caddr_t *bs, int n_bufs, vector_sort_t * specs)
+vector_bsort (caddr_t *bs, int n_bufs, vector_sort_t * specs)
 {
   /* Bubble sort n_bufs first buffers in the array. */
   int bels = specs->vs_block_elts;
@@ -4057,36 +4145,36 @@ gvector_bsort (caddr_t *bs, int n_bufs, vector_sort_t * specs)
 	{
           caddr_t *a = bs + (n * bels);
           caddr_t *b = a + bels;
-	  if (DVC_GREATER == vector_sort_cmp (a, b, specs))
-	    GVECTOR_SORT_SWAP (a, b, specs);
+	  if (DVC_GREATER == specs->vs_cmp_fn (a, b, specs))
+	    VECTOR_SORT_SWAP (a, b, specs);
 	}
     }
-#ifdef GVECTOR_SORT_DEBUG
+#ifdef VECTOR_SORT_DEBUG
   dk_check_domain_of_connectivity (specs->vs_whole_vector);
 #endif
 }
 
 
 static void
-gvector_sort_reverse_buffer (caddr_t *in, int n_in, vector_sort_t *specs)
+vector_sort_reverse_buffer (caddr_t *in, int n_in, vector_sort_t *specs)
 {
   int bels = specs->vs_block_elts;
   caddr_t *a = in;
   caddr_t *b = in + (n_in - 1) * bels;
   while (a < b)
     {
-      GVECTOR_SORT_SWAP (a, b, specs);
+      VECTOR_SORT_SWAP (a, b, specs);
       a += bels;
       b -= bels;
     }
-#ifdef GVECTOR_SORT_DEBUG
+#ifdef VECTOR_SORT_DEBUG
   dk_check_domain_of_connectivity (specs->vs_whole_vector);
 #endif
 }
 
 
 void
-gvector_qsort (caddr_t * in, caddr_t * left, int n_in, int depth, vector_sort_t * specs)
+vector_qsort_int (caddr_t * in, caddr_t * left, int n_in, int depth, vector_sort_t * specs)
 {
   if (n_in < 3)
     {
@@ -4094,9 +4182,9 @@ gvector_qsort (caddr_t * in, caddr_t * left, int n_in, int depth, vector_sort_t
       if (n_in < 2)
         return;
       bels = specs->vs_block_elts;
-      if (DVC_GREATER == vector_sort_cmp (in, in + bels, specs))
+      if (DVC_GREATER == specs->vs_cmp_fn (in, in + bels, specs))
 	{
-          GVECTOR_SORT_SWAP (in, in + bels, specs);
+          VECTOR_SORT_SWAP (in, in + bels, specs);
 	}
     }
   else
@@ -4110,7 +4198,7 @@ gvector_qsort (caddr_t * in, caddr_t * left, int n_in, int depth, vector_sort_t
       int inx, above_is_all_splits = 1;
       if (depth > 30)
 	{
-	  gvector_bsort (in, n_in, specs);
+	  vector_bsort (in, n_in, specs);
 	  return;
 	}
 
@@ -4119,7 +4207,7 @@ gvector_qsort (caddr_t * in, caddr_t * left, int n_in, int depth, vector_sort_t
       for (inx = 0; inx < n_in; inx++)
 	{
 	  caddr_t * this_pg = in + inx * bels;
-	  int rc = vector_sort_cmp (this_pg, split, specs);
+	  int rc = specs->vs_cmp_fn (this_pg, split, specs);
 	  if (!mid_filled && DVC_MATCH == rc)
 	    {
               memcpy (mid, this_pg, bsize);
@@ -4135,26 +4223,45 @@ gvector_qsort (caddr_t * in, caddr_t * left, int n_in, int depth, vector_sort_t
 	      memcpy (left + (n_right--) * bels, this_pg, bsize);
 	    }
 	}
-      gvector_qsort (left, in, n_left, depth + 1, specs);
-      gvector_sort_reverse_buffer (left + (n_right + 1) * bels, (n_in - n_right) - 1, specs);
+      vector_qsort_int (left, in, n_left, depth + 1, specs);
+      vector_sort_reverse_buffer (left + (n_right + 1) * bels, (n_in - n_right) - 1, specs);
       if (!above_is_all_splits)
-	gvector_qsort (left + (n_right + 1) * bels, in + (n_right + 1) * bels,
+	vector_qsort_int (left + (n_right + 1) * bels, in + (n_right + 1) * bels,
 	    (n_in - n_right) - 1, depth + 1, specs);
       memcpy (in, left, n_left * bsize);
 #ifdef DEBUG
       if (!mid_filled)
-        GPF_T1("gvector_qsort can not find split value in range");
+        GPF_T1("gvector_qsort_int can not find split value in range");
 #endif
       memcpy (in + n_left * bels, mid, bsize);
       memcpy (in + (n_right + 1) * bels, left + (n_right + 1) * bels,
 	  ((n_in - n_right) - 1) * bsize);
-#ifdef GVECTOR_SORT_DEBUG
+#ifdef VECTOR_SORT_DEBUG
   dk_check_domain_of_connectivity (specs->vs_whole_vector);
   dk_check_domain_of_connectivity (specs->vs_whole_tmp);
 #endif
     }
 }
 
+void
+vector_qsort (caddr_t *vect, int group_count, vector_sort_t *specs)
+{
+  caddr_t *temp;
+  specs->vs_block_size = specs->vs_block_elts * sizeof (caddr_t);
+#ifdef VECTOR_SORT_DEBUG
+  temp = (caddr_t*) dk_alloc_box_zero (box_length (vect), DV_ARRAY_OF_POINTER);
+  specs->vs_whole_vector = vect;
+  specs->vs_whole_tmp = temp;
+#else
+  temp = (caddr_t*) dk_alloc_box (box_length (vect), DV_ARRAY_OF_POINTER);
+#endif
+  vector_qsort_int (vect, temp, group_count, 0, specs);
+#ifdef VECTOR_SORT_DEBUG
+  dk_check_tree (vect);
+#endif
+  dk_free_box (temp);
+}
+
 typedef struct dsort_itm_s {
   boxint di_key;
   int di_pos;
@@ -4183,25 +4290,11 @@ bif_gvector_sort_imp (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args, co
     return box_num (group_count); /* No need to sort empty or single-element vector */
   if ('Q' == algo)
     {
-      caddr_t *temp;
-#ifdef GVECTOR_SORT_DEBUG
-      temp = (caddr_t*) dk_alloc_box_zero (box_length (vect), DV_ARRAY_OF_POINTER);
-#else
-      temp = (caddr_t*) dk_alloc_box (box_length (vect), DV_ARRAY_OF_POINTER);
-#endif
       specs.vs_block_elts = block_elts;
-      specs.vs_block_size = block_elts * sizeof (caddr_t);
       specs.vs_key_ofs = key_ofs;
       specs.vs_sort_asc = sort_asc;
-#ifdef GVECTOR_SORT_DEBUG
-      specs.vs_whole_vector = vect;
-      specs.vs_whole_tmp = temp;
-#endif
-      gvector_qsort (vect, temp, group_count, 0, &specs);
-#ifdef GVECTOR_SORT_DEBUG
-      dk_check_tree (vect);
-#endif
-      dk_free_box (temp);
+      specs.vs_cmp_fn = gvector_sort_cmp;
+      vector_qsort (vect, group_count, &specs);
     }
   else /* if ('D' == algo) */
     {
@@ -4330,26 +4423,11 @@ bif_rowvector_sort_imp (caddr_t * qst, caddr_t * err_ret, state_slot_t ** args,
     return box_num (vect_elems); /* No need to sort empty or single-element vector */
   if ('Q' == algo)
     {
-      caddr_t *temp;
-#ifdef GVECTOR_SORT_DEBUG
-      temp = (caddr_t*) dk_alloc_box_zero (box_length (vect), DV_ARRAY_OF_POINTER);
-#else
-      temp = (caddr_t*) dk_alloc_box (box_length (vect), DV_ARRAY_OF_POINTER);
-#endif
       specs.vs_block_elts = 1;
-      specs.vs_block_size = sizeof (caddr_t);
       specs.vs_key_ofs = key_ofs;
       specs.vs_sort_asc = sort_asc;
-#ifdef GVECTOR_SORT_DEBUG
-      specs.vs_whole_vector = vect;
-      specs.vs_whole_tmp = temp;
-#endif
-      GPF_T1("rowvector_qsort is not yet implemented");
-      /*rowvector_qsort (vect, temp, vect_elems, 0, &specs); */
-#ifdef GVECTOR_SORT_DEBUG
-      dk_check_tree (vect);
-#endif
-      dk_free_box (temp);
+      GPF_T1("rowvector_qsort_int is not yet implemented");
+      /*rowvector_qsort_int (vect, temp, vect_elems, 0, &specs); */
     }
   else /* if (('D' == algo) || ('S' == algo)) */
     {
@@ -4741,6 +4819,7 @@ xslt_init (void)
   bif_define ("dict_duplicate", bif_dict_duplicate);
   bif_define ("dict_put", bif_dict_put);
   bif_define ("dict_get", bif_dict_get);
+  bif_define_typed ("dict_contains_key", bif_dict_contains_key, &bt_integer);
   bif_define ("dict_remove", bif_dict_remove);
   bif_define ("dict_inc_or_put", bif_dict_inc_or_put);
   bif_define ("dict_dec_or_remove", bif_dict_dec_or_remove);
@@ -4751,6 +4830,8 @@ xslt_init (void)
   bif_define ("dict_zap", bif_dict_zap);
   bif_define ("dict_iter_rewind", bif_dict_iter_rewind);
   bif_define ("dict_iter_next", bif_dict_iter_next);
+  bif_define ("dict_key_hash", bif_dict_key_hash);
+  bif_define ("dict_key_eq", bif_dict_key_eq);
   bif_define ("gvector_sort", bif_gvector_sort);
   bif_define ("gvector_digit_sort", bif_gvector_digit_sort);
   bif_define ("rowvector_digit_sort", bif_rowvector_digit_sort);
diff --git a/libsrc/Wi/xslt_fmt.c b/libsrc/Wi/xslt_fmt.c
index 285b946..8c344b4 100644
--- a/libsrc/Wi/xslt_fmt.c
+++ b/libsrc/Wi/xslt_fmt.c
@@ -1,7 +1,7 @@
 /*
  *  xslt_fmt.c
  *
- *  $Id: xslt_fmt.c,v 1.2.2.1 2009/04/18 21:55:19 source Exp $
+ *  $Id: xslt_fmt.c,v 1.2.2.2 2010/09/17 11:18:20 source Exp $
  *
  *  XSLT formatting routines
  *
@@ -134,12 +134,12 @@ char *xslt_fmt_print_numbers (char *tail, int tail_max_fill, unsigned *nums, int
   int num_idx;
   int format_len = (int) strlen(format);
 /* Printing starting nonalpha-s */
-  while (('\0' != format[0]) && !isalnum (format[0]))
+  while (('\0' != format[0]) && !isalnum ((unsigned char) (format[0])))
     (tail++)[0] = (format++)[0];
   delim_begin = delim_end = format;
 /* Remembering format end */
   last_nonalpha_begin = format + format_len;
-  while ((last_nonalpha_begin > format) && !isalnum(last_nonalpha_begin[-1]))
+  while ((last_nonalpha_begin > format) && !isalnum((unsigned char) (last_nonalpha_begin[-1])))
     last_nonalpha_begin--;
 /* Now the printing loop is running. */
   for (num_idx = 0; num_idx < nums_count; num_idx++)
@@ -171,11 +171,11 @@ char *xslt_fmt_print_numbers (char *tail, int tail_max_fill, unsigned *nums, int
 	      break;
 	    }
 /* Error recovery should be made if the format is unsupported or invalid */
-	  if (isalnum (fmt_end[0]))
+	  if (isalnum ((unsigned char) (fmt_end[0])))
 	    {
 	      fmt_type = '1';
 	      fmt_len = 1;
-	      while (isalnum (fmt_end[0]))
+	      while (isalnum ((unsigned char) (fmt_end[0])))
 		fmt_end++;
 	    }
 	}
@@ -208,7 +208,7 @@ char *xslt_fmt_print_numbers (char *tail, int tail_max_fill, unsigned *nums, int
 	  if (delim_end < last_nonalpha_begin)
 	    {
 	      delim_begin = delim_end = fmt_end;
-	      while ((delim_end < last_nonalpha_begin) && !isalnum (delim_end[0]))
+	      while ((delim_end < last_nonalpha_begin) && !isalnum ((unsigned char) (delim_end[0])))
 		delim_end++;
 	    }
 	  if (delim_begin < delim_end)
diff --git a/libsrc/Wi/xslt_impl.h b/libsrc/Wi/xslt_impl.h
index 3e9064f..6f5c8f5 100644
--- a/libsrc/Wi/xslt_impl.h
+++ b/libsrc/Wi/xslt_impl.h
@@ -1,5 +1,5 @@
 /*
- *  $Id: xslt_impl.h,v 1.3.2.4 2009/10/26 20:46:46 source Exp $
+ *  $Id: xslt_impl.h,v 1.3.2.5 2010/09/17 22:49:26 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -249,4 +249,38 @@ extern shuric_vtable_t xslt_shuric_vtable;
 
 extern char * xslt_fmt_print_numbers (char *tail, int tail_max_fill, unsigned *nums,
     int nums_count, char *format);
+
+/* Historically, in-memory dictionaries and weird sortings are part of XSLT. That should be changed sooner or later. */
+
+/*#define VECTOR_SORT_DEBUG*/
+#define MAX_VECTOR_BSORT_BLOCK 8
+
+struct vector_sort_s;
+
+/*! Type of comparison callback for vector_qsort_int() and the like */
+typedef int vector_sort_cmp_t (caddr_t * e1, caddr_t * e2, struct vector_sort_s * specs);
+
+/*! Comparison callback used in gvector_qsort_int */
+extern int gvector_sort_cmp (caddr_t * e1, caddr_t * e2, struct vector_sort_s * specs);
+
+typedef struct vector_sort_s
+{
+  int vs_block_elts;		/*!< Number of elements in the sorting block */
+  int vs_block_size;		/*!< Size of sorting block in bytes */
+  int vs_key_ofs;		/*!< Offset of key element in sorting block, (offset in elements, not in bytes) */
+  int vs_sort_asc;		/*!< Descending sort if 0, ascending sort otherwise */
+  int vs_whole_vector_elts;	/*!< Number of elements in the whole vector to sort */
+  caddr_t *vs_whole_vector;	/*!< Whole vector to sort */
+  caddr_t *vs_whole_tmp;
+  vector_sort_cmp_t *vs_cmp_fn;	/*!< Comparison callback */
+  void *vs_env;			/*!< Callback-specific data */
+}
+vector_sort_t;
+
+/*! Bubble sort of a vactor or its fragment */
+void vector_bsort (caddr_t *bs, int n_bufs, vector_sort_t * specs);
+void vector_qsort (caddr_t *vect, int group_count, vector_sort_t *specs);
+
+
+
 #endif
diff --git a/libsrc/Wi/xslt_opt.c b/libsrc/Wi/xslt_opt.c
index 7e00878..7b94fea 100644
--- a/libsrc/Wi/xslt_opt.c
+++ b/libsrc/Wi/xslt_opt.c
@@ -1,7 +1,7 @@
 /*
  *  xslt.c
  *
- *  $Id: xslt_opt.c,v 1.9.2.5 2009/10/26 20:46:46 source Exp $
+ *  $Id: xslt_opt.c,v 1.9.2.6 2011/01/18 10:32:06 source Exp $
  *
  *  XSLT translator
  *
@@ -648,7 +648,7 @@ void xslt_includes_recursion (xslt_sheet_t *xsh, caddr_t **sheet_tree_ptr, query
 	  inctree = (caddr_t *) box_copy_tree ((box_t) inc->xsh_raw_tree);
 	  xslt_includes_recursion (inc, &inctree, qi);
 	  new_sheet_tree = xte_insert_inc (sheet_tree, inx, inctree);
-#ifdef DEBUG
+#ifdef DK_ALLOC_BOX_DEBUG
 	  {
 	    dk_hash_t *known = hash_table_allocate (4096);
 	    dk_check_tree_iter (sheet_tree, BADBEEF_BOX, known);
diff --git a/libsrc/Xml.new/Makefile.in b/libsrc/Xml.new/Makefile.in
index 1df4c7f..7895735 100644
--- a/libsrc/Xml.new/Makefile.in
+++ b/libsrc/Xml.new/Makefile.in
@@ -190,6 +190,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/Xml.new/xhtml_ent.h b/libsrc/Xml.new/xhtml_ent.h
index c67b54b..8606f58 100644
--- a/libsrc/Xml.new/xhtml_ent.h
+++ b/libsrc/Xml.new/xhtml_ent.h
@@ -34,9 +34,9 @@ struct xhtml_ent_s { const char *entity; int encoded_symbol; const char *descr;}
 #define TOTAL_KEYWORDS 253
 #define MIN_WORD_LENGTH 2
 #define MAX_WORD_LENGTH 8
-#define MIN_HASH_VALUE 116
-#define MAX_HASH_VALUE 1245
-/* maximum key range = 1130, duplicates = 0 */
+#define MIN_HASH_VALUE 145
+#define MAX_HASH_VALUE 1268
+/* maximum key range = 1124, duplicates = 0 */
 
 #ifdef __GNUC__
 __inline
@@ -50,32 +50,32 @@ hash (register const char *str, register unsigned int len)
 {
   static const unsigned short asso_values[] =
     {
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,  133,
-       122,  161,   53, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246,   43,  242,  135,   63,  206,
-       150,   15,   62,   35, 1246,   34,    6,   96,  254,  235,
-       211, 1246,   33,   28,  143,  246, 1246, 1246,  225,   28,
-        63, 1246, 1246, 1246, 1246, 1246, 1246,  166,  222,  151,
-       147,   13,   54,  180,  175,  201,  247,   30,   50,  253,
-       117,   34,   14,   73,  216,   37,  150,   64,  253,   14,
-       200,   29,  140,  196, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246, 1246,
-      1246, 1246, 1246, 1246, 1246, 1246, 1246
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,  194,
+       166,   16,  194, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269,  183,  133,  159,  167,   58,
+       196,  110,   75,  175, 1269,   45,  118,  125,  230,  219,
+       124, 1269,   20,  139,   72,   90, 1269, 1269,   97,    7,
+       159, 1269, 1269, 1269, 1269, 1269, 1269,  111,  140,   74,
+       234,  255,   76,  242,   18,  158,  225,  164,   85,  247,
+       199,   33,   90,  104,    2,  134,  209,  108,   49,  186,
+       137,    2,   78,   25, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269, 1269,
+      1269, 1269, 1269, 1269, 1269, 1269, 1269
     };
   register int hval = len;
 
@@ -102,512 +102,512 @@ hash (register const char *str, register unsigned int len)
 
 static const struct xhtml_ent_s wordlist[] =
   {
-#line 111 "./xhtml_ent.gperf"
-    {"ensp",      	8194	, DESCR("en space; UNICODE(2002) TABLE(ISOpub)")},
-#line 220 "./xhtml_ent.gperf"
-    {"prop",      	8733	, DESCR("proportional to; UNICODE(221D) TABLE(ISOtech)")},
-#line 234 "./xhtml_ent.gperf"
-    {"le",      	8804	, DESCR("less-than or equal to; UNICODE(2264) TABLE(ISOtech)")},
-#line 232 "./xhtml_ent.gperf"
-    {"ne",      	8800	, DESCR("not equal to; UNICODE(2260) TABLE(ISOtech)")},
-#line 112 "./xhtml_ent.gperf"
-    {"emsp",      	8195	, DESCR("em space; UNICODE(2003) TABLE(ISOpub)")},
-#line 132 "./xhtml_ent.gperf"
-    {"fnof",      	402	, DESCR("latin small f with hook = function = florin; UNICODE(0192) TABLE(ISOtech)")},
-#line 12 "./xhtml_ent.gperf"
-    {"copy",      	169	, DESCR("copyright sign; UNICODE(00A9) TABLE(ISOnum)")},
-#line 235 "./xhtml_ent.gperf"
-    {"ge",      	8805	, DESCR("greater-than or equal to; UNICODE(2265) TABLE(ISOtech)")},
-#line 101 "./xhtml_ent.gperf"
-    {"lt",      	60	, DESCR(" less-than sign; UNICODE(003C) TABLE(ISOnum)")},
-#line 123 "./xhtml_ent.gperf"
-    {"ldquo",      	8220	, DESCR("left double quotation mark; UNICODE(201C) TABLE(ISOnum)")},
-#line 11 "./xhtml_ent.gperf"
-    {"uml",      	168	, DESCR("diaeresis = spacing diaeresis; UNICODE(00A8) TABLE(ISOdia)")},
+#line 204 "./xhtml_ent.gperf"
+    {"rArr",      	8658	, DESCR("rightwards double arrow; UNICODE(21D2) TABLE(ISOtech)")},
+#line 198 "./xhtml_ent.gperf"
+    {"rarr",      	8594	, DESCR("rightwards arrow; UNICODE(2192) TABLE(ISOnum)")},
+#line 206 "./xhtml_ent.gperf"
+    {"hArr",      	8660	, DESCR("left right double arrow; UNICODE(21D4) TABLE(ISOamsa)")},
+#line 200 "./xhtml_ent.gperf"
+    {"harr",      	8596	, DESCR("left right arrow; UNICODE(2194) TABLE(ISOamsa)")},
 #line 224 "./xhtml_ent.gperf"
     {"or",      	8744	, DESCR("logical or = vee; UNICODE(2228) TABLE(ISOtech)")},
-#line 16 "./xhtml_ent.gperf"
-    {"shy",      	173	, DESCR("soft hyphen = discretionary hyphen; UNICODE(00AD) TABLE(ISOnum)")},
-#line 241 "./xhtml_ent.gperf"
-    {"oplus",      	8853	, DESCR("circled plus = direct sum; UNICODE(2295) TABLE(ISOamsb)")},
+#line 202 "./xhtml_ent.gperf"
+    {"lArr",      	8656	, DESCR("leftwards double arrow; UNICODE(21D0) TABLE(ISOtech)")},
+#line 173 "./xhtml_ent.gperf"
+    {"rho",      	961	, DESCR("greek small letter rho; UNICODE(03C1) ISOgrk3")},
+#line 196 "./xhtml_ent.gperf"
+    {"larr",      	8592	, DESCR("leftwards arrow; UNICODE(2190) TABLE(ISOnum)")},
 #line 149 "./xhtml_ent.gperf"
     {"Rho",      	929	, DESCR("greek capital letter rho; UNICODE(03A1)")},
-#line 100 "./xhtml_ent.gperf"
-    {"amp",      	38	, DESCR(" ampersand; UNICODE(0026) TABLE(ISOnum)")},
-#line 243 "./xhtml_ent.gperf"
-    {"perp",      	8869	, DESCR("up tack = orthogonal to = perpendicular; UNICODE(22A5) TABLE(ISOtech)")},
-#line 8 "./xhtml_ent.gperf"
-    {"yen",      	165	, DESCR("yen sign = yuan sign; UNICODE(00A5) TABLE(ISOnum)")},
-#line 237 "./xhtml_ent.gperf"
-    {"sup",      	8835	, DESCR("superset of; UNICODE(2283) TABLE(ISOtech)")},
-#line 13 "./xhtml_ent.gperf"
-    {"ordf",      	170	, DESCR("feminine ordinal indicator; UNICODE(00AA) TABLE(ISOnum)")},
-#line 240 "./xhtml_ent.gperf"
-    {"supe",      	8839	, DESCR("superset of or equal to; UNICODE(2287) TABLE(ISOtech)")},
-#line 3 "./xhtml_ent.gperf"
-    {"nbsp",      	160	, DESCR("no-break space = non-breaking space; UNICODE(00A0) TABLE(ISOnum)")},
-#line 251 "./xhtml_ent.gperf"
-    {"loz",      	9674	, DESCR("lozenge; UNICODE(25CA) TABLE(ISOpub)")},
-#line 103 "./xhtml_ent.gperf"
-    {"apos",      	39	, DESCR(" apostrophe mark; UNICODE(0027) TABLE(ISOnum)")},
-#line 210 "./xhtml_ent.gperf"
-    {"empty",      	8709	, DESCR("empty set = null set = diameter; UNICODE(2205) TABLE(ISOamso)")},
-#line 215 "./xhtml_ent.gperf"
-    {"prod",      	8719	, DESCR("n-ary product = product sign; UNICODE(220F) TABLE(ISOamsb)")},
-#line 244 "./xhtml_ent.gperf"
-    {"sdot",      	8901	, DESCR("dot operator; UNICODE(22C5) TABLE(ISOamsb)")},
-#line 102 "./xhtml_ent.gperf"
-    {"gt",      	62	, DESCR(" greater-than sign; UNICODE(003E) TABLE(ISOnum)")},
-#line 122 "./xhtml_ent.gperf"
-    {"sbquo",      	8218	, DESCR("single low-9 quotation mark; UNICODE(201A) NEW")},
-#line 190 "./xhtml_ent.gperf"
-    {"frasl",      	8260	, DESCR("fraction slash; UNICODE(2044) NEW")},
-#line 225 "./xhtml_ent.gperf"
-    {"cap",      	8745	, DESCR("intersection = cap; UNICODE(2229) TABLE(ISOtech)")},
-#line 120 "./xhtml_ent.gperf"
-    {"lsquo",      	8216	, DESCR("left single quotation mark; UNICODE(2018) TABLE(ISOnum)")},
-#line 163 "./xhtml_ent.gperf"
-    {"eta",      	951	, DESCR("greek small letter eta; UNICODE(03B7) ISOgrk3")},
+#line 203 "./xhtml_ent.gperf"
+    {"uArr",      	8657	, DESCR("upwards double arrow; UNICODE(21D1) TABLE(ISOamsa)")},
+#line 197 "./xhtml_ent.gperf"
+    {"uarr",      	8593	, DESCR("upwards arrow; UNICODE(2191) TABLE(ISOnum)")},
+#line 12 "./xhtml_ent.gperf"
+    {"copy",      	169	, DESCR("copyright sign; UNICODE(00A9) TABLE(ISOnum)")},
 #line 144 "./xhtml_ent.gperf"
     {"Mu",      	924	, DESCR("greek capital letter mu; UNICODE(039C)")},
-#line 83 "./xhtml_ent.gperf"
-    {"eth",      	240	, DESCR("latin small letter eth; UNICODE(00F0) TABLE(ISOlat1)")},
-#line 15 "./xhtml_ent.gperf"
-    {"not",      	172	, DESCR("not sign = discretionary hyphen; UNICODE(00AC) TABLE(ISOnum)")},
+#line 132 "./xhtml_ent.gperf"
+    {"fnof",      	402	, DESCR("latin small f with hook = function = florin; UNICODE(0192) TABLE(ISOtech)")},
+#line 16 "./xhtml_ent.gperf"
+    {"shy",      	173	, DESCR("soft hyphen = discretionary hyphen; UNICODE(00AD) TABLE(ISOnum)")},
+#line 51 "./xhtml_ent.gperf"
+    {"ETH",      	208	, DESCR("latin capital letter ETH; UNICODE(00D0) TABLE(ISOlat1)")},
 #line 226 "./xhtml_ent.gperf"
     {"cup",      	8746	, DESCR("union = cup; UNICODE(222A) TABLE(ISOtech)")},
+#line 22 "./xhtml_ent.gperf"
+    {"sup3",      	179	, DESCR("superscript three = superscript digit three = cubed; UNICODE(00B3) TABLE(ISOnum)")},
+#line 201 "./xhtml_ent.gperf"
+    {"crarr",      	8629	, DESCR("downwards arrow with corner leftwards  = carriage return; UNICODE(21B5) NEW")},
+#line 251 "./xhtml_ent.gperf"
+    {"loz",      	9674	, DESCR("lozenge; UNICODE(25CA) TABLE(ISOpub)")},
+#line 243 "./xhtml_ent.gperf"
+    {"perp",      	8869	, DESCR("up tack = orthogonal to = perpendicular; UNICODE(22A5) TABLE(ISOtech)")},
 #line 169 "./xhtml_ent.gperf"
     {"nu",      	957	, DESCR("greek small letter nu; UNICODE(03BD) ISOgrk3")},
-#line 218 "./xhtml_ent.gperf"
-    {"lowast",      	8727	, DESCR("asterisk operator; UNICODE(2217) TABLE(ISOtech)")},
-#line 124 "./xhtml_ent.gperf"
-    {"rdquo",      	8221	, DESCR("right double quotation mark; UNICODE(201D) TABLE(ISOnum)")},
-#line 125 "./xhtml_ent.gperf"
-    {"bdquo",      	8222	, DESCR("double low-9 quotation mark; UNICODE(201E) NEW")},
-#line 172 "./xhtml_ent.gperf"
-    {"pi",      	960	, DESCR("greek small letter pi; UNICODE(03C0) ISOgrk3")},
-#line 252 "./xhtml_ent.gperf"
-    {"spades",      	9824	, DESCR("black spade suit; UNICODE(2660) TABLE(ISOpub)")},
-#line 14 "./xhtml_ent.gperf"
-    {"laquo",      	171	, DESCR("left-pointing double angle quotation mark = left pointing guillemet; UNICODE(00AB) TABLE(ISOnum)")},
-#line 173 "./xhtml_ent.gperf"
-    {"rho",      	961	, DESCR("greek small letter rho; UNICODE(03C1) ISOgrk3")},
-#line 151 "./xhtml_ent.gperf"
-    {"Tau",      	932	, DESCR("greek capital letter tau; UNICODE(03A4)")},
-#line 223 "./xhtml_ent.gperf"
-    {"and",      	8743	, DESCR("logical and = wedge; UNICODE(2227) TABLE(ISOtech)")},
-#line 161 "./xhtml_ent.gperf"
-    {"epsilon",      	949	, DESCR("greek small letter epsilon; UNICODE(03B5) ISOgrk3")},
-#line 176 "./xhtml_ent.gperf"
-    {"tau",      	964	, DESCR("greek small letter tau; UNICODE(03C4) ISOgrk3")},
-#line 6 "./xhtml_ent.gperf"
-    {"pound",      	163	, DESCR("pound sign; UNICODE(00A3) TABLE(ISOnum)")},
-#line 88 "./xhtml_ent.gperf"
-    {"otilde",      	245	, DESCR("latin small letter o with tilde; UNICODE(00F5) TABLE(ISOlat1)")},
-#line 245 "./xhtml_ent.gperf"
-    {"lceil",      	8968	, DESCR("left ceiling = apl upstile; UNICODE(2308) TABLE(ISOamsc)")},
-#line 191 "./xhtml_ent.gperf"
-    {"weierp",      	8472	, DESCR("script capital P = power set  = Weierstrass p; UNICODE(2118) TABLE(ISOamso)")},
-#line 38 "./xhtml_ent.gperf"
-    {"Atilde",      	195	, DESCR("latin capital letter A with tilde; UNICODE(00C3) TABLE(ISOlat1)")},
-#line 194 "./xhtml_ent.gperf"
-    {"trade",      	8482	, DESCR("trade mark sign; UNICODE(2122) TABLE(ISOnum)")},
-#line 141 "./xhtml_ent.gperf"
-    {"Iota",      	921	, DESCR("greek capital letter iota; UNICODE(0399)")},
-#line 187 "./xhtml_ent.gperf"
-    {"prime",      	8242	, DESCR("prime = minutes = feet; UNICODE(2032) TABLE(ISOtech)")},
-#line 227 "./xhtml_ent.gperf"
-    {"int",      	8747	, DESCR("integral; UNICODE(222B) TABLE(ISOtech)")},
 #line 193 "./xhtml_ent.gperf"
     {"real",      	8476	, DESCR("blackletter capital R = real part symbol; UNICODE(211C) TABLE(ISOamso)")},
-#line 239 "./xhtml_ent.gperf"
-    {"sube",      	8838	, DESCR("subset of or equal to; UNICODE(2286) TABLE(ISOtech)")},
-#line 129 "./xhtml_ent.gperf"
-    {"lsaquo",      	8249	, DESCR("single left-pointing angle quotation mark; UNICODE(2039) ISO proposed")},
-#line 10 "./xhtml_ent.gperf"
-    {"sect",      	167	, DESCR("section sign; UNICODE(00A7) TABLE(ISOnum)")},
-#line 177 "./xhtml_ent.gperf"
-    {"upsilon",      	965	, DESCR("greek small letter upsilon; UNICODE(03C5) ISOgrk3")},
-#line 186 "./xhtml_ent.gperf"
-    {"hellip",      	8230	, DESCR("horizontal ellipsis = three dot leader; UNICODE(2026) TABLE(ISOpub)")},
-#line 21 "./xhtml_ent.gperf"
-    {"sup2",      	178	, DESCR("superscript two = superscript digit two = squared; UNICODE(00B2) TABLE(ISOnum)")},
+#line 237 "./xhtml_ent.gperf"
+    {"sup",      	8835	, DESCR("superset of; UNICODE(2283) TABLE(ISOtech)")},
 #line 131 "./xhtml_ent.gperf"
     {"euro",      	8364	, DESCR(" euro sign; UNICODE(20AC) NEW")},
-#line 207 "./xhtml_ent.gperf"
-    {"forall",      	8704	, DESCR("for all; UNICODE(2200) TABLE(ISOtech)")},
-#line 23 "./xhtml_ent.gperf"
-    {"acute",      	180	, DESCR("acute accent = spacing acute; UNICODE(00B4) TABLE(ISOdia)")},
-#line 222 "./xhtml_ent.gperf"
-    {"ang",      	8736	, DESCR("angle; UNICODE(2220) TABLE(ISOamso)")},
-#line 19 "./xhtml_ent.gperf"
-    {"deg",      	176	, DESCR("degree sign; UNICODE(00B0) TABLE(ISOnum)")},
-#line 214 "./xhtml_ent.gperf"
-    {"ni",      	8715	, DESCR("contains as member; UNICODE(220B) TABLE(ISOtech)")},
-#line 180 "./xhtml_ent.gperf"
-    {"psi",      	968	, DESCR("greek small letter psi; UNICODE(03C8) ISOgrk3")},
-#line 247 "./xhtml_ent.gperf"
-    {"lfloor",      	8970	, DESCR("left floor = apl downstile; UNICODE(230A) TABLE(ISOamsc)")},
-#line 168 "./xhtml_ent.gperf"
-    {"mu",      	956	, DESCR("greek small letter mu; UNICODE(03BC) ISOgrk3")},
+#line 205 "./xhtml_ent.gperf"
+    {"dArr",      	8659	, DESCR("downwards double arrow; UNICODE(21D3) TABLE(ISOamsa)")},
+#line 199 "./xhtml_ent.gperf"
+    {"darr",      	8595	, DESCR("downwards arrow; UNICODE(2193) TABLE(ISOnum)")},
 #line 145 "./xhtml_ent.gperf"
     {"Nu",      	925	, DESCR("greek capital letter nu; UNICODE(039D)")},
-#line 28 "./xhtml_ent.gperf"
-    {"sup1",      	185	, DESCR("superscript one = superscript digit one; UNICODE(00B9) TABLE(ISOnum)")},
-#line 121 "./xhtml_ent.gperf"
-    {"rsquo",      	8217	, DESCR("right single quotation mark; UNICODE(2019) TABLE(ISOnum)")},
-#line 51 "./xhtml_ent.gperf"
-    {"ETH",      	208	, DESCR("latin capital letter ETH; UNICODE(00D0) TABLE(ISOlat1)")},
-#line 209 "./xhtml_ent.gperf"
-    {"exist",      	8707	, DESCR("there exists; UNICODE(2203) TABLE(ISOtech)")},
-#line 116 "./xhtml_ent.gperf"
-    {"lrm",      	8206	, DESCR("left-to-right mark; UNICODE(200E) NEW TABLE(RFC2070)")},
-#line 84 "./xhtml_ent.gperf"
-    {"ntilde",      	241	, DESCR("latin small letter n with tilde; UNICODE(00F1) TABLE(ISOlat1)")},
-#line 31 "./xhtml_ent.gperf"
-    {"frac14",      	188	, DESCR("vulgar fraction one quarter = fraction one quarter; UNICODE(00BC) TABLE(ISOnum)")},
-#line 138 "./xhtml_ent.gperf"
-    {"Zeta",      	918	, DESCR("greek capital letter zeta; UNICODE(0396)")},
 #line 139 "./xhtml_ent.gperf"
     {"Eta",      	919	, DESCR("greek capital letter eta; UNICODE(0397)")},
-#line 242 "./xhtml_ent.gperf"
-    {"otimes",      	8855	, DESCR("circled times = vector product; UNICODE(2297) TABLE(ISOamsb)")},
-#line 166 "./xhtml_ent.gperf"
-    {"kappa",      	954	, DESCR("greek small letter kappa; UNICODE(03BA) ISOgrk3")},
-#line 91 "./xhtml_ent.gperf"
-    {"oslash",      	248	, DESCR("latin small letter o with stroke; = latin small letter o slash; UNICODE(00F8) TABLE(ISOlat1)")},
-#line 76 "./xhtml_ent.gperf"
-    {"eacute",      	233	, DESCR("latin small letter e with acute; UNICODE(00E9) TABLE(ISOlat1)")},
-#line 178 "./xhtml_ent.gperf"
-    {"phi",      	966	, DESCR("greek small letter phi; UNICODE(03C6) ISOgrk3")},
-#line 142 "./xhtml_ent.gperf"
-    {"Kappa",      	922	, DESCR("greek capital letter kappa; UNICODE(039A)")},
-#line 78 "./xhtml_ent.gperf"
-    {"euml",      	235	, DESCR("latin small letter e with diaeresis; UNICODE(00EB) TABLE(ISOlat1)")},
-#line 110 "./xhtml_ent.gperf"
-    {"tilde",      	732	, DESCR(" small tilde; UNICODE(02DC) TABLE(ISOdia)")},
-#line 5 "./xhtml_ent.gperf"
-    {"cent",      	162	, DESCR("cent sign; UNICODE(00A2) TABLE(ISOnum)")},
-#line 33 "./xhtml_ent.gperf"
-    {"frac34",      	190	, DESCR("vulgar fraction three quarters = fraction three quarters; UNICODE(00BE) TABLE(ISOnum)")},
+#line 225 "./xhtml_ent.gperf"
+    {"cap",      	8745	, DESCR("intersection = cap; UNICODE(2229) TABLE(ISOtech)")},
+#line 83 "./xhtml_ent.gperf"
+    {"eth",      	240	, DESCR("latin small letter eth; UNICODE(00F0) TABLE(ISOlat1)")},
+#line 248 "./xhtml_ent.gperf"
+    {"rfloor",      	8971	, DESCR("right floor; UNICODE(230B) TABLE(ISOamsc)")},
+#line 101 "./xhtml_ent.gperf"
+    {"lt",      	60	, DESCR(" less-than sign; UNICODE(003C) TABLE(ISOnum)")},
+#line 168 "./xhtml_ent.gperf"
+    {"mu",      	956	, DESCR("greek small letter mu; UNICODE(03BC) ISOgrk3")},
+#line 184 "./xhtml_ent.gperf"
+    {"piv",      	982	, DESCR("greek pi symbol; UNICODE(03D6) ISOgrk3")},
+#line 234 "./xhtml_ent.gperf"
+    {"le",      	8804	, DESCR("less-than or equal to; UNICODE(2264) TABLE(ISOtech)")},
+#line 30 "./xhtml_ent.gperf"
+    {"raquo",      	187	, DESCR("right-pointing double angle quotation mark = right pointing guillemet; UNICODE(00BB) TABLE(ISOnum)")},
+#line 151 "./xhtml_ent.gperf"
+    {"Tau",      	932	, DESCR("greek capital letter tau; UNICODE(03A4)")},
+#line 220 "./xhtml_ent.gperf"
+    {"prop",      	8733	, DESCR("proportional to; UNICODE(221D) TABLE(ISOtech)")},
 #line 185 "./xhtml_ent.gperf"
     {"bull",      	8226	, DESCR("bullet = black small circle; UNICODE(2022) TABLE(ISOpub)")},
-#line 22 "./xhtml_ent.gperf"
-    {"sup3",      	179	, DESCR("superscript three = superscript digit three = cubed; UNICODE(00B3) TABLE(ISOnum)")},
-#line 231 "./xhtml_ent.gperf"
-    {"asymp",      	8776	, DESCR("almost equal to = asymptotic to; UNICODE(2248) ISOamsr")},
-#line 17 "./xhtml_ent.gperf"
-    {"reg",      	174	, DESCR("registered sign = registered trade mark sign; UNICODE(00AE) TABLE(ISOnum)")},
-#line 64 "./xhtml_ent.gperf"
-    {"Yacute",      	221	, DESCR("latin capital letter Y with acute; UNICODE(00DD) TABLE(ISOlat1)")},
-#line 96 "./xhtml_ent.gperf"
-    {"yacute",      	253	, DESCR("latin small letter y with acute; UNICODE(00FD) TABLE(ISOlat1)")},
-#line 189 "./xhtml_ent.gperf"
-    {"oline",      	8254	, DESCR("overline = spacing overscore; UNICODE(203E) NEW")},
-#line 108 "./xhtml_ent.gperf"
-    {"Yuml",      	376	, DESCR(" latin capital letter Y with diaeresis; UNICODE(0178) TABLE(ISOlat2)")},
+#line 109 "./xhtml_ent.gperf"
+    {"circ",      	710	, DESCR(" modifier letter circumflex accent; UNICODE(02C6) TABLE(ISOpub)")},
+#line 207 "./xhtml_ent.gperf"
+    {"forall",      	8704	, DESCR("for all; UNICODE(2200) TABLE(ISOtech)")},
+#line 25 "./xhtml_ent.gperf"
+    {"para",      	182	, DESCR("pilcrow sign = paragraph sign; UNICODE(00B6) TABLE(ISOnum)")},
+#line 236 "./xhtml_ent.gperf"
+    {"sub",      	8834	, DESCR("subset of; UNICODE(2282) TABLE(ISOtech)")},
+#line 18 "./xhtml_ent.gperf"
+    {"macr",      	175	, DESCR("macron = spacing macron = overline = APL overbar; UNICODE(00AF) TABLE(ISOdia)")},
 #line 98 "./xhtml_ent.gperf"
     {"yuml",      	255	, DESCR("latin small letter y with diaeresis; UNICODE(00FF) TABLE(ISOlat1)")},
-#line 86 "./xhtml_ent.gperf"
-    {"oacute",      	243	, DESCR("latin small letter o with acute; UNICODE(00F3) TABLE(ISOlat1)")},
-#line 48 "./xhtml_ent.gperf"
-    {"Iacute",      	205	, DESCR("latin capital letter I with acute; UNICODE(00CD) TABLE(ISOlat1)")},
+#line 85 "./xhtml_ent.gperf"
+    {"ograve",      	242	, DESCR("latin small letter o with grave; UNICODE(00F2) TABLE(ISOlat1)")},
+#line 172 "./xhtml_ent.gperf"
+    {"pi",      	960	, DESCR("greek small letter pi; UNICODE(03C0) ISOgrk3")},
+#line 108 "./xhtml_ent.gperf"
+    {"Yuml",      	376	, DESCR(" latin capital letter Y with diaeresis; UNICODE(0178) TABLE(ISOlat2)")},
+#line 8 "./xhtml_ent.gperf"
+    {"yen",      	165	, DESCR("yen sign = yuan sign; UNICODE(00A5) TABLE(ISOnum)")},
+#line 11 "./xhtml_ent.gperf"
+    {"uml",      	168	, DESCR("diaeresis = spacing diaeresis; UNICODE(00A8) TABLE(ISOdia)")},
+#line 146 "./xhtml_ent.gperf"
+    {"Xi",      	926	, DESCR("greek capital letter xi; UNICODE(039E) ISOgrk3")},
+#line 247 "./xhtml_ent.gperf"
+    {"lfloor",      	8970	, DESCR("left floor = apl downstile; UNICODE(230A) TABLE(ISOamsc)")},
+#line 122 "./xhtml_ent.gperf"
+    {"sbquo",      	8218	, DESCR("single low-9 quotation mark; UNICODE(201A) NEW")},
+#line 100 "./xhtml_ent.gperf"
+    {"amp",      	38	, DESCR(" ampersand; UNICODE(0026) TABLE(ISOnum)")},
+#line 121 "./xhtml_ent.gperf"
+    {"rsquo",      	8217	, DESCR("right single quotation mark; UNICODE(2019) TABLE(ISOnum)")},
+#line 43 "./xhtml_ent.gperf"
+    {"Egrave",      	200	, DESCR("latin capital letter E with grave; UNICODE(00C8) TABLE(ISOlat1)")},
 #line 89 "./xhtml_ent.gperf"
     {"ouml",      	246	, DESCR("latin small letter o with diaeresis; UNICODE(00F6) TABLE(ISOlat1)")},
-#line 50 "./xhtml_ent.gperf"
-    {"Iuml",      	207	, DESCR("latin capital letter I with diaeresis; UNICODE(00CF) TABLE(ISOlat1)")},
-#line 230 "./xhtml_ent.gperf"
-    {"cong",      	8773	, DESCR("approximately equal to; UNICODE(2245) TABLE(ISOtech)")},
-#line 70 "./xhtml_ent.gperf"
-    {"atilde",      	227	, DESCR("latin small letter a with tilde; UNICODE(00E3) TABLE(ISOlat1)")},
-#line 30 "./xhtml_ent.gperf"
-    {"raquo",      	187	, DESCR("right-pointing double angle quotation mark = right pointing guillemet; UNICODE(00BB) TABLE(ISOnum)")},
-#line 36 "./xhtml_ent.gperf"
-    {"Aacute",      	193	, DESCR("latin capital letter A with acute; UNICODE(00C1) TABLE(ISOlat1)")},
-#line 170 "./xhtml_ent.gperf"
-    {"xi",      	958	, DESCR("greek small letter xi; UNICODE(03BE) ISOgrk3")},
-#line 228 "./xhtml_ent.gperf"
-    {"there4",      	8756	, DESCR("therefore; UNICODE(2234) TABLE(ISOtech)")},
-#line 39 "./xhtml_ent.gperf"
-    {"Auml",      	196	, DESCR("latin capital letter A with diaeresis; UNICODE(00C4) TABLE(ISOlat1)")},
-#line 136 "./xhtml_ent.gperf"
-    {"Delta",      	916	, DESCR("greek capital letter delta; UNICODE(0394) ISOgrk3")},
-#line 27 "./xhtml_ent.gperf"
-    {"cedil",      	184	, DESCR("cedilla = spacing cedilla; UNICODE(00B8) TABLE(ISOdia)")},
+#line 14 "./xhtml_ent.gperf"
+    {"laquo",      	171	, DESCR("left-pointing double angle quotation mark = left pointing guillemet; UNICODE(00AB) TABLE(ISOnum)")},
 #line 148 "./xhtml_ent.gperf"
     {"Pi",      	928	, DESCR("greek capital letter pi; UNICODE(03A0) ISOgrk3")},
-#line 99 "./xhtml_ent.gperf"
-    {"quot",      	34	, DESCR(" quotation mark = APL quote; UNICODE(0022) TABLE(ISOnum)")},
-#line 32 "./xhtml_ent.gperf"
-    {"frac12",      	189	, DESCR("vulgar fraction one half = fraction one half; UNICODE(00BD) TABLE(ISOnum)")},
-#line 93 "./xhtml_ent.gperf"
-    {"uacute",      	250	, DESCR("latin small letter u with acute; UNICODE(00FA) TABLE(ISOlat1)")},
+#line 186 "./xhtml_ent.gperf"
+    {"hellip",      	8230	, DESCR("horizontal ellipsis = three dot leader; UNICODE(2026) TABLE(ISOpub)")},
+#line 103 "./xhtml_ent.gperf"
+    {"apos",      	39	, DESCR(" apostrophe mark; UNICODE(0027) TABLE(ISOnum)")},
+#line 170 "./xhtml_ent.gperf"
+    {"xi",      	958	, DESCR("greek small letter xi; UNICODE(03BE) ISOgrk3")},
+#line 46 "./xhtml_ent.gperf"
+    {"Euml",      	203	, DESCR("latin capital letter E with diaeresis; UNICODE(00CB) TABLE(ISOlat1)")},
+#line 60 "./xhtml_ent.gperf"
+    {"Ugrave",      	217	, DESCR("latin capital letter U with grave; UNICODE(00D9) TABLE(ISOlat1)")},
+#line 232 "./xhtml_ent.gperf"
+    {"ne",      	8800	, DESCR("not equal to; UNICODE(2260) TABLE(ISOtech)")},
+#line 124 "./xhtml_ent.gperf"
+    {"rdquo",      	8221	, DESCR("right double quotation mark; UNICODE(201D) TABLE(ISOnum)")},
+#line 183 "./xhtml_ent.gperf"
+    {"upsih",      	978	, DESCR("greek upsilon with hook symbol; UNICODE(03D2) NEW")},
+#line 92 "./xhtml_ent.gperf"
+    {"ugrave",      	249	, DESCR("latin small letter u with grave; UNICODE(00F9) TABLE(ISOlat1)")},
+#line 179 "./xhtml_ent.gperf"
+    {"chi",      	967	, DESCR("greek small letter chi; UNICODE(03C7) ISOgrk3")},
+#line 67 "./xhtml_ent.gperf"
+    {"agrave",      	224	, DESCR("latin small letter a with grave = latin small letter a grave; UNICODE(00E0) TABLE(ISOlat1)")},
+#line 254 "./xhtml_ent.gperf"
+    {"hearts",      	9829	, DESCR("black heart suit = valentine; UNICODE(2665) TABLE(ISOpub)")},
+#line 13 "./xhtml_ent.gperf"
+    {"ordf",      	170	, DESCR("feminine ordinal indicator; UNICODE(00AA) TABLE(ISOnum)")},
+#line 63 "./xhtml_ent.gperf"
+    {"Uuml",      	220	, DESCR("latin capital letter U with diaeresis; UNICODE(00DC) TABLE(ISOlat1)")},
+#line 102 "./xhtml_ent.gperf"
+    {"gt",      	62	, DESCR(" greater-than sign; UNICODE(003E) TABLE(ISOnum)")},
+#line 17 "./xhtml_ent.gperf"
+    {"reg",      	174	, DESCR("registered sign = registered trade mark sign; UNICODE(00AE) TABLE(ISOnum)")},
+#line 178 "./xhtml_ent.gperf"
+    {"phi",      	966	, DESCR("greek small letter phi; UNICODE(03C6) ISOgrk3")},
+#line 176 "./xhtml_ent.gperf"
+    {"tau",      	964	, DESCR("greek small letter tau; UNICODE(03C4) ISOgrk3")},
+#line 130 "./xhtml_ent.gperf"
+    {"rsaquo",      	8250	, DESCR("single right-pointing angle quotation mark; UNICODE(203A) ISO proposed")},
+#line 235 "./xhtml_ent.gperf"
+    {"ge",      	8805	, DESCR("greater-than or equal to; UNICODE(2265) TABLE(ISOtech)")},
+#line 120 "./xhtml_ent.gperf"
+    {"lsquo",      	8216	, DESCR("left single quotation mark; UNICODE(2018) TABLE(ISOnum)")},
 #line 95 "./xhtml_ent.gperf"
     {"uuml",      	252	, DESCR("latin small letter u with diaeresis; UNICODE(00FC) TABLE(ISOlat1)")},
-#line 146 "./xhtml_ent.gperf"
-    {"Xi",      	926	, DESCR("greek capital letter xi; UNICODE(039E) ISOgrk3")},
+#line 87 "./xhtml_ent.gperf"
+    {"ocirc",      	244	, DESCR("latin small letter o with circumflex; UNICODE(00F4) TABLE(ISOlat1)")},
+#line 71 "./xhtml_ent.gperf"
+    {"auml",      	228	, DESCR("latin small letter a with diaeresis; UNICODE(00E4) TABLE(ISOlat1)")},
+#line 9 "./xhtml_ent.gperf"
+    {"brvbar",      	166	, DESCR("broken bar = broken vertical bar; UNICODE(00A6) TABLE(ISOnum)")},
+#line 214 "./xhtml_ent.gperf"
+    {"ni",      	8715	, DESCR("contains as member; UNICODE(220B) TABLE(ISOtech)")},
+#line 7 "./xhtml_ent.gperf"
+    {"curren",      	164	, DESCR("currency sign; UNICODE(00A4) TABLE(ISOnum)")},
+#line 163 "./xhtml_ent.gperf"
+    {"eta",      	951	, DESCR("greek small letter eta; UNICODE(03B7) ISOgrk3")},
 #line 162 "./xhtml_ent.gperf"
     {"zeta",      	950	, DESCR("greek small letter zeta; UNICODE(03B6) ISOgrk3")},
-#line 181 "./xhtml_ent.gperf"
-    {"omega",      	969	, DESCR("greek small letter omega; UNICODE(03C9) ISOgrk3")},
-#line 246 "./xhtml_ent.gperf"
-    {"rceil",      	8969	, DESCR("right ceiling; UNICODE(2309) TABLE(ISOamsc)")},
-#line 34 "./xhtml_ent.gperf"
-    {"iquest",      	191	, DESCR("inverted question mark = turned question mark; UNICODE(00BF) TABLE(ISOnum)")},
-#line 118 "./xhtml_ent.gperf"
-    {"ndash",      	8211	, DESCR("en dash; UNICODE(2013) TABLE(ISOpub)")},
-#line 137 "./xhtml_ent.gperf"
-    {"Epsilon",      	917	, DESCR("greek capital letter epsilon; UNICODE(0395)")},
-#line 192 "./xhtml_ent.gperf"
-    {"image",      	8465	, DESCR("blackletter capital I = imaginary part; UNICODE(2111) TABLE(ISOamso)")},
-#line 42 "./xhtml_ent.gperf"
-    {"Ccedil",      	199	, DESCR("latin capital letter C with cedilla; UNICODE(00C7) TABLE(ISOlat1)")},
-#line 165 "./xhtml_ent.gperf"
-    {"iota",      	953	, DESCR("greek small letter iota; UNICODE(03B9) ISOgrk3")},
-#line 105 "./xhtml_ent.gperf"
-    {"oelig",      	339	, DESCR(" latin small ligature oe; UNICODE(0153) TABLE(ISOlat2)")},
-#line 130 "./xhtml_ent.gperf"
-    {"rsaquo",      	8250	, DESCR("single right-pointing angle quotation mark; UNICODE(203A) ISO proposed")},
+#line 3 "./xhtml_ent.gperf"
+    {"nbsp",      	160	, DESCR("no-break space = non-breaking space; UNICODE(00A0) TABLE(ISOnum)")},
+#line 142 "./xhtml_ent.gperf"
+    {"Kappa",      	922	, DESCR("greek capital letter kappa; UNICODE(039A)")},
+#line 91 "./xhtml_ent.gperf"
+    {"oslash",      	248	, DESCR("latin small letter o with stroke; = latin small letter o slash; UNICODE(00F8) TABLE(ISOlat1)")},
+#line 79 "./xhtml_ent.gperf"
+    {"igrave",      	236	, DESCR("latin small letter i with grave; UNICODE(00EC) TABLE(ISOlat1)")},
+#line 153 "./xhtml_ent.gperf"
+    {"Phi",      	934	, DESCR("greek capital letter phi; UNICODE(03A6) ISOgrk3")},
+#line 241 "./xhtml_ent.gperf"
+    {"oplus",      	8853	, DESCR("circled plus = direct sum; UNICODE(2295) TABLE(ISOamsb)")},
+#line 45 "./xhtml_ent.gperf"
+    {"Ecirc",      	202	, DESCR("latin capital letter E with circumflex; UNICODE(00CA) TABLE(ISOlat1)")},
+#line 111 "./xhtml_ent.gperf"
+    {"ensp",      	8194	, DESCR("en space; UNICODE(2002) TABLE(ISOpub)")},
+#line 99 "./xhtml_ent.gperf"
+    {"quot",      	34	, DESCR(" quotation mark = APL quote; UNICODE(0022) TABLE(ISOnum)")},
+#line 21 "./xhtml_ent.gperf"
+    {"sup2",      	178	, DESCR("superscript two = superscript digit two = squared; UNICODE(00B2) TABLE(ISOnum)")},
+#line 33 "./xhtml_ent.gperf"
+    {"frac34",      	190	, DESCR("vulgar fraction three quarters = fraction three quarters; UNICODE(00BE) TABLE(ISOnum)")},
+#line 227 "./xhtml_ent.gperf"
+    {"int",      	8747	, DESCR("integral; UNICODE(222B) TABLE(ISOtech)")},
+#line 223 "./xhtml_ent.gperf"
+    {"and",      	8743	, DESCR("logical and = wedge; UNICODE(2227) TABLE(ISOtech)")},
+#line 47 "./xhtml_ent.gperf"
+    {"Igrave",      	204	, DESCR("latin capital letter I with grave; UNICODE(00CC) TABLE(ISOlat1)")},
+#line 180 "./xhtml_ent.gperf"
+    {"psi",      	968	, DESCR("greek small letter psi; UNICODE(03C8) ISOgrk3")},
+#line 24 "./xhtml_ent.gperf"
+    {"micro",      	181	, DESCR("micro sign; UNICODE(00B5) TABLE(ISOnum)")},
 #line 4 "./xhtml_ent.gperf"
     {"iexcl",      	161	, DESCR("inverted exclamation mark; UNICODE(00A1) TABLE(ISOnum)")},
-#line 106 "./xhtml_ent.gperf"
-    {"Scaron",      	352	, DESCR(" latin capital letter S with caron; UNICODE(0160) TABLE(ISOlat2)")},
-#line 74 "./xhtml_ent.gperf"
-    {"ccedil",      	231	, DESCR("latin small letter c with cedilla; UNICODE(00E7) TABLE(ISOlat1)")},
-#line 56 "./xhtml_ent.gperf"
-    {"Otilde",      	213	, DESCR("latin capital letter O with tilde; UNICODE(00D5) TABLE(ISOlat1)")},
-#line 213 "./xhtml_ent.gperf"
-    {"notin",      	8713	, DESCR("not an element of; UNICODE(2209) TABLE(ISOtech)")},
-#line 107 "./xhtml_ent.gperf"
-    {"scaron",      	353	, DESCR(" latin small letter s with caron; UNICODE(0161) TABLE(ISOlat2)")},
-#line 113 "./xhtml_ent.gperf"
-    {"thinsp",      	8201	, DESCR("thin space; UNICODE(2009) TABLE(ISOpub)")},
-#line 29 "./xhtml_ent.gperf"
-    {"ordm",      	186	, DESCR("masculine ordinal indicator; UNICODE(00BA) TABLE(ISOnum)")},
-#line 221 "./xhtml_ent.gperf"
-    {"infin",      	8734	, DESCR("infinity; UNICODE(221E) TABLE(ISOtech)")},
-#line 183 "./xhtml_ent.gperf"
-    {"upsih",      	978	, DESCR("greek upsilon with hook symbol; UNICODE(03D2) NEW")},
-#line 152 "./xhtml_ent.gperf"
-    {"Upsilon",      	933	, DESCR("greek capital letter upsilon; UNICODE(03A5) ISOgrk3")},
-#line 188 "./xhtml_ent.gperf"
-    {"Prime",      	8243	, DESCR("double prime = seconds = inches; UNICODE(2033) TABLE(ISOtech)")},
-#line 52 "./xhtml_ent.gperf"
-    {"Ntilde",      	209	, DESCR("latin capital letter N with tilde; UNICODE(00D1) TABLE(ISOlat1)")},
-#line 248 "./xhtml_ent.gperf"
-    {"rfloor",      	8971	, DESCR("right floor; UNICODE(230B) TABLE(ISOamsc)")},
-#line 236 "./xhtml_ent.gperf"
-    {"sub",      	8834	, DESCR("subset of; UNICODE(2282) TABLE(ISOtech)")},
-#line 160 "./xhtml_ent.gperf"
-    {"delta",      	948	, DESCR("greek small letter delta; UNICODE(03B4) ISOgrk3")},
+#line 123 "./xhtml_ent.gperf"
+    {"ldquo",      	8220	, DESCR("left double quotation mark; UNICODE(201C) TABLE(ISOnum)")},
+#line 35 "./xhtml_ent.gperf"
+    {"Agrave",      	192	, DESCR("latin capital letter A with grave = latin capital letter A grave; UNICODE(00C0) TABLE(ISOlat1)")},
+#line 233 "./xhtml_ent.gperf"
+    {"equiv",      	8801	, DESCR("identical to; UNICODE(2261) TABLE(ISOtech)")},
+#line 82 "./xhtml_ent.gperf"
+    {"iuml",      	239	, DESCR("latin small letter i with diaeresis; UNICODE(00EF) TABLE(ISOlat1)")},
+#line 190 "./xhtml_ent.gperf"
+    {"frasl",      	8260	, DESCR("fraction slash; UNICODE(2044) NEW")},
+#line 222 "./xhtml_ent.gperf"
+    {"ang",      	8736	, DESCR("angle; UNICODE(2220) TABLE(ISOamso)")},
 #line 154 "./xhtml_ent.gperf"
     {"Chi",      	935	, DESCR("greek capital letter chi; UNICODE(03A7)")},
-#line 58 "./xhtml_ent.gperf"
-    {"times",      	215	, DESCR("multiplication sign; UNICODE(00D7) TABLE(ISOnum)")},
-#line 20 "./xhtml_ent.gperf"
-    {"plusmn",      	177	, DESCR("plus-minus sign = plus-or-minus sign; UNICODE(00B1) TABLE(ISOnum)")},
-#line 249 "./xhtml_ent.gperf"
-    {"lang",      	9001	, DESCR("left-pointing angle bracket = bra; UNICODE(2329) TABLE(ISOtech)")},
-#line 208 "./xhtml_ent.gperf"
-    {"part",      	8706	, DESCR("partial differential; UNICODE(2202) TABLE(ISOtech)")},
-#line 179 "./xhtml_ent.gperf"
-    {"chi",      	967	, DESCR("greek small letter chi; UNICODE(03C7) ISOgrk3")},
-#line 217 "./xhtml_ent.gperf"
-    {"minus",      	8722	, DESCR("minus sign; UNICODE(2212) TABLE(ISOtech)")},
+#line 62 "./xhtml_ent.gperf"
+    {"Ucirc",      	219	, DESCR("latin capital letter U with circumflex; UNICODE(00DB) TABLE(ISOlat1)")},
+#line 134 "./xhtml_ent.gperf"
+    {"Beta",      	914	, DESCR("greek capital letter beta; UNICODE(0392)")},
+#line 50 "./xhtml_ent.gperf"
+    {"Iuml",      	207	, DESCR("latin capital letter I with diaeresis; UNICODE(00CF) TABLE(ISOlat1)")},
 #line 158 "./xhtml_ent.gperf"
     {"beta",      	946	, DESCR("greek small letter beta; UNICODE(03B2) ISOgrk3")},
-#line 40 "./xhtml_ent.gperf"
-    {"Aring",      	197	, DESCR("latin capital letter A with ring above = latin capital letter A ring; UNICODE(00C5) TABLE(ISOlat1)")},
 #line 155 "./xhtml_ent.gperf"
     {"Psi",      	936	, DESCR("greek capital letter psi; UNICODE(03A8) ISOgrk3")},
-#line 253 "./xhtml_ent.gperf"
-    {"clubs",      	9827	, DESCR("black club suit = shamrock; UNICODE(2663) TABLE(ISOpub)")},
-#line 184 "./xhtml_ent.gperf"
-    {"piv",      	982	, DESCR("greek pi symbol; UNICODE(03D6) ISOgrk3")},
-#line 68 "./xhtml_ent.gperf"
-    {"aacute",      	225	, DESCR("latin small letter a with acute; UNICODE(00E1) TABLE(ISOlat1)")},
-#line 71 "./xhtml_ent.gperf"
-    {"auml",      	228	, DESCR("latin small letter a with diaeresis; UNICODE(00E4) TABLE(ISOlat1)")},
-#line 238 "./xhtml_ent.gperf"
-    {"nsub",      	8836	, DESCR("not a subset of; UNICODE(2284) ISOamsn")},
-#line 134 "./xhtml_ent.gperf"
-    {"Beta",      	914	, DESCR("greek capital letter beta; UNICODE(0392)")},
-#line 195 "./xhtml_ent.gperf"
-    {"alefsym",      	8501	, DESCR("alef symbol = first transfinite cardinal; UNICODE(2135) NEW")},
-#line 25 "./xhtml_ent.gperf"
-    {"para",      	182	, DESCR("pilcrow sign = paragraph sign; UNICODE(00B6) TABLE(ISOnum)")},
-#line 212 "./xhtml_ent.gperf"
-    {"isin",      	8712	, DESCR("element of; UNICODE(2208) TABLE(ISOtech)")},
-#line 229 "./xhtml_ent.gperf"
-    {"sim",      	8764	, DESCR("tilde operator = varies with = similar to; UNICODE(223C) TABLE(ISOtech)")},
+#line 39 "./xhtml_ent.gperf"
+    {"Auml",      	196	, DESCR("latin capital letter A with diaeresis; UNICODE(00C4) TABLE(ISOlat1)")},
+#line 208 "./xhtml_ent.gperf"
+    {"part",      	8706	, DESCR("partial differential; UNICODE(2202) TABLE(ISOtech)")},
+#line 94 "./xhtml_ent.gperf"
+    {"ucirc",      	251	, DESCR("latin small letter u with circumflex; UNICODE(00FB) TABLE(ISOlat1)")},
+#line 129 "./xhtml_ent.gperf"
+    {"lsaquo",      	8249	, DESCR("single left-pointing angle quotation mark; UNICODE(2039) ISO proposed")},
+#line 69 "./xhtml_ent.gperf"
+    {"acirc",      	226	, DESCR("latin small letter a with circumflex; UNICODE(00E2) TABLE(ISOlat1)")},
+#line 53 "./xhtml_ent.gperf"
+    {"Ograve",      	210	, DESCR("latin capital letter O with grave; UNICODE(00D2) TABLE(ISOlat1)")},
 #line 128 "./xhtml_ent.gperf"
     {"permil",      	8240	, DESCR("per mille sign; UNICODE(2030) TABLE(ISOtech)")},
+#line 28 "./xhtml_ent.gperf"
+    {"sup1",      	185	, DESCR("superscript one = superscript digit one; UNICODE(00B9) TABLE(ISOnum)")},
+#line 115 "./xhtml_ent.gperf"
+    {"zwj",      	8205	, DESCR("zero width joiner; UNICODE(200D) NEW TABLE(RFC2070)")},
+#line 138 "./xhtml_ent.gperf"
+    {"Zeta",      	918	, DESCR("greek capital letter zeta; UNICODE(0396)")},
+#line 171 "./xhtml_ent.gperf"
+    {"omicron",      	959	, DESCR("greek small letter omicron; UNICODE(03BF) NEW")},
+#line 125 "./xhtml_ent.gperf"
+    {"bdquo",      	8222	, DESCR("double low-9 quotation mark; UNICODE(201E) NEW")},
 #line 216 "./xhtml_ent.gperf"
     {"sum",      	8721	, DESCR("n-ary sumation; UNICODE(2211) TABLE(ISOamsb)")},
-#line 254 "./xhtml_ent.gperf"
-    {"hearts",      	9829	, DESCR("black heart suit = valentine; UNICODE(2665) TABLE(ISOpub)")},
-#line 80 "./xhtml_ent.gperf"
-    {"iacute",      	237	, DESCR("latin small letter i with acute; UNICODE(00ED) TABLE(ISOlat1)")},
-#line 41 "./xhtml_ent.gperf"
-    {"AElig",      	198	, DESCR("latin capital letter AE = latin capital ligature AE; UNICODE(00C6) TABLE(ISOlat1)")},
-#line 82 "./xhtml_ent.gperf"
-    {"iuml",      	239	, DESCR("latin small letter i with diaeresis; UNICODE(00EF) TABLE(ISOlat1)")},
-#line 44 "./xhtml_ent.gperf"
-    {"Eacute",      	201	, DESCR("latin capital letter E with acute; UNICODE(00C9) TABLE(ISOlat1)")},
-#line 46 "./xhtml_ent.gperf"
-    {"Euml",      	203	, DESCR("latin capital letter E with diaeresis; UNICODE(00CB) TABLE(ISOlat1)")},
-#line 153 "./xhtml_ent.gperf"
-    {"Phi",      	934	, DESCR("greek capital letter phi; UNICODE(03A6) ISOgrk3")},
-#line 59 "./xhtml_ent.gperf"
-    {"Oslash",      	216	, DESCR("latin capital letter O with stroke = latin capital letter O slash; UNICODE(00D8) TABLE(ISOlat1)")},
+#line 165 "./xhtml_ent.gperf"
+    {"iota",      	953	, DESCR("greek small letter iota; UNICODE(03B9) ISOgrk3")},
+#line 219 "./xhtml_ent.gperf"
+    {"radic",      	8730	, DESCR("square root = radical sign; UNICODE(221A) TABLE(ISOtech)")},
+#line 57 "./xhtml_ent.gperf"
+    {"Ouml",      	214	, DESCR("latin capital letter O with diaeresis; UNICODE(00D6) TABLE(ISOlat1)")},
+#line 157 "./xhtml_ent.gperf"
+    {"alpha",      	945	, DESCR("greek small letter alpha; UNICODE(03B1) ISOgrk3")},
+#line 75 "./xhtml_ent.gperf"
+    {"egrave",      	232	, DESCR("latin small letter e with grave; UNICODE(00E8) TABLE(ISOlat1)")},
+#line 141 "./xhtml_ent.gperf"
+    {"Iota",      	921	, DESCR("greek capital letter iota; UNICODE(0399)")},
+#line 81 "./xhtml_ent.gperf"
+    {"icirc",      	238	, DESCR("latin small letter i with circumflex; UNICODE(00EE) TABLE(ISOlat1)")},
+#line 10 "./xhtml_ent.gperf"
+    {"sect",      	167	, DESCR("section sign; UNICODE(00A7) TABLE(ISOnum)")},
+#line 15 "./xhtml_ent.gperf"
+    {"not",      	172	, DESCR("not sign = discretionary hyphen; UNICODE(00AC) TABLE(ISOnum)")},
+#line 166 "./xhtml_ent.gperf"
+    {"kappa",      	954	, DESCR("greek small letter kappa; UNICODE(03BA) ISOgrk3")},
+#line 116 "./xhtml_ent.gperf"
+    {"lrm",      	8206	, DESCR("left-to-right mark; UNICODE(200E) NEW TABLE(RFC2070)")},
+#line 27 "./xhtml_ent.gperf"
+    {"cedil",      	184	, DESCR("cedilla = spacing cedilla; UNICODE(00B8) TABLE(ISOdia)")},
+#line 107 "./xhtml_ent.gperf"
+    {"scaron",      	353	, DESCR(" latin small letter s with caron; UNICODE(0161) TABLE(ISOlat2)")},
+#line 49 "./xhtml_ent.gperf"
+    {"Icirc",      	206	, DESCR("latin capital letter I with circumflex; UNICODE(00CE) TABLE(ISOlat1)")},
+#line 106 "./xhtml_ent.gperf"
+    {"Scaron",      	352	, DESCR(" latin capital letter S with caron; UNICODE(0160) TABLE(ISOlat2)")},
+#line 78 "./xhtml_ent.gperf"
+    {"euml",      	235	, DESCR("latin small letter e with diaeresis; UNICODE(00EB) TABLE(ISOlat1)")},
+#line 215 "./xhtml_ent.gperf"
+    {"prod",      	8719	, DESCR("n-ary product = product sign; UNICODE(220F) TABLE(ISOamsb)")},
+#line 37 "./xhtml_ent.gperf"
+    {"Acirc",      	194	, DESCR("latin capital letter A with circumflex; UNICODE(00C2) TABLE(ISOlat1)")},
+#line 118 "./xhtml_ent.gperf"
+    {"ndash",      	8211	, DESCR("en dash; UNICODE(2013) TABLE(ISOpub)")},
+#line 137 "./xhtml_ent.gperf"
+    {"Epsilon",      	917	, DESCR("greek capital letter epsilon; UNICODE(0395)")},
+#line 117 "./xhtml_ent.gperf"
+    {"rlm",      	8207	, DESCR("right-to-left mark; UNICODE(200F) NEW TABLE(RFC2070)")},
+#line 231 "./xhtml_ent.gperf"
+    {"asymp",      	8776	, DESCR("almost equal to = asymptotic to; UNICODE(2248) ISOamsr")},
+#line 32 "./xhtml_ent.gperf"
+    {"frac12",      	189	, DESCR("vulgar fraction one half = fraction one half; UNICODE(00BD) TABLE(ISOnum)")},
+#line 210 "./xhtml_ent.gperf"
+    {"empty",      	8709	, DESCR("empty set = null set = diameter; UNICODE(2205) TABLE(ISOamso)")},
+#line 136 "./xhtml_ent.gperf"
+    {"Delta",      	916	, DESCR("greek capital letter delta; UNICODE(0394) ISOgrk3")},
 #line 133 "./xhtml_ent.gperf"
     {"Alpha",      	913	, DESCR("greek capital letter alpha; UNICODE(0391)")},
+#line 55 "./xhtml_ent.gperf"
+    {"Ocirc",      	212	, DESCR("latin capital letter O with circumflex; UNICODE(00D4) TABLE(ISOlat1)")},
+#line 5 "./xhtml_ent.gperf"
+    {"cent",      	162	, DESCR("cent sign; UNICODE(00A2) TABLE(ISOnum)")},
+#line 112 "./xhtml_ent.gperf"
+    {"emsp",      	8195	, DESCR("em space; UNICODE(2003) TABLE(ISOpub)")},
+#line 191 "./xhtml_ent.gperf"
+    {"weierp",      	8472	, DESCR("script capital P = power set  = Weierstrass p; UNICODE(2118) TABLE(ISOamso)")},
+#line 152 "./xhtml_ent.gperf"
+    {"Upsilon",      	933	, DESCR("greek capital letter upsilon; UNICODE(03A5) ISOgrk3")},
+#line 59 "./xhtml_ent.gperf"
+    {"Oslash",      	216	, DESCR("latin capital letter O with stroke = latin capital letter O slash; UNICODE(00D8) TABLE(ISOlat1)")},
+#line 240 "./xhtml_ent.gperf"
+    {"supe",      	8839	, DESCR("superset of or equal to; UNICODE(2287) TABLE(ISOtech)")},
 #line 119 "./xhtml_ent.gperf"
     {"mdash",      	8212	, DESCR("em dash; UNICODE(2014) TABLE(ISOpub)")},
+#line 31 "./xhtml_ent.gperf"
+    {"frac14",      	188	, DESCR("vulgar fraction one quarter = fraction one quarter; UNICODE(00BC) TABLE(ISOnum)")},
+#line 211 "./xhtml_ent.gperf"
+    {"nabla",      	8711	, DESCR("nabla = backward difference; UNICODE(2207) TABLE(ISOtech)")},
+#line 96 "./xhtml_ent.gperf"
+    {"yacute",      	253	, DESCR("latin small letter y with acute; UNICODE(00FD) TABLE(ISOlat1)")},
+#line 177 "./xhtml_ent.gperf"
+    {"upsilon",      	965	, DESCR("greek small letter upsilon; UNICODE(03C5) ISOgrk3")},
+#line 19 "./xhtml_ent.gperf"
+    {"deg",      	176	, DESCR("degree sign; UNICODE(00B0) TABLE(ISOnum)")},
+#line 64 "./xhtml_ent.gperf"
+    {"Yacute",      	221	, DESCR("latin capital letter Y with acute; UNICODE(00DD) TABLE(ISOlat1)")},
+#line 238 "./xhtml_ent.gperf"
+    {"nsub",      	8836	, DESCR("not a subset of; UNICODE(2284) ISOamsn")},
+#line 77 "./xhtml_ent.gperf"
+    {"ecirc",      	234	, DESCR("latin small letter e with circumflex; UNICODE(00EA) TABLE(ISOlat1)")},
+#line 97 "./xhtml_ent.gperf"
+    {"thorn",      	254	, DESCR("latin small letter thorn with; UNICODE(00FE) TABLE(ISOlat1)")},
+#line 218 "./xhtml_ent.gperf"
+    {"lowast",      	8727	, DESCR("asterisk operator; UNICODE(2217) TABLE(ISOtech)")},
+#line 246 "./xhtml_ent.gperf"
+    {"rceil",      	8969	, DESCR("right ceiling; UNICODE(2309) TABLE(ISOamsc)")},
+#line 86 "./xhtml_ent.gperf"
+    {"oacute",      	243	, DESCR("latin small letter o with acute; UNICODE(00F3) TABLE(ISOlat1)")},
+#line 221 "./xhtml_ent.gperf"
+    {"infin",      	8734	, DESCR("infinity; UNICODE(221E) TABLE(ISOtech)")},
+#line 250 "./xhtml_ent.gperf"
+    {"rang",      	9002	, DESCR("right-pointing angle bracket = ket; UNICODE(232A) TABLE(ISOtech)")},
+#line 160 "./xhtml_ent.gperf"
+    {"delta",      	948	, DESCR("greek small letter delta; UNICODE(03B4) ISOgrk3")},
+#line 239 "./xhtml_ent.gperf"
+    {"sube",      	8838	, DESCR("subset of or equal to; UNICODE(2286) TABLE(ISOtech)")},
+#line 105 "./xhtml_ent.gperf"
+    {"oelig",      	339	, DESCR(" latin small ligature oe; UNICODE(0153) TABLE(ISOlat2)")},
+#line 253 "./xhtml_ent.gperf"
+    {"clubs",      	9827	, DESCR("black club suit = shamrock; UNICODE(2663) TABLE(ISOpub)")},
+#line 244 "./xhtml_ent.gperf"
+    {"sdot",      	8901	, DESCR("dot operator; UNICODE(22C5) TABLE(ISOamsb)")},
+#line 44 "./xhtml_ent.gperf"
+    {"Eacute",      	201	, DESCR("latin capital letter E with acute; UNICODE(00C9) TABLE(ISOlat1)")},
+#line 230 "./xhtml_ent.gperf"
+    {"cong",      	8773	, DESCR("approximately equal to; UNICODE(2245) TABLE(ISOtech)")},
+#line 229 "./xhtml_ent.gperf"
+    {"sim",      	8764	, DESCR("tilde operator = varies with = similar to; UNICODE(223C) TABLE(ISOtech)")},
+#line 147 "./xhtml_ent.gperf"
+    {"Omicron",      	927	, DESCR("greek capital letter omicron; UNICODE(039F)")},
+#line 114 "./xhtml_ent.gperf"
+    {"zwnj",      	8204	, DESCR("zero width non-joiner; UNICODE(200C) NEW TABLE(RFC2070)")},
+#line 34 "./xhtml_ent.gperf"
+    {"iquest",      	191	, DESCR("inverted question mark = turned question mark; UNICODE(00BF) TABLE(ISOnum)")},
+#line 88 "./xhtml_ent.gperf"
+    {"otilde",      	245	, DESCR("latin small letter o with tilde; UNICODE(00F5) TABLE(ISOlat1)")},
+#line 61 "./xhtml_ent.gperf"
+    {"Uacute",      	218	, DESCR("latin capital letter U with acute; UNICODE(00DA) TABLE(ISOlat1)")},
+#line 66 "./xhtml_ent.gperf"
+    {"szlig",      	223	, DESCR("latin small letter sharp s = ess-zed; UNICODE(00DF) TABLE(ISOlat1)")},
+#line 29 "./xhtml_ent.gperf"
+    {"ordm",      	186	, DESCR("masculine ordinal indicator; UNICODE(00BA) TABLE(ISOnum)")},
+#line 93 "./xhtml_ent.gperf"
+    {"uacute",      	250	, DESCR("latin small letter u with acute; UNICODE(00FA) TABLE(ISOlat1)")},
+#line 68 "./xhtml_ent.gperf"
+    {"aacute",      	225	, DESCR("latin small letter a with acute; UNICODE(00E1) TABLE(ISOlat1)")},
+#line 245 "./xhtml_ent.gperf"
+    {"lceil",      	8968	, DESCR("left ceiling = apl upstile; UNICODE(2308) TABLE(ISOamsc)")},
+#line 249 "./xhtml_ent.gperf"
+    {"lang",      	9001	, DESCR("left-pointing angle bracket = bra; UNICODE(2329) TABLE(ISOtech)")},
 #line 73 "./xhtml_ent.gperf"
     {"aelig",      	230	, DESCR("latin small letter ae = latin small ligature ae; UNICODE(00E6) TABLE(ISOlat1)")},
-#line 115 "./xhtml_ent.gperf"
-    {"zwj",      	8205	, DESCR("zero width joiner; UNICODE(200D) NEW TABLE(RFC2070)")},
-#line 97 "./xhtml_ent.gperf"
-    {"thorn",      	254	, DESCR("latin small letter thorn with; UNICODE(00FE) TABLE(ISOlat1)")},
-#line 54 "./xhtml_ent.gperf"
-    {"Oacute",      	211	, DESCR("latin capital letter O with acute; UNICODE(00D3) TABLE(ISOlat1)")},
-#line 75 "./xhtml_ent.gperf"
-    {"egrave",      	232	, DESCR("latin small letter e with grave; UNICODE(00E8) TABLE(ISOlat1)")},
-#line 171 "./xhtml_ent.gperf"
-    {"omicron",      	959	, DESCR("greek small letter omicron; UNICODE(03BF) NEW")},
 #line 140 "./xhtml_ent.gperf"
     {"Theta",      	920	, DESCR("greek capital letter theta; UNICODE(0398) ISOgrk3")},
-#line 57 "./xhtml_ent.gperf"
-    {"Ouml",      	214	, DESCR("latin capital letter O with diaeresis; UNICODE(00D6) TABLE(ISOlat1)")},
-#line 66 "./xhtml_ent.gperf"
-    {"szlig",      	223	, DESCR("latin small letter sharp s = ess-zed; UNICODE(00DF) TABLE(ISOlat1)")},
-#line 164 "./xhtml_ent.gperf"
-    {"theta",      	952	, DESCR("greek small letter theta; UNICODE(03B8) ISOgrk3")},
-#line 61 "./xhtml_ent.gperf"
-    {"Uacute",      	218	, DESCR("latin capital letter U with acute; UNICODE(00DA) TABLE(ISOlat1)")},
-#line 63 "./xhtml_ent.gperf"
-    {"Uuml",      	220	, DESCR("latin capital letter U with diaeresis; UNICODE(00DC) TABLE(ISOlat1)")},
-#line 85 "./xhtml_ent.gperf"
-    {"ograve",      	242	, DESCR("latin small letter o with grave; UNICODE(00F2) TABLE(ISOlat1)")},
-#line 47 "./xhtml_ent.gperf"
-    {"Igrave",      	204	, DESCR("latin capital letter I with grave; UNICODE(00CC) TABLE(ISOlat1)")},
-#line 35 "./xhtml_ent.gperf"
-    {"Agrave",      	192	, DESCR("latin capital letter A with grave = latin capital letter A grave; UNICODE(00C0) TABLE(ISOlat1)")},
+#line 212 "./xhtml_ent.gperf"
+    {"isin",      	8712	, DESCR("element of; UNICODE(2208) TABLE(ISOtech)")},
+#line 242 "./xhtml_ent.gperf"
+    {"otimes",      	8855	, DESCR("circled times = vector product; UNICODE(2297) TABLE(ISOamsb)")},
+#line 161 "./xhtml_ent.gperf"
+    {"epsilon",      	949	, DESCR("greek small letter epsilon; UNICODE(03B5) ISOgrk3")},
+#line 80 "./xhtml_ent.gperf"
+    {"iacute",      	237	, DESCR("latin small letter i with acute; UNICODE(00ED) TABLE(ISOlat1)")},
+#line 65 "./xhtml_ent.gperf"
+    {"THORN",      	222	, DESCR("latin capital letter THORN; UNICODE(00DE) TABLE(ISOlat1)")},
+#line 113 "./xhtml_ent.gperf"
+    {"thinsp",      	8201	, DESCR("thin space; UNICODE(2009) TABLE(ISOpub)")},
+#line 181 "./xhtml_ent.gperf"
+    {"omega",      	969	, DESCR("greek small letter omega; UNICODE(03C9) ISOgrk3")},
+#line 70 "./xhtml_ent.gperf"
+    {"atilde",      	227	, DESCR("latin small letter a with tilde; UNICODE(00E3) TABLE(ISOlat1)")},
+#line 6 "./xhtml_ent.gperf"
+    {"pound",      	163	, DESCR("pound sign; UNICODE(00A3) TABLE(ISOnum)")},
+#line 167 "./xhtml_ent.gperf"
+    {"lambda",      	955	, DESCR("greek small letter lambda; UNICODE(03BB) ISOgrk3")},
+#line 48 "./xhtml_ent.gperf"
+    {"Iacute",      	205	, DESCR("latin capital letter I with acute; UNICODE(00CD) TABLE(ISOlat1)")},
+#line 135 "./xhtml_ent.gperf"
+    {"Gamma",      	915	, DESCR("greek capital letter gamma; UNICODE(0393) ISOgrk3")},
+#line 209 "./xhtml_ent.gperf"
+    {"exist",      	8707	, DESCR("there exists; UNICODE(2203) TABLE(ISOtech)")},
+#line 36 "./xhtml_ent.gperf"
+    {"Aacute",      	193	, DESCR("latin capital letter A with acute; UNICODE(00C1) TABLE(ISOlat1)")},
+#line 252 "./xhtml_ent.gperf"
+    {"spades",      	9824	, DESCR("black spade suit; UNICODE(2660) TABLE(ISOpub)")},
+#line 143 "./xhtml_ent.gperf"
+    {"Lambda",      	923	, DESCR("greek capital letter lambda; UNICODE(039B) ISOgrk3")},
+#line 54 "./xhtml_ent.gperf"
+    {"Oacute",      	211	, DESCR("latin capital letter O with acute; UNICODE(00D3) TABLE(ISOlat1)")},
+#line 38 "./xhtml_ent.gperf"
+    {"Atilde",      	195	, DESCR("latin capital letter A with tilde; UNICODE(00C3) TABLE(ISOlat1)")},
+#line 20 "./xhtml_ent.gperf"
+    {"plusmn",      	177	, DESCR("plus-minus sign = plus-or-minus sign; UNICODE(00B1) TABLE(ISOnum)")},
+#line 174 "./xhtml_ent.gperf"
+    {"sigmaf",      	962	, DESCR("greek small letter final sigma; UNICODE(03C2) ISOgrk3")},
+#line 84 "./xhtml_ent.gperf"
+    {"ntilde",      	241	, DESCR("latin small letter n with tilde; UNICODE(00F1) TABLE(ISOlat1)")},
+#line 74 "./xhtml_ent.gperf"
+    {"ccedil",      	231	, DESCR("latin small letter c with cedilla; UNICODE(00E7) TABLE(ISOlat1)")},
+#line 76 "./xhtml_ent.gperf"
+    {"eacute",      	233	, DESCR("latin small letter e with acute; UNICODE(00E9) TABLE(ISOlat1)")},
+#line 217 "./xhtml_ent.gperf"
+    {"minus",      	8722	, DESCR("minus sign; UNICODE(2212) TABLE(ISOtech)")},
 #line 127 "./xhtml_ent.gperf"
     {"Dagger",      	8225	, DESCR("double dagger; UNICODE(2021) TABLE(ISOpub)")},
-#line 156 "./xhtml_ent.gperf"
-    {"Omega",      	937	, DESCR("greek capital letter omega; UNICODE(03A9) ISOgrk3")},
-#line 77 "./xhtml_ent.gperf"
-    {"ecirc",      	234	, DESCR("latin small letter e with circumflex; UNICODE(00EA) TABLE(ISOlat1)")},
-#line 72 "./xhtml_ent.gperf"
-    {"aring",      	229	, DESCR("latin small letter a with ring above = latin small letter a ring; UNICODE(00E5) TABLE(ISOlat1)")},
+#line 164 "./xhtml_ent.gperf"
+    {"theta",      	952	, DESCR("greek small letter theta; UNICODE(03B8) ISOgrk3")},
+#line 213 "./xhtml_ent.gperf"
+    {"notin",      	8713	, DESCR("not an element of; UNICODE(2209) TABLE(ISOtech)")},
+#line 56 "./xhtml_ent.gperf"
+    {"Otilde",      	213	, DESCR("latin capital letter O with tilde; UNICODE(00D5) TABLE(ISOlat1)")},
+#line 175 "./xhtml_ent.gperf"
+    {"sigma",      	963	, DESCR("greek small letter sigma; UNICODE(03C3) ISOgrk3")},
+#line 52 "./xhtml_ent.gperf"
+    {"Ntilde",      	209	, DESCR("latin capital letter N with tilde; UNICODE(00D1) TABLE(ISOlat1)")},
+#line 195 "./xhtml_ent.gperf"
+    {"alefsym",      	8501	, DESCR("alef symbol = first transfinite cardinal; UNICODE(2135) NEW")},
+#line 228 "./xhtml_ent.gperf"
+    {"there4",      	8756	, DESCR("therefore; UNICODE(2234) TABLE(ISOtech)")},
+#line 150 "./xhtml_ent.gperf"
+    {"Sigma",      	931	, DESCR("greek capital letter sigma; UNICODE(03A3) ISOgrk3")},
 #line 255 "./xhtml_ent.gperf"
     {"diams",      	9830	, DESCR("black diamond suit; UNICODE(2666) TABLE(ISOpub)")},
-#line 92 "./xhtml_ent.gperf"
-    {"ugrave",      	249	, DESCR("latin small letter u with grave; UNICODE(00F9) TABLE(ISOlat1)")},
-#line 87 "./xhtml_ent.gperf"
-    {"ocirc",      	244	, DESCR("latin small letter o with circumflex; UNICODE(00F4) TABLE(ISOlat1)")},
-#line 49 "./xhtml_ent.gperf"
-    {"Icirc",      	206	, DESCR("latin capital letter I with circumflex; UNICODE(00CE) TABLE(ISOlat1)")},
-#line 37 "./xhtml_ent.gperf"
-    {"Acirc",      	194	, DESCR("latin capital letter A with circumflex; UNICODE(00C2) TABLE(ISOlat1)")},
-#line 250 "./xhtml_ent.gperf"
-    {"rang",      	9002	, DESCR("right-pointing angle bracket = ket; UNICODE(232A) TABLE(ISOtech)")},
-#line 109 "./xhtml_ent.gperf"
-    {"circ",      	710	, DESCR(" modifier letter circumflex accent; UNICODE(02C6) TABLE(ISOpub)")},
-#line 196 "./xhtml_ent.gperf"
-    {"larr",      	8592	, DESCR("leftwards arrow; UNICODE(2190) TABLE(ISOnum)")},
-#line 94 "./xhtml_ent.gperf"
-    {"ucirc",      	251	, DESCR("latin small letter u with circumflex; UNICODE(00FB) TABLE(ISOlat1)")},
-#line 197 "./xhtml_ent.gperf"
-    {"uarr",      	8593	, DESCR("upwards arrow; UNICODE(2191) TABLE(ISOnum)")},
-#line 24 "./xhtml_ent.gperf"
-    {"micro",      	181	, DESCR("micro sign; UNICODE(00B5) TABLE(ISOnum)")},
-#line 182 "./xhtml_ent.gperf"
-    {"thetasym",      	977	, DESCR("greek small letter theta symbol; UNICODE(03D1) NEW")},
-#line 174 "./xhtml_ent.gperf"
-    {"sigmaf",      	962	, DESCR("greek small letter final sigma; UNICODE(03C2) ISOgrk3")},
-#line 202 "./xhtml_ent.gperf"
-    {"lArr",      	8656	, DESCR("leftwards double arrow; UNICODE(21D0) TABLE(ISOtech)")},
-#line 157 "./xhtml_ent.gperf"
-    {"alpha",      	945	, DESCR("greek small letter alpha; UNICODE(03B1) ISOgrk3")},
-#line 211 "./xhtml_ent.gperf"
-    {"nabla",      	8711	, DESCR("nabla = backward difference; UNICODE(2207) TABLE(ISOtech)")},
-#line 114 "./xhtml_ent.gperf"
-    {"zwnj",      	8204	, DESCR("zero width non-joiner; UNICODE(200C) NEW TABLE(RFC2070)")},
-#line 203 "./xhtml_ent.gperf"
-    {"uArr",      	8657	, DESCR("upwards double arrow; UNICODE(21D1) TABLE(ISOamsa)")},
-#line 65 "./xhtml_ent.gperf"
-    {"THORN",      	222	, DESCR("latin capital letter THORN; UNICODE(00DE) TABLE(ISOlat1)")},
+#line 72 "./xhtml_ent.gperf"
+    {"aring",      	229	, DESCR("latin small letter a with ring above = latin small letter a ring; UNICODE(00E5) TABLE(ISOlat1)")},
+#line 159 "./xhtml_ent.gperf"
+    {"gamma",      	947	, DESCR("greek small letter gamma; UNICODE(03B3) ISOgrk3")},
+#line 41 "./xhtml_ent.gperf"
+    {"AElig",      	198	, DESCR("latin capital letter AE = latin capital ligature AE; UNICODE(00C6) TABLE(ISOlat1)")},
 #line 126 "./xhtml_ent.gperf"
     {"dagger",      	8224	, DESCR("dagger; UNICODE(2020) TABLE(ISOpub)")},
-#line 7 "./xhtml_ent.gperf"
-    {"curren",      	164	, DESCR("currency sign; UNICODE(00A4) TABLE(ISOnum)")},
-#line 117 "./xhtml_ent.gperf"
-    {"rlm",      	8207	, DESCR("right-to-left mark; UNICODE(200F) NEW TABLE(RFC2070)")},
-#line 26 "./xhtml_ent.gperf"
-    {"middot",      	183	, DESCR("middle dot = Georgian comma = Greek middle dot; UNICODE(00B7) TABLE(ISOnum)")},
-#line 67 "./xhtml_ent.gperf"
-    {"agrave",      	224	, DESCR("latin small letter a with grave = latin small letter a grave; UNICODE(00E0) TABLE(ISOlat1)")},
+#line 42 "./xhtml_ent.gperf"
+    {"Ccedil",      	199	, DESCR("latin capital letter C with cedilla; UNICODE(00C7) TABLE(ISOlat1)")},
+#line 156 "./xhtml_ent.gperf"
+    {"Omega",      	937	, DESCR("greek capital letter omega; UNICODE(03A9) ISOgrk3")},
+#line 187 "./xhtml_ent.gperf"
+    {"prime",      	8242	, DESCR("prime = minutes = feet; UNICODE(2032) TABLE(ISOtech)")},
 #line 104 "./xhtml_ent.gperf"
     {"OElig",      	338	, DESCR(" latin capital ligature OE; UNICODE(0152) TABLE(ISOlat2)")},
-#line 233 "./xhtml_ent.gperf"
-    {"equiv",      	8801	, DESCR("identical to; UNICODE(2261) TABLE(ISOtech)")},
-#line 201 "./xhtml_ent.gperf"
-    {"crarr",      	8629	, DESCR("downwards arrow with corner leftwards  = carriage return; UNICODE(21B5) NEW")},
+#line 189 "./xhtml_ent.gperf"
+    {"oline",      	8254	, DESCR("overline = spacing overscore; UNICODE(203E) NEW")},
 #line 90 "./xhtml_ent.gperf"
     {"divide",      	247	, DESCR("division sign; UNICODE(00F7) TABLE(ISOnum)")},
-#line 199 "./xhtml_ent.gperf"
-    {"darr",      	8595	, DESCR("downwards arrow; UNICODE(2193) TABLE(ISOnum)")},
-#line 143 "./xhtml_ent.gperf"
-    {"Lambda",      	923	, DESCR("greek capital letter lambda; UNICODE(039B) ISOgrk3")},
-#line 79 "./xhtml_ent.gperf"
-    {"igrave",      	236	, DESCR("latin small letter i with grave; UNICODE(00EC) TABLE(ISOlat1)")},
-#line 43 "./xhtml_ent.gperf"
-    {"Egrave",      	200	, DESCR("latin capital letter E with grave; UNICODE(00C8) TABLE(ISOlat1)")},
-#line 69 "./xhtml_ent.gperf"
-    {"acirc",      	226	, DESCR("latin small letter a with circumflex; UNICODE(00E2) TABLE(ISOlat1)")},
-#line 205 "./xhtml_ent.gperf"
-    {"dArr",      	8659	, DESCR("downwards double arrow; UNICODE(21D3) TABLE(ISOamsa)")},
-#line 147 "./xhtml_ent.gperf"
-    {"Omicron",      	927	, DESCR("greek capital letter omicron; UNICODE(039F)")},
-#line 150 "./xhtml_ent.gperf"
-    {"Sigma",      	931	, DESCR("greek capital letter sigma; UNICODE(03A3) ISOgrk3")},
-#line 200 "./xhtml_ent.gperf"
-    {"harr",      	8596	, DESCR("left right arrow; UNICODE(2194) TABLE(ISOamsa)")},
-#line 175 "./xhtml_ent.gperf"
-    {"sigma",      	963	, DESCR("greek small letter sigma; UNICODE(03C3) ISOgrk3")},
-#line 18 "./xhtml_ent.gperf"
-    {"macr",      	175	, DESCR("macron = spacing macron = overline = APL overbar; UNICODE(00AF) TABLE(ISOdia)")},
-#line 53 "./xhtml_ent.gperf"
-    {"Ograve",      	210	, DESCR("latin capital letter O with grave; UNICODE(00D2) TABLE(ISOlat1)")},
-#line 167 "./xhtml_ent.gperf"
-    {"lambda",      	955	, DESCR("greek small letter lambda; UNICODE(03BB) ISOgrk3")},
-#line 206 "./xhtml_ent.gperf"
-    {"hArr",      	8660	, DESCR("left right double arrow; UNICODE(21D4) TABLE(ISOamsa)")},
-#line 81 "./xhtml_ent.gperf"
-    {"icirc",      	238	, DESCR("latin small letter i with circumflex; UNICODE(00EE) TABLE(ISOlat1)")},
-#line 60 "./xhtml_ent.gperf"
-    {"Ugrave",      	217	, DESCR("latin capital letter U with grave; UNICODE(00D9) TABLE(ISOlat1)")},
-#line 45 "./xhtml_ent.gperf"
-    {"Ecirc",      	202	, DESCR("latin capital letter E with circumflex; UNICODE(00CA) TABLE(ISOlat1)")},
-#line 135 "./xhtml_ent.gperf"
-    {"Gamma",      	915	, DESCR("greek capital letter gamma; UNICODE(0393) ISOgrk3")},
-#line 198 "./xhtml_ent.gperf"
-    {"rarr",      	8594	, DESCR("rightwards arrow; UNICODE(2192) TABLE(ISOnum)")},
-#line 219 "./xhtml_ent.gperf"
-    {"radic",      	8730	, DESCR("square root = radical sign; UNICODE(221A) TABLE(ISOtech)")},
-#line 55 "./xhtml_ent.gperf"
-    {"Ocirc",      	212	, DESCR("latin capital letter O with circumflex; UNICODE(00D4) TABLE(ISOlat1)")},
-#line 204 "./xhtml_ent.gperf"
-    {"rArr",      	8658	, DESCR("rightwards double arrow; UNICODE(21D2) TABLE(ISOtech)")},
-#line 62 "./xhtml_ent.gperf"
-    {"Ucirc",      	219	, DESCR("latin capital letter U with circumflex; UNICODE(00DB) TABLE(ISOlat1)")},
-#line 9 "./xhtml_ent.gperf"
-    {"brvbar",      	166	, DESCR("broken bar = broken vertical bar; UNICODE(00A6) TABLE(ISOnum)")},
-#line 159 "./xhtml_ent.gperf"
-    {"gamma",      	947	, DESCR("greek small letter gamma; UNICODE(03B3) ISOgrk3")}
+#line 40 "./xhtml_ent.gperf"
+    {"Aring",      	197	, DESCR("latin capital letter A with ring above = latin capital letter A ring; UNICODE(00C5) TABLE(ISOlat1)")},
+#line 23 "./xhtml_ent.gperf"
+    {"acute",      	180	, DESCR("acute accent = spacing acute; UNICODE(00B4) TABLE(ISOdia)")},
+#line 188 "./xhtml_ent.gperf"
+    {"Prime",      	8243	, DESCR("double prime = seconds = inches; UNICODE(2033) TABLE(ISOtech)")},
+#line 26 "./xhtml_ent.gperf"
+    {"middot",      	183	, DESCR("middle dot = Georgian comma = Greek middle dot; UNICODE(00B7) TABLE(ISOnum)")},
+#line 182 "./xhtml_ent.gperf"
+    {"thetasym",      	977	, DESCR("greek small letter theta symbol; UNICODE(03D1) NEW")},
+#line 194 "./xhtml_ent.gperf"
+    {"trade",      	8482	, DESCR("trade mark sign; UNICODE(2122) TABLE(ISOnum)")},
+#line 58 "./xhtml_ent.gperf"
+    {"times",      	215	, DESCR("multiplication sign; UNICODE(00D7) TABLE(ISOnum)")},
+#line 192 "./xhtml_ent.gperf"
+    {"image",      	8465	, DESCR("blackletter capital I = imaginary part; UNICODE(2111) TABLE(ISOamso)")},
+#line 110 "./xhtml_ent.gperf"
+    {"tilde",      	732	, DESCR(" small tilde; UNICODE(02DC) TABLE(ISOdia)")}
   };
 
 static const short lookup[] =
@@ -623,120 +623,122 @@ static const short lookup[] =
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,   0,   1,  -1,   2,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,   3,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   4,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,   5,  -1,  -1,  -1,  -1,  -1,
-     -1,   6,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   7,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,   8,  -1,  -1,  -1,
-     -1,  -1,  -1,   9,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  10,  -1,  -1,  -1,  -1,  11,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  12,
-     13,  -1,  -1,  -1,  -1,  14,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  15,  -1,  16,  -1,  -1,  -1,
-     17,  18,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     19,  -1,  -1,  -1,  20,  -1,  -1,  21,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  22,  -1,  -1,
-     -1,  23,  -1,  -1,  -1,  -1,  -1,  24,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  25,  -1,  -1,  -1,  -1,  26,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  27,  -1,  28,  29,
-     -1,  -1,  -1,  -1,  30,  -1,  -1,  -1,  -1,  -1,
-     31,  -1,  32,  -1,  -1,  33,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     34,  -1,  -1,  -1,  35,  36,  37,  38,  -1,  39,
-     -1,  -1,  -1,  -1,  -1,  40,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  41,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  42,
-     -1,  -1,  43,  -1,  -1,  -1,  -1,  -1,  44,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  45,  46,  47,  -1,
-     -1,  -1,  -1,  48,  -1,  -1,  -1,  -1,  49,  -1,
-     -1,  -1,  -1,  -1,  -1,  50,  51,  -1,  52,  -1,
-     -1,  -1,  -1,  -1,  53,  -1,  -1,  -1,  -1,  -1,
-     -1,  54,  -1,  -1,  -1,  55,  56,  -1,  57,  -1,
-     58,  -1,  59,  60,  -1,  -1,  61,  -1,  -1,  62,
-     63,  -1,  64,  -1,  65,  -1,  66,  -1,  67,  -1,
-     -1,  -1,  -1,  68,  69,  -1,  -1,  70,  -1,  71,
-     72,  -1,  73,  74,  75,  -1,  76,  -1,  -1,  77,
-     -1,  -1,  -1,  -1,  -1,  78,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  79,  -1,  80,  -1,
-     81,  -1,  -1,  82,  -1,  83,  -1,  -1,  84,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  85,  86,  87,
-     88,  89,  -1,  90,  -1,  91,  92,  -1,  93,  94,
-     95,  96,  -1,  97,  98,  99, 100,  -1, 101, 102,
-    103, 104,  -1,  -1, 105, 106, 107, 108, 109, 110,
-    111,  -1, 112, 113, 114,  -1,  -1,  -1, 115,  -1,
-     -1, 116,  -1,  -1, 117,  -1,  -1,  -1,  -1, 118,
-    119,  -1,  -1,  -1, 120, 121,  -1,  -1,  -1,  -1,
-    122, 123, 124,  -1,  -1,  -1,  -1, 125, 126,  -1,
-     -1, 127,  -1,  -1,  -1, 128,  -1,  -1,  -1, 129,
-     -1, 130,  -1,  -1, 131,  -1,  -1,  -1,  -1, 132,
-     -1, 133,  -1,  -1, 134, 135, 136,  -1,  -1,  -1,
-     -1, 137,  -1, 138,  -1,  -1, 139,  -1, 140, 141,
-    142, 143,  -1, 144,  -1, 145, 146, 147, 148,  -1,
-     -1, 149, 150,  -1, 151,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1, 152,  -1,  -1, 153, 154,  -1,  -1,
-    155,  -1, 156, 157,  -1,  -1, 158,  -1,  -1, 159,
-    160,  -1, 161,  -1,  -1,  -1, 162,  -1,  -1, 163,
-     -1,  -1, 164, 165,  -1,  -1,  -1,  -1, 166,  -1,
-    167,  -1,  -1, 168, 169,  -1,  -1,  -1,  -1, 170,
-     -1,  -1,  -1,  -1, 171,  -1,  -1, 172,  -1, 173,
-     -1, 174, 175,  -1,  -1,  -1, 176, 177,  -1, 178,
-     -1,  -1, 179,  -1, 180,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1, 181, 182,  -1,  -1,
-    183, 184, 185, 186, 187, 188,  -1,  -1,  -1, 189,
-     -1, 190, 191,  -1,  -1,  -1, 192,  -1,  -1,  -1,
-     -1,  -1,  -1, 193, 194,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1, 195,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-    196,  -1, 197,  -1, 198,  -1, 199,  -1,  -1,  -1,
-     -1,  -1, 200, 201,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1, 202, 203,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1, 204,  -1,  -1,  -1,  -1, 205,
-    206,  -1,  -1,  -1, 207,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1, 208,  -1,  -1, 209,  -1,
-    210, 211,  -1, 212, 213, 214,  -1,  -1, 215,  -1,
-     -1,  -1,  -1,  -1,  -1, 216,  -1,  -1, 217, 218,
-     -1,  -1,  -1,  -1, 219,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1, 220,  -1,  -1,  -1,  -1,  -1, 221,  -1,
-     -1,  -1,  -1,  -1, 222,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1, 223,  -1,  -1,  -1,  -1,
-     -1, 224,  -1,  -1,  -1, 225,  -1, 226,  -1,  -1,
-     -1,  -1,  -1,  -1, 227,  -1,  -1,  -1,  -1,  -1,
-     -1, 228, 229,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-    230,  -1,  -1,  -1,  -1, 231,  -1, 232,  -1,  -1,
-     -1, 233,  -1,  -1, 234, 235,  -1,  -1,  -1, 236,
-     -1,  -1,  -1,  -1, 237,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1, 238,  -1, 239,  -1, 240,  -1,  -1, 241,
-     -1,  -1, 242,  -1,  -1, 243,  -1, 244,  -1,  -1,
-    245,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-    246,  -1,  -1, 247,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1, 248,  -1,  -1,  -1,
-    249,  -1,  -1,  -1,  -1,  -1,  -1, 250,  -1,  -1,
-     -1,  -1, 251,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
      -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
-     -1,  -1,  -1,  -1,  -1, 252
+     -1,  -1,  -1,  -1,  -1,   0,  -1,  -1,  -1,  -1,
+     -1,  -1,   1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,   2,  -1,  -1,  -1,  -1,  -1,  -1,   3,  -1,
+     -1,   4,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,   5,   6,
+     -1,  -1,  -1,  -1,  -1,   7,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,   8,  -1,  -1,
+     -1,   9,  -1,  -1,  -1,  -1,  -1,  -1,  10,  -1,
+     -1,  -1,  11,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  12,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  13,  14,
+     -1,  15,  -1,  -1,  -1,  -1,  16,  -1,  -1,  17,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     18,  -1,  -1,  -1,  19,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  20,  -1,  -1,  -1,  -1,  -1,  21,  -1,
+     -1,  -1,  -1,  22,  -1,  -1,  23,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  24,  25,  -1,  -1,
+     -1,  -1,  -1,  -1,  26,  -1,  -1,  -1,  -1,  27,
+     -1,  28,  -1,  -1,  -1,  -1,  -1,  29,  -1,  -1,
+     -1,  -1,  30,  31,  32,  -1,  33,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  34,  -1,  35,  -1,
+     -1,  -1,  -1,  -1,  -1,  36,  -1,  -1,  -1,  -1,
+     -1,  37,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  38,  -1,  -1,  -1,  -1,  -1,  -1,  39,  -1,
+     -1,  -1,  -1,  40,  -1,  41,  -1,  -1,  42,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  43,  -1,  -1,  44,
+     -1,  -1,  45,  -1,  46,  47,  -1,  48,  -1,  49,
+     50,  -1,  51,  -1,  -1,  -1,  52,  -1,  -1,  -1,
+     -1,  53,  -1,  54,  55,  -1,  -1,  -1,  -1,  56,
+     -1,  -1,  -1,  57,  -1,  -1,  -1,  -1,  58,  59,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  60,  -1,
+     61,  -1,  62,  -1,  -1,  -1,  -1,  -1,  63,  -1,
+     -1,  64,  65,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     66,  -1,  -1,  -1,  -1,  67,  -1,  -1,  -1,  68,
+     -1,  69,  70,  -1,  -1,  -1,  71,  72,  -1,  -1,
+     73,  74,  -1,  -1,  -1,  75,  -1,  76,  77,  -1,
+     -1,  -1,  -1,  78,  -1,  79,  -1,  80,  81,  -1,
+     82,  83,  84,  -1,  85,  -1,  -1,  86,  87,  88,
+     -1,  89,  90,  -1,  -1,  -1,  91,  -1,  -1,  92,
+     -1,  93,  -1,  94,  -1,  95,  96,  -1,  97,  98,
+     -1,  99, 100,  -1,  -1, 101, 102,  -1, 103, 104,
+    105,  -1,  -1, 106, 107,  -1, 108,  -1, 109,  -1,
+    110, 111,  -1,  -1,  -1,  -1, 112, 113,  -1,  -1,
+     -1,  -1,  -1,  -1, 114, 115,  -1,  -1,  -1,  -1,
+     -1, 116, 117, 118, 119, 120, 121,  -1, 122,  -1,
+    123,  -1,  -1,  -1, 124, 125,  -1,  -1, 126,  -1,
+    127,  -1, 128,  -1,  -1,  -1,  -1,  -1, 129,  -1,
+    130,  -1,  -1, 131,  -1,  -1,  -1, 132,  -1, 133,
+     -1,  -1,  -1, 134,  -1,  -1, 135,  -1,  -1,  -1,
+    136,  -1,  -1,  -1,  -1, 137, 138,  -1,  -1,  -1,
+    139, 140,  -1,  -1,  -1,  -1, 141, 142,  -1, 143,
+     -1,  -1, 144,  -1, 145, 146,  -1,  -1,  -1, 147,
+    148,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+    149,  -1,  -1,  -1,  -1, 150, 151,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1, 152,  -1,  -1,  -1,  -1,  -1,
+     -1, 153, 154,  -1, 155, 156, 157,  -1,  -1,  -1,
+     -1, 158, 159, 160,  -1,  -1,  -1, 161,  -1,  -1,
+     -1,  -1, 162,  -1,  -1,  -1,  -1, 163, 164, 165,
+     -1, 166,  -1,  -1, 167, 168,  -1, 169,  -1, 170,
+    171,  -1, 172,  -1,  -1, 173,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1, 174,  -1,  -1, 175, 176,  -1,  -1, 177, 178,
+     -1, 179,  -1,  -1,  -1,  -1,  -1, 180,  -1,  -1,
+     -1, 181, 182,  -1, 183,  -1,  -1,  -1,  -1,  -1,
+    184, 185,  -1,  -1,  -1,  -1, 186,  -1, 187,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 188,  -1,
+     -1,  -1, 189,  -1,  -1,  -1,  -1,  -1,  -1, 190,
+     -1,  -1, 191,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1, 192,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 193,
+    194,  -1,  -1, 195,  -1,  -1,  -1, 196,  -1,  -1,
+     -1,  -1, 197,  -1,  -1,  -1,  -1,  -1,  -1, 198,
+     -1, 199,  -1,  -1,  -1,  -1,  -1, 200,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1, 201, 202,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+    203, 204,  -1,  -1, 205,  -1, 206, 207,  -1,  -1,
+    208,  -1,  -1, 209,  -1,  -1,  -1, 210,  -1,  -1,
+     -1, 211, 212,  -1,  -1, 213,  -1,  -1, 214,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1, 215,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1, 216,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 217,
+     -1, 218,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1, 219,  -1,  -1,  -1, 220, 221, 222,  -1,  -1,
+     -1,  -1, 223,  -1, 224,  -1,  -1,  -1, 225, 226,
+     -1,  -1,  -1,  -1,  -1, 227,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1, 228, 229, 230,  -1, 231,
+    232,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+    233, 234,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1, 235,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1, 236,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1, 237,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1, 238,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1, 239,  -1, 240,  -1,  -1, 241,  -1,  -1,
+     -1,  -1, 242,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1, 243,  -1, 244,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1, 245, 246,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 247,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1, 248,  -1,  -1,
+     -1,  -1,  -1, 249,  -1,  -1,  -1,  -1,  -1, 250,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1, 251,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,
+     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, 252
   };
 
 #ifdef __GNUC__
diff --git a/libsrc/Xml.new/xmlparser.c b/libsrc/Xml.new/xmlparser.c
index 6cc3e32..b08576a 100644
--- a/libsrc/Xml.new/xmlparser.c
+++ b/libsrc/Xml.new/xmlparser.c
@@ -1,7 +1,7 @@
 /*
  *  xmlparser.c
  *
- *  $Id: xmlparser.c,v 1.5.2.1 2009/09/13 21:45:46 source Exp $
+ *  $Id: xmlparser.c,v 1.5.2.3 2011/03/08 11:52:56 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -196,7 +196,7 @@ VXmlParserCreate (vxml_parser_config_t *config)
       if (parser->src_eh == NULL)
 	xmlparser_logprintf (parser, XCFG_ERROR, 300, "The specified name '%.100s' of the default encoding of the XML source text is not supported", parser->cfg.initial_src_enc_name);
     }
-
+  parser->feed_buf_size = config->feed_buf_size;
   parser->state = XML_ST_INITIAL;
   if (config->input_is_ge & GE_XML)
     parser->state |= XML_A_CHAR | XML_A_MISC;
@@ -278,10 +278,10 @@ VXmlParserDestroy (vxml_parser_t * parser)
       parser->eptr.buf = old->prev;
       if (NULL != old->data_begin)
 	dk_free (old->data_begin, -1);
-      dk_free (old, sizeof (brick_t));
 #ifdef UNIT_DEBUG
       printf ("Releasing a buffer element. %x\n", old);
 #endif
+      dk_free (old, sizeof (brick_t));
     }
 
   if (parser->feed_buf)
@@ -614,9 +614,17 @@ VXmlParse (vxml_parser_t * parser, char * data, s_size_t data_size)
   parser->input_cost = 1000 + data_size / 16;
 
   if (parser->feeder != NULL)
-    parser->feed_tail = parser->feed_end = parser->feed_buf = dk_alloc (FEED_BUF_SIZE);
-
-  parser->uni_tail = parser->uni_end = parser->uni_buf = dk_alloc (UNI_BUF_SIZE);
+    {
+      if (0 == parser->feed_buf_size)
+        parser->feed_buf_size = 0x2000;
+      parser->feed_tail = parser->feed_end = parser->feed_buf = dk_alloc (parser->feed_buf_size);
+    }
+  else
+    { /* parser->feed_buf_size is needed even if (NULL == parser->feeder) befause it is used in calculating the size of parser->uni_buf */
+      if (0 == parser->feed_buf_size)
+        parser->feed_buf_size = MIN (data_size + 2, 0x2000);
+    }
+  parser->uni_tail = parser->uni_end = parser->uni_buf = dk_alloc (6 * (BRICK_SIZE + parser->feed_buf_size));
 
   if (!initialize_src_eh (parser))
     return 0;
diff --git a/libsrc/Xml.new/xmlparser.h b/libsrc/Xml.new/xmlparser.h
index 56f426e..567ba85 100644
--- a/libsrc/Xml.new/xmlparser.h
+++ b/libsrc/Xml.new/xmlparser.h
@@ -1,7 +1,7 @@
 /*
  *  xmlparser.h
  *
- *  $Id: xmlparser.h,v 1.9.2.1 2009/09/13 21:45:46 source Exp $
+ *  $Id: xmlparser.h,v 1.9.2.2 2011/03/08 11:52:56 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -277,6 +277,7 @@ struct vxml_parser_config_s
   caddr_t			auto_load_xmlschema_dtd_s;	/*!< xmlschema namespace suffix */
   caddr_t			auto_load_xmlschema_uri;	/*!< uri of the schema that is requested by parser caller */
   int				dc_namespaces;		/*!< Enforced fixed value for parser's dc_namespaces, dtd config will not override */
+  int				feed_buf_size;		/*!< If nonzero then the size of the buffer for text input. */
 };
 
 typedef struct vxml_parser_config_s vxml_parser_config_t;
diff --git a/libsrc/Xml.new/xmlparser_impl.h b/libsrc/Xml.new/xmlparser_impl.h
index 45207eb..5e10b91 100644
--- a/libsrc/Xml.new/xmlparser_impl.h
+++ b/libsrc/Xml.new/xmlparser_impl.h
@@ -1,7 +1,7 @@
 /*
  *  xmlparser_impl.h
  *
- *  $Id: xmlparser_impl.h,v 1.8.2.1 2010/04/07 19:28:12 source Exp $
+ *  $Id: xmlparser_impl.h,v 1.8.2.2 2011/03/08 11:52:56 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -75,8 +75,6 @@
 #define DTD_IN_ISREAD	2
 
 #define BRICK_SIZE	4076
-#define FEED_BUF_SIZE	8192
-#define UNI_BUF_SIZE	6*(BRICK_SIZE+FEED_BUF_SIZE)
 
 #define PM(member) (parser->member)
 
@@ -212,6 +210,7 @@ struct vxml_parser_s {
   buf_ptr_t		pptr;		/*!< it points past last parsed byte */
 
   char			* feed_buf;		/*!< buffer for getting new data */
+  int			feed_buf_size;		/*!< Allocated size of \c feed_buf */
   char			* feed_tail;		/*!< untranslated tail of \c feed_buf */
   char			* feed_end;		/*!< end of data in \c feed_buf */
   unichar		* uni_buf;		/*!< buffer for data in unicode */
diff --git a/libsrc/Xml.new/xmlread.c b/libsrc/Xml.new/xmlread.c
index 5d580e8..51316b0 100644
--- a/libsrc/Xml.new/xmlread.c
+++ b/libsrc/Xml.new/xmlread.c
@@ -1,7 +1,7 @@
 /*
  *  xmlread.c
  *
- *  $Id: xmlread.c,v 1.13.2.2 2010/04/16 11:41:32 source Exp $
+ *  $Id: xmlread.c,v 1.13.2.4 2011/03/08 11:52:57 source Exp $
  *
  *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
  *  project.
@@ -208,7 +208,7 @@ get_one_xml_char (vxml_parser_t * parser)
 	GPF_T;
       if (parser->feed_tail > parser->feed_end)
 	GPF_T;
-      if (parser->feed_end > parser->feed_buf+FEED_BUF_SIZE)
+      if (parser->feed_end > parser->feed_buf + parser->feed_buf_size)
 	GPF_T;
 #endif
       if (parser->feed_tail < parser->feed_end)
@@ -233,10 +233,10 @@ get_one_xml_char (vxml_parser_t * parser)
 	GPF_T;
       if (parser->feed_tail > parser->feed_end)
 	GPF_T;
-      if (parser->feed_end > parser->feed_buf+FEED_BUF_SIZE)
+      if (parser->feed_end > parser->feed_buf + parser->feed_buf_size)
 	GPF_T;
 #endif
-	  feed_result = parser->feeder (parser->read_cd, put_begin, parser->feed_buf+FEED_BUF_SIZE-put_begin);
+	  feed_result = parser->feeder (parser->read_cd, put_begin, parser->feed_buf + parser->feed_buf_size - put_begin);
 	  if (0 >= feed_result)
 	    goto fail;
 	  parser->input_weight += 1 + (feed_result / 16);
@@ -247,7 +247,7 @@ get_one_xml_char (vxml_parser_t * parser)
 	GPF_T;
       if (parser->feed_tail > parser->feed_end)
 	GPF_T;
-      if (parser->feed_end > parser->feed_buf+FEED_BUF_SIZE)
+      if (parser->feed_end > parser->feed_buf + parser->feed_buf_size)
 	GPF_T;
 #endif
 	} while (0);
@@ -545,10 +545,10 @@ advance_ptr (vxml_parser_t * parser)
 	dk_free (old->data_begin, -1);
       else if (NULL != old->data_owner)
 	old->data_owner->data_refctr -= 1;
-      dk_free (old, sizeof (brick_t));
 #ifdef UNIT_DEBUG
       printf ("Releasing a buffer element. %x\n", old);
 #endif
+      dk_free (old, sizeof (brick_t));
     }
   leftmost_saved->prev = NULL;
   validate_parser_bricks(parser);
diff --git a/libsrc/langfunc/Makefile.am b/libsrc/langfunc/Makefile.am
index 22b5210..9be36d6 100644
--- a/libsrc/langfunc/Makefile.am
+++ b/libsrc/langfunc/Makefile.am
@@ -23,7 +23,8 @@ noinst_LTLIBRARIES = liblangfunc.la
 noinst_HEADERS = \
 	langfunc.h latin1ctype.h ucm.h \
 	unicode3_all_chars.h unicode3_lowers.h  \
-	unicode3_spaces.h unicode3_uppers.h
+	unicode3_spaces.h unicode3_uppers.h \
+	unicode3_basechars.h
 
 liblangfunc_la_SOURCES = \
 	encoding_basic.c \
@@ -48,7 +49,7 @@ liblangfunc_la_LDFLAGS = -static
 
 .PHONY: generate
 generate: 
-	. ./unicodetab2h.sh
+	$(SHELL) ./unicodetab2h.sh
 
 
 .PHONY: rclean
diff --git a/libsrc/langfunc/Makefile.in b/libsrc/langfunc/Makefile.in
index 32e0434..c2a9986 100644
--- a/libsrc/langfunc/Makefile.in
+++ b/libsrc/langfunc/Makefile.in
@@ -194,6 +194,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
@@ -306,7 +307,8 @@ noinst_LTLIBRARIES = liblangfunc.la
 noinst_HEADERS = \
 	langfunc.h latin1ctype.h ucm.h \
 	unicode3_all_chars.h unicode3_lowers.h  \
-	unicode3_spaces.h unicode3_uppers.h
+	unicode3_spaces.h unicode3_uppers.h \
+	unicode3_basechars.h
 
 liblangfunc_la_SOURCES = \
 	encoding_basic.c \
@@ -713,7 +715,7 @@ uninstall-am:
 
 .PHONY: generate
 generate: 
-	. ./unicodetab2h.sh
+	$(SHELL) ./unicodetab2h.sh
 
 .PHONY: rclean
 rclean: clean
diff --git a/libsrc/langfunc/encoding_ucm.c b/libsrc/langfunc/encoding_ucm.c
index 22fef55..9312bcf 100644
--- a/libsrc/langfunc/encoding_ucm.c
+++ b/libsrc/langfunc/encoding_ucm.c
@@ -434,10 +434,12 @@ encoding_handler_t * eh_create_ucm_handler (char *encoding_names, char *ucm_file
   ucm_file_len = ftell (ucm_file);
   fseek (ucm_file, 0, SEEK_SET);
   ucm_file_text = (char *) dk_alloc (ucm_file_len+1);
-  if (1 != fread (ucm_file_text, ucm_file_len, 1, ucm_file))
+  if (!ucm_file_text || 1 != fread (ucm_file_text, ucm_file_len, 1, ucm_file))
     {
       fclose (ucm_file);
       error_logger ("Unable to read %ld bytes from UCM file '%s' for reading", ucm_file_len, ucm_file_name);
+      if (ucm_file_text)
+        dk_free (ucm_file_text, ucm_file_len+1);
       return NULL;
     }
   fclose (ucm_file);
diff --git a/libsrc/langfunc/langfunc.c b/libsrc/langfunc/langfunc.c
index 1b880fb..f83142d 100644
--- a/libsrc/langfunc/langfunc.c
+++ b/libsrc/langfunc/langfunc.c
@@ -22,6 +22,7 @@
 */
 #include "langfunc.h"
 #include "latin1ctype.h"
+/*#define LH_ITERATOR_DEBUG 1*/
 
 static int unichar_getprops_stub (unichar uchr);
 
@@ -532,50 +533,117 @@ int lh_tolower_word__xany (const unichar *srcbuf, size_t srcbufsize, unichar *tg
   return 1;
 }
 
+int lh_xany_normalization_flags = 0;
 
 int lh_normalize_word__xany (const unichar *srcbuf, size_t srcbufsize, unichar *tgtbuf, size_t *tgtbufsize)
 {
-  size_t ctr;
+  size_t ctr, tgt_count = 0, srcsz1;
   /* int isspecial = 0; */
-  if (WORD_MAX_CHARS < srcbufsize)
+  if ((WORD_MAX_CHARS < srcbufsize) || (1 > srcbufsize))
     return 0;
+  switch (lh_xany_normalization_flags & (LH_XANY_NORMALIZATION_COMBINE | LH_XANY_NORMALIZATION_TOBASE))
+    {
+    case LH_XANY_NORMALIZATION_COMBINE | LH_XANY_NORMALIZATION_TOBASE:
+      tgt_count = 0;
+      srcsz1 = srcbufsize-1;
+      for (ctr = 0; ctr < srcsz1; ctr++)
+        {
+          unichar u = srcbuf[ctr];
+          unichar next = srcbuf[ctr+1];
+          unichar res;
+          if ((next >= unicode3_min_used_modif_char) && (next <= unicode3_max_used_modif_char))
+            {
+              res = unicode3_combine_base_and_modif_upper (u, next);
+              if (res)
+                {
+                  tgtbuf[tgt_count++] = unicode3_getupperbasechar (res);
+                  ctr++;
+                  continue;
+                }
+            }
+          res = unicode3_getupperbasechar (u);
+          tgtbuf[tgt_count++] = res;
+        }
+      if (ctr < srcbufsize)
+        tgtbuf[tgt_count++] = unicode3_getupperbasechar (srcbuf[ctr]);
+      break;
+    case LH_XANY_NORMALIZATION_COMBINE:
+      tgt_count = 0;
+      srcsz1 = srcbufsize-1;
+      for (ctr = 0; ctr < srcsz1; ctr++)
+        {
+          unichar u = srcbuf[ctr];
+          unichar next = srcbuf[ctr+1];
+          unichar res;
+          if ((next >= unicode3_min_used_modif_char) && (next <= unicode3_max_used_modif_char))
+            {
+              res = unicode3_combine_base_and_modif_upper (u, next);
+              if (res)
+                {
+                  tgtbuf[tgt_count++] = unicode3_getupperbasechar (res);
+                  ctr++;
+                  continue;
+                }
+            }
+          res = unicode3_getupperbasechar (u);
+          tgtbuf[tgt_count++] = res;
+        }
+      if (ctr < srcbufsize)
+        tgtbuf[tgt_count++] = unichar_getucase (srcbuf[ctr]);
+      break;
+    case LH_XANY_NORMALIZATION_TOBASE:
+      for (ctr = 0; ctr < srcbufsize; ctr++)
+        {
+          unichar u = srcbuf[ctr];
+          u = unicode3_getupperbasechar (u);
+          tgtbuf[ctr] = u;
+          /* if (u < 'A')
+            isspecial = 1; */
+        }
+      tgt_count = srcbufsize;
+      break;
+    case 0:
   for (ctr = 0; ctr < srcbufsize; ctr++)
     {
-      unichar ucased = unichar_getucase (srcbuf[ctr]);
-      tgtbuf[ctr] = ucased;
-      /* if (ucased < 'A')
+          unichar u = srcbuf[ctr];
+          u = unichar_getucase (u);
+          tgtbuf[ctr] = u;
+          /* if (u < 'A')
         isspecial = 1; */
     }
+      tgt_count = srcbufsize;
+      break;
+    }
 #if 0 /* This is commented out because this plural-to-single is not fully valid */
-  if (isspecial || (srcbufsize < 3) || ('S' != tgtbuf[srcbufsize - 1]) || ('S' == tgtbuf[srcbufsize - 2]))
+  if (isspecial || (tgt_count < 3) || ('S' != tgtbuf[tgt_count - 1]) || ('S' == tgtbuf[tgt_count - 2]))
     { /* Special or singular */
-      tgtbufsize[0] = srcbufsize;
+      tgtbufsize[0] = tgt_count;
       return 1;
     }
-  if ('E' == tgtbuf[srcbufsize - 2])
+  if ('E' == tgtbuf[tgt_count - 2])
     { /* "...ES"  plural */
-      if ((3 == srcbufsize) && ('Y' == tgtbuf[0]))
+      if ((3 == tgt_count) && ('Y' == tgtbuf[0]))
         { /* "YES" is singular */
-          tgtbufsize[0] = srcbufsize;
+          tgtbufsize[0] = tgt_count;
           return 1;
         }
-      if ('I' == tgtbuf[srcbufsize - 3])
+      if ('I' == tgtbuf[tgt_count - 3])
         { /* "...IES" plural */
-          tgtbuf[srcbufsize - 3] = 'Y';
-          tgtbufsize[0] = srcbufsize - 2;
+          tgtbuf[tgt_count - 3] = 'Y';
+          tgtbufsize[0] = tgt_count - 2;
           return 1;
         }
-      if ('S' == tgtbuf[srcbufsize - 3])
+      if ('S' == tgtbuf[tgt_count - 3])
         { /* "...SES" plural */
-          tgtbufsize[0] = srcbufsize - 2;
+          tgtbufsize[0] = tgt_count - 2;
           return 1;
         }
-      tgtbufsize[0] = srcbufsize - 1;
+      tgtbufsize[0] = tgt_count - 1;
       return 1;
     }  
-  tgtbufsize[0] = srcbufsize - 1; /* "...S"  plural */
+  tgtbufsize[0] = tgt_count - 1; /* "...S"  plural */
 #else
-  tgtbufsize[0] = srcbufsize;
+  tgtbufsize[0] = tgt_count;
 #endif
   return 1;
 }
diff --git a/libsrc/langfunc/langfunc.h b/libsrc/langfunc/langfunc.h
index 398ee64..c9b7dde 100644
--- a/libsrc/langfunc/langfunc.h
+++ b/libsrc/langfunc/langfunc.h
@@ -243,8 +243,21 @@ unicode_block_t *ub_getblock(unichar uchr);
 extern unichar unicode3_getucase (unichar uchr);
 /*! \brief Returns given unichar lowercased, based on data from Unicode3 tables */
 extern unichar unicode3_getlcase (unichar uchr);
+/*! \brief Returns given unichar converted to a base char (i.e. remove umlauts, accents etc.) */
+extern unichar unicode3_getbasechar (unichar uchr);
+/*! \brief An accelerated superposition of unicode3_getbasechar and then unicode3_getucase */
+extern unichar unicode3_getupperbasechar (unichar uchr);
+/*! \brief Returns a char that is combination of a base char and NSM modifier, i.e. slightly "inverse" to unicode3_getbasechar */
+extern unichar unicode3_combine_base_and_modif (unichar base, unichar modif);
+/*! \brief An accelerated superposition of unicode3_combine_base_and_modif and then unicode3_getucase */
+extern unichar unicode3_combine_base_and_modif_upper (unichar base, unichar modif);
 /*! \brief Returns if given unichar is a 'logical space' character */
 extern int unicode3_isspace (unichar uchr);
+/*! \brief The minimal nonspacing modifier (NSM) char like umlaut or accent to modify other character */
+extern unichar unicode3_min_used_modif_char;
+/*! \brief The maximal nonspacing modifier (NSM) char like umlaut or accent to modify other character. Not every char between \c unicode3_min_used_modif_char and this one is an NSM, but all NSMs actually used as modifiers falls in this interval */
+extern unichar unicode3_max_used_modif_char;
+
 
 /*! \brief Returns properties of unichar */
 EXE_EXPORT (int, unichar_getprops, (unichar uchr));
@@ -656,6 +669,11 @@ extern eh_encode_char_t eh_encode_char__charset;
 extern eh_decode_buffer_t eh_decode_buffer__charset;
 extern eh_encode_buffer_t eh_encode_buffer__charset;
 
+/*! \brief x-any language handler can normalize combined characters in different ways, depending on this variable */
+extern int lh_xany_normalization_flags;
+#define LH_XANY_NORMALIZATION_COMBINE		0x1 /*!< Any pair of base char and combinig char (NSM, non-spacing modifier) is replaced with a single combined char */
+#define LH_XANY_NORMALIZATION_TOBASE		0x2 /*!< Any combined char is converted to its (smallest known) base. If bit LH_XANY_NORMALIZATION_COMBINE is also set, pair of base char and combinig char loses its second char */
+#define LH_XANY_NORMALIZATION_FULL 0xFF	/*!< More flags may appear in the future */
 /*! \brief Language handler for "x-any" language, used for unknown/unspecified languages */
 extern lang_handler_t lh__xany;
 /*! \brief Language handler for "x-ftq-x-any" language, used as free-text-query language for unknown/unspecified languages */
diff --git a/libsrc/langfunc/langfunc_templ.c b/libsrc/langfunc/langfunc_templ.c
index e60bbb7..141d39b 100644
--- a/libsrc/langfunc/langfunc_templ.c
+++ b/libsrc/langfunc/langfunc_templ.c
@@ -68,6 +68,12 @@ void LH_ITERATE_WORDS_NAME(const unichar *buf, size_t bufsize, lh_word_check_t *
   size_t hugeword_buf_size = 0;
   utf8char *word_end;
   int prop;
+#ifdef LH_ITERATOR_DEBUG
+  int wordctr = 0, wordcount = LH_COUNT_WORDS_NAME (buf, bufsize, check);
+#define wordctr_INC1 wordctr++
+#else
+#define wordctr_INC1
+#endif
   while (pos < bufsize)
     {
       prop = UNICHAR_GETPROPS_EXPN (buf, bufsize, pos);
@@ -84,6 +90,7 @@ void LH_ITERATE_WORDS_NAME(const unichar *buf, size_t bufsize, lh_word_check_t *
 	  if (NULL != word_end)
 	    {
 	      callback (word_buf, word_end-word_buf, userdata);
+              wordctr_INC1;
 	      continue;
 	    }
 	  if (hugeword_buf_size<(word_length*MAX_UTF8_CHAR))
@@ -95,6 +102,7 @@ void LH_ITERATE_WORDS_NAME(const unichar *buf, size_t bufsize, lh_word_check_t *
 	    }
 	  word_end = (utf8char *)eh_encode_buffer__UTF8 (buf+word_start, buf+pos, (char *)hugeword_buf, (char *)(hugeword_buf+hugeword_buf_size));
 	  callback (hugeword_buf, word_end-hugeword_buf, userdata);
+          wordctr_INC1;
 	  continue;
 	}
       if (prop & UCP_IDEO)
@@ -105,12 +113,17 @@ void LH_ITERATE_WORDS_NAME(const unichar *buf, size_t bufsize, lh_word_check_t *
 	    continue;
 	  word_end = (utf8char *)eh_encode_buffer__UTF8 (buf+word_start, buf+pos, (char *)(word_buf), (char *)(word_buf+BUFSIZEOF__UTF8_WORD));
 	  callback (word_buf, word_end-word_buf, userdata);
+          wordctr_INC1;
 	  continue;
 	}
       pos++;
     }
   if (hugeword_buf_size)
     dk_free (hugeword_buf, hugeword_buf_size);
+#ifdef LH_ITERATOR_DEBUG
+  if (wordctr != wordcount)
+    GPF_T;
+#endif
 }
 
 
@@ -127,6 +140,12 @@ void LH_ITERATE_PATCHED_WORDS_NAME(const unichar *buf, size_t bufsize, lh_word_c
   size_t hugeword_buf_size = 0;
   utf8char *word_end;
   int prop;
+#ifdef LH_ITERATOR_DEBUG
+  int wordctr = 0, wordcount = LH_COUNT_WORDS_NAME (buf, bufsize, check);
+#define wordctr_INC1 wordctr++
+#else
+#define wordctr_INC1
+#endif
   while (pos < bufsize)
     {
       prop = UNICHAR_GETPROPS_EXPN(buf,bufsize,pos);
@@ -160,6 +179,7 @@ void LH_ITERATE_PATCHED_WORDS_NAME(const unichar *buf, size_t bufsize, lh_word_c
 	  if (NULL != word_end)
 	    {
 	      callback (word_buf, word_end-word_buf, userdata);
+              wordctr_INC1;
 	      continue;
 	    }
 	  if (hugeword_buf_size<(word_length*MAX_UTF8_CHAR))
@@ -171,6 +191,7 @@ void LH_ITERATE_PATCHED_WORDS_NAME(const unichar *buf, size_t bufsize, lh_word_c
 	    }
 	  word_end = (utf8char *)eh_encode_buffer__UTF8 (arg_begin, arg_begin+arg_length, (char *)(hugeword_buf), (char *)(hugeword_buf+hugeword_buf_size));
 	  callback (hugeword_buf, word_end-hugeword_buf, userdata);
+          wordctr_INC1;
 	  continue;
 	}
       if (prop & UCP_IDEO)
@@ -199,11 +220,16 @@ void LH_ITERATE_PATCHED_WORDS_NAME(const unichar *buf, size_t bufsize, lh_word_c
 	    }
 	  word_end = (utf8char *)eh_encode_buffer__UTF8 (arg_begin, arg_begin+arg_length, (char *)(word_buf), (char *)(word_buf+BUFSIZEOF__UTF8_WORD));
 	  callback (word_buf, word_end-word_buf, userdata);
+          wordctr_INC1;
 	  continue;
 	}
       pos++;
     }
   if (hugeword_buf_size)
     dk_free (hugeword_buf, hugeword_buf_size);
+#ifdef LH_ITERATOR_DEBUG
+  if (wordctr != wordcount)
+    GPF_T;
+#endif
 }
 
diff --git a/libsrc/langfunc/langman.c b/libsrc/langfunc/langman.c
index 316404f..95b990f 100644
--- a/libsrc/langfunc/langman.c
+++ b/libsrc/langfunc/langman.c
@@ -314,6 +314,7 @@ void langfunc_plugin_connect (const unit_version_t *plugin)
 
 #endif
 
+extern void unicode3_init_char_combining_hashtables (void);
 extern eh_charset_t eh_generic_chardefs[];
 extern int eh_generic_chardefs_length;
 extern void connect__enUS (void *appdata);
@@ -328,6 +329,7 @@ void langfunc_kernel_init (void)
     return;
   done = 1;
   reset_work_uniblocks ();
+  unicode3_init_char_combining_hashtables ();
   eh_load_handler (&eh__UCS4);
   eh_load_handler (&eh__UCS4BE);
   eh_load_handler (&eh__UCS4LE);
diff --git a/libsrc/langfunc/unicode3.c b/libsrc/langfunc/unicode3.c
index 7748f31..b9105da 100644
--- a/libsrc/langfunc/unicode3.c
+++ b/libsrc/langfunc/unicode3.c
@@ -21,6 +21,7 @@
  *  
 */
 #include "langfunc.h"
+#include "Dkhash.h"
 
 
 /* Conversion to uppercase */
@@ -105,7 +106,160 @@ unichar unicode3_getlcase (unichar uchr)
 }
 
 
-/* Conversion to lowercase */
+/* Conversion to base char */
+
+struct unicode3_tobasechar_s
+{
+  unsigned short int u3c_cell;
+  unsigned short int u3c_basechar;
+  unsigned short int u3c_upperbasechar;
+  unsigned short int u3c_modifier;
+};
+
+typedef struct unicode3_tobasechar_s unicode3_tobasechar_t;
+
+#define UNICODE3_HEADER unicode3_tobasechar_t unicode3_tobasechars[] = {
+#define UNICODE3_FOOTER {~0} };
+#define UNICODE3_S2(mode,base,modif) base, base, modif
+#define UNICODE3_S1(mode,base) base, base, 0
+#define UNICODE3_REC(cell,grp1,idx1,grp2,digit1,digit2,digit3,ucase1,lcase,ucase2,flg1,repl1,name1,name2,unicodename) \
+{cell,repl1},
+#include "unicode3_basechars.h"
+#undef UNICODE3_HEADER
+#undef UNICODE3_FOOTER
+#undef UNICODE3_REC
+
+
+unichar unicode3_getbasechar (unichar uchr)
+{
+  int left_cop = 0;
+  int right_cop = (int)(sizeof(unicode3_tobasechars)/sizeof(unicode3_tobasechars[0])) - 1;
+  int robber = (252-1);	/* We should optimize search for the most important case - 252(!) different modified Latin chars */
+  unichar curr;
+  while (left_cop <= right_cop)
+    {
+      curr = unicode3_tobasechars[robber].u3c_cell;
+      if (uchr == curr)
+	return unicode3_tobasechars[robber].u3c_basechar;
+      if (uchr < curr)
+	right_cop = robber-1;
+      else
+	left_cop = robber+1;
+      robber = (left_cop+right_cop)/2;
+    }
+  return uchr;
+}
+
+unichar unicode3_getupperbasechar (unichar uchr)
+{
+  int left_cop = 0;
+  int right_cop = (int)(sizeof(unicode3_tobasechars)/sizeof(unicode3_tobasechars[0])) - 1;
+  int robber = (252-1);	/* We should optimize search for the most important case - 252(!) different modified Latin chars */
+  unichar curr;
+  while (left_cop <= right_cop)
+    {
+      curr = unicode3_tobasechars[robber].u3c_cell;
+      if (uchr == curr)
+	return unicode3_tobasechars[robber].u3c_upperbasechar;
+      if (uchr < curr)
+	right_cop = robber-1;
+      else
+	left_cop = robber+1;
+      robber = (left_cop+right_cop)/2;
+    }
+  return unicode3_getucase (uchr);
+}
+
+/* Conversion from a base char and modif to a single combined char */
+
+dk_hash_t *unicode3_modif_usages = NULL;
+dk_hash_t *unicode3_charmodif_to_combined = NULL;
+dk_hash_t *unicode3_charmodif_to_combined_upper = NULL;
+unichar unicode3_min_used_modif_char = 0xFFFF, unicode3_max_used_modif_char = 0;
+unichar unicode3_min_exact_clone_char = 0xFFFF, unicode3_max_exact_clone_char = 0;
+
+unichar unicode3_combine_base_and_modif (unichar base, unichar modif)
+{
+  uptrlong boundaries = (uptrlong) gethash ((void *)((ptrlong)modif), unicode3_modif_usages);
+  if (boundaries && (base >= (boundaries >> 16)) && (base <= (boundaries & 0xFFFF)))
+    {
+      uptrlong mix = (base << 16) | modif;
+      uptrlong combined = (uptrlong) gethash ((void *)mix, unicode3_charmodif_to_combined);
+      return combined;
+    }
+  return 0;
+}
+
+unichar unicode3_combine_base_and_modif_upper (unichar base, unichar modif)
+{
+  uptrlong boundaries = (uptrlong) gethash ((void *)((ptrlong)modif), unicode3_modif_usages);
+  if (boundaries && (base >= (boundaries >> 16)) && (base <= (boundaries & 0xFFFF)))
+    {
+      uptrlong mix = (base << 16) | modif;
+      uptrlong combined_upper = (uptrlong) gethash ((void *)mix, unicode3_charmodif_to_combined_upper);
+      return combined_upper;
+    }
+  return 0;
+}
+
+void unicode3_init_char_combining_hashtables (void)
+{
+  int cellctr;
+  int cellcount = (int)(sizeof(unicode3_tobasechars)/sizeof(unicode3_tobasechars[0])) - 1;
+  if (NULL != unicode3_modif_usages)
+    return;
+  unicode3_modif_usages = hash_table_allocate (509);
+  unicode3_charmodif_to_combined = hash_table_allocate (1531);
+  unicode3_charmodif_to_combined_upper = hash_table_allocate (1531);
+  for (cellctr = 0; cellctr - cellcount; cellctr++)
+    {
+      unicode3_tobasechar_t *rec = unicode3_tobasechars + cellctr;
+      uptrlong cell = rec->u3c_cell;
+      unichar modif = rec->u3c_modifier;
+      uptrlong mix, old_cell_for_mix, boundaries, boundaries_min, boundaries_max;
+      rec->u3c_upperbasechar = unicode3_getucase (rec->u3c_basechar);
+      if (0 == modif)
+        {
+          if (cell < unicode3_min_exact_clone_char)
+            unicode3_min_exact_clone_char = cell;
+          if (cell > unicode3_max_exact_clone_char)
+            unicode3_max_exact_clone_char = cell;
+          continue;
+        }
+      if (modif < unicode3_min_used_modif_char)
+        unicode3_min_used_modif_char = modif;
+      if (modif > unicode3_max_used_modif_char)
+        unicode3_max_used_modif_char = modif;
+      mix = (rec->u3c_basechar << 16) | modif;
+      old_cell_for_mix = (uptrlong) gethash ((void *)mix, unicode3_charmodif_to_combined);
+      if (old_cell_for_mix)
+        {
+#ifndef NDEBUG
+	  GPF_T;
+#endif
+	  continue;
+        }
+      sethash ((void *)mix, unicode3_charmodif_to_combined, (void *)cell);
+      sethash ((void *)mix, unicode3_charmodif_to_combined_upper, (void *)(ptrlong)(unicode3_getucase (cell)));
+      boundaries = (uptrlong) gethash ((void *)((ptrlong)modif), unicode3_modif_usages);
+      if (!boundaries)
+        {
+	  boundaries_min = boundaries_max = rec->u3c_basechar;
+        }
+      else
+        {
+	  boundaries_min = boundaries >> 16;
+          boundaries_max = boundaries & 0xFFFF;
+          if (rec->u3c_basechar < boundaries_min)
+            boundaries_min = rec->u3c_basechar;
+          if (rec->u3c_basechar > boundaries_max)
+            boundaries_max = rec->u3c_basechar;
+        }
+      sethash ((void *)((ptrlong)(modif)), unicode3_modif_usages, ((void*)((boundaries_min << 16) | boundaries_max)));
+    }
+}
+
+/* Check for being a whitespace */
 
 #define UNICODE3_HEADER unichar unicode3_spaces[] = {
 #define UNICODE3_FOOTER ~0 };
diff --git a/libsrc/langfunc/unicode3_basechars.h b/libsrc/langfunc/unicode3_basechars.h
new file mode 100644
index 0000000..2639a98
--- /dev/null
+++ b/libsrc/langfunc/unicode3_basechars.h
@@ -0,0 +1,1336 @@
+/*
+ *  This file is generated by unicodetab2h.sh
+ *  
+ *  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
+ *  project.
+ *  
+ *  Copyright (C) 1998-2006 OpenLink Software
+ *  
+ *  This project is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; only version 2 of the License, dated June 1991.
+ *  
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *  General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *  
+ *  
+ */
+UNICODE3_HEADER
+UNICODE3_REC( 0x00C0	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00E0	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0300), ""	, "LATIN CAPITAL LETTER A GRAVE"	, "LATIN CAPITAL LETTER A WITH GRAVE")
+UNICODE3_REC( 0x00C1	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00E1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0301), ""	, "LATIN CAPITAL LETTER A ACUTE"	, "LATIN CAPITAL LETTER A WITH ACUTE")
+UNICODE3_REC( 0x00C2	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00E2	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0302), ""	, "LATIN CAPITAL LETTER A CIRCUMFLEX"	, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX")
+UNICODE3_REC( 0x00C3	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00E3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0303), ""	, "LATIN CAPITAL LETTER A TILDE"	, "LATIN CAPITAL LETTER A WITH TILDE")
+UNICODE3_REC( 0x00C4	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00E4	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0308), ""	, "LATIN CAPITAL LETTER A DIAERESIS"	, "LATIN CAPITAL LETTER A WITH DIAERESIS")
+UNICODE3_REC( 0x00C5	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00E5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x030A), ""	, "LATIN CAPITAL LETTER A RING"	, "LATIN CAPITAL LETTER A WITH RING ABOVE")
+UNICODE3_REC( 0x00C7	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00E7	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0043, 0x0327), ""	, "LATIN CAPITAL LETTER C CEDILLA"	, "LATIN CAPITAL LETTER C WITH CEDILLA")
+UNICODE3_REC( 0x00C8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00E8	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0300), ""	, "LATIN CAPITAL LETTER E GRAVE"	, "LATIN CAPITAL LETTER E WITH GRAVE")
+UNICODE3_REC( 0x00C9	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00E9	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0301), ""	, "LATIN CAPITAL LETTER E ACUTE"	, "LATIN CAPITAL LETTER E WITH ACUTE")
+UNICODE3_REC( 0x00CA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00EA	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0302), ""	, "LATIN CAPITAL LETTER E CIRCUMFLEX"	, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX")
+UNICODE3_REC( 0x00CB	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00EB	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0308), ""	, "LATIN CAPITAL LETTER E DIAERESIS"	, "LATIN CAPITAL LETTER E WITH DIAERESIS")
+UNICODE3_REC( 0x00CC	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00EC	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0300), ""	, "LATIN CAPITAL LETTER I GRAVE"	, "LATIN CAPITAL LETTER I WITH GRAVE")
+UNICODE3_REC( 0x00CD	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00ED	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0301), ""	, "LATIN CAPITAL LETTER I ACUTE"	, "LATIN CAPITAL LETTER I WITH ACUTE")
+UNICODE3_REC( 0x00CE	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00EE	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0302), ""	, "LATIN CAPITAL LETTER I CIRCUMFLEX"	, "LATIN CAPITAL LETTER I WITH CIRCUMFLEX")
+UNICODE3_REC( 0x00CF	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00EF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0308), ""	, "LATIN CAPITAL LETTER I DIAERESIS"	, "LATIN CAPITAL LETTER I WITH DIAERESIS")
+UNICODE3_REC( 0x00D1	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00F1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004E, 0x0303), ""	, "LATIN CAPITAL LETTER N TILDE"	, "LATIN CAPITAL LETTER N WITH TILDE")
+UNICODE3_REC( 0x00D2	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00F2	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x0300), ""	, "LATIN CAPITAL LETTER O GRAVE"	, "LATIN CAPITAL LETTER O WITH GRAVE")
+UNICODE3_REC( 0x00D3	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00F3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x0301), ""	, "LATIN CAPITAL LETTER O ACUTE"	, "LATIN CAPITAL LETTER O WITH ACUTE")
+UNICODE3_REC( 0x00D4	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00F4	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x0302), ""	, "LATIN CAPITAL LETTER O CIRCUMFLEX"	, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX")
+UNICODE3_REC( 0x00D5	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00F5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x0303), ""	, "LATIN CAPITAL LETTER O TILDE"	, "LATIN CAPITAL LETTER O WITH TILDE")
+UNICODE3_REC( 0x00D6	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00F6	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x0308), ""	, "LATIN CAPITAL LETTER O DIAERESIS"	, "LATIN CAPITAL LETTER O WITH DIAERESIS")
+UNICODE3_REC( 0x00D9	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00F9	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0300), ""	, "LATIN CAPITAL LETTER U GRAVE"	, "LATIN CAPITAL LETTER U WITH GRAVE")
+UNICODE3_REC( 0x00DA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00FA	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0301), ""	, "LATIN CAPITAL LETTER U ACUTE"	, "LATIN CAPITAL LETTER U WITH ACUTE")
+UNICODE3_REC( 0x00DB	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00FB	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0302), ""	, "LATIN CAPITAL LETTER U CIRCUMFLEX"	, "LATIN CAPITAL LETTER U WITH CIRCUMFLEX")
+UNICODE3_REC( 0x00DC	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00FC	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0308), ""	, "LATIN CAPITAL LETTER U DIAERESIS"	, "LATIN CAPITAL LETTER U WITH DIAERESIS")
+UNICODE3_REC( 0x00DD	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00FD	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0059, 0x0301), ""	, "LATIN CAPITAL LETTER Y ACUTE"	, "LATIN CAPITAL LETTER Y WITH ACUTE")
+UNICODE3_REC( 0x00E0	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00C0	, 0x0000	, 0x00C0	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0300), ""	, "LATIN SMALL LETTER A GRAVE"	, "LATIN SMALL LETTER A WITH GRAVE")
+UNICODE3_REC( 0x00E1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00C1	, 0x0000	, 0x00C1	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0301), ""	, "LATIN SMALL LETTER A ACUTE"	, "LATIN SMALL LETTER A WITH ACUTE")
+UNICODE3_REC( 0x00E2	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00C2	, 0x0000	, 0x00C2	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0302), ""	, "LATIN SMALL LETTER A CIRCUMFLEX"	, "LATIN SMALL LETTER A WITH CIRCUMFLEX")
+UNICODE3_REC( 0x00E3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00C3	, 0x0000	, 0x00C3	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0303), ""	, "LATIN SMALL LETTER A TILDE"	, "LATIN SMALL LETTER A WITH TILDE")
+UNICODE3_REC( 0x00E4	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00C4	, 0x0000	, 0x00C4	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0308), ""	, "LATIN SMALL LETTER A DIAERESIS"	, "LATIN SMALL LETTER A WITH DIAERESIS")
+UNICODE3_REC( 0x00E5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00C5	, 0x0000	, 0x00C5	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x030A), ""	, "LATIN SMALL LETTER A RING"	, "LATIN SMALL LETTER A WITH RING ABOVE")
+UNICODE3_REC( 0x00E7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00C7	, 0x0000	, 0x00C7	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0063, 0x0327), ""	, "LATIN SMALL LETTER C CEDILLA"	, "LATIN SMALL LETTER C WITH CEDILLA")
+UNICODE3_REC( 0x00E8	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00C8	, 0x0000	, 0x00C8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0300), ""	, "LATIN SMALL LETTER E GRAVE"	, "LATIN SMALL LETTER E WITH GRAVE")
+UNICODE3_REC( 0x00E9	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00C9	, 0x0000	, 0x00C9	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0301), ""	, "LATIN SMALL LETTER E ACUTE"	, "LATIN SMALL LETTER E WITH ACUTE")
+UNICODE3_REC( 0x00EA	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00CA	, 0x0000	, 0x00CA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0302), ""	, "LATIN SMALL LETTER E CIRCUMFLEX"	, "LATIN SMALL LETTER E WITH CIRCUMFLEX")
+UNICODE3_REC( 0x00EB	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00CB	, 0x0000	, 0x00CB	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0308), ""	, "LATIN SMALL LETTER E DIAERESIS"	, "LATIN SMALL LETTER E WITH DIAERESIS")
+UNICODE3_REC( 0x00EC	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00CC	, 0x0000	, 0x00CC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x0300), ""	, "LATIN SMALL LETTER I GRAVE"	, "LATIN SMALL LETTER I WITH GRAVE")
+UNICODE3_REC( 0x00ED	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00CD	, 0x0000	, 0x00CD	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x0301), ""	, "LATIN SMALL LETTER I ACUTE"	, "LATIN SMALL LETTER I WITH ACUTE")
+UNICODE3_REC( 0x00EE	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00CE	, 0x0000	, 0x00CE	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x0302), ""	, "LATIN SMALL LETTER I CIRCUMFLEX"	, "LATIN SMALL LETTER I WITH CIRCUMFLEX")
+UNICODE3_REC( 0x00EF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00CF	, 0x0000	, 0x00CF	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x0308), ""	, "LATIN SMALL LETTER I DIAERESIS"	, "LATIN SMALL LETTER I WITH DIAERESIS")
+UNICODE3_REC( 0x00F1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00D1	, 0x0000	, 0x00D1	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006E, 0x0303), ""	, "LATIN SMALL LETTER N TILDE"	, "LATIN SMALL LETTER N WITH TILDE")
+UNICODE3_REC( 0x00F2	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00D2	, 0x0000	, 0x00D2	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x0300), ""	, "LATIN SMALL LETTER O GRAVE"	, "LATIN SMALL LETTER O WITH GRAVE")
+UNICODE3_REC( 0x00F3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00D3	, 0x0000	, 0x00D3	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x0301), ""	, "LATIN SMALL LETTER O ACUTE"	, "LATIN SMALL LETTER O WITH ACUTE")
+UNICODE3_REC( 0x00F4	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00D4	, 0x0000	, 0x00D4	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x0302), ""	, "LATIN SMALL LETTER O CIRCUMFLEX"	, "LATIN SMALL LETTER O WITH CIRCUMFLEX")
+UNICODE3_REC( 0x00F5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00D5	, 0x0000	, 0x00D5	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x0303), ""	, "LATIN SMALL LETTER O TILDE"	, "LATIN SMALL LETTER O WITH TILDE")
+UNICODE3_REC( 0x00F6	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00D6	, 0x0000	, 0x00D6	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x0308), ""	, "LATIN SMALL LETTER O DIAERESIS"	, "LATIN SMALL LETTER O WITH DIAERESIS")
+UNICODE3_REC( 0x00F9	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00D9	, 0x0000	, 0x00D9	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0300), ""	, "LATIN SMALL LETTER U GRAVE"	, "LATIN SMALL LETTER U WITH GRAVE")
+UNICODE3_REC( 0x00FA	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00DA	, 0x0000	, 0x00DA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0301), ""	, "LATIN SMALL LETTER U ACUTE"	, "LATIN SMALL LETTER U WITH ACUTE")
+UNICODE3_REC( 0x00FB	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00DB	, 0x0000	, 0x00DB	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0302), ""	, "LATIN SMALL LETTER U CIRCUMFLEX"	, "LATIN SMALL LETTER U WITH CIRCUMFLEX")
+UNICODE3_REC( 0x00FC	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00DC	, 0x0000	, 0x00DC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0308), ""	, "LATIN SMALL LETTER U DIAERESIS"	, "LATIN SMALL LETTER U WITH DIAERESIS")
+UNICODE3_REC( 0x00FD	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x00DD	, 0x0000	, 0x00DD	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0079, 0x0301), ""	, "LATIN SMALL LETTER Y ACUTE"	, "LATIN SMALL LETTER Y WITH ACUTE")
+UNICODE3_REC( 0x00FF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0178	, 0x0000	, 0x0178	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0079, 0x0308), ""	, "LATIN SMALL LETTER Y DIAERESIS"	, "LATIN SMALL LETTER Y WITH DIAERESIS")
+UNICODE3_REC( 0x0100	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0101	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0304), ""	, "LATIN CAPITAL LETTER A MACRON"	, "LATIN CAPITAL LETTER A WITH MACRON")
+UNICODE3_REC( 0x0101	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0100	, 0x0000	, 0x0100	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0304), ""	, "LATIN SMALL LETTER A MACRON"	, "LATIN SMALL LETTER A WITH MACRON")
+UNICODE3_REC( 0x0102	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0103	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0306), ""	, "LATIN CAPITAL LETTER A BREVE"	, "LATIN CAPITAL LETTER A WITH BREVE")
+UNICODE3_REC( 0x0103	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0102	, 0x0000	, 0x0102	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0306), ""	, "LATIN SMALL LETTER A BREVE"	, "LATIN SMALL LETTER A WITH BREVE")
+UNICODE3_REC( 0x0104	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0105	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0328), ""	, "LATIN CAPITAL LETTER A OGONEK"	, "LATIN CAPITAL LETTER A WITH OGONEK")
+UNICODE3_REC( 0x0105	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0104	, 0x0000	, 0x0104	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0328), ""	, "LATIN SMALL LETTER A OGONEK"	, "LATIN SMALL LETTER A WITH OGONEK")
+UNICODE3_REC( 0x0106	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0107	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0043, 0x0301), ""	, "LATIN CAPITAL LETTER C ACUTE"	, "LATIN CAPITAL LETTER C WITH ACUTE")
+UNICODE3_REC( 0x0107	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0106	, 0x0000	, 0x0106	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0063, 0x0301), ""	, "LATIN SMALL LETTER C ACUTE"	, "LATIN SMALL LETTER C WITH ACUTE")
+UNICODE3_REC( 0x0108	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0109	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0043, 0x0302), ""	, "LATIN CAPITAL LETTER C CIRCUMFLEX"	, "LATIN CAPITAL LETTER C WITH CIRCUMFLEX")
+UNICODE3_REC( 0x0109	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0108	, 0x0000	, 0x0108	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0063, 0x0302), ""	, "LATIN SMALL LETTER C CIRCUMFLEX"	, "LATIN SMALL LETTER C WITH CIRCUMFLEX")
+UNICODE3_REC( 0x010A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x010B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0043, 0x0307), ""	, "LATIN CAPITAL LETTER C DOT"	, "LATIN CAPITAL LETTER C WITH DOT ABOVE")
+UNICODE3_REC( 0x010B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x010A	, 0x0000	, 0x010A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0063, 0x0307), ""	, "LATIN SMALL LETTER C DOT"	, "LATIN SMALL LETTER C WITH DOT ABOVE")
+UNICODE3_REC( 0x010C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x010D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0043, 0x030C), ""	, "LATIN CAPITAL LETTER C HACEK"	, "LATIN CAPITAL LETTER C WITH CARON")
+UNICODE3_REC( 0x010D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x010C	, 0x0000	, 0x010C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0063, 0x030C), ""	, "LATIN SMALL LETTER C HACEK"	, "LATIN SMALL LETTER C WITH CARON")
+UNICODE3_REC( 0x010E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x010F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0044, 0x030C), ""	, "LATIN CAPITAL LETTER D HACEK"	, "LATIN CAPITAL LETTER D WITH CARON")
+UNICODE3_REC( 0x010F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x010E	, 0x0000	, 0x010E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0064, 0x030C), ""	, "LATIN SMALL LETTER D HACEK"	, "LATIN SMALL LETTER D WITH CARON")
+UNICODE3_REC( 0x0112	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0113	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0304), ""	, "LATIN CAPITAL LETTER E MACRON"	, "LATIN CAPITAL LETTER E WITH MACRON")
+UNICODE3_REC( 0x0113	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0112	, 0x0000	, 0x0112	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0304), ""	, "LATIN SMALL LETTER E MACRON"	, "LATIN SMALL LETTER E WITH MACRON")
+UNICODE3_REC( 0x0114	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0115	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0306), ""	, "LATIN CAPITAL LETTER E BREVE"	, "LATIN CAPITAL LETTER E WITH BREVE")
+UNICODE3_REC( 0x0115	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0114	, 0x0000	, 0x0114	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0306), ""	, "LATIN SMALL LETTER E BREVE"	, "LATIN SMALL LETTER E WITH BREVE")
+UNICODE3_REC( 0x0116	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0117	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0307), ""	, "LATIN CAPITAL LETTER E DOT"	, "LATIN CAPITAL LETTER E WITH DOT ABOVE")
+UNICODE3_REC( 0x0117	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0116	, 0x0000	, 0x0116	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0307), ""	, "LATIN SMALL LETTER E DOT"	, "LATIN SMALL LETTER E WITH DOT ABOVE")
+UNICODE3_REC( 0x0118	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0119	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0328), ""	, "LATIN CAPITAL LETTER E OGONEK"	, "LATIN CAPITAL LETTER E WITH OGONEK")
+UNICODE3_REC( 0x0119	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0118	, 0x0000	, 0x0118	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0328), ""	, "LATIN SMALL LETTER E OGONEK"	, "LATIN SMALL LETTER E WITH OGONEK")
+UNICODE3_REC( 0x011A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x011B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x030C), ""	, "LATIN CAPITAL LETTER E HACEK"	, "LATIN CAPITAL LETTER E WITH CARON")
+UNICODE3_REC( 0x011B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x011A	, 0x0000	, 0x011A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x030C), ""	, "LATIN SMALL LETTER E HACEK"	, "LATIN SMALL LETTER E WITH CARON")
+UNICODE3_REC( 0x011C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x011D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0047, 0x0302), ""	, "LATIN CAPITAL LETTER G CIRCUMFLEX"	, "LATIN CAPITAL LETTER G WITH CIRCUMFLEX")
+UNICODE3_REC( 0x011D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x011C	, 0x0000	, 0x011C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0067, 0x0302), ""	, "LATIN SMALL LETTER G CIRCUMFLEX"	, "LATIN SMALL LETTER G WITH CIRCUMFLEX")
+UNICODE3_REC( 0x011E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x011F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0047, 0x0306), ""	, "LATIN CAPITAL LETTER G BREVE"	, "LATIN CAPITAL LETTER G WITH BREVE")
+UNICODE3_REC( 0x011F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x011E	, 0x0000	, 0x011E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0067, 0x0306), ""	, "LATIN SMALL LETTER G BREVE"	, "LATIN SMALL LETTER G WITH BREVE")
+UNICODE3_REC( 0x0120	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0121	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0047, 0x0307), ""	, "LATIN CAPITAL LETTER G DOT"	, "LATIN CAPITAL LETTER G WITH DOT ABOVE")
+UNICODE3_REC( 0x0121	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0120	, 0x0000	, 0x0120	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0067, 0x0307), ""	, "LATIN SMALL LETTER G DOT"	, "LATIN SMALL LETTER G WITH DOT ABOVE")
+UNICODE3_REC( 0x0122	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0123	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0047, 0x0327), ""	, "LATIN CAPITAL LETTER G CEDILLA"	, "LATIN CAPITAL LETTER G WITH CEDILLA")
+UNICODE3_REC( 0x0123	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0122	, 0x0000	, 0x0122	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0067, 0x0327), ""	, "LATIN SMALL LETTER G CEDILLA"	, "LATIN SMALL LETTER G WITH CEDILLA")
+UNICODE3_REC( 0x0124	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0125	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0048, 0x0302), ""	, "LATIN CAPITAL LETTER H CIRCUMFLEX"	, "LATIN CAPITAL LETTER H WITH CIRCUMFLEX")
+UNICODE3_REC( 0x0125	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0124	, 0x0000	, 0x0124	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0068, 0x0302), ""	, "LATIN SMALL LETTER H CIRCUMFLEX"	, "LATIN SMALL LETTER H WITH CIRCUMFLEX")
+UNICODE3_REC( 0x0128	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0129	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0303), ""	, "LATIN CAPITAL LETTER I TILDE"	, "LATIN CAPITAL LETTER I WITH TILDE")
+UNICODE3_REC( 0x0129	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0128	, 0x0000	, 0x0128	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x0303), ""	, "LATIN SMALL LETTER I TILDE"	, "LATIN SMALL LETTER I WITH TILDE")
+UNICODE3_REC( 0x012A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x012B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0304), ""	, "LATIN CAPITAL LETTER I MACRON"	, "LATIN CAPITAL LETTER I WITH MACRON")
+UNICODE3_REC( 0x012B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x012A	, 0x0000	, 0x012A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x0304), ""	, "LATIN SMALL LETTER I MACRON"	, "LATIN SMALL LETTER I WITH MACRON")
+UNICODE3_REC( 0x012C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x012D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0306), ""	, "LATIN CAPITAL LETTER I BREVE"	, "LATIN CAPITAL LETTER I WITH BREVE")
+UNICODE3_REC( 0x012D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x012C	, 0x0000	, 0x012C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x0306), ""	, "LATIN SMALL LETTER I BREVE"	, "LATIN SMALL LETTER I WITH BREVE")
+UNICODE3_REC( 0x012E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x012F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0328), ""	, "LATIN CAPITAL LETTER I OGONEK"	, "LATIN CAPITAL LETTER I WITH OGONEK")
+UNICODE3_REC( 0x012F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x012E	, 0x0000	, 0x012E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x0328), ""	, "LATIN SMALL LETTER I OGONEK"	, "LATIN SMALL LETTER I WITH OGONEK")
+UNICODE3_REC( 0x0130	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0069	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0307), ""	, "LATIN CAPITAL LETTER I DOT"	, "LATIN CAPITAL LETTER I WITH DOT ABOVE")
+UNICODE3_REC( 0x0134	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0135	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004A, 0x0302), ""	, "LATIN CAPITAL LETTER J CIRCUMFLEX"	, "LATIN CAPITAL LETTER J WITH CIRCUMFLEX")
+UNICODE3_REC( 0x0135	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0134	, 0x0000	, 0x0134	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006A, 0x0302), ""	, "LATIN SMALL LETTER J CIRCUMFLEX"	, "LATIN SMALL LETTER J WITH CIRCUMFLEX")
+UNICODE3_REC( 0x0136	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0137	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004B, 0x0327), ""	, "LATIN CAPITAL LETTER K CEDILLA"	, "LATIN CAPITAL LETTER K WITH CEDILLA")
+UNICODE3_REC( 0x0137	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0136	, 0x0000	, 0x0136	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006B, 0x0327), ""	, "LATIN SMALL LETTER K CEDILLA"	, "LATIN SMALL LETTER K WITH CEDILLA")
+UNICODE3_REC( 0x0139	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x013A	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004C, 0x0301), ""	, "LATIN CAPITAL LETTER L ACUTE"	, "LATIN CAPITAL LETTER L WITH ACUTE")
+UNICODE3_REC( 0x013A	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0139	, 0x0000	, 0x0139	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006C, 0x0301), ""	, "LATIN SMALL LETTER L ACUTE"	, "LATIN SMALL LETTER L WITH ACUTE")
+UNICODE3_REC( 0x013B	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x013C	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004C, 0x0327), ""	, "LATIN CAPITAL LETTER L CEDILLA"	, "LATIN CAPITAL LETTER L WITH CEDILLA")
+UNICODE3_REC( 0x013C	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x013B	, 0x0000	, 0x013B	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006C, 0x0327), ""	, "LATIN SMALL LETTER L CEDILLA"	, "LATIN SMALL LETTER L WITH CEDILLA")
+UNICODE3_REC( 0x013D	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x013E	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004C, 0x030C), ""	, "LATIN CAPITAL LETTER L HACEK"	, "LATIN CAPITAL LETTER L WITH CARON")
+UNICODE3_REC( 0x013E	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x013D	, 0x0000	, 0x013D	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006C, 0x030C), ""	, "LATIN SMALL LETTER L HACEK"	, "LATIN SMALL LETTER L WITH CARON")
+UNICODE3_REC( 0x0143	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0144	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004E, 0x0301), ""	, "LATIN CAPITAL LETTER N ACUTE"	, "LATIN CAPITAL LETTER N WITH ACUTE")
+UNICODE3_REC( 0x0144	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0143	, 0x0000	, 0x0143	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006E, 0x0301), ""	, "LATIN SMALL LETTER N ACUTE"	, "LATIN SMALL LETTER N WITH ACUTE")
+UNICODE3_REC( 0x0145	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0146	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004E, 0x0327), ""	, "LATIN CAPITAL LETTER N CEDILLA"	, "LATIN CAPITAL LETTER N WITH CEDILLA")
+UNICODE3_REC( 0x0146	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0145	, 0x0000	, 0x0145	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006E, 0x0327), ""	, "LATIN SMALL LETTER N CEDILLA"	, "LATIN SMALL LETTER N WITH CEDILLA")
+UNICODE3_REC( 0x0147	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0148	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004E, 0x030C), ""	, "LATIN CAPITAL LETTER N HACEK"	, "LATIN CAPITAL LETTER N WITH CARON")
+UNICODE3_REC( 0x0148	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0147	, 0x0000	, 0x0147	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006E, 0x030C), ""	, "LATIN SMALL LETTER N HACEK"	, "LATIN SMALL LETTER N WITH CARON")
+UNICODE3_REC( 0x014C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x014D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x0304), ""	, "LATIN CAPITAL LETTER O MACRON"	, "LATIN CAPITAL LETTER O WITH MACRON")
+UNICODE3_REC( 0x014D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x014C	, 0x0000	, 0x014C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x0304), ""	, "LATIN SMALL LETTER O MACRON"	, "LATIN SMALL LETTER O WITH MACRON")
+UNICODE3_REC( 0x014E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x014F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x0306), ""	, "LATIN CAPITAL LETTER O BREVE"	, "LATIN CAPITAL LETTER O WITH BREVE")
+UNICODE3_REC( 0x014F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x014E	, 0x0000	, 0x014E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x0306), ""	, "LATIN SMALL LETTER O BREVE"	, "LATIN SMALL LETTER O WITH BREVE")
+UNICODE3_REC( 0x0150	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0151	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x030B), ""	, "LATIN CAPITAL LETTER O DOUBLE ACUTE"	, "LATIN CAPITAL LETTER O WITH DOUBLE ACUTE")
+UNICODE3_REC( 0x0151	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0150	, 0x0000	, 0x0150	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x030B), ""	, "LATIN SMALL LETTER O DOUBLE ACUTE"	, "LATIN SMALL LETTER O WITH DOUBLE ACUTE")
+UNICODE3_REC( 0x0154	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0155	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0052, 0x0301), ""	, "LATIN CAPITAL LETTER R ACUTE"	, "LATIN CAPITAL LETTER R WITH ACUTE")
+UNICODE3_REC( 0x0155	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0154	, 0x0000	, 0x0154	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0072, 0x0301), ""	, "LATIN SMALL LETTER R ACUTE"	, "LATIN SMALL LETTER R WITH ACUTE")
+UNICODE3_REC( 0x0156	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0157	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0052, 0x0327), ""	, "LATIN CAPITAL LETTER R CEDILLA"	, "LATIN CAPITAL LETTER R WITH CEDILLA")
+UNICODE3_REC( 0x0157	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0156	, 0x0000	, 0x0156	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0072, 0x0327), ""	, "LATIN SMALL LETTER R CEDILLA"	, "LATIN SMALL LETTER R WITH CEDILLA")
+UNICODE3_REC( 0x0158	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0159	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0052, 0x030C), ""	, "LATIN CAPITAL LETTER R HACEK"	, "LATIN CAPITAL LETTER R WITH CARON")
+UNICODE3_REC( 0x0159	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0158	, 0x0000	, 0x0158	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0072, 0x030C), ""	, "LATIN SMALL LETTER R HACEK"	, "LATIN SMALL LETTER R WITH CARON")
+UNICODE3_REC( 0x015A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x015B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0053, 0x0301), ""	, "LATIN CAPITAL LETTER S ACUTE"	, "LATIN CAPITAL LETTER S WITH ACUTE")
+UNICODE3_REC( 0x015B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x015A	, 0x0000	, 0x015A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0073, 0x0301), ""	, "LATIN SMALL LETTER S ACUTE"	, "LATIN SMALL LETTER S WITH ACUTE")
+UNICODE3_REC( 0x015C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x015D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0053, 0x0302), ""	, "LATIN CAPITAL LETTER S CIRCUMFLEX"	, "LATIN CAPITAL LETTER S WITH CIRCUMFLEX")
+UNICODE3_REC( 0x015D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x015C	, 0x0000	, 0x015C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0073, 0x0302), ""	, "LATIN SMALL LETTER S CIRCUMFLEX"	, "LATIN SMALL LETTER S WITH CIRCUMFLEX")
+UNICODE3_REC( 0x015E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x015F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0053, 0x0327), "*"	, "LATIN CAPITAL LETTER S CEDILLA"	, "LATIN CAPITAL LETTER S WITH CEDILLA")
+UNICODE3_REC( 0x015F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x015E	, 0x0000	, 0x015E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0073, 0x0327), "*"	, "LATIN SMALL LETTER S CEDILLA"	, "LATIN SMALL LETTER S WITH CEDILLA")
+UNICODE3_REC( 0x0160	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0161	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0053, 0x030C), ""	, "LATIN CAPITAL LETTER S HACEK"	, "LATIN CAPITAL LETTER S WITH CARON")
+UNICODE3_REC( 0x0161	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0160	, 0x0000	, 0x0160	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0073, 0x030C), ""	, "LATIN SMALL LETTER S HACEK"	, "LATIN SMALL LETTER S WITH CARON")
+UNICODE3_REC( 0x0162	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0163	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0054, 0x0327), "*"	, "LATIN CAPITAL LETTER T CEDILLA"	, "LATIN CAPITAL LETTER T WITH CEDILLA")
+UNICODE3_REC( 0x0163	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0162	, 0x0000	, 0x0162	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0074, 0x0327), "*"	, "LATIN SMALL LETTER T CEDILLA"	, "LATIN SMALL LETTER T WITH CEDILLA")
+UNICODE3_REC( 0x0164	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0165	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0054, 0x030C), ""	, "LATIN CAPITAL LETTER T HACEK"	, "LATIN CAPITAL LETTER T WITH CARON")
+UNICODE3_REC( 0x0165	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0164	, 0x0000	, 0x0164	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0074, 0x030C), ""	, "LATIN SMALL LETTER T HACEK"	, "LATIN SMALL LETTER T WITH CARON")
+UNICODE3_REC( 0x0168	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0169	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0303), ""	, "LATIN CAPITAL LETTER U TILDE"	, "LATIN CAPITAL LETTER U WITH TILDE")
+UNICODE3_REC( 0x0169	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0168	, 0x0000	, 0x0168	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0303), ""	, "LATIN SMALL LETTER U TILDE"	, "LATIN SMALL LETTER U WITH TILDE")
+UNICODE3_REC( 0x016A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x016B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0304), ""	, "LATIN CAPITAL LETTER U MACRON"	, "LATIN CAPITAL LETTER U WITH MACRON")
+UNICODE3_REC( 0x016B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x016A	, 0x0000	, 0x016A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0304), ""	, "LATIN SMALL LETTER U MACRON"	, "LATIN SMALL LETTER U WITH MACRON")
+UNICODE3_REC( 0x016C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x016D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0306), ""	, "LATIN CAPITAL LETTER U BREVE"	, "LATIN CAPITAL LETTER U WITH BREVE")
+UNICODE3_REC( 0x016D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x016C	, 0x0000	, 0x016C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0306), ""	, "LATIN SMALL LETTER U BREVE"	, "LATIN SMALL LETTER U WITH BREVE")
+UNICODE3_REC( 0x016E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x016F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x030A), ""	, "LATIN CAPITAL LETTER U RING"	, "LATIN CAPITAL LETTER U WITH RING ABOVE")
+UNICODE3_REC( 0x016F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x016E	, 0x0000	, 0x016E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x030A), ""	, "LATIN SMALL LETTER U RING"	, "LATIN SMALL LETTER U WITH RING ABOVE")
+UNICODE3_REC( 0x0170	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0171	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x030B), ""	, "LATIN CAPITAL LETTER U DOUBLE ACUTE"	, "LATIN CAPITAL LETTER U WITH DOUBLE ACUTE")
+UNICODE3_REC( 0x0171	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0170	, 0x0000	, 0x0170	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x030B), ""	, "LATIN SMALL LETTER U DOUBLE ACUTE"	, "LATIN SMALL LETTER U WITH DOUBLE ACUTE")
+UNICODE3_REC( 0x0172	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0173	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0328), ""	, "LATIN CAPITAL LETTER U OGONEK"	, "LATIN CAPITAL LETTER U WITH OGONEK")
+UNICODE3_REC( 0x0173	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0172	, 0x0000	, 0x0172	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0328), ""	, "LATIN SMALL LETTER U OGONEK"	, "LATIN SMALL LETTER U WITH OGONEK")
+UNICODE3_REC( 0x0174	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0175	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0057, 0x0302), ""	, "LATIN CAPITAL LETTER W CIRCUMFLEX"	, "LATIN CAPITAL LETTER W WITH CIRCUMFLEX")
+UNICODE3_REC( 0x0175	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0174	, 0x0000	, 0x0174	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0077, 0x0302), ""	, "LATIN SMALL LETTER W CIRCUMFLEX"	, "LATIN SMALL LETTER W WITH CIRCUMFLEX")
+UNICODE3_REC( 0x0176	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0177	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0059, 0x0302), ""	, "LATIN CAPITAL LETTER Y CIRCUMFLEX"	, "LATIN CAPITAL LETTER Y WITH CIRCUMFLEX")
+UNICODE3_REC( 0x0177	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0176	, 0x0000	, 0x0176	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0079, 0x0302), ""	, "LATIN SMALL LETTER Y CIRCUMFLEX"	, "LATIN SMALL LETTER Y WITH CIRCUMFLEX")
+UNICODE3_REC( 0x0178	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00FF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0059, 0x0308), ""	, "LATIN CAPITAL LETTER Y DIAERESIS"	, "LATIN CAPITAL LETTER Y WITH DIAERESIS")
+UNICODE3_REC( 0x0179	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x017A	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x005A, 0x0301), ""	, "LATIN CAPITAL LETTER Z ACUTE"	, "LATIN CAPITAL LETTER Z WITH ACUTE")
+UNICODE3_REC( 0x017A	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0179	, 0x0000	, 0x0179	, 0	, UNICODE3_S2(UNICODE3_exact, 0x007A, 0x0301), ""	, "LATIN SMALL LETTER Z ACUTE"	, "LATIN SMALL LETTER Z WITH ACUTE")
+UNICODE3_REC( 0x017B	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x017C	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x005A, 0x0307), ""	, "LATIN CAPITAL LETTER Z DOT"	, "LATIN CAPITAL LETTER Z WITH DOT ABOVE")
+UNICODE3_REC( 0x017C	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x017B	, 0x0000	, 0x017B	, 0	, UNICODE3_S2(UNICODE3_exact, 0x007A, 0x0307), ""	, "LATIN SMALL LETTER Z DOT"	, "LATIN SMALL LETTER Z WITH DOT ABOVE")
+UNICODE3_REC( 0x017D	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x017E	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x005A, 0x030C), ""	, "LATIN CAPITAL LETTER Z HACEK"	, "LATIN CAPITAL LETTER Z WITH CARON")
+UNICODE3_REC( 0x017E	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x017D	, 0x0000	, 0x017D	, 0	, UNICODE3_S2(UNICODE3_exact, 0x007A, 0x030C), ""	, "LATIN SMALL LETTER Z HACEK"	, "LATIN SMALL LETTER Z WITH CARON")
+UNICODE3_REC( 0x01A0	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01A1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x031B), ""	, "LATIN CAPITAL LETTER O HORN"	, "LATIN CAPITAL LETTER O WITH HORN")
+UNICODE3_REC( 0x01A1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01A0	, 0x0000	, 0x01A0	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x031B), ""	, "LATIN SMALL LETTER O HORN"	, "LATIN SMALL LETTER O WITH HORN")
+UNICODE3_REC( 0x01AF	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01B0	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x031B), ""	, "LATIN CAPITAL LETTER U HORN"	, "LATIN CAPITAL LETTER U WITH HORN")
+UNICODE3_REC( 0x01B0	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01AF	, 0x0000	, 0x01AF	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x031B), ""	, "LATIN SMALL LETTER U HORN"	, "LATIN SMALL LETTER U WITH HORN")
+UNICODE3_REC( 0x01CD	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01CE	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x030C), ""	, "LATIN CAPITAL LETTER A HACEK"	, "LATIN CAPITAL LETTER A WITH CARON")
+UNICODE3_REC( 0x01CE	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01CD	, 0x0000	, 0x01CD	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x030C), ""	, "LATIN SMALL LETTER A HACEK"	, "LATIN SMALL LETTER A WITH CARON")
+UNICODE3_REC( 0x01CF	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01D0	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x030C), ""	, "LATIN CAPITAL LETTER I HACEK"	, "LATIN CAPITAL LETTER I WITH CARON")
+UNICODE3_REC( 0x01D0	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01CF	, 0x0000	, 0x01CF	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x030C), ""	, "LATIN SMALL LETTER I HACEK"	, "LATIN SMALL LETTER I WITH CARON")
+UNICODE3_REC( 0x01D1	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01D2	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x030C), ""	, "LATIN CAPITAL LETTER O HACEK"	, "LATIN CAPITAL LETTER O WITH CARON")
+UNICODE3_REC( 0x01D2	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01D1	, 0x0000	, 0x01D1	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x030C), ""	, "LATIN SMALL LETTER O HACEK"	, "LATIN SMALL LETTER O WITH CARON")
+UNICODE3_REC( 0x01D3	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01D4	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x030C), ""	, "LATIN CAPITAL LETTER U HACEK"	, "LATIN CAPITAL LETTER U WITH CARON")
+UNICODE3_REC( 0x01D4	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01D3	, 0x0000	, 0x01D3	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x030C), ""	, "LATIN SMALL LETTER U HACEK"	, "LATIN SMALL LETTER U WITH CARON")
+UNICODE3_REC( 0x01D5	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01D6	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00DC, 0x0304), ""	, "LATIN CAPITAL LETTER U DIAERESIS MACRON"	, "LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON")
+UNICODE3_REC( 0x01D6	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01D5	, 0x0000	, 0x01D5	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00FC, 0x0304), ""	, "LATIN SMALL LETTER U DIAERESIS MACRON"	, "LATIN SMALL LETTER U WITH DIAERESIS AND MACRON")
+UNICODE3_REC( 0x01D7	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01D8	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00DC, 0x0301), ""	, "LATIN CAPITAL LETTER U DIAERESIS ACUTE"	, "LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE")
+UNICODE3_REC( 0x01D8	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01D7	, 0x0000	, 0x01D7	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00FC, 0x0301), ""	, "LATIN SMALL LETTER U DIAERESIS ACUTE"	, "LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE")
+UNICODE3_REC( 0x01D9	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01DA	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00DC, 0x030C), ""	, "LATIN CAPITAL LETTER U DIAERESIS HACEK"	, "LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON")
+UNICODE3_REC( 0x01DA	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01D9	, 0x0000	, 0x01D9	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00FC, 0x030C), ""	, "LATIN SMALL LETTER U DIAERESIS HACEK"	, "LATIN SMALL LETTER U WITH DIAERESIS AND CARON")
+UNICODE3_REC( 0x01DB	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01DC	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00DC, 0x0300), ""	, "LATIN CAPITAL LETTER U DIAERESIS GRAVE"	, "LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE")
+UNICODE3_REC( 0x01DC	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01DB	, 0x0000	, 0x01DB	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00FC, 0x0300), ""	, "LATIN SMALL LETTER U DIAERESIS GRAVE"	, "LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE")
+UNICODE3_REC( 0x01DE	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01DF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00C4, 0x0304), ""	, "LATIN CAPITAL LETTER A DIAERESIS MACRON"	, "LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON")
+UNICODE3_REC( 0x01DF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01DE	, 0x0000	, 0x01DE	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00E4, 0x0304), ""	, "LATIN SMALL LETTER A DIAERESIS MACRON"	, "LATIN SMALL LETTER A WITH DIAERESIS AND MACRON")
+UNICODE3_REC( 0x01E0	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01E1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0226, 0x0304), ""	, "LATIN CAPITAL LETTER A DOT MACRON"	, "LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON")
+UNICODE3_REC( 0x01E1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01E0	, 0x0000	, 0x01E0	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0227, 0x0304), ""	, "LATIN SMALL LETTER A DOT MACRON"	, "LATIN SMALL LETTER A WITH DOT ABOVE AND MACRON")
+UNICODE3_REC( 0x01E2	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01E3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00C6, 0x0304), "ash *"	, "LATIN CAPITAL LETTER A E MACRON"	, "LATIN CAPITAL LETTER AE WITH MACRON")
+UNICODE3_REC( 0x01E3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01E2	, 0x0000	, 0x01E2	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00E6, 0x0304), "ash *"	, "LATIN SMALL LETTER A E MACRON"	, "LATIN SMALL LETTER AE WITH MACRON")
+UNICODE3_REC( 0x01E6	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01E7	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0047, 0x030C), ""	, "LATIN CAPITAL LETTER G HACEK"	, "LATIN CAPITAL LETTER G WITH CARON")
+UNICODE3_REC( 0x01E7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01E6	, 0x0000	, 0x01E6	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0067, 0x030C), ""	, "LATIN SMALL LETTER G HACEK"	, "LATIN SMALL LETTER G WITH CARON")
+UNICODE3_REC( 0x01E8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01E9	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004B, 0x030C), ""	, "LATIN CAPITAL LETTER K HACEK"	, "LATIN CAPITAL LETTER K WITH CARON")
+UNICODE3_REC( 0x01E9	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01E8	, 0x0000	, 0x01E8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006B, 0x030C), ""	, "LATIN SMALL LETTER K HACEK"	, "LATIN SMALL LETTER K WITH CARON")
+UNICODE3_REC( 0x01EA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01EB	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x0328), ""	, "LATIN CAPITAL LETTER O OGONEK"	, "LATIN CAPITAL LETTER O WITH OGONEK")
+UNICODE3_REC( 0x01EB	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01EA	, 0x0000	, 0x01EA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x0328), ""	, "LATIN SMALL LETTER O OGONEK"	, "LATIN SMALL LETTER O WITH OGONEK")
+UNICODE3_REC( 0x01EC	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01ED	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01EA, 0x0304), ""	, "LATIN CAPITAL LETTER O OGONEK MACRON"	, "LATIN CAPITAL LETTER O WITH OGONEK AND MACRON")
+UNICODE3_REC( 0x01ED	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01EC	, 0x0000	, 0x01EC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01EB, 0x0304), ""	, "LATIN SMALL LETTER O OGONEK MACRON"	, "LATIN SMALL LETTER O WITH OGONEK AND MACRON")
+UNICODE3_REC( 0x01EE	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01EF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01B7, 0x030C), ""	, "LATIN CAPITAL LETTER YOGH HACEK"	, "LATIN CAPITAL LETTER EZH WITH CARON")
+UNICODE3_REC( 0x01EF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01EE	, 0x0000	, 0x01EE	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0292, 0x030C), ""	, "LATIN SMALL LETTER YOGH HACEK"	, "LATIN SMALL LETTER EZH WITH CARON")
+UNICODE3_REC( 0x01F0	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006A, 0x030C), ""	, "LATIN SMALL LETTER J HACEK"	, "LATIN SMALL LETTER J WITH CARON")
+UNICODE3_REC( 0x01F4	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01F5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0047, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER G WITH ACUTE")
+UNICODE3_REC( 0x01F5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01F4	, 0x0000	, 0x01F4	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0067, 0x0301), ""	, ""	, "LATIN SMALL LETTER G WITH ACUTE")
+UNICODE3_REC( 0x01F8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01F9	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004E, 0x0300), ""	, ""	, "LATIN CAPITAL LETTER N WITH GRAVE")
+UNICODE3_REC( 0x01F9	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01F8	, 0x0000	, 0x01F8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006E, 0x0300), ""	, ""	, "LATIN SMALL LETTER N WITH GRAVE")
+UNICODE3_REC( 0x01FA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01FB	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00C5, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE")
+UNICODE3_REC( 0x01FB	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01FA	, 0x0000	, 0x01FA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00E5, 0x0301), ""	, ""	, "LATIN SMALL LETTER A WITH RING ABOVE AND ACUTE")
+UNICODE3_REC( 0x01FC	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01FD	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00C6, 0x0301), "ash *"	, ""	, "LATIN CAPITAL LETTER AE WITH ACUTE")
+UNICODE3_REC( 0x01FD	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01FC	, 0x0000	, 0x01FC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00E6, 0x0301), "ash *"	, ""	, "LATIN SMALL LETTER AE WITH ACUTE")
+UNICODE3_REC( 0x01FE	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x01FF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00D8, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER O WITH STROKE AND ACUTE")
+UNICODE3_REC( 0x01FF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x01FE	, 0x0000	, 0x01FE	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00F8, 0x0301), ""	, ""	, "LATIN SMALL LETTER O WITH STROKE AND ACUTE")
+UNICODE3_REC( 0x0200	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0201	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x030F), ""	, ""	, "LATIN CAPITAL LETTER A WITH DOUBLE GRAVE")
+UNICODE3_REC( 0x0201	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0200	, 0x0000	, 0x0200	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x030F), ""	, ""	, "LATIN SMALL LETTER A WITH DOUBLE GRAVE")
+UNICODE3_REC( 0x0202	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0203	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0311), ""	, ""	, "LATIN CAPITAL LETTER A WITH INVERTED BREVE")
+UNICODE3_REC( 0x0203	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0202	, 0x0000	, 0x0202	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0311), ""	, ""	, "LATIN SMALL LETTER A WITH INVERTED BREVE")
+UNICODE3_REC( 0x0204	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0205	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x030F), ""	, ""	, "LATIN CAPITAL LETTER E WITH DOUBLE GRAVE")
+UNICODE3_REC( 0x0205	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0204	, 0x0000	, 0x0204	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x030F), ""	, ""	, "LATIN SMALL LETTER E WITH DOUBLE GRAVE")
+UNICODE3_REC( 0x0206	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0207	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0311), ""	, ""	, "LATIN CAPITAL LETTER E WITH INVERTED BREVE")
+UNICODE3_REC( 0x0207	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0206	, 0x0000	, 0x0206	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0311), ""	, ""	, "LATIN SMALL LETTER E WITH INVERTED BREVE")
+UNICODE3_REC( 0x0208	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0209	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x030F), ""	, ""	, "LATIN CAPITAL LETTER I WITH DOUBLE GRAVE")
+UNICODE3_REC( 0x0209	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0208	, 0x0000	, 0x0208	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x030F), ""	, ""	, "LATIN SMALL LETTER I WITH DOUBLE GRAVE")
+UNICODE3_REC( 0x020A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x020B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0311), ""	, ""	, "LATIN CAPITAL LETTER I WITH INVERTED BREVE")
+UNICODE3_REC( 0x020B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x020A	, 0x0000	, 0x020A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x0311), ""	, ""	, "LATIN SMALL LETTER I WITH INVERTED BREVE")
+UNICODE3_REC( 0x020C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x020D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x030F), ""	, ""	, "LATIN CAPITAL LETTER O WITH DOUBLE GRAVE")
+UNICODE3_REC( 0x020D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x020C	, 0x0000	, 0x020C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x030F), ""	, ""	, "LATIN SMALL LETTER O WITH DOUBLE GRAVE")
+UNICODE3_REC( 0x020E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x020F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x0311), ""	, ""	, "LATIN CAPITAL LETTER O WITH INVERTED BREVE")
+UNICODE3_REC( 0x020F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x020E	, 0x0000	, 0x020E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x0311), ""	, ""	, "LATIN SMALL LETTER O WITH INVERTED BREVE")
+UNICODE3_REC( 0x0210	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0211	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0052, 0x030F), ""	, ""	, "LATIN CAPITAL LETTER R WITH DOUBLE GRAVE")
+UNICODE3_REC( 0x0211	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0210	, 0x0000	, 0x0210	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0072, 0x030F), ""	, ""	, "LATIN SMALL LETTER R WITH DOUBLE GRAVE")
+UNICODE3_REC( 0x0212	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0213	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0052, 0x0311), ""	, ""	, "LATIN CAPITAL LETTER R WITH INVERTED BREVE")
+UNICODE3_REC( 0x0213	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0212	, 0x0000	, 0x0212	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0072, 0x0311), ""	, ""	, "LATIN SMALL LETTER R WITH INVERTED BREVE")
+UNICODE3_REC( 0x0214	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0215	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x030F), ""	, ""	, "LATIN CAPITAL LETTER U WITH DOUBLE GRAVE")
+UNICODE3_REC( 0x0215	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0214	, 0x0000	, 0x0214	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x030F), ""	, ""	, "LATIN SMALL LETTER U WITH DOUBLE GRAVE")
+UNICODE3_REC( 0x0216	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0217	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0311), ""	, ""	, "LATIN CAPITAL LETTER U WITH INVERTED BREVE")
+UNICODE3_REC( 0x0217	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0216	, 0x0000	, 0x0216	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0311), ""	, ""	, "LATIN SMALL LETTER U WITH INVERTED BREVE")
+UNICODE3_REC( 0x0218	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0219	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0053, 0x0326), "*"	, ""	, "LATIN CAPITAL LETTER S WITH COMMA BELOW")
+UNICODE3_REC( 0x0219	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0218	, 0x0000	, 0x0218	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0073, 0x0326), "*"	, ""	, "LATIN SMALL LETTER S WITH COMMA BELOW")
+UNICODE3_REC( 0x021A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x021B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0054, 0x0326), "*"	, ""	, "LATIN CAPITAL LETTER T WITH COMMA BELOW")
+UNICODE3_REC( 0x021B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x021A	, 0x0000	, 0x021A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0074, 0x0326), "*"	, ""	, "LATIN SMALL LETTER T WITH COMMA BELOW")
+UNICODE3_REC( 0x021E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x021F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0048, 0x030C), ""	, ""	, "LATIN CAPITAL LETTER H WITH CARON")
+UNICODE3_REC( 0x021F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x021E	, 0x0000	, 0x021E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0068, 0x030C), ""	, ""	, "LATIN SMALL LETTER H WITH CARON")
+UNICODE3_REC( 0x0226	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0227	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER A WITH DOT ABOVE")
+UNICODE3_REC( 0x0227	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0226	, 0x0000	, 0x0226	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0307), ""	, ""	, "LATIN SMALL LETTER A WITH DOT ABOVE")
+UNICODE3_REC( 0x0228	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0229	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0327), ""	, ""	, "LATIN CAPITAL LETTER E WITH CEDILLA")
+UNICODE3_REC( 0x0229	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0228	, 0x0000	, 0x0228	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0327), ""	, ""	, "LATIN SMALL LETTER E WITH CEDILLA")
+UNICODE3_REC( 0x022A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x022B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00D6, 0x0304), ""	, ""	, "LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON")
+UNICODE3_REC( 0x022B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x022A	, 0x0000	, 0x022A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00F6, 0x0304), ""	, ""	, "LATIN SMALL LETTER O WITH DIAERESIS AND MACRON")
+UNICODE3_REC( 0x022C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x022D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00D5, 0x0304), ""	, ""	, "LATIN CAPITAL LETTER O WITH TILDE AND MACRON")
+UNICODE3_REC( 0x022D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x022C	, 0x0000	, 0x022C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00F5, 0x0304), ""	, ""	, "LATIN SMALL LETTER O WITH TILDE AND MACRON")
+UNICODE3_REC( 0x022E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x022F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER O WITH DOT ABOVE")
+UNICODE3_REC( 0x022F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x022E	, 0x0000	, 0x022E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x0307), ""	, ""	, "LATIN SMALL LETTER O WITH DOT ABOVE")
+UNICODE3_REC( 0x0230	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0231	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x022E, 0x0304), ""	, ""	, "LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON")
+UNICODE3_REC( 0x0231	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0230	, 0x0000	, 0x0230	, 0	, UNICODE3_S2(UNICODE3_exact, 0x022F, 0x0304), ""	, ""	, "LATIN SMALL LETTER O WITH DOT ABOVE AND MACRON")
+UNICODE3_REC( 0x0232	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0233	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0059, 0x0304), ""	, ""	, "LATIN CAPITAL LETTER Y WITH MACRON")
+UNICODE3_REC( 0x0233	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0232	, 0x0000	, 0x0232	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0079, 0x0304), ""	, ""	, "LATIN SMALL LETTER Y WITH MACRON")
+UNICODE3_REC( 0x0340	, "Mn"	, 230	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x0300), "Vietnamese"	, "NON-SPACING GRAVE TONE MARK"	, "COMBINING GRAVE TONE MARK")
+UNICODE3_REC( 0x0341	, "Mn"	, 230	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x0301), "Vietnamese"	, "NON-SPACING ACUTE TONE MARK"	, "COMBINING ACUTE TONE MARK")
+UNICODE3_REC( 0x0343	, "Mn"	, 230	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x0313), ""	, ""	, "COMBINING GREEK KORONIS")
+UNICODE3_REC( 0x0344	, "Mn"	, 230	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0308, 0x0301), ""	, "GREEK NON-SPACING DIAERESIS TONOS"	, "COMBINING GREEK DIALYTIKA TONOS")
+UNICODE3_REC( 0x0374	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x02B9), "Dexia keraia"	, "GREEK UPPER NUMERAL SIGN"	, "GREEK NUMERAL SIGN")
+UNICODE3_REC( 0x037E	, "Po"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x003B), "Erotimatiko"	, ""	, "GREEK QUESTION MARK")
+UNICODE3_REC( 0x0385	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00A8, 0x0301), ""	, "GREEK SPACING DIAERESIS TONOS"	, "GREEK DIALYTIKA TONOS")
+UNICODE3_REC( 0x0386	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x03AC	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0391, 0x0301), ""	, "GREEK CAPITAL LETTER ALPHA TONOS"	, "GREEK CAPITAL LETTER ALPHA WITH TONOS")
+UNICODE3_REC( 0x0387	, "Po"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x00B7), ""	, ""	, "GREEK ANO TELEIA")
+UNICODE3_REC( 0x0388	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x03AD	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0395, 0x0301), ""	, "GREEK CAPITAL LETTER EPSILON TONOS"	, "GREEK CAPITAL LETTER EPSILON WITH TONOS")
+UNICODE3_REC( 0x0389	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x03AE	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0397, 0x0301), ""	, "GREEK CAPITAL LETTER ETA TONOS"	, "GREEK CAPITAL LETTER ETA WITH TONOS")
+UNICODE3_REC( 0x038A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x03AF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0399, 0x0301), ""	, "GREEK CAPITAL LETTER IOTA TONOS"	, "GREEK CAPITAL LETTER IOTA WITH TONOS")
+UNICODE3_REC( 0x038C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x03CC	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x039F, 0x0301), ""	, "GREEK CAPITAL LETTER OMICRON TONOS"	, "GREEK CAPITAL LETTER OMICRON WITH TONOS")
+UNICODE3_REC( 0x038E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x03CD	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03A5, 0x0301), ""	, "GREEK CAPITAL LETTER UPSILON TONOS"	, "GREEK CAPITAL LETTER UPSILON WITH TONOS")
+UNICODE3_REC( 0x038F	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x03CE	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03A9, 0x0301), ""	, "GREEK CAPITAL LETTER OMEGA TONOS"	, "GREEK CAPITAL LETTER OMEGA WITH TONOS")
+UNICODE3_REC( 0x0390	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03CA, 0x0301), ""	, "GREEK SMALL LETTER IOTA DIAERESIS TONOS"	, "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS")
+UNICODE3_REC( 0x03AA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x03CA	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0399, 0x0308), ""	, "GREEK CAPITAL LETTER IOTA DIAERESIS"	, "GREEK CAPITAL LETTER IOTA WITH DIALYTIKA")
+UNICODE3_REC( 0x03AB	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x03CB	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03A5, 0x0308), ""	, "GREEK CAPITAL LETTER UPSILON DIAERESIS"	, "GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA")
+UNICODE3_REC( 0x03AC	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0386	, 0x0000	, 0x0386	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B1, 0x0301), ""	, "GREEK SMALL LETTER ALPHA TONOS"	, "GREEK SMALL LETTER ALPHA WITH TONOS")
+UNICODE3_REC( 0x03AD	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0388	, 0x0000	, 0x0388	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B5, 0x0301), ""	, "GREEK SMALL LETTER EPSILON TONOS"	, "GREEK SMALL LETTER EPSILON WITH TONOS")
+UNICODE3_REC( 0x03AE	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0389	, 0x0000	, 0x0389	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B7, 0x0301), ""	, "GREEK SMALL LETTER ETA TONOS"	, "GREEK SMALL LETTER ETA WITH TONOS")
+UNICODE3_REC( 0x03AF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x038A	, 0x0000	, 0x038A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B9, 0x0301), ""	, "GREEK SMALL LETTER IOTA TONOS"	, "GREEK SMALL LETTER IOTA WITH TONOS")
+UNICODE3_REC( 0x03B0	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03CB, 0x0301), ""	, "GREEK SMALL LETTER UPSILON DIAERESIS TONOS"	, "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS")
+UNICODE3_REC( 0x03CA	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x03AA	, 0x0000	, 0x03AA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B9, 0x0308), ""	, "GREEK SMALL LETTER IOTA DIAERESIS"	, "GREEK SMALL LETTER IOTA WITH DIALYTIKA")
+UNICODE3_REC( 0x03CB	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x03AB	, 0x0000	, 0x03AB	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C5, 0x0308), ""	, "GREEK SMALL LETTER UPSILON DIAERESIS"	, "GREEK SMALL LETTER UPSILON WITH DIALYTIKA")
+UNICODE3_REC( 0x03CC	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x038C	, 0x0000	, 0x038C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03BF, 0x0301), ""	, "GREEK SMALL LETTER OMICRON TONOS"	, "GREEK SMALL LETTER OMICRON WITH TONOS")
+UNICODE3_REC( 0x03CD	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x038E	, 0x0000	, 0x038E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C5, 0x0301), ""	, "GREEK SMALL LETTER UPSILON TONOS"	, "GREEK SMALL LETTER UPSILON WITH TONOS")
+UNICODE3_REC( 0x03CE	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x038F	, 0x0000	, 0x038F	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C9, 0x0301), ""	, "GREEK SMALL LETTER OMEGA TONOS"	, "GREEK SMALL LETTER OMEGA WITH TONOS")
+UNICODE3_REC( 0x03D3	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03D2, 0x0301), ""	, "GREEK CAPITAL LETTER UPSILON HOOK TONOS"	, "GREEK UPSILON WITH ACUTE AND HOOK SYMBOL")
+UNICODE3_REC( 0x03D4	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03D2, 0x0308), ""	, "GREEK CAPITAL LETTER UPSILON HOOK DIAERESIS"	, "GREEK UPSILON WITH DIAERESIS AND HOOK SYMBOL")
+UNICODE3_REC( 0x0400	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0450	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0415, 0x0300), ""	, ""	, "CYRILLIC CAPITAL LETTER IE WITH GRAVE")
+UNICODE3_REC( 0x0401	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0451	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0415, 0x0308), ""	, ""	, "CYRILLIC CAPITAL LETTER IO")
+UNICODE3_REC( 0x0403	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0453	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0413, 0x0301), ""	, ""	, "CYRILLIC CAPITAL LETTER GJE")
+UNICODE3_REC( 0x0407	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0457	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0406, 0x0308), "Ukrainian"	, ""	, "CYRILLIC CAPITAL LETTER YI")
+UNICODE3_REC( 0x040C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x045C	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x041A, 0x0301), ""	, ""	, "CYRILLIC CAPITAL LETTER KJE")
+UNICODE3_REC( 0x040D	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x045D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0418, 0x0300), ""	, ""	, "CYRILLIC CAPITAL LETTER I WITH GRAVE")
+UNICODE3_REC( 0x040E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x045E	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0423, 0x0306), "Byelorussian"	, ""	, "CYRILLIC CAPITAL LETTER SHORT U")
+UNICODE3_REC( 0x0419	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0439	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0418, 0x0306), ""	, "CYRILLIC CAPITAL LETTER SHORT II"	, "CYRILLIC CAPITAL LETTER SHORT I")
+UNICODE3_REC( 0x0439	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0419	, 0x0000	, 0x0419	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0438, 0x0306), ""	, "CYRILLIC SMALL LETTER SHORT II"	, "CYRILLIC SMALL LETTER SHORT I")
+UNICODE3_REC( 0x0450	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0400	, 0x0000	, 0x0400	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0435, 0x0300), ""	, ""	, "CYRILLIC SMALL LETTER IE WITH GRAVE")
+UNICODE3_REC( 0x0451	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0401	, 0x0000	, 0x0401	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0435, 0x0308), ""	, ""	, "CYRILLIC SMALL LETTER IO")
+UNICODE3_REC( 0x0453	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0403	, 0x0000	, 0x0403	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0433, 0x0301), ""	, ""	, "CYRILLIC SMALL LETTER GJE")
+UNICODE3_REC( 0x0457	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0407	, 0x0000	, 0x0407	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0456, 0x0308), "Ukrainian"	, ""	, "CYRILLIC SMALL LETTER YI")
+UNICODE3_REC( 0x045C	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x040C	, 0x0000	, 0x040C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x043A, 0x0301), ""	, ""	, "CYRILLIC SMALL LETTER KJE")
+UNICODE3_REC( 0x045D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x040D	, 0x0000	, 0x040D	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0438, 0x0300), ""	, ""	, "CYRILLIC SMALL LETTER I WITH GRAVE")
+UNICODE3_REC( 0x045E	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x040E	, 0x0000	, 0x040E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0443, 0x0306), "Byelorussian"	, ""	, "CYRILLIC SMALL LETTER SHORT U")
+UNICODE3_REC( 0x0476	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0477	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0474, 0x030F), ""	, "CYRILLIC CAPITAL LETTER IZHITSA DOUBLE GRAVE"	, "CYRILLIC CAPITAL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT")
+UNICODE3_REC( 0x0477	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0476	, 0x0000	, 0x0476	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0475, 0x030F), ""	, "CYRILLIC SMALL LETTER IZHITSA DOUBLE GRAVE"	, "CYRILLIC SMALL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT")
+UNICODE3_REC( 0x04C1	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04C2	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0416, 0x0306), ""	, "CYRILLIC CAPITAL LETTER SHORT ZHE"	, "CYRILLIC CAPITAL LETTER ZHE WITH BREVE")
+UNICODE3_REC( 0x04C2	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04C1	, 0x0000	, 0x04C1	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0436, 0x0306), ""	, "CYRILLIC SMALL LETTER SHORT ZHE"	, "CYRILLIC SMALL LETTER ZHE WITH BREVE")
+UNICODE3_REC( 0x04D0	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04D1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0410, 0x0306), ""	, ""	, "CYRILLIC CAPITAL LETTER A WITH BREVE")
+UNICODE3_REC( 0x04D1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04D0	, 0x0000	, 0x04D0	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0430, 0x0306), ""	, ""	, "CYRILLIC SMALL LETTER A WITH BREVE")
+UNICODE3_REC( 0x04D2	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04D3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0410, 0x0308), ""	, ""	, "CYRILLIC CAPITAL LETTER A WITH DIAERESIS")
+UNICODE3_REC( 0x04D3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04D2	, 0x0000	, 0x04D2	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0430, 0x0308), ""	, ""	, "CYRILLIC SMALL LETTER A WITH DIAERESIS")
+UNICODE3_REC( 0x04D6	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04D7	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0415, 0x0306), ""	, ""	, "CYRILLIC CAPITAL LETTER IE WITH BREVE")
+UNICODE3_REC( 0x04D7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04D6	, 0x0000	, 0x04D6	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0435, 0x0306), ""	, ""	, "CYRILLIC SMALL LETTER IE WITH BREVE")
+UNICODE3_REC( 0x04DA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04DB	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x04D8, 0x0308), ""	, ""	, "CYRILLIC CAPITAL LETTER SCHWA WITH DIAERESIS")
+UNICODE3_REC( 0x04DB	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04DA	, 0x0000	, 0x04DA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x04D9, 0x0308), ""	, ""	, "CYRILLIC SMALL LETTER SCHWA WITH DIAERESIS")
+UNICODE3_REC( 0x04DC	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04DD	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0416, 0x0308), ""	, ""	, "CYRILLIC CAPITAL LETTER ZHE WITH DIAERESIS")
+UNICODE3_REC( 0x04DD	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04DC	, 0x0000	, 0x04DC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0436, 0x0308), ""	, ""	, "CYRILLIC SMALL LETTER ZHE WITH DIAERESIS")
+UNICODE3_REC( 0x04DE	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04DF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0417, 0x0308), ""	, ""	, "CYRILLIC CAPITAL LETTER ZE WITH DIAERESIS")
+UNICODE3_REC( 0x04DF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04DE	, 0x0000	, 0x04DE	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0437, 0x0308), ""	, ""	, "CYRILLIC SMALL LETTER ZE WITH DIAERESIS")
+UNICODE3_REC( 0x04E2	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04E3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0418, 0x0304), ""	, ""	, "CYRILLIC CAPITAL LETTER I WITH MACRON")
+UNICODE3_REC( 0x04E3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04E2	, 0x0000	, 0x04E2	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0438, 0x0304), ""	, ""	, "CYRILLIC SMALL LETTER I WITH MACRON")
+UNICODE3_REC( 0x04E4	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04E5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0418, 0x0308), ""	, ""	, "CYRILLIC CAPITAL LETTER I WITH DIAERESIS")
+UNICODE3_REC( 0x04E5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04E4	, 0x0000	, 0x04E4	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0438, 0x0308), ""	, ""	, "CYRILLIC SMALL LETTER I WITH DIAERESIS")
+UNICODE3_REC( 0x04E6	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04E7	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x041E, 0x0308), ""	, ""	, "CYRILLIC CAPITAL LETTER O WITH DIAERESIS")
+UNICODE3_REC( 0x04E7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04E6	, 0x0000	, 0x04E6	, 0	, UNICODE3_S2(UNICODE3_exact, 0x043E, 0x0308), ""	, ""	, "CYRILLIC SMALL LETTER O WITH DIAERESIS")
+UNICODE3_REC( 0x04EA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04EB	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x04E8, 0x0308), ""	, ""	, "CYRILLIC CAPITAL LETTER BARRED O WITH DIAERESIS")
+UNICODE3_REC( 0x04EB	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04EA	, 0x0000	, 0x04EA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x04E9, 0x0308), ""	, ""	, "CYRILLIC SMALL LETTER BARRED O WITH DIAERESIS")
+UNICODE3_REC( 0x04EC	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04ED	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x042D, 0x0308), ""	, ""	, "CYRILLIC CAPITAL LETTER E WITH DIAERESIS")
+UNICODE3_REC( 0x04ED	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04EC	, 0x0000	, 0x04EC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x044D, 0x0308), ""	, ""	, "CYRILLIC SMALL LETTER E WITH DIAERESIS")
+UNICODE3_REC( 0x04EE	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04EF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0423, 0x0304), ""	, ""	, "CYRILLIC CAPITAL LETTER U WITH MACRON")
+UNICODE3_REC( 0x04EF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04EE	, 0x0000	, 0x04EE	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0443, 0x0304), ""	, ""	, "CYRILLIC SMALL LETTER U WITH MACRON")
+UNICODE3_REC( 0x04F0	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04F1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0423, 0x0308), ""	, ""	, "CYRILLIC CAPITAL LETTER U WITH DIAERESIS")
+UNICODE3_REC( 0x04F1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04F0	, 0x0000	, 0x04F0	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0443, 0x0308), ""	, ""	, "CYRILLIC SMALL LETTER U WITH DIAERESIS")
+UNICODE3_REC( 0x04F2	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04F3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0423, 0x030B), ""	, ""	, "CYRILLIC CAPITAL LETTER U WITH DOUBLE ACUTE")
+UNICODE3_REC( 0x04F3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04F2	, 0x0000	, 0x04F2	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0443, 0x030B), ""	, ""	, "CYRILLIC SMALL LETTER U WITH DOUBLE ACUTE")
+UNICODE3_REC( 0x04F4	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04F5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0427, 0x0308), ""	, ""	, "CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS")
+UNICODE3_REC( 0x04F5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04F4	, 0x0000	, 0x04F4	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0447, 0x0308), ""	, ""	, "CYRILLIC SMALL LETTER CHE WITH DIAERESIS")
+UNICODE3_REC( 0x04F8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x04F9	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x042B, 0x0308), ""	, ""	, "CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS")
+UNICODE3_REC( 0x04F9	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x04F8	, 0x0000	, 0x04F8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x044B, 0x0308), ""	, ""	, "CYRILLIC SMALL LETTER YERU WITH DIAERESIS")
+UNICODE3_REC( 0x0622	, "Lo"	, 0	, "AL"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0627, 0x0653), ""	, "ARABIC LETTER MADDAH ON ALEF"	, "ARABIC LETTER ALEF WITH MADDA ABOVE")
+UNICODE3_REC( 0x0623	, "Lo"	, 0	, "AL"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0627, 0x0654), ""	, "ARABIC LETTER HAMZAH ON ALEF"	, "ARABIC LETTER ALEF WITH HAMZA ABOVE")
+UNICODE3_REC( 0x0624	, "Lo"	, 0	, "AL"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0648, 0x0654), ""	, "ARABIC LETTER HAMZAH ON WAW"	, "ARABIC LETTER WAW WITH HAMZA ABOVE")
+UNICODE3_REC( 0x0625	, "Lo"	, 0	, "AL"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0627, 0x0655), ""	, "ARABIC LETTER HAMZAH UNDER ALEF"	, "ARABIC LETTER ALEF WITH HAMZA BELOW")
+UNICODE3_REC( 0x0626	, "Lo"	, 0	, "AL"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x064A, 0x0654), ""	, "ARABIC LETTER HAMZAH ON YA"	, "ARABIC LETTER YEH WITH HAMZA ABOVE")
+UNICODE3_REC( 0x06C0	, "Lo"	, 0	, "AL"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x06D5, 0x0654), ""	, "ARABIC LETTER HAMZAH ON HA"	, "ARABIC LETTER HEH WITH YEH ABOVE")
+UNICODE3_REC( 0x06C2	, "Lo"	, 0	, "AL"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x06C1, 0x0654), ""	, "ARABIC LETTER HAMZAH ON HA GOAL"	, "ARABIC LETTER HEH GOAL WITH HAMZA ABOVE")
+UNICODE3_REC( 0x06D3	, "Lo"	, 0	, "AL"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x06D2, 0x0654), ""	, "ARABIC LETTER HAMZAH ON YA BARREE"	, "ARABIC LETTER YEH BARREE WITH HAMZA ABOVE")
+UNICODE3_REC( 0x0929	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0928, 0x093C), ""	, ""	, "DEVANAGARI LETTER NNNA")
+UNICODE3_REC( 0x0931	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0930, 0x093C), ""	, ""	, "DEVANAGARI LETTER RRA")
+UNICODE3_REC( 0x0934	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0933, 0x093C), ""	, ""	, "DEVANAGARI LETTER LLLA")
+UNICODE3_REC( 0x0958	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0915, 0x093C), ""	, ""	, "DEVANAGARI LETTER QA")
+UNICODE3_REC( 0x0959	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0916, 0x093C), ""	, ""	, "DEVANAGARI LETTER KHHA")
+UNICODE3_REC( 0x095A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0917, 0x093C), ""	, ""	, "DEVANAGARI LETTER GHHA")
+UNICODE3_REC( 0x095B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x091C, 0x093C), ""	, ""	, "DEVANAGARI LETTER ZA")
+UNICODE3_REC( 0x095C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0921, 0x093C), ""	, ""	, "DEVANAGARI LETTER DDDHA")
+UNICODE3_REC( 0x095D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0922, 0x093C), ""	, ""	, "DEVANAGARI LETTER RHA")
+UNICODE3_REC( 0x095E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x092B, 0x093C), ""	, ""	, "DEVANAGARI LETTER FA")
+UNICODE3_REC( 0x095F	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x092F, 0x093C), ""	, ""	, "DEVANAGARI LETTER YYA")
+UNICODE3_REC( 0x09CB	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x09C7, 0x09BE), ""	, ""	, "BENGALI VOWEL SIGN O")
+UNICODE3_REC( 0x09CC	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x09C7, 0x09D7), ""	, ""	, "BENGALI VOWEL SIGN AU")
+UNICODE3_REC( 0x09DC	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x09A1, 0x09BC), ""	, ""	, "BENGALI LETTER RRA")
+UNICODE3_REC( 0x09DD	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x09A2, 0x09BC), ""	, ""	, "BENGALI LETTER RHA")
+UNICODE3_REC( 0x09DF	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x09AF, 0x09BC), ""	, ""	, "BENGALI LETTER YYA")
+UNICODE3_REC( 0x0A33	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0A32, 0x0A3C), ""	, ""	, "GURMUKHI LETTER LLA")
+UNICODE3_REC( 0x0A36	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0A38, 0x0A3C), ""	, ""	, "GURMUKHI LETTER SHA")
+UNICODE3_REC( 0x0A59	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0A16, 0x0A3C), ""	, ""	, "GURMUKHI LETTER KHHA")
+UNICODE3_REC( 0x0A5A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0A17, 0x0A3C), ""	, ""	, "GURMUKHI LETTER GHHA")
+UNICODE3_REC( 0x0A5B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0A1C, 0x0A3C), ""	, ""	, "GURMUKHI LETTER ZA")
+UNICODE3_REC( 0x0A5E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0A2B, 0x0A3C), ""	, ""	, "GURMUKHI LETTER FA")
+UNICODE3_REC( 0x0B48	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0B47, 0x0B56), ""	, ""	, "ORIYA VOWEL SIGN AI")
+UNICODE3_REC( 0x0B4B	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0B47, 0x0B3E), ""	, ""	, "ORIYA VOWEL SIGN O")
+UNICODE3_REC( 0x0B4C	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0B47, 0x0B57), ""	, ""	, "ORIYA VOWEL SIGN AU")
+UNICODE3_REC( 0x0B5C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0B21, 0x0B3C), ""	, ""	, "ORIYA LETTER RRA")
+UNICODE3_REC( 0x0B5D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0B22, 0x0B3C), ""	, ""	, "ORIYA LETTER RHA")
+UNICODE3_REC( 0x0B94	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0B92, 0x0BD7), ""	, ""	, "TAMIL LETTER AU")
+UNICODE3_REC( 0x0BCA	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0BC6, 0x0BBE), ""	, ""	, "TAMIL VOWEL SIGN O")
+UNICODE3_REC( 0x0BCB	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0BC7, 0x0BBE), ""	, ""	, "TAMIL VOWEL SIGN OO")
+UNICODE3_REC( 0x0BCC	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0BC6, 0x0BD7), ""	, ""	, "TAMIL VOWEL SIGN AU")
+UNICODE3_REC( 0x0C48	, "Mn"	, 0	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0C46, 0x0C56), ""	, ""	, "TELUGU VOWEL SIGN AI")
+UNICODE3_REC( 0x0CC0	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0CBF, 0x0CD5), ""	, ""	, "KANNADA VOWEL SIGN II")
+UNICODE3_REC( 0x0CC7	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0CC6, 0x0CD5), ""	, ""	, "KANNADA VOWEL SIGN EE")
+UNICODE3_REC( 0x0CC8	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0CC6, 0x0CD6), ""	, ""	, "KANNADA VOWEL SIGN AI")
+UNICODE3_REC( 0x0CCA	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0CC6, 0x0CC2), ""	, ""	, "KANNADA VOWEL SIGN O")
+UNICODE3_REC( 0x0CCB	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0CCA, 0x0CD5), ""	, ""	, "KANNADA VOWEL SIGN OO")
+UNICODE3_REC( 0x0D4A	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0D46, 0x0D3E), ""	, ""	, "MALAYALAM VOWEL SIGN O")
+UNICODE3_REC( 0x0D4B	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0D47, 0x0D3E), ""	, ""	, "MALAYALAM VOWEL SIGN OO")
+UNICODE3_REC( 0x0D4C	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0D46, 0x0D57), ""	, ""	, "MALAYALAM VOWEL SIGN AU")
+UNICODE3_REC( 0x0DDA	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0DD9, 0x0DCA), ""	, ""	, "SINHALA VOWEL SIGN DIGA KOMBUVA")
+UNICODE3_REC( 0x0DDC	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0DD9, 0x0DCF), ""	, ""	, "SINHALA VOWEL SIGN KOMBUVA HAA AELA-PILLA")
+UNICODE3_REC( 0x0DDD	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0DDC, 0x0DCA), ""	, ""	, "SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA")
+UNICODE3_REC( 0x0DDE	, "Mc"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0DD9, 0x0DDF), ""	, ""	, "SINHALA VOWEL SIGN KOMBUVA HAA GAYANUKITTA")
+UNICODE3_REC( 0x0F43	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0F42, 0x0FB7), ""	, ""	, "TIBETAN LETTER GHA")
+UNICODE3_REC( 0x0F4D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0F4C, 0x0FB7), ""	, ""	, "TIBETAN LETTER DDHA")
+UNICODE3_REC( 0x0F52	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0F51, 0x0FB7), ""	, ""	, "TIBETAN LETTER DHA")
+UNICODE3_REC( 0x0F57	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0F56, 0x0FB7), ""	, ""	, "TIBETAN LETTER BHA")
+UNICODE3_REC( 0x0F5C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0F5B, 0x0FB7), ""	, ""	, "TIBETAN LETTER DZHA")
+UNICODE3_REC( 0x0F69	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0F40, 0x0FB5), ""	, ""	, "TIBETAN LETTER KSSA")
+UNICODE3_REC( 0x0F73	, "Mn"	, 0	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0F71, 0x0F72), ""	, ""	, "TIBETAN VOWEL SIGN II")
+UNICODE3_REC( 0x0F75	, "Mn"	, 0	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0F71, 0x0F74), ""	, ""	, "TIBETAN VOWEL SIGN UU")
+UNICODE3_REC( 0x0F76	, "Mn"	, 0	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0FB2, 0x0F80), ""	, ""	, "TIBETAN VOWEL SIGN VOCALIC R")
+UNICODE3_REC( 0x0F78	, "Mn"	, 0	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0FB3, 0x0F80), ""	, ""	, "TIBETAN VOWEL SIGN VOCALIC L")
+UNICODE3_REC( 0x0F81	, "Mn"	, 0	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0F71, 0x0F80), ""	, ""	, "TIBETAN VOWEL SIGN REVERSED II")
+UNICODE3_REC( 0x0F93	, "Mn"	, 0	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0F92, 0x0FB7), ""	, ""	, "TIBETAN SUBJOINED LETTER GHA")
+UNICODE3_REC( 0x0F9D	, "Mn"	, 0	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0F9C, 0x0FB7), ""	, ""	, "TIBETAN SUBJOINED LETTER DDHA")
+UNICODE3_REC( 0x0FA2	, "Mn"	, 0	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0FA1, 0x0FB7), ""	, ""	, "TIBETAN SUBJOINED LETTER DHA")
+UNICODE3_REC( 0x0FA7	, "Mn"	, 0	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0FA6, 0x0FB7), ""	, ""	, "TIBETAN SUBJOINED LETTER BHA")
+UNICODE3_REC( 0x0FAC	, "Mn"	, 0	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0FAB, 0x0FB7), ""	, ""	, "TIBETAN SUBJOINED LETTER DZHA")
+UNICODE3_REC( 0x0FB9	, "Mn"	, 0	, "NSM"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0F90, 0x0FB5), ""	, ""	, "TIBETAN SUBJOINED LETTER KSSA")
+UNICODE3_REC( 0x1026	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1025, 0x102E), ""	, ""	, "MYANMAR LETTER UU")
+UNICODE3_REC( 0x1E00	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E01	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0325), ""	, ""	, "LATIN CAPITAL LETTER A WITH RING BELOW")
+UNICODE3_REC( 0x1E01	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E00	, 0x0000	, 0x1E00	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0325), ""	, ""	, "LATIN SMALL LETTER A WITH RING BELOW")
+UNICODE3_REC( 0x1E02	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E03	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0042, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER B WITH DOT ABOVE")
+UNICODE3_REC( 0x1E03	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E02	, 0x0000	, 0x1E02	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0062, 0x0307), ""	, ""	, "LATIN SMALL LETTER B WITH DOT ABOVE")
+UNICODE3_REC( 0x1E04	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E05	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0042, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER B WITH DOT BELOW")
+UNICODE3_REC( 0x1E05	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E04	, 0x0000	, 0x1E04	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0062, 0x0323), ""	, ""	, "LATIN SMALL LETTER B WITH DOT BELOW")
+UNICODE3_REC( 0x1E06	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E07	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0042, 0x0331), ""	, ""	, "LATIN CAPITAL LETTER B WITH LINE BELOW")
+UNICODE3_REC( 0x1E07	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E06	, 0x0000	, 0x1E06	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0062, 0x0331), ""	, ""	, "LATIN SMALL LETTER B WITH LINE BELOW")
+UNICODE3_REC( 0x1E08	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E09	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00C7, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE")
+UNICODE3_REC( 0x1E09	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E08	, 0x0000	, 0x1E08	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00E7, 0x0301), ""	, ""	, "LATIN SMALL LETTER C WITH CEDILLA AND ACUTE")
+UNICODE3_REC( 0x1E0A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E0B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0044, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER D WITH DOT ABOVE")
+UNICODE3_REC( 0x1E0B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E0A	, 0x0000	, 0x1E0A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0064, 0x0307), ""	, ""	, "LATIN SMALL LETTER D WITH DOT ABOVE")
+UNICODE3_REC( 0x1E0C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E0D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0044, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER D WITH DOT BELOW")
+UNICODE3_REC( 0x1E0D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E0C	, 0x0000	, 0x1E0C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0064, 0x0323), ""	, ""	, "LATIN SMALL LETTER D WITH DOT BELOW")
+UNICODE3_REC( 0x1E0E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E0F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0044, 0x0331), ""	, ""	, "LATIN CAPITAL LETTER D WITH LINE BELOW")
+UNICODE3_REC( 0x1E0F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E0E	, 0x0000	, 0x1E0E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0064, 0x0331), ""	, ""	, "LATIN SMALL LETTER D WITH LINE BELOW")
+UNICODE3_REC( 0x1E10	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E11	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0044, 0x0327), ""	, ""	, "LATIN CAPITAL LETTER D WITH CEDILLA")
+UNICODE3_REC( 0x1E11	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E10	, 0x0000	, 0x1E10	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0064, 0x0327), ""	, ""	, "LATIN SMALL LETTER D WITH CEDILLA")
+UNICODE3_REC( 0x1E12	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E13	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0044, 0x032D), ""	, ""	, "LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW")
+UNICODE3_REC( 0x1E13	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E12	, 0x0000	, 0x1E12	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0064, 0x032D), ""	, ""	, "LATIN SMALL LETTER D WITH CIRCUMFLEX BELOW")
+UNICODE3_REC( 0x1E14	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E15	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0112, 0x0300), ""	, ""	, "LATIN CAPITAL LETTER E WITH MACRON AND GRAVE")
+UNICODE3_REC( 0x1E15	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E14	, 0x0000	, 0x1E14	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0113, 0x0300), ""	, ""	, "LATIN SMALL LETTER E WITH MACRON AND GRAVE")
+UNICODE3_REC( 0x1E16	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E17	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0112, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER E WITH MACRON AND ACUTE")
+UNICODE3_REC( 0x1E17	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E16	, 0x0000	, 0x1E16	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0113, 0x0301), ""	, ""	, "LATIN SMALL LETTER E WITH MACRON AND ACUTE")
+UNICODE3_REC( 0x1E18	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E19	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x032D), ""	, ""	, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW")
+UNICODE3_REC( 0x1E19	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E18	, 0x0000	, 0x1E18	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x032D), ""	, ""	, "LATIN SMALL LETTER E WITH CIRCUMFLEX BELOW")
+UNICODE3_REC( 0x1E1A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E1B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0330), ""	, ""	, "LATIN CAPITAL LETTER E WITH TILDE BELOW")
+UNICODE3_REC( 0x1E1B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E1A	, 0x0000	, 0x1E1A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0330), ""	, ""	, "LATIN SMALL LETTER E WITH TILDE BELOW")
+UNICODE3_REC( 0x1E1C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E1D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0228, 0x0306), ""	, ""	, "LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE")
+UNICODE3_REC( 0x1E1D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E1C	, 0x0000	, 0x1E1C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0229, 0x0306), ""	, ""	, "LATIN SMALL LETTER E WITH CEDILLA AND BREVE")
+UNICODE3_REC( 0x1E1E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E1F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0046, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER F WITH DOT ABOVE")
+UNICODE3_REC( 0x1E1F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E1E	, 0x0000	, 0x1E1E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0066, 0x0307), ""	, ""	, "LATIN SMALL LETTER F WITH DOT ABOVE")
+UNICODE3_REC( 0x1E20	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E21	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0047, 0x0304), ""	, ""	, "LATIN CAPITAL LETTER G WITH MACRON")
+UNICODE3_REC( 0x1E21	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E20	, 0x0000	, 0x1E20	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0067, 0x0304), ""	, ""	, "LATIN SMALL LETTER G WITH MACRON")
+UNICODE3_REC( 0x1E22	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E23	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0048, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER H WITH DOT ABOVE")
+UNICODE3_REC( 0x1E23	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E22	, 0x0000	, 0x1E22	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0068, 0x0307), ""	, ""	, "LATIN SMALL LETTER H WITH DOT ABOVE")
+UNICODE3_REC( 0x1E24	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E25	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0048, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER H WITH DOT BELOW")
+UNICODE3_REC( 0x1E25	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E24	, 0x0000	, 0x1E24	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0068, 0x0323), ""	, ""	, "LATIN SMALL LETTER H WITH DOT BELOW")
+UNICODE3_REC( 0x1E26	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E27	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0048, 0x0308), ""	, ""	, "LATIN CAPITAL LETTER H WITH DIAERESIS")
+UNICODE3_REC( 0x1E27	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E26	, 0x0000	, 0x1E26	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0068, 0x0308), ""	, ""	, "LATIN SMALL LETTER H WITH DIAERESIS")
+UNICODE3_REC( 0x1E28	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E29	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0048, 0x0327), ""	, ""	, "LATIN CAPITAL LETTER H WITH CEDILLA")
+UNICODE3_REC( 0x1E29	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E28	, 0x0000	, 0x1E28	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0068, 0x0327), ""	, ""	, "LATIN SMALL LETTER H WITH CEDILLA")
+UNICODE3_REC( 0x1E2A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E2B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0048, 0x032E), ""	, ""	, "LATIN CAPITAL LETTER H WITH BREVE BELOW")
+UNICODE3_REC( 0x1E2B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E2A	, 0x0000	, 0x1E2A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0068, 0x032E), ""	, ""	, "LATIN SMALL LETTER H WITH BREVE BELOW")
+UNICODE3_REC( 0x1E2C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E2D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0330), ""	, ""	, "LATIN CAPITAL LETTER I WITH TILDE BELOW")
+UNICODE3_REC( 0x1E2D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E2C	, 0x0000	, 0x1E2C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x0330), ""	, ""	, "LATIN SMALL LETTER I WITH TILDE BELOW")
+UNICODE3_REC( 0x1E2E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E2F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00CF, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE")
+UNICODE3_REC( 0x1E2F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E2E	, 0x0000	, 0x1E2E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00EF, 0x0301), ""	, ""	, "LATIN SMALL LETTER I WITH DIAERESIS AND ACUTE")
+UNICODE3_REC( 0x1E30	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E31	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004B, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER K WITH ACUTE")
+UNICODE3_REC( 0x1E31	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E30	, 0x0000	, 0x1E30	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006B, 0x0301), ""	, ""	, "LATIN SMALL LETTER K WITH ACUTE")
+UNICODE3_REC( 0x1E32	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E33	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004B, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER K WITH DOT BELOW")
+UNICODE3_REC( 0x1E33	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E32	, 0x0000	, 0x1E32	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006B, 0x0323), ""	, ""	, "LATIN SMALL LETTER K WITH DOT BELOW")
+UNICODE3_REC( 0x1E34	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E35	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004B, 0x0331), ""	, ""	, "LATIN CAPITAL LETTER K WITH LINE BELOW")
+UNICODE3_REC( 0x1E35	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E34	, 0x0000	, 0x1E34	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006B, 0x0331), ""	, ""	, "LATIN SMALL LETTER K WITH LINE BELOW")
+UNICODE3_REC( 0x1E36	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E37	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004C, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER L WITH DOT BELOW")
+UNICODE3_REC( 0x1E37	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E36	, 0x0000	, 0x1E36	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006C, 0x0323), ""	, ""	, "LATIN SMALL LETTER L WITH DOT BELOW")
+UNICODE3_REC( 0x1E38	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E39	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1E36, 0x0304), ""	, ""	, "LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON")
+UNICODE3_REC( 0x1E39	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E38	, 0x0000	, 0x1E38	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1E37, 0x0304), ""	, ""	, "LATIN SMALL LETTER L WITH DOT BELOW AND MACRON")
+UNICODE3_REC( 0x1E3A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E3B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004C, 0x0331), ""	, ""	, "LATIN CAPITAL LETTER L WITH LINE BELOW")
+UNICODE3_REC( 0x1E3B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E3A	, 0x0000	, 0x1E3A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006C, 0x0331), ""	, ""	, "LATIN SMALL LETTER L WITH LINE BELOW")
+UNICODE3_REC( 0x1E3C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E3D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004C, 0x032D), ""	, ""	, "LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW")
+UNICODE3_REC( 0x1E3D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E3C	, 0x0000	, 0x1E3C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006C, 0x032D), ""	, ""	, "LATIN SMALL LETTER L WITH CIRCUMFLEX BELOW")
+UNICODE3_REC( 0x1E3E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E3F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004D, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER M WITH ACUTE")
+UNICODE3_REC( 0x1E3F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E3E	, 0x0000	, 0x1E3E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006D, 0x0301), ""	, ""	, "LATIN SMALL LETTER M WITH ACUTE")
+UNICODE3_REC( 0x1E40	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E41	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004D, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER M WITH DOT ABOVE")
+UNICODE3_REC( 0x1E41	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E40	, 0x0000	, 0x1E40	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006D, 0x0307), ""	, ""	, "LATIN SMALL LETTER M WITH DOT ABOVE")
+UNICODE3_REC( 0x1E42	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E43	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004D, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER M WITH DOT BELOW")
+UNICODE3_REC( 0x1E43	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E42	, 0x0000	, 0x1E42	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006D, 0x0323), ""	, ""	, "LATIN SMALL LETTER M WITH DOT BELOW")
+UNICODE3_REC( 0x1E44	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E45	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004E, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER N WITH DOT ABOVE")
+UNICODE3_REC( 0x1E45	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E44	, 0x0000	, 0x1E44	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006E, 0x0307), ""	, ""	, "LATIN SMALL LETTER N WITH DOT ABOVE")
+UNICODE3_REC( 0x1E46	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E47	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004E, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER N WITH DOT BELOW")
+UNICODE3_REC( 0x1E47	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E46	, 0x0000	, 0x1E46	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006E, 0x0323), ""	, ""	, "LATIN SMALL LETTER N WITH DOT BELOW")
+UNICODE3_REC( 0x1E48	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E49	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004E, 0x0331), ""	, ""	, "LATIN CAPITAL LETTER N WITH LINE BELOW")
+UNICODE3_REC( 0x1E49	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E48	, 0x0000	, 0x1E48	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006E, 0x0331), ""	, ""	, "LATIN SMALL LETTER N WITH LINE BELOW")
+UNICODE3_REC( 0x1E4A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E4B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004E, 0x032D), ""	, ""	, "LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW")
+UNICODE3_REC( 0x1E4B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E4A	, 0x0000	, 0x1E4A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006E, 0x032D), ""	, ""	, "LATIN SMALL LETTER N WITH CIRCUMFLEX BELOW")
+UNICODE3_REC( 0x1E4C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E4D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00D5, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER O WITH TILDE AND ACUTE")
+UNICODE3_REC( 0x1E4D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E4C	, 0x0000	, 0x1E4C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00F5, 0x0301), ""	, ""	, "LATIN SMALL LETTER O WITH TILDE AND ACUTE")
+UNICODE3_REC( 0x1E4E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E4F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00D5, 0x0308), ""	, ""	, "LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS")
+UNICODE3_REC( 0x1E4F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E4E	, 0x0000	, 0x1E4E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00F5, 0x0308), ""	, ""	, "LATIN SMALL LETTER O WITH TILDE AND DIAERESIS")
+UNICODE3_REC( 0x1E50	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E51	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x014C, 0x0300), ""	, ""	, "LATIN CAPITAL LETTER O WITH MACRON AND GRAVE")
+UNICODE3_REC( 0x1E51	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E50	, 0x0000	, 0x1E50	, 0	, UNICODE3_S2(UNICODE3_exact, 0x014D, 0x0300), ""	, ""	, "LATIN SMALL LETTER O WITH MACRON AND GRAVE")
+UNICODE3_REC( 0x1E52	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E53	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x014C, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER O WITH MACRON AND ACUTE")
+UNICODE3_REC( 0x1E53	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E52	, 0x0000	, 0x1E52	, 0	, UNICODE3_S2(UNICODE3_exact, 0x014D, 0x0301), ""	, ""	, "LATIN SMALL LETTER O WITH MACRON AND ACUTE")
+UNICODE3_REC( 0x1E54	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E55	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0050, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER P WITH ACUTE")
+UNICODE3_REC( 0x1E55	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E54	, 0x0000	, 0x1E54	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0070, 0x0301), ""	, ""	, "LATIN SMALL LETTER P WITH ACUTE")
+UNICODE3_REC( 0x1E56	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E57	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0050, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER P WITH DOT ABOVE")
+UNICODE3_REC( 0x1E57	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E56	, 0x0000	, 0x1E56	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0070, 0x0307), ""	, ""	, "LATIN SMALL LETTER P WITH DOT ABOVE")
+UNICODE3_REC( 0x1E58	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E59	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0052, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER R WITH DOT ABOVE")
+UNICODE3_REC( 0x1E59	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E58	, 0x0000	, 0x1E58	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0072, 0x0307), ""	, ""	, "LATIN SMALL LETTER R WITH DOT ABOVE")
+UNICODE3_REC( 0x1E5A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E5B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0052, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER R WITH DOT BELOW")
+UNICODE3_REC( 0x1E5B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E5A	, 0x0000	, 0x1E5A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0072, 0x0323), ""	, ""	, "LATIN SMALL LETTER R WITH DOT BELOW")
+UNICODE3_REC( 0x1E5C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E5D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1E5A, 0x0304), ""	, ""	, "LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON")
+UNICODE3_REC( 0x1E5D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E5C	, 0x0000	, 0x1E5C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1E5B, 0x0304), ""	, ""	, "LATIN SMALL LETTER R WITH DOT BELOW AND MACRON")
+UNICODE3_REC( 0x1E5E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E5F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0052, 0x0331), ""	, ""	, "LATIN CAPITAL LETTER R WITH LINE BELOW")
+UNICODE3_REC( 0x1E5F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E5E	, 0x0000	, 0x1E5E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0072, 0x0331), ""	, ""	, "LATIN SMALL LETTER R WITH LINE BELOW")
+UNICODE3_REC( 0x1E60	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E61	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0053, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER S WITH DOT ABOVE")
+UNICODE3_REC( 0x1E61	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E60	, 0x0000	, 0x1E60	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0073, 0x0307), ""	, ""	, "LATIN SMALL LETTER S WITH DOT ABOVE")
+UNICODE3_REC( 0x1E62	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E63	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0053, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER S WITH DOT BELOW")
+UNICODE3_REC( 0x1E63	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E62	, 0x0000	, 0x1E62	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0073, 0x0323), ""	, ""	, "LATIN SMALL LETTER S WITH DOT BELOW")
+UNICODE3_REC( 0x1E64	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E65	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x015A, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE")
+UNICODE3_REC( 0x1E65	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E64	, 0x0000	, 0x1E64	, 0	, UNICODE3_S2(UNICODE3_exact, 0x015B, 0x0307), ""	, ""	, "LATIN SMALL LETTER S WITH ACUTE AND DOT ABOVE")
+UNICODE3_REC( 0x1E66	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E67	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0160, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE")
+UNICODE3_REC( 0x1E67	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E66	, 0x0000	, 0x1E66	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0161, 0x0307), ""	, ""	, "LATIN SMALL LETTER S WITH CARON AND DOT ABOVE")
+UNICODE3_REC( 0x1E68	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E69	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1E62, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE")
+UNICODE3_REC( 0x1E69	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E68	, 0x0000	, 0x1E68	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1E63, 0x0307), ""	, ""	, "LATIN SMALL LETTER S WITH DOT BELOW AND DOT ABOVE")
+UNICODE3_REC( 0x1E6A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E6B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0054, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER T WITH DOT ABOVE")
+UNICODE3_REC( 0x1E6B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E6A	, 0x0000	, 0x1E6A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0074, 0x0307), ""	, ""	, "LATIN SMALL LETTER T WITH DOT ABOVE")
+UNICODE3_REC( 0x1E6C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E6D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0054, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER T WITH DOT BELOW")
+UNICODE3_REC( 0x1E6D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E6C	, 0x0000	, 0x1E6C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0074, 0x0323), ""	, ""	, "LATIN SMALL LETTER T WITH DOT BELOW")
+UNICODE3_REC( 0x1E6E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E6F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0054, 0x0331), ""	, ""	, "LATIN CAPITAL LETTER T WITH LINE BELOW")
+UNICODE3_REC( 0x1E6F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E6E	, 0x0000	, 0x1E6E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0074, 0x0331), ""	, ""	, "LATIN SMALL LETTER T WITH LINE BELOW")
+UNICODE3_REC( 0x1E70	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E71	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0054, 0x032D), ""	, ""	, "LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW")
+UNICODE3_REC( 0x1E71	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E70	, 0x0000	, 0x1E70	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0074, 0x032D), ""	, ""	, "LATIN SMALL LETTER T WITH CIRCUMFLEX BELOW")
+UNICODE3_REC( 0x1E72	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E73	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0324), ""	, ""	, "LATIN CAPITAL LETTER U WITH DIAERESIS BELOW")
+UNICODE3_REC( 0x1E73	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E72	, 0x0000	, 0x1E72	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0324), ""	, ""	, "LATIN SMALL LETTER U WITH DIAERESIS BELOW")
+UNICODE3_REC( 0x1E74	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E75	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0330), ""	, ""	, "LATIN CAPITAL LETTER U WITH TILDE BELOW")
+UNICODE3_REC( 0x1E75	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E74	, 0x0000	, 0x1E74	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0330), ""	, ""	, "LATIN SMALL LETTER U WITH TILDE BELOW")
+UNICODE3_REC( 0x1E76	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E77	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x032D), ""	, ""	, "LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW")
+UNICODE3_REC( 0x1E77	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E76	, 0x0000	, 0x1E76	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x032D), ""	, ""	, "LATIN SMALL LETTER U WITH CIRCUMFLEX BELOW")
+UNICODE3_REC( 0x1E78	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E79	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0168, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER U WITH TILDE AND ACUTE")
+UNICODE3_REC( 0x1E79	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E78	, 0x0000	, 0x1E78	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0169, 0x0301), ""	, ""	, "LATIN SMALL LETTER U WITH TILDE AND ACUTE")
+UNICODE3_REC( 0x1E7A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E7B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x016A, 0x0308), ""	, ""	, "LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS")
+UNICODE3_REC( 0x1E7B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E7A	, 0x0000	, 0x1E7A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x016B, 0x0308), ""	, ""	, "LATIN SMALL LETTER U WITH MACRON AND DIAERESIS")
+UNICODE3_REC( 0x1E7C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E7D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0056, 0x0303), ""	, ""	, "LATIN CAPITAL LETTER V WITH TILDE")
+UNICODE3_REC( 0x1E7D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E7C	, 0x0000	, 0x1E7C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0076, 0x0303), ""	, ""	, "LATIN SMALL LETTER V WITH TILDE")
+UNICODE3_REC( 0x1E7E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E7F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0056, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER V WITH DOT BELOW")
+UNICODE3_REC( 0x1E7F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E7E	, 0x0000	, 0x1E7E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0076, 0x0323), ""	, ""	, "LATIN SMALL LETTER V WITH DOT BELOW")
+UNICODE3_REC( 0x1E80	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E81	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0057, 0x0300), ""	, ""	, "LATIN CAPITAL LETTER W WITH GRAVE")
+UNICODE3_REC( 0x1E81	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E80	, 0x0000	, 0x1E80	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0077, 0x0300), ""	, ""	, "LATIN SMALL LETTER W WITH GRAVE")
+UNICODE3_REC( 0x1E82	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E83	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0057, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER W WITH ACUTE")
+UNICODE3_REC( 0x1E83	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E82	, 0x0000	, 0x1E82	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0077, 0x0301), ""	, ""	, "LATIN SMALL LETTER W WITH ACUTE")
+UNICODE3_REC( 0x1E84	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E85	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0057, 0x0308), ""	, ""	, "LATIN CAPITAL LETTER W WITH DIAERESIS")
+UNICODE3_REC( 0x1E85	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E84	, 0x0000	, 0x1E84	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0077, 0x0308), ""	, ""	, "LATIN SMALL LETTER W WITH DIAERESIS")
+UNICODE3_REC( 0x1E86	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E87	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0057, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER W WITH DOT ABOVE")
+UNICODE3_REC( 0x1E87	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E86	, 0x0000	, 0x1E86	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0077, 0x0307), ""	, ""	, "LATIN SMALL LETTER W WITH DOT ABOVE")
+UNICODE3_REC( 0x1E88	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E89	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0057, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER W WITH DOT BELOW")
+UNICODE3_REC( 0x1E89	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E88	, 0x0000	, 0x1E88	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0077, 0x0323), ""	, ""	, "LATIN SMALL LETTER W WITH DOT BELOW")
+UNICODE3_REC( 0x1E8A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E8B	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0058, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER X WITH DOT ABOVE")
+UNICODE3_REC( 0x1E8B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E8A	, 0x0000	, 0x1E8A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0078, 0x0307), ""	, ""	, "LATIN SMALL LETTER X WITH DOT ABOVE")
+UNICODE3_REC( 0x1E8C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E8D	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0058, 0x0308), ""	, ""	, "LATIN CAPITAL LETTER X WITH DIAERESIS")
+UNICODE3_REC( 0x1E8D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E8C	, 0x0000	, 0x1E8C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0078, 0x0308), ""	, ""	, "LATIN SMALL LETTER X WITH DIAERESIS")
+UNICODE3_REC( 0x1E8E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E8F	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0059, 0x0307), ""	, ""	, "LATIN CAPITAL LETTER Y WITH DOT ABOVE")
+UNICODE3_REC( 0x1E8F	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E8E	, 0x0000	, 0x1E8E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0079, 0x0307), ""	, ""	, "LATIN SMALL LETTER Y WITH DOT ABOVE")
+UNICODE3_REC( 0x1E90	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E91	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x005A, 0x0302), ""	, ""	, "LATIN CAPITAL LETTER Z WITH CIRCUMFLEX")
+UNICODE3_REC( 0x1E91	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E90	, 0x0000	, 0x1E90	, 0	, UNICODE3_S2(UNICODE3_exact, 0x007A, 0x0302), ""	, ""	, "LATIN SMALL LETTER Z WITH CIRCUMFLEX")
+UNICODE3_REC( 0x1E92	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E93	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x005A, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER Z WITH DOT BELOW")
+UNICODE3_REC( 0x1E93	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E92	, 0x0000	, 0x1E92	, 0	, UNICODE3_S2(UNICODE3_exact, 0x007A, 0x0323), ""	, ""	, "LATIN SMALL LETTER Z WITH DOT BELOW")
+UNICODE3_REC( 0x1E94	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1E95	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x005A, 0x0331), ""	, ""	, "LATIN CAPITAL LETTER Z WITH LINE BELOW")
+UNICODE3_REC( 0x1E95	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E94	, 0x0000	, 0x1E94	, 0	, UNICODE3_S2(UNICODE3_exact, 0x007A, 0x0331), ""	, ""	, "LATIN SMALL LETTER Z WITH LINE BELOW")
+UNICODE3_REC( 0x1E96	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0068, 0x0331), ""	, ""	, "LATIN SMALL LETTER H WITH LINE BELOW")
+UNICODE3_REC( 0x1E97	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0074, 0x0308), ""	, ""	, "LATIN SMALL LETTER T WITH DIAERESIS")
+UNICODE3_REC( 0x1E98	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0077, 0x030A), ""	, ""	, "LATIN SMALL LETTER W WITH RING ABOVE")
+UNICODE3_REC( 0x1E99	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0079, 0x030A), ""	, ""	, "LATIN SMALL LETTER Y WITH RING ABOVE")
+UNICODE3_REC( 0x1E9B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1E60	, 0x0000	, 0x1E60	, 0	, UNICODE3_S2(UNICODE3_exact, 0x017F, 0x0307), ""	, ""	, "LATIN SMALL LETTER LONG S WITH DOT ABOVE")
+UNICODE3_REC( 0x1EA0	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EA1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER A WITH DOT BELOW")
+UNICODE3_REC( 0x1EA1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EA0	, 0x0000	, 0x1EA0	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0323), ""	, ""	, "LATIN SMALL LETTER A WITH DOT BELOW")
+UNICODE3_REC( 0x1EA2	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EA3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0041, 0x0309), ""	, ""	, "LATIN CAPITAL LETTER A WITH HOOK ABOVE")
+UNICODE3_REC( 0x1EA3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EA2	, 0x0000	, 0x1EA2	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0061, 0x0309), ""	, ""	, "LATIN SMALL LETTER A WITH HOOK ABOVE")
+UNICODE3_REC( 0x1EA4	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EA5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00C2, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE")
+UNICODE3_REC( 0x1EA5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EA4	, 0x0000	, 0x1EA4	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00E2, 0x0301), ""	, ""	, "LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE")
+UNICODE3_REC( 0x1EA6	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EA7	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00C2, 0x0300), ""	, ""	, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE")
+UNICODE3_REC( 0x1EA7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EA6	, 0x0000	, 0x1EA6	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00E2, 0x0300), ""	, ""	, "LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE")
+UNICODE3_REC( 0x1EA8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EA9	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00C2, 0x0309), ""	, ""	, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE")
+UNICODE3_REC( 0x1EA9	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EA8	, 0x0000	, 0x1EA8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00E2, 0x0309), ""	, ""	, "LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE")
+UNICODE3_REC( 0x1EAA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EAB	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00C2, 0x0303), ""	, ""	, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE")
+UNICODE3_REC( 0x1EAB	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EAA	, 0x0000	, 0x1EAA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00E2, 0x0303), ""	, ""	, "LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE")
+UNICODE3_REC( 0x1EAC	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EAD	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1EA0, 0x0302), ""	, ""	, "LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW")
+UNICODE3_REC( 0x1EAD	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EAC	, 0x0000	, 0x1EAC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1EA1, 0x0302), ""	, ""	, "LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW")
+UNICODE3_REC( 0x1EAE	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EAF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0102, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER A WITH BREVE AND ACUTE")
+UNICODE3_REC( 0x1EAF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EAE	, 0x0000	, 0x1EAE	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0103, 0x0301), ""	, ""	, "LATIN SMALL LETTER A WITH BREVE AND ACUTE")
+UNICODE3_REC( 0x1EB0	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EB1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0102, 0x0300), ""	, ""	, "LATIN CAPITAL LETTER A WITH BREVE AND GRAVE")
+UNICODE3_REC( 0x1EB1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EB0	, 0x0000	, 0x1EB0	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0103, 0x0300), ""	, ""	, "LATIN SMALL LETTER A WITH BREVE AND GRAVE")
+UNICODE3_REC( 0x1EB2	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EB3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0102, 0x0309), ""	, ""	, "LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE")
+UNICODE3_REC( 0x1EB3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EB2	, 0x0000	, 0x1EB2	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0103, 0x0309), ""	, ""	, "LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE")
+UNICODE3_REC( 0x1EB4	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EB5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0102, 0x0303), ""	, ""	, "LATIN CAPITAL LETTER A WITH BREVE AND TILDE")
+UNICODE3_REC( 0x1EB5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EB4	, 0x0000	, 0x1EB4	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0103, 0x0303), ""	, ""	, "LATIN SMALL LETTER A WITH BREVE AND TILDE")
+UNICODE3_REC( 0x1EB6	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EB7	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1EA0, 0x0306), ""	, ""	, "LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW")
+UNICODE3_REC( 0x1EB7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EB6	, 0x0000	, 0x1EB6	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1EA1, 0x0306), ""	, ""	, "LATIN SMALL LETTER A WITH BREVE AND DOT BELOW")
+UNICODE3_REC( 0x1EB8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EB9	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER E WITH DOT BELOW")
+UNICODE3_REC( 0x1EB9	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EB8	, 0x0000	, 0x1EB8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0323), ""	, ""	, "LATIN SMALL LETTER E WITH DOT BELOW")
+UNICODE3_REC( 0x1EBA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EBB	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0309), ""	, ""	, "LATIN CAPITAL LETTER E WITH HOOK ABOVE")
+UNICODE3_REC( 0x1EBB	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EBA	, 0x0000	, 0x1EBA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0309), ""	, ""	, "LATIN SMALL LETTER E WITH HOOK ABOVE")
+UNICODE3_REC( 0x1EBC	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EBD	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0045, 0x0303), ""	, ""	, "LATIN CAPITAL LETTER E WITH TILDE")
+UNICODE3_REC( 0x1EBD	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EBC	, 0x0000	, 0x1EBC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0065, 0x0303), ""	, ""	, "LATIN SMALL LETTER E WITH TILDE")
+UNICODE3_REC( 0x1EBE	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EBF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00CA, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE")
+UNICODE3_REC( 0x1EBF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EBE	, 0x0000	, 0x1EBE	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00EA, 0x0301), ""	, ""	, "LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE")
+UNICODE3_REC( 0x1EC0	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EC1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00CA, 0x0300), ""	, ""	, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE")
+UNICODE3_REC( 0x1EC1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EC0	, 0x0000	, 0x1EC0	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00EA, 0x0300), ""	, ""	, "LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE")
+UNICODE3_REC( 0x1EC2	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EC3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00CA, 0x0309), ""	, ""	, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE")
+UNICODE3_REC( 0x1EC3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EC2	, 0x0000	, 0x1EC2	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00EA, 0x0309), ""	, ""	, "LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE")
+UNICODE3_REC( 0x1EC4	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EC5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00CA, 0x0303), ""	, ""	, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE")
+UNICODE3_REC( 0x1EC5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EC4	, 0x0000	, 0x1EC4	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00EA, 0x0303), ""	, ""	, "LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE")
+UNICODE3_REC( 0x1EC6	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EC7	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1EB8, 0x0302), ""	, ""	, "LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW")
+UNICODE3_REC( 0x1EC7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EC6	, 0x0000	, 0x1EC6	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1EB9, 0x0302), ""	, ""	, "LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW")
+UNICODE3_REC( 0x1EC8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EC9	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0309), ""	, ""	, "LATIN CAPITAL LETTER I WITH HOOK ABOVE")
+UNICODE3_REC( 0x1EC9	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EC8	, 0x0000	, 0x1EC8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x0309), ""	, ""	, "LATIN SMALL LETTER I WITH HOOK ABOVE")
+UNICODE3_REC( 0x1ECA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1ECB	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0049, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER I WITH DOT BELOW")
+UNICODE3_REC( 0x1ECB	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1ECA	, 0x0000	, 0x1ECA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0069, 0x0323), ""	, ""	, "LATIN SMALL LETTER I WITH DOT BELOW")
+UNICODE3_REC( 0x1ECC	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1ECD	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER O WITH DOT BELOW")
+UNICODE3_REC( 0x1ECD	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1ECC	, 0x0000	, 0x1ECC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x0323), ""	, ""	, "LATIN SMALL LETTER O WITH DOT BELOW")
+UNICODE3_REC( 0x1ECE	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1ECF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x004F, 0x0309), ""	, ""	, "LATIN CAPITAL LETTER O WITH HOOK ABOVE")
+UNICODE3_REC( 0x1ECF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1ECE	, 0x0000	, 0x1ECE	, 0	, UNICODE3_S2(UNICODE3_exact, 0x006F, 0x0309), ""	, ""	, "LATIN SMALL LETTER O WITH HOOK ABOVE")
+UNICODE3_REC( 0x1ED0	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1ED1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00D4, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE")
+UNICODE3_REC( 0x1ED1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1ED0	, 0x0000	, 0x1ED0	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00F4, 0x0301), ""	, ""	, "LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE")
+UNICODE3_REC( 0x1ED2	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1ED3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00D4, 0x0300), ""	, ""	, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE")
+UNICODE3_REC( 0x1ED3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1ED2	, 0x0000	, 0x1ED2	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00F4, 0x0300), ""	, ""	, "LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE")
+UNICODE3_REC( 0x1ED4	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1ED5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00D4, 0x0309), ""	, ""	, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE")
+UNICODE3_REC( 0x1ED5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1ED4	, 0x0000	, 0x1ED4	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00F4, 0x0309), ""	, ""	, "LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE")
+UNICODE3_REC( 0x1ED6	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1ED7	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00D4, 0x0303), ""	, ""	, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE")
+UNICODE3_REC( 0x1ED7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1ED6	, 0x0000	, 0x1ED6	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00F4, 0x0303), ""	, ""	, "LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE")
+UNICODE3_REC( 0x1ED8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1ED9	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1ECC, 0x0302), ""	, ""	, "LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW")
+UNICODE3_REC( 0x1ED9	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1ED8	, 0x0000	, 0x1ED8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1ECD, 0x0302), ""	, ""	, "LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW")
+UNICODE3_REC( 0x1EDA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EDB	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01A0, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER O WITH HORN AND ACUTE")
+UNICODE3_REC( 0x1EDB	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EDA	, 0x0000	, 0x1EDA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01A1, 0x0301), ""	, ""	, "LATIN SMALL LETTER O WITH HORN AND ACUTE")
+UNICODE3_REC( 0x1EDC	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EDD	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01A0, 0x0300), ""	, ""	, "LATIN CAPITAL LETTER O WITH HORN AND GRAVE")
+UNICODE3_REC( 0x1EDD	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EDC	, 0x0000	, 0x1EDC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01A1, 0x0300), ""	, ""	, "LATIN SMALL LETTER O WITH HORN AND GRAVE")
+UNICODE3_REC( 0x1EDE	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EDF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01A0, 0x0309), ""	, ""	, "LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE")
+UNICODE3_REC( 0x1EDF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EDE	, 0x0000	, 0x1EDE	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01A1, 0x0309), ""	, ""	, "LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE")
+UNICODE3_REC( 0x1EE0	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EE1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01A0, 0x0303), ""	, ""	, "LATIN CAPITAL LETTER O WITH HORN AND TILDE")
+UNICODE3_REC( 0x1EE1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EE0	, 0x0000	, 0x1EE0	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01A1, 0x0303), ""	, ""	, "LATIN SMALL LETTER O WITH HORN AND TILDE")
+UNICODE3_REC( 0x1EE2	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EE3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01A0, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW")
+UNICODE3_REC( 0x1EE3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EE2	, 0x0000	, 0x1EE2	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01A1, 0x0323), ""	, ""	, "LATIN SMALL LETTER O WITH HORN AND DOT BELOW")
+UNICODE3_REC( 0x1EE4	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EE5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER U WITH DOT BELOW")
+UNICODE3_REC( 0x1EE5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EE4	, 0x0000	, 0x1EE4	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0323), ""	, ""	, "LATIN SMALL LETTER U WITH DOT BELOW")
+UNICODE3_REC( 0x1EE6	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EE7	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0055, 0x0309), ""	, ""	, "LATIN CAPITAL LETTER U WITH HOOK ABOVE")
+UNICODE3_REC( 0x1EE7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EE6	, 0x0000	, 0x1EE6	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0075, 0x0309), ""	, ""	, "LATIN SMALL LETTER U WITH HOOK ABOVE")
+UNICODE3_REC( 0x1EE8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EE9	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01AF, 0x0301), ""	, ""	, "LATIN CAPITAL LETTER U WITH HORN AND ACUTE")
+UNICODE3_REC( 0x1EE9	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EE8	, 0x0000	, 0x1EE8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01B0, 0x0301), ""	, ""	, "LATIN SMALL LETTER U WITH HORN AND ACUTE")
+UNICODE3_REC( 0x1EEA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EEB	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01AF, 0x0300), ""	, ""	, "LATIN CAPITAL LETTER U WITH HORN AND GRAVE")
+UNICODE3_REC( 0x1EEB	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EEA	, 0x0000	, 0x1EEA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01B0, 0x0300), ""	, ""	, "LATIN SMALL LETTER U WITH HORN AND GRAVE")
+UNICODE3_REC( 0x1EEC	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EED	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01AF, 0x0309), ""	, ""	, "LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE")
+UNICODE3_REC( 0x1EED	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EEC	, 0x0000	, 0x1EEC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01B0, 0x0309), ""	, ""	, "LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE")
+UNICODE3_REC( 0x1EEE	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EEF	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01AF, 0x0303), ""	, ""	, "LATIN CAPITAL LETTER U WITH HORN AND TILDE")
+UNICODE3_REC( 0x1EEF	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EEE	, 0x0000	, 0x1EEE	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01B0, 0x0303), ""	, ""	, "LATIN SMALL LETTER U WITH HORN AND TILDE")
+UNICODE3_REC( 0x1EF0	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EF1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01AF, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW")
+UNICODE3_REC( 0x1EF1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EF0	, 0x0000	, 0x1EF0	, 0	, UNICODE3_S2(UNICODE3_exact, 0x01B0, 0x0323), ""	, ""	, "LATIN SMALL LETTER U WITH HORN AND DOT BELOW")
+UNICODE3_REC( 0x1EF2	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EF3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0059, 0x0300), ""	, ""	, "LATIN CAPITAL LETTER Y WITH GRAVE")
+UNICODE3_REC( 0x1EF3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EF2	, 0x0000	, 0x1EF2	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0079, 0x0300), ""	, ""	, "LATIN SMALL LETTER Y WITH GRAVE")
+UNICODE3_REC( 0x1EF4	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EF5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0059, 0x0323), ""	, ""	, "LATIN CAPITAL LETTER Y WITH DOT BELOW")
+UNICODE3_REC( 0x1EF5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EF4	, 0x0000	, 0x1EF4	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0079, 0x0323), ""	, ""	, "LATIN SMALL LETTER Y WITH DOT BELOW")
+UNICODE3_REC( 0x1EF6	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EF7	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0059, 0x0309), ""	, ""	, "LATIN CAPITAL LETTER Y WITH HOOK ABOVE")
+UNICODE3_REC( 0x1EF7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EF6	, 0x0000	, 0x1EF6	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0079, 0x0309), ""	, ""	, "LATIN SMALL LETTER Y WITH HOOK ABOVE")
+UNICODE3_REC( 0x1EF8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1EF9	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0059, 0x0303), ""	, ""	, "LATIN CAPITAL LETTER Y WITH TILDE")
+UNICODE3_REC( 0x1EF9	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1EF8	, 0x0000	, 0x1EF8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0079, 0x0303), ""	, ""	, "LATIN SMALL LETTER Y WITH TILDE")
+UNICODE3_REC( 0x1F00	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F08	, 0x0000	, 0x1F08	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B1, 0x0313), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH PSILI")
+UNICODE3_REC( 0x1F01	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F09	, 0x0000	, 0x1F09	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B1, 0x0314), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH DASIA")
+UNICODE3_REC( 0x1F02	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F0A	, 0x0000	, 0x1F0A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F00, 0x0300), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F03	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F0B	, 0x0000	, 0x1F0B	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F01, 0x0300), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F04	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F0C	, 0x0000	, 0x1F0C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F00, 0x0301), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F05	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F0D	, 0x0000	, 0x1F0D	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F01, 0x0301), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F06	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F0E	, 0x0000	, 0x1F0E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F00, 0x0342), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI")
+UNICODE3_REC( 0x1F07	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F0F	, 0x0000	, 0x1F0F	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F01, 0x0342), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI")
+UNICODE3_REC( 0x1F08	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F00	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0391, 0x0313), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH PSILI")
+UNICODE3_REC( 0x1F09	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F01	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0391, 0x0314), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH DASIA")
+UNICODE3_REC( 0x1F0A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F02	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F08, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F0B	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F03	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F09, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F0C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F04	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F08, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F0D	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F05	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F09, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F0E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F06	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F08, 0x0342), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI")
+UNICODE3_REC( 0x1F0F	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F07	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F09, 0x0342), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI")
+UNICODE3_REC( 0x1F10	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F18	, 0x0000	, 0x1F18	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B5, 0x0313), ""	, ""	, "GREEK SMALL LETTER EPSILON WITH PSILI")
+UNICODE3_REC( 0x1F11	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F19	, 0x0000	, 0x1F19	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B5, 0x0314), ""	, ""	, "GREEK SMALL LETTER EPSILON WITH DASIA")
+UNICODE3_REC( 0x1F12	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F1A	, 0x0000	, 0x1F1A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F10, 0x0300), ""	, ""	, "GREEK SMALL LETTER EPSILON WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F13	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F1B	, 0x0000	, 0x1F1B	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F11, 0x0300), ""	, ""	, "GREEK SMALL LETTER EPSILON WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F14	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F1C	, 0x0000	, 0x1F1C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F10, 0x0301), ""	, ""	, "GREEK SMALL LETTER EPSILON WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F15	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F1D	, 0x0000	, 0x1F1D	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F11, 0x0301), ""	, ""	, "GREEK SMALL LETTER EPSILON WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F18	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F10	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0395, 0x0313), ""	, ""	, "GREEK CAPITAL LETTER EPSILON WITH PSILI")
+UNICODE3_REC( 0x1F19	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F11	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0395, 0x0314), ""	, ""	, "GREEK CAPITAL LETTER EPSILON WITH DASIA")
+UNICODE3_REC( 0x1F1A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F12	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F18, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER EPSILON WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F1B	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F13	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F19, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER EPSILON WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F1C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F14	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F18, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER EPSILON WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F1D	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F15	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F19, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER EPSILON WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F20	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F28	, 0x0000	, 0x1F28	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B7, 0x0313), ""	, ""	, "GREEK SMALL LETTER ETA WITH PSILI")
+UNICODE3_REC( 0x1F21	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F29	, 0x0000	, 0x1F29	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B7, 0x0314), ""	, ""	, "GREEK SMALL LETTER ETA WITH DASIA")
+UNICODE3_REC( 0x1F22	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F2A	, 0x0000	, 0x1F2A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F20, 0x0300), ""	, ""	, "GREEK SMALL LETTER ETA WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F23	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F2B	, 0x0000	, 0x1F2B	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F21, 0x0300), ""	, ""	, "GREEK SMALL LETTER ETA WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F24	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F2C	, 0x0000	, 0x1F2C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F20, 0x0301), ""	, ""	, "GREEK SMALL LETTER ETA WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F25	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F2D	, 0x0000	, 0x1F2D	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F21, 0x0301), ""	, ""	, "GREEK SMALL LETTER ETA WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F26	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F2E	, 0x0000	, 0x1F2E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F20, 0x0342), ""	, ""	, "GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI")
+UNICODE3_REC( 0x1F27	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F2F	, 0x0000	, 0x1F2F	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F21, 0x0342), ""	, ""	, "GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI")
+UNICODE3_REC( 0x1F28	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F20	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0397, 0x0313), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH PSILI")
+UNICODE3_REC( 0x1F29	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F21	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0397, 0x0314), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH DASIA")
+UNICODE3_REC( 0x1F2A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F22	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F28, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F2B	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F23	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F29, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F2C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F24	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F28, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F2D	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F25	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F29, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F2E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F26	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F28, 0x0342), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI")
+UNICODE3_REC( 0x1F2F	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F27	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F29, 0x0342), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI")
+UNICODE3_REC( 0x1F30	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F38	, 0x0000	, 0x1F38	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B9, 0x0313), ""	, ""	, "GREEK SMALL LETTER IOTA WITH PSILI")
+UNICODE3_REC( 0x1F31	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F39	, 0x0000	, 0x1F39	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B9, 0x0314), ""	, ""	, "GREEK SMALL LETTER IOTA WITH DASIA")
+UNICODE3_REC( 0x1F32	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F3A	, 0x0000	, 0x1F3A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F30, 0x0300), ""	, ""	, "GREEK SMALL LETTER IOTA WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F33	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F3B	, 0x0000	, 0x1F3B	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F31, 0x0300), ""	, ""	, "GREEK SMALL LETTER IOTA WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F34	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F3C	, 0x0000	, 0x1F3C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F30, 0x0301), ""	, ""	, "GREEK SMALL LETTER IOTA WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F35	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F3D	, 0x0000	, 0x1F3D	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F31, 0x0301), ""	, ""	, "GREEK SMALL LETTER IOTA WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F36	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F3E	, 0x0000	, 0x1F3E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F30, 0x0342), ""	, ""	, "GREEK SMALL LETTER IOTA WITH PSILI AND PERISPOMENI")
+UNICODE3_REC( 0x1F37	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F3F	, 0x0000	, 0x1F3F	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F31, 0x0342), ""	, ""	, "GREEK SMALL LETTER IOTA WITH DASIA AND PERISPOMENI")
+UNICODE3_REC( 0x1F38	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F30	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0399, 0x0313), ""	, ""	, "GREEK CAPITAL LETTER IOTA WITH PSILI")
+UNICODE3_REC( 0x1F39	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F31	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0399, 0x0314), ""	, ""	, "GREEK CAPITAL LETTER IOTA WITH DASIA")
+UNICODE3_REC( 0x1F3A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F32	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F38, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER IOTA WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F3B	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F33	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F39, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER IOTA WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F3C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F34	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F38, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER IOTA WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F3D	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F35	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F39, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER IOTA WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F3E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F36	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F38, 0x0342), ""	, ""	, "GREEK CAPITAL LETTER IOTA WITH PSILI AND PERISPOMENI")
+UNICODE3_REC( 0x1F3F	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F37	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F39, 0x0342), ""	, ""	, "GREEK CAPITAL LETTER IOTA WITH DASIA AND PERISPOMENI")
+UNICODE3_REC( 0x1F40	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F48	, 0x0000	, 0x1F48	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03BF, 0x0313), ""	, ""	, "GREEK SMALL LETTER OMICRON WITH PSILI")
+UNICODE3_REC( 0x1F41	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F49	, 0x0000	, 0x1F49	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03BF, 0x0314), ""	, ""	, "GREEK SMALL LETTER OMICRON WITH DASIA")
+UNICODE3_REC( 0x1F42	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F4A	, 0x0000	, 0x1F4A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F40, 0x0300), ""	, ""	, "GREEK SMALL LETTER OMICRON WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F43	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F4B	, 0x0000	, 0x1F4B	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F41, 0x0300), ""	, ""	, "GREEK SMALL LETTER OMICRON WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F44	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F4C	, 0x0000	, 0x1F4C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F40, 0x0301), ""	, ""	, "GREEK SMALL LETTER OMICRON WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F45	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F4D	, 0x0000	, 0x1F4D	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F41, 0x0301), ""	, ""	, "GREEK SMALL LETTER OMICRON WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F48	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F40	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x039F, 0x0313), ""	, ""	, "GREEK CAPITAL LETTER OMICRON WITH PSILI")
+UNICODE3_REC( 0x1F49	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F41	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x039F, 0x0314), ""	, ""	, "GREEK CAPITAL LETTER OMICRON WITH DASIA")
+UNICODE3_REC( 0x1F4A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F42	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F48, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER OMICRON WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F4B	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F43	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F49, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER OMICRON WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F4C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F44	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F48, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER OMICRON WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F4D	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F45	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F49, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER OMICRON WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F50	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C5, 0x0313), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH PSILI")
+UNICODE3_REC( 0x1F51	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F59	, 0x0000	, 0x1F59	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C5, 0x0314), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH DASIA")
+UNICODE3_REC( 0x1F52	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F50, 0x0300), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F53	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F5B	, 0x0000	, 0x1F5B	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F51, 0x0300), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F54	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F50, 0x0301), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F55	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F5D	, 0x0000	, 0x1F5D	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F51, 0x0301), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F56	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F50, 0x0342), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI")
+UNICODE3_REC( 0x1F57	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F5F	, 0x0000	, 0x1F5F	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F51, 0x0342), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH DASIA AND PERISPOMENI")
+UNICODE3_REC( 0x1F59	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F51	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03A5, 0x0314), ""	, ""	, "GREEK CAPITAL LETTER UPSILON WITH DASIA")
+UNICODE3_REC( 0x1F5B	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F53	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F59, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER UPSILON WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F5D	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F55	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F59, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER UPSILON WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F5F	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F57	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F59, 0x0342), ""	, ""	, "GREEK CAPITAL LETTER UPSILON WITH DASIA AND PERISPOMENI")
+UNICODE3_REC( 0x1F60	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F68	, 0x0000	, 0x1F68	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C9, 0x0313), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH PSILI")
+UNICODE3_REC( 0x1F61	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F69	, 0x0000	, 0x1F69	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C9, 0x0314), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH DASIA")
+UNICODE3_REC( 0x1F62	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F6A	, 0x0000	, 0x1F6A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F60, 0x0300), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F63	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F6B	, 0x0000	, 0x1F6B	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F61, 0x0300), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F64	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F6C	, 0x0000	, 0x1F6C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F60, 0x0301), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F65	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F6D	, 0x0000	, 0x1F6D	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F61, 0x0301), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F66	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F6E	, 0x0000	, 0x1F6E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F60, 0x0342), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI")
+UNICODE3_REC( 0x1F67	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F6F	, 0x0000	, 0x1F6F	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F61, 0x0342), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI")
+UNICODE3_REC( 0x1F68	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F60	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03A9, 0x0313), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH PSILI")
+UNICODE3_REC( 0x1F69	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F61	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03A9, 0x0314), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH DASIA")
+UNICODE3_REC( 0x1F6A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F62	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F68, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA")
+UNICODE3_REC( 0x1F6B	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F63	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F69, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA")
+UNICODE3_REC( 0x1F6C	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F64	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F68, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA")
+UNICODE3_REC( 0x1F6D	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F65	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F69, 0x0301), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA")
+UNICODE3_REC( 0x1F6E	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F66	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F68, 0x0342), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI")
+UNICODE3_REC( 0x1F6F	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F67	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F69, 0x0342), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI")
+UNICODE3_REC( 0x1F70	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FBA	, 0x0000	, 0x1FBA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B1, 0x0300), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH VARIA")
+UNICODE3_REC( 0x1F71	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FBB	, 0x0000	, 0x1FBB	, 0	, UNICODE3_S1(UNICODE3_exact, 0x03AC), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH OXIA")
+UNICODE3_REC( 0x1F72	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FC8	, 0x0000	, 0x1FC8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B5, 0x0300), ""	, ""	, "GREEK SMALL LETTER EPSILON WITH VARIA")
+UNICODE3_REC( 0x1F73	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FC9	, 0x0000	, 0x1FC9	, 0	, UNICODE3_S1(UNICODE3_exact, 0x03AD), ""	, ""	, "GREEK SMALL LETTER EPSILON WITH OXIA")
+UNICODE3_REC( 0x1F74	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FCA	, 0x0000	, 0x1FCA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B7, 0x0300), ""	, ""	, "GREEK SMALL LETTER ETA WITH VARIA")
+UNICODE3_REC( 0x1F75	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FCB	, 0x0000	, 0x1FCB	, 0	, UNICODE3_S1(UNICODE3_exact, 0x03AE), ""	, ""	, "GREEK SMALL LETTER ETA WITH OXIA")
+UNICODE3_REC( 0x1F76	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FDA	, 0x0000	, 0x1FDA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B9, 0x0300), ""	, ""	, "GREEK SMALL LETTER IOTA WITH VARIA")
+UNICODE3_REC( 0x1F77	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FDB	, 0x0000	, 0x1FDB	, 0	, UNICODE3_S1(UNICODE3_exact, 0x03AF), ""	, ""	, "GREEK SMALL LETTER IOTA WITH OXIA")
+UNICODE3_REC( 0x1F78	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FF8	, 0x0000	, 0x1FF8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03BF, 0x0300), ""	, ""	, "GREEK SMALL LETTER OMICRON WITH VARIA")
+UNICODE3_REC( 0x1F79	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FF9	, 0x0000	, 0x1FF9	, 0	, UNICODE3_S1(UNICODE3_exact, 0x03CC), ""	, ""	, "GREEK SMALL LETTER OMICRON WITH OXIA")
+UNICODE3_REC( 0x1F7A	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FEA	, 0x0000	, 0x1FEA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C5, 0x0300), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH VARIA")
+UNICODE3_REC( 0x1F7B	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FEB	, 0x0000	, 0x1FEB	, 0	, UNICODE3_S1(UNICODE3_exact, 0x03CD), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH OXIA")
+UNICODE3_REC( 0x1F7C	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FFA	, 0x0000	, 0x1FFA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C9, 0x0300), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH VARIA")
+UNICODE3_REC( 0x1F7D	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FFB	, 0x0000	, 0x1FFB	, 0	, UNICODE3_S1(UNICODE3_exact, 0x03CE), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH OXIA")
+UNICODE3_REC( 0x1F80	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F88	, 0x0000	, 0x1F88	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F00, 0x0345), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F81	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F89	, 0x0000	, 0x1F89	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F01, 0x0345), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F82	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F8A	, 0x0000	, 0x1F8A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F02, 0x0345), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F83	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F8B	, 0x0000	, 0x1F8B	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F03, 0x0345), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F84	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F8C	, 0x0000	, 0x1F8C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F04, 0x0345), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F85	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F8D	, 0x0000	, 0x1F8D	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F05, 0x0345), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F86	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F8E	, 0x0000	, 0x1F8E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F06, 0x0345), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F87	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F8F	, 0x0000	, 0x1F8F	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F07, 0x0345), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F88	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F80	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F08, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F89	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F81	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F09, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F8A	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F82	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F0A, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F8B	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F83	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F0B, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F8C	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F84	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F0C, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F8D	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F85	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F0D, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F8E	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F86	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F0E, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F8F	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F87	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F0F, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F90	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F98	, 0x0000	, 0x1F98	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F20, 0x0345), ""	, ""	, "GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F91	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F99	, 0x0000	, 0x1F99	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F21, 0x0345), ""	, ""	, "GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F92	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F9A	, 0x0000	, 0x1F9A	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F22, 0x0345), ""	, ""	, "GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F93	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F9B	, 0x0000	, 0x1F9B	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F23, 0x0345), ""	, ""	, "GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F94	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F9C	, 0x0000	, 0x1F9C	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F24, 0x0345), ""	, ""	, "GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F95	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F9D	, 0x0000	, 0x1F9D	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F25, 0x0345), ""	, ""	, "GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F96	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F9E	, 0x0000	, 0x1F9E	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F26, 0x0345), ""	, ""	, "GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F97	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1F9F	, 0x0000	, 0x1F9F	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F27, 0x0345), ""	, ""	, "GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1F98	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F90	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F28, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F99	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F91	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F29, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F9A	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F92	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F2A, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F9B	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F93	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F2B, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F9C	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F94	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F2C, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F9D	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F95	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F2D, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F9E	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F96	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F2E, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1F9F	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F97	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F2F, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FA0	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FA8	, 0x0000	, 0x1FA8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F60, 0x0345), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FA1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FA9	, 0x0000	, 0x1FA9	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F61, 0x0345), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FA2	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FAA	, 0x0000	, 0x1FAA	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F62, 0x0345), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FA3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FAB	, 0x0000	, 0x1FAB	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F63, 0x0345), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FA4	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FAC	, 0x0000	, 0x1FAC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F64, 0x0345), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FA5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FAD	, 0x0000	, 0x1FAD	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F65, 0x0345), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FA6	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FAE	, 0x0000	, 0x1FAE	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F66, 0x0345), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FA7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FAF	, 0x0000	, 0x1FAF	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F67, 0x0345), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FA8	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FA0	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F68, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FA9	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FA1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F69, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FAA	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FA2	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F6A, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FAB	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FA3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F6B, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FAC	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FA4	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F6C, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FAD	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FA5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F6D, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FAE	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FA6	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F6E, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FAF	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FA7	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F6F, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FB0	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FB8	, 0x0000	, 0x1FB8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B1, 0x0306), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH VRACHY")
+UNICODE3_REC( 0x1FB1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FB9	, 0x0000	, 0x1FB9	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B1, 0x0304), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH MACRON")
+UNICODE3_REC( 0x1FB2	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F70, 0x0345), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FB3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FBC	, 0x0000	, 0x1FBC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B1, 0x0345), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FB4	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03AC, 0x0345), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FB6	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B1, 0x0342), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH PERISPOMENI")
+UNICODE3_REC( 0x1FB7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1FB6, 0x0345), ""	, ""	, "GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FB8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FB0	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0391, 0x0306), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH VRACHY")
+UNICODE3_REC( 0x1FB9	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FB1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0391, 0x0304), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH MACRON")
+UNICODE3_REC( 0x1FBA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F70	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0391, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH VARIA")
+UNICODE3_REC( 0x1FBB	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F71	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x0386), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH OXIA")
+UNICODE3_REC( 0x1FBC	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FB3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0391, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FBE	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0399	, 0x0000	, 0x0399	, 0	, UNICODE3_S1(UNICODE3_exact, 0x03B9), ""	, ""	, "GREEK PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FC1	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00A8, 0x0342), ""	, ""	, "GREEK DIALYTIKA AND PERISPOMENI")
+UNICODE3_REC( 0x1FC2	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F74, 0x0345), ""	, ""	, "GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FC3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FCC	, 0x0000	, 0x1FCC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B7, 0x0345), ""	, ""	, "GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FC4	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03AE, 0x0345), ""	, ""	, "GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FC6	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B7, 0x0342), ""	, ""	, "GREEK SMALL LETTER ETA WITH PERISPOMENI")
+UNICODE3_REC( 0x1FC7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1FC6, 0x0345), ""	, ""	, "GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FC8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F72	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0395, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER EPSILON WITH VARIA")
+UNICODE3_REC( 0x1FC9	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F73	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x0388), ""	, ""	, "GREEK CAPITAL LETTER EPSILON WITH OXIA")
+UNICODE3_REC( 0x1FCA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F74	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0397, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH VARIA")
+UNICODE3_REC( 0x1FCB	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F75	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x0389), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH OXIA")
+UNICODE3_REC( 0x1FCC	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FC3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0397, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FCD	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1FBF, 0x0300), ""	, ""	, "GREEK PSILI AND VARIA")
+UNICODE3_REC( 0x1FCE	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1FBF, 0x0301), ""	, ""	, "GREEK PSILI AND OXIA")
+UNICODE3_REC( 0x1FCF	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1FBF, 0x0342), ""	, ""	, "GREEK PSILI AND PERISPOMENI")
+UNICODE3_REC( 0x1FD0	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FD8	, 0x0000	, 0x1FD8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B9, 0x0306), ""	, ""	, "GREEK SMALL LETTER IOTA WITH VRACHY")
+UNICODE3_REC( 0x1FD1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FD9	, 0x0000	, 0x1FD9	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B9, 0x0304), ""	, ""	, "GREEK SMALL LETTER IOTA WITH MACRON")
+UNICODE3_REC( 0x1FD2	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03CA, 0x0300), ""	, ""	, "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA")
+UNICODE3_REC( 0x1FD3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x0390), ""	, ""	, "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA")
+UNICODE3_REC( 0x1FD6	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03B9, 0x0342), ""	, ""	, "GREEK SMALL LETTER IOTA WITH PERISPOMENI")
+UNICODE3_REC( 0x1FD7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03CA, 0x0342), ""	, ""	, "GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI")
+UNICODE3_REC( 0x1FD8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FD0	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0399, 0x0306), ""	, ""	, "GREEK CAPITAL LETTER IOTA WITH VRACHY")
+UNICODE3_REC( 0x1FD9	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FD1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0399, 0x0304), ""	, ""	, "GREEK CAPITAL LETTER IOTA WITH MACRON")
+UNICODE3_REC( 0x1FDA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F76	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x0399, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER IOTA WITH VARIA")
+UNICODE3_REC( 0x1FDB	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F77	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x038A), ""	, ""	, "GREEK CAPITAL LETTER IOTA WITH OXIA")
+UNICODE3_REC( 0x1FDD	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1FFE, 0x0300), ""	, ""	, "GREEK DASIA AND VARIA")
+UNICODE3_REC( 0x1FDE	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1FFE, 0x0301), ""	, ""	, "GREEK DASIA AND OXIA")
+UNICODE3_REC( 0x1FDF	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1FFE, 0x0342), ""	, ""	, "GREEK DASIA AND PERISPOMENI")
+UNICODE3_REC( 0x1FE0	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FE8	, 0x0000	, 0x1FE8	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C5, 0x0306), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH VRACHY")
+UNICODE3_REC( 0x1FE1	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FE9	, 0x0000	, 0x1FE9	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C5, 0x0304), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH MACRON")
+UNICODE3_REC( 0x1FE2	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03CB, 0x0300), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA")
+UNICODE3_REC( 0x1FE3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x03B0), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA")
+UNICODE3_REC( 0x1FE4	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C1, 0x0313), ""	, ""	, "GREEK SMALL LETTER RHO WITH PSILI")
+UNICODE3_REC( 0x1FE5	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FEC	, 0x0000	, 0x1FEC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C1, 0x0314), ""	, ""	, "GREEK SMALL LETTER RHO WITH DASIA")
+UNICODE3_REC( 0x1FE6	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C5, 0x0342), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH PERISPOMENI")
+UNICODE3_REC( 0x1FE7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03CB, 0x0342), ""	, ""	, "GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI")
+UNICODE3_REC( 0x1FE8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FE0	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03A5, 0x0306), ""	, ""	, "GREEK CAPITAL LETTER UPSILON WITH VRACHY")
+UNICODE3_REC( 0x1FE9	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FE1	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03A5, 0x0304), ""	, ""	, "GREEK CAPITAL LETTER UPSILON WITH MACRON")
+UNICODE3_REC( 0x1FEA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F7A	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03A5, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER UPSILON WITH VARIA")
+UNICODE3_REC( 0x1FEB	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F7B	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x038E), ""	, ""	, "GREEK CAPITAL LETTER UPSILON WITH OXIA")
+UNICODE3_REC( 0x1FEC	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FE5	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03A1, 0x0314), ""	, ""	, "GREEK CAPITAL LETTER RHO WITH DASIA")
+UNICODE3_REC( 0x1FED	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x00A8, 0x0300), ""	, ""	, "GREEK DIALYTIKA AND VARIA")
+UNICODE3_REC( 0x1FEE	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x0385), ""	, ""	, "GREEK DIALYTIKA AND OXIA")
+UNICODE3_REC( 0x1FEF	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x0060), ""	, ""	, "GREEK VARIA")
+UNICODE3_REC( 0x1FF2	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1F7C, 0x0345), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FF3	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x1FFC	, 0x0000	, 0x1FFC	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C9, 0x0345), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FF4	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03CE, 0x0345), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FF6	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03C9, 0x0342), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH PERISPOMENI")
+UNICODE3_REC( 0x1FF7	, "Ll"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x1FF6, 0x0345), ""	, ""	, "GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI")
+UNICODE3_REC( 0x1FF8	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F78	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x039F, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER OMICRON WITH VARIA")
+UNICODE3_REC( 0x1FF9	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F79	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x038C), ""	, ""	, "GREEK CAPITAL LETTER OMICRON WITH OXIA")
+UNICODE3_REC( 0x1FFA	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F7C	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03A9, 0x0300), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH VARIA")
+UNICODE3_REC( 0x1FFB	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1F7D	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x038F), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH OXIA")
+UNICODE3_REC( 0x1FFC	, "Lt"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x1FF3	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x03A9, 0x0345), ""	, ""	, "GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI")
+UNICODE3_REC( 0x1FFD	, "Sk"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x00B4), ""	, ""	, "GREEK OXIA")
+UNICODE3_REC( 0x2000	, "Zs"	, 0	, "WS"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x2002), ""	, ""	, "EN QUAD")
+UNICODE3_REC( 0x2001	, "Zs"	, 0	, "WS"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x2003), ""	, ""	, "EM QUAD")
+UNICODE3_REC( 0x2126	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x03C9	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x03A9), ""	, "OHM"	, "OHM SIGN")
+UNICODE3_REC( 0x212A	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x006B	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x004B), ""	, "DEGREES KELVIN"	, "KELVIN SIGN")
+UNICODE3_REC( 0x212B	, "Lu"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x00E5	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x00C5), ""	, "ANGSTROM UNIT"	, "ANGSTROM SIGN")
+UNICODE3_REC( 0x219A	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x2190, 0x0338), ""	, "LEFT ARROW WITH STROKE"	, "LEFTWARDS ARROW WITH STROKE")
+UNICODE3_REC( 0x219B	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x2192, 0x0338), ""	, "RIGHT ARROW WITH STROKE"	, "RIGHTWARDS ARROW WITH STROKE")
+UNICODE3_REC( 0x21AE	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x2194, 0x0338), ""	, ""	, "LEFT RIGHT ARROW WITH STROKE")
+UNICODE3_REC( 0x21CD	, "So"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x21D0, 0x0338), ""	, "LEFT DOUBLE ARROW WITH STROKE"	, "LEFTWARDS DOUBLE ARROW WITH STROKE")
+UNICODE3_REC( 0x21CE	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x21D4, 0x0338), ""	, ""	, "LEFT RIGHT DOUBLE ARROW WITH STROKE")
+UNICODE3_REC( 0x21CF	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x21D2, 0x0338), ""	, "RIGHT DOUBLE ARROW WITH STROKE"	, "RIGHTWARDS DOUBLE ARROW WITH STROKE")
+UNICODE3_REC( 0x2204	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2203, 0x0338), ""	, ""	, "THERE DOES NOT EXIST")
+UNICODE3_REC( 0x2209	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2208, 0x0338), ""	, ""	, "NOT AN ELEMENT OF")
+UNICODE3_REC( 0x220C	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x220B, 0x0338), ""	, ""	, "DOES NOT CONTAIN AS MEMBER")
+UNICODE3_REC( 0x2224	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2223, 0x0338), ""	, ""	, "DOES NOT DIVIDE")
+UNICODE3_REC( 0x2226	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2225, 0x0338), ""	, ""	, "NOT PARALLEL TO")
+UNICODE3_REC( 0x2241	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x223C, 0x0338), ""	, ""	, "NOT TILDE")
+UNICODE3_REC( 0x2244	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2243, 0x0338), ""	, ""	, "NOT ASYMPTOTICALLY EQUAL TO")
+UNICODE3_REC( 0x2247	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2245, 0x0338), ""	, ""	, "NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO")
+UNICODE3_REC( 0x2249	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2248, 0x0338), ""	, ""	, "NOT ALMOST EQUAL TO")
+UNICODE3_REC( 0x2260	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x003D, 0x0338), ""	, ""	, "NOT EQUAL TO")
+UNICODE3_REC( 0x2262	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2261, 0x0338), ""	, ""	, "NOT IDENTICAL TO")
+UNICODE3_REC( 0x226D	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x224D, 0x0338), ""	, ""	, "NOT EQUIVALENT TO")
+UNICODE3_REC( 0x226E	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x003C, 0x0338), ""	, "NOT LESS THAN"	, "NOT LESS-THAN")
+UNICODE3_REC( 0x226F	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x003E, 0x0338), ""	, "NOT GREATER THAN"	, "NOT GREATER-THAN")
+UNICODE3_REC( 0x2270	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2264, 0x0338), ""	, "NEITHER LESS THAN NOR EQUAL TO"	, "NEITHER LESS-THAN NOR EQUAL TO")
+UNICODE3_REC( 0x2271	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2265, 0x0338), ""	, "NEITHER GREATER THAN NOR EQUAL TO"	, "NEITHER GREATER-THAN NOR EQUAL TO")
+UNICODE3_REC( 0x2274	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2272, 0x0338), ""	, "NEITHER LESS THAN NOR EQUIVALENT TO"	, "NEITHER LESS-THAN NOR EQUIVALENT TO")
+UNICODE3_REC( 0x2275	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2273, 0x0338), ""	, "NEITHER GREATER THAN NOR EQUIVALENT TO"	, "NEITHER GREATER-THAN NOR EQUIVALENT TO")
+UNICODE3_REC( 0x2278	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2276, 0x0338), ""	, "NEITHER LESS THAN NOR GREATER THAN"	, "NEITHER LESS-THAN NOR GREATER-THAN")
+UNICODE3_REC( 0x2279	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2277, 0x0338), ""	, "NEITHER GREATER THAN NOR LESS THAN"	, "NEITHER GREATER-THAN NOR LESS-THAN")
+UNICODE3_REC( 0x2280	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x227A, 0x0338), ""	, ""	, "DOES NOT PRECEDE")
+UNICODE3_REC( 0x2281	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x227B, 0x0338), ""	, ""	, "DOES NOT SUCCEED")
+UNICODE3_REC( 0x2284	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2282, 0x0338), ""	, ""	, "NOT A SUBSET OF")
+UNICODE3_REC( 0x2285	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2283, 0x0338), ""	, ""	, "NOT A SUPERSET OF")
+UNICODE3_REC( 0x2288	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2286, 0x0338), ""	, ""	, "NEITHER A SUBSET OF NOR EQUAL TO")
+UNICODE3_REC( 0x2289	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2287, 0x0338), ""	, ""	, "NEITHER A SUPERSET OF NOR EQUAL TO")
+UNICODE3_REC( 0x22AC	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x22A2, 0x0338), ""	, ""	, "DOES NOT PROVE")
+UNICODE3_REC( 0x22AD	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x22A8, 0x0338), ""	, ""	, "NOT TRUE")
+UNICODE3_REC( 0x22AE	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x22A9, 0x0338), ""	, ""	, "DOES NOT FORCE")
+UNICODE3_REC( 0x22AF	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x22AB, 0x0338), ""	, ""	, "NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE")
+UNICODE3_REC( 0x22E0	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x227C, 0x0338), ""	, ""	, "DOES NOT PRECEDE OR EQUAL")
+UNICODE3_REC( 0x22E1	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x227D, 0x0338), ""	, ""	, "DOES NOT SUCCEED OR EQUAL")
+UNICODE3_REC( 0x22E2	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2291, 0x0338), ""	, ""	, "NOT SQUARE IMAGE OF OR EQUAL TO")
+UNICODE3_REC( 0x22E3	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x2292, 0x0338), ""	, ""	, "NOT SQUARE ORIGINAL OF OR EQUAL TO")
+UNICODE3_REC( 0x22EA	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x22B2, 0x0338), ""	, ""	, "NOT NORMAL SUBGROUP OF")
+UNICODE3_REC( 0x22EB	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x22B3, 0x0338), ""	, ""	, "DOES NOT CONTAIN AS NORMAL SUBGROUP")
+UNICODE3_REC( 0x22EC	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x22B4, 0x0338), ""	, ""	, "NOT NORMAL SUBGROUP OF OR EQUAL TO")
+UNICODE3_REC( 0x22ED	, "Sm"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S2(UNICODE3_exact, 0x22B5, 0x0338), ""	, ""	, "DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL")
+UNICODE3_REC( 0x2329	, "Ps"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S1(UNICODE3_exact, 0x3008), ""	, "BRA"	, "LEFT-POINTING ANGLE BRACKET")
+UNICODE3_REC( 0x232A	, "Pe"	, 0	, "ON"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 1	, UNICODE3_S1(UNICODE3_exact, 0x3009), ""	, "KET"	, "RIGHT-POINTING ANGLE BRACKET")
+UNICODE3_REC( 0x304C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x304B, 0x3099), ""	, ""	, "HIRAGANA LETTER GA")
+UNICODE3_REC( 0x304E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x304D, 0x3099), ""	, ""	, "HIRAGANA LETTER GI")
+UNICODE3_REC( 0x3050	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x304F, 0x3099), ""	, ""	, "HIRAGANA LETTER GU")
+UNICODE3_REC( 0x3052	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3051, 0x3099), ""	, ""	, "HIRAGANA LETTER GE")
+UNICODE3_REC( 0x3054	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3053, 0x3099), ""	, ""	, "HIRAGANA LETTER GO")
+UNICODE3_REC( 0x3056	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3055, 0x3099), ""	, ""	, "HIRAGANA LETTER ZA")
+UNICODE3_REC( 0x3058	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3057, 0x3099), ""	, ""	, "HIRAGANA LETTER ZI")
+UNICODE3_REC( 0x305A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3059, 0x3099), ""	, ""	, "HIRAGANA LETTER ZU")
+UNICODE3_REC( 0x305C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x305B, 0x3099), ""	, ""	, "HIRAGANA LETTER ZE")
+UNICODE3_REC( 0x305E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x305D, 0x3099), ""	, ""	, "HIRAGANA LETTER ZO")
+UNICODE3_REC( 0x3060	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x305F, 0x3099), ""	, ""	, "HIRAGANA LETTER DA")
+UNICODE3_REC( 0x3062	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3061, 0x3099), ""	, ""	, "HIRAGANA LETTER DI")
+UNICODE3_REC( 0x3065	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3064, 0x3099), ""	, ""	, "HIRAGANA LETTER DU")
+UNICODE3_REC( 0x3067	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3066, 0x3099), ""	, ""	, "HIRAGANA LETTER DE")
+UNICODE3_REC( 0x3069	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3068, 0x3099), ""	, ""	, "HIRAGANA LETTER DO")
+UNICODE3_REC( 0x3070	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x306F, 0x3099), ""	, ""	, "HIRAGANA LETTER BA")
+UNICODE3_REC( 0x3071	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x306F, 0x309A), ""	, ""	, "HIRAGANA LETTER PA")
+UNICODE3_REC( 0x3073	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3072, 0x3099), ""	, ""	, "HIRAGANA LETTER BI")
+UNICODE3_REC( 0x3074	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3072, 0x309A), ""	, ""	, "HIRAGANA LETTER PI")
+UNICODE3_REC( 0x3076	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3075, 0x3099), ""	, ""	, "HIRAGANA LETTER BU")
+UNICODE3_REC( 0x3077	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3075, 0x309A), ""	, ""	, "HIRAGANA LETTER PU")
+UNICODE3_REC( 0x3079	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3078, 0x3099), ""	, ""	, "HIRAGANA LETTER BE")
+UNICODE3_REC( 0x307A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3078, 0x309A), ""	, ""	, "HIRAGANA LETTER PE")
+UNICODE3_REC( 0x307C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x307B, 0x3099), ""	, ""	, "HIRAGANA LETTER BO")
+UNICODE3_REC( 0x307D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x307B, 0x309A), ""	, ""	, "HIRAGANA LETTER PO")
+UNICODE3_REC( 0x3094	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x3046, 0x3099), ""	, ""	, "HIRAGANA LETTER VU")
+UNICODE3_REC( 0x309E	, "Lm"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x309D, 0x3099), ""	, ""	, "HIRAGANA VOICED ITERATION MARK")
+UNICODE3_REC( 0x30AC	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30AB, 0x3099), ""	, ""	, "KATAKANA LETTER GA")
+UNICODE3_REC( 0x30AE	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30AD, 0x3099), ""	, ""	, "KATAKANA LETTER GI")
+UNICODE3_REC( 0x30B0	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30AF, 0x3099), ""	, ""	, "KATAKANA LETTER GU")
+UNICODE3_REC( 0x30B2	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30B1, 0x3099), ""	, ""	, "KATAKANA LETTER GE")
+UNICODE3_REC( 0x30B4	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30B3, 0x3099), ""	, ""	, "KATAKANA LETTER GO")
+UNICODE3_REC( 0x30B6	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30B5, 0x3099), ""	, ""	, "KATAKANA LETTER ZA")
+UNICODE3_REC( 0x30B8	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30B7, 0x3099), ""	, ""	, "KATAKANA LETTER ZI")
+UNICODE3_REC( 0x30BA	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30B9, 0x3099), ""	, ""	, "KATAKANA LETTER ZU")
+UNICODE3_REC( 0x30BC	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30BB, 0x3099), ""	, ""	, "KATAKANA LETTER ZE")
+UNICODE3_REC( 0x30BE	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30BD, 0x3099), ""	, ""	, "KATAKANA LETTER ZO")
+UNICODE3_REC( 0x30C0	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30BF, 0x3099), ""	, ""	, "KATAKANA LETTER DA")
+UNICODE3_REC( 0x30C2	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30C1, 0x3099), ""	, ""	, "KATAKANA LETTER DI")
+UNICODE3_REC( 0x30C5	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30C4, 0x3099), ""	, ""	, "KATAKANA LETTER DU")
+UNICODE3_REC( 0x30C7	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30C6, 0x3099), ""	, ""	, "KATAKANA LETTER DE")
+UNICODE3_REC( 0x30C9	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30C8, 0x3099), ""	, ""	, "KATAKANA LETTER DO")
+UNICODE3_REC( 0x30D0	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30CF, 0x3099), ""	, ""	, "KATAKANA LETTER BA")
+UNICODE3_REC( 0x30D1	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30CF, 0x309A), ""	, ""	, "KATAKANA LETTER PA")
+UNICODE3_REC( 0x30D3	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30D2, 0x3099), ""	, ""	, "KATAKANA LETTER BI")
+UNICODE3_REC( 0x30D4	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30D2, 0x309A), ""	, ""	, "KATAKANA LETTER PI")
+UNICODE3_REC( 0x30D6	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30D5, 0x3099), ""	, ""	, "KATAKANA LETTER BU")
+UNICODE3_REC( 0x30D7	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30D5, 0x309A), ""	, ""	, "KATAKANA LETTER PU")
+UNICODE3_REC( 0x30D9	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30D8, 0x3099), ""	, ""	, "KATAKANA LETTER BE")
+UNICODE3_REC( 0x30DA	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30D8, 0x309A), ""	, ""	, "KATAKANA LETTER PE")
+UNICODE3_REC( 0x30DC	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30DB, 0x3099), ""	, ""	, "KATAKANA LETTER BO")
+UNICODE3_REC( 0x30DD	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30DB, 0x309A), ""	, ""	, "KATAKANA LETTER PO")
+UNICODE3_REC( 0x30F4	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30A6, 0x3099), ""	, ""	, "KATAKANA LETTER VU")
+UNICODE3_REC( 0x30F7	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30EF, 0x3099), ""	, ""	, "KATAKANA LETTER VA")
+UNICODE3_REC( 0x30F8	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30F0, 0x3099), ""	, ""	, "KATAKANA LETTER VI")
+UNICODE3_REC( 0x30F9	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30F1, 0x3099), ""	, ""	, "KATAKANA LETTER VE")
+UNICODE3_REC( 0x30FA	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30F2, 0x3099), ""	, ""	, "KATAKANA LETTER VO")
+UNICODE3_REC( 0x30FE	, "Lm"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x30FD, 0x3099), ""	, ""	, "KATAKANA VOICED ITERATION MARK")
+UNICODE3_REC( 0xF900	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8C48), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F900")
+UNICODE3_REC( 0xF901	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x66F4), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F901")
+UNICODE3_REC( 0xF902	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8ECA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F902")
+UNICODE3_REC( 0xF903	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8CC8), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F903")
+UNICODE3_REC( 0xF904	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6ED1), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F904")
+UNICODE3_REC( 0xF905	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x4E32), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F905")
+UNICODE3_REC( 0xF906	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x53E5), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F906")
+UNICODE3_REC( 0xF907	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9F9C), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F907")
+UNICODE3_REC( 0xF908	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9F9C), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F908")
+UNICODE3_REC( 0xF909	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5951), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F909")
+UNICODE3_REC( 0xF90A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x91D1), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F90A")
+UNICODE3_REC( 0xF90B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5587), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F90B")
+UNICODE3_REC( 0xF90C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5948), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F90C")
+UNICODE3_REC( 0xF90D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x61F6), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F90D")
+UNICODE3_REC( 0xF90E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7669), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F90E")
+UNICODE3_REC( 0xF90F	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7F85), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F90F")
+UNICODE3_REC( 0xF910	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x863F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F910")
+UNICODE3_REC( 0xF911	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x87BA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F911")
+UNICODE3_REC( 0xF912	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x88F8), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F912")
+UNICODE3_REC( 0xF913	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x908F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F913")
+UNICODE3_REC( 0xF914	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6A02), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F914")
+UNICODE3_REC( 0xF915	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6D1B), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F915")
+UNICODE3_REC( 0xF916	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x70D9), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F916")
+UNICODE3_REC( 0xF917	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x73DE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F917")
+UNICODE3_REC( 0xF918	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x843D), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F918")
+UNICODE3_REC( 0xF919	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x916A), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F919")
+UNICODE3_REC( 0xF91A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x99F1), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F91A")
+UNICODE3_REC( 0xF91B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x4E82), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F91B")
+UNICODE3_REC( 0xF91C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5375), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F91C")
+UNICODE3_REC( 0xF91D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6B04), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F91D")
+UNICODE3_REC( 0xF91E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x721B), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F91E")
+UNICODE3_REC( 0xF91F	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x862D), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F91F")
+UNICODE3_REC( 0xF920	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9E1E), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F920")
+UNICODE3_REC( 0xF921	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5D50), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F921")
+UNICODE3_REC( 0xF922	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6FEB), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F922")
+UNICODE3_REC( 0xF923	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x85CD), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F923")
+UNICODE3_REC( 0xF924	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8964), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F924")
+UNICODE3_REC( 0xF925	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x62C9), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F925")
+UNICODE3_REC( 0xF926	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x81D8), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F926")
+UNICODE3_REC( 0xF927	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x881F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F927")
+UNICODE3_REC( 0xF928	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5ECA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F928")
+UNICODE3_REC( 0xF929	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6717), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F929")
+UNICODE3_REC( 0xF92A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6D6A), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F92A")
+UNICODE3_REC( 0xF92B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x72FC), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F92B")
+UNICODE3_REC( 0xF92C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x90CE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F92C")
+UNICODE3_REC( 0xF92D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x4F86), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F92D")
+UNICODE3_REC( 0xF92E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x51B7), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F92E")
+UNICODE3_REC( 0xF92F	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x52DE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F92F")
+UNICODE3_REC( 0xF930	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x64C4), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F930")
+UNICODE3_REC( 0xF931	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6AD3), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F931")
+UNICODE3_REC( 0xF932	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7210), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F932")
+UNICODE3_REC( 0xF933	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x76E7), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F933")
+UNICODE3_REC( 0xF934	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8001), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F934")
+UNICODE3_REC( 0xF935	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8606), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F935")
+UNICODE3_REC( 0xF936	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x865C), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F936")
+UNICODE3_REC( 0xF937	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8DEF), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F937")
+UNICODE3_REC( 0xF938	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9732), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F938")
+UNICODE3_REC( 0xF939	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9B6F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F939")
+UNICODE3_REC( 0xF93A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9DFA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F93A")
+UNICODE3_REC( 0xF93B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x788C), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F93B")
+UNICODE3_REC( 0xF93C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x797F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F93C")
+UNICODE3_REC( 0xF93D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7DA0), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F93D")
+UNICODE3_REC( 0xF93E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x83C9), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F93E")
+UNICODE3_REC( 0xF93F	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9304), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F93F")
+UNICODE3_REC( 0xF940	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9E7F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F940")
+UNICODE3_REC( 0xF941	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8AD6), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F941")
+UNICODE3_REC( 0xF942	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x58DF), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F942")
+UNICODE3_REC( 0xF943	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5F04), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F943")
+UNICODE3_REC( 0xF944	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7C60), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F944")
+UNICODE3_REC( 0xF945	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x807E), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F945")
+UNICODE3_REC( 0xF946	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7262), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F946")
+UNICODE3_REC( 0xF947	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x78CA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F947")
+UNICODE3_REC( 0xF948	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8CC2), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F948")
+UNICODE3_REC( 0xF949	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x96F7), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F949")
+UNICODE3_REC( 0xF94A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x58D8), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F94A")
+UNICODE3_REC( 0xF94B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5C62), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F94B")
+UNICODE3_REC( 0xF94C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6A13), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F94C")
+UNICODE3_REC( 0xF94D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6DDA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F94D")
+UNICODE3_REC( 0xF94E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6F0F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F94E")
+UNICODE3_REC( 0xF94F	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7D2F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F94F")
+UNICODE3_REC( 0xF950	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7E37), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F950")
+UNICODE3_REC( 0xF951	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x96FB), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F951")
+UNICODE3_REC( 0xF952	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x52D2), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F952")
+UNICODE3_REC( 0xF953	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x808B), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F953")
+UNICODE3_REC( 0xF954	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x51DC), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F954")
+UNICODE3_REC( 0xF955	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x51CC), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F955")
+UNICODE3_REC( 0xF956	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7A1C), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F956")
+UNICODE3_REC( 0xF957	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7DBE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F957")
+UNICODE3_REC( 0xF958	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x83F1), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F958")
+UNICODE3_REC( 0xF959	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9675), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F959")
+UNICODE3_REC( 0xF95A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8B80), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F95A")
+UNICODE3_REC( 0xF95B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x62CF), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F95B")
+UNICODE3_REC( 0xF95C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6A02), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F95C")
+UNICODE3_REC( 0xF95D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8AFE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F95D")
+UNICODE3_REC( 0xF95E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x4E39), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F95E")
+UNICODE3_REC( 0xF95F	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5BE7), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F95F")
+UNICODE3_REC( 0xF960	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6012), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F960")
+UNICODE3_REC( 0xF961	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7387), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F961")
+UNICODE3_REC( 0xF962	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7570), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F962")
+UNICODE3_REC( 0xF963	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5317), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F963")
+UNICODE3_REC( 0xF964	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x78FB), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F964")
+UNICODE3_REC( 0xF965	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x4FBF), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F965")
+UNICODE3_REC( 0xF966	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5FA9), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F966")
+UNICODE3_REC( 0xF967	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x4E0D), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F967")
+UNICODE3_REC( 0xF968	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6CCC), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F968")
+UNICODE3_REC( 0xF969	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6578), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F969")
+UNICODE3_REC( 0xF96A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7D22), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F96A")
+UNICODE3_REC( 0xF96B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x53C3), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F96B")
+UNICODE3_REC( 0xF96C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x585E), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F96C")
+UNICODE3_REC( 0xF96D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7701), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F96D")
+UNICODE3_REC( 0xF96E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8449), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F96E")
+UNICODE3_REC( 0xF96F	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8AAA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F96F")
+UNICODE3_REC( 0xF970	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6BBA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F970")
+UNICODE3_REC( 0xF971	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8FB0), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F971")
+UNICODE3_REC( 0xF972	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6C88), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F972")
+UNICODE3_REC( 0xF973	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x62FE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F973")
+UNICODE3_REC( 0xF974	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x82E5), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F974")
+UNICODE3_REC( 0xF975	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x63A0), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F975")
+UNICODE3_REC( 0xF976	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7565), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F976")
+UNICODE3_REC( 0xF977	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x4EAE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F977")
+UNICODE3_REC( 0xF978	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5169), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F978")
+UNICODE3_REC( 0xF979	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x51C9), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F979")
+UNICODE3_REC( 0xF97A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6881), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F97A")
+UNICODE3_REC( 0xF97B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7CE7), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F97B")
+UNICODE3_REC( 0xF97C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x826F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F97C")
+UNICODE3_REC( 0xF97D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8AD2), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F97D")
+UNICODE3_REC( 0xF97E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x91CF), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F97E")
+UNICODE3_REC( 0xF97F	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x52F5), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F97F")
+UNICODE3_REC( 0xF980	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5442), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F980")
+UNICODE3_REC( 0xF981	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5973), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F981")
+UNICODE3_REC( 0xF982	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5EEC), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F982")
+UNICODE3_REC( 0xF983	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x65C5), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F983")
+UNICODE3_REC( 0xF984	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6FFE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F984")
+UNICODE3_REC( 0xF985	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x792A), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F985")
+UNICODE3_REC( 0xF986	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x95AD), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F986")
+UNICODE3_REC( 0xF987	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9A6A), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F987")
+UNICODE3_REC( 0xF988	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9E97), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F988")
+UNICODE3_REC( 0xF989	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9ECE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F989")
+UNICODE3_REC( 0xF98A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x529B), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F98A")
+UNICODE3_REC( 0xF98B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x66C6), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F98B")
+UNICODE3_REC( 0xF98C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6B77), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F98C")
+UNICODE3_REC( 0xF98D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8F62), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F98D")
+UNICODE3_REC( 0xF98E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5E74), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F98E")
+UNICODE3_REC( 0xF98F	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6190), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F98F")
+UNICODE3_REC( 0xF990	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6200), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F990")
+UNICODE3_REC( 0xF991	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x649A), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F991")
+UNICODE3_REC( 0xF992	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6F23), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F992")
+UNICODE3_REC( 0xF993	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7149), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F993")
+UNICODE3_REC( 0xF994	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7489), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F994")
+UNICODE3_REC( 0xF995	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x79CA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F995")
+UNICODE3_REC( 0xF996	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7DF4), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F996")
+UNICODE3_REC( 0xF997	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x806F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F997")
+UNICODE3_REC( 0xF998	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8F26), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F998")
+UNICODE3_REC( 0xF999	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x84EE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F999")
+UNICODE3_REC( 0xF99A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9023), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F99A")
+UNICODE3_REC( 0xF99B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x934A), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F99B")
+UNICODE3_REC( 0xF99C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5217), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F99C")
+UNICODE3_REC( 0xF99D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x52A3), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F99D")
+UNICODE3_REC( 0xF99E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x54BD), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F99E")
+UNICODE3_REC( 0xF99F	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x70C8), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F99F")
+UNICODE3_REC( 0xF9A0	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x88C2), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9A0")
+UNICODE3_REC( 0xF9A1	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8AAA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9A1")
+UNICODE3_REC( 0xF9A2	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5EC9), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9A2")
+UNICODE3_REC( 0xF9A3	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5FF5), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9A3")
+UNICODE3_REC( 0xF9A4	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x637B), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9A4")
+UNICODE3_REC( 0xF9A5	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6BAE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9A5")
+UNICODE3_REC( 0xF9A6	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7C3E), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9A6")
+UNICODE3_REC( 0xF9A7	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7375), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9A7")
+UNICODE3_REC( 0xF9A8	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x4EE4), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9A8")
+UNICODE3_REC( 0xF9A9	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x56F9), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9A9")
+UNICODE3_REC( 0xF9AA	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5BE7), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9AA")
+UNICODE3_REC( 0xF9AB	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5DBA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9AB")
+UNICODE3_REC( 0xF9AC	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x601C), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9AC")
+UNICODE3_REC( 0xF9AD	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x73B2), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9AD")
+UNICODE3_REC( 0xF9AE	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7469), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9AE")
+UNICODE3_REC( 0xF9AF	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7F9A), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9AF")
+UNICODE3_REC( 0xF9B0	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8046), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9B0")
+UNICODE3_REC( 0xF9B1	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9234), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9B1")
+UNICODE3_REC( 0xF9B2	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x96F6), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9B2")
+UNICODE3_REC( 0xF9B3	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9748), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9B3")
+UNICODE3_REC( 0xF9B4	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9818), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9B4")
+UNICODE3_REC( 0xF9B5	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x4F8B), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9B5")
+UNICODE3_REC( 0xF9B6	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x79AE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9B6")
+UNICODE3_REC( 0xF9B7	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x91B4), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9B7")
+UNICODE3_REC( 0xF9B8	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x96B8), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9B8")
+UNICODE3_REC( 0xF9B9	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x60E1), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9B9")
+UNICODE3_REC( 0xF9BA	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x4E86), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9BA")
+UNICODE3_REC( 0xF9BB	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x50DA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9BB")
+UNICODE3_REC( 0xF9BC	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5BEE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9BC")
+UNICODE3_REC( 0xF9BD	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5C3F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9BD")
+UNICODE3_REC( 0xF9BE	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6599), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9BE")
+UNICODE3_REC( 0xF9BF	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6A02), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9BF")
+UNICODE3_REC( 0xF9C0	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x71CE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9C0")
+UNICODE3_REC( 0xF9C1	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7642), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9C1")
+UNICODE3_REC( 0xF9C2	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x84FC), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9C2")
+UNICODE3_REC( 0xF9C3	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x907C), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9C3")
+UNICODE3_REC( 0xF9C4	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9F8D), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9C4")
+UNICODE3_REC( 0xF9C5	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6688), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9C5")
+UNICODE3_REC( 0xF9C6	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x962E), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9C6")
+UNICODE3_REC( 0xF9C7	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5289), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9C7")
+UNICODE3_REC( 0xF9C8	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x677B), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9C8")
+UNICODE3_REC( 0xF9C9	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x67F3), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9C9")
+UNICODE3_REC( 0xF9CA	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6D41), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9CA")
+UNICODE3_REC( 0xF9CB	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6E9C), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9CB")
+UNICODE3_REC( 0xF9CC	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7409), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9CC")
+UNICODE3_REC( 0xF9CD	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7559), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9CD")
+UNICODE3_REC( 0xF9CE	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x786B), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9CE")
+UNICODE3_REC( 0xF9CF	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7D10), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9CF")
+UNICODE3_REC( 0xF9D0	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x985E), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9D0")
+UNICODE3_REC( 0xF9D1	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x516D), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9D1")
+UNICODE3_REC( 0xF9D2	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x622E), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9D2")
+UNICODE3_REC( 0xF9D3	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9678), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9D3")
+UNICODE3_REC( 0xF9D4	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x502B), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9D4")
+UNICODE3_REC( 0xF9D5	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5D19), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9D5")
+UNICODE3_REC( 0xF9D6	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6DEA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9D6")
+UNICODE3_REC( 0xF9D7	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8F2A), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9D7")
+UNICODE3_REC( 0xF9D8	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5F8B), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9D8")
+UNICODE3_REC( 0xF9D9	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6144), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9D9")
+UNICODE3_REC( 0xF9DA	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6817), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9DA")
+UNICODE3_REC( 0xF9DB	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7387), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9DB")
+UNICODE3_REC( 0xF9DC	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9686), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9DC")
+UNICODE3_REC( 0xF9DD	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5229), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9DD")
+UNICODE3_REC( 0xF9DE	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x540F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9DE")
+UNICODE3_REC( 0xF9DF	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5C65), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9DF")
+UNICODE3_REC( 0xF9E0	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6613), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9E0")
+UNICODE3_REC( 0xF9E1	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x674E), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9E1")
+UNICODE3_REC( 0xF9E2	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x68A8), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9E2")
+UNICODE3_REC( 0xF9E3	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6CE5), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9E3")
+UNICODE3_REC( 0xF9E4	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7406), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9E4")
+UNICODE3_REC( 0xF9E5	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x75E2), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9E5")
+UNICODE3_REC( 0xF9E6	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7F79), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9E6")
+UNICODE3_REC( 0xF9E7	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x88CF), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9E7")
+UNICODE3_REC( 0xF9E8	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x88E1), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9E8")
+UNICODE3_REC( 0xF9E9	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x91CC), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9E9")
+UNICODE3_REC( 0xF9EA	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x96E2), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9EA")
+UNICODE3_REC( 0xF9EB	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x533F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9EB")
+UNICODE3_REC( 0xF9EC	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6EBA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9EC")
+UNICODE3_REC( 0xF9ED	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x541D), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9ED")
+UNICODE3_REC( 0xF9EE	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x71D0), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9EE")
+UNICODE3_REC( 0xF9EF	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7498), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9EF")
+UNICODE3_REC( 0xF9F0	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x85FA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9F0")
+UNICODE3_REC( 0xF9F1	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x96A3), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9F1")
+UNICODE3_REC( 0xF9F2	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9C57), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9F2")
+UNICODE3_REC( 0xF9F3	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9E9F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9F3")
+UNICODE3_REC( 0xF9F4	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6797), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9F4")
+UNICODE3_REC( 0xF9F5	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6DCB), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9F5")
+UNICODE3_REC( 0xF9F6	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x81E8), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9F6")
+UNICODE3_REC( 0xF9F7	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7ACB), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9F7")
+UNICODE3_REC( 0xF9F8	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7B20), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9F8")
+UNICODE3_REC( 0xF9F9	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7C92), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9F9")
+UNICODE3_REC( 0xF9FA	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x72C0), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9FA")
+UNICODE3_REC( 0xF9FB	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7099), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9FB")
+UNICODE3_REC( 0xF9FC	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8B58), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9FC")
+UNICODE3_REC( 0xF9FD	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x4EC0), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9FD")
+UNICODE3_REC( 0xF9FE	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8336), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9FE")
+UNICODE3_REC( 0xF9FF	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x523A), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-F9FF")
+UNICODE3_REC( 0xFA00	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5207), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA00")
+UNICODE3_REC( 0xFA01	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5EA6), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA01")
+UNICODE3_REC( 0xFA02	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x62D3), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA02")
+UNICODE3_REC( 0xFA03	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7CD6), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA03")
+UNICODE3_REC( 0xFA04	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5B85), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA04")
+UNICODE3_REC( 0xFA05	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6D1E), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA05")
+UNICODE3_REC( 0xFA06	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x66B4), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA06")
+UNICODE3_REC( 0xFA07	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8F3B), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA07")
+UNICODE3_REC( 0xFA08	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x884C), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA08")
+UNICODE3_REC( 0xFA09	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x964D), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA09")
+UNICODE3_REC( 0xFA0A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x898B), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA0A")
+UNICODE3_REC( 0xFA0B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5ED3), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA0B")
+UNICODE3_REC( 0xFA0C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x5140), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA0C")
+UNICODE3_REC( 0xFA0D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x55C0), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA0D")
+UNICODE3_REC( 0xFA10	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x585A), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA10")
+UNICODE3_REC( 0xFA12	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x6674), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA12")
+UNICODE3_REC( 0xFA15	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x51DE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA15")
+UNICODE3_REC( 0xFA16	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x732A), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA16")
+UNICODE3_REC( 0xFA17	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x76CA), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA17")
+UNICODE3_REC( 0xFA18	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x793C), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA18")
+UNICODE3_REC( 0xFA19	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x795E), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA19")
+UNICODE3_REC( 0xFA1A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7965), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA1A")
+UNICODE3_REC( 0xFA1B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x798F), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA1B")
+UNICODE3_REC( 0xFA1C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9756), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA1C")
+UNICODE3_REC( 0xFA1D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7CBE), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA1D")
+UNICODE3_REC( 0xFA1E	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x7FBD), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA1E")
+UNICODE3_REC( 0xFA20	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8612), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA20")
+UNICODE3_REC( 0xFA22	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x8AF8), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA22")
+UNICODE3_REC( 0xFA25	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9038), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA25")
+UNICODE3_REC( 0xFA26	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x90FD), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA26")
+UNICODE3_REC( 0xFA2A	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x98EF), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA2A")
+UNICODE3_REC( 0xFA2B	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x98FC), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA2B")
+UNICODE3_REC( 0xFA2C	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9928), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA2C")
+UNICODE3_REC( 0xFA2D	, "Lo"	, 0	, "L"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S1(UNICODE3_exact, 0x9DB4), ""	, ""	, "CJK COMPATIBILITY IDEOGRAPH-FA2D")
+UNICODE3_REC( 0xFB1D	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D9, 0x05B4), ""	, ""	, "HEBREW LETTER YOD WITH HIRIQ")
+UNICODE3_REC( 0xFB1F	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05F2, 0x05B7), ""	, ""	, "HEBREW LIGATURE YIDDISH YOD YOD PATAH")
+UNICODE3_REC( 0xFB2A	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05E9, 0x05C1), ""	, ""	, "HEBREW LETTER SHIN WITH SHIN DOT")
+UNICODE3_REC( 0xFB2B	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05E9, 0x05C2), ""	, ""	, "HEBREW LETTER SHIN WITH SIN DOT")
+UNICODE3_REC( 0xFB2C	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0xFB49, 0x05C1), ""	, ""	, "HEBREW LETTER SHIN WITH DAGESH AND SHIN DOT")
+UNICODE3_REC( 0xFB2D	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0xFB49, 0x05C2), ""	, ""	, "HEBREW LETTER SHIN WITH DAGESH AND SIN DOT")
+UNICODE3_REC( 0xFB2E	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D0, 0x05B7), ""	, ""	, "HEBREW LETTER ALEF WITH PATAH")
+UNICODE3_REC( 0xFB2F	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D0, 0x05B8), ""	, ""	, "HEBREW LETTER ALEF WITH QAMATS")
+UNICODE3_REC( 0xFB30	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D0, 0x05BC), ""	, ""	, "HEBREW LETTER ALEF WITH MAPIQ")
+UNICODE3_REC( 0xFB31	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D1, 0x05BC), ""	, ""	, "HEBREW LETTER BET WITH DAGESH")
+UNICODE3_REC( 0xFB32	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D2, 0x05BC), ""	, ""	, "HEBREW LETTER GIMEL WITH DAGESH")
+UNICODE3_REC( 0xFB33	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D3, 0x05BC), ""	, ""	, "HEBREW LETTER DALET WITH DAGESH")
+UNICODE3_REC( 0xFB34	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D4, 0x05BC), ""	, ""	, "HEBREW LETTER HE WITH MAPIQ")
+UNICODE3_REC( 0xFB35	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D5, 0x05BC), ""	, ""	, "HEBREW LETTER VAV WITH DAGESH")
+UNICODE3_REC( 0xFB36	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D6, 0x05BC), ""	, ""	, "HEBREW LETTER ZAYIN WITH DAGESH")
+UNICODE3_REC( 0xFB38	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D8, 0x05BC), ""	, ""	, "HEBREW LETTER TET WITH DAGESH")
+UNICODE3_REC( 0xFB39	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D9, 0x05BC), ""	, ""	, "HEBREW LETTER YOD WITH DAGESH")
+UNICODE3_REC( 0xFB3A	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05DA, 0x05BC), ""	, ""	, "HEBREW LETTER FINAL KAF WITH DAGESH")
+UNICODE3_REC( 0xFB3B	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05DB, 0x05BC), ""	, ""	, "HEBREW LETTER KAF WITH DAGESH")
+UNICODE3_REC( 0xFB3C	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05DC, 0x05BC), ""	, ""	, "HEBREW LETTER LAMED WITH DAGESH")
+UNICODE3_REC( 0xFB3E	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05DE, 0x05BC), ""	, ""	, "HEBREW LETTER MEM WITH DAGESH")
+UNICODE3_REC( 0xFB40	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05E0, 0x05BC), ""	, ""	, "HEBREW LETTER NUN WITH DAGESH")
+UNICODE3_REC( 0xFB41	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05E1, 0x05BC), ""	, ""	, "HEBREW LETTER SAMEKH WITH DAGESH")
+UNICODE3_REC( 0xFB43	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05E3, 0x05BC), ""	, ""	, "HEBREW LETTER FINAL PE WITH DAGESH")
+UNICODE3_REC( 0xFB44	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05E4, 0x05BC), ""	, ""	, "HEBREW LETTER PE WITH DAGESH")
+UNICODE3_REC( 0xFB46	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05E6, 0x05BC), ""	, ""	, "HEBREW LETTER TSADI WITH DAGESH")
+UNICODE3_REC( 0xFB47	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05E7, 0x05BC), ""	, ""	, "HEBREW LETTER QOF WITH DAGESH")
+UNICODE3_REC( 0xFB48	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05E8, 0x05BC), ""	, ""	, "HEBREW LETTER RESH WITH DAGESH")
+UNICODE3_REC( 0xFB49	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05E9, 0x05BC), ""	, ""	, "HEBREW LETTER SHIN WITH DAGESH")
+UNICODE3_REC( 0xFB4A	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05EA, 0x05BC), ""	, ""	, "HEBREW LETTER TAV WITH DAGESH")
+UNICODE3_REC( 0xFB4B	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D5, 0x05B9), ""	, ""	, "HEBREW LETTER VAV WITH HOLAM")
+UNICODE3_REC( 0xFB4C	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05D1, 0x05BF), ""	, ""	, "HEBREW LETTER BET WITH RAFE")
+UNICODE3_REC( 0xFB4D	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05DB, 0x05BF), ""	, ""	, "HEBREW LETTER KAF WITH RAFE")
+UNICODE3_REC( 0xFB4E	, "Lo"	, 0	, "R"	, -1	, -1	, -1.0   	, 0x0000	, 0x0000	, 0x0000	, 0	, UNICODE3_S2(UNICODE3_exact, 0x05E4, 0x05BF), ""	, ""	, "HEBREW LETTER PE WITH RAFE")
+UNICODE3_FOOTER
diff --git a/libsrc/langfunc/unicodetab2h.sh b/libsrc/langfunc/unicodetab2h.sh
index d1552e6..8ac453a 100755
--- a/libsrc/langfunc/unicodetab2h.sh
+++ b/libsrc/langfunc/unicodetab2h.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #  
-#  $Id: unicodetab2h.sh,v 1.3 2009/04/14 12:16:49 source Exp $
+#  $Id: unicodetab2h.sh,v 1.3.2.1 2011/01/18 14:36:37 source Exp $
 #
 #  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 #  project.
@@ -108,9 +108,13 @@ echo " 100% done."
 echo -n "Search for 'logical space' characters...	"
 grep ";0;WS;" < unicode3.dat > tmp/tmp3.c
 echo " 100% done."
+echo -n "Search for modified/compatible characters...	"
+grep -E "^[^;]*;[^;]*;[^;]*;[^;]*;[^;]*;[0-9A-F][0-9A-F][0-9A-F][0-9A-F](( [0-9A-F][0-9A-F][0-9A-F][0-9A-F])?);" < unicode3.dat > tmp/tmp4.c
+echo " 100% done."
 tabtoheader tmp/tmp1.c unicode3_lowers.h
 tabtoheader tmp/tmp2.c unicode3_uppers.h
 tabtoheader tmp/tmp3.c unicode3_spaces.h
+tabtoheader tmp/tmp4.c unicode3_basechars.h
 tabtoheader unicode3.dat unicode3_all_chars.h
 
 rm -rf tmp
diff --git a/libsrc/odbcsdk/Makefile.in b/libsrc/odbcsdk/Makefile.in
index 99d9a93..cd159cc 100644
--- a/libsrc/odbcsdk/Makefile.in
+++ b/libsrc/odbcsdk/Makefile.in
@@ -160,6 +160,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/plugin/Makefile.in b/libsrc/plugin/Makefile.in
index 0ad486a..9390652 100644
--- a/libsrc/plugin/Makefile.in
+++ b/libsrc/plugin/Makefile.in
@@ -205,6 +205,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/plugin/export_gate_virtuoso.c b/libsrc/plugin/export_gate_virtuoso.c
index 72cfd15..27b3974 100644
--- a/libsrc/plugin/export_gate_virtuoso.c
+++ b/libsrc/plugin/export_gate_virtuoso.c
@@ -87,6 +87,7 @@ _gate_export_item_t _gate_export_data[] = {
   { &bif_arg, "bif_arg" },
   { &bif_arg_unrdf, "bif_arg_unrdf" },
   { &bif_array_arg, "bif_array_arg" },
+  { &bif_array_of_pointer_arg, "bif_array_of_pointer_arg" },
   { &bif_array_or_null_arg, "bif_array_or_null_arg" },
   { &bif_bin_arg, "bif_bin_arg" },
   { &bif_date_arg, "bif_date_arg" },
@@ -243,6 +244,7 @@ _gate_export_item_t _gate_export_data[] = {
   { &id_hash_set_with_hash_number, "id_hash_set_with_hash_number" },
   { &lh_get_handler, "lh_get_handler" },
   { &lh_load_handler, "lh_load_handler" },
+  { &list_to_array, "list_to_array" },
   { &lt_start, "lt_start" },
   { &md5, "md5" },
   { &mq_add_message, "mq_add_message" },
@@ -253,6 +255,7 @@ _gate_export_item_t _gate_export_data[] = {
   { &mutex_leave, "mutex_leave" },
   { &registry_get, "registry_get" },
   { &registry_get_all, "registry_get_all" },
+  { &sec_check_dba, "sec_check_dba" },
   { &semaphore_allocate, "semaphore_allocate" },
   { &server_logmsg_ap, "server_logmsg_ap" },
   { &service_read, "service_read" },
@@ -277,6 +280,7 @@ _gate_export_item_t _gate_export_data[] = {
   { &sqlr_error, "sqlr_error" },
   { &sqlr_new_error, "sqlr_new_error" },
   { &sqlr_resignal, "sqlr_resignal" },
+  { &srv_make_new_error, "srv_make_new_error" },
   { &strhash, "strhash" },
   { &strhashcmp, "strhashcmp" },
   { &strses_allocate, "strses_allocate" },
diff --git a/libsrc/plugin/import_gate_virtuoso.c b/libsrc/plugin/import_gate_virtuoso.c
index 9c21582..dfeb50a 100644
--- a/libsrc/plugin/import_gate_virtuoso.c
+++ b/libsrc/plugin/import_gate_virtuoso.c
@@ -7,6 +7,7 @@ struct _gate_s _gate = {
   { NULL, "bif_arg" },
   { NULL, "bif_arg_unrdf" },
   { NULL, "bif_array_arg" },
+  { NULL, "bif_array_of_pointer_arg" },
   { NULL, "bif_array_or_null_arg" },
   { NULL, "bif_bin_arg" },
   { NULL, "bif_date_arg" },
@@ -163,6 +164,7 @@ struct _gate_s _gate = {
   { NULL, "id_hash_set_with_hash_number" },
   { NULL, "lh_get_handler" },
   { NULL, "lh_load_handler" },
+  { NULL, "list_to_array" },
   { NULL, "lt_start" },
   { NULL, "md5" },
   { NULL, "mq_add_message" },
@@ -173,6 +175,7 @@ struct _gate_s _gate = {
   { NULL, "mutex_leave" },
   { NULL, "registry_get" },
   { NULL, "registry_get_all" },
+  { NULL, "sec_check_dba" },
   { NULL, "semaphore_allocate" },
   { NULL, "server_logmsg_ap" },
   { NULL, "service_read" },
@@ -197,6 +200,7 @@ struct _gate_s _gate = {
   { NULL, "sqlr_error" },
   { NULL, "sqlr_new_error" },
   { NULL, "sqlr_resignal" },
+  { NULL, "srv_make_new_error" },
   { NULL, "strhash" },
   { NULL, "strhashcmp" },
   { NULL, "strses_allocate" },
diff --git a/libsrc/plugin/import_gate_virtuoso.h b/libsrc/plugin/import_gate_virtuoso.h
index 0d20922..6b40b60 100644
--- a/libsrc/plugin/import_gate_virtuoso.h
+++ b/libsrc/plugin/import_gate_virtuoso.h
@@ -59,6 +59,7 @@ struct _gate_s {
   struct { typeof__bif_arg *_ptr; const char *_name; } _bif_arg;
   struct { typeof__bif_arg_unrdf *_ptr; const char *_name; } _bif_arg_unrdf;
   struct { typeof__bif_array_arg *_ptr; const char *_name; } _bif_array_arg;
+  struct { typeof__bif_array_of_pointer_arg *_ptr; const char *_name; } _bif_array_of_pointer_arg;
   struct { typeof__bif_array_or_null_arg *_ptr; const char *_name; } _bif_array_or_null_arg;
   struct { typeof__bif_bin_arg *_ptr; const char *_name; } _bif_bin_arg;
   struct { typeof__bif_date_arg *_ptr; const char *_name; } _bif_date_arg;
@@ -215,6 +216,7 @@ struct _gate_s {
   struct { typeof__id_hash_set_with_hash_number *_ptr; const char *_name; } _id_hash_set_with_hash_number;
   struct { typeof__lh_get_handler *_ptr; const char *_name; } _lh_get_handler;
   struct { typeof__lh_load_handler *_ptr; const char *_name; } _lh_load_handler;
+  struct { typeof__list_to_array *_ptr; const char *_name; } _list_to_array;
   struct { typeof__lt_start *_ptr; const char *_name; } _lt_start;
   struct { typeof__md5 *_ptr; const char *_name; } _md5;
   struct { typeof__mq_add_message *_ptr; const char *_name; } _mq_add_message;
@@ -225,6 +227,7 @@ struct _gate_s {
   struct { typeof__mutex_leave *_ptr; const char *_name; } _mutex_leave;
   struct { typeof__registry_get *_ptr; const char *_name; } _registry_get;
   struct { typeof__registry_get_all *_ptr; const char *_name; } _registry_get_all;
+  struct { typeof__sec_check_dba *_ptr; const char *_name; } _sec_check_dba;
   struct { typeof__semaphore_allocate *_ptr; const char *_name; } _semaphore_allocate;
   struct { typeof__server_logmsg_ap *_ptr; const char *_name; } _server_logmsg_ap;
   struct { typeof__service_read *_ptr; const char *_name; } _service_read;
@@ -249,6 +252,7 @@ struct _gate_s {
   struct { typeof__sqlr_error *_ptr; const char *_name; } _sqlr_error;
   struct { typeof__sqlr_new_error *_ptr; const char *_name; } _sqlr_new_error;
   struct { typeof__sqlr_resignal *_ptr; const char *_name; } _sqlr_resignal;
+  struct { typeof__srv_make_new_error *_ptr; const char *_name; } _srv_make_new_error;
   struct { typeof__strhash *_ptr; const char *_name; } _strhash;
   struct { typeof__strhashcmp *_ptr; const char *_name; } _strhashcmp;
   struct { typeof__strses_allocate *_ptr; const char *_name; } _strses_allocate;
@@ -289,6 +293,7 @@ extern struct _gate_s _gate;
 #define bif_arg (_gate._bif_arg._ptr)
 #define bif_arg_unrdf (_gate._bif_arg_unrdf._ptr)
 #define bif_array_arg (_gate._bif_array_arg._ptr)
+#define bif_array_of_pointer_arg (_gate._bif_array_of_pointer_arg._ptr)
 #define bif_array_or_null_arg (_gate._bif_array_or_null_arg._ptr)
 #define bif_bin_arg (_gate._bif_bin_arg._ptr)
 #define bif_date_arg (_gate._bif_date_arg._ptr)
@@ -445,6 +450,7 @@ extern struct _gate_s _gate;
 #define id_hash_set_with_hash_number (_gate._id_hash_set_with_hash_number._ptr)
 #define lh_get_handler (_gate._lh_get_handler._ptr)
 #define lh_load_handler (_gate._lh_load_handler._ptr)
+#define list_to_array (_gate._list_to_array._ptr)
 #define lt_start (_gate._lt_start._ptr)
 #define md5 (_gate._md5._ptr)
 #define mq_add_message (_gate._mq_add_message._ptr)
@@ -455,6 +461,7 @@ extern struct _gate_s _gate;
 #define mutex_leave (_gate._mutex_leave._ptr)
 #define registry_get (_gate._registry_get._ptr)
 #define registry_get_all (_gate._registry_get_all._ptr)
+#define sec_check_dba (_gate._sec_check_dba._ptr)
 #define semaphore_allocate (_gate._semaphore_allocate._ptr)
 #define server_logmsg_ap (_gate._server_logmsg_ap._ptr)
 #define service_read (_gate._service_read._ptr)
@@ -479,6 +486,7 @@ extern struct _gate_s _gate;
 #define sqlr_error (_gate._sqlr_error._ptr)
 #define sqlr_new_error (_gate._sqlr_new_error._ptr)
 #define sqlr_resignal (_gate._sqlr_resignal._ptr)
+#define srv_make_new_error (_gate._srv_make_new_error._ptr)
 #define strhash (_gate._strhash._ptr)
 #define strhashcmp (_gate._strhashcmp._ptr)
 #define strses_allocate (_gate._strses_allocate._ptr)
diff --git a/libsrc/util/Makefile.in b/libsrc/util/Makefile.in
index a85e7fa..eb93fd1 100644
--- a/libsrc/util/Makefile.in
+++ b/libsrc/util/Makefile.in
@@ -217,6 +217,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/libsrc/util/getdate.c b/libsrc/util/getdate.c
index 729fd76..1bb359e 100644
--- a/libsrc/util/getdate.c
+++ b/libsrc/util/getdate.c
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
 
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1.  */
 
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+   
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
+   
+   This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+   
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-
+   
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -29,7 +28,7 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-
+   
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
@@ -47,7 +46,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.1"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -55,57 +54,20 @@
 /* Pure parsers.  */
 #define YYPURE 1
 
-/* Using locations.  */
-#define YYLSP_NEEDED 0
-
-
+/* Push parsers.  */
+#define YYPUSH 0
 
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     tAGO = 258,
-     tDAY = 259,
-     tDAY_UNIT = 260,
-     tDAYZONE = 261,
-     tDST = 262,
-     tHOUR_UNIT = 263,
-     tID = 264,
-     tMERIDIAN = 265,
-     tMINUTE_UNIT = 266,
-     tMONTH = 267,
-     tMONTH_UNIT = 268,
-     tSEC_UNIT = 269,
-     tSNUMBER = 270,
-     tUNUMBER = 271,
-     tYEAR_UNIT = 272,
-     tZONE = 273
-   };
-#endif
-/* Tokens.  */
-#define tAGO 258
-#define tDAY 259
-#define tDAY_UNIT 260
-#define tDAYZONE 261
-#define tDST 262
-#define tHOUR_UNIT 263
-#define tID 264
-#define tMERIDIAN 265
-#define tMINUTE_UNIT 266
-#define tMONTH 267
-#define tMONTH_UNIT 268
-#define tSEC_UNIT 269
-#define tSNUMBER 270
-#define tUNUMBER 271
-#define tYEAR_UNIT 272
-#define tZONE 273
+/* Pull parsers.  */
+#define YYPULL 1
 
+/* Using locations.  */
+#define YYLSP_NEEDED 0
 
 
 
 /* Copy the first part of user declarations.  */
+
+/* Line 189 of yacc.c  */
 #line 1 "../../libsrc/util/getdate.y"
 
 /*
@@ -278,6 +240,9 @@ typedef struct _CONTEXT {
 #define context ((CONTEXT *) cookie)
 
 
+/* Line 189 of yacc.c  */
+#line 245 "getdate.c"
+
 /* Enabling traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 0
@@ -296,28 +261,78 @@ typedef struct _CONTEXT {
 # define YYTOKEN_TABLE 0
 #endif
 
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     tAGO = 258,
+     tDAY = 259,
+     tDAY_UNIT = 260,
+     tDAYZONE = 261,
+     tDST = 262,
+     tHOUR_UNIT = 263,
+     tID = 264,
+     tMERIDIAN = 265,
+     tMINUTE_UNIT = 266,
+     tMONTH = 267,
+     tMONTH_UNIT = 268,
+     tSEC_UNIT = 269,
+     tSNUMBER = 270,
+     tUNUMBER = 271,
+     tYEAR_UNIT = 272,
+     tZONE = 273
+   };
+#endif
+/* Tokens.  */
+#define tAGO 258
+#define tDAY 259
+#define tDAY_UNIT 260
+#define tDAYZONE 261
+#define tDST 262
+#define tHOUR_UNIT 263
+#define tID 264
+#define tMERIDIAN 265
+#define tMINUTE_UNIT 266
+#define tMONTH 267
+#define tMONTH_UNIT 268
+#define tSEC_UNIT 269
+#define tSNUMBER 270
+#define tUNUMBER 271
+#define tYEAR_UNIT 272
+#define tZONE 273
+
+
+
+
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 180 "../../libsrc/util/getdate.y"
 {
+
+/* Line 214 of yacc.c  */
+#line 180 "../../libsrc/util/getdate.y"
+
     int			Number;
     enum _MERIDIAN	Meridian;
-}
-/* Line 187 of yacc.c.  */
-#line 308 "getdate.c"
-	YYSTYPE;
+
+
+
+/* Line 214 of yacc.c  */
+#line 324 "getdate.c"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 
-
 /* Copy the second part of user declarations.  */
 
 
-/* Line 216 of yacc.c.  */
-#line 321 "getdate.c"
+/* Line 264 of yacc.c  */
+#line 336 "getdate.c"
 
 #ifdef short
 # undef short
@@ -392,14 +407,14 @@ typedef short int yytype_int16;
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static int
-YYID (int i)
+YYID (int yyi)
 #else
 static int
-YYID (i)
-    int i;
+YYID (yyi)
+    int yyi;
 #endif
 {
-  return i;
+  return yyi;
 }
 #endif
 
@@ -480,9 +495,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
 {
-  yytype_int16 yyss;
-  YYSTYPE yyvs;
-  };
+  yytype_int16 yyss_alloc;
+  YYSTYPE yyvs_alloc;
+};
 
 /* The size of the maximum gap between one aligned stack and the next.  */
 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
@@ -516,12 +531,12 @@ union yyalloc
    elements in the stack, and YYPTR gives the new location of the
    stack.  Advance YYPTR to a properly aligned location for the next
    stack.  */
-# define YYSTACK_RELOCATE(Stack)					\
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
     do									\
       {									\
 	YYSIZE_T yynewbytes;						\
-	YYCOPY (&yyptr->Stack, Stack, yysize);				\
-	Stack = &yyptr->Stack;						\
+	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
+	Stack = &yyptr->Stack_alloc;					\
 	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
 	yyptr += yynewbytes / sizeof (*yyptr);				\
       }									\
@@ -937,17 +952,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
 #else
 static void
-yy_stack_print (bottom, top)
-    yytype_int16 *bottom;
-    yytype_int16 *top;
+yy_stack_print (yybottom, yytop)
+    yytype_int16 *yybottom;
+    yytype_int16 *yytop;
 #endif
 {
   YYFPRINTF (stderr, "Stack now");
-  for (; bottom <= top; ++bottom)
-    YYFPRINTF (stderr, " %d", *bottom);
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
   YYFPRINTF (stderr, "\n");
 }
 
@@ -981,11 +999,11 @@ yy_reduce_print (yyvsp, yyrule)
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      fprintf (stderr, "   $%d = ", yyi + 1);
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
 		       &(yyvsp[(yyi + 1) - (yynrhs)])
 		       		       );
-      fprintf (stderr, "\n");
+      YYFPRINTF (stderr, "\n");
     }
 }
 
@@ -1265,10 +1283,8 @@ yydestruct (yymsg, yytype, yyvaluep)
 	break;
     }
 }
-
 
 /* Prevent warnings from -Wmissing-prototypes.  */
-
 #ifdef YYPARSE_PARAM
 #if defined __STDC__ || defined __cplusplus
 int yyparse (void *YYPARSE_PARAM);
@@ -1287,10 +1303,9 @@ int yyparse ();
 
 
 
-
-/*----------.
-| yyparse.  |
-`----------*/
+/*-------------------------.
+| yyparse or yypush_parse.  |
+`-------------------------*/
 
 #ifdef YYPARSE_PARAM
 #if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1314,74 +1329,75 @@ yyparse ()
 #endif
 #endif
 {
-  /* The look-ahead symbol.  */
+/* The lookahead symbol.  */
 int yychar;
 
-/* The semantic value of the look-ahead symbol.  */
+/* The semantic value of the lookahead symbol.  */
 YYSTYPE yylval;
 
-/* Number of syntax errors so far.  */
-int yynerrs;
-
-  int yystate;
-  int yyn;
-  int yyresult;
-  /* Number of tokens to shift before error messages enabled.  */
-  int yyerrstatus;
-  /* Look-ahead token as an internal (translated) token number.  */
-  int yytoken = 0;
-#if YYERROR_VERBOSE
-  /* Buffer for error messages, and its allocated size.  */
-  char yymsgbuf[128];
-  char *yymsg = yymsgbuf;
-  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
-  /* Three stacks and their tools:
-     `yyss': related to states,
-     `yyvs': related to semantic values,
-     `yyls': related to locations.
+    /* Number of syntax errors so far.  */
+    int yynerrs;
 
-     Refer to the stacks thru separate pointers, to allow yyoverflow
-     to reallocate them elsewhere.  */
+    int yystate;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus;
 
-  /* The state stack.  */
-  yytype_int16 yyssa[YYINITDEPTH];
-  yytype_int16 *yyss = yyssa;
-  yytype_int16 *yyssp;
+    /* The stacks and their tools:
+       `yyss': related to states.
+       `yyvs': related to semantic values.
 
-  /* The semantic value stack.  */
-  YYSTYPE yyvsa[YYINITDEPTH];
-  YYSTYPE *yyvs = yyvsa;
-  YYSTYPE *yyvsp;
+       Refer to the stacks thru separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
 
+    /* The state stack.  */
+    yytype_int16 yyssa[YYINITDEPTH];
+    yytype_int16 *yyss;
+    yytype_int16 *yyssp;
 
+    /* The semantic value stack.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs;
+    YYSTYPE *yyvsp;
 
-#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
-
-  YYSIZE_T yystacksize = YYINITDEPTH;
+    YYSIZE_T yystacksize;
 
+  int yyn;
+  int yyresult;
+  /* Lookahead token as an internal (translated) token number.  */
+  int yytoken;
   /* The variables used to return semantic value and location from the
      action routines.  */
   YYSTYPE yyval;
 
+#if YYERROR_VERBOSE
+  /* Buffer for error messages, and its allocated size.  */
+  char yymsgbuf[128];
+  char *yymsg = yymsgbuf;
+  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
   /* The number of symbols on the RHS of the reduced rule.
      Keep to zero when no symbol should be popped.  */
   int yylen = 0;
 
+  yytoken = 0;
+  yyss = yyssa;
+  yyvs = yyvsa;
+  yystacksize = YYINITDEPTH;
+
   YYDPRINTF ((stderr, "Starting parse\n"));
 
   yystate = 0;
   yyerrstatus = 0;
   yynerrs = 0;
-  yychar = YYEMPTY;		/* Cause a token to be read.  */
+  yychar = YYEMPTY; /* Cause a token to be read.  */
 
   /* Initialize stack pointers.
      Waste one element of value and location stack
      so that they stay on the same level as the state stack.
      The wasted elements are never initialized.  */
-
   yyssp = yyss;
   yyvsp = yyvs;
 
@@ -1411,7 +1427,6 @@ int yynerrs;
 	YYSTYPE *yyvs1 = yyvs;
 	yytype_int16 *yyss1 = yyss;
 
-
 	/* Each stack pointer address is followed by the size of the
 	   data in use in that stack, in bytes.  This used to be a
 	   conditional around just the two extra args, but that might
@@ -1419,7 +1434,6 @@ int yynerrs;
 	yyoverflow (YY_("memory exhausted"),
 		    &yyss1, yysize * sizeof (*yyssp),
 		    &yyvs1, yysize * sizeof (*yyvsp),
-
 		    &yystacksize);
 
 	yyss = yyss1;
@@ -1442,9 +1456,8 @@ int yynerrs;
 	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
 	if (! yyptr)
 	  goto yyexhaustedlab;
-	YYSTACK_RELOCATE (yyss);
-	YYSTACK_RELOCATE (yyvs);
-
+	YYSTACK_RELOCATE (yyss_alloc, yyss);
+	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 #  undef YYSTACK_RELOCATE
 	if (yyss1 != yyssa)
 	  YYSTACK_FREE (yyss1);
@@ -1455,7 +1468,6 @@ int yynerrs;
       yyssp = yyss + yysize - 1;
       yyvsp = yyvs + yysize - 1;
 
-
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
 		  (unsigned long int) yystacksize));
 
@@ -1465,6 +1477,9 @@ int yynerrs;
 
   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
+  if (yystate == YYFINAL)
+    YYACCEPT;
+
   goto yybackup;
 
 /*-----------.
@@ -1473,16 +1488,16 @@ int yynerrs;
 yybackup:
 
   /* Do appropriate processing given the current state.  Read a
-     look-ahead token if we need one and don't already have one.  */
+     lookahead token if we need one and don't already have one.  */
 
-  /* First try to decide what to do without reference to look-ahead token.  */
+  /* First try to decide what to do without reference to lookahead token.  */
   yyn = yypact[yystate];
   if (yyn == YYPACT_NINF)
     goto yydefault;
 
-  /* Not known => get a look-ahead token if don't already have one.  */
+  /* Not known => get a lookahead token if don't already have one.  */
 
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
   if (yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
@@ -1514,20 +1529,16 @@ yybackup:
       goto yyreduce;
     }
 
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
   /* Count tokens shifted since error; after three, turn off error
      status.  */
   if (yyerrstatus)
     yyerrstatus--;
 
-  /* Shift the look-ahead token.  */
+  /* Shift the lookahead token.  */
   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
 
-  /* Discard the shifted token unless it is eof.  */
-  if (yychar != YYEOF)
-    yychar = YYEMPTY;
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
 
   yystate = yyn;
   *++yyvsp = yylval;
@@ -1567,6 +1578,8 @@ yyreduce:
   switch (yyn)
     {
         case 4:
+
+/* Line 1455 of yacc.c  */
 #line 200 "../../libsrc/util/getdate.y"
     {
 	    context->yyHaveTime++;
@@ -1574,6 +1587,8 @@ yyreduce:
     break;
 
   case 5:
+
+/* Line 1455 of yacc.c  */
 #line 203 "../../libsrc/util/getdate.y"
     {
 	    context->yyHaveZone++;
@@ -1581,6 +1596,8 @@ yyreduce:
     break;
 
   case 6:
+
+/* Line 1455 of yacc.c  */
 #line 206 "../../libsrc/util/getdate.y"
     {
 	    context->yyHaveDate++;
@@ -1588,6 +1605,8 @@ yyreduce:
     break;
 
   case 7:
+
+/* Line 1455 of yacc.c  */
 #line 209 "../../libsrc/util/getdate.y"
     {
 	    context->yyHaveDay++;
@@ -1595,6 +1614,8 @@ yyreduce:
     break;
 
   case 8:
+
+/* Line 1455 of yacc.c  */
 #line 212 "../../libsrc/util/getdate.y"
     {
 	    context->yyHaveRel++;
@@ -1602,6 +1623,8 @@ yyreduce:
     break;
 
   case 10:
+
+/* Line 1455 of yacc.c  */
 #line 218 "../../libsrc/util/getdate.y"
     {
 	    context->yyHour = (yyvsp[(1) - (2)].Number);
@@ -1612,6 +1635,8 @@ yyreduce:
     break;
 
   case 11:
+
+/* Line 1455 of yacc.c  */
 #line 224 "../../libsrc/util/getdate.y"
     {
 	    context->yyHour = (yyvsp[(1) - (4)].Number);
@@ -1622,6 +1647,8 @@ yyreduce:
     break;
 
   case 12:
+
+/* Line 1455 of yacc.c  */
 #line 230 "../../libsrc/util/getdate.y"
     {
 	    context->yyHour = (yyvsp[(1) - (4)].Number);
@@ -1635,6 +1662,8 @@ yyreduce:
     break;
 
   case 13:
+
+/* Line 1455 of yacc.c  */
 #line 239 "../../libsrc/util/getdate.y"
     {
 	    context->yyHour = (yyvsp[(1) - (6)].Number);
@@ -1645,6 +1674,8 @@ yyreduce:
     break;
 
   case 14:
+
+/* Line 1455 of yacc.c  */
 #line 245 "../../libsrc/util/getdate.y"
     {
 	    context->yyHour = (yyvsp[(1) - (6)].Number);
@@ -1659,6 +1690,8 @@ yyreduce:
     break;
 
   case 15:
+
+/* Line 1455 of yacc.c  */
 #line 257 "../../libsrc/util/getdate.y"
     {
 	    context->yyTimezone = (yyvsp[(1) - (1)].Number);
@@ -1666,6 +1699,8 @@ yyreduce:
     break;
 
   case 16:
+
+/* Line 1455 of yacc.c  */
 #line 260 "../../libsrc/util/getdate.y"
     {
 	    context->yyTimezone = (yyvsp[(1) - (1)].Number) - 60;
@@ -1673,6 +1708,8 @@ yyreduce:
     break;
 
   case 17:
+
+/* Line 1455 of yacc.c  */
 #line 264 "../../libsrc/util/getdate.y"
     {
 	    context->yyTimezone = (yyvsp[(1) - (2)].Number) - 60;
@@ -1680,6 +1717,8 @@ yyreduce:
     break;
 
   case 18:
+
+/* Line 1455 of yacc.c  */
 #line 269 "../../libsrc/util/getdate.y"
     {
 	    context->yyDayOrdinal = 1;
@@ -1688,6 +1727,8 @@ yyreduce:
     break;
 
   case 19:
+
+/* Line 1455 of yacc.c  */
 #line 273 "../../libsrc/util/getdate.y"
     {
 	    context->yyDayOrdinal = 1;
@@ -1696,6 +1737,8 @@ yyreduce:
     break;
 
   case 20:
+
+/* Line 1455 of yacc.c  */
 #line 277 "../../libsrc/util/getdate.y"
     {
 	    context->yyDayOrdinal = (yyvsp[(1) - (2)].Number);
@@ -1704,6 +1747,8 @@ yyreduce:
     break;
 
   case 21:
+
+/* Line 1455 of yacc.c  */
 #line 283 "../../libsrc/util/getdate.y"
     {
 	    context->yyMonth = (yyvsp[(1) - (3)].Number);
@@ -1712,6 +1757,8 @@ yyreduce:
     break;
 
   case 22:
+
+/* Line 1455 of yacc.c  */
 #line 287 "../../libsrc/util/getdate.y"
     {
 	  /* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY.
@@ -1734,6 +1781,8 @@ yyreduce:
     break;
 
   case 23:
+
+/* Line 1455 of yacc.c  */
 #line 305 "../../libsrc/util/getdate.y"
     {
 	    /* ISO 8601 format.  yyyy-mm-dd.  */
@@ -1744,6 +1793,8 @@ yyreduce:
     break;
 
   case 24:
+
+/* Line 1455 of yacc.c  */
 #line 311 "../../libsrc/util/getdate.y"
     {
 	    /* e.g. 17-JUN-1992.  */
@@ -1754,6 +1805,8 @@ yyreduce:
     break;
 
   case 25:
+
+/* Line 1455 of yacc.c  */
 #line 317 "../../libsrc/util/getdate.y"
     {
 	    context->yyMonth = (yyvsp[(1) - (2)].Number);
@@ -1762,6 +1815,8 @@ yyreduce:
     break;
 
   case 26:
+
+/* Line 1455 of yacc.c  */
 #line 321 "../../libsrc/util/getdate.y"
     {
 	    context->yyMonth = (yyvsp[(1) - (4)].Number);
@@ -1771,6 +1826,8 @@ yyreduce:
     break;
 
   case 27:
+
+/* Line 1455 of yacc.c  */
 #line 326 "../../libsrc/util/getdate.y"
     {
 	    context->yyMonth = (yyvsp[(2) - (2)].Number);
@@ -1779,6 +1836,8 @@ yyreduce:
     break;
 
   case 28:
+
+/* Line 1455 of yacc.c  */
 #line 330 "../../libsrc/util/getdate.y"
     {
 	    context->yyMonth = (yyvsp[(2) - (3)].Number);
@@ -1788,6 +1847,8 @@ yyreduce:
     break;
 
   case 29:
+
+/* Line 1455 of yacc.c  */
 #line 337 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelSeconds = -context->yyRelSeconds;
@@ -1800,6 +1861,8 @@ yyreduce:
     break;
 
   case 31:
+
+/* Line 1455 of yacc.c  */
 #line 348 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelYear += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
@@ -1807,6 +1870,8 @@ yyreduce:
     break;
 
   case 32:
+
+/* Line 1455 of yacc.c  */
 #line 351 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelYear += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
@@ -1814,6 +1879,8 @@ yyreduce:
     break;
 
   case 33:
+
+/* Line 1455 of yacc.c  */
 #line 354 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelYear += (yyvsp[(1) - (1)].Number);
@@ -1821,6 +1888,8 @@ yyreduce:
     break;
 
   case 34:
+
+/* Line 1455 of yacc.c  */
 #line 357 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelMonth += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
@@ -1828,6 +1897,8 @@ yyreduce:
     break;
 
   case 35:
+
+/* Line 1455 of yacc.c  */
 #line 360 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelMonth += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
@@ -1835,6 +1906,8 @@ yyreduce:
     break;
 
   case 36:
+
+/* Line 1455 of yacc.c  */
 #line 363 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelMonth += (yyvsp[(1) - (1)].Number);
@@ -1842,6 +1915,8 @@ yyreduce:
     break;
 
   case 37:
+
+/* Line 1455 of yacc.c  */
 #line 366 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelDay += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
@@ -1849,6 +1924,8 @@ yyreduce:
     break;
 
   case 38:
+
+/* Line 1455 of yacc.c  */
 #line 369 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelDay += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
@@ -1856,6 +1933,8 @@ yyreduce:
     break;
 
   case 39:
+
+/* Line 1455 of yacc.c  */
 #line 372 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelDay += (yyvsp[(1) - (1)].Number);
@@ -1863,6 +1942,8 @@ yyreduce:
     break;
 
   case 40:
+
+/* Line 1455 of yacc.c  */
 #line 375 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelHour += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
@@ -1870,6 +1951,8 @@ yyreduce:
     break;
 
   case 41:
+
+/* Line 1455 of yacc.c  */
 #line 378 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelHour += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
@@ -1877,6 +1960,8 @@ yyreduce:
     break;
 
   case 42:
+
+/* Line 1455 of yacc.c  */
 #line 381 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelHour += (yyvsp[(1) - (1)].Number);
@@ -1884,6 +1969,8 @@ yyreduce:
     break;
 
   case 43:
+
+/* Line 1455 of yacc.c  */
 #line 384 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelMinutes += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
@@ -1891,6 +1978,8 @@ yyreduce:
     break;
 
   case 44:
+
+/* Line 1455 of yacc.c  */
 #line 387 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelMinutes += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
@@ -1898,6 +1987,8 @@ yyreduce:
     break;
 
   case 45:
+
+/* Line 1455 of yacc.c  */
 #line 390 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelMinutes += (yyvsp[(1) - (1)].Number);
@@ -1905,6 +1996,8 @@ yyreduce:
     break;
 
   case 46:
+
+/* Line 1455 of yacc.c  */
 #line 393 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelSeconds += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
@@ -1912,6 +2005,8 @@ yyreduce:
     break;
 
   case 47:
+
+/* Line 1455 of yacc.c  */
 #line 396 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelSeconds += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
@@ -1919,6 +2014,8 @@ yyreduce:
     break;
 
   case 48:
+
+/* Line 1455 of yacc.c  */
 #line 399 "../../libsrc/util/getdate.y"
     {
 	    context->yyRelSeconds += (yyvsp[(1) - (1)].Number);
@@ -1926,6 +2023,8 @@ yyreduce:
     break;
 
   case 49:
+
+/* Line 1455 of yacc.c  */
 #line 405 "../../libsrc/util/getdate.y"
     {
 	    if (context->yyHaveTime && context->yyHaveDate &&
@@ -1961,6 +2060,8 @@ yyreduce:
     break;
 
   case 50:
+
+/* Line 1455 of yacc.c  */
 #line 439 "../../libsrc/util/getdate.y"
     {
 	    (yyval.Meridian) = MER24;
@@ -1968,6 +2069,8 @@ yyreduce:
     break;
 
   case 51:
+
+/* Line 1455 of yacc.c  */
 #line 443 "../../libsrc/util/getdate.y"
     {
 	    (yyval.Meridian) = (yyvsp[(1) - (1)].Meridian);
@@ -1975,8 +2078,9 @@ yyreduce:
     break;
 
 
-/* Line 1267 of yacc.c.  */
-#line 1980 "getdate.c"
+
+/* Line 1455 of yacc.c  */
+#line 2084 "getdate.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1987,7 +2091,6 @@ yyreduce:
 
   *++yyvsp = yyval;
 
-
   /* Now `shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
@@ -2052,7 +2155,7 @@ yyerrlab:
 
   if (yyerrstatus == 3)
     {
-      /* If just tried and failed to reuse look-ahead token after an
+      /* If just tried and failed to reuse lookahead token after an
 	 error, discard it.  */
 
       if (yychar <= YYEOF)
@@ -2069,7 +2172,7 @@ yyerrlab:
 	}
     }
 
-  /* Else will try to reuse look-ahead token after shifting the error
+  /* Else will try to reuse lookahead token after shifting the error
      token.  */
   goto yyerrlab1;
 
@@ -2126,9 +2229,6 @@ yyerrlab1:
       YY_STACK_PRINT (yyss, yyssp);
     }
 
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
   *++yyvsp = yylval;
 
 
@@ -2153,7 +2253,7 @@ yyabortlab:
   yyresult = 1;
   goto yyreturn;
 
-#ifndef yyoverflow
+#if !defined(yyoverflow) || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
 `-------------------------------------------------*/
@@ -2164,7 +2264,7 @@ yyexhaustedlab:
 #endif
 
 yyreturn:
-  if (yychar != YYEOF && yychar != YYEMPTY)
+  if (yychar != YYEMPTY)
      yydestruct ("Cleanup: discarding lookahead",
 		 yytoken, &yylval);
   /* Do not reclaim the symbols of the rule which action triggered
@@ -2190,6 +2290,8 @@ yyreturn:
 }
 
 
+
+/* Line 1675 of yacc.c  */
 #line 448 "../../libsrc/util/getdate.y"
 
 
diff --git a/libsrc/zlib/Makefile.in b/libsrc/zlib/Makefile.in
index f83639d..2feb4ff 100644
--- a/libsrc/zlib/Makefile.in
+++ b/libsrc/zlib/Makefile.in
@@ -191,6 +191,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 PERL = @PERL@
diff --git a/win32/im.vcproj b/win32/im.vcproj
index e3fa20f..389a89c 100644
--- a/win32/im.vcproj
+++ b/win32/im.vcproj
@@ -150,7 +150,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\binsrc\driver,..\libsrc\Wi,..\libsrc\langfunc,..\libsrc\plugin,..\binsrc\driver\include..\libsrc\Dk,..\libsrc\util\win32,..\libsrc;..\libsrc\Xml.new;openssl,.;$(IM_PATH)"
+				AdditionalIncludeDirectories="..\binsrc\driver;..\libsrc\Wi;..\libsrc\langfunc;..\libsrc\plugin;..\binsrc\driver\include..\libsrc\Dk;..\libsrc\util\win32;..\libsrc;..\libsrc\Xml.new;openssl;.;.\ImageMagick"
 				PreprocessorDefinitions="_SSL;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;YYTOKENTYPE;DLDAPI_WINDOWS;NO_IMPORT;VIRTTP;NDEBUG;_USRDLL"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="0"
@@ -187,7 +187,7 @@
 				OutputFile="$(ConfigurationName)/im.dll"
 				LinkIncremental="1"
 				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(ConfigurationName),.\openssl;$(IM_PATH)"
+				AdditionalLibraryDirectories=""$(ConfigurationName)";.\openssl;.\ImageMagick"
 				IgnoreDefaultLibraryNames="LIBCD.lib"
 				ModuleDefinitionFile="..\binsrc\samples\image_magick\im.def"
 				GenerateDebugInformation="true"
diff --git a/win32/libvirtuoso_odbc_t.vcproj b/win32/libvirtuoso_odbc_t.vcproj
index b686ac5..c811e43 100644
--- a/win32/libvirtuoso_odbc_t.vcproj
+++ b/win32/libvirtuoso_odbc_t.vcproj
@@ -43,7 +43,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\libsrc\xml.new,..\libsrc,..\libsrc\Dk,..\libsrc\util\win32,..\libsrc\Wi,..\libsrc\zlib,..\binsrc\driver,..\libsrc\plugin,..\libsrc\langfunc,..\libsrc\openssl, ."
-				PreprocessorDefinitions="_SSL;_CONSOLE;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;SHARED_OBJECT;PACKAGE_VERSION=\"6.1.1\""
+				PreprocessorDefinitions="_SSL;_CONSOLE;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;SHARED_OBJECT;PACKAGE_VERSION=\"6.1.3\""
 				MinimalRebuild="true"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="0"
@@ -128,7 +128,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="3"
 				AdditionalIncludeDirectories="..\libsrc\xml.new,..\libsrc,..\libsrc\Dk,..\libsrc\util\win32,..\libsrc\Wi,..\libsrc\zlib,..\binsrc\driver,..\libsrc\plugin,..\libsrc\langfunc,..\libsrc\openssl, ."
-				PreprocessorDefinitions="_SSL;_CONSOLE;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;SHARED_OBJECT;NDEBUG;PACKAGE_VERSION=\"6.1.1\""
+				PreprocessorDefinitions="PACKAGE_VERSION=\"6.1.3\";_SSL;_CONSOLE;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;SHARED_OBJECT;NDEBUG"
 				MinimalRebuild="false"
 				ExceptionHandling="0"
 				BasicRuntimeChecks="0"
diff --git a/win32/sqlcode.bat b/win32/sqlcode.bat
index 0c41fe5..1efa355 100644
--- a/win32/sqlcode.bat
+++ b/win32/sqlcode.bat
@@ -15,7 +15,7 @@ set SQL_FILES_VDB=vdb.sql
 set SQL_FILES_PLDBG=cov_report.xsl cov_time.xsl
 set SQL_FILES_VAD=../../binsrc/vad/vad_root.sql ../../binsrc/vad/vad_misc.sql ../../binsrc/vad/oper_pars.sql ../../binsrc/vad/pars_init.sql ../../binsrc/vad/vad_make.sql
 set SQL_FILES_DBP=../../binsrc/vsp/admin/dbpump/dbpump_root.sql ../../binsrc/vsp/admin/dbpump/oper_pars.sql ../../binsrc/vsp/admin/dbpump/components.sql ../../binsrc/vsp/admin/dbpump/comp_html.sql ../../binsrc/vsp/admin/dbpump/comp_misc.sql ../../binsrc/vsp/admin/dbpump/comp_rpath.sql ../../binsrc/vsp/admin/dbpump/comp_tables.sql ../../binsrc/vsp/admin/dbpump/pars_init.sql
-set SQL_FILES_SPARQL=sparql.sql sparql_io.sql rdf_sponge.sql rdf_schema_objects.sql rdf_void.sql
+set SQL_FILES_SPARQL=sparql.sql sparql_io.sql rdf_sponge.sql rdf_schema_objects.sql rdf_void.sql rdflddir2.sql
 
 rm -f sql_code.c sql_code_1.c sql_code_ws.c sql_code_repl.c sql_code_dav.c sql_code_ddk.c sql_code_sys.c sql_code_uddi.c 
 rm -f sql_code_imsg.c sql_code_auto.c sql_code_adm.c sql_code_2pc.c sql_code_vdb.c sql_code_pldbg.c 
diff --git a/win32/virtuoso-opensource.sln b/win32/virtuoso-opensource.sln
index ed52784..7478643 100644
--- a/win32/virtuoso-opensource.sln
+++ b/win32/virtuoso-opensource.sln
@@ -1,5 +1,5 @@
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blobs", "blobs.vcproj", "{72ABF3AE-CF7A-11DA-85E2-A4E5714C712A}"
 	ProjectSection(ProjectDependencies) = postProject
 		{B619BB2C-A9AC-453D-BA98-3A8F3217B1AB} = {B619BB2C-A9AC-453D-BA98-3A8F3217B1AB}
@@ -363,7 +363,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rdf_mappers_vad", "rdf_mapp
 		{F4E88BFA-FC96-439D-9E67-0A92AB541EE0} = {F4E88BFA-FC96-439D-9E67-0A92AB541EE0}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "creolewiki", "creolewiki.vcproj", "{ABE43C46-E1C4-11DB-930B-CD6B662399AA}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "creolewiki", "creolewiki.vcproj", "{ABE43C46-E1C4-11DB-930B-CD6B662399AA}"
 	ProjectSection(ProjectDependencies) = postProject
 		{93051962-7797-49F0-8958-BB1CE60FFE6F} = {93051962-7797-49F0-8958-BB1CE60FFE6F}
 		{031DB868-5294-4738-90BA-F80BB2CEA9DC} = {031DB868-5294-4738-90BA-F80BB2CEA9DC}
@@ -405,208 +405,203 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hslookup", "hslookup.vcproj
 	EndProjectSection
 EndProject
 Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Win32 = Debug|Win32
-		Release|Win32 = Release|Win32
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
 	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{72ABF3AE-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{72ABF3AE-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{72ABF3AE-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{72ABF3AE-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{3A2B317A-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{3A2B317A-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{7B2A50F2-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{7B2A50F2-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{7B2A50F2-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{7B2A50F2-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{828BB6BA-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{828BB6BA-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{97D467CE-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{97D467CE-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{97D467CE-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{97D467CE-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{6E10B655-C324-491F-B202-73565D6B30FB}.Debug|Win32.ActiveCfg = Debug|Win32
-		{6E10B655-C324-491F-B202-73565D6B30FB}.Debug|Win32.Build.0 = Debug|Win32
-		{6E10B655-C324-491F-B202-73565D6B30FB}.Release|Win32.ActiveCfg = Release|Win32
-		{6E10B655-C324-491F-B202-73565D6B30FB}.Release|Win32.Build.0 = Release|Win32
-		{CA03DBF1-2C7E-4732-8F41-65030876DDE7}.Debug|Win32.ActiveCfg = Debug|Win32
-		{CA03DBF1-2C7E-4732-8F41-65030876DDE7}.Release|Win32.ActiveCfg = Release|Win32
-		{58F7DCEF-D5DE-402D-8F50-39B67C8B9E9E}.Debug|Win32.ActiveCfg = Debug|Win32
-		{58F7DCEF-D5DE-402D-8F50-39B67C8B9E9E}.Debug|Win32.Build.0 = Debug|Win32
-		{58F7DCEF-D5DE-402D-8F50-39B67C8B9E9E}.Release|Win32.ActiveCfg = Release|Win32
-		{58F7DCEF-D5DE-402D-8F50-39B67C8B9E9E}.Release|Win32.Build.0 = Release|Win32
-		{58867EBA-CA07-4F41-A966-6245FF14773E}.Debug|Win32.ActiveCfg = Debug|Win32
-		{58867EBA-CA07-4F41-A966-6245FF14773E}.Debug|Win32.Build.0 = Debug|Win32
-		{58867EBA-CA07-4F41-A966-6245FF14773E}.Release|Win32.ActiveCfg = Release|Win32
-		{58867EBA-CA07-4F41-A966-6245FF14773E}.Release|Win32.Build.0 = Release|Win32
-		{A9B1A466-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{A9B1A466-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{AFB15514-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{AFB15514-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{AFB15514-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{AFB15514-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{354809B6-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{354809B6-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{354809B6-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{B525A234-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{B525A234-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{B525A234-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{C152ADCC-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{C152ADCC-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{C152ADCC-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{C152ADCC-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{C6C66924-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{C6C66924-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{C6C66924-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{C6C66924-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{AFB1D909-86D0-49DE-8BD8-DF89349F934E}.Debug|Win32.ActiveCfg = Debug|Win32
-		{AFB1D909-86D0-49DE-8BD8-DF89349F934E}.Debug|Win32.Build.0 = Debug|Win32
-		{AFB1D909-86D0-49DE-8BD8-DF89349F934E}.Release|Win32.ActiveCfg = Release|Win32
-		{AFB1D909-86D0-49DE-8BD8-DF89349F934E}.Release|Win32.Build.0 = Release|Win32
-		{FB836C59-41E1-48EA-A59B-460AB56587EE}.Debug|Win32.ActiveCfg = Debug|Win32
-		{FB836C59-41E1-48EA-A59B-460AB56587EE}.Debug|Win32.Build.0 = Debug|Win32
-		{FB836C59-41E1-48EA-A59B-460AB56587EE}.Release|Win32.ActiveCfg = Release|Win32
-		{FB836C59-41E1-48EA-A59B-460AB56587EE}.Release|Win32.Build.0 = Release|Win32
-		{9FF2579E-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{9FF2579E-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{9FF2579E-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{9FF2579E-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{C9EC4A56-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{C9EC4A56-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{C9EC4A56-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{C9EC4A56-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{DCA407C4-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{DCA407C4-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{DCA407C4-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{DCA407C4-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{B619BB2C-A9AC-453D-BA98-3A8F3217B1AB}.Debug|Win32.ActiveCfg = Debug|Win32
-		{B619BB2C-A9AC-453D-BA98-3A8F3217B1AB}.Debug|Win32.Build.0 = Debug|Win32
-		{B619BB2C-A9AC-453D-BA98-3A8F3217B1AB}.Release|Win32.ActiveCfg = Release|Win32
-		{B619BB2C-A9AC-453D-BA98-3A8F3217B1AB}.Release|Win32.Build.0 = Release|Win32
-		{D3A2882C-410A-4F58-8ACE-A771888073E8}.Debug|Win32.ActiveCfg = Debug|Win32
-		{D3A2882C-410A-4F58-8ACE-A771888073E8}.Debug|Win32.Build.0 = Debug|Win32
-		{D3A2882C-410A-4F58-8ACE-A771888073E8}.Release|Win32.ActiveCfg = Release|Win32
-		{D3A2882C-410A-4F58-8ACE-A771888073E8}.Release|Win32.Build.0 = Release|Win32
-		{D9E130E1-7734-43DF-A7EF-15CD95E467EE}.Debug|Win32.ActiveCfg = Debug|Win32
-		{D9E130E1-7734-43DF-A7EF-15CD95E467EE}.Debug|Win32.Build.0 = Debug|Win32
-		{D9E130E1-7734-43DF-A7EF-15CD95E467EE}.Release|Win32.ActiveCfg = Release|Win32
-		{D9E130E1-7734-43DF-A7EF-15CD95E467EE}.Release|Win32.Build.0 = Release|Win32
-		{E5D3D9AA-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{E5D3D9AA-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{E5D3D9AA-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{E5D3D9AA-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{EB22A6B6-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{EB22A6B6-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{EF98F42A-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{EF98F42A-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{EF98F42A-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{EF98F42A-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{031DB868-5294-4738-90BA-F80BB2CEA9DC}.Debug|Win32.ActiveCfg = Debug|Win32
-		{031DB868-5294-4738-90BA-F80BB2CEA9DC}.Debug|Win32.Build.0 = Debug|Win32
-		{031DB868-5294-4738-90BA-F80BB2CEA9DC}.Release|Win32.ActiveCfg = Release|Win32
-		{031DB868-5294-4738-90BA-F80BB2CEA9DC}.Release|Win32.Build.0 = Release|Win32
-		{3D1A94CE-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{3D1A94CE-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{3D1A94CE-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{3D1A94CE-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{F357CF96-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{F357CF96-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{F357CF96-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{F357CF96-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{8D07389F-F48A-49B9-BED9-F71FCBACC4A8}.Debug|Win32.ActiveCfg = Debug|Win32
-		{8D07389F-F48A-49B9-BED9-F71FCBACC4A8}.Debug|Win32.Build.0 = Debug|Win32
-		{8D07389F-F48A-49B9-BED9-F71FCBACC4A8}.Release|Win32.ActiveCfg = Release|Win32
-		{8D07389F-F48A-49B9-BED9-F71FCBACC4A8}.Release|Win32.Build.0 = Release|Win32
-		{02AD88A0-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{02AD88A0-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{02AD88A0-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{0E838FA8-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{0E838FA8-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{0E838FA8-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{0E838FA8-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
-		{F4E88BFA-FC96-439D-9E67-0A92AB541EE0}.Debug|Win32.ActiveCfg = Debug|Win32
-		{F4E88BFA-FC96-439D-9E67-0A92AB541EE0}.Debug|Win32.Build.0 = Debug|Win32
-		{F4E88BFA-FC96-439D-9E67-0A92AB541EE0}.Release|Win32.ActiveCfg = Release|Win32
-		{F4E88BFA-FC96-439D-9E67-0A92AB541EE0}.Release|Win32.Build.0 = Release|Win32
-		{93051962-7797-49F0-8958-BB1CE60FFE6F}.Debug|Win32.ActiveCfg = Debug|Win32
-		{93051962-7797-49F0-8958-BB1CE60FFE6F}.Debug|Win32.Build.0 = Debug|Win32
-		{93051962-7797-49F0-8958-BB1CE60FFE6F}.Release|Win32.ActiveCfg = Release|Win32
-		{93051962-7797-49F0-8958-BB1CE60FFE6F}.Release|Win32.Build.0 = Release|Win32
-		{A66E395B-18EE-4877-8F0D-386A7BBAB370}.Debug|Win32.ActiveCfg = Debug|Win32
-		{A66E395B-18EE-4877-8F0D-386A7BBAB370}.Debug|Win32.Build.0 = Debug|Win32
-		{A66E395B-18EE-4877-8F0D-386A7BBAB370}.Release|Win32.ActiveCfg = Release|Win32
-		{A66E395B-18EE-4877-8F0D-386A7BBAB370}.Release|Win32.Build.0 = Release|Win32
-		{A326A0DF-4F93-4DF6-813D-0B64F98B389F}.Debug|Win32.ActiveCfg = Debug|Win32
-		{A326A0DF-4F93-4DF6-813D-0B64F98B389F}.Debug|Win32.Build.0 = Debug|Win32
-		{A326A0DF-4F93-4DF6-813D-0B64F98B389F}.Release|Win32.ActiveCfg = Release|Win32
-		{A326A0DF-4F93-4DF6-813D-0B64F98B389F}.Release|Win32.Build.0 = Release|Win32
-		{0C234EF0-7725-4BDA-A1C3-47F5835A3837}.Debug|Win32.ActiveCfg = Debug|Win32
-		{0C234EF0-7725-4BDA-A1C3-47F5835A3837}.Debug|Win32.Build.0 = Debug|Win32
-		{0C234EF0-7725-4BDA-A1C3-47F5835A3837}.Release|Win32.ActiveCfg = Release|Win32
-		{0C234EF0-7725-4BDA-A1C3-47F5835A3837}.Release|Win32.Build.0 = Release|Win32
-		{86645C8E-3BBE-4E1E-A8AE-C6990B4ECC64}.Debug|Win32.ActiveCfg = Debug|Win32
-		{86645C8E-3BBE-4E1E-A8AE-C6990B4ECC64}.Debug|Win32.Build.0 = Debug|Win32
-		{86645C8E-3BBE-4E1E-A8AE-C6990B4ECC64}.Release|Win32.ActiveCfg = Release|Win32
-		{86645C8E-3BBE-4E1E-A8AE-C6990B4ECC64}.Release|Win32.Build.0 = Release|Win32
-		{4C517D78-E5B9-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{4C517D78-E5B9-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
-		{4C517D78-E5B9-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{C5F98602-E5B9-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{C5F98602-E5B9-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{7DF920B2-EFDA-11DA-988C-EBAD6065650A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{7DF920B2-EFDA-11DA-988C-EBAD6065650A}.Release|Win32.ActiveCfg = Release|Win32
-		{8CF9FC64-EFDD-11DA-986F-EA05CA2469B6}.Debug|Win32.ActiveCfg = Debug|Win32
-		{8CF9FC64-EFDD-11DA-986F-EA05CA2469B6}.Release|Win32.ActiveCfg = Release|Win32
-		{40062448-EFE0-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{40062448-EFE0-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{55215A1C-EFE2-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{55215A1C-EFE2-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{441F1D0C-EFE3-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{441F1D0C-EFE3-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{8A49554A-EFE3-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{8A49554A-EFE3-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{B0058FA6-EFE3-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{B0058FA6-EFE3-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{BFCB4C14-EFE3-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{BFCB4C14-EFE3-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{C0990F5A-EFE3-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{C0990F5A-EFE3-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{607116BE-F168-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{607116BE-F168-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
-		{6260E42E-239D-11DB-9594-FD7021681415}.Debug|Win32.ActiveCfg = Debug|Win32
-		{6260E42E-239D-11DB-9594-FD7021681415}.Release|Win32.ActiveCfg = Release|Win32
-		{408E2482-2623-11DB-9BB9-97600548391D}.Debug|Win32.ActiveCfg = Debug|Win32
-		{408E2482-2623-11DB-9BB9-97600548391D}.Debug|Win32.Build.0 = Debug|Win32
-		{408E2482-2623-11DB-9BB9-97600548391D}.Release|Win32.ActiveCfg = Release|Win32
-		{408E2482-2623-11DB-9BB9-97600548391D}.Release|Win32.Build.0 = Release|Win32
-		{FAB7D8D8-C7DD-11DB-930B-CD6B662399AA}.Debug|Win32.ActiveCfg = Debug|Win32
-		{FAB7D8D8-C7DD-11DB-930B-CD6B662399AA}.Release|Win32.ActiveCfg = Release|Win32
-		{5582D8D0-DB93-11DB-930B-CD6B662399AA}.Debug|Win32.ActiveCfg = Debug|Win32
-		{5582D8D0-DB93-11DB-930B-CD6B662399AA}.Debug|Win32.Build.0 = Debug|Win32
-		{5582D8D0-DB93-11DB-930B-CD6B662399AA}.Release|Win32.ActiveCfg = Release|Win32
-		{5582D8D0-DB93-11DB-930B-CD6B662399AA}.Release|Win32.Build.0 = Release|Win32
-		{C6451C76-DC57-11DB-930B-CD6B662399AA}.Debug|Win32.ActiveCfg = Debug|Win32
-		{C6451C76-DC57-11DB-930B-CD6B662399AA}.Release|Win32.ActiveCfg = Release|Win32
-		{ABE43C46-E1C4-11DB-930B-CD6B662399AA}.Debug|Win32.ActiveCfg = Debug|Win32
-		{ABE43C46-E1C4-11DB-930B-CD6B662399AA}.Release|Win32.ActiveCfg = Release|Win32
-		{ABE43C46-E1C4-11DB-930B-CD6B662399AA}.Release|Win32.Build.0 = Release|Win32
-		{351A8882-FD57-11DB-B29C-A18F012B09DC}.Debug|Win32.ActiveCfg = Debug|Win32
-		{351A8882-FD57-11DB-B29C-A18F012B09DC}.Release|Win32.ActiveCfg = Release|Win32
-		{20D26EE8-E1BA-11DB-930B-CD6B662399AA}.Debug|Win32.ActiveCfg = Debug|Win32
-		{20D26EE8-E1BA-11DB-930B-CD6B662399AA}.Release|Win32.ActiveCfg = Release|Win32
-		{CDFD5FAC-FD70-11DB-B29C-A18F012B09DC}.Debug|Win32.ActiveCfg = Debug|Win32
-		{CDFD5FAC-FD70-11DB-B29C-A18F012B09DC}.Release|Win32.ActiveCfg = Release|Win32
-		{9D059C10-A1AE-11DC-AE66-B7BFA9FB648A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{9D059C10-A1AE-11DC-AE66-B7BFA9FB648A}.Debug|Win32.Build.0 = Debug|Win32
-		{9D059C10-A1AE-11DC-AE66-B7BFA9FB648A}.Release|Win32.ActiveCfg = Release|Win32
-		{9D059C10-A1AE-11DC-AE66-B7BFA9FB648A}.Release|Win32.Build.0 = Release|Win32
-		{14ECED18-FB38-11DC-8216-8B38A5565D8C}.Debug|Win32.ActiveCfg = Debug|Win32
-		{14ECED18-FB38-11DC-8216-8B38A5565D8C}.Debug|Win32.Build.0 = Debug|Win32
-		{14ECED18-FB38-11DC-8216-8B38A5565D8C}.Release|Win32.ActiveCfg = Release|Win32
-		{14ECED18-FB38-11DC-8216-8B38A5565D8C}.Release|Win32.Build.0 = Release|Win32
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{72ABF3AE-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{72ABF3AE-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{72ABF3AE-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{72ABF3AE-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{3A2B317A-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{3A2B317A-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{7B2A50F2-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7B2A50F2-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{7B2A50F2-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{7B2A50F2-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{828BB6BA-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{828BB6BA-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{97D467CE-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{97D467CE-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{97D467CE-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{97D467CE-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{6E10B655-C324-491F-B202-73565D6B30FB}.Debug|Win32.ActiveCfg = Debug|Win32
+		{6E10B655-C324-491F-B202-73565D6B30FB}.Debug|Win32.Build.0 = Debug|Win32
+		{6E10B655-C324-491F-B202-73565D6B30FB}.Release|Win32.ActiveCfg = Release|Win32
+		{6E10B655-C324-491F-B202-73565D6B30FB}.Release|Win32.Build.0 = Release|Win32
+		{CA03DBF1-2C7E-4732-8F41-65030876DDE7}.Debug|Win32.ActiveCfg = Debug|Win32
+		{CA03DBF1-2C7E-4732-8F41-65030876DDE7}.Release|Win32.ActiveCfg = Release|Win32
+		{58F7DCEF-D5DE-402D-8F50-39B67C8B9E9E}.Debug|Win32.ActiveCfg = Debug|Win32
+		{58F7DCEF-D5DE-402D-8F50-39B67C8B9E9E}.Debug|Win32.Build.0 = Debug|Win32
+		{58F7DCEF-D5DE-402D-8F50-39B67C8B9E9E}.Release|Win32.ActiveCfg = Release|Win32
+		{58F7DCEF-D5DE-402D-8F50-39B67C8B9E9E}.Release|Win32.Build.0 = Release|Win32
+		{58867EBA-CA07-4F41-A966-6245FF14773E}.Debug|Win32.ActiveCfg = Debug|Win32
+		{58867EBA-CA07-4F41-A966-6245FF14773E}.Debug|Win32.Build.0 = Debug|Win32
+		{58867EBA-CA07-4F41-A966-6245FF14773E}.Release|Win32.ActiveCfg = Release|Win32
+		{58867EBA-CA07-4F41-A966-6245FF14773E}.Release|Win32.Build.0 = Release|Win32
+		{A9B1A466-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A9B1A466-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{AFB15514-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{AFB15514-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{AFB15514-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{AFB15514-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{354809B6-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{354809B6-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{B525A234-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B525A234-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{C152ADCC-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C152ADCC-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{C152ADCC-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{C152ADCC-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{C6C66924-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C6C66924-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{C6C66924-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{C6C66924-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{AFB1D909-86D0-49DE-8BD8-DF89349F934E}.Debug|Win32.ActiveCfg = Debug|Win32
+		{AFB1D909-86D0-49DE-8BD8-DF89349F934E}.Debug|Win32.Build.0 = Debug|Win32
+		{AFB1D909-86D0-49DE-8BD8-DF89349F934E}.Release|Win32.ActiveCfg = Release|Win32
+		{AFB1D909-86D0-49DE-8BD8-DF89349F934E}.Release|Win32.Build.0 = Release|Win32
+		{FB836C59-41E1-48EA-A59B-460AB56587EE}.Debug|Win32.ActiveCfg = Debug|Win32
+		{FB836C59-41E1-48EA-A59B-460AB56587EE}.Debug|Win32.Build.0 = Debug|Win32
+		{FB836C59-41E1-48EA-A59B-460AB56587EE}.Release|Win32.ActiveCfg = Release|Win32
+		{FB836C59-41E1-48EA-A59B-460AB56587EE}.Release|Win32.Build.0 = Release|Win32
+		{9FF2579E-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{9FF2579E-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{9FF2579E-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{9FF2579E-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{C9EC4A56-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C9EC4A56-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{C9EC4A56-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{C9EC4A56-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{DCA407C4-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{DCA407C4-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{DCA407C4-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{DCA407C4-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{B619BB2C-A9AC-453D-BA98-3A8F3217B1AB}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B619BB2C-A9AC-453D-BA98-3A8F3217B1AB}.Debug|Win32.Build.0 = Debug|Win32
+		{B619BB2C-A9AC-453D-BA98-3A8F3217B1AB}.Release|Win32.ActiveCfg = Release|Win32
+		{B619BB2C-A9AC-453D-BA98-3A8F3217B1AB}.Release|Win32.Build.0 = Release|Win32
+		{D3A2882C-410A-4F58-8ACE-A771888073E8}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D3A2882C-410A-4F58-8ACE-A771888073E8}.Debug|Win32.Build.0 = Debug|Win32
+		{D3A2882C-410A-4F58-8ACE-A771888073E8}.Release|Win32.ActiveCfg = Release|Win32
+		{D3A2882C-410A-4F58-8ACE-A771888073E8}.Release|Win32.Build.0 = Release|Win32
+		{D9E130E1-7734-43DF-A7EF-15CD95E467EE}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D9E130E1-7734-43DF-A7EF-15CD95E467EE}.Debug|Win32.Build.0 = Debug|Win32
+		{D9E130E1-7734-43DF-A7EF-15CD95E467EE}.Release|Win32.ActiveCfg = Release|Win32
+		{D9E130E1-7734-43DF-A7EF-15CD95E467EE}.Release|Win32.Build.0 = Release|Win32
+		{E5D3D9AA-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E5D3D9AA-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{E5D3D9AA-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{E5D3D9AA-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{EB22A6B6-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{EB22A6B6-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{EF98F42A-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{EF98F42A-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{EF98F42A-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{EF98F42A-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{031DB868-5294-4738-90BA-F80BB2CEA9DC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{031DB868-5294-4738-90BA-F80BB2CEA9DC}.Debug|Win32.Build.0 = Debug|Win32
+		{031DB868-5294-4738-90BA-F80BB2CEA9DC}.Release|Win32.ActiveCfg = Release|Win32
+		{031DB868-5294-4738-90BA-F80BB2CEA9DC}.Release|Win32.Build.0 = Release|Win32
+		{3D1A94CE-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{3D1A94CE-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{3D1A94CE-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{3D1A94CE-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{F357CF96-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{F357CF96-CF7A-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{F357CF96-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{F357CF96-CF7A-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{8D07389F-F48A-49B9-BED9-F71FCBACC4A8}.Debug|Win32.ActiveCfg = Debug|Win32
+		{8D07389F-F48A-49B9-BED9-F71FCBACC4A8}.Debug|Win32.Build.0 = Debug|Win32
+		{8D07389F-F48A-49B9-BED9-F71FCBACC4A8}.Release|Win32.ActiveCfg = Release|Win32
+		{8D07389F-F48A-49B9-BED9-F71FCBACC4A8}.Release|Win32.Build.0 = Release|Win32
+		{02AD88A0-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{02AD88A0-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{02AD88A0-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{0E838FA8-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{0E838FA8-CF7B-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{0E838FA8-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{0E838FA8-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
+		{F4E88BFA-FC96-439D-9E67-0A92AB541EE0}.Debug|Win32.ActiveCfg = Debug|Win32
+		{F4E88BFA-FC96-439D-9E67-0A92AB541EE0}.Debug|Win32.Build.0 = Debug|Win32
+		{F4E88BFA-FC96-439D-9E67-0A92AB541EE0}.Release|Win32.ActiveCfg = Release|Win32
+		{F4E88BFA-FC96-439D-9E67-0A92AB541EE0}.Release|Win32.Build.0 = Release|Win32
+		{93051962-7797-49F0-8958-BB1CE60FFE6F}.Debug|Win32.ActiveCfg = Debug|Win32
+		{93051962-7797-49F0-8958-BB1CE60FFE6F}.Debug|Win32.Build.0 = Debug|Win32
+		{93051962-7797-49F0-8958-BB1CE60FFE6F}.Release|Win32.ActiveCfg = Release|Win32
+		{93051962-7797-49F0-8958-BB1CE60FFE6F}.Release|Win32.Build.0 = Release|Win32
+		{A66E395B-18EE-4877-8F0D-386A7BBAB370}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A66E395B-18EE-4877-8F0D-386A7BBAB370}.Debug|Win32.Build.0 = Debug|Win32
+		{A66E395B-18EE-4877-8F0D-386A7BBAB370}.Release|Win32.ActiveCfg = Release|Win32
+		{A66E395B-18EE-4877-8F0D-386A7BBAB370}.Release|Win32.Build.0 = Release|Win32
+		{A326A0DF-4F93-4DF6-813D-0B64F98B389F}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A326A0DF-4F93-4DF6-813D-0B64F98B389F}.Debug|Win32.Build.0 = Debug|Win32
+		{A326A0DF-4F93-4DF6-813D-0B64F98B389F}.Release|Win32.ActiveCfg = Release|Win32
+		{A326A0DF-4F93-4DF6-813D-0B64F98B389F}.Release|Win32.Build.0 = Release|Win32
+		{0C234EF0-7725-4BDA-A1C3-47F5835A3837}.Debug|Win32.ActiveCfg = Debug|Win32
+		{0C234EF0-7725-4BDA-A1C3-47F5835A3837}.Debug|Win32.Build.0 = Debug|Win32
+		{0C234EF0-7725-4BDA-A1C3-47F5835A3837}.Release|Win32.ActiveCfg = Release|Win32
+		{0C234EF0-7725-4BDA-A1C3-47F5835A3837}.Release|Win32.Build.0 = Release|Win32
+		{86645C8E-3BBE-4E1E-A8AE-C6990B4ECC64}.Debug|Win32.ActiveCfg = Debug|Win32
+		{86645C8E-3BBE-4E1E-A8AE-C6990B4ECC64}.Debug|Win32.Build.0 = Debug|Win32
+		{86645C8E-3BBE-4E1E-A8AE-C6990B4ECC64}.Release|Win32.ActiveCfg = Release|Win32
+		{86645C8E-3BBE-4E1E-A8AE-C6990B4ECC64}.Release|Win32.Build.0 = Release|Win32
+		{4C517D78-E5B9-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{4C517D78-E5B9-11DA-85E2-A4E5714C712A}.Debug|Win32.Build.0 = Debug|Win32
+		{4C517D78-E5B9-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{C5F98602-E5B9-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C5F98602-E5B9-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{7DF920B2-EFDA-11DA-988C-EBAD6065650A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7DF920B2-EFDA-11DA-988C-EBAD6065650A}.Release|Win32.ActiveCfg = Release|Win32
+		{8CF9FC64-EFDD-11DA-986F-EA05CA2469B6}.Debug|Win32.ActiveCfg = Debug|Win32
+		{8CF9FC64-EFDD-11DA-986F-EA05CA2469B6}.Release|Win32.ActiveCfg = Release|Win32
+		{40062448-EFE0-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{40062448-EFE0-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{55215A1C-EFE2-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{55215A1C-EFE2-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{441F1D0C-EFE3-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{441F1D0C-EFE3-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{8A49554A-EFE3-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{8A49554A-EFE3-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{B0058FA6-EFE3-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B0058FA6-EFE3-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{BFCB4C14-EFE3-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{BFCB4C14-EFE3-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{C0990F5A-EFE3-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C0990F5A-EFE3-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{607116BE-F168-11DA-85E2-A4E5714C712A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{607116BE-F168-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
+		{6260E42E-239D-11DB-9594-FD7021681415}.Debug|Win32.ActiveCfg = Debug|Win32
+		{6260E42E-239D-11DB-9594-FD7021681415}.Release|Win32.ActiveCfg = Release|Win32
+		{408E2482-2623-11DB-9BB9-97600548391D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{408E2482-2623-11DB-9BB9-97600548391D}.Release|Win32.ActiveCfg = Release|Win32
+		{408E2482-2623-11DB-9BB9-97600548391D}.Release|Win32.Build.0 = Release|Win32
+		{FAB7D8D8-C7DD-11DB-930B-CD6B662399AA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{FAB7D8D8-C7DD-11DB-930B-CD6B662399AA}.Release|Win32.ActiveCfg = Release|Win32
+		{5582D8D0-DB93-11DB-930B-CD6B662399AA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{5582D8D0-DB93-11DB-930B-CD6B662399AA}.Release|Win32.ActiveCfg = Release|Win32
+		{5582D8D0-DB93-11DB-930B-CD6B662399AA}.Release|Win32.Build.0 = Release|Win32
+		{C6451C76-DC57-11DB-930B-CD6B662399AA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{C6451C76-DC57-11DB-930B-CD6B662399AA}.Release|Win32.ActiveCfg = Release|Win32
+		{ABE43C46-E1C4-11DB-930B-CD6B662399AA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{ABE43C46-E1C4-11DB-930B-CD6B662399AA}.Release|Win32.ActiveCfg = Release|Win32
+		{ABE43C46-E1C4-11DB-930B-CD6B662399AA}.Release|Win32.Build.0 = Release|Win32
+		{351A8882-FD57-11DB-B29C-A18F012B09DC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{351A8882-FD57-11DB-B29C-A18F012B09DC}.Release|Win32.ActiveCfg = Release|Win32
+		{20D26EE8-E1BA-11DB-930B-CD6B662399AA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{20D26EE8-E1BA-11DB-930B-CD6B662399AA}.Release|Win32.ActiveCfg = Release|Win32
+		{CDFD5FAC-FD70-11DB-B29C-A18F012B09DC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{CDFD5FAC-FD70-11DB-B29C-A18F012B09DC}.Release|Win32.ActiveCfg = Release|Win32
+		{9D059C10-A1AE-11DC-AE66-B7BFA9FB648A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{9D059C10-A1AE-11DC-AE66-B7BFA9FB648A}.Release|Win32.ActiveCfg = Release|Win32
+		{9D059C10-A1AE-11DC-AE66-B7BFA9FB648A}.Release|Win32.Build.0 = Release|Win32
+		{14ECED18-FB38-11DC-8216-8B38A5565D8C}.Debug|Win32.ActiveCfg = Debug|Win32
+		{14ECED18-FB38-11DC-8216-8B38A5565D8C}.Debug|Win32.Build.0 = Debug|Win32
+		{14ECED18-FB38-11DC-8216-8B38A5565D8C}.Release|Win32.ActiveCfg = Release|Win32
+		{14ECED18-FB38-11DC-8216-8B38A5565D8C}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
 	EndGlobalSection
 EndGlobal
diff --git a/win32/virtuoso_odbc_clr_t.vcproj b/win32/virtuoso_odbc_clr_t.vcproj
index 255d7cd..8fed7c2 100644
--- a/win32/virtuoso_odbc_clr_t.vcproj
+++ b/win32/virtuoso_odbc_clr_t.vcproj
@@ -217,6 +217,10 @@
 				RelativePath="..\binsrc\hosting\mono\sql_code_xslt.c"
 				>
 			</File>
+			<File
+				RelativePath=".\virtuoso_t.rc"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Header Files"
diff --git a/win32/virtuoso_odbc_javavm_t.vcproj b/win32/virtuoso_odbc_javavm_t.vcproj
index 1f3a300..e97a780 100644
--- a/win32/virtuoso_odbc_javavm_t.vcproj
+++ b/win32/virtuoso_odbc_javavm_t.vcproj
@@ -41,8 +41,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="3"
-				AdditionalIncludeDirectories=""$(JDK_PATH)\include";..\libsrc\xml.new;..\libsrc;"$(JDK_PATH)\include\win32";..\libsrc\Dk;..\libsrc\util\win32;..\libsrc\Wi;..\libsrc\zlib;..\binsrc\driver;..\libsrc\plugin;..\libsrc\langfunc;..\libsrc\openssl;."
+				Optimization="0"
+				AdditionalIncludeDirectories=""$(JDK_PATH_I386)\include";..\libsrc\xml.new;..\libsrc;"$(JDK_PATH)\include\win32";..\libsrc\Dk;..\libsrc\util\win32;..\libsrc\Wi;..\libsrc\zlib;..\binsrc\driver;..\libsrc\plugin;..\libsrc\langfunc;..\libsrc\openssl;."
 				PreprocessorDefinitions="INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;_CONSOLE;_SSL;YYTOKENTYPE"
 				MinimalRebuild="false"
 				ExceptionHandling="0"
@@ -63,7 +63,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libvirtuoso-t.lib ws2_32.lib libeay32.lib ssleay32.lib "$(JDK_PATH)\lib\jvm.lib""
+				AdditionalDependencies="libvirtuoso-t.lib ws2_32.lib libeay32.lib ssleay32.lib "$(JDK_PATH_I386)\lib\jvm.lib""
 				OutputFile="$(OutDir)/virtuoso-javavm-t.exe"
 				LinkIncremental="0"
 				AdditionalLibraryDirectories="$(ConfigurationName);.\openssl;..\libsrc\openssl"
@@ -123,7 +123,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="3"
-				AdditionalIncludeDirectories=""$(JDK_PATH)\include";..\libsrc\xml.new;..\libsrc;"$(JDK_PATH)\include\win32";..\libsrc\Dk;..\libsrc\util\win32;..\libsrc\Wi;..\libsrc\zlib;..\binsrc\driver;..\libsrc\plugin;..\libsrc\langfunc;..\libsrc\openssl;."
+				AdditionalIncludeDirectories=""$(JDK_PATH_I386)\include";..\libsrc\xml.new;..\libsrc;"$(JDK_PATH)\include\win32";..\libsrc\Dk;..\libsrc\util\win32;..\libsrc\Wi;..\libsrc\zlib;..\binsrc\driver;..\libsrc\plugin;..\libsrc\langfunc;..\libsrc\openssl;."
 				PreprocessorDefinitions="INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;_CONSOLE;_SSL;YYTOKENTYPE"
 				MinimalRebuild="false"
 				ExceptionHandling="0"
@@ -145,7 +145,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="libvirtuoso-t.lib ws2_32.lib libeay32.lib ssleay32.lib "$(JDK_PATH)\lib\jvm.lib""
+				AdditionalDependencies="libvirtuoso-t.lib ws2_32.lib libeay32.lib ssleay32.lib "$(JDK_PATH_I386)\lib\jvm.lib""
 				OutputFile="$(OutDir)/virtuoso-javavm-t.exe"
 				LinkIncremental="0"
 				AdditionalLibraryDirectories="$(ConfigurationName);.\openssl;..\libsrc\openssl"
@@ -208,6 +208,10 @@
 				RelativePath="..\binsrc\tests\biftest\sql_code_xslt.c"
 				>
 			</File>
+			<File
+				RelativePath=".\virtuoso_t.rc"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Header Files"
diff --git a/win32/virtuoso_odbc_sample_t.vcproj b/win32/virtuoso_odbc_sample_t.vcproj
index 0c269c7..85e2c37 100644
--- a/win32/virtuoso_odbc_sample_t.vcproj
+++ b/win32/virtuoso_odbc_sample_t.vcproj
@@ -4,6 +4,7 @@
 	Version="9.00"
 	Name="virtuoso_sample_t"
 	ProjectGUID="{0E838FA8-CF7B-11DA-85E2-A4E5714C712A}"
+	RootNamespace="virtuoso_sample_t"
 	Keyword="Win32Proj"
 	TargetFrameworkVersion="131072"
 	>
@@ -192,6 +193,10 @@
 				RelativePath="..\binsrc\tests\biftest\bif_sample.c"
 				>
 			</File>
+			<File
+				RelativePath=".\virtuoso_t.rc"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Header Files"
diff --git a/win32/virtuoso_odbc_t.vcproj b/win32/virtuoso_odbc_t.vcproj
index 1122279..fb41750 100644
--- a/win32/virtuoso_odbc_t.vcproj
+++ b/win32/virtuoso_odbc_t.vcproj
@@ -46,7 +46,7 @@
 				AdditionalOptions="/Zm200 "
 				Optimization="3"
 				AdditionalIncludeDirectories="..\libsrc\xml.new,..\libsrc,..\libsrc\Dk,..\libsrc\util\win32,..\libsrc\Wi,..\libsrc\zlib,..\binsrc\driver,..\libsrc\plugin,..\libsrc\langfunc,..\libsrc\openssl, ."
-				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG;PACKAGE_VERSION=\"6.1.1\""
+				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG;PACKAGE_VERSION=\"6.1.3\""
 				MinimalRebuild="true"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="1"
@@ -141,7 +141,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="3"
 				AdditionalIncludeDirectories="..\libsrc\xml.new,..\libsrc,..\libsrc\Dk,..\libsrc\util\win32,..\libsrc\Wi,..\libsrc\zlib,..\binsrc\driver,..\libsrc\plugin,..\libsrc\langfunc,..\libsrc\openssl, ."
-				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG;PACKAGE_VERSION=\"6.1.1\""
+				PreprocessorDefinitions="PACKAGE_VERSION=\"6.1.3\";_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG"
 				MinimalRebuild="false"
 				ExceptionHandling="0"
 				BasicRuntimeChecks="0"
@@ -219,6 +219,18 @@
 				>
 			</File>
 			<File
+				RelativePath=".\virtuoso_t.rc"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCResourceCompilerTool"
+						Culture="1033"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
 				RelativePath="..\binsrc\virtuoso\viwin32.c"
 				>
 			</File>
@@ -227,11 +239,19 @@
 			Name="Header Files"
 			Filter="h;hpp;hxx;hm;inl"
 			>
+			<File
+				RelativePath=".\resource.h"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Resource Files"
 			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
 			>
+			<File
+				RelativePath="..\binsrc\virtuoso\viwin32.ico"
+				>
+			</File>
 		</Filter>
 	</Files>
 	<Globals>
diff --git a/win32/wi.vcproj b/win32/wi.vcproj
index 6c637f0..24fecfa 100644
--- a/win32/wi.vcproj
+++ b/win32/wi.vcproj
@@ -1,56 +1,56 @@
 <?xml version="1.0" encoding="windows-1251"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="9.00"
+	Version="9.00"
 	Name="wi"
 	ProjectGUID="{93051962-7797-49F0-8958-BB1CE60FFE6F}"
 	RootNamespace="wi"
-	TargetFrameworkVersion="131072"
-	>
+	TargetFrameworkVersion="131072"
+	>
 	<Platforms>
 		<Platform
-			Name="Win32"
-		/>
+			Name="Win32"
+		/>
 	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
+	<ToolFiles>
+	</ToolFiles>
 	<Configurations>
 		<Configuration
 			Name="Release|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)\wi"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalOptions=""
 				Optimization="3"
 				AdditionalIncludeDirectories="..\libsrc\zlib;..\libsrc\xml.new;..\libsrc;..\libsrc\Dk;..\libsrc\util\win32;..\libsrc\Wi;..\libsrc\plugin;..\libsrc\langfunc;..\libsrc\tidy;..\binsrc\driver;."
-				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG;YY_NO_UNISTD_H;PCRE_STATIC"
-				MinimalRebuild="false"
+				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG;YY_NO_UNISTD_H;PCRE_STATIC;OLD_TIDY"
+				MinimalRebuild="false"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="0"
-				BufferSecurityCheck="false"
-				EnableFunctionLevelLinking="false"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="false"
 				UsePrecompiledHeader="0"
 				PrecompiledHeaderFile="$(ConfigurationName)\wi/wi.pch"
 				AssemblerListingLocation="$(ConfigurationName)\wi/"
@@ -58,122 +58,122 @@
 				ProgramDataBaseFileName="$(ConfigurationName)\wi/"
 				BrowseInformation="0"
 				WarningLevel="3"
-				SuppressStartupBanner="true"
+				SuppressStartupBanner="true"
 				DebugInformationFormat="0"
 				CompileAs="0"
-				UndefinePreprocessorDefinitions="YYDEBUG"
-			/>
+				UndefinePreprocessorDefinitions="YYDEBUG"
+			/>
 			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
+				Name="VCManagedResourceCompilerTool"
+			/>
 			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions=""
-				Culture="1049"
-			/>
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions=""
+				Culture="1049"
+			/>
 			<Tool
-				Name="VCPreLinkEventTool"
-			/>
+				Name="VCPreLinkEventTool"
+			/>
 			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="$(ConfigurationName)\wi.lib"
-				SuppressStartupBanner="true"
-			/>
+				Name="VCLibrarianTool"
+				OutputFile="$(ConfigurationName)\wi.lib"
+				SuppressStartupBanner="true"
+			/>
 			<Tool
-				Name="VCALinkTool"
-			/>
+				Name="VCALinkTool"
+			/>
 			<Tool
-				Name="VCXDCMakeTool"
-			/>
+				Name="VCXDCMakeTool"
+			/>
 			<Tool
-				Name="VCBscMakeTool"
-			/>
+				Name="VCBscMakeTool"
+			/>
 			<Tool
-				Name="VCFxCopTool"
-			/>
+				Name="VCFxCopTool"
+			/>
 			<Tool
-				Name="VCPostBuildEventTool"
-			/>
+				Name="VCPostBuildEventTool"
+			/>
 		</Configuration>
 		<Configuration
 			Name="Debug|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)\wi"
 			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
 			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalOptions="/Zm200 "
 				Optimization="3"
 				AdditionalIncludeDirectories="..\libsrc\zlib;..\libsrc\xml.new;..\libsrc;..\libsrc\Dk;..\libsrc\util\win32;..\libsrc\Wi;..\libsrc\plugin;..\libsrc\langfunc;..\libsrc\tidy;..\binsrc\driver;."
 				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;YY_NO_UNISTD_H;PCRE_STATIC"
-				MinimalRebuild="true"
+				MinimalRebuild="true"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="1"
-				BufferSecurityCheck="false"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="0"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
 				PrecompiledHeaderFile="$(ConfigurationName)\wi/wi.pch"
 				AssemblerListingLocation="$(ConfigurationName)\wi/"
 				ObjectFile="$(ConfigurationName)\wi/"
 				ProgramDataBaseFileName="$(ConfigurationName)\wi/"
 				BrowseInformation="1"
 				WarningLevel="3"
-				SuppressStartupBanner="true"
+				SuppressStartupBanner="true"
 				DebugInformationFormat="3"
 				CompileAs="0"
-				UndefinePreprocessorDefinitions="YYDEBUG"
-			/>
+				UndefinePreprocessorDefinitions="YYDEBUG"
+			/>
 			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
+				Name="VCManagedResourceCompilerTool"
+			/>
 			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions=""
-				Culture="1049"
-			/>
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions=""
+				Culture="1049"
+			/>
 			<Tool
-				Name="VCPreLinkEventTool"
-			/>
+				Name="VCPreLinkEventTool"
+			/>
 			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="$(ConfigurationName)\wi.lib"
-				SuppressStartupBanner="true"
-			/>
+				Name="VCLibrarianTool"
+				OutputFile="$(ConfigurationName)\wi.lib"
+				SuppressStartupBanner="true"
+			/>
 			<Tool
-				Name="VCALinkTool"
-			/>
+				Name="VCALinkTool"
+			/>
 			<Tool
-				Name="VCXDCMakeTool"
-			/>
+				Name="VCXDCMakeTool"
+			/>
 			<Tool
-				Name="VCBscMakeTool"
-			/>
+				Name="VCBscMakeTool"
+			/>
 			<Tool
-				Name="VCFxCopTool"
-			/>
+				Name="VCFxCopTool"
+			/>
 			<Tool
-				Name="VCPostBuildEventTool"
-			/>
+				Name="VCPostBuildEventTool"
+			/>
 		</Configuration>
 	</Configurations>
 	<References>
@@ -181,1612 +181,1608 @@
 	<Files>
 		<Filter
 			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-			>
+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+			>
+			<File
+				RelativePath="..\libsrc\Wi\2pc.c"
+				>
+			</File>
 			<File
-				RelativePath="..\libsrc\Wi\2pc.c"
-				>
+				RelativePath="..\libsrc\Wi\aqueue.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\aqueue.c"
-				>
+				RelativePath="..\libsrc\Wi\arith.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\arith.c"
-				>
+				RelativePath="..\libsrc\Wi\auxfiles.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\auxfiles.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_audio.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_audio.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_crypto.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_crypto.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_date.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_date.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_dav.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_dav.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_diff.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_diff.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_explain.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_explain.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_file.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_file.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_gnw.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_gnw.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_imap.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_intl.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_intl.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_json.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_json.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_kerberoscli.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_kerberoscli.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_ldapcli.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_ldapcli.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
 						Optimization="0"
-					/>
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_mts.c"
-				>
-			</File>
-			<File
-				RelativePath="..\libsrc\Wi\bif_nntp.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_mts.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_phrasematch.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_nntp.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_pop3.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_phrasematch.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_regexp.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_pop3.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_repl.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_regexp.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_smtp.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_repl.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_soap.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_smtp.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_text.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_soap.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_tidy.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_text.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_uuencode.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_tidy.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_xml.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_uuencode.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_xper.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_xml.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bitmap.c"
-				>
+				RelativePath="..\libsrc\Wi\bif_xper.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\blob.c"
-				>
+				RelativePath="..\libsrc\Wi\bitmap.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\blobio.c"
-				>
+				RelativePath="..\libsrc\Wi\blob.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\cl_stubs.c"
-				>
+				RelativePath="..\libsrc\Wi\blobio.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\crypt.c"
-				>
+				RelativePath="..\libsrc\Wi\cl_stubs.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\datesupp.c"
-				>
+				RelativePath="..\libsrc\Wi\crypt.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\ddlrun.c"
-				>
+				RelativePath="..\libsrc\Wi\datesupp.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\disk.c"
-				>
+				RelativePath="..\libsrc\Wi\ddlrun.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\dks_esc.c"
-				>
+				RelativePath="..\libsrc\Wi\disk.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\eqlcomp.c"
-				>
+				RelativePath="..\libsrc\Wi\dks_esc.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\extent.c"
-				>
+				RelativePath="..\libsrc\Wi\eqlcomp.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\gate.c"
-				>
+				RelativePath="..\libsrc\Wi\extent.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\hash.c"
-				>
+				RelativePath="..\libsrc\Wi\gate.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\hosting.c"
-				>
+				RelativePath="..\libsrc\Wi\hash.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\http.c"
-				>
+				RelativePath="..\libsrc\Wi\hosting.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\http_client.c"
-				>
+				RelativePath="..\libsrc\Wi\http.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\insert.c"
-				>
+				RelativePath="..\libsrc\Wi\http_client.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\inxop.c"
-				>
+				RelativePath="..\libsrc\Wi\insert.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\jso.c"
-				>
+				RelativePath="..\libsrc\Wi\inxop.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\json_l.c"
-				>
+				RelativePath="..\libsrc\Wi\jso.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\json_p.c"
-				>
+				RelativePath="..\libsrc\Wi\json_l.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\lisprdr.c"
-				>
+				RelativePath="..\libsrc\Wi\json_p.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\lock.c"
-				>
+				RelativePath="..\libsrc\Wi\lisprdr.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\log.c"
-				>
+				RelativePath="..\libsrc\Wi\lock.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\map_schema.c"
-				>
+				RelativePath="..\libsrc\Wi\log.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\map_schema.h"
-				>
+				RelativePath="..\libsrc\Wi\map_schema.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\meta.c"
-				>
+				RelativePath="..\libsrc\Wi\map_schema.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\mtwrite.c"
-				>
+				RelativePath="..\libsrc\Wi\meta.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\multibyte.c"
-				>
+				RelativePath="..\libsrc\Wi\mtwrite.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\neodisk.c"
-				>
+				RelativePath="..\libsrc\Wi\multibyte.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\nquad_p.c"
-				>
+				RelativePath="..\libsrc\Wi\neodisk.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\numeric.c"
-				>
+				RelativePath="..\libsrc\Wi\nquad_p.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\obackup.c"
-				>
+				RelativePath="..\libsrc\Wi\numeric.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\odbccat.c"
-				>
+				RelativePath="..\libsrc\Wi\obackup.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\page.c"
-				>
+				RelativePath="..\libsrc\Wi\odbccat.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\pldebug.c"
-				>
+				RelativePath="..\libsrc\Wi\page.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\plugin_loader.c"
-				>
+				RelativePath="..\libsrc\Wi\pldebug.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\rdf_core.c"
-				>
+				RelativePath="..\libsrc\Wi\plugin_loader.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\rdf_mapping_jso.c"
-				>
+				RelativePath="..\libsrc\Wi\rdf_core.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\rdfbox.c"
-				>
+				RelativePath="..\libsrc\Wi\rdf_mapping_jso.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\rdfinf.c"
-				>
+				RelativePath="..\libsrc\Wi\rdfbox.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\rdfxml_parser.c"
-				>
+				RelativePath="..\libsrc\Wi\rdfinf.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\recovery.c"
-				>
+				RelativePath="..\libsrc\Wi\rdfxml_parser.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\regist.c"
-				>
+				RelativePath="..\libsrc\Wi\recovery.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\repldb.c"
-				>
+				RelativePath="..\libsrc\Wi\regist.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\replpush.c"
-				>
+				RelativePath="..\libsrc\Wi\rltrx.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\replsri.c"
-				>
+				RelativePath="..\libsrc\Wi\row.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\replsub.c"
-				>
+				RelativePath="..\libsrc\Wi\schspace.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\rltrx.c"
-				>
+				RelativePath="..\libsrc\Wi\scn3_vsnet.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\row.c"
-				>
+				RelativePath="..\libsrc\Wi\search.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\schspace.c"
-				>
+				RelativePath="..\libsrc\Wi\search_in.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\scn3_vsnet.c"
-				>
+				RelativePath="..\libsrc\Wi\security.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\search.c"
-				>
+				RelativePath="..\libsrc\Wi\shcompo.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\search_in.c"
-				>
+				RelativePath="..\libsrc\Wi\shuric.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\security.c"
-				>
+				RelativePath="..\libsrc\Wi\sort.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\shcompo.c"
-				>
+				RelativePath="..\libsrc\Wi\space.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\shuric.c"
-				>
+				RelativePath="..\libsrc\Wi\sparql2sql.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sort.c"
-				>
+				RelativePath="..\libsrc\Wi\sparql2sqltext.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\space.c"
-				>
+				RelativePath="..\libsrc\Wi\sparql_core.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparql2sql.c"
-				>
+				RelativePath="..\libsrc\Wi\sparql_l.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparql2sqltext.c"
-				>
+				RelativePath="..\libsrc\Wi\sparql_p.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparql_core.c"
-				>
+				RelativePath="..\libsrc\Wi\sparql_qm.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparql_l.c"
-				>
+				RelativePath="..\libsrc\Wi\sparql_rdb2rdf.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparql_p.c"
-				>
+				RelativePath="..\libsrc\Wi\sparql_sff.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparql_qm.c"
-				>
+				RelativePath="..\libsrc\Wi\sparql_tree.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparql_sff.c"
-				>
+				RelativePath="..\libsrc\Wi\sparqld.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparql_tree.c"
-				>
+				RelativePath="..\libsrc\Wi\sparul2sql.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparqld.c"
-				>
+				RelativePath="..\libsrc\Wi\sql3_vc.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparul2sql.c"
-				>
-			</File>
-			<File
-				RelativePath="..\libsrc\Wi\sql3_vc.c"
-				>
-			</File>
-			<File
-				RelativePath="..\libsrc\Wi\sql_code.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_1.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_1.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_2pc.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_2pc.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_adm.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_adm.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_auto.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_auto.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_blog.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_blog.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_cache.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_cache.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_cache_impl.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_cache_impl.c"
+				>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_dav.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_dav.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_dbp.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_dbp.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_ddk.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_ddk.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_imsg.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_imsg.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_pldbg.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_pldbg.c"
+				>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_repl.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_repl.c"
+				>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_sparql.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_sparql.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_sys.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_sys.c"
+				>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_uddi.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_uddi.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_vad.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_vad.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_vdb.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_vdb.c"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_code_ws.c"
-				>
+				RelativePath="..\libsrc\Wi\sql_code_ws.c"
+				>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCLCompilerTool"
-						Optimization="0"
-					/>
+						Optimization="0"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlbif.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlbif.c"
+				>
+			</File>
+			<File
+				RelativePath="..\libsrc\Wi\sqlbif2.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlbif2.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlcomp.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlcomp.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlcomp2.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlcomp2.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlcost.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlcost.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlcr.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlcr.c"
-				>
+				RelativePath="..\libsrc\Wi\sqldf.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqldf.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlexp.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlexp.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlgen.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlgen.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlhash.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlhash.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlintrp.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlintrp.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlinx.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlinx.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlo.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlo.c"
-				>
+				RelativePath="..\libsrc\Wi\sqloby.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqloby.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlocr.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlocr.c"
-				>
+				RelativePath="..\libsrc\Wi\sqloinv.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqloinv.c"
-				>
+				RelativePath="..\libsrc\Wi\sqloinx.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqloinx.c"
-				>
+				RelativePath="..\libsrc\Wi\sqloprt.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqloprt.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlorder.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlorder.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlovdb.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlovdb.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlpfn.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlpfn.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlprocc.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlprocc.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlprt.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlprt.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlrbuf.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlrbuf.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlrcomp.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlrcomp.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlrrun.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlrrun.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlrun.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlrun.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlsrv.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlsrv.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlstmts.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlstmts.c"
-				>
+				RelativePath="..\libsrc\Wi\sqltrig.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqltrig.c"
-				>
+				RelativePath="..\libsrc\Wi\sqltype.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqltype.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlver.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlver.c"
-				>
+				RelativePath="..\libsrc\Wi\sqlview.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlview.c"
-				>
+				RelativePath="..\libsrc\Wi\srvcr.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\srvcr.c"
-				>
+				RelativePath="..\libsrc\Wi\srvmultibyte.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\srvmultibyte.c"
-				>
+				RelativePath="..\libsrc\Wi\srvstat.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\srvstat.c"
-				>
+				RelativePath="..\libsrc\Wi\string.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\string.c"
-				>
+				RelativePath="..\libsrc\Wi\subseq.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\subseq.c"
-				>
+				RelativePath="..\libsrc\Wi\text.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\text.c"
-				>
+				RelativePath="..\libsrc\Wi\trans.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\trans.c"
-				>
+				RelativePath="..\libsrc\Wi\turtle_l.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\turtle_l.c"
-				>
+				RelativePath="..\libsrc\Wi\turtle_p.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\turtle_p.c"
-				>
+				RelativePath="..\libsrc\Wi\uname_const_decl.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\update.c"
-				>
+				RelativePath="..\libsrc\Wi\update.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\uuencode.c"
-				>
+				RelativePath="..\libsrc\Wi\uuencode.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\wi_xid.c"
-				>
+				RelativePath="..\libsrc\Wi\wi_xid.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\wirpc.c"
-				>
+				RelativePath="..\libsrc\Wi\wirpc.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\wiservic.c"
-				>
+				RelativePath="..\libsrc\Wi\wiservic.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xmlenc-dec.c"
-				>
+				RelativePath="..\libsrc\Wi\xmlenc-dec.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xmlenc.c"
-				>
+				RelativePath="..\libsrc\Wi\xmlenc.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xmlenc_algos.c"
-				>
+				RelativePath="..\libsrc\Wi\xmlenc_algos.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xmllazy.c"
-				>
+				RelativePath="..\libsrc\Wi\xmllazy.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xmlschema.c"
-				>
+				RelativePath="..\libsrc\Wi\xmlschema.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xmlsearch.c"
-				>
+				RelativePath="..\libsrc\Wi\xmlsearch.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xmlsql.c"
-				>
+				RelativePath="..\libsrc\Wi\xmlsql.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xmltree.c"
-				>
+				RelativePath="..\libsrc\Wi\xmltree.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xpath.c"
-				>
+				RelativePath="..\libsrc\Wi\xpath.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xpathp.c"
-				>
+				RelativePath="..\libsrc\Wi\xpathp.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xpf.c"
-				>
+				RelativePath="..\libsrc\Wi\xpf.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xpscn_vsnet.c"
-				>
+				RelativePath="..\libsrc\Wi\xpscn_vsnet.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xqf.c"
-				>
+				RelativePath="..\libsrc\Wi\xqf.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xslt.c"
-				>
+				RelativePath="..\libsrc\Wi\xslt.c"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xslt_fmt.c"
-				>
-			</File>
-			<File
-				RelativePath="..\libsrc\Wi\xslt_opt.c"
-				>
+				RelativePath="..\libsrc\Wi\xslt_fmt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\libsrc\Wi\xslt_opt.c"
+				>
 			</File>
 		</Filter>
 		<Filter
 			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl"
-			>
+			Filter="h;hpp;hxx;hm;inl"
+			>
 			<File
-				RelativePath="..\libsrc\Wi\2pc.h"
-				>
+				RelativePath="..\libsrc\Wi\2pc.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\2pc_client.h"
-				>
+				RelativePath="..\libsrc\Wi\2pc_client.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\arith.h"
-				>
+				RelativePath="..\libsrc\Wi\arith.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_text.h"
-				>
+				RelativePath="..\libsrc\Wi\bif_text.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\bif_xper.h"
-				>
+				RelativePath="..\libsrc\Wi\bif_xper.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\blobio.h"
-				>
+				RelativePath="..\libsrc\Wi\blobio.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\CLI.h"
-				>
+				RelativePath="..\libsrc\Wi\CLI.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\crsr.h"
-				>
+				RelativePath="..\libsrc\Wi\crsr.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\date.h"
-				>
+				RelativePath="..\libsrc\Wi\date.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\datesupp.h"
-				>
+				RelativePath="..\libsrc\Wi\datesupp.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\eqlcomp.h"
-				>
+				RelativePath="..\libsrc\Wi\eqlcomp.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\http.h"
-				>
+				RelativePath="..\libsrc\Wi\http.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\iodbcinst.h"
-				>
+				RelativePath="..\libsrc\Wi\iodbcinst.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\ksrvext.h"
-				>
+				RelativePath="..\libsrc\Wi\ksrvext.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\license.h"
-				>
+				RelativePath="..\libsrc\Wi\license.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\lisprdr.h"
-				>
+				RelativePath="..\libsrc\Wi\lisprdr.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\list2.h"
-				>
+				RelativePath="..\libsrc\Wi\list2.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\log.h"
-				>
+				RelativePath="..\libsrc\Wi\log.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\ltrx.h"
-				>
+				RelativePath="..\libsrc\Wi\ltrx.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\mts.h"
-				>
+				RelativePath="..\libsrc\Wi\mts.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\mts_client.h"
-				>
+				RelativePath="..\libsrc\Wi\mts_client.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\mts_com.h"
-				>
+				RelativePath="..\libsrc\Wi\mts_com.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\multibyte.h"
-				>
+				RelativePath="..\libsrc\Wi\multibyte.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\numeric.h"
-				>
+				RelativePath="..\libsrc\Wi\numeric.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\odbcinc.h"
-				>
+				RelativePath="..\libsrc\Wi\odbcinc.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\remote.h"
-				>
+				RelativePath="..\libsrc\Wi\remote.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\repl.h"
-				>
+				RelativePath="..\libsrc\Wi\repl.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\replsr.h"
-				>
+				RelativePath="..\libsrc\Wi\replsr.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\security.h"
-				>
+				RelativePath="..\libsrc\Wi\security.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparql.h"
-				>
+				RelativePath="..\libsrc\Wi\sparql.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparql_p.h"
-				>
+				RelativePath="..\libsrc\Wi\sparql_p.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql3.h"
-				>
+				RelativePath="..\libsrc\Wi\sql3.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlbif.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlbif.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlcmps.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlcmps.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlcomp.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlcomp.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlfn.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlfn.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlintrp.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlintrp.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlnode.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlnode.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlo.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlo.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlocr.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlocr.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlofn.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlofn.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlopcod.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlopcod.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlpar.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlpar.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlparext.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlparext.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlpfn.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlpfn.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlrcomp.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlrcomp.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqltype.h"
-				>
+				RelativePath="..\libsrc\Wi\sqltype.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqltype_c.h"
-				>
+				RelativePath="..\libsrc\Wi\sqltype_c.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlver.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlver.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlwords.h"
-				>
+				RelativePath="..\libsrc\Wi\sqlwords.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\srvmultibyte.h"
-				>
+				RelativePath="..\libsrc\Wi\srvmultibyte.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\text.h"
-				>
+				RelativePath="..\libsrc\Wi\text.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\turtle_p.h"
-				>
+				RelativePath="..\libsrc\Wi\turtle_p.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\uuencode_impl.h"
-				>
+				RelativePath="..\libsrc\Wi\uuencode_impl.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\virtext.h"
-				>
+				RelativePath="..\libsrc\Wi\virtext.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\wi.h"
-				>
+				RelativePath="..\libsrc\Wi\wi.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\widd.h"
-				>
+				RelativePath="..\libsrc\Wi\widd.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\widisk.h"
-				>
+				RelativePath="..\libsrc\Wi\widisk.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\widv.h"
-				>
+				RelativePath="..\libsrc\Wi\widv.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\wifn.h"
-				>
+				RelativePath="..\libsrc\Wi\wifn.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\wiservic.h"
-				>
+				RelativePath="..\libsrc\Wi\wiservic.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xml.h"
-				>
+				RelativePath="..\libsrc\Wi\xml.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xmlgen.h"
-				>
+				RelativePath="..\libsrc\Wi\xmlgen.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xmlnode.h"
-				>
+				RelativePath="..\libsrc\Wi\xmlnode.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xmlres.h"
-				>
+				RelativePath="..\libsrc\Wi\xmlres.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xmltree.h"
-				>
+				RelativePath="..\libsrc\Wi\xmltree.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xpath.h"
-				>
+				RelativePath="..\libsrc\Wi\xpath.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xpathp.h"
-				>
+				RelativePath="..\libsrc\Wi\xpathp.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xpathp_impl.h"
-				>
+				RelativePath="..\libsrc\Wi\xpathp_impl.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xpf.h"
-				>
+				RelativePath="..\libsrc\Wi\xpf.h"
+				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xqf.h"
-				>
+				RelativePath="..\libsrc\Wi\xqf.h"
+				>
 			</File>
 		</Filter>
 		<Filter
 			Name="PreBuild"
-			>
+			>
 			<File
-				RelativePath="..\libsrc\Wi\json.l"
-				>
+				RelativePath="..\libsrc\Wi\json.l"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f json_l.c&#x0D;&#x0A;flex -Pjsonyy -ojson_l.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f json_l.c&#x0D;&#x0A;flex -Pjsonyy -ojson_l.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						AdditionalDependencies="$(InputDir)json_p.h"
-						Outputs="$(InputDir)json_l.c"
-					/>
+						Outputs="$(InputDir)json_l.c"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f json_l.c&#x0D;&#x0A;flex -Pjsonyy -ojson_l.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f json_l.c&#x0D;&#x0A;flex -Pjsonyy -ojson_l.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						AdditionalDependencies="$(InputDir)json_p.h"
-						Outputs="$(InputDir)json_l.c"
-					/>
+						Outputs="$(InputDir)json_l.c"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\json.y"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f json_p.c&#x0D;&#x0A;rm -f json_p.h&#x0D;&#x0A;bison -y -vd -pjsonyy json.y -ojson_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)json_p.c;$(InputDir)json_p.h"
-					/>
-				</FileConfiguration>
+				RelativePath="..\libsrc\Wi\json.y"
+				>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f json_p.c&#x0D;&#x0A;rm -f json_p.h&#x0D;&#x0A;bison -y -vd -pjsonyy json.y -ojson_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)json_p.c;$(InputDir)json_p.h"
-					/>
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f json_p.c&#x0D;&#x0A;rm -f json_p.h&#x0D;&#x0A;bison -y -vd -pjsonyy json.y -ojson_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)json_p.c;$(InputDir)json_p.h"
+					/>
 				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\libsrc\Wi\nquad_p.y"
-				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f json_p.c&#x0D;&#x0A;rm -f json_p.h&#x0D;&#x0A;bison -y -vd -pjsonyy json.y -ojson_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)json_p.c;$(InputDir)json_p.h"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\libsrc\Wi\nquad_p.y"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f nquad_p.c&#x0D;&#x0A;rm -f nquad_p.h&#x0D;&#x0A;bison -y -vd -pnqyy nquad_p.y -onquad_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)nquad_p.c;$(InputDir)nquad_p.h"
-					/>
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f nquad_p.c&#x0D;&#x0A;rm -f nquad_p.h&#x0D;&#x0A;bison -y -vd -pnqyy nquad_p.y -onquad_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)nquad_p.c;$(InputDir)nquad_p.h"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\scn3.l"
-				>
+				RelativePath="..\libsrc\Wi\scn3.l"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f scn3_vsnet.c&#x0D;&#x0A;flex -oscn3_vsnet.c $(InputPath)&#x0D;&#x0A;flex -Pscn3splityy -oscn3split.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f scn3_vsnet.c&#x0D;&#x0A;flex -oscn3_vsnet.c $(InputPath)&#x0D;&#x0A;flex -Pscn3splityy -oscn3split.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						AdditionalDependencies="$(InputDir)sql3.h"
-						Outputs="$(InputDir)scn3_vsnet.c;$(InputDir)scn3split.c"
-					/>
+						Outputs="$(InputDir)scn3_vsnet.c;$(InputDir)scn3split.c"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f scn3_vsnet.c&#x0D;&#x0A;flex -oscn3_vsnet.c $(InputPath)&#x0D;&#x0A;flex -Pscn3splityy -oscn3split.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f scn3_vsnet.c&#x0D;&#x0A;flex -oscn3_vsnet.c $(InputPath)&#x0D;&#x0A;flex -Pscn3splityy -oscn3split.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						AdditionalDependencies="$(InputDir)sql3.h"
-						Outputs="$(InputDir)scn3_vsnet.c;$(InputDir)scn3split.c"
-					/>
+						Outputs="$(InputDir)scn3_vsnet.c;$(InputDir)scn3split.c"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparql_l.l"
-				>
+				RelativePath="..\libsrc\Wi\sparql_l.l"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f sparql_l.c&#x0D;&#x0A;flex -8 -Psparyy -osparql_l.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f sparql_l.c&#x0D;&#x0A;flex -8 -Psparyy -osparql_l.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						AdditionalDependencies="$(InputDir)sparql_p.h"
-						Outputs="$(InputDir)sparql_l.c"
-					/>
+						Outputs="$(InputDir)sparql_l.c"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f sparql_l.c&#x0D;&#x0A;flex -8 -Psparyy -osparql_l.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f sparql_l.c&#x0D;&#x0A;flex -8 -Psparyy -osparql_l.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						AdditionalDependencies="$(InputDir)sparql_p.h"
-						Outputs="$(InputDir)sparql_l.c"
-					/>
+						Outputs="$(InputDir)sparql_l.c"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sparql_p.y"
-				>
+				RelativePath="..\libsrc\Wi\sparql_p.y"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f sparql_p.c&#x0D;&#x0A;rm -f sparql_p.h&#x0D;&#x0A;bison -y -vd -psparyy sparql_p.y -osparql_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)sparql_p.c;$(InputDir)sparql_p.h"
-					/>
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f sparql_p.c&#x0D;&#x0A;rm -f sparql_p.h&#x0D;&#x0A;bison -y -vd -psparyy sparql_p.y -osparql_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)sparql_p.c;$(InputDir)sparql_p.h"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f sparql_p.c&#x0D;&#x0A;rm -f sparql_p.h&#x0D;&#x0A;bison -y -vd -psparyy sparql_p.y -osparql_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)sparql_p.c;$(InputDir)sparql_p.h"
-					/>
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f sparql_p.c&#x0D;&#x0A;rm -f sparql_p.h&#x0D;&#x0A;bison -y -vd -psparyy sparql_p.y -osparql_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)sparql_p.c;$(InputDir)sparql_p.h"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql3.y"
-				>
+				RelativePath="..\libsrc\Wi\sql3.y"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f sql3.c&#x0D;&#x0A;rm -f sql3.h&#x0D;&#x0A;bison -y  -vd sql3.y -osql3.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)sql3.c;$(InputDir)sql3.h"
-					/>
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f sql3.c&#x0D;&#x0A;rm -f sql3.h&#x0D;&#x0A;bison -y  -vd sql3.y -osql3.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)sql3.c;$(InputDir)sql3.h"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f sql3.c&#x0D;&#x0A;rm -f sql3.h&#x0D;&#x0A;bison -y  -vd sql3.y -osql3.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)sql3.c;$(InputDir)sql3.h"
-					/>
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f sql3.c&#x0D;&#x0A;rm -f sql3.h&#x0D;&#x0A;bison -y  -vd sql3.y -osql3.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)sql3.c;$(InputDir)sql3.h"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sql_to_c.awk"
-				>
+				RelativePath="..\libsrc\Wi\sql_to_c.awk"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;$(ProjectDir)\sqlcode.bat&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;$(ProjectDir)\sqlcode.bat&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						AdditionalDependencies="$(InputDir)\..\..\binsrc\vspx\vspx.xsl"
-						Outputs="$(InputDir)\sql_code.c;$(InputDir)\sql_code_1.c;$(InputDir)\sql_code_ddk.c;$(InputDir)\sql_code_adm.c;$(InputDir)\sql_code_dav.c;$(InputDir)\sql_code_vad.c;$(InputDir)\sql_code_dbp.c;$(InputDir)\sql_code_uddi.c;$(InputDir)\sql_code_imsg.c;$(InputDir)\sql_code_auto.c;$(InputDir)\sql_code_2pc.c;$(InputDir)\rdf_mapping_jso.h;$(InputDir)\rdf_mapping_jso.c;$(InputDir)\rdf_mapping_jso.ttl;$(InputDir)\rdf_mapping_jso.ttl-sample"
-					/>
+						Outputs="$(InputDir)\sql_code.c;$(InputDir)\sql_code_1.c;$(InputDir)\sql_code_ddk.c;$(InputDir)\sql_code_adm.c;$(InputDir)\sql_code_dav.c;$(InputDir)\sql_code_vad.c;$(InputDir)\sql_code_dbp.c;$(InputDir)\sql_code_uddi.c;$(InputDir)\sql_code_imsg.c;$(InputDir)\sql_code_auto.c;$(InputDir)\sql_code_2pc.c;$(InputDir)\rdf_mapping_jso.h;$(InputDir)\rdf_mapping_jso.c;$(InputDir)\rdf_mapping_jso.ttl;$(InputDir)\rdf_mapping_jso.ttl-sample"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;$(ProjectDir)\sqlcode.bat&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;$(ProjectDir)\sqlcode.bat&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						AdditionalDependencies="$(InputDir)\..\..\binsrc\vspx\vspx.xsl"
-						Outputs="$(InputDir)\sql_code.c;$(InputDir)\sql_code_1.c;$(InputDir)\sql_code_ddk.c;$(InputDir)\sql_code_adm.c;$(InputDir)\sql_code_dav.c;$(InputDir)\sql_code_vad.c;$(InputDir)\sql_code_dbp.c;$(InputDir)\sql_code_uddi.c;$(InputDir)\sql_code_imsg.c;$(InputDir)\sql_code_auto.c;$(InputDir)\sql_code_2pc.c;$(InputDir)\rdf_mapping_jso.h;$(InputDir)\rdf_mapping_jso.c;$(InputDir)\rdf_mapping_jso.ttl;$(InputDir)\rdf_mapping_jso.ttl-sample"
-					/>
+						Outputs="$(InputDir)\sql_code.c;$(InputDir)\sql_code_1.c;$(InputDir)\sql_code_ddk.c;$(InputDir)\sql_code_adm.c;$(InputDir)\sql_code_dav.c;$(InputDir)\sql_code_vad.c;$(InputDir)\sql_code_dbp.c;$(InputDir)\sql_code_uddi.c;$(InputDir)\sql_code_imsg.c;$(InputDir)\sql_code_auto.c;$(InputDir)\sql_code_2pc.c;$(InputDir)\rdf_mapping_jso.h;$(InputDir)\rdf_mapping_jso.c;$(InputDir)\rdf_mapping_jso.ttl;$(InputDir)\rdf_mapping_jso.ttl-sample"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\sqlwords.gperf"
-				>
+				RelativePath="..\libsrc\Wi\sqlwords.gperf"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="cd $(InputDir)&#x0D;&#x0A;rm -f sqlwords.h&#x0D;&#x0A;gperf -aCDGptr -Kkeiiyword -L ANSI-C -k1,2,3,6,9,$ sqlwords.gperf -Nlex_hash_kw | sed -e 's/char \*keyword/char *keiiyword/g' >sqlwords.h&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)\sqlwords.h"
-					/>
+						CommandLine="cd $(InputDir)&#x0D;&#x0A;rm -f sqlwords.h&#x0D;&#x0A;gperf -aCDGptr -Kkeiiyword -L ANSI-C -k1,2,3,6,9,$ sqlwords.gperf -Nlex_hash_kw | sed -e 's/char \*keyword/char *keiiyword/g' >sqlwords.h&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)\sqlwords.h"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="cd $(InputDir)&#x0D;&#x0A;rm -f sqlwords.h&#x0D;&#x0A;gperf -aCDGptr -Kkeiiyword -L ANSI-C -k1,2,3,6,9,$ sqlwords.gperf -Nlex_hash_kw | sed -e 's/char \*keyword/char *keiiyword/g' >sqlwords.h&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)\sqlwords.h"
-					/>
+						CommandLine="cd $(InputDir)&#x0D;&#x0A;rm -f sqlwords.h&#x0D;&#x0A;gperf -aCDGptr -Kkeiiyword -L ANSI-C -k1,2,3,6,9,$ sqlwords.gperf -Nlex_hash_kw | sed -e 's/char \*keyword/char *keiiyword/g' >sqlwords.h&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)\sqlwords.h"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\turtle_l.l"
-				>
+				RelativePath="..\libsrc\Wi\turtle_l.l"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f turtle_l.c&#x0D;&#x0A;flex -8 -Pttlyy -oturtle_l.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f turtle_l.c&#x0D;&#x0A;flex -8 -Pttlyy -oturtle_l.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						AdditionalDependencies="$(InputDir)turtle_p.h"
-						Outputs="$(InputDir)turtle_l.c"
-					/>
+						Outputs="$(InputDir)turtle_l.c"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f turtle_l.c&#x0D;&#x0A;flex -8 -Pttlyy -oturtle_l.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f turtle_l.c&#x0D;&#x0A;flex -8 -Pttlyy -oturtle_l.c $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						AdditionalDependencies="$(InputDir)turtle_p.h"
-						Outputs="$(InputDir)turtle_l.c"
-					/>
+						Outputs="$(InputDir)turtle_l.c"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\turtle_p.y"
-				>
+				RelativePath="..\libsrc\Wi\turtle_p.y"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f turtle_p.c&#x0D;&#x0A;rm -f turtle_p.h&#x0D;&#x0A;bison -y -vd -pttlyy turtle_p.y -oturtle_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)turtle_p.c;$(InputDir)turtle_p.h"
-					/>
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f turtle_p.c&#x0D;&#x0A;rm -f turtle_p.h&#x0D;&#x0A;bison -y -vd -pttlyy turtle_p.y -oturtle_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)turtle_p.c;$(InputDir)turtle_p.h"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f turtle_p.c&#x0D;&#x0A;rm -f turtle_p.h&#x0D;&#x0A;bison -y -vd -pttlyy turtle_p.y -oturtle_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)turtle_p.c;$(InputDir)turtle_p.h"
-					/>
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f turtle_p.c&#x0D;&#x0A;rm -f turtle_p.h&#x0D;&#x0A;bison -y -vd -pttlyy turtle_p.y -oturtle_p.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)turtle_p.c;$(InputDir)turtle_p.h"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xpathp.y"
-				>
+				RelativePath="..\libsrc\Wi\xpathp.y"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f xpathp.c&#x0D;&#x0A;rm -f xpathp.h&#x0D;&#x0A;bison -y -vd -pxpyy xpathp.y -oxpathp.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)xpathp.c;$(InputDir)xpathp.h"
-					/>
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f xpathp.c&#x0D;&#x0A;rm -f xpathp.h&#x0D;&#x0A;bison -y -vd -pxpyy xpathp.y -oxpathp.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)xpathp.c;$(InputDir)xpathp.h"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f xpathp.c&#x0D;&#x0A;rm -f xpathp.h&#x0D;&#x0A;bison -y -vd -pxpyy xpathp.y -oxpathp.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
-						Outputs="$(InputDir)xpathp.c;$(InputDir)xpathp.h"
-					/>
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f xpathp.c&#x0D;&#x0A;rm -f xpathp.h&#x0D;&#x0A;bison -y -vd -pxpyy xpathp.y -oxpathp.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						Outputs="$(InputDir)xpathp.c;$(InputDir)xpathp.h"
+					/>
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\xpscn.l"
-				>
+				RelativePath="..\libsrc\Wi\xpscn.l"
+				>
 				<FileConfiguration
-					Name="Release|Win32"
-					>
+					Name="Release|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f xpscn_vsnet.c&#x0D;&#x0A;flex -i -oxpscn_vsnet.c -Pxpyy $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f xpscn_vsnet.c&#x0D;&#x0A;flex -i -oxpscn_vsnet.c -Pxpyy $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						AdditionalDependencies="$(InputDir)xpathp.h"
-						Outputs="$(InputDir)xpscn_vsnet.c"
-					/>
+						Outputs="$(InputDir)xpscn_vsnet.c"
+					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
-					>
+					Name="Debug|Win32"
+					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f xpscn_vsnet.c&#x0D;&#x0A;flex -i -oxpscn_vsnet.c -Pxpyy $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="&#x0D;&#x0A;cd $(InputDir)&#x0D;&#x0A;rm -f xpscn_vsnet.c&#x0D;&#x0A;flex -i -oxpscn_vsnet.c -Pxpyy $(InputPath)&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						AdditionalDependencies="$(InputDir)xpathp.h"
-						Outputs="$(InputDir)xpscn_vsnet.c"
-					/>
+						Outputs="$(InputDir)xpscn_vsnet.c"
+					/>
 				</FileConfiguration>
 			</File>
 		</Filter>
diff --git a/win64/hosting_python.vcproj b/win64/hosting_python.vcproj
index f37971c..cd1eb59 100644
--- a/win64/hosting_python.vcproj
+++ b/win64/hosting_python.vcproj
@@ -180,7 +180,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386  $(PYTHON_LDFLAGS)"
+				AdditionalOptions="/MACHINE:I386 $(PYTHON_LDFLAGS)"
 				AdditionalDependencies="dk1t.lib threadw.lib util.lib odbc32.lib odbccp32.lib ws2_32.lib libeay32.lib ssleay32.lib"
 				OutputFile="$(ConfigurationName)/hosting_python.dll"
 				LinkIncremental="1"
@@ -279,7 +279,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386 $(PYTHON_LDFLAGS)"
+				AdditionalOptions="/MACHINE:I386  $(PYTHON_LDFLAGS)"
 				AdditionalDependencies="dk1t.lib threadw.lib util.lib odbc32.lib odbccp32.lib ws2_32.lib libeay32.lib ssleay32.lib"
 				OutputFile="$(ConfigurationName)/hosting_python.dll"
 				LinkIncremental="1"
diff --git a/win64/libvirtuoso_odbc_t.vcproj b/win64/libvirtuoso_odbc_t.vcproj
index 0fa5c17..f815ee9 100644
--- a/win64/libvirtuoso_odbc_t.vcproj
+++ b/win64/libvirtuoso_odbc_t.vcproj
@@ -46,7 +46,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\libsrc\xml.new,..\libsrc,..\libsrc\Dk,..\libsrc\util\win32,..\libsrc\Wi,..\libsrc\zlib,..\binsrc\driver,..\libsrc\plugin,..\libsrc\langfunc,..\libsrc\openssl, ."
-				PreprocessorDefinitions="_SSL;_CONSOLE;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;SHARED_OBJECT;PACKAGE_VERSION=\"6.1.1\""
+				PreprocessorDefinitions="_SSL;_CONSOLE;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;SHARED_OBJECT;PACKAGE_VERSION="6.1.3""
 				MinimalRebuild="true"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="0"
@@ -132,7 +132,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\libsrc\xml.new,..\libsrc,..\libsrc\Dk,..\libsrc\util\win32,..\libsrc\Wi,..\libsrc\zlib,..\binsrc\driver,..\libsrc\plugin,..\libsrc\langfunc,..\libsrc\openssl, ."
-				PreprocessorDefinitions="_SSL;_CONSOLE;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;SHARED_OBJECT;PACKAGE_VERSION=\"6.1.1\""
+				PreprocessorDefinitions="_SSL;_CONSOLE;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;SHARED_OBJECT;PACKAGE_VERSION=\"6.1.3\""
 				MinimalRebuild="true"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="0"
@@ -305,7 +305,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="3"
 				AdditionalIncludeDirectories="..\libsrc\xml.new,..\libsrc,..\libsrc\Dk,..\libsrc\util\win32,..\libsrc\Wi,..\libsrc\zlib,..\binsrc\driver,..\libsrc\plugin,..\libsrc\langfunc,..\libsrc\openssl, ."
-				PreprocessorDefinitions="_SSL;_CONSOLE;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;SHARED_OBJECT;NDEBUG;PACKAGE_VERSION=\"6.1.1\""
+				PreprocessorDefinitions="PACKAGE_VERSION=\"6.1.3\";_SSL;_CONSOLE;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;SHARED_OBJECT;NDEBUG"
 				MinimalRebuild="false"
 				ExceptionHandling="0"
 				BasicRuntimeChecks="0"
@@ -332,7 +332,7 @@
 				AdditionalDependencies="threadw.lib wi.lib dksrv.lib util.lib xml.lib zlib.lib ws2_32.lib libeay32.lib ssleay32.lib tidy.lib"
 				OutputFile="$(OutDir)/libvirtuoso-t.dll"
 				LinkIncremental="0"
-				AdditionalLibraryDirectories=""$(ConfigurationName)";.\openssl"
+				AdditionalLibraryDirectories=""$(ConfigurationName)";.\openssl;"
 				IgnoreDefaultLibraryNames="LIBCMT"
 				ModuleDefinitionFile="..\binsrc\virtuoso\libviwin32.def"
 				GenerateDebugInformation="false"
diff --git a/win64/virtuoso-opensource.sln b/win64/virtuoso-opensource.sln
index 52cad51..ae614ea 100644
--- a/win64/virtuoso-opensource.sln
+++ b/win64/virtuoso-opensource.sln
@@ -108,7 +108,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvirtuoso_t", "libvirtuos
 		{031DB868-5294-4738-90BA-F80BB2CEA9DC} = {031DB868-5294-4738-90BA-F80BB2CEA9DC}
 		{86645C8E-3BBE-4E1E-A8AE-C6990B4ECC64} = {86645C8E-3BBE-4E1E-A8AE-C6990B4ECC64}
 		{58867EBA-CA07-4F41-A966-6245FF14773E} = {58867EBA-CA07-4F41-A966-6245FF14773E}
-		{D9E130E1-7734-43DF-A7EF-15CD95E467EE} = {D9E130E1-7734-43DF-A7EF-15CD95E467EE}
 		{0C234EF0-7725-4BDA-A1C3-47F5835A3837} = {0C234EF0-7725-4BDA-A1C3-47F5835A3837}
 	EndProjectSection
 EndProject
@@ -208,7 +207,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "virtuoso_t", "virtuoso_odbc
 		{031DB868-5294-4738-90BA-F80BB2CEA9DC} = {031DB868-5294-4738-90BA-F80BB2CEA9DC}
 		{86645C8E-3BBE-4E1E-A8AE-C6990B4ECC64} = {86645C8E-3BBE-4E1E-A8AE-C6990B4ECC64}
 		{58867EBA-CA07-4F41-A966-6245FF14773E} = {58867EBA-CA07-4F41-A966-6245FF14773E}
-		{D9E130E1-7734-43DF-A7EF-15CD95E467EE} = {D9E130E1-7734-43DF-A7EF-15CD95E467EE}
 		{0C234EF0-7725-4BDA-A1C3-47F5835A3837} = {0C234EF0-7725-4BDA-A1C3-47F5835A3837}
 	EndProjectSection
 EndProject
@@ -751,6 +749,7 @@ Global
 		{02AD88A0-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.ActiveCfg = Release|Win32
 		{02AD88A0-CF7B-11DA-85E2-A4E5714C712A}.Release|Win32.Build.0 = Release|Win32
 		{02AD88A0-CF7B-11DA-85E2-A4E5714C712A}.Release|x64.ActiveCfg = Release|x64
+		{02AD88A0-CF7B-11DA-85E2-A4E5714C712A}.Release|x64.Build.0 = Release|x64
 		{02AD88A0-CF7B-11DA-85E2-A4E5714C712A}.Release|x86.ActiveCfg = Release|x64
 		{0E838FA8-CF7B-11DA-85E2-A4E5714C712A}.Debug|Any CPU.ActiveCfg = Debug|Win32
 		{0E838FA8-CF7B-11DA-85E2-A4E5714C712A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
@@ -1108,6 +1107,7 @@ Global
 		{408E2482-2623-11DB-9BB9-97600548391D}.Release|Win32.ActiveCfg = Release|Win32
 		{408E2482-2623-11DB-9BB9-97600548391D}.Release|Win32.Build.0 = Release|Win32
 		{408E2482-2623-11DB-9BB9-97600548391D}.Release|x64.ActiveCfg = Release|x64
+		{408E2482-2623-11DB-9BB9-97600548391D}.Release|x64.Build.0 = Release|x64
 		{408E2482-2623-11DB-9BB9-97600548391D}.Release|x86.ActiveCfg = Release|Win32
 		{5582D8D0-DB93-11DB-930B-CD6B662399AA}.Debug|Any CPU.ActiveCfg = Debug|x64
 		{5582D8D0-DB93-11DB-930B-CD6B662399AA}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
diff --git a/win64/virtuoso_odbc_clr_t.vcproj b/win64/virtuoso_odbc_clr_t.vcproj
index e5172de..6f005d9 100644
--- a/win64/virtuoso_odbc_clr_t.vcproj
+++ b/win64/virtuoso_odbc_clr_t.vcproj
@@ -388,6 +388,10 @@
 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
 			>
+			<File
+				RelativePath="..\win32\virtuoso_t.rc"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="PreBuild"
@@ -449,7 +453,7 @@
 					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="cd $(InputDir)&#x0D;&#x0A;rm -f sql_code_clr.c&#x0D;&#x0A;gawk -f ../../../libsrc/Wi/sql_to_c.awk -v init_name=_xslt pass_bootstrap_cli=1 pl_stats=PLDBG $(InputPath) > sql_code_xslt.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="cd $(InputDir)&#x0D;&#x0A;rm -f sql_code_xslt.c&#x0D;&#x0A;gawk -f ../../../libsrc/Wi/sql_to_c.awk -v init_name=_xslt pass_bootstrap_cli=1 pl_stats=PLDBG $(InputFileName) > sql_code_xslt.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						Outputs="$(InputDir)\sql_code_xslt.c"
 					/>
 				</FileConfiguration>
@@ -467,7 +471,7 @@
 					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="cd $(InputDir)&#x0D;&#x0A;rm -f sql_code_clr.c&#x0D;&#x0A;gawk -f ../../../libsrc/Wi/sql_to_c.awk -v init_name=_xslt pass_bootstrap_cli=1 pl_stats=PLDBG $(InputPath) > sql_code_xslt.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="cd $(InputDir)&#x0D;&#x0A;rm -f sql_code_xslt.c&#x0D;&#x0A;gawk -f ../../../libsrc/Wi/sql_to_c.awk -v init_name=_xslt pass_bootstrap_cli=1 pl_stats=PLDBG $(InputFileName) > sql_code_xslt.c&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
 						Outputs="$(InputDir)\sql_code_xslt.c"
 					/>
 				</FileConfiguration>
diff --git a/win64/virtuoso_odbc_javavm_t.vcproj b/win64/virtuoso_odbc_javavm_t.vcproj
index d3375d7..d37cf62 100644
--- a/win64/virtuoso_odbc_javavm_t.vcproj
+++ b/win64/virtuoso_odbc_javavm_t.vcproj
@@ -378,6 +378,10 @@
 				RelativePath="..\binsrc\tests\biftest\sql_code_xslt.c"
 				>
 			</File>
+			<File
+				RelativePath="..\win32\virtuoso_t.rc"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Header Files"
@@ -451,7 +455,7 @@
 					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="cd $(InputDir)&#x0D;&#x0A;&#x0D;&#x0A;rm -f sql_code_clr.c&#x0D;&#x0A;gawk -f ../../../libsrc/Wi/sql_to_c.awk -v init_name=_xslt pass_bootstrap_cli=1 pl_stats=PLDBG $(InputPath) > sql_code_xslt.c&#x0D;&#x0A;&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="cd $(InputDir)&#x0D;&#x0A;&#x0D;&#x0A;rm -f sql_code_xslt.c &#x0D;&#x0A;gawk -f ../../../libsrc/Wi/sql_to_c.awk -v init_name=_xslt pass_bootstrap_cli=1 pl_stats=PLDBG $(InputFileName) > sql_code_xslt.c&#x0D;&#x0A;&#x0D;&#x0A;cd $(ProjectDir)"
 						Outputs="$(InputDir)\sql_code_xslt.c"
 					/>
 				</FileConfiguration>
@@ -469,7 +473,7 @@
 					>
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="cd $(InputDir)&#x0D;&#x0A;&#x0D;&#x0A;rm -f sql_code_clr.c&#x0D;&#x0A;gawk -f ../../../libsrc/Wi/sql_to_c.awk -v init_name=_xslt pass_bootstrap_cli=1 pl_stats=PLDBG $(InputPath) > sql_code_xslt.c&#x0D;&#x0A;&#x0D;&#x0A;cd $(ProjectDir)&#x0D;&#x0A;"
+						CommandLine="cd $(InputDir)&#x0D;&#x0A;&#x0D;&#x0A;rm -f sql_code_xslt.c &#x0D;&#x0A;gawk -f ../../../libsrc/Wi/sql_to_c.awk -v init_name=_xslt pass_bootstrap_cli=1 pl_stats=PLDBG $(InputFileName) > sql_code_xslt.c&#x0D;&#x0A;&#x0D;&#x0A;cd $(ProjectDir)"
 						Outputs="$(InputDir)\sql_code_xslt.c"
 					/>
 				</FileConfiguration>
diff --git a/win64/virtuoso_odbc_sample_t.vcproj b/win64/virtuoso_odbc_sample_t.vcproj
index 8f060a0..7e96e89 100644
--- a/win64/virtuoso_odbc_sample_t.vcproj
+++ b/win64/virtuoso_odbc_sample_t.vcproj
@@ -4,6 +4,7 @@
 	Version="9.00"
 	Name="virtuoso_sample_t"
 	ProjectGUID="{0E838FA8-CF7B-11DA-85E2-A4E5714C712A}"
+	RootNamespace="virtuoso_sample_t"
 	Keyword="Win32Proj"
 	TargetFrameworkVersion="131072"
 	>
@@ -363,6 +364,10 @@
 				RelativePath="..\binsrc\tests\biftest\bif_sample.c"
 				>
 			</File>
+			<File
+				RelativePath="..\win32\virtuoso_t.rc"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Header Files"
diff --git a/win64/virtuoso_odbc_t.vcproj b/win64/virtuoso_odbc_t.vcproj
index 22590b7..02e2073 100644
--- a/win64/virtuoso_odbc_t.vcproj
+++ b/win64/virtuoso_odbc_t.vcproj
@@ -49,7 +49,7 @@
 				AdditionalOptions="/Zm200 "
 				Optimization="3"
 				AdditionalIncludeDirectories="..\libsrc\xml.new,..\libsrc,..\libsrc\Dk,..\libsrc\util\win32,..\libsrc\Wi,..\libsrc\zlib,..\binsrc\driver,..\libsrc\plugin,..\libsrc\langfunc,..\libsrc\openssl, ."
-				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG;PACKAGE_VERSION=\"6.1.1\""
+				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG;PACKAGE_VERSION="6.1.3""
 				MinimalRebuild="true"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="1"
@@ -142,7 +142,7 @@
 				AdditionalOptions="/Zm200 "
 				Optimization="0"
 				AdditionalIncludeDirectories="..\libsrc\xml.new,..\libsrc,..\libsrc\Dk,..\libsrc\util\win32,..\libsrc\Wi,..\libsrc\zlib,..\binsrc\driver,..\libsrc\plugin,..\libsrc\langfunc,..\libsrc\openssl, ."
-				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG;PACKAGE_VERSION=\"6.1.1\""
+				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG;PACKAGE_VERSION=\"6.1.3\""
 				MinimalRebuild="true"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="1"
@@ -327,7 +327,7 @@
 				Name="VCCLCompilerTool"
 				Optimization="3"
 				AdditionalIncludeDirectories="..\libsrc\xml.new,..\libsrc,..\libsrc\Dk,..\libsrc\util\win32,..\libsrc\Wi,..\libsrc\zlib,..\binsrc\driver,..\libsrc\plugin,..\libsrc\langfunc,..\libsrc\openssl, ."
-				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG;PACKAGE_VERSION=\"6.1.1\""
+				PreprocessorDefinitions="PACKAGE_VERSION=\"6.1.3\";_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG"
 				MinimalRebuild="false"
 				ExceptionHandling="0"
 				BasicRuntimeChecks="0"
@@ -355,11 +355,11 @@
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="/MACHINE:AMD64"
-				AdditionalDependencies="threadw.lib wi.lib dksrv.lib util.lib xml.lib zlib.lib ws2_32.lib libeay32.lib ssleay32.lib"
+				AdditionalDependencies="threadw.lib wi.lib dksrv.lib util.lib xml.lib zlib.lib ws2_32.lib libeay32.lib ssleay32.lib tidy.lib"
 				OutputFile="$(ConfigurationName)/virtuoso-t.exe"
 				LinkIncremental="1"
 				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories="$(ConfigurationName);.\openssl;..\libsrc\openssl"
+				AdditionalLibraryDirectories=""$(ConfigurationName)";.\openssl;..\libsrc\openssl"
 				IgnoreDefaultLibraryNames="LIBCMT"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(ConfigurationName)/virtuoso_t.pdb"
@@ -407,6 +407,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\win32\virtuoso_t.rc"
+				>
+			</File>
+			<File
 				RelativePath="..\binsrc\virtuoso\viwin32.c"
 				>
 			</File>
diff --git a/win64/wi.vcproj b/win64/wi.vcproj
index 512119d..56e6fd2 100644
--- a/win64/wi.vcproj
+++ b/win64/wi.vcproj
@@ -124,8 +124,8 @@
 				Name="VCCLCompilerTool"
 				AdditionalOptions=""
 				Optimization="3"
-				AdditionalIncludeDirectories="..\libsrc\zlib;..\libsrc\xml.new;..\libsrc;..\libsrc\Dk;..\libsrc\util\win32;..\libsrc\Wi;..\libsrc\plugin;..\libsrc\langfunc;..\libsrc\tidy;..\binsrc\driver;."
-				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG;YY_NO_UNISTD_H;_CRT_SECURE_NO_DEPRECATE;PCRE_STATIC"
+				AdditionalIncludeDirectories="..\libsrc\zlib;..\libsrc\xml.new;..\libsrc;..\libsrc\Dk;..\libsrc\util\win32;..\libsrc\Wi;..\libsrc\plugin;..\libsrc\langfunc;"$(InputDir)\tidy";..\binsrc\driver;.;..\libsrc\Tidy"
+				PreprocessorDefinitions="_IMSG;_SSL;_LIBC;INPROCESS_CLIENT;_MBCS;WIN32;WINDOWS;_Windows;BIF_XML;REPLICATION_SUPPORT=1;REPLICATION_SUPPORT2=1;VIRTUAL_DIR;BIF_XPER;BIF_TIDY;VIRTTP;INC_BACKUP;VAD;_LDAP;YYTOKENTYPE;PLDBG;NDEBUG;YY_NO_UNISTD_H;_CRT_SECURE_NO_DEPRECATE;PCRE_STATIC;OLD_TIDY"
 				MinimalRebuild="false"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="0"
@@ -383,6 +383,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\libsrc\Wi\bif_imap.c"
+				>
+			</File>
+			<File
 				RelativePath="..\libsrc\Wi\bif_intl.c"
 				>
 			</File>
@@ -659,22 +663,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\libsrc\Wi\repldb.c"
-				>
-			</File>
-			<File
-				RelativePath="..\libsrc\Wi\replpush.c"
-				>
-			</File>
-			<File
-				RelativePath="..\libsrc\Wi\replsri.c"
-				>
-			</File>
-			<File
-				RelativePath="..\libsrc\Wi\replsub.c"
-				>
-			</File>
-			<File
 				RelativePath="..\libsrc\Wi\rltrx.c"
 				>
 			</File>
@@ -739,6 +727,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\libsrc\Wi\sparql_rdb2rdf.c"
+				>
+			</File>
+			<File
 				RelativePath="..\libsrc\Wi\sparql_sff.c"
 				>
 			</File>
@@ -1567,6 +1559,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\libsrc\Wi\uname_const_decl.c"
+				>
+			</File>
+			<File
 				RelativePath="..\libsrc\Wi\update.c"
 				>
 			</File>

-- 
Git repository for pkg-virtuoso



More information about the Pkg-virtuoso-commits mailing list